From: Andrea Amorese Date: Wed, 26 Jan 2022 16:02:00 +0000 (+0100) Subject: Built motion from commit fb3aa52e.|2.6.0 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22angular-material.layout.css/%22?a=commitdiff_plain;h=9f135f090e12044c14436daae9bbfd1ba1c65690;p=motion2.git Built motion from commit fb3aa52e.|2.6.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index fadebc2..3bd6e19 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-26T09:06:26.251Z", + "time": "2022-01-26T15:49:31.177Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 46c0148..e496436 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-26T09:06:26.251Z", + "time": "2022-01-26T15:49:31.177Z", "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 c820b7f..067a827 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 _0x0178=['action','STRING','contactManager','integration','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]','TEXT','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x2a5353,_0x8afbe8){var _0x14eddc=function(_0x5b33f2){while(--_0x5b33f2){_0x2a5353['push'](_0x2a5353['shift']());}};_0x14eddc(++_0x8afbe8);}(_0x0178,0xce));var _0x8017=function(_0x8b499c,_0x2557a4){_0x8b499c=_0x8b499c-0x0;var _0x580def=_0x0178[_0x8b499c];return _0x580def;};'use strict';var Sequelize=require(_0x8017('0x0'));module[_0x8017('0x1')]={'name':{'type':Sequelize[_0x8017('0x2')],'get':function(_0x1d75ed){return this[_0x8017('0x3')](_0x8017('0x4'));}},'action':{'type':Sequelize[_0x8017('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8017('0x6'),_0x8017('0x7'),'motionbar','jscripty',_0x8017('0x8'),_0x8017('0x9'),'bot',_0x8017('0xa')]],'msg':_0x8017('0xb')}},'comment':_0x8017('0xb')},'data1':{'type':Sequelize[_0x8017('0x5')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x8017('0x5')](0x1000),'comment':_0x8017('0xc')},'data3':{'type':Sequelize[_0x8017('0x5')](0x1000),'comment':_0x8017('0xd')},'data4':{'type':Sequelize[_0x8017('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x8017('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x8017('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x8017('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xdb61=['browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward'];(function(_0xa185e4,_0x26bf97){var _0x1f75c3=function(_0x5297ae){while(--_0x5297ae){_0xa185e4['push'](_0xa185e4['shift']());}};_0x1f75c3(++_0x26bf97);}(_0xdb61,0xfb));var _0x1db6=function(_0x22b65d,_0x49e69c){_0x22b65d=_0x22b65d-0x0;var _0x1e56f8=_0xdb61[_0x22b65d];return _0x1e56f8;};'use strict';var Sequelize=require(_0x1db6('0x0'));module['exports']={'name':{'type':Sequelize[_0x1db6('0x1')],'get':function(_0x16ecef){return this[_0x1db6('0x2')]('action');}},'action':{'type':Sequelize[_0x1db6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1db6('0x4'),_0x1db6('0x5'),_0x1db6('0x6'),_0x1db6('0x7'),_0x1db6('0x8'),_0x1db6('0x9'),_0x1db6('0xa'),'script']],'msg':_0x1db6('0xb')}},'comment':_0x1db6('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x1db6('0xc')},'data2':{'type':Sequelize[_0x1db6('0x3')](0x1000),'comment':_0x1db6('0xd')},'data3':{'type':Sequelize[_0x1db6('0x3')](0x1000),'comment':_0x1db6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x1db6('0xf')},'data5':{'type':Sequelize[_0x1db6('0x3')](0x1000),'comments':_0x1db6('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x1db6('0x11')},'data7':{'type':Sequelize[_0x1db6('0x12')],'comments':_0x1db6('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b0f70b3..0d50ea6 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 _0x5a24=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','find','params','Action','catch','eml-format'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0x5a24,0x12b));var _0x45a2=function(_0x2fb5c7,_0x490b22){_0x2fb5c7=_0x2fb5c7-0x0;var _0x4eebe2=_0x5a24[_0x2fb5c7];return _0x4eebe2;};'use strict';var emlformat=require(_0x45a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45a2('0x1'));var jsonpatch=require(_0x45a2('0x2'));var rp=require(_0x45a2('0x3'));var moment=require(_0x45a2('0x4'));var BPromise=require(_0x45a2('0x5'));var Mustache=require('mustache');var util=require(_0x45a2('0x6'));var path=require(_0x45a2('0x7'));var sox=require(_0x45a2('0x8'));var csv=require(_0x45a2('0x9'));var ejs=require(_0x45a2('0xa'));var fs=require('fs');var fs_extra=require(_0x45a2('0xb'));var _=require(_0x45a2('0xc'));var squel=require(_0x45a2('0xd'));var crypto=require(_0x45a2('0xe'));var jsforce=require(_0x45a2('0xf'));var deskjs=require(_0x45a2('0x10'));var toCsv=require(_0x45a2('0x9'));var querystring=require('querystring');var Papa=require(_0x45a2('0x11'));var Redis=require(_0x45a2('0x12'));var authService=require(_0x45a2('0x13'));var qs=require(_0x45a2('0x14'));var as=require(_0x45a2('0x15'));var hardwareService=require(_0x45a2('0x16'));var logger=require(_0x45a2('0x17'))(_0x45a2('0x18'));var utils=require(_0x45a2('0x19'));var config=require(_0x45a2('0x1a'));var licenseUtil=require(_0x45a2('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32a690,_0x560bd2){_0x560bd2=_0x560bd2||0xcc;return function(_0x510735){if(_0x510735){return _0x32a690[_0x45a2('0x1c')](_0x560bd2);}return _0x32a690[_0x45a2('0x1d')](_0x560bd2)['end']();};}function respondWithResult(_0x1e0169,_0x23bb9f){_0x23bb9f=_0x23bb9f||0xc8;return function(_0x275f63){if(_0x275f63){return _0x1e0169[_0x45a2('0x1d')](_0x23bb9f)['json'](_0x275f63);}};}function respondWithFilteredResult(_0x2be0a4,_0x25bcb2){return function(_0x510a06){if(_0x510a06){var _0x55143f=typeof _0x25bcb2[_0x45a2('0x1e')]==='undefined'&&typeof _0x25bcb2[_0x45a2('0x1f')]===_0x45a2('0x20');var _0x468b5b=_0x510a06[_0x45a2('0x21')];var _0x47eb95=_0x55143f?0x0:_0x25bcb2[_0x45a2('0x1e')];var _0x304471=_0x55143f?_0x510a06[_0x45a2('0x21')]:_0x25bcb2[_0x45a2('0x1e')]+_0x25bcb2[_0x45a2('0x1f')];var _0x29ee2c;if(_0x304471>=_0x468b5b){_0x304471=_0x468b5b;_0x29ee2c=0xc8;}else{_0x29ee2c=0xce;}_0x2be0a4[_0x45a2('0x1d')](_0x29ee2c);return _0x2be0a4[_0x45a2('0x22')](_0x45a2('0x23'),_0x47eb95+'-'+_0x304471+'/'+_0x468b5b)['json'](_0x510a06);}return null;};}function patchUpdates(_0xb31f3b){return function(_0x36f401){try{jsonpatch['apply'](_0x36f401,_0xb31f3b,!![]);}catch(_0x286e7c){return BPromise[_0x45a2('0x24')](_0x286e7c);}return _0x36f401[_0x45a2('0x25')]();};}function saveUpdates(_0x367532,_0x479db6){return function(_0x19c412){if(_0x19c412){return _0x19c412[_0x45a2('0x26')](_0x367532)[_0x45a2('0x27')](function(_0x11e384){return _0x11e384;});}return null;};}function removeEntity(_0x1ff623,_0xafd98f){return function(_0x1768dc){if(_0x1768dc){return _0x1768dc[_0x45a2('0x28')]()[_0x45a2('0x27')](function(){_0x1ff623['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x140b1d,_0x504046){return function(_0x1f5a5b){if(!_0x1f5a5b){_0x140b1d[_0x45a2('0x1c')](0x194);}return _0x1f5a5b;};}function handleError(_0x5734f2,_0x4d9bbe){_0x4d9bbe=_0x4d9bbe||0x1f4;return function(_0x44d43f){logger[_0x45a2('0x29')](_0x44d43f[_0x45a2('0x2a')]);if(_0x44d43f['name']){delete _0x44d43f[_0x45a2('0x2b')];}_0x5734f2[_0x45a2('0x1d')](_0x4d9bbe)[_0x45a2('0x2c')](_0x44d43f);};}exports[_0x45a2('0x26')]=function(_0x14911a,_0x78da16){if(_0x14911a[_0x45a2('0x2d')]['id']){delete _0x14911a[_0x45a2('0x2d')]['id'];}return db['Action'][_0x45a2('0x2e')]({'where':{'id':_0x14911a[_0x45a2('0x2f')]['id']}})['then'](handleEntityNotFound(_0x78da16,null))[_0x45a2('0x27')](saveUpdates(_0x14911a[_0x45a2('0x2d')],null))[_0x45a2('0x27')](respondWithResult(_0x78da16,null))['catch'](handleError(_0x78da16,null));};exports['destroy']=function(_0x376c33,_0x37e4d1){return db[_0x45a2('0x30')][_0x45a2('0x2e')]({'where':{'id':_0x376c33[_0x45a2('0x2f')]['id']}})[_0x45a2('0x27')](handleEntityNotFound(_0x37e4d1,null))['then'](removeEntity(_0x37e4d1,null))[_0x45a2('0x31')](handleError(_0x37e4d1,null));}; \ No newline at end of file +var _0x47bd=['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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5f124b,_0x565008){var _0x290a99=function(_0x3cf988){while(--_0x3cf988){_0x5f124b['push'](_0x5f124b['shift']());}};_0x290a99(++_0x565008);}(_0x47bd,0x8f));var _0xd47b=function(_0x44bf8e,_0x118d11){_0x44bf8e=_0x44bf8e-0x0;var _0x5339f3=_0x47bd[_0x44bf8e];return _0x5339f3;};'use strict';var emlformat=require(_0xd47b('0x0'));var rimraf=require(_0xd47b('0x1'));var zipdir=require(_0xd47b('0x2'));var jsonpatch=require(_0xd47b('0x3'));var rp=require(_0xd47b('0x4'));var moment=require(_0xd47b('0x5'));var BPromise=require(_0xd47b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd47b('0x7'));var csv=require(_0xd47b('0x8'));var ejs=require(_0xd47b('0x9'));var fs=require('fs');var fs_extra=require(_0xd47b('0xa'));var _=require(_0xd47b('0xb'));var squel=require(_0xd47b('0xc'));var crypto=require(_0xd47b('0xd'));var jsforce=require(_0xd47b('0xe'));var deskjs=require(_0xd47b('0xf'));var toCsv=require(_0xd47b('0x8'));var querystring=require(_0xd47b('0x10'));var Papa=require(_0xd47b('0x11'));var Redis=require(_0xd47b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd47b('0x13'));var as=require(_0xd47b('0x14'));var hardwareService=require(_0xd47b('0x15'));var logger=require(_0xd47b('0x16'))(_0xd47b('0x17'));var utils=require(_0xd47b('0x18'));var config=require(_0xd47b('0x19'));var licenseUtil=require(_0xd47b('0x1a'));var db=require(_0xd47b('0x1b'))['db'];function respondWithStatusCode(_0x59639c,_0x5af77f){_0x5af77f=_0x5af77f||0xcc;return function(_0x1b8df6){if(_0x1b8df6){return _0x59639c['sendStatus'](_0x5af77f);}return _0x59639c[_0xd47b('0x1c')](_0x5af77f)[_0xd47b('0x1d')]();};}function respondWithResult(_0x116d70,_0x13f83c){_0x13f83c=_0x13f83c||0xc8;return function(_0x23b921){if(_0x23b921){return _0x116d70[_0xd47b('0x1c')](_0x13f83c)['json'](_0x23b921);}};}function respondWithFilteredResult(_0xd5070a,_0x13cf1f){return function(_0x29049b){if(_0x29049b){var _0x3120fa=typeof _0x13cf1f[_0xd47b('0x1e')]===_0xd47b('0x1f')&&typeof _0x13cf1f[_0xd47b('0x20')]===_0xd47b('0x1f');var _0x443aba=_0x29049b[_0xd47b('0x21')];var _0x5b7037=_0x3120fa?0x0:_0x13cf1f[_0xd47b('0x1e')];var _0x25e4d5=_0x3120fa?_0x29049b['count']:_0x13cf1f['offset']+_0x13cf1f[_0xd47b('0x20')];var _0x2b25b7;if(_0x25e4d5>=_0x443aba){_0x25e4d5=_0x443aba;_0x2b25b7=0xc8;}else{_0x2b25b7=0xce;}_0xd5070a[_0xd47b('0x1c')](_0x2b25b7);return _0xd5070a[_0xd47b('0x22')](_0xd47b('0x23'),_0x5b7037+'-'+_0x25e4d5+'/'+_0x443aba)[_0xd47b('0x24')](_0x29049b);}return null;};}function patchUpdates(_0x4ed2fb){return function(_0x2e90c2){try{jsonpatch[_0xd47b('0x25')](_0x2e90c2,_0x4ed2fb,!![]);}catch(_0x5a5680){return BPromise[_0xd47b('0x26')](_0x5a5680);}return _0x2e90c2[_0xd47b('0x27')]();};}function saveUpdates(_0x33079a,_0x5d53f7){return function(_0x1027d7){if(_0x1027d7){return _0x1027d7[_0xd47b('0x28')](_0x33079a)[_0xd47b('0x29')](function(_0x17aa9c){return _0x17aa9c;});}return null;};}function removeEntity(_0xcad8c2,_0x10a050){return function(_0x53a431){if(_0x53a431){return _0x53a431[_0xd47b('0x2a')]()[_0xd47b('0x29')](function(){_0xcad8c2[_0xd47b('0x1c')](0xcc)[_0xd47b('0x1d')]();});}};}function handleEntityNotFound(_0x187702,_0x511a44){return function(_0x32359f){if(!_0x32359f){_0x187702[_0xd47b('0x2b')](0x194);}return _0x32359f;};}function handleError(_0x2c7841,_0x3c8dcc){_0x3c8dcc=_0x3c8dcc||0x1f4;return function(_0x1be2ba){logger[_0xd47b('0x2c')](_0x1be2ba[_0xd47b('0x2d')]);if(_0x1be2ba[_0xd47b('0x2e')]){delete _0x1be2ba[_0xd47b('0x2e')];}_0x2c7841[_0xd47b('0x1c')](_0x3c8dcc)[_0xd47b('0x2f')](_0x1be2ba);};}exports[_0xd47b('0x28')]=function(_0xd486e0,_0x40bdca){if(_0xd486e0[_0xd47b('0x30')]['id']){delete _0xd486e0['body']['id'];}return db[_0xd47b('0x31')][_0xd47b('0x32')]({'where':{'id':_0xd486e0[_0xd47b('0x33')]['id']}})['then'](handleEntityNotFound(_0x40bdca,null))[_0xd47b('0x29')](saveUpdates(_0xd486e0[_0xd47b('0x30')],null))[_0xd47b('0x29')](respondWithResult(_0x40bdca,null))[_0xd47b('0x34')](handleError(_0x40bdca,null));};exports[_0xd47b('0x2a')]=function(_0x355321,_0x4f0a41){return db[_0xd47b('0x31')]['find']({'where':{'id':_0x355321[_0xd47b('0x33')]['id']}})[_0xd47b('0x29')](handleEntityNotFound(_0x4f0a41,null))[_0xd47b('0x29')](removeEntity(_0x4f0a41,null))[_0xd47b('0x34')](handleError(_0x4f0a41,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bc8cb5d..f9a63fb 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 _0xbe60=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xbe60,0x1bc));var _0x0be6=function(_0x57c8a1,_0x3ae71c){_0x57c8a1=_0x57c8a1-0x0;var _0x305355=_0xbe60[_0x57c8a1];return _0x305355;};'use strict';var _=require(_0x0be6('0x0'));var util=require(_0x0be6('0x1'));var logger=require(_0x0be6('0x2'))(_0x0be6('0x3'));var moment=require('moment');var BPromise=require(_0x0be6('0x4'));var rp=require(_0x0be6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0be6('0x6'));var config=require('../../config/environment');var attributes=require(_0x0be6('0x7'));module[_0x0be6('0x8')]=function(_0x5d7e81,_0xeb8019){return _0x5d7e81[_0x0be6('0x9')](_0x0be6('0xa'),attributes,{'tableName':_0x0be6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea0f=['../../config/logger','bluebird','request-promise','path','./action.attributes','exports','Action','lodash','util'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xea0f,0x73));var _0xfea0=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xea0f[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require(_0xfea0('0x0'));var util=require(_0xfea0('0x1'));var logger=require(_0xfea0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfea0('0x3'));var rp=require(_0xfea0('0x4'));var fs=require('fs');var path=require(_0xfea0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfea0('0x6'));module[_0xfea0('0x7')]=function(_0x42fa58,_0x3e40c6){return _0x42fa58['define'](_0xfea0('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5c66de1..3a8eb91 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0xf494,0x1c6));var _0x4f49=function(_0x3b61b4,_0x5a975e){_0x3b61b4=_0x3b61b4-0x0;var _0x31dbfb=_0xf494[_0x3b61b4];return _0x31dbfb;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x377b06,_0x17f190){var _0x5ca47d=function(_0x44c43a){while(--_0x44c43a){_0x377b06['push'](_0x377b06['shift']());}};_0x5ca47d(++_0x17f190);}(_0x5fc3,0xa8));var _0x35fc=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5fc3[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ac8ab5f..1eed9d8 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 _0xb3b4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x502d90,_0x147708){var _0x40d080=function(_0x5ab3d7){while(--_0x5ab3d7){_0x502d90['push'](_0x502d90['shift']());}};_0x40d080(++_0x147708);}(_0xb3b4,0xa7));var _0x4b3b=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xb3b4[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x4b3b('0x0'));var util=require(_0x4b3b('0x1'));var path=require(_0x4b3b('0x2'));var timeout=require(_0x4b3b('0x3'));var express=require(_0x4b3b('0x4'));var router=express[_0x4b3b('0x5')]();var fs_extra=require(_0x4b3b('0x6'));var auth=require(_0x4b3b('0x7'));var interaction=require(_0x4b3b('0x8'));var config=require(_0x4b3b('0x9'));var controller=require(_0x4b3b('0xa'));router[_0x4b3b('0xb')](_0x4b3b('0xc'),auth[_0x4b3b('0xd')](),controller[_0x4b3b('0xe')]);router['delete'](_0x4b3b('0xc'),auth[_0x4b3b('0xd')](),controller[_0x4b3b('0xf')]);module[_0x4b3b('0x10')]=router; \ No newline at end of file +var _0x91bf=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x903cc4,_0x32f4af){var _0x104d37=function(_0x35f6c2){while(--_0x35f6c2){_0x903cc4['push'](_0x903cc4['shift']());}};_0x104d37(++_0x32f4af);}(_0x91bf,0x159));var _0xf91b=function(_0x14bd4f,_0x1caff5){_0x14bd4f=_0x14bd4f-0x0;var _0x21381c=_0x91bf[_0x14bd4f];return _0x21381c;};'use strict';var multer=require(_0xf91b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf91b('0x1'));var router=express[_0xf91b('0x2')]();var fs_extra=require(_0xf91b('0x3'));var auth=require(_0xf91b('0x4'));var interaction=require(_0xf91b('0x5'));var config=require(_0xf91b('0x6'));var controller=require(_0xf91b('0x7'));router[_0xf91b('0x8')](_0xf91b('0x9'),auth[_0xf91b('0xa')](),controller[_0xf91b('0xb')]);router[_0xf91b('0xc')]('/:id',auth[_0xf91b('0xa')](),controller[_0xf91b('0xd')]);module[_0xf91b('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b973bfd..8618bec 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 _0x4819=['TEXT','exports','STRING'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0x4819,0xcd));var _0x9481=function(_0x52a12a,_0x19ffde){_0x52a12a=_0x52a12a-0x0;var _0xf034fb=_0x4819[_0x52a12a];return _0xf034fb;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x361ba7,_0x4ffcc0){var _0x57715e=function(_0x476c27){while(--_0x476c27){_0x361ba7['push'](_0x361ba7['shift']());}};_0x57715e(++_0x4ffcc0);}(_0xe14b,0x93));var _0xbe14=function(_0x200666,_0x39f745){_0x200666=_0x200666-0x0;var _0x147b87=_0xe14b[_0x200666];return _0x147b87;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bb27643..389e5b5 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 _0xab45=['includes','IS\x20EMPTY','getFields','Sequelize','AnalyticMetric','groupBy','alias','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','ValidationErrorItem','keyBy','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','then','destroy','CustomReports','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Please\x20insert\x20at\x20least\x20one\x20field','select','from','table','MetricId','function','replace','format','orderBy','DESC','parse','joins','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','AVG(%s)','DATE(%s)'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xab45,0xc4));var _0x5ab4=function(_0x2390e5,_0x369025){_0x2390e5=_0x2390e5-0x0;var _0xa6038f=_0xab45[_0x2390e5];return _0xa6038f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ab4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ab4('0x1'));var rp=require(_0x5ab4('0x2'));var moment=require('moment');var BPromise=require(_0x5ab4('0x3'));var Mustache=require(_0x5ab4('0x4'));var util=require('util');var path=require(_0x5ab4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ab4('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5ab4('0x7'));var crypto=require(_0x5ab4('0x8'));var jsforce=require(_0x5ab4('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5ab4('0xa'));var querystring=require(_0x5ab4('0xb'));var Papa=require('papaparse');var Redis=require(_0x5ab4('0xc'));var authService=require(_0x5ab4('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5ab4('0xe'));var hardwareService=require(_0x5ab4('0xf'));var logger=require(_0x5ab4('0x10'))('api');var utils=require(_0x5ab4('0x11'));var config=require(_0x5ab4('0x12'));var licenseUtil=require(_0x5ab4('0x13'));var db=require(_0x5ab4('0x14'))['db'];var dbH=require('../../mysqldb')[_0x5ab4('0x15')];function respondWithStatusCode(_0x17d1c8,_0x14d1d7){_0x14d1d7=_0x14d1d7||0xcc;return function(_0x16ee35){if(_0x16ee35){return _0x17d1c8[_0x5ab4('0x16')](_0x14d1d7);}return _0x17d1c8[_0x5ab4('0x17')](_0x14d1d7)[_0x5ab4('0x18')]();};}function respondWithResult(_0x5dacd8,_0x3d4f92){_0x3d4f92=_0x3d4f92||0xc8;return function(_0x24cac9){if(_0x24cac9){return _0x5dacd8[_0x5ab4('0x17')](_0x3d4f92)[_0x5ab4('0x19')](_0x24cac9);}};}function respondWithFilteredResult(_0x45f7af,_0xeecd5){return function(_0x353845){if(_0x353845){var _0x544b36=typeof _0xeecd5['offset']===_0x5ab4('0x1a')&&typeof _0xeecd5[_0x5ab4('0x1b')]===_0x5ab4('0x1a');var _0x9a0f65=_0x353845['count'];var _0x50142b=_0x544b36?0x0:_0xeecd5[_0x5ab4('0x1c')];var _0x3fa704=_0x544b36?_0x353845['count']:_0xeecd5[_0x5ab4('0x1c')]+_0xeecd5[_0x5ab4('0x1b')];var _0x474935;if(_0x3fa704>=_0x9a0f65){_0x3fa704=_0x9a0f65;_0x474935=0xc8;}else{_0x474935=0xce;}_0x45f7af[_0x5ab4('0x17')](_0x474935);return _0x45f7af[_0x5ab4('0x1d')](_0x5ab4('0x1e'),_0x50142b+'-'+_0x3fa704+'/'+_0x9a0f65)['json'](_0x353845);}return null;};}function patchUpdates(_0x6e51c7){return function(_0x442e85){try{jsonpatch[_0x5ab4('0x1f')](_0x442e85,_0x6e51c7,!![]);}catch(_0x26eb11){return BPromise['reject'](_0x26eb11);}return _0x442e85['save']();};}function saveUpdates(_0x191fc4,_0x5b399b){return function(_0x5f0372){if(_0x5f0372){return _0x5f0372['update'](_0x191fc4)[_0x5ab4('0x20')](function(_0x380ac5){return _0x380ac5;});}return null;};}function removeEntity(_0x47f43d,_0x4c4e6e){return function(_0x27532a){if(_0x27532a){return _0x27532a[_0x5ab4('0x21')]()[_0x5ab4('0x20')](function(){var _0x45b9ee=_0x27532a['get']({'plain':!![]});var _0x472c6f=_0x5ab4('0x22');return db[_0x5ab4('0x23')][_0x5ab4('0x21')]({'where':{'type':_0x472c6f,'resourceId':_0x45b9ee['id']}})[_0x5ab4('0x20')](function(){return _0x27532a;});})[_0x5ab4('0x20')](function(){_0x47f43d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35da55,_0x40700e){return function(_0x61178c){if(!_0x61178c){_0x35da55[_0x5ab4('0x16')](0x194);}return _0x61178c;};}function handleError(_0x1bc612,_0x536bd8){_0x536bd8=_0x536bd8||0x1f4;return function(_0x5b8b27){logger[_0x5ab4('0x24')](_0x5b8b27['stack']);if(_0x5b8b27[_0x5ab4('0x25')]){delete _0x5b8b27[_0x5ab4('0x25')];}_0x1bc612['status'](_0x536bd8)[_0x5ab4('0x26')](_0x5b8b27);};}exports[_0x5ab4('0x27')]=function(_0x4ad93f,_0xb5e069){var _0xec2eae={},_0x5eae1b={},_0x429f3b={'count':0x0,'rows':[]};var _0x2d7b9a=_[_0x5ab4('0x28')](db[_0x5ab4('0x29')][_0x5ab4('0x2a')],function(_0x5337f9){return{'name':_0x5337f9[_0x5ab4('0x2b')],'type':_0x5337f9[_0x5ab4('0x2c')]['key']};});_0x5eae1b[_0x5ab4('0x2d')]=_[_0x5ab4('0x28')](_0x2d7b9a,_0x5ab4('0x25'));_0x5eae1b[_0x5ab4('0x2e')]=_['keys'](_0x4ad93f[_0x5ab4('0x2e')]);_0x5eae1b['filters']=_[_0x5ab4('0x2f')](_0x5eae1b[_0x5ab4('0x2d')],_0x5eae1b[_0x5ab4('0x2e')]);_0xec2eae[_0x5ab4('0x30')]=_['intersection'](_0x5eae1b[_0x5ab4('0x2d')],qs['fields'](_0x4ad93f['query'][_0x5ab4('0x31')]));_0xec2eae[_0x5ab4('0x30')]=_0xec2eae[_0x5ab4('0x30')][_0x5ab4('0x32')]?_0xec2eae[_0x5ab4('0x30')]:_0x5eae1b[_0x5ab4('0x2d')];if(!_0x4ad93f[_0x5ab4('0x2e')][_0x5ab4('0x33')](_0x5ab4('0x34'))){_0xec2eae[_0x5ab4('0x1b')]=qs[_0x5ab4('0x1b')](_0x4ad93f[_0x5ab4('0x2e')][_0x5ab4('0x1b')]);_0xec2eae[_0x5ab4('0x1c')]=qs[_0x5ab4('0x1c')](_0x4ad93f[_0x5ab4('0x2e')]['offset']);}_0xec2eae[_0x5ab4('0x35')]=qs['sort'](_0x4ad93f[_0x5ab4('0x2e')][_0x5ab4('0x36')]);_0xec2eae['where']=qs[_0x5ab4('0x37')](_[_0x5ab4('0x38')](_0x4ad93f['query'],_0x5eae1b[_0x5ab4('0x37')]),_0x2d7b9a);if(_0x4ad93f['query'][_0x5ab4('0x39')]){_0xec2eae[_0x5ab4('0x3a')]=_[_0x5ab4('0x3b')](_0xec2eae[_0x5ab4('0x3a')],{'$or':_['map'](_0x2d7b9a,function(_0x2f3bfd){if(_0x2f3bfd[_0x5ab4('0x2c')]!==_0x5ab4('0x3c')){var _0x515869={};_0x515869[_0x2f3bfd[_0x5ab4('0x25')]]={'$like':'%'+_0x4ad93f[_0x5ab4('0x2e')][_0x5ab4('0x39')]+'%'};return _0x515869;}})});}_0xec2eae=_['merge']({},_0xec2eae,_0x4ad93f[_0x5ab4('0x3d')]);var _0x4c8d28={'where':_0xec2eae[_0x5ab4('0x3a')]};return db['AnalyticCustomReport']['count'](_0x4c8d28)[_0x5ab4('0x20')](function(_0x2bc1a0){_0x429f3b[_0x5ab4('0x3e')]=_0x2bc1a0;if(_0x4ad93f[_0x5ab4('0x2e')][_0x5ab4('0x3f')]){_0xec2eae[_0x5ab4('0x40')]=[{'all':!![]}];}return db[_0x5ab4('0x29')][_0x5ab4('0x41')](_0xec2eae);})[_0x5ab4('0x20')](function(_0x649a0e){_0x429f3b[_0x5ab4('0x42')]=_0x649a0e;return _0x429f3b;})['then'](respondWithFilteredResult(_0xb5e069,_0xec2eae))[_0x5ab4('0x43')](handleError(_0xb5e069,null));};exports[_0x5ab4('0x44')]=function(_0x12c8dd,_0x1db71d){var _0x19032c={'raw':![],'where':{'id':_0x12c8dd[_0x5ab4('0x45')]['id']}},_0x5e2423={};_0x5e2423[_0x5ab4('0x2d')]=_[_0x5ab4('0x46')](db[_0x5ab4('0x29')]['rawAttributes']);_0x5e2423[_0x5ab4('0x2e')]=_['keys'](_0x12c8dd['query']);_0x5e2423[_0x5ab4('0x37')]=_[_0x5ab4('0x2f')](_0x5e2423[_0x5ab4('0x2d')],_0x5e2423['query']);_0x19032c[_0x5ab4('0x30')]=_[_0x5ab4('0x2f')](_0x5e2423[_0x5ab4('0x2d')],qs[_0x5ab4('0x31')](_0x12c8dd[_0x5ab4('0x2e')][_0x5ab4('0x31')]));_0x19032c[_0x5ab4('0x30')]=_0x19032c['attributes']['length']?_0x19032c[_0x5ab4('0x30')]:_0x5e2423[_0x5ab4('0x2d')];if(_0x12c8dd[_0x5ab4('0x2e')][_0x5ab4('0x3f')]){_0x19032c['include']=[{'all':!![]}];}_0x19032c=_['merge']({},_0x19032c,_0x12c8dd[_0x5ab4('0x3d')]);return db[_0x5ab4('0x29')][_0x5ab4('0x47')](_0x19032c)[_0x5ab4('0x20')](handleEntityNotFound(_0x1db71d,null))[_0x5ab4('0x20')](respondWithResult(_0x1db71d,null))[_0x5ab4('0x43')](handleError(_0x1db71d,null));};exports[_0x5ab4('0x48')]=function(_0x277e5f,_0x4e1a1b){return db[_0x5ab4('0x29')][_0x5ab4('0x48')](_0x277e5f[_0x5ab4('0x49')],{})[_0x5ab4('0x20')](function(_0x6b6499){var _0x2d64d6=_0x277e5f[_0x5ab4('0x4a')][_0x5ab4('0x4b')]({'plain':!![]});if(!_0x2d64d6)throw new Error(_0x5ab4('0x4c'));if(_0x2d64d6[_0x5ab4('0x4d')]==='user'){var _0x35128e=_0x6b6499[_0x5ab4('0x4b')]({'plain':!![]});var _0x2d7c3f=_0x5ab4('0x4e');return db[_0x5ab4('0x4f')]['find']({'where':{'name':_0x2d7c3f,'userProfileId':_0x2d64d6[_0x5ab4('0x50')]},'raw':!![]})[_0x5ab4('0x20')](function(_0x263f79){if(_0x263f79&&_0x263f79[_0x5ab4('0x51')]===0x0){return db[_0x5ab4('0x23')][_0x5ab4('0x48')]({'name':_0x35128e['name'],'resourceId':_0x35128e['id'],'type':_0x5ab4('0x22'),'sectionId':_0x263f79['id']},{})[_0x5ab4('0x20')](function(){return _0x6b6499;});}else{return _0x6b6499;}})[_0x5ab4('0x43')](function(_0x234b1d){logger[_0x5ab4('0x24')](_0x5ab4('0x52'),_0x234b1d);throw _0x234b1d;});}return _0x6b6499;})[_0x5ab4('0x20')](respondWithResult(_0x4e1a1b,0xc9))[_0x5ab4('0x43')](handleError(_0x4e1a1b,null));};exports['update']=function(_0x36e824,_0x565ffa){if(_0x36e824['body']['id']){delete _0x36e824[_0x5ab4('0x49')]['id'];}return db[_0x5ab4('0x29')][_0x5ab4('0x47')]({'where':{'id':_0x36e824[_0x5ab4('0x45')]['id']}})[_0x5ab4('0x20')](handleEntityNotFound(_0x565ffa,null))[_0x5ab4('0x20')](saveUpdates(_0x36e824['body'],null))['then'](respondWithResult(_0x565ffa,null))[_0x5ab4('0x43')](handleError(_0x565ffa,null));};exports[_0x5ab4('0x21')]=function(_0x3d4142,_0x53887c){return db['AnalyticCustomReport'][_0x5ab4('0x47')]({'where':{'id':_0x3d4142['params']['id']}})[_0x5ab4('0x20')](handleEntityNotFound(_0x53887c,null))[_0x5ab4('0x20')](removeEntity(_0x53887c,null))[_0x5ab4('0x43')](handleError(_0x53887c,null));};exports[_0x5ab4('0x53')]=function(_0x3b8d7b,_0x19de8e){var _0x4aa97e=0xa;var _0xcc129=[_0x5ab4('0x54'),_0x5ab4('0x55'),_0x5ab4('0x56'),_0x5ab4('0x57')];var _0x557b13={'SUM':_0x5ab4('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5ab4('0x59'),'MAX':_0x5ab4('0x5a'),'MIN':_0x5ab4('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5ab4('0x5c'),'GROUP_CONCAT ASC':_0x5ab4('0x5d'),'GROUP_CONCAT DESC':_0x5ab4('0x5e')};var _0x19a63b={'SEC_TO_TIME':_0x5ab4('0x5f'),'DATE':'DATE(%s)','HOUR':_0x5ab4('0x60'),'ROUND':_0x5ab4('0x61'),'UNIX_TIMESTAMP':_0x5ab4('0x62')};var _0x52c74f=function(_0x54c83e){return!_['includes']([_0x5ab4('0x63'),_0x5ab4('0x64'),'IS\x20EMPTY',_0x5ab4('0x65')],_0x54c83e);};var _0x20a7e0=function(_0x23b151){if(!_0x23b151||!_0x23b151['rules'][_0x5ab4('0x32')]){return'';}for(var _0x36f700='(',_0x3adb3f=0x0;_0x3adb3f<_0x23b151[_0x5ab4('0x66')][_0x5ab4('0x32')];_0x3adb3f+=0x1){_0x3adb3f>0x0&&(_0x36f700+='\x20'+_0x23b151[_0x5ab4('0x67')]+'\x20');_0x36f700+=_0x23b151[_0x5ab4('0x66')][_0x3adb3f][_0x5ab4('0x68')]?_0x20a7e0(_0x23b151[_0x5ab4('0x66')][_0x3adb3f][_0x5ab4('0x68')]):_0x23b151[_0x5ab4('0x66')][_0x3adb3f][_0x5ab4('0x69')]+'\x20'+_0x23b151['rules'][_0x3adb3f]['condition']+(_0x52c74f(_0x23b151['rules'][_0x3adb3f][_0x5ab4('0x6a')])?'\x20'+_0x23b151[_0x5ab4('0x66')][_0x3adb3f][_0x5ab4('0x6b')]:'');}return _0x36f700+')';};var _0x313469={'where':{'id':_0x3b8d7b[_0x5ab4('0x45')]['id']}},_0x2fc07f,_0x1fe3e4,_0x54bec4,_0x37a0db,_0x3e4391;_0x313469=_['merge']({},_0x313469,_0x3b8d7b['options']);return db[_0x5ab4('0x29')][_0x5ab4('0x47')](_0x313469)[_0x5ab4('0x20')](function(_0x546c2d){if(_0x546c2d){_0x2fc07f=_0x546c2d;return _0x546c2d['getFields']();}return null;})[_0x5ab4('0x20')](function(_0x1facea){if(_0x1facea){if(!_0x1facea[_0x5ab4('0x32')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5ab4('0x6c'),0x193);}_0x1fe3e4=_0x1facea;return db['AnalyticMetric'][_0x5ab4('0x41')]({'raw':!![]});}return null;})[_0x5ab4('0x20')](function(_0x386ab2){if(_0x386ab2){_0x54bec4=_['keyBy'](_0x386ab2,'id');var _0x17ce8e;var _0x3cf72d=squel[_0x5ab4('0x6d')]();_0x3cf72d[_0x5ab4('0x6e')](_0x2fc07f[_0x5ab4('0x6f')]);for(var _0x20f668=0x0;_0x20f668<_0x1fe3e4[_0x5ab4('0x32')];_0x20f668+=0x1){_0x17ce8e=_0x1fe3e4[_0x20f668]['MetricId']?_0x54bec4[_0x1fe3e4[_0x20f668][_0x5ab4('0x70')]]['metric']:_0x1fe3e4[_0x20f668][_0x5ab4('0x69')];_0x17ce8e=_0x1fe3e4[_0x20f668][_0x5ab4('0x71')]?_[_0x5ab4('0x72')](_0x557b13[_0x1fe3e4[_0x20f668][_0x5ab4('0x71')]],'%s',_0x17ce8e):_0x17ce8e;_0x17ce8e=_0x1fe3e4[_0x20f668][_0x5ab4('0x73')]?_[_0x5ab4('0x72')](_0x19a63b[_0x1fe3e4[_0x20f668]['format']],'%s',_0x17ce8e):_0x17ce8e;if(_0x1fe3e4[_0x20f668]['groupBy']){_0x3cf72d[_0x5ab4('0x68')](_0x17ce8e);}_0x1fe3e4[_0x20f668]['orderBy']&&_0x3cf72d['order'](_0x17ce8e,_0x1fe3e4[_0x20f668][_0x5ab4('0x74')]===_0x5ab4('0x75')?![]:!![]);_0x3cf72d['field'](_0x17ce8e,_0x1fe3e4[_0x20f668]['alias']||_0x17ce8e);}if(_0x2fc07f['joins']){_0x2fc07f['joins']=JSON[_0x5ab4('0x76')](_0x2fc07f[_0x5ab4('0x77')]);for(var _0x158299=0x0;_0x158299<_0x2fc07f[_0x5ab4('0x77')][_0x5ab4('0x32')];_0x158299+=0x1){if(_0x2fc07f[_0x5ab4('0x77')][_0x158299]['type']&&_['includes'](_0xcc129,_0x2fc07f['joins'][_0x158299]['type'])&&_0x2fc07f[_0x5ab4('0x77')][_0x158299]['parentKey']&&_0x2fc07f['joins'][_0x158299][_0x5ab4('0x78')]&&_0x2fc07f[_0x5ab4('0x77')][_0x158299]['foreignKey']){_0x3cf72d[_0x2fc07f[_0x5ab4('0x77')][_0x158299]['type']](_0x2fc07f[_0x5ab4('0x77')][_0x158299][_0x5ab4('0x78')],null,util[_0x5ab4('0x73')](_0x5ab4('0x79'),_0x2fc07f['table'],_0x2fc07f[_0x5ab4('0x77')][_0x158299][_0x5ab4('0x7a')],_0x2fc07f[_0x5ab4('0x77')][_0x158299][_0x5ab4('0x78')],_0x2fc07f[_0x5ab4('0x77')][_0x158299]['foreignKey']));}}}if(_0x2fc07f[_0x5ab4('0x7b')]){_0x2fc07f[_0x5ab4('0x7b')]=JSON[_0x5ab4('0x76')](_0x2fc07f[_0x5ab4('0x7b')]);_0x3cf72d[_0x5ab4('0x3a')](_0x20a7e0(_0x2fc07f[_0x5ab4('0x7b')][_0x5ab4('0x68')]));}_0x3e4391=_0x3cf72d[_0x5ab4('0x7c')]();_0x3cf72d['limit'](_0x4aa97e);_0x3cf72d[_0x5ab4('0x1c')](0x0);logger[_0x5ab4('0x7d')](_0x5ab4('0x7e'),_0x3cf72d['toString']());return dbH[_0x5ab4('0x7f')][_0x5ab4('0x2e')](_0x3cf72d[_0x5ab4('0x80')](),{'type':dbH[_0x5ab4('0x7f')][_0x5ab4('0x81')][_0x5ab4('0x82')]});}})['then'](respondWithResult(_0x19de8e,null))[_0x5ab4('0x43')](handleError(_0x19de8e,null));};function runReport(_0x5a86ea,_0x1c425d,_0xc78139){var _0x465548=_0x1c425d[_0x5ab4('0x25')];var _0x2c9fe6=0xa;var _0x107eec=[_0x5ab4('0x54'),_0x5ab4('0x55'),_0x5ab4('0x56'),_0x5ab4('0x57')];var _0x32c658={'SUM':_0x5ab4('0x58'),'COUNT':_0x5ab4('0x83'),'COUNT DISTINCT':_0x5ab4('0x59'),'MAX':'MAX(%s)','MIN':_0x5ab4('0x5b'),'AVG':_0x5ab4('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5ab4('0x5d'),'GROUP_CONCAT DESC':_0x5ab4('0x5e')};var _0x1a8e3d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5ab4('0x85'),'HOUR':_0x5ab4('0x60'),'ROUND':_0x5ab4('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2fe304=function(_0x624c5c){return!_[_0x5ab4('0x86')]([_0x5ab4('0x63'),'IS\x20NOT\x20NULL',_0x5ab4('0x87'),'IS\x20NOT\x20EMPTY'],_0x624c5c);};var _0x51d37e=function(_0x4f3904){if(!_0x4f3904||!_0x4f3904[_0x5ab4('0x66')][_0x5ab4('0x32')]){return'';}for(var _0x1529a8='(',_0x541c3d=0x0;_0x541c3d<_0x4f3904[_0x5ab4('0x66')]['length'];_0x541c3d+=0x1){_0x541c3d>0x0&&(_0x1529a8+='\x20'+_0x4f3904['operator']+'\x20');_0x1529a8+=_0x4f3904['rules'][_0x541c3d][_0x5ab4('0x68')]?_0x51d37e(_0x4f3904[_0x5ab4('0x66')][_0x541c3d][_0x5ab4('0x68')]):_0x4f3904[_0x5ab4('0x66')][_0x541c3d][_0x5ab4('0x69')]+'\x20'+_0x4f3904['rules'][_0x541c3d][_0x5ab4('0x6a')]+(_0x2fe304(_0x4f3904[_0x5ab4('0x66')][_0x541c3d]['condition'])?'\x20'+_0x4f3904[_0x5ab4('0x66')][_0x541c3d][_0x5ab4('0x6b')]:'');}return _0x1529a8+')';};var _0x10197e={'where':{'id':_0x5a86ea['id']}},_0x2be2fe,_0x47704a,_0x19435f,_0x10e0b9,_0x588b97;_0x10197e=_[_0x5ab4('0x3b')]({},_0x10197e,_0xc78139);return db[_0x5ab4('0x29')][_0x5ab4('0x47')](_0x10197e)[_0x5ab4('0x20')](function(_0x119885){if(_0x119885){_0x2be2fe=_0x119885;return _0x119885[_0x5ab4('0x88')]();}return null;})[_0x5ab4('0x20')](function(_0x4c55e5){if(_0x4c55e5){if(!_0x4c55e5[_0x5ab4('0x32')]){throw new db[(_0x5ab4('0x89'))]['ValidationErrorItem'](_0x5ab4('0x6c'),0x193);}_0x47704a=_0x4c55e5;return db[_0x5ab4('0x8a')][_0x5ab4('0x41')]({'raw':!![]});}return null;})[_0x5ab4('0x20')](function(_0x48435f){if(_0x48435f){_0x19435f=_['keyBy'](_0x48435f,'id');var _0x389a81;var _0x4cc4e0=squel[_0x5ab4('0x6d')]();_0x4cc4e0['from'](_0x2be2fe[_0x5ab4('0x6f')]);for(var _0x4d01da=0x0;_0x4d01da<_0x47704a[_0x5ab4('0x32')];_0x4d01da+=0x1){_0x389a81=_0x47704a[_0x4d01da][_0x5ab4('0x70')]?_0x19435f[_0x47704a[_0x4d01da][_0x5ab4('0x70')]]['metric']:_0x47704a[_0x4d01da]['field'];_0x389a81=_0x47704a[_0x4d01da][_0x5ab4('0x71')]?_['replace'](_0x32c658[_0x47704a[_0x4d01da]['function']],'%s',_0x389a81):_0x389a81;_0x389a81=_0x47704a[_0x4d01da]['format']?_['replace'](_0x1a8e3d[_0x47704a[_0x4d01da][_0x5ab4('0x73')]],'%s',_0x389a81):_0x389a81;if(_0x47704a[_0x4d01da][_0x5ab4('0x8b')]){_0x4cc4e0[_0x5ab4('0x68')](_0x389a81);}_0x47704a[_0x4d01da]['orderBy']&&_0x4cc4e0[_0x5ab4('0x35')](_0x389a81,_0x47704a[_0x4d01da][_0x5ab4('0x74')]===_0x5ab4('0x75')?![]:!![]);_0x4cc4e0['field'](_0x389a81,_0x47704a[_0x4d01da][_0x5ab4('0x8c')]||_0x389a81);}if(_0x2be2fe[_0x5ab4('0x77')]){_0x2be2fe[_0x5ab4('0x77')]=JSON[_0x5ab4('0x76')](_0x2be2fe['joins']);for(var _0x63b9e0=0x0;_0x63b9e0<_0x2be2fe[_0x5ab4('0x77')][_0x5ab4('0x32')];_0x63b9e0+=0x1){if(_0x2be2fe['joins'][_0x63b9e0][_0x5ab4('0x2c')]&&_[_0x5ab4('0x86')](_0x107eec,_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x2c')])&&_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x7a')]&&_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x78')]&&_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x8d')]){_0x4cc4e0[_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x2c')]](_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x78')],null,util['format'](_0x5ab4('0x79'),_0x2be2fe['table'],_0x2be2fe['joins'][_0x63b9e0][_0x5ab4('0x7a')],_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x78')],_0x2be2fe[_0x5ab4('0x77')][_0x63b9e0][_0x5ab4('0x8d')]));}}}if(_0x2be2fe[_0x5ab4('0x7b')]){_0x2be2fe['conditions']=JSON['parse'](_0x2be2fe[_0x5ab4('0x7b')]);_0x4cc4e0['where'](_0x51d37e(_0x2be2fe[_0x5ab4('0x7b')][_0x5ab4('0x68')]));}_0x588b97=_0x4cc4e0[_0x5ab4('0x7c')]();_0x4cc4e0['limit'](_0x2c9fe6);_0x4cc4e0[_0x5ab4('0x1c')](0x0);return;}})[_0x5ab4('0x20')](function(){if(_0x1c425d[_0x5ab4('0x8e')]===_0x5ab4('0x8f')){return null;}var _0x3de513=_['merge'](_0x1c425d,{'name':_0x1c425d[_0x5ab4('0x90')]||_0x1c425d[_0x5ab4('0x25')]||_0x2be2fe[_0x5ab4('0x25')],'basename':_0x465548,'savename':util[_0x5ab4('0x73')](_0x5ab4('0x91'),_0x1c425d[_0x5ab4('0x25')]||_0x2be2fe[_0x5ab4('0x25')],require(_0x5ab4('0x92'))[_0x5ab4('0x93')](0x4),_0x1c425d[_0x5ab4('0x8e')]||_0x5ab4('0x94')),'reportId':_0x2be2fe['id'],'reportType':_0x5ab4('0x95')});return db['AnalyticExtractedReport']['create'](_0x3de513,{'raw':!![]});})[_0x5ab4('0x20')](function(_0x537ede){if(_0x2be2fe[_0x5ab4('0x6f')]===_0x5ab4('0x96')){_0x588b97[_0x5ab4('0x3a')](_0x2be2fe[_0x5ab4('0x6f')]+_0x5ab4('0x97'),_0x1c425d['startDate'],_0x1c425d[_0x5ab4('0x98')]);}else{_0x588b97[_0x5ab4('0x3a')](_0x2be2fe['table']+_0x5ab4('0x99'),_0x1c425d['startDate'],_0x1c425d['endDate']);}if(_0x537ede){logger[_0x5ab4('0x9a')](_0x5ab4('0x9b'),_0x588b97[_0x5ab4('0x80')]());require(_0x5ab4('0x9c'))[_0x5ab4('0x9d')](path[_0x5ab4('0x54')](__dirname,_0x5ab4('0x9e'),_0x537ede[_0x5ab4('0x8e')]),[_0x537ede['id'],_0x588b97['toString'](),path[_0x5ab4('0x54')](__dirname,_0x5ab4('0x9f'),_0x537ede[_0x5ab4('0xa0')]),_0x465548]);return _0x537ede;}else{var _0x3385e5=squel[_0x5ab4('0x6d')]();_0x3385e5[_0x5ab4('0x6e')]('('+_0x588b97[_0x5ab4('0x80')]()+')',_0x5ab4('0xa1'));_0x3385e5[_0x5ab4('0x69')](_0x5ab4('0xa2'),_0x5ab4('0x3e'));_0x588b97[_0x5ab4('0x1b')](_0x1c425d[_0x5ab4('0x1b')]||_0x2c9fe6);_0x588b97[_0x5ab4('0x1c')](_0x1c425d[_0x5ab4('0x1c')]||0x0);return dbH['sequelize'][_0x5ab4('0x2e')](_0x3385e5[_0x5ab4('0x80')](),{'type':dbH[_0x5ab4('0x7f')]['QueryTypes'][_0x5ab4('0x82')]})[_0x5ab4('0x20')](function(_0x4b14ba){if(!_0x4b14ba['length']){_0x10e0b9=0x0;}else{_0x10e0b9=_0x4b14ba[0x0][_0x5ab4('0x3e')]||0x0;}return dbH[_0x5ab4('0x7f')][_0x5ab4('0x2e')](_0x588b97['toString'](),{'type':dbH[_0x5ab4('0x7f')][_0x5ab4('0x81')]['SELECT']});})[_0x5ab4('0x20')](function(_0xf31538){return{'rows':_0xf31538||[],'count':_0x10e0b9};});}});}exports['run']=function(_0x7cc095,_0x51bbc7){return runReport(_0x7cc095[_0x5ab4('0x45')],_0x7cc095[_0x5ab4('0x2e')],_0x7cc095[_0x5ab4('0x3d')])['then'](respondWithResult(_0x51bbc7,null))['catch'](handleError(_0x51bbc7,null));};exports['runReport']=runReport;exports[_0x5ab4('0x2e')]=function(_0x296845,_0x2b3b34){var _0x569d86=0xa;var _0x103eb4=[_0x5ab4('0x54'),_0x5ab4('0x55'),'right_join',_0x5ab4('0x57')];var _0x359053={'SUM':_0x5ab4('0x58'),'COUNT':_0x5ab4('0x83'),'COUNT DISTINCT':_0x5ab4('0x59'),'MAX':_0x5ab4('0x5a'),'MIN':'MIN(%s)','AVG':_0x5ab4('0x84'),'GROUP_CONCAT':_0x5ab4('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x5ab4('0x5e')};var _0x87b342={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x5ab4('0x60'),'ROUND':_0x5ab4('0x61'),'UNIX_TIMESTAMP':_0x5ab4('0x62')};var _0x1345a4=function(_0x302bac){return!_[_0x5ab4('0x86')]([_0x5ab4('0x63'),_0x5ab4('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x302bac);};var _0x5ce35a=function(_0x2213fa){if(!_0x2213fa||!_0x2213fa['rules']['length']){return'';}for(var _0x15ce77='(',_0x1bc843=0x0;_0x1bc843<_0x2213fa[_0x5ab4('0x66')][_0x5ab4('0x32')];_0x1bc843+=0x1){_0x1bc843>0x0&&(_0x15ce77+='\x20'+_0x2213fa[_0x5ab4('0x67')]+'\x20');_0x15ce77+=_0x2213fa['rules'][_0x1bc843][_0x5ab4('0x68')]?_0x5ce35a(_0x2213fa[_0x5ab4('0x66')][_0x1bc843][_0x5ab4('0x68')]):_0x2213fa['rules'][_0x1bc843][_0x5ab4('0x69')]+'\x20'+_0x2213fa[_0x5ab4('0x66')][_0x1bc843][_0x5ab4('0x6a')]+(_0x1345a4(_0x2213fa[_0x5ab4('0x66')][_0x1bc843]['condition'])?'\x20'+_0x2213fa[_0x5ab4('0x66')][_0x1bc843][_0x5ab4('0x6b')]:'');}return _0x15ce77+')';};var _0x24133c={'where':{'id':_0x296845['params']['id']}},_0x5dae00,_0xbf411d,_0x42c35d,_0x130941,_0x1ab612;_0x24133c=_[_0x5ab4('0x3b')]({},_0x24133c,_0x296845['options']);return db[_0x5ab4('0x29')][_0x5ab4('0x47')](_0x24133c)[_0x5ab4('0x20')](function(_0x1f0585){if(_0x1f0585){_0x5dae00=_0x1f0585;return _0x1f0585[_0x5ab4('0x88')]();}return null;})[_0x5ab4('0x20')](function(_0x3cec3c){if(_0x3cec3c){if(!_0x3cec3c[_0x5ab4('0x32')]){throw new db[(_0x5ab4('0x89'))][(_0x5ab4('0xa3'))](_0x5ab4('0x6c'),0x193);}_0xbf411d=_0x3cec3c;return db['AnalyticMetric'][_0x5ab4('0x41')]({'raw':!![]});}return null;})['then'](function(_0x356c06){if(_0x356c06){_0x42c35d=_[_0x5ab4('0xa4')](_0x356c06,'id');var _0x331181;var _0x221d2f=squel[_0x5ab4('0x6d')]();_0x221d2f['from'](_0x5dae00['table']);for(var _0x2cde90=0x0;_0x2cde90<_0xbf411d[_0x5ab4('0x32')];_0x2cde90+=0x1){_0x331181=_0xbf411d[_0x2cde90]['MetricId']?_0x42c35d[_0xbf411d[_0x2cde90][_0x5ab4('0x70')]]['metric']:_0xbf411d[_0x2cde90][_0x5ab4('0x69')];_0x331181=_0xbf411d[_0x2cde90][_0x5ab4('0x71')]?_['replace'](_0x359053[_0xbf411d[_0x2cde90]['function']],'%s',_0x331181):_0x331181;_0x331181=_0xbf411d[_0x2cde90][_0x5ab4('0x73')]?_[_0x5ab4('0x72')](_0x87b342[_0xbf411d[_0x2cde90]['format']],'%s',_0x331181):_0x331181;if(_0xbf411d[_0x2cde90]['groupBy']){_0x221d2f[_0x5ab4('0x68')](_0x331181);}_0xbf411d[_0x2cde90][_0x5ab4('0x74')]&&_0x221d2f[_0x5ab4('0x35')](_0x331181,_0xbf411d[_0x2cde90][_0x5ab4('0x74')]===_0x5ab4('0x75')?![]:!![]);_0x221d2f[_0x5ab4('0x69')](_0x331181,_0xbf411d[_0x2cde90][_0x5ab4('0x8c')]||_0x331181);}if(_0x5dae00['joins']){_0x5dae00[_0x5ab4('0x77')]=JSON[_0x5ab4('0x76')](_0x5dae00['joins']);for(var _0x58b8e2=0x0;_0x58b8e2<_0x5dae00[_0x5ab4('0x77')]['length'];_0x58b8e2+=0x1){if(_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x2c')]&&_[_0x5ab4('0x86')](_0x103eb4,_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x2c')])&&_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x7a')]&&_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x78')]&&_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x8d')]){_0x221d2f[_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x2c')]](_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x78')],null,util[_0x5ab4('0x73')]('%s.%s\x20=\x20%s.%s',_0x5dae00['table'],_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x7a')],_0x5dae00['joins'][_0x58b8e2][_0x5ab4('0x78')],_0x5dae00[_0x5ab4('0x77')][_0x58b8e2][_0x5ab4('0x8d')]));}}}if(_0x5dae00[_0x5ab4('0x7b')]){_0x5dae00[_0x5ab4('0x7b')]=JSON['parse'](_0x5dae00['conditions']);_0x221d2f['where'](_0x5ce35a(_0x5dae00[_0x5ab4('0x7b')][_0x5ab4('0x68')]));}_0x1ab612=_0x221d2f[_0x5ab4('0x7c')]();_0x221d2f[_0x5ab4('0x1b')](_0x569d86);_0x221d2f[_0x5ab4('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x221d2f[_0x5ab4('0x80')]());return dbH[_0x5ab4('0x7f')][_0x5ab4('0x2e')](_0x221d2f[_0x5ab4('0x80')](),{'type':dbH['sequelize'][_0x5ab4('0x81')][_0x5ab4('0x82')]});}})['then'](function(){return{'sql':_0x1ab612[_0x5ab4('0x80')]()};})[_0x5ab4('0x20')](respondWithResult(_0x2b3b34,null))[_0x5ab4('0x43')](handleError(_0x2b3b34,null));}; \ No newline at end of file +var _0x967b=['options','include','rows','catch','show','params','intersection','length','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','create','update','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','toString','QueryTypes','getFields','Sequelize','findAll','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','Please\x20insert\x20at\x20least\x20one\x20field','SELECT','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x13e446,_0x57c220){var _0x142167=function(_0x2db7bb){while(--_0x2db7bb){_0x13e446['push'](_0x13e446['shift']());}};_0x142167(++_0x57c220);}(_0x967b,0x10e));var _0xb967=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x967b[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0xb967('0x0'));var rimraf=require(_0xb967('0x1'));var zipdir=require(_0xb967('0x2'));var jsonpatch=require(_0xb967('0x3'));var rp=require(_0xb967('0x4'));var moment=require(_0xb967('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb967('0x6'));var util=require('util');var path=require(_0xb967('0x7'));var sox=require(_0xb967('0x8'));var csv=require('to-csv');var ejs=require(_0xb967('0x9'));var fs=require('fs');var fs_extra=require(_0xb967('0xa'));var _=require(_0xb967('0xb'));var squel=require(_0xb967('0xc'));var crypto=require(_0xb967('0xd'));var jsforce=require(_0xb967('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb967('0xf'));var Papa=require(_0xb967('0x10'));var Redis=require(_0xb967('0x11'));var authService=require(_0xb967('0x12'));var qs=require(_0xb967('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb967('0x14'))(_0xb967('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb967('0x16'));var db=require(_0xb967('0x17'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x21e7e4,_0x3cd921){_0x3cd921=_0x3cd921||0xcc;return function(_0x1d4d9a){if(_0x1d4d9a){return _0x21e7e4[_0xb967('0x18')](_0x3cd921);}return _0x21e7e4['status'](_0x3cd921)[_0xb967('0x19')]();};}function respondWithResult(_0x195017,_0x2e4484){_0x2e4484=_0x2e4484||0xc8;return function(_0x3405c3){if(_0x3405c3){return _0x195017[_0xb967('0x1a')](_0x2e4484)[_0xb967('0x1b')](_0x3405c3);}};}function respondWithFilteredResult(_0x25e0bf,_0x1fd35b){return function(_0x35ecf7){if(_0x35ecf7){var _0x51ac38=typeof _0x1fd35b[_0xb967('0x1c')]===_0xb967('0x1d')&&typeof _0x1fd35b[_0xb967('0x1e')]===_0xb967('0x1d');var _0x35013d=_0x35ecf7[_0xb967('0x1f')];var _0x324721=_0x51ac38?0x0:_0x1fd35b[_0xb967('0x1c')];var _0x31f5e6=_0x51ac38?_0x35ecf7['count']:_0x1fd35b[_0xb967('0x1c')]+_0x1fd35b[_0xb967('0x1e')];var _0x2c3c71;if(_0x31f5e6>=_0x35013d){_0x31f5e6=_0x35013d;_0x2c3c71=0xc8;}else{_0x2c3c71=0xce;}_0x25e0bf[_0xb967('0x1a')](_0x2c3c71);return _0x25e0bf[_0xb967('0x20')](_0xb967('0x21'),_0x324721+'-'+_0x31f5e6+'/'+_0x35013d)[_0xb967('0x1b')](_0x35ecf7);}return null;};}function patchUpdates(_0x1c139b){return function(_0x3103cb){try{jsonpatch[_0xb967('0x22')](_0x3103cb,_0x1c139b,!![]);}catch(_0x18c26e){return BPromise[_0xb967('0x23')](_0x18c26e);}return _0x3103cb['save']();};}function saveUpdates(_0x4244e0,_0x271ad6){return function(_0x484213){if(_0x484213){return _0x484213['update'](_0x4244e0)['then'](function(_0x478033){return _0x478033;});}return null;};}function removeEntity(_0x505c64,_0x5403b0){return function(_0x4a03a8){if(_0x4a03a8){return _0x4a03a8[_0xb967('0x24')]()[_0xb967('0x25')](function(){var _0x4b91de=_0x4a03a8[_0xb967('0x26')]({'plain':!![]});var _0x1d844c=_0xb967('0x27');return db[_0xb967('0x28')][_0xb967('0x24')]({'where':{'type':_0x1d844c,'resourceId':_0x4b91de['id']}})[_0xb967('0x25')](function(){return _0x4a03a8;});})[_0xb967('0x25')](function(){_0x505c64[_0xb967('0x1a')](0xcc)[_0xb967('0x19')]();});}};}function handleEntityNotFound(_0x20cf03,_0x524492){return function(_0x4c89a5){if(!_0x4c89a5){_0x20cf03[_0xb967('0x18')](0x194);}return _0x4c89a5;};}function handleError(_0x22aeac,_0x2170ac){_0x2170ac=_0x2170ac||0x1f4;return function(_0x5cd6cd){logger[_0xb967('0x29')](_0x5cd6cd[_0xb967('0x2a')]);if(_0x5cd6cd[_0xb967('0x2b')]){delete _0x5cd6cd[_0xb967('0x2b')];}_0x22aeac[_0xb967('0x1a')](_0x2170ac)[_0xb967('0x2c')](_0x5cd6cd);};}exports[_0xb967('0x2d')]=function(_0x28f0a4,_0x44cdf1){var _0x47e8f9={},_0x2231b0={},_0x1d98fd={'count':0x0,'rows':[]};var _0x15c39e=_[_0xb967('0x2e')](db[_0xb967('0x2f')][_0xb967('0x30')],function(_0x3f814d){return{'name':_0x3f814d['fieldName'],'type':_0x3f814d[_0xb967('0x31')][_0xb967('0x32')]};});_0x2231b0[_0xb967('0x33')]=_['map'](_0x15c39e,_0xb967('0x2b'));_0x2231b0['query']=_[_0xb967('0x34')](_0x28f0a4[_0xb967('0x35')]);_0x2231b0[_0xb967('0x36')]=_['intersection'](_0x2231b0[_0xb967('0x33')],_0x2231b0[_0xb967('0x35')]);_0x47e8f9[_0xb967('0x37')]=_['intersection'](_0x2231b0[_0xb967('0x33')],qs[_0xb967('0x38')](_0x28f0a4[_0xb967('0x35')][_0xb967('0x38')]));_0x47e8f9[_0xb967('0x37')]=_0x47e8f9[_0xb967('0x37')]['length']?_0x47e8f9[_0xb967('0x37')]:_0x2231b0[_0xb967('0x33')];if(!_0x28f0a4['query'][_0xb967('0x39')]('nolimit')){_0x47e8f9['limit']=qs['limit'](_0x28f0a4[_0xb967('0x35')][_0xb967('0x1e')]);_0x47e8f9[_0xb967('0x1c')]=qs['offset'](_0x28f0a4['query'][_0xb967('0x1c')]);}_0x47e8f9['order']=qs[_0xb967('0x3a')](_0x28f0a4[_0xb967('0x35')][_0xb967('0x3a')]);_0x47e8f9['where']=qs[_0xb967('0x36')](_[_0xb967('0x3b')](_0x28f0a4[_0xb967('0x35')],_0x2231b0[_0xb967('0x36')]),_0x15c39e);if(_0x28f0a4[_0xb967('0x35')][_0xb967('0x3c')]){_0x47e8f9[_0xb967('0x3d')]=_[_0xb967('0x3e')](_0x47e8f9[_0xb967('0x3d')],{'$or':_[_0xb967('0x2e')](_0x15c39e,function(_0x310054){if(_0x310054['type']!==_0xb967('0x3f')){var _0x5d69c2={};_0x5d69c2[_0x310054[_0xb967('0x2b')]]={'$like':'%'+_0x28f0a4['query'][_0xb967('0x3c')]+'%'};return _0x5d69c2;}})});}_0x47e8f9=_[_0xb967('0x3e')]({},_0x47e8f9,_0x28f0a4[_0xb967('0x40')]);var _0x345c15={'where':_0x47e8f9['where']};return db[_0xb967('0x2f')]['count'](_0x345c15)['then'](function(_0x34d837){_0x1d98fd[_0xb967('0x1f')]=_0x34d837;if(_0x28f0a4[_0xb967('0x35')]['includeAll']){_0x47e8f9[_0xb967('0x41')]=[{'all':!![]}];}return db[_0xb967('0x2f')]['findAll'](_0x47e8f9);})[_0xb967('0x25')](function(_0x4734f7){_0x1d98fd[_0xb967('0x42')]=_0x4734f7;return _0x1d98fd;})[_0xb967('0x25')](respondWithFilteredResult(_0x44cdf1,_0x47e8f9))[_0xb967('0x43')](handleError(_0x44cdf1,null));};exports[_0xb967('0x44')]=function(_0x883aed,_0x4881d4){var _0x6f12d3={'raw':![],'where':{'id':_0x883aed[_0xb967('0x45')]['id']}},_0x47613b={};_0x47613b[_0xb967('0x33')]=_[_0xb967('0x34')](db[_0xb967('0x2f')]['rawAttributes']);_0x47613b[_0xb967('0x35')]=_[_0xb967('0x34')](_0x883aed[_0xb967('0x35')]);_0x47613b[_0xb967('0x36')]=_[_0xb967('0x46')](_0x47613b[_0xb967('0x33')],_0x47613b['query']);_0x6f12d3[_0xb967('0x37')]=_[_0xb967('0x46')](_0x47613b[_0xb967('0x33')],qs['fields'](_0x883aed[_0xb967('0x35')][_0xb967('0x38')]));_0x6f12d3[_0xb967('0x37')]=_0x6f12d3[_0xb967('0x37')][_0xb967('0x47')]?_0x6f12d3[_0xb967('0x37')]:_0x47613b[_0xb967('0x33')];if(_0x883aed[_0xb967('0x35')][_0xb967('0x48')]){_0x6f12d3[_0xb967('0x41')]=[{'all':!![]}];}_0x6f12d3=_[_0xb967('0x3e')]({},_0x6f12d3,_0x883aed[_0xb967('0x40')]);return db[_0xb967('0x2f')]['find'](_0x6f12d3)[_0xb967('0x25')](handleEntityNotFound(_0x4881d4,null))['then'](respondWithResult(_0x4881d4,null))[_0xb967('0x43')](handleError(_0x4881d4,null));};exports['create']=function(_0x3a6547,_0x31bd68){return db[_0xb967('0x2f')]['create'](_0x3a6547[_0xb967('0x49')],{})[_0xb967('0x25')](function(_0x39769e){var _0xfa9ed8=_0x3a6547[_0xb967('0x4a')][_0xb967('0x26')]({'plain':!![]});if(!_0xfa9ed8)throw new Error(_0xb967('0x4b'));if(_0xfa9ed8[_0xb967('0x4c')]===_0xb967('0x4a')){var _0x33937f=_0x39769e[_0xb967('0x26')]({'plain':!![]});var _0x3da4c4=_0xb967('0x4d');return db['UserProfileSection'][_0xb967('0x4e')]({'where':{'name':_0x3da4c4,'userProfileId':_0xfa9ed8[_0xb967('0x4f')]},'raw':!![]})[_0xb967('0x25')](function(_0x4e9e66){if(_0x4e9e66&&_0x4e9e66['autoAssociation']===0x0){return db[_0xb967('0x28')][_0xb967('0x50')]({'name':_0x33937f[_0xb967('0x2b')],'resourceId':_0x33937f['id'],'type':_0xb967('0x27'),'sectionId':_0x4e9e66['id']},{})[_0xb967('0x25')](function(){return _0x39769e;});}else{return _0x39769e;}})[_0xb967('0x43')](function(_0x48f6b4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48f6b4);throw _0x48f6b4;});}return _0x39769e;})[_0xb967('0x25')](respondWithResult(_0x31bd68,0xc9))[_0xb967('0x43')](handleError(_0x31bd68,null));};exports[_0xb967('0x51')]=function(_0x40ca99,_0x2fc1a0){if(_0x40ca99[_0xb967('0x49')]['id']){delete _0x40ca99[_0xb967('0x49')]['id'];}return db[_0xb967('0x2f')]['find']({'where':{'id':_0x40ca99[_0xb967('0x45')]['id']}})[_0xb967('0x25')](handleEntityNotFound(_0x2fc1a0,null))['then'](saveUpdates(_0x40ca99[_0xb967('0x49')],null))[_0xb967('0x25')](respondWithResult(_0x2fc1a0,null))['catch'](handleError(_0x2fc1a0,null));};exports['destroy']=function(_0x5a02e7,_0x3ebed2){return db[_0xb967('0x2f')][_0xb967('0x4e')]({'where':{'id':_0x5a02e7[_0xb967('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ebed2,null))[_0xb967('0x25')](removeEntity(_0x3ebed2,null))[_0xb967('0x43')](handleError(_0x3ebed2,null));};exports['preview']=function(_0x5c82e7,_0x4c1d85){var _0x7a8d0d=0xa;var _0x54aaa3=[_0xb967('0x52'),_0xb967('0x53'),_0xb967('0x54'),_0xb967('0x55')];var _0x4f79aa={'SUM':_0xb967('0x56'),'COUNT':_0xb967('0x57'),'COUNT DISTINCT':_0xb967('0x58'),'MAX':_0xb967('0x59'),'MIN':_0xb967('0x5a'),'AVG':_0xb967('0x5b'),'GROUP_CONCAT':_0xb967('0x5c'),'GROUP_CONCAT ASC':_0xb967('0x5d'),'GROUP_CONCAT DESC':_0xb967('0x5e')};var _0x447179={'SEC_TO_TIME':_0xb967('0x5f'),'DATE':_0xb967('0x60'),'HOUR':_0xb967('0x61'),'ROUND':_0xb967('0x62'),'UNIX_TIMESTAMP':_0xb967('0x63')};var _0x24c8bf=function(_0x1d9b2f){return!_[_0xb967('0x64')]([_0xb967('0x65'),_0xb967('0x66'),_0xb967('0x67'),_0xb967('0x68')],_0x1d9b2f);};var _0x1f7a44=function(_0x50495c){if(!_0x50495c||!_0x50495c[_0xb967('0x69')][_0xb967('0x47')]){return'';}for(var _0x258eb3='(',_0x38f844=0x0;_0x38f844<_0x50495c[_0xb967('0x69')][_0xb967('0x47')];_0x38f844+=0x1){_0x38f844>0x0&&(_0x258eb3+='\x20'+_0x50495c[_0xb967('0x6a')]+'\x20');_0x258eb3+=_0x50495c[_0xb967('0x69')][_0x38f844][_0xb967('0x6b')]?_0x1f7a44(_0x50495c['rules'][_0x38f844]['group']):_0x50495c[_0xb967('0x69')][_0x38f844][_0xb967('0x6c')]+'\x20'+_0x50495c[_0xb967('0x69')][_0x38f844]['condition']+(_0x24c8bf(_0x50495c[_0xb967('0x69')][_0x38f844][_0xb967('0x6d')])?'\x20'+_0x50495c['rules'][_0x38f844][_0xb967('0x6e')]:'');}return _0x258eb3+')';};var _0x38568c={'where':{'id':_0x5c82e7[_0xb967('0x45')]['id']}},_0x52d09b,_0x35096d,_0xa951b2,_0x182cd2,_0x3fd229;_0x38568c=_[_0xb967('0x3e')]({},_0x38568c,_0x5c82e7['options']);return db['AnalyticCustomReport'][_0xb967('0x4e')](_0x38568c)[_0xb967('0x25')](function(_0x3e7b1a){if(_0x3e7b1a){_0x52d09b=_0x3e7b1a;return _0x3e7b1a['getFields']();}return null;})[_0xb967('0x25')](function(_0x4f6b98){if(_0x4f6b98){if(!_0x4f6b98[_0xb967('0x47')]){throw new db['Sequelize'][(_0xb967('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35096d=_0x4f6b98;return db[_0xb967('0x70')]['findAll']({'raw':!![]});}return null;})[_0xb967('0x25')](function(_0x5195dc){if(_0x5195dc){_0xa951b2=_[_0xb967('0x71')](_0x5195dc,'id');var _0x3f1da5;var _0x423610=squel[_0xb967('0x72')]();_0x423610[_0xb967('0x73')](_0x52d09b[_0xb967('0x74')]);for(var _0x37aa67=0x0;_0x37aa67<_0x35096d['length'];_0x37aa67+=0x1){_0x3f1da5=_0x35096d[_0x37aa67][_0xb967('0x75')]?_0xa951b2[_0x35096d[_0x37aa67][_0xb967('0x75')]][_0xb967('0x76')]:_0x35096d[_0x37aa67]['field'];_0x3f1da5=_0x35096d[_0x37aa67][_0xb967('0x77')]?_[_0xb967('0x78')](_0x4f79aa[_0x35096d[_0x37aa67][_0xb967('0x77')]],'%s',_0x3f1da5):_0x3f1da5;_0x3f1da5=_0x35096d[_0x37aa67][_0xb967('0x79')]?_[_0xb967('0x78')](_0x447179[_0x35096d[_0x37aa67]['format']],'%s',_0x3f1da5):_0x3f1da5;if(_0x35096d[_0x37aa67][_0xb967('0x7a')]){_0x423610['group'](_0x3f1da5);}_0x35096d[_0x37aa67][_0xb967('0x7b')]&&_0x423610['order'](_0x3f1da5,_0x35096d[_0x37aa67]['orderBy']===_0xb967('0x7c')?![]:!![]);_0x423610[_0xb967('0x6c')](_0x3f1da5,_0x35096d[_0x37aa67][_0xb967('0x7d')]||_0x3f1da5);}if(_0x52d09b[_0xb967('0x7e')]){_0x52d09b[_0xb967('0x7e')]=JSON[_0xb967('0x7f')](_0x52d09b[_0xb967('0x7e')]);for(var _0x2d5afc=0x0;_0x2d5afc<_0x52d09b[_0xb967('0x7e')]['length'];_0x2d5afc+=0x1){if(_0x52d09b[_0xb967('0x7e')][_0x2d5afc][_0xb967('0x31')]&&_[_0xb967('0x64')](_0x54aaa3,_0x52d09b[_0xb967('0x7e')][_0x2d5afc][_0xb967('0x31')])&&_0x52d09b[_0xb967('0x7e')][_0x2d5afc][_0xb967('0x80')]&&_0x52d09b[_0xb967('0x7e')][_0x2d5afc]['foreignTable']&&_0x52d09b[_0xb967('0x7e')][_0x2d5afc][_0xb967('0x81')]){_0x423610[_0x52d09b[_0xb967('0x7e')][_0x2d5afc]['type']](_0x52d09b[_0xb967('0x7e')][_0x2d5afc]['foreignTable'],null,util[_0xb967('0x79')]('%s.%s\x20=\x20%s.%s',_0x52d09b[_0xb967('0x74')],_0x52d09b[_0xb967('0x7e')][_0x2d5afc]['parentKey'],_0x52d09b[_0xb967('0x7e')][_0x2d5afc][_0xb967('0x82')],_0x52d09b[_0xb967('0x7e')][_0x2d5afc]['foreignKey']));}}}if(_0x52d09b['conditions']){_0x52d09b[_0xb967('0x83')]=JSON[_0xb967('0x7f')](_0x52d09b[_0xb967('0x83')]);_0x423610[_0xb967('0x3d')](_0x1f7a44(_0x52d09b[_0xb967('0x83')]['group']));}_0x3fd229=_0x423610['clone']();_0x423610[_0xb967('0x1e')](_0x7a8d0d);_0x423610[_0xb967('0x1c')](0x0);logger[_0xb967('0x84')](_0xb967('0x85'),_0x423610[_0xb967('0x86')]());return dbH['sequelize']['query'](_0x423610[_0xb967('0x86')](),{'type':dbH['sequelize'][_0xb967('0x87')]['SELECT']});}})['then'](respondWithResult(_0x4c1d85,null))[_0xb967('0x43')](handleError(_0x4c1d85,null));};function runReport(_0x3d00ee,_0x17214e,_0x1d907b){var _0x39f7aa=_0x17214e['name'];var _0x8f260d=0xa;var _0x1f3257=[_0xb967('0x52'),_0xb967('0x53'),'right_join',_0xb967('0x55')];var _0x3a0ea7={'SUM':_0xb967('0x56'),'COUNT':_0xb967('0x57'),'COUNT DISTINCT':_0xb967('0x58'),'MAX':_0xb967('0x59'),'MIN':_0xb967('0x5a'),'AVG':_0xb967('0x5b'),'GROUP_CONCAT':_0xb967('0x5c'),'GROUP_CONCAT ASC':_0xb967('0x5d'),'GROUP_CONCAT DESC':_0xb967('0x5e')};var _0x1a68da={'SEC_TO_TIME':_0xb967('0x5f'),'DATE':_0xb967('0x60'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb967('0x63')};var _0x1dbe5a=function(_0x19fcdb){return!_[_0xb967('0x64')]([_0xb967('0x65'),_0xb967('0x66'),_0xb967('0x67'),'IS\x20NOT\x20EMPTY'],_0x19fcdb);};var _0x566293=function(_0x486f50){if(!_0x486f50||!_0x486f50[_0xb967('0x69')][_0xb967('0x47')]){return'';}for(var _0x4f80de='(',_0x5b6337=0x0;_0x5b6337<_0x486f50[_0xb967('0x69')][_0xb967('0x47')];_0x5b6337+=0x1){_0x5b6337>0x0&&(_0x4f80de+='\x20'+_0x486f50[_0xb967('0x6a')]+'\x20');_0x4f80de+=_0x486f50[_0xb967('0x69')][_0x5b6337]['group']?_0x566293(_0x486f50[_0xb967('0x69')][_0x5b6337]['group']):_0x486f50[_0xb967('0x69')][_0x5b6337][_0xb967('0x6c')]+'\x20'+_0x486f50['rules'][_0x5b6337][_0xb967('0x6d')]+(_0x1dbe5a(_0x486f50[_0xb967('0x69')][_0x5b6337][_0xb967('0x6d')])?'\x20'+_0x486f50[_0xb967('0x69')][_0x5b6337][_0xb967('0x6e')]:'');}return _0x4f80de+')';};var _0x310ef7={'where':{'id':_0x3d00ee['id']}},_0x52c771,_0x3d4d47,_0x4d5c85,_0x104b2f,_0x297d5d;_0x310ef7=_[_0xb967('0x3e')]({},_0x310ef7,_0x1d907b);return db[_0xb967('0x2f')][_0xb967('0x4e')](_0x310ef7)['then'](function(_0x18a375){if(_0x18a375){_0x52c771=_0x18a375;return _0x18a375[_0xb967('0x88')]();}return null;})[_0xb967('0x25')](function(_0x4fb1d1){if(_0x4fb1d1){if(!_0x4fb1d1[_0xb967('0x47')]){throw new db[(_0xb967('0x89'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3d4d47=_0x4fb1d1;return db[_0xb967('0x70')][_0xb967('0x8a')]({'raw':!![]});}return null;})[_0xb967('0x25')](function(_0x542207){if(_0x542207){_0x4d5c85=_['keyBy'](_0x542207,'id');var _0x41587f;var _0x19e92f=squel[_0xb967('0x72')]();_0x19e92f[_0xb967('0x73')](_0x52c771[_0xb967('0x74')]);for(var _0x169b19=0x0;_0x169b19<_0x3d4d47[_0xb967('0x47')];_0x169b19+=0x1){_0x41587f=_0x3d4d47[_0x169b19][_0xb967('0x75')]?_0x4d5c85[_0x3d4d47[_0x169b19][_0xb967('0x75')]][_0xb967('0x76')]:_0x3d4d47[_0x169b19]['field'];_0x41587f=_0x3d4d47[_0x169b19][_0xb967('0x77')]?_[_0xb967('0x78')](_0x3a0ea7[_0x3d4d47[_0x169b19][_0xb967('0x77')]],'%s',_0x41587f):_0x41587f;_0x41587f=_0x3d4d47[_0x169b19][_0xb967('0x79')]?_[_0xb967('0x78')](_0x1a68da[_0x3d4d47[_0x169b19][_0xb967('0x79')]],'%s',_0x41587f):_0x41587f;if(_0x3d4d47[_0x169b19][_0xb967('0x7a')]){_0x19e92f[_0xb967('0x6b')](_0x41587f);}_0x3d4d47[_0x169b19][_0xb967('0x7b')]&&_0x19e92f[_0xb967('0x8b')](_0x41587f,_0x3d4d47[_0x169b19][_0xb967('0x7b')]==='DESC'?![]:!![]);_0x19e92f['field'](_0x41587f,_0x3d4d47[_0x169b19][_0xb967('0x7d')]||_0x41587f);}if(_0x52c771[_0xb967('0x7e')]){_0x52c771[_0xb967('0x7e')]=JSON[_0xb967('0x7f')](_0x52c771[_0xb967('0x7e')]);for(var _0x1c7c75=0x0;_0x1c7c75<_0x52c771[_0xb967('0x7e')][_0xb967('0x47')];_0x1c7c75+=0x1){if(_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x31')]&&_[_0xb967('0x64')](_0x1f3257,_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x31')])&&_0x52c771['joins'][_0x1c7c75][_0xb967('0x80')]&&_0x52c771['joins'][_0x1c7c75][_0xb967('0x82')]&&_0x52c771[_0xb967('0x7e')][_0x1c7c75]['foreignKey']){_0x19e92f[_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x31')]](_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x82')],null,util[_0xb967('0x79')](_0xb967('0x8c'),_0x52c771[_0xb967('0x74')],_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x80')],_0x52c771[_0xb967('0x7e')][_0x1c7c75][_0xb967('0x82')],_0x52c771[_0xb967('0x7e')][_0x1c7c75]['foreignKey']));}}}if(_0x52c771[_0xb967('0x83')]){_0x52c771[_0xb967('0x83')]=JSON[_0xb967('0x7f')](_0x52c771[_0xb967('0x83')]);_0x19e92f[_0xb967('0x3d')](_0x566293(_0x52c771[_0xb967('0x83')][_0xb967('0x6b')]));}_0x297d5d=_0x19e92f[_0xb967('0x8d')]();_0x19e92f[_0xb967('0x1e')](_0x8f260d);_0x19e92f[_0xb967('0x1c')](0x0);return;}})[_0xb967('0x25')](function(){if(_0x17214e['output']===_0xb967('0x8e')){return null;}var _0x452127=_[_0xb967('0x3e')](_0x17214e,{'name':_0x17214e[_0xb967('0x8f')]||_0x17214e[_0xb967('0x2b')]||_0x52c771[_0xb967('0x2b')],'basename':_0x39f7aa,'savename':util['format'](_0xb967('0x90'),_0x17214e[_0xb967('0x2b')]||_0x52c771[_0xb967('0x2b')],require(_0xb967('0x91'))[_0xb967('0x92')](0x4),_0x17214e[_0xb967('0x93')]||_0xb967('0x94')),'reportId':_0x52c771['id'],'reportType':_0xb967('0x95')});return db[_0xb967('0x96')][_0xb967('0x50')](_0x452127,{'raw':!![]});})[_0xb967('0x25')](function(_0x2de3ed){if(_0x52c771[_0xb967('0x74')]==='cdr'){_0x297d5d[_0xb967('0x3d')](_0x52c771[_0xb967('0x74')]+_0xb967('0x97'),_0x17214e[_0xb967('0x98')],_0x17214e[_0xb967('0x99')]);}else{_0x297d5d[_0xb967('0x3d')](_0x52c771[_0xb967('0x74')]+_0xb967('0x9a'),_0x17214e[_0xb967('0x98')],_0x17214e[_0xb967('0x99')]);}if(_0x2de3ed){logger[_0xb967('0x9b')]('Run\x20Query:',_0x297d5d[_0xb967('0x86')]());require(_0xb967('0x9c'))[_0xb967('0x9d')](path[_0xb967('0x52')](__dirname,_0xb967('0x9e'),_0x2de3ed['output']),[_0x2de3ed['id'],_0x297d5d[_0xb967('0x86')](),path[_0xb967('0x52')](__dirname,_0xb967('0x9f'),_0x2de3ed[_0xb967('0xa0')]),_0x39f7aa]);return _0x2de3ed;}else{var _0x2a9b2d=squel['select']();_0x2a9b2d[_0xb967('0x73')]('('+_0x297d5d['toString']()+')',_0xb967('0xa1'));_0x2a9b2d[_0xb967('0x6c')](_0xb967('0xa2'),_0xb967('0x1f'));_0x297d5d[_0xb967('0x1e')](_0x17214e[_0xb967('0x1e')]||_0x8f260d);_0x297d5d['offset'](_0x17214e[_0xb967('0x1c')]||0x0);return dbH[_0xb967('0xa3')][_0xb967('0x35')](_0x2a9b2d[_0xb967('0x86')](),{'type':dbH[_0xb967('0xa3')][_0xb967('0x87')]['SELECT']})[_0xb967('0x25')](function(_0x39a74d){if(!_0x39a74d['length']){_0x104b2f=0x0;}else{_0x104b2f=_0x39a74d[0x0][_0xb967('0x1f')]||0x0;}return dbH[_0xb967('0xa3')]['query'](_0x297d5d[_0xb967('0x86')](),{'type':dbH[_0xb967('0xa3')][_0xb967('0x87')]['SELECT']});})[_0xb967('0x25')](function(_0x254943){return{'rows':_0x254943||[],'count':_0x104b2f};});}});}exports['run']=function(_0x1faf82,_0x34e0f2){return runReport(_0x1faf82['params'],_0x1faf82[_0xb967('0x35')],_0x1faf82[_0xb967('0x40')])[_0xb967('0x25')](respondWithResult(_0x34e0f2,null))[_0xb967('0x43')](handleError(_0x34e0f2,null));};exports[_0xb967('0xa4')]=runReport;exports['query']=function(_0xc3b7a8,_0x244c0d){var _0x463ab2=0xa;var _0x8e0590=[_0xb967('0x52'),_0xb967('0x53'),_0xb967('0x54'),_0xb967('0x55')];var _0x2d1130={'SUM':'SUM(%s)','COUNT':_0xb967('0x57'),'COUNT DISTINCT':_0xb967('0x58'),'MAX':_0xb967('0x59'),'MIN':_0xb967('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb967('0x5c'),'GROUP_CONCAT ASC':_0xb967('0x5d'),'GROUP_CONCAT DESC':_0xb967('0x5e')};var _0x5c9dad={'SEC_TO_TIME':_0xb967('0x5f'),'DATE':_0xb967('0x60'),'HOUR':_0xb967('0x61'),'ROUND':_0xb967('0x62'),'UNIX_TIMESTAMP':_0xb967('0x63')};var _0x4f4782=function(_0x4ac883){return!_[_0xb967('0x64')]([_0xb967('0x65'),_0xb967('0x66'),_0xb967('0x67'),_0xb967('0x68')],_0x4ac883);};var _0xe90733=function(_0x46837d){if(!_0x46837d||!_0x46837d[_0xb967('0x69')]['length']){return'';}for(var _0x3ec140='(',_0x26e93d=0x0;_0x26e93d<_0x46837d[_0xb967('0x69')][_0xb967('0x47')];_0x26e93d+=0x1){_0x26e93d>0x0&&(_0x3ec140+='\x20'+_0x46837d[_0xb967('0x6a')]+'\x20');_0x3ec140+=_0x46837d[_0xb967('0x69')][_0x26e93d][_0xb967('0x6b')]?_0xe90733(_0x46837d[_0xb967('0x69')][_0x26e93d][_0xb967('0x6b')]):_0x46837d[_0xb967('0x69')][_0x26e93d][_0xb967('0x6c')]+'\x20'+_0x46837d[_0xb967('0x69')][_0x26e93d][_0xb967('0x6d')]+(_0x4f4782(_0x46837d[_0xb967('0x69')][_0x26e93d][_0xb967('0x6d')])?'\x20'+_0x46837d['rules'][_0x26e93d][_0xb967('0x6e')]:'');}return _0x3ec140+')';};var _0x50e7b9={'where':{'id':_0xc3b7a8[_0xb967('0x45')]['id']}},_0x2e1a44,_0x16761b,_0x3fba3d,_0x52ae6f,_0x230b16;_0x50e7b9=_['merge']({},_0x50e7b9,_0xc3b7a8[_0xb967('0x40')]);return db[_0xb967('0x2f')][_0xb967('0x4e')](_0x50e7b9)[_0xb967('0x25')](function(_0x2e8048){if(_0x2e8048){_0x2e1a44=_0x2e8048;return _0x2e8048['getFields']();}return null;})[_0xb967('0x25')](function(_0x183cd4){if(_0x183cd4){if(!_0x183cd4[_0xb967('0x47')]){throw new db[(_0xb967('0x89'))][(_0xb967('0x6f'))](_0xb967('0xa5'),0x193);}_0x16761b=_0x183cd4;return db[_0xb967('0x70')][_0xb967('0x8a')]({'raw':!![]});}return null;})[_0xb967('0x25')](function(_0x12847c){if(_0x12847c){_0x3fba3d=_[_0xb967('0x71')](_0x12847c,'id');var _0x5165a4;var _0x1f832a=squel[_0xb967('0x72')]();_0x1f832a['from'](_0x2e1a44[_0xb967('0x74')]);for(var _0x1748d5=0x0;_0x1748d5<_0x16761b[_0xb967('0x47')];_0x1748d5+=0x1){_0x5165a4=_0x16761b[_0x1748d5][_0xb967('0x75')]?_0x3fba3d[_0x16761b[_0x1748d5]['MetricId']][_0xb967('0x76')]:_0x16761b[_0x1748d5][_0xb967('0x6c')];_0x5165a4=_0x16761b[_0x1748d5][_0xb967('0x77')]?_['replace'](_0x2d1130[_0x16761b[_0x1748d5][_0xb967('0x77')]],'%s',_0x5165a4):_0x5165a4;_0x5165a4=_0x16761b[_0x1748d5][_0xb967('0x79')]?_[_0xb967('0x78')](_0x5c9dad[_0x16761b[_0x1748d5][_0xb967('0x79')]],'%s',_0x5165a4):_0x5165a4;if(_0x16761b[_0x1748d5]['groupBy']){_0x1f832a[_0xb967('0x6b')](_0x5165a4);}_0x16761b[_0x1748d5][_0xb967('0x7b')]&&_0x1f832a[_0xb967('0x8b')](_0x5165a4,_0x16761b[_0x1748d5][_0xb967('0x7b')]==='DESC'?![]:!![]);_0x1f832a['field'](_0x5165a4,_0x16761b[_0x1748d5][_0xb967('0x7d')]||_0x5165a4);}if(_0x2e1a44['joins']){_0x2e1a44['joins']=JSON[_0xb967('0x7f')](_0x2e1a44[_0xb967('0x7e')]);for(var _0x37d9fe=0x0;_0x37d9fe<_0x2e1a44['joins']['length'];_0x37d9fe+=0x1){if(_0x2e1a44['joins'][_0x37d9fe][_0xb967('0x31')]&&_[_0xb967('0x64')](_0x8e0590,_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x31')])&&_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x80')]&&_0x2e1a44['joins'][_0x37d9fe]['foreignTable']&&_0x2e1a44['joins'][_0x37d9fe][_0xb967('0x81')]){_0x1f832a[_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x31')]](_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x82')],null,util[_0xb967('0x79')](_0xb967('0x8c'),_0x2e1a44['table'],_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x80')],_0x2e1a44[_0xb967('0x7e')][_0x37d9fe][_0xb967('0x82')],_0x2e1a44[_0xb967('0x7e')][_0x37d9fe]['foreignKey']));}}}if(_0x2e1a44[_0xb967('0x83')]){_0x2e1a44[_0xb967('0x83')]=JSON[_0xb967('0x7f')](_0x2e1a44[_0xb967('0x83')]);_0x1f832a[_0xb967('0x3d')](_0xe90733(_0x2e1a44['conditions'][_0xb967('0x6b')]));}_0x230b16=_0x1f832a[_0xb967('0x8d')]();_0x1f832a[_0xb967('0x1e')](_0x463ab2);_0x1f832a[_0xb967('0x1c')](0x0);logger[_0xb967('0x84')](_0xb967('0x85'),_0x1f832a['toString']());return dbH['sequelize'][_0xb967('0x35')](_0x1f832a['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xb967('0xa6')]});}})[_0xb967('0x25')](function(){return{'sql':_0x230b16[_0xb967('0x86')]()};})[_0xb967('0x25')](respondWithResult(_0x244c0d,null))['catch'](handleError(_0x244c0d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0c8f06d..a31184d 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 _0x2b89=['../../config/logger','api','moment','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','util'];(function(_0xb1c479,_0xaa6368){var _0x359e87=function(_0x2bb9a0){while(--_0x2bb9a0){_0xb1c479['push'](_0xb1c479['shift']());}};_0x359e87(++_0xaa6368);}(_0x2b89,0x10d));var _0x92b8=function(_0x18f6fa,_0x1bf166){_0x18f6fa=_0x18f6fa-0x0;var _0x3f73d1=_0x2b89[_0x18f6fa];return _0x3f73d1;};'use strict';var _=require('lodash');var util=require(_0x92b8('0x0'));var logger=require(_0x92b8('0x1'))(_0x92b8('0x2'));var moment=require(_0x92b8('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b8('0x4'));var fs=require('fs');var path=require(_0x92b8('0x5'));var rimraf=require(_0x92b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x92b8('0x7'));module[_0x92b8('0x8')]=function(_0x17b1c8,_0x419960){return _0x17b1c8['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa8=['exports','define','util','../../config/logger','moment','bluebird','path','rimraf','./analyticCustomReport.attributes'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x7fa8,0x1a0));var _0x87fa=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x7fa8[_0x1e1965];return _0x1a2e96;};'use strict';var _=require('lodash');var util=require(_0x87fa('0x0'));var logger=require(_0x87fa('0x1'))('api');var moment=require(_0x87fa('0x2'));var BPromise=require(_0x87fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87fa('0x4'));var rimraf=require(_0x87fa('0x5'));var config=require('../../config/environment');var attributes=require(_0x87fa('0x6'));module[_0x87fa('0x7')]=function(_0x8176e8,_0x236f1a){return _0x8176e8[_0x87fa('0x8')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 6ee720b..85ca366 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 _0x52fa=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x533085,_0x46f36f){var _0x3e3706=function(_0x244318){while(--_0x244318){_0x533085['push'](_0x533085['shift']());}};_0x3e3706(++_0x46f36f);}(_0x52fa,0xac));var _0xa52f=function(_0x5e4284,_0xfca9c8){_0x5e4284=_0x5e4284-0x0;var _0x3c70b6=_0x52fa[_0x5e4284];return _0x3c70b6;};'use strict';var _=require('lodash');var util=require(_0xa52f('0x0'));var moment=require(_0xa52f('0x1'));var BPromise=require(_0xa52f('0x2'));var rs=require(_0xa52f('0x3'));var fs=require('fs');var Redis=require(_0xa52f('0x4'));var db=require(_0xa52f('0x5'))['db'];var utils=require(_0xa52f('0x6'));var logger=require(_0xa52f('0x7'))('rpc');var config=require(_0xa52f('0x8'));var jayson=require(_0xa52f('0x9'));var client=jayson[_0xa52f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x530256,_0x2750e0,_0x499102){return new BPromise(function(_0x3ebc40,_0x50ac2b){return client['request'](_0x530256,_0x499102)['then'](function(_0x38cb49){logger[_0xa52f('0xb')](_0xa52f('0xc'),_0x2750e0,'request\x20sent');logger[_0xa52f('0xd')](_0xa52f('0xe'),_0x2750e0,_0xa52f('0xf'),JSON[_0xa52f('0x10')](_0x38cb49));if(_0x38cb49[_0xa52f('0x11')]){if(_0x38cb49[_0xa52f('0x11')][_0xa52f('0x12')]===0x1f4){logger['error'](_0xa52f('0xc'),_0x2750e0,_0x38cb49['error'][_0xa52f('0x13')]);return _0x50ac2b(_0x38cb49[_0xa52f('0x11')][_0xa52f('0x13')]);}logger[_0xa52f('0x11')](_0xa52f('0xc'),_0x2750e0,_0x38cb49[_0xa52f('0x11')][_0xa52f('0x13')]);return _0x3ebc40(_0x38cb49[_0xa52f('0x11')]['message']);}else{logger[_0xa52f('0xb')](_0xa52f('0xc'),_0x2750e0,'request\x20sent');_0x3ebc40(_0x38cb49['result'][_0xa52f('0x13')]);}})[_0xa52f('0x14')](function(_0x2f7d7b){logger[_0xa52f('0x11')](_0xa52f('0xc'),_0x2750e0,_0x2f7d7b);_0x50ac2b(_0x2f7d7b);});});} \ No newline at end of file +var _0x421c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x18957c,_0x52e3f8){var _0x4ce71f=function(_0x43b06d){while(--_0x43b06d){_0x18957c['push'](_0x18957c['shift']());}};_0x4ce71f(++_0x52e3f8);}(_0x421c,0x9d));var _0xc421=function(_0x828138,_0x1eff89){_0x828138=_0x828138-0x0;var _0x2fb7c8=_0x421c[_0x828138];return _0x2fb7c8;};'use strict';var _=require(_0xc421('0x0'));var util=require('util');var moment=require(_0xc421('0x1'));var BPromise=require(_0xc421('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc421('0x3'));var db=require(_0xc421('0x4'))['db'];var utils=require(_0xc421('0x5'));var logger=require(_0xc421('0x6'))(_0xc421('0x7'));var config=require(_0xc421('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x146ee9,_0x37e4c5,_0x18ab1b){return new BPromise(function(_0x1177a0,_0x41c241){return client['request'](_0x146ee9,_0x18ab1b)[_0xc421('0x9')](function(_0x24bc32){logger[_0xc421('0xa')](_0xc421('0xb'),_0x37e4c5,_0xc421('0xc'));logger[_0xc421('0xd')](_0xc421('0xe'),_0x37e4c5,_0xc421('0xc'),JSON[_0xc421('0xf')](_0x24bc32));if(_0x24bc32[_0xc421('0x10')]){if(_0x24bc32[_0xc421('0x10')][_0xc421('0x11')]===0x1f4){logger[_0xc421('0x10')](_0xc421('0xb'),_0x37e4c5,_0x24bc32[_0xc421('0x10')][_0xc421('0x12')]);return _0x41c241(_0x24bc32['error'][_0xc421('0x12')]);}logger[_0xc421('0x10')](_0xc421('0xb'),_0x37e4c5,_0x24bc32[_0xc421('0x10')]['message']);return _0x1177a0(_0x24bc32['error'][_0xc421('0x12')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x37e4c5,'request\x20sent');_0x1177a0(_0x24bc32[_0xc421('0x13')][_0xc421('0x12')]);}})['catch'](function(_0x2ba01c){logger['error'](_0xc421('0xb'),_0x37e4c5,_0x2ba01c);_0x41c241(_0x2ba01c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3a4a780..0f661b7 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 _0x6d01=['/:id/run','query','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x6d01,0x71));var _0x16d0=function(_0x4d1b0a,_0x14bbf8){_0x4d1b0a=_0x4d1b0a-0x0;var _0x48adbf=_0x6d01[_0x4d1b0a];return _0x48adbf;};'use strict';var multer=require(_0x16d0('0x0'));var util=require(_0x16d0('0x1'));var path=require(_0x16d0('0x2'));var timeout=require(_0x16d0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16d0('0x4'));var interaction=require(_0x16d0('0x5'));var config=require(_0x16d0('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x16d0('0x7')]('/',auth[_0x16d0('0x8')](),controller[_0x16d0('0x9')]);router['get'](_0x16d0('0xa'),auth['isAuthenticated'](),controller[_0x16d0('0xb')]);router['get'](_0x16d0('0xc'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x16d0('0xd'),auth[_0x16d0('0x8')](),controller['run']);router['get']('/:id/query',auth[_0x16d0('0x8')](),controller[_0x16d0('0xe')]);router[_0x16d0('0xf')]('/',auth['isAuthenticated'](),controller[_0x16d0('0x10')]);router[_0x16d0('0x11')](_0x16d0('0xa'),auth[_0x16d0('0x8')](),controller[_0x16d0('0x12')]);router[_0x16d0('0x13')](_0x16d0('0xa'),auth['isAuthenticated'](),controller[_0x16d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7256=['index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x6c7595,_0x2afeff){var _0x2e9f1d=function(_0x19687d){while(--_0x19687d){_0x6c7595['push'](_0x6c7595['shift']());}};_0x2e9f1d(++_0x2afeff);}(_0x7256,0x72));var _0x6725=function(_0x2ea3b0,_0x733235){_0x2ea3b0=_0x2ea3b0-0x0;var _0x82ee96=_0x7256[_0x2ea3b0];return _0x82ee96;};'use strict';var multer=require(_0x6725('0x0'));var util=require('util');var path=require(_0x6725('0x1'));var timeout=require(_0x6725('0x2'));var express=require(_0x6725('0x3'));var router=express[_0x6725('0x4')]();var fs_extra=require(_0x6725('0x5'));var auth=require(_0x6725('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6725('0x7'));var controller=require(_0x6725('0x8'));router[_0x6725('0x9')]('/',auth[_0x6725('0xa')](),controller[_0x6725('0xb')]);router[_0x6725('0x9')](_0x6725('0xc'),auth[_0x6725('0xa')](),controller[_0x6725('0xd')]);router[_0x6725('0x9')](_0x6725('0xe'),auth[_0x6725('0xa')](),controller[_0x6725('0xf')]);router['get'](_0x6725('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x6725('0x9')](_0x6725('0x11'),auth['isAuthenticated'](),controller[_0x6725('0x12')]);router[_0x6725('0x13')]('/',auth['isAuthenticated'](),controller[_0x6725('0x14')]);router[_0x6725('0x15')](_0x6725('0xc'),auth[_0x6725('0xa')](),controller['update']);router[_0x6725('0x16')](_0x6725('0xc'),auth['isAuthenticated'](),controller[_0x6725('0x17')]);module[_0x6725('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c1844a2..83dee5f 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0xe50213,_0x33d3a7){var _0x580080=function(_0x23587a){while(--_0x23587a){_0xe50213['push'](_0xe50213['shift']());}};_0x580080(++_0x33d3a7);}(_0x814b,0x1a2));var _0xb814=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x814b[_0x5a5395];return _0x4da43d;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2e7f75,_0x17ba6d){_0x2e7f75=_0x2e7f75-0x0;var _0x4a0029=_0x8ef6[_0x2e7f75];return _0x4a0029;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('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 b30d867..85f399b 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x1e46a5,_0x5b094e){var _0x35a2cf=function(_0x5e7c65){while(--_0x5e7c65){_0x1e46a5['push'](_0x1e46a5['shift']());}};_0x35a2cf(++_0x5b094e);}(_0x4819,0xcd));var _0x9481=function(_0x49a17d,_0x38066e){_0x49a17d=_0x49a17d-0x0;var _0x1810c0=_0x4819[_0x49a17d];return _0x1810c0;};'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'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x7a54,0x106));var _0x47a5=function(_0x382645,_0x196c44){_0x382645=_0x382645-0x0;var _0x4a34fb=_0x7a54[_0x382645];return _0x4a34fb;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8faae59..9260346 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 _0xca25=['util','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x57b57e,_0x2d7e58){var _0x6d4b40=function(_0x39914d){while(--_0x39914d){_0x57b57e['push'](_0x57b57e['shift']());}};_0x6d4b40(++_0x2d7e58);}(_0xca25,0x1ac));var _0x5ca2=function(_0xf351f3,_0x4a90f4){_0xf351f3=_0xf351f3-0x0;var _0x21d574=_0xca25[_0xf351f3];return _0x21d574;};'use strict';var _=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var logger=require('../../config/logger')(_0x5ca2('0x2'));var moment=require(_0x5ca2('0x3'));var BPromise=require(_0x5ca2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca2('0x5'));var rimraf=require(_0x5ca2('0x6'));var config=require(_0x5ca2('0x7'));var attributes=require(_0x5ca2('0x8'));module[_0x5ca2('0x9')]=function(_0x4ce3be,_0x406b8f){return _0x4ce3be[_0x5ca2('0xa')](_0x5ca2('0xb'),attributes,{'tableName':_0x5ca2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9316=['./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9316,0x16c));var _0x6931=function(_0x3d4995,_0x3bd75d){_0x3d4995=_0x3d4995-0x0;var _0x263a2c=_0x9316[_0x3d4995];return _0x263a2c;};'use strict';var _=require(_0x6931('0x0'));var util=require(_0x6931('0x1'));var logger=require(_0x6931('0x2'))(_0x6931('0x3'));var moment=require(_0x6931('0x4'));var BPromise=require(_0x6931('0x5'));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(_0x6931('0x6'));module[_0x6931('0x7')]=function(_0x2c3127,_0x4279e5){return _0x2c3127['define'](_0x6931('0x8'),attributes,{'tableName':_0x6931('0x9'),'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 e9a7d93..d2f81b2 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 _0x7cae=['rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0x7cae,0x69));var _0xe7ca=function(_0x21e97b,_0x65a77f){_0x21e97b=_0x21e97b-0x0;var _0x10ba44=_0x7cae[_0x21e97b];return _0x10ba44;};'use strict';var _=require(_0xe7ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe7ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7ca('0x2'))['db'];var utils=require(_0xe7ca('0x3'));var logger=require(_0xe7ca('0x4'))(_0xe7ca('0x5'));var config=require(_0xe7ca('0x6'));var jayson=require(_0xe7ca('0x7'));var client=jayson[_0xe7ca('0x8')][_0xe7ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11e924,_0x1ddd2d,_0x4e996e){return new BPromise(function(_0x473b90,_0x1ace4b){return client[_0xe7ca('0xa')](_0x11e924,_0x4e996e)[_0xe7ca('0xb')](function(_0x5c53a1){logger['info'](_0xe7ca('0xc'),_0x1ddd2d,_0xe7ca('0xd'));logger[_0xe7ca('0xe')](_0xe7ca('0xf'),_0x1ddd2d,_0xe7ca('0xd'),JSON[_0xe7ca('0x10')](_0x5c53a1));if(_0x5c53a1[_0xe7ca('0x11')]){if(_0x5c53a1[_0xe7ca('0x11')][_0xe7ca('0x12')]===0x1f4){logger[_0xe7ca('0x11')](_0xe7ca('0xc'),_0x1ddd2d,_0x5c53a1[_0xe7ca('0x11')]['message']);return _0x1ace4b(_0x5c53a1['error'][_0xe7ca('0x13')]);}logger[_0xe7ca('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1ddd2d,_0x5c53a1['error'][_0xe7ca('0x13')]);return _0x473b90(_0x5c53a1['error'][_0xe7ca('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1ddd2d,_0xe7ca('0xd'));_0x473b90(_0x5c53a1[_0xe7ca('0x14')][_0xe7ca('0x13')]);}})[_0xe7ca('0x15')](function(_0x209590){logger[_0xe7ca('0x11')](_0xe7ca('0xc'),_0x1ddd2d,_0x209590);_0x1ace4b(_0x209590);});});} \ No newline at end of file +var _0x9ae1=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug'];(function(_0x410445,_0x5d293a){var _0x569994=function(_0x7da4cb){while(--_0x7da4cb){_0x410445['push'](_0x410445['shift']());}};_0x569994(++_0x5d293a);}(_0x9ae1,0x166));var _0x19ae=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x9ae1[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x19ae('0x0'));var util=require(_0x19ae('0x1'));var moment=require(_0x19ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x19ae('0x3'));var fs=require('fs');var Redis=require(_0x19ae('0x4'));var db=require(_0x19ae('0x5'))['db'];var utils=require(_0x19ae('0x6'));var logger=require('../../config/logger')(_0x19ae('0x7'));var config=require(_0x19ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19ae('0x9')][_0x19ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4025b6,_0xbb72d5,_0x43d51e){return new BPromise(function(_0x43edc4,_0xbbb7d7){return client[_0x19ae('0xb')](_0x4025b6,_0x43d51e)[_0x19ae('0xc')](function(_0x28cbb4){logger[_0x19ae('0xd')](_0x19ae('0xe'),_0xbb72d5,'request\x20sent');logger[_0x19ae('0xf')](_0x19ae('0x10'),_0xbb72d5,_0x19ae('0x11'),JSON['stringify'](_0x28cbb4));if(_0x28cbb4[_0x19ae('0x12')]){if(_0x28cbb4[_0x19ae('0x12')][_0x19ae('0x13')]===0x1f4){logger[_0x19ae('0x12')](_0x19ae('0xe'),_0xbb72d5,_0x28cbb4['error']['message']);return _0xbbb7d7(_0x28cbb4[_0x19ae('0x12')][_0x19ae('0x14')]);}logger[_0x19ae('0x12')](_0x19ae('0xe'),_0xbb72d5,_0x28cbb4[_0x19ae('0x12')][_0x19ae('0x14')]);return _0x43edc4(_0x28cbb4[_0x19ae('0x12')][_0x19ae('0x14')]);}else{logger[_0x19ae('0xd')](_0x19ae('0xe'),_0xbb72d5,_0x19ae('0x11'));_0x43edc4(_0x28cbb4[_0x19ae('0x15')][_0x19ae('0x14')]);}})['catch'](function(_0x1e60fb){logger[_0x19ae('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xbb72d5,_0x1e60fb);_0xbbb7d7(_0x1e60fb);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 384ff24..1803bd4 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 _0x2a64=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query','post','create','put','/:id','update'];(function(_0x3b78a7,_0x176b87){var _0x1ba416=function(_0x18f8b8){while(--_0x18f8b8){_0x3b78a7['push'](_0x3b78a7['shift']());}};_0x1ba416(++_0x176b87);}(_0x2a64,0xc1));var _0x42a6=function(_0x40eb53,_0x56448f){_0x40eb53=_0x40eb53-0x0;var _0x50698a=_0x2a64[_0x40eb53];return _0x50698a;};'use strict';var multer=require(_0x42a6('0x0'));var util=require(_0x42a6('0x1'));var path=require(_0x42a6('0x2'));var timeout=require(_0x42a6('0x3'));var express=require('express');var router=express[_0x42a6('0x4')]();var fs_extra=require(_0x42a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x42a6('0x6'));var config=require(_0x42a6('0x7'));var controller=require(_0x42a6('0x8'));router[_0x42a6('0x9')]('/',auth[_0x42a6('0xa')](),controller[_0x42a6('0xb')]);router['get']('/:id',auth[_0x42a6('0xa')](),controller[_0x42a6('0xc')]);router['get'](_0x42a6('0xd'),auth[_0x42a6('0xa')](),controller[_0x42a6('0xe')]);router[_0x42a6('0x9')](_0x42a6('0xf'),auth[_0x42a6('0xa')](),controller[_0x42a6('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x42a6('0x11')]);router[_0x42a6('0x12')]('/',auth[_0x42a6('0xa')](),controller[_0x42a6('0x13')]);router[_0x42a6('0x14')](_0x42a6('0x15'),auth[_0x42a6('0xa')](),controller[_0x42a6('0x16')]);router['delete']('/:id',auth[_0x42a6('0xa')](),controller['destroy']);module[_0x42a6('0x17')]=router; \ No newline at end of file +var _0x066e=['preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x066e,0x11e));var _0xe066=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x066e[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0xe066('0x0'));var util=require('util');var path=require(_0xe066('0x1'));var timeout=require(_0xe066('0x2'));var express=require(_0xe066('0x3'));var router=express['Router']();var fs_extra=require(_0xe066('0x4'));var auth=require(_0xe066('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe066('0x6'));var controller=require(_0xe066('0x7'));router[_0xe066('0x8')]('/',auth[_0xe066('0x9')](),controller[_0xe066('0xa')]);router['get']('/:id',auth[_0xe066('0x9')](),controller[_0xe066('0xb')]);router['get'](_0xe066('0xc'),auth[_0xe066('0x9')](),controller[_0xe066('0xd')]);router[_0xe066('0x8')](_0xe066('0xe'),auth[_0xe066('0x9')](),controller[_0xe066('0xf')]);router['get'](_0xe066('0x10'),auth['isAuthenticated'](),controller[_0xe066('0x11')]);router[_0xe066('0x12')]('/',auth['isAuthenticated'](),controller[_0xe066('0x13')]);router[_0xe066('0x14')]('/:id',auth[_0xe066('0x9')](),controller[_0xe066('0x15')]);router['delete']('/:id',auth[_0xe066('0x9')](),controller[_0xe066('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a1f3999..f0498fb 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 _0xcd2d=['sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x324355,_0x4b7794){var _0x655caa=function(_0x64943f){while(--_0x64943f){_0x324355['push'](_0x324355['shift']());}};_0x655caa(++_0x4b7794);}(_0xcd2d,0x12b));var _0xdcd2=function(_0x7df98e,_0x220a4c){_0x7df98e=_0x7df98e-0x0;var _0x3103e0=_0xcd2d[_0x7df98e];return _0x3103e0;};'use strict';var Sequelize=require(_0xdcd2('0x0'));var moment=require(_0xdcd2('0x1'));module[_0xdcd2('0x2')]={'name':{'type':Sequelize[_0xdcd2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xdcd2('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xdcd2('0x4')](_0xdcd2('0x5'),_0xdcd2('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xdcd2('0x5')},'savename':{'type':Sequelize[_0xdcd2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xdcd2('0x7')]},'endDate':{'type':Sequelize[_0xdcd2('0x7')]},'status':{'type':Sequelize[_0xdcd2('0x3')],'defaultValue':_0xdcd2('0x8')},'type':{'type':Sequelize[_0xdcd2('0x4')](_0xdcd2('0x9'),_0xdcd2('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xdcd2('0xb')](0xb)[_0xdcd2('0xc')]},'reportType':{'type':Sequelize[_0xdcd2('0x3')]}}; \ No newline at end of file +var _0x704d=['scheduled','INTEGER','UNSIGNED','moment','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x526d6c,_0x1cc58a){var _0x43b854=function(_0x2768d5){while(--_0x2768d5){_0x526d6c['push'](_0x526d6c['shift']());}};_0x43b854(++_0x1cc58a);}(_0x704d,0x18f));var _0xd704=function(_0x40ba77,_0x2ae320){_0x40ba77=_0x40ba77-0x0;var _0x30ae6b=_0x704d[_0x40ba77];return _0x30ae6b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd704('0x0'));module['exports']={'name':{'type':Sequelize[_0xd704('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xd704('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xd704('0x2')](_0xd704('0x3'),_0xd704('0x4'),_0xd704('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xd704('0x6')]},'endDate':{'type':Sequelize[_0xd704('0x6')]},'status':{'type':Sequelize[_0xd704('0x1')],'defaultValue':_0xd704('0x7')},'type':{'type':Sequelize[_0xd704('0x2')](_0xd704('0x8'),_0xd704('0x9')),'allowNull':![],'defaultValue':_0xd704('0x8')},'reportId':{'type':Sequelize[_0xd704('0xa')](0xb)[_0xd704('0xb')]},'reportType':{'type':Sequelize[_0xd704('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5543677..edca778 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 _0x6061=['reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','sendStatus','download','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x4432e0,_0x5b332d){var _0x29e13f=function(_0x5b71e8){while(--_0x5b71e8){_0x4432e0['push'](_0x4432e0['shift']());}};_0x29e13f(++_0x5b332d);}(_0x6061,0x16b));var _0x1606=function(_0x545485,_0x2c64b1){_0x545485=_0x545485-0x0;var _0x260fb0=_0x6061[_0x545485];return _0x260fb0;};'use strict';var emlformat=require(_0x1606('0x0'));var rimraf=require(_0x1606('0x1'));var zipdir=require(_0x1606('0x2'));var jsonpatch=require(_0x1606('0x3'));var rp=require(_0x1606('0x4'));var moment=require('moment');var BPromise=require(_0x1606('0x5'));var Mustache=require(_0x1606('0x6'));var util=require(_0x1606('0x7'));var path=require(_0x1606('0x8'));var sox=require(_0x1606('0x9'));var csv=require(_0x1606('0xa'));var ejs=require(_0x1606('0xb'));var fs=require('fs');var fs_extra=require(_0x1606('0xc'));var _=require(_0x1606('0xd'));var squel=require(_0x1606('0xe'));var crypto=require(_0x1606('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1606('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1606('0x11'));var Redis=require(_0x1606('0x12'));var authService=require(_0x1606('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1606('0x14'));var hardwareService=require(_0x1606('0x15'));var logger=require(_0x1606('0x16'))('api');var utils=require(_0x1606('0x17'));var config=require(_0x1606('0x18'));var licenseUtil=require(_0x1606('0x19'));var db=require(_0x1606('0x1a'))['db'];function respondWithStatusCode(_0x5ad981,_0x38b428){_0x38b428=_0x38b428||0xcc;return function(_0x150d74){if(_0x150d74){return _0x5ad981['sendStatus'](_0x38b428);}return _0x5ad981[_0x1606('0x1b')](_0x38b428)[_0x1606('0x1c')]();};}function respondWithResult(_0x3a9604,_0x2b8ba0){_0x2b8ba0=_0x2b8ba0||0xc8;return function(_0x29ff0a){if(_0x29ff0a){return _0x3a9604[_0x1606('0x1b')](_0x2b8ba0)['json'](_0x29ff0a);}};}function respondWithFilteredResult(_0x2964e7,_0x56da97){return function(_0x30df8d){if(_0x30df8d){var _0x194f6b=typeof _0x56da97[_0x1606('0x1d')]===_0x1606('0x1e')&&typeof _0x56da97[_0x1606('0x1f')]==='undefined';var _0x1938a7=_0x30df8d[_0x1606('0x20')];var _0x4f0971=_0x194f6b?0x0:_0x56da97[_0x1606('0x1d')];var _0xb30dd2=_0x194f6b?_0x30df8d[_0x1606('0x20')]:_0x56da97[_0x1606('0x1d')]+_0x56da97[_0x1606('0x1f')];var _0x2a6b4e;if(_0xb30dd2>=_0x1938a7){_0xb30dd2=_0x1938a7;_0x2a6b4e=0xc8;}else{_0x2a6b4e=0xce;}_0x2964e7[_0x1606('0x1b')](_0x2a6b4e);return _0x2964e7[_0x1606('0x21')](_0x1606('0x22'),_0x4f0971+'-'+_0xb30dd2+'/'+_0x1938a7)[_0x1606('0x23')](_0x30df8d);}return null;};}function patchUpdates(_0x5cca18){return function(_0x188f27){try{jsonpatch[_0x1606('0x24')](_0x188f27,_0x5cca18,!![]);}catch(_0x354a2a){return BPromise[_0x1606('0x25')](_0x354a2a);}return _0x188f27[_0x1606('0x26')]();};}function saveUpdates(_0x31f182,_0x36decc){return function(_0xd85f30){if(_0xd85f30){return _0xd85f30[_0x1606('0x27')](_0x31f182)['then'](function(_0x54ef36){return _0x54ef36;});}return null;};}function removeEntity(_0x4d872f,_0x5ea195){return function(_0x337251){if(_0x337251){return _0x337251[_0x1606('0x28')]()[_0x1606('0x29')](function(){var _0x38c5db=_0x337251[_0x1606('0x2a')]({'plain':!![]});var _0xbb6060='ExtractedReports';return db[_0x1606('0x2b')][_0x1606('0x28')]({'where':{'type':_0xbb6060,'resourceId':_0x38c5db['id']}})[_0x1606('0x29')](function(){return _0x337251;});})['then'](function(){_0x4d872f['status'](0xcc)[_0x1606('0x1c')]();});}};}function handleEntityNotFound(_0x39f7e6,_0x440355){return function(_0x334580){if(!_0x334580){_0x39f7e6['sendStatus'](0x194);}return _0x334580;};}function handleError(_0x3ef738,_0x2c7a36){_0x2c7a36=_0x2c7a36||0x1f4;return function(_0x148b19){logger[_0x1606('0x2c')](_0x148b19[_0x1606('0x2d')]);if(_0x148b19[_0x1606('0x2e')]){delete _0x148b19[_0x1606('0x2e')];}_0x3ef738[_0x1606('0x1b')](_0x2c7a36)['send'](_0x148b19);};}exports[_0x1606('0x2f')]=function(_0x288d68,_0x27fb87){var _0x245a5a={},_0x106105={},_0x5c6b96={'count':0x0,'rows':[]};var _0x189e34=_[_0x1606('0x30')](db[_0x1606('0x31')][_0x1606('0x32')],function(_0x37add3){return{'name':_0x37add3[_0x1606('0x33')],'type':_0x37add3[_0x1606('0x34')]['key']};});_0x106105['model']=_[_0x1606('0x30')](_0x189e34,'name');_0x106105[_0x1606('0x35')]=_['keys'](_0x288d68['query']);_0x106105[_0x1606('0x36')]=_['intersection'](_0x106105['model'],_0x106105[_0x1606('0x35')]);_0x245a5a[_0x1606('0x37')]=_[_0x1606('0x38')](_0x106105[_0x1606('0x39')],qs[_0x1606('0x3a')](_0x288d68['query'][_0x1606('0x3a')]));_0x245a5a[_0x1606('0x37')]=_0x245a5a[_0x1606('0x37')][_0x1606('0x3b')]?_0x245a5a[_0x1606('0x37')]:_0x106105[_0x1606('0x39')];if(!_0x288d68[_0x1606('0x35')][_0x1606('0x3c')](_0x1606('0x3d'))){_0x245a5a['limit']=qs[_0x1606('0x1f')](_0x288d68['query']['limit']);_0x245a5a[_0x1606('0x1d')]=qs[_0x1606('0x1d')](_0x288d68[_0x1606('0x35')][_0x1606('0x1d')]);}_0x245a5a[_0x1606('0x3e')]=qs[_0x1606('0x3f')](_0x288d68['query'][_0x1606('0x3f')]);_0x245a5a[_0x1606('0x40')]=qs[_0x1606('0x36')](_[_0x1606('0x41')](_0x288d68['query'],_0x106105['filters']),_0x189e34);if(_0x288d68[_0x1606('0x35')][_0x1606('0x42')]){_0x245a5a['where']=_[_0x1606('0x43')](_0x245a5a[_0x1606('0x40')],{'$or':_[_0x1606('0x30')](_0x189e34,function(_0x207794){if(_0x207794[_0x1606('0x34')]!==_0x1606('0x44')){var _0x400af7={};_0x400af7[_0x207794[_0x1606('0x2e')]]={'$like':'%'+_0x288d68['query'][_0x1606('0x42')]+'%'};return _0x400af7;}})});}_0x245a5a=_[_0x1606('0x43')]({},_0x245a5a,_0x288d68['options']);var _0x1b9ba4={'where':_0x245a5a[_0x1606('0x40')]};return db[_0x1606('0x31')]['count'](_0x1b9ba4)[_0x1606('0x29')](function(_0x1993d4){_0x5c6b96[_0x1606('0x20')]=_0x1993d4;if(_0x288d68[_0x1606('0x35')][_0x1606('0x45')]){_0x245a5a[_0x1606('0x46')]=[{'all':!![]}];}return db[_0x1606('0x31')][_0x1606('0x47')](_0x245a5a);})['then'](function(_0x42cd7a){_0x5c6b96[_0x1606('0x48')]=_0x42cd7a;return _0x5c6b96;})[_0x1606('0x29')](respondWithFilteredResult(_0x27fb87,_0x245a5a))[_0x1606('0x49')](handleError(_0x27fb87,null));};exports['show']=function(_0x1b63ab,_0x3d874d){var _0x127ccc={'raw':!![],'where':{'id':_0x1b63ab['params']['id']}},_0x15a88c={};_0x15a88c[_0x1606('0x39')]=_[_0x1606('0x4a')](db['AnalyticExtractedReport']['rawAttributes']);_0x15a88c[_0x1606('0x35')]=_[_0x1606('0x4a')](_0x1b63ab[_0x1606('0x35')]);_0x15a88c[_0x1606('0x36')]=_['intersection'](_0x15a88c['model'],_0x15a88c['query']);_0x127ccc[_0x1606('0x37')]=_['intersection'](_0x15a88c['model'],qs[_0x1606('0x3a')](_0x1b63ab[_0x1606('0x35')][_0x1606('0x3a')]));_0x127ccc[_0x1606('0x37')]=_0x127ccc[_0x1606('0x37')][_0x1606('0x3b')]?_0x127ccc[_0x1606('0x37')]:_0x15a88c[_0x1606('0x39')];if(_0x1b63ab[_0x1606('0x35')][_0x1606('0x45')]){_0x127ccc['include']=[{'all':!![]}];}_0x127ccc=_[_0x1606('0x43')]({},_0x127ccc,_0x1b63ab['options']);return db[_0x1606('0x31')][_0x1606('0x4b')](_0x127ccc)[_0x1606('0x29')](handleEntityNotFound(_0x3d874d,null))['then'](respondWithResult(_0x3d874d,null))[_0x1606('0x49')](handleError(_0x3d874d,null));};exports['create']=function(_0x55a563,_0x21daae){return db['AnalyticExtractedReport'][_0x1606('0x4c')](_0x55a563[_0x1606('0x4d')],{})[_0x1606('0x29')](function(_0x211cbe){var _0x3cb011=_0x55a563[_0x1606('0x4e')]['get']({'plain':!![]});if(!_0x3cb011)throw new Error(_0x1606('0x4f'));if(_0x3cb011[_0x1606('0x50')]===_0x1606('0x4e')){var _0x1a376f=_0x211cbe[_0x1606('0x2a')]({'plain':!![]});var _0x3d30ae=_0x1606('0x51');return db[_0x1606('0x52')][_0x1606('0x4b')]({'where':{'name':_0x3d30ae,'userProfileId':_0x3cb011['userProfileId']},'raw':!![]})[_0x1606('0x29')](function(_0x4f119e){if(_0x4f119e&&_0x4f119e['autoAssociation']===0x0){return db['UserProfileResource'][_0x1606('0x4c')]({'name':_0x1a376f[_0x1606('0x2e')],'resourceId':_0x1a376f['id'],'type':_0x4f119e['name'],'sectionId':_0x4f119e['id']},{})['then'](function(){return _0x211cbe;});}else{return _0x211cbe;}})[_0x1606('0x49')](function(_0x16f835){logger[_0x1606('0x2c')](_0x1606('0x53'),_0x16f835);throw _0x16f835;});}return _0x211cbe;})[_0x1606('0x29')](respondWithResult(_0x21daae,0xc9))[_0x1606('0x49')](handleError(_0x21daae,null));};exports[_0x1606('0x27')]=function(_0x5552a0,_0xbd90b4){if(_0x5552a0['body']['id']){delete _0x5552a0['body']['id'];}return db[_0x1606('0x31')]['find']({'where':{'id':_0x5552a0[_0x1606('0x54')]['id']}})['then'](handleEntityNotFound(_0xbd90b4,null))[_0x1606('0x29')](saveUpdates(_0x5552a0[_0x1606('0x4d')],null))['then'](respondWithResult(_0xbd90b4,null))[_0x1606('0x49')](handleError(_0xbd90b4,null));};exports[_0x1606('0x28')]=function(_0x623fc6,_0x5cf7fc){return db[_0x1606('0x31')][_0x1606('0x4b')]({'where':{'id':_0x623fc6[_0x1606('0x54')]['id']}})[_0x1606('0x29')](handleEntityNotFound(_0x5cf7fc,null))[_0x1606('0x29')](removeEntity(_0x5cf7fc,null))[_0x1606('0x49')](handleError(_0x5cf7fc,null));};exports['download']=function(_0x206995,_0x239755,_0x37885d){return db[_0x1606('0x31')][_0x1606('0x4b')]({'where':{'id':_0x206995[_0x1606('0x54')]['id']},'attributes':[_0x1606('0x2e'),_0x1606('0x55'),_0x1606('0x56'),'output'],'raw':!![]})[_0x1606('0x29')](handleEntityNotFound(_0x239755,null))[_0x1606('0x29')](function(_0x4ef536){if(_0x4ef536){if(!fs[_0x1606('0x57')](path[_0x1606('0x58')](config[_0x1606('0x59')],_0x1606('0x5a'),_0x4ef536[_0x1606('0x56')]))){throw new db[(_0x1606('0x5b'))][(_0x1606('0x5c'))](_0x1606('0x5d'));}if(_0x206995['query']['exists']){return _0x239755[_0x1606('0x5e')](0xc8);}return _0x239755[_0x1606('0x5f')](path[_0x1606('0x58')](config['root'],_0x1606('0x5a'),_0x4ef536['savename']),util[_0x1606('0x60')](_0x1606('0x61'),_0x4ef536[_0x1606('0x55')]||_0x4ef536['name'],_0x4ef536[_0x1606('0x62')][_0x1606('0x63')]()));}})[_0x1606('0x49')](handleError(_0x239755,null));}; \ No newline at end of file +var _0x0d09=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','join','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','server/files/reports','format','eml-format','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','type'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x0d09,0xde));var _0x90d0=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x0d09[_0x3b5250];return _0xc844a1;};'use strict';var emlformat=require(_0x90d0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90d0('0x1'));var moment=require(_0x90d0('0x2'));var BPromise=require(_0x90d0('0x3'));var Mustache=require(_0x90d0('0x4'));var util=require('util');var path=require(_0x90d0('0x5'));var sox=require(_0x90d0('0x6'));var csv=require(_0x90d0('0x7'));var ejs=require(_0x90d0('0x8'));var fs=require('fs');var fs_extra=require(_0x90d0('0x9'));var _=require(_0x90d0('0xa'));var squel=require(_0x90d0('0xb'));var crypto=require('crypto');var jsforce=require(_0x90d0('0xc'));var deskjs=require(_0x90d0('0xd'));var toCsv=require(_0x90d0('0x7'));var querystring=require(_0x90d0('0xe'));var Papa=require(_0x90d0('0xf'));var Redis=require('ioredis');var authService=require(_0x90d0('0x10'));var qs=require(_0x90d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90d0('0x12'));var logger=require(_0x90d0('0x13'))('api');var utils=require(_0x90d0('0x14'));var config=require(_0x90d0('0x15'));var licenseUtil=require(_0x90d0('0x16'));var db=require(_0x90d0('0x17'))['db'];function respondWithStatusCode(_0x1dc1df,_0x52cc8c){_0x52cc8c=_0x52cc8c||0xcc;return function(_0x2db504){if(_0x2db504){return _0x1dc1df[_0x90d0('0x18')](_0x52cc8c);}return _0x1dc1df[_0x90d0('0x19')](_0x52cc8c)[_0x90d0('0x1a')]();};}function respondWithResult(_0x2bd26b,_0x59a4c5){_0x59a4c5=_0x59a4c5||0xc8;return function(_0x2e56d6){if(_0x2e56d6){return _0x2bd26b[_0x90d0('0x19')](_0x59a4c5)[_0x90d0('0x1b')](_0x2e56d6);}};}function respondWithFilteredResult(_0x5a5519,_0x4451d2){return function(_0x4f5307){if(_0x4f5307){var _0x4ad945=typeof _0x4451d2[_0x90d0('0x1c')]===_0x90d0('0x1d')&&typeof _0x4451d2['limit']===_0x90d0('0x1d');var _0x1643b5=_0x4f5307[_0x90d0('0x1e')];var _0x23d5fc=_0x4ad945?0x0:_0x4451d2['offset'];var _0x655636=_0x4ad945?_0x4f5307[_0x90d0('0x1e')]:_0x4451d2['offset']+_0x4451d2[_0x90d0('0x1f')];var _0x4c1524;if(_0x655636>=_0x1643b5){_0x655636=_0x1643b5;_0x4c1524=0xc8;}else{_0x4c1524=0xce;}_0x5a5519[_0x90d0('0x19')](_0x4c1524);return _0x5a5519[_0x90d0('0x20')](_0x90d0('0x21'),_0x23d5fc+'-'+_0x655636+'/'+_0x1643b5)['json'](_0x4f5307);}return null;};}function patchUpdates(_0x23eed2){return function(_0x507c81){try{jsonpatch[_0x90d0('0x22')](_0x507c81,_0x23eed2,!![]);}catch(_0x1020d3){return BPromise[_0x90d0('0x23')](_0x1020d3);}return _0x507c81[_0x90d0('0x24')]();};}function saveUpdates(_0x34bd2a,_0xe5fdaa){return function(_0x1162c9){if(_0x1162c9){return _0x1162c9[_0x90d0('0x25')](_0x34bd2a)[_0x90d0('0x26')](function(_0x2b41a0){return _0x2b41a0;});}return null;};}function removeEntity(_0xc7b9e5,_0x605c53){return function(_0x1f78e3){if(_0x1f78e3){return _0x1f78e3['destroy']()['then'](function(){var _0x2ee3ad=_0x1f78e3[_0x90d0('0x27')]({'plain':!![]});var _0x4daba8=_0x90d0('0x28');return db[_0x90d0('0x29')][_0x90d0('0x2a')]({'where':{'type':_0x4daba8,'resourceId':_0x2ee3ad['id']}})[_0x90d0('0x26')](function(){return _0x1f78e3;});})[_0x90d0('0x26')](function(){_0xc7b9e5['status'](0xcc)[_0x90d0('0x1a')]();});}};}function handleEntityNotFound(_0x3ab8e2,_0x111eac){return function(_0x4854b3){if(!_0x4854b3){_0x3ab8e2['sendStatus'](0x194);}return _0x4854b3;};}function handleError(_0x25dcdc,_0x2d215f){_0x2d215f=_0x2d215f||0x1f4;return function(_0x220c88){logger[_0x90d0('0x2b')](_0x220c88['stack']);if(_0x220c88[_0x90d0('0x2c')]){delete _0x220c88[_0x90d0('0x2c')];}_0x25dcdc[_0x90d0('0x19')](_0x2d215f)[_0x90d0('0x2d')](_0x220c88);};}exports[_0x90d0('0x2e')]=function(_0x806655,_0x5c6689){var _0x1b20ec={},_0x4c5070={},_0x4bff02={'count':0x0,'rows':[]};var _0x14b6dc=_[_0x90d0('0x2f')](db[_0x90d0('0x30')][_0x90d0('0x31')],function(_0x36bd83){return{'name':_0x36bd83['fieldName'],'type':_0x36bd83[_0x90d0('0x32')]['key']};});_0x4c5070['model']=_[_0x90d0('0x2f')](_0x14b6dc,'name');_0x4c5070[_0x90d0('0x33')]=_[_0x90d0('0x34')](_0x806655['query']);_0x4c5070[_0x90d0('0x35')]=_[_0x90d0('0x36')](_0x4c5070[_0x90d0('0x37')],_0x4c5070[_0x90d0('0x33')]);_0x1b20ec[_0x90d0('0x38')]=_[_0x90d0('0x36')](_0x4c5070[_0x90d0('0x37')],qs['fields'](_0x806655[_0x90d0('0x33')][_0x90d0('0x39')]));_0x1b20ec[_0x90d0('0x38')]=_0x1b20ec[_0x90d0('0x38')][_0x90d0('0x3a')]?_0x1b20ec[_0x90d0('0x38')]:_0x4c5070[_0x90d0('0x37')];if(!_0x806655[_0x90d0('0x33')][_0x90d0('0x3b')]('nolimit')){_0x1b20ec[_0x90d0('0x1f')]=qs[_0x90d0('0x1f')](_0x806655[_0x90d0('0x33')][_0x90d0('0x1f')]);_0x1b20ec[_0x90d0('0x1c')]=qs[_0x90d0('0x1c')](_0x806655[_0x90d0('0x33')][_0x90d0('0x1c')]);}_0x1b20ec[_0x90d0('0x3c')]=qs[_0x90d0('0x3d')](_0x806655[_0x90d0('0x33')][_0x90d0('0x3d')]);_0x1b20ec['where']=qs[_0x90d0('0x35')](_[_0x90d0('0x3e')](_0x806655['query'],_0x4c5070['filters']),_0x14b6dc);if(_0x806655[_0x90d0('0x33')]['filter']){_0x1b20ec['where']=_[_0x90d0('0x3f')](_0x1b20ec[_0x90d0('0x40')],{'$or':_['map'](_0x14b6dc,function(_0x3d8c0e){if(_0x3d8c0e[_0x90d0('0x32')]!=='VIRTUAL'){var _0x290e0a={};_0x290e0a[_0x3d8c0e[_0x90d0('0x2c')]]={'$like':'%'+_0x806655[_0x90d0('0x33')][_0x90d0('0x41')]+'%'};return _0x290e0a;}})});}_0x1b20ec=_[_0x90d0('0x3f')]({},_0x1b20ec,_0x806655[_0x90d0('0x42')]);var _0x49fddd={'where':_0x1b20ec[_0x90d0('0x40')]};return db[_0x90d0('0x30')][_0x90d0('0x1e')](_0x49fddd)[_0x90d0('0x26')](function(_0x50c9c6){_0x4bff02[_0x90d0('0x1e')]=_0x50c9c6;if(_0x806655[_0x90d0('0x33')][_0x90d0('0x43')]){_0x1b20ec[_0x90d0('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x90d0('0x45')](_0x1b20ec);})[_0x90d0('0x26')](function(_0x5cead4){_0x4bff02[_0x90d0('0x46')]=_0x5cead4;return _0x4bff02;})[_0x90d0('0x26')](respondWithFilteredResult(_0x5c6689,_0x1b20ec))[_0x90d0('0x47')](handleError(_0x5c6689,null));};exports['show']=function(_0x338d07,_0x38f75d){var _0x1b4f28={'raw':!![],'where':{'id':_0x338d07['params']['id']}},_0x51d68f={};_0x51d68f[_0x90d0('0x37')]=_[_0x90d0('0x34')](db[_0x90d0('0x30')][_0x90d0('0x31')]);_0x51d68f[_0x90d0('0x33')]=_[_0x90d0('0x34')](_0x338d07['query']);_0x51d68f['filters']=_[_0x90d0('0x36')](_0x51d68f[_0x90d0('0x37')],_0x51d68f[_0x90d0('0x33')]);_0x1b4f28[_0x90d0('0x38')]=_[_0x90d0('0x36')](_0x51d68f[_0x90d0('0x37')],qs[_0x90d0('0x39')](_0x338d07[_0x90d0('0x33')][_0x90d0('0x39')]));_0x1b4f28[_0x90d0('0x38')]=_0x1b4f28['attributes'][_0x90d0('0x3a')]?_0x1b4f28[_0x90d0('0x38')]:_0x51d68f[_0x90d0('0x37')];if(_0x338d07[_0x90d0('0x33')]['includeAll']){_0x1b4f28[_0x90d0('0x44')]=[{'all':!![]}];}_0x1b4f28=_[_0x90d0('0x3f')]({},_0x1b4f28,_0x338d07['options']);return db[_0x90d0('0x30')][_0x90d0('0x48')](_0x1b4f28)[_0x90d0('0x26')](handleEntityNotFound(_0x38f75d,null))[_0x90d0('0x26')](respondWithResult(_0x38f75d,null))[_0x90d0('0x47')](handleError(_0x38f75d,null));};exports['create']=function(_0x3e4ed8,_0x45b458){return db[_0x90d0('0x30')][_0x90d0('0x49')](_0x3e4ed8[_0x90d0('0x4a')],{})[_0x90d0('0x26')](function(_0x263c84){var _0x2266ab=_0x3e4ed8['user'][_0x90d0('0x27')]({'plain':!![]});if(!_0x2266ab)throw new Error(_0x90d0('0x4b'));if(_0x2266ab['role']==='user'){var _0x5b8000=_0x263c84['get']({'plain':!![]});var _0x49e573=_0x90d0('0x28');return db[_0x90d0('0x4c')]['find']({'where':{'name':_0x49e573,'userProfileId':_0x2266ab['userProfileId']},'raw':!![]})[_0x90d0('0x26')](function(_0x7eedd6){if(_0x7eedd6&&_0x7eedd6[_0x90d0('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b8000[_0x90d0('0x2c')],'resourceId':_0x5b8000['id'],'type':_0x7eedd6['name'],'sectionId':_0x7eedd6['id']},{})[_0x90d0('0x26')](function(){return _0x263c84;});}else{return _0x263c84;}})[_0x90d0('0x47')](function(_0x1a5660){logger[_0x90d0('0x2b')](_0x90d0('0x4e'),_0x1a5660);throw _0x1a5660;});}return _0x263c84;})['then'](respondWithResult(_0x45b458,0xc9))[_0x90d0('0x47')](handleError(_0x45b458,null));};exports[_0x90d0('0x25')]=function(_0x7f4c01,_0x51782c){if(_0x7f4c01['body']['id']){delete _0x7f4c01[_0x90d0('0x4a')]['id'];}return db[_0x90d0('0x30')][_0x90d0('0x48')]({'where':{'id':_0x7f4c01[_0x90d0('0x4f')]['id']}})[_0x90d0('0x26')](handleEntityNotFound(_0x51782c,null))[_0x90d0('0x26')](saveUpdates(_0x7f4c01['body'],null))[_0x90d0('0x26')](respondWithResult(_0x51782c,null))[_0x90d0('0x47')](handleError(_0x51782c,null));};exports['destroy']=function(_0x3cd9dc,_0x1b1b61){return db[_0x90d0('0x30')][_0x90d0('0x48')]({'where':{'id':_0x3cd9dc['params']['id']}})[_0x90d0('0x26')](handleEntityNotFound(_0x1b1b61,null))[_0x90d0('0x26')](removeEntity(_0x1b1b61,null))['catch'](handleError(_0x1b1b61,null));};exports[_0x90d0('0x50')]=function(_0x39b6b2,_0x3ae489,_0x21b637){return db['AnalyticExtractedReport'][_0x90d0('0x48')]({'where':{'id':_0x39b6b2['params']['id']},'attributes':[_0x90d0('0x2c'),_0x90d0('0x51'),'savename',_0x90d0('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x3ae489,null))['then'](function(_0x18498a){if(_0x18498a){if(!fs['existsSync'](path[_0x90d0('0x53')](config['root'],'server/files/reports',_0x18498a[_0x90d0('0x54')]))){throw new db[(_0x90d0('0x55'))][(_0x90d0('0x56'))](_0x90d0('0x57'));}if(_0x39b6b2[_0x90d0('0x33')]['exists']){return _0x3ae489[_0x90d0('0x18')](0xc8);}return _0x3ae489[_0x90d0('0x50')](path[_0x90d0('0x53')](config[_0x90d0('0x58')],_0x90d0('0x59'),_0x18498a[_0x90d0('0x54')]),util[_0x90d0('0x5a')]('%s.%s',_0x18498a[_0x90d0('0x51')]||_0x18498a[_0x90d0('0x2c')],_0x18498a[_0x90d0('0x52')]['toLowerCase']()));}})[_0x90d0('0x47')](handleError(_0x3ae489,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5b46499..c79fd9f 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 _0xc26c=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xc26c,0x104));var _0xcc26=function(_0x445219,_0x1230b0){_0x445219=_0x445219-0x0;var _0x343a3a=_0xc26c[_0x445219];return _0x343a3a;};'use strict';var _=require('lodash');var util=require(_0xcc26('0x0'));var logger=require(_0xcc26('0x1'))(_0xcc26('0x2'));var moment=require(_0xcc26('0x3'));var BPromise=require(_0xcc26('0x4'));var rp=require(_0xcc26('0x5'));var fs=require('fs');var path=require(_0xcc26('0x6'));var rimraf=require(_0xcc26('0x7'));var config=require(_0xcc26('0x8'));var attributes=require(_0xcc26('0x9'));module[_0xcc26('0xa')]=function(_0x200f15,_0x215b14){return _0x200f15[_0xcc26('0xb')](_0xcc26('0xc'),attributes,{'tableName':_0xcc26('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x744e=['rimraf','../../config/environment','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','request-promise'];(function(_0x1b82a4,_0x54a419){var _0x2c8685=function(_0x4ac23c){while(--_0x4ac23c){_0x1b82a4['push'](_0x1b82a4['shift']());}};_0x2c8685(++_0x54a419);}(_0x744e,0x1f4));var _0xe744=function(_0x528d68,_0x68cc58){_0x528d68=_0x528d68-0x0;var _0x187967=_0x744e[_0x528d68];return _0x187967;};'use strict';var _=require('lodash');var util=require(_0xe744('0x0'));var logger=require(_0xe744('0x1'))(_0xe744('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe744('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe744('0x4'));var config=require(_0xe744('0x5'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x4cbeeb,_0xdd0cfe){return _0x4cbeeb[_0xe744('0x6')](_0xe744('0x7'),attributes,{'tableName':_0xe744('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index e6f0b9f..c01c86c 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 _0x13cc=['../../config/environment','client','request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f6fe6,_0x52243c){var _0xebbe7f=function(_0x49adff){while(--_0x49adff){_0x3f6fe6['push'](_0x3f6fe6['shift']());}};_0xebbe7f(++_0x52243c);}(_0x13cc,0x161));var _0xc13c=function(_0x15f4ad,_0xabccd2){_0x15f4ad=_0x15f4ad-0x0;var _0x21d9d0=_0x13cc[_0x15f4ad];return _0x21d9d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc13c('0x0'));var BPromise=require(_0xc13c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc13c('0x2'));var db=require(_0xc13c('0x3'))['db'];var utils=require(_0xc13c('0x4'));var logger=require(_0xc13c('0x5'))(_0xc13c('0x6'));var config=require(_0xc13c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc13c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b0b4,_0x41b41b,_0x4889d6){return new BPromise(function(_0x318eab,_0x3570f3){return client[_0xc13c('0x9')](_0x18b0b4,_0x4889d6)[_0xc13c('0xa')](function(_0x5ee2aa){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x41b41b,_0xc13c('0xb'));logger[_0xc13c('0xc')](_0xc13c('0xd'),_0x41b41b,_0xc13c('0xb'),JSON[_0xc13c('0xe')](_0x5ee2aa));if(_0x5ee2aa['error']){if(_0x5ee2aa[_0xc13c('0xf')]['code']===0x1f4){logger[_0xc13c('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x41b41b,_0x5ee2aa['error'][_0xc13c('0x10')]);return _0x3570f3(_0x5ee2aa[_0xc13c('0xf')][_0xc13c('0x10')]);}logger[_0xc13c('0xf')](_0xc13c('0x11'),_0x41b41b,_0x5ee2aa[_0xc13c('0xf')][_0xc13c('0x10')]);return _0x318eab(_0x5ee2aa[_0xc13c('0xf')][_0xc13c('0x10')]);}else{logger[_0xc13c('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x41b41b,_0xc13c('0xb'));_0x318eab(_0x5ee2aa[_0xc13c('0x13')][_0xc13c('0x10')]);}})['catch'](function(_0x93cb3b){logger[_0xc13c('0xf')](_0xc13c('0x11'),_0x41b41b,_0x93cb3b);_0x3570f3(_0x93cb3b);});});} \ No newline at end of file +var _0x5c22=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2017ab,_0xa3871c){var _0x1d470a=function(_0x58852b){while(--_0x58852b){_0x2017ab['push'](_0x2017ab['shift']());}};_0x1d470a(++_0xa3871c);}(_0x5c22,0x196));var _0x25c2=function(_0x239e0e,_0x5f4685){_0x239e0e=_0x239e0e-0x0;var _0x29da81=_0x5c22[_0x239e0e];return _0x29da81;};'use strict';var _=require(_0x25c2('0x0'));var util=require(_0x25c2('0x1'));var moment=require(_0x25c2('0x2'));var BPromise=require(_0x25c2('0x3'));var rs=require(_0x25c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25c2('0x5'))['db'];var utils=require(_0x25c2('0x6'));var logger=require('../../config/logger')(_0x25c2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25c2('0x8')][_0x25c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d8ba9,_0x4450a0,_0xa6809b){return new BPromise(function(_0x2aafe3,_0x2f1600){return client[_0x25c2('0xa')](_0x4d8ba9,_0xa6809b)['then'](function(_0x22f278){logger['info'](_0x25c2('0xb'),_0x4450a0,_0x25c2('0xc'));logger[_0x25c2('0xd')](_0x25c2('0xe'),_0x4450a0,'request\x20sent',JSON[_0x25c2('0xf')](_0x22f278));if(_0x22f278[_0x25c2('0x10')]){if(_0x22f278[_0x25c2('0x10')]['code']===0x1f4){logger['error'](_0x25c2('0xb'),_0x4450a0,_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);return _0x2f1600(_0x22f278[_0x25c2('0x10')]['message']);}logger[_0x25c2('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4450a0,_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);return _0x2aafe3(_0x22f278[_0x25c2('0x10')][_0x25c2('0x11')]);}else{logger[_0x25c2('0x12')](_0x25c2('0xb'),_0x4450a0,_0x25c2('0xc'));_0x2aafe3(_0x22f278['result'][_0x25c2('0x11')]);}})[_0x25c2('0x13')](function(_0x536d5f){logger[_0x25c2('0x10')](_0x25c2('0xb'),_0x4450a0,_0x536d5f);_0x2f1600(_0x536d5f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c57391a..d3d7df3 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 _0x79cf=['download','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x3bf605,_0x4a2a33){var _0x1f6c36=function(_0x34a6a4){while(--_0x34a6a4){_0x3bf605['push'](_0x3bf605['shift']());}};_0x1f6c36(++_0x4a2a33);}(_0x79cf,0xce));var _0xf79c=function(_0x448517,_0x30afcd){_0x448517=_0x448517-0x0;var _0x3b7ec4=_0x79cf[_0x448517];return _0x3b7ec4;};'use strict';var multer=require('multer');var util=require(_0xf79c('0x0'));var path=require(_0xf79c('0x1'));var timeout=require(_0xf79c('0x2'));var express=require(_0xf79c('0x3'));var router=express[_0xf79c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf79c('0x5'));var interaction=require(_0xf79c('0x6'));var config=require(_0xf79c('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xf79c('0x8')]('/',auth['isAuthenticated'](),controller[_0xf79c('0x9')]);router['get'](_0xf79c('0xa'),auth[_0xf79c('0xb')](),controller[_0xf79c('0xc')]);router[_0xf79c('0x8')](_0xf79c('0xd'),auth[_0xf79c('0xb')](),controller[_0xf79c('0xe')]);router[_0xf79c('0xf')]('/',auth[_0xf79c('0xb')](),controller[_0xf79c('0x10')]);router[_0xf79c('0x11')](_0xf79c('0xa'),auth[_0xf79c('0xb')](),controller['update']);router[_0xf79c('0x12')](_0xf79c('0xa'),auth[_0xf79c('0xb')](),controller[_0xf79c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9835=['get','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index'];(function(_0x91567,_0x2d0052){var _0x50a5ae=function(_0x4ecae2){while(--_0x4ecae2){_0x91567['push'](_0x91567['shift']());}};_0x50a5ae(++_0x2d0052);}(_0x9835,0xb7));var _0x5983=function(_0x2c9fdb,_0x4cdc03){_0x2c9fdb=_0x2c9fdb-0x0;var _0x1b34e3=_0x9835[_0x2c9fdb];return _0x1b34e3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5983('0x0'));var router=express['Router']();var fs_extra=require(_0x5983('0x1'));var auth=require(_0x5983('0x2'));var interaction=require(_0x5983('0x3'));var config=require('../../config/environment');var controller=require(_0x5983('0x4'));router['get']('/',auth[_0x5983('0x5')](),controller[_0x5983('0x6')]);router[_0x5983('0x7')](_0x5983('0x8'),auth[_0x5983('0x5')](),controller[_0x5983('0x9')]);router[_0x5983('0x7')](_0x5983('0xa'),auth[_0x5983('0x5')](),controller[_0x5983('0xb')]);router[_0x5983('0xc')]('/',auth[_0x5983('0x5')](),controller[_0x5983('0xd')]);router[_0x5983('0xe')]('/:id',auth[_0x5983('0x5')](),controller[_0x5983('0xf')]);router[_0x5983('0x10')](_0x5983('0x8'),auth[_0x5983('0x5')](),controller[_0x5983('0x11')]);module[_0x5983('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d8081ab..92edf30 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 _0x9cff=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x9cff,0x1ab));var _0xf9cf=function(_0xde346d,_0x408453){_0xde346d=_0xde346d-0x0;var _0x4ea0db=_0x9cff[_0xde346d];return _0x4ea0db;};'use strict';var Sequelize=require(_0xf9cf('0x0'));module[_0xf9cf('0x1')]={'field':{'type':Sequelize[_0xf9cf('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xf9cf('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xf9cf('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xf9cf('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x88dd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x132716,_0x25edf7){var _0x21e3c5=function(_0x26c3ab){while(--_0x26c3ab){_0x132716['push'](_0x132716['shift']());}};_0x21e3c5(++_0x25edf7);}(_0x88dd,0x1c1));var _0xd88d=function(_0x1b0f75,_0x178e46){_0x1b0f75=_0x1b0f75-0x0;var _0x128c8d=_0x88dd[_0x1b0f75];return _0x128c8d;};'use strict';var Sequelize=require(_0xd88d('0x0'));module[_0xd88d('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd88d('0x2')]},'function':{'type':Sequelize[_0xd88d('0x2')]},'format':{'type':Sequelize[_0xd88d('0x2')]},'groupBy':{'type':Sequelize[_0xd88d('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd88d('0x2')]},'custom':{'type':Sequelize[_0xd88d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 61a60e6..6c5b900 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 _0x050a=['limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','AnalyticFieldReport','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','bulkCreate','find','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','offset'];(function(_0x41b986,_0x5a1dc2){var _0x5ede09=function(_0x2b91ff){while(--_0x2b91ff){_0x41b986['push'](_0x41b986['shift']());}};_0x5ede09(++_0x5a1dc2);}(_0x050a,0x1c9));var _0xa050=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x050a[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa050('0x0'));var zipdir=require(_0xa050('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa050('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa050('0x3'));var path=require(_0xa050('0x4'));var sox=require('sox');var csv=require(_0xa050('0x5'));var ejs=require(_0xa050('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa050('0x7'));var squel=require(_0xa050('0x8'));var crypto=require(_0xa050('0x9'));var jsforce=require(_0xa050('0xa'));var deskjs=require(_0xa050('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa050('0xc'));var Redis=require('ioredis');var authService=require(_0xa050('0xd'));var qs=require(_0xa050('0xe'));var as=require(_0xa050('0xf'));var hardwareService=require(_0xa050('0x10'));var logger=require('../../config/logger')(_0xa050('0x11'));var utils=require(_0xa050('0x12'));var config=require(_0xa050('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa050('0x14'))['db'];function respondWithStatusCode(_0x42a5a8,_0x4ff1ef){_0x4ff1ef=_0x4ff1ef||0xcc;return function(_0x13f9d2){if(_0x13f9d2){return _0x42a5a8['sendStatus'](_0x4ff1ef);}return _0x42a5a8[_0xa050('0x15')](_0x4ff1ef)['end']();};}function respondWithResult(_0x408c22,_0x38461d){_0x38461d=_0x38461d||0xc8;return function(_0x54d97e){if(_0x54d97e){return _0x408c22[_0xa050('0x15')](_0x38461d)['json'](_0x54d97e);}};}function respondWithFilteredResult(_0x6f4364,_0x5145a4){return function(_0x14e35f){if(_0x14e35f){var _0x333265=typeof _0x5145a4[_0xa050('0x16')]==='undefined'&&typeof _0x5145a4[_0xa050('0x17')]==='undefined';var _0x1977d5=_0x14e35f[_0xa050('0x18')];var _0xf4cf79=_0x333265?0x0:_0x5145a4[_0xa050('0x16')];var _0x67eda1=_0x333265?_0x14e35f[_0xa050('0x18')]:_0x5145a4['offset']+_0x5145a4['limit'];var _0x4554e0;if(_0x67eda1>=_0x1977d5){_0x67eda1=_0x1977d5;_0x4554e0=0xc8;}else{_0x4554e0=0xce;}_0x6f4364[_0xa050('0x15')](_0x4554e0);return _0x6f4364[_0xa050('0x19')](_0xa050('0x1a'),_0xf4cf79+'-'+_0x67eda1+'/'+_0x1977d5)[_0xa050('0x1b')](_0x14e35f);}return null;};}function patchUpdates(_0x35f56e){return function(_0x1b298e){try{jsonpatch[_0xa050('0x1c')](_0x1b298e,_0x35f56e,!![]);}catch(_0x3c9b21){return BPromise[_0xa050('0x1d')](_0x3c9b21);}return _0x1b298e[_0xa050('0x1e')]();};}function saveUpdates(_0x59dcf7,_0x28bade){return function(_0x1eae7f){if(_0x1eae7f){return _0x1eae7f[_0xa050('0x1f')](_0x59dcf7)[_0xa050('0x20')](function(_0x2b405e){return _0x2b405e;});}return null;};}function removeEntity(_0x25ce0c,_0x319f65){return function(_0x454bc3){if(_0x454bc3){return _0x454bc3['destroy']()[_0xa050('0x20')](function(){_0x25ce0c[_0xa050('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339dba,_0x3ea498){return function(_0x1cdd61){if(!_0x1cdd61){_0x339dba[_0xa050('0x21')](0x194);}return _0x1cdd61;};}function handleError(_0x28caec,_0x3f8703){_0x3f8703=_0x3f8703||0x1f4;return function(_0x111035){logger[_0xa050('0x22')](_0x111035[_0xa050('0x23')]);if(_0x111035[_0xa050('0x24')]){delete _0x111035[_0xa050('0x24')];}_0x28caec[_0xa050('0x15')](_0x3f8703)[_0xa050('0x25')](_0x111035);};}exports[_0xa050('0x26')]=function(_0x2cd15b,_0x40573b){var _0xc5ae43={},_0x44b187={},_0x3490ac={'count':0x0,'rows':[]};var _0x5ee031=_['map'](db[_0xa050('0x27')]['rawAttributes'],function(_0x5929f8){return{'name':_0x5929f8['fieldName'],'type':_0x5929f8['type']['key']};});_0x44b187[_0xa050('0x28')]=_['map'](_0x5ee031,'name');_0x44b187[_0xa050('0x29')]=_['keys'](_0x2cd15b[_0xa050('0x29')]);_0x44b187[_0xa050('0x2a')]=_[_0xa050('0x2b')](_0x44b187[_0xa050('0x28')],_0x44b187[_0xa050('0x29')]);_0xc5ae43[_0xa050('0x2c')]=_[_0xa050('0x2b')](_0x44b187[_0xa050('0x28')],qs[_0xa050('0x2d')](_0x2cd15b[_0xa050('0x29')][_0xa050('0x2d')]));_0xc5ae43['attributes']=_0xc5ae43[_0xa050('0x2c')][_0xa050('0x2e')]?_0xc5ae43[_0xa050('0x2c')]:_0x44b187[_0xa050('0x28')];if(!_0x2cd15b[_0xa050('0x29')][_0xa050('0x2f')](_0xa050('0x30'))){_0xc5ae43[_0xa050('0x17')]=qs[_0xa050('0x17')](_0x2cd15b[_0xa050('0x29')]['limit']);_0xc5ae43[_0xa050('0x16')]=qs[_0xa050('0x16')](_0x2cd15b[_0xa050('0x29')][_0xa050('0x16')]);}_0xc5ae43[_0xa050('0x31')]=qs['sort'](_0x2cd15b['query'][_0xa050('0x32')]);_0xc5ae43[_0xa050('0x33')]=qs[_0xa050('0x2a')](_[_0xa050('0x34')](_0x2cd15b[_0xa050('0x29')],_0x44b187['filters']),_0x5ee031);if(_0x2cd15b['query'][_0xa050('0x35')]){_0xc5ae43['where']=_[_0xa050('0x36')](_0xc5ae43[_0xa050('0x33')],{'$or':_[_0xa050('0x37')](_0x5ee031,function(_0xf85942){if(_0xf85942[_0xa050('0x38')]!=='VIRTUAL'){var _0x411e6f={};_0x411e6f[_0xf85942[_0xa050('0x24')]]={'$like':'%'+_0x2cd15b[_0xa050('0x29')][_0xa050('0x35')]+'%'};return _0x411e6f;}})});}_0xc5ae43=_['merge']({},_0xc5ae43,_0x2cd15b[_0xa050('0x39')]);var _0x3063f5={'where':_0xc5ae43[_0xa050('0x33')]};return db['AnalyticFieldReport'][_0xa050('0x18')](_0x3063f5)['then'](function(_0x20dc52){_0x3490ac[_0xa050('0x18')]=_0x20dc52;if(_0x2cd15b['query'][_0xa050('0x3a')]){_0xc5ae43['include']=[{'all':!![]}];}return db[_0xa050('0x27')]['findAll'](_0xc5ae43);})[_0xa050('0x20')](function(_0x14c28a){_0x3490ac[_0xa050('0x3b')]=_0x14c28a;return _0x3490ac;})[_0xa050('0x20')](respondWithFilteredResult(_0x40573b,_0xc5ae43))[_0xa050('0x3c')](handleError(_0x40573b,null));};exports[_0xa050('0x3d')]=function(_0x19c036,_0x434dd5){var _0x2f3278={'raw':![],'where':{'id':_0x19c036[_0xa050('0x3e')]['id']}},_0x13a00a={};_0x13a00a[_0xa050('0x28')]=_[_0xa050('0x3f')](db[_0xa050('0x27')][_0xa050('0x40')]);_0x13a00a[_0xa050('0x29')]=_[_0xa050('0x3f')](_0x19c036['query']);_0x13a00a[_0xa050('0x2a')]=_[_0xa050('0x2b')](_0x13a00a[_0xa050('0x28')],_0x13a00a[_0xa050('0x29')]);_0x2f3278['attributes']=_['intersection'](_0x13a00a[_0xa050('0x28')],qs['fields'](_0x19c036['query'][_0xa050('0x2d')]));_0x2f3278[_0xa050('0x2c')]=_0x2f3278['attributes']['length']?_0x2f3278[_0xa050('0x2c')]:_0x13a00a[_0xa050('0x28')];if(_0x19c036[_0xa050('0x29')][_0xa050('0x3a')]){_0x2f3278[_0xa050('0x41')]=[{'all':!![]}];}_0x2f3278=_[_0xa050('0x36')]({},_0x2f3278,_0x19c036[_0xa050('0x39')]);return db[_0xa050('0x27')]['find'](_0x2f3278)['then'](handleEntityNotFound(_0x434dd5,null))[_0xa050('0x20')](respondWithResult(_0x434dd5,null))[_0xa050('0x3c')](handleError(_0x434dd5,null));};exports[_0xa050('0x42')]=function(_0x2ac54d,_0x4b1828){return db['AnalyticFieldReport']['create'](_0x2ac54d[_0xa050('0x43')],{})['then'](respondWithResult(_0x4b1828,0xc9))['catch'](handleError(_0x4b1828,null));};exports['bulkCreate']=function(_0x564523,_0x19f08f){return db[_0xa050('0x27')][_0xa050('0x44')](_0x564523[_0xa050('0x43')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x19f08f,0xc9))[_0xa050('0x3c')](handleError(_0x19f08f,null));};exports['update']=function(_0x3cc794,_0x511e69){if(_0x3cc794[_0xa050('0x43')]['id']){delete _0x3cc794['body']['id'];}return db[_0xa050('0x27')][_0xa050('0x45')]({'where':{'id':_0x3cc794['params']['id']}})[_0xa050('0x20')](handleEntityNotFound(_0x511e69,null))[_0xa050('0x20')](saveUpdates(_0x3cc794[_0xa050('0x43')],null))[_0xa050('0x20')](respondWithResult(_0x511e69,null))['catch'](handleError(_0x511e69,null));};exports[_0xa050('0x46')]=function(_0x2ee91c,_0x10ebc6){return db[_0xa050('0x27')][_0xa050('0x45')]({'where':{'id':_0x2ee91c[_0xa050('0x3e')]['id']}})[_0xa050('0x20')](handleEntityNotFound(_0x10ebc6,null))[_0xa050('0x20')](removeEntity(_0x10ebc6,null))[_0xa050('0x3c')](handleError(_0x10ebc6,null));};exports[_0xa050('0x47')]=function(_0x1f402b,_0x2cf7ec){return db['AnalyticFieldReport'][_0xa050('0x46')]({'where':{'id':_0x1f402b[_0xa050('0x29')][_0xa050('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xa050('0x20')](respondWithResult(_0x2cf7ec,0xcc))['catch'](handleError(_0x2cf7ec,null));};exports[_0xa050('0x49')]=function(_0x38ebca,_0x25ba24,_0xfad29c){return db[_0xa050('0x4a')][_0xa050('0x4b')]({'where':{'id':_0x38ebca[_0xa050('0x3e')]['id']}})[_0xa050('0x20')](handleEntityNotFound(_0x25ba24,null))[_0xa050('0x20')](function(_0x54832f){if(_0x54832f){return db[_0xa050('0x4c')][_0xa050('0x4d')](function(_0x1d3934){return db[_0xa050('0x27')][_0xa050('0x46')]({'where':{'CustomReportId':_0x38ebca[_0xa050('0x3e')]['id']},'transaction':_0x1d3934})['then'](function(_0xccc2ac){var _0x2de85d=_['map'](_0x38ebca[_0xa050('0x43')],function(_0x43c919){delete _0x43c919['id'];_0x43c919[_0xa050('0x4e')]=_0x38ebca[_0xa050('0x3e')]['id'];return _0x43c919;});return db[_0xa050('0x27')][_0xa050('0x44')](_0x2de85d,{'transaction':_0x1d3934});});})[_0xa050('0x20')](function(){return db['AnalyticFieldReport'][_0xa050('0x4f')]({'where':{'CustomReportId':_0x38ebca[_0xa050('0x3e')]['id']}});});}})[_0xa050('0x20')](respondWithResult(_0x25ba24,null))['catch'](handleError(_0x25ba24,null));}; \ No newline at end of file +var _0xb3e2=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','include','AnalyticFieldReport','findAll','rows','params','includeAll','catch','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xb3e2,0x1da));var _0x2b3e=function(_0x10fc7c,_0x376325){_0x10fc7c=_0x10fc7c-0x0;var _0x307c89=_0xb3e2[_0x10fc7c];return _0x307c89;};'use strict';var emlformat=require(_0x2b3e('0x0'));var rimraf=require(_0x2b3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b3e('0x2'));var rp=require(_0x2b3e('0x3'));var moment=require(_0x2b3e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2b3e('0x5'));var util=require(_0x2b3e('0x6'));var path=require(_0x2b3e('0x7'));var sox=require(_0x2b3e('0x8'));var csv=require(_0x2b3e('0x9'));var ejs=require(_0x2b3e('0xa'));var fs=require('fs');var fs_extra=require(_0x2b3e('0xb'));var _=require(_0x2b3e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b3e('0xd'));var deskjs=require(_0x2b3e('0xe'));var toCsv=require(_0x2b3e('0x9'));var querystring=require('querystring');var Papa=require(_0x2b3e('0xf'));var Redis=require(_0x2b3e('0x10'));var authService=require(_0x2b3e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b3e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b3e('0x13'))(_0x2b3e('0x14'));var utils=require(_0x2b3e('0x15'));var config=require(_0x2b3e('0x16'));var licenseUtil=require(_0x2b3e('0x17'));var db=require(_0x2b3e('0x18'))['db'];function respondWithStatusCode(_0x6fc932,_0x132f16){_0x132f16=_0x132f16||0xcc;return function(_0x5e1fd8){if(_0x5e1fd8){return _0x6fc932[_0x2b3e('0x19')](_0x132f16);}return _0x6fc932['status'](_0x132f16)[_0x2b3e('0x1a')]();};}function respondWithResult(_0x32bd4a,_0x1be50c){_0x1be50c=_0x1be50c||0xc8;return function(_0x357d52){if(_0x357d52){return _0x32bd4a[_0x2b3e('0x1b')](_0x1be50c)['json'](_0x357d52);}};}function respondWithFilteredResult(_0x24264e,_0x1429ff){return function(_0x228d21){if(_0x228d21){var _0x300879=typeof _0x1429ff[_0x2b3e('0x1c')]===_0x2b3e('0x1d')&&typeof _0x1429ff[_0x2b3e('0x1e')]===_0x2b3e('0x1d');var _0x5aa9c1=_0x228d21[_0x2b3e('0x1f')];var _0x538bf4=_0x300879?0x0:_0x1429ff[_0x2b3e('0x1c')];var _0x24739b=_0x300879?_0x228d21[_0x2b3e('0x1f')]:_0x1429ff[_0x2b3e('0x1c')]+_0x1429ff[_0x2b3e('0x1e')];var _0x2e9850;if(_0x24739b>=_0x5aa9c1){_0x24739b=_0x5aa9c1;_0x2e9850=0xc8;}else{_0x2e9850=0xce;}_0x24264e['status'](_0x2e9850);return _0x24264e[_0x2b3e('0x20')](_0x2b3e('0x21'),_0x538bf4+'-'+_0x24739b+'/'+_0x5aa9c1)[_0x2b3e('0x22')](_0x228d21);}return null;};}function patchUpdates(_0x4191f0){return function(_0x118388){try{jsonpatch['apply'](_0x118388,_0x4191f0,!![]);}catch(_0x4a9af1){return BPromise[_0x2b3e('0x23')](_0x4a9af1);}return _0x118388[_0x2b3e('0x24')]();};}function saveUpdates(_0x236dcb,_0x22585c){return function(_0x56bf8a){if(_0x56bf8a){return _0x56bf8a[_0x2b3e('0x25')](_0x236dcb)['then'](function(_0x1a0593){return _0x1a0593;});}return null;};}function removeEntity(_0x384439,_0x316123){return function(_0x1caece){if(_0x1caece){return _0x1caece[_0x2b3e('0x26')]()[_0x2b3e('0x27')](function(){_0x384439[_0x2b3e('0x1b')](0xcc)[_0x2b3e('0x1a')]();});}};}function handleEntityNotFound(_0x36aaa3,_0x1e0015){return function(_0xb2c267){if(!_0xb2c267){_0x36aaa3[_0x2b3e('0x19')](0x194);}return _0xb2c267;};}function handleError(_0x9b63c2,_0x57aea7){_0x57aea7=_0x57aea7||0x1f4;return function(_0x2d9bb9){logger[_0x2b3e('0x28')](_0x2d9bb9[_0x2b3e('0x29')]);if(_0x2d9bb9[_0x2b3e('0x2a')]){delete _0x2d9bb9['name'];}_0x9b63c2['status'](_0x57aea7)[_0x2b3e('0x2b')](_0x2d9bb9);};}exports[_0x2b3e('0x2c')]=function(_0x28c923,_0x21265a){var _0x31eb94={},_0x518339={},_0x2e92c7={'count':0x0,'rows':[]};var _0x4428c2=_[_0x2b3e('0x2d')](db['AnalyticFieldReport'][_0x2b3e('0x2e')],function(_0x14f2c5){return{'name':_0x14f2c5['fieldName'],'type':_0x14f2c5[_0x2b3e('0x2f')]['key']};});_0x518339['model']=_[_0x2b3e('0x2d')](_0x4428c2,'name');_0x518339['query']=_[_0x2b3e('0x30')](_0x28c923['query']);_0x518339['filters']=_[_0x2b3e('0x31')](_0x518339[_0x2b3e('0x32')],_0x518339[_0x2b3e('0x33')]);_0x31eb94[_0x2b3e('0x34')]=_[_0x2b3e('0x31')](_0x518339[_0x2b3e('0x32')],qs[_0x2b3e('0x35')](_0x28c923[_0x2b3e('0x33')][_0x2b3e('0x35')]));_0x31eb94[_0x2b3e('0x34')]=_0x31eb94[_0x2b3e('0x34')][_0x2b3e('0x36')]?_0x31eb94[_0x2b3e('0x34')]:_0x518339['model'];if(!_0x28c923[_0x2b3e('0x33')][_0x2b3e('0x37')](_0x2b3e('0x38'))){_0x31eb94[_0x2b3e('0x1e')]=qs[_0x2b3e('0x1e')](_0x28c923['query']['limit']);_0x31eb94[_0x2b3e('0x1c')]=qs[_0x2b3e('0x1c')](_0x28c923[_0x2b3e('0x33')][_0x2b3e('0x1c')]);}_0x31eb94[_0x2b3e('0x39')]=qs[_0x2b3e('0x3a')](_0x28c923[_0x2b3e('0x33')]['sort']);_0x31eb94['where']=qs[_0x2b3e('0x3b')](_[_0x2b3e('0x3c')](_0x28c923['query'],_0x518339[_0x2b3e('0x3b')]),_0x4428c2);if(_0x28c923[_0x2b3e('0x33')]['filter']){_0x31eb94[_0x2b3e('0x3d')]=_[_0x2b3e('0x3e')](_0x31eb94[_0x2b3e('0x3d')],{'$or':_['map'](_0x4428c2,function(_0x37f735){if(_0x37f735[_0x2b3e('0x2f')]!=='VIRTUAL'){var _0x38792f={};_0x38792f[_0x37f735[_0x2b3e('0x2a')]]={'$like':'%'+_0x28c923['query'][_0x2b3e('0x3f')]+'%'};return _0x38792f;}})});}_0x31eb94=_[_0x2b3e('0x3e')]({},_0x31eb94,_0x28c923[_0x2b3e('0x40')]);var _0x4a4ec6={'where':_0x31eb94[_0x2b3e('0x3d')]};return db['AnalyticFieldReport'][_0x2b3e('0x1f')](_0x4a4ec6)[_0x2b3e('0x27')](function(_0x2627be){_0x2e92c7['count']=_0x2627be;if(_0x28c923[_0x2b3e('0x33')]['includeAll']){_0x31eb94[_0x2b3e('0x41')]=[{'all':!![]}];}return db[_0x2b3e('0x42')][_0x2b3e('0x43')](_0x31eb94);})[_0x2b3e('0x27')](function(_0x4699b0){_0x2e92c7[_0x2b3e('0x44')]=_0x4699b0;return _0x2e92c7;})[_0x2b3e('0x27')](respondWithFilteredResult(_0x21265a,_0x31eb94))['catch'](handleError(_0x21265a,null));};exports['show']=function(_0x25f80f,_0x4a3393){var _0x29e164={'raw':![],'where':{'id':_0x25f80f[_0x2b3e('0x45')]['id']}},_0x118271={};_0x118271['model']=_[_0x2b3e('0x30')](db[_0x2b3e('0x42')][_0x2b3e('0x2e')]);_0x118271[_0x2b3e('0x33')]=_['keys'](_0x25f80f[_0x2b3e('0x33')]);_0x118271[_0x2b3e('0x3b')]=_[_0x2b3e('0x31')](_0x118271[_0x2b3e('0x32')],_0x118271[_0x2b3e('0x33')]);_0x29e164[_0x2b3e('0x34')]=_['intersection'](_0x118271[_0x2b3e('0x32')],qs[_0x2b3e('0x35')](_0x25f80f[_0x2b3e('0x33')]['fields']));_0x29e164[_0x2b3e('0x34')]=_0x29e164[_0x2b3e('0x34')][_0x2b3e('0x36')]?_0x29e164[_0x2b3e('0x34')]:_0x118271['model'];if(_0x25f80f['query'][_0x2b3e('0x46')]){_0x29e164['include']=[{'all':!![]}];}_0x29e164=_[_0x2b3e('0x3e')]({},_0x29e164,_0x25f80f[_0x2b3e('0x40')]);return db[_0x2b3e('0x42')]['find'](_0x29e164)[_0x2b3e('0x27')](handleEntityNotFound(_0x4a3393,null))[_0x2b3e('0x27')](respondWithResult(_0x4a3393,null))[_0x2b3e('0x47')](handleError(_0x4a3393,null));};exports['create']=function(_0x5a189b,_0x34fa32){return db[_0x2b3e('0x42')]['create'](_0x5a189b[_0x2b3e('0x48')],{})['then'](respondWithResult(_0x34fa32,0xc9))[_0x2b3e('0x47')](handleError(_0x34fa32,null));};exports['bulkCreate']=function(_0x15de3f,_0x3e8c61){return db[_0x2b3e('0x42')][_0x2b3e('0x49')](_0x15de3f[_0x2b3e('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3e8c61,0xc9))[_0x2b3e('0x47')](handleError(_0x3e8c61,null));};exports[_0x2b3e('0x25')]=function(_0x2b89fe,_0x25366b){if(_0x2b89fe[_0x2b3e('0x48')]['id']){delete _0x2b89fe[_0x2b3e('0x48')]['id'];}return db[_0x2b3e('0x42')]['find']({'where':{'id':_0x2b89fe[_0x2b3e('0x45')]['id']}})[_0x2b3e('0x27')](handleEntityNotFound(_0x25366b,null))[_0x2b3e('0x27')](saveUpdates(_0x2b89fe[_0x2b3e('0x48')],null))['then'](respondWithResult(_0x25366b,null))['catch'](handleError(_0x25366b,null));};exports[_0x2b3e('0x26')]=function(_0x12cb1c,_0x1fd064){return db[_0x2b3e('0x42')][_0x2b3e('0x4a')]({'where':{'id':_0x12cb1c[_0x2b3e('0x45')]['id']}})[_0x2b3e('0x27')](handleEntityNotFound(_0x1fd064,null))['then'](removeEntity(_0x1fd064,null))[_0x2b3e('0x47')](handleError(_0x1fd064,null));};exports[_0x2b3e('0x4b')]=function(_0x3e66c6,_0x4b1a1a){return db[_0x2b3e('0x42')][_0x2b3e('0x26')]({'where':{'id':_0x3e66c6['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4b1a1a,0xcc))[_0x2b3e('0x47')](handleError(_0x4b1a1a,null));};exports[_0x2b3e('0x4c')]=function(_0x47d9da,_0x13dd22,_0x4ec89d){return db[_0x2b3e('0x4d')][_0x2b3e('0x4e')]({'where':{'id':_0x47d9da[_0x2b3e('0x45')]['id']}})['then'](handleEntityNotFound(_0x13dd22,null))[_0x2b3e('0x27')](function(_0x3a742){if(_0x3a742){return db[_0x2b3e('0x4f')][_0x2b3e('0x50')](function(_0x412e92){return db[_0x2b3e('0x42')][_0x2b3e('0x26')]({'where':{'CustomReportId':_0x47d9da[_0x2b3e('0x45')]['id']},'transaction':_0x412e92})['then'](function(_0x4900f8){var _0x3236d3=_[_0x2b3e('0x2d')](_0x47d9da[_0x2b3e('0x48')],function(_0x2e8e58){delete _0x2e8e58['id'];_0x2e8e58[_0x2b3e('0x51')]=_0x47d9da['params']['id'];return _0x2e8e58;});return db[_0x2b3e('0x42')]['bulkCreate'](_0x3236d3,{'transaction':_0x412e92});});})['then'](function(){return db[_0x2b3e('0x42')][_0x2b3e('0x43')]({'where':{'CustomReportId':_0x47d9da['params']['id']}});});}})['then'](respondWithResult(_0x13dd22,null))[_0x2b3e('0x47')](handleError(_0x13dd22,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 419862d..b9eaaa8 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 _0xad1d=['rimraf','../../config/environment','exports','define','lodash','util','api','moment','request-promise','path'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xad1d,0xc2));var _0xdad1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xad1d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xdad1('0x0'));var util=require(_0xdad1('0x1'));var logger=require('../../config/logger')(_0xdad1('0x2'));var moment=require(_0xdad1('0x3'));var BPromise=require('bluebird');var rp=require(_0xdad1('0x4'));var fs=require('fs');var path=require(_0xdad1('0x5'));var rimraf=require(_0xdad1('0x6'));var config=require(_0xdad1('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xdad1('0x8')]=function(_0x166a72,_0x136c63){return _0x166a72[_0xdad1('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5088=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x5088,0x14f));var _0x8508=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x5088[_0x40df5f];return _0x1573f1;};'use strict';var _=require(_0x8508('0x0'));var util=require(_0x8508('0x1'));var logger=require('../../config/logger')(_0x8508('0x2'));var moment=require(_0x8508('0x3'));var BPromise=require(_0x8508('0x4'));var rp=require(_0x8508('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8508('0x6'));var config=require(_0x8508('0x7'));var attributes=require(_0x8508('0x8'));module[_0x8508('0x9')]=function(_0x5179ae,_0x333177){return _0x5179ae[_0x8508('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x8508('0xb'),'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 f1730a9..3370b25 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 _0xcc90=['request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xcc90,0x165));var _0x0cc9=function(_0x24cba9,_0x12f3b7){_0x24cba9=_0x24cba9-0x0;var _0x376d70=_0xcc90[_0x24cba9];return _0x376d70;};'use strict';var _=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var moment=require(_0x0cc9('0x2'));var BPromise=require(_0x0cc9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cc9('0x4'))['db'];var utils=require(_0x0cc9('0x5'));var logger=require(_0x0cc9('0x6'))(_0x0cc9('0x7'));var config=require(_0x0cc9('0x8'));var jayson=require(_0x0cc9('0x9'));var client=jayson[_0x0cc9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543d9e,_0x356397,_0x42e553){return new BPromise(function(_0x2f3811,_0x13e4ea){return client[_0x0cc9('0xb')](_0x543d9e,_0x42e553)[_0x0cc9('0xc')](function(_0x3ff3f2){logger[_0x0cc9('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x356397,_0x0cc9('0xe'));logger[_0x0cc9('0xf')](_0x0cc9('0x10'),_0x356397,_0x0cc9('0xe'),JSON[_0x0cc9('0x11')](_0x3ff3f2));if(_0x3ff3f2['error']){if(_0x3ff3f2[_0x0cc9('0x12')][_0x0cc9('0x13')]===0x1f4){logger['error'](_0x0cc9('0x14'),_0x356397,_0x3ff3f2[_0x0cc9('0x12')]['message']);return _0x13e4ea(_0x3ff3f2[_0x0cc9('0x12')][_0x0cc9('0x15')]);}logger[_0x0cc9('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x356397,_0x3ff3f2['error'][_0x0cc9('0x15')]);return _0x2f3811(_0x3ff3f2[_0x0cc9('0x12')]['message']);}else{logger[_0x0cc9('0xd')](_0x0cc9('0x14'),_0x356397,'request\x20sent');_0x2f3811(_0x3ff3f2[_0x0cc9('0x16')][_0x0cc9('0x15')]);}})['catch'](function(_0x22c5c4){logger[_0x0cc9('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x356397,_0x22c5c4);_0x13e4ea(_0x22c5c4);});});} \ No newline at end of file +var _0xde7c=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xde7c,0x163));var _0xcde7=function(_0x5ede6d,_0x57f524){_0x5ede6d=_0x5ede6d-0x0;var _0x517d25=_0xde7c[_0x5ede6d];return _0x517d25;};'use strict';var _=require(_0xcde7('0x0'));var util=require(_0xcde7('0x1'));var moment=require(_0xcde7('0x2'));var BPromise=require(_0xcde7('0x3'));var rs=require(_0xcde7('0x4'));var fs=require('fs');var Redis=require(_0xcde7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcde7('0x6'));var logger=require(_0xcde7('0x7'))('rpc');var config=require(_0xcde7('0x8'));var jayson=require(_0xcde7('0x9'));var client=jayson['client'][_0xcde7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244d3f,_0x38ed74,_0x5f1e2e){return new BPromise(function(_0x39fc41,_0xbde418){return client[_0xcde7('0xb')](_0x244d3f,_0x5f1e2e)[_0xcde7('0xc')](function(_0x4f46cb){logger['info'](_0xcde7('0xd'),_0x38ed74,_0xcde7('0xe'));logger[_0xcde7('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x38ed74,_0xcde7('0xe'),JSON[_0xcde7('0x10')](_0x4f46cb));if(_0x4f46cb[_0xcde7('0x11')]){if(_0x4f46cb[_0xcde7('0x11')][_0xcde7('0x12')]===0x1f4){logger[_0xcde7('0x11')](_0xcde7('0xd'),_0x38ed74,_0x4f46cb['error'][_0xcde7('0x13')]);return _0xbde418(_0x4f46cb[_0xcde7('0x11')][_0xcde7('0x13')]);}logger[_0xcde7('0x11')](_0xcde7('0xd'),_0x38ed74,_0x4f46cb['error'][_0xcde7('0x13')]);return _0x39fc41(_0x4f46cb['error'][_0xcde7('0x13')]);}else{logger[_0xcde7('0x14')](_0xcde7('0xd'),_0x38ed74,_0xcde7('0xe'));_0x39fc41(_0x4f46cb[_0xcde7('0x15')][_0xcde7('0x13')]);}})['catch'](function(_0x3ea8b0){logger[_0xcde7('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38ed74,_0x3ea8b0);_0xbde418(_0x3ea8b0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index c33c2a4..edc74a0 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(_0x5a5f78,_0x4439d0){var _0xcf607f=function(_0x3b947f){while(--_0x3b947f){_0x5a5f78['push'](_0x5a5f78['shift']());}};_0xcf607f(++_0x4439d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x4bdefc,_0x320439){var _0x543ee5=function(_0xbfbc3c){while(--_0xbfbc3c){_0x4bdefc['push'](_0x4bdefc['shift']());}};_0x543ee5(++_0x320439);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 627eeb4..8dd1604 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 _0x7d80=['name','TEXT','exports','STRING'];(function(_0x1b40b5,_0x25e063){var _0x5f0a6e=function(_0x22af6d){while(--_0x22af6d){_0x1b40b5['push'](_0x1b40b5['shift']());}};_0x5f0a6e(++_0x25e063);}(_0x7d80,0x17a));var _0x07d8=function(_0x2045c7,_0x3e2324){_0x2045c7=_0x2045c7-0x0;var _0x5e53e1=_0x7d80[_0x2045c7];return _0x5e53e1;};'use strict';var Sequelize=require('sequelize');module[_0x07d8('0x0')]={'name':{'type':Sequelize[_0x07d8('0x1')],'allowNull':![],'unique':_0x07d8('0x2')},'table':{'type':Sequelize[_0x07d8('0x1')]},'metric':{'type':Sequelize[_0x07d8('0x3')]},'description':{'type':Sequelize[_0x07d8('0x1')]}}; \ No newline at end of file +var _0xf290=['TEXT','STRING','exports','name'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf290,0xde));var _0x0f29=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf290[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x0f29('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0f29('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0f29('0x2')]},'description':{'type':Sequelize[_0x0f29('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c538353..61d764f 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x5ab7d2,_0x608bdb){var _0x12af06=function(_0x43c2e1){while(--_0x43c2e1){_0x5ab7d2['push'](_0x5ab7d2['shift']());}};_0x12af06(++_0x608bdb);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2e2768,_0x5d6ccd){_0x2e2768=_0x2e2768-0x0;var _0x483254=_0xe5b3[_0x2e2768];return _0x483254;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +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(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_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(){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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c70ddad..a6f872d 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 _0x82c4=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticMetric.attributes','define'];(function(_0x2af6e9,_0x315547){var _0x5ae10e=function(_0x2702eb){while(--_0x2702eb){_0x2af6e9['push'](_0x2af6e9['shift']());}};_0x5ae10e(++_0x315547);}(_0x82c4,0x1ca));var _0x482c=function(_0x5a0e32,_0x347ae2){_0x5a0e32=_0x5a0e32-0x0;var _0xea8f24=_0x82c4[_0x5a0e32];return _0xea8f24;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4753=['bluebird','path','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment'];(function(_0x5a0b9d,_0x190631){var _0x45a9d8=function(_0xd5f80b){while(--_0xd5f80b){_0x5a0b9d['push'](_0x5a0b9d['shift']());}};_0x45a9d8(++_0x190631);}(_0x4753,0x1f4));var _0x3475=function(_0x2e66d5,_0x1d799a){_0x2e66d5=_0x2e66d5-0x0;var _0x4a0ae2=_0x4753[_0x2e66d5];return _0x4a0ae2;};'use strict';var _=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var logger=require(_0x3475('0x2'))('api');var moment=require(_0x3475('0x3'));var BPromise=require(_0x3475('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3475('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x12df57,_0x18bd53){return _0x12df57['define'](_0x3475('0x6'),attributes,{'tableName':_0x3475('0x7'),'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 d1dfb47..d6b2197 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 _0x20fb=['jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x20fb,0xfd));var _0xb20f=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x20fb[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require('lodash');var util=require(_0xb20f('0x0'));var moment=require(_0xb20f('0x1'));var BPromise=require(_0xb20f('0x2'));var rs=require(_0xb20f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb20f('0x4'));var logger=require('../../config/logger')(_0xb20f('0x5'));var config=require(_0xb20f('0x6'));var jayson=require(_0xb20f('0x7'));var client=jayson[_0xb20f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239d3c,_0x1d07e6,_0xc1b3a6){return new BPromise(function(_0xf09d4,_0x3ad78d){return client[_0xb20f('0x9')](_0x239d3c,_0xc1b3a6)[_0xb20f('0xa')](function(_0x4a117b){logger[_0xb20f('0xb')](_0xb20f('0xc'),_0x1d07e6,'request\x20sent');logger['debug'](_0xb20f('0xd'),_0x1d07e6,_0xb20f('0xe'),JSON[_0xb20f('0xf')](_0x4a117b));if(_0x4a117b[_0xb20f('0x10')]){if(_0x4a117b[_0xb20f('0x10')][_0xb20f('0x11')]===0x1f4){logger[_0xb20f('0x10')](_0xb20f('0xc'),_0x1d07e6,_0x4a117b['error']['message']);return _0x3ad78d(_0x4a117b[_0xb20f('0x10')][_0xb20f('0x12')]);}logger[_0xb20f('0x10')](_0xb20f('0xc'),_0x1d07e6,_0x4a117b[_0xb20f('0x10')]['message']);return _0xf09d4(_0x4a117b[_0xb20f('0x10')][_0xb20f('0x12')]);}else{logger[_0xb20f('0xb')](_0xb20f('0xc'),_0x1d07e6,_0xb20f('0xe'));_0xf09d4(_0x4a117b['result'][_0xb20f('0x12')]);}})[_0xb20f('0x13')](function(_0x570310){logger[_0xb20f('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1d07e6,_0x570310);_0x3ad78d(_0x570310);});});} \ No newline at end of file +var _0xf2f4=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x4cfa72,_0x2cd5b0){var _0x3b6737=function(_0x471c73){while(--_0x471c73){_0x4cfa72['push'](_0x4cfa72['shift']());}};_0x3b6737(++_0x2cd5b0);}(_0xf2f4,0x81));var _0x4f2f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf2f4[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x4f2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f2f('0x2'));var db=require(_0x4f2f('0x3'))['db'];var utils=require(_0x4f2f('0x4'));var logger=require(_0x4f2f('0x5'))('rpc');var config=require(_0x4f2f('0x6'));var jayson=require(_0x4f2f('0x7'));var client=jayson[_0x4f2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359958,_0x41ede7,_0x141f7b){return new BPromise(function(_0x4976c6,_0x39b19f){return client[_0x4f2f('0x9')](_0x359958,_0x141f7b)[_0x4f2f('0xa')](function(_0x4192de){logger[_0x4f2f('0xb')](_0x4f2f('0xc'),_0x41ede7,_0x4f2f('0xd'));logger[_0x4f2f('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x41ede7,_0x4f2f('0xd'),JSON[_0x4f2f('0xf')](_0x4192de));if(_0x4192de[_0x4f2f('0x10')]){if(_0x4192de[_0x4f2f('0x10')][_0x4f2f('0x11')]===0x1f4){logger[_0x4f2f('0x10')](_0x4f2f('0xc'),_0x41ede7,_0x4192de[_0x4f2f('0x10')][_0x4f2f('0x12')]);return _0x39b19f(_0x4192de[_0x4f2f('0x10')][_0x4f2f('0x12')]);}logger[_0x4f2f('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x41ede7,_0x4192de[_0x4f2f('0x10')][_0x4f2f('0x12')]);return _0x4976c6(_0x4192de['error']['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x41ede7,_0x4f2f('0xd'));_0x4976c6(_0x4192de['result'][_0x4f2f('0x12')]);}})[_0x4f2f('0x13')](function(_0x5ef384){logger['error'](_0x4f2f('0xc'),_0x41ede7,_0x5ef384);_0x39b19f(_0x5ef384);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6232b90..a4c9840 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 _0x448b=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x448b,0x125));var _0xb448=function(_0x4c55ba,_0x542e34){_0x4c55ba=_0x4c55ba-0x0;var _0x5ac408=_0x448b[_0x4c55ba];return _0x5ac408;};'use strict';var multer=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var path=require(_0xb448('0x2'));var timeout=require(_0xb448('0x3'));var express=require(_0xb448('0x4'));var router=express[_0xb448('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb448('0x6'));var interaction=require(_0xb448('0x7'));var config=require(_0xb448('0x8'));var controller=require(_0xb448('0x9'));router[_0xb448('0xa')]('/',auth[_0xb448('0xb')](),controller[_0xb448('0xc')]);router['get'](_0xb448('0xd'),auth[_0xb448('0xb')](),controller[_0xb448('0xe')]);router[_0xb448('0xf')]('/',auth[_0xb448('0xb')](),controller[_0xb448('0x10')]);router[_0xb448('0x11')](_0xb448('0xd'),auth['isAuthenticated'](),controller[_0xb448('0x12')]);router[_0xb448('0x13')](_0xb448('0xd'),auth[_0xb448('0xb')](),controller[_0xb448('0x14')]);module[_0xb448('0x15')]=router; \ No newline at end of file +var _0x0f89=['../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0f89,0x111));var _0x90f8=function(_0x24604f,_0x2616b5){_0x24604f=_0x24604f-0x0;var _0x1c4583=_0x0f89[_0x24604f];return _0x1c4583;};'use strict';var multer=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var path=require(_0x90f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x90f8('0x3'));var router=express[_0x90f8('0x4')]();var fs_extra=require(_0x90f8('0x5'));var auth=require(_0x90f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90f8('0x7'));var controller=require(_0x90f8('0x8'));router['get']('/',auth[_0x90f8('0x9')](),controller[_0x90f8('0xa')]);router[_0x90f8('0xb')](_0x90f8('0xc'),auth[_0x90f8('0x9')](),controller[_0x90f8('0xd')]);router[_0x90f8('0xe')]('/',auth[_0x90f8('0x9')](),controller[_0x90f8('0xf')]);router[_0x90f8('0x10')](_0x90f8('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x90f8('0x11')](_0x90f8('0xc'),auth[_0x90f8('0x9')](),controller[_0x90f8('0x12')]);module[_0x90f8('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 92a927c..9fb54b1 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 _0x80d1=['exports','TEXT','sequelize'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x80d1,0x1d0));var _0x180d=function(_0x5202c8,_0x30468f){_0x5202c8=_0x5202c8-0x0;var _0x3d318d=_0x80d1[_0x5202c8];return _0x3d318d;};'use strict';var Sequelize=require(_0x180d('0x0'));module[_0x180d('0x1')]={'tree':{'type':Sequelize[_0x180d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0f72=['sequelize','TEXT'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0x0f72,0x7a));var _0x20f7=function(_0x59c92c,_0x1a98c9){_0x59c92c=_0x59c92c-0x0;var _0x11fe84=_0x0f72[_0x59c92c];return _0x11fe84;};'use strict';var Sequelize=require(_0x20f7('0x0'));module['exports']={'tree':{'type':Sequelize[_0x20f7('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 26a1d7d..d6a0431 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 _0xbde1=['destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x1700e2,_0x51a6e8){var _0x27a26c=function(_0xfd54d5){while(--_0xfd54d5){_0x1700e2['push'](_0x1700e2['shift']());}};_0x27a26c(++_0x51a6e8);}(_0xbde1,0x18b));var _0x1bde=function(_0x1f156c,_0x144663){_0x1f156c=_0x1f156c-0x0;var _0x30697a=_0xbde1[_0x1f156c];return _0x30697a;};'use strict';var emlformat=require(_0x1bde('0x0'));var rimraf=require(_0x1bde('0x1'));var zipdir=require(_0x1bde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1bde('0x3'));var BPromise=require(_0x1bde('0x4'));var Mustache=require(_0x1bde('0x5'));var util=require(_0x1bde('0x6'));var path=require(_0x1bde('0x7'));var sox=require(_0x1bde('0x8'));var csv=require(_0x1bde('0x9'));var ejs=require(_0x1bde('0xa'));var fs=require('fs');var fs_extra=require(_0x1bde('0xb'));var _=require(_0x1bde('0xc'));var squel=require(_0x1bde('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1bde('0xe'));var toCsv=require(_0x1bde('0x9'));var querystring=require('querystring');var Papa=require(_0x1bde('0xf'));var Redis=require(_0x1bde('0x10'));var authService=require(_0x1bde('0x11'));var qs=require(_0x1bde('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bde('0x13'))(_0x1bde('0x14'));var utils=require('../../config/utils');var config=require(_0x1bde('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bde('0x16'))['db'];function respondWithStatusCode(_0x4f3c0e,_0x14230d){_0x14230d=_0x14230d||0xcc;return function(_0x351a65){if(_0x351a65){return _0x4f3c0e[_0x1bde('0x17')](_0x14230d);}return _0x4f3c0e['status'](_0x14230d)[_0x1bde('0x18')]();};}function respondWithResult(_0x161b25,_0x24b1fb){_0x24b1fb=_0x24b1fb||0xc8;return function(_0x576b9e){if(_0x576b9e){return _0x161b25[_0x1bde('0x19')](_0x24b1fb)[_0x1bde('0x1a')](_0x576b9e);}};}function respondWithFilteredResult(_0x4c2ecd,_0x2fc555){return function(_0x244578){if(_0x244578){var _0x303003=typeof _0x2fc555['offset']===_0x1bde('0x1b')&&typeof _0x2fc555[_0x1bde('0x1c')]===_0x1bde('0x1b');var _0x199335=_0x244578[_0x1bde('0x1d')];var _0x2d5c71=_0x303003?0x0:_0x2fc555[_0x1bde('0x1e')];var _0x5aad6e=_0x303003?_0x244578[_0x1bde('0x1d')]:_0x2fc555['offset']+_0x2fc555[_0x1bde('0x1c')];var _0x3e929c;if(_0x5aad6e>=_0x199335){_0x5aad6e=_0x199335;_0x3e929c=0xc8;}else{_0x3e929c=0xce;}_0x4c2ecd['status'](_0x3e929c);return _0x4c2ecd[_0x1bde('0x1f')](_0x1bde('0x20'),_0x2d5c71+'-'+_0x5aad6e+'/'+_0x199335)[_0x1bde('0x1a')](_0x244578);}return null;};}function patchUpdates(_0x26cc4f){return function(_0x47e2c2){try{jsonpatch[_0x1bde('0x21')](_0x47e2c2,_0x26cc4f,!![]);}catch(_0x1d0890){return BPromise['reject'](_0x1d0890);}return _0x47e2c2[_0x1bde('0x22')]();};}function saveUpdates(_0x669d69,_0x38d51a){return function(_0x4a4f1){if(_0x4a4f1){return _0x4a4f1[_0x1bde('0x23')](_0x669d69)[_0x1bde('0x24')](function(_0x43187e){return _0x43187e;});}return null;};}function removeEntity(_0x246aca,_0x42e851){return function(_0x32738e){if(_0x32738e){return _0x32738e[_0x1bde('0x25')]()[_0x1bde('0x24')](function(){_0x246aca[_0x1bde('0x19')](0xcc)[_0x1bde('0x18')]();});}};}function handleEntityNotFound(_0x13959b,_0xc216d2){return function(_0x4f9e17){if(!_0x4f9e17){_0x13959b['sendStatus'](0x194);}return _0x4f9e17;};}function handleError(_0xb07961,_0x12968a){_0x12968a=_0x12968a||0x1f4;return function(_0x5f3651){logger[_0x1bde('0x26')](_0x5f3651[_0x1bde('0x27')]);if(_0x5f3651[_0x1bde('0x28')]){delete _0x5f3651[_0x1bde('0x28')];}_0xb07961[_0x1bde('0x19')](_0x12968a)[_0x1bde('0x29')](_0x5f3651);};}exports[_0x1bde('0x2a')]=function(_0x1674dc,_0x5198e7){var _0x54b9e6={},_0xf220d4={},_0x3ca447={'count':0x0,'rows':[]};var _0x145909=_['map'](db[_0x1bde('0x2b')][_0x1bde('0x2c')],function(_0x2d6d62){return{'name':_0x2d6d62['fieldName'],'type':_0x2d6d62[_0x1bde('0x2d')][_0x1bde('0x2e')]};});_0xf220d4[_0x1bde('0x2f')]=_[_0x1bde('0x30')](_0x145909,_0x1bde('0x28'));_0xf220d4[_0x1bde('0x31')]=_['keys'](_0x1674dc[_0x1bde('0x31')]);_0xf220d4[_0x1bde('0x32')]=_[_0x1bde('0x33')](_0xf220d4[_0x1bde('0x2f')],_0xf220d4[_0x1bde('0x31')]);_0x54b9e6[_0x1bde('0x34')]=_[_0x1bde('0x33')](_0xf220d4[_0x1bde('0x2f')],qs[_0x1bde('0x35')](_0x1674dc[_0x1bde('0x31')]['fields']));_0x54b9e6[_0x1bde('0x34')]=_0x54b9e6[_0x1bde('0x34')][_0x1bde('0x36')]?_0x54b9e6[_0x1bde('0x34')]:_0xf220d4[_0x1bde('0x2f')];if(!_0x1674dc[_0x1bde('0x31')][_0x1bde('0x37')](_0x1bde('0x38'))){_0x54b9e6[_0x1bde('0x1c')]=qs[_0x1bde('0x1c')](_0x1674dc[_0x1bde('0x31')][_0x1bde('0x1c')]);_0x54b9e6[_0x1bde('0x1e')]=qs['offset'](_0x1674dc['query'][_0x1bde('0x1e')]);}_0x54b9e6['order']=qs[_0x1bde('0x39')](_0x1674dc['query'][_0x1bde('0x39')]);_0x54b9e6[_0x1bde('0x3a')]=qs[_0x1bde('0x32')](_[_0x1bde('0x3b')](_0x1674dc['query'],_0xf220d4[_0x1bde('0x32')]),_0x145909);if(_0x1674dc['query'][_0x1bde('0x3c')]){_0x54b9e6[_0x1bde('0x3a')]=_[_0x1bde('0x3d')](_0x54b9e6[_0x1bde('0x3a')],{'$or':_['map'](_0x145909,function(_0x3cd17b){if(_0x3cd17b[_0x1bde('0x2d')]!==_0x1bde('0x3e')){var _0x3cb0f6={};_0x3cb0f6[_0x3cd17b[_0x1bde('0x28')]]={'$like':'%'+_0x1674dc[_0x1bde('0x31')][_0x1bde('0x3c')]+'%'};return _0x3cb0f6;}})});}_0x54b9e6=_[_0x1bde('0x3d')]({},_0x54b9e6,_0x1674dc[_0x1bde('0x3f')]);var _0x93c4f8={'where':_0x54b9e6[_0x1bde('0x3a')]};return db[_0x1bde('0x2b')]['count'](_0x93c4f8)[_0x1bde('0x24')](function(_0x3f978c){_0x3ca447[_0x1bde('0x1d')]=_0x3f978c;if(_0x1674dc['query'][_0x1bde('0x40')]){_0x54b9e6['include']=[{'all':!![]}];}return db[_0x1bde('0x2b')]['findAll'](_0x54b9e6);})['then'](function(_0x368d4c){_0x3ca447[_0x1bde('0x41')]=_0x368d4c;return _0x3ca447;})[_0x1bde('0x24')](respondWithFilteredResult(_0x5198e7,_0x54b9e6))[_0x1bde('0x42')](handleError(_0x5198e7,null));};exports['show']=function(_0x353bd3,_0xfd02de){var _0x1e7ed3={'raw':!![],'where':{'id':_0x353bd3[_0x1bde('0x43')]['id']}},_0x4ad179={};_0x4ad179[_0x1bde('0x2f')]=_[_0x1bde('0x44')](db[_0x1bde('0x2b')][_0x1bde('0x2c')]);_0x4ad179[_0x1bde('0x31')]=_[_0x1bde('0x44')](_0x353bd3[_0x1bde('0x31')]);_0x4ad179[_0x1bde('0x32')]=_[_0x1bde('0x33')](_0x4ad179[_0x1bde('0x2f')],_0x4ad179[_0x1bde('0x31')]);_0x1e7ed3['attributes']=_[_0x1bde('0x33')](_0x4ad179[_0x1bde('0x2f')],qs[_0x1bde('0x35')](_0x353bd3[_0x1bde('0x31')][_0x1bde('0x35')]));_0x1e7ed3[_0x1bde('0x34')]=_0x1e7ed3['attributes'][_0x1bde('0x36')]?_0x1e7ed3[_0x1bde('0x34')]:_0x4ad179[_0x1bde('0x2f')];if(_0x353bd3['query'][_0x1bde('0x40')]){_0x1e7ed3[_0x1bde('0x45')]=[{'all':!![]}];}_0x1e7ed3=_['merge']({},_0x1e7ed3,_0x353bd3[_0x1bde('0x3f')]);return db[_0x1bde('0x2b')]['find'](_0x1e7ed3)['then'](handleEntityNotFound(_0xfd02de,null))['then'](respondWithResult(_0xfd02de,null))[_0x1bde('0x42')](handleError(_0xfd02de,null));};exports['create']=function(_0x5d5a58,_0x3712f3){return db[_0x1bde('0x2b')]['create'](_0x5d5a58['body'],{})['then'](respondWithResult(_0x3712f3,0xc9))[_0x1bde('0x42')](handleError(_0x3712f3,null));};exports[_0x1bde('0x23')]=function(_0x3455a5,_0x32490a){if(_0x3455a5[_0x1bde('0x46')]['id']){delete _0x3455a5[_0x1bde('0x46')]['id'];}return db['AnalyticTreeReport'][_0x1bde('0x47')]({'where':{'id':_0x3455a5['params']['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x32490a,null))[_0x1bde('0x24')](saveUpdates(_0x3455a5['body'],null))[_0x1bde('0x24')](respondWithResult(_0x32490a,null))[_0x1bde('0x42')](handleError(_0x32490a,null));};exports[_0x1bde('0x25')]=function(_0x374cbc,_0x6d3abb){return db[_0x1bde('0x2b')]['find']({'where':{'id':_0x374cbc[_0x1bde('0x43')]['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x6d3abb,null))[_0x1bde('0x24')](removeEntity(_0x6d3abb,null))['catch'](handleError(_0x6d3abb,null));}; \ No newline at end of file +var _0xac88=['undefined','offset','Content-Range','reject','save','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticTreeReport','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x2656fa,_0x5e8711){var _0x7e2d2a=function(_0x4c565a){while(--_0x4c565a){_0x2656fa['push'](_0x2656fa['shift']());}};_0x7e2d2a(++_0x5e8711);}(_0xac88,0xb9));var _0x8ac8=function(_0x5c6d95,_0x151e00){_0x5c6d95=_0x5c6d95-0x0;var _0x32e640=_0xac88[_0x5c6d95];return _0x32e640;};'use strict';var emlformat=require(_0x8ac8('0x0'));var rimraf=require(_0x8ac8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ac8('0x2'));var rp=require('request-promise');var moment=require(_0x8ac8('0x3'));var BPromise=require(_0x8ac8('0x4'));var Mustache=require(_0x8ac8('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ac8('0x6'));var fs=require('fs');var fs_extra=require(_0x8ac8('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ac8('0x8'));var jsforce=require(_0x8ac8('0x9'));var deskjs=require(_0x8ac8('0xa'));var toCsv=require(_0x8ac8('0xb'));var querystring=require(_0x8ac8('0xc'));var Papa=require(_0x8ac8('0xd'));var Redis=require(_0x8ac8('0xe'));var authService=require(_0x8ac8('0xf'));var qs=require(_0x8ac8('0x10'));var as=require(_0x8ac8('0x11'));var hardwareService=require(_0x8ac8('0x12'));var logger=require(_0x8ac8('0x13'))(_0x8ac8('0x14'));var utils=require(_0x8ac8('0x15'));var config=require(_0x8ac8('0x16'));var licenseUtil=require(_0x8ac8('0x17'));var db=require(_0x8ac8('0x18'))['db'];function respondWithStatusCode(_0x4e31ae,_0x26027f){_0x26027f=_0x26027f||0xcc;return function(_0x3faec0){if(_0x3faec0){return _0x4e31ae[_0x8ac8('0x19')](_0x26027f);}return _0x4e31ae[_0x8ac8('0x1a')](_0x26027f)['end']();};}function respondWithResult(_0x302265,_0x55b2ea){_0x55b2ea=_0x55b2ea||0xc8;return function(_0x5e1368){if(_0x5e1368){return _0x302265[_0x8ac8('0x1a')](_0x55b2ea)[_0x8ac8('0x1b')](_0x5e1368);}};}function respondWithFilteredResult(_0x571b5a,_0x4b83de){return function(_0x543635){if(_0x543635){var _0x5792b4=typeof _0x4b83de['offset']===_0x8ac8('0x1c')&&typeof _0x4b83de['limit']===_0x8ac8('0x1c');var _0x1ead4b=_0x543635['count'];var _0x28e5fb=_0x5792b4?0x0:_0x4b83de['offset'];var _0x32da3c=_0x5792b4?_0x543635['count']:_0x4b83de[_0x8ac8('0x1d')]+_0x4b83de['limit'];var _0x27f676;if(_0x32da3c>=_0x1ead4b){_0x32da3c=_0x1ead4b;_0x27f676=0xc8;}else{_0x27f676=0xce;}_0x571b5a[_0x8ac8('0x1a')](_0x27f676);return _0x571b5a['set'](_0x8ac8('0x1e'),_0x28e5fb+'-'+_0x32da3c+'/'+_0x1ead4b)['json'](_0x543635);}return null;};}function patchUpdates(_0x3388f1){return function(_0x3f0cee){try{jsonpatch['apply'](_0x3f0cee,_0x3388f1,!![]);}catch(_0x10a137){return BPromise[_0x8ac8('0x1f')](_0x10a137);}return _0x3f0cee[_0x8ac8('0x20')]();};}function saveUpdates(_0xeb38dd,_0x288dda){return function(_0x399d51){if(_0x399d51){return _0x399d51['update'](_0xeb38dd)[_0x8ac8('0x21')](function(_0x12c80f){return _0x12c80f;});}return null;};}function removeEntity(_0x2907d8,_0x22c018){return function(_0x4a2f1b){if(_0x4a2f1b){return _0x4a2f1b[_0x8ac8('0x22')]()['then'](function(){_0x2907d8[_0x8ac8('0x1a')](0xcc)[_0x8ac8('0x23')]();});}};}function handleEntityNotFound(_0x5216b5,_0x5286ab){return function(_0x413bff){if(!_0x413bff){_0x5216b5[_0x8ac8('0x19')](0x194);}return _0x413bff;};}function handleError(_0xff086c,_0x42ed0d){_0x42ed0d=_0x42ed0d||0x1f4;return function(_0x22fa2e){logger['error'](_0x22fa2e['stack']);if(_0x22fa2e[_0x8ac8('0x24')]){delete _0x22fa2e[_0x8ac8('0x24')];}_0xff086c[_0x8ac8('0x1a')](_0x42ed0d)[_0x8ac8('0x25')](_0x22fa2e);};}exports['index']=function(_0x356ecb,_0x2ead06){var _0x8d2c34={},_0x1ee39a={},_0x510c5a={'count':0x0,'rows':[]};var _0x1cb53c=_[_0x8ac8('0x26')](db['AnalyticTreeReport'][_0x8ac8('0x27')],function(_0x1bfa70){return{'name':_0x1bfa70[_0x8ac8('0x28')],'type':_0x1bfa70[_0x8ac8('0x29')]['key']};});_0x1ee39a[_0x8ac8('0x2a')]=_['map'](_0x1cb53c,_0x8ac8('0x24'));_0x1ee39a[_0x8ac8('0x2b')]=_[_0x8ac8('0x2c')](_0x356ecb['query']);_0x1ee39a[_0x8ac8('0x2d')]=_[_0x8ac8('0x2e')](_0x1ee39a[_0x8ac8('0x2a')],_0x1ee39a[_0x8ac8('0x2b')]);_0x8d2c34[_0x8ac8('0x2f')]=_['intersection'](_0x1ee39a[_0x8ac8('0x2a')],qs['fields'](_0x356ecb[_0x8ac8('0x2b')][_0x8ac8('0x30')]));_0x8d2c34['attributes']=_0x8d2c34[_0x8ac8('0x2f')][_0x8ac8('0x31')]?_0x8d2c34[_0x8ac8('0x2f')]:_0x1ee39a['model'];if(!_0x356ecb[_0x8ac8('0x2b')]['hasOwnProperty']('nolimit')){_0x8d2c34['limit']=qs[_0x8ac8('0x32')](_0x356ecb['query'][_0x8ac8('0x32')]);_0x8d2c34[_0x8ac8('0x1d')]=qs[_0x8ac8('0x1d')](_0x356ecb[_0x8ac8('0x2b')][_0x8ac8('0x1d')]);}_0x8d2c34[_0x8ac8('0x33')]=qs[_0x8ac8('0x34')](_0x356ecb['query'][_0x8ac8('0x34')]);_0x8d2c34[_0x8ac8('0x35')]=qs[_0x8ac8('0x2d')](_['pick'](_0x356ecb[_0x8ac8('0x2b')],_0x1ee39a['filters']),_0x1cb53c);if(_0x356ecb['query'][_0x8ac8('0x36')]){_0x8d2c34[_0x8ac8('0x35')]=_[_0x8ac8('0x37')](_0x8d2c34[_0x8ac8('0x35')],{'$or':_[_0x8ac8('0x26')](_0x1cb53c,function(_0x1a588d){if(_0x1a588d['type']!==_0x8ac8('0x38')){var _0x89cc33={};_0x89cc33[_0x1a588d[_0x8ac8('0x24')]]={'$like':'%'+_0x356ecb[_0x8ac8('0x2b')][_0x8ac8('0x36')]+'%'};return _0x89cc33;}})});}_0x8d2c34=_[_0x8ac8('0x37')]({},_0x8d2c34,_0x356ecb[_0x8ac8('0x39')]);var _0x55f5ff={'where':_0x8d2c34[_0x8ac8('0x35')]};return db[_0x8ac8('0x3a')][_0x8ac8('0x3b')](_0x55f5ff)[_0x8ac8('0x21')](function(_0x5cb9d1){_0x510c5a[_0x8ac8('0x3b')]=_0x5cb9d1;if(_0x356ecb[_0x8ac8('0x2b')][_0x8ac8('0x3c')]){_0x8d2c34[_0x8ac8('0x3d')]=[{'all':!![]}];}return db[_0x8ac8('0x3a')][_0x8ac8('0x3e')](_0x8d2c34);})[_0x8ac8('0x21')](function(_0x40a11c){_0x510c5a[_0x8ac8('0x3f')]=_0x40a11c;return _0x510c5a;})[_0x8ac8('0x21')](respondWithFilteredResult(_0x2ead06,_0x8d2c34))[_0x8ac8('0x40')](handleError(_0x2ead06,null));};exports[_0x8ac8('0x41')]=function(_0x4100c0,_0x51ed0b){var _0x20b0b8={'raw':!![],'where':{'id':_0x4100c0['params']['id']}},_0x17fe58={};_0x17fe58[_0x8ac8('0x2a')]=_[_0x8ac8('0x2c')](db['AnalyticTreeReport'][_0x8ac8('0x27')]);_0x17fe58['query']=_[_0x8ac8('0x2c')](_0x4100c0['query']);_0x17fe58[_0x8ac8('0x2d')]=_[_0x8ac8('0x2e')](_0x17fe58[_0x8ac8('0x2a')],_0x17fe58[_0x8ac8('0x2b')]);_0x20b0b8[_0x8ac8('0x2f')]=_[_0x8ac8('0x2e')](_0x17fe58[_0x8ac8('0x2a')],qs[_0x8ac8('0x30')](_0x4100c0[_0x8ac8('0x2b')][_0x8ac8('0x30')]));_0x20b0b8[_0x8ac8('0x2f')]=_0x20b0b8[_0x8ac8('0x2f')][_0x8ac8('0x31')]?_0x20b0b8[_0x8ac8('0x2f')]:_0x17fe58[_0x8ac8('0x2a')];if(_0x4100c0['query']['includeAll']){_0x20b0b8[_0x8ac8('0x3d')]=[{'all':!![]}];}_0x20b0b8=_['merge']({},_0x20b0b8,_0x4100c0[_0x8ac8('0x39')]);return db[_0x8ac8('0x3a')][_0x8ac8('0x42')](_0x20b0b8)[_0x8ac8('0x21')](handleEntityNotFound(_0x51ed0b,null))[_0x8ac8('0x21')](respondWithResult(_0x51ed0b,null))[_0x8ac8('0x40')](handleError(_0x51ed0b,null));};exports[_0x8ac8('0x43')]=function(_0x3ef501,_0x370e33){return db['AnalyticTreeReport'][_0x8ac8('0x43')](_0x3ef501[_0x8ac8('0x44')],{})['then'](respondWithResult(_0x370e33,0xc9))[_0x8ac8('0x40')](handleError(_0x370e33,null));};exports[_0x8ac8('0x45')]=function(_0x5bb0b5,_0x5f3439){if(_0x5bb0b5[_0x8ac8('0x44')]['id']){delete _0x5bb0b5[_0x8ac8('0x44')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x5bb0b5[_0x8ac8('0x46')]['id']}})[_0x8ac8('0x21')](handleEntityNotFound(_0x5f3439,null))[_0x8ac8('0x21')](saveUpdates(_0x5bb0b5[_0x8ac8('0x44')],null))[_0x8ac8('0x21')](respondWithResult(_0x5f3439,null))[_0x8ac8('0x40')](handleError(_0x5f3439,null));};exports[_0x8ac8('0x22')]=function(_0x20d44e,_0x40d2c5){return db['AnalyticTreeReport']['find']({'where':{'id':_0x20d44e[_0x8ac8('0x46')]['id']}})[_0x8ac8('0x21')](handleEntityNotFound(_0x40d2c5,null))[_0x8ac8('0x21')](removeEntity(_0x40d2c5,null))[_0x8ac8('0x40')](handleError(_0x40d2c5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3840d73..7be4190 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 _0x5841=['request-promise','path','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3fb07b,_0x2920ca){var _0x15cdb4=function(_0x93d9d5){while(--_0x93d9d5){_0x3fb07b['push'](_0x3fb07b['shift']());}};_0x15cdb4(++_0x2920ca);}(_0x5841,0x16e));var _0x1584=function(_0x4b4fab,_0x175057){_0x4b4fab=_0x4b4fab-0x0;var _0x1ba16c=_0x5841[_0x4b4fab];return _0x1ba16c;};'use strict';var _=require(_0x1584('0x0'));var util=require(_0x1584('0x1'));var logger=require(_0x1584('0x2'))(_0x1584('0x3'));var moment=require(_0x1584('0x4'));var BPromise=require(_0x1584('0x5'));var rp=require(_0x1584('0x6'));var fs=require('fs');var path=require(_0x1584('0x7'));var rimraf=require('rimraf');var config=require(_0x1584('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x1584('0x9')]=function(_0x31c816,_0x5a4b60){return _0x31c816['define'](_0x1584('0xa'),attributes,{'tableName':_0x1584('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4e=['api','moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x52c40d,_0xe5e076){var _0x4aca53=function(_0x1ffbf3){while(--_0x1ffbf3){_0x52c40d['push'](_0x52c40d['shift']());}};_0x4aca53(++_0xe5e076);}(_0x8f4e,0xaf));var _0xe8f4=function(_0x5e568b,_0x279964){_0x5e568b=_0x5e568b-0x0;var _0x504d77=_0x8f4e[_0x5e568b];return _0x504d77;};'use strict';var _=require(_0xe8f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe8f4('0x1'));var moment=require(_0xe8f4('0x2'));var BPromise=require(_0xe8f4('0x3'));var rp=require(_0xe8f4('0x4'));var fs=require('fs');var path=require(_0xe8f4('0x5'));var rimraf=require(_0xe8f4('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0xe8f4('0x7')]=function(_0x17a862,_0x12c670){return _0x17a862[_0xe8f4('0x8')](_0xe8f4('0x9'),attributes,{'tableName':_0xe8f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 6472a81..eecb145 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0xadb5,0xad));var _0x5adb=function(_0x151d15,_0x4740f5){_0x151d15=_0x151d15-0x0;var _0x7af97f=_0xadb5[_0x151d15];return _0x7af97f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x22056b,_0x203c60){var _0x3034b8=function(_0x2f16a2){while(--_0x2f16a2){_0x22056b['push'](_0x22056b['shift']());}};_0x3034b8(++_0x203c60);}(_0xdb28,0x106));var _0x8db2=function(_0x24b32c,_0x578c7e){_0x24b32c=_0x24b32c-0x0;var _0x48d105=_0xdb28[_0x24b32c];return _0x48d105;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3ffc8b1..bf58d5e 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 _0xe4ae=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xe4ae,0x101));var _0xee4a=function(_0x5cd8fa,_0x3f5270){_0x5cd8fa=_0x5cd8fa-0x0;var _0x3fd21c=_0xe4ae[_0x5cd8fa];return _0x3fd21c;};'use strict';var multer=require(_0xee4a('0x0'));var util=require(_0xee4a('0x1'));var path=require('path');var timeout=require(_0xee4a('0x2'));var express=require(_0xee4a('0x3'));var router=express['Router']();var fs_extra=require(_0xee4a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee4a('0x5'));var config=require(_0xee4a('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xee4a('0x7')]('/',auth[_0xee4a('0x8')](),controller[_0xee4a('0x9')]);router[_0xee4a('0x7')]('/:id',auth[_0xee4a('0x8')](),controller['show']);router[_0xee4a('0xa')]('/',auth[_0xee4a('0x8')](),controller[_0xee4a('0xb')]);router[_0xee4a('0xc')](_0xee4a('0xd'),auth[_0xee4a('0x8')](),controller[_0xee4a('0xe')]);router['delete'](_0xee4a('0xd'),auth[_0xee4a('0x8')](),controller[_0xee4a('0xf')]);module[_0xee4a('0x10')]=router; \ No newline at end of file +var _0x02d3=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','update','delete','destroy'];(function(_0x3762e7,_0x1812f1){var _0x47a1ed=function(_0xea1927){while(--_0xea1927){_0x3762e7['push'](_0x3762e7['shift']());}};_0x47a1ed(++_0x1812f1);}(_0x02d3,0x1bb));var _0x302d=function(_0x171c89,_0x568596){_0x171c89=_0x171c89-0x0;var _0x113b34=_0x02d3[_0x171c89];return _0x113b34;};'use strict';var multer=require(_0x302d('0x0'));var util=require('util');var path=require(_0x302d('0x1'));var timeout=require(_0x302d('0x2'));var express=require(_0x302d('0x3'));var router=express[_0x302d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x302d('0x5'));var config=require(_0x302d('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x302d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x302d('0x7')](_0x302d('0x8'),auth['isAuthenticated'](),controller[_0x302d('0x9')]);router['post']('/',auth[_0x302d('0xa')](),controller[_0x302d('0xb')]);router[_0x302d('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x302d('0xd')]);router[_0x302d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x302d('0xf')]);module[_0x302d('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1980112..1ff0cbe 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 _0x9ade=['exports','STRING','sequelize'];(function(_0x4a5460,_0x1f18d2){var _0x554d80=function(_0x1c19d6){while(--_0x1c19d6){_0x4a5460['push'](_0x4a5460['shift']());}};_0x554d80(++_0x1f18d2);}(_0x9ade,0x107));var _0xe9ad=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x9ade[_0x1d128e];return _0x3d5236;};'use strict';var Sequelize=require(_0xe9ad('0x0'));module[_0xe9ad('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe9ad('0x2')]}}; \ No newline at end of file +var _0x1f63=['exports','STRING','sequelize'];(function(_0x3fb166,_0x4eb985){var _0x5e91be=function(_0x53f4d9){while(--_0x53f4d9){_0x3fb166['push'](_0x3fb166['shift']());}};_0x5e91be(++_0x4eb985);}(_0x1f63,0x7a));var _0x31f6=function(_0x3e0d1c,_0x55827f){_0x3e0d1c=_0x3e0d1c-0x0;var _0x2a9944=_0x1f63[_0x3e0d1c];return _0x2a9944;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x31f6('0x2')]},'type':{'type':Sequelize[_0x31f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4e438ad..74b239b 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 _0xda61=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','then','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','clone','include','omit','createdAt','updatedAt','body','create','update','find','destroy','basename','file','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xda61,0xf6));var _0x1da6=function(_0x1c421a,_0x25363c){_0x1c421a=_0x1c421a-0x0;var _0x314869=_0xda61[_0x1c421a];return _0x314869;};'use strict';var emlformat=require(_0x1da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1da6('0x1'));var jsonpatch=require(_0x1da6('0x2'));var rp=require(_0x1da6('0x3'));var moment=require('moment');var BPromise=require(_0x1da6('0x4'));var Mustache=require(_0x1da6('0x5'));var util=require(_0x1da6('0x6'));var path=require(_0x1da6('0x7'));var sox=require('sox');var csv=require(_0x1da6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1da6('0x9'));var _=require(_0x1da6('0xa'));var squel=require(_0x1da6('0xb'));var crypto=require(_0x1da6('0xc'));var jsforce=require(_0x1da6('0xd'));var deskjs=require(_0x1da6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1da6('0xf'));var Papa=require('papaparse');var Redis=require(_0x1da6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1da6('0x11'));var as=require(_0x1da6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1da6('0x13'));var utils=require(_0x1da6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1da6('0x15'))['db'];function respondWithStatusCode(_0x253c0d,_0x22b87e){_0x22b87e=_0x22b87e||0xcc;return function(_0x2c7c8b){if(_0x2c7c8b){return _0x253c0d[_0x1da6('0x16')](_0x22b87e);}return _0x253c0d['status'](_0x22b87e)[_0x1da6('0x17')]();};}function respondWithResult(_0x4ef0c6,_0x2e11d7){_0x2e11d7=_0x2e11d7||0xc8;return function(_0x33363b){if(_0x33363b){return _0x4ef0c6[_0x1da6('0x18')](_0x2e11d7)['json'](_0x33363b);}};}function respondWithFilteredResult(_0x24bb19,_0x928ad5){return function(_0x30f95d){if(_0x30f95d){var _0x573193=typeof _0x928ad5[_0x1da6('0x19')]===_0x1da6('0x1a')&&typeof _0x928ad5[_0x1da6('0x1b')]===_0x1da6('0x1a');var _0x367d05=_0x30f95d[_0x1da6('0x1c')];var _0x3ce2aa=_0x573193?0x0:_0x928ad5[_0x1da6('0x19')];var _0x35137e=_0x573193?_0x30f95d['count']:_0x928ad5['offset']+_0x928ad5[_0x1da6('0x1b')];var _0x205236;if(_0x35137e>=_0x367d05){_0x35137e=_0x367d05;_0x205236=0xc8;}else{_0x205236=0xce;}_0x24bb19[_0x1da6('0x18')](_0x205236);return _0x24bb19[_0x1da6('0x1d')]('Content-Range',_0x3ce2aa+'-'+_0x35137e+'/'+_0x367d05)[_0x1da6('0x1e')](_0x30f95d);}return null;};}function patchUpdates(_0x5c0036){return function(_0x18079e){try{jsonpatch[_0x1da6('0x1f')](_0x18079e,_0x5c0036,!![]);}catch(_0x180737){return BPromise[_0x1da6('0x20')](_0x180737);}return _0x18079e[_0x1da6('0x21')]();};}function saveUpdates(_0x3bdb0f,_0x568931){return function(_0x497b57){if(_0x497b57){return _0x497b57['update'](_0x3bdb0f)[_0x1da6('0x22')](function(_0x2c589b){return _0x2c589b;});}return null;};}function removeEntity(_0x4fc383,_0x57619f){return function(_0x2a53b3){if(_0x2a53b3){return _0x2a53b3['destroy']()['then'](function(){_0x4fc383[_0x1da6('0x18')](0xcc)[_0x1da6('0x17')]();});}};}function handleEntityNotFound(_0x187f8d,_0x184c82){return function(_0x4e9cce){if(!_0x4e9cce){_0x187f8d['sendStatus'](0x194);}return _0x4e9cce;};}function handleError(_0x5179fe,_0x440c87){_0x440c87=_0x440c87||0x1f4;return function(_0x2a8cda){logger[_0x1da6('0x23')](_0x2a8cda[_0x1da6('0x24')]);if(_0x2a8cda[_0x1da6('0x25')]){delete _0x2a8cda['name'];}_0x5179fe[_0x1da6('0x18')](_0x440c87)[_0x1da6('0x26')](_0x2a8cda);};}exports[_0x1da6('0x27')]=function(_0x153aa2,_0x55c035){var _0x2d9223={},_0x169638={},_0x54037f={'count':0x0,'rows':[]};var _0x330942=_['map'](db[_0x1da6('0x28')][_0x1da6('0x29')],function(_0xea19f8){return{'name':_0xea19f8[_0x1da6('0x2a')],'type':_0xea19f8[_0x1da6('0x2b')]['key']};});_0x169638['model']=_[_0x1da6('0x2c')](_0x330942,_0x1da6('0x25'));_0x169638[_0x1da6('0x2d')]=_[_0x1da6('0x2e')](_0x153aa2['query']);_0x169638[_0x1da6('0x2f')]=_[_0x1da6('0x30')](_0x169638[_0x1da6('0x31')],_0x169638['query']);_0x2d9223[_0x1da6('0x32')]=_['intersection'](_0x169638[_0x1da6('0x31')],qs[_0x1da6('0x33')](_0x153aa2[_0x1da6('0x2d')][_0x1da6('0x33')]));_0x2d9223[_0x1da6('0x32')]=_0x2d9223[_0x1da6('0x32')][_0x1da6('0x34')]?_0x2d9223[_0x1da6('0x32')]:_0x169638[_0x1da6('0x31')];if(!_0x153aa2['query']['hasOwnProperty'](_0x1da6('0x35'))){_0x2d9223['limit']=qs[_0x1da6('0x1b')](_0x153aa2[_0x1da6('0x2d')][_0x1da6('0x1b')]);_0x2d9223['offset']=qs[_0x1da6('0x19')](_0x153aa2[_0x1da6('0x2d')][_0x1da6('0x19')]);}_0x2d9223[_0x1da6('0x36')]=qs[_0x1da6('0x37')](_0x153aa2[_0x1da6('0x2d')][_0x1da6('0x37')]);_0x2d9223[_0x1da6('0x38')]=qs[_0x1da6('0x2f')](_['pick'](_0x153aa2[_0x1da6('0x2d')],_0x169638['filters']),_0x330942);if(_0x153aa2['query'][_0x1da6('0x39')]){_0x2d9223[_0x1da6('0x38')]=_[_0x1da6('0x3a')](_0x2d9223[_0x1da6('0x38')],{'$or':_[_0x1da6('0x2c')](_0x330942,function(_0x29d72f){if(_0x29d72f[_0x1da6('0x2b')]!==_0x1da6('0x3b')){var _0x17d2b3={};_0x17d2b3[_0x29d72f[_0x1da6('0x25')]]={'$like':'%'+_0x153aa2['query'][_0x1da6('0x39')]+'%'};return _0x17d2b3;}})});}_0x2d9223=_[_0x1da6('0x3a')]({},_0x2d9223,_0x153aa2['options']);var _0x3b617c={'where':_0x2d9223[_0x1da6('0x38')]};return db[_0x1da6('0x28')][_0x1da6('0x1c')](_0x3b617c)['then'](function(_0x3ca006){_0x54037f[_0x1da6('0x1c')]=_0x3ca006;if(_0x153aa2['query'][_0x1da6('0x3c')]){_0x2d9223['include']=[{'all':!![]}];}return db[_0x1da6('0x28')][_0x1da6('0x3d')](_0x2d9223);})[_0x1da6('0x22')](function(_0x51c008){_0x54037f[_0x1da6('0x3e')]=_0x51c008;return _0x54037f;})[_0x1da6('0x22')](respondWithFilteredResult(_0x55c035,_0x2d9223))[_0x1da6('0x3f')](handleError(_0x55c035,null));};exports[_0x1da6('0x40')]=function(_0x141ae9,_0x37f22e){var _0xfba861={'raw':!![],'where':{'id':_0x141ae9[_0x1da6('0x41')]['id']}},_0x7455af={};_0x7455af['model']=_[_0x1da6('0x2e')](db[_0x1da6('0x28')][_0x1da6('0x29')]);_0x7455af[_0x1da6('0x2d')]=_[_0x1da6('0x2e')](_0x141ae9[_0x1da6('0x2d')]);_0x7455af['filters']=_[_0x1da6('0x30')](_0x7455af[_0x1da6('0x31')],_0x7455af[_0x1da6('0x2d')]);_0xfba861[_0x1da6('0x32')]=_['intersection'](_0x7455af[_0x1da6('0x31')],qs[_0x1da6('0x33')](_0x141ae9[_0x1da6('0x2d')][_0x1da6('0x33')]));_0xfba861[_0x1da6('0x32')]=_0xfba861[_0x1da6('0x32')][_0x1da6('0x34')]?_0xfba861[_0x1da6('0x32')]:_0x7455af[_0x1da6('0x31')];if(_0x141ae9[_0x1da6('0x2d')]['includeAll']){_0xfba861['include']=[{'all':!![]}];}_0xfba861=_[_0x1da6('0x3a')]({},_0xfba861,_0x141ae9['options']);return db[_0x1da6('0x28')]['find'](_0xfba861)[_0x1da6('0x22')](handleEntityNotFound(_0x37f22e,null))[_0x1da6('0x22')](respondWithResult(_0x37f22e,null))['catch'](handleError(_0x37f22e,null));};exports[_0x1da6('0x42')]=function(_0x110a27,_0x4454fc){var _0x2d8076={'where':{'id':_0x110a27['params']['id']}},_0x183a93={};_0x183a93[_0x1da6('0x31')]=_[_0x1da6('0x2e')](db[_0x1da6('0x28')][_0x1da6('0x29')]);_0x2d8076['attributes']=_[_0x1da6('0x30')](_0x183a93[_0x1da6('0x31')],qs[_0x1da6('0x33')](_0x110a27[_0x1da6('0x2d')]['fields']));_0x2d8076[_0x1da6('0x32')]=_0x2d8076[_0x1da6('0x32')][_0x1da6('0x34')]?_0x2d8076[_0x1da6('0x32')]:_0x183a93[_0x1da6('0x31')];if(_0x110a27['query']['includeAll']){_0x2d8076[_0x1da6('0x43')]=[{'all':!![]}];}_0x2d8076=_['merge']({},_0x2d8076,_0x110a27['options']);return db[_0x1da6('0x28')]['find'](_0x2d8076)[_0x1da6('0x22')](handleEntityNotFound(_0x4454fc,null))[_0x1da6('0x22')](function(_0x299c36){if(_0x299c36){var _0x3debad=_0x299c36['get']({'plain':!![]});_0x3debad=qs[_0x1da6('0x44')](_0x3debad,['id',_0x1da6('0x45'),_0x1da6('0x46')]);_0x110a27['body']=_[_0x1da6('0x44')](_0x110a27[_0x1da6('0x47')],['id',_0x1da6('0x45'),_0x1da6('0x46')]);return db[_0x1da6('0x28')][_0x1da6('0x48')](_[_0x1da6('0x3a')](_0x3debad,_0x110a27['body']),{'include':_0x110a27[_0x1da6('0x2d')][_0x1da6('0x3c')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4454fc,0xc9))[_0x1da6('0x3f')](handleError(_0x4454fc,null));};exports[_0x1da6('0x49')]=function(_0x5224d8,_0x3c293e){if(_0x5224d8[_0x1da6('0x47')]['id']){delete _0x5224d8['body']['id'];}return db[_0x1da6('0x28')][_0x1da6('0x4a')]({'where':{'id':_0x5224d8[_0x1da6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c293e,null))['then'](saveUpdates(_0x5224d8[_0x1da6('0x47')],null))[_0x1da6('0x22')](respondWithResult(_0x3c293e,null))[_0x1da6('0x3f')](handleError(_0x3c293e,null));};exports[_0x1da6('0x4b')]=function(_0x4c1b6d,_0xdde2f2){return db['Attachment'][_0x1da6('0x4a')]({'where':{'id':_0x4c1b6d[_0x1da6('0x41')]['id']}})[_0x1da6('0x22')](handleEntityNotFound(_0xdde2f2,null))['then'](removeEntity(_0xdde2f2,null))[_0x1da6('0x3f')](handleError(_0xdde2f2,null));};exports[_0x1da6('0x48')]=function(_0x4b0c8a,_0x2af69e,_0x3252d9){_0x4b0c8a['body'][_0x1da6('0x25')]=_0x4b0c8a['file']['originalname'];_0x4b0c8a[_0x1da6('0x47')][_0x1da6('0x4c')]=_0x4b0c8a[_0x1da6('0x4d')]['filename'];_0x4b0c8a[_0x1da6('0x47')][_0x1da6('0x2b')]=_0x4b0c8a[_0x1da6('0x4d')][_0x1da6('0x4e')];return db[_0x1da6('0x28')][_0x1da6('0x48')](_0x4b0c8a['body'])[_0x1da6('0x22')](respondWithResult(_0x2af69e,0xc9))['catch'](handleError(_0x2af69e,null));};exports[_0x1da6('0x4f')]=function(_0x48124a,_0x57b10f,_0x413496){return db[_0x1da6('0x28')]['findOne']({'where':{'id':_0x48124a[_0x1da6('0x41')]['id']},'raw':!![]})[_0x1da6('0x22')](handleEntityNotFound(_0x57b10f,null))[_0x1da6('0x22')](function(_0x4235c1){if(_0x4235c1){var _0x35c136=_0x4235c1[_0x1da6('0x50')]!==null;var _0x1b54e7=path[_0x1da6('0x51')](config[_0x1da6('0x52')],_0x1da6('0x53'));if(_0x35c136){_0x1b54e7=path[_0x1da6('0x51')](_0x1b54e7,'offline-chat/');}var _0x2ec377=path['join'](_0x1b54e7,_0x4235c1[_0x1da6('0x4c')]);return _0x57b10f[_0x1da6('0x4f')](_0x2ec377);}})[_0x1da6('0x3f')](handleError(_0x57b10f,null));}; \ No newline at end of file +var _0xb57a=['get','omit','createdAt','updatedAt','body','create','originalname','basename','file','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','include','findAll','then','catch','show','params','length','includeAll','options','find'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb57a,0xb7));var _0xab57=function(_0x32e3db,_0xf88949){_0x32e3db=_0x32e3db-0x0;var _0x5d170d=_0xb57a[_0x32e3db];return _0x5d170d;};'use strict';var emlformat=require(_0xab57('0x0'));var rimraf=require(_0xab57('0x1'));var zipdir=require(_0xab57('0x2'));var jsonpatch=require(_0xab57('0x3'));var rp=require(_0xab57('0x4'));var moment=require(_0xab57('0x5'));var BPromise=require(_0xab57('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab57('0x7'));var sox=require(_0xab57('0x8'));var csv=require(_0xab57('0x9'));var ejs=require(_0xab57('0xa'));var fs=require('fs');var fs_extra=require(_0xab57('0xb'));var _=require(_0xab57('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab57('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab57('0xe'));var Redis=require(_0xab57('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab57('0x11'))(_0xab57('0x12'));var utils=require('../../config/utils');var config=require(_0xab57('0x13'));var licenseUtil=require(_0xab57('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc1d5,_0x15c33d){_0x15c33d=_0x15c33d||0xcc;return function(_0x56fc76){if(_0x56fc76){return _0x1dc1d5[_0xab57('0x15')](_0x15c33d);}return _0x1dc1d5[_0xab57('0x16')](_0x15c33d)[_0xab57('0x17')]();};}function respondWithResult(_0x5d771a,_0x5e00c0){_0x5e00c0=_0x5e00c0||0xc8;return function(_0x548d07){if(_0x548d07){return _0x5d771a[_0xab57('0x16')](_0x5e00c0)[_0xab57('0x18')](_0x548d07);}};}function respondWithFilteredResult(_0x5bef1c,_0x5bd9f4){return function(_0x39361d){if(_0x39361d){var _0x1e78f8=typeof _0x5bd9f4[_0xab57('0x19')]===_0xab57('0x1a')&&typeof _0x5bd9f4['limit']===_0xab57('0x1a');var _0x38abdd=_0x39361d[_0xab57('0x1b')];var _0x5122f4=_0x1e78f8?0x0:_0x5bd9f4[_0xab57('0x19')];var _0x1727cd=_0x1e78f8?_0x39361d[_0xab57('0x1b')]:_0x5bd9f4['offset']+_0x5bd9f4[_0xab57('0x1c')];var _0x123b3d;if(_0x1727cd>=_0x38abdd){_0x1727cd=_0x38abdd;_0x123b3d=0xc8;}else{_0x123b3d=0xce;}_0x5bef1c[_0xab57('0x16')](_0x123b3d);return _0x5bef1c['set'](_0xab57('0x1d'),_0x5122f4+'-'+_0x1727cd+'/'+_0x38abdd)[_0xab57('0x18')](_0x39361d);}return null;};}function patchUpdates(_0x3dcd35){return function(_0x25b24d){try{jsonpatch[_0xab57('0x1e')](_0x25b24d,_0x3dcd35,!![]);}catch(_0x4601bb){return BPromise[_0xab57('0x1f')](_0x4601bb);}return _0x25b24d[_0xab57('0x20')]();};}function saveUpdates(_0x4f60e1,_0x1617dd){return function(_0x1682af){if(_0x1682af){return _0x1682af[_0xab57('0x21')](_0x4f60e1)['then'](function(_0x4badff){return _0x4badff;});}return null;};}function removeEntity(_0x3df3d3,_0x4d531f){return function(_0x3e6c0d){if(_0x3e6c0d){return _0x3e6c0d[_0xab57('0x22')]()['then'](function(){_0x3df3d3['status'](0xcc)[_0xab57('0x17')]();});}};}function handleEntityNotFound(_0x425deb,_0xd81f13){return function(_0x1a983a){if(!_0x1a983a){_0x425deb[_0xab57('0x15')](0x194);}return _0x1a983a;};}function handleError(_0x8c0952,_0x9977c7){_0x9977c7=_0x9977c7||0x1f4;return function(_0x2982ec){logger[_0xab57('0x23')](_0x2982ec[_0xab57('0x24')]);if(_0x2982ec[_0xab57('0x25')]){delete _0x2982ec[_0xab57('0x25')];}_0x8c0952[_0xab57('0x16')](_0x9977c7)['send'](_0x2982ec);};}exports['index']=function(_0x1e1ac1,_0x2edd12){var _0x281b51={},_0x127d7b={},_0x43174f={'count':0x0,'rows':[]};var _0x1977db=_['map'](db[_0xab57('0x26')][_0xab57('0x27')],function(_0x2565ed){return{'name':_0x2565ed[_0xab57('0x28')],'type':_0x2565ed[_0xab57('0x29')]['key']};});_0x127d7b[_0xab57('0x2a')]=_['map'](_0x1977db,_0xab57('0x25'));_0x127d7b[_0xab57('0x2b')]=_[_0xab57('0x2c')](_0x1e1ac1[_0xab57('0x2b')]);_0x127d7b[_0xab57('0x2d')]=_[_0xab57('0x2e')](_0x127d7b['model'],_0x127d7b['query']);_0x281b51[_0xab57('0x2f')]=_['intersection'](_0x127d7b['model'],qs[_0xab57('0x30')](_0x1e1ac1['query']['fields']));_0x281b51['attributes']=_0x281b51['attributes']['length']?_0x281b51[_0xab57('0x2f')]:_0x127d7b['model'];if(!_0x1e1ac1[_0xab57('0x2b')][_0xab57('0x31')]('nolimit')){_0x281b51[_0xab57('0x1c')]=qs[_0xab57('0x1c')](_0x1e1ac1[_0xab57('0x2b')][_0xab57('0x1c')]);_0x281b51[_0xab57('0x19')]=qs['offset'](_0x1e1ac1[_0xab57('0x2b')][_0xab57('0x19')]);}_0x281b51[_0xab57('0x32')]=qs[_0xab57('0x33')](_0x1e1ac1[_0xab57('0x2b')]['sort']);_0x281b51[_0xab57('0x34')]=qs[_0xab57('0x2d')](_['pick'](_0x1e1ac1[_0xab57('0x2b')],_0x127d7b[_0xab57('0x2d')]),_0x1977db);if(_0x1e1ac1[_0xab57('0x2b')]['filter']){_0x281b51[_0xab57('0x34')]=_[_0xab57('0x35')](_0x281b51[_0xab57('0x34')],{'$or':_[_0xab57('0x36')](_0x1977db,function(_0x2d9f56){if(_0x2d9f56['type']!==_0xab57('0x37')){var _0x333140={};_0x333140[_0x2d9f56['name']]={'$like':'%'+_0x1e1ac1['query']['filter']+'%'};return _0x333140;}})});}_0x281b51=_['merge']({},_0x281b51,_0x1e1ac1['options']);var _0x52b056={'where':_0x281b51[_0xab57('0x34')]};return db['Attachment']['count'](_0x52b056)['then'](function(_0xa37686){_0x43174f[_0xab57('0x1b')]=_0xa37686;if(_0x1e1ac1[_0xab57('0x2b')]['includeAll']){_0x281b51[_0xab57('0x38')]=[{'all':!![]}];}return db[_0xab57('0x26')][_0xab57('0x39')](_0x281b51);})[_0xab57('0x3a')](function(_0x5481a8){_0x43174f['rows']=_0x5481a8;return _0x43174f;})[_0xab57('0x3a')](respondWithFilteredResult(_0x2edd12,_0x281b51))[_0xab57('0x3b')](handleError(_0x2edd12,null));};exports[_0xab57('0x3c')]=function(_0x236be9,_0xadd65b){var _0x2fd064={'raw':!![],'where':{'id':_0x236be9[_0xab57('0x3d')]['id']}},_0x392456={};_0x392456[_0xab57('0x2a')]=_['keys'](db[_0xab57('0x26')][_0xab57('0x27')]);_0x392456[_0xab57('0x2b')]=_['keys'](_0x236be9[_0xab57('0x2b')]);_0x392456[_0xab57('0x2d')]=_[_0xab57('0x2e')](_0x392456[_0xab57('0x2a')],_0x392456['query']);_0x2fd064[_0xab57('0x2f')]=_[_0xab57('0x2e')](_0x392456[_0xab57('0x2a')],qs[_0xab57('0x30')](_0x236be9['query'][_0xab57('0x30')]));_0x2fd064[_0xab57('0x2f')]=_0x2fd064[_0xab57('0x2f')][_0xab57('0x3e')]?_0x2fd064[_0xab57('0x2f')]:_0x392456[_0xab57('0x2a')];if(_0x236be9[_0xab57('0x2b')][_0xab57('0x3f')]){_0x2fd064['include']=[{'all':!![]}];}_0x2fd064=_['merge']({},_0x2fd064,_0x236be9[_0xab57('0x40')]);return db[_0xab57('0x26')][_0xab57('0x41')](_0x2fd064)[_0xab57('0x3a')](handleEntityNotFound(_0xadd65b,null))['then'](respondWithResult(_0xadd65b,null))[_0xab57('0x3b')](handleError(_0xadd65b,null));};exports['clone']=function(_0x409c74,_0x11df28){var _0x49c244={'where':{'id':_0x409c74['params']['id']}},_0x552e92={};_0x552e92[_0xab57('0x2a')]=_[_0xab57('0x2c')](db[_0xab57('0x26')][_0xab57('0x27')]);_0x49c244['attributes']=_[_0xab57('0x2e')](_0x552e92['model'],qs[_0xab57('0x30')](_0x409c74[_0xab57('0x2b')]['fields']));_0x49c244['attributes']=_0x49c244['attributes'][_0xab57('0x3e')]?_0x49c244[_0xab57('0x2f')]:_0x552e92[_0xab57('0x2a')];if(_0x409c74[_0xab57('0x2b')][_0xab57('0x3f')]){_0x49c244[_0xab57('0x38')]=[{'all':!![]}];}_0x49c244=_[_0xab57('0x35')]({},_0x49c244,_0x409c74[_0xab57('0x40')]);return db[_0xab57('0x26')][_0xab57('0x41')](_0x49c244)['then'](handleEntityNotFound(_0x11df28,null))[_0xab57('0x3a')](function(_0x425050){if(_0x425050){var _0x1da3ba=_0x425050[_0xab57('0x42')]({'plain':!![]});_0x1da3ba=qs[_0xab57('0x43')](_0x1da3ba,['id',_0xab57('0x44'),_0xab57('0x45')]);_0x409c74[_0xab57('0x46')]=_[_0xab57('0x43')](_0x409c74[_0xab57('0x46')],['id',_0xab57('0x44'),_0xab57('0x45')]);return db[_0xab57('0x26')][_0xab57('0x47')](_['merge'](_0x1da3ba,_0x409c74[_0xab57('0x46')]),{'include':_0x409c74[_0xab57('0x2b')][_0xab57('0x3f')]?[{'all':!![]}]:undefined});}})[_0xab57('0x3a')](respondWithResult(_0x11df28,0xc9))[_0xab57('0x3b')](handleError(_0x11df28,null));};exports[_0xab57('0x21')]=function(_0x289b4d,_0x58ddb2){if(_0x289b4d['body']['id']){delete _0x289b4d['body']['id'];}return db[_0xab57('0x26')]['find']({'where':{'id':_0x289b4d[_0xab57('0x3d')]['id']}})['then'](handleEntityNotFound(_0x58ddb2,null))[_0xab57('0x3a')](saveUpdates(_0x289b4d[_0xab57('0x46')],null))[_0xab57('0x3a')](respondWithResult(_0x58ddb2,null))[_0xab57('0x3b')](handleError(_0x58ddb2,null));};exports[_0xab57('0x22')]=function(_0x54ec38,_0x2dffe6){return db[_0xab57('0x26')][_0xab57('0x41')]({'where':{'id':_0x54ec38[_0xab57('0x3d')]['id']}})[_0xab57('0x3a')](handleEntityNotFound(_0x2dffe6,null))[_0xab57('0x3a')](removeEntity(_0x2dffe6,null))['catch'](handleError(_0x2dffe6,null));};exports['create']=function(_0x449c07,_0x339917,_0x43c36f){_0x449c07[_0xab57('0x46')][_0xab57('0x25')]=_0x449c07['file'][_0xab57('0x48')];_0x449c07[_0xab57('0x46')][_0xab57('0x49')]=_0x449c07['file']['filename'];_0x449c07[_0xab57('0x46')][_0xab57('0x29')]=_0x449c07[_0xab57('0x4a')][_0xab57('0x4b')];return db[_0xab57('0x26')][_0xab57('0x47')](_0x449c07[_0xab57('0x46')])['then'](respondWithResult(_0x339917,0xc9))[_0xab57('0x3b')](handleError(_0x339917,null));};exports[_0xab57('0x4c')]=function(_0x3bf251,_0x4434d5,_0x33f286){return db[_0xab57('0x26')][_0xab57('0x4d')]({'where':{'id':_0x3bf251['params']['id']},'raw':!![]})[_0xab57('0x3a')](handleEntityNotFound(_0x4434d5,null))['then'](function(_0x3f4e92){if(_0x3f4e92){var _0x25826b=_0x3f4e92[_0xab57('0x4e')]!==null;var _0x14fa13=path['join'](config[_0xab57('0x4f')],_0xab57('0x50'));if(_0x25826b){_0x14fa13=path[_0xab57('0x51')](_0x14fa13,_0xab57('0x52'));}var _0x1a5a54=path[_0xab57('0x51')](_0x14fa13,_0x3f4e92[_0xab57('0x49')]);return _0x4434d5['download'](_0x1a5a54);}})[_0xab57('0x3b')](handleError(_0x4434d5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 907f5bf..a16a9c8 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 _0x59d6=['moment','path','../../config/environment','exports','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x3727ae,_0x165f88){var _0x1c3f01=function(_0x5cd5a5){while(--_0x5cd5a5){_0x3727ae['push'](_0x3727ae['shift']());}};_0x1c3f01(++_0x165f88);}(_0x59d6,0x10a));var _0x659d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x59d6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x659d('0x0'));var util=require(_0x659d('0x1'));var logger=require(_0x659d('0x2'))(_0x659d('0x3'));var moment=require(_0x659d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x659d('0x5'));var rimraf=require('rimraf');var config=require(_0x659d('0x6'));var attributes=require('./attachment.attributes');module[_0x659d('0x7')]=function(_0x4323c0,_0x32f2a7){return _0x4323c0['define'](_0x659d('0x8'),attributes,{'tableName':_0x659d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa911=['./attachment.attributes','exports','define','attachments','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x54d0c1,_0x21e4e5){var _0x58eef2=function(_0xed3b0b){while(--_0xed3b0b){_0x54d0c1['push'](_0x54d0c1['shift']());}};_0x58eef2(++_0x21e4e5);}(_0xa911,0x1c7));var _0x1a91=function(_0x223487,_0x357a09){_0x223487=_0x223487-0x0;var _0x4b0a8b=_0xa911[_0x223487];return _0x4b0a8b;};'use strict';var _=require(_0x1a91('0x0'));var util=require('util');var logger=require(_0x1a91('0x1'))(_0x1a91('0x2'));var moment=require('moment');var BPromise=require(_0x1a91('0x3'));var rp=require(_0x1a91('0x4'));var fs=require('fs');var path=require(_0x1a91('0x5'));var rimraf=require(_0x1a91('0x6'));var config=require('../../config/environment');var attributes=require(_0x1a91('0x7'));module[_0x1a91('0x8')]=function(_0x1e8fb3,_0x1ab45e){return _0x1e8fb3[_0x1a91('0x9')]('Attachment',attributes,{'tableName':_0x1a91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 7e2dce4..a1d5624 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 _0xeddd=['../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateAttachment','Attachment','create','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0xeddd,0x69));var _0xdedd=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xeddd[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var moment=require(_0xdedd('0x2'));var BPromise=require(_0xdedd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdedd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdedd('0x5'));var logger=require(_0xdedd('0x6'))('rpc');var config=require(_0xdedd('0x7'));var jayson=require(_0xdedd('0x8'));var client=jayson[_0xdedd('0x9')][_0xdedd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x102b00,_0x41d72f,_0x2aa946){return new BPromise(function(_0x260839,_0x3cc017){return client[_0xdedd('0xb')](_0x102b00,_0x2aa946)[_0xdedd('0xc')](function(_0x429585){logger['info'](_0xdedd('0xd'),_0x41d72f,_0xdedd('0xe'));logger[_0xdedd('0xf')](_0xdedd('0x10'),_0x41d72f,'request\x20sent',JSON[_0xdedd('0x11')](_0x429585));if(_0x429585[_0xdedd('0x12')]){if(_0x429585[_0xdedd('0x12')][_0xdedd('0x13')]===0x1f4){logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);return _0x3cc017(_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);}logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);return _0x260839(_0x429585[_0xdedd('0x12')][_0xdedd('0x14')]);}else{logger[_0xdedd('0x15')](_0xdedd('0xd'),_0x41d72f,_0xdedd('0xe'));_0x260839(_0x429585['result'][_0xdedd('0x14')]);}})[_0xdedd('0x16')](function(_0x588ce7){logger[_0xdedd('0x12')](_0xdedd('0xd'),_0x41d72f,_0x588ce7);_0x3cc017(_0x588ce7);});});}exports[_0xdedd('0x17')]=function(_0x4b16bb){var _0x43611b=this;return new Promise(function(_0x24e331,_0x4054b0){return db[_0xdedd('0x18')][_0xdedd('0x19')](_0x4b16bb['body'],{'raw':_0x4b16bb[_0xdedd('0x1a')]?_0x4b16bb[_0xdedd('0x1a')][_0xdedd('0x1b')]===undefined?!![]:![]:!![]})[_0xdedd('0xc')](function(_0x1213d6){logger[_0xdedd('0x15')](_0xdedd('0x17'),_0x4b16bb);logger[_0xdedd('0xf')](_0xdedd('0x17'),_0x4b16bb,JSON['stringify'](_0x1213d6));_0x24e331(_0x1213d6);})['catch'](function(_0x538dc1){logger['error'](_0xdedd('0x17'),_0x538dc1[_0xdedd('0x14')],_0x4b16bb);_0x4054b0(_0x43611b[_0xdedd('0x12')](0x1f4,_0x538dc1[_0xdedd('0x14')]));});});}; \ No newline at end of file +var _0xf4eb=['../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateAttachment','Attachment','create','body','raw','lodash','ioredis','../../config/logger','rpc'];(function(_0x5e0524,_0x34ae3a){var _0x98e31a=function(_0x3c5eca){while(--_0x3c5eca){_0x5e0524['push'](_0x5e0524['shift']());}};_0x98e31a(++_0x34ae3a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x382db5,_0x3d2ecf){_0x382db5=_0x382db5-0x0;var _0x8e9eb2=_0xf4eb[_0x382db5];return _0x8e9eb2;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('Attachment,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')](_0x577c27[_0xbf4e('0x16')],{'raw':_0x577c27['options']?_0x577c27['options'][_0xbf4e('0x17')]===undefined?!![]:![]:!![]})[_0xbf4e('0x9')](function(_0x3be138){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger[_0xbf4e('0xd')](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x3be138));_0x566ec3(_0x3be138);})[_0xbf4e('0x12')](function(_0x376832){logger[_0xbf4e('0xf')]('CreateAttachment',_0x376832[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x376832['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f531ec0..31fa4b7 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x214353,_0x4cfa98){var _0x2ad9f2=function(_0x54eec8){while(--_0x54eec8){_0x214353['push'](_0x214353['shift']());}};_0x2ad9f2(++_0x4cfa98);}(_0x757a,0xde));var _0xa757=function(_0x508cc1,_0x46d674){_0x508cc1=_0x508cc1-0x0;var _0x4d6d44=_0x757a[_0x508cc1];return _0x4d6d44;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x247759,_0x41079e){var _0x2136da=function(_0x5eca98){while(--_0x5eca98){_0x247759['push'](_0x247759['shift']());}};_0x2136da(++_0x41079e);}(_0x757a,0xde));var _0xa757=function(_0x4d93f1,_0x38be1c){_0x4d93f1=_0x4d93f1-0x0;var _0x517753=_0x757a[_0x4d93f1];return _0x517753;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index c27bfae..dfab62b 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3747=['online','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0x3747,0x198));var _0x7374=function(_0xa9a962,_0x527c23){_0xa9a962=_0xa9a962-0x0;var _0xde5975=_0x3747[_0xa9a962];return _0xde5975;};'use strict';var passport=require(_0x7374('0x0'));var LocalStrategy=require(_0x7374('0x1'))[_0x7374('0x2')];var moment=require(_0x7374('0x3'));var ActiveDirectory=require(_0x7374('0x4'));var BPromise=require(_0x7374('0x5'));var util=require(_0x7374('0x6'));var db=require(_0x7374('0x7'))['db'];var authService=require(_0x7374('0x8'));var utils=require(_0x7374('0x9'));var config=require(_0x7374('0xa'));var logger=require('../../config/logger')(_0x7374('0xb'));function isActiveDirectoryConfigured(_0x1f17e2){var _0x4a1b67=![];if(typeof _0x1f17e2[_0x7374('0xc')]!==_0x7374('0xd')){_0x4a1b67=_0x1f17e2[_0x7374('0xc')][_0x7374('0xe')]&&_0x1f17e2['activedirectory']['url']&&_0x1f17e2['activedirectory'][_0x7374('0xf')];}return _0x4a1b67;}function adAuthenticate(_0x222c4b,_0x455463,_0x1da586){return new BPromise(function(_0x1385ed,_0x462581){try{var _0x4c3ea3=new ActiveDirectory(_0x222c4b);_0x4c3ea3[_0x7374('0x10')](_0x455463,_0x1da586,function(_0x3f6dbf,_0x4563c5){if(_0x3f6dbf){logger[_0x7374('0x11')](_0x7374('0x12'),_0x455463,util['inspect'](_0x3f6dbf,{'showHidden':![],'depth':null}));_0x462581(_0x7374('0x13'));}else if(!_0x4563c5){logger[_0x7374('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x455463);_0x462581(_0x7374('0x13'));}else{_0x1385ed(_0x4563c5);}});}catch(_0x142fc1){_0x462581(_0x142fc1);}});}function ActiveDirectoryAuthenticate(_0x754fb6,_0x5ccc61,_0x5b9c4b,_0x35d8e7){var _0x4f69b5,_0x481c1b;if(!isActiveDirectoryConfigured(config)){logger[_0x7374('0x11')](_0x7374('0x14'),_0x5ccc61);return _0x35d8e7(null,![],{'message':_0x7374('0x13')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7374('0x15')],'raw':!![]})[_0x7374('0x16')](function(_0x1d9343){_0x4f69b5=_0x1d9343;if(!_0x4f69b5[_0x7374('0x17')]){logger[_0x7374('0x11')](_0x7374('0x18'),_0x5ccc61);throw new Error(_0x7374('0x13'));}return _0x754fb6[_0x7374('0x19')]({'logging':!![],'attributes':['id',_0x7374('0x1a'),_0x7374('0x1b'),_0x7374('0x1c'),_0x7374('0x1d'),_0x7374('0x1e'),_0x7374('0x1f'),_0x7374('0x20'),_0x7374('0x21')],'where':{'name':_0x5ccc61,'role':{'$or':[_0x7374('0x22'),_0x7374('0x23'),_0x7374('0x24')]},'adSsoEnabled':!![]}});})[_0x7374('0x16')](function(_0x5a39f9){if(!_0x5a39f9||_0x5a39f9&&_0x5a39f9[_0x7374('0x1a')]!==_0x5ccc61){throw new Error(_0x7374('0x13'));}_0x481c1b=_0x5a39f9;var _0x5c56f6=_0x481c1b[_0x7374('0x1a')]+'@'+config[_0x7374('0xc')][_0x7374('0xf')];return adAuthenticate(config[_0x7374('0xc')],_0x5c56f6,_0x5b9c4b);})[_0x7374('0x16')](function(_0x90a818){if(_0x481c1b[_0x7374('0x1e')]){throw new Error(_0x7374('0x13'));}if(_0x4f69b5[_0x7374('0x15')]>0x0){if(_0x481c1b['blocked']){if(moment(_0x481c1b['blockedAt'])[_0x7374('0x25')](_0x4f69b5['blockDuration'],_0x7374('0x26'))>moment()){throw new Error(_0x7374('0x13'));}return utils[_0x7374('0x27')](_0x481c1b,0x0,![],null)['then'](function(){return utils['getLicense'](_0x481c1b);})[_0x7374('0x16')](function(){return _0x35d8e7(null,_0x481c1b);});}else{return utils[_0x7374('0x28')](_0x481c1b)[_0x7374('0x16')](function(){return _0x35d8e7(null,_0x481c1b);});}}else{return utils['getLicense'](_0x481c1b)[_0x7374('0x16')](function(){return _0x35d8e7(null,_0x481c1b);});}})[_0x7374('0x29')](function(_0x8e9edf){return _0x35d8e7(null,![],_0x8e9edf);});}function handleError(_0xc5d8a1,_0x2ca5d6,_0x51fc1c){return _0xc5d8a1['status'](_0x2ca5d6||0x1f4)['send']({'message':_0x51fc1c?_0x51fc1c['message']||_0x51fc1c:''});}exports[_0x7374('0x2a')]=function(_0x35f955,_0xac8c8a,_0x342fa4){passport[_0x7374('0x10')](_0x7374('0x2b'),function(_0x4f96ed,_0x3c0176,_0x2437e6){var _0x32b278=_0x4f96ed||_0x2437e6;if(_0x32b278){return handleError(_0xac8c8a,0x191,_0x32b278);}if(!_0x3c0176){return handleError(_0xac8c8a,0x194,{'message':_0x7374('0x2c')});}else{var _0x2576b8={'payload':{'id':_0x3c0176['id'],'role':_0x3c0176['role']},'options':{'expiresIn':0x15180}};return authService[_0x7374('0x2d')](_0x2576b8)['then'](function(_0x3a301e){_0xac8c8a[_0x7374('0x2e')]({'id':_0x3c0176['id'],'token':_0x3a301e,'statusCall':'','isAlreadyLogged':_0x3c0176[_0x7374('0x21')]});});}})(_0x35f955,_0xac8c8a,_0x342fa4);};passport[_0x7374('0x2f')](_0x7374('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x38dae9,_0x1ad2b7,_0x4549ad){return ActiveDirectoryAuthenticate(db[_0x7374('0x30')],_0x38dae9,_0x1ad2b7,_0x4549ad);})); \ No newline at end of file +var _0x148d=['findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','add','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting'];(function(_0xbb87d5,_0x525bba){var _0x177e8f=function(_0x58f2eb){while(--_0x58f2eb){_0xbb87d5['push'](_0xbb87d5['shift']());}};_0x177e8f(++_0x525bba);}(_0x148d,0xab));var _0xd148=function(_0x54d87f,_0x56c422){_0x54d87f=_0x54d87f-0x0;var _0x2e0995=_0x148d[_0x54d87f];return _0x2e0995;};'use strict';var passport=require(_0xd148('0x0'));var LocalStrategy=require('passport-local')[_0xd148('0x1')];var moment=require(_0xd148('0x2'));var ActiveDirectory=require(_0xd148('0x3'));var BPromise=require(_0xd148('0x4'));var util=require(_0xd148('0x5'));var db=require(_0xd148('0x6'))['db'];var authService=require(_0xd148('0x7'));var utils=require(_0xd148('0x8'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xd148('0x9'));function isActiveDirectoryConfigured(_0x12d619){var _0x25c034=![];if(typeof _0x12d619['activedirectory']!=='undefined'){_0x25c034=_0x12d619[_0xd148('0xa')][_0xd148('0xb')]&&_0x12d619[_0xd148('0xa')]['url']&&_0x12d619[_0xd148('0xa')][_0xd148('0xc')];}return _0x25c034;}function adAuthenticate(_0x40bf65,_0x13f527,_0x373b73){return new BPromise(function(_0x343f13,_0x57a1cb){try{var _0x67bbf5=new ActiveDirectory(_0x40bf65);_0x67bbf5[_0xd148('0xd')](_0x13f527,_0x373b73,function(_0x2bc5eb,_0x1989b1){if(_0x2bc5eb){logger[_0xd148('0xe')](_0xd148('0xf'),_0x13f527,util[_0xd148('0x10')](_0x2bc5eb,{'showHidden':![],'depth':null}));_0x57a1cb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x1989b1){logger[_0xd148('0xe')](_0xd148('0x11'),_0x13f527);_0x57a1cb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x343f13(_0x1989b1);}});}catch(_0xbb9b6c){_0x57a1cb(_0xbb9b6c);}});}function ActiveDirectoryAuthenticate(_0x24c57e,_0x5881cc,_0x289534,_0x543738){var _0x2ec161,_0x58b604;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xd148('0x12'),_0x5881cc);return _0x543738(null,![],{'message':_0xd148('0x13')});}return db[_0xd148('0x14')][_0xd148('0x15')]({'where':{'id':0x1},'attributes':[_0xd148('0x16'),_0xd148('0x17')],'raw':!![]})[_0xd148('0x18')](function(_0x17d962){_0x2ec161=_0x17d962;if(!_0x2ec161['adSsoEnabled']){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5881cc);throw new Error(_0xd148('0x13'));}return _0x24c57e[_0xd148('0x15')]({'logging':!![],'attributes':['id',_0xd148('0x19'),_0xd148('0x1a'),_0xd148('0x1b'),_0xd148('0x1c'),_0xd148('0x1d'),_0xd148('0x1e'),_0xd148('0x1f'),_0xd148('0x20')],'where':{'name':_0x5881cc,'role':{'$or':[_0xd148('0x21'),'user',_0xd148('0x22')]},'adSsoEnabled':!![]}});})[_0xd148('0x18')](function(_0x26563e){if(!_0x26563e||_0x26563e&&_0x26563e[_0xd148('0x19')]!==_0x5881cc){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x58b604=_0x26563e;var _0x5cdbc7=_0x58b604['name']+'@'+config['activedirectory'][_0xd148('0xc')];return adAuthenticate(config['activedirectory'],_0x5cdbc7,_0x289534);})[_0xd148('0x18')](function(_0x5676d1){if(_0x58b604[_0xd148('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x2ec161[_0xd148('0x17')]>0x0){if(_0x58b604['blocked']){if(moment(_0x58b604[_0xd148('0x1f')])[_0xd148('0x23')](_0x2ec161[_0xd148('0x17')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xd148('0x24')](_0x58b604,0x0,![],null)[_0xd148('0x18')](function(){return utils[_0xd148('0x25')](_0x58b604);})[_0xd148('0x18')](function(){return _0x543738(null,_0x58b604);});}else{return utils[_0xd148('0x25')](_0x58b604)['then'](function(){return _0x543738(null,_0x58b604);});}}else{return utils[_0xd148('0x25')](_0x58b604)[_0xd148('0x18')](function(){return _0x543738(null,_0x58b604);});}})[_0xd148('0x26')](function(_0x449684){return _0x543738(null,![],_0x449684);});}function handleError(_0x3a8438,_0x3c0c61,_0x2fba94){return _0x3a8438[_0xd148('0x27')](_0x3c0c61||0x1f4)[_0xd148('0x28')]({'message':_0x2fba94?_0x2fba94[_0xd148('0x29')]||_0x2fba94:''});}exports[_0xd148('0x2a')]=function(_0x267a7a,_0x297b97,_0x587ac6){passport[_0xd148('0xd')](_0xd148('0x2b'),function(_0x112003,_0x20efd9,_0x3a4bcb){var _0x5d0b4a=_0x112003||_0x3a4bcb;if(_0x5d0b4a){return handleError(_0x297b97,0x191,_0x5d0b4a);}if(!_0x20efd9){return handleError(_0x297b97,0x194,{'message':_0xd148('0x2c')});}else{var _0x31830f={'payload':{'id':_0x20efd9['id'],'role':_0x20efd9['role']},'options':{'expiresIn':0x15180}};return authService[_0xd148('0x2d')](_0x31830f)[_0xd148('0x18')](function(_0x27749d){_0x297b97[_0xd148('0x2e')]({'id':_0x20efd9['id'],'token':_0x27749d,'statusCall':'','isAlreadyLogged':_0x20efd9[_0xd148('0x20')]});});}})(_0x267a7a,_0x297b97,_0x587ac6);};passport['use'](_0xd148('0x2b'),new LocalStrategy({'usernameField':_0xd148('0x19'),'passwordField':'password'},function(_0x2efecc,_0x2dfdc5,_0x241c0a){return ActiveDirectoryAuthenticate(db[_0xd148('0x2f')],_0x2efecc,_0x2dfdc5,_0x241c0a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0b6802d..a94d801 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5de0=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x25ba6a,_0x4422d6){var _0x1be09a=function(_0x308e7b){while(--_0x308e7b){_0x25ba6a['push'](_0x25ba6a['shift']());}};_0x1be09a(++_0x4422d6);}(_0x5de0,0x10b));var _0x05de=function(_0x593b03,_0x2ceb59){_0x593b03=_0x593b03-0x0;var _0x2461c1=_0x5de0[_0x593b03];return _0x2461c1;};'use strict';var express=require(_0x05de('0x0'));var router=express[_0x05de('0x1')]();var controller=require(_0x05de('0x2'));router[_0x05de('0x3')]('/',controller[_0x05de('0x4')]);module[_0x05de('0x5')]=router; \ No newline at end of file +var _0x4209=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4209,0x19f));var _0x9420=function(_0x310eaf,_0x5024e1){_0x310eaf=_0x310eaf-0x0;var _0xbab0d8=_0x4209[_0x310eaf];return _0xbab0d8;};'use strict';var express=require(_0x9420('0x0'));var router=express[_0x9420('0x1')]();var controller=require(_0x9420('0x2'));router[_0x9420('0x3')]('/',controller[_0x9420('0x4')]);module[_0x9420('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1d60bb8..80d7837 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x13ca44,_0x56a27d){var _0x62f21f=function(_0x199d67){while(--_0x199d67){_0x13ca44['push'](_0x13ca44['shift']());}};_0x62f21f(++_0x56a27d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x7a54,0x106));var _0x47a5=function(_0x3e2480,_0x4548c8){_0x3e2480=_0x3e2480-0x0;var _0x132c2b=_0x7a54[_0x3e2480];return _0x132c2b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index b82eb1e..4c979f0 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 _0x12c0=['isMiddleware','setTokenCookie','exports','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback'];(function(_0x58bdcd,_0x20597a){var _0x19357e=function(_0x440aba){while(--_0x440aba){_0x58bdcd['push'](_0x58bdcd['shift']());}};_0x19357e(++_0x20597a);}(_0x12c0,0x1d7));var _0x012c=function(_0x5c3a5d,_0x3a43d6){_0x5c3a5d=_0x5c3a5d-0x0;var _0x1ee0bb=_0x12c0[_0x5c3a5d];return _0x1ee0bb;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0x012c('0x0'));var userController=require(_0x012c('0x1'));var authService=require(_0x012c('0x2'));router[_0x012c('0x3')]('/',controller[_0x012c('0x4')]);router['get']('/callback',controller[_0x012c('0x5')],authService[_0x012c('0x6')],userController[_0x012c('0x4')],authService[_0x012c('0x7')]);module[_0x012c('0x8')]=router; \ No newline at end of file +var _0x718e=['login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x718e,0x131));var _0xe718=function(_0x2de91a,_0x542708){_0x2de91a=_0x2de91a-0x0;var _0x49d0b8=_0x718e[_0x2de91a];return _0x49d0b8;};'use strict';var express=require(_0xe718('0x0'));var passport=require(_0xe718('0x1'));var router=express[_0xe718('0x2')]();var controller=require(_0xe718('0x3'));var userController=require(_0xe718('0x4'));var authService=require(_0xe718('0x5'));router[_0xe718('0x6')]('/',controller[_0xe718('0x7')]);router[_0xe718('0x6')]('/callback',controller[_0xe718('0x8')],authService[_0xe718('0x9')],userController['login'],authService[_0xe718('0xa')]);module[_0xe718('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index afac7da..8201cb3 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 _0xc234=['authentication','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','role','json','online','forgot','generate','body','trim','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','password','resetPasswordToken','Password\x20reset!','use','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','salt','disabled','blocked','blockedAt','loginAttempts','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure'];(function(_0x40b8f8,_0x271ad2){var _0x50bb90=function(_0x163671){while(--_0x163671){_0x40b8f8['push'](_0x40b8f8['shift']());}};_0x50bb90(++_0x271ad2);}(_0xc234,0x7f));var _0x4c23=function(_0x299410,_0x1bc43d){_0x299410=_0x299410-0x0;var _0x5c3f5b=_0xc234[_0x299410];return _0x5c3f5b;};'use strict';var util=require('util');var passport=require(_0x4c23('0x0'));var LocalStrategy=require(_0x4c23('0x1'))['Strategy'];var jayson=require(_0x4c23('0x2'));var _=require(_0x4c23('0x3'));var rs=require(_0x4c23('0x4'));var moment=require(_0x4c23('0x5'));var db=require(_0x4c23('0x6'))['db'];var authService=require(_0x4c23('0x7'));var utils=require(_0x4c23('0x8'));var client=jayson[_0x4c23('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x1aff39,_0x4b1c09,_0x3dc42b,_0x44d13d){var _0xa2297d,_0x49a163;return db[_0x4c23('0xa')][_0x4c23('0xb')]({'where':{'id':0x1},'attributes':[_0x4c23('0xc'),_0x4c23('0xd')],'raw':!![]})['then'](function(_0x464858){_0xa2297d=_0x464858;return _0x1aff39[_0x4c23('0xb')]({'attributes':['id',_0x4c23('0xe'),'password',_0x4c23('0xf'),'role',_0x4c23('0x10'),_0x4c23('0x11'),_0x4c23('0x12'),_0x4c23('0x13')],'where':{'name':_0x4b1c09,'role':{'$or':['admin',_0x4c23('0x14'),_0x4c23('0x15')]}}});})[_0x4c23('0x16')](function(_0xac4b10){if(!_0xac4b10||_0xac4b10&&_0xac4b10['name']!==_0x4b1c09){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x49a163=_0xac4b10;return _0x49a163;}})['then'](function(){_0x49a163[_0x4c23('0x17')](_0x3dc42b,function(_0x470343,_0x4e68cb){var _0x95baf5=_0x49a163[_0x4c23('0x13')]+0x1;if(_0x470343){return _0x44d13d(_0x470343);}else if(!_0x4e68cb){if(_0x49a163[_0x4c23('0x10')]){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}else if(_0xa2297d[_0x4c23('0xc')]>0x0){if(_0x49a163[_0x4c23('0x11')]){if(_0xa2297d['blockDuration']>0x0){if(moment(_0x49a163['blockedAt'])[_0x4c23('0x19')](_0xa2297d[_0x4c23('0xd')],_0x4c23('0x1a'))>moment()){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}else{return utils[_0x4c23('0x1b')](_0x49a163,_0x95baf5,![],null)[_0x4c23('0x16')](function(){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});});}}else{return _0x44d13d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x95baf5>=_0xa2297d[_0x4c23('0xc')]){return utils['clearBlockUser'](_0x49a163,0x0,!![],moment())['then'](function(){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});});}else{return utils['clearBlockUser'](_0x49a163,_0x95baf5,![],null)[_0x4c23('0x16')](function(){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});});}}}else{return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}}else{if(_0x49a163['disabled']){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}else if(_0xa2297d[_0x4c23('0xc')]>0x0){if(_0x49a163[_0x4c23('0x11')]){if(_0xa2297d[_0x4c23('0xd')]>0x0){if(moment(_0x49a163['blockedAt'])['add'](_0xa2297d['blockDuration'],_0x4c23('0x1a'))>moment()){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}else{return utils[_0x4c23('0x1b')](_0x49a163,0x0,![],null)[_0x4c23('0x16')](function(){return utils[_0x4c23('0x1c')](_0x49a163);})['then'](function(){return _0x44d13d(null,_0x49a163);});}}else{return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}}else{return utils[_0x4c23('0x1b')](_0x49a163,0x0,![],null)['then'](function(){return utils[_0x4c23('0x1c')](_0x49a163);})[_0x4c23('0x16')](function(){return _0x44d13d(null,_0x49a163);})[_0x4c23('0x1d')](function(_0xf7d5fd){return _0x44d13d(null,![],_0xf7d5fd);});}}else{if(_0x49a163[_0x4c23('0x11')]){return _0x44d13d(null,![],{'message':_0x4c23('0x18')});}else{return utils[_0x4c23('0x1c')](_0x49a163)[_0x4c23('0x16')](function(){return _0x44d13d(null,_0x49a163);});}}}});})[_0x4c23('0x1d')](function(_0x588959){return _0x44d13d(null,![],_0x588959);});}function sendServiceMail(_0x521500){return db[_0x4c23('0x1e')][_0x4c23('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x4c23('0x20')],'include':[{'model':db[_0x4c23('0x21')],'as':_0x4c23('0x22')}]})['then'](function(_0x57eec2){if(!_0x57eec2){throw new Error(_0x4c23('0x23'));}var _0x5026e5={'tls':{'rejectUnauthorized':![]}};if(_0x57eec2[_0x4c23('0x22')][_0x4c23('0x24')]){_0x5026e5[_0x4c23('0x24')]=_0x57eec2['Smtp']['service'];}else{_0x5026e5['host']=_0x57eec2['Smtp']['host'];_0x5026e5[_0x4c23('0x25')]=_0x57eec2['Smtp'][_0x4c23('0x25')];_0x5026e5[_0x4c23('0x26')]=_0x57eec2['Smtp'][_0x4c23('0x26')];}if(_0x57eec2[_0x4c23('0x22')][_0x4c23('0x27')]){_0x5026e5[_0x4c23('0x28')]={'user':_0x57eec2[_0x4c23('0x22')][_0x4c23('0x14')],'pass':_0x57eec2[_0x4c23('0x22')][_0x4c23('0x29')]};}var _0x1fe303={'account':_0x5026e5,'message':_[_0x4c23('0x2a')]({'from':util['format'](_0x4c23('0x2b'),_0x57eec2[_0x4c23('0xe')],_0x57eec2[_0x4c23('0x20')]||_0x57eec2[_0x4c23('0x22')]['user'])},_0x521500)};return client['request'](_0x4c23('0x2c'),_0x1fe303);})[_0x4c23('0x16')](function(_0x4c6dd6){if(_0x4c6dd6['error']){throw new Error(util[_0x4c23('0x2d')](_0x4c23('0x2e'),_0x4c6dd6[_0x4c23('0x2f')][_0x4c23('0x30')]||JSON[_0x4c23('0x31')](_0x4c6dd6[_0x4c23('0x2f')])));}return!![];});}function handleError(_0x48feea,_0x85c4cf,_0x52219a){return _0x48feea[_0x4c23('0x32')](_0x85c4cf||0x1f4)[_0x4c23('0x33')]({'message':_0x52219a?_0x52219a[_0x4c23('0x30')]||_0x52219a:''});}exports['login']=function(_0x3011fa,_0x6c1c8c,_0x550d15){passport[_0x4c23('0x17')](_0x4c23('0x34'),function(_0x456c3f,_0x352738,_0x42ff8a){var _0x2fc448=_0x456c3f||_0x42ff8a;if(_0x2fc448){return handleError(_0x6c1c8c,0x191,_0x2fc448);}if(!_0x352738){return handleError(_0x6c1c8c,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2e681b={'payload':{'id':_0x352738['id'],'role':_0x352738[_0x4c23('0x35')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e681b)[_0x4c23('0x16')](function(_0x1a08f4){_0x6c1c8c[_0x4c23('0x36')]({'id':_0x352738['id'],'token':_0x1a08f4,'statusCall':'','isAlreadyLogged':_0x352738[_0x4c23('0x37')]});});}})(_0x3011fa,_0x6c1c8c,_0x550d15);};exports[_0x4c23('0x38')]=function(_0x15eaa5,_0x5441ed,_0x2da808){if(!_0x15eaa5['body'][_0x4c23('0x20')]){return handleError(_0x5441ed,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xbc48e6=rs[_0x4c23('0x39')]();_0x15eaa5[_0x4c23('0x3a')][_0x4c23('0x20')]=_0x15eaa5[_0x4c23('0x3a')]['email'][_0x4c23('0x3b')]()['toLowerCase']();var _0x27837b;return db[_0x4c23('0xa')][_0x4c23('0xb')]({'where':{'id':0x1},'attributes':[_0x4c23('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x94f77a){_0x27837b=_0x94f77a;return db[_0x4c23('0x3c')][_0x4c23('0x1f')]({'where':{'email':_0x15eaa5[_0x4c23('0x3a')]['email']}});})['then'](function(_0x15c134){if(!_0x15c134){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x15c134[_0x4c23('0x10')]){throw new Error(_0x4c23('0x3d'));}if(_0x15c134['blocked']){if(moment(_0x15c134[_0x4c23('0x12')])['add'](_0x27837b[_0x4c23('0xd')],_0x4c23('0x1a'))>moment()){throw new Error(_0x4c23('0x3e'));}else{_0x15c134[_0x4c23('0x11')]=![];_0x15c134[_0x4c23('0x12')]=null;}}_0x15c134['resetPasswordToken']=_0xbc48e6;_0x15c134[_0x4c23('0x3f')]=Date['now']()+0x36ee80;return _0x15c134[_0x4c23('0x40')]();})[_0x4c23('0x16')](function(){return sendServiceMail({'to':_0x15eaa5['body'][_0x4c23('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x4c23('0x41')+_0x4c23('0x42')+_0x4c23('0x43')+_0x15eaa5['headers']['host']+_0x4c23('0x44')+_0xbc48e6+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x4c23('0x16')](function(){_0x5441ed[_0x4c23('0x32')](0xc8)[_0x4c23('0x33')]({'message':_0x4c23('0x45')});})[_0x4c23('0x1d')](function(_0x580b03){return handleError(_0x5441ed,0x1f4,_0x580b03);});};exports[_0x4c23('0x46')]=function(_0x142b8d,_0x560d2a,_0x5206bb){return db[_0x4c23('0x3c')]['find']({'where':{'resetPasswordToken':_0x142b8d[_0x4c23('0x47')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x4c23('0x16')](function(_0x57490a){if(!_0x57490a){throw new Error(_0x4c23('0x48'));}return db[_0x4c23('0xa')]['findOne']({'attributes':['id',_0x4c23('0x49'),_0x4c23('0x4a'),_0x4c23('0x4b')]})[_0x4c23('0x16')](function(_0x50cb5d){if(_0x50cb5d[_0x4c23('0x49')])authService[_0x4c23('0x4c')](_0x142b8d[_0x4c23('0x3a')]['password']);if(!_0x50cb5d[_0x4c23('0x4a')]||!_0x57490a[_0x4c23('0x4d')])return _0x57490a;authService[_0x4c23('0x4e')](_0x142b8d['body']['password'],_0x57490a[_0x4c23('0x4d')],_0x50cb5d[_0x4c23('0x4b')]);return _0x57490a;})[_0x4c23('0x16')](function(){_0x57490a[_0x4c23('0x4f')]=_0x142b8d[_0x4c23('0x3a')][_0x4c23('0x4f')];_0x57490a[_0x4c23('0x50')]=null;_0x57490a['resetPasswordExpires']=null;return _0x57490a['save']();});})[_0x4c23('0x16')](function(){_0x560d2a[_0x4c23('0x32')](0xc8)['send']({'message':_0x4c23('0x51')});})[_0x4c23('0x1d')](function(_0x12625a){return handleError(_0x560d2a,0x1f4,_0x12625a);});};passport[_0x4c23('0x52')]('local-login',new LocalStrategy({'usernameField':_0x4c23('0xe'),'passwordField':_0x4c23('0x4f')},function(_0x5b950c,_0x2a5969,_0x952244){return localAuthenticate(db['User'],_0x5b950c,_0x2a5969,_0x952244);})); \ No newline at end of file +var _0x68db=['catch','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','client','http','findOne','then','name','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','add','blockDuration','minutes','clearBlockUser','allowedLoginAttempts','getLicense','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','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://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x68db,0x166));var _0xb68d=function(_0x30243d,_0x4a36ff){_0x30243d=_0x30243d-0x0;var _0x34d42b=_0x68db[_0x30243d];return _0x34d42b;};'use strict';var util=require(_0xb68d('0x0'));var passport=require(_0xb68d('0x1'));var LocalStrategy=require(_0xb68d('0x2'))[_0xb68d('0x3')];var jayson=require(_0xb68d('0x4'));var _=require('lodash');var rs=require(_0xb68d('0x5'));var moment=require('moment');var db=require(_0xb68d('0x6'))['db'];var authService=require(_0xb68d('0x7'));var utils=require('../../config/utils');var client=jayson[_0xb68d('0x8')][_0xb68d('0x9')]({'port':0x232b});function localAuthenticate(_0x48d019,_0xdfc118,_0x5cb35c,_0xc1ce96){var _0x2ab436,_0x415da8;return db['Setting'][_0xb68d('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb68d('0xb')](function(_0x5a1cee){_0x2ab436=_0x5a1cee;return _0x48d019['findOne']({'attributes':['id',_0xb68d('0xc'),'password',_0xb68d('0xd'),_0xb68d('0xe'),_0xb68d('0xf'),'blocked',_0xb68d('0x10'),'loginAttempts'],'where':{'name':_0xdfc118,'role':{'$or':[_0xb68d('0x11'),_0xb68d('0x12'),_0xb68d('0x13')]}}});})[_0xb68d('0xb')](function(_0x429572){if(!_0x429572||_0x429572&&_0x429572[_0xb68d('0xc')]!==_0xdfc118){throw new Error(_0xb68d('0x14'));}else{_0x415da8=_0x429572;return _0x415da8;}})['then'](function(){_0x415da8[_0xb68d('0x15')](_0x5cb35c,function(_0x5a3816,_0x24f67e){var _0xca9472=_0x415da8[_0xb68d('0x16')]+0x1;if(_0x5a3816){return _0xc1ce96(_0x5a3816);}else if(!_0x24f67e){if(_0x415da8[_0xb68d('0xf')]){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}else if(_0x2ab436['allowedLoginAttempts']>0x0){if(_0x415da8[_0xb68d('0x17')]){if(_0x2ab436['blockDuration']>0x0){if(moment(_0x415da8[_0xb68d('0x10')])[_0xb68d('0x18')](_0x2ab436[_0xb68d('0x19')],_0xb68d('0x1a'))>moment()){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}else{return utils[_0xb68d('0x1b')](_0x415da8,_0xca9472,![],null)[_0xb68d('0xb')](function(){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});});}}else{return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}}else{if(_0xca9472>=_0x2ab436[_0xb68d('0x1c')]){return utils[_0xb68d('0x1b')](_0x415da8,0x0,!![],moment())[_0xb68d('0xb')](function(){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});});}else{return utils[_0xb68d('0x1b')](_0x415da8,_0xca9472,![],null)[_0xb68d('0xb')](function(){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});});}}}else{return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}}else{if(_0x415da8[_0xb68d('0xf')]){return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}else if(_0x2ab436[_0xb68d('0x1c')]>0x0){if(_0x415da8[_0xb68d('0x17')]){if(_0x2ab436[_0xb68d('0x19')]>0x0){if(moment(_0x415da8[_0xb68d('0x10')])['add'](_0x2ab436[_0xb68d('0x19')],_0xb68d('0x1a'))>moment()){return _0xc1ce96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb68d('0x1b')](_0x415da8,0x0,![],null)[_0xb68d('0xb')](function(){return utils['getLicense'](_0x415da8);})[_0xb68d('0xb')](function(){return _0xc1ce96(null,_0x415da8);});}}else{return _0xc1ce96(null,![],{'message':_0xb68d('0x14')});}}else{return utils['clearBlockUser'](_0x415da8,0x0,![],null)['then'](function(){return utils[_0xb68d('0x1d')](_0x415da8);})['then'](function(){return _0xc1ce96(null,_0x415da8);})['catch'](function(_0x4b1d11){return _0xc1ce96(null,![],_0x4b1d11);});}}else{if(_0x415da8[_0xb68d('0x17')]){return _0xc1ce96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x415da8)[_0xb68d('0xb')](function(){return _0xc1ce96(null,_0x415da8);});}}}});})['catch'](function(_0x269610){return _0xc1ce96(null,![],_0x269610);});}function sendServiceMail(_0x133c45){return db[_0xb68d('0x1e')][_0xb68d('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xb68d('0x20')],'include':[{'model':db[_0xb68d('0x21')],'as':_0xb68d('0x22')}]})['then'](function(_0xb4757a){if(!_0xb4757a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x224d59={'tls':{'rejectUnauthorized':![]}};if(_0xb4757a[_0xb68d('0x22')]['service']){_0x224d59[_0xb68d('0x23')]=_0xb4757a[_0xb68d('0x22')][_0xb68d('0x23')];}else{_0x224d59[_0xb68d('0x24')]=_0xb4757a[_0xb68d('0x22')]['host'];_0x224d59[_0xb68d('0x25')]=_0xb4757a[_0xb68d('0x22')][_0xb68d('0x25')];_0x224d59[_0xb68d('0x26')]=_0xb4757a[_0xb68d('0x22')][_0xb68d('0x26')];}if(_0xb4757a[_0xb68d('0x22')]['authentication']){_0x224d59[_0xb68d('0x27')]={'user':_0xb4757a[_0xb68d('0x22')][_0xb68d('0x12')],'pass':_0xb4757a['Smtp'][_0xb68d('0x28')]};}var _0x43bc67={'account':_0x224d59,'message':_['merge']({'from':util[_0xb68d('0x29')](_0xb68d('0x2a'),_0xb4757a[_0xb68d('0xc')],_0xb4757a['email']||_0xb4757a['Smtp'][_0xb68d('0x12')])},_0x133c45)};return client[_0xb68d('0x2b')](_0xb68d('0x2c'),_0x43bc67);})[_0xb68d('0xb')](function(_0x3b0d7d){if(_0x3b0d7d[_0xb68d('0x2d')]){throw new Error(util[_0xb68d('0x29')](_0xb68d('0x2e'),_0x3b0d7d[_0xb68d('0x2d')][_0xb68d('0x2f')]||JSON[_0xb68d('0x30')](_0x3b0d7d[_0xb68d('0x2d')])));}return!![];});}function handleError(_0xbbfa90,_0x2b0eb2,_0x4d94bb){return _0xbbfa90[_0xb68d('0x31')](_0x2b0eb2||0x1f4)['send']({'message':_0x4d94bb?_0x4d94bb[_0xb68d('0x2f')]||_0x4d94bb:''});}exports[_0xb68d('0x32')]=function(_0x3d6341,_0x321326,_0x299ca1){passport['authenticate'](_0xb68d('0x33'),function(_0x54d175,_0x1df675,_0x375ef1){var _0x506ac9=_0x54d175||_0x375ef1;if(_0x506ac9){return handleError(_0x321326,0x191,_0x506ac9);}if(!_0x1df675){return handleError(_0x321326,0x194,{'message':_0xb68d('0x34')});}else{var _0x51a0a7={'payload':{'id':_0x1df675['id'],'role':_0x1df675[_0xb68d('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xb68d('0x35')](_0x51a0a7)[_0xb68d('0xb')](function(_0x3594ac){_0x321326['json']({'id':_0x1df675['id'],'token':_0x3594ac,'statusCall':'','isAlreadyLogged':_0x1df675[_0xb68d('0x36')]});});}})(_0x3d6341,_0x321326,_0x299ca1);};exports[_0xb68d('0x37')]=function(_0x5ab012,_0x12f95d,_0x3c2e54){if(!_0x5ab012['body'][_0xb68d('0x20')]){return handleError(_0x12f95d,0x1f4,{'message':_0xb68d('0x38')});}var _0x4d428d=rs[_0xb68d('0x39')]();_0x5ab012[_0xb68d('0x3a')][_0xb68d('0x20')]=_0x5ab012[_0xb68d('0x3a')][_0xb68d('0x20')]['trim']()[_0xb68d('0x3b')]();var _0x2a8f97;return db[_0xb68d('0x3c')]['findOne']({'where':{'id':0x1},'attributes':[_0xb68d('0x1c'),_0xb68d('0x19')],'raw':!![]})[_0xb68d('0xb')](function(_0x304cc5){_0x2a8f97=_0x304cc5;return db[_0xb68d('0x3d')][_0xb68d('0x1f')]({'where':{'email':_0x5ab012[_0xb68d('0x3a')][_0xb68d('0x20')]}});})[_0xb68d('0xb')](function(_0x1cf280){if(!_0x1cf280){throw new Error(_0xb68d('0x3e'));}if(_0x1cf280[_0xb68d('0xf')]){throw new Error(_0xb68d('0x3f'));}if(_0x1cf280[_0xb68d('0x17')]){if(moment(_0x1cf280[_0xb68d('0x10')])['add'](_0x2a8f97[_0xb68d('0x19')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1cf280[_0xb68d('0x17')]=![];_0x1cf280['blockedAt']=null;}}_0x1cf280[_0xb68d('0x40')]=_0x4d428d;_0x1cf280[_0xb68d('0x41')]=Date[_0xb68d('0x42')]()+0x36ee80;return _0x1cf280[_0xb68d('0x43')]();})[_0xb68d('0xb')](function(){return sendServiceMail({'to':_0x5ab012[_0xb68d('0x3a')][_0xb68d('0x20')],'subject':_0xb68d('0x44'),'text':_0xb68d('0x45')+_0xb68d('0x46')+_0xb68d('0x47')+_0x5ab012['headers'][_0xb68d('0x24')]+_0xb68d('0x48')+_0x4d428d+'\x0a\x0a'+_0xb68d('0x49')});})[_0xb68d('0xb')](function(){_0x12f95d['status'](0xc8)[_0xb68d('0x4a')]({'message':_0xb68d('0x4b')});})['catch'](function(_0x594292){return handleError(_0x12f95d,0x1f4,_0x594292);});};exports[_0xb68d('0x4c')]=function(_0x4b895e,_0xb1dd63,_0x42a30b){return db['User'][_0xb68d('0x1f')]({'where':{'resetPasswordToken':_0x4b895e[_0xb68d('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date[_0xb68d('0x42')]()}}})[_0xb68d('0xb')](function(_0x3d9411){if(!_0x3d9411){throw new Error(_0xb68d('0x4e'));}return db[_0xb68d('0x3c')][_0xb68d('0xa')]({'attributes':['id',_0xb68d('0x4f'),_0xb68d('0x50'),_0xb68d('0x51')]})[_0xb68d('0xb')](function(_0x3a6157){if(_0x3a6157[_0xb68d('0x4f')])authService[_0xb68d('0x52')](_0x4b895e[_0xb68d('0x3a')][_0xb68d('0x53')]);if(!_0x3a6157['enforcePasswordHistory']||!_0x3d9411[_0xb68d('0x54')])return _0x3d9411;authService[_0xb68d('0x55')](_0x4b895e[_0xb68d('0x3a')]['password'],_0x3d9411['previousPasswords'],_0x3a6157[_0xb68d('0x51')]);return _0x3d9411;})['then'](function(){_0x3d9411[_0xb68d('0x53')]=_0x4b895e[_0xb68d('0x3a')][_0xb68d('0x53')];_0x3d9411[_0xb68d('0x40')]=null;_0x3d9411[_0xb68d('0x41')]=null;return _0x3d9411[_0xb68d('0x43')]();});})[_0xb68d('0xb')](function(){_0xb1dd63[_0xb68d('0x31')](0xc8)['send']({'message':_0xb68d('0x56')});})[_0xb68d('0x57')](function(_0x4886e9){return handleError(_0xb1dd63,0x1f4,_0x4886e9);});};passport[_0xb68d('0x58')](_0xb68d('0x33'),new LocalStrategy({'usernameField':_0xb68d('0xc'),'passwordField':_0xb68d('0x53')},function(_0x185835,_0x2a3a2c,_0x397afa){return localAuthenticate(db[_0xb68d('0x3d')],_0x185835,_0x2a3a2c,_0x397afa);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 56ffe6b..3215851 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 _0x9f22=['/reset/:token','reset','exports','express','./authLocal.controller','post','forgot'];(function(_0x32f476,_0x5002e9){var _0x435b18=function(_0x208563){while(--_0x208563){_0x32f476['push'](_0x32f476['shift']());}};_0x435b18(++_0x5002e9);}(_0x9f22,0x130));var _0x29f2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9f22[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x29f2('0x0'));var router=express['Router']();var controller=require(_0x29f2('0x1'));router[_0x29f2('0x2')]('/',controller['login']);router['post']('/forgot',controller[_0x29f2('0x3')]);router[_0x29f2('0x2')](_0x29f2('0x4'),controller[_0x29f2('0x5')]);module[_0x29f2('0x6')]=router; \ No newline at end of file +var _0x0ae1=['forgot','reset','exports','Router','post','login','/forgot'];(function(_0x76a86a,_0x1d9665){var _0x23e53d=function(_0x58d5e0){while(--_0x58d5e0){_0x76a86a['push'](_0x76a86a['shift']());}};_0x23e53d(++_0x1d9665);}(_0x0ae1,0x13e));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x10ae('0x0')]();var controller=require('./authLocal.controller');router[_0x10ae('0x1')]('/',controller[_0x10ae('0x2')]);router[_0x10ae('0x1')](_0x10ae('0x3'),controller[_0x10ae('0x4')]);router[_0x10ae('0x1')]('/reset/:token',controller[_0x10ae('0x5')]);module[_0x10ae('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index bdc2e9c..29ce358 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 _0xfae1=['STRING','INTEGER','sequelize','exports'];(function(_0x174b19,_0x159c5d){var _0x32ac4a=function(_0x36c8d9){while(--_0x36c8d9){_0x174b19['push'](_0x174b19['shift']());}};_0x32ac4a(++_0x159c5d);}(_0xfae1,0xc6));var _0x1fae=function(_0xf0a2b5,_0x494499){_0xf0a2b5=_0xf0a2b5-0x0;var _0x56b380=_0xfae1[_0xf0a2b5];return _0x56b380;};'use strict';var Sequelize=require(_0x1fae('0x0'));module[_0x1fae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x1fae('0x2')]},'description':{'type':Sequelize[_0x1fae('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1fae('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xac20=['sequelize','exports','STRING','BOOLEAN'];(function(_0x46caef,_0x1497cb){var _0x5a0c73=function(_0x3981ef){while(--_0x3981ef){_0x46caef['push'](_0x46caef['shift']());}};_0x5a0c73(++_0x1497cb);}(_0xac20,0x1a0));var _0x0ac2=function(_0x11447a,_0x360188){_0x11447a=_0x11447a-0x0;var _0x10ee27=_0xac20[_0x11447a];return _0x10ee27;};'use strict';var Sequelize=require(_0x0ac2('0x0'));module[_0x0ac2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x0ac2('0x2')]},'description':{'type':Sequelize[_0x0ac2('0x2')]},'status':{'type':Sequelize[_0x0ac2('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 24c8d93..586fab0 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 _0x0978=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Automation','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','getActions','Action','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5ce15c,_0x19c917){var _0x36e4f5=function(_0x50fa90){while(--_0x50fa90){_0x5ce15c['push'](_0x5ce15c['shift']());}};_0x36e4f5(++_0x19c917);}(_0x0978,0xa9));var _0x8097=function(_0x247920,_0x1088f4){_0x247920=_0x247920-0x0;var _0xc423c4=_0x0978[_0x247920];return _0xc423c4;};'use strict';var emlformat=require(_0x8097('0x0'));var rimraf=require(_0x8097('0x1'));var zipdir=require(_0x8097('0x2'));var jsonpatch=require(_0x8097('0x3'));var rp=require('request-promise');var moment=require(_0x8097('0x4'));var BPromise=require(_0x8097('0x5'));var Mustache=require(_0x8097('0x6'));var util=require(_0x8097('0x7'));var path=require(_0x8097('0x8'));var sox=require(_0x8097('0x9'));var csv=require(_0x8097('0xa'));var ejs=require(_0x8097('0xb'));var fs=require('fs');var fs_extra=require(_0x8097('0xc'));var _=require(_0x8097('0xd'));var squel=require(_0x8097('0xe'));var crypto=require(_0x8097('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8097('0xa'));var querystring=require(_0x8097('0x10'));var Papa=require('papaparse');var Redis=require(_0x8097('0x11'));var authService=require(_0x8097('0x12'));var qs=require(_0x8097('0x13'));var as=require(_0x8097('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8097('0x15'))(_0x8097('0x16'));var utils=require(_0x8097('0x17'));var config=require(_0x8097('0x18'));var licenseUtil=require(_0x8097('0x19'));var db=require(_0x8097('0x1a'))['db'];function respondWithStatusCode(_0x44ee02,_0x266dc8){_0x266dc8=_0x266dc8||0xcc;return function(_0x24fc28){if(_0x24fc28){return _0x44ee02['sendStatus'](_0x266dc8);}return _0x44ee02[_0x8097('0x1b')](_0x266dc8)[_0x8097('0x1c')]();};}function respondWithResult(_0x3cddd4,_0x374b07){_0x374b07=_0x374b07||0xc8;return function(_0x275d1e){if(_0x275d1e){return _0x3cddd4['status'](_0x374b07)[_0x8097('0x1d')](_0x275d1e);}};}function respondWithFilteredResult(_0x2eefa3,_0x458399){return function(_0x58f0aa){if(_0x58f0aa){var _0x54ef45=typeof _0x458399[_0x8097('0x1e')]==='undefined'&&typeof _0x458399[_0x8097('0x1f')]===_0x8097('0x20');var _0x316f12=_0x58f0aa[_0x8097('0x21')];var _0xba5422=_0x54ef45?0x0:_0x458399[_0x8097('0x1e')];var _0x47cc9a=_0x54ef45?_0x58f0aa[_0x8097('0x21')]:_0x458399['offset']+_0x458399[_0x8097('0x1f')];var _0x2fbe62;if(_0x47cc9a>=_0x316f12){_0x47cc9a=_0x316f12;_0x2fbe62=0xc8;}else{_0x2fbe62=0xce;}_0x2eefa3[_0x8097('0x1b')](_0x2fbe62);return _0x2eefa3['set'](_0x8097('0x22'),_0xba5422+'-'+_0x47cc9a+'/'+_0x316f12)['json'](_0x58f0aa);}return null;};}function patchUpdates(_0x39d862){return function(_0x4e1d51){try{jsonpatch[_0x8097('0x23')](_0x4e1d51,_0x39d862,!![]);}catch(_0x2663e4){return BPromise[_0x8097('0x24')](_0x2663e4);}return _0x4e1d51[_0x8097('0x25')]();};}function saveUpdates(_0x56f6d5,_0x1b767d){return function(_0xeeed6d){if(_0xeeed6d){return _0xeeed6d[_0x8097('0x26')](_0x56f6d5)[_0x8097('0x27')](function(_0xdda2fc){return _0xdda2fc;});}return null;};}function removeEntity(_0xed881d,_0x107ccc){return function(_0x2d8748){if(_0x2d8748){return _0x2d8748[_0x8097('0x28')]()[_0x8097('0x27')](function(){_0xed881d['status'](0xcc)[_0x8097('0x1c')]();});}};}function handleEntityNotFound(_0x798521,_0x2f3063){return function(_0x3b54af){if(!_0x3b54af){_0x798521['sendStatus'](0x194);}return _0x3b54af;};}function handleError(_0x415ef1,_0x227684){_0x227684=_0x227684||0x1f4;return function(_0x4a9a85){logger[_0x8097('0x29')](_0x4a9a85[_0x8097('0x2a')]);if(_0x4a9a85[_0x8097('0x2b')]){delete _0x4a9a85[_0x8097('0x2b')];}_0x415ef1[_0x8097('0x1b')](_0x227684)[_0x8097('0x2c')](_0x4a9a85);};}exports[_0x8097('0x2d')]=function(_0x54d3dc,_0x9644d9){var _0x4e20b6={},_0x569906={},_0x47e75b={'count':0x0,'rows':[]};var _0x43598e=_[_0x8097('0x2e')](db['Automation']['rawAttributes'],function(_0x448e03){return{'name':_0x448e03['fieldName'],'type':_0x448e03[_0x8097('0x2f')][_0x8097('0x30')]};});_0x569906[_0x8097('0x31')]=_[_0x8097('0x2e')](_0x43598e,_0x8097('0x2b'));_0x569906[_0x8097('0x32')]=_[_0x8097('0x33')](_0x54d3dc[_0x8097('0x32')]);_0x569906[_0x8097('0x34')]=_[_0x8097('0x35')](_0x569906[_0x8097('0x31')],_0x569906[_0x8097('0x32')]);_0x4e20b6[_0x8097('0x36')]=_[_0x8097('0x35')](_0x569906['model'],qs[_0x8097('0x37')](_0x54d3dc[_0x8097('0x32')][_0x8097('0x37')]));_0x4e20b6[_0x8097('0x36')]=_0x4e20b6[_0x8097('0x36')][_0x8097('0x38')]?_0x4e20b6['attributes']:_0x569906['model'];if(!_0x54d3dc['query'][_0x8097('0x39')]('nolimit')){_0x4e20b6[_0x8097('0x1f')]=qs['limit'](_0x54d3dc['query'][_0x8097('0x1f')]);_0x4e20b6[_0x8097('0x1e')]=qs['offset'](_0x54d3dc[_0x8097('0x32')][_0x8097('0x1e')]);}_0x4e20b6[_0x8097('0x3a')]=qs[_0x8097('0x3b')](_0x54d3dc[_0x8097('0x32')][_0x8097('0x3b')]);_0x4e20b6['where']=qs[_0x8097('0x34')](_[_0x8097('0x3c')](_0x54d3dc[_0x8097('0x32')],_0x569906['filters']),_0x43598e);if(_0x54d3dc[_0x8097('0x32')][_0x8097('0x3d')]){_0x4e20b6[_0x8097('0x3e')]=_[_0x8097('0x3f')](_0x4e20b6[_0x8097('0x3e')],{'$or':_[_0x8097('0x2e')](_0x43598e,function(_0x4cb468){if(_0x4cb468['type']!==_0x8097('0x40')){var _0x4fb8cc={};_0x4fb8cc[_0x4cb468[_0x8097('0x2b')]]={'$like':'%'+_0x54d3dc[_0x8097('0x32')][_0x8097('0x3d')]+'%'};return _0x4fb8cc;}})});}_0x4e20b6=_['merge']({},_0x4e20b6,_0x54d3dc[_0x8097('0x41')]);var _0x417217={'where':_0x4e20b6[_0x8097('0x3e')]};return db[_0x8097('0x42')]['count'](_0x417217)['then'](function(_0x420cbb){_0x47e75b[_0x8097('0x21')]=_0x420cbb;if(_0x54d3dc['query'][_0x8097('0x43')]){_0x4e20b6['include']=[{'all':!![]}];}return db[_0x8097('0x42')]['findAll'](_0x4e20b6);})[_0x8097('0x27')](function(_0x3703bc){_0x47e75b[_0x8097('0x44')]=_0x3703bc;return _0x47e75b;})['then'](respondWithFilteredResult(_0x9644d9,_0x4e20b6))[_0x8097('0x45')](handleError(_0x9644d9,null));};exports[_0x8097('0x46')]=function(_0x5b606c,_0x1fd86b){var _0xea11b2={'raw':![],'where':{'id':_0x5b606c[_0x8097('0x47')]['id']}},_0x39d5a6={};_0x39d5a6[_0x8097('0x31')]=_[_0x8097('0x33')](db[_0x8097('0x42')][_0x8097('0x48')]);_0x39d5a6['query']=_[_0x8097('0x33')](_0x5b606c[_0x8097('0x32')]);_0x39d5a6[_0x8097('0x34')]=_[_0x8097('0x35')](_0x39d5a6['model'],_0x39d5a6[_0x8097('0x32')]);_0xea11b2[_0x8097('0x36')]=_[_0x8097('0x35')](_0x39d5a6[_0x8097('0x31')],qs[_0x8097('0x37')](_0x5b606c[_0x8097('0x32')][_0x8097('0x37')]));_0xea11b2['attributes']=_0xea11b2[_0x8097('0x36')]['length']?_0xea11b2[_0x8097('0x36')]:_0x39d5a6[_0x8097('0x31')];if(_0x5b606c[_0x8097('0x32')][_0x8097('0x43')]){_0xea11b2[_0x8097('0x49')]=[{'all':!![]}];}_0xea11b2=_[_0x8097('0x3f')]({},_0xea11b2,_0x5b606c[_0x8097('0x41')]);return db[_0x8097('0x42')][_0x8097('0x4a')](_0xea11b2)[_0x8097('0x27')](handleEntityNotFound(_0x1fd86b,null))[_0x8097('0x27')](respondWithResult(_0x1fd86b,null))[_0x8097('0x45')](handleError(_0x1fd86b,null));};exports[_0x8097('0x4b')]=function(_0x5bfbf9,_0x58f907){return db[_0x8097('0x42')][_0x8097('0x4b')](_0x5bfbf9[_0x8097('0x4c')],{})[_0x8097('0x27')](respondWithResult(_0x58f907,0xc9))[_0x8097('0x45')](handleError(_0x58f907,null));};exports['update']=function(_0x27f827,_0x5a41f5){if(_0x27f827[_0x8097('0x4c')]['id']){delete _0x27f827[_0x8097('0x4c')]['id'];}return db[_0x8097('0x42')]['find']({'where':{'id':_0x27f827[_0x8097('0x47')]['id']}})[_0x8097('0x27')](handleEntityNotFound(_0x5a41f5,null))[_0x8097('0x27')](saveUpdates(_0x27f827['body'],null))[_0x8097('0x27')](respondWithResult(_0x5a41f5,null))['catch'](handleError(_0x5a41f5,null));};exports[_0x8097('0x28')]=function(_0x51c408,_0x1d8627){return db[_0x8097('0x42')]['find']({'where':{'id':_0x51c408[_0x8097('0x47')]['id']}})[_0x8097('0x27')](handleEntityNotFound(_0x1d8627,null))['then'](removeEntity(_0x1d8627,null))[_0x8097('0x45')](handleError(_0x1d8627,null));};exports[_0x8097('0x4d')]=function(_0x284fbe,_0x308dbd,_0x4ccbaf){return db[_0x8097('0x4e')][_0x8097('0x4a')]({'where':{'id':_0x284fbe[_0x8097('0x47')]['id']}})[_0x8097('0x27')](handleEntityNotFound(_0x308dbd,null))['then'](function(_0x52fcb3){if(_0x52fcb3){return _0x52fcb3[_0x8097('0x4d')](_0x284fbe[_0x8097('0x4c')][_0x8097('0x4f')],_[_0x8097('0x50')](_0x284fbe[_0x8097('0x4c')],['ids','id'])||{});}})[_0x8097('0x27')](respondWithResult(_0x308dbd,null))[_0x8097('0x45')](handleError(_0x308dbd,null));};exports[_0x8097('0x51')]=function(_0x20a724,_0x5ef8f6,_0x3679a6){var _0x5c8ae4={};var _0x381c5f={};var _0x2b530d;var _0x454373;return db[_0x8097('0x42')][_0x8097('0x52')]({'where':{'id':_0x20a724[_0x8097('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef8f6,null))[_0x8097('0x27')](function(_0x32908e){if(_0x32908e){_0x2b530d=_0x32908e;_0x381c5f[_0x8097('0x31')]=_[_0x8097('0x33')](db[_0x8097('0x4e')][_0x8097('0x48')]);_0x381c5f['query']=_[_0x8097('0x33')](_0x20a724[_0x8097('0x32')]);_0x381c5f['filters']=_[_0x8097('0x35')](_0x381c5f['model'],_0x381c5f[_0x8097('0x32')]);_0x5c8ae4['attributes']=_[_0x8097('0x35')](_0x381c5f[_0x8097('0x31')],qs[_0x8097('0x37')](_0x20a724[_0x8097('0x32')]['fields']));_0x5c8ae4[_0x8097('0x36')]=_0x5c8ae4[_0x8097('0x36')][_0x8097('0x38')]?_0x5c8ae4[_0x8097('0x36')]:_0x381c5f[_0x8097('0x31')];_0x5c8ae4[_0x8097('0x3a')]=qs[_0x8097('0x3b')](_0x20a724[_0x8097('0x32')][_0x8097('0x3b')]);_0x5c8ae4[_0x8097('0x3e')]=qs[_0x8097('0x34')](_[_0x8097('0x3c')](_0x20a724['query'],_0x381c5f[_0x8097('0x34')]));if(_0x20a724[_0x8097('0x32')][_0x8097('0x3d')]){_0x5c8ae4[_0x8097('0x3e')]=_[_0x8097('0x3f')](_0x5c8ae4[_0x8097('0x3e')],{'$or':_[_0x8097('0x2e')](_0x5c8ae4[_0x8097('0x36')],function(_0x35451d){var _0x4c2f55={};_0x4c2f55[_0x35451d]={'$like':'%'+_0x20a724['query'][_0x8097('0x3d')]+'%'};return _0x4c2f55;})});}_0x5c8ae4=_[_0x8097('0x3f')]({},_0x5c8ae4,_0x20a724[_0x8097('0x41')]);return _0x2b530d[_0x8097('0x51')](_0x5c8ae4);}})[_0x8097('0x27')](function(_0x57c0a5){if(_0x57c0a5){_0x454373=_0x57c0a5[_0x8097('0x38')];if(!_0x20a724[_0x8097('0x32')]['hasOwnProperty']('nolimit')){_0x5c8ae4[_0x8097('0x1f')]=qs[_0x8097('0x1f')](_0x20a724[_0x8097('0x32')][_0x8097('0x1f')]);_0x5c8ae4[_0x8097('0x1e')]=qs[_0x8097('0x1e')](_0x20a724['query'][_0x8097('0x1e')]);}return _0x2b530d[_0x8097('0x51')](_0x5c8ae4);}})[_0x8097('0x27')](function(_0x29f8d4){if(_0x29f8d4){return _0x29f8d4?{'count':_0x454373,'rows':_0x29f8d4}:null;}})[_0x8097('0x27')](respondWithResult(_0x5ef8f6,null))[_0x8097('0x45')](handleError(_0x5ef8f6,null));};exports[_0x8097('0x53')]=function(_0x66693b,_0x174f24,_0x2c3d77){return db['Action']['find']({'where':{'id':_0x66693b['params']['id']}})[_0x8097('0x27')](handleEntityNotFound(_0x174f24,null))[_0x8097('0x27')](function(_0x50d3cf){if(_0x50d3cf){return _0x50d3cf[_0x8097('0x53')](_0x66693b[_0x8097('0x4c')][_0x8097('0x4f')],_[_0x8097('0x50')](_0x66693b[_0x8097('0x4c')],[_0x8097('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x174f24,null))[_0x8097('0x45')](handleError(_0x174f24,null));};exports[_0x8097('0x54')]=function(_0x5b738c,_0x51fa41,_0x1745d2){var _0x577110={};var _0x4ea38={};var _0x214130;var _0x26f37e;return db[_0x8097('0x42')]['findOne']({'where':{'id':_0x5b738c[_0x8097('0x47')]['id']}})[_0x8097('0x27')](handleEntityNotFound(_0x51fa41,null))[_0x8097('0x27')](function(_0x22b23d){if(_0x22b23d){_0x214130=_0x22b23d;_0x4ea38['model']=_[_0x8097('0x33')](db[_0x8097('0x55')][_0x8097('0x48')]);_0x4ea38[_0x8097('0x32')]=_['keys'](_0x5b738c[_0x8097('0x32')]);_0x4ea38[_0x8097('0x34')]=_[_0x8097('0x35')](_0x4ea38['model'],_0x4ea38['query']);_0x577110['attributes']=_[_0x8097('0x35')](_0x4ea38[_0x8097('0x31')],qs[_0x8097('0x37')](_0x5b738c[_0x8097('0x32')][_0x8097('0x37')]));_0x577110[_0x8097('0x36')]=_0x577110[_0x8097('0x36')][_0x8097('0x38')]?_0x577110[_0x8097('0x36')]:_0x4ea38['model'];_0x577110['order']=qs[_0x8097('0x3b')](_0x5b738c['query'][_0x8097('0x3b')]);_0x577110[_0x8097('0x3e')]=qs['filters'](_[_0x8097('0x3c')](_0x5b738c[_0x8097('0x32')],_0x4ea38['filters']));if(_0x5b738c[_0x8097('0x32')][_0x8097('0x3d')]){_0x577110[_0x8097('0x3e')]=_[_0x8097('0x3f')](_0x577110[_0x8097('0x3e')],{'$or':_[_0x8097('0x2e')](_0x577110[_0x8097('0x36')],function(_0x2ef052){var _0x367d89={};_0x367d89[_0x2ef052]={'$like':'%'+_0x5b738c['query'][_0x8097('0x3d')]+'%'};return _0x367d89;})});}_0x577110=_[_0x8097('0x3f')]({},_0x577110,_0x5b738c[_0x8097('0x41')]);return _0x214130[_0x8097('0x54')](_0x577110);}})['then'](function(_0x308cbb){if(_0x308cbb){_0x26f37e=_0x308cbb[_0x8097('0x38')];if(!_0x5b738c[_0x8097('0x32')]['hasOwnProperty'](_0x8097('0x56'))){_0x577110[_0x8097('0x1f')]=qs[_0x8097('0x1f')](_0x5b738c[_0x8097('0x32')][_0x8097('0x1f')]);_0x577110[_0x8097('0x1e')]=qs['offset'](_0x5b738c['query'][_0x8097('0x1e')]);}return _0x214130[_0x8097('0x54')](_0x577110);}})[_0x8097('0x27')](function(_0x23715e){if(_0x23715e){return _0x23715e?{'count':_0x26f37e,'rows':_0x23715e}:null;}})[_0x8097('0x27')](respondWithResult(_0x51fa41,null))[_0x8097('0x45')](handleError(_0x51fa41,null));}; \ No newline at end of file +var _0x0d3a=['params','model','rawAttributes','include','find','create','body','destroy','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','map','Automation','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show'];(function(_0x535bcd,_0x1575af){var _0x42f269=function(_0x1463da){while(--_0x1463da){_0x535bcd['push'](_0x535bcd['shift']());}};_0x42f269(++_0x1575af);}(_0x0d3a,0x1c9));var _0xa0d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d3a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa0d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0d3('0x1'));var jsonpatch=require(_0xa0d3('0x2'));var rp=require(_0xa0d3('0x3'));var moment=require(_0xa0d3('0x4'));var BPromise=require(_0xa0d3('0x5'));var Mustache=require('mustache');var util=require(_0xa0d3('0x6'));var path=require(_0xa0d3('0x7'));var sox=require(_0xa0d3('0x8'));var csv=require(_0xa0d3('0x9'));var ejs=require(_0xa0d3('0xa'));var fs=require('fs');var fs_extra=require(_0xa0d3('0xb'));var _=require('lodash');var squel=require(_0xa0d3('0xc'));var crypto=require(_0xa0d3('0xd'));var jsforce=require(_0xa0d3('0xe'));var deskjs=require(_0xa0d3('0xf'));var toCsv=require(_0xa0d3('0x9'));var querystring=require(_0xa0d3('0x10'));var Papa=require(_0xa0d3('0x11'));var Redis=require(_0xa0d3('0x12'));var authService=require(_0xa0d3('0x13'));var qs=require(_0xa0d3('0x14'));var as=require(_0xa0d3('0x15'));var hardwareService=require(_0xa0d3('0x16'));var logger=require(_0xa0d3('0x17'))(_0xa0d3('0x18'));var utils=require(_0xa0d3('0x19'));var config=require(_0xa0d3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0d3('0x1b'))['db'];function respondWithStatusCode(_0x24de7c,_0x151427){_0x151427=_0x151427||0xcc;return function(_0x4a9d14){if(_0x4a9d14){return _0x24de7c[_0xa0d3('0x1c')](_0x151427);}return _0x24de7c[_0xa0d3('0x1d')](_0x151427)[_0xa0d3('0x1e')]();};}function respondWithResult(_0x539aa7,_0x509891){_0x509891=_0x509891||0xc8;return function(_0x2a16ef){if(_0x2a16ef){return _0x539aa7[_0xa0d3('0x1d')](_0x509891)[_0xa0d3('0x1f')](_0x2a16ef);}};}function respondWithFilteredResult(_0x42ff37,_0x53e042){return function(_0x43d97e){if(_0x43d97e){var _0x5d6858=typeof _0x53e042[_0xa0d3('0x20')]==='undefined'&&typeof _0x53e042[_0xa0d3('0x21')]===_0xa0d3('0x22');var _0x20adae=_0x43d97e[_0xa0d3('0x23')];var _0x2d9b9d=_0x5d6858?0x0:_0x53e042[_0xa0d3('0x20')];var _0x10ec4f=_0x5d6858?_0x43d97e['count']:_0x53e042[_0xa0d3('0x20')]+_0x53e042['limit'];var _0x54fc0e;if(_0x10ec4f>=_0x20adae){_0x10ec4f=_0x20adae;_0x54fc0e=0xc8;}else{_0x54fc0e=0xce;}_0x42ff37[_0xa0d3('0x1d')](_0x54fc0e);return _0x42ff37[_0xa0d3('0x24')](_0xa0d3('0x25'),_0x2d9b9d+'-'+_0x10ec4f+'/'+_0x20adae)[_0xa0d3('0x1f')](_0x43d97e);}return null;};}function patchUpdates(_0x384663){return function(_0xe7ffc){try{jsonpatch[_0xa0d3('0x26')](_0xe7ffc,_0x384663,!![]);}catch(_0x22a9e5){return BPromise['reject'](_0x22a9e5);}return _0xe7ffc['save']();};}function saveUpdates(_0x5ed222,_0x149cea){return function(_0x2cdec9){if(_0x2cdec9){return _0x2cdec9[_0xa0d3('0x27')](_0x5ed222)['then'](function(_0x59f7a4){return _0x59f7a4;});}return null;};}function removeEntity(_0x2d5f92,_0xb26ad4){return function(_0x5230e6){if(_0x5230e6){return _0x5230e6['destroy']()[_0xa0d3('0x28')](function(){_0x2d5f92['status'](0xcc)[_0xa0d3('0x1e')]();});}};}function handleEntityNotFound(_0x57aaa2,_0x50cc5e){return function(_0xce00cb){if(!_0xce00cb){_0x57aaa2['sendStatus'](0x194);}return _0xce00cb;};}function handleError(_0x16d7fe,_0x4cf467){_0x4cf467=_0x4cf467||0x1f4;return function(_0x38cc78){logger[_0xa0d3('0x29')](_0x38cc78[_0xa0d3('0x2a')]);if(_0x38cc78[_0xa0d3('0x2b')]){delete _0x38cc78[_0xa0d3('0x2b')];}_0x16d7fe['status'](_0x4cf467)[_0xa0d3('0x2c')](_0x38cc78);};}exports['index']=function(_0x564c52,_0x1ff07f){var _0x6c473e={},_0x1f6271={},_0x3c01de={'count':0x0,'rows':[]};var _0x304ef1=_[_0xa0d3('0x2d')](db[_0xa0d3('0x2e')]['rawAttributes'],function(_0x6c680){return{'name':_0x6c680[_0xa0d3('0x2f')],'type':_0x6c680[_0xa0d3('0x30')][_0xa0d3('0x31')]};});_0x1f6271['model']=_[_0xa0d3('0x2d')](_0x304ef1,_0xa0d3('0x2b'));_0x1f6271[_0xa0d3('0x32')]=_[_0xa0d3('0x33')](_0x564c52[_0xa0d3('0x32')]);_0x1f6271[_0xa0d3('0x34')]=_[_0xa0d3('0x35')](_0x1f6271['model'],_0x1f6271[_0xa0d3('0x32')]);_0x6c473e[_0xa0d3('0x36')]=_[_0xa0d3('0x35')](_0x1f6271['model'],qs[_0xa0d3('0x37')](_0x564c52['query']['fields']));_0x6c473e[_0xa0d3('0x36')]=_0x6c473e[_0xa0d3('0x36')][_0xa0d3('0x38')]?_0x6c473e['attributes']:_0x1f6271['model'];if(!_0x564c52[_0xa0d3('0x32')][_0xa0d3('0x39')](_0xa0d3('0x3a'))){_0x6c473e[_0xa0d3('0x21')]=qs[_0xa0d3('0x21')](_0x564c52[_0xa0d3('0x32')]['limit']);_0x6c473e['offset']=qs[_0xa0d3('0x20')](_0x564c52['query'][_0xa0d3('0x20')]);}_0x6c473e[_0xa0d3('0x3b')]=qs[_0xa0d3('0x3c')](_0x564c52['query'][_0xa0d3('0x3c')]);_0x6c473e[_0xa0d3('0x3d')]=qs['filters'](_[_0xa0d3('0x3e')](_0x564c52[_0xa0d3('0x32')],_0x1f6271['filters']),_0x304ef1);if(_0x564c52['query'][_0xa0d3('0x3f')]){_0x6c473e[_0xa0d3('0x3d')]=_[_0xa0d3('0x40')](_0x6c473e[_0xa0d3('0x3d')],{'$or':_[_0xa0d3('0x2d')](_0x304ef1,function(_0x359ef9){if(_0x359ef9[_0xa0d3('0x30')]!==_0xa0d3('0x41')){var _0x2fb221={};_0x2fb221[_0x359ef9[_0xa0d3('0x2b')]]={'$like':'%'+_0x564c52[_0xa0d3('0x32')][_0xa0d3('0x3f')]+'%'};return _0x2fb221;}})});}_0x6c473e=_[_0xa0d3('0x40')]({},_0x6c473e,_0x564c52[_0xa0d3('0x42')]);var _0xf0b931={'where':_0x6c473e[_0xa0d3('0x3d')]};return db[_0xa0d3('0x2e')][_0xa0d3('0x23')](_0xf0b931)[_0xa0d3('0x28')](function(_0xcf8f71){_0x3c01de[_0xa0d3('0x23')]=_0xcf8f71;if(_0x564c52[_0xa0d3('0x32')][_0xa0d3('0x43')]){_0x6c473e['include']=[{'all':!![]}];}return db[_0xa0d3('0x2e')][_0xa0d3('0x44')](_0x6c473e);})[_0xa0d3('0x28')](function(_0x45fb82){_0x3c01de['rows']=_0x45fb82;return _0x3c01de;})['then'](respondWithFilteredResult(_0x1ff07f,_0x6c473e))[_0xa0d3('0x45')](handleError(_0x1ff07f,null));};exports[_0xa0d3('0x46')]=function(_0x5e62fd,_0x48d360){var _0x53634c={'raw':![],'where':{'id':_0x5e62fd[_0xa0d3('0x47')]['id']}},_0x3b17d7={};_0x3b17d7[_0xa0d3('0x48')]=_[_0xa0d3('0x33')](db[_0xa0d3('0x2e')][_0xa0d3('0x49')]);_0x3b17d7[_0xa0d3('0x32')]=_['keys'](_0x5e62fd[_0xa0d3('0x32')]);_0x3b17d7['filters']=_['intersection'](_0x3b17d7['model'],_0x3b17d7['query']);_0x53634c[_0xa0d3('0x36')]=_[_0xa0d3('0x35')](_0x3b17d7[_0xa0d3('0x48')],qs[_0xa0d3('0x37')](_0x5e62fd[_0xa0d3('0x32')]['fields']));_0x53634c[_0xa0d3('0x36')]=_0x53634c[_0xa0d3('0x36')][_0xa0d3('0x38')]?_0x53634c[_0xa0d3('0x36')]:_0x3b17d7[_0xa0d3('0x48')];if(_0x5e62fd[_0xa0d3('0x32')][_0xa0d3('0x43')]){_0x53634c[_0xa0d3('0x4a')]=[{'all':!![]}];}_0x53634c=_[_0xa0d3('0x40')]({},_0x53634c,_0x5e62fd[_0xa0d3('0x42')]);return db[_0xa0d3('0x2e')][_0xa0d3('0x4b')](_0x53634c)[_0xa0d3('0x28')](handleEntityNotFound(_0x48d360,null))[_0xa0d3('0x28')](respondWithResult(_0x48d360,null))['catch'](handleError(_0x48d360,null));};exports[_0xa0d3('0x4c')]=function(_0x5b67d3,_0x5cb462){return db[_0xa0d3('0x2e')][_0xa0d3('0x4c')](_0x5b67d3[_0xa0d3('0x4d')],{})['then'](respondWithResult(_0x5cb462,0xc9))[_0xa0d3('0x45')](handleError(_0x5cb462,null));};exports[_0xa0d3('0x27')]=function(_0x45a104,_0x57b659){if(_0x45a104[_0xa0d3('0x4d')]['id']){delete _0x45a104[_0xa0d3('0x4d')]['id'];}return db[_0xa0d3('0x2e')][_0xa0d3('0x4b')]({'where':{'id':_0x45a104['params']['id']}})[_0xa0d3('0x28')](handleEntityNotFound(_0x57b659,null))[_0xa0d3('0x28')](saveUpdates(_0x45a104[_0xa0d3('0x4d')],null))[_0xa0d3('0x28')](respondWithResult(_0x57b659,null))[_0xa0d3('0x45')](handleError(_0x57b659,null));};exports[_0xa0d3('0x4e')]=function(_0x1edbec,_0x21343e){return db[_0xa0d3('0x2e')]['find']({'where':{'id':_0x1edbec[_0xa0d3('0x47')]['id']}})[_0xa0d3('0x28')](handleEntityNotFound(_0x21343e,null))['then'](removeEntity(_0x21343e,null))[_0xa0d3('0x45')](handleError(_0x21343e,null));};exports[_0xa0d3('0x4f')]=function(_0x457623,_0x4ba527,_0x13a035){return db['Condition'][_0xa0d3('0x4b')]({'where':{'id':_0x457623[_0xa0d3('0x47')]['id']}})[_0xa0d3('0x28')](handleEntityNotFound(_0x4ba527,null))['then'](function(_0x5c30bb){if(_0x5c30bb){return _0x5c30bb[_0xa0d3('0x4f')](_0x457623[_0xa0d3('0x4d')][_0xa0d3('0x50')],_[_0xa0d3('0x51')](_0x457623[_0xa0d3('0x4d')],[_0xa0d3('0x50'),'id'])||{});}})[_0xa0d3('0x28')](respondWithResult(_0x4ba527,null))[_0xa0d3('0x45')](handleError(_0x4ba527,null));};exports[_0xa0d3('0x52')]=function(_0x241581,_0x21d9fc,_0xf21c71){var _0x38e0a3={};var _0x2f2cbe={};var _0x5a69ab;var _0x1f0195;return db[_0xa0d3('0x2e')][_0xa0d3('0x53')]({'where':{'id':_0x241581['params']['id']}})['then'](handleEntityNotFound(_0x21d9fc,null))[_0xa0d3('0x28')](function(_0x45d590){if(_0x45d590){_0x5a69ab=_0x45d590;_0x2f2cbe[_0xa0d3('0x48')]=_[_0xa0d3('0x33')](db[_0xa0d3('0x54')]['rawAttributes']);_0x2f2cbe[_0xa0d3('0x32')]=_[_0xa0d3('0x33')](_0x241581[_0xa0d3('0x32')]);_0x2f2cbe[_0xa0d3('0x34')]=_[_0xa0d3('0x35')](_0x2f2cbe[_0xa0d3('0x48')],_0x2f2cbe[_0xa0d3('0x32')]);_0x38e0a3[_0xa0d3('0x36')]=_['intersection'](_0x2f2cbe['model'],qs[_0xa0d3('0x37')](_0x241581[_0xa0d3('0x32')][_0xa0d3('0x37')]));_0x38e0a3[_0xa0d3('0x36')]=_0x38e0a3[_0xa0d3('0x36')][_0xa0d3('0x38')]?_0x38e0a3['attributes']:_0x2f2cbe['model'];_0x38e0a3[_0xa0d3('0x3b')]=qs['sort'](_0x241581[_0xa0d3('0x32')][_0xa0d3('0x3c')]);_0x38e0a3[_0xa0d3('0x3d')]=qs[_0xa0d3('0x34')](_['pick'](_0x241581[_0xa0d3('0x32')],_0x2f2cbe[_0xa0d3('0x34')]));if(_0x241581[_0xa0d3('0x32')][_0xa0d3('0x3f')]){_0x38e0a3[_0xa0d3('0x3d')]=_[_0xa0d3('0x40')](_0x38e0a3[_0xa0d3('0x3d')],{'$or':_[_0xa0d3('0x2d')](_0x38e0a3[_0xa0d3('0x36')],function(_0x3e9662){var _0x1e81e2={};_0x1e81e2[_0x3e9662]={'$like':'%'+_0x241581['query'][_0xa0d3('0x3f')]+'%'};return _0x1e81e2;})});}_0x38e0a3=_[_0xa0d3('0x40')]({},_0x38e0a3,_0x241581[_0xa0d3('0x42')]);return _0x5a69ab['getConditions'](_0x38e0a3);}})['then'](function(_0x43e6f0){if(_0x43e6f0){_0x1f0195=_0x43e6f0[_0xa0d3('0x38')];if(!_0x241581[_0xa0d3('0x32')][_0xa0d3('0x39')](_0xa0d3('0x3a'))){_0x38e0a3[_0xa0d3('0x21')]=qs['limit'](_0x241581[_0xa0d3('0x32')][_0xa0d3('0x21')]);_0x38e0a3['offset']=qs[_0xa0d3('0x20')](_0x241581[_0xa0d3('0x32')]['offset']);}return _0x5a69ab[_0xa0d3('0x52')](_0x38e0a3);}})[_0xa0d3('0x28')](function(_0x1b6b2d){if(_0x1b6b2d){return _0x1b6b2d?{'count':_0x1f0195,'rows':_0x1b6b2d}:null;}})[_0xa0d3('0x28')](respondWithResult(_0x21d9fc,null))[_0xa0d3('0x45')](handleError(_0x21d9fc,null));};exports[_0xa0d3('0x55')]=function(_0x3c4229,_0x44e133,_0x5d490c){return db[_0xa0d3('0x56')][_0xa0d3('0x4b')]({'where':{'id':_0x3c4229[_0xa0d3('0x47')]['id']}})[_0xa0d3('0x28')](handleEntityNotFound(_0x44e133,null))[_0xa0d3('0x28')](function(_0x13273e){if(_0x13273e){return _0x13273e['addActions'](_0x3c4229['body'][_0xa0d3('0x50')],_[_0xa0d3('0x51')](_0x3c4229[_0xa0d3('0x4d')],[_0xa0d3('0x50'),'id'])||{});}})[_0xa0d3('0x28')](respondWithResult(_0x44e133,null))[_0xa0d3('0x45')](handleError(_0x44e133,null));};exports[_0xa0d3('0x57')]=function(_0x83a507,_0x8675e5,_0x3c4fdc){var _0x1d219b={};var _0x8417a9={};var _0x2561ba;var _0x2fd423;return db[_0xa0d3('0x2e')]['findOne']({'where':{'id':_0x83a507['params']['id']}})['then'](handleEntityNotFound(_0x8675e5,null))['then'](function(_0x4e406d){if(_0x4e406d){_0x2561ba=_0x4e406d;_0x8417a9[_0xa0d3('0x48')]=_['keys'](db['Action']['rawAttributes']);_0x8417a9[_0xa0d3('0x32')]=_[_0xa0d3('0x33')](_0x83a507[_0xa0d3('0x32')]);_0x8417a9[_0xa0d3('0x34')]=_['intersection'](_0x8417a9[_0xa0d3('0x48')],_0x8417a9['query']);_0x1d219b['attributes']=_['intersection'](_0x8417a9[_0xa0d3('0x48')],qs[_0xa0d3('0x37')](_0x83a507[_0xa0d3('0x32')][_0xa0d3('0x37')]));_0x1d219b[_0xa0d3('0x36')]=_0x1d219b[_0xa0d3('0x36')][_0xa0d3('0x38')]?_0x1d219b[_0xa0d3('0x36')]:_0x8417a9[_0xa0d3('0x48')];_0x1d219b[_0xa0d3('0x3b')]=qs['sort'](_0x83a507[_0xa0d3('0x32')]['sort']);_0x1d219b['where']=qs[_0xa0d3('0x34')](_[_0xa0d3('0x3e')](_0x83a507[_0xa0d3('0x32')],_0x8417a9[_0xa0d3('0x34')]));if(_0x83a507[_0xa0d3('0x32')][_0xa0d3('0x3f')]){_0x1d219b['where']=_[_0xa0d3('0x40')](_0x1d219b['where'],{'$or':_[_0xa0d3('0x2d')](_0x1d219b[_0xa0d3('0x36')],function(_0x1cbb59){var _0x2996e0={};_0x2996e0[_0x1cbb59]={'$like':'%'+_0x83a507[_0xa0d3('0x32')][_0xa0d3('0x3f')]+'%'};return _0x2996e0;})});}_0x1d219b=_['merge']({},_0x1d219b,_0x83a507[_0xa0d3('0x42')]);return _0x2561ba[_0xa0d3('0x57')](_0x1d219b);}})[_0xa0d3('0x28')](function(_0x5e8108){if(_0x5e8108){_0x2fd423=_0x5e8108[_0xa0d3('0x38')];if(!_0x83a507[_0xa0d3('0x32')]['hasOwnProperty']('nolimit')){_0x1d219b[_0xa0d3('0x21')]=qs[_0xa0d3('0x21')](_0x83a507['query'][_0xa0d3('0x21')]);_0x1d219b[_0xa0d3('0x20')]=qs[_0xa0d3('0x20')](_0x83a507[_0xa0d3('0x32')][_0xa0d3('0x20')]);}return _0x2561ba['getActions'](_0x1d219b);}})[_0xa0d3('0x28')](function(_0x512e08){if(_0x512e08){return _0x512e08?{'count':_0x2fd423,'rows':_0x512e08}:null;}})['then'](respondWithResult(_0x8675e5,null))[_0xa0d3('0x45')](handleError(_0x8675e5,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 88d1e58..1d2dba8 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 _0xb2c3=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','./automation.attributes'];(function(_0xd73a50,_0xbe4f47){var _0x457b14=function(_0x3c0046){while(--_0x3c0046){_0xd73a50['push'](_0xd73a50['shift']());}};_0x457b14(++_0xbe4f47);}(_0xb2c3,0x189));var _0x3b2c=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0xb2c3[_0x22377a];return _0x36f105;};'use strict';var _=require(_0x3b2c('0x0'));var util=require(_0x3b2c('0x1'));var logger=require(_0x3b2c('0x2'))(_0x3b2c('0x3'));var moment=require(_0x3b2c('0x4'));var BPromise=require(_0x3b2c('0x5'));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(_0x3b2c('0x6'));module['exports']=function(_0x4c1d67,_0x8b9356){return _0x4c1d67[_0x3b2c('0x7')](_0x3b2c('0x8'),attributes,{'tableName':_0x3b2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc493=['request-promise','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','api','moment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xc493,0x194));var _0x3c49=function(_0x1fbf2f,_0x27324d){_0x1fbf2f=_0x1fbf2f-0x0;var _0x45feb4=_0xc493[_0x1fbf2f];return _0x45feb4;};'use strict';var _=require(_0x3c49('0x0'));var util=require(_0x3c49('0x1'));var logger=require('../../config/logger')(_0x3c49('0x2'));var moment=require(_0x3c49('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c49('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c49('0x5'));var config=require(_0x3c49('0x6'));var attributes=require(_0x3c49('0x7'));module[_0x3c49('0x8')]=function(_0x53fcfc,_0x471a26){return _0x53fcfc[_0x3c49('0x9')](_0x3c49('0xa'),attributes,{'tableName':_0x3c49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 731990e..411f1c0 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 _0x80cd=['client','http','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5e802e,_0x8d0759){var _0x50ffa4=function(_0x29f35b){while(--_0x29f35b){_0x5e802e['push'](_0x5e802e['shift']());}};_0x50ffa4(++_0x8d0759);}(_0x80cd,0x146));var _0xd80c=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x80cd[_0x4c184d];return _0x23d997;};'use strict';var _=require('lodash');var util=require(_0xd80c('0x0'));var moment=require(_0xd80c('0x1'));var BPromise=require(_0xd80c('0x2'));var rs=require(_0xd80c('0x3'));var fs=require('fs');var Redis=require(_0xd80c('0x4'));var db=require(_0xd80c('0x5'))['db'];var utils=require(_0xd80c('0x6'));var logger=require(_0xd80c('0x7'))('rpc');var config=require(_0xd80c('0x8'));var jayson=require(_0xd80c('0x9'));var client=jayson[_0xd80c('0xa')][_0xd80c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508e19,_0x343595,_0x20cd74){return new BPromise(function(_0x2dc89b,_0x3aa004){return client['request'](_0x508e19,_0x20cd74)[_0xd80c('0xc')](function(_0x588160){logger['info'](_0xd80c('0xd'),_0x343595,'request\x20sent');logger[_0xd80c('0xe')](_0xd80c('0xf'),_0x343595,_0xd80c('0x10'),JSON[_0xd80c('0x11')](_0x588160));if(_0x588160[_0xd80c('0x12')]){if(_0x588160[_0xd80c('0x12')][_0xd80c('0x13')]===0x1f4){logger['error'](_0xd80c('0xd'),_0x343595,_0x588160[_0xd80c('0x12')][_0xd80c('0x14')]);return _0x3aa004(_0x588160[_0xd80c('0x12')][_0xd80c('0x14')]);}logger[_0xd80c('0x12')](_0xd80c('0xd'),_0x343595,_0x588160[_0xd80c('0x12')][_0xd80c('0x14')]);return _0x2dc89b(_0x588160['error'][_0xd80c('0x14')]);}else{logger[_0xd80c('0x15')](_0xd80c('0xd'),_0x343595,_0xd80c('0x10'));_0x2dc89b(_0x588160[_0xd80c('0x16')]['message']);}})[_0xd80c('0x17')](function(_0xec332d){logger[_0xd80c('0x12')](_0xd80c('0xd'),_0x343595,_0xec332d);_0x3aa004(_0xec332d);});});} \ No newline at end of file +var _0x1f92=['request','then','request\x20sent','debug','stringify','error','code','Automation,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x372b9d,_0x547e8c){var _0x48cb9b=function(_0x5472c9){while(--_0x5472c9){_0x372b9d['push'](_0x372b9d['shift']());}};_0x48cb9b(++_0x547e8c);}(_0x1f92,0x1ad));var _0x21f9=function(_0x506715,_0x33991a){_0x506715=_0x506715-0x0;var _0x22c67e=_0x1f92[_0x506715];return _0x22c67e;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var moment=require(_0x21f9('0x1'));var BPromise=require(_0x21f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21f9('0x3'))['db'];var utils=require(_0x21f9('0x4'));var logger=require(_0x21f9('0x5'))(_0x21f9('0x6'));var config=require(_0x21f9('0x7'));var jayson=require(_0x21f9('0x8'));var client=jayson[_0x21f9('0x9')][_0x21f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44afd8,_0x2590dd,_0x2bba30){return new BPromise(function(_0x261881,_0x4abee7){return client[_0x21f9('0xb')](_0x44afd8,_0x2bba30)[_0x21f9('0xc')](function(_0x345f68){logger['info']('Automation,\x20%s,\x20%s',_0x2590dd,_0x21f9('0xd'));logger[_0x21f9('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x2590dd,_0x21f9('0xd'),JSON[_0x21f9('0xf')](_0x345f68));if(_0x345f68[_0x21f9('0x10')]){if(_0x345f68[_0x21f9('0x10')][_0x21f9('0x11')]===0x1f4){logger[_0x21f9('0x10')](_0x21f9('0x12'),_0x2590dd,_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);return _0x4abee7(_0x345f68['error']['message']);}logger[_0x21f9('0x10')]('Automation,\x20%s,\x20%s',_0x2590dd,_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);return _0x261881(_0x345f68[_0x21f9('0x10')][_0x21f9('0x13')]);}else{logger[_0x21f9('0x14')](_0x21f9('0x12'),_0x2590dd,_0x21f9('0xd'));_0x261881(_0x345f68['result'][_0x21f9('0x13')]);}})[_0x21f9('0x15')](function(_0x1c62ca){logger[_0x21f9('0x10')](_0x21f9('0x12'),_0x2590dd,_0x1c62ca);_0x4abee7(_0x1c62ca);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 80e28a7..19b1338 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 _0x7aa2=['getActions','create','post','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x2a829f,_0x1b0c15){var _0x5737c3=function(_0x2376f9){while(--_0x2376f9){_0x2a829f['push'](_0x2a829f['shift']());}};_0x5737c3(++_0x1b0c15);}(_0x7aa2,0x132));var _0x27aa=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0x7aa2[_0x1eb82d];return _0x2c9502;};'use strict';var multer=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var path=require(_0x27aa('0x2'));var timeout=require(_0x27aa('0x3'));var express=require(_0x27aa('0x4'));var router=express[_0x27aa('0x5')]();var fs_extra=require(_0x27aa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x27aa('0x7'));var config=require(_0x27aa('0x8'));var controller=require(_0x27aa('0x9'));router['get']('/',auth[_0x27aa('0xa')](),controller[_0x27aa('0xb')]);router[_0x27aa('0xc')](_0x27aa('0xd'),auth[_0x27aa('0xa')](),controller[_0x27aa('0xe')]);router['get'](_0x27aa('0xf'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x10')]);router[_0x27aa('0xc')](_0x27aa('0x11'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x12')]);router['post']('/',auth[_0x27aa('0xa')](),controller[_0x27aa('0x13')]);router['post'](_0x27aa('0xf'),auth[_0x27aa('0xa')](),controller['addConditions']);router[_0x27aa('0x14')](_0x27aa('0x11'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x15')]);router[_0x27aa('0x16')](_0x27aa('0xd'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x17')]);router[_0x27aa('0x18')](_0x27aa('0xd'),auth[_0x27aa('0xa')](),controller[_0x27aa('0x19')]);module[_0x27aa('0x1a')]=router; \ No newline at end of file +var _0xc7e9=['/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','post','create','addActions','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0xd60d36,_0x238deb){var _0x3dc626=function(_0x6cdc0a){while(--_0x6cdc0a){_0xd60d36['push'](_0xd60d36['shift']());}};_0x3dc626(++_0x238deb);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc7e9[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var path=require('path');var timeout=require(_0x9c7e('0x2'));var express=require(_0x9c7e('0x3'));var router=express[_0x9c7e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c7e('0x5'));var interaction=require(_0x9c7e('0x6'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x9c7e('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c7e('0x8')]);router[_0x9c7e('0x7')](_0x9c7e('0x9'),auth[_0x9c7e('0xa')](),controller['show']);router[_0x9c7e('0x7')](_0x9c7e('0xb'),auth[_0x9c7e('0xa')](),controller[_0x9c7e('0xc')]);router['get'](_0x9c7e('0xd'),auth[_0x9c7e('0xa')](),controller['getActions']);router[_0x9c7e('0xe')]('/',auth['isAuthenticated'](),controller[_0x9c7e('0xf')]);router[_0x9c7e('0xe')]('/:id/conditions',auth[_0x9c7e('0xa')](),controller['addConditions']);router[_0x9c7e('0xe')](_0x9c7e('0xd'),auth[_0x9c7e('0xa')](),controller[_0x9c7e('0x10')]);router[_0x9c7e('0x11')]('/:id',auth[_0x9c7e('0xa')](),controller[_0x9c7e('0x12')]);router[_0x9c7e('0x13')](_0x9c7e('0x9'),auth[_0x9c7e('0xa')](),controller[_0x9c7e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 234495d..1a8ba2e 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 _0xf8a9=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0xf8a9,0xb1));var _0x9f8a=function(_0x588989,_0x1eda3e){_0x588989=_0x588989-0x0;var _0x351d0f=_0xf8a9[_0x588989];return _0x351d0f;};'use strict';var Sequelize=require(_0x9f8a('0x0'));module[_0x9f8a('0x1')]={'name':{'type':Sequelize[_0x9f8a('0x2')],'unique':_0x9f8a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9f8a('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9f8a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x9f8a('0x5')](0x4)[_0x9f8a('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9f8a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9f8a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f8a('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9f8a('0x5')](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f8a('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9f8a('0xc')},'dialTimezone':{'type':Sequelize[_0x9f8a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9f8a('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x9f8a('0xd'),_0x9f8a('0xe'),_0x9f8a('0xf')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9f8a('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x9f8a('0x5')](0x9)[_0x9f8a('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9f8a('0x5')](0x9)[_0x9f8a('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9f8a('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9f8a('0x5')](0x9)[_0x9f8a('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9f8a('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9f8a('0x5')](0x9)[_0x9f8a('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9f8a('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9f8a('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9f8a('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9f8a('0x5')](0x9)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9f8a('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9f8a('0x5')](0x5)[_0x9f8a('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9f8a('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9f8a('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9f8a('0x16')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9f8a('0x17')]('DESC',_0x9f8a('0x18')),'defaultValue':_0x9f8a('0x19')},'dialPrefix':{'type':Sequelize[_0x9f8a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9f8a('0x1a')},'dialCutDigit':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9f8a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f8a('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9f8a('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9f8a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9f8a('0x5')](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9f8a('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9f8a('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9f8a('0x5')](0x5)[_0x9f8a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9f8a('0x21')}}; \ No newline at end of file +var _0xe1d1=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x24ad25,_0x519997){var _0x51b0fa=function(_0x5e408a){while(--_0x5e408a){_0x24ad25['push'](_0x24ad25['shift']());}};_0x51b0fa(++_0x519997);}(_0xe1d1,0x131));var _0x1e1d=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xe1d1[_0x1b4b23];return _0x2a325b;};'use strict';var Sequelize=require(_0x1e1d('0x0'));module[_0x1e1d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1e1d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1e1d('0x3')](_0x1e1d('0x4')),'allowNull':![],'defaultValue':_0x1e1d('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1e1d('0x5')],'defaultValue':0x0,'comment':_0x1e1d('0x6')},'limitCalls':{'type':Sequelize[_0x1e1d('0x7')](0x4)[_0x1e1d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1e1d('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1e1d('0xa')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e1d('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1e1d('0x7')](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'comment':_0x1e1d('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1e1d('0x7')](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1e1d('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1e1d('0xa')],'defaultValue':_0x1e1d('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1e1d('0x3')](_0x1e1d('0x12'),_0x1e1d('0x13'),'onlyIfOpen'),'defaultValue':_0x1e1d('0x12')},'dialAMDActive':{'type':Sequelize[_0x1e1d('0x5')],'defaultValue':0x0,'comment':_0x1e1d('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1e1d('0x7')](0x9)[_0x1e1d('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1e1d('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x1e1d('0x7')](0x9)[_0x1e1d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1e1d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1e1d('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1e1d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e1d('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x1e1d('0x7')](0x9)[_0x1e1d('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1e1d('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1e1d('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1e1d('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1e1d('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1e1d('0x7')](0x5)[_0x1e1d('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1e1d('0x7')](0x9)[_0x1e1d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e1d('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1e1d('0x3')](_0x1e1d('0x1b'),'ASC'),'defaultValue':_0x1e1d('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1e1d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e1d('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e1d('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1e1d('0x7')](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e1d('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e1d('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e1d('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1e1d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e1d('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1e1d('0x7')](0x3)[_0x1e1d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e1d('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1e1d('0x7')](0x5)[_0x1e1d('0x8')],'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 a1e2df2..d12d0ba 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 _0x88c8=['sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','end','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','sort','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CampaignId','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','phone\x20IS\x20NOT\x20NULL','fromQuery','cm_hopper_additional_phones','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x88c8,0x7a));var _0x888c=function(_0x4f242d,_0x28ae07){_0x4f242d=_0x4f242d-0x0;var _0x5e11b8=_0x88c8[_0x4f242d];return _0x5e11b8;};'use strict';var emlformat=require(_0x888c('0x0'));var rimraf=require(_0x888c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x888c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x888c('0x3'));var util=require(_0x888c('0x4'));var path=require('path');var sox=require(_0x888c('0x5'));var csv=require(_0x888c('0x6'));var ejs=require(_0x888c('0x7'));var fs=require('fs');var fs_extra=require(_0x888c('0x8'));var _=require(_0x888c('0x9'));var squel=require(_0x888c('0xa'));var crypto=require(_0x888c('0xb'));var jsforce=require(_0x888c('0xc'));var deskjs=require(_0x888c('0xd'));var toCsv=require(_0x888c('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x888c('0xe'));var authService=require(_0x888c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x888c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x11'))(_0x888c('0x12'));var utils=require(_0x888c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x888c('0x14'));var db=require(_0x888c('0x15'))['db'];function respondWithStatusCode(_0x29a7fb,_0x2018a4){_0x2018a4=_0x2018a4||0xcc;return function(_0xe8b4f9){if(_0xe8b4f9){return _0x29a7fb[_0x888c('0x16')](_0x2018a4);}return _0x29a7fb[_0x888c('0x17')](_0x2018a4)['end']();};}function respondWithResult(_0x524085,_0x115ecd){_0x115ecd=_0x115ecd||0xc8;return function(_0xefa022){if(_0xefa022){return _0x524085[_0x888c('0x17')](_0x115ecd)[_0x888c('0x18')](_0xefa022);}};}function respondWithFilteredResult(_0x355924,_0x24ad88){return function(_0xb48d29){if(_0xb48d29){var _0x2f5c4e=typeof _0x24ad88[_0x888c('0x19')]===_0x888c('0x1a')&&typeof _0x24ad88[_0x888c('0x1b')]===_0x888c('0x1a');var _0x406a2f=_0xb48d29['count'];var _0x1fefb1=_0x2f5c4e?0x0:_0x24ad88['offset'];var _0x133947=_0x2f5c4e?_0xb48d29['count']:_0x24ad88[_0x888c('0x19')]+_0x24ad88[_0x888c('0x1b')];var _0x2fb1fb;if(_0x133947>=_0x406a2f){_0x133947=_0x406a2f;_0x2fb1fb=0xc8;}else{_0x2fb1fb=0xce;}_0x355924[_0x888c('0x17')](_0x2fb1fb);return _0x355924[_0x888c('0x1c')]('Content-Range',_0x1fefb1+'-'+_0x133947+'/'+_0x406a2f)[_0x888c('0x18')](_0xb48d29);}return null;};}function patchUpdates(_0xa1d889){return function(_0x21262c){try{jsonpatch[_0x888c('0x1d')](_0x21262c,_0xa1d889,!![]);}catch(_0x2195d3){return BPromise[_0x888c('0x1e')](_0x2195d3);}return _0x21262c[_0x888c('0x1f')]();};}function saveUpdates(_0x109934,_0x401ffe){return function(_0x246166){if(_0x246166){return _0x246166[_0x888c('0x20')](_0x109934)['then'](function(_0x3f3608){return _0x3f3608;});}return null;};}function removeEntity(_0x1f6ccb,_0x44b882){return function(_0x3f6376){if(_0x3f6376){return _0x3f6376['destroy']()[_0x888c('0x21')](function(){var _0x2f5790=_0x3f6376['get']({'plain':!![]});var _0xce2657=_0x888c('0x22');return db[_0x888c('0x23')][_0x888c('0x24')]({'where':{'type':_0xce2657,'resourceId':_0x2f5790['id']}})[_0x888c('0x21')](function(){return _0x3f6376;});})['then'](function(){_0x1f6ccb[_0x888c('0x17')](0xcc)[_0x888c('0x25')]();});}};}function handleEntityNotFound(_0x32d6da,_0x40388d){return function(_0x4ad064){if(!_0x4ad064){_0x32d6da[_0x888c('0x16')](0x194);}return _0x4ad064;};}function handleError(_0xf6c22d,_0x6431f){_0x6431f=_0x6431f||0x1f4;return function(_0x155623){logger[_0x888c('0x26')](_0x155623[_0x888c('0x27')]);if(_0x155623[_0x888c('0x28')]){delete _0x155623[_0x888c('0x28')];}_0xf6c22d[_0x888c('0x17')](_0x6431f)[_0x888c('0x29')](_0x155623);};}exports['index']=function(_0x56779e,_0x48c906){var _0x43d7a9={},_0x80a04e={},_0x1564b2={'count':0x0,'rows':[]};var _0x4c483b=_[_0x888c('0x2a')](db[_0x888c('0x2b')][_0x888c('0x2c')],function(_0x37d67f){return{'name':_0x37d67f[_0x888c('0x2d')],'type':_0x37d67f[_0x888c('0x2e')][_0x888c('0x2f')]};});_0x80a04e[_0x888c('0x30')]=_[_0x888c('0x2a')](_0x4c483b,_0x888c('0x28'));_0x80a04e['query']=_[_0x888c('0x31')](_0x56779e[_0x888c('0x32')]);_0x80a04e[_0x888c('0x33')]=_[_0x888c('0x34')](_0x80a04e[_0x888c('0x30')],_0x80a04e['query']);_0x43d7a9[_0x888c('0x35')]=_[_0x888c('0x34')](_0x80a04e[_0x888c('0x30')],qs[_0x888c('0x36')](_0x56779e['query'][_0x888c('0x36')]));_0x43d7a9[_0x888c('0x35')]=_0x43d7a9[_0x888c('0x35')][_0x888c('0x37')]?_0x43d7a9[_0x888c('0x35')]:_0x80a04e['model'];if(!_0x56779e[_0x888c('0x32')][_0x888c('0x38')](_0x888c('0x39'))){_0x43d7a9[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x56779e[_0x888c('0x32')][_0x888c('0x1b')]);_0x43d7a9[_0x888c('0x19')]=qs['offset'](_0x56779e[_0x888c('0x32')][_0x888c('0x19')]);}_0x43d7a9[_0x888c('0x3a')]=qs['sort'](_0x56779e[_0x888c('0x32')]['sort']);_0x43d7a9[_0x888c('0x3b')]=qs[_0x888c('0x33')](_[_0x888c('0x3c')](_0x56779e['query'],_0x80a04e['filters']),_0x4c483b);if(_0x56779e[_0x888c('0x32')]['filter']){_0x43d7a9[_0x888c('0x3b')]=_[_0x888c('0x3d')](_0x43d7a9['where'],{'$or':_[_0x888c('0x2a')](_0x4c483b,function(_0x4414a9){if(_0x4414a9[_0x888c('0x2e')]!==_0x888c('0x3e')){var _0x4b8ff1={};_0x4b8ff1[_0x4414a9[_0x888c('0x28')]]={'$like':'%'+_0x56779e[_0x888c('0x32')][_0x888c('0x3f')]+'%'};return _0x4b8ff1;}})});}_0x43d7a9=_[_0x888c('0x3d')]({},_0x43d7a9,_0x56779e[_0x888c('0x40')]);var _0x4649c1={'where':_0x43d7a9['where']};return db[_0x888c('0x2b')][_0x888c('0x41')](_0x4649c1)[_0x888c('0x21')](function(_0x852003){_0x1564b2['count']=_0x852003;if(_0x56779e[_0x888c('0x32')][_0x888c('0x42')]){_0x43d7a9['include']=[{'all':!![]}];}return db['Campaign'][_0x888c('0x43')](_0x43d7a9);})[_0x888c('0x21')](function(_0x1e9be3){_0x1564b2[_0x888c('0x44')]=_0x1e9be3;return _0x1564b2;})[_0x888c('0x21')](respondWithFilteredResult(_0x48c906,_0x43d7a9))[_0x888c('0x45')](handleError(_0x48c906,null));};exports[_0x888c('0x46')]=function(_0x3c8fb5,_0x2eb8f6){var _0x3e1169={'raw':![],'where':{'id':_0x3c8fb5[_0x888c('0x47')]['id']}},_0x14c496={};_0x14c496['model']=_['keys'](db['Campaign'][_0x888c('0x2c')]);_0x14c496[_0x888c('0x32')]=_[_0x888c('0x31')](_0x3c8fb5[_0x888c('0x32')]);_0x14c496[_0x888c('0x33')]=_['intersection'](_0x14c496[_0x888c('0x30')],_0x14c496[_0x888c('0x32')]);_0x3e1169[_0x888c('0x35')]=_[_0x888c('0x34')](_0x14c496['model'],qs[_0x888c('0x36')](_0x3c8fb5[_0x888c('0x32')][_0x888c('0x36')]));_0x3e1169[_0x888c('0x35')]=_0x3e1169[_0x888c('0x35')]['length']?_0x3e1169[_0x888c('0x35')]:_0x14c496['model'];if(_0x3c8fb5[_0x888c('0x32')]['includeAll']){_0x3e1169[_0x888c('0x48')]=[{'all':!![]}];}_0x3e1169=_['merge']({},_0x3e1169,_0x3c8fb5[_0x888c('0x40')]);return db[_0x888c('0x2b')][_0x888c('0x49')](_0x3e1169)['then'](handleEntityNotFound(_0x2eb8f6,null))['then'](respondWithResult(_0x2eb8f6,null))[_0x888c('0x45')](handleError(_0x2eb8f6,null));};exports[_0x888c('0x4a')]=function(_0x26ef75,_0xaaa4e5){return db[_0x888c('0x2b')][_0x888c('0x4a')](_0x26ef75[_0x888c('0x4b')],{})[_0x888c('0x21')](function(_0x4a2824){var _0x557817=_0x26ef75[_0x888c('0x4c')][_0x888c('0x4d')]({'plain':!![]});if(!_0x557817)throw new Error(_0x888c('0x4e'));if(_0x557817[_0x888c('0x4f')]===_0x888c('0x4c')){var _0x184285=_0x4a2824['get']({'plain':!![]});var _0x550ab0=_0x888c('0x22');return db[_0x888c('0x50')][_0x888c('0x49')]({'where':{'name':_0x550ab0,'userProfileId':_0x557817[_0x888c('0x51')]},'raw':!![]})[_0x888c('0x21')](function(_0x3c64ec){if(_0x3c64ec&&_0x3c64ec['autoAssociation']===0x0){return db['UserProfileResource'][_0x888c('0x4a')]({'name':_0x184285['name'],'resourceId':_0x184285['id'],'type':_0x3c64ec['name'],'sectionId':_0x3c64ec['id']},{})[_0x888c('0x21')](function(){return _0x4a2824;});}else{return _0x4a2824;}})[_0x888c('0x45')](function(_0x14b207){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14b207);throw _0x14b207;});}return _0x4a2824;})['then'](respondWithResult(_0xaaa4e5,0xc9))[_0x888c('0x45')](handleError(_0xaaa4e5,null));};exports[_0x888c('0x52')]=function(_0x308e5f,_0x55dde0){var _0x40af32={'where':{'id':_0x308e5f['params']['id']}},_0xd5e382={};_0xd5e382['model']=_[_0x888c('0x31')](db[_0x888c('0x2b')][_0x888c('0x2c')]);_0x40af32['attributes']=_['intersection'](_0xd5e382[_0x888c('0x30')],qs[_0x888c('0x36')](_0x308e5f[_0x888c('0x32')]['fields']));_0x40af32[_0x888c('0x35')]=_0x40af32[_0x888c('0x35')][_0x888c('0x37')]?_0x40af32[_0x888c('0x35')]:_0xd5e382[_0x888c('0x30')];if(_0x308e5f['query'][_0x888c('0x42')]){_0x40af32[_0x888c('0x48')]=[{'all':!![]}];}_0x40af32=_[_0x888c('0x3d')]({},_0x40af32,_0x308e5f[_0x888c('0x40')]);return db[_0x888c('0x2b')][_0x888c('0x49')](_0x40af32)[_0x888c('0x21')](handleEntityNotFound(_0x55dde0,null))[_0x888c('0x21')](function(_0x4ea211){if(_0x4ea211){var _0x14322c=_0x4ea211[_0x888c('0x4d')]({'plain':!![]});_0x14322c=qs[_0x888c('0x53')](_0x14322c,['id',_0x888c('0x54'),'updatedAt']);_0x308e5f[_0x888c('0x4b')]=_[_0x888c('0x53')](_0x308e5f['body'],['id','createdAt',_0x888c('0x55')]);return db[_0x888c('0x2b')][_0x888c('0x4a')](_[_0x888c('0x3d')](_0x14322c,_0x308e5f[_0x888c('0x4b')]),{'include':_0x308e5f[_0x888c('0x32')][_0x888c('0x42')]?[{'all':!![]}]:undefined})[_0x888c('0x21')](function(_0x4f3121){var _0x523a20=_0x308e5f['user'][_0x888c('0x4d')]({'plain':!![]});if(!_0x523a20)throw new Error(_0x888c('0x4e'));if(_0x523a20['role']===_0x888c('0x4c')){var _0x1c416a=_0x4f3121[_0x888c('0x4d')]({'plain':!![]});var _0x4ea2bd=_0x888c('0x22');return db[_0x888c('0x50')][_0x888c('0x49')]({'where':{'name':_0x4ea2bd,'userProfileId':_0x523a20[_0x888c('0x51')]},'raw':!![]})['then'](function(_0xdcfa6b){if(_0xdcfa6b&&_0xdcfa6b[_0x888c('0x56')]===0x0){return db['UserProfileResource'][_0x888c('0x4a')]({'name':_0x1c416a[_0x888c('0x28')],'resourceId':_0x1c416a['id'],'type':_0xdcfa6b['name'],'sectionId':_0xdcfa6b['id']},{})['then'](function(){return _0x4f3121;});}else{return _0x4f3121;}})['catch'](function(_0x56dde2){logger[_0x888c('0x26')](_0x888c('0x57'),_0x56dde2);throw _0x56dde2;});}return _0x4f3121;});}})[_0x888c('0x21')](respondWithResult(_0x55dde0,0xc9))['catch'](handleError(_0x55dde0,null));};exports[_0x888c('0x20')]=function(_0x4bc11d,_0x1dc046){if(_0x4bc11d[_0x888c('0x4b')]['id']){delete _0x4bc11d[_0x888c('0x4b')]['id'];}return db['Campaign'][_0x888c('0x49')]({'where':{'id':_0x4bc11d[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x1dc046,null))['then'](saveUpdates(_0x4bc11d[_0x888c('0x4b')],null))['then'](respondWithResult(_0x1dc046,null))[_0x888c('0x45')](handleError(_0x1dc046,null));};exports[_0x888c('0x24')]=function(_0xc28dc2,_0x8aca12){return db[_0x888c('0x2b')]['find']({'where':{'id':_0xc28dc2[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x8aca12,null))[_0x888c('0x21')](removeEntity(_0x8aca12,null))[_0x888c('0x45')](handleError(_0x8aca12,null));};exports[_0x888c('0x58')]=function(_0x36e073,_0x684a41,_0x37ee7c){var _0xd6d0a0={'raw':!![],'where':{}};var _0x171041={};var _0x367b55={'count':0x0,'rows':[]};return db[_0x888c('0x2b')][_0x888c('0x59')]({'where':{'id':_0x36e073[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x684a41,null))[_0x888c('0x21')](function(_0x2d0e5b){if(_0x2d0e5b){_0x171041[_0x888c('0x30')]=_[_0x888c('0x31')](db[_0x888c('0x5a')]['rawAttributes']);_0x171041[_0x888c('0x32')]=_['keys'](_0x36e073[_0x888c('0x32')]);_0x171041[_0x888c('0x33')]=_['intersection'](_0x171041[_0x888c('0x30')],_0x171041[_0x888c('0x32')]);_0xd6d0a0[_0x888c('0x35')]=_[_0x888c('0x34')](_0x171041['model'],qs[_0x888c('0x36')](_0x36e073[_0x888c('0x32')][_0x888c('0x36')]));_0xd6d0a0[_0x888c('0x35')]=_0xd6d0a0[_0x888c('0x35')][_0x888c('0x37')]?_0xd6d0a0[_0x888c('0x35')]:_0x171041['model'];if(!_0x36e073[_0x888c('0x32')][_0x888c('0x38')]('nolimit')){_0xd6d0a0['limit']=qs[_0x888c('0x1b')](_0x36e073[_0x888c('0x32')][_0x888c('0x1b')]);_0xd6d0a0[_0x888c('0x19')]=qs['offset'](_0x36e073['query'][_0x888c('0x19')]);}_0xd6d0a0[_0x888c('0x3a')]=qs[_0x888c('0x5b')](_0x36e073[_0x888c('0x32')]['sort']);_0xd6d0a0[_0x888c('0x3b')]=qs[_0x888c('0x33')](_[_0x888c('0x3c')](_0x36e073['query'],_0x171041[_0x888c('0x33')]));_0xd6d0a0[_0x888c('0x3b')]['CampaignId']=_0x2d0e5b['id'];if(_0x36e073['query']['filter']){_0xd6d0a0[_0x888c('0x3b')]=_[_0x888c('0x3d')](_0xd6d0a0[_0x888c('0x3b')],{'$or':_['map'](_0xd6d0a0['attributes'],function(_0x283b9b){var _0x54ac54={};_0x54ac54[_0x283b9b]={'$like':'%'+_0x36e073[_0x888c('0x32')]['filter']+'%'};return _0x54ac54;})});}_0xd6d0a0=_[_0x888c('0x3d')]({},_0xd6d0a0,_0x36e073[_0x888c('0x40')]);return db['CmHopper'][_0x888c('0x41')]({'where':_0xd6d0a0['where']})[_0x888c('0x21')](function(_0x2f87eb){_0x367b55['count']=_0x2f87eb;if(_0x36e073[_0x888c('0x32')][_0x888c('0x42')]){_0xd6d0a0[_0x888c('0x48')]=[{'all':!![]}];}return db[_0x888c('0x5a')]['findAll'](_0xd6d0a0);})[_0x888c('0x21')](function(_0x130e73){_0x367b55['rows']=_0x130e73;return _0x367b55;});}})['then'](respondWithFilteredResult(_0x684a41,_0xd6d0a0))['catch'](handleError(_0x684a41,null));};exports[_0x888c('0x5c')]=function(_0x1d5611,_0x211e89,_0x3711ec){var _0x445518={'raw':!![],'where':{}};var _0x3a5851={};var _0x4ec620={'count':0x0,'rows':[]};return db[_0x888c('0x2b')]['findOne']({'where':{'id':_0x1d5611[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x211e89,null))[_0x888c('0x21')](function(_0x501ae1){if(_0x501ae1){_0x3a5851[_0x888c('0x30')]=_[_0x888c('0x31')](db['CmHopperHistory']['rawAttributes']);_0x3a5851['query']=_[_0x888c('0x31')](_0x1d5611[_0x888c('0x32')]);_0x3a5851['filters']=_[_0x888c('0x34')](_0x3a5851[_0x888c('0x30')],_0x3a5851[_0x888c('0x32')]);_0x445518['attributes']=_[_0x888c('0x34')](_0x3a5851['model'],qs['fields'](_0x1d5611[_0x888c('0x32')][_0x888c('0x36')]));_0x445518[_0x888c('0x35')]=_0x445518[_0x888c('0x35')][_0x888c('0x37')]?_0x445518[_0x888c('0x35')]:_0x3a5851[_0x888c('0x30')];if(!_0x1d5611[_0x888c('0x32')]['hasOwnProperty'](_0x888c('0x39'))){_0x445518[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x1d5611[_0x888c('0x32')]['limit']);_0x445518['offset']=qs[_0x888c('0x19')](_0x1d5611['query'][_0x888c('0x19')]);}_0x445518['order']=qs[_0x888c('0x5b')](_0x1d5611['query'][_0x888c('0x5b')]);_0x445518[_0x888c('0x3b')]=qs[_0x888c('0x33')](_[_0x888c('0x3c')](_0x1d5611['query'],_0x3a5851[_0x888c('0x33')]));_0x445518[_0x888c('0x3b')]['CampaignId']=_0x501ae1['id'];if(_0x1d5611['query'][_0x888c('0x3f')]){_0x445518[_0x888c('0x3b')]=_['merge'](_0x445518['where'],{'$or':_[_0x888c('0x2a')](_0x445518[_0x888c('0x35')],function(_0x234c6e){var _0x1dffb4={};_0x1dffb4[_0x234c6e]={'$like':'%'+_0x1d5611[_0x888c('0x32')]['filter']+'%'};return _0x1dffb4;})});}_0x445518=_[_0x888c('0x3d')]({},_0x445518,_0x1d5611[_0x888c('0x40')]);return db[_0x888c('0x5d')][_0x888c('0x41')]({'where':_0x445518[_0x888c('0x3b')]})[_0x888c('0x21')](function(_0x42e3dc){_0x4ec620[_0x888c('0x41')]=_0x42e3dc;if(_0x1d5611['query'][_0x888c('0x42')]){_0x445518[_0x888c('0x48')]=[{'all':!![]}];}return db[_0x888c('0x5d')][_0x888c('0x43')](_0x445518);})[_0x888c('0x21')](function(_0x17f275){_0x4ec620['rows']=_0x17f275;return _0x4ec620;});}})[_0x888c('0x21')](respondWithFilteredResult(_0x211e89,_0x445518))[_0x888c('0x45')](handleError(_0x211e89,null));};exports['getHopperFinals']=function(_0x45850b,_0x34e2b7,_0xbf1c29){var _0x5246fc={'raw':!![],'where':{}};var _0x6cc1d1={};var _0x215995={'count':0x0,'rows':[]};return db[_0x888c('0x2b')][_0x888c('0x59')]({'where':{'id':_0x45850b[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x34e2b7,null))[_0x888c('0x21')](function(_0x55f319){if(_0x55f319){_0x6cc1d1[_0x888c('0x30')]=_[_0x888c('0x31')](db[_0x888c('0x5e')][_0x888c('0x2c')]);_0x6cc1d1[_0x888c('0x32')]=_[_0x888c('0x31')](_0x45850b['query']);_0x6cc1d1[_0x888c('0x33')]=_['intersection'](_0x6cc1d1[_0x888c('0x30')],_0x6cc1d1[_0x888c('0x32')]);_0x5246fc[_0x888c('0x35')]=_[_0x888c('0x34')](_0x6cc1d1[_0x888c('0x30')],qs['fields'](_0x45850b['query'][_0x888c('0x36')]));_0x5246fc[_0x888c('0x35')]=_0x5246fc['attributes'][_0x888c('0x37')]?_0x5246fc[_0x888c('0x35')]:_0x6cc1d1[_0x888c('0x30')];if(!_0x45850b[_0x888c('0x32')]['hasOwnProperty'](_0x888c('0x39'))){_0x5246fc[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x45850b[_0x888c('0x32')]['limit']);_0x5246fc[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x45850b[_0x888c('0x32')][_0x888c('0x19')]);}_0x5246fc[_0x888c('0x3a')]=qs[_0x888c('0x5b')](_0x45850b[_0x888c('0x32')][_0x888c('0x5b')]);_0x5246fc[_0x888c('0x3b')]=qs['filters'](_[_0x888c('0x3c')](_0x45850b[_0x888c('0x32')],_0x6cc1d1['filters']));_0x5246fc[_0x888c('0x3b')]['CampaignId']=_0x55f319['id'];if(_0x45850b[_0x888c('0x32')][_0x888c('0x3f')]){_0x5246fc[_0x888c('0x3b')]=_[_0x888c('0x3d')](_0x5246fc['where'],{'$or':_[_0x888c('0x2a')](_0x5246fc['attributes'],function(_0x36e0f1){var _0x3af968={};_0x3af968[_0x36e0f1]={'$like':'%'+_0x45850b[_0x888c('0x32')][_0x888c('0x3f')]+'%'};return _0x3af968;})});}_0x5246fc=_[_0x888c('0x3d')]({},_0x5246fc,_0x45850b[_0x888c('0x40')]);return db[_0x888c('0x5e')]['count']({'where':_0x5246fc[_0x888c('0x3b')]})[_0x888c('0x21')](function(_0x12af53){_0x215995[_0x888c('0x41')]=_0x12af53;if(_0x45850b['query']['includeAll']){_0x5246fc[_0x888c('0x48')]=[{'all':!![]}];}return db[_0x888c('0x5e')]['findAll'](_0x5246fc);})[_0x888c('0x21')](function(_0x193240){_0x215995[_0x888c('0x44')]=_0x193240;return _0x215995;});}})[_0x888c('0x21')](respondWithFilteredResult(_0x34e2b7,_0x5246fc))['catch'](handleError(_0x34e2b7,null));};exports[_0x888c('0x5f')]=function(_0x28a042,_0x4a2201,_0x46c69){var _0x75a5f0={'raw':!![],'where':{}};var _0x3f566a={};var _0x164dd4={'count':0x0,'rows':[]};return db[_0x888c('0x2b')][_0x888c('0x59')]({'where':{'id':_0x28a042['params']['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x4a2201,null))[_0x888c('0x21')](function(_0x12bd1e){if(_0x12bd1e){_0x3f566a[_0x888c('0x30')]=_[_0x888c('0x31')](db[_0x888c('0x60')][_0x888c('0x2c')]);_0x3f566a[_0x888c('0x32')]=_[_0x888c('0x31')](_0x28a042[_0x888c('0x32')]);_0x3f566a[_0x888c('0x33')]=_[_0x888c('0x34')](_0x3f566a[_0x888c('0x30')],_0x3f566a[_0x888c('0x32')]);_0x75a5f0[_0x888c('0x35')]=_[_0x888c('0x34')](_0x3f566a[_0x888c('0x30')],qs[_0x888c('0x36')](_0x28a042['query'][_0x888c('0x36')]));_0x75a5f0[_0x888c('0x35')]=_0x75a5f0['attributes'][_0x888c('0x37')]?_0x75a5f0[_0x888c('0x35')]:_0x3f566a[_0x888c('0x30')];if(!_0x28a042[_0x888c('0x32')]['hasOwnProperty'](_0x888c('0x39'))){_0x75a5f0[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x28a042[_0x888c('0x32')][_0x888c('0x1b')]);_0x75a5f0[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x28a042[_0x888c('0x32')][_0x888c('0x19')]);}_0x75a5f0['order']=qs[_0x888c('0x5b')](_0x28a042[_0x888c('0x32')]['sort']);_0x75a5f0[_0x888c('0x3b')]=qs['filters'](_['pick'](_0x28a042[_0x888c('0x32')],_0x3f566a[_0x888c('0x33')]));_0x75a5f0[_0x888c('0x3b')][_0x888c('0x61')]=_0x12bd1e['id'];if(_0x28a042[_0x888c('0x32')][_0x888c('0x3f')]){_0x75a5f0['where']=_[_0x888c('0x3d')](_0x75a5f0[_0x888c('0x3b')],{'$or':_[_0x888c('0x2a')](_0x75a5f0[_0x888c('0x35')],function(_0x52f6ab){var _0x11834f={};_0x11834f[_0x52f6ab]={'$like':'%'+_0x28a042[_0x888c('0x32')][_0x888c('0x3f')]+'%'};return _0x11834f;})});}_0x75a5f0=_[_0x888c('0x3d')]({},_0x75a5f0,_0x28a042[_0x888c('0x40')]);return db[_0x888c('0x60')][_0x888c('0x41')]({'where':_0x75a5f0[_0x888c('0x3b')]})[_0x888c('0x21')](function(_0x578f1b){_0x164dd4['count']=_0x578f1b;if(_0x28a042[_0x888c('0x32')][_0x888c('0x42')]){_0x75a5f0['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x888c('0x43')](_0x75a5f0);})[_0x888c('0x21')](function(_0x128620){_0x164dd4[_0x888c('0x44')]=_0x128620;return _0x164dd4;});}})[_0x888c('0x21')](respondWithFilteredResult(_0x4a2201,_0x75a5f0))[_0x888c('0x45')](handleError(_0x4a2201,null));};exports['getLists']=function(_0xcce80f,_0x1d60aa,_0x53b2ac){var _0x3bb8e2={};var _0x3dbaf3={};var _0x46fda5;var _0x18a9a6;return db['Campaign'][_0x888c('0x59')]({'where':{'id':_0xcce80f[_0x888c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d60aa,null))[_0x888c('0x21')](function(_0x22d18b){if(_0x22d18b){_0x46fda5=_0x22d18b;_0x3dbaf3[_0x888c('0x30')]=_[_0x888c('0x31')](db[_0x888c('0x62')]['rawAttributes']);_0x3dbaf3[_0x888c('0x32')]=_[_0x888c('0x31')](_0xcce80f['query']);_0x3dbaf3['filters']=_[_0x888c('0x34')](_0x3dbaf3['model'],_0x3dbaf3[_0x888c('0x32')]);_0x3bb8e2[_0x888c('0x35')]=_[_0x888c('0x34')](_0x3dbaf3['model'],qs[_0x888c('0x36')](_0xcce80f[_0x888c('0x32')]['fields']));_0x3bb8e2[_0x888c('0x35')]=_0x3bb8e2[_0x888c('0x35')][_0x888c('0x37')]?_0x3bb8e2[_0x888c('0x35')]:_0x3dbaf3[_0x888c('0x30')];_0x3bb8e2[_0x888c('0x3a')]=qs['sort'](_0xcce80f[_0x888c('0x32')]['sort']);_0x3bb8e2[_0x888c('0x3b')]=qs[_0x888c('0x33')](_[_0x888c('0x3c')](_0xcce80f[_0x888c('0x32')],_0x3dbaf3[_0x888c('0x33')]));if(_0xcce80f['query']['filter']){_0x3bb8e2[_0x888c('0x3b')]=_['merge'](_0x3bb8e2[_0x888c('0x3b')],{'$or':_[_0x888c('0x2a')](_0x3bb8e2['attributes'],function(_0x4ea8d2){var _0x1763bf={};_0x1763bf[_0x4ea8d2]={'$like':'%'+_0xcce80f[_0x888c('0x32')][_0x888c('0x3f')]+'%'};return _0x1763bf;})});}_0x3bb8e2=_[_0x888c('0x3d')]({},_0x3bb8e2,_0xcce80f[_0x888c('0x40')]);return _0x46fda5[_0x888c('0x63')](_0x3bb8e2);}})['then'](function(_0x1a8f5f){if(_0x1a8f5f){_0x18a9a6=_0x1a8f5f[_0x888c('0x37')];if(!_0xcce80f[_0x888c('0x32')][_0x888c('0x38')]('nolimit')){_0x3bb8e2[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0xcce80f['query']['limit']);_0x3bb8e2['offset']=qs[_0x888c('0x19')](_0xcce80f[_0x888c('0x32')]['offset']);}return _0x46fda5[_0x888c('0x63')](_0x3bb8e2);}})[_0x888c('0x21')](function(_0x1c1104){if(_0x1c1104){return _0x1c1104?{'count':_0x18a9a6,'rows':_0x1c1104}:null;}})[_0x888c('0x21')](respondWithResult(_0x1d60aa,null))['catch'](handleError(_0x1d60aa,null));};exports[_0x888c('0x64')]=function(_0x385732,_0x28be34,_0x2445e5){var _0x565558,_0xe354be;var _0x248ed5=[];var _0x495246=moment()[_0x888c('0x65')](_0x888c('0x66'));return db['Campaign'][_0x888c('0x49')]({'where':{'id':_0x385732['params']['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x28be34,null))['then'](function(_0x3b9fc4){if(_0x3b9fc4){_0xe354be=_0x3b9fc4;return _0x3b9fc4[_0x888c('0x64')](_0x385732[_0x888c('0x4b')][_0x888c('0x67')],_[_0x888c('0x53')](_0x385732['body'],[_0x888c('0x67'),'id'])||{});}return null;})[_0x888c('0x68')](function(_0x3ec045){var _0x5422bb;var _0xab63e8;_0x565558=_0x3ec045||[];var _0x3ac5d2=[];if(_0x3ec045){for(var _0x4f9e9f=0x0;_0x4f9e9f<_0x3ec045[_0x888c('0x37')];_0x4f9e9f+=0x1){var _0x138d4b=_0x3ec045[_0x4f9e9f]['get']({'plain':!![]});_0xe354be['dialCheckDuplicateType']=_0x385732[_0x888c('0x4b')][_0x888c('0x69')]?_0x385732[_0x888c('0x4b')][_0x888c('0x69')]:_0xe354be[_0x888c('0x69')];switch(_0xe354be[_0x888c('0x69')]){case _0x888c('0x6a'):_0x5422bb=squel[_0x888c('0x6b')]()[_0x888c('0x6c')]('cm_hopper')['fromQuery']([_0x888c('0x6d'),_0x888c('0x6e'),_0x888c('0x6f'),_0x888c('0x70'),_0x888c('0x61'),'createdAt',_0x888c('0x55')],squel['select']()[_0x888c('0x71')](_0x888c('0x6d'),_0x888c('0x6d'))[_0x888c('0x71')](_0x888c('0x72'),_0x888c('0x6e'))[_0x888c('0x71')]('id',_0x888c('0x6f'))[_0x888c('0x71')](_0x138d4b[_0x888c('0x73')]['toString'](),_0x888c('0x70'))[_0x888c('0x71')](_0x385732['params']['id'][_0x888c('0x74')](),_0x888c('0x61'))['field']('\x27'+_0x495246+'\x27',_0x888c('0x54'))[_0x888c('0x71')]('\x27'+_0x495246+'\x27',_0x888c('0x55'))[_0x888c('0x75')](_0x888c('0x76'))[_0x888c('0x3b')](_0x888c('0x77'))[_0x888c('0x3b')](_0x888c('0x78'),_0x138d4b['CmListId'][_0x888c('0x74')]())[_0x888c('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x888c('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x888c('0x79')]()[_0x888c('0x71')](_0x888c('0x7a'))[_0x888c('0x75')](_0x888c('0x7b'))['where'](_0x888c('0x7c'),_0x385732['params']['id'][_0x888c('0x74')]()))[_0x888c('0x3b')](_0x888c('0x7d'),squel[_0x888c('0x79')]()[_0x888c('0x71')](_0x888c('0x7e'))[_0x888c('0x75')](_0x888c('0x7f'))[_0x888c('0x3b')](_0x888c('0x7c'),_0x385732[_0x888c('0x47')]['id'][_0x888c('0x74')]())))[_0x888c('0x74')]();break;case'onlyIfOpen':_0x5422bb=squel[_0x888c('0x6b')]()[_0x888c('0x6c')](_0x888c('0x7f'))['fromQuery']([_0x888c('0x6d'),'scheduledAt','ContactId','ListId',_0x888c('0x61'),'createdAt',_0x888c('0x55')],squel[_0x888c('0x79')]()[_0x888c('0x71')](_0x888c('0x6d'),_0x888c('0x6d'))[_0x888c('0x71')]('NOW()','scheduledAt')['field']('id',_0x888c('0x6f'))[_0x888c('0x71')](_0x138d4b[_0x888c('0x73')][_0x888c('0x74')](),'ListId')[_0x888c('0x71')](_0x385732['params']['id'][_0x888c('0x74')](),'CampaignId')['field']('\x27'+_0x495246+'\x27','createdAt')[_0x888c('0x71')]('\x27'+_0x495246+'\x27','updatedAt')['from'](_0x888c('0x76'))[_0x888c('0x3b')](_0x888c('0x77'))['where'](_0x888c('0x78'),_0x138d4b[_0x888c('0x73')]['toString']())[_0x888c('0x3b')](_0x888c('0x80'))[_0x888c('0x3b')](_0x888c('0x7d'),squel[_0x888c('0x79')]()[_0x888c('0x71')](_0x888c('0x7e'))[_0x888c('0x75')](_0x888c('0x7f'))['where'](_0x888c('0x7c'),_0x385732['params']['id'][_0x888c('0x74')]())))[_0x888c('0x74')]();break;default:_0x5422bb=squel[_0x888c('0x6b')]()[_0x888c('0x6c')](_0x888c('0x7f'))[_0x888c('0x81')]([_0x888c('0x6d'),_0x888c('0x6e'),'ContactId',_0x888c('0x70'),_0x888c('0x61'),'createdAt',_0x888c('0x55')],squel[_0x888c('0x79')]()[_0x888c('0x71')](_0x888c('0x6d'),_0x888c('0x6d'))['field'](_0x888c('0x72'),_0x888c('0x6e'))['field']('id',_0x888c('0x6f'))[_0x888c('0x71')](_0x138d4b['CmListId'][_0x888c('0x74')](),'ListId')[_0x888c('0x71')](_0x385732[_0x888c('0x47')]['id'][_0x888c('0x74')](),_0x888c('0x61'))[_0x888c('0x71')]('\x27'+_0x495246+'\x27',_0x888c('0x54'))[_0x888c('0x71')]('\x27'+_0x495246+'\x27','updatedAt')['from'](_0x888c('0x76'))[_0x888c('0x3b')](_0x888c('0x77'))['where']('ListId\x20=\x20?',_0x138d4b['CmListId'][_0x888c('0x74')]())[_0x888c('0x3b')](_0x888c('0x80')))[_0x888c('0x74')]();}_0xab63e8=squel['insert']()[_0x888c('0x6c')](_0x888c('0x82'))[_0x888c('0x81')](['cmHopperId',_0x888c('0x6e'),_0x888c('0x6d'),'OrderBy',_0x888c('0x54'),_0x888c('0x55')],squel[_0x888c('0x79')]()[_0x888c('0x71')]('h.id','id')[_0x888c('0x71')](_0x888c('0x72'),'scheduledAt')[_0x888c('0x71')](_0x888c('0x83'),_0x888c('0x6d'))[_0x888c('0x71')]('ci.OrderBY','OrderBy')[_0x888c('0x71')]('\x27'+_0x495246+'\x27','createdAt')[_0x888c('0x71')]('\x27'+_0x495246+'\x27',_0x888c('0x55'))[_0x888c('0x75')](_0x888c('0x84'),'ci')[_0x888c('0x85')]('cm_hopper','h',_0x888c('0x86'))[_0x888c('0x3b')](_0x888c('0x87'),_0x138d4b[_0x888c('0x73')][_0x888c('0x74')]())[_0x888c('0x3b')]('h.CampaignId=?',_0x385732['params']['id']['toString']())['where']('h.createdAt\x20=\x20?',_0x495246))[_0x888c('0x74')]();_0x3ac5d2[_0x888c('0x88')](db[_0x888c('0x89')][_0x888c('0x32')](_0x5422bb));_0x248ed5[_0x888c('0x88')](db[_0x888c('0x89')][_0x888c('0x32')](_0xab63e8));}return BPromise['all'](_0x3ac5d2);}})[_0x888c('0x21')](function(){return BPromise['all'](_0x248ed5);})[_0x888c('0x21')](function(){return _0x565558;})[_0x888c('0x21')](respondWithResult(_0x28be34,null))[_0x888c('0x45')](handleError(_0x28be34,null));};exports[_0x888c('0x8a')]=function(_0x32f546,_0x3513ac,_0x5b0fca){return db[_0x888c('0x2b')][_0x888c('0x49')]({'where':{'id':_0x32f546[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x3513ac,null))[_0x888c('0x21')](function(_0x2e6a39){if(_0x2e6a39){return _0x2e6a39['removeLists'](_0x32f546[_0x888c('0x32')][_0x888c('0x67')]);}})['then'](function(_0x559fbf){if(_0x559fbf){return db[_0x888c('0x5a')][_0x888c('0x24')]({'where':{'ListId':_0x32f546[_0x888c('0x32')][_0x888c('0x67')],'CampaignId':_0x32f546[_0x888c('0x47')]['id']}})[_0x888c('0x21')](function(){return _0x559fbf;});}})['then'](respondWithStatusCode(_0x3513ac,null))[_0x888c('0x45')](handleError(_0x3513ac,null));};exports[_0x888c('0x8b')]=function(_0x41edaa,_0x153987,_0x1c918f){var _0x30e25f={};var _0x5f22ba={};var _0x711026;var _0x599111;return db[_0x888c('0x2b')]['findOne']({'where':{'id':_0x41edaa[_0x888c('0x47')]['id']}})['then'](handleEntityNotFound(_0x153987,null))[_0x888c('0x21')](function(_0x5ead9d){if(_0x5ead9d){_0x711026=_0x5ead9d;_0x5f22ba[_0x888c('0x30')]=_[_0x888c('0x31')](db[_0x888c('0x62')][_0x888c('0x2c')]);_0x5f22ba[_0x888c('0x32')]=_[_0x888c('0x31')](_0x41edaa['query']);_0x5f22ba[_0x888c('0x33')]=_[_0x888c('0x34')](_0x5f22ba[_0x888c('0x30')],_0x5f22ba['query']);_0x30e25f[_0x888c('0x35')]=_[_0x888c('0x34')](_0x5f22ba[_0x888c('0x30')],qs[_0x888c('0x36')](_0x41edaa[_0x888c('0x32')][_0x888c('0x36')]));_0x30e25f[_0x888c('0x35')]=_0x30e25f[_0x888c('0x35')][_0x888c('0x37')]?_0x30e25f[_0x888c('0x35')]:_0x5f22ba[_0x888c('0x30')];_0x30e25f[_0x888c('0x3a')]=qs['sort'](_0x41edaa[_0x888c('0x32')][_0x888c('0x5b')]);_0x30e25f['where']=qs[_0x888c('0x33')](_[_0x888c('0x3c')](_0x41edaa['query'],_0x5f22ba[_0x888c('0x33')]));if(_0x41edaa[_0x888c('0x32')][_0x888c('0x3f')]){_0x30e25f[_0x888c('0x3b')]=_['merge'](_0x30e25f[_0x888c('0x3b')],{'$or':_[_0x888c('0x2a')](_0x30e25f[_0x888c('0x35')],function(_0x486f7a){var _0x382b04={};_0x382b04[_0x486f7a]={'$like':'%'+_0x41edaa[_0x888c('0x32')][_0x888c('0x3f')]+'%'};return _0x382b04;})});}_0x30e25f=_[_0x888c('0x3d')]({},_0x30e25f,_0x41edaa[_0x888c('0x40')]);return _0x711026[_0x888c('0x8b')](_0x30e25f);}})[_0x888c('0x21')](function(_0x5b6e28){if(_0x5b6e28){_0x599111=_0x5b6e28[_0x888c('0x37')];if(!_0x41edaa[_0x888c('0x32')][_0x888c('0x38')](_0x888c('0x39'))){_0x30e25f[_0x888c('0x1b')]=qs[_0x888c('0x1b')](_0x41edaa[_0x888c('0x32')][_0x888c('0x1b')]);_0x30e25f[_0x888c('0x19')]=qs['offset'](_0x41edaa[_0x888c('0x32')][_0x888c('0x19')]);}return _0x711026[_0x888c('0x8b')](_0x30e25f);}})[_0x888c('0x21')](function(_0x1bc54a){if(_0x1bc54a){return _0x1bc54a?{'count':_0x599111,'rows':_0x1bc54a}:null;}})['then'](respondWithResult(_0x153987,null))['catch'](handleError(_0x153987,null));};exports[_0x888c('0x8c')]=function(_0x1ea3b4,_0x40c024,_0x3300e4){var _0x51e381,_0x1407d2;var _0x2a91ba=[];var _0x4ca94f=moment()[_0x888c('0x65')](_0x888c('0x66'));return db[_0x888c('0x2b')][_0x888c('0x49')]({'where':{'id':_0x1ea3b4[_0x888c('0x47')]['id']}})['then'](handleEntityNotFound(_0x40c024,null))[_0x888c('0x21')](function(_0x25fa97){if(_0x25fa97){_0x1407d2=_0x25fa97;return _0x25fa97[_0x888c('0x8c')](_0x1ea3b4[_0x888c('0x4b')][_0x888c('0x67')],_[_0x888c('0x53')](_0x1ea3b4[_0x888c('0x4b')],['ids','id'])||{});}return null;})[_0x888c('0x68')](function(_0x37ae5e){var _0x1c4f1c;var _0x532ba0;_0x51e381=_0x37ae5e||[];var _0xd50cd8=[];if(_0x37ae5e){for(var _0x3bdd15=0x0;_0x3bdd15<_0x37ae5e['length'];_0x3bdd15+=0x1){var _0x4e9a2d=_0x37ae5e[_0x3bdd15][_0x888c('0x4d')]({'plain':!![]});_0x1c4f1c=squel[_0x888c('0x6b')]()[_0x888c('0x6c')](_0x888c('0x8d'))[_0x888c('0x81')]([_0x888c('0x6d'),'ContactId','ListId',_0x888c('0x61'),'createdAt',_0x888c('0x55')],squel['select']()[_0x888c('0x71')](_0x888c('0x6d'),_0x888c('0x6d'))[_0x888c('0x71')]('id',_0x888c('0x6f'))[_0x888c('0x71')](_0x4e9a2d[_0x888c('0x73')][_0x888c('0x74')](),_0x888c('0x70'))[_0x888c('0x71')](_0x1ea3b4[_0x888c('0x47')]['id'][_0x888c('0x74')](),_0x888c('0x61'))[_0x888c('0x71')]('NOW()',_0x888c('0x54'))['field'](_0x888c('0x72'),_0x888c('0x55'))['from'](_0x888c('0x76'))['where']('deletedAt\x20IS\x20NULL')[_0x888c('0x3b')](_0x888c('0x78'),_0x4e9a2d[_0x888c('0x73')][_0x888c('0x74')]())[_0x888c('0x3b')](_0x888c('0x80')))['toString']();_0xd50cd8[_0x888c('0x88')](db['sequelize']['query'](_0x1c4f1c));}return BPromise[_0x888c('0x8e')](_0xd50cd8);}})['then'](function(){return _0x51e381;})['then'](respondWithResult(_0x40c024,null))['catch'](handleError(_0x40c024,null));};exports[_0x888c('0x8f')]=function(_0x3cc3a1,_0x2a5fa9,_0x3881a5){return db[_0x888c('0x2b')][_0x888c('0x49')]({'where':{'id':_0x3cc3a1[_0x888c('0x47')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x2a5fa9,null))[_0x888c('0x21')](function(_0xd5cd7f){if(_0xd5cd7f){return _0xd5cd7f[_0x888c('0x8f')](_0x3cc3a1[_0x888c('0x32')][_0x888c('0x67')]);}})['then'](function(_0x217c79){if(_0x217c79){return db['CmHopperBlack'][_0x888c('0x24')]({'where':{'ListId':_0x3cc3a1['query'][_0x888c('0x67')],'CampaignId':_0x3cc3a1[_0x888c('0x47')]['id']}})[_0x888c('0x21')](function(){return _0x217c79;});}})[_0x888c('0x21')](respondWithStatusCode(_0x2a5fa9,null))['catch'](handleError(_0x2a5fa9,null));}; \ No newline at end of file +var _0x91ab=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','keys','intersection','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','omit','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','findAll','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','ids','spread','dialCheckDuplicateType','into','fromQuery','phone','scheduledAt','ContactId','field','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CmListId','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x91ab,0x7b));var _0xb91a=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x91ab[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb91a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb91a('0x1'));var rp=require(_0xb91a('0x2'));var moment=require(_0xb91a('0x3'));var BPromise=require(_0xb91a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb91a('0x5'));var sox=require('sox');var csv=require(_0xb91a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb91a('0x7'));var squel=require('squel');var crypto=require(_0xb91a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb91a('0x9'));var toCsv=require(_0xb91a('0x6'));var querystring=require(_0xb91a('0xa'));var Papa=require('papaparse');var Redis=require(_0xb91a('0xb'));var authService=require(_0xb91a('0xc'));var qs=require(_0xb91a('0xd'));var as=require(_0xb91a('0xe'));var hardwareService=require(_0xb91a('0xf'));var logger=require('../../config/logger')(_0xb91a('0x10'));var utils=require('../../config/utils');var config=require(_0xb91a('0x11'));var licenseUtil=require(_0xb91a('0x12'));var db=require(_0xb91a('0x13'))['db'];function respondWithStatusCode(_0x577f4b,_0x122fc1){_0x122fc1=_0x122fc1||0xcc;return function(_0x26deb1){if(_0x26deb1){return _0x577f4b[_0xb91a('0x14')](_0x122fc1);}return _0x577f4b[_0xb91a('0x15')](_0x122fc1)[_0xb91a('0x16')]();};}function respondWithResult(_0x321b3f,_0x2f1939){_0x2f1939=_0x2f1939||0xc8;return function(_0x108713){if(_0x108713){return _0x321b3f['status'](_0x2f1939)['json'](_0x108713);}};}function respondWithFilteredResult(_0x28a218,_0x584f6c){return function(_0x4366c5){if(_0x4366c5){var _0x3b154c=typeof _0x584f6c[_0xb91a('0x17')]==='undefined'&&typeof _0x584f6c[_0xb91a('0x18')]===_0xb91a('0x19');var _0x111e08=_0x4366c5['count'];var _0x3bdade=_0x3b154c?0x0:_0x584f6c[_0xb91a('0x17')];var _0x15e54e=_0x3b154c?_0x4366c5[_0xb91a('0x1a')]:_0x584f6c[_0xb91a('0x17')]+_0x584f6c['limit'];var _0x33d491;if(_0x15e54e>=_0x111e08){_0x15e54e=_0x111e08;_0x33d491=0xc8;}else{_0x33d491=0xce;}_0x28a218[_0xb91a('0x15')](_0x33d491);return _0x28a218[_0xb91a('0x1b')](_0xb91a('0x1c'),_0x3bdade+'-'+_0x15e54e+'/'+_0x111e08)['json'](_0x4366c5);}return null;};}function patchUpdates(_0x5e62b6){return function(_0x31e5a8){try{jsonpatch[_0xb91a('0x1d')](_0x31e5a8,_0x5e62b6,!![]);}catch(_0x3ca17e){return BPromise['reject'](_0x3ca17e);}return _0x31e5a8[_0xb91a('0x1e')]();};}function saveUpdates(_0x1a9b33,_0x9cca7e){return function(_0x42b565){if(_0x42b565){return _0x42b565[_0xb91a('0x1f')](_0x1a9b33)[_0xb91a('0x20')](function(_0x5d23dd){return _0x5d23dd;});}return null;};}function removeEntity(_0x54ca8,_0xaaa7b5){return function(_0x2a4a8b){if(_0x2a4a8b){return _0x2a4a8b[_0xb91a('0x21')]()['then'](function(){var _0x1e001a=_0x2a4a8b['get']({'plain':!![]});var _0x1478a0=_0xb91a('0x22');return db[_0xb91a('0x23')][_0xb91a('0x21')]({'where':{'type':_0x1478a0,'resourceId':_0x1e001a['id']}})[_0xb91a('0x20')](function(){return _0x2a4a8b;});})[_0xb91a('0x20')](function(){_0x54ca8[_0xb91a('0x15')](0xcc)[_0xb91a('0x16')]();});}};}function handleEntityNotFound(_0x374a4b,_0x1e5e6c){return function(_0x1d9a92){if(!_0x1d9a92){_0x374a4b[_0xb91a('0x14')](0x194);}return _0x1d9a92;};}function handleError(_0x3be1f5,_0x469384){_0x469384=_0x469384||0x1f4;return function(_0x2570ac){logger[_0xb91a('0x24')](_0x2570ac[_0xb91a('0x25')]);if(_0x2570ac[_0xb91a('0x26')]){delete _0x2570ac[_0xb91a('0x26')];}_0x3be1f5[_0xb91a('0x15')](_0x469384)[_0xb91a('0x27')](_0x2570ac);};}exports['index']=function(_0x31682c,_0x366519){var _0x2e51fd={},_0x4c492a={},_0x1bcaa9={'count':0x0,'rows':[]};var _0xaa41e2=_[_0xb91a('0x28')](db[_0xb91a('0x29')][_0xb91a('0x2a')],function(_0x4aa031){return{'name':_0x4aa031['fieldName'],'type':_0x4aa031[_0xb91a('0x2b')][_0xb91a('0x2c')]};});_0x4c492a[_0xb91a('0x2d')]=_['map'](_0xaa41e2,_0xb91a('0x26'));_0x4c492a[_0xb91a('0x2e')]=_['keys'](_0x31682c[_0xb91a('0x2e')]);_0x4c492a[_0xb91a('0x2f')]=_['intersection'](_0x4c492a['model'],_0x4c492a[_0xb91a('0x2e')]);_0x2e51fd[_0xb91a('0x30')]=_['intersection'](_0x4c492a[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x31682c['query'][_0xb91a('0x31')]));_0x2e51fd[_0xb91a('0x30')]=_0x2e51fd[_0xb91a('0x30')]['length']?_0x2e51fd['attributes']:_0x4c492a[_0xb91a('0x2d')];if(!_0x31682c[_0xb91a('0x2e')][_0xb91a('0x32')](_0xb91a('0x33'))){_0x2e51fd[_0xb91a('0x18')]=qs[_0xb91a('0x18')](_0x31682c['query'][_0xb91a('0x18')]);_0x2e51fd[_0xb91a('0x17')]=qs['offset'](_0x31682c['query'][_0xb91a('0x17')]);}_0x2e51fd[_0xb91a('0x34')]=qs['sort'](_0x31682c[_0xb91a('0x2e')][_0xb91a('0x35')]);_0x2e51fd[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0x31682c[_0xb91a('0x2e')],_0x4c492a['filters']),_0xaa41e2);if(_0x31682c[_0xb91a('0x2e')]['filter']){_0x2e51fd[_0xb91a('0x36')]=_[_0xb91a('0x38')](_0x2e51fd[_0xb91a('0x36')],{'$or':_[_0xb91a('0x28')](_0xaa41e2,function(_0x4f017c){if(_0x4f017c[_0xb91a('0x2b')]!==_0xb91a('0x39')){var _0x34f129={};_0x34f129[_0x4f017c['name']]={'$like':'%'+_0x31682c[_0xb91a('0x2e')][_0xb91a('0x3a')]+'%'};return _0x34f129;}})});}_0x2e51fd=_[_0xb91a('0x38')]({},_0x2e51fd,_0x31682c[_0xb91a('0x3b')]);var _0x29ae29={'where':_0x2e51fd[_0xb91a('0x36')]};return db[_0xb91a('0x29')][_0xb91a('0x1a')](_0x29ae29)[_0xb91a('0x20')](function(_0x2eefc3){_0x1bcaa9[_0xb91a('0x1a')]=_0x2eefc3;if(_0x31682c[_0xb91a('0x2e')]['includeAll']){_0x2e51fd[_0xb91a('0x3c')]=[{'all':!![]}];}return db[_0xb91a('0x29')]['findAll'](_0x2e51fd);})['then'](function(_0x576207){_0x1bcaa9[_0xb91a('0x3d')]=_0x576207;return _0x1bcaa9;})[_0xb91a('0x20')](respondWithFilteredResult(_0x366519,_0x2e51fd))[_0xb91a('0x3e')](handleError(_0x366519,null));};exports['show']=function(_0x35afea,_0x212957){var _0x5ddcc1={'raw':![],'where':{'id':_0x35afea['params']['id']}},_0x2c3673={};_0x2c3673['model']=_[_0xb91a('0x3f')](db[_0xb91a('0x29')][_0xb91a('0x2a')]);_0x2c3673['query']=_[_0xb91a('0x3f')](_0x35afea[_0xb91a('0x2e')]);_0x2c3673[_0xb91a('0x2f')]=_['intersection'](_0x2c3673[_0xb91a('0x2d')],_0x2c3673['query']);_0x5ddcc1[_0xb91a('0x30')]=_[_0xb91a('0x40')](_0x2c3673[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x35afea[_0xb91a('0x2e')]['fields']));_0x5ddcc1[_0xb91a('0x30')]=_0x5ddcc1[_0xb91a('0x30')][_0xb91a('0x41')]?_0x5ddcc1[_0xb91a('0x30')]:_0x2c3673[_0xb91a('0x2d')];if(_0x35afea[_0xb91a('0x2e')]['includeAll']){_0x5ddcc1['include']=[{'all':!![]}];}_0x5ddcc1=_[_0xb91a('0x38')]({},_0x5ddcc1,_0x35afea[_0xb91a('0x3b')]);return db['Campaign'][_0xb91a('0x42')](_0x5ddcc1)[_0xb91a('0x20')](handleEntityNotFound(_0x212957,null))[_0xb91a('0x20')](respondWithResult(_0x212957,null))[_0xb91a('0x3e')](handleError(_0x212957,null));};exports[_0xb91a('0x43')]=function(_0x3d23f1,_0x11b90c){return db[_0xb91a('0x29')][_0xb91a('0x43')](_0x3d23f1[_0xb91a('0x44')],{})[_0xb91a('0x20')](function(_0xc29074){var _0x132fab=_0x3d23f1['user'][_0xb91a('0x45')]({'plain':!![]});if(!_0x132fab)throw new Error(_0xb91a('0x46'));if(_0x132fab['role']==='user'){var _0xe0b630=_0xc29074['get']({'plain':!![]});var _0x1d0c53=_0xb91a('0x22');return db[_0xb91a('0x47')][_0xb91a('0x42')]({'where':{'name':_0x1d0c53,'userProfileId':_0x132fab[_0xb91a('0x48')]},'raw':!![]})[_0xb91a('0x20')](function(_0x20cdfe){if(_0x20cdfe&&_0x20cdfe[_0xb91a('0x49')]===0x0){return db[_0xb91a('0x23')][_0xb91a('0x43')]({'name':_0xe0b630[_0xb91a('0x26')],'resourceId':_0xe0b630['id'],'type':_0x20cdfe[_0xb91a('0x26')],'sectionId':_0x20cdfe['id']},{})[_0xb91a('0x20')](function(){return _0xc29074;});}else{return _0xc29074;}})[_0xb91a('0x3e')](function(_0x93fd8d){logger[_0xb91a('0x24')](_0xb91a('0x4a'),_0x93fd8d);throw _0x93fd8d;});}return _0xc29074;})[_0xb91a('0x20')](respondWithResult(_0x11b90c,0xc9))[_0xb91a('0x3e')](handleError(_0x11b90c,null));};exports['clone']=function(_0x4c401e,_0x25a9aa){var _0x376a0e={'where':{'id':_0x4c401e[_0xb91a('0x4b')]['id']}},_0x22f9a2={};_0x22f9a2[_0xb91a('0x2d')]=_[_0xb91a('0x3f')](db[_0xb91a('0x29')]['rawAttributes']);_0x376a0e['attributes']=_[_0xb91a('0x40')](_0x22f9a2[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x4c401e[_0xb91a('0x2e')][_0xb91a('0x31')]));_0x376a0e[_0xb91a('0x30')]=_0x376a0e[_0xb91a('0x30')][_0xb91a('0x41')]?_0x376a0e[_0xb91a('0x30')]:_0x22f9a2[_0xb91a('0x2d')];if(_0x4c401e['query'][_0xb91a('0x4c')]){_0x376a0e[_0xb91a('0x3c')]=[{'all':!![]}];}_0x376a0e=_[_0xb91a('0x38')]({},_0x376a0e,_0x4c401e['options']);return db[_0xb91a('0x29')][_0xb91a('0x42')](_0x376a0e)[_0xb91a('0x20')](handleEntityNotFound(_0x25a9aa,null))[_0xb91a('0x20')](function(_0x5f2ad5){if(_0x5f2ad5){var _0x207fcc=_0x5f2ad5[_0xb91a('0x45')]({'plain':!![]});_0x207fcc=qs[_0xb91a('0x4d')](_0x207fcc,['id','createdAt','updatedAt']);_0x4c401e[_0xb91a('0x44')]=_[_0xb91a('0x4d')](_0x4c401e['body'],['id',_0xb91a('0x4e'),_0xb91a('0x4f')]);return db[_0xb91a('0x29')][_0xb91a('0x43')](_[_0xb91a('0x38')](_0x207fcc,_0x4c401e['body']),{'include':_0x4c401e[_0xb91a('0x2e')][_0xb91a('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x5ad85e){var _0x58f07a=_0x4c401e['user'][_0xb91a('0x45')]({'plain':!![]});if(!_0x58f07a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58f07a[_0xb91a('0x50')]==='user'){var _0x7255f1=_0x5ad85e[_0xb91a('0x45')]({'plain':!![]});var _0x278d36='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x278d36,'userProfileId':_0x58f07a[_0xb91a('0x48')]},'raw':!![]})[_0xb91a('0x20')](function(_0x434fb4){if(_0x434fb4&&_0x434fb4[_0xb91a('0x49')]===0x0){return db[_0xb91a('0x23')][_0xb91a('0x43')]({'name':_0x7255f1[_0xb91a('0x26')],'resourceId':_0x7255f1['id'],'type':_0x434fb4[_0xb91a('0x26')],'sectionId':_0x434fb4['id']},{})[_0xb91a('0x20')](function(){return _0x5ad85e;});}else{return _0x5ad85e;}})[_0xb91a('0x3e')](function(_0x456b06){logger[_0xb91a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x456b06);throw _0x456b06;});}return _0x5ad85e;});}})[_0xb91a('0x20')](respondWithResult(_0x25a9aa,0xc9))[_0xb91a('0x3e')](handleError(_0x25a9aa,null));};exports[_0xb91a('0x1f')]=function(_0x289d90,_0x556032){if(_0x289d90[_0xb91a('0x44')]['id']){delete _0x289d90[_0xb91a('0x44')]['id'];}return db[_0xb91a('0x29')]['find']({'where':{'id':_0x289d90[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x556032,null))[_0xb91a('0x20')](saveUpdates(_0x289d90[_0xb91a('0x44')],null))[_0xb91a('0x20')](respondWithResult(_0x556032,null))[_0xb91a('0x3e')](handleError(_0x556032,null));};exports[_0xb91a('0x21')]=function(_0x5ca926,_0xc2127a){return db['Campaign'][_0xb91a('0x42')]({'where':{'id':_0x5ca926['params']['id']}})['then'](handleEntityNotFound(_0xc2127a,null))[_0xb91a('0x20')](removeEntity(_0xc2127a,null))[_0xb91a('0x3e')](handleError(_0xc2127a,null));};exports[_0xb91a('0x51')]=function(_0x437a8e,_0x3b0b9e,_0x467939){var _0x41f815={'raw':!![],'where':{}};var _0x74135e={};var _0x1d3ca1={'count':0x0,'rows':[]};return db[_0xb91a('0x29')][_0xb91a('0x52')]({'where':{'id':_0x437a8e[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x3b0b9e,null))[_0xb91a('0x20')](function(_0x8f455d){if(_0x8f455d){_0x74135e[_0xb91a('0x2d')]=_[_0xb91a('0x3f')](db[_0xb91a('0x53')][_0xb91a('0x2a')]);_0x74135e[_0xb91a('0x2e')]=_[_0xb91a('0x3f')](_0x437a8e[_0xb91a('0x2e')]);_0x74135e[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x74135e[_0xb91a('0x2d')],_0x74135e[_0xb91a('0x2e')]);_0x41f815['attributes']=_['intersection'](_0x74135e[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x437a8e['query'][_0xb91a('0x31')]));_0x41f815[_0xb91a('0x30')]=_0x41f815['attributes'][_0xb91a('0x41')]?_0x41f815['attributes']:_0x74135e['model'];if(!_0x437a8e[_0xb91a('0x2e')]['hasOwnProperty'](_0xb91a('0x33'))){_0x41f815[_0xb91a('0x18')]=qs[_0xb91a('0x18')](_0x437a8e[_0xb91a('0x2e')]['limit']);_0x41f815[_0xb91a('0x17')]=qs[_0xb91a('0x17')](_0x437a8e['query'][_0xb91a('0x17')]);}_0x41f815[_0xb91a('0x34')]=qs[_0xb91a('0x35')](_0x437a8e[_0xb91a('0x2e')][_0xb91a('0x35')]);_0x41f815[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0x437a8e[_0xb91a('0x2e')],_0x74135e[_0xb91a('0x2f')]));_0x41f815[_0xb91a('0x36')]['CampaignId']=_0x8f455d['id'];if(_0x437a8e[_0xb91a('0x2e')][_0xb91a('0x3a')]){_0x41f815[_0xb91a('0x36')]=_[_0xb91a('0x38')](_0x41f815[_0xb91a('0x36')],{'$or':_[_0xb91a('0x28')](_0x41f815['attributes'],function(_0x16797c){var _0x47a3fe={};_0x47a3fe[_0x16797c]={'$like':'%'+_0x437a8e[_0xb91a('0x2e')][_0xb91a('0x3a')]+'%'};return _0x47a3fe;})});}_0x41f815=_[_0xb91a('0x38')]({},_0x41f815,_0x437a8e[_0xb91a('0x3b')]);return db[_0xb91a('0x53')][_0xb91a('0x1a')]({'where':_0x41f815[_0xb91a('0x36')]})[_0xb91a('0x20')](function(_0x488504){_0x1d3ca1['count']=_0x488504;if(_0x437a8e['query'][_0xb91a('0x4c')]){_0x41f815[_0xb91a('0x3c')]=[{'all':!![]}];}return db[_0xb91a('0x53')][_0xb91a('0x54')](_0x41f815);})[_0xb91a('0x20')](function(_0x176c8f){_0x1d3ca1[_0xb91a('0x3d')]=_0x176c8f;return _0x1d3ca1;});}})['then'](respondWithFilteredResult(_0x3b0b9e,_0x41f815))[_0xb91a('0x3e')](handleError(_0x3b0b9e,null));};exports[_0xb91a('0x55')]=function(_0x4ddc8f,_0x49e719,_0x2ed2a5){var _0x23c833={'raw':!![],'where':{}};var _0x23c5e2={};var _0x5bf72e={'count':0x0,'rows':[]};return db[_0xb91a('0x29')][_0xb91a('0x52')]({'where':{'id':_0x4ddc8f[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x49e719,null))[_0xb91a('0x20')](function(_0x1097c2){if(_0x1097c2){_0x23c5e2[_0xb91a('0x2d')]=_[_0xb91a('0x3f')](db[_0xb91a('0x56')]['rawAttributes']);_0x23c5e2[_0xb91a('0x2e')]=_[_0xb91a('0x3f')](_0x4ddc8f[_0xb91a('0x2e')]);_0x23c5e2[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x23c5e2['model'],_0x23c5e2[_0xb91a('0x2e')]);_0x23c833['attributes']=_['intersection'](_0x23c5e2[_0xb91a('0x2d')],qs['fields'](_0x4ddc8f['query']['fields']));_0x23c833[_0xb91a('0x30')]=_0x23c833[_0xb91a('0x30')][_0xb91a('0x41')]?_0x23c833[_0xb91a('0x30')]:_0x23c5e2['model'];if(!_0x4ddc8f[_0xb91a('0x2e')][_0xb91a('0x32')](_0xb91a('0x33'))){_0x23c833['limit']=qs[_0xb91a('0x18')](_0x4ddc8f['query']['limit']);_0x23c833[_0xb91a('0x17')]=qs[_0xb91a('0x17')](_0x4ddc8f[_0xb91a('0x2e')][_0xb91a('0x17')]);}_0x23c833[_0xb91a('0x34')]=qs[_0xb91a('0x35')](_0x4ddc8f['query']['sort']);_0x23c833[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0x4ddc8f['query'],_0x23c5e2[_0xb91a('0x2f')]));_0x23c833[_0xb91a('0x36')][_0xb91a('0x57')]=_0x1097c2['id'];if(_0x4ddc8f[_0xb91a('0x2e')]['filter']){_0x23c833[_0xb91a('0x36')]=_[_0xb91a('0x38')](_0x23c833[_0xb91a('0x36')],{'$or':_['map'](_0x23c833['attributes'],function(_0x3b92e2){var _0x4a9997={};_0x4a9997[_0x3b92e2]={'$like':'%'+_0x4ddc8f[_0xb91a('0x2e')][_0xb91a('0x3a')]+'%'};return _0x4a9997;})});}_0x23c833=_[_0xb91a('0x38')]({},_0x23c833,_0x4ddc8f['options']);return db[_0xb91a('0x56')]['count']({'where':_0x23c833['where']})[_0xb91a('0x20')](function(_0xa648f6){_0x5bf72e[_0xb91a('0x1a')]=_0xa648f6;if(_0x4ddc8f[_0xb91a('0x2e')]['includeAll']){_0x23c833[_0xb91a('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb91a('0x54')](_0x23c833);})[_0xb91a('0x20')](function(_0x274adb){_0x5bf72e[_0xb91a('0x3d')]=_0x274adb;return _0x5bf72e;});}})[_0xb91a('0x20')](respondWithFilteredResult(_0x49e719,_0x23c833))[_0xb91a('0x3e')](handleError(_0x49e719,null));};exports[_0xb91a('0x58')]=function(_0x35d220,_0x7a3731,_0x584b08){var _0x149605={'raw':!![],'where':{}};var _0x4a3d37={};var _0x17e970={'count':0x0,'rows':[]};return db[_0xb91a('0x29')][_0xb91a('0x52')]({'where':{'id':_0x35d220[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x7a3731,null))['then'](function(_0x1ce83f){if(_0x1ce83f){_0x4a3d37['model']=_[_0xb91a('0x3f')](db[_0xb91a('0x59')][_0xb91a('0x2a')]);_0x4a3d37['query']=_[_0xb91a('0x3f')](_0x35d220['query']);_0x4a3d37[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x4a3d37[_0xb91a('0x2d')],_0x4a3d37['query']);_0x149605['attributes']=_['intersection'](_0x4a3d37[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x35d220[_0xb91a('0x2e')][_0xb91a('0x31')]));_0x149605['attributes']=_0x149605['attributes']['length']?_0x149605[_0xb91a('0x30')]:_0x4a3d37[_0xb91a('0x2d')];if(!_0x35d220[_0xb91a('0x2e')][_0xb91a('0x32')]('nolimit')){_0x149605[_0xb91a('0x18')]=qs['limit'](_0x35d220[_0xb91a('0x2e')]['limit']);_0x149605[_0xb91a('0x17')]=qs[_0xb91a('0x17')](_0x35d220[_0xb91a('0x2e')][_0xb91a('0x17')]);}_0x149605[_0xb91a('0x34')]=qs[_0xb91a('0x35')](_0x35d220[_0xb91a('0x2e')][_0xb91a('0x35')]);_0x149605[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0x35d220[_0xb91a('0x2e')],_0x4a3d37[_0xb91a('0x2f')]));_0x149605['where']['CampaignId']=_0x1ce83f['id'];if(_0x35d220[_0xb91a('0x2e')][_0xb91a('0x3a')]){_0x149605['where']=_[_0xb91a('0x38')](_0x149605['where'],{'$or':_[_0xb91a('0x28')](_0x149605[_0xb91a('0x30')],function(_0x2e207f){var _0x45e245={};_0x45e245[_0x2e207f]={'$like':'%'+_0x35d220['query']['filter']+'%'};return _0x45e245;})});}_0x149605=_[_0xb91a('0x38')]({},_0x149605,_0x35d220['options']);return db[_0xb91a('0x59')][_0xb91a('0x1a')]({'where':_0x149605['where']})[_0xb91a('0x20')](function(_0x3e4415){_0x17e970[_0xb91a('0x1a')]=_0x3e4415;if(_0x35d220['query'][_0xb91a('0x4c')]){_0x149605[_0xb91a('0x3c')]=[{'all':!![]}];}return db[_0xb91a('0x59')]['findAll'](_0x149605);})[_0xb91a('0x20')](function(_0x2a548c){_0x17e970[_0xb91a('0x3d')]=_0x2a548c;return _0x17e970;});}})[_0xb91a('0x20')](respondWithFilteredResult(_0x7a3731,_0x149605))[_0xb91a('0x3e')](handleError(_0x7a3731,null));};exports[_0xb91a('0x5a')]=function(_0xe53bb,_0x551a24,_0x38546f){var _0x584ef2={'raw':!![],'where':{}};var _0x2e05eb={};var _0x921a65={'count':0x0,'rows':[]};return db['Campaign'][_0xb91a('0x52')]({'where':{'id':_0xe53bb[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x551a24,null))['then'](function(_0x294a4d){if(_0x294a4d){_0x2e05eb[_0xb91a('0x2d')]=_['keys'](db[_0xb91a('0x5b')][_0xb91a('0x2a')]);_0x2e05eb[_0xb91a('0x2e')]=_[_0xb91a('0x3f')](_0xe53bb['query']);_0x2e05eb[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x2e05eb[_0xb91a('0x2d')],_0x2e05eb[_0xb91a('0x2e')]);_0x584ef2[_0xb91a('0x30')]=_[_0xb91a('0x40')](_0x2e05eb[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0xe53bb[_0xb91a('0x2e')]['fields']));_0x584ef2[_0xb91a('0x30')]=_0x584ef2[_0xb91a('0x30')][_0xb91a('0x41')]?_0x584ef2[_0xb91a('0x30')]:_0x2e05eb[_0xb91a('0x2d')];if(!_0xe53bb[_0xb91a('0x2e')][_0xb91a('0x32')](_0xb91a('0x33'))){_0x584ef2[_0xb91a('0x18')]=qs[_0xb91a('0x18')](_0xe53bb[_0xb91a('0x2e')][_0xb91a('0x18')]);_0x584ef2[_0xb91a('0x17')]=qs['offset'](_0xe53bb[_0xb91a('0x2e')]['offset']);}_0x584ef2[_0xb91a('0x34')]=qs[_0xb91a('0x35')](_0xe53bb[_0xb91a('0x2e')]['sort']);_0x584ef2[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0xe53bb[_0xb91a('0x2e')],_0x2e05eb[_0xb91a('0x2f')]));_0x584ef2[_0xb91a('0x36')][_0xb91a('0x57')]=_0x294a4d['id'];if(_0xe53bb[_0xb91a('0x2e')]['filter']){_0x584ef2[_0xb91a('0x36')]=_[_0xb91a('0x38')](_0x584ef2[_0xb91a('0x36')],{'$or':_[_0xb91a('0x28')](_0x584ef2['attributes'],function(_0x57179b){var _0x1f63f5={};_0x1f63f5[_0x57179b]={'$like':'%'+_0xe53bb[_0xb91a('0x2e')][_0xb91a('0x3a')]+'%'};return _0x1f63f5;})});}_0x584ef2=_['merge']({},_0x584ef2,_0xe53bb['options']);return db[_0xb91a('0x5b')][_0xb91a('0x1a')]({'where':_0x584ef2[_0xb91a('0x36')]})[_0xb91a('0x20')](function(_0x41318a){_0x921a65[_0xb91a('0x1a')]=_0x41318a;if(_0xe53bb[_0xb91a('0x2e')]['includeAll']){_0x584ef2[_0xb91a('0x3c')]=[{'all':!![]}];}return db[_0xb91a('0x5b')][_0xb91a('0x54')](_0x584ef2);})[_0xb91a('0x20')](function(_0x21a14b){_0x921a65['rows']=_0x21a14b;return _0x921a65;});}})[_0xb91a('0x20')](respondWithFilteredResult(_0x551a24,_0x584ef2))[_0xb91a('0x3e')](handleError(_0x551a24,null));};exports['getLists']=function(_0x1bffed,_0x53a82a,_0x3efadc){var _0x5bc253={};var _0x42038a={};var _0x484950;var _0xb84b4d;return db[_0xb91a('0x29')][_0xb91a('0x52')]({'where':{'id':_0x1bffed[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x53a82a,null))[_0xb91a('0x20')](function(_0x16e781){if(_0x16e781){_0x484950=_0x16e781;_0x42038a[_0xb91a('0x2d')]=_[_0xb91a('0x3f')](db[_0xb91a('0x5c')]['rawAttributes']);_0x42038a[_0xb91a('0x2e')]=_[_0xb91a('0x3f')](_0x1bffed[_0xb91a('0x2e')]);_0x42038a[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x42038a[_0xb91a('0x2d')],_0x42038a['query']);_0x5bc253[_0xb91a('0x30')]=_[_0xb91a('0x40')](_0x42038a[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x1bffed[_0xb91a('0x2e')]['fields']));_0x5bc253[_0xb91a('0x30')]=_0x5bc253['attributes'][_0xb91a('0x41')]?_0x5bc253[_0xb91a('0x30')]:_0x42038a['model'];_0x5bc253['order']=qs[_0xb91a('0x35')](_0x1bffed[_0xb91a('0x2e')][_0xb91a('0x35')]);_0x5bc253[_0xb91a('0x36')]=qs[_0xb91a('0x2f')](_[_0xb91a('0x37')](_0x1bffed[_0xb91a('0x2e')],_0x42038a[_0xb91a('0x2f')]));if(_0x1bffed[_0xb91a('0x2e')][_0xb91a('0x3a')]){_0x5bc253[_0xb91a('0x36')]=_['merge'](_0x5bc253[_0xb91a('0x36')],{'$or':_[_0xb91a('0x28')](_0x5bc253[_0xb91a('0x30')],function(_0x3be88f){var _0x2a8309={};_0x2a8309[_0x3be88f]={'$like':'%'+_0x1bffed[_0xb91a('0x2e')][_0xb91a('0x3a')]+'%'};return _0x2a8309;})});}_0x5bc253=_[_0xb91a('0x38')]({},_0x5bc253,_0x1bffed[_0xb91a('0x3b')]);return _0x484950[_0xb91a('0x5d')](_0x5bc253);}})[_0xb91a('0x20')](function(_0x28e971){if(_0x28e971){_0xb84b4d=_0x28e971[_0xb91a('0x41')];if(!_0x1bffed[_0xb91a('0x2e')]['hasOwnProperty'](_0xb91a('0x33'))){_0x5bc253[_0xb91a('0x18')]=qs[_0xb91a('0x18')](_0x1bffed[_0xb91a('0x2e')][_0xb91a('0x18')]);_0x5bc253[_0xb91a('0x17')]=qs['offset'](_0x1bffed['query']['offset']);}return _0x484950[_0xb91a('0x5d')](_0x5bc253);}})[_0xb91a('0x20')](function(_0x6f02b8){if(_0x6f02b8){return _0x6f02b8?{'count':_0xb84b4d,'rows':_0x6f02b8}:null;}})['then'](respondWithResult(_0x53a82a,null))[_0xb91a('0x3e')](handleError(_0x53a82a,null));};exports[_0xb91a('0x5e')]=function(_0xd08417,_0x33c9d8,_0x1016fd){var _0x24e336,_0x2f079d;var _0x11e278=[];var _0x2c0a4d=moment()[_0xb91a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xb91a('0x29')]['find']({'where':{'id':_0xd08417[_0xb91a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33c9d8,null))[_0xb91a('0x20')](function(_0x1bb0f6){if(_0x1bb0f6){_0x2f079d=_0x1bb0f6;return _0x1bb0f6[_0xb91a('0x5e')](_0xd08417['body'][_0xb91a('0x60')],_['omit'](_0xd08417['body'],['ids','id'])||{});}return null;})[_0xb91a('0x61')](function(_0x1a7592){var _0x210fa9;var _0x45cbf4;_0x24e336=_0x1a7592||[];var _0x3adac7=[];if(_0x1a7592){for(var _0x434e4f=0x0;_0x434e4f<_0x1a7592[_0xb91a('0x41')];_0x434e4f+=0x1){var _0x1fd9cc=_0x1a7592[_0x434e4f][_0xb91a('0x45')]({'plain':!![]});_0x2f079d[_0xb91a('0x62')]=_0xd08417[_0xb91a('0x44')][_0xb91a('0x62')]?_0xd08417[_0xb91a('0x44')][_0xb91a('0x62')]:_0x2f079d[_0xb91a('0x62')];switch(_0x2f079d['dialCheckDuplicateType']){case'always':_0x210fa9=squel['insert']()[_0xb91a('0x63')]('cm_hopper')[_0xb91a('0x64')]([_0xb91a('0x65'),_0xb91a('0x66'),_0xb91a('0x67'),'ListId',_0xb91a('0x57'),_0xb91a('0x4e'),_0xb91a('0x4f')],squel['select']()[_0xb91a('0x68')]('phone',_0xb91a('0x65'))[_0xb91a('0x68')](_0xb91a('0x69'),_0xb91a('0x66'))[_0xb91a('0x68')]('id',_0xb91a('0x67'))['field'](_0x1fd9cc['CmListId'][_0xb91a('0x6a')](),_0xb91a('0x6b'))[_0xb91a('0x68')](_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')](),_0xb91a('0x57'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4e'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4f'))[_0xb91a('0x6c')](_0xb91a('0x6d'))['where'](_0xb91a('0x6e'))[_0xb91a('0x36')](_0xb91a('0x6f'),_0x1fd9cc['CmListId'][_0xb91a('0x6a')]())[_0xb91a('0x36')](_0xb91a('0x70'))[_0xb91a('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb91a('0x71')]()['field'](_0xb91a('0x72'))[_0xb91a('0x6c')]('cm_hopper_final')['where'](_0xb91a('0x73'),_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')]()))[_0xb91a('0x36')](_0xb91a('0x74'),squel[_0xb91a('0x71')]()['field'](_0xb91a('0x75'))['from'](_0xb91a('0x76'))[_0xb91a('0x36')](_0xb91a('0x73'),_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')]())))[_0xb91a('0x6a')]();break;case'onlyIfOpen':_0x210fa9=squel['insert']()[_0xb91a('0x63')](_0xb91a('0x76'))[_0xb91a('0x64')]([_0xb91a('0x65'),_0xb91a('0x66'),_0xb91a('0x67'),'ListId',_0xb91a('0x57'),_0xb91a('0x4e'),_0xb91a('0x4f')],squel[_0xb91a('0x71')]()[_0xb91a('0x68')]('phone',_0xb91a('0x65'))[_0xb91a('0x68')](_0xb91a('0x69'),'scheduledAt')[_0xb91a('0x68')]('id',_0xb91a('0x67'))[_0xb91a('0x68')](_0x1fd9cc[_0xb91a('0x77')][_0xb91a('0x6a')](),_0xb91a('0x6b'))[_0xb91a('0x68')](_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')](),_0xb91a('0x57'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4e'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4f'))[_0xb91a('0x6c')]('cm_contacts')[_0xb91a('0x36')](_0xb91a('0x6e'))[_0xb91a('0x36')](_0xb91a('0x6f'),_0x1fd9cc[_0xb91a('0x77')][_0xb91a('0x6a')]())['where'](_0xb91a('0x70'))[_0xb91a('0x36')](_0xb91a('0x74'),squel[_0xb91a('0x71')]()['field'](_0xb91a('0x75'))[_0xb91a('0x6c')]('cm_hopper')[_0xb91a('0x36')]('CampaignId\x20=\x20?',_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')]())))['toString']();break;default:_0x210fa9=squel[_0xb91a('0x78')]()[_0xb91a('0x63')](_0xb91a('0x76'))['fromQuery']([_0xb91a('0x65'),'scheduledAt','ContactId',_0xb91a('0x6b'),_0xb91a('0x57'),_0xb91a('0x4e'),'updatedAt'],squel[_0xb91a('0x71')]()[_0xb91a('0x68')](_0xb91a('0x65'),_0xb91a('0x65'))[_0xb91a('0x68')](_0xb91a('0x69'),_0xb91a('0x66'))[_0xb91a('0x68')]('id','ContactId')[_0xb91a('0x68')](_0x1fd9cc['CmListId'][_0xb91a('0x6a')](),_0xb91a('0x6b'))[_0xb91a('0x68')](_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')](),_0xb91a('0x57'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4e'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4f'))[_0xb91a('0x6c')](_0xb91a('0x6d'))[_0xb91a('0x36')](_0xb91a('0x6e'))['where'](_0xb91a('0x6f'),_0x1fd9cc[_0xb91a('0x77')]['toString']())['where'](_0xb91a('0x70')))[_0xb91a('0x6a')]();}_0x45cbf4=squel['insert']()['into'](_0xb91a('0x79'))['fromQuery']([_0xb91a('0x7a'),_0xb91a('0x66'),_0xb91a('0x65'),_0xb91a('0x7b'),_0xb91a('0x4e'),_0xb91a('0x4f')],squel[_0xb91a('0x71')]()['field'](_0xb91a('0x7c'),'id')[_0xb91a('0x68')](_0xb91a('0x69'),_0xb91a('0x66'))['field'](_0xb91a('0x7d'),'phone')[_0xb91a('0x68')](_0xb91a('0x7e'),'OrderBy')[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27',_0xb91a('0x4e'))[_0xb91a('0x68')]('\x27'+_0x2c0a4d+'\x27','updatedAt')[_0xb91a('0x6c')]('cm_contact_has_items','ci')[_0xb91a('0x7f')](_0xb91a('0x76'),'h','h.ContactId\x20=\x20ci.CmContactId')['where']('h.ListId\x20=\x20?',_0x1fd9cc[_0xb91a('0x77')][_0xb91a('0x6a')]())[_0xb91a('0x36')](_0xb91a('0x80'),_0xd08417[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')]())[_0xb91a('0x36')](_0xb91a('0x81'),_0x2c0a4d))['toString']();_0x3adac7[_0xb91a('0x82')](db[_0xb91a('0x83')][_0xb91a('0x2e')](_0x210fa9));_0x11e278['push'](db[_0xb91a('0x83')][_0xb91a('0x2e')](_0x45cbf4));}return BPromise[_0xb91a('0x84')](_0x3adac7);}})['then'](function(){return BPromise[_0xb91a('0x84')](_0x11e278);})['then'](function(){return _0x24e336;})[_0xb91a('0x20')](respondWithResult(_0x33c9d8,null))[_0xb91a('0x3e')](handleError(_0x33c9d8,null));};exports[_0xb91a('0x85')]=function(_0x1a8622,_0x463fcd,_0x121f42){return db[_0xb91a('0x29')][_0xb91a('0x42')]({'where':{'id':_0x1a8622[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x463fcd,null))[_0xb91a('0x20')](function(_0x5af048){if(_0x5af048){return _0x5af048['removeLists'](_0x1a8622['query']['ids']);}})[_0xb91a('0x20')](function(_0x59f59a){if(_0x59f59a){return db[_0xb91a('0x53')]['destroy']({'where':{'ListId':_0x1a8622[_0xb91a('0x2e')]['ids'],'CampaignId':_0x1a8622[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](function(){return _0x59f59a;});}})[_0xb91a('0x20')](respondWithStatusCode(_0x463fcd,null))['catch'](handleError(_0x463fcd,null));};exports[_0xb91a('0x86')]=function(_0x3c6f08,_0x53106a,_0x310033){var _0x1984d1={};var _0x1cebc3={};var _0x1770b3;var _0x1a2517;return db[_0xb91a('0x29')]['findOne']({'where':{'id':_0x3c6f08[_0xb91a('0x4b')]['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x53106a,null))[_0xb91a('0x20')](function(_0x37d17e){if(_0x37d17e){_0x1770b3=_0x37d17e;_0x1cebc3[_0xb91a('0x2d')]=_[_0xb91a('0x3f')](db[_0xb91a('0x5c')][_0xb91a('0x2a')]);_0x1cebc3[_0xb91a('0x2e')]=_[_0xb91a('0x3f')](_0x3c6f08[_0xb91a('0x2e')]);_0x1cebc3[_0xb91a('0x2f')]=_[_0xb91a('0x40')](_0x1cebc3[_0xb91a('0x2d')],_0x1cebc3[_0xb91a('0x2e')]);_0x1984d1[_0xb91a('0x30')]=_[_0xb91a('0x40')](_0x1cebc3[_0xb91a('0x2d')],qs[_0xb91a('0x31')](_0x3c6f08[_0xb91a('0x2e')]['fields']));_0x1984d1[_0xb91a('0x30')]=_0x1984d1['attributes']['length']?_0x1984d1[_0xb91a('0x30')]:_0x1cebc3[_0xb91a('0x2d')];_0x1984d1['order']=qs['sort'](_0x3c6f08[_0xb91a('0x2e')][_0xb91a('0x35')]);_0x1984d1['where']=qs['filters'](_[_0xb91a('0x37')](_0x3c6f08[_0xb91a('0x2e')],_0x1cebc3[_0xb91a('0x2f')]));if(_0x3c6f08[_0xb91a('0x2e')]['filter']){_0x1984d1[_0xb91a('0x36')]=_[_0xb91a('0x38')](_0x1984d1['where'],{'$or':_[_0xb91a('0x28')](_0x1984d1['attributes'],function(_0x1f2bf0){var _0x2f972a={};_0x2f972a[_0x1f2bf0]={'$like':'%'+_0x3c6f08['query'][_0xb91a('0x3a')]+'%'};return _0x2f972a;})});}_0x1984d1=_[_0xb91a('0x38')]({},_0x1984d1,_0x3c6f08[_0xb91a('0x3b')]);return _0x1770b3['getBlackLists'](_0x1984d1);}})[_0xb91a('0x20')](function(_0x55e31b){if(_0x55e31b){_0x1a2517=_0x55e31b[_0xb91a('0x41')];if(!_0x3c6f08['query'][_0xb91a('0x32')](_0xb91a('0x33'))){_0x1984d1[_0xb91a('0x18')]=qs[_0xb91a('0x18')](_0x3c6f08[_0xb91a('0x2e')][_0xb91a('0x18')]);_0x1984d1['offset']=qs[_0xb91a('0x17')](_0x3c6f08[_0xb91a('0x2e')][_0xb91a('0x17')]);}return _0x1770b3[_0xb91a('0x86')](_0x1984d1);}})[_0xb91a('0x20')](function(_0x8fc30d){if(_0x8fc30d){return _0x8fc30d?{'count':_0x1a2517,'rows':_0x8fc30d}:null;}})[_0xb91a('0x20')](respondWithResult(_0x53106a,null))[_0xb91a('0x3e')](handleError(_0x53106a,null));};exports[_0xb91a('0x87')]=function(_0x498447,_0x5d4632,_0x5f39c2){var _0x1085be,_0x4e2f60;var _0x2c6be7=[];var _0xb65537=moment()[_0xb91a('0x5f')](_0xb91a('0x88'));return db[_0xb91a('0x29')][_0xb91a('0x42')]({'where':{'id':_0x498447[_0xb91a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d4632,null))['then'](function(_0x4c2f61){if(_0x4c2f61){_0x4e2f60=_0x4c2f61;return _0x4c2f61[_0xb91a('0x87')](_0x498447['body'][_0xb91a('0x60')],_[_0xb91a('0x4d')](_0x498447[_0xb91a('0x44')],['ids','id'])||{});}return null;})[_0xb91a('0x61')](function(_0x54c8f1){var _0x2c79f4;var _0x41e828;_0x1085be=_0x54c8f1||[];var _0x2f107e=[];if(_0x54c8f1){for(var _0x2cfb07=0x0;_0x2cfb07<_0x54c8f1[_0xb91a('0x41')];_0x2cfb07+=0x1){var _0x48fb47=_0x54c8f1[_0x2cfb07][_0xb91a('0x45')]({'plain':!![]});_0x2c79f4=squel[_0xb91a('0x78')]()['into'](_0xb91a('0x89'))[_0xb91a('0x64')]([_0xb91a('0x65'),_0xb91a('0x67'),_0xb91a('0x6b'),'CampaignId','createdAt',_0xb91a('0x4f')],squel[_0xb91a('0x71')]()[_0xb91a('0x68')](_0xb91a('0x65'),'phone')[_0xb91a('0x68')]('id',_0xb91a('0x67'))[_0xb91a('0x68')](_0x48fb47[_0xb91a('0x77')][_0xb91a('0x6a')](),_0xb91a('0x6b'))[_0xb91a('0x68')](_0x498447[_0xb91a('0x4b')]['id'][_0xb91a('0x6a')](),'CampaignId')[_0xb91a('0x68')]('NOW()',_0xb91a('0x4e'))[_0xb91a('0x68')]('NOW()',_0xb91a('0x4f'))[_0xb91a('0x6c')](_0xb91a('0x6d'))[_0xb91a('0x36')]('deletedAt\x20IS\x20NULL')[_0xb91a('0x36')](_0xb91a('0x6f'),_0x48fb47[_0xb91a('0x77')][_0xb91a('0x6a')]())[_0xb91a('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0xb91a('0x6a')]();_0x2f107e[_0xb91a('0x82')](db[_0xb91a('0x83')][_0xb91a('0x2e')](_0x2c79f4));}return BPromise[_0xb91a('0x84')](_0x2f107e);}})[_0xb91a('0x20')](function(){return _0x1085be;})[_0xb91a('0x20')](respondWithResult(_0x5d4632,null))[_0xb91a('0x3e')](handleError(_0x5d4632,null));};exports['removeBlackLists']=function(_0x181159,_0x282705,_0xd8a7aa){return db[_0xb91a('0x29')][_0xb91a('0x42')]({'where':{'id':_0x181159['params']['id']}})[_0xb91a('0x20')](handleEntityNotFound(_0x282705,null))['then'](function(_0x3eb346){if(_0x3eb346){return _0x3eb346['removeBlackLists'](_0x181159[_0xb91a('0x2e')][_0xb91a('0x60')]);}})['then'](function(_0x3deb55){if(_0x3deb55){return db[_0xb91a('0x5b')][_0xb91a('0x21')]({'where':{'ListId':_0x181159[_0xb91a('0x2e')][_0xb91a('0x60')],'CampaignId':_0x181159['params']['id']}})[_0xb91a('0x20')](function(){return _0x3deb55;});}})[_0xb91a('0x20')](respondWithStatusCode(_0x282705,null))['catch'](handleError(_0x282705,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1b0b924..b075d7d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5b2c0b,_0x12fa22){var _0x300219=function(_0x3dc245){while(--_0x3dc245){_0x5b2c0b['push'](_0x5b2c0b['shift']());}};_0x300219(++_0x12fa22);}(_0x7a54,0x106));var _0x47a5=function(_0x58a2de,_0x47f72e){_0x58a2de=_0x58a2de-0x0;var _0x23aa98=_0x7a54[_0x58a2de];return _0x23aa98;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 2635418..816482d 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 _0xcea2=['rpc','../../config/environment','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Campaign','findAll','options','where','attributes','limit','map','include','model','then','GetCampaign','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1e224b,_0x2ca2c3){var _0x20cb8f=function(_0x34c47e){while(--_0x34c47e){_0x1e224b['push'](_0x1e224b['shift']());}};_0x20cb8f(++_0x2ca2c3);}(_0xcea2,0x15a));var _0x2cea=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xcea2[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('Campaign,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});}exports['GetCampaign']=function(_0x19927a){var _0x464f7d=this;return new Promise(function(_0x20c46c,_0x43ae15){return db[_0x2cea('0x15')][_0x2cea('0x16')]({'raw':_0x19927a['options']?_0x19927a[_0x2cea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x18')]||null:null,'attributes':_0x19927a['options']?_0x19927a[_0x2cea('0x17')][_0x2cea('0x19')]||null:null,'limit':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')][_0x2cea('0x1a')]||null:null,'include':_0x19927a[_0x2cea('0x17')]?_0x19927a[_0x2cea('0x17')]['include']?_[_0x2cea('0x1b')](_0x19927a['options'][_0x2cea('0x1c')],function(_0x4926ff){return{'model':db[_0x4926ff[_0x2cea('0x1d')]],'as':_0x4926ff['as'],'attributes':_0x4926ff[_0x2cea('0x19')],'include':_0x4926ff['include']?_[_0x2cea('0x1b')](_0x4926ff[_0x2cea('0x1c')],function(_0x101314){return{'model':db[_0x101314[_0x2cea('0x1d')]],'as':_0x101314['as'],'attributes':_0x101314[_0x2cea('0x19')],'include':_0x101314[_0x2cea('0x1c')]?_['map'](_0x101314[_0x2cea('0x1c')],function(_0x32b6a3){return{'model':db[_0x32b6a3[_0x2cea('0x1d')]],'as':_0x32b6a3['as'],'attributes':_0x32b6a3[_0x2cea('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cea('0x1e')](function(_0x3ea40c){logger[_0x2cea('0xa')](_0x2cea('0x1f'),_0x19927a);logger['debug'](_0x2cea('0x1f'),_0x19927a,JSON[_0x2cea('0xf')](_0x3ea40c));_0x20c46c(_0x3ea40c);})['catch'](function(_0xfeb8bd){logger[_0x2cea('0x11')](_0x2cea('0x1f'),_0xfeb8bd[_0x2cea('0x12')],_0x19927a);_0x43ae15(_0x464f7d['error'](0x1f4,_0xfeb8bd[_0x2cea('0x12')]));});});}; \ No newline at end of file +var _0xe920=['../../config/logger','rpc','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','Campaign,\x20%s,\x20%s','result','GetCampaign','Campaign','options','raw','attributes','limit','include','model','map','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xe920,0xbe));var _0x0e92=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xe920[_0x547add];return _0x2ed1f3;};'use strict';var _=require(_0x0e92('0x0'));var util=require(_0x0e92('0x1'));var moment=require(_0x0e92('0x2'));var BPromise=require(_0x0e92('0x3'));var rs=require(_0x0e92('0x4'));var fs=require('fs');var Redis=require(_0x0e92('0x5'));var db=require(_0x0e92('0x6'))['db'];var utils=require(_0x0e92('0x7'));var logger=require(_0x0e92('0x8'))(_0x0e92('0x9'));var config=require('../../config/environment');var jayson=require(_0x0e92('0xa'));var client=jayson['client'][_0x0e92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a315,_0x2d921f,_0x176c3b){return new BPromise(function(_0x5662dc,_0x3dbc96){return client[_0x0e92('0xc')](_0x33a315,_0x176c3b)[_0x0e92('0xd')](function(_0x129376){logger[_0x0e92('0xe')]('Campaign,\x20%s,\x20%s',_0x2d921f,'request\x20sent');logger['debug'](_0x0e92('0xf'),_0x2d921f,_0x0e92('0x10'),JSON['stringify'](_0x129376));if(_0x129376['error']){if(_0x129376['error'][_0x0e92('0x11')]===0x1f4){logger[_0x0e92('0x12')]('Campaign,\x20%s,\x20%s',_0x2d921f,_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);return _0x3dbc96(_0x129376['error'][_0x0e92('0x13')]);}logger[_0x0e92('0x12')](_0x0e92('0x14'),_0x2d921f,_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);return _0x5662dc(_0x129376[_0x0e92('0x12')][_0x0e92('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x2d921f,_0x0e92('0x10'));_0x5662dc(_0x129376[_0x0e92('0x15')]['message']);}})['catch'](function(_0x424c3a){logger['error'](_0x0e92('0x14'),_0x2d921f,_0x424c3a);_0x3dbc96(_0x424c3a);});});}exports[_0x0e92('0x16')]=function(_0x3316a5){var _0x46aa84=this;return new Promise(function(_0x153002,_0x8f7626){return db[_0x0e92('0x17')]['findAll']({'raw':_0x3316a5[_0x0e92('0x18')]?_0x3316a5['options'][_0x0e92('0x19')]===undefined?!![]:![]:!![],'where':_0x3316a5['options']?_0x3316a5['options']['where']||null:null,'attributes':_0x3316a5[_0x0e92('0x18')]?_0x3316a5['options'][_0x0e92('0x1a')]||null:null,'limit':_0x3316a5['options']?_0x3316a5[_0x0e92('0x18')][_0x0e92('0x1b')]||null:null,'include':_0x3316a5['options']?_0x3316a5[_0x0e92('0x18')][_0x0e92('0x1c')]?_['map'](_0x3316a5[_0x0e92('0x18')]['include'],function(_0x43c54c){return{'model':db[_0x43c54c[_0x0e92('0x1d')]],'as':_0x43c54c['as'],'attributes':_0x43c54c[_0x0e92('0x1a')],'include':_0x43c54c[_0x0e92('0x1c')]?_[_0x0e92('0x1e')](_0x43c54c[_0x0e92('0x1c')],function(_0xc34ae4){return{'model':db[_0xc34ae4[_0x0e92('0x1d')]],'as':_0xc34ae4['as'],'attributes':_0xc34ae4[_0x0e92('0x1a')],'include':_0xc34ae4[_0x0e92('0x1c')]?_['map'](_0xc34ae4[_0x0e92('0x1c')],function(_0x47f156){return{'model':db[_0x47f156['model']],'as':_0x47f156['as'],'attributes':_0x47f156[_0x0e92('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0e92('0xd')](function(_0x5c5cef){logger['info'](_0x0e92('0x16'),_0x3316a5);logger[_0x0e92('0x1f')]('GetCampaign',_0x3316a5,JSON['stringify'](_0x5c5cef));_0x153002(_0x5c5cef);})[_0x0e92('0x20')](function(_0x329c5f){logger[_0x0e92('0x12')](_0x0e92('0x16'),_0x329c5f[_0x0e92('0x13')],_0x3316a5);_0x8f7626(_0x46aa84[_0x0e92('0x12')](0x1f4,_0x329c5f[_0x0e92('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 250c020..aee4c48 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 _0x76c6=['getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','put','update','delete','removeLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x1364ef,_0x14c8b4){var _0x2b6e2a=function(_0x43376b){while(--_0x43376b){_0x1364ef['push'](_0x1364ef['shift']());}};_0x2b6e2a(++_0x14c8b4);}(_0x76c6,0x12f));var _0x676c=function(_0x3fd91f,_0x24a033){_0x3fd91f=_0x3fd91f-0x0;var _0x10a826=_0x76c6[_0x3fd91f];return _0x10a826;};'use strict';var multer=require('multer');var util=require(_0x676c('0x0'));var path=require(_0x676c('0x1'));var timeout=require(_0x676c('0x2'));var express=require(_0x676c('0x3'));var router=express[_0x676c('0x4')]();var fs_extra=require(_0x676c('0x5'));var auth=require(_0x676c('0x6'));var interaction=require(_0x676c('0x7'));var config=require('../../config/environment');var controller=require(_0x676c('0x8'));router['get']('/',auth[_0x676c('0x9')](),controller[_0x676c('0xa')]);router[_0x676c('0xb')](_0x676c('0xc'),auth[_0x676c('0x9')](),controller[_0x676c('0xd')]);router[_0x676c('0xb')](_0x676c('0xe'),auth[_0x676c('0x9')](),controller[_0x676c('0xf')]);router[_0x676c('0xb')](_0x676c('0x10'),auth[_0x676c('0x9')](),controller[_0x676c('0x11')]);router[_0x676c('0xb')](_0x676c('0x12'),auth[_0x676c('0x9')](),controller[_0x676c('0x13')]);router[_0x676c('0xb')](_0x676c('0x14'),auth[_0x676c('0x9')](),controller[_0x676c('0x15')]);router[_0x676c('0xb')]('/:id/lists',auth[_0x676c('0x9')](),controller[_0x676c('0x16')]);router['get'](_0x676c('0x17'),auth[_0x676c('0x9')](),controller[_0x676c('0x18')]);router[_0x676c('0x19')]('/',auth[_0x676c('0x9')](),controller[_0x676c('0x1a')]);router[_0x676c('0x19')](_0x676c('0x1b'),auth['isAuthenticated'](),controller[_0x676c('0x1c')]);router[_0x676c('0x19')](_0x676c('0x1d'),auth[_0x676c('0x9')](),controller[_0x676c('0x1e')]);router[_0x676c('0x19')](_0x676c('0x17'),auth[_0x676c('0x9')](),controller['addBlackLists']);router[_0x676c('0x1f')]('/:id',auth[_0x676c('0x9')](),controller[_0x676c('0x20')]);router[_0x676c('0x21')](_0x676c('0xc'),auth[_0x676c('0x9')](),controller['destroy']);router[_0x676c('0x21')](_0x676c('0x1d'),auth[_0x676c('0x9')](),controller[_0x676c('0x22')]);router[_0x676c('0x21')](_0x676c('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x676c('0x23')]=router; \ No newline at end of file +var _0xefbb=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories'];(function(_0x27a117,_0x48c130){var _0x38ee30=function(_0x53c04d){while(--_0x53c04d){_0x27a117['push'](_0x27a117['shift']());}};_0x38ee30(++_0x48c130);}(_0xefbb,0x11b));var _0xbefb=function(_0x10988a,_0x59543f){_0x10988a=_0x10988a-0x0;var _0x3c6936=_0xefbb[_0x10988a];return _0x3c6936;};'use strict';var multer=require(_0xbefb('0x0'));var util=require(_0xbefb('0x1'));var path=require(_0xbefb('0x2'));var timeout=require(_0xbefb('0x3'));var express=require(_0xbefb('0x4'));var router=express['Router']();var fs_extra=require(_0xbefb('0x5'));var auth=require(_0xbefb('0x6'));var interaction=require(_0xbefb('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbefb('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbefb('0x9')](_0xbefb('0xa'),auth[_0xbefb('0xb')](),controller[_0xbefb('0xc')]);router[_0xbefb('0x9')](_0xbefb('0xd'),auth[_0xbefb('0xb')](),controller['getHopperHistories']);router[_0xbefb('0x9')]('/:id/hopper_finals',auth[_0xbefb('0xb')](),controller[_0xbefb('0xe')]);router[_0xbefb('0x9')](_0xbefb('0xf'),auth['isAuthenticated'](),controller[_0xbefb('0x10')]);router[_0xbefb('0x9')](_0xbefb('0x11'),auth[_0xbefb('0xb')](),controller[_0xbefb('0x12')]);router[_0xbefb('0x9')](_0xbefb('0x13'),auth[_0xbefb('0xb')](),controller[_0xbefb('0x14')]);router[_0xbefb('0x15')]('/',auth[_0xbefb('0xb')](),controller[_0xbefb('0x16')]);router[_0xbefb('0x15')](_0xbefb('0x17'),auth['isAuthenticated'](),controller[_0xbefb('0x18')]);router['post'](_0xbefb('0x11'),auth[_0xbefb('0xb')](),controller[_0xbefb('0x19')]);router[_0xbefb('0x15')](_0xbefb('0x13'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xbefb('0x1a')](_0xbefb('0x1b'),auth[_0xbefb('0xb')](),controller[_0xbefb('0x1c')]);router[_0xbefb('0x1d')](_0xbefb('0x1b'),auth[_0xbefb('0xb')](),controller[_0xbefb('0x1e')]);router[_0xbefb('0x1d')]('/:id/lists',auth[_0xbefb('0xb')](),controller[_0xbefb('0x1f')]);router['delete'](_0xbefb('0x13'),auth['isAuthenticated'](),controller[_0xbefb('0x20')]);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 27e866d..6f8245e 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 _0xf123=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xf123,0x190));var _0x3f12=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0xf123[_0x47a40b];return _0x19610c;};'use strict';var Sequelize=require(_0x3f12('0x0'));module[_0x3f12('0x1')]={'key':{'type':Sequelize[_0x3f12('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x3f12('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3f12('0x4')],'get':function(){return this[_0x3f12('0x5')](_0x3f12('0x6'));}}}; \ No newline at end of file +var _0x80ff=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x57a570,_0xc2ae8f){var _0x311384=function(_0x3fdfc0){while(--_0x3fdfc0){_0x57a570['push'](_0x57a570['shift']());}};_0x311384(++_0xc2ae8f);}(_0x80ff,0x115));var _0xf80f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x80ff[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0xf80f('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf80f('0x1')]},'name':{'type':Sequelize[_0xf80f('0x2')],'get':function(){return this[_0xf80f('0x3')](_0xf80f('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 92ffa54..737cdd4 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 _0x1d3d=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','undefined','limit','offset','count','status','set','Content-Range','json','apply','save','update','then','CannedAnswers','UserProfileResource','error','name','send','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x42871b,_0x50738e){var _0x14999c=function(_0x2eba58){while(--_0x2eba58){_0x42871b['push'](_0x42871b['shift']());}};_0x14999c(++_0x50738e);}(_0x1d3d,0xc6));var _0xd1d3=function(_0x5132e6,_0x5b0574){_0x5132e6=_0x5132e6-0x0;var _0x3cb11b=_0x1d3d[_0x5132e6];return _0x3cb11b;};'use strict';var emlformat=require(_0xd1d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1d3('0x2'));var moment=require(_0xd1d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd1d3('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd1d3('0x5'));var csv=require(_0xd1d3('0x6'));var ejs=require(_0xd1d3('0x7'));var fs=require('fs');var fs_extra=require(_0xd1d3('0x8'));var _=require(_0xd1d3('0x9'));var squel=require(_0xd1d3('0xa'));var crypto=require(_0xd1d3('0xb'));var jsforce=require(_0xd1d3('0xc'));var deskjs=require(_0xd1d3('0xd'));var toCsv=require(_0xd1d3('0x6'));var querystring=require(_0xd1d3('0xe'));var Papa=require(_0xd1d3('0xf'));var Redis=require('ioredis');var authService=require(_0xd1d3('0x10'));var qs=require(_0xd1d3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1d3('0x12'));var logger=require(_0xd1d3('0x13'))(_0xd1d3('0x14'));var utils=require(_0xd1d3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd1d3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239e73,_0x4bf5cb){_0x4bf5cb=_0x4bf5cb||0xcc;return function(_0x2afe27){if(_0x2afe27){return _0x239e73[_0xd1d3('0x17')](_0x4bf5cb);}return _0x239e73['status'](_0x4bf5cb)[_0xd1d3('0x18')]();};}function respondWithResult(_0x9acc7e,_0x5df183){_0x5df183=_0x5df183||0xc8;return function(_0x5ce834){if(_0x5ce834){return _0x9acc7e['status'](_0x5df183)['json'](_0x5ce834);}};}function respondWithFilteredResult(_0xe8c224,_0x58da4c){return function(_0x36aca2){if(_0x36aca2){var _0x3da955=typeof _0x58da4c['offset']===_0xd1d3('0x19')&&typeof _0x58da4c[_0xd1d3('0x1a')]==='undefined';var _0x2fb45c=_0x36aca2['count'];var _0x15335d=_0x3da955?0x0:_0x58da4c[_0xd1d3('0x1b')];var _0x11c533=_0x3da955?_0x36aca2[_0xd1d3('0x1c')]:_0x58da4c[_0xd1d3('0x1b')]+_0x58da4c['limit'];var _0xba92c1;if(_0x11c533>=_0x2fb45c){_0x11c533=_0x2fb45c;_0xba92c1=0xc8;}else{_0xba92c1=0xce;}_0xe8c224[_0xd1d3('0x1d')](_0xba92c1);return _0xe8c224[_0xd1d3('0x1e')](_0xd1d3('0x1f'),_0x15335d+'-'+_0x11c533+'/'+_0x2fb45c)[_0xd1d3('0x20')](_0x36aca2);}return null;};}function patchUpdates(_0x4cf1a1){return function(_0x96615b){try{jsonpatch[_0xd1d3('0x21')](_0x96615b,_0x4cf1a1,!![]);}catch(_0x152181){return BPromise['reject'](_0x152181);}return _0x96615b[_0xd1d3('0x22')]();};}function saveUpdates(_0x464503,_0x4c2802){return function(_0x4cee9e){if(_0x4cee9e){return _0x4cee9e[_0xd1d3('0x23')](_0x464503)[_0xd1d3('0x24')](function(_0x979dcf){return _0x979dcf;});}return null;};}function removeEntity(_0x3b0f86,_0x4875fe){return function(_0xe1ba20){if(_0xe1ba20){return _0xe1ba20['destroy']()[_0xd1d3('0x24')](function(){var _0x12ad98=_0xe1ba20['get']({'plain':!![]});var _0x271fcd=_0xd1d3('0x25');return db[_0xd1d3('0x26')]['destroy']({'where':{'type':_0x271fcd,'resourceId':_0x12ad98['id']}})[_0xd1d3('0x24')](function(){return _0xe1ba20;});})[_0xd1d3('0x24')](function(){_0x3b0f86[_0xd1d3('0x1d')](0xcc)[_0xd1d3('0x18')]();});}};}function handleEntityNotFound(_0x5a78ed,_0x2f6072){return function(_0x42fe24){if(!_0x42fe24){_0x5a78ed['sendStatus'](0x194);}return _0x42fe24;};}function handleError(_0x5d3bf3,_0x1bc478){_0x1bc478=_0x1bc478||0x1f4;return function(_0x2e4194){logger[_0xd1d3('0x27')](_0x2e4194['stack']);if(_0x2e4194[_0xd1d3('0x28')]){delete _0x2e4194[_0xd1d3('0x28')];}_0x5d3bf3[_0xd1d3('0x1d')](_0x1bc478)[_0xd1d3('0x29')](_0x2e4194);};}exports['index']=function(_0x5b6a2e,_0x368e49){var _0x142cc1={},_0x67c928={},_0x4d7a2b={'count':0x0,'rows':[]};var _0x1c7dc1=_['map'](db[_0xd1d3('0x2a')]['rawAttributes'],function(_0x4f0b51){return{'name':_0x4f0b51[_0xd1d3('0x2b')],'type':_0x4f0b51[_0xd1d3('0x2c')][_0xd1d3('0x2d')]};});_0x67c928[_0xd1d3('0x2e')]=_[_0xd1d3('0x2f')](_0x1c7dc1,'name');_0x67c928[_0xd1d3('0x30')]=_[_0xd1d3('0x31')](_0x5b6a2e['query']);_0x67c928[_0xd1d3('0x32')]=_[_0xd1d3('0x33')](_0x67c928[_0xd1d3('0x2e')],_0x67c928[_0xd1d3('0x30')]);_0x142cc1[_0xd1d3('0x34')]=_[_0xd1d3('0x33')](_0x67c928[_0xd1d3('0x2e')],qs[_0xd1d3('0x35')](_0x5b6a2e[_0xd1d3('0x30')]['fields']));_0x142cc1['attributes']=_0x142cc1[_0xd1d3('0x34')][_0xd1d3('0x36')]?_0x142cc1['attributes']:_0x67c928['model'];if(!_0x5b6a2e[_0xd1d3('0x30')]['hasOwnProperty'](_0xd1d3('0x37'))){_0x142cc1[_0xd1d3('0x1a')]=qs[_0xd1d3('0x1a')](_0x5b6a2e[_0xd1d3('0x30')][_0xd1d3('0x1a')]);_0x142cc1[_0xd1d3('0x1b')]=qs[_0xd1d3('0x1b')](_0x5b6a2e[_0xd1d3('0x30')][_0xd1d3('0x1b')]);}_0x142cc1[_0xd1d3('0x38')]=qs[_0xd1d3('0x39')](_0x5b6a2e['query'][_0xd1d3('0x39')]);_0x142cc1[_0xd1d3('0x3a')]=qs[_0xd1d3('0x32')](_[_0xd1d3('0x3b')](_0x5b6a2e[_0xd1d3('0x30')],_0x67c928[_0xd1d3('0x32')]),_0x1c7dc1);if(_0x5b6a2e[_0xd1d3('0x30')][_0xd1d3('0x3c')]){_0x142cc1[_0xd1d3('0x3a')]=_[_0xd1d3('0x3d')](_0x142cc1[_0xd1d3('0x3a')],{'$or':[{'key':{'$like':'%'+_0x5b6a2e['query'][_0xd1d3('0x3c')]+'%'}},{'value':{'$like':'%'+_0x5b6a2e['query'][_0xd1d3('0x3c')]+'%'}}]});}_0x142cc1=_[_0xd1d3('0x3d')]({},_0x142cc1,_0x5b6a2e[_0xd1d3('0x3e')]);var _0xb0a468={'where':_0x142cc1[_0xd1d3('0x3a')]};return db['CannedAnswer'][_0xd1d3('0x1c')](_0xb0a468)[_0xd1d3('0x24')](function(_0x50b732){_0x4d7a2b['count']=_0x50b732;if(_0x5b6a2e['query'][_0xd1d3('0x3f')]){_0x142cc1[_0xd1d3('0x40')]=[{'all':!![]}];}return db[_0xd1d3('0x2a')][_0xd1d3('0x41')](_0x142cc1);})[_0xd1d3('0x24')](function(_0xb32da1){_0x4d7a2b[_0xd1d3('0x42')]=_0xb32da1;return _0x4d7a2b;})[_0xd1d3('0x24')](respondWithFilteredResult(_0x368e49,_0x142cc1))[_0xd1d3('0x43')](handleError(_0x368e49,null));};exports[_0xd1d3('0x44')]=function(_0x395f39,_0x5d1b1a){var _0xe287fb={'raw':!![],'where':{'id':_0x395f39[_0xd1d3('0x45')]['id']}},_0x3d5e36={};_0x3d5e36[_0xd1d3('0x2e')]=_[_0xd1d3('0x31')](db[_0xd1d3('0x2a')]['rawAttributes']);_0x3d5e36[_0xd1d3('0x30')]=_[_0xd1d3('0x31')](_0x395f39[_0xd1d3('0x30')]);_0x3d5e36[_0xd1d3('0x32')]=_[_0xd1d3('0x33')](_0x3d5e36[_0xd1d3('0x2e')],_0x3d5e36[_0xd1d3('0x30')]);_0xe287fb[_0xd1d3('0x34')]=_[_0xd1d3('0x33')](_0x3d5e36['model'],qs[_0xd1d3('0x35')](_0x395f39[_0xd1d3('0x30')][_0xd1d3('0x35')]));_0xe287fb[_0xd1d3('0x34')]=_0xe287fb[_0xd1d3('0x34')][_0xd1d3('0x36')]?_0xe287fb[_0xd1d3('0x34')]:_0x3d5e36[_0xd1d3('0x2e')];if(_0x395f39[_0xd1d3('0x30')]['includeAll']){_0xe287fb[_0xd1d3('0x40')]=[{'all':!![]}];}_0xe287fb=_['merge']({},_0xe287fb,_0x395f39[_0xd1d3('0x3e')]);return db['CannedAnswer']['find'](_0xe287fb)[_0xd1d3('0x24')](handleEntityNotFound(_0x5d1b1a,null))[_0xd1d3('0x24')](respondWithResult(_0x5d1b1a,null))['catch'](handleError(_0x5d1b1a,null));};exports[_0xd1d3('0x23')]=function(_0x23960b,_0x1bf47b){if(_0x23960b['body']['id']){delete _0x23960b['body']['id'];}return db[_0xd1d3('0x2a')][_0xd1d3('0x46')]({'where':{'id':_0x23960b['params']['id']}})[_0xd1d3('0x24')](handleEntityNotFound(_0x1bf47b,null))[_0xd1d3('0x24')](saveUpdates(_0x23960b[_0xd1d3('0x47')],null))[_0xd1d3('0x24')](respondWithResult(_0x1bf47b,null))[_0xd1d3('0x43')](handleError(_0x1bf47b,null));};exports[_0xd1d3('0x48')]=function(_0x5cbc43,_0x191c41){return db[_0xd1d3('0x2a')]['find']({'where':{'id':_0x5cbc43[_0xd1d3('0x45')]['id']}})[_0xd1d3('0x24')](handleEntityNotFound(_0x191c41,null))[_0xd1d3('0x24')](removeEntity(_0x191c41,null))['catch'](handleError(_0x191c41,null));};exports[_0xd1d3('0x49')]=function(_0x165ca6,_0x595e85){var _0x14bdc2={'key':_0x165ca6[_0xd1d3('0x47')]['key']};if(_0x165ca6[_0xd1d3('0x47')]['MailAccountId']){_0x14bdc2[_0xd1d3('0x4a')]=_0x165ca6['body'][_0xd1d3('0x4a')];}else if(_0x165ca6[_0xd1d3('0x47')][_0xd1d3('0x4b')]){_0x14bdc2[_0xd1d3('0x4b')]=_0x165ca6[_0xd1d3('0x47')]['SmsAccountId'];}else if(_0x165ca6['body'][_0xd1d3('0x4c')]){_0x14bdc2['OpenchannelAccountId']=_0x165ca6[_0xd1d3('0x47')][_0xd1d3('0x4c')];}else if(_0x165ca6[_0xd1d3('0x47')]['ChatWebsiteId']){_0x14bdc2[_0xd1d3('0x4d')]=_0x165ca6[_0xd1d3('0x47')][_0xd1d3('0x4d')];}return db[_0xd1d3('0x2a')]['find']({'where':_0x14bdc2})['then'](function(_0x51e755){if(_0x51e755){throw new db['Sequelize'][(_0xd1d3('0x4e'))](_0xd1d3('0x4f'));}return db[_0xd1d3('0x2a')]['create'](_0x165ca6[_0xd1d3('0x47')]);})[_0xd1d3('0x24')](function(_0x29e916){var _0xd597d=_0x165ca6['user']['get']({'plain':!![]});if(!_0xd597d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd597d[_0xd1d3('0x50')]==='user'){var _0x3a80b6=_0x29e916[_0xd1d3('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xd1d3('0x46')]({'where':{'name':_0xd1d3('0x25'),'userProfileId':_0xd597d[_0xd1d3('0x52')]},'raw':!![]})['then'](function(_0x2f02e9){if(_0x2f02e9&&_0x2f02e9[_0xd1d3('0x53')]===0x0){return db[_0xd1d3('0x26')][_0xd1d3('0x49')]({'name':_0x3a80b6['name'],'resourceId':_0x3a80b6['id'],'type':_0x2f02e9[_0xd1d3('0x28')],'sectionId':_0x2f02e9['id']},{})[_0xd1d3('0x24')](function(){return _0x29e916;});}else{return _0x29e916;}})['catch'](function(_0x4e4d24){logger[_0xd1d3('0x27')](_0xd1d3('0x54'),_0x4e4d24);throw _0x4e4d24;});}return _0x29e916;})[_0xd1d3('0x24')](respondWithResult(_0x595e85,0xc9))[_0xd1d3('0x43')](handleError(_0x595e85,null));}; \ No newline at end of file +var _0xcc40=['hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','show','params','fields','update','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0xcc40,0x77));var _0x0cc4=function(_0x5d49ca,_0x43fcb2){_0x5d49ca=_0x5d49ca-0x0;var _0x53e0c9=_0xcc40[_0x5d49ca];return _0x53e0c9;};'use strict';var emlformat=require(_0x0cc4('0x0'));var rimraf=require(_0x0cc4('0x1'));var zipdir=require(_0x0cc4('0x2'));var jsonpatch=require(_0x0cc4('0x3'));var rp=require(_0x0cc4('0x4'));var moment=require('moment');var BPromise=require(_0x0cc4('0x5'));var Mustache=require(_0x0cc4('0x6'));var util=require(_0x0cc4('0x7'));var path=require('path');var sox=require(_0x0cc4('0x8'));var csv=require(_0x0cc4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cc4('0xa'));var _=require('lodash');var squel=require(_0x0cc4('0xb'));var crypto=require(_0x0cc4('0xc'));var jsforce=require(_0x0cc4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0cc4('0x9'));var querystring=require(_0x0cc4('0xe'));var Papa=require(_0x0cc4('0xf'));var Redis=require(_0x0cc4('0x10'));var authService=require(_0x0cc4('0x11'));var qs=require(_0x0cc4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc4('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0cc4('0x14'));var config=require(_0x0cc4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cc4('0x16'))['db'];function respondWithStatusCode(_0x29e738,_0x1e92c2){_0x1e92c2=_0x1e92c2||0xcc;return function(_0x54cf32){if(_0x54cf32){return _0x29e738[_0x0cc4('0x17')](_0x1e92c2);}return _0x29e738[_0x0cc4('0x18')](_0x1e92c2)[_0x0cc4('0x19')]();};}function respondWithResult(_0x45d519,_0x4eee5e){_0x4eee5e=_0x4eee5e||0xc8;return function(_0x3ab04f){if(_0x3ab04f){return _0x45d519[_0x0cc4('0x18')](_0x4eee5e)[_0x0cc4('0x1a')](_0x3ab04f);}};}function respondWithFilteredResult(_0x1bb0c6,_0x33f65c){return function(_0x3d5ffc){if(_0x3d5ffc){var _0x1e17f8=typeof _0x33f65c['offset']==='undefined'&&typeof _0x33f65c['limit']==='undefined';var _0x5a6fb2=_0x3d5ffc['count'];var _0x32554d=_0x1e17f8?0x0:_0x33f65c[_0x0cc4('0x1b')];var _0x2ef5ea=_0x1e17f8?_0x3d5ffc[_0x0cc4('0x1c')]:_0x33f65c[_0x0cc4('0x1b')]+_0x33f65c['limit'];var _0x560cde;if(_0x2ef5ea>=_0x5a6fb2){_0x2ef5ea=_0x5a6fb2;_0x560cde=0xc8;}else{_0x560cde=0xce;}_0x1bb0c6['status'](_0x560cde);return _0x1bb0c6[_0x0cc4('0x1d')](_0x0cc4('0x1e'),_0x32554d+'-'+_0x2ef5ea+'/'+_0x5a6fb2)[_0x0cc4('0x1a')](_0x3d5ffc);}return null;};}function patchUpdates(_0x52912e){return function(_0x5928c8){try{jsonpatch[_0x0cc4('0x1f')](_0x5928c8,_0x52912e,!![]);}catch(_0x16a09b){return BPromise[_0x0cc4('0x20')](_0x16a09b);}return _0x5928c8['save']();};}function saveUpdates(_0x5bd5da,_0x3c5b80){return function(_0x2580d8){if(_0x2580d8){return _0x2580d8['update'](_0x5bd5da)[_0x0cc4('0x21')](function(_0x2b334d){return _0x2b334d;});}return null;};}function removeEntity(_0x1bc218,_0x138b70){return function(_0x472687){if(_0x472687){return _0x472687[_0x0cc4('0x22')]()['then'](function(){var _0x41d915=_0x472687[_0x0cc4('0x23')]({'plain':!![]});var _0x246db7=_0x0cc4('0x24');return db[_0x0cc4('0x25')]['destroy']({'where':{'type':_0x246db7,'resourceId':_0x41d915['id']}})[_0x0cc4('0x21')](function(){return _0x472687;});})[_0x0cc4('0x21')](function(){_0x1bc218[_0x0cc4('0x18')](0xcc)[_0x0cc4('0x19')]();});}};}function handleEntityNotFound(_0x3cfe33,_0x20b0cd){return function(_0x2c23f7){if(!_0x2c23f7){_0x3cfe33['sendStatus'](0x194);}return _0x2c23f7;};}function handleError(_0x434138,_0xe8b4eb){_0xe8b4eb=_0xe8b4eb||0x1f4;return function(_0x1b7e20){logger[_0x0cc4('0x26')](_0x1b7e20[_0x0cc4('0x27')]);if(_0x1b7e20['name']){delete _0x1b7e20[_0x0cc4('0x28')];}_0x434138[_0x0cc4('0x18')](_0xe8b4eb)['send'](_0x1b7e20);};}exports[_0x0cc4('0x29')]=function(_0x2dd6d7,_0xa8b652){var _0x5cfb84={},_0x80e412={},_0x11d141={'count':0x0,'rows':[]};var _0x466597=_[_0x0cc4('0x2a')](db[_0x0cc4('0x2b')][_0x0cc4('0x2c')],function(_0x2669bd){return{'name':_0x2669bd[_0x0cc4('0x2d')],'type':_0x2669bd[_0x0cc4('0x2e')][_0x0cc4('0x2f')]};});_0x80e412[_0x0cc4('0x30')]=_[_0x0cc4('0x2a')](_0x466597,_0x0cc4('0x28'));_0x80e412['query']=_[_0x0cc4('0x31')](_0x2dd6d7[_0x0cc4('0x32')]);_0x80e412[_0x0cc4('0x33')]=_['intersection'](_0x80e412[_0x0cc4('0x30')],_0x80e412[_0x0cc4('0x32')]);_0x5cfb84[_0x0cc4('0x34')]=_[_0x0cc4('0x35')](_0x80e412[_0x0cc4('0x30')],qs['fields'](_0x2dd6d7[_0x0cc4('0x32')]['fields']));_0x5cfb84['attributes']=_0x5cfb84[_0x0cc4('0x34')][_0x0cc4('0x36')]?_0x5cfb84[_0x0cc4('0x34')]:_0x80e412['model'];if(!_0x2dd6d7[_0x0cc4('0x32')][_0x0cc4('0x37')](_0x0cc4('0x38'))){_0x5cfb84[_0x0cc4('0x39')]=qs['limit'](_0x2dd6d7[_0x0cc4('0x32')][_0x0cc4('0x39')]);_0x5cfb84[_0x0cc4('0x1b')]=qs[_0x0cc4('0x1b')](_0x2dd6d7[_0x0cc4('0x32')][_0x0cc4('0x1b')]);}_0x5cfb84[_0x0cc4('0x3a')]=qs[_0x0cc4('0x3b')](_0x2dd6d7['query'][_0x0cc4('0x3b')]);_0x5cfb84[_0x0cc4('0x3c')]=qs['filters'](_[_0x0cc4('0x3d')](_0x2dd6d7['query'],_0x80e412[_0x0cc4('0x33')]),_0x466597);if(_0x2dd6d7[_0x0cc4('0x32')]['filter']){_0x5cfb84[_0x0cc4('0x3c')]=_[_0x0cc4('0x3e')](_0x5cfb84[_0x0cc4('0x3c')],{'$or':[{'key':{'$like':'%'+_0x2dd6d7[_0x0cc4('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x2dd6d7['query'][_0x0cc4('0x3f')]+'%'}}]});}_0x5cfb84=_[_0x0cc4('0x3e')]({},_0x5cfb84,_0x2dd6d7[_0x0cc4('0x40')]);var _0x78fd00={'where':_0x5cfb84[_0x0cc4('0x3c')]};return db[_0x0cc4('0x2b')]['count'](_0x78fd00)['then'](function(_0x397ecb){_0x11d141[_0x0cc4('0x1c')]=_0x397ecb;if(_0x2dd6d7[_0x0cc4('0x32')][_0x0cc4('0x41')]){_0x5cfb84[_0x0cc4('0x42')]=[{'all':!![]}];}return db[_0x0cc4('0x2b')][_0x0cc4('0x43')](_0x5cfb84);})[_0x0cc4('0x21')](function(_0x2cc844){_0x11d141['rows']=_0x2cc844;return _0x11d141;})['then'](respondWithFilteredResult(_0xa8b652,_0x5cfb84))['catch'](handleError(_0xa8b652,null));};exports[_0x0cc4('0x44')]=function(_0x15b435,_0x239137){var _0x446b58={'raw':!![],'where':{'id':_0x15b435[_0x0cc4('0x45')]['id']}},_0x4be71f={};_0x4be71f[_0x0cc4('0x30')]=_[_0x0cc4('0x31')](db['CannedAnswer'][_0x0cc4('0x2c')]);_0x4be71f[_0x0cc4('0x32')]=_[_0x0cc4('0x31')](_0x15b435['query']);_0x4be71f[_0x0cc4('0x33')]=_['intersection'](_0x4be71f[_0x0cc4('0x30')],_0x4be71f['query']);_0x446b58[_0x0cc4('0x34')]=_['intersection'](_0x4be71f[_0x0cc4('0x30')],qs[_0x0cc4('0x46')](_0x15b435[_0x0cc4('0x32')][_0x0cc4('0x46')]));_0x446b58[_0x0cc4('0x34')]=_0x446b58[_0x0cc4('0x34')][_0x0cc4('0x36')]?_0x446b58[_0x0cc4('0x34')]:_0x4be71f[_0x0cc4('0x30')];if(_0x15b435[_0x0cc4('0x32')][_0x0cc4('0x41')]){_0x446b58[_0x0cc4('0x42')]=[{'all':!![]}];}_0x446b58=_[_0x0cc4('0x3e')]({},_0x446b58,_0x15b435[_0x0cc4('0x40')]);return db[_0x0cc4('0x2b')]['find'](_0x446b58)['then'](handleEntityNotFound(_0x239137,null))[_0x0cc4('0x21')](respondWithResult(_0x239137,null))['catch'](handleError(_0x239137,null));};exports[_0x0cc4('0x47')]=function(_0x1bad37,_0x74a33b){if(_0x1bad37[_0x0cc4('0x48')]['id']){delete _0x1bad37[_0x0cc4('0x48')]['id'];}return db[_0x0cc4('0x2b')][_0x0cc4('0x49')]({'where':{'id':_0x1bad37[_0x0cc4('0x45')]['id']}})['then'](handleEntityNotFound(_0x74a33b,null))[_0x0cc4('0x21')](saveUpdates(_0x1bad37[_0x0cc4('0x48')],null))[_0x0cc4('0x21')](respondWithResult(_0x74a33b,null))['catch'](handleError(_0x74a33b,null));};exports[_0x0cc4('0x22')]=function(_0x1f9dfc,_0x5c9593){return db[_0x0cc4('0x2b')][_0x0cc4('0x49')]({'where':{'id':_0x1f9dfc['params']['id']}})[_0x0cc4('0x21')](handleEntityNotFound(_0x5c9593,null))[_0x0cc4('0x21')](removeEntity(_0x5c9593,null))['catch'](handleError(_0x5c9593,null));};exports['create']=function(_0x3a2e9a,_0x3d342c){var _0x3fdd1d={'key':_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x2f')]};if(_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x4a')]){_0x3fdd1d[_0x0cc4('0x4a')]=_0x3a2e9a[_0x0cc4('0x48')]['MailAccountId'];}else if(_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x4b')]){_0x3fdd1d['SmsAccountId']=_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x4b')];}else if(_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x4c')]){_0x3fdd1d[_0x0cc4('0x4c')]=_0x3a2e9a[_0x0cc4('0x48')][_0x0cc4('0x4c')];}else if(_0x3a2e9a[_0x0cc4('0x48')]['ChatWebsiteId']){_0x3fdd1d[_0x0cc4('0x4d')]=_0x3a2e9a['body'][_0x0cc4('0x4d')];}return db[_0x0cc4('0x2b')]['find']({'where':_0x3fdd1d})[_0x0cc4('0x21')](function(_0xebb143){if(_0xebb143){throw new db['Sequelize'][(_0x0cc4('0x4e'))](_0x0cc4('0x4f'));}return db['CannedAnswer']['create'](_0x3a2e9a[_0x0cc4('0x48')]);})[_0x0cc4('0x21')](function(_0x1600f7){var _0x2ee0a1=_0x3a2e9a['user'][_0x0cc4('0x23')]({'plain':!![]});if(!_0x2ee0a1)throw new Error(_0x0cc4('0x50'));if(_0x2ee0a1[_0x0cc4('0x51')]===_0x0cc4('0x52')){var _0x4c8e2e=_0x1600f7[_0x0cc4('0x23')]({'plain':!![]});return db[_0x0cc4('0x53')][_0x0cc4('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x2ee0a1[_0x0cc4('0x54')]},'raw':!![]})[_0x0cc4('0x21')](function(_0x4246dd){if(_0x4246dd&&_0x4246dd['autoAssociation']===0x0){return db['UserProfileResource'][_0x0cc4('0x55')]({'name':_0x4c8e2e[_0x0cc4('0x28')],'resourceId':_0x4c8e2e['id'],'type':_0x4246dd[_0x0cc4('0x28')],'sectionId':_0x4246dd['id']},{})['then'](function(){return _0x1600f7;});}else{return _0x1600f7;}})[_0x0cc4('0x56')](function(_0x275e20){logger[_0x0cc4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x275e20);throw _0x275e20;});}return _0x1600f7;})[_0x0cc4('0x21')](respondWithResult(_0x3d342c,0xc9))[_0x0cc4('0x56')](handleError(_0x3d342c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d200528..17e50ce 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 _0xcd6a=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd6a,0xa6));var _0xacd6=function(_0x361b1b,_0x56af5b){_0x361b1b=_0x361b1b-0x0;var _0x17c591=_0xcd6a[_0x361b1b];return _0x17c591;};'use strict';var _=require('lodash');var util=require(_0xacd6('0x0'));var logger=require(_0xacd6('0x1'))(_0xacd6('0x2'));var moment=require('moment');var BPromise=require(_0xacd6('0x3'));var rp=require(_0xacd6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacd6('0x5'));var config=require('../../config/environment');var attributes=require(_0xacd6('0x6'));module[_0xacd6('0x7')]=function(_0x18eeb4,_0x572297){return _0x18eeb4['define'](_0xacd6('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xacd6('0x9'),'collate':_0xacd6('0xa')});}; \ No newline at end of file +var _0x1beb=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x2f1deb,_0x506c9a){var _0x1dc5ab=function(_0x3bc600){while(--_0x3bc600){_0x2f1deb['push'](_0x2f1deb['shift']());}};_0x1dc5ab(++_0x506c9a);}(_0x1beb,0x165));var _0xb1be=function(_0x313294,_0x586d6d){_0x313294=_0x313294-0x0;var _0x162522=_0x1beb[_0x313294];return _0x162522;};'use strict';var _=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var logger=require('../../config/logger')(_0xb1be('0x2'));var moment=require(_0xb1be('0x3'));var BPromise=require(_0xb1be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1be('0x5'));var rimraf=require(_0xb1be('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1be('0x7'));module[_0xb1be('0x8')]=function(_0x116394,_0xe36555){return _0x116394[_0xb1be('0x9')](_0xb1be('0xa'),attributes,{'tableName':_0xb1be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb1be('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 61373ba..4eaa19f 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(_0x73de58,_0x373667){var _0x47fe5b=function(_0x32fdb5){while(--_0x32fdb5){_0x73de58['push'](_0x73de58['shift']());}};_0x47fe5b(++_0x373667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x452a43,_0x2cd623){var _0x331099=function(_0xa62c82){while(--_0xa62c82){_0x452a43['push'](_0x452a43['shift']());}};_0x331099(++_0x2cd623);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index fe7a40b..73b228d 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 _0x559a=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','post','put','update','destroy','exports'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x559a,0x1d1));var _0xa559=function(_0x63cffc,_0x4ff552){_0x63cffc=_0x63cffc-0x0;var _0x2f967b=_0x559a[_0x63cffc];return _0x2f967b;};'use strict';var multer=require('multer');var util=require(_0xa559('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa559('0x1'));var router=express[_0xa559('0x2')]();var fs_extra=require(_0xa559('0x3'));var auth=require(_0xa559('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa559('0x5'));var controller=require(_0xa559('0x6'));router[_0xa559('0x7')]('/',auth[_0xa559('0x8')](),controller['index']);router[_0xa559('0x7')](_0xa559('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa559('0xa')]('/',auth[_0xa559('0x8')](),controller['create']);router[_0xa559('0xb')](_0xa559('0x9'),auth[_0xa559('0x8')](),controller[_0xa559('0xc')]);router['delete']('/:id',auth[_0xa559('0x8')](),controller[_0xa559('0xd')]);module[_0xa559('0xe')]=router; \ No newline at end of file +var _0x06d5=['create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06d5,0x1e4));var _0x506d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x06d5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x506d('0x0'));var util=require(_0x506d('0x1'));var path=require(_0x506d('0x2'));var timeout=require(_0x506d('0x3'));var express=require(_0x506d('0x4'));var router=express[_0x506d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x506d('0x6'));var config=require('../../config/environment');var controller=require(_0x506d('0x7'));router[_0x506d('0x8')]('/',auth[_0x506d('0x9')](),controller['index']);router[_0x506d('0x8')](_0x506d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x506d('0xb')]('/',auth[_0x506d('0x9')](),controller[_0x506d('0xc')]);router['put'](_0x506d('0xa'),auth[_0x506d('0x9')](),controller[_0x506d('0xd')]);router[_0x506d('0xe')](_0x506d('0xa'),auth[_0x506d('0x9')](),controller['destroy']);module[_0x506d('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c8f9073..8505faa 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 _0xcea2=['STRING','INTEGER','sequelize','DATE'];(function(_0x3ba6e9,_0x1c7dc7){var _0x2e5a29=function(_0x1ff325){while(--_0x1ff325){_0x3ba6e9['push'](_0x3ba6e9['shift']());}};_0x2e5a29(++_0x1c7dc7);}(_0xcea2,0x15a));var _0x2cea=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xcea2[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x2cea('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x2cea('0x2')]},'src':{'type':Sequelize[_0x2cea('0x2')]},'dst':{'type':Sequelize[_0x2cea('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2cea('0x2')]},'dstchannel':{'type':Sequelize[_0x2cea('0x2')]},'lastapp':{'type':Sequelize[_0x2cea('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2cea('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2cea('0x2')]},'amaflags':{'type':Sequelize[_0x2cea('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2cea('0x2')]},'userfield':{'type':Sequelize[_0x2cea('0x2')]},'uniqueid':{'type':Sequelize[_0x2cea('0x2')]},'linkedid':{'type':Sequelize[_0x2cea('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x2cea('0x2')]},'type':{'type':Sequelize[_0x2cea('0x2')]},'tag':{'type':Sequelize[_0x2cea('0x2')]}}; \ No newline at end of file +var _0x9d3d=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x19f32e,_0x3dc822){var _0x261cc2=function(_0x5de051){while(--_0x5de051){_0x19f32e['push'](_0x19f32e['shift']());}};_0x261cc2(++_0x3dc822);}(_0x9d3d,0x96));var _0xd9d3=function(_0x114976,_0x118228){_0x114976=_0x114976-0x0;var _0xb08928=_0x9d3d[_0x114976];return _0xb08928;};'use strict';var Sequelize=require('sequelize');module[_0xd9d3('0x0')]={'calldate':{'type':Sequelize[_0xd9d3('0x1')],'allowNull':![],'defaultValue':_0xd9d3('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xd9d3('0x3')]},'dcontext':{'type':Sequelize[_0xd9d3('0x3')]},'channel':{'type':Sequelize[_0xd9d3('0x3')]},'dstchannel':{'type':Sequelize[_0xd9d3('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd9d3('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd9d3('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd9d3('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xd9d3('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd9d3('0x3')]},'sequence':{'type':Sequelize[_0xd9d3('0x3')]},'peeraccount':{'type':Sequelize[_0xd9d3('0x3')]},'type':{'type':Sequelize[_0xd9d3('0x3')]},'tag':{'type':Sequelize[_0xd9d3('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 8da0dc9..568bc52 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 _0x31c2=['then','destroy','error','name','send','index','map','Cdr','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','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','reject','save','update'];(function(_0x3c79d1,_0x1e55d4){var _0x1646e8=function(_0x278dfe){while(--_0x278dfe){_0x3c79d1['push'](_0x3c79d1['shift']());}};_0x1646e8(++_0x1e55d4);}(_0x31c2,0x1e1));var _0x231c=function(_0x5f0810,_0xda9a54){_0x5f0810=_0x5f0810-0x0;var _0x546d16=_0x31c2[_0x5f0810];return _0x546d16;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];function respondWithStatusCode(_0x43c270,_0x871ed1){_0x871ed1=_0x871ed1||0xcc;return function(_0x1aa3fe){if(_0x1aa3fe){return _0x43c270[_0x231c('0x19')](_0x871ed1);}return _0x43c270[_0x231c('0x1a')](_0x871ed1)[_0x231c('0x1b')]();};}function respondWithResult(_0x3355f6,_0xc09de5){_0xc09de5=_0xc09de5||0xc8;return function(_0x311218){if(_0x311218){return _0x3355f6[_0x231c('0x1a')](_0xc09de5)[_0x231c('0x1c')](_0x311218);}};}function respondWithFilteredResult(_0xe37de8,_0x1f7764){return function(_0x12a6ad){if(_0x12a6ad){var _0x210f2e=typeof _0x1f7764[_0x231c('0x1d')]===_0x231c('0x1e')&&typeof _0x1f7764[_0x231c('0x1f')]===_0x231c('0x1e');var _0x51b8ca=_0x12a6ad[_0x231c('0x20')];var _0x341645=_0x210f2e?0x0:_0x1f7764[_0x231c('0x1d')];var _0xadea80=_0x210f2e?_0x12a6ad[_0x231c('0x20')]:_0x1f7764[_0x231c('0x1d')]+_0x1f7764[_0x231c('0x1f')];var _0x172d50;if(_0xadea80>=_0x51b8ca){_0xadea80=_0x51b8ca;_0x172d50=0xc8;}else{_0x172d50=0xce;}_0xe37de8[_0x231c('0x1a')](_0x172d50);return _0xe37de8[_0x231c('0x21')]('Content-Range',_0x341645+'-'+_0xadea80+'/'+_0x51b8ca)[_0x231c('0x1c')](_0x12a6ad);}return null;};}function patchUpdates(_0x5e8a53){return function(_0x872034){try{jsonpatch['apply'](_0x872034,_0x5e8a53,!![]);}catch(_0x42cca3){return BPromise[_0x231c('0x22')](_0x42cca3);}return _0x872034[_0x231c('0x23')]();};}function saveUpdates(_0x3267f9,_0x255671){return function(_0x309393){if(_0x309393){return _0x309393[_0x231c('0x24')](_0x3267f9)[_0x231c('0x25')](function(_0x54566f){return _0x54566f;});}return null;};}function removeEntity(_0x128112,_0x3336d8){return function(_0x4af49b){if(_0x4af49b){return _0x4af49b[_0x231c('0x26')]()[_0x231c('0x25')](function(){_0x128112['status'](0xcc)[_0x231c('0x1b')]();});}};}function handleEntityNotFound(_0x564939,_0x3ea0cd){return function(_0x454f70){if(!_0x454f70){_0x564939[_0x231c('0x19')](0x194);}return _0x454f70;};}function handleError(_0x2a673c,_0x449d74){_0x449d74=_0x449d74||0x1f4;return function(_0x131cfd){logger[_0x231c('0x27')](_0x131cfd['stack']);if(_0x131cfd[_0x231c('0x28')]){delete _0x131cfd[_0x231c('0x28')];}_0x2a673c['status'](_0x449d74)[_0x231c('0x29')](_0x131cfd);};}exports[_0x231c('0x2a')]=function(_0x45ced8,_0xeeddfc){var _0x271635={},_0x15a9bb={},_0x40f76e={'count':0x0,'rows':[]};var _0x4dfaa3=_[_0x231c('0x2b')](db[_0x231c('0x2c')]['rawAttributes'],function(_0x4be2e2){return{'name':_0x4be2e2['fieldName'],'type':_0x4be2e2[_0x231c('0x2d')]['key']};});_0x15a9bb[_0x231c('0x2e')]=_['map'](_0x4dfaa3,_0x231c('0x28'));_0x15a9bb[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x45ced8[_0x231c('0x2f')]);_0x15a9bb['filters']=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],_0x15a9bb[_0x231c('0x2f')]);_0x271635[_0x231c('0x32')]=_[_0x231c('0x31')](_0x15a9bb[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x45ced8[_0x231c('0x2f')]['fields']));_0x271635['attributes']=_0x271635[_0x231c('0x32')][_0x231c('0x34')]?_0x271635[_0x231c('0x32')]:_0x15a9bb[_0x231c('0x2e')];if(!_0x45ced8[_0x231c('0x2f')][_0x231c('0x35')]('nolimit')){_0x271635[_0x231c('0x1f')]=qs[_0x231c('0x1f')](_0x45ced8['query']['limit']);_0x271635[_0x231c('0x1d')]=qs['offset'](_0x45ced8[_0x231c('0x2f')]['offset']);}_0x271635[_0x231c('0x36')]=qs[_0x231c('0x37')](_0x45ced8['query'][_0x231c('0x37')]);_0x271635[_0x231c('0x38')]=qs[_0x231c('0x39')](_['pick'](_0x45ced8[_0x231c('0x2f')],_0x15a9bb[_0x231c('0x39')]),_0x4dfaa3);if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3a')]){_0x271635[_0x231c('0x38')]=_[_0x231c('0x3b')](_0x271635[_0x231c('0x38')],{'$or':_[_0x231c('0x2b')](_0x4dfaa3,function(_0x409b01){if(_0x409b01[_0x231c('0x2d')]!==_0x231c('0x3c')){var _0x2c8033={};_0x2c8033[_0x409b01[_0x231c('0x28')]]={'$like':'%'+_0x45ced8['query'][_0x231c('0x3a')]+'%'};return _0x2c8033;}})});}_0x271635=_[_0x231c('0x3b')]({},_0x271635,_0x45ced8[_0x231c('0x3d')]);var _0x2f763d={'where':_0x271635[_0x231c('0x38')]};return db['Cdr'][_0x231c('0x20')](_0x2f763d)[_0x231c('0x25')](function(_0x229953){_0x40f76e['count']=_0x229953;if(_0x45ced8[_0x231c('0x2f')][_0x231c('0x3e')]){_0x271635[_0x231c('0x3f')]=[{'all':!![]}];}return db[_0x231c('0x2c')][_0x231c('0x40')](_0x271635);})[_0x231c('0x25')](function(_0x5d46eb){_0x40f76e[_0x231c('0x41')]=_0x5d46eb;return _0x40f76e;})[_0x231c('0x25')](respondWithFilteredResult(_0xeeddfc,_0x271635))[_0x231c('0x42')](handleError(_0xeeddfc,null));};exports[_0x231c('0x43')]=function(_0x518011,_0x33396b){var _0x523339={'raw':!![],'where':{'id':_0x518011['params']['id']}},_0x26bfd2={};_0x26bfd2[_0x231c('0x2e')]=_[_0x231c('0x30')](db[_0x231c('0x2c')][_0x231c('0x44')]);_0x26bfd2[_0x231c('0x2f')]=_[_0x231c('0x30')](_0x518011['query']);_0x26bfd2[_0x231c('0x39')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],_0x26bfd2['query']);_0x523339[_0x231c('0x32')]=_[_0x231c('0x31')](_0x26bfd2[_0x231c('0x2e')],qs[_0x231c('0x33')](_0x518011['query'][_0x231c('0x33')]));_0x523339['attributes']=_0x523339[_0x231c('0x32')][_0x231c('0x34')]?_0x523339[_0x231c('0x32')]:_0x26bfd2[_0x231c('0x2e')];if(_0x518011[_0x231c('0x2f')][_0x231c('0x3e')]){_0x523339[_0x231c('0x3f')]=[{'all':!![]}];}_0x523339=_[_0x231c('0x3b')]({},_0x523339,_0x518011[_0x231c('0x3d')]);return db[_0x231c('0x2c')][_0x231c('0x45')](_0x523339)[_0x231c('0x25')](handleEntityNotFound(_0x33396b,null))[_0x231c('0x25')](respondWithResult(_0x33396b,null))[_0x231c('0x42')](handleError(_0x33396b,null));};exports['create']=function(_0x18aaca,_0x293de2){return db[_0x231c('0x2c')][_0x231c('0x46')](_0x18aaca[_0x231c('0x47')],{})['then'](respondWithResult(_0x293de2,0xc9))['catch'](handleError(_0x293de2,null));};exports[_0x231c('0x24')]=function(_0x56a885,_0x419f63){if(_0x56a885[_0x231c('0x47')]['id']){delete _0x56a885[_0x231c('0x47')]['id'];}return db['Cdr'][_0x231c('0x45')]({'where':{'id':_0x56a885['params']['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x419f63,null))[_0x231c('0x25')](saveUpdates(_0x56a885['body'],null))[_0x231c('0x25')](respondWithResult(_0x419f63,null))[_0x231c('0x42')](handleError(_0x419f63,null));};exports[_0x231c('0x26')]=function(_0x5d2d20,_0x49baac){return db['Cdr'][_0x231c('0x45')]({'where':{'id':_0x5d2d20[_0x231c('0x48')]['id']}})[_0x231c('0x25')](handleEntityNotFound(_0x49baac,null))['then'](removeEntity(_0x49baac,null))[_0x231c('0x42')](handleError(_0x49baac,null));};exports[_0x231c('0x49')]=function(_0x4fd60b,_0xf225d0){return db[_0x231c('0x2c')][_0x231c('0x49')]()[_0x231c('0x25')](respondWithResult(_0xf225d0,null))[_0x231c('0x42')](handleError(_0xf225d0,null));}; \ No newline at end of file +var _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0xc0504e,_0x31d68f){var _0x8181d=function(_0x1e971b){while(--_0x1e971b){_0xc0504e['push'](_0xc0504e['shift']());}};_0x8181d(++_0x31d68f);}(_0x8819,0x94));var _0x9881=function(_0x3c2c5f,_0x129d69){_0x3c2c5f=_0x3c2c5f-0x0;var _0x4ab7d1=_0x8819[_0x3c2c5f];return _0x4ab7d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5ab696c..f47f33e 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(_0x42e722,_0x5c0998){var _0x5efcd9=function(_0x2287bb){while(--_0x2287bb){_0x42e722['push'](_0x42e722['shift']());}};_0x5efcd9(++_0x5c0998);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4d8f6f,_0x559720){var _0x441c71=function(_0x543b50){while(--_0x543b50){_0x4d8f6f['push'](_0x4d8f6f['shift']());}};_0x441c71(++_0x559720);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 42813fa..ed54c46 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 _0x584c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x584c,0x1df));var _0xc584=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x584c[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xc584('0x0'));var util=require(_0xc584('0x1'));var moment=require(_0xc584('0x2'));var BPromise=require(_0xc584('0x3'));var rs=require(_0xc584('0x4'));var fs=require('fs');var Redis=require(_0xc584('0x5'));var db=require(_0xc584('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc584('0x7'))(_0xc584('0x8'));var config=require(_0xc584('0x9'));var jayson=require(_0xc584('0xa'));var client=jayson[_0xc584('0xb')][_0xc584('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x572e58,_0x9023a4,_0x4a5674){return new BPromise(function(_0x2ae08e,_0x1be714){return client['request'](_0x572e58,_0x4a5674)[_0xc584('0xd')](function(_0xbade24){logger[_0xc584('0xe')](_0xc584('0xf'),_0x9023a4,_0xc584('0x10'));logger[_0xc584('0x11')](_0xc584('0x12'),_0x9023a4,_0xc584('0x10'),JSON['stringify'](_0xbade24));if(_0xbade24[_0xc584('0x13')]){if(_0xbade24[_0xc584('0x13')][_0xc584('0x14')]===0x1f4){logger[_0xc584('0x13')](_0xc584('0xf'),_0x9023a4,_0xbade24[_0xc584('0x13')][_0xc584('0x15')]);return _0x1be714(_0xbade24['error']['message']);}logger[_0xc584('0x13')](_0xc584('0xf'),_0x9023a4,_0xbade24['error'][_0xc584('0x15')]);return _0x2ae08e(_0xbade24['error'][_0xc584('0x15')]);}else{logger[_0xc584('0xe')](_0xc584('0xf'),_0x9023a4,_0xc584('0x10'));_0x2ae08e(_0xbade24['result']['message']);}})[_0xc584('0x16')](function(_0x4f61d7){logger[_0xc584('0x13')](_0xc584('0xf'),_0x9023a4,_0x4f61d7);_0x1be714(_0x4f61d7);});});} \ No newline at end of file +var _0x7e21=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','result','lodash'];(function(_0x5eb913,_0x1fac3d){var _0x1aa949=function(_0x58a2e1){while(--_0x58a2e1){_0x5eb913['push'](_0x5eb913['shift']());}};_0x1aa949(++_0x1fac3d);}(_0x7e21,0x1cd));var _0x17e2=function(_0x115162,_0x1eaa7b){_0x115162=_0x115162-0x0;var _0x502071=_0x7e21[_0x115162];return _0x502071;};'use strict';var _=require(_0x17e2('0x0'));var util=require(_0x17e2('0x1'));var moment=require(_0x17e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17e2('0x3'));var fs=require('fs');var Redis=require(_0x17e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17e2('0x5'));var logger=require(_0x17e2('0x6'))(_0x17e2('0x7'));var config=require(_0x17e2('0x8'));var jayson=require(_0x17e2('0x9'));var client=jayson[_0x17e2('0xa')][_0x17e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x745f3e,_0x2663b3,_0x33460d){return new BPromise(function(_0x66be72,_0x2963ad){return client[_0x17e2('0xc')](_0x745f3e,_0x33460d)[_0x17e2('0xd')](function(_0x20db6e){logger['info'](_0x17e2('0xe'),_0x2663b3,_0x17e2('0xf'));logger[_0x17e2('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2663b3,_0x17e2('0xf'),JSON[_0x17e2('0x11')](_0x20db6e));if(_0x20db6e['error']){if(_0x20db6e['error'][_0x17e2('0x12')]===0x1f4){logger['error'](_0x17e2('0xe'),_0x2663b3,_0x20db6e['error'][_0x17e2('0x13')]);return _0x2963ad(_0x20db6e[_0x17e2('0x14')][_0x17e2('0x13')]);}logger[_0x17e2('0x14')](_0x17e2('0xe'),_0x2663b3,_0x20db6e['error']['message']);return _0x66be72(_0x20db6e[_0x17e2('0x14')][_0x17e2('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x2663b3,_0x17e2('0xf'));_0x66be72(_0x20db6e[_0x17e2('0x15')][_0x17e2('0x13')]);}})['catch'](function(_0x1a904c){logger[_0x17e2('0x14')](_0x17e2('0xe'),_0x2663b3,_0x1a904c);_0x2963ad(_0x1a904c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index c8df3a3..6d5370d 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xcb228f,_0x5c6b29){var _0x24baa9=function(_0x3f7d58){while(--_0x3f7d58){_0xcb228f['push'](_0xcb228f['shift']());}};_0x24baa9(++_0x5c6b29);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ee607,_0x5ef350){_0x5ee607=_0x5ee607-0x0;var _0x49a75a=_0xb10b[_0x5ee607];return _0x49a75a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c99c2e8..35db0c8 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 _0x5609=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x5609,0x14d));var _0x9560=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5609[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x9560('0x0'));module[_0x9560('0x1')]={'priority':{'type':Sequelize[_0x9560('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9560('0x3')],'allowNull':![],'defaultValue':_0x9560('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9560('0x3')]},'interval':{'type':Sequelize[_0x9560('0x3')],'defaultValue':_0x9560('0x5')}}; \ No newline at end of file +var _0x1bfc=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x566939,_0x2f5e3c){var _0x46dd57=function(_0x35e3e4){while(--_0x35e3e4){_0x566939['push'](_0x566939['shift']());}};_0x46dd57(++_0x2f5e3c);}(_0x1bfc,0xcf));var _0xc1bf=function(_0x1af941,_0x1c873e){_0x1af941=_0x1af941-0x0;var _0x5d7f4d=_0x1bfc[_0x1af941];return _0x5d7f4d;};'use strict';var Sequelize=require(_0xc1bf('0x0'));module[_0xc1bf('0x1')]={'priority':{'type':Sequelize[_0xc1bf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc1bf('0x3')],'allowNull':![],'defaultValue':_0xc1bf('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc1bf('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 329e59e..22bc445 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 _0xe9ad=['fields','length','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','model','attributes','intersection'];(function(_0x1d7ca0,_0x2cf461){var _0x406010=function(_0x4e9217){while(--_0x4e9217){_0x1d7ca0['push'](_0x1d7ca0['shift']());}};_0x406010(++_0x2cf461);}(_0xe9ad,0x82));var _0xde9a=function(_0x53b37c,_0x1e3dae){_0x53b37c=_0x53b37c-0x0;var _0x912a5=_0xe9ad[_0x53b37c];return _0x912a5;};'use strict';var emlformat=require(_0xde9a('0x0'));var rimraf=require(_0xde9a('0x1'));var zipdir=require(_0xde9a('0x2'));var jsonpatch=require(_0xde9a('0x3'));var rp=require(_0xde9a('0x4'));var moment=require(_0xde9a('0x5'));var BPromise=require(_0xde9a('0x6'));var Mustache=require('mustache');var util=require(_0xde9a('0x7'));var path=require(_0xde9a('0x8'));var sox=require(_0xde9a('0x9'));var csv=require(_0xde9a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde9a('0xb'));var _=require(_0xde9a('0xc'));var squel=require(_0xde9a('0xd'));var crypto=require('crypto');var jsforce=require(_0xde9a('0xe'));var deskjs=require(_0xde9a('0xf'));var toCsv=require(_0xde9a('0xa'));var querystring=require(_0xde9a('0x10'));var Papa=require(_0xde9a('0x11'));var Redis=require(_0xde9a('0x12'));var authService=require(_0xde9a('0x13'));var qs=require(_0xde9a('0x14'));var as=require(_0xde9a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde9a('0x16'))(_0xde9a('0x17'));var utils=require(_0xde9a('0x18'));var config=require(_0xde9a('0x19'));var licenseUtil=require(_0xde9a('0x1a'));var db=require(_0xde9a('0x1b'))['db'];function respondWithStatusCode(_0x1cb3bd,_0x3a9b1a){_0x3a9b1a=_0x3a9b1a||0xcc;return function(_0xd81956){if(_0xd81956){return _0x1cb3bd['sendStatus'](_0x3a9b1a);}return _0x1cb3bd[_0xde9a('0x1c')](_0x3a9b1a)[_0xde9a('0x1d')]();};}function respondWithResult(_0x2f2e11,_0x267d5b){_0x267d5b=_0x267d5b||0xc8;return function(_0x1c1873){if(_0x1c1873){return _0x2f2e11[_0xde9a('0x1c')](_0x267d5b)[_0xde9a('0x1e')](_0x1c1873);}};}function respondWithFilteredResult(_0x432d3c,_0x3f0e39){return function(_0x474713){if(_0x474713){var _0x50ffb8=typeof _0x3f0e39[_0xde9a('0x1f')]===_0xde9a('0x20')&&typeof _0x3f0e39[_0xde9a('0x21')]===_0xde9a('0x20');var _0x454156=_0x474713['count'];var _0x12ba7f=_0x50ffb8?0x0:_0x3f0e39[_0xde9a('0x1f')];var _0x3b89ef=_0x50ffb8?_0x474713['count']:_0x3f0e39[_0xde9a('0x1f')]+_0x3f0e39['limit'];var _0x8f481a;if(_0x3b89ef>=_0x454156){_0x3b89ef=_0x454156;_0x8f481a=0xc8;}else{_0x8f481a=0xce;}_0x432d3c['status'](_0x8f481a);return _0x432d3c[_0xde9a('0x22')](_0xde9a('0x23'),_0x12ba7f+'-'+_0x3b89ef+'/'+_0x454156)[_0xde9a('0x1e')](_0x474713);}return null;};}function patchUpdates(_0x4add81){return function(_0x43b1bb){try{jsonpatch[_0xde9a('0x24')](_0x43b1bb,_0x4add81,!![]);}catch(_0x4e4e02){return BPromise['reject'](_0x4e4e02);}return _0x43b1bb[_0xde9a('0x25')]();};}function saveUpdates(_0x416b36,_0x56550b){return function(_0x290d8d){if(_0x290d8d){return _0x290d8d[_0xde9a('0x26')](_0x416b36)[_0xde9a('0x27')](function(_0x402b06){return _0x402b06;});}return null;};}function removeEntity(_0xa48b6b,_0x284c96){return function(_0x544f9d){if(_0x544f9d){return _0x544f9d[_0xde9a('0x28')]()[_0xde9a('0x27')](function(){_0xa48b6b[_0xde9a('0x1c')](0xcc)[_0xde9a('0x1d')]();});}};}function handleEntityNotFound(_0xfd4b9d,_0xdcc5d2){return function(_0xbc8e99){if(!_0xbc8e99){_0xfd4b9d[_0xde9a('0x29')](0x194);}return _0xbc8e99;};}function handleError(_0x125720,_0x490b11){_0x490b11=_0x490b11||0x1f4;return function(_0x5ab5e5){logger[_0xde9a('0x2a')](_0x5ab5e5[_0xde9a('0x2b')]);if(_0x5ab5e5[_0xde9a('0x2c')]){delete _0x5ab5e5[_0xde9a('0x2c')];}_0x125720['status'](_0x490b11)[_0xde9a('0x2d')](_0x5ab5e5);};}exports[_0xde9a('0x2e')]=function(_0x467ce2,_0x51806d){var _0x3bd254={'raw':!![],'where':{'id':_0x467ce2[_0xde9a('0x2f')]['id']}},_0x5890c5={};_0x5890c5['model']=_[_0xde9a('0x30')](db[_0xde9a('0x31')][_0xde9a('0x32')]);_0x5890c5[_0xde9a('0x33')]=_[_0xde9a('0x30')](_0x467ce2[_0xde9a('0x33')]);_0x5890c5[_0xde9a('0x34')]=_['intersection'](_0x5890c5[_0xde9a('0x35')],_0x5890c5[_0xde9a('0x33')]);_0x3bd254[_0xde9a('0x36')]=_[_0xde9a('0x37')](_0x5890c5[_0xde9a('0x35')],qs[_0xde9a('0x38')](_0x467ce2[_0xde9a('0x33')][_0xde9a('0x38')]));_0x3bd254[_0xde9a('0x36')]=_0x3bd254[_0xde9a('0x36')][_0xde9a('0x39')]?_0x3bd254[_0xde9a('0x36')]:_0x5890c5[_0xde9a('0x35')];if(_0x467ce2[_0xde9a('0x33')]['includeAll']){_0x3bd254['include']=[{'all':!![]}];}_0x3bd254=_[_0xde9a('0x3a')]({},_0x3bd254,_0x467ce2['options']);return db[_0xde9a('0x31')][_0xde9a('0x3b')](_0x3bd254)['then'](handleEntityNotFound(_0x51806d,null))[_0xde9a('0x27')](respondWithResult(_0x51806d,null))[_0xde9a('0x3c')](handleError(_0x51806d,null));};exports[_0xde9a('0x26')]=function(_0x4d45a2,_0x4f93d2){if(_0x4d45a2[_0xde9a('0x3d')]['id']){delete _0x4d45a2[_0xde9a('0x3d')]['id'];}return db['ChatApplication'][_0xde9a('0x3b')]({'where':{'id':_0x4d45a2[_0xde9a('0x2f')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x4f93d2,null))[_0xde9a('0x27')](saveUpdates(_0x4d45a2[_0xde9a('0x3d')],null))[_0xde9a('0x27')](respondWithResult(_0x4f93d2,null))[_0xde9a('0x3c')](handleError(_0x4f93d2,null));};exports[_0xde9a('0x28')]=function(_0x32c6f0,_0x463dc5){return db['ChatApplication'][_0xde9a('0x3b')]({'where':{'id':_0x32c6f0[_0xde9a('0x2f')]['id']}})[_0xde9a('0x27')](handleEntityNotFound(_0x463dc5,null))[_0xde9a('0x27')](removeEntity(_0x463dc5,null))['catch'](handleError(_0x463dc5,null));}; \ No newline at end of file +var _0xb16f=['set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','params','keys','model','query','attributes','intersection','fields','length','includeAll','include','merge','ChatApplication','catch','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb16f,0xf6));var _0xfb16=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0xb16f[_0x58ae8a];return _0x2f0b6b;};'use strict';var emlformat=require(_0xfb16('0x0'));var rimraf=require(_0xfb16('0x1'));var zipdir=require(_0xfb16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb16('0x3'));var moment=require(_0xfb16('0x4'));var BPromise=require(_0xfb16('0x5'));var Mustache=require(_0xfb16('0x6'));var util=require('util');var path=require(_0xfb16('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb16('0x8'));var squel=require('squel');var crypto=require(_0xfb16('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfb16('0xa'));var toCsv=require(_0xfb16('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb16('0xc'));var qs=require(_0xfb16('0xd'));var as=require(_0xfb16('0xe'));var hardwareService=require(_0xfb16('0xf'));var logger=require(_0xfb16('0x10'))(_0xfb16('0x11'));var utils=require(_0xfb16('0x12'));var config=require(_0xfb16('0x13'));var licenseUtil=require(_0xfb16('0x14'));var db=require(_0xfb16('0x15'))['db'];function respondWithStatusCode(_0x3a8de2,_0x4f3a00){_0x4f3a00=_0x4f3a00||0xcc;return function(_0xd6eeee){if(_0xd6eeee){return _0x3a8de2['sendStatus'](_0x4f3a00);}return _0x3a8de2['status'](_0x4f3a00)[_0xfb16('0x16')]();};}function respondWithResult(_0x89a4b8,_0x4cdc87){_0x4cdc87=_0x4cdc87||0xc8;return function(_0x507bcc){if(_0x507bcc){return _0x89a4b8[_0xfb16('0x17')](_0x4cdc87)[_0xfb16('0x18')](_0x507bcc);}};}function respondWithFilteredResult(_0x4708c2,_0x1643cc){return function(_0x28cb87){if(_0x28cb87){var _0xcf5a5=typeof _0x1643cc[_0xfb16('0x19')]===_0xfb16('0x1a')&&typeof _0x1643cc[_0xfb16('0x1b')]===_0xfb16('0x1a');var _0x1748fb=_0x28cb87[_0xfb16('0x1c')];var _0x3b0064=_0xcf5a5?0x0:_0x1643cc[_0xfb16('0x19')];var _0x51078f=_0xcf5a5?_0x28cb87[_0xfb16('0x1c')]:_0x1643cc[_0xfb16('0x19')]+_0x1643cc[_0xfb16('0x1b')];var _0x5af84a;if(_0x51078f>=_0x1748fb){_0x51078f=_0x1748fb;_0x5af84a=0xc8;}else{_0x5af84a=0xce;}_0x4708c2['status'](_0x5af84a);return _0x4708c2[_0xfb16('0x1d')](_0xfb16('0x1e'),_0x3b0064+'-'+_0x51078f+'/'+_0x1748fb)[_0xfb16('0x18')](_0x28cb87);}return null;};}function patchUpdates(_0x5394a8){return function(_0x193162){try{jsonpatch[_0xfb16('0x1f')](_0x193162,_0x5394a8,!![]);}catch(_0x17bdd0){return BPromise['reject'](_0x17bdd0);}return _0x193162['save']();};}function saveUpdates(_0x544b4b,_0x27203c){return function(_0x354ef4){if(_0x354ef4){return _0x354ef4[_0xfb16('0x20')](_0x544b4b)[_0xfb16('0x21')](function(_0x502d60){return _0x502d60;});}return null;};}function removeEntity(_0x5814e9,_0x8ef26c){return function(_0x2aea90){if(_0x2aea90){return _0x2aea90[_0xfb16('0x22')]()[_0xfb16('0x21')](function(){_0x5814e9[_0xfb16('0x17')](0xcc)[_0xfb16('0x16')]();});}};}function handleEntityNotFound(_0x15b3b8,_0x239633){return function(_0x1335a3){if(!_0x1335a3){_0x15b3b8[_0xfb16('0x23')](0x194);}return _0x1335a3;};}function handleError(_0x177b67,_0x4c194a){_0x4c194a=_0x4c194a||0x1f4;return function(_0x1ca17b){logger[_0xfb16('0x24')](_0x1ca17b[_0xfb16('0x25')]);if(_0x1ca17b[_0xfb16('0x26')]){delete _0x1ca17b[_0xfb16('0x26')];}_0x177b67['status'](_0x4c194a)[_0xfb16('0x27')](_0x1ca17b);};}exports['show']=function(_0x407379,_0x21822b){var _0xe1a799={'raw':!![],'where':{'id':_0x407379[_0xfb16('0x28')]['id']}},_0x1a92ce={};_0x1a92ce['model']=_[_0xfb16('0x29')](db['ChatApplication']['rawAttributes']);_0x1a92ce['query']=_[_0xfb16('0x29')](_0x407379['query']);_0x1a92ce['filters']=_['intersection'](_0x1a92ce[_0xfb16('0x2a')],_0x1a92ce[_0xfb16('0x2b')]);_0xe1a799[_0xfb16('0x2c')]=_[_0xfb16('0x2d')](_0x1a92ce[_0xfb16('0x2a')],qs[_0xfb16('0x2e')](_0x407379[_0xfb16('0x2b')][_0xfb16('0x2e')]));_0xe1a799['attributes']=_0xe1a799[_0xfb16('0x2c')][_0xfb16('0x2f')]?_0xe1a799[_0xfb16('0x2c')]:_0x1a92ce['model'];if(_0x407379[_0xfb16('0x2b')][_0xfb16('0x30')]){_0xe1a799[_0xfb16('0x31')]=[{'all':!![]}];}_0xe1a799=_[_0xfb16('0x32')]({},_0xe1a799,_0x407379['options']);return db[_0xfb16('0x33')]['find'](_0xe1a799)[_0xfb16('0x21')](handleEntityNotFound(_0x21822b,null))[_0xfb16('0x21')](respondWithResult(_0x21822b,null))[_0xfb16('0x34')](handleError(_0x21822b,null));};exports['update']=function(_0x14fe06,_0x414f2e){if(_0x14fe06[_0xfb16('0x35')]['id']){delete _0x14fe06[_0xfb16('0x35')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x14fe06[_0xfb16('0x28')]['id']}})['then'](handleEntityNotFound(_0x414f2e,null))[_0xfb16('0x21')](saveUpdates(_0x14fe06[_0xfb16('0x35')],null))[_0xfb16('0x21')](respondWithResult(_0x414f2e,null))[_0xfb16('0x34')](handleError(_0x414f2e,null));};exports['destroy']=function(_0x163dd5,_0x4d2595){return db[_0xfb16('0x33')][_0xfb16('0x36')]({'where':{'id':_0x163dd5[_0xfb16('0x28')]['id']}})[_0xfb16('0x21')](handleEntityNotFound(_0x4d2595,null))['then'](removeEntity(_0x4d2595,null))[_0xfb16('0x34')](handleError(_0x4d2595,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 26d4760..d6c3fdc 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 _0xcb3c=['../../config/logger','api','bluebird','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','lodash','util'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xcb3c,0x150));var _0xccb3=function(_0x2cce72,_0x432665){_0x2cce72=_0x2cce72-0x0;var _0xe78e46=_0xcb3c[_0x2cce72];return _0xe78e46;};'use strict';var _=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var logger=require(_0xccb3('0x2'))(_0xccb3('0x3'));var moment=require('moment');var BPromise=require(_0xccb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccb3('0x5'));var rimraf=require('rimraf');var config=require(_0xccb3('0x6'));var attributes=require(_0xccb3('0x7'));module[_0xccb3('0x8')]=function(_0x3c02f3,_0x56eec1){return _0x3c02f3[_0xccb3('0x9')](_0xccb3('0xa'),attributes,{'tableName':_0xccb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccb3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb011=['../../config/environment','./chatApplication.attributes','exports','define','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path'];(function(_0x1f52ea,_0x1dd436){var _0x2d4b16=function(_0x3cee20){while(--_0x3cee20){_0x1f52ea['push'](_0x1f52ea['shift']());}};_0x2d4b16(++_0x1dd436);}(_0xb011,0x19c));var _0x1b01=function(_0x3ce1d4,_0xb72c57){_0x3ce1d4=_0x3ce1d4-0x0;var _0x446e1e=_0xb011[_0x3ce1d4];return _0x446e1e;};'use strict';var _=require(_0x1b01('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1b01('0x1'));var moment=require(_0x1b01('0x2'));var BPromise=require(_0x1b01('0x3'));var rp=require(_0x1b01('0x4'));var fs=require('fs');var path=require(_0x1b01('0x5'));var rimraf=require('rimraf');var config=require(_0x1b01('0x6'));var attributes=require(_0x1b01('0x7'));module[_0x1b01('0x8')]=function(_0x54b415,_0x521a1b){return _0x54b415[_0x1b01('0x9')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1b01('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index aa342c6..b664a3a 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 _0xf713=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x43f92c,_0x291a47){var _0xca4547=function(_0x50b574){while(--_0x50b574){_0x43f92c['push'](_0x43f92c['shift']());}};_0xca4547(++_0x291a47);}(_0xf713,0x196));var _0x3f71=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0xf713[_0x3a723e];return _0x3e9c03;};'use strict';var _=require(_0x3f71('0x0'));var util=require(_0x3f71('0x1'));var moment=require(_0x3f71('0x2'));var BPromise=require(_0x3f71('0x3'));var rs=require(_0x3f71('0x4'));var fs=require('fs');var Redis=require(_0x3f71('0x5'));var db=require(_0x3f71('0x6'))['db'];var utils=require(_0x3f71('0x7'));var logger=require(_0x3f71('0x8'))(_0x3f71('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f71('0xa')][_0x3f71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d9d67,_0x490d90,_0xa6c678){return new BPromise(function(_0x3faddd,_0x3d65d5){return client[_0x3f71('0xc')](_0x3d9d67,_0xa6c678)[_0x3f71('0xd')](function(_0x383f3e){logger[_0x3f71('0xe')](_0x3f71('0xf'),_0x490d90,_0x3f71('0x10'));logger[_0x3f71('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x490d90,_0x3f71('0x10'),JSON['stringify'](_0x383f3e));if(_0x383f3e[_0x3f71('0x12')]){if(_0x383f3e[_0x3f71('0x12')][_0x3f71('0x13')]===0x1f4){logger['error'](_0x3f71('0xf'),_0x490d90,_0x383f3e[_0x3f71('0x12')][_0x3f71('0x14')]);return _0x3d65d5(_0x383f3e['error']['message']);}logger[_0x3f71('0x12')](_0x3f71('0xf'),_0x490d90,_0x383f3e[_0x3f71('0x12')][_0x3f71('0x14')]);return _0x3faddd(_0x383f3e[_0x3f71('0x12')][_0x3f71('0x14')]);}else{logger[_0x3f71('0xe')](_0x3f71('0xf'),_0x490d90,_0x3f71('0x10'));_0x3faddd(_0x383f3e['result']['message']);}})['catch'](function(_0xfcccda){logger[_0x3f71('0x12')](_0x3f71('0xf'),_0x490d90,_0xfcccda);_0x3d65d5(_0xfcccda);});});} \ No newline at end of file +var _0xc03e=['request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x453a8d,_0x4e46f0){var _0x3270ad=function(_0x5750f7){while(--_0x5750f7){_0x453a8d['push'](_0x453a8d['shift']());}};_0x3270ad(++_0x4e46f0);}(_0xc03e,0xfe));var _0xec03=function(_0x435dde,_0x2a2fa3){_0x435dde=_0x435dde-0x0;var _0x4aca2d=_0xc03e[_0x435dde];return _0x4aca2d;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require(_0xec03('0x1'));var BPromise=require(_0xec03('0x2'));var rs=require(_0xec03('0x3'));var fs=require('fs');var Redis=require(_0xec03('0x4'));var db=require(_0xec03('0x5'))['db'];var utils=require(_0xec03('0x6'));var logger=require(_0xec03('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xec03('0x8'));var client=jayson['client'][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e8ef0,_0x5e3a2e,_0x5617c){return new BPromise(function(_0x120652,_0x52bab1){return client[_0xec03('0xa')](_0x5e8ef0,_0x5617c)[_0xec03('0xb')](function(_0x34087c){logger['info'](_0xec03('0xc'),_0x5e3a2e,_0xec03('0xd'));logger['debug'](_0xec03('0xe'),_0x5e3a2e,_0xec03('0xd'),JSON[_0xec03('0xf')](_0x34087c));if(_0x34087c['error']){if(_0x34087c[_0xec03('0x10')][_0xec03('0x11')]===0x1f4){logger[_0xec03('0x10')](_0xec03('0xc'),_0x5e3a2e,_0x34087c[_0xec03('0x10')][_0xec03('0x12')]);return _0x52bab1(_0x34087c[_0xec03('0x10')][_0xec03('0x12')]);}logger[_0xec03('0x10')](_0xec03('0xc'),_0x5e3a2e,_0x34087c['error']['message']);return _0x120652(_0x34087c[_0xec03('0x10')][_0xec03('0x12')]);}else{logger[_0xec03('0x13')](_0xec03('0xc'),_0x5e3a2e,_0xec03('0xd'));_0x120652(_0x34087c[_0xec03('0x14')]['message']);}})[_0xec03('0x15')](function(_0x1c7b3f){logger[_0xec03('0x10')](_0xec03('0xc'),_0x5e3a2e,_0x1c7b3f);_0x52bab1(_0x1c7b3f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3ebe9db..0e6a98c 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 _0x84d9=['get','/:id','show','put','isAuthenticated','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x550cc8,_0x2ca666){var _0x15f05a=function(_0x3e6670){while(--_0x3e6670){_0x550cc8['push'](_0x550cc8['shift']());}};_0x15f05a(++_0x2ca666);}(_0x84d9,0x19c));var _0x984d=function(_0x35ed68,_0x4b920d){_0x35ed68=_0x35ed68-0x0;var _0x48f7f6=_0x84d9[_0x35ed68];return _0x48f7f6;};'use strict';var multer=require('multer');var util=require(_0x984d('0x0'));var path=require(_0x984d('0x1'));var timeout=require(_0x984d('0x2'));var express=require('express');var router=express[_0x984d('0x3')]();var fs_extra=require(_0x984d('0x4'));var auth=require(_0x984d('0x5'));var interaction=require(_0x984d('0x6'));var config=require(_0x984d('0x7'));var controller=require('./chatApplication.controller');router[_0x984d('0x8')](_0x984d('0x9'),auth['isAuthenticated'](),controller[_0x984d('0xa')]);router[_0x984d('0xb')](_0x984d('0x9'),auth[_0x984d('0xc')](),controller['update']);router['delete']('/:id',auth[_0x984d('0xc')](),controller[_0x984d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x817d=['../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x817d,0xd6));var _0xd817=function(_0x44b7b6,_0x460871){_0x44b7b6=_0x44b7b6-0x0;var _0x1e5656=_0x817d[_0x44b7b6];return _0x1e5656;};'use strict';var multer=require(_0xd817('0x0'));var util=require(_0xd817('0x1'));var path=require(_0xd817('0x2'));var timeout=require(_0xd817('0x3'));var express=require(_0xd817('0x4'));var router=express[_0xd817('0x5')]();var fs_extra=require(_0xd817('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd817('0x7'));var config=require('../../config/environment');var controller=require(_0xd817('0x8'));router[_0xd817('0x9')]('/:id',auth[_0xd817('0xa')](),controller[_0xd817('0xb')]);router[_0xd817('0xc')]('/:id',auth[_0xd817('0xa')](),controller['update']);router[_0xd817('0xd')](_0xd817('0xe'),auth[_0xd817('0xa')](),controller[_0xd817('0xf')]);module[_0xd817('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 63268aa..ca5330f 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 _0x618a=['exports','STRING','BOOLEAN','sequelize'];(function(_0xadafdf,_0x506951){var _0x5d46f6=function(_0x111c23){while(--_0x111c23){_0xadafdf['push'](_0xadafdf['shift']());}};_0x5d46f6(++_0x506951);}(_0x618a,0xe3));var _0xa618=function(_0x1e0139,_0x4970a3){_0x1e0139=_0x1e0139-0x0;var _0xbfc2ba=_0x618a[_0x1e0139];return _0xbfc2ba;};'use strict';var Sequelize=require(_0xa618('0x0'));module[_0xa618('0x1')]={'name':{'type':Sequelize[_0xa618('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa618('0x2')]},'write':{'type':Sequelize[_0xa618('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe635=['STRING','BOOLEAN','sequelize','exports'];(function(_0x217195,_0x2b7eb6){var _0x1d0401=function(_0x4fc4e4){while(--_0x4fc4e4){_0x217195['push'](_0x217195['shift']());}};_0x1d0401(++_0x2b7eb6);}(_0xe635,0x1be));var _0x5e63=function(_0x4b6413,_0x2720f4){_0x4b6413=_0x4b6413-0x0;var _0x37d105=_0xe635[_0x4b6413];return _0x37d105;};'use strict';var Sequelize=require(_0x5e63('0x0'));module[_0x5e63('0x1')]={'name':{'type':Sequelize[_0x5e63('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5e63('0x2')]},'write':{'type':Sequelize[_0x5e63('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0a34d2a..c3fd288 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 _0x15b7=['key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','show','params','keys','includeAll','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','getMessages','$gte','split','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName'];(function(_0x488909,_0x58b353){var _0x3694d2=function(_0x518ff7){while(--_0x518ff7){_0x488909['push'](_0x488909['shift']());}};_0x3694d2(++_0x58b353);}(_0x15b7,0xe4));var _0x715b=function(_0x98c7ad,_0x580505){_0x98c7ad=_0x98c7ad-0x0;var _0xdd0fa3=_0x15b7[_0x98c7ad];return _0xdd0fa3;};'use strict';var emlformat=require(_0x715b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x715b('0x1'));var jsonpatch=require(_0x715b('0x2'));var rp=require(_0x715b('0x3'));var moment=require(_0x715b('0x4'));var BPromise=require(_0x715b('0x5'));var Mustache=require(_0x715b('0x6'));var util=require(_0x715b('0x7'));var path=require('path');var sox=require(_0x715b('0x8'));var csv=require('to-csv');var ejs=require(_0x715b('0x9'));var fs=require('fs');var fs_extra=require(_0x715b('0xa'));var _=require(_0x715b('0xb'));var squel=require(_0x715b('0xc'));var crypto=require(_0x715b('0xd'));var jsforce=require(_0x715b('0xe'));var deskjs=require(_0x715b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x715b('0x10'));var Papa=require(_0x715b('0x11'));var Redis=require('ioredis');var authService=require(_0x715b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x715b('0x13'))(_0x715b('0x14'));var utils=require(_0x715b('0x15'));var config=require(_0x715b('0x16'));var licenseUtil=require(_0x715b('0x17'));var db=require(_0x715b('0x18'))['db'];config['redis']=_['defaults'](config[_0x715b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x715b('0x1a'))(new Redis(config[_0x715b('0x19')]));require(_0x715b('0x1b'))[_0x715b('0x1c')](socket);function respondWithStatusCode(_0x54557b,_0x2a5593){_0x2a5593=_0x2a5593||0xcc;return function(_0x126d88){if(_0x126d88){return _0x54557b['sendStatus'](_0x2a5593);}return _0x54557b[_0x715b('0x1d')](_0x2a5593)[_0x715b('0x1e')]();};}function respondWithResult(_0x3f28bd,_0x33e145){_0x33e145=_0x33e145||0xc8;return function(_0x2d2c59){if(_0x2d2c59){return _0x3f28bd[_0x715b('0x1d')](_0x33e145)[_0x715b('0x1f')](_0x2d2c59);}};}function respondWithFilteredResult(_0x26a6ce,_0x289c2a){return function(_0x22f871){if(_0x22f871){var _0x572e2d=typeof _0x289c2a[_0x715b('0x20')]===_0x715b('0x21')&&typeof _0x289c2a[_0x715b('0x22')]==='undefined';var _0x2cad04=_0x22f871['count'];var _0x4595e8=_0x572e2d?0x0:_0x289c2a[_0x715b('0x20')];var _0xd2fc73=_0x572e2d?_0x22f871[_0x715b('0x23')]:_0x289c2a['offset']+_0x289c2a[_0x715b('0x22')];var _0x4d8860;if(_0xd2fc73>=_0x2cad04){_0xd2fc73=_0x2cad04;_0x4d8860=0xc8;}else{_0x4d8860=0xce;}_0x26a6ce['status'](_0x4d8860);return _0x26a6ce['set'](_0x715b('0x24'),_0x4595e8+'-'+_0xd2fc73+'/'+_0x2cad04)['json'](_0x22f871);}return null;};}function patchUpdates(_0x218e78){return function(_0x31d6ad){try{jsonpatch['apply'](_0x31d6ad,_0x218e78,!![]);}catch(_0x37fd0b){return BPromise[_0x715b('0x25')](_0x37fd0b);}return _0x31d6ad['save']();};}function saveUpdates(_0x43a741,_0x1f245c){return function(_0xe29c50){if(_0xe29c50){return _0xe29c50[_0x715b('0x26')](_0x43a741)[_0x715b('0x27')](function(_0x51de99){return _0x51de99;});}return null;};}function removeEntity(_0x3522f1,_0x204170){return function(_0x4e51d5){if(_0x4e51d5){return _0x4e51d5[_0x715b('0x28')]()[_0x715b('0x27')](function(){_0x3522f1[_0x715b('0x1d')](0xcc)[_0x715b('0x1e')]();});}};}function handleEntityNotFound(_0x19fc09,_0x4b35b6){return function(_0x4db692){if(!_0x4db692){_0x19fc09[_0x715b('0x29')](0x194);}return _0x4db692;};}function handleError(_0x555005,_0x452600){_0x452600=_0x452600||0x1f4;return function(_0xf26564){logger[_0x715b('0x2a')](_0xf26564[_0x715b('0x2b')]);if(_0xf26564[_0x715b('0x2c')]){delete _0xf26564[_0x715b('0x2c')];}_0x555005[_0x715b('0x1d')](_0x452600)[_0x715b('0x2d')](_0xf26564);};}exports[_0x715b('0x2e')]=function(_0x19690a,_0x2621ef){var _0x14b7ea={},_0x59fcb8={},_0x5236a2={'count':0x0,'rows':[]};var _0x40bba9=_[_0x715b('0x2f')](db[_0x715b('0x30')][_0x715b('0x31')],function(_0x16d0fc){return{'name':_0x16d0fc[_0x715b('0x32')],'type':_0x16d0fc['type'][_0x715b('0x33')]};});_0x59fcb8[_0x715b('0x34')]=_[_0x715b('0x2f')](_0x40bba9,_0x715b('0x2c'));_0x59fcb8[_0x715b('0x35')]=_['keys'](_0x19690a['query']);_0x59fcb8[_0x715b('0x36')]=_['intersection'](_0x59fcb8[_0x715b('0x34')],_0x59fcb8[_0x715b('0x35')]);_0x14b7ea[_0x715b('0x37')]=_[_0x715b('0x38')](_0x59fcb8['model'],qs[_0x715b('0x39')](_0x19690a['query'][_0x715b('0x39')]));_0x14b7ea['attributes']=_0x14b7ea['attributes'][_0x715b('0x3a')]?_0x14b7ea[_0x715b('0x37')]:_0x59fcb8[_0x715b('0x34')];if(!_0x19690a[_0x715b('0x35')][_0x715b('0x3b')](_0x715b('0x3c'))){_0x14b7ea[_0x715b('0x22')]=qs['limit'](_0x19690a[_0x715b('0x35')][_0x715b('0x22')]);_0x14b7ea[_0x715b('0x20')]=qs['offset'](_0x19690a[_0x715b('0x35')][_0x715b('0x20')]);}_0x14b7ea[_0x715b('0x3d')]=qs[_0x715b('0x3e')](_0x19690a[_0x715b('0x35')][_0x715b('0x3e')]);_0x14b7ea[_0x715b('0x3f')]=qs[_0x715b('0x36')](_[_0x715b('0x40')](_0x19690a[_0x715b('0x35')],_0x59fcb8['filters']),_0x40bba9);if(_0x19690a['query'][_0x715b('0x41')]){_0x14b7ea['where']=_[_0x715b('0x42')](_0x14b7ea[_0x715b('0x3f')],{'$or':_[_0x715b('0x2f')](_0x40bba9,function(_0x1af1c1){if(_0x1af1c1['type']!=='VIRTUAL'){var _0x588468={};_0x588468[_0x1af1c1[_0x715b('0x2c')]]={'$like':'%'+_0x19690a[_0x715b('0x35')]['filter']+'%'};return _0x588468;}})});}_0x14b7ea=_['merge']({},_0x14b7ea,_0x19690a[_0x715b('0x43')]);var _0x589ef0={'where':_0x14b7ea[_0x715b('0x3f')]};return db[_0x715b('0x30')][_0x715b('0x23')](_0x589ef0)[_0x715b('0x27')](function(_0x22c997){_0x5236a2[_0x715b('0x23')]=_0x22c997;if(_0x19690a[_0x715b('0x35')]['includeAll']){_0x14b7ea['include']=[{'all':!![]}];}return db[_0x715b('0x30')][_0x715b('0x44')](_0x14b7ea);})[_0x715b('0x27')](function(_0x3efa3f){_0x5236a2[_0x715b('0x45')]=_0x3efa3f;return _0x5236a2;})[_0x715b('0x27')](respondWithFilteredResult(_0x2621ef,_0x14b7ea))['catch'](handleError(_0x2621ef,null));};exports[_0x715b('0x46')]=function(_0x334836,_0x50cf76){var _0x3c4434={'raw':!![],'where':{'id':_0x334836[_0x715b('0x47')]['id']}},_0x383280={};_0x383280['model']=_[_0x715b('0x48')](db[_0x715b('0x30')][_0x715b('0x31')]);_0x383280[_0x715b('0x35')]=_[_0x715b('0x48')](_0x334836[_0x715b('0x35')]);_0x383280['filters']=_[_0x715b('0x38')](_0x383280[_0x715b('0x34')],_0x383280[_0x715b('0x35')]);_0x3c4434[_0x715b('0x37')]=_[_0x715b('0x38')](_0x383280['model'],qs[_0x715b('0x39')](_0x334836[_0x715b('0x35')]['fields']));_0x3c4434[_0x715b('0x37')]=_0x3c4434[_0x715b('0x37')][_0x715b('0x3a')]?_0x3c4434[_0x715b('0x37')]:_0x383280['model'];if(_0x334836['query'][_0x715b('0x49')]){_0x3c4434['include']=[{'all':!![]}];}_0x3c4434=_['merge']({},_0x3c4434,_0x334836[_0x715b('0x43')]);return db[_0x715b('0x30')][_0x715b('0x4a')](_0x3c4434)[_0x715b('0x27')](handleEntityNotFound(_0x50cf76,null))[_0x715b('0x27')](respondWithResult(_0x50cf76,null))[_0x715b('0x4b')](handleError(_0x50cf76,null));};exports[_0x715b('0x4c')]=function(_0x19a152,_0x4db4d0){return db[_0x715b('0x30')][_0x715b('0x4c')](_0x19a152['body'],{})[_0x715b('0x27')](respondWithResult(_0x4db4d0,0xc9))['catch'](handleError(_0x4db4d0,null));};exports[_0x715b('0x26')]=function(_0x2fa100,_0x42b5d4){if(_0x2fa100['body']['id']){delete _0x2fa100['body']['id'];}return db[_0x715b('0x30')][_0x715b('0x4a')]({'where':{'id':_0x2fa100['params']['id']}})[_0x715b('0x27')](handleEntityNotFound(_0x42b5d4,null))[_0x715b('0x27')](saveUpdates(_0x2fa100[_0x715b('0x4d')],null))['then'](respondWithResult(_0x42b5d4,null))[_0x715b('0x4b')](handleError(_0x42b5d4,null));};exports['destroy']=function(_0x29cafc,_0x30b994){return db[_0x715b('0x30')][_0x715b('0x4a')]({'where':{'id':_0x29cafc[_0x715b('0x47')]['id']}})[_0x715b('0x27')](handleEntityNotFound(_0x30b994,null))['then'](removeEntity(_0x30b994,null))[_0x715b('0x4b')](handleError(_0x30b994,null));};exports[_0x715b('0x4e')]=function(_0x47dd3f,_0x16b18d){return db[_0x715b('0x30')][_0x715b('0x4e')]()[_0x715b('0x27')](respondWithResult(_0x16b18d,null))[_0x715b('0x4b')](handleError(_0x16b18d,null));};exports[_0x715b('0x4f')]=function(_0x2b63f5,_0x485213,_0x242557){return db[_0x715b('0x50')][_0x715b('0x23')]({'where':{'ChatGroupId':_0x2b63f5['params']['id'],'ToId':_0x2b63f5['user']['id'],'read':![]}})['then'](function(_0x4dc3aa){return{'id':_[_0x715b('0x51')](_0x2b63f5[_0x715b('0x47')]['id']),'count':_0x4dc3aa};})[_0x715b('0x27')](respondWithResult(_0x485213,null))[_0x715b('0x4b')](handleError(_0x485213,null));};exports[_0x715b('0x52')]=function(_0x4b44d3,_0x376961,_0x4f5e24){return db['ChatGroup'][_0x715b('0x4a')]({'where':{'id':_0x4b44d3[_0x715b('0x47')]['id']}})['then'](handleEntityNotFound(_0x376961,null))['then'](function(_0x215efa){if(_0x215efa){return _0x215efa[_0x715b('0x52')](_0x4b44d3[_0x715b('0x4d')][_0x715b('0x53')],_[_0x715b('0x54')](_0x4b44d3[_0x715b('0x4d')],[_0x715b('0x53'),'id'])||{});}})[_0x715b('0x27')](respondWithResult(_0x376961,null))[_0x715b('0x4b')](handleError(_0x376961,null));};exports[_0x715b('0x55')]=function(_0x2edd74,_0x20e9d0,_0x458501){var _0x2cdf97={};var _0x503f60={};var _0x4dee29;var _0x4dfcb4;return db[_0x715b('0x30')][_0x715b('0x56')]({'where':{'id':_0x2edd74[_0x715b('0x47')]['id']}})[_0x715b('0x27')](handleEntityNotFound(_0x20e9d0,null))[_0x715b('0x27')](function(_0x382f49){if(_0x382f49){_0x4dee29=_0x382f49;_0x503f60[_0x715b('0x34')]=_['keys'](db[_0x715b('0x57')][_0x715b('0x31')]);_0x503f60[_0x715b('0x35')]=_[_0x715b('0x48')](_0x2edd74['query']);_0x503f60[_0x715b('0x36')]=_[_0x715b('0x38')](_0x503f60[_0x715b('0x34')],_0x503f60[_0x715b('0x35')]);_0x2cdf97[_0x715b('0x37')]=_[_0x715b('0x38')](_0x503f60[_0x715b('0x34')],qs[_0x715b('0x39')](_0x2edd74[_0x715b('0x35')][_0x715b('0x39')]));_0x2cdf97['attributes']=_0x2cdf97[_0x715b('0x37')][_0x715b('0x3a')]?_0x2cdf97['attributes']:_0x503f60[_0x715b('0x34')];_0x2cdf97[_0x715b('0x3d')]=qs[_0x715b('0x3e')](_0x2edd74['query'][_0x715b('0x3e')]);_0x2cdf97[_0x715b('0x3f')]=qs[_0x715b('0x36')](_['pick'](_0x2edd74[_0x715b('0x35')],_0x503f60[_0x715b('0x36')]));if(_0x2edd74[_0x715b('0x35')]['filter']){_0x2cdf97[_0x715b('0x3f')]=_['merge'](_0x2cdf97[_0x715b('0x3f')],{'$or':_['map'](_0x2cdf97['attributes'],function(_0x4fbc32){var _0x56b391={};_0x56b391[_0x4fbc32]={'$like':'%'+_0x2edd74[_0x715b('0x35')]['filter']+'%'};return _0x56b391;})});}_0x2cdf97=_['merge']({},_0x2cdf97,_0x2edd74[_0x715b('0x43')]);return _0x4dee29[_0x715b('0x55')](_0x2cdf97);}})['then'](function(_0x2e517f){if(_0x2e517f){_0x4dfcb4=_0x2e517f[_0x715b('0x3a')];if(!_0x2edd74[_0x715b('0x35')][_0x715b('0x3b')]('nolimit')){_0x2cdf97['limit']=qs[_0x715b('0x22')](_0x2edd74[_0x715b('0x35')][_0x715b('0x22')]);_0x2cdf97['offset']=qs['offset'](_0x2edd74['query'][_0x715b('0x20')]);}return _0x4dee29[_0x715b('0x55')](_0x2cdf97);}})[_0x715b('0x27')](function(_0x573e05){if(_0x573e05){return _0x573e05?{'count':_0x4dfcb4,'rows':_0x573e05}:null;}})[_0x715b('0x27')](respondWithResult(_0x20e9d0,null))[_0x715b('0x4b')](handleError(_0x20e9d0,null));};exports[_0x715b('0x58')]=function(_0x45b15e,_0x41880e,_0x16b2c2){return db[_0x715b('0x30')]['find']({'where':{'id':_0x45b15e['params']['id']}})['then'](handleEntityNotFound(_0x41880e,null))[_0x715b('0x27')](function(_0x5ee6da){if(_0x5ee6da){return _0x5ee6da['removeMembers'](_0x45b15e['query'][_0x715b('0x53')]);}})[_0x715b('0x27')](respondWithStatusCode(_0x41880e,null))['catch'](handleError(_0x41880e,null));};exports[_0x715b('0x59')]=function(_0x5ae078,_0x3c55d4,_0x151931){if(_0x5ae078[_0x715b('0x4d')]['id']){delete _0x5ae078['body']['id'];}return db[_0x715b('0x30')][_0x715b('0x4a')]({'where':{'id':_0x5ae078[_0x715b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c55d4,null))['then'](function(_0x160b5d){if(_0x160b5d){_0x5ae078['body']['ChatGroupId']=_0x160b5d['id'];return db[_0x715b('0x50')][_0x715b('0x4c')](_0x5ae078[_0x715b('0x4d')]);}})[_0x715b('0x27')](respondWithResult(_0x3c55d4,null))['catch'](handleError(_0x3c55d4,null));};exports[_0x715b('0x5a')]=function(_0xde2558,_0x297cc1,_0xb4923c){var _0x44bf2d={};var _0x37761e={};var _0x12a765;var _0x1f869c;return db[_0x715b('0x30')]['findOne']({'where':{'id':_0xde2558[_0x715b('0x47')]['id']}})[_0x715b('0x27')](handleEntityNotFound(_0x297cc1,null))[_0x715b('0x27')](function(_0x200860){if(_0x200860){_0x12a765=_0x200860;_0x37761e[_0x715b('0x34')]=_['keys'](db['ChatInternalMessage'][_0x715b('0x31')]);_0x37761e['query']=_['keys'](_0xde2558[_0x715b('0x35')]);_0x37761e['filters']=_[_0x715b('0x38')](_0x37761e[_0x715b('0x34')],_0x37761e[_0x715b('0x35')]);_0x44bf2d[_0x715b('0x37')]=_['intersection'](_0x37761e[_0x715b('0x34')],qs['fields'](_0xde2558[_0x715b('0x35')][_0x715b('0x39')]));_0x44bf2d[_0x715b('0x37')]=_0x44bf2d[_0x715b('0x37')]['length']?_0x44bf2d[_0x715b('0x37')]:_0x37761e[_0x715b('0x34')];_0x44bf2d['order']=qs['sort'](_0xde2558['query'][_0x715b('0x3e')]);_0x44bf2d['where']=qs['filters'](_[_0x715b('0x40')](_0xde2558[_0x715b('0x35')],_0x37761e[_0x715b('0x36')]));if(_0xde2558[_0x715b('0x35')][_0x715b('0x41')]){_0x44bf2d[_0x715b('0x3f')]=_[_0x715b('0x42')](_0x44bf2d['where'],{'$or':_[_0x715b('0x2f')](_0x44bf2d[_0x715b('0x37')],function(_0x38fdf2){var _0x591561={};_0x591561[_0x38fdf2]={'$like':'%'+_0xde2558['query'][_0x715b('0x41')]+'%'};return _0x591561;})});}if(_0xde2558[_0x715b('0x35')][_0x715b('0x5b')]){var _0x3fc437=_0xde2558['query']['$gte'][_0x715b('0x5c')](',');var _0x7ba279={};_0x7ba279[_0x3fc437[0x0]]={'$gte':moment(_0x3fc437[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x44bf2d['where']=_[_0x715b('0x42')](_0x44bf2d['where'],_0x7ba279);}_0x44bf2d=_['merge']({},_0x44bf2d,_0xde2558['options']);return _0x12a765[_0x715b('0x5a')](_0x44bf2d);}})['then'](function(_0x32d9b5){if(_0x32d9b5){_0x1f869c=_0x32d9b5['length'];if(!_0xde2558[_0x715b('0x35')][_0x715b('0x3b')](_0x715b('0x3c'))){_0x44bf2d[_0x715b('0x22')]=qs[_0x715b('0x22')](_0xde2558[_0x715b('0x35')][_0x715b('0x22')]);_0x44bf2d[_0x715b('0x20')]=qs[_0x715b('0x20')](_0xde2558[_0x715b('0x35')][_0x715b('0x20')]);}return _0x12a765[_0x715b('0x5a')](_0x44bf2d);}})[_0x715b('0x27')](function(_0x419c98){if(_0x419c98){return _0x419c98?{'count':_0x1f869c,'rows':_0x419c98}:null;}})['then'](respondWithResult(_0x297cc1,null))[_0x715b('0x4b')](handleError(_0x297cc1,null));}; \ No newline at end of file +var _0x3f84=['set','Content-Range','apply','reject','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','type','VIRTUAL','merge','options','ChatGroup','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','where','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','limit','undefined','count','offset'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x3f84,0x1c2));var _0x43f8=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x3f84[_0x503790];return _0x388092;};'use strict';var emlformat=require(_0x43f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43f8('0x2'));var Mustache=require(_0x43f8('0x3'));var util=require(_0x43f8('0x4'));var path=require(_0x43f8('0x5'));var sox=require(_0x43f8('0x6'));var csv=require(_0x43f8('0x7'));var ejs=require(_0x43f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43f8('0x9'));var squel=require(_0x43f8('0xa'));var crypto=require(_0x43f8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x43f8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x43f8('0xd'));var Papa=require('papaparse');var Redis=require(_0x43f8('0xe'));var authService=require(_0x43f8('0xf'));var qs=require(_0x43f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43f8('0x11'));var logger=require(_0x43f8('0x12'))('api');var utils=require(_0x43f8('0x13'));var config=require(_0x43f8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43f8('0x15'))['db'];config[_0x43f8('0x16')]=_[_0x43f8('0x17')](config[_0x43f8('0x16')],{'host':_0x43f8('0x18'),'port':0x18eb});var socket=require(_0x43f8('0x19'))(new Redis(config[_0x43f8('0x16')]));require(_0x43f8('0x1a'))['register'](socket);function respondWithStatusCode(_0x212608,_0x10173b){_0x10173b=_0x10173b||0xcc;return function(_0x12f23c){if(_0x12f23c){return _0x212608[_0x43f8('0x1b')](_0x10173b);}return _0x212608[_0x43f8('0x1c')](_0x10173b)[_0x43f8('0x1d')]();};}function respondWithResult(_0xa232a0,_0xf4c87f){_0xf4c87f=_0xf4c87f||0xc8;return function(_0x328a17){if(_0x328a17){return _0xa232a0['status'](_0xf4c87f)[_0x43f8('0x1e')](_0x328a17);}};}function respondWithFilteredResult(_0x5f149e,_0x16de87){return function(_0xf5b7e6){if(_0xf5b7e6){var _0x14cf88=typeof _0x16de87['offset']==='undefined'&&typeof _0x16de87[_0x43f8('0x1f')]===_0x43f8('0x20');var _0x39c8a4=_0xf5b7e6[_0x43f8('0x21')];var _0xcbab36=_0x14cf88?0x0:_0x16de87[_0x43f8('0x22')];var _0xcf8e48=_0x14cf88?_0xf5b7e6[_0x43f8('0x21')]:_0x16de87[_0x43f8('0x22')]+_0x16de87[_0x43f8('0x1f')];var _0x1c2de3;if(_0xcf8e48>=_0x39c8a4){_0xcf8e48=_0x39c8a4;_0x1c2de3=0xc8;}else{_0x1c2de3=0xce;}_0x5f149e['status'](_0x1c2de3);return _0x5f149e[_0x43f8('0x23')](_0x43f8('0x24'),_0xcbab36+'-'+_0xcf8e48+'/'+_0x39c8a4)['json'](_0xf5b7e6);}return null;};}function patchUpdates(_0x36a20d){return function(_0x11cac9){try{jsonpatch[_0x43f8('0x25')](_0x11cac9,_0x36a20d,!![]);}catch(_0x5170e5){return BPromise[_0x43f8('0x26')](_0x5170e5);}return _0x11cac9['save']();};}function saveUpdates(_0x53e3d5,_0x3fbab6){return function(_0x371998){if(_0x371998){return _0x371998['update'](_0x53e3d5)[_0x43f8('0x27')](function(_0x352fcb){return _0x352fcb;});}return null;};}function removeEntity(_0x41d17c,_0x1c78ce){return function(_0x5cd139){if(_0x5cd139){return _0x5cd139[_0x43f8('0x28')]()[_0x43f8('0x27')](function(){_0x41d17c[_0x43f8('0x1c')](0xcc)[_0x43f8('0x1d')]();});}};}function handleEntityNotFound(_0x3e4484,_0x151832){return function(_0x40f76d){if(!_0x40f76d){_0x3e4484['sendStatus'](0x194);}return _0x40f76d;};}function handleError(_0x44d782,_0x4c543e){_0x4c543e=_0x4c543e||0x1f4;return function(_0x432790){logger['error'](_0x432790[_0x43f8('0x29')]);if(_0x432790[_0x43f8('0x2a')]){delete _0x432790[_0x43f8('0x2a')];}_0x44d782[_0x43f8('0x1c')](_0x4c543e)[_0x43f8('0x2b')](_0x432790);};}exports[_0x43f8('0x2c')]=function(_0x2f001a,_0x32ee8e){var _0x655870={},_0x3c5aba={},_0x554624={'count':0x0,'rows':[]};var _0x483c54=_['map'](db['ChatGroup'][_0x43f8('0x2d')],function(_0x31a6c0){return{'name':_0x31a6c0[_0x43f8('0x2e')],'type':_0x31a6c0['type'][_0x43f8('0x2f')]};});_0x3c5aba[_0x43f8('0x30')]=_[_0x43f8('0x31')](_0x483c54,'name');_0x3c5aba['query']=_['keys'](_0x2f001a[_0x43f8('0x32')]);_0x3c5aba[_0x43f8('0x33')]=_['intersection'](_0x3c5aba[_0x43f8('0x30')],_0x3c5aba[_0x43f8('0x32')]);_0x655870[_0x43f8('0x34')]=_[_0x43f8('0x35')](_0x3c5aba[_0x43f8('0x30')],qs[_0x43f8('0x36')](_0x2f001a[_0x43f8('0x32')][_0x43f8('0x36')]));_0x655870['attributes']=_0x655870[_0x43f8('0x34')][_0x43f8('0x37')]?_0x655870[_0x43f8('0x34')]:_0x3c5aba[_0x43f8('0x30')];if(!_0x2f001a[_0x43f8('0x32')][_0x43f8('0x38')](_0x43f8('0x39'))){_0x655870['limit']=qs[_0x43f8('0x1f')](_0x2f001a[_0x43f8('0x32')][_0x43f8('0x1f')]);_0x655870['offset']=qs[_0x43f8('0x22')](_0x2f001a[_0x43f8('0x32')][_0x43f8('0x22')]);}_0x655870['order']=qs[_0x43f8('0x3a')](_0x2f001a[_0x43f8('0x32')]['sort']);_0x655870['where']=qs[_0x43f8('0x33')](_[_0x43f8('0x3b')](_0x2f001a[_0x43f8('0x32')],_0x3c5aba[_0x43f8('0x33')]),_0x483c54);if(_0x2f001a['query'][_0x43f8('0x3c')]){_0x655870['where']=_['merge'](_0x655870['where'],{'$or':_[_0x43f8('0x31')](_0x483c54,function(_0x97f4b2){if(_0x97f4b2[_0x43f8('0x3d')]!==_0x43f8('0x3e')){var _0x377378={};_0x377378[_0x97f4b2[_0x43f8('0x2a')]]={'$like':'%'+_0x2f001a['query']['filter']+'%'};return _0x377378;}})});}_0x655870=_[_0x43f8('0x3f')]({},_0x655870,_0x2f001a[_0x43f8('0x40')]);var _0x13089d={'where':_0x655870['where']};return db[_0x43f8('0x41')][_0x43f8('0x21')](_0x13089d)[_0x43f8('0x27')](function(_0x252a56){_0x554624['count']=_0x252a56;if(_0x2f001a[_0x43f8('0x32')][_0x43f8('0x42')]){_0x655870[_0x43f8('0x43')]=[{'all':!![]}];}return db[_0x43f8('0x41')][_0x43f8('0x44')](_0x655870);})[_0x43f8('0x27')](function(_0x566935){_0x554624[_0x43f8('0x45')]=_0x566935;return _0x554624;})[_0x43f8('0x27')](respondWithFilteredResult(_0x32ee8e,_0x655870))[_0x43f8('0x46')](handleError(_0x32ee8e,null));};exports[_0x43f8('0x47')]=function(_0x26131b,_0xa5536e){var _0xfa45fe={'raw':!![],'where':{'id':_0x26131b[_0x43f8('0x48')]['id']}},_0x3a7b0b={};_0x3a7b0b[_0x43f8('0x30')]=_[_0x43f8('0x49')](db[_0x43f8('0x41')][_0x43f8('0x2d')]);_0x3a7b0b[_0x43f8('0x32')]=_['keys'](_0x26131b[_0x43f8('0x32')]);_0x3a7b0b[_0x43f8('0x33')]=_[_0x43f8('0x35')](_0x3a7b0b[_0x43f8('0x30')],_0x3a7b0b[_0x43f8('0x32')]);_0xfa45fe['attributes']=_[_0x43f8('0x35')](_0x3a7b0b[_0x43f8('0x30')],qs[_0x43f8('0x36')](_0x26131b['query'][_0x43f8('0x36')]));_0xfa45fe[_0x43f8('0x34')]=_0xfa45fe['attributes'][_0x43f8('0x37')]?_0xfa45fe[_0x43f8('0x34')]:_0x3a7b0b[_0x43f8('0x30')];if(_0x26131b[_0x43f8('0x32')]['includeAll']){_0xfa45fe[_0x43f8('0x43')]=[{'all':!![]}];}_0xfa45fe=_['merge']({},_0xfa45fe,_0x26131b[_0x43f8('0x40')]);return db[_0x43f8('0x41')][_0x43f8('0x4a')](_0xfa45fe)[_0x43f8('0x27')](handleEntityNotFound(_0xa5536e,null))[_0x43f8('0x27')](respondWithResult(_0xa5536e,null))['catch'](handleError(_0xa5536e,null));};exports[_0x43f8('0x4b')]=function(_0x534587,_0x2e7b64){return db[_0x43f8('0x41')][_0x43f8('0x4b')](_0x534587['body'],{})[_0x43f8('0x27')](respondWithResult(_0x2e7b64,0xc9))[_0x43f8('0x46')](handleError(_0x2e7b64,null));};exports[_0x43f8('0x4c')]=function(_0x2a9843,_0x18822f){if(_0x2a9843[_0x43f8('0x4d')]['id']){delete _0x2a9843['body']['id'];}return db[_0x43f8('0x41')][_0x43f8('0x4a')]({'where':{'id':_0x2a9843[_0x43f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x18822f,null))[_0x43f8('0x27')](saveUpdates(_0x2a9843['body'],null))[_0x43f8('0x27')](respondWithResult(_0x18822f,null))['catch'](handleError(_0x18822f,null));};exports[_0x43f8('0x28')]=function(_0x3ba720,_0x3a1bca){return db[_0x43f8('0x41')][_0x43f8('0x4a')]({'where':{'id':_0x3ba720['params']['id']}})[_0x43f8('0x27')](handleEntityNotFound(_0x3a1bca,null))[_0x43f8('0x27')](removeEntity(_0x3a1bca,null))[_0x43f8('0x46')](handleError(_0x3a1bca,null));};exports[_0x43f8('0x4e')]=function(_0x305a2d,_0x158d28){return db[_0x43f8('0x41')][_0x43f8('0x4e')]()[_0x43f8('0x27')](respondWithResult(_0x158d28,null))['catch'](handleError(_0x158d28,null));};exports[_0x43f8('0x4f')]=function(_0x49278b,_0x38a8ed,_0x54c729){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x49278b['params']['id'],'ToId':_0x49278b['user']['id'],'read':![]}})[_0x43f8('0x27')](function(_0x3433a5){return{'id':_[_0x43f8('0x50')](_0x49278b[_0x43f8('0x48')]['id']),'count':_0x3433a5};})[_0x43f8('0x27')](respondWithResult(_0x38a8ed,null))['catch'](handleError(_0x38a8ed,null));};exports[_0x43f8('0x51')]=function(_0x2f2533,_0x53f9bb,_0x5caa44){return db[_0x43f8('0x41')]['find']({'where':{'id':_0x2f2533[_0x43f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x53f9bb,null))[_0x43f8('0x27')](function(_0x253004){if(_0x253004){return _0x253004[_0x43f8('0x51')](_0x2f2533[_0x43f8('0x4d')][_0x43f8('0x52')],_[_0x43f8('0x53')](_0x2f2533['body'],[_0x43f8('0x52'),'id'])||{});}})['then'](respondWithResult(_0x53f9bb,null))[_0x43f8('0x46')](handleError(_0x53f9bb,null));};exports[_0x43f8('0x54')]=function(_0x15d8cc,_0x138143,_0x1d5230){var _0x3e92da={};var _0x14ee78={};var _0x34e153;var _0x1dde23;return db['ChatGroup'][_0x43f8('0x55')]({'where':{'id':_0x15d8cc[_0x43f8('0x48')]['id']}})[_0x43f8('0x27')](handleEntityNotFound(_0x138143,null))['then'](function(_0x25bc8e){if(_0x25bc8e){_0x34e153=_0x25bc8e;_0x14ee78[_0x43f8('0x30')]=_[_0x43f8('0x49')](db[_0x43f8('0x56')][_0x43f8('0x2d')]);_0x14ee78[_0x43f8('0x32')]=_[_0x43f8('0x49')](_0x15d8cc[_0x43f8('0x32')]);_0x14ee78[_0x43f8('0x33')]=_[_0x43f8('0x35')](_0x14ee78[_0x43f8('0x30')],_0x14ee78[_0x43f8('0x32')]);_0x3e92da[_0x43f8('0x34')]=_[_0x43f8('0x35')](_0x14ee78[_0x43f8('0x30')],qs[_0x43f8('0x36')](_0x15d8cc[_0x43f8('0x32')][_0x43f8('0x36')]));_0x3e92da[_0x43f8('0x34')]=_0x3e92da[_0x43f8('0x34')]['length']?_0x3e92da['attributes']:_0x14ee78[_0x43f8('0x30')];_0x3e92da[_0x43f8('0x57')]=qs['sort'](_0x15d8cc[_0x43f8('0x32')][_0x43f8('0x3a')]);_0x3e92da[_0x43f8('0x58')]=qs['filters'](_[_0x43f8('0x3b')](_0x15d8cc[_0x43f8('0x32')],_0x14ee78[_0x43f8('0x33')]));if(_0x15d8cc['query'][_0x43f8('0x3c')]){_0x3e92da[_0x43f8('0x58')]=_[_0x43f8('0x3f')](_0x3e92da[_0x43f8('0x58')],{'$or':_[_0x43f8('0x31')](_0x3e92da[_0x43f8('0x34')],function(_0x392d43){var _0x1d170c={};_0x1d170c[_0x392d43]={'$like':'%'+_0x15d8cc[_0x43f8('0x32')][_0x43f8('0x3c')]+'%'};return _0x1d170c;})});}_0x3e92da=_['merge']({},_0x3e92da,_0x15d8cc['options']);return _0x34e153['getMembers'](_0x3e92da);}})['then'](function(_0x1fc4e9){if(_0x1fc4e9){_0x1dde23=_0x1fc4e9[_0x43f8('0x37')];if(!_0x15d8cc[_0x43f8('0x32')]['hasOwnProperty']('nolimit')){_0x3e92da['limit']=qs[_0x43f8('0x1f')](_0x15d8cc[_0x43f8('0x32')][_0x43f8('0x1f')]);_0x3e92da[_0x43f8('0x22')]=qs[_0x43f8('0x22')](_0x15d8cc[_0x43f8('0x32')][_0x43f8('0x22')]);}return _0x34e153['getMembers'](_0x3e92da);}})[_0x43f8('0x27')](function(_0x114618){if(_0x114618){return _0x114618?{'count':_0x1dde23,'rows':_0x114618}:null;}})[_0x43f8('0x27')](respondWithResult(_0x138143,null))[_0x43f8('0x46')](handleError(_0x138143,null));};exports['removeMembers']=function(_0x4a9d78,_0x2c0b59,_0x29c48b){return db['ChatGroup'][_0x43f8('0x4a')]({'where':{'id':_0x4a9d78[_0x43f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c0b59,null))['then'](function(_0x241a55){if(_0x241a55){return _0x241a55[_0x43f8('0x59')](_0x4a9d78[_0x43f8('0x32')][_0x43f8('0x52')]);}})['then'](respondWithStatusCode(_0x2c0b59,null))[_0x43f8('0x46')](handleError(_0x2c0b59,null));};exports[_0x43f8('0x5a')]=function(_0x4cc442,_0x264e0d,_0x428292){if(_0x4cc442['body']['id']){delete _0x4cc442[_0x43f8('0x4d')]['id'];}return db[_0x43f8('0x41')][_0x43f8('0x4a')]({'where':{'id':_0x4cc442[_0x43f8('0x48')]['id']}})[_0x43f8('0x27')](handleEntityNotFound(_0x264e0d,null))['then'](function(_0x1f2e06){if(_0x1f2e06){_0x4cc442['body'][_0x43f8('0x5b')]=_0x1f2e06['id'];return db[_0x43f8('0x5c')][_0x43f8('0x4b')](_0x4cc442[_0x43f8('0x4d')]);}})['then'](respondWithResult(_0x264e0d,null))[_0x43f8('0x46')](handleError(_0x264e0d,null));};exports[_0x43f8('0x5d')]=function(_0x498d61,_0x290685,_0xd207b0){var _0x34a064={};var _0x2f5a46={};var _0x1cc212;var _0xbb52b4;return db[_0x43f8('0x41')][_0x43f8('0x55')]({'where':{'id':_0x498d61[_0x43f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x290685,null))[_0x43f8('0x27')](function(_0x416c23){if(_0x416c23){_0x1cc212=_0x416c23;_0x2f5a46['model']=_[_0x43f8('0x49')](db[_0x43f8('0x5c')][_0x43f8('0x2d')]);_0x2f5a46['query']=_[_0x43f8('0x49')](_0x498d61[_0x43f8('0x32')]);_0x2f5a46['filters']=_[_0x43f8('0x35')](_0x2f5a46['model'],_0x2f5a46[_0x43f8('0x32')]);_0x34a064['attributes']=_[_0x43f8('0x35')](_0x2f5a46[_0x43f8('0x30')],qs[_0x43f8('0x36')](_0x498d61[_0x43f8('0x32')][_0x43f8('0x36')]));_0x34a064[_0x43f8('0x34')]=_0x34a064[_0x43f8('0x34')][_0x43f8('0x37')]?_0x34a064['attributes']:_0x2f5a46[_0x43f8('0x30')];_0x34a064[_0x43f8('0x57')]=qs[_0x43f8('0x3a')](_0x498d61[_0x43f8('0x32')][_0x43f8('0x3a')]);_0x34a064[_0x43f8('0x58')]=qs['filters'](_[_0x43f8('0x3b')](_0x498d61[_0x43f8('0x32')],_0x2f5a46['filters']));if(_0x498d61[_0x43f8('0x32')][_0x43f8('0x3c')]){_0x34a064['where']=_[_0x43f8('0x3f')](_0x34a064[_0x43f8('0x58')],{'$or':_[_0x43f8('0x31')](_0x34a064['attributes'],function(_0x377d99){var _0x106aba={};_0x106aba[_0x377d99]={'$like':'%'+_0x498d61[_0x43f8('0x32')]['filter']+'%'};return _0x106aba;})});}if(_0x498d61['query'][_0x43f8('0x5e')]){var _0x33c625=_0x498d61[_0x43f8('0x32')][_0x43f8('0x5e')]['split'](',');var _0x48b68d={};_0x48b68d[_0x33c625[0x0]]={'$gte':moment(_0x33c625[0x1])[_0x43f8('0x5f')](_0x43f8('0x60'))};_0x34a064[_0x43f8('0x58')]=_[_0x43f8('0x3f')](_0x34a064[_0x43f8('0x58')],_0x48b68d);}_0x34a064=_[_0x43f8('0x3f')]({},_0x34a064,_0x498d61[_0x43f8('0x40')]);return _0x1cc212[_0x43f8('0x5d')](_0x34a064);}})[_0x43f8('0x27')](function(_0x446805){if(_0x446805){_0xbb52b4=_0x446805[_0x43f8('0x37')];if(!_0x498d61[_0x43f8('0x32')][_0x43f8('0x38')](_0x43f8('0x39'))){_0x34a064[_0x43f8('0x1f')]=qs[_0x43f8('0x1f')](_0x498d61[_0x43f8('0x32')][_0x43f8('0x1f')]);_0x34a064['offset']=qs[_0x43f8('0x22')](_0x498d61[_0x43f8('0x32')]['offset']);}return _0x1cc212[_0x43f8('0x5d')](_0x34a064);}})[_0x43f8('0x27')](function(_0x5c4f72){if(_0x5c4f72){return _0x5c4f72?{'count':_0xbb52b4,'rows':_0x5c4f72}:null;}})[_0x43f8('0x27')](respondWithResult(_0x290685,null))[_0x43f8('0x46')](handleError(_0x290685,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fa2c845..c81990c 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 _0x3e65=['setMaxListeners','save','remove','emit','exports','events','ChatGroup'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3e65,0xde));var _0x53e6=function(_0x27b413,_0x2e351d){_0x27b413=_0x27b413-0x0;var _0x30fef4=_0x3e65[_0x27b413];return _0x30fef4;};'use strict';var EventEmitter=require(_0x53e6('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x53e6('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x53e6('0x2')](0x0);var events={'afterCreate':_0x53e6('0x3'),'afterUpdate':'update','afterDestroy':_0x53e6('0x4')};function emitEvent(_0x5bc7d2){return function(_0x15a5c8,_0x4de2aa,_0x375153){ChatGroupEvents[_0x53e6('0x5')](_0x5bc7d2+':'+_0x15a5c8['id'],_0x15a5c8);ChatGroupEvents[_0x53e6('0x5')](_0x5bc7d2,_0x15a5c8);_0x375153(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x53e6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xc6aa=['remove','emit','exports','ChatGroup','setMaxListeners','save','update'];(function(_0x1c5e9d,_0x412682){var _0x413e7c=function(_0x2a34a3){while(--_0x2a34a3){_0x1c5e9d['push'](_0x1c5e9d['shift']());}};_0x413e7c(++_0x412682);}(_0xc6aa,0x1f4));var _0xac6a=function(_0x3eff50,_0xf705a1){_0x3eff50=_0x3eff50-0x0;var _0x5dabe9=_0xc6aa[_0x3eff50];return _0x5dabe9;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xac6a('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xac6a('0x1')](0x0);var events={'afterCreate':_0xac6a('0x2'),'afterUpdate':_0xac6a('0x3'),'afterDestroy':_0xac6a('0x4')};function emitEvent(_0x307132){return function(_0x58aecd,_0x2c212c,_0x5e6efe){ChatGroupEvents[_0xac6a('0x5')](_0x307132+':'+_0x58aecd['id'],_0x58aecd);ChatGroupEvents[_0xac6a('0x5')](_0x307132,_0x58aecd);_0x5e6efe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xac6a('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ab20afe..ef70775 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 _0x5f99=['chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup'];(function(_0xfbfc07,_0x3681b0){var _0x23b6e6=function(_0x2ca326){while(--_0x2ca326){_0xfbfc07['push'](_0xfbfc07['shift']());}};_0x23b6e6(++_0x3681b0);}(_0x5f99,0x1ae));var _0x95f9=function(_0x4ecc53,_0x1cc6e8){_0x4ecc53=_0x4ecc53-0x0;var _0x16a418=_0x5f99[_0x4ecc53];return _0x16a418;};'use strict';var _=require(_0x95f9('0x0'));var util=require(_0x95f9('0x1'));var logger=require(_0x95f9('0x2'))(_0x95f9('0x3'));var moment=require('moment');var BPromise=require(_0x95f9('0x4'));var rp=require(_0x95f9('0x5'));var fs=require('fs');var path=require(_0x95f9('0x6'));var rimraf=require(_0x95f9('0x7'));var config=require(_0x95f9('0x8'));var attributes=require(_0x95f9('0x9'));module['exports']=function(_0xc5da65,_0x1fb516){return _0xc5da65[_0x95f9('0xa')](_0x95f9('0xb'),attributes,{'tableName':_0x95f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7783=['../../config/environment','./chatGroup.attributes','define','ChatGroup','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32be4e,_0x3a2812){var _0x46721d=function(_0x174448){while(--_0x174448){_0x32be4e['push'](_0x32be4e['shift']());}};_0x46721d(++_0x3a2812);}(_0x7783,0x72));var _0x3778=function(_0x4f9691,_0x1f484d){_0x4f9691=_0x4f9691-0x0;var _0x57db23=_0x7783[_0x4f9691];return _0x57db23;};'use strict';var _=require('lodash');var util=require(_0x3778('0x0'));var logger=require(_0x3778('0x1'))(_0x3778('0x2'));var moment=require(_0x3778('0x3'));var BPromise=require(_0x3778('0x4'));var rp=require(_0x3778('0x5'));var fs=require('fs');var path=require(_0x3778('0x6'));var rimraf=require('rimraf');var config=require(_0x3778('0x7'));var attributes=require(_0x3778('0x8'));module['exports']=function(_0xf526,_0x1919d0){return _0xf526[_0x3778('0x9')](_0x3778('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 48f0f9f..8c09e09 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 _0x80d9=['localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0x80d9,0xb6));var _0x980d=function(_0x4d6887,_0x10fad1){_0x4d6887=_0x4d6887-0x0;var _0x503748=_0x80d9[_0x4d6887];return _0x503748;};'use strict';var _=require(_0x980d('0x0'));var util=require(_0x980d('0x1'));var moment=require(_0x980d('0x2'));var BPromise=require(_0x980d('0x3'));var rs=require(_0x980d('0x4'));var fs=require('fs');var Redis=require(_0x980d('0x5'));var db=require(_0x980d('0x6'))['db'];var utils=require(_0x980d('0x7'));var logger=require('../../config/logger')(_0x980d('0x8'));var config=require(_0x980d('0x9'));var jayson=require(_0x980d('0xa'));var client=jayson[_0x980d('0xb')][_0x980d('0xc')]({'port':0x232a});config[_0x980d('0xd')]=_['defaults'](config[_0x980d('0xd')],{'host':_0x980d('0xe'),'port':0x18eb});var socket=require(_0x980d('0xf'))(new Redis(config[_0x980d('0xd')]));require(_0x980d('0x10'))['register'](socket);function respondWithRpcPromise(_0x2b5c39,_0x27cdfa,_0x3a059a){return new BPromise(function(_0x340a8d,_0x135fee){return client[_0x980d('0x11')](_0x2b5c39,_0x3a059a)[_0x980d('0x12')](function(_0x4856e0){logger[_0x980d('0x13')](_0x980d('0x14'),_0x27cdfa,_0x980d('0x15'));logger['debug'](_0x980d('0x16'),_0x27cdfa,_0x980d('0x15'),JSON[_0x980d('0x17')](_0x4856e0));if(_0x4856e0[_0x980d('0x18')]){if(_0x4856e0[_0x980d('0x18')]['code']===0x1f4){logger[_0x980d('0x18')](_0x980d('0x14'),_0x27cdfa,_0x4856e0[_0x980d('0x18')][_0x980d('0x19')]);return _0x135fee(_0x4856e0[_0x980d('0x18')]['message']);}logger[_0x980d('0x18')](_0x980d('0x14'),_0x27cdfa,_0x4856e0['error'][_0x980d('0x19')]);return _0x340a8d(_0x4856e0[_0x980d('0x18')][_0x980d('0x19')]);}else{logger[_0x980d('0x13')](_0x980d('0x14'),_0x27cdfa,_0x980d('0x15'));_0x340a8d(_0x4856e0[_0x980d('0x1a')]['message']);}})[_0x980d('0x1b')](function(_0x1b2815){logger[_0x980d('0x18')]('ChatGroup,\x20%s,\x20%s',_0x27cdfa,_0x1b2815);_0x135fee(_0x1b2815);});});} \ No newline at end of file +var _0xf006=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0xf006,0x146));var _0x6f00=function(_0x1e38b8,_0x4bf917){_0x1e38b8=_0x1e38b8-0x0;var _0x5271d3=_0xf006[_0x1e38b8];return _0x5271d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f00('0x0'));var BPromise=require(_0x6f00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f00('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f00('0x4'));var jayson=require(_0x6f00('0x5'));var client=jayson[_0x6f00('0x6')]['http']({'port':0x232a});config[_0x6f00('0x7')]=_['defaults'](config[_0x6f00('0x7')],{'host':_0x6f00('0x8'),'port':0x18eb});var socket=require(_0x6f00('0x9'))(new Redis(config[_0x6f00('0x7')]));require(_0x6f00('0xa'))[_0x6f00('0xb')](socket);function respondWithRpcPromise(_0x44b63c,_0x1e0720,_0x2aa181){return new BPromise(function(_0x3e6a41,_0x3a0ef4){return client[_0x6f00('0xc')](_0x44b63c,_0x2aa181)[_0x6f00('0xd')](function(_0x4ff833){logger[_0x6f00('0xe')](_0x6f00('0xf'),_0x1e0720,_0x6f00('0x10'));logger[_0x6f00('0x11')](_0x6f00('0x12'),_0x1e0720,'request\x20sent',JSON[_0x6f00('0x13')](_0x4ff833));if(_0x4ff833['error']){if(_0x4ff833[_0x6f00('0x14')]['code']===0x1f4){logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x4ff833[_0x6f00('0x14')][_0x6f00('0x15')]);return _0x3a0ef4(_0x4ff833[_0x6f00('0x14')][_0x6f00('0x15')]);}logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x4ff833[_0x6f00('0x14')]['message']);return _0x3e6a41(_0x4ff833[_0x6f00('0x14')]['message']);}else{logger['info'](_0x6f00('0xf'),_0x1e0720,_0x6f00('0x10'));_0x3e6a41(_0x4ff833[_0x6f00('0x16')][_0x6f00('0x15')]);}})[_0x6f00('0x17')](function(_0x27e466){logger[_0x6f00('0x14')](_0x6f00('0xf'),_0x1e0720,_0x27e466);_0x3a0ef4(_0x27e466);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 18a5c4b..b936acc 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 _0x0afe=['length','chatGroup:','./chatGroup.events','save','remove','removeListener','register'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x0afe,0xbf));var _0xe0af=function(_0x5f20bc,_0x518cf7){_0x5f20bc=_0x5f20bc-0x0;var _0x56f81a=_0x0afe[_0x5f20bc];return _0x56f81a;};'use strict';var ChatGroupEvents=require(_0xe0af('0x0'));var events=[_0xe0af('0x1'),_0xe0af('0x2'),'update'];function createListener(_0x41b0a8,_0x44f5ce){return function(_0x4fbc31){_0x44f5ce['emit'](_0x41b0a8,_0x4fbc31);};}function removeListener(_0x1be16b,_0x30c9fb){return function(){ChatGroupEvents[_0xe0af('0x3')](_0x1be16b,_0x30c9fb);};}exports[_0xe0af('0x4')]=function(_0x49b2fc){for(var _0x2ec13e=0x0,_0x230219=events[_0xe0af('0x5')];_0x2ec13e<_0x230219;_0x2ec13e++){var _0x5b31d8=events[_0x2ec13e];var _0x28904e=createListener(_0xe0af('0x6')+_0x5b31d8,_0x49b2fc);ChatGroupEvents['on'](_0x5b31d8,_0x28904e);}}; \ No newline at end of file +var _0xca58=['emit','removeListener','register','length','./chatGroup.events','save','update'];(function(_0x18f7ff,_0xcfc554){var _0x3343dc=function(_0x18ea0d){while(--_0x18ea0d){_0x18f7ff['push'](_0x18f7ff['shift']());}};_0x3343dc(++_0xcfc554);}(_0xca58,0x154));var _0x8ca5=function(_0x45b7fc,_0x41edf5){_0x45b7fc=_0x45b7fc-0x0;var _0x3cd7e9=_0xca58[_0x45b7fc];return _0x3cd7e9;};'use strict';var ChatGroupEvents=require(_0x8ca5('0x0'));var events=[_0x8ca5('0x1'),'remove',_0x8ca5('0x2')];function createListener(_0x289c0d,_0xd15d1f){return function(_0x3398f6){_0xd15d1f[_0x8ca5('0x3')](_0x289c0d,_0x3398f6);};}function removeListener(_0x5d5f62,_0x3eb701){return function(){ChatGroupEvents[_0x8ca5('0x4')](_0x5d5f62,_0x3eb701);};}exports[_0x8ca5('0x5')]=function(_0x2e8714){for(var _0x5cbfeb=0x0,_0x121d53=events[_0x8ca5('0x6')];_0x5cbfeb<_0x121d53;_0x5cbfeb++){var _0x5c60b4=events[_0x5cbfeb];var _0x3cb36e=createListener('chatGroup:'+_0x5c60b4,_0x2e8714);ChatGroupEvents['on'](_0x5c60b4,_0x3cb36e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9f73f81..16c7297 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 _0xa4b4=['getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','update','destroy','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id/unread'];(function(_0x91188d,_0x2d2019){var _0x2f47ae=function(_0x10e0e8){while(--_0x10e0e8){_0x91188d['push'](_0x91188d['shift']());}};_0x2f47ae(++_0x2d2019);}(_0xa4b4,0x12a));var _0x4a4b=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xa4b4[_0x1ca29f];return _0x576c3b;};'use strict';var multer=require('multer');var util=require(_0x4a4b('0x0'));var path=require(_0x4a4b('0x1'));var timeout=require(_0x4a4b('0x2'));var express=require(_0x4a4b('0x3'));var router=express['Router']();var fs_extra=require(_0x4a4b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a4b('0x5'));var config=require(_0x4a4b('0x6'));var controller=require(_0x4a4b('0x7'));router[_0x4a4b('0x8')]('/',auth[_0x4a4b('0x9')](),controller[_0x4a4b('0xa')]);router[_0x4a4b('0x8')](_0x4a4b('0xb'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0xc')]);router[_0x4a4b('0x8')]('/:id',auth[_0x4a4b('0x9')](),controller['show']);router[_0x4a4b('0x8')](_0x4a4b('0xd'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0xe')]);router[_0x4a4b('0x8')](_0x4a4b('0xf'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x10')]);router[_0x4a4b('0x8')](_0x4a4b('0x11'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x12')]);router[_0x4a4b('0x13')]('/',auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x14')]);router[_0x4a4b('0x13')](_0x4a4b('0xf'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x15')]);router[_0x4a4b('0x13')](_0x4a4b('0x11'),auth['isAuthenticated'](),controller['addMessage']);router['put']('/:id',auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x16')]);router['delete']('/:id',auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x17')]);router['delete'](_0x4a4b('0xf'),auth[_0x4a4b('0x9')](),controller[_0x4a4b('0x18')]);module[_0x4a4b('0x19')]=router; \ No newline at end of file +var _0x35a7=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23ebcc,_0xb4902b){var _0x3def9f=function(_0x1e106a){while(--_0x1e106a){_0x23ebcc['push'](_0x23ebcc['shift']());}};_0x3def9f(++_0xb4902b);}(_0x35a7,0x124));var _0x735a=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x35a7[_0x15b399];return _0x199f2d;};'use strict';var multer=require(_0x735a('0x0'));var util=require('util');var path=require(_0x735a('0x1'));var timeout=require(_0x735a('0x2'));var express=require(_0x735a('0x3'));var router=express[_0x735a('0x4')]();var fs_extra=require(_0x735a('0x5'));var auth=require(_0x735a('0x6'));var interaction=require(_0x735a('0x7'));var config=require(_0x735a('0x8'));var controller=require('./chatGroup.controller');router[_0x735a('0x9')]('/',auth['isAuthenticated'](),controller[_0x735a('0xa')]);router[_0x735a('0x9')](_0x735a('0xb'),auth[_0x735a('0xc')](),controller[_0x735a('0xd')]);router['get'](_0x735a('0xe'),auth[_0x735a('0xc')](),controller[_0x735a('0xf')]);router[_0x735a('0x9')](_0x735a('0x10'),auth['isAuthenticated'](),controller[_0x735a('0x11')]);router[_0x735a('0x9')](_0x735a('0x12'),auth[_0x735a('0xc')](),controller['getMembers']);router[_0x735a('0x9')](_0x735a('0x13'),auth[_0x735a('0xc')](),controller['getMessages']);router[_0x735a('0x14')]('/',auth[_0x735a('0xc')](),controller[_0x735a('0x15')]);router[_0x735a('0x14')](_0x735a('0x12'),auth[_0x735a('0xc')](),controller[_0x735a('0x16')]);router['post'](_0x735a('0x13'),auth['isAuthenticated'](),controller[_0x735a('0x17')]);router[_0x735a('0x18')](_0x735a('0xe'),auth['isAuthenticated'](),controller[_0x735a('0x19')]);router[_0x735a('0x1a')](_0x735a('0xe'),auth[_0x735a('0xc')](),controller[_0x735a('0x1b')]);router[_0x735a('0x1a')](_0x735a('0x12'),auth[_0x735a('0xc')](),controller[_0x735a('0x1c')]);module[_0x735a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6a11e7c..a9649bc 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 _0xf69c=['ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE','long'];(function(_0xb09609,_0x1c4aed){var _0x1130da=function(_0x35e50b){while(--_0x35e50b){_0xb09609['push'](_0xb09609['shift']());}};_0x1130da(++_0x1c4aed);}(_0xf69c,0x1e2));var _0xcf69=function(_0x51057a,_0x2c8c27){_0x51057a=_0x51057a-0x0;var _0x3cbdaa=_0xf69c[_0x51057a];return _0x3cbdaa;};'use strict';var Sequelize=require(_0xcf69('0x0'));module[_0xcf69('0x1')]={'closed':{'type':Sequelize[_0xcf69('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xcf69('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0xcf69('0x4'),_0xcf69('0x5')),'defaultValue':_0xcf69('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xcf69('0x6')]},'mailTranscript':{'type':Sequelize[_0xcf69('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xcf69('0x8')]},'disposition':{'type':Sequelize[_0xcf69('0x7')]},'secondDisposition':{'type':Sequelize[_0xcf69('0x7')]},'thirdDisposition':{'type':Sequelize[_0xcf69('0x7')]},'note':{'type':Sequelize[_0xcf69('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xcf69('0x7')]},'osName':{'type':Sequelize[_0xcf69('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xcf69('0x7')]},'deviceVendor':{'type':Sequelize[_0xcf69('0x7')]},'deviceType':{'type':Sequelize[_0xcf69('0x7')]},'referer':{'type':Sequelize[_0xcf69('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xcf69('0x6')](_0xcf69('0x9'))},'read1stAt':{'type':Sequelize[_0xcf69('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcf69('0xa')]('in',_0xcf69('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xcf69('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xcf69('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xcf69('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9efc=['TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0x300860,_0x509371){var _0x2094ad=function(_0x2090a2){while(--_0x2090a2){_0x300860['push'](_0x300860['shift']());}};_0x2094ad(++_0x509371);}(_0x9efc,0x19c));var _0xc9ef=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0x9efc[_0x17fd72];return _0xa8d8c6;};'use strict';var Sequelize=require(_0xc9ef('0x0'));module[_0xc9ef('0x1')]={'closed':{'type':Sequelize[_0xc9ef('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc9ef('0x3')]},'ratingType':{'type':Sequelize[_0xc9ef('0x4')]('star','thumb'),'defaultValue':_0xc9ef('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xc9ef('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc9ef('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc9ef('0x8')]},'thirdDisposition':{'type':Sequelize[_0xc9ef('0x8')]},'note':{'type':Sequelize[_0xc9ef('0x8')]},'browserName':{'type':Sequelize[_0xc9ef('0x8')]},'browserVersion':{'type':Sequelize[_0xc9ef('0x8')]},'osName':{'type':Sequelize[_0xc9ef('0x8')]},'osVersion':{'type':Sequelize[_0xc9ef('0x8')]},'deviceModel':{'type':Sequelize[_0xc9ef('0x8')]},'deviceVendor':{'type':Sequelize[_0xc9ef('0x8')]},'deviceType':{'type':Sequelize[_0xc9ef('0x8')]},'referer':{'type':Sequelize[_0xc9ef('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xc9ef('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc9ef('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc9ef('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xc9ef('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xc9ef('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2caab71..646f632 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 _0x07d0=['https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','Interaction\x20already\x20assigned','AbandonInteraction','originalname','basename','filename','mimetype','Attachment','findOne','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ContactId','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','includeAgent','findAll','setTags','spread','emit','removeTags','download','unix','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','Account','Owner','Chat','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','lastName','views','downloadInteraction.ejs','.pdf','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','destroy','stack','name','send','render','merge','body','Users','fullname','TagIds','Tags','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','select','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','some','isEmpty','ChatWebsiteId','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','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','agent','sequelize','toString','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.*','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','rows','show','ChatInteraction','include','options','create','params','describe','createVidaooSession','ChatWebsite','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','email','contact','account','POST'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x07d0,0x65));var _0x007d=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x07d0[_0x2db12b];return _0x20990b;};'use strict';var emlformat=require(_0x007d('0x0'));var rimraf=require(_0x007d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x007d('0x2'));var rp=require(_0x007d('0x3'));var moment=require(_0x007d('0x4'));var BPromise=require(_0x007d('0x5'));var Mustache=require('mustache');var util=require(_0x007d('0x6'));var path=require(_0x007d('0x7'));var sox=require(_0x007d('0x8'));var csv=require(_0x007d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x007d('0xa'));var _=require('lodash');var squel=require(_0x007d('0xb'));var crypto=require(_0x007d('0xc'));var jsforce=require(_0x007d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x007d('0xe'));var Papa=require('papaparse');var Redis=require(_0x007d('0xf'));var authService=require(_0x007d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x007d('0x11'));var pdf=require(_0x007d('0x12'));var hardwareService=require(_0x007d('0x13'));var logger=require(_0x007d('0x14'))(_0x007d('0x15'));var utils=require(_0x007d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x007d('0x17'));var db=require(_0x007d('0x18'))['db'];config['redis']=_[_0x007d('0x19')](config[_0x007d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x007d('0x1b'))(new Redis(config[_0x007d('0x1a')]));require(_0x007d('0x1c'))['register'](socket);var jayson=require(_0x007d('0x1d'));var client=jayson[_0x007d('0x1e')][_0x007d('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0x007d('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x5ddc88,_0x46fa19,_0x3bdbc7,_0x31f921){return new BPromise(function(_0x4da663,_0x306d4f){var _0x2d7efa=_0x31f921||client;return _0x2d7efa[_0x007d('0x20')](_0x5ddc88,_0x3bdbc7)[_0x007d('0x21')](function(_0x3026b8){logger[_0x007d('0x22')](_0x007d('0x23'),_0x46fa19,_0x007d('0x24'));logger[_0x007d('0x25')](_0x007d('0x26'),_0x46fa19,_0x007d('0x24'),JSON[_0x007d('0x27')](_0x3026b8));if(_0x3026b8[_0x007d('0x28')]){if(_0x3026b8[_0x007d('0x28')][_0x007d('0x29')]===0x1f4){logger[_0x007d('0x28')](_0x007d('0x23'),_0x46fa19,_0x3026b8[_0x007d('0x28')][_0x007d('0x2a')]);return _0x306d4f(_0x3026b8[_0x007d('0x28')][_0x007d('0x2a')]);}logger[_0x007d('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x46fa19,_0x3026b8['error'][_0x007d('0x2a')]);return _0x4da663(_0x3026b8[_0x007d('0x28')][_0x007d('0x2a')]);}else{logger[_0x007d('0x22')](_0x007d('0x23'),_0x46fa19,_0x007d('0x24'));_0x4da663(_0x3026b8['result'][_0x007d('0x2a')]);}})[_0x007d('0x2b')](function(_0x4c4913){logger['error'](_0x007d('0x23'),_0x46fa19,_0x4c4913);_0x306d4f(_0x4c4913);});});}function respondWithStatusCode(_0x2a8ad9,_0x4df618){_0x4df618=_0x4df618||0xcc;return function(_0x181f68){if(_0x181f68){return _0x2a8ad9['sendStatus'](_0x4df618);}return _0x2a8ad9['status'](_0x4df618)[_0x007d('0x2c')]();};}function respondWithResult(_0x4b574a,_0x3ccba6){_0x3ccba6=_0x3ccba6||0xc8;return function(_0x52bf4f){if(_0x52bf4f){return _0x4b574a['status'](_0x3ccba6)[_0x007d('0x2d')](_0x52bf4f);}};}function respondWithFilteredResult(_0x248d0d,_0x4f3e58){return function(_0x1ecf23){if(_0x1ecf23){var _0xf06b2c=typeof _0x4f3e58[_0x007d('0x2e')]===_0x007d('0x2f')&&typeof _0x4f3e58['limit']===_0x007d('0x2f');var _0x4b3962=_0x1ecf23['count'];var _0x31a0e7=_0xf06b2c?0x0:_0x4f3e58['offset'];var _0xbee5e4=_0xf06b2c?_0x1ecf23[_0x007d('0x30')]:_0x4f3e58[_0x007d('0x2e')]+_0x4f3e58[_0x007d('0x31')];var _0x398754;if(_0xbee5e4>=_0x4b3962){_0xbee5e4=_0x4b3962;_0x398754=0xc8;}else{_0x398754=0xce;}_0x248d0d[_0x007d('0x32')](_0x398754);return _0x248d0d[_0x007d('0x33')](_0x007d('0x34'),_0x31a0e7+'-'+_0xbee5e4+'/'+_0x4b3962)['json'](_0x1ecf23);}return null;};}function patchUpdates(_0x59f138){return function(_0x3c5787){try{jsonpatch['apply'](_0x3c5787,_0x59f138,!![]);}catch(_0x7a798d){return BPromise[_0x007d('0x35')](_0x7a798d);}return _0x3c5787['save']();};}function saveUpdates(_0x41ec62,_0x4a3220){return function(_0x477280){if(_0x477280){return _0x477280[_0x007d('0x36')](_0x41ec62)[_0x007d('0x21')](function(_0x5126a1){return _0x5126a1;});}return null;};}function removeEntity(_0x350c68,_0x372da6){return function(_0x32e106){if(_0x32e106){return _0x32e106[_0x007d('0x37')]()['then'](function(){_0x350c68[_0x007d('0x32')](0xcc)[_0x007d('0x2c')]();});}};}function handleEntityNotFound(_0x25bf8a,_0x1057c6){return function(_0x46364d){if(!_0x46364d){_0x25bf8a['sendStatus'](0x194);}return _0x46364d;};}function handleError(_0x577a20,_0x492850){_0x492850=_0x492850||0x1f4;return function(_0x4d5925){logger[_0x007d('0x28')](_0x4d5925[_0x007d('0x38')]);if(_0x4d5925['name']){delete _0x4d5925[_0x007d('0x39')];}_0x577a20[_0x007d('0x32')](_0x492850)[_0x007d('0x3a')](_0x4d5925);};}function getMustacheRender(_0x18637f,_0x17e1ca){return Mustache[_0x007d('0x3b')](_0x18637f,_[_0x007d('0x3c')](_0x17e1ca[_0x007d('0x3d')],{'contact':_0x17e1ca['contact'],'message':_0x17e1ca[_0x007d('0x2a')],'agent':_0x17e1ca['agent'],'interaction':_0x17e1ca['interaction'],'account':_0x17e1ca['account']}))||'';}function getInteractionUsers(_0x41291b,_0x242004){return new BPromise(function(_0xbdf3d,_0x444cab){try{if(_0x242004[_0x41291b['id']]){_0x41291b[_0x007d('0x3e')]=_['map'](_0x242004[_0x41291b['id']],function(_0x30083f){return{'id':_0x30083f['id'],'fullname':_0x30083f[_0x007d('0x3f')]};});}}catch(_0x46a790){_0x444cab(_0x46a790);}_0xbdf3d(_0x41291b);});}function getInteractionTags(_0x4ad719,_0x1258d1){return new BPromise(function(_0x1f8a27,_0x5523e5){try{if(_0x4ad719[_0x007d('0x40')]){_0x4ad719[_0x007d('0x41')]=[];_0x4ad719[_0x007d('0x40')][_0x007d('0x42')](',')[_0x007d('0x43')](function(_0x4b8442){_0x4ad719[_0x007d('0x41')]['push'](_0x1258d1[_0x4b8442]);});}delete _0x4ad719[_0x007d('0x40')];}catch(_0x1559a5){_0x5523e5(_0x1559a5);}_0x1f8a27(_0x4ad719);});}function updateChatInteraction(_0x432291,_0x5c4cc2,_0x4779ae){return new BPromise(function(_0x49ea0e,_0x57237c){return getInteractionUsers(_0x432291,_0x4779ae)[_0x007d('0x21')](function(_0x49c8ef){return getInteractionTags(_0x49c8ef,_0x5c4cc2);})[_0x007d('0x21')](function(_0x4991ea){return getStateInteraction(_0x4991ea);})[_0x007d('0x21')](function(_0x500e53){_0x49ea0e(_0x500e53);})[_0x007d('0x2b')](function(_0x27b626){_0x57237c(_0x27b626);});});}function getStateInteraction(_0x38bf97){return new BPromise(function(_0x346239){_0x38bf97[_0x007d('0x44')]=0x0;_0x38bf97[_0x007d('0x45')]=0x0;_0x38bf97[_0x007d('0x46')]=0x0;_0x38bf97[_0x007d('0x47')]=0x0;_0x38bf97[_0x007d('0x48')]=0x0;_0x38bf97[_0x007d('0x49')]=0x0;if(!_0x38bf97[_0x007d('0x4a')]&&!_0x38bf97[_0x007d('0x4b')]){_0x38bf97['waiting']+=0x1;}if(!_0x38bf97[_0x007d('0x4a')]&&_0x38bf97[_0x007d('0x4b')]){_0x38bf97[_0x007d('0x45')]+=0x1;if(_0x38bf97[_0x007d('0x44')]){_0x38bf97[_0x007d('0x44')]-=0x1;}}if(_0x38bf97[_0x007d('0x4a')]&&_0x38bf97[_0x007d('0x4c')]==='abandoned'){_0x38bf97['abandoned']+=0x1;if(_0x38bf97[_0x007d('0x44')]){_0x38bf97[_0x007d('0x44')]-=0x1;}}else if(_0x38bf97[_0x007d('0x4a')]&&!_0x38bf97[_0x007d('0x4b')]&&_0x38bf97[_0x007d('0x4c')]){_0x38bf97[_0x007d('0x47')]+=0x1;if(_0x38bf97[_0x007d('0x44')]){_0x38bf97[_0x007d('0x44')]-=0x1;}}else if(_0x38bf97[_0x007d('0x4a')]&&_0x38bf97[_0x007d('0x4b')]){_0x38bf97['answered']+=0x1;if(_0x38bf97[_0x007d('0x45')]){_0x38bf97[_0x007d('0x45')]-=0x1;}}_0x38bf97[_0x007d('0x49')]+=0x1;_0x346239(_0x38bf97);});}exports['index']=function(_0x31a552,_0xeb6e10){var _0x1b594d={},_0x5722ef={},_0x1cc91e={'count':0x0,'rows':[]};var _0x27b9db=_[_0x007d('0x4d')](db['ChatInteraction'][_0x007d('0x4e')],function(_0x47a98e){return{'name':_0x47a98e[_0x007d('0x4f')],'type':_0x47a98e[_0x007d('0x50')]['key']};});_0x5722ef[_0x007d('0x51')]=_[_0x007d('0x4d')](_0x27b9db,_0x007d('0x39'));_0x5722ef['query']=_[_0x007d('0x52')](_0x31a552['query']);_0x5722ef[_0x007d('0x53')]=_[_0x007d('0x54')](_0x5722ef[_0x007d('0x51')],_0x5722ef[_0x007d('0x55')]);_0x1b594d[_0x007d('0x56')]=_[_0x007d('0x54')](_0x5722ef[_0x007d('0x51')],qs['fields'](_0x31a552['query'][_0x007d('0x57')]));_0x1b594d[_0x007d('0x56')]=_0x1b594d[_0x007d('0x56')][_0x007d('0x58')]?_0x1b594d[_0x007d('0x56')]:_0x5722ef[_0x007d('0x51')];if(!_0x31a552['query'][_0x007d('0x59')](_0x007d('0x5a'))){_0x1b594d[_0x007d('0x31')]=qs[_0x007d('0x31')](_0x31a552['query']['limit']);_0x1b594d[_0x007d('0x2e')]=qs[_0x007d('0x2e')](_0x31a552['query'][_0x007d('0x2e')]);}_0x1b594d[_0x007d('0x5b')]=qs[_0x007d('0x5c')](_0x31a552['query']['sort']);_0x1b594d[_0x007d('0x5d')]=qs['filters'](_['pick'](_0x31a552[_0x007d('0x55')],_0x5722ef['filters']),_0x27b9db);var _0xfc623e=[];var _0x45f2d0=squel['select']()[_0x007d('0x5e')]('id')[_0x007d('0x5e')](_0x007d('0x39'))[_0x007d('0x5e')](_0x007d('0x5f'))[_0x007d('0x60')](_0x007d('0x61'));var _0x5445a6=squel['select']()[_0x007d('0x5e')](_0x007d('0x62'))[_0x007d('0x5e')](_0x007d('0x63'))[_0x007d('0x5e')]('ui.ChatInteractionId')[_0x007d('0x60')]('user_has_chat_interactions','ui')['left_join'](_0x007d('0x64'),'u',_0x007d('0x65'));var _0x1eb8f1=squel[_0x007d('0x66')]()['from'](_0x007d('0x67'),'i')[_0x007d('0x68')](_0x007d('0x69'),'c',_0x007d('0x6a'))['left_join'](_0x007d('0x64'),'o',_0x007d('0x6b'))[_0x007d('0x68')](_0x007d('0x6c'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x007d('0x68')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')['left_join']('chat_interaction_has_tags','it',_0x007d('0x6d'))['left_join'](_0x007d('0x61'),'t',_0x007d('0x6e'));var _0x388b89=squel[_0x007d('0x6f')]();var _0x3bbc0e=[];var _0x3667dc=squel[_0x007d('0x6f')]();var _0x48a883;if(_0x31a552['query']['search']){_0x48a883=as['parseSearch'](_0x31a552[_0x007d('0x55')][_0x007d('0x70')]);var _0x5ce815=_0x48a883['sqlOperator'];for(var _0x50d5f4=0x0;_0x50d5f4<_0x48a883[_0x007d('0x71')][_0x007d('0x58')];_0x50d5f4++){var _0x32f1cd=_0x48a883['conditions'][_0x50d5f4];var _0x47ca61='i';var _0xcbdd0e=_[_0x007d('0x72')](_0x27b9db,[_0x007d('0x39'),_0x32f1cd[_0x007d('0x5e')]]);if(!_0xcbdd0e){switch(_0x32f1cd[_0x007d('0x5e')]){case _0x007d('0x73'):if(_0x32f1cd[_0x007d('0x74')]==0x1){_0x1eb8f1[_0x007d('0x75')]('`'+_0x32f1cd['field']+_0x007d('0x76'));}else{_0x1eb8f1[_0x007d('0x75')]('`'+_0x32f1cd['field']+_0x007d('0x77'));}break;case _0x007d('0x78'):if(_0x32f1cd[_0x007d('0x79')]===_0x007d('0x7a')){if(_0x32f1cd[_0x007d('0x74')]['split']('\x20')[_0x007d('0x58')]>0x1){_0x388b89[_0x5ce815](_0x007d('0x7b'),qs[_0x007d('0x7c')](_0x32f1cd[_0x007d('0x74')]),null);}else{var _0x24e879='%'+_0x32f1cd[_0x007d('0x74')]+'%';_0x388b89[_0x5ce815](_0x007d('0x7d'),_0x24e879,_0x24e879,_0x24e879);}}else{_0xcbdd0e=_[_0x007d('0x72')](_0x27b9db,[_0x007d('0x39'),'ContactId']);_0x32f1cd[_0x007d('0x5e')]='ContactId';_0x5ae2f0=as[_0x007d('0x7e')](_0x47ca61,_0xcbdd0e[_0x007d('0x50')],_0x32f1cd);_0x388b89[_0x5ce815](_0x5ae2f0[_0x007d('0x7f')],_0x5ae2f0[_0x007d('0x74')][_0x007d('0x80')],_0x5ae2f0['value'][_0x007d('0x2c')]);}break;case _0x007d('0x81'):var _0x17facf=_0x32f1cd['value']['split'](',')['map'](function(_0x1cf64a){return Number(_0x1cf64a);});_0x17facf[_0x007d('0x43')](function(_0x31cfaa){_0x3667dc['or'](_0x007d('0x82'),'%,'+_0x31cfaa+',%');});_0x3bbc0e=_['union'](_0x3bbc0e,_0x17facf);break;case _0x007d('0x83'):if(_0x32f1cd[_0x007d('0x79')]===_0x007d('0x7a')){_0x388b89[_0x5ce815]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x32f1cd['value']+'%',null);}else{_0xcbdd0e=_[_0x007d('0x72')](_0x27b9db,[_0x007d('0x39'),_0x007d('0x4b')]);_0x32f1cd[_0x007d('0x5e')]=_0x007d('0x4b');_0x5ae2f0=as[_0x007d('0x7e')](_0x47ca61,_0xcbdd0e['type'],_0x32f1cd);_0x388b89[_0x5ce815](_0x5ae2f0[_0x007d('0x7f')],_0x5ae2f0[_0x007d('0x74')]['start'],_0x5ae2f0[_0x007d('0x74')]['end']);}break;case _0x007d('0x3d'):_0x5ae2f0=as[_0x007d('0x7e')]('me',null,_0x32f1cd);_0x388b89[_0x5ce815](_0x5ae2f0[_0x007d('0x7f')],_0x5ae2f0[_0x007d('0x74')]['start'],_0x5ae2f0['value'][_0x007d('0x2c')]);break;}}else{var _0x5ae2f0=as[_0x007d('0x7e')](_0x47ca61,_0xcbdd0e[_0x007d('0x50')],_0x32f1cd);_0x388b89[_0x5ce815](_0x5ae2f0[_0x007d('0x7f')],_0x5ae2f0[_0x007d('0x74')]['start'],_0x5ae2f0[_0x007d('0x74')][_0x007d('0x2c')]);}}}else{var _0x1f1ed7=_(_0x31a552['query'])[_0x007d('0x52')]()[_0x007d('0x4d')](function(_0x3f8840){return _[_0x007d('0x84')](_0x27b9db,[_0x007d('0x39'),_0x3f8840])?_0x3f8840:undefined;})['compact']()[_0x007d('0x74')]();if(!_[_0x007d('0x85')](_0x1f1ed7)){_0x1f1ed7['forEach'](function(_0x546340){if(_0x546340===_0x007d('0x86')){_0x1eb8f1[_0x007d('0x5d')]('i.ChatWebsiteId\x20IN\x20?',[][_0x007d('0x87')](_0x31a552[_0x007d('0x55')][_0x546340]));}else if(_0x546340===_0x007d('0x88')){var _0x43b8f6=JSON[_0x007d('0x89')](_0x31a552['query'][_0x546340])[_0x007d('0x8a')];var _0xfd7e0c=JSON['parse'](_0x31a552[_0x007d('0x55')][_0x546340])[_0x007d('0x8b')];_0x1eb8f1['where'](_0x007d('0x8c'),_0x43b8f6,_0xfd7e0c);}else{if(_0x31a552[_0x007d('0x55')][_0x546340]===_0x007d('0x8d')){_0x1eb8f1['where']('i.'+_0x546340+_0x007d('0x8e'));}else{_0x1eb8f1[_0x007d('0x5d')]('i.'+_0x546340+_0x007d('0x8f'),_0x31a552[_0x007d('0x55')][_0x546340]);}}});}if(_0x31a552[_0x007d('0x55')]['read']){if(_0x31a552[_0x007d('0x55')][_0x007d('0x90')]==0x1){_0x1eb8f1[_0x007d('0x75')](_0x007d('0x91'));}else{_0x1eb8f1[_0x007d('0x75')](_0x007d('0x92'));}}if(_0x31a552[_0x007d('0x55')][_0x007d('0x93')]){_0x3bbc0e=_[_0x007d('0x94')](_0x31a552[_0x007d('0x55')]['tag'])?_0x31a552[_0x007d('0x55')][_0x007d('0x93')]:new Array(_0x31a552['query'][_0x007d('0x93')]);_0x3bbc0e[_0x007d('0x43')](function(_0x98968e){_0x3667dc['or'](_0x007d('0x82'),'%,'+_0x98968e+',%');});}if(_0x31a552[_0x007d('0x55')][_0x007d('0x95')]){var _0x486936=_0x31a552[_0x007d('0x55')][_0x007d('0x95')][_0x007d('0x96')]('\x5c','\x5c\x5c')[_0x007d('0x96')](/'/g,'\x27\x27');if(qs[_0x007d('0x97')](_0x486936)){_0x388b89['or']('i.id\x20LIKE\x20?',_0x486936+'%');}else{_0x388b89['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x007d('0x7c')](_0x486936))['or'](_0x007d('0x98'),_0x486936+'%');}}}_0x1eb8f1[_0x007d('0x5d')](_0x388b89);_0x1eb8f1[_0x007d('0x99')](_0x007d('0x9a'));var _0x5befd2={'type':db[_0x007d('0x9b')][_0x007d('0x9c')][_0x007d('0x9d')],'raw':!![]};var _0x2cc4fd=_0x1eb8f1[_0x007d('0x9e')]();_0x2cc4fd[_0x007d('0x5e')](_0x007d('0x9a'));_0x2cc4fd[_0x007d('0x5e')](_0x007d('0x9f'),_0x007d('0x73'));if(_0x1b594d[_0x007d('0x5b')]){_0x1b594d[_0x007d('0x5b')]['forEach'](function(_0x58b9c7){var _0x199d0f=_0x58b9c7[0x0]===_0x007d('0xa0')?_0x58b9c7[0x0]:'i.'+_0x58b9c7[0x0];_0x1eb8f1[_0x007d('0x5b')](_0x199d0f,_0x58b9c7[0x1]==='DESC'?![]:!![]);});}if(!_[_0x007d('0x85')](_0x3bbc0e)){_0x1eb8f1[_0x007d('0x75')](_0x3667dc);_0x2cc4fd['where']('t.id\x20IN\x20?',_0x3bbc0e);}BPromise[_0x007d('0xa1')]()[_0x007d('0x21')](function(){if(!_0x48a883){if(_0x31a552['query'][_0x007d('0x86')])return;_0x2cc4fd[_0x007d('0x5d')](_0x007d('0xa2'));_0x1eb8f1['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x31a552['user'][_0x007d('0xa3')]!=='agent')return;return _0x31a552[_0x007d('0xa4')][_0x007d('0xa5')]({'attributes':['id'],'raw':!![]})[_0x007d('0x21')](function(_0x43ec2d){if(_[_0x007d('0x85')](_0x43ec2d)){_0x2cc4fd[_0x007d('0x5d')](_0x007d('0xa6'));_0x1eb8f1[_0x007d('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2cc4fd['where'](_0x007d('0xa7'),_[_0x007d('0x4d')](_0x43ec2d,'id'));_0x1eb8f1['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x007d('0x4d')](_0x43ec2d,'id'));}});})[_0x007d('0x21')](function(){if(_0x31a552[_0x007d('0xa4')][_0x007d('0xa3')]===_0x007d('0xa8')&&!_0x48a883&&!_0x31a552[_0x007d('0x55')][_0x007d('0x86')])return[];return db[_0x007d('0xa9')]['query'](_0x2cc4fd[_0x007d('0xaa')](),_0x5befd2);})[_0x007d('0x21')](function(_0x113594){_0x1cc91e[_0x007d('0x30')]=_0x113594[_0x007d('0x58')];if(_0x1cc91e['count']===0x0)return[];return db[_0x007d('0xa9')]['query'](_0x45f2d0[_0x007d('0xaa')](),_0x5befd2)[_0x007d('0x21')](function(_0x454c2e){_0xfc623e=_['keyBy'](_0x454c2e,'id');_0x5befd2=_['merge'](_0x5befd2,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31a552[_0x007d('0x55')][_0x007d('0x57')]){_0x1b594d[_0x007d('0x56')][_0x007d('0x43')](function(_0x119c59){_0x1eb8f1[_0x007d('0x5e')]('i.'+_0x119c59);});}else{_0x1eb8f1['field'](_0x007d('0x9f'),_0x007d('0x73'));_0x1eb8f1['field'](_0x007d('0xab'),'Account.key');_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xac'),_0x007d('0xad'));_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xae'),_0x007d('0xa0'));_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xaf'));_0x1eb8f1[_0x007d('0x5e')]('c.firstName',_0x007d('0xb0'));_0x1eb8f1['field']('c.lastName',_0x007d('0xb1'));_0x1eb8f1[_0x007d('0x5e')]('c.email','Contact.email');_0x1eb8f1['field'](_0x007d('0xb2'),_0x007d('0xb3'));_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xb4'),_0x007d('0xb5'));_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xb6'),_0x007d('0xb7'));_0x1eb8f1['field'](_0x007d('0xb8'),_0x007d('0xb9'));_0x1eb8f1[_0x007d('0x5e')](_0x007d('0xba'),_0x007d('0xbb'));_0x1eb8f1[_0x007d('0x5e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x007d('0x40'));}if(_0x1b594d[_0x007d('0x31')])_0x1eb8f1['limit'](_0x1b594d['limit']);if(_0x1b594d[_0x007d('0x2e')])_0x1eb8f1[_0x007d('0x2e')](_0x1b594d['offset']);return db[_0x007d('0xa9')][_0x007d('0x55')](_0x1eb8f1[_0x007d('0xaa')](),_0x5befd2);})['then'](function(_0x5dabfb){if(_0x5dabfb['length']>0x0)_0x5445a6['where'](_0x007d('0xbc'),_['map'](_0x5dabfb,'id'));return db['sequelize'][_0x007d('0x55')](_0x5445a6[_0x007d('0xaa')](),_0x5befd2)[_0x007d('0x21')](function(_0x4438f4){var _0x568673=_['groupBy'](_0x4438f4,_0x007d('0xbd'));var _0x2392a1=[];_0x5dabfb[_0x007d('0x43')](function(_0x1a152b){_0x2392a1[_0x007d('0xbe')](updateChatInteraction(_0x1a152b,_0xfc623e,_0x568673));});return BPromise['all'](_0x2392a1);});});})[_0x007d('0x21')](function(_0x4a3728){_0x1cc91e[_0x007d('0xbf')]=_0x4a3728;return _0x1cc91e;})[_0x007d('0x21')](respondWithFilteredResult(_0xeb6e10,_0x1b594d))['catch'](handleError(_0xeb6e10,null));};exports[_0x007d('0xc0')]=function(_0x23a1aa,_0xae7aeb){var _0x3c467={'raw':![],'where':{'id':_0x23a1aa['params']['id']}},_0x4473db={};_0x4473db[_0x007d('0x51')]=_['keys'](db[_0x007d('0xc1')]['rawAttributes']);_0x4473db[_0x007d('0x55')]=_[_0x007d('0x52')](_0x23a1aa[_0x007d('0x55')]);_0x4473db[_0x007d('0x53')]=_[_0x007d('0x54')](_0x4473db['model'],_0x4473db[_0x007d('0x55')]);_0x3c467['attributes']=_[_0x007d('0x54')](_0x4473db['model'],qs[_0x007d('0x57')](_0x23a1aa['query'][_0x007d('0x57')]));_0x3c467[_0x007d('0x56')]=_0x3c467[_0x007d('0x56')]['length']?_0x3c467[_0x007d('0x56')]:_0x4473db[_0x007d('0x51')];if(_0x23a1aa['query']['includeAll']){_0x3c467[_0x007d('0xc2')]=[{'all':!![]}];}_0x3c467=_[_0x007d('0x3c')]({},_0x3c467,_0x23a1aa[_0x007d('0xc3')]);return db[_0x007d('0xc1')][_0x007d('0x72')](_0x3c467)[_0x007d('0x21')](handleEntityNotFound(_0xae7aeb,null))[_0x007d('0x21')](respondWithResult(_0xae7aeb,null))[_0x007d('0x2b')](handleError(_0xae7aeb,null));};exports[_0x007d('0xc4')]=function(_0x554dbf,_0x3a6f0e){return db['ChatInteraction'][_0x007d('0xc4')](_0x554dbf[_0x007d('0x3d')],{})[_0x007d('0x21')](respondWithResult(_0x3a6f0e,0xc9))[_0x007d('0x2b')](handleError(_0x3a6f0e,null));};exports['update']=function(_0x47d984,_0xe755a2){if(_0x47d984['body']['id']){delete _0x47d984['body']['id'];}return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x47d984[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](handleEntityNotFound(_0xe755a2,null))[_0x007d('0x21')](saveUpdates(_0x47d984[_0x007d('0x3d')],null))['then'](respondWithResult(_0xe755a2,null))[_0x007d('0x2b')](handleError(_0xe755a2,null));};exports[_0x007d('0x37')]=function(_0x5ac55e,_0x5a96c4){return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x5ac55e[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](handleEntityNotFound(_0x5a96c4,null))['then'](removeEntity(_0x5a96c4,null))[_0x007d('0x2b')](handleError(_0x5a96c4,null));};exports[_0x007d('0xc6')]=function(_0x391887,_0x2adbb8){return db[_0x007d('0xc1')]['describe']()['then'](respondWithResult(_0x2adbb8,null))[_0x007d('0x2b')](handleError(_0x2adbb8,null));};exports[_0x007d('0xc7')]=function(_0x53de51,_0x26f336){var _0x57a83f=_0x53de51[_0x007d('0xc5')]['id'];var _0x21695f;var _0x33f743;var _0x4df82c;return db['ChatInteraction']['findOne']({'where':{'id':_0x57a83f}})[_0x007d('0x21')](function(_0x5a12b2){_0x21695f=_0x5a12b2;return db[_0x007d('0xc8')]['findOne']({'where':{'id':_0x5a12b2['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0x007d('0xc9'),_0x007d('0xca')],'raw':!![]});})['then'](function(_0xb1741d){if(_0xb1741d&&_0xb1741d[_0x007d('0xcb')]&&_0xb1741d[_0x007d('0xcc')]){_0x33f743=_0xb1741d;var _0x1efff7={'interaction':{'id':_0x57a83f},'agent':{'id':_0x53de51[_0x007d('0xa4')]['id'],'name':_0x53de51[_0x007d('0xa4')][_0x007d('0x39')],'fullname':_0x53de51[_0x007d('0xa4')]['fullname'],'email':_0x53de51['user'][_0x007d('0xcd')]},'contact':_0x53de51[_0x007d('0x3d')][_0x007d('0xce')],'account':_0x53de51[_0x007d('0x3d')][_0x007d('0xcf')]};var _0x10548f={'rejectUnauthorized':![],'method':_0x007d('0xd0'),'url':_0x007d('0xd1'),'headers':{'X-APIKEY':_0xb1741d[_0x007d('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53de51[_0x007d('0xa4')][_0x007d('0xcd')]],'buttons':null,'topic':_0x33f743['vidaooTopic'],'note':_[_0x007d('0xd2')](_0x33f743[_0x007d('0xc9')])?null:getMustacheRender(_0x33f743[_0x007d('0xc9')],_0x1efff7),'metadata':null},'redirect':_0x007d('0xd3'),'json':!![]};try{if(!_['isNull'](_0x33f743['vidaooMetadata'])){var _0x4fa00=getMustacheRender(_0x33f743[_0x007d('0xca')],_0x1efff7);var _0x15f28e=JSON['parse'](_0x4fa00);_0x10548f[_0x007d('0x3d')][_0x007d('0xd4')]=_0x15f28e;}}catch(_0x129ea2){throw new db[(_0x007d('0x9b'))][(_0x007d('0xd5'))](_0x007d('0xd6'));}return rp(_0x10548f);}else{throw new db[(_0x007d('0x9b'))]['ValidationError'](_0x007d('0xd7'));}})[_0x007d('0x21')](function(_0x1d9782){_0x4df82c=_0x1d9782;if(_0x4df82c['id']){var _0x10cc5e={'body':_0x4df82c[_0x007d('0xd8')],'ChatWebsiteId':_0x33f743['id'],'ChatInteractionId':_0x21695f['id'],'direction':'out','UserId':_0x53de51['user']['id']};return db[_0x007d('0xd9')][_0x007d('0xc4')](_0x10cc5e,{});}else{throw new db[(_0x007d('0x9b'))][(_0x007d('0xd5'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x007d('0x21')](function(){return _0x21695f[_0x007d('0xda')]({'vidaooSessionId':_0x4df82c['id']});})['then'](respondWithResult(_0x26f336,null))[_0x007d('0x2b')](handleError(_0x26f336,null));};exports[_0x007d('0xdb')]=function(_0x451415,_0x1bd7c7){if(_0x451415[_0x007d('0x3d')]['id']){delete _0x451415[_0x007d('0x3d')]['id'];}return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x451415[_0x007d('0xc5')]['id']},'include':[{'model':db[_0x007d('0xdc')],'as':'Contact'}]})[_0x007d('0x21')](handleEntityNotFound(_0x1bd7c7,null))[_0x007d('0x21')](saveUpdates(_0x451415[_0x007d('0x3d')],null))['then'](respondWithResult(_0x1bd7c7,null))[_0x007d('0x2b')](handleError(_0x1bd7c7,null));};exports[_0x007d('0xdd')]=function(_0x2f4de7,_0xf1d5d1,_0x2a705c){if(_0x2f4de7[_0x007d('0x3d')]['id']){delete _0x2f4de7[_0x007d('0x3d')]['id'];}return db['ChatInteraction'][_0x007d('0x72')]({'where':{'id':_0x2f4de7[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](function(_0x173667){if(!_0x173667){logger['error'](_0x007d('0xde'),_0x007d('0xdd'),0x194,_0x007d('0xdf'));_0xf1d5d1[_0x007d('0xe0')](0x194);}else{if(_0x173667[_0x007d('0x4b')]){throw new db[(_0x007d('0x9b'))][(_0x007d('0xd5'))](_0x007d('0xe1'));}}return _0x173667;})[_0x007d('0x21')](function(_0x29b52a){if(_0x29b52a){return _0x29b52a[_0x007d('0x36')]({'closed':_0x2f4de7[_0x007d('0x3d')][_0x007d('0x4a')],'disposition':_0x2f4de7[_0x007d('0x3d')][_0x007d('0x4c')]})[_0x007d('0x21')](function(_0x2e3cc4){return _0x2e3cc4;});}})[_0x007d('0x21')](function(_0x5555c2){return respondWithRpcPromise(_0x007d('0xe2'),_0x007d('0xdd'),_0x2f4de7[_0x007d('0x3d')],client9004);})[_0x007d('0x21')](respondWithResult(_0xf1d5d1,null))['catch'](handleError(_0xf1d5d1,null));};exports['attachmentUpload']=function(_0x17d2e9,_0x334ea5,_0x3636ae){_0x17d2e9[_0x007d('0x3d')]['name']=_0x17d2e9['file'][_0x007d('0xe3')];_0x17d2e9[_0x007d('0x3d')][_0x007d('0xe4')]=_0x17d2e9['file'][_0x007d('0xe5')];_0x17d2e9[_0x007d('0x3d')]['type']=_0x17d2e9['file'][_0x007d('0xe6')];return db[_0x007d('0xe7')][_0x007d('0xc4')](_0x17d2e9[_0x007d('0x3d')])['then'](respondWithResult(_0x334ea5,0xc9))[_0x007d('0x2b')](handleError(_0x334ea5,null));};exports['attachmentDownload']=function(_0x14f429,_0x4af9f0,_0x58d62e){return db[_0x007d('0xc1')][_0x007d('0xe8')]({'where':{'id':_0x14f429['params']['id']},'raw':!![]})[_0x007d('0x21')](handleEntityNotFound(_0x4af9f0,null))[_0x007d('0x21')](function(_0x2335ee){if(_0x2335ee){if(_0x2335ee[_0x007d('0x4a')]){return _0x4af9f0['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x007d('0xe7')][_0x007d('0xe8')]({'where':{'id':_0x14f429[_0x007d('0x55')][_0x007d('0xe9')]},'raw':!![]})[_0x007d('0x21')](handleEntityNotFound(_0x4af9f0,null));}})['then'](function(_0x130f8a){if(_0x130f8a){var _0x5ddc01=_0x130f8a[_0x007d('0xea')]!==null;var _0xa872d2=path[_0x007d('0xeb')](config[_0x007d('0xec')],_0x007d('0xed'));if(_0x5ddc01){_0xa872d2=path[_0x007d('0xeb')](_0xa872d2,_0x007d('0xee'));}var _0x2cb366=path[_0x007d('0xeb')](_0xa872d2,_0x130f8a[_0x007d('0xe4')]);return _0x4af9f0['download'](_0x2cb366);}})[_0x007d('0x2b')](handleError(_0x4af9f0,null));};exports['close']=function(_0x556fa3,_0x16e209){var _0x1d5c62=null;var _0x243670=null;var _0x2df7a0=null;var _0x5c20b7=null;if(_0x556fa3[_0x007d('0x3d')]['id']){delete _0x556fa3[_0x007d('0x3d')]['id'];}if(_0x556fa3['body'][_0x007d('0xef')]){_0x5c20b7=path[_0x007d('0xeb')](config['root'],_0x007d('0xf0'),util[_0x007d('0xf1')](_0x007d('0xf2'),Date['now']()));_0x556fa3[_0x007d('0x3d')][_0x007d('0xf3')]=_0x5c20b7;}return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x556fa3[_0x007d('0xc5')]['id']},'include':[{'model':db[_0x007d('0xd9')],'as':'Messages','include':[{'model':db[_0x007d('0x83')],'as':_0x007d('0x83')}]}]})[_0x007d('0x21')](handleEntityNotFound(_0x16e209,null))[_0x007d('0x21')](saveUpdates(_0x556fa3[_0x007d('0x3d')],null))['then'](function(_0x7f92cd){if(_0x7f92cd){_0x1d5c62=_0x7f92cd;return db['ChatWebsite'][_0x007d('0x72')]({'where':{'id':_0x1d5c62[_0x007d('0x86')]}});}})[_0x007d('0x21')](function(_0x40484f){if(_0x40484f){_0x2df7a0=_0x40484f;return db[_0x007d('0xdc')][_0x007d('0x72')]({'where':{'id':_0x1d5c62[_0x007d('0xf4')]}});}})['then'](function(_0x3a7425){if(_0x3a7425){_0x243670=_0x3a7425;if(_0x5c20b7){var _0x4767f8=null;for(var _0x5a596f=0x1;_0x5a596f<_0x1d5c62['Messages'][_0x007d('0x58')];++_0x5a596f){_0x4767f8=_0x1d5c62[_0x007d('0xf5')][_0x5a596f];var _0x3a015f=_0x4767f8['UserId']?util[_0x007d('0xf1')](_0x007d('0xf6'),_0x2df7a0[_0x007d('0xf7')],_0x4767f8[_0x007d('0x4b')]):'System';var _0x353a1b=_0x556fa3['body'][_0x007d('0xf8')]||util[_0x007d('0xf1')](_0x007d('0xf6'),_0x007d('0xf9'),_0x4767f8[_0x007d('0xf4')]);switch(_0x2df7a0[_0x007d('0xfa')]){case _0x007d('0xfb'):_0x3a015f=_0x4767f8['UserId']?util[_0x007d('0xf1')]('%s%d',_0x2df7a0[_0x007d('0xf7')],_0x4767f8[_0x007d('0x4b')]):'System';break;case _0x007d('0xfc'):_0x3a015f=_0x4767f8[_0x007d('0x4b')]?_0x4767f8[_0x007d('0x83')][_0x007d('0xfd')]||_0x4767f8[_0x007d('0x83')]['fullname']:_0x007d('0xfe');break;case _0x007d('0xff'):_0x3a015f=_0x4767f8[_0x007d('0x4b')]?_0x4767f8[_0x007d('0x83')][_0x007d('0x3f')]:_0x007d('0xfe');break;default:_0x3a015f=_0x4767f8[_0x007d('0x4b')]?util[_0x007d('0xf1')](_0x007d('0xf6'),_0x2df7a0['agentAlias'],_0x4767f8['UserId']):_0x007d('0xfe');}var _0x1f3938=util[_0x007d('0xf1')](_0x007d('0x100'),moment(_0x4767f8[_0x007d('0x88')])[_0x007d('0xf1')](_0x007d('0x101')),_0x4767f8[_0x007d('0x102')]==='in'?_0x353a1b:_0x3a015f,_0x4767f8[_0x007d('0x3d')]);if(!_0x4767f8[_0x007d('0x103')]){fs[_0x007d('0x104')](_0x5c20b7,_0x1f3938);}}return db[_0x007d('0x105')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x007d('0x106')],'as':_0x007d('0x107'),'raw':!![]}]});}}})['then'](function(_0x426939){if(_0x426939&&_0x426939[_0x007d('0x107')]&&_0x556fa3['body']){var _0x382f2b={'tls':{'rejectUnauthorized':![]}};if(_0x426939['Smtp'][_0x007d('0x108')]){_0x382f2b['service']=_0x426939['Smtp'][_0x007d('0x108')];}else{_0x382f2b[_0x007d('0x109')]=_0x426939['Smtp'][_0x007d('0x109')];_0x382f2b[_0x007d('0x10a')]=_0x426939[_0x007d('0x107')][_0x007d('0x10a')];_0x382f2b[_0x007d('0x10b')]=_0x426939[_0x007d('0x107')][_0x007d('0x10b')];}if(_0x426939[_0x007d('0x107')]['authentication']){_0x382f2b['auth']={'user':_0x426939[_0x007d('0x107')][_0x007d('0xa4')],'pass':_0x426939[_0x007d('0x107')][_0x007d('0x10c')]};}return respondWithRpcPromise(_0x007d('0x10d'),_0x007d('0x10e'),{'account':_0x382f2b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x426939['name'],_0x426939[_0x007d('0xcd')]||_0x426939[_0x007d('0x107')][_0x007d('0xa4')]),'to':_0x556fa3[_0x007d('0x3d')][_0x007d('0xef')],'subject':_0x007d('0x10f'),'text':util[_0x007d('0xf1')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x556fa3[_0x007d('0x3d')][_0x007d('0xef')]),'attachments':[{'path':_0x5c20b7}]}})['then'](function(){return _0x1d5c62;})[_0x007d('0x2b')](function(_0x18c3c9){console[_0x007d('0x28')](_0x18c3c9);});}else{return _0x1d5c62;}})[_0x007d('0x21')](respondWithStatusCode(_0x16e209,0xc8))[_0x007d('0x2b')](handleError(_0x16e209,null));};exports['addMessage']=function(_0x2c7174,_0x52399f,_0x5f1cdb){return db[_0x007d('0xd9')][_0x007d('0x72')]({'where':{'id':_0x2c7174[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](handleEntityNotFound(_0x52399f,null))[_0x007d('0x21')](function(_0x31bddd){if(_0x31bddd){return _0x31bddd[_0x007d('0x110')](_0x2c7174[_0x007d('0x3d')][_0x007d('0x111')],_[_0x007d('0x112')](_0x2c7174[_0x007d('0x3d')],[_0x007d('0x111'),'id'])||{});}})['then'](respondWithResult(_0x52399f,null))[_0x007d('0x2b')](handleError(_0x52399f,null));};exports['getMessages']=function(_0x33f9dc,_0x3df673,_0x34e52c){var _0x4debd4={'raw':![],'where':{}};var _0x2f251b={};var _0xe2b029={'count':0x0,'rows':[]};return db[_0x007d('0xc1')][_0x007d('0xe8')]({'where':{'id':_0x33f9dc[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](handleEntityNotFound(_0x3df673,null))['then'](function(_0x5388e7){if(_0x5388e7){_0x2f251b[_0x007d('0x51')]=_[_0x007d('0x52')](db[_0x007d('0xd9')][_0x007d('0x4e')]);_0x2f251b[_0x007d('0x55')]=_[_0x007d('0x52')](_0x33f9dc[_0x007d('0x55')]);_0x2f251b[_0x007d('0x53')]=_['intersection'](_0x2f251b[_0x007d('0x51')],_0x2f251b[_0x007d('0x55')]);_0x4debd4['attributes']=_[_0x007d('0x54')](_0x2f251b[_0x007d('0x51')],qs[_0x007d('0x57')](_0x33f9dc['query'][_0x007d('0x57')]));_0x4debd4['attributes']=_0x4debd4[_0x007d('0x56')][_0x007d('0x58')]?_0x4debd4[_0x007d('0x56')]:_0x2f251b[_0x007d('0x51')];if(!_0x33f9dc['query'][_0x007d('0x59')](_0x007d('0x5a'))){_0x4debd4[_0x007d('0x31')]=qs[_0x007d('0x31')](_0x33f9dc['query']['limit']);_0x4debd4['offset']=qs[_0x007d('0x2e')](_0x33f9dc[_0x007d('0x55')][_0x007d('0x2e')]);}_0x4debd4['order']=qs[_0x007d('0x5c')](_0x33f9dc[_0x007d('0x55')][_0x007d('0x5c')]);_0x4debd4[_0x007d('0x5d')]=qs['filters'](_[_0x007d('0x113')](_0x33f9dc[_0x007d('0x55')],_0x2f251b['filters']));_0x4debd4[_0x007d('0x5d')][_0x007d('0xbd')]=_0x5388e7['id'];if(_0x33f9dc[_0x007d('0x55')][_0x007d('0x95')]){_0x4debd4[_0x007d('0x5d')]=_[_0x007d('0x3c')](_0x4debd4[_0x007d('0x5d')],{'$or':_['map'](_0x4debd4[_0x007d('0x56')],function(_0x12993f){var _0x4014b9={};_0x4014b9[_0x12993f]={'$like':'%'+_0x33f9dc[_0x007d('0x55')][_0x007d('0x95')]+'%'};return _0x4014b9;})});}if(_0x33f9dc['query'][_0x007d('0x8a')]){var _0x2234ef=_0x33f9dc[_0x007d('0x55')][_0x007d('0x8a')][_0x007d('0x42')](',');var _0x1235ce={};_0x1235ce[_0x2234ef[0x0]]={'$gte':moment(_0x2234ef[0x1])['format'](_0x007d('0x114'))};_0x4debd4[_0x007d('0x5d')]=_[_0x007d('0x3c')](_0x4debd4['where'],_0x1235ce);}_0x4debd4=_['merge']({},_0x4debd4,_0x33f9dc[_0x007d('0xc3')]);return db[_0x007d('0xd9')][_0x007d('0x30')]({'where':_0x4debd4[_0x007d('0x5d')]})[_0x007d('0x21')](function(_0x4f057d){_0xe2b029[_0x007d('0x30')]=_0x4f057d;if(_0x33f9dc['query']['includeAll']){_0x4debd4[_0x007d('0xc2')]=[{'all':!![]}];}return db[_0x007d('0xd9')]['findAll'](_0x4debd4);})[_0x007d('0x21')](function(_0x5105bb){_0xe2b029[_0x007d('0xbf')]=_0x5105bb;return _0xe2b029;});}})[_0x007d('0x21')](respondWithFilteredResult(_0x3df673,_0x4debd4))[_0x007d('0x2b')](handleError(_0x3df673,null));};exports['getMyMessages']=function(_0x3abb4d,_0x9593a9,_0xce71e6){var _0x26f673={'where':{}},_0x24dc3c={},_0x3e16bb={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x007d('0xe8')]({'where':{'id':_0x3abb4d['params']['id']}})[_0x007d('0x21')](handleEntityNotFound(_0x9593a9,null))[_0x007d('0x21')](function(_0x45d278){if(_0x45d278){_0x24dc3c[_0x007d('0x51')]=_['keys'](db[_0x007d('0xd9')]['rawAttributes']);_0x24dc3c['query']=_['keys'](_0x3abb4d[_0x007d('0x55')]);_0x24dc3c[_0x007d('0x53')]=_[_0x007d('0x54')](_0x24dc3c[_0x007d('0x51')],_0x24dc3c[_0x007d('0x55')]);_0x26f673[_0x007d('0x56')]=_[_0x007d('0x54')](_0x24dc3c[_0x007d('0x51')],qs['fields'](_0x3abb4d[_0x007d('0x55')][_0x007d('0x57')]));_0x26f673[_0x007d('0x56')]=_0x26f673[_0x007d('0x56')][_0x007d('0x58')]?_0x26f673[_0x007d('0x56')]:_0x24dc3c[_0x007d('0x51')];if(!_0x3abb4d[_0x007d('0x55')][_0x007d('0x59')](_0x007d('0x5a'))){_0x26f673[_0x007d('0x31')]=qs[_0x007d('0x31')](_0x3abb4d[_0x007d('0x55')][_0x007d('0x31')]);_0x26f673[_0x007d('0x2e')]=qs['offset'](_0x3abb4d[_0x007d('0x55')][_0x007d('0x2e')]);}_0x26f673['order']=qs[_0x007d('0x5c')](_0x3abb4d[_0x007d('0x55')][_0x007d('0x5c')]);_0x26f673['where']=qs['filters'](_['pick'](_0x3abb4d[_0x007d('0x55')],_0x24dc3c[_0x007d('0x53')]));_0x26f673[_0x007d('0x5d')]['ChatInteractionId']=_0x45d278['id'];if(_0x3abb4d['query'][_0x007d('0x95')]){_0x26f673[_0x007d('0x5d')]=_['merge'](_0x26f673[_0x007d('0x5d')],{'$or':_[_0x007d('0x4d')](_0x26f673['attributes'],function(_0x548817){var _0x5330fa={};_0x5330fa[_0x548817]={'$like':'%'+_0x3abb4d[_0x007d('0x55')][_0x007d('0x95')]+'%'};return _0x5330fa;})});}_0x26f673['where'][_0x007d('0x103')]=![];if(_0x3abb4d[_0x007d('0x55')]['id']){_0x26f673['where']['id']={'$gt':_0x3abb4d[_0x007d('0x55')]['id']};}_0x26f673=_[_0x007d('0x3c')]({},_0x26f673,_0x3abb4d[_0x007d('0xc3')]);return db[_0x007d('0xd9')][_0x007d('0x30')]({'where':_0x26f673[_0x007d('0x5d')]})[_0x007d('0x21')](function(_0x14b214){_0x3e16bb[_0x007d('0x30')]=_0x14b214;_0x26f673[_0x007d('0xc2')]=[];if(_0x3abb4d[_0x007d('0x55')][_0x007d('0x115')]){_0x26f673[_0x007d('0xc2')][_0x007d('0xbe')]({'model':db[_0x007d('0x83')],'as':_0x007d('0x83'),'attributes':['id',_0x007d('0x3f'),_0x007d('0xfd')]});}if(_0x3abb4d[_0x007d('0x55')]['includeAll']){_0x26f673[_0x007d('0xc2')]=[{'all':!![]}];}return db['ChatMessage'][_0x007d('0x116')](_0x26f673);})[_0x007d('0x21')](function(_0x5f12ba){_0x3e16bb[_0x007d('0xbf')]=_0x5f12ba;return _0x3e16bb;});}})[_0x007d('0x21')](respondWithFilteredResult(_0x9593a9,_0x26f673))[_0x007d('0x2b')](handleError(_0x9593a9,null));};exports['addTags']=function(_0x4a634a,_0x7cb8f9,_0x2ade1f){return db['ChatInteraction'][_0x007d('0x72')]({'where':{'id':_0x4a634a[_0x007d('0xc5')]['id']}})[_0x007d('0x21')](handleEntityNotFound(_0x7cb8f9,null))[_0x007d('0x21')](function(_0x2ae50f){if(_0x2ae50f){return _0x2ae50f[_0x007d('0x117')](_0x4a634a[_0x007d('0x3d')][_0x007d('0x111')],_['omit'](_0x4a634a['body'],['ids','id'])||{})[_0x007d('0x118')](function(){return db[_0x007d('0x81')]['findAll']({'attributes':['id',_0x007d('0x39'),_0x007d('0x5f')],'where':{'id':_0x4a634a[_0x007d('0x3d')][_0x007d('0x111')]}});})[_0x007d('0x21')](function(_0x524bc4){socket[_0x007d('0x119')]('chatInteractionTags:save',{'id':Number(_0x4a634a[_0x007d('0xc5')]['id']),'tags':_0x524bc4||[]});return{'id':Number(_0x4a634a[_0x007d('0xc5')]['id']),'tags':_0x524bc4||[]};});}})[_0x007d('0x21')](respondWithResult(_0x7cb8f9,null))[_0x007d('0x2b')](handleError(_0x7cb8f9,null));};exports[_0x007d('0x11a')]=function(_0x55ce0b,_0x56204a,_0x288be5){return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x55ce0b[_0x007d('0xc5')]['id']}})['then'](handleEntityNotFound(_0x56204a,null))['then'](function(_0x14b7e0){if(_0x14b7e0){return _0x14b7e0[_0x007d('0x11a')](_0x55ce0b['query'][_0x007d('0x111')]);}})[_0x007d('0x21')](respondWithStatusCode(_0x56204a,null))['catch'](handleError(_0x56204a,null));};exports[_0x007d('0x11b')]=function(_0x4c73f0,_0x575416){var _0x185944=moment()[_0x007d('0x11c')]()[_0x007d('0xaa')]();var _0xf3882c=path['join'](config[_0x007d('0xec')],'server','files',_0x007d('0x11d'));var _0x371b56=path[_0x007d('0xeb')](config[_0x007d('0xec')],_0x007d('0x11e'),_0x007d('0x11f'),_0x007d('0x120'));var _0x79ac29=path['join'](_0xf3882c,_0x185944);var _0x2abb8a=util[_0x007d('0xf1')](_0x007d('0x121'),_0x4c73f0[_0x007d('0xc5')]['id'],_0x185944);var _0x3e38d2=path[_0x007d('0xeb')](_0xf3882c,_0x2abb8a);var _0x1ad3e1=[];_0x1ad3e1[_0x007d('0xbe')]({'model':db[_0x007d('0x83')],'as':'User','attributes':['id',_0x007d('0x3f')],'raw':!![]});_0x1ad3e1['push']({'model':db['CmContact'],'as':_0x007d('0x78'),'attributes':['id',_0x007d('0x122'),'lastName'],'raw':!![]});if(_0x4c73f0['query'][_0x007d('0x120')]){_0x1ad3e1[_0x007d('0xbe')]({'model':db[_0x007d('0xe7')],'as':_0x007d('0xe7'),'raw':!![]});}var _0x33e35b=[{'model':db[_0x007d('0xd9')],'as':_0x007d('0xf5'),'attributes':['id',_0x007d('0x3d'),_0x007d('0x88'),'direction',_0x007d('0x103'),_0x007d('0x90')],'include':_0x1ad3e1}];_0x33e35b[_0x007d('0xbe')]({'model':db['ChatWebsite'],'as':_0x007d('0x123'),'attributes':['id',_0x007d('0x39')]});_0x33e35b['push']({'model':db[_0x007d('0x83')],'as':_0x007d('0x124'),'attributes':['id',_0x007d('0x3f')]});return db[_0x007d('0xc1')][_0x007d('0x72')]({'where':{'id':_0x4c73f0[_0x007d('0xc5')]['id']},'include':_0x33e35b})[_0x007d('0x21')](handleEntityNotFound(_0x575416,null))['then'](function(_0x48018d){if(_0x48018d){var _0x548018=_0x48018d['get']({'plain':!![]});fs['mkdirSync'](_0x79ac29);var _0x29b8f6={'channel':_0x007d('0x125'),'account':_0x548018[_0x007d('0x123')]['name'],'agent':_0x548018['Owner']?_0x548018[_0x007d('0x124')][_0x007d('0x3f')]:'N.A.','createdAt':moment(_0x548018[_0x007d('0x88')])[_0x007d('0xf1')](_0x007d('0x114'))[_0x007d('0xaa')](),'closedAt':_0x548018['closed']?moment(_0x548018['closedAt'])[_0x007d('0xf1')](_0x007d('0x114'))[_0x007d('0xaa')]():'','disposition':_0x548018[_0x007d('0x4c')],'chatInfo':{'browser':_0x548018[_0x007d('0x126')],'os':_0x548018[_0x007d('0x127')],'referer':_0x548018[_0x007d('0x128')],'customerIp':_0x548018[_0x007d('0x129')],'customerPort':_0x548018['customerPort']?_0x548018[_0x007d('0x12a')]:'N.A.'},'messages':_(_0x548018['Messages'])[_0x007d('0x12b')]()[_0x007d('0x95')]({'secret':![]})[_0x007d('0x4d')](function(_0x46d182){if(_0x46d182['Attachment']){var _0x4ed659=path[_0x007d('0xeb')](_0x371b56,_0x46d182[_0x007d('0xe7')][_0x007d('0xe4')]);if(fs[_0x007d('0x12c')](_0x4ed659)){fs['createReadStream'](_0x4ed659)[_0x007d('0x12d')](fs[_0x007d('0x12e')](path[_0x007d('0xeb')](_0x79ac29,_0x46d182[_0x007d('0xe7')][_0x007d('0xe4')])));}}return{'date':moment(_0x46d182['createdAt'])[_0x007d('0xf1')](_0x007d('0x114'))[_0x007d('0xaa')](),'sender':_0x46d182['direction']===_0x007d('0x12f')?_0x46d182[_0x007d('0x83')]?_0x46d182['User']['fullname']:_0x007d('0xfe'):_0x46d182[_0x007d('0x78')][_0x007d('0x122')]+(_0x46d182[_0x007d('0x78')][_0x007d('0x130')]?'\x20'+_0x46d182['Contact'][_0x007d('0x130')]:''),'body':_0x46d182[_0x007d('0xe7')]?_0x46d182[_0x007d('0xe7')][_0x007d('0xe4')]:_0x46d182['body'],'direction':_0x46d182['direction']==='out'?'A':'C','secret':_0x46d182[_0x007d('0x103')],'read':_0x46d182[_0x007d('0x90')],'attachment':_0x46d182[_0x007d('0xe7')]};})[_0x007d('0x74')]()};return ejs['renderFile'](path[_0x007d('0xeb')](config[_0x007d('0xec')],'server',_0x007d('0x131'),_0x007d('0x132')),{'interaction':_0x29b8f6})[_0x007d('0x21')](function(_0x3026f0){var _0x3ac10c=path[_0x007d('0xeb')](_0x79ac29,'transcript-'+_0x548018['id']+'-'+_0x185944+_0x007d('0x133'));var _0x5106d2={'path':_0x3ac10c,'channel':_0x007d('0x125'),'interactionId':_0x548018['id']};return pdf['createPdfFromHTML'](_0x3026f0,_0x5106d2);})['then'](function(){return new BPromise(function(_0x2f9c56,_0x31688c){zipdir(_0x79ac29,{'saveTo':_0x3e38d2},function(_0x277e47,_0x40bb84){if(_0x277e47)return _0x31688c(_0x277e47);return _0x2f9c56(_0x40bb84);});})[_0x007d('0x21')](function(){return new BPromise(function(_0x5d3efe,_0x282545){rimraf(_0x79ac29,function(_0x85dad0){if(_0x85dad0)_0x282545(_0x85dad0);return _0x5d3efe();});});})['then'](function(){return _0x575416[_0x007d('0x11b')](_0x3e38d2,_0x2abb8a,function(_0x567265){if(_0x567265){console['log'](_0x007d('0x134'),_0x567265);}else{fs[_0x007d('0x135')](_0x3e38d2);}});});});}else{return _0x575416['sendStatus'](0xc8);}})['catch'](handleError(_0x575416,null));}; \ No newline at end of file +var _0x134e=['secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','options','includeAgent','alias','addTags','setTags','spread','emit','chatInteractionTags:save','unix','server','files','attachments','lastName','createdAt','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','basename','createReadStream','pipe','firstName','renderFile','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','limit','undefined','count','offset','set','apply','reject','save','destroy','sendStatus','stack','name','render','merge','body','contact','agent','Users','map','fullname','TagIds','Tags','split','forEach','talking','answered','unmanaged','abandoned','closed','waiting','UserId','disposition','total','index','ChatInteraction','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','ChatWebsiteId','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','show','params','rawAttributes','includeAll','include','create','describe','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','metadata','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','AbandonInteraction','file','originalname','mimetype','Attachment','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','pathTranscript','Messages','User','format','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction'];(function(_0x35cd3d,_0x59b8a0){var _0x33d47c=function(_0x1f57e){while(--_0x1f57e){_0x35cd3d['push'](_0x35cd3d['shift']());}};_0x33d47c(++_0x59b8a0);}(_0x134e,0x184));var _0xe134=function(_0x545b3b,_0x1ffae3){_0x545b3b=_0x545b3b-0x0;var _0x189a5f=_0x134e[_0x545b3b];return _0x189a5f;};'use strict';var emlformat=require(_0xe134('0x0'));var rimraf=require(_0xe134('0x1'));var zipdir=require(_0xe134('0x2'));var jsonpatch=require(_0xe134('0x3'));var rp=require(_0xe134('0x4'));var moment=require(_0xe134('0x5'));var BPromise=require(_0xe134('0x6'));var Mustache=require('mustache');var util=require(_0xe134('0x7'));var path=require(_0xe134('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe134('0x9'));var _=require(_0xe134('0xa'));var squel=require(_0xe134('0xb'));var crypto=require(_0xe134('0xc'));var jsforce=require(_0xe134('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe134('0xe'));var querystring=require(_0xe134('0xf'));var Papa=require(_0xe134('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xe134('0x11'));var hardwareService=require(_0xe134('0x12'));var logger=require(_0xe134('0x13'))(_0xe134('0x14'));var utils=require('../../config/utils');var config=require(_0xe134('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe134('0x16'))['db'];config[_0xe134('0x17')]=_[_0xe134('0x18')](config[_0xe134('0x17')],{'host':_0xe134('0x19'),'port':0x18eb});var socket=require(_0xe134('0x1a'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xe134('0x1b')](socket);var jayson=require(_0xe134('0x1c'));var client=jayson[_0xe134('0x1d')][_0xe134('0x1e')]({'port':0x232b});var client9004=jayson[_0xe134('0x1d')][_0xe134('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x50ccda,_0x2b0ba0,_0x258547,_0x4cf2e8){return new BPromise(function(_0x447e9d,_0x133db6){var _0xe757e1=_0x4cf2e8||client;return _0xe757e1[_0xe134('0x1f')](_0x50ccda,_0x258547)[_0xe134('0x20')](function(_0x188f19){logger['info'](_0xe134('0x21'),_0x2b0ba0,_0xe134('0x22'));logger[_0xe134('0x23')](_0xe134('0x24'),_0x2b0ba0,_0xe134('0x22'),JSON[_0xe134('0x25')](_0x188f19));if(_0x188f19['error']){if(_0x188f19[_0xe134('0x26')][_0xe134('0x27')]===0x1f4){logger[_0xe134('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x2b0ba0,_0x188f19[_0xe134('0x26')][_0xe134('0x28')]);return _0x133db6(_0x188f19[_0xe134('0x26')]['message']);}logger['error'](_0xe134('0x21'),_0x2b0ba0,_0x188f19[_0xe134('0x26')][_0xe134('0x28')]);return _0x447e9d(_0x188f19[_0xe134('0x26')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2b0ba0,_0xe134('0x22'));_0x447e9d(_0x188f19[_0xe134('0x29')][_0xe134('0x28')]);}})[_0xe134('0x2a')](function(_0x28b40b){logger[_0xe134('0x26')](_0xe134('0x21'),_0x2b0ba0,_0x28b40b);_0x133db6(_0x28b40b);});});}function respondWithStatusCode(_0x2dff1c,_0x2d532a){_0x2d532a=_0x2d532a||0xcc;return function(_0xe56635){if(_0xe56635){return _0x2dff1c['sendStatus'](_0x2d532a);}return _0x2dff1c[_0xe134('0x2b')](_0x2d532a)[_0xe134('0x2c')]();};}function respondWithResult(_0x1eaf84,_0x9d060b){_0x9d060b=_0x9d060b||0xc8;return function(_0x477fb4){if(_0x477fb4){return _0x1eaf84[_0xe134('0x2b')](_0x9d060b)[_0xe134('0x2d')](_0x477fb4);}};}function respondWithFilteredResult(_0xee6e53,_0x53aada){return function(_0x2bbb9c){if(_0x2bbb9c){var _0x5e61ea=typeof _0x53aada['offset']==='undefined'&&typeof _0x53aada[_0xe134('0x2e')]===_0xe134('0x2f');var _0x4548a0=_0x2bbb9c[_0xe134('0x30')];var _0x35c6eb=_0x5e61ea?0x0:_0x53aada[_0xe134('0x31')];var _0x183167=_0x5e61ea?_0x2bbb9c[_0xe134('0x30')]:_0x53aada[_0xe134('0x31')]+_0x53aada[_0xe134('0x2e')];var _0x5ba896;if(_0x183167>=_0x4548a0){_0x183167=_0x4548a0;_0x5ba896=0xc8;}else{_0x5ba896=0xce;}_0xee6e53[_0xe134('0x2b')](_0x5ba896);return _0xee6e53[_0xe134('0x32')]('Content-Range',_0x35c6eb+'-'+_0x183167+'/'+_0x4548a0)[_0xe134('0x2d')](_0x2bbb9c);}return null;};}function patchUpdates(_0x397a51){return function(_0x232002){try{jsonpatch[_0xe134('0x33')](_0x232002,_0x397a51,!![]);}catch(_0x525ffb){return BPromise[_0xe134('0x34')](_0x525ffb);}return _0x232002[_0xe134('0x35')]();};}function saveUpdates(_0x559312,_0x59a7c3){return function(_0x31cc61){if(_0x31cc61){return _0x31cc61['update'](_0x559312)[_0xe134('0x20')](function(_0x4b5d40){return _0x4b5d40;});}return null;};}function removeEntity(_0x39132d,_0x156c11){return function(_0x482b5f){if(_0x482b5f){return _0x482b5f[_0xe134('0x36')]()[_0xe134('0x20')](function(){_0x39132d[_0xe134('0x2b')](0xcc)[_0xe134('0x2c')]();});}};}function handleEntityNotFound(_0x4ff8fa,_0x1c4288){return function(_0x1082b0){if(!_0x1082b0){_0x4ff8fa[_0xe134('0x37')](0x194);}return _0x1082b0;};}function handleError(_0xae7396,_0x25216c){_0x25216c=_0x25216c||0x1f4;return function(_0x11fdb9){logger[_0xe134('0x26')](_0x11fdb9[_0xe134('0x38')]);if(_0x11fdb9[_0xe134('0x39')]){delete _0x11fdb9[_0xe134('0x39')];}_0xae7396['status'](_0x25216c)['send'](_0x11fdb9);};}function getMustacheRender(_0x403430,_0x136aec){return Mustache[_0xe134('0x3a')](_0x403430,_[_0xe134('0x3b')](_0x136aec[_0xe134('0x3c')],{'contact':_0x136aec[_0xe134('0x3d')],'message':_0x136aec[_0xe134('0x28')],'agent':_0x136aec[_0xe134('0x3e')],'interaction':_0x136aec['interaction'],'account':_0x136aec['account']}))||'';}function getInteractionUsers(_0x29cd71,_0x152e0c){return new BPromise(function(_0x3ffd26,_0x55bf43){try{if(_0x152e0c[_0x29cd71['id']]){_0x29cd71[_0xe134('0x3f')]=_[_0xe134('0x40')](_0x152e0c[_0x29cd71['id']],function(_0x35b4f3){return{'id':_0x35b4f3['id'],'fullname':_0x35b4f3[_0xe134('0x41')]};});}}catch(_0x23950c){_0x55bf43(_0x23950c);}_0x3ffd26(_0x29cd71);});}function getInteractionTags(_0x178742,_0x2295e4){return new BPromise(function(_0x4c7f03,_0x4db77e){try{if(_0x178742[_0xe134('0x42')]){_0x178742[_0xe134('0x43')]=[];_0x178742[_0xe134('0x42')][_0xe134('0x44')](',')[_0xe134('0x45')](function(_0x19049e){_0x178742[_0xe134('0x43')]['push'](_0x2295e4[_0x19049e]);});}delete _0x178742[_0xe134('0x42')];}catch(_0x2ff942){_0x4db77e(_0x2ff942);}_0x4c7f03(_0x178742);});}function updateChatInteraction(_0x5d2080,_0x435d0a,_0x313307){return new BPromise(function(_0x4330cf,_0x268aa6){return getInteractionUsers(_0x5d2080,_0x313307)[_0xe134('0x20')](function(_0xb53b78){return getInteractionTags(_0xb53b78,_0x435d0a);})[_0xe134('0x20')](function(_0x5b3384){return getStateInteraction(_0x5b3384);})[_0xe134('0x20')](function(_0x23b6d8){_0x4330cf(_0x23b6d8);})[_0xe134('0x2a')](function(_0x11a127){_0x268aa6(_0x11a127);});});}function getStateInteraction(_0x3ff73a){return new BPromise(function(_0x88d09d){_0x3ff73a['waiting']=0x0;_0x3ff73a[_0xe134('0x46')]=0x0;_0x3ff73a[_0xe134('0x47')]=0x0;_0x3ff73a[_0xe134('0x48')]=0x0;_0x3ff73a[_0xe134('0x49')]=0x0;_0x3ff73a['total']=0x0;if(!_0x3ff73a[_0xe134('0x4a')]&&!_0x3ff73a['UserId']){_0x3ff73a[_0xe134('0x4b')]+=0x1;}if(!_0x3ff73a['closed']&&_0x3ff73a[_0xe134('0x4c')]){_0x3ff73a[_0xe134('0x46')]+=0x1;if(_0x3ff73a[_0xe134('0x4b')]){_0x3ff73a['waiting']-=0x1;}}if(_0x3ff73a[_0xe134('0x4a')]&&_0x3ff73a[_0xe134('0x4d')]==='abandoned'){_0x3ff73a[_0xe134('0x49')]+=0x1;if(_0x3ff73a[_0xe134('0x4b')]){_0x3ff73a[_0xe134('0x4b')]-=0x1;}}else if(_0x3ff73a[_0xe134('0x4a')]&&!_0x3ff73a[_0xe134('0x4c')]&&_0x3ff73a['disposition']){_0x3ff73a['unmanaged']+=0x1;if(_0x3ff73a['waiting']){_0x3ff73a[_0xe134('0x4b')]-=0x1;}}else if(_0x3ff73a[_0xe134('0x4a')]&&_0x3ff73a[_0xe134('0x4c')]){_0x3ff73a['answered']+=0x1;if(_0x3ff73a['talking']){_0x3ff73a[_0xe134('0x46')]-=0x1;}}_0x3ff73a[_0xe134('0x4e')]+=0x1;_0x88d09d(_0x3ff73a);});}exports[_0xe134('0x4f')]=function(_0x36602a,_0x4b7037){var _0x2cff9a={},_0x32a2c5={},_0x372e91={'count':0x0,'rows':[]};var _0x448d9a=_[_0xe134('0x40')](db[_0xe134('0x50')]['rawAttributes'],function(_0x18edf4){return{'name':_0x18edf4['fieldName'],'type':_0x18edf4['type'][_0xe134('0x51')]};});_0x32a2c5[_0xe134('0x52')]=_[_0xe134('0x40')](_0x448d9a,_0xe134('0x39'));_0x32a2c5[_0xe134('0x53')]=_[_0xe134('0x54')](_0x36602a[_0xe134('0x53')]);_0x32a2c5[_0xe134('0x55')]=_[_0xe134('0x56')](_0x32a2c5[_0xe134('0x52')],_0x32a2c5[_0xe134('0x53')]);_0x2cff9a[_0xe134('0x57')]=_['intersection'](_0x32a2c5[_0xe134('0x52')],qs[_0xe134('0x58')](_0x36602a[_0xe134('0x53')][_0xe134('0x58')]));_0x2cff9a[_0xe134('0x57')]=_0x2cff9a[_0xe134('0x57')][_0xe134('0x59')]?_0x2cff9a[_0xe134('0x57')]:_0x32a2c5[_0xe134('0x52')];if(!_0x36602a[_0xe134('0x53')][_0xe134('0x5a')]('nolimit')){_0x2cff9a[_0xe134('0x2e')]=qs[_0xe134('0x2e')](_0x36602a[_0xe134('0x53')]['limit']);_0x2cff9a[_0xe134('0x31')]=qs[_0xe134('0x31')](_0x36602a[_0xe134('0x53')][_0xe134('0x31')]);}_0x2cff9a[_0xe134('0x5b')]=qs[_0xe134('0x5c')](_0x36602a['query'][_0xe134('0x5c')]);_0x2cff9a[_0xe134('0x5d')]=qs[_0xe134('0x55')](_['pick'](_0x36602a[_0xe134('0x53')],_0x32a2c5[_0xe134('0x55')]),_0x448d9a);var _0x1c2969=[];var _0x48e6b7=squel[_0xe134('0x5e')]()['field']('id')[_0xe134('0x5f')](_0xe134('0x39'))['field'](_0xe134('0x60'))[_0xe134('0x61')](_0xe134('0x62'));var _0x3bac9b=squel[_0xe134('0x5e')]()[_0xe134('0x5f')](_0xe134('0x63'))['field'](_0xe134('0x64'))[_0xe134('0x5f')](_0xe134('0x65'))[_0xe134('0x61')](_0xe134('0x66'),'ui')[_0xe134('0x67')](_0xe134('0x68'),'u',_0xe134('0x69'));var _0x275261=squel[_0xe134('0x5e')]()['from'](_0xe134('0x6a'),'i')['left_join'](_0xe134('0x6b'),'c',_0xe134('0x6c'))[_0xe134('0x67')]('users','o',_0xe134('0x6d'))[_0xe134('0x67')]('chat_websites','a',_0xe134('0x6e'))[_0xe134('0x67')](_0xe134('0x6f'),'me',_0xe134('0x70'))[_0xe134('0x67')](_0xe134('0x71'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join'](_0xe134('0x62'),'t',_0xe134('0x72'));var _0x20e961=squel[_0xe134('0x73')]();var _0x228879=[];var _0x53c077=squel[_0xe134('0x73')]();var _0x2953b2;if(_0x36602a[_0xe134('0x53')]['search']){_0x2953b2=as['parseSearch'](_0x36602a[_0xe134('0x53')]['search']);var _0x26ef8f=_0x2953b2['sqlOperator'];for(var _0x43faac=0x0;_0x43faac<_0x2953b2[_0xe134('0x74')]['length'];_0x43faac++){var _0x39f570=_0x2953b2[_0xe134('0x74')][_0x43faac];var _0x5edc3b='i';var _0x35bc9a=_[_0xe134('0x75')](_0x448d9a,[_0xe134('0x39'),_0x39f570['field']]);if(!_0x35bc9a){switch(_0x39f570[_0xe134('0x5f')]){case _0xe134('0x76'):if(_0x39f570[_0xe134('0x77')]==0x1){_0x275261['having']('`'+_0x39f570[_0xe134('0x5f')]+_0xe134('0x78'));}else{_0x275261[_0xe134('0x79')]('`'+_0x39f570[_0xe134('0x5f')]+'`\x20>\x200');}break;case _0xe134('0x7a'):if(_0x39f570[_0xe134('0x7b')]==='$substring'){if(_0x39f570[_0xe134('0x77')][_0xe134('0x44')]('\x20')[_0xe134('0x59')]>0x1){_0x20e961[_0x26ef8f](_0xe134('0x7c'),qs[_0xe134('0x7d')](_0x39f570['value']),null);}else{var _0x72f16f='%'+_0x39f570[_0xe134('0x77')]+'%';_0x20e961[_0x26ef8f](_0xe134('0x7e'),_0x72f16f,_0x72f16f,_0x72f16f);}}else{_0x35bc9a=_[_0xe134('0x75')](_0x448d9a,[_0xe134('0x39'),_0xe134('0x7f')]);_0x39f570['field']=_0xe134('0x7f');_0x3559ff=as[_0xe134('0x80')](_0x5edc3b,_0x35bc9a[_0xe134('0x81')],_0x39f570);_0x20e961[_0x26ef8f](_0x3559ff[_0xe134('0x82')],_0x3559ff[_0xe134('0x77')][_0xe134('0x83')],_0x3559ff[_0xe134('0x77')][_0xe134('0x2c')]);}break;case _0xe134('0x84'):var _0x591d97=_0x39f570[_0xe134('0x77')][_0xe134('0x44')](',')['map'](function(_0x53b52e){return Number(_0x53b52e);});_0x591d97[_0xe134('0x45')](function(_0x2149f2){_0x53c077['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2149f2+',%');});_0x228879=_[_0xe134('0x85')](_0x228879,_0x591d97);break;case'User':if(_0x39f570[_0xe134('0x7b')]===_0xe134('0x86')){_0x20e961[_0x26ef8f](_0xe134('0x87'),'%'+_0x39f570['value']+'%',null);}else{_0x35bc9a=_[_0xe134('0x75')](_0x448d9a,[_0xe134('0x39'),_0xe134('0x4c')]);_0x39f570['field']=_0xe134('0x4c');_0x3559ff=as[_0xe134('0x80')](_0x5edc3b,_0x35bc9a[_0xe134('0x81')],_0x39f570);_0x20e961[_0x26ef8f](_0x3559ff[_0xe134('0x82')],_0x3559ff[_0xe134('0x77')][_0xe134('0x83')],_0x3559ff[_0xe134('0x77')][_0xe134('0x2c')]);}break;case _0xe134('0x3c'):_0x3559ff=as['buildExpression']('me',null,_0x39f570);_0x20e961[_0x26ef8f](_0x3559ff['text'],_0x3559ff[_0xe134('0x77')][_0xe134('0x83')],_0x3559ff[_0xe134('0x77')]['end']);break;}}else{var _0x3559ff=as[_0xe134('0x80')](_0x5edc3b,_0x35bc9a[_0xe134('0x81')],_0x39f570);_0x20e961[_0x26ef8f](_0x3559ff[_0xe134('0x82')],_0x3559ff['value'][_0xe134('0x83')],_0x3559ff[_0xe134('0x77')][_0xe134('0x2c')]);}}}else{var _0x3fe97b=_(_0x36602a[_0xe134('0x53')])['keys']()[_0xe134('0x40')](function(_0x1226ca){return _[_0xe134('0x88')](_0x448d9a,['name',_0x1226ca])?_0x1226ca:undefined;})['compact']()[_0xe134('0x77')]();if(!_[_0xe134('0x89')](_0x3fe97b)){_0x3fe97b[_0xe134('0x45')](function(_0x3b0ce8){if(_0x3b0ce8==='ChatWebsiteId'){_0x275261[_0xe134('0x5d')](_0xe134('0x8a'),[][_0xe134('0x8b')](_0x36602a[_0xe134('0x53')][_0x3b0ce8]));}else if(_0x3b0ce8==='createdAt'){var _0x335289=JSON[_0xe134('0x8c')](_0x36602a[_0xe134('0x53')][_0x3b0ce8])['$gte'];var _0x178604=JSON['parse'](_0x36602a['query'][_0x3b0ce8])[_0xe134('0x8d')];_0x275261[_0xe134('0x5d')](_0xe134('0x8e'),_0x335289,_0x178604);}else{if(_0x36602a[_0xe134('0x53')][_0x3b0ce8]==='null'){_0x275261['where']('i.'+_0x3b0ce8+_0xe134('0x8f'));}else{_0x275261['where']('i.'+_0x3b0ce8+_0xe134('0x90'),_0x36602a[_0xe134('0x53')][_0x3b0ce8]);}}});}if(_0x36602a[_0xe134('0x53')][_0xe134('0x91')]){if(_0x36602a[_0xe134('0x53')][_0xe134('0x91')]==0x1){_0x275261[_0xe134('0x79')](_0xe134('0x92'));}else{_0x275261[_0xe134('0x79')]('`unreadMessages`\x20>\x200');}}if(_0x36602a[_0xe134('0x53')][_0xe134('0x93')]){_0x228879=_[_0xe134('0x94')](_0x36602a[_0xe134('0x53')][_0xe134('0x93')])?_0x36602a[_0xe134('0x53')]['tag']:new Array(_0x36602a['query'][_0xe134('0x93')]);_0x228879['forEach'](function(_0x4106af){_0x53c077['or'](_0xe134('0x95'),'%,'+_0x4106af+',%');});}if(_0x36602a[_0xe134('0x53')][_0xe134('0x96')]){var _0x30678c=_0x36602a[_0xe134('0x53')][_0xe134('0x96')][_0xe134('0x97')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe134('0x98')](_0x30678c)){_0x20e961['or'](_0xe134('0x99'),_0x30678c+'%');}else{_0x20e961['or'](_0xe134('0x9a'),qs[_0xe134('0x7d')](_0x30678c))['or'](_0xe134('0x9b'),_0x30678c+'%');}}}_0x275261['where'](_0x20e961);_0x275261[_0xe134('0x9c')](_0xe134('0x9d'));var _0x3ed616={'type':db[_0xe134('0x9e')][_0xe134('0x9f')]['SELECT'],'raw':!![]};var _0x571f41=_0x275261[_0xe134('0xa0')]();_0x571f41[_0xe134('0x5f')]('i.id');_0x571f41['field'](_0xe134('0xa1'),_0xe134('0x76'));if(_0x2cff9a[_0xe134('0x5b')]){_0x2cff9a[_0xe134('0x5b')][_0xe134('0x45')](function(_0x35c4bd){var _0x577a6c=_0x35c4bd[0x0]==='contactName'?_0x35c4bd[0x0]:'i.'+_0x35c4bd[0x0];_0x275261[_0xe134('0x5b')](_0x577a6c,_0x35c4bd[0x1]===_0xe134('0xa2')?![]:!![]);});}if(!_[_0xe134('0x89')](_0x228879)){_0x275261[_0xe134('0x79')](_0x53c077);_0x571f41[_0xe134('0x5d')](_0xe134('0xa3'),_0x228879);}BPromise[_0xe134('0xa4')]()[_0xe134('0x20')](function(){if(!_0x2953b2){if(_0x36602a['query']['ChatWebsiteId'])return;_0x571f41['where'](_0xe134('0xa5'));_0x275261[_0xe134('0x5d')](_0xe134('0xa5'));return;}if(_0x36602a['user'][_0xe134('0xa6')]!==_0xe134('0x3e'))return;return _0x36602a['user'][_0xe134('0xa7')]({'attributes':['id'],'raw':!![]})[_0xe134('0x20')](function(_0x4a908b){if(_[_0xe134('0x89')](_0x4a908b)){_0x571f41[_0xe134('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');_0x275261[_0xe134('0x5d')](_0xe134('0xa8'));}else{_0x571f41[_0xe134('0x5d')](_0xe134('0x8a'),_[_0xe134('0x40')](_0x4a908b,'id'));_0x275261['where'](_0xe134('0x8a'),_['map'](_0x4a908b,'id'));}});})[_0xe134('0x20')](function(){if(_0x36602a[_0xe134('0xa9')][_0xe134('0xa6')]===_0xe134('0x3e')&&!_0x2953b2&&!_0x36602a[_0xe134('0x53')][_0xe134('0xaa')])return[];return db[_0xe134('0xab')][_0xe134('0x53')](_0x571f41[_0xe134('0xac')](),_0x3ed616);})['then'](function(_0x3d8f54){_0x372e91[_0xe134('0x30')]=_0x3d8f54[_0xe134('0x59')];if(_0x372e91[_0xe134('0x30')]===0x0)return[];return db[_0xe134('0xab')][_0xe134('0x53')](_0x48e6b7['toString'](),_0x3ed616)['then'](function(_0x52339a){_0x1c2969=_[_0xe134('0xad')](_0x52339a,'id');_0x3ed616=_[_0xe134('0x3b')](_0x3ed616,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36602a[_0xe134('0x53')]['fields']){_0x2cff9a[_0xe134('0x57')][_0xe134('0x45')](function(_0x27e105){_0x275261[_0xe134('0x5f')]('i.'+_0x27e105);});}else{_0x275261[_0xe134('0x5f')](_0xe134('0xa1'),_0xe134('0x76'));_0x275261[_0xe134('0x5f')](_0xe134('0xae'),'Account.key');_0x275261[_0xe134('0x5f')](_0xe134('0xaf'),_0xe134('0xb0'));_0x275261[_0xe134('0x5f')](_0xe134('0xb1'),_0xe134('0xb2'));_0x275261['field'](_0xe134('0xb3'));_0x275261[_0xe134('0x5f')](_0xe134('0xb4'),_0xe134('0xb5'));_0x275261[_0xe134('0x5f')](_0xe134('0xb6'),_0xe134('0xb7'));_0x275261[_0xe134('0x5f')]('c.email','Contact.email');_0x275261[_0xe134('0x5f')](_0xe134('0xb8'),_0xe134('0xb9'));_0x275261[_0xe134('0x5f')](_0xe134('0xba'),_0xe134('0xbb'));_0x275261['field'](_0xe134('0xbc'),_0xe134('0xbd'));_0x275261[_0xe134('0x5f')](_0xe134('0xbe'),_0xe134('0xbf'));_0x275261[_0xe134('0x5f')](_0xe134('0xc0'),_0xe134('0xc1'));_0x275261['field'](_0xe134('0xc2'),_0xe134('0x42'));}if(_0x2cff9a[_0xe134('0x2e')])_0x275261['limit'](_0x2cff9a[_0xe134('0x2e')]);if(_0x2cff9a[_0xe134('0x31')])_0x275261[_0xe134('0x31')](_0x2cff9a[_0xe134('0x31')]);return db[_0xe134('0xab')][_0xe134('0x53')](_0x275261[_0xe134('0xac')](),_0x3ed616);})[_0xe134('0x20')](function(_0x281cd5){if(_0x281cd5[_0xe134('0x59')]>0x0)_0x3bac9b['where'](_0xe134('0xc3'),_[_0xe134('0x40')](_0x281cd5,'id'));return db[_0xe134('0xab')]['query'](_0x3bac9b[_0xe134('0xac')](),_0x3ed616)[_0xe134('0x20')](function(_0x41bc4c){var _0x52d933=_[_0xe134('0xc4')](_0x41bc4c,_0xe134('0xc5'));var _0x381507=[];_0x281cd5[_0xe134('0x45')](function(_0x46f2c1){_0x381507[_0xe134('0xc6')](updateChatInteraction(_0x46f2c1,_0x1c2969,_0x52d933));});return BPromise[_0xe134('0xc7')](_0x381507);});});})[_0xe134('0x20')](function(_0x579cd5){_0x372e91['rows']=_0x579cd5;return _0x372e91;})[_0xe134('0x20')](respondWithFilteredResult(_0x4b7037,_0x2cff9a))[_0xe134('0x2a')](handleError(_0x4b7037,null));};exports[_0xe134('0xc8')]=function(_0xc74ad5,_0x19b84e){var _0x365823={'raw':![],'where':{'id':_0xc74ad5[_0xe134('0xc9')]['id']}},_0x498a52={};_0x498a52[_0xe134('0x52')]=_[_0xe134('0x54')](db[_0xe134('0x50')][_0xe134('0xca')]);_0x498a52['query']=_[_0xe134('0x54')](_0xc74ad5[_0xe134('0x53')]);_0x498a52['filters']=_[_0xe134('0x56')](_0x498a52[_0xe134('0x52')],_0x498a52[_0xe134('0x53')]);_0x365823[_0xe134('0x57')]=_[_0xe134('0x56')](_0x498a52[_0xe134('0x52')],qs['fields'](_0xc74ad5['query'][_0xe134('0x58')]));_0x365823[_0xe134('0x57')]=_0x365823[_0xe134('0x57')]['length']?_0x365823[_0xe134('0x57')]:_0x498a52[_0xe134('0x52')];if(_0xc74ad5[_0xe134('0x53')][_0xe134('0xcb')]){_0x365823[_0xe134('0xcc')]=[{'all':!![]}];}_0x365823=_[_0xe134('0x3b')]({},_0x365823,_0xc74ad5['options']);return db[_0xe134('0x50')][_0xe134('0x75')](_0x365823)['then'](handleEntityNotFound(_0x19b84e,null))[_0xe134('0x20')](respondWithResult(_0x19b84e,null))[_0xe134('0x2a')](handleError(_0x19b84e,null));};exports[_0xe134('0xcd')]=function(_0x570674,_0x3beacd){return db[_0xe134('0x50')]['create'](_0x570674[_0xe134('0x3c')],{})['then'](respondWithResult(_0x3beacd,0xc9))[_0xe134('0x2a')](handleError(_0x3beacd,null));};exports['update']=function(_0x47a0b5,_0x344758){if(_0x47a0b5[_0xe134('0x3c')]['id']){delete _0x47a0b5['body']['id'];}return db[_0xe134('0x50')]['find']({'where':{'id':_0x47a0b5[_0xe134('0xc9')]['id']}})['then'](handleEntityNotFound(_0x344758,null))['then'](saveUpdates(_0x47a0b5[_0xe134('0x3c')],null))[_0xe134('0x20')](respondWithResult(_0x344758,null))[_0xe134('0x2a')](handleError(_0x344758,null));};exports[_0xe134('0x36')]=function(_0x5b6c26,_0x4b92bc){return db['ChatInteraction'][_0xe134('0x75')]({'where':{'id':_0x5b6c26['params']['id']}})['then'](handleEntityNotFound(_0x4b92bc,null))[_0xe134('0x20')](removeEntity(_0x4b92bc,null))[_0xe134('0x2a')](handleError(_0x4b92bc,null));};exports[_0xe134('0xce')]=function(_0x17ede2,_0x325246){return db[_0xe134('0x50')]['describe']()[_0xe134('0x20')](respondWithResult(_0x325246,null))[_0xe134('0x2a')](handleError(_0x325246,null));};exports['createVidaooSession']=function(_0x464060,_0x218c0f){var _0xfe4358=_0x464060[_0xe134('0xc9')]['id'];var _0x33d0c7;var _0x248b1c;var _0x2b482f;return db['ChatInteraction']['findOne']({'where':{'id':_0xfe4358}})[_0xe134('0x20')](function(_0x345141){_0x33d0c7=_0x345141;return db[_0xe134('0xcf')][_0xe134('0xd0')]({'where':{'id':_0x345141[_0xe134('0xaa')]},'attributes':['id','vidaooApiKey',_0xe134('0xd1'),_0xe134('0xd2'),_0xe134('0xd3'),_0xe134('0xd4')],'raw':!![]});})['then'](function(_0x273116){if(_0x273116&&_0x273116[_0xe134('0xd5')]&&_0x273116[_0xe134('0xd1')]){_0x248b1c=_0x273116;var _0x3a0c6d={'interaction':{'id':_0xfe4358},'agent':{'id':_0x464060['user']['id'],'name':_0x464060[_0xe134('0xa9')]['name'],'fullname':_0x464060[_0xe134('0xa9')]['fullname'],'email':_0x464060[_0xe134('0xa9')]['email']},'contact':_0x464060['body'][_0xe134('0x3d')],'account':_0x464060[_0xe134('0x3c')]['account']};var _0x26529d={'rejectUnauthorized':![],'method':_0xe134('0xd6'),'url':_0xe134('0xd7'),'headers':{'X-APIKEY':_0x273116['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x464060[_0xe134('0xa9')][_0xe134('0xd8')]],'buttons':null,'topic':_0x248b1c[_0xe134('0xd2')],'note':_['isNull'](_0x248b1c['vidaooNote'])?null:getMustacheRender(_0x248b1c['vidaooNote'],_0x3a0c6d),'metadata':null},'redirect':_0xe134('0xd9'),'json':!![]};try{if(!_[_0xe134('0xda')](_0x248b1c[_0xe134('0xd4')])){var _0x19a286=getMustacheRender(_0x248b1c[_0xe134('0xd4')],_0x3a0c6d);var _0x83ed22=JSON[_0xe134('0x8c')](_0x19a286);_0x26529d[_0xe134('0x3c')][_0xe134('0xdb')]=_0x83ed22;}}catch(_0x26dceb){throw new db['Sequelize'][(_0xe134('0xdc'))](_0xe134('0xdd'));}return rp(_0x26529d);}else{throw new db[(_0xe134('0x9e'))][(_0xe134('0xdc'))](_0xe134('0xde'));}})[_0xe134('0x20')](function(_0x872478){_0x2b482f=_0x872478;if(_0x2b482f['id']){var _0x495bf4={'body':_0x2b482f[_0xe134('0xdf')],'ChatWebsiteId':_0x248b1c['id'],'ChatInteractionId':_0x33d0c7['id'],'direction':_0xe134('0xe0'),'UserId':_0x464060[_0xe134('0xa9')]['id']};return db[_0xe134('0xe1')]['create'](_0x495bf4,{});}else{throw new db[(_0xe134('0x9e'))][(_0xe134('0xdc'))](_0xe134('0xe2'));}})[_0xe134('0x20')](function(){return _0x33d0c7[_0xe134('0xe3')]({'vidaooSessionId':_0x2b482f['id']});})[_0xe134('0x20')](respondWithResult(_0x218c0f,null))[_0xe134('0x2a')](handleError(_0x218c0f,null));};exports[_0xe134('0xe4')]=function(_0x56fb7f,_0x3be76d){if(_0x56fb7f[_0xe134('0x3c')]['id']){delete _0x56fb7f[_0xe134('0x3c')]['id'];}return db[_0xe134('0x50')][_0xe134('0x75')]({'where':{'id':_0x56fb7f[_0xe134('0xc9')]['id']},'include':[{'model':db[_0xe134('0xe5')],'as':_0xe134('0x7a')}]})[_0xe134('0x20')](handleEntityNotFound(_0x3be76d,null))[_0xe134('0x20')](saveUpdates(_0x56fb7f[_0xe134('0x3c')],null))['then'](respondWithResult(_0x3be76d,null))[_0xe134('0x2a')](handleError(_0x3be76d,null));};exports[_0xe134('0xe6')]=function(_0x16fb0c,_0x1d974c,_0x9f2ed6){if(_0x16fb0c[_0xe134('0x3c')]['id']){delete _0x16fb0c[_0xe134('0x3c')]['id'];}return db['ChatInteraction'][_0xe134('0x75')]({'where':{'id':_0x16fb0c[_0xe134('0xc9')]['id']}})['then'](function(_0x44c551){if(!_0x44c551){logger[_0xe134('0x26')](_0xe134('0xe7'),'abandon',0x194,_0xe134('0xe8'));_0x1d974c[_0xe134('0x37')](0x194);}else{if(_0x44c551[_0xe134('0x4c')]){throw new db['Sequelize'][(_0xe134('0xdc'))](_0xe134('0xe9'));}}return _0x44c551;})['then'](function(_0x45275c){if(_0x45275c){return _0x45275c[_0xe134('0xea')]({'closed':_0x16fb0c['body'][_0xe134('0x4a')],'disposition':_0x16fb0c[_0xe134('0x3c')]['disposition']})[_0xe134('0x20')](function(_0x508f7b){return _0x508f7b;});}})['then'](function(_0xcd71eb){return respondWithRpcPromise(_0xe134('0xeb'),_0xe134('0xe6'),_0x16fb0c[_0xe134('0x3c')],client9004);})['then'](respondWithResult(_0x1d974c,null))[_0xe134('0x2a')](handleError(_0x1d974c,null));};exports['attachmentUpload']=function(_0x1eef5d,_0x21f397,_0x809cb4){_0x1eef5d[_0xe134('0x3c')]['name']=_0x1eef5d[_0xe134('0xec')][_0xe134('0xed')];_0x1eef5d[_0xe134('0x3c')]['basename']=_0x1eef5d[_0xe134('0xec')]['filename'];_0x1eef5d[_0xe134('0x3c')][_0xe134('0x81')]=_0x1eef5d['file'][_0xe134('0xee')];return db[_0xe134('0xef')][_0xe134('0xcd')](_0x1eef5d['body'])[_0xe134('0x20')](respondWithResult(_0x21f397,0xc9))[_0xe134('0x2a')](handleError(_0x21f397,null));};exports['attachmentDownload']=function(_0x207eaa,_0x2f98cd,_0x30f184){return db['ChatInteraction']['findOne']({'where':{'id':_0x207eaa[_0xe134('0xc9')]['id']},'raw':!![]})[_0xe134('0x20')](handleEntityNotFound(_0x2f98cd,null))[_0xe134('0x20')](function(_0x520d16){if(_0x520d16){if(_0x520d16['closed']){return _0x2f98cd[_0xe134('0x2b')](0x193)[_0xe134('0x2d')]({'status':0x193,'message':_0xe134('0xf0')});}return db[_0xe134('0xef')][_0xe134('0xd0')]({'where':{'id':_0x207eaa[_0xe134('0x53')][_0xe134('0xf1')]},'raw':!![]})[_0xe134('0x20')](handleEntityNotFound(_0x2f98cd,null));}})[_0xe134('0x20')](function(_0x189ad0){if(_0x189ad0){var _0x12b7a7=_0x189ad0['ChatOfflineMessageId']!==null;var _0x3ecd4d=path[_0xe134('0xf2')](config[_0xe134('0xf3')],_0xe134('0xf4'));if(_0x12b7a7){_0x3ecd4d=path['join'](_0x3ecd4d,_0xe134('0xf5'));}var _0x43776a=path['join'](_0x3ecd4d,_0x189ad0['basename']);return _0x2f98cd[_0xe134('0xf6')](_0x43776a);}})[_0xe134('0x2a')](handleError(_0x2f98cd,null));};exports[_0xe134('0xf7')]=function(_0x4accb5,_0x911e23){var _0x33ff55=null;var _0x529985=null;var _0x227ebe=null;var _0x17f968=null;if(_0x4accb5[_0xe134('0x3c')]['id']){delete _0x4accb5[_0xe134('0x3c')]['id'];}if(_0x4accb5[_0xe134('0x3c')][_0xe134('0xf8')]){_0x17f968=path['join'](config[_0xe134('0xf3')],_0xe134('0xf9'),util['format']('transcript-%s.txt',Date['now']()));_0x4accb5['body'][_0xe134('0xfa')]=_0x17f968;}return db[_0xe134('0x50')][_0xe134('0x75')]({'where':{'id':_0x4accb5['params']['id']},'include':[{'model':db[_0xe134('0xe1')],'as':_0xe134('0xfb'),'include':[{'model':db[_0xe134('0xfc')],'as':_0xe134('0xfc')}]}]})[_0xe134('0x20')](handleEntityNotFound(_0x911e23,null))[_0xe134('0x20')](saveUpdates(_0x4accb5['body'],null))[_0xe134('0x20')](function(_0x27920f){if(_0x27920f){_0x33ff55=_0x27920f;return db['ChatWebsite'][_0xe134('0x75')]({'where':{'id':_0x33ff55['ChatWebsiteId']}});}})[_0xe134('0x20')](function(_0x27e3a6){if(_0x27e3a6){_0x227ebe=_0x27e3a6;return db[_0xe134('0xe5')][_0xe134('0x75')]({'where':{'id':_0x33ff55[_0xe134('0x7f')]}});}})['then'](function(_0x13075d){if(_0x13075d){_0x529985=_0x13075d;if(_0x17f968){var _0x586636=null;for(var _0x403e36=0x1;_0x403e36<_0x33ff55['Messages']['length'];++_0x403e36){_0x586636=_0x33ff55[_0xe134('0xfb')][_0x403e36];var _0x3c574b=_0x586636['UserId']?util[_0xe134('0xfd')](_0xe134('0xfe'),_0x227ebe[_0xe134('0xff')],_0x586636[_0xe134('0x4c')]):_0xe134('0x100');var _0x3bf84b=_0x4accb5[_0xe134('0x3c')][_0xe134('0x101')]||util[_0xe134('0xfd')](_0xe134('0xfe'),'Visitor',_0x586636[_0xe134('0x7f')]);switch(_0x227ebe[_0xe134('0x102')]){case _0xe134('0x103'):_0x3c574b=_0x586636['UserId']?util['format'](_0xe134('0xfe'),_0x227ebe[_0xe134('0xff')],_0x586636[_0xe134('0x4c')]):_0xe134('0x100');break;case _0xe134('0x104'):_0x3c574b=_0x586636['UserId']?_0x586636['User']['alias']||_0x586636['User']['fullname']:_0xe134('0x100');break;case _0xe134('0x105'):_0x3c574b=_0x586636['UserId']?_0x586636[_0xe134('0xfc')][_0xe134('0x41')]:'System';break;default:_0x3c574b=_0x586636[_0xe134('0x4c')]?util[_0xe134('0xfd')](_0xe134('0xfe'),_0x227ebe['agentAlias'],_0x586636[_0xe134('0x4c')]):_0xe134('0x100');}var _0x533a7f=util[_0xe134('0xfd')](_0xe134('0x106'),moment(_0x586636['createdAt'])[_0xe134('0xfd')]('MM/DD/YYYY\x20HH:mm:ss'),_0x586636[_0xe134('0x107')]==='in'?_0x3bf84b:_0x3c574b,_0x586636[_0xe134('0x3c')]);if(!_0x586636[_0xe134('0x108')]){fs[_0xe134('0x109')](_0x17f968,_0x533a7f);}}return db[_0xe134('0x10a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe134('0x10b')],'as':_0xe134('0x10c'),'raw':!![]}]});}}})[_0xe134('0x20')](function(_0x26d21a){if(_0x26d21a&&_0x26d21a[_0xe134('0x10c')]&&_0x4accb5[_0xe134('0x3c')]){var _0xcb0997={'tls':{'rejectUnauthorized':![]}};if(_0x26d21a['Smtp'][_0xe134('0x10d')]){_0xcb0997[_0xe134('0x10d')]=_0x26d21a['Smtp']['service'];}else{_0xcb0997[_0xe134('0x10e')]=_0x26d21a[_0xe134('0x10c')][_0xe134('0x10e')];_0xcb0997[_0xe134('0x10f')]=_0x26d21a[_0xe134('0x10c')][_0xe134('0x10f')];_0xcb0997[_0xe134('0x110')]=_0x26d21a[_0xe134('0x10c')][_0xe134('0x110')];}if(_0x26d21a[_0xe134('0x10c')][_0xe134('0x111')]){_0xcb0997[_0xe134('0x112')]={'user':_0x26d21a[_0xe134('0x10c')][_0xe134('0xa9')],'pass':_0x26d21a[_0xe134('0x10c')][_0xe134('0x113')]};}return respondWithRpcPromise(_0xe134('0x114'),_0xe134('0x115'),{'account':_0xcb0997,'message':{'from':util[_0xe134('0xfd')](_0xe134('0x116'),_0x26d21a[_0xe134('0x39')],_0x26d21a[_0xe134('0xd8')]||_0x26d21a[_0xe134('0x10c')][_0xe134('0xa9')]),'to':_0x4accb5[_0xe134('0x3c')][_0xe134('0xf8')],'subject':'Mail\x20Transcript','text':util[_0xe134('0xfd')](_0xe134('0x117'),_0x4accb5['body']['mailTranscript']),'attachments':[{'path':_0x17f968}]}})[_0xe134('0x20')](function(){return _0x33ff55;})[_0xe134('0x2a')](function(_0x189691){console[_0xe134('0x26')](_0x189691);});}else{return _0x33ff55;}})['then'](respondWithStatusCode(_0x911e23,0xc8))[_0xe134('0x2a')](handleError(_0x911e23,null));};exports[_0xe134('0x118')]=function(_0x199817,_0x3ed859,_0x588085){return db[_0xe134('0xe1')][_0xe134('0x75')]({'where':{'id':_0x199817[_0xe134('0xc9')]['id']}})[_0xe134('0x20')](handleEntityNotFound(_0x3ed859,null))['then'](function(_0x1f12d5){if(_0x1f12d5){return _0x1f12d5[_0xe134('0x118')](_0x199817['body']['ids'],_[_0xe134('0x119')](_0x199817[_0xe134('0x3c')],[_0xe134('0x11a'),'id'])||{});}})[_0xe134('0x20')](respondWithResult(_0x3ed859,null))['catch'](handleError(_0x3ed859,null));};exports[_0xe134('0x11b')]=function(_0x144e29,_0x412e3a,_0x3d4a50){var _0x27cb97={'raw':![],'where':{}};var _0x169857={};var _0x518e44={'count':0x0,'rows':[]};return db[_0xe134('0x50')][_0xe134('0xd0')]({'where':{'id':_0x144e29[_0xe134('0xc9')]['id']}})[_0xe134('0x20')](handleEntityNotFound(_0x412e3a,null))[_0xe134('0x20')](function(_0x176eeb){if(_0x176eeb){_0x169857['model']=_[_0xe134('0x54')](db['ChatMessage'][_0xe134('0xca')]);_0x169857[_0xe134('0x53')]=_[_0xe134('0x54')](_0x144e29[_0xe134('0x53')]);_0x169857[_0xe134('0x55')]=_[_0xe134('0x56')](_0x169857['model'],_0x169857[_0xe134('0x53')]);_0x27cb97[_0xe134('0x57')]=_[_0xe134('0x56')](_0x169857[_0xe134('0x52')],qs[_0xe134('0x58')](_0x144e29[_0xe134('0x53')][_0xe134('0x58')]));_0x27cb97[_0xe134('0x57')]=_0x27cb97[_0xe134('0x57')][_0xe134('0x59')]?_0x27cb97[_0xe134('0x57')]:_0x169857[_0xe134('0x52')];if(!_0x144e29['query'][_0xe134('0x5a')](_0xe134('0x11c'))){_0x27cb97[_0xe134('0x2e')]=qs['limit'](_0x144e29[_0xe134('0x53')][_0xe134('0x2e')]);_0x27cb97[_0xe134('0x31')]=qs[_0xe134('0x31')](_0x144e29[_0xe134('0x53')][_0xe134('0x31')]);}_0x27cb97[_0xe134('0x5b')]=qs[_0xe134('0x5c')](_0x144e29[_0xe134('0x53')]['sort']);_0x27cb97[_0xe134('0x5d')]=qs[_0xe134('0x55')](_[_0xe134('0x11d')](_0x144e29[_0xe134('0x53')],_0x169857[_0xe134('0x55')]));_0x27cb97[_0xe134('0x5d')][_0xe134('0xc5')]=_0x176eeb['id'];if(_0x144e29[_0xe134('0x53')][_0xe134('0x96')]){_0x27cb97[_0xe134('0x5d')]=_[_0xe134('0x3b')](_0x27cb97[_0xe134('0x5d')],{'$or':_[_0xe134('0x40')](_0x27cb97[_0xe134('0x57')],function(_0x56fac2){var _0x467f51={};_0x467f51[_0x56fac2]={'$like':'%'+_0x144e29[_0xe134('0x53')][_0xe134('0x96')]+'%'};return _0x467f51;})});}if(_0x144e29['query'][_0xe134('0x11e')]){var _0x581df7=_0x144e29[_0xe134('0x53')][_0xe134('0x11e')][_0xe134('0x44')](',');var _0x12de24={};_0x12de24[_0x581df7[0x0]]={'$gte':moment(_0x581df7[0x1])[_0xe134('0xfd')](_0xe134('0x11f'))};_0x27cb97[_0xe134('0x5d')]=_[_0xe134('0x3b')](_0x27cb97[_0xe134('0x5d')],_0x12de24);}_0x27cb97=_['merge']({},_0x27cb97,_0x144e29['options']);return db[_0xe134('0xe1')][_0xe134('0x30')]({'where':_0x27cb97[_0xe134('0x5d')]})[_0xe134('0x20')](function(_0x3d0651){_0x518e44[_0xe134('0x30')]=_0x3d0651;if(_0x144e29[_0xe134('0x53')][_0xe134('0xcb')]){_0x27cb97[_0xe134('0xcc')]=[{'all':!![]}];}return db[_0xe134('0xe1')][_0xe134('0x120')](_0x27cb97);})['then'](function(_0x2579b3){_0x518e44[_0xe134('0x121')]=_0x2579b3;return _0x518e44;});}})[_0xe134('0x20')](respondWithFilteredResult(_0x412e3a,_0x27cb97))['catch'](handleError(_0x412e3a,null));};exports[_0xe134('0x122')]=function(_0x4a6b6a,_0x10bb48,_0x31fd6b){var _0x1cbd36={'where':{}},_0x3af1dc={},_0x5b0d4f={'count':0x0,'rows':[]};return db[_0xe134('0x50')][_0xe134('0xd0')]({'where':{'id':_0x4a6b6a[_0xe134('0xc9')]['id']}})[_0xe134('0x20')](handleEntityNotFound(_0x10bb48,null))['then'](function(_0x2d5037){if(_0x2d5037){_0x3af1dc[_0xe134('0x52')]=_['keys'](db[_0xe134('0xe1')][_0xe134('0xca')]);_0x3af1dc[_0xe134('0x53')]=_['keys'](_0x4a6b6a[_0xe134('0x53')]);_0x3af1dc[_0xe134('0x55')]=_[_0xe134('0x56')](_0x3af1dc[_0xe134('0x52')],_0x3af1dc[_0xe134('0x53')]);_0x1cbd36[_0xe134('0x57')]=_['intersection'](_0x3af1dc[_0xe134('0x52')],qs[_0xe134('0x58')](_0x4a6b6a[_0xe134('0x53')][_0xe134('0x58')]));_0x1cbd36[_0xe134('0x57')]=_0x1cbd36[_0xe134('0x57')][_0xe134('0x59')]?_0x1cbd36[_0xe134('0x57')]:_0x3af1dc[_0xe134('0x52')];if(!_0x4a6b6a['query'][_0xe134('0x5a')]('nolimit')){_0x1cbd36[_0xe134('0x2e')]=qs[_0xe134('0x2e')](_0x4a6b6a[_0xe134('0x53')][_0xe134('0x2e')]);_0x1cbd36[_0xe134('0x31')]=qs['offset'](_0x4a6b6a[_0xe134('0x53')]['offset']);}_0x1cbd36[_0xe134('0x5b')]=qs[_0xe134('0x5c')](_0x4a6b6a[_0xe134('0x53')][_0xe134('0x5c')]);_0x1cbd36['where']=qs['filters'](_[_0xe134('0x11d')](_0x4a6b6a[_0xe134('0x53')],_0x3af1dc[_0xe134('0x55')]));_0x1cbd36['where'][_0xe134('0xc5')]=_0x2d5037['id'];if(_0x4a6b6a['query'][_0xe134('0x96')]){_0x1cbd36[_0xe134('0x5d')]=_[_0xe134('0x3b')](_0x1cbd36[_0xe134('0x5d')],{'$or':_[_0xe134('0x40')](_0x1cbd36[_0xe134('0x57')],function(_0x5857d6){var _0x1ebc6a={};_0x1ebc6a[_0x5857d6]={'$like':'%'+_0x4a6b6a['query'][_0xe134('0x96')]+'%'};return _0x1ebc6a;})});}_0x1cbd36[_0xe134('0x5d')][_0xe134('0x108')]=![];if(_0x4a6b6a[_0xe134('0x53')]['id']){_0x1cbd36[_0xe134('0x5d')]['id']={'$gt':_0x4a6b6a['query']['id']};}_0x1cbd36=_[_0xe134('0x3b')]({},_0x1cbd36,_0x4a6b6a[_0xe134('0x123')]);return db[_0xe134('0xe1')][_0xe134('0x30')]({'where':_0x1cbd36['where']})[_0xe134('0x20')](function(_0x4171b5){_0x5b0d4f[_0xe134('0x30')]=_0x4171b5;_0x1cbd36[_0xe134('0xcc')]=[];if(_0x4a6b6a[_0xe134('0x53')][_0xe134('0x124')]){_0x1cbd36[_0xe134('0xcc')][_0xe134('0xc6')]({'model':db[_0xe134('0xfc')],'as':_0xe134('0xfc'),'attributes':['id',_0xe134('0x41'),_0xe134('0x125')]});}if(_0x4a6b6a['query'][_0xe134('0xcb')]){_0x1cbd36[_0xe134('0xcc')]=[{'all':!![]}];}return db[_0xe134('0xe1')]['findAll'](_0x1cbd36);})[_0xe134('0x20')](function(_0xc2229e){_0x5b0d4f[_0xe134('0x121')]=_0xc2229e;return _0x5b0d4f;});}})['then'](respondWithFilteredResult(_0x10bb48,_0x1cbd36))[_0xe134('0x2a')](handleError(_0x10bb48,null));};exports[_0xe134('0x126')]=function(_0xd807ef,_0x2482f4,_0x3f2502){return db[_0xe134('0x50')]['find']({'where':{'id':_0xd807ef[_0xe134('0xc9')]['id']}})[_0xe134('0x20')](handleEntityNotFound(_0x2482f4,null))[_0xe134('0x20')](function(_0x56a607){if(_0x56a607){return _0x56a607[_0xe134('0x127')](_0xd807ef['body'][_0xe134('0x11a')],_['omit'](_0xd807ef[_0xe134('0x3c')],[_0xe134('0x11a'),'id'])||{})[_0xe134('0x128')](function(){return db['Tag'][_0xe134('0x120')]({'attributes':['id',_0xe134('0x39'),_0xe134('0x60')],'where':{'id':_0xd807ef[_0xe134('0x3c')]['ids']}});})[_0xe134('0x20')](function(_0x26cd13){socket[_0xe134('0x129')](_0xe134('0x12a'),{'id':Number(_0xd807ef[_0xe134('0xc9')]['id']),'tags':_0x26cd13||[]});return{'id':Number(_0xd807ef[_0xe134('0xc9')]['id']),'tags':_0x26cd13||[]};});}})['then'](respondWithResult(_0x2482f4,null))[_0xe134('0x2a')](handleError(_0x2482f4,null));};exports['removeTags']=function(_0x3be256,_0x116ab7,_0x1cc11e){return db[_0xe134('0x50')][_0xe134('0x75')]({'where':{'id':_0x3be256[_0xe134('0xc9')]['id']}})[_0xe134('0x20')](handleEntityNotFound(_0x116ab7,null))[_0xe134('0x20')](function(_0x56d4ab){if(_0x56d4ab){return _0x56d4ab['removeTags'](_0x3be256[_0xe134('0x53')][_0xe134('0x11a')]);}})[_0xe134('0x20')](respondWithStatusCode(_0x116ab7,null))['catch'](handleError(_0x116ab7,null));};exports[_0xe134('0xf6')]=function(_0x3fac6a,_0xa8c5d5){var _0xe729fd=moment()[_0xe134('0x12b')]()[_0xe134('0xac')]();var _0xe69263=path['join'](config[_0xe134('0xf3')],_0xe134('0x12c'),_0xe134('0x12d'),'tmp');var _0x33353f=path['join'](config[_0xe134('0xf3')],_0xe134('0x12c'),_0xe134('0x12d'),_0xe134('0x12e'));var _0x45be1c=path[_0xe134('0xf2')](_0xe69263,_0xe729fd);var _0x5cf266=util[_0xe134('0xfd')]('transcript-%d-%s.zip',_0x3fac6a['params']['id'],_0xe729fd);var _0x5617f4=path[_0xe134('0xf2')](_0xe69263,_0x5cf266);var _0xb46229=[];_0xb46229[_0xe134('0xc6')]({'model':db[_0xe134('0xfc')],'as':'User','attributes':['id',_0xe134('0x41')],'raw':!![]});_0xb46229['push']({'model':db[_0xe134('0xe5')],'as':_0xe134('0x7a'),'attributes':['id','firstName',_0xe134('0x12f')],'raw':!![]});if(_0x3fac6a[_0xe134('0x53')][_0xe134('0x12e')]){_0xb46229[_0xe134('0xc6')]({'model':db[_0xe134('0xef')],'as':_0xe134('0xef'),'raw':!![]});}var _0x5dab5d=[{'model':db[_0xe134('0xe1')],'as':_0xe134('0xfb'),'attributes':['id',_0xe134('0x3c'),_0xe134('0x130'),'direction',_0xe134('0x108'),'read'],'include':_0xb46229}];_0x5dab5d[_0xe134('0xc6')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xe134('0x39')]});_0x5dab5d[_0xe134('0xc6')]({'model':db['User'],'as':_0xe134('0x131'),'attributes':['id','fullname']});return db['ChatInteraction']['find']({'where':{'id':_0x3fac6a[_0xe134('0xc9')]['id']},'include':_0x5dab5d})['then'](handleEntityNotFound(_0xa8c5d5,null))[_0xe134('0x20')](function(_0x2942f7){if(_0x2942f7){var _0x1d68f8=_0x2942f7[_0xe134('0x132')]({'plain':!![]});fs[_0xe134('0x133')](_0x45be1c);var _0x432734={'channel':_0xe134('0x134'),'account':_0x1d68f8['Account']['name'],'agent':_0x1d68f8[_0xe134('0x131')]?_0x1d68f8[_0xe134('0x131')][_0xe134('0x41')]:_0xe134('0x135'),'createdAt':moment(_0x1d68f8['createdAt'])[_0xe134('0xfd')](_0xe134('0x11f'))[_0xe134('0xac')](),'closedAt':_0x1d68f8[_0xe134('0x4a')]?moment(_0x1d68f8[_0xe134('0x136')])['format'](_0xe134('0x11f'))['toString']():'','disposition':_0x1d68f8[_0xe134('0x4d')],'chatInfo':{'browser':_0x1d68f8[_0xe134('0x137')],'os':_0x1d68f8[_0xe134('0x138')],'referer':_0x1d68f8[_0xe134('0x139')],'customerIp':_0x1d68f8[_0xe134('0x13a')],'customerPort':_0x1d68f8[_0xe134('0x13b')]?_0x1d68f8[_0xe134('0x13b')]:'N.A.'},'messages':_(_0x1d68f8[_0xe134('0xfb')])[_0xe134('0x13c')]()['filter']({'secret':![]})[_0xe134('0x40')](function(_0x4539c8){if(_0x4539c8['Attachment']){var _0x353be6=path[_0xe134('0xf2')](_0x33353f,_0x4539c8[_0xe134('0xef')][_0xe134('0x13d')]);if(fs['existsSync'](_0x353be6)){fs[_0xe134('0x13e')](_0x353be6)[_0xe134('0x13f')](fs['createWriteStream'](path[_0xe134('0xf2')](_0x45be1c,_0x4539c8[_0xe134('0xef')][_0xe134('0x13d')])));}}return{'date':moment(_0x4539c8[_0xe134('0x130')])['format'](_0xe134('0x11f'))[_0xe134('0xac')](),'sender':_0x4539c8[_0xe134('0x107')]===_0xe134('0xe0')?_0x4539c8['User']?_0x4539c8[_0xe134('0xfc')]['fullname']:'System':_0x4539c8[_0xe134('0x7a')][_0xe134('0x140')]+(_0x4539c8[_0xe134('0x7a')][_0xe134('0x12f')]?'\x20'+_0x4539c8[_0xe134('0x7a')][_0xe134('0x12f')]:''),'body':_0x4539c8['Attachment']?_0x4539c8['Attachment']['basename']:_0x4539c8[_0xe134('0x3c')],'direction':_0x4539c8['direction']===_0xe134('0xe0')?'A':'C','secret':_0x4539c8['secret'],'read':_0x4539c8[_0xe134('0x91')],'attachment':_0x4539c8['Attachment']};})['value']()};return ejs[_0xe134('0x141')](path[_0xe134('0xf2')](config[_0xe134('0xf3')],'server','views','downloadInteraction.ejs'),{'interaction':_0x432734})[_0xe134('0x20')](function(_0x13e009){var _0x617656=path['join'](_0x45be1c,_0xe134('0x142')+_0x1d68f8['id']+'-'+_0xe729fd+_0xe134('0x143'));var _0x372866={'path':_0x617656,'channel':_0xe134('0x134'),'interactionId':_0x1d68f8['id']};return pdf[_0xe134('0x144')](_0x13e009,_0x372866);})[_0xe134('0x20')](function(){return new BPromise(function(_0x13ba47,_0x56d788){zipdir(_0x45be1c,{'saveTo':_0x5617f4},function(_0x1bd65,_0xb5d665){if(_0x1bd65)return _0x56d788(_0x1bd65);return _0x13ba47(_0xb5d665);});})[_0xe134('0x20')](function(){return new BPromise(function(_0x23e8dd,_0x52f5a6){rimraf(_0x45be1c,function(_0x50c54d){if(_0x50c54d)_0x52f5a6(_0x50c54d);return _0x23e8dd();});});})[_0xe134('0x20')](function(){return _0xa8c5d5[_0xe134('0xf6')](_0x5617f4,_0x5cf266,function(_0x104206){if(_0x104206){console[_0xe134('0x145')]('err',_0x104206);}else{fs['unlinkSync'](_0x5617f4);}});});});}else{return _0xa8c5d5[_0xe134('0x37')](0xc8);}})[_0xe134('0x2a')](handleError(_0xa8c5d5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1b98b3a..7855a7c 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 _0x5ac7=['length','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x1292fa,_0x3d64a4){var _0x5e4457=function(_0x37e1df){while(--_0x37e1df){_0x1292fa['push'](_0x1292fa['shift']());}};_0x5e4457(++_0x3d64a4);}(_0x5ac7,0x1ea));var _0x75ac=function(_0x1152de,_0x19aeff){_0x1152de=_0x1152de-0x0;var _0x39c275=_0x5ac7[_0x1152de];return _0x39c275;};'use strict';var EventEmitter=require(_0x75ac('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x75ac('0x1')];var ChatMessage=require(_0x75ac('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x75ac('0x3')](0x0);var events={'afterCreate':_0x75ac('0x4'),'afterUpdate':_0x75ac('0x5'),'afterDestroy':_0x75ac('0x6')};function emitEvent(_0x1d0c0f){return function(_0x2e6dcb,_0xc3cc96,_0x58b132){_0x2e6dcb[_0x75ac('0x7')]({'attributes':['id'],'raw':!![]})[_0x75ac('0x8')](function(_0x347152){_0x2e6dcb['setDataValue'](_0x75ac('0x9'),_0x347152[_0x75ac('0xa')](function(_0x243867){return{'id':_0x243867['id']};}));return ChatMessage[_0x75ac('0xb')]({'where':{'ChatInteractionId':_0x2e6dcb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x75ac('0x8')](function(_0x513fe7){_0x2e6dcb[_0x75ac('0xc')](_0x75ac('0xd'),_0x513fe7[_0x75ac('0xe')]);ChatInteractionEvents['emit'](_0x1d0c0f+':'+_0x2e6dcb['id'],_0x2e6dcb);ChatInteractionEvents['emit'](_0x1d0c0f,_0x2e6dcb);_0x58b132(null);})[_0x75ac('0xf')](_0x58b132(null));};}for(var e in events){if(events[_0x75ac('0x10')](e)){var event=events[e];ChatInteraction[_0x75ac('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x3fd5=['setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','Users','findAll','then'];(function(_0x14a78e,_0x2e75d6){var _0x46eeef=function(_0x295683){while(--_0x295683){_0x14a78e['push'](_0x14a78e['shift']());}};_0x46eeef(++_0x2e75d6);}(_0x3fd5,0xb1));var _0x53fd=function(_0x492f53,_0x11b1a7){_0x492f53=_0x492f53-0x0;var _0x53ed21=_0x3fd5[_0x492f53];return _0x53ed21;};'use strict';var EventEmitter=require(_0x53fd('0x0'));var ChatInteraction=require(_0x53fd('0x1'))['db'][_0x53fd('0x2')];var ChatMessage=require(_0x53fd('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x53fd('0x3')](0x0);var events={'afterCreate':_0x53fd('0x4'),'afterUpdate':'update','afterDestroy':_0x53fd('0x5')};function emitEvent(_0x3827c1){return function(_0x3670e6,_0x4ee87b,_0x5cb997){_0x3670e6[_0x53fd('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4660b5){_0x3670e6['setDataValue'](_0x53fd('0x7'),_0x4660b5['map'](function(_0x5bd6da){return{'id':_0x5bd6da['id']};}));return ChatMessage[_0x53fd('0x8')]({'where':{'ChatInteractionId':_0x3670e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53fd('0x9')](function(_0x333424){_0x3670e6[_0x53fd('0xa')](_0x53fd('0xb'),_0x333424[_0x53fd('0xc')]);ChatInteractionEvents[_0x53fd('0xd')](_0x3827c1+':'+_0x3670e6['id'],_0x3670e6);ChatInteractionEvents[_0x53fd('0xd')](_0x3827c1,_0x3670e6);_0x5cb997(null);})['catch'](_0x5cb997(null));};}for(var e in events){if(events[_0x53fd('0xe')](e)){var event=events[e];ChatInteraction[_0x53fd('0xf')](e,emitEvent(event));}}module[_0x53fd('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index abddc1b..1da1d0d 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 _0x9265=['util','moment','bluebird','request-promise','path','rimraf','exports','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9265,0x185));var _0x5926=function(_0x9a089f,_0x206a3e){_0x9a089f=_0x9a089f-0x0;var _0x2728eb=_0x9265[_0x9a089f];return _0x2728eb;};'use strict';var _=require(_0x5926('0x0'));var util=require(_0x5926('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5926('0x2'));var BPromise=require(_0x5926('0x3'));var rp=require(_0x5926('0x4'));var fs=require('fs');var path=require(_0x5926('0x5'));var rimraf=require(_0x5926('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x5926('0x7')]=function(_0xd8a85d,_0x424f40){return _0xd8a85d['define'](_0x5926('0x8'),attributes,{'tableName':_0x5926('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18a4c0,_0x1a083b,_0x8ae35f){if(_0x18a4c0[_0x5926('0xa')]('closed')){_0x18a4c0['closedAt']=moment()[_0x5926('0xb')](_0x5926('0xc'));}_0x8ae35f(null,_0x18a4c0);}},'charset':_0x5926('0xd'),'collate':_0x5926('0xe')});}; \ No newline at end of file +var _0xd31e=['define','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xd31e,0x1d7));var _0xed31=function(_0x32b8ab,_0x46590e){_0x32b8ab=_0x32b8ab-0x0;var _0x170cb7=_0xd31e[_0x32b8ab];return _0x170cb7;};'use strict';var _=require('lodash');var util=require(_0xed31('0x0'));var logger=require(_0xed31('0x1'))(_0xed31('0x2'));var moment=require(_0xed31('0x3'));var BPromise=require('bluebird');var rp=require(_0xed31('0x4'));var fs=require('fs');var path=require(_0xed31('0x5'));var rimraf=require(_0xed31('0x6'));var config=require(_0xed31('0x7'));var attributes=require(_0xed31('0x8'));module['exports']=function(_0xd168ba,_0x2ac33c){return _0xd168ba[_0xed31('0x9')](_0xed31('0xa'),attributes,{'tableName':_0xed31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c97d2,_0x55d632,_0xb797f3){if(_0x1c97d2['changed'](_0xed31('0xc'))){_0x1c97d2['closedAt']=moment()[_0xed31('0xd')](_0xed31('0xe'));}_0xb797f3(null,_0x1c97d2);}},'charset':_0xed31('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2d025e1..9016713 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 _0x65b6=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','ChatInteraction','update','options','raw','where','limit','UpdateChatInteraction','catch','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x65b6,0x82));var _0x665b=function(_0x1a2635,_0x2a33a8){_0x1a2635=_0x1a2635-0x0;var _0x2ccd92=_0x65b6[_0x1a2635];return _0x2ccd92;};'use strict';var _=require(_0x665b('0x0'));var util=require(_0x665b('0x1'));var moment=require(_0x665b('0x2'));var BPromise=require('bluebird');var rs=require(_0x665b('0x3'));var fs=require('fs');var Redis=require(_0x665b('0x4'));var db=require(_0x665b('0x5'))['db'];var utils=require(_0x665b('0x6'));var logger=require(_0x665b('0x7'))(_0x665b('0x8'));var config=require(_0x665b('0x9'));var jayson=require(_0x665b('0xa'));var client=jayson['client'][_0x665b('0xb')]({'port':0x232a});config[_0x665b('0xc')]=_[_0x665b('0xd')](config[_0x665b('0xc')],{'host':_0x665b('0xe'),'port':0x18eb});var socket=require(_0x665b('0xf'))(new Redis(config[_0x665b('0xc')]));require(_0x665b('0x10'))[_0x665b('0x11')](socket);function respondWithRpcPromise(_0x56bc77,_0x51d2b4,_0x6cf369){return new BPromise(function(_0x2bab5c,_0xf9cd50){return client[_0x665b('0x12')](_0x56bc77,_0x6cf369)[_0x665b('0x13')](function(_0x4689bd){logger[_0x665b('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x51d2b4,_0x665b('0x15'));logger[_0x665b('0x16')](_0x665b('0x17'),_0x51d2b4,_0x665b('0x15'),JSON[_0x665b('0x18')](_0x4689bd));if(_0x4689bd[_0x665b('0x19')]){if(_0x4689bd['error'][_0x665b('0x1a')]===0x1f4){logger[_0x665b('0x19')](_0x665b('0x1b'),_0x51d2b4,_0x4689bd[_0x665b('0x19')][_0x665b('0x1c')]);return _0xf9cd50(_0x4689bd['error']['message']);}logger[_0x665b('0x19')](_0x665b('0x1b'),_0x51d2b4,_0x4689bd[_0x665b('0x19')]['message']);return _0x2bab5c(_0x4689bd[_0x665b('0x19')][_0x665b('0x1c')]);}else{logger[_0x665b('0x14')](_0x665b('0x1b'),_0x51d2b4,_0x665b('0x15'));_0x2bab5c(_0x4689bd[_0x665b('0x1d')]['message']);}})['catch'](function(_0x51cdec){logger[_0x665b('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x51d2b4,_0x51cdec);_0xf9cd50(_0x51cdec);});});}exports['UpdateChatInteraction']=function(_0x2b1f50){var _0x123d89=this;return new Promise(function(_0x14ff02,_0x435e27){return db[_0x665b('0x1e')][_0x665b('0x1f')](_0x2b1f50['body'],{'raw':_0x2b1f50[_0x665b('0x20')]?_0x2b1f50[_0x665b('0x20')][_0x665b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1f50[_0x665b('0x20')]?_0x2b1f50[_0x665b('0x20')][_0x665b('0x22')]||null:null,'attributes':_0x2b1f50[_0x665b('0x20')]?_0x2b1f50[_0x665b('0x20')]['attributes']||null:null,'limit':_0x2b1f50[_0x665b('0x20')]?_0x2b1f50[_0x665b('0x20')][_0x665b('0x23')]||null:null})[_0x665b('0x13')](function(_0x50708c){logger[_0x665b('0x14')](_0x665b('0x24'),_0x2b1f50);logger[_0x665b('0x16')](_0x665b('0x24'),_0x2b1f50,JSON[_0x665b('0x18')](_0x50708c));_0x14ff02(_0x50708c);})[_0x665b('0x25')](function(_0x32206c){logger['error'](_0x665b('0x24'),_0x32206c[_0x665b('0x1c')],_0x2b1f50);_0x435e27(_0x123d89['error'](0x1f4,_0x32206c[_0x665b('0x1c')]));});});};exports['AddTagsToChatInteraction']=function(_0x3433c9){return new Promise(function(_0xa5f9db,_0x49c5f9){return db[_0x665b('0x1e')][_0x665b('0x26')]({'where':_0x3433c9[_0x665b('0x20')]?_0x3433c9[_0x665b('0x20')][_0x665b('0x22')]||null:null})[_0x665b('0x13')](function(_0x2272c5){if(_0x2272c5){return _0x2272c5[_0x665b('0x27')](_0x3433c9['body'][_0x665b('0x28')],_[_0x665b('0x29')](_0x3433c9['body'],[_0x665b('0x28'),'id'])||{});}})[_0x665b('0x2a')](function(_0x429801){logger[_0x665b('0x14')](_0x665b('0x2b'),_0x3433c9);logger[_0x665b('0x16')]('AddTags',_0x3433c9,JSON[_0x665b('0x18')](_0x429801));_0xa5f9db(_0x429801);})[_0x665b('0x25')](function(_0x1092cb){logger[_0x665b('0x19')](_0x665b('0x2b'),_0x1092cb[_0x665b('0x1c')],_0x3433c9);_0x49c5f9(_this['error'](0x1f4,_0x1092cb[_0x665b('0x1c')]));});});}; \ No newline at end of file +var _0xee6b=['where','then','stringify','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','update','options'];(function(_0x366317,_0x399d68){var _0x48f401=function(_0x13472c){while(--_0x13472c){_0x366317['push'](_0x366317['shift']());}};_0x48f401(++_0x399d68);}(_0xee6b,0xbe));var _0xbee6=function(_0x542c11,_0x35d5df){_0x542c11=_0x542c11-0x0;var _0xd5ba30=_0xee6b[_0x542c11];return _0xd5ba30;};'use strict';var _=require('lodash');var util=require(_0xbee6('0x0'));var moment=require(_0xbee6('0x1'));var BPromise=require(_0xbee6('0x2'));var rs=require(_0xbee6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbee6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbee6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee6('0x6'));var client=jayson['client'][_0xbee6('0x7')]({'port':0x232a});config[_0xbee6('0x8')]=_['defaults'](config[_0xbee6('0x8')],{'host':_0xbee6('0x9'),'port':0x18eb});var socket=require(_0xbee6('0xa'))(new Redis(config[_0xbee6('0x8')]));require(_0xbee6('0xb'))[_0xbee6('0xc')](socket);function respondWithRpcPromise(_0x476f21,_0x118bb2,_0xa2d9d4){return new BPromise(function(_0x24725d,_0x379977){return client['request'](_0x476f21,_0xa2d9d4)['then'](function(_0x477d92){logger[_0xbee6('0xd')](_0xbee6('0xe'),_0x118bb2,'request\x20sent');logger[_0xbee6('0xf')](_0xbee6('0x10'),_0x118bb2,_0xbee6('0x11'),JSON['stringify'](_0x477d92));if(_0x477d92['error']){if(_0x477d92[_0xbee6('0x12')][_0xbee6('0x13')]===0x1f4){logger[_0xbee6('0x12')](_0xbee6('0xe'),_0x118bb2,_0x477d92[_0xbee6('0x12')][_0xbee6('0x14')]);return _0x379977(_0x477d92[_0xbee6('0x12')]['message']);}logger['error'](_0xbee6('0xe'),_0x118bb2,_0x477d92[_0xbee6('0x12')][_0xbee6('0x14')]);return _0x24725d(_0x477d92[_0xbee6('0x12')][_0xbee6('0x14')]);}else{logger[_0xbee6('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x118bb2,_0xbee6('0x11'));_0x24725d(_0x477d92[_0xbee6('0x15')][_0xbee6('0x14')]);}})[_0xbee6('0x16')](function(_0x4c19b9){logger['error'](_0xbee6('0xe'),_0x118bb2,_0x4c19b9);_0x379977(_0x4c19b9);});});}exports[_0xbee6('0x17')]=function(_0x2b5fea){var _0x59f013=this;return new Promise(function(_0x47b723,_0x2d2d9b){return db['ChatInteraction'][_0xbee6('0x18')](_0x2b5fea['body'],{'raw':_0x2b5fea[_0xbee6('0x19')]?_0x2b5fea[_0xbee6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5fea[_0xbee6('0x19')]?_0x2b5fea[_0xbee6('0x19')][_0xbee6('0x1a')]||null:null,'attributes':_0x2b5fea[_0xbee6('0x19')]?_0x2b5fea[_0xbee6('0x19')]['attributes']||null:null,'limit':_0x2b5fea[_0xbee6('0x19')]?_0x2b5fea[_0xbee6('0x19')]['limit']||null:null})[_0xbee6('0x1b')](function(_0x29c5bc){logger[_0xbee6('0xd')](_0xbee6('0x17'),_0x2b5fea);logger[_0xbee6('0xf')](_0xbee6('0x17'),_0x2b5fea,JSON[_0xbee6('0x1c')](_0x29c5bc));_0x47b723(_0x29c5bc);})['catch'](function(_0x15ab19){logger[_0xbee6('0x12')](_0xbee6('0x17'),_0x15ab19[_0xbee6('0x14')],_0x2b5fea);_0x2d2d9b(_0x59f013[_0xbee6('0x12')](0x1f4,_0x15ab19[_0xbee6('0x14')]));});});};exports[_0xbee6('0x1d')]=function(_0x29b8a4){return new Promise(function(_0x5c4fa0,_0x41ad42){return db['ChatInteraction'][_0xbee6('0x1e')]({'where':_0x29b8a4[_0xbee6('0x19')]?_0x29b8a4[_0xbee6('0x19')][_0xbee6('0x1a')]||null:null})['then'](function(_0x65045b){if(_0x65045b){return _0x65045b['addTags'](_0x29b8a4[_0xbee6('0x1f')][_0xbee6('0x20')],_[_0xbee6('0x21')](_0x29b8a4[_0xbee6('0x1f')],['ids','id'])||{});}})[_0xbee6('0x22')](function(_0x212075){logger[_0xbee6('0xd')](_0xbee6('0x23'),_0x29b8a4);logger[_0xbee6('0xf')](_0xbee6('0x23'),_0x29b8a4,JSON[_0xbee6('0x1c')](_0x212075));_0x5c4fa0(_0x212075);})[_0xbee6('0x16')](function(_0x48fd47){logger['error'](_0xbee6('0x23'),_0x48fd47[_0xbee6('0x14')],_0x29b8a4);_0x41ad42(_this[_0xbee6('0x12')](0x1f4,_0x48fd47[_0xbee6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a893acd..9e44d76 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 _0x52cb=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x104662,_0x53a7a7){var _0x19cba7=function(_0x5a76c0){while(--_0x5a76c0){_0x104662['push'](_0x104662['shift']());}};_0x19cba7(++_0x53a7a7);}(_0x52cb,0x1a2));var _0xb52c=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x52cb[_0x218972];return _0x1bb1a8;};'use strict';var ChatInteractionEvents=require(_0xb52c('0x0'));var events=[_0xb52c('0x1'),'remove',_0xb52c('0x2')];function createListener(_0x3f7146,_0xc000d){return function(_0x1cc265){_0xc000d['emit'](_0x3f7146,_0x1cc265);};}function removeListener(_0x2fe947,_0x35a92d){return function(){ChatInteractionEvents[_0xb52c('0x3')](_0x2fe947,_0x35a92d);};}exports[_0xb52c('0x4')]=function(_0x304783){for(var _0x30fd4f=0x0,_0x2fe837=events[_0xb52c('0x5')];_0x30fd4f<_0x2fe837;_0x30fd4f++){var _0x2cbdf1=events[_0x30fd4f];var _0x14591f=createListener(_0xb52c('0x6')+_0x2cbdf1,_0x304783);ChatInteractionEvents['on'](_0x2cbdf1,_0x14591f);}}; \ No newline at end of file +var _0x62b9=['./chatInteraction.events','save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0x62b9,0x130));var _0x962b=function(_0x5aa3d3,_0x158adb){_0x5aa3d3=_0x5aa3d3-0x0;var _0x402b3f=_0x62b9[_0x5aa3d3];return _0x402b3f;};'use strict';var ChatInteractionEvents=require(_0x962b('0x0'));var events=[_0x962b('0x1'),_0x962b('0x2'),_0x962b('0x3')];function createListener(_0x5e31af,_0x5ba207){return function(_0x31e414){_0x5ba207[_0x962b('0x4')](_0x5e31af,_0x31e414);};}function removeListener(_0x3f8b4a,_0x381ea4){return function(){ChatInteractionEvents[_0x962b('0x5')](_0x3f8b4a,_0x381ea4);};}exports['register']=function(_0x60794){for(var _0x439523=0x0,_0x432365=events[_0x962b('0x6')];_0x439523<_0x432365;_0x439523++){var _0x44fe4e=events[_0x439523];var _0x19241c=createListener(_0x962b('0x7')+_0x44fe4e,_0x60794);ChatInteractionEvents['on'](_0x44fe4e,_0x19241c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9fd8dc0..9ad655e 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 _0xde1d=['/:id/attachment_download','/:id/messages','getMyMessages','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','/:id','tracked','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','isChatInteractionAuthorized','show'];(function(_0x40e13e,_0x376d13){var _0x5db39e=function(_0x2dc3f6){while(--_0x2dc3f6){_0x40e13e['push'](_0x40e13e['shift']());}};_0x5db39e(++_0x376d13);}(_0xde1d,0x1ef));var _0xdde1=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0xde1d[_0x133f81];return _0x2eef30;};'use strict';var multer=require(_0xdde1('0x0'));var util=require(_0xdde1('0x1'));var path=require(_0xdde1('0x2'));var timeout=require(_0xdde1('0x3'));var express=require('express');var router=express[_0xdde1('0x4')]();var fs_extra=require(_0xdde1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdde1('0x6'));var config=require(_0xdde1('0x7'));var controller=require(_0xdde1('0x8'));router['get']('/',auth[_0xdde1('0x9')](),controller[_0xdde1('0xa')]);router[_0xdde1('0xb')](_0xdde1('0xc'),auth[_0xdde1('0x9')](),controller['describe']);router[_0xdde1('0xb')]('/:id',auth[_0xdde1('0xd')](),controller[_0xdde1('0xe')]);router[_0xdde1('0xb')](_0xdde1('0xf'),auth[_0xdde1('0xd')](),controller['attachmentDownload']);router[_0xdde1('0xb')](_0xdde1('0x10'),auth[_0xdde1('0x9')](),controller['getMessages']);router[_0xdde1('0xb')]('/:id/my_messages',auth[_0xdde1('0xd')](),controller[_0xdde1('0x11')]);router[_0xdde1('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xdde1('0x12')]);router[_0xdde1('0x13')]('/',auth[_0xdde1('0x9')](),controller[_0xdde1('0x14')]);router[_0xdde1('0x13')](_0xdde1('0x15'),auth[_0xdde1('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xdde1('0x16')]({'destination':function(_0x4bcb99,_0x26cc19,_0x1268bb){_0x1268bb(null,path[_0xdde1('0x17')](config[_0xdde1('0x18')],_0xdde1('0x19')));},'filename':function(_0x41ecf5,_0x2b077d,_0x15c8fd){_0x15c8fd(null,util[_0xdde1('0x1a')]('%s-%s',Date[_0xdde1('0x1b')](),_0x2b077d[_0xdde1('0x1c')][_0xdde1('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdde1('0x13')]('/:id/attachment_upload',upload[_0xdde1('0x1e')](_0xdde1('0x1f')),controller[_0xdde1('0x20')]);router['post'](_0xdde1('0x10'),auth[_0xdde1('0xd')](),controller[_0xdde1('0x21')]);router['post'](_0xdde1('0x22'),auth[_0xdde1('0x9')](),interaction['tracked'](_0xdde1('0x23'),'chatinteraction:addtags'),controller[_0xdde1('0x24')]);router['put'](_0xdde1('0x25'),auth[_0xdde1('0x9')](),interaction[_0xdde1('0x26')](_0xdde1('0x23'),_0xdde1('0x27')),controller['update']);router[_0xdde1('0x28')](_0xdde1('0x29'),controller[_0xdde1('0x2a')]);router[_0xdde1('0x28')](_0xdde1('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xdde1('0x2c')]);router[_0xdde1('0x28')](_0xdde1('0x2d'),controller['close']);router[_0xdde1('0x2e')](_0xdde1('0x25'),auth[_0xdde1('0x9')](),interaction[_0xdde1('0x26')](_0xdde1('0x23'),_0xdde1('0x2f')),controller[_0xdde1('0x30')]);router[_0xdde1('0x2e')]('/:id/tags',auth[_0xdde1('0x9')](),controller[_0xdde1('0x31')]);module[_0xdde1('0x32')]=router; \ No newline at end of file +var _0x73fb=['single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','close','chat','destroy','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','join','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x73fb,0x7a));var _0xb73f=function(_0x57d232,_0x1eb10c){_0x57d232=_0x57d232-0x0;var _0x4c7e6d=_0x73fb[_0x57d232];return _0x4c7e6d;};'use strict';var multer=require(_0xb73f('0x0'));var util=require('util');var path=require(_0xb73f('0x1'));var timeout=require(_0xb73f('0x2'));var express=require(_0xb73f('0x3'));var router=express[_0xb73f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb73f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb73f('0x6'));var controller=require(_0xb73f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb73f('0x8')]);router[_0xb73f('0x9')](_0xb73f('0xa'),auth[_0xb73f('0xb')](),controller[_0xb73f('0xc')]);router[_0xb73f('0x9')](_0xb73f('0xd'),auth[_0xb73f('0xe')](),controller[_0xb73f('0xf')]);router['get']('/:id/attachment_download',auth[_0xb73f('0xe')](),controller[_0xb73f('0x10')]);router['get'](_0xb73f('0x11'),auth[_0xb73f('0xb')](),controller[_0xb73f('0x12')]);router[_0xb73f('0x9')](_0xb73f('0x13'),auth[_0xb73f('0xe')](),controller[_0xb73f('0x14')]);router[_0xb73f('0x9')](_0xb73f('0x15'),auth[_0xb73f('0xb')](),controller[_0xb73f('0x16')]);router['post']('/',auth[_0xb73f('0xb')](),controller[_0xb73f('0x17')]);router[_0xb73f('0x18')](_0xb73f('0x19'),auth[_0xb73f('0xb')](),controller[_0xb73f('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20eedb,_0x576829,_0x24ef90){_0x24ef90(null,path[_0xb73f('0x1b')](config['root'],_0xb73f('0x1c')));},'filename':function(_0x514e44,_0x1591a7,_0x3b0754){_0x3b0754(null,util[_0xb73f('0x1d')](_0xb73f('0x1e'),Date['now'](),_0x1591a7[_0xb73f('0x1f')][_0xb73f('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb73f('0x18')](_0xb73f('0x21'),upload[_0xb73f('0x22')](_0xb73f('0x23')),controller[_0xb73f('0x24')]);router[_0xb73f('0x18')](_0xb73f('0x11'),auth[_0xb73f('0xe')](),controller[_0xb73f('0x25')]);router['post'](_0xb73f('0x26'),auth['isAuthenticated'](),interaction[_0xb73f('0x27')]('chat',_0xb73f('0x28')),controller[_0xb73f('0x29')]);router[_0xb73f('0x2a')](_0xb73f('0xd'),auth['isAuthenticated'](),interaction[_0xb73f('0x27')]('chat',_0xb73f('0x2b')),controller['update']);router[_0xb73f('0x2a')]('/:id/custom_update',controller[_0xb73f('0x2c')]);router['put'](_0xb73f('0x2d'),auth[_0xb73f('0xe')](),controller[_0xb73f('0x2e')]);router['put']('/:id/close',controller[_0xb73f('0x2f')]);router['delete'](_0xb73f('0xd'),auth[_0xb73f('0xb')](),interaction[_0xb73f('0x27')](_0xb73f('0x30'),'chatinteraction:destroy'),controller[_0xb73f('0x31')]);router[_0xb73f('0x32')](_0xb73f('0x26'),auth['isAuthenticated'](),controller['removeTags']);module[_0xb73f('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1d11a91..d4f48be 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 _0x5fd7=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x2d7c86,_0x1d450c){var _0x4cb66b=function(_0x2366eb){while(--_0x2366eb){_0x2d7c86['push'](_0x2d7c86['shift']());}};_0x4cb66b(++_0x1d450c);}(_0x5fd7,0xbc));var _0x75fd=function(_0x3167a2,_0x4f7866){_0x3167a2=_0x3167a2-0x0;var _0x4ce01c=_0x5fd7[_0x3167a2];return _0x4ce01c;};'use strict';var Sequelize=require('sequelize');module[_0x75fd('0x0')]={'body':{'type':Sequelize[_0x75fd('0x1')](_0x75fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x75fd('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x75fd('0x4')]}}; \ No newline at end of file +var _0x35b1=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x25e9d5,_0x13e29e){var _0x33640a=function(_0x4fbafa){while(--_0x4fbafa){_0x25e9d5['push'](_0x25e9d5['shift']());}};_0x33640a(++_0x13e29e);}(_0x35b1,0x16d));var _0x135b=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x35b1[_0x4a1353];return _0x3805cc;};'use strict';var Sequelize=require(_0x135b('0x0'));module[_0x135b('0x1')]={'body':{'type':Sequelize[_0x135b('0x2')](_0x135b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x135b('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x135b('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fbff616..6191558 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 _0x37cc=['query','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','catch','keys','length','includeAll','include','find','create','body','describe','get','messages','createdAt','lastMessage','format','getUsers','agent','admin','user','fullname','role','internal','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','destroy','then','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key'];(function(_0x5bbb1e,_0x353c6a){var _0x1a4081=function(_0x206d2d){while(--_0x206d2d){_0x5bbb1e['push'](_0x5bbb1e['shift']());}};_0x1a4081(++_0x353c6a);}(_0x37cc,0x1df));var _0xc37c=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0x37cc[_0x30780e];return _0x5b9129;};'use strict';var emlformat=require(_0xc37c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc37c('0x1'));var jsonpatch=require(_0xc37c('0x2'));var rp=require(_0xc37c('0x3'));var moment=require(_0xc37c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc37c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc37c('0x6'));var csv=require(_0xc37c('0x7'));var ejs=require(_0xc37c('0x8'));var fs=require('fs');var fs_extra=require(_0xc37c('0x9'));var _=require(_0xc37c('0xa'));var squel=require(_0xc37c('0xb'));var crypto=require(_0xc37c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc37c('0x7'));var querystring=require(_0xc37c('0xd'));var Papa=require('papaparse');var Redis=require(_0xc37c('0xe'));var authService=require(_0xc37c('0xf'));var qs=require(_0xc37c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc37c('0x11'));var logger=require(_0xc37c('0x12'))(_0xc37c('0x13'));var utils=require('../../config/utils');var config=require(_0xc37c('0x14'));var licenseUtil=require(_0xc37c('0x15'));var db=require(_0xc37c('0x16'))['db'];config[_0xc37c('0x17')]=_[_0xc37c('0x18')](config['redis'],{'host':_0xc37c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc37c('0x17')]));require(_0xc37c('0x1a'))[_0xc37c('0x1b')](socket);function respondWithStatusCode(_0x4faf1d,_0x3ab678){_0x3ab678=_0x3ab678||0xcc;return function(_0x455139){if(_0x455139){return _0x4faf1d[_0xc37c('0x1c')](_0x3ab678);}return _0x4faf1d[_0xc37c('0x1d')](_0x3ab678)[_0xc37c('0x1e')]();};}function respondWithResult(_0x24756a,_0x587823){_0x587823=_0x587823||0xc8;return function(_0x72fb78){if(_0x72fb78){return _0x24756a[_0xc37c('0x1d')](_0x587823)['json'](_0x72fb78);}};}function respondWithFilteredResult(_0x18b0eb,_0x5d472d){return function(_0x532e54){if(_0x532e54){var _0x1b15b7=typeof _0x5d472d['offset']===_0xc37c('0x1f')&&typeof _0x5d472d[_0xc37c('0x20')]===_0xc37c('0x1f');var _0x3a6490=_0x532e54['count'];var _0x56c569=_0x1b15b7?0x0:_0x5d472d[_0xc37c('0x21')];var _0x5a0b7d=_0x1b15b7?_0x532e54['count']:_0x5d472d[_0xc37c('0x21')]+_0x5d472d[_0xc37c('0x20')];var _0x25afb3;if(_0x5a0b7d>=_0x3a6490){_0x5a0b7d=_0x3a6490;_0x25afb3=0xc8;}else{_0x25afb3=0xce;}_0x18b0eb[_0xc37c('0x1d')](_0x25afb3);return _0x18b0eb[_0xc37c('0x22')](_0xc37c('0x23'),_0x56c569+'-'+_0x5a0b7d+'/'+_0x3a6490)[_0xc37c('0x24')](_0x532e54);}return null;};}function patchUpdates(_0x15c9b4){return function(_0x380dce){try{jsonpatch[_0xc37c('0x25')](_0x380dce,_0x15c9b4,!![]);}catch(_0xe17e3a){return BPromise[_0xc37c('0x26')](_0xe17e3a);}return _0x380dce['save']();};}function saveUpdates(_0x15199e,_0x11af63){return function(_0x38effc){if(_0x38effc){return _0x38effc[_0xc37c('0x27')](_0x15199e)['then'](function(_0x3ccf72){return _0x3ccf72;});}return null;};}function removeEntity(_0x4b3c01,_0x3e50ac){return function(_0x4c25e8){if(_0x4c25e8){return _0x4c25e8[_0xc37c('0x28')]()[_0xc37c('0x29')](function(){_0x4b3c01[_0xc37c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x65aa43,_0x4c72f6){return function(_0x3a1cd9){if(!_0x3a1cd9){_0x65aa43[_0xc37c('0x1c')](0x194);}return _0x3a1cd9;};}function handleError(_0x23aa42,_0x2ba026){_0x2ba026=_0x2ba026||0x1f4;return function(_0x38ba9b){logger['error'](_0x38ba9b['stack']);if(_0x38ba9b[_0xc37c('0x2a')]){delete _0x38ba9b[_0xc37c('0x2a')];}_0x23aa42[_0xc37c('0x1d')](_0x2ba026)[_0xc37c('0x2b')](_0x38ba9b);};}exports[_0xc37c('0x2c')]=function(_0x32c633,_0x1add69){var _0x595f7d={},_0x1d7111={},_0x2f2b6c={'count':0x0,'rows':[]};var _0x1f1efa=_[_0xc37c('0x2d')](db[_0xc37c('0x2e')][_0xc37c('0x2f')],function(_0x200aaf){return{'name':_0x200aaf[_0xc37c('0x30')],'type':_0x200aaf[_0xc37c('0x31')][_0xc37c('0x32')]};});_0x1d7111['model']=_[_0xc37c('0x2d')](_0x1f1efa,'name');_0x1d7111[_0xc37c('0x33')]=_['keys'](_0x32c633[_0xc37c('0x33')]);_0x1d7111['filters']=_['intersection'](_0x1d7111[_0xc37c('0x34')],_0x1d7111[_0xc37c('0x33')]);_0x595f7d[_0xc37c('0x35')]=_[_0xc37c('0x36')](_0x1d7111['model'],qs[_0xc37c('0x37')](_0x32c633[_0xc37c('0x33')][_0xc37c('0x37')]));_0x595f7d[_0xc37c('0x35')]=_0x595f7d[_0xc37c('0x35')]['length']?_0x595f7d[_0xc37c('0x35')]:_0x1d7111['model'];if(!_0x32c633[_0xc37c('0x33')][_0xc37c('0x38')](_0xc37c('0x39'))){_0x595f7d['limit']=qs[_0xc37c('0x20')](_0x32c633[_0xc37c('0x33')][_0xc37c('0x20')]);_0x595f7d['offset']=qs[_0xc37c('0x21')](_0x32c633[_0xc37c('0x33')][_0xc37c('0x21')]);}_0x595f7d['order']=qs[_0xc37c('0x3a')](_0x32c633[_0xc37c('0x33')][_0xc37c('0x3a')]);_0x595f7d['where']=qs[_0xc37c('0x3b')](_[_0xc37c('0x3c')](_0x32c633[_0xc37c('0x33')],_0x1d7111[_0xc37c('0x3b')]),_0x1f1efa);if(_0x32c633[_0xc37c('0x33')][_0xc37c('0x3d')]){_0x595f7d[_0xc37c('0x3e')]=_[_0xc37c('0x3f')](_0x595f7d[_0xc37c('0x3e')],{'$or':_[_0xc37c('0x2d')](_0x1f1efa,function(_0x24d2eb){if(_0x24d2eb[_0xc37c('0x31')]!==_0xc37c('0x40')){var _0x433c71={};_0x433c71[_0x24d2eb['name']]={'$like':'%'+_0x32c633[_0xc37c('0x33')][_0xc37c('0x3d')]+'%'};return _0x433c71;}})});}_0x595f7d=_[_0xc37c('0x3f')]({},_0x595f7d,_0x32c633[_0xc37c('0x41')]);var _0x366c81={'where':_0x595f7d[_0xc37c('0x3e')]};return db[_0xc37c('0x2e')][_0xc37c('0x42')](_0x366c81)[_0xc37c('0x29')](function(_0x3b302a){_0x2f2b6c[_0xc37c('0x42')]=_0x3b302a;if(_0x32c633[_0xc37c('0x33')]['includeAll']){_0x595f7d['include']=[{'all':!![]}];}return db[_0xc37c('0x2e')][_0xc37c('0x43')](_0x595f7d);})[_0xc37c('0x29')](function(_0x1ea6fc){_0x2f2b6c[_0xc37c('0x44')]=_0x1ea6fc;return _0x2f2b6c;})[_0xc37c('0x29')](respondWithFilteredResult(_0x1add69,_0x595f7d))[_0xc37c('0x45')](handleError(_0x1add69,null));};exports['show']=function(_0x4212d5,_0x1ecc17){var _0x27856a={'raw':!![],'where':{'id':_0x4212d5['params']['id']}},_0x5f50ee={};_0x5f50ee[_0xc37c('0x34')]=_[_0xc37c('0x46')](db[_0xc37c('0x2e')]['rawAttributes']);_0x5f50ee[_0xc37c('0x33')]=_[_0xc37c('0x46')](_0x4212d5['query']);_0x5f50ee[_0xc37c('0x3b')]=_[_0xc37c('0x36')](_0x5f50ee[_0xc37c('0x34')],_0x5f50ee[_0xc37c('0x33')]);_0x27856a['attributes']=_[_0xc37c('0x36')](_0x5f50ee[_0xc37c('0x34')],qs[_0xc37c('0x37')](_0x4212d5[_0xc37c('0x33')][_0xc37c('0x37')]));_0x27856a[_0xc37c('0x35')]=_0x27856a[_0xc37c('0x35')][_0xc37c('0x47')]?_0x27856a[_0xc37c('0x35')]:_0x5f50ee[_0xc37c('0x34')];if(_0x4212d5[_0xc37c('0x33')][_0xc37c('0x48')]){_0x27856a[_0xc37c('0x49')]=[{'all':!![]}];}_0x27856a=_[_0xc37c('0x3f')]({},_0x27856a,_0x4212d5[_0xc37c('0x41')]);return db[_0xc37c('0x2e')][_0xc37c('0x4a')](_0x27856a)['then'](handleEntityNotFound(_0x1ecc17,null))['then'](respondWithResult(_0x1ecc17,null))['catch'](handleError(_0x1ecc17,null));};exports[_0xc37c('0x4b')]=function(_0xa6e31f,_0x38ab71){return db[_0xc37c('0x2e')][_0xc37c('0x4b')](_0xa6e31f[_0xc37c('0x4c')],{})['then'](respondWithResult(_0x38ab71,0xc9))[_0xc37c('0x45')](handleError(_0x38ab71,null));};exports['update']=function(_0x561171,_0x2a1f03){if(_0x561171[_0xc37c('0x4c')]['id']){delete _0x561171[_0xc37c('0x4c')]['id'];}return db[_0xc37c('0x2e')][_0xc37c('0x4a')]({'where':{'id':_0x561171['params']['id']}})['then'](handleEntityNotFound(_0x2a1f03,null))[_0xc37c('0x29')](saveUpdates(_0x561171['body'],null))['then'](respondWithResult(_0x2a1f03,null))[_0xc37c('0x45')](handleError(_0x2a1f03,null));};exports[_0xc37c('0x28')]=function(_0xb46c67,_0x437b0){return db[_0xc37c('0x2e')][_0xc37c('0x4a')]({'where':{'id':_0xb46c67['params']['id']}})[_0xc37c('0x29')](handleEntityNotFound(_0x437b0,null))[_0xc37c('0x29')](removeEntity(_0x437b0,null))[_0xc37c('0x45')](handleError(_0x437b0,null));};exports[_0xc37c('0x4d')]=function(_0x3e97b5,_0x35884a){return db[_0xc37c('0x2e')]['describe']()[_0xc37c('0x29')](respondWithResult(_0x35884a,null))[_0xc37c('0x45')](handleError(_0x35884a,null));};function wrapUser(_0x3e817f){return function(_0x4e1b3f){var _0x139f13=_0x3e817f[_0xc37c('0x4e')]({'plain':!![]});_0x139f13[_0xc37c('0x4f')]=[];if(_0x4e1b3f){_0x139f13['lastMessageAt']=_0x4e1b3f[_0xc37c('0x50')];_0x139f13[_0xc37c('0x51')]=_0x4e1b3f;}else{_0x139f13['lastMessageAt']=moment(0x0)[_0xc37c('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x139f13[_0xc37c('0x51')]={};}return _0x139f13;};}exports[_0xc37c('0x53')]=function(_0x1e0346,_0x4a434a,_0xe2eac5){var _0x24c167=[];return db['User'][_0xc37c('0x43')]({'where':{'role':[_0xc37c('0x54'),_0xc37c('0x55'),_0xc37c('0x56')]},'attributes':['id',_0xc37c('0x57'),_0xc37c('0x2a'),_0xc37c('0x58'),'userpic',_0xc37c('0x59'),'online','lastLoginAt','allowmessenger',_0xc37c('0x5a')],'order':qs[_0xc37c('0x3a')](_0xc37c('0x5b')),'include':[{'model':db[_0xc37c('0x5c')],'as':'VoiceQueues','attributes':['id',_0xc37c('0x2a'),_0xc37c('0x31')],'through':{'attributes':[]}}]})[_0xc37c('0x29')](function(_0x4a747c){if(_0x4a747c){var _0x2b8146=_0x1e0346[_0xc37c('0x56')][_0xc37c('0x4e')]({'plain':!![]});if(!_0x2b8146)throw new Error(_0xc37c('0x5d'));if(_0x2b8146[_0xc37c('0x58')]===_0xc37c('0x56')){return db[_0xc37c('0x5e')][_0xc37c('0x4a')]({'where':{'name':_0xc37c('0x5f'),'userProfileId':_0x2b8146[_0xc37c('0x60')]},'raw':!![]})[_0xc37c('0x29')](function(_0x2fc6f6){if(_0x2fc6f6){if(_0x2fc6f6[_0xc37c('0x61')]===0x0){return db[_0xc37c('0x62')][_0xc37c('0x43')]({'where':{'sectionId':_0x2fc6f6['id']},'raw':!![]})[_0xc37c('0x29')](function(_0x3d2267){var _0x1d455=[];if(_[_0xc37c('0x63')](_0x3d2267)){_0x1d455=_['filter'](_0x4a747c,function(_0x3c3c22){if(_0x3c3c22['role']!=='agent'){return _0x3c3c22;}});return _0x1d455;}else{for(var _0x7f96df=0x0;_0x7f96df<_0x4a747c[_0xc37c('0x47')];_0x7f96df++){var _0x7fecf1=_0x4a747c[_0x7f96df];if(_0x7fecf1[_0xc37c('0x58')]===_0xc37c('0x54')){var _0x26b90a=_[_0xc37c('0x4a')](_0x3d2267,function(_0xa02497){return _0xa02497[_0xc37c('0x64')]===_0x7fecf1['id'];});if(_0x26b90a)_0x1d455[_0xc37c('0x65')](_0x7fecf1);}else{_0x1d455[_0xc37c('0x65')](_0x7fecf1);}}return _0x1d455;}});}else{return _0x4a747c;}}else{var _0x1ff865=_[_0xc37c('0x3d')](_0x4a747c,function(_0x410f74){if(_0x410f74[_0xc37c('0x58')]!==_0xc37c('0x54')){return _0x410f74;}});return _0x1ff865;}});}else{return _0x4a747c;}}})[_0xc37c('0x29')](function(_0x2a6e72){var _0x49dab0=[];if(_0x2a6e72){_0x24c167=_0x2a6e72;for(var _0x4c7d7c=0x0;_0x4c7d7c<_0x2a6e72[_0xc37c('0x47')];_0x4c7d7c+=0x1){_0x24c167[_0x4c7d7c]['messages']=[];_0x49dab0['push'](db[_0xc37c('0x2e')][_0xc37c('0x4a')]({'where':{'FromId':[_0x1e0346[_0xc37c('0x56')]['id'],_0x2a6e72[_0x4c7d7c]['id']],'ToId':[_0x1e0346[_0xc37c('0x56')]['id'],_0x2a6e72[_0x4c7d7c]['id']],'ChatGroupId':null},'attributes':['id',_0xc37c('0x50'),_0xc37c('0x66'),'ToId',_0xc37c('0x67'),'body'],'order':qs[_0xc37c('0x3a')](_0xc37c('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc37c('0x29')](wrapUser(_0x2a6e72[_0x4c7d7c])));}return BPromise[_0xc37c('0x69')](_0x49dab0);}return[];})['then'](function(_0x1c22a2){return{'rows':_0x1c22a2,'count':_0x1c22a2[_0xc37c('0x47')]};})[_0xc37c('0x29')](respondWithResult(_0x4a434a,null))[_0xc37c('0x45')](handleError(_0x4a434a,null));}; \ No newline at end of file +var _0x1223=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','allowmessenger','showWebBar','-online','VoiceQueue','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','length','resourceId','push','FromId','read','-createdAt','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1223,0x6d));var _0x3122=function(_0x51167d,_0x208fdf){_0x51167d=_0x51167d-0x0;var _0x59203b=_0x1223[_0x51167d];return _0x59203b;};'use strict';var emlformat=require(_0x3122('0x0'));var rimraf=require(_0x3122('0x1'));var zipdir=require(_0x3122('0x2'));var jsonpatch=require(_0x3122('0x3'));var rp=require(_0x3122('0x4'));var moment=require(_0x3122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3122('0x6'));var util=require(_0x3122('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3122('0x8'));var ejs=require(_0x3122('0x9'));var fs=require('fs');var fs_extra=require(_0x3122('0xa'));var _=require(_0x3122('0xb'));var squel=require(_0x3122('0xc'));var crypto=require(_0x3122('0xd'));var jsforce=require(_0x3122('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3122('0xf'));var Redis=require(_0x3122('0x10'));var authService=require(_0x3122('0x11'));var qs=require(_0x3122('0x12'));var as=require(_0x3122('0x13'));var hardwareService=require(_0x3122('0x14'));var logger=require(_0x3122('0x15'))(_0x3122('0x16'));var utils=require(_0x3122('0x17'));var config=require(_0x3122('0x18'));var licenseUtil=require(_0x3122('0x19'));var db=require(_0x3122('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3122('0x1b'),'port':0x18eb});var socket=require(_0x3122('0x1c'))(new Redis(config['redis']));require(_0x3122('0x1d'))[_0x3122('0x1e')](socket);function respondWithStatusCode(_0x267f9b,_0x33d790){_0x33d790=_0x33d790||0xcc;return function(_0x4f6e6c){if(_0x4f6e6c){return _0x267f9b[_0x3122('0x1f')](_0x33d790);}return _0x267f9b['status'](_0x33d790)[_0x3122('0x20')]();};}function respondWithResult(_0x2697f5,_0xc960d9){_0xc960d9=_0xc960d9||0xc8;return function(_0xb88688){if(_0xb88688){return _0x2697f5['status'](_0xc960d9)[_0x3122('0x21')](_0xb88688);}};}function respondWithFilteredResult(_0x4508bf,_0x5d3674){return function(_0x1a9093){if(_0x1a9093){var _0x2b5642=typeof _0x5d3674[_0x3122('0x22')]===_0x3122('0x23')&&typeof _0x5d3674[_0x3122('0x24')]===_0x3122('0x23');var _0xd48489=_0x1a9093[_0x3122('0x25')];var _0x142ff5=_0x2b5642?0x0:_0x5d3674[_0x3122('0x22')];var _0x4614e8=_0x2b5642?_0x1a9093[_0x3122('0x25')]:_0x5d3674[_0x3122('0x22')]+_0x5d3674[_0x3122('0x24')];var _0x25ed36;if(_0x4614e8>=_0xd48489){_0x4614e8=_0xd48489;_0x25ed36=0xc8;}else{_0x25ed36=0xce;}_0x4508bf[_0x3122('0x26')](_0x25ed36);return _0x4508bf[_0x3122('0x27')](_0x3122('0x28'),_0x142ff5+'-'+_0x4614e8+'/'+_0xd48489)[_0x3122('0x21')](_0x1a9093);}return null;};}function patchUpdates(_0x54c913){return function(_0xd0222f){try{jsonpatch[_0x3122('0x29')](_0xd0222f,_0x54c913,!![]);}catch(_0x31df18){return BPromise['reject'](_0x31df18);}return _0xd0222f[_0x3122('0x2a')]();};}function saveUpdates(_0x4e5ddb,_0x476879){return function(_0xa4d979){if(_0xa4d979){return _0xa4d979[_0x3122('0x2b')](_0x4e5ddb)[_0x3122('0x2c')](function(_0x15334f){return _0x15334f;});}return null;};}function removeEntity(_0x5b0bcb,_0x44d2c4){return function(_0x3f2033){if(_0x3f2033){return _0x3f2033['destroy']()[_0x3122('0x2c')](function(){_0x5b0bcb[_0x3122('0x26')](0xcc)[_0x3122('0x20')]();});}};}function handleEntityNotFound(_0x569365,_0x1ced73){return function(_0x413253){if(!_0x413253){_0x569365[_0x3122('0x1f')](0x194);}return _0x413253;};}function handleError(_0xe321eb,_0x261a23){_0x261a23=_0x261a23||0x1f4;return function(_0x3eea19){logger['error'](_0x3eea19['stack']);if(_0x3eea19[_0x3122('0x2d')]){delete _0x3eea19['name'];}_0xe321eb[_0x3122('0x26')](_0x261a23)[_0x3122('0x2e')](_0x3eea19);};}exports[_0x3122('0x2f')]=function(_0x2f0928,_0x3348b8){var _0x24aed5={},_0xccb3c6={},_0x4bc1d6={'count':0x0,'rows':[]};var _0x4ef104=_['map'](db[_0x3122('0x30')][_0x3122('0x31')],function(_0x3d9046){return{'name':_0x3d9046[_0x3122('0x32')],'type':_0x3d9046['type'][_0x3122('0x33')]};});_0xccb3c6[_0x3122('0x34')]=_['map'](_0x4ef104,_0x3122('0x2d'));_0xccb3c6[_0x3122('0x35')]=_[_0x3122('0x36')](_0x2f0928[_0x3122('0x35')]);_0xccb3c6[_0x3122('0x37')]=_[_0x3122('0x38')](_0xccb3c6[_0x3122('0x34')],_0xccb3c6[_0x3122('0x35')]);_0x24aed5[_0x3122('0x39')]=_['intersection'](_0xccb3c6['model'],qs[_0x3122('0x3a')](_0x2f0928['query'][_0x3122('0x3a')]));_0x24aed5[_0x3122('0x39')]=_0x24aed5['attributes']['length']?_0x24aed5[_0x3122('0x39')]:_0xccb3c6[_0x3122('0x34')];if(!_0x2f0928[_0x3122('0x35')][_0x3122('0x3b')]('nolimit')){_0x24aed5[_0x3122('0x24')]=qs[_0x3122('0x24')](_0x2f0928[_0x3122('0x35')][_0x3122('0x24')]);_0x24aed5[_0x3122('0x22')]=qs[_0x3122('0x22')](_0x2f0928[_0x3122('0x35')][_0x3122('0x22')]);}_0x24aed5[_0x3122('0x3c')]=qs['sort'](_0x2f0928[_0x3122('0x35')][_0x3122('0x3d')]);_0x24aed5[_0x3122('0x3e')]=qs[_0x3122('0x37')](_[_0x3122('0x3f')](_0x2f0928[_0x3122('0x35')],_0xccb3c6[_0x3122('0x37')]),_0x4ef104);if(_0x2f0928[_0x3122('0x35')][_0x3122('0x40')]){_0x24aed5['where']=_[_0x3122('0x41')](_0x24aed5[_0x3122('0x3e')],{'$or':_[_0x3122('0x42')](_0x4ef104,function(_0x33c02a){if(_0x33c02a['type']!==_0x3122('0x43')){var _0x51e084={};_0x51e084[_0x33c02a['name']]={'$like':'%'+_0x2f0928['query'][_0x3122('0x40')]+'%'};return _0x51e084;}})});}_0x24aed5=_['merge']({},_0x24aed5,_0x2f0928[_0x3122('0x44')]);var _0xe819da={'where':_0x24aed5[_0x3122('0x3e')]};return db[_0x3122('0x30')][_0x3122('0x25')](_0xe819da)[_0x3122('0x2c')](function(_0x482908){_0x4bc1d6['count']=_0x482908;if(_0x2f0928['query'][_0x3122('0x45')]){_0x24aed5[_0x3122('0x46')]=[{'all':!![]}];}return db[_0x3122('0x30')][_0x3122('0x47')](_0x24aed5);})['then'](function(_0x48121f){_0x4bc1d6[_0x3122('0x48')]=_0x48121f;return _0x4bc1d6;})['then'](respondWithFilteredResult(_0x3348b8,_0x24aed5))[_0x3122('0x49')](handleError(_0x3348b8,null));};exports[_0x3122('0x4a')]=function(_0x5484ce,_0x5bbf2c){var _0x2cc201={'raw':!![],'where':{'id':_0x5484ce[_0x3122('0x4b')]['id']}},_0x38dd1b={};_0x38dd1b[_0x3122('0x34')]=_[_0x3122('0x36')](db[_0x3122('0x30')][_0x3122('0x31')]);_0x38dd1b[_0x3122('0x35')]=_[_0x3122('0x36')](_0x5484ce[_0x3122('0x35')]);_0x38dd1b[_0x3122('0x37')]=_[_0x3122('0x38')](_0x38dd1b[_0x3122('0x34')],_0x38dd1b['query']);_0x2cc201[_0x3122('0x39')]=_['intersection'](_0x38dd1b[_0x3122('0x34')],qs[_0x3122('0x3a')](_0x5484ce[_0x3122('0x35')][_0x3122('0x3a')]));_0x2cc201[_0x3122('0x39')]=_0x2cc201[_0x3122('0x39')]['length']?_0x2cc201[_0x3122('0x39')]:_0x38dd1b[_0x3122('0x34')];if(_0x5484ce['query'][_0x3122('0x45')]){_0x2cc201['include']=[{'all':!![]}];}_0x2cc201=_[_0x3122('0x41')]({},_0x2cc201,_0x5484ce[_0x3122('0x44')]);return db['ChatInternalMessage'][_0x3122('0x4c')](_0x2cc201)[_0x3122('0x2c')](handleEntityNotFound(_0x5bbf2c,null))['then'](respondWithResult(_0x5bbf2c,null))[_0x3122('0x49')](handleError(_0x5bbf2c,null));};exports[_0x3122('0x4d')]=function(_0x38fdfe,_0x41f806){return db[_0x3122('0x30')][_0x3122('0x4d')](_0x38fdfe['body'],{})[_0x3122('0x2c')](respondWithResult(_0x41f806,0xc9))[_0x3122('0x49')](handleError(_0x41f806,null));};exports['update']=function(_0x5e0945,_0x34d08b){if(_0x5e0945[_0x3122('0x4e')]['id']){delete _0x5e0945[_0x3122('0x4e')]['id'];}return db[_0x3122('0x30')][_0x3122('0x4c')]({'where':{'id':_0x5e0945[_0x3122('0x4b')]['id']}})[_0x3122('0x2c')](handleEntityNotFound(_0x34d08b,null))[_0x3122('0x2c')](saveUpdates(_0x5e0945['body'],null))['then'](respondWithResult(_0x34d08b,null))[_0x3122('0x49')](handleError(_0x34d08b,null));};exports['destroy']=function(_0x28b5e0,_0x17ad2e){return db[_0x3122('0x30')][_0x3122('0x4c')]({'where':{'id':_0x28b5e0[_0x3122('0x4b')]['id']}})[_0x3122('0x2c')](handleEntityNotFound(_0x17ad2e,null))['then'](removeEntity(_0x17ad2e,null))['catch'](handleError(_0x17ad2e,null));};exports['describe']=function(_0x573556,_0x1b3a6b){return db[_0x3122('0x30')]['describe']()[_0x3122('0x2c')](respondWithResult(_0x1b3a6b,null))[_0x3122('0x49')](handleError(_0x1b3a6b,null));};function wrapUser(_0x2777e2){return function(_0x2bdbaf){var _0x5c6b89=_0x2777e2[_0x3122('0x4f')]({'plain':!![]});_0x5c6b89[_0x3122('0x50')]=[];if(_0x2bdbaf){_0x5c6b89[_0x3122('0x51')]=_0x2bdbaf[_0x3122('0x52')];_0x5c6b89[_0x3122('0x53')]=_0x2bdbaf;}else{_0x5c6b89[_0x3122('0x51')]=moment(0x0)[_0x3122('0x54')](_0x3122('0x55'));_0x5c6b89[_0x3122('0x53')]={};}return _0x5c6b89;};}exports[_0x3122('0x56')]=function(_0x520fee,_0x2ad7dd,_0x4bc5f7){var _0x59ff3e=[];return db[_0x3122('0x57')][_0x3122('0x47')]({'where':{'role':[_0x3122('0x58'),_0x3122('0x59'),_0x3122('0x5a')]},'attributes':['id',_0x3122('0x5b'),_0x3122('0x2d'),_0x3122('0x5c'),_0x3122('0x5d'),'internal','online','lastLoginAt',_0x3122('0x5e'),_0x3122('0x5f')],'order':qs['sort'](_0x3122('0x60')),'include':[{'model':db[_0x3122('0x61')],'as':'VoiceQueues','attributes':['id',_0x3122('0x2d'),_0x3122('0x62')],'through':{'attributes':[]}}]})['then'](function(_0x512256){if(_0x512256){var _0x163c12=_0x520fee['user']['get']({'plain':!![]});if(!_0x163c12)throw new Error(_0x3122('0x63'));if(_0x163c12['role']===_0x3122('0x5a')){return db[_0x3122('0x64')]['find']({'where':{'name':_0x3122('0x65'),'userProfileId':_0x163c12['userProfileId']},'raw':!![]})[_0x3122('0x2c')](function(_0x1cbf5e){if(_0x1cbf5e){if(_0x1cbf5e[_0x3122('0x66')]===0x0){return db[_0x3122('0x67')][_0x3122('0x47')]({'where':{'sectionId':_0x1cbf5e['id']},'raw':!![]})[_0x3122('0x2c')](function(_0x1544f0){var _0x2ab1cf=[];if(_['isEmpty'](_0x1544f0)){_0x2ab1cf=_['filter'](_0x512256,function(_0x4f8a49){if(_0x4f8a49[_0x3122('0x5c')]!==_0x3122('0x58')){return _0x4f8a49;}});return _0x2ab1cf;}else{for(var _0x1d3c2=0x0;_0x1d3c2<_0x512256[_0x3122('0x68')];_0x1d3c2++){var _0x486335=_0x512256[_0x1d3c2];if(_0x486335[_0x3122('0x5c')]===_0x3122('0x58')){var _0x3036da=_[_0x3122('0x4c')](_0x1544f0,function(_0x1687ab){return _0x1687ab[_0x3122('0x69')]===_0x486335['id'];});if(_0x3036da)_0x2ab1cf[_0x3122('0x6a')](_0x486335);}else{_0x2ab1cf[_0x3122('0x6a')](_0x486335);}}return _0x2ab1cf;}});}else{return _0x512256;}}else{var _0xb9bb90=_[_0x3122('0x40')](_0x512256,function(_0x5ca520){if(_0x5ca520[_0x3122('0x5c')]!==_0x3122('0x58')){return _0x5ca520;}});return _0xb9bb90;}});}else{return _0x512256;}}})[_0x3122('0x2c')](function(_0x3cf741){var _0x46bae0=[];if(_0x3cf741){_0x59ff3e=_0x3cf741;for(var _0x5d8153=0x0;_0x5d8153<_0x3cf741[_0x3122('0x68')];_0x5d8153+=0x1){_0x59ff3e[_0x5d8153]['messages']=[];_0x46bae0['push'](db['ChatInternalMessage'][_0x3122('0x4c')]({'where':{'FromId':[_0x520fee[_0x3122('0x5a')]['id'],_0x3cf741[_0x5d8153]['id']],'ToId':[_0x520fee[_0x3122('0x5a')]['id'],_0x3cf741[_0x5d8153]['id']],'ChatGroupId':null},'attributes':['id',_0x3122('0x52'),_0x3122('0x6b'),'ToId',_0x3122('0x6c'),_0x3122('0x4e')],'order':qs[_0x3122('0x3d')](_0x3122('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3122('0x2c')](wrapUser(_0x3cf741[_0x5d8153])));}return BPromise['all'](_0x46bae0);}return[];})[_0x3122('0x2c')](function(_0x524f74){return{'rows':_0x524f74,'count':_0x524f74[_0x3122('0x68')]};})[_0x3122('0x2c')](respondWithResult(_0x2ad7dd,null))[_0x3122('0x49')](handleError(_0x2ad7dd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7ebb85e..d0194ca 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 _0x0751=['events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x41894c,_0x25f3af){var _0x1c56f5=function(_0x3f8e29){while(--_0x3f8e29){_0x41894c['push'](_0x41894c['shift']());}};_0x1c56f5(++_0x25f3af);}(_0x0751,0x1e0));var _0x1075=function(_0x253834,_0x5bc6de){_0x253834=_0x253834-0x0;var _0xbfcd9c=_0x0751[_0x253834];return _0xbfcd9c;};'use strict';var EventEmitter=require(_0x1075('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x1075('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1075('0x2')](0x0);var events={'afterCreate':_0x1075('0x3'),'afterUpdate':_0x1075('0x4'),'afterDestroy':_0x1075('0x5')};function emitEvent(_0x224c8e){return function(_0x381997,_0x1f21dd,_0x3f7b34){ChatInternalMessageEvents['emit'](_0x224c8e+':'+_0x381997['id'],_0x381997);ChatInternalMessageEvents[_0x1075('0x6')](_0x224c8e,_0x381997);_0x3f7b34(null);};}for(var e in events){if(events[_0x1075('0x7')](e)){var event=events[e];ChatInternalMessage[_0x1075('0x8')](e,emitEvent(event));}}module[_0x1075('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x971e=['remove','emit','exports','events','ChatInternalMessage','setMaxListeners'];(function(_0x147686,_0x292c6a){var _0x4db1b8=function(_0x3da383){while(--_0x3da383){_0x147686['push'](_0x147686['shift']());}};_0x4db1b8(++_0x292c6a);}(_0x971e,0x165));var _0xe971=function(_0x200885,_0x387793){_0x200885=_0x200885-0x0;var _0x56a302=_0x971e[_0x200885];return _0x56a302;};'use strict';var EventEmitter=require(_0xe971('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe971('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe971('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe971('0x3')};function emitEvent(_0x57e1ca){return function(_0x33c241,_0x13241d,_0x2a80d9){ChatInternalMessageEvents[_0xe971('0x4')](_0x57e1ca+':'+_0x33c241['id'],_0x33c241);ChatInternalMessageEvents[_0xe971('0x4')](_0x57e1ca,_0x33c241);_0x2a80d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xe971('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 10a2b6f..96fd1b8 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 _0xf24e=['lodash','util','../../config/logger','bluebird','path','../../config/environment','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x25be56,_0x170c8c){var _0x469c77=function(_0x2548ef){while(--_0x2548ef){_0x25be56['push'](_0x25be56['shift']());}};_0x469c77(++_0x170c8c);}(_0xf24e,0x136));var _0xef24=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0xf24e[_0x45c981];return _0x4f62c8;};'use strict';var _=require(_0xef24('0x0'));var util=require(_0xef24('0x1'));var logger=require(_0xef24('0x2'))('api');var moment=require('moment');var BPromise=require(_0xef24('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef24('0x4'));var rimraf=require('rimraf');var config=require(_0xef24('0x5'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x1234cd,_0x4bed6a){return _0x1234cd[_0xef24('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xef24('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef24('0x8'),'collate':_0xef24('0x9')});}; \ No newline at end of file +var _0x37f9=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4cbe00,_0x6123d8){var _0x19be2f=function(_0x5bddfd){while(--_0x5bddfd){_0x4cbe00['push'](_0x4cbe00['shift']());}};_0x19be2f(++_0x6123d8);}(_0x37f9,0x139));var _0x937f=function(_0x379a30,_0x2fc1d0){_0x379a30=_0x379a30-0x0;var _0x2d8cfe=_0x37f9[_0x379a30];return _0x2d8cfe;};'use strict';var _=require(_0x937f('0x0'));var util=require(_0x937f('0x1'));var logger=require(_0x937f('0x2'))('api');var moment=require(_0x937f('0x3'));var BPromise=require('bluebird');var rp=require(_0x937f('0x4'));var fs=require('fs');var path=require(_0x937f('0x5'));var rimraf=require(_0x937f('0x6'));var config=require(_0x937f('0x7'));var attributes=require(_0x937f('0x8'));module[_0x937f('0x9')]=function(_0x5cf2f3,_0x5c4ee5){return _0x5cf2f3[_0x937f('0xa')](_0x937f('0xb'),attributes,{'tableName':_0x937f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x937f('0xd'),'collate':_0x937f('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 28c78c3..1ffde52 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 _0xc906=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2b3fc6,_0x3fd7f1){var _0x13a5a5=function(_0x27dc9e){while(--_0x27dc9e){_0x2b3fc6['push'](_0x2b3fc6['shift']());}};_0x13a5a5(++_0x3fd7f1);}(_0xc906,0x1ad));var _0x6c90=function(_0x3a9c46,_0x4a7f3f){_0x3a9c46=_0x3a9c46-0x0;var _0x2aee82=_0xc906[_0x3a9c46];return _0x2aee82;};'use strict';var _=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));var moment=require('moment');var BPromise=require(_0x6c90('0x2'));var rs=require(_0x6c90('0x3'));var fs=require('fs');var Redis=require(_0x6c90('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c90('0x5'));var logger=require(_0x6c90('0x6'))(_0x6c90('0x7'));var config=require(_0x6c90('0x8'));var jayson=require(_0x6c90('0x9'));var client=jayson[_0x6c90('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6c90('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c90('0xc'))(new Redis(config[_0x6c90('0xb')]));require(_0x6c90('0xd'))[_0x6c90('0xe')](socket);function respondWithRpcPromise(_0x417974,_0x43e2bd,_0x252b10){return new BPromise(function(_0x7c8215,_0x1eba4b){return client[_0x6c90('0xf')](_0x417974,_0x252b10)[_0x6c90('0x10')](function(_0x441c1d){logger[_0x6c90('0x11')](_0x6c90('0x12'),_0x43e2bd,'request\x20sent');logger['debug'](_0x6c90('0x13'),_0x43e2bd,_0x6c90('0x14'),JSON[_0x6c90('0x15')](_0x441c1d));if(_0x441c1d[_0x6c90('0x16')]){if(_0x441c1d[_0x6c90('0x16')][_0x6c90('0x17')]===0x1f4){logger[_0x6c90('0x16')](_0x6c90('0x12'),_0x43e2bd,_0x441c1d[_0x6c90('0x16')][_0x6c90('0x18')]);return _0x1eba4b(_0x441c1d['error'][_0x6c90('0x18')]);}logger[_0x6c90('0x16')](_0x6c90('0x12'),_0x43e2bd,_0x441c1d[_0x6c90('0x16')]['message']);return _0x7c8215(_0x441c1d[_0x6c90('0x16')][_0x6c90('0x18')]);}else{logger['info'](_0x6c90('0x12'),_0x43e2bd,_0x6c90('0x14'));_0x7c8215(_0x441c1d[_0x6c90('0x19')][_0x6c90('0x18')]);}})[_0x6c90('0x1a')](function(_0x3442ac){logger['error'](_0x6c90('0x12'),_0x43e2bd,_0x3442ac);_0x1eba4b(_0x3442ac);});});} \ No newline at end of file +var _0xdb1b=['error','code','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x21d039,_0x43cce7){var _0x2a7f2f=function(_0x41d135){while(--_0x41d135){_0x21d039['push'](_0x21d039['shift']());}};_0x2a7f2f(++_0x43cce7);}(_0xdb1b,0x139));var _0xbdb1=function(_0x14dea5,_0x106f69){_0x14dea5=_0x14dea5-0x0;var _0x5065aa=_0xdb1b[_0x14dea5];return _0x5065aa;};'use strict';var _=require(_0xbdb1('0x0'));var util=require(_0xbdb1('0x1'));var moment=require(_0xbdb1('0x2'));var BPromise=require(_0xbdb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdb1('0x4'));var db=require(_0xbdb1('0x5'))['db'];var utils=require(_0xbdb1('0x6'));var logger=require(_0xbdb1('0x7'))(_0xbdb1('0x8'));var config=require(_0xbdb1('0x9'));var jayson=require(_0xbdb1('0xa'));var client=jayson[_0xbdb1('0xb')][_0xbdb1('0xc')]({'port':0x232a});config[_0xbdb1('0xd')]=_['defaults'](config['redis'],{'host':_0xbdb1('0xe'),'port':0x18eb});var socket=require(_0xbdb1('0xf'))(new Redis(config[_0xbdb1('0xd')]));require(_0xbdb1('0x10'))[_0xbdb1('0x11')](socket);function respondWithRpcPromise(_0x28e0ed,_0x29c519,_0x23b0c8){return new BPromise(function(_0x148d86,_0x4c6b1a){return client[_0xbdb1('0x12')](_0x28e0ed,_0x23b0c8)[_0xbdb1('0x13')](function(_0x100e2f){logger[_0xbdb1('0x14')](_0xbdb1('0x15'),_0x29c519,'request\x20sent');logger['debug'](_0xbdb1('0x16'),_0x29c519,'request\x20sent',JSON['stringify'](_0x100e2f));if(_0x100e2f[_0xbdb1('0x17')]){if(_0x100e2f[_0xbdb1('0x17')][_0xbdb1('0x18')]===0x1f4){logger['error'](_0xbdb1('0x15'),_0x29c519,_0x100e2f[_0xbdb1('0x17')][_0xbdb1('0x19')]);return _0x4c6b1a(_0x100e2f[_0xbdb1('0x17')]['message']);}logger['error'](_0xbdb1('0x15'),_0x29c519,_0x100e2f[_0xbdb1('0x17')][_0xbdb1('0x19')]);return _0x148d86(_0x100e2f[_0xbdb1('0x17')][_0xbdb1('0x19')]);}else{logger[_0xbdb1('0x14')](_0xbdb1('0x15'),_0x29c519,_0xbdb1('0x1a'));_0x148d86(_0x100e2f[_0xbdb1('0x1b')][_0xbdb1('0x19')]);}})['catch'](function(_0x47f2c2){logger[_0xbdb1('0x17')](_0xbdb1('0x15'),_0x29c519,_0x47f2c2);_0x4c6b1a(_0x47f2c2);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6af99d2..ae15ea3 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 _0x2fa4=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','register'];(function(_0x199cd0,_0x42f22d){var _0xa2fe98=function(_0x3b3d61){while(--_0x3b3d61){_0x199cd0['push'](_0x199cd0['shift']());}};_0xa2fe98(++_0x42f22d);}(_0x2fa4,0x6b));var _0x42fa=function(_0x53d44f,_0x5317ef){_0x53d44f=_0x53d44f-0x0;var _0x3c6495=_0x2fa4[_0x53d44f];return _0x3c6495;};'use strict';var ChatInternalMessageEvents=require(_0x42fa('0x0'));var events=[_0x42fa('0x1'),_0x42fa('0x2'),_0x42fa('0x3')];function createListener(_0xd1fa43,_0x342ca7){return function(_0x1e1d27){_0x342ca7['emit'](_0xd1fa43,_0x1e1d27);};}function removeListener(_0x4b7181,_0x241c34){return function(){ChatInternalMessageEvents['removeListener'](_0x4b7181,_0x241c34);};}exports[_0x42fa('0x4')]=function(_0x46ee12){for(var _0x170863=0x0,_0x5517f6=events[_0x42fa('0x5')];_0x170863<_0x5517f6;_0x170863++){var _0x5aabcf=events[_0x170863];var _0x631fb2=createListener(_0x42fa('0x6')+_0x5aabcf,_0x46ee12);ChatInternalMessageEvents['on'](_0x5aabcf,_0x631fb2);}}; \ No newline at end of file +var _0xfbe6=['chatInternalMessage:','./chatInternalMessage.events','update'];(function(_0x5c3d20,_0x4949aa){var _0x18b1bf=function(_0x22e50f){while(--_0x22e50f){_0x5c3d20['push'](_0x5c3d20['shift']());}};_0x18b1bf(++_0x4949aa);}(_0xfbe6,0xcd));var _0x6fbe=function(_0x451539,_0x4ddef2){_0x451539=_0x451539-0x0;var _0x290fd9=_0xfbe6[_0x451539];return _0x290fd9;};'use strict';var ChatInternalMessageEvents=require(_0x6fbe('0x0'));var events=['save','remove',_0x6fbe('0x1')];function createListener(_0x552879,_0x1da5c2){return function(_0x4d188f){_0x1da5c2['emit'](_0x552879,_0x4d188f);};}function removeListener(_0x35ab0b,_0x3f94ae){return function(){ChatInternalMessageEvents['removeListener'](_0x35ab0b,_0x3f94ae);};}exports['register']=function(_0x32d210){for(var _0x1ed905=0x0,_0x5cd2d7=events['length'];_0x1ed905<_0x5cd2d7;_0x1ed905++){var _0x5c9d0d=events[_0x1ed905];var _0x207f4b=createListener(_0x6fbe('0x2')+_0x5c9d0d,_0x32d210);ChatInternalMessageEvents['on'](_0x5c9d0d,_0x207f4b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7c1d589..f45a54a 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 _0x874e=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/users','getUsers','/:id','show','post','create','update','delete'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x874e,0xf3));var _0xe874=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x874e[_0x79b649];return _0x1af9b1;};'use strict';var multer=require(_0xe874('0x0'));var util=require(_0xe874('0x1'));var path=require(_0xe874('0x2'));var timeout=require(_0xe874('0x3'));var express=require('express');var router=express[_0xe874('0x4')]();var fs_extra=require(_0xe874('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe874('0x6'));var config=require(_0xe874('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0xe874('0x8')](),controller[_0xe874('0x9')]);router['get'](_0xe874('0xa'),auth[_0xe874('0x8')](),controller[_0xe874('0xb')]);router[_0xe874('0xc')](_0xe874('0xd'),auth[_0xe874('0x8')](),controller[_0xe874('0xe')]);router[_0xe874('0xc')](_0xe874('0xf'),auth[_0xe874('0x8')](),controller[_0xe874('0x10')]);router[_0xe874('0x11')]('/',auth[_0xe874('0x8')](),controller[_0xe874('0x12')]);router['put']('/:id',controller[_0xe874('0x13')]);router[_0xe874('0x14')](_0xe874('0xf'),auth[_0xe874('0x8')](),controller['destroy']);module[_0xe874('0x15')]=router; \ No newline at end of file +var _0x9cb5=['/describe','describe','isAuthenticated','getUsers','/:id','show','put','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x3f2e2d,_0x314ddc){var _0x5cf715=function(_0x4de41c){while(--_0x4de41c){_0x3f2e2d['push'](_0x3f2e2d['shift']());}};_0x5cf715(++_0x314ddc);}(_0x9cb5,0x1f0));var _0x59cb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9cb5[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x59cb('0x0'));var path=require(_0x59cb('0x1'));var timeout=require('connect-timeout');var express=require(_0x59cb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x59cb('0x3'));var interaction=require(_0x59cb('0x4'));var config=require(_0x59cb('0x5'));var controller=require(_0x59cb('0x6'));router[_0x59cb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59cb('0x7')](_0x59cb('0x8'),auth['isAuthenticated'](),controller[_0x59cb('0x9')]);router[_0x59cb('0x7')]('/users',auth[_0x59cb('0xa')](),controller[_0x59cb('0xb')]);router['get'](_0x59cb('0xc'),auth['isAuthenticated'](),controller[_0x59cb('0xd')]);router['post']('/',auth[_0x59cb('0xa')](),controller['create']);router[_0x59cb('0xe')](_0x59cb('0xc'),controller[_0x59cb('0xf')]);router[_0x59cb('0x10')]('/:id',auth[_0x59cb('0xa')](),controller['destroy']);module[_0x59cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 30be21f..479ce33 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 _0x0447=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5d0eb8,_0x40c598){var _0x32d89b=function(_0x31fdf8){while(--_0x31fdf8){_0x5d0eb8['push'](_0x5d0eb8['shift']());}};_0x32d89b(++_0x40c598);}(_0x0447,0x8b));var _0x7044=function(_0x48478f,_0x537acd){_0x48478f=_0x48478f-0x0;var _0x10af50=_0x0447[_0x48478f];return _0x10af50;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'body':{'type':Sequelize[_0x7044('0x2')](_0x7044('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7044('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7044('0x5')]('in',_0x7044('0x6')),'defaultValue':_0x7044('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7044('0x7')]},'providerName':{'type':Sequelize[_0x7044('0x8')]},'providerResponse':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file +var _0x988c=['BOOLEAN','ENUM','STRING','TEXT','sequelize'];(function(_0x3e8d84,_0x33a8a8){var _0x3faa15=function(_0x5b0200){while(--_0x5b0200){_0x3e8d84['push'](_0x3e8d84['shift']());}};_0x3faa15(++_0x33a8a8);}(_0x988c,0x19e));var _0xc988=function(_0x424046,_0x55bcfa){_0x424046=_0x424046-0x0;var _0x20e37c=_0x988c[_0x424046];return _0x20e37c;};'use strict';var Sequelize=require(_0xc988('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc988('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc988('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc988('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc988('0x3')]},'providerResponse':{'type':Sequelize[_0xc988('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d1d24d8..e372c49 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 _0xf24f=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','ChatMessage','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','params','keys','rawAttributes','find','body','update','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','parse','formData','ChatInteraction','RejectMessage','event','EventManager','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xf24f,0xfe));var _0xff24=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xf24f[_0x1b5a05];return _0x347931;};'use strict';var emlformat=require(_0xff24('0x0'));var rimraf=require(_0xff24('0x1'));var zipdir=require(_0xff24('0x2'));var jsonpatch=require(_0xff24('0x3'));var rp=require(_0xff24('0x4'));var moment=require('moment');var BPromise=require(_0xff24('0x5'));var Mustache=require('mustache');var util=require(_0xff24('0x6'));var path=require(_0xff24('0x7'));var sox=require(_0xff24('0x8'));var csv=require('to-csv');var ejs=require(_0xff24('0x9'));var fs=require('fs');var fs_extra=require(_0xff24('0xa'));var _=require(_0xff24('0xb'));var squel=require(_0xff24('0xc'));var crypto=require(_0xff24('0xd'));var jsforce=require(_0xff24('0xe'));var deskjs=require(_0xff24('0xf'));var toCsv=require(_0xff24('0x10'));var querystring=require('querystring');var Papa=require(_0xff24('0x11'));var Redis=require(_0xff24('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff24('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff24('0x14'))(_0xff24('0x15'));var utils=require(_0xff24('0x16'));var config=require(_0xff24('0x17'));var licenseUtil=require(_0xff24('0x18'));var db=require(_0xff24('0x19'))['db'];config['redis']=_[_0xff24('0x1a')](config['redis'],{'host':_0xff24('0x1b'),'port':0x18eb});var socket=require(_0xff24('0x1c'))(new Redis(config[_0xff24('0x1d')]));require(_0xff24('0x1e'))[_0xff24('0x1f')](socket);var jayson=require(_0xff24('0x20'));var client=jayson[_0xff24('0x21')][_0xff24('0x22')]({'port':0x232c});var client9002=jayson[_0xff24('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3394d6,_0x25dcb2,_0x101fbe,_0x3582b9){return new BPromise(function(_0x19a10e,_0x2e96c2){var _0x171d91=_0x3582b9||client;return _0x171d91[_0xff24('0x23')](_0x3394d6,_0x101fbe)[_0xff24('0x24')](function(_0x51657a){logger[_0xff24('0x25')](_0xff24('0x26'),_0x25dcb2,_0xff24('0x27'));logger[_0xff24('0x28')](_0xff24('0x29'),_0x25dcb2,_0xff24('0x27'),JSON['stringify'](_0x51657a));if(_0x51657a[_0xff24('0x2a')]){if(_0x51657a[_0xff24('0x2a')][_0xff24('0x2b')]===0x1f4){logger[_0xff24('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x25dcb2,_0x51657a['error'][_0xff24('0x2c')]);return _0x2e96c2(_0x51657a[_0xff24('0x2a')]['message']);}logger['error'](_0xff24('0x26'),_0x25dcb2,_0x51657a[_0xff24('0x2a')][_0xff24('0x2c')]);return _0x19a10e(_0x51657a[_0xff24('0x2a')][_0xff24('0x2c')]);}else{logger[_0xff24('0x25')](_0xff24('0x26'),_0x25dcb2,'request\x20sent');_0x19a10e(_0x51657a['result'][_0xff24('0x2c')]);}})[_0xff24('0x2d')](function(_0x592ff8){logger['error']('ChatMessage,\x20%s,\x20%s',_0x25dcb2,_0x592ff8);_0x2e96c2(_0x592ff8);});});}function respondWithStatusCode(_0x478230,_0x142d52){_0x142d52=_0x142d52||0xcc;return function(_0x5d4fe7){if(_0x5d4fe7){return _0x478230['sendStatus'](_0x142d52);}return _0x478230[_0xff24('0x2e')](_0x142d52)[_0xff24('0x2f')]();};}function respondWithResult(_0x46aee0,_0xce6adf){_0xce6adf=_0xce6adf||0xc8;return function(_0x2c3c06){if(_0x2c3c06){return _0x46aee0[_0xff24('0x2e')](_0xce6adf)['json'](_0x2c3c06);}};}function respondWithFilteredResult(_0x4455d2,_0x3b0d0a){return function(_0x3bc8b0){if(_0x3bc8b0){var _0x56107c=typeof _0x3b0d0a[_0xff24('0x30')]===_0xff24('0x31')&&typeof _0x3b0d0a[_0xff24('0x32')]===_0xff24('0x31');var _0x4db2a9=_0x3bc8b0[_0xff24('0x33')];var _0x2d789e=_0x56107c?0x0:_0x3b0d0a[_0xff24('0x30')];var _0x348b25=_0x56107c?_0x3bc8b0[_0xff24('0x33')]:_0x3b0d0a[_0xff24('0x30')]+_0x3b0d0a[_0xff24('0x32')];var _0x197870;if(_0x348b25>=_0x4db2a9){_0x348b25=_0x4db2a9;_0x197870=0xc8;}else{_0x197870=0xce;}_0x4455d2[_0xff24('0x2e')](_0x197870);return _0x4455d2[_0xff24('0x34')](_0xff24('0x35'),_0x2d789e+'-'+_0x348b25+'/'+_0x4db2a9)[_0xff24('0x36')](_0x3bc8b0);}return null;};}function patchUpdates(_0x216385){return function(_0x128da8){try{jsonpatch[_0xff24('0x37')](_0x128da8,_0x216385,!![]);}catch(_0x1fc81f){return BPromise[_0xff24('0x38')](_0x1fc81f);}return _0x128da8[_0xff24('0x39')]();};}function saveUpdates(_0x46e05d,_0x4346b0){return function(_0x4621c9){if(_0x4621c9){return _0x4621c9['update'](_0x46e05d)[_0xff24('0x24')](function(_0x474abe){return _0x474abe;});}return null;};}function removeEntity(_0x2ee80c,_0x53f2a8){return function(_0x20249b){if(_0x20249b){return _0x20249b[_0xff24('0x3a')]()[_0xff24('0x24')](function(){_0x2ee80c[_0xff24('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a75dc,_0x44895b){return function(_0x10a7db){if(!_0x10a7db){_0x3a75dc[_0xff24('0x3b')](0x194);}return _0x10a7db;};}function handleError(_0xe4c41e,_0x1c57a2){_0x1c57a2=_0x1c57a2||0x1f4;return function(_0x5ceb7e){logger[_0xff24('0x2a')](_0x5ceb7e[_0xff24('0x3c')]);if(_0x5ceb7e['name']){delete _0x5ceb7e[_0xff24('0x3d')];}_0xe4c41e['status'](_0x1c57a2)[_0xff24('0x3e')](_0x5ceb7e);};}exports[_0xff24('0x3f')]=function(_0x360069,_0x212e39){var _0x100e8d={},_0x35b558={},_0x4949da={'count':0x0,'rows':[]};var _0x28ec4b=_[_0xff24('0x40')](db[_0xff24('0x41')]['rawAttributes'],function(_0x17ef21){return{'name':_0x17ef21[_0xff24('0x42')],'type':_0x17ef21[_0xff24('0x43')][_0xff24('0x44')]};});_0x35b558['model']=_[_0xff24('0x40')](_0x28ec4b,_0xff24('0x3d'));_0x35b558[_0xff24('0x45')]=_['keys'](_0x360069[_0xff24('0x45')]);_0x35b558['filters']=_[_0xff24('0x46')](_0x35b558[_0xff24('0x47')],_0x35b558[_0xff24('0x45')]);_0x100e8d[_0xff24('0x48')]=_[_0xff24('0x46')](_0x35b558[_0xff24('0x47')],qs[_0xff24('0x49')](_0x360069[_0xff24('0x45')][_0xff24('0x49')]));_0x100e8d[_0xff24('0x48')]=_0x100e8d[_0xff24('0x48')][_0xff24('0x4a')]?_0x100e8d[_0xff24('0x48')]:_0x35b558[_0xff24('0x47')];if(!_0x360069[_0xff24('0x45')][_0xff24('0x4b')](_0xff24('0x4c'))){_0x100e8d[_0xff24('0x32')]=qs[_0xff24('0x32')](_0x360069[_0xff24('0x45')]['limit']);_0x100e8d[_0xff24('0x30')]=qs[_0xff24('0x30')](_0x360069[_0xff24('0x45')][_0xff24('0x30')]);}_0x100e8d[_0xff24('0x4d')]=qs[_0xff24('0x4e')](_0x360069[_0xff24('0x45')][_0xff24('0x4e')]);_0x100e8d['where']=qs[_0xff24('0x4f')](_[_0xff24('0x50')](_0x360069[_0xff24('0x45')],_0x35b558[_0xff24('0x4f')]),_0x28ec4b);if(_0x360069[_0xff24('0x45')]['filter']){_0x100e8d[_0xff24('0x51')]=_[_0xff24('0x52')](_0x100e8d['where'],{'$or':_['map'](_0x28ec4b,function(_0x24b5e5){if(_0x24b5e5[_0xff24('0x43')]!==_0xff24('0x53')){var _0x47837c={};_0x47837c[_0x24b5e5['name']]={'$like':'%'+_0x360069[_0xff24('0x45')]['filter']+'%'};return _0x47837c;}})});}_0x100e8d=_[_0xff24('0x52')]({},_0x100e8d,_0x360069[_0xff24('0x54')]);var _0x2939b9={'where':_0x100e8d[_0xff24('0x51')]};return db['ChatMessage'][_0xff24('0x33')](_0x2939b9)[_0xff24('0x24')](function(_0x31195d){_0x4949da[_0xff24('0x33')]=_0x31195d;if(_0x360069['query'][_0xff24('0x55')]){_0x100e8d[_0xff24('0x56')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x100e8d);})[_0xff24('0x24')](function(_0x33c6cd){_0x4949da['rows']=_0x33c6cd;return _0x4949da;})[_0xff24('0x24')](respondWithFilteredResult(_0x212e39,_0x100e8d))['catch'](handleError(_0x212e39,null));};exports['show']=function(_0x37124b,_0x93882c){var _0x4c6cb0={'raw':!![],'where':{'id':_0x37124b[_0xff24('0x57')]['id']}},_0xc30e5c={};_0xc30e5c[_0xff24('0x47')]=_[_0xff24('0x58')](db[_0xff24('0x41')][_0xff24('0x59')]);_0xc30e5c['query']=_[_0xff24('0x58')](_0x37124b[_0xff24('0x45')]);_0xc30e5c[_0xff24('0x4f')]=_[_0xff24('0x46')](_0xc30e5c[_0xff24('0x47')],_0xc30e5c['query']);_0x4c6cb0[_0xff24('0x48')]=_[_0xff24('0x46')](_0xc30e5c[_0xff24('0x47')],qs[_0xff24('0x49')](_0x37124b[_0xff24('0x45')]['fields']));_0x4c6cb0[_0xff24('0x48')]=_0x4c6cb0['attributes']['length']?_0x4c6cb0[_0xff24('0x48')]:_0xc30e5c[_0xff24('0x47')];if(_0x37124b[_0xff24('0x45')][_0xff24('0x55')]){_0x4c6cb0[_0xff24('0x56')]=[{'all':!![]}];}_0x4c6cb0=_[_0xff24('0x52')]({},_0x4c6cb0,_0x37124b[_0xff24('0x54')]);return db[_0xff24('0x41')][_0xff24('0x5a')](_0x4c6cb0)['then'](handleEntityNotFound(_0x93882c,null))[_0xff24('0x24')](respondWithResult(_0x93882c,null))[_0xff24('0x2d')](handleError(_0x93882c,null));};exports['create']=function(_0x7cea37,_0x2ece63){return db[_0xff24('0x41')]['create'](_0x7cea37[_0xff24('0x5b')],{})[_0xff24('0x24')](respondWithResult(_0x2ece63,0xc9))[_0xff24('0x2d')](handleError(_0x2ece63,null));};exports[_0xff24('0x5c')]=function(_0x4fb1cd,_0x17cabf){if(_0x4fb1cd[_0xff24('0x5b')]['id']){delete _0x4fb1cd[_0xff24('0x5b')]['id'];}return db[_0xff24('0x41')]['find']({'where':{'id':_0x4fb1cd[_0xff24('0x57')]['id']}})[_0xff24('0x24')](handleEntityNotFound(_0x17cabf,null))[_0xff24('0x24')](saveUpdates(_0x4fb1cd[_0xff24('0x5b')],null))['then'](respondWithResult(_0x17cabf,null))['catch'](handleError(_0x17cabf,null));};exports[_0xff24('0x3a')]=function(_0x44ea22,_0x5daa10){return db['ChatMessage']['find']({'where':{'id':_0x44ea22[_0xff24('0x57')]['id']}})[_0xff24('0x24')](handleEntityNotFound(_0x5daa10,null))[_0xff24('0x24')](removeEntity(_0x5daa10,null))[_0xff24('0x2d')](handleError(_0x5daa10,null));};exports[_0xff24('0x5d')]=function(_0x5aec20,_0x32be44){return db[_0xff24('0x41')][_0xff24('0x5d')]()['then'](respondWithResult(_0x32be44,null))['catch'](handleError(_0x32be44,null));};var interaction_log=require(_0xff24('0x14'))(_0xff24('0x5e'));exports[_0xff24('0x5f')]=function(_0x4956ed,_0x28e7f6,_0x5b7658){var _0xb51c29={'agent':{},'channel':_0xff24('0x60')};if(_0x4956ed[_0xff24('0x5b')]['id']){delete _0x4956ed[_0xff24('0x5b')]['id'];}_0x4956ed['body'][_0xff24('0x61')]=!![];_0x4956ed[_0xff24('0x5b')][_0xff24('0x62')]=moment()['format'](_0xff24('0x63'));_0x4956ed[_0xff24('0x5b')][_0xff24('0x64')]=_0x4956ed[_0xff24('0x5b')][_0xff24('0x64')]||_0x4956ed[_0xff24('0x65')]['id'];_0xb51c29[_0xff24('0x66')]['id']=_0x4956ed[_0xff24('0x5b')][_0xff24('0x64')];return db[_0xff24('0x41')][_0xff24('0x5a')]({'where':{'id':_0x4956ed[_0xff24('0x57')]['id'],'UserId':null}})[_0xff24('0x24')](handleEntityNotFound(_0x28e7f6,null))[_0xff24('0x24')](saveUpdates(_0x4956ed['body'],null))['then'](function(_0x5b598a){if(_0x5b598a){_0xb51c29[_0xff24('0x2c')]=_0x5b598a[_0xff24('0x67')]({'plain':!![]});return db['ChatInteraction'][_0xff24('0x5a')]({'where':{'id':_0x5b598a[_0xff24('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x28e7f6,null))[_0xff24('0x24')](function(_0x581dba){if(_0x581dba){return _0x581dba[_0xff24('0x5c')]({'UserId':_0x4956ed[_0xff24('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x581dba[_0xff24('0x69')])?moment()[_0xff24('0x6a')](_0xff24('0x63')):undefined});}return null;})['then'](function(_0xcfff2d){if(_0xcfff2d){_0xb51c29[_0xff24('0x6b')]=_0xcfff2d[_0xff24('0x67')]({'plain':!![]});interaction_log['info'](_0xff24('0x6c'),_0x4956ed[_0xff24('0x65')]['id'],_0x4956ed[_0xff24('0x65')][_0xff24('0x3d')],_0x4956ed[_0xff24('0x65')][_0xff24('0x6d')],_0xb51c29[_0xff24('0x6b')]['id'],_0x4956ed[_0xff24('0x5b')]?JSON[_0xff24('0x6e')](_0x4956ed[_0xff24('0x5b')]):_0xff24('0x6f'));return respondWithRpcPromise(_0xff24('0x70'),_0xff24('0x71'),_0xb51c29);}return null;})[_0xff24('0x24')](function(_0x20b494){var _0x5076a1=_0xff24('0x72')+_0x20b494[_0xff24('0x2c')][_0xff24('0x73')];return db[_0xff24('0x74')][_0xff24('0x45')](_0x5076a1,{'type':db[_0xff24('0x75')][_0xff24('0x76')]['SELECT'],'raw':!![]})[_0xff24('0x24')](function(_0xa5000b){return _0xa5000b;});})[_0xff24('0x24')](function(_0x396538){if(_0x396538){_0xb51c29[_0xff24('0x2c')][_0xff24('0x77')]=_0x396538[0x0];if(!_0x4956ed[_0xff24('0x5b')][_0xff24('0x64')])return;return db[_0xff24('0x78')][_0xff24('0x5a')]({'where':{'id':_0x4956ed[_0xff24('0x5b')][_0xff24('0x64')],'role':_0xff24('0x66')},'attributes':['id','name',_0xff24('0x79'),_0xff24('0x7a'),'internal'],'raw':!![]});}return null;})[_0xff24('0x24')](function(_0x143ffe){if(!_0x143ffe)return null;_0xb51c29[_0xff24('0x2c')][_0xff24('0x66')]=_0x143ffe;return _0xb51c29;})['then'](function(_0x3202de){if(_0x3202de){if(_0x4956ed[_0xff24('0x5b')][_0xff24('0x7b')]){_0xb51c29[_0xff24('0x2c')][_0xff24('0x7c')]=util['format'](_0xff24('0x7d'),_0x4956ed['user'][_0xff24('0x3d')]);_0xb51c29[_0xff24('0x2c')][_0xff24('0x7e')]=_0xb51c29[_0xff24('0x7e')];_0xb51c29[_0xff24('0x2c')][_0xff24('0x7f')]=_0xb51c29[_0xff24('0x7e')];_0xb51c29[_0xff24('0x2c')]['event']=_0xff24('0x5f');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0xff24('0x52')](_0xb51c29[_0xff24('0x2c')],JSON[_0xff24('0x80')](_0xb51c29[_0xff24('0x6b')][_0xff24('0x81')]))},client9002)[_0xff24('0x24')](function(){return _0xb51c29;});}return _0xb51c29;}return null;})[_0xff24('0x24')](respondWithResult(_0x28e7f6,null))['catch'](handleError(_0x28e7f6,null));};var interaction_log=require(_0xff24('0x14'))(_0xff24('0x5e'));exports[_0xff24('0x38')]=function(_0x13c9e5,_0x2f3be8,_0x4baab1){var _0xb6419c={'agent':{},'channel':_0xff24('0x60')};if(_0x13c9e5[_0xff24('0x5b')]['id']){delete _0x13c9e5[_0xff24('0x5b')]['id'];}_0x13c9e5['body'][_0xff24('0x64')]=_0x13c9e5[_0xff24('0x5b')][_0xff24('0x64')]||_0x13c9e5[_0xff24('0x65')]['id'];_0xb6419c[_0xff24('0x66')]['id']=_0x13c9e5['body'][_0xff24('0x64')];return db[_0xff24('0x41')][_0xff24('0x5a')]({'where':{'id':_0x13c9e5[_0xff24('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f3be8,null))[_0xff24('0x24')](function(_0x1c8f96){if(_0x1c8f96){_0xb6419c[_0xff24('0x2c')]=_0x1c8f96[_0xff24('0x67')]({'plain':!![]});return db[_0xff24('0x82')][_0xff24('0x5a')]({'where':{'id':_0x1c8f96[_0xff24('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x2f3be8,null))['then'](function(_0x4c5a4b){if(_0x4c5a4b){_0xb6419c['interaction']=_0x4c5a4b[_0xff24('0x67')]({'plain':!![]});interaction_log[_0xff24('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13c9e5[_0xff24('0x65')]['id'],_0x13c9e5['user'][_0xff24('0x3d')],_0x13c9e5[_0xff24('0x65')][_0xff24('0x6d')],_0xb6419c[_0xff24('0x6b')]['id'],_0x13c9e5[_0xff24('0x5b')]?JSON[_0xff24('0x6e')](_0x13c9e5[_0xff24('0x5b')]):_0xff24('0x6f'));return respondWithRpcPromise(_0xff24('0x83'),'rejectMessage',_0xb6419c);}return null;})[_0xff24('0x24')](function(_0x53b161){var _0x1ae455=_0xff24('0x72')+_0x53b161[_0xff24('0x2c')]['ContactId'];return db[_0xff24('0x74')]['query'](_0x1ae455,{'type':db[_0xff24('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0xff24('0x24')](function(_0x34cfc6){return _0x34cfc6;});})['then'](function(_0x1ddab7){if(_0x1ddab7){_0xb6419c[_0xff24('0x2c')][_0xff24('0x77')]=_0x1ddab7[0x0];if(!_0x13c9e5[_0xff24('0x5b')]['UserId'])return;return db[_0xff24('0x78')]['find']({'where':{'id':_0x13c9e5[_0xff24('0x5b')][_0xff24('0x64')],'role':_0xff24('0x66')},'attributes':['id',_0xff24('0x3d'),_0xff24('0x79'),_0xff24('0x7a'),'internal'],'raw':!![]});}return null;})[_0xff24('0x24')](function(_0x5f3de5){if(!_0x5f3de5)return null;_0xb6419c[_0xff24('0x2c')][_0xff24('0x66')]=_0x5f3de5;return _0xb6419c;})['then'](function(_0x44f2ea){if(_0x44f2ea){_0x44f2ea[_0xff24('0x2c')][_0xff24('0x7c')]=util[_0xff24('0x6a')]('SIP/%s',_0x13c9e5[_0xff24('0x65')][_0xff24('0x3d')]);_0x44f2ea['message'][_0xff24('0x7e')]=_0xb6419c[_0xff24('0x7e')];_0x44f2ea[_0xff24('0x2c')][_0xff24('0x7f')]=_0xb6419c[_0xff24('0x7e')];_0x44f2ea[_0xff24('0x2c')][_0xff24('0x84')]=_0xff24('0x38');respondWithRpcPromise('EventManager',_0xff24('0x85'),{'event':'rejectmessage','message':_[_0xff24('0x52')](_0xb6419c[_0xff24('0x2c')],JSON[_0xff24('0x80')](_0xb6419c['interaction'][_0xff24('0x81')]))},client9002);return _0xb6419c;}return null;})[_0xff24('0x24')](respondWithResult(_0x2f3be8,null))['catch'](handleError(_0x2f3be8,null));}; \ No newline at end of file +var _0xcafa=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteractionId','isNil','interaction','get','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','formData','ChatInteraction','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','event','parse','eml-format','fast-json-patch','request-promise','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/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','describe','chat-interactions','accept','chat','read'];(function(_0x13c12b,_0x4baa0d){var _0x4fcf37=function(_0xcd644e){while(--_0xcd644e){_0x13c12b['push'](_0x13c12b['shift']());}};_0x4fcf37(++_0x4baa0d);}(_0xcafa,0x1b2));var _0xacaf=function(_0x4df801,_0x42a009){_0x4df801=_0x4df801-0x0;var _0x170804=_0xcafa[_0x4df801];return _0x170804;};'use strict';var emlformat=require(_0xacaf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacaf('0x1'));var rp=require(_0xacaf('0x2'));var moment=require('moment');var BPromise=require(_0xacaf('0x3'));var Mustache=require(_0xacaf('0x4'));var util=require(_0xacaf('0x5'));var path=require(_0xacaf('0x6'));var sox=require('sox');var csv=require(_0xacaf('0x7'));var ejs=require(_0xacaf('0x8'));var fs=require('fs');var fs_extra=require(_0xacaf('0x9'));var _=require(_0xacaf('0xa'));var squel=require(_0xacaf('0xb'));var crypto=require(_0xacaf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xacaf('0xd'));var toCsv=require(_0xacaf('0x7'));var querystring=require(_0xacaf('0xe'));var Papa=require('papaparse');var Redis=require(_0xacaf('0xf'));var authService=require(_0xacaf('0x10'));var qs=require(_0xacaf('0x11'));var as=require(_0xacaf('0x12'));var hardwareService=require(_0xacaf('0x13'));var logger=require(_0xacaf('0x14'))(_0xacaf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xacaf('0x16'));var db=require(_0xacaf('0x17'))['db'];config[_0xacaf('0x18')]=_[_0xacaf('0x19')](config[_0xacaf('0x18')],{'host':_0xacaf('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacaf('0x18')]));require('./chatMessage.socket')[_0xacaf('0x1b')](socket);var jayson=require(_0xacaf('0x1c'));var client=jayson[_0xacaf('0x1d')][_0xacaf('0x1e')]({'port':0x232c});var client9002=jayson[_0xacaf('0x1d')][_0xacaf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x55ee74,_0x4c7a47,_0x59b3a7,_0x5afa65){return new BPromise(function(_0x32cb21,_0x37214f){var _0x57f2c5=_0x5afa65||client;return _0x57f2c5[_0xacaf('0x1f')](_0x55ee74,_0x59b3a7)[_0xacaf('0x20')](function(_0x4a384b){logger['info']('ChatMessage,\x20%s,\x20%s',_0x4c7a47,_0xacaf('0x21'));logger[_0xacaf('0x22')](_0xacaf('0x23'),_0x4c7a47,'request\x20sent',JSON[_0xacaf('0x24')](_0x4a384b));if(_0x4a384b[_0xacaf('0x25')]){if(_0x4a384b[_0xacaf('0x25')]['code']===0x1f4){logger[_0xacaf('0x25')](_0xacaf('0x26'),_0x4c7a47,_0x4a384b[_0xacaf('0x25')]['message']);return _0x37214f(_0x4a384b['error'][_0xacaf('0x27')]);}logger[_0xacaf('0x25')](_0xacaf('0x26'),_0x4c7a47,_0x4a384b[_0xacaf('0x25')][_0xacaf('0x27')]);return _0x32cb21(_0x4a384b[_0xacaf('0x25')][_0xacaf('0x27')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4c7a47,_0xacaf('0x21'));_0x32cb21(_0x4a384b[_0xacaf('0x28')][_0xacaf('0x27')]);}})[_0xacaf('0x29')](function(_0x344d5d){logger[_0xacaf('0x25')](_0xacaf('0x26'),_0x4c7a47,_0x344d5d);_0x37214f(_0x344d5d);});});}function respondWithStatusCode(_0x4233fa,_0xff255c){_0xff255c=_0xff255c||0xcc;return function(_0x281427){if(_0x281427){return _0x4233fa[_0xacaf('0x2a')](_0xff255c);}return _0x4233fa[_0xacaf('0x2b')](_0xff255c)['end']();};}function respondWithResult(_0x271a54,_0x425585){_0x425585=_0x425585||0xc8;return function(_0x5f331f){if(_0x5f331f){return _0x271a54[_0xacaf('0x2b')](_0x425585)[_0xacaf('0x2c')](_0x5f331f);}};}function respondWithFilteredResult(_0x648310,_0x4eb775){return function(_0x5b299d){if(_0x5b299d){var _0x5d0233=typeof _0x4eb775[_0xacaf('0x2d')]===_0xacaf('0x2e')&&typeof _0x4eb775[_0xacaf('0x2f')]==='undefined';var _0x1072ed=_0x5b299d[_0xacaf('0x30')];var _0x96da17=_0x5d0233?0x0:_0x4eb775['offset'];var _0xab2103=_0x5d0233?_0x5b299d[_0xacaf('0x30')]:_0x4eb775[_0xacaf('0x2d')]+_0x4eb775[_0xacaf('0x2f')];var _0x13e944;if(_0xab2103>=_0x1072ed){_0xab2103=_0x1072ed;_0x13e944=0xc8;}else{_0x13e944=0xce;}_0x648310['status'](_0x13e944);return _0x648310['set'](_0xacaf('0x31'),_0x96da17+'-'+_0xab2103+'/'+_0x1072ed)['json'](_0x5b299d);}return null;};}function patchUpdates(_0x323b1a){return function(_0x34d403){try{jsonpatch[_0xacaf('0x32')](_0x34d403,_0x323b1a,!![]);}catch(_0x4d8832){return BPromise[_0xacaf('0x33')](_0x4d8832);}return _0x34d403['save']();};}function saveUpdates(_0x566420,_0x343230){return function(_0x45ff9f){if(_0x45ff9f){return _0x45ff9f[_0xacaf('0x34')](_0x566420)[_0xacaf('0x20')](function(_0x8965f2){return _0x8965f2;});}return null;};}function removeEntity(_0x2f9e76,_0x321fc4){return function(_0x460b00){if(_0x460b00){return _0x460b00[_0xacaf('0x35')]()['then'](function(){_0x2f9e76[_0xacaf('0x2b')](0xcc)[_0xacaf('0x36')]();});}};}function handleEntityNotFound(_0x424600,_0x5c0d46){return function(_0x1204e4){if(!_0x1204e4){_0x424600['sendStatus'](0x194);}return _0x1204e4;};}function handleError(_0x2ddb19,_0x44bfed){_0x44bfed=_0x44bfed||0x1f4;return function(_0xeb5766){logger['error'](_0xeb5766['stack']);if(_0xeb5766[_0xacaf('0x37')]){delete _0xeb5766[_0xacaf('0x37')];}_0x2ddb19[_0xacaf('0x2b')](_0x44bfed)[_0xacaf('0x38')](_0xeb5766);};}exports[_0xacaf('0x39')]=function(_0x5e9cf0,_0x4e70b3){var _0x2b589d={},_0xf23554={},_0x4e4866={'count':0x0,'rows':[]};var _0xa85de3=_['map'](db[_0xacaf('0x3a')][_0xacaf('0x3b')],function(_0x1400af){return{'name':_0x1400af[_0xacaf('0x3c')],'type':_0x1400af[_0xacaf('0x3d')]['key']};});_0xf23554[_0xacaf('0x3e')]=_[_0xacaf('0x3f')](_0xa85de3,_0xacaf('0x37'));_0xf23554['query']=_['keys'](_0x5e9cf0[_0xacaf('0x40')]);_0xf23554[_0xacaf('0x41')]=_['intersection'](_0xf23554[_0xacaf('0x3e')],_0xf23554[_0xacaf('0x40')]);_0x2b589d[_0xacaf('0x42')]=_[_0xacaf('0x43')](_0xf23554[_0xacaf('0x3e')],qs[_0xacaf('0x44')](_0x5e9cf0[_0xacaf('0x40')]['fields']));_0x2b589d[_0xacaf('0x42')]=_0x2b589d[_0xacaf('0x42')][_0xacaf('0x45')]?_0x2b589d['attributes']:_0xf23554[_0xacaf('0x3e')];if(!_0x5e9cf0['query'][_0xacaf('0x46')](_0xacaf('0x47'))){_0x2b589d['limit']=qs[_0xacaf('0x2f')](_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x2f')]);_0x2b589d['offset']=qs[_0xacaf('0x2d')](_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x2d')]);}_0x2b589d[_0xacaf('0x48')]=qs[_0xacaf('0x49')](_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x49')]);_0x2b589d[_0xacaf('0x4a')]=qs[_0xacaf('0x41')](_['pick'](_0x5e9cf0['query'],_0xf23554[_0xacaf('0x41')]),_0xa85de3);if(_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x4b')]){_0x2b589d[_0xacaf('0x4a')]=_[_0xacaf('0x4c')](_0x2b589d[_0xacaf('0x4a')],{'$or':_[_0xacaf('0x3f')](_0xa85de3,function(_0x15e803){if(_0x15e803[_0xacaf('0x3d')]!==_0xacaf('0x4d')){var _0x4466b3={};_0x4466b3[_0x15e803[_0xacaf('0x37')]]={'$like':'%'+_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x4b')]+'%'};return _0x4466b3;}})});}_0x2b589d=_[_0xacaf('0x4c')]({},_0x2b589d,_0x5e9cf0[_0xacaf('0x4e')]);var _0x322770={'where':_0x2b589d[_0xacaf('0x4a')]};return db[_0xacaf('0x3a')][_0xacaf('0x30')](_0x322770)[_0xacaf('0x20')](function(_0x2ee32e){_0x4e4866[_0xacaf('0x30')]=_0x2ee32e;if(_0x5e9cf0[_0xacaf('0x40')][_0xacaf('0x4f')]){_0x2b589d['include']=[{'all':!![]}];}return db[_0xacaf('0x3a')][_0xacaf('0x50')](_0x2b589d);})[_0xacaf('0x20')](function(_0x34b5a5){_0x4e4866[_0xacaf('0x51')]=_0x34b5a5;return _0x4e4866;})[_0xacaf('0x20')](respondWithFilteredResult(_0x4e70b3,_0x2b589d))[_0xacaf('0x29')](handleError(_0x4e70b3,null));};exports[_0xacaf('0x52')]=function(_0x5e6e46,_0x555238){var _0x242d81={'raw':!![],'where':{'id':_0x5e6e46[_0xacaf('0x53')]['id']}},_0x49a628={};_0x49a628[_0xacaf('0x3e')]=_[_0xacaf('0x54')](db[_0xacaf('0x3a')][_0xacaf('0x3b')]);_0x49a628[_0xacaf('0x40')]=_[_0xacaf('0x54')](_0x5e6e46['query']);_0x49a628[_0xacaf('0x41')]=_[_0xacaf('0x43')](_0x49a628[_0xacaf('0x3e')],_0x49a628[_0xacaf('0x40')]);_0x242d81[_0xacaf('0x42')]=_['intersection'](_0x49a628['model'],qs[_0xacaf('0x44')](_0x5e6e46[_0xacaf('0x40')][_0xacaf('0x44')]));_0x242d81[_0xacaf('0x42')]=_0x242d81[_0xacaf('0x42')]['length']?_0x242d81[_0xacaf('0x42')]:_0x49a628[_0xacaf('0x3e')];if(_0x5e6e46[_0xacaf('0x40')]['includeAll']){_0x242d81[_0xacaf('0x55')]=[{'all':!![]}];}_0x242d81=_[_0xacaf('0x4c')]({},_0x242d81,_0x5e6e46['options']);return db[_0xacaf('0x3a')][_0xacaf('0x56')](_0x242d81)[_0xacaf('0x20')](handleEntityNotFound(_0x555238,null))[_0xacaf('0x20')](respondWithResult(_0x555238,null))[_0xacaf('0x29')](handleError(_0x555238,null));};exports[_0xacaf('0x57')]=function(_0x2f56a5,_0x3ae6f8){return db[_0xacaf('0x3a')][_0xacaf('0x57')](_0x2f56a5[_0xacaf('0x58')],{})[_0xacaf('0x20')](respondWithResult(_0x3ae6f8,0xc9))[_0xacaf('0x29')](handleError(_0x3ae6f8,null));};exports[_0xacaf('0x34')]=function(_0x760309,_0x37043a){if(_0x760309[_0xacaf('0x58')]['id']){delete _0x760309[_0xacaf('0x58')]['id'];}return db[_0xacaf('0x3a')][_0xacaf('0x56')]({'where':{'id':_0x760309['params']['id']}})['then'](handleEntityNotFound(_0x37043a,null))[_0xacaf('0x20')](saveUpdates(_0x760309[_0xacaf('0x58')],null))['then'](respondWithResult(_0x37043a,null))[_0xacaf('0x29')](handleError(_0x37043a,null));};exports[_0xacaf('0x35')]=function(_0x4566f8,_0x5f10ea){return db[_0xacaf('0x3a')]['find']({'where':{'id':_0x4566f8['params']['id']}})['then'](handleEntityNotFound(_0x5f10ea,null))[_0xacaf('0x20')](removeEntity(_0x5f10ea,null))[_0xacaf('0x29')](handleError(_0x5f10ea,null));};exports[_0xacaf('0x59')]=function(_0x28c70f,_0x3b939b){return db[_0xacaf('0x3a')]['describe']()[_0xacaf('0x20')](respondWithResult(_0x3b939b,null))['catch'](handleError(_0x3b939b,null));};var interaction_log=require('../../config/logger')(_0xacaf('0x5a'));exports[_0xacaf('0x5b')]=function(_0x524da3,_0xd43a40,_0xc260a7){var _0x272048={'agent':{},'channel':_0xacaf('0x5c')};if(_0x524da3[_0xacaf('0x58')]['id']){delete _0x524da3['body']['id'];}_0x524da3[_0xacaf('0x58')][_0xacaf('0x5d')]=!![];_0x524da3[_0xacaf('0x58')][_0xacaf('0x5e')]=moment()[_0xacaf('0x5f')](_0xacaf('0x60'));_0x524da3[_0xacaf('0x58')][_0xacaf('0x61')]=_0x524da3[_0xacaf('0x58')]['UserId']||_0x524da3[_0xacaf('0x62')]['id'];_0x272048['agent']['id']=_0x524da3[_0xacaf('0x58')][_0xacaf('0x61')];return db[_0xacaf('0x3a')][_0xacaf('0x56')]({'where':{'id':_0x524da3[_0xacaf('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd43a40,null))[_0xacaf('0x20')](saveUpdates(_0x524da3[_0xacaf('0x58')],null))['then'](function(_0x1ac92e){if(_0x1ac92e){_0x272048[_0xacaf('0x27')]=_0x1ac92e['get']({'plain':!![]});return db['ChatInteraction'][_0xacaf('0x56')]({'where':{'id':_0x1ac92e[_0xacaf('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xd43a40,null))[_0xacaf('0x20')](function(_0xdf85fa){if(_0xdf85fa){return _0xdf85fa['update']({'UserId':_0x524da3['body'][_0xacaf('0x61')],'read1stAt':_[_0xacaf('0x64')](_0xdf85fa['read1stAt'])?moment()[_0xacaf('0x5f')](_0xacaf('0x60')):undefined});}return null;})[_0xacaf('0x20')](function(_0x4b962a){if(_0x4b962a){_0x272048[_0xacaf('0x65')]=_0x4b962a[_0xacaf('0x66')]({'plain':!![]});interaction_log[_0xacaf('0x67')](_0xacaf('0x68'),_0x524da3[_0xacaf('0x62')]['id'],_0x524da3[_0xacaf('0x62')]['name'],_0x524da3[_0xacaf('0x62')][_0xacaf('0x69')],_0x272048['interaction']['id'],_0x524da3[_0xacaf('0x58')]?JSON[_0xacaf('0x24')](_0x524da3[_0xacaf('0x58')]):_0xacaf('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xacaf('0x6b'),_0x272048);}return null;})[_0xacaf('0x20')](function(_0x32064f){var _0x12ae04=_0xacaf('0x6c')+_0x32064f[_0xacaf('0x27')]['ContactId'];return db['sequelize'][_0xacaf('0x40')](_0x12ae04,{'type':db['Sequelize'][_0xacaf('0x6d')]['SELECT'],'raw':!![]})[_0xacaf('0x20')](function(_0x4558bd){return _0x4558bd;});})['then'](function(_0x52346f){if(_0x52346f){_0x272048[_0xacaf('0x27')][_0xacaf('0x6e')]=_0x52346f[0x0];if(!_0x524da3[_0xacaf('0x58')][_0xacaf('0x61')])return;return db[_0xacaf('0x6f')][_0xacaf('0x56')]({'where':{'id':_0x524da3['body'][_0xacaf('0x61')],'role':'agent'},'attributes':['id',_0xacaf('0x37'),_0xacaf('0x70'),_0xacaf('0x71'),_0xacaf('0x72')],'raw':!![]});}return null;})[_0xacaf('0x20')](function(_0x3b32cb){if(!_0x3b32cb)return null;_0x272048[_0xacaf('0x27')][_0xacaf('0x73')]=_0x3b32cb;return _0x272048;})[_0xacaf('0x20')](function(_0x1c35ec){if(_0x1c35ec){if(_0x524da3['body'][_0xacaf('0x74')]){_0x272048[_0xacaf('0x27')][_0xacaf('0x75')]=util[_0xacaf('0x5f')](_0xacaf('0x76'),_0x524da3['user']['name']);_0x272048[_0xacaf('0x27')][_0xacaf('0x77')]=_0x272048[_0xacaf('0x77')];_0x272048[_0xacaf('0x27')][_0xacaf('0x78')]=_0x272048[_0xacaf('0x77')];_0x272048[_0xacaf('0x27')]['event']='accept';return respondWithRpcPromise(_0xacaf('0x79'),_0xacaf('0x79'),{'event':_0xacaf('0x7a'),'message':_[_0xacaf('0x4c')](_0x272048['message'],JSON['parse'](_0x272048['interaction'][_0xacaf('0x7b')]))},client9002)['then'](function(){return _0x272048;});}return _0x272048;}return null;})[_0xacaf('0x20')](respondWithResult(_0xd43a40,null))[_0xacaf('0x29')](handleError(_0xd43a40,null));};var interaction_log=require(_0xacaf('0x14'))(_0xacaf('0x5a'));exports[_0xacaf('0x33')]=function(_0x47d9db,_0x36b113,_0x2f17b5){var _0x1ee7d3={'agent':{},'channel':_0xacaf('0x5c')};if(_0x47d9db[_0xacaf('0x58')]['id']){delete _0x47d9db[_0xacaf('0x58')]['id'];}_0x47d9db[_0xacaf('0x58')][_0xacaf('0x61')]=_0x47d9db['body']['UserId']||_0x47d9db[_0xacaf('0x62')]['id'];_0x1ee7d3[_0xacaf('0x73')]['id']=_0x47d9db[_0xacaf('0x58')][_0xacaf('0x61')];return db['ChatMessage'][_0xacaf('0x56')]({'where':{'id':_0x47d9db[_0xacaf('0x53')]['id'],'UserId':null}})[_0xacaf('0x20')](handleEntityNotFound(_0x36b113,null))['then'](function(_0x3e25b2){if(_0x3e25b2){_0x1ee7d3[_0xacaf('0x27')]=_0x3e25b2[_0xacaf('0x66')]({'plain':!![]});return db[_0xacaf('0x7c')][_0xacaf('0x56')]({'where':{'id':_0x3e25b2[_0xacaf('0x63')]}});}return null;})[_0xacaf('0x20')](handleEntityNotFound(_0x36b113,null))[_0xacaf('0x20')](function(_0x57a84c){if(_0x57a84c){_0x1ee7d3[_0xacaf('0x65')]=_0x57a84c[_0xacaf('0x66')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47d9db[_0xacaf('0x62')]['id'],_0x47d9db[_0xacaf('0x62')][_0xacaf('0x37')],_0x47d9db[_0xacaf('0x62')][_0xacaf('0x69')],_0x1ee7d3[_0xacaf('0x65')]['id'],_0x47d9db['body']?JSON[_0xacaf('0x24')](_0x47d9db[_0xacaf('0x58')]):_0xacaf('0x6a'));return respondWithRpcPromise(_0xacaf('0x7d'),_0xacaf('0x7e'),_0x1ee7d3);}return null;})[_0xacaf('0x20')](function(_0x566960){var _0x18498a=_0xacaf('0x6c')+_0x566960[_0xacaf('0x27')][_0xacaf('0x7f')];return db[_0xacaf('0x80')]['query'](_0x18498a,{'type':db[_0xacaf('0x81')][_0xacaf('0x6d')]['SELECT'],'raw':!![]})[_0xacaf('0x20')](function(_0x13a522){return _0x13a522;});})[_0xacaf('0x20')](function(_0x3a6ead){if(_0x3a6ead){_0x1ee7d3[_0xacaf('0x27')]['contact']=_0x3a6ead[0x0];if(!_0x47d9db[_0xacaf('0x58')][_0xacaf('0x61')])return;return db[_0xacaf('0x6f')][_0xacaf('0x56')]({'where':{'id':_0x47d9db[_0xacaf('0x58')][_0xacaf('0x61')],'role':_0xacaf('0x73')},'attributes':['id',_0xacaf('0x37'),_0xacaf('0x70'),'email',_0xacaf('0x72')],'raw':!![]});}return null;})[_0xacaf('0x20')](function(_0x3b19f6){if(!_0x3b19f6)return null;_0x1ee7d3[_0xacaf('0x27')]['agent']=_0x3b19f6;return _0x1ee7d3;})[_0xacaf('0x20')](function(_0xe85d73){if(_0xe85d73){_0xe85d73[_0xacaf('0x27')]['interface']=util[_0xacaf('0x5f')](_0xacaf('0x76'),_0x47d9db[_0xacaf('0x62')][_0xacaf('0x37')]);_0xe85d73['message'][_0xacaf('0x77')]=_0x1ee7d3[_0xacaf('0x77')];_0xe85d73['message'][_0xacaf('0x78')]=_0x1ee7d3[_0xacaf('0x77')];_0xe85d73[_0xacaf('0x27')][_0xacaf('0x82')]=_0xacaf('0x33');respondWithRpcPromise(_0xacaf('0x79'),_0xacaf('0x79'),{'event':'rejectmessage','message':_['merge'](_0x1ee7d3[_0xacaf('0x27')],JSON[_0xacaf('0x83')](_0x1ee7d3['interaction'][_0xacaf('0x7b')]))},client9002);return _0x1ee7d3;}return null;})[_0xacaf('0x20')](respondWithResult(_0x36b113,null))[_0xacaf('0x29')](handleError(_0x36b113,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0e2178b..8abbe36 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 _0x6c0f=['events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x5b984b,_0x355e68){var _0x52e07d=function(_0x5b5064){while(--_0x5b5064){_0x5b984b['push'](_0x5b984b['shift']());}};_0x52e07d(++_0x355e68);}(_0x6c0f,0x19d));var _0xf6c0=function(_0x243aaf,_0x17de07){_0x243aaf=_0x243aaf-0x0;var _0x29133f=_0x6c0f[_0x243aaf];return _0x29133f;};'use strict';var EventEmitter=require(_0xf6c0('0x0'));var ChatMessage=require(_0xf6c0('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf6c0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf6c0('0x3')};function emitEvent(_0x1617e9){return function(_0x5245ca,_0x586ce0,_0x3b1462){ChatMessageEvents[_0xf6c0('0x4')](_0x1617e9+':'+_0x5245ca['id'],_0x5245ca);ChatMessageEvents[_0xf6c0('0x4')](_0x1617e9,_0x5245ca);_0x3b1462(null);};}for(var e in events){if(events[_0xf6c0('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xf6c0('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x6ca6=['events','../../mysqldb','ChatMessage','setMaxListeners','emit','hook'];(function(_0x4bbce6,_0x554194){var _0x33ab0a=function(_0x8f9f9c){while(--_0x8f9f9c){_0x4bbce6['push'](_0x4bbce6['shift']());}};_0x33ab0a(++_0x554194);}(_0x6ca6,0x1da));var _0x66ca=function(_0x47f1b8,_0x2becb2){_0x47f1b8=_0x47f1b8-0x0;var _0x20b5cf=_0x6ca6[_0x47f1b8];return _0x20b5cf;};'use strict';var EventEmitter=require(_0x66ca('0x0'));var ChatMessage=require(_0x66ca('0x1'))['db'][_0x66ca('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x66ca('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19bd3b){return function(_0x5473ff,_0x1c83c5,_0x2d7b15){ChatMessageEvents[_0x66ca('0x4')](_0x19bd3b+':'+_0x5473ff['id'],_0x5473ff);ChatMessageEvents['emit'](_0x19bd3b,_0x5473ff);_0x2d7b15(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x66ca('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5700c10..024ff43 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 _0xcebf=['toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction'];(function(_0xd10f87,_0x23e287){var _0x50769d=function(_0x2e245e){while(--_0x2e245e){_0xd10f87['push'](_0xd10f87['shift']());}};_0x50769d(++_0x23e287);}(_0xcebf,0x1a0));var _0xfceb=function(_0x1beb7f,_0x1a5039){_0x1beb7f=_0x1beb7f-0x0;var _0x7b372f=_0xcebf[_0x1beb7f];return _0x7b372f;};'use strict';var _=require('lodash');var util=require(_0xfceb('0x0'));var logger=require(_0xfceb('0x1'))(_0xfceb('0x2'));var moment=require(_0xfceb('0x3'));var BPromise=require(_0xfceb('0x4'));var rp=require(_0xfceb('0x5'));var fs=require('fs');var path=require(_0xfceb('0x6'));var rimraf=require(_0xfceb('0x7'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xfceb('0x8')]=function(_0x7cd28d,_0x54b077){return _0x7cd28d[_0xfceb('0x9')](_0xfceb('0xa'),attributes,{'tableName':_0xfceb('0xb'),'paranoid':![],'indexes':[{'name':_0xfceb('0xc'),'fields':[_0xfceb('0xd')],'type':_0xfceb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4abbae,_0x6c902e,_0x13a2f9){var _0x8ab13=_0x7cd28d[_0xfceb('0xf')];var _0x387da0=_0x4abbae[_0xfceb('0x10')]({'plain':!![]});if(_0x387da0[_0xfceb('0x11')][_0xfceb('0x12')]()==='in'||_0x387da0[_0xfceb('0x11')]['toLowerCase']()===_0xfceb('0x13')&&!_0x387da0[_0xfceb('0x14')]&&!_['isNil'](_0x387da0[_0xfceb('0x15')])){_0x8ab13[_0xfceb('0x16')][_0xfceb('0x17')]({'where':{'id':_0x387da0[_0xfceb('0x18')]}})[_0xfceb('0x19')](function(_0x4aff91){if(_0x4aff91){_0x4aff91[_0xfceb('0x1a')]({'lastMsgAt':_0x387da0['createdAt'],'lastMsgDirection':_0x387da0['direction'][_0xfceb('0x12')]()});}})[_0xfceb('0x1b')](function(_0x462a2b){console[_0xfceb('0x1c')](_0x462a2b);});}_0x13a2f9();}},'charset':_0xfceb('0x1d'),'collate':_0xfceb('0x1e')});}; \ No newline at end of file +var _0xab55=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','createdAt','catch'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xab55,0x139));var _0x5ab5=function(_0x369dc5,_0x5aae04){_0x369dc5=_0x369dc5-0x0;var _0x5d87fd=_0xab55[_0x369dc5];return _0x5d87fd;};'use strict';var _=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var logger=require(_0x5ab5('0x2'))(_0x5ab5('0x3'));var moment=require('moment');var BPromise=require(_0x5ab5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ab5('0x5'));var rimraf=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var attributes=require(_0x5ab5('0x8'));module[_0x5ab5('0x9')]=function(_0x37fce1,_0x27d170){return _0x37fce1[_0x5ab5('0xa')](_0x5ab5('0xb'),attributes,{'tableName':_0x5ab5('0xc'),'paranoid':![],'indexes':[{'name':_0x5ab5('0xd'),'fields':[_0x5ab5('0xe')],'type':_0x5ab5('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x854251,_0x1b7e1e,_0x406a75){var _0x50efd0=_0x37fce1[_0x5ab5('0x10')];var _0xb83553=_0x854251['get']({'plain':!![]});if(_0xb83553[_0x5ab5('0x11')][_0x5ab5('0x12')]()==='in'||_0xb83553[_0x5ab5('0x11')][_0x5ab5('0x12')]()===_0x5ab5('0x13')&&!_0xb83553[_0x5ab5('0x14')]&&!_[_0x5ab5('0x15')](_0xb83553[_0x5ab5('0x16')])){_0x50efd0['ChatInteraction'][_0x5ab5('0x17')]({'where':{'id':_0xb83553[_0x5ab5('0x18')]}})[_0x5ab5('0x19')](function(_0x1eb597){if(_0x1eb597){_0x1eb597['update']({'lastMsgAt':_0xb83553[_0x5ab5('0x1a')],'lastMsgDirection':_0xb83553['direction'][_0x5ab5('0x12')]()});}})[_0x5ab5('0x1b')](function(_0xd48f81){console[_0x5ab5('0x1c')](_0xd48f81);});}_0x406a75();}},'charset':_0x5ab5('0x1d'),'collate':_0x5ab5('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 61069cb..7965fde 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 _0x6d84=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','body','options','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3423eb,_0x139bdf){var _0x203dba=function(_0x2ef1b8){while(--_0x2ef1b8){_0x3423eb['push'](_0x3423eb['shift']());}};_0x203dba(++_0x139bdf);}(_0x6d84,0x90));var _0x46d8=function(_0x32d71a,_0xa64abd){_0x32d71a=_0x32d71a-0x0;var _0x5e2cb1=_0x6d84[_0x32d71a];return _0x5e2cb1;};'use strict';var _=require(_0x46d8('0x0'));var util=require(_0x46d8('0x1'));var moment=require(_0x46d8('0x2'));var BPromise=require(_0x46d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46d8('0x5'))(_0x46d8('0x6'));var config=require(_0x46d8('0x7'));var jayson=require(_0x46d8('0x8'));var client=jayson[_0x46d8('0x9')][_0x46d8('0xa')]({'port':0x232a});config[_0x46d8('0xb')]=_[_0x46d8('0xc')](config[_0x46d8('0xb')],{'host':_0x46d8('0xd'),'port':0x18eb});var socket=require(_0x46d8('0xe'))(new Redis(config[_0x46d8('0xb')]));require(_0x46d8('0xf'))[_0x46d8('0x10')](socket);function respondWithRpcPromise(_0x216b44,_0x4d2a7b,_0x2a459f){return new BPromise(function(_0x3f0d53,_0x537e63){return client['request'](_0x216b44,_0x2a459f)[_0x46d8('0x11')](function(_0x2056a2){logger[_0x46d8('0x12')](_0x46d8('0x13'),_0x4d2a7b,_0x46d8('0x14'));logger[_0x46d8('0x15')](_0x46d8('0x16'),_0x4d2a7b,'request\x20sent',JSON[_0x46d8('0x17')](_0x2056a2));if(_0x2056a2['error']){if(_0x2056a2[_0x46d8('0x18')][_0x46d8('0x19')]===0x1f4){logger[_0x46d8('0x18')](_0x46d8('0x13'),_0x4d2a7b,_0x2056a2[_0x46d8('0x18')]['message']);return _0x537e63(_0x2056a2[_0x46d8('0x18')][_0x46d8('0x1a')]);}logger[_0x46d8('0x18')](_0x46d8('0x13'),_0x4d2a7b,_0x2056a2[_0x46d8('0x18')]['message']);return _0x3f0d53(_0x2056a2[_0x46d8('0x18')]['message']);}else{logger[_0x46d8('0x12')](_0x46d8('0x13'),_0x4d2a7b,_0x46d8('0x14'));_0x3f0d53(_0x2056a2[_0x46d8('0x1b')][_0x46d8('0x1a')]);}})['catch'](function(_0x33096c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4d2a7b,_0x33096c);_0x537e63(_0x33096c);});});}exports[_0x46d8('0x1c')]=function(_0x5ad126){var _0x192ad5=this;return new Promise(function(_0xbe3489,_0x1a7570){return db[_0x46d8('0x1d')][_0x46d8('0x1e')](_0x5ad126[_0x46d8('0x1f')],{'raw':_0x5ad126[_0x46d8('0x20')]?_0x5ad126[_0x46d8('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x46d8('0x11')](function(_0x17d720){logger[_0x46d8('0x12')](_0x46d8('0x1c'),_0x5ad126);logger['debug'](_0x46d8('0x1c'),_0x5ad126,JSON[_0x46d8('0x17')](_0x17d720));_0xbe3489(_0x17d720);})['catch'](function(_0x54b55a){logger[_0x46d8('0x18')](_0x46d8('0x1c'),_0x54b55a[_0x46d8('0x1a')],_0x5ad126);_0x1a7570(_0x192ad5[_0x46d8('0x18')](0x1f4,_0x54b55a[_0x46d8('0x1a')]));});});}; \ No newline at end of file +var _0xe049=['defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage','create','options','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x47b195,_0x2e9369){var _0x878628=function(_0x3d02f2){while(--_0x3d02f2){_0x47b195['push'](_0x47b195['shift']());}};_0x878628(++_0x2e9369);}(_0xe049,0x1f1));var _0x9e04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe049[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9e04('0x0'));var util=require(_0x9e04('0x1'));var moment=require(_0x9e04('0x2'));var BPromise=require(_0x9e04('0x3'));var rs=require(_0x9e04('0x4'));var fs=require('fs');var Redis=require(_0x9e04('0x5'));var db=require(_0x9e04('0x6'))['db'];var utils=require(_0x9e04('0x7'));var logger=require(_0x9e04('0x8'))(_0x9e04('0x9'));var config=require('../../config/environment');var jayson=require(_0x9e04('0xa'));var client=jayson[_0x9e04('0xb')]['http']({'port':0x232a});config[_0x9e04('0xc')]=_[_0x9e04('0xd')](config[_0x9e04('0xc')],{'host':_0x9e04('0xe'),'port':0x18eb});var socket=require(_0x9e04('0xf'))(new Redis(config[_0x9e04('0xc')]));require(_0x9e04('0x10'))[_0x9e04('0x11')](socket);function respondWithRpcPromise(_0x55410c,_0x2a3608,_0x57ede1){return new BPromise(function(_0x212fca,_0xe73d13){return client[_0x9e04('0x12')](_0x55410c,_0x57ede1)[_0x9e04('0x13')](function(_0xa48ed9){logger['info'](_0x9e04('0x14'),_0x2a3608,_0x9e04('0x15'));logger['debug'](_0x9e04('0x16'),_0x2a3608,_0x9e04('0x15'),JSON[_0x9e04('0x17')](_0xa48ed9));if(_0xa48ed9[_0x9e04('0x18')]){if(_0xa48ed9['error']['code']===0x1f4){logger[_0x9e04('0x18')]('ChatMessage,\x20%s,\x20%s',_0x2a3608,_0xa48ed9['error'][_0x9e04('0x19')]);return _0xe73d13(_0xa48ed9[_0x9e04('0x18')][_0x9e04('0x19')]);}logger[_0x9e04('0x18')](_0x9e04('0x14'),_0x2a3608,_0xa48ed9[_0x9e04('0x18')][_0x9e04('0x19')]);return _0x212fca(_0xa48ed9[_0x9e04('0x18')][_0x9e04('0x19')]);}else{logger[_0x9e04('0x1a')]('ChatMessage,\x20%s,\x20%s',_0x2a3608,_0x9e04('0x15'));_0x212fca(_0xa48ed9[_0x9e04('0x1b')][_0x9e04('0x19')]);}})['catch'](function(_0x4bd4a0){logger['error'](_0x9e04('0x14'),_0x2a3608,_0x4bd4a0);_0xe73d13(_0x4bd4a0);});});}exports[_0x9e04('0x1c')]=function(_0x591a51){var _0x1c98ac=this;return new Promise(function(_0x85d4cb,_0x179067){return db[_0x9e04('0x1d')][_0x9e04('0x1e')](_0x591a51['body'],{'raw':_0x591a51[_0x9e04('0x1f')]?_0x591a51[_0x9e04('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5183a7){logger[_0x9e04('0x1a')](_0x9e04('0x1c'),_0x591a51);logger[_0x9e04('0x20')]('CreateChatMessage',_0x591a51,JSON[_0x9e04('0x17')](_0x5183a7));_0x85d4cb(_0x5183a7);})[_0x9e04('0x21')](function(_0x1c32ee){logger['error'](_0x9e04('0x1c'),_0x1c32ee[_0x9e04('0x19')],_0x591a51);_0x179067(_0x1c98ac[_0x9e04('0x18')](0x1f4,_0x1c32ee[_0x9e04('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c9a0f2a..24de242 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 _0xdd0c=['save','remove','update','emit','removeListener','register','length'];(function(_0x3620a2,_0x345770){var _0x3ecc4f=function(_0x2892d9){while(--_0x2892d9){_0x3620a2['push'](_0x3620a2['shift']());}};_0x3ecc4f(++_0x345770);}(_0xdd0c,0x165));var _0xcdd0=function(_0xd1d583,_0xbe4851){_0xd1d583=_0xd1d583-0x0;var _0x434d34=_0xdd0c[_0xd1d583];return _0x434d34;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xcdd0('0x0'),_0xcdd0('0x1'),_0xcdd0('0x2')];function createListener(_0x5e3ada,_0xe8ed9){return function(_0x5b86cb){_0xe8ed9[_0xcdd0('0x3')](_0x5e3ada,_0x5b86cb);};}function removeListener(_0x159e38,_0x432716){return function(){ChatMessageEvents[_0xcdd0('0x4')](_0x159e38,_0x432716);};}exports[_0xcdd0('0x5')]=function(_0x5ae472){for(var _0x2b33fc=0x0,_0x1b6f5d=events[_0xcdd0('0x6')];_0x2b33fc<_0x1b6f5d;_0x2b33fc++){var _0x15c402=events[_0x2b33fc];var _0x337496=createListener('chatMessage:'+_0x15c402,_0x5ae472);ChatMessageEvents['on'](_0x15c402,_0x337496);}}; \ No newline at end of file +var _0x6379=['emit','removeListener','register','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6379,0x84));var _0x9637=function(_0x1e67d0,_0x2fcb30){_0x1e67d0=_0x1e67d0-0x0;var _0x551f3a=_0x6379[_0x1e67d0];return _0x551f3a;};'use strict';var ChatMessageEvents=require(_0x9637('0x0'));var events=[_0x9637('0x1'),_0x9637('0x2'),_0x9637('0x3')];function createListener(_0x19949a,_0x52d27e){return function(_0x44a9ae){_0x52d27e[_0x9637('0x4')](_0x19949a,_0x44a9ae);};}function removeListener(_0x5f1058,_0x5f50c5){return function(){ChatMessageEvents[_0x9637('0x5')](_0x5f1058,_0x5f50c5);};}exports[_0x9637('0x6')]=function(_0x19f7d0){for(var _0x25087c=0x0,_0xf0db9f=events['length'];_0x25087c<_0xf0db9f;_0x25087c++){var _0x515a84=events[_0x25087c];var _0x21d91b=createListener(_0x9637('0x7')+_0x515a84,_0x19f7d0);ChatMessageEvents['on'](_0x515a84,_0x21d91b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9f58097..50db555 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 _0x26d8=['reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','tracked','chat','create','put','/:id/accept','accept','/:id/reject'];(function(_0x359848,_0x4e288e){var _0x3943d2=function(_0x231872){while(--_0x231872){_0x359848['push'](_0x359848['shift']());}};_0x3943d2(++_0x4e288e);}(_0x26d8,0x19b));var _0x826d=function(_0x4df232,_0x1fcd0d){_0x4df232=_0x4df232-0x0;var _0x2b3cad=_0x26d8[_0x4df232];return _0x2b3cad;};'use strict';var multer=require(_0x826d('0x0'));var util=require(_0x826d('0x1'));var path=require(_0x826d('0x2'));var timeout=require(_0x826d('0x3'));var express=require(_0x826d('0x4'));var router=express[_0x826d('0x5')]();var fs_extra=require(_0x826d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x826d('0x7'));router['get']('/',auth[_0x826d('0x8')](),controller[_0x826d('0x9')]);router[_0x826d('0xa')](_0x826d('0xb'),auth[_0x826d('0x8')](),controller[_0x826d('0xc')]);router[_0x826d('0xa')](_0x826d('0xd'),auth[_0x826d('0x8')](),controller['show']);router['post']('/',auth[_0x826d('0x8')](),interaction[_0x826d('0xe')](_0x826d('0xf'),'chatmessage:create'),controller[_0x826d('0x10')]);router['put'](_0x826d('0xd'),controller['update']);router[_0x826d('0x11')](_0x826d('0x12'),auth[_0x826d('0x8')](),controller[_0x826d('0x13')]);router[_0x826d('0x11')](_0x826d('0x14'),auth[_0x826d('0x8')](),controller[_0x826d('0x15')]);router[_0x826d('0x16')](_0x826d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x826d('0x17')]=router; \ No newline at end of file +var _0xfb7a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xfb7a,0x9e));var _0xafb7=function(_0xf738ad,_0x5e1d7f){_0xf738ad=_0xf738ad-0x0;var _0x598570=_0xfb7a[_0xf738ad];return _0x598570;};'use strict';var multer=require(_0xafb7('0x0'));var util=require(_0xafb7('0x1'));var path=require(_0xafb7('0x2'));var timeout=require('connect-timeout');var express=require(_0xafb7('0x3'));var router=express[_0xafb7('0x4')]();var fs_extra=require(_0xafb7('0x5'));var auth=require(_0xafb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xafb7('0x7'));var controller=require('./chatMessage.controller');router[_0xafb7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xafb7('0x9'),auth['isAuthenticated'](),controller[_0xafb7('0xa')]);router[_0xafb7('0x8')](_0xafb7('0xb'),auth[_0xafb7('0xc')](),controller[_0xafb7('0xd')]);router[_0xafb7('0xe')]('/',auth[_0xafb7('0xc')](),interaction[_0xafb7('0xf')](_0xafb7('0x10'),_0xafb7('0x11')),controller[_0xafb7('0x12')]);router['put'](_0xafb7('0xb'),controller[_0xafb7('0x13')]);router[_0xafb7('0x14')](_0xafb7('0x15'),auth[_0xafb7('0xc')](),controller[_0xafb7('0x16')]);router[_0xafb7('0x14')](_0xafb7('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0xafb7('0x18')]('/:id',auth[_0xafb7('0xc')](),controller[_0xafb7('0x19')]);module[_0xafb7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 3dd6186..96cd2a0 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x0b0e[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x12eb3f,_0x3ce728){var _0x4d8e42=function(_0x597601){while(--_0x597601){_0x12eb3f['push'](_0x12eb3f['shift']());}};_0x4d8e42(++_0x3ce728);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0xb10b[_0x4a79fd];return _0xef2f88;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index de4d938..5474371 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(_0xcb7f61,_0x1a672c){var _0x5091dc=function(_0x3d9b2d){while(--_0x3d9b2d){_0xcb7f61['push'](_0xcb7f61['shift']());}};_0x5091dc(++_0x1a672c);}(_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(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7a54,0x106));var _0x47a5=function(_0x1aab21,_0x4603cc){_0x1aab21=_0x1aab21-0x0;var _0x1c3505=_0x7a54[_0x1aab21];return _0x1c3505;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 22470cd..8ea6876 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c42=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x46a728,_0xcb3e1c){var _0xc7dca7=function(_0x5d29ff){while(--_0x5d29ff){_0x46a728['push'](_0x46a728['shift']());}};_0xc7dca7(++_0xcb3e1c);}(_0x9c42,0xf2));var _0x29c4=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x9c42[_0x52666e];return _0x515330;};'use strict';var EventEmitter=require(_0x29c4('0x0'));var ChatOfflineMessage=require(_0x29c4('0x1'))['db'][_0x29c4('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x29c4('0x3')](0x0);var events={'afterCreate':_0x29c4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ea169){return function(_0x2c735d,_0x4d4d68,_0x479b64){ChatOfflineMessageEvents[_0x29c4('0x5')](_0x1ea169+':'+_0x2c735d['id'],_0x2c735d);ChatOfflineMessageEvents[_0x29c4('0x5')](_0x1ea169,_0x2c735d);_0x479b64(null);};}for(var e in events){if(events[_0x29c4('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x29c4('0x7')](e,emitEvent(event));}}module[_0x29c4('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xed54=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x18eaab,_0x5f57c0){var _0x588728=function(_0xd86fad){while(--_0xd86fad){_0x18eaab['push'](_0x18eaab['shift']());}};_0x588728(++_0x5f57c0);}(_0xed54,0xfc));var _0x4ed5=function(_0x2ded8b,_0x387026){_0x2ded8b=_0x2ded8b-0x0;var _0x194400=_0xed54[_0x2ded8b];return _0x194400;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x4ed5('0x0'))['db'][_0x4ed5('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4ed5('0x2')](0x0);var events={'afterCreate':_0x4ed5('0x3'),'afterUpdate':'update','afterDestroy':_0x4ed5('0x4')};function emitEvent(_0x39d4d7){return function(_0x5f4777,_0x5c6d8b,_0xf1fb13){ChatOfflineMessageEvents[_0x4ed5('0x5')](_0x39d4d7+':'+_0x5f4777['id'],_0x5f4777);ChatOfflineMessageEvents[_0x4ed5('0x5')](_0x39d4d7,_0x5f4777);_0xf1fb13(null);};}for(var e in events){if(events[_0x4ed5('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x4ed5('0x7')](e,emitEvent(event));}}module[_0x4ed5('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c4b658f..5b16c85 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 _0x4217=['exports','define','ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4217,0x68));var _0x7421=function(_0x2bdf92,_0x481715){_0x2bdf92=_0x2bdf92-0x0;var _0x48ff22=_0x4217[_0x2bdf92];return _0x48ff22;};'use strict';var attributes=require(_0x7421('0x0'));module[_0x7421('0x1')]=function(_0x391aac){return _0x391aac[_0x7421('0x2')](_0x7421('0x3'),attributes,{'tableName':_0x7421('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe408=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xe408,0x1b7));var _0x8e40=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0xe408[_0x817d9b];return _0x2752e1;};'use strict';var attributes=require(_0x8e40('0x0'));module[_0x8e40('0x1')]=function(_0x48b3e9){return _0x48b3e9[_0x8e40('0x2')](_0x8e40('0x3'),attributes,{'tableName':_0x8e40('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e40('0x5'),'collate':_0x8e40('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a4ae5f5..83539cc 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 _0x2b6d=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x38c596,_0x520267){var _0x1c095f=function(_0x2cbc35){while(--_0x2cbc35){_0x38c596['push'](_0x38c596['shift']());}};_0x1c095f(++_0x520267);}(_0x2b6d,0x1d6));var _0xd2b6=function(_0x2c8749,_0x4d396c){_0x2c8749=_0x2c8749-0x0;var _0x36f666=_0x2b6d[_0x2c8749];return _0x36f666;};'use strict';var _=require(_0xd2b6('0x0'));var util=require(_0xd2b6('0x1'));var moment=require(_0xd2b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2b6('0x3'));var fs=require('fs');var Redis=require(_0xd2b6('0x4'));var db=require(_0xd2b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2b6('0x6'))(_0xd2b6('0x7'));var config=require(_0xd2b6('0x8'));var jayson=require(_0xd2b6('0x9'));var client=jayson[_0xd2b6('0xa')][_0xd2b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af77e,_0x11ffc6,_0x2f43bb){return new BPromise(function(_0x37ba35,_0x577d34){return client[_0xd2b6('0xc')](_0x3af77e,_0x2f43bb)[_0xd2b6('0xd')](function(_0x3f09c8){logger[_0xd2b6('0xe')](_0xd2b6('0xf'),_0x11ffc6,_0xd2b6('0x10'));logger[_0xd2b6('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x11ffc6,_0xd2b6('0x10'),JSON[_0xd2b6('0x12')](_0x3f09c8));if(_0x3f09c8[_0xd2b6('0x13')]){if(_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x14')]===0x1f4){logger[_0xd2b6('0x13')](_0xd2b6('0xf'),_0x11ffc6,_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x15')]);return _0x577d34(_0x3f09c8['error'][_0xd2b6('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x11ffc6,_0x3f09c8['error'][_0xd2b6('0x15')]);return _0x37ba35(_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x15')]);}else{logger[_0xd2b6('0xe')](_0xd2b6('0xf'),_0x11ffc6,'request\x20sent');_0x37ba35(_0x3f09c8['result'][_0xd2b6('0x15')]);}})[_0xd2b6('0x16')](function(_0x4b73eb){logger[_0xd2b6('0x13')](_0xd2b6('0xf'),_0x11ffc6,_0x4b73eb);_0x577d34(_0x4b73eb);});});} \ No newline at end of file +var _0xe3a2=['error','code','message','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1f7073,_0x22a430){var _0x4b5660=function(_0x1558e1){while(--_0x1558e1){_0x1f7073['push'](_0x1f7073['shift']());}};_0x4b5660(++_0x22a430);}(_0xe3a2,0x1de));var _0x2e3a=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0xe3a2[_0x18e5c7];return _0x55f2f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e3a('0x0'));var BPromise=require(_0x2e3a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e3a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e3a('0x3'))(_0x2e3a('0x4'));var config=require(_0x2e3a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2e3a('0x6')][_0x2e3a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf1ac6e,_0x23c92c,_0x1dbe02){return new BPromise(function(_0x1c26e8,_0x13d0df){return client[_0x2e3a('0x8')](_0xf1ac6e,_0x1dbe02)[_0x2e3a('0x9')](function(_0x212407){logger[_0x2e3a('0xa')](_0x2e3a('0xb'),_0x23c92c,'request\x20sent');logger[_0x2e3a('0xc')](_0x2e3a('0xd'),_0x23c92c,_0x2e3a('0xe'),JSON[_0x2e3a('0xf')](_0x212407));if(_0x212407['error']){if(_0x212407[_0x2e3a('0x10')][_0x2e3a('0x11')]===0x1f4){logger[_0x2e3a('0x10')](_0x2e3a('0xb'),_0x23c92c,_0x212407[_0x2e3a('0x10')][_0x2e3a('0x12')]);return _0x13d0df(_0x212407['error'][_0x2e3a('0x12')]);}logger[_0x2e3a('0x10')](_0x2e3a('0xb'),_0x23c92c,_0x212407['error'][_0x2e3a('0x12')]);return _0x1c26e8(_0x212407[_0x2e3a('0x10')][_0x2e3a('0x12')]);}else{logger[_0x2e3a('0xa')](_0x2e3a('0xb'),_0x23c92c,_0x2e3a('0xe'));_0x1c26e8(_0x212407['result'][_0x2e3a('0x12')]);}})['catch'](function(_0x52d48d){logger['error'](_0x2e3a('0xb'),_0x23c92c,_0x52d48d);_0x13d0df(_0x52d48d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5c7a886..2841509 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 _0xc2c5=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete'];(function(_0x148f15,_0x166285){var _0x23b9cd=function(_0x143c37){while(--_0x143c37){_0x148f15['push'](_0x148f15['shift']());}};_0x23b9cd(++_0x166285);}(_0xc2c5,0x17e));var _0x5c2c=function(_0x58e84a,_0x57ed90){_0x58e84a=_0x58e84a-0x0;var _0x3b2e7f=_0xc2c5[_0x58e84a];return _0x3b2e7f;};'use strict';var multer=require(_0x5c2c('0x0'));var util=require('util');var path=require(_0x5c2c('0x1'));var timeout=require(_0x5c2c('0x2'));var express=require(_0x5c2c('0x3'));var router=express['Router']();var fs_extra=require(_0x5c2c('0x4'));var auth=require(_0x5c2c('0x5'));var interaction=require(_0x5c2c('0x6'));var config=require(_0x5c2c('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x5c2c('0x8')]('/',auth[_0x5c2c('0x9')](),controller['index']);router[_0x5c2c('0x8')](_0x5c2c('0xa'),auth['isAuthenticated'](),controller[_0x5c2c('0xb')]);router[_0x5c2c('0x8')](_0x5c2c('0xc'),auth[_0x5c2c('0x9')](),controller['show']);router[_0x5c2c('0xd')]('/',auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xe')]);router['put'](_0x5c2c('0xc'),auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xf')]);router[_0x5c2c('0x10')](_0x5c2c('0xc'),auth[_0x5c2c('0x9')](),controller[_0x5c2c('0x11')]);module[_0x5c2c('0x12')]=router; \ No newline at end of file +var _0xfe4d=['./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x469d98,_0x2a4896){var _0x1a53e0=function(_0x54241e){while(--_0x54241e){_0x469d98['push'](_0x469d98['shift']());}};_0x1a53e0(++_0x2a4896);}(_0xfe4d,0xf1));var _0xdfe4=function(_0x38bbd2,_0x709b0a){_0x38bbd2=_0x38bbd2-0x0;var _0x32c72c=_0xfe4d[_0x38bbd2];return _0x32c72c;};'use strict';var multer=require('multer');var util=require(_0xdfe4('0x0'));var path=require(_0xdfe4('0x1'));var timeout=require(_0xdfe4('0x2'));var express=require(_0xdfe4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfe4('0x4'));var interaction=require(_0xdfe4('0x5'));var config=require('../../config/environment');var controller=require(_0xdfe4('0x6'));router[_0xdfe4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfe4('0x7')](_0xdfe4('0x8'),auth[_0xdfe4('0x9')](),controller[_0xdfe4('0xa')]);router[_0xdfe4('0x7')](_0xdfe4('0xb'),auth[_0xdfe4('0x9')](),controller[_0xdfe4('0xc')]);router[_0xdfe4('0xd')]('/',auth[_0xdfe4('0x9')](),controller[_0xdfe4('0xe')]);router[_0xdfe4('0xf')](_0xdfe4('0xb'),auth[_0xdfe4('0x9')](),controller['update']);router[_0xdfe4('0x10')](_0xdfe4('0xb'),auth[_0xdfe4('0x9')](),controller[_0xdfe4('0x11')]);module[_0xdfe4('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 5673b24..431b57c 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 _0x8e60=['ENUM','mouseOver','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x4bc413,_0x36b22d){var _0x155c86=function(_0xe7f17b){while(--_0xe7f17b){_0x4bc413['push'](_0x4bc413['shift']());}};_0x155c86(++_0x36b22d);}(_0x8e60,0x10f));var _0x08e6=function(_0x2fca92,_0x42aa4f){_0x2fca92=_0x2fca92-0x0;var _0x3138c7=_0x8e60[_0x2fca92];return _0x3138c7;};'use strict';var Sequelize=require(_0x08e6('0x0'));module[_0x08e6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x08e6('0x2')](_0x08e6('0x3'),_0x08e6('0x4')),'defaultValue':_0x08e6('0x3')},'selector':{'type':Sequelize[_0x08e6('0x5')]},'timeout':{'type':Sequelize[_0x08e6('0x6')]}}; \ No newline at end of file +var _0xaca9=['timeout','mouseOver','STRING','INTEGER','sequelize','ENUM'];(function(_0x80b9b8,_0x2a2163){var _0xb7fe18=function(_0x4db660){while(--_0x4db660){_0x80b9b8['push'](_0x80b9b8['shift']());}};_0xb7fe18(++_0x2a2163);}(_0xaca9,0x1de));var _0x9aca=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xaca9[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x9aca('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9aca('0x1')]('mouseOver',_0x9aca('0x2')),'defaultValue':_0x9aca('0x3')},'selector':{'type':Sequelize[_0x9aca('0x4')]},'timeout':{'type':Sequelize[_0x9aca('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 9c97668..9fde244 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 _0x269f=['create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','find','catch'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x269f,0xee));var _0xf269=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x269f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xf269('0x0'));var rimraf=require(_0xf269('0x1'));var zipdir=require(_0xf269('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf269('0x3'));var moment=require('moment');var BPromise=require(_0xf269('0x4'));var Mustache=require(_0xf269('0x5'));var util=require(_0xf269('0x6'));var path=require(_0xf269('0x7'));var sox=require(_0xf269('0x8'));var csv=require('to-csv');var ejs=require(_0xf269('0x9'));var fs=require('fs');var fs_extra=require(_0xf269('0xa'));var _=require(_0xf269('0xb'));var squel=require(_0xf269('0xc'));var crypto=require(_0xf269('0xd'));var jsforce=require(_0xf269('0xe'));var deskjs=require(_0xf269('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf269('0x10'));var Papa=require(_0xf269('0x11'));var Redis=require(_0xf269('0x12'));var authService=require(_0xf269('0x13'));var qs=require(_0xf269('0x14'));var as=require(_0xf269('0x15'));var hardwareService=require(_0xf269('0x16'));var logger=require(_0xf269('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194d06,_0x36504a){_0x36504a=_0x36504a||0xcc;return function(_0x396a75){if(_0x396a75){return _0x194d06[_0xf269('0x18')](_0x36504a);}return _0x194d06[_0xf269('0x19')](_0x36504a)[_0xf269('0x1a')]();};}function respondWithResult(_0x2cf3f2,_0x34912d){_0x34912d=_0x34912d||0xc8;return function(_0x3e6198){if(_0x3e6198){return _0x2cf3f2[_0xf269('0x19')](_0x34912d)[_0xf269('0x1b')](_0x3e6198);}};}function respondWithFilteredResult(_0x2bdeb9,_0xfc8d78){return function(_0x2a240a){if(_0x2a240a){var _0x31201c=typeof _0xfc8d78[_0xf269('0x1c')]===_0xf269('0x1d')&&typeof _0xfc8d78[_0xf269('0x1e')]===_0xf269('0x1d');var _0x2910d0=_0x2a240a[_0xf269('0x1f')];var _0x1333ce=_0x31201c?0x0:_0xfc8d78['offset'];var _0x60f3b0=_0x31201c?_0x2a240a[_0xf269('0x1f')]:_0xfc8d78['offset']+_0xfc8d78['limit'];var _0x3a7f06;if(_0x60f3b0>=_0x2910d0){_0x60f3b0=_0x2910d0;_0x3a7f06=0xc8;}else{_0x3a7f06=0xce;}_0x2bdeb9['status'](_0x3a7f06);return _0x2bdeb9[_0xf269('0x20')]('Content-Range',_0x1333ce+'-'+_0x60f3b0+'/'+_0x2910d0)['json'](_0x2a240a);}return null;};}function patchUpdates(_0x4924d4){return function(_0x1d1847){try{jsonpatch[_0xf269('0x21')](_0x1d1847,_0x4924d4,!![]);}catch(_0x4cedf4){return BPromise[_0xf269('0x22')](_0x4cedf4);}return _0x1d1847[_0xf269('0x23')]();};}function saveUpdates(_0x5795cc,_0x9c9c7a){return function(_0x328973){if(_0x328973){return _0x328973[_0xf269('0x24')](_0x5795cc)[_0xf269('0x25')](function(_0x18f0db){return _0x18f0db;});}return null;};}function removeEntity(_0x30d9b0,_0x4d9776){return function(_0x9148c5){if(_0x9148c5){return _0x9148c5[_0xf269('0x26')]()['then'](function(){_0x30d9b0[_0xf269('0x19')](0xcc)[_0xf269('0x1a')]();});}};}function handleEntityNotFound(_0x100ce8,_0x3ac6fc){return function(_0x21e13f){if(!_0x21e13f){_0x100ce8['sendStatus'](0x194);}return _0x21e13f;};}function handleError(_0x523477,_0x9f558d){_0x9f558d=_0x9f558d||0x1f4;return function(_0x4087ef){logger[_0xf269('0x27')](_0x4087ef[_0xf269('0x28')]);if(_0x4087ef[_0xf269('0x29')]){delete _0x4087ef[_0xf269('0x29')];}_0x523477[_0xf269('0x19')](_0x9f558d)['send'](_0x4087ef);};}exports['show']=function(_0xeac015,_0x3e9ab9){var _0x261ccf={'raw':!![],'where':{'id':_0xeac015[_0xf269('0x2a')]['id']}},_0x43d6b8={};_0x43d6b8[_0xf269('0x2b')]=_[_0xf269('0x2c')](db[_0xf269('0x2d')][_0xf269('0x2e')]);_0x43d6b8[_0xf269('0x2f')]=_[_0xf269('0x2c')](_0xeac015[_0xf269('0x2f')]);_0x43d6b8['filters']=_['intersection'](_0x43d6b8[_0xf269('0x2b')],_0x43d6b8['query']);_0x261ccf[_0xf269('0x30')]=_[_0xf269('0x31')](_0x43d6b8[_0xf269('0x2b')],qs[_0xf269('0x32')](_0xeac015['query'][_0xf269('0x32')]));_0x261ccf[_0xf269('0x30')]=_0x261ccf[_0xf269('0x30')][_0xf269('0x33')]?_0x261ccf[_0xf269('0x30')]:_0x43d6b8[_0xf269('0x2b')];if(_0xeac015[_0xf269('0x2f')][_0xf269('0x34')]){_0x261ccf[_0xf269('0x35')]=[{'all':!![]}];}_0x261ccf=_[_0xf269('0x36')]({},_0x261ccf,_0xeac015['options']);return db[_0xf269('0x2d')][_0xf269('0x37')](_0x261ccf)['then'](handleEntityNotFound(_0x3e9ab9,null))['then'](respondWithResult(_0x3e9ab9,null))[_0xf269('0x38')](handleError(_0x3e9ab9,null));};exports[_0xf269('0x39')]=function(_0x5ce9fa,_0x2de42e){return db[_0xf269('0x2d')]['create'](_0x5ce9fa[_0xf269('0x3a')],{})[_0xf269('0x25')](respondWithResult(_0x2de42e,0xc9))[_0xf269('0x38')](handleError(_0x2de42e,null));};exports['update']=function(_0x30ea5e,_0x202103){if(_0x30ea5e[_0xf269('0x3a')]['id']){delete _0x30ea5e[_0xf269('0x3a')]['id'];}return db[_0xf269('0x2d')][_0xf269('0x37')]({'where':{'id':_0x30ea5e['params']['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x202103,null))[_0xf269('0x25')](saveUpdates(_0x30ea5e[_0xf269('0x3a')],null))[_0xf269('0x25')](respondWithResult(_0x202103,null))[_0xf269('0x38')](handleError(_0x202103,null));};exports['destroy']=function(_0x406757,_0x22d0f2){return db[_0xf269('0x2d')][_0xf269('0x37')]({'where':{'id':_0x406757[_0xf269('0x2a')]['id']}})[_0xf269('0x25')](handleEntityNotFound(_0x22d0f2,null))['then'](removeEntity(_0x22d0f2,null))[_0xf269('0x38')](handleError(_0x22d0f2,null));}; \ No newline at end of file +var _0x7d9f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body'];(function(_0xaebe78,_0x21613c){var _0x4eeea5=function(_0x5abdd3){while(--_0x5abdd3){_0xaebe78['push'](_0xaebe78['shift']());}};_0x4eeea5(++_0x21613c);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4a5046,_0x5b1d8e){_0x4a5046=_0x4a5046-0x0;var _0x3c3b34=_0x7d9f[_0x4a5046];return _0x3c3b34;};'use strict';var emlformat=require(_0xf7d9('0x0'));var rimraf=require(_0xf7d9('0x1'));var zipdir=require(_0xf7d9('0x2'));var jsonpatch=require(_0xf7d9('0x3'));var rp=require(_0xf7d9('0x4'));var moment=require('moment');var BPromise=require(_0xf7d9('0x5'));var Mustache=require(_0xf7d9('0x6'));var util=require(_0xf7d9('0x7'));var path=require(_0xf7d9('0x8'));var sox=require(_0xf7d9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7d9('0xa'));var _=require(_0xf7d9('0xb'));var squel=require('squel');var crypto=require(_0xf7d9('0xc'));var jsforce=require(_0xf7d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf7d9('0xe'));var querystring=require('querystring');var Papa=require(_0xf7d9('0xf'));var Redis=require(_0xf7d9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf7d9('0x11'));var hardwareService=require(_0xf7d9('0x12'));var logger=require(_0xf7d9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf7d9('0x14'));var licenseUtil=require(_0xf7d9('0x15'));var db=require(_0xf7d9('0x16'))['db'];function respondWithStatusCode(_0x35e156,_0x594dfe){_0x594dfe=_0x594dfe||0xcc;return function(_0x16e680){if(_0x16e680){return _0x35e156[_0xf7d9('0x17')](_0x594dfe);}return _0x35e156[_0xf7d9('0x18')](_0x594dfe)[_0xf7d9('0x19')]();};}function respondWithResult(_0x49f766,_0x189c82){_0x189c82=_0x189c82||0xc8;return function(_0x359843){if(_0x359843){return _0x49f766[_0xf7d9('0x18')](_0x189c82)[_0xf7d9('0x1a')](_0x359843);}};}function respondWithFilteredResult(_0x5d3029,_0x405ed4){return function(_0x22ed4a){if(_0x22ed4a){var _0x341e27=typeof _0x405ed4['offset']==='undefined'&&typeof _0x405ed4[_0xf7d9('0x1b')]===_0xf7d9('0x1c');var _0xe29103=_0x22ed4a['count'];var _0x44ebd3=_0x341e27?0x0:_0x405ed4[_0xf7d9('0x1d')];var _0x5eb7c9=_0x341e27?_0x22ed4a[_0xf7d9('0x1e')]:_0x405ed4['offset']+_0x405ed4[_0xf7d9('0x1b')];var _0x1bbc77;if(_0x5eb7c9>=_0xe29103){_0x5eb7c9=_0xe29103;_0x1bbc77=0xc8;}else{_0x1bbc77=0xce;}_0x5d3029['status'](_0x1bbc77);return _0x5d3029[_0xf7d9('0x1f')](_0xf7d9('0x20'),_0x44ebd3+'-'+_0x5eb7c9+'/'+_0xe29103)[_0xf7d9('0x1a')](_0x22ed4a);}return null;};}function patchUpdates(_0x316d54){return function(_0x165160){try{jsonpatch[_0xf7d9('0x21')](_0x165160,_0x316d54,!![]);}catch(_0xd04b9d){return BPromise[_0xf7d9('0x22')](_0xd04b9d);}return _0x165160['save']();};}function saveUpdates(_0x5e96df,_0x36b974){return function(_0x4cfe93){if(_0x4cfe93){return _0x4cfe93[_0xf7d9('0x23')](_0x5e96df)[_0xf7d9('0x24')](function(_0x574b12){return _0x574b12;});}return null;};}function removeEntity(_0x8d8e48,_0x27ba8c){return function(_0x514ffa){if(_0x514ffa){return _0x514ffa['destroy']()[_0xf7d9('0x24')](function(){_0x8d8e48[_0xf7d9('0x18')](0xcc)[_0xf7d9('0x19')]();});}};}function handleEntityNotFound(_0x595556,_0x3c0b91){return function(_0x496ab7){if(!_0x496ab7){_0x595556[_0xf7d9('0x17')](0x194);}return _0x496ab7;};}function handleError(_0x3b3ea5,_0x144ae2){_0x144ae2=_0x144ae2||0x1f4;return function(_0x5b1ea5){logger[_0xf7d9('0x25')](_0x5b1ea5[_0xf7d9('0x26')]);if(_0x5b1ea5[_0xf7d9('0x27')]){delete _0x5b1ea5[_0xf7d9('0x27')];}_0x3b3ea5[_0xf7d9('0x18')](_0x144ae2)['send'](_0x5b1ea5);};}exports[_0xf7d9('0x28')]=function(_0x3847ff,_0x2b5f17){var _0x2c04c3={'raw':!![],'where':{'id':_0x3847ff[_0xf7d9('0x29')]['id']}},_0x508b00={};_0x508b00[_0xf7d9('0x2a')]=_[_0xf7d9('0x2b')](db[_0xf7d9('0x2c')][_0xf7d9('0x2d')]);_0x508b00[_0xf7d9('0x2e')]=_['keys'](_0x3847ff['query']);_0x508b00['filters']=_[_0xf7d9('0x2f')](_0x508b00['model'],_0x508b00[_0xf7d9('0x2e')]);_0x2c04c3['attributes']=_[_0xf7d9('0x2f')](_0x508b00['model'],qs['fields'](_0x3847ff['query'][_0xf7d9('0x30')]));_0x2c04c3['attributes']=_0x2c04c3[_0xf7d9('0x31')][_0xf7d9('0x32')]?_0x2c04c3[_0xf7d9('0x31')]:_0x508b00[_0xf7d9('0x2a')];if(_0x3847ff[_0xf7d9('0x2e')][_0xf7d9('0x33')]){_0x2c04c3[_0xf7d9('0x34')]=[{'all':!![]}];}_0x2c04c3=_[_0xf7d9('0x35')]({},_0x2c04c3,_0x3847ff['options']);return db[_0xf7d9('0x2c')][_0xf7d9('0x36')](_0x2c04c3)['then'](handleEntityNotFound(_0x2b5f17,null))['then'](respondWithResult(_0x2b5f17,null))[_0xf7d9('0x37')](handleError(_0x2b5f17,null));};exports[_0xf7d9('0x38')]=function(_0x4110ce,_0x5301a8){return db[_0xf7d9('0x2c')][_0xf7d9('0x38')](_0x4110ce[_0xf7d9('0x39')],{})[_0xf7d9('0x24')](respondWithResult(_0x5301a8,0xc9))[_0xf7d9('0x37')](handleError(_0x5301a8,null));};exports[_0xf7d9('0x23')]=function(_0x427963,_0x1280fa){if(_0x427963[_0xf7d9('0x39')]['id']){delete _0x427963[_0xf7d9('0x39')]['id'];}return db[_0xf7d9('0x2c')]['find']({'where':{'id':_0x427963[_0xf7d9('0x29')]['id']}})['then'](handleEntityNotFound(_0x1280fa,null))[_0xf7d9('0x24')](saveUpdates(_0x427963[_0xf7d9('0x39')],null))[_0xf7d9('0x24')](respondWithResult(_0x1280fa,null))[_0xf7d9('0x37')](handleError(_0x1280fa,null));};exports['destroy']=function(_0x55b49d,_0x2173e2){return db['ChatProactiveAction'][_0xf7d9('0x36')]({'where':{'id':_0x55b49d[_0xf7d9('0x29')]['id']}})[_0xf7d9('0x24')](handleEntityNotFound(_0x2173e2,null))[_0xf7d9('0x24')](removeEntity(_0x2173e2,null))['catch'](handleError(_0x2173e2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a4c76cb..427730f 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 _0xc15b=['exports','define','ChatProactiveAction','lodash','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes'];(function(_0x53e97d,_0x554a9c){var _0x5c77f0=function(_0x2734fc){while(--_0x2734fc){_0x53e97d['push'](_0x53e97d['shift']());}};_0x5c77f0(++_0x554a9c);}(_0xc15b,0x111));var _0xbc15=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xc15b[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rp=require(_0xbc15('0x3'));var fs=require('fs');var path=require(_0xbc15('0x4'));var rimraf=require(_0xbc15('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc15('0x6'));module[_0xbc15('0x7')]=function(_0x451757,_0x410925){return _0x451757[_0xbc15('0x8')](_0xbc15('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86b6=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x344f47,_0x9b4c03){var _0x3f1618=function(_0x20d140){while(--_0x20d140){_0x344f47['push'](_0x344f47['shift']());}};_0x3f1618(++_0x9b4c03);}(_0x86b6,0x118));var _0x686b=function(_0x571449,_0x7353c2){_0x571449=_0x571449-0x0;var _0x305bf6=_0x86b6[_0x571449];return _0x305bf6;};'use strict';var _=require('lodash');var util=require(_0x686b('0x0'));var logger=require(_0x686b('0x1'))(_0x686b('0x2'));var moment=require(_0x686b('0x3'));var BPromise=require(_0x686b('0x4'));var rp=require(_0x686b('0x5'));var fs=require('fs');var path=require(_0x686b('0x6'));var rimraf=require(_0x686b('0x7'));var config=require('../../config/environment');var attributes=require(_0x686b('0x8'));module['exports']=function(_0x2a47ef,_0x185671){return _0x2a47ef[_0x686b('0x9')](_0x686b('0xa'),attributes,{'tableName':_0x686b('0xb'),'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 574a378..13c6263 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 _0xe096=['info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x51de27,_0x3a683f){var _0x2a71f3=function(_0xd8482d){while(--_0xd8482d){_0x51de27['push'](_0x51de27['shift']());}};_0x2a71f3(++_0x3a683f);}(_0xe096,0x1a7));var _0x6e09=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xe096[_0x591db7];return _0x4ad760;};'use strict';var _=require('lodash');var util=require(_0x6e09('0x0'));var moment=require(_0x6e09('0x1'));var BPromise=require(_0x6e09('0x2'));var rs=require(_0x6e09('0x3'));var fs=require('fs');var Redis=require(_0x6e09('0x4'));var db=require(_0x6e09('0x5'))['db'];var utils=require(_0x6e09('0x6'));var logger=require(_0x6e09('0x7'))(_0x6e09('0x8'));var config=require(_0x6e09('0x9'));var jayson=require(_0x6e09('0xa'));var client=jayson[_0x6e09('0xb')][_0x6e09('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302004,_0x110ba4,_0x2c0d9b){return new BPromise(function(_0x56a52a,_0x2e59cd){return client['request'](_0x302004,_0x2c0d9b)[_0x6e09('0xd')](function(_0x1ac6b3){logger[_0x6e09('0xe')](_0x6e09('0xf'),_0x110ba4,_0x6e09('0x10'));logger[_0x6e09('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x110ba4,_0x6e09('0x10'),JSON['stringify'](_0x1ac6b3));if(_0x1ac6b3[_0x6e09('0x12')]){if(_0x1ac6b3[_0x6e09('0x12')][_0x6e09('0x13')]===0x1f4){logger[_0x6e09('0x12')](_0x6e09('0xf'),_0x110ba4,_0x1ac6b3[_0x6e09('0x12')][_0x6e09('0x14')]);return _0x2e59cd(_0x1ac6b3[_0x6e09('0x12')]['message']);}logger[_0x6e09('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x110ba4,_0x1ac6b3[_0x6e09('0x12')][_0x6e09('0x14')]);return _0x56a52a(_0x1ac6b3[_0x6e09('0x12')][_0x6e09('0x14')]);}else{logger[_0x6e09('0xe')](_0x6e09('0xf'),_0x110ba4,_0x6e09('0x10'));_0x56a52a(_0x1ac6b3[_0x6e09('0x15')][_0x6e09('0x14')]);}})[_0x6e09('0x16')](function(_0x2854d3){logger[_0x6e09('0x12')](_0x6e09('0xf'),_0x110ba4,_0x2854d3);_0x2e59cd(_0x2854d3);});});} \ No newline at end of file +var _0x3d1e=['message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','stringify','error'];(function(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0x3d1e,0x1a1));var _0xe3d1=function(_0x2b8f11,_0x20774f){_0x2b8f11=_0x2b8f11-0x0;var _0x2364de=_0x3d1e[_0x2b8f11];return _0x2364de;};'use strict';var _=require('lodash');var util=require(_0xe3d1('0x0'));var moment=require(_0xe3d1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3d1('0x2'));var db=require(_0xe3d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3d1('0x4'))(_0xe3d1('0x5'));var config=require(_0xe3d1('0x6'));var jayson=require(_0xe3d1('0x7'));var client=jayson[_0xe3d1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x480cbc,_0x11484b,_0x509741){return new BPromise(function(_0x59276a,_0x158ce0){return client['request'](_0x480cbc,_0x509741)[_0xe3d1('0x9')](function(_0x455f67){logger[_0xe3d1('0xa')](_0xe3d1('0xb'),_0x11484b,'request\x20sent');logger[_0xe3d1('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x11484b,'request\x20sent',JSON[_0xe3d1('0xd')](_0x455f67));if(_0x455f67[_0xe3d1('0xe')]){if(_0x455f67[_0xe3d1('0xe')]['code']===0x1f4){logger[_0xe3d1('0xe')](_0xe3d1('0xb'),_0x11484b,_0x455f67[_0xe3d1('0xe')][_0xe3d1('0xf')]);return _0x158ce0(_0x455f67[_0xe3d1('0xe')]['message']);}logger[_0xe3d1('0xe')](_0xe3d1('0xb'),_0x11484b,_0x455f67['error'][_0xe3d1('0xf')]);return _0x59276a(_0x455f67[_0xe3d1('0xe')][_0xe3d1('0xf')]);}else{logger['info'](_0xe3d1('0xb'),_0x11484b,'request\x20sent');_0x59276a(_0x455f67[_0xe3d1('0x10')][_0xe3d1('0xf')]);}})[_0xe3d1('0x11')](function(_0x21b7e5){logger[_0xe3d1('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x11484b,_0x21b7e5);_0x158ce0(_0x21b7e5);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 830cc27..63e3aa1 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2dcb13,_0x52a8c0){_0x2dcb13=_0x2dcb13-0x0;var _0x49a562=_0x8d0e[_0x2dcb13];return _0x49a562;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x46ed,0x168));var _0xd46e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x46ed[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0xa')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')](_0xd46e('0x9'),auth[_0xd46e('0xa')](),controller['update']);router[_0xd46e('0xf')](_0xd46e('0x9'),auth['isAuthenticated'](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f1c68b3..99aa4a0 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 _0xb7f9=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x311b91,_0x5362f5){var _0x5ce828=function(_0x549c54){while(--_0x549c54){_0x311b91['push'](_0x311b91['shift']());}};_0x5ce828(++_0x5362f5);}(_0xb7f9,0x9f));var _0x9b7f=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xb7f9[_0x46a38b];return _0x346e75;};'use strict';var Sequelize=require(_0x9b7f('0x0'));module[_0x9b7f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b7f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9b7f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b7f('0x4')](_0x9b7f('0x5'),_0x9b7f('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xcf51=['INTEGER','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x3f24e0,_0x1bca4a){var _0x8c08ec=function(_0x1f8737){while(--_0x1f8737){_0x3f24e0['push'](_0x3f24e0['shift']());}};_0x8c08ec(++_0x1bca4a);}(_0xcf51,0x18b));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1cf5('0x0'));module[_0x1cf5('0x1')]={'name':{'type':Sequelize[_0x1cf5('0x2')],'unique':_0x1cf5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1cf5('0x2')]},'timeout':{'type':Sequelize[_0x1cf5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1cf5('0x5'),_0x1cf5('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a83c9b5..e334b36 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 _0x1578=['SELECT','every','TeamId','includes','union','compact','value','sequelize','isEmpty','userChatQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','ChatQueueId','UserChatQueue','findAll','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1578,0x1e2));var _0x8157=function(_0x21bb59,_0xb9bc94){_0x21bb59=_0x21bb59-0x0;var _0x5205fb=_0x1578[_0x21bb59];return _0x5205fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8157('0x0'));var jsonpatch=require(_0x8157('0x1'));var rp=require(_0x8157('0x2'));var moment=require(_0x8157('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8157('0x4'));var util=require(_0x8157('0x5'));var path=require(_0x8157('0x6'));var sox=require(_0x8157('0x7'));var csv=require(_0x8157('0x8'));var ejs=require(_0x8157('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8157('0xa'));var squel=require('squel');var crypto=require(_0x8157('0xb'));var jsforce=require(_0x8157('0xc'));var deskjs=require(_0x8157('0xd'));var toCsv=require(_0x8157('0x8'));var querystring=require(_0x8157('0xe'));var Papa=require(_0x8157('0xf'));var Redis=require(_0x8157('0x10'));var authService=require(_0x8157('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8157('0x12'));var logger=require(_0x8157('0x13'))(_0x8157('0x14'));var utils=require(_0x8157('0x15'));var config=require(_0x8157('0x16'));var licenseUtil=require(_0x8157('0x17'));var db=require(_0x8157('0x18'))['db'];config['redis']=_['defaults'](config[_0x8157('0x19')],{'host':_0x8157('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8157('0x1b'))[_0x8157('0x1c')](socket);var jayson=require(_0x8157('0x1d'));var client=jayson[_0x8157('0x1e')][_0x8157('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2fb5af,_0x23bd2e,_0x536547,_0x44dcc4){return new BPromise(function(_0x53ce5c,_0x47cd50){var _0x2e1ad7=_0x44dcc4||client;return _0x2e1ad7[_0x8157('0x20')](_0x2fb5af,_0x536547)[_0x8157('0x21')](function(_0x54e467){logger[_0x8157('0x22')](_0x8157('0x23'),_0x23bd2e,_0x8157('0x24'));logger['debug'](_0x8157('0x25'),_0x23bd2e,_0x8157('0x24'),JSON['stringify'](_0x54e467));if(_0x54e467[_0x8157('0x26')]){if(_0x54e467[_0x8157('0x26')][_0x8157('0x27')]===0x1f4){logger[_0x8157('0x26')](_0x8157('0x23'),_0x23bd2e,_0x54e467['error'][_0x8157('0x28')]);return _0x47cd50(_0x54e467[_0x8157('0x26')][_0x8157('0x28')]);}logger[_0x8157('0x26')](_0x8157('0x23'),_0x23bd2e,_0x54e467[_0x8157('0x26')][_0x8157('0x28')]);return _0x53ce5c(_0x54e467[_0x8157('0x26')][_0x8157('0x28')]);}else{logger[_0x8157('0x22')](_0x8157('0x23'),_0x23bd2e,_0x8157('0x24'));_0x53ce5c(_0x54e467[_0x8157('0x29')]['message']);}})['catch'](function(_0x29592e){logger['error'](_0x8157('0x23'),_0x23bd2e,_0x29592e);_0x47cd50(_0x29592e);});});}function respondWithStatusCode(_0x264e5e,_0x4e9ee2){_0x4e9ee2=_0x4e9ee2||0xcc;return function(_0x1162b8){if(_0x1162b8){return _0x264e5e[_0x8157('0x2a')](_0x4e9ee2);}return _0x264e5e['status'](_0x4e9ee2)[_0x8157('0x2b')]();};}function respondWithResult(_0x522412,_0x2cddc1){_0x2cddc1=_0x2cddc1||0xc8;return function(_0x4f78d9){if(_0x4f78d9){return _0x522412[_0x8157('0x2c')](_0x2cddc1)[_0x8157('0x2d')](_0x4f78d9);}};}function respondWithFilteredResult(_0x4c31f5,_0x12a6fb){return function(_0x19bebe){if(_0x19bebe){var _0x4751fb=typeof _0x12a6fb[_0x8157('0x2e')]===_0x8157('0x2f')&&typeof _0x12a6fb[_0x8157('0x30')]===_0x8157('0x2f');var _0x274315=_0x19bebe['count'];var _0x101cce=_0x4751fb?0x0:_0x12a6fb[_0x8157('0x2e')];var _0x4337be=_0x4751fb?_0x19bebe['count']:_0x12a6fb['offset']+_0x12a6fb[_0x8157('0x30')];var _0x335035;if(_0x4337be>=_0x274315){_0x4337be=_0x274315;_0x335035=0xc8;}else{_0x335035=0xce;}_0x4c31f5[_0x8157('0x2c')](_0x335035);return _0x4c31f5[_0x8157('0x31')](_0x8157('0x32'),_0x101cce+'-'+_0x4337be+'/'+_0x274315)[_0x8157('0x2d')](_0x19bebe);}return null;};}function patchUpdates(_0x5c9378){return function(_0x803ef0){try{jsonpatch['apply'](_0x803ef0,_0x5c9378,!![]);}catch(_0x3c3820){return BPromise[_0x8157('0x33')](_0x3c3820);}return _0x803ef0[_0x8157('0x34')]();};}function saveUpdates(_0x20a2b0,_0x5d2d91){return function(_0x51168d){if(_0x51168d){return _0x51168d['update'](_0x20a2b0)[_0x8157('0x21')](function(_0x5c42d9){return _0x5c42d9;});}return null;};}function removeEntity(_0x57ae9a,_0x4ed63c){return function(_0x3278cf){if(_0x3278cf){return _0x3278cf[_0x8157('0x35')]()[_0x8157('0x21')](function(){var _0x397f6b=_0x3278cf[_0x8157('0x36')]({'plain':!![]});var _0x5588d6=_0x8157('0x37');return db[_0x8157('0x38')][_0x8157('0x35')]({'where':{'type':_0x5588d6,'resourceId':_0x397f6b['id']}})[_0x8157('0x21')](function(){return _0x3278cf;});})[_0x8157('0x21')](function(){_0x57ae9a['status'](0xcc)[_0x8157('0x2b')]();});}};}function handleEntityNotFound(_0x15caac,_0x5abe2f){return function(_0x557be3){if(!_0x557be3){_0x15caac[_0x8157('0x2a')](0x194);}return _0x557be3;};}function handleError(_0x15ca74,_0x27add3){_0x27add3=_0x27add3||0x1f4;return function(_0x39213a){logger[_0x8157('0x26')](_0x39213a[_0x8157('0x39')]);if(_0x39213a[_0x8157('0x3a')]){delete _0x39213a['name'];}_0x15ca74[_0x8157('0x2c')](_0x27add3)[_0x8157('0x3b')](_0x39213a);};}exports['index']=function(_0x6c77d1,_0xdae42a){var _0x5654a0={},_0x285b29={},_0x40229f={'count':0x0,'rows':[]};var _0x5a575b=_[_0x8157('0x3c')](db[_0x8157('0x3d')][_0x8157('0x3e')],function(_0x33d563){return{'name':_0x33d563[_0x8157('0x3f')],'type':_0x33d563[_0x8157('0x40')][_0x8157('0x41')]};});_0x285b29[_0x8157('0x42')]=_['map'](_0x5a575b,_0x8157('0x3a'));_0x285b29[_0x8157('0x43')]=_[_0x8157('0x44')](_0x6c77d1[_0x8157('0x43')]);_0x285b29[_0x8157('0x45')]=_[_0x8157('0x46')](_0x285b29['model'],_0x285b29[_0x8157('0x43')]);_0x5654a0[_0x8157('0x47')]=_[_0x8157('0x46')](_0x285b29[_0x8157('0x42')],qs[_0x8157('0x48')](_0x6c77d1[_0x8157('0x43')]['fields']));_0x5654a0[_0x8157('0x47')]=_0x5654a0[_0x8157('0x47')]['length']?_0x5654a0[_0x8157('0x47')]:_0x285b29[_0x8157('0x42')];if(!_0x6c77d1[_0x8157('0x43')]['hasOwnProperty']('nolimit')){_0x5654a0[_0x8157('0x30')]=qs[_0x8157('0x30')](_0x6c77d1[_0x8157('0x43')][_0x8157('0x30')]);_0x5654a0[_0x8157('0x2e')]=qs[_0x8157('0x2e')](_0x6c77d1[_0x8157('0x43')][_0x8157('0x2e')]);}_0x5654a0[_0x8157('0x49')]=qs['sort'](_0x6c77d1['query']['sort']);_0x5654a0['where']=qs[_0x8157('0x45')](_[_0x8157('0x4a')](_0x6c77d1[_0x8157('0x43')],_0x285b29[_0x8157('0x45')]),_0x5a575b);if(_0x6c77d1['query'][_0x8157('0x4b')]){_0x5654a0[_0x8157('0x4c')]=_[_0x8157('0x4d')](_0x5654a0[_0x8157('0x4c')],{'$or':_['map'](_0x5a575b,function(_0x2c3a02){if(_0x2c3a02[_0x8157('0x40')]!==_0x8157('0x4e')){var _0x5d78a0={};_0x5d78a0[_0x2c3a02[_0x8157('0x3a')]]={'$like':'%'+_0x6c77d1[_0x8157('0x43')][_0x8157('0x4b')]+'%'};return _0x5d78a0;}})});}_0x5654a0=_['merge']({},_0x5654a0,_0x6c77d1[_0x8157('0x4f')]);var _0x25088a={'where':_0x5654a0[_0x8157('0x4c')]};return db['ChatQueue'][_0x8157('0x50')](_0x25088a)[_0x8157('0x21')](function(_0x3495d8){_0x40229f['count']=_0x3495d8;if(_0x6c77d1[_0x8157('0x43')][_0x8157('0x51')]){_0x5654a0[_0x8157('0x52')]=[{'all':!![]}];}return db[_0x8157('0x3d')]['findAll'](_0x5654a0);})[_0x8157('0x21')](function(_0x1340d9){_0x40229f['rows']=_0x1340d9;return _0x40229f;})['then'](respondWithFilteredResult(_0xdae42a,_0x5654a0))[_0x8157('0x53')](handleError(_0xdae42a,null));};exports['show']=function(_0xb6d6df,_0x457e98){var _0x566c28={'raw':!![],'where':{'id':_0xb6d6df[_0x8157('0x54')]['id']}},_0x2b07ba={};_0x2b07ba[_0x8157('0x42')]=_['keys'](db['ChatQueue'][_0x8157('0x3e')]);_0x2b07ba[_0x8157('0x43')]=_[_0x8157('0x44')](_0xb6d6df[_0x8157('0x43')]);_0x2b07ba[_0x8157('0x45')]=_[_0x8157('0x46')](_0x2b07ba['model'],_0x2b07ba[_0x8157('0x43')]);_0x566c28[_0x8157('0x47')]=_['intersection'](_0x2b07ba[_0x8157('0x42')],qs[_0x8157('0x48')](_0xb6d6df[_0x8157('0x43')][_0x8157('0x48')]));_0x566c28[_0x8157('0x47')]=_0x566c28['attributes'][_0x8157('0x55')]?_0x566c28[_0x8157('0x47')]:_0x2b07ba[_0x8157('0x42')];if(_0xb6d6df[_0x8157('0x43')][_0x8157('0x51')]){_0x566c28['include']=[{'all':!![]}];}_0x566c28=_['merge']({},_0x566c28,_0xb6d6df[_0x8157('0x4f')]);return db['ChatQueue']['find'](_0x566c28)[_0x8157('0x21')](handleEntityNotFound(_0x457e98,null))[_0x8157('0x21')](respondWithResult(_0x457e98,null))[_0x8157('0x53')](handleError(_0x457e98,null));};exports[_0x8157('0x56')]=function(_0x478514,_0x3961a8){return db[_0x8157('0x3d')][_0x8157('0x56')](_0x478514[_0x8157('0x57')],{})[_0x8157('0x21')](function(_0x6d343){var _0x403bd2=_0x478514[_0x8157('0x58')][_0x8157('0x36')]({'plain':!![]});if(!_0x403bd2)throw new Error(_0x8157('0x59'));if(_0x403bd2[_0x8157('0x5a')]==='user'){var _0x10f38d=_0x6d343['get']({'plain':!![]});var _0x41f510=_0x8157('0x37');return db[_0x8157('0x5b')][_0x8157('0x5c')]({'where':{'name':_0x41f510,'userProfileId':_0x403bd2[_0x8157('0x5d')]},'raw':!![]})[_0x8157('0x21')](function(_0x5992df){if(_0x5992df&&_0x5992df['autoAssociation']===0x0){return db[_0x8157('0x38')][_0x8157('0x56')]({'name':_0x10f38d[_0x8157('0x3a')],'resourceId':_0x10f38d['id'],'type':_0x5992df['name'],'sectionId':_0x5992df['id']},{})[_0x8157('0x21')](function(){return _0x6d343;});}else{return _0x6d343;}})[_0x8157('0x53')](function(_0x3ee2c7){logger[_0x8157('0x26')](_0x8157('0x5e'),_0x3ee2c7);throw _0x3ee2c7;});}return _0x6d343;})[_0x8157('0x21')](respondWithResult(_0x3961a8,0xc9))[_0x8157('0x53')](handleError(_0x3961a8,null));};exports[_0x8157('0x5f')]=function(_0x428976,_0x141608){if(_0x428976[_0x8157('0x57')]['id']){delete _0x428976[_0x8157('0x57')]['id'];}return db[_0x8157('0x3d')][_0x8157('0x5c')]({'where':{'id':_0x428976[_0x8157('0x54')]['id']}})['then'](handleEntityNotFound(_0x141608,null))[_0x8157('0x21')](saveUpdates(_0x428976[_0x8157('0x57')],null))[_0x8157('0x21')](respondWithResult(_0x141608,null))[_0x8157('0x53')](handleError(_0x141608,null));};exports[_0x8157('0x35')]=function(_0x420d17,_0x21fffd){return db['ChatQueue'][_0x8157('0x5c')]({'where':{'id':_0x420d17[_0x8157('0x54')]['id']}})['then'](handleEntityNotFound(_0x21fffd,null))[_0x8157('0x21')](removeEntity(_0x21fffd,null))[_0x8157('0x53')](handleError(_0x21fffd,null));};exports['describe']=function(_0xe7f9ce,_0x2003e2){return db[_0x8157('0x3d')][_0x8157('0x60')]()[_0x8157('0x21')](respondWithResult(_0x2003e2,null))[_0x8157('0x53')](handleError(_0x2003e2,null));};exports[_0x8157('0x61')]=function(_0x23590d,_0x4c0b33,_0x328e01){var _0x383162={'raw':!![],'where':{}},_0x45a9a6={},_0x35f05b;return db[_0x8157('0x3d')][_0x8157('0x62')]({'where':{'id':_0x23590d['params']['id']}})['then'](handleEntityNotFound(_0x4c0b33,null))[_0x8157('0x21')](function(_0x5c2bb1){if(_0x5c2bb1){_0x35f05b=_0x5c2bb1[_0x8157('0x36')]({'plain':!![]});_0x45a9a6[_0x8157('0x42')]=_[_0x8157('0x44')](db['UserChatQueue'][_0x8157('0x3e')]);_0x45a9a6[_0x8157('0x43')]=_[_0x8157('0x44')](_0x23590d[_0x8157('0x43')]);_0x45a9a6[_0x8157('0x45')]=_[_0x8157('0x46')](_0x45a9a6[_0x8157('0x42')],_0x45a9a6['query']);_0x383162['attributes']=_['intersection'](_0x45a9a6['model'],qs['fields'](_0x23590d[_0x8157('0x43')][_0x8157('0x48')]));_0x383162[_0x8157('0x47')]=_0x383162[_0x8157('0x47')]['length']?_0x383162[_0x8157('0x47')]:_0x45a9a6[_0x8157('0x42')];if(!_0x23590d['query'][_0x8157('0x63')](_0x8157('0x64'))){_0x383162['limit']=qs[_0x8157('0x30')](_0x23590d[_0x8157('0x43')]['limit']);_0x383162[_0x8157('0x2e')]=qs['offset'](_0x23590d[_0x8157('0x43')][_0x8157('0x2e')]);}_0x383162[_0x8157('0x49')]=qs[_0x8157('0x65')](_0x23590d['query'][_0x8157('0x65')]);_0x383162['where']=qs[_0x8157('0x45')](_[_0x8157('0x4a')](_0x23590d['query'],_0x45a9a6[_0x8157('0x45')]));_0x383162[_0x8157('0x4c')][_0x8157('0x66')]=_0x5c2bb1['id'];if(_0x23590d[_0x8157('0x43')][_0x8157('0x4b')]){_0x383162['where']=_[_0x8157('0x4d')](_0x383162[_0x8157('0x4c')],{'$or':_[_0x8157('0x3c')](_0x383162[_0x8157('0x47')],function(_0x14c3ba){var _0x29a05f={};_0x29a05f[_0x14c3ba]={'$like':'%'+_0x23590d[_0x8157('0x43')]['filter']+'%'};return _0x29a05f;})});}_0x383162=_[_0x8157('0x4d')]({},_0x383162,_0x23590d['options']);return db[_0x8157('0x67')][_0x8157('0x68')](_0x383162);}})[_0x8157('0x21')](function(_0x172c01){if(_0x172c01){return db['User'][_0x8157('0x69')]({'where':{'id':_[_0x8157('0x3c')](_0x172c01,_0x8157('0x6a')),'role':'agent'},'attributes':['id',_0x8157('0x3a'),'chatPause',_0x8157('0x6b'),_0x8157('0x6c')]});}})[_0x8157('0x21')](function(_0x54edff){if(_0x54edff){return{'count':_0x54edff[_0x8157('0x50')],'rows':_[_0x8157('0x3c')](_0x54edff[_0x8157('0x6d')],function(_0x3f180e){return{'membername':_0x3f180e[_0x8157('0x3a')],'UserId':_0x3f180e['id'],'queue_name':_0x35f05b[_0x8157('0x3a')],'ChatQueueId':_0x35f05b['id'],'interface':util[_0x8157('0x6e')](_0x8157('0x6f'),_0x8157('0x70'),_0x3f180e[_0x8157('0x3a')]),'penalty':0x0,'paused':_0x3f180e['chatPause'],'createdAt':_0x3f180e[_0x8157('0x6c')],'updatedAt':_0x3f180e[_0x8157('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8157('0x21')](respondWithFilteredResult(_0x4c0b33,_0x383162))['catch'](handleError(_0x4c0b33,null));};exports[_0x8157('0x71')]=function(_0x5b1077,_0x18192e,_0x2c40ae){var _0x5f2e6c={};var _0x3132fa={};var _0x125a7a;var _0x5b1507;return db['ChatQueue'][_0x8157('0x62')]({'where':{'id':_0x5b1077[_0x8157('0x54')]['id']}})[_0x8157('0x21')](handleEntityNotFound(_0x18192e,null))['then'](function(_0x591052){if(_0x591052){_0x125a7a=_0x591052;_0x3132fa[_0x8157('0x42')]=_[_0x8157('0x44')](db[_0x8157('0x72')]['rawAttributes']);_0x3132fa['query']=_['keys'](_0x5b1077[_0x8157('0x43')]);_0x3132fa[_0x8157('0x45')]=_['intersection'](_0x3132fa[_0x8157('0x42')],_0x3132fa[_0x8157('0x43')]);_0x5f2e6c['attributes']=_[_0x8157('0x46')](_0x3132fa[_0x8157('0x42')],qs[_0x8157('0x48')](_0x5b1077[_0x8157('0x43')][_0x8157('0x48')]));_0x5f2e6c[_0x8157('0x47')]=_0x5f2e6c[_0x8157('0x47')][_0x8157('0x55')]?_0x5f2e6c[_0x8157('0x47')]:_0x3132fa['model'];_0x5f2e6c[_0x8157('0x49')]=qs[_0x8157('0x65')](_0x5b1077[_0x8157('0x43')][_0x8157('0x65')]);_0x5f2e6c['where']=qs['filters'](_[_0x8157('0x4a')](_0x5b1077[_0x8157('0x43')],_0x3132fa[_0x8157('0x45')]));if(_0x5b1077[_0x8157('0x43')][_0x8157('0x4b')]){_0x5f2e6c[_0x8157('0x4c')]=_[_0x8157('0x4d')](_0x5f2e6c[_0x8157('0x4c')],{'$or':_[_0x8157('0x3c')](_0x5f2e6c['attributes'],function(_0x5518cd){var _0x42ce53={};_0x42ce53[_0x5518cd]={'$like':'%'+_0x5b1077[_0x8157('0x43')][_0x8157('0x4b')]+'%'};return _0x42ce53;})});}_0x5f2e6c=_['merge']({},_0x5f2e6c,_0x5b1077['options']);return _0x125a7a[_0x8157('0x71')](_0x5f2e6c);}})[_0x8157('0x21')](function(_0x247dbe){if(_0x247dbe){_0x5b1507=_0x247dbe[_0x8157('0x55')];if(!_0x5b1077[_0x8157('0x43')]['hasOwnProperty'](_0x8157('0x64'))){_0x5f2e6c[_0x8157('0x30')]=qs[_0x8157('0x30')](_0x5b1077['query']['limit']);_0x5f2e6c[_0x8157('0x2e')]=qs[_0x8157('0x2e')](_0x5b1077['query'][_0x8157('0x2e')]);}return _0x125a7a[_0x8157('0x71')](_0x5f2e6c);}})['then'](function(_0x19d075){if(_0x19d075){return _0x19d075?{'count':_0x5b1507,'rows':_0x19d075}:null;}})[_0x8157('0x21')](respondWithResult(_0x18192e,null))[_0x8157('0x53')](handleError(_0x18192e,null));};exports[_0x8157('0x73')]=function(_0x4cfd73,_0x48b427,_0x5a118f){var _0xf22283=_0x4cfd73[_0x8157('0x57')][_0x8157('0x74')];return db[_0x8157('0x72')][_0x8157('0x68')]({'where':{'id':_0xf22283},'attributes':['id'],'include':[{'model':db[_0x8157('0x75')],'as':_0x8157('0x76'),'attributes':['id',_0x8157('0x3a'),_0x8157('0x77'),_0x8157('0x78'),_0x8157('0x79')],'raw':!![]}]})['then'](function(_0x2267c7){if(_0x2267c7){var _0x18e9f3=_[_0x8157('0x7a')](_0x2267c7,function(_0x1efff7){var _0x3815d7=_0x1efff7['get']({'plain':!![]});return _0x3815d7['Agents'];});return db[_0x8157('0x3d')][_0x8157('0x5c')]({'where':{'id':_0x4cfd73[_0x8157('0x54')]['id']}})[_0x8157('0x21')](function(_0x591ad2){return db['sequelize'][_0x8157('0x7b')](function(_0x2b2f72){return _0x591ad2[_0x8157('0x73')](_0xf22283,{'transaction':_0x2b2f72})['then'](function(){return BPromise[_0x8157('0x7c')](_0x18e9f3,function(_0x51421b){return db['UserChatQueue'][_0x8157('0x7d')]({'where':{'UserId':_0x51421b['id'],'ChatQueueId':_0x4cfd73[_0x8157('0x54')]['id']},'transaction':_0x2b2f72});});})['then'](function(){_0x18e9f3[_0x8157('0x7e')](function(_0xffd09a){socket[_0x8157('0x7f')](_0x8157('0x80'),{'UserId':_0xffd09a['id'],'ChatQueueId':_0x591ad2['id']});});});});});}})['then'](respondWithStatusCode(_0x48b427,null))[_0x8157('0x53')](handleError(_0x48b427,null));};exports[_0x8157('0x81')]=function(_0x159764,_0x29297f,_0x40b847){return db['Team'][_0x8157('0x68')]({'where':{'id':_0x159764['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8157('0x75')],'as':_0x8157('0x76'),'attributes':['id'],'raw':!![]}]})[_0x8157('0x21')](handleEntityNotFound(_0x29297f,null))[_0x8157('0x21')](function(_0x5da071){var _0x532d51=_[_0x8157('0x3c')](_0x5da071,'id');var _0x35c24b=[];var _0x2949db=[];var _0x33ed82=squel[_0x8157('0x82')]();_0x33ed82[_0x8157('0x83')](_0x8157('0x84'))[_0x8157('0x85')](_0x8157('0x86'),'tq')[_0x8157('0x87')](_0x8157('0x88'),'ut',_0x8157('0x89'))[_0x8157('0x4c')](_0x8157('0x8a'),_0x159764[_0x8157('0x54')]['id']);for(var _0xbc3199=0x0;_0xbc3199<_0x5da071['length'];_0xbc3199+=0x1){let _0x4e3904=_0x5da071[_0xbc3199];for(var _0x4e1f6f=0x0;_0x4e1f6f<_0x4e3904[_0x8157('0x76')][_0x8157('0x55')];_0x4e1f6f+=0x1){let _0x4b27df=_0x4e3904[_0x8157('0x76')][_0x4e1f6f];var _0xd8a61b=_0x33ed82[_0x8157('0x8b')]();_0xd8a61b[_0x8157('0x4c')]('ut.UserId\x20=\x20?',_0x4b27df['id']);_0x2949db['push'](db['sequelize']['query'](_0xd8a61b[_0x8157('0x8c')](),{'type':db['sequelize'][_0x8157('0x8d')][_0x8157('0x8e')]})['then'](function(_0x2d7e02){if(_0x2d7e02['length']===0x1){return _0x4b27df['id'];}else{var _0x26e026=_[_0x8157('0x8f')](_[_0x8157('0x3c')](_0x2d7e02,_0x8157('0x90')),function(_0x294167){return _[_0x8157('0x91')](_0x532d51,_0x294167);});if(_0x26e026){return _0x4b27df['id'];}}}));}}return BPromise['all'](_0x2949db)['then'](function(_0x1c676b){_0x35c24b=_(_0x35c24b)[_0x8157('0x92')](_0x1c676b)[_0x8157('0x93')]()[_0x8157('0x94')]();return db['ChatQueue'][_0x8157('0x5c')]({'where':{'id':_0x159764[_0x8157('0x54')]['id']}})['then'](function(_0x57ae70){return db[_0x8157('0x95')]['transaction'](function(_0x257fad){return _0x57ae70['removeTeams'](_0x159764[_0x8157('0x43')][_0x8157('0x74')],{'transaction':_0x257fad})[_0x8157('0x21')](function(){if(!_[_0x8157('0x96')](_0x35c24b)){return _0x57ae70['removeAgents'](_0x35c24b,{'transaction':_0x257fad});}})[_0x8157('0x21')](function(){_0x35c24b[_0x8157('0x7e')](function(_0x11ed81){socket[_0x8157('0x7f')](_0x8157('0x97'),{'UserId':_0x11ed81,'ChatQueueId':_0x57ae70['id']});});});});});});})[_0x8157('0x21')](respondWithStatusCode(_0x29297f,null))[_0x8157('0x53')](handleError(_0x29297f,null));};exports[_0x8157('0x98')]=function(_0x32b606,_0x25be80,_0x488ef0){return db['ChatQueue'][_0x8157('0x5c')]({'where':{'id':_0x32b606['params']['id']}})[_0x8157('0x21')](handleEntityNotFound(_0x25be80,null))[_0x8157('0x21')](function(_0x3a1807){if(_0x3a1807){return _0x3a1807['addAgents'](_0x32b606['body']['ids'],_['omit'](_0x32b606['body'],[_0x8157('0x74'),'id'])||{})[_0x8157('0x99')](function(_0x1a8d99){for(var _0x15dff9=0x0;_0x15dff9<_0x32b606[_0x8157('0x57')][_0x8157('0x74')][_0x8157('0x55')];_0x15dff9+=0x1){socket['emit'](_0x8157('0x80'),{'UserId':Number(_0x32b606[_0x8157('0x57')]['ids'][_0x15dff9]),'ChatQueueId':Number(_0x32b606[_0x8157('0x54')]['id'])});}return _0x1a8d99;});}})[_0x8157('0x21')](respondWithResult(_0x25be80,null))[_0x8157('0x53')](handleError(_0x25be80,null));};exports['removeAgents']=function(_0x1b404d,_0x5e64d8,_0x21b870){return db[_0x8157('0x3d')][_0x8157('0x5c')]({'where':{'id':_0x1b404d[_0x8157('0x54')]['id']}})[_0x8157('0x21')](handleEntityNotFound(_0x5e64d8,null))[_0x8157('0x21')](function(_0xc7d872){if(_0xc7d872){return _0xc7d872['removeAgents'](_0x1b404d['query'][_0x8157('0x74')])[_0x8157('0x21')](function(){if(_[_0x8157('0x9a')](_0x1b404d[_0x8157('0x43')][_0x8157('0x74')])){for(var _0x4e6a46=0x0;_0x4e6a46<_0x1b404d[_0x8157('0x43')]['ids'][_0x8157('0x55')];_0x4e6a46+=0x1){socket[_0x8157('0x7f')](_0x8157('0x97'),{'UserId':Number(_0x1b404d['query']['ids'][_0x4e6a46]),'ChatQueueId':Number(_0x1b404d['params']['id'])});}}else{socket[_0x8157('0x7f')](_0x8157('0x97'),{'UserId':Number(_0x1b404d[_0x8157('0x43')]['ids']),'ChatQueueId':Number(_0x1b404d[_0x8157('0x54')]['id'])});}});}})[_0x8157('0x21')](respondWithStatusCode(_0x5e64d8,null))[_0x8157('0x53')](handleError(_0x5e64d8,null));};exports['getAgents']=function(_0x554851,_0x510509,_0x5c57ff){var _0x17f4d0={};var _0x4657a6={};var _0x1de9ff;var _0x2d3c7e;return db[_0x8157('0x3d')][_0x8157('0x62')]({'where':{'id':_0x554851[_0x8157('0x54')]['id']}})[_0x8157('0x21')](handleEntityNotFound(_0x510509,null))[_0x8157('0x21')](function(_0x3f9cbd){if(_0x3f9cbd){_0x1de9ff=_0x3f9cbd;_0x4657a6[_0x8157('0x42')]=_[_0x8157('0x44')](db['User'][_0x8157('0x3e')]);_0x4657a6[_0x8157('0x43')]=_['keys'](_0x554851['query']);_0x4657a6[_0x8157('0x45')]=_['intersection'](_0x4657a6[_0x8157('0x42')],_0x4657a6['query']);_0x17f4d0['attributes']=_[_0x8157('0x46')](_0x4657a6[_0x8157('0x42')],qs[_0x8157('0x48')](_0x554851['query']['fields']));_0x17f4d0['attributes']=_0x17f4d0[_0x8157('0x47')][_0x8157('0x55')]?_0x17f4d0[_0x8157('0x47')]:_0x4657a6[_0x8157('0x42')];_0x17f4d0[_0x8157('0x49')]=qs[_0x8157('0x65')](_0x554851['query'][_0x8157('0x65')]);_0x17f4d0[_0x8157('0x4c')]=qs[_0x8157('0x45')](_[_0x8157('0x4a')](_0x554851[_0x8157('0x43')],_0x4657a6['filters']));if(_0x554851[_0x8157('0x43')]['filter']){_0x17f4d0[_0x8157('0x4c')]=_[_0x8157('0x4d')](_0x17f4d0['where'],{'$or':_[_0x8157('0x3c')](_0x17f4d0[_0x8157('0x47')],function(_0xcce519){var _0x4ef81f={};_0x4ef81f[_0xcce519]={'$like':'%'+_0x554851[_0x8157('0x43')][_0x8157('0x4b')]+'%'};return _0x4ef81f;})});}_0x17f4d0=_[_0x8157('0x4d')]({},_0x17f4d0,_0x554851[_0x8157('0x4f')]);return _0x1de9ff[_0x8157('0x9b')](_0x17f4d0);}})['then'](function(_0x4ac157){if(_0x4ac157){_0x2d3c7e=_0x4ac157[_0x8157('0x55')];if(!_0x554851[_0x8157('0x43')][_0x8157('0x63')](_0x8157('0x64'))){_0x17f4d0[_0x8157('0x30')]=qs[_0x8157('0x30')](_0x554851['query'][_0x8157('0x30')]);_0x17f4d0['offset']=qs[_0x8157('0x2e')](_0x554851[_0x8157('0x43')][_0x8157('0x2e')]);}return _0x1de9ff[_0x8157('0x9b')](_0x17f4d0);}})[_0x8157('0x21')](function(_0x2ef817){if(_0x2ef817){return _0x2ef817?{'count':_0x2d3c7e,'rows':_0x2ef817}:null;}})['then'](respondWithResult(_0x510509,null))[_0x8157('0x53')](handleError(_0x510509,null));}; \ No newline at end of file +var _0x1ee1=['redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','ChatQueues','UserProfileResource','sendStatus','stack','name','send','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','describe','findOne','order','pick','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5cceb8,_0xa8e57a){var _0xeaf4be=function(_0x154250){while(--_0x154250){_0x5cceb8['push'](_0x5cceb8['shift']());}};_0xeaf4be(++_0xa8e57a);}(_0x1ee1,0x117));var _0x11ee=function(_0x35dff9,_0x3e50d0){_0x35dff9=_0x35dff9-0x0;var _0xfbc676=_0x1ee1[_0x35dff9];return _0xfbc676;};'use strict';var emlformat=require(_0x11ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11ee('0x1'));var jsonpatch=require(_0x11ee('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x11ee('0x3'));var Mustache=require(_0x11ee('0x4'));var util=require(_0x11ee('0x5'));var path=require(_0x11ee('0x6'));var sox=require('sox');var csv=require(_0x11ee('0x7'));var ejs=require(_0x11ee('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11ee('0x9'));var squel=require(_0x11ee('0xa'));var crypto=require('crypto');var jsforce=require(_0x11ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x11ee('0x7'));var querystring=require(_0x11ee('0xc'));var Papa=require('papaparse');var Redis=require(_0x11ee('0xd'));var authService=require(_0x11ee('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x11ee('0xf'));var hardwareService=require(_0x11ee('0x10'));var logger=require(_0x11ee('0x11'))('api');var utils=require(_0x11ee('0x12'));var config=require(_0x11ee('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x11ee('0x14'))['db'];config[_0x11ee('0x15')]=_[_0x11ee('0x16')](config[_0x11ee('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x11ee('0x17'))(new Redis(config[_0x11ee('0x15')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x11ee('0x18'));var client=jayson[_0x11ee('0x19')][_0x11ee('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x27e768,_0x1af9f4,_0x58f925,_0xf4956d){return new BPromise(function(_0x369f55,_0x2c2bf4){var _0x3f686d=_0xf4956d||client;return _0x3f686d[_0x11ee('0x1b')](_0x27e768,_0x58f925)[_0x11ee('0x1c')](function(_0x16fd56){logger[_0x11ee('0x1d')](_0x11ee('0x1e'),_0x1af9f4,_0x11ee('0x1f'));logger[_0x11ee('0x20')](_0x11ee('0x21'),_0x1af9f4,_0x11ee('0x1f'),JSON[_0x11ee('0x22')](_0x16fd56));if(_0x16fd56[_0x11ee('0x23')]){if(_0x16fd56[_0x11ee('0x23')][_0x11ee('0x24')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1af9f4,_0x16fd56[_0x11ee('0x23')]['message']);return _0x2c2bf4(_0x16fd56[_0x11ee('0x23')]['message']);}logger[_0x11ee('0x23')]('ChatQueue,\x20%s,\x20%s',_0x1af9f4,_0x16fd56['error']['message']);return _0x369f55(_0x16fd56[_0x11ee('0x23')][_0x11ee('0x25')]);}else{logger[_0x11ee('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x1af9f4,_0x11ee('0x1f'));_0x369f55(_0x16fd56[_0x11ee('0x26')]['message']);}})[_0x11ee('0x27')](function(_0x574786){logger[_0x11ee('0x23')]('ChatQueue,\x20%s,\x20%s',_0x1af9f4,_0x574786);_0x2c2bf4(_0x574786);});});}function respondWithStatusCode(_0x4f36c7,_0x3ef5df){_0x3ef5df=_0x3ef5df||0xcc;return function(_0x277971){if(_0x277971){return _0x4f36c7['sendStatus'](_0x3ef5df);}return _0x4f36c7[_0x11ee('0x28')](_0x3ef5df)[_0x11ee('0x29')]();};}function respondWithResult(_0x4c3949,_0x3947ed){_0x3947ed=_0x3947ed||0xc8;return function(_0x123e1d){if(_0x123e1d){return _0x4c3949[_0x11ee('0x28')](_0x3947ed)[_0x11ee('0x2a')](_0x123e1d);}};}function respondWithFilteredResult(_0x5e3f72,_0x2118fb){return function(_0x3fc54d){if(_0x3fc54d){var _0x838605=typeof _0x2118fb['offset']===_0x11ee('0x2b')&&typeof _0x2118fb['limit']===_0x11ee('0x2b');var _0x3f446e=_0x3fc54d['count'];var _0xdd330e=_0x838605?0x0:_0x2118fb[_0x11ee('0x2c')];var _0xa1d474=_0x838605?_0x3fc54d[_0x11ee('0x2d')]:_0x2118fb[_0x11ee('0x2c')]+_0x2118fb[_0x11ee('0x2e')];var _0x2e4e90;if(_0xa1d474>=_0x3f446e){_0xa1d474=_0x3f446e;_0x2e4e90=0xc8;}else{_0x2e4e90=0xce;}_0x5e3f72[_0x11ee('0x28')](_0x2e4e90);return _0x5e3f72[_0x11ee('0x2f')](_0x11ee('0x30'),_0xdd330e+'-'+_0xa1d474+'/'+_0x3f446e)[_0x11ee('0x2a')](_0x3fc54d);}return null;};}function patchUpdates(_0x41a5e7){return function(_0x28e4f0){try{jsonpatch['apply'](_0x28e4f0,_0x41a5e7,!![]);}catch(_0xfaabb4){return BPromise[_0x11ee('0x31')](_0xfaabb4);}return _0x28e4f0[_0x11ee('0x32')]();};}function saveUpdates(_0x2ad70c,_0x6b812d){return function(_0x24dc45){if(_0x24dc45){return _0x24dc45[_0x11ee('0x33')](_0x2ad70c)[_0x11ee('0x1c')](function(_0xcbae32){return _0xcbae32;});}return null;};}function removeEntity(_0x110932,_0x225b02){return function(_0x333c82){if(_0x333c82){return _0x333c82[_0x11ee('0x34')]()[_0x11ee('0x1c')](function(){var _0xdfce2b=_0x333c82['get']({'plain':!![]});var _0x4bb766=_0x11ee('0x35');return db[_0x11ee('0x36')][_0x11ee('0x34')]({'where':{'type':_0x4bb766,'resourceId':_0xdfce2b['id']}})['then'](function(){return _0x333c82;});})[_0x11ee('0x1c')](function(){_0x110932['status'](0xcc)[_0x11ee('0x29')]();});}};}function handleEntityNotFound(_0x1e8a44,_0x11c470){return function(_0x1a7e0d){if(!_0x1a7e0d){_0x1e8a44[_0x11ee('0x37')](0x194);}return _0x1a7e0d;};}function handleError(_0x36e968,_0x49d655){_0x49d655=_0x49d655||0x1f4;return function(_0x35570a){logger[_0x11ee('0x23')](_0x35570a[_0x11ee('0x38')]);if(_0x35570a[_0x11ee('0x39')]){delete _0x35570a[_0x11ee('0x39')];}_0x36e968[_0x11ee('0x28')](_0x49d655)[_0x11ee('0x3a')](_0x35570a);};}exports['index']=function(_0x2904f2,_0xd98b84){var _0x4ed33e={},_0x221c43={},_0x5ac985={'count':0x0,'rows':[]};var _0x59e111=_['map'](db[_0x11ee('0x3b')][_0x11ee('0x3c')],function(_0x3da34b){return{'name':_0x3da34b[_0x11ee('0x3d')],'type':_0x3da34b[_0x11ee('0x3e')][_0x11ee('0x3f')]};});_0x221c43[_0x11ee('0x40')]=_[_0x11ee('0x41')](_0x59e111,_0x11ee('0x39'));_0x221c43[_0x11ee('0x42')]=_['keys'](_0x2904f2[_0x11ee('0x42')]);_0x221c43[_0x11ee('0x43')]=_['intersection'](_0x221c43[_0x11ee('0x40')],_0x221c43[_0x11ee('0x42')]);_0x4ed33e[_0x11ee('0x44')]=_[_0x11ee('0x45')](_0x221c43['model'],qs['fields'](_0x2904f2[_0x11ee('0x42')][_0x11ee('0x46')]));_0x4ed33e[_0x11ee('0x44')]=_0x4ed33e[_0x11ee('0x44')][_0x11ee('0x47')]?_0x4ed33e[_0x11ee('0x44')]:_0x221c43[_0x11ee('0x40')];if(!_0x2904f2[_0x11ee('0x42')]['hasOwnProperty'](_0x11ee('0x48'))){_0x4ed33e[_0x11ee('0x2e')]=qs[_0x11ee('0x2e')](_0x2904f2[_0x11ee('0x42')][_0x11ee('0x2e')]);_0x4ed33e[_0x11ee('0x2c')]=qs[_0x11ee('0x2c')](_0x2904f2[_0x11ee('0x42')]['offset']);}_0x4ed33e['order']=qs[_0x11ee('0x49')](_0x2904f2[_0x11ee('0x42')][_0x11ee('0x49')]);_0x4ed33e[_0x11ee('0x4a')]=qs[_0x11ee('0x43')](_['pick'](_0x2904f2[_0x11ee('0x42')],_0x221c43['filters']),_0x59e111);if(_0x2904f2[_0x11ee('0x42')][_0x11ee('0x4b')]){_0x4ed33e[_0x11ee('0x4a')]=_[_0x11ee('0x4c')](_0x4ed33e[_0x11ee('0x4a')],{'$or':_[_0x11ee('0x41')](_0x59e111,function(_0x76d3d5){if(_0x76d3d5['type']!==_0x11ee('0x4d')){var _0x2ccf44={};_0x2ccf44[_0x76d3d5[_0x11ee('0x39')]]={'$like':'%'+_0x2904f2[_0x11ee('0x42')][_0x11ee('0x4b')]+'%'};return _0x2ccf44;}})});}_0x4ed33e=_[_0x11ee('0x4c')]({},_0x4ed33e,_0x2904f2['options']);var _0x1360af={'where':_0x4ed33e[_0x11ee('0x4a')]};return db[_0x11ee('0x3b')][_0x11ee('0x2d')](_0x1360af)[_0x11ee('0x1c')](function(_0x5a542a){_0x5ac985['count']=_0x5a542a;if(_0x2904f2[_0x11ee('0x42')][_0x11ee('0x4e')]){_0x4ed33e[_0x11ee('0x4f')]=[{'all':!![]}];}return db[_0x11ee('0x3b')][_0x11ee('0x50')](_0x4ed33e);})[_0x11ee('0x1c')](function(_0x572ae3){_0x5ac985['rows']=_0x572ae3;return _0x5ac985;})[_0x11ee('0x1c')](respondWithFilteredResult(_0xd98b84,_0x4ed33e))[_0x11ee('0x27')](handleError(_0xd98b84,null));};exports[_0x11ee('0x51')]=function(_0x20dd15,_0x2a4201){var _0x46f6e3={'raw':!![],'where':{'id':_0x20dd15[_0x11ee('0x52')]['id']}},_0x137ce8={};_0x137ce8[_0x11ee('0x40')]=_[_0x11ee('0x53')](db['ChatQueue'][_0x11ee('0x3c')]);_0x137ce8[_0x11ee('0x42')]=_['keys'](_0x20dd15['query']);_0x137ce8[_0x11ee('0x43')]=_[_0x11ee('0x45')](_0x137ce8[_0x11ee('0x40')],_0x137ce8['query']);_0x46f6e3[_0x11ee('0x44')]=_[_0x11ee('0x45')](_0x137ce8['model'],qs[_0x11ee('0x46')](_0x20dd15[_0x11ee('0x42')]['fields']));_0x46f6e3[_0x11ee('0x44')]=_0x46f6e3[_0x11ee('0x44')][_0x11ee('0x47')]?_0x46f6e3[_0x11ee('0x44')]:_0x137ce8[_0x11ee('0x40')];if(_0x20dd15['query'][_0x11ee('0x4e')]){_0x46f6e3[_0x11ee('0x4f')]=[{'all':!![]}];}_0x46f6e3=_[_0x11ee('0x4c')]({},_0x46f6e3,_0x20dd15[_0x11ee('0x54')]);return db['ChatQueue']['find'](_0x46f6e3)[_0x11ee('0x1c')](handleEntityNotFound(_0x2a4201,null))[_0x11ee('0x1c')](respondWithResult(_0x2a4201,null))[_0x11ee('0x27')](handleError(_0x2a4201,null));};exports[_0x11ee('0x55')]=function(_0x1296fb,_0x18392c){return db[_0x11ee('0x3b')][_0x11ee('0x55')](_0x1296fb[_0x11ee('0x56')],{})[_0x11ee('0x1c')](function(_0x44481d){var _0x15eef3=_0x1296fb['user'][_0x11ee('0x57')]({'plain':!![]});if(!_0x15eef3)throw new Error(_0x11ee('0x58'));if(_0x15eef3[_0x11ee('0x59')]==='user'){var _0x462283=_0x44481d['get']({'plain':!![]});var _0x14ee74='ChatQueues';return db[_0x11ee('0x5a')][_0x11ee('0x5b')]({'where':{'name':_0x14ee74,'userProfileId':_0x15eef3['userProfileId']},'raw':!![]})[_0x11ee('0x1c')](function(_0x5ba680){if(_0x5ba680&&_0x5ba680[_0x11ee('0x5c')]===0x0){return db[_0x11ee('0x36')][_0x11ee('0x55')]({'name':_0x462283['name'],'resourceId':_0x462283['id'],'type':_0x5ba680[_0x11ee('0x39')],'sectionId':_0x5ba680['id']},{})[_0x11ee('0x1c')](function(){return _0x44481d;});}else{return _0x44481d;}})[_0x11ee('0x27')](function(_0x3a4e2d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a4e2d);throw _0x3a4e2d;});}return _0x44481d;})[_0x11ee('0x1c')](respondWithResult(_0x18392c,0xc9))['catch'](handleError(_0x18392c,null));};exports[_0x11ee('0x33')]=function(_0x418a81,_0x4472de){if(_0x418a81[_0x11ee('0x56')]['id']){delete _0x418a81['body']['id'];}return db[_0x11ee('0x3b')][_0x11ee('0x5b')]({'where':{'id':_0x418a81[_0x11ee('0x52')]['id']}})['then'](handleEntityNotFound(_0x4472de,null))[_0x11ee('0x1c')](saveUpdates(_0x418a81[_0x11ee('0x56')],null))[_0x11ee('0x1c')](respondWithResult(_0x4472de,null))[_0x11ee('0x27')](handleError(_0x4472de,null));};exports[_0x11ee('0x34')]=function(_0x31ff5c,_0xcd600e){return db[_0x11ee('0x3b')][_0x11ee('0x5b')]({'where':{'id':_0x31ff5c[_0x11ee('0x52')]['id']}})['then'](handleEntityNotFound(_0xcd600e,null))['then'](removeEntity(_0xcd600e,null))['catch'](handleError(_0xcd600e,null));};exports['describe']=function(_0x443d28,_0x504c95){return db[_0x11ee('0x3b')][_0x11ee('0x5d')]()[_0x11ee('0x1c')](respondWithResult(_0x504c95,null))[_0x11ee('0x27')](handleError(_0x504c95,null));};exports['getMembers']=function(_0x4c5bd9,_0x1e8fe2,_0x534c0c){var _0x3fafaa={'raw':!![],'where':{}},_0x2d5dc6={},_0x10a04f;return db[_0x11ee('0x3b')][_0x11ee('0x5e')]({'where':{'id':_0x4c5bd9[_0x11ee('0x52')]['id']}})[_0x11ee('0x1c')](handleEntityNotFound(_0x1e8fe2,null))[_0x11ee('0x1c')](function(_0x10f157){if(_0x10f157){_0x10a04f=_0x10f157[_0x11ee('0x57')]({'plain':!![]});_0x2d5dc6['model']=_['keys'](db['UserChatQueue'][_0x11ee('0x3c')]);_0x2d5dc6[_0x11ee('0x42')]=_[_0x11ee('0x53')](_0x4c5bd9[_0x11ee('0x42')]);_0x2d5dc6[_0x11ee('0x43')]=_[_0x11ee('0x45')](_0x2d5dc6['model'],_0x2d5dc6[_0x11ee('0x42')]);_0x3fafaa['attributes']=_[_0x11ee('0x45')](_0x2d5dc6[_0x11ee('0x40')],qs[_0x11ee('0x46')](_0x4c5bd9['query'][_0x11ee('0x46')]));_0x3fafaa['attributes']=_0x3fafaa[_0x11ee('0x44')][_0x11ee('0x47')]?_0x3fafaa['attributes']:_0x2d5dc6['model'];if(!_0x4c5bd9['query']['hasOwnProperty'](_0x11ee('0x48'))){_0x3fafaa[_0x11ee('0x2e')]=qs[_0x11ee('0x2e')](_0x4c5bd9[_0x11ee('0x42')]['limit']);_0x3fafaa['offset']=qs[_0x11ee('0x2c')](_0x4c5bd9[_0x11ee('0x42')]['offset']);}_0x3fafaa[_0x11ee('0x5f')]=qs[_0x11ee('0x49')](_0x4c5bd9[_0x11ee('0x42')][_0x11ee('0x49')]);_0x3fafaa[_0x11ee('0x4a')]=qs['filters'](_[_0x11ee('0x60')](_0x4c5bd9[_0x11ee('0x42')],_0x2d5dc6[_0x11ee('0x43')]));_0x3fafaa['where'][_0x11ee('0x61')]=_0x10f157['id'];if(_0x4c5bd9[_0x11ee('0x42')][_0x11ee('0x4b')]){_0x3fafaa[_0x11ee('0x4a')]=_['merge'](_0x3fafaa['where'],{'$or':_[_0x11ee('0x41')](_0x3fafaa['attributes'],function(_0x47d47b){var _0x478689={};_0x478689[_0x47d47b]={'$like':'%'+_0x4c5bd9['query'][_0x11ee('0x4b')]+'%'};return _0x478689;})});}_0x3fafaa=_['merge']({},_0x3fafaa,_0x4c5bd9[_0x11ee('0x54')]);return db[_0x11ee('0x62')][_0x11ee('0x50')](_0x3fafaa);}})['then'](function(_0x132474){if(_0x132474){return db['User'][_0x11ee('0x63')]({'where':{'id':_[_0x11ee('0x41')](_0x132474,_0x11ee('0x64')),'role':_0x11ee('0x65')},'attributes':['id','name',_0x11ee('0x66'),_0x11ee('0x67'),_0x11ee('0x68')]});}})[_0x11ee('0x1c')](function(_0x236725){if(_0x236725){return{'count':_0x236725[_0x11ee('0x2d')],'rows':_[_0x11ee('0x41')](_0x236725['rows'],function(_0x5c6e2a){return{'membername':_0x5c6e2a[_0x11ee('0x39')],'UserId':_0x5c6e2a['id'],'queue_name':_0x10a04f[_0x11ee('0x39')],'ChatQueueId':_0x10a04f['id'],'interface':util[_0x11ee('0x69')](_0x11ee('0x6a'),'SIP',_0x5c6e2a['name']),'penalty':0x0,'paused':_0x5c6e2a[_0x11ee('0x66')],'createdAt':_0x5c6e2a[_0x11ee('0x68')],'updatedAt':_0x5c6e2a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x11ee('0x1c')](respondWithFilteredResult(_0x1e8fe2,_0x3fafaa))['catch'](handleError(_0x1e8fe2,null));};exports['getTeams']=function(_0x8147f1,_0x58ddb8,_0x305489){var _0x4a5050={};var _0x15a958={};var _0x3ceab9;var _0x2255c1;return db[_0x11ee('0x3b')][_0x11ee('0x5e')]({'where':{'id':_0x8147f1[_0x11ee('0x52')]['id']}})['then'](handleEntityNotFound(_0x58ddb8,null))[_0x11ee('0x1c')](function(_0x46ed46){if(_0x46ed46){_0x3ceab9=_0x46ed46;_0x15a958[_0x11ee('0x40')]=_['keys'](db[_0x11ee('0x6b')][_0x11ee('0x3c')]);_0x15a958['query']=_[_0x11ee('0x53')](_0x8147f1[_0x11ee('0x42')]);_0x15a958[_0x11ee('0x43')]=_[_0x11ee('0x45')](_0x15a958[_0x11ee('0x40')],_0x15a958['query']);_0x4a5050[_0x11ee('0x44')]=_[_0x11ee('0x45')](_0x15a958[_0x11ee('0x40')],qs[_0x11ee('0x46')](_0x8147f1[_0x11ee('0x42')]['fields']));_0x4a5050[_0x11ee('0x44')]=_0x4a5050[_0x11ee('0x44')]['length']?_0x4a5050['attributes']:_0x15a958[_0x11ee('0x40')];_0x4a5050[_0x11ee('0x5f')]=qs[_0x11ee('0x49')](_0x8147f1[_0x11ee('0x42')][_0x11ee('0x49')]);_0x4a5050[_0x11ee('0x4a')]=qs[_0x11ee('0x43')](_[_0x11ee('0x60')](_0x8147f1[_0x11ee('0x42')],_0x15a958['filters']));if(_0x8147f1[_0x11ee('0x42')]['filter']){_0x4a5050[_0x11ee('0x4a')]=_['merge'](_0x4a5050['where'],{'$or':_[_0x11ee('0x41')](_0x4a5050[_0x11ee('0x44')],function(_0x268b4b){var _0xa88b1a={};_0xa88b1a[_0x268b4b]={'$like':'%'+_0x8147f1['query'][_0x11ee('0x4b')]+'%'};return _0xa88b1a;})});}_0x4a5050=_[_0x11ee('0x4c')]({},_0x4a5050,_0x8147f1['options']);return _0x3ceab9[_0x11ee('0x6c')](_0x4a5050);}})[_0x11ee('0x1c')](function(_0x22d56e){if(_0x22d56e){_0x2255c1=_0x22d56e[_0x11ee('0x47')];if(!_0x8147f1[_0x11ee('0x42')][_0x11ee('0x6d')](_0x11ee('0x48'))){_0x4a5050[_0x11ee('0x2e')]=qs[_0x11ee('0x2e')](_0x8147f1['query'][_0x11ee('0x2e')]);_0x4a5050[_0x11ee('0x2c')]=qs[_0x11ee('0x2c')](_0x8147f1[_0x11ee('0x42')][_0x11ee('0x2c')]);}return _0x3ceab9[_0x11ee('0x6c')](_0x4a5050);}})[_0x11ee('0x1c')](function(_0x10fb73){if(_0x10fb73){return _0x10fb73?{'count':_0x2255c1,'rows':_0x10fb73}:null;}})[_0x11ee('0x1c')](respondWithResult(_0x58ddb8,null))[_0x11ee('0x27')](handleError(_0x58ddb8,null));};exports[_0x11ee('0x6e')]=function(_0x2456f4,_0x33b9ae,_0x189659){var _0x945548=_0x2456f4[_0x11ee('0x56')][_0x11ee('0x6f')];return db[_0x11ee('0x6b')][_0x11ee('0x50')]({'where':{'id':_0x945548},'attributes':['id'],'include':[{'model':db['User'],'as':_0x11ee('0x70'),'attributes':['id','name',_0x11ee('0x71'),_0x11ee('0x72'),_0x11ee('0x73')],'raw':!![]}]})[_0x11ee('0x1c')](function(_0x173b32){if(_0x173b32){var _0x2ef59a=_[_0x11ee('0x74')](_0x173b32,function(_0x5054cd){var _0x24ce81=_0x5054cd[_0x11ee('0x57')]({'plain':!![]});return _0x24ce81[_0x11ee('0x70')];});return db[_0x11ee('0x3b')]['find']({'where':{'id':_0x2456f4['params']['id']}})[_0x11ee('0x1c')](function(_0x4caa8d){return db[_0x11ee('0x75')]['transaction'](function(_0x11cccb){return _0x4caa8d[_0x11ee('0x6e')](_0x945548,{'transaction':_0x11cccb})['then'](function(){return BPromise[_0x11ee('0x76')](_0x2ef59a,function(_0x2cb62e){return db[_0x11ee('0x62')][_0x11ee('0x77')]({'where':{'UserId':_0x2cb62e['id'],'ChatQueueId':_0x2456f4[_0x11ee('0x52')]['id']},'transaction':_0x11cccb});});})['then'](function(){_0x2ef59a[_0x11ee('0x78')](function(_0x1b83ea){socket[_0x11ee('0x79')](_0x11ee('0x7a'),{'UserId':_0x1b83ea['id'],'ChatQueueId':_0x4caa8d['id']});});});});});}})['then'](respondWithStatusCode(_0x33b9ae,null))[_0x11ee('0x27')](handleError(_0x33b9ae,null));};exports[_0x11ee('0x7b')]=function(_0x5e7801,_0x2e527e,_0x401ccb){return db[_0x11ee('0x6b')]['findAll']({'where':{'id':_0x5e7801['query'][_0x11ee('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x11ee('0x7c')],'as':_0x11ee('0x70'),'attributes':['id'],'raw':!![]}]})[_0x11ee('0x1c')](handleEntityNotFound(_0x2e527e,null))[_0x11ee('0x1c')](function(_0x56372c){var _0x454fed=_[_0x11ee('0x41')](_0x56372c,'id');var _0x5e9aed=[];var _0x562b0a=[];var _0x396230=squel['select']();_0x396230[_0x11ee('0x7d')](_0x11ee('0x7e'))[_0x11ee('0x7f')](_0x11ee('0x80'),'tq')[_0x11ee('0x81')](_0x11ee('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x11ee('0x4a')](_0x11ee('0x83'),_0x5e7801[_0x11ee('0x52')]['id']);for(var _0x3a13c9=0x0;_0x3a13c9<_0x56372c['length'];_0x3a13c9+=0x1){let _0x4f4df6=_0x56372c[_0x3a13c9];for(var _0x45a111=0x0;_0x45a111<_0x4f4df6[_0x11ee('0x70')][_0x11ee('0x47')];_0x45a111+=0x1){let _0x20f4bb=_0x4f4df6[_0x11ee('0x70')][_0x45a111];var _0x1a76bf=_0x396230[_0x11ee('0x84')]();_0x1a76bf[_0x11ee('0x4a')](_0x11ee('0x85'),_0x20f4bb['id']);_0x562b0a[_0x11ee('0x86')](db['sequelize']['query'](_0x1a76bf['toString'](),{'type':db['sequelize']['QueryTypes'][_0x11ee('0x87')]})[_0x11ee('0x1c')](function(_0x4d3971){if(_0x4d3971[_0x11ee('0x47')]===0x1){return _0x20f4bb['id'];}else{var _0x20a23f=_['every'](_[_0x11ee('0x41')](_0x4d3971,_0x11ee('0x88')),function(_0x3b5cb7){return _[_0x11ee('0x89')](_0x454fed,_0x3b5cb7);});if(_0x20a23f){return _0x20f4bb['id'];}}}));}}return BPromise['all'](_0x562b0a)[_0x11ee('0x1c')](function(_0x1302ce){_0x5e9aed=_(_0x5e9aed)[_0x11ee('0x8a')](_0x1302ce)[_0x11ee('0x8b')]()[_0x11ee('0x8c')]();return db[_0x11ee('0x3b')]['find']({'where':{'id':_0x5e7801[_0x11ee('0x52')]['id']}})['then'](function(_0xa28983){return db[_0x11ee('0x75')][_0x11ee('0x8d')](function(_0x50ff7e){return _0xa28983[_0x11ee('0x7b')](_0x5e7801[_0x11ee('0x42')][_0x11ee('0x6f')],{'transaction':_0x50ff7e})['then'](function(){if(!_[_0x11ee('0x8e')](_0x5e9aed)){return _0xa28983[_0x11ee('0x8f')](_0x5e9aed,{'transaction':_0x50ff7e});}})[_0x11ee('0x1c')](function(){_0x5e9aed[_0x11ee('0x78')](function(_0x2e5ce9){socket[_0x11ee('0x79')](_0x11ee('0x90'),{'UserId':_0x2e5ce9,'ChatQueueId':_0xa28983['id']});});});});});});})['then'](respondWithStatusCode(_0x2e527e,null))[_0x11ee('0x27')](handleError(_0x2e527e,null));};exports[_0x11ee('0x91')]=function(_0x35cf5e,_0x265595,_0x42d5e8){return db[_0x11ee('0x3b')]['find']({'where':{'id':_0x35cf5e[_0x11ee('0x52')]['id']}})[_0x11ee('0x1c')](handleEntityNotFound(_0x265595,null))[_0x11ee('0x1c')](function(_0x53fd40){if(_0x53fd40){return _0x53fd40[_0x11ee('0x91')](_0x35cf5e[_0x11ee('0x56')][_0x11ee('0x6f')],_[_0x11ee('0x92')](_0x35cf5e[_0x11ee('0x56')],[_0x11ee('0x6f'),'id'])||{})[_0x11ee('0x93')](function(_0x4945dd){for(var _0x1d8976=0x0;_0x1d8976<_0x35cf5e[_0x11ee('0x56')][_0x11ee('0x6f')][_0x11ee('0x47')];_0x1d8976+=0x1){socket[_0x11ee('0x79')]('userChatQueue:save',{'UserId':Number(_0x35cf5e['body'][_0x11ee('0x6f')][_0x1d8976]),'ChatQueueId':Number(_0x35cf5e['params']['id'])});}return _0x4945dd;});}})['then'](respondWithResult(_0x265595,null))[_0x11ee('0x27')](handleError(_0x265595,null));};exports[_0x11ee('0x8f')]=function(_0x203c4a,_0x206877,_0x346454){return db[_0x11ee('0x3b')]['find']({'where':{'id':_0x203c4a[_0x11ee('0x52')]['id']}})[_0x11ee('0x1c')](handleEntityNotFound(_0x206877,null))[_0x11ee('0x1c')](function(_0x1ec83d){if(_0x1ec83d){return _0x1ec83d[_0x11ee('0x8f')](_0x203c4a[_0x11ee('0x42')][_0x11ee('0x6f')])[_0x11ee('0x1c')](function(){if(_[_0x11ee('0x94')](_0x203c4a[_0x11ee('0x42')]['ids'])){for(var _0x36f685=0x0;_0x36f685<_0x203c4a[_0x11ee('0x42')][_0x11ee('0x6f')][_0x11ee('0x47')];_0x36f685+=0x1){socket[_0x11ee('0x79')]('userChatQueue:remove',{'UserId':Number(_0x203c4a['query'][_0x11ee('0x6f')][_0x36f685]),'ChatQueueId':Number(_0x203c4a[_0x11ee('0x52')]['id'])});}}else{socket[_0x11ee('0x79')](_0x11ee('0x90'),{'UserId':Number(_0x203c4a['query'][_0x11ee('0x6f')]),'ChatQueueId':Number(_0x203c4a[_0x11ee('0x52')]['id'])});}});}})[_0x11ee('0x1c')](respondWithStatusCode(_0x206877,null))[_0x11ee('0x27')](handleError(_0x206877,null));};exports['getAgents']=function(_0x97da0e,_0x223419,_0x27ac56){var _0x461eb8={};var _0x398812={};var _0x28c9ab;var _0x149021;return db[_0x11ee('0x3b')]['findOne']({'where':{'id':_0x97da0e['params']['id']}})['then'](handleEntityNotFound(_0x223419,null))[_0x11ee('0x1c')](function(_0x5af488){if(_0x5af488){_0x28c9ab=_0x5af488;_0x398812[_0x11ee('0x40')]=_[_0x11ee('0x53')](db[_0x11ee('0x7c')][_0x11ee('0x3c')]);_0x398812['query']=_[_0x11ee('0x53')](_0x97da0e[_0x11ee('0x42')]);_0x398812[_0x11ee('0x43')]=_[_0x11ee('0x45')](_0x398812[_0x11ee('0x40')],_0x398812[_0x11ee('0x42')]);_0x461eb8[_0x11ee('0x44')]=_[_0x11ee('0x45')](_0x398812[_0x11ee('0x40')],qs[_0x11ee('0x46')](_0x97da0e['query'][_0x11ee('0x46')]));_0x461eb8[_0x11ee('0x44')]=_0x461eb8[_0x11ee('0x44')]['length']?_0x461eb8[_0x11ee('0x44')]:_0x398812[_0x11ee('0x40')];_0x461eb8[_0x11ee('0x5f')]=qs[_0x11ee('0x49')](_0x97da0e['query']['sort']);_0x461eb8['where']=qs[_0x11ee('0x43')](_[_0x11ee('0x60')](_0x97da0e[_0x11ee('0x42')],_0x398812[_0x11ee('0x43')]));if(_0x97da0e[_0x11ee('0x42')]['filter']){_0x461eb8[_0x11ee('0x4a')]=_[_0x11ee('0x4c')](_0x461eb8[_0x11ee('0x4a')],{'$or':_[_0x11ee('0x41')](_0x461eb8[_0x11ee('0x44')],function(_0x789f99){var _0x48b612={};_0x48b612[_0x789f99]={'$like':'%'+_0x97da0e[_0x11ee('0x42')][_0x11ee('0x4b')]+'%'};return _0x48b612;})});}_0x461eb8=_[_0x11ee('0x4c')]({},_0x461eb8,_0x97da0e['options']);return _0x28c9ab[_0x11ee('0x95')](_0x461eb8);}})[_0x11ee('0x1c')](function(_0x11aa48){if(_0x11aa48){_0x149021=_0x11aa48[_0x11ee('0x47')];if(!_0x97da0e['query'][_0x11ee('0x6d')](_0x11ee('0x48'))){_0x461eb8[_0x11ee('0x2e')]=qs[_0x11ee('0x2e')](_0x97da0e[_0x11ee('0x42')]['limit']);_0x461eb8[_0x11ee('0x2c')]=qs['offset'](_0x97da0e[_0x11ee('0x42')][_0x11ee('0x2c')]);}return _0x28c9ab[_0x11ee('0x95')](_0x461eb8);}})[_0x11ee('0x1c')](function(_0x5a050e){if(_0x5a050e){return _0x5a050e?{'count':_0x149021,'rows':_0x5a050e}:null;}})['then'](respondWithResult(_0x223419,null))[_0x11ee('0x27')](handleError(_0x223419,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index cca904d..934c42d 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 _0x331c=['../../mysqldb','update','remove','emit','hook','exports'];(function(_0x500bb5,_0x547f7c){var _0x798307=function(_0xe19ba8){while(--_0xe19ba8){_0x500bb5['push'](_0x500bb5['shift']());}};_0x798307(++_0x547f7c);}(_0x331c,0xe4));var _0xc331=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x331c[_0xf50820];return _0x2a9b10;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xc331('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc331('0x1'),'afterDestroy':_0xc331('0x2')};function emitEvent(_0x5b7216){return function(_0x211440,_0x169fcf,_0x434c03){ChatQueueEvents['emit'](_0x5b7216+':'+_0x211440['id'],_0x211440);ChatQueueEvents[_0xc331('0x3')](_0x5b7216,_0x211440);_0x434c03(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xc331('0x4')](e,emitEvent(event));}}module[_0xc331('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0xcb81=['setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1a295b,_0x3a5c9a){var _0xaa1602=function(_0x91d655){while(--_0x91d655){_0x1a295b['push'](_0x1a295b['shift']());}};_0xaa1602(++_0x3a5c9a);}(_0xcb81,0x154));var _0x1cb8=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xcb81[_0x3e6b2f];return _0x323215;};'use strict';var EventEmitter=require(_0x1cb8('0x0'));var ChatQueue=require(_0x1cb8('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1cb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38c3ea){return function(_0x33a8f2,_0x237e94,_0x3642b9){ChatQueueEvents[_0x1cb8('0x3')](_0x38c3ea+':'+_0x33a8f2['id'],_0x33a8f2);ChatQueueEvents['emit'](_0x38c3ea,_0x33a8f2);_0x3642b9(null);};}for(var e in events){if(events[_0x1cb8('0x4')](e)){var event=events[e];ChatQueue[_0x1cb8('0x5')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 70fecf6..d746d70 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 _0x0ce2=['bluebird','request-promise','rimraf','../../config/environment','define','ChatQueue','lodash','util','api'];(function(_0x22a52d,_0x44dcef){var _0x366245=function(_0x212039){while(--_0x212039){_0x22a52d['push'](_0x22a52d['shift']());}};_0x366245(++_0x44dcef);}(_0x0ce2,0x84));var _0x20ce=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0ce2[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x20ce('0x0'));var util=require(_0x20ce('0x1'));var logger=require('../../config/logger')(_0x20ce('0x2'));var moment=require('moment');var BPromise=require(_0x20ce('0x3'));var rp=require(_0x20ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20ce('0x5'));var config=require(_0x20ce('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x321e78,_0x3952ed){return _0x321e78[_0x20ce('0x7')](_0x20ce('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae34=['define','chat_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xae34,0x124));var _0x4ae3=function(_0x4cee2c,_0x23d3d8){_0x4cee2c=_0x4cee2c-0x0;var _0x1505d8=_0xae34[_0x4cee2c];return _0x1505d8;};'use strict';var _=require('lodash');var util=require(_0x4ae3('0x0'));var logger=require(_0x4ae3('0x1'))(_0x4ae3('0x2'));var moment=require('moment');var BPromise=require(_0x4ae3('0x3'));var rp=require(_0x4ae3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae3('0x5'));var config=require(_0x4ae3('0x6'));var attributes=require(_0x4ae3('0x7'));module['exports']=function(_0x459f6f,_0x341982){return _0x459f6f[_0x4ae3('0x8')]('ChatQueue',attributes,{'tableName':_0x4ae3('0x9'),'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 bc4bff0..f8b4950 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 _0x1e44=['error','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','include','map','model','ShowChatQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e44,0xb3));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var moment=require(_0x41e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x41e4('0x3'));var fs=require('fs');var Redis=require(_0x41e4('0x4'));var db=require(_0x41e4('0x5'))['db'];var utils=require(_0x41e4('0x6'));var logger=require('../../config/logger')(_0x41e4('0x7'));var config=require(_0x41e4('0x8'));var jayson=require(_0x41e4('0x9'));var client=jayson[_0x41e4('0xa')][_0x41e4('0xb')]({'port':0x232a});config[_0x41e4('0xc')]=_[_0x41e4('0xd')](config[_0x41e4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x41e4('0xe'))(new Redis(config[_0x41e4('0xc')]));require(_0x41e4('0xf'))[_0x41e4('0x10')](socket);function respondWithRpcPromise(_0x1afa1c,_0x318431,_0x1e1bd7){return new BPromise(function(_0x45565d,_0x5593cd){return client['request'](_0x1afa1c,_0x1e1bd7)[_0x41e4('0x11')](function(_0x5e8114){logger[_0x41e4('0x12')](_0x41e4('0x13'),_0x318431,_0x41e4('0x14'));logger[_0x41e4('0x15')](_0x41e4('0x16'),_0x318431,_0x41e4('0x14'),JSON[_0x41e4('0x17')](_0x5e8114));if(_0x5e8114['error']){if(_0x5e8114['error'][_0x41e4('0x18')]===0x1f4){logger['error'](_0x41e4('0x13'),_0x318431,_0x5e8114['error'][_0x41e4('0x19')]);return _0x5593cd(_0x5e8114[_0x41e4('0x1a')][_0x41e4('0x19')]);}logger['error'](_0x41e4('0x13'),_0x318431,_0x5e8114[_0x41e4('0x1a')]['message']);return _0x45565d(_0x5e8114[_0x41e4('0x1a')]['message']);}else{logger['info'](_0x41e4('0x13'),_0x318431,_0x41e4('0x14'));_0x45565d(_0x5e8114[_0x41e4('0x1b')][_0x41e4('0x19')]);}})[_0x41e4('0x1c')](function(_0x5ecc5c){logger['error'](_0x41e4('0x13'),_0x318431,_0x5ecc5c);_0x5593cd(_0x5ecc5c);});});}exports[_0x41e4('0x1d')]=function(_0x42230e){var _0x21dba8=this;return new Promise(function(_0xea1550,_0x35b386){return db[_0x41e4('0x1e')][_0x41e4('0x1f')]({'raw':_0x42230e['options']?_0x42230e[_0x41e4('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x42230e[_0x41e4('0x20')]?_0x42230e[_0x41e4('0x20')][_0x41e4('0x21')]||null:null,'attributes':_0x42230e[_0x41e4('0x20')]?_0x42230e[_0x41e4('0x20')][_0x41e4('0x22')]||null:null,'limit':_0x42230e['options']?_0x42230e[_0x41e4('0x20')]['limit']||null:null,'include':_0x42230e[_0x41e4('0x20')]?_0x42230e[_0x41e4('0x20')][_0x41e4('0x23')]?_[_0x41e4('0x24')](_0x42230e[_0x41e4('0x20')][_0x41e4('0x23')],function(_0x46a5d1){return{'model':db[_0x46a5d1[_0x41e4('0x25')]],'as':_0x46a5d1['as'],'attributes':_0x46a5d1[_0x41e4('0x22')],'include':_0x46a5d1[_0x41e4('0x23')]?_[_0x41e4('0x24')](_0x46a5d1[_0x41e4('0x23')],function(_0x1b33e8){return{'model':db[_0x1b33e8[_0x41e4('0x25')]],'as':_0x1b33e8['as'],'attributes':_0x1b33e8[_0x41e4('0x22')],'include':_0x1b33e8[_0x41e4('0x23')]?_[_0x41e4('0x24')](_0x1b33e8[_0x41e4('0x23')],function(_0xff795e){return{'model':db[_0xff795e[_0x41e4('0x25')]],'as':_0xff795e['as'],'attributes':_0xff795e[_0x41e4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41e4('0x11')](function(_0x46ba7c){logger[_0x41e4('0x12')]('GetChatQueue',_0x42230e);logger[_0x41e4('0x15')](_0x41e4('0x1d'),_0x42230e,JSON[_0x41e4('0x17')](_0x46ba7c));_0xea1550(_0x46ba7c);})[_0x41e4('0x1c')](function(_0x111c8e){logger[_0x41e4('0x1a')](_0x41e4('0x1d'),_0x111c8e['message'],_0x42230e);_0x35b386(_0x21dba8[_0x41e4('0x1a')](0x1f4,_0x111c8e[_0x41e4('0x19')]));});});};exports[_0x41e4('0x26')]=function(_0x5ee29e){var _0x43324c=this;return new Promise(function(_0x3a7520,_0x130ad0){return db['ChatQueue'][_0x41e4('0x27')]({'raw':_0x5ee29e[_0x41e4('0x20')]?_0x5ee29e[_0x41e4('0x20')][_0x41e4('0x28')]===undefined?!![]:![]:!![],'where':_0x5ee29e['options']?_0x5ee29e[_0x41e4('0x20')][_0x41e4('0x21')]||null:null,'attributes':_0x5ee29e[_0x41e4('0x20')]?_0x5ee29e[_0x41e4('0x20')][_0x41e4('0x22')]||null:null,'include':_0x5ee29e['options']?_0x5ee29e[_0x41e4('0x20')][_0x41e4('0x23')]?_[_0x41e4('0x24')](_0x5ee29e[_0x41e4('0x20')]['include'],function(_0x2831b7){return{'model':db[_0x2831b7[_0x41e4('0x25')]],'as':_0x2831b7['as'],'attributes':_0x2831b7[_0x41e4('0x22')],'include':_0x2831b7[_0x41e4('0x23')]?_['map'](_0x2831b7['include'],function(_0x5ef1c1){return{'model':db[_0x5ef1c1[_0x41e4('0x25')]],'as':_0x5ef1c1['as'],'attributes':_0x5ef1c1[_0x41e4('0x22')],'include':_0x5ef1c1['include']?_[_0x41e4('0x24')](_0x5ef1c1['include'],function(_0x4e73ac){return{'model':db[_0x4e73ac[_0x41e4('0x25')]],'as':_0x4e73ac['as'],'attributes':_0x4e73ac[_0x41e4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41e4('0x11')](function(_0x3de587){logger[_0x41e4('0x12')](_0x41e4('0x26'),_0x5ee29e);logger[_0x41e4('0x15')](_0x41e4('0x26'),_0x5ee29e,JSON[_0x41e4('0x17')](_0x3de587));_0x3a7520(_0x3de587);})['catch'](function(_0x51018a){logger['error'](_0x41e4('0x26'),_0x51018a['message'],_0x5ee29e);_0x130ad0(_0x43324c[_0x41e4('0x1a')](0x1f4,_0x51018a['message']));});});}; \ No newline at end of file +var _0x37e4=['stringify','error','code','ChatQueue,\x20%s,\x20%s','message','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','ShowChatQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x124269,_0x161b31){var _0x231ac3=function(_0x297925){while(--_0x297925){_0x124269['push'](_0x124269['shift']());}};_0x231ac3(++_0x161b31);}(_0x37e4,0x18e));var _0x437e=function(_0x377e42,_0x28fd67){_0x377e42=_0x377e42-0x0;var _0xd3df66=_0x37e4[_0x377e42];return _0xd3df66;};'use strict';var _=require(_0x437e('0x0'));var util=require(_0x437e('0x1'));var moment=require('moment');var BPromise=require(_0x437e('0x2'));var rs=require(_0x437e('0x3'));var fs=require('fs');var Redis=require(_0x437e('0x4'));var db=require(_0x437e('0x5'))['db'];var utils=require(_0x437e('0x6'));var logger=require(_0x437e('0x7'))(_0x437e('0x8'));var config=require(_0x437e('0x9'));var jayson=require(_0x437e('0xa'));var client=jayson[_0x437e('0xb')][_0x437e('0xc')]({'port':0x232a});config[_0x437e('0xd')]=_[_0x437e('0xe')](config[_0x437e('0xd')],{'host':_0x437e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x437e('0xd')]));require('./chatQueue.socket')[_0x437e('0x10')](socket);function respondWithRpcPromise(_0x43d0bb,_0x482695,_0x3a8fd7){return new BPromise(function(_0x922490,_0x3f0586){return client[_0x437e('0x11')](_0x43d0bb,_0x3a8fd7)[_0x437e('0x12')](function(_0x2f662e){logger['info']('ChatQueue,\x20%s,\x20%s',_0x482695,'request\x20sent');logger[_0x437e('0x13')](_0x437e('0x14'),_0x482695,_0x437e('0x15'),JSON[_0x437e('0x16')](_0x2f662e));if(_0x2f662e[_0x437e('0x17')]){if(_0x2f662e[_0x437e('0x17')][_0x437e('0x18')]===0x1f4){logger[_0x437e('0x17')](_0x437e('0x19'),_0x482695,_0x2f662e[_0x437e('0x17')][_0x437e('0x1a')]);return _0x3f0586(_0x2f662e[_0x437e('0x17')][_0x437e('0x1a')]);}logger['error'](_0x437e('0x19'),_0x482695,_0x2f662e[_0x437e('0x17')][_0x437e('0x1a')]);return _0x922490(_0x2f662e[_0x437e('0x17')][_0x437e('0x1a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x482695,'request\x20sent');_0x922490(_0x2f662e['result']['message']);}})['catch'](function(_0x1bad66){logger['error']('ChatQueue,\x20%s,\x20%s',_0x482695,_0x1bad66);_0x3f0586(_0x1bad66);});});}exports[_0x437e('0x1b')]=function(_0x5aaac3){var _0xdd986a=this;return new Promise(function(_0x1be43d,_0x595925){return db[_0x437e('0x1c')][_0x437e('0x1d')]({'raw':_0x5aaac3[_0x437e('0x1e')]?_0x5aaac3['options'][_0x437e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5aaac3['options']?_0x5aaac3['options'][_0x437e('0x20')]||null:null,'attributes':_0x5aaac3[_0x437e('0x1e')]?_0x5aaac3[_0x437e('0x1e')][_0x437e('0x21')]||null:null,'limit':_0x5aaac3[_0x437e('0x1e')]?_0x5aaac3['options'][_0x437e('0x22')]||null:null,'include':_0x5aaac3[_0x437e('0x1e')]?_0x5aaac3['options'][_0x437e('0x23')]?_['map'](_0x5aaac3[_0x437e('0x1e')]['include'],function(_0x354ac9){return{'model':db[_0x354ac9[_0x437e('0x24')]],'as':_0x354ac9['as'],'attributes':_0x354ac9[_0x437e('0x21')],'include':_0x354ac9['include']?_['map'](_0x354ac9[_0x437e('0x23')],function(_0x3b7baf){return{'model':db[_0x3b7baf['model']],'as':_0x3b7baf['as'],'attributes':_0x3b7baf['attributes'],'include':_0x3b7baf[_0x437e('0x23')]?_[_0x437e('0x25')](_0x3b7baf['include'],function(_0x27a269){return{'model':db[_0x27a269[_0x437e('0x24')]],'as':_0x27a269['as'],'attributes':_0x27a269[_0x437e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x437e('0x12')](function(_0x11d8f2){logger[_0x437e('0x26')](_0x437e('0x1b'),_0x5aaac3);logger[_0x437e('0x13')](_0x437e('0x1b'),_0x5aaac3,JSON[_0x437e('0x16')](_0x11d8f2));_0x1be43d(_0x11d8f2);})[_0x437e('0x27')](function(_0x397a33){logger[_0x437e('0x17')](_0x437e('0x1b'),_0x397a33['message'],_0x5aaac3);_0x595925(_0xdd986a[_0x437e('0x17')](0x1f4,_0x397a33[_0x437e('0x1a')]));});});};exports[_0x437e('0x28')]=function(_0x269a3d){var _0x13476d=this;return new Promise(function(_0x2a4602,_0x23b0d5){return db[_0x437e('0x1c')][_0x437e('0x29')]({'raw':_0x269a3d[_0x437e('0x1e')]?_0x269a3d[_0x437e('0x1e')][_0x437e('0x1f')]===undefined?!![]:![]:!![],'where':_0x269a3d[_0x437e('0x1e')]?_0x269a3d[_0x437e('0x1e')]['where']||null:null,'attributes':_0x269a3d['options']?_0x269a3d['options'][_0x437e('0x21')]||null:null,'include':_0x269a3d[_0x437e('0x1e')]?_0x269a3d[_0x437e('0x1e')][_0x437e('0x23')]?_[_0x437e('0x25')](_0x269a3d['options'][_0x437e('0x23')],function(_0x144ef8){return{'model':db[_0x144ef8['model']],'as':_0x144ef8['as'],'attributes':_0x144ef8['attributes'],'include':_0x144ef8[_0x437e('0x23')]?_['map'](_0x144ef8[_0x437e('0x23')],function(_0x361587){return{'model':db[_0x361587[_0x437e('0x24')]],'as':_0x361587['as'],'attributes':_0x361587['attributes'],'include':_0x361587[_0x437e('0x23')]?_[_0x437e('0x25')](_0x361587[_0x437e('0x23')],function(_0x5acbaf){return{'model':db[_0x5acbaf[_0x437e('0x24')]],'as':_0x5acbaf['as'],'attributes':_0x5acbaf[_0x437e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x437e('0x12')](function(_0x333c6c){logger['info'](_0x437e('0x28'),_0x269a3d);logger[_0x437e('0x13')](_0x437e('0x28'),_0x269a3d,JSON[_0x437e('0x16')](_0x333c6c));_0x2a4602(_0x333c6c);})[_0x437e('0x27')](function(_0x429591){logger['error'](_0x437e('0x28'),_0x429591['message'],_0x269a3d);_0x23b0d5(_0x13476d[_0x437e('0x17')](0x1f4,_0x429591[_0x437e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 37b4e5b..4234fe2 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 _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x148f22,_0x5a5572){var _0x50ccfa=function(_0x22492f){while(--_0x22492f){_0x148f22['push'](_0x148f22['shift']());}};_0x50ccfa(++_0x5a5572);}(_0x0faf,0x132));var _0xf0fa=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x0faf[_0x4aa838];return _0x3abff0;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file +var _0x70e0=['chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x31498f,_0x392094){var _0x3204f2=function(_0x463af7){while(--_0x463af7){_0x31498f['push'](_0x31498f['shift']());}};_0x3204f2(++_0x392094);}(_0x70e0,0x17b));var _0x070e=function(_0x5af40a,_0x445a80){_0x5af40a=_0x5af40a-0x0;var _0x1410ce=_0x70e0[_0x5af40a];return _0x1410ce;};'use strict';var ChatQueueEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatQueueEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatQueueEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a3934b5..1872022 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x206d66,_0x4c48e0){var _0x5c63db=function(_0x22fd00){while(--_0x22fd00){_0x206d66['push'](_0x206d66['shift']());}};_0x5c63db(++_0x4c48e0);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x28af4f,_0x3e56f8){var _0x5517bf=function(_0x1571f6){while(--_0x1571f6){_0x28af4f['push'](_0x28af4f['shift']());}};_0x5517bf(++_0x3e56f8);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c439711..08bc885 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 _0xd619=['exports','STRING','DATE','moment','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd619,0x18e));var _0x9d61=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xd619[_0x2f45ea];return _0x485a84;};'use strict';var moment=require(_0x9d61('0x0'));var Sequelize=require(_0x9d61('0x1'));module[_0x9d61('0x2')]={'uniqueid':{'type':Sequelize[_0x9d61('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9d61('0x3')]},'joinAt':{'type':Sequelize[_0x9d61('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9d61('0x4')]},'exitAt':{'type':Sequelize[_0x9d61('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x039b=['sequelize','exports','STRING','DATE','moment'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x039b,0x15d));var _0xb039=function(_0x59ed18,_0x2c3d81){_0x59ed18=_0x59ed18-0x0;var _0x182155=_0x039b[_0x59ed18];return _0x182155;};'use strict';var moment=require(_0xb039('0x0'));var Sequelize=require(_0xb039('0x1'));module[_0xb039('0x2')]={'uniqueid':{'type':Sequelize[_0xb039('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb039('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb039('0x4')]},'acceptAt':{'type':Sequelize[_0xb039('0x4')]},'exitAt':{'type':Sequelize[_0xb039('0x4')]},'reason':{'type':Sequelize[_0xb039('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 96b5704..fa0b931 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 _0x41ec=['merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','ChatQueueReport','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x1096ec,_0x614d45){var _0x7c6ba4=function(_0x4a2844){while(--_0x4a2844){_0x1096ec['push'](_0x1096ec['shift']());}};_0x7c6ba4(++_0x614d45);}(_0x41ec,0x143));var _0xc41e=function(_0x440197,_0x5282b9){_0x440197=_0x440197-0x0;var _0x4f70b2=_0x41ec[_0x440197];return _0x4f70b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc41e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x1'));var rp=require(_0xc41e('0x2'));var moment=require('moment');var BPromise=require(_0xc41e('0x3'));var Mustache=require(_0xc41e('0x4'));var util=require(_0xc41e('0x5'));var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require(_0xc41e('0xb'));var squel=require(_0xc41e('0xc'));var crypto=require(_0xc41e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc41e('0xe'));var toCsv=require(_0xc41e('0x8'));var querystring=require(_0xc41e('0xf'));var Papa=require(_0xc41e('0x10'));var Redis=require(_0xc41e('0x11'));var authService=require(_0xc41e('0x12'));var qs=require(_0xc41e('0x13'));var as=require(_0xc41e('0x14'));var hardwareService=require(_0xc41e('0x15'));var logger=require(_0xc41e('0x16'))(_0xc41e('0x17'));var utils=require('../../config/utils');var config=require(_0xc41e('0x18'));var licenseUtil=require(_0xc41e('0x19'));var db=require(_0xc41e('0x1a'))['db'];function respondWithStatusCode(_0x3d7280,_0x11a117){_0x11a117=_0x11a117||0xcc;return function(_0x433ca9){if(_0x433ca9){return _0x3d7280[_0xc41e('0x1b')](_0x11a117);}return _0x3d7280[_0xc41e('0x1c')](_0x11a117)['end']();};}function respondWithResult(_0x3b3900,_0x6b614a){_0x6b614a=_0x6b614a||0xc8;return function(_0xcd58a0){if(_0xcd58a0){return _0x3b3900[_0xc41e('0x1c')](_0x6b614a)['json'](_0xcd58a0);}};}function respondWithFilteredResult(_0x5c705e,_0x4f960d){return function(_0x28eb53){if(_0x28eb53){var _0x4293a5=typeof _0x4f960d['offset']===_0xc41e('0x1d')&&typeof _0x4f960d[_0xc41e('0x1e')]==='undefined';var _0x4e7aa3=_0x28eb53[_0xc41e('0x1f')];var _0x5c0517=_0x4293a5?0x0:_0x4f960d[_0xc41e('0x20')];var _0x23c9b6=_0x4293a5?_0x28eb53['count']:_0x4f960d[_0xc41e('0x20')]+_0x4f960d[_0xc41e('0x1e')];var _0xee0f01;if(_0x23c9b6>=_0x4e7aa3){_0x23c9b6=_0x4e7aa3;_0xee0f01=0xc8;}else{_0xee0f01=0xce;}_0x5c705e[_0xc41e('0x1c')](_0xee0f01);return _0x5c705e[_0xc41e('0x21')](_0xc41e('0x22'),_0x5c0517+'-'+_0x23c9b6+'/'+_0x4e7aa3)[_0xc41e('0x23')](_0x28eb53);}return null;};}function patchUpdates(_0x57e0c4){return function(_0x239c25){try{jsonpatch[_0xc41e('0x24')](_0x239c25,_0x57e0c4,!![]);}catch(_0x3f26d5){return BPromise['reject'](_0x3f26d5);}return _0x239c25[_0xc41e('0x25')]();};}function saveUpdates(_0x408d27,_0x814a72){return function(_0x490cc3){if(_0x490cc3){return _0x490cc3[_0xc41e('0x26')](_0x408d27)[_0xc41e('0x27')](function(_0x602bd7){return _0x602bd7;});}return null;};}function removeEntity(_0x4adaad,_0x5a06dd){return function(_0x4c20b1){if(_0x4c20b1){return _0x4c20b1[_0xc41e('0x28')]()[_0xc41e('0x27')](function(){_0x4adaad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3e0d,_0x1c33a6){return function(_0x1ad4c7){if(!_0x1ad4c7){_0x5a3e0d[_0xc41e('0x1b')](0x194);}return _0x1ad4c7;};}function handleError(_0x467672,_0x1c6a2a){_0x1c6a2a=_0x1c6a2a||0x1f4;return function(_0x580b9e){logger[_0xc41e('0x29')](_0x580b9e[_0xc41e('0x2a')]);if(_0x580b9e[_0xc41e('0x2b')]){delete _0x580b9e['name'];}_0x467672[_0xc41e('0x1c')](_0x1c6a2a)[_0xc41e('0x2c')](_0x580b9e);};}exports['index']=function(_0x25b319,_0x12536e){var _0x5c2c62={},_0xcb3a15={},_0x2fa98a={'count':0x0,'rows':[]};var _0x17246e=_[_0xc41e('0x2d')](db['ChatQueueReport']['rawAttributes'],function(_0x541ac4){return{'name':_0x541ac4[_0xc41e('0x2e')],'type':_0x541ac4[_0xc41e('0x2f')][_0xc41e('0x30')]};});_0xcb3a15[_0xc41e('0x31')]=_[_0xc41e('0x2d')](_0x17246e,_0xc41e('0x2b'));_0xcb3a15[_0xc41e('0x32')]=_['keys'](_0x25b319[_0xc41e('0x32')]);_0xcb3a15[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0xcb3a15['model'],_0xcb3a15[_0xc41e('0x32')]);_0x5c2c62['attributes']=_[_0xc41e('0x34')](_0xcb3a15[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x25b319[_0xc41e('0x32')]['fields']));_0x5c2c62['attributes']=_0x5c2c62[_0xc41e('0x36')][_0xc41e('0x37')]?_0x5c2c62[_0xc41e('0x36')]:_0xcb3a15[_0xc41e('0x31')];if(!_0x25b319[_0xc41e('0x32')][_0xc41e('0x38')]('nolimit')){_0x5c2c62[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0x25b319[_0xc41e('0x32')]['limit']);_0x5c2c62[_0xc41e('0x20')]=qs[_0xc41e('0x20')](_0x25b319['query'][_0xc41e('0x20')]);}_0x5c2c62[_0xc41e('0x39')]=qs[_0xc41e('0x3a')](_0x25b319[_0xc41e('0x32')][_0xc41e('0x3a')]);_0x5c2c62['where']=qs['filters'](_[_0xc41e('0x3b')](_0x25b319[_0xc41e('0x32')],_0xcb3a15[_0xc41e('0x33')]),_0x17246e);if(_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]){_0x5c2c62[_0xc41e('0x3d')]=_[_0xc41e('0x3e')](_0x5c2c62[_0xc41e('0x3d')],{'$or':_[_0xc41e('0x2d')](_0x17246e,function(_0x4de59a){if(_0x4de59a['type']!==_0xc41e('0x3f')){var _0xfd6ff6={};_0xfd6ff6[_0x4de59a[_0xc41e('0x2b')]]={'$like':'%'+_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]+'%'};return _0xfd6ff6;}})});}_0x5c2c62=_[_0xc41e('0x3e')]({},_0x5c2c62,_0x25b319[_0xc41e('0x40')]);var _0x150f30={'where':_0x5c2c62['where']};return db['ChatQueueReport'][_0xc41e('0x1f')](_0x150f30)[_0xc41e('0x27')](function(_0x10cfed){_0x2fa98a['count']=_0x10cfed;if(_0x25b319['query'][_0xc41e('0x41')]){_0x5c2c62['include']=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x5c2c62);})['then'](function(_0x3c30e2){_0x2fa98a[_0xc41e('0x42')]=_0x3c30e2;return _0x2fa98a;})[_0xc41e('0x27')](respondWithFilteredResult(_0x12536e,_0x5c2c62))[_0xc41e('0x43')](handleError(_0x12536e,null));};exports[_0xc41e('0x44')]=function(_0x206aa1,_0x4bb1f6){var _0x28d15d={'raw':!![],'where':{'id':_0x206aa1[_0xc41e('0x45')]['id']}},_0x1a3e67={};_0x1a3e67[_0xc41e('0x31')]=_[_0xc41e('0x46')](db[_0xc41e('0x47')]['rawAttributes']);_0x1a3e67[_0xc41e('0x32')]=_[_0xc41e('0x46')](_0x206aa1['query']);_0x1a3e67[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0x1a3e67['model'],_0x1a3e67[_0xc41e('0x32')]);_0x28d15d['attributes']=_[_0xc41e('0x34')](_0x1a3e67[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x206aa1['query'][_0xc41e('0x35')]));_0x28d15d[_0xc41e('0x36')]=_0x28d15d['attributes']['length']?_0x28d15d['attributes']:_0x1a3e67['model'];if(_0x206aa1[_0xc41e('0x32')]['includeAll']){_0x28d15d[_0xc41e('0x48')]=[{'all':!![]}];}_0x28d15d=_['merge']({},_0x28d15d,_0x206aa1['options']);return db[_0xc41e('0x47')]['find'](_0x28d15d)[_0xc41e('0x27')](handleEntityNotFound(_0x4bb1f6,null))[_0xc41e('0x27')](respondWithResult(_0x4bb1f6,null))[_0xc41e('0x43')](handleError(_0x4bb1f6,null));};exports[_0xc41e('0x49')]=function(_0x46aef6,_0x31b393){return db[_0xc41e('0x47')][_0xc41e('0x49')](_0x46aef6[_0xc41e('0x4a')],{})[_0xc41e('0x27')](respondWithResult(_0x31b393,0xc9))[_0xc41e('0x43')](handleError(_0x31b393,null));};exports['update']=function(_0x4b67d4,_0x1cdf49){if(_0x4b67d4[_0xc41e('0x4a')]['id']){delete _0x4b67d4[_0xc41e('0x4a')]['id'];}return db['ChatQueueReport'][_0xc41e('0x4b')]({'where':{'id':_0x4b67d4[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x1cdf49,null))[_0xc41e('0x27')](saveUpdates(_0x4b67d4[_0xc41e('0x4a')],null))[_0xc41e('0x27')](respondWithResult(_0x1cdf49,null))[_0xc41e('0x43')](handleError(_0x1cdf49,null));};exports['destroy']=function(_0x3c867a,_0x317eba){return db['ChatQueueReport']['find']({'where':{'id':_0x3c867a[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x317eba,null))[_0xc41e('0x27')](removeEntity(_0x317eba,null))[_0xc41e('0x43')](handleError(_0x317eba,null));};exports[_0xc41e('0x4c')]=function(_0x53a799,_0x576831){return db[_0xc41e('0x47')]['describe']()[_0xc41e('0x27')](respondWithResult(_0x576831,null))['catch'](handleError(_0x576831,null));}; \ No newline at end of file +var _0xb7f0=['fields','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','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','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x18d36f,_0x31b65f){var _0x10034d=function(_0x38bb30){while(--_0x38bb30){_0x18d36f['push'](_0x18d36f['shift']());}};_0x10034d(++_0x31b65f);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x2c9ea3,_0x515521){_0x2c9ea3=_0x2c9ea3-0x0;var _0x5c5c65=_0xb7f0[_0x2c9ea3];return _0x5c5c65;};'use strict';var emlformat=require(_0x0b7f('0x0'));var rimraf=require(_0x0b7f('0x1'));var zipdir=require(_0x0b7f('0x2'));var jsonpatch=require(_0x0b7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b7f('0x4'));var Mustache=require(_0x0b7f('0x5'));var util=require(_0x0b7f('0x6'));var path=require(_0x0b7f('0x7'));var sox=require(_0x0b7f('0x8'));var csv=require(_0x0b7f('0x9'));var ejs=require(_0x0b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x0b7f('0xb'));var _=require(_0x0b7f('0xc'));var squel=require(_0x0b7f('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b7f('0xe'));var deskjs=require(_0x0b7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b7f('0x10'));var Papa=require(_0x0b7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b7f('0x12'));var hardwareService=require(_0x0b7f('0x13'));var logger=require(_0x0b7f('0x14'))(_0x0b7f('0x15'));var utils=require(_0x0b7f('0x16'));var config=require(_0x0b7f('0x17'));var licenseUtil=require(_0x0b7f('0x18'));var db=require(_0x0b7f('0x19'))['db'];function respondWithStatusCode(_0x1af907,_0x34121a){_0x34121a=_0x34121a||0xcc;return function(_0x930432){if(_0x930432){return _0x1af907['sendStatus'](_0x34121a);}return _0x1af907[_0x0b7f('0x1a')](_0x34121a)[_0x0b7f('0x1b')]();};}function respondWithResult(_0x1e3f86,_0x19ddf2){_0x19ddf2=_0x19ddf2||0xc8;return function(_0x294db5){if(_0x294db5){return _0x1e3f86[_0x0b7f('0x1a')](_0x19ddf2)[_0x0b7f('0x1c')](_0x294db5);}};}function respondWithFilteredResult(_0x18069a,_0x5a2b0b){return function(_0x20e15d){if(_0x20e15d){var _0x1d223f=typeof _0x5a2b0b[_0x0b7f('0x1d')]===_0x0b7f('0x1e')&&typeof _0x5a2b0b['limit']===_0x0b7f('0x1e');var _0x3f6463=_0x20e15d[_0x0b7f('0x1f')];var _0x168e7e=_0x1d223f?0x0:_0x5a2b0b[_0x0b7f('0x1d')];var _0x50cee2=_0x1d223f?_0x20e15d[_0x0b7f('0x1f')]:_0x5a2b0b['offset']+_0x5a2b0b['limit'];var _0x36a619;if(_0x50cee2>=_0x3f6463){_0x50cee2=_0x3f6463;_0x36a619=0xc8;}else{_0x36a619=0xce;}_0x18069a[_0x0b7f('0x1a')](_0x36a619);return _0x18069a[_0x0b7f('0x20')](_0x0b7f('0x21'),_0x168e7e+'-'+_0x50cee2+'/'+_0x3f6463)[_0x0b7f('0x1c')](_0x20e15d);}return null;};}function patchUpdates(_0x52abc6){return function(_0x55362c){try{jsonpatch[_0x0b7f('0x22')](_0x55362c,_0x52abc6,!![]);}catch(_0x3ca024){return BPromise[_0x0b7f('0x23')](_0x3ca024);}return _0x55362c['save']();};}function saveUpdates(_0xb130f0,_0x1ec1d3){return function(_0x26f974){if(_0x26f974){return _0x26f974[_0x0b7f('0x24')](_0xb130f0)[_0x0b7f('0x25')](function(_0x44a0ae){return _0x44a0ae;});}return null;};}function removeEntity(_0x459389,_0x45ab0e){return function(_0xc74a5d){if(_0xc74a5d){return _0xc74a5d['destroy']()[_0x0b7f('0x25')](function(){_0x459389[_0x0b7f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50776a,_0x4a2841){return function(_0x37a5e5){if(!_0x37a5e5){_0x50776a[_0x0b7f('0x26')](0x194);}return _0x37a5e5;};}function handleError(_0x4e61be,_0xd3cb99){_0xd3cb99=_0xd3cb99||0x1f4;return function(_0x3cda59){logger[_0x0b7f('0x27')](_0x3cda59[_0x0b7f('0x28')]);if(_0x3cda59[_0x0b7f('0x29')]){delete _0x3cda59[_0x0b7f('0x29')];}_0x4e61be[_0x0b7f('0x1a')](_0xd3cb99)[_0x0b7f('0x2a')](_0x3cda59);};}exports[_0x0b7f('0x2b')]=function(_0x4ae467,_0x599bae){var _0x4ada58={},_0x3ea675={},_0x4f7e74={'count':0x0,'rows':[]};var _0x34b54c=_[_0x0b7f('0x2c')](db[_0x0b7f('0x2d')][_0x0b7f('0x2e')],function(_0x2d4727){return{'name':_0x2d4727[_0x0b7f('0x2f')],'type':_0x2d4727[_0x0b7f('0x30')]['key']};});_0x3ea675['model']=_[_0x0b7f('0x2c')](_0x34b54c,'name');_0x3ea675[_0x0b7f('0x31')]=_[_0x0b7f('0x32')](_0x4ae467[_0x0b7f('0x31')]);_0x3ea675[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x3ea675[_0x0b7f('0x35')],_0x3ea675[_0x0b7f('0x31')]);_0x4ada58[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x3ea675['model'],qs['fields'](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x4ada58[_0x0b7f('0x36')]=_0x4ada58[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x4ada58[_0x0b7f('0x36')]:_0x3ea675[_0x0b7f('0x35')];if(!_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x39')]('nolimit')){_0x4ada58['limit']=qs[_0x0b7f('0x3a')](_0x4ae467['query'][_0x0b7f('0x3a')]);_0x4ada58['offset']=qs[_0x0b7f('0x1d')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x1d')]);}_0x4ada58[_0x0b7f('0x3b')]=qs[_0x0b7f('0x3c')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x3c')]);_0x4ada58[_0x0b7f('0x3d')]=qs[_0x0b7f('0x33')](_['pick'](_0x4ae467['query'],_0x3ea675['filters']),_0x34b54c);if(_0x4ae467[_0x0b7f('0x31')]['filter']){_0x4ada58[_0x0b7f('0x3d')]=_[_0x0b7f('0x3e')](_0x4ada58[_0x0b7f('0x3d')],{'$or':_[_0x0b7f('0x2c')](_0x34b54c,function(_0x1e2f6c){if(_0x1e2f6c['type']!==_0x0b7f('0x3f')){var _0x2eafb6={};_0x2eafb6[_0x1e2f6c[_0x0b7f('0x29')]]={'$like':'%'+_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x40')]+'%'};return _0x2eafb6;}})});}_0x4ada58=_['merge']({},_0x4ada58,_0x4ae467[_0x0b7f('0x41')]);var _0x2f5351={'where':_0x4ada58[_0x0b7f('0x3d')]};return db[_0x0b7f('0x2d')][_0x0b7f('0x1f')](_0x2f5351)[_0x0b7f('0x25')](function(_0x40b1c5){_0x4f7e74[_0x0b7f('0x1f')]=_0x40b1c5;if(_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x4ada58[_0x0b7f('0x43')]=[{'all':!![]}];}return db[_0x0b7f('0x2d')][_0x0b7f('0x44')](_0x4ada58);})['then'](function(_0x4aaf15){_0x4f7e74[_0x0b7f('0x45')]=_0x4aaf15;return _0x4f7e74;})[_0x0b7f('0x25')](respondWithFilteredResult(_0x599bae,_0x4ada58))[_0x0b7f('0x46')](handleError(_0x599bae,null));};exports[_0x0b7f('0x47')]=function(_0x2c25fc,_0x230c6b){var _0x57c147={'raw':!![],'where':{'id':_0x2c25fc[_0x0b7f('0x48')]['id']}},_0x2176c6={};_0x2176c6[_0x0b7f('0x35')]=_[_0x0b7f('0x32')](db['ChatQueueReport'][_0x0b7f('0x2e')]);_0x2176c6['query']=_[_0x0b7f('0x32')](_0x2c25fc[_0x0b7f('0x31')]);_0x2176c6[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],_0x2176c6['query']);_0x57c147[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],qs[_0x0b7f('0x37')](_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x57c147[_0x0b7f('0x36')]=_0x57c147[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x57c147[_0x0b7f('0x36')]:_0x2176c6[_0x0b7f('0x35')];if(_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x57c147['include']=[{'all':!![]}];}_0x57c147=_[_0x0b7f('0x3e')]({},_0x57c147,_0x2c25fc[_0x0b7f('0x41')]);return db[_0x0b7f('0x2d')][_0x0b7f('0x49')](_0x57c147)[_0x0b7f('0x25')](handleEntityNotFound(_0x230c6b,null))[_0x0b7f('0x25')](respondWithResult(_0x230c6b,null))[_0x0b7f('0x46')](handleError(_0x230c6b,null));};exports['create']=function(_0x4d432b,_0x562843){return db[_0x0b7f('0x2d')][_0x0b7f('0x4a')](_0x4d432b['body'],{})[_0x0b7f('0x25')](respondWithResult(_0x562843,0xc9))[_0x0b7f('0x46')](handleError(_0x562843,null));};exports['update']=function(_0x2469e2,_0x4a825c){if(_0x2469e2[_0x0b7f('0x4b')]['id']){delete _0x2469e2['body']['id'];}return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x2469e2[_0x0b7f('0x48')]['id']}})[_0x0b7f('0x25')](handleEntityNotFound(_0x4a825c,null))[_0x0b7f('0x25')](saveUpdates(_0x2469e2[_0x0b7f('0x4b')],null))[_0x0b7f('0x25')](respondWithResult(_0x4a825c,null))[_0x0b7f('0x46')](handleError(_0x4a825c,null));};exports[_0x0b7f('0x4c')]=function(_0x3cfa81,_0x23e3ef){return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x3cfa81[_0x0b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e3ef,null))[_0x0b7f('0x25')](removeEntity(_0x23e3ef,null))[_0x0b7f('0x46')](handleError(_0x23e3ef,null));};exports[_0x0b7f('0x4d')]=function(_0xe820e0,_0xbad1cd){return db[_0x0b7f('0x2d')]['describe']()[_0x0b7f('0x25')](respondWithResult(_0xbad1cd,null))['catch'](handleError(_0xbad1cd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2559ca4..417a103 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5098bc,_0x766238){var _0x1aa55b=function(_0x1f442d){while(--_0x1f442d){_0x5098bc['push'](_0x5098bc['shift']());}};_0x1aa55b(++_0x766238);}(_0x757a,0xde));var _0xa757=function(_0x327b61,_0x2994a6){_0x327b61=_0x327b61-0x0;var _0x182ca2=_0x757a[_0x327b61];return _0x182ca2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x6fe016,_0x1e61c3){var _0x30499a=function(_0x593dfd){while(--_0x593dfd){_0x6fe016['push'](_0x6fe016['shift']());}};_0x30499a(++_0x1e61c3);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 31f7a5c..13b952f 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 _0x34ea=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','stringify','update','where','attributes','limit','UpdateChatQueueReport','util','bluebird'];(function(_0x10fb54,_0xdfc476){var _0x546821=function(_0x5a9d2d){while(--_0x5a9d2d){_0x10fb54['push'](_0x10fb54['shift']());}};_0x546821(++_0xdfc476);}(_0x34ea,0x148));var _0xa34e=function(_0x4acac7,_0x4ff81c){_0x4acac7=_0x4acac7-0x0;var _0x363d42=_0x34ea[_0x4acac7];return _0x363d42;};'use strict';var _=require('lodash');var util=require(_0xa34e('0x0'));var moment=require('moment');var BPromise=require(_0xa34e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa34e('0x2'));var logger=require(_0xa34e('0x3'))('rpc');var config=require(_0xa34e('0x4'));var jayson=require(_0xa34e('0x5'));var client=jayson['client'][_0xa34e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3e8ba7,_0x5819dd,_0x397e6e){return new BPromise(function(_0x56ca72,_0x421a76){return client[_0xa34e('0x7')](_0x3e8ba7,_0x397e6e)[_0xa34e('0x8')](function(_0x88cc8f){logger[_0xa34e('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x5819dd,_0xa34e('0xa'));logger['debug'](_0xa34e('0xb'),_0x5819dd,_0xa34e('0xa'),JSON['stringify'](_0x88cc8f));if(_0x88cc8f[_0xa34e('0xc')]){if(_0x88cc8f[_0xa34e('0xc')]['code']===0x1f4){logger[_0xa34e('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5819dd,_0x88cc8f['error'][_0xa34e('0xd')]);return _0x421a76(_0x88cc8f[_0xa34e('0xc')]['message']);}logger[_0xa34e('0xc')](_0xa34e('0xe'),_0x5819dd,_0x88cc8f[_0xa34e('0xc')][_0xa34e('0xd')]);return _0x56ca72(_0x88cc8f[_0xa34e('0xc')][_0xa34e('0xd')]);}else{logger[_0xa34e('0x9')](_0xa34e('0xe'),_0x5819dd,_0xa34e('0xa'));_0x56ca72(_0x88cc8f[_0xa34e('0xf')][_0xa34e('0xd')]);}})[_0xa34e('0x10')](function(_0x4dd34c){logger[_0xa34e('0xc')](_0xa34e('0xe'),_0x5819dd,_0x4dd34c);_0x421a76(_0x4dd34c);});});}exports[_0xa34e('0x11')]=function(_0xd97dff){var _0x90b8b6=this;return new Promise(function(_0x599a66,_0x789def){return db[_0xa34e('0x12')][_0xa34e('0x13')](_0xd97dff[_0xa34e('0x14')],{'raw':_0xd97dff[_0xa34e('0x15')]?_0xd97dff[_0xa34e('0x15')][_0xa34e('0x16')]===undefined?!![]:![]:!![]})[_0xa34e('0x8')](function(_0x200c9a){logger[_0xa34e('0x9')](_0xa34e('0x11'),_0xd97dff);logger[_0xa34e('0x17')]('CreateChatQueueReport',_0xd97dff,JSON[_0xa34e('0x18')](_0x200c9a));_0x599a66(_0x200c9a);})[_0xa34e('0x10')](function(_0x30662d){logger[_0xa34e('0xc')](_0xa34e('0x11'),_0x30662d[_0xa34e('0xd')],_0xd97dff);_0x789def(_0x90b8b6['error'](0x1f4,_0x30662d[_0xa34e('0xd')]));});});};exports['UpdateChatQueueReport']=function(_0x1b471b){var _0xb1d50=this;return new Promise(function(_0xa3b5cc,_0x228b98){return db[_0xa34e('0x12')][_0xa34e('0x19')](_0x1b471b['body'],{'raw':_0x1b471b[_0xa34e('0x15')]?_0x1b471b[_0xa34e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b471b['options']?_0x1b471b[_0xa34e('0x15')][_0xa34e('0x1a')]||null:null,'attributes':_0x1b471b['options']?_0x1b471b[_0xa34e('0x15')][_0xa34e('0x1b')]||null:null,'limit':_0x1b471b[_0xa34e('0x15')]?_0x1b471b[_0xa34e('0x15')][_0xa34e('0x1c')]||null:null})[_0xa34e('0x8')](function(_0x32da26){logger[_0xa34e('0x9')](_0xa34e('0x1d'),_0x1b471b);logger[_0xa34e('0x17')](_0xa34e('0x1d'),_0x1b471b,JSON[_0xa34e('0x18')](_0x32da26));_0xa3b5cc(_0x32da26);})[_0xa34e('0x10')](function(_0x35dc63){logger[_0xa34e('0xc')](_0xa34e('0x1d'),_0x35dc63[_0xa34e('0xd')],_0x1b471b);_0x228b98(_0xb1d50[_0xa34e('0xc')](0x1f4,_0x35dc63[_0xa34e('0xd')]));});});}; \ No newline at end of file +var _0xb989=['raw','then','debug','where','attributes','limit','UpdateChatQueueReport','util','bluebird','randomstring','../../config/utils','rpc','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options'];(function(_0x279040,_0x119e4d){var _0x539631=function(_0x584a19){while(--_0x584a19){_0x279040['push'](_0x279040['shift']());}};_0x539631(++_0x119e4d);}(_0xb989,0x180));var _0x9b98=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0xb989[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require('lodash');var util=require(_0x9b98('0x0'));var moment=require('moment');var BPromise=require(_0x9b98('0x1'));var rs=require(_0x9b98('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b98('0x3'));var logger=require('../../config/logger')(_0x9b98('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9b98('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b1c52,_0x5dc4de,_0x5a6bfc){return new BPromise(function(_0x55f35e,_0x42ab42){return client[_0x9b98('0x6')](_0x2b1c52,_0x5a6bfc)['then'](function(_0x5c7c0c){logger[_0x9b98('0x7')](_0x9b98('0x8'),_0x5dc4de,_0x9b98('0x9'));logger['debug'](_0x9b98('0xa'),_0x5dc4de,_0x9b98('0x9'),JSON[_0x9b98('0xb')](_0x5c7c0c));if(_0x5c7c0c[_0x9b98('0xc')]){if(_0x5c7c0c[_0x9b98('0xc')][_0x9b98('0xd')]===0x1f4){logger['error'](_0x9b98('0x8'),_0x5dc4de,_0x5c7c0c[_0x9b98('0xc')]['message']);return _0x42ab42(_0x5c7c0c[_0x9b98('0xc')]['message']);}logger[_0x9b98('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x5dc4de,_0x5c7c0c[_0x9b98('0xc')][_0x9b98('0xe')]);return _0x55f35e(_0x5c7c0c[_0x9b98('0xc')][_0x9b98('0xe')]);}else{logger[_0x9b98('0x7')](_0x9b98('0x8'),_0x5dc4de,'request\x20sent');_0x55f35e(_0x5c7c0c[_0x9b98('0xf')][_0x9b98('0xe')]);}})[_0x9b98('0x10')](function(_0x1974c5){logger[_0x9b98('0xc')](_0x9b98('0x8'),_0x5dc4de,_0x1974c5);_0x42ab42(_0x1974c5);});});}exports[_0x9b98('0x11')]=function(_0x54a167){var _0x4d3014=this;return new Promise(function(_0x296c94,_0x124d60){return db[_0x9b98('0x12')][_0x9b98('0x13')](_0x54a167[_0x9b98('0x14')],{'raw':_0x54a167[_0x9b98('0x15')]?_0x54a167[_0x9b98('0x15')][_0x9b98('0x16')]===undefined?!![]:![]:!![]})[_0x9b98('0x17')](function(_0x8b5562){logger[_0x9b98('0x7')](_0x9b98('0x11'),_0x54a167);logger[_0x9b98('0x18')]('CreateChatQueueReport',_0x54a167,JSON[_0x9b98('0xb')](_0x8b5562));_0x296c94(_0x8b5562);})['catch'](function(_0x191eaf){logger['error'](_0x9b98('0x11'),_0x191eaf[_0x9b98('0xe')],_0x54a167);_0x124d60(_0x4d3014[_0x9b98('0xc')](0x1f4,_0x191eaf['message']));});});};exports['UpdateChatQueueReport']=function(_0x1fe06a){var _0x31c27e=this;return new Promise(function(_0x435e39,_0x3a99ba){return db[_0x9b98('0x12')]['update'](_0x1fe06a[_0x9b98('0x14')],{'raw':_0x1fe06a['options']?_0x1fe06a[_0x9b98('0x15')][_0x9b98('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe06a[_0x9b98('0x15')]?_0x1fe06a['options'][_0x9b98('0x19')]||null:null,'attributes':_0x1fe06a[_0x9b98('0x15')]?_0x1fe06a[_0x9b98('0x15')][_0x9b98('0x1a')]||null:null,'limit':_0x1fe06a['options']?_0x1fe06a[_0x9b98('0x15')][_0x9b98('0x1b')]||null:null})[_0x9b98('0x17')](function(_0x268d06){logger[_0x9b98('0x7')]('UpdateChatQueueReport',_0x1fe06a);logger['debug'](_0x9b98('0x1c'),_0x1fe06a,JSON[_0x9b98('0xb')](_0x268d06));_0x435e39(_0x268d06);})[_0x9b98('0x10')](function(_0x47f234){logger[_0x9b98('0xc')](_0x9b98('0x1c'),_0x47f234['message'],_0x1fe06a);_0x3a99ba(_0x31c27e['error'](0x1f4,_0x47f234[_0x9b98('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 20e4592..21b5171 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 _0xc216=['fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','util','path','connect-timeout','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc216,0xec));var _0x6c21=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xc216[_0x24237f];return _0x48298e;};'use strict';var multer=require('multer');var util=require(_0x6c21('0x0'));var path=require(_0x6c21('0x1'));var timeout=require(_0x6c21('0x2'));var express=require(_0x6c21('0x3'));var router=express['Router']();var fs_extra=require(_0x6c21('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c21('0x5'));var controller=require('./chatQueueReport.controller');router[_0x6c21('0x6')]('/',auth[_0x6c21('0x7')](),controller['index']);router[_0x6c21('0x6')](_0x6c21('0x8'),auth['isAuthenticated'](),controller[_0x6c21('0x9')]);router[_0x6c21('0x6')](_0x6c21('0xa'),auth[_0x6c21('0x7')](),controller[_0x6c21('0xb')]);router[_0x6c21('0xc')]('/',auth['isAuthenticated'](),controller[_0x6c21('0xd')]);router[_0x6c21('0xe')](_0x6c21('0xa'),auth[_0x6c21('0x7')](),controller['update']);router[_0x6c21('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bc6=['/:id','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x6c93f,_0x1c4207){var _0x523799=function(_0x4380c1){while(--_0x4380c1){_0x6c93f['push'](_0x6c93f['shift']());}};_0x523799(++_0x1c4207);}(_0x6bc6,0xdd));var _0x66bc=function(_0x28836b,_0x389433){_0x28836b=_0x28836b-0x0;var _0x51f3f8=_0x6bc6[_0x28836b];return _0x51f3f8;};'use strict';var multer=require(_0x66bc('0x0'));var util=require(_0x66bc('0x1'));var path=require(_0x66bc('0x2'));var timeout=require(_0x66bc('0x3'));var express=require('express');var router=express[_0x66bc('0x4')]();var fs_extra=require(_0x66bc('0x5'));var auth=require(_0x66bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x66bc('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x66bc('0x8')](),controller[_0x66bc('0x9')]);router[_0x66bc('0xa')](_0x66bc('0xb'),auth[_0x66bc('0x8')](),controller[_0x66bc('0xc')]);router[_0x66bc('0xa')](_0x66bc('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x66bc('0xe')]);router[_0x66bc('0xf')](_0x66bc('0xd'),auth[_0x66bc('0x8')](),controller[_0x66bc('0x10')]);router[_0x66bc('0x11')](_0x66bc('0xd'),auth[_0x66bc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f89368b..c6f6ffe 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x342516,_0x390501){var _0x2d7865=function(_0x123f20){while(--_0x123f20){_0x342516['push'](_0x342516['shift']());}};_0x2d7865(++_0x390501);}(_0xaa88,0x137));var _0x8aa8=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xaa88[_0x234ae1];return _0x227ba0;};'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 +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3dd59c,_0x520251){var _0x433a99=function(_0x191e3b){while(--_0x191e3b){_0x3dd59c['push'](_0x3dd59c['shift']());}};_0x433a99(++_0x520251);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'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 6209275..af60745 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 _0x689f=['set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','map','VIRTUAL','filter','ChatTransferReport','includeAll','include','rows','catch','show','params','merge','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x689f,0x150));var _0xf689=function(_0x657a54,_0x42c3ec){_0x657a54=_0x657a54-0x0;var _0x4b15bb=_0x689f[_0x657a54];return _0x4b15bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf689('0x0'));var jsonpatch=require(_0xf689('0x1'));var rp=require(_0xf689('0x2'));var moment=require(_0xf689('0x3'));var BPromise=require(_0xf689('0x4'));var Mustache=require('mustache');var util=require(_0xf689('0x5'));var path=require(_0xf689('0x6'));var sox=require('sox');var csv=require(_0xf689('0x7'));var ejs=require(_0xf689('0x8'));var fs=require('fs');var fs_extra=require(_0xf689('0x9'));var _=require(_0xf689('0xa'));var squel=require('squel');var crypto=require(_0xf689('0xb'));var jsforce=require(_0xf689('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf689('0x7'));var querystring=require('querystring');var Papa=require(_0xf689('0xd'));var Redis=require(_0xf689('0xe'));var authService=require(_0xf689('0xf'));var qs=require(_0xf689('0x10'));var as=require(_0xf689('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf689('0x12'));var utils=require(_0xf689('0x13'));var config=require(_0xf689('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf689('0x15'))['db'];function respondWithStatusCode(_0x1a2c63,_0x185de8){_0x185de8=_0x185de8||0xcc;return function(_0x545371){if(_0x545371){return _0x1a2c63[_0xf689('0x16')](_0x185de8);}return _0x1a2c63[_0xf689('0x17')](_0x185de8)[_0xf689('0x18')]();};}function respondWithResult(_0x11a75d,_0x4a8e83){_0x4a8e83=_0x4a8e83||0xc8;return function(_0x15800){if(_0x15800){return _0x11a75d[_0xf689('0x17')](_0x4a8e83)['json'](_0x15800);}};}function respondWithFilteredResult(_0x1013c7,_0x45d318){return function(_0x3a9afc){if(_0x3a9afc){var _0x2f739f=typeof _0x45d318[_0xf689('0x19')]===_0xf689('0x1a')&&typeof _0x45d318[_0xf689('0x1b')]===_0xf689('0x1a');var _0x3b2fec=_0x3a9afc[_0xf689('0x1c')];var _0x3c7202=_0x2f739f?0x0:_0x45d318[_0xf689('0x19')];var _0x34d816=_0x2f739f?_0x3a9afc[_0xf689('0x1c')]:_0x45d318[_0xf689('0x19')]+_0x45d318[_0xf689('0x1b')];var _0x535ce3;if(_0x34d816>=_0x3b2fec){_0x34d816=_0x3b2fec;_0x535ce3=0xc8;}else{_0x535ce3=0xce;}_0x1013c7[_0xf689('0x17')](_0x535ce3);return _0x1013c7[_0xf689('0x1d')](_0xf689('0x1e'),_0x3c7202+'-'+_0x34d816+'/'+_0x3b2fec)['json'](_0x3a9afc);}return null;};}function patchUpdates(_0xf2d595){return function(_0x1b7b79){try{jsonpatch[_0xf689('0x1f')](_0x1b7b79,_0xf2d595,!![]);}catch(_0x2902e1){return BPromise[_0xf689('0x20')](_0x2902e1);}return _0x1b7b79['save']();};}function saveUpdates(_0x25da76,_0x168868){return function(_0x1a8fb9){if(_0x1a8fb9){return _0x1a8fb9['update'](_0x25da76)[_0xf689('0x21')](function(_0x1803ff){return _0x1803ff;});}return null;};}function removeEntity(_0x155a90,_0x4e597d){return function(_0x5bb792){if(_0x5bb792){return _0x5bb792[_0xf689('0x22')]()[_0xf689('0x21')](function(){_0x155a90[_0xf689('0x17')](0xcc)[_0xf689('0x18')]();});}};}function handleEntityNotFound(_0x92b030,_0x59d6ab){return function(_0xf96b26){if(!_0xf96b26){_0x92b030[_0xf689('0x16')](0x194);}return _0xf96b26;};}function handleError(_0x444fb7,_0x5cbd9e){_0x5cbd9e=_0x5cbd9e||0x1f4;return function(_0x536783){logger[_0xf689('0x23')](_0x536783[_0xf689('0x24')]);if(_0x536783[_0xf689('0x25')]){delete _0x536783[_0xf689('0x25')];}_0x444fb7[_0xf689('0x17')](_0x5cbd9e)[_0xf689('0x26')](_0x536783);};}exports[_0xf689('0x27')]=function(_0x22f3ae,_0x172c62){var _0x257bdb={},_0xb7fc50={},_0x4a20b9={'count':0x0,'rows':[]};var _0xe7b686=_['map'](db['ChatTransferReport'][_0xf689('0x28')],function(_0x3b57ec){return{'name':_0x3b57ec['fieldName'],'type':_0x3b57ec[_0xf689('0x29')][_0xf689('0x2a')]};});_0xb7fc50[_0xf689('0x2b')]=_['map'](_0xe7b686,_0xf689('0x25'));_0xb7fc50[_0xf689('0x2c')]=_[_0xf689('0x2d')](_0x22f3ae[_0xf689('0x2c')]);_0xb7fc50[_0xf689('0x2e')]=_[_0xf689('0x2f')](_0xb7fc50['model'],_0xb7fc50[_0xf689('0x2c')]);_0x257bdb[_0xf689('0x30')]=_['intersection'](_0xb7fc50[_0xf689('0x2b')],qs[_0xf689('0x31')](_0x22f3ae['query'][_0xf689('0x31')]));_0x257bdb['attributes']=_0x257bdb[_0xf689('0x30')][_0xf689('0x32')]?_0x257bdb[_0xf689('0x30')]:_0xb7fc50['model'];if(!_0x22f3ae[_0xf689('0x2c')][_0xf689('0x33')](_0xf689('0x34'))){_0x257bdb[_0xf689('0x1b')]=qs['limit'](_0x22f3ae[_0xf689('0x2c')][_0xf689('0x1b')]);_0x257bdb[_0xf689('0x19')]=qs[_0xf689('0x19')](_0x22f3ae[_0xf689('0x2c')]['offset']);}_0x257bdb[_0xf689('0x35')]=qs[_0xf689('0x36')](_0x22f3ae['query'][_0xf689('0x36')]);_0x257bdb['where']=qs[_0xf689('0x2e')](_[_0xf689('0x37')](_0x22f3ae['query'],_0xb7fc50[_0xf689('0x2e')]),_0xe7b686);if(_0x22f3ae[_0xf689('0x2c')]['filter']){_0x257bdb[_0xf689('0x38')]=_['merge'](_0x257bdb[_0xf689('0x38')],{'$or':_[_0xf689('0x39')](_0xe7b686,function(_0x7d18f4){if(_0x7d18f4[_0xf689('0x29')]!==_0xf689('0x3a')){var _0x4ad5a8={};_0x4ad5a8[_0x7d18f4[_0xf689('0x25')]]={'$like':'%'+_0x22f3ae['query'][_0xf689('0x3b')]+'%'};return _0x4ad5a8;}})});}_0x257bdb=_['merge']({},_0x257bdb,_0x22f3ae['options']);var _0x5a9f1e={'where':_0x257bdb[_0xf689('0x38')]};return db[_0xf689('0x3c')][_0xf689('0x1c')](_0x5a9f1e)[_0xf689('0x21')](function(_0x36e8dc){_0x4a20b9[_0xf689('0x1c')]=_0x36e8dc;if(_0x22f3ae[_0xf689('0x2c')][_0xf689('0x3d')]){_0x257bdb[_0xf689('0x3e')]=[{'all':!![]}];}return db[_0xf689('0x3c')]['findAll'](_0x257bdb);})[_0xf689('0x21')](function(_0xd2c09b){_0x4a20b9[_0xf689('0x3f')]=_0xd2c09b;return _0x4a20b9;})[_0xf689('0x21')](respondWithFilteredResult(_0x172c62,_0x257bdb))[_0xf689('0x40')](handleError(_0x172c62,null));};exports[_0xf689('0x41')]=function(_0x42698a,_0x135e2c){var _0x5010a7={'raw':!![],'where':{'id':_0x42698a[_0xf689('0x42')]['id']}},_0x3f6e94={};_0x3f6e94[_0xf689('0x2b')]=_['keys'](db[_0xf689('0x3c')]['rawAttributes']);_0x3f6e94[_0xf689('0x2c')]=_['keys'](_0x42698a[_0xf689('0x2c')]);_0x3f6e94[_0xf689('0x2e')]=_[_0xf689('0x2f')](_0x3f6e94[_0xf689('0x2b')],_0x3f6e94[_0xf689('0x2c')]);_0x5010a7['attributes']=_[_0xf689('0x2f')](_0x3f6e94['model'],qs[_0xf689('0x31')](_0x42698a[_0xf689('0x2c')][_0xf689('0x31')]));_0x5010a7[_0xf689('0x30')]=_0x5010a7[_0xf689('0x30')][_0xf689('0x32')]?_0x5010a7[_0xf689('0x30')]:_0x3f6e94[_0xf689('0x2b')];if(_0x42698a['query'][_0xf689('0x3d')]){_0x5010a7[_0xf689('0x3e')]=[{'all':!![]}];}_0x5010a7=_[_0xf689('0x43')]({},_0x5010a7,_0x42698a['options']);return db[_0xf689('0x3c')][_0xf689('0x44')](_0x5010a7)[_0xf689('0x21')](handleEntityNotFound(_0x135e2c,null))[_0xf689('0x21')](respondWithResult(_0x135e2c,null))[_0xf689('0x40')](handleError(_0x135e2c,null));};exports['create']=function(_0x1d5e84,_0x2a0d23){return db[_0xf689('0x3c')][_0xf689('0x45')](_0x1d5e84[_0xf689('0x46')],{})[_0xf689('0x21')](respondWithResult(_0x2a0d23,0xc9))[_0xf689('0x40')](handleError(_0x2a0d23,null));};exports[_0xf689('0x47')]=function(_0x51e728,_0x57bd7e){if(_0x51e728[_0xf689('0x46')]['id']){delete _0x51e728[_0xf689('0x46')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x51e728[_0xf689('0x42')]['id']}})['then'](handleEntityNotFound(_0x57bd7e,null))['then'](saveUpdates(_0x51e728[_0xf689('0x46')],null))[_0xf689('0x21')](respondWithResult(_0x57bd7e,null))[_0xf689('0x40')](handleError(_0x57bd7e,null));};exports[_0xf689('0x22')]=function(_0x3ec16d,_0x18e3cc){return db['ChatTransferReport'][_0xf689('0x44')]({'where':{'id':_0x3ec16d[_0xf689('0x42')]['id']}})[_0xf689('0x21')](handleEntityNotFound(_0x18e3cc,null))['then'](removeEntity(_0x18e3cc,null))[_0xf689('0x40')](handleError(_0x18e3cc,null));};exports['describe']=function(_0x281632,_0xe61c38){return db[_0xf689('0x3c')][_0xf689('0x48')]()[_0xf689('0x21')](respondWithResult(_0xe61c38,null))[_0xf689('0x40')](handleError(_0xe61c38,null));}; \ No newline at end of file +var _0xc976=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','model','keys'];(function(_0x15ad6e,_0x1d118c){var _0x7eccad=function(_0x13c5e4){while(--_0x13c5e4){_0x15ad6e['push'](_0x15ad6e['shift']());}};_0x7eccad(++_0x1d118c);}(_0xc976,0x14e));var _0x6c97=function(_0x4949f8,_0x379e12){_0x4949f8=_0x4949f8-0x0;var _0x364f6b=_0xc976[_0x4949f8];return _0x364f6b;};'use strict';var emlformat=require(_0x6c97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c97('0x1'));var jsonpatch=require(_0x6c97('0x2'));var rp=require(_0x6c97('0x3'));var moment=require(_0x6c97('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c97('0x5'));var util=require(_0x6c97('0x6'));var path=require(_0x6c97('0x7'));var sox=require(_0x6c97('0x8'));var csv=require(_0x6c97('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c97('0xa'));var _=require('lodash');var squel=require(_0x6c97('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c97('0xc'));var deskjs=require(_0x6c97('0xd'));var toCsv=require(_0x6c97('0x9'));var querystring=require(_0x6c97('0xe'));var Papa=require(_0x6c97('0xf'));var Redis=require(_0x6c97('0x10'));var authService=require(_0x6c97('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6c97('0x12'));var hardwareService=require(_0x6c97('0x13'));var logger=require(_0x6c97('0x14'))(_0x6c97('0x15'));var utils=require(_0x6c97('0x16'));var config=require(_0x6c97('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c97('0x18'))['db'];function respondWithStatusCode(_0x4a9ea2,_0xb988c2){_0xb988c2=_0xb988c2||0xcc;return function(_0x1730d0){if(_0x1730d0){return _0x4a9ea2[_0x6c97('0x19')](_0xb988c2);}return _0x4a9ea2[_0x6c97('0x1a')](_0xb988c2)[_0x6c97('0x1b')]();};}function respondWithResult(_0x153f2d,_0x465c74){_0x465c74=_0x465c74||0xc8;return function(_0x31aaf1){if(_0x31aaf1){return _0x153f2d['status'](_0x465c74)[_0x6c97('0x1c')](_0x31aaf1);}};}function respondWithFilteredResult(_0x4fa674,_0x31857d){return function(_0x2a5cda){if(_0x2a5cda){var _0x17a87f=typeof _0x31857d['offset']===_0x6c97('0x1d')&&typeof _0x31857d[_0x6c97('0x1e')]==='undefined';var _0x45ae3d=_0x2a5cda[_0x6c97('0x1f')];var _0x2b90fe=_0x17a87f?0x0:_0x31857d[_0x6c97('0x20')];var _0x30446d=_0x17a87f?_0x2a5cda[_0x6c97('0x1f')]:_0x31857d['offset']+_0x31857d['limit'];var _0x103ce1;if(_0x30446d>=_0x45ae3d){_0x30446d=_0x45ae3d;_0x103ce1=0xc8;}else{_0x103ce1=0xce;}_0x4fa674[_0x6c97('0x1a')](_0x103ce1);return _0x4fa674['set'](_0x6c97('0x21'),_0x2b90fe+'-'+_0x30446d+'/'+_0x45ae3d)[_0x6c97('0x1c')](_0x2a5cda);}return null;};}function patchUpdates(_0x5c9a0b){return function(_0x20b624){try{jsonpatch[_0x6c97('0x22')](_0x20b624,_0x5c9a0b,!![]);}catch(_0x35a250){return BPromise[_0x6c97('0x23')](_0x35a250);}return _0x20b624[_0x6c97('0x24')]();};}function saveUpdates(_0x34f3e7,_0x450607){return function(_0x2809bd){if(_0x2809bd){return _0x2809bd[_0x6c97('0x25')](_0x34f3e7)['then'](function(_0x22d616){return _0x22d616;});}return null;};}function removeEntity(_0x1967bf,_0x35882d){return function(_0x1eeb60){if(_0x1eeb60){return _0x1eeb60[_0x6c97('0x26')]()[_0x6c97('0x27')](function(){_0x1967bf[_0x6c97('0x1a')](0xcc)[_0x6c97('0x1b')]();});}};}function handleEntityNotFound(_0x5761db,_0x423393){return function(_0x18894a){if(!_0x18894a){_0x5761db['sendStatus'](0x194);}return _0x18894a;};}function handleError(_0x408584,_0x39bc56){_0x39bc56=_0x39bc56||0x1f4;return function(_0x4678d7){logger[_0x6c97('0x28')](_0x4678d7[_0x6c97('0x29')]);if(_0x4678d7[_0x6c97('0x2a')]){delete _0x4678d7[_0x6c97('0x2a')];}_0x408584[_0x6c97('0x1a')](_0x39bc56)[_0x6c97('0x2b')](_0x4678d7);};}exports[_0x6c97('0x2c')]=function(_0x1e033e,_0x471edb){var _0x51c291={},_0x14eac9={},_0x3eaf5e={'count':0x0,'rows':[]};var _0x38ff84=_[_0x6c97('0x2d')](db[_0x6c97('0x2e')]['rawAttributes'],function(_0x331918){return{'name':_0x331918[_0x6c97('0x2f')],'type':_0x331918[_0x6c97('0x30')]['key']};});_0x14eac9[_0x6c97('0x31')]=_[_0x6c97('0x2d')](_0x38ff84,_0x6c97('0x2a'));_0x14eac9['query']=_[_0x6c97('0x32')](_0x1e033e[_0x6c97('0x33')]);_0x14eac9[_0x6c97('0x34')]=_[_0x6c97('0x35')](_0x14eac9[_0x6c97('0x31')],_0x14eac9[_0x6c97('0x33')]);_0x51c291[_0x6c97('0x36')]=_['intersection'](_0x14eac9[_0x6c97('0x31')],qs[_0x6c97('0x37')](_0x1e033e[_0x6c97('0x33')][_0x6c97('0x37')]));_0x51c291['attributes']=_0x51c291[_0x6c97('0x36')]['length']?_0x51c291['attributes']:_0x14eac9['model'];if(!_0x1e033e[_0x6c97('0x33')][_0x6c97('0x38')](_0x6c97('0x39'))){_0x51c291[_0x6c97('0x1e')]=qs[_0x6c97('0x1e')](_0x1e033e[_0x6c97('0x33')][_0x6c97('0x1e')]);_0x51c291[_0x6c97('0x20')]=qs['offset'](_0x1e033e[_0x6c97('0x33')]['offset']);}_0x51c291[_0x6c97('0x3a')]=qs[_0x6c97('0x3b')](_0x1e033e[_0x6c97('0x33')][_0x6c97('0x3b')]);_0x51c291[_0x6c97('0x3c')]=qs['filters'](_[_0x6c97('0x3d')](_0x1e033e[_0x6c97('0x33')],_0x14eac9[_0x6c97('0x34')]),_0x38ff84);if(_0x1e033e[_0x6c97('0x33')][_0x6c97('0x3e')]){_0x51c291[_0x6c97('0x3c')]=_[_0x6c97('0x3f')](_0x51c291[_0x6c97('0x3c')],{'$or':_['map'](_0x38ff84,function(_0x23b248){if(_0x23b248[_0x6c97('0x30')]!==_0x6c97('0x40')){var _0x3a3be9={};_0x3a3be9[_0x23b248['name']]={'$like':'%'+_0x1e033e[_0x6c97('0x33')][_0x6c97('0x3e')]+'%'};return _0x3a3be9;}})});}_0x51c291=_[_0x6c97('0x3f')]({},_0x51c291,_0x1e033e[_0x6c97('0x41')]);var _0x14ac8b={'where':_0x51c291[_0x6c97('0x3c')]};return db[_0x6c97('0x2e')][_0x6c97('0x1f')](_0x14ac8b)['then'](function(_0x3469e7){_0x3eaf5e[_0x6c97('0x1f')]=_0x3469e7;if(_0x1e033e[_0x6c97('0x33')]['includeAll']){_0x51c291[_0x6c97('0x42')]=[{'all':!![]}];}return db[_0x6c97('0x2e')]['findAll'](_0x51c291);})[_0x6c97('0x27')](function(_0xf22a9b){_0x3eaf5e[_0x6c97('0x43')]=_0xf22a9b;return _0x3eaf5e;})[_0x6c97('0x27')](respondWithFilteredResult(_0x471edb,_0x51c291))[_0x6c97('0x44')](handleError(_0x471edb,null));};exports[_0x6c97('0x45')]=function(_0x27d61e,_0x14eabd){var _0x29932b={'raw':!![],'where':{'id':_0x27d61e[_0x6c97('0x46')]['id']}},_0x14d375={};_0x14d375[_0x6c97('0x31')]=_[_0x6c97('0x32')](db[_0x6c97('0x2e')][_0x6c97('0x47')]);_0x14d375[_0x6c97('0x33')]=_[_0x6c97('0x32')](_0x27d61e[_0x6c97('0x33')]);_0x14d375[_0x6c97('0x34')]=_[_0x6c97('0x35')](_0x14d375[_0x6c97('0x31')],_0x14d375[_0x6c97('0x33')]);_0x29932b[_0x6c97('0x36')]=_[_0x6c97('0x35')](_0x14d375[_0x6c97('0x31')],qs[_0x6c97('0x37')](_0x27d61e[_0x6c97('0x33')][_0x6c97('0x37')]));_0x29932b[_0x6c97('0x36')]=_0x29932b['attributes']['length']?_0x29932b['attributes']:_0x14d375['model'];if(_0x27d61e[_0x6c97('0x33')][_0x6c97('0x48')]){_0x29932b[_0x6c97('0x42')]=[{'all':!![]}];}_0x29932b=_[_0x6c97('0x3f')]({},_0x29932b,_0x27d61e[_0x6c97('0x41')]);return db[_0x6c97('0x2e')][_0x6c97('0x49')](_0x29932b)['then'](handleEntityNotFound(_0x14eabd,null))[_0x6c97('0x27')](respondWithResult(_0x14eabd,null))[_0x6c97('0x44')](handleError(_0x14eabd,null));};exports[_0x6c97('0x4a')]=function(_0x38298e,_0x3b03a1){return db['ChatTransferReport'][_0x6c97('0x4a')](_0x38298e[_0x6c97('0x4b')],{})['then'](respondWithResult(_0x3b03a1,0xc9))[_0x6c97('0x44')](handleError(_0x3b03a1,null));};exports[_0x6c97('0x25')]=function(_0x56cb24,_0xae8ad9){if(_0x56cb24[_0x6c97('0x4b')]['id']){delete _0x56cb24['body']['id'];}return db[_0x6c97('0x2e')]['find']({'where':{'id':_0x56cb24[_0x6c97('0x46')]['id']}})['then'](handleEntityNotFound(_0xae8ad9,null))[_0x6c97('0x27')](saveUpdates(_0x56cb24[_0x6c97('0x4b')],null))[_0x6c97('0x27')](respondWithResult(_0xae8ad9,null))[_0x6c97('0x44')](handleError(_0xae8ad9,null));};exports[_0x6c97('0x26')]=function(_0x5de540,_0x491e95){return db[_0x6c97('0x2e')]['find']({'where':{'id':_0x5de540[_0x6c97('0x46')]['id']}})[_0x6c97('0x27')](handleEntityNotFound(_0x491e95,null))[_0x6c97('0x27')](removeEntity(_0x491e95,null))[_0x6c97('0x44')](handleError(_0x491e95,null));};exports[_0x6c97('0x4c')]=function(_0x4ec751,_0x48d444){return db[_0x6c97('0x2e')][_0x6c97('0x4c')]()[_0x6c97('0x27')](respondWithResult(_0x48d444,null))[_0x6c97('0x44')](handleError(_0x48d444,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index dfd7ad0..c7f8257 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 _0xfdc7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid'];(function(_0x16056b,_0x27e794){var _0x534079=function(_0x5be1d7){while(--_0x5be1d7){_0x16056b['push'](_0x16056b['shift']());}};_0x534079(++_0x27e794);}(_0xfdc7,0x1a4));var _0x7fdc=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0xfdc7[_0x24f862];return _0x198aa4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7fdc('0x0'))(_0x7fdc('0x1'));var moment=require(_0x7fdc('0x2'));var BPromise=require(_0x7fdc('0x3'));var rp=require(_0x7fdc('0x4'));var fs=require('fs');var path=require(_0x7fdc('0x5'));var rimraf=require(_0x7fdc('0x6'));var config=require(_0x7fdc('0x7'));var attributes=require(_0x7fdc('0x8'));module[_0x7fdc('0x9')]=function(_0x3f5609,_0x461098){return _0x3f5609['define'](_0x7fdc('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x7fdc('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6405=['util','../../config/logger','moment','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x3728c8,_0x4cd76b){var _0xd6c60d=function(_0x591805){while(--_0x591805){_0x3728c8['push'](_0x3728c8['shift']());}};_0xd6c60d(++_0x4cd76b);}(_0x6405,0x143));var _0x5640=function(_0x3736bd,_0x26f90d){_0x3736bd=_0x3736bd-0x0;var _0x5d03cf=_0x6405[_0x3736bd];return _0x5d03cf;};'use strict';var _=require(_0x5640('0x0'));var util=require(_0x5640('0x1'));var logger=require(_0x5640('0x2'))('api');var moment=require(_0x5640('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5640('0x4'));var rimraf=require('rimraf');var config=require(_0x5640('0x5'));var attributes=require(_0x5640('0x6'));module[_0x5640('0x7')]=function(_0x2186c1,_0x2969f2){return _0x2186c1[_0x5640('0x8')](_0x5640('0x9'),attributes,{'tableName':_0x5640('0xa'),'paranoid':![],'indexes':[{'name':_0x5640('0xb'),'fields':[_0x5640('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ab93530..eb3b4f7 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 _0x7425=['then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x344412,_0x313e02){var _0x1271ef=function(_0x247b53){while(--_0x247b53){_0x344412['push'](_0x344412['shift']());}};_0x1271ef(++_0x313e02);}(_0x7425,0x172));var _0x5742=function(_0x19515c,_0x12b7ec){_0x19515c=_0x19515c-0x0;var _0x268500=_0x7425[_0x19515c];return _0x268500;};'use strict';var _=require(_0x5742('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5742('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5742('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5742('0x3'))(_0x5742('0x4'));var config=require(_0x5742('0x5'));var jayson=require(_0x5742('0x6'));var client=jayson[_0x5742('0x7')][_0x5742('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2141ba,_0x473070,_0x4b97f7){return new BPromise(function(_0x2a129a,_0x53295a){return client[_0x5742('0x9')](_0x2141ba,_0x4b97f7)[_0x5742('0xa')](function(_0xbeb719){logger['info'](_0x5742('0xb'),_0x473070,_0x5742('0xc'));logger[_0x5742('0xd')](_0x5742('0xe'),_0x473070,_0x5742('0xc'),JSON['stringify'](_0xbeb719));if(_0xbeb719[_0x5742('0xf')]){if(_0xbeb719[_0x5742('0xf')]['code']===0x1f4){logger[_0x5742('0xf')](_0x5742('0xb'),_0x473070,_0xbeb719[_0x5742('0xf')][_0x5742('0x10')]);return _0x53295a(_0xbeb719[_0x5742('0xf')][_0x5742('0x10')]);}logger[_0x5742('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x473070,_0xbeb719[_0x5742('0xf')]['message']);return _0x2a129a(_0xbeb719[_0x5742('0xf')][_0x5742('0x10')]);}else{logger[_0x5742('0x11')](_0x5742('0xb'),_0x473070,_0x5742('0xc'));_0x2a129a(_0xbeb719[_0x5742('0x12')][_0x5742('0x10')]);}})[_0x5742('0x13')](function(_0x471bc4){logger['error'](_0x5742('0xb'),_0x473070,_0x471bc4);_0x53295a(_0x471bc4);});});} \ No newline at end of file +var _0x7007=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7007,0xba));var _0x7700=function(_0x225039,_0xe667f8){_0x225039=_0x225039-0x0;var _0x269565=_0x7007[_0x225039];return _0x269565;};'use strict';var _=require(_0x7700('0x0'));var util=require('util');var moment=require(_0x7700('0x1'));var BPromise=require(_0x7700('0x2'));var rs=require(_0x7700('0x3'));var fs=require('fs');var Redis=require(_0x7700('0x4'));var db=require(_0x7700('0x5'))['db'];var utils=require(_0x7700('0x6'));var logger=require(_0x7700('0x7'))(_0x7700('0x8'));var config=require(_0x7700('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7700('0xa')][_0x7700('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x501ef5,_0xb9d656,_0x4e0cfd){return new BPromise(function(_0x52126c,_0x335442){return client[_0x7700('0xc')](_0x501ef5,_0x4e0cfd)[_0x7700('0xd')](function(_0x373684){logger['info'](_0x7700('0xe'),_0xb9d656,_0x7700('0xf'));logger[_0x7700('0x10')](_0x7700('0x11'),_0xb9d656,_0x7700('0xf'),JSON[_0x7700('0x12')](_0x373684));if(_0x373684['error']){if(_0x373684[_0x7700('0x13')][_0x7700('0x14')]===0x1f4){logger[_0x7700('0x13')](_0x7700('0xe'),_0xb9d656,_0x373684[_0x7700('0x13')]['message']);return _0x335442(_0x373684[_0x7700('0x13')][_0x7700('0x15')]);}logger['error'](_0x7700('0xe'),_0xb9d656,_0x373684[_0x7700('0x13')]['message']);return _0x52126c(_0x373684['error'][_0x7700('0x15')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xb9d656,_0x7700('0xf'));_0x52126c(_0x373684[_0x7700('0x16')][_0x7700('0x15')]);}})[_0x7700('0x17')](function(_0x4fd479){logger[_0x7700('0x13')](_0x7700('0xe'),_0xb9d656,_0x4fd479);_0x335442(_0x4fd479);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 593f35a..30e118b 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 _0x9001=['post','create','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4bc353,_0x45ac4e){var _0xf4e316=function(_0x17578c){while(--_0x17578c){_0x4bc353['push'](_0x4bc353['shift']());}};_0xf4e316(++_0x45ac4e);}(_0x9001,0x130));var _0x1900=function(_0x4f1dc7,_0x2984e7){_0x4f1dc7=_0x4f1dc7-0x0;var _0x55d6ea=_0x9001[_0x4f1dc7];return _0x55d6ea;};'use strict';var multer=require('multer');var util=require(_0x1900('0x0'));var path=require(_0x1900('0x1'));var timeout=require(_0x1900('0x2'));var express=require(_0x1900('0x3'));var router=express[_0x1900('0x4')]();var fs_extra=require(_0x1900('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1900('0x6'));var config=require(_0x1900('0x7'));var controller=require(_0x1900('0x8'));router[_0x1900('0x9')]('/',auth[_0x1900('0xa')](),controller[_0x1900('0xb')]);router[_0x1900('0x9')](_0x1900('0xc'),auth[_0x1900('0xa')](),controller[_0x1900('0xd')]);router[_0x1900('0x9')](_0x1900('0xe'),auth[_0x1900('0xa')](),controller[_0x1900('0xf')]);router[_0x1900('0x10')]('/',auth[_0x1900('0xa')](),controller[_0x1900('0x11')]);router['put']('/:id',auth[_0x1900('0xa')](),controller[_0x1900('0x12')]);router['delete'](_0x1900('0xe'),auth[_0x1900('0xa')](),controller[_0x1900('0x13')]);module['exports']=router; \ No newline at end of file +var _0xadba=['../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x5093fe,_0x54a1e){var _0x2c3b49=function(_0x15cad4){while(--_0x15cad4){_0x5093fe['push'](_0x5093fe['shift']());}};_0x2c3b49(++_0x54a1e);}(_0xadba,0xfb));var _0xaadb=function(_0x513ead,_0x3f6753){_0x513ead=_0x513ead-0x0;var _0x3f5a98=_0xadba[_0x513ead];return _0x3f5a98;};'use strict';var multer=require('multer');var util=require(_0xaadb('0x0'));var path=require(_0xaadb('0x1'));var timeout=require(_0xaadb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaadb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xaadb('0x4'));var config=require(_0xaadb('0x5'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0xaadb('0x6')](),controller['index']);router[_0xaadb('0x7')](_0xaadb('0x8'),auth[_0xaadb('0x6')](),controller[_0xaadb('0x9')]);router[_0xaadb('0x7')](_0xaadb('0xa'),auth[_0xaadb('0x6')](),controller[_0xaadb('0xb')]);router[_0xaadb('0xc')]('/',auth[_0xaadb('0x6')](),controller[_0xaadb('0xd')]);router['put'](_0xaadb('0xa'),auth['isAuthenticated'](),controller[_0xaadb('0xe')]);router['delete'](_0xaadb('0xa'),auth[_0xaadb('0x6')](),controller['destroy']);module[_0xaadb('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c283443..455b267 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 _0x6303=['Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x458d68,_0x1dbe12){var _0x3e4a4b=function(_0x3f7b04){while(--_0x3f7b04){_0x458d68['push'](_0x458d68['shift']());}};_0x3e4a4b(++_0x1dbe12);}(_0x6303,0x15d));var _0x3630=function(_0x1ebd92,_0x363a1d){_0x1ebd92=_0x1ebd92-0x0;var _0x2c4308=_0x6303[_0x1ebd92];return _0x2c4308;};'use strict';var Sequelize=require(_0x3630('0x0'));var rs=require(_0x3630('0x1'));module[_0x3630('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x3630('0x3')],'allowNull':![],'unique':_0x3630('0x4')},'description':{'type':Sequelize[_0x3630('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0x6')},'customerAlias':{'type':Sequelize[_0x3630('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3630('0x3')],'allowNull':![],'defaultValue':_0x3630('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3630('0x3')],'allowNull':![],'defaultValue':_0x3630('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3630('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3630('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3630('0x3')]},'animation':{'type':Sequelize[_0x3630('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3630('0xa')](_0x3630('0xb'),_0x3630('0xc')),'defaultValue':_0x3630('0xb')},'header_online':{'type':Sequelize[_0x3630('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0xd')},'offline_chat_button':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x3630('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3630('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3630('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x13')},'noteTitle':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x14')},'placeholderMessage':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0xe')},'skipMessageButton':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x17')},'conditionAgreement':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x18')},'ratingType':{'type':Sequelize[_0x3630('0xa')](_0x3630('0x19'),_0x3630('0x1a')),'defaultValue':_0x3630('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x3630('0x1b')]({'items':[{'type':_0x3630('0x1c'),'variable':null,'config':{'placeholder':_0x3630('0x1d'),'type':_0x3630('0x1e'),'required':!![]},'props':{'title':_0x3630('0x1d'),'helpText':''}},{'type':_0x3630('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x3630('0x5'),'type':_0x3630('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3630('0x1f')](_0x3630('0x20'))?JSON['parse'](this[_0x3630('0x1f')](_0x3630('0x20'))):{};},'set':function(_0x2e77a5){return this[_0x3630('0x21')](_0x3630('0x20'),JSON[_0x3630('0x1b')](_0x2e77a5));}},'offlineForm':{'type':Sequelize[_0x3630('0x10')],'defaultValue':function(){return JSON[_0x3630('0x1b')]({'items':[{'type':_0x3630('0x1c'),'props':{'title':_0x3630('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3630('0x5')},'variable':null},{'type':_0x3630('0x22'),'config':{'placeholder':_0x3630('0x23')},'props':{'title':'Comments','helpText':_0x3630('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x3630('0x1f')]('offlineForm')?JSON[_0x3630('0x25')](this[_0x3630('0x1f')]('offlineForm')):{};},'set':function(_0x206c8d){return this[_0x3630('0x21')](_0x3630('0x26'),JSON['stringify'](_0x206c8d));}},'token':{'type':Sequelize[_0x3630('0x3')],'defaultValue':function(){return rs[_0x3630('0x27')]();}},'autoclose':{'type':Sequelize[_0x3630('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3630('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3630('0x3')]},'waitingTitle':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0x29')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x2a')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x17')},'sendUnmanaged':{'type':Sequelize[_0x3630('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3630('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3630('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3630('0x10')],'defaultValue':function(){return _0x3630('0x2c');}},'notificationSound':{'type':Sequelize[_0x3630('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3630('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x2e')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x3630('0x3')],'defaultValue':_0x3630('0x2f')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3630('0x30')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x3630('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3630('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3630('0x31'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3630('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3630('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3630('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3630('0x8')],'comment':_0x3630('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![],'comment':_0x3630('0x33'),'set':function(_0x4d151f){if(!_0x4d151f)this['setDataValue'](_0x3630('0x34'),null);this[_0x3630('0x21')](_0x3630('0x35'),_0x4d151f);}},'vidaooEscalation':{'type':Sequelize[_0x3630('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3630('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3630('0x3')],'allowNull':![],'defaultValue':_0x3630('0x36')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x3630('0x37');}},'vidaooMetadata':{'type':Sequelize[_0x3630('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3630('0x10')]}}; \ No newline at end of file +var _0x2a66=['Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5bf44e,_0x3473cc){var _0x3c26b1=function(_0x5a19dd){while(--_0x5a19dd){_0x5bf44e['push'](_0x5bf44e['shift']());}};_0x3c26b1(++_0x3473cc);}(_0x2a66,0x13f));var _0x62a6=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x2a66[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x62a6('0x0'));module[_0x62a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x62a6('0x2')],'allowNull':![],'unique':_0x62a6('0x3')},'description':{'type':Sequelize[_0x62a6('0x2')]},'mapKey':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x4')},'mapKeyOffline':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x62a6('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x5')},'customerAlias':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62a6('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x62a6('0x2')],'allowNull':![],'defaultValue':_0x62a6('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62a6('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x62a6('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x62a6('0x2')]},'animation':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x62a6('0xa'),_0x62a6('0xb')),'defaultValue':_0x62a6('0xa')},'header_online':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0xc')},'download_transcript':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x62a6('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x62a6('0xd')]},'closingQuestion':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x62a6('0xf')},'noteTitle':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x10')},'placeholderMessage':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x11')},'closingMessage':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x12')},'closingMessageButton':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x13')},'skipMessageButton':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x14')},'conditionAgreement':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x15')},'ratingType':{'type':Sequelize[_0x62a6('0x16')](_0x62a6('0x17'),_0x62a6('0x18')),'defaultValue':_0x62a6('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x62a6('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x62a6('0xd')],'defaultValue':function(){return JSON[_0x62a6('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x62a6('0x1a'),'type':_0x62a6('0x1b'),'required':!![]},'props':{'title':_0x62a6('0x1a'),'helpText':''}},{'type':_0x62a6('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x62a6('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x62a6('0x1d')](_0x62a6('0x1e'))?JSON[_0x62a6('0x1f')](this['getDataValue']('onlineForm')):{};},'set':function(_0x5f54b9){return this[_0x62a6('0x20')](_0x62a6('0x1e'),JSON['stringify'](_0x5f54b9));}},'offlineForm':{'type':Sequelize[_0x62a6('0xd')],'defaultValue':function(){return JSON[_0x62a6('0x19')]({'items':[{'type':'input','props':{'title':_0x62a6('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x62a6('0x4'),'type':'email'},'variable':null},{'type':_0x62a6('0x21'),'config':{'placeholder':_0x62a6('0x22')},'props':{'title':_0x62a6('0x22'),'helpText':_0x62a6('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x62a6('0x1d')](_0x62a6('0x24'))?JSON[_0x62a6('0x1f')](this[_0x62a6('0x1d')](_0x62a6('0x24'))):{};},'set':function(_0x3438f5){return this[_0x62a6('0x20')](_0x62a6('0x24'),JSON[_0x62a6('0x19')](_0x3438f5));}},'token':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':function(){return rs[_0x62a6('0x25')]();}},'autoclose':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x62a6('0x2')]},'waitingTitle':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x26')},'waitingMessage':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x62a6('0x28')},'offlineMessageBody':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x62a6('0xd')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x62a6('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x62a6('0x2b');}},'notificationSound':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x62a6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x2c')},'verticalAlignment':{'type':Sequelize[_0x62a6('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x62a6('0x2e')},'defaultTitle':{'type':Sequelize[_0x62a6('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x62a6('0x2')],'allowNull':![],'defaultValue':_0x62a6('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x62a6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':_0x62a6('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62a6('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![],'comment':_0x62a6('0x31'),'set':function(_0x52ba8c){if(!_0x52ba8c)this[_0x62a6('0x20')](_0x62a6('0x32'),null);this['setDataValue'](_0x62a6('0x33'),_0x52ba8c);}},'vidaooEscalation':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x62a6('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62a6('0x34')},'vidaooNote':{'type':Sequelize[_0x62a6('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x62a6('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x62a6('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x62a6('0xd')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1fb2a32..8e56e1f 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 _0xdad2=['x-real-ip','connection','remoteAddress','replace','alignment','color','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','omit','removeAgents','userChatWebsite:remove','emit','getAgents','mustache','util','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','then','get','ChatWebsites','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','nolimit','sort','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','Applications','account','applications','orderBy','asc','Contacts','defaults','ListId','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','server','files','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','remote'];(function(_0x173d45,_0x3a055c){var _0x39aee9=function(_0x42f958){while(--_0x42f958){_0x173d45['push'](_0x173d45['shift']());}};_0x39aee9(++_0x3a055c);}(_0xdad2,0x14c));var _0x2dad=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xdad2[_0x59ee6f];return _0x4c0979;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x2dad('0x0'));var util=require(_0x2dad('0x1'));var path=require('path');var ejs=require(_0x2dad('0x2'));var fs=require('fs');var fs_extra=require(_0x2dad('0x3'));var _=require(_0x2dad('0x4'));var querystring=require('querystring');var Redis=require(_0x2dad('0x5'));var qs=require(_0x2dad('0x6'));var logger=require('../../config/logger')(_0x2dad('0x7'));var config=require(_0x2dad('0x8'));var db=require(_0x2dad('0x9'))['db'];config[_0x2dad('0xa')]=_['defaults'](config['redis'],{'host':_0x2dad('0xb'),'port':0x18eb});var socket=require(_0x2dad('0xc'))(new Redis(config[_0x2dad('0xa')]));require(_0x2dad('0xd'))[_0x2dad('0xe')](socket);var htmlToText=require(_0x2dad('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x2dad('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x2dad('0x10')][_0x2dad('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x2dad('0x11')]({'port':0x232b});var client9001=jayson[_0x2dad('0x10')][_0x2dad('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x490d40,_0x39a4d5,_0x1d1f6a,_0x4aa814){return new BPromise(function(_0x137735,_0x2fabe2){var _0x3ca27e=_0x4aa814||client;return _0x3ca27e[_0x2dad('0x12')](_0x490d40,_0x1d1f6a)['then'](function(_0x711ee2){logger[_0x2dad('0x13')](_0x2dad('0x14'),_0x39a4d5,_0x2dad('0x15'));logger[_0x2dad('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x39a4d5,'request\x20sent',JSON[_0x2dad('0x17')](_0x711ee2));if(_0x711ee2['error']){if(_0x711ee2['error']['code']===0x1f4){logger[_0x2dad('0x18')](_0x2dad('0x14'),_0x39a4d5,_0x711ee2[_0x2dad('0x18')][_0x2dad('0x19')]);return _0x2fabe2(_0x711ee2[_0x2dad('0x18')]['message']);}logger[_0x2dad('0x18')](_0x2dad('0x14'),_0x39a4d5,_0x711ee2['error'][_0x2dad('0x19')]);return _0x137735(_0x711ee2['error']['message']);}else{logger[_0x2dad('0x13')](_0x2dad('0x14'),_0x39a4d5,_0x2dad('0x15'));_0x137735(_0x711ee2[_0x2dad('0x1a')][_0x2dad('0x19')]);}})[_0x2dad('0x1b')](function(_0x49624c){logger['error'](_0x2dad('0x14'),_0x39a4d5,_0x49624c);_0x2fabe2(_0x49624c);});});}function respondWithStatusCode(_0x5d66af,_0x53ee1d){_0x53ee1d=_0x53ee1d||0xcc;return function(_0x18a0f9){if(_0x18a0f9){return _0x5d66af[_0x2dad('0x1c')](_0x53ee1d);}return _0x5d66af[_0x2dad('0x1d')](_0x53ee1d)['end']();};}function respondWithResult(_0xebad04,_0x505216){_0x505216=_0x505216||0xc8;return function(_0x423c29){if(_0x423c29){return _0xebad04[_0x2dad('0x1d')](_0x505216)[_0x2dad('0x1e')](_0x423c29);}};}function respondWithFilteredResult(_0x546946,_0x42d345){return function(_0x30e0fe){if(_0x30e0fe){var _0xa8d751=typeof _0x42d345['offset']===_0x2dad('0x1f')&&typeof _0x42d345[_0x2dad('0x20')]===_0x2dad('0x1f');var _0x518ee2=_0x30e0fe[_0x2dad('0x21')];var _0x343905=_0xa8d751?0x0:_0x42d345[_0x2dad('0x22')];var _0x379961=_0xa8d751?_0x30e0fe[_0x2dad('0x21')]:_0x42d345[_0x2dad('0x22')]+_0x42d345[_0x2dad('0x20')];var _0x529e88;if(_0x379961>=_0x518ee2){_0x379961=_0x518ee2;_0x529e88=0xc8;}else{_0x529e88=0xce;}_0x546946[_0x2dad('0x1d')](_0x529e88);return _0x546946[_0x2dad('0x23')]('Content-Range',_0x343905+'-'+_0x379961+'/'+_0x518ee2)['json'](_0x30e0fe);}return null;};}function saveUpdates(_0x367bd0){return function(_0x224373){if(_0x224373){return _0x224373['update'](_0x367bd0)[_0x2dad('0x24')](function(_0x2f0a7a){return _0x2f0a7a;});}return null;};}function removeEntity(_0x2dd1dc){return function(_0x5334a5){if(_0x5334a5){return _0x5334a5['destroy']()[_0x2dad('0x24')](function(){var _0x305d12=_0x5334a5[_0x2dad('0x25')]({'plain':!![]});var _0x344ad3=_0x2dad('0x26');return db['UserProfileResource'][_0x2dad('0x27')]({'where':{'type':_0x344ad3,'resourceId':_0x305d12['id']}})['then'](function(){return _0x5334a5;});})[_0x2dad('0x24')](function(){_0x2dd1dc[_0x2dad('0x1d')](0xcc)[_0x2dad('0x28')]();});}};}function handleEntityNotFound(_0xcf033e){return function(_0x35cf62){if(!_0x35cf62){_0xcf033e[_0x2dad('0x1c')](0x194);}return _0x35cf62;};}function handleError(_0x35ad87,_0x37176c){_0x37176c=_0x37176c||0x1f4;return function(_0x3f8c85){logger[_0x2dad('0x18')](_0x3f8c85[_0x2dad('0x29')]);if(_0x3f8c85[_0x2dad('0x2a')]){delete _0x3f8c85[_0x2dad('0x2a')];}_0x35ad87[_0x2dad('0x1d')](_0x37176c)[_0x2dad('0x2b')](_0x3f8c85);};}exports[_0x2dad('0x2c')]=function(_0xb7c090,_0x347e76){var _0x543443={'include':[{'model':db[_0x2dad('0x2d')],'as':_0x2dad('0x2e')}]},_0x3cc928={},_0x5db147={'count':0x0,'rows':[]};var _0x4abb32=_[_0x2dad('0x2f')](db[_0x2dad('0x30')][_0x2dad('0x31')],function(_0x36a741){return{'name':_0x36a741['fieldName'],'type':_0x36a741['type'][_0x2dad('0x32')]};});_0x3cc928[_0x2dad('0x33')]=_[_0x2dad('0x2f')](_0x4abb32,_0x2dad('0x2a'));_0x3cc928[_0x2dad('0x34')]=_[_0x2dad('0x35')](_0xb7c090['query']);_0x3cc928[_0x2dad('0x36')]=_[_0x2dad('0x37')](_0x3cc928[_0x2dad('0x33')],_0x3cc928['query']);_0x543443[_0x2dad('0x38')]=_[_0x2dad('0x37')](_0x3cc928['model'],qs[_0x2dad('0x39')](_0xb7c090[_0x2dad('0x34')][_0x2dad('0x39')]));_0x543443[_0x2dad('0x38')]=_0x543443['attributes'][_0x2dad('0x3a')]?_0x543443[_0x2dad('0x38')]:_0x3cc928['model'];if(!_0xb7c090['query'][_0x2dad('0x3b')]('nolimit')){_0x543443[_0x2dad('0x20')]=qs[_0x2dad('0x20')](_0xb7c090['query']['limit']);_0x543443[_0x2dad('0x22')]=qs[_0x2dad('0x22')](_0xb7c090['query'][_0x2dad('0x22')]);}_0x543443[_0x2dad('0x3c')]=qs['sort'](_0xb7c090[_0x2dad('0x34')]['sort']);_0x543443[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_[_0x2dad('0x3e')](_0xb7c090['query'],_0x3cc928[_0x2dad('0x36')]),_0x4abb32);if(_0xb7c090[_0x2dad('0x34')][_0x2dad('0x3f')]){_0x543443[_0x2dad('0x3d')]=_['merge'](_0x543443[_0x2dad('0x3d')],{'$or':_[_0x2dad('0x2f')](_0x4abb32,function(_0x5e7f03){if(_0x5e7f03[_0x2dad('0x40')]!=='VIRTUAL'){var _0x535351={};_0x535351[_0x5e7f03[_0x2dad('0x2a')]]={'$like':'%'+_0xb7c090[_0x2dad('0x34')][_0x2dad('0x3f')]+'%'};return _0x535351;}})});}_0x543443=_[_0x2dad('0x41')]({},_0x543443,_0xb7c090[_0x2dad('0x42')]);var _0x37db80={'where':_0x543443[_0x2dad('0x3d')]};return db[_0x2dad('0x30')]['count'](_0x37db80)[_0x2dad('0x24')](function(_0x18017a){_0x5db147[_0x2dad('0x21')]=_0x18017a;if(_0xb7c090['query'][_0x2dad('0x43')]){_0x543443[_0x2dad('0x44')]=[{'all':!![]}];}return db[_0x2dad('0x30')][_0x2dad('0x45')](_0x543443);})[_0x2dad('0x24')](function(_0x595358){_0x5db147['rows']=_0x595358;return _0x5db147;})['then'](respondWithFilteredResult(_0x347e76,_0x543443))['catch'](handleError(_0x347e76,null));};exports[_0x2dad('0x46')]=function(_0x522ef4,_0x3fcd88){var _0x2cbb15={'raw':![],'where':{'id':_0x522ef4[_0x2dad('0x47')]['id']},'include':[{'model':db[_0x2dad('0x2d')],'as':'mandatoryDispositionPause'}]},_0x6f995b={};_0x6f995b[_0x2dad('0x33')]=_[_0x2dad('0x35')](db[_0x2dad('0x30')][_0x2dad('0x31')]);_0x6f995b['query']=_['keys'](_0x522ef4[_0x2dad('0x34')]);_0x6f995b['filters']=_[_0x2dad('0x37')](_0x6f995b[_0x2dad('0x33')],_0x6f995b['query']);_0x2cbb15[_0x2dad('0x38')]=_['intersection'](_0x6f995b[_0x2dad('0x33')],qs['fields'](_0x522ef4['query'][_0x2dad('0x39')]));_0x2cbb15[_0x2dad('0x38')]=_0x2cbb15['attributes'][_0x2dad('0x3a')]?_0x2cbb15[_0x2dad('0x38')]:_0x6f995b[_0x2dad('0x33')];if(_0x522ef4[_0x2dad('0x34')]['includeAll']){_0x2cbb15['include']=[{'all':!![]}];}_0x2cbb15=_[_0x2dad('0x41')]({},_0x2cbb15,_0x522ef4['options']);return db[_0x2dad('0x30')][_0x2dad('0x48')](_0x2cbb15)[_0x2dad('0x24')](handleEntityNotFound(_0x3fcd88,null))[_0x2dad('0x24')](respondWithResult(_0x3fcd88,null))[_0x2dad('0x1b')](handleError(_0x3fcd88,null));};exports[_0x2dad('0x49')]=function(_0x269c8d,_0x27be00){return db['ChatWebsite'][_0x2dad('0x49')](_0x269c8d[_0x2dad('0x4a')],{})['then'](function(_0x12f7d2){var _0x43463e=_0x269c8d[_0x2dad('0x4b')][_0x2dad('0x25')]({'plain':!![]});if(!_0x43463e)throw new Error(_0x2dad('0x4c'));if(_0x43463e[_0x2dad('0x4d')]===_0x2dad('0x4b')){var _0x37376e=_0x12f7d2[_0x2dad('0x25')]({'plain':!![]});var _0x1baaab=_0x2dad('0x26');return db[_0x2dad('0x4e')]['find']({'where':{'name':_0x1baaab,'userProfileId':_0x43463e[_0x2dad('0x4f')]},'raw':!![]})[_0x2dad('0x24')](function(_0x39a133){if(_0x39a133&&_0x39a133[_0x2dad('0x50')]===0x0){return db[_0x2dad('0x51')][_0x2dad('0x49')]({'name':_0x37376e[_0x2dad('0x2a')],'resourceId':_0x37376e['id'],'type':_0x39a133['name'],'sectionId':_0x39a133['id']},{})[_0x2dad('0x24')](function(){return _0x12f7d2;});}else{return _0x12f7d2;}})['catch'](function(_0x66da4d){logger[_0x2dad('0x18')](_0x2dad('0x52'),_0x66da4d);throw _0x66da4d;});}return _0x12f7d2;})[_0x2dad('0x24')](respondWithResult(_0x27be00,0xc9))[_0x2dad('0x1b')](handleError(_0x27be00,null));};exports[_0x2dad('0x53')]=function(_0x43a0d7,_0x188012){if(_0x43a0d7[_0x2dad('0x4a')]['id']){delete _0x43a0d7[_0x2dad('0x4a')]['id'];}return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x43a0d7['params']['id']},'include':[{'model':db[_0x2dad('0x2d')],'as':_0x2dad('0x2e')}]})[_0x2dad('0x24')](handleEntityNotFound(_0x188012,null))[_0x2dad('0x24')](saveUpdates(_0x43a0d7[_0x2dad('0x4a')],null))[_0x2dad('0x24')](respondWithResult(_0x188012,null))[_0x2dad('0x1b')](handleError(_0x188012,null));};exports[_0x2dad('0x27')]=function(_0x5e781a,_0x42cb77){return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x5e781a[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x42cb77,null))[_0x2dad('0x24')](removeEntity(_0x42cb77,null))[_0x2dad('0x1b')](handleError(_0x42cb77,null));};exports[_0x2dad('0x54')]=function(_0x9f5fa3,_0x286050){return db[_0x2dad('0x30')][_0x2dad('0x54')]()['then'](respondWithResult(_0x286050,null))['catch'](handleError(_0x286050,null));};exports[_0x2dad('0x55')]=function(_0x120fd2,_0x3b0836){if(_0x120fd2['body']['id']){delete _0x120fd2[_0x2dad('0x4a')]['id'];}return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x120fd2[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b0836,null))[_0x2dad('0x24')](function(_0x29fbc9){if(_0x29fbc9){_0x120fd2[_0x2dad('0x4a')][_0x2dad('0x56')]=_0x29fbc9['id'];return db['Disposition'][_0x2dad('0x49')](_0x120fd2['body']);}})['then'](respondWithResult(_0x3b0836,null))['catch'](handleError(_0x3b0836,null));};exports[_0x2dad('0x57')]=function(_0x337ae2,_0x680446){var _0x377b39={'raw':![],'where':{}};var _0xd18e9a={};var _0x31be88={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2dad('0x58')]({'where':{'id':_0x337ae2[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x680446,null))['then'](function(_0x1673a6){if(_0x1673a6){_0xd18e9a['model']=_['keys'](db['Disposition'][_0x2dad('0x31')]);_0xd18e9a[_0x2dad('0x34')]=_[_0x2dad('0x35')](_0x337ae2[_0x2dad('0x34')]);_0xd18e9a[_0x2dad('0x36')]=_['intersection'](_0xd18e9a[_0x2dad('0x33')],_0xd18e9a[_0x2dad('0x34')]);_0x377b39[_0x2dad('0x38')]=_[_0x2dad('0x37')](_0xd18e9a[_0x2dad('0x33')],qs[_0x2dad('0x39')](_0x337ae2['query']['fields']));_0x377b39['attributes']=_0x377b39['attributes']['length']?_0x377b39[_0x2dad('0x38')]:_0xd18e9a[_0x2dad('0x33')];if(!_0x337ae2[_0x2dad('0x34')][_0x2dad('0x3b')](_0x2dad('0x59'))){_0x377b39['limit']=qs[_0x2dad('0x20')](_0x337ae2[_0x2dad('0x34')][_0x2dad('0x20')]);_0x377b39[_0x2dad('0x22')]=qs[_0x2dad('0x22')](_0x337ae2[_0x2dad('0x34')][_0x2dad('0x22')]);}_0x377b39[_0x2dad('0x3c')]=qs['sort'](_0x337ae2[_0x2dad('0x34')][_0x2dad('0x5a')]);_0x377b39[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_[_0x2dad('0x3e')](_0x337ae2[_0x2dad('0x34')],_0xd18e9a[_0x2dad('0x36')]));_0x377b39[_0x2dad('0x3d')][_0x2dad('0x56')]=_0x1673a6['id'];if(_0x337ae2[_0x2dad('0x34')]['filter']){_0x377b39[_0x2dad('0x3d')]=_[_0x2dad('0x41')](_0x377b39[_0x2dad('0x3d')],{'$or':_[_0x2dad('0x2f')](_0x377b39[_0x2dad('0x38')],function(_0x57d7ab){var _0x441e38={};_0x441e38[_0x57d7ab]={'$like':'%'+_0x337ae2['query'][_0x2dad('0x3f')]+'%'};return _0x441e38;})});}_0x377b39=_[_0x2dad('0x41')]({},_0x377b39,_0x337ae2[_0x2dad('0x42')]);return db[_0x2dad('0x5b')][_0x2dad('0x21')]({'where':_0x377b39[_0x2dad('0x3d')]})[_0x2dad('0x24')](function(_0x478b65){_0x31be88[_0x2dad('0x21')]=_0x478b65;if(_0x337ae2[_0x2dad('0x34')][_0x2dad('0x43')]){_0x377b39[_0x2dad('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x377b39);})[_0x2dad('0x24')](function(_0x369c5d){_0x31be88['rows']=_0x369c5d;return _0x31be88;});}})['then'](respondWithFilteredResult(_0x680446,_0x377b39))[_0x2dad('0x1b')](handleError(_0x680446,null));};exports[_0x2dad('0x5c')]=function(_0x11923b,_0x4c341a){return db['ChatWebsite']['find']({'where':{'id':_0x11923b[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x4c341a,null))[_0x2dad('0x24')](function(_0x298bf4){if(_0x298bf4){return _0x298bf4['removeDispositions'](_0x11923b[_0x2dad('0x34')][_0x2dad('0x5d')]);}})['then'](respondWithStatusCode(_0x4c341a,null))[_0x2dad('0x1b')](handleError(_0x4c341a,null));};exports[_0x2dad('0x5e')]=function(_0x3e5b29,_0x346ee3){if(_0x3e5b29[_0x2dad('0x4a')]['id']){delete _0x3e5b29[_0x2dad('0x4a')]['id'];}return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x3e5b29[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x346ee3,null))[_0x2dad('0x24')](function(_0xf6923){if(_0xf6923){_0x3e5b29[_0x2dad('0x4a')][_0x2dad('0x56')]=_0xf6923['id'];return db[_0x2dad('0x5f')][_0x2dad('0x49')](_0x3e5b29[_0x2dad('0x4a')]);}})[_0x2dad('0x24')](respondWithResult(_0x346ee3,null))['catch'](handleError(_0x346ee3,null));};exports[_0x2dad('0x60')]=function(_0x7964a7,_0x305cab){var _0x45ae2c={'raw':![],'where':{}};var _0x226c3b={};var _0x37405b={'count':0x0,'rows':[]};return db[_0x2dad('0x30')][_0x2dad('0x58')]({'where':{'id':_0x7964a7[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x305cab,null))['then'](function(_0x260193){if(_0x260193){_0x226c3b[_0x2dad('0x33')]=_['keys'](db['CannedAnswer'][_0x2dad('0x31')]);_0x226c3b['query']=_[_0x2dad('0x35')](_0x7964a7[_0x2dad('0x34')]);_0x226c3b[_0x2dad('0x36')]=_['intersection'](_0x226c3b[_0x2dad('0x33')],_0x226c3b['query']);_0x45ae2c[_0x2dad('0x38')]=_['intersection'](_0x226c3b['model'],qs['fields'](_0x7964a7[_0x2dad('0x34')][_0x2dad('0x39')]));_0x45ae2c[_0x2dad('0x38')]=_0x45ae2c['attributes'][_0x2dad('0x3a')]?_0x45ae2c[_0x2dad('0x38')]:_0x226c3b['model'];if(!_0x7964a7[_0x2dad('0x34')]['hasOwnProperty'](_0x2dad('0x59'))){_0x45ae2c[_0x2dad('0x20')]=qs[_0x2dad('0x20')](_0x7964a7[_0x2dad('0x34')][_0x2dad('0x20')]);_0x45ae2c[_0x2dad('0x22')]=qs[_0x2dad('0x22')](_0x7964a7[_0x2dad('0x34')]['offset']);}_0x45ae2c[_0x2dad('0x3c')]=qs['sort'](_0x7964a7[_0x2dad('0x34')]['sort']);_0x45ae2c[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_[_0x2dad('0x3e')](_0x7964a7[_0x2dad('0x34')],_0x226c3b[_0x2dad('0x36')]));_0x45ae2c[_0x2dad('0x3d')][_0x2dad('0x56')]=_0x260193['id'];if(_0x7964a7[_0x2dad('0x34')][_0x2dad('0x3f')]){_0x45ae2c[_0x2dad('0x3d')]=_['merge'](_0x45ae2c[_0x2dad('0x3d')],{'$or':_['map'](_0x45ae2c['attributes'],function(_0x4a8a7d){var _0x1ff09d={};_0x1ff09d[_0x4a8a7d]={'$like':'%'+_0x7964a7[_0x2dad('0x34')]['filter']+'%'};return _0x1ff09d;})});}_0x45ae2c=_['merge']({},_0x45ae2c,_0x7964a7[_0x2dad('0x42')]);return db['CannedAnswer'][_0x2dad('0x21')]({'where':_0x45ae2c['where']})[_0x2dad('0x24')](function(_0x128110){_0x37405b[_0x2dad('0x21')]=_0x128110;if(_0x7964a7[_0x2dad('0x34')][_0x2dad('0x43')]){_0x45ae2c[_0x2dad('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2dad('0x45')](_0x45ae2c);})['then'](function(_0x5618df){_0x37405b[_0x2dad('0x61')]=_0x5618df;return _0x37405b;});}})[_0x2dad('0x24')](respondWithFilteredResult(_0x305cab,_0x45ae2c))[_0x2dad('0x1b')](handleError(_0x305cab,null));};exports['removeAnswers']=function(_0x4887c1,_0x167861){return db['ChatWebsite'][_0x2dad('0x48')]({'where':{'id':_0x4887c1[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x167861,null))[_0x2dad('0x24')](function(_0x439857){if(_0x439857){return _0x439857[_0x2dad('0x62')](_0x4887c1[_0x2dad('0x34')]['ids']);}})[_0x2dad('0x24')](respondWithStatusCode(_0x167861,null))['catch'](handleError(_0x167861,null));};exports[_0x2dad('0x63')]=function(_0x2967e6,_0x13bb38){_0x2967e6[_0x2dad('0x4a')][_0x2dad('0x64')]=_0x2967e6[_0x2dad('0x65')][_0x2dad('0x66')];return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x2967e6[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x13bb38,null))[_0x2dad('0x24')](saveUpdates(_0x2967e6['body'],null))[_0x2dad('0x24')](respondWithResult(_0x13bb38,null))['catch'](handleError(_0x13bb38,null));};exports[_0x2dad('0x67')]=function(_0x23ec66,_0x476d19){_0x23ec66[_0x2dad('0x4a')][_0x2dad('0x68')]=_0x23ec66[_0x2dad('0x65')]['filename'];return db['ChatWebsite'][_0x2dad('0x48')]({'where':{'id':_0x23ec66['params']['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x476d19,null))[_0x2dad('0x24')](saveUpdates(_0x23ec66[_0x2dad('0x4a')],null))[_0x2dad('0x24')](respondWithResult(_0x476d19,null))[_0x2dad('0x1b')](handleError(_0x476d19,null));};exports[_0x2dad('0x69')]=function(_0x266dbc,_0x566570){_0x266dbc[_0x2dad('0x4a')][_0x2dad('0x6a')]=_0x266dbc[_0x2dad('0x65')]['filename'];return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x266dbc[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x566570,null))[_0x2dad('0x24')](saveUpdates(_0x266dbc[_0x2dad('0x4a')],null))[_0x2dad('0x24')](respondWithResult(_0x566570,null))[_0x2dad('0x1b')](handleError(_0x566570,null));};exports[_0x2dad('0x6b')]=function(_0x52b8a6,_0x51e15c){_0x52b8a6['body']['systemAvatar']=_0x52b8a6[_0x2dad('0x65')][_0x2dad('0x66')];return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x52b8a6[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x51e15c,null))[_0x2dad('0x24')](saveUpdates(_0x52b8a6[_0x2dad('0x4a')],null))[_0x2dad('0x24')](respondWithResult(_0x51e15c,null))[_0x2dad('0x1b')](handleError(_0x51e15c,null));};exports['getLogo']=function(_0x5ac8de,_0x240acd){var _0xe68544=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x6e'));var _0x3566e8={'where':{'id':_0x5ac8de['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x13201f=![];return require('../../config/license/util')[_0x2dad('0x6f')]()[_0x2dad('0x24')](function(_0xd8c40c){if(_0xd8c40c){_0x13201f=_0xd8c40c['custom'];}})[_0x2dad('0x24')](function(){return db[_0x2dad('0x30')][_0x2dad('0x48')](_0x3566e8);})['then'](handleEntityNotFound(_0x240acd,null))[_0x2dad('0x24')](function(_0x14ced5){if(_0x14ced5){if(!_[_0x2dad('0x70')](_0x14ced5['sitepic'])){if(fs[_0x2dad('0x71')](path['join'](config['root'],_0x2dad('0x72'),_0x14ced5['sitepic']))&&_0x13201f){_0xe68544=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],'server/files/images/logos/',_0x14ced5['sitepic']);}}return _0x240acd[_0x2dad('0x73')](_0xe68544);}})[_0x2dad('0x1b')](handleError(_0x240acd,null));};exports['getAvatar']=function(_0x2fbaf2,_0x50cf02){var _0x26d2cd=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x74'));var _0x157f6b={'where':{'id':_0x2fbaf2[_0x2dad('0x47')]['id']},'attributes':['id',_0x2dad('0x68')],'raw':!![]};return db[_0x2dad('0x30')][_0x2dad('0x48')](_0x157f6b)[_0x2dad('0x24')](handleEntityNotFound(_0x50cf02,null))['then'](function(_0x4d13b7){if(_0x4d13b7){if(!_['isNil'](_0x4d13b7[_0x2dad('0x68')])){if(fs[_0x2dad('0x71')](path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],'server/files/images/avatars/',_0x4d13b7[_0x2dad('0x68')]))){_0x26d2cd=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x75'),_0x4d13b7[_0x2dad('0x68')]);}}return _0x50cf02[_0x2dad('0x73')](_0x26d2cd);}})[_0x2dad('0x1b')](handleError(_0x50cf02,null));};exports[_0x2dad('0x76')]=function(_0x119277,_0x55f705){var _0x59f4f0=path['join'](config[_0x2dad('0x6d')],'server/files/images/avatars/customer_avatar.png');var _0x462c96={'where':{'id':_0x119277['params']['id']},'attributes':['id',_0x2dad('0x6a'),_0x2dad('0x77')],'raw':!![]};return db[_0x2dad('0x30')][_0x2dad('0x48')](_0x462c96)[_0x2dad('0x24')](handleEntityNotFound(_0x55f705,null))[_0x2dad('0x24')](function(_0x1193a5){if(_0x1193a5){if(!_[_0x2dad('0x70')](_0x1193a5[_0x2dad('0x6a')])){if(fs[_0x2dad('0x71')](path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x75'),_0x1193a5['customerAvatar']))&&_0x1193a5[_0x2dad('0x77')]){_0x59f4f0=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x75'),_0x1193a5[_0x2dad('0x6a')]);}}return _0x55f705[_0x2dad('0x73')](_0x59f4f0);}})[_0x2dad('0x1b')](handleError(_0x55f705,null));};exports[_0x2dad('0x78')]=function(_0x421049,_0x2a2630){var _0xa922f1=path[_0x2dad('0x6c')](config['root'],_0x2dad('0x79'));var _0x30edd6={'where':{'id':_0x421049[_0x2dad('0x47')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0x2dad('0x48')](_0x30edd6)[_0x2dad('0x24')](handleEntityNotFound(_0x2a2630,null))[_0x2dad('0x24')](function(_0x57fbfb){if(_0x57fbfb){if(!_[_0x2dad('0x70')](_0x57fbfb[_0x2dad('0x7a')])){if(fs[_0x2dad('0x71')](path['join'](config[_0x2dad('0x6d')],_0x2dad('0x75'),_0x57fbfb[_0x2dad('0x7a')]))){_0xa922f1=path['join'](config['root'],_0x2dad('0x75'),_0x57fbfb[_0x2dad('0x7a')]);}}return _0x2a2630[_0x2dad('0x73')](_0xa922f1);}})[_0x2dad('0x1b')](handleError(_0x2a2630,null));};exports[_0x2dad('0x7b')]=function(_0x2fff58,_0x5539de){var _0x7e4162=require(_0x2dad('0x7c'));var _0x305ad0=new _0x7e4162();var _0x3a7269=_0x305ad0[_0x2dad('0x7d')](_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x7f')])[_0x2dad('0x80')]();var _0x570d57={'body':_0x2fff58[_0x2dad('0x4a')],'channel':'chat'};var _0x3cce2e=[];var _0x3f5eac=[];var _0x4c3f9a={};var _0x52b83d=![];return db[_0x2dad('0x81')][_0x2dad('0x54')]()[_0x2dad('0x24')](function(_0x27bd16){if(!_0x27bd16){throw new db[(_0x2dad('0x82'))][(_0x2dad('0x83'))]('no\x20available\x20attributes');}_0x3cce2e=_[_0x2dad('0x84')](_[_0x2dad('0x35')](_0x27bd16),[_0x2dad('0x85'),_0x2dad('0x86')]);_0x3f5eac=_['difference'](_[_0x2dad('0x35')](_0x27bd16),[_0x2dad('0x85'),_0x2dad('0x86'),_0x2dad('0x87'),'ListId']);if(_0x2fff58[_0x2dad('0x4a')]['id']){delete _0x2fff58[_0x2dad('0x4a')]['id'];}if(_[_0x2dad('0x70')](_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x88')])){throw new db[(_0x2dad('0x82'))][(_0x2dad('0x83'))]('from\x20is\x20mandatory');}if(_[_0x2dad('0x70')](_0x2fff58[_0x2dad('0x4a')]['body'])||_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x4a')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x89')])){throw new db[(_0x2dad('0x82'))][(_0x2dad('0x83'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f5eac);}if(!_[_0x2dad('0x8a')](_0x3f5eac,_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x89')])){throw new db[(_0x2dad('0x82'))][(_0x2dad('0x83'))](_0x2dad('0x8b')+_0x3f5eac);}_0x4c3f9a[_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x89')]]=_0x2fff58[_0x2dad('0x4a')]['from'];})[_0x2dad('0x24')](function(){return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x2fff58[_0x2dad('0x47')]['id']},'include':[{'model':db['CmList'],'as':_0x2dad('0x8c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4c3f9a,'limit':0x1,'order':[[_0x2dad('0x86'),_0x2dad('0x8d')]]}]},{'model':db[_0x2dad('0x8e')],'as':_0x2dad('0x8f')}]});})[_0x2dad('0x24')](handleEntityNotFound(_0x5539de,null))[_0x2dad('0x24')](function(_0x4f2851){if(_0x4f2851&&_0x4f2851[_0x2dad('0x8c')]){_0x570d57[_0x2dad('0x90')]=_0x4f2851;_0x570d57[_0x2dad('0x91')]=_0x4f2851[_0x2dad('0x8f')];_0x570d57['list']=_0x4f2851['List'];_0x570d57[_0x2dad('0x91')]=_[_0x2dad('0x92')](_0x570d57[_0x2dad('0x91')],['priority'],[_0x2dad('0x93')]);if(_0x570d57[_0x2dad('0x90')]['Applications']){delete _0x570d57[_0x2dad('0x90')][_0x2dad('0x8f')];}if(_0x570d57['account']['List']&&_0x570d57['account'][_0x2dad('0x8c')][_0x2dad('0x94')]['length']){return _0x570d57[_0x2dad('0x90')][_0x2dad('0x8c')][_0x2dad('0x94')][0x0];}var _0x3b6e0f=_[_0x2dad('0x95')](_0x2fff58[_0x2dad('0x4a')],{'firstName':_0x2fff58['body']['from'],'ListId':_0x4f2851[_0x2dad('0x96')]});_0x3b6e0f[_0x2fff58[_0x2dad('0x4a')]['mapKey']]=_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x88')];return db[_0x2dad('0x81')]['create'](_0x3b6e0f,{'fields':_0x3cce2e,'raw':!![]});}})[_0x2dad('0x24')](handleEntityNotFound(_0x5539de,null))[_0x2dad('0x24')](function(_0x500541){_0x570d57['contact']=_0x500541;var _0xe7fc9d=_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x97')];if(_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x98')]){_0xe7fc9d=_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x98')];}else if(_0x2fff58[_0x2dad('0x7e')]['x-forwarded-for']){_0xe7fc9d=_[_0x2dad('0x99')](_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x9a')][_0x2dad('0x9b')](','));}if(_0x500541){var _0x2d6665={'ContactId':_0x500541['id'],'ChatWebsiteId':_0x2fff58[_0x2dad('0x47')]['id'],'from':(_0x500541[_0x2dad('0x9c')]||'')+'\x20'+(_0x500541[_0x2dad('0x9d')]||''),'customerIp':_0xe7fc9d,'customerPort':_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x9e')]?_0x2fff58[_0x2dad('0x7e')][_0x2dad('0x9e')]:null,'referer':_0x2fff58[_0x2dad('0x4a')]['referer'],'browserName':_0x3a7269[_0x2dad('0x9f')][_0x2dad('0x2a')]&&_0x3a7269[_0x2dad('0x9f')]['version']?util[_0x2dad('0xa0')](_0x2dad('0xa1'),_0x3a7269[_0x2dad('0x9f')][_0x2dad('0x2a')],_0x3a7269[_0x2dad('0x9f')][_0x2dad('0xa2')]):_0x2dad('0xa3'),'browserVersion':_0x3a7269[_0x2dad('0x9f')][_0x2dad('0xa2')]||_0x2dad('0xa3'),'osName':util[_0x2dad('0xa0')](_0x2dad('0xa1'),_0x3a7269['os']['name'],_0x3a7269['os'][_0x2dad('0xa2')]),'osVersion':_0x3a7269['os'][_0x2dad('0xa2')],'deviceModel':_0x3a7269[_0x2dad('0xa4')]['model']&&_0x3a7269[_0x2dad('0xa4')][_0x2dad('0xa5')]?util['format'](_0x2dad('0xa6'),_0x3a7269[_0x2dad('0xa4')][_0x2dad('0x33')],_0x3a7269[_0x2dad('0xa4')][_0x2dad('0xa5')],_0x3a7269[_0x2dad('0xa4')][_0x2dad('0x40')]):null,'deviceVendor':_0x3a7269[_0x2dad('0xa4')][_0x2dad('0xa5')],'deviceType':_0x3a7269['device'][_0x2dad('0x40')],'formData':JSON[_0x2dad('0x17')](_0x2fff58[_0x2dad('0x4a')])};var _0x498509={'ChatWebsiteId':_0x2fff58[_0x2dad('0x47')]['id'],'closed':![]};if(_0x2fff58['body']['threadId']){_0x498509['threadId']=_0x2fff58[_0x2dad('0x4a')][_0x2dad('0xa7')];return db['ChatInteraction'][_0x2dad('0x48')]({'where':_0x498509})[_0x2dad('0x24')](function(_0x12778a){if(_0x12778a){return[_0x12778a,![]];}_0x2d6665[_0x2dad('0xa7')]=_0x2fff58[_0x2dad('0x4a')][_0x2dad('0xa7')];_0x2d6665[_0x2dad('0xa8')]=_0x2fff58['body'][_0x2dad('0xa8')];return db[_0x2dad('0xa9')][_0x2dad('0x49')](_0x2d6665)[_0x2dad('0x24')](function(_0x3d38c0){return[_0x3d38c0,!![]];});});}_0x498509[_0x2dad('0xaa')]=_0x500541['id'];if(_0x2fff58['body'][_0x2dad('0xab')]&&_0x2fff58[_0x2dad('0x4a')][_0x2dad('0xab')]['id']){_0x498509['id']=_0x2fff58[_0x2dad('0x4a')]['interaction']['id'];return db[_0x2dad('0xa9')]['find']({'where':_0x498509})[_0x2dad('0x24')](function(_0x16111c){if(_0x16111c){return[_0x16111c,![]];}return db[_0x2dad('0xa9')]['create'](_0x2d6665)[_0x2dad('0x24')](function(_0x34ed11){return[_0x34ed11,!![]];});});}return db[_0x2dad('0xa9')][_0x2dad('0x49')](_0x2d6665)[_0x2dad('0x24')](function(_0x55efa6){return[_0x55efa6,!![]];});}})[_0x2dad('0xac')](function(_0xa71cd1,_0x3a5864){if(_0xa71cd1){_0x52b83d=_0x3a5864;if(!_0x3a5864){var _0x1ca184={'from':(_0x570d57[_0x2dad('0xad')]['firstName']||'')+'\x20'+(_0x570d57[_0x2dad('0xad')][_0x2dad('0x9d')]||'')};if(_0x2fff58['body'][_0x2dad('0xa7')]&&_0x2fff58['body']['messageId']&&_0x2fff58[_0x2dad('0x4a')]['threadId']!=_0x2fff58['body'][_0x2dad('0xae')]){_0x1ca184[_0x2dad('0xa7')]=_0x2fff58['body'][_0x2dad('0xae')];}return _0xa71cd1[_0x2dad('0x53')](_0x1ca184);}else{return _0xa71cd1;}}})[_0x2dad('0x24')](function(_0x3a4927){_0x570d57[_0x2dad('0xab')]=_0x3a4927[_0x2dad('0x25')]({'plain':!![]});_0x570d57[_0x2dad('0xab')][_0x2dad('0xaf')]=_0x52b83d;if(_0x570d57[_0x2dad('0xab')][_0x2dad('0xaf')]){if(_0x570d57[_0x2dad('0x90')][_0x2dad('0xb0')]){_0x570d57[_0x2dad('0x91')][_0x2dad('0xb1')]({'id':0x0,'priority':_0x570d57['applications'][_0x2dad('0x3a')]+0x1,'app':_0x2dad('0xb2'),'appdata':_0x2dad('0xb3'),'interval':_0x2dad('0xb4')});}}return db[_0x2dad('0xb5')][_0x2dad('0x49')]({'body':_0x2fff58[_0x2dad('0x4a')][_0x2dad('0x4a')],'ChatWebsiteId':_0x2fff58[_0x2dad('0x47')]['id'],'ChatInteractionId':_0x3a4927['id'],'direction':'in','ContactId':_0x570d57[_0x2dad('0xad')]['id'],'AttachmentId':_0x2fff58[_0x2dad('0x4a')][_0x2dad('0xb6')]});})[_0x2dad('0x24')](function(_0x4a40c9){_0x570d57[_0x2dad('0x19')]=_0x4a40c9;if(_0x570d57[_0x2dad('0xab')][_0x2dad('0xb7')]){return db[_0x2dad('0xb8')][_0x2dad('0x48')]({'attributes':['id',_0x2dad('0x2a')],'where':{'id':_0x570d57['interaction'][_0x2dad('0xb7')]}})[_0x2dad('0x24')](function(_0x5f05fc){if(_0x5f05fc){_0x570d57['applications'][_0x2dad('0xb9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f05fc['name']+','+(_0x570d57[_0x2dad('0x90')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x570d57[_0x2dad('0xba')]=!![];}return respondWithRpcPromise(_0x2dad('0xbb'),'startRouting',_0x570d57);});}return respondWithRpcPromise(_0x2dad('0xbb'),_0x2dad('0xbc'),_0x570d57);})['then'](function(_0x133e1a){respondWithRpcPromise(_0x2dad('0xbd'),_0x2dad('0xbd'),{'event':_0x2dad('0x7b'),'message':_0x133e1a},client9002);return _0x133e1a;})[_0x2dad('0x24')](respondWithResult(_0x5539de,null))[_0x2dad('0x1b')](handleError(_0x5539de,null));};exports[_0x2dad('0xbe')]=function(_0x457de8,_0x3247b6){var _0xe0b971,_0x4a793f,_0x786a1b;var _0x5547cc=[];var _0x116c34={};var _0x4dfe60=_0x457de8['files']||[];var _0x2d36d8=[];var _0x340df9;return db[_0x2dad('0x81')][_0x2dad('0x54')]()[_0x2dad('0x24')](function(_0x3ee3e6){if(!_0x3ee3e6){throw new db[(_0x2dad('0x82'))][(_0x2dad('0x83'))](_0x2dad('0xbf'));}_0x5547cc=_[_0x2dad('0x84')](_['keys'](_0x3ee3e6),[_0x2dad('0x85'),'updatedAt','CompanyId',_0x2dad('0x96')]);if(_0x457de8['body']['id']){delete _0x457de8[_0x2dad('0x4a')]['id'];}if(_['isNil'](_0x457de8[_0x2dad('0x4a')][_0x2dad('0x88')])){throw _0x3247b6[_0x2dad('0x1d')](0x1f4)[_0x2dad('0x2b')](new db['Sequelize'][(_0x2dad('0x83'))](_0x2dad('0xc0')));}if(_[_0x2dad('0x70')](_0x457de8[_0x2dad('0x4a')][_0x2dad('0x4a')])||_0x457de8['body']['body']===''){throw _0x3247b6[_0x2dad('0x1d')](0x1f4)['send'](new db['Sequelize'][(_0x2dad('0x83'))](_0x2dad('0xc1')));}if(_[_0x2dad('0x70')](_0x457de8[_0x2dad('0x4a')][_0x2dad('0xc2')])){throw _0x3247b6[_0x2dad('0x1d')](0x1f4)[_0x2dad('0x2b')](new db[(_0x2dad('0x82'))]['ValidationError'](_0x2dad('0xc3')+_0x5547cc));}if(!_[_0x2dad('0x8a')](_0x5547cc,_0x457de8['body']['mapKeyOffline'])){throw _0x3247b6[_0x2dad('0x1d')](0x1f4)['send'](new db[(_0x2dad('0x82'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5547cc));}_0x116c34[_0x457de8['body'][_0x2dad('0xc2')]]=_0x457de8[_0x2dad('0x4a')][_0x2dad('0x88')];})[_0x2dad('0x24')](function(){return db[_0x2dad('0x30')][_0x2dad('0x48')]({'where':{'id':_0x457de8[_0x2dad('0x47')]['id']},'include':[{'model':db[_0x2dad('0xc4')],'as':'List'},{'model':db['MailAccount'],'as':_0x2dad('0xc5')}]});})['then'](handleEntityNotFound(_0x3247b6,null))[_0x2dad('0x24')](function(_0x518da2){if(_0x518da2&&_0x518da2[_0x2dad('0x8c')]){_0x4a793f=_0x518da2;var _0x8b00aa=_[_0x2dad('0x95')](_0x457de8[_0x2dad('0x4a')],{'firstName':_0x457de8[_0x2dad('0x4a')][_0x2dad('0x88')],'phone':_0x457de8[_0x2dad('0x4a')]['from'],'ListId':_0x518da2[_0x2dad('0x96')]});_0x8b00aa[_0x457de8[_0x2dad('0x4a')][_0x2dad('0xc2')]]=_0x457de8[_0x2dad('0x4a')][_0x2dad('0x88')];return db[_0x2dad('0x81')]['findOrCreate']({'where':_0x116c34,'defaults':_0x8b00aa});}})[_0x2dad('0xac')](function(_0x95de1e){if(_0x95de1e){_0x786a1b=_0x95de1e;var _0x13ce09=fs[_0x2dad('0xc6')](path[_0x2dad('0x6c')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x398aa5=ejs[_0x2dad('0xc7')](_0x13ce09,{'body':_[_0x2dad('0xc8')](_0x457de8[_0x2dad('0x4a')]['body']),'bodyTitle':_0x4a793f[_0x2dad('0xc9')]});return db[_0x2dad('0xca')][_0x2dad('0x49')]({'body':_0x398aa5,'plainBody':htmlToText[_0x2dad('0xcb')](_0x398aa5),'ContactId':_0x95de1e['id'],'ChatWebsiteId':_0x4a793f['id']});}})['then'](function(_0x3788b1){_0x340df9=_0x3788b1;if(_0x4dfe60['length']){var _0xc4be02=_0x4dfe60[_0x2dad('0x2f')](function(_0x5da6c8){return{'name':_0x5da6c8[_0x2dad('0xcc')],'basename':_0x5da6c8[_0x2dad('0x66')],'type':_0x5da6c8['mimetype'],'ChatOfflineMessageId':_0x3788b1['id']};});_0x2d36d8=_0xc4be02[_0x2dad('0x2f')](_0x167a19=>{var _0x129800={'filename':_0x167a19['name'],'path':path[_0x2dad('0x6c')](config['root'],'server','files',_0x2dad('0xcd'),'offline-chat',_0x167a19[_0x2dad('0xce')])};return _0x129800;});if(!_0x4a793f[_0x2dad('0xcf')]){return db[_0x2dad('0xd0')][_0x2dad('0xd1')](function(_0xd4c91f){return db[_0x2dad('0xd2')][_0x2dad('0xd3')](_0xc4be02,{'transaction':_0xd4c91f});});}}})[_0x2dad('0x24')](function(){if(_0x340df9){_0xe0b971=_0x340df9;return db[_0x2dad('0xc5')][_0x2dad('0x58')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2dad('0xd4'),'raw':!![]}]});}})[_0x2dad('0x24')](function(_0x1e5448){if(_0x1e5448&&_0x1e5448[_0x2dad('0xd4')]&&_0x4a793f[_0x2dad('0xd5')]&&_0x4a793f[_0x2dad('0xd6')]){var _0x144690={'tls':{'rejectUnauthorized':![]}};if(_0x1e5448['Smtp'][_0x2dad('0xd7')]){_0x144690['service']=_0x1e5448['Smtp'][_0x2dad('0xd7')];}else{_0x144690['host']=_0x1e5448[_0x2dad('0xd4')][_0x2dad('0xd8')];_0x144690['port']=_0x1e5448[_0x2dad('0xd4')][_0x2dad('0xd9')];_0x144690[_0x2dad('0xda')]=_0x1e5448[_0x2dad('0xd4')]['secure'];}if(_0x1e5448['Smtp'][_0x2dad('0xdb')]){_0x144690[_0x2dad('0xdc')]={'user':_0x1e5448[_0x2dad('0xd4')][_0x2dad('0x4b')],'pass':_0x1e5448[_0x2dad('0xd4')][_0x2dad('0xdd')]};}return respondWithRpcPromise('SendMail',_0x2dad('0xde'),{'account':_0x144690,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1e5448[_0x2dad('0x2a')],_0x1e5448['email']||_0x1e5448[_0x2dad('0xd4')][_0x2dad('0x4b')]),'to':_0x4a793f[_0x2dad('0xd6')],'subject':_0x4a793f[_0x2dad('0xdf')],'html':_0xe0b971['body'],'attachments':_0x2d36d8}},client9003)[_0x2dad('0x24')](function(){return _0xe0b971;})[_0x2dad('0x1b')](function(_0x2992fd){console['error'](_0x2992fd);});}})[_0x2dad('0x24')](function(){if(_0x4a793f&&_0x4a793f[_0x2dad('0xcf')]&&_0x4a793f[_0x2dad('0xe0')]){var _0x567b1d=[];if(_0x4dfe60[_0x2dad('0x3a')]){_0x567b1d=_0x4dfe60['map'](function(_0x4ef775){return{'name':_0x4ef775[_0x2dad('0xcc')],'basename':_0x4ef775['filename'],'type':_0x4ef775[_0x2dad('0xe1')],'ChatOfflineMessageId':_0x340df9['id']};});}var _0x3a0bd1;if(!_[_0x2dad('0x70')](_0x4a793f[_0x2dad('0xe2')])){var _0x3ee87f=_[_0x2dad('0x2f')](_0x457de8[_0x2dad('0x4a')],function(_0x38fd9b){return _0x38fd9b;});var _0x33f9f8=_[_0x2dad('0xe3')](_0x3ee87f)[0x0];var _0x498f64=_['mapValues'](_0x33f9f8,function(_0x15e1e2){return _0x15e1e2;});_0x3a0bd1=_0x498f64[0x1][_0x4a793f[_0x2dad('0xe2')]];}var _0x4163c9={'from':_0x786a1b[_0x2dad('0xe4')],'firstName':_0x786a1b[_0x2dad('0x9c')],'lastName':_0x786a1b['lastName'],'mapKey':_0x2dad('0xe4'),'message':{'from':_0x786a1b[_0x2dad('0xe4')],'to':_0x4a793f[_0x2dad('0xc5')][_0x2dad('0xe4')],'cc':'','subject':_['isNil'](_0x3a0bd1)?_0x4a793f['offlineMessageSubject']:_0x3a0bd1,'messageId':'','sentAt':new Date(),'attach':_0x567b1d['length'],'attachments':_0x567b1d,'originChannel':_0x2dad('0xe5'),'ChatWebsiteId':_0x4a793f['id'],'ChatOfflineMessageId':_0xe0b971['id'],'originTo':_0x4a793f['MailAccount']['email']},'body':_0xe0b971[_0x2dad('0x4a')]};var _0x8d8f9b={'account':{'id':_0x4a793f[_0x2dad('0xe0')]},'body':_0x4163c9,'log':_0x2dad('0xe6')};return respondWithRpcPromise(_0x2dad('0xe6'),_0x2dad('0xe7'),_0x8d8f9b,client9001)[_0x2dad('0x24')](function(){return _0xe0b971;})[_0x2dad('0x1b')](function(_0x546130){console[_0x2dad('0x18')](_0x546130);});}return;})['then'](function(){if(_0xe0b971){return _0xe0b971;}})['then'](respondWithResult(_0x3247b6,null))['catch'](function(_0x5629c3){console[_0x2dad('0x18')]('catch',_0x5629c3);for(var _0xc9eafa of _0x4dfe60){var _0x5c5137=path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0xe8'),_0x2dad('0xe9'),_0x2dad('0xcd'),_0x2dad('0xea'),_0xc9eafa[_0x2dad('0x66')]);fs_extra[_0x2dad('0xeb')](_0x5c5137)[_0x2dad('0x1b')](function(_0x1a3471){console[_0x2dad('0x18')](_0x2dad('0xec'),_0x5c5137,_0x1a3471);});}});};exports[_0x2dad('0xed')]=function(_0x1abba6,_0x5506ee){return db['ChatInteraction'][_0x2dad('0x48')]({'where':{'id':_0x1abba6[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x5506ee,null))[_0x2dad('0x24')](function(_0x40fd89){if(_0x40fd89){return _0x40fd89[_0x2dad('0xed')](_0x1abba6['body'][_0x2dad('0x5d')],_['omit'](_0x1abba6[_0x2dad('0x4a')],[_0x2dad('0x5d'),'id'])||{});}})[_0x2dad('0x24')](respondWithResult(_0x5506ee,null))[_0x2dad('0x1b')](handleError(_0x5506ee,null));};exports['getInteractions']=function(_0x1b9bca,_0x579f66){var _0x2774f8={'raw':![],'where':{}};var _0xcb3818={};var _0x1265cb={'count':0x0,'rows':[]};return db[_0x2dad('0x30')]['findOne']({'where':{'id':_0x1b9bca[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x579f66,null))[_0x2dad('0x24')](function(_0x3385ce){if(_0x3385ce){_0xcb3818[_0x2dad('0x33')]=_[_0x2dad('0x35')](db[_0x2dad('0xa9')][_0x2dad('0x31')]);_0xcb3818[_0x2dad('0x34')]=_[_0x2dad('0x35')](_0x1b9bca[_0x2dad('0x34')]);_0xcb3818[_0x2dad('0x36')]=_[_0x2dad('0x37')](_0xcb3818['model'],_0xcb3818['query']);_0x2774f8[_0x2dad('0x38')]=_[_0x2dad('0x37')](_0xcb3818[_0x2dad('0x33')],qs[_0x2dad('0x39')](_0x1b9bca['query'][_0x2dad('0x39')]));_0x2774f8[_0x2dad('0x38')]=_0x2774f8[_0x2dad('0x38')][_0x2dad('0x3a')]?_0x2774f8[_0x2dad('0x38')]:_0xcb3818['model'];if(!_0x1b9bca[_0x2dad('0x34')][_0x2dad('0x3b')](_0x2dad('0x59'))){_0x2774f8['limit']=qs[_0x2dad('0x20')](_0x1b9bca[_0x2dad('0x34')][_0x2dad('0x20')]);_0x2774f8[_0x2dad('0x22')]=qs['offset'](_0x1b9bca[_0x2dad('0x34')][_0x2dad('0x22')]);}_0x2774f8[_0x2dad('0x3c')]=qs[_0x2dad('0x5a')](_0x1b9bca[_0x2dad('0x34')]['sort']);_0x2774f8[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_['pick'](_0x1b9bca[_0x2dad('0x34')],_0xcb3818['filters']));_0x2774f8[_0x2dad('0x3d')][_0x2dad('0x56')]=_0x3385ce['id'];if(_0x1b9bca[_0x2dad('0x34')]['filter']){_0x2774f8[_0x2dad('0x3d')]=_[_0x2dad('0x41')](_0x2774f8['where'],{'$or':_[_0x2dad('0x2f')](_0x2774f8['attributes'],function(_0x583d64){var _0x47f9a0={};_0x47f9a0[_0x583d64]={'$like':'%'+_0x1b9bca['query'][_0x2dad('0x3f')]+'%'};return _0x47f9a0;})});}_0x2774f8=_['merge']({},_0x2774f8,_0x1b9bca[_0x2dad('0x42')]);return db[_0x2dad('0xa9')]['count']({'where':_0x2774f8[_0x2dad('0x3d')]})['then'](function(_0x27c340){_0x1265cb[_0x2dad('0x21')]=_0x27c340;if(_0x1b9bca[_0x2dad('0x34')][_0x2dad('0x43')]){_0x2774f8[_0x2dad('0x44')]=[{'model':db[_0x2dad('0x81')],'as':_0x2dad('0xee'),'required':![]},{'model':db['User'],'as':_0x2dad('0xef'),'attributes':['name',_0x2dad('0xf0'),_0x2dad('0xf1')],'required':![]},{'model':db[_0x2dad('0xf2')],'as':_0x2dad('0xf3'),'attributes':['id',_0x2dad('0x2a'),'color'],'where':_0x1b9bca[_0x2dad('0x34')]['tag']?{'id':_0x1b9bca[_0x2dad('0x34')][_0x2dad('0xf4')]}:undefined,'required':_0x1b9bca[_0x2dad('0x34')][_0x2dad('0xf4')]?!![]:![]}];}return db['ChatInteraction'][_0x2dad('0x45')](_0x2774f8);})['then'](function(_0x16732e){_0x1265cb[_0x2dad('0x61')]=_0x16732e;return _0x1265cb;});}})[_0x2dad('0x24')](respondWithFilteredResult(_0x579f66,_0x2774f8))[_0x2dad('0x1b')](handleError(_0x579f66,null));};function iftimePromise(_0x5a83c3,_0x14afe8){return respondWithRpcPromise(_0x2dad('0xf5'),_0x2dad('0xf6'),{'command':_0x14afe8['timezone']?util[_0x2dad('0xa0')](_0x2dad('0xf7'),_0x5a83c3[_0x2dad('0xf8')],_0x14afe8[_0x2dad('0xf9')]):util[_0x2dad('0xa0')](_0x2dad('0xfa'),_0x5a83c3[_0x2dad('0xf8')])},client9002)[_0x2dad('0x24')](function(_0x5ca7e4){var _0x4f1487=_0x5ca7e4&&_0x5ca7e4[_0x2dad('0xfb')](_0x2dad('0xfc'))>=0x0?!![]:![];logger[_0x2dad('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14afe8['id'],_0x5a83c3['id'],_0x5a83c3[_0x2dad('0xf8')],_0x4f1487?_0x2dad('0xfd'):_0x2dad('0xfe'),_0x14afe8[_0x2dad('0xf9')]?_0x14afe8[_0x2dad('0xf9')]:_0x2dad('0xff'));return _0x4f1487;})[_0x2dad('0x1b')](function(_0x6cdfe1){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14afe8['id'],_0x5a83c3['id'],_0x5a83c3[_0x2dad('0xf8')],util['inspect'](_0x6cdfe1,{'showHidden':![],'depth':null}),_0x14afe8[_0x2dad('0xf9')]?_0x14afe8['timezone']:_0x2dad('0xff'));return![];});}exports[_0x2dad('0xf6')]=function(_0x1a1a7d,_0x47c78b){var _0x261ce8=0x0;var _0x4cf6fd=0x0;var _0x515920=![];var _0x329b4b;var _0x1bdbcb;return db['ChatWebsite'][_0x2dad('0x48')]({'where':{'id':_0x1a1a7d[_0x2dad('0x47')]['id']},'include':[{'model':db[_0x2dad('0x100')],'as':_0x2dad('0x100'),'include':[{'model':db['Interval'],'as':_0x2dad('0x101'),'attributes':['id',_0x2dad('0xf8')],'raw':!![]}]}]})[_0x2dad('0x24')](handleEntityNotFound(_0x47c78b,null))[_0x2dad('0x24')](function(_0x3e53be){if(_0x3e53be){_0x329b4b=_0x3e53be;return _0x3e53be[_0x2dad('0x102')]({'raw':!![]});}})[_0x2dad('0x24')](function(_0x51e32b){if(_0x329b4b){if(_0x51e32b){_0x1bdbcb=_0x51e32b;}}return require(_0x2dad('0x103'))[_0x2dad('0x6f')]();})['then'](function(_0x5b9689){if(_0x5b9689){_0x4cf6fd=_0x5b9689[_0x2dad('0x104')];_0x515920=_0x5b9689['custom'];}})[_0x2dad('0x24')](function(){return db['ChatInteraction'][_0x2dad('0x21')]({'where':{'closed':![]}});})[_0x2dad('0x24')](function(_0x58bff3){_0x261ce8=_0x58bff3;if(_0x4cf6fd&&_0x58bff3>_0x4cf6fd){return db['License'][_0x2dad('0x58')]({'where':{'id':0x1}})['then'](function(_0x1c97fe){if(_0x1c97fe){_0x1c97fe[_0x2dad('0x105')](_0x2dad('0x106'));}});}})[_0x2dad('0x24')](function(){if(_0x329b4b['Interval']&&_0x329b4b[_0x2dad('0x100')]['Intervals']){var _0x32b9b1=[];for(var _0x134c79=0x0;_0x134c79<_0x329b4b[_0x2dad('0x100')][_0x2dad('0x101')][_0x2dad('0x3a')];_0x134c79++){var _0xc1ff0e=_0x329b4b[_0x2dad('0x100')][_0x2dad('0x101')][_0x134c79][_0x2dad('0x25')]({'plain':!![]});_0x32b9b1['push'](iftimePromise(_0xc1ff0e,_0x329b4b));}return BPromise['all'](_0x32b9b1)['then'](function(_0x24700e){return _['some'](_0x24700e);});}else{return!![];}})['then'](function(_0x121bea){var _0x108479=fs[_0x2dad('0xc6')](path[_0x2dad('0x6c')](config[_0x2dad('0x6d')],_0x2dad('0x107')),_0x2dad('0x108'));var _0x3c7188={'remote':_0x329b4b[_0x2dad('0x109')],'query':querystring[_0x2dad('0x17')](_[_0x2dad('0x41')](_0x329b4b[_0x2dad('0x25')]({'plain':!![]}),{'customerIp':_0x1a1a7d[_0x2dad('0x7e')]['x-forwarded-for']||_0x1a1a7d[_0x2dad('0x7e')][_0x2dad('0x10a')]||_0x1a1a7d[_0x2dad('0x10b')][_0x2dad('0x10c')]||_0x1a1a7d['ip'],'referer':_0x1a1a7d['headers']['referer'],'openedInteractions':_0x261ce8,'maxInteractions':_0x4cf6fd,'virtual':_0x515920[_0x2dad('0x104')],'online':_0x121bea,'custom':_0x515920}))[_0x2dad('0x10d')](/'/g,'\x5c\x27')};_0x47c78b[_0x2dad('0x2b')](ejs['render'](Mustache[_0x2dad('0xc7')](_0x108479,_0x3c7188),{'proactiveActions':_0x1bdbcb,'alignment':_0x329b4b[_0x2dad('0x10e')],'verticalAlignment':_0x329b4b['verticalAlignment'],'div_color':_0x329b4b[_0x2dad('0x10f')],'labelText':_0x329b4b[_0x2dad('0x110')],'text_color':_0x329b4b[_0x2dad('0x111')],'button_color':_0x329b4b[_0x2dad('0x112')],'background_color':_0x329b4b[_0x2dad('0x113')],'hideWhenOffline':_0x329b4b[_0x2dad('0x114')],'interval':_0x329b4b[_0x2dad('0x115')]}));})['catch'](handleError(_0x47c78b,null));};exports['addApplications']=function(_0x295eaa,_0x2977ff){var _0x210bb8=_0x295eaa[_0x2dad('0x47')]['id'];var _0x4a505c=_0x295eaa[_0x2dad('0x4a')];var _0x347dfd=0xc8;var _0x3987b7=null;return db[_0x2dad('0xd0')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x2dad('0x116')]['READ_COMMITTED']},function(_0x4ec03f){return db['ChatWebsite'][_0x2dad('0x58')]({'where':{'id':_0x210bb8},'transaction':_0x4ec03f})[_0x2dad('0x24')](function(_0x5b07df){if(_0x5b07df){return db[_0x2dad('0x8e')]['destroy']({'where':{'ChatWebsiteId':_0x210bb8},'transaction':_0x4ec03f})['then'](function(){var _0x1ca70f=_[_0x2dad('0x2f')](_0x4a505c,function(_0x38c50b){_0x38c50b[_0x2dad('0x56')]=_0x210bb8;return _0x38c50b;});return db['ChatApplication'][_0x2dad('0xd3')](_0x1ca70f,{'transaction':_0x4ec03f});});}else{_0x347dfd=0x194;_0x3987b7=[];}});})[_0x2dad('0x24')](function(){if(_0x347dfd!==0x194){return db[_0x2dad('0x8e')][_0x2dad('0x117')]({'where':{'ChatWebsiteId':_0x210bb8},'order':_0x2dad('0x118')})['then'](function(_0x440648){_0x3987b7=_0x440648;});}})[_0x2dad('0x1b')](function(_0x20701d){_0x347dfd=0x1f4;logger['error'](_0x20701d[_0x2dad('0x29')]);if(_0x20701d[_0x2dad('0x2a')]){delete _0x20701d[_0x2dad('0x2a')];}_0x3987b7=_0x20701d;})[_0x2dad('0x119')](function(){if(_0x3987b7===null){_0x2977ff[_0x2dad('0x1c')](_0x347dfd);}else{if(_0x347dfd===0x1f4){_0x2977ff['status'](_0x347dfd)[_0x2dad('0x2b')](_0x3987b7);}else{_0x2977ff['status'](_0x347dfd)[_0x2dad('0x1e')](_0x3987b7);}}});};exports[_0x2dad('0x11a')]=function(_0x14673f,_0x384666){var _0x5549f2={};var _0x19687b={};var _0x2dabe5;var _0x3c75a8;return db[_0x2dad('0x30')][_0x2dad('0x58')]({'where':{'id':_0x14673f['params']['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x384666,null))[_0x2dad('0x24')](function(_0x12a662){if(_0x12a662){_0x2dabe5=_0x12a662;_0x19687b[_0x2dad('0x33')]=_[_0x2dad('0x35')](db['ChatApplication'][_0x2dad('0x31')]);_0x19687b[_0x2dad('0x34')]=_[_0x2dad('0x35')](_0x14673f[_0x2dad('0x34')]);_0x19687b[_0x2dad('0x36')]=_[_0x2dad('0x37')](_0x19687b[_0x2dad('0x33')],_0x19687b['query']);_0x5549f2['attributes']=_[_0x2dad('0x37')](_0x19687b[_0x2dad('0x33')],qs[_0x2dad('0x39')](_0x14673f['query'][_0x2dad('0x39')]));_0x5549f2[_0x2dad('0x38')]=_0x5549f2[_0x2dad('0x38')][_0x2dad('0x3a')]?_0x5549f2[_0x2dad('0x38')]:_0x19687b[_0x2dad('0x33')];_0x5549f2[_0x2dad('0x3c')]=qs[_0x2dad('0x5a')](_0x14673f[_0x2dad('0x34')][_0x2dad('0x5a')]);_0x5549f2[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_[_0x2dad('0x3e')](_0x14673f[_0x2dad('0x34')],_0x19687b[_0x2dad('0x36')]));if(_0x14673f['query']['filter']){_0x5549f2[_0x2dad('0x3d')]=_[_0x2dad('0x41')](_0x5549f2[_0x2dad('0x3d')],{'$or':_[_0x2dad('0x2f')](_0x5549f2['attributes'],function(_0x8b4865){var _0x2ad3d0={};_0x2ad3d0[_0x8b4865]={'$like':'%'+_0x14673f['query'][_0x2dad('0x3f')]+'%'};return _0x2ad3d0;})});}_0x5549f2=_[_0x2dad('0x41')]({},_0x5549f2,_0x14673f[_0x2dad('0x42')]);return _0x2dabe5[_0x2dad('0x11a')](_0x5549f2);}})[_0x2dad('0x24')](function(_0x2afba1){if(_0x2afba1){_0x3c75a8=_0x2afba1[_0x2dad('0x3a')];if(!_0x14673f[_0x2dad('0x34')]['hasOwnProperty'](_0x2dad('0x59'))){_0x5549f2[_0x2dad('0x20')]=qs[_0x2dad('0x20')](_0x14673f[_0x2dad('0x34')][_0x2dad('0x20')]);_0x5549f2['offset']=qs[_0x2dad('0x22')](_0x14673f[_0x2dad('0x34')]['offset']);}return _0x2dabe5['getApplications'](_0x5549f2);}})['then'](function(_0x250e13){if(_0x250e13){return _0x250e13?{'count':_0x3c75a8,'rows':_0x250e13}:null;}})[_0x2dad('0x24')](respondWithResult(_0x384666,null))[_0x2dad('0x1b')](handleError(_0x384666,null));};exports[_0x2dad('0x11b')]=function(_0x2b72f9,_0x3c1a16){return db[_0x2dad('0x11c')][_0x2dad('0x48')]({'where':{'id':_0x2b72f9[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x3c1a16,null))['then'](function(_0x53a684){if(_0x53a684){return _0x53a684[_0x2dad('0x11b')](_0x2b72f9[_0x2dad('0x4a')][_0x2dad('0x5d')],_['omit'](_0x2b72f9[_0x2dad('0x4a')],[_0x2dad('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x3c1a16,null))[_0x2dad('0x1b')](handleError(_0x3c1a16,null));};exports['getProactiveActions']=function(_0x519f17,_0x786d80){var _0x2bfe5a={};var _0x13a3ed={};var _0x34be66;var _0x1c06e9;return db[_0x2dad('0x30')][_0x2dad('0x58')]({'where':{'id':_0x519f17[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x786d80,null))[_0x2dad('0x24')](function(_0x4011fd){if(_0x4011fd){_0x34be66=_0x4011fd;_0x13a3ed[_0x2dad('0x33')]=_['keys'](db[_0x2dad('0x11d')][_0x2dad('0x31')]);_0x13a3ed['query']=_[_0x2dad('0x35')](_0x519f17['query']);_0x13a3ed[_0x2dad('0x36')]=_[_0x2dad('0x37')](_0x13a3ed['model'],_0x13a3ed[_0x2dad('0x34')]);_0x2bfe5a['attributes']=_[_0x2dad('0x37')](_0x13a3ed['model'],qs[_0x2dad('0x39')](_0x519f17[_0x2dad('0x34')][_0x2dad('0x39')]));_0x2bfe5a['attributes']=_0x2bfe5a['attributes'][_0x2dad('0x3a')]?_0x2bfe5a[_0x2dad('0x38')]:_0x13a3ed[_0x2dad('0x33')];_0x2bfe5a[_0x2dad('0x3c')]=qs['sort'](_0x519f17[_0x2dad('0x34')][_0x2dad('0x5a')]);_0x2bfe5a[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_['pick'](_0x519f17[_0x2dad('0x34')],_0x13a3ed[_0x2dad('0x36')]));if(_0x519f17[_0x2dad('0x34')]['filter']){_0x2bfe5a[_0x2dad('0x3d')]=_['merge'](_0x2bfe5a['where'],{'$or':_[_0x2dad('0x2f')](_0x2bfe5a['attributes'],function(_0x2ebafb){var _0x459f71={};_0x459f71[_0x2ebafb]={'$like':'%'+_0x519f17[_0x2dad('0x34')][_0x2dad('0x3f')]+'%'};return _0x459f71;})});}_0x2bfe5a=_[_0x2dad('0x41')]({},_0x2bfe5a,_0x519f17[_0x2dad('0x42')]);return _0x34be66[_0x2dad('0x102')](_0x2bfe5a);}})[_0x2dad('0x24')](function(_0x3bb493){if(_0x3bb493){_0x1c06e9=_0x3bb493['length'];if(!_0x519f17['query'][_0x2dad('0x3b')](_0x2dad('0x59'))){_0x2bfe5a['limit']=qs[_0x2dad('0x20')](_0x519f17[_0x2dad('0x34')][_0x2dad('0x20')]);_0x2bfe5a[_0x2dad('0x22')]=qs[_0x2dad('0x22')](_0x519f17[_0x2dad('0x34')]['offset']);}return _0x34be66[_0x2dad('0x102')](_0x2bfe5a);}})[_0x2dad('0x24')](function(_0x5c1688){if(_0x5c1688){return _0x5c1688?{'count':_0x1c06e9,'rows':_0x5c1688}:null;}})[_0x2dad('0x24')](respondWithResult(_0x786d80,null))[_0x2dad('0x1b')](handleError(_0x786d80,null));};exports[_0x2dad('0x11e')]=function(_0x206ddb,_0x2790db){var _0x3ff6ed=_0x206ddb['query'][_0x2dad('0x11f')]==='false'?_0x2dad('0x120'):'onlineForm';return db[_0x2dad('0x30')][_0x2dad('0x48')]({'attributes':['id',_0x3ff6ed],'where':{'id':_0x206ddb[_0x2dad('0x47')]['id']}})[_0x2dad('0x24')](handleEntityNotFound(_0x2790db,null))['then'](function(_0x50c789){if(_0x50c789){var _0x24d5de=_0x50c789[_0x3ff6ed];var _0x23041a=_0x24d5de&&_0x24d5de[_0x2dad('0x121')]?_0x24d5de[_0x2dad('0x121')]:[];_0x2790db[_0x2dad('0x2b')]({'fromKey':_[_0x2dad('0x70')](_0x24d5de[_0x2dad('0x122')])?undefined:_0x24d5de[_0x2dad('0x122')],'count':_0x23041a['length'],'rows':_0x23041a});}})[_0x2dad('0x1b')](handleError(_0x2790db,null));};exports[_0x2dad('0x123')]=function(_0x38d947,_0x1dc20a){var _0x1f5230={'raw':![],'where':{}};var _0x41b0b1={};var _0x14498d={'count':0x0,'rows':[]};return db[_0x2dad('0x30')][_0x2dad('0x58')]({'where':{'id':_0x38d947[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1dc20a,null))['then'](function(_0x1aa251){if(_0x1aa251){_0x41b0b1[_0x2dad('0x33')]=_[_0x2dad('0x35')](db[_0x2dad('0xca')]['rawAttributes']);_0x41b0b1[_0x2dad('0x34')]=_['keys'](_0x38d947[_0x2dad('0x34')]);_0x41b0b1[_0x2dad('0x36')]=_[_0x2dad('0x37')](_0x41b0b1[_0x2dad('0x33')],_0x41b0b1[_0x2dad('0x34')]);_0x1f5230[_0x2dad('0x38')]=_[_0x2dad('0x37')](_0x41b0b1[_0x2dad('0x33')],qs[_0x2dad('0x39')](_0x38d947[_0x2dad('0x34')][_0x2dad('0x39')]));_0x1f5230[_0x2dad('0x38')]=_0x1f5230[_0x2dad('0x38')]['length']?_0x1f5230[_0x2dad('0x38')]:_0x41b0b1[_0x2dad('0x33')];if(!_0x38d947['query'][_0x2dad('0x3b')](_0x2dad('0x59'))){_0x1f5230['limit']=qs[_0x2dad('0x20')](_0x38d947[_0x2dad('0x34')][_0x2dad('0x20')]);_0x1f5230[_0x2dad('0x22')]=qs[_0x2dad('0x22')](_0x38d947[_0x2dad('0x34')][_0x2dad('0x22')]);}_0x1f5230[_0x2dad('0x3c')]=qs[_0x2dad('0x5a')](_0x38d947['query']['sort']);_0x1f5230[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_[_0x2dad('0x3e')](_0x38d947[_0x2dad('0x34')],_0x41b0b1[_0x2dad('0x36')]));_0x1f5230[_0x2dad('0x3d')][_0x2dad('0x56')]=_0x1aa251['id'];if(_0x38d947[_0x2dad('0x34')][_0x2dad('0x3f')]){_0x1f5230[_0x2dad('0x3d')]=_[_0x2dad('0x41')](_0x1f5230[_0x2dad('0x3d')],{'$or':_[_0x2dad('0x2f')](_0x1f5230[_0x2dad('0x38')],function(_0x575845){var _0x29e02e={};_0x29e02e[_0x575845]={'$like':'%'+_0x38d947['query']['filter']+'%'};return _0x29e02e;})});}_0x1f5230=_[_0x2dad('0x41')]({},_0x1f5230,_0x38d947['options']);return db[_0x2dad('0xca')]['count']({'where':_0x1f5230[_0x2dad('0x3d')]})['then'](function(_0x304e52){_0x14498d['count']=_0x304e52;if(_0x38d947[_0x2dad('0x34')][_0x2dad('0x43')]){_0x1f5230['include']=[{'all':!![]}];}else{_0x1f5230[_0x2dad('0x44')]=[{'model':db['CmContact'],'as':_0x2dad('0xee'),'required':![]},{'model':db[_0x2dad('0xd2')],'as':_0x2dad('0x124'),'required':![]}];}return db[_0x2dad('0xca')][_0x2dad('0x45')](_0x1f5230);})[_0x2dad('0x24')](function(_0x99c95d){_0x14498d['rows']=_0x99c95d;return _0x14498d;});}})[_0x2dad('0x24')](respondWithFilteredResult(_0x1dc20a,_0x1f5230))[_0x2dad('0x1b')](handleError(_0x1dc20a,null));};exports[_0x2dad('0x125')]=function(_0x54a6a1,_0x1c09a0){return db[_0x2dad('0x30')]['find']({'where':{'id':_0x54a6a1[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c09a0,null))['then'](function(_0x5825f2){if(_0x5825f2){return _0x5825f2[_0x2dad('0x125')](_0x54a6a1['body'][_0x2dad('0x5d')],_[_0x2dad('0x126')](_0x54a6a1[_0x2dad('0x4a')],[_0x2dad('0x5d'),'id'])||{})[_0x2dad('0xac')](function(_0x5cba02){for(var _0x5a8d2d=0x0;_0x5a8d2d<_0x54a6a1['body']['ids'][_0x2dad('0x3a')];_0x5a8d2d+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x54a6a1[_0x2dad('0x4a')]['ids'][_0x5a8d2d]),'ChatWebsiteId':Number(_0x54a6a1['params']['id'])});}return _0x5cba02;});}})['then'](respondWithResult(_0x1c09a0,null))[_0x2dad('0x1b')](handleError(_0x1c09a0,null));};exports['removeAgents']=function(_0x5f414c,_0x2f1512){return db[_0x2dad('0x30')]['find']({'where':{'id':_0x5f414c[_0x2dad('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f1512,null))['then'](function(_0x3187ea){if(_0x3187ea){return _0x3187ea[_0x2dad('0x127')](_0x5f414c[_0x2dad('0x34')]['ids'])[_0x2dad('0x24')](function(){if(_['isArray'](_0x5f414c[_0x2dad('0x34')][_0x2dad('0x5d')])){for(var _0x5c994a=0x0;_0x5c994a<_0x5f414c['query']['ids'][_0x2dad('0x3a')];_0x5c994a+=0x1){socket['emit'](_0x2dad('0x128'),{'UserId':Number(_0x5f414c[_0x2dad('0x34')][_0x2dad('0x5d')][_0x5c994a]),'ChatWebsiteId':Number(_0x5f414c[_0x2dad('0x47')]['id'])});}}else{socket[_0x2dad('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x5f414c[_0x2dad('0x34')][_0x2dad('0x5d')]),'ChatWebsiteId':Number(_0x5f414c[_0x2dad('0x47')]['id'])});}});}})[_0x2dad('0x24')](respondWithStatusCode(_0x2f1512,null))[_0x2dad('0x1b')](handleError(_0x2f1512,null));};exports[_0x2dad('0x12a')]=function(_0x385df6,_0x43e5f1){var _0x189a77={};var _0x8305ee={};var _0x428886;var _0x5b148f;return db[_0x2dad('0x30')][_0x2dad('0x58')]({'where':{'id':_0x385df6['params']['id']}})['then'](handleEntityNotFound(_0x43e5f1,null))['then'](function(_0x32c16c){if(_0x32c16c){_0x428886=_0x32c16c;_0x8305ee[_0x2dad('0x33')]=_[_0x2dad('0x35')](db[_0x2dad('0xb8')]['rawAttributes']);_0x8305ee['query']=_[_0x2dad('0x35')](_0x385df6['query']);_0x8305ee['filters']=_[_0x2dad('0x37')](_0x8305ee[_0x2dad('0x33')],_0x8305ee[_0x2dad('0x34')]);_0x189a77[_0x2dad('0x38')]=_[_0x2dad('0x37')](_0x8305ee[_0x2dad('0x33')],qs[_0x2dad('0x39')](_0x385df6[_0x2dad('0x34')][_0x2dad('0x39')]));_0x189a77[_0x2dad('0x38')]=_0x189a77[_0x2dad('0x38')][_0x2dad('0x3a')]?_0x189a77[_0x2dad('0x38')]:_0x8305ee['model'];_0x189a77[_0x2dad('0x3c')]=qs[_0x2dad('0x5a')](_0x385df6[_0x2dad('0x34')][_0x2dad('0x5a')]);_0x189a77[_0x2dad('0x3d')]=qs[_0x2dad('0x36')](_['pick'](_0x385df6[_0x2dad('0x34')],_0x8305ee[_0x2dad('0x36')]));if(_0x385df6[_0x2dad('0x34')]['filter']){_0x189a77['where']=_['merge'](_0x189a77['where'],{'$or':_['map'](_0x189a77[_0x2dad('0x38')],function(_0x43f9af){var _0x47a276={};_0x47a276[_0x43f9af]={'$like':'%'+_0x385df6[_0x2dad('0x34')][_0x2dad('0x3f')]+'%'};return _0x47a276;})});}_0x189a77=_[_0x2dad('0x41')]({},_0x189a77,_0x385df6['options']);return _0x428886[_0x2dad('0x12a')](_0x189a77);}})[_0x2dad('0x24')](function(_0x1bb9c5){if(_0x1bb9c5){_0x5b148f=_0x1bb9c5[_0x2dad('0x3a')];if(!_0x385df6[_0x2dad('0x34')][_0x2dad('0x3b')]('nolimit')){_0x189a77[_0x2dad('0x20')]=qs[_0x2dad('0x20')](_0x385df6['query'][_0x2dad('0x20')]);_0x189a77[_0x2dad('0x22')]=qs['offset'](_0x385df6[_0x2dad('0x34')][_0x2dad('0x22')]);}return _0x428886[_0x2dad('0x12a')](_0x189a77);}})['then'](function(_0x5ac0b2){if(_0x5ac0b2){return _0x5ac0b2?{'count':_0x5b148f,'rows':_0x5ac0b2}:null;}})[_0x2dad('0x24')](respondWithResult(_0x43e5f1,null))[_0x2dad('0x1b')](handleError(_0x43e5f1,null));}; \ No newline at end of file +var _0xee39=['systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','existsSync','server/files/images/logos/','getAvatar','root','isNil','server/files/images/avatars/','download','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','account','from','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','browser','%s\x20%s','version','unknown','device','format','vendor','threadId','ChatInteraction','ContactId','interaction','spread','contact','lastName','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','email','offlineMessageSubject','toPairsIn','MailAccountId','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','remote','connection','referer','replace','render','alignment','textColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','priority','stack','finally','getApplications','addProactiveActions','getProactiveActions','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','destroy','get','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ChatWebsiteId','Disposition','findOne','options','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar'];(function(_0x2fbb34,_0x35bcba){var _0x565ea6=function(_0x36d02b){while(--_0x36d02b){_0x2fbb34['push'](_0x2fbb34['shift']());}};_0x565ea6(++_0x35bcba);}(_0xee39,0x1e6));var _0x9ee3=function(_0x3dd23c,_0x18c32f){_0x3dd23c=_0x3dd23c-0x0;var _0x520bf8=_0xee39[_0x3dd23c];return _0x520bf8;};'use strict';var BPromise=require(_0x9ee3('0x0'));var Mustache=require(_0x9ee3('0x1'));var util=require(_0x9ee3('0x2'));var path=require('path');var ejs=require(_0x9ee3('0x3'));var fs=require('fs');var fs_extra=require(_0x9ee3('0x4'));var _=require(_0x9ee3('0x5'));var querystring=require(_0x9ee3('0x6'));var Redis=require(_0x9ee3('0x7'));var qs=require(_0x9ee3('0x8'));var logger=require(_0x9ee3('0x9'))(_0x9ee3('0xa'));var config=require(_0x9ee3('0xb'));var db=require(_0x9ee3('0xc'))['db'];config['redis']=_[_0x9ee3('0xd')](config[_0x9ee3('0xe')],{'host':_0x9ee3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ee3('0xe')]));require('./chatWebsite.socket')[_0x9ee3('0x10')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x9ee3('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9ee3('0x12')]['http']({'port':0x232a});var client9003=jayson[_0x9ee3('0x12')]['http']({'port':0x232b});var client9001=jayson[_0x9ee3('0x12')][_0x9ee3('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x45e166,_0x3dbd01,_0x262724,_0x46eb9c){return new BPromise(function(_0x64e211,_0x4e7134){var _0x1d12e9=_0x46eb9c||client;return _0x1d12e9[_0x9ee3('0x14')](_0x45e166,_0x262724)[_0x9ee3('0x15')](function(_0x579438){logger[_0x9ee3('0x16')](_0x9ee3('0x17'),_0x3dbd01,_0x9ee3('0x18'));logger[_0x9ee3('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3dbd01,'request\x20sent',JSON[_0x9ee3('0x1a')](_0x579438));if(_0x579438[_0x9ee3('0x1b')]){if(_0x579438[_0x9ee3('0x1b')][_0x9ee3('0x1c')]===0x1f4){logger[_0x9ee3('0x1b')](_0x9ee3('0x17'),_0x3dbd01,_0x579438['error']['message']);return _0x4e7134(_0x579438[_0x9ee3('0x1b')][_0x9ee3('0x1d')]);}logger[_0x9ee3('0x1b')](_0x9ee3('0x17'),_0x3dbd01,_0x579438[_0x9ee3('0x1b')][_0x9ee3('0x1d')]);return _0x64e211(_0x579438[_0x9ee3('0x1b')][_0x9ee3('0x1d')]);}else{logger[_0x9ee3('0x16')](_0x9ee3('0x17'),_0x3dbd01,'request\x20sent');_0x64e211(_0x579438[_0x9ee3('0x1e')][_0x9ee3('0x1d')]);}})[_0x9ee3('0x1f')](function(_0x13748c){logger[_0x9ee3('0x1b')](_0x9ee3('0x17'),_0x3dbd01,_0x13748c);_0x4e7134(_0x13748c);});});}function respondWithStatusCode(_0x5f1c6a,_0xa34734){_0xa34734=_0xa34734||0xcc;return function(_0x36e298){if(_0x36e298){return _0x5f1c6a[_0x9ee3('0x20')](_0xa34734);}return _0x5f1c6a[_0x9ee3('0x21')](_0xa34734)['end']();};}function respondWithResult(_0x511a84,_0x4142fc){_0x4142fc=_0x4142fc||0xc8;return function(_0x2575d2){if(_0x2575d2){return _0x511a84[_0x9ee3('0x21')](_0x4142fc)[_0x9ee3('0x22')](_0x2575d2);}};}function respondWithFilteredResult(_0x29faa8,_0x123fc7){return function(_0x353e55){if(_0x353e55){var _0x144c79=typeof _0x123fc7[_0x9ee3('0x23')]===_0x9ee3('0x24')&&typeof _0x123fc7[_0x9ee3('0x25')]==='undefined';var _0x4fcf8c=_0x353e55[_0x9ee3('0x26')];var _0x12adb8=_0x144c79?0x0:_0x123fc7[_0x9ee3('0x23')];var _0x3747f4=_0x144c79?_0x353e55[_0x9ee3('0x26')]:_0x123fc7[_0x9ee3('0x23')]+_0x123fc7[_0x9ee3('0x25')];var _0x454f96;if(_0x3747f4>=_0x4fcf8c){_0x3747f4=_0x4fcf8c;_0x454f96=0xc8;}else{_0x454f96=0xce;}_0x29faa8[_0x9ee3('0x21')](_0x454f96);return _0x29faa8['set'](_0x9ee3('0x27'),_0x12adb8+'-'+_0x3747f4+'/'+_0x4fcf8c)[_0x9ee3('0x22')](_0x353e55);}return null;};}function saveUpdates(_0x1bb7c9){return function(_0x33153){if(_0x33153){return _0x33153['update'](_0x1bb7c9)[_0x9ee3('0x15')](function(_0x4316f9){return _0x4316f9;});}return null;};}function removeEntity(_0x5664d9){return function(_0x38afd3){if(_0x38afd3){return _0x38afd3[_0x9ee3('0x28')]()[_0x9ee3('0x15')](function(){var _0x4e0757=_0x38afd3[_0x9ee3('0x29')]({'plain':!![]});var _0x57daa4='ChatWebsites';return db[_0x9ee3('0x2a')][_0x9ee3('0x28')]({'where':{'type':_0x57daa4,'resourceId':_0x4e0757['id']}})[_0x9ee3('0x15')](function(){return _0x38afd3;});})[_0x9ee3('0x15')](function(){_0x5664d9['status'](0xcc)[_0x9ee3('0x2b')]();});}};}function handleEntityNotFound(_0x331cdc){return function(_0x5392c9){if(!_0x5392c9){_0x331cdc[_0x9ee3('0x20')](0x194);}return _0x5392c9;};}function handleError(_0x4a290d,_0x49060c){_0x49060c=_0x49060c||0x1f4;return function(_0x29c6be){logger[_0x9ee3('0x1b')](_0x29c6be['stack']);if(_0x29c6be[_0x9ee3('0x2c')]){delete _0x29c6be[_0x9ee3('0x2c')];}_0x4a290d['status'](_0x49060c)[_0x9ee3('0x2d')](_0x29c6be);};}exports[_0x9ee3('0x2e')]=function(_0x32b262,_0x417f46){var _0x50972e={'include':[{'model':db[_0x9ee3('0x2f')],'as':_0x9ee3('0x30')}]},_0x1ab9e2={},_0x179400={'count':0x0,'rows':[]};var _0x4067d3=_[_0x9ee3('0x31')](db[_0x9ee3('0x32')][_0x9ee3('0x33')],function(_0x29db21){return{'name':_0x29db21[_0x9ee3('0x34')],'type':_0x29db21[_0x9ee3('0x35')][_0x9ee3('0x36')]};});_0x1ab9e2[_0x9ee3('0x37')]=_[_0x9ee3('0x31')](_0x4067d3,_0x9ee3('0x2c'));_0x1ab9e2[_0x9ee3('0x38')]=_[_0x9ee3('0x39')](_0x32b262[_0x9ee3('0x38')]);_0x1ab9e2['filters']=_[_0x9ee3('0x3a')](_0x1ab9e2[_0x9ee3('0x37')],_0x1ab9e2['query']);_0x50972e[_0x9ee3('0x3b')]=_[_0x9ee3('0x3a')](_0x1ab9e2['model'],qs[_0x9ee3('0x3c')](_0x32b262[_0x9ee3('0x38')][_0x9ee3('0x3c')]));_0x50972e['attributes']=_0x50972e[_0x9ee3('0x3b')][_0x9ee3('0x3d')]?_0x50972e[_0x9ee3('0x3b')]:_0x1ab9e2[_0x9ee3('0x37')];if(!_0x32b262[_0x9ee3('0x38')][_0x9ee3('0x3e')](_0x9ee3('0x3f'))){_0x50972e[_0x9ee3('0x25')]=qs[_0x9ee3('0x25')](_0x32b262[_0x9ee3('0x38')]['limit']);_0x50972e[_0x9ee3('0x23')]=qs[_0x9ee3('0x23')](_0x32b262[_0x9ee3('0x38')][_0x9ee3('0x23')]);}_0x50972e[_0x9ee3('0x40')]=qs[_0x9ee3('0x41')](_0x32b262[_0x9ee3('0x38')][_0x9ee3('0x41')]);_0x50972e[_0x9ee3('0x42')]=qs[_0x9ee3('0x43')](_[_0x9ee3('0x44')](_0x32b262[_0x9ee3('0x38')],_0x1ab9e2[_0x9ee3('0x43')]),_0x4067d3);if(_0x32b262[_0x9ee3('0x38')]['filter']){_0x50972e[_0x9ee3('0x42')]=_['merge'](_0x50972e[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x4067d3,function(_0x32a630){if(_0x32a630[_0x9ee3('0x35')]!=='VIRTUAL'){var _0x563dd1={};_0x563dd1[_0x32a630['name']]={'$like':'%'+_0x32b262['query'][_0x9ee3('0x45')]+'%'};return _0x563dd1;}})});}_0x50972e=_[_0x9ee3('0x46')]({},_0x50972e,_0x32b262['options']);var _0x37a0af={'where':_0x50972e['where']};return db[_0x9ee3('0x32')]['count'](_0x37a0af)[_0x9ee3('0x15')](function(_0x4a3923){_0x179400['count']=_0x4a3923;if(_0x32b262[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0x50972e[_0x9ee3('0x48')]=[{'all':!![]}];}return db['ChatWebsite'][_0x9ee3('0x49')](_0x50972e);})[_0x9ee3('0x15')](function(_0x34c8ae){_0x179400[_0x9ee3('0x4a')]=_0x34c8ae;return _0x179400;})[_0x9ee3('0x15')](respondWithFilteredResult(_0x417f46,_0x50972e))[_0x9ee3('0x1f')](handleError(_0x417f46,null));};exports[_0x9ee3('0x4b')]=function(_0x4db69d,_0xe5cfad){var _0x815ca5={'raw':![],'where':{'id':_0x4db69d[_0x9ee3('0x4c')]['id']},'include':[{'model':db['Pause'],'as':_0x9ee3('0x30')}]},_0x1102c8={};_0x1102c8[_0x9ee3('0x37')]=_[_0x9ee3('0x39')](db['ChatWebsite'][_0x9ee3('0x33')]);_0x1102c8[_0x9ee3('0x38')]=_['keys'](_0x4db69d[_0x9ee3('0x38')]);_0x1102c8[_0x9ee3('0x43')]=_[_0x9ee3('0x3a')](_0x1102c8[_0x9ee3('0x37')],_0x1102c8[_0x9ee3('0x38')]);_0x815ca5[_0x9ee3('0x3b')]=_['intersection'](_0x1102c8['model'],qs[_0x9ee3('0x3c')](_0x4db69d['query'][_0x9ee3('0x3c')]));_0x815ca5[_0x9ee3('0x3b')]=_0x815ca5['attributes']['length']?_0x815ca5[_0x9ee3('0x3b')]:_0x1102c8['model'];if(_0x4db69d[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0x815ca5[_0x9ee3('0x48')]=[{'all':!![]}];}_0x815ca5=_[_0x9ee3('0x46')]({},_0x815ca5,_0x4db69d['options']);return db['ChatWebsite'][_0x9ee3('0x4d')](_0x815ca5)[_0x9ee3('0x15')](handleEntityNotFound(_0xe5cfad,null))[_0x9ee3('0x15')](respondWithResult(_0xe5cfad,null))[_0x9ee3('0x1f')](handleError(_0xe5cfad,null));};exports[_0x9ee3('0x4e')]=function(_0x358720,_0x36780f){return db['ChatWebsite'][_0x9ee3('0x4e')](_0x358720[_0x9ee3('0x4f')],{})[_0x9ee3('0x15')](function(_0x233f50){var _0x1a700f=_0x358720[_0x9ee3('0x50')]['get']({'plain':!![]});if(!_0x1a700f)throw new Error(_0x9ee3('0x51'));if(_0x1a700f['role']===_0x9ee3('0x50')){var _0xa8af55=_0x233f50[_0x9ee3('0x29')]({'plain':!![]});var _0x1598bf=_0x9ee3('0x52');return db['UserProfileSection'][_0x9ee3('0x4d')]({'where':{'name':_0x1598bf,'userProfileId':_0x1a700f[_0x9ee3('0x53')]},'raw':!![]})[_0x9ee3('0x15')](function(_0x5f1b67){if(_0x5f1b67&&_0x5f1b67[_0x9ee3('0x54')]===0x0){return db[_0x9ee3('0x2a')]['create']({'name':_0xa8af55[_0x9ee3('0x2c')],'resourceId':_0xa8af55['id'],'type':_0x5f1b67[_0x9ee3('0x2c')],'sectionId':_0x5f1b67['id']},{})['then'](function(){return _0x233f50;});}else{return _0x233f50;}})[_0x9ee3('0x1f')](function(_0x14b937){logger['error'](_0x9ee3('0x55'),_0x14b937);throw _0x14b937;});}return _0x233f50;})[_0x9ee3('0x15')](respondWithResult(_0x36780f,0xc9))['catch'](handleError(_0x36780f,null));};exports[_0x9ee3('0x56')]=function(_0x15c73d,_0x4ac5d4){if(_0x15c73d[_0x9ee3('0x4f')]['id']){delete _0x15c73d[_0x9ee3('0x4f')]['id'];}return db[_0x9ee3('0x32')][_0x9ee3('0x4d')]({'where':{'id':_0x15c73d[_0x9ee3('0x4c')]['id']},'include':[{'model':db[_0x9ee3('0x2f')],'as':_0x9ee3('0x30')}]})[_0x9ee3('0x15')](handleEntityNotFound(_0x4ac5d4,null))[_0x9ee3('0x15')](saveUpdates(_0x15c73d[_0x9ee3('0x4f')],null))[_0x9ee3('0x15')](respondWithResult(_0x4ac5d4,null))[_0x9ee3('0x1f')](handleError(_0x4ac5d4,null));};exports[_0x9ee3('0x28')]=function(_0x12e4cf,_0x365631){return db['ChatWebsite'][_0x9ee3('0x4d')]({'where':{'id':_0x12e4cf[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x365631,null))[_0x9ee3('0x15')](removeEntity(_0x365631,null))[_0x9ee3('0x1f')](handleError(_0x365631,null));};exports['describe']=function(_0x1cc1b6,_0x5ea19d){return db[_0x9ee3('0x32')][_0x9ee3('0x57')]()[_0x9ee3('0x15')](respondWithResult(_0x5ea19d,null))[_0x9ee3('0x1f')](handleError(_0x5ea19d,null));};exports['addDisposition']=function(_0x4f2b80,_0x4284a3){if(_0x4f2b80[_0x9ee3('0x4f')]['id']){delete _0x4f2b80[_0x9ee3('0x4f')]['id'];}return db[_0x9ee3('0x32')]['find']({'where':{'id':_0x4f2b80[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x4284a3,null))['then'](function(_0x5e2228){if(_0x5e2228){_0x4f2b80[_0x9ee3('0x4f')][_0x9ee3('0x58')]=_0x5e2228['id'];return db[_0x9ee3('0x59')][_0x9ee3('0x4e')](_0x4f2b80[_0x9ee3('0x4f')]);}})[_0x9ee3('0x15')](respondWithResult(_0x4284a3,null))[_0x9ee3('0x1f')](handleError(_0x4284a3,null));};exports['getDispositions']=function(_0x596c6a,_0x58554e){var _0xf23ba6={'raw':![],'where':{}};var _0x53c9c7={};var _0x3ab3ad={'count':0x0,'rows':[]};return db[_0x9ee3('0x32')][_0x9ee3('0x5a')]({'where':{'id':_0x596c6a['params']['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x58554e,null))[_0x9ee3('0x15')](function(_0x442ed0){if(_0x442ed0){_0x53c9c7[_0x9ee3('0x37')]=_[_0x9ee3('0x39')](db[_0x9ee3('0x59')][_0x9ee3('0x33')]);_0x53c9c7['query']=_[_0x9ee3('0x39')](_0x596c6a[_0x9ee3('0x38')]);_0x53c9c7['filters']=_[_0x9ee3('0x3a')](_0x53c9c7[_0x9ee3('0x37')],_0x53c9c7[_0x9ee3('0x38')]);_0xf23ba6[_0x9ee3('0x3b')]=_[_0x9ee3('0x3a')](_0x53c9c7['model'],qs[_0x9ee3('0x3c')](_0x596c6a[_0x9ee3('0x38')]['fields']));_0xf23ba6[_0x9ee3('0x3b')]=_0xf23ba6[_0x9ee3('0x3b')]['length']?_0xf23ba6[_0x9ee3('0x3b')]:_0x53c9c7[_0x9ee3('0x37')];if(!_0x596c6a[_0x9ee3('0x38')]['hasOwnProperty'](_0x9ee3('0x3f'))){_0xf23ba6[_0x9ee3('0x25')]=qs[_0x9ee3('0x25')](_0x596c6a[_0x9ee3('0x38')]['limit']);_0xf23ba6[_0x9ee3('0x23')]=qs[_0x9ee3('0x23')](_0x596c6a['query'][_0x9ee3('0x23')]);}_0xf23ba6[_0x9ee3('0x40')]=qs['sort'](_0x596c6a[_0x9ee3('0x38')][_0x9ee3('0x41')]);_0xf23ba6[_0x9ee3('0x42')]=qs['filters'](_[_0x9ee3('0x44')](_0x596c6a[_0x9ee3('0x38')],_0x53c9c7['filters']));_0xf23ba6[_0x9ee3('0x42')][_0x9ee3('0x58')]=_0x442ed0['id'];if(_0x596c6a[_0x9ee3('0x38')]['filter']){_0xf23ba6[_0x9ee3('0x42')]=_['merge'](_0xf23ba6['where'],{'$or':_[_0x9ee3('0x31')](_0xf23ba6[_0x9ee3('0x3b')],function(_0x1bf460){var _0x2dc38c={};_0x2dc38c[_0x1bf460]={'$like':'%'+_0x596c6a[_0x9ee3('0x38')][_0x9ee3('0x45')]+'%'};return _0x2dc38c;})});}_0xf23ba6=_[_0x9ee3('0x46')]({},_0xf23ba6,_0x596c6a[_0x9ee3('0x5b')]);return db[_0x9ee3('0x59')][_0x9ee3('0x26')]({'where':_0xf23ba6[_0x9ee3('0x42')]})[_0x9ee3('0x15')](function(_0x4b881d){_0x3ab3ad[_0x9ee3('0x26')]=_0x4b881d;if(_0x596c6a[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0xf23ba6[_0x9ee3('0x48')]=[{'all':!![]}];}return db[_0x9ee3('0x59')][_0x9ee3('0x49')](_0xf23ba6);})[_0x9ee3('0x15')](function(_0x5f4748){_0x3ab3ad[_0x9ee3('0x4a')]=_0x5f4748;return _0x3ab3ad;});}})[_0x9ee3('0x15')](respondWithFilteredResult(_0x58554e,_0xf23ba6))[_0x9ee3('0x1f')](handleError(_0x58554e,null));};exports[_0x9ee3('0x5c')]=function(_0x2e7a54,_0x48f6aa){return db[_0x9ee3('0x32')][_0x9ee3('0x4d')]({'where':{'id':_0x2e7a54[_0x9ee3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x48f6aa,null))['then'](function(_0x4a1c8){if(_0x4a1c8){return _0x4a1c8[_0x9ee3('0x5c')](_0x2e7a54[_0x9ee3('0x38')][_0x9ee3('0x5d')]);}})[_0x9ee3('0x15')](respondWithStatusCode(_0x48f6aa,null))['catch'](handleError(_0x48f6aa,null));};exports[_0x9ee3('0x5e')]=function(_0x492e6d,_0x443fe4){if(_0x492e6d[_0x9ee3('0x4f')]['id']){delete _0x492e6d[_0x9ee3('0x4f')]['id'];}return db[_0x9ee3('0x32')][_0x9ee3('0x4d')]({'where':{'id':_0x492e6d[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x443fe4,null))['then'](function(_0x3a9ee6){if(_0x3a9ee6){_0x492e6d[_0x9ee3('0x4f')]['ChatWebsiteId']=_0x3a9ee6['id'];return db['CannedAnswer'][_0x9ee3('0x4e')](_0x492e6d[_0x9ee3('0x4f')]);}})['then'](respondWithResult(_0x443fe4,null))[_0x9ee3('0x1f')](handleError(_0x443fe4,null));};exports['getAnswers']=function(_0x3c1e73,_0x5b2f6b){var _0x2177ac={'raw':![],'where':{}};var _0xc93c9={};var _0xaac5c5={'count':0x0,'rows':[]};return db[_0x9ee3('0x32')][_0x9ee3('0x5a')]({'where':{'id':_0x3c1e73['params']['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x5b2f6b,null))[_0x9ee3('0x15')](function(_0x255fe1){if(_0x255fe1){_0xc93c9[_0x9ee3('0x37')]=_[_0x9ee3('0x39')](db[_0x9ee3('0x5f')][_0x9ee3('0x33')]);_0xc93c9[_0x9ee3('0x38')]=_['keys'](_0x3c1e73[_0x9ee3('0x38')]);_0xc93c9[_0x9ee3('0x43')]=_[_0x9ee3('0x3a')](_0xc93c9[_0x9ee3('0x37')],_0xc93c9[_0x9ee3('0x38')]);_0x2177ac[_0x9ee3('0x3b')]=_['intersection'](_0xc93c9['model'],qs[_0x9ee3('0x3c')](_0x3c1e73[_0x9ee3('0x38')][_0x9ee3('0x3c')]));_0x2177ac[_0x9ee3('0x3b')]=_0x2177ac[_0x9ee3('0x3b')]['length']?_0x2177ac[_0x9ee3('0x3b')]:_0xc93c9[_0x9ee3('0x37')];if(!_0x3c1e73[_0x9ee3('0x38')]['hasOwnProperty']('nolimit')){_0x2177ac[_0x9ee3('0x25')]=qs[_0x9ee3('0x25')](_0x3c1e73['query'][_0x9ee3('0x25')]);_0x2177ac[_0x9ee3('0x23')]=qs[_0x9ee3('0x23')](_0x3c1e73['query'][_0x9ee3('0x23')]);}_0x2177ac['order']=qs[_0x9ee3('0x41')](_0x3c1e73[_0x9ee3('0x38')][_0x9ee3('0x41')]);_0x2177ac[_0x9ee3('0x42')]=qs[_0x9ee3('0x43')](_[_0x9ee3('0x44')](_0x3c1e73[_0x9ee3('0x38')],_0xc93c9[_0x9ee3('0x43')]));_0x2177ac['where'][_0x9ee3('0x58')]=_0x255fe1['id'];if(_0x3c1e73[_0x9ee3('0x38')][_0x9ee3('0x45')]){_0x2177ac['where']=_[_0x9ee3('0x46')](_0x2177ac[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x2177ac[_0x9ee3('0x3b')],function(_0xc5525d){var _0x1bc93a={};_0x1bc93a[_0xc5525d]={'$like':'%'+_0x3c1e73[_0x9ee3('0x38')][_0x9ee3('0x45')]+'%'};return _0x1bc93a;})});}_0x2177ac=_[_0x9ee3('0x46')]({},_0x2177ac,_0x3c1e73['options']);return db['CannedAnswer'][_0x9ee3('0x26')]({'where':_0x2177ac['where']})['then'](function(_0x25362c){_0xaac5c5[_0x9ee3('0x26')]=_0x25362c;if(_0x3c1e73[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0x2177ac['include']=[{'all':!![]}];}return db[_0x9ee3('0x5f')][_0x9ee3('0x49')](_0x2177ac);})[_0x9ee3('0x15')](function(_0x164763){_0xaac5c5[_0x9ee3('0x4a')]=_0x164763;return _0xaac5c5;});}})[_0x9ee3('0x15')](respondWithFilteredResult(_0x5b2f6b,_0x2177ac))[_0x9ee3('0x1f')](handleError(_0x5b2f6b,null));};exports[_0x9ee3('0x60')]=function(_0x14046d,_0x523bea){return db[_0x9ee3('0x32')][_0x9ee3('0x4d')]({'where':{'id':_0x14046d[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x523bea,null))['then'](function(_0x30c08e){if(_0x30c08e){return _0x30c08e[_0x9ee3('0x60')](_0x14046d[_0x9ee3('0x38')][_0x9ee3('0x5d')]);}})[_0x9ee3('0x15')](respondWithStatusCode(_0x523bea,null))[_0x9ee3('0x1f')](handleError(_0x523bea,null));};exports['addLogo']=function(_0x31c703,_0x811ec){_0x31c703[_0x9ee3('0x4f')][_0x9ee3('0x61')]=_0x31c703[_0x9ee3('0x62')][_0x9ee3('0x63')];return db[_0x9ee3('0x32')]['find']({'where':{'id':_0x31c703[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x811ec,null))[_0x9ee3('0x15')](saveUpdates(_0x31c703[_0x9ee3('0x4f')],null))[_0x9ee3('0x15')](respondWithResult(_0x811ec,null))[_0x9ee3('0x1f')](handleError(_0x811ec,null));};exports[_0x9ee3('0x64')]=function(_0x1aa099,_0x3f39a9){_0x1aa099[_0x9ee3('0x4f')][_0x9ee3('0x65')]=_0x1aa099[_0x9ee3('0x62')][_0x9ee3('0x63')];return db['ChatWebsite']['find']({'where':{'id':_0x1aa099[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x3f39a9,null))[_0x9ee3('0x15')](saveUpdates(_0x1aa099[_0x9ee3('0x4f')],null))['then'](respondWithResult(_0x3f39a9,null))[_0x9ee3('0x1f')](handleError(_0x3f39a9,null));};exports[_0x9ee3('0x66')]=function(_0x15926d,_0x1b6327){_0x15926d[_0x9ee3('0x4f')]['customerAvatar']=_0x15926d[_0x9ee3('0x62')]['filename'];return db[_0x9ee3('0x32')]['find']({'where':{'id':_0x15926d[_0x9ee3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b6327,null))[_0x9ee3('0x15')](saveUpdates(_0x15926d[_0x9ee3('0x4f')],null))[_0x9ee3('0x15')](respondWithResult(_0x1b6327,null))['catch'](handleError(_0x1b6327,null));};exports[_0x9ee3('0x67')]=function(_0x4751df,_0x18a5e2){_0x4751df[_0x9ee3('0x4f')][_0x9ee3('0x68')]=_0x4751df[_0x9ee3('0x62')][_0x9ee3('0x63')];return db[_0x9ee3('0x32')]['find']({'where':{'id':_0x4751df[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x18a5e2,null))[_0x9ee3('0x15')](saveUpdates(_0x4751df[_0x9ee3('0x4f')],null))[_0x9ee3('0x15')](respondWithResult(_0x18a5e2,null))[_0x9ee3('0x1f')](handleError(_0x18a5e2,null));};exports[_0x9ee3('0x69')]=function(_0x3f7f6c,_0x59aec2){var _0x42cf60=path[_0x9ee3('0x6a')](config['root'],_0x9ee3('0x6b'));var _0x3e9f7b={'where':{'id':_0x3f7f6c[_0x9ee3('0x4c')]['id']},'attributes':['id',_0x9ee3('0x61')],'raw':!![]};var _0x39da05=![];return require('../../config/license/util')[_0x9ee3('0x6c')]()['then'](function(_0x304f47){if(_0x304f47){_0x39da05=_0x304f47[_0x9ee3('0x6d')];}})[_0x9ee3('0x15')](function(){return db[_0x9ee3('0x32')][_0x9ee3('0x4d')](_0x3e9f7b);})[_0x9ee3('0x15')](handleEntityNotFound(_0x59aec2,null))[_0x9ee3('0x15')](function(_0x27923a){if(_0x27923a){if(!_['isNil'](_0x27923a[_0x9ee3('0x61')])){if(fs[_0x9ee3('0x6e')](path[_0x9ee3('0x6a')](config['root'],'server/files/images/logos/',_0x27923a[_0x9ee3('0x61')]))&&_0x39da05){_0x42cf60=path[_0x9ee3('0x6a')](config['root'],_0x9ee3('0x6f'),_0x27923a[_0x9ee3('0x61')]);}}return _0x59aec2['download'](_0x42cf60);}})[_0x9ee3('0x1f')](handleError(_0x59aec2,null));};exports[_0x9ee3('0x70')]=function(_0x225947,_0x32b2ea){var _0x72dcd0=path[_0x9ee3('0x6a')](config[_0x9ee3('0x71')],'server/files/images/avatars/default_avatar.png');var _0x1645c5={'where':{'id':_0x225947[_0x9ee3('0x4c')]['id']},'attributes':['id',_0x9ee3('0x65')],'raw':!![]};return db['ChatWebsite'][_0x9ee3('0x4d')](_0x1645c5)[_0x9ee3('0x15')](handleEntityNotFound(_0x32b2ea,null))[_0x9ee3('0x15')](function(_0x391aad){if(_0x391aad){if(!_[_0x9ee3('0x72')](_0x391aad[_0x9ee3('0x65')])){if(fs[_0x9ee3('0x6e')](path[_0x9ee3('0x6a')](config['root'],'server/files/images/avatars/',_0x391aad[_0x9ee3('0x65')]))){_0x72dcd0=path['join'](config[_0x9ee3('0x71')],_0x9ee3('0x73'),_0x391aad[_0x9ee3('0x65')]);}}return _0x32b2ea[_0x9ee3('0x74')](_0x72dcd0);}})[_0x9ee3('0x1f')](handleError(_0x32b2ea,null));};exports[_0x9ee3('0x75')]=function(_0x1b7bb5,_0x22918a){var _0x191aef=path[_0x9ee3('0x6a')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x6d4fdb={'where':{'id':_0x1b7bb5[_0x9ee3('0x4c')]['id']},'attributes':['id',_0x9ee3('0x76'),_0x9ee3('0x77')],'raw':!![]};return db[_0x9ee3('0x32')][_0x9ee3('0x4d')](_0x6d4fdb)['then'](handleEntityNotFound(_0x22918a,null))[_0x9ee3('0x15')](function(_0x507ea0){if(_0x507ea0){if(!_['isNil'](_0x507ea0[_0x9ee3('0x76')])){if(fs[_0x9ee3('0x6e')](path['join'](config['root'],'server/files/images/avatars/',_0x507ea0[_0x9ee3('0x76')]))&&_0x507ea0[_0x9ee3('0x77')]){_0x191aef=path[_0x9ee3('0x6a')](config[_0x9ee3('0x71')],'server/files/images/avatars/',_0x507ea0[_0x9ee3('0x76')]);}}return _0x22918a[_0x9ee3('0x74')](_0x191aef);}})[_0x9ee3('0x1f')](handleError(_0x22918a,null));};exports[_0x9ee3('0x78')]=function(_0x43126a,_0x97bbeb){var _0x2fc1ef=path[_0x9ee3('0x6a')](config[_0x9ee3('0x71')],_0x9ee3('0x79'));var _0x47986a={'where':{'id':_0x43126a[_0x9ee3('0x4c')]['id']},'attributes':['id',_0x9ee3('0x68')],'raw':!![]};return db[_0x9ee3('0x32')][_0x9ee3('0x4d')](_0x47986a)[_0x9ee3('0x15')](handleEntityNotFound(_0x97bbeb,null))['then'](function(_0x420d97){if(_0x420d97){if(!_[_0x9ee3('0x72')](_0x420d97[_0x9ee3('0x68')])){if(fs[_0x9ee3('0x6e')](path[_0x9ee3('0x6a')](config['root'],_0x9ee3('0x73'),_0x420d97[_0x9ee3('0x68')]))){_0x2fc1ef=path['join'](config['root'],_0x9ee3('0x73'),_0x420d97[_0x9ee3('0x68')]);}}return _0x97bbeb[_0x9ee3('0x74')](_0x2fc1ef);}})[_0x9ee3('0x1f')](handleError(_0x97bbeb,null));};exports[_0x9ee3('0x7a')]=function(_0x2cee79,_0x422662){var _0x39ae14=require(_0x9ee3('0x7b'));var _0x180d82=new _0x39ae14();var _0x1da2dc=_0x180d82[_0x9ee3('0x7c')](_0x2cee79[_0x9ee3('0x7d')][_0x9ee3('0x7e')])[_0x9ee3('0x7f')]();var _0x41ae49={'body':_0x2cee79[_0x9ee3('0x4f')],'channel':'chat'};var _0x2f7083=[];var _0x18e6e7=[];var _0x27fec5={};var _0x4196ea=![];return db[_0x9ee3('0x80')][_0x9ee3('0x57')]()['then'](function(_0x55f66d){if(!_0x55f66d){throw new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))](_0x9ee3('0x83'));}_0x2f7083=_['difference'](_[_0x9ee3('0x39')](_0x55f66d),[_0x9ee3('0x84'),_0x9ee3('0x85')]);_0x18e6e7=_[_0x9ee3('0x86')](_[_0x9ee3('0x39')](_0x55f66d),[_0x9ee3('0x84'),_0x9ee3('0x85'),_0x9ee3('0x87'),_0x9ee3('0x88')]);if(_0x2cee79[_0x9ee3('0x4f')]['id']){delete _0x2cee79[_0x9ee3('0x4f')]['id'];}if(_[_0x9ee3('0x72')](_0x2cee79['body']['from'])){throw new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))]('from\x20is\x20mandatory');}if(_[_0x9ee3('0x72')](_0x2cee79[_0x9ee3('0x4f')]['body'])||_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0x4f')]===''){throw new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))](_0x9ee3('0x89'));}if(_[_0x9ee3('0x72')](_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0x8a')])){throw new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))](_0x9ee3('0x8b')+_0x18e6e7);}if(!_['includes'](_0x18e6e7,_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0x8a')])){throw new db[(_0x9ee3('0x81'))]['ValidationError'](_0x9ee3('0x8c')+_0x18e6e7);}_0x27fec5[_0x2cee79[_0x9ee3('0x4f')]['mapKey']]=_0x2cee79[_0x9ee3('0x4f')]['from'];})[_0x9ee3('0x15')](function(){return db[_0x9ee3('0x32')]['find']({'where':{'id':_0x2cee79[_0x9ee3('0x4c')]['id']},'include':[{'model':db[_0x9ee3('0x8d')],'as':_0x9ee3('0x8e'),'include':[{'model':db[_0x9ee3('0x80')],'as':_0x9ee3('0x8f'),'where':_0x27fec5,'limit':0x1,'order':[[_0x9ee3('0x85'),_0x9ee3('0x90')]]}]},{'model':db[_0x9ee3('0x91')],'as':_0x9ee3('0x92')}]});})['then'](handleEntityNotFound(_0x422662,null))[_0x9ee3('0x15')](function(_0x4c57b3){if(_0x4c57b3&&_0x4c57b3['List']){_0x41ae49['account']=_0x4c57b3;_0x41ae49[_0x9ee3('0x93')]=_0x4c57b3[_0x9ee3('0x92')];_0x41ae49[_0x9ee3('0x94')]=_0x4c57b3[_0x9ee3('0x8e')];_0x41ae49[_0x9ee3('0x93')]=_[_0x9ee3('0x95')](_0x41ae49[_0x9ee3('0x93')],['priority'],['asc']);if(_0x41ae49[_0x9ee3('0x96')]['Applications']){delete _0x41ae49[_0x9ee3('0x96')][_0x9ee3('0x92')];}if(_0x41ae49[_0x9ee3('0x96')][_0x9ee3('0x8e')]&&_0x41ae49[_0x9ee3('0x96')][_0x9ee3('0x8e')]['Contacts'][_0x9ee3('0x3d')]){return _0x41ae49[_0x9ee3('0x96')][_0x9ee3('0x8e')][_0x9ee3('0x8f')][0x0];}var _0x3bd869=_['defaults'](_0x2cee79[_0x9ee3('0x4f')],{'firstName':_0x2cee79[_0x9ee3('0x4f')]['from'],'ListId':_0x4c57b3[_0x9ee3('0x88')]});_0x3bd869[_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0x8a')]]=_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0x97')];return db[_0x9ee3('0x80')]['create'](_0x3bd869,{'fields':_0x2f7083,'raw':!![]});}})['then'](handleEntityNotFound(_0x422662,null))[_0x9ee3('0x15')](function(_0x93903a){_0x41ae49['contact']=_0x93903a;var _0x1bac60=_0x2cee79['body'][_0x9ee3('0x98')];if(_0x2cee79[_0x9ee3('0x7d')][_0x9ee3('0x99')]){_0x1bac60=_0x2cee79['headers']['cf-connecting-ip'];}else if(_0x2cee79[_0x9ee3('0x7d')][_0x9ee3('0x9a')]){_0x1bac60=_[_0x9ee3('0x9b')](_0x2cee79[_0x9ee3('0x7d')]['x-forwarded-for'][_0x9ee3('0x9c')](','));}if(_0x93903a){var _0x10f9bf={'ContactId':_0x93903a['id'],'ChatWebsiteId':_0x2cee79[_0x9ee3('0x4c')]['id'],'from':(_0x93903a[_0x9ee3('0x9d')]||'')+'\x20'+(_0x93903a['lastName']||''),'customerIp':_0x1bac60,'customerPort':_0x2cee79[_0x9ee3('0x7d')]['x-real-port']?_0x2cee79['headers']['x-real-port']:null,'referer':_0x2cee79[_0x9ee3('0x4f')]['referer'],'browserName':_0x1da2dc[_0x9ee3('0x9e')]['name']&&_0x1da2dc[_0x9ee3('0x9e')]['version']?util['format'](_0x9ee3('0x9f'),_0x1da2dc['browser'][_0x9ee3('0x2c')],_0x1da2dc['browser'][_0x9ee3('0xa0')]):_0x9ee3('0xa1'),'browserVersion':_0x1da2dc[_0x9ee3('0x9e')]['version']||'unknown','osName':util['format'](_0x9ee3('0x9f'),_0x1da2dc['os'][_0x9ee3('0x2c')],_0x1da2dc['os']['version']),'osVersion':_0x1da2dc['os'][_0x9ee3('0xa0')],'deviceModel':_0x1da2dc[_0x9ee3('0xa2')][_0x9ee3('0x37')]&&_0x1da2dc[_0x9ee3('0xa2')]['vendor']?util[_0x9ee3('0xa3')]('%s\x20%s\x20%s',_0x1da2dc[_0x9ee3('0xa2')][_0x9ee3('0x37')],_0x1da2dc[_0x9ee3('0xa2')][_0x9ee3('0xa4')],_0x1da2dc['device'][_0x9ee3('0x35')]):null,'deviceVendor':_0x1da2dc[_0x9ee3('0xa2')]['vendor'],'deviceType':_0x1da2dc[_0x9ee3('0xa2')][_0x9ee3('0x35')],'formData':JSON['stringify'](_0x2cee79[_0x9ee3('0x4f')])};var _0x32268b={'ChatWebsiteId':_0x2cee79[_0x9ee3('0x4c')]['id'],'closed':![]};if(_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xa5')]){_0x32268b[_0x9ee3('0xa5')]=_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xa5')];return db['ChatInteraction']['find']({'where':_0x32268b})[_0x9ee3('0x15')](function(_0x457472){if(_0x457472){return[_0x457472,![]];}_0x10f9bf[_0x9ee3('0xa5')]=_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xa5')];_0x10f9bf['externalUrl']=_0x2cee79[_0x9ee3('0x4f')]['externalUrl'];return db[_0x9ee3('0xa6')]['create'](_0x10f9bf)['then'](function(_0x33693a){return[_0x33693a,!![]];});});}_0x32268b[_0x9ee3('0xa7')]=_0x93903a['id'];if(_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xa8')]&&_0x2cee79[_0x9ee3('0x4f')]['interaction']['id']){_0x32268b['id']=_0x2cee79[_0x9ee3('0x4f')]['interaction']['id'];return db[_0x9ee3('0xa6')][_0x9ee3('0x4d')]({'where':_0x32268b})[_0x9ee3('0x15')](function(_0x1f743f){if(_0x1f743f){return[_0x1f743f,![]];}return db[_0x9ee3('0xa6')][_0x9ee3('0x4e')](_0x10f9bf)['then'](function(_0x3ad06a){return[_0x3ad06a,!![]];});});}return db['ChatInteraction'][_0x9ee3('0x4e')](_0x10f9bf)['then'](function(_0x285c94){return[_0x285c94,!![]];});}})[_0x9ee3('0xa9')](function(_0x5b5b2b,_0x5a883f){if(_0x5b5b2b){_0x4196ea=_0x5a883f;if(!_0x5a883f){var _0x52394d={'from':(_0x41ae49[_0x9ee3('0xaa')][_0x9ee3('0x9d')]||'')+'\x20'+(_0x41ae49[_0x9ee3('0xaa')][_0x9ee3('0xab')]||'')};if(_0x2cee79[_0x9ee3('0x4f')]['threadId']&&_0x2cee79['body']['messageId']&&_0x2cee79['body']['threadId']!=_0x2cee79['body'][_0x9ee3('0xac')]){_0x52394d[_0x9ee3('0xa5')]=_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xac')];}return _0x5b5b2b[_0x9ee3('0x56')](_0x52394d);}else{return _0x5b5b2b;}}})[_0x9ee3('0x15')](function(_0xd66efc){_0x41ae49[_0x9ee3('0xa8')]=_0xd66efc[_0x9ee3('0x29')]({'plain':!![]});_0x41ae49[_0x9ee3('0xa8')][_0x9ee3('0xad')]=_0x4196ea;if(_0x41ae49['interaction']['created']){if(_0x41ae49[_0x9ee3('0x96')]['autoclose']){_0x41ae49[_0x9ee3('0x93')][_0x9ee3('0xae')]({'id':0x0,'priority':_0x41ae49[_0x9ee3('0x93')][_0x9ee3('0x3d')]+0x1,'app':_0x9ee3('0xaf'),'appdata':_0x9ee3('0xb0'),'interval':'*,*,*,*'});}}return db[_0x9ee3('0xb1')][_0x9ee3('0x4e')]({'body':_0x2cee79[_0x9ee3('0x4f')]['body'],'ChatWebsiteId':_0x2cee79[_0x9ee3('0x4c')]['id'],'ChatInteractionId':_0xd66efc['id'],'direction':'in','ContactId':_0x41ae49[_0x9ee3('0xaa')]['id'],'AttachmentId':_0x2cee79[_0x9ee3('0x4f')][_0x9ee3('0xb2')]});})[_0x9ee3('0x15')](function(_0x13c532){_0x41ae49['message']=_0x13c532;if(_0x41ae49['interaction'][_0x9ee3('0xb3')]){return db[_0x9ee3('0xb4')]['find']({'attributes':['id',_0x9ee3('0x2c')],'where':{'id':_0x41ae49[_0x9ee3('0xa8')][_0x9ee3('0xb3')]}})[_0x9ee3('0x15')](function(_0xc5cbab){if(_0xc5cbab){_0x41ae49[_0x9ee3('0x93')][_0x9ee3('0xb5')]({'id':0x0,'priority':0x0,'app':_0x9ee3('0xb6'),'appdata':_0xc5cbab[_0x9ee3('0x2c')]+','+(_0x41ae49['account']['waitForTheAssignedAgent']||0xa),'interval':_0x9ee3('0xb7')});_0x41ae49[_0x9ee3('0xb8')]=!![];}return respondWithRpcPromise(_0x9ee3('0xb9'),_0x9ee3('0xba'),_0x41ae49);});}return respondWithRpcPromise('Start',_0x9ee3('0xba'),_0x41ae49);})[_0x9ee3('0x15')](function(_0x37c038){respondWithRpcPromise(_0x9ee3('0xbb'),_0x9ee3('0xbb'),{'event':'notify','message':_0x37c038},client9002);return _0x37c038;})[_0x9ee3('0x15')](respondWithResult(_0x422662,null))[_0x9ee3('0x1f')](handleError(_0x422662,null));};exports[_0x9ee3('0xbc')]=function(_0x21fb3e,_0x32e7a1){var _0x41e122,_0x15ec52,_0x22ceec;var _0x57055f=[];var _0x538bb8={};var _0x2cdb2d=_0x21fb3e[_0x9ee3('0xbd')]||[];var _0x2739ed=[];var _0x28af55;return db[_0x9ee3('0x80')][_0x9ee3('0x57')]()['then'](function(_0x2e7076){if(!_0x2e7076){throw new db[(_0x9ee3('0x81'))]['ValidationError'](_0x9ee3('0x83'));}_0x57055f=_[_0x9ee3('0x86')](_[_0x9ee3('0x39')](_0x2e7076),[_0x9ee3('0x84'),_0x9ee3('0x85'),_0x9ee3('0x87'),_0x9ee3('0x88')]);if(_0x21fb3e['body']['id']){delete _0x21fb3e[_0x9ee3('0x4f')]['id'];}if(_[_0x9ee3('0x72')](_0x21fb3e[_0x9ee3('0x4f')]['from'])){throw _0x32e7a1[_0x9ee3('0x21')](0x1f4)[_0x9ee3('0x2d')](new db[(_0x9ee3('0x81'))]['ValidationError'](_0x9ee3('0xbe')));}if(_['isNil'](_0x21fb3e[_0x9ee3('0x4f')]['body'])||_0x21fb3e[_0x9ee3('0x4f')][_0x9ee3('0x4f')]===''){throw _0x32e7a1['status'](0x1f4)[_0x9ee3('0x2d')](new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9ee3('0x72')](_0x21fb3e['body'][_0x9ee3('0xbf')])){throw _0x32e7a1['status'](0x1f4)[_0x9ee3('0x2d')](new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))](_0x9ee3('0xc0')+_0x57055f));}if(!_[_0x9ee3('0xc1')](_0x57055f,_0x21fb3e['body'][_0x9ee3('0xbf')])){throw _0x32e7a1[_0x9ee3('0x21')](0x1f4)['send'](new db[(_0x9ee3('0x81'))][(_0x9ee3('0x82'))](_0x9ee3('0xc2')+_0x57055f));}_0x538bb8[_0x21fb3e[_0x9ee3('0x4f')][_0x9ee3('0xbf')]]=_0x21fb3e[_0x9ee3('0x4f')][_0x9ee3('0x97')];})[_0x9ee3('0x15')](function(){return db['ChatWebsite'][_0x9ee3('0x4d')]({'where':{'id':_0x21fb3e[_0x9ee3('0x4c')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x9ee3('0xc3')],'as':_0x9ee3('0xc3')}]});})[_0x9ee3('0x15')](handleEntityNotFound(_0x32e7a1,null))[_0x9ee3('0x15')](function(_0x5a9e12){if(_0x5a9e12&&_0x5a9e12['List']){_0x15ec52=_0x5a9e12;var _0x13b770=_['defaults'](_0x21fb3e['body'],{'firstName':_0x21fb3e[_0x9ee3('0x4f')]['from'],'phone':_0x21fb3e[_0x9ee3('0x4f')]['from'],'ListId':_0x5a9e12[_0x9ee3('0x88')]});_0x13b770[_0x21fb3e[_0x9ee3('0x4f')][_0x9ee3('0xbf')]]=_0x21fb3e[_0x9ee3('0x4f')][_0x9ee3('0x97')];return db[_0x9ee3('0x80')][_0x9ee3('0xc4')]({'where':_0x538bb8,'defaults':_0x13b770});}})[_0x9ee3('0xa9')](function(_0x5bf497){if(_0x5bf497){_0x22ceec=_0x5bf497;var _0x28c083=fs[_0x9ee3('0xc5')](path[_0x9ee3('0x6a')](config[_0x9ee3('0x71')],'server/files/templates/chatOfflineMessage.ejs'),_0x9ee3('0xc6'));var _0x22c2fe=ejs['render'](_0x28c083,{'body':_['toPairs'](_0x21fb3e[_0x9ee3('0x4f')]['body']),'bodyTitle':_0x15ec52[_0x9ee3('0xc7')]});return db[_0x9ee3('0xc8')]['create']({'body':_0x22c2fe,'plainBody':htmlToText[_0x9ee3('0xc9')](_0x22c2fe),'ContactId':_0x5bf497['id'],'ChatWebsiteId':_0x15ec52['id']});}})[_0x9ee3('0x15')](function(_0xaaf16){_0x28af55=_0xaaf16;if(_0x2cdb2d[_0x9ee3('0x3d')]){var _0x1a6f52=_0x2cdb2d[_0x9ee3('0x31')](function(_0x9e4e2){return{'name':_0x9e4e2[_0x9ee3('0xca')],'basename':_0x9e4e2[_0x9ee3('0x63')],'type':_0x9e4e2[_0x9ee3('0xcb')],'ChatOfflineMessageId':_0xaaf16['id']};});_0x2739ed=_0x1a6f52['map'](_0x46adcf=>{var _0xf4beaa={'filename':_0x46adcf[_0x9ee3('0x2c')],'path':path['join'](config[_0x9ee3('0x71')],_0x9ee3('0xcc'),_0x9ee3('0xbd'),_0x9ee3('0xcd'),_0x9ee3('0xce'),_0x46adcf[_0x9ee3('0xcf')])};return _0xf4beaa;});if(!_0x15ec52[_0x9ee3('0xd0')]){return db['sequelize'][_0x9ee3('0xd1')](function(_0x19e5df){return db[_0x9ee3('0xd2')][_0x9ee3('0xd3')](_0x1a6f52,{'transaction':_0x19e5df});});}}})[_0x9ee3('0x15')](function(){if(_0x28af55){_0x41e122=_0x28af55;return db[_0x9ee3('0xc3')][_0x9ee3('0x5a')]({'where':{'active':!![]},'include':[{'model':db[_0x9ee3('0xd4')],'as':_0x9ee3('0xd5'),'raw':!![]}]});}})['then'](function(_0xd6c9f4){if(_0xd6c9f4&&_0xd6c9f4['Smtp']&&_0x15ec52[_0x9ee3('0xd6')]&&_0x15ec52[_0x9ee3('0xd7')]){var _0x397842={'tls':{'rejectUnauthorized':![]}};if(_0xd6c9f4['Smtp'][_0x9ee3('0xd8')]){_0x397842[_0x9ee3('0xd8')]=_0xd6c9f4[_0x9ee3('0xd5')][_0x9ee3('0xd8')];}else{_0x397842['host']=_0xd6c9f4[_0x9ee3('0xd5')][_0x9ee3('0xd9')];_0x397842[_0x9ee3('0xda')]=_0xd6c9f4['Smtp']['port'];_0x397842[_0x9ee3('0xdb')]=_0xd6c9f4[_0x9ee3('0xd5')][_0x9ee3('0xdb')];}if(_0xd6c9f4['Smtp'][_0x9ee3('0xdc')]){_0x397842[_0x9ee3('0xdd')]={'user':_0xd6c9f4[_0x9ee3('0xd5')][_0x9ee3('0x50')],'pass':_0xd6c9f4[_0x9ee3('0xd5')]['pass']};}return respondWithRpcPromise(_0x9ee3('0xde'),_0x9ee3('0xdf'),{'account':_0x397842,'message':{'from':util[_0x9ee3('0xa3')]('\x22%s\x22\x20<%s>',_0xd6c9f4[_0x9ee3('0x2c')],_0xd6c9f4[_0x9ee3('0xe0')]||_0xd6c9f4[_0x9ee3('0xd5')][_0x9ee3('0x50')]),'to':_0x15ec52[_0x9ee3('0xd7')],'subject':_0x15ec52[_0x9ee3('0xe1')],'html':_0x41e122[_0x9ee3('0x4f')],'attachments':_0x2739ed}},client9003)['then'](function(){return _0x41e122;})[_0x9ee3('0x1f')](function(_0x56e70e){console[_0x9ee3('0x1b')](_0x56e70e);});}})[_0x9ee3('0x15')](function(){if(_0x15ec52&&_0x15ec52[_0x9ee3('0xd0')]&&_0x15ec52['MailAccountId']){var _0x3b0294=[];if(_0x2cdb2d[_0x9ee3('0x3d')]){_0x3b0294=_0x2cdb2d[_0x9ee3('0x31')](function(_0x3a539c){return{'name':_0x3a539c[_0x9ee3('0xca')],'basename':_0x3a539c[_0x9ee3('0x63')],'type':_0x3a539c[_0x9ee3('0xcb')],'ChatOfflineMessageId':_0x28af55['id']};});}var _0x66e068;if(!_[_0x9ee3('0x72')](_0x15ec52['subjectOffline'])){var _0x2317c9=_[_0x9ee3('0x31')](_0x21fb3e[_0x9ee3('0x4f')],function(_0x404920){return _0x404920;});var _0x1d31ba=_[_0x9ee3('0xe2')](_0x2317c9)[0x0];var _0x4e89e4=_['mapValues'](_0x1d31ba,function(_0x3d0cc4){return _0x3d0cc4;});_0x66e068=_0x4e89e4[0x1][_0x15ec52['subjectOffline']];}var _0x1a2e18={'from':_0x22ceec[_0x9ee3('0xe0')],'firstName':_0x22ceec[_0x9ee3('0x9d')],'lastName':_0x22ceec[_0x9ee3('0xab')],'mapKey':'email','message':{'from':_0x22ceec[_0x9ee3('0xe0')],'to':_0x15ec52[_0x9ee3('0xc3')]['email'],'cc':'','subject':_[_0x9ee3('0x72')](_0x66e068)?_0x15ec52[_0x9ee3('0xe1')]:_0x66e068,'messageId':'','sentAt':new Date(),'attach':_0x3b0294[_0x9ee3('0x3d')],'attachments':_0x3b0294,'originChannel':'Chat','ChatWebsiteId':_0x15ec52['id'],'ChatOfflineMessageId':_0x41e122['id'],'originTo':_0x15ec52[_0x9ee3('0xc3')][_0x9ee3('0xe0')]},'body':_0x41e122['body']};var _0x3401ef={'account':{'id':_0x15ec52[_0x9ee3('0xe3')]},'body':_0x1a2e18,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x9ee3('0xe4'),_0x3401ef,client9001)[_0x9ee3('0x15')](function(){return _0x41e122;})[_0x9ee3('0x1f')](function(_0x2a6f61){console[_0x9ee3('0x1b')](_0x2a6f61);});}return;})['then'](function(){if(_0x41e122){return _0x41e122;}})[_0x9ee3('0x15')](respondWithResult(_0x32e7a1,null))[_0x9ee3('0x1f')](function(_0x2e15f7){console['error']('catch',_0x2e15f7);for(var _0x564a73 of _0x2cdb2d){var _0x1b6c56=path[_0x9ee3('0x6a')](config[_0x9ee3('0x71')],_0x9ee3('0xcc'),_0x9ee3('0xbd'),_0x9ee3('0xcd'),'offline-chat',_0x564a73[_0x9ee3('0x63')]);fs_extra[_0x9ee3('0xe5')](_0x1b6c56)[_0x9ee3('0x1f')](function(_0xbae2f5){console[_0x9ee3('0x1b')](_0x9ee3('0xe6'),_0x1b6c56,_0xbae2f5);});}});};exports[_0x9ee3('0xe7')]=function(_0x31f05b,_0x298b33){return db['ChatInteraction'][_0x9ee3('0x4d')]({'where':{'id':_0x31f05b[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x298b33,null))[_0x9ee3('0x15')](function(_0x3bd883){if(_0x3bd883){return _0x3bd883[_0x9ee3('0xe7')](_0x31f05b[_0x9ee3('0x4f')]['ids'],_[_0x9ee3('0xe8')](_0x31f05b[_0x9ee3('0x4f')],[_0x9ee3('0x5d'),'id'])||{});}})[_0x9ee3('0x15')](respondWithResult(_0x298b33,null))[_0x9ee3('0x1f')](handleError(_0x298b33,null));};exports[_0x9ee3('0xe9')]=function(_0x5131a8,_0x31e441){var _0x488a13={'raw':![],'where':{}};var _0x44f172={};var _0x39b7ad={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9ee3('0x5a')]({'where':{'id':_0x5131a8[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x31e441,null))['then'](function(_0x3f7f16){if(_0x3f7f16){_0x44f172[_0x9ee3('0x37')]=_[_0x9ee3('0x39')](db['ChatInteraction'][_0x9ee3('0x33')]);_0x44f172[_0x9ee3('0x38')]=_[_0x9ee3('0x39')](_0x5131a8['query']);_0x44f172[_0x9ee3('0x43')]=_['intersection'](_0x44f172['model'],_0x44f172[_0x9ee3('0x38')]);_0x488a13[_0x9ee3('0x3b')]=_[_0x9ee3('0x3a')](_0x44f172[_0x9ee3('0x37')],qs['fields'](_0x5131a8['query'][_0x9ee3('0x3c')]));_0x488a13[_0x9ee3('0x3b')]=_0x488a13[_0x9ee3('0x3b')][_0x9ee3('0x3d')]?_0x488a13['attributes']:_0x44f172['model'];if(!_0x5131a8[_0x9ee3('0x38')][_0x9ee3('0x3e')](_0x9ee3('0x3f'))){_0x488a13[_0x9ee3('0x25')]=qs['limit'](_0x5131a8[_0x9ee3('0x38')][_0x9ee3('0x25')]);_0x488a13[_0x9ee3('0x23')]=qs['offset'](_0x5131a8['query'][_0x9ee3('0x23')]);}_0x488a13[_0x9ee3('0x40')]=qs[_0x9ee3('0x41')](_0x5131a8[_0x9ee3('0x38')]['sort']);_0x488a13[_0x9ee3('0x42')]=qs['filters'](_[_0x9ee3('0x44')](_0x5131a8[_0x9ee3('0x38')],_0x44f172[_0x9ee3('0x43')]));_0x488a13[_0x9ee3('0x42')][_0x9ee3('0x58')]=_0x3f7f16['id'];if(_0x5131a8[_0x9ee3('0x38')]['filter']){_0x488a13[_0x9ee3('0x42')]=_[_0x9ee3('0x46')](_0x488a13['where'],{'$or':_['map'](_0x488a13[_0x9ee3('0x3b')],function(_0x34435d){var _0x36e571={};_0x36e571[_0x34435d]={'$like':'%'+_0x5131a8['query'][_0x9ee3('0x45')]+'%'};return _0x36e571;})});}_0x488a13=_['merge']({},_0x488a13,_0x5131a8[_0x9ee3('0x5b')]);return db[_0x9ee3('0xa6')]['count']({'where':_0x488a13[_0x9ee3('0x42')]})[_0x9ee3('0x15')](function(_0x274c0c){_0x39b7ad[_0x9ee3('0x26')]=_0x274c0c;if(_0x5131a8[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0x488a13['include']=[{'model':db[_0x9ee3('0x80')],'as':'Contact','required':![]},{'model':db[_0x9ee3('0xb4')],'as':'Owner','attributes':[_0x9ee3('0x2c'),'fullname',_0x9ee3('0xea')],'required':![]},{'model':db[_0x9ee3('0xeb')],'as':_0x9ee3('0xec'),'attributes':['id',_0x9ee3('0x2c'),_0x9ee3('0xed')],'where':_0x5131a8[_0x9ee3('0x38')][_0x9ee3('0xee')]?{'id':_0x5131a8[_0x9ee3('0x38')][_0x9ee3('0xee')]}:undefined,'required':_0x5131a8['query']['tag']?!![]:![]}];}return db[_0x9ee3('0xa6')][_0x9ee3('0x49')](_0x488a13);})[_0x9ee3('0x15')](function(_0x12cc20){_0x39b7ad[_0x9ee3('0x4a')]=_0x12cc20;return _0x39b7ad;});}})[_0x9ee3('0x15')](respondWithFilteredResult(_0x31e441,_0x488a13))[_0x9ee3('0x1f')](handleError(_0x31e441,null));};function iftimePromise(_0x1cd276,_0x36bc22){return respondWithRpcPromise(_0x9ee3('0xef'),_0x9ee3('0xf0'),{'command':_0x36bc22[_0x9ee3('0xf1')]?util['format'](_0x9ee3('0xf2'),_0x1cd276[_0x9ee3('0xf3')],_0x36bc22[_0x9ee3('0xf1')]):util['format'](_0x9ee3('0xf4'),_0x1cd276[_0x9ee3('0xf3')])},client9002)['then'](function(_0x11c316){var _0x2590ca=_0x11c316&&_0x11c316['indexOf'](_0x9ee3('0xf5'))>=0x0?!![]:![];logger[_0x9ee3('0x16')](_0x9ee3('0xf6'),_0x36bc22['id'],_0x1cd276['id'],_0x1cd276['interval'],_0x2590ca?_0x9ee3('0xf7'):_0x9ee3('0xf8'),_0x36bc22[_0x9ee3('0xf1')]?_0x36bc22[_0x9ee3('0xf1')]:_0x9ee3('0xf9'));return _0x2590ca;})[_0x9ee3('0x1f')](function(_0x4dc643){logger[_0x9ee3('0x1b')](_0x9ee3('0xf6'),_0x36bc22['id'],_0x1cd276['id'],_0x1cd276[_0x9ee3('0xf3')],util[_0x9ee3('0xfa')](_0x4dc643,{'showHidden':![],'depth':null}),_0x36bc22[_0x9ee3('0xf1')]?_0x36bc22['timezone']:_0x9ee3('0xf9'));return![];});}exports[_0x9ee3('0xf0')]=function(_0x25180d,_0x5488ed){var _0xd37a1d=0x0;var _0x3bf58a=0x0;var _0x3072b1=![];var _0x5c3876;var _0x178b70;return db['ChatWebsite']['find']({'where':{'id':_0x25180d[_0x9ee3('0x4c')]['id']},'include':[{'model':db[_0x9ee3('0xfb')],'as':_0x9ee3('0xfb'),'include':[{'model':db[_0x9ee3('0xfb')],'as':_0x9ee3('0xfc'),'attributes':['id',_0x9ee3('0xf3')],'raw':!![]}]}]})[_0x9ee3('0x15')](handleEntityNotFound(_0x5488ed,null))[_0x9ee3('0x15')](function(_0x1559c8){if(_0x1559c8){_0x5c3876=_0x1559c8;return _0x1559c8['getProactiveActions']({'raw':!![]});}})[_0x9ee3('0x15')](function(_0x2e0656){if(_0x5c3876){if(_0x2e0656){_0x178b70=_0x2e0656;}}return require(_0x9ee3('0xfd'))[_0x9ee3('0x6c')]();})[_0x9ee3('0x15')](function(_0xc263ad){if(_0xc263ad){_0x3bf58a=_0xc263ad[_0x9ee3('0xfe')];_0x3072b1=_0xc263ad[_0x9ee3('0x6d')];}})[_0x9ee3('0x15')](function(){return db[_0x9ee3('0xa6')][_0x9ee3('0x26')]({'where':{'closed':![]}});})[_0x9ee3('0x15')](function(_0x4cf056){_0xd37a1d=_0x4cf056;if(_0x3bf58a&&_0x4cf056>_0x3bf58a){return db[_0x9ee3('0xff')][_0x9ee3('0x5a')]({'where':{'id':0x1}})[_0x9ee3('0x15')](function(_0x3c9a27){if(_0x3c9a27){_0x3c9a27[_0x9ee3('0x100')](_0x9ee3('0x101'));}});}})[_0x9ee3('0x15')](function(){if(_0x5c3876[_0x9ee3('0xfb')]&&_0x5c3876[_0x9ee3('0xfb')][_0x9ee3('0xfc')]){var _0x18a931=[];for(var _0x1e1edf=0x0;_0x1e1edf<_0x5c3876[_0x9ee3('0xfb')][_0x9ee3('0xfc')][_0x9ee3('0x3d')];_0x1e1edf++){var _0x5bb596=_0x5c3876[_0x9ee3('0xfb')][_0x9ee3('0xfc')][_0x1e1edf][_0x9ee3('0x29')]({'plain':!![]});_0x18a931['push'](iftimePromise(_0x5bb596,_0x5c3876));}return BPromise['all'](_0x18a931)['then'](function(_0x4014d9){return _['some'](_0x4014d9);});}else{return!![];}})[_0x9ee3('0x15')](function(_0xd923a4){var _0x1b4226=fs[_0x9ee3('0xc5')](path['join'](config[_0x9ee3('0x71')],_0x9ee3('0x102')),'utf8');var _0x4061e1={'remote':_0x5c3876[_0x9ee3('0x103')],'query':querystring[_0x9ee3('0x1a')](_[_0x9ee3('0x46')](_0x5c3876['get']({'plain':!![]}),{'customerIp':_0x25180d[_0x9ee3('0x7d')][_0x9ee3('0x9a')]||_0x25180d['headers']['x-real-ip']||_0x25180d[_0x9ee3('0x104')]['remoteAddress']||_0x25180d['ip'],'referer':_0x25180d[_0x9ee3('0x7d')][_0x9ee3('0x105')],'openedInteractions':_0xd37a1d,'maxInteractions':_0x3bf58a,'virtual':_0x3072b1['virtual'],'online':_0xd923a4,'custom':_0x3072b1}))[_0x9ee3('0x106')](/'/g,'\x5c\x27')};_0x5488ed[_0x9ee3('0x2d')](ejs[_0x9ee3('0x107')](Mustache[_0x9ee3('0x107')](_0x1b4226,_0x4061e1),{'proactiveActions':_0x178b70,'alignment':_0x5c3876[_0x9ee3('0x108')],'verticalAlignment':_0x5c3876['verticalAlignment'],'div_color':_0x5c3876[_0x9ee3('0xed')],'labelText':_0x5c3876['labelText'],'text_color':_0x5c3876[_0x9ee3('0x109')],'button_color':_0x5c3876[_0x9ee3('0x10a')],'background_color':_0x5c3876['backgroundColor'],'hideWhenOffline':_0x5c3876[_0x9ee3('0x10b')],'interval':_0x5c3876[_0x9ee3('0x10c')]}));})[_0x9ee3('0x1f')](handleError(_0x5488ed,null));};exports[_0x9ee3('0x10d')]=function(_0x83affe,_0x1da5c5){var _0x4e286d=_0x83affe[_0x9ee3('0x4c')]['id'];var _0x37c94f=_0x83affe['body'];var _0x174858=0xc8;var _0xed25b=null;return db[_0x9ee3('0x10e')]['transaction']({'isolationLevel':db[_0x9ee3('0x10e')]['Transaction'][_0x9ee3('0x10f')][_0x9ee3('0x110')]},function(_0x2f2cae){return db[_0x9ee3('0x32')][_0x9ee3('0x5a')]({'where':{'id':_0x4e286d},'transaction':_0x2f2cae})['then'](function(_0x4d1a0a){if(_0x4d1a0a){return db[_0x9ee3('0x91')][_0x9ee3('0x28')]({'where':{'ChatWebsiteId':_0x4e286d},'transaction':_0x2f2cae})[_0x9ee3('0x15')](function(){var _0x2e7c8e=_[_0x9ee3('0x31')](_0x37c94f,function(_0x57e817){_0x57e817[_0x9ee3('0x58')]=_0x4e286d;return _0x57e817;});return db[_0x9ee3('0x91')][_0x9ee3('0xd3')](_0x2e7c8e,{'transaction':_0x2f2cae});});}else{_0x174858=0x194;_0xed25b=[];}});})['then'](function(){if(_0x174858!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x4e286d},'order':_0x9ee3('0x111')})[_0x9ee3('0x15')](function(_0x52b796){_0xed25b=_0x52b796;});}})['catch'](function(_0x5ebba2){_0x174858=0x1f4;logger[_0x9ee3('0x1b')](_0x5ebba2[_0x9ee3('0x112')]);if(_0x5ebba2[_0x9ee3('0x2c')]){delete _0x5ebba2[_0x9ee3('0x2c')];}_0xed25b=_0x5ebba2;})[_0x9ee3('0x113')](function(){if(_0xed25b===null){_0x1da5c5[_0x9ee3('0x20')](_0x174858);}else{if(_0x174858===0x1f4){_0x1da5c5['status'](_0x174858)[_0x9ee3('0x2d')](_0xed25b);}else{_0x1da5c5[_0x9ee3('0x21')](_0x174858)[_0x9ee3('0x22')](_0xed25b);}}});};exports['getApplications']=function(_0x36d9d7,_0x137e0a){var _0x431fe9={};var _0x3ec662={};var _0xccb0b4;var _0x534888;return db['ChatWebsite']['findOne']({'where':{'id':_0x36d9d7[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x137e0a,null))[_0x9ee3('0x15')](function(_0x2ce055){if(_0x2ce055){_0xccb0b4=_0x2ce055;_0x3ec662['model']=_[_0x9ee3('0x39')](db[_0x9ee3('0x91')][_0x9ee3('0x33')]);_0x3ec662[_0x9ee3('0x38')]=_['keys'](_0x36d9d7['query']);_0x3ec662[_0x9ee3('0x43')]=_[_0x9ee3('0x3a')](_0x3ec662[_0x9ee3('0x37')],_0x3ec662[_0x9ee3('0x38')]);_0x431fe9[_0x9ee3('0x3b')]=_[_0x9ee3('0x3a')](_0x3ec662[_0x9ee3('0x37')],qs[_0x9ee3('0x3c')](_0x36d9d7[_0x9ee3('0x38')][_0x9ee3('0x3c')]));_0x431fe9[_0x9ee3('0x3b')]=_0x431fe9[_0x9ee3('0x3b')][_0x9ee3('0x3d')]?_0x431fe9['attributes']:_0x3ec662[_0x9ee3('0x37')];_0x431fe9['order']=qs[_0x9ee3('0x41')](_0x36d9d7[_0x9ee3('0x38')]['sort']);_0x431fe9[_0x9ee3('0x42')]=qs['filters'](_[_0x9ee3('0x44')](_0x36d9d7[_0x9ee3('0x38')],_0x3ec662[_0x9ee3('0x43')]));if(_0x36d9d7[_0x9ee3('0x38')]['filter']){_0x431fe9[_0x9ee3('0x42')]=_['merge'](_0x431fe9[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x431fe9[_0x9ee3('0x3b')],function(_0x632fbc){var _0x58078b={};_0x58078b[_0x632fbc]={'$like':'%'+_0x36d9d7[_0x9ee3('0x38')][_0x9ee3('0x45')]+'%'};return _0x58078b;})});}_0x431fe9=_['merge']({},_0x431fe9,_0x36d9d7['options']);return _0xccb0b4[_0x9ee3('0x114')](_0x431fe9);}})[_0x9ee3('0x15')](function(_0x5cb76e){if(_0x5cb76e){_0x534888=_0x5cb76e[_0x9ee3('0x3d')];if(!_0x36d9d7[_0x9ee3('0x38')][_0x9ee3('0x3e')]('nolimit')){_0x431fe9[_0x9ee3('0x25')]=qs[_0x9ee3('0x25')](_0x36d9d7[_0x9ee3('0x38')]['limit']);_0x431fe9[_0x9ee3('0x23')]=qs[_0x9ee3('0x23')](_0x36d9d7[_0x9ee3('0x38')][_0x9ee3('0x23')]);}return _0xccb0b4[_0x9ee3('0x114')](_0x431fe9);}})[_0x9ee3('0x15')](function(_0xa221a9){if(_0xa221a9){return _0xa221a9?{'count':_0x534888,'rows':_0xa221a9}:null;}})['then'](respondWithResult(_0x137e0a,null))[_0x9ee3('0x1f')](handleError(_0x137e0a,null));};exports[_0x9ee3('0x115')]=function(_0x18bf92,_0x29ace0){return db['chatProactiveAction']['find']({'where':{'id':_0x18bf92[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x29ace0,null))['then'](function(_0x171db7){if(_0x171db7){return _0x171db7['addProactiveActions'](_0x18bf92[_0x9ee3('0x4f')][_0x9ee3('0x5d')],_[_0x9ee3('0xe8')](_0x18bf92[_0x9ee3('0x4f')],[_0x9ee3('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x29ace0,null))[_0x9ee3('0x1f')](handleError(_0x29ace0,null));};exports[_0x9ee3('0x116')]=function(_0x3fe8b4,_0x259dce){var _0x284012={};var _0x111b9d={};var _0x5f343a;var _0x12d4dd;return db['ChatWebsite']['findOne']({'where':{'id':_0x3fe8b4[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x259dce,null))[_0x9ee3('0x15')](function(_0x5e477f){if(_0x5e477f){_0x5f343a=_0x5e477f;_0x111b9d[_0x9ee3('0x37')]=_['keys'](db['ChatProactiveAction'][_0x9ee3('0x33')]);_0x111b9d['query']=_['keys'](_0x3fe8b4[_0x9ee3('0x38')]);_0x111b9d[_0x9ee3('0x43')]=_['intersection'](_0x111b9d[_0x9ee3('0x37')],_0x111b9d['query']);_0x284012['attributes']=_[_0x9ee3('0x3a')](_0x111b9d[_0x9ee3('0x37')],qs['fields'](_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x3c')]));_0x284012[_0x9ee3('0x3b')]=_0x284012[_0x9ee3('0x3b')][_0x9ee3('0x3d')]?_0x284012[_0x9ee3('0x3b')]:_0x111b9d[_0x9ee3('0x37')];_0x284012['order']=qs[_0x9ee3('0x41')](_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x41')]);_0x284012['where']=qs[_0x9ee3('0x43')](_[_0x9ee3('0x44')](_0x3fe8b4['query'],_0x111b9d[_0x9ee3('0x43')]));if(_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x45')]){_0x284012[_0x9ee3('0x42')]=_[_0x9ee3('0x46')](_0x284012[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x284012['attributes'],function(_0x2ff7cb){var _0x158677={};_0x158677[_0x2ff7cb]={'$like':'%'+_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x45')]+'%'};return _0x158677;})});}_0x284012=_['merge']({},_0x284012,_0x3fe8b4[_0x9ee3('0x5b')]);return _0x5f343a[_0x9ee3('0x116')](_0x284012);}})['then'](function(_0x503a21){if(_0x503a21){_0x12d4dd=_0x503a21[_0x9ee3('0x3d')];if(!_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x3e')]('nolimit')){_0x284012['limit']=qs['limit'](_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x25')]);_0x284012['offset']=qs[_0x9ee3('0x23')](_0x3fe8b4[_0x9ee3('0x38')][_0x9ee3('0x23')]);}return _0x5f343a[_0x9ee3('0x116')](_0x284012);}})[_0x9ee3('0x15')](function(_0x33a14c){if(_0x33a14c){return _0x33a14c?{'count':_0x12d4dd,'rows':_0x33a14c}:null;}})['then'](respondWithResult(_0x259dce,null))[_0x9ee3('0x1f')](handleError(_0x259dce,null));};exports[_0x9ee3('0x117')]=function(_0x5dbc0,_0x74f91e){var _0x2ef216=_0x5dbc0[_0x9ee3('0x38')][_0x9ee3('0x118')]===_0x9ee3('0x119')?'offlineForm':_0x9ee3('0x11a');return db[_0x9ee3('0x32')][_0x9ee3('0x4d')]({'attributes':['id',_0x2ef216],'where':{'id':_0x5dbc0[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x74f91e,null))[_0x9ee3('0x15')](function(_0x35807d){if(_0x35807d){var _0x3ddc10=_0x35807d[_0x2ef216];var _0x1bd134=_0x3ddc10&&_0x3ddc10[_0x9ee3('0x11b')]?_0x3ddc10[_0x9ee3('0x11b')]:[];_0x74f91e['send']({'fromKey':_['isNil'](_0x3ddc10[_0x9ee3('0x11c')])?undefined:_0x3ddc10[_0x9ee3('0x11c')],'count':_0x1bd134[_0x9ee3('0x3d')],'rows':_0x1bd134});}})[_0x9ee3('0x1f')](handleError(_0x74f91e,null));};exports[_0x9ee3('0x11d')]=function(_0x4537e4,_0x254e94){var _0x287028={'raw':![],'where':{}};var _0x4b1eb5={};var _0x1fda13={'count':0x0,'rows':[]};return db[_0x9ee3('0x32')][_0x9ee3('0x5a')]({'where':{'id':_0x4537e4['params']['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x254e94,null))[_0x9ee3('0x15')](function(_0x23d7a1){if(_0x23d7a1){_0x4b1eb5['model']=_[_0x9ee3('0x39')](db[_0x9ee3('0xc8')]['rawAttributes']);_0x4b1eb5[_0x9ee3('0x38')]=_[_0x9ee3('0x39')](_0x4537e4[_0x9ee3('0x38')]);_0x4b1eb5[_0x9ee3('0x43')]=_['intersection'](_0x4b1eb5[_0x9ee3('0x37')],_0x4b1eb5['query']);_0x287028[_0x9ee3('0x3b')]=_[_0x9ee3('0x3a')](_0x4b1eb5[_0x9ee3('0x37')],qs[_0x9ee3('0x3c')](_0x4537e4[_0x9ee3('0x38')][_0x9ee3('0x3c')]));_0x287028['attributes']=_0x287028[_0x9ee3('0x3b')][_0x9ee3('0x3d')]?_0x287028[_0x9ee3('0x3b')]:_0x4b1eb5[_0x9ee3('0x37')];if(!_0x4537e4[_0x9ee3('0x38')][_0x9ee3('0x3e')](_0x9ee3('0x3f'))){_0x287028[_0x9ee3('0x25')]=qs[_0x9ee3('0x25')](_0x4537e4['query'][_0x9ee3('0x25')]);_0x287028['offset']=qs[_0x9ee3('0x23')](_0x4537e4['query'][_0x9ee3('0x23')]);}_0x287028[_0x9ee3('0x40')]=qs[_0x9ee3('0x41')](_0x4537e4['query'][_0x9ee3('0x41')]);_0x287028[_0x9ee3('0x42')]=qs['filters'](_[_0x9ee3('0x44')](_0x4537e4[_0x9ee3('0x38')],_0x4b1eb5[_0x9ee3('0x43')]));_0x287028[_0x9ee3('0x42')][_0x9ee3('0x58')]=_0x23d7a1['id'];if(_0x4537e4[_0x9ee3('0x38')][_0x9ee3('0x45')]){_0x287028['where']=_[_0x9ee3('0x46')](_0x287028[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x287028[_0x9ee3('0x3b')],function(_0x5cf7e4){var _0x4588cd={};_0x4588cd[_0x5cf7e4]={'$like':'%'+_0x4537e4[_0x9ee3('0x38')][_0x9ee3('0x45')]+'%'};return _0x4588cd;})});}_0x287028=_['merge']({},_0x287028,_0x4537e4[_0x9ee3('0x5b')]);return db[_0x9ee3('0xc8')][_0x9ee3('0x26')]({'where':_0x287028[_0x9ee3('0x42')]})['then'](function(_0x36f520){_0x1fda13[_0x9ee3('0x26')]=_0x36f520;if(_0x4537e4[_0x9ee3('0x38')][_0x9ee3('0x47')]){_0x287028[_0x9ee3('0x48')]=[{'all':!![]}];}else{_0x287028[_0x9ee3('0x48')]=[{'model':db[_0x9ee3('0x80')],'as':_0x9ee3('0x11e'),'required':![]},{'model':db['Attachment'],'as':_0x9ee3('0x11f'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x287028);})[_0x9ee3('0x15')](function(_0x9516de){_0x1fda13['rows']=_0x9516de;return _0x1fda13;});}})[_0x9ee3('0x15')](respondWithFilteredResult(_0x254e94,_0x287028))[_0x9ee3('0x1f')](handleError(_0x254e94,null));};exports['addAgents']=function(_0x182ee3,_0x545376){return db['ChatWebsite'][_0x9ee3('0x4d')]({'where':{'id':_0x182ee3[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x545376,null))['then'](function(_0x401a12){if(_0x401a12){return _0x401a12[_0x9ee3('0x120')](_0x182ee3[_0x9ee3('0x4f')][_0x9ee3('0x5d')],_[_0x9ee3('0xe8')](_0x182ee3[_0x9ee3('0x4f')],[_0x9ee3('0x5d'),'id'])||{})['spread'](function(_0x3f54e6){for(var _0xf1893c=0x0;_0xf1893c<_0x182ee3['body'][_0x9ee3('0x5d')]['length'];_0xf1893c+=0x1){socket[_0x9ee3('0x121')](_0x9ee3('0x122'),{'UserId':Number(_0x182ee3[_0x9ee3('0x4f')]['ids'][_0xf1893c]),'ChatWebsiteId':Number(_0x182ee3[_0x9ee3('0x4c')]['id'])});}return _0x3f54e6;});}})['then'](respondWithResult(_0x545376,null))[_0x9ee3('0x1f')](handleError(_0x545376,null));};exports[_0x9ee3('0x123')]=function(_0x471d48,_0x180eac){return db['ChatWebsite'][_0x9ee3('0x4d')]({'where':{'id':_0x471d48['params']['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x180eac,null))[_0x9ee3('0x15')](function(_0x359bdb){if(_0x359bdb){return _0x359bdb['removeAgents'](_0x471d48[_0x9ee3('0x38')][_0x9ee3('0x5d')])['then'](function(){if(_[_0x9ee3('0x124')](_0x471d48[_0x9ee3('0x38')][_0x9ee3('0x5d')])){for(var _0x252fc1=0x0;_0x252fc1<_0x471d48[_0x9ee3('0x38')][_0x9ee3('0x5d')][_0x9ee3('0x3d')];_0x252fc1+=0x1){socket[_0x9ee3('0x121')](_0x9ee3('0x125'),{'UserId':Number(_0x471d48[_0x9ee3('0x38')][_0x9ee3('0x5d')][_0x252fc1]),'ChatWebsiteId':Number(_0x471d48['params']['id'])});}}else{socket[_0x9ee3('0x121')](_0x9ee3('0x125'),{'UserId':Number(_0x471d48[_0x9ee3('0x38')][_0x9ee3('0x5d')]),'ChatWebsiteId':Number(_0x471d48[_0x9ee3('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x180eac,null))[_0x9ee3('0x1f')](handleError(_0x180eac,null));};exports[_0x9ee3('0x126')]=function(_0x4f9f2f,_0x5e3d1b){var _0x324c70={};var _0x50263a={};var _0x4fbc4d;var _0x5c8619;return db['ChatWebsite'][_0x9ee3('0x5a')]({'where':{'id':_0x4f9f2f[_0x9ee3('0x4c')]['id']}})[_0x9ee3('0x15')](handleEntityNotFound(_0x5e3d1b,null))[_0x9ee3('0x15')](function(_0x42ff70){if(_0x42ff70){_0x4fbc4d=_0x42ff70;_0x50263a[_0x9ee3('0x37')]=_[_0x9ee3('0x39')](db[_0x9ee3('0xb4')]['rawAttributes']);_0x50263a['query']=_['keys'](_0x4f9f2f[_0x9ee3('0x38')]);_0x50263a['filters']=_[_0x9ee3('0x3a')](_0x50263a['model'],_0x50263a[_0x9ee3('0x38')]);_0x324c70[_0x9ee3('0x3b')]=_['intersection'](_0x50263a['model'],qs[_0x9ee3('0x3c')](_0x4f9f2f['query']['fields']));_0x324c70['attributes']=_0x324c70[_0x9ee3('0x3b')]['length']?_0x324c70[_0x9ee3('0x3b')]:_0x50263a['model'];_0x324c70[_0x9ee3('0x40')]=qs[_0x9ee3('0x41')](_0x4f9f2f[_0x9ee3('0x38')][_0x9ee3('0x41')]);_0x324c70[_0x9ee3('0x42')]=qs[_0x9ee3('0x43')](_[_0x9ee3('0x44')](_0x4f9f2f[_0x9ee3('0x38')],_0x50263a[_0x9ee3('0x43')]));if(_0x4f9f2f[_0x9ee3('0x38')][_0x9ee3('0x45')]){_0x324c70['where']=_[_0x9ee3('0x46')](_0x324c70[_0x9ee3('0x42')],{'$or':_[_0x9ee3('0x31')](_0x324c70[_0x9ee3('0x3b')],function(_0x18883a){var _0x40d0d0={};_0x40d0d0[_0x18883a]={'$like':'%'+_0x4f9f2f['query'][_0x9ee3('0x45')]+'%'};return _0x40d0d0;})});}_0x324c70=_[_0x9ee3('0x46')]({},_0x324c70,_0x4f9f2f[_0x9ee3('0x5b')]);return _0x4fbc4d[_0x9ee3('0x126')](_0x324c70);}})['then'](function(_0x2ab09d){if(_0x2ab09d){_0x5c8619=_0x2ab09d[_0x9ee3('0x3d')];if(!_0x4f9f2f['query'][_0x9ee3('0x3e')](_0x9ee3('0x3f'))){_0x324c70['limit']=qs['limit'](_0x4f9f2f[_0x9ee3('0x38')][_0x9ee3('0x25')]);_0x324c70['offset']=qs[_0x9ee3('0x23')](_0x4f9f2f[_0x9ee3('0x38')][_0x9ee3('0x23')]);}return _0x4fbc4d[_0x9ee3('0x126')](_0x324c70);}})[_0x9ee3('0x15')](function(_0x4831a3){if(_0x4831a3){return _0x4831a3?{'count':_0x5c8619,'rows':_0x4831a3}:null;}})[_0x9ee3('0x15')](respondWithResult(_0x5e3d1b,null))[_0x9ee3('0x1f')](handleError(_0x5e3d1b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index edfea2c..a533d67 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 _0xac9d=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0xac9d,0x14d));var _0xdac9=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xac9d[_0x478c8a];return _0x3b6b3e;};'use strict';var EventEmitter=require(_0xdac9('0x0'));var ChatWebsite=require(_0xdac9('0x1'))['db'][_0xdac9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdac9('0x3')](0x0);var events={'afterCreate':_0xdac9('0x4'),'afterUpdate':_0xdac9('0x5'),'afterDestroy':_0xdac9('0x6')};function emitEvent(_0x1b967e){return function(_0x51a5d7,_0x1c17a6,_0x5a984a){ChatWebsiteEvents[_0xdac9('0x7')](_0x1b967e+':'+_0x51a5d7['id'],_0x51a5d7);ChatWebsiteEvents[_0xdac9('0x7')](_0x1b967e,_0x51a5d7);_0x5a984a(null);};}for(var e in events){if(events[_0xdac9('0x8')](e)){var event=events[e];ChatWebsite[_0xdac9('0x9')](e,emitEvent(event));}}module[_0xdac9('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6dfa=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x530a37,_0x524809){var _0x1b19f8=function(_0x5a834e){while(--_0x5a834e){_0x530a37['push'](_0x530a37['shift']());}};_0x1b19f8(++_0x524809);}(_0x6dfa,0x7b));var _0xa6df=function(_0x4eef7b,_0x30c9b0){_0x4eef7b=_0x4eef7b-0x0;var _0x563d1e=_0x6dfa[_0x4eef7b];return _0x563d1e;};'use strict';var EventEmitter=require(_0xa6df('0x0'));var ChatWebsite=require(_0xa6df('0x1'))['db'][_0xa6df('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa6df('0x3')](0x0);var events={'afterCreate':_0xa6df('0x4'),'afterUpdate':'update','afterDestroy':_0xa6df('0x5')};function emitEvent(_0x4e356f){return function(_0x2ea163,_0x4da450,_0x5b92a8){ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f+':'+_0x2ea163['id'],_0x2ea163);ChatWebsiteEvents[_0xa6df('0x6')](_0x4e356f,_0x2ea163);_0x5b92a8(null);};}for(var e in events){if(events[_0xa6df('0x7')](e)){var event=events[e];ChatWebsite[_0xa6df('0x8')](e,emitEvent(event));}}module[_0xa6df('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 3f4636e..89f7919 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 _0x7b03=['request-promise','path','../../config/environment','exports','define','ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird'];(function(_0x3dc4d6,_0x52fdf3){var _0x37f277=function(_0x10ffcd){while(--_0x10ffcd){_0x3dc4d6['push'](_0x3dc4d6['shift']());}};_0x37f277(++_0x52fdf3);}(_0x7b03,0x1d5));var _0x37b0=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0x7b03[_0x241eb9];return _0x4f916b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x37b0('0x0'))(_0x37b0('0x1'));var moment=require(_0x37b0('0x2'));var BPromise=require(_0x37b0('0x3'));var rp=require(_0x37b0('0x4'));var fs=require('fs');var path=require(_0x37b0('0x5'));var rimraf=require('rimraf');var config=require(_0x37b0('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x37b0('0x7')]=function(_0x3659ad,_0x87f451){return _0x3659ad[_0x37b0('0x8')](_0x37b0('0x9'),attributes,{'tableName':_0x37b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44cf=['../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','moment','bluebird','request-promise','rimraf'];(function(_0x2ba028,_0x47cccb){var _0x40e828=function(_0x6ac414){while(--_0x6ac414){_0x2ba028['push'](_0x2ba028['shift']());}};_0x40e828(++_0x47cccb);}(_0x44cf,0x18b));var _0xf44c=function(_0xca8a63,_0x33b892){_0xca8a63=_0xca8a63-0x0;var _0x5eaf5f=_0x44cf[_0xca8a63];return _0x5eaf5f;};'use strict';var _=require(_0xf44c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf44c('0x1'));var BPromise=require(_0xf44c('0x2'));var rp=require(_0xf44c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf44c('0x4'));var config=require(_0xf44c('0x5'));var attributes=require(_0xf44c('0x6'));module[_0xf44c('0x7')]=function(_0x192026,_0x289a78){return _0x192026['define'](_0xf44c('0x8'),attributes,{'tableName':_0xf44c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 33ec7b8..4032865 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 _0x52b8=['localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0x52b8,0x13c));var _0x852b=function(_0xe806dc,_0x8b2fd1){_0xe806dc=_0xe806dc-0x0;var _0x15a396=_0x52b8[_0xe806dc];return _0x15a396;};'use strict';var _=require(_0x852b('0x0'));var util=require(_0x852b('0x1'));var moment=require(_0x852b('0x2'));var BPromise=require(_0x852b('0x3'));var rs=require(_0x852b('0x4'));var fs=require('fs');var Redis=require(_0x852b('0x5'));var db=require(_0x852b('0x6'))['db'];var utils=require(_0x852b('0x7'));var logger=require(_0x852b('0x8'))(_0x852b('0x9'));var config=require('../../config/environment');var jayson=require(_0x852b('0xa'));var client=jayson[_0x852b('0xb')]['http']({'port':0x232a});config[_0x852b('0xc')]=_[_0x852b('0xd')](config[_0x852b('0xc')],{'host':_0x852b('0xe'),'port':0x18eb});var socket=require(_0x852b('0xf'))(new Redis(config[_0x852b('0xc')]));require(_0x852b('0x10'))[_0x852b('0x11')](socket);function respondWithRpcPromise(_0xf0952b,_0x36dd72,_0x56ac15){return new BPromise(function(_0x51e379,_0x1590bb){return client[_0x852b('0x12')](_0xf0952b,_0x56ac15)[_0x852b('0x13')](function(_0x355608){logger[_0x852b('0x14')](_0x852b('0x15'),_0x36dd72,_0x852b('0x16'));logger[_0x852b('0x17')](_0x852b('0x18'),_0x36dd72,'request\x20sent',JSON['stringify'](_0x355608));if(_0x355608[_0x852b('0x19')]){if(_0x355608['error'][_0x852b('0x1a')]===0x1f4){logger[_0x852b('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x36dd72,_0x355608[_0x852b('0x19')][_0x852b('0x1b')]);return _0x1590bb(_0x355608[_0x852b('0x19')][_0x852b('0x1b')]);}logger[_0x852b('0x19')](_0x852b('0x15'),_0x36dd72,_0x355608['error'][_0x852b('0x1b')]);return _0x51e379(_0x355608[_0x852b('0x19')][_0x852b('0x1b')]);}else{logger[_0x852b('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x36dd72,_0x852b('0x16'));_0x51e379(_0x355608[_0x852b('0x1c')][_0x852b('0x1b')]);}})[_0x852b('0x1d')](function(_0x4261b1){logger[_0x852b('0x19')](_0x852b('0x15'),_0x36dd72,_0x4261b1);_0x1590bb(_0x4261b1);});});} \ No newline at end of file +var _0x2ba4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x2ba4,0x8b));var _0x42ba=function(_0x4b3842,_0x20a6bc){_0x4b3842=_0x4b3842-0x0;var _0x470ca2=_0x2ba4[_0x4b3842];return _0x470ca2;};'use strict';var _=require('lodash');var util=require(_0x42ba('0x0'));var moment=require(_0x42ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x42ba('0x2'));var fs=require('fs');var Redis=require(_0x42ba('0x3'));var db=require(_0x42ba('0x4'))['db'];var utils=require(_0x42ba('0x5'));var logger=require(_0x42ba('0x6'))(_0x42ba('0x7'));var config=require(_0x42ba('0x8'));var jayson=require(_0x42ba('0x9'));var client=jayson[_0x42ba('0xa')][_0x42ba('0xb')]({'port':0x232a});config[_0x42ba('0xc')]=_[_0x42ba('0xd')](config['redis'],{'host':_0x42ba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42ba('0xc')]));require(_0x42ba('0xf'))[_0x42ba('0x10')](socket);function respondWithRpcPromise(_0x1f793b,_0x286ad0,_0x158789){return new BPromise(function(_0x25765a,_0x59124c){return client[_0x42ba('0x11')](_0x1f793b,_0x158789)[_0x42ba('0x12')](function(_0x749a6e){logger[_0x42ba('0x13')](_0x42ba('0x14'),_0x286ad0,_0x42ba('0x15'));logger[_0x42ba('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x286ad0,_0x42ba('0x15'),JSON[_0x42ba('0x17')](_0x749a6e));if(_0x749a6e[_0x42ba('0x18')]){if(_0x749a6e[_0x42ba('0x18')][_0x42ba('0x19')]===0x1f4){logger[_0x42ba('0x18')](_0x42ba('0x14'),_0x286ad0,_0x749a6e[_0x42ba('0x18')][_0x42ba('0x1a')]);return _0x59124c(_0x749a6e[_0x42ba('0x18')][_0x42ba('0x1a')]);}logger[_0x42ba('0x18')](_0x42ba('0x14'),_0x286ad0,_0x749a6e[_0x42ba('0x18')][_0x42ba('0x1a')]);return _0x25765a(_0x749a6e[_0x42ba('0x18')][_0x42ba('0x1a')]);}else{logger[_0x42ba('0x13')](_0x42ba('0x14'),_0x286ad0,'request\x20sent');_0x25765a(_0x749a6e[_0x42ba('0x1b')]['message']);}})[_0x42ba('0x1c')](function(_0x4cc840){logger[_0x42ba('0x18')](_0x42ba('0x14'),_0x286ad0,_0x4cc840);_0x59124c(_0x4cc840);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0d0c35a..56a86b7 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 _0x6ad1=['remove','update','emit','removeListener','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x37512d,_0x2da3d9){var _0x2c356f=function(_0x5914ae){while(--_0x5914ae){_0x37512d['push'](_0x37512d['shift']());}};_0x2c356f(++_0x2da3d9);}(_0x6ad1,0xde));var _0x16ad=function(_0xc95ab8,_0x2985ac){_0xc95ab8=_0xc95ab8-0x0;var _0x2aed95=_0x6ad1[_0xc95ab8];return _0x2aed95;};'use strict';var ChatWebsiteEvents=require(_0x16ad('0x0'));var events=[_0x16ad('0x1'),_0x16ad('0x2'),_0x16ad('0x3')];function createListener(_0x50be0b,_0x49fe89){return function(_0x2363ea){_0x49fe89[_0x16ad('0x4')](_0x50be0b,_0x2363ea);};}function removeListener(_0x3a177d,_0x48aa25){return function(){ChatWebsiteEvents[_0x16ad('0x5')](_0x3a177d,_0x48aa25);};}exports['register']=function(_0x4d848e){for(var _0x24eaf4=0x0,_0x6b6320=events[_0x16ad('0x6')];_0x24eaf4<_0x6b6320;_0x24eaf4++){var _0xe68b7f=events[_0x24eaf4];var _0xac1e80=createListener(_0x16ad('0x7')+_0xe68b7f,_0x4d848e);ChatWebsiteEvents['on'](_0xe68b7f,_0xac1e80);}}; \ No newline at end of file +var _0x1834=['chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener','register'];(function(_0x3ad00a,_0x11b46a){var _0x582dcc=function(_0x427aca){while(--_0x427aca){_0x3ad00a['push'](_0x3ad00a['shift']());}};_0x582dcc(++_0x11b46a);}(_0x1834,0xb0));var _0x4183=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x1834[_0x4a9a17];return _0x30e831;};'use strict';var ChatWebsiteEvents=require(_0x4183('0x0'));var events=[_0x4183('0x1'),_0x4183('0x2'),'update'];function createListener(_0x102fac,_0x2950d4){return function(_0x5aae7e){_0x2950d4[_0x4183('0x3')](_0x102fac,_0x5aae7e);};}function removeListener(_0x388b2f,_0x38165c){return function(){ChatWebsiteEvents[_0x4183('0x4')](_0x388b2f,_0x38165c);};}exports[_0x4183('0x5')]=function(_0x3fdcba){for(var _0x2d524e=0x0,_0x27649c=events['length'];_0x2d524e<_0x27649c;_0x2d524e++){var _0x6d88d4=events[_0x2d524e];var _0x2d13b7=createListener(_0x4183('0x6')+_0x6d88d4,_0x3fdcba);ChatWebsiteEvents['on'](_0x6d88d4,_0x2d13b7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 367ea47..2e0fa0a 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 _0x162e=['getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','format','file','addAvatar','root','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','put','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar'];(function(_0x5117ac,_0x3161ce){var _0x46e8bf=function(_0x196461){while(--_0x196461){_0x5117ac['push'](_0x5117ac['shift']());}};_0x46e8bf(++_0x3161ce);}(_0x162e,0x19b));var _0xe162=function(_0x258c77,_0x144d59){_0x258c77=_0x258c77-0x0;var _0x56169e=_0x162e[_0x258c77];return _0x56169e;};'use strict';var multer=require(_0xe162('0x0'));var util=require(_0xe162('0x1'));var path=require(_0xe162('0x2'));var timeout=require(_0xe162('0x3'));var express=require(_0xe162('0x4'));var router=express['Router']();var fs_extra=require(_0xe162('0x5'));var auth=require(_0xe162('0x6'));var interaction=require(_0xe162('0x7'));var config=require('../../config/environment');var controller=require(_0xe162('0x8'));router[_0xe162('0x9')]('/',auth['isAuthenticated'](),controller[_0xe162('0xa')]);router['get'](_0xe162('0xb'),auth[_0xe162('0xc')](),controller[_0xe162('0xd')]);router[_0xe162('0x9')](_0xe162('0xe'),auth['isAuthenticated'](),controller[_0xe162('0xf')]);router[_0xe162('0x9')](_0xe162('0x10'),auth[_0xe162('0xc')](),controller[_0xe162('0x11')]);router[_0xe162('0x9')](_0xe162('0x12'),auth[_0xe162('0xc')](),controller['getAnswers']);router[_0xe162('0x9')](_0xe162('0x13'),controller[_0xe162('0x14')]);router[_0xe162('0x9')](_0xe162('0x15'),controller[_0xe162('0x16')]);router[_0xe162('0x9')](_0xe162('0x17'),controller[_0xe162('0x18')]);router[_0xe162('0x9')](_0xe162('0x19'),controller[_0xe162('0x1a')]);router[_0xe162('0x9')]('/:id/interactions',auth[_0xe162('0xc')](),controller[_0xe162('0x1b')]);router[_0xe162('0x9')]('/:id/snippet',controller[_0xe162('0x1c')]);router[_0xe162('0x9')](_0xe162('0x1d'),auth[_0xe162('0xc')](),controller[_0xe162('0x1e')]);router[_0xe162('0x9')](_0xe162('0x1f'),auth[_0xe162('0xc')](),controller[_0xe162('0x20')]);router[_0xe162('0x9')]('/:id/fields',controller['getFields']);router[_0xe162('0x9')](_0xe162('0x21'),auth['isAuthenticated'](),controller[_0xe162('0x22')]);router[_0xe162('0x9')](_0xe162('0x23'),auth['isAuthenticated'](),controller[_0xe162('0x24')]);router[_0xe162('0x25')]('/',auth[_0xe162('0xc')](),controller[_0xe162('0x26')]);router[_0xe162('0x25')](_0xe162('0x10'),auth[_0xe162('0xc')](),controller[_0xe162('0x27')]);router[_0xe162('0x25')]('/:id/canned_answers',auth[_0xe162('0xc')](),controller[_0xe162('0x28')]);var upload=multer({'storage':multer[_0xe162('0x29')]({'destination':function(_0x415832,_0xb456f,_0x372478){_0x372478(null,path[_0xe162('0x2a')](config['root'],_0xe162('0x2b')));},'filename':function(_0x25638c,_0x2f83c0,_0x220ed6){_0x220ed6(null,util['format'](_0xe162('0x2c'),Date[_0xe162('0x2d')](),_0x2f83c0[_0xe162('0x2e')]));}})});router[_0xe162('0x25')](_0xe162('0x13'),upload[_0xe162('0x2f')]('file'),controller[_0xe162('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x518ce3,_0x5074f2,_0x5aef51){_0x5aef51(null,path[_0xe162('0x2a')](config['root'],_0xe162('0x31')));},'filename':function(_0x223fec,_0x497298,_0x53c5a6){_0x53c5a6(null,util[_0xe162('0x32')](_0xe162('0x2c'),Date['now'](),_0x497298[_0xe162('0x2e')]));}})});router[_0xe162('0x25')]('/:id/avatar',upload[_0xe162('0x2f')](_0xe162('0x33')),controller[_0xe162('0x34')]);var upload=multer({'storage':multer[_0xe162('0x29')]({'destination':function(_0x1931d6,_0x43d3af,_0x1c73ed){_0x1c73ed(null,path[_0xe162('0x2a')](config[_0xe162('0x35')],'server/files/images/avatars/'));},'filename':function(_0x4c04cf,_0x3fc210,_0x3b4213){_0x3b4213(null,util[_0xe162('0x32')](_0xe162('0x2c'),Date['now'](),_0x3fc210[_0xe162('0x2e')]));}})});router['post'](_0xe162('0x17'),upload[_0xe162('0x2f')](_0xe162('0x33')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe162('0x29')]({'destination':function(_0x513a4b,_0x5cc7cc,_0x10dd73){_0x10dd73(null,path[_0xe162('0x2a')](config[_0xe162('0x35')],_0xe162('0x31')));},'filename':function(_0x238340,_0x7ffcb2,_0x43a257){_0x43a257(null,util[_0xe162('0x32')](_0xe162('0x2c'),Date[_0xe162('0x2d')](),_0x7ffcb2[_0xe162('0x2e')]));}})});router[_0xe162('0x25')](_0xe162('0x19'),upload[_0xe162('0x2f')]('file'),controller[_0xe162('0x36')]);router[_0xe162('0x25')](_0xe162('0x37'),controller[_0xe162('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0xe162('0x29')]({'destination':function(_0x104620,_0xf9faad,_0x9e5f9c){const _0x2fd8e3=path[_0xe162('0x2a')](config[_0xe162('0x35')],'server/files',_0xe162('0x39'),_0xe162('0x3a'));fs_extra['ensureDir'](_0x2fd8e3,function(){_0x9e5f9c(null,_0x2fd8e3);});},'filename':function(_0x33db46,_0x44e06f,_0x56bfcc){const _0xee18ec=_0x44e06f['originalname'][_0xe162('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1e6814=path[_0xe162('0x3c')](_0xee18ec);const _0x239de4=Date[_0xe162('0x2d')]()+'-'+_0xee18ec[_0xe162('0x3b')](_0x1e6814,'')+_0x1e6814;_0x56bfcc(null,_0x239de4);}})});router[_0xe162('0x25')](_0xe162('0x3d'),offlineUploadMulter[_0xe162('0x3e')](),controller[_0xe162('0x3f')]);router[_0xe162('0x25')]('/:id/interactions',auth[_0xe162('0xc')](),controller[_0xe162('0x40')]);router[_0xe162('0x25')](_0xe162('0x1d'),auth[_0xe162('0xc')](),controller[_0xe162('0x41')]);router[_0xe162('0x25')]('/:id/proactive_actions',auth[_0xe162('0xc')](),controller['addProactiveActions']);router[_0xe162('0x25')](_0xe162('0x23'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe162('0x42')](_0xe162('0xe'),auth[_0xe162('0xc')](),controller['update']);router['delete'](_0xe162('0xe'),auth['isAuthenticated'](),controller[_0xe162('0x43')]);router['delete'](_0xe162('0x10'),auth[_0xe162('0xc')](),controller[_0xe162('0x44')]);router[_0xe162('0x45')](_0xe162('0x12'),auth['isAuthenticated'](),controller[_0xe162('0x46')]);router[_0xe162('0x45')](_0xe162('0x23'),auth[_0xe162('0xc')](),controller[_0xe162('0x47')]);module[_0xe162('0x48')]=router; \ No newline at end of file +var _0x5984=['replace','extname','offline','addInteraction','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAnswers','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','post','addAnswer','join','root','server/files/images/logos/','single','file','addLogo','server/files/images/avatars/','format','%s-%s','now','originalname','addCustomerAvatar','diskStorage','/:id/system_avatar','/:id/notify','server/files','attachments','offline-chat','ensureDir'];(function(_0x42ac42,_0x6e6a4b){var _0x50dc84=function(_0x38b450){while(--_0x38b450){_0x42ac42['push'](_0x42ac42['shift']());}};_0x50dc84(++_0x6e6a4b);}(_0x5984,0x90));var _0x4598=function(_0x21843a,_0xc9244f){_0x21843a=_0x21843a-0x0;var _0x54d050=_0x5984[_0x21843a];return _0x54d050;};'use strict';var multer=require('multer');var util=require(_0x4598('0x0'));var path=require(_0x4598('0x1'));var timeout=require('connect-timeout');var express=require(_0x4598('0x2'));var router=express[_0x4598('0x3')]();var fs_extra=require(_0x4598('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4598('0x5'));var config=require(_0x4598('0x6'));var controller=require(_0x4598('0x7'));router[_0x4598('0x8')]('/',auth['isAuthenticated'](),controller[_0x4598('0x9')]);router['get']('/describe',auth[_0x4598('0xa')](),controller[_0x4598('0xb')]);router[_0x4598('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4598('0xc')]);router[_0x4598('0x8')](_0x4598('0xd'),auth[_0x4598('0xa')](),controller[_0x4598('0xe')]);router[_0x4598('0x8')]('/:id/canned_answers',auth[_0x4598('0xa')](),controller[_0x4598('0xf')]);router[_0x4598('0x8')](_0x4598('0x10'),controller[_0x4598('0x11')]);router['get'](_0x4598('0x12'),controller['getAvatar']);router[_0x4598('0x8')](_0x4598('0x13'),controller[_0x4598('0x14')]);router[_0x4598('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router[_0x4598('0x8')](_0x4598('0x15'),auth[_0x4598('0xa')](),controller[_0x4598('0x16')]);router[_0x4598('0x8')](_0x4598('0x17'),controller['getSnippet']);router[_0x4598('0x8')](_0x4598('0x18'),auth[_0x4598('0xa')](),controller[_0x4598('0x19')]);router['get'](_0x4598('0x1a'),auth['isAuthenticated'](),controller[_0x4598('0x1b')]);router[_0x4598('0x8')]('/:id/fields',controller['getFields']);router[_0x4598('0x8')](_0x4598('0x1c'),auth[_0x4598('0xa')](),controller[_0x4598('0x1d')]);router[_0x4598('0x8')]('/:id/users',auth[_0x4598('0xa')](),controller['getAgents']);router[_0x4598('0x1e')]('/',auth[_0x4598('0xa')](),controller['create']);router[_0x4598('0x1e')](_0x4598('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x4598('0xa')](),controller[_0x4598('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x548274,_0x2d381e,_0xa478cb){_0xa478cb(null,path[_0x4598('0x20')](config[_0x4598('0x21')],_0x4598('0x22')));},'filename':function(_0x467c46,_0x573d31,_0xb57cbc){_0xb57cbc(null,util['format']('%s-%s',Date['now'](),_0x573d31['originalname']));}})});router[_0x4598('0x1e')](_0x4598('0x10'),upload[_0x4598('0x23')](_0x4598('0x24')),controller[_0x4598('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c70f3,_0xa501e5,_0x2f44a1){_0x2f44a1(null,path[_0x4598('0x20')](config['root'],_0x4598('0x26')));},'filename':function(_0x42463b,_0x3d4ac8,_0x250aac){_0x250aac(null,util[_0x4598('0x27')]('%s-%s',Date['now'](),_0x3d4ac8['originalname']));}})});router['post'](_0x4598('0x12'),upload[_0x4598('0x23')](_0x4598('0x24')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ca6f7,_0x3aec9f,_0x5d4145){_0x5d4145(null,path[_0x4598('0x20')](config[_0x4598('0x21')],'server/files/images/avatars/'));},'filename':function(_0x5173b7,_0x2f179a,_0x1e7dac){_0x1e7dac(null,util['format'](_0x4598('0x28'),Date[_0x4598('0x29')](),_0x2f179a[_0x4598('0x2a')]));}})});router[_0x4598('0x1e')](_0x4598('0x13'),upload[_0x4598('0x23')](_0x4598('0x24')),controller[_0x4598('0x2b')]);var upload=multer({'storage':multer[_0x4598('0x2c')]({'destination':function(_0x2e9067,_0x5b0521,_0x531bdf){_0x531bdf(null,path[_0x4598('0x20')](config[_0x4598('0x21')],_0x4598('0x26')));},'filename':function(_0x3f7992,_0x561207,_0x3451cb){_0x3451cb(null,util[_0x4598('0x27')](_0x4598('0x28'),Date[_0x4598('0x29')](),_0x561207['originalname']));}})});router[_0x4598('0x1e')](_0x4598('0x2d'),upload[_0x4598('0x23')](_0x4598('0x24')),controller['addSystemAvatar']);router[_0x4598('0x1e')](_0x4598('0x2e'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x4598('0x2c')]({'destination':function(_0x5f0ad4,_0x4ed926,_0x19de4d){const _0x3f8c89=path[_0x4598('0x20')](config['root'],_0x4598('0x2f'),_0x4598('0x30'),_0x4598('0x31'));fs_extra[_0x4598('0x32')](_0x3f8c89,function(){_0x19de4d(null,_0x3f8c89);});},'filename':function(_0x4e897b,_0x18a8f6,_0x289191){const _0x6723a0=_0x18a8f6['originalname'][_0x4598('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5cd35f=path[_0x4598('0x34')](_0x6723a0);const _0x156f26=Date['now']()+'-'+_0x6723a0[_0x4598('0x33')](_0x5cd35f,'')+_0x5cd35f;_0x289191(null,_0x156f26);}})});router[_0x4598('0x1e')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x4598('0x35')]);router[_0x4598('0x1e')](_0x4598('0x15'),auth[_0x4598('0xa')](),controller[_0x4598('0x36')]);router['post'](_0x4598('0x18'),auth[_0x4598('0xa')](),controller['addApplications']);router[_0x4598('0x1e')](_0x4598('0x1a'),auth[_0x4598('0xa')](),controller[_0x4598('0x37')]);router['post'](_0x4598('0x38'),auth['isAuthenticated'](),controller[_0x4598('0x39')]);router[_0x4598('0x3a')](_0x4598('0x3b'),auth['isAuthenticated'](),controller[_0x4598('0x3c')]);router[_0x4598('0x3d')](_0x4598('0x3b'),auth[_0x4598('0xa')](),controller[_0x4598('0x3e')]);router['delete'](_0x4598('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x4598('0x3d')]('/:id/canned_answers',auth[_0x4598('0xa')](),controller[_0x4598('0x3f')]);router['delete']('/:id/users',auth[_0x4598('0xa')](),controller['removeAgents']);module[_0x4598('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index e9b3b2b..26f5adc 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8862=['Router','env','production','get','client-side-logger','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x8ee07f,_0x156d35){var _0x29cc4d=function(_0x51f430){while(--_0x51f430){_0x8ee07f['push'](_0x8ee07f['shift']());}};_0x29cc4d(++_0x156d35);}(_0x8862,0x1b6));var _0x2886=function(_0x3f09bb,_0x28bb27){_0x3f09bb=_0x3f09bb-0x0;var _0x542281=_0x8862[_0x3f09bb];return _0x542281;};var beaverLogger=require(_0x2886('0x0'));var express=require(_0x2886('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x2886('0x2')]();var isProduction=config[_0x2886('0x3')]===_0x2886('0x4')||![];function clientSideLogs(_0x8a4882,_0x549f19,_0x12175d){var _0x445f96=_0x8a4882['app'][_0x2886('0x5')](_0x2886('0x6'));if(!_0x445f96){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x2886('0x7')]({'uri':_0x2886('0x8'),'logger':_0x445f96,'enableCors':!isProduction})(_0x8a4882,_0x549f19,_0x12175d);}router['use'](auth[_0x2886('0x9')](),clientSideLogs);module[_0x2886('0xa')]=router; \ No newline at end of file +var _0x09d4=['exports','beaver-logger/server','express','../config/environment','Router','env','client-side-logger','Client-Side\x20logger\x20not\x20found!','use','isAuthenticated'];(function(_0x105608,_0x567eea){var _0x4938a2=function(_0x2fa01d){while(--_0x2fa01d){_0x105608['push'](_0x105608['shift']());}};_0x4938a2(++_0x567eea);}(_0x09d4,0x1cd));var _0x409d=function(_0x1fa7c7,_0x159f9d){_0x1fa7c7=_0x1fa7c7-0x0;var _0x22c4b7=_0x09d4[_0x1fa7c7];return _0x22c4b7;};var beaverLogger=require(_0x409d('0x0'));var express=require(_0x409d('0x1'));var auth=require('../components/auth/service');var config=require(_0x409d('0x2'));var router=express[_0x409d('0x3')]();var isProduction=config[_0x409d('0x4')]==='production'||![];function clientSideLogs(_0x34c57f,_0x453c49,_0x3ee14b){var _0x3b7145=_0x34c57f['app']['get'](_0x409d('0x5'));if(!_0x3b7145){throw new Error(_0x409d('0x6'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x3b7145,'enableCors':!isProduction})(_0x34c57f,_0x453c49,_0x3ee14b);}router[_0x409d('0x7')](auth[_0x409d('0x8')](),clientSideLogs);module[_0x409d('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1e58dc7..f20a82b 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 _0x6d56=['MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x6d56,0xeb));var _0x66d5=function(_0x5430c7,_0x539556){_0x5430c7=_0x5430c7-0x0;var _0x3e23f9=_0x6d56[_0x5430c7];return _0x3e23f9;};'use strict';var Sequelize=require(_0x66d5('0x0'));module[_0x66d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x66d5('0x2')](_0x66d5('0x3'),_0x66d5('0x4'),_0x66d5('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x66d5('0x2')](_0x66d5('0x6'),_0x66d5('0x7'))},'data1':{'type':Sequelize[_0x66d5('0x8')],'comment':_0x66d5('0x9')},'data2':{'type':Sequelize[_0x66d5('0x8')],'comment':_0x66d5('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x66d5('0xb')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x66d5('0xc')],'comment':_0x66d5('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0x66d5('0xe')},'data7':{'type':Sequelize[_0x66d5('0xc')],'comment':_0x66d5('0xf')}}; \ No newline at end of file +var _0x7890=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Dynamics365'];(function(_0xd7337f,_0x42e946){var _0xc6eefb=function(_0x4419fe){while(--_0x4419fe){_0xd7337f['push'](_0xd7337f['shift']());}};_0xc6eefb(++_0x42e946);}(_0x7890,0x1b7));var _0x0789=function(_0x20914e,_0x293b85){_0x20914e=_0x20914e-0x0;var _0x36a2bc=_0x7890[_0x20914e];return _0x36a2bc;};'use strict';var Sequelize=require(_0x0789('0x0'));module['exports']={'name':{'type':Sequelize[_0x0789('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0789('0x2')](_0x0789('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x0789('0x4'))},'data1':{'type':Sequelize[_0x0789('0x1')],'comment':_0x0789('0x5')},'data2':{'type':Sequelize[_0x0789('0x1')],'comment':_0x0789('0x6')},'data3':{'type':Sequelize[_0x0789('0x1')],'comment':_0x0789('0x7')},'data4':{'type':Sequelize[_0x0789('0x1')],'comment':_0x0789('0x8')},'data5':{'type':Sequelize[_0x0789('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x0789('0x9')],'comment':_0x0789('0xa')},'data7':{'type':Sequelize[_0x0789('0x9')],'comment':_0x0789('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 1f1aeab..c590c50 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 _0x2356=['type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Name\x20parameter\x20not\x20specified','service','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','base64','toString','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','offset','undefined','count','limit','Content-Range','json','update','sendStatus','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2356,0x1b1));var _0x6235=function(_0x34df53,_0x583165){_0x34df53=_0x34df53-0x0;var _0x540088=_0x2356[_0x34df53];return _0x540088;};'use strict';var _=require('lodash');var Redis=require(_0x6235('0x0'));var qs=require(_0x6235('0x1'));var encryptor=require(_0x6235('0x2'));var config=require(_0x6235('0x3'));var logger=require(_0x6235('0x4'))(_0x6235('0x5'));var db=require(_0x6235('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x6235('0x7')]=_[_0x6235('0x8')](config[_0x6235('0x7')],{'host':_0x6235('0x9'),'port':0x18eb});var socket=require(_0x6235('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x6235('0x7')]);function respondWithStatusCode(_0x2d6543,_0x462664){_0x462664=_0x462664||0xcc;return function(_0x46aad4){if(_0x46aad4){return _0x2d6543['sendStatus'](_0x462664);}return _0x2d6543[_0x6235('0xb')](_0x462664)[_0x6235('0xc')]();};}function respondWithResult(_0x24587f,_0x4360be){_0x4360be=_0x4360be||0xc8;return function(_0x172b90){if(_0x172b90){return _0x24587f[_0x6235('0xb')](_0x4360be)['json'](_0x172b90);}};}function respondWithFilteredResult(_0x23a00e,_0xb23293){return function(_0x5b920c){if(_0x5b920c){var _0x102d7e=typeof _0xb23293[_0x6235('0xd')]===_0x6235('0xe')&&typeof _0xb23293['limit']==='undefined';var _0x31b3e2=_0x5b920c['count'];var _0x289d4c=_0x102d7e?0x0:_0xb23293['offset'];var _0x4764bb=_0x102d7e?_0x5b920c[_0x6235('0xf')]:_0xb23293['offset']+_0xb23293[_0x6235('0x10')];var _0x4ce6e0;if(_0x4764bb>=_0x31b3e2){_0x4764bb=_0x31b3e2;_0x4ce6e0=0xc8;}else{_0x4ce6e0=0xce;}_0x23a00e['status'](_0x4ce6e0);return _0x23a00e['set'](_0x6235('0x11'),_0x289d4c+'-'+_0x4764bb+'/'+_0x31b3e2)[_0x6235('0x12')](_0x5b920c);}return null;};}function saveUpdates(_0x482725){return function(_0x1f90d5){if(_0x1f90d5){return _0x1f90d5[_0x6235('0x13')](_0x482725)['then'](function(_0x34201b){return _0x34201b;});}return null;};}function removeEntity(_0x2f12b0){return function(_0x2a74df){if(_0x2a74df){return _0x2a74df['destroy']()['then'](function(){_0x2f12b0[_0x6235('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4373eb){return function(_0x142a14){if(!_0x142a14){_0x4373eb[_0x6235('0x14')](0x194);}return _0x142a14;};}function handleError(_0x87cc27,_0x503bd3){_0x503bd3=_0x503bd3||0x1f4;return function(_0x78c90c){logger[_0x6235('0x15')](_0x78c90c[_0x6235('0x16')]);if(_0x78c90c[_0x6235('0x17')]){delete _0x78c90c[_0x6235('0x17')];}_0x87cc27[_0x6235('0xb')](_0x503bd3)[_0x6235('0x18')](_0x78c90c);};}function maskClientSecret(_0x4a5bb1){return _[_0x6235('0x19')](_0x4a5bb1[_0x6235('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6235('0x1b')]=function(_0x19b95a,_0x29fb6d){var _0x1e247b={},_0x1d67d9={},_0x1419c9={'count':0x0,'rows':[]};var _0x1e4900=_[_0x6235('0x1c')](db[_0x6235('0x1d')][_0x6235('0x1e')],function(_0x5d8fd5){return{'name':_0x5d8fd5[_0x6235('0x1f')],'type':_0x5d8fd5[_0x6235('0x20')][_0x6235('0x21')]};});_0x1d67d9[_0x6235('0x22')]=_[_0x6235('0x1c')](_0x1e4900,_0x6235('0x17'));_0x1d67d9['query']=_[_0x6235('0x23')](_0x19b95a['query']);_0x1d67d9[_0x6235('0x24')]=_[_0x6235('0x25')](_0x1d67d9[_0x6235('0x22')],_0x1d67d9[_0x6235('0x26')]);_0x1e247b[_0x6235('0x27')]=_[_0x6235('0x25')](_0x1d67d9[_0x6235('0x22')],qs[_0x6235('0x28')](_0x19b95a[_0x6235('0x26')][_0x6235('0x28')]));_0x1e247b[_0x6235('0x27')]=_0x1e247b['attributes'][_0x6235('0x29')]?_0x1e247b[_0x6235('0x27')]:_0x1d67d9[_0x6235('0x22')];if(!_0x19b95a[_0x6235('0x26')][_0x6235('0x2a')](_0x6235('0x2b'))){_0x1e247b[_0x6235('0x10')]=qs[_0x6235('0x10')](_0x19b95a[_0x6235('0x26')]['limit']);_0x1e247b[_0x6235('0xd')]=qs[_0x6235('0xd')](_0x19b95a['query'][_0x6235('0xd')]);}_0x1e247b[_0x6235('0x2c')]=qs[_0x6235('0x2d')](_0x19b95a['query'][_0x6235('0x2d')]);_0x1e247b[_0x6235('0x2e')]=qs[_0x6235('0x24')](_[_0x6235('0x2f')](_0x19b95a[_0x6235('0x26')],_0x1d67d9[_0x6235('0x24')]),_0x1e4900);if(_0x19b95a['query'][_0x6235('0x30')]){_0x1e247b[_0x6235('0x2e')]=_[_0x6235('0x31')](_0x1e247b['where'],{'$or':_[_0x6235('0x1c')](_0x1e4900,function(_0x2aed2a){if(_0x2aed2a[_0x6235('0x20')]!=='VIRTUAL'){var _0x2fb906={};_0x2fb906[_0x2aed2a['name']]={'$like':'%'+_0x19b95a[_0x6235('0x26')][_0x6235('0x30')]+'%'};return _0x2fb906;}})});}_0x1e247b=_[_0x6235('0x31')]({},_0x1e247b,_0x19b95a[_0x6235('0x32')]);var _0x37faab={'where':_0x1e247b[_0x6235('0x2e')]};return db[_0x6235('0x1d')][_0x6235('0xf')](_0x37faab)[_0x6235('0x33')](function(_0x2ab66d){_0x1419c9[_0x6235('0xf')]=_0x2ab66d;if(_0x19b95a['query'][_0x6235('0x34')]){_0x1e247b[_0x6235('0x35')]=[{'all':!![]}];}return db[_0x6235('0x1d')][_0x6235('0x36')](_0x1e247b);})[_0x6235('0x33')](function(_0x2b64ca){_0x1419c9[_0x6235('0x37')]=_[_0x6235('0x1c')](_0x2b64ca,function(_0x264bc4){if(_0x264bc4['service']===_0x6235('0x38')){var _0x2b4a18=encryptor[_0x6235('0x39')](_0x264bc4[_0x6235('0x3a')]);_0x264bc4[_0x6235('0x3a')]=maskClientSecret(_0x2b4a18);}return _0x264bc4;});return _0x1419c9;})[_0x6235('0x33')](respondWithFilteredResult(_0x29fb6d,_0x1e247b))[_0x6235('0x3b')](handleError(_0x29fb6d,null));};exports[_0x6235('0x3c')]=function(_0x37c7ea,_0x58559b){var _0x86523={'raw':!![],'where':{'id':_0x37c7ea[_0x6235('0x3d')]['id']}},_0x419db0={};_0x419db0[_0x6235('0x22')]=_['keys'](db[_0x6235('0x1d')]['rawAttributes']);_0x419db0['query']=_['keys'](_0x37c7ea[_0x6235('0x26')]);_0x419db0[_0x6235('0x24')]=_[_0x6235('0x25')](_0x419db0[_0x6235('0x22')],_0x419db0[_0x6235('0x26')]);_0x86523[_0x6235('0x27')]=_[_0x6235('0x25')](_0x419db0['model'],qs[_0x6235('0x28')](_0x37c7ea[_0x6235('0x26')]['fields']));_0x86523[_0x6235('0x27')]=_0x86523[_0x6235('0x27')][_0x6235('0x29')]?_0x86523[_0x6235('0x27')]:_0x419db0[_0x6235('0x22')];if(_0x37c7ea[_0x6235('0x26')]['includeAll']){_0x86523[_0x6235('0x35')]=[{'all':!![]}];}_0x86523=_[_0x6235('0x31')]({},_0x86523,_0x37c7ea['options']);return db[_0x6235('0x1d')][_0x6235('0x3e')](_0x86523)[_0x6235('0x33')](handleEntityNotFound(_0x58559b,null))[_0x6235('0x33')](function(_0x1dffe6){if(_0x1dffe6['service']===_0x6235('0x38')){var _0x5b01b2=encryptor[_0x6235('0x39')](_0x1dffe6['data3']);_0x1dffe6[_0x6235('0x3a')]=maskClientSecret(_0x5b01b2);}return _0x1dffe6;})[_0x6235('0x33')](respondWithResult(_0x58559b,null))['catch'](handleError(_0x58559b,null));};exports[_0x6235('0x3f')]=function(_0x29dd9f,_0x58847f){if(!_0x29dd9f[_0x6235('0x40')][_0x6235('0x17')])throw new Error(_0x6235('0x41'));if(!_0x29dd9f[_0x6235('0x40')][_0x6235('0x42')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x118e62=db['CloudProvider']['rawAttributes'][_0x6235('0x42')]['values'];if(!_0x118e62[_0x6235('0x43')](_0x29dd9f[_0x6235('0x40')][_0x6235('0x42')]))throw new Error(_0x6235('0x44')+_0x118e62['join'](',\x20'));if(_0x29dd9f[_0x6235('0x40')][_0x6235('0x42')]===_0x6235('0x38')&&_0x29dd9f['body'][_0x6235('0x3a')]){_0x29dd9f[_0x6235('0x40')][_0x6235('0x3a')]=encryptor[_0x6235('0x45')](_0x29dd9f[_0x6235('0x40')][_0x6235('0x3a')]);}return db['CloudProvider'][_0x6235('0x3f')](_0x29dd9f[_0x6235('0x40')],{})[_0x6235('0x33')](respondWithResult(_0x58847f,0xc9))[_0x6235('0x3b')](handleError(_0x58847f,null));};exports[_0x6235('0x13')]=function(_0x4d86d2,_0x2da64b){if(_0x4d86d2[_0x6235('0x40')]['id']){delete _0x4d86d2[_0x6235('0x40')]['id'];}return db[_0x6235('0x1d')]['find']({'where':{'id':_0x4d86d2[_0x6235('0x3d')]['id']}})[_0x6235('0x33')](handleEntityNotFound(_0x2da64b,null))['then'](function(_0x3eedaa){if(_0x3eedaa[_0x6235('0x42')]===_0x6235('0x38')&&_0x4d86d2['body'][_0x6235('0x3a')]){_0x4d86d2[_0x6235('0x40')]['data3']=encryptor['encryptString'](_0x4d86d2[_0x6235('0x40')][_0x6235('0x3a')]);}return _0x3eedaa;})[_0x6235('0x33')](saveUpdates(_0x4d86d2[_0x6235('0x40')],null))[_0x6235('0x33')](respondWithResult(_0x2da64b,null))[_0x6235('0x3b')](handleError(_0x2da64b,null));};exports['destroy']=function(_0xaa1a47,_0x27a222){return db['CloudProvider'][_0x6235('0x3e')]({'where':{'id':_0xaa1a47[_0x6235('0x3d')]['id']}})[_0x6235('0x33')](handleEntityNotFound(_0x27a222,null))[_0x6235('0x33')](removeEntity(_0x27a222,null))['catch'](handleError(_0x27a222,null));};exports['oauth2MicrosoftAuthorize']=function(_0x70375f,_0x3312c2){return db['CloudProvider'][_0x6235('0x46')]({'where':{'id':_0x70375f[_0x6235('0x3d')]['id']},'raw':!![]})[_0x6235('0x33')](function(_0x4cd452){if(!_0x4cd452)return _0x3312c2[_0x6235('0x14')](0x194);return{'url':oauth[_0x6235('0x47')](_0x4cd452,_0x70375f[_0x6235('0x48')]['id'])};})[_0x6235('0x33')](respondWithResult(_0x3312c2,null))[_0x6235('0x3b')](handleError(_0x3312c2,null));};exports['oauth2MicrosoftCallback']=function(_0x4f9757,_0x384bf2){var _0x1b4e4e=_0x4f9757['body'];var _0x36eaf2;var _0x5d270f;if(_0x1b4e4e[_0x6235('0x15')])throw _0x1b4e4e;redis['get'](_0x1b4e4e[_0x6235('0x49')])[_0x6235('0x33')](function(_0x1dd77b){if(!_0x1dd77b)throw new Error(_0x6235('0x4a'));_0x36eaf2=JSON[_0x6235('0x4b')](_0x1dd77b);var _0x4e3571=Buffer[_0x6235('0x4c')](_0x1b4e4e[_0x6235('0x49')],_0x6235('0x4d'))[_0x6235('0x4e')]('ascii');_0x5d270f=JSON[_0x6235('0x4b')](_0x4e3571);if(!oauth[_0x6235('0x4f')](_0x1b4e4e[_0x6235('0x50')],_0x36eaf2[_0x6235('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6235('0x52')](_0x1b4e4e['state']);return oauth[_0x6235('0x53')](_0x1b4e4e[_0x6235('0x54')],_0x36eaf2);})['then'](function(_0x342039){_0x36eaf2[_0x6235('0x55')]=_0x342039['access_token'];_0x36eaf2[_0x6235('0x56')]=_0x342039['refresh_token'];return db[_0x6235('0x1d')][_0x6235('0x13')]({'data5':_0x36eaf2[_0x6235('0x55')],'data6':_0x36eaf2[_0x6235('0x56')]},{'where':{'id':_0x36eaf2['id']}});})[_0x6235('0x33')](function(){oauth[_0x6235('0x57')](_0x36eaf2);socket[_0x6235('0x58')](_0x6235('0x59'),{'id':_0x5d270f['id']});return;})['then'](respondWithStatusCode(_0x384bf2,null))['catch'](function(_0x3da8cc){if(_0x5d270f){socket[_0x6235('0x58')]('microsoftAuthorization:error',{'id':_0x5d270f['id']});}if(!_0x36eaf2){logger['error'](_0x6235('0x5a'),_0x3da8cc);return _0x384bf2[_0x6235('0xb')](0x1f4)[_0x6235('0x18')](_0x3da8cc['message']);}logger[_0x6235('0x15')](_0x6235('0x5b'),_0x36eaf2['id'],JSON[_0x6235('0x5c')](_0x3da8cc));});}; \ No newline at end of file +var _0x0b3b=['destroy','then','sendStatus','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','include','options','create','Service\x20parameter\x20not\x20specified','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','update','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','status','end','json','offset','undefined','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b3b,0x168));var _0xb0b3=function(_0x47024a,_0x2cc60a){_0x47024a=_0x47024a-0x0;var _0xc021b8=_0x0b3b[_0x47024a];return _0xc021b8;};'use strict';var _=require(_0xb0b3('0x0'));var Redis=require(_0xb0b3('0x1'));var qs=require(_0xb0b3('0x2'));var encryptor=require(_0xb0b3('0x3'));var config=require(_0xb0b3('0x4'));var logger=require('../../config/logger')(_0xb0b3('0x5'));var db=require(_0xb0b3('0x6'))['db'];var oauth=require(_0xb0b3('0x7'));config['redis']=_[_0xb0b3('0x8')](config[_0xb0b3('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0b3('0x9')]));var redis=new Redis(config[_0xb0b3('0x9')]);function respondWithStatusCode(_0x2ceefa,_0x48cf29){_0x48cf29=_0x48cf29||0xcc;return function(_0x4285a8){if(_0x4285a8){return _0x2ceefa['sendStatus'](_0x48cf29);}return _0x2ceefa[_0xb0b3('0xa')](_0x48cf29)[_0xb0b3('0xb')]();};}function respondWithResult(_0x227b5e,_0x4ac966){_0x4ac966=_0x4ac966||0xc8;return function(_0x420655){if(_0x420655){return _0x227b5e[_0xb0b3('0xa')](_0x4ac966)[_0xb0b3('0xc')](_0x420655);}};}function respondWithFilteredResult(_0x77a68,_0x4a39a9){return function(_0x4f9270){if(_0x4f9270){var _0x1098a8=typeof _0x4a39a9[_0xb0b3('0xd')]==='undefined'&&typeof _0x4a39a9['limit']===_0xb0b3('0xe');var _0x152527=_0x4f9270[_0xb0b3('0xf')];var _0x338902=_0x1098a8?0x0:_0x4a39a9[_0xb0b3('0xd')];var _0x26d7e2=_0x1098a8?_0x4f9270[_0xb0b3('0xf')]:_0x4a39a9[_0xb0b3('0xd')]+_0x4a39a9['limit'];var _0x4408b2;if(_0x26d7e2>=_0x152527){_0x26d7e2=_0x152527;_0x4408b2=0xc8;}else{_0x4408b2=0xce;}_0x77a68['status'](_0x4408b2);return _0x77a68['set']('Content-Range',_0x338902+'-'+_0x26d7e2+'/'+_0x152527)[_0xb0b3('0xc')](_0x4f9270);}return null;};}function saveUpdates(_0xee31ee){return function(_0x3df732){if(_0x3df732){return _0x3df732['update'](_0xee31ee)['then'](function(_0x584c78){return _0x584c78;});}return null;};}function removeEntity(_0x2b3a33){return function(_0x394c38){if(_0x394c38){return _0x394c38[_0xb0b3('0x10')]()[_0xb0b3('0x11')](function(){_0x2b3a33[_0xb0b3('0xa')](0xcc)[_0xb0b3('0xb')]();});}};}function handleEntityNotFound(_0xe84d43){return function(_0x5edd88){if(!_0x5edd88){_0xe84d43[_0xb0b3('0x12')](0x194);}return _0x5edd88;};}function handleError(_0x5f035d,_0x3526e6){_0x3526e6=_0x3526e6||0x1f4;return function(_0x470b93){logger['error'](_0x470b93['stack']);if(_0x470b93[_0xb0b3('0x13')]){delete _0x470b93[_0xb0b3('0x13')];}_0x5f035d[_0xb0b3('0xa')](_0x3526e6)['send'](_0x470b93);};}function maskClientSecret(_0x74e334){return _[_0xb0b3('0x14')](_0x74e334[_0xb0b3('0x15')](0x0,0x3),0x14,'*');}exports[_0xb0b3('0x16')]=function(_0x2a9eea,_0x520a93){var _0x351049={},_0x3db094={},_0x257abf={'count':0x0,'rows':[]};var _0xa05667=_[_0xb0b3('0x17')](db[_0xb0b3('0x18')][_0xb0b3('0x19')],function(_0x4279b8){return{'name':_0x4279b8[_0xb0b3('0x1a')],'type':_0x4279b8[_0xb0b3('0x1b')][_0xb0b3('0x1c')]};});_0x3db094[_0xb0b3('0x1d')]=_[_0xb0b3('0x17')](_0xa05667,_0xb0b3('0x13'));_0x3db094['query']=_['keys'](_0x2a9eea[_0xb0b3('0x1e')]);_0x3db094[_0xb0b3('0x1f')]=_[_0xb0b3('0x20')](_0x3db094[_0xb0b3('0x1d')],_0x3db094['query']);_0x351049[_0xb0b3('0x21')]=_[_0xb0b3('0x20')](_0x3db094[_0xb0b3('0x1d')],qs['fields'](_0x2a9eea[_0xb0b3('0x1e')]['fields']));_0x351049[_0xb0b3('0x21')]=_0x351049[_0xb0b3('0x21')][_0xb0b3('0x22')]?_0x351049[_0xb0b3('0x21')]:_0x3db094[_0xb0b3('0x1d')];if(!_0x2a9eea[_0xb0b3('0x1e')][_0xb0b3('0x23')]('nolimit')){_0x351049[_0xb0b3('0x24')]=qs[_0xb0b3('0x24')](_0x2a9eea['query'][_0xb0b3('0x24')]);_0x351049[_0xb0b3('0xd')]=qs[_0xb0b3('0xd')](_0x2a9eea[_0xb0b3('0x1e')][_0xb0b3('0xd')]);}_0x351049[_0xb0b3('0x25')]=qs[_0xb0b3('0x26')](_0x2a9eea[_0xb0b3('0x1e')]['sort']);_0x351049['where']=qs[_0xb0b3('0x1f')](_[_0xb0b3('0x27')](_0x2a9eea[_0xb0b3('0x1e')],_0x3db094[_0xb0b3('0x1f')]),_0xa05667);if(_0x2a9eea['query'][_0xb0b3('0x28')]){_0x351049[_0xb0b3('0x29')]=_['merge'](_0x351049[_0xb0b3('0x29')],{'$or':_['map'](_0xa05667,function(_0x2a4d7d){if(_0x2a4d7d[_0xb0b3('0x1b')]!==_0xb0b3('0x2a')){var _0x32b49d={};_0x32b49d[_0x2a4d7d[_0xb0b3('0x13')]]={'$like':'%'+_0x2a9eea[_0xb0b3('0x1e')][_0xb0b3('0x28')]+'%'};return _0x32b49d;}})});}_0x351049=_[_0xb0b3('0x2b')]({},_0x351049,_0x2a9eea['options']);var _0x27b370={'where':_0x351049[_0xb0b3('0x29')]};return db[_0xb0b3('0x18')]['count'](_0x27b370)[_0xb0b3('0x11')](function(_0x1988cc){_0x257abf['count']=_0x1988cc;if(_0x2a9eea[_0xb0b3('0x1e')][_0xb0b3('0x2c')]){_0x351049['include']=[{'all':!![]}];}return db[_0xb0b3('0x18')][_0xb0b3('0x2d')](_0x351049);})['then'](function(_0x1ee4cb){_0x257abf[_0xb0b3('0x2e')]=_[_0xb0b3('0x17')](_0x1ee4cb,function(_0x3af6c4){if(_0x3af6c4[_0xb0b3('0x2f')]===_0xb0b3('0x30')){var _0x17579f=encryptor[_0xb0b3('0x31')](_0x3af6c4[_0xb0b3('0x32')]);_0x3af6c4['data3']=maskClientSecret(_0x17579f);}return _0x3af6c4;});return _0x257abf;})[_0xb0b3('0x11')](respondWithFilteredResult(_0x520a93,_0x351049))[_0xb0b3('0x33')](handleError(_0x520a93,null));};exports[_0xb0b3('0x34')]=function(_0x3c5183,_0x34557d){var _0x251b77={'raw':!![],'where':{'id':_0x3c5183[_0xb0b3('0x35')]['id']}},_0x4d42fe={};_0x4d42fe[_0xb0b3('0x1d')]=_['keys'](db['CloudProvider'][_0xb0b3('0x19')]);_0x4d42fe['query']=_[_0xb0b3('0x36')](_0x3c5183['query']);_0x4d42fe['filters']=_[_0xb0b3('0x20')](_0x4d42fe[_0xb0b3('0x1d')],_0x4d42fe['query']);_0x251b77['attributes']=_['intersection'](_0x4d42fe[_0xb0b3('0x1d')],qs['fields'](_0x3c5183[_0xb0b3('0x1e')]['fields']));_0x251b77['attributes']=_0x251b77[_0xb0b3('0x21')][_0xb0b3('0x22')]?_0x251b77[_0xb0b3('0x21')]:_0x4d42fe[_0xb0b3('0x1d')];if(_0x3c5183[_0xb0b3('0x1e')][_0xb0b3('0x2c')]){_0x251b77[_0xb0b3('0x37')]=[{'all':!![]}];}_0x251b77=_[_0xb0b3('0x2b')]({},_0x251b77,_0x3c5183[_0xb0b3('0x38')]);return db[_0xb0b3('0x18')]['find'](_0x251b77)[_0xb0b3('0x11')](handleEntityNotFound(_0x34557d,null))['then'](function(_0x52c57a){if(_0x52c57a[_0xb0b3('0x2f')]===_0xb0b3('0x30')){var _0x439892=encryptor[_0xb0b3('0x31')](_0x52c57a['data3']);_0x52c57a['data3']=maskClientSecret(_0x439892);}return _0x52c57a;})[_0xb0b3('0x11')](respondWithResult(_0x34557d,null))[_0xb0b3('0x33')](handleError(_0x34557d,null));};exports[_0xb0b3('0x39')]=function(_0x2ed13c,_0x3b0416){if(!_0x2ed13c['body'][_0xb0b3('0x13')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x2ed13c['body']['service'])throw new Error(_0xb0b3('0x3a'));var _0x493c25=db['CloudProvider'][_0xb0b3('0x19')][_0xb0b3('0x2f')][_0xb0b3('0x3b')];if(!_0x493c25[_0xb0b3('0x3c')](_0x2ed13c[_0xb0b3('0x3d')][_0xb0b3('0x2f')]))throw new Error(_0xb0b3('0x3e')+_0x493c25[_0xb0b3('0x3f')](',\x20'));if(_0x2ed13c['body'][_0xb0b3('0x2f')]===_0xb0b3('0x30')&&_0x2ed13c[_0xb0b3('0x3d')][_0xb0b3('0x32')]){_0x2ed13c[_0xb0b3('0x3d')][_0xb0b3('0x32')]=encryptor[_0xb0b3('0x40')](_0x2ed13c[_0xb0b3('0x3d')][_0xb0b3('0x32')]);}return db[_0xb0b3('0x18')][_0xb0b3('0x39')](_0x2ed13c[_0xb0b3('0x3d')],{})[_0xb0b3('0x11')](respondWithResult(_0x3b0416,0xc9))[_0xb0b3('0x33')](handleError(_0x3b0416,null));};exports['update']=function(_0x621a43,_0x19acaf){if(_0x621a43[_0xb0b3('0x3d')]['id']){delete _0x621a43[_0xb0b3('0x3d')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x621a43['params']['id']}})['then'](handleEntityNotFound(_0x19acaf,null))['then'](function(_0x5f3ed3){if(_0x5f3ed3[_0xb0b3('0x2f')]==='MicrosoftAzure'&&_0x621a43[_0xb0b3('0x3d')]['data3']){_0x621a43[_0xb0b3('0x3d')][_0xb0b3('0x32')]=encryptor['encryptString'](_0x621a43[_0xb0b3('0x3d')]['data3']);}return _0x5f3ed3;})[_0xb0b3('0x11')](saveUpdates(_0x621a43[_0xb0b3('0x3d')],null))[_0xb0b3('0x11')](respondWithResult(_0x19acaf,null))[_0xb0b3('0x33')](handleError(_0x19acaf,null));};exports['destroy']=function(_0x13db3f,_0x58c5e6){return db['CloudProvider']['find']({'where':{'id':_0x13db3f[_0xb0b3('0x35')]['id']}})[_0xb0b3('0x11')](handleEntityNotFound(_0x58c5e6,null))[_0xb0b3('0x11')](removeEntity(_0x58c5e6,null))[_0xb0b3('0x33')](handleError(_0x58c5e6,null));};exports['oauth2MicrosoftAuthorize']=function(_0x416a30,_0x2f5935){return db[_0xb0b3('0x18')]['findOne']({'where':{'id':_0x416a30[_0xb0b3('0x35')]['id']},'raw':!![]})['then'](function(_0xf92f08){if(!_0xf92f08)return _0x2f5935[_0xb0b3('0x12')](0x194);return{'url':oauth[_0xb0b3('0x41')](_0xf92f08,_0x416a30[_0xb0b3('0x42')]['id'])};})['then'](respondWithResult(_0x2f5935,null))[_0xb0b3('0x33')](handleError(_0x2f5935,null));};exports[_0xb0b3('0x43')]=function(_0x2c98a8,_0x1aca4d){var _0x2ebc6d=_0x2c98a8['body'];var _0x5aeab3;var _0x4a1dc8;if(_0x2ebc6d[_0xb0b3('0x44')])throw _0x2ebc6d;redis['get'](_0x2ebc6d[_0xb0b3('0x45')])[_0xb0b3('0x11')](function(_0x2a9716){if(!_0x2a9716)throw new Error(_0xb0b3('0x46'));_0x5aeab3=JSON[_0xb0b3('0x47')](_0x2a9716);var _0xfd5c6c=Buffer[_0xb0b3('0x48')](_0x2ebc6d[_0xb0b3('0x45')],_0xb0b3('0x49'))[_0xb0b3('0x4a')](_0xb0b3('0x4b'));_0x4a1dc8=JSON[_0xb0b3('0x47')](_0xfd5c6c);if(!oauth[_0xb0b3('0x4c')](_0x2ebc6d[_0xb0b3('0x4d')],_0x5aeab3['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xb0b3('0x4e')](_0x2ebc6d[_0xb0b3('0x45')]);return oauth[_0xb0b3('0x4f')](_0x2ebc6d[_0xb0b3('0x50')],_0x5aeab3);})['then'](function(_0x4ddd94){_0x5aeab3['data5']=_0x4ddd94[_0xb0b3('0x51')];_0x5aeab3[_0xb0b3('0x52')]=_0x4ddd94[_0xb0b3('0x53')];return db[_0xb0b3('0x18')][_0xb0b3('0x54')]({'data5':_0x5aeab3[_0xb0b3('0x55')],'data6':_0x5aeab3[_0xb0b3('0x52')]},{'where':{'id':_0x5aeab3['id']}});})[_0xb0b3('0x11')](function(){oauth[_0xb0b3('0x56')](_0x5aeab3);socket[_0xb0b3('0x57')](_0xb0b3('0x58'),{'id':_0x4a1dc8['id']});return;})[_0xb0b3('0x11')](respondWithStatusCode(_0x1aca4d,null))['catch'](function(_0x3e37f6){if(_0x4a1dc8){socket[_0xb0b3('0x57')](_0xb0b3('0x59'),{'id':_0x4a1dc8['id']});}if(!_0x5aeab3){logger[_0xb0b3('0x44')](_0xb0b3('0x5a'),_0x3e37f6);return _0x1aca4d['status'](0x1f4)[_0xb0b3('0x5b')](_0x3e37f6[_0xb0b3('0x5c')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x5aeab3['id'],JSON[_0xb0b3('0x5d')](_0x3e37f6));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fa3a5f9..fa885af 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 _0xf84c=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf84c,0x1b8));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcf84('0x0'));var logger=require(_0xcf84('0x1'))(_0xcf84('0x2'));var moment=require('moment');var BPromise=require(_0xcf84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf84('0x4'));var rimraf=require(_0xcf84('0x5'));var config=require(_0xcf84('0x6'));var attributes=require(_0xcf84('0x7'));module['exports']=function(_0x158d88,_0x343eb8){return _0x158d88[_0xcf84('0x8')](_0xcf84('0x9'),attributes,{'tableName':_0xcf84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb27=['exports','define','cloud_providers','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x58c340,_0x796d2f){var _0x315877=function(_0x1e3232){while(--_0x1e3232){_0x58c340['push'](_0x58c340['shift']());}};_0x315877(++_0x796d2f);}(_0xfb27,0x163));var _0x7fb2=function(_0x1f0448,_0xa2865f){_0x1f0448=_0x1f0448-0x0;var _0x16fe78=_0xfb27[_0x1f0448];return _0x16fe78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7fb2('0x0'))(_0x7fb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fb2('0x2'));var rimraf=require(_0x7fb2('0x3'));var config=require(_0x7fb2('0x4'));var attributes=require('./cloudProvider.attributes');module[_0x7fb2('0x5')]=function(_0x2eae7a,_0x290ff2){return _0x2eae7a[_0x7fb2('0x6')]('CloudProvider',attributes,{'tableName':_0x7fb2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9232373..c62b34a 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f3=['/.default','data2','code','id_token','stringify','toString','base64','hex','client_id','response_type','join','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','key','replace','oauth2/','data1','set','payload','issuer','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','{TENANT_ID}','access_token','data5','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','intervals','all','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','Dynamics365','data7','type','Outlook365'];(function(_0xacc326,_0x56bc9f){var _0x37143f=function(_0x12526a){while(--_0x12526a){_0xacc326['push'](_0xacc326['shift']());}};_0x37143f(++_0x56bc9f);}(_0x32f3,0x10a));var _0x332f=function(_0x491cf5,_0x3a5308){_0x491cf5=_0x491cf5-0x0;var _0x17c70c=_0x32f3[_0x491cf5];return _0x17c70c;};'use strict';var _=require(_0x332f('0x0'));var crypto=require(_0x332f('0x1'));var jwt=require(_0x332f('0x2'));var moment=require('moment');var Redis=require(_0x332f('0x3'));var rp=require(_0x332f('0x4'));var util=require(_0x332f('0x5'));var encryptor=require(_0x332f('0x6'));var config=require(_0x332f('0x7'));var logger=require(_0x332f('0x8'))('api');var schedule=require(_0x332f('0x9'));var db=require(_0x332f('0xa'))['db'];config[_0x332f('0xb')]=_[_0x332f('0xc')](config['redis'],{'host':_0x332f('0xd'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x332f('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x332f('0xf'),'profile',_0x332f('0x10'),_0x332f('0x11'),_0x332f('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x332f('0x13')],'Dynamics365':['openid',_0x332f('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x332f('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x14d65c){var _0x1e62aa=_[_0x332f('0x15')](AZURE_AUTH_SCOPES[_0x14d65c['type']]);if(_0x14d65c['type']===_0x332f('0x16'))_0x1e62aa['push'](_0x14d65c[_0x332f('0x17')]+'/.default');return _0x1e62aa['join']('\x20');}function getAccessTokenScope(_0xac8e1c){if(_0xac8e1c[_0x332f('0x18')]===_0x332f('0x19'))return _0x332f('0x12');if(_0xac8e1c[_0x332f('0x18')]===_0x332f('0x16'))return _0xac8e1c[_0x332f('0x17')]+_0x332f('0x1a');}function generateMicrosoftAuthorizationUrl(_0x24cd0e,_0x255eb2){var _0x4d75a5=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x24cd0e[_0x332f('0x1b')]);var _0xaf7f9=[_0x332f('0x1c'),_0x332f('0x1d')];var _0x55a0f3=Buffer['from'](JSON[_0x332f('0x1e')]({'id':_0x255eb2}))[_0x332f('0x1f')](_0x332f('0x20'));var _0x4c0101=crypto['randomBytes'](0x10)['toString'](_0x332f('0x21'));var _0x4b4efc=getAuthorizationScopes(_0x24cd0e);var _0x3ca9ee=[{'key':_0x332f('0x22'),'value':_0x24cd0e['data1']},{'key':_0x332f('0x23'),'value':encodeURIComponent(_0xaf7f9[_0x332f('0x24')]('\x20'))},{'key':_0x332f('0x25'),'value':_0x24cd0e['data4']},{'key':_0x332f('0x26'),'value':_0x332f('0x27')},{'key':_0x332f('0x28'),'value':encodeURIComponent(_0x4b4efc)},{'key':_0x332f('0x29'),'value':_0x55a0f3},{'key':_0x332f('0x2a'),'value':_0x4c0101},{'key':_0x332f('0x2b'),'value':'login'}];var _0x446b5e=_0x4d75a5+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x332f('0x15')](_0x3ca9ee,function(_0x5903fc){return _0x5903fc[_0x332f('0x2c')]+'='+_0x5903fc['value'];})[_0x332f('0x24')]('&');_0x24cd0e['oauth2Claims']={'issuer':_0x4d75a5[_0x332f('0x2d')](_0x332f('0x2e'),''),'audience':_0x24cd0e[_0x332f('0x2f')],'state':_0x55a0f3,'nonce':_0x4c0101};redis[_0x332f('0x30')](_0x55a0f3,JSON[_0x332f('0x1e')](_0x24cd0e));return _0x446b5e;}function isValidIdToken(_0x519db1,_0x10dcca){try{var _0x467a6a=jwt['decode'](_0x519db1,{'complete':!![]});var _0x318323=_0x467a6a[_0x332f('0x31')];if(_0x318323['iss']!==_0x10dcca[_0x332f('0x32')])return![];if(_0x318323['aud']!==_0x10dcca['audience'])return![];if(_0x318323[_0x332f('0x2a')]!==_0x10dcca[_0x332f('0x2a')])return![];if(moment()[_0x332f('0x33')](moment[_0x332f('0x34')](_0x318323[_0x332f('0x35')])))return![];return!![];}catch(_0x4637ca){throw _0x4637ca;}}function refreshOauth2MicrosoftAccessToken(_0x10be28){return Promise[_0x332f('0x36')]()['then'](function(){if(_0x10be28[_0x332f('0x37')])return _0x10be28;return db[_0x332f('0x38')][_0x332f('0x39')]({'where':{'id':_0x10be28['id']},'raw':!![]});})[_0x332f('0x3a')](function(_0x1b84d4){var _0x95affb={'grant_type':_0x332f('0x3b'),'refresh_token':_0x1b84d4[_0x332f('0x3c')],'scope':getAccessTokenScope(_0x1b84d4),'redirect_uri':_0x1b84d4['data4'],'client_id':_0x1b84d4['data1'],'client_secret':encryptor[_0x332f('0x3d')](_0x1b84d4[_0x332f('0x37')])};var _0x42486b={'method':_0x332f('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x332f('0x3f'),_0x1b84d4['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x95affb,'json':!![]};return rp(_0x42486b);})[_0x332f('0x3a')](function(_0x10d141){_0x10be28['data5']=_0x10d141[_0x332f('0x40')];_0x10be28[_0x332f('0x3c')]=_0x10d141[_0x332f('0x3b')];return db[_0x332f('0x38')]['update']({'data5':_0x10be28[_0x332f('0x41')],'data6':_0x10be28[_0x332f('0x3c')]},{'where':{'id':_0x10be28['id']}});})[_0x332f('0x3a')](function(){return _0x10be28;})['catch'](function(_0x525f36){logger['error'](_0x332f('0x42'),_0x10be28['id'],_0x525f36);});}function getOauth2MicrosoftAccessToken(_0x36adbc,_0x47894e){var _0x21fecd={'grant_type':'authorization_code','code':_0x36adbc,'scope':getAccessTokenScope(_0x47894e),'redirect_uri':_0x47894e[_0x332f('0x43')],'client_id':_0x47894e[_0x332f('0x2f')],'client_secret':encryptor['decryptString'](_0x47894e[_0x332f('0x37')])};var _0x27400b={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x332f('0x2d')]('{TENANT_ID}',_0x47894e[_0x332f('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x21fecd,'json':!![]};return rp(_0x27400b);}function startRefreshInterval(_0x13b497){var _0x50c0a5=schedule['intervals'];if(_0x50c0a5[_0x13b497['id']])clearInterval(_0x50c0a5[_0x13b497['id']]);_0x50c0a5[_0x13b497['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x13b497['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x332f('0x44')]=_0x50c0a5;}function startAllRefreshIntervals(){return db[_0x332f('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x332f('0x3a')](function(_0x4a2728){var _0x1d2a62=_0x4a2728[_0x332f('0x15')](function(_0x11eddf){return refreshOauth2MicrosoftAccessToken(_0x11eddf)[_0x332f('0x3a')](function(_0x3d655f){startRefreshInterval(_0x3d655f);});});return Promise[_0x332f('0x45')](_0x1d2a62);})[_0x332f('0x46')](function(_0x4e9ecb){var _0x3a7a0c=_0x4e9ecb?util['inspect'](_0x4e9ecb,{'showHidden':![],'depth':null}):'';logger[_0x332f('0x47')](_0x332f('0x48'),_0x3a7a0c);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x5dd8=['decode','payload','iss','issuer','aud','nonce','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','data4','decryptString','data3','POST','{TENANT_ID}','access_token','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','moment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','join','Outlook365','Dynamics365','replace','data2','code','id_token','stringify','toString','base64','randomBytes','data1','redirect_uri','response_mode','form_post','state','prompt','login','map','key','value','oauth2Claims','oauth2/','set'];(function(_0x1b98a1,_0x51ea61){var _0x575d89=function(_0x32bfdf){while(--_0x32bfdf){_0x1b98a1['push'](_0x1b98a1['shift']());}};_0x575d89(++_0x51ea61);}(_0x5dd8,0xb1));var _0x85dd=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x5dd8[_0x46e523];return _0x5da0ee;};'use strict';var _=require(_0x85dd('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x85dd('0x1'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x85dd('0x2'))(_0x85dd('0x3'));var schedule=require(_0x85dd('0x4'));var db=require(_0x85dd('0x5'))['db'];config[_0x85dd('0x6')]=_['defaults'](config[_0x85dd('0x6')],{'host':_0x85dd('0x7'),'port':0x18eb});var redis=new Redis(config[_0x85dd('0x6')]);var MICROSOFT_AUTH_URL=_0x85dd('0x8');var AZURE_AUTH_SCOPES={'Outlook365':[_0x85dd('0x9'),'profile',_0x85dd('0xa'),_0x85dd('0xb'),_0x85dd('0xc'),_0x85dd('0xd'),_0x85dd('0xe')],'Dynamics365':['openid',_0x85dd('0xb')]};var MICROSOFT_AUTH_ENDPOINT=_0x85dd('0xf');var MICROSOFT_TOKEN_ENDPOINT=_0x85dd('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x28776b){var _0x1f89cf=_['map'](AZURE_AUTH_SCOPES[_0x28776b['type']]);if(_0x28776b[_0x85dd('0x11')]==='Dynamics365')_0x1f89cf[_0x85dd('0x12')](_0x28776b[_0x85dd('0x13')]+_0x85dd('0x14'));return _0x1f89cf[_0x85dd('0x15')]('\x20');}function getAccessTokenScope(_0x4a9700){if(_0x4a9700['type']===_0x85dd('0x16'))return _0x85dd('0xc');if(_0x4a9700[_0x85dd('0x11')]===_0x85dd('0x17'))return _0x4a9700[_0x85dd('0x13')]+_0x85dd('0x14');}function generateMicrosoftAuthorizationUrl(_0x15bdc1,_0x2c4b8f){var _0xe38d9d=MICROSOFT_AUTH_URL[_0x85dd('0x18')]('{TENANT_ID}',_0x15bdc1[_0x85dd('0x19')]);var _0x3d3b50=[_0x85dd('0x1a'),_0x85dd('0x1b')];var _0x7538a6=Buffer['from'](JSON[_0x85dd('0x1c')]({'id':_0x2c4b8f}))[_0x85dd('0x1d')](_0x85dd('0x1e'));var _0x4adce4=crypto[_0x85dd('0x1f')](0x10)[_0x85dd('0x1d')]('hex');var _0x4804fc=getAuthorizationScopes(_0x15bdc1);var _0x333a08=[{'key':'client_id','value':_0x15bdc1[_0x85dd('0x20')]},{'key':'response_type','value':encodeURIComponent(_0x3d3b50[_0x85dd('0x15')]('\x20'))},{'key':_0x85dd('0x21'),'value':_0x15bdc1['data4']},{'key':_0x85dd('0x22'),'value':_0x85dd('0x23')},{'key':'scope','value':encodeURIComponent(_0x4804fc)},{'key':_0x85dd('0x24'),'value':_0x7538a6},{'key':'nonce','value':_0x4adce4},{'key':_0x85dd('0x25'),'value':_0x85dd('0x26')}];var _0x54c845=_0xe38d9d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x85dd('0x27')](_0x333a08,function(_0x123c57){return _0x123c57[_0x85dd('0x28')]+'='+_0x123c57[_0x85dd('0x29')];})[_0x85dd('0x15')]('&');_0x15bdc1[_0x85dd('0x2a')]={'issuer':_0xe38d9d[_0x85dd('0x18')](_0x85dd('0x2b'),''),'audience':_0x15bdc1[_0x85dd('0x20')],'state':_0x7538a6,'nonce':_0x4adce4};redis[_0x85dd('0x2c')](_0x7538a6,JSON[_0x85dd('0x1c')](_0x15bdc1));return _0x54c845;}function isValidIdToken(_0x39e4d5,_0x5f2185){try{var _0x5e020e=jwt[_0x85dd('0x2d')](_0x39e4d5,{'complete':!![]});var _0x4df88a=_0x5e020e[_0x85dd('0x2e')];if(_0x4df88a[_0x85dd('0x2f')]!==_0x5f2185[_0x85dd('0x30')])return![];if(_0x4df88a[_0x85dd('0x31')]!==_0x5f2185['audience'])return![];if(_0x4df88a[_0x85dd('0x32')]!==_0x5f2185[_0x85dd('0x32')])return![];if(moment()[_0x85dd('0x33')](moment[_0x85dd('0x34')](_0x4df88a[_0x85dd('0x35')])))return![];return!![];}catch(_0x598c10){throw _0x598c10;}}function refreshOauth2MicrosoftAccessToken(_0x1f4eb4){return Promise[_0x85dd('0x36')]()[_0x85dd('0x37')](function(){if(_0x1f4eb4['data3'])return _0x1f4eb4;return db[_0x85dd('0x38')][_0x85dd('0x39')]({'where':{'id':_0x1f4eb4['id']},'raw':!![]});})[_0x85dd('0x37')](function(_0x3dee1d){var _0x2b3721={'grant_type':_0x85dd('0x3a'),'refresh_token':_0x3dee1d[_0x85dd('0x3b')],'scope':getAccessTokenScope(_0x3dee1d),'redirect_uri':_0x3dee1d[_0x85dd('0x3c')],'client_id':_0x3dee1d[_0x85dd('0x20')],'client_secret':encryptor[_0x85dd('0x3d')](_0x3dee1d[_0x85dd('0x3e')])};var _0x38fb2e={'method':_0x85dd('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x85dd('0x18')](_0x85dd('0x40'),_0x3dee1d[_0x85dd('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b3721,'json':!![]};return rp(_0x38fb2e);})[_0x85dd('0x37')](function(_0x37d1c3){_0x1f4eb4['data5']=_0x37d1c3[_0x85dd('0x41')];_0x1f4eb4[_0x85dd('0x3b')]=_0x37d1c3[_0x85dd('0x3a')];return db[_0x85dd('0x38')]['update']({'data5':_0x1f4eb4['data5'],'data6':_0x1f4eb4[_0x85dd('0x3b')]},{'where':{'id':_0x1f4eb4['id']}});})['then'](function(){return _0x1f4eb4;})[_0x85dd('0x42')](function(_0x1862bf){logger['error'](_0x85dd('0x43'),_0x1f4eb4['id'],_0x1862bf);});}function getOauth2MicrosoftAccessToken(_0x1ec838,_0x36c601){var _0x5d823c={'grant_type':_0x85dd('0x44'),'code':_0x1ec838,'scope':getAccessTokenScope(_0x36c601),'redirect_uri':_0x36c601[_0x85dd('0x3c')],'client_id':_0x36c601[_0x85dd('0x20')],'client_secret':encryptor['decryptString'](_0x36c601['data3'])};var _0x1d6a59={'method':_0x85dd('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x85dd('0x18')](_0x85dd('0x40'),_0x36c601[_0x85dd('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d823c,'json':!![]};return rp(_0x1d6a59);}function startRefreshInterval(_0x313c98){var _0x5e92c6=schedule['intervals'];if(_0x5e92c6[_0x313c98['id']])clearInterval(_0x5e92c6[_0x313c98['id']]);_0x5e92c6[_0x313c98['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x85dd('0x45')](this,{'id':_0x313c98['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5e92c6;}function startAllRefreshIntervals(){return db[_0x85dd('0x38')][_0x85dd('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x85dd('0x37')](function(_0x6430f6){var _0x16d554=_0x6430f6['map'](function(_0x10bf0f){return refreshOauth2MicrosoftAccessToken(_0x10bf0f)[_0x85dd('0x37')](function(_0x402af3){startRefreshInterval(_0x402af3);});});return Promise[_0x85dd('0x47')](_0x16d554);})[_0x85dd('0x42')](function(_0x2daea6){var _0x412c79=_0x2daea6?util[_0x85dd('0x48')](_0x2daea6,{'showHidden':![],'depth':null}):'';logger['error'](_0x85dd('0x49'),_0x412c79);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index d489370..568fd25 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 _0x1c9a=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x1c9a,0x98));var _0xa1c9=function(_0x15b53c,_0x389a8b){_0x15b53c=_0x15b53c-0x0;var _0xde9485=_0x1c9a[_0x15b53c];return _0xde9485;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('CloudProvider,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});} \ No newline at end of file +var _0x8276=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','CloudProvider,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x149b25,_0x2bb415){var _0x40b742=function(_0x103584){while(--_0x103584){_0x149b25['push'](_0x149b25['shift']());}};_0x40b742(++_0x2bb415);}(_0x8276,0xa7));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6827('0x2'));var fs=require('fs');var Redis=require(_0x6827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6827('0x4'));var logger=require(_0x6827('0x5'))('rpc');var config=require(_0x6827('0x6'));var jayson=require(_0x6827('0x7'));var client=jayson[_0x6827('0x8')][_0x6827('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x461c14,_0x38c2e7,_0x17ac1b){return new BPromise(function(_0x2d8f3f,_0x21cdf0){return client['request'](_0x461c14,_0x17ac1b)[_0x6827('0xa')](function(_0x352cd5){logger[_0x6827('0xb')]('CloudProvider,\x20%s,\x20%s',_0x38c2e7,_0x6827('0xc'));logger[_0x6827('0xd')](_0x6827('0xe'),_0x38c2e7,'request\x20sent',JSON[_0x6827('0xf')](_0x352cd5));if(_0x352cd5[_0x6827('0x10')]){if(_0x352cd5[_0x6827('0x10')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x38c2e7,_0x352cd5[_0x6827('0x10')][_0x6827('0x11')]);return _0x21cdf0(_0x352cd5[_0x6827('0x10')]['message']);}logger[_0x6827('0x10')](_0x6827('0x12'),_0x38c2e7,_0x352cd5['error']['message']);return _0x2d8f3f(_0x352cd5[_0x6827('0x10')][_0x6827('0x11')]);}else{logger[_0x6827('0xb')](_0x6827('0x12'),_0x38c2e7,_0x6827('0xc'));_0x2d8f3f(_0x352cd5['result']['message']);}})[_0x6827('0x13')](function(_0x447ede){logger['error']('CloudProvider,\x20%s,\x20%s',_0x38c2e7,_0x447ede);_0x21cdf0(_0x447ede);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e8f151a..b1a1790 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1af2a8,_0xec502b){var _0x490d13=function(_0x41d8fd){while(--_0x41d8fd){_0x1af2a8['push'](_0x1af2a8['shift']());}};_0x490d13(++_0xec502b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x48f3d8,_0x1182f3){var _0x406879=function(_0x3471f2){while(--_0x3471f2){_0x48f3d8['push'](_0x48f3d8['shift']());}};_0x406879(++_0x1182f3);}(_0xdb28,0x106));var _0x8db2=function(_0x3cd7f7,_0x4f3b89){_0x3cd7f7=_0x3cd7f7-0x0;var _0x591f60=_0xdb28[_0x3cd7f7];return _0x591f60;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 02f06e6..786bb6b 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 _0xde0e=['name','sequelize','exports','STRING'];(function(_0x29cbb6,_0x4a52ce){var _0x485aab=function(_0x181047){while(--_0x181047){_0x29cbb6['push'](_0x29cbb6['shift']());}};_0x485aab(++_0x4a52ce);}(_0xde0e,0x145));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xede0('0x0'));module[_0xede0('0x1')]={'name':{'type':Sequelize[_0xede0('0x2')],'unique':_0xede0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xede0('0x2')]},'companyId':{'type':Sequelize[_0xede0('0x2')]},'website':{'type':Sequelize[_0xede0('0x2')]},'phone':{'type':Sequelize[_0xede0('0x2')]},'fax':{'type':Sequelize[_0xede0('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xede0('0x2')]},'country':{'type':Sequelize[_0xede0('0x2')]},'email':{'type':Sequelize[_0xede0('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xede0('0x2')]},'sPostalCode':{'type':Sequelize[_0xede0('0x2')]},'sCity':{'type':Sequelize[_0xede0('0x2')]},'sCountry':{'type':Sequelize[_0xede0('0x2')]},'description':{'type':Sequelize[_0xede0('0x2')]}}; \ No newline at end of file +var _0x4d81=['exports','STRING','name','sequelize'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x4d81,0x187));var _0x14d8=function(_0x554db4,_0x4cbe7b){_0x554db4=_0x554db4-0x0;var _0x6b1dd1=_0x4d81[_0x554db4];return _0x6b1dd1;};'use strict';var Sequelize=require(_0x14d8('0x0'));module[_0x14d8('0x1')]={'name':{'type':Sequelize[_0x14d8('0x2')],'unique':_0x14d8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x14d8('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x14d8('0x2')]},'phone':{'type':Sequelize[_0x14d8('0x2')]},'fax':{'type':Sequelize[_0x14d8('0x2')]},'type':{'type':Sequelize[_0x14d8('0x2')]},'street':{'type':Sequelize[_0x14d8('0x2')]},'postalCode':{'type':Sequelize[_0x14d8('0x2')]},'city':{'type':Sequelize[_0x14d8('0x2')]},'country':{'type':Sequelize[_0x14d8('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x14d8('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x14d8('0x2')]},'sCity':{'type':Sequelize[_0x14d8('0x2')]},'sCountry':{'type':Sequelize[_0x14d8('0x2')]},'description':{'type':Sequelize[_0x14d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1296133..45c7e4c 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 _0xfa9a=['undefined','limit','set','apply','reject','save','update','destroy','Companies','UserProfileResource','then','stack','name','send','describe','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CmCompany','count','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','map','getContacts','eml-format','zip-dir','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa9a,0x1dd));var _0xafa9=function(_0x18f88d,_0x2c94a7){_0x18f88d=_0x18f88d-0x0;var _0x2d351e=_0xfa9a[_0x18f88d];return _0x2d351e;};'use strict';var emlformat=require(_0xafa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafa9('0x2'));var BPromise=require(_0xafa9('0x3'));var Mustache=require(_0xafa9('0x4'));var util=require(_0xafa9('0x5'));var path=require(_0xafa9('0x6'));var sox=require(_0xafa9('0x7'));var csv=require(_0xafa9('0x8'));var ejs=require(_0xafa9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafa9('0xa'));var squel=require(_0xafa9('0xb'));var crypto=require(_0xafa9('0xc'));var jsforce=require(_0xafa9('0xd'));var deskjs=require(_0xafa9('0xe'));var toCsv=require(_0xafa9('0x8'));var querystring=require(_0xafa9('0xf'));var Papa=require(_0xafa9('0x10'));var Redis=require(_0xafa9('0x11'));var authService=require(_0xafa9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xafa9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xafa9('0x14'));var licenseUtil=require(_0xafa9('0x15'));var db=require(_0xafa9('0x16'))['db'];function respondWithStatusCode(_0x3c8ef2,_0xa97622){_0xa97622=_0xa97622||0xcc;return function(_0x3212ec){if(_0x3212ec){return _0x3c8ef2[_0xafa9('0x17')](_0xa97622);}return _0x3c8ef2[_0xafa9('0x18')](_0xa97622)['end']();};}function respondWithResult(_0x1655d5,_0x7a5df8){_0x7a5df8=_0x7a5df8||0xc8;return function(_0x120929){if(_0x120929){return _0x1655d5[_0xafa9('0x18')](_0x7a5df8)[_0xafa9('0x19')](_0x120929);}};}function respondWithFilteredResult(_0x2c4b1e,_0x56c300){return function(_0x52c332){if(_0x52c332){var _0x5ca1ea=typeof _0x56c300[_0xafa9('0x1a')]===_0xafa9('0x1b')&&typeof _0x56c300[_0xafa9('0x1c')]===_0xafa9('0x1b');var _0x5c7e93=_0x52c332['count'];var _0x27e158=_0x5ca1ea?0x0:_0x56c300[_0xafa9('0x1a')];var _0x5c65da=_0x5ca1ea?_0x52c332['count']:_0x56c300[_0xafa9('0x1a')]+_0x56c300[_0xafa9('0x1c')];var _0x53b622;if(_0x5c65da>=_0x5c7e93){_0x5c65da=_0x5c7e93;_0x53b622=0xc8;}else{_0x53b622=0xce;}_0x2c4b1e[_0xafa9('0x18')](_0x53b622);return _0x2c4b1e[_0xafa9('0x1d')]('Content-Range',_0x27e158+'-'+_0x5c65da+'/'+_0x5c7e93)['json'](_0x52c332);}return null;};}function patchUpdates(_0x1b2b9f){return function(_0x5651d0){try{jsonpatch[_0xafa9('0x1e')](_0x5651d0,_0x1b2b9f,!![]);}catch(_0x20a1f9){return BPromise[_0xafa9('0x1f')](_0x20a1f9);}return _0x5651d0[_0xafa9('0x20')]();};}function saveUpdates(_0x3d4446,_0x59115c){return function(_0x4eda70){if(_0x4eda70){return _0x4eda70[_0xafa9('0x21')](_0x3d4446)['then'](function(_0x47ef16){return _0x47ef16;});}return null;};}function removeEntity(_0x1912bc,_0x26e774){return function(_0x5d7243){if(_0x5d7243){return _0x5d7243[_0xafa9('0x22')]()['then'](function(){var _0x1db8b0=_0x5d7243['get']({'plain':!![]});var _0x33cd80=_0xafa9('0x23');return db[_0xafa9('0x24')][_0xafa9('0x22')]({'where':{'type':_0x33cd80,'resourceId':_0x1db8b0['id']}})['then'](function(){return _0x5d7243;});})[_0xafa9('0x25')](function(){_0x1912bc[_0xafa9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x283d04,_0x352764){return function(_0x505705){if(!_0x505705){_0x283d04[_0xafa9('0x17')](0x194);}return _0x505705;};}function handleError(_0x251ff3,_0x2feedc){_0x2feedc=_0x2feedc||0x1f4;return function(_0x4053f6){logger['error'](_0x4053f6[_0xafa9('0x26')]);if(_0x4053f6[_0xafa9('0x27')]){delete _0x4053f6[_0xafa9('0x27')];}_0x251ff3[_0xafa9('0x18')](_0x2feedc)[_0xafa9('0x28')](_0x4053f6);};}exports['index']=function(_0x4082fd,_0x43255d){var _0x513702={},_0xb215ff={},_0x4992dd={'count':0x0,'rows':[]};return db['CmCompany'][_0xafa9('0x29')]()[_0xafa9('0x25')](function(_0x169887){_0xb215ff[_0xafa9('0x2a')]=_['keys'](_0x169887);_0xb215ff[_0xafa9('0x2b')]=_[_0xafa9('0x2c')](_0x4082fd['query']);_0xb215ff['filters']=_['intersection'](_0xb215ff[_0xafa9('0x2a')],_0xb215ff[_0xafa9('0x2b')]);_0x513702[_0xafa9('0x2d')]=_[_0xafa9('0x2e')](_0xb215ff[_0xafa9('0x2a')],qs[_0xafa9('0x2f')](_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x2f')]));_0x513702[_0xafa9('0x2d')]=_0x513702['attributes']['length']?_0x513702[_0xafa9('0x2d')]:_0xb215ff[_0xafa9('0x2a')];if(!_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x30')](_0xafa9('0x31'))){_0x513702[_0xafa9('0x1c')]=qs[_0xafa9('0x1c')](_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x1c')]);_0x513702[_0xafa9('0x1a')]=qs['offset'](_0x4082fd['query'][_0xafa9('0x1a')]);}_0x513702[_0xafa9('0x32')]=qs[_0xafa9('0x33')](_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x33')]);_0x513702[_0xafa9('0x34')]=qs[_0xafa9('0x35')](_[_0xafa9('0x36')](_0x4082fd[_0xafa9('0x2b')],_0xb215ff['filters']),_0x169887);if(_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x37')]){_0x513702[_0xafa9('0x34')]=_[_0xafa9('0x38')](_0x513702[_0xafa9('0x34')],{'$or':_['map'](_0x513702[_0xafa9('0x2d')],function(_0x18f136){var _0x1e5dab={};_0x1e5dab[_0x18f136]={'$like':'%'+_0x4082fd[_0xafa9('0x2b')]['filter']+'%'};return _0x1e5dab;})});}_0x513702=_[_0xafa9('0x38')]({},_0x513702,_0x4082fd[_0xafa9('0x39')]);var _0x2b91f2={'where':_0x513702[_0xafa9('0x34')]};return db[_0xafa9('0x3a')]['count'](_0x2b91f2)[_0xafa9('0x25')](function(_0x15a448){_0x4992dd[_0xafa9('0x3b')]=_0x15a448;if(_0x4082fd[_0xafa9('0x2b')][_0xafa9('0x3c')]){_0x513702[_0xafa9('0x3d')]=[{'all':!![]}];}return db[_0xafa9('0x3a')][_0xafa9('0x3e')](_0x513702);})['then'](function(_0x2d0a95){_0x4992dd[_0xafa9('0x3f')]=_0x2d0a95;return _0x4992dd;})[_0xafa9('0x25')](respondWithFilteredResult(_0x43255d,_0x513702))[_0xafa9('0x40')](handleError(_0x43255d,null));})[_0xafa9('0x40')](handleError(_0x43255d,null));};exports['show']=function(_0x18c494,_0x5464e1){var _0x2bfc0b={'raw':![],'where':{'id':_0x18c494[_0xafa9('0x41')]['id']}},_0x408c82={};_0x408c82['model']=_[_0xafa9('0x2c')](db[_0xafa9('0x3a')][_0xafa9('0x42')]);_0x408c82[_0xafa9('0x2b')]=_[_0xafa9('0x2c')](_0x18c494[_0xafa9('0x2b')]);_0x408c82[_0xafa9('0x35')]=_['intersection'](_0x408c82[_0xafa9('0x2a')],_0x408c82[_0xafa9('0x2b')]);_0x2bfc0b[_0xafa9('0x2d')]=_[_0xafa9('0x2e')](_0x408c82['model'],qs['fields'](_0x18c494[_0xafa9('0x2b')][_0xafa9('0x2f')]));_0x2bfc0b['attributes']=_0x2bfc0b[_0xafa9('0x2d')][_0xafa9('0x43')]?_0x2bfc0b[_0xafa9('0x2d')]:_0x408c82[_0xafa9('0x2a')];if(_0x18c494['query'][_0xafa9('0x3c')]){_0x2bfc0b['include']=[{'all':!![]}];}_0x2bfc0b=_[_0xafa9('0x38')]({},_0x2bfc0b,_0x18c494[_0xafa9('0x39')]);return db[_0xafa9('0x3a')][_0xafa9('0x44')](_0x2bfc0b)[_0xafa9('0x25')](handleEntityNotFound(_0x5464e1,null))[_0xafa9('0x25')](respondWithResult(_0x5464e1,null))[_0xafa9('0x40')](handleError(_0x5464e1,null));};exports[_0xafa9('0x45')]=function(_0x34e405,_0x3f916a){return db[_0xafa9('0x3a')][_0xafa9('0x45')](_0x34e405[_0xafa9('0x46')],{})[_0xafa9('0x25')](function(_0x172917){var _0x2d5368=_0x34e405['user'][_0xafa9('0x47')]({'plain':!![]});if(!_0x2d5368)throw new Error(_0xafa9('0x48'));if(_0x2d5368['role']==='user'){var _0x2e38e1=_0x172917[_0xafa9('0x47')]({'plain':!![]});var _0x19d61a=_0xafa9('0x23');return db['UserProfileSection'][_0xafa9('0x44')]({'where':{'name':_0x19d61a,'userProfileId':_0x2d5368[_0xafa9('0x49')]},'raw':!![]})[_0xafa9('0x25')](function(_0x4ba950){if(_0x4ba950&&_0x4ba950[_0xafa9('0x4a')]===0x0){return db[_0xafa9('0x24')][_0xafa9('0x45')]({'name':_0x2e38e1[_0xafa9('0x27')],'resourceId':_0x2e38e1['id'],'type':_0x4ba950['name'],'sectionId':_0x4ba950['id']},{})['then'](function(){return _0x172917;});}else{return _0x172917;}})['catch'](function(_0x33eadb){logger[_0xafa9('0x4b')](_0xafa9('0x4c'),_0x33eadb);throw _0x33eadb;});}return _0x172917;})[_0xafa9('0x25')](respondWithResult(_0x3f916a,0xc9))[_0xafa9('0x40')](handleError(_0x3f916a,null));};exports[_0xafa9('0x21')]=function(_0x2fdbaa,_0x1298d9){if(_0x2fdbaa['body']['id']){delete _0x2fdbaa[_0xafa9('0x46')]['id'];}return db[_0xafa9('0x3a')][_0xafa9('0x44')]({'where':{'id':_0x2fdbaa['params']['id']}})[_0xafa9('0x25')](handleEntityNotFound(_0x1298d9,null))[_0xafa9('0x25')](saveUpdates(_0x2fdbaa[_0xafa9('0x46')],null))['then'](respondWithResult(_0x1298d9,null))[_0xafa9('0x40')](handleError(_0x1298d9,null));};exports[_0xafa9('0x22')]=function(_0x136232,_0x426496){return db[_0xafa9('0x3a')][_0xafa9('0x44')]({'where':{'id':_0x136232[_0xafa9('0x41')]['id']}})[_0xafa9('0x25')](handleEntityNotFound(_0x426496,null))[_0xafa9('0x25')](removeEntity(_0x426496,null))[_0xafa9('0x40')](handleError(_0x426496,null));};exports[_0xafa9('0x29')]=function(_0x2d016c,_0x471425){return db['CmCompany'][_0xafa9('0x29')]()[_0xafa9('0x25')](respondWithResult(_0x471425,null))[_0xafa9('0x40')](handleError(_0x471425,null));};exports[_0xafa9('0x4d')]=function(_0x596971,_0x58bd4f,_0xed04c5){return db[_0xafa9('0x4e')][_0xafa9('0x44')]({'where':{'id':_0x596971[_0xafa9('0x41')]['id']}})['then'](handleEntityNotFound(_0x58bd4f,null))[_0xafa9('0x25')](function(_0x265871){if(_0x265871){return _0x265871[_0xafa9('0x4d')](_0x596971['body'][_0xafa9('0x4f')],_[_0xafa9('0x50')](_0x596971['body'],[_0xafa9('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x58bd4f,null))[_0xafa9('0x40')](handleError(_0x58bd4f,null));};exports['getContacts']=function(_0x849f70,_0x561e7d,_0x46d283){var _0x42416e={};var _0x2909f5={};var _0x585e5a;var _0x345d65;return db[_0xafa9('0x3a')][_0xafa9('0x51')]({'where':{'id':_0x849f70[_0xafa9('0x41')]['id']}})[_0xafa9('0x25')](handleEntityNotFound(_0x561e7d,null))[_0xafa9('0x25')](function(_0x28e10d){if(_0x28e10d){_0x585e5a=_0x28e10d;_0x2909f5['model']=_[_0xafa9('0x2c')](db[_0xafa9('0x4e')][_0xafa9('0x42')]);_0x2909f5[_0xafa9('0x2b')]=_[_0xafa9('0x2c')](_0x849f70['query']);_0x2909f5[_0xafa9('0x35')]=_[_0xafa9('0x2e')](_0x2909f5[_0xafa9('0x2a')],_0x2909f5[_0xafa9('0x2b')]);_0x42416e[_0xafa9('0x2d')]=_[_0xafa9('0x2e')](_0x2909f5[_0xafa9('0x2a')],qs[_0xafa9('0x2f')](_0x849f70[_0xafa9('0x2b')][_0xafa9('0x2f')]));_0x42416e[_0xafa9('0x2d')]=_0x42416e[_0xafa9('0x2d')][_0xafa9('0x43')]?_0x42416e[_0xafa9('0x2d')]:_0x2909f5[_0xafa9('0x2a')];_0x42416e[_0xafa9('0x32')]=qs['sort'](_0x849f70[_0xafa9('0x2b')][_0xafa9('0x33')]);_0x42416e['where']=qs[_0xafa9('0x35')](_['pick'](_0x849f70[_0xafa9('0x2b')],_0x2909f5[_0xafa9('0x35')]));if(_0x849f70[_0xafa9('0x2b')][_0xafa9('0x37')]){_0x42416e['where']=_[_0xafa9('0x38')](_0x42416e['where'],{'$or':_[_0xafa9('0x52')](_0x42416e[_0xafa9('0x2d')],function(_0x5946f0){var _0x874cd1={};_0x874cd1[_0x5946f0]={'$like':'%'+_0x849f70[_0xafa9('0x2b')]['filter']+'%'};return _0x874cd1;})});}_0x42416e=_[_0xafa9('0x38')]({},_0x42416e,_0x849f70['options']);return _0x585e5a[_0xafa9('0x53')](_0x42416e);}})[_0xafa9('0x25')](function(_0x52e62c){if(_0x52e62c){_0x345d65=_0x52e62c[_0xafa9('0x43')];if(!_0x849f70[_0xafa9('0x2b')][_0xafa9('0x30')](_0xafa9('0x31'))){_0x42416e[_0xafa9('0x1c')]=qs[_0xafa9('0x1c')](_0x849f70[_0xafa9('0x2b')]['limit']);_0x42416e[_0xafa9('0x1a')]=qs[_0xafa9('0x1a')](_0x849f70['query'][_0xafa9('0x1a')]);}return _0x585e5a[_0xafa9('0x53')](_0x42416e);}})['then'](function(_0x183ef4){if(_0x183ef4){return _0x183ef4?{'count':_0x345d65,'rows':_0x183ef4}:null;}})['then'](respondWithResult(_0x561e7d,null))['catch'](handleError(_0x561e7d,null));}; \ No newline at end of file +var _0xcc21=['index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','user','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','omit','ids','getContacts','findOne','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcc21,0xc4));var _0x1cc2=function(_0x2c4a45,_0x8836e3){_0x2c4a45=_0x2c4a45-0x0;var _0x51c36e=_0xcc21[_0x2c4a45];return _0x51c36e;};'use strict';var emlformat=require(_0x1cc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1cc2('0x1'));var rp=require('request-promise');var moment=require(_0x1cc2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1cc2('0x3'));var util=require('util');var path=require(_0x1cc2('0x4'));var sox=require(_0x1cc2('0x5'));var csv=require(_0x1cc2('0x6'));var ejs=require(_0x1cc2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cc2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1cc2('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cc2('0xa'));var Redis=require('ioredis');var authService=require(_0x1cc2('0xb'));var qs=require(_0x1cc2('0xc'));var as=require(_0x1cc2('0xd'));var hardwareService=require(_0x1cc2('0xe'));var logger=require(_0x1cc2('0xf'))(_0x1cc2('0x10'));var utils=require(_0x1cc2('0x11'));var config=require(_0x1cc2('0x12'));var licenseUtil=require(_0x1cc2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21ea50,_0x3ed552){_0x3ed552=_0x3ed552||0xcc;return function(_0x365c08){if(_0x365c08){return _0x21ea50['sendStatus'](_0x3ed552);}return _0x21ea50[_0x1cc2('0x14')](_0x3ed552)['end']();};}function respondWithResult(_0x4d9b31,_0x55a7db){_0x55a7db=_0x55a7db||0xc8;return function(_0x1b5473){if(_0x1b5473){return _0x4d9b31[_0x1cc2('0x14')](_0x55a7db)['json'](_0x1b5473);}};}function respondWithFilteredResult(_0x10498b,_0x45fccb){return function(_0x39f7f1){if(_0x39f7f1){var _0x2c84e1=typeof _0x45fccb[_0x1cc2('0x15')]===_0x1cc2('0x16')&&typeof _0x45fccb['limit']===_0x1cc2('0x16');var _0x4688a4=_0x39f7f1['count'];var _0x663dcc=_0x2c84e1?0x0:_0x45fccb[_0x1cc2('0x15')];var _0x399c69=_0x2c84e1?_0x39f7f1[_0x1cc2('0x17')]:_0x45fccb['offset']+_0x45fccb[_0x1cc2('0x18')];var _0x40916b;if(_0x399c69>=_0x4688a4){_0x399c69=_0x4688a4;_0x40916b=0xc8;}else{_0x40916b=0xce;}_0x10498b[_0x1cc2('0x14')](_0x40916b);return _0x10498b[_0x1cc2('0x19')]('Content-Range',_0x663dcc+'-'+_0x399c69+'/'+_0x4688a4)[_0x1cc2('0x1a')](_0x39f7f1);}return null;};}function patchUpdates(_0x271d18){return function(_0x1e8fa8){try{jsonpatch[_0x1cc2('0x1b')](_0x1e8fa8,_0x271d18,!![]);}catch(_0xf8c514){return BPromise['reject'](_0xf8c514);}return _0x1e8fa8[_0x1cc2('0x1c')]();};}function saveUpdates(_0x57e89a,_0x3f8a49){return function(_0x166af9){if(_0x166af9){return _0x166af9[_0x1cc2('0x1d')](_0x57e89a)[_0x1cc2('0x1e')](function(_0x31b06f){return _0x31b06f;});}return null;};}function removeEntity(_0x592206,_0x2213ef){return function(_0x2d5686){if(_0x2d5686){return _0x2d5686[_0x1cc2('0x1f')]()['then'](function(){var _0x54d66d=_0x2d5686['get']({'plain':!![]});var _0x405821='Companies';return db[_0x1cc2('0x20')]['destroy']({'where':{'type':_0x405821,'resourceId':_0x54d66d['id']}})[_0x1cc2('0x1e')](function(){return _0x2d5686;});})['then'](function(){_0x592206[_0x1cc2('0x14')](0xcc)[_0x1cc2('0x21')]();});}};}function handleEntityNotFound(_0x29f98d,_0x28652e){return function(_0x25ee27){if(!_0x25ee27){_0x29f98d[_0x1cc2('0x22')](0x194);}return _0x25ee27;};}function handleError(_0x4a1761,_0x1ef04e){_0x1ef04e=_0x1ef04e||0x1f4;return function(_0x5f0a38){logger[_0x1cc2('0x23')](_0x5f0a38[_0x1cc2('0x24')]);if(_0x5f0a38['name']){delete _0x5f0a38[_0x1cc2('0x25')];}_0x4a1761[_0x1cc2('0x14')](_0x1ef04e)['send'](_0x5f0a38);};}exports[_0x1cc2('0x26')]=function(_0x3ed262,_0x189e1b){var _0x16907c={},_0x43a425={},_0x42615e={'count':0x0,'rows':[]};return db[_0x1cc2('0x27')]['describe']()[_0x1cc2('0x1e')](function(_0x15d3c6){_0x43a425[_0x1cc2('0x28')]=_[_0x1cc2('0x29')](_0x15d3c6);_0x43a425[_0x1cc2('0x2a')]=_['keys'](_0x3ed262[_0x1cc2('0x2a')]);_0x43a425[_0x1cc2('0x2b')]=_[_0x1cc2('0x2c')](_0x43a425[_0x1cc2('0x28')],_0x43a425[_0x1cc2('0x2a')]);_0x16907c[_0x1cc2('0x2d')]=_['intersection'](_0x43a425[_0x1cc2('0x28')],qs[_0x1cc2('0x2e')](_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x2e')]));_0x16907c[_0x1cc2('0x2d')]=_0x16907c[_0x1cc2('0x2d')][_0x1cc2('0x2f')]?_0x16907c[_0x1cc2('0x2d')]:_0x43a425[_0x1cc2('0x28')];if(!_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x30')](_0x1cc2('0x31'))){_0x16907c[_0x1cc2('0x18')]=qs[_0x1cc2('0x18')](_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x18')]);_0x16907c[_0x1cc2('0x15')]=qs[_0x1cc2('0x15')](_0x3ed262['query'][_0x1cc2('0x15')]);}_0x16907c[_0x1cc2('0x32')]=qs[_0x1cc2('0x33')](_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x33')]);_0x16907c['where']=qs[_0x1cc2('0x2b')](_[_0x1cc2('0x34')](_0x3ed262[_0x1cc2('0x2a')],_0x43a425[_0x1cc2('0x2b')]),_0x15d3c6);if(_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x35')]){_0x16907c[_0x1cc2('0x36')]=_[_0x1cc2('0x37')](_0x16907c[_0x1cc2('0x36')],{'$or':_[_0x1cc2('0x38')](_0x16907c['attributes'],function(_0x27a6fe){var _0x4c7726={};_0x4c7726[_0x27a6fe]={'$like':'%'+_0x3ed262['query'][_0x1cc2('0x35')]+'%'};return _0x4c7726;})});}_0x16907c=_[_0x1cc2('0x37')]({},_0x16907c,_0x3ed262[_0x1cc2('0x39')]);var _0x4dfbd1={'where':_0x16907c[_0x1cc2('0x36')]};return db[_0x1cc2('0x27')][_0x1cc2('0x17')](_0x4dfbd1)['then'](function(_0x4f0f1c){_0x42615e[_0x1cc2('0x17')]=_0x4f0f1c;if(_0x3ed262[_0x1cc2('0x2a')][_0x1cc2('0x3a')]){_0x16907c[_0x1cc2('0x3b')]=[{'all':!![]}];}return db[_0x1cc2('0x27')][_0x1cc2('0x3c')](_0x16907c);})['then'](function(_0x22a0e5){_0x42615e[_0x1cc2('0x3d')]=_0x22a0e5;return _0x42615e;})['then'](respondWithFilteredResult(_0x189e1b,_0x16907c))['catch'](handleError(_0x189e1b,null));})[_0x1cc2('0x3e')](handleError(_0x189e1b,null));};exports['show']=function(_0x14a165,_0x3e2bb3){var _0x161883={'raw':![],'where':{'id':_0x14a165[_0x1cc2('0x3f')]['id']}},_0x2adca7={};_0x2adca7[_0x1cc2('0x28')]=_[_0x1cc2('0x29')](db[_0x1cc2('0x27')]['rawAttributes']);_0x2adca7[_0x1cc2('0x2a')]=_[_0x1cc2('0x29')](_0x14a165[_0x1cc2('0x2a')]);_0x2adca7['filters']=_[_0x1cc2('0x2c')](_0x2adca7['model'],_0x2adca7['query']);_0x161883[_0x1cc2('0x2d')]=_[_0x1cc2('0x2c')](_0x2adca7['model'],qs[_0x1cc2('0x2e')](_0x14a165[_0x1cc2('0x2a')][_0x1cc2('0x2e')]));_0x161883[_0x1cc2('0x2d')]=_0x161883[_0x1cc2('0x2d')]['length']?_0x161883[_0x1cc2('0x2d')]:_0x2adca7[_0x1cc2('0x28')];if(_0x14a165[_0x1cc2('0x2a')][_0x1cc2('0x3a')]){_0x161883[_0x1cc2('0x3b')]=[{'all':!![]}];}_0x161883=_[_0x1cc2('0x37')]({},_0x161883,_0x14a165[_0x1cc2('0x39')]);return db[_0x1cc2('0x27')][_0x1cc2('0x40')](_0x161883)['then'](handleEntityNotFound(_0x3e2bb3,null))[_0x1cc2('0x1e')](respondWithResult(_0x3e2bb3,null))['catch'](handleError(_0x3e2bb3,null));};exports[_0x1cc2('0x41')]=function(_0x7f0d1,_0x1b60bf){return db[_0x1cc2('0x27')]['create'](_0x7f0d1['body'],{})[_0x1cc2('0x1e')](function(_0x4182bc){var _0x55e2d2=_0x7f0d1[_0x1cc2('0x42')]['get']({'plain':!![]});if(!_0x55e2d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55e2d2['role']===_0x1cc2('0x42')){var _0xbb2ae3=_0x4182bc['get']({'plain':!![]});var _0x428501=_0x1cc2('0x43');return db[_0x1cc2('0x44')][_0x1cc2('0x40')]({'where':{'name':_0x428501,'userProfileId':_0x55e2d2[_0x1cc2('0x45')]},'raw':!![]})[_0x1cc2('0x1e')](function(_0x535c6a){if(_0x535c6a&&_0x535c6a['autoAssociation']===0x0){return db['UserProfileResource'][_0x1cc2('0x41')]({'name':_0xbb2ae3['name'],'resourceId':_0xbb2ae3['id'],'type':_0x535c6a[_0x1cc2('0x25')],'sectionId':_0x535c6a['id']},{})[_0x1cc2('0x1e')](function(){return _0x4182bc;});}else{return _0x4182bc;}})[_0x1cc2('0x3e')](function(_0x5b81cc){logger['error'](_0x1cc2('0x46'),_0x5b81cc);throw _0x5b81cc;});}return _0x4182bc;})[_0x1cc2('0x1e')](respondWithResult(_0x1b60bf,0xc9))[_0x1cc2('0x3e')](handleError(_0x1b60bf,null));};exports['update']=function(_0x37e744,_0x56939d){if(_0x37e744[_0x1cc2('0x47')]['id']){delete _0x37e744[_0x1cc2('0x47')]['id'];}return db[_0x1cc2('0x27')][_0x1cc2('0x40')]({'where':{'id':_0x37e744[_0x1cc2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x56939d,null))[_0x1cc2('0x1e')](saveUpdates(_0x37e744[_0x1cc2('0x47')],null))[_0x1cc2('0x1e')](respondWithResult(_0x56939d,null))[_0x1cc2('0x3e')](handleError(_0x56939d,null));};exports[_0x1cc2('0x1f')]=function(_0x2c3e03,_0x55b813){return db[_0x1cc2('0x27')][_0x1cc2('0x40')]({'where':{'id':_0x2c3e03[_0x1cc2('0x3f')]['id']}})[_0x1cc2('0x1e')](handleEntityNotFound(_0x55b813,null))['then'](removeEntity(_0x55b813,null))[_0x1cc2('0x3e')](handleError(_0x55b813,null));};exports['describe']=function(_0x5e909d,_0x26e1d0){return db['CmCompany']['describe']()['then'](respondWithResult(_0x26e1d0,null))[_0x1cc2('0x3e')](handleError(_0x26e1d0,null));};exports['addContacts']=function(_0x5419c8,_0x3b3530,_0xee5bd3){return db[_0x1cc2('0x48')][_0x1cc2('0x40')]({'where':{'id':_0x5419c8[_0x1cc2('0x3f')]['id']}})[_0x1cc2('0x1e')](handleEntityNotFound(_0x3b3530,null))[_0x1cc2('0x1e')](function(_0x3c91dd){if(_0x3c91dd){return _0x3c91dd[_0x1cc2('0x49')](_0x5419c8[_0x1cc2('0x47')]['ids'],_[_0x1cc2('0x4a')](_0x5419c8[_0x1cc2('0x47')],[_0x1cc2('0x4b'),'id'])||{});}})[_0x1cc2('0x1e')](respondWithResult(_0x3b3530,null))[_0x1cc2('0x3e')](handleError(_0x3b3530,null));};exports[_0x1cc2('0x4c')]=function(_0x5cebd1,_0xf6948b,_0x9a9eb1){var _0x4b7130={};var _0x210347={};var _0x5ade44;var _0x52e7f8;return db[_0x1cc2('0x27')][_0x1cc2('0x4d')]({'where':{'id':_0x5cebd1[_0x1cc2('0x3f')]['id']}})[_0x1cc2('0x1e')](handleEntityNotFound(_0xf6948b,null))[_0x1cc2('0x1e')](function(_0x2616f5){if(_0x2616f5){_0x5ade44=_0x2616f5;_0x210347[_0x1cc2('0x28')]=_['keys'](db[_0x1cc2('0x48')]['rawAttributes']);_0x210347[_0x1cc2('0x2a')]=_[_0x1cc2('0x29')](_0x5cebd1['query']);_0x210347[_0x1cc2('0x2b')]=_['intersection'](_0x210347[_0x1cc2('0x28')],_0x210347[_0x1cc2('0x2a')]);_0x4b7130['attributes']=_[_0x1cc2('0x2c')](_0x210347['model'],qs[_0x1cc2('0x2e')](_0x5cebd1[_0x1cc2('0x2a')][_0x1cc2('0x2e')]));_0x4b7130[_0x1cc2('0x2d')]=_0x4b7130[_0x1cc2('0x2d')][_0x1cc2('0x2f')]?_0x4b7130[_0x1cc2('0x2d')]:_0x210347[_0x1cc2('0x28')];_0x4b7130[_0x1cc2('0x32')]=qs[_0x1cc2('0x33')](_0x5cebd1['query'][_0x1cc2('0x33')]);_0x4b7130[_0x1cc2('0x36')]=qs['filters'](_['pick'](_0x5cebd1[_0x1cc2('0x2a')],_0x210347[_0x1cc2('0x2b')]));if(_0x5cebd1[_0x1cc2('0x2a')][_0x1cc2('0x35')]){_0x4b7130[_0x1cc2('0x36')]=_[_0x1cc2('0x37')](_0x4b7130['where'],{'$or':_['map'](_0x4b7130['attributes'],function(_0x3367c4){var _0x241f48={};_0x241f48[_0x3367c4]={'$like':'%'+_0x5cebd1[_0x1cc2('0x2a')]['filter']+'%'};return _0x241f48;})});}_0x4b7130=_[_0x1cc2('0x37')]({},_0x4b7130,_0x5cebd1[_0x1cc2('0x39')]);return _0x5ade44[_0x1cc2('0x4c')](_0x4b7130);}})[_0x1cc2('0x1e')](function(_0x520942){if(_0x520942){_0x52e7f8=_0x520942[_0x1cc2('0x2f')];if(!_0x5cebd1[_0x1cc2('0x2a')]['hasOwnProperty'](_0x1cc2('0x31'))){_0x4b7130[_0x1cc2('0x18')]=qs[_0x1cc2('0x18')](_0x5cebd1['query'][_0x1cc2('0x18')]);_0x4b7130[_0x1cc2('0x15')]=qs['offset'](_0x5cebd1[_0x1cc2('0x2a')][_0x1cc2('0x15')]);}return _0x5ade44[_0x1cc2('0x4c')](_0x4b7130);}})[_0x1cc2('0x1e')](function(_0x57d31e){if(_0x57d31e){return _0x57d31e?{'count':_0x52e7f8,'rows':_0x57d31e}:null;}})[_0x1cc2('0x1e')](respondWithResult(_0xf6948b,null))[_0x1cc2('0x3e')](handleError(_0xf6948b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b98bac4..b6ef556 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 _0x0674=['moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','util','../../config/logger'];(function(_0x1046b8,_0x2dcf18){var _0x480e1d=function(_0x28c074){while(--_0x28c074){_0x1046b8['push'](_0x1046b8['shift']());}};_0x480e1d(++_0x2dcf18);}(_0x0674,0x148));var _0x4067=function(_0x414682,_0x560738){_0x414682=_0x414682-0x0;var _0x3d2eb6=_0x0674[_0x414682];return _0x3d2eb6;};'use strict';var _=require('lodash');var util=require(_0x4067('0x0'));var logger=require(_0x4067('0x1'))('api');var moment=require(_0x4067('0x2'));var BPromise=require('bluebird');var rp=require(_0x4067('0x3'));var fs=require('fs');var path=require(_0x4067('0x4'));var rimraf=require(_0x4067('0x5'));var config=require(_0x4067('0x6'));var attributes=require(_0x4067('0x7'));module[_0x4067('0x8')]=function(_0x11361b,_0x51800f){return _0x11361b[_0x4067('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x682f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x682f,0x1e9));var _0xf682=function(_0x13ccbe,_0xb101de){_0x13ccbe=_0x13ccbe-0x0;var _0x3120c4=_0x682f[_0x13ccbe];return _0x3120c4;};'use strict';var _=require(_0xf682('0x0'));var util=require(_0xf682('0x1'));var logger=require(_0xf682('0x2'))(_0xf682('0x3'));var moment=require(_0xf682('0x4'));var BPromise=require(_0xf682('0x5'));var rp=require(_0xf682('0x6'));var fs=require('fs');var path=require(_0xf682('0x7'));var rimraf=require(_0xf682('0x8'));var config=require(_0xf682('0x9'));var attributes=require(_0xf682('0xa'));module['exports']=function(_0x4ce279,_0x4aef2b){return _0x4ce279['define'](_0xf682('0xb'),attributes,{'tableName':_0xf682('0xc'),'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 85a5d1e..61d6d21 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 _0x970c=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x489d21,_0x1f75c2){var _0x38b054=function(_0x28ed22){while(--_0x28ed22){_0x489d21['push'](_0x489d21['shift']());}};_0x38b054(++_0x1f75c2);}(_0x970c,0xa1));var _0xc970=function(_0x3d1917,_0x1a3ce1){_0x3d1917=_0x3d1917-0x0;var _0x4465df=_0x970c[_0x3d1917];return _0x4465df;};'use strict';var _=require(_0xc970('0x0'));var util=require(_0xc970('0x1'));var moment=require(_0xc970('0x2'));var BPromise=require(_0xc970('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc970('0x4'))['db'];var utils=require(_0xc970('0x5'));var logger=require(_0xc970('0x6'))(_0xc970('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x230d8c,_0x28cf10,_0x4e5c77){return new BPromise(function(_0x577123,_0x5e5898){return client[_0xc970('0x9')](_0x230d8c,_0x4e5c77)['then'](function(_0x37b666){logger['info'](_0xc970('0xa'),_0x28cf10,_0xc970('0xb'));logger[_0xc970('0xc')](_0xc970('0xd'),_0x28cf10,'request\x20sent',JSON[_0xc970('0xe')](_0x37b666));if(_0x37b666[_0xc970('0xf')]){if(_0x37b666[_0xc970('0xf')][_0xc970('0x10')]===0x1f4){logger[_0xc970('0xf')](_0xc970('0xa'),_0x28cf10,_0x37b666[_0xc970('0xf')][_0xc970('0x11')]);return _0x5e5898(_0x37b666[_0xc970('0xf')][_0xc970('0x11')]);}logger[_0xc970('0xf')](_0xc970('0xa'),_0x28cf10,_0x37b666[_0xc970('0xf')]['message']);return _0x577123(_0x37b666[_0xc970('0xf')]['message']);}else{logger['info'](_0xc970('0xa'),_0x28cf10,_0xc970('0xb'));_0x577123(_0x37b666[_0xc970('0x12')]['message']);}})['catch'](function(_0x380603){logger[_0xc970('0xf')](_0xc970('0xa'),_0x28cf10,_0x380603);_0x5e5898(_0x380603);});});} \ No newline at end of file +var _0xe07b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xe07b,0x181));var _0xbe07=function(_0x2090a3,_0x4f6319){_0x2090a3=_0x2090a3-0x0;var _0x35e209=_0xe07b[_0x2090a3];return _0x35e209;};'use strict';var _=require(_0xbe07('0x0'));var util=require(_0xbe07('0x1'));var moment=require(_0xbe07('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe07('0x3'));var fs=require('fs');var Redis=require(_0xbe07('0x4'));var db=require(_0xbe07('0x5'))['db'];var utils=require(_0xbe07('0x6'));var logger=require('../../config/logger')(_0xbe07('0x7'));var config=require(_0xbe07('0x8'));var jayson=require(_0xbe07('0x9'));var client=jayson[_0xbe07('0xa')][_0xbe07('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35ddb8,_0x34c618,_0x12015d){return new BPromise(function(_0x4f68fb,_0x564d8f){return client['request'](_0x35ddb8,_0x12015d)[_0xbe07('0xc')](function(_0x42fcb5){logger[_0xbe07('0xd')]('CmCompany,\x20%s,\x20%s',_0x34c618,_0xbe07('0xe'));logger[_0xbe07('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x34c618,_0xbe07('0xe'),JSON[_0xbe07('0x10')](_0x42fcb5));if(_0x42fcb5['error']){if(_0x42fcb5[_0xbe07('0x11')][_0xbe07('0x12')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x34c618,_0x42fcb5['error'][_0xbe07('0x13')]);return _0x564d8f(_0x42fcb5['error'][_0xbe07('0x13')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x34c618,_0x42fcb5[_0xbe07('0x11')][_0xbe07('0x13')]);return _0x4f68fb(_0x42fcb5[_0xbe07('0x11')][_0xbe07('0x13')]);}else{logger[_0xbe07('0xd')](_0xbe07('0x14'),_0x34c618,_0xbe07('0xe'));_0x4f68fb(_0x42fcb5[_0xbe07('0x15')]['message']);}})[_0xbe07('0x16')](function(_0x2ca5a8){logger[_0xbe07('0x11')](_0xbe07('0x14'),_0x34c618,_0x2ca5a8);_0x564d8f(_0x2ca5a8);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 66d3915..e4d1e1c 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 _0xb918=['get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb918,0x1ae));var _0x8b91=function(_0x403885,_0x2de2da){_0x403885=_0x403885-0x0;var _0x20e746=_0xb918[_0x403885];return _0x20e746;};'use strict';var multer=require(_0x8b91('0x0'));var util=require(_0x8b91('0x1'));var path=require('path');var timeout=require(_0x8b91('0x2'));var express=require(_0x8b91('0x3'));var router=express[_0x8b91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b91('0x5'));var interaction=require(_0x8b91('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x8b91('0x7')]('/',auth[_0x8b91('0x8')](),controller[_0x8b91('0x9')]);router[_0x8b91('0x7')](_0x8b91('0xa'),auth['isAuthenticated'](),controller[_0x8b91('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8b91('0xc')]);router['get'](_0x8b91('0xd'),auth[_0x8b91('0x8')](),controller[_0x8b91('0xe')]);router[_0x8b91('0xf')]('/',auth[_0x8b91('0x8')](),controller[_0x8b91('0x10')]);router[_0x8b91('0xf')]('/:id/contacts',auth[_0x8b91('0x8')](),controller[_0x8b91('0x11')]);router[_0x8b91('0x12')](_0x8b91('0x13'),auth[_0x8b91('0x8')](),controller['update']);router[_0x8b91('0x14')](_0x8b91('0x13'),auth[_0x8b91('0x8')](),controller[_0x8b91('0x15')]);module[_0x8b91('0x16')]=router; \ No newline at end of file +var _0x4ecf=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','path'];(function(_0x34e466,_0x49db68){var _0x1d7662=function(_0x47aadc){while(--_0x47aadc){_0x34e466['push'](_0x34e466['shift']());}};_0x1d7662(++_0x49db68);}(_0x4ecf,0x68));var _0xf4ec=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4ecf[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf4ec('0x0'));var timeout=require(_0xf4ec('0x1'));var express=require(_0xf4ec('0x2'));var router=express['Router']();var fs_extra=require(_0xf4ec('0x3'));var auth=require(_0xf4ec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf4ec('0x5'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0xf4ec('0x6')](),controller['index']);router[_0xf4ec('0x7')](_0xf4ec('0x8'),auth['isAuthenticated'](),controller[_0xf4ec('0x9')]);router[_0xf4ec('0x7')](_0xf4ec('0xa'),auth['isAuthenticated'](),controller[_0xf4ec('0xb')]);router[_0xf4ec('0x7')](_0xf4ec('0xc'),auth['isAuthenticated'](),controller[_0xf4ec('0xd')]);router[_0xf4ec('0xe')]('/',auth[_0xf4ec('0x6')](),controller[_0xf4ec('0xf')]);router['post'](_0xf4ec('0xc'),auth[_0xf4ec('0x6')](),controller[_0xf4ec('0x10')]);router[_0xf4ec('0x11')](_0xf4ec('0xa'),auth['isAuthenticated'](),controller[_0xf4ec('0x12')]);router[_0xf4ec('0x13')](_0xf4ec('0xa'),auth[_0xf4ec('0x6')](),controller[_0xf4ec('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 443bc0f..c92087f 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 _0x2885=['TEXT','INTEGER','DATE','NOW','lodash','exports','STRING'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x2885,0xb3));var _0x5288=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2885[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x5288('0x0'));var Sequelize=require('sequelize');module[_0x5288('0x1')]={'firstName':{'type':Sequelize[_0x5288('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5288('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5288('0x2')]},'city':{'type':Sequelize[_0x5288('0x2')]},'country':{'type':Sequelize[_0x5288('0x2')]},'dateOfBirth':{'type':Sequelize[_0x5288('0x2')]},'description':{'type':Sequelize[_0x5288('0x3')]},'phone':{'type':Sequelize[_0x5288('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5288('0x2')]},'url':{'type':Sequelize[_0x5288('0x2')]},'facebook':{'type':Sequelize[_0x5288('0x2')]},'fb_data':{'type':Sequelize[_0x5288('0x2')]},'twitter':{'type':Sequelize[_0x5288('0x2')]},'skype':{'type':Sequelize[_0x5288('0x2')]},'teams':{'type':Sequelize[_0x5288('0x2')]},'viber':{'type':Sequelize[_0x5288('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5288('0x2')]},'telegram':{'type':Sequelize[_0x5288('0x2')]},'UserId':{'type':Sequelize[_0x5288('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5288('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5288('0x5')],'defaultValue':Sequelize[_0x5288('0x6')]},'dialTimezone':{'type':Sequelize[_0x5288('0x2')]},'utcOffset':{'type':Sequelize[_0x5288('0x4')]}}; \ No newline at end of file +var _0xcf21=['NOW','lodash','exports','STRING','INTEGER','UNSIGNED'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xcf21,0x121));var _0x1cf2=function(_0x13ae8a,_0x5282c7){_0x13ae8a=_0x13ae8a-0x0;var _0x1d66a2=_0xcf21[_0x13ae8a];return _0x1d66a2;};'use strict';var _=require(_0x1cf2('0x0'));var Sequelize=require('sequelize');module[_0x1cf2('0x1')]={'firstName':{'type':Sequelize[_0x1cf2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1cf2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1cf2('0x2')]},'city':{'type':Sequelize[_0x1cf2('0x2')]},'country':{'type':Sequelize[_0x1cf2('0x2')]},'dateOfBirth':{'type':Sequelize[_0x1cf2('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x1cf2('0x2')]},'mobile':{'type':Sequelize[_0x1cf2('0x2')]},'fax':{'type':Sequelize[_0x1cf2('0x2')]},'email':{'type':Sequelize[_0x1cf2('0x2')]},'url':{'type':Sequelize[_0x1cf2('0x2')]},'facebook':{'type':Sequelize[_0x1cf2('0x2')]},'fb_data':{'type':Sequelize[_0x1cf2('0x2')]},'twitter':{'type':Sequelize[_0x1cf2('0x2')]},'skype':{'type':Sequelize[_0x1cf2('0x2')]},'teams':{'type':Sequelize[_0x1cf2('0x2')]},'viber':{'type':Sequelize[_0x1cf2('0x2')]},'line':{'type':Sequelize[_0x1cf2('0x2')]},'wechat':{'type':Sequelize[_0x1cf2('0x2')]},'telegram':{'type':Sequelize[_0x1cf2('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cf2('0x3')](0x2)[_0x1cf2('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x1cf2('0x5')]},'dialTimezone':{'type':Sequelize[_0x1cf2('0x2')]},'utcOffset':{'type':Sequelize[_0x1cf2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e2407e3..6eb8019 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 _0x7e22=['custom','values','merge','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','timezones','additionalPhones','each','duplicates','$or','spread','contact','params','Phones','ContactItemType','ItemType','Phones.OrderBy','$and','format','cf_%d','utcOffset','omit','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','pick','options','nolimit','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','CmHopperId','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','pid','upload','createReadStream','parse','meta','import','binding','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','mail','chat','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20createdAt\x20filter','voice','destination','callerid','starttime','endtime','duration','note','createdAt','userThirdDisposition','UserId','fullname','alias','findAndCountAll','Website','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','browserName','customerPort','osName','ratingMessage','ratingType','referer','substatus','Interaction','flatten','sortBy','reverse','slice','moment','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','count','offset','limit','set','Content-Range','json','destroy','then','end','sendStatus','error','stack','send','index','describe','keys','cf_','push','trimStart','all','length','fieldType','model','query','filters','intersection','fields','attributes','order','sort','where','select','field','name','color','from','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','value','dateOfBirth','datetime','castTo','DATE','buildExpression','type','start','map','hasOwnProperty','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','tag','isArray','filter','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','SELECT','clone','c.id','DESC','having','resolve','user','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','CmContact','c.lastName','c.phone','c.mobile','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','tags','startsWith','columnName','analytics','CmCustomField','findAll','displayName'];(function(_0x2e33c5,_0x1d1d38){var _0x33b7e5=function(_0xc04c36){while(--_0xc04c36){_0x2e33c5['push'](_0x2e33c5['shift']());}};_0x33b7e5(++_0x1d1d38);}(_0x7e22,0x1d8));var _0x27e2=function(_0x4036f3,_0x4a7ff8){_0x4036f3=_0x4036f3-0x0;var _0xb9177d=_0x7e22[_0x4036f3];return _0xb9177d;};'use strict';var moment=require(_0x27e2('0x0'));var BPromise=require('bluebird');var util=require(_0x27e2('0x1'));var path=require(_0x27e2('0x2'));var fs=require('fs');var _=require(_0x27e2('0x3'));var squel=require(_0x27e2('0x4'));var Papa=require(_0x27e2('0x5'));var Redis=require(_0x27e2('0x6'));var qs=require('../../components/parsers/qs');var as=require(_0x27e2('0x7'));var logger=require('../../config/logger')(_0x27e2('0x8'));var config=require(_0x27e2('0x9'));var shared=require(_0x27e2('0xa'));var db=require(_0x27e2('0xb'))['db'];config['redis']=_[_0x27e2('0xc')](config[_0x27e2('0xd')],{'host':_0x27e2('0xe'),'port':0x18eb});var socket=require(_0x27e2('0xf'))(new Redis(config[_0x27e2('0xd')]));require(_0x27e2('0x10'))[_0x27e2('0x11')](socket);function respondWithResult(_0x256eac,_0x49d150){_0x49d150=_0x49d150||0xc8;return function(_0x3303bb){if(_0x3303bb){return _0x256eac[_0x27e2('0x12')](_0x49d150)['json'](_0x3303bb);}};}function respondWithFilteredResult(_0x1263c4,_0x281721){return function(_0x298536){if(_0x298536){var _0x1d6bc6=typeof _0x281721['offset']===_0x27e2('0x13')&&typeof _0x281721['limit']===_0x27e2('0x13');var _0x396d33=_0x298536[_0x27e2('0x14')];var _0x2f60b2=_0x1d6bc6?0x0:_0x281721[_0x27e2('0x15')];var _0x563b96=_0x1d6bc6?_0x298536[_0x27e2('0x14')]:_0x281721['offset']+_0x281721[_0x27e2('0x16')];var _0x5c625;if(_0x563b96>=_0x396d33){_0x563b96=_0x396d33;_0x5c625=0xc8;}else{_0x5c625=0xce;}_0x1263c4[_0x27e2('0x12')](_0x5c625);return _0x1263c4[_0x27e2('0x17')](_0x27e2('0x18'),_0x2f60b2+'-'+_0x563b96+'/'+_0x396d33)[_0x27e2('0x19')](_0x298536);}return null;};}function saveUpdates(_0x371885){return function(_0x18a838){if(_0x18a838){return _0x18a838['update'](_0x371885)['then'](function(_0x14ce22){return _0x14ce22;});}return null;};}function removeEntity(_0x1c5847){return function(_0x54e0d7){if(_0x54e0d7){return _0x54e0d7[_0x27e2('0x1a')]()[_0x27e2('0x1b')](function(){_0x1c5847[_0x27e2('0x12')](0xcc)[_0x27e2('0x1c')]();});}};}function handleEntityNotFound(_0x127d7e){return function(_0x502c9e){if(!_0x502c9e){_0x127d7e[_0x27e2('0x1d')](0x194);}return _0x502c9e;};}function handleError(_0x32be33,_0x74986d){_0x74986d=_0x74986d||0x1f4;return function(_0x4c3e17){logger[_0x27e2('0x1e')](_0x4c3e17[_0x27e2('0x1f')]);if(_0x4c3e17['name']){delete _0x4c3e17['name'];}_0x32be33[_0x27e2('0x12')](_0x74986d)[_0x27e2('0x20')](_0x4c3e17);};}exports[_0x27e2('0x21')]=function(_0x1aefa9,_0x2650c7){var _0xfa78e4={},_0x3cb5b1={},_0x566746={'count':0x0,'rows':[]};return db['CmContact'][_0x27e2('0x22')]()[_0x27e2('0x1b')](function(_0x38c02c){var _0x270cf3=[];for(var _0xe04676=0x0;_0xe046760x1){_0x81efa1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x27e2('0x5c')](_0x172891),null);}else{if(qs[_0x27e2('0x5d')](_0x172891)){_0x81efa1['or'](_0x27e2('0x5e'),_0x172891+'%');_0x81efa1['or'](_0x27e2('0x5f'),_0x172891+'%');_0x81efa1['or'](_0x27e2('0x60'),_0x172891+'%');_0x81efa1['or'](_0x27e2('0x61'),_0x172891+'%');}else if(qs[_0x27e2('0x62')](_0x172891)){_0x81efa1['or']('c.email\x20LIKE\x20?',_0x172891+'%');}else{_0x81efa1['or'](_0x27e2('0x63'),'%'+_0x172891+'%');_0x81efa1['or']('c.lastName\x20LIKE\x20?','%'+_0x172891+'%');_0x81efa1['or'](_0x27e2('0x64'),'%'+_0x172891+'%');}}}}_0x387ea6[_0x27e2('0x32')](_0x81efa1);_0x387ea6[_0x27e2('0x65')]('c.id');var _0x42c70d={'type':db['Sequelize']['QueryTypes'][_0x27e2('0x66')],'raw':!![]};var _0x191a5f=_0x387ea6[_0x27e2('0x67')]()[_0x27e2('0x34')](_0x27e2('0x68'));if(_0xfa78e4[_0x27e2('0x30')]){_0xfa78e4[_0x27e2('0x30')][_0x27e2('0x46')](function(_0xf6355){_0x387ea6['order']('c.'+_0xf6355[0x0],_0xf6355[0x1]===_0x27e2('0x69')?![]:!![]);});}if(!_[_0x27e2('0x55')](_0x493765)){_0x387ea6[_0x27e2('0x6a')](_0xa8ad6);_0x191a5f[_0x27e2('0x32')]('t.id\x20IN\x20?',_0x493765);}BPromise[_0x27e2('0x6b')]()['then'](function(){if(!_0x395bf3)return;if(_0x1aefa9[_0x27e2('0x6c')][_0x27e2('0x6d')]!==_0x27e2('0x6e'))return;if(!_[_0x27e2('0x6f')](_0x395bf3[_0x27e2('0x42')],[_0x27e2('0x34'),_0x27e2('0x70')])){return _0x1aefa9[_0x27e2('0x6c')][_0x27e2('0x71')]({'attributes':['id'],'raw':!![]})[_0x27e2('0x1b')](function(_0x14f73f){if(_[_0x27e2('0x55')](_0x14f73f)){_0x191a5f[_0x27e2('0x32')](_0x27e2('0x72'));_0x387ea6['where'](_0x27e2('0x72'));}else{_0x191a5f['where']('c.ListId\x20IN\x20?',_[_0x27e2('0x51')](_0x14f73f,'id'));_0x387ea6['where'](_0x27e2('0x57'),_[_0x27e2('0x51')](_0x14f73f,'id'));}});}})[_0x27e2('0x1b')](function(){if(_0x1aefa9[_0x27e2('0x6c')][_0x27e2('0x6d')]===_0x27e2('0x6e')&&!_0x395bf3&&!_0x1aefa9[_0x27e2('0x2b')][_0x27e2('0x56')])return[];return db[_0x27e2('0x73')]['query'](_0x191a5f[_0x27e2('0x74')](),_0x42c70d);})[_0x27e2('0x1b')](function(_0x4b7039){_0x566746['count']=_0x4b7039[_0x27e2('0x28')];if(_0x566746[_0x27e2('0x14')]===0x0)return[];return db[_0x27e2('0x73')][_0x27e2('0x2b')](_0x2a07fa[_0x27e2('0x74')](),_0x42c70d)[_0x27e2('0x1b')](function(_0x39435b){_0x51a01d=_[_0x27e2('0x75')](_0x39435b,'id');_0x42c70d=_['merge'](_0x42c70d,{'model':db[_0x27e2('0x76')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1aefa9[_0x27e2('0x2b')][_0x27e2('0x2e')]){_0xfa78e4['attributes'][_0x27e2('0x46')](function(_0x32dc95){_0x387ea6[_0x27e2('0x34')]('c.'+_0x32dc95);});}else{_0x387ea6['field'](_0x27e2('0x68'));_0x387ea6[_0x27e2('0x34')]('c.firstName');_0x387ea6['field'](_0x27e2('0x77'));_0x387ea6[_0x27e2('0x34')](_0x27e2('0x78'));_0x387ea6[_0x27e2('0x34')](_0x27e2('0x79'));_0x387ea6['field']('c.fax');_0x387ea6[_0x27e2('0x34')]('c.email');_0x387ea6['field']('c.ListId');_0x387ea6[_0x27e2('0x34')](_0x27e2('0x7a'));_0x387ea6['field'](_0x27e2('0x7b'));_0x387ea6['field'](_0x27e2('0x7c'));_0x387ea6[_0x27e2('0x34')](_0x27e2('0x7d'),_0x27e2('0x7e'));}if(_0xfa78e4['limit'])_0x387ea6[_0x27e2('0x16')](_0xfa78e4[_0x27e2('0x16')]);if(_0xfa78e4['offset'])_0x387ea6[_0x27e2('0x15')](_0xfa78e4[_0x27e2('0x15')]);return db[_0x27e2('0x73')][_0x27e2('0x2b')](_0x387ea6['toString'](),_0x42c70d);});})[_0x27e2('0x1b')](function(_0x5c6c04){_0x5c6c04[_0x27e2('0x46')](function(_0x22c99f){if(_0x22c99f['TagIds']){_0x22c99f[_0x27e2('0x7f')]=[];_0x22c99f[_0x27e2('0x7e')][_0x27e2('0x45')](',')[_0x27e2('0x46')](function(_0x1a7839){_0x22c99f[_0x27e2('0x7f')][_0x27e2('0x25')](_0x51a01d[_0x1a7839]);});}delete _0x22c99f[_0x27e2('0x7e')];});_0x566746['rows']=_0x5c6c04;return _0x566746;})[_0x27e2('0x1b')](respondWithFilteredResult(_0x2650c7,_0xfa78e4));})[_0x27e2('0x80')](handleError(_0x2650c7,null));};exports[_0x27e2('0x1a')]=function(_0x219385,_0x54595d){return db[_0x27e2('0x76')][_0x27e2('0x43')]({'where':{'id':_0x219385['params']['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0x54595d,null))[_0x27e2('0x1b')](removeEntity(_0x54595d,null))[_0x27e2('0x80')](handleError(_0x54595d,null));};exports[_0x27e2('0x22')]=function(_0x3561f2,_0x3e312a){return db[_0x27e2('0x76')][_0x27e2('0x22')]()[_0x27e2('0x1b')](function(_0x1cc141){delete _0x1cc141[_0x27e2('0x81')];for(var _0x4e72ef=0x0;_0x4e72ef0x0){return new Promise(function(_0x5d0106,_0x35c446){var _0x4656fb=[];for(var _0x199e05=0x0;_0x199e05<_0x54cde7[_0x27e2('0x28')];_0x199e05++){_0x4656fb[_0x27e2('0x25')](insertAdditionalPhones(_0x54cde7[_0x199e05][_0x27e2('0xaf')],_0x54cde7[_0x199e05][_0x27e2('0xaa')]));}Promise[_0x27e2('0x27')](_0x4656fb)[_0x27e2('0x1b')](function(){_0x5d0106(0x1);});})[_0x27e2('0x1b')](function(){return{'success':_0x182991,'failure':_0x5eb53d,'duplicates':_0x27d7c6};});}else{return{'success':_0x182991,'failure':_0x5eb53d,'duplicates':_0x27d7c6};}}})['then'](respondWithResult(_0x588829,0xc9))['catch'](handleError(_0x588829,null));};exports['show']=function(_0x53cf25,_0x44d7f6){var _0x376295;return db[_0x27e2('0x76')][_0x27e2('0x22')]()['then'](function(_0x27ef2e){return db[_0x27e2('0x76')][_0x27e2('0x43')]({'where':{'id':_0x53cf25[_0x27e2('0xb0')]['id']},'include':[{'model':db[_0x27e2('0x44')],'as':'Tags','attributes':['id','name',_0x27e2('0x36')],'required':_0x53cf25[_0x27e2('0x2b')][_0x27e2('0x59')]?!![]:![]},{'model':db[_0x27e2('0x9e')],'as':_0x27e2('0xb1'),'where':{'CmContactId':_0x53cf25['params']['id']},'required':![],'include':[{'model':db[_0x27e2('0xb2')],'as':_0x27e2('0xb3')}]}],'order':[db['sequelize']['literal'](_0x27e2('0xb4'))],'attributes':_[_0x27e2('0x23')](_0x27ef2e)});})[_0x27e2('0x1b')](function(_0xafc9c1){if(!_[_0x27e2('0x53')](_0xafc9c1)){_0x376295=_0xafc9c1[_0x27e2('0x8c')]({'plain':!![]});var _0x263707={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xafc9c1&&_0xafc9c1[_0x27e2('0x56')]){if(_0xafc9c1[_0x27e2('0x56')]){_0x263707[_0x27e2('0x32')][_0x27e2('0xb5')][_0x27e2('0x25')]({'ListId':{'$ne':_0xafc9c1[_0x27e2('0x56')]}});}}return db['CmCustomField']['findAll'](_0x263707);}})['then'](function(_0x2de8de){if(!_[_0x27e2('0x53')](_0x2de8de)){return _['omit'](_0x376295,_[_0x27e2('0x51')](_0x2de8de,function(_0x2f6b20){return util[_0x27e2('0xb6')](_0x27e2('0xb7'),_0x2f6b20['id']);}));}})[_0x27e2('0x1b')](handleEntityNotFound(_0x44d7f6,null))[_0x27e2('0x1b')](respondWithResult(_0x44d7f6,null))[_0x27e2('0x80')](handleError(_0x44d7f6,null));};exports[_0x27e2('0x95')]=function(_0x25561d,_0x167d89){var _0x23ba54;if(_0x25561d[_0x27e2('0x8b')]['id']){delete _0x25561d[_0x27e2('0x8b')]['id'];}if(!_[_0x27e2('0x53')](_0x25561d[_0x27e2('0x8b')][_0x27e2('0xa8')])){var _0x200659=_0x25561d[_0x27e2('0x8b')][_0x27e2('0xa8')];if(!_[_0x27e2('0x53')](shared[_0x27e2('0xa9')][_0x200659]))_0x25561d[_0x27e2('0x8b')][_0x27e2('0xb8')]=shared['timezones'][_0x200659]['utcOffset'];}return db[_0x27e2('0x76')][_0x27e2('0x43')]({'where':{'id':_0x25561d[_0x27e2('0xb0')]['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0x167d89,null))[_0x27e2('0x1b')](saveUpdates(_0x25561d[_0x27e2('0x8b')],null))['then'](function(_0x37e9e3){_0x23ba54=_0x37e9e3;var _0x4daec5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x37e9e3&&_0x37e9e3[_0x27e2('0x56')]){if(_0x37e9e3[_0x27e2('0x56')]){_0x4daec5[_0x27e2('0x32')][_0x27e2('0xb5')][_0x27e2('0x25')]({'ListId':{'$ne':_0x37e9e3[_0x27e2('0x56')]}});}}return db['CmCustomField']['findAll'](_0x4daec5);})['then'](function(_0x596f9e){if(_0x596f9e){return _[_0x27e2('0xb9')](_['pickBy'](_0x25561d[_0x27e2('0x8b')],function(_0x3dee00,_0x214e36){return _[_0x27e2('0x82')](_0x214e36,_0x27e2('0x24'));}),_[_0x27e2('0x51')](_0x596f9e,function(_0x2e94a1){return util[_0x27e2('0xb6')](_0x27e2('0xb7'),_0x2e94a1['id']);}));}})[_0x27e2('0x1b')](function(_0x15e9a7){if(_0x15e9a7&&!_['isEmpty'](_0x15e9a7)){var _0x378b68=squel['update']()[_0x27e2('0xba')]('cm_contacts')[_0x27e2('0xbb')](_0x15e9a7)['where'](_0x27e2('0xbc'),_0x25561d[_0x27e2('0xb0')]['id'])[_0x27e2('0xbd')]();return db[_0x27e2('0x73')]['query'](_0x378b68[_0x27e2('0xbe')],{'replacements':_0x378b68[_0x27e2('0x89')]});}})[_0x27e2('0x1b')](function(){if(_0x25561d[_0x27e2('0x8b')][_0x27e2('0xbf')]&&_0x23ba54){return db['CmHopper']['update']({'phone':_0x25561d[_0x27e2('0x8b')][_0x27e2('0xbf')],'OrderBy':0x0},{'where':{'ContactId':_0x23ba54['id']}});}})[_0x27e2('0x1b')](function(){return _0x23ba54;})['then'](respondWithResult(_0x167d89,null))[_0x27e2('0x80')](handleError(_0x167d89,null));};exports[_0x27e2('0xc0')]=function(_0x3f93dd,_0x57fd67){var _0x37eaec={};var _0x1ad2ac={};var _0x332d08;var _0x4d3d7d;return db[_0x27e2('0x76')][_0x27e2('0xc1')]({'where':{'id':_0x3f93dd['params']['id']}})['then'](handleEntityNotFound(_0x57fd67,null))[_0x27e2('0x1b')](function(_0x43ffdd){if(_0x43ffdd){_0x332d08=_0x43ffdd;_0x1ad2ac['model']=_[_0x27e2('0x23')](db['Tag'][_0x27e2('0xc2')]);_0x1ad2ac[_0x27e2('0x2b')]=_[_0x27e2('0x23')](_0x3f93dd[_0x27e2('0x2b')]);_0x1ad2ac[_0x27e2('0x2c')]=_['intersection'](_0x1ad2ac[_0x27e2('0x2a')],_0x1ad2ac[_0x27e2('0x2b')]);_0x37eaec[_0x27e2('0x2f')]=_[_0x27e2('0x2d')](_0x1ad2ac[_0x27e2('0x2a')],qs[_0x27e2('0x2e')](_0x3f93dd[_0x27e2('0x2b')][_0x27e2('0x2e')]));_0x37eaec[_0x27e2('0x2f')]=_0x37eaec[_0x27e2('0x2f')][_0x27e2('0x28')]?_0x37eaec['attributes']:_0x1ad2ac['model'];_0x37eaec['order']=qs[_0x27e2('0x31')](_0x3f93dd[_0x27e2('0x2b')]['sort']);_0x37eaec['where']=qs[_0x27e2('0x2c')](_[_0x27e2('0xc3')](_0x3f93dd['query'],_0x1ad2ac[_0x27e2('0x2c')]));if(_0x3f93dd[_0x27e2('0x2b')]['filter']){_0x37eaec[_0x27e2('0x32')]=_[_0x27e2('0x8a')](_0x37eaec[_0x27e2('0x32')],{'$or':_[_0x27e2('0x51')](_0x37eaec[_0x27e2('0x2f')],function(_0x589526){var _0x465a31={};_0x465a31[_0x589526]={'$like':'%'+_0x3f93dd[_0x27e2('0x2b')]['filter']+'%'};return _0x465a31;})});}_0x37eaec=_['merge']({},_0x37eaec,_0x3f93dd[_0x27e2('0xc4')]);return _0x332d08[_0x27e2('0xc0')](_0x37eaec);}})[_0x27e2('0x1b')](function(_0x47adb5){if(_0x47adb5){_0x4d3d7d=_0x47adb5[_0x27e2('0x28')];if(!_0x3f93dd[_0x27e2('0x2b')][_0x27e2('0x52')](_0x27e2('0xc5'))){_0x37eaec[_0x27e2('0x16')]=qs[_0x27e2('0x16')](_0x3f93dd[_0x27e2('0x2b')][_0x27e2('0x16')]);_0x37eaec[_0x27e2('0x15')]=qs['offset'](_0x3f93dd[_0x27e2('0x2b')][_0x27e2('0x15')]);}return _0x332d08['getTags'](_0x37eaec);}})[_0x27e2('0x1b')](function(_0x2398c7){if(_0x2398c7){return _0x2398c7?{'count':_0x4d3d7d,'rows':_0x2398c7}:null;}})[_0x27e2('0x1b')](respondWithResult(_0x57fd67,null))[_0x27e2('0x80')](handleError(_0x57fd67,null));};exports['setTags']=function(_0x497daa,_0x4efdbe){if(_0x497daa[_0x27e2('0x8b')]['id']){delete _0x497daa[_0x27e2('0x8b')]['id'];}return db[_0x27e2('0x76')][_0x27e2('0xc1')]({'where':{'id':_0x497daa[_0x27e2('0xb0')]['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0x4efdbe,null))[_0x27e2('0x1b')](function(_0x10e08f){if(_0x10e08f){return _0x10e08f['setTags'](_0x497daa[_0x27e2('0x8b')][_0x27e2('0xc6')]||[]);}return null;})[_0x27e2('0x1b')](respondWithResult(_0x4efdbe,null))['catch'](handleError(_0x4efdbe,null));};exports[_0x27e2('0xc7')]=function(_0xdaa27b,_0x423ea2){var _0x3ec8fa=[];_0x3ec8fa['push'](addAdditionalPhones(_0xdaa27b[_0x27e2('0x8b')]));Promise['all'](_0x3ec8fa)[_0x27e2('0x1b')](function(){_0x3ec8fa=[];_0x3ec8fa[_0x27e2('0x25')](deleteCmHopperPhones(_0xdaa27b[_0x27e2('0x8b')]['id']));_0x3ec8fa[_0x27e2('0x25')](addCmHopperPhones(_0xdaa27b['body']['id']));Promise[_0x27e2('0x27')](_0x3ec8fa)[_0x27e2('0x1b')](function(){return[0x1];})[_0x27e2('0x1b')](respondWithResult(_0x423ea2,null));});};function addAdditionalPhones(_0xb06e49){var _0x1d6f11;return new Promise(function(_0x26ed5c,_0x4a6373){return db[_0x27e2('0x9e')][_0x27e2('0x1a')]({'where':{'CmContactId':_0xb06e49['id']}})[_0x27e2('0x1b')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x27e2('0xc8')]})['then'](function(_0x4c65b9){var _0x4879e2=[];for(var _0x1ef1d5=0x0;_0x1ef1d5<_0xb06e49[_0x27e2('0xc9')][_0x27e2('0x28')];_0x1ef1d5++){var _0x59d873=_0xb06e49[_0x27e2('0xca')]?_[_0x27e2('0x53')](_0xb06e49['item_types'][_0x1ef1d5])?'':_0xb06e49['item_types'][_0x1ef1d5]:_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5]['ItemTypeId']?_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5][_0x27e2('0xcb')]:'';var _0x123404=_[_0x27e2('0x53')](_0xb06e49['items'][_0x1ef1d5][_0x27e2('0xcc')])?'':_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5][_0x27e2('0xcc')];var _0x4aeb8e=_0x59d873+':'+_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5][_0x27e2('0xbf')]+'§'+_0x123404;if(_[_0x27e2('0x53')](_0x1d6f11))_0x1d6f11=_0x4aeb8e;else _0x1d6f11+=';'+_0x4aeb8e;var _0x32e4aa=null;if(_0xb06e49[_0x27e2('0xca')]){if(!_[_0x27e2('0x53')](_0xb06e49[_0x27e2('0xca')][_0x1ef1d5])){var _0x22fa78=_[_0x27e2('0x43')](_0x4c65b9,function(_0x2d29b0){return _0x2d29b0['id']===_0xb06e49['item_types'][_0x1ef1d5];});if(!_[_0x27e2('0x53')](_0x22fa78)){_0x32e4aa=_0x22fa78[_0x27e2('0xc8')];}}}else{if(!_[_0x27e2('0x53')](_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5])){var _0x22fa78=_[_0x27e2('0x43')](_0x4c65b9,function(_0xe457ee){return _0xe457ee['id']===_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5][_0x27e2('0xcb')];});if(!_['isNil'](_0x22fa78)){_0x32e4aa=_0x1ef1d5;}}}if(_[_0x27e2('0x53')](_0x32e4aa)){_0x32e4aa=0x64;}_0x4879e2[_0x27e2('0x25')](addAdditionalPhone(_0xb06e49['id'],_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5]['phone'],_0xb06e49['item_types']?_[_0x27e2('0x53')](_0xb06e49[_0x27e2('0xca')][_0x1ef1d5])?null:_0xb06e49[_0x27e2('0xca')][_0x1ef1d5]:_0xb06e49[_0x27e2('0xc9')][_0x1ef1d5][_0x27e2('0xcb')]?_0xb06e49['items'][_0x1ef1d5][_0x27e2('0xcb')]:null,_0x32e4aa,_0x123404));}Promise[_0x27e2('0x27')](_0x4879e2)[_0x27e2('0x1b')](function(){db[_0x27e2('0x76')][_0x27e2('0x95')]({'AdditionalPhones':_0x1d6f11},{'where':{'id':_0xb06e49['id']}})[_0x27e2('0x1b')](function(){_0x26ed5c(0x1);});});});});});}function addAdditionalPhone(_0x58314c,_0x3abedc,_0x5db72f,_0x15dc50,_0x2409f5){return db[_0x27e2('0x9e')][_0x27e2('0x43')]({'where':{'CmContactId':_0x58314c,'item':_0x3abedc}})[_0x27e2('0x1b')](function(_0x6e12f1){if(_0x6e12f1)logger[_0x27e2('0x8e')](_0x27e2('0xcd'),_0x6e12f1);else{db['CmContactHasItem'][_0x27e2('0x93')]({'CmContactId':_0x58314c,'item':_0x3abedc,'ItemTypeId':_0x5db72f,'OrderBy':_0x15dc50,'ItemClass':_0x27e2('0xce'),'description':_0x2409f5});}});}function deletePhones(_0x4e87ee){return db['CmContactHasItem'][_0x27e2('0x1a')]({'where':{'CmContactId':_0x4e87ee}});}function deleteCmHopperPhones(_0x134866){return new Promise(function(_0x36be41,_0x4b14e5){return db[_0x27e2('0x90')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x134866}})['then'](function(_0x2fe33f){db[_0x27e2('0xcf')][_0x27e2('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x27e2('0x51')](_0x2fe33f,'id')}}});})[_0x27e2('0x1b')](function(){_0x36be41(0x1);});});}function addCmHopperPhones(_0x4972a4){return new Promise(function(_0x3e3403,_0x66de04){return db[_0x27e2('0x90')][_0x27e2('0x86')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4972a4}})[_0x27e2('0x1b')](function(_0x1f4cd3){var _0x125703=[];_['map'](_0x1f4cd3,function(_0x1298b4){_0x125703[_0x27e2('0x25')](createCmHopperPhone(_0x4972a4,_0x1298b4['id']));});Promise[_0x27e2('0x27')](_0x125703)[_0x27e2('0x1b')](function(){_0x3e3403(0x1);});});});}function createCmHopperPhone(_0x3060de,_0x6643c5){return new Promise(function(_0x5179e9,_0x3b302b){db[_0x27e2('0x9e')][_0x27e2('0x86')]({'raw':!![],'attributes':[_0x27e2('0xd0'),_0x27e2('0xc8')],'where':{'CmContactId':_0x3060de,'ItemClass':'PHONE'},'include':[{'model':db[_0x27e2('0xb2')],'attributes':[_0x27e2('0xc8')],'as':_0x27e2('0xb3')}],'order':['OrderBy',db[_0x27e2('0x73')][_0x27e2('0xd1')](_0x27e2('0xd2'))]})[_0x27e2('0x1b')](function(_0x1cd5c4){var _0x586600=0x1;var _0x47c029=_[_0x27e2('0x51')](_0x1cd5c4,function(_0x53eccf){_0x53eccf[_0x27e2('0xd3')]=_0x6643c5;_0x53eccf['phone']=_0x53eccf[_0x27e2('0xd0')];_0x53eccf[_0x27e2('0xc8')]=_0x586600;delete _0x53eccf['ItemType.OrderBy'];_0x586600=_0x586600+0x1;return _0x53eccf;});return db[_0x27e2('0xcf')][_0x27e2('0xd4')](_0x47c029,{});})[_0x27e2('0x1b')](function(){_0x5179e9(0x1);});});}function insertAdditionalPhones(_0x290354,_0x544849){return new Promise(function(_0x3e45d5,_0x3f4ee0){var _0x5acb5c=[];for(var _0x39c88a=0x0;_0x39c88a<_0x544849['length'];_0x39c88a++){var _0x49af82=_0x544849[_0x39c88a];_0x5acb5c[_0x27e2('0x25')](parseContactItemType(_0x49af82));}Promise[_0x27e2('0x27')](_0x5acb5c)[_0x27e2('0x1b')](function(){var _0x373f3a={'id':_0x290354['id'],'items':_0x544849};return addAdditionalPhones(_0x373f3a)[_0x27e2('0x1b')](function(_0x308f22){return addCmHopperPhones(_0x290354['id']);});})[_0x27e2('0x1b')](function(){_0x3e45d5(_0x290354);});});}function parseContactItemType(_0x3e7900){return new Promise(function(_0x16faa4,_0x2ddcd1){if(_0x3e7900[_0x27e2('0x52')](_0x27e2('0xcb'))){_0x16faa4(_0x3e7900);}else{return db[_0x27e2('0xb2')][_0x27e2('0x43')]({'where':{'name':_0x3e7900['ItemType']}})[_0x27e2('0x1b')](function(_0x2c5a52){if(_[_0x27e2('0x53')](_0x2c5a52))_0x3e7900[_0x27e2('0xcb')]=null;else _0x3e7900[_0x27e2('0xcb')]=_0x2c5a52['id'];_0x16faa4(_0x3e7900);});}});}exports[_0x27e2('0xd5')]=function(_0x276ee3,_0x551e4c){return db[_0x27e2('0x9e')][_0x27e2('0x86')]({'raw':!![],'where':{'CmContactId':_0x276ee3['params']['id'],'ItemClass':_0x27e2('0xce')},'include':[{'model':db[_0x27e2('0xb2')],'as':_0x27e2('0xb3')}],'order':[[db[_0x27e2('0x73')]['literal']('`ItemType`.OrderBy')],[_0x27e2('0xc8')]]})[_0x27e2('0x1b')](function(_0x306547){return _0x306547;})['then'](respondWithResult(_0x551e4c,null))[_0x27e2('0x80')](handleError(_0x551e4c,null));};exports[_0x27e2('0xd6')]=function(_0x40b3db,_0x8308ea){return db[_0x27e2('0x9e')][_0x27e2('0x86')]({'raw':!![],'where':{'CmContactId':_0x40b3db[_0x27e2('0x8b')][_0x27e2('0xd7')]}})['then'](function(_0x3cf40a){var _0x1b88b0=_[_0x27e2('0x51')](_0x3cf40a,function(_0x2cdcdb){_0x2cdcdb[_0x27e2('0xd8')]=_0x40b3db[_0x27e2('0x8b')][_0x27e2('0xd9')];return _0x2cdcdb;});return db['CmContactHasItem'][_0x27e2('0xd4')](_0x1b88b0,{});})['then'](function(_0x41e8a7){return addCmHopperPhones(_0x40b3db[_0x27e2('0x8b')]['toContactId']);})[_0x27e2('0x1b')](function(_0x3ccce8){return['ok'];})[_0x27e2('0x1b')](respondWithResult(_0x8308ea,null))[_0x27e2('0x80')](handleError(_0x8308ea,null));};exports[_0x27e2('0xda')]=function(_0x2aa0f5,_0x52704c){var _0x3b4d8a=[];_0x3b4d8a[_0x27e2('0x25')](createCmHopperPhone(_0x2aa0f5[_0x27e2('0x8b')]['id'],_0x2aa0f5[_0x27e2('0x8b')]['hopperId']));Promise[_0x27e2('0x27')](_0x3b4d8a)[_0x27e2('0x1b')](function(){return[0x1];})[_0x27e2('0x1b')](respondWithResult(_0x52704c,null));};exports[_0x27e2('0xdb')]=function(_0x217eb3,_0x5c0250){var _0x5e287f={'raw':![],'where':{}};var _0x20fd02={};var _0x23a66f={'count':0x0,'rows':[]};return db[_0x27e2('0x76')][_0x27e2('0xc1')]({'where':{'id':_0x217eb3['params']['id']}})['then'](handleEntityNotFound(_0x5c0250,null))[_0x27e2('0x1b')](function(_0x2ee36a){if(_0x2ee36a){_0x20fd02[_0x27e2('0x2a')]=_[_0x27e2('0x23')](db[_0x27e2('0x90')][_0x27e2('0xc2')]);_0x20fd02[_0x27e2('0x2b')]=_[_0x27e2('0x23')](_0x217eb3[_0x27e2('0x2b')]);_0x20fd02[_0x27e2('0x2c')]=_[_0x27e2('0x2d')](_0x20fd02[_0x27e2('0x2a')],_0x20fd02[_0x27e2('0x2b')]);_0x5e287f['attributes']=_[_0x27e2('0x2d')](_0x20fd02[_0x27e2('0x2a')],qs[_0x27e2('0x2e')](_0x217eb3['query'][_0x27e2('0x2e')]));_0x5e287f[_0x27e2('0x2f')]=_0x5e287f[_0x27e2('0x2f')][_0x27e2('0x28')]?_0x5e287f[_0x27e2('0x2f')]:_0x20fd02[_0x27e2('0x2a')];if(!_0x217eb3[_0x27e2('0x2b')][_0x27e2('0x52')](_0x27e2('0xc5'))){_0x5e287f['limit']=qs[_0x27e2('0x16')](_0x217eb3[_0x27e2('0x2b')][_0x27e2('0x16')]);_0x5e287f[_0x27e2('0x15')]=qs[_0x27e2('0x15')](_0x217eb3[_0x27e2('0x2b')]['offset']);}_0x5e287f['order']=qs[_0x27e2('0x31')](_0x217eb3[_0x27e2('0x2b')][_0x27e2('0x31')]);_0x5e287f[_0x27e2('0x32')]=qs[_0x27e2('0x2c')](_[_0x27e2('0xc3')](_0x217eb3[_0x27e2('0x2b')],_0x20fd02[_0x27e2('0x2c')]));_0x5e287f[_0x27e2('0x32')][_0x27e2('0xdc')]=_0x2ee36a['id'];if(_0x217eb3['query'][_0x27e2('0x5b')]){_0x5e287f[_0x27e2('0x32')]=_['merge'](_0x5e287f[_0x27e2('0x32')],{'$or':_['map'](_0x5e287f['attributes'],function(_0x302c9f){var _0x65eb0f={};_0x65eb0f[_0x302c9f]={'$like':'%'+_0x217eb3[_0x27e2('0x2b')][_0x27e2('0x5b')]+'%'};return _0x65eb0f;})});}_0x5e287f=_[_0x27e2('0x8a')]({},_0x5e287f,_0x217eb3[_0x27e2('0xc4')]);return db['CmHopper'][_0x27e2('0x14')]({'where':_0x5e287f[_0x27e2('0x32')]})[_0x27e2('0x1b')](function(_0x234020){_0x23a66f[_0x27e2('0x14')]=_0x234020;if(_0x217eb3[_0x27e2('0x2b')][_0x27e2('0xdd')]){_0x5e287f['include']=[{'all':!![]}];}return db[_0x27e2('0x90')][_0x27e2('0x86')](_0x5e287f);})[_0x27e2('0x1b')](function(_0x109802){_0x23a66f[_0x27e2('0xde')]=_0x109802;return _0x23a66f;});}})['then'](respondWithFilteredResult(_0x5c0250,_0x5e287f))[_0x27e2('0x80')](handleError(_0x5c0250,null));};exports[_0x27e2('0xdf')]=function(_0xf7ddc9,_0xb9e4af){var _0x45c444={'raw':!![],'where':{}};var _0x577a20={};var _0x4e8268={'count':0x0,'rows':[]};return db['CmContact'][_0x27e2('0xc1')]({'where':{'id':_0xf7ddc9['params']['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0xb9e4af,null))[_0x27e2('0x1b')](function(_0x193a25){if(_0x193a25){_0x577a20['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x577a20['query']=_[_0x27e2('0x23')](_0xf7ddc9[_0x27e2('0x2b')]);_0x577a20[_0x27e2('0x2c')]=_[_0x27e2('0x2d')](_0x577a20[_0x27e2('0x2a')],_0x577a20[_0x27e2('0x2b')]);_0x45c444[_0x27e2('0x2f')]=_[_0x27e2('0x2d')](_0x577a20[_0x27e2('0x2a')],qs[_0x27e2('0x2e')](_0xf7ddc9[_0x27e2('0x2b')][_0x27e2('0x2e')]));_0x45c444[_0x27e2('0x2f')]=_0x45c444[_0x27e2('0x2f')][_0x27e2('0x28')]?_0x45c444[_0x27e2('0x2f')]:_0x577a20[_0x27e2('0x2a')];if(!_0xf7ddc9[_0x27e2('0x2b')][_0x27e2('0x52')](_0x27e2('0xc5'))){_0x45c444[_0x27e2('0x16')]=qs[_0x27e2('0x16')](_0xf7ddc9['query'][_0x27e2('0x16')]);_0x45c444[_0x27e2('0x15')]=qs['offset'](_0xf7ddc9['query']['offset']);}_0x45c444[_0x27e2('0x30')]=qs[_0x27e2('0x31')](_0xf7ddc9[_0x27e2('0x2b')]['sort']);_0x45c444[_0x27e2('0x32')]=qs[_0x27e2('0x2c')](_[_0x27e2('0xc3')](_0xf7ddc9[_0x27e2('0x2b')],_0x577a20[_0x27e2('0x2c')]));_0x45c444[_0x27e2('0x32')][_0x27e2('0xdc')]=_0x193a25['id'];if(_0xf7ddc9[_0x27e2('0x2b')][_0x27e2('0x5b')]){_0x45c444[_0x27e2('0x32')]=_[_0x27e2('0x8a')](_0x45c444[_0x27e2('0x32')],{'$or':_[_0x27e2('0x51')](_0x45c444[_0x27e2('0x2f')],function(_0x167fb1){var _0x18a3c3={};_0x18a3c3[_0x167fb1]={'$like':'%'+_0xf7ddc9['query'][_0x27e2('0x5b')]+'%'};return _0x18a3c3;})});}_0x45c444=_[_0x27e2('0x8a')]({},_0x45c444,_0xf7ddc9[_0x27e2('0xc4')]);return db[_0x27e2('0xa0')]['count']({'where':_0x45c444['where']})[_0x27e2('0x1b')](function(_0x179e59){_0x4e8268['count']=_0x179e59;if(_0xf7ddc9[_0x27e2('0x2b')][_0x27e2('0xdd')]){_0x45c444[_0x27e2('0xe0')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x27e2('0x86')](_0x45c444);})['then'](function(_0x3f57a3){_0x4e8268[_0x27e2('0xde')]=_0x3f57a3;return _0x4e8268;});}})[_0x27e2('0x1b')](respondWithFilteredResult(_0xb9e4af,_0x45c444))[_0x27e2('0x80')](handleError(_0xb9e4af,null));};exports[_0x27e2('0xe1')]=function(_0x58137e,_0x2066eb){var _0x8a5ca8={'raw':!![],'where':{}};var _0x2459d0={};var _0x428aae={'count':0x0,'rows':[]};return db[_0x27e2('0x76')][_0x27e2('0xc1')]({'where':{'id':_0x58137e['params']['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0x2066eb,null))[_0x27e2('0x1b')](function(_0x51eae0){if(_0x51eae0){_0x2459d0[_0x27e2('0x2a')]=_[_0x27e2('0x23')](db['CmHopperFinal'][_0x27e2('0xc2')]);_0x2459d0[_0x27e2('0x2b')]=_[_0x27e2('0x23')](_0x58137e[_0x27e2('0x2b')]);_0x2459d0[_0x27e2('0x2c')]=_[_0x27e2('0x2d')](_0x2459d0[_0x27e2('0x2a')],_0x2459d0['query']);_0x8a5ca8['attributes']=_[_0x27e2('0x2d')](_0x2459d0[_0x27e2('0x2a')],qs[_0x27e2('0x2e')](_0x58137e[_0x27e2('0x2b')][_0x27e2('0x2e')]));_0x8a5ca8[_0x27e2('0x2f')]=_0x8a5ca8[_0x27e2('0x2f')][_0x27e2('0x28')]?_0x8a5ca8['attributes']:_0x2459d0[_0x27e2('0x2a')];if(!_0x58137e['query'][_0x27e2('0x52')](_0x27e2('0xc5'))){_0x8a5ca8[_0x27e2('0x16')]=qs['limit'](_0x58137e['query'][_0x27e2('0x16')]);_0x8a5ca8[_0x27e2('0x15')]=qs[_0x27e2('0x15')](_0x58137e['query']['offset']);}_0x8a5ca8[_0x27e2('0x30')]=qs['sort'](_0x58137e[_0x27e2('0x2b')]['sort']);_0x8a5ca8['where']=qs[_0x27e2('0x2c')](_[_0x27e2('0xc3')](_0x58137e[_0x27e2('0x2b')],_0x2459d0[_0x27e2('0x2c')]));_0x8a5ca8[_0x27e2('0x32')][_0x27e2('0xdc')]=_0x51eae0['id'];if(_0x58137e[_0x27e2('0x2b')][_0x27e2('0x5b')]){_0x8a5ca8[_0x27e2('0x32')]=_[_0x27e2('0x8a')](_0x8a5ca8[_0x27e2('0x32')],{'$or':_[_0x27e2('0x51')](_0x8a5ca8[_0x27e2('0x2f')],function(_0x5a3f04){var _0x5a8656={};_0x5a8656[_0x5a3f04]={'$like':'%'+_0x58137e['query'][_0x27e2('0x5b')]+'%'};return _0x5a8656;})});}_0x8a5ca8=_[_0x27e2('0x8a')]({},_0x8a5ca8,_0x58137e['options']);return db[_0x27e2('0x9f')][_0x27e2('0x14')]({'where':_0x8a5ca8[_0x27e2('0x32')]})[_0x27e2('0x1b')](function(_0x4f98b2){_0x428aae[_0x27e2('0x14')]=_0x4f98b2;if(_0x58137e[_0x27e2('0x2b')][_0x27e2('0xdd')]){_0x8a5ca8[_0x27e2('0xe0')]=[{'all':!![]}];}return db[_0x27e2('0x9f')]['findAll'](_0x8a5ca8);})[_0x27e2('0x1b')](function(_0x29cc54){_0x428aae[_0x27e2('0xde')]=_0x29cc54;return _0x428aae;});}})[_0x27e2('0x1b')](respondWithFilteredResult(_0x2066eb,_0x8a5ca8))[_0x27e2('0x80')](handleError(_0x2066eb,null));};exports[_0x27e2('0xe2')]=function(_0x5cfc48,_0x32a13d){var _0x16d54c={'raw':!![],'where':{}};var _0x2ebb36={};var _0x480570={'count':0x0,'rows':[]};return db[_0x27e2('0x76')][_0x27e2('0xc1')]({'where':{'id':_0x5cfc48[_0x27e2('0xb0')]['id']}})[_0x27e2('0x1b')](handleEntityNotFound(_0x32a13d,null))[_0x27e2('0x1b')](function(_0x168840){if(_0x168840){_0x2ebb36[_0x27e2('0x2a')]=_[_0x27e2('0x23')](db['JscriptySessionReport']['rawAttributes']);_0x2ebb36[_0x27e2('0x2b')]=_['keys'](_0x5cfc48[_0x27e2('0x2b')]);_0x2ebb36[_0x27e2('0x2c')]=_['intersection'](_0x2ebb36[_0x27e2('0x2a')],_0x2ebb36['query']);_0x16d54c[_0x27e2('0x2f')]=_[_0x27e2('0x2d')](_0x2ebb36[_0x27e2('0x2a')],qs[_0x27e2('0x2e')](_0x5cfc48[_0x27e2('0x2b')][_0x27e2('0x2e')]));_0x16d54c[_0x27e2('0x2f')]=_0x16d54c[_0x27e2('0x2f')]['length']?_0x16d54c[_0x27e2('0x2f')]:_0x2ebb36[_0x27e2('0x2a')];if(!_0x5cfc48['query'][_0x27e2('0x52')](_0x27e2('0xc5'))){_0x16d54c[_0x27e2('0x16')]=qs[_0x27e2('0x16')](_0x5cfc48[_0x27e2('0x2b')][_0x27e2('0x16')]);_0x16d54c[_0x27e2('0x15')]=qs[_0x27e2('0x15')](_0x5cfc48[_0x27e2('0x2b')][_0x27e2('0x15')]);}_0x16d54c[_0x27e2('0x30')]=qs[_0x27e2('0x31')](_0x5cfc48[_0x27e2('0x2b')][_0x27e2('0x31')]);_0x16d54c[_0x27e2('0x32')]=qs[_0x27e2('0x2c')](_[_0x27e2('0xc3')](_0x5cfc48[_0x27e2('0x2b')],_0x2ebb36['filters']));_0x16d54c['where']['ContactId']=_0x168840['id'];if(_0x5cfc48['query'][_0x27e2('0x5b')]){_0x16d54c[_0x27e2('0x32')]=_[_0x27e2('0x8a')](_0x16d54c[_0x27e2('0x32')],{'$or':_[_0x27e2('0x51')](_0x16d54c[_0x27e2('0x2f')],function(_0x495aa7){var _0xab2d8a={};_0xab2d8a[_0x495aa7]={'$like':'%'+_0x5cfc48['query'][_0x27e2('0x5b')]+'%'};return _0xab2d8a;})});}_0x16d54c=_[_0x27e2('0x8a')]({},_0x16d54c,_0x5cfc48[_0x27e2('0xc4')]);return db[_0x27e2('0xa5')][_0x27e2('0x14')]({'where':_0x16d54c[_0x27e2('0x32')]})[_0x27e2('0x1b')](function(_0x2c283b){_0x480570['count']=_0x2c283b;if(_0x5cfc48[_0x27e2('0x2b')]['includeAll']){_0x16d54c['include']=[{'all':!![]}];}return db[_0x27e2('0xa5')]['findAll'](_0x16d54c);})[_0x27e2('0x1b')](function(_0xaa0e1e){_0x480570[_0x27e2('0xde')]=_0xaa0e1e;return _0x480570;});}})[_0x27e2('0x1b')](respondWithFilteredResult(_0x32a13d,_0x16d54c))[_0x27e2('0x80')](handleError(_0x32a13d,null));};exports['uploadCsv']=function(_0x55a09a,_0x2eb71f){try{if(!_0x55a09a['body'][_0x27e2('0x56')]){throw new Error(_0x27e2('0xe3'));}if(!_0x55a09a[_0x27e2('0x8b')][_0x27e2('0xe4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x55a09a[_0x27e2('0x8b')][_0x27e2('0xe5')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x55a09a['body'][_0x27e2('0xe6')]){throw new Error(_0x27e2('0xe7'));}var _0x336fea=_0x55a09a[_0x27e2('0x8b')][_0x27e2('0xe4')]['split'](',');var _0x1c4b35=_0x55a09a['body'][_0x27e2('0xe5')]['split'](',');if(!_0x336fea[_0x27e2('0x28')]||!_0x1c4b35[_0x27e2('0x28')]||_0x336fea[_0x27e2('0x28')]!==_0x1c4b35[_0x27e2('0x28')]){throw new Error(_0x27e2('0xe8'));}_0x55a09a[_0x27e2('0x8b')][_0x27e2('0x2e')]=_[_0x27e2('0xe9')](_0x336fea,_0x1c4b35);if(!_0x55a09a[_0x27e2('0x8b')][_0x27e2('0x2e')]['phone']){throw new Error(_0x27e2('0xea'));}if(!_0x55a09a[_0x27e2('0x8b')][_0x27e2('0x2e')]['firstName']){throw new Error(_0x27e2('0xeb'));}var _0x462897=path['join'](config['root'],_0x27e2('0xec'),_0x55a09a[_0x27e2('0xed')][_0x27e2('0xee')]);fs[_0x27e2('0xef')](_0x462897,parseInt(_0x27e2('0xf0'),0x8));var _0x3ba78e=require(_0x27e2('0xf1'))[_0x27e2('0xf2')](path[_0x27e2('0x8d')](__dirname,_0x27e2('0xf3')),[_0x462897,_0x55a09a['body'][_0x27e2('0xe4')],_0x55a09a['body']['binding_values'],_0x55a09a[_0x27e2('0x8b')][_0x27e2('0x56')],_0x55a09a[_0x27e2('0x8b')]['CompanyId'],_0x55a09a[_0x27e2('0x8b')]['duplicates'],_0x55a09a['body'][_0x27e2('0xe6')]]);return _0x2eb71f[_0x27e2('0x12')](0xc8)[_0x27e2('0x19')]({'message':'File\x20uploaded\x20correctly!','pid':_0x3ba78e[_0x27e2('0xf4')]});}catch(_0x1c3307){return _0x2eb71f[_0x27e2('0x12')](0x1f4)[_0x27e2('0x20')](_0x1c3307);}};exports[_0x27e2('0xf5')]=function(_0x361139,_0x8bc05){var _0x44272=fs[_0x27e2('0xf6')](_0x361139[_0x27e2('0xed')][_0x27e2('0x2')]);Papa[_0x27e2('0xf7')](_0x44272,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c1819){return _0x8bc05['status'](0xc8)['json']({'file':_0x361139[_0x27e2('0xed')],'fields':_0x5c1819[_0x27e2('0xf8')][_0x27e2('0x2e')]});}});};exports[_0x27e2('0xf9')]=function(_0x5906b1,_0x21ab6f){return db[_0x27e2('0x70')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x27e2('0x6e')}})[_0x27e2('0x1b')](function(_0xa351fb){var _0x541eae=![];if(!_0x5906b1['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x5906b1['body'][_0x27e2('0xfa')][_0x27e2('0xbf')]){throw new Error(_0x27e2('0xea'));}if(!_0x5906b1[_0x27e2('0x8b')][_0x27e2('0xfa')][_0x27e2('0xfb')]){throw new Error(_0x27e2('0xeb'));}if(!_0x5906b1[_0x27e2('0x8b')][_0x27e2('0xe6')]){throw new Error(_0x27e2('0xe7'));}var _0x5a6ba0=require(_0x27e2('0xf1'))[_0x27e2('0xf2')](path[_0x27e2('0x8d')](__dirname,_0x27e2('0xfc')),[_0x5906b1[_0x27e2('0xb0')]['id'],JSON[_0x27e2('0xfd')](_0x5906b1[_0x27e2('0x8b')]),JSON[_0x27e2('0xfd')](_0xa351fb)]);_0x5a6ba0['on'](_0x27e2('0xfe'),function(){_0x541eae=!![];return _0x21ab6f[_0x27e2('0x12')](0xc8)['json']({'message':_0x27e2('0xff'),'pid':_0x5a6ba0[_0x27e2('0xf4')]});});_0x5a6ba0['on'](_0x27e2('0x100'),function(_0x4c51e9){if(_0x4c51e9&&!_0x541eae){return _0x21ab6f[_0x27e2('0x12')](0x1f4)[_0x27e2('0x19')]({'message':_0x27e2('0x101'),'pid':_0x5a6ba0[_0x27e2('0xf4')]});}});})[_0x27e2('0x80')](handleError(_0x21ab6f,null));};exports[_0x27e2('0x102')]=function(_0x588751,_0xd6d1d0,_0x54beef){return db[_0x27e2('0x70')][_0x27e2('0x86')]({'raw':!![],'attributes':['id'],'where':{'role':_0x27e2('0x6e')}})[_0x27e2('0x1b')](function(_0x10b8b8){var _0x1a31a3=![];if(!_0x588751[_0x27e2('0x8b')][_0x27e2('0x56')]){throw new Error(_0x27e2('0xe3'));}if(!_0x588751[_0x27e2('0x8b')][_0x27e2('0xfa')]['phone']){throw new Error(_0x27e2('0xea'));}if(!_0x588751[_0x27e2('0x8b')][_0x27e2('0xfa')][_0x27e2('0xfb')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x588751['body'][_0x27e2('0xe6')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5f1431=require('child_process')[_0x27e2('0xf2')](path[_0x27e2('0x8d')](__dirname,'../../components/import/cm/csvUpdates'),[_0x588751['params']['id'],JSON['stringify'](_0x588751[_0x27e2('0x8b')]),JSON[_0x27e2('0xfd')](_0x10b8b8)]);_0x5f1431['on'](_0x27e2('0xfe'),function(_0x157053){_0x1a31a3=!![];return _0xd6d1d0['status'](0xc8)[_0x27e2('0x19')]({'message':_0x27e2('0xff'),'pid':_0x5f1431[_0x27e2('0xf4')]});});_0x5f1431['on'](_0x27e2('0x100'),function(_0x5d142d){if(_0x5d142d&&!_0x1a31a3){return _0xd6d1d0[_0x27e2('0x12')](0x1f4)[_0x27e2('0x19')]({'message':_0x27e2('0x101'),'pid':_0x5f1431['pid']});}});})[_0x27e2('0x80')](handleError(_0xd6d1d0,null));};exports['getJourney']=function(_0x2bc986,_0x4055a5){var _0x3de567=[_0x27e2('0x103'),_0x27e2('0x104'),'sms',_0x27e2('0x105'),_0x27e2('0x106'),_0x27e2('0x107'),'voice'];var _0x3b42bf={'offset':0x0,'order':qs[_0x27e2('0x31')](_0x27e2('0x108'))},_0x4ffbf4={'count':0x0,'rows':[]};Promise[_0x27e2('0x6b')]()[_0x27e2('0x1b')](function(){if(_0x2bc986[_0x27e2('0x2b')][_0x27e2('0x109')]){if(!_[_0x27e2('0x10a')](_0x3de567,_0x2bc986['query'][_0x27e2('0x109')][_0x27e2('0x10b')]())){throw new Error('Invalid\x20channel');}_0x3de567=[_0x2bc986['query'][_0x27e2('0x109')][_0x27e2('0x10b')]()];}if(_0x2bc986[_0x27e2('0x2b')][_0x27e2('0x10c')]){try{var _0x92c71b=JSON[_0x27e2('0xf7')](_0x2bc986[_0x27e2('0x2b')]['range']);if(!moment(_0x92c71b['from'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x92c71b['to'])[_0x27e2('0x10d')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x1771fb){throw new Error(_0x27e2('0x10e'));}}if(!_0x2bc986[_0x27e2('0x2b')][_0x27e2('0x52')]('nolimit')){_0x3b42bf[_0x27e2('0x16')]=qs['limit'](_0x2bc986[_0x27e2('0x2b')][_0x27e2('0x16')]||0xa);_0x3b42bf[_0x27e2('0x15')]=qs['offset'](_0x2bc986['query']['offset']);}var _0x39ae51=_0x3de567[_0x27e2('0x51')](function(_0x43fc9f){if(_0x43fc9f===_0x27e2('0x10f')){var _0x3c2d4d={'attributes':['id','uniqueid','type','source',_0x27e2('0x110'),_0x27e2('0x111'),_0x27e2('0x112'),_0x27e2('0x113'),_0x27e2('0x114'),_0x27e2('0x115'),_0x27e2('0x116'),'userDisposition','userSecondDisposition',_0x27e2('0x117'),_0x27e2('0x118')],'where':{'ContactId':_0x2bc986[_0x27e2('0xb0')]['id']},'include':[{'model':db[_0x27e2('0x70')],'as':_0x27e2('0x70'),'attributes':['id','name',_0x27e2('0x119'),_0x27e2('0x11a')]}],'order':[[_0x27e2('0x116'),_0x27e2('0x69')]]};if(_0x2bc986['query'][_0x27e2('0x10c')]){_0x3c2d4d[_0x27e2('0x32')]['createdAt']={'$gte':_0x92c71b['from'],'$lte':_0x92c71b['to']};}return db['VoiceCallReport'][_0x27e2('0x11b')](_0x3c2d4d)['then'](function(_0x49ef14){_0x4ffbf4[_0x27e2('0x14')]+=_0x49ef14[_0x27e2('0x14')];return _['map'](_0x49ef14[_0x27e2('0xde')],function(_0x2fbf5f){var _0x2d403d=_0x2fbf5f[_0x27e2('0x8c')]({'plain':!![]});_0x2d403d[_0x27e2('0x109')]=_0x43fc9f;if(_0x2d403d[_0x27e2('0x70')]){_0x2d403d[_0x27e2('0x70')]={'id':_0x2d403d[_0x27e2('0x70')]['id'],'name':_0x2d403d['User']['name'],'fullname':_0x2d403d[_0x27e2('0x70')][_0x27e2('0x119')],'alias':_0x2d403d[_0x27e2('0x70')]['alias']};}return _0x2d403d;});});}else{var _0x1138a1=_['startCase'](_0x43fc9f)+(_0x43fc9f===_0x27e2('0x104')?_0x27e2('0x11c'):_0x27e2('0x11d'));var _0x3ae15d={'attributes':['id',_0x27e2('0x11e'),_0x27e2('0x11f'),_0x27e2('0x116'),_0x27e2('0x115'),_0x27e2('0x120'),'secondDisposition',_0x27e2('0x121'),'UserId',_0x1138a1+'Id'],'where':{'ContactId':_0x2bc986[_0x27e2('0xb0')]['id']},'include':[{'model':db[_0x1138a1],'as':_0x27e2('0x11d'),'attributes':['id',_0x27e2('0x35'),_0x27e2('0x122')]},{'model':db[_0x27e2('0x70')],'as':_0x27e2('0x123'),'attributes':['id',_0x27e2('0x35'),_0x27e2('0x119')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x27e2('0x35'),_0x27e2('0x36')],'through':{'attributes':[]}}],'order':[['createdAt',_0x27e2('0x69')]]};if(_0x2bc986[_0x27e2('0x2b')][_0x27e2('0x10c')]){_0x3ae15d[_0x27e2('0x32')][_0x27e2('0x116')]={'$gte':_0x92c71b['from'],'$lte':_0x92c71b['to']};}switch(_0x43fc9f){case _0x27e2('0x104'):_0x3ae15d[_0x27e2('0x2f')][_0x27e2('0x25')](_0x27e2('0x124'),'customerIp',_0x27e2('0x125'),'deviceModel',_0x27e2('0x126'),_0x27e2('0x127'),_0x27e2('0x128'),'ratingValue',_0x27e2('0x129'));break;case _0x27e2('0x103'):_0x3ae15d[_0x27e2('0x2f')][_0x27e2('0x25')]('subject',_0x27e2('0x12a'));break;case _0x27e2('0x105'):_0x3ae15d['attributes'][_0x27e2('0x25')]('externalUrl','threadId');break;}return db[_['startCase'](_0x43fc9f)+_0x27e2('0x12b')][_0x27e2('0x11b')](_0x3ae15d)[_0x27e2('0x1b')](function(_0x1181e6){_0x4ffbf4[_0x27e2('0x14')]+=_0x1181e6[_0x27e2('0x14')];return _['map'](_0x1181e6[_0x27e2('0xde')],function(_0x3f4337){var _0x40a1aa=_0x3f4337[_0x27e2('0x8c')]({'plain':!![]});_0x40a1aa[_0x27e2('0x109')]=_0x43fc9f;if(_0x40a1aa['Owner']){_0x40a1aa[_0x27e2('0x123')]={'id':_0x40a1aa[_0x27e2('0x123')]['id'],'name':_0x40a1aa[_0x27e2('0x123')][_0x27e2('0x35')],'fullname':_0x40a1aa[_0x27e2('0x123')][_0x27e2('0x119')]};}return _0x40a1aa;});});}});return Promise['all'](_0x39ae51);})[_0x27e2('0x1b')](function(_0x248d27){return _(_0x248d27)[_0x27e2('0x12c')]()[_0x27e2('0x12d')]('createdAt')[_0x27e2('0x12e')]()[_0x27e2('0x49')]();})['then'](function(_0x2bbe38){_0x4ffbf4[_0x27e2('0xde')]=_0x3b42bf[_0x27e2('0x16')]?_0x2bbe38[_0x27e2('0x12f')](_0x3b42bf[_0x27e2('0x15')],_0x3b42bf['offset']+_0x3b42bf['limit']):_0x2bbe38;return _0x4ffbf4;})[_0x27e2('0x1b')](respondWithFilteredResult(_0x4055a5,_0x3b42bf))['catch'](handleError(_0x4055a5,null));}; \ No newline at end of file +var _0x2b4f=['substatus','externalUrl','threadId','Interaction','Owner','sortBy','reverse','bluebird','path','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','length','fieldType','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','union','User','and','dateOfBirth','datetime','castTo','DATE','type','text','start','isNil','Contact','isEmpty','ListId','where','c.ListId\x20IN\x20?','concat','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','toString','sequelize','keyBy','c.firstName','c.lastName','c.fax','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','columnName','displayName','analytics','alias','custom','values','merge','body','findAll','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','findOrCreate','spread','contact','show','params','Phones','ItemType','literal','Phones.OrderBy','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','options','getTags','setTags','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','phone','PHONE','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','rawAttributes','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','binding_keys','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','0777','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','fork','../../components/import/cm/csvUpdates','error\x20child\x20process','sms','openchannel','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','duration','userDisposition','userSecondDisposition','userThirdDisposition','fullname','createdAt','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','note','secondDisposition','thirdDisposition','key','customerIp','deviceModel','osName','ratingType','ratingValue','mail','subject'];(function(_0x9abec8,_0xd30b37){var _0x58324e=function(_0x172e9b){while(--_0x172e9b){_0x9abec8['push'](_0x9abec8['shift']());}};_0x58324e(++_0xd30b37);}(_0x2b4f,0x142));var _0xf2b4=function(_0x3fa5a9,_0x49532c){_0x3fa5a9=_0x3fa5a9-0x0;var _0x5abed2=_0x2b4f[_0x3fa5a9];return _0x5abed2;};'use strict';var moment=require('moment');var BPromise=require(_0xf2b4('0x0'));var util=require('util');var path=require(_0xf2b4('0x1'));var fs=require('fs');var _=require(_0xf2b4('0x2'));var squel=require(_0xf2b4('0x3'));var Papa=require(_0xf2b4('0x4'));var Redis=require(_0xf2b4('0x5'));var qs=require('../../components/parsers/qs');var as=require(_0xf2b4('0x6'));var logger=require(_0xf2b4('0x7'))(_0xf2b4('0x8'));var config=require(_0xf2b4('0x9'));var shared=require('../../config/environment/shared');var db=require(_0xf2b4('0xa'))['db'];config['redis']=_[_0xf2b4('0xb')](config[_0xf2b4('0xc')],{'host':_0xf2b4('0xd'),'port':0x18eb});var socket=require(_0xf2b4('0xe'))(new Redis(config[_0xf2b4('0xc')]));require(_0xf2b4('0xf'))[_0xf2b4('0x10')](socket);function respondWithResult(_0x2a470a,_0x11ada6){_0x11ada6=_0x11ada6||0xc8;return function(_0x23812d){if(_0x23812d){return _0x2a470a[_0xf2b4('0x11')](_0x11ada6)[_0xf2b4('0x12')](_0x23812d);}};}function respondWithFilteredResult(_0x3d792a,_0x1f3f68){return function(_0x150b91){if(_0x150b91){var _0x5c5e41=typeof _0x1f3f68[_0xf2b4('0x13')]===_0xf2b4('0x14')&&typeof _0x1f3f68[_0xf2b4('0x15')]===_0xf2b4('0x14');var _0x4dc9b8=_0x150b91['count'];var _0x470116=_0x5c5e41?0x0:_0x1f3f68['offset'];var _0x435022=_0x5c5e41?_0x150b91[_0xf2b4('0x16')]:_0x1f3f68[_0xf2b4('0x13')]+_0x1f3f68['limit'];var _0x4fcecf;if(_0x435022>=_0x4dc9b8){_0x435022=_0x4dc9b8;_0x4fcecf=0xc8;}else{_0x4fcecf=0xce;}_0x3d792a[_0xf2b4('0x11')](_0x4fcecf);return _0x3d792a[_0xf2b4('0x17')](_0xf2b4('0x18'),_0x470116+'-'+_0x435022+'/'+_0x4dc9b8)[_0xf2b4('0x12')](_0x150b91);}return null;};}function saveUpdates(_0x562ab8){return function(_0x3d57a3){if(_0x3d57a3){return _0x3d57a3['update'](_0x562ab8)[_0xf2b4('0x19')](function(_0x797856){return _0x797856;});}return null;};}function removeEntity(_0x1b0a12){return function(_0x42802f){if(_0x42802f){return _0x42802f[_0xf2b4('0x1a')]()[_0xf2b4('0x19')](function(){_0x1b0a12[_0xf2b4('0x11')](0xcc)[_0xf2b4('0x1b')]();});}};}function handleEntityNotFound(_0x4a1b6a){return function(_0x32fe54){if(!_0x32fe54){_0x4a1b6a[_0xf2b4('0x1c')](0x194);}return _0x32fe54;};}function handleError(_0x449fdb,_0x4642bc){_0x4642bc=_0x4642bc||0x1f4;return function(_0x38afe7){logger[_0xf2b4('0x1d')](_0x38afe7[_0xf2b4('0x1e')]);if(_0x38afe7['name']){delete _0x38afe7[_0xf2b4('0x1f')];}_0x449fdb[_0xf2b4('0x11')](_0x4642bc)[_0xf2b4('0x20')](_0x38afe7);};}exports[_0xf2b4('0x21')]=function(_0x51330b,_0x4ea69f){var _0xb14af2={},_0x1244f2={},_0x18d28b={'count':0x0,'rows':[]};return db[_0xf2b4('0x22')][_0xf2b4('0x23')]()[_0xf2b4('0x19')](function(_0x390c94){var _0x4346c1=[];for(var _0x2ee93b=0x0;_0x2ee93b0x1){_0xf78bf1['or'](_0xf2b4('0x65'),qs[_0xf2b4('0x66')](_0x12dd95),null);}else{if(qs[_0xf2b4('0x67')](_0x12dd95)){_0xf78bf1['or'](_0xf2b4('0x68'),_0x12dd95+'%');_0xf78bf1['or'](_0xf2b4('0x69'),_0x12dd95+'%');_0xf78bf1['or'](_0xf2b4('0x6a'),_0x12dd95+'%');_0xf78bf1['or'](_0xf2b4('0x6b'),_0x12dd95+'%');}else if(qs[_0xf2b4('0x6c')](_0x12dd95)){_0xf78bf1['or'](_0xf2b4('0x6d'),_0x12dd95+'%');}else{_0xf78bf1['or']('c.firstName\x20LIKE\x20?','%'+_0x12dd95+'%');_0xf78bf1['or'](_0xf2b4('0x6e'),'%'+_0x12dd95+'%');_0xf78bf1['or']('c.email\x20LIKE\x20?','%'+_0x12dd95+'%');}}}}_0x4065c7[_0xf2b4('0x5d')](_0xf78bf1);_0x4065c7[_0xf2b4('0x6f')](_0xf2b4('0x70'));var _0x27ac60={'type':db[_0xf2b4('0x71')][_0xf2b4('0x72')][_0xf2b4('0x73')],'raw':!![]};var _0x13c9b7=_0x4065c7['clone']()[_0xf2b4('0x3a')](_0xf2b4('0x70'));if(_0xb14af2['order']){_0xb14af2[_0xf2b4('0x35')][_0xf2b4('0x4e')](function(_0x302805){_0x4065c7['order']('c.'+_0x302805[0x0],_0x302805[0x1]===_0xf2b4('0x74')?![]:!![]);});}if(!_[_0xf2b4('0x5b')](_0x2c5bc4)){_0x4065c7[_0xf2b4('0x75')](_0x43768c);_0x13c9b7['where'](_0xf2b4('0x76'),_0x2c5bc4);}BPromise[_0xf2b4('0x77')]()['then'](function(){if(!_0x507bb2)return;if(_0x51330b[_0xf2b4('0x78')][_0xf2b4('0x79')]!==_0xf2b4('0x7a'))return;if(!_[_0xf2b4('0x7b')](_0x507bb2[_0xf2b4('0x49')],['field',_0xf2b4('0x50')])){return _0x51330b[_0xf2b4('0x78')][_0xf2b4('0x7c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12f19c){if(_[_0xf2b4('0x5b')](_0x12f19c)){_0x13c9b7[_0xf2b4('0x5d')](_0xf2b4('0x7d'));_0x4065c7[_0xf2b4('0x5d')](_0xf2b4('0x7d'));}else{_0x13c9b7[_0xf2b4('0x5d')](_0xf2b4('0x5e'),_[_0xf2b4('0x4d')](_0x12f19c,'id'));_0x4065c7['where'](_0xf2b4('0x5e'),_[_0xf2b4('0x4d')](_0x12f19c,'id'));}});}})[_0xf2b4('0x19')](function(){if(_0x51330b[_0xf2b4('0x78')]['role']==='agent'&&!_0x507bb2&&!_0x51330b[_0xf2b4('0x2f')][_0xf2b4('0x5c')])return[];return db['sequelize']['query'](_0x13c9b7[_0xf2b4('0x7e')](),_0x27ac60);})[_0xf2b4('0x19')](function(_0x318b28){_0x18d28b[_0xf2b4('0x16')]=_0x318b28[_0xf2b4('0x2c')];if(_0x18d28b[_0xf2b4('0x16')]===0x0)return[];return db[_0xf2b4('0x7f')]['query'](_0x56898c['toString'](),_0x27ac60)[_0xf2b4('0x19')](function(_0x177ca2){_0x31ac5d=_[_0xf2b4('0x80')](_0x177ca2,'id');_0x27ac60=_['merge'](_0x27ac60,{'model':db[_0xf2b4('0x22')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51330b[_0xf2b4('0x2f')]['fields']){_0xb14af2[_0xf2b4('0x30')][_0xf2b4('0x4e')](function(_0x402292){_0x4065c7[_0xf2b4('0x3a')]('c.'+_0x402292);});}else{_0x4065c7['field'](_0xf2b4('0x70'));_0x4065c7[_0xf2b4('0x3a')](_0xf2b4('0x81'));_0x4065c7[_0xf2b4('0x3a')](_0xf2b4('0x82'));_0x4065c7[_0xf2b4('0x3a')]('c.phone');_0x4065c7[_0xf2b4('0x3a')]('c.mobile');_0x4065c7[_0xf2b4('0x3a')](_0xf2b4('0x83'));_0x4065c7[_0xf2b4('0x3a')]('c.email');_0x4065c7[_0xf2b4('0x3a')](_0xf2b4('0x84'));_0x4065c7[_0xf2b4('0x3a')](_0xf2b4('0x85'));_0x4065c7[_0xf2b4('0x3a')]('c.deletedAt');_0x4065c7['field'](_0xf2b4('0x86'));_0x4065c7['field'](_0xf2b4('0x87'),_0xf2b4('0x88'));}if(_0xb14af2['limit'])_0x4065c7[_0xf2b4('0x15')](_0xb14af2[_0xf2b4('0x15')]);if(_0xb14af2[_0xf2b4('0x13')])_0x4065c7['offset'](_0xb14af2[_0xf2b4('0x13')]);return db['sequelize'][_0xf2b4('0x2f')](_0x4065c7['toString'](),_0x27ac60);});})[_0xf2b4('0x19')](function(_0x1f54f5){_0x1f54f5['forEach'](function(_0x86a407){if(_0x86a407[_0xf2b4('0x88')]){_0x86a407[_0xf2b4('0x89')]=[];_0x86a407[_0xf2b4('0x88')][_0xf2b4('0x4c')](',')[_0xf2b4('0x4e')](function(_0x32528d){_0x86a407[_0xf2b4('0x89')][_0xf2b4('0x26')](_0x31ac5d[_0x32528d]);});}delete _0x86a407[_0xf2b4('0x88')];});_0x18d28b[_0xf2b4('0x8a')]=_0x1f54f5;return _0x18d28b;})['then'](respondWithFilteredResult(_0x4ea69f,_0xb14af2));})[_0xf2b4('0x8b')](handleError(_0x4ea69f,null));};exports['destroy']=function(_0x5938aa,_0x1d594b){return db[_0xf2b4('0x22')][_0xf2b4('0x8c')]({'where':{'id':_0x5938aa['params']['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0x1d594b,null))[_0xf2b4('0x19')](removeEntity(_0x1d594b,null))[_0xf2b4('0x8b')](handleError(_0x1d594b,null));};exports[_0xf2b4('0x23')]=function(_0x2df76e,_0x27aea9){return db[_0xf2b4('0x22')]['describe']()[_0xf2b4('0x19')](function(_0x566383){delete _0x566383['tags'];for(var _0x5e5003=0x0;_0x5e50030x0){return new Promise(function(_0x2339cf,_0x140ae8){var _0x1efa44=[];for(var _0x281529=0x0;_0x281529<_0x3ee042[_0xf2b4('0x2c')];_0x281529++){_0x1efa44[_0xf2b4('0x26')](insertAdditionalPhones(_0x3ee042[_0x281529][_0xf2b4('0xbf')],_0x3ee042[_0x281529]['additionalPhones']));}Promise[_0xf2b4('0x2b')](_0x1efa44)[_0xf2b4('0x19')](function(){_0x2339cf(0x1);});})['then'](function(){return{'success':_0x24141c,'failure':_0xb5dd7e,'duplicates':_0x544be4};});}else{return{'success':_0x24141c,'failure':_0xb5dd7e,'duplicates':_0x544be4};}}})[_0xf2b4('0x19')](respondWithResult(_0x2b372b,0xc9))[_0xf2b4('0x8b')](handleError(_0x2b372b,null));};exports[_0xf2b4('0xc0')]=function(_0x42f5c5,_0x14f7c5){var _0x3a548e;return db['CmContact'][_0xf2b4('0x23')]()[_0xf2b4('0x19')](function(_0x4f726a){return db['CmContact'][_0xf2b4('0x8c')]({'where':{'id':_0x42f5c5[_0xf2b4('0xc1')]['id']},'include':[{'model':db[_0xf2b4('0x4a')],'as':_0xf2b4('0x89'),'attributes':['id','name',_0xf2b4('0x3b')],'required':_0x42f5c5[_0xf2b4('0x2f')][_0xf2b4('0x60')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xf2b4('0xc2'),'where':{'CmContactId':_0x42f5c5['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xf2b4('0xc3')}]}],'order':[db['sequelize'][_0xf2b4('0xc4')](_0xf2b4('0xc5'))],'attributes':_['keys'](_0x4f726a)});})[_0xf2b4('0x19')](function(_0x5c59ad){if(!_['isNil'](_0x5c59ad)){_0x3a548e=_0x5c59ad[_0xf2b4('0x96')]({'plain':!![]});var _0x2b0f1b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c59ad&&_0x5c59ad[_0xf2b4('0x5c')]){if(_0x5c59ad[_0xf2b4('0x5c')]){_0x2b0f1b['where']['$and'][_0xf2b4('0x26')]({'ListId':{'$ne':_0x5c59ad['ListId']}});}}return db[_0xf2b4('0x27')][_0xf2b4('0x95')](_0x2b0f1b);}})[_0xf2b4('0x19')](function(_0x34829c){if(!_['isNil'](_0x34829c)){return _[_0xf2b4('0xc6')](_0x3a548e,_[_0xf2b4('0x4d')](_0x34829c,function(_0x54cb60){return util[_0xf2b4('0xc7')](_0xf2b4('0xc8'),_0x54cb60['id']);}));}})[_0xf2b4('0x19')](handleEntityNotFound(_0x14f7c5,null))['then'](respondWithResult(_0x14f7c5,null))[_0xf2b4('0x8b')](handleError(_0x14f7c5,null));};exports[_0xf2b4('0xa2')]=function(_0x27ed43,_0x105e8e){var _0x5dd86f;if(_0x27ed43[_0xf2b4('0x94')]['id']){delete _0x27ed43['body']['id'];}if(!_[_0xf2b4('0x59')](_0x27ed43[_0xf2b4('0x94')][_0xf2b4('0xb6')])){var _0x31db50=_0x27ed43[_0xf2b4('0x94')][_0xf2b4('0xb6')];if(!_['isNil'](shared['timezones'][_0x31db50]))_0x27ed43['body'][_0xf2b4('0xb8')]=shared[_0xf2b4('0xb7')][_0x31db50][_0xf2b4('0xb8')];}return db[_0xf2b4('0x22')][_0xf2b4('0x8c')]({'where':{'id':_0x27ed43[_0xf2b4('0xc1')]['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0x105e8e,null))[_0xf2b4('0x19')](saveUpdates(_0x27ed43['body'],null))[_0xf2b4('0x19')](function(_0x5eeac3){_0x5dd86f=_0x5eeac3;var _0x46e4ed={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5eeac3&&_0x5eeac3[_0xf2b4('0x5c')]){if(_0x5eeac3['ListId']){_0x46e4ed['where']['$and'][_0xf2b4('0x26')]({'ListId':{'$ne':_0x5eeac3[_0xf2b4('0x5c')]}});}}return db[_0xf2b4('0x27')]['findAll'](_0x46e4ed);})[_0xf2b4('0x19')](function(_0x2e590e){if(_0x2e590e){return _['omit'](_[_0xf2b4('0xc9')](_0x27ed43[_0xf2b4('0x94')],function(_0x4d5c28,_0x444a6f){return _[_0xf2b4('0x25')](_0x444a6f,'cf_');}),_[_0xf2b4('0x4d')](_0x2e590e,function(_0x122719){return util[_0xf2b4('0xc7')](_0xf2b4('0xc8'),_0x122719['id']);}));}})['then'](function(_0x37f3e0){if(_0x37f3e0&&!_[_0xf2b4('0x5b')](_0x37f3e0)){var _0x5b7cf7=squel['update']()[_0xf2b4('0xca')](_0xf2b4('0x3e'))['setFields'](_0x37f3e0)[_0xf2b4('0x5d')](_0xf2b4('0xcb'),_0x27ed43['params']['id'])[_0xf2b4('0xcc')]();return db[_0xf2b4('0x7f')][_0xf2b4('0x2f')](_0x5b7cf7['text'],{'replacements':_0x5b7cf7[_0xf2b4('0x92')]});}})[_0xf2b4('0x19')](function(){if(_0x27ed43[_0xf2b4('0x94')]['phone']&&_0x5dd86f){return db[_0xf2b4('0x9b')][_0xf2b4('0xa2')]({'phone':_0x27ed43[_0xf2b4('0x94')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5dd86f['id']}});}})['then'](function(){return _0x5dd86f;})[_0xf2b4('0x19')](respondWithResult(_0x105e8e,null))['catch'](handleError(_0x105e8e,null));};exports['getTags']=function(_0x37b699,_0x5eb2a6){var _0x24cfe0={};var _0x4dd0c4={};var _0x4ce468;var _0x445de4;return db[_0xf2b4('0x22')][_0xf2b4('0x28')]({'where':{'id':_0x37b699['params']['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0x5eb2a6,null))[_0xf2b4('0x19')](function(_0x588a07){if(_0x588a07){_0x4ce468=_0x588a07;_0x4dd0c4[_0xf2b4('0x2e')]=_[_0xf2b4('0x24')](db[_0xf2b4('0x4a')]['rawAttributes']);_0x4dd0c4[_0xf2b4('0x2f')]=_[_0xf2b4('0x24')](_0x37b699[_0xf2b4('0x2f')]);_0x4dd0c4[_0xf2b4('0x37')]=_['intersection'](_0x4dd0c4[_0xf2b4('0x2e')],_0x4dd0c4[_0xf2b4('0x2f')]);_0x24cfe0[_0xf2b4('0x30')]=_['intersection'](_0x4dd0c4[_0xf2b4('0x2e')],qs[_0xf2b4('0x32')](_0x37b699[_0xf2b4('0x2f')]['fields']));_0x24cfe0[_0xf2b4('0x30')]=_0x24cfe0[_0xf2b4('0x30')][_0xf2b4('0x2c')]?_0x24cfe0[_0xf2b4('0x30')]:_0x4dd0c4[_0xf2b4('0x2e')];_0x24cfe0[_0xf2b4('0x35')]=qs[_0xf2b4('0x36')](_0x37b699[_0xf2b4('0x2f')][_0xf2b4('0x36')]);_0x24cfe0[_0xf2b4('0x5d')]=qs[_0xf2b4('0x37')](_['pick'](_0x37b699[_0xf2b4('0x2f')],_0x4dd0c4[_0xf2b4('0x37')]));if(_0x37b699[_0xf2b4('0x2f')][_0xf2b4('0x63')]){_0x24cfe0[_0xf2b4('0x5d')]=_['merge'](_0x24cfe0[_0xf2b4('0x5d')],{'$or':_[_0xf2b4('0x4d')](_0x24cfe0['attributes'],function(_0x5cf6da){var _0x487b0c={};_0x487b0c[_0x5cf6da]={'$like':'%'+_0x37b699[_0xf2b4('0x2f')]['filter']+'%'};return _0x487b0c;})});}_0x24cfe0=_[_0xf2b4('0x93')]({},_0x24cfe0,_0x37b699[_0xf2b4('0xcd')]);return _0x4ce468[_0xf2b4('0xce')](_0x24cfe0);}})['then'](function(_0x240b9e){if(_0x240b9e){_0x445de4=_0x240b9e['length'];if(!_0x37b699[_0xf2b4('0x2f')]['hasOwnProperty'](_0xf2b4('0x34'))){_0x24cfe0[_0xf2b4('0x15')]=qs['limit'](_0x37b699['query'][_0xf2b4('0x15')]);_0x24cfe0[_0xf2b4('0x13')]=qs[_0xf2b4('0x13')](_0x37b699['query'][_0xf2b4('0x13')]);}return _0x4ce468[_0xf2b4('0xce')](_0x24cfe0);}})[_0xf2b4('0x19')](function(_0x37e763){if(_0x37e763){return _0x37e763?{'count':_0x445de4,'rows':_0x37e763}:null;}})[_0xf2b4('0x19')](respondWithResult(_0x5eb2a6,null))[_0xf2b4('0x8b')](handleError(_0x5eb2a6,null));};exports[_0xf2b4('0xcf')]=function(_0x3b7155,_0xd479ea){if(_0x3b7155['body']['id']){delete _0x3b7155['body']['id'];}return db[_0xf2b4('0x22')][_0xf2b4('0x28')]({'where':{'id':_0x3b7155[_0xf2b4('0xc1')]['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0xd479ea,null))['then'](function(_0x23a350){if(_0x23a350){return _0x23a350[_0xf2b4('0xcf')](_0x3b7155[_0xf2b4('0x94')]['ids']||[]);}return null;})[_0xf2b4('0x19')](respondWithResult(_0xd479ea,null))[_0xf2b4('0x8b')](handleError(_0xd479ea,null));};exports[_0xf2b4('0xd0')]=function(_0x95f650,_0x7b7fb){var _0x349240=[];_0x349240[_0xf2b4('0x26')](addAdditionalPhones(_0x95f650['body']));Promise[_0xf2b4('0x2b')](_0x349240)[_0xf2b4('0x19')](function(){_0x349240=[];_0x349240[_0xf2b4('0x26')](deleteCmHopperPhones(_0x95f650['body']['id']));_0x349240['push'](addCmHopperPhones(_0x95f650[_0xf2b4('0x94')]['id']));Promise['all'](_0x349240)['then'](function(){return[0x1];})[_0xf2b4('0x19')](respondWithResult(_0x7b7fb,null));});};function addAdditionalPhones(_0x41a575){var _0x2c3cf7;return new Promise(function(_0x3efe3d,_0x1480b5){return db[_0xf2b4('0xaa')][_0xf2b4('0x1a')]({'where':{'CmContactId':_0x41a575['id']}})['then'](function(){db[_0xf2b4('0xd1')][_0xf2b4('0x95')]({'raw':!![],'attributes':['id',_0xf2b4('0xd2')]})['then'](function(_0x2c1273){var _0x2496e1=[];for(var _0x389cdd=0x0;_0x389cdd<_0x41a575[_0xf2b4('0xd3')]['length'];_0x389cdd++){var _0x4592a7=_0x41a575['item_types']?_[_0xf2b4('0x59')](_0x41a575[_0xf2b4('0xd4')][_0x389cdd])?'':_0x41a575[_0xf2b4('0xd4')][_0x389cdd]:_0x41a575['items'][_0x389cdd]['ItemTypeId']?_0x41a575[_0xf2b4('0xd3')][_0x389cdd][_0xf2b4('0xd5')]:'';var _0x3bf621=_['isNil'](_0x41a575[_0xf2b4('0xd3')][_0x389cdd][_0xf2b4('0xd6')])?'':_0x41a575[_0xf2b4('0xd3')][_0x389cdd]['description'];var _0x16a68e=_0x4592a7+':'+_0x41a575['items'][_0x389cdd][_0xf2b4('0xd7')]+'§'+_0x3bf621;if(_['isNil'](_0x2c3cf7))_0x2c3cf7=_0x16a68e;else _0x2c3cf7+=';'+_0x16a68e;var _0x302ce8=null;if(_0x41a575[_0xf2b4('0xd4')]){if(!_[_0xf2b4('0x59')](_0x41a575['item_types'][_0x389cdd])){var _0x8e86d4=_[_0xf2b4('0x8c')](_0x2c1273,function(_0x3fb3ee){return _0x3fb3ee['id']===_0x41a575[_0xf2b4('0xd4')][_0x389cdd];});if(!_[_0xf2b4('0x59')](_0x8e86d4)){_0x302ce8=_0x8e86d4[_0xf2b4('0xd2')];}}}else{if(!_[_0xf2b4('0x59')](_0x41a575['items'][_0x389cdd])){var _0x8e86d4=_[_0xf2b4('0x8c')](_0x2c1273,function(_0x1a8ff9){return _0x1a8ff9['id']===_0x41a575[_0xf2b4('0xd3')][_0x389cdd][_0xf2b4('0xd5')];});if(!_[_0xf2b4('0x59')](_0x8e86d4)){_0x302ce8=_0x389cdd;}}}if(_['isNil'](_0x302ce8)){_0x302ce8=0x64;}_0x2496e1['push'](addAdditionalPhone(_0x41a575['id'],_0x41a575['items'][_0x389cdd][_0xf2b4('0xd7')],_0x41a575['item_types']?_[_0xf2b4('0x59')](_0x41a575['item_types'][_0x389cdd])?null:_0x41a575[_0xf2b4('0xd4')][_0x389cdd]:_0x41a575[_0xf2b4('0xd3')][_0x389cdd][_0xf2b4('0xd5')]?_0x41a575['items'][_0x389cdd][_0xf2b4('0xd5')]:null,_0x302ce8,_0x3bf621));}Promise['all'](_0x2496e1)['then'](function(){db[_0xf2b4('0x22')][_0xf2b4('0xa2')]({'AdditionalPhones':_0x2c3cf7},{'where':{'id':_0x41a575['id']}})[_0xf2b4('0x19')](function(){_0x3efe3d(0x1);});});});});});}function addAdditionalPhone(_0x591e84,_0x10d1de,_0x5b2356,_0x341758,_0x2baa4f){return db[_0xf2b4('0xaa')][_0xf2b4('0x8c')]({'where':{'CmContactId':_0x591e84,'item':_0x10d1de}})[_0xf2b4('0x19')](function(_0x51f348){if(_0x51f348)logger[_0xf2b4('0x9c')]('contact\x20phone\x20exists',_0x51f348);else{db[_0xf2b4('0xaa')]['create']({'CmContactId':_0x591e84,'item':_0x10d1de,'ItemTypeId':_0x5b2356,'OrderBy':_0x341758,'ItemClass':_0xf2b4('0xd8'),'description':_0x2baa4f});}});}function deletePhones(_0x2d1b75){return db[_0xf2b4('0xaa')][_0xf2b4('0x1a')]({'where':{'CmContactId':_0x2d1b75}});}function deleteCmHopperPhones(_0x574db1){return new Promise(function(_0x487f23,_0x34449a){return db[_0xf2b4('0x9b')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x574db1}})[_0xf2b4('0x19')](function(_0x104dda){db['CmHopperAdditionalPhone'][_0xf2b4('0x1a')]({'where':{'CmHopperId':{'$in':_[_0xf2b4('0x4d')](_0x104dda,'id')}}});})[_0xf2b4('0x19')](function(){_0x487f23(0x1);});});}function addCmHopperPhones(_0x97ec01){return new Promise(function(_0x48f24a,_0x2aef41){return db[_0xf2b4('0x9b')][_0xf2b4('0x95')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x97ec01}})[_0xf2b4('0x19')](function(_0x5dd91f){var _0x2ce310=[];_['map'](_0x5dd91f,function(_0x476f67){_0x2ce310['push'](createCmHopperPhone(_0x97ec01,_0x476f67['id']));});Promise[_0xf2b4('0x2b')](_0x2ce310)['then'](function(){_0x48f24a(0x1);});});});}function createCmHopperPhone(_0x215137,_0x23e0ef){return new Promise(function(_0xa692cc,_0x2a2e07){db[_0xf2b4('0xaa')]['findAll']({'raw':!![],'attributes':[_0xf2b4('0xd9'),'OrderBy'],'where':{'CmContactId':_0x215137,'ItemClass':'PHONE'},'include':[{'model':db[_0xf2b4('0xd1')],'attributes':[_0xf2b4('0xd2')],'as':'ItemType'}],'order':[_0xf2b4('0xd2'),db['sequelize'][_0xf2b4('0xc4')](_0xf2b4('0xda'))]})[_0xf2b4('0x19')](function(_0x1571eb){var _0x5386cd=0x1;var _0x36b020=_['map'](_0x1571eb,function(_0x4a7c3e){_0x4a7c3e[_0xf2b4('0xdb')]=_0x23e0ef;_0x4a7c3e[_0xf2b4('0xd7')]=_0x4a7c3e[_0xf2b4('0xd9')];_0x4a7c3e[_0xf2b4('0xd2')]=_0x5386cd;delete _0x4a7c3e[_0xf2b4('0xdc')];_0x5386cd=_0x5386cd+0x1;return _0x4a7c3e;});return db[_0xf2b4('0xdd')][_0xf2b4('0xba')](_0x36b020,{});})['then'](function(){_0xa692cc(0x1);});});}function insertAdditionalPhones(_0x2e4c48,_0x3f5d7b){return new Promise(function(_0x2f9006,_0x2ff4a7){var _0x4a8313=[];for(var _0x30505a=0x0;_0x30505a<_0x3f5d7b[_0xf2b4('0x2c')];_0x30505a++){var _0x2e2514=_0x3f5d7b[_0x30505a];_0x4a8313[_0xf2b4('0x26')](parseContactItemType(_0x2e2514));}Promise['all'](_0x4a8313)['then'](function(){var _0x146fa3={'id':_0x2e4c48['id'],'items':_0x3f5d7b};return addAdditionalPhones(_0x146fa3)[_0xf2b4('0x19')](function(_0x50a91b){return addCmHopperPhones(_0x2e4c48['id']);});})[_0xf2b4('0x19')](function(){_0x2f9006(_0x2e4c48);});});}function parseContactItemType(_0x4c6dcd){return new Promise(function(_0x312e35,_0x14971b){if(_0x4c6dcd[_0xf2b4('0x33')]('ItemTypeId')){_0x312e35(_0x4c6dcd);}else{return db[_0xf2b4('0xd1')][_0xf2b4('0x8c')]({'where':{'name':_0x4c6dcd[_0xf2b4('0xc3')]}})[_0xf2b4('0x19')](function(_0x11f2a3){if(_[_0xf2b4('0x59')](_0x11f2a3))_0x4c6dcd[_0xf2b4('0xd5')]=null;else _0x4c6dcd[_0xf2b4('0xd5')]=_0x11f2a3['id'];_0x312e35(_0x4c6dcd);});}});}exports[_0xf2b4('0xde')]=function(_0x4f1e5e,_0x23c72b){return db[_0xf2b4('0xaa')]['findAll']({'raw':!![],'where':{'CmContactId':_0x4f1e5e[_0xf2b4('0xc1')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xf2b4('0xd1')],'as':_0xf2b4('0xc3')}],'order':[[db[_0xf2b4('0x7f')][_0xf2b4('0xc4')](_0xf2b4('0xda'))],[_0xf2b4('0xd2')]]})[_0xf2b4('0x19')](function(_0x5986e7){return _0x5986e7;})['then'](respondWithResult(_0x23c72b,null))[_0xf2b4('0x8b')](handleError(_0x23c72b,null));};exports[_0xf2b4('0xdf')]=function(_0xcfcf73,_0x47e8a3){return db[_0xf2b4('0xaa')]['findAll']({'raw':!![],'where':{'CmContactId':_0xcfcf73['body']['fromContactId']}})[_0xf2b4('0x19')](function(_0x1a7723){var _0x3d0273=_['map'](_0x1a7723,function(_0x37fade){_0x37fade[_0xf2b4('0xe0')]=_0xcfcf73[_0xf2b4('0x94')]['toContactId'];return _0x37fade;});return db[_0xf2b4('0xaa')][_0xf2b4('0xba')](_0x3d0273,{});})['then'](function(_0x2193fa){return addCmHopperPhones(_0xcfcf73[_0xf2b4('0x94')]['toContactId']);})[_0xf2b4('0x19')](function(_0x21b218){return['ok'];})[_0xf2b4('0x19')](respondWithResult(_0x47e8a3,null))[_0xf2b4('0x8b')](handleError(_0x47e8a3,null));};exports[_0xf2b4('0xe1')]=function(_0x5a9c87,_0x1183bb){var _0x2b003a=[];_0x2b003a[_0xf2b4('0x26')](createCmHopperPhone(_0x5a9c87[_0xf2b4('0x94')]['id'],_0x5a9c87[_0xf2b4('0x94')][_0xf2b4('0xe2')]));Promise[_0xf2b4('0x2b')](_0x2b003a)[_0xf2b4('0x19')](function(){return[0x1];})[_0xf2b4('0x19')](respondWithResult(_0x1183bb,null));};exports[_0xf2b4('0xe3')]=function(_0x1e8aac,_0x49582d){var _0x5decd4={'raw':![],'where':{}};var _0x21ab99={};var _0x5ce55c={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1e8aac[_0xf2b4('0xc1')]['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0x49582d,null))[_0xf2b4('0x19')](function(_0x199ef3){if(_0x199ef3){_0x21ab99[_0xf2b4('0x2e')]=_[_0xf2b4('0x24')](db[_0xf2b4('0x9b')]['rawAttributes']);_0x21ab99['query']=_[_0xf2b4('0x24')](_0x1e8aac[_0xf2b4('0x2f')]);_0x21ab99['filters']=_[_0xf2b4('0x31')](_0x21ab99[_0xf2b4('0x2e')],_0x21ab99[_0xf2b4('0x2f')]);_0x5decd4[_0xf2b4('0x30')]=_[_0xf2b4('0x31')](_0x21ab99[_0xf2b4('0x2e')],qs[_0xf2b4('0x32')](_0x1e8aac['query']['fields']));_0x5decd4[_0xf2b4('0x30')]=_0x5decd4['attributes'][_0xf2b4('0x2c')]?_0x5decd4[_0xf2b4('0x30')]:_0x21ab99[_0xf2b4('0x2e')];if(!_0x1e8aac[_0xf2b4('0x2f')][_0xf2b4('0x33')]('nolimit')){_0x5decd4[_0xf2b4('0x15')]=qs[_0xf2b4('0x15')](_0x1e8aac[_0xf2b4('0x2f')]['limit']);_0x5decd4[_0xf2b4('0x13')]=qs['offset'](_0x1e8aac['query'][_0xf2b4('0x13')]);}_0x5decd4[_0xf2b4('0x35')]=qs[_0xf2b4('0x36')](_0x1e8aac[_0xf2b4('0x2f')][_0xf2b4('0x36')]);_0x5decd4['where']=qs[_0xf2b4('0x37')](_[_0xf2b4('0x38')](_0x1e8aac[_0xf2b4('0x2f')],_0x21ab99['filters']));_0x5decd4[_0xf2b4('0x5d')][_0xf2b4('0xe4')]=_0x199ef3['id'];if(_0x1e8aac[_0xf2b4('0x2f')][_0xf2b4('0x63')]){_0x5decd4[_0xf2b4('0x5d')]=_['merge'](_0x5decd4[_0xf2b4('0x5d')],{'$or':_[_0xf2b4('0x4d')](_0x5decd4[_0xf2b4('0x30')],function(_0x3aaacd){var _0x563dcb={};_0x563dcb[_0x3aaacd]={'$like':'%'+_0x1e8aac[_0xf2b4('0x2f')][_0xf2b4('0x63')]+'%'};return _0x563dcb;})});}_0x5decd4=_[_0xf2b4('0x93')]({},_0x5decd4,_0x1e8aac[_0xf2b4('0xcd')]);return db[_0xf2b4('0x9b')][_0xf2b4('0x16')]({'where':_0x5decd4['where']})[_0xf2b4('0x19')](function(_0x39e04f){_0x5ce55c[_0xf2b4('0x16')]=_0x39e04f;if(_0x1e8aac['query'][_0xf2b4('0xe5')]){_0x5decd4[_0xf2b4('0xe6')]=[{'all':!![]}];}return db[_0xf2b4('0x9b')][_0xf2b4('0x95')](_0x5decd4);})[_0xf2b4('0x19')](function(_0xe8c9b){_0x5ce55c[_0xf2b4('0x8a')]=_0xe8c9b;return _0x5ce55c;});}})[_0xf2b4('0x19')](respondWithFilteredResult(_0x49582d,_0x5decd4))[_0xf2b4('0x8b')](handleError(_0x49582d,null));};exports[_0xf2b4('0xe7')]=function(_0x41c04a,_0x2238be){var _0x390c75={'raw':!![],'where':{}};var _0x4d308e={};var _0x4dad9c={'count':0x0,'rows':[]};return db[_0xf2b4('0x22')][_0xf2b4('0x28')]({'where':{'id':_0x41c04a[_0xf2b4('0xc1')]['id']}})['then'](handleEntityNotFound(_0x2238be,null))[_0xf2b4('0x19')](function(_0x39f5cc){if(_0x39f5cc){_0x4d308e[_0xf2b4('0x2e')]=_[_0xf2b4('0x24')](db[_0xf2b4('0xac')]['rawAttributes']);_0x4d308e[_0xf2b4('0x2f')]=_[_0xf2b4('0x24')](_0x41c04a['query']);_0x4d308e[_0xf2b4('0x37')]=_[_0xf2b4('0x31')](_0x4d308e[_0xf2b4('0x2e')],_0x4d308e['query']);_0x390c75[_0xf2b4('0x30')]=_[_0xf2b4('0x31')](_0x4d308e[_0xf2b4('0x2e')],qs['fields'](_0x41c04a['query'][_0xf2b4('0x32')]));_0x390c75[_0xf2b4('0x30')]=_0x390c75[_0xf2b4('0x30')][_0xf2b4('0x2c')]?_0x390c75[_0xf2b4('0x30')]:_0x4d308e[_0xf2b4('0x2e')];if(!_0x41c04a[_0xf2b4('0x2f')]['hasOwnProperty'](_0xf2b4('0x34'))){_0x390c75[_0xf2b4('0x15')]=qs[_0xf2b4('0x15')](_0x41c04a[_0xf2b4('0x2f')][_0xf2b4('0x15')]);_0x390c75['offset']=qs['offset'](_0x41c04a[_0xf2b4('0x2f')][_0xf2b4('0x13')]);}_0x390c75[_0xf2b4('0x35')]=qs[_0xf2b4('0x36')](_0x41c04a['query'][_0xf2b4('0x36')]);_0x390c75['where']=qs[_0xf2b4('0x37')](_[_0xf2b4('0x38')](_0x41c04a[_0xf2b4('0x2f')],_0x4d308e[_0xf2b4('0x37')]));_0x390c75[_0xf2b4('0x5d')][_0xf2b4('0xe4')]=_0x39f5cc['id'];if(_0x41c04a['query'][_0xf2b4('0x63')]){_0x390c75[_0xf2b4('0x5d')]=_[_0xf2b4('0x93')](_0x390c75['where'],{'$or':_[_0xf2b4('0x4d')](_0x390c75[_0xf2b4('0x30')],function(_0x5f1957){var _0x430553={};_0x430553[_0x5f1957]={'$like':'%'+_0x41c04a[_0xf2b4('0x2f')][_0xf2b4('0x63')]+'%'};return _0x430553;})});}_0x390c75=_[_0xf2b4('0x93')]({},_0x390c75,_0x41c04a[_0xf2b4('0xcd')]);return db[_0xf2b4('0xac')][_0xf2b4('0x16')]({'where':_0x390c75[_0xf2b4('0x5d')]})[_0xf2b4('0x19')](function(_0x24850b){_0x4dad9c[_0xf2b4('0x16')]=_0x24850b;if(_0x41c04a[_0xf2b4('0x2f')]['includeAll']){_0x390c75[_0xf2b4('0xe6')]=[{'all':!![]}];}return db[_0xf2b4('0xac')][_0xf2b4('0x95')](_0x390c75);})[_0xf2b4('0x19')](function(_0x4056c9){_0x4dad9c[_0xf2b4('0x8a')]=_0x4056c9;return _0x4dad9c;});}})[_0xf2b4('0x19')](respondWithFilteredResult(_0x2238be,_0x390c75))[_0xf2b4('0x8b')](handleError(_0x2238be,null));};exports[_0xf2b4('0xe8')]=function(_0x37b76a,_0x21fede){var _0x235cc0={'raw':!![],'where':{}};var _0x59a762={};var _0x67b9e7={'count':0x0,'rows':[]};return db[_0xf2b4('0x22')][_0xf2b4('0x28')]({'where':{'id':_0x37b76a[_0xf2b4('0xc1')]['id']}})['then'](handleEntityNotFound(_0x21fede,null))[_0xf2b4('0x19')](function(_0x129544){if(_0x129544){_0x59a762['model']=_[_0xf2b4('0x24')](db[_0xf2b4('0xab')][_0xf2b4('0xe9')]);_0x59a762['query']=_[_0xf2b4('0x24')](_0x37b76a[_0xf2b4('0x2f')]);_0x59a762[_0xf2b4('0x37')]=_[_0xf2b4('0x31')](_0x59a762['model'],_0x59a762[_0xf2b4('0x2f')]);_0x235cc0[_0xf2b4('0x30')]=_[_0xf2b4('0x31')](_0x59a762[_0xf2b4('0x2e')],qs['fields'](_0x37b76a['query'][_0xf2b4('0x32')]));_0x235cc0[_0xf2b4('0x30')]=_0x235cc0[_0xf2b4('0x30')][_0xf2b4('0x2c')]?_0x235cc0[_0xf2b4('0x30')]:_0x59a762['model'];if(!_0x37b76a[_0xf2b4('0x2f')]['hasOwnProperty'](_0xf2b4('0x34'))){_0x235cc0['limit']=qs[_0xf2b4('0x15')](_0x37b76a['query'][_0xf2b4('0x15')]);_0x235cc0['offset']=qs[_0xf2b4('0x13')](_0x37b76a[_0xf2b4('0x2f')][_0xf2b4('0x13')]);}_0x235cc0[_0xf2b4('0x35')]=qs[_0xf2b4('0x36')](_0x37b76a[_0xf2b4('0x2f')][_0xf2b4('0x36')]);_0x235cc0['where']=qs[_0xf2b4('0x37')](_['pick'](_0x37b76a[_0xf2b4('0x2f')],_0x59a762[_0xf2b4('0x37')]));_0x235cc0[_0xf2b4('0x5d')][_0xf2b4('0xe4')]=_0x129544['id'];if(_0x37b76a[_0xf2b4('0x2f')][_0xf2b4('0x63')]){_0x235cc0[_0xf2b4('0x5d')]=_[_0xf2b4('0x93')](_0x235cc0[_0xf2b4('0x5d')],{'$or':_[_0xf2b4('0x4d')](_0x235cc0[_0xf2b4('0x30')],function(_0x1267c0){var _0x1391d4={};_0x1391d4[_0x1267c0]={'$like':'%'+_0x37b76a['query'][_0xf2b4('0x63')]+'%'};return _0x1391d4;})});}_0x235cc0=_[_0xf2b4('0x93')]({},_0x235cc0,_0x37b76a[_0xf2b4('0xcd')]);return db[_0xf2b4('0xab')][_0xf2b4('0x16')]({'where':_0x235cc0[_0xf2b4('0x5d')]})[_0xf2b4('0x19')](function(_0x2d3cec){_0x67b9e7['count']=_0x2d3cec;if(_0x37b76a[_0xf2b4('0x2f')][_0xf2b4('0xe5')]){_0x235cc0[_0xf2b4('0xe6')]=[{'all':!![]}];}return db[_0xf2b4('0xab')][_0xf2b4('0x95')](_0x235cc0);})[_0xf2b4('0x19')](function(_0x1bb786){_0x67b9e7['rows']=_0x1bb786;return _0x67b9e7;});}})[_0xf2b4('0x19')](respondWithFilteredResult(_0x21fede,_0x235cc0))['catch'](handleError(_0x21fede,null));};exports[_0xf2b4('0xea')]=function(_0x41264d,_0x3635bf){var _0x1426c3={'raw':!![],'where':{}};var _0x2e9332={};var _0x1d23d6={'count':0x0,'rows':[]};return db[_0xf2b4('0x22')][_0xf2b4('0x28')]({'where':{'id':_0x41264d[_0xf2b4('0xc1')]['id']}})[_0xf2b4('0x19')](handleEntityNotFound(_0x3635bf,null))['then'](function(_0x50491b){if(_0x50491b){_0x2e9332[_0xf2b4('0x2e')]=_[_0xf2b4('0x24')](db[_0xf2b4('0xb3')][_0xf2b4('0xe9')]);_0x2e9332[_0xf2b4('0x2f')]=_[_0xf2b4('0x24')](_0x41264d[_0xf2b4('0x2f')]);_0x2e9332['filters']=_[_0xf2b4('0x31')](_0x2e9332[_0xf2b4('0x2e')],_0x2e9332[_0xf2b4('0x2f')]);_0x1426c3[_0xf2b4('0x30')]=_[_0xf2b4('0x31')](_0x2e9332[_0xf2b4('0x2e')],qs['fields'](_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x32')]));_0x1426c3[_0xf2b4('0x30')]=_0x1426c3[_0xf2b4('0x30')][_0xf2b4('0x2c')]?_0x1426c3['attributes']:_0x2e9332['model'];if(!_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x33')](_0xf2b4('0x34'))){_0x1426c3[_0xf2b4('0x15')]=qs[_0xf2b4('0x15')](_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x15')]);_0x1426c3[_0xf2b4('0x13')]=qs[_0xf2b4('0x13')](_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x13')]);}_0x1426c3[_0xf2b4('0x35')]=qs[_0xf2b4('0x36')](_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x36')]);_0x1426c3[_0xf2b4('0x5d')]=qs['filters'](_[_0xf2b4('0x38')](_0x41264d['query'],_0x2e9332[_0xf2b4('0x37')]));_0x1426c3[_0xf2b4('0x5d')][_0xf2b4('0xe4')]=_0x50491b['id'];if(_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0x63')]){_0x1426c3[_0xf2b4('0x5d')]=_[_0xf2b4('0x93')](_0x1426c3[_0xf2b4('0x5d')],{'$or':_[_0xf2b4('0x4d')](_0x1426c3['attributes'],function(_0x73d6d7){var _0x3addf4={};_0x3addf4[_0x73d6d7]={'$like':'%'+_0x41264d['query']['filter']+'%'};return _0x3addf4;})});}_0x1426c3=_[_0xf2b4('0x93')]({},_0x1426c3,_0x41264d[_0xf2b4('0xcd')]);return db['JscriptySessionReport']['count']({'where':_0x1426c3[_0xf2b4('0x5d')]})[_0xf2b4('0x19')](function(_0xc5fc5d){_0x1d23d6[_0xf2b4('0x16')]=_0xc5fc5d;if(_0x41264d[_0xf2b4('0x2f')][_0xf2b4('0xe5')]){_0x1426c3['include']=[{'all':!![]}];}return db[_0xf2b4('0xb3')]['findAll'](_0x1426c3);})[_0xf2b4('0x19')](function(_0xa004de){_0x1d23d6[_0xf2b4('0x8a')]=_0xa004de;return _0x1d23d6;});}})['then'](respondWithFilteredResult(_0x3635bf,_0x1426c3))[_0xf2b4('0x8b')](handleError(_0x3635bf,null));};exports['uploadCsv']=function(_0x4d1535,_0x35a84d){try{if(!_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0x5c')]){throw new Error(_0xf2b4('0xeb'));}if(!_0x4d1535[_0xf2b4('0x94')]['binding_keys']){throw new Error(_0xf2b4('0xec'));}if(!_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xed')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xee')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x51f916=_0x4d1535['body'][_0xf2b4('0xef')][_0xf2b4('0x4c')](',');var _0x497e02=_0x4d1535[_0xf2b4('0x94')]['binding_values'][_0xf2b4('0x4c')](',');if(!_0x51f916[_0xf2b4('0x2c')]||!_0x497e02[_0xf2b4('0x2c')]||_0x51f916['length']!==_0x497e02[_0xf2b4('0x2c')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0x32')]=_[_0xf2b4('0xf0')](_0x51f916,_0x497e02);if(!_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0x32')][_0xf2b4('0xd7')]){throw new Error(_0xf2b4('0xf1'));}if(!_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0x32')][_0xf2b4('0xf2')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x5b800d=path[_0xf2b4('0x99')](config[_0xf2b4('0xf3')],_0xf2b4('0xf4'),_0x4d1535[_0xf2b4('0xf5')]['filename']);fs['chmodSync'](_0x5b800d,parseInt(_0xf2b4('0xf6'),0x8));var _0x5e4bf2=require(_0xf2b4('0xf7'))['fork'](path[_0xf2b4('0x99')](__dirname,'../../components/import/cm/csv'),[_0x5b800d,_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xef')],_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xed')],_0x4d1535['body'][_0xf2b4('0x5c')],_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xf8')],_0x4d1535['body'][_0xf2b4('0xbc')],_0x4d1535[_0xf2b4('0x94')][_0xf2b4('0xee')]]);return _0x35a84d[_0xf2b4('0x11')](0xc8)[_0xf2b4('0x12')]({'message':_0xf2b4('0xf9'),'pid':_0x5e4bf2[_0xf2b4('0xfa')]});}catch(_0xbdce70){return _0x35a84d['status'](0x1f4)['send'](_0xbdce70);}};exports[_0xf2b4('0xfb')]=function(_0x57a6ad,_0xd28559){var _0x43004f=fs[_0xf2b4('0xfc')](_0x57a6ad[_0xf2b4('0xf5')][_0xf2b4('0x1')]);Papa[_0xf2b4('0xfd')](_0x43004f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x350c19){return _0xd28559['status'](0xc8)['json']({'file':_0x57a6ad[_0xf2b4('0xf5')],'fields':_0x350c19[_0xf2b4('0xfe')][_0xf2b4('0x32')]});}});};exports['import']=function(_0x53d3c3,_0x2b2bf2){return db[_0xf2b4('0x50')][_0xf2b4('0x95')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf2b4('0x7a')}})[_0xf2b4('0x19')](function(_0x21d716){var _0x125e0f=![];if(!_0x53d3c3[_0xf2b4('0x94')][_0xf2b4('0x5c')]){throw new Error(_0xf2b4('0xeb'));}if(!_0x53d3c3[_0xf2b4('0x94')][_0xf2b4('0xff')][_0xf2b4('0xd7')]){throw new Error(_0xf2b4('0xf1'));}if(!_0x53d3c3[_0xf2b4('0x94')][_0xf2b4('0xff')][_0xf2b4('0xf2')]){throw new Error(_0xf2b4('0x100'));}if(!_0x53d3c3[_0xf2b4('0x94')][_0xf2b4('0xee')]){throw new Error(_0xf2b4('0x101'));}var _0x29160e=require('child_process')['fork'](path[_0xf2b4('0x99')](__dirname,_0xf2b4('0x102')),[_0x53d3c3[_0xf2b4('0xc1')]['id'],JSON[_0xf2b4('0x103')](_0x53d3c3[_0xf2b4('0x94')]),JSON[_0xf2b4('0x103')](_0x21d716)]);_0x29160e['on'](_0xf2b4('0x104'),function(){_0x125e0f=!![];return _0x2b2bf2['status'](0xc8)[_0xf2b4('0x12')]({'message':_0xf2b4('0x105'),'pid':_0x29160e[_0xf2b4('0xfa')]});});_0x29160e['on'](_0xf2b4('0x106'),function(_0x1af925){if(_0x1af925&&!_0x125e0f){return _0x2b2bf2[_0xf2b4('0x11')](0x1f4)[_0xf2b4('0x12')]({'message':'error\x20child\x20process','pid':_0x29160e[_0xf2b4('0xfa')]});}});})[_0xf2b4('0x8b')](handleError(_0x2b2bf2,null));};exports[_0xf2b4('0x107')]=function(_0x510f48,_0x595573,_0xc2f600){return db[_0xf2b4('0x50')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x4df357){var _0x23acb8=![];if(!_0x510f48[_0xf2b4('0x94')][_0xf2b4('0x5c')]){throw new Error(_0xf2b4('0xeb'));}if(!_0x510f48['body'][_0xf2b4('0xff')]['phone']){throw new Error(_0xf2b4('0xf1'));}if(!_0x510f48[_0xf2b4('0x94')][_0xf2b4('0xff')][_0xf2b4('0xf2')]){throw new Error(_0xf2b4('0x100'));}if(!_0x510f48['body'][_0xf2b4('0xee')]){throw new Error(_0xf2b4('0x101'));}var _0x4fc553=require('child_process')[_0xf2b4('0x108')](path[_0xf2b4('0x99')](__dirname,_0xf2b4('0x109')),[_0x510f48[_0xf2b4('0xc1')]['id'],JSON[_0xf2b4('0x103')](_0x510f48['body']),JSON[_0xf2b4('0x103')](_0x4df357)]);_0x4fc553['on'](_0xf2b4('0x104'),function(_0x426e5f){_0x23acb8=!![];return _0x595573[_0xf2b4('0x11')](0xc8)[_0xf2b4('0x12')]({'message':_0xf2b4('0x105'),'pid':_0x4fc553[_0xf2b4('0xfa')]});});_0x4fc553['on'](_0xf2b4('0x106'),function(_0x50a2f9){if(_0x50a2f9&&!_0x23acb8){return _0x595573[_0xf2b4('0x11')](0x1f4)[_0xf2b4('0x12')]({'message':_0xf2b4('0x10a'),'pid':_0x4fc553[_0xf2b4('0xfa')]});}});})[_0xf2b4('0x8b')](handleError(_0x595573,null));};exports['getJourney']=function(_0x18cf00,_0x1b554f){var _0x24e0a2=['mail','chat',_0xf2b4('0x10b'),_0xf2b4('0x10c'),_0xf2b4('0x10d'),_0xf2b4('0x10e'),_0xf2b4('0x10f')];var _0x3fc0af={'offset':0x0,'order':qs[_0xf2b4('0x36')]('-createdAt')},_0x2727d4={'count':0x0,'rows':[]};Promise[_0xf2b4('0x77')]()['then'](function(){if(_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x110')]){if(!_[_0xf2b4('0x111')](_0x24e0a2,_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x110')][_0xf2b4('0x112')]())){throw new Error(_0xf2b4('0x113'));}_0x24e0a2=[_0x18cf00['query'][_0xf2b4('0x110')][_0xf2b4('0x112')]()];}if(_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x114')]){try{var _0x130c38=JSON['parse'](_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x114')]);if(!moment(_0x130c38[_0xf2b4('0x3c')])[_0xf2b4('0x115')]()){throw new Error(_0xf2b4('0x116'));}if(!moment(_0x130c38['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x10f2dc){throw new Error(_0xf2b4('0x117'));}}if(!_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x33')]('nolimit')){_0x3fc0af['limit']=qs[_0xf2b4('0x15')](_0x18cf00[_0xf2b4('0x2f')][_0xf2b4('0x15')]||0xa);_0x3fc0af[_0xf2b4('0x13')]=qs[_0xf2b4('0x13')](_0x18cf00[_0xf2b4('0x2f')]['offset']);}var _0x3546e8=_0x24e0a2[_0xf2b4('0x4d')](function(_0x4c0ac6){if(_0x4c0ac6===_0xf2b4('0x10f')){var _0x5ac35b={'attributes':['id',_0xf2b4('0x118'),_0xf2b4('0x56'),'source',_0xf2b4('0x119'),_0xf2b4('0x11a'),_0xf2b4('0x11b'),'endtime',_0xf2b4('0x11c'),'note','createdAt',_0xf2b4('0x11d'),_0xf2b4('0x11e'),_0xf2b4('0x11f'),'UserId'],'where':{'ContactId':_0x18cf00[_0xf2b4('0xc1')]['id']},'include':[{'model':db[_0xf2b4('0x50')],'as':'User','attributes':['id',_0xf2b4('0x1f'),_0xf2b4('0x120'),'alias']}],'order':[['createdAt',_0xf2b4('0x74')]]};if(_0x18cf00['query'][_0xf2b4('0x114')]){_0x5ac35b[_0xf2b4('0x5d')][_0xf2b4('0x121')]={'$gte':_0x130c38[_0xf2b4('0x3c')],'$lte':_0x130c38['to']};}return db[_0xf2b4('0xae')][_0xf2b4('0x122')](_0x5ac35b)[_0xf2b4('0x19')](function(_0x21a70a){_0x2727d4['count']+=_0x21a70a[_0xf2b4('0x16')];return _[_0xf2b4('0x4d')](_0x21a70a[_0xf2b4('0x8a')],function(_0x170625){var _0x3bfdf0=_0x170625[_0xf2b4('0x96')]({'plain':!![]});_0x3bfdf0[_0xf2b4('0x110')]=_0x4c0ac6;if(_0x3bfdf0[_0xf2b4('0x50')]){_0x3bfdf0[_0xf2b4('0x50')]={'id':_0x3bfdf0[_0xf2b4('0x50')]['id'],'name':_0x3bfdf0[_0xf2b4('0x50')][_0xf2b4('0x1f')],'fullname':_0x3bfdf0[_0xf2b4('0x50')][_0xf2b4('0x120')],'alias':_0x3bfdf0[_0xf2b4('0x50')][_0xf2b4('0x90')]};}return _0x3bfdf0;});});}else{var _0x26fa7d=_[_0xf2b4('0x123')](_0x4c0ac6)+(_0x4c0ac6===_0xf2b4('0x124')?_0xf2b4('0x125'):_0xf2b4('0x126'));var _0x348901={'attributes':['id',_0xf2b4('0x127'),_0xf2b4('0x128'),'createdAt',_0xf2b4('0x129'),'disposition',_0xf2b4('0x12a'),_0xf2b4('0x12b'),'UserId',_0x26fa7d+'Id'],'where':{'ContactId':_0x18cf00[_0xf2b4('0xc1')]['id']},'include':[{'model':db[_0x26fa7d],'as':_0xf2b4('0x126'),'attributes':['id',_0xf2b4('0x1f'),_0xf2b4('0x12c')]},{'model':db[_0xf2b4('0x50')],'as':'Owner','attributes':['id',_0xf2b4('0x1f'),'fullname']},{'model':db['Tag'],'as':_0xf2b4('0x89'),'attributes':['id',_0xf2b4('0x1f'),_0xf2b4('0x3b')],'through':{'attributes':[]}}],'order':[[_0xf2b4('0x121'),_0xf2b4('0x74')]]};if(_0x18cf00['query'][_0xf2b4('0x114')]){_0x348901[_0xf2b4('0x5d')][_0xf2b4('0x121')]={'$gte':_0x130c38[_0xf2b4('0x3c')],'$lte':_0x130c38['to']};}switch(_0x4c0ac6){case _0xf2b4('0x124'):_0x348901[_0xf2b4('0x30')][_0xf2b4('0x26')]('browserName',_0xf2b4('0x12d'),'customerPort',_0xf2b4('0x12e'),_0xf2b4('0x12f'),'ratingMessage',_0xf2b4('0x130'),_0xf2b4('0x131'),'referer');break;case _0xf2b4('0x132'):_0x348901[_0xf2b4('0x30')][_0xf2b4('0x26')](_0xf2b4('0x133'),_0xf2b4('0x134'));break;case'openchannel':_0x348901[_0xf2b4('0x30')][_0xf2b4('0x26')](_0xf2b4('0x135'),_0xf2b4('0x136'));break;}return db[_[_0xf2b4('0x123')](_0x4c0ac6)+_0xf2b4('0x137')][_0xf2b4('0x122')](_0x348901)[_0xf2b4('0x19')](function(_0x4691a2){_0x2727d4['count']+=_0x4691a2[_0xf2b4('0x16')];return _['map'](_0x4691a2[_0xf2b4('0x8a')],function(_0x50a1a3){var _0x1a63b3=_0x50a1a3[_0xf2b4('0x96')]({'plain':!![]});_0x1a63b3[_0xf2b4('0x110')]=_0x4c0ac6;if(_0x1a63b3['Owner']){_0x1a63b3['Owner']={'id':_0x1a63b3[_0xf2b4('0x138')]['id'],'name':_0x1a63b3['Owner']['name'],'fullname':_0x1a63b3[_0xf2b4('0x138')][_0xf2b4('0x120')]};}return _0x1a63b3;});});}});return Promise[_0xf2b4('0x2b')](_0x3546e8);})[_0xf2b4('0x19')](function(_0x4b467d){return _(_0x4b467d)['flatten']()[_0xf2b4('0x139')](_0xf2b4('0x121'))[_0xf2b4('0x13a')]()[_0xf2b4('0x4b')]();})[_0xf2b4('0x19')](function(_0x1897b2){_0x2727d4['rows']=_0x3fc0af[_0xf2b4('0x15')]?_0x1897b2['slice'](_0x3fc0af['offset'],_0x3fc0af['offset']+_0x3fc0af[_0xf2b4('0x15')]):_0x1897b2;return _0x2727d4;})[_0xf2b4('0x19')](respondWithFilteredResult(_0x1b554f,_0x3fc0af))[_0xf2b4('0x8b')](handleError(_0x1b554f,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 8b35dc2..01d3682 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09bf=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09bf,0x1f0));var _0xf09b=function(_0x443285,_0x6e0652){_0x443285=_0x443285-0x0;var _0x22c69f=_0x09bf[_0x443285];return _0x22c69f;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xf09b('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf09b('0x1')](0x0);var events={'afterCreate':_0xf09b('0x2'),'afterUpdate':_0xf09b('0x3'),'afterDestroy':_0xf09b('0x4')};function emitEvent(_0x5650af){return function(_0x1291a,_0x4d5ad8,_0x2ec129){CmContactEvents[_0xf09b('0x5')](_0x5650af+':'+_0x1291a['id'],_0x1291a);CmContactEvents[_0xf09b('0x5')](_0x5650af,_0x1291a);_0x2ec129(null);};}for(var e in events){if(events[_0xf09b('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf09b('0x7')]=CmContactEvents; \ No newline at end of file +var _0xc532=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','CmContact','save','update'];(function(_0x46ee23,_0x52cc5e){var _0x225fc7=function(_0x233971){while(--_0x233971){_0x46ee23['push'](_0x46ee23['shift']());}};_0x225fc7(++_0x52cc5e);}(_0xc532,0xaf));var _0x2c53=function(_0xe6f990,_0xa5f05c){_0xe6f990=_0xe6f990-0x0;var _0x43fe22=_0xc532[_0xe6f990];return _0x43fe22;};'use strict';var EventEmitter=require(_0x2c53('0x0'));var CmContact=require(_0x2c53('0x1'))['db'][_0x2c53('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c53('0x3'),'afterUpdate':_0x2c53('0x4'),'afterDestroy':_0x2c53('0x5')};function emitEvent(_0x200d71){return function(_0x45a0b0,_0x254ae4,_0x581cac){CmContactEvents[_0x2c53('0x6')](_0x200d71+':'+_0x45a0b0['id'],_0x45a0b0);CmContactEvents['emit'](_0x200d71,_0x45a0b0);_0x581cac(null);};}for(var e in events){if(events[_0x2c53('0x7')](e)){var event=events[e];CmContact[_0x2c53('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 10fbbd6..a1329e0 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf007=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Campaign','findAll','message','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','ret'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xf007,0x13d));var _0x7f00=function(_0x5c6951,_0x507abb){_0x5c6951=_0x5c6951-0x0;var _0x5ee145=_0xf007[_0x5c6951];return _0x5ee145;};'use strict';var _=require(_0x7f00('0x0'));var util=require(_0x7f00('0x1'));var logger=require(_0x7f00('0x2'))('api');var moment=require(_0x7f00('0x3'));var BPromise=require(_0x7f00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f00('0x5'));var config=require(_0x7f00('0x6'));var shared=require(_0x7f00('0x7'));var attributes=require(_0x7f00('0x8'));module[_0x7f00('0x9')]=function(_0x3bbb4d,_0x404f0e){return _0x3bbb4d[_0x7f00('0xa')](_0x7f00('0xb'),attributes,{'tableName':_0x7f00('0xc'),'paranoid':!![],'indexes':[{'name':_0x7f00('0xd'),'fields':[_0x7f00('0xd')]},{'name':_0x7f00('0xe'),'fields':[_0x7f00('0xf'),'lastName',_0x7f00('0xd'),'mobile',_0x7f00('0x10'),_0x7f00('0x11')],'type':_0x7f00('0x12')}],'timestamps':!![],'charset':_0x7f00('0x13'),'collate':_0x7f00('0x14'),'hooks':{'afterCreate':function(_0x146fa2,_0x4acc4d,_0x30ae4d){var _0x167673=_0x3bbb4d[_0x7f00('0x15')];var _0x4ccb8b=_0x146fa2[_0x7f00('0x16')]({'plain':!![]});function _0x17ccff(){return function(_0x1c072d){logger[_0x7f00('0x17')](_0x7f00('0x18'),_0x7f00('0x19'),util[_0x7f00('0x1a')](_0x1c072d,{'showHidden':![],'depth':null}));};}function _0x8a35e6(_0x2f5455,_0x1ccfba){var _0x96c15=_0x1ccfba[_0x7f00('0x1b')]?_0x1ccfba['scheduledat']:moment()[_0x7f00('0x1c')](_0x7f00('0x1d'));return new BPromise(function(_0x42014f,_0x28f292){if(_[_0x7f00('0x1e')](_0x1ccfba[_0x7f00('0x1f')])){_0x42014f({'ret':_0x96c15});}else{_0x167673[_0x7f00('0x20')][_0x7f00('0x21')]({'where':{'id':_0x2f5455['id']}})[_0x7f00('0x22')](function(_0x46d640){if(!_[_0x7f00('0x1e')](_0x46d640)){var _0x4d4625=_0x46d640[_0x7f00('0x1f')];if(!_[_0x7f00('0x1e')](_0x4d4625)){var _0x28156a=shared[_0x7f00('0x23')];var _0x3824a2=_0x28156a[_0x4d4625];var _0x37ff3f=_0x28156a[_0x1ccfba[_0x7f00('0x1f')]];if(!_[_0x7f00('0x1e')](_0x3824a2)&&!_[_0x7f00('0x1e')](_0x37ff3f)){var _0x1f9b9b=_0x3824a2[_0x7f00('0x24')]-_0x37ff3f[_0x7f00('0x24')];_0x96c15=_0x1ccfba['scheduledat']?_0x1ccfba['scheduledat']:moment();var _0x1aa35d=moment(_0x96c15)[_0x7f00('0x25')](_0x1f9b9b,_0x7f00('0x26'));_0x42014f({'ret':_0x1aa35d['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x42014f({'ret':_0x96c15});}else _0x42014f({'ret':_0x96c15});}else{_0x42014f({'ret':_0x96c15});}});}});return 0xa;}var _0x28506e=function(_0x2cb586){return new BPromise(function(_0xb2115e,_0x3dc982){_0x8a35e6(_0x2cb586,_0x4ccb8b)['then'](function(_0xfbf300){_0x4ccb8b[_0x7f00('0x1b')]=_0xfbf300['ret'];_0x167673[_0x7f00('0x27')]['findOne']({'where':{'phone':_0x4ccb8b[_0x7f00('0xd')],'VoiceQueueId':_0x2cb586['id']}})[_0x7f00('0x22')](function(_0x34392e){if(!_['isNil'](_0x34392e)){throw new Error(_0x7f00('0x28')+_0x4ccb8b['phone']+_0x7f00('0x29')+_0x2cb586['id']);}return _0x167673['CmHopper'][_0x7f00('0x2a')]({'phone':_0x4ccb8b['phone'],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'priority':_0x4ccb8b[_0x7f00('0x2c')]?_0x4ccb8b['priority']:0x2,'scheduledat':_0x4ccb8b[_0x7f00('0x1b')]?_0x4ccb8b[_0x7f00('0x1b')]:moment()[_0x7f00('0x1c')](_0x7f00('0x1d')),'callback':_0x4ccb8b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb8b['callbackUniqueid']?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b[_0x7f00('0x2d')]?moment()[_0x7f00('0x1c')](_0x7f00('0x1d')):undefined,'VoiceQueueId':_0x2cb586['id']});})[_0x7f00('0x2e')](function(_0x54cf7d){_0x3dc982(_0x54cf7d);});});});};var _0x16942e=function(_0x6ff981){return new BPromise(function(_0x31682b,_0x1186c3){_0x8a35e6(_0x6ff981,_0x4ccb8b)['then'](function(_0x51228b){_0x4ccb8b[_0x7f00('0x1b')]=_0x51228b[_0x7f00('0x2f')];_0x167673[_0x7f00('0x27')][_0x7f00('0x21')]({'where':{'phone':_0x4ccb8b[_0x7f00('0xd')],'VoiceQueueId':_0x6ff981['id']}})[_0x7f00('0x22')](function(_0xfdeb72){if(!_[_0x7f00('0x1e')](_0xfdeb72)){throw new Error(_0x7f00('0x28')+_0x4ccb8b[_0x7f00('0xd')]+_0x7f00('0x30')+_0x6ff981['id']);}return _0x167673[_0x7f00('0x31')]['findOne']({'where':{'calleridnum':_0x4ccb8b['phone'],'VoiceQueueId':_0x6ff981['id']}});})[_0x7f00('0x22')](function(_0x2d24c4){if(!_['isNil'](_0x2d24c4)){throw new Error(_0x7f00('0x32')+_0x4ccb8b['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x6ff981['id']);}return _0x167673[_0x7f00('0x27')][_0x7f00('0x2a')]({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b['ListId'],'priority':_0x4ccb8b[_0x7f00('0x2c')]?_0x4ccb8b['priority']:0x2,'scheduledat':_0x4ccb8b['scheduledat']?_0x4ccb8b[_0x7f00('0x1b')]:moment()[_0x7f00('0x1c')](_0x7f00('0x1d')),'callback':_0x4ccb8b[_0x7f00('0x2d')]?!![]:![],'callbackuniqueid':_0x4ccb8b['callbackUniqueid']?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b[_0x7f00('0x2d')]?moment()['format'](_0x7f00('0x1d')):undefined,'VoiceQueueId':_0x6ff981['id']});})[_0x7f00('0x2e')](function(_0x309368){_0x1186c3(_0x309368);});});});};function _0x3ea901(){return function(_0x2f5e38){logger['error'](_0x7f00('0x18'),_0x7f00('0x19'),util[_0x7f00('0x1a')](_0x2f5e38,{'showHidden':![],'depth':null}));};}function _0x51b424(_0x489b34,_0x45acab){var _0x26a5d6=_0x45acab[_0x7f00('0x1b')]?_0x45acab[_0x7f00('0x1b')]:moment()[_0x7f00('0x1c')](_0x7f00('0x1d'));return new BPromise(function(_0x54b3e1,_0x52df34){if(_[_0x7f00('0x1e')](_0x45acab['dialTimezone'])){_0x54b3e1({'ret':_0x26a5d6});}else{_0x167673['Campaign'][_0x7f00('0x21')]({'where':{'id':_0x489b34['id']}})[_0x7f00('0x22')](function(_0x5b414c){if(!_['isNil'](_0x5b414c)){var _0x1a7e36=_0x5b414c[_0x7f00('0x1f')];if(!_[_0x7f00('0x1e')](_0x1a7e36)){var _0xbf907b=shared[_0x7f00('0x23')];var _0x487be5=_0xbf907b[_0x1a7e36];var _0x216a63=_0xbf907b[_0x45acab[_0x7f00('0x1f')]];if(!_[_0x7f00('0x1e')](_0x487be5)&&!_['isNil'](_0x216a63)){var _0x1e87be=_0x487be5[_0x7f00('0x24')]-_0x216a63['utcOffset'];_0x26a5d6=_0x45acab[_0x7f00('0x1b')]?_0x45acab[_0x7f00('0x1b')]:moment();var _0x1f85e5=moment(_0x26a5d6)[_0x7f00('0x25')](_0x1e87be,_0x7f00('0x26'));_0x54b3e1({'ret':_0x1f85e5[_0x7f00('0x1c')](_0x7f00('0x1d'))});}else _0x54b3e1({'ret':_0x26a5d6});}else _0x54b3e1({'ret':_0x26a5d6});}else{_0x54b3e1({'ret':_0x26a5d6});}});}});return 0xa;}var _0x2ba592=function(_0x52339a){return new BPromise(function(_0x37c7de,_0x3579aa){_0x51b424(_0x52339a,_0x4ccb8b)[_0x7f00('0x22')](function(_0x4f1e20){_0x4ccb8b['scheduledat']=_0x4f1e20['ret'];_0x167673[_0x7f00('0x27')][_0x7f00('0x21')]({'where':{'phone':_0x4ccb8b[_0x7f00('0xd')],'CampaignId':_0x52339a['id']}})['then'](function(_0x52ece1){if(!_[_0x7f00('0x1e')](_0x52ece1)){throw new Error(_0x7f00('0x28')+_0x4ccb8b['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x52339a['id']);}return _0x167673[_0x7f00('0x27')][_0x7f00('0x2a')]({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'priority':_0x4ccb8b[_0x7f00('0x2c')]?_0x4ccb8b[_0x7f00('0x2c')]:0x2,'scheduledat':_0x4ccb8b[_0x7f00('0x1b')]?_0x4ccb8b[_0x7f00('0x1b')]:moment()['format'](_0x7f00('0x1d')),'callback':_0x4ccb8b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb8b[_0x7f00('0x2d')]?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b[_0x7f00('0x2d')]?moment()[_0x7f00('0x1c')](_0x7f00('0x1d')):undefined,'CampaignId':_0x52339a['id']});})['catch'](function(_0x2a6968){_0x3579aa(_0x2a6968);});});});};var _0x35c335=function(_0x3301f0){return new BPromise(function(_0x3ae730,_0x36de14){_0x51b424(_0x3301f0,_0x4ccb8b)['then'](function(_0x3aa36f){_0x4ccb8b['scheduledat']=_0x3aa36f[_0x7f00('0x2f')];_0x167673[_0x7f00('0x27')][_0x7f00('0x21')]({'where':{'phone':_0x4ccb8b['phone'],'CampaignId':_0x3301f0['id']}})[_0x7f00('0x22')](function(_0xd5e0b){if(!_[_0x7f00('0x1e')](_0xd5e0b)){throw new Error(_0x7f00('0x28')+_0x4ccb8b[_0x7f00('0xd')]+_0x7f00('0x33')+_0x3301f0['id']);}return _0x167673['CmHopperFinal'][_0x7f00('0x21')]({'where':{'calleridnum':_0x4ccb8b[_0x7f00('0xd')],'CampaignId':_0x3301f0['id']}});})[_0x7f00('0x22')](function(_0xdfe657){if(!_[_0x7f00('0x1e')](_0xdfe657)){throw new Error(_0x7f00('0x32')+_0x4ccb8b['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3301f0['id']);}return _0x167673[_0x7f00('0x27')]['create']({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'priority':_0x4ccb8b[_0x7f00('0x2c')]?_0x4ccb8b[_0x7f00('0x2c')]:0x2,'scheduledat':_0x4ccb8b[_0x7f00('0x1b')]?_0x4ccb8b[_0x7f00('0x1b')]:moment()[_0x7f00('0x1c')](_0x7f00('0x1d')),'callback':_0x4ccb8b[_0x7f00('0x2d')]?!![]:![],'callbackuniqueid':_0x4ccb8b['callbackUniqueid']?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b['callbackUniqueid']?moment()[_0x7f00('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3301f0['id']});})[_0x7f00('0x2e')](function(_0x58f4f4){_0x36de14(_0x58f4f4);});});});};if(_0x4ccb8b[_0x7f00('0x2b')]){_0x167673[_0x7f00('0x20')]['findAll']({'where':{'type':_0x7f00('0x34')},'attributes':['id',_0x7f00('0x35'),_0x7f00('0x1f')],'include':[{'model':_0x167673[_0x7f00('0x36')],'as':_0x7f00('0x37'),'where':{'id':_0x4ccb8b[_0x7f00('0x2b')]}}]})[_0x7f00('0x22')](function(_0x29cdb9){if(_0x29cdb9){var _0x3e5f61=[];for(var _0xe64c7d=0x0,_0x590873;_0xe64c7d<_0x29cdb9[_0x7f00('0x38')];_0xe64c7d+=0x1){_0x590873=_0x29cdb9[_0xe64c7d][_0x7f00('0x16')]({'plain':!![]});switch(_0x590873[_0x7f00('0x35')]){case _0x7f00('0x39'):_0x16942e(_0x590873)[_0x7f00('0x2e')](_0x17ccff());break;case _0x7f00('0x3a'):_0x28506e(_0x590873)[_0x7f00('0x2e')](_0x17ccff());break;default:_0x51b424(_0x590873,_0x4ccb8b)[_0x7f00('0x22')](function(_0x558053){_0x4ccb8b[_0x7f00('0x1b')]=_0x558053['ret'];_0x167673[_0x7f00('0x27')][_0x7f00('0x2a')]({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'scheduledat':_0x4ccb8b[_0x7f00('0x1b')]?_0x4ccb8b[_0x7f00('0x1b')]:moment()['format'](_0x7f00('0x1d')),'priority':_0x4ccb8b[_0x7f00('0x2c')]?_0x4ccb8b[_0x7f00('0x2c')]:0x2,'callback':_0x4ccb8b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4ccb8b[_0x7f00('0x2d')]?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b[_0x7f00('0x2d')]?moment()[_0x7f00('0x1c')](_0x7f00('0x1d')):undefined,'VoiceQueueId':_0x590873['id']})[_0x7f00('0x2e')](_0x17ccff());});}}}})[_0x7f00('0x22')](function(){return _0x167673[_0x7f00('0x20')]['findAll']({'where':{'type':_0x7f00('0x34')},'attributes':['id'],'include':[{'model':_0x167673['CmList'],'as':_0x7f00('0x3b'),'where':{'id':_0x4ccb8b[_0x7f00('0x2b')]}}]})[_0x7f00('0x22')](function(_0x9a4001){if(_0x9a4001){var _0x4cf2e0=[];for(var _0x34ba4e=0x0,_0x59d012;_0x34ba4e<_0x9a4001[_0x7f00('0x38')];_0x34ba4e+=0x1){_0x59d012=_0x9a4001[_0x34ba4e][_0x7f00('0x16')]({'plain':!![]});_0x167673[_0x7f00('0x3c')][_0x7f00('0x2a')]({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'VoiceQueueId':_0x59d012['id']})[_0x7f00('0x2e')](function(_0x4db471){logger[_0x7f00('0x17')](_0x7f00('0x3d'),_0x7f00('0x19'),_0x4db471['message']);});}}});})[_0x7f00('0x22')](function(){return _0x167673[_0x7f00('0x3e')][_0x7f00('0x3f')]({'attributes':['id',_0x7f00('0x35'),_0x7f00('0x1f')],'include':[{'model':_0x167673[_0x7f00('0x36')],'as':_0x7f00('0x37'),'where':{'id':_0x4ccb8b[_0x7f00('0x2b')]}}]})['then'](function(_0x3cf7dc){if(_0x3cf7dc){var _0x146619=[];for(var _0x440843=0x0,_0xd54936;_0x440843<_0x3cf7dc['length'];_0x440843+=0x1){_0xd54936=_0x3cf7dc[_0x440843]['get']({'plain':!![]});switch(_0xd54936[_0x7f00('0x35')]){case _0x7f00('0x39'):_0x35c335(_0xd54936)[_0x7f00('0x2e')](_0x3ea901());break;case'onlyIfOpen':_0x2ba592(_0xd54936)[_0x7f00('0x2e')](_0x3ea901());break;default:_0x167673['CmHopper']['create']({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b['ListId'],'scheduledat':_0x4ccb8b[_0x7f00('0x1b')]?_0x4ccb8b[_0x7f00('0x1b')]:moment()['format'](_0x7f00('0x1d')),'priority':_0x4ccb8b['priority']?_0x4ccb8b[_0x7f00('0x2c')]:0x2,'callback':_0x4ccb8b[_0x7f00('0x2d')]?!![]:![],'callbackuniqueid':_0x4ccb8b[_0x7f00('0x2d')]?_0x4ccb8b[_0x7f00('0x2d')]:undefined,'callbackat':_0x4ccb8b[_0x7f00('0x2d')]?moment()[_0x7f00('0x1c')](_0x7f00('0x1d')):undefined,'CampaignId':_0xd54936['id']})[_0x7f00('0x2e')](_0x3ea901());}}}});})[_0x7f00('0x22')](function(){return _0x167673['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x167673[_0x7f00('0x36')],'as':_0x7f00('0x3b'),'where':{'id':_0x4ccb8b[_0x7f00('0x2b')]}}]})[_0x7f00('0x22')](function(_0x2e05f7){if(_0x2e05f7){var _0x4c41d5=[];for(var _0xa0f76f=0x0,_0x2447c0;_0xa0f76f<_0x2e05f7[_0x7f00('0x38')];_0xa0f76f+=0x1){_0x2447c0=_0x2e05f7[_0xa0f76f]['get']({'plain':!![]});_0x167673[_0x7f00('0x3c')][_0x7f00('0x2a')]({'phone':_0x4ccb8b[_0x7f00('0xd')],'ContactId':_0x4ccb8b['id'],'ListId':_0x4ccb8b[_0x7f00('0x2b')],'CampaignId':_0x2447c0['id']})[_0x7f00('0x2e')](function(_0x4b7ce1){logger[_0x7f00('0x17')](_0x7f00('0x3d'),'afterCreate',_0x4b7ce1['message']);});}}});})[_0x7f00('0x22')](function(){_0x30ae4d();})[_0x7f00('0x2e')](function(_0x2073b4){logger[_0x7f00('0x17')]('cmContact,\x20%s,\x20%s','afterCreate',_0x2073b4[_0x7f00('0x40')]);_0x30ae4d(_0x2073b4);});}else{_0x30ae4d(new Error(_0x7f00('0x41')));}},'afterDestroy':function(_0x1dd5dd,_0x4a1e1b,_0x55b6b4){var _0x1c4611=_0x3bbb4d[_0x7f00('0x15')];var _0x4a861e=_0x1dd5dd[_0x7f00('0x16')]({'plain':!![]});return _0x1c4611[_0x7f00('0x27')][_0x7f00('0x3f')]({'raw':!![],'where':{'ListId':_0x4a861e['ListId'],'ContactId':_0x4a861e['id']}})[_0x7f00('0x22')](function(_0x2951f2){if(!_[_0x7f00('0x42')](_0x2951f2)){var _0x485b06=[];for(var _0x4b1dc5=0x0;_0x4b1dc5<_0x2951f2['length'];_0x4b1dc5+=0x1){var _0x120f48=_0x1c4611[_0x7f00('0x27')]['destroy']({'where':{'ListId':_0x2951f2[_0x4b1dc5][_0x7f00('0x2b')],'ContactId':_0x2951f2[_0x4b1dc5][_0x7f00('0x43')],'VoiceQueueId':_0x2951f2[_0x4b1dc5][_0x7f00('0x44')],'CampaignId':_0x2951f2[_0x4b1dc5][_0x7f00('0x45')]}});_0x485b06['push'](_0x120f48);}return BPromise['all'](_0x485b06);}})[_0x7f00('0x22')](function(_0x2239f0){logger[_0x7f00('0x46')](_0x7f00('0x47'),util[_0x7f00('0x1a')](_0x2239f0,{'showHidden':![],'depth':null}));_0x55b6b4();})['catch'](function(_0x29ba62){logger[_0x7f00('0x17')](_0x7f00('0x48'),util[_0x7f00('0x1a')](_0x29ba62,{'showHidden':![],'depth':null}));_0x55b6b4(_0x29ba62);});}}});}; \ No newline at end of file +var _0xc17d=['priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','minutes','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','CmHopperBlack','Lists','message','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId'];(function(_0x21fd12,_0x1c3cf2){var _0x4a2a2a=function(_0x3f6fc6){while(--_0x3f6fc6){_0x21fd12['push'](_0x21fd12['shift']());}};_0x4a2a2a(++_0x1c3cf2);}(_0xc17d,0x100));var _0xdc17=function(_0x3a0bd3,_0x71e0b){_0x3a0bd3=_0x3a0bd3-0x0;var _0x359beb=_0xc17d[_0x3a0bd3];return _0x359beb;};'use strict';var _=require(_0xdc17('0x0'));var util=require(_0xdc17('0x1'));var logger=require('../../config/logger')(_0xdc17('0x2'));var moment=require(_0xdc17('0x3'));var BPromise=require(_0xdc17('0x4'));var rp=require(_0xdc17('0x5'));var fs=require('fs');var path=require(_0xdc17('0x6'));var rimraf=require(_0xdc17('0x7'));var config=require(_0xdc17('0x8'));var shared=require(_0xdc17('0x9'));var attributes=require(_0xdc17('0xa'));module[_0xdc17('0xb')]=function(_0xf7e2e8,_0x2ac9f9){return _0xf7e2e8['define'](_0xdc17('0xc'),attributes,{'tableName':_0xdc17('0xd'),'paranoid':!![],'indexes':[{'name':_0xdc17('0xe'),'fields':[_0xdc17('0xe')]},{'name':_0xdc17('0xf'),'fields':[_0xdc17('0x10'),_0xdc17('0x11'),_0xdc17('0xe'),'mobile',_0xdc17('0x12'),_0xdc17('0x13')],'type':_0xdc17('0x14')}],'timestamps':!![],'charset':_0xdc17('0x15'),'collate':_0xdc17('0x16'),'hooks':{'afterCreate':function(_0x28d94d,_0x1ef17,_0x1d8d6d){var _0x5b6e2b=_0xf7e2e8[_0xdc17('0x17')];var _0xde5cb=_0x28d94d[_0xdc17('0x18')]({'plain':!![]});function _0x5c4c44(){return function(_0x42ddd1){logger[_0xdc17('0x19')]('cmContact','afterCreate',util[_0xdc17('0x1a')](_0x42ddd1,{'showHidden':![],'depth':null}));};}function _0x2831ea(_0x41882f,_0x3045ab){var _0x113d3b=_0x3045ab['scheduledat']?_0x3045ab[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')](_0xdc17('0x1d'));return new BPromise(function(_0x71f6f8,_0x20d0be){if(_[_0xdc17('0x1e')](_0x3045ab[_0xdc17('0x1f')])){_0x71f6f8({'ret':_0x113d3b});}else{_0x5b6e2b[_0xdc17('0x20')][_0xdc17('0x21')]({'where':{'id':_0x41882f['id']}})[_0xdc17('0x22')](function(_0x327775){if(!_['isNil'](_0x327775)){var _0x512090=_0x327775['dialTimezone'];if(!_[_0xdc17('0x1e')](_0x512090)){var _0x472dbb=shared[_0xdc17('0x23')];var _0x4b9535=_0x472dbb[_0x512090];var _0x636718=_0x472dbb[_0x3045ab['dialTimezone']];if(!_[_0xdc17('0x1e')](_0x4b9535)&&!_[_0xdc17('0x1e')](_0x636718)){var _0x26c0ea=_0x4b9535['utcOffset']-_0x636718[_0xdc17('0x24')];_0x113d3b=_0x3045ab[_0xdc17('0x1b')]?_0x3045ab[_0xdc17('0x1b')]:moment();var _0x3dcfdf=moment(_0x113d3b)[_0xdc17('0x25')](_0x26c0ea,'minutes');_0x71f6f8({'ret':_0x3dcfdf['format'](_0xdc17('0x1d'))});}else _0x71f6f8({'ret':_0x113d3b});}else _0x71f6f8({'ret':_0x113d3b});}else{_0x71f6f8({'ret':_0x113d3b});}});}});return 0xa;}var _0x4e0ab0=function(_0x4969a6){return new BPromise(function(_0x3ea5fd,_0x204567){_0x2831ea(_0x4969a6,_0xde5cb)[_0xdc17('0x22')](function(_0x40f729){_0xde5cb[_0xdc17('0x1b')]=_0x40f729[_0xdc17('0x26')];_0x5b6e2b['CmHopper']['findOne']({'where':{'phone':_0xde5cb[_0xdc17('0xe')],'VoiceQueueId':_0x4969a6['id']}})[_0xdc17('0x22')](function(_0x141049){if(!_[_0xdc17('0x1e')](_0x141049)){throw new Error(_0xdc17('0x27')+_0xde5cb['phone']+_0xdc17('0x28')+_0x4969a6['id']);}return _0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'priority':_0xde5cb['priority']?_0xde5cb[_0xdc17('0x2c')]:0x2,'scheduledat':_0xde5cb['scheduledat']?_0xde5cb[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb[_0xdc17('0x2d')]?_0xde5cb[_0xdc17('0x2d')]:undefined,'callbackat':_0xde5cb[_0xdc17('0x2d')]?moment()[_0xdc17('0x1c')](_0xdc17('0x1d')):undefined,'VoiceQueueId':_0x4969a6['id']});})[_0xdc17('0x2e')](function(_0x19fd50){_0x204567(_0x19fd50);});});});};var _0x6fad9d=function(_0x3cf4ab){return new BPromise(function(_0x367953,_0x12ec79){_0x2831ea(_0x3cf4ab,_0xde5cb)[_0xdc17('0x22')](function(_0x5cee43){_0xde5cb[_0xdc17('0x1b')]=_0x5cee43[_0xdc17('0x26')];_0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x21')]({'where':{'phone':_0xde5cb['phone'],'VoiceQueueId':_0x3cf4ab['id']}})[_0xdc17('0x22')](function(_0xcaef45){if(!_[_0xdc17('0x1e')](_0xcaef45)){throw new Error(_0xdc17('0x27')+_0xde5cb[_0xdc17('0xe')]+_0xdc17('0x2f')+_0x3cf4ab['id']);}return _0x5b6e2b['CmHopperFinal'][_0xdc17('0x21')]({'where':{'calleridnum':_0xde5cb[_0xdc17('0xe')],'VoiceQueueId':_0x3cf4ab['id']}});})[_0xdc17('0x22')](function(_0x4acf63){if(!_[_0xdc17('0x1e')](_0x4acf63)){throw new Error(_0xdc17('0x30')+_0xde5cb[_0xdc17('0xe')]+_0xdc17('0x31')+_0x3cf4ab['id']);}return _0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'priority':_0xde5cb['priority']?_0xde5cb[_0xdc17('0x2c')]:0x2,'scheduledat':_0xde5cb['scheduledat']?_0xde5cb[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')](_0xdc17('0x1d')),'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb['callbackUniqueid']?_0xde5cb[_0xdc17('0x2d')]:undefined,'callbackat':_0xde5cb['callbackUniqueid']?moment()[_0xdc17('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3cf4ab['id']});})[_0xdc17('0x2e')](function(_0x39f758){_0x12ec79(_0x39f758);});});});};function _0x136d06(){return function(_0x1688b4){logger[_0xdc17('0x19')]('cmContact',_0xdc17('0x32'),util['inspect'](_0x1688b4,{'showHidden':![],'depth':null}));};}function _0x1c8bc7(_0x7e2243,_0x1b01cf){var _0x1fa16a=_0x1b01cf['scheduledat']?_0x1b01cf[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')](_0xdc17('0x1d'));return new BPromise(function(_0x5bd9b8,_0x1ac4be){if(_[_0xdc17('0x1e')](_0x1b01cf[_0xdc17('0x1f')])){_0x5bd9b8({'ret':_0x1fa16a});}else{_0x5b6e2b[_0xdc17('0x33')][_0xdc17('0x21')]({'where':{'id':_0x7e2243['id']}})[_0xdc17('0x22')](function(_0x38fd59){if(!_[_0xdc17('0x1e')](_0x38fd59)){var _0x5bc46b=_0x38fd59[_0xdc17('0x1f')];if(!_[_0xdc17('0x1e')](_0x5bc46b)){var _0x134580=shared[_0xdc17('0x23')];var _0x238b1f=_0x134580[_0x5bc46b];var _0x218722=_0x134580[_0x1b01cf[_0xdc17('0x1f')]];if(!_[_0xdc17('0x1e')](_0x238b1f)&&!_['isNil'](_0x218722)){var _0x50e081=_0x238b1f[_0xdc17('0x24')]-_0x218722[_0xdc17('0x24')];_0x1fa16a=_0x1b01cf['scheduledat']?_0x1b01cf[_0xdc17('0x1b')]:moment();var _0x648d4f=moment(_0x1fa16a)[_0xdc17('0x25')](_0x50e081,_0xdc17('0x34'));_0x5bd9b8({'ret':_0x648d4f[_0xdc17('0x1c')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5bd9b8({'ret':_0x1fa16a});}else _0x5bd9b8({'ret':_0x1fa16a});}else{_0x5bd9b8({'ret':_0x1fa16a});}});}});return 0xa;}var _0x334fe2=function(_0x4449ec){return new BPromise(function(_0x13b073,_0x25b7d5){_0x1c8bc7(_0x4449ec,_0xde5cb)['then'](function(_0x135e4d){_0xde5cb[_0xdc17('0x1b')]=_0x135e4d[_0xdc17('0x26')];_0x5b6e2b['CmHopper'][_0xdc17('0x21')]({'where':{'phone':_0xde5cb[_0xdc17('0xe')],'CampaignId':_0x4449ec['id']}})[_0xdc17('0x22')](function(_0x1477b1){if(!_[_0xdc17('0x1e')](_0x1477b1)){throw new Error(_0xdc17('0x27')+_0xde5cb[_0xdc17('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x4449ec['id']);}return _0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'priority':_0xde5cb[_0xdc17('0x2c')]?_0xde5cb[_0xdc17('0x2c')]:0x2,'scheduledat':_0xde5cb[_0xdc17('0x1b')]?_0xde5cb[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')](_0xdc17('0x1d')),'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb[_0xdc17('0x2d')]?_0xde5cb[_0xdc17('0x2d')]:undefined,'callbackat':_0xde5cb[_0xdc17('0x2d')]?moment()[_0xdc17('0x1c')](_0xdc17('0x1d')):undefined,'CampaignId':_0x4449ec['id']});})[_0xdc17('0x2e')](function(_0x207f99){_0x25b7d5(_0x207f99);});});});};var _0xc0f3cc=function(_0xb58a47){return new BPromise(function(_0x232857,_0x3f08ca){_0x1c8bc7(_0xb58a47,_0xde5cb)['then'](function(_0x8d4e65){_0xde5cb[_0xdc17('0x1b')]=_0x8d4e65[_0xdc17('0x26')];_0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x21')]({'where':{'phone':_0xde5cb['phone'],'CampaignId':_0xb58a47['id']}})['then'](function(_0x3beca9){if(!_[_0xdc17('0x1e')](_0x3beca9)){throw new Error(_0xdc17('0x27')+_0xde5cb[_0xdc17('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0xb58a47['id']);}return _0x5b6e2b[_0xdc17('0x35')][_0xdc17('0x21')]({'where':{'calleridnum':_0xde5cb[_0xdc17('0xe')],'CampaignId':_0xb58a47['id']}});})[_0xdc17('0x22')](function(_0x4aeecb){if(!_[_0xdc17('0x1e')](_0x4aeecb)){throw new Error(_0xdc17('0x30')+_0xde5cb[_0xdc17('0xe')]+_0xdc17('0x36')+_0xb58a47['id']);}return _0x5b6e2b['CmHopper'][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'priority':_0xde5cb[_0xdc17('0x2c')]?_0xde5cb[_0xdc17('0x2c')]:0x2,'scheduledat':_0xde5cb['scheduledat']?_0xde5cb['scheduledat']:moment()['format'](_0xdc17('0x1d')),'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb[_0xdc17('0x2d')]?_0xde5cb['callbackUniqueid']:undefined,'callbackat':_0xde5cb[_0xdc17('0x2d')]?moment()[_0xdc17('0x1c')](_0xdc17('0x1d')):undefined,'CampaignId':_0xb58a47['id']});})[_0xdc17('0x2e')](function(_0x3fc197){_0x3f08ca(_0x3fc197);});});});};if(_0xde5cb['ListId']){_0x5b6e2b['VoiceQueue'][_0xdc17('0x37')]({'where':{'type':_0xdc17('0x38')},'attributes':['id',_0xdc17('0x39'),'dialTimezone'],'include':[{'model':_0x5b6e2b[_0xdc17('0x3a')],'as':'Lists','where':{'id':_0xde5cb['ListId']}}]})[_0xdc17('0x22')](function(_0x23e6aa){if(_0x23e6aa){var _0x14d1e8=[];for(var _0x3882b6=0x0,_0x5968dc;_0x3882b6<_0x23e6aa[_0xdc17('0x3b')];_0x3882b6+=0x1){_0x5968dc=_0x23e6aa[_0x3882b6][_0xdc17('0x18')]({'plain':!![]});switch(_0x5968dc[_0xdc17('0x39')]){case _0xdc17('0x3c'):_0x6fad9d(_0x5968dc)['catch'](_0x5c4c44());break;case _0xdc17('0x3d'):_0x4e0ab0(_0x5968dc)['catch'](_0x5c4c44());break;default:_0x1c8bc7(_0x5968dc,_0xde5cb)['then'](function(_0x199d6b){_0xde5cb[_0xdc17('0x1b')]=_0x199d6b[_0xdc17('0x26')];_0x5b6e2b['CmHopper'][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb['ListId'],'scheduledat':_0xde5cb[_0xdc17('0x1b')]?_0xde5cb[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xde5cb[_0xdc17('0x2c')]?_0xde5cb['priority']:0x2,'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb[_0xdc17('0x2d')]?_0xde5cb[_0xdc17('0x2d')]:undefined,'callbackat':_0xde5cb[_0xdc17('0x2d')]?moment()[_0xdc17('0x1c')](_0xdc17('0x1d')):undefined,'VoiceQueueId':_0x5968dc['id']})['catch'](_0x5c4c44());});}}}})[_0xdc17('0x22')](function(){return _0x5b6e2b[_0xdc17('0x20')][_0xdc17('0x37')]({'where':{'type':_0xdc17('0x38')},'attributes':['id'],'include':[{'model':_0x5b6e2b[_0xdc17('0x3a')],'as':_0xdc17('0x3e'),'where':{'id':_0xde5cb[_0xdc17('0x2b')]}}]})['then'](function(_0x4afb38){if(_0x4afb38){var _0x2f0a8b=[];for(var _0x6b89ca=0x0,_0x5e96c3;_0x6b89ca<_0x4afb38[_0xdc17('0x3b')];_0x6b89ca+=0x1){_0x5e96c3=_0x4afb38[_0x6b89ca][_0xdc17('0x18')]({'plain':!![]});_0x5b6e2b[_0xdc17('0x3f')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'VoiceQueueId':_0x5e96c3['id']})[_0xdc17('0x2e')](function(_0x4850e1){logger[_0xdc17('0x19')]('cmContact,\x20%s,\x20%s',_0xdc17('0x32'),_0x4850e1['message']);});}}});})[_0xdc17('0x22')](function(){return _0x5b6e2b[_0xdc17('0x33')]['findAll']({'attributes':['id',_0xdc17('0x39'),_0xdc17('0x1f')],'include':[{'model':_0x5b6e2b[_0xdc17('0x3a')],'as':_0xdc17('0x40'),'where':{'id':_0xde5cb[_0xdc17('0x2b')]}}]})[_0xdc17('0x22')](function(_0x376dd1){if(_0x376dd1){var _0x700d20=[];for(var _0x5e1adf=0x0,_0x5392a0;_0x5e1adf<_0x376dd1[_0xdc17('0x3b')];_0x5e1adf+=0x1){_0x5392a0=_0x376dd1[_0x5e1adf]['get']({'plain':!![]});switch(_0x5392a0[_0xdc17('0x39')]){case'always':_0xc0f3cc(_0x5392a0)['catch'](_0x136d06());break;case _0xdc17('0x3d'):_0x334fe2(_0x5392a0)[_0xdc17('0x2e')](_0x136d06());break;default:_0x5b6e2b[_0xdc17('0x29')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb[_0xdc17('0x2b')],'scheduledat':_0xde5cb[_0xdc17('0x1b')]?_0xde5cb[_0xdc17('0x1b')]:moment()[_0xdc17('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xde5cb[_0xdc17('0x2c')]?_0xde5cb[_0xdc17('0x2c')]:0x2,'callback':_0xde5cb[_0xdc17('0x2d')]?!![]:![],'callbackuniqueid':_0xde5cb['callbackUniqueid']?_0xde5cb['callbackUniqueid']:undefined,'callbackat':_0xde5cb['callbackUniqueid']?moment()[_0xdc17('0x1c')](_0xdc17('0x1d')):undefined,'CampaignId':_0x5392a0['id']})[_0xdc17('0x2e')](_0x136d06());}}}});})[_0xdc17('0x22')](function(){return _0x5b6e2b[_0xdc17('0x33')][_0xdc17('0x37')]({'attributes':['id'],'include':[{'model':_0x5b6e2b[_0xdc17('0x3a')],'as':_0xdc17('0x3e'),'where':{'id':_0xde5cb[_0xdc17('0x2b')]}}]})[_0xdc17('0x22')](function(_0x2953c5){if(_0x2953c5){var _0x3917b2=[];for(var _0xbf66ea=0x0,_0x1c0e22;_0xbf66ea<_0x2953c5[_0xdc17('0x3b')];_0xbf66ea+=0x1){_0x1c0e22=_0x2953c5[_0xbf66ea][_0xdc17('0x18')]({'plain':!![]});_0x5b6e2b[_0xdc17('0x3f')][_0xdc17('0x2a')]({'phone':_0xde5cb[_0xdc17('0xe')],'ContactId':_0xde5cb['id'],'ListId':_0xde5cb['ListId'],'CampaignId':_0x1c0e22['id']})[_0xdc17('0x2e')](function(_0x49b649){logger[_0xdc17('0x19')]('cmContact,\x20%s,\x20%s',_0xdc17('0x32'),_0x49b649[_0xdc17('0x41')]);});}}});})[_0xdc17('0x22')](function(){_0x1d8d6d();})[_0xdc17('0x2e')](function(_0x13c778){logger['error']('cmContact,\x20%s,\x20%s',_0xdc17('0x32'),_0x13c778[_0xdc17('0x41')]);_0x1d8d6d(_0x13c778);});}else{_0x1d8d6d(new Error(_0xdc17('0x42')));}},'afterDestroy':function(_0x4b368a,_0x4374fa,_0x398e68){var _0x34ef79=_0xf7e2e8[_0xdc17('0x17')];var _0x3f7b5b=_0x4b368a[_0xdc17('0x18')]({'plain':!![]});return _0x34ef79[_0xdc17('0x29')][_0xdc17('0x37')]({'raw':!![],'where':{'ListId':_0x3f7b5b['ListId'],'ContactId':_0x3f7b5b['id']}})[_0xdc17('0x22')](function(_0x236d85){if(!_[_0xdc17('0x43')](_0x236d85)){var _0x445d44=[];for(var _0x1827b2=0x0;_0x1827b2<_0x236d85[_0xdc17('0x3b')];_0x1827b2+=0x1){var _0x5e76b4=_0x34ef79['CmHopper']['destroy']({'where':{'ListId':_0x236d85[_0x1827b2]['ListId'],'ContactId':_0x236d85[_0x1827b2][_0xdc17('0x44')],'VoiceQueueId':_0x236d85[_0x1827b2][_0xdc17('0x45')],'CampaignId':_0x236d85[_0x1827b2]['CampaignId']}});_0x445d44[_0xdc17('0x46')](_0x5e76b4);}return BPromise[_0xdc17('0x47')](_0x445d44);}})[_0xdc17('0x22')](function(_0x140632){logger[_0xdc17('0x48')](_0xdc17('0x49'),util[_0xdc17('0x1a')](_0x140632,{'showHidden':![],'depth':null}));_0x398e68();})['catch'](function(_0x267262){logger['error'](_0xdc17('0x4a'),util[_0xdc17('0x1a')](_0x267262,{'showHidden':![],'depth':null}));_0x398e68(_0x267262);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index feb2a89..9de43f3 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','attributes','limit','include','map','model','phone','length','CmContactHasItem','find','Contact','GetCmContact\x20debug\x20contactHasItems','isNil','CmContactId','GetCmContact\x20debug\x20found\x20contactId','create','body','keys','startsWith','update','table','cm_contacts','set','id\x20=\x20?','sequelize','CreateCmContact','lodash','moment','bluebird','randomstring','ioredis','squel'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'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 squel=require(_0x7721('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7721('0x6'))(_0x7721('0x7'));var config=require(_0x7721('0x8'));var jayson=require(_0x7721('0x9'));var client=jayson[_0x7721('0xa')][_0x7721('0xb')]({'port':0x232a});config[_0x7721('0xc')]=_[_0x7721('0xd')](config[_0x7721('0xc')],{'host':_0x7721('0xe'),'port':0x18eb});var socket=require(_0x7721('0xf'))(new Redis(config[_0x7721('0xc')]));require(_0x7721('0x10'))[_0x7721('0x11')](socket);function respondWithRpcPromise(_0x2c3986,_0x578d59,_0x461d1a){return new BPromise(function(_0x29bc8f,_0x8729a6){return client[_0x7721('0x12')](_0x2c3986,_0x461d1a)[_0x7721('0x13')](function(_0x409b37){logger[_0x7721('0x14')](_0x7721('0x15'),_0x578d59,'request\x20sent');logger[_0x7721('0x16')](_0x7721('0x17'),_0x578d59,'request\x20sent',JSON[_0x7721('0x18')](_0x409b37));if(_0x409b37[_0x7721('0x19')]){if(_0x409b37[_0x7721('0x19')][_0x7721('0x1a')]===0x1f4){logger['error'](_0x7721('0x15'),_0x578d59,_0x409b37[_0x7721('0x19')]['message']);return _0x8729a6(_0x409b37['error']['message']);}logger[_0x7721('0x19')](_0x7721('0x15'),_0x578d59,_0x409b37[_0x7721('0x19')][_0x7721('0x1b')]);return _0x29bc8f(_0x409b37['error'][_0x7721('0x1b')]);}else{logger['info'](_0x7721('0x15'),_0x578d59,'request\x20sent');_0x29bc8f(_0x409b37[_0x7721('0x1c')][_0x7721('0x1b')]);}})[_0x7721('0x1d')](function(_0x3e140d){logger[_0x7721('0x19')](_0x7721('0x15'),_0x578d59,_0x3e140d);_0x8729a6(_0x3e140d);});});}exports[_0x7721('0x1e')]=function(_0x413263){var _0x3b29ac=this;return new Promise(function(_0xaeccc4,_0x4ce1db){return db[_0x7721('0x1f')][_0x7721('0x20')]({'raw':_0x413263[_0x7721('0x21')]?_0x413263[_0x7721('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x413263[_0x7721('0x21')]?_0x413263['options'][_0x7721('0x22')]||null:null,'attributes':_0x413263[_0x7721('0x21')]?_0x413263[_0x7721('0x21')][_0x7721('0x23')]||null:null,'limit':_0x413263[_0x7721('0x21')]?_0x413263[_0x7721('0x21')][_0x7721('0x24')]||null:null,'include':_0x413263['options']?_0x413263[_0x7721('0x21')][_0x7721('0x25')]?_[_0x7721('0x26')](_0x413263[_0x7721('0x21')][_0x7721('0x25')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x27')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x23')],'include':_0x16355a[_0x7721('0x25')]?_['map'](_0x16355a[_0x7721('0x25')],function(_0x5b0551){return{'model':db[_0x5b0551['model']],'as':_0x5b0551['as'],'attributes':_0x5b0551[_0x7721('0x23')],'include':_0x5b0551[_0x7721('0x25')]?_[_0x7721('0x26')](_0x5b0551[_0x7721('0x25')],function(_0x1ea4d){return{'model':db[_0x1ea4d[_0x7721('0x27')]],'as':_0x1ea4d['as'],'attributes':_0x1ea4d[_0x7721('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7721('0x13')](function(_0x5c54f0){logger[_0x7721('0x14')](_0x7721('0x1e'),_0x413263);logger['info']('GetCmContact\x20debug\x20contact',_0x413263,JSON[_0x7721('0x18')](_0x5c54f0));logger[_0x7721('0x14')]('GetCmContact\x20debug\x20PHONE',_0x413263[_0x7721('0x21')][_0x7721('0x28')]);logger[_0x7721('0x16')]('GetCmContact',_0x413263,JSON[_0x7721('0x18')](_0x5c54f0));if(_0x5c54f0[_0x7721('0x29')]==0x0){return db[_0x7721('0x2a')][_0x7721('0x2b')]({'raw':!![],'where':{'item':_0x413263[_0x7721('0x21')]['phone']},'include':[{'model':db[_0x7721('0x1f')],'as':_0x7721('0x2c')}]})[_0x7721('0x13')](function(_0x5c5b33){logger[_0x7721('0x14')](_0x7721('0x2d'),JSON['stringify'](_0x5c5b33));if(_[_0x7721('0x2e')](_0x5c5b33)){_0xaeccc4(_0x5c54f0);}else{var _0x5ce026=_0x5c5b33[_0x7721('0x2f')];logger[_0x7721('0x14')](_0x7721('0x30'),_0x413263,_0x5ce026);return db[_0x7721('0x1f')][_0x7721('0x20')]({'raw':!![],'where':{'id':_0x5ce026},'attributes':_0x413263[_0x7721('0x21')]?_0x413263[_0x7721('0x21')][_0x7721('0x23')]||null:null})[_0x7721('0x13')](function(_0x3a2eb7){logger[_0x7721('0x14')]('GetCmContact\x20debug\x20contact\x20from\x20additional',_0x413263,JSON[_0x7721('0x18')](_0x3a2eb7));_0xaeccc4(_0x3a2eb7);});}});}else{_0xaeccc4(_0x5c54f0);}})['catch'](function(_0x212384){logger[_0x7721('0x19')](_0x7721('0x1e'),_0x212384[_0x7721('0x1b')],_0x413263);_0x4ce1db(_0x3b29ac[_0x7721('0x19')](0x1f4,_0x212384[_0x7721('0x1b')]));});});};exports['CreateCmContact']=function(_0x557c34){var _0x4cadef=this;return new Promise(function(_0x539560,_0x18001c){return db[_0x7721('0x1f')][_0x7721('0x31')](_0x557c34[_0x7721('0x32')],{'raw':_0x557c34['options']?_0x557c34[_0x7721('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x7721('0x13')](function(_0x11f356){var _0x5a278e;for(var _0x2041a2=0x0;_0x2041a2{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x23d83d,_0x35a1e9){var _0x56da44=function(_0x4e7e7c){while(--_0x4e7e7c){_0x23d83d['push'](_0x23d83d['shift']());}};_0x56da44(++_0x35a1e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index e9640d4..4edd0f1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7c8=['PHONE','exports','INTEGER','STRING'];(function(_0x5b2f78,_0x5b508c){var _0x38f628=function(_0x100a17){while(--_0x100a17){_0x5b2f78['push'](_0x5b2f78['shift']());}};_0x38f628(++_0x5b508c);}(_0xb7c8,0x119));var _0x8b7c=function(_0x68c3a7,_0x1743fa){_0x68c3a7=_0x68c3a7-0x0;var _0x302476=_0xb7c8[_0x68c3a7];return _0x302476;};'use strict';var Sequelize=require('sequelize');module[_0x8b7c('0x0')]={'CmContactId':{'type':Sequelize[_0x8b7c('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8b7c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8b7c('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8b7c('0x2')],'defaultValue':_0x8b7c('0x3')},'OrderBy':{'type':Sequelize[_0x8b7c('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xc770=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x592db9,_0x200a85){var _0x3f52d4=function(_0xe22cd){while(--_0xe22cd){_0x592db9['push'](_0x592db9['shift']());}};_0x3f52d4(++_0x200a85);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c77('0x0'));module[_0x0c77('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0c77('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0c77('0x3')],'defaultValue':_0x0c77('0x4')},'OrderBy':{'type':Sequelize[_0x0c77('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x0c77('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index aa5e3ed..6859295 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef29=['util','path','to-csv','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','findAll','params','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x58374f,_0x2a57b2){var _0xb465b3=function(_0x11ad48){while(--_0x11ad48){_0x58374f['push'](_0x58374f['shift']());}};_0xb465b3(++_0x2a57b2);}(_0xef29,0x99));var _0x9ef2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xef29[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x9ef2('0x0'));var rimraf=require(_0x9ef2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ef2('0x2'));var rp=require(_0x9ef2('0x3'));var moment=require(_0x9ef2('0x4'));var BPromise=require(_0x9ef2('0x5'));var Mustache=require(_0x9ef2('0x6'));var util=require(_0x9ef2('0x7'));var path=require(_0x9ef2('0x8'));var sox=require('sox');var csv=require(_0x9ef2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ef2('0xa'));var squel=require('squel');var crypto=require(_0x9ef2('0xb'));var jsforce=require(_0x9ef2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9ef2('0x9'));var querystring=require(_0x9ef2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9ef2('0xe'));var qs=require(_0x9ef2('0xf'));var as=require(_0x9ef2('0x10'));var hardwareService=require(_0x9ef2('0x11'));var logger=require(_0x9ef2('0x12'))(_0x9ef2('0x13'));var utils=require(_0x9ef2('0x14'));var config=require(_0x9ef2('0x15'));var licenseUtil=require(_0x9ef2('0x16'));var db=require(_0x9ef2('0x17'))['db'];function respondWithStatusCode(_0x2b6501,_0xf71a67){_0xf71a67=_0xf71a67||0xcc;return function(_0x1e1d2d){if(_0x1e1d2d){return _0x2b6501['sendStatus'](_0xf71a67);}return _0x2b6501[_0x9ef2('0x18')](_0xf71a67)[_0x9ef2('0x19')]();};}function respondWithResult(_0x28510e,_0x77fd31){_0x77fd31=_0x77fd31||0xc8;return function(_0x294d28){if(_0x294d28){return _0x28510e[_0x9ef2('0x18')](_0x77fd31)[_0x9ef2('0x1a')](_0x294d28);}};}function respondWithFilteredResult(_0x5c4f1d,_0x32c4f0){return function(_0x43fdb3){if(_0x43fdb3){var _0x176a83=typeof _0x32c4f0[_0x9ef2('0x1b')]===_0x9ef2('0x1c')&&typeof _0x32c4f0[_0x9ef2('0x1d')]==='undefined';var _0x5de7f6=_0x43fdb3[_0x9ef2('0x1e')];var _0x1de703=_0x176a83?0x0:_0x32c4f0['offset'];var _0x495b37=_0x176a83?_0x43fdb3[_0x9ef2('0x1e')]:_0x32c4f0['offset']+_0x32c4f0[_0x9ef2('0x1d')];var _0x453fd6;if(_0x495b37>=_0x5de7f6){_0x495b37=_0x5de7f6;_0x453fd6=0xc8;}else{_0x453fd6=0xce;}_0x5c4f1d['status'](_0x453fd6);return _0x5c4f1d['set'](_0x9ef2('0x1f'),_0x1de703+'-'+_0x495b37+'/'+_0x5de7f6)[_0x9ef2('0x1a')](_0x43fdb3);}return null;};}function patchUpdates(_0x1ffdbf){return function(_0x1df32a){try{jsonpatch[_0x9ef2('0x20')](_0x1df32a,_0x1ffdbf,!![]);}catch(_0x541e4b){return BPromise['reject'](_0x541e4b);}return _0x1df32a[_0x9ef2('0x21')]();};}function saveUpdates(_0x69c0d4,_0xf46786){return function(_0x201764){if(_0x201764){return _0x201764[_0x9ef2('0x22')](_0x69c0d4)[_0x9ef2('0x23')](function(_0x13db10){return _0x13db10;});}return null;};}function removeEntity(_0x5ba100,_0x47fdde){return function(_0x23f251){if(_0x23f251){return _0x23f251[_0x9ef2('0x24')]()[_0x9ef2('0x23')](function(){var _0x5a7248=_0x23f251[_0x9ef2('0x25')]({'plain':!![]});var _0x3bd41e=_0x9ef2('0x26');return db[_0x9ef2('0x27')][_0x9ef2('0x24')]({'where':{'type':_0x3bd41e,'resourceId':_0x5a7248['id']}})[_0x9ef2('0x23')](function(){return _0x23f251;});})[_0x9ef2('0x23')](function(){_0x5ba100['status'](0xcc)[_0x9ef2('0x19')]();});}};}function handleEntityNotFound(_0x234a99,_0x146bdf){return function(_0x168133){if(!_0x168133){_0x234a99['sendStatus'](0x194);}return _0x168133;};}function handleError(_0x5f3c64,_0xa8f5df){_0xa8f5df=_0xa8f5df||0x1f4;return function(_0xd74edf){logger[_0x9ef2('0x28')](_0xd74edf[_0x9ef2('0x29')]);if(_0xd74edf['name']){delete _0xd74edf[_0x9ef2('0x2a')];}_0x5f3c64[_0x9ef2('0x18')](_0xa8f5df)[_0x9ef2('0x2b')](_0xd74edf);};}exports[_0x9ef2('0x2c')]=function(_0x4cd49b,_0x20a00b){var _0xb9e3f0={},_0x495663={},_0x3ef35b={'count':0x0,'rows':[]};var _0xe0aafc=_[_0x9ef2('0x2d')](db[_0x9ef2('0x2e')]['rawAttributes'],function(_0x5bfe57){return{'name':_0x5bfe57['fieldName'],'type':_0x5bfe57[_0x9ef2('0x2f')][_0x9ef2('0x30')]};});_0x495663[_0x9ef2('0x31')]=_[_0x9ef2('0x2d')](_0xe0aafc,_0x9ef2('0x2a'));_0x495663[_0x9ef2('0x32')]=_[_0x9ef2('0x33')](_0x4cd49b[_0x9ef2('0x32')]);_0x495663['filters']=_[_0x9ef2('0x34')](_0x495663[_0x9ef2('0x31')],_0x495663[_0x9ef2('0x32')]);_0xb9e3f0[_0x9ef2('0x35')]=_[_0x9ef2('0x34')](_0x495663[_0x9ef2('0x31')],qs[_0x9ef2('0x36')](_0x4cd49b['query'][_0x9ef2('0x36')]));_0xb9e3f0[_0x9ef2('0x35')]=_0xb9e3f0[_0x9ef2('0x35')]['length']?_0xb9e3f0[_0x9ef2('0x35')]:_0x495663[_0x9ef2('0x31')];if(!_0x4cd49b[_0x9ef2('0x32')][_0x9ef2('0x37')](_0x9ef2('0x38'))){_0xb9e3f0[_0x9ef2('0x1d')]=qs[_0x9ef2('0x1d')](_0x4cd49b[_0x9ef2('0x32')]['limit']);_0xb9e3f0[_0x9ef2('0x1b')]=qs[_0x9ef2('0x1b')](_0x4cd49b['query']['offset']);}_0xb9e3f0['order']=qs[_0x9ef2('0x39')](_0x4cd49b[_0x9ef2('0x32')]['sort']);_0xb9e3f0[_0x9ef2('0x3a')]=qs[_0x9ef2('0x3b')](_[_0x9ef2('0x3c')](_0x4cd49b['query'],_0x495663[_0x9ef2('0x3b')]),_0xe0aafc);if(_0x4cd49b['query'][_0x9ef2('0x3d')]){_0xb9e3f0[_0x9ef2('0x3a')]=_['merge'](_0xb9e3f0[_0x9ef2('0x3a')],{'$or':_[_0x9ef2('0x2d')](_0xe0aafc,function(_0x535722){if(_0x535722['type']!=='VIRTUAL'){var _0x108475={};_0x108475[_0x535722[_0x9ef2('0x2a')]]={'$like':'%'+_0x4cd49b['query'][_0x9ef2('0x3d')]+'%'};return _0x108475;}})});}_0xb9e3f0=_[_0x9ef2('0x3e')]({},_0xb9e3f0,_0x4cd49b['options']);var _0x4718f4={'where':_0xb9e3f0[_0x9ef2('0x3a')]};return db[_0x9ef2('0x2e')][_0x9ef2('0x1e')](_0x4718f4)[_0x9ef2('0x23')](function(_0x55dee5){_0x3ef35b[_0x9ef2('0x1e')]=_0x55dee5;if(_0x4cd49b[_0x9ef2('0x32')][_0x9ef2('0x3f')]){_0xb9e3f0[_0x9ef2('0x40')]=[{'all':!![]}];}return db[_0x9ef2('0x2e')][_0x9ef2('0x41')](_0xb9e3f0);})[_0x9ef2('0x23')](function(_0x26c46d){_0x3ef35b['rows']=_0x26c46d;return _0x3ef35b;})[_0x9ef2('0x23')](respondWithFilteredResult(_0x20a00b,_0xb9e3f0))['catch'](handleError(_0x20a00b,null));};exports['show']=function(_0x3839b5,_0x593e30){var _0x236935={'raw':!![],'where':{'id':_0x3839b5[_0x9ef2('0x42')]['id']}},_0x5ca9c9={};_0x5ca9c9[_0x9ef2('0x31')]=_[_0x9ef2('0x33')](db['CmContactHasItem']['rawAttributes']);_0x5ca9c9[_0x9ef2('0x32')]=_[_0x9ef2('0x33')](_0x3839b5[_0x9ef2('0x32')]);_0x5ca9c9[_0x9ef2('0x3b')]=_[_0x9ef2('0x34')](_0x5ca9c9[_0x9ef2('0x31')],_0x5ca9c9[_0x9ef2('0x32')]);_0x236935[_0x9ef2('0x35')]=_[_0x9ef2('0x34')](_0x5ca9c9[_0x9ef2('0x31')],qs[_0x9ef2('0x36')](_0x3839b5[_0x9ef2('0x32')][_0x9ef2('0x36')]));_0x236935[_0x9ef2('0x35')]=_0x236935[_0x9ef2('0x35')][_0x9ef2('0x43')]?_0x236935[_0x9ef2('0x35')]:_0x5ca9c9[_0x9ef2('0x31')];if(_0x3839b5['query']['includeAll']){_0x236935['include']=[{'all':!![]}];}_0x236935=_[_0x9ef2('0x3e')]({},_0x236935,_0x3839b5[_0x9ef2('0x44')]);return db[_0x9ef2('0x2e')]['find'](_0x236935)[_0x9ef2('0x23')](handleEntityNotFound(_0x593e30,null))['then'](respondWithResult(_0x593e30,null))['catch'](handleError(_0x593e30,null));};exports[_0x9ef2('0x45')]=function(_0x219246,_0x14239e){return db[_0x9ef2('0x2e')]['create'](_0x219246['body'],{})[_0x9ef2('0x23')](function(_0x233bb7){var _0x34d899=_0x219246[_0x9ef2('0x46')][_0x9ef2('0x25')]({'plain':!![]});if(!_0x34d899)throw new Error(_0x9ef2('0x47'));if(_0x34d899[_0x9ef2('0x48')]==='user'){var _0x2e0a41=_0x233bb7[_0x9ef2('0x25')]({'plain':!![]});var _0x3e60e9=_0x9ef2('0x26');return db[_0x9ef2('0x49')][_0x9ef2('0x4a')]({'where':{'name':_0x3e60e9,'userProfileId':_0x34d899[_0x9ef2('0x4b')]},'raw':!![]})[_0x9ef2('0x23')](function(_0x3cd9b2){if(_0x3cd9b2&&_0x3cd9b2[_0x9ef2('0x4c')]===0x0){return db['UserProfileResource'][_0x9ef2('0x45')]({'name':_0x2e0a41[_0x9ef2('0x2a')],'resourceId':_0x2e0a41['id'],'type':_0x3cd9b2[_0x9ef2('0x2a')],'sectionId':_0x3cd9b2['id']},{})[_0x9ef2('0x23')](function(){return _0x233bb7;});}else{return _0x233bb7;}})[_0x9ef2('0x4d')](function(_0xedc420){logger['error'](_0x9ef2('0x4e'),_0xedc420);throw _0xedc420;});}return _0x233bb7;})[_0x9ef2('0x23')](respondWithResult(_0x14239e,0xc9))[_0x9ef2('0x4d')](handleError(_0x14239e,null));};exports['update']=function(_0xc598e0,_0x3b1acd){if(_0xc598e0[_0x9ef2('0x4f')]['id']){delete _0xc598e0['body']['id'];}return db[_0x9ef2('0x2e')][_0x9ef2('0x4a')]({'where':{'id':_0xc598e0[_0x9ef2('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b1acd,null))[_0x9ef2('0x23')](saveUpdates(_0xc598e0[_0x9ef2('0x4f')],null))['then'](respondWithResult(_0x3b1acd,null))['catch'](handleError(_0x3b1acd,null));};exports[_0x9ef2('0x24')]=function(_0x409f74,_0x155bc8){return db[_0x9ef2('0x2e')]['find']({'where':{'id':_0x409f74[_0x9ef2('0x42')]['id']}})['then'](handleEntityNotFound(_0x155bc8,null))[_0x9ef2('0x23')](removeEntity(_0x155bc8,null))[_0x9ef2('0x4d')](handleError(_0x155bc8,null));}; \ No newline at end of file +var _0xf398=['offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x268f09,_0x5bdd72){var _0x3ffd96=function(_0x431971){while(--_0x431971){_0x268f09['push'](_0x268f09['shift']());}};_0x3ffd96(++_0x5bdd72);}(_0xf398,0x19a));var _0x8f39=function(_0x5568ab,_0x9ce69c){_0x5568ab=_0x5568ab-0x0;var _0x17c94f=_0xf398[_0x5568ab];return _0x17c94f;};'use strict';var emlformat=require(_0x8f39('0x0'));var rimraf=require(_0x8f39('0x1'));var zipdir=require(_0x8f39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8f39('0x3'));var BPromise=require(_0x8f39('0x4'));var Mustache=require(_0x8f39('0x5'));var util=require(_0x8f39('0x6'));var path=require(_0x8f39('0x7'));var sox=require(_0x8f39('0x8'));var csv=require(_0x8f39('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f39('0xa'));var _=require(_0x8f39('0xb'));var squel=require(_0x8f39('0xc'));var crypto=require(_0x8f39('0xd'));var jsforce=require(_0x8f39('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f39('0x9'));var querystring=require(_0x8f39('0xf'));var Papa=require(_0x8f39('0x10'));var Redis=require(_0x8f39('0x11'));var authService=require(_0x8f39('0x12'));var qs=require(_0x8f39('0x13'));var as=require(_0x8f39('0x14'));var hardwareService=require(_0x8f39('0x15'));var logger=require(_0x8f39('0x16'))(_0x8f39('0x17'));var utils=require(_0x8f39('0x18'));var config=require(_0x8f39('0x19'));var licenseUtil=require(_0x8f39('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487d0d,_0xb7a53d){_0xb7a53d=_0xb7a53d||0xcc;return function(_0x563347){if(_0x563347){return _0x487d0d[_0x8f39('0x1b')](_0xb7a53d);}return _0x487d0d[_0x8f39('0x1c')](_0xb7a53d)['end']();};}function respondWithResult(_0x3f0618,_0x2c7dd9){_0x2c7dd9=_0x2c7dd9||0xc8;return function(_0x2dd957){if(_0x2dd957){return _0x3f0618[_0x8f39('0x1c')](_0x2c7dd9)[_0x8f39('0x1d')](_0x2dd957);}};}function respondWithFilteredResult(_0x38bd60,_0x2791e3){return function(_0x3d0c83){if(_0x3d0c83){var _0x191547=typeof _0x2791e3[_0x8f39('0x1e')]===_0x8f39('0x1f')&&typeof _0x2791e3[_0x8f39('0x20')]==='undefined';var _0x12de09=_0x3d0c83[_0x8f39('0x21')];var _0x2e8157=_0x191547?0x0:_0x2791e3[_0x8f39('0x1e')];var _0x460885=_0x191547?_0x3d0c83['count']:_0x2791e3[_0x8f39('0x1e')]+_0x2791e3[_0x8f39('0x20')];var _0x439ad9;if(_0x460885>=_0x12de09){_0x460885=_0x12de09;_0x439ad9=0xc8;}else{_0x439ad9=0xce;}_0x38bd60[_0x8f39('0x1c')](_0x439ad9);return _0x38bd60['set'](_0x8f39('0x22'),_0x2e8157+'-'+_0x460885+'/'+_0x12de09)['json'](_0x3d0c83);}return null;};}function patchUpdates(_0x3341a8){return function(_0x2f0f21){try{jsonpatch[_0x8f39('0x23')](_0x2f0f21,_0x3341a8,!![]);}catch(_0x46f0a9){return BPromise[_0x8f39('0x24')](_0x46f0a9);}return _0x2f0f21[_0x8f39('0x25')]();};}function saveUpdates(_0x48e7d7,_0x5acae6){return function(_0x4f1ebe){if(_0x4f1ebe){return _0x4f1ebe['update'](_0x48e7d7)['then'](function(_0x1942dd){return _0x1942dd;});}return null;};}function removeEntity(_0x1bef86,_0x1829a2){return function(_0x405747){if(_0x405747){return _0x405747['destroy']()[_0x8f39('0x26')](function(){var _0x149d3a=_0x405747[_0x8f39('0x27')]({'plain':!![]});var _0x2e3d16=_0x8f39('0x28');return db[_0x8f39('0x29')][_0x8f39('0x2a')]({'where':{'type':_0x2e3d16,'resourceId':_0x149d3a['id']}})[_0x8f39('0x26')](function(){return _0x405747;});})[_0x8f39('0x26')](function(){_0x1bef86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8713,_0x3c343c){return function(_0x25cfe4){if(!_0x25cfe4){_0x4e8713[_0x8f39('0x1b')](0x194);}return _0x25cfe4;};}function handleError(_0x274f5f,_0x38637b){_0x38637b=_0x38637b||0x1f4;return function(_0x580d85){logger[_0x8f39('0x2b')](_0x580d85[_0x8f39('0x2c')]);if(_0x580d85['name']){delete _0x580d85[_0x8f39('0x2d')];}_0x274f5f[_0x8f39('0x1c')](_0x38637b)[_0x8f39('0x2e')](_0x580d85);};}exports[_0x8f39('0x2f')]=function(_0x4524d3,_0x825e15){var _0x2c0371={},_0x5bd30e={},_0x2fc71d={'count':0x0,'rows':[]};var _0xe812fe=_['map'](db[_0x8f39('0x30')][_0x8f39('0x31')],function(_0x854626){return{'name':_0x854626[_0x8f39('0x32')],'type':_0x854626[_0x8f39('0x33')][_0x8f39('0x34')]};});_0x5bd30e[_0x8f39('0x35')]=_[_0x8f39('0x36')](_0xe812fe,'name');_0x5bd30e[_0x8f39('0x37')]=_['keys'](_0x4524d3[_0x8f39('0x37')]);_0x5bd30e[_0x8f39('0x38')]=_[_0x8f39('0x39')](_0x5bd30e[_0x8f39('0x35')],_0x5bd30e[_0x8f39('0x37')]);_0x2c0371[_0x8f39('0x3a')]=_['intersection'](_0x5bd30e['model'],qs[_0x8f39('0x3b')](_0x4524d3[_0x8f39('0x37')][_0x8f39('0x3b')]));_0x2c0371[_0x8f39('0x3a')]=_0x2c0371[_0x8f39('0x3a')][_0x8f39('0x3c')]?_0x2c0371[_0x8f39('0x3a')]:_0x5bd30e[_0x8f39('0x35')];if(!_0x4524d3[_0x8f39('0x37')][_0x8f39('0x3d')](_0x8f39('0x3e'))){_0x2c0371[_0x8f39('0x20')]=qs[_0x8f39('0x20')](_0x4524d3['query'][_0x8f39('0x20')]);_0x2c0371[_0x8f39('0x1e')]=qs[_0x8f39('0x1e')](_0x4524d3[_0x8f39('0x37')][_0x8f39('0x1e')]);}_0x2c0371[_0x8f39('0x3f')]=qs[_0x8f39('0x40')](_0x4524d3['query'][_0x8f39('0x40')]);_0x2c0371[_0x8f39('0x41')]=qs[_0x8f39('0x38')](_[_0x8f39('0x42')](_0x4524d3[_0x8f39('0x37')],_0x5bd30e[_0x8f39('0x38')]),_0xe812fe);if(_0x4524d3[_0x8f39('0x37')]['filter']){_0x2c0371[_0x8f39('0x41')]=_['merge'](_0x2c0371['where'],{'$or':_[_0x8f39('0x36')](_0xe812fe,function(_0x212d40){if(_0x212d40[_0x8f39('0x33')]!==_0x8f39('0x43')){var _0x5c7463={};_0x5c7463[_0x212d40[_0x8f39('0x2d')]]={'$like':'%'+_0x4524d3[_0x8f39('0x37')]['filter']+'%'};return _0x5c7463;}})});}_0x2c0371=_[_0x8f39('0x44')]({},_0x2c0371,_0x4524d3[_0x8f39('0x45')]);var _0x4aaaa7={'where':_0x2c0371[_0x8f39('0x41')]};return db[_0x8f39('0x30')][_0x8f39('0x21')](_0x4aaaa7)['then'](function(_0x35d8e7){_0x2fc71d['count']=_0x35d8e7;if(_0x4524d3[_0x8f39('0x37')][_0x8f39('0x46')]){_0x2c0371['include']=[{'all':!![]}];}return db[_0x8f39('0x30')][_0x8f39('0x47')](_0x2c0371);})['then'](function(_0x2005eb){_0x2fc71d['rows']=_0x2005eb;return _0x2fc71d;})[_0x8f39('0x26')](respondWithFilteredResult(_0x825e15,_0x2c0371))[_0x8f39('0x48')](handleError(_0x825e15,null));};exports[_0x8f39('0x49')]=function(_0x21ad88,_0x3ffae6){var _0x1e8e13={'raw':!![],'where':{'id':_0x21ad88[_0x8f39('0x4a')]['id']}},_0x536d7e={};_0x536d7e[_0x8f39('0x35')]=_[_0x8f39('0x4b')](db[_0x8f39('0x30')]['rawAttributes']);_0x536d7e['query']=_[_0x8f39('0x4b')](_0x21ad88[_0x8f39('0x37')]);_0x536d7e[_0x8f39('0x38')]=_[_0x8f39('0x39')](_0x536d7e[_0x8f39('0x35')],_0x536d7e['query']);_0x1e8e13[_0x8f39('0x3a')]=_[_0x8f39('0x39')](_0x536d7e[_0x8f39('0x35')],qs[_0x8f39('0x3b')](_0x21ad88[_0x8f39('0x37')][_0x8f39('0x3b')]));_0x1e8e13[_0x8f39('0x3a')]=_0x1e8e13[_0x8f39('0x3a')]['length']?_0x1e8e13[_0x8f39('0x3a')]:_0x536d7e['model'];if(_0x21ad88[_0x8f39('0x37')][_0x8f39('0x46')]){_0x1e8e13[_0x8f39('0x4c')]=[{'all':!![]}];}_0x1e8e13=_[_0x8f39('0x44')]({},_0x1e8e13,_0x21ad88[_0x8f39('0x45')]);return db[_0x8f39('0x30')][_0x8f39('0x4d')](_0x1e8e13)[_0x8f39('0x26')](handleEntityNotFound(_0x3ffae6,null))['then'](respondWithResult(_0x3ffae6,null))[_0x8f39('0x48')](handleError(_0x3ffae6,null));};exports['create']=function(_0x5b89b0,_0x45593d){return db[_0x8f39('0x30')]['create'](_0x5b89b0[_0x8f39('0x4e')],{})['then'](function(_0x51e9e0){var _0x373f5d=_0x5b89b0[_0x8f39('0x4f')]['get']({'plain':!![]});if(!_0x373f5d)throw new Error(_0x8f39('0x50'));if(_0x373f5d[_0x8f39('0x51')]===_0x8f39('0x4f')){var _0x2f5ec0=_0x51e9e0[_0x8f39('0x27')]({'plain':!![]});var _0x1dcb55='CmContactHasItems';return db[_0x8f39('0x52')]['find']({'where':{'name':_0x1dcb55,'userProfileId':_0x373f5d[_0x8f39('0x53')]},'raw':!![]})[_0x8f39('0x26')](function(_0x4f6335){if(_0x4f6335&&_0x4f6335[_0x8f39('0x54')]===0x0){return db[_0x8f39('0x29')][_0x8f39('0x55')]({'name':_0x2f5ec0[_0x8f39('0x2d')],'resourceId':_0x2f5ec0['id'],'type':_0x4f6335[_0x8f39('0x2d')],'sectionId':_0x4f6335['id']},{})['then'](function(){return _0x51e9e0;});}else{return _0x51e9e0;}})['catch'](function(_0xe2334){logger[_0x8f39('0x2b')](_0x8f39('0x56'),_0xe2334);throw _0xe2334;});}return _0x51e9e0;})[_0x8f39('0x26')](respondWithResult(_0x45593d,0xc9))['catch'](handleError(_0x45593d,null));};exports[_0x8f39('0x57')]=function(_0x5bf6e9,_0x55a3ec){if(_0x5bf6e9[_0x8f39('0x4e')]['id']){delete _0x5bf6e9[_0x8f39('0x4e')]['id'];}return db[_0x8f39('0x30')]['find']({'where':{'id':_0x5bf6e9['params']['id']}})['then'](handleEntityNotFound(_0x55a3ec,null))[_0x8f39('0x26')](saveUpdates(_0x5bf6e9['body'],null))[_0x8f39('0x26')](respondWithResult(_0x55a3ec,null))[_0x8f39('0x48')](handleError(_0x55a3ec,null));};exports['destroy']=function(_0x2f829a,_0x39e466){return db[_0x8f39('0x30')]['find']({'where':{'id':_0x2f829a[_0x8f39('0x4a')]['id']}})[_0x8f39('0x26')](handleEntityNotFound(_0x39e466,null))[_0x8f39('0x26')](removeEntity(_0x39e466,null))[_0x8f39('0x48')](handleError(_0x39e466,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9628f2d..b7424d9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d5=['define','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports'];(function(_0x2cdb8f,_0x1e35f9){var _0x2040fa=function(_0xd6d153){while(--_0xd6d153){_0x2cdb8f['push'](_0x2cdb8f['shift']());}};_0x2040fa(++_0x1e35f9);}(_0x57d5,0x1b2));var _0x557d=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x57d5[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x557d('0x0'));var logger=require(_0x557d('0x1'))('api');var moment=require(_0x557d('0x2'));var BPromise=require(_0x557d('0x3'));var rp=require(_0x557d('0x4'));var fs=require('fs');var path=require(_0x557d('0x5'));var rimraf=require(_0x557d('0x6'));var config=require(_0x557d('0x7'));var attributes=require(_0x557d('0x8'));module[_0x557d('0x9')]=function(_0x2e3fe8,_0x6e5c70){return _0x2e3fe8[_0x557d('0xa')]('CmContactHasItem',attributes,{'tableName':_0x557d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8965=['../../config/logger','api','bluebird','rimraf','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','util'];(function(_0x59cedc,_0x8ed4e8){var _0x4f007a=function(_0x4aedd4){while(--_0x4aedd4){_0x59cedc['push'](_0x59cedc['shift']());}};_0x4f007a(++_0x8ed4e8);}(_0x8965,0x17b));var _0x5896=function(_0x5ab837,_0x347638){_0x5ab837=_0x5ab837-0x0;var _0x1ecccd=_0x8965[_0x5ab837];return _0x1ecccd;};'use strict';var _=require('lodash');var util=require(_0x5896('0x0'));var logger=require(_0x5896('0x1'))(_0x5896('0x2'));var moment=require('moment');var BPromise=require(_0x5896('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5896('0x4'));var config=require(_0x5896('0x5'));var attributes=require(_0x5896('0x6'));module['exports']=function(_0x534cf4,_0x536835){return _0x534cf4[_0x5896('0x7')](_0x5896('0x8'),attributes,{'tableName':_0x5896('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index b6b8eaa..a9ba86b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fec=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x303a2e,_0x16d1dc){var _0x12c2ba=function(_0x61fdc0){while(--_0x61fdc0){_0x303a2e['push'](_0x303a2e['shift']());}};_0x12c2ba(++_0x16d1dc);}(_0x3fec,0x197));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc3fe('0x0'));var util=require(_0xc3fe('0x1'));var moment=require(_0xc3fe('0x2'));var BPromise=require(_0xc3fe('0x3'));var rs=require(_0xc3fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3fe('0x5'));var logger=require(_0xc3fe('0x6'))(_0xc3fe('0x7'));var config=require(_0xc3fe('0x8'));var jayson=require(_0xc3fe('0x9'));var client=jayson[_0xc3fe('0xa')][_0xc3fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50d24f,_0x23ea03,_0x57ffd6){return new BPromise(function(_0x33de81,_0x316b61){return client[_0xc3fe('0xc')](_0x50d24f,_0x57ffd6)[_0xc3fe('0xd')](function(_0x1f4a27){logger[_0xc3fe('0xe')](_0xc3fe('0xf'),_0x23ea03,_0xc3fe('0x10'));logger[_0xc3fe('0x11')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x23ea03,_0xc3fe('0x10'),JSON[_0xc3fe('0x12')](_0x1f4a27));if(_0x1f4a27[_0xc3fe('0x13')]){if(_0x1f4a27[_0xc3fe('0x13')][_0xc3fe('0x14')]===0x1f4){logger[_0xc3fe('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x23ea03,_0x1f4a27[_0xc3fe('0x13')][_0xc3fe('0x15')]);return _0x316b61(_0x1f4a27[_0xc3fe('0x13')][_0xc3fe('0x15')]);}logger['error'](_0xc3fe('0xf'),_0x23ea03,_0x1f4a27[_0xc3fe('0x13')][_0xc3fe('0x15')]);return _0x33de81(_0x1f4a27['error']['message']);}else{logger['info'](_0xc3fe('0xf'),_0x23ea03,'request\x20sent');_0x33de81(_0x1f4a27[_0xc3fe('0x16')][_0xc3fe('0x15')]);}})[_0xc3fe('0x17')](function(_0x2f774b){logger[_0xc3fe('0x13')](_0xc3fe('0xf'),_0x23ea03,_0x2f774b);_0x316b61(_0x2f774b);});});} \ No newline at end of file +var _0x2516=['http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x16babe,_0x579274){var _0x1faf00=function(_0x4ef767){while(--_0x4ef767){_0x16babe['push'](_0x16babe['shift']());}};_0x1faf00(++_0x579274);}(_0x2516,0x73));var _0x6251=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x2516[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var moment=require(_0x6251('0x2'));var BPromise=require(_0x6251('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6251('0x4'));var db=require(_0x6251('0x5'))['db'];var utils=require(_0x6251('0x6'));var logger=require(_0x6251('0x7'))(_0x6251('0x8'));var config=require('../../config/environment');var jayson=require(_0x6251('0x9'));var client=jayson[_0x6251('0xa')][_0x6251('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x470cd5,_0x541716,_0x410c64){return new BPromise(function(_0x3b9200,_0x160618){return client['request'](_0x470cd5,_0x410c64)[_0x6251('0xc')](function(_0x593fbb){logger[_0x6251('0xd')](_0x6251('0xe'),_0x541716,_0x6251('0xf'));logger['debug'](_0x6251('0x10'),_0x541716,_0x6251('0xf'),JSON[_0x6251('0x11')](_0x593fbb));if(_0x593fbb['error']){if(_0x593fbb[_0x6251('0x12')][_0x6251('0x13')]===0x1f4){logger[_0x6251('0x12')](_0x6251('0xe'),_0x541716,_0x593fbb[_0x6251('0x12')][_0x6251('0x14')]);return _0x160618(_0x593fbb['error'][_0x6251('0x14')]);}logger[_0x6251('0x12')](_0x6251('0xe'),_0x541716,_0x593fbb['error'][_0x6251('0x14')]);return _0x3b9200(_0x593fbb[_0x6251('0x12')][_0x6251('0x14')]);}else{logger[_0x6251('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x541716,_0x6251('0xf'));_0x3b9200(_0x593fbb['result'][_0x6251('0x14')]);}})['catch'](function(_0x580b54){logger['error'](_0x6251('0xe'),_0x541716,_0x580b54);_0x160618(_0x580b54);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 917b4ce..d533388 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc615=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x22185a,_0x2c9c0f){var _0x27e1f1=function(_0x9ed420){while(--_0x9ed420){_0x22185a['push'](_0x22185a['shift']());}};_0x27e1f1(++_0x2c9c0f);}(_0xc615,0x128));var _0x5c61=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0xc615[_0x1c156e];return _0x58fc22;};'use strict';var multer=require(_0x5c61('0x0'));var util=require(_0x5c61('0x1'));var path=require(_0x5c61('0x2'));var timeout=require(_0x5c61('0x3'));var express=require(_0x5c61('0x4'));var router=express[_0x5c61('0x5')]();var fs_extra=require(_0x5c61('0x6'));var auth=require(_0x5c61('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5c61('0x8'));var controller=require(_0x5c61('0x9'));router[_0x5c61('0xa')]('/',auth[_0x5c61('0xb')](),controller[_0x5c61('0xc')]);router[_0x5c61('0xa')](_0x5c61('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5c61('0xe')]('/',auth[_0x5c61('0xb')](),controller[_0x5c61('0xf')]);router['put'](_0x5c61('0xd'),auth[_0x5c61('0xb')](),controller['update']);router[_0x5c61('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5c61('0x11')]);module[_0x5c61('0x12')]=router; \ No newline at end of file +var _0xaf53=['../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x13c7eb,_0xa2dbca){var _0x25bcde=function(_0x262249){while(--_0x262249){_0x13c7eb['push'](_0x13c7eb['shift']());}};_0x25bcde(++_0xa2dbca);}(_0xaf53,0x1d8));var _0x3af5=function(_0x1d9774,_0x38278c){_0x1d9774=_0x1d9774-0x0;var _0x30c9a0=_0xaf53[_0x1d9774];return _0x30c9a0;};'use strict';var multer=require('multer');var util=require(_0x3af5('0x0'));var path=require('path');var timeout=require(_0x3af5('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3af5('0x2'));var auth=require(_0x3af5('0x3'));var interaction=require(_0x3af5('0x4'));var config=require(_0x3af5('0x5'));var controller=require(_0x3af5('0x6'));router['get']('/',auth[_0x3af5('0x7')](),controller[_0x3af5('0x8')]);router[_0x3af5('0x9')](_0x3af5('0xa'),auth[_0x3af5('0x7')](),controller['show']);router[_0x3af5('0xb')]('/',auth[_0x3af5('0x7')](),controller[_0x3af5('0xc')]);router[_0x3af5('0xd')](_0x3af5('0xa'),auth[_0x3af5('0x7')](),controller[_0x3af5('0xe')]);router[_0x3af5('0xf')](_0x3af5('0xa'),auth['isAuthenticated'](),controller[_0x3af5('0x10')]);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 85b40a9..6428c72 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 _0x90f9=['TEXT','long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','sequelize','getDataValue','STRING','alias','name'];(function(_0x427444,_0xf966d1){var _0x356dca=function(_0x28b183){while(--_0x28b183){_0x427444['push'](_0x427444['shift']());}};_0x356dca(++_0xf966d1);}(_0x90f9,0x8b));var _0x990f=function(_0x563318,_0x1ee60f){_0x563318=_0x563318-0x0;var _0x2f345c=_0x90f9[_0x563318];return _0x2f345c;};'use strict';var Sequelize=require(_0x990f('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x59cca6){return this[_0x990f('0x1')]('alias');}},'alias':{'type':Sequelize[_0x990f('0x2')],'allowNull':![],'set':function(_0x17edb4){this['setDataValue'](_0x990f('0x3'),_0x17edb4?_0x17edb4:this[_0x990f('0x1')](_0x990f('0x4')));}},'type':{'type':Sequelize[_0x990f('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x990f('0x5')](_0x990f('0x6')),'get':function(){if(this['getDataValue'](_0x990f('0x7'))===_0x990f('0x8')){return JSON[_0x990f('0x9')](this[_0x990f('0x1')](_0x990f('0xa')));}else{return this['getDataValue'](_0x990f('0xa'));}},'set':function(_0x101e35){if(Array[_0x990f('0xb')](_0x101e35)){this[_0x990f('0xc')]('values',JSON[_0x990f('0xd')](_0x101e35));}else{this[_0x990f('0xc')](_0x990f('0xa'),_0x101e35);}}},'required':{'type':Sequelize[_0x990f('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x990f('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x990f('0xf')]('voice')}}; \ No newline at end of file +var _0xa7ce=['alias','STRING','setDataValue','name','TEXT','type','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','getDataValue'];(function(_0x1eaab8,_0x2b438c){var _0x293ad3=function(_0x30d07a){while(--_0x30d07a){_0x1eaab8['push'](_0x1eaab8['shift']());}};_0x293ad3(++_0x2b438c);}(_0xa7ce,0x66));var _0xea7c=function(_0x8218b7,_0x20e38e){_0x8218b7=_0x8218b7-0x0;var _0x516772=_0xa7ce[_0x8218b7];return _0x516772;};'use strict';var Sequelize=require(_0xea7c('0x0'));var _=require(_0xea7c('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x170c2a){return this[_0xea7c('0x2')](_0xea7c('0x3'));}},'alias':{'type':Sequelize[_0xea7c('0x4')],'allowNull':![],'set':function(_0x3ccbca){this[_0xea7c('0x5')](_0xea7c('0x3'),_0x3ccbca?_0x3ccbca:this[_0xea7c('0x2')](_0xea7c('0x6')));}},'type':{'type':Sequelize[_0xea7c('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xea7c('0x7')]('long'),'get':function(){if(this['getDataValue'](_0xea7c('0x8'))==='select'){return JSON[_0xea7c('0x9')](this['getDataValue']('values'));}else{return this[_0xea7c('0x2')](_0xea7c('0xa'));}},'set':function(_0x176829){if(Array[_0xea7c('0xb')](_0x176829)){this[_0xea7c('0x5')]('values',JSON[_0xea7c('0xc')](_0x176829));}else{this[_0xea7c('0x5')](_0xea7c('0xa'),_0x176829);}}},'required':{'type':Sequelize[_0xea7c('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xea7c('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xea7c('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 36e81e9..2b27435 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 _0x22df=['options','CmCustomField','includeAll','include','findAll','show','params','body','find','catch','create','sequelize','transaction','TEXT','number','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x2a4d34,_0x531aa){var _0xf16b51=function(_0x2a621c){while(--_0x2a621c){_0x2a4d34['push'](_0x2a4d34['shift']());}};_0xf16b51(++_0x531aa);}(_0x22df,0x11c));var _0xf22d=function(_0x3b2322,_0x3d5350){_0x3b2322=_0x3b2322-0x0;var _0x5c9382=_0x22df[_0x3b2322];return _0x5c9382;};'use strict';var emlformat=require(_0xf22d('0x0'));var rimraf=require(_0xf22d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf22d('0x2'));var rp=require(_0xf22d('0x3'));var moment=require(_0xf22d('0x4'));var BPromise=require(_0xf22d('0x5'));var Mustache=require(_0xf22d('0x6'));var util=require(_0xf22d('0x7'));var path=require(_0xf22d('0x8'));var sox=require(_0xf22d('0x9'));var csv=require(_0xf22d('0xa'));var ejs=require(_0xf22d('0xb'));var fs=require('fs');var fs_extra=require(_0xf22d('0xc'));var _=require(_0xf22d('0xd'));var squel=require(_0xf22d('0xe'));var crypto=require('crypto');var jsforce=require(_0xf22d('0xf'));var deskjs=require(_0xf22d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf22d('0x11'));var Papa=require(_0xf22d('0x12'));var Redis=require('ioredis');var authService=require(_0xf22d('0x13'));var qs=require(_0xf22d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf22d('0x15'));var logger=require(_0xf22d('0x16'))(_0xf22d('0x17'));var utils=require(_0xf22d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c97c,_0x42060a){_0x42060a=_0x42060a||0xcc;return function(_0x2cf75a){if(_0x2cf75a){return _0x25c97c['sendStatus'](_0x42060a);}return _0x25c97c[_0xf22d('0x19')](_0x42060a)[_0xf22d('0x1a')]();};}function respondWithResult(_0x58fa4e,_0x2afceb){_0x2afceb=_0x2afceb||0xc8;return function(_0xc56cc8){if(_0xc56cc8){return _0x58fa4e['status'](_0x2afceb)['json'](_0xc56cc8);}};}function respondWithFilteredResult(_0x8bb04f,_0x16b90f){return function(_0x5925b9){if(_0x5925b9){var _0xdf52a=typeof _0x16b90f[_0xf22d('0x1b')]===_0xf22d('0x1c')&&typeof _0x16b90f[_0xf22d('0x1d')]===_0xf22d('0x1c');var _0x1ffa12=_0x5925b9[_0xf22d('0x1e')];var _0x5d5b63=_0xdf52a?0x0:_0x16b90f[_0xf22d('0x1b')];var _0x435c79=_0xdf52a?_0x5925b9[_0xf22d('0x1e')]:_0x16b90f['offset']+_0x16b90f[_0xf22d('0x1d')];var _0x2594d1;if(_0x435c79>=_0x1ffa12){_0x435c79=_0x1ffa12;_0x2594d1=0xc8;}else{_0x2594d1=0xce;}_0x8bb04f[_0xf22d('0x19')](_0x2594d1);return _0x8bb04f[_0xf22d('0x1f')](_0xf22d('0x20'),_0x5d5b63+'-'+_0x435c79+'/'+_0x1ffa12)[_0xf22d('0x21')](_0x5925b9);}return null;};}function patchUpdates(_0x25e72a){return function(_0x18ed50){try{jsonpatch[_0xf22d('0x22')](_0x18ed50,_0x25e72a,!![]);}catch(_0x2f64f2){return BPromise[_0xf22d('0x23')](_0x2f64f2);}return _0x18ed50[_0xf22d('0x24')]();};}function saveUpdates(_0x4ab961,_0x5834d5){return function(_0x5c560f){if(_0x5c560f){return _0x5c560f[_0xf22d('0x25')](_0x4ab961)['then'](function(_0x9795d2){return _0x9795d2;});}return null;};}function removeEntity(_0x2ea732,_0x52f924){return function(_0x2dd3eb){if(_0x2dd3eb){return _0x2dd3eb[_0xf22d('0x26')]()[_0xf22d('0x27')](function(){_0x2ea732['status'](0xcc)[_0xf22d('0x1a')]();});}};}function handleEntityNotFound(_0x336fb3,_0x49add5){return function(_0x32fc3a){if(!_0x32fc3a){_0x336fb3['sendStatus'](0x194);}return _0x32fc3a;};}function handleError(_0x2a5e82,_0x389ac4){_0x389ac4=_0x389ac4||0x1f4;return function(_0x1fb156){logger[_0xf22d('0x28')](_0x1fb156[_0xf22d('0x29')]);if(_0x1fb156[_0xf22d('0x2a')]){delete _0x1fb156['name'];}_0x2a5e82['status'](_0x389ac4)[_0xf22d('0x2b')](_0x1fb156);};}exports[_0xf22d('0x2c')]=function(_0x5e175c,_0x148f55){var _0x1a6db7={},_0x11602d={},_0x76f0af={'count':0x0,'rows':[]};var _0x834291=_[_0xf22d('0x2d')](db['CmCustomField'][_0xf22d('0x2e')],function(_0x393233){return{'name':_0x393233[_0xf22d('0x2f')],'type':_0x393233[_0xf22d('0x30')][_0xf22d('0x31')]};});_0x11602d['model']=_[_0xf22d('0x32')](_[_0xf22d('0x2d')](_0x834291,_0xf22d('0x2a')),['name']);_0x11602d[_0xf22d('0x33')]=_[_0xf22d('0x34')](_0x5e175c['query']);_0x11602d[_0xf22d('0x35')]=_[_0xf22d('0x36')](_0x11602d[_0xf22d('0x37')],_0x11602d[_0xf22d('0x33')]);_0x1a6db7[_0xf22d('0x38')]=_['intersection'](_0x11602d['model'],qs[_0xf22d('0x39')](_0x5e175c[_0xf22d('0x33')][_0xf22d('0x39')]));_0x1a6db7[_0xf22d('0x38')]=_0x1a6db7[_0xf22d('0x38')][_0xf22d('0x3a')]?_0x1a6db7['attributes']:_0x11602d[_0xf22d('0x37')];if(!_0x5e175c[_0xf22d('0x33')][_0xf22d('0x3b')](_0xf22d('0x3c'))){_0x1a6db7[_0xf22d('0x1d')]=qs[_0xf22d('0x1d')](_0x5e175c[_0xf22d('0x33')][_0xf22d('0x1d')]);_0x1a6db7[_0xf22d('0x1b')]=qs[_0xf22d('0x1b')](_0x5e175c[_0xf22d('0x33')][_0xf22d('0x1b')]);}_0x1a6db7[_0xf22d('0x3d')]=qs[_0xf22d('0x3e')](_0x5e175c[_0xf22d('0x33')][_0xf22d('0x3e')]);_0x1a6db7[_0xf22d('0x3f')]=qs['filters'](_[_0xf22d('0x40')](_0x5e175c[_0xf22d('0x33')],_0x11602d[_0xf22d('0x35')]),_0x834291);if(_0x5e175c[_0xf22d('0x33')][_0xf22d('0x41')]){_0x1a6db7[_0xf22d('0x3f')]=_[_0xf22d('0x42')](_0x1a6db7['where'],{'$or':_['map'](_0x834291,function(_0x167249){if(_0x167249[_0xf22d('0x30')]!==_0xf22d('0x43')){var _0x431a4b={};_0x431a4b[_0x167249[_0xf22d('0x2a')]]={'$like':'%'+_0x5e175c[_0xf22d('0x33')][_0xf22d('0x41')]+'%'};return _0x431a4b;}})});}_0x1a6db7=_['merge']({},_0x1a6db7,_0x5e175c[_0xf22d('0x44')]);var _0x11904b={'where':_0x1a6db7[_0xf22d('0x3f')]};return db[_0xf22d('0x45')][_0xf22d('0x1e')](_0x11904b)[_0xf22d('0x27')](function(_0x15120c){_0x76f0af[_0xf22d('0x1e')]=_0x15120c;if(_0x5e175c[_0xf22d('0x33')][_0xf22d('0x46')]){_0x1a6db7[_0xf22d('0x47')]=[{'all':!![]}];}return db[_0xf22d('0x45')][_0xf22d('0x48')](_0x1a6db7);})['then'](function(_0x1c1502){_0x76f0af['rows']=_0x1c1502;return _0x76f0af;})[_0xf22d('0x27')](respondWithFilteredResult(_0x148f55,_0x1a6db7))['catch'](handleError(_0x148f55,null));};exports[_0xf22d('0x49')]=function(_0x269a72,_0x1864f0){var _0x124a35={'raw':!![],'where':{'id':_0x269a72[_0xf22d('0x4a')]['id']}},_0x1bd69b={};_0x1bd69b[_0xf22d('0x37')]=_[_0xf22d('0x34')](db[_0xf22d('0x45')][_0xf22d('0x2e')]);_0x1bd69b[_0xf22d('0x33')]=_[_0xf22d('0x34')](_0x269a72[_0xf22d('0x33')]);_0x1bd69b['filters']=_[_0xf22d('0x36')](_0x1bd69b[_0xf22d('0x37')],_0x1bd69b[_0xf22d('0x33')]);_0x124a35[_0xf22d('0x38')]=_[_0xf22d('0x36')](_0x1bd69b[_0xf22d('0x37')],qs['fields'](_0x269a72[_0xf22d('0x33')][_0xf22d('0x39')]));_0x124a35[_0xf22d('0x38')]=_0x124a35[_0xf22d('0x38')][_0xf22d('0x3a')]?_0x124a35[_0xf22d('0x38')]:_0x1bd69b[_0xf22d('0x37')];if(_0x269a72['query'][_0xf22d('0x46')]){_0x124a35[_0xf22d('0x47')]=[{'all':!![]}];}_0x124a35=_[_0xf22d('0x42')]({},_0x124a35,_0x269a72['options']);return db[_0xf22d('0x45')]['find'](_0x124a35)['then'](handleEntityNotFound(_0x1864f0,null))[_0xf22d('0x27')](respondWithResult(_0x1864f0,null))['catch'](handleError(_0x1864f0,null));};exports[_0xf22d('0x25')]=function(_0x208f88,_0x3c8286){if(_0x208f88['body']['id']){delete _0x208f88[_0xf22d('0x4b')]['id'];}return db[_0xf22d('0x45')][_0xf22d('0x4c')]({'where':{'id':_0x208f88['params']['id']}})[_0xf22d('0x27')](handleEntityNotFound(_0x3c8286,null))[_0xf22d('0x27')](saveUpdates(_0x208f88[_0xf22d('0x4b')],null))[_0xf22d('0x27')](respondWithResult(_0x3c8286,null))[_0xf22d('0x4d')](handleError(_0x3c8286,null));};exports[_0xf22d('0x26')]=function(_0x86d72c,_0x1a1927){return db['CmCustomField'][_0xf22d('0x4c')]({'where':{'id':_0x86d72c['params']['id']}})['then'](handleEntityNotFound(_0x1a1927,null))['then'](removeEntity(_0x1a1927,null))['catch'](handleError(_0x1a1927,null));};exports[_0xf22d('0x4e')]=function(_0x101a15,_0x34fe12){var _0x42996d;return db[_0xf22d('0x4f')][_0xf22d('0x50')](function(_0x3f17b4){return db[_0xf22d('0x45')]['create'](_0x101a15[_0xf22d('0x4b')],{'transaction':_0x3f17b4})[_0xf22d('0x27')](function(_0x5e571e){_0x42996d=_0x5e571e;var _0x3fffc0={'type':db['Sequelize']['TEXT'],'transaction':_0x3f17b4};switch(_0x101a15[_0xf22d('0x4b')][_0xf22d('0x30')]){case'text':_0x3fffc0[_0xf22d('0x30')]=db['Sequelize'][_0xf22d('0x51')];break;case _0xf22d('0x52'):_0x3fffc0[_0xf22d('0x30')]=db['Sequelize']['INTEGER'];break;case'switch':_0x3fffc0['type']=db['Sequelize']['BOOLEAN'];_0x3fffc0[_0xf22d('0x53')]=![];break;default:}return db[_0xf22d('0x4f')][_0xf22d('0x54')][_0xf22d('0x55')](_0xf22d('0x56'),util['format'](_0xf22d('0x57'),_0x42996d['id']),_0x3fffc0);})[_0xf22d('0x27')](function(){return _0x42996d;});})['then'](respondWithResult(_0x34fe12,0xc9))['catch'](handleError(_0x34fe12,null));}; \ No newline at end of file +var _0xd30b=['json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','CmCustomField','include','findAll','rows','catch','show','includeAll','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x23082a,_0x445d35){var _0x4be541=function(_0xb3f462){while(--_0xb3f462){_0x23082a['push'](_0x23082a['shift']());}};_0x4be541(++_0x445d35);}(_0xd30b,0x99));var _0xbd30=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xd30b[_0x163040];return _0x364667;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd30('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd30('0x1'));var moment=require(_0xbd30('0x2'));var BPromise=require(_0xbd30('0x3'));var Mustache=require(_0xbd30('0x4'));var util=require(_0xbd30('0x5'));var path=require(_0xbd30('0x6'));var sox=require(_0xbd30('0x7'));var csv=require(_0xbd30('0x8'));var ejs=require(_0xbd30('0x9'));var fs=require('fs');var fs_extra=require(_0xbd30('0xa'));var _=require(_0xbd30('0xb'));var squel=require(_0xbd30('0xc'));var crypto=require(_0xbd30('0xd'));var jsforce=require(_0xbd30('0xe'));var deskjs=require(_0xbd30('0xf'));var toCsv=require(_0xbd30('0x8'));var querystring=require(_0xbd30('0x10'));var Papa=require(_0xbd30('0x11'));var Redis=require(_0xbd30('0x12'));var authService=require(_0xbd30('0x13'));var qs=require(_0xbd30('0x14'));var as=require(_0xbd30('0x15'));var hardwareService=require(_0xbd30('0x16'));var logger=require(_0xbd30('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbd30('0x18'));var licenseUtil=require(_0xbd30('0x19'));var db=require(_0xbd30('0x1a'))['db'];function respondWithStatusCode(_0x54539a,_0x415a3e){_0x415a3e=_0x415a3e||0xcc;return function(_0x46ed54){if(_0x46ed54){return _0x54539a[_0xbd30('0x1b')](_0x415a3e);}return _0x54539a['status'](_0x415a3e)[_0xbd30('0x1c')]();};}function respondWithResult(_0x2c1300,_0x357e10){_0x357e10=_0x357e10||0xc8;return function(_0x3befdf){if(_0x3befdf){return _0x2c1300['status'](_0x357e10)[_0xbd30('0x1d')](_0x3befdf);}};}function respondWithFilteredResult(_0x569157,_0x190fee){return function(_0x11bc25){if(_0x11bc25){var _0x21b580=typeof _0x190fee[_0xbd30('0x1e')]===_0xbd30('0x1f')&&typeof _0x190fee[_0xbd30('0x20')]===_0xbd30('0x1f');var _0x36cf3d=_0x11bc25[_0xbd30('0x21')];var _0x308d94=_0x21b580?0x0:_0x190fee[_0xbd30('0x1e')];var _0x1f38e5=_0x21b580?_0x11bc25['count']:_0x190fee[_0xbd30('0x1e')]+_0x190fee[_0xbd30('0x20')];var _0x5f0764;if(_0x1f38e5>=_0x36cf3d){_0x1f38e5=_0x36cf3d;_0x5f0764=0xc8;}else{_0x5f0764=0xce;}_0x569157[_0xbd30('0x22')](_0x5f0764);return _0x569157[_0xbd30('0x23')](_0xbd30('0x24'),_0x308d94+'-'+_0x1f38e5+'/'+_0x36cf3d)[_0xbd30('0x1d')](_0x11bc25);}return null;};}function patchUpdates(_0x5f17ea){return function(_0x5bb4fa){try{jsonpatch['apply'](_0x5bb4fa,_0x5f17ea,!![]);}catch(_0x5810e1){return BPromise[_0xbd30('0x25')](_0x5810e1);}return _0x5bb4fa[_0xbd30('0x26')]();};}function saveUpdates(_0x13bfb6,_0x3eb4e8){return function(_0x4c2ed7){if(_0x4c2ed7){return _0x4c2ed7[_0xbd30('0x27')](_0x13bfb6)['then'](function(_0x558ffd){return _0x558ffd;});}return null;};}function removeEntity(_0x4cb83b,_0x337ab1){return function(_0x32c016){if(_0x32c016){return _0x32c016[_0xbd30('0x28')]()[_0xbd30('0x29')](function(){_0x4cb83b[_0xbd30('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7285,_0x3ad7b2){return function(_0x8f43a1){if(!_0x8f43a1){_0x1c7285['sendStatus'](0x194);}return _0x8f43a1;};}function handleError(_0x560285,_0x194d1f){_0x194d1f=_0x194d1f||0x1f4;return function(_0x30e87a){logger['error'](_0x30e87a['stack']);if(_0x30e87a[_0xbd30('0x2a')]){delete _0x30e87a[_0xbd30('0x2a')];}_0x560285[_0xbd30('0x22')](_0x194d1f)[_0xbd30('0x2b')](_0x30e87a);};}exports[_0xbd30('0x2c')]=function(_0x1e0408,_0x48d858){var _0x35a8dd={},_0x220ba3={},_0x2e464b={'count':0x0,'rows':[]};var _0x164ce9=_[_0xbd30('0x2d')](db['CmCustomField'][_0xbd30('0x2e')],function(_0x574746){return{'name':_0x574746[_0xbd30('0x2f')],'type':_0x574746[_0xbd30('0x30')][_0xbd30('0x31')]};});_0x220ba3['model']=_[_0xbd30('0x32')](_[_0xbd30('0x2d')](_0x164ce9,_0xbd30('0x2a')),[_0xbd30('0x2a')]);_0x220ba3[_0xbd30('0x33')]=_[_0xbd30('0x34')](_0x1e0408['query']);_0x220ba3[_0xbd30('0x35')]=_[_0xbd30('0x36')](_0x220ba3[_0xbd30('0x37')],_0x220ba3[_0xbd30('0x33')]);_0x35a8dd[_0xbd30('0x38')]=_[_0xbd30('0x36')](_0x220ba3[_0xbd30('0x37')],qs[_0xbd30('0x39')](_0x1e0408['query'][_0xbd30('0x39')]));_0x35a8dd[_0xbd30('0x38')]=_0x35a8dd[_0xbd30('0x38')][_0xbd30('0x3a')]?_0x35a8dd[_0xbd30('0x38')]:_0x220ba3[_0xbd30('0x37')];if(!_0x1e0408[_0xbd30('0x33')][_0xbd30('0x3b')](_0xbd30('0x3c'))){_0x35a8dd['limit']=qs[_0xbd30('0x20')](_0x1e0408['query']['limit']);_0x35a8dd['offset']=qs['offset'](_0x1e0408['query'][_0xbd30('0x1e')]);}_0x35a8dd['order']=qs[_0xbd30('0x3d')](_0x1e0408[_0xbd30('0x33')][_0xbd30('0x3d')]);_0x35a8dd[_0xbd30('0x3e')]=qs[_0xbd30('0x35')](_[_0xbd30('0x3f')](_0x1e0408['query'],_0x220ba3[_0xbd30('0x35')]),_0x164ce9);if(_0x1e0408['query']['filter']){_0x35a8dd[_0xbd30('0x3e')]=_[_0xbd30('0x40')](_0x35a8dd[_0xbd30('0x3e')],{'$or':_[_0xbd30('0x2d')](_0x164ce9,function(_0x5784b0){if(_0x5784b0[_0xbd30('0x30')]!=='VIRTUAL'){var _0x9be620={};_0x9be620[_0x5784b0[_0xbd30('0x2a')]]={'$like':'%'+_0x1e0408[_0xbd30('0x33')][_0xbd30('0x41')]+'%'};return _0x9be620;}})});}_0x35a8dd=_[_0xbd30('0x40')]({},_0x35a8dd,_0x1e0408[_0xbd30('0x42')]);var _0x1618fc={'where':_0x35a8dd['where']};return db[_0xbd30('0x43')]['count'](_0x1618fc)[_0xbd30('0x29')](function(_0x2dc73e){_0x2e464b[_0xbd30('0x21')]=_0x2dc73e;if(_0x1e0408[_0xbd30('0x33')]['includeAll']){_0x35a8dd[_0xbd30('0x44')]=[{'all':!![]}];}return db['CmCustomField'][_0xbd30('0x45')](_0x35a8dd);})[_0xbd30('0x29')](function(_0x551213){_0x2e464b[_0xbd30('0x46')]=_0x551213;return _0x2e464b;})[_0xbd30('0x29')](respondWithFilteredResult(_0x48d858,_0x35a8dd))[_0xbd30('0x47')](handleError(_0x48d858,null));};exports[_0xbd30('0x48')]=function(_0x4eeeab,_0x16681d){var _0x1cc0a4={'raw':!![],'where':{'id':_0x4eeeab['params']['id']}},_0x4b8be4={};_0x4b8be4[_0xbd30('0x37')]=_[_0xbd30('0x34')](db[_0xbd30('0x43')][_0xbd30('0x2e')]);_0x4b8be4['query']=_[_0xbd30('0x34')](_0x4eeeab[_0xbd30('0x33')]);_0x4b8be4[_0xbd30('0x35')]=_[_0xbd30('0x36')](_0x4b8be4[_0xbd30('0x37')],_0x4b8be4['query']);_0x1cc0a4[_0xbd30('0x38')]=_['intersection'](_0x4b8be4[_0xbd30('0x37')],qs[_0xbd30('0x39')](_0x4eeeab['query'][_0xbd30('0x39')]));_0x1cc0a4['attributes']=_0x1cc0a4[_0xbd30('0x38')][_0xbd30('0x3a')]?_0x1cc0a4[_0xbd30('0x38')]:_0x4b8be4['model'];if(_0x4eeeab['query'][_0xbd30('0x49')]){_0x1cc0a4[_0xbd30('0x44')]=[{'all':!![]}];}_0x1cc0a4=_[_0xbd30('0x40')]({},_0x1cc0a4,_0x4eeeab[_0xbd30('0x42')]);return db[_0xbd30('0x43')][_0xbd30('0x4a')](_0x1cc0a4)[_0xbd30('0x29')](handleEntityNotFound(_0x16681d,null))[_0xbd30('0x29')](respondWithResult(_0x16681d,null))['catch'](handleError(_0x16681d,null));};exports[_0xbd30('0x27')]=function(_0x31040b,_0x77cc7e){if(_0x31040b[_0xbd30('0x4b')]['id']){delete _0x31040b['body']['id'];}return db[_0xbd30('0x43')][_0xbd30('0x4a')]({'where':{'id':_0x31040b[_0xbd30('0x4c')]['id']}})[_0xbd30('0x29')](handleEntityNotFound(_0x77cc7e,null))['then'](saveUpdates(_0x31040b[_0xbd30('0x4b')],null))['then'](respondWithResult(_0x77cc7e,null))[_0xbd30('0x47')](handleError(_0x77cc7e,null));};exports[_0xbd30('0x28')]=function(_0x42324a,_0x3e77e6){return db[_0xbd30('0x43')][_0xbd30('0x4a')]({'where':{'id':_0x42324a[_0xbd30('0x4c')]['id']}})[_0xbd30('0x29')](handleEntityNotFound(_0x3e77e6,null))[_0xbd30('0x29')](removeEntity(_0x3e77e6,null))[_0xbd30('0x47')](handleError(_0x3e77e6,null));};exports[_0xbd30('0x4d')]=function(_0x5b50ad,_0x20dab0){var _0x356c9b;return db[_0xbd30('0x4e')][_0xbd30('0x4f')](function(_0x1f6db0){return db[_0xbd30('0x43')][_0xbd30('0x4d')](_0x5b50ad['body'],{'transaction':_0x1f6db0})[_0xbd30('0x29')](function(_0x1c4066){_0x356c9b=_0x1c4066;var _0x37011c={'type':db[_0xbd30('0x50')][_0xbd30('0x51')],'transaction':_0x1f6db0};switch(_0x5b50ad['body'][_0xbd30('0x30')]){case _0xbd30('0x52'):_0x37011c[_0xbd30('0x30')]=db[_0xbd30('0x50')]['TEXT'];break;case _0xbd30('0x53'):_0x37011c[_0xbd30('0x30')]=db[_0xbd30('0x50')][_0xbd30('0x54')];break;case _0xbd30('0x55'):_0x37011c['type']=db[_0xbd30('0x50')][_0xbd30('0x56')];_0x37011c[_0xbd30('0x57')]=![];break;default:}return db[_0xbd30('0x4e')]['queryInterface'][_0xbd30('0x58')](_0xbd30('0x59'),util['format'](_0xbd30('0x5a'),_0x356c9b['id']),_0x37011c);})[_0xbd30('0x29')](function(){return _0x356c9b;});})[_0xbd30('0x29')](respondWithResult(_0x20dab0,0xc9))['catch'](handleError(_0x20dab0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index eaa6190..dd9aa41 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 _0xe0fb=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe0fb,0x134));var _0xbe0f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe0fb[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xbe0f('0x0'));var util=require(_0xbe0f('0x1'));var logger=require(_0xbe0f('0x2'))('api');var moment=require(_0xbe0f('0x3'));var BPromise=require(_0xbe0f('0x4'));var rp=require(_0xbe0f('0x5'));var fs=require('fs');var path=require(_0xbe0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe0f('0x7'));module[_0xbe0f('0x8')]=function(_0x57f757,_0x3f14c9){return _0x57f757[_0xbe0f('0x9')](_0xbe0f('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda37=['define','CmCustomField','lodash','api','moment','bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x2ec12a,_0x4298b4){var _0x40e7b2=function(_0x59955d){while(--_0x59955d){_0x2ec12a['push'](_0x2ec12a['shift']());}};_0x40e7b2(++_0x4298b4);}(_0xda37,0x174));var _0x7da3=function(_0x26e0be,_0x1d34ce){_0x26e0be=_0x26e0be-0x0;var _0x3049cd=_0xda37[_0x26e0be];return _0x3049cd;};'use strict';var _=require(_0x7da3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7da3('0x1'));var moment=require(_0x7da3('0x2'));var BPromise=require(_0x7da3('0x3'));var rp=require(_0x7da3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7da3('0x5'));var attributes=require(_0x7da3('0x6'));module[_0x7da3('0x7')]=function(_0x32fb0b,_0x5a4ce0){return _0x32fb0b[_0x7da3('0x8')](_0x7da3('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 74f07b6..eeb4ef3 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 _0xcf00=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0xcf00,0x1dd));var _0x0cf0=function(_0x1075a2,_0xb2f371){_0x1075a2=_0x1075a2-0x0;var _0x43f5f9=_0xcf00[_0x1075a2];return _0x43f5f9;};'use strict';var _=require(_0x0cf0('0x0'));var util=require(_0x0cf0('0x1'));var moment=require('moment');var BPromise=require(_0x0cf0('0x2'));var rs=require(_0x0cf0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cf0('0x4'))['db'];var utils=require(_0x0cf0('0x5'));var logger=require(_0x0cf0('0x6'))(_0x0cf0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47adc6,_0x3a0b14,_0x2a3229){return new BPromise(function(_0x2c567c,_0x236652){return client[_0x0cf0('0x8')](_0x47adc6,_0x2a3229)['then'](function(_0x4f61ed){logger[_0x0cf0('0x9')](_0x0cf0('0xa'),_0x3a0b14,_0x0cf0('0xb'));logger['debug'](_0x0cf0('0xc'),_0x3a0b14,_0x0cf0('0xb'),JSON[_0x0cf0('0xd')](_0x4f61ed));if(_0x4f61ed[_0x0cf0('0xe')]){if(_0x4f61ed[_0x0cf0('0xe')][_0x0cf0('0xf')]===0x1f4){logger[_0x0cf0('0xe')](_0x0cf0('0xa'),_0x3a0b14,_0x4f61ed['error'][_0x0cf0('0x10')]);return _0x236652(_0x4f61ed['error'][_0x0cf0('0x10')]);}logger[_0x0cf0('0xe')](_0x0cf0('0xa'),_0x3a0b14,_0x4f61ed[_0x0cf0('0xe')][_0x0cf0('0x10')]);return _0x2c567c(_0x4f61ed[_0x0cf0('0xe')][_0x0cf0('0x10')]);}else{logger[_0x0cf0('0x9')](_0x0cf0('0xa'),_0x3a0b14,_0x0cf0('0xb'));_0x2c567c(_0x4f61ed[_0x0cf0('0x11')]['message']);}})['catch'](function(_0x49c0d1){logger[_0x0cf0('0xe')](_0x0cf0('0xa'),_0x3a0b14,_0x49c0d1);_0x236652(_0x49c0d1);});});} \ No newline at end of file +var _0x561d=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x62e123,_0x369edf){var _0x2c32cf=function(_0x2a56b7){while(--_0x2a56b7){_0x62e123['push'](_0x62e123['shift']());}};_0x2c32cf(++_0x369edf);}(_0x561d,0x1b6));var _0xd561=function(_0x39407b,_0x550e7e){_0x39407b=_0x39407b-0x0;var _0xa91a8e=_0x561d[_0x39407b];return _0xa91a8e;};'use strict';var _=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var moment=require('moment');var BPromise=require(_0xd561('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd561('0x3'));var db=require(_0xd561('0x4'))['db'];var utils=require(_0xd561('0x5'));var logger=require(_0xd561('0x6'))(_0xd561('0x7'));var config=require(_0xd561('0x8'));var jayson=require(_0xd561('0x9'));var client=jayson[_0xd561('0xa')][_0xd561('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48d23c,_0x1b4efa,_0x1a18ee){return new BPromise(function(_0x45199d,_0x933fe8){return client[_0xd561('0xc')](_0x48d23c,_0x1a18ee)[_0xd561('0xd')](function(_0x26067d){logger[_0xd561('0xe')](_0xd561('0xf'),_0x1b4efa,'request\x20sent');logger[_0xd561('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1b4efa,_0xd561('0x11'),JSON[_0xd561('0x12')](_0x26067d));if(_0x26067d[_0xd561('0x13')]){if(_0x26067d[_0xd561('0x13')][_0xd561('0x14')]===0x1f4){logger['error'](_0xd561('0xf'),_0x1b4efa,_0x26067d[_0xd561('0x13')][_0xd561('0x15')]);return _0x933fe8(_0x26067d['error']['message']);}logger[_0xd561('0x13')](_0xd561('0xf'),_0x1b4efa,_0x26067d[_0xd561('0x13')][_0xd561('0x15')]);return _0x45199d(_0x26067d[_0xd561('0x13')][_0xd561('0x15')]);}else{logger[_0xd561('0xe')](_0xd561('0xf'),_0x1b4efa,_0xd561('0x11'));_0x45199d(_0x26067d[_0xd561('0x16')][_0xd561('0x15')]);}})[_0xd561('0x17')](function(_0xf775ac){logger[_0xd561('0x13')](_0xd561('0xf'),_0x1b4efa,_0xf775ac);_0x933fe8(_0xf775ac);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 20d236a..cba546d 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 _0xf518=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','exports','util','connect-timeout','express','Router'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf518,0xd4));var _0x8f51=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xf518[_0xf2628e];return _0x13863a;};'use strict';var multer=require('multer');var util=require(_0x8f51('0x0'));var path=require('path');var timeout=require(_0x8f51('0x1'));var express=require(_0x8f51('0x2'));var router=express[_0x8f51('0x3')]();var fs_extra=require(_0x8f51('0x4'));var auth=require(_0x8f51('0x5'));var interaction=require(_0x8f51('0x6'));var config=require(_0x8f51('0x7'));var controller=require('./cmCustomField.controller');router[_0x8f51('0x8')]('/',auth[_0x8f51('0x9')](),controller[_0x8f51('0xa')]);router[_0x8f51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8f51('0xb')]);router[_0x8f51('0xc')]('/',auth[_0x8f51('0x9')](),controller[_0x8f51('0xd')]);router[_0x8f51('0xe')](_0x8f51('0xf'),auth[_0x8f51('0x9')](),controller[_0x8f51('0x10')]);router['delete']('/:id',auth[_0x8f51('0x9')](),controller['destroy']);module[_0x8f51('0x11')]=router; \ No newline at end of file +var _0xc15b=['isAuthenticated','create','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id'];(function(_0x437116,_0x3e15d8){var _0x172892=function(_0x715f5b){while(--_0x715f5b){_0x437116['push'](_0x437116['shift']());}};_0x172892(++_0x3e15d8);}(_0xc15b,0xe4));var _0xbc15=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc15b[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xbc15('0x0'));var util=require('util');var path=require(_0xbc15('0x1'));var timeout=require(_0xbc15('0x2'));var express=require(_0xbc15('0x3'));var router=express[_0xbc15('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var controller=require(_0xbc15('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbc15('0x8')](_0xbc15('0x9'),auth[_0xbc15('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbc15('0xb')]);router['put'](_0xbc15('0x9'),auth[_0xbc15('0xa')](),controller[_0xbc15('0xc')]);router['delete'](_0xbc15('0x9'),auth[_0xbc15('0xa')](),controller['destroy']);module[_0xbc15('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index df55a1b..4d9614e 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 _0xeaf4=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaf4,0xe1));var _0x4eaf=function(_0xe18c7,_0x516b7c){_0xe18c7=_0xe18c7-0x0;var _0x5f2874=_0xeaf4[_0xe18c7];return _0x5f2874;};'use strict';var moment=require(_0x4eaf('0x0'));var Sequelize=require(_0x4eaf('0x1'));module[_0x4eaf('0x2')]={'phone':{'type':Sequelize[_0x4eaf('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4eaf('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4eaf('0x5')],'defaultValue':moment()[_0x4eaf('0x6')](_0x4eaf('0x7'))},'countbusyretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4eaf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4eaf('0x5')]},'priority':{'type':Sequelize[_0x4eaf('0x8')](0x2)[_0x4eaf('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4eaf('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4eaf('0x8')],'unique':_0x4eaf('0xa')},'ListId':{'type':Sequelize[_0x4eaf('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4eaf('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x4eaf('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x4eaf('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4eaf('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4eaf('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4eaf('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x58a4=['sequelize','exports','STRING','BOOLEAN','format','INTEGER','UNSIGNED','contactListQueue','DATE','moment'];(function(_0xf054ff,_0x41f4bf){var _0x1da3ed=function(_0x30b869){while(--_0x30b869){_0xf054ff['push'](_0xf054ff['shift']());}};_0x1da3ed(++_0x41f4bf);}(_0x58a4,0x15d));var _0x458a=function(_0x51f492,_0x6b3e08){_0x51f492=_0x51f492-0x0;var _0x4c76eb=_0x58a4[_0x51f492];return _0x4c76eb;};'use strict';var moment=require(_0x458a('0x0'));var Sequelize=require(_0x458a('0x1'));module[_0x458a('0x2')]={'phone':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x458a('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x458a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x458a('0x6')](0x2)[_0x458a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x458a('0x6')],'unique':_0x458a('0x8')},'ListId':{'type':Sequelize[_0x458a('0x6')],'unique':_0x458a('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x458a('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x458a('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x458a('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x458a('0x9')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index cdbb5ad..65dbf9c 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 _0xa97c=['YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','transaction','CmCompany','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','utcOffset','getTimezone','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notIn','$like','$iLike','$notILike','$overlap','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','catch','create','body','find','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format'];(function(_0x54c879,_0x54595a){var _0x10f4ea=function(_0x46cc4e){while(--_0x46cc4e){_0x54c879['push'](_0x54c879['shift']());}};_0x10f4ea(++_0x54595a);}(_0xa97c,0xd0));var _0xca97=function(_0x540f76,_0x52fb38){_0x540f76=_0x540f76-0x0;var _0x1e6091=_0xa97c[_0x540f76];return _0x1e6091;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca97('0x0'));var zipdir=require(_0xca97('0x1'));var jsonpatch=require(_0xca97('0x2'));var rp=require(_0xca97('0x3'));var moment=require(_0xca97('0x4'));var BPromise=require(_0xca97('0x5'));var Mustache=require(_0xca97('0x6'));var util=require(_0xca97('0x7'));var path=require(_0xca97('0x8'));var sox=require(_0xca97('0x9'));var csv=require(_0xca97('0xa'));var ejs=require(_0xca97('0xb'));var fs=require('fs');var fs_extra=require(_0xca97('0xc'));var _=require('lodash');var squel=require(_0xca97('0xd'));var crypto=require(_0xca97('0xe'));var jsforce=require(_0xca97('0xf'));var deskjs=require(_0xca97('0x10'));var toCsv=require(_0xca97('0xa'));var querystring=require(_0xca97('0x11'));var Papa=require(_0xca97('0x12'));var Redis=require(_0xca97('0x13'));var authService=require(_0xca97('0x14'));var qs=require(_0xca97('0x15'));var as=require(_0xca97('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xca97('0x17'));var config=require('../../config/environment');var shared=require(_0xca97('0x18'));var licenseUtil=require(_0xca97('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ecea8,_0x25ee68){_0x25ee68=_0x25ee68||0xcc;return function(_0x2fc57d){if(_0x2fc57d){return _0x1ecea8[_0xca97('0x1a')](_0x25ee68);}return _0x1ecea8[_0xca97('0x1b')](_0x25ee68)[_0xca97('0x1c')]();};}function respondWithResult(_0x4d344b,_0x50ae53){_0x50ae53=_0x50ae53||0xc8;return function(_0x263d38){if(_0x263d38){return _0x4d344b[_0xca97('0x1b')](_0x50ae53)[_0xca97('0x1d')](_0x263d38);}};}function respondWithFilteredResult(_0x55abad,_0x938696){return function(_0xe41019){if(_0xe41019){var _0x34147e=typeof _0x938696[_0xca97('0x1e')]===_0xca97('0x1f')&&typeof _0x938696[_0xca97('0x20')]==='undefined';var _0x204116=_0xe41019[_0xca97('0x21')];var _0x449a32=_0x34147e?0x0:_0x938696[_0xca97('0x1e')];var _0xcc2a70=_0x34147e?_0xe41019[_0xca97('0x21')]:_0x938696[_0xca97('0x1e')]+_0x938696['limit'];var _0x191a05;if(_0xcc2a70>=_0x204116){_0xcc2a70=_0x204116;_0x191a05=0xc8;}else{_0x191a05=0xce;}_0x55abad[_0xca97('0x1b')](_0x191a05);return _0x55abad['set']('Content-Range',_0x449a32+'-'+_0xcc2a70+'/'+_0x204116)[_0xca97('0x1d')](_0xe41019);}return null;};}function patchUpdates(_0x4e67d3){return function(_0x2b90d5){try{jsonpatch[_0xca97('0x22')](_0x2b90d5,_0x4e67d3,!![]);}catch(_0x59496a){return BPromise[_0xca97('0x23')](_0x59496a);}return _0x2b90d5['save']();};}function saveUpdates(_0x9b5b3b,_0x42a542){return function(_0x5f045b){if(_0x5f045b){return _0x5f045b[_0xca97('0x24')](_0x9b5b3b)[_0xca97('0x25')](function(_0x56e3e7){return _0x56e3e7;});}return null;};}function removeEntity(_0xb91710,_0x4e68f5){return function(_0x145aa3){if(_0x145aa3){return _0x145aa3[_0xca97('0x26')]()[_0xca97('0x25')](function(){_0xb91710['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e67d9,_0x31f589){return function(_0x5d85e4){if(!_0x5d85e4){_0x4e67d9[_0xca97('0x1a')](0x194);}return _0x5d85e4;};}function handleError(_0x5d24a8,_0x54c647){_0x54c647=_0x54c647||0x1f4;return function(_0x51f4d0){logger[_0xca97('0x27')](_0x51f4d0[_0xca97('0x28')]);if(_0x51f4d0[_0xca97('0x29')]){delete _0x51f4d0[_0xca97('0x29')];}_0x5d24a8['status'](_0x54c647)['send'](_0x51f4d0);};}exports[_0xca97('0x2a')]=function(_0x3bba46,_0x534e61){var _0x1ec2a9={},_0x567c10={},_0x1a2973={'count':0x0,'rows':[]};var _0x5e53bc=_[_0xca97('0x2b')](db[_0xca97('0x2c')][_0xca97('0x2d')],function(_0x1c5eec){return{'name':_0x1c5eec[_0xca97('0x2e')],'type':_0x1c5eec[_0xca97('0x2f')][_0xca97('0x30')]};});_0x567c10[_0xca97('0x31')]=_[_0xca97('0x2b')](_0x5e53bc,_0xca97('0x29'));_0x567c10['query']=_[_0xca97('0x32')](_0x3bba46['query']);_0x567c10[_0xca97('0x33')]=_[_0xca97('0x34')](_0x567c10[_0xca97('0x31')],_0x567c10[_0xca97('0x35')]);_0x567c10[_0xca97('0x33')]=_[_0xca97('0x36')](_0x567c10[_0xca97('0x33')],[_0xca97('0x37'),_0xca97('0x38'),'$gt',_0xca97('0x39'),_0xca97('0x3a'),_0xca97('0x3b'),_0xca97('0x3c'),_0xca97('0x3d'),'$not',_0xca97('0x3e'),'$notBetween','$in',_0xca97('0x3f'),_0xca97('0x40'),'$notLike',_0xca97('0x41'),_0xca97('0x42'),_0xca97('0x40'),_0xca97('0x43'),'$contains',_0xca97('0x44'),'$any']);_0x1ec2a9[_0xca97('0x45')]=_[_0xca97('0x34')](_0x567c10[_0xca97('0x31')],qs[_0xca97('0x46')](_0x3bba46[_0xca97('0x35')]['fields']));_0x1ec2a9['attributes']=_0x1ec2a9[_0xca97('0x45')][_0xca97('0x47')]?_0x1ec2a9[_0xca97('0x45')]:_0x567c10['model'];if(!_0x3bba46['query'][_0xca97('0x48')](_0xca97('0x49'))){_0x1ec2a9['limit']=qs[_0xca97('0x20')](_0x3bba46[_0xca97('0x35')]['limit']);_0x1ec2a9[_0xca97('0x1e')]=qs['offset'](_0x3bba46[_0xca97('0x35')][_0xca97('0x1e')]);}_0x1ec2a9[_0xca97('0x4a')]=qs['sort'](_0x3bba46[_0xca97('0x35')][_0xca97('0x4b')]);_0x1ec2a9[_0xca97('0x4c')]=qs['filters'](_['pick'](_0x3bba46[_0xca97('0x35')],_0x567c10[_0xca97('0x33')]),_0x5e53bc);if(_0x3bba46[_0xca97('0x35')][_0xca97('0x4d')]){_0x1ec2a9['where']=_[_0xca97('0x4e')](_0x1ec2a9[_0xca97('0x4c')],{'$or':_[_0xca97('0x2b')](_0x5e53bc,function(_0x56bec2){if(_0x56bec2[_0xca97('0x2f')]!=='VIRTUAL'){var _0x317a26={};_0x317a26[_0x56bec2[_0xca97('0x29')]]={'$like':'%'+_0x3bba46[_0xca97('0x35')][_0xca97('0x4d')]+'%'};return _0x317a26;}})});}_0x1ec2a9=_[_0xca97('0x4e')]({},_0x1ec2a9,_0x3bba46[_0xca97('0x4f')]);var _0x93ad8={'where':_0x1ec2a9[_0xca97('0x4c')]};return db[_0xca97('0x2c')][_0xca97('0x21')](_0x93ad8)[_0xca97('0x25')](function(_0x39e5b2){_0x1a2973[_0xca97('0x21')]=_0x39e5b2;if(_0x3bba46[_0xca97('0x35')][_0xca97('0x50')]){_0x1ec2a9[_0xca97('0x51')]=[{'all':!![]}];}return db[_0xca97('0x2c')]['findAll'](_0x1ec2a9);})[_0xca97('0x25')](function(_0x3f8b4c){_0x1a2973[_0xca97('0x52')]=_0x3f8b4c;return _0x1a2973;})[_0xca97('0x25')](respondWithFilteredResult(_0x534e61,_0x1ec2a9))['catch'](handleError(_0x534e61,null));};exports[_0xca97('0x53')]=function(_0x1ee848,_0x994766){var _0x43bbe7={'raw':!![],'where':{'id':_0x1ee848['params']['id']}},_0xdc5c7d={};_0xdc5c7d[_0xca97('0x31')]=_[_0xca97('0x32')](db[_0xca97('0x2c')][_0xca97('0x2d')]);_0xdc5c7d['query']=_[_0xca97('0x32')](_0x1ee848[_0xca97('0x35')]);_0xdc5c7d['filters']=_['intersection'](_0xdc5c7d[_0xca97('0x31')],_0xdc5c7d[_0xca97('0x35')]);_0x43bbe7['attributes']=_[_0xca97('0x34')](_0xdc5c7d[_0xca97('0x31')],qs['fields'](_0x1ee848[_0xca97('0x35')]['fields']));_0x43bbe7[_0xca97('0x45')]=_0x43bbe7['attributes']['length']?_0x43bbe7['attributes']:_0xdc5c7d['model'];if(_0x1ee848[_0xca97('0x35')]['includeAll']){_0x43bbe7['include']=[{'all':!![]}];}_0x43bbe7=_['merge']({},_0x43bbe7,_0x1ee848[_0xca97('0x4f')]);return db['CmHopper']['find'](_0x43bbe7)[_0xca97('0x25')](handleEntityNotFound(_0x994766,null))[_0xca97('0x25')](respondWithResult(_0x994766,null))[_0xca97('0x54')](handleError(_0x994766,null));};exports[_0xca97('0x55')]=function(_0x46c2ba,_0x2771e5){return db[_0xca97('0x2c')]['create'](_0x46c2ba['body'],{})[_0xca97('0x25')](respondWithResult(_0x2771e5,0xc9))[_0xca97('0x54')](handleError(_0x2771e5,null));};exports[_0xca97('0x24')]=function(_0x2584e3,_0x27eddc){if(_0x2584e3[_0xca97('0x56')]['id']){delete _0x2584e3['body']['id'];}return db[_0xca97('0x2c')][_0xca97('0x57')]({'where':{'id':_0x2584e3[_0xca97('0x58')]['id']}})[_0xca97('0x25')](handleEntityNotFound(_0x27eddc,null))['then'](saveUpdates(_0x2584e3[_0xca97('0x56')],null))[_0xca97('0x25')](respondWithResult(_0x27eddc,null))[_0xca97('0x54')](handleError(_0x27eddc,null));};exports[_0xca97('0x59')]=function(_0xb27a4e,_0xff7fe4){return db[_0xca97('0x2c')][_0xca97('0x59')]()[_0xca97('0x25')](respondWithResult(_0xff7fe4,null))[_0xca97('0x54')](handleError(_0xff7fe4,null));};exports['destroy']=function(_0x2bc266,_0x26edb4){var _0x8e2279;var _0x5b03df=_0x2bc266['params']['id'];return db[_0xca97('0x2c')][_0xca97('0x57')]({'where':{'id':_0x2bc266['params']['id']}})[_0xca97('0x25')](handleEntityNotFound(_0x26edb4,null))[_0xca97('0x25')](function(_0x3db3dc){if(_0x3db3dc){return _0x3db3dc[_0xca97('0x26')]()[_0xca97('0x25')](function(_0x1f3a88){return _0x1f3a88;});}})[_0xca97('0x25')](function(_0x4a3fa9){_0x8e2279=_0x4a3fa9;if(_0x4a3fa9){if(_0x4a3fa9[_0xca97('0x5a')]||_0x4a3fa9[_0xca97('0x5b')]){return db[_0x4a3fa9['VoiceQueueId']?_0xca97('0x5c'):_0xca97('0x5d')][_0xca97('0x57')]({'where':{'id':_0x4a3fa9['VoiceQueueId']?_0x4a3fa9[_0xca97('0x5a')]:_0x4a3fa9['CampaignId']},'attributes':['id',_0xca97('0x29')],'raw':!![]});}}})[_0xca97('0x25')](function(_0x1ca7db){var _0x359fb8={};if(_0x1ca7db){_['merge'](_0x359fb8,_['omit'](_0x8e2279[_0xca97('0x5e')],[_0xca97('0x5f'),'updatedAt','id']));_0x359fb8['state']=0x15;_0x359fb8[_0xca97('0x60')]=_0xca97('0x61');_0x359fb8[_0xca97('0x62')]=_0x1ca7db[_0xca97('0x29')];_0x359fb8[_0xca97('0x63')]=_0x2bc266[_0xca97('0x64')][_0xca97('0x29')];_0x359fb8[_0xca97('0x65')]=_0x2bc266[_0xca97('0x64')]['id'];_0x359fb8['deleted']=!![];_0x359fb8[_0xca97('0x66')]=moment()[_0xca97('0x67')](_0xca97('0x68'));_0x359fb8[_0xca97('0x69')]=_0x8e2279['phone'];_0x359fb8[_0xca97('0x6a')]=_0x8e2279['VoiceQueueId']?'queue':_0xca97('0x6b');return db[_0xca97('0x6c')]['find']({'where':{'id':_0x359fb8[_0xca97('0x6d')]},'attributes':[_0xca97('0x6e'),_0xca97('0x6f')]})['then'](function(_0x344f07){if(!_[_0xca97('0x70')](_0x26edb4)&&!_[_0xca97('0x70')](_0x344f07[_0xca97('0x6e')])){_0x359fb8[_0xca97('0x71')]=_0x344f07[_0xca97('0x6e')];if(!_[_0xca97('0x70')](_0x344f07['lastName'])){_0x359fb8[_0xca97('0x71')]+='\x20'+_0x344f07[_0xca97('0x6f')];}}})[_0xca97('0x72')](function(){return db['CmHopperFinal'][_0xca97('0x55')](_0x359fb8);});}})[_0xca97('0x25')](function(_0x19696f){return db[_0xca97('0x73')][_0xca97('0x26')]({'where':{'CmHopperId':_0x5b03df}});})[_0xca97('0x25')](function(){return _0x26edb4[_0xca97('0x1b')](0xcc)[_0xca97('0x1c')]();})[_0xca97('0x54')](handleError(_0x26edb4,null));};exports[_0xca97('0x74')]=function(_0x31604b,_0x113012,_0x5266fc){var _0x391c1a=[];return db[_0xca97('0x6c')][_0xca97('0x59')]()[_0xca97('0x25')](function(_0x3cb4c5){_0x391c1a=_[_0xca97('0x32')](_0x3cb4c5);return _0x31604b[_0xca97('0x64')][_0xca97('0x75')]({'where':{'type':_0xca97('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xca97('0x77'),_0xca97('0x78')],'raw':!![]});})[_0xca97('0x25')](function(_0x371081){if(_0x371081&&_0x371081[_0xca97('0x47')]){return db[_0xca97('0x79')]['transaction'](function(_0x5444cd){var _0x39bc65={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xca97('0x67')](_0xca97('0x68'))},'VoiceQueueId':{'$in':_[_0xca97('0x2b')](_0x371081,'id')},'$or':[{'UserId':null},{'UserId':_0x31604b[_0xca97('0x64')]['id']}]};var _0x1b7ef3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x371081)[_0xca97('0x4d')]([_0xca97('0x78'),0x0])[_0xca97('0x2b')]('id')[_0xca97('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x31604b[_0xca97('0x64')]['id']}]};var _0x38ec1f={'$or':[_0x39bc65,_0x1b7ef3]};var _0x5dda0a=[];if(_0x31604b[_0xca97('0x56')][_0xca97('0x7b')]&&_0x31604b[_0xca97('0x56')][_0xca97('0x7b')]===_0xca97('0x7c')){if(!_[_0xca97('0x7d')](_0x31604b[_0xca97('0x56')][_0xca97('0x7e')])){_0x38ec1f['id']={'$in':_0x31604b['body'][_0xca97('0x7e')]};}_0x5dda0a=[[_0xca97('0x7f'),_0xca97('0x80')],[_0xca97('0x81'),_0x371081[0x0][_0xca97('0x77')]==='ASC'?_0xca97('0x82'):_0xca97('0x80')],db[_0xca97('0x79')][_0xca97('0x83')](_0xca97('0x84')),['id',_0xca97('0x82')]];}else{if(!_['isEmpty'](_0x31604b[_0xca97('0x56')]['hopperIds'])){_0x38ec1f['id']={'$notIn':_0x31604b[_0xca97('0x56')][_0xca97('0x7e')]};}_0x5dda0a=[['priority',_0xca97('0x82')],['scheduledAt',_0x371081[0x0][_0xca97('0x77')]],db[_0xca97('0x79')][_0xca97('0x83')](_0xca97('0x85')),['id',_0xca97('0x80')]];}return db['CmHopper'][_0xca97('0x86')]({'attributes':['id',_0xca97('0x87'),_0xca97('0x88'),_0xca97('0x89')],'where':_0x38ec1f,'order':_0x5dda0a,'transaction':_0x5444cd,'lock':_0x5444cd[_0xca97('0x8a')][_0xca97('0x8b')],'include':[{'model':db[_0xca97('0x6c')],'as':_0xca97('0x8c'),'attributes':_0x391c1a,'include':[{'model':db['CmCompany'],'as':_0xca97('0x8d'),'attributes':['id',_0xca97('0x29')]}]},{'model':db[_0xca97('0x8e')],'as':_0xca97('0x8f'),'attributes':['id',_0xca97('0x29')]},{'model':db[_0xca97('0x5c')],'as':_0xca97('0x90'),'attributes':['id',_0xca97('0x29'),_0xca97('0x91')]}]})[_0xca97('0x25')](function(_0x2cfa1e){if(_0x2cfa1e){return _0x2cfa1e[_0xca97('0x24')]({'UserId':_0x31604b[_0xca97('0x64')]['id']},{'transaction':_0x5444cd});}});});}})[_0xca97('0x25')](handleEntityNotFound(_0x113012,null))['then'](respondWithResult(_0x113012,null))[_0xca97('0x54')](handleError(_0x113012,null));};exports['getPreviewRecall']=function(_0x3975eb,_0x58a70d,_0x38833f){var _0x4c253e=[];return db['CmContact'][_0xca97('0x59')]()['then'](function(_0xb8ca0f){_0x4c253e=_[_0xca97('0x32')](_0xb8ca0f);return _0x3975eb[_0xca97('0x64')][_0xca97('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xca97('0x77'),_0xca97('0x78')],'raw':!![]});})[_0xca97('0x25')](function(_0xa67e40){if(_0xa67e40&&_0xa67e40['length']){return db['sequelize'][_0xca97('0x92')](function(_0x4f2f22){var _0x37e4e3={'active':![],'recallme':!![],'id':_0x3975eb['body']['hopperId']};return db[_0xca97('0x2c')]['findOne']({'attributes':['id',_0xca97('0x87'),_0xca97('0x89')],'where':_0x37e4e3,'transaction':_0x4f2f22,'lock':_0x4f2f22[_0xca97('0x8a')]['UPDATE'],'include':[{'model':db[_0xca97('0x6c')],'as':_0xca97('0x8c'),'attributes':_0x4c253e,'include':[{'model':db[_0xca97('0x93')],'as':_0xca97('0x8d'),'attributes':['id',_0xca97('0x29')]}]},{'model':db[_0xca97('0x8e')],'as':_0xca97('0x8f'),'attributes':['id','name']},{'model':db[_0xca97('0x5c')],'as':'Queue','attributes':['id','name',_0xca97('0x91')]}]})[_0xca97('0x25')](function(_0x1db071){if(_0x1db071){return _0x1db071['update']({'UserId':_0x3975eb[_0xca97('0x64')]['id']},{'transaction':_0x4f2f22});}});});}})[_0xca97('0x25')](handleEntityNotFound(_0x58a70d,null))[_0xca97('0x25')](respondWithResult(_0x58a70d,null))[_0xca97('0x54')](handleError(_0x58a70d,null));};exports['getOpenContacts']=function(_0x393589,_0xb02277,_0x34ec7e){return _0x393589[_0xca97('0x64')]['getVoiceQueues']({'where':{'type':_0xca97('0x76'),'dialActive':!![],'dialMethod':_0xca97('0x94')},'attributes':['id'],'raw':!![]})[_0xca97('0x25')](function(_0x2ba69d){if(_0x2ba69d&&_0x2ba69d['length']){return db[_0xca97('0x2c')][_0xca97('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xca97('0x67')](_0xca97('0x68'))},'VoiceQueueId':{'$in':_['map'](_0x2ba69d,'id')},'$or':[{'UserId':null},{'UserId':_0x393589[_0xca97('0x64')]['id']}]}});}return 0x0;})['then'](function(_0x2833ba){if(!_['isNil'](_0x2833ba)&&_[_0xca97('0x95')](_0x2833ba)){return _0xb02277[_0xca97('0x1b')](0xc8)['json']({'contacts':_0x2833ba});}else{logger['error'](_0xca97('0x96'),_0xca97('0x97'),0x194,_0xca97('0x98'));_0xb02277[_0xca97('0x1a')](0x194);}})[_0xca97('0x54')](handleError(_0xb02277,null));};exports['getTimezones']=function(_0x1e66ba,_0x49bd12,_0x438c17){var _0x3443f3=shared[_0xca97('0x99')];var _0x39ac4c=[];_['map'](_0x3443f3,function(_0x54a33e){_0x39ac4c['push']({'id':_0x54a33e[_0xca97('0x29')],'name':_0x54a33e[_0xca97('0x29')],'utcOffset':_0x54a33e[_0xca97('0x9a')]});});return _0x49bd12['status'](0xc8)[_0xca97('0x1d')]({'tz':_0x39ac4c});};exports[_0xca97('0x9b')]=function(_0x5716c3,_0x302110,_0x2fa798){var _0x33d6ed=shared[_0xca97('0x99')];var _0x75436c={};if(!_[_0xca97('0x70')](_0x33d6ed[_0x5716c3['body']['id']]))_0x75436c=_0x33d6ed[_0x5716c3[_0xca97('0x56')]['id']];return _0x302110['status'](0xc8)[_0xca97('0x1d')](_0x75436c);}; \ No newline at end of file +var _0x73d0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','finally','destroy','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','map','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','List','Queue','dialActive','hopperId','CmCompany','getOpenContacts','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','utcOffset','getTimezone','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x73d0,0x1c6));var _0x073d=function(_0x3e6cd6,_0x4cade5){_0x3e6cd6=_0x3e6cd6-0x0;var _0x294588=_0x73d0[_0x3e6cd6];return _0x294588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x073d('0x0'));var zipdir=require(_0x073d('0x1'));var jsonpatch=require(_0x073d('0x2'));var rp=require(_0x073d('0x3'));var moment=require(_0x073d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x073d('0x5'));var util=require('util');var path=require(_0x073d('0x6'));var sox=require(_0x073d('0x7'));var csv=require(_0x073d('0x8'));var ejs=require(_0x073d('0x9'));var fs=require('fs');var fs_extra=require(_0x073d('0xa'));var _=require('lodash');var squel=require(_0x073d('0xb'));var crypto=require(_0x073d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x073d('0xd'));var toCsv=require(_0x073d('0x8'));var querystring=require(_0x073d('0xe'));var Papa=require('papaparse');var Redis=require(_0x073d('0xf'));var authService=require(_0x073d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x073d('0x11'));var hardwareService=require(_0x073d('0x12'));var logger=require(_0x073d('0x13'))(_0x073d('0x14'));var utils=require(_0x073d('0x15'));var config=require(_0x073d('0x16'));var shared=require('../../config/environment');var licenseUtil=require(_0x073d('0x17'));var db=require(_0x073d('0x18'))['db'];function respondWithStatusCode(_0x4fa2a8,_0x12cc1a){_0x12cc1a=_0x12cc1a||0xcc;return function(_0x3e01aa){if(_0x3e01aa){return _0x4fa2a8[_0x073d('0x19')](_0x12cc1a);}return _0x4fa2a8[_0x073d('0x1a')](_0x12cc1a)[_0x073d('0x1b')]();};}function respondWithResult(_0x23cc08,_0x4635be){_0x4635be=_0x4635be||0xc8;return function(_0x684a4e){if(_0x684a4e){return _0x23cc08['status'](_0x4635be)[_0x073d('0x1c')](_0x684a4e);}};}function respondWithFilteredResult(_0x4ed300,_0x574d48){return function(_0x1a6d4d){if(_0x1a6d4d){var _0x2fe0f1=typeof _0x574d48[_0x073d('0x1d')]===_0x073d('0x1e')&&typeof _0x574d48[_0x073d('0x1f')]===_0x073d('0x1e');var _0x4cf455=_0x1a6d4d[_0x073d('0x20')];var _0x5206e6=_0x2fe0f1?0x0:_0x574d48[_0x073d('0x1d')];var _0x3c696c=_0x2fe0f1?_0x1a6d4d[_0x073d('0x20')]:_0x574d48['offset']+_0x574d48[_0x073d('0x1f')];var _0x2d85d4;if(_0x3c696c>=_0x4cf455){_0x3c696c=_0x4cf455;_0x2d85d4=0xc8;}else{_0x2d85d4=0xce;}_0x4ed300[_0x073d('0x1a')](_0x2d85d4);return _0x4ed300[_0x073d('0x21')](_0x073d('0x22'),_0x5206e6+'-'+_0x3c696c+'/'+_0x4cf455)[_0x073d('0x1c')](_0x1a6d4d);}return null;};}function patchUpdates(_0x2a70cc){return function(_0x5455da){try{jsonpatch['apply'](_0x5455da,_0x2a70cc,!![]);}catch(_0x520b38){return BPromise[_0x073d('0x23')](_0x520b38);}return _0x5455da[_0x073d('0x24')]();};}function saveUpdates(_0x906ce4,_0x149e05){return function(_0x3cc888){if(_0x3cc888){return _0x3cc888[_0x073d('0x25')](_0x906ce4)['then'](function(_0x57e04a){return _0x57e04a;});}return null;};}function removeEntity(_0x473e4c,_0x4a30cc){return function(_0x87987e){if(_0x87987e){return _0x87987e['destroy']()[_0x073d('0x26')](function(){_0x473e4c[_0x073d('0x1a')](0xcc)[_0x073d('0x1b')]();});}};}function handleEntityNotFound(_0x435e2b,_0x12c29f){return function(_0x3079ff){if(!_0x3079ff){_0x435e2b[_0x073d('0x19')](0x194);}return _0x3079ff;};}function handleError(_0x18255c,_0x57e703){_0x57e703=_0x57e703||0x1f4;return function(_0x46493d){logger['error'](_0x46493d['stack']);if(_0x46493d[_0x073d('0x27')]){delete _0x46493d[_0x073d('0x27')];}_0x18255c['status'](_0x57e703)[_0x073d('0x28')](_0x46493d);};}exports[_0x073d('0x29')]=function(_0x4618bf,_0x2a3091){var _0x19e01d={},_0x39c7fe={},_0x3e57a3={'count':0x0,'rows':[]};var _0x32a79b=_['map'](db[_0x073d('0x2a')][_0x073d('0x2b')],function(_0x1f3bad){return{'name':_0x1f3bad[_0x073d('0x2c')],'type':_0x1f3bad[_0x073d('0x2d')][_0x073d('0x2e')]};});_0x39c7fe[_0x073d('0x2f')]=_['map'](_0x32a79b,_0x073d('0x27'));_0x39c7fe[_0x073d('0x30')]=_[_0x073d('0x31')](_0x4618bf['query']);_0x39c7fe[_0x073d('0x32')]=_[_0x073d('0x33')](_0x39c7fe[_0x073d('0x2f')],_0x39c7fe[_0x073d('0x30')]);_0x39c7fe[_0x073d('0x32')]=_[_0x073d('0x34')](_0x39c7fe['filters'],[_0x073d('0x35'),'$or',_0x073d('0x36'),'$gte',_0x073d('0x37'),_0x073d('0x38'),_0x073d('0x39'),_0x073d('0x3a'),_0x073d('0x3b'),_0x073d('0x3c'),_0x073d('0x3d'),_0x073d('0x3e'),_0x073d('0x3f'),_0x073d('0x40'),_0x073d('0x41'),_0x073d('0x42'),'$notILike','$like',_0x073d('0x43'),_0x073d('0x44'),'$contained',_0x073d('0x45')]);_0x19e01d[_0x073d('0x46')]=_[_0x073d('0x33')](_0x39c7fe[_0x073d('0x2f')],qs[_0x073d('0x47')](_0x4618bf[_0x073d('0x30')][_0x073d('0x47')]));_0x19e01d['attributes']=_0x19e01d[_0x073d('0x46')][_0x073d('0x48')]?_0x19e01d['attributes']:_0x39c7fe['model'];if(!_0x4618bf['query'][_0x073d('0x49')](_0x073d('0x4a'))){_0x19e01d[_0x073d('0x1f')]=qs[_0x073d('0x1f')](_0x4618bf['query'][_0x073d('0x1f')]);_0x19e01d['offset']=qs['offset'](_0x4618bf[_0x073d('0x30')]['offset']);}_0x19e01d[_0x073d('0x4b')]=qs[_0x073d('0x4c')](_0x4618bf['query'][_0x073d('0x4c')]);_0x19e01d[_0x073d('0x4d')]=qs[_0x073d('0x32')](_[_0x073d('0x4e')](_0x4618bf[_0x073d('0x30')],_0x39c7fe[_0x073d('0x32')]),_0x32a79b);if(_0x4618bf[_0x073d('0x30')]['filter']){_0x19e01d[_0x073d('0x4d')]=_['merge'](_0x19e01d[_0x073d('0x4d')],{'$or':_['map'](_0x32a79b,function(_0x1ccb60){if(_0x1ccb60[_0x073d('0x2d')]!==_0x073d('0x4f')){var _0x41ea85={};_0x41ea85[_0x1ccb60[_0x073d('0x27')]]={'$like':'%'+_0x4618bf['query']['filter']+'%'};return _0x41ea85;}})});}_0x19e01d=_[_0x073d('0x50')]({},_0x19e01d,_0x4618bf[_0x073d('0x51')]);var _0x31bcf2={'where':_0x19e01d['where']};return db[_0x073d('0x2a')][_0x073d('0x20')](_0x31bcf2)[_0x073d('0x26')](function(_0x189c19){_0x3e57a3[_0x073d('0x20')]=_0x189c19;if(_0x4618bf[_0x073d('0x30')][_0x073d('0x52')]){_0x19e01d[_0x073d('0x53')]=[{'all':!![]}];}return db[_0x073d('0x2a')]['findAll'](_0x19e01d);})[_0x073d('0x26')](function(_0x82ee2a){_0x3e57a3['rows']=_0x82ee2a;return _0x3e57a3;})['then'](respondWithFilteredResult(_0x2a3091,_0x19e01d))[_0x073d('0x54')](handleError(_0x2a3091,null));};exports[_0x073d('0x55')]=function(_0x5d0107,_0x3f6add){var _0x5d4d9f={'raw':!![],'where':{'id':_0x5d0107[_0x073d('0x56')]['id']}},_0x7122ae={};_0x7122ae[_0x073d('0x2f')]=_['keys'](db['CmHopper']['rawAttributes']);_0x7122ae[_0x073d('0x30')]=_[_0x073d('0x31')](_0x5d0107[_0x073d('0x30')]);_0x7122ae['filters']=_[_0x073d('0x33')](_0x7122ae[_0x073d('0x2f')],_0x7122ae['query']);_0x5d4d9f[_0x073d('0x46')]=_[_0x073d('0x33')](_0x7122ae[_0x073d('0x2f')],qs[_0x073d('0x47')](_0x5d0107['query']['fields']));_0x5d4d9f[_0x073d('0x46')]=_0x5d4d9f[_0x073d('0x46')][_0x073d('0x48')]?_0x5d4d9f[_0x073d('0x46')]:_0x7122ae[_0x073d('0x2f')];if(_0x5d0107[_0x073d('0x30')]['includeAll']){_0x5d4d9f[_0x073d('0x53')]=[{'all':!![]}];}_0x5d4d9f=_[_0x073d('0x50')]({},_0x5d4d9f,_0x5d0107[_0x073d('0x51')]);return db[_0x073d('0x2a')][_0x073d('0x57')](_0x5d4d9f)[_0x073d('0x26')](handleEntityNotFound(_0x3f6add,null))[_0x073d('0x26')](respondWithResult(_0x3f6add,null))[_0x073d('0x54')](handleError(_0x3f6add,null));};exports['create']=function(_0x5ccc68,_0x1cd7fc){return db[_0x073d('0x2a')][_0x073d('0x58')](_0x5ccc68['body'],{})['then'](respondWithResult(_0x1cd7fc,0xc9))[_0x073d('0x54')](handleError(_0x1cd7fc,null));};exports[_0x073d('0x25')]=function(_0x15e3cf,_0x310de5){if(_0x15e3cf[_0x073d('0x59')]['id']){delete _0x15e3cf[_0x073d('0x59')]['id'];}return db[_0x073d('0x2a')][_0x073d('0x57')]({'where':{'id':_0x15e3cf[_0x073d('0x56')]['id']}})[_0x073d('0x26')](handleEntityNotFound(_0x310de5,null))[_0x073d('0x26')](saveUpdates(_0x15e3cf[_0x073d('0x59')],null))[_0x073d('0x26')](respondWithResult(_0x310de5,null))[_0x073d('0x54')](handleError(_0x310de5,null));};exports[_0x073d('0x5a')]=function(_0x2bd55c,_0x17687f){return db[_0x073d('0x2a')][_0x073d('0x5a')]()[_0x073d('0x26')](respondWithResult(_0x17687f,null))[_0x073d('0x54')](handleError(_0x17687f,null));};exports['destroy']=function(_0x465da6,_0x2b5975){var _0x1d16ac;var _0x93d423=_0x465da6[_0x073d('0x56')]['id'];return db[_0x073d('0x2a')][_0x073d('0x57')]({'where':{'id':_0x465da6['params']['id']}})[_0x073d('0x26')](handleEntityNotFound(_0x2b5975,null))['then'](function(_0x1a0372){if(_0x1a0372){return _0x1a0372['destroy']()['then'](function(_0x1031c5){return _0x1031c5;});}})['then'](function(_0x24065c){_0x1d16ac=_0x24065c;if(_0x24065c){if(_0x24065c[_0x073d('0x5b')]||_0x24065c['CampaignId']){return db[_0x24065c[_0x073d('0x5b')]?_0x073d('0x5c'):_0x073d('0x5d')][_0x073d('0x57')]({'where':{'id':_0x24065c[_0x073d('0x5b')]?_0x24065c['VoiceQueueId']:_0x24065c[_0x073d('0x5e')]},'attributes':['id',_0x073d('0x27')],'raw':!![]});}}})['then'](function(_0x7d2ae9){var _0x5a7288={};if(_0x7d2ae9){_[_0x073d('0x50')](_0x5a7288,_[_0x073d('0x5f')](_0x1d16ac[_0x073d('0x60')],[_0x073d('0x61'),_0x073d('0x62'),'id']));_0x5a7288[_0x073d('0x63')]=0x15;_0x5a7288[_0x073d('0x64')]='deleted';_0x5a7288['campaign']=_0x7d2ae9['name'];_0x5a7288[_0x073d('0x65')]=_0x465da6[_0x073d('0x66')][_0x073d('0x27')];_0x5a7288['UserId']=_0x465da6[_0x073d('0x66')]['id'];_0x5a7288['deleted']=!![];_0x5a7288[_0x073d('0x67')]=moment()[_0x073d('0x68')](_0x073d('0x69'));_0x5a7288[_0x073d('0x6a')]=_0x1d16ac['phone'];_0x5a7288['campaigntype']=_0x1d16ac[_0x073d('0x5b')]?_0x073d('0x6b'):_0x073d('0x6c');return db[_0x073d('0x6d')]['find']({'where':{'id':_0x5a7288[_0x073d('0x6e')]},'attributes':['firstName','lastName']})['then'](function(_0x53ddd3){if(!_['isNil'](_0x2b5975)&&!_[_0x073d('0x6f')](_0x53ddd3[_0x073d('0x70')])){_0x5a7288['calleridname']=_0x53ddd3[_0x073d('0x70')];if(!_[_0x073d('0x6f')](_0x53ddd3['lastName'])){_0x5a7288[_0x073d('0x71')]+='\x20'+_0x53ddd3['lastName'];}}})[_0x073d('0x72')](function(){return db['CmHopperFinal']['create'](_0x5a7288);});}})[_0x073d('0x26')](function(_0x467a84){return db['CmHopperAdditionalPhone'][_0x073d('0x73')]({'where':{'CmHopperId':_0x93d423}});})[_0x073d('0x26')](function(){return _0x2b5975[_0x073d('0x1a')](0xcc)[_0x073d('0x1b')]();})[_0x073d('0x54')](handleError(_0x2b5975,null));};exports[_0x073d('0x74')]=function(_0x25c72c,_0x441dee,_0x51db08){var _0x5e0be0=[];return db[_0x073d('0x6d')][_0x073d('0x5a')]()['then'](function(_0x5b443b){_0x5e0be0=_[_0x073d('0x31')](_0x5b443b);return _0x25c72c[_0x073d('0x66')][_0x073d('0x75')]({'where':{'type':_0x073d('0x76'),'dialActive':!![],'dialMethod':_0x073d('0x77')},'attributes':['id',_0x073d('0x78'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x073d('0x26')](function(_0x47c772){if(_0x47c772&&_0x47c772[_0x073d('0x48')]){return db['sequelize'][_0x073d('0x79')](function(_0x219a9d){var _0x1293f2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x073d('0x68')](_0x073d('0x69'))},'VoiceQueueId':{'$in':_[_0x073d('0x7a')](_0x47c772,'id')},'$or':[{'UserId':null},{'UserId':_0x25c72c[_0x073d('0x66')]['id']}]};var _0x3f2ff4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x47c772)['filter']([_0x073d('0x7b'),0x0])[_0x073d('0x7a')]('id')[_0x073d('0x7c')]()},'$or':[{'UserId':null},{'UserId':_0x25c72c[_0x073d('0x66')]['id']}]};var _0x585dfd={'$or':[_0x1293f2,_0x3f2ff4]};var _0x1253c6=[];if(_0x25c72c[_0x073d('0x59')][_0x073d('0x7d')]&&_0x25c72c[_0x073d('0x59')][_0x073d('0x7d')]===_0x073d('0x7e')){if(!_[_0x073d('0x7f')](_0x25c72c[_0x073d('0x59')][_0x073d('0x80')])){_0x585dfd['id']={'$in':_0x25c72c['body']['hopperIds']};}_0x1253c6=[['priority',_0x073d('0x81')],[_0x073d('0x82'),_0x47c772[0x0][_0x073d('0x78')]==='ASC'?_0x073d('0x83'):'ASC'],db[_0x073d('0x84')][_0x073d('0x85')](_0x073d('0x86')),['id','DESC']];}else{if(!_[_0x073d('0x7f')](_0x25c72c[_0x073d('0x59')][_0x073d('0x80')])){_0x585dfd['id']={'$notIn':_0x25c72c[_0x073d('0x59')][_0x073d('0x80')]};}_0x1253c6=[[_0x073d('0x87'),_0x073d('0x83')],['scheduledAt',_0x47c772[0x0][_0x073d('0x78')]],db[_0x073d('0x84')][_0x073d('0x85')](_0x073d('0x88')),['id',_0x073d('0x81')]];}return db[_0x073d('0x2a')][_0x073d('0x89')]({'attributes':['id',_0x073d('0x8a'),_0x073d('0x8b'),_0x073d('0x8c')],'where':_0x585dfd,'order':_0x1253c6,'transaction':_0x219a9d,'lock':_0x219a9d[_0x073d('0x8d')][_0x073d('0x8e')],'include':[{'model':db[_0x073d('0x6d')],'as':_0x073d('0x8f'),'attributes':_0x5e0be0,'include':[{'model':db['CmCompany'],'as':_0x073d('0x90'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x073d('0x91'),'attributes':['id','name']},{'model':db[_0x073d('0x5c')],'as':_0x073d('0x92'),'attributes':['id','name',_0x073d('0x93')]}]})['then'](function(_0x3022b3){if(_0x3022b3){return _0x3022b3[_0x073d('0x25')]({'UserId':_0x25c72c[_0x073d('0x66')]['id']},{'transaction':_0x219a9d});}});});}})[_0x073d('0x26')](handleEntityNotFound(_0x441dee,null))[_0x073d('0x26')](respondWithResult(_0x441dee,null))[_0x073d('0x54')](handleError(_0x441dee,null));};exports['getPreviewRecall']=function(_0x9ce73,_0x435040,_0xdcc956){var _0x353a6c=[];return db['CmContact'][_0x073d('0x5a')]()['then'](function(_0x19edd9){_0x353a6c=_[_0x073d('0x31')](_0x19edd9);return _0x9ce73[_0x073d('0x66')][_0x073d('0x75')]({'where':{'type':_0x073d('0x76'),'dialActive':!![],'dialMethod':_0x073d('0x77')},'attributes':['id',_0x073d('0x78'),_0x073d('0x7b')],'raw':!![]});})['then'](function(_0x16983d){if(_0x16983d&&_0x16983d['length']){return db[_0x073d('0x84')][_0x073d('0x79')](function(_0x233697){var _0x5d7d55={'active':![],'recallme':!![],'id':_0x9ce73[_0x073d('0x59')][_0x073d('0x94')]};return db['CmHopper'][_0x073d('0x89')]({'attributes':['id',_0x073d('0x8a'),_0x073d('0x8c')],'where':_0x5d7d55,'transaction':_0x233697,'lock':_0x233697[_0x073d('0x8d')][_0x073d('0x8e')],'include':[{'model':db[_0x073d('0x6d')],'as':_0x073d('0x8f'),'attributes':_0x353a6c,'include':[{'model':db[_0x073d('0x95')],'as':_0x073d('0x90'),'attributes':['id',_0x073d('0x27')]}]},{'model':db['CmList'],'as':_0x073d('0x91'),'attributes':['id',_0x073d('0x27')]},{'model':db[_0x073d('0x5c')],'as':'Queue','attributes':['id',_0x073d('0x27'),'dialActive']}]})[_0x073d('0x26')](function(_0xda8bb4){if(_0xda8bb4){return _0xda8bb4[_0x073d('0x25')]({'UserId':_0x9ce73['user']['id']},{'transaction':_0x233697});}});});}})[_0x073d('0x26')](handleEntityNotFound(_0x435040,null))[_0x073d('0x26')](respondWithResult(_0x435040,null))[_0x073d('0x54')](handleError(_0x435040,null));};exports[_0x073d('0x96')]=function(_0x132f00,_0x372654,_0x2c3fa3){return _0x132f00[_0x073d('0x66')][_0x073d('0x75')]({'where':{'type':_0x073d('0x76'),'dialActive':!![],'dialMethod':_0x073d('0x77')},'attributes':['id'],'raw':!![]})[_0x073d('0x26')](function(_0x1b89ef){if(_0x1b89ef&&_0x1b89ef[_0x073d('0x48')]){return db[_0x073d('0x2a')][_0x073d('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x073d('0x68')](_0x073d('0x69'))},'VoiceQueueId':{'$in':_[_0x073d('0x7a')](_0x1b89ef,'id')},'$or':[{'UserId':null},{'UserId':_0x132f00['user']['id']}]}});}return 0x0;})[_0x073d('0x26')](function(_0x4da758){if(!_[_0x073d('0x6f')](_0x4da758)&&_['isNumber'](_0x4da758)){return _0x372654[_0x073d('0x1a')](0xc8)['json']({'contacts':_0x4da758});}else{logger[_0x073d('0x97')](_0x073d('0x98'),_0x073d('0x96'),0x194,_0x073d('0x99'));_0x372654['sendStatus'](0x194);}})[_0x073d('0x54')](handleError(_0x372654,null));};exports[_0x073d('0x9a')]=function(_0x4e1ce2,_0x32f17b,_0x4a8764){var _0x1f1141=shared['timezones'];var _0xd5a084=[];_[_0x073d('0x7a')](_0x1f1141,function(_0x24936b){_0xd5a084['push']({'id':_0x24936b[_0x073d('0x27')],'name':_0x24936b[_0x073d('0x27')],'utcOffset':_0x24936b[_0x073d('0x9b')]});});return _0x32f17b['status'](0xc8)[_0x073d('0x1c')]({'tz':_0xd5a084});};exports[_0x073d('0x9c')]=function(_0xd61f9a,_0x45dbcc,_0x239380){var _0x524e00=shared['timezones'];var _0x507017={};if(!_['isNil'](_0x524e00[_0xd61f9a[_0x073d('0x59')]['id']]))_0x507017=_0x524e00[_0xd61f9a[_0x073d('0x59')]['id']];return _0x45dbcc[_0x073d('0x1a')](0xc8)[_0x073d('0x1c')](_0x507017);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 70c2240..1bcc82e 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 _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1a0011,_0x32b202){var _0x49bfb2=function(_0x2ecc23){while(--_0x2ecc23){_0x1a0011['push'](_0x1a0011['shift']());}};_0x49bfb2(++_0x32b202);}(_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('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x2c18d6,_0xdd5ac1){var _0x551c3a=function(_0x2a8668){while(--_0x2a8668){_0x2c18d6['push'](_0x2c18d6['shift']());}};_0x551c3a(++_0xdd5ac1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x8afaa5,_0x171a39){_0x8afaa5=_0x8afaa5-0x0;var _0x721181=_0xd8fb[_0x8afaa5];return _0x721181;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index da9f05a..6f2e04c 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 _0x8a78=['message','result','catch','GetCmHopper','CmHopper','options','attributes','limit','include','model','map','debug','ShowCmHopper','find','raw','where','stringify','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','order','LOCK','UPDATE','Contact','keys','name','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','UserId','GetContactRecallMe','GetCmHopperPreview','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','voicePause','CmList','List','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8a78,0x158));var _0x88a7=function(_0xc298ad,_0xea4dc2){_0xc298ad=_0xc298ad-0x0;var _0x11b2e6=_0x8a78[_0xc298ad];return _0x11b2e6;};'use strict';var _=require(_0x88a7('0x0'));var util=require(_0x88a7('0x1'));var moment=require(_0x88a7('0x2'));var BPromise=require(_0x88a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a7('0x4'));var db=require(_0x88a7('0x5'))['db'];var utils=require(_0x88a7('0x6'));var logger=require(_0x88a7('0x7'))(_0x88a7('0x8'));var config=require('../../config/environment');var jayson=require(_0x88a7('0x9'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x88a7('0xa')][_0x88a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x118b71,_0x38201b,_0x585571){return new BPromise(function(_0xd25e66,_0x4092d8){return client[_0x88a7('0xc')](_0x118b71,_0x585571)[_0x88a7('0xd')](function(_0x3e67c2){logger[_0x88a7('0xe')](_0x88a7('0xf'),_0x38201b,_0x88a7('0x10'));logger['debug'](_0x88a7('0x11'),_0x38201b,_0x88a7('0x10'),JSON['stringify'](_0x3e67c2));if(_0x3e67c2[_0x88a7('0x12')]){if(_0x3e67c2['error'][_0x88a7('0x13')]===0x1f4){logger[_0x88a7('0x12')](_0x88a7('0xf'),_0x38201b,_0x3e67c2['error'][_0x88a7('0x14')]);return _0x4092d8(_0x3e67c2[_0x88a7('0x12')][_0x88a7('0x14')]);}logger['error'](_0x88a7('0xf'),_0x38201b,_0x3e67c2[_0x88a7('0x12')]['message']);return _0xd25e66(_0x3e67c2[_0x88a7('0x12')]['message']);}else{logger[_0x88a7('0xe')](_0x88a7('0xf'),_0x38201b,_0x88a7('0x10'));_0xd25e66(_0x3e67c2[_0x88a7('0x15')][_0x88a7('0x14')]);}})[_0x88a7('0x16')](function(_0x489c4c){logger['error'](_0x88a7('0xf'),_0x38201b,_0x489c4c);_0x4092d8(_0x489c4c);});});}exports[_0x88a7('0x17')]=function(_0x49a061){var _0x28c99f=this;return new Promise(function(_0x3086fd,_0x37b164){return db[_0x88a7('0x18')]['findAll']({'raw':_0x49a061['options']?_0x49a061[_0x88a7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49a061[_0x88a7('0x19')]?_0x49a061[_0x88a7('0x19')]['where']||null:null,'attributes':_0x49a061['options']?_0x49a061['options'][_0x88a7('0x1a')]||null:null,'limit':_0x49a061[_0x88a7('0x19')]?_0x49a061[_0x88a7('0x19')][_0x88a7('0x1b')]||null:null,'include':_0x49a061[_0x88a7('0x19')]?_0x49a061['options']['include']?_['map'](_0x49a061[_0x88a7('0x19')][_0x88a7('0x1c')],function(_0x31f895){return{'model':db[_0x31f895[_0x88a7('0x1d')]],'as':_0x31f895['as'],'attributes':_0x31f895[_0x88a7('0x1a')],'include':_0x31f895[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x31f895[_0x88a7('0x1c')],function(_0x192e95){return{'model':db[_0x192e95['model']],'as':_0x192e95['as'],'attributes':_0x192e95[_0x88a7('0x1a')],'include':_0x192e95[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x192e95[_0x88a7('0x1c')],function(_0x27408d){return{'model':db[_0x27408d[_0x88a7('0x1d')]],'as':_0x27408d['as'],'attributes':_0x27408d[_0x88a7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59bbf4){logger[_0x88a7('0xe')](_0x88a7('0x17'),_0x49a061);logger[_0x88a7('0x1f')](_0x88a7('0x17'),_0x49a061,JSON['stringify'](_0x59bbf4));_0x3086fd(_0x59bbf4);})[_0x88a7('0x16')](function(_0x41fbe0){logger[_0x88a7('0x12')](_0x88a7('0x17'),_0x41fbe0[_0x88a7('0x14')],_0x49a061);_0x37b164(_0x28c99f[_0x88a7('0x12')](0x1f4,_0x41fbe0[_0x88a7('0x14')]));});});};exports[_0x88a7('0x20')]=function(_0x18b03e){var _0x34b0a2=this;return new Promise(function(_0x404cae,_0x4631bd){return db[_0x88a7('0x18')][_0x88a7('0x21')]({'raw':_0x18b03e[_0x88a7('0x19')]?_0x18b03e['options'][_0x88a7('0x22')]===undefined?!![]:![]:!![],'where':_0x18b03e['options']?_0x18b03e[_0x88a7('0x19')][_0x88a7('0x23')]||null:null,'attributes':_0x18b03e[_0x88a7('0x19')]?_0x18b03e[_0x88a7('0x19')][_0x88a7('0x1a')]||null:null,'include':_0x18b03e['options']?_0x18b03e[_0x88a7('0x19')][_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x18b03e[_0x88a7('0x19')][_0x88a7('0x1c')],function(_0x2ebc70){return{'model':db[_0x2ebc70['model']],'as':_0x2ebc70['as'],'attributes':_0x2ebc70['attributes'],'include':_0x2ebc70[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x2ebc70[_0x88a7('0x1c')],function(_0x45827b){return{'model':db[_0x45827b[_0x88a7('0x1d')]],'as':_0x45827b['as'],'attributes':_0x45827b['attributes'],'include':_0x45827b[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x45827b['include'],function(_0x5e6ad7){return{'model':db[_0x5e6ad7['model']],'as':_0x5e6ad7['as'],'attributes':_0x5e6ad7[_0x88a7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x88a7('0xd')](function(_0xb49bf9){logger[_0x88a7('0xe')]('ShowCmHopper',_0x18b03e);logger[_0x88a7('0x1f')](_0x88a7('0x20'),_0x18b03e,JSON[_0x88a7('0x24')](_0xb49bf9));_0x404cae(_0xb49bf9);})[_0x88a7('0x16')](function(_0x2ac3f2){logger['error'](_0x88a7('0x20'),_0x2ac3f2['message'],_0x18b03e);_0x4631bd(_0x34b0a2['error'](0x1f4,_0x2ac3f2[_0x88a7('0x14')]));});});};exports[_0x88a7('0x25')]=function(_0xb12aa1){var _0x3f36d7=this;return new Promise(function(_0x16bac5,_0x34f0f6){return db[_0x88a7('0x18')][_0x88a7('0x26')](_0xb12aa1[_0x88a7('0x27')],{'raw':_0xb12aa1[_0x88a7('0x19')]?_0xb12aa1[_0x88a7('0x19')][_0x88a7('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x2db0ea){logger[_0x88a7('0xe')](_0x88a7('0x25'),_0xb12aa1);logger[_0x88a7('0x1f')](_0x88a7('0x25'),_0xb12aa1,JSON[_0x88a7('0x24')](_0x2db0ea));_0x16bac5(_0x2db0ea);})[_0x88a7('0x16')](function(_0x3f6446){logger[_0x88a7('0x12')](_0x88a7('0x25'),_0x3f6446[_0x88a7('0x14')],_0xb12aa1);_0x34f0f6(_0x3f36d7[_0x88a7('0x12')](0x1f4,_0x3f6446[_0x88a7('0x14')]));});});};exports['UpdateCmHopper']=function(_0x4896c1){var _0x57b4df=this;return new Promise(function(_0x232894,_0x2d8655){return db['CmHopper'][_0x88a7('0x28')](_0x4896c1[_0x88a7('0x27')],{'raw':_0x4896c1['options']?_0x4896c1[_0x88a7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4896c1['options']?_0x4896c1[_0x88a7('0x19')]['where']||null:null,'attributes':_0x4896c1[_0x88a7('0x19')]?_0x4896c1['options'][_0x88a7('0x1a')]||null:null,'limit':_0x4896c1[_0x88a7('0x19')]?_0x4896c1[_0x88a7('0x19')][_0x88a7('0x1b')]||null:null})[_0x88a7('0xd')](function(_0x20d56e){logger[_0x88a7('0xe')](_0x88a7('0x29'),_0x4896c1);logger[_0x88a7('0xe')](_0x88a7('0x2a'),JSON['stringify'](_0x4896c1[_0x88a7('0x19')][_0x88a7('0x23')]),_0x4896c1[_0x88a7('0x27')]['active']);logger[_0x88a7('0x1f')](_0x88a7('0x29'),_0x4896c1,JSON[_0x88a7('0x24')](_0x20d56e));_0x232894(_0x20d56e);})[_0x88a7('0x16')](function(_0x438ca6){logger['error'](_0x88a7('0x29'),_0x438ca6[_0x88a7('0x14')],_0x4896c1);_0x2d8655(_0x57b4df[_0x88a7('0x12')](0x1f4,_0x438ca6['message']));});});};exports[_0x88a7('0x2b')]=function(_0x1c33ce){var _0x189a2b=this;return new Promise(function(_0x5a3ce8,_0x5be31f){return db['CmHopper'][_0x88a7('0x2c')]({'where':_0x1c33ce[_0x88a7('0x19')]?_0x1c33ce['options']['where']||null:null})[_0x88a7('0xd')](function(_0x127f0f){logger[_0x88a7('0xe')](_0x88a7('0x2b'),_0x1c33ce);logger[_0x88a7('0x1f')]('DestroyCmHopper',_0x1c33ce,JSON[_0x88a7('0x24')](_0x127f0f));_0x5a3ce8(_0x127f0f);})[_0x88a7('0x16')](function(_0x59eacd){logger[_0x88a7('0x12')](_0x88a7('0x2b'),_0x59eacd[_0x88a7('0x14')],_0x1c33ce);_0x5be31f(_0x189a2b[_0x88a7('0x12')](0x1f4,_0x59eacd[_0x88a7('0x14')]));});});};exports[_0x88a7('0x2d')]=function(_0x103d6e){var _0x5863f3=this;return new Promise(function(_0x44f1c2,_0x47b188){return db[_0x88a7('0x2e')][_0x88a7('0x2f')]()['then'](function(_0x55b132){return db[_0x88a7('0x30')]['transaction'](function(_0x57fc18){return db['CmHopper'][_0x88a7('0x31')]({'where':_0x103d6e[_0x88a7('0x19')]?_0x103d6e[_0x88a7('0x19')][_0x88a7('0x23')]||null:null,'attributes':_0x103d6e[_0x88a7('0x19')]?_0x103d6e[_0x88a7('0x19')][_0x88a7('0x1a')]||null:null,'limit':_0x103d6e[_0x88a7('0x19')]?_0x103d6e[_0x88a7('0x19')][_0x88a7('0x1b')]||null:null,'order':_0x103d6e[_0x88a7('0x19')]?_0x103d6e[_0x88a7('0x19')][_0x88a7('0x32')]||null:null,'transaction':_0x57fc18,'lock':_0x57fc18[_0x88a7('0x33')][_0x88a7('0x34')],'include':[{'model':db[_0x88a7('0x2e')],'as':_0x88a7('0x35'),'attributes':_[_0x88a7('0x36')](_0x55b132)},{'model':db['User'],'as':'Agent','attributes':['id',_0x88a7('0x37'),'voicePause']}]})['then'](function(_0x50c95c){var _0x27ee31=[];var _0x295d27=[];for(var _0x2cf247=0x0;_0x2cf247<_0x50c95c[_0x88a7('0x38')];_0x2cf247+=0x1){var _0xe04bf8=_0x50c95c[_0x2cf247]['UserId'];if(_0xe04bf8===null){_0x27ee31[_0x88a7('0x39')](_0x50c95c[_0x2cf247][_0x88a7('0x28')](_0x103d6e[_0x88a7('0x27')],{'transaction':_0x57fc18}));}else if(!_0x295d27[_0x88a7('0x3a')](_0xe04bf8)){_0x295d27['push'](_0xe04bf8);_0x27ee31[_0x88a7('0x39')](_0x50c95c[_0x2cf247][_0x88a7('0x28')](_0x103d6e[_0x88a7('0x27')],{'transaction':_0x57fc18}));}}return BPromise[_0x88a7('0x3b')](_0x27ee31);});})[_0x88a7('0xd')](function(_0x526658){logger[_0x88a7('0xe')]('GetContactDialer',_0x103d6e);if(_0x526658[_0x88a7('0x38')]>0x0){logger[_0x88a7('0xe')](_0x88a7('0x3c'),_0x526658[0x0][_0x88a7('0x3d')]['id'],_0x526658[0x0][_0x88a7('0x3d')]['ContactId'],_0x526658[0x0][_0x88a7('0x3d')][_0x88a7('0x3e')]);}logger[_0x88a7('0x1f')](_0x88a7('0x2d'),_0x103d6e,JSON[_0x88a7('0x24')](_0x526658));_0x44f1c2(_0x526658);})[_0x88a7('0x16')](function(_0xaf215f){logger['error'](_0x88a7('0x2d'),_0xaf215f['message'],_0x103d6e);_0x47b188(_0x5863f3[_0x88a7('0x12')](0x1f4,_0xaf215f[_0x88a7('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x26d2ca){var _0x54a061=this;return new Promise(function(_0x4c0f98,_0x3de059){return db[_0x88a7('0x30')][_0x88a7('0x3f')](function(_0x58e95a){return db[_0x88a7('0x40')]['create'](_0x26d2ca[_0x88a7('0x27')],{'raw':_0x26d2ca[_0x88a7('0x19')]?_0x26d2ca['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x58e95a})[_0x88a7('0xd')](function(){logger[_0x88a7('0xe')](_0x88a7('0x41'),JSON[_0x88a7('0x24')](_0x26d2ca[_0x88a7('0x19')]['where']),_0x26d2ca[_0x88a7('0x19')]['where'][_0x88a7('0x3e')]);return db[_0x88a7('0x18')][_0x88a7('0x2c')]({'where':_0x26d2ca[_0x88a7('0x19')]?_0x26d2ca[_0x88a7('0x19')][_0x88a7('0x23')]||null:null,'transaction':_0x58e95a});});})[_0x88a7('0xd')](function(_0x4a341f){logger[_0x88a7('0xe')](_0x88a7('0x42'),_0x26d2ca);logger['debug'](_0x88a7('0x42'),_0x26d2ca,JSON[_0x88a7('0x24')](_0x4a341f));_0x4c0f98(_0x4a341f);})[_0x88a7('0x16')](function(_0x64ca40){logger['error'](_0x88a7('0x42'),_0x64ca40[_0x88a7('0x14')],_0x26d2ca);_0x3de059(_0x54a061[_0x88a7('0x12')](0x1f4,_0x64ca40[_0x88a7('0x14')]));});});};exports[_0x88a7('0x43')]=function(_0x3d3d73){var _0x474f9a=this;return new Promise(function(_0x8bb981,_0x15a716){return db[_0x88a7('0x18')][_0x88a7('0x31')]({'raw':_0x3d3d73['options']?_0x3d3d73[_0x88a7('0x19')][_0x88a7('0x22')]===undefined?!![]:![]:!![],'where':_0x3d3d73['options']?_0x3d3d73[_0x88a7('0x19')]['where']||null:null,'attributes':[[db[_0x88a7('0x30')]['fn']('COUNT',db[_0x88a7('0x30')]['fn']('IF',db[_0x88a7('0x30')][_0x88a7('0x44')](_0x88a7('0x45')+util[_0x88a7('0x46')](_0x88a7('0x47'),moment()[_0x88a7('0x46')](_0x88a7('0x48')))+'\x20,\x201,\x20null'))),_0x88a7('0x49')]]})[_0x88a7('0xd')](function(_0x28e907){logger['info'](_0x88a7('0x43'),_0x3d3d73);logger[_0x88a7('0x1f')](_0x88a7('0x43'),_0x3d3d73,JSON['stringify'](_0x28e907));_0x8bb981(_0x28e907);})[_0x88a7('0x16')](function(_0x1b9c66){logger[_0x88a7('0x12')]('CountReScheduled',_0x1b9c66[_0x88a7('0x14')],_0x3d3d73);_0x15a716(_0x474f9a[_0x88a7('0x12')](0x1f4,_0x1b9c66[_0x88a7('0x14')]));});});};exports['GetContactRecallMe']=function(_0x5021d7){var _0x9bdda0=this;return new Promise(function(_0x41e9f0,_0x475233){return db[_0x88a7('0x2e')][_0x88a7('0x2f')]()[_0x88a7('0xd')](function(_0x335049){return db['sequelize'][_0x88a7('0x3f')](function(_0x521ac8){return db[_0x88a7('0x18')][_0x88a7('0x31')]({'where':_0x5021d7[_0x88a7('0x19')]?_0x5021d7[_0x88a7('0x19')][_0x88a7('0x23')]||null:null,'attributes':_0x5021d7[_0x88a7('0x19')]?_0x5021d7[_0x88a7('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x5021d7[_0x88a7('0x19')]?_0x5021d7[_0x88a7('0x19')][_0x88a7('0x32')]||null:null,'group':db['CmHopper'][_0x88a7('0x4a')],'transaction':_0x521ac8,'lock':_0x521ac8[_0x88a7('0x33')][_0x88a7('0x34')],'include':_0x5021d7[_0x88a7('0x19')]?_0x5021d7[_0x88a7('0x19')][_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x5021d7[_0x88a7('0x19')][_0x88a7('0x1c')],function(_0x47f015){return{'model':db[_0x47f015[_0x88a7('0x1d')]],'as':_0x47f015['as'],'attributes':_0x47f015[_0x88a7('0x1a')],'include':_0x47f015[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x47f015[_0x88a7('0x1c')],function(_0x54752c){return{'model':db[_0x54752c['model']],'as':_0x54752c['as'],'attributes':_0x54752c[_0x88a7('0x1a')],'include':_0x54752c[_0x88a7('0x1c')]?_[_0x88a7('0x1e')](_0x54752c['include'],function(_0x4422f0){return{'model':db[_0x4422f0['model']],'as':_0x4422f0['as'],'attributes':_0x4422f0[_0x88a7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x88a7('0xd')](function(_0x438f7a){var _0x3d5de1=[];for(var _0x2ae3b7=0x0;_0x2ae3b7<_0x438f7a['length'];_0x2ae3b7+=0x1){_0x3d5de1[_0x88a7('0x39')](_0x438f7a[_0x2ae3b7][_0x88a7('0x28')](_0x5021d7[_0x88a7('0x27')],{'transaction':_0x521ac8}));}return BPromise[_0x88a7('0x3b')](_0x3d5de1);});})[_0x88a7('0xd')](function(_0x504644){logger[_0x88a7('0xe')](_0x88a7('0x4b'),_0x5021d7);logger[_0x88a7('0x1f')]('GetContactRecallMe',_0x5021d7,JSON[_0x88a7('0x24')](_0x504644));_0x41e9f0(_0x504644);})['catch'](function(_0x412e52){logger[_0x88a7('0x12')](_0x88a7('0x4b'),_0x412e52[_0x88a7('0x14')],_0x5021d7);_0x475233(_0x9bdda0[_0x88a7('0x12')](0x1f4,_0x412e52[_0x88a7('0x14')]));});});});};exports[_0x88a7('0x4c')]=function(_0x47f5ca){var _0x1cafa2=this;return new Promise(function(_0x4ee23f,_0x529236){db[_0x88a7('0x2e')]['describe']()['then'](function(_0x2ff7fb){return db[_0x88a7('0x18')][_0x88a7('0x31')]({'raw':_0x47f5ca['options']?_0x47f5ca[_0x88a7('0x19')][_0x88a7('0x22')]===undefined?!![]:![]:!![],'where':_0x47f5ca[_0x88a7('0x19')]?_0x47f5ca[_0x88a7('0x19')][_0x88a7('0x23')]||null:null,'attributes':_0x47f5ca[_0x88a7('0x19')]?_0x47f5ca['options'][_0x88a7('0x1a')]||null:null,'limit':_0x47f5ca[_0x88a7('0x19')]?_0x47f5ca[_0x88a7('0x19')]['limit']||null:null,'include':_0x47f5ca['options']?_0x47f5ca['options']['include']?_[_0x88a7('0x1e')](_0x47f5ca['options'][_0x88a7('0x1c')],function(_0x21e064){return{'model':db[_0x21e064['model']],'as':_0x21e064['as'],'attributes':_0x21e064['as']===_0x88a7('0x35')?_[_0x88a7('0x36')](_0x2ff7fb):_0x21e064[_0x88a7('0x1a')],'include':_0x21e064[_0x88a7('0x1c')]?_['map'](_0x21e064[_0x88a7('0x1c')],function(_0x363344){return{'model':db[_0x363344[_0x88a7('0x1d')]],'as':_0x363344['as'],'attributes':_0x363344['attributes'],'include':_0x363344[_0x88a7('0x1c')]?_['map'](_0x363344[_0x88a7('0x1c')],function(_0x1c1498){return{'model':db[_0x1c1498[_0x88a7('0x1d')]],'as':_0x1c1498['as'],'attributes':_0x1c1498[_0x88a7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x88a7('0xd')](function(_0x5b6684){logger[_0x88a7('0xe')](_0x88a7('0x17'),_0x47f5ca);logger[_0x88a7('0x1f')]('GetCmHopper',_0x47f5ca,JSON[_0x88a7('0x24')](_0x5b6684));_0x4ee23f(_0x5b6684);})['catch'](function(_0x4b7df9){logger[_0x88a7('0x12')](_0x88a7('0x17'),_0x4b7df9[_0x88a7('0x14')],_0x47f5ca);_0x529236(_0x1cafa2[_0x88a7('0x12')](0x1f4,_0x4b7df9[_0x88a7('0x14')]));});});});};exports['GetContactByPhone']=function(_0x6898a1){var _0x1e23b0=this;return new Promise(function(_0x1c9e46,_0x523aa4){return db[_0x88a7('0x2e')][_0x88a7('0x4d')]({'raw':!![],'where':{'phone':_0x6898a1[_0x88a7('0x19')][_0x88a7('0x23')][_0x88a7('0x4e')]},'attributes':['id','dialTimezone'],'order':[['id',_0x88a7('0x4f')]]})[_0x88a7('0xd')](function(_0x5a83a7){logger[_0x88a7('0xe')](_0x88a7('0x50'),_0x6898a1);logger['debug'](_0x88a7('0x50'),_0x6898a1,JSON[_0x88a7('0x24')](_0x5a83a7));_0x1c9e46(_0x5a83a7);})[_0x88a7('0x16')](function(_0x4b202c){logger[_0x88a7('0x12')](_0x88a7('0x50'),_0x4b202c[_0x88a7('0x14')],_0x6898a1);_0x523aa4(_0x1e23b0['error'](0x1f4,_0x4b202c['message']));});});};exports['ResetActiveCalls']=function(_0x21b41d){var _0x55aa12=this;return new Promise(function(_0x34a8b0,_0x22bafe){return db[_0x88a7('0x30')][_0x88a7('0x3f')](function(_0x391880){return db['CmHopper'][_0x88a7('0x28')]({'active':![]},{'where':{},'transaction':_0x391880})['then'](function(_0x35705c){logger[_0x88a7('0xe')]('ResetActiveCalls',_0x21b41d);logger['debug'](_0x88a7('0x51'),_0x21b41d,JSON[_0x88a7('0x24')](_0x35705c));_0x34a8b0(_0x35705c);})[_0x88a7('0x16')](function(_0x25e222){logger[_0x88a7('0x12')](_0x88a7('0x51'),_0x25e222['message'],_0x21b41d);_0x22bafe(_0x55aa12[_0x88a7('0x12')](0x1f4,_0x25e222['message']));});});});};exports[_0x88a7('0x52')]=function(_0x416753){var _0x3a50b7=this;var _0x5af289=_0x416753[_0x88a7('0x27')][_0x88a7('0x23')][_0x88a7('0x53')];var _0x37b81c=_0x416753[_0x88a7('0x27')][_0x88a7('0x23')][_0x88a7('0x54')];return new Promise(function(_0x45d0dc,_0x431605){return db['CmHopper']['findAll']({'where':{'voiceQueueId':_0x5af289,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x88a7('0x30')]['literal'](_0x88a7('0x55')+_0x37b81c+_0x88a7('0x56'))}},'include':[{'model':db['CmContact'],'as':_0x88a7('0x35')},{'model':db['User'],'as':_0x88a7('0x57'),'attributes':['id',_0x88a7('0x37'),_0x88a7('0x58')]},{'model':db[_0x88a7('0x59')],'as':_0x88a7('0x5a')}]})[_0x88a7('0xd')](function(_0x210a84){return db[_0x88a7('0x30')][_0x88a7('0x3f')](function(_0x5ee45f){return db[_0x88a7('0x18')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x5af289,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x88a7('0x30')]['literal'](_0x88a7('0x55')+_0x37b81c+_0x88a7('0x56'))}},'transaction':_0x5ee45f})['then'](function(_0x4c1e95){_0x45d0dc(_0x210a84);})['catch'](function(_0x2b15d0){logger['error'](_0x88a7('0x52'),_0x2b15d0[_0x88a7('0x14')],_0x416753);_0x431605(validateExpressRequest);});});})['catch'](function(_0x52af30){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x52af30[_0x88a7('0x14')],_0x416753);_0x431605(_0x3a50b7[_0x88a7('0x12')](0x1f4,_0x52af30[_0x88a7('0x14')]));});});}; \ No newline at end of file +var _0x1f70=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','then','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','Agent','name','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','length','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','literal','NOW()\x20+\x20INTERVAL\x20','User','voicePause','CmList','List','lodash','util'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x1f70,0x176));var _0x01f7=function(_0x52f3b4,_0x2bcaec){_0x52f3b4=_0x52f3b4-0x0;var _0x2ac632=_0x1f70[_0x52f3b4];return _0x2ac632;};'use strict';var _=require(_0x01f7('0x0'));var util=require(_0x01f7('0x1'));var moment=require(_0x01f7('0x2'));var BPromise=require(_0x01f7('0x3'));var rs=require(_0x01f7('0x4'));var fs=require('fs');var Redis=require(_0x01f7('0x5'));var db=require(_0x01f7('0x6'))['db'];var utils=require(_0x01f7('0x7'));var logger=require(_0x01f7('0x8'))(_0x01f7('0x9'));var config=require(_0x01f7('0xa'));var jayson=require(_0x01f7('0xb'));const {validateExpressRequest}=require(_0x01f7('0xc'));var client=jayson[_0x01f7('0xd')][_0x01f7('0xe')]({'port':0x232a});function respondWithRpcPromise(_0x31c084,_0x34e862,_0x5ce7b6){return new BPromise(function(_0x29a18f,_0x25f52c){return client[_0x01f7('0xf')](_0x31c084,_0x5ce7b6)['then'](function(_0x48dd12){logger[_0x01f7('0x10')](_0x01f7('0x11'),_0x34e862,_0x01f7('0x12'));logger[_0x01f7('0x13')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x34e862,_0x01f7('0x12'),JSON[_0x01f7('0x14')](_0x48dd12));if(_0x48dd12[_0x01f7('0x15')]){if(_0x48dd12[_0x01f7('0x15')][_0x01f7('0x16')]===0x1f4){logger[_0x01f7('0x15')](_0x01f7('0x11'),_0x34e862,_0x48dd12['error'][_0x01f7('0x17')]);return _0x25f52c(_0x48dd12[_0x01f7('0x15')][_0x01f7('0x17')]);}logger[_0x01f7('0x15')](_0x01f7('0x11'),_0x34e862,_0x48dd12[_0x01f7('0x15')][_0x01f7('0x17')]);return _0x29a18f(_0x48dd12[_0x01f7('0x15')][_0x01f7('0x17')]);}else{logger[_0x01f7('0x10')](_0x01f7('0x11'),_0x34e862,_0x01f7('0x12'));_0x29a18f(_0x48dd12[_0x01f7('0x18')]['message']);}})[_0x01f7('0x19')](function(_0x1e4624){logger[_0x01f7('0x15')]('CmHopper,\x20%s,\x20%s',_0x34e862,_0x1e4624);_0x25f52c(_0x1e4624);});});}exports[_0x01f7('0x1a')]=function(_0x1a88b1){var _0x151d72=this;return new Promise(function(_0x5eebea,_0x15f4ba){return db[_0x01f7('0x1b')][_0x01f7('0x1c')]({'raw':_0x1a88b1[_0x01f7('0x1d')]?_0x1a88b1[_0x01f7('0x1d')][_0x01f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a88b1[_0x01f7('0x1d')]?_0x1a88b1[_0x01f7('0x1d')][_0x01f7('0x1f')]||null:null,'attributes':_0x1a88b1[_0x01f7('0x1d')]?_0x1a88b1['options'][_0x01f7('0x20')]||null:null,'limit':_0x1a88b1['options']?_0x1a88b1[_0x01f7('0x1d')][_0x01f7('0x21')]||null:null,'include':_0x1a88b1[_0x01f7('0x1d')]?_0x1a88b1['options'][_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x1a88b1['options']['include'],function(_0x9b88c6){return{'model':db[_0x9b88c6[_0x01f7('0x24')]],'as':_0x9b88c6['as'],'attributes':_0x9b88c6['attributes'],'include':_0x9b88c6['include']?_[_0x01f7('0x23')](_0x9b88c6[_0x01f7('0x22')],function(_0x4b6ec3){return{'model':db[_0x4b6ec3[_0x01f7('0x24')]],'as':_0x4b6ec3['as'],'attributes':_0x4b6ec3[_0x01f7('0x20')],'include':_0x4b6ec3['include']?_['map'](_0x4b6ec3[_0x01f7('0x22')],function(_0x100349){return{'model':db[_0x100349['model']],'as':_0x100349['as'],'attributes':_0x100349['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12abaf){logger[_0x01f7('0x10')](_0x01f7('0x1a'),_0x1a88b1);logger['debug']('GetCmHopper',_0x1a88b1,JSON['stringify'](_0x12abaf));_0x5eebea(_0x12abaf);})['catch'](function(_0x8c9f83){logger[_0x01f7('0x15')](_0x01f7('0x1a'),_0x8c9f83[_0x01f7('0x17')],_0x1a88b1);_0x15f4ba(_0x151d72['error'](0x1f4,_0x8c9f83['message']));});});};exports[_0x01f7('0x25')]=function(_0x4b3324){var _0x4fb3ac=this;return new Promise(function(_0x32dec6,_0x1c8aed){return db[_0x01f7('0x1b')][_0x01f7('0x26')]({'raw':_0x4b3324[_0x01f7('0x1d')]?_0x4b3324[_0x01f7('0x1d')][_0x01f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b3324['options']?_0x4b3324['options']['where']||null:null,'attributes':_0x4b3324[_0x01f7('0x1d')]?_0x4b3324[_0x01f7('0x1d')][_0x01f7('0x20')]||null:null,'include':_0x4b3324[_0x01f7('0x1d')]?_0x4b3324[_0x01f7('0x1d')]['include']?_[_0x01f7('0x23')](_0x4b3324[_0x01f7('0x1d')][_0x01f7('0x22')],function(_0x3c6aec){return{'model':db[_0x3c6aec['model']],'as':_0x3c6aec['as'],'attributes':_0x3c6aec[_0x01f7('0x20')],'include':_0x3c6aec[_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x3c6aec[_0x01f7('0x22')],function(_0x168c37){return{'model':db[_0x168c37[_0x01f7('0x24')]],'as':_0x168c37['as'],'attributes':_0x168c37[_0x01f7('0x20')],'include':_0x168c37[_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x168c37[_0x01f7('0x22')],function(_0x14514f){return{'model':db[_0x14514f[_0x01f7('0x24')]],'as':_0x14514f['as'],'attributes':_0x14514f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22e67b){logger[_0x01f7('0x10')](_0x01f7('0x25'),_0x4b3324);logger[_0x01f7('0x13')](_0x01f7('0x25'),_0x4b3324,JSON[_0x01f7('0x14')](_0x22e67b));_0x32dec6(_0x22e67b);})['catch'](function(_0x24ff46){logger['error'](_0x01f7('0x25'),_0x24ff46[_0x01f7('0x17')],_0x4b3324);_0x1c8aed(_0x4fb3ac[_0x01f7('0x15')](0x1f4,_0x24ff46[_0x01f7('0x17')]));});});};exports[_0x01f7('0x27')]=function(_0x1f5044){var _0x4df45a=this;return new Promise(function(_0x302afe,_0x102212){return db['CmHopper'][_0x01f7('0x28')](_0x1f5044['body'],{'raw':_0x1f5044[_0x01f7('0x1d')]?_0x1f5044[_0x01f7('0x1d')][_0x01f7('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4f293e){logger['info'](_0x01f7('0x27'),_0x1f5044);logger[_0x01f7('0x13')]('CreateCmHopper',_0x1f5044,JSON[_0x01f7('0x14')](_0x4f293e));_0x302afe(_0x4f293e);})[_0x01f7('0x19')](function(_0x2ecec2){logger[_0x01f7('0x15')](_0x01f7('0x27'),_0x2ecec2[_0x01f7('0x17')],_0x1f5044);_0x102212(_0x4df45a['error'](0x1f4,_0x2ecec2[_0x01f7('0x17')]));});});};exports[_0x01f7('0x29')]=function(_0x4fa221){var _0x4e9f3a=this;return new Promise(function(_0x2f4482,_0x2039bd){return db['CmHopper'][_0x01f7('0x2a')](_0x4fa221[_0x01f7('0x2b')],{'raw':_0x4fa221[_0x01f7('0x1d')]?_0x4fa221[_0x01f7('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fa221[_0x01f7('0x1d')]?_0x4fa221['options']['where']||null:null,'attributes':_0x4fa221[_0x01f7('0x1d')]?_0x4fa221[_0x01f7('0x1d')][_0x01f7('0x20')]||null:null,'limit':_0x4fa221[_0x01f7('0x1d')]?_0x4fa221[_0x01f7('0x1d')]['limit']||null:null})[_0x01f7('0x2c')](function(_0x45520f){logger[_0x01f7('0x10')](_0x01f7('0x29'),_0x4fa221);logger[_0x01f7('0x10')](_0x01f7('0x2d'),JSON['stringify'](_0x4fa221[_0x01f7('0x1d')][_0x01f7('0x1f')]),_0x4fa221[_0x01f7('0x2b')][_0x01f7('0x2e')]);logger[_0x01f7('0x13')](_0x01f7('0x29'),_0x4fa221,JSON[_0x01f7('0x14')](_0x45520f));_0x2f4482(_0x45520f);})[_0x01f7('0x19')](function(_0x6fec20){logger[_0x01f7('0x15')]('UpdateCmHopper',_0x6fec20[_0x01f7('0x17')],_0x4fa221);_0x2039bd(_0x4e9f3a[_0x01f7('0x15')](0x1f4,_0x6fec20[_0x01f7('0x17')]));});});};exports[_0x01f7('0x2f')]=function(_0x2e3caf){var _0x3b61d4=this;return new Promise(function(_0x3d0107,_0x3a97fb){return db[_0x01f7('0x1b')]['destroy']({'where':_0x2e3caf['options']?_0x2e3caf[_0x01f7('0x1d')][_0x01f7('0x1f')]||null:null})[_0x01f7('0x2c')](function(_0x468c16){logger[_0x01f7('0x10')]('DestroyCmHopper',_0x2e3caf);logger[_0x01f7('0x13')](_0x01f7('0x2f'),_0x2e3caf,JSON[_0x01f7('0x14')](_0x468c16));_0x3d0107(_0x468c16);})['catch'](function(_0x2fc766){logger[_0x01f7('0x15')]('DestroyCmHopper',_0x2fc766[_0x01f7('0x17')],_0x2e3caf);_0x3a97fb(_0x3b61d4[_0x01f7('0x15')](0x1f4,_0x2fc766[_0x01f7('0x17')]));});});};exports[_0x01f7('0x30')]=function(_0x1b6e90){var _0x25f6ea=this;return new Promise(function(_0x47c7e8,_0x58a01b){return db[_0x01f7('0x31')][_0x01f7('0x32')]()[_0x01f7('0x2c')](function(_0x18fd4f){return db[_0x01f7('0x33')][_0x01f7('0x34')](function(_0x372a27){return db['CmHopper'][_0x01f7('0x1c')]({'where':_0x1b6e90['options']?_0x1b6e90['options']['where']||null:null,'attributes':_0x1b6e90[_0x01f7('0x1d')]?_0x1b6e90[_0x01f7('0x1d')][_0x01f7('0x20')]||null:null,'limit':_0x1b6e90[_0x01f7('0x1d')]?_0x1b6e90['options'][_0x01f7('0x21')]||null:null,'order':_0x1b6e90[_0x01f7('0x1d')]?_0x1b6e90[_0x01f7('0x1d')]['order']||null:null,'transaction':_0x372a27,'lock':_0x372a27['LOCK'][_0x01f7('0x35')],'include':[{'model':db['CmContact'],'as':_0x01f7('0x36'),'attributes':_[_0x01f7('0x37')](_0x18fd4f)},{'model':db['User'],'as':_0x01f7('0x38'),'attributes':['id',_0x01f7('0x39'),'voicePause']}]})[_0x01f7('0x2c')](function(_0x509eb3){var _0x5b1c31=[];var _0x6b86da=[];for(var _0xba41ce=0x0;_0xba41ce<_0x509eb3['length'];_0xba41ce+=0x1){var _0x30bf79=_0x509eb3[_0xba41ce][_0x01f7('0x3a')];if(_0x30bf79===null){_0x5b1c31[_0x01f7('0x3b')](_0x509eb3[_0xba41ce]['update'](_0x1b6e90[_0x01f7('0x2b')],{'transaction':_0x372a27}));}else if(!_0x6b86da[_0x01f7('0x3c')](_0x30bf79)){_0x6b86da[_0x01f7('0x3b')](_0x30bf79);_0x5b1c31[_0x01f7('0x3b')](_0x509eb3[_0xba41ce][_0x01f7('0x2a')](_0x1b6e90[_0x01f7('0x2b')],{'transaction':_0x372a27}));}}return BPromise[_0x01f7('0x3d')](_0x5b1c31);});})[_0x01f7('0x2c')](function(_0x1d2d9){logger[_0x01f7('0x10')](_0x01f7('0x30'),_0x1b6e90);if(_0x1d2d9['length']>0x0){logger[_0x01f7('0x10')](_0x01f7('0x3e'),_0x1d2d9[0x0]['dataValues']['id'],_0x1d2d9[0x0]['dataValues'][_0x01f7('0x3f')],_0x1d2d9[0x0]['dataValues'][_0x01f7('0x2e')]);}logger[_0x01f7('0x13')](_0x01f7('0x30'),_0x1b6e90,JSON[_0x01f7('0x14')](_0x1d2d9));_0x47c7e8(_0x1d2d9);})[_0x01f7('0x19')](function(_0x599ee4){logger[_0x01f7('0x15')](_0x01f7('0x30'),_0x599ee4[_0x01f7('0x17')],_0x1b6e90);_0x58a01b(_0x25f6ea['error'](0x1f4,_0x599ee4[_0x01f7('0x17')]));});});});};exports['MoveContactManagedDialer']=function(_0x22df54){var _0x5aee19=this;return new Promise(function(_0x1dfce8,_0x5a00f7){return db[_0x01f7('0x33')][_0x01f7('0x34')](function(_0x12bfc3){return db[_0x01f7('0x40')][_0x01f7('0x28')](_0x22df54[_0x01f7('0x2b')],{'raw':_0x22df54['options']?_0x22df54[_0x01f7('0x1d')]['raw']===undefined?!![]:![]:!![],'transaction':_0x12bfc3})[_0x01f7('0x2c')](function(){logger[_0x01f7('0x10')](_0x01f7('0x41'),JSON['stringify'](_0x22df54[_0x01f7('0x1d')][_0x01f7('0x1f')]),_0x22df54[_0x01f7('0x1d')][_0x01f7('0x1f')][_0x01f7('0x2e')]);return db[_0x01f7('0x1b')][_0x01f7('0x42')]({'where':_0x22df54[_0x01f7('0x1d')]?_0x22df54[_0x01f7('0x1d')]['where']||null:null,'transaction':_0x12bfc3});});})['then'](function(_0x326723){logger[_0x01f7('0x10')](_0x01f7('0x43'),_0x22df54);logger[_0x01f7('0x13')](_0x01f7('0x43'),_0x22df54,JSON[_0x01f7('0x14')](_0x326723));_0x1dfce8(_0x326723);})[_0x01f7('0x19')](function(_0x41817f){logger[_0x01f7('0x15')](_0x01f7('0x43'),_0x41817f[_0x01f7('0x17')],_0x22df54);_0x5a00f7(_0x5aee19[_0x01f7('0x15')](0x1f4,_0x41817f[_0x01f7('0x17')]));});});};exports[_0x01f7('0x44')]=function(_0x435636){var _0x55cdfa=this;return new Promise(function(_0x1e4690,_0xc00729){return db[_0x01f7('0x1b')][_0x01f7('0x1c')]({'raw':_0x435636[_0x01f7('0x1d')]?_0x435636[_0x01f7('0x1d')][_0x01f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x435636[_0x01f7('0x1d')]?_0x435636[_0x01f7('0x1d')][_0x01f7('0x1f')]||null:null,'attributes':[[db[_0x01f7('0x33')]['fn'](_0x01f7('0x45'),db[_0x01f7('0x33')]['fn']('IF',db[_0x01f7('0x33')]['literal']('`scheduledat`\x20>=\x20'+util[_0x01f7('0x46')]('\x22%s\x22',moment()[_0x01f7('0x46')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x01f7('0x47')))),_0x01f7('0x48')]]})['then'](function(_0x41507f){logger['info'](_0x01f7('0x44'),_0x435636);logger[_0x01f7('0x13')](_0x01f7('0x44'),_0x435636,JSON[_0x01f7('0x14')](_0x41507f));_0x1e4690(_0x41507f);})['catch'](function(_0x3dd68a){logger[_0x01f7('0x15')](_0x01f7('0x44'),_0x3dd68a[_0x01f7('0x17')],_0x435636);_0xc00729(_0x55cdfa[_0x01f7('0x15')](0x1f4,_0x3dd68a[_0x01f7('0x17')]));});});};exports[_0x01f7('0x49')]=function(_0x4ba247){var _0xbb1355=this;return new Promise(function(_0x3dc147,_0x5227ff){return db[_0x01f7('0x31')][_0x01f7('0x32')]()['then'](function(_0x10eddd){return db[_0x01f7('0x33')]['transaction'](function(_0xab50bd){return db[_0x01f7('0x1b')][_0x01f7('0x1c')]({'where':_0x4ba247[_0x01f7('0x1d')]?_0x4ba247[_0x01f7('0x1d')][_0x01f7('0x1f')]||null:null,'attributes':_0x4ba247['options']?_0x4ba247[_0x01f7('0x1d')][_0x01f7('0x20')]||null:null,'limit':0x1,'order':_0x4ba247['options']?_0x4ba247[_0x01f7('0x1d')][_0x01f7('0x4a')]||null:null,'group':db[_0x01f7('0x1b')]['UserId'],'transaction':_0xab50bd,'lock':_0xab50bd[_0x01f7('0x4b')][_0x01f7('0x35')],'include':_0x4ba247['options']?_0x4ba247[_0x01f7('0x1d')][_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x4ba247[_0x01f7('0x1d')][_0x01f7('0x22')],function(_0x40293f){return{'model':db[_0x40293f[_0x01f7('0x24')]],'as':_0x40293f['as'],'attributes':_0x40293f['attributes'],'include':_0x40293f['include']?_[_0x01f7('0x23')](_0x40293f[_0x01f7('0x22')],function(_0x166c23){return{'model':db[_0x166c23[_0x01f7('0x24')]],'as':_0x166c23['as'],'attributes':_0x166c23[_0x01f7('0x20')],'include':_0x166c23['include']?_[_0x01f7('0x23')](_0x166c23['include'],function(_0x12ad6b){return{'model':db[_0x12ad6b['model']],'as':_0x12ad6b['as'],'attributes':_0x12ad6b[_0x01f7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x420f77){var _0x4410b2=[];for(var _0x56e511=0x0;_0x56e511<_0x420f77[_0x01f7('0x4c')];_0x56e511+=0x1){_0x4410b2[_0x01f7('0x3b')](_0x420f77[_0x56e511][_0x01f7('0x2a')](_0x4ba247['body'],{'transaction':_0xab50bd}));}return BPromise['all'](_0x4410b2);});})[_0x01f7('0x2c')](function(_0x81f6f5){logger[_0x01f7('0x10')]('GetContactRecallMe',_0x4ba247);logger[_0x01f7('0x13')](_0x01f7('0x49'),_0x4ba247,JSON['stringify'](_0x81f6f5));_0x3dc147(_0x81f6f5);})['catch'](function(_0x27a86b){logger[_0x01f7('0x15')](_0x01f7('0x49'),_0x27a86b[_0x01f7('0x17')],_0x4ba247);_0x5227ff(_0xbb1355[_0x01f7('0x15')](0x1f4,_0x27a86b[_0x01f7('0x17')]));});});});};exports[_0x01f7('0x4d')]=function(_0x20008d){var _0x3cd2c0=this;return new Promise(function(_0x584c00,_0xc94447){db[_0x01f7('0x31')][_0x01f7('0x32')]()[_0x01f7('0x2c')](function(_0x59691b){return db[_0x01f7('0x1b')][_0x01f7('0x1c')]({'raw':_0x20008d[_0x01f7('0x1d')]?_0x20008d['options'][_0x01f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x20008d['options']?_0x20008d['options'][_0x01f7('0x1f')]||null:null,'attributes':_0x20008d['options']?_0x20008d[_0x01f7('0x1d')][_0x01f7('0x20')]||null:null,'limit':_0x20008d[_0x01f7('0x1d')]?_0x20008d[_0x01f7('0x1d')][_0x01f7('0x21')]||null:null,'include':_0x20008d[_0x01f7('0x1d')]?_0x20008d[_0x01f7('0x1d')][_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x20008d['options'][_0x01f7('0x22')],function(_0xaa519c){return{'model':db[_0xaa519c[_0x01f7('0x24')]],'as':_0xaa519c['as'],'attributes':_0xaa519c['as']===_0x01f7('0x36')?_[_0x01f7('0x37')](_0x59691b):_0xaa519c['attributes'],'include':_0xaa519c[_0x01f7('0x22')]?_['map'](_0xaa519c['include'],function(_0x107c85){return{'model':db[_0x107c85['model']],'as':_0x107c85['as'],'attributes':_0x107c85['attributes'],'include':_0x107c85[_0x01f7('0x22')]?_[_0x01f7('0x23')](_0x107c85[_0x01f7('0x22')],function(_0x4a1486){return{'model':db[_0x4a1486[_0x01f7('0x24')]],'as':_0x4a1486['as'],'attributes':_0x4a1486[_0x01f7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x01f7('0x2c')](function(_0x413b02){logger[_0x01f7('0x10')](_0x01f7('0x1a'),_0x20008d);logger[_0x01f7('0x13')](_0x01f7('0x1a'),_0x20008d,JSON[_0x01f7('0x14')](_0x413b02));_0x584c00(_0x413b02);})[_0x01f7('0x19')](function(_0x76dc6f){logger[_0x01f7('0x15')](_0x01f7('0x1a'),_0x76dc6f[_0x01f7('0x17')],_0x20008d);_0xc94447(_0x3cd2c0[_0x01f7('0x15')](0x1f4,_0x76dc6f[_0x01f7('0x17')]));});});});};exports[_0x01f7('0x4e')]=function(_0x3f3b20){var _0xd99a6f=this;return new Promise(function(_0x30d72e,_0x828a72){return db['CmContact'][_0x01f7('0x4f')]({'raw':!![],'where':{'phone':_0x3f3b20[_0x01f7('0x1d')][_0x01f7('0x1f')][_0x01f7('0x50')]},'attributes':['id',_0x01f7('0x51')],'order':[['id',_0x01f7('0x52')]]})[_0x01f7('0x2c')](function(_0x52fd10){logger['info']('getContactByPhone',_0x3f3b20);logger['debug'](_0x01f7('0x53'),_0x3f3b20,JSON[_0x01f7('0x14')](_0x52fd10));_0x30d72e(_0x52fd10);})[_0x01f7('0x19')](function(_0x50cf89){logger['error'](_0x01f7('0x53'),_0x50cf89[_0x01f7('0x17')],_0x3f3b20);_0x828a72(_0xd99a6f[_0x01f7('0x15')](0x1f4,_0x50cf89['message']));});});};exports['ResetActiveCalls']=function(_0x34468b){var _0x57dd8e=this;return new Promise(function(_0x4d7029,_0x40b7e0){return db[_0x01f7('0x33')][_0x01f7('0x34')](function(_0x57aedf){return db[_0x01f7('0x1b')][_0x01f7('0x2a')]({'active':![]},{'where':{},'transaction':_0x57aedf})[_0x01f7('0x2c')](function(_0x14191b){logger[_0x01f7('0x10')](_0x01f7('0x54'),_0x34468b);logger[_0x01f7('0x13')](_0x01f7('0x54'),_0x34468b,JSON[_0x01f7('0x14')](_0x14191b));_0x4d7029(_0x14191b);})['catch'](function(_0x3a1245){logger[_0x01f7('0x15')](_0x01f7('0x54'),_0x3a1245['message'],_0x34468b);_0x40b7e0(_0x57dd8e[_0x01f7('0x15')](0x1f4,_0x3a1245['message']));});});});};exports[_0x01f7('0x55')]=function(_0x3abe65){var _0xd23993=this;var _0x5c5a8e=_0x3abe65[_0x01f7('0x2b')][_0x01f7('0x1f')][_0x01f7('0x56')];var _0x604e31=_0x3abe65[_0x01f7('0x2b')][_0x01f7('0x1f')][_0x01f7('0x57')];return new Promise(function(_0x5c0fad,_0x2ca532){return db[_0x01f7('0x1b')][_0x01f7('0x1c')]({'where':{'voiceQueueId':_0x5c5a8e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x01f7('0x33')][_0x01f7('0x58')](_0x01f7('0x59')+_0x604e31+'\x20MINUTE')}},'include':[{'model':db[_0x01f7('0x31')],'as':_0x01f7('0x36')},{'model':db[_0x01f7('0x5a')],'as':'Agent','attributes':['id','name',_0x01f7('0x5b')]},{'model':db[_0x01f7('0x5c')],'as':_0x01f7('0x5d')}]})[_0x01f7('0x2c')](function(_0x5e8f56){return db[_0x01f7('0x33')][_0x01f7('0x34')](function(_0x1e6390){return db[_0x01f7('0x1b')][_0x01f7('0x2a')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x5c5a8e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x01f7('0x33')][_0x01f7('0x58')](_0x01f7('0x59')+_0x604e31+'\x20MINUTE')}},'transaction':_0x1e6390})[_0x01f7('0x2c')](function(_0x4ba0eb){_0x5c0fad(_0x5e8f56);})[_0x01f7('0x19')](function(_0x19b177){logger[_0x01f7('0x15')](_0x01f7('0x55'),_0x19b177['message'],_0x3abe65);_0x2ca532(validateExpressRequest);});});})[_0x01f7('0x19')](function(_0x4b9888){logger[_0x01f7('0x15')](_0x01f7('0x55'),_0x4b9888[_0x01f7('0x17')],_0x3abe65);_0x2ca532(_0xd23993[_0x01f7('0x15')](0x1f4,_0x4b9888[_0x01f7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0813c8a..c55f1ac 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 _0xb285=['update','delete','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','show','post','create','/preview','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','put'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0xb285,0x11a));var _0x5b28=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xb285[_0x27beea];return _0x122645;};'use strict';var multer=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var path=require(_0x5b28('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b28('0x3'));var router=express['Router']();var fs_extra=require(_0x5b28('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b28('0x5'));var config=require(_0x5b28('0x6'));var controller=require(_0x5b28('0x7'));router[_0x5b28('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b28('0x8')](_0x5b28('0x9'),auth[_0x5b28('0xa')](),controller[_0x5b28('0xb')]);router['get'](_0x5b28('0xc'),auth[_0x5b28('0xa')](),controller['getOpenContacts']);router['get'](_0x5b28('0xd'),auth['isAuthenticated'](),controller[_0x5b28('0xe')]);router[_0x5b28('0x8')](_0x5b28('0xf'),auth['isAuthenticated'](),controller[_0x5b28('0x10')]);router[_0x5b28('0x11')]('/',auth[_0x5b28('0xa')](),controller[_0x5b28('0x12')]);router[_0x5b28('0x11')](_0x5b28('0x13'),auth[_0x5b28('0xa')](),controller[_0x5b28('0x14')]);router[_0x5b28('0x11')](_0x5b28('0x15'),auth[_0x5b28('0xa')](),controller[_0x5b28('0x16')]);router[_0x5b28('0x11')](_0x5b28('0x17'),auth[_0x5b28('0xa')](),controller[_0x5b28('0x18')]);router[_0x5b28('0x19')]('/:id',auth[_0x5b28('0xa')](),controller[_0x5b28('0x1a')]);router[_0x5b28('0x1b')](_0x5b28('0xf'),auth[_0x5b28('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcab6=['getTimezone','/previewrecall','getPreviewRecall','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/timezone'];(function(_0x1be2a5,_0x55e0ce){var _0x5c9047=function(_0x26f5ff){while(--_0x26f5ff){_0x1be2a5['push'](_0x1be2a5['shift']());}};_0x5c9047(++_0x55e0ce);}(_0xcab6,0x1ab));var _0x6cab=function(_0xa57015,_0x2662dd){_0xa57015=_0xa57015-0x0;var _0x4caf68=_0xcab6[_0xa57015];return _0x4caf68;};'use strict';var multer=require(_0x6cab('0x0'));var util=require(_0x6cab('0x1'));var path=require('path');var timeout=require(_0x6cab('0x2'));var express=require(_0x6cab('0x3'));var router=express[_0x6cab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cab('0x5'));var interaction=require(_0x6cab('0x6'));var config=require(_0x6cab('0x7'));var controller=require(_0x6cab('0x8'));router[_0x6cab('0x9')]('/',auth['isAuthenticated'](),controller[_0x6cab('0xa')]);router[_0x6cab('0x9')](_0x6cab('0xb'),auth[_0x6cab('0xc')](),controller[_0x6cab('0xd')]);router[_0x6cab('0x9')](_0x6cab('0xe'),auth[_0x6cab('0xc')](),controller[_0x6cab('0xf')]);router[_0x6cab('0x9')](_0x6cab('0x10'),auth[_0x6cab('0xc')](),controller[_0x6cab('0x11')]);router[_0x6cab('0x9')](_0x6cab('0x12'),auth[_0x6cab('0xc')](),controller[_0x6cab('0x13')]);router[_0x6cab('0x14')]('/',auth[_0x6cab('0xc')](),controller[_0x6cab('0x15')]);router[_0x6cab('0x14')]('/preview',auth[_0x6cab('0xc')](),controller['getPreview']);router[_0x6cab('0x14')](_0x6cab('0x16'),auth['isAuthenticated'](),controller[_0x6cab('0x17')]);router['post'](_0x6cab('0x18'),auth[_0x6cab('0xc')](),controller[_0x6cab('0x19')]);router[_0x6cab('0x1a')](_0x6cab('0x12'),auth[_0x6cab('0xc')](),controller['update']);router[_0x6cab('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x6cab('0x1c')]);module[_0x6cab('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index db7654b..755bad1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa98=['STRING','format','exports','INTEGER'];(function(_0x3d46c6,_0x43b3a1){var _0x375246=function(_0x1e8abf){while(--_0x1e8abf){_0x3d46c6['push'](_0x3d46c6['shift']());}};_0x375246(++_0x43b3a1);}(_0xaa98,0x17a));var _0x8aa9=function(_0x16fd58,_0x416fe9){_0x16fd58=_0x16fd58-0x0;var _0x445681=_0xaa98[_0x16fd58];return _0x445681;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x8aa9('0x0')]={'CmHopperId':{'type':Sequelize[_0x8aa9('0x1')]},'phone':{'type':Sequelize[_0x8aa9('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8aa9('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8aa9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7e6=['moment','sequelize','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46a187,_0x120a55){var _0x1e6960=function(_0x137ffe){while(--_0x137ffe){_0x46a187['push'](_0x46a187['shift']());}};_0x1e6960(++_0x120a55);}(_0xf7e6,0xb8));var _0x6f7e=function(_0x401146,_0x3619ac){_0x401146=_0x401146-0x0;var _0x3e7d99=_0xf7e6[_0x401146];return _0x3e7d99;};'use strict';var moment=require(_0x6f7e('0x0'));var Sequelize=require(_0x6f7e('0x1'));module[_0x6f7e('0x2')]={'CmHopperId':{'type':Sequelize[_0x6f7e('0x3')]},'phone':{'type':Sequelize[_0x6f7e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6f7e('0x5')],'defaultValue':moment()[_0x6f7e('0x6')](_0x6f7e('0x7'))},'countbusyretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f7e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index cf554b5..b40d73e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec21=['name','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','CmHopperAdditionalPhone','count','includeAll','findAll','rows','catch','params','include','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0xec21,0xba));var _0x1ec2=function(_0x3d1260,_0x1277bb){_0x3d1260=_0x3d1260-0x0;var _0x18c14b=_0xec21[_0x3d1260];return _0x18c14b;};'use strict';var emlformat=require(_0x1ec2('0x0'));var rimraf=require(_0x1ec2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ec2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1ec2('0x3'));var util=require(_0x1ec2('0x4'));var path=require('path');var sox=require(_0x1ec2('0x5'));var csv=require(_0x1ec2('0x6'));var ejs=require(_0x1ec2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1ec2('0x8'));var crypto=require(_0x1ec2('0x9'));var jsforce=require(_0x1ec2('0xa'));var deskjs=require(_0x1ec2('0xb'));var toCsv=require(_0x1ec2('0x6'));var querystring=require('querystring');var Papa=require(_0x1ec2('0xc'));var Redis=require('ioredis');var authService=require(_0x1ec2('0xd'));var qs=require(_0x1ec2('0xe'));var as=require(_0x1ec2('0xf'));var hardwareService=require(_0x1ec2('0x10'));var logger=require('../../config/logger')(_0x1ec2('0x11'));var utils=require(_0x1ec2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1ec2('0x13'));var db=require(_0x1ec2('0x14'))['db'];function respondWithStatusCode(_0x31859f,_0x4a0e3f){_0x4a0e3f=_0x4a0e3f||0xcc;return function(_0x566d93){if(_0x566d93){return _0x31859f[_0x1ec2('0x15')](_0x4a0e3f);}return _0x31859f['status'](_0x4a0e3f)[_0x1ec2('0x16')]();};}function respondWithResult(_0x4bfda6,_0x2bb22f){_0x2bb22f=_0x2bb22f||0xc8;return function(_0x41d88e){if(_0x41d88e){return _0x4bfda6[_0x1ec2('0x17')](_0x2bb22f)['json'](_0x41d88e);}};}function respondWithFilteredResult(_0x302af4,_0x868547){return function(_0x14dea6){if(_0x14dea6){var _0x3927c1=typeof _0x868547[_0x1ec2('0x18')]===_0x1ec2('0x19')&&typeof _0x868547[_0x1ec2('0x1a')]===_0x1ec2('0x19');var _0x5dab4e=_0x14dea6['count'];var _0x373ea8=_0x3927c1?0x0:_0x868547[_0x1ec2('0x18')];var _0x4f8715=_0x3927c1?_0x14dea6['count']:_0x868547[_0x1ec2('0x18')]+_0x868547[_0x1ec2('0x1a')];var _0x15cfe5;if(_0x4f8715>=_0x5dab4e){_0x4f8715=_0x5dab4e;_0x15cfe5=0xc8;}else{_0x15cfe5=0xce;}_0x302af4[_0x1ec2('0x17')](_0x15cfe5);return _0x302af4['set'](_0x1ec2('0x1b'),_0x373ea8+'-'+_0x4f8715+'/'+_0x5dab4e)[_0x1ec2('0x1c')](_0x14dea6);}return null;};}function patchUpdates(_0x32f18e){return function(_0x41143d){try{jsonpatch[_0x1ec2('0x1d')](_0x41143d,_0x32f18e,!![]);}catch(_0x8870ca){return BPromise[_0x1ec2('0x1e')](_0x8870ca);}return _0x41143d[_0x1ec2('0x1f')]();};}function saveUpdates(_0x396eb3,_0x1aa52c){return function(_0x5b9dee){if(_0x5b9dee){return _0x5b9dee[_0x1ec2('0x20')](_0x396eb3)[_0x1ec2('0x21')](function(_0x38549b){return _0x38549b;});}return null;};}function removeEntity(_0x5edf55,_0x452553){return function(_0x3e678b){if(_0x3e678b){return _0x3e678b['destroy']()[_0x1ec2('0x21')](function(){var _0xf89870=_0x3e678b[_0x1ec2('0x22')]({'plain':!![]});var _0x2ef88d=_0x1ec2('0x23');return db[_0x1ec2('0x24')][_0x1ec2('0x25')]({'where':{'type':_0x2ef88d,'resourceId':_0xf89870['id']}})[_0x1ec2('0x21')](function(){return _0x3e678b;});})[_0x1ec2('0x21')](function(){_0x5edf55[_0x1ec2('0x17')](0xcc)[_0x1ec2('0x16')]();});}};}function handleEntityNotFound(_0x3adc2b,_0xafbc54){return function(_0x19647d){if(!_0x19647d){_0x3adc2b[_0x1ec2('0x15')](0x194);}return _0x19647d;};}function handleError(_0x1471c2,_0x12c9e6){_0x12c9e6=_0x12c9e6||0x1f4;return function(_0x552458){logger[_0x1ec2('0x26')](_0x552458['stack']);if(_0x552458[_0x1ec2('0x27')]){delete _0x552458[_0x1ec2('0x27')];}_0x1471c2['status'](_0x12c9e6)['send'](_0x552458);};}exports['index']=function(_0x52bd4c,_0x2f5da7){var _0x549693={},_0x3b45ed={},_0x418376={'count':0x0,'rows':[]};var _0x2bd63d=_['map'](db['CmHopperAdditionalPhone'][_0x1ec2('0x28')],function(_0x16c9e1){return{'name':_0x16c9e1['fieldName'],'type':_0x16c9e1[_0x1ec2('0x29')][_0x1ec2('0x2a')]};});_0x3b45ed['model']=_['map'](_0x2bd63d,_0x1ec2('0x27'));_0x3b45ed[_0x1ec2('0x2b')]=_[_0x1ec2('0x2c')](_0x52bd4c[_0x1ec2('0x2b')]);_0x3b45ed[_0x1ec2('0x2d')]=_[_0x1ec2('0x2e')](_0x3b45ed['model'],_0x3b45ed[_0x1ec2('0x2b')]);_0x549693['attributes']=_[_0x1ec2('0x2e')](_0x3b45ed[_0x1ec2('0x2f')],qs['fields'](_0x52bd4c['query'][_0x1ec2('0x30')]));_0x549693['attributes']=_0x549693[_0x1ec2('0x31')][_0x1ec2('0x32')]?_0x549693[_0x1ec2('0x31')]:_0x3b45ed[_0x1ec2('0x2f')];if(!_0x52bd4c['query'][_0x1ec2('0x33')](_0x1ec2('0x34'))){_0x549693[_0x1ec2('0x1a')]=qs['limit'](_0x52bd4c[_0x1ec2('0x2b')]['limit']);_0x549693[_0x1ec2('0x18')]=qs[_0x1ec2('0x18')](_0x52bd4c[_0x1ec2('0x2b')][_0x1ec2('0x18')]);}_0x549693['order']=qs['sort'](_0x52bd4c['query'][_0x1ec2('0x35')]);_0x549693[_0x1ec2('0x36')]=qs[_0x1ec2('0x2d')](_['pick'](_0x52bd4c[_0x1ec2('0x2b')],_0x3b45ed[_0x1ec2('0x2d')]),_0x2bd63d);if(_0x52bd4c['query'][_0x1ec2('0x37')]){_0x549693[_0x1ec2('0x36')]=_[_0x1ec2('0x38')](_0x549693[_0x1ec2('0x36')],{'$or':_['map'](_0x2bd63d,function(_0x26d425){if(_0x26d425[_0x1ec2('0x29')]!==_0x1ec2('0x39')){var _0x5714d3={};_0x5714d3[_0x26d425[_0x1ec2('0x27')]]={'$like':'%'+_0x52bd4c[_0x1ec2('0x2b')][_0x1ec2('0x37')]+'%'};return _0x5714d3;}})});}_0x549693=_[_0x1ec2('0x38')]({},_0x549693,_0x52bd4c['options']);var _0x56f6a1={'where':_0x549693[_0x1ec2('0x36')]};return db[_0x1ec2('0x3a')]['count'](_0x56f6a1)[_0x1ec2('0x21')](function(_0x170493){_0x418376[_0x1ec2('0x3b')]=_0x170493;if(_0x52bd4c['query'][_0x1ec2('0x3c')]){_0x549693['include']=[{'all':!![]}];}return db[_0x1ec2('0x3a')][_0x1ec2('0x3d')](_0x549693);})[_0x1ec2('0x21')](function(_0x25f56a){_0x418376[_0x1ec2('0x3e')]=_0x25f56a;return _0x418376;})['then'](respondWithFilteredResult(_0x2f5da7,_0x549693))[_0x1ec2('0x3f')](handleError(_0x2f5da7,null));};exports['show']=function(_0x11850e,_0x2564c1){var _0x1c30a5={'raw':!![],'where':{'id':_0x11850e[_0x1ec2('0x40')]['id']}},_0x25e443={};_0x25e443[_0x1ec2('0x2f')]=_[_0x1ec2('0x2c')](db[_0x1ec2('0x3a')][_0x1ec2('0x28')]);_0x25e443[_0x1ec2('0x2b')]=_['keys'](_0x11850e[_0x1ec2('0x2b')]);_0x25e443[_0x1ec2('0x2d')]=_[_0x1ec2('0x2e')](_0x25e443['model'],_0x25e443[_0x1ec2('0x2b')]);_0x1c30a5[_0x1ec2('0x31')]=_[_0x1ec2('0x2e')](_0x25e443[_0x1ec2('0x2f')],qs[_0x1ec2('0x30')](_0x11850e[_0x1ec2('0x2b')][_0x1ec2('0x30')]));_0x1c30a5[_0x1ec2('0x31')]=_0x1c30a5['attributes'][_0x1ec2('0x32')]?_0x1c30a5['attributes']:_0x25e443[_0x1ec2('0x2f')];if(_0x11850e[_0x1ec2('0x2b')][_0x1ec2('0x3c')]){_0x1c30a5[_0x1ec2('0x41')]=[{'all':!![]}];}_0x1c30a5=_['merge']({},_0x1c30a5,_0x11850e[_0x1ec2('0x42')]);return db[_0x1ec2('0x3a')][_0x1ec2('0x43')](_0x1c30a5)['then'](handleEntityNotFound(_0x2564c1,null))['then'](respondWithResult(_0x2564c1,null))[_0x1ec2('0x3f')](handleError(_0x2564c1,null));};exports['create']=function(_0x44c885,_0x4b441c){return db[_0x1ec2('0x3a')][_0x1ec2('0x44')](_0x44c885[_0x1ec2('0x45')],{})['then'](function(_0x4d5e77){var _0x309630=_0x44c885['user'][_0x1ec2('0x22')]({'plain':!![]});if(!_0x309630)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x309630['role']===_0x1ec2('0x46')){var _0x24537b=_0x4d5e77[_0x1ec2('0x22')]({'plain':!![]});var _0x5d2856='CmHopperAdditionalPhones';return db[_0x1ec2('0x47')][_0x1ec2('0x43')]({'where':{'name':_0x5d2856,'userProfileId':_0x309630[_0x1ec2('0x48')]},'raw':!![]})[_0x1ec2('0x21')](function(_0xe55d80){if(_0xe55d80&&_0xe55d80[_0x1ec2('0x49')]===0x0){return db[_0x1ec2('0x24')][_0x1ec2('0x44')]({'name':_0x24537b['name'],'resourceId':_0x24537b['id'],'type':_0xe55d80[_0x1ec2('0x27')],'sectionId':_0xe55d80['id']},{})['then'](function(){return _0x4d5e77;});}else{return _0x4d5e77;}})['catch'](function(_0x2c6383){logger[_0x1ec2('0x26')](_0x1ec2('0x4a'),_0x2c6383);throw _0x2c6383;});}return _0x4d5e77;})[_0x1ec2('0x21')](respondWithResult(_0x4b441c,0xc9))[_0x1ec2('0x3f')](handleError(_0x4b441c,null));};exports[_0x1ec2('0x20')]=function(_0x473054,_0x1ca912){if(_0x473054[_0x1ec2('0x45')]['id']){delete _0x473054[_0x1ec2('0x45')]['id'];}return db['CmHopperAdditionalPhone'][_0x1ec2('0x43')]({'where':{'id':_0x473054[_0x1ec2('0x40')]['id']}})[_0x1ec2('0x21')](handleEntityNotFound(_0x1ca912,null))[_0x1ec2('0x21')](saveUpdates(_0x473054[_0x1ec2('0x45')],null))[_0x1ec2('0x21')](respondWithResult(_0x1ca912,null))[_0x1ec2('0x3f')](handleError(_0x1ca912,null));};exports[_0x1ec2('0x25')]=function(_0x2d261d,_0x27823b){return db[_0x1ec2('0x3a')][_0x1ec2('0x43')]({'where':{'id':_0x2d261d[_0x1ec2('0x40')]['id']}})['then'](handleEntityNotFound(_0x27823b,null))['then'](removeEntity(_0x27823b,null))[_0x1ec2('0x3f')](handleError(_0x27823b,null));}; \ No newline at end of file +var _0x5cbe=['limit','count','offset','set','Content-Range','apply','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x29e023,_0x5480f1){var _0xfc1527=function(_0x5641eb){while(--_0x5641eb){_0x29e023['push'](_0x29e023['shift']());}};_0xfc1527(++_0x5480f1);}(_0x5cbe,0xe6));var _0xe5cb=function(_0x3c82b4,_0x1de0a4){_0x3c82b4=_0x3c82b4-0x0;var _0x45dcfe=_0x5cbe[_0x3c82b4];return _0x45dcfe;};'use strict';var emlformat=require(_0xe5cb('0x0'));var rimraf=require(_0xe5cb('0x1'));var zipdir=require(_0xe5cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5cb('0x3'));var moment=require(_0xe5cb('0x4'));var BPromise=require(_0xe5cb('0x5'));var Mustache=require(_0xe5cb('0x6'));var util=require(_0xe5cb('0x7'));var path=require('path');var sox=require(_0xe5cb('0x8'));var csv=require(_0xe5cb('0x9'));var ejs=require(_0xe5cb('0xa'));var fs=require('fs');var fs_extra=require(_0xe5cb('0xb'));var _=require(_0xe5cb('0xc'));var squel=require('squel');var crypto=require(_0xe5cb('0xd'));var jsforce=require(_0xe5cb('0xe'));var deskjs=require(_0xe5cb('0xf'));var toCsv=require(_0xe5cb('0x9'));var querystring=require(_0xe5cb('0x10'));var Papa=require(_0xe5cb('0x11'));var Redis=require(_0xe5cb('0x12'));var authService=require(_0xe5cb('0x13'));var qs=require(_0xe5cb('0x14'));var as=require(_0xe5cb('0x15'));var hardwareService=require(_0xe5cb('0x16'));var logger=require(_0xe5cb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe5cb('0x18'));var licenseUtil=require(_0xe5cb('0x19'));var db=require(_0xe5cb('0x1a'))['db'];function respondWithStatusCode(_0xca12cc,_0x332c8e){_0x332c8e=_0x332c8e||0xcc;return function(_0x1788b7){if(_0x1788b7){return _0xca12cc['sendStatus'](_0x332c8e);}return _0xca12cc[_0xe5cb('0x1b')](_0x332c8e)[_0xe5cb('0x1c')]();};}function respondWithResult(_0x376aeb,_0x1c6ef5){_0x1c6ef5=_0x1c6ef5||0xc8;return function(_0x23bfec){if(_0x23bfec){return _0x376aeb[_0xe5cb('0x1b')](_0x1c6ef5)[_0xe5cb('0x1d')](_0x23bfec);}};}function respondWithFilteredResult(_0x7f2849,_0x2ad3eb){return function(_0x162169){if(_0x162169){var _0x1b1ca0=typeof _0x2ad3eb['offset']===_0xe5cb('0x1e')&&typeof _0x2ad3eb[_0xe5cb('0x1f')]===_0xe5cb('0x1e');var _0x110275=_0x162169[_0xe5cb('0x20')];var _0x48ef93=_0x1b1ca0?0x0:_0x2ad3eb[_0xe5cb('0x21')];var _0x12d33b=_0x1b1ca0?_0x162169[_0xe5cb('0x20')]:_0x2ad3eb[_0xe5cb('0x21')]+_0x2ad3eb[_0xe5cb('0x1f')];var _0x5bde7d;if(_0x12d33b>=_0x110275){_0x12d33b=_0x110275;_0x5bde7d=0xc8;}else{_0x5bde7d=0xce;}_0x7f2849[_0xe5cb('0x1b')](_0x5bde7d);return _0x7f2849[_0xe5cb('0x22')](_0xe5cb('0x23'),_0x48ef93+'-'+_0x12d33b+'/'+_0x110275)[_0xe5cb('0x1d')](_0x162169);}return null;};}function patchUpdates(_0x1f0542){return function(_0x49a5c2){try{jsonpatch[_0xe5cb('0x24')](_0x49a5c2,_0x1f0542,!![]);}catch(_0x2783db){return BPromise[_0xe5cb('0x25')](_0x2783db);}return _0x49a5c2['save']();};}function saveUpdates(_0x3d18e9,_0x3af768){return function(_0x25b96a){if(_0x25b96a){return _0x25b96a[_0xe5cb('0x26')](_0x3d18e9)[_0xe5cb('0x27')](function(_0x15ac1f){return _0x15ac1f;});}return null;};}function removeEntity(_0x1a9047,_0x19aa78){return function(_0x2d7e44){if(_0x2d7e44){return _0x2d7e44['destroy']()[_0xe5cb('0x27')](function(){var _0x3c3dda=_0x2d7e44[_0xe5cb('0x28')]({'plain':!![]});var _0xcdfb7e=_0xe5cb('0x29');return db[_0xe5cb('0x2a')]['destroy']({'where':{'type':_0xcdfb7e,'resourceId':_0x3c3dda['id']}})[_0xe5cb('0x27')](function(){return _0x2d7e44;});})['then'](function(){_0x1a9047[_0xe5cb('0x1b')](0xcc)[_0xe5cb('0x1c')]();});}};}function handleEntityNotFound(_0x28bd0e,_0x261fb1){return function(_0x3fa14c){if(!_0x3fa14c){_0x28bd0e[_0xe5cb('0x2b')](0x194);}return _0x3fa14c;};}function handleError(_0x1ed2c4,_0x38ca96){_0x38ca96=_0x38ca96||0x1f4;return function(_0x3bdc71){logger[_0xe5cb('0x2c')](_0x3bdc71[_0xe5cb('0x2d')]);if(_0x3bdc71[_0xe5cb('0x2e')]){delete _0x3bdc71[_0xe5cb('0x2e')];}_0x1ed2c4[_0xe5cb('0x1b')](_0x38ca96)[_0xe5cb('0x2f')](_0x3bdc71);};}exports[_0xe5cb('0x30')]=function(_0x1335c7,_0x5ed10e){var _0x2e230f={},_0x21552c={},_0x85f596={'count':0x0,'rows':[]};var _0x11a9b1=_[_0xe5cb('0x31')](db[_0xe5cb('0x32')][_0xe5cb('0x33')],function(_0x18b3f4){return{'name':_0x18b3f4[_0xe5cb('0x34')],'type':_0x18b3f4[_0xe5cb('0x35')][_0xe5cb('0x36')]};});_0x21552c[_0xe5cb('0x37')]=_['map'](_0x11a9b1,'name');_0x21552c[_0xe5cb('0x38')]=_['keys'](_0x1335c7['query']);_0x21552c[_0xe5cb('0x39')]=_[_0xe5cb('0x3a')](_0x21552c[_0xe5cb('0x37')],_0x21552c['query']);_0x2e230f[_0xe5cb('0x3b')]=_[_0xe5cb('0x3a')](_0x21552c['model'],qs[_0xe5cb('0x3c')](_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x3c')]));_0x2e230f[_0xe5cb('0x3b')]=_0x2e230f[_0xe5cb('0x3b')][_0xe5cb('0x3d')]?_0x2e230f[_0xe5cb('0x3b')]:_0x21552c[_0xe5cb('0x37')];if(!_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x3e')]('nolimit')){_0x2e230f['limit']=qs[_0xe5cb('0x1f')](_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x1f')]);_0x2e230f[_0xe5cb('0x21')]=qs[_0xe5cb('0x21')](_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x21')]);}_0x2e230f[_0xe5cb('0x3f')]=qs['sort'](_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x40')]);_0x2e230f[_0xe5cb('0x41')]=qs[_0xe5cb('0x39')](_[_0xe5cb('0x42')](_0x1335c7[_0xe5cb('0x38')],_0x21552c['filters']),_0x11a9b1);if(_0x1335c7['query'][_0xe5cb('0x43')]){_0x2e230f[_0xe5cb('0x41')]=_[_0xe5cb('0x44')](_0x2e230f[_0xe5cb('0x41')],{'$or':_[_0xe5cb('0x31')](_0x11a9b1,function(_0x23dce2){if(_0x23dce2['type']!==_0xe5cb('0x45')){var _0x3587e8={};_0x3587e8[_0x23dce2[_0xe5cb('0x2e')]]={'$like':'%'+_0x1335c7[_0xe5cb('0x38')]['filter']+'%'};return _0x3587e8;}})});}_0x2e230f=_[_0xe5cb('0x44')]({},_0x2e230f,_0x1335c7[_0xe5cb('0x46')]);var _0x13fa6f={'where':_0x2e230f[_0xe5cb('0x41')]};return db['CmHopperAdditionalPhone'][_0xe5cb('0x20')](_0x13fa6f)[_0xe5cb('0x27')](function(_0x57c463){_0x85f596[_0xe5cb('0x20')]=_0x57c463;if(_0x1335c7[_0xe5cb('0x38')][_0xe5cb('0x47')]){_0x2e230f[_0xe5cb('0x48')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x2e230f);})[_0xe5cb('0x27')](function(_0x33e6c1){_0x85f596[_0xe5cb('0x49')]=_0x33e6c1;return _0x85f596;})[_0xe5cb('0x27')](respondWithFilteredResult(_0x5ed10e,_0x2e230f))['catch'](handleError(_0x5ed10e,null));};exports[_0xe5cb('0x4a')]=function(_0x162921,_0x2896f6){var _0x25b913={'raw':!![],'where':{'id':_0x162921['params']['id']}},_0x5c6b6f={};_0x5c6b6f['model']=_['keys'](db['CmHopperAdditionalPhone'][_0xe5cb('0x33')]);_0x5c6b6f[_0xe5cb('0x38')]=_[_0xe5cb('0x4b')](_0x162921[_0xe5cb('0x38')]);_0x5c6b6f['filters']=_[_0xe5cb('0x3a')](_0x5c6b6f[_0xe5cb('0x37')],_0x5c6b6f[_0xe5cb('0x38')]);_0x25b913['attributes']=_['intersection'](_0x5c6b6f['model'],qs['fields'](_0x162921[_0xe5cb('0x38')][_0xe5cb('0x3c')]));_0x25b913[_0xe5cb('0x3b')]=_0x25b913[_0xe5cb('0x3b')][_0xe5cb('0x3d')]?_0x25b913[_0xe5cb('0x3b')]:_0x5c6b6f['model'];if(_0x162921[_0xe5cb('0x38')][_0xe5cb('0x47')]){_0x25b913[_0xe5cb('0x48')]=[{'all':!![]}];}_0x25b913=_['merge']({},_0x25b913,_0x162921[_0xe5cb('0x46')]);return db['CmHopperAdditionalPhone']['find'](_0x25b913)[_0xe5cb('0x27')](handleEntityNotFound(_0x2896f6,null))['then'](respondWithResult(_0x2896f6,null))[_0xe5cb('0x4c')](handleError(_0x2896f6,null));};exports[_0xe5cb('0x4d')]=function(_0xac84c5,_0x563088){return db['CmHopperAdditionalPhone'][_0xe5cb('0x4d')](_0xac84c5[_0xe5cb('0x4e')],{})['then'](function(_0x11eeed){var _0x1a2eed=_0xac84c5[_0xe5cb('0x4f')][_0xe5cb('0x28')]({'plain':!![]});if(!_0x1a2eed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a2eed[_0xe5cb('0x50')]===_0xe5cb('0x4f')){var _0x5eda8a=_0x11eeed[_0xe5cb('0x28')]({'plain':!![]});var _0x51581e='CmHopperAdditionalPhones';return db[_0xe5cb('0x51')][_0xe5cb('0x52')]({'where':{'name':_0x51581e,'userProfileId':_0x1a2eed[_0xe5cb('0x53')]},'raw':!![]})[_0xe5cb('0x27')](function(_0x47aa97){if(_0x47aa97&&_0x47aa97[_0xe5cb('0x54')]===0x0){return db[_0xe5cb('0x2a')][_0xe5cb('0x4d')]({'name':_0x5eda8a[_0xe5cb('0x2e')],'resourceId':_0x5eda8a['id'],'type':_0x47aa97[_0xe5cb('0x2e')],'sectionId':_0x47aa97['id']},{})[_0xe5cb('0x27')](function(){return _0x11eeed;});}else{return _0x11eeed;}})[_0xe5cb('0x4c')](function(_0x2925fa){logger[_0xe5cb('0x2c')](_0xe5cb('0x55'),_0x2925fa);throw _0x2925fa;});}return _0x11eeed;})['then'](respondWithResult(_0x563088,0xc9))[_0xe5cb('0x4c')](handleError(_0x563088,null));};exports[_0xe5cb('0x26')]=function(_0x1b1217,_0x132576){if(_0x1b1217[_0xe5cb('0x4e')]['id']){delete _0x1b1217[_0xe5cb('0x4e')]['id'];}return db[_0xe5cb('0x32')][_0xe5cb('0x52')]({'where':{'id':_0x1b1217[_0xe5cb('0x56')]['id']}})[_0xe5cb('0x27')](handleEntityNotFound(_0x132576,null))[_0xe5cb('0x27')](saveUpdates(_0x1b1217[_0xe5cb('0x4e')],null))[_0xe5cb('0x27')](respondWithResult(_0x132576,null))[_0xe5cb('0x4c')](handleError(_0x132576,null));};exports['destroy']=function(_0x201eb1,_0x227a15){return db[_0xe5cb('0x32')][_0xe5cb('0x52')]({'where':{'id':_0x201eb1[_0xe5cb('0x56')]['id']}})['then'](handleEntityNotFound(_0x227a15,null))['then'](removeEntity(_0x227a15,null))['catch'](handleError(_0x227a15,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 339b546..2639809 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc96b=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x339ae2,_0x5a81e0){var _0xa99395=function(_0xd02902){while(--_0xd02902){_0x339ae2['push'](_0x339ae2['shift']());}};_0xa99395(++_0x5a81e0);}(_0xc96b,0x16d));var _0xbc96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc96b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbc96('0x0'));var util=require(_0xbc96('0x1'));var logger=require(_0xbc96('0x2'))(_0xbc96('0x3'));var moment=require(_0xbc96('0x4'));var BPromise=require(_0xbc96('0x5'));var rp=require(_0xbc96('0x6'));var fs=require('fs');var path=require(_0xbc96('0x7'));var rimraf=require(_0xbc96('0x8'));var config=require(_0xbc96('0x9'));var attributes=require(_0xbc96('0xa'));module[_0xbc96('0xb')]=function(_0x32095b,_0x555175){return _0x32095b[_0xbc96('0xc')](_0xbc96('0xd'),attributes,{'tableName':_0xbc96('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x453a=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','moment','bluebird','request-promise'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0x453a,0x8b));var _0xa453=function(_0x5a2b99,_0xb0e62){_0x5a2b99=_0x5a2b99-0x0;var _0x46b640=_0x453a[_0x5a2b99];return _0x46b640;};'use strict';var _=require(_0xa453('0x0'));var util=require(_0xa453('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa453('0x2'));var BPromise=require(_0xa453('0x3'));var rp=require(_0xa453('0x4'));var fs=require('fs');var path=require(_0xa453('0x5'));var rimraf=require(_0xa453('0x6'));var config=require(_0xa453('0x7'));var attributes=require(_0xa453('0x8'));module[_0xa453('0x9')]=function(_0x5bf452,_0x394f72){return _0x5bf452[_0xa453('0xa')](_0xa453('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 6c8d6ae..5e0ccb4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ed7=['createdAt','sequelize','transaction','update','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','catch','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countmachineretry','entity','VerifyAdditionalPhones','CmHopper','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt'];(function(_0x4f98e5,_0x392e13){var _0x39cfdf=function(_0x3817ba){while(--_0x3817ba){_0x4f98e5['push'](_0x4f98e5['shift']());}};_0x39cfdf(++_0x392e13);}(_0x1ed7,0x6e));var _0x71ed=function(_0x10b315,_0x19d704){_0x10b315=_0x10b315-0x0;var _0x1200cf=_0x1ed7[_0x10b315];return _0x1200cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x71ed('0x0'));var rs=require(_0x71ed('0x1'));var fs=require('fs');var Redis=require(_0x71ed('0x2'));var db=require(_0x71ed('0x3'))['db'];var utils=require(_0x71ed('0x4'));var logger=require('../../config/logger')(_0x71ed('0x5'));var config=require(_0x71ed('0x6'));var jayson=require(_0x71ed('0x7'));var client=jayson[_0x71ed('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x572ad8,_0x159d75,_0x1eaefe){return new BPromise(function(_0x1dfb6d,_0x3eedbe){return client[_0x71ed('0x9')](_0x572ad8,_0x1eaefe)[_0x71ed('0xa')](function(_0x585943){logger[_0x71ed('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x159d75,_0x71ed('0xc'));logger[_0x71ed('0xd')](_0x71ed('0xe'),_0x159d75,_0x71ed('0xc'),JSON[_0x71ed('0xf')](_0x585943));if(_0x585943[_0x71ed('0x10')]){if(_0x585943[_0x71ed('0x10')][_0x71ed('0x11')]===0x1f4){logger[_0x71ed('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x159d75,_0x585943[_0x71ed('0x10')][_0x71ed('0x12')]);return _0x3eedbe(_0x585943[_0x71ed('0x10')][_0x71ed('0x12')]);}logger['error'](_0x71ed('0x13'),_0x159d75,_0x585943[_0x71ed('0x10')]['message']);return _0x1dfb6d(_0x585943['error'][_0x71ed('0x12')]);}else{logger[_0x71ed('0xb')](_0x71ed('0x13'),_0x159d75,_0x71ed('0xc'));_0x1dfb6d(_0x585943['result'][_0x71ed('0x12')]);}})[_0x71ed('0x14')](function(_0x531d6f){logger[_0x71ed('0x10')](_0x71ed('0x13'),_0x159d75,_0x531d6f);_0x3eedbe(_0x531d6f);});});}exports['VerifyAdditionalPhones']=function(_0x4a9f42){var _0x5e1fd6=this;return new Promise(function(_0x1ce561,_0x3aebfa){return db['CmHopper'][_0x71ed('0x15')]({'raw':!![],'where':{'ContactId':_0x4a9f42[_0x71ed('0x16')][_0x71ed('0x17')],'ListId':_0x4a9f42[_0x71ed('0x16')]['ListId'],'VoiceQueueId':_0x4a9f42[_0x71ed('0x16')]['VoiceQueueId']===undefined?null:_0x4a9f42[_0x71ed('0x16')][_0x71ed('0x18')],'CampaignId':_0x4a9f42['body']['CampaignId']===undefined?null:_0x4a9f42[_0x71ed('0x16')][_0x71ed('0x19')]}})[_0x71ed('0xa')](function(_0x5a1c85){if(_0x5a1c85!=null){return db[_0x71ed('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5a1c85['id'],'OrderBy':{'$gt':_0x5a1c85[_0x71ed('0x1b')]}},'order':[[_0x71ed('0x1b'),_0x71ed('0x1c')]]})[_0x71ed('0xa')](function(_0x2c00f5){var _0xe974cc=0x0;if(_0x2c00f5){if(_0x2c00f5['countbusyretry']+_0x2c00f5['countcongestionretry']+_0x2c00f5[_0x71ed('0x1d')]+_0x2c00f5[_0x71ed('0x1e')]+_0x2c00f5[_0x71ed('0x1f')]+_0x2c00f5[_0x71ed('0x20')]+_0x2c00f5['countmachineretry']+_0x2c00f5[_0x71ed('0x21')]<_0x4a9f42['entity'][_0x71ed('0x22')])_0xe974cc=0x1;_0x1ce561({'additional':_0xe974cc});}else{return db['CmHopperAdditionalPhone'][_0x71ed('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5a1c85['id']},'order':[[_0x71ed('0x1b'),'ASC']]})['then'](function(_0x26cdcf){var _0xff59b8=0x0;if(_0x26cdcf){if(_0x26cdcf[_0x71ed('0x23')]+_0x26cdcf[_0x71ed('0x24')]+_0x26cdcf['countnoanswerretry']+_0x26cdcf['countnosuchnumberretry']+_0x26cdcf[_0x71ed('0x1f')]+_0x26cdcf['countabandonedretry']+_0x26cdcf[_0x71ed('0x25')]+_0x26cdcf['countagentrejectretry']<_0x4a9f42[_0x71ed('0x26')][_0x71ed('0x22')])_0xff59b8=0x1;_0x1ce561({'additional':_0xff59b8});}else{_0x1ce561({'additional':0x0});}})[_0x71ed('0x14')](function(_0x33eb53){logger['error'](_0x71ed('0x27'),_0x33eb53[_0x71ed('0x12')]);_0x3aebfa(_0x5e1fd6['error'](0x1f4,_0x33eb53[_0x71ed('0x12')]));});}})[_0x71ed('0x14')](function(_0x46d80b){logger[_0x71ed('0x10')](_0x71ed('0x27'),_0x46d80b[_0x71ed('0x12')]);_0x3aebfa(_0x5e1fd6[_0x71ed('0x10')](0x1f4,_0x46d80b[_0x71ed('0x12')]));});}else _0x1ce561({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2453ed){var _0x370a01=this;return new Promise(function(_0x654dd,_0x4a5001){return db[_0x71ed('0x28')][_0x71ed('0x15')]({'raw':!![],'where':{'ContactId':_0x2453ed[_0x71ed('0x16')]['ContactId'],'ListId':_0x2453ed[_0x71ed('0x16')]['ListId'],'VoiceQueueId':_0x2453ed['body'][_0x71ed('0x18')]===undefined?null:_0x2453ed[_0x71ed('0x16')][_0x71ed('0x18')],'CampaignId':_0x2453ed['body'][_0x71ed('0x19')]===undefined?null:_0x2453ed[_0x71ed('0x16')][_0x71ed('0x19')]}})[_0x71ed('0xa')](function(_0x5308d1){if(_0x5308d1!=null){return db[_0x71ed('0x1a')][_0x71ed('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5308d1['id'],'OrderBy':{'$gte':_0x5308d1[_0x71ed('0x1b')]}},'order':[[_0x71ed('0x1b'),'ASC']]})['then'](function(_0x53a9a5){if(_0x53a9a5)return activateAdditionalPhone(_0x5308d1,_0x2453ed[_0x71ed('0x16')],_0x53a9a5,_0x2453ed[_0x71ed('0x29')],_0x2453ed[_0x71ed('0x2a')])[_0x71ed('0xa')](function(_0x3b2002){_0x654dd(_0x3b2002);});else{return db[_0x71ed('0x1a')][_0x71ed('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5308d1['id']},'order':[['OrderBy','ASC']]})[_0x71ed('0xa')](function(_0x301fde){if(_0x301fde)return activateAdditionalPhone(_0x5308d1,_0x2453ed[_0x71ed('0x16')],_0x301fde,_0x2453ed[_0x71ed('0x29')],_0x2453ed[_0x71ed('0x2a')])['then'](function(_0x1aca84){_0x654dd(_0x1aca84);});else{_0x654dd({'id':_0x5308d1['id'],'phone':''});}})[_0x71ed('0x14')](function(_0x5c8633){logger[_0x71ed('0x10')](_0x71ed('0x27'),_0x5c8633[_0x71ed('0x12')]);_0x4a5001(_0x370a01[_0x71ed('0x10')](0x1f4,_0x5c8633[_0x71ed('0x12')]));});}})[_0x71ed('0x14')](function(_0x1baa77){logger[_0x71ed('0x10')](_0x71ed('0x27'),_0x1baa77[_0x71ed('0x12')]);_0x4a5001(_0x370a01['error'](0x1f4,_0x1baa77[_0x71ed('0x12')]));});}else _0x654dd(0x1);});});};function activateAdditionalPhone(_0x5a2312,_0x268452,_0x32bb0a,_0x152043,_0x530645){return new Promise(function(_0x18d389,_0x2fb2e1){var _0x5a3ae3;if(_[_0x71ed('0x2b')](_0x32bb0a[_0x71ed('0x2c')])){_0x32bb0a['scheduledat']=moment();}if(moment()>moment(_0x32bb0a[_0x71ed('0x2c')])){_0x5a3ae3=moment()[_0x71ed('0x2d')](_0x530645||0x3,'minutes');}else{if(_0x32bb0a[_0x71ed('0x1b')]==0x0){_0x5a3ae3=moment(_0x32bb0a[_0x71ed('0x2c')]);}else{_0x5a3ae3=moment()['add'](_0x530645||0x3,_0x71ed('0x2e'));}}if(_['isNil'](_0x5a3ae3)){_0x5a3ae3=moment()['add'](_0x530645||0x3,'minutes');}var _0x147d04={'phone':_0x5a2312[_0x71ed('0x2f')],'active':0x0,'OrderBy':_[_0x71ed('0x2b')](_0x5a2312['OrderBy'])?0x0:_0x5a2312[_0x71ed('0x1b')],'scheduledat':moment()[_0x71ed('0x2d')](_0x152043||0x1,_0x71ed('0x2e')),'countbusyretry':_0x268452[_0x71ed('0x23')],'countcongestionretry':_0x268452[_0x71ed('0x24')],'countnoanswerretry':_0x268452[_0x71ed('0x1d')],'countnosuchnumberretry':_0x268452[_0x71ed('0x1e')],'countdropretry':_0x268452['countdropretry'],'countabandonedretry':_0x268452[_0x71ed('0x20')],'countmachineretry':_0x268452[_0x71ed('0x25')],'countagentrejectretry':_0x268452[_0x71ed('0x21')],'createdAt':_0x268452['createdAt'],'updatedAt':_0x268452[_0x71ed('0x30')]};var _0x15ba45={'CmHopperId':_0x5a2312['id'],'phone':_0x32bb0a['phone'],'active':0x0,'OrderBy':_[_0x71ed('0x2b')](_0x32bb0a['OrderBy'])?0x0:_0x32bb0a[_0x71ed('0x1b')],'scheduledat':_0x5a3ae3,'countbusyretry':_0x32bb0a['countbusyretry'],'countcongestionretry':_0x32bb0a[_0x71ed('0x24')],'countnoanswerretry':_0x32bb0a['countnoanswerretry'],'countnosuchnumberretry':_0x32bb0a[_0x71ed('0x1e')],'countdropretry':_0x32bb0a[_0x71ed('0x1f')],'countabandonedretry':_0x32bb0a['countabandonedretry'],'countmachineretry':_0x32bb0a['countmachineretry'],'countagentrejectretry':_0x32bb0a[_0x71ed('0x21')],'createdAt':_0x32bb0a[_0x71ed('0x31')],'updatedAt':_0x32bb0a[_0x71ed('0x30')]};return db[_0x71ed('0x32')][_0x71ed('0x33')](function(_0x3d60b9){return db[_0x71ed('0x1a')][_0x71ed('0x34')](_0x147d04,{'where':{'id':_0x32bb0a['id']}},{'transaction':_0x3d60b9})[_0x71ed('0xa')](function(){return db['CmHopper'][_0x71ed('0x34')](_0x15ba45,{'where':{'id':_0x5a2312['id']}},{'transaction':_0x3d60b9});});})[_0x71ed('0xa')](function(_0x5749e2){_0x18d389({'id':_0x5a2312['id'],'phone':_0x32bb0a[_0x71ed('0x2f')]});})[_0x71ed('0x14')](function(_0x28533c){logger[_0x71ed('0x10')]('activateAdditionalPhone',_0x28533c[_0x71ed('0x12')]);_0x2fb2e1({'error':_0x28533c['message']});});});}exports['IncrementPreviewCounters']=function(_0x112608){var _0x13e64d=this;return new Promise(function(_0x174e48,_0x2d9b76){return db[_0x71ed('0x28')][_0x71ed('0x34')](_0x112608[_0x71ed('0x16')]['field'],{'where':{'id':_0x112608['body']['id']}})['then'](function(_0x10453b){_0x174e48(_0x10453b);})['catch'](function(_0x542fa2){logger['error']('IncrementPreviewCounters',_0x542fa2[_0x71ed('0x12')]);_0x2d9b76(_0x13e64d[_0x71ed('0x10')](0x1f4,_0x542fa2['message']));});});}; \ No newline at end of file +var _0x8442=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','catch','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2e53d8,_0x1ac26a){var _0x1b7a63=function(_0xf7cb53){while(--_0xf7cb53){_0x2e53d8['push'](_0x2e53d8['shift']());}};_0x1b7a63(++_0x1ac26a);}(_0x8442,0x118));var _0x2844=function(_0x3615b2,_0x272fa9){_0x3615b2=_0x3615b2-0x0;var _0x852cc3=_0x8442[_0x3615b2];return _0x852cc3;};'use strict';var _=require('lodash');var util=require(_0x2844('0x0'));var moment=require(_0x2844('0x1'));var BPromise=require(_0x2844('0x2'));var rs=require(_0x2844('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2844('0x4'))['db'];var utils=require(_0x2844('0x5'));var logger=require(_0x2844('0x6'))(_0x2844('0x7'));var config=require('../../config/environment');var jayson=require(_0x2844('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x269be3,_0x1e691d,_0x51060b){return new BPromise(function(_0x290029,_0x5df016){return client[_0x2844('0x9')](_0x269be3,_0x51060b)[_0x2844('0xa')](function(_0x55b6d3){logger['info'](_0x2844('0xb'),_0x1e691d,'request\x20sent');logger[_0x2844('0xc')](_0x2844('0xd'),_0x1e691d,_0x2844('0xe'),JSON['stringify'](_0x55b6d3));if(_0x55b6d3[_0x2844('0xf')]){if(_0x55b6d3['error'][_0x2844('0x10')]===0x1f4){logger[_0x2844('0xf')](_0x2844('0xb'),_0x1e691d,_0x55b6d3['error'][_0x2844('0x11')]);return _0x5df016(_0x55b6d3[_0x2844('0xf')][_0x2844('0x11')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1e691d,_0x55b6d3['error']['message']);return _0x290029(_0x55b6d3[_0x2844('0xf')][_0x2844('0x11')]);}else{logger[_0x2844('0x12')](_0x2844('0xb'),_0x1e691d,_0x2844('0xe'));_0x290029(_0x55b6d3[_0x2844('0x13')]['message']);}})['catch'](function(_0x4852e0){logger[_0x2844('0xf')](_0x2844('0xb'),_0x1e691d,_0x4852e0);_0x5df016(_0x4852e0);});});}exports[_0x2844('0x14')]=function(_0x685f14){var _0x4f397a=this;return new Promise(function(_0x4e4189,_0x2b2aff){return db[_0x2844('0x15')][_0x2844('0x16')]({'raw':!![],'where':{'ContactId':_0x685f14[_0x2844('0x17')][_0x2844('0x18')],'ListId':_0x685f14[_0x2844('0x17')]['ListId'],'VoiceQueueId':_0x685f14[_0x2844('0x17')][_0x2844('0x19')]===undefined?null:_0x685f14['body']['VoiceQueueId'],'CampaignId':_0x685f14['body']['CampaignId']===undefined?null:_0x685f14['body'][_0x2844('0x1a')]}})['then'](function(_0x20c066){if(_0x20c066!=null){return db[_0x2844('0x1b')][_0x2844('0x16')]({'raw':!![],'where':{'CmHopperId':_0x20c066['id'],'OrderBy':{'$gt':_0x20c066[_0x2844('0x1c')]}},'order':[[_0x2844('0x1c'),_0x2844('0x1d')]]})[_0x2844('0xa')](function(_0x5deea0){var _0x2b5b98=0x0;if(_0x5deea0){if(_0x5deea0[_0x2844('0x1e')]+_0x5deea0[_0x2844('0x1f')]+_0x5deea0['countnoanswerretry']+_0x5deea0['countnosuchnumberretry']+_0x5deea0[_0x2844('0x20')]+_0x5deea0[_0x2844('0x21')]+_0x5deea0[_0x2844('0x22')]+_0x5deea0[_0x2844('0x23')]<_0x685f14[_0x2844('0x24')][_0x2844('0x25')])_0x2b5b98=0x1;_0x4e4189({'additional':_0x2b5b98});}else{return db[_0x2844('0x1b')][_0x2844('0x16')]({'raw':!![],'where':{'CmHopperId':_0x20c066['id']},'order':[[_0x2844('0x1c'),_0x2844('0x1d')]]})[_0x2844('0xa')](function(_0x25c57b){var _0x1389f5=0x0;if(_0x25c57b){if(_0x25c57b[_0x2844('0x1e')]+_0x25c57b[_0x2844('0x1f')]+_0x25c57b[_0x2844('0x26')]+_0x25c57b[_0x2844('0x27')]+_0x25c57b[_0x2844('0x20')]+_0x25c57b[_0x2844('0x21')]+_0x25c57b[_0x2844('0x22')]+_0x25c57b[_0x2844('0x23')]<_0x685f14[_0x2844('0x24')][_0x2844('0x25')])_0x1389f5=0x1;_0x4e4189({'additional':_0x1389f5});}else{_0x4e4189({'additional':0x0});}})['catch'](function(_0x14032b){logger[_0x2844('0xf')](_0x2844('0x14'),_0x14032b[_0x2844('0x11')]);_0x2b2aff(_0x4f397a[_0x2844('0xf')](0x1f4,_0x14032b[_0x2844('0x11')]));});}})[_0x2844('0x28')](function(_0x2ecdd0){logger[_0x2844('0xf')](_0x2844('0x14'),_0x2ecdd0[_0x2844('0x11')]);_0x2b2aff(_0x4f397a[_0x2844('0xf')](0x1f4,_0x2ecdd0[_0x2844('0x11')]));});}else _0x4e4189({'additional':0x0});});});};exports[_0x2844('0x29')]=function(_0x16b714){var _0x3157ee=this;return new Promise(function(_0x48d2de,_0x1bf86a){return db[_0x2844('0x15')][_0x2844('0x16')]({'raw':!![],'where':{'ContactId':_0x16b714[_0x2844('0x17')][_0x2844('0x18')],'ListId':_0x16b714[_0x2844('0x17')][_0x2844('0x2a')],'VoiceQueueId':_0x16b714['body'][_0x2844('0x19')]===undefined?null:_0x16b714[_0x2844('0x17')]['VoiceQueueId'],'CampaignId':_0x16b714[_0x2844('0x17')][_0x2844('0x1a')]===undefined?null:_0x16b714[_0x2844('0x17')][_0x2844('0x1a')]}})[_0x2844('0xa')](function(_0x1503fa){if(_0x1503fa!=null){return db[_0x2844('0x1b')][_0x2844('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1503fa['id'],'OrderBy':{'$gte':_0x1503fa[_0x2844('0x1c')]}},'order':[[_0x2844('0x1c'),_0x2844('0x1d')]]})[_0x2844('0xa')](function(_0x41ac3c){if(_0x41ac3c)return activateAdditionalPhone(_0x1503fa,_0x16b714[_0x2844('0x17')],_0x41ac3c,_0x16b714[_0x2844('0x2b')],_0x16b714[_0x2844('0x2c')])[_0x2844('0xa')](function(_0x4d3c70){_0x48d2de(_0x4d3c70);});else{return db[_0x2844('0x1b')][_0x2844('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1503fa['id']},'order':[['OrderBy',_0x2844('0x1d')]]})['then'](function(_0x1d7de3){if(_0x1d7de3)return activateAdditionalPhone(_0x1503fa,_0x16b714[_0x2844('0x17')],_0x1d7de3,_0x16b714[_0x2844('0x2b')],_0x16b714['waitTime'])[_0x2844('0xa')](function(_0x4026b6){_0x48d2de(_0x4026b6);});else{_0x48d2de({'id':_0x1503fa['id'],'phone':''});}})[_0x2844('0x28')](function(_0x53b6c4){logger[_0x2844('0xf')](_0x2844('0x14'),_0x53b6c4[_0x2844('0x11')]);_0x1bf86a(_0x3157ee[_0x2844('0xf')](0x1f4,_0x53b6c4[_0x2844('0x11')]));});}})[_0x2844('0x28')](function(_0x5b305e){logger[_0x2844('0xf')](_0x2844('0x14'),_0x5b305e[_0x2844('0x11')]);_0x1bf86a(_0x3157ee[_0x2844('0xf')](0x1f4,_0x5b305e[_0x2844('0x11')]));});}else _0x48d2de(0x1);});});};function activateAdditionalPhone(_0x4aba3c,_0x5c1e9,_0x2ae4fe,_0x1b73c9,_0xc52ce1){return new Promise(function(_0x2ba7c3,_0xa936){var _0x530ffc;if(_[_0x2844('0x2d')](_0x2ae4fe[_0x2844('0x2e')])){_0x2ae4fe[_0x2844('0x2e')]=moment();}if(moment()>moment(_0x2ae4fe['scheduledat'])){_0x530ffc=moment()[_0x2844('0x2f')](_0xc52ce1||0x3,_0x2844('0x30'));}else{if(_0x2ae4fe['OrderBy']==0x0){_0x530ffc=moment(_0x2ae4fe[_0x2844('0x2e')]);}else{_0x530ffc=moment()[_0x2844('0x2f')](_0xc52ce1||0x3,_0x2844('0x30'));}}if(_[_0x2844('0x2d')](_0x530ffc)){_0x530ffc=moment()['add'](_0xc52ce1||0x3,_0x2844('0x30'));}var _0x47a642={'phone':_0x4aba3c[_0x2844('0x31')],'active':0x0,'OrderBy':_[_0x2844('0x2d')](_0x4aba3c[_0x2844('0x1c')])?0x0:_0x4aba3c[_0x2844('0x1c')],'scheduledat':moment()[_0x2844('0x2f')](_0x1b73c9||0x1,_0x2844('0x30')),'countbusyretry':_0x5c1e9[_0x2844('0x1e')],'countcongestionretry':_0x5c1e9[_0x2844('0x1f')],'countnoanswerretry':_0x5c1e9[_0x2844('0x26')],'countnosuchnumberretry':_0x5c1e9[_0x2844('0x27')],'countdropretry':_0x5c1e9['countdropretry'],'countabandonedretry':_0x5c1e9['countabandonedretry'],'countmachineretry':_0x5c1e9[_0x2844('0x22')],'countagentrejectretry':_0x5c1e9[_0x2844('0x23')],'createdAt':_0x5c1e9[_0x2844('0x32')],'updatedAt':_0x5c1e9[_0x2844('0x33')]};var _0x13ddf9={'CmHopperId':_0x4aba3c['id'],'phone':_0x2ae4fe['phone'],'active':0x0,'OrderBy':_['isNil'](_0x2ae4fe['OrderBy'])?0x0:_0x2ae4fe[_0x2844('0x1c')],'scheduledat':_0x530ffc,'countbusyretry':_0x2ae4fe[_0x2844('0x1e')],'countcongestionretry':_0x2ae4fe['countcongestionretry'],'countnoanswerretry':_0x2ae4fe[_0x2844('0x26')],'countnosuchnumberretry':_0x2ae4fe[_0x2844('0x27')],'countdropretry':_0x2ae4fe['countdropretry'],'countabandonedretry':_0x2ae4fe['countabandonedretry'],'countmachineretry':_0x2ae4fe[_0x2844('0x22')],'countagentrejectretry':_0x2ae4fe[_0x2844('0x23')],'createdAt':_0x2ae4fe[_0x2844('0x32')],'updatedAt':_0x2ae4fe[_0x2844('0x33')]};return db['sequelize'][_0x2844('0x34')](function(_0xcf831c){return db[_0x2844('0x1b')][_0x2844('0x35')](_0x47a642,{'where':{'id':_0x2ae4fe['id']}},{'transaction':_0xcf831c})['then'](function(){return db[_0x2844('0x15')][_0x2844('0x35')](_0x13ddf9,{'where':{'id':_0x4aba3c['id']}},{'transaction':_0xcf831c});});})[_0x2844('0xa')](function(_0x54c042){_0x2ba7c3({'id':_0x4aba3c['id'],'phone':_0x2ae4fe[_0x2844('0x31')]});})[_0x2844('0x28')](function(_0x11e066){logger[_0x2844('0xf')](_0x2844('0x36'),_0x11e066[_0x2844('0x11')]);_0xa936({'error':_0x11e066['message']});});});}exports[_0x2844('0x37')]=function(_0x173595){var _0x179e52=this;return new Promise(function(_0x5a8306,_0x1d0e19){return db[_0x2844('0x15')][_0x2844('0x35')](_0x173595[_0x2844('0x17')][_0x2844('0x38')],{'where':{'id':_0x173595[_0x2844('0x17')]['id']}})['then'](function(_0x587ce8){_0x5a8306(_0x587ce8);})[_0x2844('0x28')](function(_0x2e9e8a){logger['error']('IncrementPreviewCounters',_0x2e9e8a[_0x2844('0x11')]);_0x1d0e19(_0x179e52[_0x2844('0xf')](0x1f4,_0x2e9e8a[_0x2844('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index c386ea7..1ff2e5c 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d6a=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy'];(function(_0x9a5b2a,_0x2f6b38){var _0x543904=function(_0x1665f1){while(--_0x1665f1){_0x9a5b2a['push'](_0x9a5b2a['shift']());}};_0x543904(++_0x2f6b38);}(_0x1d6a,0x190));var _0xa1d6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1d6a[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0xa1d6('0x0'));var path=require(_0xa1d6('0x1'));var timeout=require(_0xa1d6('0x2'));var express=require('express');var router=express[_0xa1d6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa1d6('0x4'));var interaction=require(_0xa1d6('0x5'));var config=require(_0xa1d6('0x6'));var controller=require(_0xa1d6('0x7'));router[_0xa1d6('0x8')]('/',auth[_0xa1d6('0x9')](),controller['index']);router[_0xa1d6('0x8')](_0xa1d6('0xa'),auth['isAuthenticated'](),controller[_0xa1d6('0xb')]);router[_0xa1d6('0xc')]('/',auth[_0xa1d6('0x9')](),controller[_0xa1d6('0xd')]);router['put'](_0xa1d6('0xa'),auth[_0xa1d6('0x9')](),controller['update']);router[_0xa1d6('0xe')](_0xa1d6('0xa'),auth[_0xa1d6('0x9')](),controller[_0xa1d6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x464b=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show'];(function(_0x38b6f4,_0x4d67f5){var _0x19b690=function(_0x28be67){while(--_0x28be67){_0x38b6f4['push'](_0x38b6f4['shift']());}};_0x19b690(++_0x4d67f5);}(_0x464b,0x161));var _0xb464=function(_0x28c69d,_0x5a9df6){_0x28c69d=_0x28c69d-0x0;var _0x4262ba=_0x464b[_0x28c69d];return _0x4262ba;};'use strict';var multer=require(_0xb464('0x0'));var util=require(_0xb464('0x1'));var path=require(_0xb464('0x2'));var timeout=require(_0xb464('0x3'));var express=require(_0xb464('0x4'));var router=express[_0xb464('0x5')]();var fs_extra=require(_0xb464('0x6'));var auth=require(_0xb464('0x7'));var interaction=require(_0xb464('0x8'));var config=require(_0xb464('0x9'));var controller=require(_0xb464('0xa'));router[_0xb464('0xb')]('/',auth[_0xb464('0xc')](),controller[_0xb464('0xd')]);router[_0xb464('0xb')]('/:id',auth[_0xb464('0xc')](),controller[_0xb464('0xe')]);router[_0xb464('0xf')]('/',auth[_0xb464('0xc')](),controller[_0xb464('0x10')]);router[_0xb464('0x11')](_0xb464('0x12'),auth[_0xb464('0xc')](),controller[_0xb464('0x13')]);router[_0xb464('0x14')](_0xb464('0x12'),auth[_0xb464('0xc')](),controller[_0xb464('0x15')]);module[_0xb464('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 1a9fc72..598b13e 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 _0xbfe8=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x29daac,_0x3067e2){var _0x1f337f=function(_0x1b49cd){while(--_0x1b49cd){_0x29daac['push'](_0x29daac['shift']());}};_0x1f337f(++_0x3067e2);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x35d8ef,_0x697773){_0x35d8ef=_0x35d8ef-0x0;var _0x4181ea=_0xbfe8[_0x35d8ef];return _0x4181ea;};'use strict';var moment=require('moment');var Sequelize=require(_0x8bfe('0x0'));module['exports']={'phone':{'type':Sequelize[_0x8bfe('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8bfe('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8bfe('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8bfe('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x42fa=['contactListQueue','moment','sequelize','INTEGER'];(function(_0x5b8580,_0x1ea611){var _0x21965b=function(_0x2d26d4){while(--_0x2d26d4){_0x5b8580['push'](_0x5b8580['shift']());}};_0x21965b(++_0x1ea611);}(_0x42fa,0x161));var _0xa42f=function(_0x539a39,_0x480887){_0x539a39=_0x539a39-0x0;var _0x2b2b5e=_0x42fa[_0x539a39];return _0x2b2b5e;};'use strict';var moment=require(_0xa42f('0x0'));var Sequelize=require(_0xa42f('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa42f('0x2')],'unique':_0xa42f('0x3')},'ListId':{'type':Sequelize[_0xa42f('0x2')],'unique':_0xa42f('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa42f('0x2')],'unique':_0xa42f('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2b705a8..30fc753 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 _0x0664=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','CmHopperBlack','rawAttributes','type','map','query','keys','filters','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','params','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1626df,_0x138073){var _0x3afb4a=function(_0x31e5c5){while(--_0x31e5c5){_0x1626df['push'](_0x1626df['shift']());}};_0x3afb4a(++_0x138073);}(_0x0664,0x14f));var _0x4066=function(_0x2bc0b4,_0x1dc80d){_0x2bc0b4=_0x2bc0b4-0x0;var _0x19b4b9=_0x0664[_0x2bc0b4];return _0x19b4b9;};'use strict';var emlformat=require(_0x4066('0x0'));var rimraf=require(_0x4066('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4066('0x2'));var rp=require(_0x4066('0x3'));var moment=require('moment');var BPromise=require(_0x4066('0x4'));var Mustache=require('mustache');var util=require(_0x4066('0x5'));var path=require(_0x4066('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4066('0x7'));var fs=require('fs');var fs_extra=require(_0x4066('0x8'));var _=require(_0x4066('0x9'));var squel=require(_0x4066('0xa'));var crypto=require(_0x4066('0xb'));var jsforce=require(_0x4066('0xc'));var deskjs=require(_0x4066('0xd'));var toCsv=require(_0x4066('0xe'));var querystring=require('querystring');var Papa=require(_0x4066('0xf'));var Redis=require(_0x4066('0x10'));var authService=require(_0x4066('0x11'));var qs=require(_0x4066('0x12'));var as=require(_0x4066('0x13'));var hardwareService=require(_0x4066('0x14'));var logger=require(_0x4066('0x15'))(_0x4066('0x16'));var utils=require(_0x4066('0x17'));var config=require(_0x4066('0x18'));var licenseUtil=require(_0x4066('0x19'));var db=require(_0x4066('0x1a'))['db'];function respondWithStatusCode(_0x3dd6a8,_0x1beb96){_0x1beb96=_0x1beb96||0xcc;return function(_0x43091e){if(_0x43091e){return _0x3dd6a8[_0x4066('0x1b')](_0x1beb96);}return _0x3dd6a8['status'](_0x1beb96)[_0x4066('0x1c')]();};}function respondWithResult(_0x3a7a11,_0x4a4b20){_0x4a4b20=_0x4a4b20||0xc8;return function(_0x422305){if(_0x422305){return _0x3a7a11[_0x4066('0x1d')](_0x4a4b20)['json'](_0x422305);}};}function respondWithFilteredResult(_0x33397f,_0x53ea88){return function(_0x1d8e1d){if(_0x1d8e1d){var _0x235b81=typeof _0x53ea88[_0x4066('0x1e')]===_0x4066('0x1f')&&typeof _0x53ea88['limit']===_0x4066('0x1f');var _0x3bb632=_0x1d8e1d[_0x4066('0x20')];var _0x10c56e=_0x235b81?0x0:_0x53ea88[_0x4066('0x1e')];var _0x5789cc=_0x235b81?_0x1d8e1d['count']:_0x53ea88[_0x4066('0x1e')]+_0x53ea88[_0x4066('0x21')];var _0x1abaad;if(_0x5789cc>=_0x3bb632){_0x5789cc=_0x3bb632;_0x1abaad=0xc8;}else{_0x1abaad=0xce;}_0x33397f[_0x4066('0x1d')](_0x1abaad);return _0x33397f[_0x4066('0x22')](_0x4066('0x23'),_0x10c56e+'-'+_0x5789cc+'/'+_0x3bb632)['json'](_0x1d8e1d);}return null;};}function patchUpdates(_0x3915a8){return function(_0x3bd1f9){try{jsonpatch[_0x4066('0x24')](_0x3bd1f9,_0x3915a8,!![]);}catch(_0x52cb23){return BPromise[_0x4066('0x25')](_0x52cb23);}return _0x3bd1f9[_0x4066('0x26')]();};}function saveUpdates(_0x26dcfc,_0x394224){return function(_0x504ecc){if(_0x504ecc){return _0x504ecc[_0x4066('0x27')](_0x26dcfc)[_0x4066('0x28')](function(_0x53b40c){return _0x53b40c;});}return null;};}function removeEntity(_0x35ed06,_0x364b16){return function(_0x1b090e){if(_0x1b090e){return _0x1b090e[_0x4066('0x29')]()[_0x4066('0x28')](function(){_0x35ed06['status'](0xcc)[_0x4066('0x1c')]();});}};}function handleEntityNotFound(_0x47c09b,_0x5438eb){return function(_0x3ea0ed){if(!_0x3ea0ed){_0x47c09b[_0x4066('0x1b')](0x194);}return _0x3ea0ed;};}function handleError(_0x1ddb74,_0x455dad){_0x455dad=_0x455dad||0x1f4;return function(_0x5df641){logger[_0x4066('0x2a')](_0x5df641['stack']);if(_0x5df641[_0x4066('0x2b')]){delete _0x5df641['name'];}_0x1ddb74[_0x4066('0x1d')](_0x455dad)[_0x4066('0x2c')](_0x5df641);};}exports[_0x4066('0x2d')]=function(_0x2a0561,_0x53a1a7){var _0xed0265={},_0x53fc37={},_0x4a46ed={'count':0x0,'rows':[]};var _0x27e224=_['map'](db[_0x4066('0x2e')][_0x4066('0x2f')],function(_0x43fa42){return{'name':_0x43fa42['fieldName'],'type':_0x43fa42[_0x4066('0x30')]['key']};});_0x53fc37['model']=_[_0x4066('0x31')](_0x27e224,_0x4066('0x2b'));_0x53fc37[_0x4066('0x32')]=_[_0x4066('0x33')](_0x2a0561['query']);_0x53fc37[_0x4066('0x34')]=_['intersection'](_0x53fc37[_0x4066('0x35')],_0x53fc37[_0x4066('0x32')]);_0xed0265[_0x4066('0x36')]=_['intersection'](_0x53fc37[_0x4066('0x35')],qs[_0x4066('0x37')](_0x2a0561[_0x4066('0x32')][_0x4066('0x37')]));_0xed0265[_0x4066('0x36')]=_0xed0265[_0x4066('0x36')][_0x4066('0x38')]?_0xed0265[_0x4066('0x36')]:_0x53fc37[_0x4066('0x35')];if(!_0x2a0561[_0x4066('0x32')]['hasOwnProperty']('nolimit')){_0xed0265[_0x4066('0x21')]=qs['limit'](_0x2a0561[_0x4066('0x32')][_0x4066('0x21')]);_0xed0265['offset']=qs[_0x4066('0x1e')](_0x2a0561[_0x4066('0x32')]['offset']);}_0xed0265['order']=qs[_0x4066('0x39')](_0x2a0561[_0x4066('0x32')][_0x4066('0x39')]);_0xed0265[_0x4066('0x3a')]=qs[_0x4066('0x34')](_[_0x4066('0x3b')](_0x2a0561[_0x4066('0x32')],_0x53fc37[_0x4066('0x34')]),_0x27e224);if(_0x2a0561['query'][_0x4066('0x3c')]){_0xed0265['where']=_[_0x4066('0x3d')](_0xed0265[_0x4066('0x3a')],{'$or':_['map'](_0x27e224,function(_0x277e2c){if(_0x277e2c[_0x4066('0x30')]!==_0x4066('0x3e')){var _0x529697={};_0x529697[_0x277e2c[_0x4066('0x2b')]]={'$like':'%'+_0x2a0561['query'][_0x4066('0x3c')]+'%'};return _0x529697;}})});}_0xed0265=_[_0x4066('0x3d')]({},_0xed0265,_0x2a0561[_0x4066('0x3f')]);var _0x34572b={'where':_0xed0265[_0x4066('0x3a')]};return db[_0x4066('0x2e')][_0x4066('0x20')](_0x34572b)[_0x4066('0x28')](function(_0x20c75f){_0x4a46ed[_0x4066('0x20')]=_0x20c75f;if(_0x2a0561[_0x4066('0x32')][_0x4066('0x40')]){_0xed0265[_0x4066('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4066('0x42')](_0xed0265);})['then'](function(_0x22a2f5){_0x4a46ed['rows']=_0x22a2f5;return _0x4a46ed;})[_0x4066('0x28')](respondWithFilteredResult(_0x53a1a7,_0xed0265))[_0x4066('0x43')](handleError(_0x53a1a7,null));};exports[_0x4066('0x44')]=function(_0x3d693c,_0x2ac5a2){var _0x1b7696={'raw':!![],'where':{'id':_0x3d693c['params']['id']}},_0x1cc5ad={};_0x1cc5ad[_0x4066('0x35')]=_[_0x4066('0x33')](db[_0x4066('0x2e')][_0x4066('0x2f')]);_0x1cc5ad[_0x4066('0x32')]=_['keys'](_0x3d693c['query']);_0x1cc5ad['filters']=_['intersection'](_0x1cc5ad[_0x4066('0x35')],_0x1cc5ad[_0x4066('0x32')]);_0x1b7696[_0x4066('0x36')]=_['intersection'](_0x1cc5ad[_0x4066('0x35')],qs[_0x4066('0x37')](_0x3d693c[_0x4066('0x32')]['fields']));_0x1b7696[_0x4066('0x36')]=_0x1b7696[_0x4066('0x36')][_0x4066('0x38')]?_0x1b7696[_0x4066('0x36')]:_0x1cc5ad[_0x4066('0x35')];if(_0x3d693c['query'][_0x4066('0x40')]){_0x1b7696[_0x4066('0x41')]=[{'all':!![]}];}_0x1b7696=_['merge']({},_0x1b7696,_0x3d693c['options']);return db[_0x4066('0x2e')][_0x4066('0x45')](_0x1b7696)[_0x4066('0x28')](handleEntityNotFound(_0x2ac5a2,null))['then'](respondWithResult(_0x2ac5a2,null))[_0x4066('0x43')](handleError(_0x2ac5a2,null));};exports[_0x4066('0x27')]=function(_0x33102b,_0x54a763){if(_0x33102b['body']['id']){delete _0x33102b['body']['id'];}return db[_0x4066('0x2e')][_0x4066('0x45')]({'where':{'id':_0x33102b[_0x4066('0x46')]['id']}})['then'](handleEntityNotFound(_0x54a763,null))[_0x4066('0x28')](saveUpdates(_0x33102b[_0x4066('0x47')],null))[_0x4066('0x28')](respondWithResult(_0x54a763,null))[_0x4066('0x43')](handleError(_0x54a763,null));};exports[_0x4066('0x29')]=function(_0x33b9ed,_0x68bf89){return db[_0x4066('0x2e')][_0x4066('0x45')]({'where':{'id':_0x33b9ed[_0x4066('0x46')]['id']}})['then'](handleEntityNotFound(_0x68bf89,null))['then'](removeEntity(_0x68bf89,null))['catch'](handleError(_0x68bf89,null));};exports[_0x4066('0x48')]=function(_0x56fd2a,_0x4492ca){return db[_0x4066('0x2e')][_0x4066('0x48')]()[_0x4066('0x28')](respondWithResult(_0x4492ca,null))['catch'](handleError(_0x4492ca,null));}; \ No newline at end of file +var _0x277c=['moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','save','update','destroy','then','end','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','request-promise'];(function(_0xf1d357,_0x1887c8){var _0x91f3b0=function(_0x11f00d){while(--_0x11f00d){_0xf1d357['push'](_0xf1d357['shift']());}};_0x91f3b0(++_0x1887c8);}(_0x277c,0x119));var _0xc277=function(_0x6ec3d4,_0x5a5d43){_0x6ec3d4=_0x6ec3d4-0x0;var _0x518f49=_0x277c[_0x6ec3d4];return _0x518f49;};'use strict';var emlformat=require(_0xc277('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc277('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc277('0x4'));var path=require(_0xc277('0x5'));var sox=require(_0xc277('0x6'));var csv=require(_0xc277('0x7'));var ejs=require(_0xc277('0x8'));var fs=require('fs');var fs_extra=require(_0xc277('0x9'));var _=require(_0xc277('0xa'));var squel=require(_0xc277('0xb'));var crypto=require(_0xc277('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc277('0xd'));var toCsv=require(_0xc277('0x7'));var querystring=require(_0xc277('0xe'));var Papa=require('papaparse');var Redis=require(_0xc277('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc277('0x10'));var as=require(_0xc277('0x11'));var hardwareService=require(_0xc277('0x12'));var logger=require('../../config/logger')(_0xc277('0x13'));var utils=require(_0xc277('0x14'));var config=require(_0xc277('0x15'));var licenseUtil=require(_0xc277('0x16'));var db=require(_0xc277('0x17'))['db'];function respondWithStatusCode(_0x2bdc92,_0x353b18){_0x353b18=_0x353b18||0xcc;return function(_0x138af5){if(_0x138af5){return _0x2bdc92[_0xc277('0x18')](_0x353b18);}return _0x2bdc92[_0xc277('0x19')](_0x353b18)['end']();};}function respondWithResult(_0x56200,_0x50b3a5){_0x50b3a5=_0x50b3a5||0xc8;return function(_0x13824d){if(_0x13824d){return _0x56200[_0xc277('0x19')](_0x50b3a5)[_0xc277('0x1a')](_0x13824d);}};}function respondWithFilteredResult(_0xa42635,_0x3aeae6){return function(_0x2b2114){if(_0x2b2114){var _0x53d68b=typeof _0x3aeae6[_0xc277('0x1b')]===_0xc277('0x1c')&&typeof _0x3aeae6['limit']===_0xc277('0x1c');var _0x573e19=_0x2b2114['count'];var _0x5e7ffd=_0x53d68b?0x0:_0x3aeae6[_0xc277('0x1b')];var _0xad7a8f=_0x53d68b?_0x2b2114[_0xc277('0x1d')]:_0x3aeae6[_0xc277('0x1b')]+_0x3aeae6['limit'];var _0x11281c;if(_0xad7a8f>=_0x573e19){_0xad7a8f=_0x573e19;_0x11281c=0xc8;}else{_0x11281c=0xce;}_0xa42635[_0xc277('0x19')](_0x11281c);return _0xa42635['set']('Content-Range',_0x5e7ffd+'-'+_0xad7a8f+'/'+_0x573e19)[_0xc277('0x1a')](_0x2b2114);}return null;};}function patchUpdates(_0x1f32ba){return function(_0x547b61){try{jsonpatch['apply'](_0x547b61,_0x1f32ba,!![]);}catch(_0x1e46ca){return BPromise['reject'](_0x1e46ca);}return _0x547b61[_0xc277('0x1e')]();};}function saveUpdates(_0x5dba0c,_0x2c8400){return function(_0x43cf66){if(_0x43cf66){return _0x43cf66[_0xc277('0x1f')](_0x5dba0c)['then'](function(_0x5bf642){return _0x5bf642;});}return null;};}function removeEntity(_0x599e08,_0x33d88d){return function(_0x20ba68){if(_0x20ba68){return _0x20ba68[_0xc277('0x20')]()[_0xc277('0x21')](function(){_0x599e08[_0xc277('0x19')](0xcc)[_0xc277('0x22')]();});}};}function handleEntityNotFound(_0x118671,_0x3d47d6){return function(_0x58afd8){if(!_0x58afd8){_0x118671['sendStatus'](0x194);}return _0x58afd8;};}function handleError(_0x54936f,_0x4608ab){_0x4608ab=_0x4608ab||0x1f4;return function(_0x1e3d41){logger[_0xc277('0x23')](_0x1e3d41[_0xc277('0x24')]);if(_0x1e3d41[_0xc277('0x25')]){delete _0x1e3d41[_0xc277('0x25')];}_0x54936f[_0xc277('0x19')](_0x4608ab)['send'](_0x1e3d41);};}exports[_0xc277('0x26')]=function(_0x3dc7a6,_0x3e93fe){var _0x5774a0={},_0xdcf3b5={},_0xd798af={'count':0x0,'rows':[]};var _0x259ed5=_[_0xc277('0x27')](db['CmHopperBlack'][_0xc277('0x28')],function(_0x289b84){return{'name':_0x289b84['fieldName'],'type':_0x289b84['type'][_0xc277('0x29')]};});_0xdcf3b5[_0xc277('0x2a')]=_['map'](_0x259ed5,_0xc277('0x25'));_0xdcf3b5[_0xc277('0x2b')]=_[_0xc277('0x2c')](_0x3dc7a6[_0xc277('0x2b')]);_0xdcf3b5[_0xc277('0x2d')]=_[_0xc277('0x2e')](_0xdcf3b5[_0xc277('0x2a')],_0xdcf3b5[_0xc277('0x2b')]);_0x5774a0[_0xc277('0x2f')]=_['intersection'](_0xdcf3b5['model'],qs[_0xc277('0x30')](_0x3dc7a6[_0xc277('0x2b')]['fields']));_0x5774a0['attributes']=_0x5774a0[_0xc277('0x2f')][_0xc277('0x31')]?_0x5774a0[_0xc277('0x2f')]:_0xdcf3b5[_0xc277('0x2a')];if(!_0x3dc7a6[_0xc277('0x2b')]['hasOwnProperty']('nolimit')){_0x5774a0['limit']=qs[_0xc277('0x32')](_0x3dc7a6['query'][_0xc277('0x32')]);_0x5774a0['offset']=qs['offset'](_0x3dc7a6[_0xc277('0x2b')][_0xc277('0x1b')]);}_0x5774a0[_0xc277('0x33')]=qs[_0xc277('0x34')](_0x3dc7a6[_0xc277('0x2b')]['sort']);_0x5774a0[_0xc277('0x35')]=qs['filters'](_[_0xc277('0x36')](_0x3dc7a6[_0xc277('0x2b')],_0xdcf3b5['filters']),_0x259ed5);if(_0x3dc7a6['query']['filter']){_0x5774a0['where']=_[_0xc277('0x37')](_0x5774a0[_0xc277('0x35')],{'$or':_[_0xc277('0x27')](_0x259ed5,function(_0x4f4111){if(_0x4f4111[_0xc277('0x38')]!==_0xc277('0x39')){var _0x296f15={};_0x296f15[_0x4f4111['name']]={'$like':'%'+_0x3dc7a6[_0xc277('0x2b')][_0xc277('0x3a')]+'%'};return _0x296f15;}})});}_0x5774a0=_[_0xc277('0x37')]({},_0x5774a0,_0x3dc7a6[_0xc277('0x3b')]);var _0x1e3d1a={'where':_0x5774a0[_0xc277('0x35')]};return db[_0xc277('0x3c')]['count'](_0x1e3d1a)[_0xc277('0x21')](function(_0x685ff2){_0xd798af[_0xc277('0x1d')]=_0x685ff2;if(_0x3dc7a6[_0xc277('0x2b')][_0xc277('0x3d')]){_0x5774a0[_0xc277('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc277('0x3f')](_0x5774a0);})['then'](function(_0xaa3933){_0xd798af[_0xc277('0x40')]=_0xaa3933;return _0xd798af;})[_0xc277('0x21')](respondWithFilteredResult(_0x3e93fe,_0x5774a0))[_0xc277('0x41')](handleError(_0x3e93fe,null));};exports[_0xc277('0x42')]=function(_0x2f64b2,_0x38b20f){var _0x1913a6={'raw':!![],'where':{'id':_0x2f64b2['params']['id']}},_0x218af2={};_0x218af2['model']=_['keys'](db[_0xc277('0x3c')][_0xc277('0x28')]);_0x218af2[_0xc277('0x2b')]=_[_0xc277('0x2c')](_0x2f64b2['query']);_0x218af2[_0xc277('0x2d')]=_[_0xc277('0x2e')](_0x218af2['model'],_0x218af2[_0xc277('0x2b')]);_0x1913a6[_0xc277('0x2f')]=_['intersection'](_0x218af2[_0xc277('0x2a')],qs[_0xc277('0x30')](_0x2f64b2[_0xc277('0x2b')][_0xc277('0x30')]));_0x1913a6[_0xc277('0x2f')]=_0x1913a6['attributes'][_0xc277('0x31')]?_0x1913a6['attributes']:_0x218af2[_0xc277('0x2a')];if(_0x2f64b2['query']['includeAll']){_0x1913a6[_0xc277('0x3e')]=[{'all':!![]}];}_0x1913a6=_[_0xc277('0x37')]({},_0x1913a6,_0x2f64b2['options']);return db[_0xc277('0x3c')][_0xc277('0x43')](_0x1913a6)['then'](handleEntityNotFound(_0x38b20f,null))[_0xc277('0x21')](respondWithResult(_0x38b20f,null))['catch'](handleError(_0x38b20f,null));};exports[_0xc277('0x1f')]=function(_0x2a6966,_0x48a8d8){if(_0x2a6966[_0xc277('0x44')]['id']){delete _0x2a6966['body']['id'];}return db[_0xc277('0x3c')][_0xc277('0x43')]({'where':{'id':_0x2a6966[_0xc277('0x45')]['id']}})[_0xc277('0x21')](handleEntityNotFound(_0x48a8d8,null))[_0xc277('0x21')](saveUpdates(_0x2a6966[_0xc277('0x44')],null))['then'](respondWithResult(_0x48a8d8,null))[_0xc277('0x41')](handleError(_0x48a8d8,null));};exports[_0xc277('0x20')]=function(_0x4e2c83,_0x2d5c53){return db[_0xc277('0x3c')][_0xc277('0x43')]({'where':{'id':_0x4e2c83[_0xc277('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d5c53,null))[_0xc277('0x21')](removeEntity(_0x2d5c53,null))['catch'](handleError(_0x2d5c53,null));};exports[_0xc277('0x46')]=function(_0x314ccd,_0x5d8957){return db['CmHopperBlack'][_0xc277('0x46')]()[_0xc277('0x21')](respondWithResult(_0x5d8957,null))[_0xc277('0x41')](handleError(_0x5d8957,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 4e30973..0adc278 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 _0x35d5=['util','../../config/logger','moment','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x2a3a82,_0x231059){var _0x1d13b8=function(_0x41fe91){while(--_0x41fe91){_0x2a3a82['push'](_0x2a3a82['shift']());}};_0x1d13b8(++_0x231059);}(_0x35d5,0x107));var _0x535d=function(_0x3d85a2,_0x30701f){_0x3d85a2=_0x3d85a2-0x0;var _0x4748d7=_0x35d5[_0x3d85a2];return _0x4748d7;};'use strict';var _=require(_0x535d('0x0'));var util=require(_0x535d('0x1'));var logger=require(_0x535d('0x2'))('api');var moment=require(_0x535d('0x3'));var BPromise=require('bluebird');var rp=require(_0x535d('0x4'));var fs=require('fs');var path=require(_0x535d('0x5'));var rimraf=require('rimraf');var config=require(_0x535d('0x6'));var attributes=require(_0x535d('0x7'));module[_0x535d('0x8')]=function(_0x47b4c1,_0x15a127){return _0x47b4c1['define'](_0x535d('0x9'),attributes,{'tableName':_0x535d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac41=['define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0xac41,0x1d1));var _0x1ac4=function(_0x292816,_0x38b81f){_0x292816=_0x292816-0x0;var _0x5090ac=_0xac41[_0x292816];return _0x5090ac;};'use strict';var _=require(_0x1ac4('0x0'));var util=require('util');var logger=require(_0x1ac4('0x1'))(_0x1ac4('0x2'));var moment=require(_0x1ac4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac4('0x4'));var config=require(_0x1ac4('0x5'));var attributes=require(_0x1ac4('0x6'));module[_0x1ac4('0x7')]=function(_0x59a53e,_0x4f0665){return _0x59a53e[_0x1ac4('0x8')](_0x1ac4('0x9'),attributes,{'tableName':_0x1ac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 1b529e3..fa949bf 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 _0x2fee=['request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x44e8bb,_0x98dbe3){var _0x598d33=function(_0x7301e2){while(--_0x7301e2){_0x44e8bb['push'](_0x44e8bb['shift']());}};_0x598d33(++_0x98dbe3);}(_0x2fee,0xdd));var _0xe2fe=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x2fee[_0x395718];return _0x3028b8;};'use strict';var _=require(_0xe2fe('0x0'));var util=require('util');var moment=require(_0xe2fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xe2fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2fe('0x3'))['db'];var utils=require(_0xe2fe('0x4'));var logger=require(_0xe2fe('0x5'))('rpc');var config=require(_0xe2fe('0x6'));var jayson=require(_0xe2fe('0x7'));var client=jayson[_0xe2fe('0x8')][_0xe2fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336343,_0x3fdf70,_0x1446b7){return new BPromise(function(_0x1095e1,_0x50632f){return client[_0xe2fe('0xa')](_0x336343,_0x1446b7)[_0xe2fe('0xb')](function(_0x5a1e85){logger[_0xe2fe('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x3fdf70,_0xe2fe('0xd'));logger['debug'](_0xe2fe('0xe'),_0x3fdf70,'request\x20sent',JSON[_0xe2fe('0xf')](_0x5a1e85));if(_0x5a1e85[_0xe2fe('0x10')]){if(_0x5a1e85[_0xe2fe('0x10')][_0xe2fe('0x11')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3fdf70,_0x5a1e85[_0xe2fe('0x10')][_0xe2fe('0x12')]);return _0x50632f(_0x5a1e85[_0xe2fe('0x10')][_0xe2fe('0x12')]);}logger[_0xe2fe('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3fdf70,_0x5a1e85[_0xe2fe('0x10')][_0xe2fe('0x12')]);return _0x1095e1(_0x5a1e85[_0xe2fe('0x10')][_0xe2fe('0x12')]);}else{logger[_0xe2fe('0xc')](_0xe2fe('0x13'),_0x3fdf70,_0xe2fe('0xd'));_0x1095e1(_0x5a1e85[_0xe2fe('0x14')][_0xe2fe('0x12')]);}})[_0xe2fe('0x15')](function(_0x14e181){logger[_0xe2fe('0x10')](_0xe2fe('0x13'),_0x3fdf70,_0x14e181);_0x50632f(_0x14e181);});});}exports[_0xe2fe('0x16')]=function(_0x2a207c){var _0xe414ba=this;return new Promise(function(_0x5e3bc6,_0x5d2abc){return db[_0xe2fe('0x17')][_0xe2fe('0x18')]({'raw':_0x2a207c['options']?_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a207c[_0xe2fe('0x19')]?_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1b')]||null:null,'attributes':_0x2a207c[_0xe2fe('0x19')]?_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1c')]||null:null,'limit':_0x2a207c[_0xe2fe('0x19')]?_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1d')]||null:null,'include':_0x2a207c[_0xe2fe('0x19')]?_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1e')]?_['map'](_0x2a207c[_0xe2fe('0x19')][_0xe2fe('0x1e')],function(_0x2aa001){return{'model':db[_0x2aa001[_0xe2fe('0x1f')]],'as':_0x2aa001['as'],'attributes':_0x2aa001[_0xe2fe('0x1c')],'include':_0x2aa001[_0xe2fe('0x1e')]?_[_0xe2fe('0x20')](_0x2aa001[_0xe2fe('0x1e')],function(_0x35c3fd){return{'model':db[_0x35c3fd['model']],'as':_0x35c3fd['as'],'attributes':_0x35c3fd['attributes'],'include':_0x35c3fd[_0xe2fe('0x1e')]?_[_0xe2fe('0x20')](_0x35c3fd['include'],function(_0x418339){return{'model':db[_0x418339[_0xe2fe('0x1f')]],'as':_0x418339['as'],'attributes':_0x418339[_0xe2fe('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe2fe('0xb')](function(_0xca820e){logger['info'](_0xe2fe('0x16'),_0x2a207c);logger[_0xe2fe('0x21')](_0xe2fe('0x16'),_0x2a207c,JSON['stringify'](_0xca820e));_0x5e3bc6(_0xca820e);})['catch'](function(_0x40307b){logger['error'](_0xe2fe('0x16'),_0x40307b[_0xe2fe('0x12')],_0x2a207c);_0x5d2abc(_0xe414ba[_0xe2fe('0x10')](0x1f4,_0x40307b[_0xe2fe('0x12')]));});});};exports[_0xe2fe('0x22')]=function(_0x58564f){var _0x23e932=this;return new Promise(function(_0x4d7d9e,_0x8ad74b){return db['CmHopperBlack'][_0xe2fe('0x23')](_0x58564f[_0xe2fe('0x24')],{'raw':_0x58564f[_0xe2fe('0x19')]?_0x58564f[_0xe2fe('0x19')][_0xe2fe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58564f[_0xe2fe('0x19')]?_0x58564f[_0xe2fe('0x19')][_0xe2fe('0x1b')]||null:null,'attributes':_0x58564f[_0xe2fe('0x19')]?_0x58564f[_0xe2fe('0x19')][_0xe2fe('0x1c')]||null:null,'limit':_0x58564f[_0xe2fe('0x19')]?_0x58564f['options'][_0xe2fe('0x1d')]||null:null})[_0xe2fe('0xb')](function(_0x5323c7){logger['info'](_0xe2fe('0x22'),_0x58564f);logger[_0xe2fe('0x21')]('UpdateCmHopperBlack',_0x58564f,JSON['stringify'](_0x5323c7));_0x4d7d9e(_0x5323c7);})['catch'](function(_0x30f095){logger['error'](_0xe2fe('0x22'),_0x30f095[_0xe2fe('0x12')],_0x58564f);_0x8ad74b(_0x23e932['error'](0x1f4,_0x30f095[_0xe2fe('0x12')]));});});};exports[_0xe2fe('0x25')]=function(_0x36febf){var _0x5b1336=this;return new Promise(function(_0x48f81f,_0x26bb25){return db['CmHopperBlack'][_0xe2fe('0x26')]({'where':_0x36febf[_0xe2fe('0x19')]?_0x36febf['options'][_0xe2fe('0x1b')]||null:null})[_0xe2fe('0xb')](function(_0x360718){logger['info'](_0xe2fe('0x25'),_0x36febf);logger['debug'](_0xe2fe('0x25'),_0x36febf,JSON[_0xe2fe('0xf')](_0x360718));_0x48f81f(_0x360718);})[_0xe2fe('0x15')](function(_0x5021ee){logger['error'](_0xe2fe('0x25'),_0x5021ee['message'],_0x36febf);_0x26bb25(_0x5b1336[_0xe2fe('0x10')](0x1f4,_0x5021ee[_0xe2fe('0x12')]));});});}; \ No newline at end of file +var _0x0b7f=['GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','limit','include','map','model','attributes'];(function(_0x4a568f,_0x24751e){var _0x2e7ded=function(_0x3d0332){while(--_0x3d0332){_0x4a568f['push'](_0x4a568f['shift']());}};_0x2e7ded(++_0x24751e);}(_0x0b7f,0x167));var _0xf0b7=function(_0x32d58e,_0x476b2f){_0x32d58e=_0x32d58e-0x0;var _0x8be770=_0x0b7f[_0x32d58e];return _0x8be770;};'use strict';var _=require(_0xf0b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf0b7('0x1'));var rs=require(_0xf0b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0b7('0x3'))['db'];var utils=require(_0xf0b7('0x4'));var logger=require(_0xf0b7('0x5'))(_0xf0b7('0x6'));var config=require(_0xf0b7('0x7'));var jayson=require(_0xf0b7('0x8'));var client=jayson[_0xf0b7('0x9')][_0xf0b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1458fc,_0x352115,_0x34ee4f){return new BPromise(function(_0x892668,_0x52e389){return client[_0xf0b7('0xb')](_0x1458fc,_0x34ee4f)[_0xf0b7('0xc')](function(_0x40470c){logger[_0xf0b7('0xd')](_0xf0b7('0xe'),_0x352115,_0xf0b7('0xf'));logger[_0xf0b7('0x10')](_0xf0b7('0x11'),_0x352115,_0xf0b7('0xf'),JSON[_0xf0b7('0x12')](_0x40470c));if(_0x40470c[_0xf0b7('0x13')]){if(_0x40470c[_0xf0b7('0x13')][_0xf0b7('0x14')]===0x1f4){logger[_0xf0b7('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x352115,_0x40470c[_0xf0b7('0x13')]['message']);return _0x52e389(_0x40470c[_0xf0b7('0x13')]['message']);}logger[_0xf0b7('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x352115,_0x40470c['error'][_0xf0b7('0x15')]);return _0x892668(_0x40470c[_0xf0b7('0x13')]['message']);}else{logger[_0xf0b7('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x352115,_0xf0b7('0xf'));_0x892668(_0x40470c['result'][_0xf0b7('0x15')]);}})[_0xf0b7('0x16')](function(_0xc451d5){logger[_0xf0b7('0x13')](_0xf0b7('0xe'),_0x352115,_0xc451d5);_0x52e389(_0xc451d5);});});}exports['GetCmHopperBlack']=function(_0x1cf1ca){var _0x643209=this;return new Promise(function(_0x43a5d0,_0x2ddc6a){return db['CmHopperBlack'][_0xf0b7('0x17')]({'raw':_0x1cf1ca['options']?_0x1cf1ca[_0xf0b7('0x18')][_0xf0b7('0x19')]===undefined?!![]:![]:!![],'where':_0x1cf1ca[_0xf0b7('0x18')]?_0x1cf1ca[_0xf0b7('0x18')]['where']||null:null,'attributes':_0x1cf1ca[_0xf0b7('0x18')]?_0x1cf1ca[_0xf0b7('0x18')]['attributes']||null:null,'limit':_0x1cf1ca['options']?_0x1cf1ca[_0xf0b7('0x18')][_0xf0b7('0x1a')]||null:null,'include':_0x1cf1ca['options']?_0x1cf1ca[_0xf0b7('0x18')][_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x1cf1ca[_0xf0b7('0x18')][_0xf0b7('0x1b')],function(_0x5dd7df){return{'model':db[_0x5dd7df[_0xf0b7('0x1d')]],'as':_0x5dd7df['as'],'attributes':_0x5dd7df[_0xf0b7('0x1e')],'include':_0x5dd7df[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x5dd7df['include'],function(_0x2b0c0e){return{'model':db[_0x2b0c0e[_0xf0b7('0x1d')]],'as':_0x2b0c0e['as'],'attributes':_0x2b0c0e['attributes'],'include':_0x2b0c0e[_0xf0b7('0x1b')]?_[_0xf0b7('0x1c')](_0x2b0c0e[_0xf0b7('0x1b')],function(_0xebe668){return{'model':db[_0xebe668[_0xf0b7('0x1d')]],'as':_0xebe668['as'],'attributes':_0xebe668[_0xf0b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0b7('0xc')](function(_0x35f2ea){logger[_0xf0b7('0xd')](_0xf0b7('0x1f'),_0x1cf1ca);logger['debug']('GetCmHopperBlack',_0x1cf1ca,JSON[_0xf0b7('0x12')](_0x35f2ea));_0x43a5d0(_0x35f2ea);})[_0xf0b7('0x16')](function(_0x4ee6d6){logger[_0xf0b7('0x13')]('GetCmHopperBlack',_0x4ee6d6[_0xf0b7('0x15')],_0x1cf1ca);_0x2ddc6a(_0x643209[_0xf0b7('0x13')](0x1f4,_0x4ee6d6[_0xf0b7('0x15')]));});});};exports[_0xf0b7('0x20')]=function(_0x4032c6){var _0x468b48=this;return new Promise(function(_0xa315cf,_0x29cc3c){return db[_0xf0b7('0x21')][_0xf0b7('0x22')](_0x4032c6[_0xf0b7('0x23')],{'raw':_0x4032c6[_0xf0b7('0x18')]?_0x4032c6[_0xf0b7('0x18')][_0xf0b7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4032c6['options']?_0x4032c6[_0xf0b7('0x18')][_0xf0b7('0x24')]||null:null,'attributes':_0x4032c6[_0xf0b7('0x18')]?_0x4032c6[_0xf0b7('0x18')][_0xf0b7('0x1e')]||null:null,'limit':_0x4032c6['options']?_0x4032c6[_0xf0b7('0x18')][_0xf0b7('0x1a')]||null:null})['then'](function(_0x1cde69){logger['info'](_0xf0b7('0x20'),_0x4032c6);logger[_0xf0b7('0x10')](_0xf0b7('0x20'),_0x4032c6,JSON[_0xf0b7('0x12')](_0x1cde69));_0xa315cf(_0x1cde69);})[_0xf0b7('0x16')](function(_0x28a0e4){logger[_0xf0b7('0x13')](_0xf0b7('0x20'),_0x28a0e4[_0xf0b7('0x15')],_0x4032c6);_0x29cc3c(_0x468b48['error'](0x1f4,_0x28a0e4[_0xf0b7('0x15')]));});});};exports[_0xf0b7('0x25')]=function(_0x2feba0){var _0x1b5ed5=this;return new Promise(function(_0x3b6a5f,_0x2dd540){return db[_0xf0b7('0x21')][_0xf0b7('0x26')]({'where':_0x2feba0[_0xf0b7('0x18')]?_0x2feba0[_0xf0b7('0x18')][_0xf0b7('0x24')]||null:null})[_0xf0b7('0xc')](function(_0x292717){logger[_0xf0b7('0xd')](_0xf0b7('0x25'),_0x2feba0);logger[_0xf0b7('0x10')]('DestroyCmHopperBlack',_0x2feba0,JSON['stringify'](_0x292717));_0x3b6a5f(_0x292717);})[_0xf0b7('0x16')](function(_0x15233e){logger[_0xf0b7('0x13')](_0xf0b7('0x25'),_0x15233e[_0xf0b7('0x15')],_0x2feba0);_0x2dd540(_0x1b5ed5[_0xf0b7('0x13')](0x1f4,_0x15233e[_0xf0b7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 747edd5..72b564c 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 _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x1e21ec,_0xac0400){var _0x2c2198=function(_0x2dc2d2){while(--_0x2dc2d2){_0x1e21ec['push'](_0x1e21ec['shift']());}};_0x2c2198(++_0xac0400);}(_0x187d,0x93));var _0xd187=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x187d[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file +var _0xaa3f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x5f1e5c,_0x5dd07c){var _0x14ef4b=function(_0x480a84){while(--_0x480a84){_0x5f1e5c['push'](_0x5f1e5c['shift']());}};_0x14ef4b(++_0x5dd07c);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x9035d6,_0x3af0eb){_0x9035d6=_0x9035d6-0x0;var _0x1cd80f=_0xaa3f[_0x9035d6];return _0x1cd80f;};'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('./cmHopperBlack.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x12')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x13')]);module[_0xfaa3('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 904b4fd..d5dbeba 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 _0x11f5=['DATE','getDataValue','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x49dca3,_0x5228d8){var _0x2b9243=function(_0x36d8cf){while(--_0x36d8cf){_0x49dca3['push'](_0x49dca3['shift']());}};_0x2b9243(++_0x5228d8);}(_0x11f5,0x1ac));var _0x511f=function(_0x1b1d2f,_0x393cad){_0x1b1d2f=_0x1b1d2f-0x0;var _0x528383=_0x11f5[_0x1b1d2f];return _0x528383;};'use strict';var Sequelize=require(_0x511f('0x0'));var moment=require('moment');module[_0x511f('0x1')]={'state':{'type':Sequelize[_0x511f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x511f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x511f('0x3')]},'originatecalleridname':{'type':Sequelize[_0x511f('0x3')]},'calleridnum':{'type':Sequelize[_0x511f('0x3')]},'calleridname':{'type':Sequelize[_0x511f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x511f('0x4')]},'answertime':{'type':Sequelize[_0x511f('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x511f('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x511f('0x3')]},'campaign':{'type':Sequelize[_0x511f('0x3')]},'campaigntype':{'type':Sequelize[_0x511f('0x3')]},'membername':{'type':Sequelize[_0x511f('0x3')]},'reason':{'type':Sequelize[_0x511f('0x3')]},'disposition':{'type':Sequelize[_0x511f('0x3')]},'secondDisposition':{'type':Sequelize[_0x511f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x511f('0x4')],'set':function(_0x2e5bd7){var _0x2bf3bb=this[_0x511f('0x5')]('endtime');if(_0x2bf3bb&&_0x2e5bd7){this['setDataValue']('followuptime',moment(_0x2e5bd7)['diff'](moment(_0x2bf3bb),_0x511f('0x6')));}}},'amd':{'type':Sequelize[_0x511f('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0x511f('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x511f('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x511f('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x511f('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x511f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x511f('0x4')]},'deleted':{'type':Sequelize[_0x511f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x511f('0x4')]},'recallme':{'type':Sequelize[_0x511f('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x511f('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x511f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd6c=['INTEGER','DATE','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING'];(function(_0x123043,_0x11a882){var _0xb86078=function(_0x129a91){while(--_0x129a91){_0x123043['push'](_0x123043['shift']());}};_0xb86078(++_0x11a882);}(_0xdd6c,0x6a));var _0xcdd6=function(_0x502051,_0x22f68e){_0x502051=_0x502051-0x0;var _0x948075=_0xdd6c[_0x502051];return _0x948075;};'use strict';var Sequelize=require(_0xcdd6('0x0'));var moment=require(_0xcdd6('0x1'));module[_0xcdd6('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xcdd6('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcdd6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xcdd6('0x3')]},'originatecalleridname':{'type':Sequelize[_0xcdd6('0x3')]},'calleridnum':{'type':Sequelize[_0xcdd6('0x3')]},'calleridname':{'type':Sequelize[_0xcdd6('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcdd6('0x5')]},'answertime':{'type':Sequelize[_0xcdd6('0x5')]},'droptime':{'type':Sequelize[_0xcdd6('0x5')]},'endtime':{'type':Sequelize[_0xcdd6('0x5')]},'ringtime':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xcdd6('0x3')]},'campaigntype':{'type':Sequelize[_0xcdd6('0x3')]},'membername':{'type':Sequelize[_0xcdd6('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcdd6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcdd6('0x3')]},'dispositionat':{'type':Sequelize[_0xcdd6('0x5')],'set':function(_0x5ddc3e){var _0x14b2bf=this['getDataValue'](_0xcdd6('0x6'));if(_0x14b2bf&&_0x5ddc3e){this[_0xcdd6('0x7')]('followuptime',moment(_0x5ddc3e)[_0xcdd6('0x8')](moment(_0x14b2bf),_0xcdd6('0x9')));}}},'amd':{'type':Sequelize[_0xcdd6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcdd6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcdd6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcdd6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xcdd6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcdd6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcdd6('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xcdd6('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcdd6('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcdd6('0x4')],'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 484c2ac..6dffeb6 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 _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4975,0x86));var _0x5497=function(_0x5b137f,_0x8b6f3a){_0x5b137f=_0x5b137f-0x0;var _0x2667cc=_0x4975[_0x5b137f];return _0x2667cc;};'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'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file +var _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x187d,0x93));var _0xd187=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x187d[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 23d9478..0d45be8 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 _0x4e02=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','moment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x4e02,0x105));var _0x24e0=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x4e02[_0x4ca6a4];return _0x120555;};'use strict';var _=require('lodash');var util=require(_0x24e0('0x0'));var logger=require(_0x24e0('0x1'))('api');var moment=require(_0x24e0('0x2'));var BPromise=require(_0x24e0('0x3'));var rp=require(_0x24e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24e0('0x5'));var config=require(_0x24e0('0x6'));var attributes=require(_0x24e0('0x7'));module[_0x24e0('0x8')]=function(_0xe45b1f,_0x25c6f7){return _0xe45b1f['define'](_0x24e0('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x24e0('0xa'),'fields':[_0x24e0('0xa')]},{'name':'uniqueid','fields':[_0x24e0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1ca=['define','cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','bluebird','../../config/environment','./cmHopperFinal.attributes'];(function(_0x225240,_0x4542c4){var _0x21b6bb=function(_0x59fed1){while(--_0x59fed1){_0x225240['push'](_0x225240['shift']());}};_0x21b6bb(++_0x4542c4);}(_0xa1ca,0x13a));var _0xaa1c=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0xa1ca[_0x447725];return _0x399167;};'use strict';var _=require(_0xaa1c('0x0'));var util=require(_0xaa1c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaa1c('0x2'));var BPromise=require(_0xaa1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa1c('0x4'));var attributes=require(_0xaa1c('0x5'));module['exports']=function(_0x474e4d,_0x124b50){return _0x474e4d[_0xaa1c('0x6')]('CmHopperFinal',attributes,{'tableName':_0xaa1c('0x7'),'paranoid':![],'indexes':[{'name':_0xaa1c('0x8'),'fields':['calleridnum']},{'name':_0xaa1c('0x9'),'fields':[_0xaa1c('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 aa93a96..bc6aa6b 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(_0x1de3ce,_0x57c0ad){var _0x669651=function(_0x94f9f4){while(--_0x94f9f4){_0x1de3ce['push'](_0x1de3ce['shift']());}};_0x669651(++_0x57c0ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x2de9a5,_0x1bbbd1){_0x2de9a5=_0x2de9a5-0x0;var _0xddd28a=_0xb10b[_0x2de9a5];return _0xddd28a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x432a64,_0x3c5bee){var _0x4f92b5=function(_0x4f5767){while(--_0x4f5767){_0x432a64['push'](_0x432a64['shift']());}};_0x4f92b5(++_0x3c5bee);}(_0x7a54,0x106));var _0x47a5=function(_0x46cc0a,_0x35baeb){_0x46cc0a=_0x46cc0a-0x0;var _0x2f58ac=_0x7a54[_0x46cc0a];return _0x2f58ac;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 18ca157..69b0184 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 _0x21ec=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update'];(function(_0x556361,_0x3b94ba){var _0x183ffd=function(_0x2344b3){while(--_0x2344b3){_0x556361['push'](_0x556361['shift']());}};_0x183ffd(++_0x3b94ba);}(_0x21ec,0xb0));var _0xc21e=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x21ec[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xc21e('0x0'));var util=require('util');var path=require(_0xc21e('0x1'));var timeout=require(_0xc21e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc21e('0x3'));var auth=require(_0xc21e('0x4'));var interaction=require(_0xc21e('0x5'));var config=require(_0xc21e('0x6'));var controller=require(_0xc21e('0x7'));router[_0xc21e('0x8')]('/',auth[_0xc21e('0x9')](),controller[_0xc21e('0xa')]);router[_0xc21e('0x8')]('/describe',auth[_0xc21e('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc21e('0xb')]);router[_0xc21e('0x8')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xc21e('0xc')]);router['get'](_0xc21e('0xd'),auth[_0xc21e('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xc21e('0xe')](_0xc21e('0xf'),auth['isAuthenticated'](),controller[_0xc21e('0x10')]);router[_0xc21e('0xe')](_0xc21e('0x11'),auth[_0xc21e('0x9')](),controller[_0xc21e('0x12')]);router[_0xc21e('0xe')](_0xc21e('0x13'),auth['isAuthenticated'](),controller[_0xc21e('0x14')]);router[_0xc21e('0x15')](_0xc21e('0x16'),auth['isAuthenticated'](),controller[_0xc21e('0x17')]);module[_0xc21e('0x18')]=router; \ No newline at end of file +var _0x56be=['put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','checkContactHopper'];(function(_0x45aa8a,_0x3dcc95){var _0x2108eb=function(_0x1342d1){while(--_0x1342d1){_0x45aa8a['push'](_0x45aa8a['shift']());}};_0x2108eb(++_0x3dcc95);}(_0x56be,0x1d7));var _0xe56b=function(_0x5c634a,_0x566d35){_0x5c634a=_0x5c634a-0x0;var _0x4c0be2=_0x56be[_0x5c634a];return _0x4c0be2;};'use strict';var multer=require(_0xe56b('0x0'));var util=require(_0xe56b('0x1'));var path=require(_0xe56b('0x2'));var timeout=require(_0xe56b('0x3'));var express=require(_0xe56b('0x4'));var router=express[_0xe56b('0x5')]();var fs_extra=require(_0xe56b('0x6'));var auth=require(_0xe56b('0x7'));var interaction=require(_0xe56b('0x8'));var config=require(_0xe56b('0x9'));var controller=require('./cmHopperFinal.controller');router[_0xe56b('0xa')]('/',auth['isAuthenticated'](),controller[_0xe56b('0xb')]);router[_0xe56b('0xa')]('/describe',auth[_0xe56b('0xc')](),controller[_0xe56b('0xd')]);router['get'](_0xe56b('0xe'),auth['isAuthenticated'](),controller[_0xe56b('0xf')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xe56b('0xc')](),controller[_0xe56b('0x10')]);router['get'](_0xe56b('0x11'),auth[_0xe56b('0xc')](),controller[_0xe56b('0x12')]);router['post'](_0xe56b('0x13'),auth[_0xe56b('0xc')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xe56b('0x14')](_0xe56b('0x15'),auth[_0xe56b('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xe56b('0x14')]('/checkContactHopper',auth[_0xe56b('0xc')](),controller[_0xe56b('0x16')]);router[_0xe56b('0x17')](_0xe56b('0xe'),auth[_0xe56b('0xc')](),controller[_0xe56b('0x18')]);module[_0xe56b('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 36e3ba4..88a3a60 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 _0x7c71=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x53c9f9,_0x3c6abf){var _0x577b4b=function(_0x59d11c){while(--_0x59d11c){_0x53c9f9['push'](_0x53c9f9['shift']());}};_0x577b4b(++_0x3c6abf);}(_0x7c71,0x177));var _0x17c7=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x7c71[_0x15ca1a];return _0x507626;};'use strict';var Sequelize=require(_0x17c7('0x0'));module[_0x17c7('0x1')]={'state':{'type':Sequelize[_0x17c7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x17c7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x17c7('0x3')]},'originatecalleridname':{'type':Sequelize[_0x17c7('0x3')]},'calleridnum':{'type':Sequelize[_0x17c7('0x3')]},'calleridname':{'type':Sequelize[_0x17c7('0x3')]},'starttime':{'type':Sequelize[_0x17c7('0x4')]},'responsetime':{'type':Sequelize[_0x17c7('0x4')]},'answertime':{'type':Sequelize[_0x17c7('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x17c7('0x4')]},'ringtime':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x17c7('0x3')]},'campaign':{'type':Sequelize[_0x17c7('0x3')]},'campaigntype':{'type':Sequelize[_0x17c7('0x3')]},'membername':{'type':Sequelize[_0x17c7('0x3')]},'reason':{'type':Sequelize[_0x17c7('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x17c7('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x17c7('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x17c7('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x17c7('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x17c7('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x17c7('0x3')]}}; \ No newline at end of file +var _0xf1c3=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x4e788c,_0x3bb64e){var _0x23a20c=function(_0x487cd1){while(--_0x487cd1){_0x4e788c['push'](_0x4e788c['shift']());}};_0x23a20c(++_0x3bb64e);}(_0xf1c3,0x1d8));var _0x3f1c=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0xf1c3[_0x15b380];return _0x232c5c;};'use strict';var Sequelize=require(_0x3f1c('0x0'));module['exports']={'state':{'type':Sequelize[_0x3f1c('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3f1c('0x2')]},'scheduledat':{'type':Sequelize[_0x3f1c('0x3')]},'countbusyretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x3f1c('0x2')]},'calleridnum':{'type':Sequelize[_0x3f1c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3f1c('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3f1c('0x3')]},'droptime':{'type':Sequelize[_0x3f1c('0x3')]},'endtime':{'type':Sequelize[_0x3f1c('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3f1c('0x2')]},'campaign':{'type':Sequelize[_0x3f1c('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3f1c('0x2')]},'reason':{'type':Sequelize[_0x3f1c('0x2')]},'amd':{'type':Sequelize[_0x3f1c('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x3f1c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3f1c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3f1c('0x3')]},'edited':{'type':Sequelize[_0x3f1c('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3f1c('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3f1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 687b625..9aed654 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 _0xda1b=['nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','describe','update','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0xda1b,0xaa));var _0xbda1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xda1b[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require(_0xbda1('0x0'));var rimraf=require(_0xbda1('0x1'));var zipdir=require(_0xbda1('0x2'));var jsonpatch=require(_0xbda1('0x3'));var rp=require(_0xbda1('0x4'));var moment=require('moment');var BPromise=require(_0xbda1('0x5'));var Mustache=require('mustache');var util=require(_0xbda1('0x6'));var path=require(_0xbda1('0x7'));var sox=require('sox');var csv=require(_0xbda1('0x8'));var ejs=require(_0xbda1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbda1('0xa'));var crypto=require(_0xbda1('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbda1('0x8'));var querystring=require(_0xbda1('0xc'));var Papa=require(_0xbda1('0xd'));var Redis=require(_0xbda1('0xe'));var authService=require(_0xbda1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbda1('0x10'));var hardwareService=require(_0xbda1('0x11'));var logger=require(_0xbda1('0x12'))(_0xbda1('0x13'));var utils=require(_0xbda1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbda1('0x15'))['db'];function respondWithStatusCode(_0x106b33,_0x38455f){_0x38455f=_0x38455f||0xcc;return function(_0x371c6b){if(_0x371c6b){return _0x106b33[_0xbda1('0x16')](_0x38455f);}return _0x106b33[_0xbda1('0x17')](_0x38455f)['end']();};}function respondWithResult(_0x4b573a,_0x44d5c3){_0x44d5c3=_0x44d5c3||0xc8;return function(_0x4f322a){if(_0x4f322a){return _0x4b573a[_0xbda1('0x17')](_0x44d5c3)['json'](_0x4f322a);}};}function respondWithFilteredResult(_0x44507c,_0x154bf2){return function(_0x31374a){if(_0x31374a){var _0x4080bb=typeof _0x154bf2[_0xbda1('0x18')]===_0xbda1('0x19')&&typeof _0x154bf2['limit']===_0xbda1('0x19');var _0x5ec291=_0x31374a[_0xbda1('0x1a')];var _0xdacdca=_0x4080bb?0x0:_0x154bf2[_0xbda1('0x18')];var _0x444cfc=_0x4080bb?_0x31374a['count']:_0x154bf2[_0xbda1('0x18')]+_0x154bf2[_0xbda1('0x1b')];var _0x424ca6;if(_0x444cfc>=_0x5ec291){_0x444cfc=_0x5ec291;_0x424ca6=0xc8;}else{_0x424ca6=0xce;}_0x44507c[_0xbda1('0x17')](_0x424ca6);return _0x44507c[_0xbda1('0x1c')](_0xbda1('0x1d'),_0xdacdca+'-'+_0x444cfc+'/'+_0x5ec291)['json'](_0x31374a);}return null;};}function patchUpdates(_0x5932f5){return function(_0x1fb077){try{jsonpatch['apply'](_0x1fb077,_0x5932f5,!![]);}catch(_0x45cbb2){return BPromise[_0xbda1('0x1e')](_0x45cbb2);}return _0x1fb077[_0xbda1('0x1f')]();};}function saveUpdates(_0x21af54,_0x5d136e){return function(_0x188af1){if(_0x188af1){return _0x188af1['update'](_0x21af54)[_0xbda1('0x20')](function(_0xda7d87){return _0xda7d87;});}return null;};}function removeEntity(_0x351e29,_0x29f5b7){return function(_0x1edc07){if(_0x1edc07){return _0x1edc07[_0xbda1('0x21')]()['then'](function(){_0x351e29[_0xbda1('0x17')](0xcc)[_0xbda1('0x22')]();});}};}function handleEntityNotFound(_0xa4224d,_0x3438ac){return function(_0x578168){if(!_0x578168){_0xa4224d[_0xbda1('0x16')](0x194);}return _0x578168;};}function handleError(_0x24cb91,_0x2586a5){_0x2586a5=_0x2586a5||0x1f4;return function(_0x583d2f){logger[_0xbda1('0x23')](_0x583d2f[_0xbda1('0x24')]);if(_0x583d2f[_0xbda1('0x25')]){delete _0x583d2f['name'];}_0x24cb91['status'](_0x2586a5)['send'](_0x583d2f);};}exports[_0xbda1('0x26')]=function(_0x3084e6,_0x2486c9){var _0x278cd1={},_0x2f0ad3={},_0x24c04b={'count':0x0,'rows':[]};var _0x4278fe=_[_0xbda1('0x27')](db[_0xbda1('0x28')][_0xbda1('0x29')],function(_0x5f53d8){return{'name':_0x5f53d8['fieldName'],'type':_0x5f53d8['type'][_0xbda1('0x2a')]};});_0x2f0ad3['model']=_[_0xbda1('0x27')](_0x4278fe,'name');_0x2f0ad3[_0xbda1('0x2b')]=_[_0xbda1('0x2c')](_0x3084e6[_0xbda1('0x2b')]);_0x2f0ad3[_0xbda1('0x2d')]=_[_0xbda1('0x2e')](_0x2f0ad3[_0xbda1('0x2f')],_0x2f0ad3[_0xbda1('0x2b')]);_0x278cd1[_0xbda1('0x30')]=_[_0xbda1('0x2e')](_0x2f0ad3[_0xbda1('0x2f')],qs[_0xbda1('0x31')](_0x3084e6['query'][_0xbda1('0x31')]));_0x278cd1[_0xbda1('0x30')]=_0x278cd1['attributes'][_0xbda1('0x32')]?_0x278cd1[_0xbda1('0x30')]:_0x2f0ad3[_0xbda1('0x2f')];if(!_0x3084e6[_0xbda1('0x2b')][_0xbda1('0x33')](_0xbda1('0x34'))){_0x278cd1[_0xbda1('0x1b')]=qs[_0xbda1('0x1b')](_0x3084e6[_0xbda1('0x2b')]['limit']);_0x278cd1['offset']=qs['offset'](_0x3084e6[_0xbda1('0x2b')][_0xbda1('0x18')]);}_0x278cd1[_0xbda1('0x35')]=qs[_0xbda1('0x36')](_0x3084e6['query']['sort']);_0x278cd1[_0xbda1('0x37')]=qs['filters'](_[_0xbda1('0x38')](_0x3084e6[_0xbda1('0x2b')],_0x2f0ad3[_0xbda1('0x2d')]),_0x4278fe);if(_0x3084e6['query'][_0xbda1('0x39')]){_0x278cd1[_0xbda1('0x37')]=_[_0xbda1('0x3a')](_0x278cd1['where'],{'$or':_[_0xbda1('0x27')](_0x4278fe,function(_0x3cddab){if(_0x3cddab[_0xbda1('0x3b')]!==_0xbda1('0x3c')){var _0x44508c={};_0x44508c[_0x3cddab['name']]={'$like':'%'+_0x3084e6[_0xbda1('0x2b')][_0xbda1('0x39')]+'%'};return _0x44508c;}})});}_0x278cd1=_[_0xbda1('0x3a')]({},_0x278cd1,_0x3084e6[_0xbda1('0x3d')]);var _0x1712ab={'where':_0x278cd1['where']};return db[_0xbda1('0x28')][_0xbda1('0x1a')](_0x1712ab)[_0xbda1('0x20')](function(_0x7e4437){_0x24c04b[_0xbda1('0x1a')]=_0x7e4437;if(_0x3084e6['query'][_0xbda1('0x3e')]){_0x278cd1[_0xbda1('0x3f')]=[{'all':!![]}];}return db[_0xbda1('0x28')][_0xbda1('0x40')](_0x278cd1);})[_0xbda1('0x20')](function(_0x3cee8){_0x24c04b[_0xbda1('0x41')]=_0x3cee8;return _0x24c04b;})['then'](respondWithFilteredResult(_0x2486c9,_0x278cd1))['catch'](handleError(_0x2486c9,null));};exports['show']=function(_0x271dc8,_0x182171){var _0x37e776={'raw':!![],'where':{'id':_0x271dc8[_0xbda1('0x42')]['id']}},_0x4d96dc={};_0x4d96dc[_0xbda1('0x2f')]=_[_0xbda1('0x2c')](db[_0xbda1('0x28')][_0xbda1('0x29')]);_0x4d96dc[_0xbda1('0x2b')]=_['keys'](_0x271dc8[_0xbda1('0x2b')]);_0x4d96dc[_0xbda1('0x2d')]=_[_0xbda1('0x2e')](_0x4d96dc[_0xbda1('0x2f')],_0x4d96dc[_0xbda1('0x2b')]);_0x37e776['attributes']=_[_0xbda1('0x2e')](_0x4d96dc[_0xbda1('0x2f')],qs[_0xbda1('0x31')](_0x271dc8[_0xbda1('0x2b')]['fields']));_0x37e776[_0xbda1('0x30')]=_0x37e776[_0xbda1('0x30')]['length']?_0x37e776[_0xbda1('0x30')]:_0x4d96dc[_0xbda1('0x2f')];if(_0x271dc8[_0xbda1('0x2b')][_0xbda1('0x3e')]){_0x37e776[_0xbda1('0x3f')]=[{'all':!![]}];}_0x37e776=_[_0xbda1('0x3a')]({},_0x37e776,_0x271dc8['options']);return db[_0xbda1('0x28')]['find'](_0x37e776)['then'](handleEntityNotFound(_0x182171,null))[_0xbda1('0x20')](respondWithResult(_0x182171,null))[_0xbda1('0x43')](handleError(_0x182171,null));};exports[_0xbda1('0x44')]=function(_0x38b940,_0x37aa4f){return db[_0xbda1('0x28')][_0xbda1('0x44')](_0x38b940[_0xbda1('0x45')],{})[_0xbda1('0x20')](respondWithResult(_0x37aa4f,0xc9))[_0xbda1('0x43')](handleError(_0x37aa4f,null));};exports[_0xbda1('0x46')]=function(_0x8a5ac9,_0x5d51d4){return db[_0xbda1('0x28')][_0xbda1('0x46')]()[_0xbda1('0x20')](respondWithResult(_0x5d51d4,null))[_0xbda1('0x43')](handleError(_0x5d51d4,null));};exports[_0xbda1('0x47')]=function(_0x1fcadf,_0xa06510){if(_0x1fcadf['body'][_0xbda1('0x48')]){delete _0x1fcadf['body'][_0xbda1('0x48')];}return db['CmHopperHistory'][_0xbda1('0x49')]({'where':{'uniqueid':_0x1fcadf[_0xbda1('0x42')]['id']}})['then'](handleEntityNotFound(_0xa06510,null))['then'](saveUpdates(_0x1fcadf[_0xbda1('0x45')],null))[_0xbda1('0x20')](respondWithResult(_0xa06510,null))[_0xbda1('0x43')](handleError(_0xa06510,null));}; \ No newline at end of file +var _0x1a76=['find','eml-format','rimraf','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','CmHopperHistory','findAll','rows','show','params','length','includeAll','catch','create','body','describe','uniqueid'];(function(_0x109d07,_0x493a0f){var _0x549773=function(_0x1010df){while(--_0x1010df){_0x109d07['push'](_0x109d07['shift']());}};_0x549773(++_0x493a0f);}(_0x1a76,0x1d5));var _0x61a7=function(_0x458709,_0x1981ea){_0x458709=_0x458709-0x0;var _0x48cbd7=_0x1a76[_0x458709];return _0x48cbd7;};'use strict';var emlformat=require(_0x61a7('0x0'));var rimraf=require(_0x61a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61a7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x61a7('0x3'));var util=require(_0x61a7('0x4'));var path=require(_0x61a7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x61a7('0x6'));var fs=require('fs');var fs_extra=require(_0x61a7('0x7'));var _=require(_0x61a7('0x8'));var squel=require(_0x61a7('0x9'));var crypto=require('crypto');var jsforce=require(_0x61a7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x61a7('0xb'));var querystring=require(_0x61a7('0xc'));var Papa=require('papaparse');var Redis=require(_0x61a7('0xd'));var authService=require(_0x61a7('0xe'));var qs=require(_0x61a7('0xf'));var as=require(_0x61a7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61a7('0x11'))(_0x61a7('0x12'));var utils=require(_0x61a7('0x13'));var config=require(_0x61a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x61a7('0x15'))['db'];function respondWithStatusCode(_0xaa63f6,_0x26b96f){_0x26b96f=_0x26b96f||0xcc;return function(_0x21cb3a){if(_0x21cb3a){return _0xaa63f6['sendStatus'](_0x26b96f);}return _0xaa63f6[_0x61a7('0x16')](_0x26b96f)[_0x61a7('0x17')]();};}function respondWithResult(_0x4e900f,_0x109d75){_0x109d75=_0x109d75||0xc8;return function(_0x56f623){if(_0x56f623){return _0x4e900f[_0x61a7('0x16')](_0x109d75)['json'](_0x56f623);}};}function respondWithFilteredResult(_0x2ac656,_0x21e3b8){return function(_0x5e003a){if(_0x5e003a){var _0x56471f=typeof _0x21e3b8[_0x61a7('0x18')]==='undefined'&&typeof _0x21e3b8[_0x61a7('0x19')]===_0x61a7('0x1a');var _0x1550dc=_0x5e003a[_0x61a7('0x1b')];var _0x5901c0=_0x56471f?0x0:_0x21e3b8[_0x61a7('0x18')];var _0x5be68e=_0x56471f?_0x5e003a['count']:_0x21e3b8[_0x61a7('0x18')]+_0x21e3b8[_0x61a7('0x19')];var _0x5e5fd6;if(_0x5be68e>=_0x1550dc){_0x5be68e=_0x1550dc;_0x5e5fd6=0xc8;}else{_0x5e5fd6=0xce;}_0x2ac656['status'](_0x5e5fd6);return _0x2ac656[_0x61a7('0x1c')](_0x61a7('0x1d'),_0x5901c0+'-'+_0x5be68e+'/'+_0x1550dc)[_0x61a7('0x1e')](_0x5e003a);}return null;};}function patchUpdates(_0x1f1906){return function(_0x547563){try{jsonpatch[_0x61a7('0x1f')](_0x547563,_0x1f1906,!![]);}catch(_0x133cbd){return BPromise[_0x61a7('0x20')](_0x133cbd);}return _0x547563[_0x61a7('0x21')]();};}function saveUpdates(_0x1eb44a,_0x2478a8){return function(_0x4dbe95){if(_0x4dbe95){return _0x4dbe95[_0x61a7('0x22')](_0x1eb44a)[_0x61a7('0x23')](function(_0x5d77da){return _0x5d77da;});}return null;};}function removeEntity(_0xa127b,_0x356d6d){return function(_0x448910){if(_0x448910){return _0x448910[_0x61a7('0x24')]()[_0x61a7('0x23')](function(){_0xa127b['status'](0xcc)[_0x61a7('0x17')]();});}};}function handleEntityNotFound(_0x3d3e7d,_0x2b7735){return function(_0x1126d2){if(!_0x1126d2){_0x3d3e7d[_0x61a7('0x25')](0x194);}return _0x1126d2;};}function handleError(_0x1059fc,_0x4b2804){_0x4b2804=_0x4b2804||0x1f4;return function(_0x4cff87){logger[_0x61a7('0x26')](_0x4cff87[_0x61a7('0x27')]);if(_0x4cff87[_0x61a7('0x28')]){delete _0x4cff87[_0x61a7('0x28')];}_0x1059fc['status'](_0x4b2804)['send'](_0x4cff87);};}exports[_0x61a7('0x29')]=function(_0x13d323,_0x12dca9){var _0x299800={},_0x1d6c8c={},_0x42fabc={'count':0x0,'rows':[]};var _0x18f2a6=_[_0x61a7('0x2a')](db['CmHopperHistory'][_0x61a7('0x2b')],function(_0xa0aaa2){return{'name':_0xa0aaa2[_0x61a7('0x2c')],'type':_0xa0aaa2[_0x61a7('0x2d')][_0x61a7('0x2e')]};});_0x1d6c8c[_0x61a7('0x2f')]=_[_0x61a7('0x2a')](_0x18f2a6,'name');_0x1d6c8c['query']=_[_0x61a7('0x30')](_0x13d323[_0x61a7('0x31')]);_0x1d6c8c['filters']=_['intersection'](_0x1d6c8c[_0x61a7('0x2f')],_0x1d6c8c[_0x61a7('0x31')]);_0x299800[_0x61a7('0x32')]=_[_0x61a7('0x33')](_0x1d6c8c['model'],qs[_0x61a7('0x34')](_0x13d323[_0x61a7('0x31')][_0x61a7('0x34')]));_0x299800['attributes']=_0x299800[_0x61a7('0x32')]['length']?_0x299800[_0x61a7('0x32')]:_0x1d6c8c[_0x61a7('0x2f')];if(!_0x13d323[_0x61a7('0x31')][_0x61a7('0x35')](_0x61a7('0x36'))){_0x299800['limit']=qs[_0x61a7('0x19')](_0x13d323[_0x61a7('0x31')][_0x61a7('0x19')]);_0x299800[_0x61a7('0x18')]=qs[_0x61a7('0x18')](_0x13d323['query'][_0x61a7('0x18')]);}_0x299800[_0x61a7('0x37')]=qs[_0x61a7('0x38')](_0x13d323[_0x61a7('0x31')][_0x61a7('0x38')]);_0x299800[_0x61a7('0x39')]=qs['filters'](_[_0x61a7('0x3a')](_0x13d323[_0x61a7('0x31')],_0x1d6c8c[_0x61a7('0x3b')]),_0x18f2a6);if(_0x13d323['query'][_0x61a7('0x3c')]){_0x299800[_0x61a7('0x39')]=_[_0x61a7('0x3d')](_0x299800['where'],{'$or':_[_0x61a7('0x2a')](_0x18f2a6,function(_0x1a9b29){if(_0x1a9b29[_0x61a7('0x2d')]!==_0x61a7('0x3e')){var _0x1e2c11={};_0x1e2c11[_0x1a9b29[_0x61a7('0x28')]]={'$like':'%'+_0x13d323[_0x61a7('0x31')][_0x61a7('0x3c')]+'%'};return _0x1e2c11;}})});}_0x299800=_['merge']({},_0x299800,_0x13d323[_0x61a7('0x3f')]);var _0x2e2631={'where':_0x299800['where']};return db['CmHopperHistory'][_0x61a7('0x1b')](_0x2e2631)[_0x61a7('0x23')](function(_0x2b8dbf){_0x42fabc['count']=_0x2b8dbf;if(_0x13d323[_0x61a7('0x31')]['includeAll']){_0x299800[_0x61a7('0x40')]=[{'all':!![]}];}return db[_0x61a7('0x41')][_0x61a7('0x42')](_0x299800);})[_0x61a7('0x23')](function(_0x358af4){_0x42fabc[_0x61a7('0x43')]=_0x358af4;return _0x42fabc;})[_0x61a7('0x23')](respondWithFilteredResult(_0x12dca9,_0x299800))['catch'](handleError(_0x12dca9,null));};exports[_0x61a7('0x44')]=function(_0x36feec,_0x199eea){var _0x1d48fd={'raw':!![],'where':{'id':_0x36feec[_0x61a7('0x45')]['id']}},_0x4b1fda={};_0x4b1fda[_0x61a7('0x2f')]=_['keys'](db[_0x61a7('0x41')][_0x61a7('0x2b')]);_0x4b1fda[_0x61a7('0x31')]=_[_0x61a7('0x30')](_0x36feec[_0x61a7('0x31')]);_0x4b1fda[_0x61a7('0x3b')]=_[_0x61a7('0x33')](_0x4b1fda[_0x61a7('0x2f')],_0x4b1fda[_0x61a7('0x31')]);_0x1d48fd[_0x61a7('0x32')]=_[_0x61a7('0x33')](_0x4b1fda['model'],qs['fields'](_0x36feec[_0x61a7('0x31')][_0x61a7('0x34')]));_0x1d48fd[_0x61a7('0x32')]=_0x1d48fd[_0x61a7('0x32')][_0x61a7('0x46')]?_0x1d48fd[_0x61a7('0x32')]:_0x4b1fda[_0x61a7('0x2f')];if(_0x36feec[_0x61a7('0x31')][_0x61a7('0x47')]){_0x1d48fd[_0x61a7('0x40')]=[{'all':!![]}];}_0x1d48fd=_[_0x61a7('0x3d')]({},_0x1d48fd,_0x36feec[_0x61a7('0x3f')]);return db[_0x61a7('0x41')]['find'](_0x1d48fd)[_0x61a7('0x23')](handleEntityNotFound(_0x199eea,null))[_0x61a7('0x23')](respondWithResult(_0x199eea,null))[_0x61a7('0x48')](handleError(_0x199eea,null));};exports['create']=function(_0x1a2f8a,_0x4d78f1){return db[_0x61a7('0x41')][_0x61a7('0x49')](_0x1a2f8a[_0x61a7('0x4a')],{})[_0x61a7('0x23')](respondWithResult(_0x4d78f1,0xc9))[_0x61a7('0x48')](handleError(_0x4d78f1,null));};exports[_0x61a7('0x4b')]=function(_0x1c8b24,_0x118e50){return db['CmHopperHistory'][_0x61a7('0x4b')]()[_0x61a7('0x23')](respondWithResult(_0x118e50,null))[_0x61a7('0x48')](handleError(_0x118e50,null));};exports[_0x61a7('0x22')]=function(_0x2392ae,_0x36f302){if(_0x2392ae[_0x61a7('0x4a')]['uniqueid']){delete _0x2392ae[_0x61a7('0x4a')][_0x61a7('0x4c')];}return db[_0x61a7('0x41')][_0x61a7('0x4d')]({'where':{'uniqueid':_0x2392ae[_0x61a7('0x45')]['id']}})[_0x61a7('0x23')](handleEntityNotFound(_0x36f302,null))[_0x61a7('0x23')](saveUpdates(_0x2392ae[_0x61a7('0x4a')],null))['then'](respondWithResult(_0x36f302,null))['catch'](handleError(_0x36f302,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 96ea8f1..1a7e44a 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 _0x0137=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x370fc9,_0x4b1f71){var _0x21c87a=function(_0x2d2167){while(--_0x2d2167){_0x370fc9['push'](_0x370fc9['shift']());}};_0x21c87a(++_0x4b1f71);}(_0x0137,0x1d8));var _0x7013=function(_0x57d867,_0x2ee50b){_0x57d867=_0x57d867-0x0;var _0x33d270=_0x0137[_0x57d867];return _0x33d270;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('CmHopperHistory',attributes,{'tableName':_0x7013('0xc'),'paranoid':![],'indexes':[{'name':_0x7013('0xd'),'fields':[_0x7013('0xd')]},{'name':'uniqueid','fields':[_0x7013('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xb515,0x1b8));var _0x5b51=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb515[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[{'name':_0x5b51('0xd'),'fields':[_0x5b51('0xd')]},{'name':_0x5b51('0xe'),'fields':[_0x5b51('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 375f94b..305386c 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 _0xe348=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','COUNT','sequelize','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','CmHopperHistory','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null'];(function(_0x19685d,_0x76d4e6){var _0x2a66d9=function(_0x34b8ca){while(--_0x34b8ca){_0x19685d['push'](_0x19685d['shift']());}};_0x2a66d9(++_0x76d4e6);}(_0xe348,0x137));var _0x8e34=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe348[_0xa8883];return _0x479426;};'use strict';var _=require(_0x8e34('0x0'));var util=require(_0x8e34('0x1'));var moment=require('moment');var BPromise=require(_0x8e34('0x2'));var rs=require(_0x8e34('0x3'));var fs=require('fs');var Redis=require(_0x8e34('0x4'));var db=require(_0x8e34('0x5'))['db'];var utils=require(_0x8e34('0x6'));var logger=require(_0x8e34('0x7'))(_0x8e34('0x8'));var config=require('../../config/environment');var jayson=require(_0x8e34('0x9'));var client=jayson[_0x8e34('0xa')][_0x8e34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8565,_0x1a5573,_0x5b4bbe){return new BPromise(function(_0x161e98,_0x41e8a8){return client['request'](_0x4e8565,_0x5b4bbe)[_0x8e34('0xc')](function(_0x3ee4d8){logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,_0x8e34('0xf'));logger[_0x8e34('0x10')](_0x8e34('0x11'),_0x1a5573,_0x8e34('0xf'),JSON[_0x8e34('0x12')](_0x3ee4d8));if(_0x3ee4d8[_0x8e34('0x13')]){if(_0x3ee4d8['error'][_0x8e34('0x14')]===0x1f4){logger[_0x8e34('0x13')](_0x8e34('0xe'),_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x41e8a8(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x161e98(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}else{logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,'request\x20sent');_0x161e98(_0x3ee4d8[_0x8e34('0x16')]['message']);}})[_0x8e34('0x17')](function(_0x1b8ade){logger['error'](_0x8e34('0xe'),_0x1a5573,_0x1b8ade);_0x41e8a8(_0x1b8ade);});});}exports['CreateCmHopperHistory']=function(_0x2f174a){var _0x4a398c=this;return new Promise(function(_0x425ec1,_0x5e9b4c){return db['CmHopperHistory'][_0x8e34('0x18')](_0x2f174a[_0x8e34('0x19')],{'raw':_0x2f174a[_0x8e34('0x1a')]?_0x2f174a[_0x8e34('0x1a')][_0x8e34('0x1b')]===undefined?!![]:![]:!![]})[_0x8e34('0xc')](function(_0x5f5616){logger[_0x8e34('0xd')](_0x8e34('0x1c'),_0x2f174a);logger['debug'](_0x8e34('0x1c'),_0x2f174a,JSON[_0x8e34('0x12')](_0x5f5616));_0x425ec1(_0x5f5616);})[_0x8e34('0x17')](function(_0x1746bf){logger[_0x8e34('0x13')](_0x8e34('0x1c'),_0x1746bf['message'],_0x2f174a);_0x5e9b4c(_0x4a398c[_0x8e34('0x13')](0x1f4,_0x1746bf[_0x8e34('0x15')]));});});};exports[_0x8e34('0x1d')]=function(_0x150472){var _0x42e9f0=this;return new Promise(function(_0x36c1ef,_0x1ef7d1){return db['CmHopperHistory'][_0x8e34('0x1e')]({'raw':_0x150472[_0x8e34('0x1a')]?_0x150472[_0x8e34('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x150472['options']?_0x150472[_0x8e34('0x1a')][_0x8e34('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['col']('id')),_0x8e34('0x22')],[db['sequelize']['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')]['literal'](_0x8e34('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x8e34('0x24')],[db['sequelize']['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x26')))),_0x8e34('0x27')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x8e34('0x25')](_0x8e34('0x29')))),_0x8e34('0x2a')],[db['sequelize']['fn'](_0x8e34('0x28'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x8e34('0x2b')]]})['then'](function(_0x2055cc){logger[_0x8e34('0xd')](_0x8e34('0x1d'),_0x150472);logger[_0x8e34('0x10')](_0x8e34('0x1d'),_0x150472,JSON[_0x8e34('0x12')](_0x2055cc));_0x36c1ef(_0x2055cc);})[_0x8e34('0x17')](function(_0x536d42){logger[_0x8e34('0x13')](_0x8e34('0x1d'),_0x536d42[_0x8e34('0x15')],_0x150472);_0x1ef7d1(_0x42e9f0[_0x8e34('0x13')](0x1f4,_0x536d42[_0x8e34('0x15')]));});});};exports[_0x8e34('0x2c')]=function(_0x1c5284){var _0x2425ef=this;return new Promise(function(_0x499b14,_0x204287){return db[_0x8e34('0x2d')][_0x8e34('0x1e')]({'raw':_0x1c5284[_0x8e34('0x1a')]?_0x1c5284['options'][_0x8e34('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c5284[_0x8e34('0x1a')]?_0x1c5284[_0x8e34('0x1a')][_0x8e34('0x1f')]||null:null,'attributes':[['campaign',_0x8e34('0x2e')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db['sequelize'][_0x8e34('0x25')](_0x8e34('0x2f')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x8e34('0x20'),db['sequelize']['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x30')))),_0x8e34('0x31')],[db[_0x8e34('0x21')]['fn']('COUNT',db[_0x8e34('0x21')]['fn']('IF',db['sequelize'][_0x8e34('0x25')](_0x8e34('0x23')))),_0x8e34('0x32')],[db[_0x8e34('0x21')]['fn']('COUNT',db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x33')))),_0x8e34('0x34')],[db['sequelize']['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x35')))),_0x8e34('0x36')],[db[_0x8e34('0x21')]['fn']('COUNT',db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x37')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x38')))),_0x8e34('0x39')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x3a')))),_0x8e34('0x3b')],[db[_0x8e34('0x21')]['fn']('COUNT',db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0x8e34('0x3c')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db['sequelize']['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x8e34('0x3d')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x3e')))),_0x8e34('0x3f')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')][_0x8e34('0x25')](_0x8e34('0x40')))),'outboundAnswerAgiCallsDay'],[db[_0x8e34('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8e34('0x25')](_0x8e34('0x41')))),'outboundRejectCallsDay'],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db[_0x8e34('0x21')]['literal'](_0x8e34('0x42')))),_0x8e34('0x43')]],'group':[_0x8e34('0x44')]})[_0x8e34('0xc')](function(_0x5bf1fe){logger[_0x8e34('0xd')](_0x8e34('0x2c'),_0x1c5284);logger[_0x8e34('0x10')](_0x8e34('0x2c'),_0x1c5284,JSON['stringify'](_0x5bf1fe));_0x499b14(_0x5bf1fe);})[_0x8e34('0x17')](function(_0x44e28b){logger[_0x8e34('0x13')](_0x8e34('0x2c'),_0x44e28b[_0x8e34('0x15')],_0x1c5284);_0x204287(_0x2425ef[_0x8e34('0x13')](0x1f4,_0x44e28b[_0x8e34('0x15')]));});});};exports[_0x8e34('0x45')]=function(_0x1e0871){var _0xfd3d3a=this;return new Promise(function(_0x3d3b04,_0x3b3423){return db[_0x8e34('0x2d')][_0x8e34('0x1e')]({'raw':_0x1e0871['options']?_0x1e0871[_0x8e34('0x1a')][_0x8e34('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0871[_0x8e34('0x1a')]?_0x1e0871[_0x8e34('0x1a')][_0x8e34('0x1f')]||null:null,'attributes':[['campaign',_0x8e34('0x2e')],[db[_0x8e34('0x21')]['fn']('COUNT',db['sequelize'][_0x8e34('0x46')]('id')),_0x8e34('0x47')],[db[_0x8e34('0x21')]['fn'](_0x8e34('0x20'),db[_0x8e34('0x21')]['fn']('IF',db['sequelize'][_0x8e34('0x25')](_0x8e34('0x23')))),'ivrAnswerCallsDay']],'group':[_0x8e34('0x44')]})[_0x8e34('0xc')](function(_0x198bd7){logger[_0x8e34('0xd')](_0x8e34('0x45'),_0x1e0871);logger['debug'](_0x8e34('0x45'),_0x1e0871,JSON['stringify'](_0x198bd7));_0x3d3b04(_0x198bd7);})[_0x8e34('0x17')](function(_0x5d93af){logger[_0x8e34('0x13')](_0x8e34('0x45'),_0x5d93af[_0x8e34('0x15')],_0x1e0871);_0x3b3423(_0xfd3d3a[_0x8e34('0x13')](0x1f4,_0x5d93af[_0x8e34('0x15')]));});});}; \ No newline at end of file +var _0x0298=['code','message','CreateCmHopperHistory','body','options','catch','AvgHandleTime','CmHopperHistory','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x0298,0x74));var _0x8029=function(_0x323708,_0x4bebf2){_0x323708=_0x323708-0x0;var _0x3da3d7=_0x0298[_0x323708];return _0x3da3d7;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var moment=require('moment');var BPromise=require(_0x8029('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8029('0x3'));var db=require(_0x8029('0x4'))['db'];var utils=require(_0x8029('0x5'));var logger=require(_0x8029('0x6'))(_0x8029('0x7'));var config=require(_0x8029('0x8'));var jayson=require(_0x8029('0x9'));var client=jayson[_0x8029('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd7497e,_0x24ddfa,_0x1ac95a){return new BPromise(function(_0xc61637,_0x29688f){return client[_0x8029('0xb')](_0xd7497e,_0x1ac95a)[_0x8029('0xc')](function(_0x5a0ddc){logger[_0x8029('0xd')](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));logger[_0x8029('0x10')](_0x8029('0x11'),_0x24ddfa,_0x8029('0xf'),JSON[_0x8029('0x12')](_0x5a0ddc));if(_0x5a0ddc[_0x8029('0x13')]){if(_0x5a0ddc['error'][_0x8029('0x14')]===0x1f4){logger[_0x8029('0x13')](_0x8029('0xe'),_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0x29688f(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x24ddfa,_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);return _0xc61637(_0x5a0ddc[_0x8029('0x13')][_0x8029('0x15')]);}else{logger['info'](_0x8029('0xe'),_0x24ddfa,_0x8029('0xf'));_0xc61637(_0x5a0ddc['result'][_0x8029('0x15')]);}})['catch'](function(_0xaa28da){logger[_0x8029('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x24ddfa,_0xaa28da);_0x29688f(_0xaa28da);});});}exports[_0x8029('0x16')]=function(_0x22e136){var _0x4a868f=this;return new Promise(function(_0x4cb6fa,_0x4f9179){return db['CmHopperHistory']['create'](_0x22e136[_0x8029('0x17')],{'raw':_0x22e136[_0x8029('0x18')]?_0x22e136[_0x8029('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8029('0xc')](function(_0x2ad1d1){logger[_0x8029('0xd')]('CreateCmHopperHistory',_0x22e136);logger[_0x8029('0x10')](_0x8029('0x16'),_0x22e136,JSON[_0x8029('0x12')](_0x2ad1d1));_0x4cb6fa(_0x2ad1d1);})[_0x8029('0x19')](function(_0x27b875){logger[_0x8029('0x13')](_0x8029('0x16'),_0x27b875[_0x8029('0x15')],_0x22e136);_0x4f9179(_0x4a868f[_0x8029('0x13')](0x1f4,_0x27b875['message']));});});};exports[_0x8029('0x1a')]=function(_0x2cd286){var _0x34c354=this;return new Promise(function(_0x24d88b,_0x1dceb5){return db[_0x8029('0x1b')]['findAll']({'raw':_0x2cd286['options']?_0x2cd286[_0x8029('0x18')][_0x8029('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cd286['options']?_0x2cd286[_0x8029('0x18')][_0x8029('0x1d')]||null:null,'attributes':[[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')][_0x8029('0x20')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x22')))),_0x8029('0x23')],[db['sequelize']['fn']('COUNT',db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x24')))),_0x8029('0x25')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn']('AVG',db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')]['literal'](_0x8029('0x27')))),_0x8029('0x28')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x29'),db[_0x8029('0x1e')]['fn']('IF',db['sequelize'][_0x8029('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x8029('0x2a')]]})[_0x8029('0xc')](function(_0x5edf8c){logger[_0x8029('0xd')]('AvgHandleTime',_0x2cd286);logger[_0x8029('0x10')]('AvgHandleTime',_0x2cd286,JSON[_0x8029('0x12')](_0x5edf8c));_0x24d88b(_0x5edf8c);})[_0x8029('0x19')](function(_0x436a28){logger['error'](_0x8029('0x1a'),_0x436a28['message'],_0x2cd286);_0x1dceb5(_0x34c354[_0x8029('0x13')](0x1f4,_0x436a28[_0x8029('0x15')]));});});};exports[_0x8029('0x2b')]=function(_0x70f922){var _0x56030d=this;return new Promise(function(_0x5320ea,_0x37c764){return db[_0x8029('0x1b')][_0x8029('0x2c')]({'raw':_0x70f922[_0x8029('0x18')]?_0x70f922[_0x8029('0x18')][_0x8029('0x1c')]===undefined?!![]:![]:!![],'where':_0x70f922[_0x8029('0x18')]?_0x70f922[_0x8029('0x18')][_0x8029('0x1d')]||null:null,'attributes':[[_0x8029('0x2d'),'name'],[db[_0x8029('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8029('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x8029('0x2e')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db['sequelize'][_0x8029('0x21')](_0x8029('0x2f')))),_0x8029('0x30')],[db['sequelize']['fn']('COUNT',db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')]['literal'](_0x8029('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x8029('0x1f'),db['sequelize']['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x8029('0x31')],[db[_0x8029('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x32')))),_0x8029('0x33')],[db[_0x8029('0x1e')]['fn']('COUNT',db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8029('0x34')],[db[_0x8029('0x1e')]['fn']('COUNT',db[_0x8029('0x1e')]['fn']('IF',db['sequelize'][_0x8029('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8029('0x35')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x36')))),_0x8029('0x37')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x38')))),_0x8029('0x39')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x3a')))),'outboundOriginateFailureCallsDay'],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db['sequelize'][_0x8029('0x21')](_0x8029('0x3b')))),_0x8029('0x3c')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')]['literal'](_0x8029('0x3d')))),_0x8029('0x3e')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8029('0x21')](_0x8029('0x3f')))),_0x8029('0x3c')],[db[_0x8029('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x8029('0x2d')]})['then'](function(_0x3c180f){logger['info'](_0x8029('0x2b'),_0x70f922);logger[_0x8029('0x10')](_0x8029('0x2b'),_0x70f922,JSON[_0x8029('0x12')](_0x3c180f));_0x5320ea(_0x3c180f);})[_0x8029('0x19')](function(_0xe7a7d1){logger[_0x8029('0x13')](_0x8029('0x2b'),_0xe7a7d1['message'],_0x70f922);_0x37c764(_0x56030d['error'](0x1f4,_0xe7a7d1['message']));});});};exports['GetCampaignHopperHistory']=function(_0x59a990){var _0x160d2f=this;return new Promise(function(_0x5d1df1,_0x191323){return db['CmHopperHistory'][_0x8029('0x2c')]({'raw':_0x59a990['options']?_0x59a990['options']['raw']===undefined?!![]:![]:!![],'where':_0x59a990[_0x8029('0x18')]?_0x59a990[_0x8029('0x18')][_0x8029('0x1d')]||null:null,'attributes':[[_0x8029('0x2d'),_0x8029('0x40')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db['sequelize'][_0x8029('0x20')]('id')),_0x8029('0x41')],[db[_0x8029('0x1e')]['fn'](_0x8029('0x1f'),db[_0x8029('0x1e')]['fn']('IF',db[_0x8029('0x1e')][_0x8029('0x21')](_0x8029('0x22')))),_0x8029('0x42')]],'group':[_0x8029('0x2d')]})['then'](function(_0x53469b){logger[_0x8029('0xd')]('GetCampaignHopperHistory',_0x59a990);logger[_0x8029('0x10')](_0x8029('0x43'),_0x59a990,JSON[_0x8029('0x12')](_0x53469b));_0x5d1df1(_0x53469b);})['catch'](function(_0x5f1e1b){logger[_0x8029('0x13')](_0x8029('0x43'),_0x5f1e1b[_0x8029('0x15')],_0x59a990);_0x191323(_0x160d2f[_0x8029('0x13')](0x1f4,_0x5f1e1b[_0x8029('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9e052a5..d393984 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 _0xbe84=['create','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x58c6a9,_0x3a0caf){var _0x394f21=function(_0x37ddc2){while(--_0x37ddc2){_0x58c6a9['push'](_0x58c6a9['shift']());}};_0x394f21(++_0x3a0caf);}(_0xbe84,0xed));var _0x4be8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xbe84[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x4be8('0x0'));var util=require('util');var path=require(_0x4be8('0x1'));var timeout=require('connect-timeout');var express=require(_0x4be8('0x2'));var router=express[_0x4be8('0x3')]();var fs_extra=require(_0x4be8('0x4'));var auth=require(_0x4be8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4be8('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x4be8('0x7')]('/',auth[_0x4be8('0x8')](),controller[_0x4be8('0x9')]);router[_0x4be8('0x7')](_0x4be8('0xa'),auth['isAuthenticated'](),controller[_0x4be8('0xb')]);router[_0x4be8('0x7')](_0x4be8('0xc'),auth[_0x4be8('0x8')](),controller[_0x4be8('0xd')]);router[_0x4be8('0xe')]('/',auth[_0x4be8('0x8')](),controller[_0x4be8('0xf')]);router['put'](_0x4be8('0xc'),auth[_0x4be8('0x8')](),controller[_0x4be8('0x10')]);module[_0x4be8('0x11')]=router; \ No newline at end of file +var _0x63e1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports'];(function(_0x8fd558,_0x3b1fc5){var _0x3f82c8=function(_0x27cbcf){while(--_0x27cbcf){_0x8fd558['push'](_0x8fd558['shift']());}};_0x3f82c8(++_0x3b1fc5);}(_0x63e1,0x126));var _0x163e=function(_0x347620,_0x4ec8bd){_0x347620=_0x347620-0x0;var _0x465959=_0x63e1[_0x347620];return _0x465959;};'use strict';var multer=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var path=require(_0x163e('0x2'));var timeout=require(_0x163e('0x3'));var express=require(_0x163e('0x4'));var router=express[_0x163e('0x5')]();var fs_extra=require(_0x163e('0x6'));var auth=require(_0x163e('0x7'));var interaction=require(_0x163e('0x8'));var config=require('../../config/environment');var controller=require(_0x163e('0x9'));router[_0x163e('0xa')]('/',auth[_0x163e('0xb')](),controller['index']);router['get'](_0x163e('0xc'),auth[_0x163e('0xb')](),controller[_0x163e('0xd')]);router[_0x163e('0xa')](_0x163e('0xe'),auth[_0x163e('0xb')](),controller[_0x163e('0xf')]);router[_0x163e('0x10')]('/',auth[_0x163e('0xb')](),controller[_0x163e('0x11')]);router[_0x163e('0x12')](_0x163e('0xe'),auth[_0x163e('0xb')](),controller[_0x163e('0x13')]);module[_0x163e('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f50a38a..2c68334 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 _0x34e8=['sequelize','exports','STRING','name'];(function(_0x33daaa,_0x140943){var _0x372794=function(_0x52a9d9){while(--_0x52a9d9){_0x33daaa['push'](_0x33daaa['shift']());}};_0x372794(++_0x140943);}(_0x34e8,0x12c));var _0x834e=function(_0x43b52f,_0x364fb3){_0x43b52f=_0x43b52f-0x0;var _0x18f5f5=_0x34e8[_0x43b52f];return _0x18f5f5;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x06f4=['name','STRING','sequelize','exports'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x06f4,0x136));var _0x406f=function(_0xbc9e78,_0x27aca5){_0xbc9e78=_0xbc9e78-0x0;var _0x46099a=_0x06f4[_0xbc9e78];return _0x46099a;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x406f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('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 f841f09..ede2e4f 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 _0xa9e0=['set','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','show','params','create','body','role','user','get','Lists','UserProfileSection','find','autoAssociation','describe','ListId','getDispositions','Disposition','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','success','errors','getContacts','CmCustomField','CustomFields','concat','cf_%d','pick','raw','ContactItemType','OrderBy','alias','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','select','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','spread','message','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','./cmList.socket','register','status','offset','undefined','limit','count'];(function(_0x19a2eb,_0x2df439){var _0x3c8514=function(_0x2b6204){while(--_0x2b6204){_0x19a2eb['push'](_0x19a2eb['shift']());}};_0x3c8514(++_0x2df439);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var csv_results;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);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x33161b=_0x197ec0['get']({'plain':!![]});var _0x384319='Lists';return db[_0x0a9e('0x25')]['destroy']({'where':{'type':_0x384319,'resourceId':_0x33161b['id']}})[_0x0a9e('0x23')](function(){return _0x197ec0;});})[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x140511,_0x1538a4){return function(_0x11c3b6){if(!_0x11c3b6){_0x140511[_0x0a9e('0x27')](0x194);}return _0x11c3b6;};}function handleError(_0x5a101a,_0x3652a7){_0x3652a7=_0x3652a7||0x1f4;return function(_0x468813){logger[_0x0a9e('0x28')](_0x468813[_0x0a9e('0x29')]);if(_0x468813['name']){delete _0x468813[_0x0a9e('0x2a')];}_0x5a101a[_0x0a9e('0x1a')](_0x3652a7)[_0x0a9e('0x2b')](_0x468813);};}exports[_0x0a9e('0x2c')]=function(_0x58b06f,_0x563b45){var _0x296f41={},_0x2e8759={},_0x1dbde2={'count':0x0,'rows':[]};var _0x540530=_[_0x0a9e('0x2d')](db['CmList'][_0x0a9e('0x2e')],function(_0x3ae878){return{'name':_0x3ae878[_0x0a9e('0x2f')],'type':_0x3ae878[_0x0a9e('0x30')][_0x0a9e('0x31')]};});_0x2e8759['model']=_[_0x0a9e('0x2d')](_0x540530,_0x0a9e('0x2a'));_0x2e8759[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x58b06f[_0x0a9e('0x32')]);_0x2e8759[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2e8759[_0x0a9e('0x36')],_0x2e8759['query']);_0x296f41[_0x0a9e('0x37')]=_['intersection'](_0x2e8759[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x296f41['attributes']=_0x296f41[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x296f41[_0x0a9e('0x37')]:_0x2e8759[_0x0a9e('0x36')];if(!_0x58b06f['query']['hasOwnProperty'](_0x0a9e('0x3a'))){_0x296f41['limit']=qs[_0x0a9e('0x1d')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x296f41[_0x0a9e('0x1b')]=qs['offset'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x296f41[_0x0a9e('0x3b')]=qs['sort'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x296f41[_0x0a9e('0x3d')]=qs['filters'](_['pick'](_0x58b06f[_0x0a9e('0x32')],_0x2e8759[_0x0a9e('0x34')]),_0x540530);if(_0x58b06f['query'][_0x0a9e('0x3e')]){_0x296f41[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x296f41[_0x0a9e('0x3d')],{'$or':_['map'](_0x540530,function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x30')]!==_0x0a9e('0x40')){var _0x53f3ee={};_0x53f3ee[_0x5a594b[_0x0a9e('0x2a')]]={'$like':'%'+_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x53f3ee;}})});}_0x296f41=_['merge']({},_0x296f41,_0x58b06f[_0x0a9e('0x41')]);var _0x2cfea9={'where':_0x296f41[_0x0a9e('0x3d')]};return db[_0x0a9e('0x42')][_0x0a9e('0x1e')](_0x2cfea9)[_0x0a9e('0x23')](function(_0x2881b3){_0x1dbde2[_0x0a9e('0x1e')]=_0x2881b3;if(_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x296f41[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x42')][_0x0a9e('0x45')](_0x296f41);})[_0x0a9e('0x23')](function(_0x37f6cc){_0x1dbde2['rows']=_0x37f6cc;return _0x1dbde2;})['then'](respondWithFilteredResult(_0x563b45,_0x296f41))[_0x0a9e('0x46')](handleError(_0x563b45,null));};exports[_0x0a9e('0x47')]=function(_0x405c8f,_0x315881){var _0x1a69dd={'raw':![],'where':{'id':_0x405c8f[_0x0a9e('0x48')]['id']}},_0xc9a702={};_0xc9a702[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0xc9a702[_0x0a9e('0x32')]=_['keys'](_0x405c8f[_0x0a9e('0x32')]);_0xc9a702[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],_0xc9a702[_0x0a9e('0x32')]);_0x1a69dd[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],qs['fields'](_0x405c8f[_0x0a9e('0x32')]['fields']));_0x1a69dd[_0x0a9e('0x37')]=_0x1a69dd[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x1a69dd['attributes']:_0xc9a702[_0x0a9e('0x36')];if(_0x405c8f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x1a69dd[_0x0a9e('0x44')]=[{'all':!![]}];}_0x1a69dd=_[_0x0a9e('0x3f')]({},_0x1a69dd,_0x405c8f[_0x0a9e('0x41')]);return db[_0x0a9e('0x42')]['find'](_0x1a69dd)[_0x0a9e('0x23')](handleEntityNotFound(_0x315881,null))[_0x0a9e('0x23')](respondWithResult(_0x315881,null))[_0x0a9e('0x46')](handleError(_0x315881,null));};exports[_0x0a9e('0x49')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x42')][_0x0a9e('0x49')](_0x409789[_0x0a9e('0x4a')],{})['then'](function(_0xe401a){var _0x3fe430=_0x409789['user']['get']({'plain':!![]});if(!_0x3fe430)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fe430[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){var _0x37edaa=_0xe401a[_0x0a9e('0x4d')]({'plain':!![]});var _0x61bb17=_0x0a9e('0x4e');return db[_0x0a9e('0x4f')][_0x0a9e('0x50')]({'where':{'name':_0x61bb17,'userProfileId':_0x3fe430['userProfileId']},'raw':!![]})['then'](function(_0x53975a){if(_0x53975a&&_0x53975a[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x37edaa['name'],'resourceId':_0x37edaa['id'],'type':_0x53975a[_0x0a9e('0x2a')],'sectionId':_0x53975a['id']},{})[_0x0a9e('0x23')](function(){return _0xe401a;});}else{return _0xe401a;}})['catch'](function(_0x5a88da){logger[_0x0a9e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a88da);throw _0x5a88da;});}return _0xe401a;})[_0x0a9e('0x23')](respondWithResult(_0x992c77,0xc9))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x22')]=function(_0x3c20b2,_0x439340){if(_0x3c20b2['body']['id']){delete _0x3c20b2[_0x0a9e('0x4a')]['id'];}return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x3c20b2['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x439340,null))[_0x0a9e('0x23')](saveUpdates(_0x3c20b2['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x439340,null))['catch'](handleError(_0x439340,null));};exports[_0x0a9e('0x24')]=function(_0x523cd2,_0xe22ccc){return db['CmList']['find']({'where':{'id':_0x523cd2['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xe22ccc,null))['then'](removeEntity(_0xe22ccc,null))[_0x0a9e('0x46')](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x52')]=function(_0x3cfd00,_0x19b4df){return db[_0x0a9e('0x42')][_0x0a9e('0x52')]()[_0x0a9e('0x23')](respondWithResult(_0x19b4df,null))[_0x0a9e('0x46')](handleError(_0x19b4df,null));};exports['addDisposition']=function(_0x1c693e,_0x121cef,_0x2642bb){if(_0x1c693e[_0x0a9e('0x4a')]['id']){delete _0x1c693e[_0x0a9e('0x4a')]['id'];}return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x1c693e[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x121cef,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x1c693e['body'][_0x0a9e('0x53')]=_0x3649cc['id'];return db['Disposition']['create'](_0x1c693e['body']);}})[_0x0a9e('0x23')](respondWithResult(_0x121cef,null))['catch'](handleError(_0x121cef,null));};exports[_0x0a9e('0x54')]=function(_0x1fc70e,_0x261adb,_0x7be420){var _0x1cca9f={'raw':![],'where':{}};var _0x26d7db={};var _0x49eed0={'count':0x0,'rows':[]};return db[_0x0a9e('0x42')]['findOne']({'where':{'id':_0x1fc70e[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x261adb,null))[_0x0a9e('0x23')](function(_0x5adf8f){if(_0x5adf8f){_0x26d7db[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2e')]);_0x26d7db['query']=_[_0x0a9e('0x33')](_0x1fc70e[_0x0a9e('0x32')]);_0x26d7db['filters']=_[_0x0a9e('0x35')](_0x26d7db[_0x0a9e('0x36')],_0x26d7db[_0x0a9e('0x32')]);_0x1cca9f[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x26d7db['model'],qs[_0x0a9e('0x38')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x1cca9f['attributes']=_0x1cca9f[_0x0a9e('0x37')]['length']?_0x1cca9f['attributes']:_0x26d7db[_0x0a9e('0x36')];if(!_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x56')](_0x0a9e('0x3a'))){_0x1cca9f[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x1cca9f[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x1cca9f[_0x0a9e('0x3b')]=qs[_0x0a9e('0x3c')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x1cca9f[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_['pick'](_0x1fc70e[_0x0a9e('0x32')],_0x26d7db[_0x0a9e('0x34')]));_0x1cca9f[_0x0a9e('0x3d')]['ListId']=_0x5adf8f['id'];if(_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x1cca9f['where']=_[_0x0a9e('0x3f')](_0x1cca9f[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x1cca9f[_0x0a9e('0x37')],function(_0x13b5c0){var _0x4a43a8={};_0x4a43a8[_0x13b5c0]={'$like':'%'+_0x1fc70e['query']['filter']+'%'};return _0x4a43a8;})});}_0x1cca9f=_[_0x0a9e('0x3f')]({},_0x1cca9f,_0x1fc70e[_0x0a9e('0x41')]);return db[_0x0a9e('0x55')][_0x0a9e('0x1e')]({'where':_0x1cca9f[_0x0a9e('0x3d')]})[_0x0a9e('0x23')](function(_0xeef20){_0x49eed0[_0x0a9e('0x1e')]=_0xeef20;if(_0x1fc70e['query'][_0x0a9e('0x43')]){_0x1cca9f[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x55')]['findAll'](_0x1cca9f);})[_0x0a9e('0x23')](function(_0x583b2e){_0x49eed0[_0x0a9e('0x57')]=_0x583b2e;return _0x49eed0;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x261adb,_0x1cca9f))['catch'](handleError(_0x261adb,null));};exports[_0x0a9e('0x58')]=function(_0x75912a,_0x2cc7a7,_0x317c0c){return db['CmList'][_0x0a9e('0x50')]({'where':{'id':_0x75912a[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2cc7a7,null))[_0x0a9e('0x23')](function(_0x5b7fc3){if(_0x5b7fc3){return _0x5b7fc3[_0x0a9e('0x58')](_0x75912a[_0x0a9e('0x32')][_0x0a9e('0x59')]);}})[_0x0a9e('0x23')](respondWithStatusCode(_0x2cc7a7,null))['catch'](handleError(_0x2cc7a7,null));};exports[_0x0a9e('0x5a')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){return db[_0x0a9e('0x42')][_0x0a9e('0x50')]({'where':{'id':_0x3511c9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x23')](function(_0x336dc3){if(_0x336dc3){var _0xc4c230=[];var _0x1f10ef={'success':[],'errors':[]};return db[_0x0a9e('0x5b')][_0x0a9e('0x52')]()['then'](function(_0xf4120f){if(_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')]&&_['isArray'](_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')])){if(_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')]['length']){_0x3511c9['body'][_0x0a9e('0x5c')]=_0x3511c9[_0x0a9e('0x4a')]['tags'][_0x0a9e('0x5d')](';')+';';}else{_0x3511c9['body'][_0x0a9e('0x5c')]=null;}}else{_0x3511c9[_0x0a9e('0x4a')]['tags']=null;}if(_0x3511c9[_0x0a9e('0x4a')]&&_[_0x0a9e('0x5e')](_0x3511c9[_0x0a9e('0x4a')])){for(var _0x42b959=0x0;_0x42b959<_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x39')];_0x42b959+=0x1){_0x3511c9[_0x0a9e('0x4a')][_0x42b959]['ListId']=_0x3511c9[_0x0a9e('0x48')]['id'];_0xc4c230[_0x0a9e('0x5f')](_0x3511c9[_0x0a9e('0x4a')][_0x42b959]);}return BPromise[_0x0a9e('0x60')](_0xc4c230,function(_0x492543){return db[_0x0a9e('0x5b')][_0x0a9e('0x49')](_['omit'](_0x492543,[_0x0a9e('0x59'),'id'])||{},{'fields':_['keys'](_0xf4120f),'raw':!![]})[_0x0a9e('0x23')](function(_0x2bb25a){_0x1f10ef[_0x0a9e('0x61')][_0x0a9e('0x5f')](_0x2bb25a['dataValues']);})['catch'](function(_0x353384){_0x1f10ef[_0x0a9e('0x62')][_0x0a9e('0x5f')]({'data':_0x492543,'error':_0x353384['message']});});})[_0x0a9e('0x23')](function(_0x36e975){return _0x1f10ef;})['catch'](function(_0x4e46b2){return _0x4e46b2;});}else{_0x30a4c7[_0x0a9e('0x1a')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x46')](handleError(_0x30a4c7,null));};exports[_0x0a9e('0x63')]=function(_0x9044fe,_0x3bfadf,_0x3c6dd6){var _0x2600de;return db['CmList'][_0x0a9e('0x50')]({'where':{'id':_0x9044fe['params']['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':_0x0a9e('0x65')}]})[_0x0a9e('0x23')](handleEntityNotFound(_0x3bfadf,null))[_0x0a9e('0x23')](function(_0x50f8d7){if(_0x50f8d7){_0x2600de=_0x50f8d7;return db[_0x0a9e('0x5b')][_0x0a9e('0x2e')];}})[_0x0a9e('0x23')](function(_0x5b74c3){if(_0x5b74c3){var _0xb6e411={};var _0x21e592={};_0x21e592[_0x0a9e('0x36')]=_[_0x0a9e('0x66')](_[_0x0a9e('0x33')](_0x5b74c3),_[_0x0a9e('0x2d')](_0x2600de[_0x0a9e('0x65')],function(_0x11ac43){return util['format'](_0x0a9e('0x67'),_0x11ac43['id']);}));_0x21e592[_0x0a9e('0x32')]=_['keys'](_0x9044fe[_0x0a9e('0x32')]);_0x21e592[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x21e592['model'],_0x21e592[_0x0a9e('0x32')]);_0xb6e411['attributes']=_[_0x0a9e('0x35')](_0x21e592[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0xb6e411[_0x0a9e('0x37')]=_0xb6e411[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0xb6e411['attributes']:_0x21e592[_0x0a9e('0x36')];if(!_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x56')](_0x0a9e('0x3a'))){_0xb6e411[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0xb6e411[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0xb6e411[_0x0a9e('0x3b')]=qs['sort'](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0xb6e411[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x9044fe['query'],_0x21e592[_0x0a9e('0x34')]));_0xb6e411[_0x0a9e('0x69')]=!![];if(_0x9044fe['query'][_0x0a9e('0x3e')]){_0xb6e411['where']=_[_0x0a9e('0x3f')](_0xb6e411[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0xb6e411[_0x0a9e('0x37')],function(_0x4f4d2d){var _0x3ceba6={};_0x3ceba6[_0x4f4d2d]={'$like':'%'+_0x9044fe['query'][_0x0a9e('0x3e')]+'%'};return _0x3ceba6;})});}_0xb6e411=_[_0x0a9e('0x3f')]({},_0xb6e411,_0x9044fe['options']);return _0x2600de[_0x0a9e('0x63')](_0xb6e411);}})[_0x0a9e('0x23')](respondWithResult(_0x3bfadf,null))[_0x0a9e('0x46')](handleError(_0x3bfadf,null));};exports['getContactsCsv']=function(_0x4c788f,_0x1b82b7,_0x6ba2be){var _0x1707dc;var _0x413190;var _0x3f2f40;var _0x2450a8=_0x4c788f[_0x0a9e('0x48')]['id'];csv_results=[];return db[_0x0a9e('0x6a')][_0x0a9e('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x0a9e('0x6b')]})['then'](function(_0x287324){_0x1707dc=_0x287324;var _0x2f7791=_[_0x0a9e('0x33')](db[_0x0a9e('0x5b')][_0x0a9e('0x2e')]);return db['CmCustomField'][_0x0a9e('0x45')]({'raw':!![],'attributes':['id',_0x0a9e('0x6c')]})[_0x0a9e('0x23')](function(_0x2aa5f2){_0x413190=_0x2aa5f2;var _0x2263f1=squel['select']()['fields'](_0x2f7791)[_0x0a9e('0x6d')]('cm_contacts','c')[_0x0a9e('0x3d')](_0x0a9e('0x6e'),_0x2450a8)[_0x0a9e('0x3d')](_0x0a9e('0x6f'))[_0x0a9e('0x70')]();for(var _0x5c689c=0x0;_0x5c689c<_0x413190['length'];_0x5c689c++){_0x2263f1['field'](_0x0a9e('0x71')+_0x413190[_0x5c689c]['id'],'customField_'+_0x413190[_0x5c689c][_0x0a9e('0x6c')]);}for(var _0x5c689c=0x0;_0x5c689c<_0x1707dc[_0x0a9e('0x39')];_0x5c689c++){_0x2263f1['field'](squel['select']()[_0x0a9e('0x72')](_0x0a9e('0x73'))['from'](_0x0a9e('0x74'))[_0x0a9e('0x3d')](_0x0a9e('0x75'),_0x1707dc[_0x5c689c]['id'])[_0x0a9e('0x3d')](_0x0a9e('0x76')),'additionalPhone_'+_0x1707dc[_0x5c689c]['name']);_0x2263f1[_0x0a9e('0x72')](squel[_0x0a9e('0x77')]()[_0x0a9e('0x72')](_0x0a9e('0x78'))[_0x0a9e('0x6d')]('cm_contact_has_items')[_0x0a9e('0x3d')](_0x0a9e('0x75'),_0x1707dc[_0x5c689c]['id'])['where'](_0x0a9e('0x76')),_0x0a9e('0x79')+_0x1707dc[_0x5c689c][_0x0a9e('0x2a')]);}var _0x2427d5=[];_0x2427d5[_0x0a9e('0x5f')](_0x2263f1[_0x0a9e('0x7a')]());BPromise[_0x0a9e('0x60')](_0x2427d5,handleQuery)[_0x0a9e('0x23')](function(_0x40dd2a){handleQuery(_0x2263f1[_0x0a9e('0x7a')]());var _0x4bdebb=csv_results[0x0];if(!_[_0x0a9e('0x7b')](_0x4bdebb)){var _0x301047=toCsv(_0x4bdebb);var _0x2ada60=Date[_0x0a9e('0x7c')]();fs[_0x0a9e('0x7d')](util['format']('/tmp/list_%d_%s.csv',_0x2450a8,_0x2ada60),_0x301047);_0x1b82b7[_0x0a9e('0x7e')](_0x0a9e('0x7f'),_0x0a9e('0x80')+util[_0x0a9e('0x81')](_0x0a9e('0x82'),_0x2450a8,_0x2ada60));_0x1b82b7['setHeader'](_0x0a9e('0x83'),_0x0a9e('0x84'));return _0x1b82b7[_0x0a9e('0x85')](util['format'](_0x0a9e('0x86'),_0x2450a8,_0x2ada60));}else{return _0x1b82b7['sendStatus'](0xcc);}});});});};exports[_0x0a9e('0x87')]=function(_0x4799d4,_0x25b745,_0x42b833){var _0xe339b1;delete _0x4799d4['body']['id'];return db[_0x0a9e('0x42')]['findOne']({'where':{'id':_0x4799d4[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25b745,null))[_0x0a9e('0x23')](function(_0x6c47cd){if(_0x6c47cd){return db[_0x0a9e('0x88')][_0x0a9e('0x89')](function(_0x4014c7){return db[_0x0a9e('0x64')][_0x0a9e('0x49')](_0x4799d4[_0x0a9e('0x4a')],{'transaction':_0x4014c7})[_0x0a9e('0x23')](function(_0xc876d4){_0xe339b1=_0xc876d4;return _0x6c47cd[_0x0a9e('0x8a')](_0xc876d4,{'transaction':_0x4014c7});})[_0x0a9e('0x23')](function(){var _0x98c62c={'type':db[_0x0a9e('0x8b')]['TEXT'],'transaction':_0x4014c7};switch(_0x4799d4['body'][_0x0a9e('0x30')]){case'text':_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')]['TEXT'];break;case _0x0a9e('0x8c'):_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')][_0x0a9e('0x8d')];break;case'switch':_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')][_0x0a9e('0x8e')];_0x98c62c[_0x0a9e('0x8f')]=![];break;default:}return db['sequelize'][_0x0a9e('0x90')][_0x0a9e('0x91')](_0x0a9e('0x92'),util['format'](_0x0a9e('0x93'),_0xe339b1['id']),_0x98c62c);})[_0x0a9e('0x23')](function(){return _0xe339b1;});});}})[_0x0a9e('0x23')](respondWithResult(_0x25b745,null))['catch'](handleError(_0x25b745,null));};exports[_0x0a9e('0x94')]=function(_0x4394bb,_0x1d9b57,_0x1a7f58){var _0x2394d3={};var _0x555780={};var _0x3211d2;var _0x289e65;return db['CmList'][_0x0a9e('0x95')]({'where':{'id':_0x4394bb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x1d9b57,null))['then'](function(_0x5c3b6f){if(_0x5c3b6f){_0x3211d2=_0x5c3b6f;_0x555780['model']=_[_0x0a9e('0x33')](db[_0x0a9e('0x64')]['rawAttributes']);_0x555780[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4394bb[_0x0a9e('0x32')]);_0x555780['filters']=_[_0x0a9e('0x35')](_0x555780[_0x0a9e('0x36')],_0x555780[_0x0a9e('0x32')]);_0x2394d3[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x555780[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x2394d3['attributes']=_0x2394d3[_0x0a9e('0x37')]['length']?_0x2394d3[_0x0a9e('0x37')]:_0x555780[_0x0a9e('0x36')];_0x2394d3[_0x0a9e('0x3b')]=qs[_0x0a9e('0x3c')](_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x2394d3['where']=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x4394bb[_0x0a9e('0x32')],_0x555780[_0x0a9e('0x34')]));_0x2394d3['where']=_[_0x0a9e('0x3f')](_0x2394d3[_0x0a9e('0x3d')],{'$or':[{'ListId':_0x5c3b6f['id']},{'ListId':null}]});if(_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x2394d3[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x2394d3[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x2394d3[_0x0a9e('0x37')],function(_0x3539b7){var _0x57f0ad={};_0x57f0ad[_0x3539b7]={'$like':'%'+_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x57f0ad;})});}_0x2394d3=_[_0x0a9e('0x3f')]({},_0x2394d3,_0x4394bb[_0x0a9e('0x41')]);return db[_0x0a9e('0x64')][_0x0a9e('0x96')](_0x2394d3);}})[_0x0a9e('0x23')](respondWithResult(_0x1d9b57,null))[_0x0a9e('0x46')](handleError(_0x1d9b57,null));};exports['getGlobalCustomFields']=function(_0x3b581c,_0xd2391){return db[_0x0a9e('0x64')]['findAndCountAll']({'where':{'ListId':null}})[_0x0a9e('0x23')](handleEntityNotFound(_0xd2391,null))[_0x0a9e('0x23')](function(_0xb0af1e){return _0xb0af1e;})[_0x0a9e('0x23')](respondWithResult(_0xd2391,null))[_0x0a9e('0x46')](handleError(_0xd2391,null));};exports[_0x0a9e('0x97')]=function(_0x424f1b,_0x336a19,_0x401601){return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x424f1b[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x336a19,null))[_0x0a9e('0x23')](function(_0x3db98f){if(_0x3db98f){return _0x3db98f[_0x0a9e('0x97')](_0x424f1b[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x98')](_0x424f1b['body'],['ids','id'])||{})['spread'](function(_0x19e4e6){for(var _0x3fa3f2=0x0;_0x3fa3f2<_0x424f1b[_0x0a9e('0x4a')][_0x0a9e('0x59')]['length'];_0x3fa3f2+=0x1){socket[_0x0a9e('0x99')](_0x0a9e('0x9a'),{'UserId':Number(_0x424f1b[_0x0a9e('0x4a')][_0x0a9e('0x59')][_0x3fa3f2]),'CmListId':Number(_0x424f1b[_0x0a9e('0x48')]['id'])});}return _0x19e4e6;});}})['then'](respondWithResult(_0x336a19,null))['catch'](handleError(_0x336a19,null));};exports[_0x0a9e('0x9b')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x42')][_0x0a9e('0x50')]({'where':{'id':_0x33bcb2[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x23')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0x9b')](_0x33bcb2['query'][_0x0a9e('0x59')])[_0x0a9e('0x23')](function(){if(_[_0x0a9e('0x5e')](_0x33bcb2['query']['ids'])){for(var _0x53ef46=0x0;_0x53ef46<_0x33bcb2[_0x0a9e('0x32')][_0x0a9e('0x59')][_0x0a9e('0x39')];_0x53ef46+=0x1){socket[_0x0a9e('0x99')]('userCmList:remove',{'UserId':Number(_0x33bcb2[_0x0a9e('0x32')]['ids'][_0x53ef46]),'CmListId':Number(_0x33bcb2[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x99')](_0x0a9e('0x9c'),{'UserId':Number(_0x33bcb2['query'][_0x0a9e('0x59')]),'CmListId':Number(_0x33bcb2[_0x0a9e('0x48')]['id'])});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x2a293f,null))['catch'](handleError(_0x2a293f,null));};exports[_0x0a9e('0x9d')]=function(_0x4f2594,_0x1b637c,_0x5c57e1){var _0x41b90a={};var _0x57b7d4={};var _0xb14971;var _0x37215d;return db[_0x0a9e('0x42')][_0x0a9e('0x95')]({'where':{'id':_0x4f2594[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x1b637c,null))[_0x0a9e('0x23')](function(_0x5acdc9){if(_0x5acdc9){_0xb14971=_0x5acdc9;_0x57b7d4[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db['User'][_0x0a9e('0x2e')]);_0x57b7d4[_0x0a9e('0x32')]=_['keys'](_0x4f2594[_0x0a9e('0x32')]);_0x57b7d4[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x57b7d4['model'],_0x57b7d4[_0x0a9e('0x32')]);_0x41b90a[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x57b7d4[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x41b90a[_0x0a9e('0x37')]=_0x41b90a[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x41b90a['attributes']:_0x57b7d4[_0x0a9e('0x36')];_0x41b90a['order']=qs[_0x0a9e('0x3c')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x41b90a[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x4f2594['query'],_0x57b7d4[_0x0a9e('0x34')]));if(_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x41b90a['where']=_[_0x0a9e('0x3f')](_0x41b90a[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x41b90a[_0x0a9e('0x37')],function(_0x31e1e0){var _0x1d0a78={};_0x1d0a78[_0x31e1e0]={'$like':'%'+_0x4f2594[_0x0a9e('0x32')]['filter']+'%'};return _0x1d0a78;})});}_0x41b90a=_[_0x0a9e('0x3f')]({},_0x41b90a,_0x4f2594[_0x0a9e('0x41')]);return _0xb14971[_0x0a9e('0x9d')](_0x41b90a);}})[_0x0a9e('0x23')](function(_0x3de77e){if(_0x3de77e){_0x37215d=_0x3de77e[_0x0a9e('0x39')];if(!_0x4f2594[_0x0a9e('0x32')]['hasOwnProperty']('nolimit')){_0x41b90a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x41b90a[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4f2594[_0x0a9e('0x32')]['offset']);}return _0xb14971[_0x0a9e('0x9d')](_0x41b90a);}})[_0x0a9e('0x23')](function(_0x2d8e91){if(_0x2d8e91){return _0x2d8e91?{'count':_0x37215d,'rows':_0x2d8e91}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x1b637c,null))[_0x0a9e('0x46')](handleError(_0x1b637c,null));};function handleQuery(_0x3c6082){logger[_0x0a9e('0x9e')](_0x3c6082);return db['sequelize'][_0x0a9e('0x32')](_0x3c6082)[_0x0a9e('0x9f')](function(_0x231826){csv_results['push'](_0x231826);})[_0x0a9e('0x46')](function(_0x387817){logger[_0x0a9e('0x28')](_0x387817[_0x0a9e('0xa0')]);});} \ No newline at end of file +var _0xa9e0=['set','apply','save','update','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','show','params','create','body','role','user','get','Lists','UserProfileSection','find','autoAssociation','describe','ListId','getDispositions','Disposition','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','success','errors','getContacts','CmCustomField','CustomFields','concat','cf_%d','pick','raw','ContactItemType','OrderBy','alias','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','select','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','spread','message','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','./cmList.socket','register','status','offset','undefined','limit','count'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var csv_results;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);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=typeof _0x5a0a06[_0x0a9e('0x1b')]===_0x0a9e('0x1c')&&typeof _0x5a0a06[_0x0a9e('0x1d')]===_0x0a9e('0x1c');var _0x530eb7=_0x459eb1[_0x0a9e('0x1e')];var _0x1314ae=_0x478723?0x0:_0x5a0a06[_0x0a9e('0x1b')];var _0x1c696a=_0x478723?_0x459eb1[_0x0a9e('0x1e')]:_0x5a0a06['offset']+_0x5a0a06[_0x0a9e('0x1d')];var _0x155cce;if(_0x1c696a>=_0x530eb7){_0x1c696a=_0x530eb7;_0x155cce=0xc8;}else{_0x155cce=0xce;}_0x225616['status'](_0x155cce);return _0x225616[_0x0a9e('0x1f')]('Content-Range',_0x1314ae+'-'+_0x1c696a+'/'+_0x530eb7)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x3a02e1){return function(_0x432e56){try{jsonpatch[_0x0a9e('0x20')](_0x432e56,_0x3a02e1,!![]);}catch(_0x30bae6){return BPromise['reject'](_0x30bae6);}return _0x432e56[_0x0a9e('0x21')]();};}function saveUpdates(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x22')](_0x2fb0e4)[_0x0a9e('0x23')](function(_0x16b1ca){return _0x16b1ca;});}return null;};}function removeEntity(_0x5ea472,_0x59181e){return function(_0x197ec0){if(_0x197ec0){return _0x197ec0[_0x0a9e('0x24')]()[_0x0a9e('0x23')](function(){var _0x33161b=_0x197ec0['get']({'plain':!![]});var _0x384319='Lists';return db[_0x0a9e('0x25')]['destroy']({'where':{'type':_0x384319,'resourceId':_0x33161b['id']}})[_0x0a9e('0x23')](function(){return _0x197ec0;});})[_0x0a9e('0x23')](function(){_0x5ea472[_0x0a9e('0x1a')](0xcc)[_0x0a9e('0x26')]();});}};}function handleEntityNotFound(_0x140511,_0x1538a4){return function(_0x11c3b6){if(!_0x11c3b6){_0x140511[_0x0a9e('0x27')](0x194);}return _0x11c3b6;};}function handleError(_0x5a101a,_0x3652a7){_0x3652a7=_0x3652a7||0x1f4;return function(_0x468813){logger[_0x0a9e('0x28')](_0x468813[_0x0a9e('0x29')]);if(_0x468813['name']){delete _0x468813[_0x0a9e('0x2a')];}_0x5a101a[_0x0a9e('0x1a')](_0x3652a7)[_0x0a9e('0x2b')](_0x468813);};}exports[_0x0a9e('0x2c')]=function(_0x58b06f,_0x563b45){var _0x296f41={},_0x2e8759={},_0x1dbde2={'count':0x0,'rows':[]};var _0x540530=_[_0x0a9e('0x2d')](db['CmList'][_0x0a9e('0x2e')],function(_0x3ae878){return{'name':_0x3ae878[_0x0a9e('0x2f')],'type':_0x3ae878[_0x0a9e('0x30')][_0x0a9e('0x31')]};});_0x2e8759['model']=_[_0x0a9e('0x2d')](_0x540530,_0x0a9e('0x2a'));_0x2e8759[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x58b06f[_0x0a9e('0x32')]);_0x2e8759[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2e8759[_0x0a9e('0x36')],_0x2e8759['query']);_0x296f41[_0x0a9e('0x37')]=_['intersection'](_0x2e8759[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x296f41['attributes']=_0x296f41[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x296f41[_0x0a9e('0x37')]:_0x2e8759[_0x0a9e('0x36')];if(!_0x58b06f['query']['hasOwnProperty'](_0x0a9e('0x3a'))){_0x296f41['limit']=qs[_0x0a9e('0x1d')](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x296f41[_0x0a9e('0x1b')]=qs['offset'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x296f41[_0x0a9e('0x3b')]=qs['sort'](_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x296f41[_0x0a9e('0x3d')]=qs['filters'](_['pick'](_0x58b06f[_0x0a9e('0x32')],_0x2e8759[_0x0a9e('0x34')]),_0x540530);if(_0x58b06f['query'][_0x0a9e('0x3e')]){_0x296f41[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x296f41[_0x0a9e('0x3d')],{'$or':_['map'](_0x540530,function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x30')]!==_0x0a9e('0x40')){var _0x53f3ee={};_0x53f3ee[_0x5a594b[_0x0a9e('0x2a')]]={'$like':'%'+_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x53f3ee;}})});}_0x296f41=_['merge']({},_0x296f41,_0x58b06f[_0x0a9e('0x41')]);var _0x2cfea9={'where':_0x296f41[_0x0a9e('0x3d')]};return db[_0x0a9e('0x42')][_0x0a9e('0x1e')](_0x2cfea9)[_0x0a9e('0x23')](function(_0x2881b3){_0x1dbde2[_0x0a9e('0x1e')]=_0x2881b3;if(_0x58b06f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x296f41[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x42')][_0x0a9e('0x45')](_0x296f41);})[_0x0a9e('0x23')](function(_0x37f6cc){_0x1dbde2['rows']=_0x37f6cc;return _0x1dbde2;})['then'](respondWithFilteredResult(_0x563b45,_0x296f41))[_0x0a9e('0x46')](handleError(_0x563b45,null));};exports[_0x0a9e('0x47')]=function(_0x405c8f,_0x315881){var _0x1a69dd={'raw':![],'where':{'id':_0x405c8f[_0x0a9e('0x48')]['id']}},_0xc9a702={};_0xc9a702[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x42')][_0x0a9e('0x2e')]);_0xc9a702[_0x0a9e('0x32')]=_['keys'](_0x405c8f[_0x0a9e('0x32')]);_0xc9a702[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],_0xc9a702[_0x0a9e('0x32')]);_0x1a69dd[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0xc9a702[_0x0a9e('0x36')],qs['fields'](_0x405c8f[_0x0a9e('0x32')]['fields']));_0x1a69dd[_0x0a9e('0x37')]=_0x1a69dd[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x1a69dd['attributes']:_0xc9a702[_0x0a9e('0x36')];if(_0x405c8f[_0x0a9e('0x32')][_0x0a9e('0x43')]){_0x1a69dd[_0x0a9e('0x44')]=[{'all':!![]}];}_0x1a69dd=_[_0x0a9e('0x3f')]({},_0x1a69dd,_0x405c8f[_0x0a9e('0x41')]);return db[_0x0a9e('0x42')]['find'](_0x1a69dd)[_0x0a9e('0x23')](handleEntityNotFound(_0x315881,null))[_0x0a9e('0x23')](respondWithResult(_0x315881,null))[_0x0a9e('0x46')](handleError(_0x315881,null));};exports[_0x0a9e('0x49')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x42')][_0x0a9e('0x49')](_0x409789[_0x0a9e('0x4a')],{})['then'](function(_0xe401a){var _0x3fe430=_0x409789['user']['get']({'plain':!![]});if(!_0x3fe430)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fe430[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){var _0x37edaa=_0xe401a[_0x0a9e('0x4d')]({'plain':!![]});var _0x61bb17=_0x0a9e('0x4e');return db[_0x0a9e('0x4f')][_0x0a9e('0x50')]({'where':{'name':_0x61bb17,'userProfileId':_0x3fe430['userProfileId']},'raw':!![]})['then'](function(_0x53975a){if(_0x53975a&&_0x53975a[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x49')]({'name':_0x37edaa['name'],'resourceId':_0x37edaa['id'],'type':_0x53975a[_0x0a9e('0x2a')],'sectionId':_0x53975a['id']},{})[_0x0a9e('0x23')](function(){return _0xe401a;});}else{return _0xe401a;}})['catch'](function(_0x5a88da){logger[_0x0a9e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a88da);throw _0x5a88da;});}return _0xe401a;})[_0x0a9e('0x23')](respondWithResult(_0x992c77,0xc9))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x22')]=function(_0x3c20b2,_0x439340){if(_0x3c20b2['body']['id']){delete _0x3c20b2[_0x0a9e('0x4a')]['id'];}return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x3c20b2['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x439340,null))[_0x0a9e('0x23')](saveUpdates(_0x3c20b2['body'],null))[_0x0a9e('0x23')](respondWithResult(_0x439340,null))['catch'](handleError(_0x439340,null));};exports[_0x0a9e('0x24')]=function(_0x523cd2,_0xe22ccc){return db['CmList']['find']({'where':{'id':_0x523cd2['params']['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0xe22ccc,null))['then'](removeEntity(_0xe22ccc,null))[_0x0a9e('0x46')](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x52')]=function(_0x3cfd00,_0x19b4df){return db[_0x0a9e('0x42')][_0x0a9e('0x52')]()[_0x0a9e('0x23')](respondWithResult(_0x19b4df,null))[_0x0a9e('0x46')](handleError(_0x19b4df,null));};exports['addDisposition']=function(_0x1c693e,_0x121cef,_0x2642bb){if(_0x1c693e[_0x0a9e('0x4a')]['id']){delete _0x1c693e[_0x0a9e('0x4a')]['id'];}return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x1c693e[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x121cef,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x1c693e['body'][_0x0a9e('0x53')]=_0x3649cc['id'];return db['Disposition']['create'](_0x1c693e['body']);}})[_0x0a9e('0x23')](respondWithResult(_0x121cef,null))['catch'](handleError(_0x121cef,null));};exports[_0x0a9e('0x54')]=function(_0x1fc70e,_0x261adb,_0x7be420){var _0x1cca9f={'raw':![],'where':{}};var _0x26d7db={};var _0x49eed0={'count':0x0,'rows':[]};return db[_0x0a9e('0x42')]['findOne']({'where':{'id':_0x1fc70e[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x261adb,null))[_0x0a9e('0x23')](function(_0x5adf8f){if(_0x5adf8f){_0x26d7db[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2e')]);_0x26d7db['query']=_[_0x0a9e('0x33')](_0x1fc70e[_0x0a9e('0x32')]);_0x26d7db['filters']=_[_0x0a9e('0x35')](_0x26d7db[_0x0a9e('0x36')],_0x26d7db[_0x0a9e('0x32')]);_0x1cca9f[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x26d7db['model'],qs[_0x0a9e('0x38')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x1cca9f['attributes']=_0x1cca9f[_0x0a9e('0x37')]['length']?_0x1cca9f['attributes']:_0x26d7db[_0x0a9e('0x36')];if(!_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x56')](_0x0a9e('0x3a'))){_0x1cca9f[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x1cca9f[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0x1cca9f[_0x0a9e('0x3b')]=qs[_0x0a9e('0x3c')](_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x1cca9f[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_['pick'](_0x1fc70e[_0x0a9e('0x32')],_0x26d7db[_0x0a9e('0x34')]));_0x1cca9f[_0x0a9e('0x3d')]['ListId']=_0x5adf8f['id'];if(_0x1fc70e[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x1cca9f['where']=_[_0x0a9e('0x3f')](_0x1cca9f[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x1cca9f[_0x0a9e('0x37')],function(_0x13b5c0){var _0x4a43a8={};_0x4a43a8[_0x13b5c0]={'$like':'%'+_0x1fc70e['query']['filter']+'%'};return _0x4a43a8;})});}_0x1cca9f=_[_0x0a9e('0x3f')]({},_0x1cca9f,_0x1fc70e[_0x0a9e('0x41')]);return db[_0x0a9e('0x55')][_0x0a9e('0x1e')]({'where':_0x1cca9f[_0x0a9e('0x3d')]})[_0x0a9e('0x23')](function(_0xeef20){_0x49eed0[_0x0a9e('0x1e')]=_0xeef20;if(_0x1fc70e['query'][_0x0a9e('0x43')]){_0x1cca9f[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x55')]['findAll'](_0x1cca9f);})[_0x0a9e('0x23')](function(_0x583b2e){_0x49eed0[_0x0a9e('0x57')]=_0x583b2e;return _0x49eed0;});}})[_0x0a9e('0x23')](respondWithFilteredResult(_0x261adb,_0x1cca9f))['catch'](handleError(_0x261adb,null));};exports[_0x0a9e('0x58')]=function(_0x75912a,_0x2cc7a7,_0x317c0c){return db['CmList'][_0x0a9e('0x50')]({'where':{'id':_0x75912a[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x2cc7a7,null))[_0x0a9e('0x23')](function(_0x5b7fc3){if(_0x5b7fc3){return _0x5b7fc3[_0x0a9e('0x58')](_0x75912a[_0x0a9e('0x32')][_0x0a9e('0x59')]);}})[_0x0a9e('0x23')](respondWithStatusCode(_0x2cc7a7,null))['catch'](handleError(_0x2cc7a7,null));};exports[_0x0a9e('0x5a')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){return db[_0x0a9e('0x42')][_0x0a9e('0x50')]({'where':{'id':_0x3511c9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x23')](function(_0x336dc3){if(_0x336dc3){var _0xc4c230=[];var _0x1f10ef={'success':[],'errors':[]};return db[_0x0a9e('0x5b')][_0x0a9e('0x52')]()['then'](function(_0xf4120f){if(_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')]&&_['isArray'](_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')])){if(_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x5c')]['length']){_0x3511c9['body'][_0x0a9e('0x5c')]=_0x3511c9[_0x0a9e('0x4a')]['tags'][_0x0a9e('0x5d')](';')+';';}else{_0x3511c9['body'][_0x0a9e('0x5c')]=null;}}else{_0x3511c9[_0x0a9e('0x4a')]['tags']=null;}if(_0x3511c9[_0x0a9e('0x4a')]&&_[_0x0a9e('0x5e')](_0x3511c9[_0x0a9e('0x4a')])){for(var _0x42b959=0x0;_0x42b959<_0x3511c9[_0x0a9e('0x4a')][_0x0a9e('0x39')];_0x42b959+=0x1){_0x3511c9[_0x0a9e('0x4a')][_0x42b959]['ListId']=_0x3511c9[_0x0a9e('0x48')]['id'];_0xc4c230[_0x0a9e('0x5f')](_0x3511c9[_0x0a9e('0x4a')][_0x42b959]);}return BPromise[_0x0a9e('0x60')](_0xc4c230,function(_0x492543){return db[_0x0a9e('0x5b')][_0x0a9e('0x49')](_['omit'](_0x492543,[_0x0a9e('0x59'),'id'])||{},{'fields':_['keys'](_0xf4120f),'raw':!![]})[_0x0a9e('0x23')](function(_0x2bb25a){_0x1f10ef[_0x0a9e('0x61')][_0x0a9e('0x5f')](_0x2bb25a['dataValues']);})['catch'](function(_0x353384){_0x1f10ef[_0x0a9e('0x62')][_0x0a9e('0x5f')]({'data':_0x492543,'error':_0x353384['message']});});})[_0x0a9e('0x23')](function(_0x36e975){return _0x1f10ef;})['catch'](function(_0x4e46b2){return _0x4e46b2;});}else{_0x30a4c7[_0x0a9e('0x1a')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x46')](handleError(_0x30a4c7,null));};exports[_0x0a9e('0x63')]=function(_0x9044fe,_0x3bfadf,_0x3c6dd6){var _0x2600de;return db['CmList'][_0x0a9e('0x50')]({'where':{'id':_0x9044fe['params']['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':_0x0a9e('0x65')}]})[_0x0a9e('0x23')](handleEntityNotFound(_0x3bfadf,null))[_0x0a9e('0x23')](function(_0x50f8d7){if(_0x50f8d7){_0x2600de=_0x50f8d7;return db[_0x0a9e('0x5b')][_0x0a9e('0x2e')];}})[_0x0a9e('0x23')](function(_0x5b74c3){if(_0x5b74c3){var _0xb6e411={};var _0x21e592={};_0x21e592[_0x0a9e('0x36')]=_[_0x0a9e('0x66')](_[_0x0a9e('0x33')](_0x5b74c3),_[_0x0a9e('0x2d')](_0x2600de[_0x0a9e('0x65')],function(_0x11ac43){return util['format'](_0x0a9e('0x67'),_0x11ac43['id']);}));_0x21e592[_0x0a9e('0x32')]=_['keys'](_0x9044fe[_0x0a9e('0x32')]);_0x21e592[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x21e592['model'],_0x21e592[_0x0a9e('0x32')]);_0xb6e411['attributes']=_[_0x0a9e('0x35')](_0x21e592[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0xb6e411[_0x0a9e('0x37')]=_0xb6e411[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0xb6e411['attributes']:_0x21e592[_0x0a9e('0x36')];if(!_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x56')](_0x0a9e('0x3a'))){_0xb6e411[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0xb6e411[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x1b')]);}_0xb6e411[_0x0a9e('0x3b')]=qs['sort'](_0x9044fe[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0xb6e411[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x9044fe['query'],_0x21e592[_0x0a9e('0x34')]));_0xb6e411[_0x0a9e('0x69')]=!![];if(_0x9044fe['query'][_0x0a9e('0x3e')]){_0xb6e411['where']=_[_0x0a9e('0x3f')](_0xb6e411[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0xb6e411[_0x0a9e('0x37')],function(_0x4f4d2d){var _0x3ceba6={};_0x3ceba6[_0x4f4d2d]={'$like':'%'+_0x9044fe['query'][_0x0a9e('0x3e')]+'%'};return _0x3ceba6;})});}_0xb6e411=_[_0x0a9e('0x3f')]({},_0xb6e411,_0x9044fe['options']);return _0x2600de[_0x0a9e('0x63')](_0xb6e411);}})[_0x0a9e('0x23')](respondWithResult(_0x3bfadf,null))[_0x0a9e('0x46')](handleError(_0x3bfadf,null));};exports['getContactsCsv']=function(_0x4c788f,_0x1b82b7,_0x6ba2be){var _0x1707dc;var _0x413190;var _0x3f2f40;var _0x2450a8=_0x4c788f[_0x0a9e('0x48')]['id'];csv_results=[];return db[_0x0a9e('0x6a')][_0x0a9e('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x0a9e('0x6b')]})['then'](function(_0x287324){_0x1707dc=_0x287324;var _0x2f7791=_[_0x0a9e('0x33')](db[_0x0a9e('0x5b')][_0x0a9e('0x2e')]);return db['CmCustomField'][_0x0a9e('0x45')]({'raw':!![],'attributes':['id',_0x0a9e('0x6c')]})[_0x0a9e('0x23')](function(_0x2aa5f2){_0x413190=_0x2aa5f2;var _0x2263f1=squel['select']()['fields'](_0x2f7791)[_0x0a9e('0x6d')]('cm_contacts','c')[_0x0a9e('0x3d')](_0x0a9e('0x6e'),_0x2450a8)[_0x0a9e('0x3d')](_0x0a9e('0x6f'))[_0x0a9e('0x70')]();for(var _0x5c689c=0x0;_0x5c689c<_0x413190['length'];_0x5c689c++){_0x2263f1['field'](_0x0a9e('0x71')+_0x413190[_0x5c689c]['id'],'customField_'+_0x413190[_0x5c689c][_0x0a9e('0x6c')]);}for(var _0x5c689c=0x0;_0x5c689c<_0x1707dc[_0x0a9e('0x39')];_0x5c689c++){_0x2263f1['field'](squel['select']()[_0x0a9e('0x72')](_0x0a9e('0x73'))['from'](_0x0a9e('0x74'))[_0x0a9e('0x3d')](_0x0a9e('0x75'),_0x1707dc[_0x5c689c]['id'])[_0x0a9e('0x3d')](_0x0a9e('0x76')),'additionalPhone_'+_0x1707dc[_0x5c689c]['name']);_0x2263f1[_0x0a9e('0x72')](squel[_0x0a9e('0x77')]()[_0x0a9e('0x72')](_0x0a9e('0x78'))[_0x0a9e('0x6d')]('cm_contact_has_items')[_0x0a9e('0x3d')](_0x0a9e('0x75'),_0x1707dc[_0x5c689c]['id'])['where'](_0x0a9e('0x76')),_0x0a9e('0x79')+_0x1707dc[_0x5c689c][_0x0a9e('0x2a')]);}var _0x2427d5=[];_0x2427d5[_0x0a9e('0x5f')](_0x2263f1[_0x0a9e('0x7a')]());BPromise[_0x0a9e('0x60')](_0x2427d5,handleQuery)[_0x0a9e('0x23')](function(_0x40dd2a){handleQuery(_0x2263f1[_0x0a9e('0x7a')]());var _0x4bdebb=csv_results[0x0];if(!_[_0x0a9e('0x7b')](_0x4bdebb)){var _0x301047=toCsv(_0x4bdebb);var _0x2ada60=Date[_0x0a9e('0x7c')]();fs[_0x0a9e('0x7d')](util['format']('/tmp/list_%d_%s.csv',_0x2450a8,_0x2ada60),_0x301047);_0x1b82b7[_0x0a9e('0x7e')](_0x0a9e('0x7f'),_0x0a9e('0x80')+util[_0x0a9e('0x81')](_0x0a9e('0x82'),_0x2450a8,_0x2ada60));_0x1b82b7['setHeader'](_0x0a9e('0x83'),_0x0a9e('0x84'));return _0x1b82b7[_0x0a9e('0x85')](util['format'](_0x0a9e('0x86'),_0x2450a8,_0x2ada60));}else{return _0x1b82b7['sendStatus'](0xcc);}});});});};exports[_0x0a9e('0x87')]=function(_0x4799d4,_0x25b745,_0x42b833){var _0xe339b1;delete _0x4799d4['body']['id'];return db[_0x0a9e('0x42')]['findOne']({'where':{'id':_0x4799d4[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x25b745,null))[_0x0a9e('0x23')](function(_0x6c47cd){if(_0x6c47cd){return db[_0x0a9e('0x88')][_0x0a9e('0x89')](function(_0x4014c7){return db[_0x0a9e('0x64')][_0x0a9e('0x49')](_0x4799d4[_0x0a9e('0x4a')],{'transaction':_0x4014c7})[_0x0a9e('0x23')](function(_0xc876d4){_0xe339b1=_0xc876d4;return _0x6c47cd[_0x0a9e('0x8a')](_0xc876d4,{'transaction':_0x4014c7});})[_0x0a9e('0x23')](function(){var _0x98c62c={'type':db[_0x0a9e('0x8b')]['TEXT'],'transaction':_0x4014c7};switch(_0x4799d4['body'][_0x0a9e('0x30')]){case'text':_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')]['TEXT'];break;case _0x0a9e('0x8c'):_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')][_0x0a9e('0x8d')];break;case'switch':_0x98c62c[_0x0a9e('0x30')]=db[_0x0a9e('0x8b')][_0x0a9e('0x8e')];_0x98c62c[_0x0a9e('0x8f')]=![];break;default:}return db['sequelize'][_0x0a9e('0x90')][_0x0a9e('0x91')](_0x0a9e('0x92'),util['format'](_0x0a9e('0x93'),_0xe339b1['id']),_0x98c62c);})[_0x0a9e('0x23')](function(){return _0xe339b1;});});}})[_0x0a9e('0x23')](respondWithResult(_0x25b745,null))['catch'](handleError(_0x25b745,null));};exports[_0x0a9e('0x94')]=function(_0x4394bb,_0x1d9b57,_0x1a7f58){var _0x2394d3={};var _0x555780={};var _0x3211d2;var _0x289e65;return db['CmList'][_0x0a9e('0x95')]({'where':{'id':_0x4394bb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x1d9b57,null))['then'](function(_0x5c3b6f){if(_0x5c3b6f){_0x3211d2=_0x5c3b6f;_0x555780['model']=_[_0x0a9e('0x33')](db[_0x0a9e('0x64')]['rawAttributes']);_0x555780[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4394bb[_0x0a9e('0x32')]);_0x555780['filters']=_[_0x0a9e('0x35')](_0x555780[_0x0a9e('0x36')],_0x555780[_0x0a9e('0x32')]);_0x2394d3[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x555780[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x2394d3['attributes']=_0x2394d3[_0x0a9e('0x37')]['length']?_0x2394d3[_0x0a9e('0x37')]:_0x555780[_0x0a9e('0x36')];_0x2394d3[_0x0a9e('0x3b')]=qs[_0x0a9e('0x3c')](_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x2394d3['where']=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x4394bb[_0x0a9e('0x32')],_0x555780[_0x0a9e('0x34')]));_0x2394d3['where']=_[_0x0a9e('0x3f')](_0x2394d3[_0x0a9e('0x3d')],{'$or':[{'ListId':_0x5c3b6f['id']},{'ListId':null}]});if(_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x2394d3[_0x0a9e('0x3d')]=_[_0x0a9e('0x3f')](_0x2394d3[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x2394d3[_0x0a9e('0x37')],function(_0x3539b7){var _0x57f0ad={};_0x57f0ad[_0x3539b7]={'$like':'%'+_0x4394bb[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x57f0ad;})});}_0x2394d3=_[_0x0a9e('0x3f')]({},_0x2394d3,_0x4394bb[_0x0a9e('0x41')]);return db[_0x0a9e('0x64')][_0x0a9e('0x96')](_0x2394d3);}})[_0x0a9e('0x23')](respondWithResult(_0x1d9b57,null))[_0x0a9e('0x46')](handleError(_0x1d9b57,null));};exports['getGlobalCustomFields']=function(_0x3b581c,_0xd2391){return db[_0x0a9e('0x64')]['findAndCountAll']({'where':{'ListId':null}})[_0x0a9e('0x23')](handleEntityNotFound(_0xd2391,null))[_0x0a9e('0x23')](function(_0xb0af1e){return _0xb0af1e;})[_0x0a9e('0x23')](respondWithResult(_0xd2391,null))[_0x0a9e('0x46')](handleError(_0xd2391,null));};exports[_0x0a9e('0x97')]=function(_0x424f1b,_0x336a19,_0x401601){return db[_0x0a9e('0x42')]['find']({'where':{'id':_0x424f1b[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x336a19,null))[_0x0a9e('0x23')](function(_0x3db98f){if(_0x3db98f){return _0x3db98f[_0x0a9e('0x97')](_0x424f1b[_0x0a9e('0x4a')]['ids'],_[_0x0a9e('0x98')](_0x424f1b['body'],['ids','id'])||{})['spread'](function(_0x19e4e6){for(var _0x3fa3f2=0x0;_0x3fa3f2<_0x424f1b[_0x0a9e('0x4a')][_0x0a9e('0x59')]['length'];_0x3fa3f2+=0x1){socket[_0x0a9e('0x99')](_0x0a9e('0x9a'),{'UserId':Number(_0x424f1b[_0x0a9e('0x4a')][_0x0a9e('0x59')][_0x3fa3f2]),'CmListId':Number(_0x424f1b[_0x0a9e('0x48')]['id'])});}return _0x19e4e6;});}})['then'](respondWithResult(_0x336a19,null))['catch'](handleError(_0x336a19,null));};exports[_0x0a9e('0x9b')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x42')][_0x0a9e('0x50')]({'where':{'id':_0x33bcb2[_0x0a9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x23')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0x9b')](_0x33bcb2['query'][_0x0a9e('0x59')])[_0x0a9e('0x23')](function(){if(_[_0x0a9e('0x5e')](_0x33bcb2['query']['ids'])){for(var _0x53ef46=0x0;_0x53ef46<_0x33bcb2[_0x0a9e('0x32')][_0x0a9e('0x59')][_0x0a9e('0x39')];_0x53ef46+=0x1){socket[_0x0a9e('0x99')]('userCmList:remove',{'UserId':Number(_0x33bcb2[_0x0a9e('0x32')]['ids'][_0x53ef46]),'CmListId':Number(_0x33bcb2[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x99')](_0x0a9e('0x9c'),{'UserId':Number(_0x33bcb2['query'][_0x0a9e('0x59')]),'CmListId':Number(_0x33bcb2[_0x0a9e('0x48')]['id'])});}});}})[_0x0a9e('0x23')](respondWithStatusCode(_0x2a293f,null))['catch'](handleError(_0x2a293f,null));};exports[_0x0a9e('0x9d')]=function(_0x4f2594,_0x1b637c,_0x5c57e1){var _0x41b90a={};var _0x57b7d4={};var _0xb14971;var _0x37215d;return db[_0x0a9e('0x42')][_0x0a9e('0x95')]({'where':{'id':_0x4f2594[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x23')](handleEntityNotFound(_0x1b637c,null))[_0x0a9e('0x23')](function(_0x5acdc9){if(_0x5acdc9){_0xb14971=_0x5acdc9;_0x57b7d4[_0x0a9e('0x36')]=_[_0x0a9e('0x33')](db['User'][_0x0a9e('0x2e')]);_0x57b7d4[_0x0a9e('0x32')]=_['keys'](_0x4f2594[_0x0a9e('0x32')]);_0x57b7d4[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x57b7d4['model'],_0x57b7d4[_0x0a9e('0x32')]);_0x41b90a[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](_0x57b7d4[_0x0a9e('0x36')],qs[_0x0a9e('0x38')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x38')]));_0x41b90a[_0x0a9e('0x37')]=_0x41b90a[_0x0a9e('0x37')][_0x0a9e('0x39')]?_0x41b90a['attributes']:_0x57b7d4[_0x0a9e('0x36')];_0x41b90a['order']=qs[_0x0a9e('0x3c')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x3c')]);_0x41b90a[_0x0a9e('0x3d')]=qs[_0x0a9e('0x34')](_[_0x0a9e('0x68')](_0x4f2594['query'],_0x57b7d4[_0x0a9e('0x34')]));if(_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x41b90a['where']=_[_0x0a9e('0x3f')](_0x41b90a[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x2d')](_0x41b90a[_0x0a9e('0x37')],function(_0x31e1e0){var _0x1d0a78={};_0x1d0a78[_0x31e1e0]={'$like':'%'+_0x4f2594[_0x0a9e('0x32')]['filter']+'%'};return _0x1d0a78;})});}_0x41b90a=_[_0x0a9e('0x3f')]({},_0x41b90a,_0x4f2594[_0x0a9e('0x41')]);return _0xb14971[_0x0a9e('0x9d')](_0x41b90a);}})[_0x0a9e('0x23')](function(_0x3de77e){if(_0x3de77e){_0x37215d=_0x3de77e[_0x0a9e('0x39')];if(!_0x4f2594[_0x0a9e('0x32')]['hasOwnProperty']('nolimit')){_0x41b90a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x4f2594[_0x0a9e('0x32')][_0x0a9e('0x1d')]);_0x41b90a[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x4f2594[_0x0a9e('0x32')]['offset']);}return _0xb14971[_0x0a9e('0x9d')](_0x41b90a);}})[_0x0a9e('0x23')](function(_0x2d8e91){if(_0x2d8e91){return _0x2d8e91?{'count':_0x37215d,'rows':_0x2d8e91}:null;}})[_0x0a9e('0x23')](respondWithResult(_0x1b637c,null))[_0x0a9e('0x46')](handleError(_0x1b637c,null));};function handleQuery(_0x3c6082){logger[_0x0a9e('0x9e')](_0x3c6082);return db['sequelize'][_0x0a9e('0x32')](_0x3c6082)[_0x0a9e('0x9f')](function(_0x231826){csv_results['push'](_0x231826);})[_0x0a9e('0x46')](function(_0x387817){logger[_0x0a9e('0x28')](_0x387817[_0x0a9e('0xa0')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4c63445..2705136 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x5ce5e7,_0x495679){var _0x2bef07=function(_0x6c3061){while(--_0x6c3061){_0x5ce5e7['push'](_0x5ce5e7['shift']());}};_0x2bef07(++_0x495679);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x5fc3,0xa8));var _0x35fc=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x5fc3[_0x10c51f];return _0x56a0cd;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 04a5cf1..2659e3d 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 _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x3f3add,_0x207aa2){var _0x378186=function(_0x178fdc){while(--_0x178fdc){_0x3f3add['push'](_0x3f3add['shift']());}};_0x378186(++_0x207aa2);}(_0xbec5,0xe5));var _0x5bec=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xbec5[_0x56ba92];return _0x8fe94d;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 5bdc578..df6c74a 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 _0x9224=['defaults','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','stringify','error','CmList,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x436a1a,_0x1c6be0){var _0x8e1d7b=function(_0x514831){while(--_0x514831){_0x436a1a['push'](_0x436a1a['shift']());}};_0x8e1d7b(++_0x1c6be0);}(_0x9224,0x138));var _0x4922=function(_0x22419d,_0x4c6974){_0x22419d=_0x22419d-0x0;var _0x169dde=_0x9224[_0x22419d];return _0x169dde;};'use strict';var _=require('lodash');var util=require(_0x4922('0x0'));var moment=require(_0x4922('0x1'));var BPromise=require(_0x4922('0x2'));var rs=require(_0x4922('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4922('0x4'))['db'];var utils=require(_0x4922('0x5'));var logger=require(_0x4922('0x6'))(_0x4922('0x7'));var config=require(_0x4922('0x8'));var jayson=require(_0x4922('0x9'));var client=jayson[_0x4922('0xa')]['http']({'port':0x232a});config[_0x4922('0xb')]=_[_0x4922('0xc')](config[_0x4922('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4922('0xd'))(new Redis(config[_0x4922('0xb')]));require(_0x4922('0xe'))[_0x4922('0xf')](socket);function respondWithRpcPromise(_0x170c91,_0x22ccde,_0x3363f6){return new BPromise(function(_0x439bab,_0x36c87e){return client[_0x4922('0x10')](_0x170c91,_0x3363f6)[_0x4922('0x11')](function(_0x23e16c){logger[_0x4922('0x12')]('CmList,\x20%s,\x20%s',_0x22ccde,_0x4922('0x13'));logger[_0x4922('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x22ccde,'request\x20sent',JSON[_0x4922('0x15')](_0x23e16c));if(_0x23e16c[_0x4922('0x16')]){if(_0x23e16c['error']['code']===0x1f4){logger[_0x4922('0x16')](_0x4922('0x17'),_0x22ccde,_0x23e16c['error']['message']);return _0x36c87e(_0x23e16c[_0x4922('0x16')][_0x4922('0x18')]);}logger[_0x4922('0x16')](_0x4922('0x17'),_0x22ccde,_0x23e16c[_0x4922('0x16')][_0x4922('0x18')]);return _0x439bab(_0x23e16c[_0x4922('0x16')][_0x4922('0x18')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x22ccde,_0x4922('0x13'));_0x439bab(_0x23e16c[_0x4922('0x19')][_0x4922('0x18')]);}})[_0x4922('0x1a')](function(_0x514986){logger[_0x4922('0x16')](_0x4922('0x17'),_0x22ccde,_0x514986);_0x36c87e(_0x514986);});});} \ No newline at end of file +var _0x2da9=['register','request','then','info','request\x20sent','debug','error','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5ad5da,_0x3e78ee){var _0x45b9a8=function(_0x2176f2){while(--_0x2176f2){_0x5ad5da['push'](_0x5ad5da['shift']());}};_0x45b9a8(++_0x3e78ee);}(_0x2da9,0x73));var _0x92da=function(_0xa9ee0f,_0x2357be){_0xa9ee0f=_0xa9ee0f-0x0;var _0x280c6f=_0x2da9[_0xa9ee0f];return _0x280c6f;};'use strict';var _=require(_0x92da('0x0'));var util=require(_0x92da('0x1'));var moment=require(_0x92da('0x2'));var BPromise=require(_0x92da('0x3'));var rs=require(_0x92da('0x4'));var fs=require('fs');var Redis=require(_0x92da('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x92da('0x6'))(_0x92da('0x7'));var config=require(_0x92da('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92da('0x9')][_0x92da('0xa')]({'port':0x232a});config[_0x92da('0xb')]=_[_0x92da('0xc')](config['redis'],{'host':_0x92da('0xd'),'port':0x18eb});var socket=require(_0x92da('0xe'))(new Redis(config[_0x92da('0xb')]));require('./cmList.socket')[_0x92da('0xf')](socket);function respondWithRpcPromise(_0x4b75af,_0x56008b,_0x1d6681){return new BPromise(function(_0x2ec9b1,_0x4a5b92){return client[_0x92da('0x10')](_0x4b75af,_0x1d6681)[_0x92da('0x11')](function(_0x1c0138){logger[_0x92da('0x12')]('CmList,\x20%s,\x20%s',_0x56008b,_0x92da('0x13'));logger[_0x92da('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x56008b,_0x92da('0x13'),JSON['stringify'](_0x1c0138));if(_0x1c0138[_0x92da('0x15')]){if(_0x1c0138['error']['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x56008b,_0x1c0138[_0x92da('0x15')][_0x92da('0x16')]);return _0x4a5b92(_0x1c0138[_0x92da('0x15')][_0x92da('0x16')]);}logger['error'](_0x92da('0x17'),_0x56008b,_0x1c0138[_0x92da('0x15')][_0x92da('0x16')]);return _0x2ec9b1(_0x1c0138[_0x92da('0x15')][_0x92da('0x16')]);}else{logger[_0x92da('0x12')]('CmList,\x20%s,\x20%s',_0x56008b,_0x92da('0x13'));_0x2ec9b1(_0x1c0138[_0x92da('0x18')]['message']);}})[_0x92da('0x19')](function(_0x5c99af){logger['error'](_0x92da('0x17'),_0x56008b,_0x5c99af);_0x4a5b92(_0x5c99af);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b69136a..b4bbc07 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 _0xd0d6=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x1f25f4,_0x1b01a8){var _0xdfa7cb=function(_0xdde183){while(--_0xdde183){_0x1f25f4['push'](_0x1f25f4['shift']());}};_0xdfa7cb(++_0x1b01a8);}(_0xd0d6,0x166));var _0x6d0d=function(_0xb9987d,_0x13f033){_0xb9987d=_0xb9987d-0x0;var _0x4406b4=_0xd0d6[_0xb9987d];return _0x4406b4;};'use strict';var CmListEvents=require(_0x6d0d('0x0'));var events=[_0x6d0d('0x1'),_0x6d0d('0x2'),_0x6d0d('0x3')];function createListener(_0x133f54,_0x4bb45a){return function(_0x26cd0c){_0x4bb45a[_0x6d0d('0x4')](_0x133f54,_0x26cd0c);};}function removeListener(_0x2cc27a,_0x39e82f){return function(){CmListEvents[_0x6d0d('0x5')](_0x2cc27a,_0x39e82f);};}exports[_0x6d0d('0x6')]=function(_0x41ad87){for(var _0x993560=0x0,_0x843656=events[_0x6d0d('0x7')];_0x993560<_0x843656;_0x993560++){var _0x35bce9=events[_0x993560];var _0xba3df2=createListener(_0x6d0d('0x8')+_0x35bce9,_0x41ad87);CmListEvents['on'](_0x35bce9,_0xba3df2);}}; \ No newline at end of file +var _0xa1bf=['remove','update','emit','length','./cmList.events'];(function(_0x4f9b6,_0x2be668){var _0xeea205=function(_0xb7b927){while(--_0xb7b927){_0x4f9b6['push'](_0x4f9b6['shift']());}};_0xeea205(++_0x2be668);}(_0xa1bf,0x117));var _0xfa1b=function(_0x4dce85,_0x140ba9){_0x4dce85=_0x4dce85-0x0;var _0x5c9710=_0xa1bf[_0x4dce85];return _0x5c9710;};'use strict';var CmListEvents=require(_0xfa1b('0x0'));var events=['save',_0xfa1b('0x1'),_0xfa1b('0x2')];function createListener(_0x4d6a1a,_0x404ba2){return function(_0x234ce7){_0x404ba2[_0xfa1b('0x3')](_0x4d6a1a,_0x234ce7);};}function removeListener(_0x4df2c0,_0x47f13c){return function(){CmListEvents['removeListener'](_0x4df2c0,_0x47f13c);};}exports['register']=function(_0x1ea7ee){for(var _0x2cc618=0x0,_0x109910=events[_0xfa1b('0x4')];_0x2cc618<_0x109910;_0x2cc618++){var _0x3b772f=events[_0x2cc618];var _0x5bca2b=createListener('cmList:'+_0x3b772f,_0x1ea7ee);CmListEvents['on'](_0x3b772f,_0x5bca2b);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3a1cfd3..2eec1c3 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 _0xc910=['multer','util','path','connect-timeout','Router','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','put','update','destroy','delete','removeAgents'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc910,0x140));var _0x0c91=function(_0x1cc450,_0x13625e){_0x1cc450=_0x1cc450-0x0;var _0x4573e7=_0xc910[_0x1cc450];return _0x4573e7;};'use strict';var multer=require(_0x0c91('0x0'));var util=require(_0x0c91('0x1'));var path=require(_0x0c91('0x2'));var timeout=require(_0x0c91('0x3'));var express=require('express');var router=express[_0x0c91('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c91('0x5'));var controller=require(_0x0c91('0x6'));router[_0x0c91('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0c91('0x8'),auth[_0x0c91('0x9')](),controller[_0x0c91('0xa')]);router['get'](_0x0c91('0xb'),auth['isAuthenticated'](),controller[_0x0c91('0xc')]);router[_0x0c91('0x7')](_0x0c91('0xd'),auth['isAuthenticated'](),controller[_0x0c91('0xe')]);router['get'](_0x0c91('0xf'),auth[_0x0c91('0x9')](),controller[_0x0c91('0x10')]);router[_0x0c91('0x7')](_0x0c91('0x11'),auth[_0x0c91('0x9')](),controller[_0x0c91('0x12')]);router[_0x0c91('0x7')](_0x0c91('0x13'),auth['isAuthenticated'](),controller[_0x0c91('0x14')]);router[_0x0c91('0x7')](_0x0c91('0x15'),auth['isAuthenticated'](),controller[_0x0c91('0x16')]);router['get'](_0x0c91('0x17'),auth[_0x0c91('0x9')](),controller['getAgents']);router[_0x0c91('0x18')]('/',auth[_0x0c91('0x9')](),controller[_0x0c91('0x19')]);router[_0x0c91('0x18')](_0x0c91('0xf'),auth[_0x0c91('0x9')](),controller[_0x0c91('0x1a')]);router[_0x0c91('0x18')](_0x0c91('0x11'),auth[_0x0c91('0x9')](),controller['addContacts']);router[_0x0c91('0x18')](_0x0c91('0x15'),auth[_0x0c91('0x9')](),controller['addCustomField']);router[_0x0c91('0x18')](_0x0c91('0x17'),auth[_0x0c91('0x9')](),controller['addAgents']);router[_0x0c91('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x0c91('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0c91('0x1d')]);router[_0x0c91('0x1e')](_0x0c91('0xf'),auth[_0x0c91('0x9')](),controller['removeDispositions']);router['delete'](_0x0c91('0x17'),auth[_0x0c91('0x9')](),controller[_0x0c91('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x6b6d=['addCustomField','addAgents','put','/:id','destroy','removeDispositions','delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','create','post','addDisposition','addContacts'];(function(_0x4e12fe,_0x5d5df0){var _0x38b5d9=function(_0x2c8405){while(--_0x2c8405){_0x4e12fe['push'](_0x4e12fe['shift']());}};_0x38b5d9(++_0x5d5df0);}(_0x6b6d,0x19a));var _0xd6b6=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x6b6d[_0x119d5a];return _0x15bff4;};'use strict';var multer=require('multer');var util=require(_0xd6b6('0x0'));var path=require(_0xd6b6('0x1'));var timeout=require(_0xd6b6('0x2'));var express=require('express');var router=express[_0xd6b6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd6b6('0x4'));var interaction=require(_0xd6b6('0x5'));var config=require(_0xd6b6('0x6'));var controller=require('./cmList.controller');router[_0xd6b6('0x7')]('/',auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x9')]);router['get'](_0xd6b6('0xa'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0xb')]);router['get'](_0xd6b6('0xc'),auth[_0xd6b6('0x8')](),controller['getGlobalCustomFields']);router[_0xd6b6('0x7')]('/:id',auth[_0xd6b6('0x8')](),controller[_0xd6b6('0xd')]);router[_0xd6b6('0x7')](_0xd6b6('0xe'),auth[_0xd6b6('0x8')](),controller['getDispositions']);router[_0xd6b6('0x7')](_0xd6b6('0xf'),auth[_0xd6b6('0x8')](),controller['getContacts']);router[_0xd6b6('0x7')](_0xd6b6('0x10'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x11')]);router[_0xd6b6('0x7')](_0xd6b6('0x12'),auth[_0xd6b6('0x8')](),controller['getCustomFields']);router[_0xd6b6('0x7')](_0xd6b6('0x13'),auth[_0xd6b6('0x8')](),controller['getAgents']);router['post']('/',auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x14')]);router[_0xd6b6('0x15')]('/:id/dispositions',auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x16')]);router[_0xd6b6('0x15')](_0xd6b6('0xf'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x17')]);router[_0xd6b6('0x15')](_0xd6b6('0x12'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x18')]);router[_0xd6b6('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xd6b6('0x19')]);router[_0xd6b6('0x1a')](_0xd6b6('0x1b'),auth[_0xd6b6('0x8')](),controller['update']);router['delete'](_0xd6b6('0x1b'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x1c')]);router['delete'](_0xd6b6('0xe'),auth[_0xd6b6('0x8')](),controller[_0xd6b6('0x1d')]);router[_0xd6b6('0x1e')]('/:id/users',auth[_0xd6b6('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 81e3268..8235838 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 _0xb3c3=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb3c3,0x19d));var _0x3b3c=function(_0x3d9f55,_0x7e644c){_0x3d9f55=_0x3d9f55-0x0;var _0xac766c=_0xb3c3[_0x3d9f55];return _0xac766c;};'use strict';var Sequelize=require(_0x3b3c('0x0'));module[_0x3b3c('0x1')]={'name':{'type':Sequelize[_0x3b3c('0x2')],'get':function(_0x2caab3){return this[_0x3b3c('0x3')]('field');}},'field':{'type':Sequelize[_0x3b3c('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3b3c('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xaefc=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x1682a9,_0x34b75f){var _0x1cdf47=function(_0x4d38ce){while(--_0x4d38ce){_0x1682a9['push'](_0x1682a9['shift']());}};_0x1cdf47(++_0x34b75f);}(_0xaefc,0xe8));var _0xcaef=function(_0x173f79,_0x3b2224){_0x173f79=_0x173f79-0x0;var _0x59ce8c=_0xaefc[_0x173f79];return _0x59ce8c;};'use strict';var Sequelize=require(_0xcaef('0x0'));module[_0xcaef('0x1')]={'name':{'type':Sequelize[_0xcaef('0x2')],'get':function(_0x5786a3){return this['getDataValue'](_0xcaef('0x3'));}},'field':{'type':Sequelize[_0xcaef('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xcaef('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xcaef('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0235005..09f1dd3 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 _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(_0x316c9e,_0x44fc83){var _0x3a65b9=function(_0x1b3cbb){while(--_0x1b3cbb){_0x316c9e['push'](_0x316c9e['shift']());}};_0x3a65b9(++_0x44fc83);}(_0x7a54,0x106));var _0x47a5=function(_0x4a3271,_0x5e02a6){_0x4a3271=_0x4a3271-0x0;var _0xb8fa5e=_0x7a54[_0x4a3271];return _0xb8fa5e;};'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 +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(_0xcb076e,_0x38798a){var _0x5a7598=function(_0x14084f){while(--_0x14084f){_0xcb076e['push'](_0xcb076e['shift']());}};_0x5a7598(++_0x38798a);}(_0x7a54,0x106));var _0x47a5=function(_0x4aff0a,_0xd99ea9){_0x4aff0a=_0x4aff0a-0x0;var _0xab0048=_0x7a54[_0x4aff0a];return _0xab0048;};'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 3ca2cca..496e846 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 _0x8a12=['exports','define','Condition','tools_conditions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x382a36,_0x5f2c45){var _0x51cff0=function(_0x45ab88){while(--_0x45ab88){_0x382a36['push'](_0x382a36['shift']());}};_0x51cff0(++_0x5f2c45);}(_0x8a12,0x18a));var _0x28a1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8a12[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x28a1('0x0'));var util=require(_0x28a1('0x1'));var logger=require('../../config/logger')(_0x28a1('0x2'));var moment=require(_0x28a1('0x3'));var BPromise=require('bluebird');var rp=require(_0x28a1('0x4'));var fs=require('fs');var path=require(_0x28a1('0x5'));var rimraf=require(_0x28a1('0x6'));var config=require(_0x28a1('0x7'));var attributes=require(_0x28a1('0x8'));module[_0x28a1('0x9')]=function(_0x3e5f1,_0x341c83){return _0x3e5f1[_0x28a1('0xa')](_0x28a1('0xb'),attributes,{'tableName':_0x28a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b0=['./condition.attributes','define','tools_conditions','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x3a802d,_0x119cfc){var _0x2fd218=function(_0x46bb78){while(--_0x46bb78){_0x3a802d['push'](_0x3a802d['shift']());}};_0x2fd218(++_0x119cfc);}(_0x72b0,0x143));var _0x072b=function(_0x46f5d5,_0x343a0c){_0x46f5d5=_0x46f5d5-0x0;var _0x447017=_0x72b0[_0x46f5d5];return _0x447017;};'use strict';var _=require(_0x072b('0x0'));var util=require(_0x072b('0x1'));var logger=require(_0x072b('0x2'))(_0x072b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x072b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072b('0x5'));var config=require(_0x072b('0x6'));var attributes=require(_0x072b('0x7'));module['exports']=function(_0x39fcc2,_0x5cb238){return _0x39fcc2[_0x072b('0x8')]('Condition',attributes,{'tableName':_0x072b('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 e78601b..9c0249e 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 _0x18e7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0x18e7,0x1cc));var _0x718e=function(_0x1e72aa,_0x3a3073){_0x1e72aa=_0x1e72aa-0x0;var _0x458adf=_0x18e7[_0x1e72aa];return _0x458adf;};'use strict';var _=require(_0x718e('0x0'));var util=require('util');var moment=require(_0x718e('0x1'));var BPromise=require(_0x718e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x718e('0x3'));var db=require(_0x718e('0x4'))['db'];var utils=require(_0x718e('0x5'));var logger=require(_0x718e('0x6'))(_0x718e('0x7'));var config=require(_0x718e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x718e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d74ad,_0xfb8470,_0xd465f7){return new BPromise(function(_0x2551fb,_0x47fff3){return client[_0x718e('0xa')](_0x3d74ad,_0xd465f7)['then'](function(_0xc05bef){logger[_0x718e('0xb')](_0x718e('0xc'),_0xfb8470,_0x718e('0xd'));logger[_0x718e('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0xfb8470,_0x718e('0xd'),JSON[_0x718e('0xf')](_0xc05bef));if(_0xc05bef[_0x718e('0x10')]){if(_0xc05bef['error'][_0x718e('0x11')]===0x1f4){logger[_0x718e('0x10')](_0x718e('0xc'),_0xfb8470,_0xc05bef[_0x718e('0x10')]['message']);return _0x47fff3(_0xc05bef[_0x718e('0x10')][_0x718e('0x12')]);}logger[_0x718e('0x10')](_0x718e('0xc'),_0xfb8470,_0xc05bef[_0x718e('0x10')][_0x718e('0x12')]);return _0x2551fb(_0xc05bef[_0x718e('0x10')][_0x718e('0x12')]);}else{logger[_0x718e('0xb')](_0x718e('0xc'),_0xfb8470,_0x718e('0xd'));_0x2551fb(_0xc05bef[_0x718e('0x13')][_0x718e('0x12')]);}})[_0x718e('0x14')](function(_0x2c58a2){logger['error'](_0x718e('0xc'),_0xfb8470,_0x2c58a2);_0x47fff3(_0x2c58a2);});});} \ No newline at end of file +var _0x88d5=['debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x41de20,_0x578ed2){var _0x3d868f=function(_0x2b937d){while(--_0x2b937d){_0x41de20['push'](_0x41de20['shift']());}};_0x3d868f(++_0x578ed2);}(_0x88d5,0x17c));var _0x588d=function(_0x8a2aeb,_0x206730){_0x8a2aeb=_0x8a2aeb-0x0;var _0x5adc74=_0x88d5[_0x8a2aeb];return _0x5adc74;};'use strict';var _=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var moment=require(_0x588d('0x2'));var BPromise=require('bluebird');var rs=require(_0x588d('0x3'));var fs=require('fs');var Redis=require(_0x588d('0x4'));var db=require(_0x588d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x588d('0x6'))(_0x588d('0x7'));var config=require(_0x588d('0x8'));var jayson=require(_0x588d('0x9'));var client=jayson[_0x588d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13c4fb,_0xdc4f69,_0x31cb44){return new BPromise(function(_0x50ad27,_0x429ebf){return client[_0x588d('0xb')](_0x13c4fb,_0x31cb44)[_0x588d('0xc')](function(_0x4e72a2){logger[_0x588d('0xd')](_0x588d('0xe'),_0xdc4f69,_0x588d('0xf'));logger[_0x588d('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0xdc4f69,_0x588d('0xf'),JSON['stringify'](_0x4e72a2));if(_0x4e72a2['error']){if(_0x4e72a2[_0x588d('0x11')][_0x588d('0x12')]===0x1f4){logger['error'](_0x588d('0xe'),_0xdc4f69,_0x4e72a2['error'][_0x588d('0x13')]);return _0x429ebf(_0x4e72a2['error'][_0x588d('0x13')]);}logger['error'](_0x588d('0xe'),_0xdc4f69,_0x4e72a2[_0x588d('0x11')][_0x588d('0x13')]);return _0x50ad27(_0x4e72a2[_0x588d('0x11')]['message']);}else{logger[_0x588d('0xd')](_0x588d('0xe'),_0xdc4f69,_0x588d('0xf'));_0x50ad27(_0x4e72a2[_0x588d('0x14')][_0x588d('0x13')]);}})[_0x588d('0x15')](function(_0x3cebd2){logger[_0x588d('0x11')]('Condition,\x20%s,\x20%s',_0xdc4f69,_0x3cebd2);_0x429ebf(_0x3cebd2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1cc74ce..641516b 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 _0x56f0=['isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x56f0,0x145));var _0x056f=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0x56f0[_0x1aa13e];return _0x1144bd;};'use strict';var multer=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var path=require('path');var timeout=require(_0x056f('0x2'));var express=require(_0x056f('0x3'));var router=express[_0x056f('0x4')]();var fs_extra=require(_0x056f('0x5'));var auth=require(_0x056f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x056f('0x7'));var controller=require(_0x056f('0x8'));router[_0x056f('0x9')](_0x056f('0xa'),auth[_0x056f('0xb')](),controller[_0x056f('0xc')]);router[_0x056f('0xd')](_0x056f('0xa'),auth['isAuthenticated'](),controller[_0x056f('0xe')]);module[_0x056f('0xf')]=router; \ No newline at end of file +var _0x0688=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x43e4b3,_0x1444de){var _0x10c655=function(_0x56c01d){while(--_0x56c01d){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x10c655(++_0x1444de);}(_0x0688,0x108));var _0x8068=function(_0x1867c3,_0x242ae6){_0x1867c3=_0x1867c3-0x0;var _0x2c911e=_0x0688[_0x1867c3];return _0x2c911e;};'use strict';var multer=require(_0x8068('0x0'));var util=require(_0x8068('0x1'));var path=require(_0x8068('0x2'));var timeout=require(_0x8068('0x3'));var express=require(_0x8068('0x4'));var router=express[_0x8068('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8068('0x6'));var config=require(_0x8068('0x7'));var controller=require(_0x8068('0x8'));router[_0x8068('0x9')](_0x8068('0xa'),auth[_0x8068('0xb')](),controller['update']);router[_0x8068('0xc')](_0x8068('0xa'),auth['isAuthenticated'](),controller[_0x8068('0xd')]);module[_0x8068('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 4e80749..959a82c 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf54b=['name','INTEGER','exports','STRING'];(function(_0x52bdfe,_0x5282ec){var _0x5c6df7=function(_0x2355bb){while(--_0x2355bb){_0x52bdfe['push'](_0x52bdfe['shift']());}};_0x5c6df7(++_0x5282ec);}(_0xf54b,0xf2));var _0xbf54=function(_0x4d58ce,_0x47fb4f){_0x4d58ce=_0x4d58ce-0x0;var _0x504769=_0xf54b[_0x4d58ce];return _0x504769;};'use strict';var Sequelize=require('sequelize');module[_0xbf54('0x0')]={'name':{'type':Sequelize[_0xbf54('0x1')],'allowNull':![],'unique':_0xbf54('0x2')},'OrderBy':{'type':Sequelize[_0xbf54('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbf54('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x0541=['INTEGER','STRING','sequelize','exports','name'];(function(_0x451fea,_0x2cab9c){var _0x483d11=function(_0x2e3a2f){while(--_0x2e3a2f){_0x451fea['push'](_0x451fea['shift']());}};_0x483d11(++_0x2cab9c);}(_0x0541,0xa2));var _0x1054=function(_0x34d635,_0x2784fc){_0x34d635=_0x34d635-0x0;var _0x3ab288=_0x0541[_0x34d635];return _0x3ab288;};'use strict';var Sequelize=require(_0x1054('0x0'));module[_0x1054('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1054('0x2')},'OrderBy':{'type':Sequelize[_0x1054('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1054('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 923cc7b..33b790a 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x781d=['find','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','get','stack','name','send','index','ContactItemType','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3da901,_0x498bec){var _0xda8ce8=function(_0x1c57c7){while(--_0x1c57c7){_0x3da901['push'](_0x3da901['shift']());}};_0xda8ce8(++_0x498bec);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){var _0x221f14=_0x31bf57[_0xd781('0x27')]({'plain':!![]});var _0x10940b='ContactItemTypes';return db['UserProfileResource'][_0xd781('0x25')]({'where':{'type':_0x10940b,'resourceId':_0x221f14['id']}})[_0xd781('0x26')](function(){return _0x31bf57;});})[_0xd781('0x26')](function(){_0x101480['status'](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x5a431b,_0x47c609){return function(_0x1e29c8){if(!_0x1e29c8){_0x5a431b['sendStatus'](0x194);}return _0x1e29c8;};}function handleError(_0x3e868,_0x123a6a){_0x123a6a=_0x123a6a||0x1f4;return function(_0x5c3848){logger['error'](_0x5c3848[_0xd781('0x28')]);if(_0x5c3848['name']){delete _0x5c3848[_0xd781('0x29')];}_0x3e868['status'](_0x123a6a)[_0xd781('0x2a')](_0x5c3848);};}exports[_0xd781('0x2b')]=function(_0x556127,_0x54521e){var _0x432d14={},_0x29e81a={},_0x1c7d83={'count':0x0,'rows':[]};var _0x5a389c=_['map'](db[_0xd781('0x2c')][_0xd781('0x2d')],function(_0x36a889){return{'name':_0x36a889['fieldName'],'type':_0x36a889['type'][_0xd781('0x2e')]};});_0x29e81a[_0xd781('0x2f')]=_['map'](_0x5a389c,_0xd781('0x29'));_0x29e81a[_0xd781('0x30')]=_['keys'](_0x556127[_0xd781('0x30')]);_0x29e81a[_0xd781('0x31')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],_0x29e81a['query']);_0x432d14[_0xd781('0x33')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x556127['query'][_0xd781('0x34')]));_0x432d14[_0xd781('0x33')]=_0x432d14['attributes'][_0xd781('0x35')]?_0x432d14['attributes']:_0x29e81a[_0xd781('0x2f')];if(!_0x556127[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x36'))){_0x432d14[_0xd781('0x1e')]=qs['limit'](_0x556127[_0xd781('0x30')]['limit']);_0x432d14[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x556127['query'][_0xd781('0x1c')]);}_0x432d14[_0xd781('0x37')]=qs['sort'](_0x556127[_0xd781('0x30')][_0xd781('0x38')]);_0x432d14[_0xd781('0x39')]=qs['filters'](_[_0xd781('0x3a')](_0x556127[_0xd781('0x30')],_0x29e81a[_0xd781('0x31')]),_0x5a389c);if(_0x556127[_0xd781('0x30')][_0xd781('0x3b')]){_0x432d14[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x432d14[_0xd781('0x39')],{'$or':_[_0xd781('0x3d')](_0x5a389c,function(_0x5c6026){if(_0x5c6026[_0xd781('0x3e')]!=='VIRTUAL'){var _0x2504ac={};_0x2504ac[_0x5c6026[_0xd781('0x29')]]={'$like':'%'+_0x556127['query'][_0xd781('0x3b')]+'%'};return _0x2504ac;}})});}_0x432d14=_[_0xd781('0x3c')]({},_0x432d14,_0x556127[_0xd781('0x3f')]);var _0x402c9c={'where':_0x432d14['where']};return db[_0xd781('0x2c')]['count'](_0x402c9c)[_0xd781('0x26')](function(_0xcdaacf){_0x1c7d83['count']=_0xcdaacf;if(_0x556127['query'][_0xd781('0x40')]){_0x432d14[_0xd781('0x41')]=[{'all':!![]}];}return db[_0xd781('0x2c')][_0xd781('0x42')](_0x432d14);})['then'](function(_0x46e7f6){_0x1c7d83[_0xd781('0x43')]=_0x46e7f6;return _0x1c7d83;})['then'](respondWithFilteredResult(_0x54521e,_0x432d14))['catch'](handleError(_0x54521e,null));};exports[_0xd781('0x44')]=function(_0x1d901e,_0xaa552){var _0x4e2eea={'raw':!![],'where':{'id':_0x1d901e[_0xd781('0x45')]['id']}},_0x594f85={};_0x594f85[_0xd781('0x2f')]=_[_0xd781('0x46')](db[_0xd781('0x2c')][_0xd781('0x2d')]);_0x594f85[_0xd781('0x30')]=_['keys'](_0x1d901e['query']);_0x594f85[_0xd781('0x31')]=_[_0xd781('0x32')](_0x594f85[_0xd781('0x2f')],_0x594f85[_0xd781('0x30')]);_0x4e2eea[_0xd781('0x33')]=_['intersection'](_0x594f85[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x1d901e[_0xd781('0x30')]['fields']));_0x4e2eea[_0xd781('0x33')]=_0x4e2eea[_0xd781('0x33')][_0xd781('0x35')]?_0x4e2eea['attributes']:_0x594f85[_0xd781('0x2f')];if(_0x1d901e[_0xd781('0x30')]['includeAll']){_0x4e2eea['include']=[{'all':!![]}];}_0x4e2eea=_[_0xd781('0x3c')]({},_0x4e2eea,_0x1d901e[_0xd781('0x3f')]);return db[_0xd781('0x2c')]['find'](_0x4e2eea)[_0xd781('0x26')](handleEntityNotFound(_0xaa552,null))[_0xd781('0x26')](respondWithResult(_0xaa552,null))[_0xd781('0x47')](handleError(_0xaa552,null));};exports[_0xd781('0x48')]=function(_0x336d30,_0x3828ad){return db[_0xd781('0x2c')]['create'](_0x336d30[_0xd781('0x49')],{})[_0xd781('0x26')](function(_0x1d54bd){var _0x4c7cb6=_0x336d30[_0xd781('0x4a')][_0xd781('0x27')]({'plain':!![]});if(!_0x4c7cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7cb6[_0xd781('0x4b')]===_0xd781('0x4a')){var _0x41caac=_0x1d54bd[_0xd781('0x27')]({'plain':!![]});var _0x42a2f9='ContactItemTypes';return db[_0xd781('0x4c')]['find']({'where':{'name':_0x42a2f9,'userProfileId':_0x4c7cb6[_0xd781('0x4d')]},'raw':!![]})['then'](function(_0x2ce1f6){if(_0x2ce1f6&&_0x2ce1f6[_0xd781('0x4e')]===0x0){return db['UserProfileResource'][_0xd781('0x48')]({'name':_0x41caac['name'],'resourceId':_0x41caac['id'],'type':_0x2ce1f6['name'],'sectionId':_0x2ce1f6['id']},{})['then'](function(){return _0x1d54bd;});}else{return _0x1d54bd;}})[_0xd781('0x47')](function(_0x174fcd){logger['error'](_0xd781('0x4f'),_0x174fcd);throw _0x174fcd;});}return _0x1d54bd;})['then'](respondWithResult(_0x3828ad,0xc9))[_0xd781('0x47')](handleError(_0x3828ad,null));};exports[_0xd781('0x24')]=function(_0x39d47d,_0x19a6c2){if(_0x39d47d['body']['id']){delete _0x39d47d[_0xd781('0x49')]['id'];}return db['ContactItemType'][_0xd781('0x50')]({'where':{'id':_0x39d47d['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x19a6c2,null))[_0xd781('0x26')](saveUpdates(_0x39d47d['body'],null))[_0xd781('0x26')](respondWithResult(_0x19a6c2,null))[_0xd781('0x47')](handleError(_0x19a6c2,null));};exports[_0xd781('0x25')]=function(_0x32fd9f,_0xfc466c){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x32fd9f['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0xfc466c,null))[_0xd781('0x26')](db[_0xd781('0x51')][_0xd781('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x32fd9f['params']['id']}}))[_0xd781('0x26')](removeEntity(_0xfc466c,null))['catch'](handleError(_0xfc466c,null));}; \ No newline at end of file +var _0x4b17=['sort','pick','filters','filter','where','merge','options','ContactItemType','include','findAll','rows','show','length','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','params','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x4b17,0x10f));var _0x74b1=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x4b17[_0x54f7c0];return _0x245d03;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){var _0x3a7ef9=_0x4ee88b[_0x74b1('0x25')]({'plain':!![]});var _0xb5af0=_0x74b1('0x26');return db[_0x74b1('0x27')][_0x74b1('0x24')]({'where':{'type':_0xb5af0,'resourceId':_0x3a7ef9['id']}})[_0x74b1('0x23')](function(){return _0x4ee88b;});})[_0x74b1('0x23')](function(){_0x44bf7e['status'](0xcc)[_0x74b1('0x28')]();});}};}function handleEntityNotFound(_0x42b69d,_0x4099af){return function(_0x5c32d2){if(!_0x5c32d2){_0x42b69d[_0x74b1('0x17')](0x194);}return _0x5c32d2;};}function handleError(_0x351392,_0x94b1f8){_0x94b1f8=_0x94b1f8||0x1f4;return function(_0x1b011a){logger[_0x74b1('0x29')](_0x1b011a[_0x74b1('0x2a')]);if(_0x1b011a[_0x74b1('0x2b')]){delete _0x1b011a[_0x74b1('0x2b')];}_0x351392['status'](_0x94b1f8)[_0x74b1('0x2c')](_0x1b011a);};}exports[_0x74b1('0x2d')]=function(_0x51ce6d,_0x543b5){var _0x45404f={},_0x1ac433={},_0x5f4d1b={'count':0x0,'rows':[]};var _0x113300=_[_0x74b1('0x2e')](db['ContactItemType'][_0x74b1('0x2f')],function(_0x33ec7c){return{'name':_0x33ec7c[_0x74b1('0x30')],'type':_0x33ec7c[_0x74b1('0x31')][_0x74b1('0x32')]};});_0x1ac433[_0x74b1('0x33')]=_[_0x74b1('0x2e')](_0x113300,_0x74b1('0x2b'));_0x1ac433['query']=_[_0x74b1('0x34')](_0x51ce6d['query']);_0x1ac433['filters']=_[_0x74b1('0x35')](_0x1ac433['model'],_0x1ac433['query']);_0x45404f[_0x74b1('0x36')]=_[_0x74b1('0x35')](_0x1ac433[_0x74b1('0x33')],qs[_0x74b1('0x37')](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x37')]));_0x45404f[_0x74b1('0x36')]=_0x45404f[_0x74b1('0x36')]['length']?_0x45404f['attributes']:_0x1ac433['model'];if(!_0x51ce6d[_0x74b1('0x38')]['hasOwnProperty']('nolimit')){_0x45404f[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x51ce6d[_0x74b1('0x38')]['limit']);_0x45404f[_0x74b1('0x19')]=qs['offset'](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x19')]);}_0x45404f['order']=qs['sort'](_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x39')]);_0x45404f['where']=qs['filters'](_[_0x74b1('0x3a')](_0x51ce6d['query'],_0x1ac433[_0x74b1('0x3b')]),_0x113300);if(_0x51ce6d[_0x74b1('0x38')][_0x74b1('0x3c')]){_0x45404f[_0x74b1('0x3d')]=_[_0x74b1('0x3e')](_0x45404f['where'],{'$or':_[_0x74b1('0x2e')](_0x113300,function(_0x5a981b){if(_0x5a981b[_0x74b1('0x31')]!=='VIRTUAL'){var _0x23cac2={};_0x23cac2[_0x5a981b['name']]={'$like':'%'+_0x51ce6d['query'][_0x74b1('0x3c')]+'%'};return _0x23cac2;}})});}_0x45404f=_[_0x74b1('0x3e')]({},_0x45404f,_0x51ce6d[_0x74b1('0x3f')]);var _0x49f7da={'where':_0x45404f[_0x74b1('0x3d')]};return db[_0x74b1('0x40')][_0x74b1('0x1c')](_0x49f7da)['then'](function(_0xfecdc){_0x5f4d1b[_0x74b1('0x1c')]=_0xfecdc;if(_0x51ce6d['query']['includeAll']){_0x45404f[_0x74b1('0x41')]=[{'all':!![]}];}return db[_0x74b1('0x40')][_0x74b1('0x42')](_0x45404f);})[_0x74b1('0x23')](function(_0x1d9f5b){_0x5f4d1b[_0x74b1('0x43')]=_0x1d9f5b;return _0x5f4d1b;})[_0x74b1('0x23')](respondWithFilteredResult(_0x543b5,_0x45404f))['catch'](handleError(_0x543b5,null));};exports[_0x74b1('0x44')]=function(_0x118623,_0x456c6e){var _0x452fa0={'raw':!![],'where':{'id':_0x118623['params']['id']}},_0x17a44f={};_0x17a44f[_0x74b1('0x33')]=_[_0x74b1('0x34')](db['ContactItemType']['rawAttributes']);_0x17a44f[_0x74b1('0x38')]=_[_0x74b1('0x34')](_0x118623['query']);_0x17a44f[_0x74b1('0x3b')]=_[_0x74b1('0x35')](_0x17a44f[_0x74b1('0x33')],_0x17a44f[_0x74b1('0x38')]);_0x452fa0[_0x74b1('0x36')]=_[_0x74b1('0x35')](_0x17a44f[_0x74b1('0x33')],qs['fields'](_0x118623['query']['fields']));_0x452fa0[_0x74b1('0x36')]=_0x452fa0[_0x74b1('0x36')][_0x74b1('0x45')]?_0x452fa0[_0x74b1('0x36')]:_0x17a44f[_0x74b1('0x33')];if(_0x118623['query'][_0x74b1('0x46')]){_0x452fa0[_0x74b1('0x41')]=[{'all':!![]}];}_0x452fa0=_[_0x74b1('0x3e')]({},_0x452fa0,_0x118623[_0x74b1('0x3f')]);return db[_0x74b1('0x40')][_0x74b1('0x47')](_0x452fa0)[_0x74b1('0x23')](handleEntityNotFound(_0x456c6e,null))[_0x74b1('0x23')](respondWithResult(_0x456c6e,null))[_0x74b1('0x48')](handleError(_0x456c6e,null));};exports[_0x74b1('0x49')]=function(_0x186516,_0x3038f9){return db['ContactItemType'][_0x74b1('0x49')](_0x186516[_0x74b1('0x4a')],{})['then'](function(_0xf3735e){var _0x4923d2=_0x186516[_0x74b1('0x4b')][_0x74b1('0x25')]({'plain':!![]});if(!_0x4923d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4923d2[_0x74b1('0x4c')]===_0x74b1('0x4b')){var _0x326b98=_0xf3735e['get']({'plain':!![]});var _0x497006=_0x74b1('0x26');return db[_0x74b1('0x4d')][_0x74b1('0x47')]({'where':{'name':_0x497006,'userProfileId':_0x4923d2[_0x74b1('0x4e')]},'raw':!![]})['then'](function(_0x1e7507){if(_0x1e7507&&_0x1e7507['autoAssociation']===0x0){return db[_0x74b1('0x27')][_0x74b1('0x49')]({'name':_0x326b98['name'],'resourceId':_0x326b98['id'],'type':_0x1e7507[_0x74b1('0x2b')],'sectionId':_0x1e7507['id']},{})[_0x74b1('0x23')](function(){return _0xf3735e;});}else{return _0xf3735e;}})[_0x74b1('0x48')](function(_0x54a221){logger[_0x74b1('0x29')](_0x74b1('0x4f'),_0x54a221);throw _0x54a221;});}return _0xf3735e;})['then'](respondWithResult(_0x3038f9,0xc9))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports['update']=function(_0x4ba250,_0x18cd64){if(_0x4ba250[_0x74b1('0x4a')]['id']){delete _0x4ba250[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x40')][_0x74b1('0x47')]({'where':{'id':_0x4ba250['params']['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x18cd64,null))[_0x74b1('0x23')](saveUpdates(_0x4ba250['body'],null))[_0x74b1('0x23')](respondWithResult(_0x18cd64,null))[_0x74b1('0x48')](handleError(_0x18cd64,null));};exports[_0x74b1('0x24')]=function(_0x5634d1,_0x2fac5d){return db[_0x74b1('0x40')][_0x74b1('0x47')]({'where':{'id':_0x5634d1['params']['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x2fac5d,null))[_0x74b1('0x23')](db[_0x74b1('0x50')][_0x74b1('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5634d1[_0x74b1('0x51')]['id']}}))[_0x74b1('0x23')](removeEntity(_0x2fac5d,null))['catch'](handleError(_0x2fac5d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 36b598a..d6d670e 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1e4=['exports','ContactItemType','tools_contact_item_types','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x4ff3e2,_0x2eb869){var _0x216c24=function(_0x3509c7){while(--_0x3509c7){_0x4ff3e2['push'](_0x4ff3e2['shift']());}};_0x216c24(++_0x2eb869);}(_0xc1e4,0xa3));var _0x4c1e=function(_0x381470,_0x36679d){_0x381470=_0x381470-0x0;var _0x4e636d=_0xc1e4[_0x381470];return _0x4e636d;};'use strict';var _=require(_0x4c1e('0x0'));var util=require(_0x4c1e('0x1'));var logger=require('../../config/logger')(_0x4c1e('0x2'));var moment=require(_0x4c1e('0x3'));var BPromise=require(_0x4c1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c1e('0x5'));var rimraf=require(_0x4c1e('0x6'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x4c1e('0x7')]=function(_0x32f1ad,_0x5794eb){return _0x32f1ad['define'](_0x4c1e('0x8'),attributes,{'tableName':_0x4c1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2394=['define','ContactItemType','tools_contact_item_types','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x2394,0x1b0));var _0x4239=function(_0x25b9f9,_0xd3d9dd){_0x25b9f9=_0x25b9f9-0x0;var _0x261447=_0x2394[_0x25b9f9];return _0x261447;};'use strict';var _=require('lodash');var util=require(_0x4239('0x0'));var logger=require(_0x4239('0x1'))(_0x4239('0x2'));var moment=require(_0x4239('0x3'));var BPromise=require(_0x4239('0x4'));var rp=require(_0x4239('0x5'));var fs=require('fs');var path=require(_0x4239('0x6'));var rimraf=require(_0x4239('0x7'));var config=require(_0x4239('0x8'));var attributes=require('./contactItemType.attributes');module[_0x4239('0x9')]=function(_0x35afdf,_0x70739e){return _0x35afdf[_0x4239('0xa')](_0x4239('0xb'),attributes,{'tableName':_0x4239('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index d11ab32..57a4e5a 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc521=['code','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0xc521,0xbd));var _0x1c52=function(_0x2571e2,_0x547809){_0x2571e2=_0x2571e2-0x0;var _0x29c6c7=_0xc521[_0x2571e2];return _0x29c6c7;};'use strict';var _=require(_0x1c52('0x0'));var util=require(_0x1c52('0x1'));var moment=require(_0x1c52('0x2'));var BPromise=require(_0x1c52('0x3'));var rs=require(_0x1c52('0x4'));var fs=require('fs');var Redis=require(_0x1c52('0x5'));var db=require(_0x1c52('0x6'))['db'];var utils=require(_0x1c52('0x7'));var logger=require(_0x1c52('0x8'))(_0x1c52('0x9'));var config=require(_0x1c52('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1c52('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d74cf,_0x447f4d,_0x4f337c){return new BPromise(function(_0x3d64aa,_0x49cf7b){return client['request'](_0x3d74cf,_0x4f337c)[_0x1c52('0xc')](function(_0x47c887){logger['info']('ContactItemType,\x20%s,\x20%s',_0x447f4d,_0x1c52('0xd'));logger[_0x1c52('0xe')](_0x1c52('0xf'),_0x447f4d,'request\x20sent',JSON[_0x1c52('0x10')](_0x47c887));if(_0x47c887[_0x1c52('0x11')]){if(_0x47c887[_0x1c52('0x11')][_0x1c52('0x12')]===0x1f4){logger[_0x1c52('0x11')](_0x1c52('0x13'),_0x447f4d,_0x47c887[_0x1c52('0x11')][_0x1c52('0x14')]);return _0x49cf7b(_0x47c887[_0x1c52('0x11')][_0x1c52('0x14')]);}logger[_0x1c52('0x11')]('ContactItemType,\x20%s,\x20%s',_0x447f4d,_0x47c887[_0x1c52('0x11')]['message']);return _0x3d64aa(_0x47c887['error'][_0x1c52('0x14')]);}else{logger['info'](_0x1c52('0x13'),_0x447f4d,'request\x20sent');_0x3d64aa(_0x47c887[_0x1c52('0x15')][_0x1c52('0x14')]);}})[_0x1c52('0x16')](function(_0x4d1770){logger[_0x1c52('0x11')](_0x1c52('0x13'),_0x447f4d,_0x4d1770);_0x49cf7b(_0x4d1770);});});} \ No newline at end of file +var _0x7e07=['../../config/environment','jayson/promise','http','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7e07,0xfc));var _0x77e0=function(_0x5e864f,_0x328d2e){_0x5e864f=_0x5e864f-0x0;var _0x48bc51=_0x7e07[_0x5e864f];return _0x48bc51;};'use strict';var _=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var moment=require(_0x77e0('0x2'));var BPromise=require(_0x77e0('0x3'));var rs=require(_0x77e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77e0('0x5'))['db'];var utils=require(_0x77e0('0x6'));var logger=require(_0x77e0('0x7'))('rpc');var config=require(_0x77e0('0x8'));var jayson=require(_0x77e0('0x9'));var client=jayson['client'][_0x77e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22af63,_0x2c0439,_0x42b39f){return new BPromise(function(_0x43d0e2,_0x18e6d2){return client['request'](_0x22af63,_0x42b39f)['then'](function(_0x2ddf7d){logger[_0x77e0('0xb')](_0x77e0('0xc'),_0x2c0439,'request\x20sent');logger[_0x77e0('0xd')](_0x77e0('0xe'),_0x2c0439,_0x77e0('0xf'),JSON['stringify'](_0x2ddf7d));if(_0x2ddf7d[_0x77e0('0x10')]){if(_0x2ddf7d[_0x77e0('0x10')]['code']===0x1f4){logger[_0x77e0('0x10')](_0x77e0('0xc'),_0x2c0439,_0x2ddf7d[_0x77e0('0x10')][_0x77e0('0x11')]);return _0x18e6d2(_0x2ddf7d[_0x77e0('0x10')][_0x77e0('0x11')]);}logger[_0x77e0('0x10')](_0x77e0('0xc'),_0x2c0439,_0x2ddf7d[_0x77e0('0x10')][_0x77e0('0x11')]);return _0x43d0e2(_0x2ddf7d[_0x77e0('0x10')][_0x77e0('0x11')]);}else{logger[_0x77e0('0xb')](_0x77e0('0xc'),_0x2c0439,'request\x20sent');_0x43d0e2(_0x2ddf7d[_0x77e0('0x12')][_0x77e0('0x11')]);}})[_0x77e0('0x13')](function(_0x2f9bcb){logger['error'](_0x77e0('0xc'),_0x2c0439,_0x2f9bcb);_0x18e6d2(_0x2f9bcb);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e3be67e..85e9e66 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x744b=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x5ec2a5,_0x53f90c){var _0x27a436=function(_0x291525){while(--_0x291525){_0x5ec2a5['push'](_0x5ec2a5['shift']());}};_0x27a436(++_0x53f90c);}(_0x744b,0x142));var _0xb744=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0x744b[_0x2e1907];return _0x401555;};'use strict';var multer=require(_0xb744('0x0'));var util=require(_0xb744('0x1'));var path=require(_0xb744('0x2'));var timeout=require(_0xb744('0x3'));var express=require(_0xb744('0x4'));var router=express['Router']();var fs_extra=require(_0xb744('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb744('0x6'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xb744('0x7')]('/',auth[_0xb744('0x8')](),controller['index']);router[_0xb744('0x7')](_0xb744('0x9'),auth[_0xb744('0x8')](),controller[_0xb744('0xa')]);router[_0xb744('0xb')]('/',auth[_0xb744('0x8')](),controller[_0xb744('0xc')]);router[_0xb744('0xd')](_0xb744('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb744('0xe')](_0xb744('0x9'),auth[_0xb744('0x8')](),controller[_0xb744('0xf')]);module['exports']=router; \ No newline at end of file +var _0x28ea=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','post'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x28ea,0x101));var _0xa28e=function(_0x93763c,_0xb7dd3c){_0x93763c=_0x93763c-0x0;var _0x3cff9c=_0x28ea[_0x93763c];return _0x3cff9c;};'use strict';var multer=require('multer');var util=require(_0xa28e('0x0'));var path=require('path');var timeout=require(_0xa28e('0x1'));var express=require(_0xa28e('0x2'));var router=express[_0xa28e('0x3')]();var fs_extra=require(_0xa28e('0x4'));var auth=require(_0xa28e('0x5'));var interaction=require(_0xa28e('0x6'));var config=require(_0xa28e('0x7'));var controller=require(_0xa28e('0x8'));router[_0xa28e('0x9')]('/',auth[_0xa28e('0xa')](),controller['index']);router['get'](_0xa28e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa28e('0xc')]('/',auth[_0xa28e('0xa')](),controller['create']);router[_0xa28e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa28e('0xe')]);router[_0xa28e('0xf')]('/:id',auth[_0xa28e('0xa')](),controller[_0xa28e('0x10')]);module[_0xa28e('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 8c8c61c..b121b39 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 _0x757a=['exports','STRING'];(function(_0x4a5f7d,_0x310d5e){var _0x5d3052=function(_0x57c9cf){while(--_0x57c9cf){_0x4a5f7d['push'](_0x4a5f7d['shift']());}};_0x5d3052(++_0x310d5e);}(_0x757a,0xde));var _0xa757=function(_0x421023,_0x3c5370){_0x421023=_0x421023-0x0;var _0x5b323a=_0x757a[_0x421023];return _0x5b323a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 97af0df..77d2ac3 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 _0xbb11=['redis','defaults','socket.io-emitter','sendStatus','json','offset','undefined','limit','count','Content-Range','save','destroy','get','CustomDashboards','UserProfileResource','then','status','end','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','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','clone','omit','updatedAt','createdAt','autoAssociation','update','iframe','attrUrl','attrs','https://','value','clock','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','sort','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x791b75,_0x764053){var _0x51e3d6=function(_0xacf5df){while(--_0xacf5df){_0x791b75['push'](_0x791b75['shift']());}};_0x51e3d6(++_0x764053);}(_0xbb11,0x64));var _0x1bb1=function(_0x2a0b35,_0x287480){_0x2a0b35=_0x2a0b35-0x0;var _0x425aba=_0xbb11[_0x2a0b35];return _0x425aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bb1('0x0'));var zipdir=require(_0x1bb1('0x1'));var jsonpatch=require(_0x1bb1('0x2'));var rp=require(_0x1bb1('0x3'));var moment=require(_0x1bb1('0x4'));var BPromise=require(_0x1bb1('0x5'));var Mustache=require(_0x1bb1('0x6'));var util=require(_0x1bb1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1bb1('0x8'));var ejs=require(_0x1bb1('0x9'));var fs=require('fs');var fs_extra=require(_0x1bb1('0xa'));var _=require('lodash');var squel=require(_0x1bb1('0xb'));var crypto=require(_0x1bb1('0xc'));var jsforce=require(_0x1bb1('0xd'));var deskjs=require(_0x1bb1('0xe'));var toCsv=require(_0x1bb1('0x8'));var querystring=require(_0x1bb1('0xf'));var Papa=require(_0x1bb1('0x10'));var Redis=require('ioredis');var authService=require(_0x1bb1('0x11'));var qs=require(_0x1bb1('0x12'));var as=require(_0x1bb1('0x13'));var hardwareService=require(_0x1bb1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1bb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1bb1('0x16'));var db=require(_0x1bb1('0x17'))['db'];config[_0x1bb1('0x18')]=_[_0x1bb1('0x19')](config[_0x1bb1('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bb1('0x1a'))(new Redis(config[_0x1bb1('0x18')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x4dad5a,_0x3008b3){_0x3008b3=_0x3008b3||0xcc;return function(_0x2cffa0){if(_0x2cffa0){return _0x4dad5a[_0x1bb1('0x1b')](_0x3008b3);}return _0x4dad5a['status'](_0x3008b3)['end']();};}function respondWithResult(_0x2c9337,_0x349cc6){_0x349cc6=_0x349cc6||0xc8;return function(_0xb36c46){if(_0xb36c46){return _0x2c9337['status'](_0x349cc6)[_0x1bb1('0x1c')](_0xb36c46);}};}function respondWithFilteredResult(_0x973b94,_0x28378a){return function(_0x445102){if(_0x445102){var _0x484ae2=typeof _0x28378a[_0x1bb1('0x1d')]===_0x1bb1('0x1e')&&typeof _0x28378a[_0x1bb1('0x1f')]===_0x1bb1('0x1e');var _0xbf97f9=_0x445102[_0x1bb1('0x20')];var _0x2d0e77=_0x484ae2?0x0:_0x28378a['offset'];var _0x33ca29=_0x484ae2?_0x445102[_0x1bb1('0x20')]:_0x28378a[_0x1bb1('0x1d')]+_0x28378a[_0x1bb1('0x1f')];var _0x2ded2e;if(_0x33ca29>=_0xbf97f9){_0x33ca29=_0xbf97f9;_0x2ded2e=0xc8;}else{_0x2ded2e=0xce;}_0x973b94['status'](_0x2ded2e);return _0x973b94['set'](_0x1bb1('0x21'),_0x2d0e77+'-'+_0x33ca29+'/'+_0xbf97f9)['json'](_0x445102);}return null;};}function patchUpdates(_0x133bea){return function(_0x2c37c9){try{jsonpatch['apply'](_0x2c37c9,_0x133bea,!![]);}catch(_0x559532){return BPromise['reject'](_0x559532);}return _0x2c37c9[_0x1bb1('0x22')]();};}function saveUpdates(_0x33faef,_0x4382c7){return function(_0x4f0b74){if(_0x4f0b74){return _0x4f0b74['update'](_0x33faef)['then'](function(_0x5ea0d0){return _0x5ea0d0;});}return null;};}function removeEntity(_0x5662b3,_0x13adbb){return function(_0x15ac67){if(_0x15ac67){return _0x15ac67[_0x1bb1('0x23')]()['then'](function(){var _0x5d282d=_0x15ac67[_0x1bb1('0x24')]({'plain':!![]});var _0x3fd2f0=_0x1bb1('0x25');return db[_0x1bb1('0x26')][_0x1bb1('0x23')]({'where':{'type':_0x3fd2f0,'resourceId':_0x5d282d['id']}})['then'](function(){return _0x15ac67;});})[_0x1bb1('0x27')](function(){_0x5662b3[_0x1bb1('0x28')](0xcc)[_0x1bb1('0x29')]();});}};}function handleEntityNotFound(_0x389d79,_0x485213){return function(_0x20f3b4){if(!_0x20f3b4){_0x389d79[_0x1bb1('0x1b')](0x194);}return _0x20f3b4;};}function handleError(_0xf76f0b,_0x1190b2){_0x1190b2=_0x1190b2||0x1f4;return function(_0x59794c){logger['error'](_0x59794c[_0x1bb1('0x2a')]);if(_0x59794c['name']){delete _0x59794c[_0x1bb1('0x2b')];}_0xf76f0b['status'](_0x1190b2)[_0x1bb1('0x2c')](_0x59794c);};}exports[_0x1bb1('0x2d')]=function(_0xffdf4a,_0x47965e){var _0x38423e={},_0x17abf2={},_0x39c976={'count':0x0,'rows':[]};var _0x5eafc9=_[_0x1bb1('0x2e')](db[_0x1bb1('0x2f')][_0x1bb1('0x30')],function(_0x44a263){return{'name':_0x44a263[_0x1bb1('0x31')],'type':_0x44a263[_0x1bb1('0x32')]['key']};});_0x17abf2[_0x1bb1('0x33')]=_[_0x1bb1('0x2e')](_0x5eafc9,_0x1bb1('0x2b'));_0x17abf2[_0x1bb1('0x34')]=_[_0x1bb1('0x35')](_0xffdf4a['query']);_0x17abf2[_0x1bb1('0x36')]=_[_0x1bb1('0x37')](_0x17abf2[_0x1bb1('0x33')],_0x17abf2[_0x1bb1('0x34')]);_0x38423e[_0x1bb1('0x38')]=_['intersection'](_0x17abf2['model'],qs[_0x1bb1('0x39')](_0xffdf4a['query'][_0x1bb1('0x39')]));_0x38423e[_0x1bb1('0x38')]=_0x38423e[_0x1bb1('0x38')]['length']?_0x38423e[_0x1bb1('0x38')]:_0x17abf2[_0x1bb1('0x33')];if(!_0xffdf4a[_0x1bb1('0x34')]['hasOwnProperty'](_0x1bb1('0x3a'))){_0x38423e[_0x1bb1('0x1f')]=qs[_0x1bb1('0x1f')](_0xffdf4a[_0x1bb1('0x34')][_0x1bb1('0x1f')]);_0x38423e[_0x1bb1('0x1d')]=qs[_0x1bb1('0x1d')](_0xffdf4a[_0x1bb1('0x34')][_0x1bb1('0x1d')]);}_0x38423e[_0x1bb1('0x3b')]=qs['sort'](_0xffdf4a['query']['sort']);_0x38423e['where']=qs[_0x1bb1('0x36')](_[_0x1bb1('0x3c')](_0xffdf4a[_0x1bb1('0x34')],_0x17abf2[_0x1bb1('0x36')]),_0x5eafc9);if(_0xffdf4a[_0x1bb1('0x34')][_0x1bb1('0x3d')]){_0x38423e[_0x1bb1('0x3e')]=_[_0x1bb1('0x3f')](_0x38423e[_0x1bb1('0x3e')],{'$or':_[_0x1bb1('0x2e')](_0x5eafc9,function(_0x449e92){if(_0x449e92[_0x1bb1('0x32')]!==_0x1bb1('0x40')){var _0x2651fe={};_0x2651fe[_0x449e92[_0x1bb1('0x2b')]]={'$like':'%'+_0xffdf4a[_0x1bb1('0x34')][_0x1bb1('0x3d')]+'%'};return _0x2651fe;}})});}_0x38423e=_[_0x1bb1('0x3f')]({},_0x38423e,_0xffdf4a[_0x1bb1('0x41')]);var _0x5e2996={'where':_0x38423e['where']};return db[_0x1bb1('0x2f')]['count'](_0x5e2996)[_0x1bb1('0x27')](function(_0x3772c4){_0x39c976['count']=_0x3772c4;if(_0xffdf4a[_0x1bb1('0x34')][_0x1bb1('0x42')]){_0x38423e[_0x1bb1('0x43')]=[{'all':!![]}];}return db[_0x1bb1('0x2f')][_0x1bb1('0x44')](_0x38423e);})[_0x1bb1('0x27')](function(_0x46b5f8){_0x39c976[_0x1bb1('0x45')]=_0x46b5f8;return _0x39c976;})[_0x1bb1('0x27')](respondWithFilteredResult(_0x47965e,_0x38423e))[_0x1bb1('0x46')](handleError(_0x47965e,null));};exports[_0x1bb1('0x47')]=function(_0x278b13,_0x42b1fc){var _0x198866={'raw':![],'where':{'id':_0x278b13[_0x1bb1('0x48')]['id']}},_0x3337a3={};_0x3337a3[_0x1bb1('0x33')]=_[_0x1bb1('0x35')](db[_0x1bb1('0x2f')][_0x1bb1('0x30')]);_0x3337a3['query']=_[_0x1bb1('0x35')](_0x278b13[_0x1bb1('0x34')]);_0x3337a3['filters']=_['intersection'](_0x3337a3['model'],_0x3337a3[_0x1bb1('0x34')]);_0x198866[_0x1bb1('0x38')]=_['intersection'](_0x3337a3['model'],qs[_0x1bb1('0x39')](_0x278b13[_0x1bb1('0x34')][_0x1bb1('0x39')]));_0x198866[_0x1bb1('0x38')]=_0x198866[_0x1bb1('0x38')][_0x1bb1('0x49')]?_0x198866['attributes']:_0x3337a3[_0x1bb1('0x33')];if(_0x278b13[_0x1bb1('0x34')][_0x1bb1('0x42')]){_0x198866[_0x1bb1('0x43')]=[{'all':!![]}];}_0x198866=_[_0x1bb1('0x3f')]({},_0x198866,_0x278b13[_0x1bb1('0x41')]);return db[_0x1bb1('0x2f')][_0x1bb1('0x4a')](_0x198866)['then'](handleEntityNotFound(_0x42b1fc,null))[_0x1bb1('0x27')](respondWithResult(_0x42b1fc,null))['catch'](handleError(_0x42b1fc,null));};exports[_0x1bb1('0x4b')]=function(_0x365625,_0x5b0931){return db[_0x1bb1('0x2f')][_0x1bb1('0x4b')](_0x365625[_0x1bb1('0x4c')],{})[_0x1bb1('0x27')](function(_0x1ed1ec){var _0xae8612=_0x365625[_0x1bb1('0x4d')]['get']({'plain':!![]});if(!_0xae8612)throw new Error(_0x1bb1('0x4e'));if(_0xae8612[_0x1bb1('0x4f')]===_0x1bb1('0x4d')){var _0x40b0b6=_0x1ed1ec[_0x1bb1('0x24')]({'plain':!![]});var _0x3acd02=_0x1bb1('0x25');return db[_0x1bb1('0x50')][_0x1bb1('0x4a')]({'where':{'name':_0x3acd02,'userProfileId':_0xae8612[_0x1bb1('0x51')]},'raw':!![]})[_0x1bb1('0x27')](function(_0xa8ded1){if(_0xa8ded1&&_0xa8ded1['autoAssociation']===0x0){return db[_0x1bb1('0x26')]['create']({'name':_0x40b0b6['name'],'resourceId':_0x40b0b6['id'],'type':_0xa8ded1[_0x1bb1('0x2b')],'sectionId':_0xa8ded1['id']},{})['then'](function(){return _0x1ed1ec;});}else{return _0x1ed1ec;}})[_0x1bb1('0x46')](function(_0x21707a){logger[_0x1bb1('0x52')](_0x1bb1('0x53'),_0x21707a);throw _0x21707a;});}return _0x1ed1ec;})[_0x1bb1('0x27')](respondWithResult(_0x5b0931,0xc9))[_0x1bb1('0x46')](handleError(_0x5b0931,null));};exports[_0x1bb1('0x54')]=function(_0x429511,_0x302113){var _0x4233fc={'where':{'id':_0x429511['params']['id']}},_0x5af5f2={};_0x5af5f2[_0x1bb1('0x33')]=_[_0x1bb1('0x35')](db[_0x1bb1('0x2f')]['rawAttributes']);_0x4233fc['attributes']=_[_0x1bb1('0x37')](_0x5af5f2[_0x1bb1('0x33')],qs['fields'](_0x429511[_0x1bb1('0x34')][_0x1bb1('0x39')]));_0x4233fc[_0x1bb1('0x38')]=_0x4233fc[_0x1bb1('0x38')][_0x1bb1('0x49')]?_0x4233fc[_0x1bb1('0x38')]:_0x5af5f2[_0x1bb1('0x33')];if(_0x429511[_0x1bb1('0x34')][_0x1bb1('0x42')]){_0x4233fc['include']=[{'all':!![]}];}_0x4233fc=_[_0x1bb1('0x3f')]({},_0x4233fc,_0x429511[_0x1bb1('0x41')]);return db['Dashboard'][_0x1bb1('0x4a')](_0x4233fc)['then'](handleEntityNotFound(_0x302113,null))[_0x1bb1('0x27')](function(_0x848079){if(_0x848079){var _0x35c65e=_0x848079['get']({'plain':!![]});_0x35c65e=qs[_0x1bb1('0x55')](_0x35c65e,['id','createdAt',_0x1bb1('0x56')]);_0x429511[_0x1bb1('0x4c')]=_[_0x1bb1('0x55')](_0x429511[_0x1bb1('0x4c')],['id',_0x1bb1('0x57'),_0x1bb1('0x56')]);return db[_0x1bb1('0x2f')][_0x1bb1('0x4b')](_['merge'](_0x35c65e,_0x429511[_0x1bb1('0x4c')]),{'include':_0x429511[_0x1bb1('0x34')][_0x1bb1('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x1ed92e){var _0x411697=_0x429511[_0x1bb1('0x4d')][_0x1bb1('0x24')]({'plain':!![]});if(!_0x411697)throw new Error(_0x1bb1('0x4e'));if(_0x411697[_0x1bb1('0x4f')]===_0x1bb1('0x4d')){var _0x41b198=_0x1ed92e['get']({'plain':!![]});var _0x2166b7=_0x1bb1('0x25');return db[_0x1bb1('0x50')][_0x1bb1('0x4a')]({'where':{'name':_0x2166b7,'userProfileId':_0x411697[_0x1bb1('0x51')]},'raw':!![]})['then'](function(_0x1b19a3){if(_0x1b19a3&&_0x1b19a3[_0x1bb1('0x58')]===0x0){return db[_0x1bb1('0x26')][_0x1bb1('0x4b')]({'name':_0x41b198[_0x1bb1('0x2b')],'resourceId':_0x41b198['id'],'type':_0x1b19a3[_0x1bb1('0x2b')],'sectionId':_0x1b19a3['id']},{})['then'](function(){return _0x1ed92e;});}else{return _0x1ed92e;}})[_0x1bb1('0x46')](function(_0x4ce92f){logger[_0x1bb1('0x52')](_0x1bb1('0x53'),_0x4ce92f);throw _0x4ce92f;});}return _0x1ed92e;});}})[_0x1bb1('0x27')](respondWithResult(_0x302113,0xc9))[_0x1bb1('0x46')](handleError(_0x302113,null));};exports[_0x1bb1('0x59')]=function(_0x4009ab,_0x1b9dbf){if(_0x4009ab['body']['id']){delete _0x4009ab[_0x1bb1('0x4c')]['id'];}return db[_0x1bb1('0x2f')][_0x1bb1('0x4a')]({'where':{'id':_0x4009ab[_0x1bb1('0x48')]['id']}})[_0x1bb1('0x27')](handleEntityNotFound(_0x1b9dbf,null))[_0x1bb1('0x27')](saveUpdates(_0x4009ab[_0x1bb1('0x4c')],null))[_0x1bb1('0x27')](respondWithResult(_0x1b9dbf,null))[_0x1bb1('0x46')](handleError(_0x1b9dbf,null));};exports[_0x1bb1('0x23')]=function(_0x467ce1,_0x140971){return db[_0x1bb1('0x2f')][_0x1bb1('0x4a')]({'where':{'id':_0x467ce1[_0x1bb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x140971,null))[_0x1bb1('0x27')](removeEntity(_0x140971,null))['catch'](handleError(_0x140971,null));};function widgetAttributes(_0x442d4a){try{switch(_0x442d4a[_0x1bb1('0x32')]){case _0x1bb1('0x5a'):return[{'name':_0x1bb1('0x5b'),'value':_0x442d4a[_0x1bb1('0x5b')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0]['value']:undefined)||_0x1bb1('0x5d')}];case'custom':return[{'name':'attrPath','value':_0x442d4a['attrPath']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0][_0x1bb1('0x5e')]:undefined)||''}];case _0x1bb1('0x5f'):return[{'name':'attrHourFormat','value':_0x442d4a['attrHourFormat']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0][_0x1bb1('0x5e')]:undefined)||'HH:mm:ss'},{'name':_0x1bb1('0x60'),'value':_0x442d4a[_0x1bb1('0x60')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x1]?_0x442d4a[_0x1bb1('0x5c')][0x1][_0x1bb1('0x5e')]:undefined)||'0.00'},{'name':_0x1bb1('0x61'),'value':_0x442d4a[_0x1bb1('0x61')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x2]?_0x442d4a[_0x1bb1('0x5c')][0x2][_0x1bb1('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0x1bb1('0x62'),'value':_0x442d4a[_0x1bb1('0x62')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a['attrs'][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0][_0x1bb1('0x5e')]:undefined)||'total'},{'name':_0x1bb1('0x63'),'value':_0x442d4a[_0x1bb1('0x63')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x1]?_0x442d4a[_0x1bb1('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x1bb1('0x61'),'value':_0x442d4a['attrFontSize']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x2]?_0x442d4a[_0x1bb1('0x5c')][0x2][_0x1bb1('0x5e')]:undefined)||0x14},{'name':_0x1bb1('0x64'),'value':_0x442d4a[_0x1bb1('0x64')]||(_0x442d4a['attrs']&&_0x442d4a['attrs'][0x3]?_0x442d4a['attrs'][0x3][_0x1bb1('0x5e')]:undefined)||_0x1bb1('0x65')},{'name':_0x1bb1('0x66'),'value':_0x442d4a[_0x1bb1('0x66')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x4]?_0x442d4a[_0x1bb1('0x5c')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x442d4a[_0x1bb1('0x67')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x5]?_0x442d4a[_0x1bb1('0x5c')][0x5][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x68'),'value':_0x442d4a[_0x1bb1('0x68')]||(_0x442d4a['attrs']&&_0x442d4a[_0x1bb1('0x5c')][0x6]?_0x442d4a[_0x1bb1('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x442d4a[_0x1bb1('0x69')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x7]?_0x442d4a[_0x1bb1('0x5c')][0x7][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x6a'),'value':_0x442d4a[_0x1bb1('0x6a')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a['attrs'][0x8]?_0x442d4a['attrs'][0x8][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x6b'),'value':_0x442d4a[_0x1bb1('0x6b')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x9]?_0x442d4a[_0x1bb1('0x5c')][0x9][_0x1bb1('0x5e')]:undefined)||''}];case _0x1bb1('0x6c'):case'pie-chart':return[{'name':_0x1bb1('0x6d'),'value':_0x442d4a[_0x1bb1('0x6d')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0]['value']:undefined)||_0x1bb1('0x6e')},{'name':'attrSerie2','value':_0x442d4a[_0x1bb1('0x6f')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x1]?_0x442d4a[_0x1bb1('0x5c')][0x1][_0x1bb1('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x442d4a[_0x1bb1('0x70')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a['attrs'][0x2]?_0x442d4a[_0x1bb1('0x5c')][0x2][_0x1bb1('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x442d4a['attrVoiceQueues']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x3]?_0x442d4a[_0x1bb1('0x5c')][0x3][_0x1bb1('0x5e')]:undefined)||[]},{'name':_0x1bb1('0x64'),'value':_0x442d4a['attrChannel']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a['attrs'][0x4]?_0x442d4a[_0x1bb1('0x5c')][0x4][_0x1bb1('0x5e')]:undefined)||_0x1bb1('0x65')},{'name':_0x1bb1('0x66'),'value':_0x442d4a[_0x1bb1('0x66')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x5]?_0x442d4a[_0x1bb1('0x5c')][0x5][_0x1bb1('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x442d4a['attrFaxAccounts']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x6]?_0x442d4a[_0x1bb1('0x5c')][0x6][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x68'),'value':_0x442d4a[_0x1bb1('0x68')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x7]?_0x442d4a['attrs'][0x7]['value']:undefined)||''},{'name':_0x1bb1('0x69'),'value':_0x442d4a[_0x1bb1('0x69')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x8]?_0x442d4a[_0x1bb1('0x5c')][0x8][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x6a'),'value':_0x442d4a['attrWhatsappAccounts']||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x9]?_0x442d4a[_0x1bb1('0x5c')][0x9][_0x1bb1('0x5e')]:undefined)||''},{'name':_0x1bb1('0x6b'),'value':_0x442d4a[_0x1bb1('0x6b')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0xa]?_0x442d4a[_0x1bb1('0x5c')][0xa][_0x1bb1('0x5e')]:undefined)||''}];case _0x1bb1('0x71'):return[{'name':'attrReport','type':_0x442d4a[_0x1bb1('0x72')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a[_0x1bb1('0x5c')][0x0][_0x1bb1('0x32')]:undefined)||null,'value':_0x442d4a['attrReport']||(_0x442d4a['attrs']&&_0x442d4a[_0x1bb1('0x5c')][0x0]?_0x442d4a['attrs'][0x0]['value']:undefined)||null},{'name':_0x1bb1('0x73'),'value':_0x442d4a[_0x1bb1('0x73')]||(_0x442d4a[_0x1bb1('0x5c')]&&_0x442d4a[_0x1bb1('0x5c')][0x1]?_0x442d4a[_0x1bb1('0x5c')][0x1][_0x1bb1('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x5c402c){logger['error']('widgetAttributes:\x20%s',JSON[_0x1bb1('0x74')](_0x5c402c));return[];}}exports[_0x1bb1('0x75')]=function(_0x3757b9,_0x17422e,_0x2ecfac){if(_0x3757b9[_0x1bb1('0x4c')]['id']){delete _0x3757b9[_0x1bb1('0x4c')]['id'];}return db[_0x1bb1('0x2f')][_0x1bb1('0x4a')]({'where':{'id':_0x3757b9[_0x1bb1('0x48')]['id']}})[_0x1bb1('0x27')](handleEntityNotFound(_0x17422e,null))[_0x1bb1('0x27')](function(_0x41f4a7){if(_0x41f4a7){_0x3757b9['body'][_0x1bb1('0x76')]=_0x41f4a7['id'];_0x3757b9[_0x1bb1('0x4c')][_0x1bb1('0x5c')]=widgetAttributes(_0x3757b9[_0x1bb1('0x4c')]);return db['DashboardItem']['create'](_0x3757b9[_0x1bb1('0x4c')]);}})[_0x1bb1('0x27')](respondWithResult(_0x17422e,null))[_0x1bb1('0x46')](handleError(_0x17422e,null));};exports[_0x1bb1('0x77')]=function(_0x489bad,_0x125586,_0x429752){var _0x2f9711={};var _0x37ec2={};var _0x109313;var _0x3ede59;return db['Dashboard'][_0x1bb1('0x78')]({'where':{'id':_0x489bad[_0x1bb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x125586,null))[_0x1bb1('0x27')](function(_0xc9af0c){if(_0xc9af0c){_0x109313=_0xc9af0c;_0x37ec2[_0x1bb1('0x33')]=_[_0x1bb1('0x35')](db[_0x1bb1('0x79')]['rawAttributes']);_0x37ec2[_0x1bb1('0x34')]=_['keys'](_0x489bad[_0x1bb1('0x34')]);_0x37ec2[_0x1bb1('0x36')]=_[_0x1bb1('0x37')](_0x37ec2[_0x1bb1('0x33')],_0x37ec2['query']);_0x2f9711[_0x1bb1('0x38')]=_['intersection'](_0x37ec2[_0x1bb1('0x33')],qs[_0x1bb1('0x39')](_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x39')]));_0x2f9711[_0x1bb1('0x38')]=_0x2f9711[_0x1bb1('0x38')][_0x1bb1('0x49')]?_0x2f9711[_0x1bb1('0x38')]:_0x37ec2[_0x1bb1('0x33')];_0x2f9711[_0x1bb1('0x3b')]=qs[_0x1bb1('0x7a')](_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x7a')]);_0x2f9711[_0x1bb1('0x3e')]=qs[_0x1bb1('0x36')](_[_0x1bb1('0x3c')](_0x489bad[_0x1bb1('0x34')],_0x37ec2[_0x1bb1('0x36')]));if(_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x3d')]){_0x2f9711[_0x1bb1('0x3e')]=_['merge'](_0x2f9711[_0x1bb1('0x3e')],{'$or':_['map'](_0x2f9711[_0x1bb1('0x38')],function(_0x59f5df){var _0x2408c2={};_0x2408c2[_0x59f5df]={'$like':'%'+_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x3d')]+'%'};return _0x2408c2;})});}_0x2f9711=_[_0x1bb1('0x3f')]({},_0x2f9711,_0x489bad[_0x1bb1('0x41')]);return _0x109313[_0x1bb1('0x77')](_0x2f9711);}})[_0x1bb1('0x27')](function(_0x2a7178){if(_0x2a7178){_0x3ede59=_0x2a7178[_0x1bb1('0x49')];if(!_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x7b')]('nolimit')){_0x2f9711[_0x1bb1('0x1f')]=qs[_0x1bb1('0x1f')](_0x489bad['query'][_0x1bb1('0x1f')]);_0x2f9711[_0x1bb1('0x1d')]=qs[_0x1bb1('0x1d')](_0x489bad[_0x1bb1('0x34')][_0x1bb1('0x1d')]);}return _0x109313[_0x1bb1('0x77')](_0x2f9711);}})['then'](function(_0x1471f7){if(_0x1471f7){return _0x1471f7?{'count':_0x3ede59,'rows':_0x1471f7}:null;}})[_0x1bb1('0x27')](respondWithResult(_0x125586,null))[_0x1bb1('0x46')](handleError(_0x125586,null));}; \ No newline at end of file +var _0x540d=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','error','stack','send','index','Dashboard','fieldName','type','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrEmailAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x37e961,_0x457dba){var _0x5862b5=function(_0x3a0d85){while(--_0x3a0d85){_0x37e961['push'](_0x37e961['shift']());}};_0x5862b5(++_0x457dba);}(_0x540d,0x17b));var _0xd540=function(_0x4c2ff1,_0x172770){_0x4c2ff1=_0x4c2ff1-0x0;var _0x3b3674=_0x540d[_0x4c2ff1];return _0x3b3674;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd540('0x0'));var jsonpatch=require(_0xd540('0x1'));var rp=require(_0xd540('0x2'));var moment=require(_0xd540('0x3'));var BPromise=require(_0xd540('0x4'));var Mustache=require('mustache');var util=require(_0xd540('0x5'));var path=require(_0xd540('0x6'));var sox=require(_0xd540('0x7'));var csv=require(_0xd540('0x8'));var ejs=require(_0xd540('0x9'));var fs=require('fs');var fs_extra=require(_0xd540('0xa'));var _=require(_0xd540('0xb'));var squel=require(_0xd540('0xc'));var crypto=require('crypto');var jsforce=require(_0xd540('0xd'));var deskjs=require(_0xd540('0xe'));var toCsv=require(_0xd540('0x8'));var querystring=require(_0xd540('0xf'));var Papa=require(_0xd540('0x10'));var Redis=require(_0xd540('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd540('0x12'));var as=require(_0xd540('0x13'));var hardwareService=require(_0xd540('0x14'));var logger=require('../../config/logger')(_0xd540('0x15'));var utils=require('../../config/utils');var config=require(_0xd540('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd540('0x17'))['db'];config[_0xd540('0x18')]=_['defaults'](config['redis'],{'host':_0xd540('0x19'),'port':0x18eb});var socket=require(_0xd540('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x4cb581,_0x251c11){_0x251c11=_0x251c11||0xcc;return function(_0x5d25ec){if(_0x5d25ec){return _0x4cb581[_0xd540('0x1b')](_0x251c11);}return _0x4cb581[_0xd540('0x1c')](_0x251c11)[_0xd540('0x1d')]();};}function respondWithResult(_0xce4b7d,_0x4aa438){_0x4aa438=_0x4aa438||0xc8;return function(_0x514054){if(_0x514054){return _0xce4b7d[_0xd540('0x1c')](_0x4aa438)['json'](_0x514054);}};}function respondWithFilteredResult(_0x1319a6,_0x473e77){return function(_0x5bc150){if(_0x5bc150){var _0x5d3897=typeof _0x473e77[_0xd540('0x1e')]===_0xd540('0x1f')&&typeof _0x473e77[_0xd540('0x20')]==='undefined';var _0x5a0f14=_0x5bc150['count'];var _0xda4a60=_0x5d3897?0x0:_0x473e77['offset'];var _0x40bd7d=_0x5d3897?_0x5bc150[_0xd540('0x21')]:_0x473e77[_0xd540('0x1e')]+_0x473e77[_0xd540('0x20')];var _0x127e6d;if(_0x40bd7d>=_0x5a0f14){_0x40bd7d=_0x5a0f14;_0x127e6d=0xc8;}else{_0x127e6d=0xce;}_0x1319a6['status'](_0x127e6d);return _0x1319a6[_0xd540('0x22')](_0xd540('0x23'),_0xda4a60+'-'+_0x40bd7d+'/'+_0x5a0f14)[_0xd540('0x24')](_0x5bc150);}return null;};}function patchUpdates(_0x2675a5){return function(_0x302b2d){try{jsonpatch[_0xd540('0x25')](_0x302b2d,_0x2675a5,!![]);}catch(_0x3baa3c){return BPromise[_0xd540('0x26')](_0x3baa3c);}return _0x302b2d[_0xd540('0x27')]();};}function saveUpdates(_0x289c3b,_0x56be52){return function(_0x39df1d){if(_0x39df1d){return _0x39df1d[_0xd540('0x28')](_0x289c3b)[_0xd540('0x29')](function(_0x474d0e){return _0x474d0e;});}return null;};}function removeEntity(_0xb96470,_0x45f374){return function(_0x2e537e){if(_0x2e537e){return _0x2e537e[_0xd540('0x2a')]()[_0xd540('0x29')](function(){var _0x470d64=_0x2e537e['get']({'plain':!![]});var _0x3958b7=_0xd540('0x2b');return db[_0xd540('0x2c')][_0xd540('0x2a')]({'where':{'type':_0x3958b7,'resourceId':_0x470d64['id']}})[_0xd540('0x29')](function(){return _0x2e537e;});})[_0xd540('0x29')](function(){_0xb96470[_0xd540('0x1c')](0xcc)[_0xd540('0x1d')]();});}};}function handleEntityNotFound(_0x5052eb,_0x1792bb){return function(_0x6864f4){if(!_0x6864f4){_0x5052eb[_0xd540('0x1b')](0x194);}return _0x6864f4;};}function handleError(_0x46cab3,_0x3d5a50){_0x3d5a50=_0x3d5a50||0x1f4;return function(_0x5563f5){logger[_0xd540('0x2d')](_0x5563f5[_0xd540('0x2e')]);if(_0x5563f5['name']){delete _0x5563f5['name'];}_0x46cab3['status'](_0x3d5a50)[_0xd540('0x2f')](_0x5563f5);};}exports[_0xd540('0x30')]=function(_0x181479,_0x67cb4b){var _0x38bb40={},_0x3ccd8f={},_0x4b906b={'count':0x0,'rows':[]};var _0x5ba7aa=_['map'](db[_0xd540('0x31')]['rawAttributes'],function(_0xec701a){return{'name':_0xec701a[_0xd540('0x32')],'type':_0xec701a[_0xd540('0x33')]['key']};});_0x3ccd8f[_0xd540('0x34')]=_[_0xd540('0x35')](_0x5ba7aa,_0xd540('0x36'));_0x3ccd8f[_0xd540('0x37')]=_[_0xd540('0x38')](_0x181479['query']);_0x3ccd8f[_0xd540('0x39')]=_[_0xd540('0x3a')](_0x3ccd8f[_0xd540('0x34')],_0x3ccd8f['query']);_0x38bb40['attributes']=_['intersection'](_0x3ccd8f['model'],qs['fields'](_0x181479[_0xd540('0x37')][_0xd540('0x3b')]));_0x38bb40[_0xd540('0x3c')]=_0x38bb40[_0xd540('0x3c')][_0xd540('0x3d')]?_0x38bb40[_0xd540('0x3c')]:_0x3ccd8f[_0xd540('0x34')];if(!_0x181479[_0xd540('0x37')][_0xd540('0x3e')]('nolimit')){_0x38bb40['limit']=qs[_0xd540('0x20')](_0x181479['query']['limit']);_0x38bb40[_0xd540('0x1e')]=qs['offset'](_0x181479[_0xd540('0x37')][_0xd540('0x1e')]);}_0x38bb40[_0xd540('0x3f')]=qs[_0xd540('0x40')](_0x181479[_0xd540('0x37')]['sort']);_0x38bb40[_0xd540('0x41')]=qs[_0xd540('0x39')](_[_0xd540('0x42')](_0x181479[_0xd540('0x37')],_0x3ccd8f[_0xd540('0x39')]),_0x5ba7aa);if(_0x181479['query'][_0xd540('0x43')]){_0x38bb40[_0xd540('0x41')]=_['merge'](_0x38bb40['where'],{'$or':_[_0xd540('0x35')](_0x5ba7aa,function(_0x11e091){if(_0x11e091[_0xd540('0x33')]!==_0xd540('0x44')){var _0x19dd20={};_0x19dd20[_0x11e091[_0xd540('0x36')]]={'$like':'%'+_0x181479['query']['filter']+'%'};return _0x19dd20;}})});}_0x38bb40=_['merge']({},_0x38bb40,_0x181479['options']);var _0xa5e5a7={'where':_0x38bb40[_0xd540('0x41')]};return db[_0xd540('0x31')][_0xd540('0x21')](_0xa5e5a7)['then'](function(_0x35c7d6){_0x4b906b[_0xd540('0x21')]=_0x35c7d6;if(_0x181479['query'][_0xd540('0x45')]){_0x38bb40[_0xd540('0x46')]=[{'all':!![]}];}return db[_0xd540('0x31')][_0xd540('0x47')](_0x38bb40);})[_0xd540('0x29')](function(_0x498436){_0x4b906b[_0xd540('0x48')]=_0x498436;return _0x4b906b;})[_0xd540('0x29')](respondWithFilteredResult(_0x67cb4b,_0x38bb40))[_0xd540('0x49')](handleError(_0x67cb4b,null));};exports['show']=function(_0x54c1a7,_0x4648c9){var _0x37a387={'raw':![],'where':{'id':_0x54c1a7[_0xd540('0x4a')]['id']}},_0x3c918d={};_0x3c918d['model']=_[_0xd540('0x38')](db[_0xd540('0x31')][_0xd540('0x4b')]);_0x3c918d[_0xd540('0x37')]=_[_0xd540('0x38')](_0x54c1a7[_0xd540('0x37')]);_0x3c918d[_0xd540('0x39')]=_[_0xd540('0x3a')](_0x3c918d[_0xd540('0x34')],_0x3c918d[_0xd540('0x37')]);_0x37a387[_0xd540('0x3c')]=_[_0xd540('0x3a')](_0x3c918d[_0xd540('0x34')],qs[_0xd540('0x3b')](_0x54c1a7[_0xd540('0x37')][_0xd540('0x3b')]));_0x37a387[_0xd540('0x3c')]=_0x37a387[_0xd540('0x3c')][_0xd540('0x3d')]?_0x37a387['attributes']:_0x3c918d['model'];if(_0x54c1a7[_0xd540('0x37')]['includeAll']){_0x37a387[_0xd540('0x46')]=[{'all':!![]}];}_0x37a387=_[_0xd540('0x4c')]({},_0x37a387,_0x54c1a7[_0xd540('0x4d')]);return db[_0xd540('0x31')][_0xd540('0x4e')](_0x37a387)['then'](handleEntityNotFound(_0x4648c9,null))[_0xd540('0x29')](respondWithResult(_0x4648c9,null))[_0xd540('0x49')](handleError(_0x4648c9,null));};exports[_0xd540('0x4f')]=function(_0x590a0a,_0x456801){return db[_0xd540('0x31')][_0xd540('0x4f')](_0x590a0a[_0xd540('0x50')],{})[_0xd540('0x29')](function(_0x22cdfc){var _0x2421a5=_0x590a0a[_0xd540('0x51')][_0xd540('0x52')]({'plain':!![]});if(!_0x2421a5)throw new Error(_0xd540('0x53'));if(_0x2421a5['role']==='user'){var _0x2bb5e5=_0x22cdfc['get']({'plain':!![]});var _0x462402=_0xd540('0x2b');return db[_0xd540('0x54')][_0xd540('0x4e')]({'where':{'name':_0x462402,'userProfileId':_0x2421a5[_0xd540('0x55')]},'raw':!![]})[_0xd540('0x29')](function(_0x1e80ba){if(_0x1e80ba&&_0x1e80ba[_0xd540('0x56')]===0x0){return db[_0xd540('0x2c')][_0xd540('0x4f')]({'name':_0x2bb5e5[_0xd540('0x36')],'resourceId':_0x2bb5e5['id'],'type':_0x1e80ba['name'],'sectionId':_0x1e80ba['id']},{})['then'](function(){return _0x22cdfc;});}else{return _0x22cdfc;}})[_0xd540('0x49')](function(_0x4bc820){logger[_0xd540('0x2d')](_0xd540('0x57'),_0x4bc820);throw _0x4bc820;});}return _0x22cdfc;})[_0xd540('0x29')](respondWithResult(_0x456801,0xc9))[_0xd540('0x49')](handleError(_0x456801,null));};exports[_0xd540('0x58')]=function(_0x20c69f,_0x2b15fc){var _0x11bc72={'where':{'id':_0x20c69f[_0xd540('0x4a')]['id']}},_0xefe060={};_0xefe060[_0xd540('0x34')]=_[_0xd540('0x38')](db['Dashboard']['rawAttributes']);_0x11bc72[_0xd540('0x3c')]=_[_0xd540('0x3a')](_0xefe060['model'],qs[_0xd540('0x3b')](_0x20c69f[_0xd540('0x37')]['fields']));_0x11bc72[_0xd540('0x3c')]=_0x11bc72[_0xd540('0x3c')]['length']?_0x11bc72['attributes']:_0xefe060[_0xd540('0x34')];if(_0x20c69f['query']['includeAll']){_0x11bc72[_0xd540('0x46')]=[{'all':!![]}];}_0x11bc72=_['merge']({},_0x11bc72,_0x20c69f[_0xd540('0x4d')]);return db[_0xd540('0x31')][_0xd540('0x4e')](_0x11bc72)[_0xd540('0x29')](handleEntityNotFound(_0x2b15fc,null))['then'](function(_0x5a8a59){if(_0x5a8a59){var _0x426632=_0x5a8a59['get']({'plain':!![]});_0x426632=qs[_0xd540('0x59')](_0x426632,['id',_0xd540('0x5a'),_0xd540('0x5b')]);_0x20c69f[_0xd540('0x50')]=_['omit'](_0x20c69f[_0xd540('0x50')],['id','createdAt','updatedAt']);return db[_0xd540('0x31')][_0xd540('0x4f')](_[_0xd540('0x4c')](_0x426632,_0x20c69f['body']),{'include':_0x20c69f[_0xd540('0x37')][_0xd540('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x1c9cd4){var _0x56d13f=_0x20c69f[_0xd540('0x51')][_0xd540('0x52')]({'plain':!![]});if(!_0x56d13f)throw new Error(_0xd540('0x53'));if(_0x56d13f[_0xd540('0x5c')]===_0xd540('0x51')){var _0x8b8e6d=_0x1c9cd4[_0xd540('0x52')]({'plain':!![]});var _0x30c986='CustomDashboards';return db[_0xd540('0x54')][_0xd540('0x4e')]({'where':{'name':_0x30c986,'userProfileId':_0x56d13f[_0xd540('0x55')]},'raw':!![]})[_0xd540('0x29')](function(_0x3560de){if(_0x3560de&&_0x3560de[_0xd540('0x56')]===0x0){return db[_0xd540('0x2c')][_0xd540('0x4f')]({'name':_0x8b8e6d[_0xd540('0x36')],'resourceId':_0x8b8e6d['id'],'type':_0x3560de[_0xd540('0x36')],'sectionId':_0x3560de['id']},{})[_0xd540('0x29')](function(){return _0x1c9cd4;});}else{return _0x1c9cd4;}})['catch'](function(_0x53a3dd){logger[_0xd540('0x2d')](_0xd540('0x57'),_0x53a3dd);throw _0x53a3dd;});}return _0x1c9cd4;});}})[_0xd540('0x29')](respondWithResult(_0x2b15fc,0xc9))[_0xd540('0x49')](handleError(_0x2b15fc,null));};exports[_0xd540('0x28')]=function(_0x452f48,_0x22b0d2){if(_0x452f48[_0xd540('0x50')]['id']){delete _0x452f48[_0xd540('0x50')]['id'];}return db[_0xd540('0x31')][_0xd540('0x4e')]({'where':{'id':_0x452f48[_0xd540('0x4a')]['id']}})[_0xd540('0x29')](handleEntityNotFound(_0x22b0d2,null))[_0xd540('0x29')](saveUpdates(_0x452f48[_0xd540('0x50')],null))[_0xd540('0x29')](respondWithResult(_0x22b0d2,null))['catch'](handleError(_0x22b0d2,null));};exports[_0xd540('0x2a')]=function(_0x22d65d,_0x46100a){return db['Dashboard'][_0xd540('0x4e')]({'where':{'id':_0x22d65d['params']['id']}})[_0xd540('0x29')](handleEntityNotFound(_0x46100a,null))[_0xd540('0x29')](removeEntity(_0x46100a,null))['catch'](handleError(_0x46100a,null));};function widgetAttributes(_0x2278b2){try{switch(_0x2278b2[_0xd540('0x33')]){case _0xd540('0x5d'):return[{'name':_0xd540('0x5e'),'value':_0x2278b2[_0xd540('0x5e')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x0]?_0x2278b2[_0xd540('0x5f')][0x0][_0xd540('0x60')]:undefined)||_0xd540('0x61')}];case'custom':return[{'name':_0xd540('0x62'),'value':_0x2278b2[_0xd540('0x62')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2['attrs'][0x0]?_0x2278b2['attrs'][0x0][_0xd540('0x60')]:undefined)||''}];case _0xd540('0x63'):return[{'name':_0xd540('0x64'),'value':_0x2278b2[_0xd540('0x64')]||(_0x2278b2['attrs']&&_0x2278b2[_0xd540('0x5f')][0x0]?_0x2278b2[_0xd540('0x5f')][0x0][_0xd540('0x60')]:undefined)||_0xd540('0x65')},{'name':_0xd540('0x66'),'value':_0x2278b2[_0xd540('0x66')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x1]?_0x2278b2[_0xd540('0x5f')][0x1]['value']:undefined)||_0xd540('0x67')},{'name':'attrFontSize','value':_0x2278b2[_0xd540('0x68')]||(_0x2278b2['attrs']&&_0x2278b2[_0xd540('0x5f')][0x2]?_0x2278b2[_0xd540('0x5f')][0x2][_0xd540('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0xd540('0x69'),'value':_0x2278b2[_0xd540('0x69')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x0]?_0x2278b2['attrs'][0x0]['value']:undefined)||_0xd540('0x6a')},{'name':_0xd540('0x6b'),'value':_0x2278b2[_0xd540('0x6b')]||(_0x2278b2['attrs']&&_0x2278b2[_0xd540('0x5f')][0x1]?_0x2278b2[_0xd540('0x5f')][0x1][_0xd540('0x60')]:undefined)||[]},{'name':_0xd540('0x68'),'value':_0x2278b2[_0xd540('0x68')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x2]?_0x2278b2[_0xd540('0x5f')][0x2]['value']:undefined)||0x14},{'name':_0xd540('0x6c'),'value':_0x2278b2[_0xd540('0x6c')]||(_0x2278b2['attrs']&&_0x2278b2['attrs'][0x3]?_0x2278b2[_0xd540('0x5f')][0x3][_0xd540('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2278b2['attrEmailAccounts']||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x4]?_0x2278b2['attrs'][0x4][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x6d'),'value':_0x2278b2[_0xd540('0x6d')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x5]?_0x2278b2[_0xd540('0x5f')][0x5][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x6e'),'value':_0x2278b2[_0xd540('0x6e')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x6]?_0x2278b2[_0xd540('0x5f')][0x6][_0xd540('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2278b2[_0xd540('0x6f')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x7]?_0x2278b2[_0xd540('0x5f')][0x7][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x70'),'value':_0x2278b2[_0xd540('0x70')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2['attrs'][0x8]?_0x2278b2[_0xd540('0x5f')][0x8][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x71'),'value':_0x2278b2[_0xd540('0x71')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x9]?_0x2278b2[_0xd540('0x5f')][0x9][_0xd540('0x60')]:undefined)||''}];case _0xd540('0x72'):case'pie-chart':return[{'name':_0xd540('0x73'),'value':_0x2278b2['attrSerie1']||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x0]?_0x2278b2[_0xd540('0x5f')][0x0][_0xd540('0x60')]:undefined)||_0xd540('0x6a')},{'name':_0xd540('0x74'),'value':_0x2278b2[_0xd540('0x74')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x1]?_0x2278b2[_0xd540('0x5f')][0x1][_0xd540('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x2278b2[_0xd540('0x75')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x2]?_0x2278b2[_0xd540('0x5f')][0x2][_0xd540('0x60')]:undefined)||null},{'name':_0xd540('0x6b'),'value':_0x2278b2['attrVoiceQueues']||(_0x2278b2['attrs']&&_0x2278b2[_0xd540('0x5f')][0x3]?_0x2278b2['attrs'][0x3][_0xd540('0x60')]:undefined)||[]},{'name':_0xd540('0x6c'),'value':_0x2278b2['attrChannel']||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x4]?_0x2278b2[_0xd540('0x5f')][0x4][_0xd540('0x60')]:undefined)||_0xd540('0x76')},{'name':_0xd540('0x77'),'value':_0x2278b2[_0xd540('0x77')]||(_0x2278b2['attrs']&&_0x2278b2[_0xd540('0x5f')][0x5]?_0x2278b2[_0xd540('0x5f')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2278b2[_0xd540('0x6d')]||(_0x2278b2['attrs']&&_0x2278b2['attrs'][0x6]?_0x2278b2[_0xd540('0x5f')][0x6][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x6e'),'value':_0x2278b2['attrSmsAccounts']||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x7]?_0x2278b2[_0xd540('0x5f')][0x7][_0xd540('0x60')]:undefined)||''},{'name':_0xd540('0x6f'),'value':_0x2278b2[_0xd540('0x6f')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x8]?_0x2278b2[_0xd540('0x5f')][0x8]['value']:undefined)||''},{'name':_0xd540('0x70'),'value':_0x2278b2[_0xd540('0x70')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x9]?_0x2278b2[_0xd540('0x5f')][0x9][_0xd540('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2278b2['attrChatWebsites']||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0xa]?_0x2278b2[_0xd540('0x5f')][0xa][_0xd540('0x60')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x2278b2[_0xd540('0x78')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x0]?_0x2278b2[_0xd540('0x5f')][0x0]['type']:undefined)||null,'value':_0x2278b2[_0xd540('0x79')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2['attrs'][0x0]?_0x2278b2['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x2278b2[_0xd540('0x7a')]||(_0x2278b2[_0xd540('0x5f')]&&_0x2278b2[_0xd540('0x5f')][0x1]?_0x2278b2[_0xd540('0x5f')][0x1][_0xd540('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x541af5){logger['error'](_0xd540('0x7b'),JSON[_0xd540('0x7c')](_0x541af5));return[];}}exports[_0xd540('0x7d')]=function(_0xbeec77,_0x543ef1,_0x5cbc96){if(_0xbeec77[_0xd540('0x50')]['id']){delete _0xbeec77[_0xd540('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xbeec77[_0xd540('0x4a')]['id']}})[_0xd540('0x29')](handleEntityNotFound(_0x543ef1,null))[_0xd540('0x29')](function(_0x38d2cf){if(_0x38d2cf){_0xbeec77[_0xd540('0x50')][_0xd540('0x7e')]=_0x38d2cf['id'];_0xbeec77[_0xd540('0x50')]['attrs']=widgetAttributes(_0xbeec77[_0xd540('0x50')]);return db['DashboardItem'][_0xd540('0x4f')](_0xbeec77[_0xd540('0x50')]);}})['then'](respondWithResult(_0x543ef1,null))[_0xd540('0x49')](handleError(_0x543ef1,null));};exports[_0xd540('0x7f')]=function(_0x52467f,_0x53a5c0,_0x4f0e92){var _0x30a4b5={};var _0x3f4f3b={};var _0xfd8be4;var _0x219453;return db[_0xd540('0x31')][_0xd540('0x80')]({'where':{'id':_0x52467f[_0xd540('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a5c0,null))['then'](function(_0x1891f7){if(_0x1891f7){_0xfd8be4=_0x1891f7;_0x3f4f3b[_0xd540('0x34')]=_[_0xd540('0x38')](db[_0xd540('0x81')][_0xd540('0x4b')]);_0x3f4f3b[_0xd540('0x37')]=_[_0xd540('0x38')](_0x52467f['query']);_0x3f4f3b[_0xd540('0x39')]=_[_0xd540('0x3a')](_0x3f4f3b[_0xd540('0x34')],_0x3f4f3b[_0xd540('0x37')]);_0x30a4b5[_0xd540('0x3c')]=_[_0xd540('0x3a')](_0x3f4f3b[_0xd540('0x34')],qs[_0xd540('0x3b')](_0x52467f[_0xd540('0x37')][_0xd540('0x3b')]));_0x30a4b5['attributes']=_0x30a4b5[_0xd540('0x3c')]['length']?_0x30a4b5[_0xd540('0x3c')]:_0x3f4f3b[_0xd540('0x34')];_0x30a4b5[_0xd540('0x3f')]=qs[_0xd540('0x40')](_0x52467f[_0xd540('0x37')]['sort']);_0x30a4b5[_0xd540('0x41')]=qs[_0xd540('0x39')](_[_0xd540('0x42')](_0x52467f[_0xd540('0x37')],_0x3f4f3b[_0xd540('0x39')]));if(_0x52467f['query'][_0xd540('0x43')]){_0x30a4b5[_0xd540('0x41')]=_[_0xd540('0x4c')](_0x30a4b5[_0xd540('0x41')],{'$or':_[_0xd540('0x35')](_0x30a4b5['attributes'],function(_0xc2b54){var _0x36c96b={};_0x36c96b[_0xc2b54]={'$like':'%'+_0x52467f[_0xd540('0x37')][_0xd540('0x43')]+'%'};return _0x36c96b;})});}_0x30a4b5=_[_0xd540('0x4c')]({},_0x30a4b5,_0x52467f[_0xd540('0x4d')]);return _0xfd8be4[_0xd540('0x7f')](_0x30a4b5);}})['then'](function(_0x434656){if(_0x434656){_0x219453=_0x434656[_0xd540('0x3d')];if(!_0x52467f['query'][_0xd540('0x3e')](_0xd540('0x82'))){_0x30a4b5['limit']=qs[_0xd540('0x20')](_0x52467f[_0xd540('0x37')]['limit']);_0x30a4b5[_0xd540('0x1e')]=qs[_0xd540('0x1e')](_0x52467f[_0xd540('0x37')][_0xd540('0x1e')]);}return _0xfd8be4[_0xd540('0x7f')](_0x30a4b5);}})[_0xd540('0x29')](function(_0x30bcf3){if(_0x30bcf3){return _0x30bcf3?{'count':_0x219453,'rows':_0x30bcf3}:null;}})[_0xd540('0x29')](respondWithResult(_0x53a5c0,null))[_0xd540('0x49')](handleError(_0x53a5c0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 989e2b0..71b7750 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 _0xa98b=['emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save','update','remove'];(function(_0x4ef7e2,_0x257e37){var _0x84fa8=function(_0x2c967b){while(--_0x2c967b){_0x4ef7e2['push'](_0x4ef7e2['shift']());}};_0x84fa8(++_0x257e37);}(_0xa98b,0x158));var _0xba98=function(_0x542196,_0x173d58){_0x542196=_0x542196-0x0;var _0xe83001=_0xa98b[_0x542196];return _0xe83001;};'use strict';var EventEmitter=require(_0xba98('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xba98('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xba98('0x2')](0x0);var events={'afterCreate':_0xba98('0x3'),'afterUpdate':_0xba98('0x4'),'afterDestroy':_0xba98('0x5')};function emitEvent(_0x46b881){return function(_0x150e17,_0x59ecbf,_0x290bff){DashboardEvents[_0xba98('0x6')](_0x46b881+':'+_0x150e17['id'],_0x150e17);DashboardEvents[_0xba98('0x6')](_0x46b881,_0x150e17);_0x290bff(null);};}for(var e in events){if(events[_0xba98('0x7')](e)){var event=events[e];Dashboard[_0xba98('0x8')](e,emitEvent(event));}}module[_0xba98('0x9')]=DashboardEvents; \ No newline at end of file +var _0xcedf=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard'];(function(_0x2142bf,_0x404713){var _0x204a22=function(_0x36a515){while(--_0x36a515){_0x2142bf['push'](_0x2142bf['shift']());}};_0x204a22(++_0x404713);}(_0xcedf,0x1b6));var _0xfced=function(_0x21945f,_0x188d2a){_0x21945f=_0x21945f-0x0;var _0x1e1f9a=_0xcedf[_0x21945f];return _0x1e1f9a;};'use strict';var EventEmitter=require(_0xfced('0x0'));var Dashboard=require(_0xfced('0x1'))['db'][_0xfced('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfced('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfced('0x4'),'afterDestroy':_0xfced('0x5')};function emitEvent(_0x4c426b){return function(_0x5b16af,_0x1dad76,_0x4a86d5){DashboardEvents[_0xfced('0x6')](_0x4c426b+':'+_0x5b16af['id'],_0x5b16af);DashboardEvents['emit'](_0x4c426b,_0x5b16af);_0x4a86d5(null);};}for(var e in events){if(events[_0xfced('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xfced('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 79a61ec..9788262 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 _0x0a7f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Dashboard','dashboards'];(function(_0x3f4c75,_0x36af7b){var _0x36096f=function(_0x62fa3){while(--_0x62fa3){_0x3f4c75['push'](_0x3f4c75['shift']());}};_0x36096f(++_0x36af7b);}(_0x0a7f,0xe6));var _0xf0a7=function(_0x63b6d3,_0x13c87d){_0x63b6d3=_0x63b6d3-0x0;var _0x41a70c=_0x0a7f[_0x63b6d3];return _0x41a70c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0a7('0x0'))('api');var moment=require(_0xf0a7('0x1'));var BPromise=require(_0xf0a7('0x2'));var rp=require(_0xf0a7('0x3'));var fs=require('fs');var path=require(_0xf0a7('0x4'));var rimraf=require(_0xf0a7('0x5'));var config=require(_0xf0a7('0x6'));var attributes=require('./dashboard.attributes');module[_0xf0a7('0x7')]=function(_0x191298,_0x501ef2){return _0x191298['define'](_0xf0a7('0x8'),attributes,{'tableName':_0xf0a7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2dd=['../../config/environment','./dashboard.attributes','define','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2dd,0xea));var _0xda2d=function(_0x4a1881,_0x23af8e){_0x4a1881=_0x4a1881-0x0;var _0x5c7b49=_0xa2dd[_0x4a1881];return _0x5c7b49;};'use strict';var _=require(_0xda2d('0x0'));var util=require('util');var logger=require(_0xda2d('0x1'))(_0xda2d('0x2'));var moment=require(_0xda2d('0x3'));var BPromise=require(_0xda2d('0x4'));var rp=require(_0xda2d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xda2d('0x6'));var attributes=require(_0xda2d('0x7'));module['exports']=function(_0xaebb41,_0x3632c5){return _0xaebb41[_0xda2d('0x8')]('Dashboard',attributes,{'tableName':_0xda2d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 56f9fb1..c163e14 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 _0xf2c0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xf2c0,0x186));var _0x0f2c=function(_0x335db8,_0x2d0dc2){_0x335db8=_0x335db8-0x0;var _0x224b29=_0xf2c0[_0x335db8];return _0x224b29;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0f2c('0x0'));var BPromise=require(_0x0f2c('0x1'));var rs=require(_0x0f2c('0x2'));var fs=require('fs');var Redis=require(_0x0f2c('0x3'));var db=require(_0x0f2c('0x4'))['db'];var utils=require(_0x0f2c('0x5'));var logger=require(_0x0f2c('0x6'))(_0x0f2c('0x7'));var config=require(_0x0f2c('0x8'));var jayson=require(_0x0f2c('0x9'));var client=jayson[_0x0f2c('0xa')][_0x0f2c('0xb')]({'port':0x232a});config[_0x0f2c('0xc')]=_[_0x0f2c('0xd')](config[_0x0f2c('0xc')],{'host':_0x0f2c('0xe'),'port':0x18eb});var socket=require(_0x0f2c('0xf'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x3a9f4c,_0x1339db,_0x56c336){return new BPromise(function(_0x1e2989,_0x162094){return client['request'](_0x3a9f4c,_0x56c336)[_0x0f2c('0x10')](function(_0x4e14ac){logger[_0x0f2c('0x11')](_0x0f2c('0x12'),_0x1339db,_0x0f2c('0x13'));logger[_0x0f2c('0x14')](_0x0f2c('0x15'),_0x1339db,_0x0f2c('0x13'),JSON[_0x0f2c('0x16')](_0x4e14ac));if(_0x4e14ac[_0x0f2c('0x17')]){if(_0x4e14ac['error'][_0x0f2c('0x18')]===0x1f4){logger[_0x0f2c('0x17')](_0x0f2c('0x12'),_0x1339db,_0x4e14ac[_0x0f2c('0x17')][_0x0f2c('0x19')]);return _0x162094(_0x4e14ac[_0x0f2c('0x17')][_0x0f2c('0x19')]);}logger[_0x0f2c('0x17')](_0x0f2c('0x12'),_0x1339db,_0x4e14ac['error']['message']);return _0x1e2989(_0x4e14ac[_0x0f2c('0x17')][_0x0f2c('0x19')]);}else{logger[_0x0f2c('0x11')](_0x0f2c('0x12'),_0x1339db,_0x0f2c('0x13'));_0x1e2989(_0x4e14ac[_0x0f2c('0x1a')][_0x0f2c('0x19')]);}})[_0x0f2c('0x1b')](function(_0x51b137){logger[_0x0f2c('0x17')](_0x0f2c('0x12'),_0x1339db,_0x51b137);_0x162094(_0x51b137);});});} \ No newline at end of file +var _0x124b=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2354ac,_0xd8b2c6){var _0x4ab0a9=function(_0x312853){while(--_0x312853){_0x2354ac['push'](_0x2354ac['shift']());}};_0x4ab0a9(++_0xd8b2c6);}(_0x124b,0x8f));var _0xb124=function(_0x516968,_0x58c439){_0x516968=_0x516968-0x0;var _0x4be190=_0x124b[_0x516968];return _0x4be190;};'use strict';var _=require(_0xb124('0x0'));var util=require(_0xb124('0x1'));var moment=require(_0xb124('0x2'));var BPromise=require(_0xb124('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb124('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb124('0x5'))(_0xb124('0x6'));var config=require(_0xb124('0x7'));var jayson=require(_0xb124('0x8'));var client=jayson[_0xb124('0x9')][_0xb124('0xa')]({'port':0x232a});config[_0xb124('0xb')]=_[_0xb124('0xc')](config[_0xb124('0xb')],{'host':_0xb124('0xd'),'port':0x18eb});var socket=require(_0xb124('0xe'))(new Redis(config[_0xb124('0xb')]));require(_0xb124('0xf'))[_0xb124('0x10')](socket);function respondWithRpcPromise(_0x7e14f2,_0x51365a,_0x40d40c){return new BPromise(function(_0x3a7fd6,_0x5be136){return client[_0xb124('0x11')](_0x7e14f2,_0x40d40c)[_0xb124('0x12')](function(_0x27d642){logger[_0xb124('0x13')](_0xb124('0x14'),_0x51365a,_0xb124('0x15'));logger['debug'](_0xb124('0x16'),_0x51365a,_0xb124('0x15'),JSON[_0xb124('0x17')](_0x27d642));if(_0x27d642[_0xb124('0x18')]){if(_0x27d642[_0xb124('0x18')][_0xb124('0x19')]===0x1f4){logger['error'](_0xb124('0x14'),_0x51365a,_0x27d642['error']['message']);return _0x5be136(_0x27d642['error'][_0xb124('0x1a')]);}logger[_0xb124('0x18')](_0xb124('0x14'),_0x51365a,_0x27d642[_0xb124('0x18')][_0xb124('0x1a')]);return _0x3a7fd6(_0x27d642['error'][_0xb124('0x1a')]);}else{logger[_0xb124('0x13')](_0xb124('0x14'),_0x51365a,'request\x20sent');_0x3a7fd6(_0x27d642[_0xb124('0x1b')][_0xb124('0x1a')]);}})[_0xb124('0x1c')](function(_0xca49ab){logger[_0xb124('0x18')]('Dashboard,\x20%s,\x20%s',_0x51365a,_0xca49ab);_0x5be136(_0xca49ab);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 582dacf..ad25102 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 _0x60f7=['save','remove','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x166781,_0x5436fe){var _0x322be6=function(_0x26b7a6){while(--_0x26b7a6){_0x166781['push'](_0x166781['shift']());}};_0x322be6(++_0x5436fe);}(_0x60f7,0x1cf));var _0x760f=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x60f7[_0x4c12ec];return _0x3ae42c;};'use strict';var DashboardEvents=require(_0x760f('0x0'));var events=[_0x760f('0x1'),_0x760f('0x2'),'update'];function createListener(_0x44eeb4,_0x20fa42){return function(_0x5b19a1){_0x20fa42[_0x760f('0x3')](_0x44eeb4,_0x5b19a1);};}function removeListener(_0x120537,_0x74059e){return function(){DashboardEvents[_0x760f('0x4')](_0x120537,_0x74059e);};}exports[_0x760f('0x5')]=function(_0x4a300d){for(var _0x3ddedd=0x0,_0x24c927=events[_0x760f('0x6')];_0x3ddedd<_0x24c927;_0x3ddedd++){var _0x345d46=events[_0x3ddedd];var _0x12ace1=createListener(_0x760f('0x7')+_0x345d46,_0x4a300d);DashboardEvents['on'](_0x345d46,_0x12ace1);}}; \ No newline at end of file +var _0x19d3=['register','length','./dashboard.events','save','remove','update','emit'];(function(_0x47ef8a,_0x91844f){var _0x1198e1=function(_0x3fe353){while(--_0x3fe353){_0x47ef8a['push'](_0x47ef8a['shift']());}};_0x1198e1(++_0x91844f);}(_0x19d3,0x1a6));var _0x319d=function(_0x1d1fd9,_0x343c4f){_0x1d1fd9=_0x1d1fd9-0x0;var _0x48c07e=_0x19d3[_0x1d1fd9];return _0x48c07e;};'use strict';var DashboardEvents=require(_0x319d('0x0'));var events=[_0x319d('0x1'),_0x319d('0x2'),_0x319d('0x3')];function createListener(_0x47dbd9,_0xdad04e){return function(_0x26eb75){_0xdad04e[_0x319d('0x4')](_0x47dbd9,_0x26eb75);};}function removeListener(_0x212f42,_0x27a26b){return function(){DashboardEvents['removeListener'](_0x212f42,_0x27a26b);};}exports[_0x319d('0x5')]=function(_0x4839cf){for(var _0xe1293d=0x0,_0x5855db=events[_0x319d('0x6')];_0xe1293d<_0x5855db;_0xe1293d++){var _0xa111f0=events[_0xe1293d];var _0x507f3f=createListener('dashboard:'+_0xa111f0,_0x4839cf);DashboardEvents['on'](_0xa111f0,_0x507f3f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d264516..8fa74d5 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 _0x5da0=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','/:id/items','put','update','destroy','exports','multer'];(function(_0x198127,_0x536320){var _0x822398=function(_0x55aa02){while(--_0x55aa02){_0x198127['push'](_0x198127['shift']());}};_0x822398(++_0x536320);}(_0x5da0,0x83));var _0x05da=function(_0x23aefd,_0x59c912){_0x23aefd=_0x23aefd-0x0;var _0x3d535c=_0x5da0[_0x23aefd];return _0x3d535c;};'use strict';var multer=require(_0x05da('0x0'));var util=require(_0x05da('0x1'));var path=require(_0x05da('0x2'));var timeout=require(_0x05da('0x3'));var express=require(_0x05da('0x4'));var router=express['Router']();var fs_extra=require(_0x05da('0x5'));var auth=require(_0x05da('0x6'));var interaction=require(_0x05da('0x7'));var config=require(_0x05da('0x8'));var controller=require(_0x05da('0x9'));router[_0x05da('0xa')]('/',auth[_0x05da('0xb')](),controller[_0x05da('0xc')]);router['get'](_0x05da('0xd'),auth['isAuthenticated'](),controller[_0x05da('0xe')]);router[_0x05da('0xa')]('/:id/items',auth[_0x05da('0xb')](),controller['getItems']);router[_0x05da('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x05da('0xf')](_0x05da('0x10'),auth[_0x05da('0xb')](),controller['clone']);router[_0x05da('0xf')](_0x05da('0x11'),auth['isAuthenticated'](),controller['addItem']);router[_0x05da('0x12')](_0x05da('0xd'),auth[_0x05da('0xb')](),controller[_0x05da('0x13')]);router['delete'](_0x05da('0xd'),auth[_0x05da('0xb')](),controller[_0x05da('0x14')]);module[_0x05da('0x15')]=router; \ No newline at end of file +var _0xd509=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x23a140,_0x4281ce){var _0x93ce6a=function(_0x2750b2){while(--_0x2750b2){_0x23a140['push'](_0x23a140['shift']());}};_0x93ce6a(++_0x4281ce);}(_0xd509,0x80));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9d50('0x0'));var util=require(_0x9d50('0x1'));var path=require(_0x9d50('0x2'));var timeout=require(_0x9d50('0x3'));var express=require(_0x9d50('0x4'));var router=express[_0x9d50('0x5')]();var fs_extra=require(_0x9d50('0x6'));var auth=require(_0x9d50('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9d50('0x8'));var controller=require(_0x9d50('0x9'));router[_0x9d50('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9d50('0xa')]('/:id',auth[_0x9d50('0xb')](),controller[_0x9d50('0xc')]);router['get'](_0x9d50('0xd'),auth[_0x9d50('0xb')](),controller[_0x9d50('0xe')]);router[_0x9d50('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d50('0x10')]);router[_0x9d50('0xf')](_0x9d50('0x11'),auth[_0x9d50('0xb')](),controller[_0x9d50('0x12')]);router['post'](_0x9d50('0xd'),auth[_0x9d50('0xb')](),controller[_0x9d50('0x13')]);router[_0x9d50('0x14')](_0x9d50('0x15'),auth[_0x9d50('0xb')](),controller[_0x9d50('0x16')]);router[_0x9d50('0x17')]('/:id',auth[_0x9d50('0xb')](),controller[_0x9d50('0x18')]);module[_0x9d50('0x19')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 760c184..00a3a68 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 _0x195f=['./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include','options','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','type','attrReport','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x3af270,_0x5675b4){var _0x1dc18a=function(_0x310711){while(--_0x310711){_0x3af270['push'](_0x3af270['shift']());}};_0x1dc18a(++_0x5675b4);}(_0x195f,0x113));var _0xf195=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x195f[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xf195('0x0'));var rimraf=require(_0xf195('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf195('0x2'));var rp=require(_0xf195('0x3'));var moment=require('moment');var BPromise=require(_0xf195('0x4'));var Mustache=require('mustache');var util=require(_0xf195('0x5'));var path=require(_0xf195('0x6'));var sox=require(_0xf195('0x7'));var csv=require(_0xf195('0x8'));var ejs=require(_0xf195('0x9'));var fs=require('fs');var fs_extra=require(_0xf195('0xa'));var _=require(_0xf195('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf195('0xc'));var deskjs=require(_0xf195('0xd'));var toCsv=require(_0xf195('0x8'));var querystring=require(_0xf195('0xe'));var Papa=require(_0xf195('0xf'));var Redis=require(_0xf195('0x10'));var authService=require(_0xf195('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf195('0x12'));var hardwareService=require(_0xf195('0x13'));var logger=require(_0xf195('0x14'))('api');var utils=require(_0xf195('0x15'));var config=require(_0xf195('0x16'));var licenseUtil=require(_0xf195('0x17'));var db=require(_0xf195('0x18'))['db'];config['redis']=_[_0xf195('0x19')](config[_0xf195('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf195('0x1b'))(new Redis(config['redis']));require(_0xf195('0x1c'))[_0xf195('0x1d')](socket);function respondWithStatusCode(_0x345a44,_0x41a77d){_0x41a77d=_0x41a77d||0xcc;return function(_0x27ac95){if(_0x27ac95){return _0x345a44[_0xf195('0x1e')](_0x41a77d);}return _0x345a44[_0xf195('0x1f')](_0x41a77d)[_0xf195('0x20')]();};}function respondWithResult(_0x4c1956,_0x56c2d7){_0x56c2d7=_0x56c2d7||0xc8;return function(_0x15590e){if(_0x15590e){return _0x4c1956[_0xf195('0x1f')](_0x56c2d7)[_0xf195('0x21')](_0x15590e);}};}function respondWithFilteredResult(_0x321bd7,_0x52b7c1){return function(_0x374fc6){if(_0x374fc6){var _0x1ae33e=typeof _0x52b7c1['offset']===_0xf195('0x22')&&typeof _0x52b7c1[_0xf195('0x23')]==='undefined';var _0x15acd6=_0x374fc6[_0xf195('0x24')];var _0x5a2bd4=_0x1ae33e?0x0:_0x52b7c1[_0xf195('0x25')];var _0x26dfea=_0x1ae33e?_0x374fc6[_0xf195('0x24')]:_0x52b7c1[_0xf195('0x25')]+_0x52b7c1['limit'];var _0x5933f0;if(_0x26dfea>=_0x15acd6){_0x26dfea=_0x15acd6;_0x5933f0=0xc8;}else{_0x5933f0=0xce;}_0x321bd7['status'](_0x5933f0);return _0x321bd7[_0xf195('0x26')](_0xf195('0x27'),_0x5a2bd4+'-'+_0x26dfea+'/'+_0x15acd6)[_0xf195('0x21')](_0x374fc6);}return null;};}function patchUpdates(_0x785aae){return function(_0x1c72f5){try{jsonpatch[_0xf195('0x28')](_0x1c72f5,_0x785aae,!![]);}catch(_0x3d3d14){return BPromise[_0xf195('0x29')](_0x3d3d14);}return _0x1c72f5[_0xf195('0x2a')]();};}function saveUpdates(_0x255d58,_0x45ebf9){return function(_0x1481ae){if(_0x1481ae){return _0x1481ae['update'](_0x255d58)[_0xf195('0x2b')](function(_0x246750){return _0x246750;});}return null;};}function removeEntity(_0x3dddd3,_0x2ae42e){return function(_0x221439){if(_0x221439){return _0x221439[_0xf195('0x2c')]()[_0xf195('0x2b')](function(){_0x3dddd3[_0xf195('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583255,_0x190b43){return function(_0x37d9e9){if(!_0x37d9e9){_0x583255[_0xf195('0x1e')](0x194);}return _0x37d9e9;};}function handleError(_0x5e853d,_0x292a7a){_0x292a7a=_0x292a7a||0x1f4;return function(_0x37b3c6){logger[_0xf195('0x2d')](_0x37b3c6[_0xf195('0x2e')]);if(_0x37b3c6[_0xf195('0x2f')]){delete _0x37b3c6[_0xf195('0x2f')];}_0x5e853d[_0xf195('0x1f')](_0x292a7a)[_0xf195('0x30')](_0x37b3c6);};}exports[_0xf195('0x31')]=function(_0x2a3522,_0xdb8e93){var _0x245a06={'raw':![],'where':{'id':_0x2a3522[_0xf195('0x32')]['id']}},_0x20e0e3={};_0x20e0e3[_0xf195('0x33')]=_['keys'](db[_0xf195('0x34')][_0xf195('0x35')]);_0x20e0e3[_0xf195('0x36')]=_[_0xf195('0x37')](_0x2a3522[_0xf195('0x36')]);_0x20e0e3[_0xf195('0x38')]=_[_0xf195('0x39')](_0x20e0e3[_0xf195('0x33')],_0x20e0e3[_0xf195('0x36')]);_0x245a06[_0xf195('0x3a')]=_[_0xf195('0x39')](_0x20e0e3[_0xf195('0x33')],qs[_0xf195('0x3b')](_0x2a3522[_0xf195('0x36')][_0xf195('0x3b')]));_0x245a06[_0xf195('0x3a')]=_0x245a06[_0xf195('0x3a')]['length']?_0x245a06[_0xf195('0x3a')]:_0x20e0e3[_0xf195('0x33')];if(_0x2a3522[_0xf195('0x36')][_0xf195('0x3c')]){_0x245a06[_0xf195('0x3d')]=[{'all':!![]}];}_0x245a06=_['merge']({},_0x245a06,_0x2a3522[_0xf195('0x3e')]);return db[_0xf195('0x34')][_0xf195('0x3f')](_0x245a06)['then'](handleEntityNotFound(_0xdb8e93,null))['then'](respondWithResult(_0xdb8e93,null))[_0xf195('0x40')](handleError(_0xdb8e93,null));};exports[_0xf195('0x2c')]=function(_0x2814f6,_0xef4f39){return db[_0xf195('0x34')][_0xf195('0x3f')]({'where':{'id':_0x2814f6[_0xf195('0x32')]['id']}})[_0xf195('0x2b')](handleEntityNotFound(_0xef4f39,null))[_0xf195('0x2b')](removeEntity(_0xef4f39,null))[_0xf195('0x40')](handleError(_0xef4f39,null));};function widgetAttributes(_0x481537){try{switch(_0x481537['type']){case _0xf195('0x41'):return[{'name':_0xf195('0x42'),'value':_0x481537[_0xf195('0x42')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x44')]:undefined)||_0xf195('0x45')}];case'custom':return[{'name':_0xf195('0x46'),'value':_0x481537['attrPath']||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x44')]:undefined)||''}];case _0xf195('0x47'):return[{'name':_0xf195('0x48'),'value':_0x481537[_0xf195('0x48')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x44')]:undefined)||_0xf195('0x49')},{'name':_0xf195('0x4a'),'value':_0x481537[_0xf195('0x4a')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x1]?_0x481537['attrs'][0x1][_0xf195('0x44')]:undefined)||_0xf195('0x4b')},{'name':_0xf195('0x4c'),'value':_0x481537[_0xf195('0x4c')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x2]?_0x481537[_0xf195('0x43')][0x2][_0xf195('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xf195('0x4d'),'value':_0x481537[_0xf195('0x4d')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x44')]:undefined)||_0xf195('0x4e')},{'name':'attrVoiceQueues','value':_0x481537[_0xf195('0x4f')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x1]?_0x481537[_0xf195('0x43')][0x1]['value']:undefined)||[]},{'name':_0xf195('0x4c'),'value':_0x481537[_0xf195('0x4c')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x2]?_0x481537[_0xf195('0x43')][0x2][_0xf195('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x481537[_0xf195('0x50')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x3]?_0x481537[_0xf195('0x43')][0x3][_0xf195('0x44')]:undefined)||'voice'},{'name':_0xf195('0x51'),'value':_0x481537[_0xf195('0x51')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x4]?_0x481537[_0xf195('0x43')][0x4][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x52'),'value':_0x481537[_0xf195('0x52')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x5]?_0x481537['attrs'][0x5][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x53'),'value':_0x481537[_0xf195('0x53')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x6]?_0x481537[_0xf195('0x43')][0x6][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x54'),'value':_0x481537['attrOpenchannelAccounts']||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x7]?_0x481537[_0xf195('0x43')][0x7][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x55'),'value':_0x481537[_0xf195('0x55')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x8]?_0x481537[_0xf195('0x43')][0x8][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x56'),'value':_0x481537[_0xf195('0x56')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x9]?_0x481537[_0xf195('0x43')][0x9]['value']:undefined)||''}];case _0xf195('0x57'):case _0xf195('0x58'):return[{'name':_0xf195('0x59'),'value':_0x481537[_0xf195('0x59')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x0]?_0x481537[_0xf195('0x43')][0x0]['value']:undefined)||_0xf195('0x4e')},{'name':_0xf195('0x5a'),'value':_0x481537[_0xf195('0x5a')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x1]?_0x481537[_0xf195('0x43')][0x1][_0xf195('0x44')]:undefined)||null},{'name':_0xf195('0x5b'),'value':_0x481537['attrSerie3']||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x2]?_0x481537[_0xf195('0x43')][0x2][_0xf195('0x44')]:undefined)||null},{'name':_0xf195('0x4f'),'value':_0x481537[_0xf195('0x4f')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x3]?_0x481537['attrs'][0x3][_0xf195('0x44')]:undefined)||[]},{'name':_0xf195('0x50'),'value':_0x481537[_0xf195('0x50')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x4]?_0x481537['attrs'][0x4][_0xf195('0x44')]:undefined)||_0xf195('0x5c')},{'name':_0xf195('0x51'),'value':_0x481537[_0xf195('0x51')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x5]?_0x481537[_0xf195('0x43')][0x5][_0xf195('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x481537[_0xf195('0x52')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x6]?_0x481537[_0xf195('0x43')][0x6][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x53'),'value':_0x481537[_0xf195('0x53')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x7]?_0x481537[_0xf195('0x43')][0x7][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x54'),'value':_0x481537[_0xf195('0x54')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x8]?_0x481537[_0xf195('0x43')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x481537[_0xf195('0x55')]||(_0x481537['attrs']&&_0x481537[_0xf195('0x43')][0x9]?_0x481537['attrs'][0x9][_0xf195('0x44')]:undefined)||''},{'name':_0xf195('0x56'),'value':_0x481537[_0xf195('0x56')]||(_0x481537['attrs']&&_0x481537['attrs'][0xa]?_0x481537[_0xf195('0x43')][0xa][_0xf195('0x44')]:undefined)||''}];case _0xf195('0x5d'):return[{'name':'attrReport','type':_0x481537[_0xf195('0x5e')]||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x5f')]:undefined)||null,'value':_0x481537[_0xf195('0x60')]||(_0x481537[_0xf195('0x43')]&&_0x481537['attrs'][0x0]?_0x481537[_0xf195('0x43')][0x0][_0xf195('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x481537['attrRefresh']||(_0x481537[_0xf195('0x43')]&&_0x481537[_0xf195('0x43')][0x1]?_0x481537[_0xf195('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x16cc75){logger['error'](_0xf195('0x61'),JSON[_0xf195('0x62')](_0x16cc75));return[];}}exports[_0xf195('0x63')]=function(_0x308aaf,_0x3f4a51){if(_0x308aaf['body']){_0x308aaf[_0xf195('0x64')][_0xf195('0x43')]=widgetAttributes(_0x308aaf[_0xf195('0x64')]);}return db['DashboardItem'][_0xf195('0x63')](_0x308aaf['body'],{})[_0xf195('0x2b')](respondWithResult(_0x3f4a51,0xc9))[_0xf195('0x40')](handleError(_0x3f4a51,null));};exports['update']=function(_0x2230f2,_0x3fae3a){if(_0x2230f2['body']['id']){delete _0x2230f2[_0xf195('0x64')]['id'];}_0x2230f2[_0xf195('0x64')]['attrs']=widgetAttributes(_0x2230f2[_0xf195('0x64')]);return db[_0xf195('0x34')][_0xf195('0x3f')]({'where':{'id':_0x2230f2[_0xf195('0x32')]['id']}})[_0xf195('0x2b')](handleEntityNotFound(_0x3fae3a,null))['then'](saveUpdates(_0x2230f2['body'],null))[_0xf195('0x2b')](respondWithResult(_0x3fae3a,null))[_0xf195('0x40')](handleError(_0x3fae3a,null));}; \ No newline at end of file +var _0xb2ac=['redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','query','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','DashboardItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x2a1744,_0x46c5ad){var _0x49f02c=function(_0x4683cb){while(--_0x4683cb){_0x2a1744['push'](_0x2a1744['shift']());}};_0x49f02c(++_0x46c5ad);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x1973ea,_0x4a1c75){_0x1973ea=_0x1973ea-0x0;var _0x353133=_0xb2ac[_0x1973ea];return _0x353133;};'use strict';var emlformat=require(_0xcb2a('0x0'));var rimraf=require(_0xcb2a('0x1'));var zipdir=require(_0xcb2a('0x2'));var jsonpatch=require(_0xcb2a('0x3'));var rp=require(_0xcb2a('0x4'));var moment=require(_0xcb2a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb2a('0x6'));var util=require(_0xcb2a('0x7'));var path=require(_0xcb2a('0x8'));var sox=require(_0xcb2a('0x9'));var csv=require(_0xcb2a('0xa'));var ejs=require(_0xcb2a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb2a('0xc'));var squel=require(_0xcb2a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb2a('0xa'));var querystring=require('querystring');var Papa=require(_0xcb2a('0xe'));var Redis=require(_0xcb2a('0xf'));var authService=require(_0xcb2a('0x10'));var qs=require(_0xcb2a('0x11'));var as=require(_0xcb2a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb2a('0x13'))(_0xcb2a('0x14'));var utils=require('../../config/utils');var config=require(_0xcb2a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcb2a('0x16')]=_[_0xcb2a('0x17')](config[_0xcb2a('0x16')],{'host':_0xcb2a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb2a('0x16')]));require(_0xcb2a('0x19'))['register'](socket);function respondWithStatusCode(_0x3a647c,_0x2b88e9){_0x2b88e9=_0x2b88e9||0xcc;return function(_0xfca62f){if(_0xfca62f){return _0x3a647c[_0xcb2a('0x1a')](_0x2b88e9);}return _0x3a647c[_0xcb2a('0x1b')](_0x2b88e9)[_0xcb2a('0x1c')]();};}function respondWithResult(_0x27b758,_0x2a3541){_0x2a3541=_0x2a3541||0xc8;return function(_0x51bba7){if(_0x51bba7){return _0x27b758['status'](_0x2a3541)[_0xcb2a('0x1d')](_0x51bba7);}};}function respondWithFilteredResult(_0x31fe86,_0x5279be){return function(_0x4e595b){if(_0x4e595b){var _0x60836a=typeof _0x5279be[_0xcb2a('0x1e')]===_0xcb2a('0x1f')&&typeof _0x5279be[_0xcb2a('0x20')]===_0xcb2a('0x1f');var _0x1a9f50=_0x4e595b[_0xcb2a('0x21')];var _0x5eb1f3=_0x60836a?0x0:_0x5279be[_0xcb2a('0x1e')];var _0x2eee07=_0x60836a?_0x4e595b[_0xcb2a('0x21')]:_0x5279be[_0xcb2a('0x1e')]+_0x5279be[_0xcb2a('0x20')];var _0x2f0343;if(_0x2eee07>=_0x1a9f50){_0x2eee07=_0x1a9f50;_0x2f0343=0xc8;}else{_0x2f0343=0xce;}_0x31fe86[_0xcb2a('0x1b')](_0x2f0343);return _0x31fe86[_0xcb2a('0x22')]('Content-Range',_0x5eb1f3+'-'+_0x2eee07+'/'+_0x1a9f50)[_0xcb2a('0x1d')](_0x4e595b);}return null;};}function patchUpdates(_0x269fa1){return function(_0x2509e0){try{jsonpatch[_0xcb2a('0x23')](_0x2509e0,_0x269fa1,!![]);}catch(_0x5752bd){return BPromise[_0xcb2a('0x24')](_0x5752bd);}return _0x2509e0[_0xcb2a('0x25')]();};}function saveUpdates(_0x20eee4,_0xbedade){return function(_0x4eddd6){if(_0x4eddd6){return _0x4eddd6[_0xcb2a('0x26')](_0x20eee4)[_0xcb2a('0x27')](function(_0x20b76a){return _0x20b76a;});}return null;};}function removeEntity(_0x3548f4,_0x4f9887){return function(_0x246a3d){if(_0x246a3d){return _0x246a3d[_0xcb2a('0x28')]()[_0xcb2a('0x27')](function(){_0x3548f4['status'](0xcc)[_0xcb2a('0x1c')]();});}};}function handleEntityNotFound(_0x47511d,_0x3d093a){return function(_0x231cf9){if(!_0x231cf9){_0x47511d[_0xcb2a('0x1a')](0x194);}return _0x231cf9;};}function handleError(_0x4b07e6,_0xf9ea0d){_0xf9ea0d=_0xf9ea0d||0x1f4;return function(_0x504f5c){logger[_0xcb2a('0x29')](_0x504f5c[_0xcb2a('0x2a')]);if(_0x504f5c[_0xcb2a('0x2b')]){delete _0x504f5c[_0xcb2a('0x2b')];}_0x4b07e6[_0xcb2a('0x1b')](_0xf9ea0d)[_0xcb2a('0x2c')](_0x504f5c);};}exports[_0xcb2a('0x2d')]=function(_0x5b16e4,_0x11a6e8){var _0xdffa58={'raw':![],'where':{'id':_0x5b16e4[_0xcb2a('0x2e')]['id']}},_0x57f7a2={};_0x57f7a2[_0xcb2a('0x2f')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x57f7a2[_0xcb2a('0x30')]=_[_0xcb2a('0x31')](_0x5b16e4[_0xcb2a('0x30')]);_0x57f7a2[_0xcb2a('0x32')]=_[_0xcb2a('0x33')](_0x57f7a2[_0xcb2a('0x2f')],_0x57f7a2[_0xcb2a('0x30')]);_0xdffa58[_0xcb2a('0x34')]=_['intersection'](_0x57f7a2[_0xcb2a('0x2f')],qs[_0xcb2a('0x35')](_0x5b16e4['query'][_0xcb2a('0x35')]));_0xdffa58['attributes']=_0xdffa58['attributes']['length']?_0xdffa58[_0xcb2a('0x34')]:_0x57f7a2[_0xcb2a('0x2f')];if(_0x5b16e4[_0xcb2a('0x30')][_0xcb2a('0x36')]){_0xdffa58['include']=[{'all':!![]}];}_0xdffa58=_[_0xcb2a('0x37')]({},_0xdffa58,_0x5b16e4[_0xcb2a('0x38')]);return db['DashboardItem'][_0xcb2a('0x39')](_0xdffa58)[_0xcb2a('0x27')](handleEntityNotFound(_0x11a6e8,null))[_0xcb2a('0x27')](respondWithResult(_0x11a6e8,null))[_0xcb2a('0x3a')](handleError(_0x11a6e8,null));};exports[_0xcb2a('0x28')]=function(_0x2d70bf,_0x16cdce){return db['DashboardItem']['find']({'where':{'id':_0x2d70bf[_0xcb2a('0x2e')]['id']}})[_0xcb2a('0x27')](handleEntityNotFound(_0x16cdce,null))[_0xcb2a('0x27')](removeEntity(_0x16cdce,null))[_0xcb2a('0x3a')](handleError(_0x16cdce,null));};function widgetAttributes(_0x31ea8e){try{switch(_0x31ea8e[_0xcb2a('0x3b')]){case'iframe':return[{'name':'attrUrl','value':_0x31ea8e[_0xcb2a('0x3c')]||(_0x31ea8e['attrs']&&_0x31ea8e[_0xcb2a('0x3d')][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0]['value']:undefined)||_0xcb2a('0x3e')}];case _0xcb2a('0x3f'):return[{'name':'attrPath','value':_0x31ea8e[_0xcb2a('0x40')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0][_0xcb2a('0x41')]:undefined)||''}];case'clock':return[{'name':_0xcb2a('0x42'),'value':_0x31ea8e[_0xcb2a('0x42')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0][_0xcb2a('0x41')]:undefined)||_0xcb2a('0x43')},{'name':'attrTimezone','value':_0x31ea8e[_0xcb2a('0x44')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x1]?_0x31ea8e[_0xcb2a('0x3d')][0x1]['value']:undefined)||_0xcb2a('0x45')},{'name':'attrFontSize','value':_0x31ea8e[_0xcb2a('0x46')]||(_0x31ea8e['attrs']&&_0x31ea8e[_0xcb2a('0x3d')][0x2]?_0x31ea8e[_0xcb2a('0x3d')][0x2][_0xcb2a('0x41')]:undefined)||0xc}];case _0xcb2a('0x47'):return[{'name':_0xcb2a('0x48'),'value':_0x31ea8e['attrMetric']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0][_0xcb2a('0x41')]:undefined)||_0xcb2a('0x49')},{'name':_0xcb2a('0x4a'),'value':_0x31ea8e[_0xcb2a('0x4a')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x1]?_0x31ea8e[_0xcb2a('0x3d')][0x1]['value']:undefined)||[]},{'name':_0xcb2a('0x46'),'value':_0x31ea8e[_0xcb2a('0x46')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x2]?_0x31ea8e[_0xcb2a('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0xcb2a('0x4b'),'value':_0x31ea8e['attrChannel']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x3]?_0x31ea8e[_0xcb2a('0x3d')][0x3]['value']:undefined)||_0xcb2a('0x4c')},{'name':_0xcb2a('0x4d'),'value':_0x31ea8e[_0xcb2a('0x4d')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x4]?_0x31ea8e[_0xcb2a('0x3d')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x31ea8e['attrFaxAccounts']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x5]?_0x31ea8e[_0xcb2a('0x3d')][0x5][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x4e'),'value':_0x31ea8e['attrSmsAccounts']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x6]?_0x31ea8e[_0xcb2a('0x3d')][0x6][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x4f'),'value':_0x31ea8e[_0xcb2a('0x4f')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x7]?_0x31ea8e['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x31ea8e[_0xcb2a('0x50')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x8]?_0x31ea8e[_0xcb2a('0x3d')][0x8][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x51'),'value':_0x31ea8e[_0xcb2a('0x51')]||(_0x31ea8e['attrs']&&_0x31ea8e['attrs'][0x9]?_0x31ea8e[_0xcb2a('0x3d')][0x9]['value']:undefined)||''}];case _0xcb2a('0x52'):case _0xcb2a('0x53'):return[{'name':_0xcb2a('0x54'),'value':_0x31ea8e[_0xcb2a('0x54')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0]['value']:undefined)||_0xcb2a('0x49')},{'name':'attrSerie2','value':_0x31ea8e[_0xcb2a('0x55')]||(_0x31ea8e['attrs']&&_0x31ea8e['attrs'][0x1]?_0x31ea8e['attrs'][0x1][_0xcb2a('0x41')]:undefined)||null},{'name':_0xcb2a('0x56'),'value':_0x31ea8e[_0xcb2a('0x56')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x2]?_0x31ea8e[_0xcb2a('0x3d')][0x2]['value']:undefined)||null},{'name':_0xcb2a('0x4a'),'value':_0x31ea8e[_0xcb2a('0x4a')]||(_0x31ea8e['attrs']&&_0x31ea8e[_0xcb2a('0x3d')][0x3]?_0x31ea8e[_0xcb2a('0x3d')][0x3]['value']:undefined)||[]},{'name':_0xcb2a('0x4b'),'value':_0x31ea8e[_0xcb2a('0x4b')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x4]?_0x31ea8e[_0xcb2a('0x3d')][0x4][_0xcb2a('0x41')]:undefined)||_0xcb2a('0x4c')},{'name':_0xcb2a('0x4d'),'value':_0x31ea8e[_0xcb2a('0x4d')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x5]?_0x31ea8e['attrs'][0x5][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x57'),'value':_0x31ea8e[_0xcb2a('0x57')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x6]?_0x31ea8e[_0xcb2a('0x3d')][0x6][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x4e'),'value':_0x31ea8e['attrSmsAccounts']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x7]?_0x31ea8e[_0xcb2a('0x3d')][0x7][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x4f'),'value':_0x31ea8e[_0xcb2a('0x4f')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x8]?_0x31ea8e['attrs'][0x8]['value']:undefined)||''},{'name':_0xcb2a('0x50'),'value':_0x31ea8e[_0xcb2a('0x50')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0x9]?_0x31ea8e['attrs'][0x9][_0xcb2a('0x41')]:undefined)||''},{'name':_0xcb2a('0x51'),'value':_0x31ea8e[_0xcb2a('0x51')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e[_0xcb2a('0x3d')][0xa]?_0x31ea8e[_0xcb2a('0x3d')][0xa][_0xcb2a('0x41')]:undefined)||''}];case _0xcb2a('0x58'):return[{'name':_0xcb2a('0x59'),'type':_0x31ea8e[_0xcb2a('0x5a')]||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0][_0xcb2a('0x3b')]:undefined)||null,'value':_0x31ea8e['attrReport']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x0]?_0x31ea8e[_0xcb2a('0x3d')][0x0]['value']:undefined)||null},{'name':_0xcb2a('0x5b'),'value':_0x31ea8e['attrRefresh']||(_0x31ea8e[_0xcb2a('0x3d')]&&_0x31ea8e['attrs'][0x1]?_0x31ea8e[_0xcb2a('0x3d')][0x1][_0xcb2a('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1b9bcd){logger[_0xcb2a('0x29')](_0xcb2a('0x5c'),JSON['stringify'](_0x1b9bcd));return[];}}exports[_0xcb2a('0x5d')]=function(_0x38b06c,_0x100967){if(_0x38b06c['body']){_0x38b06c['body'][_0xcb2a('0x3d')]=widgetAttributes(_0x38b06c[_0xcb2a('0x5e')]);}return db[_0xcb2a('0x5f')]['create'](_0x38b06c[_0xcb2a('0x5e')],{})[_0xcb2a('0x27')](respondWithResult(_0x100967,0xc9))[_0xcb2a('0x3a')](handleError(_0x100967,null));};exports['update']=function(_0x4ff4cd,_0x5e1a89){if(_0x4ff4cd['body']['id']){delete _0x4ff4cd[_0xcb2a('0x5e')]['id'];}_0x4ff4cd['body'][_0xcb2a('0x3d')]=widgetAttributes(_0x4ff4cd[_0xcb2a('0x5e')]);return db[_0xcb2a('0x5f')][_0xcb2a('0x39')]({'where':{'id':_0x4ff4cd[_0xcb2a('0x2e')]['id']}})[_0xcb2a('0x27')](handleEntityNotFound(_0x5e1a89,null))['then'](saveUpdates(_0x4ff4cd[_0xcb2a('0x5e')],null))[_0xcb2a('0x27')](respondWithResult(_0x5e1a89,null))['catch'](handleError(_0x5e1a89,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5eb674e..66d5a2d 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 _0x4628=['remove','emit','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4628,0xd3));var _0x8462=function(_0x57a4f0,_0x534004){_0x57a4f0=_0x57a4f0-0x0;var _0x2b6993=_0x4628[_0x57a4f0];return _0x2b6993;};'use strict';var EventEmitter=require(_0x8462('0x0'));var DashboardItem=require(_0x8462('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8462('0x2')](0x0);var events={'afterCreate':_0x8462('0x3'),'afterUpdate':_0x8462('0x4'),'afterDestroy':_0x8462('0x5')};function emitEvent(_0x337b21){return function(_0x5f1fdb,_0x1ebadd,_0x85915a){DashboardItemEvents[_0x8462('0x6')](_0x337b21+':'+_0x5f1fdb['id'],_0x5f1fdb);DashboardItemEvents[_0x8462('0x6')](_0x337b21,_0x5f1fdb);_0x85915a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x8462('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x778c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','DashboardItem'];(function(_0x10bf61,_0x1b2716){var _0x3d330e=function(_0x4a7e53){while(--_0x4a7e53){_0x10bf61['push'](_0x10bf61['shift']());}};_0x3d330e(++_0x1b2716);}(_0x778c,0x1e4));var _0xc778=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x778c[_0x39b316];return _0x182ab1;};'use strict';var EventEmitter=require(_0xc778('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc778('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc778('0x2')](0x0);var events={'afterCreate':_0xc778('0x3'),'afterUpdate':_0xc778('0x4'),'afterDestroy':_0xc778('0x5')};function emitEvent(_0x405cda){return function(_0x5be380,_0x2b759f,_0x552344){DashboardItemEvents['emit'](_0x405cda+':'+_0x5be380['id'],_0x5be380);DashboardItemEvents[_0xc778('0x6')](_0x405cda,_0x5be380);_0x552344(null);};}for(var e in events){if(events[_0xc778('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xc778('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6a2fd04..2dcdfa2 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 _0xd4cc=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items'];(function(_0x356b73,_0x17774c){var _0x1965e0=function(_0x4fb907){while(--_0x4fb907){_0x356b73['push'](_0x356b73['shift']());}};_0x1965e0(++_0x17774c);}(_0xd4cc,0x114));var _0xcd4c=function(_0x1c3b40,_0x581b78){_0x1c3b40=_0x1c3b40-0x0;var _0x470677=_0xd4cc[_0x1c3b40];return _0x470677;};'use strict';var _=require(_0xcd4c('0x0'));var util=require(_0xcd4c('0x1'));var logger=require(_0xcd4c('0x2'))('api');var moment=require(_0xcd4c('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd4c('0x4'));var fs=require('fs');var path=require(_0xcd4c('0x5'));var rimraf=require(_0xcd4c('0x6'));var config=require(_0xcd4c('0x7'));var attributes=require(_0xcd4c('0x8'));module[_0xcd4c('0x9')]=function(_0x2d7040,_0x10dd24){return _0x2d7040[_0xcd4c('0xa')]('DashboardItem',attributes,{'tableName':_0xcd4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ab=['util','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','dashboard_items','lodash'];(function(_0x1e7e19,_0x43a0f2){var _0x340148=function(_0x388a77){while(--_0x388a77){_0x1e7e19['push'](_0x1e7e19['shift']());}};_0x340148(++_0x43a0f2);}(_0x80ab,0x143));var _0xb80a=function(_0x36bebe,_0x2ff7c1){_0x36bebe=_0x36bebe-0x0;var _0x24b2b2=_0x80ab[_0x36bebe];return _0x24b2b2;};'use strict';var _=require(_0xb80a('0x0'));var util=require(_0xb80a('0x1'));var logger=require('../../config/logger')(_0xb80a('0x2'));var moment=require(_0xb80a('0x3'));var BPromise=require(_0xb80a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb80a('0x5'));var rimraf=require(_0xb80a('0x6'));var config=require('../../config/environment');var attributes=require(_0xb80a('0x7'));module['exports']=function(_0x59e86e,_0x2060e0){return _0x59e86e['define']('DashboardItem',attributes,{'tableName':_0xb80a('0x8'),'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 5df88e1..d05c86d 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 _0x88da=['../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','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','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x53ffe9,_0x367829){var _0xc6597e=function(_0x49ea9a){while(--_0x49ea9a){_0x53ffe9['push'](_0x53ffe9['shift']());}};_0xc6597e(++_0x367829);}(_0x88da,0xf5));var _0xa88d=function(_0x16bf81,_0x30750b){_0x16bf81=_0x16bf81-0x0;var _0x56dc74=_0x88da[_0x16bf81];return _0x56dc74;};'use strict';var _=require('lodash');var util=require(_0xa88d('0x0'));var moment=require(_0xa88d('0x1'));var BPromise=require('bluebird');var rs=require(_0xa88d('0x2'));var fs=require('fs');var Redis=require(_0xa88d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa88d('0x4'));var logger=require(_0xa88d('0x5'))(_0xa88d('0x6'));var config=require(_0xa88d('0x7'));var jayson=require(_0xa88d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa88d('0x9')]=_[_0xa88d('0xa')](config[_0xa88d('0x9')],{'host':_0xa88d('0xb'),'port':0x18eb});var socket=require(_0xa88d('0xc'))(new Redis(config[_0xa88d('0x9')]));require(_0xa88d('0xd'))[_0xa88d('0xe')](socket);function respondWithRpcPromise(_0x353026,_0x109532,_0x2ec5e0){return new BPromise(function(_0x1c4ec7,_0x4b68c4){return client[_0xa88d('0xf')](_0x353026,_0x2ec5e0)[_0xa88d('0x10')](function(_0x475e99){logger[_0xa88d('0x11')](_0xa88d('0x12'),_0x109532,_0xa88d('0x13'));logger[_0xa88d('0x14')](_0xa88d('0x15'),_0x109532,_0xa88d('0x13'),JSON[_0xa88d('0x16')](_0x475e99));if(_0x475e99['error']){if(_0x475e99[_0xa88d('0x17')][_0xa88d('0x18')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x109532,_0x475e99[_0xa88d('0x17')]['message']);return _0x4b68c4(_0x475e99[_0xa88d('0x17')][_0xa88d('0x19')]);}logger[_0xa88d('0x17')](_0xa88d('0x12'),_0x109532,_0x475e99[_0xa88d('0x17')][_0xa88d('0x19')]);return _0x1c4ec7(_0x475e99[_0xa88d('0x17')]['message']);}else{logger[_0xa88d('0x11')](_0xa88d('0x12'),_0x109532,_0xa88d('0x13'));_0x1c4ec7(_0x475e99[_0xa88d('0x1a')][_0xa88d('0x19')]);}})[_0xa88d('0x1b')](function(_0x2cbd05){logger[_0xa88d('0x17')](_0xa88d('0x12'),_0x109532,_0x2cbd05);_0x4b68c4(_0x2cbd05);});});} \ No newline at end of file +var _0x1112=['../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x1112,0xeb));var _0x2111=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0x1112[_0x57f8c0];return _0x117f08;};'use strict';var _=require(_0x2111('0x0'));var util=require(_0x2111('0x1'));var moment=require('moment');var BPromise=require(_0x2111('0x2'));var rs=require(_0x2111('0x3'));var fs=require('fs');var Redis=require(_0x2111('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2111('0x5'));var logger=require(_0x2111('0x6'))(_0x2111('0x7'));var config=require(_0x2111('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2111('0x9')](config[_0x2111('0xa')],{'host':_0x2111('0xb'),'port':0x18eb});var socket=require(_0x2111('0xc'))(new Redis(config[_0x2111('0xa')]));require(_0x2111('0xd'))['register'](socket);function respondWithRpcPromise(_0x44f62c,_0x271fbb,_0x275919){return new BPromise(function(_0x2b62ac,_0x5c1dcc){return client['request'](_0x44f62c,_0x275919)[_0x2111('0xe')](function(_0x142cce){logger[_0x2111('0xf')](_0x2111('0x10'),_0x271fbb,_0x2111('0x11'));logger[_0x2111('0x12')](_0x2111('0x13'),_0x271fbb,_0x2111('0x11'),JSON[_0x2111('0x14')](_0x142cce));if(_0x142cce[_0x2111('0x15')]){if(_0x142cce['error'][_0x2111('0x16')]===0x1f4){logger['error'](_0x2111('0x10'),_0x271fbb,_0x142cce['error'][_0x2111('0x17')]);return _0x5c1dcc(_0x142cce[_0x2111('0x15')]['message']);}logger[_0x2111('0x15')](_0x2111('0x10'),_0x271fbb,_0x142cce[_0x2111('0x15')][_0x2111('0x17')]);return _0x2b62ac(_0x142cce[_0x2111('0x15')][_0x2111('0x17')]);}else{logger[_0x2111('0xf')]('DashboardItem,\x20%s,\x20%s',_0x271fbb,_0x2111('0x11'));_0x2b62ac(_0x142cce['result'][_0x2111('0x17')]);}})['catch'](function(_0x24c1d8){logger[_0x2111('0x15')]('DashboardItem,\x20%s,\x20%s',_0x271fbb,_0x24c1d8);_0x5c1dcc(_0x24c1d8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 76dffd2..a2d15eb 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 _0x1b6b=['./dashboardItem.events','save','emit','removeListener','register','length','dashboardItem:'];(function(_0x1b0de5,_0x33bba2){var _0x4b9a1c=function(_0xd172e3){while(--_0xd172e3){_0x1b0de5['push'](_0x1b0de5['shift']());}};_0x4b9a1c(++_0x33bba2);}(_0x1b6b,0x17a));var _0xb1b6=function(_0x6d34dc,_0x4939fc){_0x6d34dc=_0x6d34dc-0x0;var _0x1d5d8e=_0x1b6b[_0x6d34dc];return _0x1d5d8e;};'use strict';var DashboardItemEvents=require(_0xb1b6('0x0'));var events=[_0xb1b6('0x1'),'remove','update'];function createListener(_0x3c3a92,_0x3134e4){return function(_0x3c7558){_0x3134e4[_0xb1b6('0x2')](_0x3c3a92,_0x3c7558);};}function removeListener(_0x1b99bf,_0x14477c){return function(){DashboardItemEvents[_0xb1b6('0x3')](_0x1b99bf,_0x14477c);};}exports[_0xb1b6('0x4')]=function(_0x96d5b9){for(var _0x3d7493=0x0,_0x31c15f=events[_0xb1b6('0x5')];_0x3d7493<_0x31c15f;_0x3d7493++){var _0x757b45=events[_0x3d7493];var _0x6e9ed1=createListener(_0xb1b6('0x6')+_0x757b45,_0x96d5b9);DashboardItemEvents['on'](_0x757b45,_0x6e9ed1);}}; \ No newline at end of file +var _0x44d3=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x426155,_0x2570f7){var _0x13e514=function(_0x126db4){while(--_0x126db4){_0x426155['push'](_0x426155['shift']());}};_0x13e514(++_0x2570f7);}(_0x44d3,0xe8));var _0x344d=function(_0x524d8e,_0x55b0ac){_0x524d8e=_0x524d8e-0x0;var _0x85e441=_0x44d3[_0x524d8e];return _0x85e441;};'use strict';var DashboardItemEvents=require(_0x344d('0x0'));var events=[_0x344d('0x1'),_0x344d('0x2'),_0x344d('0x3')];function createListener(_0x339662,_0x256f86){return function(_0x1641fe){_0x256f86[_0x344d('0x4')](_0x339662,_0x1641fe);};}function removeListener(_0xe43411,_0x282da4){return function(){DashboardItemEvents['removeListener'](_0xe43411,_0x282da4);};}exports[_0x344d('0x5')]=function(_0x1a9494){for(var _0x210f5c=0x0,_0x360c3=events[_0x344d('0x6')];_0x210f5c<_0x360c3;_0x210f5c++){var _0x3a19e7=events[_0x210f5c];var _0x184527=createListener(_0x344d('0x7')+_0x3a19e7,_0x1a9494);DashboardItemEvents['on'](_0x3a19e7,_0x184527);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e341564..f5132a3 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 _0x9249=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','create','put','/:id','delete','destroy','util','path'];(function(_0x3f4a1e,_0x47d489){var _0x29c1a1=function(_0x18cec2){while(--_0x18cec2){_0x3f4a1e['push'](_0x3f4a1e['shift']());}};_0x29c1a1(++_0x47d489);}(_0x9249,0x85));var _0x9924=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9249[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x9924('0x0'));var path=require(_0x9924('0x1'));var timeout=require('connect-timeout');var express=require(_0x9924('0x2'));var router=express[_0x9924('0x3')]();var fs_extra=require(_0x9924('0x4'));var auth=require(_0x9924('0x5'));var interaction=require(_0x9924('0x6'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x9924('0x7')]('/:id',auth[_0x9924('0x8')](),controller[_0x9924('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9924('0xa')]);router[_0x9924('0xb')](_0x9924('0xc'),auth[_0x9924('0x8')](),controller['update']);router[_0x9924('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9924('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7033=['create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0xbaa540,_0x339232){var _0x52aaa0=function(_0xd8663c){while(--_0xd8663c){_0xbaa540['push'](_0xbaa540['shift']());}};_0x52aaa0(++_0x339232);}(_0x7033,0xb7));var _0x3703=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7033[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var path=require(_0x3703('0x2'));var timeout=require(_0x3703('0x3'));var express=require(_0x3703('0x4'));var router=express[_0x3703('0x5')]();var fs_extra=require(_0x3703('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3703('0x7'));var config=require(_0x3703('0x8'));var controller=require(_0x3703('0x9'));router[_0x3703('0xa')](_0x3703('0xb'),auth[_0x3703('0xc')](),controller[_0x3703('0xd')]);router[_0x3703('0xe')]('/',auth[_0x3703('0xc')](),controller[_0x3703('0xf')]);router['put']('/:id',auth[_0x3703('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3703('0x10')]);module[_0x3703('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 7809447..0086271 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 _0x57d4=['exports','STRING','second','third','sequelize'];(function(_0x3771c9,_0x2a0328){var _0x4cee1e=function(_0xa7830f){while(--_0xa7830f){_0x3771c9['push'](_0x3771c9['shift']());}};_0x4cee1e(++_0x2a0328);}(_0x57d4,0xd6));var _0x457d=function(_0x3ea7df,_0x4bc93d){_0x3ea7df=_0x3ea7df-0x0;var _0x5bc0fa=_0x57d4[_0x3ea7df];return _0x5bc0fa;};'use strict';var Sequelize=require(_0x457d('0x0'));module[_0x457d('0x1')]={'name':{'type':Sequelize[_0x457d('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x457d('0x3'),_0x457d('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x457d('0x2')]}}; \ No newline at end of file +var _0xdac5=['sequelize','STRING','ENUM','second','third','first'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0xdac5,0x1e0));var _0x5dac=function(_0x56326d,_0x382c97){_0x56326d=_0x56326d-0x0;var _0x385acc=_0xdac5[_0x56326d];return _0x385acc;};'use strict';var Sequelize=require(_0x5dac('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dac('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x5dac('0x2')]('first',_0x5dac('0x3'),_0x5dac('0x4')),'allowNull':![],'defaultValue':_0x5dac('0x5')},'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 cf1aa23..ad3c260 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 _0xbe25=['end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus'];(function(_0x372cd6,_0x44d6b7){var _0x20b281=function(_0x28117d){while(--_0x28117d){_0x372cd6['push'](_0x372cd6['shift']());}};_0x20b281(++_0x44d6b7);}(_0xbe25,0x1c9));var _0x5be2=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xbe25[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0x5be2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5be2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5be2('0x2'));var moment=require(_0x5be2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5be2('0x4'));var util=require(_0x5be2('0x5'));var path=require(_0x5be2('0x6'));var sox=require(_0x5be2('0x7'));var csv=require(_0x5be2('0x8'));var ejs=require(_0x5be2('0x9'));var fs=require('fs');var fs_extra=require(_0x5be2('0xa'));var _=require(_0x5be2('0xb'));var squel=require('squel');var crypto=require(_0x5be2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5be2('0xd'));var toCsv=require(_0x5be2('0x8'));var querystring=require('querystring');var Papa=require(_0x5be2('0xe'));var Redis=require('ioredis');var authService=require(_0x5be2('0xf'));var qs=require(_0x5be2('0x10'));var as=require(_0x5be2('0x11'));var hardwareService=require(_0x5be2('0x12'));var logger=require(_0x5be2('0x13'))(_0x5be2('0x14'));var utils=require(_0x5be2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab389,_0x124275){_0x124275=_0x124275||0xcc;return function(_0x63cfbe){if(_0x63cfbe){return _0x2ab389[_0x5be2('0x16')](_0x124275);}return _0x2ab389['status'](_0x124275)[_0x5be2('0x17')]();};}function respondWithResult(_0x176a93,_0x1c9634){_0x1c9634=_0x1c9634||0xc8;return function(_0xcdbbf4){if(_0xcdbbf4){return _0x176a93[_0x5be2('0x18')](_0x1c9634)[_0x5be2('0x19')](_0xcdbbf4);}};}function respondWithFilteredResult(_0x21655c,_0x361cfe){return function(_0xe999fb){if(_0xe999fb){var _0x35373e=typeof _0x361cfe[_0x5be2('0x1a')]===_0x5be2('0x1b')&&typeof _0x361cfe['limit']===_0x5be2('0x1b');var _0x16dcbb=_0xe999fb[_0x5be2('0x1c')];var _0x5caa4c=_0x35373e?0x0:_0x361cfe[_0x5be2('0x1a')];var _0x3aa842=_0x35373e?_0xe999fb[_0x5be2('0x1c')]:_0x361cfe['offset']+_0x361cfe[_0x5be2('0x1d')];var _0x180cdd;if(_0x3aa842>=_0x16dcbb){_0x3aa842=_0x16dcbb;_0x180cdd=0xc8;}else{_0x180cdd=0xce;}_0x21655c[_0x5be2('0x18')](_0x180cdd);return _0x21655c[_0x5be2('0x1e')]('Content-Range',_0x5caa4c+'-'+_0x3aa842+'/'+_0x16dcbb)[_0x5be2('0x19')](_0xe999fb);}return null;};}function patchUpdates(_0x2e36f4){return function(_0x37394a){try{jsonpatch[_0x5be2('0x1f')](_0x37394a,_0x2e36f4,!![]);}catch(_0x2197fe){return BPromise[_0x5be2('0x20')](_0x2197fe);}return _0x37394a['save']();};}function saveUpdates(_0x18301e,_0x2c5628){return function(_0x15b907){if(_0x15b907){return _0x15b907[_0x5be2('0x21')](_0x18301e)[_0x5be2('0x22')](function(_0xeae4ce){return _0xeae4ce;});}return null;};}function removeEntity(_0x3b28f2,_0x209946){return function(_0x222a94){if(_0x222a94){return _0x222a94[_0x5be2('0x23')]()[_0x5be2('0x22')](function(){var _0x20151e=_0x222a94[_0x5be2('0x24')]({'plain':!![]});var _0x3c9fd9=_0x5be2('0x25');return db[_0x5be2('0x26')][_0x5be2('0x23')]({'where':{'type':_0x3c9fd9,'resourceId':_0x20151e['id']}})[_0x5be2('0x22')](function(){return _0x222a94;});})[_0x5be2('0x22')](function(){_0x3b28f2[_0x5be2('0x18')](0xcc)[_0x5be2('0x17')]();});}};}function handleEntityNotFound(_0x13f116,_0x4d92b7){return function(_0x5428d1){if(!_0x5428d1){_0x13f116[_0x5be2('0x16')](0x194);}return _0x5428d1;};}function handleError(_0x159419,_0x17912d){_0x17912d=_0x17912d||0x1f4;return function(_0x50c149){logger[_0x5be2('0x27')](_0x50c149[_0x5be2('0x28')]);if(_0x50c149[_0x5be2('0x29')]){delete _0x50c149[_0x5be2('0x29')];}_0x159419[_0x5be2('0x18')](_0x17912d)[_0x5be2('0x2a')](_0x50c149);};}exports[_0x5be2('0x2b')]=function(_0x462b71,_0x1e12b7){var _0x4518a3={},_0x1edd9e={},_0x3bd8d0={'count':0x0,'rows':[]};var _0x271f42=_[_0x5be2('0x2c')](db[_0x5be2('0x2d')][_0x5be2('0x2e')],function(_0x50a9fd){return{'name':_0x50a9fd['fieldName'],'type':_0x50a9fd['type'][_0x5be2('0x2f')]};});_0x1edd9e[_0x5be2('0x30')]=_[_0x5be2('0x2c')](_0x271f42,_0x5be2('0x29'));_0x1edd9e[_0x5be2('0x31')]=_[_0x5be2('0x32')](_0x462b71['query']);_0x1edd9e[_0x5be2('0x33')]=_[_0x5be2('0x34')](_0x1edd9e[_0x5be2('0x30')],_0x1edd9e['query']);_0x4518a3[_0x5be2('0x35')]=_['intersection'](_0x1edd9e[_0x5be2('0x30')],qs[_0x5be2('0x36')](_0x462b71[_0x5be2('0x31')]['fields']));_0x4518a3[_0x5be2('0x35')]=_0x4518a3['attributes'][_0x5be2('0x37')]?_0x4518a3[_0x5be2('0x35')]:_0x1edd9e[_0x5be2('0x30')];if(!_0x462b71[_0x5be2('0x31')]['hasOwnProperty'](_0x5be2('0x38'))){_0x4518a3[_0x5be2('0x1d')]=qs[_0x5be2('0x1d')](_0x462b71[_0x5be2('0x31')]['limit']);_0x4518a3['offset']=qs[_0x5be2('0x1a')](_0x462b71[_0x5be2('0x31')]['offset']);}_0x4518a3[_0x5be2('0x39')]=qs[_0x5be2('0x3a')](_0x462b71[_0x5be2('0x31')]['sort']);_0x4518a3[_0x5be2('0x3b')]=qs[_0x5be2('0x33')](_['pick'](_0x462b71[_0x5be2('0x31')],_0x1edd9e['filters']),_0x271f42);if(_0x462b71[_0x5be2('0x31')][_0x5be2('0x3c')]){_0x4518a3[_0x5be2('0x3b')]=_[_0x5be2('0x3d')](_0x4518a3['where'],{'$or':_['map'](_0x271f42,function(_0x146e1b){if(_0x146e1b[_0x5be2('0x3e')]!==_0x5be2('0x3f')){var _0x56c838={};_0x56c838[_0x146e1b['name']]={'$like':'%'+_0x462b71[_0x5be2('0x31')][_0x5be2('0x3c')]+'%'};return _0x56c838;}})});}_0x4518a3=_['merge']({},_0x4518a3,_0x462b71['options']);var _0x70cacc={'where':_0x4518a3[_0x5be2('0x3b')]};return db[_0x5be2('0x2d')][_0x5be2('0x1c')](_0x70cacc)[_0x5be2('0x22')](function(_0xcadd95){_0x3bd8d0[_0x5be2('0x1c')]=_0xcadd95;if(_0x462b71[_0x5be2('0x31')][_0x5be2('0x40')]){_0x4518a3['include']=[{'all':!![]}];}return db[_0x5be2('0x2d')][_0x5be2('0x41')](_0x4518a3);})['then'](function(_0x28df6){_0x3bd8d0[_0x5be2('0x42')]=_0x28df6;return _0x3bd8d0;})[_0x5be2('0x22')](respondWithFilteredResult(_0x1e12b7,_0x4518a3))[_0x5be2('0x43')](handleError(_0x1e12b7,null));};exports[_0x5be2('0x44')]=function(_0x3eaf04,_0x2323af){var _0x574612={'raw':!![],'where':{'id':_0x3eaf04[_0x5be2('0x45')]['id']}},_0x372412={};_0x372412[_0x5be2('0x30')]=_[_0x5be2('0x32')](db[_0x5be2('0x2d')][_0x5be2('0x2e')]);_0x372412['query']=_[_0x5be2('0x32')](_0x3eaf04[_0x5be2('0x31')]);_0x372412[_0x5be2('0x33')]=_[_0x5be2('0x34')](_0x372412[_0x5be2('0x30')],_0x372412['query']);_0x574612[_0x5be2('0x35')]=_[_0x5be2('0x34')](_0x372412[_0x5be2('0x30')],qs[_0x5be2('0x36')](_0x3eaf04[_0x5be2('0x31')]['fields']));_0x574612[_0x5be2('0x35')]=_0x574612['attributes'][_0x5be2('0x37')]?_0x574612[_0x5be2('0x35')]:_0x372412[_0x5be2('0x30')];if(_0x3eaf04[_0x5be2('0x31')][_0x5be2('0x40')]){_0x574612[_0x5be2('0x46')]=[{'all':!![]}];}_0x574612=_[_0x5be2('0x3d')]({},_0x574612,_0x3eaf04['options']);return db['Disposition'][_0x5be2('0x47')](_0x574612)[_0x5be2('0x22')](handleEntityNotFound(_0x2323af,null))['then'](respondWithResult(_0x2323af,null))[_0x5be2('0x43')](handleError(_0x2323af,null));};exports[_0x5be2('0x48')]=function(_0x3e4a48,_0x1dc4b2){return db['Disposition'][_0x5be2('0x48')](_0x3e4a48[_0x5be2('0x49')],{})['then'](function(_0x4e2bf8){var _0x16379c=_0x3e4a48[_0x5be2('0x4a')][_0x5be2('0x24')]({'plain':!![]});if(!_0x16379c)throw new Error(_0x5be2('0x4b'));if(_0x16379c[_0x5be2('0x4c')]===_0x5be2('0x4a')){var _0x7da408=_0x4e2bf8[_0x5be2('0x24')]({'plain':!![]});var _0xebe513=_0x5be2('0x25');return db['UserProfileSection'][_0x5be2('0x47')]({'where':{'name':_0xebe513,'userProfileId':_0x16379c[_0x5be2('0x4d')]},'raw':!![]})['then'](function(_0x2fc75e){if(_0x2fc75e&&_0x2fc75e[_0x5be2('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x7da408[_0x5be2('0x29')],'resourceId':_0x7da408['id'],'type':_0x2fc75e[_0x5be2('0x29')],'sectionId':_0x2fc75e['id']},{})[_0x5be2('0x22')](function(){return _0x4e2bf8;});}else{return _0x4e2bf8;}})['catch'](function(_0x454ce1){logger[_0x5be2('0x27')](_0x5be2('0x4f'),_0x454ce1);throw _0x454ce1;});}return _0x4e2bf8;})['then'](respondWithResult(_0x1dc4b2,0xc9))[_0x5be2('0x43')](handleError(_0x1dc4b2,null));};exports[_0x5be2('0x21')]=function(_0x3d072c,_0x2ac7a6){if(_0x3d072c['body']['id']){delete _0x3d072c[_0x5be2('0x49')]['id'];}return db[_0x5be2('0x2d')][_0x5be2('0x47')]({'where':{'id':_0x3d072c[_0x5be2('0x45')]['id']}})[_0x5be2('0x22')](handleEntityNotFound(_0x2ac7a6,null))[_0x5be2('0x22')](saveUpdates(_0x3d072c['body'],null))[_0x5be2('0x22')](respondWithResult(_0x2ac7a6,null))[_0x5be2('0x43')](handleError(_0x2ac7a6,null));};exports[_0x5be2('0x23')]=function(_0x3275fe,_0x378f59){return db[_0x5be2('0x2d')][_0x5be2('0x47')]({'where':{'id':_0x3275fe[_0x5be2('0x45')]['id']}})['then'](handleEntityNotFound(_0x378f59,null))['then'](removeEntity(_0x378f59,null))[_0x5be2('0x43')](handleError(_0x378f59,null));}; \ No newline at end of file +var _0x6a3b=['../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','json','apply','update','then','destroy','Dispositions','error','stack','name','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','show','intersection','includeAll','find','catch','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','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','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'];(function(_0x14700d,_0x55a66d){var _0x4ddcd5=function(_0x398af9){while(--_0x398af9){_0x14700d['push'](_0x14700d['shift']());}};_0x4ddcd5(++_0x55a66d);}(_0x6a3b,0x134));var _0xb6a3=function(_0x141c62,_0x290f60){_0x141c62=_0x141c62-0x0;var _0x30306b=_0x6a3b[_0x141c62];return _0x30306b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6a3('0x0'));var zipdir=require(_0xb6a3('0x1'));var jsonpatch=require(_0xb6a3('0x2'));var rp=require('request-promise');var moment=require(_0xb6a3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb6a3('0x4'));var util=require(_0xb6a3('0x5'));var path=require(_0xb6a3('0x6'));var sox=require(_0xb6a3('0x7'));var csv=require('to-csv');var ejs=require(_0xb6a3('0x8'));var fs=require('fs');var fs_extra=require(_0xb6a3('0x9'));var _=require(_0xb6a3('0xa'));var squel=require(_0xb6a3('0xb'));var crypto=require(_0xb6a3('0xc'));var jsforce=require(_0xb6a3('0xd'));var deskjs=require(_0xb6a3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb6a3('0xf'));var Redis=require(_0xb6a3('0x10'));var authService=require(_0xb6a3('0x11'));var qs=require(_0xb6a3('0x12'));var as=require(_0xb6a3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6a3('0x14'))(_0xb6a3('0x15'));var utils=require(_0xb6a3('0x16'));var config=require(_0xb6a3('0x17'));var licenseUtil=require(_0xb6a3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa82dc9,_0x17fac2){_0x17fac2=_0x17fac2||0xcc;return function(_0x5c4a0c){if(_0x5c4a0c){return _0xa82dc9[_0xb6a3('0x19')](_0x17fac2);}return _0xa82dc9[_0xb6a3('0x1a')](_0x17fac2)['end']();};}function respondWithResult(_0x4352a0,_0x135bee){_0x135bee=_0x135bee||0xc8;return function(_0x1d73aa){if(_0x1d73aa){return _0x4352a0[_0xb6a3('0x1a')](_0x135bee)['json'](_0x1d73aa);}};}function respondWithFilteredResult(_0x260fb5,_0x280830){return function(_0x17233a){if(_0x17233a){var _0x34a657=typeof _0x280830[_0xb6a3('0x1b')]===_0xb6a3('0x1c')&&typeof _0x280830['limit']===_0xb6a3('0x1c');var _0x4606b8=_0x17233a[_0xb6a3('0x1d')];var _0x2d9991=_0x34a657?0x0:_0x280830[_0xb6a3('0x1b')];var _0x44e6e7=_0x34a657?_0x17233a[_0xb6a3('0x1d')]:_0x280830[_0xb6a3('0x1b')]+_0x280830[_0xb6a3('0x1e')];var _0x52632d;if(_0x44e6e7>=_0x4606b8){_0x44e6e7=_0x4606b8;_0x52632d=0xc8;}else{_0x52632d=0xce;}_0x260fb5['status'](_0x52632d);return _0x260fb5[_0xb6a3('0x1f')]('Content-Range',_0x2d9991+'-'+_0x44e6e7+'/'+_0x4606b8)[_0xb6a3('0x20')](_0x17233a);}return null;};}function patchUpdates(_0x4db941){return function(_0x42a99c){try{jsonpatch[_0xb6a3('0x21')](_0x42a99c,_0x4db941,!![]);}catch(_0x386e6b){return BPromise['reject'](_0x386e6b);}return _0x42a99c['save']();};}function saveUpdates(_0x83fa92,_0x1026cf){return function(_0x546282){if(_0x546282){return _0x546282[_0xb6a3('0x22')](_0x83fa92)[_0xb6a3('0x23')](function(_0x17f08f){return _0x17f08f;});}return null;};}function removeEntity(_0x198773,_0x49d6b0){return function(_0x3620ce){if(_0x3620ce){return _0x3620ce[_0xb6a3('0x24')]()[_0xb6a3('0x23')](function(){var _0x3aac76=_0x3620ce['get']({'plain':!![]});var _0x7ecad0=_0xb6a3('0x25');return db['UserProfileResource'][_0xb6a3('0x24')]({'where':{'type':_0x7ecad0,'resourceId':_0x3aac76['id']}})[_0xb6a3('0x23')](function(){return _0x3620ce;});})[_0xb6a3('0x23')](function(){_0x198773[_0xb6a3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3055b6,_0x3fed53){return function(_0x5253b6){if(!_0x5253b6){_0x3055b6[_0xb6a3('0x19')](0x194);}return _0x5253b6;};}function handleError(_0x37bc1d,_0x4e8b0e){_0x4e8b0e=_0x4e8b0e||0x1f4;return function(_0x11dc67){logger[_0xb6a3('0x26')](_0x11dc67[_0xb6a3('0x27')]);if(_0x11dc67[_0xb6a3('0x28')]){delete _0x11dc67[_0xb6a3('0x28')];}_0x37bc1d['status'](_0x4e8b0e)['send'](_0x11dc67);};}exports[_0xb6a3('0x29')]=function(_0x453e3e,_0xc44047){var _0x3d6a0c={},_0x41caf7={},_0x4dda55={'count':0x0,'rows':[]};var _0x9c832c=_['map'](db[_0xb6a3('0x2a')][_0xb6a3('0x2b')],function(_0x105f94){return{'name':_0x105f94[_0xb6a3('0x2c')],'type':_0x105f94[_0xb6a3('0x2d')][_0xb6a3('0x2e')]};});_0x41caf7[_0xb6a3('0x2f')]=_[_0xb6a3('0x30')](_0x9c832c,_0xb6a3('0x28'));_0x41caf7[_0xb6a3('0x31')]=_[_0xb6a3('0x32')](_0x453e3e['query']);_0x41caf7[_0xb6a3('0x33')]=_['intersection'](_0x41caf7['model'],_0x41caf7[_0xb6a3('0x31')]);_0x3d6a0c['attributes']=_['intersection'](_0x41caf7['model'],qs[_0xb6a3('0x34')](_0x453e3e['query']['fields']));_0x3d6a0c[_0xb6a3('0x35')]=_0x3d6a0c[_0xb6a3('0x35')][_0xb6a3('0x36')]?_0x3d6a0c[_0xb6a3('0x35')]:_0x41caf7['model'];if(!_0x453e3e[_0xb6a3('0x31')][_0xb6a3('0x37')](_0xb6a3('0x38'))){_0x3d6a0c['limit']=qs[_0xb6a3('0x1e')](_0x453e3e['query'][_0xb6a3('0x1e')]);_0x3d6a0c[_0xb6a3('0x1b')]=qs['offset'](_0x453e3e['query'][_0xb6a3('0x1b')]);}_0x3d6a0c[_0xb6a3('0x39')]=qs[_0xb6a3('0x3a')](_0x453e3e[_0xb6a3('0x31')][_0xb6a3('0x3a')]);_0x3d6a0c['where']=qs['filters'](_[_0xb6a3('0x3b')](_0x453e3e[_0xb6a3('0x31')],_0x41caf7['filters']),_0x9c832c);if(_0x453e3e[_0xb6a3('0x31')][_0xb6a3('0x3c')]){_0x3d6a0c[_0xb6a3('0x3d')]=_[_0xb6a3('0x3e')](_0x3d6a0c[_0xb6a3('0x3d')],{'$or':_[_0xb6a3('0x30')](_0x9c832c,function(_0x49dd39){if(_0x49dd39[_0xb6a3('0x2d')]!==_0xb6a3('0x3f')){var _0x249d7a={};_0x249d7a[_0x49dd39[_0xb6a3('0x28')]]={'$like':'%'+_0x453e3e[_0xb6a3('0x31')][_0xb6a3('0x3c')]+'%'};return _0x249d7a;}})});}_0x3d6a0c=_['merge']({},_0x3d6a0c,_0x453e3e['options']);var _0x420bf8={'where':_0x3d6a0c['where']};return db['Disposition'][_0xb6a3('0x1d')](_0x420bf8)[_0xb6a3('0x23')](function(_0x176903){_0x4dda55[_0xb6a3('0x1d')]=_0x176903;if(_0x453e3e['query']['includeAll']){_0x3d6a0c[_0xb6a3('0x40')]=[{'all':!![]}];}return db[_0xb6a3('0x2a')]['findAll'](_0x3d6a0c);})[_0xb6a3('0x23')](function(_0x31dcd2){_0x4dda55[_0xb6a3('0x41')]=_0x31dcd2;return _0x4dda55;})[_0xb6a3('0x23')](respondWithFilteredResult(_0xc44047,_0x3d6a0c))['catch'](handleError(_0xc44047,null));};exports[_0xb6a3('0x42')]=function(_0x285d11,_0x23a038){var _0x5dbeab={'raw':!![],'where':{'id':_0x285d11['params']['id']}},_0x3bd746={};_0x3bd746[_0xb6a3('0x2f')]=_['keys'](db['Disposition'][_0xb6a3('0x2b')]);_0x3bd746[_0xb6a3('0x31')]=_['keys'](_0x285d11['query']);_0x3bd746['filters']=_['intersection'](_0x3bd746[_0xb6a3('0x2f')],_0x3bd746['query']);_0x5dbeab['attributes']=_[_0xb6a3('0x43')](_0x3bd746[_0xb6a3('0x2f')],qs[_0xb6a3('0x34')](_0x285d11[_0xb6a3('0x31')][_0xb6a3('0x34')]));_0x5dbeab[_0xb6a3('0x35')]=_0x5dbeab['attributes'][_0xb6a3('0x36')]?_0x5dbeab[_0xb6a3('0x35')]:_0x3bd746['model'];if(_0x285d11['query'][_0xb6a3('0x44')]){_0x5dbeab[_0xb6a3('0x40')]=[{'all':!![]}];}_0x5dbeab=_[_0xb6a3('0x3e')]({},_0x5dbeab,_0x285d11['options']);return db[_0xb6a3('0x2a')][_0xb6a3('0x45')](_0x5dbeab)[_0xb6a3('0x23')](handleEntityNotFound(_0x23a038,null))[_0xb6a3('0x23')](respondWithResult(_0x23a038,null))[_0xb6a3('0x46')](handleError(_0x23a038,null));};exports[_0xb6a3('0x47')]=function(_0x5e83c3,_0x5e8413){return db['Disposition'][_0xb6a3('0x47')](_0x5e83c3[_0xb6a3('0x48')],{})['then'](function(_0x112792){var _0x341e87=_0x5e83c3[_0xb6a3('0x49')][_0xb6a3('0x4a')]({'plain':!![]});if(!_0x341e87)throw new Error(_0xb6a3('0x4b'));if(_0x341e87[_0xb6a3('0x4c')]===_0xb6a3('0x49')){var _0x466fbc=_0x112792[_0xb6a3('0x4a')]({'plain':!![]});var _0x5787b1='Dispositions';return db[_0xb6a3('0x4d')]['find']({'where':{'name':_0x5787b1,'userProfileId':_0x341e87[_0xb6a3('0x4e')]},'raw':!![]})[_0xb6a3('0x23')](function(_0x1c8c9c){if(_0x1c8c9c&&_0x1c8c9c[_0xb6a3('0x4f')]===0x0){return db[_0xb6a3('0x50')][_0xb6a3('0x47')]({'name':_0x466fbc[_0xb6a3('0x28')],'resourceId':_0x466fbc['id'],'type':_0x1c8c9c[_0xb6a3('0x28')],'sectionId':_0x1c8c9c['id']},{})[_0xb6a3('0x23')](function(){return _0x112792;});}else{return _0x112792;}})[_0xb6a3('0x46')](function(_0x1dc738){logger[_0xb6a3('0x26')](_0xb6a3('0x51'),_0x1dc738);throw _0x1dc738;});}return _0x112792;})['then'](respondWithResult(_0x5e8413,0xc9))['catch'](handleError(_0x5e8413,null));};exports[_0xb6a3('0x22')]=function(_0x288101,_0x4d7c86){if(_0x288101[_0xb6a3('0x48')]['id']){delete _0x288101[_0xb6a3('0x48')]['id'];}return db[_0xb6a3('0x2a')]['find']({'where':{'id':_0x288101[_0xb6a3('0x52')]['id']}})[_0xb6a3('0x23')](handleEntityNotFound(_0x4d7c86,null))[_0xb6a3('0x23')](saveUpdates(_0x288101['body'],null))['then'](respondWithResult(_0x4d7c86,null))['catch'](handleError(_0x4d7c86,null));};exports[_0xb6a3('0x24')]=function(_0x35a781,_0x2dc77c){return db['Disposition'][_0xb6a3('0x45')]({'where':{'id':_0x35a781[_0xb6a3('0x52')]['id']}})[_0xb6a3('0x23')](handleEntityNotFound(_0x2dc77c,null))[_0xb6a3('0x23')](removeEntity(_0x2dc77c,null))[_0xb6a3('0x46')](handleError(_0x2dc77c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0521af6..fc24514 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 _0x4be7=['./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_whatsapp','WhatsappAccountId','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4be7,0x93));var _0x74be=function(_0x2e846d,_0x370cd6){_0x2e846d=_0x2e846d-0x0;var _0x10a6ab=_0x4be7[_0x2e846d];return _0x10a6ab;};'use strict';var _=require('lodash');var util=require(_0x74be('0x0'));var logger=require('../../config/logger')(_0x74be('0x1'));var moment=require('moment');var BPromise=require(_0x74be('0x2'));var rp=require(_0x74be('0x3'));var fs=require('fs');var path=require(_0x74be('0x4'));var rimraf=require(_0x74be('0x5'));var config=require(_0x74be('0x6'));var attributes=require(_0x74be('0x7'));module[_0x74be('0x8')]=function(_0x178f9e,_0x47555e){return _0x178f9e[_0x74be('0x9')](_0x74be('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x74be('0xb'),_0x74be('0xc')]},{'unique':!![],'name':_0x74be('0xd'),'fields':[_0x74be('0xb'),_0x74be('0xe')]},{'unique':!![],'name':_0x74be('0xf'),'fields':[_0x74be('0xb'),_0x74be('0x10')]},{'unique':!![],'name':_0x74be('0x11'),'fields':[_0x74be('0xb'),_0x74be('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x74be('0xb'),_0x74be('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x74be('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x74be('0x14'),'fields':[_0x74be('0xb'),_0x74be('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5011=['MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0xb3c46e,_0x5c15f0){var _0x43ad16=function(_0x865238){while(--_0x865238){_0xb3c46e['push'](_0xb3c46e['shift']());}};_0x43ad16(++_0x5c15f0);}(_0x5011,0x102));var _0x1501=function(_0xce221a,_0x2d84cf){_0xce221a=_0xce221a-0x0;var _0x3a57be=_0x5011[_0xce221a];return _0x3a57be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1501('0x0'))(_0x1501('0x1'));var moment=require(_0x1501('0x2'));var BPromise=require(_0x1501('0x3'));var rp=require(_0x1501('0x4'));var fs=require('fs');var path=require(_0x1501('0x5'));var rimraf=require(_0x1501('0x6'));var config=require(_0x1501('0x7'));var attributes=require(_0x1501('0x8'));module[_0x1501('0x9')]=function(_0x5c6510,_0x24dcf8){return _0x5c6510[_0x1501('0xa')](_0x1501('0xb'),attributes,{'tableName':_0x1501('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1501('0xd'),'fields':[_0x1501('0xe'),_0x1501('0xf')]},{'unique':!![],'name':_0x1501('0x10'),'fields':[_0x1501('0xe'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x1501('0xe'),_0x1501('0x11')]},{'unique':!![],'name':_0x1501('0x12'),'fields':[_0x1501('0xe'),_0x1501('0x13')]},{'unique':!![],'name':_0x1501('0x14'),'fields':[_0x1501('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x1501('0x15'),'fields':[_0x1501('0xe'),_0x1501('0x16')]},{'unique':!![],'name':_0x1501('0x17'),'fields':[_0x1501('0xe'),_0x1501('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 9d48b34..033a10d 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(_0x382b04,_0x342877){var _0x4c5188=function(_0x43b43f){while(--_0x43b43f){_0x382b04['push'](_0x382b04['shift']());}};_0x4c5188(++_0x342877);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x5c9b87,_0x456be6){var _0xb96880=function(_0x4747ce){while(--_0x4747ce){_0x5c9b87['push'](_0x5c9b87['shift']());}};_0xb96880(++_0x456be6);}(_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 50be6ca..f35f956 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 _0x1499=['./disposition.controller','get','/:id','isAuthenticated','show','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x56b35c,_0x59fb99){var _0xae5768=function(_0x4bf57e){while(--_0x4bf57e){_0x56b35c['push'](_0x56b35c['shift']());}};_0xae5768(++_0x59fb99);}(_0x1499,0x118));var _0x9149=function(_0x4583a0,_0x50c521){_0x4583a0=_0x4583a0-0x0;var _0x1453e9=_0x1499[_0x4583a0];return _0x1453e9;};'use strict';var multer=require(_0x9149('0x0'));var util=require(_0x9149('0x1'));var path=require(_0x9149('0x2'));var timeout=require(_0x9149('0x3'));var express=require(_0x9149('0x4'));var router=express[_0x9149('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9149('0x6'));var config=require(_0x9149('0x7'));var controller=require(_0x9149('0x8'));router[_0x9149('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9149('0x9')](_0x9149('0xa'),auth[_0x9149('0xb')](),controller[_0x9149('0xc')]);router['post']('/',auth[_0x9149('0xb')](),controller['create']);router['put'](_0x9149('0xa'),auth[_0x9149('0xb')](),controller[_0x9149('0xd')]);router['delete'](_0x9149('0xa'),auth[_0x9149('0xb')](),controller[_0x9149('0xe')]);module[_0x9149('0xf')]=router; \ No newline at end of file +var _0x2e56=['fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','exports','multer','path','Router'];(function(_0x3bdc30,_0x119486){var _0x1a4986=function(_0x4a2ed0){while(--_0x4a2ed0){_0x3bdc30['push'](_0x3bdc30['shift']());}};_0x1a4986(++_0x119486);}(_0x2e56,0x156));var _0x62e5=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x2e56[_0x452968];return _0xb6f9ae;};'use strict';var multer=require(_0x62e5('0x0'));var util=require('util');var path=require(_0x62e5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x62e5('0x2')]();var fs_extra=require(_0x62e5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x62e5('0x4'));var config=require(_0x62e5('0x5'));var controller=require('./disposition.controller');router[_0x62e5('0x6')]('/',auth['isAuthenticated'](),controller[_0x62e5('0x7')]);router[_0x62e5('0x6')](_0x62e5('0x8'),auth[_0x62e5('0x9')](),controller[_0x62e5('0xa')]);router[_0x62e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x62e5('0xc')]);router['put'](_0x62e5('0x8'),auth[_0x62e5('0x9')](),controller[_0x62e5('0xd')]);router['delete'](_0x62e5('0x8'),auth[_0x62e5('0x9')](),controller['destroy']);module[_0x62e5('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 715a292..43af739 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 _0x8f64=['14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','localstationid','4800','7200','9600','12000','2400'];(function(_0x398b7c,_0x139757){var _0x32146f=function(_0x119f33){while(--_0x119f33){_0x398b7c['push'](_0x398b7c['shift']());}};_0x32146f(++_0x139757);}(_0x8f64,0xbd));var _0x48f6=function(_0x2e2fd4,_0xf80b13){_0x2e2fd4=_0x2e2fd4-0x0;var _0x182699=_0x8f64[_0x2e2fd4];return _0x182699;};'use strict';var Sequelize=require('sequelize');module[_0x48f6('0x0')]={'name':{'type':Sequelize[_0x48f6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x48f6('0x1')]},'ecm':{'type':Sequelize[_0x48f6('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x48f6('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x48f6('0x1')],'unique':_0x48f6('0x3')},'minrate':{'type':Sequelize[_0x48f6('0x2')]('2400',_0x48f6('0x4'),_0x48f6('0x5'),_0x48f6('0x6'),_0x48f6('0x7'),'14400'),'defaultValue':_0x48f6('0x4')},'maxrate':{'type':Sequelize[_0x48f6('0x2')](_0x48f6('0x8'),_0x48f6('0x4'),_0x48f6('0x5'),_0x48f6('0x6'),_0x48f6('0x7'),_0x48f6('0x9')),'defaultValue':_0x48f6('0x9')},'modem':{'type':Sequelize[_0x48f6('0x1')],'defaultValue':_0x48f6('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x48f6('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x48f6('0x2')](_0x48f6('0xb'),_0x48f6('0xc'),_0x48f6('0xd'),_0x48f6('0xe')),'defaultValue':_0x48f6('0xb')},'key':{'type':Sequelize[_0x48f6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x48f6('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x48f6('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x48f6('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x48f6('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x48f6('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x48f6('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x48f6('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x48f6('0x10')],'defaultValue':![],'comment':_0x48f6('0x13'),'set':function(_0x591209){if(!_0x591209)this[_0x48f6('0x14')]('mandatoryDispositionPauseId',null);this[_0x48f6('0x14')](_0x48f6('0x15'),_0x591209);}}}; \ No newline at end of file +var _0x0bed=['14400','12000','v17,v27,v29','INTEGER','IAX','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','ENUM','yes','STRING','localstationid','2400','4800','7200','9600'];(function(_0x259269,_0x6a496b){var _0x1a3277=function(_0x47ff03){while(--_0x47ff03){_0x259269['push'](_0x259269['shift']());}};_0x1a3277(++_0x6a496b);}(_0x0bed,0x186));var _0xd0be=function(_0x4737ed,_0x5c3f84){_0x4737ed=_0x4737ed-0x0;var _0x37e484=_0x0bed[_0x4737ed];return _0x37e484;};'use strict';var Sequelize=require(_0xd0be('0x0'));module[_0xd0be('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xd0be('0x2')](_0xd0be('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd0be('0x4')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd0be('0x4')],'unique':_0xd0be('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xd0be('0x6'),_0xd0be('0x7'),_0xd0be('0x8'),_0xd0be('0x9'),'12000',_0xd0be('0xa')),'defaultValue':_0xd0be('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xd0be('0x6'),_0xd0be('0x7'),'7200',_0xd0be('0x9'),_0xd0be('0xb'),_0xd0be('0xa')),'defaultValue':_0xd0be('0xa')},'modem':{'type':Sequelize[_0xd0be('0x4')],'defaultValue':_0xd0be('0xc')},'gateway':{'type':Sequelize[_0xd0be('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd0be('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd0be('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd0be('0x2')]('SIP',_0xd0be('0xe'),'DADHI',_0xd0be('0xf')),'defaultValue':_0xd0be('0x10')},'key':{'type':Sequelize[_0xd0be('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd0be('0x11')],'defaultValue':function(){return _0xd0be('0x12');}},'notificationSound':{'type':Sequelize[_0xd0be('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd0be('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0be('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd0be('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd0be('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd0be('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xd0be('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xd0be('0x13')],'defaultValue':![],'comment':_0xd0be('0x15'),'set':function(_0x146dc7){if(!_0x146dc7)this['setDataValue'](_0xd0be('0x16'),null);this[_0xd0be('0x17')](_0xd0be('0x18'),_0x146dc7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3c24311..42a6490 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 _0x7c9a=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','localstationid','app','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','omit','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','format','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','offset','count','limit','json','reject','save','get','destroy','end','name','index','Pause','map','FaxAccount','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction'];(function(_0x5dc728,_0x380b89){var _0x19c56d=function(_0x8e110a){while(--_0x8e110a){_0x5dc728['push'](_0x5dc728['shift']());}};_0x19c56d(++_0x380b89);}(_0x7c9a,0xfb));var _0xa7c9=function(_0x4df661,_0x481a9b){_0x4df661=_0x4df661-0x0;var _0x2ccd9c=_0x7c9a[_0x4df661];return _0x2ccd9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa7c9('0x0'));var zipdir=require(_0xa7c9('0x1'));var jsonpatch=require(_0xa7c9('0x2'));var rp=require(_0xa7c9('0x3'));var moment=require('moment');var BPromise=require(_0xa7c9('0x4'));var Mustache=require(_0xa7c9('0x5'));var util=require(_0xa7c9('0x6'));var path=require(_0xa7c9('0x7'));var sox=require(_0xa7c9('0x8'));var csv=require(_0xa7c9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa7c9('0xa'));var _=require(_0xa7c9('0xb'));var squel=require(_0xa7c9('0xc'));var crypto=require(_0xa7c9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa7c9('0xe'));var toCsv=require(_0xa7c9('0x9'));var querystring=require(_0xa7c9('0xf'));var Papa=require(_0xa7c9('0x10'));var Redis=require(_0xa7c9('0x11'));var authService=require(_0xa7c9('0x12'));var qs=require(_0xa7c9('0x13'));var as=require(_0xa7c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa7c9('0x15'));var config=require(_0xa7c9('0x16'));var licenseUtil=require(_0xa7c9('0x17'));var db=require('../../mysqldb')['db'];config[_0xa7c9('0x18')]=_[_0xa7c9('0x19')](config[_0xa7c9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7c9('0x1a'))(new Redis(config[_0xa7c9('0x18')]));require('./faxAccount.socket')[_0xa7c9('0x1b')](socket);var jayson=require(_0xa7c9('0x1c'));var client=jayson[_0xa7c9('0x1d')][_0xa7c9('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xa7c9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x59d484,_0x3c3669,_0x9f2b80,_0x31d5e0){return new BPromise(function(_0x1119da,_0x44db9f){var _0xe8a700=_0x31d5e0||client;return _0xe8a700[_0xa7c9('0x1f')](_0x59d484,_0x9f2b80)[_0xa7c9('0x20')](function(_0x4f10da){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3c3669,_0xa7c9('0x21'));logger[_0xa7c9('0x22')](_0xa7c9('0x23'),_0x3c3669,'request\x20sent',JSON[_0xa7c9('0x24')](_0x4f10da));if(_0x4f10da[_0xa7c9('0x25')]){if(_0x4f10da[_0xa7c9('0x25')][_0xa7c9('0x26')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3c3669,_0x4f10da[_0xa7c9('0x25')]['message']);return _0x44db9f(_0x4f10da[_0xa7c9('0x25')][_0xa7c9('0x27')]);}logger[_0xa7c9('0x25')](_0xa7c9('0x28'),_0x3c3669,_0x4f10da[_0xa7c9('0x25')][_0xa7c9('0x27')]);return _0x1119da(_0x4f10da['error'][_0xa7c9('0x27')]);}else{logger[_0xa7c9('0x29')](_0xa7c9('0x28'),_0x3c3669,_0xa7c9('0x21'));_0x1119da(_0x4f10da[_0xa7c9('0x2a')]['message']);}})[_0xa7c9('0x2b')](function(_0xb8cf0b){logger[_0xa7c9('0x25')](_0xa7c9('0x28'),_0x3c3669,_0xb8cf0b);_0x44db9f(_0xb8cf0b);});});}function respondWithStatusCode(_0x2b1f87,_0x97dc80){_0x97dc80=_0x97dc80||0xcc;return function(_0x208cd0){if(_0x208cd0){return _0x2b1f87[_0xa7c9('0x2c')](_0x97dc80);}return _0x2b1f87[_0xa7c9('0x2d')](_0x97dc80)['end']();};}function respondWithResult(_0x51e877,_0x5286af){_0x5286af=_0x5286af||0xc8;return function(_0x74040e){if(_0x74040e){return _0x51e877[_0xa7c9('0x2d')](_0x5286af)['json'](_0x74040e);}};}function respondWithFilteredResult(_0x3f0ae4,_0x271b5d){return function(_0x12087d){if(_0x12087d){var _0x594464=typeof _0x271b5d[_0xa7c9('0x2e')]==='undefined'&&typeof _0x271b5d['limit']==='undefined';var _0x187cce=_0x12087d[_0xa7c9('0x2f')];var _0x1ec950=_0x594464?0x0:_0x271b5d['offset'];var _0x9563be=_0x594464?_0x12087d['count']:_0x271b5d[_0xa7c9('0x2e')]+_0x271b5d[_0xa7c9('0x30')];var _0x598992;if(_0x9563be>=_0x187cce){_0x9563be=_0x187cce;_0x598992=0xc8;}else{_0x598992=0xce;}_0x3f0ae4['status'](_0x598992);return _0x3f0ae4['set']('Content-Range',_0x1ec950+'-'+_0x9563be+'/'+_0x187cce)[_0xa7c9('0x31')](_0x12087d);}return null;};}function patchUpdates(_0x2169f3){return function(_0x4b2f95){try{jsonpatch['apply'](_0x4b2f95,_0x2169f3,!![]);}catch(_0x287ac8){return BPromise[_0xa7c9('0x32')](_0x287ac8);}return _0x4b2f95[_0xa7c9('0x33')]();};}function saveUpdates(_0x103ee6,_0x99bec6){return function(_0x542e85){if(_0x542e85){return _0x542e85['update'](_0x103ee6)[_0xa7c9('0x20')](function(_0x225ae0){return _0x225ae0;});}return null;};}function removeEntity(_0x3fdd73,_0x1c47fd){return function(_0xd686e2){if(_0xd686e2){return _0xd686e2['destroy']()[_0xa7c9('0x20')](function(){var _0xbc836a=_0xd686e2[_0xa7c9('0x34')]({'plain':!![]});var _0x25421c='FaxAccounts';return db['UserProfileResource'][_0xa7c9('0x35')]({'where':{'type':_0x25421c,'resourceId':_0xbc836a['id']}})[_0xa7c9('0x20')](function(){return _0xd686e2;});})['then'](function(){_0x3fdd73[_0xa7c9('0x2d')](0xcc)[_0xa7c9('0x36')]();});}};}function handleEntityNotFound(_0x1b74d4,_0x394bf0){return function(_0x5ef527){if(!_0x5ef527){_0x1b74d4[_0xa7c9('0x2c')](0x194);}return _0x5ef527;};}function handleError(_0x1ce78c,_0x1ec4f0){_0x1ec4f0=_0x1ec4f0||0x1f4;return function(_0x49ce99){logger[_0xa7c9('0x25')](_0x49ce99['stack']);if(_0x49ce99['name']){delete _0x49ce99[_0xa7c9('0x37')];}_0x1ce78c[_0xa7c9('0x2d')](_0x1ec4f0)['send'](_0x49ce99);};}exports[_0xa7c9('0x38')]=function(_0x1f2993,_0x46a7dd){var _0x59c26d={'include':[{'model':db[_0xa7c9('0x39')],'as':'mandatoryDispositionPause'}]},_0x2188b6={},_0x37367a={'count':0x0,'rows':[]};var _0x215810=_[_0xa7c9('0x3a')](db[_0xa7c9('0x3b')][_0xa7c9('0x3c')],function(_0x260c08){return{'name':_0x260c08['fieldName'],'type':_0x260c08[_0xa7c9('0x3d')][_0xa7c9('0x3e')]};});_0x2188b6[_0xa7c9('0x3f')]=_[_0xa7c9('0x3a')](_0x215810,_0xa7c9('0x37'));_0x2188b6['query']=_[_0xa7c9('0x40')](_0x1f2993[_0xa7c9('0x41')]);_0x2188b6[_0xa7c9('0x42')]=_['intersection'](_0x2188b6[_0xa7c9('0x3f')],_0x2188b6['query']);_0x59c26d[_0xa7c9('0x43')]=_[_0xa7c9('0x44')](_0x2188b6[_0xa7c9('0x3f')],qs[_0xa7c9('0x45')](_0x1f2993[_0xa7c9('0x41')]['fields']));_0x59c26d[_0xa7c9('0x43')]=_0x59c26d['attributes']['length']?_0x59c26d[_0xa7c9('0x43')]:_0x2188b6['model'];if(!_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x59c26d[_0xa7c9('0x30')]=qs['limit'](_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x30')]);_0x59c26d[_0xa7c9('0x2e')]=qs[_0xa7c9('0x2e')](_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x2e')]);}_0x59c26d['order']=qs[_0xa7c9('0x48')](_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x48')]);_0x59c26d[_0xa7c9('0x49')]=qs['filters'](_[_0xa7c9('0x4a')](_0x1f2993[_0xa7c9('0x41')],_0x2188b6[_0xa7c9('0x42')]),_0x215810);if(_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x4b')]){_0x59c26d[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x59c26d['where'],{'$or':_[_0xa7c9('0x3a')](_0x215810,function(_0x4e82af){if(_0x4e82af[_0xa7c9('0x3d')]!==_0xa7c9('0x4d')){var _0x5aa71a={};_0x5aa71a[_0x4e82af['name']]={'$like':'%'+_0x1f2993['query'][_0xa7c9('0x4b')]+'%'};return _0x5aa71a;}})});}_0x59c26d=_[_0xa7c9('0x4c')]({},_0x59c26d,_0x1f2993[_0xa7c9('0x4e')]);var _0x1e2822={'where':_0x59c26d['where']};return db[_0xa7c9('0x3b')][_0xa7c9('0x2f')](_0x1e2822)['then'](function(_0x4cf916){_0x37367a[_0xa7c9('0x2f')]=_0x4cf916;if(_0x1f2993[_0xa7c9('0x41')][_0xa7c9('0x4f')]){_0x59c26d[_0xa7c9('0x50')]=[{'all':!![]}];}return db[_0xa7c9('0x3b')][_0xa7c9('0x51')](_0x59c26d);})[_0xa7c9('0x20')](function(_0x162cfd){_0x37367a[_0xa7c9('0x52')]=_0x162cfd;return _0x37367a;})[_0xa7c9('0x20')](respondWithFilteredResult(_0x46a7dd,_0x59c26d))[_0xa7c9('0x2b')](handleError(_0x46a7dd,null));};exports[_0xa7c9('0x53')]=function(_0x50e7f4,_0x49641b){var _0x1b36af={'raw':![],'where':{'id':_0x50e7f4['params']['id']},'include':[{'model':db[_0xa7c9('0x39')],'as':_0xa7c9('0x54')}]},_0xc23165={};_0xc23165[_0xa7c9('0x3f')]=_[_0xa7c9('0x40')](db[_0xa7c9('0x3b')][_0xa7c9('0x3c')]);_0xc23165[_0xa7c9('0x41')]=_[_0xa7c9('0x40')](_0x50e7f4[_0xa7c9('0x41')]);_0xc23165[_0xa7c9('0x42')]=_[_0xa7c9('0x44')](_0xc23165[_0xa7c9('0x3f')],_0xc23165[_0xa7c9('0x41')]);_0x1b36af[_0xa7c9('0x43')]=_[_0xa7c9('0x44')](_0xc23165['model'],qs[_0xa7c9('0x45')](_0x50e7f4[_0xa7c9('0x41')][_0xa7c9('0x45')]));_0x1b36af['attributes']=_0x1b36af[_0xa7c9('0x43')][_0xa7c9('0x55')]?_0x1b36af[_0xa7c9('0x43')]:_0xc23165[_0xa7c9('0x3f')];if(_0x50e7f4[_0xa7c9('0x41')][_0xa7c9('0x4f')]){_0x1b36af[_0xa7c9('0x50')]=[{'all':!![]}];}_0x1b36af=_[_0xa7c9('0x4c')]({},_0x1b36af,_0x50e7f4[_0xa7c9('0x4e')]);return db[_0xa7c9('0x3b')]['find'](_0x1b36af)['then'](handleEntityNotFound(_0x49641b,null))[_0xa7c9('0x20')](respondWithResult(_0x49641b,null))[_0xa7c9('0x2b')](handleError(_0x49641b,null));};exports[_0xa7c9('0x56')]=function(_0x4dd0b6,_0x31dc6b){return db[_0xa7c9('0x3b')][_0xa7c9('0x56')](_0x4dd0b6[_0xa7c9('0x57')],{})['then'](function(_0x1b1f70){var _0x24d336=_0x4dd0b6[_0xa7c9('0x58')][_0xa7c9('0x34')]({'plain':!![]});if(!_0x24d336)throw new Error(_0xa7c9('0x59'));if(_0x24d336[_0xa7c9('0x5a')]===_0xa7c9('0x58')){var _0x14898d=_0x1b1f70['get']({'plain':!![]});var _0x167756=_0xa7c9('0x5b');return db['UserProfileSection'][_0xa7c9('0x5c')]({'where':{'name':_0x167756,'userProfileId':_0x24d336[_0xa7c9('0x5d')]},'raw':!![]})[_0xa7c9('0x20')](function(_0x341cbb){if(_0x341cbb&&_0x341cbb[_0xa7c9('0x5e')]===0x0){return db[_0xa7c9('0x5f')][_0xa7c9('0x56')]({'name':_0x14898d[_0xa7c9('0x37')],'resourceId':_0x14898d['id'],'type':_0x341cbb[_0xa7c9('0x37')],'sectionId':_0x341cbb['id']},{})[_0xa7c9('0x20')](function(){return _0x1b1f70;});}else{return _0x1b1f70;}})[_0xa7c9('0x2b')](function(_0x13ec03){logger[_0xa7c9('0x25')](_0xa7c9('0x60'),_0x13ec03);throw _0x13ec03;});}return _0x1b1f70;})[_0xa7c9('0x20')](respondWithResult(_0x31dc6b,0xc9))[_0xa7c9('0x2b')](handleError(_0x31dc6b,null));};exports[_0xa7c9('0x61')]=function(_0x24c6fd,_0x47b480){if(_0x24c6fd['body']['id']){delete _0x24c6fd[_0xa7c9('0x57')]['id'];}return db[_0xa7c9('0x3b')][_0xa7c9('0x5c')]({'where':{'id':_0x24c6fd[_0xa7c9('0x62')]['id']},'include':[{'model':db[_0xa7c9('0x39')],'as':_0xa7c9('0x54')}]})[_0xa7c9('0x20')](handleEntityNotFound(_0x47b480,null))[_0xa7c9('0x20')](saveUpdates(_0x24c6fd[_0xa7c9('0x57')],null))[_0xa7c9('0x20')](respondWithResult(_0x47b480,null))[_0xa7c9('0x2b')](handleError(_0x47b480,null));};exports[_0xa7c9('0x35')]=function(_0x1f958d,_0x26a478){return db['FaxAccount']['find']({'where':{'id':_0x1f958d[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x26a478,null))[_0xa7c9('0x20')](removeEntity(_0x26a478,null))[_0xa7c9('0x2b')](handleError(_0x26a478,null));};exports[_0xa7c9('0x63')]=function(_0x273204,_0x54975e){return db['FaxAccount']['describe']()[_0xa7c9('0x20')](respondWithResult(_0x54975e,null))[_0xa7c9('0x2b')](handleError(_0x54975e,null));};exports['addDisposition']=function(_0x175966,_0x4a9fc0,_0x376f04){if(_0x175966[_0xa7c9('0x57')]['id']){delete _0x175966[_0xa7c9('0x57')]['id'];}return db[_0xa7c9('0x3b')][_0xa7c9('0x5c')]({'where':{'id':_0x175966[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x4a9fc0,null))['then'](function(_0x300b90){if(_0x300b90){_0x175966['body'][_0xa7c9('0x64')]=_0x300b90['id'];return db[_0xa7c9('0x65')][_0xa7c9('0x56')](_0x175966[_0xa7c9('0x57')]);}})['then'](respondWithResult(_0x4a9fc0,null))['catch'](handleError(_0x4a9fc0,null));};exports[_0xa7c9('0x66')]=function(_0x343622,_0x14deb1,_0x2893de){var _0x1ce396={'raw':![],'where':{}};var _0x191f06={};var _0x1922b8={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa7c9('0x67')]({'where':{'id':_0x343622[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x14deb1,null))[_0xa7c9('0x20')](function(_0x5b781b){if(_0x5b781b){_0x191f06['model']=_[_0xa7c9('0x40')](db['Disposition']['rawAttributes']);_0x191f06['query']=_[_0xa7c9('0x40')](_0x343622[_0xa7c9('0x41')]);_0x191f06[_0xa7c9('0x42')]=_[_0xa7c9('0x44')](_0x191f06[_0xa7c9('0x3f')],_0x191f06[_0xa7c9('0x41')]);_0x1ce396[_0xa7c9('0x43')]=_['intersection'](_0x191f06[_0xa7c9('0x3f')],qs['fields'](_0x343622[_0xa7c9('0x41')][_0xa7c9('0x45')]));_0x1ce396[_0xa7c9('0x43')]=_0x1ce396[_0xa7c9('0x43')]['length']?_0x1ce396[_0xa7c9('0x43')]:_0x191f06['model'];if(!_0x343622[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x1ce396['limit']=qs[_0xa7c9('0x30')](_0x343622[_0xa7c9('0x41')][_0xa7c9('0x30')]);_0x1ce396[_0xa7c9('0x2e')]=qs[_0xa7c9('0x2e')](_0x343622['query'][_0xa7c9('0x2e')]);}_0x1ce396[_0xa7c9('0x68')]=qs['sort'](_0x343622[_0xa7c9('0x41')][_0xa7c9('0x48')]);_0x1ce396[_0xa7c9('0x49')]=qs[_0xa7c9('0x42')](_[_0xa7c9('0x4a')](_0x343622[_0xa7c9('0x41')],_0x191f06['filters']));_0x1ce396['where'][_0xa7c9('0x64')]=_0x5b781b['id'];if(_0x343622[_0xa7c9('0x41')][_0xa7c9('0x4b')]){_0x1ce396[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x1ce396[_0xa7c9('0x49')],{'$or':_['map'](_0x1ce396['attributes'],function(_0xcea148){var _0x10ecb8={};_0x10ecb8[_0xcea148]={'$like':'%'+_0x343622[_0xa7c9('0x41')][_0xa7c9('0x4b')]+'%'};return _0x10ecb8;})});}_0x1ce396=_[_0xa7c9('0x4c')]({},_0x1ce396,_0x343622[_0xa7c9('0x4e')]);return db[_0xa7c9('0x65')][_0xa7c9('0x2f')]({'where':_0x1ce396[_0xa7c9('0x49')]})['then'](function(_0x2504e1){_0x1922b8[_0xa7c9('0x2f')]=_0x2504e1;if(_0x343622[_0xa7c9('0x41')]['includeAll']){_0x1ce396[_0xa7c9('0x50')]=[{'all':!![]}];}return db['Disposition'][_0xa7c9('0x51')](_0x1ce396);})[_0xa7c9('0x20')](function(_0x4fb8e0){_0x1922b8['rows']=_0x4fb8e0;return _0x1922b8;});}})['then'](respondWithFilteredResult(_0x14deb1,_0x1ce396))[_0xa7c9('0x2b')](handleError(_0x14deb1,null));};exports[_0xa7c9('0x69')]=function(_0x21b3ce,_0x2281d1,_0x4184ef){return db['FaxAccount'][_0xa7c9('0x5c')]({'where':{'id':_0x21b3ce[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x2281d1,null))[_0xa7c9('0x20')](function(_0x1faeba){if(_0x1faeba){return _0x1faeba[_0xa7c9('0x69')](_0x21b3ce[_0xa7c9('0x41')][_0xa7c9('0x6a')]);}})['then'](respondWithStatusCode(_0x2281d1,null))['catch'](handleError(_0x2281d1,null));};exports[_0xa7c9('0x6b')]=function(_0x4801ff,_0x1fee4f,_0x2c3e71){if(_0x4801ff[_0xa7c9('0x57')]['id']){delete _0x4801ff[_0xa7c9('0x57')]['id'];}return db[_0xa7c9('0x3b')]['find']({'where':{'id':_0x4801ff[_0xa7c9('0x62')]['id']}})['then'](handleEntityNotFound(_0x1fee4f,null))[_0xa7c9('0x20')](function(_0x2e8574){if(_0x2e8574){_0x4801ff[_0xa7c9('0x57')][_0xa7c9('0x64')]=_0x2e8574['id'];return db[_0xa7c9('0x6c')]['create'](_0x4801ff[_0xa7c9('0x57')]);}})[_0xa7c9('0x20')](respondWithResult(_0x1fee4f,null))[_0xa7c9('0x2b')](handleError(_0x1fee4f,null));};exports['getAnswers']=function(_0x11f7e,_0x3749a1,_0x3613ff){var _0x28a486={'raw':![],'where':{}};var _0x28f909={};var _0x10ed25={'count':0x0,'rows':[]};return db[_0xa7c9('0x3b')][_0xa7c9('0x67')]({'where':{'id':_0x11f7e[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x3749a1,null))[_0xa7c9('0x20')](function(_0x2437bd){if(_0x2437bd){_0x28f909['model']=_[_0xa7c9('0x40')](db[_0xa7c9('0x6c')][_0xa7c9('0x3c')]);_0x28f909[_0xa7c9('0x41')]=_[_0xa7c9('0x40')](_0x11f7e['query']);_0x28f909[_0xa7c9('0x42')]=_['intersection'](_0x28f909[_0xa7c9('0x3f')],_0x28f909[_0xa7c9('0x41')]);_0x28a486['attributes']=_['intersection'](_0x28f909[_0xa7c9('0x3f')],qs[_0xa7c9('0x45')](_0x11f7e['query']['fields']));_0x28a486[_0xa7c9('0x43')]=_0x28a486[_0xa7c9('0x43')][_0xa7c9('0x55')]?_0x28a486[_0xa7c9('0x43')]:_0x28f909['model'];if(!_0x11f7e[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x28a486[_0xa7c9('0x30')]=qs[_0xa7c9('0x30')](_0x11f7e[_0xa7c9('0x41')][_0xa7c9('0x30')]);_0x28a486[_0xa7c9('0x2e')]=qs['offset'](_0x11f7e[_0xa7c9('0x41')][_0xa7c9('0x2e')]);}_0x28a486['order']=qs[_0xa7c9('0x48')](_0x11f7e[_0xa7c9('0x41')][_0xa7c9('0x48')]);_0x28a486[_0xa7c9('0x49')]=qs['filters'](_['pick'](_0x11f7e['query'],_0x28f909[_0xa7c9('0x42')]));_0x28a486[_0xa7c9('0x49')][_0xa7c9('0x64')]=_0x2437bd['id'];if(_0x11f7e['query'][_0xa7c9('0x4b')]){_0x28a486[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x28a486[_0xa7c9('0x49')],{'$or':_[_0xa7c9('0x3a')](_0x28a486[_0xa7c9('0x43')],function(_0x37061d){var _0x4cbdc0={};_0x4cbdc0[_0x37061d]={'$like':'%'+_0x11f7e['query'][_0xa7c9('0x4b')]+'%'};return _0x4cbdc0;})});}_0x28a486=_[_0xa7c9('0x4c')]({},_0x28a486,_0x11f7e[_0xa7c9('0x4e')]);return db[_0xa7c9('0x6c')][_0xa7c9('0x2f')]({'where':_0x28a486[_0xa7c9('0x49')]})[_0xa7c9('0x20')](function(_0x5f241d){_0x10ed25[_0xa7c9('0x2f')]=_0x5f241d;if(_0x11f7e['query'][_0xa7c9('0x4f')]){_0x28a486[_0xa7c9('0x50')]=[{'all':!![]}];}return db[_0xa7c9('0x6c')]['findAll'](_0x28a486);})[_0xa7c9('0x20')](function(_0x1dcd76){_0x10ed25['rows']=_0x1dcd76;return _0x10ed25;});}})[_0xa7c9('0x20')](respondWithFilteredResult(_0x3749a1,_0x28a486))[_0xa7c9('0x2b')](handleError(_0x3749a1,null));};exports['removeAnswers']=function(_0x26282a,_0x2de526,_0x32086a){return db[_0xa7c9('0x3b')]['find']({'where':{'id':_0x26282a[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x2de526,null))[_0xa7c9('0x20')](function(_0x12891b){if(_0x12891b){return _0x12891b[_0xa7c9('0x6d')](_0x26282a['query']['ids']);}})[_0xa7c9('0x20')](respondWithStatusCode(_0x2de526,null))[_0xa7c9('0x2b')](handleError(_0x2de526,null));};exports['addInteraction']=function(_0x2bc3eb,_0xea7b38,_0x44feac){return db[_0xa7c9('0x6e')]['find']({'where':{'id':_0x2bc3eb[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0xea7b38,null))[_0xa7c9('0x20')](function(_0x40f522){if(_0x40f522){return _0x40f522[_0xa7c9('0x6f')](_0x2bc3eb[_0xa7c9('0x57')][_0xa7c9('0x6a')],_['omit'](_0x2bc3eb[_0xa7c9('0x57')],[_0xa7c9('0x6a'),'id'])||{});}})[_0xa7c9('0x20')](respondWithResult(_0xea7b38,null))[_0xa7c9('0x2b')](handleError(_0xea7b38,null));};exports[_0xa7c9('0x70')]=function(_0x370909,_0x5c086a,_0x51fbb3){var _0x170479={'raw':![],'where':{}};var _0xa2ba2f={};var _0x43e953={'count':0x0,'rows':[]};return db[_0xa7c9('0x3b')][_0xa7c9('0x67')]({'where':{'id':_0x370909['params']['id']}})['then'](handleEntityNotFound(_0x5c086a,null))[_0xa7c9('0x20')](function(_0x5bd8a0){if(_0x5bd8a0){_0xa2ba2f[_0xa7c9('0x3f')]=_[_0xa7c9('0x40')](db[_0xa7c9('0x6e')][_0xa7c9('0x3c')]);_0xa2ba2f[_0xa7c9('0x41')]=_[_0xa7c9('0x40')](_0x370909[_0xa7c9('0x41')]);_0xa2ba2f[_0xa7c9('0x42')]=_['intersection'](_0xa2ba2f[_0xa7c9('0x3f')],_0xa2ba2f[_0xa7c9('0x41')]);_0x170479[_0xa7c9('0x43')]=_[_0xa7c9('0x44')](_0xa2ba2f['model'],qs['fields'](_0x370909['query'][_0xa7c9('0x45')]));_0x170479['attributes']=_0x170479[_0xa7c9('0x43')][_0xa7c9('0x55')]?_0x170479[_0xa7c9('0x43')]:_0xa2ba2f['model'];if(!_0x370909[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x170479[_0xa7c9('0x30')]=qs[_0xa7c9('0x30')](_0x370909['query'][_0xa7c9('0x30')]);_0x170479['offset']=qs['offset'](_0x370909[_0xa7c9('0x41')][_0xa7c9('0x2e')]);}_0x170479[_0xa7c9('0x68')]=qs[_0xa7c9('0x48')](_0x370909[_0xa7c9('0x41')][_0xa7c9('0x48')]);_0x170479[_0xa7c9('0x49')]=qs[_0xa7c9('0x42')](_[_0xa7c9('0x4a')](_0x370909['query'],_0xa2ba2f[_0xa7c9('0x42')]));_0x170479['where'][_0xa7c9('0x64')]=_0x5bd8a0['id'];if(_0x370909['query'][_0xa7c9('0x4b')]){_0x170479[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x170479['where'],{'$or':_['map'](_0x170479[_0xa7c9('0x43')],function(_0x52d3ae){var _0x545148={};_0x545148[_0x52d3ae]={'$like':'%'+_0x370909['query'][_0xa7c9('0x4b')]+'%'};return _0x545148;})});}_0x170479=_['merge']({},_0x170479,_0x370909[_0xa7c9('0x4e')]);return db[_0xa7c9('0x6e')]['count']({'where':_0x170479[_0xa7c9('0x49')]})['then'](function(_0x278739){_0x43e953[_0xa7c9('0x2f')]=_0x278739;if(_0x370909['query'][_0xa7c9('0x4f')]){_0x170479[_0xa7c9('0x50')]=[{'model':db[_0xa7c9('0x71')],'as':_0xa7c9('0x72'),'required':![]},{'model':db[_0xa7c9('0x73')],'as':_0xa7c9('0x74'),'attributes':[_0xa7c9('0x37'),_0xa7c9('0x75'),'internal'],'required':![]},{'model':db[_0xa7c9('0x76')],'as':_0xa7c9('0x77'),'attributes':['id','name',_0xa7c9('0x78')],'where':_0x370909[_0xa7c9('0x41')][_0xa7c9('0x79')]?{'id':_0x370909[_0xa7c9('0x41')]['tag']}:undefined,'required':_0x370909[_0xa7c9('0x41')][_0xa7c9('0x79')]?!![]:![]}];}return db[_0xa7c9('0x6e')]['findAll'](_0x170479);})[_0xa7c9('0x20')](function(_0x535ea3){_0x43e953[_0xa7c9('0x52')]=_0x535ea3;return _0x43e953;});}})['then'](respondWithFilteredResult(_0x5c086a,_0x170479))[_0xa7c9('0x2b')](handleError(_0x5c086a,null));};exports[_0xa7c9('0x7a')]=function(_0x5de265,_0x4c5ae8){var _0x3ff525=_0x5de265['params']['id'];var _0x241c53=_0x5de265[_0xa7c9('0x57')];var _0x110879=0xc8;var _0xbe9e4a=null;return db[_0xa7c9('0x7b')][_0xa7c9('0x7c')]({'isolationLevel':db[_0xa7c9('0x7b')][_0xa7c9('0x7d')][_0xa7c9('0x7e')][_0xa7c9('0x7f')]},function(_0x1f5641){return db[_0xa7c9('0x3b')]['findOne']({'where':{'id':_0x3ff525},'transaction':_0x1f5641})[_0xa7c9('0x20')](function(_0x47ef25){if(_0x47ef25){return db[_0xa7c9('0x80')][_0xa7c9('0x35')]({'where':{'FaxAccountId':_0x3ff525},'transaction':_0x1f5641})['then'](function(){var _0x1768c7=_[_0xa7c9('0x3a')](_0x241c53,function(_0xf2e602){_0xf2e602[_0xa7c9('0x64')]=_0x3ff525;return _0xf2e602;});return db['FaxApplication'][_0xa7c9('0x81')](_0x1768c7,{'transaction':_0x1f5641});});}else{_0x110879=0x194;_0xbe9e4a=[];}});})[_0xa7c9('0x20')](function(){if(_0x110879!==0x194){return db['FaxApplication'][_0xa7c9('0x82')]({'where':{'FaxAccountId':_0x3ff525},'order':_0xa7c9('0x83')})[_0xa7c9('0x20')](function(_0x315f6e){_0xbe9e4a=_0x315f6e;});}})[_0xa7c9('0x2b')](function(_0x24c5b4){_0x110879=0x1f4;logger['error'](_0x24c5b4['stack']);if(_0x24c5b4[_0xa7c9('0x37')]){delete _0x24c5b4['name'];}_0xbe9e4a=_0x24c5b4;})['finally'](function(){if(_0xbe9e4a===null){_0x4c5ae8['sendStatus'](_0x110879);}else{if(_0x110879===0x1f4){_0x4c5ae8['status'](_0x110879)[_0xa7c9('0x84')](_0xbe9e4a);}else{_0x4c5ae8['status'](_0x110879)[_0xa7c9('0x31')](_0xbe9e4a);}}});};exports[_0xa7c9('0x85')]=function(_0x30b47e,_0xd2be25,_0x57d847){var _0x333edb={};var _0x47714d={};var _0x5defcc;var _0x53d964;return db['FaxAccount']['findOne']({'where':{'id':_0x30b47e[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0xd2be25,null))[_0xa7c9('0x20')](function(_0x4e88ba){if(_0x4e88ba){_0x5defcc=_0x4e88ba;_0x47714d[_0xa7c9('0x3f')]=_['keys'](db[_0xa7c9('0x80')]['rawAttributes']);_0x47714d[_0xa7c9('0x41')]=_[_0xa7c9('0x40')](_0x30b47e[_0xa7c9('0x41')]);_0x47714d['filters']=_[_0xa7c9('0x44')](_0x47714d[_0xa7c9('0x3f')],_0x47714d[_0xa7c9('0x41')]);_0x333edb['attributes']=_['intersection'](_0x47714d['model'],qs[_0xa7c9('0x45')](_0x30b47e[_0xa7c9('0x41')]['fields']));_0x333edb[_0xa7c9('0x43')]=_0x333edb['attributes'][_0xa7c9('0x55')]?_0x333edb[_0xa7c9('0x43')]:_0x47714d[_0xa7c9('0x3f')];_0x333edb[_0xa7c9('0x68')]=qs[_0xa7c9('0x48')](_0x30b47e[_0xa7c9('0x41')]['sort']);_0x333edb[_0xa7c9('0x49')]=qs[_0xa7c9('0x42')](_[_0xa7c9('0x4a')](_0x30b47e[_0xa7c9('0x41')],_0x47714d[_0xa7c9('0x42')]));if(_0x30b47e[_0xa7c9('0x41')][_0xa7c9('0x4b')]){_0x333edb['where']=_['merge'](_0x333edb[_0xa7c9('0x49')],{'$or':_[_0xa7c9('0x3a')](_0x333edb[_0xa7c9('0x43')],function(_0x1b4d55){var _0x3353a7={};_0x3353a7[_0x1b4d55]={'$like':'%'+_0x30b47e[_0xa7c9('0x41')][_0xa7c9('0x4b')]+'%'};return _0x3353a7;})});}_0x333edb=_[_0xa7c9('0x4c')]({},_0x333edb,_0x30b47e[_0xa7c9('0x4e')]);return _0x5defcc[_0xa7c9('0x85')](_0x333edb);}})[_0xa7c9('0x20')](function(_0x275607){if(_0x275607){_0x53d964=_0x275607['length'];if(!_0x30b47e[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x333edb[_0xa7c9('0x30')]=qs[_0xa7c9('0x30')](_0x30b47e['query'][_0xa7c9('0x30')]);_0x333edb[_0xa7c9('0x2e')]=qs['offset'](_0x30b47e[_0xa7c9('0x41')][_0xa7c9('0x2e')]);}return _0x5defcc[_0xa7c9('0x85')](_0x333edb);}})[_0xa7c9('0x20')](function(_0x959c62){if(_0x959c62){return _0x959c62?{'count':_0x53d964,'rows':_0x959c62}:null;}})[_0xa7c9('0x20')](respondWithResult(_0xd2be25,null))['catch'](handleError(_0xd2be25,null));};function Extension(_0x392818,_0x38a0ce,_0x11c867,_0x39c6fa){this['context']='from-voip-provider';this['exten']=_0x392818[_0xa7c9('0x86')];this[_0xa7c9('0x87')]=_0x39c6fa;this[_0xa7c9('0x3d')]='system';this['description']='Fax\x20Extension';this[_0xa7c9('0x64')]=_0x392818['id'];this[_0xa7c9('0x83')]=_0x38a0ce;this[_0xa7c9('0x88')]=_0x11c867;}function createExtensionsReciveFax(_0x5158e8){var _0xba59f1=0x1;var _0xef7d0f=[];_0xef7d0f[_0xa7c9('0x89')](new Extension(_0x5158e8,_0xba59f1,'',_0xa7c9('0x8a')));_0xba59f1+=0x1;_0xef7d0f[_0xa7c9('0x89')](new Extension(_0x5158e8,_0xba59f1,_0xa7c9('0x8b'),_0xa7c9('0x8c')));_0xba59f1+=0x1;for(var _0x589d63 in _0x5158e8){if(_0x5158e8[_0xa7c9('0x46')](_0x589d63)&&(_0x589d63===_0xa7c9('0x8d')||_0x589d63===_0xa7c9('0x86')||_0x589d63===_0xa7c9('0x8e')||_0x589d63==='faxdetect'||_0x589d63==='headerinfo'||_0x589d63==='maxrate'||_0x589d63===_0xa7c9('0x8f')||_0x589d63===_0xa7c9('0x90')||_0x589d63===_0xa7c9('0x91'))){_0xef7d0f['push'](new Extension(_0x5158e8,_0xba59f1,_0xa7c9('0x92')+_0x589d63+')='+_0x5158e8[_0x589d63],'Set'));_0xba59f1+=0x1;}}_0xef7d0f['push'](new Extension(_0x5158e8,_0xba59f1,'6','Wait'));_0xba59f1+=0x1;_0xef7d0f[_0xa7c9('0x89')](new Extension(_0x5158e8,_0xba59f1,'/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',_0xa7c9('0x93')));_0xba59f1=0x0;return _0xef7d0f;}exports[_0xa7c9('0x94')]=function(_0x57a5fa,_0x56977c,_0x4ba125){var _0x68281a;return db['sequelize'][_0xa7c9('0x7c')](function(_0x16870e){return db[_0xa7c9('0x3b')]['create'](_0x57a5fa['body'],{'transaction':_0x16870e})[_0xa7c9('0x20')](function(_0x40e22e){_0x68281a=_0x40e22e[_0xa7c9('0x34')]({'plain':!![]});return db['VoiceExtension'][_0xa7c9('0x81')](createExtensionsReciveFax(_0x68281a),{'transaction':_0x16870e});});})['then'](function(){return _0x68281a;})[_0xa7c9('0x20')](respondWithResult(_0x56977c,null))[_0xa7c9('0x2b')](handleError(_0x56977c,null));};exports['updateAccountApplications']=function(_0x56fd08,_0x2053c1,_0x55fde8){var _0x2cb8a5;return db['sequelize'][_0xa7c9('0x7c')](function(_0x4819e3){return db[_0xa7c9('0x3b')][_0xa7c9('0x61')](_0x56fd08[_0xa7c9('0x57')],{'where':{'id':_0x56fd08[_0xa7c9('0x57')]['id']},'transaction':_0x4819e3})[_0xa7c9('0x20')](function(_0x203f9d){return db[_0xa7c9('0x95')][_0xa7c9('0x35')]({'where':{'FaxAccountId':_0x56fd08[_0xa7c9('0x57')]['id']},'transaction':_0x4819e3})['then'](function(_0x5682d5){return db[_0xa7c9('0x95')][_0xa7c9('0x81')](createExtensionsReciveFax(_[_0xa7c9('0x96')](_0x56fd08[_0xa7c9('0x57')],['tech',_0xa7c9('0x3e'),_0xa7c9('0x97'),_0xa7c9('0x98'),_0xa7c9('0x99'),_0xa7c9('0x9a')])),{'transaction':_0x4819e3});});});})[_0xa7c9('0x20')](function(){return db[_0xa7c9('0x3b')][_0xa7c9('0x9b')](_0x56fd08[_0xa7c9('0x57')]['id']);})[_0xa7c9('0x20')](respondWithResult(_0x2053c1,null))[_0xa7c9('0x2b')](handleError(_0x2053c1,null));};exports[_0xa7c9('0x9c')]=function(_0x430ceb,_0x477cc0,_0xbcd361){var _0x3d1329={'raw':!![],'where':{}};var _0x51d3cf={};var _0x4124d8={'count':0x0,'rows':[]};return db[_0xa7c9('0x3b')][_0xa7c9('0x67')]({'where':{'id':_0x430ceb['params']['id']}})['then'](handleEntityNotFound(_0x477cc0,null))[_0xa7c9('0x20')](function(_0x450720){if(_0x450720){_0x51d3cf[_0xa7c9('0x3f')]=_[_0xa7c9('0x40')](db[_0xa7c9('0x9d')][_0xa7c9('0x3c')]);_0x51d3cf['query']=_[_0xa7c9('0x40')](_0x430ceb['query']);_0x51d3cf[_0xa7c9('0x42')]=_[_0xa7c9('0x44')](_0x51d3cf[_0xa7c9('0x3f')],_0x51d3cf[_0xa7c9('0x41')]);_0x3d1329[_0xa7c9('0x43')]=_['intersection'](_0x51d3cf[_0xa7c9('0x3f')],qs['fields'](_0x430ceb['query'][_0xa7c9('0x45')]));_0x3d1329[_0xa7c9('0x43')]=_0x3d1329['attributes'][_0xa7c9('0x55')]?_0x3d1329['attributes']:_0x51d3cf[_0xa7c9('0x3f')];if(!_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x3d1329['limit']=qs[_0xa7c9('0x30')](_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x30')]);_0x3d1329[_0xa7c9('0x2e')]=qs[_0xa7c9('0x2e')](_0x430ceb[_0xa7c9('0x41')]['offset']);}_0x3d1329['order']=qs[_0xa7c9('0x48')](_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x48')]);_0x3d1329['where']=qs['filters'](_['pick'](_0x430ceb[_0xa7c9('0x41')],_0x51d3cf[_0xa7c9('0x42')]));_0x3d1329['where']['FaxAccountId']=_0x450720['id'];if(_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x4b')]){_0x3d1329[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x3d1329[_0xa7c9('0x49')],{'$or':_['map'](_0x3d1329[_0xa7c9('0x43')],function(_0x326d0e){var _0x51ce52={};_0x51ce52[_0x326d0e]={'$like':'%'+_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x4b')]+'%'};return _0x51ce52;})});}if(_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x9e')]){var _0x295367=_0x430ceb['query'][_0xa7c9('0x9e')][_0xa7c9('0x9f')](',');var _0x3da716={};_0x3da716[_0x295367[0x0]]={'$gte':moment(_0x295367[0x1])['format'](_0xa7c9('0xa0'))};_0x3d1329[_0xa7c9('0x49')]=_[_0xa7c9('0x4c')](_0x3d1329[_0xa7c9('0x49')],_0x3da716);}_0x3d1329=_[_0xa7c9('0x4c')]({},_0x3d1329,_0x430ceb['options']);return db[_0xa7c9('0x9d')][_0xa7c9('0x2f')]({'where':_0x3d1329['where']})[_0xa7c9('0x20')](function(_0x129320){_0x4124d8[_0xa7c9('0x2f')]=_0x129320;if(_0x430ceb[_0xa7c9('0x41')][_0xa7c9('0x4f')]){_0x3d1329['include']=[{'all':!![]}];}return db[_0xa7c9('0x9d')]['findAll'](_0x3d1329);})[_0xa7c9('0x20')](function(_0x4fae78){_0x4124d8['rows']=_0x4fae78;return _0x4124d8;});}})['then'](respondWithFilteredResult(_0x477cc0,_0x3d1329))[_0xa7c9('0x2b')](handleError(_0x477cc0,null));};exports[_0xa7c9('0x84')]=function(_0x1187d6,_0x1ca37b,_0xda81f4){var _0x3d97c8,_0x4d772e={},_0x7323c5;if(_0x1187d6[_0xa7c9('0x57')]['to']){_0x7323c5=_0x1187d6[_0xa7c9('0x57')]['to'][0x0];}return db[_0xa7c9('0x3b')][_0xa7c9('0x5c')]({'where':{'id':_0x1187d6[_0xa7c9('0x62')]['id']},'include':[{'model':db[_0xa7c9('0xa1')],'as':_0xa7c9('0xa2'),'include':[{'model':db[_0xa7c9('0x71')],'as':_0xa7c9('0xa3'),'where':{'fax':_0x7323c5},'limit':0x1,'order':[[_0xa7c9('0x98'),_0xa7c9('0xa4')]]}]}]})[_0xa7c9('0x20')](handleEntityNotFound(_0x1ca37b,null))['then'](function(_0x413f66){_0x3d97c8=_0x413f66;if(_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')]&&_0x1187d6['body'][_0xa7c9('0xa5')]['length']){for(var _0x36b6b0=0x0;_0x36b6b0<_0x1187d6[_0xa7c9('0x57')]['attachments'][_0xa7c9('0x55')];_0x36b6b0+=0x1){_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][_0x36b6b0]={'filename':_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][_0x36b6b0][_0xa7c9('0x37')],'id':_0x1187d6['body'][_0xa7c9('0xa5')][_0x36b6b0]['id'],'path':path['join'](config['root'],_0xa7c9('0xa6'),_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][_0x36b6b0][_0xa7c9('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0xa7c9('0xa8'),{'FaxAccountId':_[_0xa7c9('0xa9')](_0x1187d6['params']['id'])?undefined:_0x1187d6[_0xa7c9('0x62')]['id'],'path':_[_0xa7c9('0xa9')](_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][0x0][_0xa7c9('0x7')])?undefined:_0x1187d6['body'][_0xa7c9('0xa5')][0x0][_0xa7c9('0x7')],'fax':_[_0xa7c9('0xa9')](_0x1187d6['body']['to'][0x0])?undefined:_0x1187d6['body']['to'][0x0]},client9002);})[_0xa7c9('0x20')](function(){if(_0x3d97c8){if(_['isNil'](_0x1187d6['body'][_0xa7c9('0xaa')])){_0x1187d6['body'][_0xa7c9('0xaa')]=util[_0xa7c9('0xab')]('\x22%s\x22\x20<%s>',_0x3d97c8[_0xa7c9('0x37')],_0x3d97c8['fax']);}if(_0x3d97c8[_0xa7c9('0xa2')]){if(_0x3d97c8[_0xa7c9('0xa2')][_0xa7c9('0xa3')][_0xa7c9('0x55')]){return _0x3d97c8[_0xa7c9('0xa2')][_0xa7c9('0xa3')][0x0];}else{return db[_0xa7c9('0x71')][_0xa7c9('0x56')](_[_0xa7c9('0x19')](_0x1187d6['body'],{'firstName':_0x1187d6[_0xa7c9('0x57')]['to'][0x0],'phone':_0x1187d6[_0xa7c9('0x57')]['to'][0x0],'fax':_0x1187d6['body']['to'][0x0],'ListId':_0x3d97c8[_0xa7c9('0x9a')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa7c9('0x20')](function(_0x59008c){if(_0x59008c){return db[_0xa7c9('0x6e')]['find']({'where':{'ContactId':_0x59008c['id'],'closed':![],'FaxAccountId':_0x3d97c8['id']}})['then'](function(_0x1329a9){if(_0x1329a9){return[_0x1329a9,![]];}return db[_0xa7c9('0x6e')][_0xa7c9('0x56')]({'UserId':_0x1187d6[_0xa7c9('0x58')]['id'],'ContactId':_0x59008c['id'],'FaxAccountId':_0x3d97c8['id'],'fax':_0x1187d6[_0xa7c9('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa7c9('0x4c')](_0x1187d6[_0xa7c9('0x57')],{'read':![],'body':_0x1187d6[_0xa7c9('0x57')]['attachments'][0x0][_0xa7c9('0xac')],'FaxAccountId':_0x3d97c8['id'],'UserId':_0x1187d6[_0xa7c9('0x58')]['id'],'ContactId':_0x59008c['id'],'AttachmentId':_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xa7c9('0x9d')],'as':_0xa7c9('0xad')}]})['then'](function(_0x2561f0){return[_0x2561f0,!![]];});});}else{throw new Error(_0xa7c9('0xae'));}})[_0xa7c9('0xaf')](function(_0x43ba73,_0x245a9c){if(_0x245a9c){return _0x43ba73;}return db[_0xa7c9('0x9d')][_0xa7c9('0x56')]({'direction':_0xa7c9('0xb0'),'read':![],'body':_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][0x0]['filename'],'FaxAccountId':_0x3d97c8['id'],'FaxInteractionId':_0x43ba73['id'],'UserId':_0x1187d6[_0xa7c9('0x58')]['id'],'ContactId':_0x43ba73[_0xa7c9('0xb1')],'AttachmentId':_0x1187d6[_0xa7c9('0x57')]['attachments'][0x0]['id']})[_0xa7c9('0x20')](function(_0xf12551){_0x43ba73['dataValues'][_0xa7c9('0xad')]=[];_0x43ba73[_0xa7c9('0xb2')]['Messages'][_0xa7c9('0x89')](_0xf12551[_0xa7c9('0xb2')]);return _0x43ba73;});})['then'](function(_0x182111){respondWithRpcPromise(_0xa7c9('0xb3'),'SendFax',{'FaxAccountId':_[_0xa7c9('0xa9')](_0x1187d6[_0xa7c9('0x62')]['id'])?undefined:_0x1187d6['params']['id'],'path':_['isNil'](_0x1187d6[_0xa7c9('0x57')]['attachments'][0x0][_0xa7c9('0x7')])?undefined:_0x1187d6[_0xa7c9('0x57')][_0xa7c9('0xa5')][0x0]['path'],'fax':_[_0xa7c9('0xa9')](_0x1187d6[_0xa7c9('0x57')]['to'][0x0])?undefined:_0x1187d6[_0xa7c9('0x57')]['to'][0x0],'AttachmentId':_0x1187d6[_0xa7c9('0x57')]['attachments'][0x0]['id']},client9002)['then'](function(_0x222389){logger['info'](_0xa7c9('0xb4'),_0x222389);})[_0xa7c9('0x2b')](function(_0xf1d403){logger['info']('SendFaxRpc,\x20%s',_0xf1d403);});return _0x182111;})[_0xa7c9('0x20')](respondWithResult(_0x1ca37b,null))[_0xa7c9('0x2b')](handleError(_0x1ca37b,null));};exports[_0xa7c9('0xb5')]=function(_0x213ec2,_0xc5871d,_0xa2beaf){return db[_0xa7c9('0x3b')][_0xa7c9('0x5c')]({'where':{'id':_0x213ec2[_0xa7c9('0x62')]['id']}})['then'](handleEntityNotFound(_0xc5871d,null))[_0xa7c9('0x20')](function(_0x4c2c65){if(_0x4c2c65){return _0x4c2c65[_0xa7c9('0xb5')](_0x213ec2[_0xa7c9('0x57')]['ids'],_['omit'](_0x213ec2['body'],[_0xa7c9('0x6a'),'id'])||{})[_0xa7c9('0xaf')](function(_0x50b94d){for(var _0x1e4526=0x0;_0x1e4526<_0x213ec2[_0xa7c9('0x57')][_0xa7c9('0x6a')]['length'];_0x1e4526+=0x1){socket['emit'](_0xa7c9('0xb6'),{'UserId':Number(_0x213ec2[_0xa7c9('0x57')]['ids'][_0x1e4526]),'FaxAccountId':Number(_0x213ec2[_0xa7c9('0x62')]['id'])});}return _0x50b94d;});}})[_0xa7c9('0x20')](respondWithResult(_0xc5871d,null))[_0xa7c9('0x2b')](handleError(_0xc5871d,null));};exports[_0xa7c9('0xb7')]=function(_0x6c58ff,_0xcf7146,_0x539d80){return db[_0xa7c9('0x3b')]['find']({'where':{'id':_0x6c58ff[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0xcf7146,null))['then'](function(_0xd59e1f){if(_0xd59e1f){return _0xd59e1f['removeAgents'](_0x6c58ff[_0xa7c9('0x41')][_0xa7c9('0x6a')])[_0xa7c9('0x20')](function(){if(_[_0xa7c9('0xb8')](_0x6c58ff[_0xa7c9('0x41')][_0xa7c9('0x6a')])){for(var _0x3930cc=0x0;_0x3930cc<_0x6c58ff[_0xa7c9('0x41')][_0xa7c9('0x6a')][_0xa7c9('0x55')];_0x3930cc+=0x1){socket[_0xa7c9('0xb9')](_0xa7c9('0xba'),{'UserId':Number(_0x6c58ff[_0xa7c9('0x41')][_0xa7c9('0x6a')][_0x3930cc]),'FaxAccountId':Number(_0x6c58ff[_0xa7c9('0x62')]['id'])});}}else{socket[_0xa7c9('0xb9')](_0xa7c9('0xba'),{'UserId':Number(_0x6c58ff[_0xa7c9('0x41')][_0xa7c9('0x6a')]),'FaxAccountId':Number(_0x6c58ff['params']['id'])});}});}})[_0xa7c9('0x20')](respondWithStatusCode(_0xcf7146,null))[_0xa7c9('0x2b')](handleError(_0xcf7146,null));};exports[_0xa7c9('0xbb')]=function(_0x15e1e4,_0x4c6d18,_0x53089c){var _0x8c3189={};var _0x106f1a={};var _0x1600af;var _0x296cf3;return db[_0xa7c9('0x3b')][_0xa7c9('0x67')]({'where':{'id':_0x15e1e4[_0xa7c9('0x62')]['id']}})[_0xa7c9('0x20')](handleEntityNotFound(_0x4c6d18,null))[_0xa7c9('0x20')](function(_0x27834a){if(_0x27834a){_0x1600af=_0x27834a;_0x106f1a[_0xa7c9('0x3f')]=_[_0xa7c9('0x40')](db[_0xa7c9('0x73')]['rawAttributes']);_0x106f1a[_0xa7c9('0x41')]=_[_0xa7c9('0x40')](_0x15e1e4[_0xa7c9('0x41')]);_0x106f1a[_0xa7c9('0x42')]=_['intersection'](_0x106f1a[_0xa7c9('0x3f')],_0x106f1a[_0xa7c9('0x41')]);_0x8c3189[_0xa7c9('0x43')]=_[_0xa7c9('0x44')](_0x106f1a[_0xa7c9('0x3f')],qs[_0xa7c9('0x45')](_0x15e1e4['query'][_0xa7c9('0x45')]));_0x8c3189[_0xa7c9('0x43')]=_0x8c3189[_0xa7c9('0x43')][_0xa7c9('0x55')]?_0x8c3189['attributes']:_0x106f1a[_0xa7c9('0x3f')];_0x8c3189[_0xa7c9('0x68')]=qs[_0xa7c9('0x48')](_0x15e1e4['query']['sort']);_0x8c3189[_0xa7c9('0x49')]=qs[_0xa7c9('0x42')](_[_0xa7c9('0x4a')](_0x15e1e4['query'],_0x106f1a['filters']));if(_0x15e1e4[_0xa7c9('0x41')][_0xa7c9('0x4b')]){_0x8c3189['where']=_[_0xa7c9('0x4c')](_0x8c3189[_0xa7c9('0x49')],{'$or':_['map'](_0x8c3189[_0xa7c9('0x43')],function(_0x2e08cd){var _0x56d67c={};_0x56d67c[_0x2e08cd]={'$like':'%'+_0x15e1e4[_0xa7c9('0x41')][_0xa7c9('0x4b')]+'%'};return _0x56d67c;})});}_0x8c3189=_[_0xa7c9('0x4c')]({},_0x8c3189,_0x15e1e4[_0xa7c9('0x4e')]);return _0x1600af[_0xa7c9('0xbb')](_0x8c3189);}})[_0xa7c9('0x20')](function(_0x564fcb){if(_0x564fcb){_0x296cf3=_0x564fcb[_0xa7c9('0x55')];if(!_0x15e1e4[_0xa7c9('0x41')][_0xa7c9('0x46')](_0xa7c9('0x47'))){_0x8c3189[_0xa7c9('0x30')]=qs[_0xa7c9('0x30')](_0x15e1e4[_0xa7c9('0x41')][_0xa7c9('0x30')]);_0x8c3189[_0xa7c9('0x2e')]=qs[_0xa7c9('0x2e')](_0x15e1e4['query'][_0xa7c9('0x2e')]);}return _0x1600af['getAgents'](_0x8c3189);}})[_0xa7c9('0x20')](function(_0xf3e77c){if(_0xf3e77c){return _0xf3e77c?{'count':_0x296cf3,'rows':_0xf3e77c}:null;}})['then'](respondWithResult(_0x4c6d18,null))[_0xa7c9('0x2b')](handleError(_0x4c6d18,null));}; \ No newline at end of file +var _0x8fd7=['TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxAccount.socket','jayson/promise','http','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','get','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','order','sort','filters','filter','where','merge','map','options','FaxAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','fullname','Tag','Tags','color','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','send','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','/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','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt'];(function(_0x40534b,_0x3858aa){var _0x167165=function(_0x3b3e86){while(--_0x3b3e86){_0x40534b['push'](_0x40534b['shift']());}};_0x167165(++_0x3858aa);}(_0x8fd7,0x1af));var _0x78fd=function(_0x38257d,_0x4aa6da){_0x38257d=_0x38257d-0x0;var _0x1175b3=_0x8fd7[_0x38257d];return _0x1175b3;};'use strict';var emlformat=require(_0x78fd('0x0'));var rimraf=require(_0x78fd('0x1'));var zipdir=require(_0x78fd('0x2'));var jsonpatch=require(_0x78fd('0x3'));var rp=require(_0x78fd('0x4'));var moment=require(_0x78fd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78fd('0x6'));var util=require(_0x78fd('0x7'));var path=require('path');var sox=require(_0x78fd('0x8'));var csv=require('to-csv');var ejs=require(_0x78fd('0x9'));var fs=require('fs');var fs_extra=require(_0x78fd('0xa'));var _=require(_0x78fd('0xb'));var squel=require('squel');var crypto=require(_0x78fd('0xc'));var jsforce=require(_0x78fd('0xd'));var deskjs=require(_0x78fd('0xe'));var toCsv=require(_0x78fd('0xf'));var querystring=require('querystring');var Papa=require(_0x78fd('0x10'));var Redis=require(_0x78fd('0x11'));var authService=require(_0x78fd('0x12'));var qs=require(_0x78fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x78fd('0x14'));var config=require(_0x78fd('0x15'));var licenseUtil=require(_0x78fd('0x16'));var db=require('../../mysqldb')['db'];config[_0x78fd('0x17')]=_['defaults'](config[_0x78fd('0x17')],{'host':_0x78fd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78fd('0x17')]));require(_0x78fd('0x19'))['register'](socket);var jayson=require(_0x78fd('0x1a'));var client=jayson['client'][_0x78fd('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x78fd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4b756a,_0x4e7f38,_0x55e1dc,_0x969c96){return new BPromise(function(_0x12dfdb,_0x4077a0){var _0x133760=_0x969c96||client;return _0x133760['request'](_0x4b756a,_0x55e1dc)[_0x78fd('0x1c')](function(_0x38adb7){logger[_0x78fd('0x1d')](_0x78fd('0x1e'),_0x4e7f38,'request\x20sent');logger[_0x78fd('0x1f')](_0x78fd('0x20'),_0x4e7f38,_0x78fd('0x21'),JSON[_0x78fd('0x22')](_0x38adb7));if(_0x38adb7['error']){if(_0x38adb7[_0x78fd('0x23')][_0x78fd('0x24')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4e7f38,_0x38adb7[_0x78fd('0x23')][_0x78fd('0x25')]);return _0x4077a0(_0x38adb7[_0x78fd('0x23')][_0x78fd('0x25')]);}logger[_0x78fd('0x23')](_0x78fd('0x1e'),_0x4e7f38,_0x38adb7[_0x78fd('0x23')][_0x78fd('0x25')]);return _0x12dfdb(_0x38adb7[_0x78fd('0x23')]['message']);}else{logger[_0x78fd('0x1d')](_0x78fd('0x1e'),_0x4e7f38,_0x78fd('0x21'));_0x12dfdb(_0x38adb7[_0x78fd('0x26')]['message']);}})[_0x78fd('0x27')](function(_0x272f21){logger[_0x78fd('0x23')](_0x78fd('0x1e'),_0x4e7f38,_0x272f21);_0x4077a0(_0x272f21);});});}function respondWithStatusCode(_0x132c25,_0x116419){_0x116419=_0x116419||0xcc;return function(_0x4d121d){if(_0x4d121d){return _0x132c25[_0x78fd('0x28')](_0x116419);}return _0x132c25[_0x78fd('0x29')](_0x116419)[_0x78fd('0x2a')]();};}function respondWithResult(_0x56c2f0,_0x15226e){_0x15226e=_0x15226e||0xc8;return function(_0x27de4d){if(_0x27de4d){return _0x56c2f0[_0x78fd('0x29')](_0x15226e)[_0x78fd('0x2b')](_0x27de4d);}};}function respondWithFilteredResult(_0x3c1814,_0x339146){return function(_0x14f989){if(_0x14f989){var _0x41f7d9=typeof _0x339146[_0x78fd('0x2c')]==='undefined'&&typeof _0x339146[_0x78fd('0x2d')]===_0x78fd('0x2e');var _0x419669=_0x14f989['count'];var _0x257bcd=_0x41f7d9?0x0:_0x339146['offset'];var _0xad11d4=_0x41f7d9?_0x14f989[_0x78fd('0x2f')]:_0x339146[_0x78fd('0x2c')]+_0x339146[_0x78fd('0x2d')];var _0x2e5ffd;if(_0xad11d4>=_0x419669){_0xad11d4=_0x419669;_0x2e5ffd=0xc8;}else{_0x2e5ffd=0xce;}_0x3c1814[_0x78fd('0x29')](_0x2e5ffd);return _0x3c1814[_0x78fd('0x30')](_0x78fd('0x31'),_0x257bcd+'-'+_0xad11d4+'/'+_0x419669)[_0x78fd('0x2b')](_0x14f989);}return null;};}function patchUpdates(_0x344017){return function(_0x48d9f6){try{jsonpatch[_0x78fd('0x32')](_0x48d9f6,_0x344017,!![]);}catch(_0x384fdd){return BPromise['reject'](_0x384fdd);}return _0x48d9f6['save']();};}function saveUpdates(_0x1d79bf,_0xff475d){return function(_0x2bd5b5){if(_0x2bd5b5){return _0x2bd5b5[_0x78fd('0x33')](_0x1d79bf)[_0x78fd('0x1c')](function(_0x370382){return _0x370382;});}return null;};}function removeEntity(_0x4b7e4c,_0x58ecfb){return function(_0x85d341){if(_0x85d341){return _0x85d341[_0x78fd('0x34')]()[_0x78fd('0x1c')](function(){var _0x29f61d=_0x85d341[_0x78fd('0x35')]({'plain':!![]});var _0x588087='FaxAccounts';return db['UserProfileResource'][_0x78fd('0x34')]({'where':{'type':_0x588087,'resourceId':_0x29f61d['id']}})['then'](function(){return _0x85d341;});})[_0x78fd('0x1c')](function(){_0x4b7e4c[_0x78fd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da973,_0x45dace){return function(_0x297212){if(!_0x297212){_0x3da973[_0x78fd('0x28')](0x194);}return _0x297212;};}function handleError(_0x4cbcf8,_0x8e286c){_0x8e286c=_0x8e286c||0x1f4;return function(_0x36bbc6){logger['error'](_0x36bbc6[_0x78fd('0x36')]);if(_0x36bbc6[_0x78fd('0x37')]){delete _0x36bbc6[_0x78fd('0x37')];}_0x4cbcf8[_0x78fd('0x29')](_0x8e286c)['send'](_0x36bbc6);};}exports[_0x78fd('0x38')]=function(_0x34335f,_0x5ca713){var _0xf296e7={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x30ef3f={},_0x327c24={'count':0x0,'rows':[]};var _0x24f109=_['map'](db['FaxAccount'][_0x78fd('0x39')],function(_0x213449){return{'name':_0x213449[_0x78fd('0x3a')],'type':_0x213449[_0x78fd('0x3b')][_0x78fd('0x3c')]};});_0x30ef3f[_0x78fd('0x3d')]=_['map'](_0x24f109,_0x78fd('0x37'));_0x30ef3f[_0x78fd('0x3e')]=_[_0x78fd('0x3f')](_0x34335f[_0x78fd('0x3e')]);_0x30ef3f['filters']=_[_0x78fd('0x40')](_0x30ef3f['model'],_0x30ef3f[_0x78fd('0x3e')]);_0xf296e7[_0x78fd('0x41')]=_[_0x78fd('0x40')](_0x30ef3f[_0x78fd('0x3d')],qs['fields'](_0x34335f[_0x78fd('0x3e')]['fields']));_0xf296e7[_0x78fd('0x41')]=_0xf296e7['attributes'][_0x78fd('0x42')]?_0xf296e7[_0x78fd('0x41')]:_0x30ef3f[_0x78fd('0x3d')];if(!_0x34335f[_0x78fd('0x3e')]['hasOwnProperty']('nolimit')){_0xf296e7['limit']=qs[_0x78fd('0x2d')](_0x34335f[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0xf296e7[_0x78fd('0x2c')]=qs[_0x78fd('0x2c')](_0x34335f['query']['offset']);}_0xf296e7[_0x78fd('0x43')]=qs['sort'](_0x34335f['query'][_0x78fd('0x44')]);_0xf296e7['where']=qs[_0x78fd('0x45')](_['pick'](_0x34335f[_0x78fd('0x3e')],_0x30ef3f[_0x78fd('0x45')]),_0x24f109);if(_0x34335f[_0x78fd('0x3e')][_0x78fd('0x46')]){_0xf296e7[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0xf296e7[_0x78fd('0x47')],{'$or':_[_0x78fd('0x49')](_0x24f109,function(_0x4abc72){if(_0x4abc72[_0x78fd('0x3b')]!=='VIRTUAL'){var _0x4df097={};_0x4df097[_0x4abc72[_0x78fd('0x37')]]={'$like':'%'+_0x34335f[_0x78fd('0x3e')][_0x78fd('0x46')]+'%'};return _0x4df097;}})});}_0xf296e7=_[_0x78fd('0x48')]({},_0xf296e7,_0x34335f[_0x78fd('0x4a')]);var _0x1b19c0={'where':_0xf296e7[_0x78fd('0x47')]};return db[_0x78fd('0x4b')]['count'](_0x1b19c0)[_0x78fd('0x1c')](function(_0x3c4eb8){_0x327c24[_0x78fd('0x2f')]=_0x3c4eb8;if(_0x34335f[_0x78fd('0x3e')][_0x78fd('0x4c')]){_0xf296e7[_0x78fd('0x4d')]=[{'all':!![]}];}return db[_0x78fd('0x4b')][_0x78fd('0x4e')](_0xf296e7);})['then'](function(_0x335930){_0x327c24[_0x78fd('0x4f')]=_0x335930;return _0x327c24;})[_0x78fd('0x1c')](respondWithFilteredResult(_0x5ca713,_0xf296e7))[_0x78fd('0x27')](handleError(_0x5ca713,null));};exports[_0x78fd('0x50')]=function(_0x4a8a52,_0x5ace70){var _0x18fcff={'raw':![],'where':{'id':_0x4a8a52[_0x78fd('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x78fd('0x52')}]},_0x14d28a={};_0x14d28a['model']=_[_0x78fd('0x3f')](db['FaxAccount']['rawAttributes']);_0x14d28a['query']=_['keys'](_0x4a8a52['query']);_0x14d28a[_0x78fd('0x45')]=_['intersection'](_0x14d28a[_0x78fd('0x3d')],_0x14d28a[_0x78fd('0x3e')]);_0x18fcff['attributes']=_[_0x78fd('0x40')](_0x14d28a[_0x78fd('0x3d')],qs[_0x78fd('0x53')](_0x4a8a52[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x18fcff[_0x78fd('0x41')]=_0x18fcff[_0x78fd('0x41')][_0x78fd('0x42')]?_0x18fcff[_0x78fd('0x41')]:_0x14d28a[_0x78fd('0x3d')];if(_0x4a8a52['query'][_0x78fd('0x4c')]){_0x18fcff[_0x78fd('0x4d')]=[{'all':!![]}];}_0x18fcff=_['merge']({},_0x18fcff,_0x4a8a52[_0x78fd('0x4a')]);return db['FaxAccount'][_0x78fd('0x54')](_0x18fcff)[_0x78fd('0x1c')](handleEntityNotFound(_0x5ace70,null))[_0x78fd('0x1c')](respondWithResult(_0x5ace70,null))[_0x78fd('0x27')](handleError(_0x5ace70,null));};exports[_0x78fd('0x55')]=function(_0x373d43,_0x54e8db){return db['FaxAccount'][_0x78fd('0x55')](_0x373d43[_0x78fd('0x56')],{})[_0x78fd('0x1c')](function(_0x5737b4){var _0x24294c=_0x373d43[_0x78fd('0x57')]['get']({'plain':!![]});if(!_0x24294c)throw new Error(_0x78fd('0x58'));if(_0x24294c[_0x78fd('0x59')]===_0x78fd('0x57')){var _0x248f6d=_0x5737b4[_0x78fd('0x35')]({'plain':!![]});var _0x3fc210='FaxAccounts';return db[_0x78fd('0x5a')]['find']({'where':{'name':_0x3fc210,'userProfileId':_0x24294c[_0x78fd('0x5b')]},'raw':!![]})[_0x78fd('0x1c')](function(_0x21dba1){if(_0x21dba1&&_0x21dba1[_0x78fd('0x5c')]===0x0){return db[_0x78fd('0x5d')]['create']({'name':_0x248f6d[_0x78fd('0x37')],'resourceId':_0x248f6d['id'],'type':_0x21dba1[_0x78fd('0x37')],'sectionId':_0x21dba1['id']},{})['then'](function(){return _0x5737b4;});}else{return _0x5737b4;}})[_0x78fd('0x27')](function(_0x18a00f){logger[_0x78fd('0x23')](_0x78fd('0x5e'),_0x18a00f);throw _0x18a00f;});}return _0x5737b4;})[_0x78fd('0x1c')](respondWithResult(_0x54e8db,0xc9))[_0x78fd('0x27')](handleError(_0x54e8db,null));};exports[_0x78fd('0x33')]=function(_0xfbb54e,_0x21098b){if(_0xfbb54e[_0x78fd('0x56')]['id']){delete _0xfbb54e['body']['id'];}return db[_0x78fd('0x4b')][_0x78fd('0x54')]({'where':{'id':_0xfbb54e[_0x78fd('0x51')]['id']},'include':[{'model':db[_0x78fd('0x5f')],'as':_0x78fd('0x52')}]})[_0x78fd('0x1c')](handleEntityNotFound(_0x21098b,null))['then'](saveUpdates(_0xfbb54e[_0x78fd('0x56')],null))[_0x78fd('0x1c')](respondWithResult(_0x21098b,null))['catch'](handleError(_0x21098b,null));};exports[_0x78fd('0x34')]=function(_0x2d897e,_0x36de5b){return db[_0x78fd('0x4b')]['find']({'where':{'id':_0x2d897e['params']['id']}})['then'](handleEntityNotFound(_0x36de5b,null))[_0x78fd('0x1c')](removeEntity(_0x36de5b,null))[_0x78fd('0x27')](handleError(_0x36de5b,null));};exports[_0x78fd('0x60')]=function(_0x83760,_0x456e8a){return db[_0x78fd('0x4b')][_0x78fd('0x60')]()['then'](respondWithResult(_0x456e8a,null))[_0x78fd('0x27')](handleError(_0x456e8a,null));};exports[_0x78fd('0x61')]=function(_0x2cd2ed,_0x3e2570,_0x486941){if(_0x2cd2ed[_0x78fd('0x56')]['id']){delete _0x2cd2ed[_0x78fd('0x56')]['id'];}return db[_0x78fd('0x4b')][_0x78fd('0x54')]({'where':{'id':_0x2cd2ed[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x3e2570,null))[_0x78fd('0x1c')](function(_0x450c38){if(_0x450c38){_0x2cd2ed['body'][_0x78fd('0x62')]=_0x450c38['id'];return db[_0x78fd('0x63')][_0x78fd('0x55')](_0x2cd2ed[_0x78fd('0x56')]);}})['then'](respondWithResult(_0x3e2570,null))['catch'](handleError(_0x3e2570,null));};exports[_0x78fd('0x64')]=function(_0x2aacb8,_0x592ef5,_0x1756dc){var _0x23d90a={'raw':![],'where':{}};var _0x144b20={};var _0x399070={'count':0x0,'rows':[]};return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0x2aacb8[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x592ef5,null))['then'](function(_0xe36f1){if(_0xe36f1){_0x144b20['model']=_[_0x78fd('0x3f')](db[_0x78fd('0x63')][_0x78fd('0x39')]);_0x144b20[_0x78fd('0x3e')]=_[_0x78fd('0x3f')](_0x2aacb8[_0x78fd('0x3e')]);_0x144b20[_0x78fd('0x45')]=_[_0x78fd('0x40')](_0x144b20[_0x78fd('0x3d')],_0x144b20[_0x78fd('0x3e')]);_0x23d90a['attributes']=_['intersection'](_0x144b20[_0x78fd('0x3d')],qs['fields'](_0x2aacb8[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x23d90a[_0x78fd('0x41')]=_0x23d90a[_0x78fd('0x41')][_0x78fd('0x42')]?_0x23d90a[_0x78fd('0x41')]:_0x144b20[_0x78fd('0x3d')];if(!_0x2aacb8[_0x78fd('0x3e')]['hasOwnProperty'](_0x78fd('0x66'))){_0x23d90a[_0x78fd('0x2d')]=qs['limit'](_0x2aacb8[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0x23d90a[_0x78fd('0x2c')]=qs[_0x78fd('0x2c')](_0x2aacb8[_0x78fd('0x3e')][_0x78fd('0x2c')]);}_0x23d90a['order']=qs[_0x78fd('0x44')](_0x2aacb8[_0x78fd('0x3e')][_0x78fd('0x44')]);_0x23d90a[_0x78fd('0x47')]=qs[_0x78fd('0x45')](_['pick'](_0x2aacb8[_0x78fd('0x3e')],_0x144b20[_0x78fd('0x45')]));_0x23d90a[_0x78fd('0x47')]['FaxAccountId']=_0xe36f1['id'];if(_0x2aacb8['query'][_0x78fd('0x46')]){_0x23d90a[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x23d90a['where'],{'$or':_['map'](_0x23d90a[_0x78fd('0x41')],function(_0x5a8dda){var _0x5d4999={};_0x5d4999[_0x5a8dda]={'$like':'%'+_0x2aacb8[_0x78fd('0x3e')][_0x78fd('0x46')]+'%'};return _0x5d4999;})});}_0x23d90a=_[_0x78fd('0x48')]({},_0x23d90a,_0x2aacb8[_0x78fd('0x4a')]);return db[_0x78fd('0x63')][_0x78fd('0x2f')]({'where':_0x23d90a['where']})[_0x78fd('0x1c')](function(_0x30a762){_0x399070[_0x78fd('0x2f')]=_0x30a762;if(_0x2aacb8[_0x78fd('0x3e')]['includeAll']){_0x23d90a[_0x78fd('0x4d')]=[{'all':!![]}];}return db[_0x78fd('0x63')][_0x78fd('0x4e')](_0x23d90a);})['then'](function(_0x33f414){_0x399070[_0x78fd('0x4f')]=_0x33f414;return _0x399070;});}})['then'](respondWithFilteredResult(_0x592ef5,_0x23d90a))[_0x78fd('0x27')](handleError(_0x592ef5,null));};exports['removeDispositions']=function(_0x403a43,_0x1b7e9d,_0x1294a0){return db[_0x78fd('0x4b')][_0x78fd('0x54')]({'where':{'id':_0x403a43[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x1b7e9d,null))['then'](function(_0x23fd51){if(_0x23fd51){return _0x23fd51[_0x78fd('0x67')](_0x403a43['query'][_0x78fd('0x68')]);}})[_0x78fd('0x1c')](respondWithStatusCode(_0x1b7e9d,null))['catch'](handleError(_0x1b7e9d,null));};exports[_0x78fd('0x69')]=function(_0x4415e2,_0xc1a4b0,_0x38bd46){if(_0x4415e2[_0x78fd('0x56')]['id']){delete _0x4415e2[_0x78fd('0x56')]['id'];}return db[_0x78fd('0x4b')]['find']({'where':{'id':_0x4415e2[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0xc1a4b0,null))['then'](function(_0x1272d2){if(_0x1272d2){_0x4415e2['body'][_0x78fd('0x62')]=_0x1272d2['id'];return db[_0x78fd('0x6a')][_0x78fd('0x55')](_0x4415e2['body']);}})[_0x78fd('0x1c')](respondWithResult(_0xc1a4b0,null))[_0x78fd('0x27')](handleError(_0xc1a4b0,null));};exports[_0x78fd('0x6b')]=function(_0x3fd0d0,_0x23c2f5,_0x319c35){var _0x3d3902={'raw':![],'where':{}};var _0x3290b3={};var _0x1a6f08={'count':0x0,'rows':[]};return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0x3fd0d0['params']['id']}})['then'](handleEntityNotFound(_0x23c2f5,null))[_0x78fd('0x1c')](function(_0x4d8f31){if(_0x4d8f31){_0x3290b3[_0x78fd('0x3d')]=_['keys'](db[_0x78fd('0x6a')][_0x78fd('0x39')]);_0x3290b3[_0x78fd('0x3e')]=_['keys'](_0x3fd0d0['query']);_0x3290b3[_0x78fd('0x45')]=_[_0x78fd('0x40')](_0x3290b3['model'],_0x3290b3[_0x78fd('0x3e')]);_0x3d3902[_0x78fd('0x41')]=_[_0x78fd('0x40')](_0x3290b3[_0x78fd('0x3d')],qs[_0x78fd('0x53')](_0x3fd0d0[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x3d3902[_0x78fd('0x41')]=_0x3d3902[_0x78fd('0x41')][_0x78fd('0x42')]?_0x3d3902[_0x78fd('0x41')]:_0x3290b3['model'];if(!_0x3fd0d0['query']['hasOwnProperty'](_0x78fd('0x66'))){_0x3d3902[_0x78fd('0x2d')]=qs[_0x78fd('0x2d')](_0x3fd0d0['query'][_0x78fd('0x2d')]);_0x3d3902[_0x78fd('0x2c')]=qs[_0x78fd('0x2c')](_0x3fd0d0[_0x78fd('0x3e')][_0x78fd('0x2c')]);}_0x3d3902[_0x78fd('0x43')]=qs['sort'](_0x3fd0d0[_0x78fd('0x3e')][_0x78fd('0x44')]);_0x3d3902[_0x78fd('0x47')]=qs['filters'](_[_0x78fd('0x6c')](_0x3fd0d0[_0x78fd('0x3e')],_0x3290b3[_0x78fd('0x45')]));_0x3d3902[_0x78fd('0x47')][_0x78fd('0x62')]=_0x4d8f31['id'];if(_0x3fd0d0['query']['filter']){_0x3d3902[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x3d3902[_0x78fd('0x47')],{'$or':_[_0x78fd('0x49')](_0x3d3902['attributes'],function(_0x2566ee){var _0x310c8f={};_0x310c8f[_0x2566ee]={'$like':'%'+_0x3fd0d0['query'][_0x78fd('0x46')]+'%'};return _0x310c8f;})});}_0x3d3902=_[_0x78fd('0x48')]({},_0x3d3902,_0x3fd0d0[_0x78fd('0x4a')]);return db[_0x78fd('0x6a')]['count']({'where':_0x3d3902[_0x78fd('0x47')]})[_0x78fd('0x1c')](function(_0x131655){_0x1a6f08[_0x78fd('0x2f')]=_0x131655;if(_0x3fd0d0[_0x78fd('0x3e')][_0x78fd('0x4c')]){_0x3d3902[_0x78fd('0x4d')]=[{'all':!![]}];}return db[_0x78fd('0x6a')]['findAll'](_0x3d3902);})['then'](function(_0x3fd90a){_0x1a6f08[_0x78fd('0x4f')]=_0x3fd90a;return _0x1a6f08;});}})[_0x78fd('0x1c')](respondWithFilteredResult(_0x23c2f5,_0x3d3902))['catch'](handleError(_0x23c2f5,null));};exports['removeAnswers']=function(_0x4aa91f,_0x441d1c,_0x3f590a){return db[_0x78fd('0x4b')]['find']({'where':{'id':_0x4aa91f[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x441d1c,null))[_0x78fd('0x1c')](function(_0x136d09){if(_0x136d09){return _0x136d09[_0x78fd('0x6d')](_0x4aa91f[_0x78fd('0x3e')]['ids']);}})[_0x78fd('0x1c')](respondWithStatusCode(_0x441d1c,null))[_0x78fd('0x27')](handleError(_0x441d1c,null));};exports[_0x78fd('0x6e')]=function(_0x14481d,_0x20afe6,_0x29dee0){return db[_0x78fd('0x6f')][_0x78fd('0x54')]({'where':{'id':_0x14481d[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x20afe6,null))['then'](function(_0x28bd2f){if(_0x28bd2f){return _0x28bd2f[_0x78fd('0x6e')](_0x14481d[_0x78fd('0x56')]['ids'],_[_0x78fd('0x70')](_0x14481d[_0x78fd('0x56')],[_0x78fd('0x68'),'id'])||{});}})[_0x78fd('0x1c')](respondWithResult(_0x20afe6,null))['catch'](handleError(_0x20afe6,null));};exports[_0x78fd('0x71')]=function(_0x5cc699,_0x40380d,_0x2bf85a){var _0x1aed97={'raw':![],'where':{}};var _0x164353={};var _0x55c0e8={'count':0x0,'rows':[]};return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0x5cc699['params']['id']}})['then'](handleEntityNotFound(_0x40380d,null))[_0x78fd('0x1c')](function(_0x362193){if(_0x362193){_0x164353[_0x78fd('0x3d')]=_[_0x78fd('0x3f')](db['FaxInteraction'][_0x78fd('0x39')]);_0x164353[_0x78fd('0x3e')]=_[_0x78fd('0x3f')](_0x5cc699['query']);_0x164353[_0x78fd('0x45')]=_[_0x78fd('0x40')](_0x164353[_0x78fd('0x3d')],_0x164353[_0x78fd('0x3e')]);_0x1aed97[_0x78fd('0x41')]=_[_0x78fd('0x40')](_0x164353[_0x78fd('0x3d')],qs[_0x78fd('0x53')](_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x1aed97[_0x78fd('0x41')]=_0x1aed97[_0x78fd('0x41')][_0x78fd('0x42')]?_0x1aed97[_0x78fd('0x41')]:_0x164353['model'];if(!_0x5cc699['query'][_0x78fd('0x72')](_0x78fd('0x66'))){_0x1aed97[_0x78fd('0x2d')]=qs[_0x78fd('0x2d')](_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0x1aed97['offset']=qs[_0x78fd('0x2c')](_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x2c')]);}_0x1aed97[_0x78fd('0x43')]=qs['sort'](_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x44')]);_0x1aed97[_0x78fd('0x47')]=qs[_0x78fd('0x45')](_['pick'](_0x5cc699['query'],_0x164353[_0x78fd('0x45')]));_0x1aed97[_0x78fd('0x47')][_0x78fd('0x62')]=_0x362193['id'];if(_0x5cc699['query'][_0x78fd('0x46')]){_0x1aed97[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x1aed97[_0x78fd('0x47')],{'$or':_[_0x78fd('0x49')](_0x1aed97[_0x78fd('0x41')],function(_0x520ebf){var _0x28e1f3={};_0x28e1f3[_0x520ebf]={'$like':'%'+_0x5cc699['query']['filter']+'%'};return _0x28e1f3;})});}_0x1aed97=_[_0x78fd('0x48')]({},_0x1aed97,_0x5cc699[_0x78fd('0x4a')]);return db[_0x78fd('0x6f')][_0x78fd('0x2f')]({'where':_0x1aed97[_0x78fd('0x47')]})[_0x78fd('0x1c')](function(_0x342def){_0x55c0e8[_0x78fd('0x2f')]=_0x342def;if(_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x4c')]){_0x1aed97[_0x78fd('0x4d')]=[{'model':db[_0x78fd('0x73')],'as':_0x78fd('0x74'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x78fd('0x37'),_0x78fd('0x75'),'internal'],'required':![]},{'model':db[_0x78fd('0x76')],'as':_0x78fd('0x77'),'attributes':['id',_0x78fd('0x37'),_0x78fd('0x78')],'where':_0x5cc699[_0x78fd('0x3e')][_0x78fd('0x79')]?{'id':_0x5cc699['query'][_0x78fd('0x79')]}:undefined,'required':_0x5cc699[_0x78fd('0x3e')]['tag']?!![]:![]}];}return db[_0x78fd('0x6f')][_0x78fd('0x4e')](_0x1aed97);})[_0x78fd('0x1c')](function(_0x5835d7){_0x55c0e8[_0x78fd('0x4f')]=_0x5835d7;return _0x55c0e8;});}})[_0x78fd('0x1c')](respondWithFilteredResult(_0x40380d,_0x1aed97))[_0x78fd('0x27')](handleError(_0x40380d,null));};exports['addApplications']=function(_0x3279ea,_0x10cb5c){var _0x41c86d=_0x3279ea['params']['id'];var _0xdb1885=_0x3279ea[_0x78fd('0x56')];var _0x5a6588=0xc8;var _0x4ea0e4=null;return db[_0x78fd('0x7a')][_0x78fd('0x7b')]({'isolationLevel':db['sequelize']['Transaction'][_0x78fd('0x7c')][_0x78fd('0x7d')]},function(_0x83691){return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0x41c86d},'transaction':_0x83691})[_0x78fd('0x1c')](function(_0x321233){if(_0x321233){return db[_0x78fd('0x7e')][_0x78fd('0x34')]({'where':{'FaxAccountId':_0x41c86d},'transaction':_0x83691})['then'](function(){var _0x462d2c=_[_0x78fd('0x49')](_0xdb1885,function(_0x1e1acc){_0x1e1acc[_0x78fd('0x62')]=_0x41c86d;return _0x1e1acc;});return db[_0x78fd('0x7e')][_0x78fd('0x7f')](_0x462d2c,{'transaction':_0x83691});});}else{_0x5a6588=0x194;_0x4ea0e4=[];}});})['then'](function(){if(_0x5a6588!==0x194){return db['FaxApplication'][_0x78fd('0x80')]({'where':{'FaxAccountId':_0x41c86d},'order':'priority'})[_0x78fd('0x1c')](function(_0x59e683){_0x4ea0e4=_0x59e683;});}})[_0x78fd('0x27')](function(_0x354fb2){_0x5a6588=0x1f4;logger[_0x78fd('0x23')](_0x354fb2[_0x78fd('0x36')]);if(_0x354fb2['name']){delete _0x354fb2[_0x78fd('0x37')];}_0x4ea0e4=_0x354fb2;})[_0x78fd('0x81')](function(){if(_0x4ea0e4===null){_0x10cb5c[_0x78fd('0x28')](_0x5a6588);}else{if(_0x5a6588===0x1f4){_0x10cb5c[_0x78fd('0x29')](_0x5a6588)[_0x78fd('0x82')](_0x4ea0e4);}else{_0x10cb5c['status'](_0x5a6588)[_0x78fd('0x2b')](_0x4ea0e4);}}});};exports['getApplications']=function(_0x1b3d4e,_0x3337e8,_0x15e346){var _0x29fb89={};var _0x48267e={};var _0x2ef127;var _0x5a49db;return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0x1b3d4e['params']['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x3337e8,null))[_0x78fd('0x1c')](function(_0x4f010a){if(_0x4f010a){_0x2ef127=_0x4f010a;_0x48267e[_0x78fd('0x3d')]=_[_0x78fd('0x3f')](db[_0x78fd('0x7e')][_0x78fd('0x39')]);_0x48267e[_0x78fd('0x3e')]=_[_0x78fd('0x3f')](_0x1b3d4e[_0x78fd('0x3e')]);_0x48267e[_0x78fd('0x45')]=_['intersection'](_0x48267e[_0x78fd('0x3d')],_0x48267e['query']);_0x29fb89[_0x78fd('0x41')]=_[_0x78fd('0x40')](_0x48267e['model'],qs[_0x78fd('0x53')](_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x29fb89[_0x78fd('0x41')]=_0x29fb89[_0x78fd('0x41')][_0x78fd('0x42')]?_0x29fb89['attributes']:_0x48267e[_0x78fd('0x3d')];_0x29fb89[_0x78fd('0x43')]=qs[_0x78fd('0x44')](_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x44')]);_0x29fb89[_0x78fd('0x47')]=qs[_0x78fd('0x45')](_['pick'](_0x1b3d4e[_0x78fd('0x3e')],_0x48267e[_0x78fd('0x45')]));if(_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x46')]){_0x29fb89[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x29fb89[_0x78fd('0x47')],{'$or':_['map'](_0x29fb89[_0x78fd('0x41')],function(_0x4e62f0){var _0x296325={};_0x296325[_0x4e62f0]={'$like':'%'+_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x46')]+'%'};return _0x296325;})});}_0x29fb89=_[_0x78fd('0x48')]({},_0x29fb89,_0x1b3d4e[_0x78fd('0x4a')]);return _0x2ef127['getApplications'](_0x29fb89);}})[_0x78fd('0x1c')](function(_0x35f1a4){if(_0x35f1a4){_0x5a49db=_0x35f1a4['length'];if(!_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x72')](_0x78fd('0x66'))){_0x29fb89['limit']=qs['limit'](_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0x29fb89['offset']=qs[_0x78fd('0x2c')](_0x1b3d4e[_0x78fd('0x3e')][_0x78fd('0x2c')]);}return _0x2ef127[_0x78fd('0x83')](_0x29fb89);}})[_0x78fd('0x1c')](function(_0x26ddcb){if(_0x26ddcb){return _0x26ddcb?{'count':_0x5a49db,'rows':_0x26ddcb}:null;}})[_0x78fd('0x1c')](respondWithResult(_0x3337e8,null))[_0x78fd('0x27')](handleError(_0x3337e8,null));};function Extension(_0x4fe9ac,_0x4b0e23,_0x15d5e1,_0x180529){this['context']=_0x78fd('0x84');this[_0x78fd('0x85')]=_0x4fe9ac[_0x78fd('0x86')];this[_0x78fd('0x87')]=_0x180529;this[_0x78fd('0x3b')]=_0x78fd('0x88');this[_0x78fd('0x89')]=_0x78fd('0x8a');this[_0x78fd('0x62')]=_0x4fe9ac['id'];this[_0x78fd('0x8b')]=_0x4b0e23;this[_0x78fd('0x8c')]=_0x15d5e1;}function createExtensionsReciveFax(_0x15fd98){var _0x4c0ae0=0x1;var _0x29992a=[];_0x29992a[_0x78fd('0x8d')](new Extension(_0x15fd98,_0x4c0ae0,'',_0x78fd('0x8e')));_0x4c0ae0+=0x1;_0x29992a[_0x78fd('0x8d')](new Extension(_0x15fd98,_0x4c0ae0,_0x78fd('0x8f'),'Set'));_0x4c0ae0+=0x1;for(var _0x1b4de8 in _0x15fd98){if(_0x15fd98['hasOwnProperty'](_0x1b4de8)&&(_0x1b4de8===_0x78fd('0x90')||_0x1b4de8===_0x78fd('0x86')||_0x1b4de8===_0x78fd('0x91')||_0x1b4de8===_0x78fd('0x92')||_0x1b4de8===_0x78fd('0x93')||_0x1b4de8===_0x78fd('0x94')||_0x1b4de8==='minrate'||_0x1b4de8==='modem'||_0x1b4de8===_0x78fd('0x95'))){_0x29992a['push'](new Extension(_0x15fd98,_0x4c0ae0,_0x78fd('0x96')+_0x1b4de8+')='+_0x15fd98[_0x1b4de8],'Set'));_0x4c0ae0+=0x1;}}_0x29992a['push'](new Extension(_0x15fd98,_0x4c0ae0,'6','Wait'));_0x4c0ae0+=0x1;_0x29992a[_0x78fd('0x8d')](new Extension(_0x15fd98,_0x4c0ae0,_0x78fd('0x97'),'ReceiveFax'));_0x4c0ae0=0x0;return _0x29992a;}exports[_0x78fd('0x98')]=function(_0x12b7af,_0x4fbe3c,_0x2531c8){var _0x389b92;return db[_0x78fd('0x7a')][_0x78fd('0x7b')](function(_0x547ead){return db[_0x78fd('0x4b')][_0x78fd('0x55')](_0x12b7af['body'],{'transaction':_0x547ead})[_0x78fd('0x1c')](function(_0x16bc6d){_0x389b92=_0x16bc6d[_0x78fd('0x35')]({'plain':!![]});return db[_0x78fd('0x99')][_0x78fd('0x7f')](createExtensionsReciveFax(_0x389b92),{'transaction':_0x547ead});});})[_0x78fd('0x1c')](function(){return _0x389b92;})['then'](respondWithResult(_0x4fbe3c,null))[_0x78fd('0x27')](handleError(_0x4fbe3c,null));};exports[_0x78fd('0x9a')]=function(_0x4a1b55,_0xfb9f5d,_0xbffcad){var _0x23d845;return db[_0x78fd('0x7a')][_0x78fd('0x7b')](function(_0x4fed64){return db[_0x78fd('0x4b')][_0x78fd('0x33')](_0x4a1b55[_0x78fd('0x56')],{'where':{'id':_0x4a1b55[_0x78fd('0x56')]['id']},'transaction':_0x4fed64})[_0x78fd('0x1c')](function(_0x3d7dcf){return db[_0x78fd('0x99')][_0x78fd('0x34')]({'where':{'FaxAccountId':_0x4a1b55[_0x78fd('0x56')]['id']},'transaction':_0x4fed64})[_0x78fd('0x1c')](function(_0x5826f5){return db[_0x78fd('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0x78fd('0x70')](_0x4a1b55[_0x78fd('0x56')],[_0x78fd('0x9b'),_0x78fd('0x3c'),'createdAt',_0x78fd('0x9c'),_0x78fd('0x9d'),_0x78fd('0x9e')])),{'transaction':_0x4fed64});});});})[_0x78fd('0x1c')](function(){return db['FaxAccount'][_0x78fd('0x9f')](_0x4a1b55[_0x78fd('0x56')]['id']);})[_0x78fd('0x1c')](respondWithResult(_0xfb9f5d,null))[_0x78fd('0x27')](handleError(_0xfb9f5d,null));};exports[_0x78fd('0xa0')]=function(_0xd79b8c,_0x14d521,_0x2eab25){var _0x9b6dd6={'raw':!![],'where':{}};var _0x1c7b48={};var _0x3fd9a3={'count':0x0,'rows':[]};return db[_0x78fd('0x4b')][_0x78fd('0x65')]({'where':{'id':_0xd79b8c[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x14d521,null))[_0x78fd('0x1c')](function(_0x28b313){if(_0x28b313){_0x1c7b48['model']=_[_0x78fd('0x3f')](db[_0x78fd('0xa1')][_0x78fd('0x39')]);_0x1c7b48[_0x78fd('0x3e')]=_[_0x78fd('0x3f')](_0xd79b8c[_0x78fd('0x3e')]);_0x1c7b48[_0x78fd('0x45')]=_['intersection'](_0x1c7b48[_0x78fd('0x3d')],_0x1c7b48['query']);_0x9b6dd6['attributes']=_[_0x78fd('0x40')](_0x1c7b48[_0x78fd('0x3d')],qs[_0x78fd('0x53')](_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x53')]));_0x9b6dd6[_0x78fd('0x41')]=_0x9b6dd6[_0x78fd('0x41')][_0x78fd('0x42')]?_0x9b6dd6[_0x78fd('0x41')]:_0x1c7b48[_0x78fd('0x3d')];if(!_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x72')]('nolimit')){_0x9b6dd6[_0x78fd('0x2d')]=qs[_0x78fd('0x2d')](_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0x9b6dd6[_0x78fd('0x2c')]=qs[_0x78fd('0x2c')](_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x2c')]);}_0x9b6dd6[_0x78fd('0x43')]=qs[_0x78fd('0x44')](_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x44')]);_0x9b6dd6[_0x78fd('0x47')]=qs[_0x78fd('0x45')](_[_0x78fd('0x6c')](_0xd79b8c[_0x78fd('0x3e')],_0x1c7b48[_0x78fd('0x45')]));_0x9b6dd6[_0x78fd('0x47')]['FaxAccountId']=_0x28b313['id'];if(_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x46')]){_0x9b6dd6[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x9b6dd6[_0x78fd('0x47')],{'$or':_[_0x78fd('0x49')](_0x9b6dd6[_0x78fd('0x41')],function(_0x561515){var _0x54ce31={};_0x54ce31[_0x561515]={'$like':'%'+_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0x46')]+'%'};return _0x54ce31;})});}if(_0xd79b8c[_0x78fd('0x3e')][_0x78fd('0xa2')]){var _0x47f2c0=_0xd79b8c[_0x78fd('0x3e')]['$gte'][_0x78fd('0xa3')](',');var _0x2d49de={};_0x2d49de[_0x47f2c0[0x0]]={'$gte':moment(_0x47f2c0[0x1])[_0x78fd('0xa4')](_0x78fd('0xa5'))};_0x9b6dd6[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x9b6dd6[_0x78fd('0x47')],_0x2d49de);}_0x9b6dd6=_[_0x78fd('0x48')]({},_0x9b6dd6,_0xd79b8c['options']);return db['FaxMessage'][_0x78fd('0x2f')]({'where':_0x9b6dd6[_0x78fd('0x47')]})['then'](function(_0xc36930){_0x3fd9a3[_0x78fd('0x2f')]=_0xc36930;if(_0xd79b8c[_0x78fd('0x3e')]['includeAll']){_0x9b6dd6['include']=[{'all':!![]}];}return db['FaxMessage'][_0x78fd('0x4e')](_0x9b6dd6);})[_0x78fd('0x1c')](function(_0x166830){_0x3fd9a3[_0x78fd('0x4f')]=_0x166830;return _0x3fd9a3;});}})[_0x78fd('0x1c')](respondWithFilteredResult(_0x14d521,_0x9b6dd6))[_0x78fd('0x27')](handleError(_0x14d521,null));};exports['send']=function(_0x49cd90,_0x12ee23,_0xcf40f1){var _0x2f8232,_0x1c8ba8={},_0x3bd18c;if(_0x49cd90[_0x78fd('0x56')]['to']){_0x3bd18c=_0x49cd90[_0x78fd('0x56')]['to'][0x0];}return db[_0x78fd('0x4b')]['find']({'where':{'id':_0x49cd90[_0x78fd('0x51')]['id']},'include':[{'model':db[_0x78fd('0xa6')],'as':_0x78fd('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x3bd18c},'limit':0x1,'order':[['updatedAt',_0x78fd('0xa8')]]}]}]})[_0x78fd('0x1c')](handleEntityNotFound(_0x12ee23,null))[_0x78fd('0x1c')](function(_0x52c71d){_0x2f8232=_0x52c71d;if(_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')]&&_0x49cd90[_0x78fd('0x56')]['attachments'][_0x78fd('0x42')]){for(var _0x259ccc=0x0;_0x259ccc<_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][_0x78fd('0x42')];_0x259ccc+=0x1){_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][_0x259ccc]={'filename':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][_0x259ccc]['name'],'id':_0x49cd90['body'][_0x78fd('0xa9')][_0x259ccc]['id'],'path':path[_0x78fd('0xaa')](config['root'],_0x78fd('0xab'),_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][_0x259ccc][_0x78fd('0xac')])};}}return respondWithRpcPromise('CheckAfterSend',_0x78fd('0xad'),{'FaxAccountId':_[_0x78fd('0xae')](_0x49cd90[_0x78fd('0x51')]['id'])?undefined:_0x49cd90[_0x78fd('0x51')]['id'],'path':_[_0x78fd('0xae')](_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0][_0x78fd('0xaf')])?undefined:_0x49cd90['body'][_0x78fd('0xa9')][0x0][_0x78fd('0xaf')],'fax':_[_0x78fd('0xae')](_0x49cd90['body']['to'][0x0])?undefined:_0x49cd90['body']['to'][0x0]},client9002);})['then'](function(){if(_0x2f8232){if(_['isNil'](_0x49cd90[_0x78fd('0x56')][_0x78fd('0xb0')])){_0x49cd90[_0x78fd('0x56')][_0x78fd('0xb0')]=util[_0x78fd('0xa4')](_0x78fd('0xb1'),_0x2f8232['name'],_0x2f8232[_0x78fd('0xb2')]);}if(_0x2f8232[_0x78fd('0xa7')]){if(_0x2f8232[_0x78fd('0xa7')][_0x78fd('0xb3')][_0x78fd('0x42')]){return _0x2f8232['List'][_0x78fd('0xb3')][0x0];}else{return db['CmContact']['create'](_[_0x78fd('0xb4')](_0x49cd90[_0x78fd('0x56')],{'firstName':_0x49cd90[_0x78fd('0x56')]['to'][0x0],'phone':_0x49cd90[_0x78fd('0x56')]['to'][0x0],'fax':_0x49cd90['body']['to'][0x0],'ListId':_0x2f8232[_0x78fd('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x3602eb){if(_0x3602eb){return db[_0x78fd('0x6f')]['find']({'where':{'ContactId':_0x3602eb['id'],'closed':![],'FaxAccountId':_0x2f8232['id']}})[_0x78fd('0x1c')](function(_0x979551){if(_0x979551){return[_0x979551,![]];}return db['FaxInteraction'][_0x78fd('0x55')]({'UserId':_0x49cd90[_0x78fd('0x57')]['id'],'ContactId':_0x3602eb['id'],'FaxAccountId':_0x2f8232['id'],'fax':_0x49cd90[_0x78fd('0x56')]['to'][0x0],'firstMsgDirection':_0x78fd('0xb5'),'Messages':[_[_0x78fd('0x48')](_0x49cd90['body'],{'read':![],'body':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0][_0x78fd('0xb6')],'FaxAccountId':_0x2f8232['id'],'UserId':_0x49cd90[_0x78fd('0x57')]['id'],'ContactId':_0x3602eb['id'],'AttachmentId':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x78fd('0xa1')],'as':_0x78fd('0xb7')}]})[_0x78fd('0x1c')](function(_0x4a25aa){return[_0x4a25aa,!![]];});});}else{throw new Error(_0x78fd('0xb8'));}})['spread'](function(_0xde57ce,_0x79019){if(_0x79019){return _0xde57ce;}return db[_0x78fd('0xa1')]['create']({'direction':_0x78fd('0xb5'),'read':![],'body':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0][_0x78fd('0xb6')],'FaxAccountId':_0x2f8232['id'],'FaxInteractionId':_0xde57ce['id'],'UserId':_0x49cd90[_0x78fd('0x57')]['id'],'ContactId':_0xde57ce[_0x78fd('0xb9')],'AttachmentId':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0]['id']})[_0x78fd('0x1c')](function(_0x2d4ddd){_0xde57ce[_0x78fd('0xba')][_0x78fd('0xb7')]=[];_0xde57ce['dataValues'][_0x78fd('0xb7')][_0x78fd('0x8d')](_0x2d4ddd[_0x78fd('0xba')]);return _0xde57ce;});})[_0x78fd('0x1c')](function(_0x2161bd){respondWithRpcPromise('SendFax',_0x78fd('0xbb'),{'FaxAccountId':_[_0x78fd('0xae')](_0x49cd90[_0x78fd('0x51')]['id'])?undefined:_0x49cd90[_0x78fd('0x51')]['id'],'path':_[_0x78fd('0xae')](_0x49cd90['body'][_0x78fd('0xa9')][0x0][_0x78fd('0xaf')])?undefined:_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0][_0x78fd('0xaf')],'fax':_[_0x78fd('0xae')](_0x49cd90[_0x78fd('0x56')]['to'][0x0])?undefined:_0x49cd90['body']['to'][0x0],'AttachmentId':_0x49cd90[_0x78fd('0x56')][_0x78fd('0xa9')][0x0]['id']},client9002)[_0x78fd('0x1c')](function(_0x55057e){logger[_0x78fd('0x1d')]('SendFaxRpc,\x20%s',_0x55057e);})['catch'](function(_0x46d50f){logger[_0x78fd('0x1d')]('SendFaxRpc,\x20%s',_0x46d50f);});return _0x2161bd;})[_0x78fd('0x1c')](respondWithResult(_0x12ee23,null))[_0x78fd('0x27')](handleError(_0x12ee23,null));};exports[_0x78fd('0xbc')]=function(_0x14d4e7,_0x4bc5fc,_0x341271){return db['FaxAccount']['find']({'where':{'id':_0x14d4e7['params']['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x4bc5fc,null))['then'](function(_0x19449a){if(_0x19449a){return _0x19449a[_0x78fd('0xbc')](_0x14d4e7['body'][_0x78fd('0x68')],_['omit'](_0x14d4e7[_0x78fd('0x56')],['ids','id'])||{})['spread'](function(_0x1583d8){for(var _0x3ef344=0x0;_0x3ef344<_0x14d4e7['body']['ids'][_0x78fd('0x42')];_0x3ef344+=0x1){socket[_0x78fd('0xbd')](_0x78fd('0xbe'),{'UserId':Number(_0x14d4e7[_0x78fd('0x56')][_0x78fd('0x68')][_0x3ef344]),'FaxAccountId':Number(_0x14d4e7[_0x78fd('0x51')]['id'])});}return _0x1583d8;});}})['then'](respondWithResult(_0x4bc5fc,null))[_0x78fd('0x27')](handleError(_0x4bc5fc,null));};exports[_0x78fd('0xbf')]=function(_0x2354db,_0x38c424,_0x32fec5){return db['FaxAccount']['find']({'where':{'id':_0x2354db[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x38c424,null))[_0x78fd('0x1c')](function(_0x2fe43c){if(_0x2fe43c){return _0x2fe43c[_0x78fd('0xbf')](_0x2354db[_0x78fd('0x3e')][_0x78fd('0x68')])['then'](function(){if(_[_0x78fd('0xc0')](_0x2354db['query'][_0x78fd('0x68')])){for(var _0x559ba1=0x0;_0x559ba1<_0x2354db['query'][_0x78fd('0x68')][_0x78fd('0x42')];_0x559ba1+=0x1){socket[_0x78fd('0xbd')](_0x78fd('0xc1'),{'UserId':Number(_0x2354db[_0x78fd('0x3e')]['ids'][_0x559ba1]),'FaxAccountId':Number(_0x2354db[_0x78fd('0x51')]['id'])});}}else{socket[_0x78fd('0xbd')](_0x78fd('0xc1'),{'UserId':Number(_0x2354db[_0x78fd('0x3e')][_0x78fd('0x68')]),'FaxAccountId':Number(_0x2354db[_0x78fd('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x38c424,null))[_0x78fd('0x27')](handleError(_0x38c424,null));};exports[_0x78fd('0xc2')]=function(_0x36705b,_0x3b1da3,_0xcfe456){var _0x255295={};var _0x15c83d={};var _0x4e6173;var _0x297272;return db[_0x78fd('0x4b')]['findOne']({'where':{'id':_0x36705b[_0x78fd('0x51')]['id']}})[_0x78fd('0x1c')](handleEntityNotFound(_0x3b1da3,null))[_0x78fd('0x1c')](function(_0x4ce697){if(_0x4ce697){_0x4e6173=_0x4ce697;_0x15c83d[_0x78fd('0x3d')]=_['keys'](db[_0x78fd('0xc3')][_0x78fd('0x39')]);_0x15c83d['query']=_['keys'](_0x36705b['query']);_0x15c83d['filters']=_[_0x78fd('0x40')](_0x15c83d[_0x78fd('0x3d')],_0x15c83d[_0x78fd('0x3e')]);_0x255295[_0x78fd('0x41')]=_['intersection'](_0x15c83d[_0x78fd('0x3d')],qs['fields'](_0x36705b['query'][_0x78fd('0x53')]));_0x255295[_0x78fd('0x41')]=_0x255295[_0x78fd('0x41')][_0x78fd('0x42')]?_0x255295[_0x78fd('0x41')]:_0x15c83d[_0x78fd('0x3d')];_0x255295[_0x78fd('0x43')]=qs[_0x78fd('0x44')](_0x36705b['query'][_0x78fd('0x44')]);_0x255295['where']=qs[_0x78fd('0x45')](_[_0x78fd('0x6c')](_0x36705b['query'],_0x15c83d[_0x78fd('0x45')]));if(_0x36705b[_0x78fd('0x3e')][_0x78fd('0x46')]){_0x255295[_0x78fd('0x47')]=_[_0x78fd('0x48')](_0x255295[_0x78fd('0x47')],{'$or':_['map'](_0x255295[_0x78fd('0x41')],function(_0x3ae841){var _0x118e1f={};_0x118e1f[_0x3ae841]={'$like':'%'+_0x36705b[_0x78fd('0x3e')][_0x78fd('0x46')]+'%'};return _0x118e1f;})});}_0x255295=_[_0x78fd('0x48')]({},_0x255295,_0x36705b[_0x78fd('0x4a')]);return _0x4e6173[_0x78fd('0xc2')](_0x255295);}})[_0x78fd('0x1c')](function(_0x1bca84){if(_0x1bca84){_0x297272=_0x1bca84['length'];if(!_0x36705b[_0x78fd('0x3e')]['hasOwnProperty'](_0x78fd('0x66'))){_0x255295[_0x78fd('0x2d')]=qs[_0x78fd('0x2d')](_0x36705b[_0x78fd('0x3e')][_0x78fd('0x2d')]);_0x255295[_0x78fd('0x2c')]=qs[_0x78fd('0x2c')](_0x36705b[_0x78fd('0x3e')][_0x78fd('0x2c')]);}return _0x4e6173[_0x78fd('0xc2')](_0x255295);}})[_0x78fd('0x1c')](function(_0x43ca45){if(_0x43ca45){return _0x43ca45?{'count':_0x297272,'rows':_0x43ca45}:null;}})[_0x78fd('0x1c')](respondWithResult(_0x3b1da3,null))[_0x78fd('0x27')](handleError(_0x3b1da3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 13ab361..f93d50c 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 _0x28f1=['exports','FaxAccount','save','emit','hasOwnProperty','hook'];(function(_0x3b9140,_0x16a1ce){var _0x24df3b=function(_0x31e262){while(--_0x31e262){_0x3b9140['push'](_0x3b9140['shift']());}};_0x24df3b(++_0x16a1ce);}(_0x28f1,0x1db));var _0x128f=function(_0x23bd8a,_0x21127d){_0x23bd8a=_0x23bd8a-0x0;var _0x3c1508=_0x28f1[_0x23bd8a];return _0x3c1508;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x128f('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x128f('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3278ff){return function(_0x5e03c7,_0x397e04,_0x373dc2){FaxAccountEvents[_0x128f('0x2')](_0x3278ff+':'+_0x5e03c7['id'],_0x5e03c7);FaxAccountEvents[_0x128f('0x2')](_0x3278ff,_0x5e03c7);_0x373dc2(null);};}for(var e in events){if(events[_0x128f('0x3')](e)){var event=events[e];FaxAccount[_0x128f('0x4')](e,emitEvent(event));}}module[_0x128f('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0xfc20=['remove','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x42fff1,_0x12be71){var _0x542c94=function(_0x4ff6dc){while(--_0x4ff6dc){_0x42fff1['push'](_0x42fff1['shift']());}};_0x542c94(++_0x12be71);}(_0xfc20,0xd5));var _0x0fc2=function(_0x765cc9,_0x90fa0d){_0x765cc9=_0x765cc9-0x0;var _0x5450a1=_0xfc20[_0x765cc9];return _0x5450a1;};'use strict';var EventEmitter=require(_0x0fc2('0x0'));var FaxAccount=require(_0x0fc2('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0fc2('0x2'),'afterUpdate':_0x0fc2('0x3'),'afterDestroy':_0x0fc2('0x4')};function emitEvent(_0xac8a5){return function(_0xe1c254,_0x58f336,_0x22125b){FaxAccountEvents['emit'](_0xac8a5+':'+_0xe1c254['id'],_0xe1c254);FaxAccountEvents['emit'](_0xac8a5,_0xe1c254);_0x22125b(null);};}for(var e in events){if(events[_0x0fc2('0x5')](e)){var event=events[e];FaxAccount[_0x0fc2('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 465c8f2..c89f51b 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 _0xdb66=['exports','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f4a75,_0x3132ab){var _0x36808f=function(_0x218c5f){while(--_0x218c5f){_0x3f4a75['push'](_0x3f4a75['shift']());}};_0x36808f(++_0x3132ab);}(_0xdb66,0x1a4));var _0x6db6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xdb66[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x6db6('0x0'));var util=require(_0x6db6('0x1'));var logger=require(_0x6db6('0x2'))(_0x6db6('0x3'));var moment=require(_0x6db6('0x4'));var BPromise=require(_0x6db6('0x5'));var rp=require(_0x6db6('0x6'));var fs=require('fs');var path=require(_0x6db6('0x7'));var rimraf=require(_0x6db6('0x8'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x6db6('0x9')]=function(_0x4c3ee3,_0x43fd76){return _0x4c3ee3['define'](_0x6db6('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1ce=['FaxAccount','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxAccount.attributes','define'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xd1ce,0x1a8));var _0xed1c=function(_0x1d6d61,_0x10380b){_0x1d6d61=_0x1d6d61-0x0;var _0x227fc9=_0xd1ce[_0x1d6d61];return _0x227fc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed1c('0x0'))(_0xed1c('0x1'));var moment=require('moment');var BPromise=require(_0xed1c('0x2'));var rp=require(_0xed1c('0x3'));var fs=require('fs');var path=require(_0xed1c('0x4'));var rimraf=require(_0xed1c('0x5'));var config=require('../../config/environment');var attributes=require(_0xed1c('0x6'));module['exports']=function(_0xe83a64,_0x511b4b){return _0xe83a64[_0xed1c('0x7')](_0xed1c('0x8'),attributes,{'tableName':'fax_accounts','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 c98fba1..6ce7141 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 _0x582d=['from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','stringify','catch','NotifyFaxAccount','body','fax','CmContact','describe','then','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil'];(function(_0x46b371,_0x5e1241){var _0x2eea12=function(_0x57ae83){while(--_0x57ae83){_0x46b371['push'](_0x46b371['shift']());}};_0x2eea12(++_0x5e1241);}(_0x582d,0x82));var _0xd582=function(_0x31496e,_0x49a4ce){_0x31496e=_0x31496e-0x0;var _0x5c3017=_0x582d[_0x31496e];return _0x5c3017;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd582('0x0'));var BPromise=require(_0xd582('0x1'));var rs=require(_0xd582('0x2'));var fs=require('fs');var Redis=require(_0xd582('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd582('0x4'));var logger=require(_0xd582('0x5'))(_0xd582('0x6'));var config=require(_0xd582('0x7'));var jayson=require(_0xd582('0x8'));var client=jayson[_0xd582('0x9')][_0xd582('0xa')]({'port':0x232c});config[_0xd582('0xb')]=_[_0xd582('0xc')](config[_0xd582('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd582('0xb')]));require(_0xd582('0xd'))['register'](socket);function respondWithRpcPromise(_0x510b7e,_0x443cf5,_0x38b0a9){return new BPromise(function(_0x4fdabd,_0x3ae487){return client[_0xd582('0xe')](_0x510b7e,_0x38b0a9)['then'](function(_0x546dc1){logger[_0xd582('0xf')](_0xd582('0x10'),_0x443cf5,'request\x20sent');logger[_0xd582('0x11')](_0xd582('0x12'),_0x443cf5,_0xd582('0x13'),JSON['stringify'](_0x546dc1));if(_0x546dc1[_0xd582('0x14')]){if(_0x546dc1[_0xd582('0x14')]['code']===0x1f4){logger[_0xd582('0x14')](_0xd582('0x10'),_0x443cf5,_0x546dc1['error'][_0xd582('0x15')]);return _0x3ae487(_0x546dc1[_0xd582('0x14')][_0xd582('0x15')]);}logger[_0xd582('0x14')](_0xd582('0x10'),_0x443cf5,_0x546dc1[_0xd582('0x14')][_0xd582('0x15')]);return _0x4fdabd(_0x546dc1[_0xd582('0x14')][_0xd582('0x15')]);}else{logger[_0xd582('0xf')](_0xd582('0x10'),_0x443cf5,_0xd582('0x13'));_0x4fdabd(_0x546dc1[_0xd582('0x16')][_0xd582('0x15')]);}})['catch'](function(_0x5ac8bd){logger[_0xd582('0x14')](_0xd582('0x10'),_0x443cf5,_0x5ac8bd);_0x3ae487(_0x5ac8bd);});});}exports['GetFaxAccount']=function(_0x3b40a7){var _0x98ef3d=this;return new Promise(function(_0x4402cc,_0x3acc31){return db[_0xd582('0x17')][_0xd582('0x18')]({'raw':_0x3b40a7[_0xd582('0x19')]?_0x3b40a7[_0xd582('0x19')][_0xd582('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b40a7['options']?_0x3b40a7['options'][_0xd582('0x1b')]||null:null,'attributes':_0x3b40a7[_0xd582('0x19')]?_0x3b40a7[_0xd582('0x19')][_0xd582('0x1c')]||null:null,'limit':_0x3b40a7[_0xd582('0x19')]?_0x3b40a7[_0xd582('0x19')][_0xd582('0x1d')]||null:null,'include':_0x3b40a7[_0xd582('0x19')]?_0x3b40a7['options'][_0xd582('0x1e')]?_[_0xd582('0x1f')](_0x3b40a7[_0xd582('0x19')][_0xd582('0x1e')],function(_0x50a2c){return{'model':db[_0x50a2c[_0xd582('0x20')]],'as':_0x50a2c['as'],'attributes':_0x50a2c[_0xd582('0x1c')],'include':_0x50a2c[_0xd582('0x1e')]?_['map'](_0x50a2c[_0xd582('0x1e')],function(_0x33b272){return{'model':db[_0x33b272[_0xd582('0x20')]],'as':_0x33b272['as'],'attributes':_0x33b272['attributes'],'include':_0x33b272[_0xd582('0x1e')]?_[_0xd582('0x1f')](_0x33b272[_0xd582('0x1e')],function(_0x354b31){return{'model':db[_0x354b31['model']],'as':_0x354b31['as'],'attributes':_0x354b31[_0xd582('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c7359){logger[_0xd582('0xf')]('GetFaxAccount',_0x3b40a7);logger['debug'](_0xd582('0x21'),_0x3b40a7,JSON[_0xd582('0x22')](_0x2c7359));_0x4402cc(_0x2c7359);})[_0xd582('0x23')](function(_0x5300e7){logger[_0xd582('0x14')]('GetFaxAccount',_0x5300e7[_0xd582('0x15')],_0x3b40a7);_0x3acc31(_0x98ef3d[_0xd582('0x14')](0x1f4,_0x5300e7['message']));});});};exports[_0xd582('0x24')]=function(_0x111230,_0x2eec5e,_0x1f7474){var _0x5c9fde=this;return new Promise(function(_0x2f2339,_0x476507){var _0x13e6cc={'body':_0x111230[_0xd582('0x25')],'channel':_0xd582('0x26')};var _0x5e5e2b=[];var _0x3e14ff=[];var _0x18a455={};return db[_0xd582('0x27')][_0xd582('0x28')]()[_0xd582('0x29')](function(_0x9f1138){if(!_0x9f1138){throw new db['Sequelize'][(_0xd582('0x2a'))](_0xd582('0x2b'));}_0x5e5e2b=_['difference'](_['keys'](_0x9f1138),[_0xd582('0x2c'),_0xd582('0x2d')]);_0x3e14ff=_[_0xd582('0x2e')](_['keys'](_0x9f1138),[_0xd582('0x2c'),_0xd582('0x2d'),_0xd582('0x2f'),_0xd582('0x30')]);if(_0x111230['body']['id']){delete _0x111230[_0xd582('0x25')]['id'];}if(_[_0xd582('0x31')](_0x111230['body'][_0xd582('0x32')])){throw new db['Sequelize'][(_0xd582('0x2a'))](_0xd582('0x33'));}if(_[_0xd582('0x31')](_0x111230['body'][_0xd582('0x25')])||_0x111230[_0xd582('0x25')][_0xd582('0x25')]===''){throw new db[(_0xd582('0x34'))][(_0xd582('0x2a'))](_0xd582('0x35'));}if(_[_0xd582('0x31')](_0x111230['body'][_0xd582('0x36')])){throw new db[(_0xd582('0x34'))][(_0xd582('0x2a'))](_0xd582('0x37')+_0x3e14ff);}if(!_[_0xd582('0x38')](_0x3e14ff,_0x111230[_0xd582('0x25')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd582('0x39')+_0x3e14ff);}_0x18a455[_0x111230[_0xd582('0x25')]['mapKey']]=_0x111230[_0xd582('0x25')][_0xd582('0x32')];})['then'](function(){return db['FaxAccount'][_0xd582('0x3a')]({'where':{'id':_0x111230[_0xd582('0x3b')]['id']},'include':[{'model':db[_0xd582('0x3c')],'as':_0xd582('0x3d'),'include':[{'model':db[_0xd582('0x27')],'as':_0xd582('0x3e'),'where':_0x18a455,'limit':0x1,'order':[[_0xd582('0x2d'),_0xd582('0x3f')]]}]},{'model':db[_0xd582('0x40')],'as':_0xd582('0x41')}]});})[_0xd582('0x29')](function(_0x42036d){if(_0x42036d&&_0x42036d['List']){var _0x412b2e=_0x42036d[_0xd582('0x42')]({'plain':!![]});_0x13e6cc['account']=_0x412b2e;_0x13e6cc[_0xd582('0x43')]=_0x412b2e['Applications'];_0x13e6cc[_0xd582('0x44')]=_0x412b2e['List'];_0x13e6cc[_0xd582('0x43')]=_['orderBy'](_0x13e6cc['applications'],['priority'],[_0xd582('0x45')]);if(_0x13e6cc['account']['Applications']){delete _0x13e6cc['account'][_0xd582('0x41')];}if(_0x13e6cc['account'][_0xd582('0x3d')]&&_0x13e6cc[_0xd582('0x3b')][_0xd582('0x3d')][_0xd582('0x3e')][_0xd582('0x46')]){return _0x13e6cc[_0xd582('0x3b')][_0xd582('0x3d')]['Contacts'][0x0];}var _0x3ce6fc=_[_0xd582('0xc')](_0x111230[_0xd582('0x25')],{'firstName':_0x111230[_0xd582('0x25')][_0xd582('0x32')],'ListId':_0x412b2e[_0xd582('0x30')]});_0x3ce6fc[_0x111230['body'][_0xd582('0x36')]]=_0x111230[_0xd582('0x25')][_0xd582('0x32')];return db[_0xd582('0x27')][_0xd582('0x47')](_0x3ce6fc,{'fields':_0x5e5e2b,'raw':!![]});}})['then'](function(_0x5093cf){_0x13e6cc[_0xd582('0x48')]=_0x5093cf;if(_0x5093cf){var _0x3d4fed={'ContactId':_0x5093cf['id'],'FaxAccountId':_0x111230[_0xd582('0x3b')]['id'],'fax':_0x5093cf[_0xd582('0x26')]};return db[_0xd582('0x49')][_0xd582('0x3a')]({'where':{'ContactId':_0x5093cf['id'],'closed':![],'FaxAccountId':_0x111230[_0xd582('0x3b')]['id']}})[_0xd582('0x29')](function(_0xd7b78b){if(_0xd7b78b){return[_0xd7b78b,![]];}return db[_0xd582('0x49')]['create'](_0x3d4fed)[_0xd582('0x29')](function(_0x12b60d){return[_0x12b60d,!![]];});});}else{throw new Error(_0xd582('0x4a'));}})[_0xd582('0x4b')](function(_0x1dc97c,_0x2d6035){var _0x2e6ba4=_0x1dc97c['get']({'plain':!![]});if(_0x2d6035){if(_0x13e6cc[_0xd582('0x3b')][_0xd582('0x4c')]){_0x13e6cc[_0xd582('0x43')]['push']({'id':0x0,'priority':_0x13e6cc[_0xd582('0x43')]['length']+0x1,'app':_0xd582('0x4d'),'appdata':_0xd582('0x4e'),'interval':_0xd582('0x4f')});}_0x2e6ba4[_0xd582('0x50')]=!![];}else{_0x2e6ba4[_0xd582('0x50')]=![];}_0x13e6cc[_0xd582('0x51')]=_0x2e6ba4;return db['FaxMessage'][_0xd582('0x47')]({'body':_0x111230[_0xd582('0x25')]['body'],'FaxAccountId':_0x111230['account']['id'],'FaxInteractionId':_0x1dc97c['id'],'direction':'in','ContactId':_0x1dc97c[_0xd582('0x52')],'AttachmentId':_0x111230['body']['AttachmentId']});})[_0xd582('0x29')](function(_0x301225){_0x13e6cc[_0xd582('0x15')]=_0x301225;if(_0x13e6cc[_0xd582('0x51')][_0xd582('0x53')]){return db[_0xd582('0x54')][_0xd582('0x3a')]({'attributes':['id',_0xd582('0x55')],'where':{'id':_0x13e6cc[_0xd582('0x51')][_0xd582('0x53')]}})['then'](function(_0x1bbd1f){if(_0x1bbd1f){_0x13e6cc['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd582('0x56'),'appdata':_0x1bbd1f[_0xd582('0x55')]+','+(_0x13e6cc[_0xd582('0x3b')][_0xd582('0x57')]||0xa),'interval':_0xd582('0x4f')});}return respondWithRpcPromise(_0xd582('0x58'),_0xd582('0x59'),_0x13e6cc);});}return respondWithRpcPromise(_0xd582('0x58'),_0xd582('0x59'),_0x13e6cc);})['then'](function(_0xf733ed){_0x2f2339(_0xf733ed);})['catch'](function(_0x1c8531){_0x476507(_0x5c9fde[_0xd582('0x14')](0x1f4,_0x1c8531['message']));});});}; \ No newline at end of file +var _0x02ff=['no\x20available\x20attributes','difference','keys','createdAt','ListId','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','List','updatedAt','DESC','Applications','get','account','applications','list','priority','Contacts','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','ValidationError'];(function(_0x2c9e61,_0x2d13f5){var _0x4d55d6=function(_0x56f065){while(--_0x56f065){_0x2c9e61['push'](_0x2c9e61['shift']());}};_0x4d55d6(++_0x2d13f5);}(_0x02ff,0x147));var _0xf02f=function(_0x1a9c40,_0x5e1495){_0x1a9c40=_0x1a9c40-0x0;var _0x5da3b3=_0x02ff[_0x1a9c40];return _0x5da3b3;};'use strict';var _=require('lodash');var util=require(_0xf02f('0x0'));var moment=require(_0xf02f('0x1'));var BPromise=require(_0xf02f('0x2'));var rs=require(_0xf02f('0x3'));var fs=require('fs');var Redis=require(_0xf02f('0x4'));var db=require(_0xf02f('0x5'))['db'];var utils=require(_0xf02f('0x6'));var logger=require(_0xf02f('0x7'))(_0xf02f('0x8'));var config=require(_0xf02f('0x9'));var jayson=require(_0xf02f('0xa'));var client=jayson[_0xf02f('0xb')][_0xf02f('0xc')]({'port':0x232c});config['redis']=_[_0xf02f('0xd')](config[_0xf02f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xf02f('0xf'))(new Redis(config[_0xf02f('0xe')]));require(_0xf02f('0x10'))[_0xf02f('0x11')](socket);function respondWithRpcPromise(_0xbdd1c1,_0x148f12,_0x286c50){return new BPromise(function(_0x39d798,_0x5e8e1f){return client[_0xf02f('0x12')](_0xbdd1c1,_0x286c50)['then'](function(_0x2c13bd){logger[_0xf02f('0x13')](_0xf02f('0x14'),_0x148f12,_0xf02f('0x15'));logger['debug'](_0xf02f('0x16'),_0x148f12,_0xf02f('0x15'),JSON[_0xf02f('0x17')](_0x2c13bd));if(_0x2c13bd['error']){if(_0x2c13bd[_0xf02f('0x18')][_0xf02f('0x19')]===0x1f4){logger[_0xf02f('0x18')](_0xf02f('0x14'),_0x148f12,_0x2c13bd[_0xf02f('0x18')][_0xf02f('0x1a')]);return _0x5e8e1f(_0x2c13bd[_0xf02f('0x18')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x148f12,_0x2c13bd[_0xf02f('0x18')]['message']);return _0x39d798(_0x2c13bd[_0xf02f('0x18')][_0xf02f('0x1a')]);}else{logger[_0xf02f('0x13')](_0xf02f('0x14'),_0x148f12,'request\x20sent');_0x39d798(_0x2c13bd[_0xf02f('0x1b')]['message']);}})[_0xf02f('0x1c')](function(_0x33bc3f){logger['error'](_0xf02f('0x14'),_0x148f12,_0x33bc3f);_0x5e8e1f(_0x33bc3f);});});}exports[_0xf02f('0x1d')]=function(_0x5b76e1){var _0x3eda39=this;return new Promise(function(_0x4a16f5,_0x223c11){return db[_0xf02f('0x1e')][_0xf02f('0x1f')]({'raw':_0x5b76e1[_0xf02f('0x20')]?_0x5b76e1[_0xf02f('0x20')][_0xf02f('0x21')]===undefined?!![]:![]:!![],'where':_0x5b76e1[_0xf02f('0x20')]?_0x5b76e1[_0xf02f('0x20')][_0xf02f('0x22')]||null:null,'attributes':_0x5b76e1[_0xf02f('0x20')]?_0x5b76e1[_0xf02f('0x20')][_0xf02f('0x23')]||null:null,'limit':_0x5b76e1[_0xf02f('0x20')]?_0x5b76e1[_0xf02f('0x20')][_0xf02f('0x24')]||null:null,'include':_0x5b76e1[_0xf02f('0x20')]?_0x5b76e1[_0xf02f('0x20')][_0xf02f('0x25')]?_[_0xf02f('0x26')](_0x5b76e1[_0xf02f('0x20')]['include'],function(_0x118177){return{'model':db[_0x118177['model']],'as':_0x118177['as'],'attributes':_0x118177['attributes'],'include':_0x118177[_0xf02f('0x25')]?_['map'](_0x118177['include'],function(_0x315e53){return{'model':db[_0x315e53[_0xf02f('0x27')]],'as':_0x315e53['as'],'attributes':_0x315e53[_0xf02f('0x23')],'include':_0x315e53['include']?_[_0xf02f('0x26')](_0x315e53[_0xf02f('0x25')],function(_0x2da499){return{'model':db[_0x2da499[_0xf02f('0x27')]],'as':_0x2da499['as'],'attributes':_0x2da499['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a0b9e){logger[_0xf02f('0x13')](_0xf02f('0x1d'),_0x5b76e1);logger[_0xf02f('0x28')](_0xf02f('0x1d'),_0x5b76e1,JSON[_0xf02f('0x17')](_0x4a0b9e));_0x4a16f5(_0x4a0b9e);})[_0xf02f('0x1c')](function(_0x1236be){logger[_0xf02f('0x18')](_0xf02f('0x1d'),_0x1236be[_0xf02f('0x1a')],_0x5b76e1);_0x223c11(_0x3eda39[_0xf02f('0x18')](0x1f4,_0x1236be['message']));});});};exports[_0xf02f('0x29')]=function(_0x33c844,_0x47ca9e,_0x44ea96){var _0x39e858=this;return new Promise(function(_0x148390,_0xe53124){var _0x5cf31a={'body':_0x33c844[_0xf02f('0x2a')],'channel':_0xf02f('0x2b')};var _0x320a76=[];var _0x1c0b82=[];var _0x31bce8={};return db[_0xf02f('0x2c')][_0xf02f('0x2d')]()[_0xf02f('0x2e')](function(_0x7142c){if(!_0x7142c){throw new db[(_0xf02f('0x2f'))][(_0xf02f('0x30'))](_0xf02f('0x31'));}_0x320a76=_[_0xf02f('0x32')](_[_0xf02f('0x33')](_0x7142c),[_0xf02f('0x34'),'updatedAt']);_0x1c0b82=_[_0xf02f('0x32')](_['keys'](_0x7142c),[_0xf02f('0x34'),'updatedAt','CompanyId',_0xf02f('0x35')]);if(_0x33c844[_0xf02f('0x2a')]['id']){delete _0x33c844[_0xf02f('0x2a')]['id'];}if(_[_0xf02f('0x36')](_0x33c844[_0xf02f('0x2a')]['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf02f('0x36')](_0x33c844[_0xf02f('0x2a')][_0xf02f('0x2a')])||_0x33c844[_0xf02f('0x2a')][_0xf02f('0x2a')]===''){throw new db[(_0xf02f('0x2f'))][(_0xf02f('0x30'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x33c844[_0xf02f('0x2a')]['mapKey'])){throw new db[(_0xf02f('0x2f'))][(_0xf02f('0x30'))](_0xf02f('0x37')+_0x1c0b82);}if(!_[_0xf02f('0x38')](_0x1c0b82,_0x33c844[_0xf02f('0x2a')][_0xf02f('0x39')])){throw new db[(_0xf02f('0x2f'))]['ValidationError'](_0xf02f('0x3a')+_0x1c0b82);}_0x31bce8[_0x33c844[_0xf02f('0x2a')]['mapKey']]=_0x33c844[_0xf02f('0x2a')][_0xf02f('0x3b')];})[_0xf02f('0x2e')](function(){return db[_0xf02f('0x1e')][_0xf02f('0x3c')]({'where':{'id':_0x33c844['account']['id']},'include':[{'model':db[_0xf02f('0x3d')],'as':_0xf02f('0x3e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x31bce8,'limit':0x1,'order':[[_0xf02f('0x3f'),_0xf02f('0x40')]]}]},{'model':db['FaxApplication'],'as':_0xf02f('0x41')}]});})[_0xf02f('0x2e')](function(_0x225776){if(_0x225776&&_0x225776[_0xf02f('0x3e')]){var _0x1c79fc=_0x225776[_0xf02f('0x42')]({'plain':!![]});_0x5cf31a[_0xf02f('0x43')]=_0x1c79fc;_0x5cf31a[_0xf02f('0x44')]=_0x1c79fc[_0xf02f('0x41')];_0x5cf31a[_0xf02f('0x45')]=_0x1c79fc[_0xf02f('0x3e')];_0x5cf31a[_0xf02f('0x44')]=_['orderBy'](_0x5cf31a[_0xf02f('0x44')],[_0xf02f('0x46')],['asc']);if(_0x5cf31a[_0xf02f('0x43')][_0xf02f('0x41')]){delete _0x5cf31a[_0xf02f('0x43')]['Applications'];}if(_0x5cf31a[_0xf02f('0x43')][_0xf02f('0x3e')]&&_0x5cf31a[_0xf02f('0x43')][_0xf02f('0x3e')]['Contacts']['length']){return _0x5cf31a[_0xf02f('0x43')][_0xf02f('0x3e')][_0xf02f('0x47')][0x0];}var _0x54b7e3=_['defaults'](_0x33c844[_0xf02f('0x2a')],{'firstName':_0x33c844[_0xf02f('0x2a')][_0xf02f('0x3b')],'ListId':_0x1c79fc['ListId']});_0x54b7e3[_0x33c844[_0xf02f('0x2a')][_0xf02f('0x39')]]=_0x33c844[_0xf02f('0x2a')][_0xf02f('0x3b')];return db[_0xf02f('0x2c')]['create'](_0x54b7e3,{'fields':_0x320a76,'raw':!![]});}})[_0xf02f('0x2e')](function(_0x171b0a){_0x5cf31a[_0xf02f('0x48')]=_0x171b0a;if(_0x171b0a){var _0x591d14={'ContactId':_0x171b0a['id'],'FaxAccountId':_0x33c844[_0xf02f('0x43')]['id'],'fax':_0x171b0a[_0xf02f('0x2b')]};return db[_0xf02f('0x49')][_0xf02f('0x3c')]({'where':{'ContactId':_0x171b0a['id'],'closed':![],'FaxAccountId':_0x33c844['account']['id']}})[_0xf02f('0x2e')](function(_0x2c6ac6){if(_0x2c6ac6){return[_0x2c6ac6,![]];}return db[_0xf02f('0x49')]['create'](_0x591d14)[_0xf02f('0x2e')](function(_0x3787fb){return[_0x3787fb,!![]];});});}else{throw new Error(_0xf02f('0x4a'));}})[_0xf02f('0x4b')](function(_0x4332be,_0x115e1d){var _0x270e38=_0x4332be[_0xf02f('0x42')]({'plain':!![]});if(_0x115e1d){if(_0x5cf31a[_0xf02f('0x43')][_0xf02f('0x4c')]){_0x5cf31a['applications'][_0xf02f('0x4d')]({'id':0x0,'priority':_0x5cf31a['applications']['length']+0x1,'app':_0xf02f('0x4e'),'appdata':_0xf02f('0x4f'),'interval':_0xf02f('0x50')});}_0x270e38[_0xf02f('0x51')]=!![];}else{_0x270e38['created']=![];}_0x5cf31a[_0xf02f('0x52')]=_0x270e38;return db[_0xf02f('0x53')][_0xf02f('0x54')]({'body':_0x33c844[_0xf02f('0x2a')]['body'],'FaxAccountId':_0x33c844['account']['id'],'FaxInteractionId':_0x4332be['id'],'direction':'in','ContactId':_0x4332be[_0xf02f('0x55')],'AttachmentId':_0x33c844[_0xf02f('0x2a')][_0xf02f('0x56')]});})[_0xf02f('0x2e')](function(_0x24930f){_0x5cf31a[_0xf02f('0x1a')]=_0x24930f;if(_0x5cf31a['interaction'][_0xf02f('0x57')]){return db[_0xf02f('0x58')][_0xf02f('0x3c')]({'attributes':['id',_0xf02f('0x59')],'where':{'id':_0x5cf31a['interaction'][_0xf02f('0x57')]}})[_0xf02f('0x2e')](function(_0x2c6f9b){if(_0x2c6f9b){_0x5cf31a[_0xf02f('0x44')][_0xf02f('0x5a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2c6f9b[_0xf02f('0x59')]+','+(_0x5cf31a[_0xf02f('0x43')][_0xf02f('0x5b')]||0xa),'interval':_0xf02f('0x50')});}return respondWithRpcPromise(_0xf02f('0x5c'),_0xf02f('0x5d'),_0x5cf31a);});}return respondWithRpcPromise(_0xf02f('0x5c'),_0xf02f('0x5d'),_0x5cf31a);})[_0xf02f('0x2e')](function(_0xa082ab){_0x148390(_0xa082ab);})[_0xf02f('0x1c')](function(_0x2f4eb1){_0xe53124(_0x39e858[_0xf02f('0x18')](0x1f4,_0x2f4eb1[_0xf02f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d6bdb6d..0f0a257 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 _0x8272=['update','emit','removeListener','register','faxAccount:','./faxAccount.events','remove'];(function(_0x507c4b,_0x36cc1a){var _0x1b8bb6=function(_0x5aa094){while(--_0x5aa094){_0x507c4b['push'](_0x507c4b['shift']());}};_0x1b8bb6(++_0x36cc1a);}(_0x8272,0x7c));var _0x2827=function(_0x5f5016,_0x423699){_0x5f5016=_0x5f5016-0x0;var _0x2b0254=_0x8272[_0x5f5016];return _0x2b0254;};'use strict';var FaxAccountEvents=require(_0x2827('0x0'));var events=['save',_0x2827('0x1'),_0x2827('0x2')];function createListener(_0x518f78,_0x5305e7){return function(_0x4dbcd3){_0x5305e7[_0x2827('0x3')](_0x518f78,_0x4dbcd3);};}function removeListener(_0x544dd0,_0x110ff7){return function(){FaxAccountEvents[_0x2827('0x4')](_0x544dd0,_0x110ff7);};}exports[_0x2827('0x5')]=function(_0x14d65b){for(var _0x4b0fbd=0x0,_0x367ea7=events['length'];_0x4b0fbd<_0x367ea7;_0x4b0fbd++){var _0x40a938=events[_0x4b0fbd];var _0x58d7e3=createListener(_0x2827('0x6')+_0x40a938,_0x14d65b);FaxAccountEvents['on'](_0x40a938,_0x58d7e3);}}; \ No newline at end of file +var _0x3003=['length','update','emit','register'];(function(_0x4d325f,_0xf381f6){var _0x3aa5ac=function(_0x197c91){while(--_0x197c91){_0x4d325f['push'](_0x4d325f['shift']());}};_0x3aa5ac(++_0xf381f6);}(_0x3003,0x1ed));var _0x3300=function(_0x367e25,_0xc8efea){_0x367e25=_0x367e25-0x0;var _0x1c7517=_0x3003[_0x367e25];return _0x1c7517;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0x3300('0x0')];function createListener(_0x332df2,_0x562e80){return function(_0x2426be){_0x562e80[_0x3300('0x1')](_0x332df2,_0x2426be);};}function removeListener(_0x286d1c,_0x39c194){return function(){FaxAccountEvents['removeListener'](_0x286d1c,_0x39c194);};}exports[_0x3300('0x2')]=function(_0x58b3f9){for(var _0x29e569=0x0,_0xb4b525=events[_0x3300('0x3')];_0x29e569<_0xb4b525;_0x29e569++){var _0x3e99a5=events[_0x29e569];var _0x3bcec3=createListener('faxAccount:'+_0x3e99a5,_0x58b3f9);FaxAccountEvents['on'](_0x3e99a5,_0x3bcec3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9b968a3..ff31489 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(_0xe33509,_0x213a9f){var _0x1fac1b=function(_0x5ba764){while(--_0x5ba764){_0xe33509['push'](_0xe33509['shift']());}};_0x1fac1b(++_0x213a9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +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(_0x4ebf9e,_0x1607e2){var _0x3dfaf2=function(_0x1ada84){while(--_0x1ada84){_0x4ebf9e['push'](_0x4ebf9e['shift']());}};_0x3dfaf2(++_0x1607e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ee07543..9f4b06a 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 _0xc39b=['STRING','*,*,*,*','exports','noop'];(function(_0x5ce6a2,_0x25e9f5){var _0xb75c7e=function(_0x2ba0cd){while(--_0x2ba0cd){_0x5ce6a2['push'](_0x5ce6a2['shift']());}};_0xb75c7e(++_0x25e9f5);}(_0xc39b,0xc6));var _0xbc39=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc39b[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require('sequelize');module[_0xbc39('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbc39('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbc39('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbc39('0x3')}}; \ No newline at end of file +var _0xa2f0=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2f0,0x101));var _0x0a2f=function(_0x336f57,_0x1c7a30){_0x336f57=_0x336f57-0x0;var _0x27e137=_0xa2f0[_0x336f57];return _0x27e137;};'use strict';var Sequelize=require(_0x0a2f('0x0'));module[_0x0a2f('0x1')]={'priority':{'type':Sequelize[_0x0a2f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0a2f('0x3')],'allowNull':![],'defaultValue':_0x0a2f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0a2f('0x3')]},'interval':{'type':Sequelize[_0x0a2f('0x3')],'defaultValue':_0x0a2f('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index b56d361..94e63ee 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 _0x4bd0=['FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','index','map'];(function(_0x2cb2e4,_0x250d15){var _0x22a0f5=function(_0x19e78c){while(--_0x19e78c){_0x2cb2e4['push'](_0x2cb2e4['shift']());}};_0x22a0f5(++_0x250d15);}(_0x4bd0,0x16d));var _0x04bd=function(_0x4e1bc0,_0x2fd996){_0x4e1bc0=_0x4e1bc0-0x0;var _0x151f70=_0x4bd0[_0x4e1bc0];return _0x151f70;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require(_0x04bd('0x1'));var zipdir=require(_0x04bd('0x2'));var jsonpatch=require(_0x04bd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x04bd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x04bd('0x5'));var sox=require(_0x04bd('0x6'));var csv=require(_0x04bd('0x7'));var ejs=require(_0x04bd('0x8'));var fs=require('fs');var fs_extra=require(_0x04bd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x04bd('0xa'));var jsforce=require(_0x04bd('0xb'));var deskjs=require(_0x04bd('0xc'));var toCsv=require(_0x04bd('0x7'));var querystring=require('querystring');var Papa=require(_0x04bd('0xd'));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(_0x04bd('0xe'));var logger=require(_0x04bd('0xf'))(_0x04bd('0x10'));var utils=require('../../config/utils');var config=require(_0x04bd('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5b4,_0x15f8cd){_0x15f8cd=_0x15f8cd||0xcc;return function(_0x593913){if(_0x593913){return _0x34b5b4[_0x04bd('0x12')](_0x15f8cd);}return _0x34b5b4[_0x04bd('0x13')](_0x15f8cd)[_0x04bd('0x14')]();};}function respondWithResult(_0x31444d,_0x9ad09b){_0x9ad09b=_0x9ad09b||0xc8;return function(_0x59a53d){if(_0x59a53d){return _0x31444d[_0x04bd('0x13')](_0x9ad09b)['json'](_0x59a53d);}};}function respondWithFilteredResult(_0x2eabc3,_0x280418){return function(_0x2a3ff5){if(_0x2a3ff5){var _0x45437e=typeof _0x280418[_0x04bd('0x15')]===_0x04bd('0x16')&&typeof _0x280418[_0x04bd('0x17')]===_0x04bd('0x16');var _0x966f9=_0x2a3ff5[_0x04bd('0x18')];var _0x585768=_0x45437e?0x0:_0x280418['offset'];var _0x194142=_0x45437e?_0x2a3ff5[_0x04bd('0x18')]:_0x280418['offset']+_0x280418['limit'];var _0x13cfee;if(_0x194142>=_0x966f9){_0x194142=_0x966f9;_0x13cfee=0xc8;}else{_0x13cfee=0xce;}_0x2eabc3[_0x04bd('0x13')](_0x13cfee);return _0x2eabc3[_0x04bd('0x19')](_0x04bd('0x1a'),_0x585768+'-'+_0x194142+'/'+_0x966f9)[_0x04bd('0x1b')](_0x2a3ff5);}return null;};}function patchUpdates(_0xd8716a){return function(_0x324960){try{jsonpatch[_0x04bd('0x1c')](_0x324960,_0xd8716a,!![]);}catch(_0x4ba768){return BPromise[_0x04bd('0x1d')](_0x4ba768);}return _0x324960[_0x04bd('0x1e')]();};}function saveUpdates(_0x52071d,_0x143afa){return function(_0x287171){if(_0x287171){return _0x287171[_0x04bd('0x1f')](_0x52071d)[_0x04bd('0x20')](function(_0x227b5d){return _0x227b5d;});}return null;};}function removeEntity(_0x11b6de,_0x32b848){return function(_0x5f0afe){if(_0x5f0afe){return _0x5f0afe['destroy']()[_0x04bd('0x20')](function(){_0x11b6de[_0x04bd('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x202a16,_0x1fccd3){return function(_0x5129cf){if(!_0x5129cf){_0x202a16[_0x04bd('0x12')](0x194);}return _0x5129cf;};}function handleError(_0x264201,_0x587803){_0x587803=_0x587803||0x1f4;return function(_0x62b5c8){logger['error'](_0x62b5c8['stack']);if(_0x62b5c8[_0x04bd('0x21')]){delete _0x62b5c8[_0x04bd('0x21')];}_0x264201[_0x04bd('0x13')](_0x587803)[_0x04bd('0x22')](_0x62b5c8);};}exports[_0x04bd('0x23')]=function(_0x50cab6,_0x52a890){var _0x5245f3={},_0x22f11a={},_0x5de1b7={'count':0x0,'rows':[]};var _0x396572=_[_0x04bd('0x24')](db[_0x04bd('0x25')]['rawAttributes'],function(_0x4cd603){return{'name':_0x4cd603[_0x04bd('0x26')],'type':_0x4cd603[_0x04bd('0x27')][_0x04bd('0x28')]};});_0x22f11a[_0x04bd('0x29')]=_[_0x04bd('0x24')](_0x396572,'name');_0x22f11a[_0x04bd('0x2a')]=_[_0x04bd('0x2b')](_0x50cab6[_0x04bd('0x2a')]);_0x22f11a[_0x04bd('0x2c')]=_[_0x04bd('0x2d')](_0x22f11a[_0x04bd('0x29')],_0x22f11a[_0x04bd('0x2a')]);_0x5245f3[_0x04bd('0x2e')]=_[_0x04bd('0x2d')](_0x22f11a[_0x04bd('0x29')],qs['fields'](_0x50cab6[_0x04bd('0x2a')][_0x04bd('0x2f')]));_0x5245f3['attributes']=_0x5245f3[_0x04bd('0x2e')][_0x04bd('0x30')]?_0x5245f3['attributes']:_0x22f11a[_0x04bd('0x29')];if(!_0x50cab6['query'][_0x04bd('0x31')]('nolimit')){_0x5245f3[_0x04bd('0x17')]=qs['limit'](_0x50cab6[_0x04bd('0x2a')]['limit']);_0x5245f3[_0x04bd('0x15')]=qs[_0x04bd('0x15')](_0x50cab6['query'][_0x04bd('0x15')]);}_0x5245f3[_0x04bd('0x32')]=qs[_0x04bd('0x33')](_0x50cab6[_0x04bd('0x2a')]['sort']);_0x5245f3[_0x04bd('0x34')]=qs[_0x04bd('0x2c')](_['pick'](_0x50cab6[_0x04bd('0x2a')],_0x22f11a[_0x04bd('0x2c')]),_0x396572);if(_0x50cab6['query'][_0x04bd('0x35')]){_0x5245f3['where']=_[_0x04bd('0x36')](_0x5245f3['where'],{'$or':_[_0x04bd('0x24')](_0x396572,function(_0x5a421a){if(_0x5a421a['type']!==_0x04bd('0x37')){var _0x4d541f={};_0x4d541f[_0x5a421a[_0x04bd('0x21')]]={'$like':'%'+_0x50cab6[_0x04bd('0x2a')][_0x04bd('0x35')]+'%'};return _0x4d541f;}})});}_0x5245f3=_[_0x04bd('0x36')]({},_0x5245f3,_0x50cab6[_0x04bd('0x38')]);var _0x3e181e={'where':_0x5245f3[_0x04bd('0x34')]};return db['FaxApplication']['count'](_0x3e181e)[_0x04bd('0x20')](function(_0x478185){_0x5de1b7[_0x04bd('0x18')]=_0x478185;if(_0x50cab6[_0x04bd('0x2a')][_0x04bd('0x39')]){_0x5245f3[_0x04bd('0x3a')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x5245f3);})[_0x04bd('0x20')](function(_0x1241c5){_0x5de1b7['rows']=_0x1241c5;return _0x5de1b7;})[_0x04bd('0x20')](respondWithFilteredResult(_0x52a890,_0x5245f3))['catch'](handleError(_0x52a890,null));};exports[_0x04bd('0x3b')]=function(_0x5b0f07,_0x20ea9d){var _0x31c20c={'raw':!![],'where':{'id':_0x5b0f07[_0x04bd('0x3c')]['id']}},_0x7a19b1={};_0x7a19b1[_0x04bd('0x29')]=_[_0x04bd('0x2b')](db[_0x04bd('0x25')][_0x04bd('0x3d')]);_0x7a19b1[_0x04bd('0x2a')]=_[_0x04bd('0x2b')](_0x5b0f07[_0x04bd('0x2a')]);_0x7a19b1['filters']=_[_0x04bd('0x2d')](_0x7a19b1[_0x04bd('0x29')],_0x7a19b1[_0x04bd('0x2a')]);_0x31c20c[_0x04bd('0x2e')]=_['intersection'](_0x7a19b1[_0x04bd('0x29')],qs[_0x04bd('0x2f')](_0x5b0f07[_0x04bd('0x2a')][_0x04bd('0x2f')]));_0x31c20c['attributes']=_0x31c20c[_0x04bd('0x2e')][_0x04bd('0x30')]?_0x31c20c[_0x04bd('0x2e')]:_0x7a19b1['model'];if(_0x5b0f07[_0x04bd('0x2a')][_0x04bd('0x39')]){_0x31c20c[_0x04bd('0x3a')]=[{'all':!![]}];}_0x31c20c=_['merge']({},_0x31c20c,_0x5b0f07[_0x04bd('0x38')]);return db[_0x04bd('0x25')][_0x04bd('0x3e')](_0x31c20c)[_0x04bd('0x20')](handleEntityNotFound(_0x20ea9d,null))[_0x04bd('0x20')](respondWithResult(_0x20ea9d,null))[_0x04bd('0x3f')](handleError(_0x20ea9d,null));};exports[_0x04bd('0x40')]=function(_0x511836,_0x228667){return db['FaxApplication'][_0x04bd('0x40')](_0x511836[_0x04bd('0x41')],{})[_0x04bd('0x20')](respondWithResult(_0x228667,0xc9))['catch'](handleError(_0x228667,null));};exports[_0x04bd('0x1f')]=function(_0x31e24d,_0x442246){if(_0x31e24d['body']['id']){delete _0x31e24d['body']['id'];}return db[_0x04bd('0x25')]['find']({'where':{'id':_0x31e24d['params']['id']}})[_0x04bd('0x20')](handleEntityNotFound(_0x442246,null))[_0x04bd('0x20')](saveUpdates(_0x31e24d[_0x04bd('0x41')],null))['then'](respondWithResult(_0x442246,null))[_0x04bd('0x3f')](handleError(_0x442246,null));};exports[_0x04bd('0x42')]=function(_0x1b83dc,_0xdf6664){return db[_0x04bd('0x25')][_0x04bd('0x3e')]({'where':{'id':_0x1b83dc[_0x04bd('0x3c')]['id']}})[_0x04bd('0x20')](handleEntityNotFound(_0xdf6664,null))[_0x04bd('0x20')](removeEntity(_0xdf6664,null))[_0x04bd('0x3f')](handleError(_0xdf6664,null));}; \ No newline at end of file +var _0x7096=['destroy','error','stack','name','send','index','map','FaxApplication','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x4fc811,_0x55aed9){var _0x22598a=function(_0x29cccf){while(--_0x29cccf){_0x4fc811['push'](_0x4fc811['shift']());}};_0x22598a(++_0x55aed9);}(_0x7096,0x1ec));var _0x6709=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7096[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require(_0x6709('0x1'));var jsonpatch=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var moment=require(_0x6709('0x4'));var BPromise=require(_0x6709('0x5'));var Mustache=require(_0x6709('0x6'));var util=require(_0x6709('0x7'));var path=require(_0x6709('0x8'));var sox=require(_0x6709('0x9'));var csv=require(_0x6709('0xa'));var ejs=require(_0x6709('0xb'));var fs=require('fs');var fs_extra=require(_0x6709('0xc'));var _=require(_0x6709('0xd'));var squel=require(_0x6709('0xe'));var crypto=require(_0x6709('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6709('0x10'));var toCsv=require(_0x6709('0xa'));var querystring=require(_0x6709('0x11'));var Papa=require(_0x6709('0x12'));var Redis=require(_0x6709('0x13'));var authService=require(_0x6709('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6709('0x15'));var logger=require('../../config/logger')(_0x6709('0x16'));var utils=require(_0x6709('0x17'));var config=require(_0x6709('0x18'));var licenseUtil=require(_0x6709('0x19'));var db=require(_0x6709('0x1a'))['db'];function respondWithStatusCode(_0x1e2a6c,_0x3bc73a){_0x3bc73a=_0x3bc73a||0xcc;return function(_0x3b9344){if(_0x3b9344){return _0x1e2a6c[_0x6709('0x1b')](_0x3bc73a);}return _0x1e2a6c[_0x6709('0x1c')](_0x3bc73a)['end']();};}function respondWithResult(_0x295be2,_0x411378){_0x411378=_0x411378||0xc8;return function(_0x2b1bd3){if(_0x2b1bd3){return _0x295be2[_0x6709('0x1c')](_0x411378)[_0x6709('0x1d')](_0x2b1bd3);}};}function respondWithFilteredResult(_0x181601,_0x5e603d){return function(_0x114636){if(_0x114636){var _0x55342d=typeof _0x5e603d[_0x6709('0x1e')]==='undefined'&&typeof _0x5e603d[_0x6709('0x1f')]==='undefined';var _0x163bb9=_0x114636[_0x6709('0x20')];var _0x4b6698=_0x55342d?0x0:_0x5e603d[_0x6709('0x1e')];var _0x46cd6f=_0x55342d?_0x114636[_0x6709('0x20')]:_0x5e603d[_0x6709('0x1e')]+_0x5e603d[_0x6709('0x1f')];var _0x24a6a2;if(_0x46cd6f>=_0x163bb9){_0x46cd6f=_0x163bb9;_0x24a6a2=0xc8;}else{_0x24a6a2=0xce;}_0x181601[_0x6709('0x1c')](_0x24a6a2);return _0x181601[_0x6709('0x21')](_0x6709('0x22'),_0x4b6698+'-'+_0x46cd6f+'/'+_0x163bb9)[_0x6709('0x1d')](_0x114636);}return null;};}function patchUpdates(_0x35eec6){return function(_0x1b55f7){try{jsonpatch[_0x6709('0x23')](_0x1b55f7,_0x35eec6,!![]);}catch(_0x3d7539){return BPromise[_0x6709('0x24')](_0x3d7539);}return _0x1b55f7[_0x6709('0x25')]();};}function saveUpdates(_0xdbef24,_0x2a1f2e){return function(_0x24705c){if(_0x24705c){return _0x24705c[_0x6709('0x26')](_0xdbef24)[_0x6709('0x27')](function(_0x2e630c){return _0x2e630c;});}return null;};}function removeEntity(_0x35596e,_0x9d1daf){return function(_0x46bf18){if(_0x46bf18){return _0x46bf18[_0x6709('0x28')]()[_0x6709('0x27')](function(){_0x35596e[_0x6709('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc388,_0x54ac9d){return function(_0x5220af){if(!_0x5220af){_0x2cc388[_0x6709('0x1b')](0x194);}return _0x5220af;};}function handleError(_0x403462,_0x1130e5){_0x1130e5=_0x1130e5||0x1f4;return function(_0x641835){logger[_0x6709('0x29')](_0x641835[_0x6709('0x2a')]);if(_0x641835[_0x6709('0x2b')]){delete _0x641835[_0x6709('0x2b')];}_0x403462[_0x6709('0x1c')](_0x1130e5)[_0x6709('0x2c')](_0x641835);};}exports[_0x6709('0x2d')]=function(_0x2c6d4f,_0x2c7761){var _0x43fdce={},_0x403725={},_0x172f3f={'count':0x0,'rows':[]};var _0x1de9ae=_[_0x6709('0x2e')](db[_0x6709('0x2f')]['rawAttributes'],function(_0x4638ca){return{'name':_0x4638ca['fieldName'],'type':_0x4638ca[_0x6709('0x30')]['key']};});_0x403725[_0x6709('0x31')]=_['map'](_0x1de9ae,_0x6709('0x2b'));_0x403725['query']=_[_0x6709('0x32')](_0x2c6d4f[_0x6709('0x33')]);_0x403725['filters']=_[_0x6709('0x34')](_0x403725[_0x6709('0x31')],_0x403725[_0x6709('0x33')]);_0x43fdce[_0x6709('0x35')]=_[_0x6709('0x34')](_0x403725['model'],qs[_0x6709('0x36')](_0x2c6d4f['query']['fields']));_0x43fdce['attributes']=_0x43fdce[_0x6709('0x35')][_0x6709('0x37')]?_0x43fdce[_0x6709('0x35')]:_0x403725['model'];if(!_0x2c6d4f[_0x6709('0x33')]['hasOwnProperty'](_0x6709('0x38'))){_0x43fdce[_0x6709('0x1f')]=qs[_0x6709('0x1f')](_0x2c6d4f['query'][_0x6709('0x1f')]);_0x43fdce[_0x6709('0x1e')]=qs[_0x6709('0x1e')](_0x2c6d4f['query'][_0x6709('0x1e')]);}_0x43fdce[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x2c6d4f[_0x6709('0x33')][_0x6709('0x3a')]);_0x43fdce[_0x6709('0x3b')]=qs[_0x6709('0x3c')](_[_0x6709('0x3d')](_0x2c6d4f[_0x6709('0x33')],_0x403725['filters']),_0x1de9ae);if(_0x2c6d4f['query'][_0x6709('0x3e')]){_0x43fdce[_0x6709('0x3b')]=_['merge'](_0x43fdce[_0x6709('0x3b')],{'$or':_[_0x6709('0x2e')](_0x1de9ae,function(_0x339ba4){if(_0x339ba4[_0x6709('0x30')]!==_0x6709('0x3f')){var _0x300dda={};_0x300dda[_0x339ba4['name']]={'$like':'%'+_0x2c6d4f[_0x6709('0x33')]['filter']+'%'};return _0x300dda;}})});}_0x43fdce=_[_0x6709('0x40')]({},_0x43fdce,_0x2c6d4f[_0x6709('0x41')]);var _0x3fe850={'where':_0x43fdce[_0x6709('0x3b')]};return db['FaxApplication'][_0x6709('0x20')](_0x3fe850)[_0x6709('0x27')](function(_0x504f81){_0x172f3f[_0x6709('0x20')]=_0x504f81;if(_0x2c6d4f[_0x6709('0x33')][_0x6709('0x42')]){_0x43fdce[_0x6709('0x43')]=[{'all':!![]}];}return db[_0x6709('0x2f')][_0x6709('0x44')](_0x43fdce);})[_0x6709('0x27')](function(_0x34d803){_0x172f3f['rows']=_0x34d803;return _0x172f3f;})['then'](respondWithFilteredResult(_0x2c7761,_0x43fdce))[_0x6709('0x45')](handleError(_0x2c7761,null));};exports[_0x6709('0x46')]=function(_0x1cef8d,_0x21ecba){var _0x4f0ef8={'raw':!![],'where':{'id':_0x1cef8d[_0x6709('0x47')]['id']}},_0xdb32c8={};_0xdb32c8[_0x6709('0x31')]=_[_0x6709('0x32')](db[_0x6709('0x2f')][_0x6709('0x48')]);_0xdb32c8[_0x6709('0x33')]=_[_0x6709('0x32')](_0x1cef8d[_0x6709('0x33')]);_0xdb32c8[_0x6709('0x3c')]=_[_0x6709('0x34')](_0xdb32c8[_0x6709('0x31')],_0xdb32c8[_0x6709('0x33')]);_0x4f0ef8[_0x6709('0x35')]=_[_0x6709('0x34')](_0xdb32c8[_0x6709('0x31')],qs['fields'](_0x1cef8d[_0x6709('0x33')][_0x6709('0x36')]));_0x4f0ef8['attributes']=_0x4f0ef8['attributes'][_0x6709('0x37')]?_0x4f0ef8['attributes']:_0xdb32c8[_0x6709('0x31')];if(_0x1cef8d['query'][_0x6709('0x42')]){_0x4f0ef8[_0x6709('0x43')]=[{'all':!![]}];}_0x4f0ef8=_['merge']({},_0x4f0ef8,_0x1cef8d[_0x6709('0x41')]);return db[_0x6709('0x2f')][_0x6709('0x49')](_0x4f0ef8)[_0x6709('0x27')](handleEntityNotFound(_0x21ecba,null))[_0x6709('0x27')](respondWithResult(_0x21ecba,null))[_0x6709('0x45')](handleError(_0x21ecba,null));};exports['create']=function(_0xc9f785,_0x25b345){return db[_0x6709('0x2f')][_0x6709('0x4a')](_0xc9f785[_0x6709('0x4b')],{})[_0x6709('0x27')](respondWithResult(_0x25b345,0xc9))[_0x6709('0x45')](handleError(_0x25b345,null));};exports[_0x6709('0x26')]=function(_0x2cd49b,_0x5dba57){if(_0x2cd49b[_0x6709('0x4b')]['id']){delete _0x2cd49b[_0x6709('0x4b')]['id'];}return db[_0x6709('0x2f')][_0x6709('0x49')]({'where':{'id':_0x2cd49b['params']['id']}})['then'](handleEntityNotFound(_0x5dba57,null))['then'](saveUpdates(_0x2cd49b[_0x6709('0x4b')],null))[_0x6709('0x27')](respondWithResult(_0x5dba57,null))[_0x6709('0x45')](handleError(_0x5dba57,null));};exports[_0x6709('0x28')]=function(_0x169343,_0x2d1eb2){return db[_0x6709('0x2f')]['find']({'where':{'id':_0x169343[_0x6709('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d1eb2,null))['then'](removeEntity(_0x2d1eb2,null))[_0x6709('0x45')](handleError(_0x2d1eb2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e71f375..ccdab81 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 _0xe73b=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes'];(function(_0x371f13,_0x3e89fc){var _0x50b54b=function(_0x1b902e){while(--_0x1b902e){_0x371f13['push'](_0x371f13['shift']());}};_0x50b54b(++_0x3e89fc);}(_0xe73b,0x1c0));var _0xbe73=function(_0x520e16,_0x545cb6){_0x520e16=_0x520e16-0x0;var _0x4771b5=_0xe73b[_0x520e16];return _0x4771b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe73('0x0'))('api');var moment=require(_0xbe73('0x1'));var BPromise=require(_0xbe73('0x2'));var rp=require(_0xbe73('0x3'));var fs=require('fs');var path=require(_0xbe73('0x4'));var rimraf=require(_0xbe73('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe73('0x6'));module[_0xbe73('0x7')]=function(_0x3a3003,_0x1fe1c8){return _0x3a3003[_0xbe73('0x8')](_0xbe73('0x9'),attributes,{'tableName':_0xbe73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe73('0xb'),'collate':_0xbe73('0xc')});}; \ No newline at end of file +var _0xfa31=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2d2d37,_0x5778a6){var _0x55bbce=function(_0x319445){while(--_0x319445){_0x2d2d37['push'](_0x2d2d37['shift']());}};_0x55bbce(++_0x5778a6);}(_0xfa31,0x17e));var _0x1fa3=function(_0x30be00,_0x3c156d){_0x30be00=_0x30be00-0x0;var _0x33b3e9=_0xfa31[_0x30be00];return _0x33b3e9;};'use strict';var _=require(_0x1fa3('0x0'));var util=require(_0x1fa3('0x1'));var logger=require(_0x1fa3('0x2'))(_0x1fa3('0x3'));var moment=require(_0x1fa3('0x4'));var BPromise=require(_0x1fa3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fa3('0x6'));var rimraf=require(_0x1fa3('0x7'));var config=require(_0x1fa3('0x8'));var attributes=require(_0x1fa3('0x9'));module[_0x1fa3('0xa')]=function(_0x50941a,_0x3bcbdc){return _0x50941a[_0x1fa3('0xb')](_0x1fa3('0xc'),attributes,{'tableName':_0x1fa3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1fa3('0xe'),'collate':_0x1fa3('0xf')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e8593e5..0793f4a 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 _0x3b70=['info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4e14ea,_0x564c20){var _0x50c3cf=function(_0x20edb2){while(--_0x20edb2){_0x4e14ea['push'](_0x4e14ea['shift']());}};_0x50c3cf(++_0x564c20);}(_0x3b70,0x13c));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x03b7('0x0'));var util=require(_0x03b7('0x1'));var moment=require(_0x03b7('0x2'));var BPromise=require(_0x03b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03b7('0x5'));var logger=require(_0x03b7('0x6'))(_0x03b7('0x7'));var config=require(_0x03b7('0x8'));var jayson=require(_0x03b7('0x9'));var client=jayson[_0x03b7('0xa')][_0x03b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfaec4d,_0x57edea,_0x44c2c1){return new BPromise(function(_0x2b423a,_0x335a1c){return client[_0x03b7('0xc')](_0xfaec4d,_0x44c2c1)[_0x03b7('0xd')](function(_0x5acb4e){logger[_0x03b7('0xe')]('FaxApplication,\x20%s,\x20%s',_0x57edea,_0x03b7('0xf'));logger[_0x03b7('0x10')](_0x03b7('0x11'),_0x57edea,_0x03b7('0xf'),JSON[_0x03b7('0x12')](_0x5acb4e));if(_0x5acb4e[_0x03b7('0x13')]){if(_0x5acb4e[_0x03b7('0x13')][_0x03b7('0x14')]===0x1f4){logger[_0x03b7('0x13')](_0x03b7('0x15'),_0x57edea,_0x5acb4e['error']['message']);return _0x335a1c(_0x5acb4e['error']['message']);}logger['error'](_0x03b7('0x15'),_0x57edea,_0x5acb4e['error']['message']);return _0x2b423a(_0x5acb4e[_0x03b7('0x13')][_0x03b7('0x16')]);}else{logger[_0x03b7('0xe')](_0x03b7('0x15'),_0x57edea,_0x03b7('0xf'));_0x2b423a(_0x5acb4e['result']['message']);}})[_0x03b7('0x17')](function(_0x3de96f){logger['error'](_0x03b7('0x15'),_0x57edea,_0x3de96f);_0x335a1c(_0x3de96f);});});}exports['UpdateFaxApplication']=function(_0x18b56f){var _0x2c5031=this;return new Promise(function(_0xbadb2a,_0x12f644){return db[_0x03b7('0x18')][_0x03b7('0x19')](_0x18b56f[_0x03b7('0x1a')],{'raw':_0x18b56f[_0x03b7('0x1b')]?_0x18b56f[_0x03b7('0x1b')][_0x03b7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b56f['options']?_0x18b56f['options'][_0x03b7('0x1d')]||null:null,'attributes':_0x18b56f[_0x03b7('0x1b')]?_0x18b56f[_0x03b7('0x1b')][_0x03b7('0x1e')]||null:null,'limit':_0x18b56f['options']?_0x18b56f[_0x03b7('0x1b')][_0x03b7('0x1f')]||null:null})[_0x03b7('0xd')](function(_0x575474){logger[_0x03b7('0xe')]('UpdateFaxApplication',_0x18b56f);logger[_0x03b7('0x10')](_0x03b7('0x20'),_0x18b56f,JSON[_0x03b7('0x12')](_0x575474));_0xbadb2a(_0x575474);})[_0x03b7('0x17')](function(_0x3dd6d4){logger[_0x03b7('0x13')]('UpdateFaxApplication',_0x3dd6d4[_0x03b7('0x16')],_0x18b56f);_0x12f644(_0x2c5031[_0x03b7('0x13')](0x1f4,_0x3dd6d4[_0x03b7('0x16')]));});});}; \ No newline at end of file +var _0xf9f4=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xf9f4,0x1be));var _0x4f9f=function(_0x1b141d,_0x3cf3e5){_0x1b141d=_0x1b141d-0x0;var _0x3eff55=_0xf9f4[_0x1b141d];return _0x3eff55;};'use strict';var _=require(_0x4f9f('0x0'));var util=require(_0x4f9f('0x1'));var moment=require(_0x4f9f('0x2'));var BPromise=require(_0x4f9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f9f('0x5'));var logger=require(_0x4f9f('0x6'))('rpc');var config=require(_0x4f9f('0x7'));var jayson=require(_0x4f9f('0x8'));var client=jayson[_0x4f9f('0x9')][_0x4f9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ffa30,_0x4695a4,_0x3443be){return new BPromise(function(_0x95c0a7,_0x538b2a){return client[_0x4f9f('0xb')](_0x3ffa30,_0x3443be)[_0x4f9f('0xc')](function(_0x21aac2){logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,'request\x20sent');logger[_0x4f9f('0xf')](_0x4f9f('0x10'),_0x4695a4,_0x4f9f('0x11'),JSON['stringify'](_0x21aac2));if(_0x21aac2[_0x4f9f('0x12')]){if(_0x21aac2[_0x4f9f('0x12')]['code']===0x1f4){logger[_0x4f9f('0x12')]('FaxApplication,\x20%s,\x20%s',_0x4695a4,_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);return _0x538b2a(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x21aac2['error'][_0x4f9f('0x13')]);return _0x95c0a7(_0x21aac2[_0x4f9f('0x12')][_0x4f9f('0x13')]);}else{logger[_0x4f9f('0xd')](_0x4f9f('0xe'),_0x4695a4,_0x4f9f('0x11'));_0x95c0a7(_0x21aac2[_0x4f9f('0x14')][_0x4f9f('0x13')]);}})[_0x4f9f('0x15')](function(_0x4cf8b2){logger[_0x4f9f('0x12')](_0x4f9f('0xe'),_0x4695a4,_0x4cf8b2);_0x538b2a(_0x4cf8b2);});});}exports[_0x4f9f('0x16')]=function(_0x537097){var _0x1b9538=this;return new Promise(function(_0x5b1f43,_0x516ffc){return db[_0x4f9f('0x17')][_0x4f9f('0x18')](_0x537097[_0x4f9f('0x19')],{'raw':_0x537097[_0x4f9f('0x1a')]?_0x537097[_0x4f9f('0x1a')][_0x4f9f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537097['options']?_0x537097[_0x4f9f('0x1a')][_0x4f9f('0x1c')]||null:null,'attributes':_0x537097[_0x4f9f('0x1a')]?_0x537097[_0x4f9f('0x1a')][_0x4f9f('0x1d')]||null:null,'limit':_0x537097[_0x4f9f('0x1a')]?_0x537097[_0x4f9f('0x1a')][_0x4f9f('0x1e')]||null:null})[_0x4f9f('0xc')](function(_0x2f04d2){logger[_0x4f9f('0xd')](_0x4f9f('0x16'),_0x537097);logger['debug'](_0x4f9f('0x16'),_0x537097,JSON[_0x4f9f('0x1f')](_0x2f04d2));_0x5b1f43(_0x2f04d2);})[_0x4f9f('0x15')](function(_0x34df85){logger[_0x4f9f('0x12')](_0x4f9f('0x16'),_0x34df85[_0x4f9f('0x13')],_0x537097);_0x516ffc(_0x1b9538[_0x4f9f('0x12')](0x1f4,_0x34df85[_0x4f9f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3c824bc..f02d8f3 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 _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x210f07,_0x9468bd){_0x210f07=_0x210f07-0x0;var _0x92a15f=_0xd7d1[_0x210f07];return _0x92a15f;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x399c07,_0x612c2){var _0xeed581=function(_0x16f740){while(--_0x16f740){_0x399c07['push'](_0x399c07['shift']());}};_0xeed581(++_0x612c2);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index dad7a73..cbc3ce2 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 _0xc252=['BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xc252,0xf5));var _0x2c25=function(_0x3d279d,_0x21718b){_0x3d279d=_0x3d279d-0x0;var _0x5f4d3d=_0xc252[_0x3d279d];return _0x5f4d3d;};'use strict';var Sequelize=require(_0x2c25('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2c25('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2c25('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2c25('0x3')]},'note':{'type':Sequelize[_0x2c25('0x3')]},'read1stAt':{'type':Sequelize[_0x2c25('0x2')]},'fax':{'type':Sequelize[_0x2c25('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2c25('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2c25('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2c25('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x879f=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x270aa8,_0x2b1de1){var _0x1675ab=function(_0x1693d4){while(--_0x1693d4){_0x270aa8['push'](_0x270aa8['shift']());}};_0x1675ab(++_0x2b1de1);}(_0x879f,0x17b));var _0xf879=function(_0x1238d8,_0xecccc0){_0x1238d8=_0x1238d8-0x0;var _0x30fb47=_0x879f[_0x1238d8];return _0x30fb47;};'use strict';var Sequelize=require(_0xf879('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf879('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf879('0x2')]},'disposition':{'type':Sequelize[_0xf879('0x3')]},'secondDisposition':{'type':Sequelize[_0xf879('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf879('0x3')]},'note':{'type':Sequelize[_0xf879('0x3')]},'read1stAt':{'type':Sequelize[_0xf879('0x2')]},'fax':{'type':Sequelize[_0xf879('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf879('0x4')]('in',_0xf879('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf879('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a68a61c..659507e 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 _0xbe21=['attachments','Attachment','Messages','get','join','basename','existsSync','pipe','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','send','map','fullname','Tags','TagIds','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','FaxInteraction','rawAttributes','fieldName','key','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','type','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','count','keyBy','merge','a.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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','body','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','removeTags','download','unix','root','tmp','files'];(function(_0x12826e,_0x139980){var _0x1f3722=function(_0xa794c){while(--_0xa794c){_0x12826e['push'](_0x12826e['shift']());}};_0x1f3722(++_0x139980);}(_0xbe21,0x1b6));var _0x1be2=function(_0x5831a3,_0x4463b7){_0x5831a3=_0x5831a3-0x0;var _0x198912=_0xbe21[_0x5831a3];return _0x198912;};'use strict';var emlformat=require(_0x1be2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1be2('0x1'));var jsonpatch=require(_0x1be2('0x2'));var rp=require(_0x1be2('0x3'));var moment=require('moment');var BPromise=require(_0x1be2('0x4'));var Mustache=require(_0x1be2('0x5'));var util=require('util');var path=require(_0x1be2('0x6'));var sox=require(_0x1be2('0x7'));var csv=require(_0x1be2('0x8'));var ejs=require(_0x1be2('0x9'));var fs=require('fs');var fs_extra=require(_0x1be2('0xa'));var _=require(_0x1be2('0xb'));var squel=require(_0x1be2('0xc'));var crypto=require('crypto');var jsforce=require(_0x1be2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1be2('0x8'));var querystring=require(_0x1be2('0xe'));var Papa=require(_0x1be2('0xf'));var Redis=require(_0x1be2('0x10'));var authService=require(_0x1be2('0x11'));var qs=require(_0x1be2('0x12'));var as=require(_0x1be2('0x13'));var hardwareService=require(_0x1be2('0x14'));var logger=require(_0x1be2('0x15'))(_0x1be2('0x16'));var utils=require('../../config/utils');var config=require(_0x1be2('0x17'));var licenseUtil=require(_0x1be2('0x18'));var db=require(_0x1be2('0x19'))['db'];config['redis']=_['defaults'](config[_0x1be2('0x1a')],{'host':_0x1be2('0x1b'),'port':0x18eb});var socket=require(_0x1be2('0x1c'))(new Redis(config[_0x1be2('0x1a')]));require('./faxInteraction.socket')[_0x1be2('0x1d')](socket);function respondWithStatusCode(_0xaff823,_0x51a12e){_0x51a12e=_0x51a12e||0xcc;return function(_0x2ac249){if(_0x2ac249){return _0xaff823[_0x1be2('0x1e')](_0x51a12e);}return _0xaff823[_0x1be2('0x1f')](_0x51a12e)[_0x1be2('0x20')]();};}function respondWithResult(_0x40b396,_0x920929){_0x920929=_0x920929||0xc8;return function(_0x54cbda){if(_0x54cbda){return _0x40b396[_0x1be2('0x1f')](_0x920929)[_0x1be2('0x21')](_0x54cbda);}};}function respondWithFilteredResult(_0x4b07db,_0x59b67a){return function(_0x27015d){if(_0x27015d){var _0x239bd8=typeof _0x59b67a[_0x1be2('0x22')]===_0x1be2('0x23')&&typeof _0x59b67a[_0x1be2('0x24')]===_0x1be2('0x23');var _0x301bca=_0x27015d['count'];var _0x3a6025=_0x239bd8?0x0:_0x59b67a[_0x1be2('0x22')];var _0x33dd75=_0x239bd8?_0x27015d['count']:_0x59b67a[_0x1be2('0x22')]+_0x59b67a[_0x1be2('0x24')];var _0x4f4e99;if(_0x33dd75>=_0x301bca){_0x33dd75=_0x301bca;_0x4f4e99=0xc8;}else{_0x4f4e99=0xce;}_0x4b07db['status'](_0x4f4e99);return _0x4b07db[_0x1be2('0x25')]('Content-Range',_0x3a6025+'-'+_0x33dd75+'/'+_0x301bca)[_0x1be2('0x21')](_0x27015d);}return null;};}function patchUpdates(_0x48bb56){return function(_0x454f07){try{jsonpatch[_0x1be2('0x26')](_0x454f07,_0x48bb56,!![]);}catch(_0x13ab19){return BPromise[_0x1be2('0x27')](_0x13ab19);}return _0x454f07[_0x1be2('0x28')]();};}function saveUpdates(_0x112814,_0x5b4889){return function(_0x3492b4){if(_0x3492b4){return _0x3492b4[_0x1be2('0x29')](_0x112814)[_0x1be2('0x2a')](function(_0x5693cd){return _0x5693cd;});}return null;};}function removeEntity(_0x491709,_0x1cf2b8){return function(_0x581b44){if(_0x581b44){return _0x581b44['destroy']()[_0x1be2('0x2a')](function(){_0x491709[_0x1be2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e99c,_0x5b6e04){return function(_0x1159df){if(!_0x1159df){_0x48e99c['sendStatus'](0x194);}return _0x1159df;};}function handleError(_0x3a60d4,_0x46c6b7){_0x46c6b7=_0x46c6b7||0x1f4;return function(_0x20174f){logger[_0x1be2('0x2b')](_0x20174f['stack']);if(_0x20174f['name']){delete _0x20174f['name'];}_0x3a60d4[_0x1be2('0x1f')](_0x46c6b7)[_0x1be2('0x2c')](_0x20174f);};}function getInteractionUsers(_0x5ba3ce,_0x4672fa){return new BPromise(function(_0x25addb,_0x2ba72e){try{if(_0x4672fa[_0x5ba3ce['id']]){_0x5ba3ce['Users']=_[_0x1be2('0x2d')](_0x4672fa[_0x5ba3ce['id']],function(_0x5e9b80){return{'id':_0x5e9b80['id'],'fullname':_0x5e9b80[_0x1be2('0x2e')]};});}}catch(_0x31bc1d){_0x2ba72e(_0x31bc1d);}_0x25addb(_0x5ba3ce);});}function getInteractionTags(_0x2399f1,_0x56be2d){return new BPromise(function(_0x39b88f,_0xe3ca75){try{if(_0x2399f1['TagIds']){_0x2399f1[_0x1be2('0x2f')]=[];_0x2399f1[_0x1be2('0x30')]['split'](',')[_0x1be2('0x31')](function(_0xe9e51a){_0x2399f1['Tags'][_0x1be2('0x32')](_0x56be2d[_0xe9e51a]);});}delete _0x2399f1['TagIds'];}catch(_0x15f9f0){_0xe3ca75(_0x15f9f0);}_0x39b88f(_0x2399f1);});}function updateFaxInteraction(_0x52ebc9,_0x492bc6,_0x29c2e8){return new BPromise(function(_0xc756f3,_0x483731){return getInteractionUsers(_0x52ebc9,_0x29c2e8)['then'](function(_0x3051b4){return getInteractionTags(_0x3051b4,_0x492bc6);})[_0x1be2('0x2a')](function(_0x424bbf){return getStateInteraction(_0x424bbf);})['then'](function(_0xd22c6e){_0xc756f3(_0xd22c6e);})[_0x1be2('0x33')](function(_0x5ea9c3){_0x483731(_0x5ea9c3);});});}function getStateInteraction(_0x1fbd5d){return new BPromise(function(_0x3df072){_0x1fbd5d[_0x1be2('0x34')]=0x0;_0x1fbd5d[_0x1be2('0x35')]=0x0;_0x1fbd5d['answered']=0x0;_0x1fbd5d[_0x1be2('0x36')]=0x0;_0x1fbd5d[_0x1be2('0x37')]=0x0;if(!_0x1fbd5d[_0x1be2('0x38')]&&!_0x1fbd5d[_0x1be2('0x39')]){_0x1fbd5d[_0x1be2('0x34')]+=0x1;}if(!_0x1fbd5d[_0x1be2('0x38')]&&_0x1fbd5d[_0x1be2('0x39')]){_0x1fbd5d[_0x1be2('0x35')]+=0x1;if(_0x1fbd5d[_0x1be2('0x34')]){_0x1fbd5d[_0x1be2('0x34')]-=0x1;}}if(_0x1fbd5d[_0x1be2('0x38')]&&_0x1fbd5d[_0x1be2('0x39')]){_0x1fbd5d[_0x1be2('0x3a')]+=0x1;if(_0x1fbd5d[_0x1be2('0x35')]){_0x1fbd5d[_0x1be2('0x35')]-=0x1;}}if(_0x1fbd5d[_0x1be2('0x38')]&&!_0x1fbd5d[_0x1be2('0x39')]){_0x1fbd5d[_0x1be2('0x36')]+=0x1;if(_0x1fbd5d[_0x1be2('0x34')]){_0x1fbd5d[_0x1be2('0x34')]-=0x1;}}_0x1fbd5d[_0x1be2('0x37')]+=0x1;_0x3df072(_0x1fbd5d);});}exports['index']=function(_0x5bb269,_0x12ed94){var _0x1877db={},_0x58ad75={},_0x47a846={'count':0x0,'rows':[]};var _0x5e0a5b=_[_0x1be2('0x2d')](db[_0x1be2('0x3b')][_0x1be2('0x3c')],function(_0x35a26d){return{'name':_0x35a26d[_0x1be2('0x3d')],'type':_0x35a26d['type'][_0x1be2('0x3e')]};});_0x58ad75[_0x1be2('0x3f')]=_[_0x1be2('0x2d')](_0x5e0a5b,_0x1be2('0x40'));_0x58ad75['query']=_[_0x1be2('0x41')](_0x5bb269[_0x1be2('0x42')]);_0x58ad75['filters']=_[_0x1be2('0x43')](_0x58ad75[_0x1be2('0x3f')],_0x58ad75[_0x1be2('0x42')]);_0x1877db['attributes']=_[_0x1be2('0x43')](_0x58ad75[_0x1be2('0x3f')],qs['fields'](_0x5bb269[_0x1be2('0x42')][_0x1be2('0x44')]));_0x1877db[_0x1be2('0x45')]=_0x1877db[_0x1be2('0x45')][_0x1be2('0x46')]?_0x1877db[_0x1be2('0x45')]:_0x58ad75['model'];if(!_0x5bb269[_0x1be2('0x42')][_0x1be2('0x47')](_0x1be2('0x48'))){_0x1877db[_0x1be2('0x24')]=qs[_0x1be2('0x24')](_0x5bb269[_0x1be2('0x42')][_0x1be2('0x24')]);_0x1877db['offset']=qs[_0x1be2('0x22')](_0x5bb269[_0x1be2('0x42')][_0x1be2('0x22')]);}_0x1877db['order']=qs[_0x1be2('0x49')](_0x5bb269['query'][_0x1be2('0x49')]);_0x1877db['where']=qs[_0x1be2('0x4a')](_['pick'](_0x5bb269[_0x1be2('0x42')],_0x58ad75['filters']),_0x5e0a5b);var _0x391aa4=[];var _0x163ff5=squel[_0x1be2('0x4b')]()[_0x1be2('0x4c')]('id')['field']('name')[_0x1be2('0x4c')](_0x1be2('0x4d'))[_0x1be2('0x4e')](_0x1be2('0x4f'));var _0x1902a7=squel['select']()[_0x1be2('0x4c')](_0x1be2('0x50'))['field'](_0x1be2('0x51'))[_0x1be2('0x4c')](_0x1be2('0x52'))[_0x1be2('0x4e')](_0x1be2('0x53'),'ui')[_0x1be2('0x54')](_0x1be2('0x55'),'u',_0x1be2('0x56'));var _0x59f9b6=squel['select']()[_0x1be2('0x4e')](_0x1be2('0x57'),'i')['left_join'](_0x1be2('0x58'),'c',_0x1be2('0x59'))['left_join'](_0x1be2('0x55'),'o',_0x1be2('0x5a'))[_0x1be2('0x54')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x1be2('0x5b'),'me',_0x1be2('0x5c'))[_0x1be2('0x54')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x1be2('0x54')](_0x1be2('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x19d264=squel[_0x1be2('0x5d')]();var _0x5f0dc1=[];var _0x3c0a4a=squel[_0x1be2('0x5d')]();var _0x1c776c;if(_0x5bb269[_0x1be2('0x42')][_0x1be2('0x5e')]){_0x1c776c=as[_0x1be2('0x5f')](_0x5bb269[_0x1be2('0x42')][_0x1be2('0x5e')]);var _0x25a80b=_0x1c776c['sqlOperator'];for(var _0x13f93b=0x0;_0x13f93b<_0x1c776c[_0x1be2('0x60')][_0x1be2('0x46')];_0x13f93b++){var _0x4ec0ee=_0x1c776c[_0x1be2('0x60')][_0x13f93b];var _0x42267f='i';var _0x36e7aa=_[_0x1be2('0x61')](_0x5e0a5b,[_0x1be2('0x40'),_0x4ec0ee[_0x1be2('0x4c')]]);if(!_0x36e7aa){switch(_0x4ec0ee[_0x1be2('0x4c')]){case _0x1be2('0x62'):if(_0x4ec0ee[_0x1be2('0x63')]==0x1){_0x59f9b6['having']('`'+_0x4ec0ee[_0x1be2('0x4c')]+_0x1be2('0x64'));}else{_0x59f9b6[_0x1be2('0x65')]('`'+_0x4ec0ee[_0x1be2('0x4c')]+_0x1be2('0x66'));}break;case _0x1be2('0x67'):if(_0x4ec0ee[_0x1be2('0x68')]===_0x1be2('0x69')){if(_0x4ec0ee[_0x1be2('0x63')]['split']('\x20')[_0x1be2('0x46')]>0x1){_0x19d264[_0x25a80b](_0x1be2('0x6a'),qs['getFullTextValue'](_0x4ec0ee[_0x1be2('0x63')]),null);}else{var _0xa4637d='%'+_0x4ec0ee[_0x1be2('0x63')]+'%';_0x19d264[_0x25a80b](_0x1be2('0x6b'),_0xa4637d,_0xa4637d,_0xa4637d);}}else{_0x36e7aa=_[_0x1be2('0x61')](_0x5e0a5b,[_0x1be2('0x40'),_0x1be2('0x6c')]);_0x4ec0ee[_0x1be2('0x4c')]=_0x1be2('0x6c');_0x5ef13f=as['buildExpression'](_0x42267f,_0x36e7aa['type'],_0x4ec0ee);_0x19d264[_0x25a80b](_0x5ef13f[_0x1be2('0x6d')],_0x5ef13f[_0x1be2('0x63')]['start'],_0x5ef13f[_0x1be2('0x63')][_0x1be2('0x20')]);}break;case _0x1be2('0x6e'):var _0x6db990=_0x4ec0ee[_0x1be2('0x63')][_0x1be2('0x6f')](',')['map'](function(_0x212cb8){return Number(_0x212cb8);});_0x6db990['forEach'](function(_0x1e4cb2){_0x3c0a4a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1e4cb2+',%');});_0x5f0dc1=_[_0x1be2('0x70')](_0x5f0dc1,_0x6db990);break;case _0x1be2('0x71'):if(_0x4ec0ee[_0x1be2('0x68')]===_0x1be2('0x69')){_0x19d264[_0x25a80b](_0x1be2('0x72'),'%'+_0x4ec0ee[_0x1be2('0x63')]+'%',null);}else{_0x36e7aa=_[_0x1be2('0x61')](_0x5e0a5b,[_0x1be2('0x40'),'UserId']);_0x4ec0ee[_0x1be2('0x4c')]=_0x1be2('0x39');_0x5ef13f=as['buildExpression'](_0x42267f,_0x36e7aa['type'],_0x4ec0ee);_0x19d264[_0x25a80b](_0x5ef13f['text'],_0x5ef13f[_0x1be2('0x63')]['start'],_0x5ef13f[_0x1be2('0x63')][_0x1be2('0x20')]);}break;case'body':_0x5ef13f=as['buildExpression']('me',null,_0x4ec0ee);_0x19d264[_0x25a80b](_0x5ef13f[_0x1be2('0x6d')],_0x5ef13f[_0x1be2('0x63')]['start'],_0x5ef13f[_0x1be2('0x63')][_0x1be2('0x20')]);break;}}else{var _0x5ef13f=as[_0x1be2('0x73')](_0x42267f,_0x36e7aa[_0x1be2('0x74')],_0x4ec0ee);_0x19d264[_0x25a80b](_0x5ef13f[_0x1be2('0x6d')],_0x5ef13f[_0x1be2('0x63')]['start'],_0x5ef13f[_0x1be2('0x63')][_0x1be2('0x20')]);}}}else{var _0x17dd90=_(_0x5bb269[_0x1be2('0x42')])['keys']()['map'](function(_0x458340){return _[_0x1be2('0x75')](_0x5e0a5b,[_0x1be2('0x40'),_0x458340])?_0x458340:undefined;})[_0x1be2('0x76')]()[_0x1be2('0x63')]();if(!_[_0x1be2('0x77')](_0x17dd90)){_0x17dd90[_0x1be2('0x31')](function(_0x38829e){if(_0x38829e===_0x1be2('0x78')){_0x59f9b6[_0x1be2('0x79')](_0x1be2('0x7a'),[]['concat'](_0x5bb269[_0x1be2('0x42')][_0x38829e]));}else if(_0x38829e===_0x1be2('0x7b')){var _0x7a3a16=JSON[_0x1be2('0x7c')](_0x5bb269[_0x1be2('0x42')][_0x38829e])[_0x1be2('0x7d')];var _0x240907=JSON[_0x1be2('0x7c')](_0x5bb269[_0x1be2('0x42')][_0x38829e])[_0x1be2('0x7e')];_0x59f9b6[_0x1be2('0x79')](_0x1be2('0x7f'),_0x7a3a16,_0x240907);}else{if(_0x5bb269[_0x1be2('0x42')][_0x38829e]==='null'){_0x59f9b6[_0x1be2('0x79')]('i.'+_0x38829e+_0x1be2('0x80'));}else{_0x59f9b6['where']('i.'+_0x38829e+_0x1be2('0x81'),_0x5bb269[_0x1be2('0x42')][_0x38829e]);}}});}if(_0x5bb269['query']['read']){if(_0x5bb269[_0x1be2('0x42')][_0x1be2('0x82')]==0x1){_0x59f9b6[_0x1be2('0x65')]('`unreadMessages`\x20=\x200');}else{_0x59f9b6[_0x1be2('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x5bb269[_0x1be2('0x42')][_0x1be2('0x83')]){_0x5f0dc1=_[_0x1be2('0x84')](_0x5bb269[_0x1be2('0x42')]['tag'])?_0x5bb269['query'][_0x1be2('0x83')]:new Array(_0x5bb269['query'][_0x1be2('0x83')]);_0x5f0dc1[_0x1be2('0x31')](function(_0x595918){_0x3c0a4a['or'](_0x1be2('0x85'),'%,'+_0x595918+',%');});}if(_0x5bb269[_0x1be2('0x42')][_0x1be2('0x86')]){var _0x431881=_0x5bb269[_0x1be2('0x42')][_0x1be2('0x86')][_0x1be2('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1be2('0x88')](_0x431881)){_0x19d264['or'](_0x1be2('0x89'),_0x431881+'%')['or']('i.fax\x20LIKE\x20?',_0x431881+'%');}_0x19d264['or'](_0x1be2('0x8a'),_0x431881+'%');}}_0x59f9b6[_0x1be2('0x79')](_0x19d264);_0x59f9b6[_0x1be2('0x8b')](_0x1be2('0x8c'));var _0x1996e6={'type':db['Sequelize'][_0x1be2('0x8d')]['SELECT'],'raw':!![]};var _0x329611=_0x59f9b6[_0x1be2('0x8e')]();_0x329611[_0x1be2('0x4c')](_0x1be2('0x8c'));_0x329611[_0x1be2('0x4c')](_0x1be2('0x8f'),_0x1be2('0x62'));if(_0x1877db['order']){_0x1877db[_0x1be2('0x90')]['forEach'](function(_0x3d76cf){var _0x4c3b0d=_0x3d76cf[0x0]===_0x1be2('0x91')?_0x3d76cf[0x0]:'i.'+_0x3d76cf[0x0];_0x59f9b6[_0x1be2('0x90')](_0x4c3b0d,_0x3d76cf[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5f0dc1)){_0x59f9b6['having'](_0x3c0a4a);_0x329611[_0x1be2('0x79')](_0x1be2('0x92'),_0x5f0dc1);}BPromise[_0x1be2('0x93')]()[_0x1be2('0x2a')](function(){if(!_0x1c776c){if(_0x5bb269[_0x1be2('0x42')][_0x1be2('0x78')])return;_0x329611[_0x1be2('0x79')](_0x1be2('0x94'));_0x59f9b6[_0x1be2('0x79')](_0x1be2('0x94'));return;}if(_0x5bb269[_0x1be2('0x95')][_0x1be2('0x96')]!==_0x1be2('0x97'))return;return _0x5bb269[_0x1be2('0x95')][_0x1be2('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11981e){if(_[_0x1be2('0x77')](_0x11981e)){_0x329611[_0x1be2('0x79')](_0x1be2('0x99'));_0x59f9b6[_0x1be2('0x79')](_0x1be2('0x99'));}else{_0x329611[_0x1be2('0x79')](_0x1be2('0x7a'),_[_0x1be2('0x2d')](_0x11981e,'id'));_0x59f9b6[_0x1be2('0x79')](_0x1be2('0x7a'),_[_0x1be2('0x2d')](_0x11981e,'id'));}});})[_0x1be2('0x2a')](function(){if(_0x5bb269[_0x1be2('0x95')][_0x1be2('0x96')]===_0x1be2('0x97')&&!_0x1c776c&&!_0x5bb269[_0x1be2('0x42')][_0x1be2('0x78')])return[];return db[_0x1be2('0x9a')]['query'](_0x329611['toString'](),_0x1996e6);})[_0x1be2('0x2a')](function(_0x4f104c){_0x47a846[_0x1be2('0x9b')]=_0x4f104c[_0x1be2('0x46')];if(_0x47a846[_0x1be2('0x9b')]===0x0)return[];return db[_0x1be2('0x9a')][_0x1be2('0x42')](_0x163ff5['toString'](),_0x1996e6)[_0x1be2('0x2a')](function(_0x924d31){_0x391aa4=_[_0x1be2('0x9c')](_0x924d31,'id');_0x1996e6=_[_0x1be2('0x9d')](_0x1996e6,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5bb269[_0x1be2('0x42')]['fields']){_0x1877db[_0x1be2('0x45')][_0x1be2('0x31')](function(_0x4d5282){_0x59f9b6['field']('i.'+_0x4d5282);});}else{_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0x8f'),_0x1be2('0x62'));_0x59f9b6['field'](_0x1be2('0x9e'),'Account.key');_0x59f9b6[_0x1be2('0x4c')]('a.mandatoryDisposition',_0x1be2('0x9f'));_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xa0'),_0x1be2('0x91'));_0x59f9b6[_0x1be2('0x4c')]('i.*');_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xa1'),'Contact.firstName');_0x59f9b6['field'](_0x1be2('0xa2'),_0x1be2('0xa3'));_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xa4'),_0x1be2('0xa5'));_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xa6'),'Contact.phone');_0x59f9b6['field']('c.mobile',_0x1be2('0xa7'));_0x59f9b6[_0x1be2('0x4c')]('c.fax','Contact.fax');_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xa8'),_0x1be2('0xa9'));_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xaa'),_0x1be2('0xab'));_0x59f9b6[_0x1be2('0x4c')](_0x1be2('0xac'),_0x1be2('0x30'));}if(_0x1877db[_0x1be2('0x24')])_0x59f9b6[_0x1be2('0x24')](_0x1877db[_0x1be2('0x24')]);if(_0x1877db[_0x1be2('0x22')])_0x59f9b6['offset'](_0x1877db['offset']);return db[_0x1be2('0x9a')][_0x1be2('0x42')](_0x59f9b6[_0x1be2('0xad')](),_0x1996e6);})[_0x1be2('0x2a')](function(_0x25aa98){if(_0x25aa98[_0x1be2('0x46')]>0x0)_0x1902a7[_0x1be2('0x79')](_0x1be2('0xae'),_[_0x1be2('0x2d')](_0x25aa98,'id'));return db[_0x1be2('0x9a')][_0x1be2('0x42')](_0x1902a7['toString'](),_0x1996e6)[_0x1be2('0x2a')](function(_0x4012c2){var _0x3093d0=_[_0x1be2('0xaf')](_0x4012c2,'FaxInteractionId');var _0x45d9c4=[];_0x25aa98[_0x1be2('0x31')](function(_0x2261b4){_0x45d9c4[_0x1be2('0x32')](updateFaxInteraction(_0x2261b4,_0x391aa4,_0x3093d0));});return BPromise[_0x1be2('0xb0')](_0x45d9c4);});});})[_0x1be2('0x2a')](function(_0x2275f7){_0x47a846[_0x1be2('0xb1')]=_0x2275f7;return _0x47a846;})[_0x1be2('0x2a')](respondWithFilteredResult(_0x12ed94,_0x1877db))[_0x1be2('0x33')](handleError(_0x12ed94,null));};exports[_0x1be2('0xb2')]=function(_0x5133a4,_0xcb4827){var _0x1815b2={'raw':![],'where':{'id':_0x5133a4[_0x1be2('0xb3')]['id']}},_0x33eac8={};_0x33eac8[_0x1be2('0x3f')]=_[_0x1be2('0x41')](db[_0x1be2('0x3b')][_0x1be2('0x3c')]);_0x33eac8[_0x1be2('0x42')]=_[_0x1be2('0x41')](_0x5133a4['query']);_0x33eac8['filters']=_[_0x1be2('0x43')](_0x33eac8[_0x1be2('0x3f')],_0x33eac8[_0x1be2('0x42')]);_0x1815b2[_0x1be2('0x45')]=_['intersection'](_0x33eac8[_0x1be2('0x3f')],qs['fields'](_0x5133a4[_0x1be2('0x42')][_0x1be2('0x44')]));_0x1815b2[_0x1be2('0x45')]=_0x1815b2['attributes'][_0x1be2('0x46')]?_0x1815b2[_0x1be2('0x45')]:_0x33eac8[_0x1be2('0x3f')];if(_0x5133a4[_0x1be2('0x42')]['includeAll']){_0x1815b2[_0x1be2('0xb4')]=[{'all':!![]}];}_0x1815b2=_[_0x1be2('0x9d')]({},_0x1815b2,_0x5133a4[_0x1be2('0xb5')]);return db['FaxInteraction'][_0x1be2('0x61')](_0x1815b2)[_0x1be2('0x2a')](handleEntityNotFound(_0xcb4827,null))[_0x1be2('0x2a')](respondWithResult(_0xcb4827,null))[_0x1be2('0x33')](handleError(_0xcb4827,null));};exports[_0x1be2('0xb6')]=function(_0x39bbec,_0x2e9f9f){return db['FaxInteraction'][_0x1be2('0xb6')](_0x39bbec[_0x1be2('0xb7')],{})[_0x1be2('0x2a')](respondWithResult(_0x2e9f9f,0xc9))['catch'](handleError(_0x2e9f9f,null));};exports[_0x1be2('0x29')]=function(_0x39abd5,_0x407c44){if(_0x39abd5['body']['id']){delete _0x39abd5[_0x1be2('0xb7')]['id'];}return db[_0x1be2('0x3b')]['find']({'where':{'id':_0x39abd5['params']['id']}})[_0x1be2('0x2a')](handleEntityNotFound(_0x407c44,null))['then'](saveUpdates(_0x39abd5[_0x1be2('0xb7')],null))[_0x1be2('0x2a')](respondWithResult(_0x407c44,null))[_0x1be2('0x33')](handleError(_0x407c44,null));};exports[_0x1be2('0xb8')]=function(_0x44c725,_0x4f16c7){return db[_0x1be2('0x3b')][_0x1be2('0x61')]({'where':{'id':_0x44c725[_0x1be2('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4f16c7,null))[_0x1be2('0x2a')](removeEntity(_0x4f16c7,null))['catch'](handleError(_0x4f16c7,null));};exports[_0x1be2('0xb9')]=function(_0x2bcc46,_0x29c505){return db[_0x1be2('0x3b')][_0x1be2('0xb9')]()[_0x1be2('0x2a')](respondWithResult(_0x29c505,null))['catch'](handleError(_0x29c505,null));};exports[_0x1be2('0xba')]=function(_0x457ea3,_0x4d4c1f,_0x29e237){return db[_0x1be2('0xbb')][_0x1be2('0x61')]({'where':{'id':_0x457ea3[_0x1be2('0xb3')]['id']}})[_0x1be2('0x2a')](handleEntityNotFound(_0x4d4c1f,null))[_0x1be2('0x2a')](function(_0x567cf5){if(_0x567cf5){return _0x567cf5[_0x1be2('0xba')](_0x457ea3['body']['ids'],_[_0x1be2('0xbc')](_0x457ea3['body'],[_0x1be2('0xbd'),'id'])||{});}})[_0x1be2('0x2a')](respondWithResult(_0x4d4c1f,null))['catch'](handleError(_0x4d4c1f,null));};exports[_0x1be2('0xbe')]=function(_0x497a74,_0x4cbc42,_0x23f502){var _0x16f0d4={'raw':![],'where':{}};var _0x3e09db={};var _0x2c5fe0={'count':0x0,'rows':[]};return db[_0x1be2('0x3b')][_0x1be2('0xbf')]({'where':{'id':_0x497a74[_0x1be2('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4cbc42,null))[_0x1be2('0x2a')](function(_0x1e5b13){if(_0x1e5b13){_0x3e09db['model']=_[_0x1be2('0x41')](db['FaxMessage'][_0x1be2('0x3c')]);_0x3e09db[_0x1be2('0x42')]=_[_0x1be2('0x41')](_0x497a74[_0x1be2('0x42')]);_0x3e09db[_0x1be2('0x4a')]=_[_0x1be2('0x43')](_0x3e09db[_0x1be2('0x3f')],_0x3e09db[_0x1be2('0x42')]);_0x16f0d4[_0x1be2('0x45')]=_[_0x1be2('0x43')](_0x3e09db[_0x1be2('0x3f')],qs[_0x1be2('0x44')](_0x497a74['query'][_0x1be2('0x44')]));_0x16f0d4[_0x1be2('0x45')]=_0x16f0d4[_0x1be2('0x45')][_0x1be2('0x46')]?_0x16f0d4[_0x1be2('0x45')]:_0x3e09db[_0x1be2('0x3f')];if(!_0x497a74[_0x1be2('0x42')][_0x1be2('0x47')](_0x1be2('0x48'))){_0x16f0d4[_0x1be2('0x24')]=qs[_0x1be2('0x24')](_0x497a74[_0x1be2('0x42')][_0x1be2('0x24')]);_0x16f0d4[_0x1be2('0x22')]=qs['offset'](_0x497a74[_0x1be2('0x42')][_0x1be2('0x22')]);}_0x16f0d4[_0x1be2('0x90')]=qs[_0x1be2('0x49')](_0x497a74[_0x1be2('0x42')][_0x1be2('0x49')]);_0x16f0d4[_0x1be2('0x79')]=qs[_0x1be2('0x4a')](_['pick'](_0x497a74[_0x1be2('0x42')],_0x3e09db[_0x1be2('0x4a')]));_0x16f0d4['where'][_0x1be2('0xc0')]=_0x1e5b13['id'];if(_0x497a74[_0x1be2('0x42')][_0x1be2('0x86')]){_0x16f0d4['where']=_[_0x1be2('0x9d')](_0x16f0d4[_0x1be2('0x79')],{'$or':_[_0x1be2('0x2d')](_0x16f0d4[_0x1be2('0x45')],function(_0x4ffc){var _0x300551={};_0x300551[_0x4ffc]={'$like':'%'+_0x497a74[_0x1be2('0x42')][_0x1be2('0x86')]+'%'};return _0x300551;})});}if(_0x497a74[_0x1be2('0x42')][_0x1be2('0x7d')]){var _0x1ba763=_0x497a74[_0x1be2('0x42')][_0x1be2('0x7d')][_0x1be2('0x6f')](',');var _0x12810d={};_0x12810d[_0x1ba763[0x0]]={'$gte':moment(_0x1ba763[0x1])[_0x1be2('0xc1')](_0x1be2('0xc2'))};_0x16f0d4[_0x1be2('0x79')]=_[_0x1be2('0x9d')](_0x16f0d4['where'],_0x12810d);}_0x16f0d4=_['merge']({},_0x16f0d4,_0x497a74[_0x1be2('0xb5')]);return db[_0x1be2('0xbb')][_0x1be2('0x9b')]({'where':_0x16f0d4['where']})[_0x1be2('0x2a')](function(_0x3a0145){_0x2c5fe0[_0x1be2('0x9b')]=_0x3a0145;if(_0x497a74['query']['includeAll']){_0x16f0d4[_0x1be2('0xb4')]=[{'all':!![]}];}return db[_0x1be2('0xbb')]['findAll'](_0x16f0d4);})['then'](function(_0x407dfa){_0x2c5fe0[_0x1be2('0xb1')]=_0x407dfa;return _0x2c5fe0;});}})[_0x1be2('0x2a')](respondWithFilteredResult(_0x4cbc42,_0x16f0d4))['catch'](handleError(_0x4cbc42,null));};exports[_0x1be2('0xc3')]=function(_0x30b736,_0x5a0b9b,_0x1d9842){return db[_0x1be2('0x3b')][_0x1be2('0x61')]({'where':{'id':_0x30b736[_0x1be2('0xb3')]['id']}})['then'](handleEntityNotFound(_0x5a0b9b,null))[_0x1be2('0x2a')](function(_0x17bb8f){if(_0x17bb8f){return _0x17bb8f[_0x1be2('0xc4')](_0x30b736[_0x1be2('0xb7')][_0x1be2('0xbd')],_[_0x1be2('0xbc')](_0x30b736[_0x1be2('0xb7')],[_0x1be2('0xbd'),'id'])||{})[_0x1be2('0xc5')](function(){return db[_0x1be2('0x6e')]['findAll']({'attributes':['id',_0x1be2('0x40'),_0x1be2('0x4d')],'where':{'id':_0x30b736[_0x1be2('0xb7')][_0x1be2('0xbd')]}});})[_0x1be2('0x2a')](function(_0x27f72c){socket['emit']('faxInteractionTags:save',{'id':Number(_0x30b736[_0x1be2('0xb3')]['id']),'tags':_0x27f72c||[]});return{'id':Number(_0x30b736[_0x1be2('0xb3')]['id']),'tags':_0x27f72c||[]};});}})[_0x1be2('0x2a')](respondWithResult(_0x5a0b9b,null))[_0x1be2('0x33')](handleError(_0x5a0b9b,null));};exports[_0x1be2('0xc6')]=function(_0x7c793c,_0x158da6,_0xe9acde){return db['FaxInteraction'][_0x1be2('0x61')]({'where':{'id':_0x7c793c[_0x1be2('0xb3')]['id']}})[_0x1be2('0x2a')](handleEntityNotFound(_0x158da6,null))[_0x1be2('0x2a')](function(_0x229340){if(_0x229340){return _0x229340[_0x1be2('0xc6')](_0x7c793c[_0x1be2('0x42')][_0x1be2('0xbd')]);}})['then'](respondWithStatusCode(_0x158da6,null))[_0x1be2('0x33')](handleError(_0x158da6,null));};exports[_0x1be2('0xc7')]=function(_0x34f523,_0x1c9d37){var _0x41fc64=moment()[_0x1be2('0xc8')]()[_0x1be2('0xad')]();var _0x55f734=path['join'](config[_0x1be2('0xc9')],'server','files',_0x1be2('0xca'));var _0x12fb27=path['join'](config[_0x1be2('0xc9')],'server',_0x1be2('0xcb'),_0x1be2('0xcc'));var _0x48ccdb=path['join'](_0x55f734,_0x41fc64);var _0x282559=util[_0x1be2('0xc1')]('transcript-%d-%s.zip',_0x34f523[_0x1be2('0xb3')]['id'],_0x41fc64);var _0x1f893c=path['join'](_0x55f734,_0x282559);var _0x5c1c07=[];_0x5c1c07[_0x1be2('0x32')]({'model':db[_0x1be2('0xcd')],'as':'Attachment','raw':!![]});var _0x6cbb4c=[{'model':db[_0x1be2('0xbb')],'as':'Messages','attributes':['id','body',_0x1be2('0x7b')],'include':_0x5c1c07}];return db[_0x1be2('0x3b')][_0x1be2('0x61')]({'where':{'id':_0x34f523[_0x1be2('0xb3')]['id']},'include':_0x6cbb4c})['then'](handleEntityNotFound(_0x1c9d37,null))[_0x1be2('0x2a')](function(_0x329ae8){if(_0x329ae8&&_0x329ae8[_0x1be2('0xce')]){var _0xd99c5e=_0x329ae8[_0x1be2('0xcf')]({'plain':!![]});fs['mkdirSync'](_0x48ccdb);for(var _0x3ad1a7=0x0;_0x3ad1a7<_0xd99c5e[_0x1be2('0xce')][_0x1be2('0x46')];_0x3ad1a7++){var _0x2a13b3=_0xd99c5e[_0x1be2('0xce')][_0x3ad1a7][_0x1be2('0xcd')];if(_0x2a13b3){var _0x2eda15=path[_0x1be2('0xd0')](_0x12fb27,_0x2a13b3[_0x1be2('0xd1')]);if(fs[_0x1be2('0xd2')](_0x2eda15)){fs['createReadStream'](_0x2eda15)[_0x1be2('0xd3')](fs['createWriteStream'](path['join'](_0x48ccdb,_0x2a13b3[_0x1be2('0xd1')])));}}}return BPromise[_0x1be2('0x93')]()[_0x1be2('0x2a')](function(){return new BPromise(function(_0xfa3cd7,_0x44a735){zipdir(_0x48ccdb,{'saveTo':_0x1f893c},function(_0x7d304,_0x291052){if(_0x7d304)return _0x44a735(_0x7d304);return _0xfa3cd7(_0x291052);});})[_0x1be2('0x2a')](function(){return new BPromise(function(_0x3ef0fa,_0x5b6c05){rimraf(_0x48ccdb,function(_0x20e538){if(_0x20e538)_0x5b6c05(_0x20e538);return _0x3ef0fa();});});})[_0x1be2('0x2a')](function(){return _0x1c9d37[_0x1be2('0xc7')](_0x1f893c,_0x282559,function(_0x274dda){if(_0x274dda){console['log'](_0x1be2('0xd4'),_0x274dda);}else{fs[_0x1be2('0xd5')](_0x1f893c);}});});});}else{return _0x1c9d37['sendStatus'](0xc8);}})['catch'](handleError(_0x1c9d37,null));}; \ No newline at end of file +var _0x04a2=['ContactId','buildExpression','text','start','end','Tag','union','body','some','compact','isEmpty','FaxAccountId','where','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','role','sequelize','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','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','includeAll','include','merge','create','find','destroy','describe','FaxMessage','addMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','root','server','tmp','files','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','log','err','unlinkSync','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags','catch','talking','answered','unmanaged','total','UserId','waiting','closed','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','field','color','from','select','u.fullname','user_has_fax_interactions','users','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x04a2,0x147));var _0x204a=function(_0x3161af,_0x3c3fc6){_0x3161af=_0x3161af-0x0;var _0x2c0055=_0x04a2[_0x3161af];return _0x2c0055;};'use strict';var emlformat=require(_0x204a('0x0'));var rimraf=require(_0x204a('0x1'));var zipdir=require(_0x204a('0x2'));var jsonpatch=require(_0x204a('0x3'));var rp=require(_0x204a('0x4'));var moment=require(_0x204a('0x5'));var BPromise=require(_0x204a('0x6'));var Mustache=require(_0x204a('0x7'));var util=require(_0x204a('0x8'));var path=require(_0x204a('0x9'));var sox=require('sox');var csv=require(_0x204a('0xa'));var ejs=require(_0x204a('0xb'));var fs=require('fs');var fs_extra=require(_0x204a('0xc'));var _=require(_0x204a('0xd'));var squel=require(_0x204a('0xe'));var crypto=require(_0x204a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x204a('0x10'));var toCsv=require(_0x204a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x204a('0x11'));var authService=require(_0x204a('0x12'));var qs=require(_0x204a('0x13'));var as=require(_0x204a('0x14'));var hardwareService=require(_0x204a('0x15'));var logger=require(_0x204a('0x16'))(_0x204a('0x17'));var utils=require(_0x204a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x204a('0x19'));var db=require('../../mysqldb')['db'];config[_0x204a('0x1a')]=_[_0x204a('0x1b')](config[_0x204a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x204a('0x1a')]));require(_0x204a('0x1c'))['register'](socket);function respondWithStatusCode(_0x1eee2a,_0x109a6b){_0x109a6b=_0x109a6b||0xcc;return function(_0x23f71b){if(_0x23f71b){return _0x1eee2a[_0x204a('0x1d')](_0x109a6b);}return _0x1eee2a[_0x204a('0x1e')](_0x109a6b)['end']();};}function respondWithResult(_0x5dc398,_0x41567b){_0x41567b=_0x41567b||0xc8;return function(_0x2ef697){if(_0x2ef697){return _0x5dc398[_0x204a('0x1e')](_0x41567b)[_0x204a('0x1f')](_0x2ef697);}};}function respondWithFilteredResult(_0x1d75de,_0x57c83d){return function(_0x6e60f5){if(_0x6e60f5){var _0x76f67=typeof _0x57c83d[_0x204a('0x20')]===_0x204a('0x21')&&typeof _0x57c83d[_0x204a('0x22')]===_0x204a('0x21');var _0x5a6e36=_0x6e60f5[_0x204a('0x23')];var _0x57645e=_0x76f67?0x0:_0x57c83d[_0x204a('0x20')];var _0x2aa4c7=_0x76f67?_0x6e60f5[_0x204a('0x23')]:_0x57c83d[_0x204a('0x20')]+_0x57c83d[_0x204a('0x22')];var _0x537512;if(_0x2aa4c7>=_0x5a6e36){_0x2aa4c7=_0x5a6e36;_0x537512=0xc8;}else{_0x537512=0xce;}_0x1d75de['status'](_0x537512);return _0x1d75de['set'](_0x204a('0x24'),_0x57645e+'-'+_0x2aa4c7+'/'+_0x5a6e36)[_0x204a('0x1f')](_0x6e60f5);}return null;};}function patchUpdates(_0x4743a3){return function(_0x2864ef){try{jsonpatch[_0x204a('0x25')](_0x2864ef,_0x4743a3,!![]);}catch(_0x315448){return BPromise['reject'](_0x315448);}return _0x2864ef[_0x204a('0x26')]();};}function saveUpdates(_0x2ee036,_0x6e90db){return function(_0x54a1aa){if(_0x54a1aa){return _0x54a1aa[_0x204a('0x27')](_0x2ee036)['then'](function(_0x464c58){return _0x464c58;});}return null;};}function removeEntity(_0x42e8d8,_0x212908){return function(_0x26befd){if(_0x26befd){return _0x26befd['destroy']()[_0x204a('0x28')](function(){_0x42e8d8[_0x204a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdaf2cc,_0x1810ce){return function(_0x4b73f3){if(!_0x4b73f3){_0xdaf2cc[_0x204a('0x1d')](0x194);}return _0x4b73f3;};}function handleError(_0x3907d2,_0x28d22f){_0x28d22f=_0x28d22f||0x1f4;return function(_0x419e68){logger[_0x204a('0x29')](_0x419e68[_0x204a('0x2a')]);if(_0x419e68[_0x204a('0x2b')]){delete _0x419e68[_0x204a('0x2b')];}_0x3907d2[_0x204a('0x1e')](_0x28d22f)['send'](_0x419e68);};}function getInteractionUsers(_0x5d3f35,_0x364bd5){return new BPromise(function(_0x4233cd,_0x2712c2){try{if(_0x364bd5[_0x5d3f35['id']]){_0x5d3f35[_0x204a('0x2c')]=_[_0x204a('0x2d')](_0x364bd5[_0x5d3f35['id']],function(_0x53babe){return{'id':_0x53babe['id'],'fullname':_0x53babe[_0x204a('0x2e')]};});}}catch(_0xea0c87){_0x2712c2(_0xea0c87);}_0x4233cd(_0x5d3f35);});}function getInteractionTags(_0xe5b251,_0x559c8b){return new BPromise(function(_0x3aeef3,_0x115848){try{if(_0xe5b251[_0x204a('0x2f')]){_0xe5b251['Tags']=[];_0xe5b251[_0x204a('0x2f')][_0x204a('0x30')](',')[_0x204a('0x31')](function(_0x33830f){_0xe5b251[_0x204a('0x32')]['push'](_0x559c8b[_0x33830f]);});}delete _0xe5b251[_0x204a('0x2f')];}catch(_0xc2c679){_0x115848(_0xc2c679);}_0x3aeef3(_0xe5b251);});}function updateFaxInteraction(_0x3a779c,_0x3c66e4,_0x5ea6ba){return new BPromise(function(_0x368863,_0x125043){return getInteractionUsers(_0x3a779c,_0x5ea6ba)[_0x204a('0x28')](function(_0x329a20){return getInteractionTags(_0x329a20,_0x3c66e4);})['then'](function(_0x642d51){return getStateInteraction(_0x642d51);})[_0x204a('0x28')](function(_0x19c6f5){_0x368863(_0x19c6f5);})[_0x204a('0x33')](function(_0x3a99ad){_0x125043(_0x3a99ad);});});}function getStateInteraction(_0x13fd77){return new BPromise(function(_0x2f243b){_0x13fd77['waiting']=0x0;_0x13fd77[_0x204a('0x34')]=0x0;_0x13fd77[_0x204a('0x35')]=0x0;_0x13fd77[_0x204a('0x36')]=0x0;_0x13fd77[_0x204a('0x37')]=0x0;if(!_0x13fd77['closed']&&!_0x13fd77[_0x204a('0x38')]){_0x13fd77[_0x204a('0x39')]+=0x1;}if(!_0x13fd77[_0x204a('0x3a')]&&_0x13fd77[_0x204a('0x38')]){_0x13fd77[_0x204a('0x34')]+=0x1;if(_0x13fd77[_0x204a('0x39')]){_0x13fd77[_0x204a('0x39')]-=0x1;}}if(_0x13fd77[_0x204a('0x3a')]&&_0x13fd77['UserId']){_0x13fd77[_0x204a('0x35')]+=0x1;if(_0x13fd77[_0x204a('0x34')]){_0x13fd77[_0x204a('0x34')]-=0x1;}}if(_0x13fd77[_0x204a('0x3a')]&&!_0x13fd77[_0x204a('0x38')]){_0x13fd77[_0x204a('0x36')]+=0x1;if(_0x13fd77[_0x204a('0x39')]){_0x13fd77[_0x204a('0x39')]-=0x1;}}_0x13fd77[_0x204a('0x37')]+=0x1;_0x2f243b(_0x13fd77);});}exports[_0x204a('0x3b')]=function(_0x49a432,_0x112658){var _0x525b36={},_0x2f95f1={},_0x5e5a09={'count':0x0,'rows':[]};var _0x4ebbf0=_[_0x204a('0x2d')](db[_0x204a('0x3c')][_0x204a('0x3d')],function(_0x5543a5){return{'name':_0x5543a5[_0x204a('0x3e')],'type':_0x5543a5[_0x204a('0x3f')][_0x204a('0x40')]};});_0x2f95f1['model']=_[_0x204a('0x2d')](_0x4ebbf0,_0x204a('0x2b'));_0x2f95f1[_0x204a('0x41')]=_[_0x204a('0x42')](_0x49a432[_0x204a('0x41')]);_0x2f95f1[_0x204a('0x43')]=_[_0x204a('0x44')](_0x2f95f1[_0x204a('0x45')],_0x2f95f1[_0x204a('0x41')]);_0x525b36[_0x204a('0x46')]=_[_0x204a('0x44')](_0x2f95f1[_0x204a('0x45')],qs[_0x204a('0x47')](_0x49a432[_0x204a('0x41')]['fields']));_0x525b36[_0x204a('0x46')]=_0x525b36[_0x204a('0x46')]['length']?_0x525b36['attributes']:_0x2f95f1[_0x204a('0x45')];if(!_0x49a432[_0x204a('0x41')]['hasOwnProperty'](_0x204a('0x48'))){_0x525b36[_0x204a('0x22')]=qs[_0x204a('0x22')](_0x49a432[_0x204a('0x41')]['limit']);_0x525b36[_0x204a('0x20')]=qs[_0x204a('0x20')](_0x49a432['query'][_0x204a('0x20')]);}_0x525b36[_0x204a('0x49')]=qs[_0x204a('0x4a')](_0x49a432[_0x204a('0x41')][_0x204a('0x4a')]);_0x525b36['where']=qs['filters'](_[_0x204a('0x4b')](_0x49a432[_0x204a('0x41')],_0x2f95f1[_0x204a('0x43')]),_0x4ebbf0);var _0x178573=[];var _0x2a84db=squel['select']()[_0x204a('0x4c')]('id')['field'](_0x204a('0x2b'))['field'](_0x204a('0x4d'))[_0x204a('0x4e')]('tools_tags');var _0x616794=squel[_0x204a('0x4f')]()['field']('u.id')[_0x204a('0x4c')](_0x204a('0x50'))[_0x204a('0x4c')]('ui.FaxInteractionId')[_0x204a('0x4e')](_0x204a('0x51'),'ui')['left_join'](_0x204a('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x3897f7=squel[_0x204a('0x4f')]()[_0x204a('0x4e')](_0x204a('0x53'),'i')[_0x204a('0x54')](_0x204a('0x55'),'c',_0x204a('0x56'))['left_join'](_0x204a('0x52'),'o',_0x204a('0x57'))['left_join'](_0x204a('0x58'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x204a('0x59'),'me',_0x204a('0x5a'))['left_join'](_0x204a('0x5b'),'it',_0x204a('0x5c'))['left_join'](_0x204a('0x5d'),'t',_0x204a('0x5e'));var _0x5146f2=squel[_0x204a('0x5f')]();var _0x275ce5=[];var _0xed6ab2=squel['expr']();var _0x3c8efe;if(_0x49a432[_0x204a('0x41')][_0x204a('0x60')]){_0x3c8efe=as['parseSearch'](_0x49a432[_0x204a('0x41')][_0x204a('0x60')]);var _0x3ecf64=_0x3c8efe[_0x204a('0x61')];for(var _0x2faf54=0x0;_0x2faf54<_0x3c8efe['conditions'][_0x204a('0x62')];_0x2faf54++){var _0x3c519a=_0x3c8efe[_0x204a('0x63')][_0x2faf54];var _0x1f80d5='i';var _0x1ad582=_['find'](_0x4ebbf0,[_0x204a('0x2b'),_0x3c519a[_0x204a('0x4c')]]);if(!_0x1ad582){switch(_0x3c519a['field']){case _0x204a('0x64'):if(_0x3c519a[_0x204a('0x65')]==0x1){_0x3897f7['having']('`'+_0x3c519a[_0x204a('0x4c')]+_0x204a('0x66'));}else{_0x3897f7[_0x204a('0x67')]('`'+_0x3c519a[_0x204a('0x4c')]+_0x204a('0x68'));}break;case _0x204a('0x69'):if(_0x3c519a[_0x204a('0x6a')]==='$substring'){if(_0x3c519a['value'][_0x204a('0x30')]('\x20')[_0x204a('0x62')]>0x1){_0x5146f2[_0x3ecf64]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x204a('0x6b')](_0x3c519a['value']),null);}else{var _0x56b66b='%'+_0x3c519a['value']+'%';_0x5146f2[_0x3ecf64](_0x204a('0x6c'),_0x56b66b,_0x56b66b,_0x56b66b);}}else{_0x1ad582=_['find'](_0x4ebbf0,[_0x204a('0x2b'),'ContactId']);_0x3c519a[_0x204a('0x4c')]=_0x204a('0x6d');_0x5d9f41=as[_0x204a('0x6e')](_0x1f80d5,_0x1ad582[_0x204a('0x3f')],_0x3c519a);_0x5146f2[_0x3ecf64](_0x5d9f41[_0x204a('0x6f')],_0x5d9f41[_0x204a('0x65')][_0x204a('0x70')],_0x5d9f41[_0x204a('0x65')][_0x204a('0x71')]);}break;case _0x204a('0x72'):var _0x3df4b0=_0x3c519a['value']['split'](',')[_0x204a('0x2d')](function(_0xc931b){return Number(_0xc931b);});_0x3df4b0['forEach'](function(_0x5889ec){_0xed6ab2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5889ec+',%');});_0x275ce5=_[_0x204a('0x73')](_0x275ce5,_0x3df4b0);break;case'User':if(_0x3c519a[_0x204a('0x6a')]==='$substring'){_0x5146f2[_0x3ecf64]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3c519a[_0x204a('0x65')]+'%',null);}else{_0x1ad582=_['find'](_0x4ebbf0,[_0x204a('0x2b'),_0x204a('0x38')]);_0x3c519a['field']=_0x204a('0x38');_0x5d9f41=as['buildExpression'](_0x1f80d5,_0x1ad582[_0x204a('0x3f')],_0x3c519a);_0x5146f2[_0x3ecf64](_0x5d9f41[_0x204a('0x6f')],_0x5d9f41[_0x204a('0x65')][_0x204a('0x70')],_0x5d9f41['value'][_0x204a('0x71')]);}break;case _0x204a('0x74'):_0x5d9f41=as[_0x204a('0x6e')]('me',null,_0x3c519a);_0x5146f2[_0x3ecf64](_0x5d9f41[_0x204a('0x6f')],_0x5d9f41['value'][_0x204a('0x70')],_0x5d9f41['value'][_0x204a('0x71')]);break;}}else{var _0x5d9f41=as[_0x204a('0x6e')](_0x1f80d5,_0x1ad582['type'],_0x3c519a);_0x5146f2[_0x3ecf64](_0x5d9f41[_0x204a('0x6f')],_0x5d9f41[_0x204a('0x65')]['start'],_0x5d9f41[_0x204a('0x65')][_0x204a('0x71')]);}}}else{var _0x2756d9=_(_0x49a432[_0x204a('0x41')])['keys']()[_0x204a('0x2d')](function(_0x46fb9a){return _[_0x204a('0x75')](_0x4ebbf0,[_0x204a('0x2b'),_0x46fb9a])?_0x46fb9a:undefined;})[_0x204a('0x76')]()['value']();if(!_[_0x204a('0x77')](_0x2756d9)){_0x2756d9['forEach'](function(_0x1ea600){if(_0x1ea600===_0x204a('0x78')){_0x3897f7[_0x204a('0x79')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x49a432[_0x204a('0x41')][_0x1ea600]));}else if(_0x1ea600===_0x204a('0x7a')){var _0x4956a0=JSON[_0x204a('0x7b')](_0x49a432[_0x204a('0x41')][_0x1ea600])[_0x204a('0x7c')];var _0x561380=JSON[_0x204a('0x7b')](_0x49a432[_0x204a('0x41')][_0x1ea600])[_0x204a('0x7d')];_0x3897f7[_0x204a('0x79')](_0x204a('0x7e'),_0x4956a0,_0x561380);}else{if(_0x49a432[_0x204a('0x41')][_0x1ea600]===_0x204a('0x7f')){_0x3897f7['where']('i.'+_0x1ea600+_0x204a('0x80'));}else{_0x3897f7['where']('i.'+_0x1ea600+_0x204a('0x81'),_0x49a432[_0x204a('0x41')][_0x1ea600]);}}});}if(_0x49a432[_0x204a('0x41')][_0x204a('0x82')]){if(_0x49a432['query'][_0x204a('0x82')]==0x1){_0x3897f7[_0x204a('0x67')](_0x204a('0x83'));}else{_0x3897f7[_0x204a('0x67')](_0x204a('0x84'));}}if(_0x49a432[_0x204a('0x41')][_0x204a('0x85')]){_0x275ce5=_['isArray'](_0x49a432[_0x204a('0x41')][_0x204a('0x85')])?_0x49a432['query'][_0x204a('0x85')]:new Array(_0x49a432['query'][_0x204a('0x85')]);_0x275ce5['forEach'](function(_0x59fcf2){_0xed6ab2['or'](_0x204a('0x86'),'%,'+_0x59fcf2+',%');});}if(_0x49a432[_0x204a('0x41')][_0x204a('0x87')]){var _0x7b15c1=_0x49a432[_0x204a('0x41')]['filter']['replace']('\x5c','\x5c\x5c')[_0x204a('0x88')](/'/g,'\x27\x27');if(qs[_0x204a('0x89')](_0x7b15c1)){_0x5146f2['or']('i.id\x20LIKE\x20?',_0x7b15c1+'%')['or'](_0x204a('0x8a'),_0x7b15c1+'%');}_0x5146f2['or'](_0x204a('0x8b'),_0x7b15c1+'%');}}_0x3897f7[_0x204a('0x79')](_0x5146f2);_0x3897f7['group'](_0x204a('0x8c'));var _0x303b8f={'type':db[_0x204a('0x8d')][_0x204a('0x8e')][_0x204a('0x8f')],'raw':!![]};var _0x4ccc2e=_0x3897f7[_0x204a('0x90')]();_0x4ccc2e[_0x204a('0x4c')](_0x204a('0x8c'));_0x4ccc2e[_0x204a('0x4c')](_0x204a('0x91'),_0x204a('0x64'));if(_0x525b36[_0x204a('0x49')]){_0x525b36[_0x204a('0x49')][_0x204a('0x31')](function(_0x1c2bad){var _0xcf77b6=_0x1c2bad[0x0]===_0x204a('0x92')?_0x1c2bad[0x0]:'i.'+_0x1c2bad[0x0];_0x3897f7[_0x204a('0x49')](_0xcf77b6,_0x1c2bad[0x1]===_0x204a('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x275ce5)){_0x3897f7['having'](_0xed6ab2);_0x4ccc2e[_0x204a('0x79')](_0x204a('0x94'),_0x275ce5);}BPromise[_0x204a('0x95')]()[_0x204a('0x28')](function(){if(!_0x3c8efe){if(_0x49a432['query'][_0x204a('0x78')])return;_0x4ccc2e[_0x204a('0x79')](_0x204a('0x96'));_0x3897f7[_0x204a('0x79')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x49a432[_0x204a('0x97')]['role']!==_0x204a('0x98'))return;return _0x49a432[_0x204a('0x97')][_0x204a('0x99')]({'attributes':['id'],'raw':!![]})[_0x204a('0x28')](function(_0x30eb90){if(_[_0x204a('0x77')](_0x30eb90)){_0x4ccc2e[_0x204a('0x79')]('i.FaxAccountId\x20IS\x20NULL');_0x3897f7['where'](_0x204a('0x9a'));}else{_0x4ccc2e[_0x204a('0x79')](_0x204a('0x9b'),_[_0x204a('0x2d')](_0x30eb90,'id'));_0x3897f7['where']('i.FaxAccountId\x20IN\x20?',_[_0x204a('0x2d')](_0x30eb90,'id'));}});})[_0x204a('0x28')](function(){if(_0x49a432['user'][_0x204a('0x9c')]===_0x204a('0x98')&&!_0x3c8efe&&!_0x49a432[_0x204a('0x41')][_0x204a('0x78')])return[];return db[_0x204a('0x9d')][_0x204a('0x41')](_0x4ccc2e['toString'](),_0x303b8f);})[_0x204a('0x28')](function(_0xd9e191){_0x5e5a09[_0x204a('0x23')]=_0xd9e191[_0x204a('0x62')];if(_0x5e5a09[_0x204a('0x23')]===0x0)return[];return db[_0x204a('0x9d')][_0x204a('0x41')](_0x2a84db['toString'](),_0x303b8f)[_0x204a('0x28')](function(_0x336f37){_0x178573=_['keyBy'](_0x336f37,'id');_0x303b8f=_['merge'](_0x303b8f,{'model':db[_0x204a('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49a432['query'][_0x204a('0x47')]){_0x525b36[_0x204a('0x46')]['forEach'](function(_0x26066f){_0x3897f7[_0x204a('0x4c')]('i.'+_0x26066f);});}else{_0x3897f7[_0x204a('0x4c')](_0x204a('0x91'),_0x204a('0x64'));_0x3897f7['field']('a.key',_0x204a('0x9e'));_0x3897f7[_0x204a('0x4c')](_0x204a('0x9f'),_0x204a('0xa0'));_0x3897f7[_0x204a('0x4c')](_0x204a('0xa1'),_0x204a('0x92'));_0x3897f7[_0x204a('0x4c')]('i.*');_0x3897f7[_0x204a('0x4c')]('c.firstName',_0x204a('0xa2'));_0x3897f7[_0x204a('0x4c')](_0x204a('0xa3'),_0x204a('0xa4'));_0x3897f7[_0x204a('0x4c')]('c.email',_0x204a('0xa5'));_0x3897f7[_0x204a('0x4c')]('c.phone','Contact.phone');_0x3897f7[_0x204a('0x4c')](_0x204a('0xa6'),_0x204a('0xa7'));_0x3897f7[_0x204a('0x4c')](_0x204a('0xa8'),_0x204a('0xa9'));_0x3897f7['field'](_0x204a('0xaa'),'Owner.fullname');_0x3897f7[_0x204a('0x4c')](_0x204a('0xab'),_0x204a('0xac'));_0x3897f7[_0x204a('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x204a('0x2f'));}if(_0x525b36[_0x204a('0x22')])_0x3897f7[_0x204a('0x22')](_0x525b36[_0x204a('0x22')]);if(_0x525b36[_0x204a('0x20')])_0x3897f7[_0x204a('0x20')](_0x525b36['offset']);return db[_0x204a('0x9d')]['query'](_0x3897f7[_0x204a('0xad')](),_0x303b8f);})['then'](function(_0x309315){if(_0x309315[_0x204a('0x62')]>0x0)_0x616794[_0x204a('0x79')](_0x204a('0xae'),_['map'](_0x309315,'id'));return db[_0x204a('0x9d')][_0x204a('0x41')](_0x616794[_0x204a('0xad')](),_0x303b8f)['then'](function(_0x439052){var _0x2ccbec=_[_0x204a('0xaf')](_0x439052,_0x204a('0xb0'));var _0x5c3c34=[];_0x309315[_0x204a('0x31')](function(_0xfdfdb){_0x5c3c34['push'](updateFaxInteraction(_0xfdfdb,_0x178573,_0x2ccbec));});return BPromise['all'](_0x5c3c34);});});})[_0x204a('0x28')](function(_0x3a9c11){_0x5e5a09[_0x204a('0xb1')]=_0x3a9c11;return _0x5e5a09;})['then'](respondWithFilteredResult(_0x112658,_0x525b36))[_0x204a('0x33')](handleError(_0x112658,null));};exports[_0x204a('0xb2')]=function(_0x4c0738,_0x22a795){var _0x102941={'raw':![],'where':{'id':_0x4c0738[_0x204a('0xb3')]['id']}},_0x42f9f3={};_0x42f9f3[_0x204a('0x45')]=_['keys'](db['FaxInteraction'][_0x204a('0x3d')]);_0x42f9f3[_0x204a('0x41')]=_[_0x204a('0x42')](_0x4c0738[_0x204a('0x41')]);_0x42f9f3[_0x204a('0x43')]=_[_0x204a('0x44')](_0x42f9f3[_0x204a('0x45')],_0x42f9f3[_0x204a('0x41')]);_0x102941[_0x204a('0x46')]=_[_0x204a('0x44')](_0x42f9f3[_0x204a('0x45')],qs[_0x204a('0x47')](_0x4c0738['query']['fields']));_0x102941[_0x204a('0x46')]=_0x102941[_0x204a('0x46')][_0x204a('0x62')]?_0x102941['attributes']:_0x42f9f3[_0x204a('0x45')];if(_0x4c0738[_0x204a('0x41')][_0x204a('0xb4')]){_0x102941[_0x204a('0xb5')]=[{'all':!![]}];}_0x102941=_[_0x204a('0xb6')]({},_0x102941,_0x4c0738['options']);return db[_0x204a('0x3c')]['find'](_0x102941)[_0x204a('0x28')](handleEntityNotFound(_0x22a795,null))[_0x204a('0x28')](respondWithResult(_0x22a795,null))['catch'](handleError(_0x22a795,null));};exports[_0x204a('0xb7')]=function(_0x73d6a8,_0x5746f2){return db[_0x204a('0x3c')]['create'](_0x73d6a8[_0x204a('0x74')],{})[_0x204a('0x28')](respondWithResult(_0x5746f2,0xc9))['catch'](handleError(_0x5746f2,null));};exports['update']=function(_0x596d6d,_0x47e07d){if(_0x596d6d['body']['id']){delete _0x596d6d[_0x204a('0x74')]['id'];}return db[_0x204a('0x3c')][_0x204a('0xb8')]({'where':{'id':_0x596d6d['params']['id']}})[_0x204a('0x28')](handleEntityNotFound(_0x47e07d,null))[_0x204a('0x28')](saveUpdates(_0x596d6d[_0x204a('0x74')],null))[_0x204a('0x28')](respondWithResult(_0x47e07d,null))['catch'](handleError(_0x47e07d,null));};exports[_0x204a('0xb9')]=function(_0x48c8dc,_0x37a69e){return db[_0x204a('0x3c')][_0x204a('0xb8')]({'where':{'id':_0x48c8dc[_0x204a('0xb3')]['id']}})[_0x204a('0x28')](handleEntityNotFound(_0x37a69e,null))[_0x204a('0x28')](removeEntity(_0x37a69e,null))[_0x204a('0x33')](handleError(_0x37a69e,null));};exports['describe']=function(_0x28bde6,_0x417bf5){return db[_0x204a('0x3c')][_0x204a('0xba')]()[_0x204a('0x28')](respondWithResult(_0x417bf5,null))[_0x204a('0x33')](handleError(_0x417bf5,null));};exports['addMessage']=function(_0x2f1ceb,_0x33bb3c,_0x35bf32){return db[_0x204a('0xbb')][_0x204a('0xb8')]({'where':{'id':_0x2f1ceb['params']['id']}})[_0x204a('0x28')](handleEntityNotFound(_0x33bb3c,null))[_0x204a('0x28')](function(_0x238f5c){if(_0x238f5c){return _0x238f5c[_0x204a('0xbc')](_0x2f1ceb[_0x204a('0x74')][_0x204a('0xbd')],_[_0x204a('0xbe')](_0x2f1ceb[_0x204a('0x74')],[_0x204a('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x33bb3c,null))['catch'](handleError(_0x33bb3c,null));};exports['getMessages']=function(_0x14f5a3,_0x2a39e6,_0x454301){var _0x73339b={'raw':![],'where':{}};var _0x4be287={};var _0x245665={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x204a('0xbf')]({'where':{'id':_0x14f5a3['params']['id']}})[_0x204a('0x28')](handleEntityNotFound(_0x2a39e6,null))[_0x204a('0x28')](function(_0x57188f){if(_0x57188f){_0x4be287['model']=_[_0x204a('0x42')](db[_0x204a('0xbb')][_0x204a('0x3d')]);_0x4be287[_0x204a('0x41')]=_[_0x204a('0x42')](_0x14f5a3['query']);_0x4be287[_0x204a('0x43')]=_['intersection'](_0x4be287[_0x204a('0x45')],_0x4be287[_0x204a('0x41')]);_0x73339b[_0x204a('0x46')]=_[_0x204a('0x44')](_0x4be287[_0x204a('0x45')],qs[_0x204a('0x47')](_0x14f5a3[_0x204a('0x41')]['fields']));_0x73339b[_0x204a('0x46')]=_0x73339b[_0x204a('0x46')][_0x204a('0x62')]?_0x73339b['attributes']:_0x4be287['model'];if(!_0x14f5a3[_0x204a('0x41')]['hasOwnProperty'](_0x204a('0x48'))){_0x73339b['limit']=qs['limit'](_0x14f5a3[_0x204a('0x41')][_0x204a('0x22')]);_0x73339b[_0x204a('0x20')]=qs['offset'](_0x14f5a3['query'][_0x204a('0x20')]);}_0x73339b[_0x204a('0x49')]=qs[_0x204a('0x4a')](_0x14f5a3[_0x204a('0x41')][_0x204a('0x4a')]);_0x73339b[_0x204a('0x79')]=qs[_0x204a('0x43')](_[_0x204a('0x4b')](_0x14f5a3[_0x204a('0x41')],_0x4be287[_0x204a('0x43')]));_0x73339b[_0x204a('0x79')][_0x204a('0xb0')]=_0x57188f['id'];if(_0x14f5a3[_0x204a('0x41')][_0x204a('0x87')]){_0x73339b[_0x204a('0x79')]=_[_0x204a('0xb6')](_0x73339b[_0x204a('0x79')],{'$or':_[_0x204a('0x2d')](_0x73339b['attributes'],function(_0x2c884c){var _0xb98420={};_0xb98420[_0x2c884c]={'$like':'%'+_0x14f5a3[_0x204a('0x41')]['filter']+'%'};return _0xb98420;})});}if(_0x14f5a3[_0x204a('0x41')][_0x204a('0x7c')]){var _0x5e9842=_0x14f5a3[_0x204a('0x41')][_0x204a('0x7c')][_0x204a('0x30')](',');var _0x179a97={};_0x179a97[_0x5e9842[0x0]]={'$gte':moment(_0x5e9842[0x1])[_0x204a('0xc0')](_0x204a('0xc1'))};_0x73339b[_0x204a('0x79')]=_[_0x204a('0xb6')](_0x73339b['where'],_0x179a97);}_0x73339b=_['merge']({},_0x73339b,_0x14f5a3['options']);return db[_0x204a('0xbb')][_0x204a('0x23')]({'where':_0x73339b[_0x204a('0x79')]})[_0x204a('0x28')](function(_0x3f8d0a){_0x245665[_0x204a('0x23')]=_0x3f8d0a;if(_0x14f5a3[_0x204a('0x41')][_0x204a('0xb4')]){_0x73339b[_0x204a('0xb5')]=[{'all':!![]}];}return db[_0x204a('0xbb')][_0x204a('0xc2')](_0x73339b);})[_0x204a('0x28')](function(_0x57d1b5){_0x245665['rows']=_0x57d1b5;return _0x245665;});}})['then'](respondWithFilteredResult(_0x2a39e6,_0x73339b))['catch'](handleError(_0x2a39e6,null));};exports[_0x204a('0xc3')]=function(_0x4fb80c,_0x972aaf,_0x1621d5){return db[_0x204a('0x3c')]['find']({'where':{'id':_0x4fb80c[_0x204a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x972aaf,null))[_0x204a('0x28')](function(_0xd29d7c){if(_0xd29d7c){return _0xd29d7c['setTags'](_0x4fb80c[_0x204a('0x74')]['ids'],_['omit'](_0x4fb80c[_0x204a('0x74')],[_0x204a('0xbd'),'id'])||{})[_0x204a('0xc4')](function(){return db[_0x204a('0x72')]['findAll']({'attributes':['id',_0x204a('0x2b'),_0x204a('0x4d')],'where':{'id':_0x4fb80c[_0x204a('0x74')][_0x204a('0xbd')]}});})['then'](function(_0xf9cd2d){socket[_0x204a('0xc5')](_0x204a('0xc6'),{'id':Number(_0x4fb80c[_0x204a('0xb3')]['id']),'tags':_0xf9cd2d||[]});return{'id':Number(_0x4fb80c[_0x204a('0xb3')]['id']),'tags':_0xf9cd2d||[]};});}})[_0x204a('0x28')](respondWithResult(_0x972aaf,null))[_0x204a('0x33')](handleError(_0x972aaf,null));};exports[_0x204a('0xc7')]=function(_0x44eaa0,_0x215ee5,_0x309f90){return db[_0x204a('0x3c')]['find']({'where':{'id':_0x44eaa0['params']['id']}})[_0x204a('0x28')](handleEntityNotFound(_0x215ee5,null))['then'](function(_0x1aeb05){if(_0x1aeb05){return _0x1aeb05[_0x204a('0xc7')](_0x44eaa0['query'][_0x204a('0xbd')]);}})[_0x204a('0x28')](respondWithStatusCode(_0x215ee5,null))['catch'](handleError(_0x215ee5,null));};exports['download']=function(_0x152a43,_0x86cb24){var _0x2635c7=moment()['unix']()[_0x204a('0xad')]();var _0x3caa62=path['join'](config[_0x204a('0xc8')],_0x204a('0xc9'),'files',_0x204a('0xca'));var _0x4ebf13=path['join'](config[_0x204a('0xc8')],_0x204a('0xc9'),_0x204a('0xcb'),_0x204a('0xcc'));var _0x5be8c0=path[_0x204a('0xcd')](_0x3caa62,_0x2635c7);var _0x2a1438=util[_0x204a('0xc0')](_0x204a('0xce'),_0x152a43[_0x204a('0xb3')]['id'],_0x2635c7);var _0x1e3934=path['join'](_0x3caa62,_0x2a1438);var _0x23f2f3=[];_0x23f2f3[_0x204a('0xcf')]({'model':db[_0x204a('0xd0')],'as':'Attachment','raw':!![]});var _0x4523df=[{'model':db['FaxMessage'],'as':_0x204a('0xd1'),'attributes':['id',_0x204a('0x74'),'createdAt'],'include':_0x23f2f3}];return db['FaxInteraction'][_0x204a('0xb8')]({'where':{'id':_0x152a43[_0x204a('0xb3')]['id']},'include':_0x4523df})[_0x204a('0x28')](handleEntityNotFound(_0x86cb24,null))[_0x204a('0x28')](function(_0x273eec){if(_0x273eec&&_0x273eec[_0x204a('0xd1')]){var _0x2b7350=_0x273eec[_0x204a('0xd2')]({'plain':!![]});fs[_0x204a('0xd3')](_0x5be8c0);for(var _0x20b88f=0x0;_0x20b88f<_0x2b7350[_0x204a('0xd1')][_0x204a('0x62')];_0x20b88f++){var _0x58a7fb=_0x2b7350[_0x204a('0xd1')][_0x20b88f][_0x204a('0xd0')];if(_0x58a7fb){var _0x57771a=path[_0x204a('0xcd')](_0x4ebf13,_0x58a7fb[_0x204a('0xd4')]);if(fs['existsSync'](_0x57771a)){fs['createReadStream'](_0x57771a)[_0x204a('0xd5')](fs[_0x204a('0xd6')](path[_0x204a('0xcd')](_0x5be8c0,_0x58a7fb['basename'])));}}}return BPromise[_0x204a('0x95')]()[_0x204a('0x28')](function(){return new BPromise(function(_0x255a85,_0x46e82b){zipdir(_0x5be8c0,{'saveTo':_0x1e3934},function(_0x31e449,_0x553951){if(_0x31e449)return _0x46e82b(_0x31e449);return _0x255a85(_0x553951);});})['then'](function(){return new BPromise(function(_0x522225,_0xf9c578){rimraf(_0x5be8c0,function(_0x3ccdbf){if(_0x3ccdbf)_0xf9c578(_0x3ccdbf);return _0x522225();});});})[_0x204a('0x28')](function(){return _0x86cb24['download'](_0x1e3934,_0x2a1438,function(_0x10e209){if(_0x10e209){console[_0x204a('0xd7')](_0x204a('0xd8'),_0x10e209);}else{fs[_0x204a('0xd9')](_0x1e3934);}});});});}else{return _0x86cb24[_0x204a('0x1d')](0xc8);}})[_0x204a('0x33')](handleError(_0x86cb24,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0e12fa1..70a7a72 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 _0x778f=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','then','setDataValue','Users','map'];(function(_0x5bf47a,_0x6ea2d1){var _0x1b57b8=function(_0x5183d8){while(--_0x5183d8){_0x5bf47a['push'](_0x5bf47a['shift']());}};_0x1b57b8(++_0x6ea2d1);}(_0x778f,0xe6));var _0xf778=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x778f[_0x59d89e];return _0x554e93;};'use strict';var EventEmitter=require(_0xf778('0x0'));var FaxInteraction=require(_0xf778('0x1'))['db'][_0xf778('0x2')];var FaxMessage=require(_0xf778('0x1'))['db'][_0xf778('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf778('0x4')](0x0);var events={'afterCreate':_0xf778('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4baeff){return function(_0x229cc5,_0x39af74,_0x2b4a95){_0x229cc5['getUsers']({'attributes':['id'],'raw':!![]})[_0xf778('0x6')](function(_0x1bef74){_0x229cc5[_0xf778('0x7')](_0xf778('0x8'),_0x1bef74[_0xf778('0x9')](function(_0x554c8f){return{'id':_0x554c8f['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x229cc5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d4633){_0x229cc5['setDataValue'](_0xf778('0xa'),_0x4d4633['length']);FaxInteractionEvents['emit'](_0x4baeff+':'+_0x229cc5['id'],_0x229cc5);FaxInteractionEvents[_0xf778('0xb')](_0x4baeff,_0x229cc5);_0x2b4a95(null);})[_0xf778('0xc')](_0x2b4a95(null));};}for(var e in events){if(events[_0xf778('0xd')](e)){var event=events[e];FaxInteraction[_0xf778('0xe')](e,emitEvent(event));}}module[_0xf778('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xe09a=['getUsers','then','Users','findAll','unreadMessages','length','catch','hasOwnProperty','events','../../mysqldb','FaxMessage','update','remove'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xe09a,0x1e9));var _0xae09=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0xe09a[_0x1d7300];return _0x46ee98;};'use strict';var EventEmitter=require(_0xae09('0x0'));var FaxInteraction=require(_0xae09('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xae09('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xae09('0x3'),'afterDestroy':_0xae09('0x4')};function emitEvent(_0x54853f){return function(_0x3b2017,_0x1161a7,_0x12fca2){_0x3b2017[_0xae09('0x5')]({'attributes':['id'],'raw':!![]})[_0xae09('0x6')](function(_0x20e670){_0x3b2017['setDataValue'](_0xae09('0x7'),_0x20e670['map'](function(_0x2870d5){return{'id':_0x2870d5['id']};}));return FaxMessage[_0xae09('0x8')]({'where':{'FaxInteractionId':_0x3b2017['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae09('0x6')](function(_0x2e5bf7){_0x3b2017['setDataValue'](_0xae09('0x9'),_0x2e5bf7[_0xae09('0xa')]);FaxInteractionEvents['emit'](_0x54853f+':'+_0x3b2017['id'],_0x3b2017);FaxInteractionEvents['emit'](_0x54853f,_0x3b2017);_0x12fca2(null);})[_0xae09('0xb')](_0x12fca2(null));};}for(var e in events){if(events[_0xae09('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 06c6061..24c7fce 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 _0x4a41=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0x4a41,0x1b8));var _0x14a4=function(_0x628d48,_0x304714){_0x628d48=_0x628d48-0x0;var _0x558cd7=_0x4a41[_0x628d48];return _0x558cd7;};'use strict';var _=require(_0x14a4('0x0'));var util=require(_0x14a4('0x1'));var logger=require(_0x14a4('0x2'))(_0x14a4('0x3'));var moment=require(_0x14a4('0x4'));var BPromise=require(_0x14a4('0x5'));var rp=require(_0x14a4('0x6'));var fs=require('fs');var path=require(_0x14a4('0x7'));var rimraf=require(_0x14a4('0x8'));var config=require(_0x14a4('0x9'));var attributes=require('./faxInteraction.attributes');module[_0x14a4('0xa')]=function(_0x5dbffc,_0x3ef4d9){return _0x5dbffc[_0x14a4('0xb')]('FaxInteraction',attributes,{'tableName':_0x14a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23f6b6,_0x4c3eb2,_0x593323){if(_0x23f6b6[_0x14a4('0xd')](_0x14a4('0xe'))){_0x23f6b6[_0x14a4('0xf')]=moment()['format'](_0x14a4('0x10'));}_0x593323(null,_0x23f6b6);}}});}; \ No newline at end of file +var _0xc7e8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1169a2,_0x40226c){var _0x3b6ff1=function(_0x2f69f3){while(--_0x2f69f3){_0x1169a2['push'](_0x1169a2['shift']());}};_0x3b6ff1(++_0x40226c);}(_0xc7e8,0x78));var _0x8c7e=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xc7e8[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c7e('0x0'))(_0x8c7e('0x1'));var moment=require(_0x8c7e('0x2'));var BPromise=require(_0x8c7e('0x3'));var rp=require(_0x8c7e('0x4'));var fs=require('fs');var path=require(_0x8c7e('0x5'));var rimraf=require(_0x8c7e('0x6'));var config=require(_0x8c7e('0x7'));var attributes=require(_0x8c7e('0x8'));module[_0x8c7e('0x9')]=function(_0x1c91b6,_0x53e33d){return _0x1c91b6['define'](_0x8c7e('0xa'),attributes,{'tableName':_0x8c7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1271a3,_0x205c74,_0x5c2276){if(_0x1271a3['changed'](_0x8c7e('0xc'))){_0x1271a3[_0x8c7e('0xd')]=moment()['format'](_0x8c7e('0xe'));}_0x5c2276(null,_0x1271a3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1d0cf4a..9f4fb77 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 _0xd199=['register','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x3e4d5b,_0x10ff2f){var _0xf2591e=function(_0x12edb7){while(--_0x12edb7){_0x3e4d5b['push'](_0x3e4d5b['shift']());}};_0xf2591e(++_0x10ff2f);}(_0xd199,0x1bf));var _0x9d19=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd199[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9d19('0x0'));var util=require(_0x9d19('0x1'));var moment=require(_0x9d19('0x2'));var BPromise=require(_0x9d19('0x3'));var rs=require(_0x9d19('0x4'));var fs=require('fs');var Redis=require(_0x9d19('0x5'));var db=require(_0x9d19('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9d19('0x7'));var jayson=require(_0x9d19('0x8'));var client=jayson[_0x9d19('0x9')][_0x9d19('0xa')]({'port':0x232a});config['redis']=_[_0x9d19('0xb')](config[_0x9d19('0xc')],{'host':_0x9d19('0xd'),'port':0x18eb});var socket=require(_0x9d19('0xe'))(new Redis(config[_0x9d19('0xc')]));require('./faxInteraction.socket')[_0x9d19('0xf')](socket);function respondWithRpcPromise(_0x5528fc,_0x389635,_0x308d4a){return new BPromise(function(_0x5c6dc1,_0xa07bec){return client['request'](_0x5528fc,_0x308d4a)[_0x9d19('0x10')](function(_0x2ceeee){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x389635,_0x9d19('0x11'));logger[_0x9d19('0x12')](_0x9d19('0x13'),_0x389635,_0x9d19('0x11'),JSON['stringify'](_0x2ceeee));if(_0x2ceeee[_0x9d19('0x14')]){if(_0x2ceeee[_0x9d19('0x14')]['code']===0x1f4){logger['error'](_0x9d19('0x15'),_0x389635,_0x2ceeee[_0x9d19('0x14')][_0x9d19('0x16')]);return _0xa07bec(_0x2ceeee[_0x9d19('0x14')][_0x9d19('0x16')]);}logger[_0x9d19('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x389635,_0x2ceeee['error']['message']);return _0x5c6dc1(_0x2ceeee[_0x9d19('0x14')][_0x9d19('0x16')]);}else{logger[_0x9d19('0x17')](_0x9d19('0x15'),_0x389635,_0x9d19('0x11'));_0x5c6dc1(_0x2ceeee[_0x9d19('0x18')]['message']);}})[_0x9d19('0x19')](function(_0x1a3cc1){logger['error'](_0x9d19('0x15'),_0x389635,_0x1a3cc1);_0xa07bec(_0x1a3cc1);});});}exports[_0x9d19('0x1a')]=function(_0x54c261){var _0x52ed8f=this;return new Promise(function(_0x938c25,_0x362a71){return db['FaxInteraction'][_0x9d19('0x1b')](_0x54c261[_0x9d19('0x1c')],{'raw':_0x54c261[_0x9d19('0x1d')]?_0x54c261['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c261[_0x9d19('0x1d')]?_0x54c261[_0x9d19('0x1d')][_0x9d19('0x1e')]||null:null,'attributes':_0x54c261['options']?_0x54c261['options'][_0x9d19('0x1f')]||null:null,'limit':_0x54c261[_0x9d19('0x1d')]?_0x54c261[_0x9d19('0x1d')][_0x9d19('0x20')]||null:null})[_0x9d19('0x10')](function(_0x2ba142){logger[_0x9d19('0x17')](_0x9d19('0x1a'),_0x54c261);logger[_0x9d19('0x12')](_0x9d19('0x1a'),_0x54c261,JSON['stringify'](_0x2ba142));_0x938c25(_0x2ba142);})[_0x9d19('0x19')](function(_0x3a3fab){logger[_0x9d19('0x14')](_0x9d19('0x1a'),_0x3a3fab[_0x9d19('0x16')],_0x54c261);_0x362a71(_0x52ed8f[_0x9d19('0x14')](0x1f4,_0x3a3fab[_0x9d19('0x16')]));});});};exports[_0x9d19('0x21')]=function(_0x1fe0dc){return new Promise(function(_0x27a696,_0x55dc9d){return db[_0x9d19('0x22')][_0x9d19('0x23')]({'where':_0x1fe0dc['options']?_0x1fe0dc['options'][_0x9d19('0x1e')]||null:null})[_0x9d19('0x10')](function(_0x130be6){if(_0x130be6){return _0x130be6[_0x9d19('0x24')](_0x1fe0dc[_0x9d19('0x1c')][_0x9d19('0x25')],_[_0x9d19('0x26')](_0x1fe0dc[_0x9d19('0x1c')],[_0x9d19('0x25'),'id'])||{});}})[_0x9d19('0x27')](function(_0x4c3933){logger[_0x9d19('0x17')](_0x9d19('0x28'),_0x1fe0dc);logger[_0x9d19('0x12')]('AddTags',_0x1fe0dc,JSON[_0x9d19('0x29')](_0x4c3933));_0x27a696(_0x4c3933);})[_0x9d19('0x19')](function(_0x3c6d68){logger[_0x9d19('0x14')]('AddTags',_0x3c6d68[_0x9d19('0x16')],_0x1fe0dc);_0x55dc9d(_this['error'](0x1f4,_0x3c6d68[_0x9d19('0x16')]));});});}; \ No newline at end of file +var _0xdea3=['FaxInteraction','options','raw','where','attributes','limit','AddTagsToFaxInteraction','body','ids','omit','AddTags','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxInteraction'];(function(_0x114f3d,_0x4d953f){var _0x2e8d7e=function(_0x3e4fa9){while(--_0x3e4fa9){_0x114f3d['push'](_0x114f3d['shift']());}};_0x2e8d7e(++_0x4d953f);}(_0xdea3,0xa4));var _0x3dea=function(_0x238a91,_0x34a72f){_0x238a91=_0x238a91-0x0;var _0x5b8144=_0xdea3[_0x238a91];return _0x5b8144;};'use strict';var _=require('lodash');var util=require(_0x3dea('0x0'));var moment=require('moment');var BPromise=require(_0x3dea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dea('0x2'));var db=require(_0x3dea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dea('0x4'))(_0x3dea('0x5'));var config=require(_0x3dea('0x6'));var jayson=require(_0x3dea('0x7'));var client=jayson[_0x3dea('0x8')][_0x3dea('0x9')]({'port':0x232a});config[_0x3dea('0xa')]=_['defaults'](config[_0x3dea('0xa')],{'host':_0x3dea('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3dea('0xa')]));require(_0x3dea('0xc'))[_0x3dea('0xd')](socket);function respondWithRpcPromise(_0x379e19,_0x5795a0,_0xad66df){return new BPromise(function(_0x253cde,_0x1fc2fd){return client[_0x3dea('0xe')](_0x379e19,_0xad66df)[_0x3dea('0xf')](function(_0x500e7d){logger[_0x3dea('0x10')](_0x3dea('0x11'),_0x5795a0,_0x3dea('0x12'));logger[_0x3dea('0x13')](_0x3dea('0x14'),_0x5795a0,_0x3dea('0x12'),JSON[_0x3dea('0x15')](_0x500e7d));if(_0x500e7d[_0x3dea('0x16')]){if(_0x500e7d[_0x3dea('0x16')]['code']===0x1f4){logger[_0x3dea('0x16')](_0x3dea('0x11'),_0x5795a0,_0x500e7d[_0x3dea('0x16')]['message']);return _0x1fc2fd(_0x500e7d[_0x3dea('0x16')][_0x3dea('0x17')]);}logger[_0x3dea('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5795a0,_0x500e7d[_0x3dea('0x16')][_0x3dea('0x17')]);return _0x253cde(_0x500e7d[_0x3dea('0x16')][_0x3dea('0x17')]);}else{logger['info'](_0x3dea('0x11'),_0x5795a0,_0x3dea('0x12'));_0x253cde(_0x500e7d[_0x3dea('0x18')]['message']);}})['catch'](function(_0x1ba116){logger[_0x3dea('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5795a0,_0x1ba116);_0x1fc2fd(_0x1ba116);});});}exports[_0x3dea('0x19')]=function(_0x369f05){var _0x4abe9e=this;return new Promise(function(_0xc0c8c,_0x29508c){return db[_0x3dea('0x1a')]['update'](_0x369f05['body'],{'raw':_0x369f05[_0x3dea('0x1b')]?_0x369f05[_0x3dea('0x1b')][_0x3dea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x369f05[_0x3dea('0x1b')]?_0x369f05['options'][_0x3dea('0x1d')]||null:null,'attributes':_0x369f05['options']?_0x369f05['options'][_0x3dea('0x1e')]||null:null,'limit':_0x369f05[_0x3dea('0x1b')]?_0x369f05[_0x3dea('0x1b')][_0x3dea('0x1f')]||null:null})[_0x3dea('0xf')](function(_0x12a7df){logger['info'](_0x3dea('0x19'),_0x369f05);logger[_0x3dea('0x13')](_0x3dea('0x19'),_0x369f05,JSON[_0x3dea('0x15')](_0x12a7df));_0xc0c8c(_0x12a7df);})['catch'](function(_0x557e5c){logger['error'](_0x3dea('0x19'),_0x557e5c[_0x3dea('0x17')],_0x369f05);_0x29508c(_0x4abe9e[_0x3dea('0x16')](0x1f4,_0x557e5c['message']));});});};exports[_0x3dea('0x20')]=function(_0x1d8123){return new Promise(function(_0x4d83fc,_0x4efd25){return db[_0x3dea('0x1a')]['find']({'where':_0x1d8123['options']?_0x1d8123[_0x3dea('0x1b')][_0x3dea('0x1d')]||null:null})[_0x3dea('0xf')](function(_0x638ce9){if(_0x638ce9){return _0x638ce9['addTags'](_0x1d8123[_0x3dea('0x21')][_0x3dea('0x22')],_[_0x3dea('0x23')](_0x1d8123[_0x3dea('0x21')],[_0x3dea('0x22'),'id'])||{});}})['spread'](function(_0x4f3418){logger[_0x3dea('0x10')](_0x3dea('0x24'),_0x1d8123);logger[_0x3dea('0x13')]('AddTags',_0x1d8123,JSON[_0x3dea('0x15')](_0x4f3418));_0x4d83fc(_0x4f3418);})[_0x3dea('0x25')](function(_0x121649){logger[_0x3dea('0x16')](_0x3dea('0x24'),_0x121649[_0x3dea('0x17')],_0x1d8123);_0x4efd25(_this[_0x3dea('0x16')](0x1f4,_0x121649[_0x3dea('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 648890b..e8533a9 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 _0x8313=['faxInteraction:','./faxInteraction.events','remove','update','removeListener','register','length'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x8313,0x94));var _0x3831=function(_0x233975,_0x808eff){_0x233975=_0x233975-0x0;var _0x3dd8fa=_0x8313[_0x233975];return _0x3dd8fa;};'use strict';var FaxInteractionEvents=require(_0x3831('0x0'));var events=['save',_0x3831('0x1'),_0x3831('0x2')];function createListener(_0x43ebd6,_0x590968){return function(_0x535895){_0x590968['emit'](_0x43ebd6,_0x535895);};}function removeListener(_0x15f267,_0x550367){return function(){FaxInteractionEvents[_0x3831('0x3')](_0x15f267,_0x550367);};}exports[_0x3831('0x4')]=function(_0x2b86f1){for(var _0x292f9b=0x0,_0x193fb3=events[_0x3831('0x5')];_0x292f9b<_0x193fb3;_0x292f9b++){var _0x4c5d53=events[_0x292f9b];var _0xaefad6=createListener(_0x3831('0x6')+_0x4c5d53,_0x2b86f1);FaxInteractionEvents['on'](_0x4c5d53,_0xaefad6);}}; \ No newline at end of file +var _0x365a=['emit','removeListener','register','length','faxInteraction:','remove','update'];(function(_0xf6f17e,_0xa50445){var _0x2ceb96=function(_0x303066){while(--_0x303066){_0xf6f17e['push'](_0xf6f17e['shift']());}};_0x2ceb96(++_0xa50445);}(_0x365a,0x9f));var _0xa365=function(_0x367ddc,_0x573e19){_0x367ddc=_0x367ddc-0x0;var _0xcfff0c=_0x365a[_0x367ddc];return _0xcfff0c;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xa365('0x0'),_0xa365('0x1')];function createListener(_0x39e2ae,_0x5145af){return function(_0x1fe9af){_0x5145af[_0xa365('0x2')](_0x39e2ae,_0x1fe9af);};}function removeListener(_0x38c10a,_0x43d2fe){return function(){FaxInteractionEvents[_0xa365('0x3')](_0x38c10a,_0x43d2fe);};}exports[_0xa365('0x4')]=function(_0x52da9a){for(var _0x54d868=0x0,_0x2cac80=events[_0xa365('0x5')];_0x54d868<_0x2cac80;_0x54d868++){var _0x33c24a=events[_0x54d868];var _0x57c4cd=createListener(_0xa365('0x6')+_0x33c24a,_0x52da9a);FaxInteractionEvents['on'](_0x33c24a,_0x57c4cd);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7b1ed61..ec30590 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 _0xdd01=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','update','destroy','removeTags'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xdd01,0x137));var _0x1dd0=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xdd01[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x1dd0('0x0'));var path=require(_0x1dd0('0x1'));var timeout=require(_0x1dd0('0x2'));var express=require(_0x1dd0('0x3'));var router=express['Router']();var fs_extra=require(_0x1dd0('0x4'));var auth=require(_0x1dd0('0x5'));var interaction=require(_0x1dd0('0x6'));var config=require(_0x1dd0('0x7'));var controller=require(_0x1dd0('0x8'));router[_0x1dd0('0x9')]('/',auth[_0x1dd0('0xa')](),controller[_0x1dd0('0xb')]);router[_0x1dd0('0x9')]('/describe',auth[_0x1dd0('0xa')](),controller[_0x1dd0('0xc')]);router[_0x1dd0('0x9')](_0x1dd0('0xd'),auth[_0x1dd0('0xa')](),controller[_0x1dd0('0xe')]);router[_0x1dd0('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1dd0('0xf')]);router['get'](_0x1dd0('0x10'),auth['isAuthenticated'](),controller[_0x1dd0('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1dd0('0x12')]);router[_0x1dd0('0x13')](_0x1dd0('0x14'),auth[_0x1dd0('0xa')](),controller[_0x1dd0('0x15')]);router['post'](_0x1dd0('0x16'),auth['isAuthenticated'](),interaction[_0x1dd0('0x17')](_0x1dd0('0x18'),'faxinteraction:addtags'),controller['addTags']);router[_0x1dd0('0x19')](_0x1dd0('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x1dd0('0x18'),_0x1dd0('0x1a')),controller[_0x1dd0('0x1b')]);router['delete'](_0x1dd0('0xd'),auth[_0x1dd0('0xa')](),interaction[_0x1dd0('0x17')]('fax','faxinteraction:destroy'),controller[_0x1dd0('0x1c')]);router['delete'](_0x1dd0('0x16'),auth['isAuthenticated'](),controller[_0x1dd0('0x1d')]);module[_0x1dd0('0x1e')]=router; \ No newline at end of file +var _0x4e3f=['fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked'];(function(_0xa6b3c0,_0x25085d){var _0x92e041=function(_0x3d72bd){while(--_0x3d72bd){_0xa6b3c0['push'](_0xa6b3c0['shift']());}};_0x92e041(++_0x25085d);}(_0x4e3f,0x11c));var _0xf4e3=function(_0x40bd32,_0x1c3aca){_0x40bd32=_0x40bd32-0x0;var _0x1e7558=_0x4e3f[_0x40bd32];return _0x1e7558;};'use strict';var multer=require(_0xf4e3('0x0'));var util=require(_0xf4e3('0x1'));var path=require(_0xf4e3('0x2'));var timeout=require(_0xf4e3('0x3'));var express=require(_0xf4e3('0x4'));var router=express[_0xf4e3('0x5')]();var fs_extra=require(_0xf4e3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf4e3('0x7'));var config=require(_0xf4e3('0x8'));var controller=require(_0xf4e3('0x9'));router[_0xf4e3('0xa')]('/',auth[_0xf4e3('0xb')](),controller['index']);router[_0xf4e3('0xa')](_0xf4e3('0xc'),auth['isAuthenticated'](),controller[_0xf4e3('0xd')]);router[_0xf4e3('0xa')]('/:id',auth[_0xf4e3('0xb')](),controller[_0xf4e3('0xe')]);router[_0xf4e3('0xa')](_0xf4e3('0xf'),auth['isAuthenticated'](),controller[_0xf4e3('0x10')]);router[_0xf4e3('0xa')](_0xf4e3('0x11'),auth[_0xf4e3('0xb')](),controller[_0xf4e3('0x12')]);router[_0xf4e3('0x13')]('/',auth[_0xf4e3('0xb')](),controller[_0xf4e3('0x14')]);router[_0xf4e3('0x13')](_0xf4e3('0xf'),auth[_0xf4e3('0xb')](),controller['addMessage']);router['post']('/:id/tags',auth[_0xf4e3('0xb')](),interaction[_0xf4e3('0x15')](_0xf4e3('0x16'),_0xf4e3('0x17')),controller[_0xf4e3('0x18')]);router[_0xf4e3('0x19')](_0xf4e3('0x1a'),auth[_0xf4e3('0xb')](),interaction[_0xf4e3('0x15')](_0xf4e3('0x16'),_0xf4e3('0x1b')),controller['update']);router['delete'](_0xf4e3('0x1a'),auth[_0xf4e3('0xb')](),interaction[_0xf4e3('0x15')](_0xf4e3('0x16'),_0xf4e3('0x1c')),controller[_0xf4e3('0x1d')]);router[_0xf4e3('0x1e')](_0xf4e3('0x1f'),auth['isAuthenticated'](),controller[_0xf4e3('0x20')]);module[_0xf4e3('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 0969640..dbe90be 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 _0x430e=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x430e,0x105));var _0xe430=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x430e[_0x17fea7];return _0x3150c3;};'use strict';var Sequelize=require('sequelize');module[_0xe430('0x0')]={'body':{'type':Sequelize[_0xe430('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe430('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe430('0x3')]('in',_0xe430('0x4')),'defaultValue':_0xe430('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe430('0x5')]}}; \ No newline at end of file +var _0x8a9c=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x26aaca,_0x36d870){var _0x481d1b=function(_0xcdef0c){while(--_0xcdef0c){_0x26aaca['push'](_0x26aaca['shift']());}};_0x481d1b(++_0x36d870);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8a9('0x0'));module[_0xc8a9('0x1')]={'body':{'type':Sequelize[_0xc8a9('0x2')](_0xc8a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc8a9('0x5')),'defaultValue':_0xc8a9('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xc8a9('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index bd13dd7..404b91f 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 _0xfb1e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','stack','name','send','map','FaxMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','params','update','body','find','destroy','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','eml-format','rimraf'];(function(_0x30781e,_0x48457f){var _0x22da8c=function(_0x80a5c7){while(--_0x80a5c7){_0x30781e['push'](_0x30781e['shift']());}};_0x22da8c(++_0x48457f);}(_0xfb1e,0x124));var _0xefb1=function(_0x44c995,_0x1c2add){_0x44c995=_0x44c995-0x0;var _0xa18619=_0xfb1e[_0x44c995];return _0xa18619;};'use strict';var emlformat=require(_0xefb1('0x0'));var rimraf=require(_0xefb1('0x1'));var zipdir=require(_0xefb1('0x2'));var jsonpatch=require(_0xefb1('0x3'));var rp=require(_0xefb1('0x4'));var moment=require(_0xefb1('0x5'));var BPromise=require(_0xefb1('0x6'));var Mustache=require('mustache');var util=require(_0xefb1('0x7'));var path=require(_0xefb1('0x8'));var sox=require(_0xefb1('0x9'));var csv=require(_0xefb1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefb1('0xb'));var _=require(_0xefb1('0xc'));var squel=require(_0xefb1('0xd'));var crypto=require(_0xefb1('0xe'));var jsforce=require(_0xefb1('0xf'));var deskjs=require(_0xefb1('0x10'));var toCsv=require(_0xefb1('0xa'));var querystring=require(_0xefb1('0x11'));var Papa=require(_0xefb1('0x12'));var Redis=require(_0xefb1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xefb1('0x14'));var as=require(_0xefb1('0x15'));var hardwareService=require(_0xefb1('0x16'));var logger=require(_0xefb1('0x17'))(_0xefb1('0x18'));var utils=require(_0xefb1('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xefb1('0x1a'));var db=require(_0xefb1('0x1b'))['db'];config[_0xefb1('0x1c')]=_[_0xefb1('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xefb1('0x1e'))(new Redis(config[_0xefb1('0x1c')]));require(_0xefb1('0x1f'))[_0xefb1('0x20')](socket);var jayson=require(_0xefb1('0x21'));var client=jayson[_0xefb1('0x22')][_0xefb1('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xefb1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3fa724,_0x549b1a,_0x79c3b,_0x2547be){return new BPromise(function(_0x3abe76,_0x50c2db){var _0x5009dd=_0x2547be||client;return _0x5009dd[_0xefb1('0x24')](_0x3fa724,_0x79c3b)['then'](function(_0x22c724){logger['info'](_0xefb1('0x25'),_0x549b1a,_0xefb1('0x26'));logger['debug'](_0xefb1('0x27'),_0x549b1a,_0xefb1('0x26'),JSON[_0xefb1('0x28')](_0x22c724));if(_0x22c724[_0xefb1('0x29')]){if(_0x22c724['error'][_0xefb1('0x2a')]===0x1f4){logger[_0xefb1('0x29')](_0xefb1('0x25'),_0x549b1a,_0x22c724[_0xefb1('0x29')][_0xefb1('0x2b')]);return _0x50c2db(_0x22c724['error'][_0xefb1('0x2b')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x549b1a,_0x22c724['error'][_0xefb1('0x2b')]);return _0x3abe76(_0x22c724[_0xefb1('0x29')][_0xefb1('0x2b')]);}else{logger['info'](_0xefb1('0x25'),_0x549b1a,_0xefb1('0x26'));_0x3abe76(_0x22c724[_0xefb1('0x2c')][_0xefb1('0x2b')]);}})[_0xefb1('0x2d')](function(_0x2bf228){logger[_0xefb1('0x29')]('FaxMessage,\x20%s,\x20%s',_0x549b1a,_0x2bf228);_0x50c2db(_0x2bf228);});});}function respondWithStatusCode(_0x5c3584,_0x2b9d70){_0x2b9d70=_0x2b9d70||0xcc;return function(_0x291af1){if(_0x291af1){return _0x5c3584[_0xefb1('0x2e')](_0x2b9d70);}return _0x5c3584[_0xefb1('0x2f')](_0x2b9d70)[_0xefb1('0x30')]();};}function respondWithResult(_0x2266bb,_0x2fea28){_0x2fea28=_0x2fea28||0xc8;return function(_0x2fb199){if(_0x2fb199){return _0x2266bb[_0xefb1('0x2f')](_0x2fea28)[_0xefb1('0x31')](_0x2fb199);}};}function respondWithFilteredResult(_0x11b61c,_0xc60683){return function(_0x560c7a){if(_0x560c7a){var _0x46a80b=typeof _0xc60683[_0xefb1('0x32')]==='undefined'&&typeof _0xc60683[_0xefb1('0x33')]===_0xefb1('0x34');var _0x52cff1=_0x560c7a[_0xefb1('0x35')];var _0x5bafd4=_0x46a80b?0x0:_0xc60683[_0xefb1('0x32')];var _0x2099ff=_0x46a80b?_0x560c7a['count']:_0xc60683[_0xefb1('0x32')]+_0xc60683[_0xefb1('0x33')];var _0x215019;if(_0x2099ff>=_0x52cff1){_0x2099ff=_0x52cff1;_0x215019=0xc8;}else{_0x215019=0xce;}_0x11b61c[_0xefb1('0x2f')](_0x215019);return _0x11b61c[_0xefb1('0x36')](_0xefb1('0x37'),_0x5bafd4+'-'+_0x2099ff+'/'+_0x52cff1)['json'](_0x560c7a);}return null;};}function patchUpdates(_0x4fe6cf){return function(_0x55139d){try{jsonpatch[_0xefb1('0x38')](_0x55139d,_0x4fe6cf,!![]);}catch(_0x250c37){return BPromise[_0xefb1('0x39')](_0x250c37);}return _0x55139d[_0xefb1('0x3a')]();};}function saveUpdates(_0x6b0fc2,_0x101cbd){return function(_0x1c6170){if(_0x1c6170){return _0x1c6170['update'](_0x6b0fc2)[_0xefb1('0x3b')](function(_0xad6ea3){return _0xad6ea3;});}return null;};}function removeEntity(_0x2ace7d,_0x55dadd){return function(_0x1cbb35){if(_0x1cbb35){return _0x1cbb35['destroy']()[_0xefb1('0x3b')](function(){_0x2ace7d['status'](0xcc)[_0xefb1('0x30')]();});}};}function handleEntityNotFound(_0x1ae00f,_0x1447ce){return function(_0x3ebc60){if(!_0x3ebc60){_0x1ae00f['sendStatus'](0x194);}return _0x3ebc60;};}function handleError(_0x8cf1a4,_0x1ce768){_0x1ce768=_0x1ce768||0x1f4;return function(_0xb14707){logger[_0xefb1('0x29')](_0xb14707[_0xefb1('0x3c')]);if(_0xb14707[_0xefb1('0x3d')]){delete _0xb14707[_0xefb1('0x3d')];}_0x8cf1a4[_0xefb1('0x2f')](_0x1ce768)[_0xefb1('0x3e')](_0xb14707);};}exports['index']=function(_0x4e67e1,_0x3d97dd){var _0x40b2aa={},_0x2c1c89={},_0x5f4d81={'count':0x0,'rows':[]};var _0x2e261a=_[_0xefb1('0x3f')](db[_0xefb1('0x40')][_0xefb1('0x41')],function(_0x35f0bf){return{'name':_0x35f0bf['fieldName'],'type':_0x35f0bf[_0xefb1('0x42')]['key']};});_0x2c1c89[_0xefb1('0x43')]=_[_0xefb1('0x3f')](_0x2e261a,'name');_0x2c1c89[_0xefb1('0x44')]=_[_0xefb1('0x45')](_0x4e67e1[_0xefb1('0x44')]);_0x2c1c89[_0xefb1('0x46')]=_['intersection'](_0x2c1c89['model'],_0x2c1c89['query']);_0x40b2aa[_0xefb1('0x47')]=_[_0xefb1('0x48')](_0x2c1c89[_0xefb1('0x43')],qs[_0xefb1('0x49')](_0x4e67e1[_0xefb1('0x44')]['fields']));_0x40b2aa[_0xefb1('0x47')]=_0x40b2aa['attributes'][_0xefb1('0x4a')]?_0x40b2aa[_0xefb1('0x47')]:_0x2c1c89[_0xefb1('0x43')];if(!_0x4e67e1[_0xefb1('0x44')][_0xefb1('0x4b')](_0xefb1('0x4c'))){_0x40b2aa[_0xefb1('0x33')]=qs['limit'](_0x4e67e1['query'][_0xefb1('0x33')]);_0x40b2aa[_0xefb1('0x32')]=qs[_0xefb1('0x32')](_0x4e67e1['query']['offset']);}_0x40b2aa[_0xefb1('0x4d')]=qs['sort'](_0x4e67e1[_0xefb1('0x44')][_0xefb1('0x4e')]);_0x40b2aa['where']=qs['filters'](_[_0xefb1('0x4f')](_0x4e67e1['query'],_0x2c1c89['filters']),_0x2e261a);if(_0x4e67e1[_0xefb1('0x44')][_0xefb1('0x50')]){_0x40b2aa[_0xefb1('0x51')]=_[_0xefb1('0x52')](_0x40b2aa[_0xefb1('0x51')],{'$or':_[_0xefb1('0x3f')](_0x2e261a,function(_0x3f92cd){if(_0x3f92cd[_0xefb1('0x42')]!==_0xefb1('0x53')){var _0x206b9f={};_0x206b9f[_0x3f92cd[_0xefb1('0x3d')]]={'$like':'%'+_0x4e67e1[_0xefb1('0x44')][_0xefb1('0x50')]+'%'};return _0x206b9f;}})});}_0x40b2aa=_[_0xefb1('0x52')]({},_0x40b2aa,_0x4e67e1[_0xefb1('0x54')]);var _0x1cf686={'where':_0x40b2aa['where']};return db['FaxMessage']['count'](_0x1cf686)[_0xefb1('0x3b')](function(_0x199387){_0x5f4d81[_0xefb1('0x35')]=_0x199387;if(_0x4e67e1['query'][_0xefb1('0x55')]){_0x40b2aa[_0xefb1('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x40b2aa);})[_0xefb1('0x3b')](function(_0x48431b){_0x5f4d81['rows']=_0x48431b;return _0x5f4d81;})['then'](respondWithFilteredResult(_0x3d97dd,_0x40b2aa))[_0xefb1('0x2d')](handleError(_0x3d97dd,null));};exports['show']=function(_0x210ff3,_0x2aae2c){var _0x5b143f={'raw':!![],'where':{'id':_0x210ff3[_0xefb1('0x57')]['id']}},_0xdf58e9={};_0xdf58e9[_0xefb1('0x43')]=_[_0xefb1('0x45')](db[_0xefb1('0x40')][_0xefb1('0x41')]);_0xdf58e9[_0xefb1('0x44')]=_[_0xefb1('0x45')](_0x210ff3[_0xefb1('0x44')]);_0xdf58e9[_0xefb1('0x46')]=_[_0xefb1('0x48')](_0xdf58e9['model'],_0xdf58e9[_0xefb1('0x44')]);_0x5b143f[_0xefb1('0x47')]=_[_0xefb1('0x48')](_0xdf58e9['model'],qs[_0xefb1('0x49')](_0x210ff3[_0xefb1('0x44')]['fields']));_0x5b143f[_0xefb1('0x47')]=_0x5b143f[_0xefb1('0x47')][_0xefb1('0x4a')]?_0x5b143f[_0xefb1('0x47')]:_0xdf58e9[_0xefb1('0x43')];if(_0x210ff3['query'][_0xefb1('0x55')]){_0x5b143f[_0xefb1('0x56')]=[{'all':!![]}];}_0x5b143f=_['merge']({},_0x5b143f,_0x210ff3[_0xefb1('0x54')]);return db[_0xefb1('0x40')]['find'](_0x5b143f)[_0xefb1('0x3b')](handleEntityNotFound(_0x2aae2c,null))[_0xefb1('0x3b')](respondWithResult(_0x2aae2c,null))[_0xefb1('0x2d')](handleError(_0x2aae2c,null));};exports[_0xefb1('0x58')]=function(_0x4911fd,_0x5a00db){if(_0x4911fd[_0xefb1('0x59')]['id']){delete _0x4911fd[_0xefb1('0x59')]['id'];}return db[_0xefb1('0x40')][_0xefb1('0x5a')]({'where':{'id':_0x4911fd[_0xefb1('0x57')]['id']}})[_0xefb1('0x3b')](handleEntityNotFound(_0x5a00db,null))['then'](saveUpdates(_0x4911fd[_0xefb1('0x59')],null))['then'](respondWithResult(_0x5a00db,null))[_0xefb1('0x2d')](handleError(_0x5a00db,null));};exports[_0xefb1('0x5b')]=function(_0x575b9e,_0x3e4f71){return db['FaxMessage'][_0xefb1('0x5a')]({'where':{'id':_0x575b9e[_0xefb1('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e4f71,null))[_0xefb1('0x3b')](removeEntity(_0x3e4f71,null))[_0xefb1('0x2d')](handleError(_0x3e4f71,null));};exports[_0xefb1('0x5c')]=function(_0x330f93,_0x11be71){return db[_0xefb1('0x40')][_0xefb1('0x5c')]()[_0xefb1('0x3b')](respondWithResult(_0x11be71,null))[_0xefb1('0x2d')](handleError(_0x11be71,null));};var interaction_log=require(_0xefb1('0x17'))(_0xefb1('0x5d'));exports['accept']=function(_0x2c93fb,_0x5a3ed9,_0x5cf7de){var _0x46d9bf={'agent':{},'channel':'fax'};if(_0x2c93fb[_0xefb1('0x59')]['id']){delete _0x2c93fb[_0xefb1('0x59')]['id'];}_0x2c93fb['body'][_0xefb1('0x5e')]=!![];_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x5f')]=moment()[_0xefb1('0x60')](_0xefb1('0x61'));_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x62')]=_0x2c93fb[_0xefb1('0x59')]['UserId']||_0x2c93fb[_0xefb1('0x63')]['id'];_0x46d9bf['agent']['id']=_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x62')];return db[_0xefb1('0x40')][_0xefb1('0x5a')]({'where':{'id':_0x2c93fb[_0xefb1('0x57')]['id'],'UserId':null}})[_0xefb1('0x3b')](handleEntityNotFound(_0x5a3ed9,null))['then'](saveUpdates(_0x2c93fb[_0xefb1('0x59')],null))['then'](function(_0x424f01){if(_0x424f01){_0x46d9bf[_0xefb1('0x2b')]=_0x424f01[_0xefb1('0x64')]({'plain':!![]});return db['FaxInteraction'][_0xefb1('0x5a')]({'where':{'id':_0x424f01[_0xefb1('0x65')]}});}return null;})[_0xefb1('0x3b')](handleEntityNotFound(_0x5a3ed9,null))['then'](function(_0x293ebb){if(_0x293ebb){return _0x293ebb[_0xefb1('0x58')]({'UserId':_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x62')],'read1stAt':_[_0xefb1('0x66')](_0x293ebb[_0xefb1('0x67')])?moment()[_0xefb1('0x60')](_0xefb1('0x61')):undefined});}return null;})['then'](function(_0x3ebbf1){if(_0x3ebbf1){_0x46d9bf[_0xefb1('0x68')]=_0x3ebbf1[_0xefb1('0x64')]({'plain':!![]});interaction_log['info'](_0xefb1('0x69'),_0x2c93fb[_0xefb1('0x63')]['id'],_0x2c93fb[_0xefb1('0x63')]['name'],_0x2c93fb[_0xefb1('0x63')][_0xefb1('0x6a')],_0x46d9bf[_0xefb1('0x68')]['id'],_0x2c93fb[_0xefb1('0x59')]?JSON[_0xefb1('0x28')](_0x2c93fb[_0xefb1('0x59')]):_0xefb1('0x6b'));return respondWithRpcPromise(_0xefb1('0x6c'),_0xefb1('0x6d'),_0x46d9bf);}return null;})['then'](function(_0xebade3){var _0x12ec31=_0xefb1('0x6e')+_0xebade3[_0xefb1('0x2b')][_0xefb1('0x6f')];return db[_0xefb1('0x70')][_0xefb1('0x44')](_0x12ec31,{'type':db['Sequelize'][_0xefb1('0x71')][_0xefb1('0x72')],'raw':!![]})[_0xefb1('0x3b')](function(_0x5e86cd){return _0x5e86cd;});})[_0xefb1('0x3b')](function(_0x355da7){if(_0x355da7){_0x46d9bf['message']['contact']=_0x355da7[0x0];if(!_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x62')])return;return db['User'][_0xefb1('0x5a')]({'where':{'id':_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x62')],'role':_0xefb1('0x73')},'attributes':['id','name',_0xefb1('0x74'),_0xefb1('0x75'),_0xefb1('0x76')],'raw':!![]});}return null;})[_0xefb1('0x3b')](function(_0x5482a2){if(!_0x5482a2)return null;_0x46d9bf['message'][_0xefb1('0x73')]=_0x5482a2;return _0x46d9bf;})['then'](function(_0x1b3223){if(_0x1b3223){if(_0x2c93fb[_0xefb1('0x59')][_0xefb1('0x77')]){_0x46d9bf['message'][_0xefb1('0x78')]=util[_0xefb1('0x60')](_0xefb1('0x79'),_0x2c93fb['user'][_0xefb1('0x3d')]);_0x46d9bf[_0xefb1('0x2b')][_0xefb1('0x7a')]=_0x46d9bf[_0xefb1('0x7a')];_0x46d9bf['message'][_0xefb1('0x7b')]=_0x46d9bf['channel'];_0x46d9bf[_0xefb1('0x2b')][_0xefb1('0x7c')]=_0xefb1('0x7d');return respondWithRpcPromise('EventManager',_0xefb1('0x7e'),{'event':_0xefb1('0x7f'),'message':_0x46d9bf['message']},client9002)[_0xefb1('0x3b')](function(){return _0x46d9bf;});}return _0x46d9bf;}return null;})['then'](respondWithResult(_0x5a3ed9,null))[_0xefb1('0x2d')](handleError(_0x5a3ed9,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xefb1('0x39')]=function(_0x17b2c9,_0x9c8b6e,_0x27ef97){var _0x70a79a={'agent':{},'channel':_0xefb1('0x80')};if(_0x17b2c9[_0xefb1('0x59')]['id']){delete _0x17b2c9['body']['id'];}_0x17b2c9[_0xefb1('0x59')][_0xefb1('0x62')]=_0x17b2c9[_0xefb1('0x59')]['UserId']||_0x17b2c9['user']['id'];_0x70a79a['agent']['id']=_0x17b2c9[_0xefb1('0x59')][_0xefb1('0x62')];return db[_0xefb1('0x40')][_0xefb1('0x5a')]({'where':{'id':_0x17b2c9[_0xefb1('0x57')]['id'],'UserId':null}})[_0xefb1('0x3b')](handleEntityNotFound(_0x9c8b6e,null))['then'](function(_0xd3be3f){if(_0xd3be3f){_0x70a79a[_0xefb1('0x2b')]=_0xd3be3f[_0xefb1('0x64')]({'plain':!![]});return db[_0xefb1('0x81')][_0xefb1('0x5a')]({'where':{'id':_0xd3be3f['FaxInteractionId']}});}return null;})[_0xefb1('0x3b')](handleEntityNotFound(_0x9c8b6e,null))[_0xefb1('0x3b')](function(_0x31d84b){if(_0x31d84b){_0x70a79a[_0xefb1('0x68')]=_0x31d84b[_0xefb1('0x64')]({'plain':!![]});interaction_log['info'](_0xefb1('0x82'),_0x17b2c9[_0xefb1('0x63')]['id'],_0x17b2c9[_0xefb1('0x63')][_0xefb1('0x3d')],_0x17b2c9[_0xefb1('0x63')]['role'],_0x70a79a[_0xefb1('0x68')]['id'],_0x17b2c9[_0xefb1('0x59')]?JSON[_0xefb1('0x28')](_0x17b2c9[_0xefb1('0x59')]):_0xefb1('0x6b'));return respondWithRpcPromise(_0xefb1('0x83'),'rejectMessage',_0x70a79a);}return null;})[_0xefb1('0x3b')](function(_0x42c131){var _0x414e59='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42c131[_0xefb1('0x2b')][_0xefb1('0x6f')];return db[_0xefb1('0x70')][_0xefb1('0x44')](_0x414e59,{'type':db['Sequelize'][_0xefb1('0x71')][_0xefb1('0x72')],'raw':!![]})[_0xefb1('0x3b')](function(_0x24ad5a){return _0x24ad5a;});})[_0xefb1('0x3b')](function(_0x204759){if(_0x204759){_0x70a79a['message'][_0xefb1('0x84')]=_0x204759[0x0];if(!_0x17b2c9['body'][_0xefb1('0x62')])return;return db['User']['find']({'where':{'id':_0x17b2c9[_0xefb1('0x59')]['UserId'],'role':_0xefb1('0x73')},'attributes':['id',_0xefb1('0x3d'),'fullname',_0xefb1('0x75'),_0xefb1('0x76')],'raw':!![]});}return null;})['then'](function(_0x1de158){if(!_0x1de158)return null;_0x70a79a[_0xefb1('0x2b')][_0xefb1('0x73')]=_0x1de158;return _0x70a79a;})[_0xefb1('0x3b')](function(_0x29439b){if(_0x29439b){_0x29439b[_0xefb1('0x2b')]['interface']=util[_0xefb1('0x60')]('SIP/%s',_0x17b2c9['user'][_0xefb1('0x3d')]);_0x29439b['message'][_0xefb1('0x7a')]=_0x70a79a[_0xefb1('0x7a')];_0x29439b[_0xefb1('0x2b')][_0xefb1('0x7b')]=_0x70a79a[_0xefb1('0x7a')];_0x29439b[_0xefb1('0x2b')][_0xefb1('0x7c')]=_0xefb1('0x39');respondWithRpcPromise(_0xefb1('0x7e'),_0xefb1('0x7e'),{'event':'rejectmessage','message':_0x29439b[_0xefb1('0x2b')]},client9002);return _0x70a79a;}return null;})['then'](respondWithResult(_0x9c8b6e,null))[_0xefb1('0x2d')](handleError(_0x9c8b6e,null));};exports['create']=function(_0x503d5a,_0x4021c0){var _0x2a985b;return db[_0xefb1('0x40')][_0xefb1('0x85')](_0x503d5a[_0xefb1('0x59')],{})['then'](function(_0x4ce7cc){_0x2a985b=_0x4ce7cc;return db[_0xefb1('0x86')][_0xefb1('0x87')]({'where':{'id':_0x2a985b[_0xefb1('0x6f')]}});})['then'](function(_0x1e6c66){if(_[_0xefb1('0x66')](_0x1e6c66)){return;}else{_0x2a985b[_0xefb1('0x80')]=_0x1e6c66[_0xefb1('0x80')];return db[_0xefb1('0x88')][_0xefb1('0x87')]({'where':{'id':_0x2a985b[_0xefb1('0x89')]}});}})['then'](function(_0x4baea4){return respondWithRpcPromise(_0xefb1('0x8a'),_0xefb1('0x8a'),{'FaxAccountId':_['isNil'](_0x503d5a['body'])?undefined:_0x503d5a[_0xefb1('0x59')][_0xefb1('0x8b')],'path':_[_0xefb1('0x66')](_0x4baea4)?undefined:util[_0xefb1('0x60')](_0xefb1('0x8c'),_0x4baea4[_0xefb1('0x8d')]),'fax':_[_0xefb1('0x66')](_0x2a985b[_0xefb1('0x80')])?undefined:_0x2a985b[_0xefb1('0x80')],'AttachmentId':_0x2a985b[_0xefb1('0x89')]},client9002);})[_0xefb1('0x3b')](respondWithResult(_0x4021c0,0xc9))[_0xefb1('0x2d')](handleError(_0x4021c0,null));};exports[_0xefb1('0x8e')]=function(_0x4d8280,_0x47287a){var _0xc48a0b=path[_0xefb1('0x8f')](config[_0xefb1('0x90')],_0xefb1('0x91'),_0xefb1('0x92'),'attachments');return db[_0xefb1('0x40')][_0xefb1('0x5a')]({'where':{'id':_0x4d8280['params']['id']},'include':[{'model':db[_0xefb1('0x88')],'as':'Attachment'}]})[_0xefb1('0x3b')](handleEntityNotFound(_0x47287a,null))[_0xefb1('0x3b')](function(_0x3322f3){if(_0x3322f3){return _0x47287a[_0xefb1('0x8e')](path[_0xefb1('0x8f')](_0xc48a0b,_0x3322f3['Attachment'][_0xefb1('0x8d')]));}})[_0xefb1('0x2d')](handleError(_0x47287a,null));}; \ No newline at end of file +var _0xc296=['fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','index','FaxMessage','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','body','catch','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','User','create','CmContact','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs'];(function(_0x105393,_0x11c44e){var _0xf50bb1=function(_0x1b2d3f){while(--_0x1b2d3f){_0x105393['push'](_0x105393['shift']());}};_0xf50bb1(++_0x11c44e);}(_0xc296,0x8a));var _0x6c29=function(_0x212ffa,_0x4d80bc){_0x212ffa=_0x212ffa-0x0;var _0x528faf=_0xc296[_0x212ffa];return _0x528faf;};'use strict';var emlformat=require(_0x6c29('0x0'));var rimraf=require(_0x6c29('0x1'));var zipdir=require(_0x6c29('0x2'));var jsonpatch=require(_0x6c29('0x3'));var rp=require(_0x6c29('0x4'));var moment=require('moment');var BPromise=require(_0x6c29('0x5'));var Mustache=require(_0x6c29('0x6'));var util=require('util');var path=require(_0x6c29('0x7'));var sox=require(_0x6c29('0x8'));var csv=require('to-csv');var ejs=require(_0x6c29('0x9'));var fs=require('fs');var fs_extra=require(_0x6c29('0xa'));var _=require('lodash');var squel=require(_0x6c29('0xb'));var crypto=require(_0x6c29('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6c29('0xd'));var toCsv=require(_0x6c29('0xe'));var querystring=require(_0x6c29('0xf'));var Papa=require(_0x6c29('0x10'));var Redis=require(_0x6c29('0x11'));var authService=require(_0x6c29('0x12'));var qs=require(_0x6c29('0x13'));var as=require(_0x6c29('0x14'));var hardwareService=require(_0x6c29('0x15'));var logger=require(_0x6c29('0x16'))(_0x6c29('0x17'));var utils=require(_0x6c29('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c29('0x19'))['db'];config[_0x6c29('0x1a')]=_[_0x6c29('0x1b')](config[_0x6c29('0x1a')],{'host':_0x6c29('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c29('0x1a')]));require(_0x6c29('0x1d'))[_0x6c29('0x1e')](socket);var jayson=require(_0x6c29('0x1f'));var client=jayson[_0x6c29('0x20')][_0x6c29('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a365d,_0x575b70,_0xa7be48,_0x5200dd){return new BPromise(function(_0x4f76a9,_0x397db9){var _0x3d83ce=_0x5200dd||client;return _0x3d83ce[_0x6c29('0x22')](_0x5a365d,_0xa7be48)[_0x6c29('0x23')](function(_0x40e9c1){logger[_0x6c29('0x24')](_0x6c29('0x25'),_0x575b70,_0x6c29('0x26'));logger[_0x6c29('0x27')](_0x6c29('0x28'),_0x575b70,_0x6c29('0x26'),JSON[_0x6c29('0x29')](_0x40e9c1));if(_0x40e9c1[_0x6c29('0x2a')]){if(_0x40e9c1[_0x6c29('0x2a')][_0x6c29('0x2b')]===0x1f4){logger[_0x6c29('0x2a')](_0x6c29('0x25'),_0x575b70,_0x40e9c1[_0x6c29('0x2a')][_0x6c29('0x2c')]);return _0x397db9(_0x40e9c1[_0x6c29('0x2a')][_0x6c29('0x2c')]);}logger[_0x6c29('0x2a')](_0x6c29('0x25'),_0x575b70,_0x40e9c1[_0x6c29('0x2a')]['message']);return _0x4f76a9(_0x40e9c1['error'][_0x6c29('0x2c')]);}else{logger[_0x6c29('0x24')]('FaxMessage,\x20%s,\x20%s',_0x575b70,_0x6c29('0x26'));_0x4f76a9(_0x40e9c1[_0x6c29('0x2d')][_0x6c29('0x2c')]);}})['catch'](function(_0x918c8d){logger[_0x6c29('0x2a')](_0x6c29('0x25'),_0x575b70,_0x918c8d);_0x397db9(_0x918c8d);});});}function respondWithStatusCode(_0x47c8c7,_0x16314e){_0x16314e=_0x16314e||0xcc;return function(_0x38b07d){if(_0x38b07d){return _0x47c8c7['sendStatus'](_0x16314e);}return _0x47c8c7['status'](_0x16314e)[_0x6c29('0x2e')]();};}function respondWithResult(_0x319bc1,_0x4d6aa1){_0x4d6aa1=_0x4d6aa1||0xc8;return function(_0x24e5de){if(_0x24e5de){return _0x319bc1[_0x6c29('0x2f')](_0x4d6aa1)['json'](_0x24e5de);}};}function respondWithFilteredResult(_0x507a5a,_0x4e39da){return function(_0x55212c){if(_0x55212c){var _0x56fccd=typeof _0x4e39da[_0x6c29('0x30')]===_0x6c29('0x31')&&typeof _0x4e39da['limit']===_0x6c29('0x31');var _0x2ed1be=_0x55212c[_0x6c29('0x32')];var _0x289c1e=_0x56fccd?0x0:_0x4e39da['offset'];var _0x37c8b3=_0x56fccd?_0x55212c['count']:_0x4e39da[_0x6c29('0x30')]+_0x4e39da['limit'];var _0xa27ea8;if(_0x37c8b3>=_0x2ed1be){_0x37c8b3=_0x2ed1be;_0xa27ea8=0xc8;}else{_0xa27ea8=0xce;}_0x507a5a[_0x6c29('0x2f')](_0xa27ea8);return _0x507a5a[_0x6c29('0x33')](_0x6c29('0x34'),_0x289c1e+'-'+_0x37c8b3+'/'+_0x2ed1be)[_0x6c29('0x35')](_0x55212c);}return null;};}function patchUpdates(_0xd864c){return function(_0x62a0b3){try{jsonpatch['apply'](_0x62a0b3,_0xd864c,!![]);}catch(_0x5ed7a7){return BPromise[_0x6c29('0x36')](_0x5ed7a7);}return _0x62a0b3[_0x6c29('0x37')]();};}function saveUpdates(_0x3a0ab0,_0x2b9f15){return function(_0x3b362f){if(_0x3b362f){return _0x3b362f[_0x6c29('0x38')](_0x3a0ab0)[_0x6c29('0x23')](function(_0x45bd50){return _0x45bd50;});}return null;};}function removeEntity(_0x389dcd,_0x492dcc){return function(_0x48c484){if(_0x48c484){return _0x48c484[_0x6c29('0x39')]()[_0x6c29('0x23')](function(){_0x389dcd[_0x6c29('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422aff,_0x29786e){return function(_0x59b55b){if(!_0x59b55b){_0x422aff[_0x6c29('0x3a')](0x194);}return _0x59b55b;};}function handleError(_0x3358c2,_0x30765e){_0x30765e=_0x30765e||0x1f4;return function(_0x453fa0){logger[_0x6c29('0x2a')](_0x453fa0['stack']);if(_0x453fa0['name']){delete _0x453fa0[_0x6c29('0x3b')];}_0x3358c2[_0x6c29('0x2f')](_0x30765e)[_0x6c29('0x3c')](_0x453fa0);};}exports[_0x6c29('0x3d')]=function(_0x7474f3,_0x41fc5f){var _0xac3370={},_0x106a16={},_0xd64f60={'count':0x0,'rows':[]};var _0x119696=_['map'](db[_0x6c29('0x3e')]['rawAttributes'],function(_0xbb31a8){return{'name':_0xbb31a8[_0x6c29('0x3f')],'type':_0xbb31a8[_0x6c29('0x40')][_0x6c29('0x41')]};});_0x106a16[_0x6c29('0x42')]=_[_0x6c29('0x43')](_0x119696,'name');_0x106a16['query']=_[_0x6c29('0x44')](_0x7474f3[_0x6c29('0x45')]);_0x106a16[_0x6c29('0x46')]=_[_0x6c29('0x47')](_0x106a16[_0x6c29('0x42')],_0x106a16['query']);_0xac3370[_0x6c29('0x48')]=_['intersection'](_0x106a16[_0x6c29('0x42')],qs[_0x6c29('0x49')](_0x7474f3[_0x6c29('0x45')][_0x6c29('0x49')]));_0xac3370['attributes']=_0xac3370[_0x6c29('0x48')][_0x6c29('0x4a')]?_0xac3370[_0x6c29('0x48')]:_0x106a16[_0x6c29('0x42')];if(!_0x7474f3['query'][_0x6c29('0x4b')](_0x6c29('0x4c'))){_0xac3370[_0x6c29('0x4d')]=qs[_0x6c29('0x4d')](_0x7474f3[_0x6c29('0x45')][_0x6c29('0x4d')]);_0xac3370[_0x6c29('0x30')]=qs[_0x6c29('0x30')](_0x7474f3['query'][_0x6c29('0x30')]);}_0xac3370[_0x6c29('0x4e')]=qs[_0x6c29('0x4f')](_0x7474f3[_0x6c29('0x45')]['sort']);_0xac3370[_0x6c29('0x50')]=qs['filters'](_[_0x6c29('0x51')](_0x7474f3['query'],_0x106a16[_0x6c29('0x46')]),_0x119696);if(_0x7474f3[_0x6c29('0x45')]['filter']){_0xac3370[_0x6c29('0x50')]=_['merge'](_0xac3370['where'],{'$or':_[_0x6c29('0x43')](_0x119696,function(_0x135fce){if(_0x135fce[_0x6c29('0x40')]!==_0x6c29('0x52')){var _0x2f9172={};_0x2f9172[_0x135fce[_0x6c29('0x3b')]]={'$like':'%'+_0x7474f3[_0x6c29('0x45')][_0x6c29('0x53')]+'%'};return _0x2f9172;}})});}_0xac3370=_[_0x6c29('0x54')]({},_0xac3370,_0x7474f3[_0x6c29('0x55')]);var _0x4b3b7b={'where':_0xac3370['where']};return db['FaxMessage'][_0x6c29('0x32')](_0x4b3b7b)[_0x6c29('0x23')](function(_0x3a5a1d){_0xd64f60[_0x6c29('0x32')]=_0x3a5a1d;if(_0x7474f3['query'][_0x6c29('0x56')]){_0xac3370[_0x6c29('0x57')]=[{'all':!![]}];}return db[_0x6c29('0x3e')][_0x6c29('0x58')](_0xac3370);})[_0x6c29('0x23')](function(_0x275685){_0xd64f60['rows']=_0x275685;return _0xd64f60;})[_0x6c29('0x23')](respondWithFilteredResult(_0x41fc5f,_0xac3370))['catch'](handleError(_0x41fc5f,null));};exports[_0x6c29('0x59')]=function(_0x3b6c06,_0x3691b0){var _0xe377b3={'raw':!![],'where':{'id':_0x3b6c06[_0x6c29('0x5a')]['id']}},_0x5e687a={};_0x5e687a['model']=_[_0x6c29('0x44')](db[_0x6c29('0x3e')][_0x6c29('0x5b')]);_0x5e687a['query']=_[_0x6c29('0x44')](_0x3b6c06[_0x6c29('0x45')]);_0x5e687a[_0x6c29('0x46')]=_[_0x6c29('0x47')](_0x5e687a[_0x6c29('0x42')],_0x5e687a[_0x6c29('0x45')]);_0xe377b3[_0x6c29('0x48')]=_[_0x6c29('0x47')](_0x5e687a[_0x6c29('0x42')],qs[_0x6c29('0x49')](_0x3b6c06[_0x6c29('0x45')][_0x6c29('0x49')]));_0xe377b3[_0x6c29('0x48')]=_0xe377b3[_0x6c29('0x48')][_0x6c29('0x4a')]?_0xe377b3[_0x6c29('0x48')]:_0x5e687a[_0x6c29('0x42')];if(_0x3b6c06['query']['includeAll']){_0xe377b3['include']=[{'all':!![]}];}_0xe377b3=_[_0x6c29('0x54')]({},_0xe377b3,_0x3b6c06['options']);return db[_0x6c29('0x3e')][_0x6c29('0x5c')](_0xe377b3)[_0x6c29('0x23')](handleEntityNotFound(_0x3691b0,null))['then'](respondWithResult(_0x3691b0,null))['catch'](handleError(_0x3691b0,null));};exports[_0x6c29('0x38')]=function(_0x3a729c,_0x402fc3){if(_0x3a729c[_0x6c29('0x5d')]['id']){delete _0x3a729c[_0x6c29('0x5d')]['id'];}return db[_0x6c29('0x3e')][_0x6c29('0x5c')]({'where':{'id':_0x3a729c['params']['id']}})['then'](handleEntityNotFound(_0x402fc3,null))[_0x6c29('0x23')](saveUpdates(_0x3a729c[_0x6c29('0x5d')],null))[_0x6c29('0x23')](respondWithResult(_0x402fc3,null))[_0x6c29('0x5e')](handleError(_0x402fc3,null));};exports['destroy']=function(_0x1ac681,_0x141b5c){return db[_0x6c29('0x3e')]['find']({'where':{'id':_0x1ac681['params']['id']}})[_0x6c29('0x23')](handleEntityNotFound(_0x141b5c,null))[_0x6c29('0x23')](removeEntity(_0x141b5c,null))[_0x6c29('0x5e')](handleError(_0x141b5c,null));};exports[_0x6c29('0x5f')]=function(_0x5417fe,_0x1f8568){return db[_0x6c29('0x3e')]['describe']()['then'](respondWithResult(_0x1f8568,null))[_0x6c29('0x5e')](handleError(_0x1f8568,null));};var interaction_log=require(_0x6c29('0x16'))(_0x6c29('0x60'));exports[_0x6c29('0x61')]=function(_0x11afed,_0x1353de,_0x25b15a){var _0x42d2de={'agent':{},'channel':_0x6c29('0x62')};if(_0x11afed[_0x6c29('0x5d')]['id']){delete _0x11afed['body']['id'];}_0x11afed[_0x6c29('0x5d')]['read']=!![];_0x11afed[_0x6c29('0x5d')]['readAt']=moment()[_0x6c29('0x63')](_0x6c29('0x64'));_0x11afed['body']['UserId']=_0x11afed['body'][_0x6c29('0x65')]||_0x11afed[_0x6c29('0x66')]['id'];_0x42d2de['agent']['id']=_0x11afed[_0x6c29('0x5d')][_0x6c29('0x65')];return db[_0x6c29('0x3e')][_0x6c29('0x5c')]({'where':{'id':_0x11afed[_0x6c29('0x5a')]['id'],'UserId':null}})[_0x6c29('0x23')](handleEntityNotFound(_0x1353de,null))[_0x6c29('0x23')](saveUpdates(_0x11afed[_0x6c29('0x5d')],null))[_0x6c29('0x23')](function(_0x95d8b2){if(_0x95d8b2){_0x42d2de[_0x6c29('0x2c')]=_0x95d8b2['get']({'plain':!![]});return db[_0x6c29('0x67')][_0x6c29('0x5c')]({'where':{'id':_0x95d8b2[_0x6c29('0x68')]}});}return null;})[_0x6c29('0x23')](handleEntityNotFound(_0x1353de,null))[_0x6c29('0x23')](function(_0x1a6906){if(_0x1a6906){return _0x1a6906[_0x6c29('0x38')]({'UserId':_0x11afed[_0x6c29('0x5d')]['UserId'],'read1stAt':_[_0x6c29('0x69')](_0x1a6906[_0x6c29('0x6a')])?moment()[_0x6c29('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6c29('0x23')](function(_0x1fb753){if(_0x1fb753){_0x42d2de[_0x6c29('0x6b')]=_0x1fb753['get']({'plain':!![]});interaction_log[_0x6c29('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11afed[_0x6c29('0x66')]['id'],_0x11afed[_0x6c29('0x66')][_0x6c29('0x3b')],_0x11afed[_0x6c29('0x66')][_0x6c29('0x6c')],_0x42d2de[_0x6c29('0x6b')]['id'],_0x11afed['body']?JSON[_0x6c29('0x29')](_0x11afed['body']):_0x6c29('0x6d'));return respondWithRpcPromise(_0x6c29('0x6e'),_0x6c29('0x6f'),_0x42d2de);}return null;})[_0x6c29('0x23')](function(_0x44ac60){var _0x2769ef=_0x6c29('0x70')+_0x44ac60[_0x6c29('0x2c')]['ContactId'];return db['sequelize'][_0x6c29('0x45')](_0x2769ef,{'type':db['Sequelize'][_0x6c29('0x71')][_0x6c29('0x72')],'raw':!![]})[_0x6c29('0x23')](function(_0x322faf){return _0x322faf;});})[_0x6c29('0x23')](function(_0x47a07d){if(_0x47a07d){_0x42d2de['message'][_0x6c29('0x73')]=_0x47a07d[0x0];if(!_0x11afed['body'][_0x6c29('0x65')])return;return db['User'][_0x6c29('0x5c')]({'where':{'id':_0x11afed[_0x6c29('0x5d')]['UserId'],'role':_0x6c29('0x74')},'attributes':['id',_0x6c29('0x3b'),_0x6c29('0x75'),'email',_0x6c29('0x76')],'raw':!![]});}return null;})[_0x6c29('0x23')](function(_0x486398){if(!_0x486398)return null;_0x42d2de[_0x6c29('0x2c')][_0x6c29('0x74')]=_0x486398;return _0x42d2de;})['then'](function(_0xc9a361){if(_0xc9a361){if(_0x11afed[_0x6c29('0x5d')][_0x6c29('0x77')]){_0x42d2de[_0x6c29('0x2c')][_0x6c29('0x78')]=util[_0x6c29('0x63')](_0x6c29('0x79'),_0x11afed[_0x6c29('0x66')]['name']);_0x42d2de[_0x6c29('0x2c')]['channel']=_0x42d2de[_0x6c29('0x7a')];_0x42d2de[_0x6c29('0x2c')][_0x6c29('0x7b')]=_0x42d2de[_0x6c29('0x7a')];_0x42d2de[_0x6c29('0x2c')][_0x6c29('0x7c')]=_0x6c29('0x61');return respondWithRpcPromise(_0x6c29('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x42d2de[_0x6c29('0x2c')]},client9002)[_0x6c29('0x23')](function(){return _0x42d2de;});}return _0x42d2de;}return null;})[_0x6c29('0x23')](respondWithResult(_0x1353de,null))[_0x6c29('0x5e')](handleError(_0x1353de,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x6c29('0x36')]=function(_0x5844d2,_0x4b1155,_0x522683){var _0x3f0ad1={'agent':{},'channel':'fax'};if(_0x5844d2[_0x6c29('0x5d')]['id']){delete _0x5844d2[_0x6c29('0x5d')]['id'];}_0x5844d2['body'][_0x6c29('0x65')]=_0x5844d2['body']['UserId']||_0x5844d2['user']['id'];_0x3f0ad1[_0x6c29('0x74')]['id']=_0x5844d2[_0x6c29('0x5d')][_0x6c29('0x65')];return db[_0x6c29('0x3e')]['find']({'where':{'id':_0x5844d2[_0x6c29('0x5a')]['id'],'UserId':null}})[_0x6c29('0x23')](handleEntityNotFound(_0x4b1155,null))[_0x6c29('0x23')](function(_0x20f2ea){if(_0x20f2ea){_0x3f0ad1[_0x6c29('0x2c')]=_0x20f2ea[_0x6c29('0x7e')]({'plain':!![]});return db[_0x6c29('0x67')][_0x6c29('0x5c')]({'where':{'id':_0x20f2ea[_0x6c29('0x68')]}});}return null;})[_0x6c29('0x23')](handleEntityNotFound(_0x4b1155,null))[_0x6c29('0x23')](function(_0x62a8af){if(_0x62a8af){_0x3f0ad1[_0x6c29('0x6b')]=_0x62a8af[_0x6c29('0x7e')]({'plain':!![]});interaction_log['info'](_0x6c29('0x7f'),_0x5844d2['user']['id'],_0x5844d2[_0x6c29('0x66')][_0x6c29('0x3b')],_0x5844d2[_0x6c29('0x66')][_0x6c29('0x6c')],_0x3f0ad1[_0x6c29('0x6b')]['id'],_0x5844d2[_0x6c29('0x5d')]?JSON[_0x6c29('0x29')](_0x5844d2[_0x6c29('0x5d')]):_0x6c29('0x6d'));return respondWithRpcPromise(_0x6c29('0x80'),_0x6c29('0x81'),_0x3f0ad1);}return null;})[_0x6c29('0x23')](function(_0x4ce2d7){var _0x1914a4=_0x6c29('0x70')+_0x4ce2d7[_0x6c29('0x2c')]['ContactId'];return db[_0x6c29('0x82')]['query'](_0x1914a4,{'type':db[_0x6c29('0x83')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6c29('0x23')](function(_0x34638b){return _0x34638b;});})[_0x6c29('0x23')](function(_0x24bc9f){if(_0x24bc9f){_0x3f0ad1[_0x6c29('0x2c')]['contact']=_0x24bc9f[0x0];if(!_0x5844d2[_0x6c29('0x5d')][_0x6c29('0x65')])return;return db[_0x6c29('0x84')]['find']({'where':{'id':_0x5844d2['body'][_0x6c29('0x65')],'role':_0x6c29('0x74')},'attributes':['id',_0x6c29('0x3b'),_0x6c29('0x75'),'email','internal'],'raw':!![]});}return null;})[_0x6c29('0x23')](function(_0x5ce58c){if(!_0x5ce58c)return null;_0x3f0ad1[_0x6c29('0x2c')][_0x6c29('0x74')]=_0x5ce58c;return _0x3f0ad1;})['then'](function(_0x1d1769){if(_0x1d1769){_0x1d1769[_0x6c29('0x2c')][_0x6c29('0x78')]=util[_0x6c29('0x63')](_0x6c29('0x79'),_0x5844d2[_0x6c29('0x66')][_0x6c29('0x3b')]);_0x1d1769[_0x6c29('0x2c')][_0x6c29('0x7a')]=_0x3f0ad1['channel'];_0x1d1769[_0x6c29('0x2c')]['motionChannel']=_0x3f0ad1[_0x6c29('0x7a')];_0x1d1769[_0x6c29('0x2c')]['event']=_0x6c29('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x1d1769[_0x6c29('0x2c')]},client9002);return _0x3f0ad1;}return null;})[_0x6c29('0x23')](respondWithResult(_0x4b1155,null))[_0x6c29('0x5e')](handleError(_0x4b1155,null));};exports['create']=function(_0x47101c,_0x26bdaa){var _0x503ae1;return db['FaxMessage'][_0x6c29('0x85')](_0x47101c[_0x6c29('0x5d')],{})['then'](function(_0x5b4f91){_0x503ae1=_0x5b4f91;return db[_0x6c29('0x86')][_0x6c29('0x87')]({'where':{'id':_0x503ae1[_0x6c29('0x88')]}});})['then'](function(_0x7b9e77){if(_['isNil'](_0x7b9e77)){return;}else{_0x503ae1[_0x6c29('0x62')]=_0x7b9e77['fax'];return db[_0x6c29('0x89')][_0x6c29('0x87')]({'where':{'id':_0x503ae1[_0x6c29('0x8a')]}});}})[_0x6c29('0x23')](function(_0x2bb1ad){return respondWithRpcPromise(_0x6c29('0x8b'),_0x6c29('0x8b'),{'FaxAccountId':_['isNil'](_0x47101c[_0x6c29('0x5d')])?undefined:_0x47101c[_0x6c29('0x5d')][_0x6c29('0x8c')],'path':_['isNil'](_0x2bb1ad)?undefined:util[_0x6c29('0x63')](_0x6c29('0x8d'),_0x2bb1ad['basename']),'fax':_[_0x6c29('0x69')](_0x503ae1[_0x6c29('0x62')])?undefined:_0x503ae1[_0x6c29('0x62')],'AttachmentId':_0x503ae1[_0x6c29('0x8a')]},client9002);})[_0x6c29('0x23')](respondWithResult(_0x26bdaa,0xc9))[_0x6c29('0x5e')](handleError(_0x26bdaa,null));};exports[_0x6c29('0x8e')]=function(_0xa09422,_0xfc0b0b){var _0x196b33=path[_0x6c29('0x8f')](config[_0x6c29('0x90')],_0x6c29('0x91'),_0x6c29('0x92'),_0x6c29('0x93'));return db[_0x6c29('0x3e')][_0x6c29('0x5c')]({'where':{'id':_0xa09422[_0x6c29('0x5a')]['id']},'include':[{'model':db[_0x6c29('0x89')],'as':_0x6c29('0x89')}]})['then'](handleEntityNotFound(_0xfc0b0b,null))[_0x6c29('0x23')](function(_0x465f8f){if(_0x465f8f){return _0xfc0b0b['download'](path[_0x6c29('0x8f')](_0x196b33,_0x465f8f[_0x6c29('0x89')]['basename']));}})['catch'](handleError(_0xfc0b0b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 29e90d0..0227f13 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 _0x8ff3=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x387af5,_0x57853b){var _0x59b86e=function(_0x562d78){while(--_0x562d78){_0x387af5['push'](_0x387af5['shift']());}};_0x59b86e(++_0x57853b);}(_0x8ff3,0x72));var _0x38ff=function(_0x162b38,_0x543c5c){_0x162b38=_0x162b38-0x0;var _0x4d04a0=_0x8ff3[_0x162b38];return _0x4d04a0;};'use strict';var EventEmitter=require(_0x38ff('0x0'));var FaxMessage=require(_0x38ff('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x38ff('0x2')](0x0);var events={'afterCreate':_0x38ff('0x3'),'afterUpdate':_0x38ff('0x4'),'afterDestroy':_0x38ff('0x5')};function emitEvent(_0x33ac8d){return function(_0x5bf243,_0x5f377c,_0x35d87f){FaxMessageEvents['emit'](_0x33ac8d+':'+_0x5bf243['id'],_0x5bf243);FaxMessageEvents[_0x38ff('0x6')](_0x33ac8d,_0x5bf243);_0x35d87f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x38ff('0x7')](e,emitEvent(event));}}module[_0x38ff('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xbc48=['events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc48,0x111));var _0x8bc4=function(_0xc69e8f,_0x206094){_0xc69e8f=_0xc69e8f-0x0;var _0x4d01af=_0xbc48[_0xc69e8f];return _0x4d01af;};'use strict';var EventEmitter=require(_0x8bc4('0x0'));var FaxMessage=require(_0x8bc4('0x1'))['db'][_0x8bc4('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8bc4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bc4('0x4'),'afterDestroy':_0x8bc4('0x5')};function emitEvent(_0x3efe3a){return function(_0x5971fb,_0x5468ea,_0x2f83e9){FaxMessageEvents['emit'](_0x3efe3a+':'+_0x5971fb['id'],_0x5971fb);FaxMessageEvents['emit'](_0x3efe3a,_0x5971fb);_0x2f83e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x8bc4('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 019549e..522538a 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 _0x1d29=['FaxInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','FaxInteraction','findOne'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x1d29,0x166));var _0x91d2=function(_0xb6c029,_0x289717){_0xb6c029=_0xb6c029-0x0;var _0x369954=_0x1d29[_0xb6c029];return _0x369954;};'use strict';var _=require(_0x91d2('0x0'));var util=require(_0x91d2('0x1'));var logger=require(_0x91d2('0x2'))(_0x91d2('0x3'));var moment=require(_0x91d2('0x4'));var BPromise=require(_0x91d2('0x5'));var rp=require(_0x91d2('0x6'));var fs=require('fs');var path=require(_0x91d2('0x7'));var rimraf=require(_0x91d2('0x8'));var config=require(_0x91d2('0x9'));var attributes=require(_0x91d2('0xa'));module[_0x91d2('0xb')]=function(_0x5c9900,_0x53b1e8){return _0x5c9900[_0x91d2('0xc')](_0x91d2('0xd'),attributes,{'tableName':_0x91d2('0xe'),'paranoid':![],'indexes':[{'name':_0x91d2('0xf'),'fields':[_0x91d2('0x10')],'type':_0x91d2('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a43da,_0x271d6d,_0x4c3211){var _0x4966d4=_0x5c9900[_0x91d2('0x12')];var _0x4424ec=_0x1a43da[_0x91d2('0x13')]({'plain':!![]});if(_0x4424ec[_0x91d2('0x14')][_0x91d2('0x15')]()==='in'||_0x4424ec[_0x91d2('0x14')][_0x91d2('0x15')]()==='out'&&!_0x4424ec[_0x91d2('0x16')]&&!_['isNil'](_0x4424ec[_0x91d2('0x17')])){_0x4966d4[_0x91d2('0x18')][_0x91d2('0x19')]({'where':{'id':_0x4424ec[_0x91d2('0x1a')]}})[_0x91d2('0x1b')](function(_0x4536bf){if(_0x4536bf){_0x4536bf[_0x91d2('0x1c')]({'lastMsgAt':_0x4424ec[_0x91d2('0x1d')],'lastMsgDirection':_0x4424ec[_0x91d2('0x14')][_0x91d2('0x15')]()});}})[_0x91d2('0x1e')](function(_0x53f403){console['error'](_0x53f403);});}_0x4c3211();}},'charset':_0x91d2('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe058=['bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment'];(function(_0x5d9368,_0x1b525d){var _0x562a01=function(_0x4b23ec){while(--_0x4b23ec){_0x5d9368['push'](_0x5d9368['shift']());}};_0x562a01(++_0x1b525d);}(_0xe058,0xe6));var _0x8e05=function(_0x1761dd,_0x57ea8c){_0x1761dd=_0x1761dd-0x0;var _0x34265c=_0xe058[_0x1761dd];return _0x34265c;};'use strict';var _=require('lodash');var util=require(_0x8e05('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8e05('0x1'));var BPromise=require(_0x8e05('0x2'));var rp=require(_0x8e05('0x3'));var fs=require('fs');var path=require(_0x8e05('0x4'));var rimraf=require(_0x8e05('0x5'));var config=require(_0x8e05('0x6'));var attributes=require(_0x8e05('0x7'));module['exports']=function(_0x481fed,_0x1db228){return _0x481fed['define'](_0x8e05('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8e05('0x9'),'fields':[_0x8e05('0xa')],'type':_0x8e05('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55a555,_0x1b0338,_0x124fe7){var _0x57b84f=_0x481fed[_0x8e05('0xc')];var _0x7c8f17=_0x55a555[_0x8e05('0xd')]({'plain':!![]});if(_0x7c8f17['direction'][_0x8e05('0xe')]()==='in'||_0x7c8f17[_0x8e05('0xf')][_0x8e05('0xe')]()===_0x8e05('0x10')&&!_0x7c8f17[_0x8e05('0x11')]&&!_[_0x8e05('0x12')](_0x7c8f17[_0x8e05('0x13')])){_0x57b84f[_0x8e05('0x14')][_0x8e05('0x15')]({'where':{'id':_0x7c8f17[_0x8e05('0x16')]}})['then'](function(_0x143dbc){if(_0x143dbc){_0x143dbc[_0x8e05('0x17')]({'lastMsgAt':_0x7c8f17[_0x8e05('0x18')],'lastMsgDirection':_0x7c8f17[_0x8e05('0xf')]['toLowerCase']()});}})[_0x8e05('0x19')](function(_0x5cfebf){console[_0x8e05('0x1a')](_0x5cfebf);});}_0x124fe7();}},'charset':_0x8e05('0x1b'),'collate':_0x8e05('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2d66781..5182e1f 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 _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x230f1d,_0x466a5f){var _0x1cfc95=function(_0x278bab){while(--_0x278bab){_0x230f1d['push'](_0x230f1d['shift']());}};_0x1cfc95(++_0x466a5f);}(_0x2d17,0x17e));var _0x72d1=function(_0x478ffb,_0x21616b){_0x478ffb=_0x478ffb-0x0;var _0x524b38=_0x2d17[_0x478ffb];return _0x524b38;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file +var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x370ed5,_0xa86a91){var _0x4dc24a=function(_0x52c215){while(--_0x52c215){_0x370ed5['push'](_0x370ed5['shift']());}};_0x4dc24a(++_0xa86a91);}(_0x008c,0x188));var _0xc008=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0x008c[_0x21c068];return _0x5cf199;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 514781d..689f40c 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 _0x78b6=['remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x83560f,_0x3d005f){var _0x5d4a9f=function(_0x3530d1){while(--_0x3530d1){_0x83560f['push'](_0x83560f['shift']());}};_0x5d4a9f(++_0x3d005f);}(_0x78b6,0x8e));var _0x678b=function(_0x18e9a3,_0x276495){_0x18e9a3=_0x18e9a3-0x0;var _0x214569=_0x78b6[_0x18e9a3];return _0x214569;};'use strict';var FaxMessageEvents=require(_0x678b('0x0'));var events=[_0x678b('0x1'),_0x678b('0x2'),_0x678b('0x3')];function createListener(_0x46e1de,_0x5eadb2){return function(_0xf60dd9){_0x5eadb2[_0x678b('0x4')](_0x46e1de,_0xf60dd9);};}function removeListener(_0x1182e5,_0x914b0b){return function(){FaxMessageEvents[_0x678b('0x5')](_0x1182e5,_0x914b0b);};}exports[_0x678b('0x6')]=function(_0x2dddb2){for(var _0x2c9319=0x0,_0x307b92=events[_0x678b('0x7')];_0x2c9319<_0x307b92;_0x2c9319++){var _0xaca93=events[_0x2c9319];var _0x29c0ef=createListener(_0x678b('0x8')+_0xaca93,_0x2dddb2);FaxMessageEvents['on'](_0xaca93,_0x29c0ef);}}; \ No newline at end of file +var _0x199c=['emit','removeListener','register','./faxMessage.events','remove','update'];(function(_0x3c1353,_0xe37ca3){var _0x52d42b=function(_0x56c0fb){while(--_0x56c0fb){_0x3c1353['push'](_0x3c1353['shift']());}};_0x52d42b(++_0xe37ca3);}(_0x199c,0x1a7));var _0xc199=function(_0x3bad8e,_0xd3c891){_0x3bad8e=_0x3bad8e-0x0;var _0x4860c5=_0x199c[_0x3bad8e];return _0x4860c5;};'use strict';var FaxMessageEvents=require(_0xc199('0x0'));var events=['save',_0xc199('0x1'),_0xc199('0x2')];function createListener(_0xeb512b,_0x2dc5ab){return function(_0x56d351){_0x2dc5ab[_0xc199('0x3')](_0xeb512b,_0x56d351);};}function removeListener(_0x751116,_0x55a7bb){return function(){FaxMessageEvents[_0xc199('0x4')](_0x751116,_0x55a7bb);};}exports[_0xc199('0x5')]=function(_0x5c3993){for(var _0x1ac3ca=0x0,_0x30774d=events['length'];_0x1ac3ca<_0x30774d;_0x1ac3ca++){var _0x35c5b2=events[_0x1ac3ca];var _0x5e8bc8=createListener('faxMessage:'+_0x35c5b2,_0x5c3993);FaxMessageEvents['on'](_0x35c5b2,_0x5e8bc8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index bf500d4..3ed412f 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 _0x5db8=['download','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id/download'];(function(_0x250ebb,_0x33a65f){var _0x1225fb=function(_0x40172e){while(--_0x40172e){_0x250ebb['push'](_0x250ebb['shift']());}};_0x1225fb(++_0x33a65f);}(_0x5db8,0xbb));var _0x85db=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x5db8[_0x2906e6];return _0x12517a;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),auth[_0x85db('0x9')](),controller[_0x85db('0xb')]);router[_0x85db('0x8')]('/:id',auth[_0x85db('0x9')](),controller['show']);router[_0x85db('0x8')](_0x85db('0xc'),auth[_0x85db('0x9')](),controller[_0x85db('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x85db('0xe'),_0x85db('0xf')),controller['create']);router[_0x85db('0x10')]('/:id',auth[_0x85db('0x9')](),controller[_0x85db('0x11')]);router[_0x85db('0x10')](_0x85db('0x12'),auth[_0x85db('0x9')](),controller[_0x85db('0x13')]);router[_0x85db('0x10')](_0x85db('0x14'),auth[_0x85db('0x9')](),controller[_0x85db('0x15')]);router[_0x85db('0x16')](_0x85db('0x17'),auth[_0x85db('0x9')](),controller['destroy']);module[_0x85db('0x18')]=router; \ No newline at end of file +var _0x668b=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x668b,0x140));var _0xb668=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x668b[_0x4d45c1];return _0x244478;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xa')](_0xb668('0xf'),auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb668('0x12')](_0xb668('0x13'),_0xb668('0x14')),controller[_0xb668('0x15')]);router[_0xb668('0x16')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x17')]);router[_0xb668('0x16')](_0xb668('0x18'),auth[_0xb668('0x8')](),controller[_0xb668('0x19')]);router[_0xb668('0x16')](_0xb668('0x1a'),auth[_0xb668('0x8')](),controller[_0xb668('0x1b')]);router[_0xb668('0x1c')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x1d')]);module[_0xb668('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 54012fe..c5b8961 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 _0xa9b9=['rrmemory','beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x188036,_0x520fc1){var _0x10e835=function(_0x590f64){while(--_0x590f64){_0x188036['push'](_0x188036['shift']());}};_0x10e835(++_0x520fc1);}(_0xa9b9,0x1c2));var _0x9a9b=function(_0xb2454d,_0x291753){_0xb2454d=_0xb2454d-0x0;var _0x5464fb=_0xa9b9[_0xb2454d];return _0x5464fb;};'use strict';var Sequelize=require(_0x9a9b('0x0'));module[_0x9a9b('0x1')]={'name':{'type':Sequelize[_0x9a9b('0x2')],'unique':_0x9a9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9a9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a9b('0x5')](_0x9a9b('0x6'),_0x9a9b('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9a9b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x831f=['STRING','name','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x4fd58b,_0x39f149){var _0x347273=function(_0x2f2e39){while(--_0x2f2e39){_0x4fd58b['push'](_0x4fd58b['shift']());}};_0x347273(++_0x39f149);}(_0x831f,0x1be));var _0xf831=function(_0x41b872,_0x4c4ef9){_0x41b872=_0x41b872-0x0;var _0x439768=_0x831f[_0x41b872];return _0x439768;};'use strict';var Sequelize=require(_0xf831('0x0'));module[_0xf831('0x1')]={'name':{'type':Sequelize[_0xf831('0x2')],'unique':_0xf831('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf831('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf831('0x4')](_0xf831('0x5'),_0xf831('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ab5f068..8dba40a 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 _0x91f0=['show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserFaxQueue','hasOwnProperty','filters','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','compact','value','isEmpty','addAgents','omit','userFaxQueue:save','removeAgents','isArray','userFaxQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxQueue.socket','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','save','update','destroy','then','FaxQueues','UserProfileResource','name','send','index','map','FaxQueue','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x1e8074,_0x420771){var _0x5c0d69=function(_0x29caea){while(--_0x29caea){_0x1e8074['push'](_0x1e8074['shift']());}};_0x5c0d69(++_0x420771);}(_0x91f0,0x142));var _0x091f=function(_0x375ead,_0x143aa7){_0x375ead=_0x375ead-0x0;var _0xb673f9=_0x91f0[_0x375ead];return _0xb673f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x091f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x091f('0x1'));var rp=require(_0x091f('0x2'));var moment=require(_0x091f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x091f('0x4'));var util=require(_0x091f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x091f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x091f('0x7'));var squel=require(_0x091f('0x8'));var crypto=require(_0x091f('0x9'));var jsforce=require(_0x091f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x091f('0x6'));var querystring=require(_0x091f('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x091f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x091f('0xd'));var hardwareService=require(_0x091f('0xe'));var logger=require(_0x091f('0xf'))(_0x091f('0x10'));var utils=require(_0x091f('0x11'));var config=require(_0x091f('0x12'));var licenseUtil=require(_0x091f('0x13'));var db=require(_0x091f('0x14'))['db'];config['redis']=_[_0x091f('0x15')](config[_0x091f('0x16')],{'host':_0x091f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x091f('0x16')]));require(_0x091f('0x18'))['register'](socket);function respondWithStatusCode(_0x5c00f6,_0x247773){_0x247773=_0x247773||0xcc;return function(_0x308bae){if(_0x308bae){return _0x5c00f6[_0x091f('0x19')](_0x247773);}return _0x5c00f6['status'](_0x247773)[_0x091f('0x1a')]();};}function respondWithResult(_0x579d87,_0x5aac2c){_0x5aac2c=_0x5aac2c||0xc8;return function(_0x1b7829){if(_0x1b7829){return _0x579d87['status'](_0x5aac2c)[_0x091f('0x1b')](_0x1b7829);}};}function respondWithFilteredResult(_0x2add79,_0x64aa5b){return function(_0x17bae9){if(_0x17bae9){var _0x1977c8=typeof _0x64aa5b['offset']===_0x091f('0x1c')&&typeof _0x64aa5b[_0x091f('0x1d')]===_0x091f('0x1c');var _0x2a066e=_0x17bae9[_0x091f('0x1e')];var _0x1eada1=_0x1977c8?0x0:_0x64aa5b['offset'];var _0x308aa2=_0x1977c8?_0x17bae9[_0x091f('0x1e')]:_0x64aa5b[_0x091f('0x1f')]+_0x64aa5b['limit'];var _0x42f192;if(_0x308aa2>=_0x2a066e){_0x308aa2=_0x2a066e;_0x42f192=0xc8;}else{_0x42f192=0xce;}_0x2add79[_0x091f('0x20')](_0x42f192);return _0x2add79['set'](_0x091f('0x21'),_0x1eada1+'-'+_0x308aa2+'/'+_0x2a066e)[_0x091f('0x1b')](_0x17bae9);}return null;};}function patchUpdates(_0x523c58){return function(_0x314f1c){try{jsonpatch['apply'](_0x314f1c,_0x523c58,!![]);}catch(_0x4b1852){return BPromise['reject'](_0x4b1852);}return _0x314f1c[_0x091f('0x22')]();};}function saveUpdates(_0x432d31,_0x495282){return function(_0x49b8ac){if(_0x49b8ac){return _0x49b8ac[_0x091f('0x23')](_0x432d31)['then'](function(_0x476f28){return _0x476f28;});}return null;};}function removeEntity(_0x21f72f,_0x6120c8){return function(_0x26a9c7){if(_0x26a9c7){return _0x26a9c7[_0x091f('0x24')]()[_0x091f('0x25')](function(){var _0x324e30=_0x26a9c7['get']({'plain':!![]});var _0x4dafc5=_0x091f('0x26');return db[_0x091f('0x27')][_0x091f('0x24')]({'where':{'type':_0x4dafc5,'resourceId':_0x324e30['id']}})[_0x091f('0x25')](function(){return _0x26a9c7;});})[_0x091f('0x25')](function(){_0x21f72f['status'](0xcc)[_0x091f('0x1a')]();});}};}function handleEntityNotFound(_0x38e5f1,_0x285f36){return function(_0x1b32d5){if(!_0x1b32d5){_0x38e5f1['sendStatus'](0x194);}return _0x1b32d5;};}function handleError(_0x3233b8,_0x4927a2){_0x4927a2=_0x4927a2||0x1f4;return function(_0x19f5d5){logger['error'](_0x19f5d5['stack']);if(_0x19f5d5[_0x091f('0x28')]){delete _0x19f5d5[_0x091f('0x28')];}_0x3233b8[_0x091f('0x20')](_0x4927a2)[_0x091f('0x29')](_0x19f5d5);};}exports[_0x091f('0x2a')]=function(_0x24c27f,_0x224f1d){var _0x385d21={},_0x220c6f={},_0x364541={'count':0x0,'rows':[]};var _0x48b19b=_[_0x091f('0x2b')](db[_0x091f('0x2c')][_0x091f('0x2d')],function(_0x22b8f7){return{'name':_0x22b8f7['fieldName'],'type':_0x22b8f7[_0x091f('0x2e')]['key']};});_0x220c6f[_0x091f('0x2f')]=_['map'](_0x48b19b,_0x091f('0x28'));_0x220c6f[_0x091f('0x30')]=_[_0x091f('0x31')](_0x24c27f['query']);_0x220c6f['filters']=_[_0x091f('0x32')](_0x220c6f['model'],_0x220c6f[_0x091f('0x30')]);_0x385d21['attributes']=_[_0x091f('0x32')](_0x220c6f['model'],qs[_0x091f('0x33')](_0x24c27f[_0x091f('0x30')][_0x091f('0x33')]));_0x385d21[_0x091f('0x34')]=_0x385d21[_0x091f('0x34')][_0x091f('0x35')]?_0x385d21[_0x091f('0x34')]:_0x220c6f[_0x091f('0x2f')];if(!_0x24c27f[_0x091f('0x30')]['hasOwnProperty'](_0x091f('0x36'))){_0x385d21[_0x091f('0x1d')]=qs['limit'](_0x24c27f[_0x091f('0x30')][_0x091f('0x1d')]);_0x385d21[_0x091f('0x1f')]=qs[_0x091f('0x1f')](_0x24c27f[_0x091f('0x30')][_0x091f('0x1f')]);}_0x385d21[_0x091f('0x37')]=qs[_0x091f('0x38')](_0x24c27f[_0x091f('0x30')][_0x091f('0x38')]);_0x385d21[_0x091f('0x39')]=qs['filters'](_['pick'](_0x24c27f[_0x091f('0x30')],_0x220c6f['filters']),_0x48b19b);if(_0x24c27f[_0x091f('0x30')][_0x091f('0x3a')]){_0x385d21[_0x091f('0x39')]=_[_0x091f('0x3b')](_0x385d21['where'],{'$or':_[_0x091f('0x2b')](_0x48b19b,function(_0x5a994b){if(_0x5a994b[_0x091f('0x2e')]!=='VIRTUAL'){var _0x37c29a={};_0x37c29a[_0x5a994b['name']]={'$like':'%'+_0x24c27f[_0x091f('0x30')][_0x091f('0x3a')]+'%'};return _0x37c29a;}})});}_0x385d21=_[_0x091f('0x3b')]({},_0x385d21,_0x24c27f['options']);var _0x47738e={'where':_0x385d21[_0x091f('0x39')]};return db['FaxQueue']['count'](_0x47738e)[_0x091f('0x25')](function(_0x445032){_0x364541[_0x091f('0x1e')]=_0x445032;if(_0x24c27f[_0x091f('0x30')][_0x091f('0x3c')]){_0x385d21[_0x091f('0x3d')]=[{'all':!![]}];}return db['FaxQueue'][_0x091f('0x3e')](_0x385d21);})['then'](function(_0x9aefd3){_0x364541[_0x091f('0x3f')]=_0x9aefd3;return _0x364541;})[_0x091f('0x25')](respondWithFilteredResult(_0x224f1d,_0x385d21))[_0x091f('0x40')](handleError(_0x224f1d,null));};exports[_0x091f('0x41')]=function(_0x71276a,_0x234500){var _0x5b9cd9={'raw':!![],'where':{'id':_0x71276a['params']['id']}},_0x3c20be={};_0x3c20be[_0x091f('0x2f')]=_['keys'](db[_0x091f('0x2c')]['rawAttributes']);_0x3c20be[_0x091f('0x30')]=_['keys'](_0x71276a[_0x091f('0x30')]);_0x3c20be['filters']=_[_0x091f('0x32')](_0x3c20be[_0x091f('0x2f')],_0x3c20be[_0x091f('0x30')]);_0x5b9cd9[_0x091f('0x34')]=_[_0x091f('0x32')](_0x3c20be[_0x091f('0x2f')],qs['fields'](_0x71276a[_0x091f('0x30')][_0x091f('0x33')]));_0x5b9cd9[_0x091f('0x34')]=_0x5b9cd9[_0x091f('0x34')]['length']?_0x5b9cd9['attributes']:_0x3c20be[_0x091f('0x2f')];if(_0x71276a['query'][_0x091f('0x3c')]){_0x5b9cd9[_0x091f('0x3d')]=[{'all':!![]}];}_0x5b9cd9=_[_0x091f('0x3b')]({},_0x5b9cd9,_0x71276a[_0x091f('0x42')]);return db['FaxQueue']['find'](_0x5b9cd9)['then'](handleEntityNotFound(_0x234500,null))[_0x091f('0x25')](respondWithResult(_0x234500,null))[_0x091f('0x40')](handleError(_0x234500,null));};exports[_0x091f('0x43')]=function(_0x3c8777,_0x50ac0a){return db[_0x091f('0x2c')][_0x091f('0x43')](_0x3c8777[_0x091f('0x44')],{})[_0x091f('0x25')](function(_0x4eeb8b){var _0x4f88bf=_0x3c8777['user']['get']({'plain':!![]});if(!_0x4f88bf)throw new Error(_0x091f('0x45'));if(_0x4f88bf[_0x091f('0x46')]===_0x091f('0x47')){var _0x346d0e=_0x4eeb8b[_0x091f('0x48')]({'plain':!![]});var _0x151b82=_0x091f('0x26');return db['UserProfileSection'][_0x091f('0x49')]({'where':{'name':_0x151b82,'userProfileId':_0x4f88bf[_0x091f('0x4a')]},'raw':!![]})[_0x091f('0x25')](function(_0x453b9c){if(_0x453b9c&&_0x453b9c[_0x091f('0x4b')]===0x0){return db[_0x091f('0x27')][_0x091f('0x43')]({'name':_0x346d0e[_0x091f('0x28')],'resourceId':_0x346d0e['id'],'type':_0x453b9c['name'],'sectionId':_0x453b9c['id']},{})['then'](function(){return _0x4eeb8b;});}else{return _0x4eeb8b;}})[_0x091f('0x40')](function(_0x72dd89){logger[_0x091f('0x4c')](_0x091f('0x4d'),_0x72dd89);throw _0x72dd89;});}return _0x4eeb8b;})[_0x091f('0x25')](respondWithResult(_0x50ac0a,0xc9))[_0x091f('0x40')](handleError(_0x50ac0a,null));};exports[_0x091f('0x23')]=function(_0x56a7a5,_0x147692){if(_0x56a7a5[_0x091f('0x44')]['id']){delete _0x56a7a5[_0x091f('0x44')]['id'];}return db[_0x091f('0x2c')][_0x091f('0x49')]({'where':{'id':_0x56a7a5['params']['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x147692,null))[_0x091f('0x25')](saveUpdates(_0x56a7a5['body'],null))[_0x091f('0x25')](respondWithResult(_0x147692,null))[_0x091f('0x40')](handleError(_0x147692,null));};exports['destroy']=function(_0x59f4df,_0xe1e4c5){return db['FaxQueue'][_0x091f('0x49')]({'where':{'id':_0x59f4df[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0xe1e4c5,null))[_0x091f('0x25')](removeEntity(_0xe1e4c5,null))['catch'](handleError(_0xe1e4c5,null));};exports['describe']=function(_0x14ca6d,_0x3bdffd){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x3bdffd,null))[_0x091f('0x40')](handleError(_0x3bdffd,null));};exports[_0x091f('0x4f')]=function(_0x23dd7b,_0x215897,_0x23ea30){var _0x26b2e5={'raw':!![],'where':{}},_0x17eef9={},_0x36fdac;return db['FaxQueue'][_0x091f('0x50')]({'where':{'id':_0x23dd7b[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x215897,null))[_0x091f('0x25')](function(_0x559a6c){if(_0x559a6c){_0x36fdac=_0x559a6c['get']({'plain':!![]});_0x17eef9[_0x091f('0x2f')]=_[_0x091f('0x31')](db[_0x091f('0x51')][_0x091f('0x2d')]);_0x17eef9[_0x091f('0x30')]=_['keys'](_0x23dd7b['query']);_0x17eef9['filters']=_[_0x091f('0x32')](_0x17eef9[_0x091f('0x2f')],_0x17eef9[_0x091f('0x30')]);_0x26b2e5[_0x091f('0x34')]=_[_0x091f('0x32')](_0x17eef9[_0x091f('0x2f')],qs[_0x091f('0x33')](_0x23dd7b['query']['fields']));_0x26b2e5[_0x091f('0x34')]=_0x26b2e5[_0x091f('0x34')][_0x091f('0x35')]?_0x26b2e5[_0x091f('0x34')]:_0x17eef9['model'];if(!_0x23dd7b[_0x091f('0x30')][_0x091f('0x52')](_0x091f('0x36'))){_0x26b2e5[_0x091f('0x1d')]=qs[_0x091f('0x1d')](_0x23dd7b['query'][_0x091f('0x1d')]);_0x26b2e5['offset']=qs[_0x091f('0x1f')](_0x23dd7b[_0x091f('0x30')][_0x091f('0x1f')]);}_0x26b2e5[_0x091f('0x37')]=qs[_0x091f('0x38')](_0x23dd7b[_0x091f('0x30')][_0x091f('0x38')]);_0x26b2e5['where']=qs[_0x091f('0x53')](_[_0x091f('0x54')](_0x23dd7b[_0x091f('0x30')],_0x17eef9[_0x091f('0x53')]));_0x26b2e5[_0x091f('0x39')]['FaxQueueId']=_0x559a6c['id'];if(_0x23dd7b[_0x091f('0x30')][_0x091f('0x3a')]){_0x26b2e5[_0x091f('0x39')]=_[_0x091f('0x3b')](_0x26b2e5[_0x091f('0x39')],{'$or':_['map'](_0x26b2e5[_0x091f('0x34')],function(_0x456449){var _0x5c0a74={};_0x5c0a74[_0x456449]={'$like':'%'+_0x23dd7b[_0x091f('0x30')]['filter']+'%'};return _0x5c0a74;})});}_0x26b2e5=_[_0x091f('0x3b')]({},_0x26b2e5,_0x23dd7b[_0x091f('0x42')]);return db[_0x091f('0x51')]['findAll'](_0x26b2e5);}})['then'](function(_0x3ca3a1){if(_0x3ca3a1){return db[_0x091f('0x55')][_0x091f('0x56')]({'where':{'id':_[_0x091f('0x2b')](_0x3ca3a1,_0x091f('0x57')),'role':_0x091f('0x58')},'attributes':['id','name',_0x091f('0x59'),'updatedAt',_0x091f('0x5a')]});}})[_0x091f('0x25')](function(_0xc70531){if(_0xc70531){return{'count':_0xc70531[_0x091f('0x1e')],'rows':_['map'](_0xc70531[_0x091f('0x3f')],function(_0x2ec5ee){return{'membername':_0x2ec5ee[_0x091f('0x28')],'UserId':_0x2ec5ee['id'],'queue_name':_0x36fdac[_0x091f('0x28')],'FaxQueueId':_0x36fdac['id'],'interface':util[_0x091f('0x5b')](_0x091f('0x5c'),_0x091f('0x5d'),_0x2ec5ee[_0x091f('0x28')]),'penalty':0x0,'paused':_0x2ec5ee['faxPause'],'createdAt':_0x2ec5ee[_0x091f('0x5a')],'updatedAt':_0x2ec5ee[_0x091f('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x091f('0x25')](respondWithFilteredResult(_0x215897,_0x26b2e5))[_0x091f('0x40')](handleError(_0x215897,null));};exports[_0x091f('0x5f')]=function(_0x2a5874,_0x1ffe06,_0x594bb2){var _0x12f653={};var _0x461d45={};var _0x197475;var _0x3ac64f;return db['FaxQueue'][_0x091f('0x50')]({'where':{'id':_0x2a5874[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x1ffe06,null))[_0x091f('0x25')](function(_0x41e497){if(_0x41e497){_0x197475=_0x41e497;_0x461d45[_0x091f('0x2f')]=_['keys'](db[_0x091f('0x60')][_0x091f('0x2d')]);_0x461d45[_0x091f('0x30')]=_[_0x091f('0x31')](_0x2a5874[_0x091f('0x30')]);_0x461d45[_0x091f('0x53')]=_[_0x091f('0x32')](_0x461d45[_0x091f('0x2f')],_0x461d45[_0x091f('0x30')]);_0x12f653[_0x091f('0x34')]=_[_0x091f('0x32')](_0x461d45['model'],qs[_0x091f('0x33')](_0x2a5874[_0x091f('0x30')][_0x091f('0x33')]));_0x12f653[_0x091f('0x34')]=_0x12f653[_0x091f('0x34')]['length']?_0x12f653[_0x091f('0x34')]:_0x461d45[_0x091f('0x2f')];_0x12f653['order']=qs[_0x091f('0x38')](_0x2a5874[_0x091f('0x30')]['sort']);_0x12f653[_0x091f('0x39')]=qs['filters'](_[_0x091f('0x54')](_0x2a5874['query'],_0x461d45[_0x091f('0x53')]));if(_0x2a5874['query'][_0x091f('0x3a')]){_0x12f653[_0x091f('0x39')]=_[_0x091f('0x3b')](_0x12f653[_0x091f('0x39')],{'$or':_[_0x091f('0x2b')](_0x12f653[_0x091f('0x34')],function(_0x47d086){var _0x440154={};_0x440154[_0x47d086]={'$like':'%'+_0x2a5874[_0x091f('0x30')][_0x091f('0x3a')]+'%'};return _0x440154;})});}_0x12f653=_[_0x091f('0x3b')]({},_0x12f653,_0x2a5874[_0x091f('0x42')]);return _0x197475[_0x091f('0x5f')](_0x12f653);}})[_0x091f('0x25')](function(_0x52efe9){if(_0x52efe9){_0x3ac64f=_0x52efe9['length'];if(!_0x2a5874['query'][_0x091f('0x52')](_0x091f('0x36'))){_0x12f653['limit']=qs['limit'](_0x2a5874[_0x091f('0x30')][_0x091f('0x1d')]);_0x12f653[_0x091f('0x1f')]=qs[_0x091f('0x1f')](_0x2a5874[_0x091f('0x30')]['offset']);}return _0x197475[_0x091f('0x5f')](_0x12f653);}})[_0x091f('0x25')](function(_0x99467d){if(_0x99467d){return _0x99467d?{'count':_0x3ac64f,'rows':_0x99467d}:null;}})[_0x091f('0x25')](respondWithResult(_0x1ffe06,null))['catch'](handleError(_0x1ffe06,null));};exports['addTeams']=function(_0xa72191,_0x1010e8,_0x675faf){var _0x534362=_0xa72191[_0x091f('0x44')][_0x091f('0x61')];return db[_0x091f('0x60')]['findAll']({'where':{'id':_0x534362},'attributes':['id'],'include':[{'model':db['User'],'as':_0x091f('0x62'),'attributes':['id',_0x091f('0x28'),_0x091f('0x63'),_0x091f('0x64'),_0x091f('0x65')],'raw':!![]}]})[_0x091f('0x25')](function(_0x53c42b){if(_0x53c42b){var _0x2db215=_[_0x091f('0x66')](_0x53c42b,function(_0x488496){var _0x46fb36=_0x488496[_0x091f('0x48')]({'plain':!![]});return _0x46fb36[_0x091f('0x62')];});return db[_0x091f('0x2c')][_0x091f('0x49')]({'where':{'id':_0xa72191[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](function(_0x421ec){return db[_0x091f('0x67')][_0x091f('0x68')](function(_0x1f092c){return _0x421ec['addTeams'](_0x534362,{'transaction':_0x1f092c})['then'](function(){return BPromise[_0x091f('0x69')](_0x2db215,function(_0x4870fa){return db[_0x091f('0x51')]['findOrCreate']({'where':{'UserId':_0x4870fa['id'],'FaxQueueId':_0xa72191['params']['id']},'transaction':_0x1f092c});});})[_0x091f('0x25')](function(){_0x2db215['forEach'](function(_0x58336c){socket[_0x091f('0x6a')]('userFaxQueue:save',{'UserId':_0x58336c['id'],'FaxQueueId':_0x421ec['id']});});});});});}})[_0x091f('0x25')](respondWithStatusCode(_0x1010e8,null))[_0x091f('0x40')](handleError(_0x1010e8,null));};exports[_0x091f('0x6b')]=function(_0x5648b3,_0x5b8524,_0x26e031){return db[_0x091f('0x60')][_0x091f('0x3e')]({'where':{'id':_0x5648b3[_0x091f('0x30')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x091f('0x62'),'attributes':['id'],'raw':!![]}]})[_0x091f('0x25')](handleEntityNotFound(_0x5b8524,null))[_0x091f('0x25')](function(_0x323136){var _0x168fcf=_[_0x091f('0x2b')](_0x323136,'id');var _0x389690=[];var _0x54b0e5=[];var _0x1cd2c8=squel[_0x091f('0x6c')]();_0x1cd2c8[_0x091f('0x6d')](_0x091f('0x6e'))['from']('team_has_fax_queues','tq')[_0x091f('0x6f')](_0x091f('0x70'),'ut',_0x091f('0x71'))[_0x091f('0x39')]('FaxQueueId\x20=\x20?',_0x5648b3['params']['id']);for(var _0x31f05d=0x0;_0x31f05d<_0x323136[_0x091f('0x35')];_0x31f05d+=0x1){let _0x4a2c65=_0x323136[_0x31f05d];for(var _0x575dff=0x0;_0x575dff<_0x4a2c65['Agents']['length'];_0x575dff+=0x1){let _0x12b7a5=_0x4a2c65['Agents'][_0x575dff];var _0x487312=_0x1cd2c8['clone']();_0x487312[_0x091f('0x39')](_0x091f('0x72'),_0x12b7a5['id']);_0x54b0e5['push'](db['sequelize']['query'](_0x487312['toString'](),{'type':db[_0x091f('0x67')]['QueryTypes'][_0x091f('0x73')]})[_0x091f('0x25')](function(_0x642eb3){if(_0x642eb3[_0x091f('0x35')]===0x1){return _0x12b7a5['id'];}else{var _0x3cd112=_[_0x091f('0x74')](_['map'](_0x642eb3,_0x091f('0x75')),function(_0x5a3a37){return _[_0x091f('0x76')](_0x168fcf,_0x5a3a37);});if(_0x3cd112){return _0x12b7a5['id'];}}}));}}return BPromise['all'](_0x54b0e5)[_0x091f('0x25')](function(_0x39920e){_0x389690=_(_0x389690)['union'](_0x39920e)[_0x091f('0x77')]()[_0x091f('0x78')]();return db[_0x091f('0x2c')][_0x091f('0x49')]({'where':{'id':_0x5648b3[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](function(_0x4eaf3b){return db[_0x091f('0x67')][_0x091f('0x68')](function(_0x2d9652){return _0x4eaf3b[_0x091f('0x6b')](_0x5648b3[_0x091f('0x30')][_0x091f('0x61')],{'transaction':_0x2d9652})[_0x091f('0x25')](function(){if(!_[_0x091f('0x79')](_0x389690)){return _0x4eaf3b['removeAgents'](_0x389690,{'transaction':_0x2d9652});}})['then'](function(){_0x389690['forEach'](function(_0x42291f){socket['emit']('userFaxQueue:remove',{'UserId':_0x42291f,'FaxQueueId':_0x4eaf3b['id']});});});});});});})[_0x091f('0x25')](respondWithStatusCode(_0x5b8524,null))[_0x091f('0x40')](handleError(_0x5b8524,null));};exports[_0x091f('0x7a')]=function(_0x64f59a,_0x52195e,_0xbf85a6){return db['FaxQueue'][_0x091f('0x49')]({'where':{'id':_0x64f59a[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x52195e,null))[_0x091f('0x25')](function(_0xb31f8d){if(_0xb31f8d){return _0xb31f8d['addAgents'](_0x64f59a[_0x091f('0x44')][_0x091f('0x61')],_[_0x091f('0x7b')](_0x64f59a[_0x091f('0x44')],['ids','id'])||{})['spread'](function(_0x435ebd){for(var _0x45a5c7=0x0;_0x45a5c7<_0x64f59a[_0x091f('0x44')][_0x091f('0x61')]['length'];_0x45a5c7+=0x1){socket[_0x091f('0x6a')](_0x091f('0x7c'),{'UserId':Number(_0x64f59a[_0x091f('0x44')][_0x091f('0x61')][_0x45a5c7]),'FaxQueueId':Number(_0x64f59a[_0x091f('0x4e')]['id'])});}return _0x435ebd;});}})[_0x091f('0x25')](respondWithResult(_0x52195e,null))[_0x091f('0x40')](handleError(_0x52195e,null));};exports[_0x091f('0x7d')]=function(_0x2998b3,_0x136276,_0x4b486f){return db[_0x091f('0x2c')][_0x091f('0x49')]({'where':{'id':_0x2998b3[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x136276,null))[_0x091f('0x25')](function(_0x33f873){if(_0x33f873){return _0x33f873[_0x091f('0x7d')](_0x2998b3['query'][_0x091f('0x61')])[_0x091f('0x25')](function(){if(_[_0x091f('0x7e')](_0x2998b3[_0x091f('0x30')][_0x091f('0x61')])){for(var _0x14c37f=0x0;_0x14c37f<_0x2998b3[_0x091f('0x30')][_0x091f('0x61')][_0x091f('0x35')];_0x14c37f+=0x1){socket[_0x091f('0x6a')]('userFaxQueue:remove',{'UserId':Number(_0x2998b3['query']['ids'][_0x14c37f]),'FaxQueueId':Number(_0x2998b3[_0x091f('0x4e')]['id'])});}}else{socket[_0x091f('0x6a')](_0x091f('0x7f'),{'UserId':Number(_0x2998b3[_0x091f('0x30')]['ids']),'FaxQueueId':Number(_0x2998b3[_0x091f('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x136276,null))[_0x091f('0x40')](handleError(_0x136276,null));};exports['getAgents']=function(_0x100b52,_0x13500b,_0x492882){var _0xb9e947={};var _0xfa12a0={};var _0x10ac74;var _0x4a0fa0;return db[_0x091f('0x2c')][_0x091f('0x50')]({'where':{'id':_0x100b52[_0x091f('0x4e')]['id']}})[_0x091f('0x25')](handleEntityNotFound(_0x13500b,null))[_0x091f('0x25')](function(_0x34d97f){if(_0x34d97f){_0x10ac74=_0x34d97f;_0xfa12a0[_0x091f('0x2f')]=_[_0x091f('0x31')](db[_0x091f('0x55')]['rawAttributes']);_0xfa12a0[_0x091f('0x30')]=_[_0x091f('0x31')](_0x100b52['query']);_0xfa12a0[_0x091f('0x53')]=_['intersection'](_0xfa12a0[_0x091f('0x2f')],_0xfa12a0[_0x091f('0x30')]);_0xb9e947[_0x091f('0x34')]=_[_0x091f('0x32')](_0xfa12a0[_0x091f('0x2f')],qs[_0x091f('0x33')](_0x100b52[_0x091f('0x30')][_0x091f('0x33')]));_0xb9e947[_0x091f('0x34')]=_0xb9e947['attributes'][_0x091f('0x35')]?_0xb9e947[_0x091f('0x34')]:_0xfa12a0[_0x091f('0x2f')];_0xb9e947['order']=qs['sort'](_0x100b52['query'][_0x091f('0x38')]);_0xb9e947[_0x091f('0x39')]=qs[_0x091f('0x53')](_['pick'](_0x100b52[_0x091f('0x30')],_0xfa12a0[_0x091f('0x53')]));if(_0x100b52[_0x091f('0x30')]['filter']){_0xb9e947[_0x091f('0x39')]=_['merge'](_0xb9e947[_0x091f('0x39')],{'$or':_[_0x091f('0x2b')](_0xb9e947[_0x091f('0x34')],function(_0x191eaa){var _0x43302a={};_0x43302a[_0x191eaa]={'$like':'%'+_0x100b52[_0x091f('0x30')][_0x091f('0x3a')]+'%'};return _0x43302a;})});}_0xb9e947=_[_0x091f('0x3b')]({},_0xb9e947,_0x100b52[_0x091f('0x42')]);return _0x10ac74['getAgents'](_0xb9e947);}})[_0x091f('0x25')](function(_0x3bf944){if(_0x3bf944){_0x4a0fa0=_0x3bf944['length'];if(!_0x100b52[_0x091f('0x30')][_0x091f('0x52')](_0x091f('0x36'))){_0xb9e947[_0x091f('0x1d')]=qs[_0x091f('0x1d')](_0x100b52['query'][_0x091f('0x1d')]);_0xb9e947[_0x091f('0x1f')]=qs[_0x091f('0x1f')](_0x100b52[_0x091f('0x30')][_0x091f('0x1f')]);}return _0x10ac74[_0x091f('0x80')](_0xb9e947);}})[_0x091f('0x25')](function(_0x477306){if(_0x477306){return _0x477306?{'count':_0x4a0fa0,'rows':_0x477306}:null;}})['then'](respondWithResult(_0x13500b,null))[_0x091f('0x40')](handleError(_0x13500b,null));}; \ No newline at end of file +var _0x4a08=['catch','show','intersection','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxQueues','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','request-promise','bluebird','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','FaxQueue','include','findAll','rows'];(function(_0x2c4910,_0x17775f){var _0x47939d=function(_0x53574d){while(--_0x53574d){_0x2c4910['push'](_0x2c4910['shift']());}};_0x47939d(++_0x17775f);}(_0x4a08,0x159));var _0x84a0=function(_0xc54d44,_0x3c1316){_0xc54d44=_0xc54d44-0x0;var _0x4d5f78=_0x4a08[_0xc54d44];return _0x4d5f78;};'use strict';var emlformat=require(_0x84a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84a0('0x2'));var moment=require('moment');var BPromise=require(_0x84a0('0x3'));var Mustache=require('mustache');var util=require(_0x84a0('0x4'));var path=require(_0x84a0('0x5'));var sox=require(_0x84a0('0x6'));var csv=require(_0x84a0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84a0('0x8'));var squel=require(_0x84a0('0x9'));var crypto=require(_0x84a0('0xa'));var jsforce=require(_0x84a0('0xb'));var deskjs=require(_0x84a0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x84a0('0xd'));var Papa=require(_0x84a0('0xe'));var Redis=require(_0x84a0('0xf'));var authService=require(_0x84a0('0x10'));var qs=require(_0x84a0('0x11'));var as=require(_0x84a0('0x12'));var hardwareService=require(_0x84a0('0x13'));var logger=require(_0x84a0('0x14'))(_0x84a0('0x15'));var utils=require('../../config/utils');var config=require(_0x84a0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x84a0('0x17'))['db'];config[_0x84a0('0x18')]=_[_0x84a0('0x19')](config[_0x84a0('0x18')],{'host':_0x84a0('0x1a'),'port':0x18eb});var socket=require(_0x84a0('0x1b'))(new Redis(config[_0x84a0('0x18')]));require(_0x84a0('0x1c'))[_0x84a0('0x1d')](socket);function respondWithStatusCode(_0xc41fbb,_0xa1d644){_0xa1d644=_0xa1d644||0xcc;return function(_0x5e893c){if(_0x5e893c){return _0xc41fbb['sendStatus'](_0xa1d644);}return _0xc41fbb['status'](_0xa1d644)[_0x84a0('0x1e')]();};}function respondWithResult(_0x6d3de6,_0x4d8bd8){_0x4d8bd8=_0x4d8bd8||0xc8;return function(_0x29cc65){if(_0x29cc65){return _0x6d3de6['status'](_0x4d8bd8)[_0x84a0('0x1f')](_0x29cc65);}};}function respondWithFilteredResult(_0x4bc00d,_0x3b8e79){return function(_0x32585c){if(_0x32585c){var _0xcfc6f0=typeof _0x3b8e79[_0x84a0('0x20')]===_0x84a0('0x21')&&typeof _0x3b8e79[_0x84a0('0x22')]==='undefined';var _0x3dcaac=_0x32585c[_0x84a0('0x23')];var _0xa3d78c=_0xcfc6f0?0x0:_0x3b8e79[_0x84a0('0x20')];var _0x590ef0=_0xcfc6f0?_0x32585c[_0x84a0('0x23')]:_0x3b8e79[_0x84a0('0x20')]+_0x3b8e79['limit'];var _0x23dc68;if(_0x590ef0>=_0x3dcaac){_0x590ef0=_0x3dcaac;_0x23dc68=0xc8;}else{_0x23dc68=0xce;}_0x4bc00d[_0x84a0('0x24')](_0x23dc68);return _0x4bc00d[_0x84a0('0x25')](_0x84a0('0x26'),_0xa3d78c+'-'+_0x590ef0+'/'+_0x3dcaac)[_0x84a0('0x1f')](_0x32585c);}return null;};}function patchUpdates(_0x36df8e){return function(_0x10726c){try{jsonpatch[_0x84a0('0x27')](_0x10726c,_0x36df8e,!![]);}catch(_0x27361d){return BPromise['reject'](_0x27361d);}return _0x10726c[_0x84a0('0x28')]();};}function saveUpdates(_0x532160,_0x548414){return function(_0x205aa0){if(_0x205aa0){return _0x205aa0[_0x84a0('0x29')](_0x532160)['then'](function(_0x1bfc2b){return _0x1bfc2b;});}return null;};}function removeEntity(_0x556fbc,_0x4c244b){return function(_0x37d21a){if(_0x37d21a){return _0x37d21a[_0x84a0('0x2a')]()[_0x84a0('0x2b')](function(){var _0x2760f3=_0x37d21a[_0x84a0('0x2c')]({'plain':!![]});var _0x279784='FaxQueues';return db[_0x84a0('0x2d')][_0x84a0('0x2a')]({'where':{'type':_0x279784,'resourceId':_0x2760f3['id']}})[_0x84a0('0x2b')](function(){return _0x37d21a;});})[_0x84a0('0x2b')](function(){_0x556fbc[_0x84a0('0x24')](0xcc)[_0x84a0('0x1e')]();});}};}function handleEntityNotFound(_0x2d455e,_0x951885){return function(_0x4ba087){if(!_0x4ba087){_0x2d455e['sendStatus'](0x194);}return _0x4ba087;};}function handleError(_0x24f9b1,_0x227101){_0x227101=_0x227101||0x1f4;return function(_0x47391a){logger[_0x84a0('0x2e')](_0x47391a[_0x84a0('0x2f')]);if(_0x47391a[_0x84a0('0x30')]){delete _0x47391a[_0x84a0('0x30')];}_0x24f9b1[_0x84a0('0x24')](_0x227101)[_0x84a0('0x31')](_0x47391a);};}exports[_0x84a0('0x32')]=function(_0x515aa2,_0x43fda6){var _0x16387a={},_0x3d8e62={},_0x20b3b3={'count':0x0,'rows':[]};var _0x38d777=_[_0x84a0('0x33')](db['FaxQueue'][_0x84a0('0x34')],function(_0x1b6c13){return{'name':_0x1b6c13['fieldName'],'type':_0x1b6c13['type'][_0x84a0('0x35')]};});_0x3d8e62['model']=_[_0x84a0('0x33')](_0x38d777,_0x84a0('0x30'));_0x3d8e62[_0x84a0('0x36')]=_[_0x84a0('0x37')](_0x515aa2['query']);_0x3d8e62[_0x84a0('0x38')]=_['intersection'](_0x3d8e62[_0x84a0('0x39')],_0x3d8e62[_0x84a0('0x36')]);_0x16387a[_0x84a0('0x3a')]=_['intersection'](_0x3d8e62[_0x84a0('0x39')],qs['fields'](_0x515aa2[_0x84a0('0x36')][_0x84a0('0x3b')]));_0x16387a[_0x84a0('0x3a')]=_0x16387a[_0x84a0('0x3a')][_0x84a0('0x3c')]?_0x16387a[_0x84a0('0x3a')]:_0x3d8e62[_0x84a0('0x39')];if(!_0x515aa2[_0x84a0('0x36')][_0x84a0('0x3d')](_0x84a0('0x3e'))){_0x16387a[_0x84a0('0x22')]=qs[_0x84a0('0x22')](_0x515aa2[_0x84a0('0x36')][_0x84a0('0x22')]);_0x16387a[_0x84a0('0x20')]=qs[_0x84a0('0x20')](_0x515aa2['query']['offset']);}_0x16387a[_0x84a0('0x3f')]=qs['sort'](_0x515aa2['query'][_0x84a0('0x40')]);_0x16387a[_0x84a0('0x41')]=qs['filters'](_[_0x84a0('0x42')](_0x515aa2[_0x84a0('0x36')],_0x3d8e62[_0x84a0('0x38')]),_0x38d777);if(_0x515aa2[_0x84a0('0x36')]['filter']){_0x16387a['where']=_[_0x84a0('0x43')](_0x16387a['where'],{'$or':_[_0x84a0('0x33')](_0x38d777,function(_0x3d277e){if(_0x3d277e[_0x84a0('0x44')]!==_0x84a0('0x45')){var _0xd44b9={};_0xd44b9[_0x3d277e['name']]={'$like':'%'+_0x515aa2['query'][_0x84a0('0x46')]+'%'};return _0xd44b9;}})});}_0x16387a=_[_0x84a0('0x43')]({},_0x16387a,_0x515aa2['options']);var _0x26f363={'where':_0x16387a['where']};return db[_0x84a0('0x47')][_0x84a0('0x23')](_0x26f363)['then'](function(_0x501447){_0x20b3b3[_0x84a0('0x23')]=_0x501447;if(_0x515aa2[_0x84a0('0x36')]['includeAll']){_0x16387a[_0x84a0('0x48')]=[{'all':!![]}];}return db[_0x84a0('0x47')][_0x84a0('0x49')](_0x16387a);})['then'](function(_0x51102e){_0x20b3b3[_0x84a0('0x4a')]=_0x51102e;return _0x20b3b3;})[_0x84a0('0x2b')](respondWithFilteredResult(_0x43fda6,_0x16387a))[_0x84a0('0x4b')](handleError(_0x43fda6,null));};exports[_0x84a0('0x4c')]=function(_0xcb1e7e,_0x519e3a){var _0x123fe3={'raw':!![],'where':{'id':_0xcb1e7e['params']['id']}},_0xb12b36={};_0xb12b36[_0x84a0('0x39')]=_[_0x84a0('0x37')](db[_0x84a0('0x47')][_0x84a0('0x34')]);_0xb12b36['query']=_[_0x84a0('0x37')](_0xcb1e7e[_0x84a0('0x36')]);_0xb12b36[_0x84a0('0x38')]=_['intersection'](_0xb12b36[_0x84a0('0x39')],_0xb12b36['query']);_0x123fe3[_0x84a0('0x3a')]=_[_0x84a0('0x4d')](_0xb12b36[_0x84a0('0x39')],qs[_0x84a0('0x3b')](_0xcb1e7e['query'][_0x84a0('0x3b')]));_0x123fe3[_0x84a0('0x3a')]=_0x123fe3[_0x84a0('0x3a')][_0x84a0('0x3c')]?_0x123fe3['attributes']:_0xb12b36['model'];if(_0xcb1e7e[_0x84a0('0x36')][_0x84a0('0x4e')]){_0x123fe3[_0x84a0('0x48')]=[{'all':!![]}];}_0x123fe3=_[_0x84a0('0x43')]({},_0x123fe3,_0xcb1e7e['options']);return db[_0x84a0('0x47')][_0x84a0('0x4f')](_0x123fe3)[_0x84a0('0x2b')](handleEntityNotFound(_0x519e3a,null))[_0x84a0('0x2b')](respondWithResult(_0x519e3a,null))[_0x84a0('0x4b')](handleError(_0x519e3a,null));};exports['create']=function(_0x1c996d,_0x56ad52){return db[_0x84a0('0x47')]['create'](_0x1c996d[_0x84a0('0x50')],{})[_0x84a0('0x2b')](function(_0x35765c){var _0x29c64f=_0x1c996d['user'][_0x84a0('0x2c')]({'plain':!![]});if(!_0x29c64f)throw new Error(_0x84a0('0x51'));if(_0x29c64f[_0x84a0('0x52')]===_0x84a0('0x53')){var _0x5a8c9e=_0x35765c[_0x84a0('0x2c')]({'plain':!![]});var _0x261851=_0x84a0('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x261851,'userProfileId':_0x29c64f[_0x84a0('0x55')]},'raw':!![]})[_0x84a0('0x2b')](function(_0x5c16af){if(_0x5c16af&&_0x5c16af['autoAssociation']===0x0){return db['UserProfileResource'][_0x84a0('0x56')]({'name':_0x5a8c9e['name'],'resourceId':_0x5a8c9e['id'],'type':_0x5c16af[_0x84a0('0x30')],'sectionId':_0x5c16af['id']},{})[_0x84a0('0x2b')](function(){return _0x35765c;});}else{return _0x35765c;}})['catch'](function(_0x5d6a03){logger[_0x84a0('0x2e')](_0x84a0('0x57'),_0x5d6a03);throw _0x5d6a03;});}return _0x35765c;})['then'](respondWithResult(_0x56ad52,0xc9))[_0x84a0('0x4b')](handleError(_0x56ad52,null));};exports['update']=function(_0x4997cf,_0x519763){if(_0x4997cf[_0x84a0('0x50')]['id']){delete _0x4997cf[_0x84a0('0x50')]['id'];}return db['FaxQueue'][_0x84a0('0x4f')]({'where':{'id':_0x4997cf['params']['id']}})[_0x84a0('0x2b')](handleEntityNotFound(_0x519763,null))[_0x84a0('0x2b')](saveUpdates(_0x4997cf[_0x84a0('0x50')],null))[_0x84a0('0x2b')](respondWithResult(_0x519763,null))[_0x84a0('0x4b')](handleError(_0x519763,null));};exports['destroy']=function(_0x420a87,_0x25af8e){return db[_0x84a0('0x47')][_0x84a0('0x4f')]({'where':{'id':_0x420a87[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](handleEntityNotFound(_0x25af8e,null))[_0x84a0('0x2b')](removeEntity(_0x25af8e,null))[_0x84a0('0x4b')](handleError(_0x25af8e,null));};exports[_0x84a0('0x59')]=function(_0x48172a,_0x270295){return db[_0x84a0('0x47')][_0x84a0('0x59')]()[_0x84a0('0x2b')](respondWithResult(_0x270295,null))['catch'](handleError(_0x270295,null));};exports['getMembers']=function(_0x243055,_0x461cc4,_0x2540f7){var _0xb83711={'raw':!![],'where':{}},_0x4faa94={},_0x3a46b6;return db[_0x84a0('0x47')][_0x84a0('0x5a')]({'where':{'id':_0x243055[_0x84a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x461cc4,null))['then'](function(_0x4760ca){if(_0x4760ca){_0x3a46b6=_0x4760ca[_0x84a0('0x2c')]({'plain':!![]});_0x4faa94[_0x84a0('0x39')]=_[_0x84a0('0x37')](db[_0x84a0('0x5b')][_0x84a0('0x34')]);_0x4faa94[_0x84a0('0x36')]=_[_0x84a0('0x37')](_0x243055['query']);_0x4faa94[_0x84a0('0x38')]=_[_0x84a0('0x4d')](_0x4faa94['model'],_0x4faa94[_0x84a0('0x36')]);_0xb83711['attributes']=_[_0x84a0('0x4d')](_0x4faa94['model'],qs['fields'](_0x243055['query'][_0x84a0('0x3b')]));_0xb83711['attributes']=_0xb83711[_0x84a0('0x3a')]['length']?_0xb83711[_0x84a0('0x3a')]:_0x4faa94['model'];if(!_0x243055['query']['hasOwnProperty'](_0x84a0('0x3e'))){_0xb83711['limit']=qs[_0x84a0('0x22')](_0x243055[_0x84a0('0x36')]['limit']);_0xb83711[_0x84a0('0x20')]=qs[_0x84a0('0x20')](_0x243055['query']['offset']);}_0xb83711[_0x84a0('0x3f')]=qs[_0x84a0('0x40')](_0x243055['query'][_0x84a0('0x40')]);_0xb83711[_0x84a0('0x41')]=qs['filters'](_[_0x84a0('0x42')](_0x243055['query'],_0x4faa94[_0x84a0('0x38')]));_0xb83711['where']['FaxQueueId']=_0x4760ca['id'];if(_0x243055['query'][_0x84a0('0x46')]){_0xb83711[_0x84a0('0x41')]=_[_0x84a0('0x43')](_0xb83711[_0x84a0('0x41')],{'$or':_[_0x84a0('0x33')](_0xb83711[_0x84a0('0x3a')],function(_0x2b212a){var _0x157336={};_0x157336[_0x2b212a]={'$like':'%'+_0x243055[_0x84a0('0x36')][_0x84a0('0x46')]+'%'};return _0x157336;})});}_0xb83711=_['merge']({},_0xb83711,_0x243055[_0x84a0('0x5c')]);return db['UserFaxQueue'][_0x84a0('0x49')](_0xb83711);}})['then'](function(_0x39c22c){if(_0x39c22c){return db[_0x84a0('0x5d')][_0x84a0('0x5e')]({'where':{'id':_[_0x84a0('0x33')](_0x39c22c,_0x84a0('0x5f')),'role':_0x84a0('0x60')},'attributes':['id',_0x84a0('0x30'),_0x84a0('0x61'),_0x84a0('0x62'),'createdAt']});}})[_0x84a0('0x2b')](function(_0x2c74f2){if(_0x2c74f2){return{'count':_0x2c74f2[_0x84a0('0x23')],'rows':_[_0x84a0('0x33')](_0x2c74f2[_0x84a0('0x4a')],function(_0x5625f9){return{'membername':_0x5625f9[_0x84a0('0x30')],'UserId':_0x5625f9['id'],'queue_name':_0x3a46b6[_0x84a0('0x30')],'FaxQueueId':_0x3a46b6['id'],'interface':util['format'](_0x84a0('0x63'),_0x84a0('0x64'),_0x5625f9[_0x84a0('0x30')]),'penalty':0x0,'paused':_0x5625f9[_0x84a0('0x61')],'createdAt':_0x5625f9[_0x84a0('0x65')],'updatedAt':_0x5625f9[_0x84a0('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x84a0('0x2b')](respondWithFilteredResult(_0x461cc4,_0xb83711))['catch'](handleError(_0x461cc4,null));};exports[_0x84a0('0x66')]=function(_0x594084,_0x1bba30,_0x49ea28){var _0x1469a1={};var _0x494447={};var _0x23aa53;var _0x6fd76a;return db[_0x84a0('0x47')][_0x84a0('0x5a')]({'where':{'id':_0x594084[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](handleEntityNotFound(_0x1bba30,null))[_0x84a0('0x2b')](function(_0x1ce67e){if(_0x1ce67e){_0x23aa53=_0x1ce67e;_0x494447[_0x84a0('0x39')]=_['keys'](db[_0x84a0('0x67')]['rawAttributes']);_0x494447['query']=_[_0x84a0('0x37')](_0x594084[_0x84a0('0x36')]);_0x494447[_0x84a0('0x38')]=_['intersection'](_0x494447['model'],_0x494447[_0x84a0('0x36')]);_0x1469a1[_0x84a0('0x3a')]=_['intersection'](_0x494447['model'],qs[_0x84a0('0x3b')](_0x594084['query'][_0x84a0('0x3b')]));_0x1469a1['attributes']=_0x1469a1[_0x84a0('0x3a')][_0x84a0('0x3c')]?_0x1469a1[_0x84a0('0x3a')]:_0x494447[_0x84a0('0x39')];_0x1469a1[_0x84a0('0x3f')]=qs['sort'](_0x594084[_0x84a0('0x36')]['sort']);_0x1469a1[_0x84a0('0x41')]=qs['filters'](_['pick'](_0x594084[_0x84a0('0x36')],_0x494447[_0x84a0('0x38')]));if(_0x594084['query']['filter']){_0x1469a1['where']=_[_0x84a0('0x43')](_0x1469a1[_0x84a0('0x41')],{'$or':_[_0x84a0('0x33')](_0x1469a1['attributes'],function(_0x5412ff){var _0x2b137e={};_0x2b137e[_0x5412ff]={'$like':'%'+_0x594084[_0x84a0('0x36')][_0x84a0('0x46')]+'%'};return _0x2b137e;})});}_0x1469a1=_['merge']({},_0x1469a1,_0x594084['options']);return _0x23aa53[_0x84a0('0x66')](_0x1469a1);}})[_0x84a0('0x2b')](function(_0x3ef05d){if(_0x3ef05d){_0x6fd76a=_0x3ef05d[_0x84a0('0x3c')];if(!_0x594084[_0x84a0('0x36')]['hasOwnProperty']('nolimit')){_0x1469a1[_0x84a0('0x22')]=qs[_0x84a0('0x22')](_0x594084['query']['limit']);_0x1469a1['offset']=qs[_0x84a0('0x20')](_0x594084[_0x84a0('0x36')][_0x84a0('0x20')]);}return _0x23aa53[_0x84a0('0x66')](_0x1469a1);}})[_0x84a0('0x2b')](function(_0x155eac){if(_0x155eac){return _0x155eac?{'count':_0x6fd76a,'rows':_0x155eac}:null;}})[_0x84a0('0x2b')](respondWithResult(_0x1bba30,null))[_0x84a0('0x4b')](handleError(_0x1bba30,null));};exports[_0x84a0('0x68')]=function(_0x3e084f,_0x4d78af,_0x4d6535){var _0x4ad4ef=_0x3e084f[_0x84a0('0x50')][_0x84a0('0x69')];return db[_0x84a0('0x67')][_0x84a0('0x49')]({'where':{'id':_0x4ad4ef},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84a0('0x6a'),'attributes':['id',_0x84a0('0x30'),_0x84a0('0x6b'),_0x84a0('0x6c'),_0x84a0('0x6d')],'raw':!![]}]})['then'](function(_0x1b9b35){if(_0x1b9b35){var _0x666c64=_[_0x84a0('0x6e')](_0x1b9b35,function(_0x1f5fdb){var _0x599e35=_0x1f5fdb[_0x84a0('0x2c')]({'plain':!![]});return _0x599e35['Agents'];});return db[_0x84a0('0x47')]['find']({'where':{'id':_0x3e084f[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](function(_0x4ba163){return db[_0x84a0('0x6f')][_0x84a0('0x70')](function(_0x104d08){return _0x4ba163[_0x84a0('0x68')](_0x4ad4ef,{'transaction':_0x104d08})[_0x84a0('0x2b')](function(){return BPromise['each'](_0x666c64,function(_0x1cd53c){return db[_0x84a0('0x5b')][_0x84a0('0x71')]({'where':{'UserId':_0x1cd53c['id'],'FaxQueueId':_0x3e084f[_0x84a0('0x58')]['id']},'transaction':_0x104d08});});})['then'](function(){_0x666c64[_0x84a0('0x72')](function(_0x2148f1){socket[_0x84a0('0x73')](_0x84a0('0x74'),{'UserId':_0x2148f1['id'],'FaxQueueId':_0x4ba163['id']});});});});});}})[_0x84a0('0x2b')](respondWithStatusCode(_0x4d78af,null))[_0x84a0('0x4b')](handleError(_0x4d78af,null));};exports[_0x84a0('0x75')]=function(_0x311d97,_0x21c1ea,_0x54b777){return db['Team'][_0x84a0('0x49')]({'where':{'id':_0x311d97[_0x84a0('0x36')][_0x84a0('0x69')]},'attributes':['id'],'include':[{'model':db[_0x84a0('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x84a0('0x2b')](handleEntityNotFound(_0x21c1ea,null))[_0x84a0('0x2b')](function(_0xe5f2cf){var _0x556139=_[_0x84a0('0x33')](_0xe5f2cf,'id');var _0x4b651a=[];var _0x207e97=[];var _0x20b14e=squel['select']();_0x20b14e[_0x84a0('0x76')]('tq.TeamId')[_0x84a0('0x77')](_0x84a0('0x78'),'tq')[_0x84a0('0x79')](_0x84a0('0x7a'),'ut',_0x84a0('0x7b'))[_0x84a0('0x41')]('FaxQueueId\x20=\x20?',_0x311d97[_0x84a0('0x58')]['id']);for(var _0xcf53d8=0x0;_0xcf53d8<_0xe5f2cf[_0x84a0('0x3c')];_0xcf53d8+=0x1){let _0xdcb873=_0xe5f2cf[_0xcf53d8];for(var _0x17ae96=0x0;_0x17ae96<_0xdcb873[_0x84a0('0x6a')][_0x84a0('0x3c')];_0x17ae96+=0x1){let _0x1612ac=_0xdcb873[_0x84a0('0x6a')][_0x17ae96];var _0x5248ef=_0x20b14e[_0x84a0('0x7c')]();_0x5248ef['where'](_0x84a0('0x7d'),_0x1612ac['id']);_0x207e97['push'](db[_0x84a0('0x6f')][_0x84a0('0x36')](_0x5248ef[_0x84a0('0x7e')](),{'type':db['sequelize'][_0x84a0('0x7f')][_0x84a0('0x80')]})[_0x84a0('0x2b')](function(_0x55d128){if(_0x55d128[_0x84a0('0x3c')]===0x1){return _0x1612ac['id'];}else{var _0xabb149=_[_0x84a0('0x81')](_[_0x84a0('0x33')](_0x55d128,_0x84a0('0x82')),function(_0x3392d3){return _[_0x84a0('0x83')](_0x556139,_0x3392d3);});if(_0xabb149){return _0x1612ac['id'];}}}));}}return BPromise[_0x84a0('0x84')](_0x207e97)['then'](function(_0x322b01){_0x4b651a=_(_0x4b651a)[_0x84a0('0x85')](_0x322b01)['compact']()['value']();return db['FaxQueue'][_0x84a0('0x4f')]({'where':{'id':_0x311d97[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](function(_0x3946cf){return db[_0x84a0('0x6f')][_0x84a0('0x70')](function(_0x52020c){return _0x3946cf['removeTeams'](_0x311d97[_0x84a0('0x36')][_0x84a0('0x69')],{'transaction':_0x52020c})[_0x84a0('0x2b')](function(){if(!_['isEmpty'](_0x4b651a)){return _0x3946cf[_0x84a0('0x86')](_0x4b651a,{'transaction':_0x52020c});}})[_0x84a0('0x2b')](function(){_0x4b651a[_0x84a0('0x72')](function(_0x51b144){socket['emit'](_0x84a0('0x87'),{'UserId':_0x51b144,'FaxQueueId':_0x3946cf['id']});});});});});});})[_0x84a0('0x2b')](respondWithStatusCode(_0x21c1ea,null))[_0x84a0('0x4b')](handleError(_0x21c1ea,null));};exports[_0x84a0('0x88')]=function(_0x34974e,_0x53d41b,_0x220455){return db[_0x84a0('0x47')]['find']({'where':{'id':_0x34974e[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](handleEntityNotFound(_0x53d41b,null))[_0x84a0('0x2b')](function(_0x54e31e){if(_0x54e31e){return _0x54e31e[_0x84a0('0x88')](_0x34974e[_0x84a0('0x50')][_0x84a0('0x69')],_[_0x84a0('0x89')](_0x34974e['body'],[_0x84a0('0x69'),'id'])||{})['spread'](function(_0xe702bc){for(var _0x1cfe4a=0x0;_0x1cfe4a<_0x34974e['body'][_0x84a0('0x69')][_0x84a0('0x3c')];_0x1cfe4a+=0x1){socket[_0x84a0('0x73')]('userFaxQueue:save',{'UserId':Number(_0x34974e[_0x84a0('0x50')][_0x84a0('0x69')][_0x1cfe4a]),'FaxQueueId':Number(_0x34974e[_0x84a0('0x58')]['id'])});}return _0xe702bc;});}})[_0x84a0('0x2b')](respondWithResult(_0x53d41b,null))[_0x84a0('0x4b')](handleError(_0x53d41b,null));};exports[_0x84a0('0x86')]=function(_0x3eaec1,_0x39d1ee,_0x1c081){return db[_0x84a0('0x47')][_0x84a0('0x4f')]({'where':{'id':_0x3eaec1[_0x84a0('0x58')]['id']}})['then'](handleEntityNotFound(_0x39d1ee,null))['then'](function(_0xaf28e8){if(_0xaf28e8){return _0xaf28e8[_0x84a0('0x86')](_0x3eaec1[_0x84a0('0x36')][_0x84a0('0x69')])[_0x84a0('0x2b')](function(){if(_[_0x84a0('0x8a')](_0x3eaec1[_0x84a0('0x36')]['ids'])){for(var _0x4fceed=0x0;_0x4fceed<_0x3eaec1['query'][_0x84a0('0x69')][_0x84a0('0x3c')];_0x4fceed+=0x1){socket['emit'](_0x84a0('0x87'),{'UserId':Number(_0x3eaec1[_0x84a0('0x36')]['ids'][_0x4fceed]),'FaxQueueId':Number(_0x3eaec1[_0x84a0('0x58')]['id'])});}}else{socket[_0x84a0('0x73')](_0x84a0('0x87'),{'UserId':Number(_0x3eaec1[_0x84a0('0x36')][_0x84a0('0x69')]),'FaxQueueId':Number(_0x3eaec1[_0x84a0('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x39d1ee,null))['catch'](handleError(_0x39d1ee,null));};exports[_0x84a0('0x8b')]=function(_0x5c0130,_0x3ac062,_0xb96f05){var _0x30194f={};var _0x2f91a8={};var _0x3ae05c;var _0x3408f4;return db[_0x84a0('0x47')][_0x84a0('0x5a')]({'where':{'id':_0x5c0130[_0x84a0('0x58')]['id']}})[_0x84a0('0x2b')](handleEntityNotFound(_0x3ac062,null))[_0x84a0('0x2b')](function(_0x1e2389){if(_0x1e2389){_0x3ae05c=_0x1e2389;_0x2f91a8['model']=_[_0x84a0('0x37')](db[_0x84a0('0x5d')]['rawAttributes']);_0x2f91a8[_0x84a0('0x36')]=_[_0x84a0('0x37')](_0x5c0130[_0x84a0('0x36')]);_0x2f91a8['filters']=_['intersection'](_0x2f91a8[_0x84a0('0x39')],_0x2f91a8[_0x84a0('0x36')]);_0x30194f[_0x84a0('0x3a')]=_[_0x84a0('0x4d')](_0x2f91a8[_0x84a0('0x39')],qs['fields'](_0x5c0130[_0x84a0('0x36')][_0x84a0('0x3b')]));_0x30194f['attributes']=_0x30194f['attributes'][_0x84a0('0x3c')]?_0x30194f[_0x84a0('0x3a')]:_0x2f91a8[_0x84a0('0x39')];_0x30194f[_0x84a0('0x3f')]=qs[_0x84a0('0x40')](_0x5c0130[_0x84a0('0x36')][_0x84a0('0x40')]);_0x30194f[_0x84a0('0x41')]=qs[_0x84a0('0x38')](_[_0x84a0('0x42')](_0x5c0130[_0x84a0('0x36')],_0x2f91a8[_0x84a0('0x38')]));if(_0x5c0130['query'][_0x84a0('0x46')]){_0x30194f[_0x84a0('0x41')]=_['merge'](_0x30194f[_0x84a0('0x41')],{'$or':_[_0x84a0('0x33')](_0x30194f['attributes'],function(_0xefb382){var _0x37ed21={};_0x37ed21[_0xefb382]={'$like':'%'+_0x5c0130['query'][_0x84a0('0x46')]+'%'};return _0x37ed21;})});}_0x30194f=_[_0x84a0('0x43')]({},_0x30194f,_0x5c0130['options']);return _0x3ae05c[_0x84a0('0x8b')](_0x30194f);}})['then'](function(_0xe110){if(_0xe110){_0x3408f4=_0xe110[_0x84a0('0x3c')];if(!_0x5c0130[_0x84a0('0x36')][_0x84a0('0x3d')](_0x84a0('0x3e'))){_0x30194f[_0x84a0('0x22')]=qs[_0x84a0('0x22')](_0x5c0130['query']['limit']);_0x30194f[_0x84a0('0x20')]=qs[_0x84a0('0x20')](_0x5c0130[_0x84a0('0x36')]['offset']);}return _0x3ae05c[_0x84a0('0x8b')](_0x30194f);}})[_0x84a0('0x2b')](function(_0x440d02){if(_0x440d02){return _0x440d02?{'count':_0x3408f4,'rows':_0x440d02}:null;}})[_0x84a0('0x2b')](respondWithResult(_0x3ac062,null))[_0x84a0('0x4b')](handleError(_0x3ac062,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5cf6a50..0385787 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 _0x125a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','update'];(function(_0x6d2d32,_0x15e9a4){var _0x5ec8d7=function(_0x5b23a7){while(--_0x5b23a7){_0x6d2d32['push'](_0x6d2d32['shift']());}};_0x5ec8d7(++_0x15e9a4);}(_0x125a,0x1e5));var _0xa125=function(_0x3f9f9d,_0x923a36){_0x3f9f9d=_0x3f9f9d-0x0;var _0x3f9fc9=_0x125a[_0x3f9f9d];return _0x3f9fc9;};'use strict';var EventEmitter=require(_0xa125('0x0'));var FaxQueue=require(_0xa125('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa125('0x2'),'afterDestroy':_0xa125('0x3')};function emitEvent(_0x508d81){return function(_0x3996e8,_0xe2b956,_0x2983b2){FaxQueueEvents[_0xa125('0x4')](_0x508d81+':'+_0x3996e8['id'],_0x3996e8);FaxQueueEvents[_0xa125('0x4')](_0x508d81,_0x3996e8);_0x2983b2(null);};}for(var e in events){if(events[_0xa125('0x5')](e)){var event=events[e];FaxQueue[_0xa125('0x6')](e,emitEvent(event));}}module[_0xa125('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x0a92=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0x4a2f70,_0x11cd2e){var _0x5b20c1=function(_0x28bbc3){while(--_0x28bbc3){_0x4a2f70['push'](_0x4a2f70['shift']());}};_0x5b20c1(++_0x11cd2e);}(_0x0a92,0x1f1));var _0x20a9=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x0a92[_0x56825b];return _0x69ce77;};'use strict';var EventEmitter=require(_0x20a9('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x20a9('0x1')](0x0);var events={'afterCreate':_0x20a9('0x2'),'afterUpdate':_0x20a9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2c6c63){return function(_0x656bb3,_0x4fb70a,_0x401b1a){FaxQueueEvents[_0x20a9('0x4')](_0x2c6c63+':'+_0x656bb3['id'],_0x656bb3);FaxQueueEvents[_0x20a9('0x4')](_0x2c6c63,_0x656bb3);_0x401b1a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x20a9('0x5')](e,emitEvent(event));}}module[_0x20a9('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 01a6bee..22d4014 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 _0xfdab=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','FaxQueue'];(function(_0x2f5361,_0x3b30bd){var _0x1bee07=function(_0x1e5753){while(--_0x1e5753){_0x2f5361['push'](_0x2f5361['shift']());}};_0x1bee07(++_0x3b30bd);}(_0xfdab,0xcd));var _0xbfda=function(_0x3093fd,_0x22a601){_0x3093fd=_0x3093fd-0x0;var _0x490262=_0xfdab[_0x3093fd];return _0x490262;};'use strict';var _=require(_0xbfda('0x0'));var util=require(_0xbfda('0x1'));var logger=require(_0xbfda('0x2'))(_0xbfda('0x3'));var moment=require(_0xbfda('0x4'));var BPromise=require(_0xbfda('0x5'));var rp=require(_0xbfda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfda('0x7'));var config=require(_0xbfda('0x8'));var attributes=require(_0xbfda('0x9'));module['exports']=function(_0x11b092,_0x22e82e){return _0x11b092['define'](_0xbfda('0xa'),attributes,{'tableName':_0xbfda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc936=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./faxQueue.attributes','FaxQueue'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xc936,0x99));var _0x6c93=function(_0x4659d8,_0x2f83b2){_0x4659d8=_0x4659d8-0x0;var _0x11982e=_0xc936[_0x4659d8];return _0x11982e;};'use strict';var _=require(_0x6c93('0x0'));var util=require(_0x6c93('0x1'));var logger=require(_0x6c93('0x2'))('api');var moment=require(_0x6c93('0x3'));var BPromise=require(_0x6c93('0x4'));var rp=require(_0x6c93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c93('0x6'));var attributes=require(_0x6c93('0x7'));module['exports']=function(_0x1d434e,_0x5ef985){return _0x1d434e['define'](_0x6c93('0x8'),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 2e0b491..8a27c84 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 _0x4652=['raw','options','where','attributes','limit','map','include','model','GetFaxQueue','debug','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueue,\x20%s,\x20%s','request\x20sent','result','catch','FaxQueue','findAll'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x4652,0x153));var _0x2465=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4652[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2465('0x0'));var util=require(_0x2465('0x1'));var moment=require(_0x2465('0x2'));var BPromise=require(_0x2465('0x3'));var rs=require(_0x2465('0x4'));var fs=require('fs');var Redis=require(_0x2465('0x5'));var db=require(_0x2465('0x6'))['db'];var utils=require(_0x2465('0x7'));var logger=require(_0x2465('0x8'))('rpc');var config=require(_0x2465('0x9'));var jayson=require(_0x2465('0xa'));var client=jayson[_0x2465('0xb')][_0x2465('0xc')]({'port':0x232a});config[_0x2465('0xd')]=_['defaults'](config['redis'],{'host':_0x2465('0xe'),'port':0x18eb});var socket=require(_0x2465('0xf'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x431ffc,_0x286624,_0x3e74c2){return new BPromise(function(_0x408544,_0x37e30e){return client[_0x2465('0x10')](_0x431ffc,_0x3e74c2)[_0x2465('0x11')](function(_0x2e059d){logger[_0x2465('0x12')]('FaxQueue,\x20%s,\x20%s',_0x286624,'request\x20sent');logger['debug'](_0x2465('0x13'),_0x286624,'request\x20sent',JSON[_0x2465('0x14')](_0x2e059d));if(_0x2e059d[_0x2465('0x15')]){if(_0x2e059d[_0x2465('0x15')][_0x2465('0x16')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x286624,_0x2e059d[_0x2465('0x15')][_0x2465('0x17')]);return _0x37e30e(_0x2e059d[_0x2465('0x15')][_0x2465('0x17')]);}logger[_0x2465('0x15')](_0x2465('0x18'),_0x286624,_0x2e059d[_0x2465('0x15')][_0x2465('0x17')]);return _0x408544(_0x2e059d['error']['message']);}else{logger['info'](_0x2465('0x18'),_0x286624,_0x2465('0x19'));_0x408544(_0x2e059d[_0x2465('0x1a')][_0x2465('0x17')]);}})[_0x2465('0x1b')](function(_0x3b56f7){logger[_0x2465('0x15')](_0x2465('0x18'),_0x286624,_0x3b56f7);_0x37e30e(_0x3b56f7);});});}exports['GetFaxQueue']=function(_0x48db6c){var _0x14a31f=this;return new Promise(function(_0x5976ac,_0x35d4b7){return db[_0x2465('0x1c')][_0x2465('0x1d')]({'raw':_0x48db6c['options']?_0x48db6c['options'][_0x2465('0x1e')]===undefined?!![]:![]:!![],'where':_0x48db6c[_0x2465('0x1f')]?_0x48db6c['options'][_0x2465('0x20')]||null:null,'attributes':_0x48db6c[_0x2465('0x1f')]?_0x48db6c[_0x2465('0x1f')][_0x2465('0x21')]||null:null,'limit':_0x48db6c[_0x2465('0x1f')]?_0x48db6c[_0x2465('0x1f')][_0x2465('0x22')]||null:null,'include':_0x48db6c[_0x2465('0x1f')]?_0x48db6c[_0x2465('0x1f')]['include']?_[_0x2465('0x23')](_0x48db6c[_0x2465('0x1f')][_0x2465('0x24')],function(_0x3b5e37){return{'model':db[_0x3b5e37['model']],'as':_0x3b5e37['as'],'attributes':_0x3b5e37['attributes'],'include':_0x3b5e37[_0x2465('0x24')]?_[_0x2465('0x23')](_0x3b5e37[_0x2465('0x24')],function(_0x2e14cf){return{'model':db[_0x2e14cf[_0x2465('0x25')]],'as':_0x2e14cf['as'],'attributes':_0x2e14cf[_0x2465('0x21')],'include':_0x2e14cf[_0x2465('0x24')]?_[_0x2465('0x23')](_0x2e14cf[_0x2465('0x24')],function(_0x31e304){return{'model':db[_0x31e304[_0x2465('0x25')]],'as':_0x31e304['as'],'attributes':_0x31e304[_0x2465('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2782a0){logger['info'](_0x2465('0x26'),_0x48db6c);logger[_0x2465('0x27')](_0x2465('0x26'),_0x48db6c,JSON[_0x2465('0x14')](_0x2782a0));_0x5976ac(_0x2782a0);})[_0x2465('0x1b')](function(_0x3209ba){logger['error'](_0x2465('0x26'),_0x3209ba['message'],_0x48db6c);_0x35d4b7(_0x14a31f['error'](0x1f4,_0x3209ba[_0x2465('0x17')]));});});};exports['ShowFaxQueue']=function(_0x3b5a22){var _0x2d988e=this;return new Promise(function(_0x5b5558,_0x3debc4){return db[_0x2465('0x1c')]['find']({'raw':_0x3b5a22[_0x2465('0x1f')]?_0x3b5a22[_0x2465('0x1f')][_0x2465('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b5a22[_0x2465('0x1f')]?_0x3b5a22['options']['where']||null:null,'attributes':_0x3b5a22[_0x2465('0x1f')]?_0x3b5a22[_0x2465('0x1f')][_0x2465('0x21')]||null:null,'include':_0x3b5a22[_0x2465('0x1f')]?_0x3b5a22[_0x2465('0x1f')][_0x2465('0x24')]?_['map'](_0x3b5a22[_0x2465('0x1f')][_0x2465('0x24')],function(_0x1050bc){return{'model':db[_0x1050bc[_0x2465('0x25')]],'as':_0x1050bc['as'],'attributes':_0x1050bc[_0x2465('0x21')],'include':_0x1050bc[_0x2465('0x24')]?_['map'](_0x1050bc[_0x2465('0x24')],function(_0x4c4fc3){return{'model':db[_0x4c4fc3[_0x2465('0x25')]],'as':_0x4c4fc3['as'],'attributes':_0x4c4fc3['attributes'],'include':_0x4c4fc3[_0x2465('0x24')]?_[_0x2465('0x23')](_0x4c4fc3[_0x2465('0x24')],function(_0x5e35bf){return{'model':db[_0x5e35bf[_0x2465('0x25')]],'as':_0x5e35bf['as'],'attributes':_0x5e35bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2465('0x11')](function(_0x3e8582){logger[_0x2465('0x12')](_0x2465('0x28'),_0x3b5a22);logger[_0x2465('0x27')](_0x2465('0x28'),_0x3b5a22,JSON[_0x2465('0x14')](_0x3e8582));_0x5b5558(_0x3e8582);})[_0x2465('0x1b')](function(_0x59253c){logger[_0x2465('0x15')](_0x2465('0x28'),_0x59253c[_0x2465('0x17')],_0x3b5a22);_0x3debc4(_0x2d988e[_0x2465('0x15')](0x1f4,_0x59253c[_0x2465('0x17')]));});});}; \ No newline at end of file +var _0x6d1a=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','debug','ShowFaxQueue','find','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request'];(function(_0x212cc8,_0x593d9d){var _0x4cc4d9=function(_0x5626b5){while(--_0x5626b5){_0x212cc8['push'](_0x212cc8['shift']());}};_0x4cc4d9(++_0x593d9d);}(_0x6d1a,0x1db));var _0xa6d1=function(_0x57a7b9,_0xb1d18e){_0x57a7b9=_0x57a7b9-0x0;var _0x2af2d1=_0x6d1a[_0x57a7b9];return _0x2af2d1;};'use strict';var _=require(_0xa6d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6d1('0x1'));var rs=require(_0xa6d1('0x2'));var fs=require('fs');var Redis=require(_0xa6d1('0x3'));var db=require(_0xa6d1('0x4'))['db'];var utils=require(_0xa6d1('0x5'));var logger=require(_0xa6d1('0x6'))(_0xa6d1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa6d1('0x8'));var client=jayson[_0xa6d1('0x9')][_0xa6d1('0xa')]({'port':0x232a});config[_0xa6d1('0xb')]=_[_0xa6d1('0xc')](config['redis'],{'host':_0xa6d1('0xd'),'port':0x18eb});var socket=require(_0xa6d1('0xe'))(new Redis(config[_0xa6d1('0xb')]));require(_0xa6d1('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c81e9,_0x2ca4b5,_0x1f2ba2){return new BPromise(function(_0x54c567,_0x156548){return client[_0xa6d1('0x10')](_0x1c81e9,_0x1f2ba2)[_0xa6d1('0x11')](function(_0x423cb2){logger[_0xa6d1('0x12')](_0xa6d1('0x13'),_0x2ca4b5,_0xa6d1('0x14'));logger['debug'](_0xa6d1('0x15'),_0x2ca4b5,_0xa6d1('0x14'),JSON[_0xa6d1('0x16')](_0x423cb2));if(_0x423cb2['error']){if(_0x423cb2['error'][_0xa6d1('0x17')]===0x1f4){logger[_0xa6d1('0x18')]('FaxQueue,\x20%s,\x20%s',_0x2ca4b5,_0x423cb2[_0xa6d1('0x18')][_0xa6d1('0x19')]);return _0x156548(_0x423cb2['error'][_0xa6d1('0x19')]);}logger['error'](_0xa6d1('0x13'),_0x2ca4b5,_0x423cb2['error'][_0xa6d1('0x19')]);return _0x54c567(_0x423cb2[_0xa6d1('0x18')][_0xa6d1('0x19')]);}else{logger[_0xa6d1('0x12')](_0xa6d1('0x13'),_0x2ca4b5,_0xa6d1('0x14'));_0x54c567(_0x423cb2[_0xa6d1('0x1a')][_0xa6d1('0x19')]);}})[_0xa6d1('0x1b')](function(_0x20fe5a){logger['error'](_0xa6d1('0x13'),_0x2ca4b5,_0x20fe5a);_0x156548(_0x20fe5a);});});}exports[_0xa6d1('0x1c')]=function(_0x493bc0){var _0x3f5013=this;return new Promise(function(_0x41b6c9,_0x460c42){return db[_0xa6d1('0x1d')][_0xa6d1('0x1e')]({'raw':_0x493bc0['options']?_0x493bc0[_0xa6d1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x493bc0[_0xa6d1('0x1f')]?_0x493bc0[_0xa6d1('0x1f')][_0xa6d1('0x20')]||null:null,'attributes':_0x493bc0[_0xa6d1('0x1f')]?_0x493bc0[_0xa6d1('0x1f')][_0xa6d1('0x21')]||null:null,'limit':_0x493bc0[_0xa6d1('0x1f')]?_0x493bc0[_0xa6d1('0x1f')]['limit']||null:null,'include':_0x493bc0[_0xa6d1('0x1f')]?_0x493bc0[_0xa6d1('0x1f')][_0xa6d1('0x22')]?_[_0xa6d1('0x23')](_0x493bc0[_0xa6d1('0x1f')][_0xa6d1('0x22')],function(_0x5b1962){return{'model':db[_0x5b1962[_0xa6d1('0x24')]],'as':_0x5b1962['as'],'attributes':_0x5b1962['attributes'],'include':_0x5b1962[_0xa6d1('0x22')]?_['map'](_0x5b1962[_0xa6d1('0x22')],function(_0x2c253a){return{'model':db[_0x2c253a[_0xa6d1('0x24')]],'as':_0x2c253a['as'],'attributes':_0x2c253a['attributes'],'include':_0x2c253a['include']?_[_0xa6d1('0x23')](_0x2c253a[_0xa6d1('0x22')],function(_0x4ea3c4){return{'model':db[_0x4ea3c4[_0xa6d1('0x24')]],'as':_0x4ea3c4['as'],'attributes':_0x4ea3c4[_0xa6d1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa6d1('0x11')](function(_0x2ff7c3){logger[_0xa6d1('0x12')](_0xa6d1('0x1c'),_0x493bc0);logger[_0xa6d1('0x25')](_0xa6d1('0x1c'),_0x493bc0,JSON[_0xa6d1('0x16')](_0x2ff7c3));_0x41b6c9(_0x2ff7c3);})[_0xa6d1('0x1b')](function(_0x5d359f){logger[_0xa6d1('0x18')](_0xa6d1('0x1c'),_0x5d359f[_0xa6d1('0x19')],_0x493bc0);_0x460c42(_0x3f5013[_0xa6d1('0x18')](0x1f4,_0x5d359f[_0xa6d1('0x19')]));});});};exports[_0xa6d1('0x26')]=function(_0x3d5ebb){var _0x5bbebf=this;return new Promise(function(_0x5eaae4,_0xabfdc){return db[_0xa6d1('0x1d')][_0xa6d1('0x27')]({'raw':_0x3d5ebb[_0xa6d1('0x1f')]?_0x3d5ebb[_0xa6d1('0x1f')][_0xa6d1('0x28')]===undefined?!![]:![]:!![],'where':_0x3d5ebb[_0xa6d1('0x1f')]?_0x3d5ebb[_0xa6d1('0x1f')][_0xa6d1('0x20')]||null:null,'attributes':_0x3d5ebb['options']?_0x3d5ebb['options'][_0xa6d1('0x21')]||null:null,'include':_0x3d5ebb[_0xa6d1('0x1f')]?_0x3d5ebb['options'][_0xa6d1('0x22')]?_[_0xa6d1('0x23')](_0x3d5ebb[_0xa6d1('0x1f')]['include'],function(_0x362edc){return{'model':db[_0x362edc['model']],'as':_0x362edc['as'],'attributes':_0x362edc[_0xa6d1('0x21')],'include':_0x362edc[_0xa6d1('0x22')]?_[_0xa6d1('0x23')](_0x362edc[_0xa6d1('0x22')],function(_0x1f02aa){return{'model':db[_0x1f02aa[_0xa6d1('0x24')]],'as':_0x1f02aa['as'],'attributes':_0x1f02aa[_0xa6d1('0x21')],'include':_0x1f02aa[_0xa6d1('0x22')]?_[_0xa6d1('0x23')](_0x1f02aa[_0xa6d1('0x22')],function(_0x9fd17f){return{'model':db[_0x9fd17f[_0xa6d1('0x24')]],'as':_0x9fd17f['as'],'attributes':_0x9fd17f[_0xa6d1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa6d1('0x11')](function(_0x4c9c63){logger['info'](_0xa6d1('0x26'),_0x3d5ebb);logger[_0xa6d1('0x25')]('ShowFaxQueue',_0x3d5ebb,JSON[_0xa6d1('0x16')](_0x4c9c63));_0x5eaae4(_0x4c9c63);})[_0xa6d1('0x1b')](function(_0x116ab3){logger[_0xa6d1('0x18')](_0xa6d1('0x26'),_0x116ab3[_0xa6d1('0x19')],_0x3d5ebb);_0xabfdc(_0x5bbebf['error'](0x1f4,_0x116ab3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a4176e4..9ec6f07 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 _0xbac8=['./faxQueue.events','save','length','faxQueue:'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0xbac8,0x140));var _0x8bac=function(_0x1ed367,_0x2bb45d){_0x1ed367=_0x1ed367-0x0;var _0x214fdb=_0xbac8[_0x1ed367];return _0x214fdb;};'use strict';var FaxQueueEvents=require(_0x8bac('0x0'));var events=[_0x8bac('0x1'),'remove','update'];function createListener(_0x9c72e9,_0x1bc048){return function(_0x333437){_0x1bc048['emit'](_0x9c72e9,_0x333437);};}function removeListener(_0x3f0076,_0x10229f){return function(){FaxQueueEvents['removeListener'](_0x3f0076,_0x10229f);};}exports['register']=function(_0x28b1d1){for(var _0x36f5b4=0x0,_0x3e95bb=events[_0x8bac('0x2')];_0x36f5b4<_0x3e95bb;_0x36f5b4++){var _0x2e6c33=events[_0x36f5b4];var _0x3a315c=createListener(_0x8bac('0x3')+_0x2e6c33,_0x28b1d1);FaxQueueEvents['on'](_0x2e6c33,_0x3a315c);}}; \ No newline at end of file +var _0x85f1=['./faxQueue.events','save','update','emit','register','length','faxQueue:'];(function(_0x481f54,_0x5be7b4){var _0x48826f=function(_0x2af7e1){while(--_0x2af7e1){_0x481f54['push'](_0x481f54['shift']());}};_0x48826f(++_0x5be7b4);}(_0x85f1,0xc4));var _0x185f=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x85f1[_0x411add];return _0x238242;};'use strict';var FaxQueueEvents=require(_0x185f('0x0'));var events=[_0x185f('0x1'),'remove',_0x185f('0x2')];function createListener(_0x4f3b0b,_0x4d1e18){return function(_0x2572a2){_0x4d1e18[_0x185f('0x3')](_0x4f3b0b,_0x2572a2);};}function removeListener(_0x5c0472,_0x2ef0e7){return function(){FaxQueueEvents['removeListener'](_0x5c0472,_0x2ef0e7);};}exports[_0x185f('0x4')]=function(_0x2051a9){for(var _0x45e082=0x0,_0x101795=events[_0x185f('0x5')];_0x45e082<_0x101795;_0x45e082++){var _0x58ec0e=events[_0x45e082];var _0x41a1ae=createListener(_0x185f('0x6')+_0x58ec0e,_0x2051a9);FaxQueueEvents['on'](_0x58ec0e,_0x41a1ae);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a7de8fb..1373701 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 _0xd9eb=['/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','/: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','./faxQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x41eeed,_0x3e4310){var _0x21c55a=function(_0x5102cf){while(--_0x5102cf){_0x41eeed['push'](_0x41eeed['shift']());}};_0x21c55a(++_0x3e4310);}(_0xd9eb,0xca));var _0xbd9e=function(_0x41b3d6,_0x21daa8){_0x41b3d6=_0x41b3d6-0x0;var _0x3e60ca=_0xd9eb[_0x41b3d6];return _0x3e60ca;};'use strict';var multer=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var path=require(_0xbd9e('0x2'));var timeout=require(_0xbd9e('0x3'));var express=require(_0xbd9e('0x4'));var router=express[_0xbd9e('0x5')]();var fs_extra=require(_0xbd9e('0x6'));var auth=require(_0xbd9e('0x7'));var interaction=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var controller=require(_0xbd9e('0xa'));router[_0xbd9e('0xb')]('/',auth[_0xbd9e('0xc')](),controller['index']);router[_0xbd9e('0xb')](_0xbd9e('0xd'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0xe')]);router[_0xbd9e('0xb')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x10')]);router[_0xbd9e('0xb')](_0xbd9e('0x11'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x12')]);router['get'](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['getTeams']);router[_0xbd9e('0xb')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x14')]);router[_0xbd9e('0x15')]('/',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x16')]);router[_0xbd9e('0x15')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['addTeams']);router[_0xbd9e('0x15')](_0xbd9e('0x17'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x18')]);router[_0xbd9e('0x19')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1a')]);router[_0xbd9e('0x1b')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller['destroy']);router[_0xbd9e('0x1b')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1c')]);router[_0xbd9e('0x1b')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1d')]);module[_0xbd9e('0x1e')]=router; \ No newline at end of file +var _0xdeb3=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','removeTeams','removeAgents'];(function(_0x11596a,_0x401782){var _0x4f62d4=function(_0x172731){while(--_0x172731){_0x11596a['push'](_0x11596a['shift']());}};_0x4f62d4(++_0x401782);}(_0xdeb3,0xb7));var _0x3deb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdeb3[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x3deb('0x0'));var path=require(_0x3deb('0x1'));var timeout=require(_0x3deb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3deb('0x3'));var auth=require(_0x3deb('0x4'));var interaction=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var controller=require(_0x3deb('0x7'));router['get']('/',auth[_0x3deb('0x8')](),controller['index']);router[_0x3deb('0x9')]('/describe',auth[_0x3deb('0x8')](),controller[_0x3deb('0xa')]);router[_0x3deb('0x9')](_0x3deb('0xb'),auth[_0x3deb('0x8')](),controller[_0x3deb('0xc')]);router[_0x3deb('0x9')](_0x3deb('0xd'),auth[_0x3deb('0x8')](),controller['getMembers']);router['get'](_0x3deb('0xe'),auth[_0x3deb('0x8')](),controller[_0x3deb('0xf')]);router['get'](_0x3deb('0x10'),auth[_0x3deb('0x8')](),controller[_0x3deb('0x11')]);router[_0x3deb('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3deb('0xe'),auth[_0x3deb('0x8')](),controller[_0x3deb('0x13')]);router['post'](_0x3deb('0x10'),auth[_0x3deb('0x8')](),controller['addAgents']);router[_0x3deb('0x14')](_0x3deb('0xb'),auth['isAuthenticated'](),controller[_0x3deb('0x15')]);router['delete'](_0x3deb('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x3deb('0x16')](_0x3deb('0xe'),auth[_0x3deb('0x8')](),controller[_0x3deb('0x17')]);router[_0x3deb('0x16')](_0x3deb('0x10'),auth['isAuthenticated'](),controller[_0x3deb('0x18')]);module[_0x3deb('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 39eaece..8d0f450 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 _0x89ca=['STRING','DATE','moment'];(function(_0x289eff,_0x492c32){var _0x2de8ce=function(_0x2da89e){while(--_0x2da89e){_0x289eff['push'](_0x289eff['shift']());}};_0x2de8ce(++_0x492c32);}(_0x89ca,0xe3));var _0xa89c=function(_0x32fad4,_0x51dd98){_0x32fad4=_0x32fad4-0x0;var _0x583237=_0x89ca[_0x32fad4];return _0x583237;};'use strict';var moment=require(_0xa89c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa89c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa89c('0x1')]},'joinAt':{'type':Sequelize[_0xa89c('0x2')]},'leaveAt':{'type':Sequelize[_0xa89c('0x2')]},'acceptAt':{'type':Sequelize[_0xa89c('0x2')]},'exitAt':{'type':Sequelize[_0xa89c('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6d0=['DATE','moment','STRING'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xf6d0,0x163));var _0x0f6d=function(_0x3ea9b9,_0x1d5217){_0x3ea9b9=_0x3ea9b9-0x0;var _0x376320=_0xf6d0[_0x3ea9b9];return _0x376320;};'use strict';var moment=require(_0x0f6d('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0f6d('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x0f6d('0x1')]},'joinAt':{'type':Sequelize[_0x0f6d('0x2')]},'leaveAt':{'type':Sequelize[_0x0f6d('0x2')]},'acceptAt':{'type':Sequelize[_0x0f6d('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0f6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9889fdc..dea1b8f 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 _0x68fc=['pick','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','map','FaxQueueReport','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x68fc,0xa5));var _0xc68f=function(_0x3117b3,_0x46b3ab){_0x3117b3=_0x3117b3-0x0;var _0x4a3aaf=_0x68fc[_0x3117b3];return _0x4a3aaf;};'use strict';var emlformat=require(_0xc68f('0x0'));var rimraf=require(_0xc68f('0x1'));var zipdir=require(_0xc68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc68f('0x5'));var csv=require(_0xc68f('0x6'));var ejs=require(_0xc68f('0x7'));var fs=require('fs');var fs_extra=require(_0xc68f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc68f('0x9'));var jsforce=require(_0xc68f('0xa'));var deskjs=require(_0xc68f('0xb'));var toCsv=require(_0xc68f('0x6'));var querystring=require(_0xc68f('0xc'));var Papa=require(_0xc68f('0xd'));var Redis=require(_0xc68f('0xe'));var authService=require(_0xc68f('0xf'));var qs=require(_0xc68f('0x10'));var as=require(_0xc68f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc68f('0x12'))(_0xc68f('0x13'));var utils=require(_0xc68f('0x14'));var config=require(_0xc68f('0x15'));var licenseUtil=require(_0xc68f('0x16'));var db=require(_0xc68f('0x17'))['db'];function respondWithStatusCode(_0x3ccebe,_0x41aeb8){_0x41aeb8=_0x41aeb8||0xcc;return function(_0x151bde){if(_0x151bde){return _0x3ccebe[_0xc68f('0x18')](_0x41aeb8);}return _0x3ccebe[_0xc68f('0x19')](_0x41aeb8)['end']();};}function respondWithResult(_0x2ea1c4,_0x90ccbd){_0x90ccbd=_0x90ccbd||0xc8;return function(_0x2b1d30){if(_0x2b1d30){return _0x2ea1c4[_0xc68f('0x19')](_0x90ccbd)[_0xc68f('0x1a')](_0x2b1d30);}};}function respondWithFilteredResult(_0x2673b4,_0x3d1406){return function(_0x209d16){if(_0x209d16){var _0x4648c6=typeof _0x3d1406['offset']==='undefined'&&typeof _0x3d1406[_0xc68f('0x1b')]===_0xc68f('0x1c');var _0x171eea=_0x209d16[_0xc68f('0x1d')];var _0x2d9d85=_0x4648c6?0x0:_0x3d1406[_0xc68f('0x1e')];var _0x50fab4=_0x4648c6?_0x209d16[_0xc68f('0x1d')]:_0x3d1406[_0xc68f('0x1e')]+_0x3d1406[_0xc68f('0x1b')];var _0x2c058c;if(_0x50fab4>=_0x171eea){_0x50fab4=_0x171eea;_0x2c058c=0xc8;}else{_0x2c058c=0xce;}_0x2673b4[_0xc68f('0x19')](_0x2c058c);return _0x2673b4[_0xc68f('0x1f')](_0xc68f('0x20'),_0x2d9d85+'-'+_0x50fab4+'/'+_0x171eea)[_0xc68f('0x1a')](_0x209d16);}return null;};}function patchUpdates(_0x582301){return function(_0xcc11a3){try{jsonpatch[_0xc68f('0x21')](_0xcc11a3,_0x582301,!![]);}catch(_0x2e27b9){return BPromise['reject'](_0x2e27b9);}return _0xcc11a3[_0xc68f('0x22')]();};}function saveUpdates(_0x1daac5,_0x116203){return function(_0x2064db){if(_0x2064db){return _0x2064db[_0xc68f('0x23')](_0x1daac5)[_0xc68f('0x24')](function(_0x2412a9){return _0x2412a9;});}return null;};}function removeEntity(_0x547d46,_0x38c3a0){return function(_0x288957){if(_0x288957){return _0x288957['destroy']()[_0xc68f('0x24')](function(){_0x547d46[_0xc68f('0x19')](0xcc)[_0xc68f('0x25')]();});}};}function handleEntityNotFound(_0x44c4b2,_0x39419a){return function(_0x48d797){if(!_0x48d797){_0x44c4b2[_0xc68f('0x18')](0x194);}return _0x48d797;};}function handleError(_0x417de2,_0x5d4632){_0x5d4632=_0x5d4632||0x1f4;return function(_0x38b935){logger[_0xc68f('0x26')](_0x38b935['stack']);if(_0x38b935[_0xc68f('0x27')]){delete _0x38b935[_0xc68f('0x27')];}_0x417de2[_0xc68f('0x19')](_0x5d4632)[_0xc68f('0x28')](_0x38b935);};}exports['index']=function(_0x477a1c,_0x1cc5b2){var _0x26003a={},_0x435482={},_0x1ba1ac={'count':0x0,'rows':[]};var _0x11b203=_[_0xc68f('0x29')](db[_0xc68f('0x2a')]['rawAttributes'],function(_0x37f947){return{'name':_0x37f947[_0xc68f('0x2b')],'type':_0x37f947['type'][_0xc68f('0x2c')]};});_0x435482[_0xc68f('0x2d')]=_[_0xc68f('0x29')](_0x11b203,_0xc68f('0x27'));_0x435482['query']=_[_0xc68f('0x2e')](_0x477a1c[_0xc68f('0x2f')]);_0x435482['filters']=_[_0xc68f('0x30')](_0x435482[_0xc68f('0x2d')],_0x435482[_0xc68f('0x2f')]);_0x26003a[_0xc68f('0x31')]=_[_0xc68f('0x30')](_0x435482['model'],qs['fields'](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x32')]));_0x26003a[_0xc68f('0x31')]=_0x26003a[_0xc68f('0x31')][_0xc68f('0x33')]?_0x26003a['attributes']:_0x435482['model'];if(!_0x477a1c[_0xc68f('0x2f')]['hasOwnProperty'](_0xc68f('0x34'))){_0x26003a[_0xc68f('0x1b')]=qs[_0xc68f('0x1b')](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x1b')]);_0x26003a[_0xc68f('0x1e')]=qs[_0xc68f('0x1e')](_0x477a1c['query'][_0xc68f('0x1e')]);}_0x26003a[_0xc68f('0x35')]=qs[_0xc68f('0x36')](_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x36')]);_0x26003a[_0xc68f('0x37')]=qs[_0xc68f('0x38')](_[_0xc68f('0x39')](_0x477a1c[_0xc68f('0x2f')],_0x435482[_0xc68f('0x38')]),_0x11b203);if(_0x477a1c[_0xc68f('0x2f')]['filter']){_0x26003a['where']=_['merge'](_0x26003a[_0xc68f('0x37')],{'$or':_[_0xc68f('0x29')](_0x11b203,function(_0x268649){if(_0x268649[_0xc68f('0x3a')]!=='VIRTUAL'){var _0x10c664={};_0x10c664[_0x268649[_0xc68f('0x27')]]={'$like':'%'+_0x477a1c[_0xc68f('0x2f')]['filter']+'%'};return _0x10c664;}})});}_0x26003a=_[_0xc68f('0x3b')]({},_0x26003a,_0x477a1c[_0xc68f('0x3c')]);var _0x4a8883={'where':_0x26003a[_0xc68f('0x37')]};return db[_0xc68f('0x2a')][_0xc68f('0x1d')](_0x4a8883)['then'](function(_0x2702ac){_0x1ba1ac[_0xc68f('0x1d')]=_0x2702ac;if(_0x477a1c[_0xc68f('0x2f')][_0xc68f('0x3d')]){_0x26003a[_0xc68f('0x3e')]=[{'all':!![]}];}return db[_0xc68f('0x2a')][_0xc68f('0x3f')](_0x26003a);})['then'](function(_0x192942){_0x1ba1ac[_0xc68f('0x40')]=_0x192942;return _0x1ba1ac;})[_0xc68f('0x24')](respondWithFilteredResult(_0x1cc5b2,_0x26003a))[_0xc68f('0x41')](handleError(_0x1cc5b2,null));};exports[_0xc68f('0x42')]=function(_0x1e4f50,_0x1d4619){var _0x335b52={'raw':!![],'where':{'id':_0x1e4f50['params']['id']}},_0x1e8141={};_0x1e8141[_0xc68f('0x2d')]=_[_0xc68f('0x2e')](db[_0xc68f('0x2a')][_0xc68f('0x43')]);_0x1e8141[_0xc68f('0x2f')]=_[_0xc68f('0x2e')](_0x1e4f50[_0xc68f('0x2f')]);_0x1e8141['filters']=_[_0xc68f('0x30')](_0x1e8141['model'],_0x1e8141['query']);_0x335b52[_0xc68f('0x31')]=_[_0xc68f('0x30')](_0x1e8141['model'],qs['fields'](_0x1e4f50[_0xc68f('0x2f')][_0xc68f('0x32')]));_0x335b52[_0xc68f('0x31')]=_0x335b52[_0xc68f('0x31')][_0xc68f('0x33')]?_0x335b52[_0xc68f('0x31')]:_0x1e8141[_0xc68f('0x2d')];if(_0x1e4f50[_0xc68f('0x2f')][_0xc68f('0x3d')]){_0x335b52[_0xc68f('0x3e')]=[{'all':!![]}];}_0x335b52=_[_0xc68f('0x3b')]({},_0x335b52,_0x1e4f50['options']);return db[_0xc68f('0x2a')]['find'](_0x335b52)[_0xc68f('0x24')](handleEntityNotFound(_0x1d4619,null))[_0xc68f('0x24')](respondWithResult(_0x1d4619,null))['catch'](handleError(_0x1d4619,null));};exports[_0xc68f('0x44')]=function(_0x3f4537,_0x28e8ef){return db[_0xc68f('0x2a')][_0xc68f('0x44')](_0x3f4537[_0xc68f('0x45')],{})[_0xc68f('0x24')](respondWithResult(_0x28e8ef,0xc9))[_0xc68f('0x41')](handleError(_0x28e8ef,null));};exports['update']=function(_0x2920d5,_0x15eaa2){if(_0x2920d5[_0xc68f('0x45')]['id']){delete _0x2920d5['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2920d5[_0xc68f('0x46')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x15eaa2,null))['then'](saveUpdates(_0x2920d5[_0xc68f('0x45')],null))['then'](respondWithResult(_0x15eaa2,null))[_0xc68f('0x41')](handleError(_0x15eaa2,null));};exports[_0xc68f('0x47')]=function(_0x44efa8,_0x26ac9a){return db[_0xc68f('0x2a')][_0xc68f('0x48')]({'where':{'id':_0x44efa8[_0xc68f('0x46')]['id']}})[_0xc68f('0x24')](handleEntityNotFound(_0x26ac9a,null))[_0xc68f('0x24')](removeEntity(_0x26ac9a,null))[_0xc68f('0x41')](handleError(_0x26ac9a,null));};exports[_0xc68f('0x49')]=function(_0x5e36c7,_0x2e4ebc){return db[_0xc68f('0x2a')]['describe']()['then'](respondWithResult(_0x2e4ebc,null))[_0xc68f('0x41')](handleError(_0x2e4ebc,null));}; \ No newline at end of file +var _0x132f=['merge','map','VIRTUAL','filter','options','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x45b70b,_0x1fcab9){var _0x53db21=function(_0x33be73){while(--_0x33be73){_0x45b70b['push'](_0x45b70b['shift']());}};_0x53db21(++_0x1fcab9);}(_0x132f,0x182));var _0xf132=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x132f[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require(_0xf132('0x0'));var rimraf=require(_0xf132('0x1'));var zipdir=require(_0xf132('0x2'));var jsonpatch=require(_0xf132('0x3'));var rp=require(_0xf132('0x4'));var moment=require(_0xf132('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf132('0x6'));var util=require(_0xf132('0x7'));var path=require(_0xf132('0x8'));var sox=require(_0xf132('0x9'));var csv=require(_0xf132('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf132('0xb'));var _=require(_0xf132('0xc'));var squel=require('squel');var crypto=require(_0xf132('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf132('0xe'));var toCsv=require(_0xf132('0xa'));var querystring=require(_0xf132('0xf'));var Papa=require(_0xf132('0x10'));var Redis=require(_0xf132('0x11'));var authService=require(_0xf132('0x12'));var qs=require(_0xf132('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf132('0x14'))(_0xf132('0x15'));var utils=require(_0xf132('0x16'));var config=require(_0xf132('0x17'));var licenseUtil=require(_0xf132('0x18'));var db=require(_0xf132('0x19'))['db'];function respondWithStatusCode(_0x37d148,_0x1c79e0){_0x1c79e0=_0x1c79e0||0xcc;return function(_0x3f0f56){if(_0x3f0f56){return _0x37d148[_0xf132('0x1a')](_0x1c79e0);}return _0x37d148[_0xf132('0x1b')](_0x1c79e0)[_0xf132('0x1c')]();};}function respondWithResult(_0x5b58f8,_0x79d371){_0x79d371=_0x79d371||0xc8;return function(_0x259b76){if(_0x259b76){return _0x5b58f8['status'](_0x79d371)[_0xf132('0x1d')](_0x259b76);}};}function respondWithFilteredResult(_0x4edb9c,_0x50ed67){return function(_0x206e0c){if(_0x206e0c){var _0x24c138=typeof _0x50ed67[_0xf132('0x1e')]==='undefined'&&typeof _0x50ed67['limit']===_0xf132('0x1f');var _0x2f3c15=_0x206e0c[_0xf132('0x20')];var _0x31db78=_0x24c138?0x0:_0x50ed67['offset'];var _0x1af2db=_0x24c138?_0x206e0c[_0xf132('0x20')]:_0x50ed67[_0xf132('0x1e')]+_0x50ed67[_0xf132('0x21')];var _0x4b4f5d;if(_0x1af2db>=_0x2f3c15){_0x1af2db=_0x2f3c15;_0x4b4f5d=0xc8;}else{_0x4b4f5d=0xce;}_0x4edb9c[_0xf132('0x1b')](_0x4b4f5d);return _0x4edb9c['set'](_0xf132('0x22'),_0x31db78+'-'+_0x1af2db+'/'+_0x2f3c15)[_0xf132('0x1d')](_0x206e0c);}return null;};}function patchUpdates(_0x53b78a){return function(_0x129820){try{jsonpatch['apply'](_0x129820,_0x53b78a,!![]);}catch(_0x5aae77){return BPromise['reject'](_0x5aae77);}return _0x129820['save']();};}function saveUpdates(_0xbb67a7,_0x202dca){return function(_0x2fb27d){if(_0x2fb27d){return _0x2fb27d[_0xf132('0x23')](_0xbb67a7)[_0xf132('0x24')](function(_0x3f7613){return _0x3f7613;});}return null;};}function removeEntity(_0x209c99,_0x5c9958){return function(_0x3db8a0){if(_0x3db8a0){return _0x3db8a0[_0xf132('0x25')]()[_0xf132('0x24')](function(){_0x209c99[_0xf132('0x1b')](0xcc)[_0xf132('0x1c')]();});}};}function handleEntityNotFound(_0x271471,_0x6f16b1){return function(_0x4f1e5f){if(!_0x4f1e5f){_0x271471[_0xf132('0x1a')](0x194);}return _0x4f1e5f;};}function handleError(_0x2fdf22,_0x562770){_0x562770=_0x562770||0x1f4;return function(_0x5b01b5){logger[_0xf132('0x26')](_0x5b01b5[_0xf132('0x27')]);if(_0x5b01b5[_0xf132('0x28')]){delete _0x5b01b5[_0xf132('0x28')];}_0x2fdf22[_0xf132('0x1b')](_0x562770)[_0xf132('0x29')](_0x5b01b5);};}exports[_0xf132('0x2a')]=function(_0x1c1756,_0x395050){var _0x45fdf5={},_0x43a510={},_0x355212={'count':0x0,'rows':[]};var _0xeb393e=_['map'](db[_0xf132('0x2b')]['rawAttributes'],function(_0x4ff070){return{'name':_0x4ff070[_0xf132('0x2c')],'type':_0x4ff070['type']['key']};});_0x43a510[_0xf132('0x2d')]=_['map'](_0xeb393e,_0xf132('0x28'));_0x43a510[_0xf132('0x2e')]=_[_0xf132('0x2f')](_0x1c1756[_0xf132('0x2e')]);_0x43a510[_0xf132('0x30')]=_[_0xf132('0x31')](_0x43a510[_0xf132('0x2d')],_0x43a510[_0xf132('0x2e')]);_0x45fdf5[_0xf132('0x32')]=_[_0xf132('0x31')](_0x43a510[_0xf132('0x2d')],qs['fields'](_0x1c1756[_0xf132('0x2e')][_0xf132('0x33')]));_0x45fdf5['attributes']=_0x45fdf5[_0xf132('0x32')][_0xf132('0x34')]?_0x45fdf5['attributes']:_0x43a510['model'];if(!_0x1c1756[_0xf132('0x2e')][_0xf132('0x35')](_0xf132('0x36'))){_0x45fdf5[_0xf132('0x21')]=qs[_0xf132('0x21')](_0x1c1756[_0xf132('0x2e')][_0xf132('0x21')]);_0x45fdf5['offset']=qs['offset'](_0x1c1756['query']['offset']);}_0x45fdf5['order']=qs[_0xf132('0x37')](_0x1c1756['query'][_0xf132('0x37')]);_0x45fdf5[_0xf132('0x38')]=qs[_0xf132('0x30')](_[_0xf132('0x39')](_0x1c1756[_0xf132('0x2e')],_0x43a510[_0xf132('0x30')]),_0xeb393e);if(_0x1c1756['query']['filter']){_0x45fdf5['where']=_[_0xf132('0x3a')](_0x45fdf5['where'],{'$or':_[_0xf132('0x3b')](_0xeb393e,function(_0x54b933){if(_0x54b933['type']!==_0xf132('0x3c')){var _0x427430={};_0x427430[_0x54b933['name']]={'$like':'%'+_0x1c1756[_0xf132('0x2e')][_0xf132('0x3d')]+'%'};return _0x427430;}})});}_0x45fdf5=_[_0xf132('0x3a')]({},_0x45fdf5,_0x1c1756[_0xf132('0x3e')]);var _0x4c9d15={'where':_0x45fdf5['where']};return db['FaxQueueReport'][_0xf132('0x20')](_0x4c9d15)[_0xf132('0x24')](function(_0x1ae97e){_0x355212[_0xf132('0x20')]=_0x1ae97e;if(_0x1c1756['query']['includeAll']){_0x45fdf5['include']=[{'all':!![]}];}return db[_0xf132('0x2b')][_0xf132('0x3f')](_0x45fdf5);})[_0xf132('0x24')](function(_0x552c7e){_0x355212[_0xf132('0x40')]=_0x552c7e;return _0x355212;})[_0xf132('0x24')](respondWithFilteredResult(_0x395050,_0x45fdf5))[_0xf132('0x41')](handleError(_0x395050,null));};exports['show']=function(_0x121719,_0x4585fa){var _0x2ede85={'raw':!![],'where':{'id':_0x121719[_0xf132('0x42')]['id']}},_0x4c597f={};_0x4c597f['model']=_[_0xf132('0x2f')](db[_0xf132('0x2b')][_0xf132('0x43')]);_0x4c597f[_0xf132('0x2e')]=_[_0xf132('0x2f')](_0x121719['query']);_0x4c597f['filters']=_[_0xf132('0x31')](_0x4c597f['model'],_0x4c597f[_0xf132('0x2e')]);_0x2ede85['attributes']=_[_0xf132('0x31')](_0x4c597f['model'],qs[_0xf132('0x33')](_0x121719['query']['fields']));_0x2ede85[_0xf132('0x32')]=_0x2ede85[_0xf132('0x32')][_0xf132('0x34')]?_0x2ede85[_0xf132('0x32')]:_0x4c597f['model'];if(_0x121719['query'][_0xf132('0x44')]){_0x2ede85[_0xf132('0x45')]=[{'all':!![]}];}_0x2ede85=_[_0xf132('0x3a')]({},_0x2ede85,_0x121719[_0xf132('0x3e')]);return db[_0xf132('0x2b')][_0xf132('0x46')](_0x2ede85)[_0xf132('0x24')](handleEntityNotFound(_0x4585fa,null))[_0xf132('0x24')](respondWithResult(_0x4585fa,null))[_0xf132('0x41')](handleError(_0x4585fa,null));};exports['create']=function(_0x8d7d66,_0x184bf1){return db[_0xf132('0x2b')][_0xf132('0x47')](_0x8d7d66[_0xf132('0x48')],{})['then'](respondWithResult(_0x184bf1,0xc9))[_0xf132('0x41')](handleError(_0x184bf1,null));};exports[_0xf132('0x23')]=function(_0x3f22e2,_0x12d024){if(_0x3f22e2['body']['id']){delete _0x3f22e2[_0xf132('0x48')]['id'];}return db[_0xf132('0x2b')][_0xf132('0x46')]({'where':{'id':_0x3f22e2[_0xf132('0x42')]['id']}})['then'](handleEntityNotFound(_0x12d024,null))[_0xf132('0x24')](saveUpdates(_0x3f22e2[_0xf132('0x48')],null))['then'](respondWithResult(_0x12d024,null))[_0xf132('0x41')](handleError(_0x12d024,null));};exports[_0xf132('0x25')]=function(_0x425344,_0x3994d9){return db[_0xf132('0x2b')][_0xf132('0x46')]({'where':{'id':_0x425344['params']['id']}})['then'](handleEntityNotFound(_0x3994d9,null))[_0xf132('0x24')](removeEntity(_0x3994d9,null))['catch'](handleError(_0x3994d9,null));};exports[_0xf132('0x49')]=function(_0x5b68e2,_0x875fb0){return db[_0xf132('0x2b')][_0xf132('0x49')]()[_0xf132('0x24')](respondWithResult(_0x875fb0,null))[_0xf132('0x41')](handleError(_0x875fb0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4995bb6..1a582d4 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x159e65,_0x1edeca){var _0x48bee0=function(_0x40b219){while(--_0x40b219){_0x159e65['push'](_0x159e65['shift']());}};_0x48bee0(++_0x1edeca);}(_0x53ec,0x192));var _0xc53e=function(_0x5ddafe,_0x1fb508){_0x5ddafe=_0x5ddafe-0x0;var _0x5e23aa=_0x53ec[_0x5ddafe];return _0x5e23aa;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x2fef6d,_0x41743c){var _0x2748fb=function(_0x486d2d){while(--_0x486d2d){_0x2fef6d['push'](_0x2fef6d['shift']());}};_0x2748fb(++_0x41743c);}(_0x1261,0x144));var _0x1126=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x1261[_0x725b8e];return _0x43ac45;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6a1eb51..9e4e8d8 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 _0x2571=['error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch','UpdateFaxQueueReport','update','where','attributes','limit','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48ea8c,_0x5e36b9){var _0x338288=function(_0x4495f0){while(--_0x4495f0){_0x48ea8c['push'](_0x48ea8c['shift']());}};_0x338288(++_0x5e36b9);}(_0x2571,0x170));var _0x1257=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0x2571[_0x3cba1d];return _0x5f192b;};'use strict';var _=require('lodash');var util=require(_0x1257('0x0'));var moment=require(_0x1257('0x1'));var BPromise=require(_0x1257('0x2'));var rs=require(_0x1257('0x3'));var fs=require('fs');var Redis=require(_0x1257('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1257('0x5'));var logger=require(_0x1257('0x6'))(_0x1257('0x7'));var config=require(_0x1257('0x8'));var jayson=require(_0x1257('0x9'));var client=jayson[_0x1257('0xa')][_0x1257('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2889ef,_0x1bcec5,_0x30aeb9){return new BPromise(function(_0x35ab68,_0xc7b4ee){return client[_0x1257('0xc')](_0x2889ef,_0x30aeb9)['then'](function(_0x258422){logger[_0x1257('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1bcec5,_0x1257('0xe'));logger['debug'](_0x1257('0xf'),_0x1bcec5,_0x1257('0xe'),JSON[_0x1257('0x10')](_0x258422));if(_0x258422[_0x1257('0x11')]){if(_0x258422[_0x1257('0x11')][_0x1257('0x12')]===0x1f4){logger[_0x1257('0x11')](_0x1257('0x13'),_0x1bcec5,_0x258422[_0x1257('0x11')]['message']);return _0xc7b4ee(_0x258422[_0x1257('0x11')][_0x1257('0x14')]);}logger[_0x1257('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1bcec5,_0x258422[_0x1257('0x11')]['message']);return _0x35ab68(_0x258422[_0x1257('0x11')][_0x1257('0x14')]);}else{logger[_0x1257('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x1bcec5,'request\x20sent');_0x35ab68(_0x258422['result'][_0x1257('0x14')]);}})['catch'](function(_0x3b1ca1){logger[_0x1257('0x11')](_0x1257('0x13'),_0x1bcec5,_0x3b1ca1);_0xc7b4ee(_0x3b1ca1);});});}exports[_0x1257('0x15')]=function(_0x118a22){var _0x52a8b5=this;return new Promise(function(_0x2c3ccc,_0x4c572d){return db[_0x1257('0x16')][_0x1257('0x17')](_0x118a22[_0x1257('0x18')],{'raw':_0x118a22[_0x1257('0x19')]?_0x118a22[_0x1257('0x19')][_0x1257('0x1a')]===undefined?!![]:![]:!![]})[_0x1257('0x1b')](function(_0x281a06){logger['info'](_0x1257('0x15'),_0x118a22);logger['debug']('CreateFaxQueueReport',_0x118a22,JSON['stringify'](_0x281a06));_0x2c3ccc(_0x281a06);})[_0x1257('0x1c')](function(_0x4b663d){logger[_0x1257('0x11')](_0x1257('0x15'),_0x4b663d[_0x1257('0x14')],_0x118a22);_0x4c572d(_0x52a8b5[_0x1257('0x11')](0x1f4,_0x4b663d[_0x1257('0x14')]));});});};exports[_0x1257('0x1d')]=function(_0x4f653b){var _0x2f4cb5=this;return new Promise(function(_0x20eeb4,_0x2b162f){return db[_0x1257('0x16')][_0x1257('0x1e')](_0x4f653b['body'],{'raw':_0x4f653b[_0x1257('0x19')]?_0x4f653b['options'][_0x1257('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f653b[_0x1257('0x19')]?_0x4f653b['options'][_0x1257('0x1f')]||null:null,'attributes':_0x4f653b[_0x1257('0x19')]?_0x4f653b[_0x1257('0x19')][_0x1257('0x20')]||null:null,'limit':_0x4f653b[_0x1257('0x19')]?_0x4f653b[_0x1257('0x19')][_0x1257('0x21')]||null:null})[_0x1257('0x1b')](function(_0x5488db){logger[_0x1257('0xd')](_0x1257('0x1d'),_0x4f653b);logger[_0x1257('0x22')](_0x1257('0x1d'),_0x4f653b,JSON['stringify'](_0x5488db));_0x20eeb4(_0x5488db);})[_0x1257('0x1c')](function(_0x389380){logger[_0x1257('0x11')](_0x1257('0x1d'),_0x389380[_0x1257('0x14')],_0x4f653b);_0x2b162f(_0x2f4cb5[_0x1257('0x11')](0x1f4,_0x389380[_0x1257('0x14')]));});});}; \ No newline at end of file +var _0x3a9b=['CreateFaxQueueReport','FaxQueueReport','body','options','raw','catch','UpdateFaxQueueReport','update','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x3a9b,0x168));var _0xb3a9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x3a9b[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xb3a9('0x0'));var util=require(_0xb3a9('0x1'));var moment=require(_0xb3a9('0x2'));var BPromise=require(_0xb3a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3a9('0x4'));var db=require(_0xb3a9('0x5'))['db'];var utils=require(_0xb3a9('0x6'));var logger=require(_0xb3a9('0x7'))(_0xb3a9('0x8'));var config=require(_0xb3a9('0x9'));var jayson=require(_0xb3a9('0xa'));var client=jayson[_0xb3a9('0xb')][_0xb3a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e59e6,_0x1e642f,_0x2afef1){return new BPromise(function(_0x13fc5c,_0x493d6f){return client[_0xb3a9('0xd')](_0x3e59e6,_0x2afef1)[_0xb3a9('0xe')](function(_0x2c9226){logger['info'](_0xb3a9('0xf'),_0x1e642f,_0xb3a9('0x10'));logger[_0xb3a9('0x11')](_0xb3a9('0x12'),_0x1e642f,_0xb3a9('0x10'),JSON[_0xb3a9('0x13')](_0x2c9226));if(_0x2c9226['error']){if(_0x2c9226[_0xb3a9('0x14')][_0xb3a9('0x15')]===0x1f4){logger[_0xb3a9('0x14')](_0xb3a9('0xf'),_0x1e642f,_0x2c9226[_0xb3a9('0x14')][_0xb3a9('0x16')]);return _0x493d6f(_0x2c9226[_0xb3a9('0x14')][_0xb3a9('0x16')]);}logger['error'](_0xb3a9('0xf'),_0x1e642f,_0x2c9226[_0xb3a9('0x14')][_0xb3a9('0x16')]);return _0x13fc5c(_0x2c9226[_0xb3a9('0x14')]['message']);}else{logger[_0xb3a9('0x17')]('FaxQueueReport,\x20%s,\x20%s',_0x1e642f,_0xb3a9('0x10'));_0x13fc5c(_0x2c9226[_0xb3a9('0x18')][_0xb3a9('0x16')]);}})['catch'](function(_0x437395){logger[_0xb3a9('0x14')](_0xb3a9('0xf'),_0x1e642f,_0x437395);_0x493d6f(_0x437395);});});}exports[_0xb3a9('0x19')]=function(_0x1f5b44){var _0x164fc4=this;return new Promise(function(_0x1bce4b,_0x1631b0){return db[_0xb3a9('0x1a')]['create'](_0x1f5b44[_0xb3a9('0x1b')],{'raw':_0x1f5b44[_0xb3a9('0x1c')]?_0x1f5b44[_0xb3a9('0x1c')][_0xb3a9('0x1d')]===undefined?!![]:![]:!![]})[_0xb3a9('0xe')](function(_0x1abea4){logger[_0xb3a9('0x17')]('CreateFaxQueueReport',_0x1f5b44);logger[_0xb3a9('0x11')]('CreateFaxQueueReport',_0x1f5b44,JSON[_0xb3a9('0x13')](_0x1abea4));_0x1bce4b(_0x1abea4);})[_0xb3a9('0x1e')](function(_0x302242){logger[_0xb3a9('0x14')](_0xb3a9('0x19'),_0x302242[_0xb3a9('0x16')],_0x1f5b44);_0x1631b0(_0x164fc4[_0xb3a9('0x14')](0x1f4,_0x302242[_0xb3a9('0x16')]));});});};exports[_0xb3a9('0x1f')]=function(_0x203d41){var _0xdd25a5=this;return new Promise(function(_0xb8b42,_0x3f4bd3){return db['FaxQueueReport'][_0xb3a9('0x20')](_0x203d41['body'],{'raw':_0x203d41['options']?_0x203d41[_0xb3a9('0x1c')][_0xb3a9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203d41['options']?_0x203d41[_0xb3a9('0x1c')][_0xb3a9('0x21')]||null:null,'attributes':_0x203d41['options']?_0x203d41[_0xb3a9('0x1c')][_0xb3a9('0x22')]||null:null,'limit':_0x203d41['options']?_0x203d41[_0xb3a9('0x1c')]['limit']||null:null})[_0xb3a9('0xe')](function(_0x41fbf7){logger[_0xb3a9('0x17')](_0xb3a9('0x1f'),_0x203d41);logger[_0xb3a9('0x11')](_0xb3a9('0x1f'),_0x203d41,JSON[_0xb3a9('0x13')](_0x41fbf7));_0xb8b42(_0x41fbf7);})[_0xb3a9('0x1e')](function(_0x8c989f){logger['error'](_0xb3a9('0x1f'),_0x8c989f[_0xb3a9('0x16')],_0x203d41);_0x3f4bd3(_0xdd25a5[_0xb3a9('0x14')](0x1f4,_0x8c989f[_0xb3a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 12a7f34..33dcabf 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 _0x4b5c=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x189795,_0x27ec80){var _0x3c541e=function(_0x1e6e9e){while(--_0x1e6e9e){_0x189795['push'](_0x189795['shift']());}};_0x3c541e(++_0x27ec80);}(_0x4b5c,0x104));var _0xc4b5=function(_0x566cfa,_0x3a07c9){_0x566cfa=_0x566cfa-0x0;var _0x212f9d=_0x4b5c[_0x566cfa];return _0x212f9d;};'use strict';var multer=require(_0xc4b5('0x0'));var util=require(_0xc4b5('0x1'));var path=require('path');var timeout=require(_0xc4b5('0x2'));var express=require(_0xc4b5('0x3'));var router=express[_0xc4b5('0x4')]();var fs_extra=require(_0xc4b5('0x5'));var auth=require(_0xc4b5('0x6'));var interaction=require(_0xc4b5('0x7'));var config=require(_0xc4b5('0x8'));var controller=require(_0xc4b5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc4b5('0xa')](_0xc4b5('0xb'),auth[_0xc4b5('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc4b5('0xd')]);router[_0xc4b5('0xe')]('/',auth['isAuthenticated'](),controller[_0xc4b5('0xf')]);router[_0xc4b5('0x10')]('/:id',auth[_0xc4b5('0xc')](),controller[_0xc4b5('0x11')]);router['delete']('/:id',auth[_0xc4b5('0xc')](),controller[_0xc4b5('0x12')]);module[_0xc4b5('0x13')]=router; \ No newline at end of file +var _0x44dd=['../../components/interaction/service','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x583e07,_0x2b45b8){var _0xe9272c=function(_0x4fb5f9){while(--_0x4fb5f9){_0x583e07['push'](_0x583e07['shift']());}};_0xe9272c(++_0x2b45b8);}(_0x44dd,0x1bc));var _0xd44d=function(_0x4cb540,_0x1a2364){_0x4cb540=_0x4cb540-0x0;var _0x3db784=_0x44dd[_0x4cb540];return _0x3db784;};'use strict';var multer=require(_0xd44d('0x0'));var util=require('util');var path=require(_0xd44d('0x1'));var timeout=require(_0xd44d('0x2'));var express=require(_0xd44d('0x3'));var router=express[_0xd44d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd44d('0x5'));var interaction=require(_0xd44d('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xd44d('0x7')](),controller[_0xd44d('0x8')]);router[_0xd44d('0x9')]('/describe',auth[_0xd44d('0x7')](),controller['describe']);router[_0xd44d('0x9')]('/:id',auth[_0xd44d('0x7')](),controller['show']);router[_0xd44d('0xa')]('/',auth[_0xd44d('0x7')](),controller[_0xd44d('0xb')]);router[_0xd44d('0xc')](_0xd44d('0xd'),auth['isAuthenticated'](),controller[_0xd44d('0xe')]);router[_0xd44d('0xf')](_0xd44d('0xd'),auth[_0xd44d('0x7')](),controller[_0xd44d('0x10')]);module[_0xd44d('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 1fdd6aa..bbe220c 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x422996,_0x53659e){var _0x6f4ba9=function(_0x5cab27){while(--_0x5cab27){_0x422996['push'](_0x422996['shift']());}};_0x6f4ba9(++_0x53659e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x00bb[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2a05c5,_0x2c5077){var _0x15b2c5=function(_0x4c033f){while(--_0x4c033f){_0x2a05c5['push'](_0x2a05c5['shift']());}};_0x15b2c5(++_0x2c5077);}(_0xaa88,0x137));var _0x8aa8=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0xaa88[_0x37862a];return _0x5b0104;};'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 9b9077d..7a40956 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 _0x51d3=['offset','limit','set','Content-Range','save','update','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x30b9e3,_0x9a40cb){var _0x1bbab0=function(_0x3c475c){while(--_0x3c475c){_0x30b9e3['push'](_0x30b9e3['shift']());}};_0x1bbab0(++_0x9a40cb);}(_0x51d3,0x146));var _0x351d=function(_0x14d9fc,_0x343f3d){_0x14d9fc=_0x14d9fc-0x0;var _0x1020e2=_0x51d3[_0x14d9fc];return _0x1020e2;};'use strict';var emlformat=require(_0x351d('0x0'));var rimraf=require(_0x351d('0x1'));var zipdir=require(_0x351d('0x2'));var jsonpatch=require(_0x351d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x351d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x351d('0x5'));var sox=require(_0x351d('0x6'));var csv=require('to-csv');var ejs=require(_0x351d('0x7'));var fs=require('fs');var fs_extra=require(_0x351d('0x8'));var _=require(_0x351d('0x9'));var squel=require(_0x351d('0xa'));var crypto=require('crypto');var jsforce=require(_0x351d('0xb'));var deskjs=require(_0x351d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x351d('0xd'));var authService=require(_0x351d('0xe'));var qs=require(_0x351d('0xf'));var as=require(_0x351d('0x10'));var hardwareService=require(_0x351d('0x11'));var logger=require(_0x351d('0x12'))(_0x351d('0x13'));var utils=require(_0x351d('0x14'));var config=require(_0x351d('0x15'));var licenseUtil=require(_0x351d('0x16'));var db=require(_0x351d('0x17'))['db'];function respondWithStatusCode(_0x53ac2e,_0x5e9906){_0x5e9906=_0x5e9906||0xcc;return function(_0x6ec131){if(_0x6ec131){return _0x53ac2e[_0x351d('0x18')](_0x5e9906);}return _0x53ac2e[_0x351d('0x19')](_0x5e9906)['end']();};}function respondWithResult(_0x567604,_0x42a053){_0x42a053=_0x42a053||0xc8;return function(_0x4c9826){if(_0x4c9826){return _0x567604[_0x351d('0x19')](_0x42a053)[_0x351d('0x1a')](_0x4c9826);}};}function respondWithFilteredResult(_0x1e4152,_0x51e508){return function(_0x2ffd51){if(_0x2ffd51){var _0x2a6f40=typeof _0x51e508['offset']===_0x351d('0x1b')&&typeof _0x51e508['limit']===_0x351d('0x1b');var _0x56b301=_0x2ffd51['count'];var _0x1bdf43=_0x2a6f40?0x0:_0x51e508['offset'];var _0x1640a8=_0x2a6f40?_0x2ffd51[_0x351d('0x1c')]:_0x51e508[_0x351d('0x1d')]+_0x51e508[_0x351d('0x1e')];var _0x29c8d2;if(_0x1640a8>=_0x56b301){_0x1640a8=_0x56b301;_0x29c8d2=0xc8;}else{_0x29c8d2=0xce;}_0x1e4152['status'](_0x29c8d2);return _0x1e4152[_0x351d('0x1f')](_0x351d('0x20'),_0x1bdf43+'-'+_0x1640a8+'/'+_0x56b301)[_0x351d('0x1a')](_0x2ffd51);}return null;};}function patchUpdates(_0x196a08){return function(_0x4a395a){try{jsonpatch['apply'](_0x4a395a,_0x196a08,!![]);}catch(_0x5d9489){return BPromise['reject'](_0x5d9489);}return _0x4a395a[_0x351d('0x21')]();};}function saveUpdates(_0x319ccd,_0x85dba8){return function(_0x1a81e6){if(_0x1a81e6){return _0x1a81e6[_0x351d('0x22')](_0x319ccd)[_0x351d('0x23')](function(_0x29c177){return _0x29c177;});}return null;};}function removeEntity(_0x848a10,_0x4362e5){return function(_0x181b73){if(_0x181b73){return _0x181b73['destroy']()[_0x351d('0x23')](function(){_0x848a10[_0x351d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2403db,_0x260162){return function(_0x188c1a){if(!_0x188c1a){_0x2403db[_0x351d('0x18')](0x194);}return _0x188c1a;};}function handleError(_0x327741,_0x2a8179){_0x2a8179=_0x2a8179||0x1f4;return function(_0x2b1b75){logger[_0x351d('0x24')](_0x2b1b75[_0x351d('0x25')]);if(_0x2b1b75[_0x351d('0x26')]){delete _0x2b1b75['name'];}_0x327741[_0x351d('0x19')](_0x2a8179)['send'](_0x2b1b75);};}exports[_0x351d('0x27')]=function(_0x318c09,_0x2d7845){var _0xbd4ea4={},_0x5e6e2a={},_0x1e44e5={'count':0x0,'rows':[]};var _0x788400=_[_0x351d('0x28')](db[_0x351d('0x29')][_0x351d('0x2a')],function(_0x26c588){return{'name':_0x26c588['fieldName'],'type':_0x26c588['type'][_0x351d('0x2b')]};});_0x5e6e2a[_0x351d('0x2c')]=_[_0x351d('0x28')](_0x788400,_0x351d('0x26'));_0x5e6e2a['query']=_['keys'](_0x318c09[_0x351d('0x2d')]);_0x5e6e2a[_0x351d('0x2e')]=_[_0x351d('0x2f')](_0x5e6e2a['model'],_0x5e6e2a[_0x351d('0x2d')]);_0xbd4ea4['attributes']=_[_0x351d('0x2f')](_0x5e6e2a[_0x351d('0x2c')],qs['fields'](_0x318c09['query'][_0x351d('0x30')]));_0xbd4ea4[_0x351d('0x31')]=_0xbd4ea4['attributes'][_0x351d('0x32')]?_0xbd4ea4[_0x351d('0x31')]:_0x5e6e2a[_0x351d('0x2c')];if(!_0x318c09[_0x351d('0x2d')][_0x351d('0x33')](_0x351d('0x34'))){_0xbd4ea4[_0x351d('0x1e')]=qs['limit'](_0x318c09['query'][_0x351d('0x1e')]);_0xbd4ea4['offset']=qs[_0x351d('0x1d')](_0x318c09[_0x351d('0x2d')]['offset']);}_0xbd4ea4['order']=qs[_0x351d('0x35')](_0x318c09[_0x351d('0x2d')][_0x351d('0x35')]);_0xbd4ea4['where']=qs[_0x351d('0x2e')](_['pick'](_0x318c09[_0x351d('0x2d')],_0x5e6e2a['filters']),_0x788400);if(_0x318c09[_0x351d('0x2d')][_0x351d('0x36')]){_0xbd4ea4['where']=_['merge'](_0xbd4ea4[_0x351d('0x37')],{'$or':_['map'](_0x788400,function(_0x19360e){if(_0x19360e['type']!==_0x351d('0x38')){var _0x33c62e={};_0x33c62e[_0x19360e['name']]={'$like':'%'+_0x318c09['query'][_0x351d('0x36')]+'%'};return _0x33c62e;}})});}_0xbd4ea4=_[_0x351d('0x39')]({},_0xbd4ea4,_0x318c09[_0x351d('0x3a')]);var _0x2a10f9={'where':_0xbd4ea4[_0x351d('0x37')]};return db[_0x351d('0x29')][_0x351d('0x1c')](_0x2a10f9)['then'](function(_0x127981){_0x1e44e5[_0x351d('0x1c')]=_0x127981;if(_0x318c09[_0x351d('0x2d')][_0x351d('0x3b')]){_0xbd4ea4[_0x351d('0x3c')]=[{'all':!![]}];}return db[_0x351d('0x29')][_0x351d('0x3d')](_0xbd4ea4);})[_0x351d('0x23')](function(_0x560c9d){_0x1e44e5[_0x351d('0x3e')]=_0x560c9d;return _0x1e44e5;})['then'](respondWithFilteredResult(_0x2d7845,_0xbd4ea4))[_0x351d('0x3f')](handleError(_0x2d7845,null));};exports[_0x351d('0x40')]=function(_0x1a2e01,_0x2c7ba2){var _0x4cc5a4={'raw':!![],'where':{'id':_0x1a2e01[_0x351d('0x41')]['id']}},_0x2f7451={};_0x2f7451[_0x351d('0x2c')]=_['keys'](db[_0x351d('0x29')][_0x351d('0x2a')]);_0x2f7451[_0x351d('0x2d')]=_['keys'](_0x1a2e01['query']);_0x2f7451[_0x351d('0x2e')]=_[_0x351d('0x2f')](_0x2f7451[_0x351d('0x2c')],_0x2f7451[_0x351d('0x2d')]);_0x4cc5a4[_0x351d('0x31')]=_[_0x351d('0x2f')](_0x2f7451[_0x351d('0x2c')],qs[_0x351d('0x30')](_0x1a2e01[_0x351d('0x2d')][_0x351d('0x30')]));_0x4cc5a4[_0x351d('0x31')]=_0x4cc5a4[_0x351d('0x31')][_0x351d('0x32')]?_0x4cc5a4['attributes']:_0x2f7451[_0x351d('0x2c')];if(_0x1a2e01[_0x351d('0x2d')][_0x351d('0x3b')]){_0x4cc5a4[_0x351d('0x3c')]=[{'all':!![]}];}_0x4cc5a4=_[_0x351d('0x39')]({},_0x4cc5a4,_0x1a2e01[_0x351d('0x3a')]);return db[_0x351d('0x29')]['find'](_0x4cc5a4)[_0x351d('0x23')](handleEntityNotFound(_0x2c7ba2,null))[_0x351d('0x23')](respondWithResult(_0x2c7ba2,null))[_0x351d('0x3f')](handleError(_0x2c7ba2,null));};exports[_0x351d('0x42')]=function(_0x477a5a,_0x12b4ad){return db[_0x351d('0x29')]['create'](_0x477a5a[_0x351d('0x43')],{})[_0x351d('0x23')](respondWithResult(_0x12b4ad,0xc9))[_0x351d('0x3f')](handleError(_0x12b4ad,null));};exports[_0x351d('0x22')]=function(_0x371465,_0x244fcf){if(_0x371465[_0x351d('0x43')]['id']){delete _0x371465[_0x351d('0x43')]['id'];}return db[_0x351d('0x29')][_0x351d('0x44')]({'where':{'id':_0x371465[_0x351d('0x41')]['id']}})[_0x351d('0x23')](handleEntityNotFound(_0x244fcf,null))[_0x351d('0x23')](saveUpdates(_0x371465[_0x351d('0x43')],null))['then'](respondWithResult(_0x244fcf,null))[_0x351d('0x3f')](handleError(_0x244fcf,null));};exports[_0x351d('0x45')]=function(_0x54fd4d,_0x25508a){return db[_0x351d('0x29')]['find']({'where':{'id':_0x54fd4d[_0x351d('0x41')]['id']}})[_0x351d('0x23')](handleEntityNotFound(_0x25508a,null))[_0x351d('0x23')](removeEntity(_0x25508a,null))[_0x351d('0x3f')](handleError(_0x25508a,null));};exports[_0x351d('0x46')]=function(_0x411989,_0x57e4bf){return db[_0x351d('0x29')][_0x351d('0x46')]()[_0x351d('0x23')](respondWithResult(_0x57e4bf,null))[_0x351d('0x3f')](handleError(_0x57e4bf,null));}; \ No newline at end of file +var _0x3d47=['end','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','options','include','findAll','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1c0a06,_0x53b821){var _0x43e800=function(_0x460a21){while(--_0x460a21){_0x1c0a06['push'](_0x1c0a06['shift']());}};_0x43e800(++_0x53b821);}(_0x3d47,0x103));var _0x73d4=function(_0x35766e,_0xe640a3){_0x35766e=_0x35766e-0x0;var _0x173508=_0x3d47[_0x35766e];return _0x173508;};'use strict';var emlformat=require(_0x73d4('0x0'));var rimraf=require(_0x73d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73d4('0x2'));var rp=require(_0x73d4('0x3'));var moment=require(_0x73d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73d4('0x5'));var util=require(_0x73d4('0x6'));var path=require('path');var sox=require(_0x73d4('0x7'));var csv=require(_0x73d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73d4('0x9'));var squel=require(_0x73d4('0xa'));var crypto=require('crypto');var jsforce=require(_0x73d4('0xb'));var deskjs=require(_0x73d4('0xc'));var toCsv=require(_0x73d4('0x8'));var querystring=require(_0x73d4('0xd'));var Papa=require(_0x73d4('0xe'));var Redis=require(_0x73d4('0xf'));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(_0x73d4('0x17'));var licenseUtil=require(_0x73d4('0x18'));var db=require(_0x73d4('0x19'))['db'];function respondWithStatusCode(_0x441122,_0x2c5a76){_0x2c5a76=_0x2c5a76||0xcc;return function(_0x123a9f){if(_0x123a9f){return _0x441122[_0x73d4('0x1a')](_0x2c5a76);}return _0x441122['status'](_0x2c5a76)['end']();};}function respondWithResult(_0x4e7858,_0x19b2e0){_0x19b2e0=_0x19b2e0||0xc8;return function(_0x218910){if(_0x218910){return _0x4e7858[_0x73d4('0x1b')](_0x19b2e0)[_0x73d4('0x1c')](_0x218910);}};}function respondWithFilteredResult(_0x53f529,_0x313fa0){return function(_0x1a9c5a){if(_0x1a9c5a){var _0x41f96c=typeof _0x313fa0[_0x73d4('0x1d')]===_0x73d4('0x1e')&&typeof _0x313fa0[_0x73d4('0x1f')]===_0x73d4('0x1e');var _0x22c926=_0x1a9c5a[_0x73d4('0x20')];var _0x31b6d9=_0x41f96c?0x0:_0x313fa0[_0x73d4('0x1d')];var _0x235677=_0x41f96c?_0x1a9c5a['count']:_0x313fa0[_0x73d4('0x1d')]+_0x313fa0[_0x73d4('0x1f')];var _0x2cd8b5;if(_0x235677>=_0x22c926){_0x235677=_0x22c926;_0x2cd8b5=0xc8;}else{_0x2cd8b5=0xce;}_0x53f529[_0x73d4('0x1b')](_0x2cd8b5);return _0x53f529[_0x73d4('0x21')](_0x73d4('0x22'),_0x31b6d9+'-'+_0x235677+'/'+_0x22c926)[_0x73d4('0x1c')](_0x1a9c5a);}return null;};}function patchUpdates(_0x16b8fe){return function(_0x970c71){try{jsonpatch[_0x73d4('0x23')](_0x970c71,_0x16b8fe,!![]);}catch(_0x167f2f){return BPromise[_0x73d4('0x24')](_0x167f2f);}return _0x970c71[_0x73d4('0x25')]();};}function saveUpdates(_0x59d709,_0x192be3){return function(_0x3463e9){if(_0x3463e9){return _0x3463e9[_0x73d4('0x26')](_0x59d709)[_0x73d4('0x27')](function(_0x1d8b17){return _0x1d8b17;});}return null;};}function removeEntity(_0x531f64,_0x278486){return function(_0x4f1606){if(_0x4f1606){return _0x4f1606[_0x73d4('0x28')]()['then'](function(){_0x531f64['status'](0xcc)[_0x73d4('0x29')]();});}};}function handleEntityNotFound(_0x1d5998,_0x251fba){return function(_0x3ce31f){if(!_0x3ce31f){_0x1d5998[_0x73d4('0x1a')](0x194);}return _0x3ce31f;};}function handleError(_0x3d2cfb,_0x14d1f9){_0x14d1f9=_0x14d1f9||0x1f4;return function(_0x3ba1dc){logger['error'](_0x3ba1dc[_0x73d4('0x2a')]);if(_0x3ba1dc[_0x73d4('0x2b')]){delete _0x3ba1dc['name'];}_0x3d2cfb[_0x73d4('0x1b')](_0x14d1f9)['send'](_0x3ba1dc);};}exports[_0x73d4('0x2c')]=function(_0x311643,_0x20150a){var _0x2e6e38={},_0x372c43={},_0x17c8fa={'count':0x0,'rows':[]};var _0xd1cad1=_[_0x73d4('0x2d')](db[_0x73d4('0x2e')][_0x73d4('0x2f')],function(_0x55a38d){return{'name':_0x55a38d[_0x73d4('0x30')],'type':_0x55a38d['type']['key']};});_0x372c43[_0x73d4('0x31')]=_[_0x73d4('0x2d')](_0xd1cad1,_0x73d4('0x2b'));_0x372c43[_0x73d4('0x32')]=_['keys'](_0x311643[_0x73d4('0x32')]);_0x372c43[_0x73d4('0x33')]=_[_0x73d4('0x34')](_0x372c43['model'],_0x372c43[_0x73d4('0x32')]);_0x2e6e38[_0x73d4('0x35')]=_[_0x73d4('0x34')](_0x372c43[_0x73d4('0x31')],qs[_0x73d4('0x36')](_0x311643[_0x73d4('0x32')][_0x73d4('0x36')]));_0x2e6e38['attributes']=_0x2e6e38['attributes'][_0x73d4('0x37')]?_0x2e6e38[_0x73d4('0x35')]:_0x372c43[_0x73d4('0x31')];if(!_0x311643['query'][_0x73d4('0x38')](_0x73d4('0x39'))){_0x2e6e38['limit']=qs[_0x73d4('0x1f')](_0x311643[_0x73d4('0x32')][_0x73d4('0x1f')]);_0x2e6e38[_0x73d4('0x1d')]=qs[_0x73d4('0x1d')](_0x311643['query'][_0x73d4('0x1d')]);}_0x2e6e38[_0x73d4('0x3a')]=qs[_0x73d4('0x3b')](_0x311643[_0x73d4('0x32')][_0x73d4('0x3b')]);_0x2e6e38[_0x73d4('0x3c')]=qs[_0x73d4('0x33')](_[_0x73d4('0x3d')](_0x311643[_0x73d4('0x32')],_0x372c43['filters']),_0xd1cad1);if(_0x311643['query']['filter']){_0x2e6e38[_0x73d4('0x3c')]=_[_0x73d4('0x3e')](_0x2e6e38['where'],{'$or':_['map'](_0xd1cad1,function(_0x5bfec1){if(_0x5bfec1[_0x73d4('0x3f')]!=='VIRTUAL'){var _0x564717={};_0x564717[_0x5bfec1[_0x73d4('0x2b')]]={'$like':'%'+_0x311643[_0x73d4('0x32')]['filter']+'%'};return _0x564717;}})});}_0x2e6e38=_['merge']({},_0x2e6e38,_0x311643[_0x73d4('0x40')]);var _0x1834c4={'where':_0x2e6e38[_0x73d4('0x3c')]};return db[_0x73d4('0x2e')]['count'](_0x1834c4)[_0x73d4('0x27')](function(_0x4e0a56){_0x17c8fa['count']=_0x4e0a56;if(_0x311643[_0x73d4('0x32')]['includeAll']){_0x2e6e38[_0x73d4('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x73d4('0x42')](_0x2e6e38);})['then'](function(_0xc60f3a){_0x17c8fa['rows']=_0xc60f3a;return _0x17c8fa;})[_0x73d4('0x27')](respondWithFilteredResult(_0x20150a,_0x2e6e38))[_0x73d4('0x43')](handleError(_0x20150a,null));};exports['show']=function(_0x3089b0,_0x299dcc){var _0x14831b={'raw':!![],'where':{'id':_0x3089b0[_0x73d4('0x44')]['id']}},_0x4f51e7={};_0x4f51e7[_0x73d4('0x31')]=_['keys'](db['FaxTransferReport'][_0x73d4('0x2f')]);_0x4f51e7[_0x73d4('0x32')]=_[_0x73d4('0x45')](_0x3089b0[_0x73d4('0x32')]);_0x4f51e7['filters']=_[_0x73d4('0x34')](_0x4f51e7['model'],_0x4f51e7[_0x73d4('0x32')]);_0x14831b['attributes']=_[_0x73d4('0x34')](_0x4f51e7[_0x73d4('0x31')],qs[_0x73d4('0x36')](_0x3089b0[_0x73d4('0x32')][_0x73d4('0x36')]));_0x14831b[_0x73d4('0x35')]=_0x14831b['attributes'][_0x73d4('0x37')]?_0x14831b[_0x73d4('0x35')]:_0x4f51e7[_0x73d4('0x31')];if(_0x3089b0['query'][_0x73d4('0x46')]){_0x14831b[_0x73d4('0x41')]=[{'all':!![]}];}_0x14831b=_[_0x73d4('0x3e')]({},_0x14831b,_0x3089b0[_0x73d4('0x40')]);return db['FaxTransferReport'][_0x73d4('0x47')](_0x14831b)['then'](handleEntityNotFound(_0x299dcc,null))[_0x73d4('0x27')](respondWithResult(_0x299dcc,null))[_0x73d4('0x43')](handleError(_0x299dcc,null));};exports[_0x73d4('0x48')]=function(_0x3c5727,_0x14cce0){return db[_0x73d4('0x2e')][_0x73d4('0x48')](_0x3c5727['body'],{})[_0x73d4('0x27')](respondWithResult(_0x14cce0,0xc9))['catch'](handleError(_0x14cce0,null));};exports[_0x73d4('0x26')]=function(_0x35430d,_0x459b95){if(_0x35430d['body']['id']){delete _0x35430d[_0x73d4('0x49')]['id'];}return db[_0x73d4('0x2e')]['find']({'where':{'id':_0x35430d[_0x73d4('0x44')]['id']}})['then'](handleEntityNotFound(_0x459b95,null))[_0x73d4('0x27')](saveUpdates(_0x35430d['body'],null))[_0x73d4('0x27')](respondWithResult(_0x459b95,null))[_0x73d4('0x43')](handleError(_0x459b95,null));};exports[_0x73d4('0x28')]=function(_0x1b5173,_0x161e8d){return db['FaxTransferReport'][_0x73d4('0x47')]({'where':{'id':_0x1b5173[_0x73d4('0x44')]['id']}})[_0x73d4('0x27')](handleEntityNotFound(_0x161e8d,null))[_0x73d4('0x27')](removeEntity(_0x161e8d,null))['catch'](handleError(_0x161e8d,null));};exports[_0x73d4('0x4a')]=function(_0x3971e9,_0x461793){return db[_0x73d4('0x2e')][_0x73d4('0x4a')]()[_0x73d4('0x27')](respondWithResult(_0x461793,null))[_0x73d4('0x43')](handleError(_0x461793,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a3bdf6c..32e4d81 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 _0xd125=['report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xd125,0x92));var _0x5d12=function(_0x2ad781,_0x5b9b39){_0x2ad781=_0x2ad781-0x0;var _0x35dc90=_0xd125[_0x2ad781];return _0x35dc90;};'use strict';var _=require('lodash');var util=require(_0x5d12('0x0'));var logger=require(_0x5d12('0x1'))(_0x5d12('0x2'));var moment=require(_0x5d12('0x3'));var BPromise=require(_0x5d12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d12('0x5'));var rimraf=require(_0x5d12('0x6'));var config=require('../../config/environment');var attributes=require(_0x5d12('0x7'));module['exports']=function(_0x41bae4,_0xe9bee9){return _0x41bae4[_0x5d12('0x8')](_0x5d12('0x9'),attributes,{'tableName':_0x5d12('0xa'),'paranoid':![],'indexes':[{'name':_0x5d12('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash'];(function(_0x4ecbbc,_0x473214){var _0x2b7bda=function(_0x561b08){while(--_0x561b08){_0x4ecbbc['push'](_0x4ecbbc['shift']());}};_0x2b7bda(++_0x473214);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x38fa97,_0x51d816){_0x38fa97=_0x38fa97-0x0;var _0x5e4859=_0xd1d3[_0x38fa97];return _0x5e4859;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))('api');var moment=require(_0x3d1d('0x2'));var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d1d('0x7'));module[_0x3d1d('0x8')]=function(_0x55c165,_0x2d3a52){return _0x55c165[_0x3d1d('0x9')]('FaxTransferReport',attributes,{'tableName':_0x3d1d('0xa'),'paranoid':![],'indexes':[{'name':_0x3d1d('0xb'),'fields':[_0x3d1d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c51ec98..2be9de4 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 _0x874d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x23f50a,_0x1e0fbc){var _0x3d48e2=function(_0x103d6e){while(--_0x103d6e){_0x23f50a['push'](_0x23f50a['shift']());}};_0x3d48e2(++_0x1e0fbc);}(_0x874d,0xa8));var _0xd874=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x874d[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xd874('0x0'));var util=require(_0xd874('0x1'));var moment=require(_0xd874('0x2'));var BPromise=require(_0xd874('0x3'));var rs=require(_0xd874('0x4'));var fs=require('fs');var Redis=require(_0xd874('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd874('0x6'));var logger=require('../../config/logger')(_0xd874('0x7'));var config=require(_0xd874('0x8'));var jayson=require(_0xd874('0x9'));var client=jayson[_0xd874('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1562,_0x31a616,_0x45c9ab){return new BPromise(function(_0x214dba,_0x5b69e9){return client[_0xd874('0xb')](_0x1a1562,_0x45c9ab)['then'](function(_0x77145a){logger[_0xd874('0xc')](_0xd874('0xd'),_0x31a616,_0xd874('0xe'));logger[_0xd874('0xf')](_0xd874('0x10'),_0x31a616,_0xd874('0xe'),JSON[_0xd874('0x11')](_0x77145a));if(_0x77145a['error']){if(_0x77145a['error']['code']===0x1f4){logger[_0xd874('0x12')](_0xd874('0xd'),_0x31a616,_0x77145a[_0xd874('0x12')][_0xd874('0x13')]);return _0x5b69e9(_0x77145a[_0xd874('0x12')][_0xd874('0x13')]);}logger[_0xd874('0x12')](_0xd874('0xd'),_0x31a616,_0x77145a[_0xd874('0x12')][_0xd874('0x13')]);return _0x214dba(_0x77145a[_0xd874('0x12')][_0xd874('0x13')]);}else{logger[_0xd874('0xc')](_0xd874('0xd'),_0x31a616,_0xd874('0xe'));_0x214dba(_0x77145a[_0xd874('0x14')][_0xd874('0x13')]);}})['catch'](function(_0xde2718){logger[_0xd874('0x12')](_0xd874('0xd'),_0x31a616,_0xde2718);_0x5b69e9(_0xde2718);});});} \ No newline at end of file +var _0x47cd=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x15fb20,_0xe2048c){var _0x4ed40b=function(_0x50743f){while(--_0x50743f){_0x15fb20['push'](_0x15fb20['shift']());}};_0x4ed40b(++_0xe2048c);}(_0x47cd,0xaa));var _0xd47c=function(_0x4c49a5,_0x698519){_0x4c49a5=_0x4c49a5-0x0;var _0x3e9d8c=_0x47cd[_0x4c49a5];return _0x3e9d8c;};'use strict';var _=require(_0xd47c('0x0'));var util=require(_0xd47c('0x1'));var moment=require(_0xd47c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd47c('0x3'));var fs=require('fs');var Redis=require(_0xd47c('0x4'));var db=require(_0xd47c('0x5'))['db'];var utils=require(_0xd47c('0x6'));var logger=require('../../config/logger')(_0xd47c('0x7'));var config=require(_0xd47c('0x8'));var jayson=require(_0xd47c('0x9'));var client=jayson[_0xd47c('0xa')][_0xd47c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6b83,_0x54cea6,_0x1c71b3){return new BPromise(function(_0x432a91,_0x1dc1e7){return client['request'](_0x3a6b83,_0x1c71b3)[_0xd47c('0xc')](function(_0x5ba79e){logger[_0xd47c('0xd')](_0xd47c('0xe'),_0x54cea6,_0xd47c('0xf'));logger[_0xd47c('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x54cea6,'request\x20sent',JSON[_0xd47c('0x11')](_0x5ba79e));if(_0x5ba79e[_0xd47c('0x12')]){if(_0x5ba79e['error'][_0xd47c('0x13')]===0x1f4){logger[_0xd47c('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x54cea6,_0x5ba79e[_0xd47c('0x12')][_0xd47c('0x14')]);return _0x1dc1e7(_0x5ba79e[_0xd47c('0x12')]['message']);}logger[_0xd47c('0x12')](_0xd47c('0xe'),_0x54cea6,_0x5ba79e['error'][_0xd47c('0x14')]);return _0x432a91(_0x5ba79e['error'][_0xd47c('0x14')]);}else{logger[_0xd47c('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x54cea6,_0xd47c('0xf'));_0x432a91(_0x5ba79e['result'][_0xd47c('0x14')]);}})[_0xd47c('0x15')](function(_0x2a709c){logger[_0xd47c('0x12')](_0xd47c('0xe'),_0x54cea6,_0x2a709c);_0x1dc1e7(_0x2a709c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 619ca17..4a92bb8 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 _0x189e=['connect-timeout','express','Router','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','destroy','exports','util','path'];(function(_0x20bff0,_0x3c2ac9){var _0x5bb0d0=function(_0x16d9d7){while(--_0x16d9d7){_0x20bff0['push'](_0x20bff0['shift']());}};_0x5bb0d0(++_0x3c2ac9);}(_0x189e,0x11f));var _0xe189=function(_0x3c424f,_0x47c73e){_0x3c424f=_0x3c424f-0x0;var _0x590451=_0x189e[_0x3c424f];return _0x590451;};'use strict';var multer=require('multer');var util=require(_0xe189('0x0'));var path=require(_0xe189('0x1'));var timeout=require(_0xe189('0x2'));var express=require(_0xe189('0x3'));var router=express[_0xe189('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe189('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe189('0x6'));router[_0xe189('0x7')]('/',auth[_0xe189('0x8')](),controller[_0xe189('0x9')]);router['get'](_0xe189('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe189('0x7')](_0xe189('0xb'),auth[_0xe189('0x8')](),controller[_0xe189('0xc')]);router[_0xe189('0xd')]('/',auth[_0xe189('0x8')](),controller[_0xe189('0xe')]);router['put'](_0xe189('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe189('0xb'),auth[_0xe189('0x8')](),controller[_0xe189('0xf')]);module[_0xe189('0x10')]=router; \ No newline at end of file +var _0x920a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','multer','util','path','connect-timeout','express'];(function(_0x3af75b,_0x15c8e1){var _0x50cfb7=function(_0xc0ea41){while(--_0xc0ea41){_0x3af75b['push'](_0x3af75b['shift']());}};_0x50cfb7(++_0x15c8e1);}(_0x920a,0x13e));var _0xa920=function(_0x342a54,_0x266428){_0x342a54=_0x342a54-0x0;var _0x4fff8a=_0x920a[_0x342a54];return _0x4fff8a;};'use strict';var multer=require(_0xa920('0x0'));var util=require(_0xa920('0x1'));var path=require(_0xa920('0x2'));var timeout=require(_0xa920('0x3'));var express=require(_0xa920('0x4'));var router=express[_0xa920('0x5')]();var fs_extra=require(_0xa920('0x6'));var auth=require(_0xa920('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa920('0x8'));var controller=require('./faxTransferReport.controller');router[_0xa920('0x9')]('/',auth[_0xa920('0xa')](),controller[_0xa920('0xb')]);router['get'](_0xa920('0xc'),auth[_0xa920('0xa')](),controller[_0xa920('0xd')]);router[_0xa920('0x9')](_0xa920('0xe'),auth[_0xa920('0xa')](),controller[_0xa920('0xf')]);router[_0xa920('0x10')]('/',auth[_0xa920('0xa')](),controller[_0xa920('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa920('0xa')](),controller[_0xa920('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 ac1297b..3dbe683 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 _0x7c95=['isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','get','/:id'];(function(_0x714755,_0x316444){var _0x1cbb8a=function(_0x2c9653){while(--_0x2c9653){_0x714755['push'](_0x714755['shift']());}};_0x1cbb8a(++_0x316444);}(_0x7c95,0x1a3));var _0x57c9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7c95[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x57c9('0x0'));var util=require(_0x57c9('0x1'));var path=require(_0x57c9('0x2'));var timeout=require(_0x57c9('0x3'));var express=require('express');var router=express[_0x57c9('0x4')]();var fs_extra=require(_0x57c9('0x5'));var auth=require(_0x57c9('0x6'));var interaction=require(_0x57c9('0x7'));var config=require(_0x57c9('0x8'));var controller=require(_0x57c9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x57c9('0xa')]);router[_0x57c9('0xb')](_0x57c9('0xc'),auth[_0x57c9('0xd')](),controller[_0x57c9('0xe')]);router['get'](_0x57c9('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x57c9('0xb')](_0x57c9('0x10'),auth['isAuthenticated'](),controller[_0x57c9('0x11')]);router[_0x57c9('0x12')]('/',auth[_0x57c9('0xd')](),controller['create']);router[_0x57c9('0x12')]('/:id/configurations',auth[_0x57c9('0xd')](),controller[_0x57c9('0x13')]);router[_0x57c9('0x14')]('/:id',auth[_0x57c9('0xd')](),controller[_0x57c9('0x15')]);router[_0x57c9('0x16')](_0x57c9('0xc'),auth[_0x57c9('0xd')](),controller['destroy']);module[_0x57c9('0x17')]=router; \ No newline at end of file +var _0x68d2=['/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x11767d,_0x338365){var _0x391dc6=function(_0x408991){while(--_0x408991){_0x11767d['push'](_0x11767d['shift']());}};_0x391dc6(++_0x338365);}(_0x68d2,0x135));var _0x268d=function(_0x2c7034,_0x2456cd){_0x2c7034=_0x2c7034-0x0;var _0x432394=_0x68d2[_0x2c7034];return _0x432394;};'use strict';var multer=require(_0x268d('0x0'));var util=require(_0x268d('0x1'));var path=require(_0x268d('0x2'));var timeout=require(_0x268d('0x3'));var express=require(_0x268d('0x4'));var router=express['Router']();var fs_extra=require(_0x268d('0x5'));var auth=require(_0x268d('0x6'));var interaction=require(_0x268d('0x7'));var config=require(_0x268d('0x8'));var controller=require(_0x268d('0x9'));router[_0x268d('0xa')]('/',auth[_0x268d('0xb')](),controller[_0x268d('0xc')]);router[_0x268d('0xa')](_0x268d('0xd'),auth[_0x268d('0xb')](),controller[_0x268d('0xe')]);router[_0x268d('0xa')](_0x268d('0xf'),auth[_0x268d('0xb')](),controller[_0x268d('0x10')]);router[_0x268d('0xa')]('/:id/fields',auth[_0x268d('0xb')](),controller['getFields']);router[_0x268d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x268d('0x11')](_0x268d('0xf'),auth['isAuthenticated'](),controller[_0x268d('0x12')]);router[_0x268d('0x13')](_0x268d('0xd'),auth[_0x268d('0xb')](),controller[_0x268d('0x14')]);router['delete'](_0x268d('0xd'),auth[_0x268d('0xb')](),controller[_0x268d('0x15')]);module[_0x268d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index dd320a0..32267cb 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 _0x405e=['basic','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x28f667,_0x33c890){var _0x432b4e=function(_0x1e593e){while(--_0x1e593e){_0x28f667['push'](_0x28f667['shift']());}};_0x432b4e(++_0x33c890);}(_0x405e,0x1cc));var _0xe405=function(_0x388fc1,_0x31de00){_0x388fc1=_0x388fc1-0x0;var _0x2c2219=_0x405e[_0x388fc1];return _0x2c2219;};'use strict';var Sequelize=require('sequelize');module[_0xe405('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe405('0x1')]},'username':{'type':Sequelize[_0xe405('0x1')]},'remoteUri':{'type':Sequelize[_0xe405('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xe405('0x2')),'defaultValue':_0xe405('0x2')},'password':{'type':Sequelize[_0xe405('0x1')]},'consumerKey':{'type':Sequelize[_0xe405('0x1')]},'consumerSecret':{'type':Sequelize[_0xe405('0x1')]},'token':{'type':Sequelize[_0xe405('0x1')]},'tokenSecret':{'type':Sequelize[_0xe405('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe405('0x3')](_0xe405('0x4'),_0xe405('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7097=['basic','sequelize','exports','STRING'];(function(_0x319deb,_0xa00044){var _0x5a1854=function(_0x45eb06){while(--_0x45eb06){_0x319deb['push'](_0x319deb['shift']());}};_0x5a1854(++_0xa00044);}(_0x7097,0x8d));var _0x7709=function(_0x605abd,_0x349be8){_0x605abd=_0x605abd-0x0;var _0x5477e1=_0x7097[_0x605abd];return _0x5477e1;};'use strict';var Sequelize=require(_0x7709('0x0'));module[_0x7709('0x1')]={'name':{'type':Sequelize[_0x7709('0x2')]},'description':{'type':Sequelize[_0x7709('0x2')]},'username':{'type':Sequelize[_0x7709('0x2')]},'remoteUri':{'type':Sequelize[_0x7709('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x7709('0x3')),'defaultValue':_0x7709('0x3')},'password':{'type':Sequelize[_0x7709('0x2')]},'consumerKey':{'type':Sequelize[_0x7709('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7709('0x2')]},'tokenSecret':{'type':Sequelize[_0x7709('0x2')]},'serverUrl':{'type':Sequelize[_0x7709('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index afe36bb..0a3b142 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 _0x1f56=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','show','params','fields','length','find','create','update','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','priority','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','application/json','authType','basic','headers','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x1145d7,_0x160a6f){var _0x3dae17=function(_0x48e79a){while(--_0x48e79a){_0x1145d7['push'](_0x1145d7['shift']());}};_0x3dae17(++_0x160a6f);}(_0x1f56,0xd2));var _0x61f5=function(_0x43de9d,_0x208bf1){_0x43de9d=_0x43de9d-0x0;var _0x3212b9=_0x1f56[_0x43de9d];return _0x3212b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61f5('0x0'));var jsonpatch=require(_0x61f5('0x1'));var rp=require(_0x61f5('0x2'));var moment=require(_0x61f5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x61f5('0x4'));var csv=require(_0x61f5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61f5('0x6'));var _=require('lodash');var squel=require(_0x61f5('0x7'));var crypto=require(_0x61f5('0x8'));var jsforce=require(_0x61f5('0x9'));var deskjs=require(_0x61f5('0xa'));var toCsv=require(_0x61f5('0x5'));var querystring=require('querystring');var Papa=require(_0x61f5('0xb'));var Redis=require('ioredis');var authService=require(_0x61f5('0xc'));var qs=require(_0x61f5('0xd'));var as=require(_0x61f5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61f5('0xf'))(_0x61f5('0x10'));var utils=require(_0x61f5('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x61f5('0x12'));var db=require(_0x61f5('0x13'))['db'];var integrations=require(_0x61f5('0x14'));function respondWithStatusCode(_0x2d6c1c,_0x36477f){_0x36477f=_0x36477f||0xcc;return function(_0x58e812){if(_0x58e812){return _0x2d6c1c[_0x61f5('0x15')](_0x36477f);}return _0x2d6c1c[_0x61f5('0x16')](_0x36477f)[_0x61f5('0x17')]();};}function respondWithResult(_0x796c6f,_0x2d7d48){_0x2d7d48=_0x2d7d48||0xc8;return function(_0x247285){if(_0x247285){return _0x796c6f[_0x61f5('0x16')](_0x2d7d48)[_0x61f5('0x18')](_0x247285);}};}function respondWithFilteredResult(_0xc0c6e4,_0x183fba){return function(_0x41f64c){if(_0x41f64c){var _0x599541=typeof _0x183fba[_0x61f5('0x19')]===_0x61f5('0x1a')&&typeof _0x183fba[_0x61f5('0x1b')]===_0x61f5('0x1a');var _0x355c47=_0x41f64c[_0x61f5('0x1c')];var _0x428e4b=_0x599541?0x0:_0x183fba[_0x61f5('0x19')];var _0x1c2d12=_0x599541?_0x41f64c[_0x61f5('0x1c')]:_0x183fba[_0x61f5('0x19')]+_0x183fba[_0x61f5('0x1b')];var _0x339596;if(_0x1c2d12>=_0x355c47){_0x1c2d12=_0x355c47;_0x339596=0xc8;}else{_0x339596=0xce;}_0xc0c6e4['status'](_0x339596);return _0xc0c6e4['set']('Content-Range',_0x428e4b+'-'+_0x1c2d12+'/'+_0x355c47)[_0x61f5('0x18')](_0x41f64c);}return null;};}function patchUpdates(_0x31def3){return function(_0x27735c){try{jsonpatch[_0x61f5('0x1d')](_0x27735c,_0x31def3,!![]);}catch(_0x156e24){return BPromise['reject'](_0x156e24);}return _0x27735c[_0x61f5('0x1e')]();};}function saveUpdates(_0x2f60d7,_0x3548fd){return function(_0x3dad99){if(_0x3dad99){return _0x3dad99['update'](_0x2f60d7)[_0x61f5('0x1f')](function(_0x52217c){return _0x52217c;});}return null;};}function removeEntity(_0x5b6f52,_0x416cc6){return function(_0xdf2338){if(_0xdf2338){return _0xdf2338[_0x61f5('0x20')]()[_0x61f5('0x1f')](function(){_0x5b6f52[_0x61f5('0x16')](0xcc)[_0x61f5('0x17')]();});}};}function handleEntityNotFound(_0x6431ea,_0x28e403){return function(_0x591527){if(!_0x591527){_0x6431ea[_0x61f5('0x15')](0x194);}return _0x591527;};}function handleError(_0x1e5455,_0x7ab42a){_0x7ab42a=_0x7ab42a||0x1f4;return function(_0x54dcec){logger[_0x61f5('0x21')](_0x54dcec[_0x61f5('0x22')]);if(_0x54dcec[_0x61f5('0x23')]){delete _0x54dcec[_0x61f5('0x23')];}_0x1e5455['status'](_0x7ab42a)[_0x61f5('0x24')](_0x54dcec);};}exports[_0x61f5('0x25')]=function(_0x4c20ea,_0x2cd341){var _0x5445d1={},_0x367083={},_0x5aeb39={'count':0x0,'rows':[]};var _0x124c2d=_[_0x61f5('0x26')](db['DeskAccount'][_0x61f5('0x27')],function(_0x1f00e9){return{'name':_0x1f00e9[_0x61f5('0x28')],'type':_0x1f00e9['type']['key']};});_0x367083[_0x61f5('0x29')]=_[_0x61f5('0x26')](_0x124c2d,'name');_0x367083[_0x61f5('0x2a')]=_[_0x61f5('0x2b')](_0x4c20ea['query']);_0x367083[_0x61f5('0x2c')]=_[_0x61f5('0x2d')](_0x367083[_0x61f5('0x29')],_0x367083[_0x61f5('0x2a')]);_0x5445d1[_0x61f5('0x2e')]=_['intersection'](_0x367083['model'],qs['fields'](_0x4c20ea['query']['fields']));_0x5445d1[_0x61f5('0x2e')]=_0x5445d1['attributes']['length']?_0x5445d1[_0x61f5('0x2e')]:_0x367083[_0x61f5('0x29')];if(!_0x4c20ea[_0x61f5('0x2a')][_0x61f5('0x2f')](_0x61f5('0x30'))){_0x5445d1[_0x61f5('0x1b')]=qs[_0x61f5('0x1b')](_0x4c20ea['query'][_0x61f5('0x1b')]);_0x5445d1[_0x61f5('0x19')]=qs['offset'](_0x4c20ea[_0x61f5('0x2a')][_0x61f5('0x19')]);}_0x5445d1[_0x61f5('0x31')]=qs[_0x61f5('0x32')](_0x4c20ea[_0x61f5('0x2a')][_0x61f5('0x32')]);_0x5445d1[_0x61f5('0x33')]=qs[_0x61f5('0x2c')](_[_0x61f5('0x34')](_0x4c20ea[_0x61f5('0x2a')],_0x367083[_0x61f5('0x2c')]),_0x124c2d);if(_0x4c20ea['query'][_0x61f5('0x35')]){_0x5445d1[_0x61f5('0x33')]=_[_0x61f5('0x36')](_0x5445d1['where'],{'$or':_[_0x61f5('0x26')](_0x124c2d,function(_0x4b634e){if(_0x4b634e[_0x61f5('0x37')]!==_0x61f5('0x38')){var _0x4889c8={};_0x4889c8[_0x4b634e[_0x61f5('0x23')]]={'$like':'%'+_0x4c20ea[_0x61f5('0x2a')]['filter']+'%'};return _0x4889c8;}})});}_0x5445d1=_[_0x61f5('0x36')]({},_0x5445d1,_0x4c20ea[_0x61f5('0x39')]);var _0x32a8c1={'where':_0x5445d1[_0x61f5('0x33')]};return db[_0x61f5('0x3a')][_0x61f5('0x1c')](_0x32a8c1)[_0x61f5('0x1f')](function(_0x350499){_0x5aeb39[_0x61f5('0x1c')]=_0x350499;if(_0x4c20ea['query'][_0x61f5('0x3b')]){_0x5445d1[_0x61f5('0x3c')]=[{'all':!![]}];}return db[_0x61f5('0x3a')]['findAll'](_0x5445d1);})[_0x61f5('0x1f')](function(_0x3a9638){_0x5aeb39[_0x61f5('0x3d')]=_0x3a9638;return _0x5aeb39;})['then'](respondWithFilteredResult(_0x2cd341,_0x5445d1))[_0x61f5('0x3e')](handleError(_0x2cd341,null));};exports[_0x61f5('0x3f')]=function(_0x377577,_0xbe9fa3){var _0x5f48ea={'raw':![],'where':{'id':_0x377577[_0x61f5('0x40')]['id']}},_0x39cf34={};_0x39cf34[_0x61f5('0x29')]=_[_0x61f5('0x2b')](db['DeskAccount'][_0x61f5('0x27')]);_0x39cf34[_0x61f5('0x2a')]=_[_0x61f5('0x2b')](_0x377577[_0x61f5('0x2a')]);_0x39cf34[_0x61f5('0x2c')]=_[_0x61f5('0x2d')](_0x39cf34[_0x61f5('0x29')],_0x39cf34[_0x61f5('0x2a')]);_0x5f48ea[_0x61f5('0x2e')]=_[_0x61f5('0x2d')](_0x39cf34[_0x61f5('0x29')],qs[_0x61f5('0x41')](_0x377577[_0x61f5('0x2a')][_0x61f5('0x41')]));_0x5f48ea[_0x61f5('0x2e')]=_0x5f48ea['attributes'][_0x61f5('0x42')]?_0x5f48ea[_0x61f5('0x2e')]:_0x39cf34[_0x61f5('0x29')];if(_0x377577[_0x61f5('0x2a')][_0x61f5('0x3b')]){_0x5f48ea[_0x61f5('0x3c')]=[{'all':!![]}];}_0x5f48ea=_[_0x61f5('0x36')]({},_0x5f48ea,_0x377577[_0x61f5('0x39')]);return db['DeskAccount'][_0x61f5('0x43')](_0x5f48ea)[_0x61f5('0x1f')](handleEntityNotFound(_0xbe9fa3,null))[_0x61f5('0x1f')](respondWithResult(_0xbe9fa3,null))['catch'](handleError(_0xbe9fa3,null));};exports[_0x61f5('0x44')]=function(_0x2e7d20,_0x12eae2){return db[_0x61f5('0x3a')][_0x61f5('0x44')](_0x2e7d20['body'],{})[_0x61f5('0x1f')](respondWithResult(_0x12eae2,0xc9))[_0x61f5('0x3e')](handleError(_0x12eae2,null));};exports[_0x61f5('0x45')]=function(_0x38b73b,_0x1217fc){if(_0x38b73b['body']['id']){delete _0x38b73b['body']['id'];}return db[_0x61f5('0x3a')]['find']({'where':{'id':_0x38b73b[_0x61f5('0x40')]['id']}})[_0x61f5('0x1f')](handleEntityNotFound(_0x1217fc,null))[_0x61f5('0x1f')](saveUpdates(_0x38b73b[_0x61f5('0x46')],null))[_0x61f5('0x1f')](respondWithResult(_0x1217fc,null))[_0x61f5('0x3e')](handleError(_0x1217fc,null));};exports[_0x61f5('0x20')]=function(_0x2b9e53,_0x20d506){return db[_0x61f5('0x3a')][_0x61f5('0x43')]({'where':{'id':_0x2b9e53[_0x61f5('0x40')]['id']}})[_0x61f5('0x1f')](handleEntityNotFound(_0x20d506,null))[_0x61f5('0x1f')](removeEntity(_0x20d506,null))[_0x61f5('0x3e')](handleError(_0x20d506,null));};exports[_0x61f5('0x47')]=function(_0x14d3f8,_0xb188d8,_0x3d9113){var _0x1bb553={};var _0x1fb7b5={};var _0x404d1f;var _0x155cef;return db[_0x61f5('0x3a')][_0x61f5('0x48')]({'where':{'id':_0x14d3f8[_0x61f5('0x40')]['id']}})['then'](handleEntityNotFound(_0xb188d8,null))['then'](function(_0x902f9b){if(_0x902f9b){_0x404d1f=_0x902f9b;_0x1fb7b5['model']=_[_0x61f5('0x2b')](db[_0x61f5('0x49')]['rawAttributes']);_0x1fb7b5[_0x61f5('0x2a')]=_['keys'](_0x14d3f8[_0x61f5('0x2a')]);_0x1fb7b5[_0x61f5('0x2c')]=_['intersection'](_0x1fb7b5['model'],_0x1fb7b5[_0x61f5('0x2a')]);_0x1bb553[_0x61f5('0x2e')]=_[_0x61f5('0x2d')](_0x1fb7b5[_0x61f5('0x29')],qs['fields'](_0x14d3f8[_0x61f5('0x2a')][_0x61f5('0x41')]));_0x1bb553['attributes']=_0x1bb553[_0x61f5('0x2e')]['length']?_0x1bb553['attributes']:_0x1fb7b5['model'];_0x1bb553['order']=qs[_0x61f5('0x32')](_0x14d3f8['query'][_0x61f5('0x32')]);_0x1bb553['where']=qs['filters'](_[_0x61f5('0x34')](_0x14d3f8['query'],_0x1fb7b5['filters']));if(_0x14d3f8[_0x61f5('0x2a')][_0x61f5('0x35')]){_0x1bb553['where']=_['merge'](_0x1bb553[_0x61f5('0x33')],{'$or':_[_0x61f5('0x26')](_0x1bb553[_0x61f5('0x2e')],function(_0x3105d4){var _0x1568c3={};_0x1568c3[_0x3105d4]={'$like':'%'+_0x14d3f8[_0x61f5('0x2a')]['filter']+'%'};return _0x1568c3;})});}_0x1bb553=_[_0x61f5('0x36')]({},_0x1bb553,_0x14d3f8[_0x61f5('0x39')]);return _0x404d1f[_0x61f5('0x47')](_0x1bb553);}})[_0x61f5('0x1f')](function(_0x50fa89){if(_0x50fa89){_0x155cef=_0x50fa89[_0x61f5('0x42')];if(!_0x14d3f8['query']['hasOwnProperty']('nolimit')){_0x1bb553[_0x61f5('0x1b')]=qs[_0x61f5('0x1b')](_0x14d3f8[_0x61f5('0x2a')]['limit']);_0x1bb553['offset']=qs[_0x61f5('0x19')](_0x14d3f8[_0x61f5('0x2a')]['offset']);}return _0x404d1f['getConfigurations'](_0x1bb553);}})[_0x61f5('0x1f')](function(_0x1685e1){if(_0x1685e1){return _0x1685e1?{'count':_0x155cef,'rows':_0x1685e1}:null;}})[_0x61f5('0x1f')](respondWithResult(_0xb188d8,null))['catch'](handleError(_0xb188d8,null));};exports[_0x61f5('0x4a')]=function(_0x4dfa70,_0x2058e2,_0x1973fc){if(_0x4dfa70[_0x61f5('0x46')]['id']){delete _0x4dfa70[_0x61f5('0x46')]['id'];}return db[_0x61f5('0x3a')]['findOne']({'where':{'id':_0x4dfa70[_0x61f5('0x40')]['id']}})[_0x61f5('0x1f')](handleEntityNotFound(_0x2058e2,null))[_0x61f5('0x1f')](function(_0x255e91){if(_0x255e91){_0x4dfa70[_0x61f5('0x46')]['AccountId']=_0x255e91['id'];_0x4dfa70['body'][_0x61f5('0x4b')]=integrations[_0x61f5('0x4c')](_0x4dfa70['body'][_0x61f5('0x4d')],_0x4dfa70[_0x61f5('0x46')][_0x61f5('0x37')]);_0x4dfa70['body']['Descriptions']=integrations[_0x61f5('0x4e')](_0x4dfa70[_0x61f5('0x46')][_0x61f5('0x4d')],_0x4dfa70['body']['type']);return db[_0x61f5('0x49')][_0x61f5('0x44')](_0x4dfa70['body'],{'include':[{'model':db[_0x61f5('0x4f')],'as':'Subjects'},{'model':db[_0x61f5('0x4f')],'as':_0x61f5('0x50')}]});}return null;})[_0x61f5('0x1f')](respondWithResult(_0x2058e2,null))[_0x61f5('0x3e')](handleError(_0x2058e2,null));};exports['getFields']=function(_0x5e79a4,_0x490606,_0x45a1f0){var _0x50563c=[{'name':'priority','label':_0x61f5('0x51'),'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 _0x4fb746='';return db[_0x61f5('0x3a')][_0x61f5('0x48')]({'where':{'id':_0x5e79a4[_0x61f5('0x40')]['id']},'attributes':['id','remoteUri','authType',_0x61f5('0x52'),_0x61f5('0x53'),_0x61f5('0x54'),_0x61f5('0x55'),_0x61f5('0x56'),_0x61f5('0x57')]})[_0x61f5('0x1f')](handleEntityNotFound(_0x490606,null))[_0x61f5('0x1f')](function(_0x32fc4b){if(_0x32fc4b){_0x4fb746=_0x32fc4b[_0x61f5('0x58')];var _0x154fe7=_0x4fb746[_0x61f5('0x59')](-0x1);if(_0x154fe7==='/'){_0x4fb746=_0x4fb746['substring'](0x0,_0x4fb746[_0x61f5('0x5a')](_0x154fe7));}var _0x1c405d={'method':_0x61f5('0x5b'),'uri':util[_0x61f5('0x5c')]('%s/custom_fields',_0x4fb746),'headers':{'Content-Type':_0x61f5('0x5d'),'Accept':_0x61f5('0x5d')},'json':!![]};if(_0x32fc4b[_0x61f5('0x5e')]===_0x61f5('0x5f')){_0x1c405d[_0x61f5('0x60')]['Authorization']=util[_0x61f5('0x5c')]('Basic\x20%s',new Buffer(util[_0x61f5('0x5c')](_0x61f5('0x61'),_0x32fc4b[_0x61f5('0x52')],_0x32fc4b['password']))[_0x61f5('0x62')](_0x61f5('0x63')));}return rp(_0x1c405d)['then'](function(_0xd61944){return _0x50563c['concat'](_[_0x61f5('0x26')](_0xd61944[_0x61f5('0x64')][_0x61f5('0x65')],function(_0xfb710d){return{'id':_0xfb710d[_0x61f5('0x23')],'name':_0xfb710d['name'],'type':_0xfb710d[_0x61f5('0x37')],'active':_0xfb710d[_0x61f5('0x66')],'label':_0xfb710d[_0x61f5('0x67')],'custom':!![]};}));});}})[_0x61f5('0x1f')](function(_0x3d9a52){return{'count':_0x3d9a52[_0x61f5('0x42')],'rows':_0x3d9a52};})[_0x61f5('0x1f')](respondWithResult(_0x490606,null))[_0x61f5('0x3e')](function(_0x33e48b){var _0x17cfd0=_0x5e79a4[_0x61f5('0x2a')][_0x61f5('0x68')]?0x1f4:_0x33e48b[_0x61f5('0x69')]||0x1f4;logger[_0x61f5('0x21')](_0x61f5('0x6a'),_0x61f5('0x6b'),_0x17cfd0,JSON[_0x61f5('0x6c')](_0x33e48b));delete _0x33e48b[_0x61f5('0x23')];if(_0x17cfd0===0x191){_0x17cfd0=0x190;}_0x490606['status'](_0x17cfd0)[_0x61f5('0x24')](_0x5e79a4[_0x61f5('0x2a')][_0x61f5('0x68')]?{'message':_0x61f5('0x6d'),'statusCode':_0x33e48b[_0x61f5('0x69')]}:_0x33e48b);});}; \ No newline at end of file +var _0xc65b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','DeskAccount','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','create','body','find','findOne','order','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','authType','username','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x173738,_0x1bb545){var _0x1bbf5e=function(_0x4e8e68){while(--_0x4e8e68){_0x173738['push'](_0x173738['shift']());}};_0x1bbf5e(++_0x1bb545);}(_0xc65b,0xd8));var _0xbc65=function(_0xe7dfa7,_0x3d17ee){_0xe7dfa7=_0xe7dfa7-0x0;var _0x1a9fbf=_0xc65b[_0xe7dfa7];return _0x1a9fbf;};'use strict';var emlformat=require(_0xbc65('0x0'));var rimraf=require(_0xbc65('0x1'));var zipdir=require(_0xbc65('0x2'));var jsonpatch=require(_0xbc65('0x3'));var rp=require(_0xbc65('0x4'));var moment=require(_0xbc65('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbc65('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbc65('0x7'));var csv=require(_0xbc65('0x8'));var ejs=require(_0xbc65('0x9'));var fs=require('fs');var fs_extra=require(_0xbc65('0xa'));var _=require(_0xbc65('0xb'));var squel=require(_0xbc65('0xc'));var crypto=require('crypto');var jsforce=require(_0xbc65('0xd'));var deskjs=require(_0xbc65('0xe'));var toCsv=require(_0xbc65('0x8'));var querystring=require(_0xbc65('0xf'));var Papa=require(_0xbc65('0x10'));var Redis=require(_0xbc65('0x11'));var authService=require(_0xbc65('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbc65('0x13'));var hardwareService=require(_0xbc65('0x14'));var logger=require(_0xbc65('0x15'))(_0xbc65('0x16'));var utils=require(_0xbc65('0x17'));var config=require(_0xbc65('0x18'));var licenseUtil=require(_0xbc65('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbc65('0x1a'));function respondWithStatusCode(_0x410199,_0x5b9426){_0x5b9426=_0x5b9426||0xcc;return function(_0x1a6d11){if(_0x1a6d11){return _0x410199[_0xbc65('0x1b')](_0x5b9426);}return _0x410199['status'](_0x5b9426)[_0xbc65('0x1c')]();};}function respondWithResult(_0x137449,_0x3126b1){_0x3126b1=_0x3126b1||0xc8;return function(_0x45c4fa){if(_0x45c4fa){return _0x137449[_0xbc65('0x1d')](_0x3126b1)['json'](_0x45c4fa);}};}function respondWithFilteredResult(_0x5139a1,_0x28e956){return function(_0x2b5fb9){if(_0x2b5fb9){var _0x2621ed=typeof _0x28e956['offset']===_0xbc65('0x1e')&&typeof _0x28e956[_0xbc65('0x1f')]===_0xbc65('0x1e');var _0x3b4f93=_0x2b5fb9[_0xbc65('0x20')];var _0x13cde2=_0x2621ed?0x0:_0x28e956[_0xbc65('0x21')];var _0x1df33d=_0x2621ed?_0x2b5fb9[_0xbc65('0x20')]:_0x28e956[_0xbc65('0x21')]+_0x28e956['limit'];var _0x53d436;if(_0x1df33d>=_0x3b4f93){_0x1df33d=_0x3b4f93;_0x53d436=0xc8;}else{_0x53d436=0xce;}_0x5139a1[_0xbc65('0x1d')](_0x53d436);return _0x5139a1[_0xbc65('0x22')](_0xbc65('0x23'),_0x13cde2+'-'+_0x1df33d+'/'+_0x3b4f93)['json'](_0x2b5fb9);}return null;};}function patchUpdates(_0x509da9){return function(_0xcf9fdd){try{jsonpatch[_0xbc65('0x24')](_0xcf9fdd,_0x509da9,!![]);}catch(_0x14f8e8){return BPromise['reject'](_0x14f8e8);}return _0xcf9fdd[_0xbc65('0x25')]();};}function saveUpdates(_0x3c2e3d,_0xa488ec){return function(_0x35460c){if(_0x35460c){return _0x35460c[_0xbc65('0x26')](_0x3c2e3d)[_0xbc65('0x27')](function(_0x2b7701){return _0x2b7701;});}return null;};}function removeEntity(_0x74972c,_0x203d3c){return function(_0x7c8313){if(_0x7c8313){return _0x7c8313[_0xbc65('0x28')]()[_0xbc65('0x27')](function(){_0x74972c[_0xbc65('0x1d')](0xcc)[_0xbc65('0x1c')]();});}};}function handleEntityNotFound(_0x40602e,_0x3e8f0a){return function(_0x5400fb){if(!_0x5400fb){_0x40602e['sendStatus'](0x194);}return _0x5400fb;};}function handleError(_0x3a5c57,_0x2905cf){_0x2905cf=_0x2905cf||0x1f4;return function(_0x5bf639){logger['error'](_0x5bf639[_0xbc65('0x29')]);if(_0x5bf639[_0xbc65('0x2a')]){delete _0x5bf639['name'];}_0x3a5c57[_0xbc65('0x1d')](_0x2905cf)['send'](_0x5bf639);};}exports[_0xbc65('0x2b')]=function(_0x5ceb38,_0x3809d3){var _0xa3ce07={},_0x55d413={},_0x49c14b={'count':0x0,'rows':[]};var _0x4384f3=_[_0xbc65('0x2c')](db[_0xbc65('0x2d')][_0xbc65('0x2e')],function(_0x202a83){return{'name':_0x202a83['fieldName'],'type':_0x202a83['type']['key']};});_0x55d413[_0xbc65('0x2f')]=_[_0xbc65('0x2c')](_0x4384f3,_0xbc65('0x2a'));_0x55d413[_0xbc65('0x30')]=_[_0xbc65('0x31')](_0x5ceb38[_0xbc65('0x30')]);_0x55d413[_0xbc65('0x32')]=_['intersection'](_0x55d413[_0xbc65('0x2f')],_0x55d413[_0xbc65('0x30')]);_0xa3ce07[_0xbc65('0x33')]=_['intersection'](_0x55d413[_0xbc65('0x2f')],qs[_0xbc65('0x34')](_0x5ceb38[_0xbc65('0x30')][_0xbc65('0x34')]));_0xa3ce07[_0xbc65('0x33')]=_0xa3ce07['attributes'][_0xbc65('0x35')]?_0xa3ce07[_0xbc65('0x33')]:_0x55d413[_0xbc65('0x2f')];if(!_0x5ceb38['query'][_0xbc65('0x36')](_0xbc65('0x37'))){_0xa3ce07[_0xbc65('0x1f')]=qs[_0xbc65('0x1f')](_0x5ceb38[_0xbc65('0x30')][_0xbc65('0x1f')]);_0xa3ce07[_0xbc65('0x21')]=qs[_0xbc65('0x21')](_0x5ceb38[_0xbc65('0x30')][_0xbc65('0x21')]);}_0xa3ce07['order']=qs['sort'](_0x5ceb38[_0xbc65('0x30')][_0xbc65('0x38')]);_0xa3ce07['where']=qs[_0xbc65('0x32')](_[_0xbc65('0x39')](_0x5ceb38[_0xbc65('0x30')],_0x55d413['filters']),_0x4384f3);if(_0x5ceb38[_0xbc65('0x30')]['filter']){_0xa3ce07[_0xbc65('0x3a')]=_['merge'](_0xa3ce07['where'],{'$or':_[_0xbc65('0x2c')](_0x4384f3,function(_0x4a7927){if(_0x4a7927[_0xbc65('0x3b')]!==_0xbc65('0x3c')){var _0xb6ab87={};_0xb6ab87[_0x4a7927[_0xbc65('0x2a')]]={'$like':'%'+_0x5ceb38[_0xbc65('0x30')]['filter']+'%'};return _0xb6ab87;}})});}_0xa3ce07=_[_0xbc65('0x3d')]({},_0xa3ce07,_0x5ceb38['options']);var _0x2aff35={'where':_0xa3ce07['where']};return db[_0xbc65('0x2d')][_0xbc65('0x20')](_0x2aff35)[_0xbc65('0x27')](function(_0x40d352){_0x49c14b[_0xbc65('0x20')]=_0x40d352;if(_0x5ceb38[_0xbc65('0x30')][_0xbc65('0x3e')]){_0xa3ce07[_0xbc65('0x3f')]=[{'all':!![]}];}return db[_0xbc65('0x2d')][_0xbc65('0x40')](_0xa3ce07);})[_0xbc65('0x27')](function(_0x36f7fd){_0x49c14b[_0xbc65('0x41')]=_0x36f7fd;return _0x49c14b;})['then'](respondWithFilteredResult(_0x3809d3,_0xa3ce07))[_0xbc65('0x42')](handleError(_0x3809d3,null));};exports[_0xbc65('0x43')]=function(_0x3abc86,_0x33ffa5){var _0x405227={'raw':![],'where':{'id':_0x3abc86[_0xbc65('0x44')]['id']}},_0x56d702={};_0x56d702['model']=_[_0xbc65('0x31')](db['DeskAccount'][_0xbc65('0x2e')]);_0x56d702[_0xbc65('0x30')]=_['keys'](_0x3abc86[_0xbc65('0x30')]);_0x56d702[_0xbc65('0x32')]=_[_0xbc65('0x45')](_0x56d702['model'],_0x56d702[_0xbc65('0x30')]);_0x405227['attributes']=_[_0xbc65('0x45')](_0x56d702[_0xbc65('0x2f')],qs[_0xbc65('0x34')](_0x3abc86[_0xbc65('0x30')]['fields']));_0x405227[_0xbc65('0x33')]=_0x405227[_0xbc65('0x33')]['length']?_0x405227[_0xbc65('0x33')]:_0x56d702[_0xbc65('0x2f')];if(_0x3abc86[_0xbc65('0x30')][_0xbc65('0x3e')]){_0x405227[_0xbc65('0x3f')]=[{'all':!![]}];}_0x405227=_[_0xbc65('0x3d')]({},_0x405227,_0x3abc86[_0xbc65('0x46')]);return db['DeskAccount']['find'](_0x405227)[_0xbc65('0x27')](handleEntityNotFound(_0x33ffa5,null))[_0xbc65('0x27')](respondWithResult(_0x33ffa5,null))[_0xbc65('0x42')](handleError(_0x33ffa5,null));};exports[_0xbc65('0x47')]=function(_0xe651d,_0x1e03c5){return db[_0xbc65('0x2d')][_0xbc65('0x47')](_0xe651d[_0xbc65('0x48')],{})['then'](respondWithResult(_0x1e03c5,0xc9))[_0xbc65('0x42')](handleError(_0x1e03c5,null));};exports[_0xbc65('0x26')]=function(_0x4b437f,_0x2140c7){if(_0x4b437f[_0xbc65('0x48')]['id']){delete _0x4b437f['body']['id'];}return db['DeskAccount'][_0xbc65('0x49')]({'where':{'id':_0x4b437f[_0xbc65('0x44')]['id']}})['then'](handleEntityNotFound(_0x2140c7,null))[_0xbc65('0x27')](saveUpdates(_0x4b437f[_0xbc65('0x48')],null))[_0xbc65('0x27')](respondWithResult(_0x2140c7,null))[_0xbc65('0x42')](handleError(_0x2140c7,null));};exports[_0xbc65('0x28')]=function(_0x4e0eb2,_0x58ed96){return db[_0xbc65('0x2d')][_0xbc65('0x49')]({'where':{'id':_0x4e0eb2[_0xbc65('0x44')]['id']}})[_0xbc65('0x27')](handleEntityNotFound(_0x58ed96,null))['then'](removeEntity(_0x58ed96,null))[_0xbc65('0x42')](handleError(_0x58ed96,null));};exports['getConfigurations']=function(_0x450b2e,_0x1b9309,_0x4d6e0a){var _0x385722={};var _0x39e2f0={};var _0x2e4040;var _0x16a53c;return db[_0xbc65('0x2d')][_0xbc65('0x4a')]({'where':{'id':_0x450b2e[_0xbc65('0x44')]['id']}})[_0xbc65('0x27')](handleEntityNotFound(_0x1b9309,null))[_0xbc65('0x27')](function(_0x2d9794){if(_0x2d9794){_0x2e4040=_0x2d9794;_0x39e2f0[_0xbc65('0x2f')]=_[_0xbc65('0x31')](db['DeskConfiguration']['rawAttributes']);_0x39e2f0['query']=_[_0xbc65('0x31')](_0x450b2e[_0xbc65('0x30')]);_0x39e2f0['filters']=_['intersection'](_0x39e2f0[_0xbc65('0x2f')],_0x39e2f0['query']);_0x385722[_0xbc65('0x33')]=_[_0xbc65('0x45')](_0x39e2f0[_0xbc65('0x2f')],qs[_0xbc65('0x34')](_0x450b2e[_0xbc65('0x30')][_0xbc65('0x34')]));_0x385722[_0xbc65('0x33')]=_0x385722[_0xbc65('0x33')][_0xbc65('0x35')]?_0x385722['attributes']:_0x39e2f0['model'];_0x385722[_0xbc65('0x4b')]=qs['sort'](_0x450b2e['query'][_0xbc65('0x38')]);_0x385722[_0xbc65('0x3a')]=qs[_0xbc65('0x32')](_['pick'](_0x450b2e[_0xbc65('0x30')],_0x39e2f0[_0xbc65('0x32')]));if(_0x450b2e[_0xbc65('0x30')][_0xbc65('0x4c')]){_0x385722['where']=_[_0xbc65('0x3d')](_0x385722[_0xbc65('0x3a')],{'$or':_[_0xbc65('0x2c')](_0x385722[_0xbc65('0x33')],function(_0x33b7b7){var _0x1f5349={};_0x1f5349[_0x33b7b7]={'$like':'%'+_0x450b2e[_0xbc65('0x30')][_0xbc65('0x4c')]+'%'};return _0x1f5349;})});}_0x385722=_['merge']({},_0x385722,_0x450b2e[_0xbc65('0x46')]);return _0x2e4040['getConfigurations'](_0x385722);}})[_0xbc65('0x27')](function(_0x7af164){if(_0x7af164){_0x16a53c=_0x7af164['length'];if(!_0x450b2e[_0xbc65('0x30')][_0xbc65('0x36')]('nolimit')){_0x385722[_0xbc65('0x1f')]=qs['limit'](_0x450b2e['query']['limit']);_0x385722[_0xbc65('0x21')]=qs[_0xbc65('0x21')](_0x450b2e['query'][_0xbc65('0x21')]);}return _0x2e4040['getConfigurations'](_0x385722);}})[_0xbc65('0x27')](function(_0x27aef4){if(_0x27aef4){return _0x27aef4?{'count':_0x16a53c,'rows':_0x27aef4}:null;}})['then'](respondWithResult(_0x1b9309,null))['catch'](handleError(_0x1b9309,null));};exports[_0xbc65('0x4d')]=function(_0x213033,_0x2a677d,_0x14d4cf){if(_0x213033['body']['id']){delete _0x213033[_0xbc65('0x48')]['id'];}return db[_0xbc65('0x2d')]['findOne']({'where':{'id':_0x213033[_0xbc65('0x44')]['id']}})[_0xbc65('0x27')](handleEntityNotFound(_0x2a677d,null))[_0xbc65('0x27')](function(_0x14be68){if(_0x14be68){_0x213033['body']['AccountId']=_0x14be68['id'];_0x213033['body'][_0xbc65('0x4e')]=integrations[_0xbc65('0x4f')](_0x213033[_0xbc65('0x48')][_0xbc65('0x50')],_0x213033[_0xbc65('0x48')][_0xbc65('0x3b')]);_0x213033[_0xbc65('0x48')][_0xbc65('0x51')]=integrations[_0xbc65('0x52')](_0x213033[_0xbc65('0x48')]['channel'],_0x213033[_0xbc65('0x48')][_0xbc65('0x3b')]);return db[_0xbc65('0x53')][_0xbc65('0x47')](_0x213033['body'],{'include':[{'model':db[_0xbc65('0x54')],'as':_0xbc65('0x4e')},{'model':db[_0xbc65('0x54')],'as':_0xbc65('0x51')}]});}return null;})['then'](respondWithResult(_0x2a677d,null))[_0xbc65('0x42')](handleError(_0x2a677d,null));};exports[_0xbc65('0x55')]=function(_0x19d34b,_0x32547b,_0x1fd13e){var _0x22d8bb=[{'name':_0xbc65('0x56'),'label':_0xbc65('0x56'),'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 _0x249b70='';return db['DeskAccount']['findOne']({'where':{'id':_0x19d34b[_0xbc65('0x44')]['id']},'attributes':['id','remoteUri',_0xbc65('0x57'),_0xbc65('0x58'),'password','consumerKey',_0xbc65('0x59'),_0xbc65('0x5a'),_0xbc65('0x5b')]})[_0xbc65('0x27')](handleEntityNotFound(_0x32547b,null))[_0xbc65('0x27')](function(_0x12ca4f){if(_0x12ca4f){_0x249b70=_0x12ca4f[_0xbc65('0x5c')];var _0x5659e6=_0x249b70[_0xbc65('0x5d')](-0x1);if(_0x5659e6==='/'){_0x249b70=_0x249b70['substring'](0x0,_0x249b70[_0xbc65('0x5e')](_0x5659e6));}var _0x172ec8={'method':'GET','uri':util['format'](_0xbc65('0x5f'),_0x249b70),'headers':{'Content-Type':_0xbc65('0x60'),'Accept':_0xbc65('0x60')},'json':!![]};if(_0x12ca4f[_0xbc65('0x57')]===_0xbc65('0x61')){_0x172ec8[_0xbc65('0x62')][_0xbc65('0x63')]=util[_0xbc65('0x64')](_0xbc65('0x65'),new Buffer(util[_0xbc65('0x64')](_0xbc65('0x66'),_0x12ca4f[_0xbc65('0x58')],_0x12ca4f[_0xbc65('0x67')]))[_0xbc65('0x68')](_0xbc65('0x69')));}return rp(_0x172ec8)['then'](function(_0x38e51c){return _0x22d8bb[_0xbc65('0x6a')](_[_0xbc65('0x2c')](_0x38e51c[_0xbc65('0x6b')][_0xbc65('0x6c')],function(_0x45296b){return{'id':_0x45296b['name'],'name':_0x45296b['name'],'type':_0x45296b[_0xbc65('0x3b')],'active':_0x45296b[_0xbc65('0x6d')],'label':_0x45296b[_0xbc65('0x6e')],'custom':!![]};}));});}})[_0xbc65('0x27')](function(_0x45fa65){return{'count':_0x45fa65[_0xbc65('0x35')],'rows':_0x45fa65};})[_0xbc65('0x27')](respondWithResult(_0x32547b,null))['catch'](function(_0x481e15){var _0x1a684a=_0x19d34b['query'][_0xbc65('0x6f')]?0x1f4:_0x481e15[_0xbc65('0x70')]||0x1f4;logger[_0xbc65('0x71')](_0xbc65('0x72'),_0xbc65('0x55'),_0x1a684a,JSON[_0xbc65('0x73')](_0x481e15));delete _0x481e15[_0xbc65('0x2a')];if(_0x1a684a===0x191){_0x1a684a=0x190;}_0x32547b[_0xbc65('0x1d')](_0x1a684a)['send'](_0x19d34b[_0xbc65('0x30')][_0xbc65('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x481e15[_0xbc65('0x70')]}:_0x481e15);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index afc5d81..bc57de3 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 _0x375c=['exports','define','DeskAccount','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x375c,0x92));var _0xc375=function(_0x813c33,_0x3f4957){_0x813c33=_0x813c33-0x0;var _0x1bca78=_0x375c[_0x813c33];return _0x1bca78;};'use strict';var _=require(_0xc375('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc375('0x1'));var moment=require('moment');var BPromise=require(_0xc375('0x2'));var rp=require(_0xc375('0x3'));var fs=require('fs');var path=require(_0xc375('0x4'));var rimraf=require(_0xc375('0x5'));var config=require(_0xc375('0x6'));var attributes=require(_0xc375('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc375('0x8')]=function(_0x499ba1,_0x4d5261){return _0x499ba1[_0xc375('0x9')](_0xc375('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c96=['exports','define','DeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x486ea7,_0x162998){var _0x4c0315=function(_0x66a8e7){while(--_0x66a8e7){_0x486ea7['push'](_0x486ea7['shift']());}};_0x4c0315(++_0x162998);}(_0x4c96,0x1f2));var _0x64c9=function(_0x3b4f09,_0x4e231f){_0x3b4f09=_0x3b4f09-0x0;var _0x1d52ff=_0x4c96[_0x3b4f09];return _0x1d52ff;};'use strict';var _=require(_0x64c9('0x0'));var util=require(_0x64c9('0x1'));var logger=require(_0x64c9('0x2'))(_0x64c9('0x3'));var moment=require(_0x64c9('0x4'));var BPromise=require(_0x64c9('0x5'));var rp=require(_0x64c9('0x6'));var fs=require('fs');var path=require(_0x64c9('0x7'));var rimraf=require(_0x64c9('0x8'));var config=require(_0x64c9('0x9'));var attributes=require(_0x64c9('0xa'));var integrations=require(_0x64c9('0xb'));module[_0x64c9('0xc')]=function(_0xcc9f41,_0x401b5d){return _0xcc9f41[_0x64c9('0xd')](_0x64c9('0xe'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3b5b4c5..42ba22a 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 _0xcaa5=['map','model','debug','GetDeskAccount','find','ShowDeskAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','message','DeskAccount,\x20%s,\x20%s','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x4bc9b3,_0x298862){var _0x19da83=function(_0x46efbb){while(--_0x46efbb){_0x4bc9b3['push'](_0x4bc9b3['shift']());}};_0x19da83(++_0x298862);}(_0xcaa5,0xcc));var _0x5caa=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0xcaa5[_0x7f3667];return _0x2c4c24;};'use strict';var _=require(_0x5caa('0x0'));var util=require(_0x5caa('0x1'));var moment=require(_0x5caa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5caa('0x3'));var db=require(_0x5caa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5caa('0x5'))(_0x5caa('0x6'));var config=require(_0x5caa('0x7'));var jayson=require(_0x5caa('0x8'));var client=jayson[_0x5caa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25326d,_0x3ce3cc,_0x370087){return new BPromise(function(_0xdc66b2,_0x511ef3){return client[_0x5caa('0xa')](_0x25326d,_0x370087)[_0x5caa('0xb')](function(_0xeb03aa){logger[_0x5caa('0xc')]('DeskAccount,\x20%s,\x20%s',_0x3ce3cc,_0x5caa('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3ce3cc,_0x5caa('0xd'),JSON[_0x5caa('0xe')](_0xeb03aa));if(_0xeb03aa[_0x5caa('0xf')]){if(_0xeb03aa['error']['code']===0x1f4){logger[_0x5caa('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3ce3cc,_0xeb03aa[_0x5caa('0xf')][_0x5caa('0x10')]);return _0x511ef3(_0xeb03aa[_0x5caa('0xf')][_0x5caa('0x10')]);}logger['error'](_0x5caa('0x11'),_0x3ce3cc,_0xeb03aa[_0x5caa('0xf')][_0x5caa('0x10')]);return _0xdc66b2(_0xeb03aa[_0x5caa('0xf')][_0x5caa('0x10')]);}else{logger[_0x5caa('0xc')](_0x5caa('0x11'),_0x3ce3cc,_0x5caa('0xd'));_0xdc66b2(_0xeb03aa['result'][_0x5caa('0x10')]);}})[_0x5caa('0x12')](function(_0x24d9ff){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3ce3cc,_0x24d9ff);_0x511ef3(_0x24d9ff);});});}exports['GetDeskAccount']=function(_0x1fd454){var _0x291db2=this;return new Promise(function(_0x3156e5,_0x12380b){return db[_0x5caa('0x13')][_0x5caa('0x14')]({'raw':_0x1fd454['options']?_0x1fd454[_0x5caa('0x15')][_0x5caa('0x16')]===undefined?!![]:![]:!![],'where':_0x1fd454['options']?_0x1fd454[_0x5caa('0x15')][_0x5caa('0x17')]||null:null,'attributes':_0x1fd454['options']?_0x1fd454['options'][_0x5caa('0x18')]||null:null,'limit':_0x1fd454[_0x5caa('0x15')]?_0x1fd454['options'][_0x5caa('0x19')]||null:null,'include':_0x1fd454[_0x5caa('0x15')]?_0x1fd454[_0x5caa('0x15')][_0x5caa('0x1a')]?_[_0x5caa('0x1b')](_0x1fd454[_0x5caa('0x15')][_0x5caa('0x1a')],function(_0x5a1bd9){return{'model':db[_0x5a1bd9[_0x5caa('0x1c')]],'as':_0x5a1bd9['as'],'attributes':_0x5a1bd9[_0x5caa('0x18')],'include':_0x5a1bd9[_0x5caa('0x1a')]?_['map'](_0x5a1bd9[_0x5caa('0x1a')],function(_0x3cfebd){return{'model':db[_0x3cfebd[_0x5caa('0x1c')]],'as':_0x3cfebd['as'],'attributes':_0x3cfebd['attributes'],'include':_0x3cfebd['include']?_[_0x5caa('0x1b')](_0x3cfebd[_0x5caa('0x1a')],function(_0x596606){return{'model':db[_0x596606[_0x5caa('0x1c')]],'as':_0x596606['as'],'attributes':_0x596606[_0x5caa('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c652){logger['info']('GetDeskAccount',_0x1fd454);logger[_0x5caa('0x1d')]('GetDeskAccount',_0x1fd454,JSON[_0x5caa('0xe')](_0x27c652));_0x3156e5(_0x27c652);})[_0x5caa('0x12')](function(_0x3304e3){logger[_0x5caa('0xf')](_0x5caa('0x1e'),_0x3304e3[_0x5caa('0x10')],_0x1fd454);_0x12380b(_0x291db2[_0x5caa('0xf')](0x1f4,_0x3304e3['message']));});});};exports['ShowDeskAccount']=function(_0x3be23b){var _0x58d707=this;return new Promise(function(_0x1e2dfc,_0x5e5e27){return db[_0x5caa('0x13')][_0x5caa('0x1f')]({'raw':_0x3be23b[_0x5caa('0x15')]?_0x3be23b[_0x5caa('0x15')][_0x5caa('0x16')]===undefined?!![]:![]:!![],'where':_0x3be23b[_0x5caa('0x15')]?_0x3be23b[_0x5caa('0x15')]['where']||null:null,'attributes':_0x3be23b[_0x5caa('0x15')]?_0x3be23b[_0x5caa('0x15')][_0x5caa('0x18')]||null:null,'include':_0x3be23b['options']?_0x3be23b[_0x5caa('0x15')]['include']?_[_0x5caa('0x1b')](_0x3be23b[_0x5caa('0x15')][_0x5caa('0x1a')],function(_0x5c4cf0){return{'model':db[_0x5c4cf0[_0x5caa('0x1c')]],'as':_0x5c4cf0['as'],'attributes':_0x5c4cf0['attributes'],'include':_0x5c4cf0['include']?_[_0x5caa('0x1b')](_0x5c4cf0[_0x5caa('0x1a')],function(_0x5ab2e5){return{'model':db[_0x5ab2e5[_0x5caa('0x1c')]],'as':_0x5ab2e5['as'],'attributes':_0x5ab2e5[_0x5caa('0x18')],'include':_0x5ab2e5[_0x5caa('0x1a')]?_[_0x5caa('0x1b')](_0x5ab2e5['include'],function(_0xe1ee20){return{'model':db[_0xe1ee20[_0x5caa('0x1c')]],'as':_0xe1ee20['as'],'attributes':_0xe1ee20[_0x5caa('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5caa('0xb')](function(_0x3579e7){logger['info'](_0x5caa('0x20'),_0x3be23b);logger['debug'](_0x5caa('0x20'),_0x3be23b,JSON[_0x5caa('0xe')](_0x3579e7));_0x1e2dfc(_0x3579e7);})[_0x5caa('0x12')](function(_0x41da3f){logger[_0x5caa('0xf')]('ShowDeskAccount',_0x41da3f['message'],_0x3be23b);_0x5e5e27(_0x58d707[_0x5caa('0xf')](0x1f4,_0x41da3f[_0x5caa('0x10')]));});});}; \ No newline at end of file +var _0x9f86=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','info','result','catch','GetDeskAccount','options','raw','where','limit','include','map','model','attributes','debug','ShowDeskAccount','DeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x1c7db9,_0x33be66){var _0x429b5c=function(_0x476f84){while(--_0x476f84){_0x1c7db9['push'](_0x1c7db9['shift']());}};_0x429b5c(++_0x33be66);}(_0x9f86,0x81));var _0x69f8=function(_0x5849ff,_0x535d62){_0x5849ff=_0x5849ff-0x0;var _0xde61a2=_0x9f86[_0x5849ff];return _0xde61a2;};'use strict';var _=require(_0x69f8('0x0'));var util=require(_0x69f8('0x1'));var moment=require(_0x69f8('0x2'));var BPromise=require(_0x69f8('0x3'));var rs=require(_0x69f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69f8('0x5'))['db'];var utils=require(_0x69f8('0x6'));var logger=require(_0x69f8('0x7'))(_0x69f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x69f8('0x9'));var client=jayson[_0x69f8('0xa')][_0x69f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0e37,_0x2b0f83,_0x4cd3b4){return new BPromise(function(_0x25cbdf,_0xe60ab1){return client[_0x69f8('0xc')](_0x2a0e37,_0x4cd3b4)[_0x69f8('0xd')](function(_0x222b54){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2b0f83,_0x69f8('0xe'));logger['debug'](_0x69f8('0xf'),_0x2b0f83,'request\x20sent',JSON[_0x69f8('0x10')](_0x222b54));if(_0x222b54['error']){if(_0x222b54[_0x69f8('0x11')]['code']===0x1f4){logger[_0x69f8('0x11')](_0x69f8('0x12'),_0x2b0f83,_0x222b54[_0x69f8('0x11')][_0x69f8('0x13')]);return _0xe60ab1(_0x222b54[_0x69f8('0x11')]['message']);}logger[_0x69f8('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2b0f83,_0x222b54[_0x69f8('0x11')][_0x69f8('0x13')]);return _0x25cbdf(_0x222b54[_0x69f8('0x11')]['message']);}else{logger[_0x69f8('0x14')](_0x69f8('0x12'),_0x2b0f83,_0x69f8('0xe'));_0x25cbdf(_0x222b54[_0x69f8('0x15')][_0x69f8('0x13')]);}})[_0x69f8('0x16')](function(_0x5d7fbb){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2b0f83,_0x5d7fbb);_0xe60ab1(_0x5d7fbb);});});}exports[_0x69f8('0x17')]=function(_0x401be4){var _0x49348b=this;return new Promise(function(_0x128f2a,_0x28b746){return db['DeskAccount']['findAll']({'raw':_0x401be4[_0x69f8('0x18')]?_0x401be4[_0x69f8('0x18')][_0x69f8('0x19')]===undefined?!![]:![]:!![],'where':_0x401be4[_0x69f8('0x18')]?_0x401be4[_0x69f8('0x18')][_0x69f8('0x1a')]||null:null,'attributes':_0x401be4['options']?_0x401be4[_0x69f8('0x18')]['attributes']||null:null,'limit':_0x401be4[_0x69f8('0x18')]?_0x401be4[_0x69f8('0x18')][_0x69f8('0x1b')]||null:null,'include':_0x401be4[_0x69f8('0x18')]?_0x401be4['options'][_0x69f8('0x1c')]?_[_0x69f8('0x1d')](_0x401be4[_0x69f8('0x18')]['include'],function(_0x186eca){return{'model':db[_0x186eca[_0x69f8('0x1e')]],'as':_0x186eca['as'],'attributes':_0x186eca[_0x69f8('0x1f')],'include':_0x186eca['include']?_[_0x69f8('0x1d')](_0x186eca['include'],function(_0x360935){return{'model':db[_0x360935[_0x69f8('0x1e')]],'as':_0x360935['as'],'attributes':_0x360935['attributes'],'include':_0x360935[_0x69f8('0x1c')]?_[_0x69f8('0x1d')](_0x360935['include'],function(_0x58987b){return{'model':db[_0x58987b[_0x69f8('0x1e')]],'as':_0x58987b['as'],'attributes':_0x58987b[_0x69f8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d1c31){logger[_0x69f8('0x14')]('GetDeskAccount',_0x401be4);logger[_0x69f8('0x20')](_0x69f8('0x17'),_0x401be4,JSON[_0x69f8('0x10')](_0x1d1c31));_0x128f2a(_0x1d1c31);})['catch'](function(_0x68f9b7){logger[_0x69f8('0x11')](_0x69f8('0x17'),_0x68f9b7[_0x69f8('0x13')],_0x401be4);_0x28b746(_0x49348b[_0x69f8('0x11')](0x1f4,_0x68f9b7[_0x69f8('0x13')]));});});};exports[_0x69f8('0x21')]=function(_0x384153){var _0x35a76e=this;return new Promise(function(_0x153449,_0x1b2ce2){return db[_0x69f8('0x22')][_0x69f8('0x23')]({'raw':_0x384153['options']?_0x384153[_0x69f8('0x18')][_0x69f8('0x19')]===undefined?!![]:![]:!![],'where':_0x384153[_0x69f8('0x18')]?_0x384153[_0x69f8('0x18')][_0x69f8('0x1a')]||null:null,'attributes':_0x384153[_0x69f8('0x18')]?_0x384153[_0x69f8('0x18')]['attributes']||null:null,'include':_0x384153[_0x69f8('0x18')]?_0x384153[_0x69f8('0x18')][_0x69f8('0x1c')]?_[_0x69f8('0x1d')](_0x384153[_0x69f8('0x18')][_0x69f8('0x1c')],function(_0x179676){return{'model':db[_0x179676['model']],'as':_0x179676['as'],'attributes':_0x179676[_0x69f8('0x1f')],'include':_0x179676[_0x69f8('0x1c')]?_[_0x69f8('0x1d')](_0x179676[_0x69f8('0x1c')],function(_0x15bd60){return{'model':db[_0x15bd60[_0x69f8('0x1e')]],'as':_0x15bd60['as'],'attributes':_0x15bd60['attributes'],'include':_0x15bd60['include']?_['map'](_0x15bd60[_0x69f8('0x1c')],function(_0x34ba48){return{'model':db[_0x34ba48[_0x69f8('0x1e')]],'as':_0x34ba48['as'],'attributes':_0x34ba48['attributes']};}):[]};}):[]};}):[]:[]})[_0x69f8('0xd')](function(_0x1d1372){logger[_0x69f8('0x14')](_0x69f8('0x21'),_0x384153);logger['debug'](_0x69f8('0x21'),_0x384153,JSON[_0x69f8('0x10')](_0x1d1372));_0x153449(_0x1d1372);})['catch'](function(_0x57e418){logger['error'](_0x69f8('0x21'),_0x57e418['message'],_0x384153);_0x1b2ce2(_0x35a76e[_0x69f8('0x11')](0x1f4,_0x57e418[_0x69f8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 84604a1..637aade 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x22342c,_0x218835){var _0xd3b434=function(_0x45b259){while(--_0x45b259){_0x22342c['push'](_0x22342c['shift']());}};_0xd3b434(++_0x218835);}(_0x55ca,0x126));var _0xa55c=function(_0x13c4f8,_0x433521){_0x13c4f8=_0x13c4f8-0x0;var _0x5a8f4b=_0x55ca[_0x13c4f8];return _0x5a8f4b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd7d30b,_0x556159){var _0x14271f=function(_0x9f61a6){while(--_0x9f61a6){_0xd7d30b['push'](_0xd7d30b['shift']());}};_0x14271f(++_0x556159);}(_0x008c,0x188));var _0xc008=function(_0x50b850,_0x797ed2){_0x50b850=_0x50b850-0x0;var _0x348619=_0x008c[_0x50b850];return _0x348619;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 15869ae..6546b33 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 _0x1e82=['exports','STRING','sequelize'];(function(_0x4a325a,_0x2c154c){var _0x2597a1=function(_0x437af3){while(--_0x437af3){_0x4a325a['push'](_0x4a325a['shift']());}};_0x2597a1(++_0x2c154c);}(_0x1e82,0x10d));var _0x21e8=function(_0x53d243,_0x576abf){_0x53d243=_0x53d243-0x0;var _0x28c6f6=_0x1e82[_0x53d243];return _0x28c6f6;};'use strict';var Sequelize=require(_0x21e8('0x0'));module[_0x21e8('0x1')]={'name':{'type':Sequelize[_0x21e8('0x2')]},'description':{'type':Sequelize[_0x21e8('0x2')]}}; \ No newline at end of file +var _0xb48c=['exports','STRING','sequelize'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0xb48c,0x10a));var _0xcb48=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb48c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xcb48('0x0'));module[_0xcb48('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb48('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 690b238..e34246d 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 _0xc577=['hasOwnProperty','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','DeskConfiguration','includeAll','include','findAll','rows','catch','show','keys','options','create','body','update','find','params','destroy','getFields','findOne'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xc577,0x1bb));var _0x7c57=function(_0x9c173a,_0x461c9c){_0x9c173a=_0x9c173a-0x0;var _0x88d611=_0xc577[_0x9c173a];return _0x88d611;};'use strict';var emlformat=require(_0x7c57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c57('0x1'));var jsonpatch=require(_0x7c57('0x2'));var rp=require(_0x7c57('0x3'));var moment=require(_0x7c57('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c57('0x5'));var path=require(_0x7c57('0x6'));var sox=require('sox');var csv=require(_0x7c57('0x7'));var ejs=require(_0x7c57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c57('0x9'));var squel=require(_0x7c57('0xa'));var crypto=require(_0x7c57('0xb'));var jsforce=require(_0x7c57('0xc'));var deskjs=require(_0x7c57('0xd'));var toCsv=require(_0x7c57('0x7'));var querystring=require(_0x7c57('0xe'));var Papa=require(_0x7c57('0xf'));var Redis=require(_0x7c57('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7c57('0x11'));var as=require(_0x7c57('0x12'));var hardwareService=require(_0x7c57('0x13'));var logger=require(_0x7c57('0x14'))(_0x7c57('0x15'));var utils=require('../../config/utils');var config=require(_0x7c57('0x16'));var licenseUtil=require(_0x7c57('0x17'));var db=require(_0x7c57('0x18'))['db'];function respondWithStatusCode(_0x2e3611,_0x574ffd){_0x574ffd=_0x574ffd||0xcc;return function(_0x2b905c){if(_0x2b905c){return _0x2e3611[_0x7c57('0x19')](_0x574ffd);}return _0x2e3611[_0x7c57('0x1a')](_0x574ffd)[_0x7c57('0x1b')]();};}function respondWithResult(_0x397ce5,_0x1c62f5){_0x1c62f5=_0x1c62f5||0xc8;return function(_0x5818e3){if(_0x5818e3){return _0x397ce5[_0x7c57('0x1a')](_0x1c62f5)[_0x7c57('0x1c')](_0x5818e3);}};}function respondWithFilteredResult(_0x56068d,_0x56bfb9){return function(_0x231b12){if(_0x231b12){var _0x47e3ba=typeof _0x56bfb9[_0x7c57('0x1d')]==='undefined'&&typeof _0x56bfb9[_0x7c57('0x1e')]===_0x7c57('0x1f');var _0x1c3cb6=_0x231b12[_0x7c57('0x20')];var _0x1c16da=_0x47e3ba?0x0:_0x56bfb9[_0x7c57('0x1d')];var _0x2ff345=_0x47e3ba?_0x231b12['count']:_0x56bfb9[_0x7c57('0x1d')]+_0x56bfb9['limit'];var _0x1903f5;if(_0x2ff345>=_0x1c3cb6){_0x2ff345=_0x1c3cb6;_0x1903f5=0xc8;}else{_0x1903f5=0xce;}_0x56068d[_0x7c57('0x1a')](_0x1903f5);return _0x56068d[_0x7c57('0x21')](_0x7c57('0x22'),_0x1c16da+'-'+_0x2ff345+'/'+_0x1c3cb6)[_0x7c57('0x1c')](_0x231b12);}return null;};}function patchUpdates(_0x39297d){return function(_0x5f33df){try{jsonpatch[_0x7c57('0x23')](_0x5f33df,_0x39297d,!![]);}catch(_0x1f1dd1){return BPromise[_0x7c57('0x24')](_0x1f1dd1);}return _0x5f33df[_0x7c57('0x25')]();};}function saveUpdates(_0x544eb6,_0x2a7dc6){return function(_0x58064c){if(_0x58064c){return _0x58064c['update'](_0x544eb6)[_0x7c57('0x26')](function(_0x13f350){return _0x13f350;});}return null;};}function removeEntity(_0x1c7d9d,_0x83a1a){return function(_0x5860dd){if(_0x5860dd){return _0x5860dd['destroy']()[_0x7c57('0x26')](function(){_0x1c7d9d[_0x7c57('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc550,_0x4ee9eb){return function(_0x1bd2be){if(!_0x1bd2be){_0x5cc550[_0x7c57('0x19')](0x194);}return _0x1bd2be;};}function handleError(_0x4faba0,_0x3bfe1a){_0x3bfe1a=_0x3bfe1a||0x1f4;return function(_0xb73917){logger['error'](_0xb73917[_0x7c57('0x27')]);if(_0xb73917[_0x7c57('0x28')]){delete _0xb73917[_0x7c57('0x28')];}_0x4faba0[_0x7c57('0x1a')](_0x3bfe1a)[_0x7c57('0x29')](_0xb73917);};}exports[_0x7c57('0x2a')]=function(_0x1a3b8a,_0x1be4b3){var _0xe6ad8f={},_0x4f4ddd={},_0x3e4d74={'count':0x0,'rows':[]};var _0x133b27=_[_0x7c57('0x2b')](db['DeskConfiguration'][_0x7c57('0x2c')],function(_0x1e4980){return{'name':_0x1e4980[_0x7c57('0x2d')],'type':_0x1e4980[_0x7c57('0x2e')]['key']};});_0x4f4ddd['model']=_[_0x7c57('0x2b')](_0x133b27,_0x7c57('0x28'));_0x4f4ddd[_0x7c57('0x2f')]=_['keys'](_0x1a3b8a['query']);_0x4f4ddd[_0x7c57('0x30')]=_[_0x7c57('0x31')](_0x4f4ddd[_0x7c57('0x32')],_0x4f4ddd['query']);_0xe6ad8f[_0x7c57('0x33')]=_[_0x7c57('0x31')](_0x4f4ddd[_0x7c57('0x32')],qs[_0x7c57('0x34')](_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x34')]));_0xe6ad8f[_0x7c57('0x33')]=_0xe6ad8f[_0x7c57('0x33')][_0x7c57('0x35')]?_0xe6ad8f[_0x7c57('0x33')]:_0x4f4ddd['model'];if(!_0x1a3b8a['query']['hasOwnProperty'](_0x7c57('0x36'))){_0xe6ad8f['limit']=qs[_0x7c57('0x1e')](_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x1e')]);_0xe6ad8f['offset']=qs[_0x7c57('0x1d')](_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x1d')]);}_0xe6ad8f[_0x7c57('0x37')]=qs['sort'](_0x1a3b8a['query'][_0x7c57('0x38')]);_0xe6ad8f['where']=qs[_0x7c57('0x30')](_[_0x7c57('0x39')](_0x1a3b8a[_0x7c57('0x2f')],_0x4f4ddd[_0x7c57('0x30')]),_0x133b27);if(_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x3a')]){_0xe6ad8f['where']=_[_0x7c57('0x3b')](_0xe6ad8f['where'],{'$or':_[_0x7c57('0x2b')](_0x133b27,function(_0x5a9d10){if(_0x5a9d10[_0x7c57('0x2e')]!==_0x7c57('0x3c')){var _0x2b7d66={};_0x2b7d66[_0x5a9d10['name']]={'$like':'%'+_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x3a')]+'%'};return _0x2b7d66;}})});}_0xe6ad8f=_[_0x7c57('0x3b')]({},_0xe6ad8f,_0x1a3b8a['options']);var _0x2373a4={'where':_0xe6ad8f[_0x7c57('0x3d')]};return db[_0x7c57('0x3e')]['count'](_0x2373a4)[_0x7c57('0x26')](function(_0x1aed0){_0x3e4d74['count']=_0x1aed0;if(_0x1a3b8a[_0x7c57('0x2f')][_0x7c57('0x3f')]){_0xe6ad8f[_0x7c57('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7c57('0x41')](_0xe6ad8f);})[_0x7c57('0x26')](function(_0xf5cf72){_0x3e4d74[_0x7c57('0x42')]=_0xf5cf72;return _0x3e4d74;})[_0x7c57('0x26')](respondWithFilteredResult(_0x1be4b3,_0xe6ad8f))[_0x7c57('0x43')](handleError(_0x1be4b3,null));};exports[_0x7c57('0x44')]=function(_0x203f9f,_0x416e6a){var _0x41c564={'raw':![],'where':{'id':_0x203f9f['params']['id']}},_0x47e6cb={};_0x47e6cb['model']=_['keys'](db[_0x7c57('0x3e')][_0x7c57('0x2c')]);_0x47e6cb['query']=_[_0x7c57('0x45')](_0x203f9f[_0x7c57('0x2f')]);_0x47e6cb[_0x7c57('0x30')]=_['intersection'](_0x47e6cb[_0x7c57('0x32')],_0x47e6cb['query']);_0x41c564[_0x7c57('0x33')]=_[_0x7c57('0x31')](_0x47e6cb['model'],qs[_0x7c57('0x34')](_0x203f9f[_0x7c57('0x2f')][_0x7c57('0x34')]));_0x41c564[_0x7c57('0x33')]=_0x41c564[_0x7c57('0x33')][_0x7c57('0x35')]?_0x41c564[_0x7c57('0x33')]:_0x47e6cb[_0x7c57('0x32')];if(_0x203f9f[_0x7c57('0x2f')][_0x7c57('0x3f')]){_0x41c564[_0x7c57('0x40')]=[{'all':!![]}];}_0x41c564=_[_0x7c57('0x3b')]({},_0x41c564,_0x203f9f[_0x7c57('0x46')]);return db[_0x7c57('0x3e')]['find'](_0x41c564)[_0x7c57('0x26')](handleEntityNotFound(_0x416e6a,null))['then'](respondWithResult(_0x416e6a,null))[_0x7c57('0x43')](handleError(_0x416e6a,null));};exports[_0x7c57('0x47')]=function(_0x32ac20,_0x2f97fe){return db[_0x7c57('0x3e')][_0x7c57('0x47')](_0x32ac20[_0x7c57('0x48')],{})[_0x7c57('0x26')](respondWithResult(_0x2f97fe,0xc9))[_0x7c57('0x43')](handleError(_0x2f97fe,null));};exports[_0x7c57('0x49')]=function(_0x5863ec,_0x51ce72){if(_0x5863ec[_0x7c57('0x48')]['id']){delete _0x5863ec[_0x7c57('0x48')]['id'];}return db['DeskConfiguration'][_0x7c57('0x4a')]({'where':{'id':_0x5863ec[_0x7c57('0x4b')]['id']}})[_0x7c57('0x26')](handleEntityNotFound(_0x51ce72,null))[_0x7c57('0x26')](saveUpdates(_0x5863ec[_0x7c57('0x48')],null))[_0x7c57('0x26')](respondWithResult(_0x51ce72,null))[_0x7c57('0x43')](handleError(_0x51ce72,null));};exports[_0x7c57('0x4c')]=function(_0x2fa185,_0xa2e7eb){return db['DeskConfiguration']['find']({'where':{'id':_0x2fa185[_0x7c57('0x4b')]['id']}})[_0x7c57('0x26')](handleEntityNotFound(_0xa2e7eb,null))[_0x7c57('0x26')](removeEntity(_0xa2e7eb,null))['catch'](handleError(_0xa2e7eb,null));};exports[_0x7c57('0x4d')]=function(_0x333023,_0x11120f,_0x58a334){var _0x2ce4b8={};var _0x49209f={};var _0x43f222;var _0x5afd44;return db[_0x7c57('0x3e')][_0x7c57('0x4e')]({'where':{'id':_0x333023[_0x7c57('0x4b')]['id']}})[_0x7c57('0x26')](handleEntityNotFound(_0x11120f,null))[_0x7c57('0x26')](function(_0x5ece7a){if(_0x5ece7a){_0x43f222=_0x5ece7a;_0x49209f[_0x7c57('0x32')]=_[_0x7c57('0x45')](db['DeskField'][_0x7c57('0x2c')]);_0x49209f[_0x7c57('0x2f')]=_[_0x7c57('0x45')](_0x333023[_0x7c57('0x2f')]);_0x49209f['filters']=_[_0x7c57('0x31')](_0x49209f[_0x7c57('0x32')],_0x49209f['query']);_0x2ce4b8[_0x7c57('0x33')]=_[_0x7c57('0x31')](_0x49209f[_0x7c57('0x32')],qs[_0x7c57('0x34')](_0x333023['query'][_0x7c57('0x34')]));_0x2ce4b8[_0x7c57('0x33')]=_0x2ce4b8[_0x7c57('0x33')][_0x7c57('0x35')]?_0x2ce4b8[_0x7c57('0x33')]:_0x49209f[_0x7c57('0x32')];_0x2ce4b8[_0x7c57('0x37')]=qs['sort'](_0x333023[_0x7c57('0x2f')]['sort']);_0x2ce4b8[_0x7c57('0x3d')]=qs[_0x7c57('0x30')](_['pick'](_0x333023[_0x7c57('0x2f')],_0x49209f[_0x7c57('0x30')]));if(_0x333023['query'][_0x7c57('0x3a')]){_0x2ce4b8[_0x7c57('0x3d')]=_[_0x7c57('0x3b')](_0x2ce4b8[_0x7c57('0x3d')],{'$or':_[_0x7c57('0x2b')](_0x2ce4b8['attributes'],function(_0x2482aa){var _0x2a19ba={};_0x2a19ba[_0x2482aa]={'$like':'%'+_0x333023[_0x7c57('0x2f')][_0x7c57('0x3a')]+'%'};return _0x2a19ba;})});}_0x2ce4b8=_[_0x7c57('0x3b')]({},_0x2ce4b8,_0x333023[_0x7c57('0x46')]);return _0x43f222[_0x7c57('0x4d')](_0x2ce4b8);}})[_0x7c57('0x26')](function(_0x5c0180){if(_0x5c0180){_0x5afd44=_0x5c0180[_0x7c57('0x35')];if(!_0x333023[_0x7c57('0x2f')][_0x7c57('0x4f')](_0x7c57('0x36'))){_0x2ce4b8[_0x7c57('0x1e')]=qs[_0x7c57('0x1e')](_0x333023['query'][_0x7c57('0x1e')]);_0x2ce4b8[_0x7c57('0x1d')]=qs[_0x7c57('0x1d')](_0x333023[_0x7c57('0x2f')][_0x7c57('0x1d')]);}return _0x43f222['getFields'](_0x2ce4b8);}})['then'](function(_0x1a71fd){if(_0x1a71fd){return _0x1a71fd?{'count':_0x5afd44,'rows':_0x1a71fd}:null;}})['then'](respondWithResult(_0x11120f,null))['catch'](handleError(_0x11120f,null));};exports[_0x7c57('0x50')]=function(_0x476e21,_0x10fe71,_0x3b6ea8){var _0x4508ac={};var _0x2cf1c1={};var _0x5be7c1;var _0x22de4a;return db[_0x7c57('0x3e')][_0x7c57('0x4e')]({'where':{'id':_0x476e21[_0x7c57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10fe71,null))[_0x7c57('0x26')](function(_0x4c65b4){if(_0x4c65b4){_0x5be7c1=_0x4c65b4;_0x2cf1c1[_0x7c57('0x32')]=_[_0x7c57('0x45')](db['DeskField']['rawAttributes']);_0x2cf1c1['query']=_['keys'](_0x476e21['query']);_0x2cf1c1[_0x7c57('0x30')]=_['intersection'](_0x2cf1c1[_0x7c57('0x32')],_0x2cf1c1[_0x7c57('0x2f')]);_0x4508ac['attributes']=_['intersection'](_0x2cf1c1[_0x7c57('0x32')],qs[_0x7c57('0x34')](_0x476e21[_0x7c57('0x2f')][_0x7c57('0x34')]));_0x4508ac[_0x7c57('0x33')]=_0x4508ac[_0x7c57('0x33')][_0x7c57('0x35')]?_0x4508ac[_0x7c57('0x33')]:_0x2cf1c1[_0x7c57('0x32')];_0x4508ac['order']=qs[_0x7c57('0x38')](_0x476e21['query'][_0x7c57('0x38')]);_0x4508ac[_0x7c57('0x3d')]=qs[_0x7c57('0x30')](_[_0x7c57('0x39')](_0x476e21['query'],_0x2cf1c1['filters']));if(_0x476e21[_0x7c57('0x2f')][_0x7c57('0x3a')]){_0x4508ac[_0x7c57('0x3d')]=_[_0x7c57('0x3b')](_0x4508ac[_0x7c57('0x3d')],{'$or':_['map'](_0x4508ac['attributes'],function(_0x3cd9aa){var _0x4c79ba={};_0x4c79ba[_0x3cd9aa]={'$like':'%'+_0x476e21[_0x7c57('0x2f')][_0x7c57('0x3a')]+'%'};return _0x4c79ba;})});}_0x4508ac=_['merge']({},_0x4508ac,_0x476e21['options']);return _0x5be7c1[_0x7c57('0x50')](_0x4508ac);}})['then'](function(_0x1aecba){if(_0x1aecba){_0x22de4a=_0x1aecba[_0x7c57('0x35')];if(!_0x476e21[_0x7c57('0x2f')][_0x7c57('0x4f')]('nolimit')){_0x4508ac[_0x7c57('0x1e')]=qs[_0x7c57('0x1e')](_0x476e21[_0x7c57('0x2f')][_0x7c57('0x1e')]);_0x4508ac[_0x7c57('0x1d')]=qs['offset'](_0x476e21[_0x7c57('0x2f')][_0x7c57('0x1d')]);}return _0x5be7c1['getSubjects'](_0x4508ac);}})['then'](function(_0x401a71){if(_0x401a71){return _0x401a71?{'count':_0x22de4a,'rows':_0x401a71}:null;}})[_0x7c57('0x26')](respondWithResult(_0x10fe71,null))[_0x7c57('0x43')](handleError(_0x10fe71,null));};exports[_0x7c57('0x51')]=function(_0x5e0bdd,_0x4b2ffa,_0x22bf21){var _0x30f31b={};var _0x3469e9={};var _0x402e5c;var _0x5f7124;return db[_0x7c57('0x3e')]['findOne']({'where':{'id':_0x5e0bdd[_0x7c57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b2ffa,null))[_0x7c57('0x26')](function(_0x1f129f){if(_0x1f129f){_0x402e5c=_0x1f129f;_0x3469e9[_0x7c57('0x32')]=_[_0x7c57('0x45')](db[_0x7c57('0x52')][_0x7c57('0x2c')]);_0x3469e9[_0x7c57('0x2f')]=_[_0x7c57('0x45')](_0x5e0bdd[_0x7c57('0x2f')]);_0x3469e9[_0x7c57('0x30')]=_[_0x7c57('0x31')](_0x3469e9[_0x7c57('0x32')],_0x3469e9[_0x7c57('0x2f')]);_0x30f31b[_0x7c57('0x33')]=_['intersection'](_0x3469e9[_0x7c57('0x32')],qs[_0x7c57('0x34')](_0x5e0bdd['query'][_0x7c57('0x34')]));_0x30f31b[_0x7c57('0x33')]=_0x30f31b[_0x7c57('0x33')][_0x7c57('0x35')]?_0x30f31b[_0x7c57('0x33')]:_0x3469e9[_0x7c57('0x32')];_0x30f31b[_0x7c57('0x37')]=qs[_0x7c57('0x38')](_0x5e0bdd[_0x7c57('0x2f')][_0x7c57('0x38')]);_0x30f31b[_0x7c57('0x3d')]=qs[_0x7c57('0x30')](_[_0x7c57('0x39')](_0x5e0bdd[_0x7c57('0x2f')],_0x3469e9[_0x7c57('0x30')]));if(_0x5e0bdd['query'][_0x7c57('0x3a')]){_0x30f31b[_0x7c57('0x3d')]=_[_0x7c57('0x3b')](_0x30f31b[_0x7c57('0x3d')],{'$or':_[_0x7c57('0x2b')](_0x30f31b['attributes'],function(_0x337e09){var _0x4d88ac={};_0x4d88ac[_0x337e09]={'$like':'%'+_0x5e0bdd[_0x7c57('0x2f')][_0x7c57('0x3a')]+'%'};return _0x4d88ac;})});}_0x30f31b=_[_0x7c57('0x3b')]({},_0x30f31b,_0x5e0bdd['options']);return _0x402e5c[_0x7c57('0x51')](_0x30f31b);}})[_0x7c57('0x26')](function(_0x1e196b){if(_0x1e196b){_0x5f7124=_0x1e196b['length'];if(!_0x5e0bdd[_0x7c57('0x2f')][_0x7c57('0x4f')](_0x7c57('0x36'))){_0x30f31b[_0x7c57('0x1e')]=qs[_0x7c57('0x1e')](_0x5e0bdd[_0x7c57('0x2f')][_0x7c57('0x1e')]);_0x30f31b[_0x7c57('0x1d')]=qs['offset'](_0x5e0bdd['query'][_0x7c57('0x1d')]);}return _0x402e5c[_0x7c57('0x51')](_0x30f31b);}})['then'](function(_0x1a99d3){if(_0x1a99d3){return _0x1a99d3?{'count':_0x5f7124,'rows':_0x1a99d3}:null;}})[_0x7c57('0x26')](respondWithResult(_0x4b2ffa,null))[_0x7c57('0x43')](handleError(_0x4b2ffa,null));};exports[_0x7c57('0x53')]=function(_0x2748b1,_0x17a481,_0xb776f){var _0x1e12d6={};var _0x341e23={};var _0x22b65b;var _0x503883;return db[_0x7c57('0x3e')]['findOne']({'where':{'id':_0x2748b1[_0x7c57('0x4b')]['id']}})[_0x7c57('0x26')](handleEntityNotFound(_0x17a481,null))[_0x7c57('0x26')](function(_0x517e5d){if(_0x517e5d){_0x22b65b=_0x517e5d;_0x341e23['model']=_['keys'](db[_0x7c57('0x54')][_0x7c57('0x2c')]);_0x341e23[_0x7c57('0x2f')]=_[_0x7c57('0x45')](_0x2748b1[_0x7c57('0x2f')]);_0x341e23[_0x7c57('0x30')]=_[_0x7c57('0x31')](_0x341e23[_0x7c57('0x32')],_0x341e23['query']);_0x1e12d6[_0x7c57('0x33')]=_[_0x7c57('0x31')](_0x341e23[_0x7c57('0x32')],qs['fields'](_0x2748b1['query'][_0x7c57('0x34')]));_0x1e12d6['attributes']=_0x1e12d6[_0x7c57('0x33')][_0x7c57('0x35')]?_0x1e12d6[_0x7c57('0x33')]:_0x341e23[_0x7c57('0x32')];_0x1e12d6['order']=qs[_0x7c57('0x38')](_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x38')]);_0x1e12d6['where']=qs['filters'](_[_0x7c57('0x39')](_0x2748b1[_0x7c57('0x2f')],_0x341e23[_0x7c57('0x30')]));if(_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x3a')]){_0x1e12d6['where']=_[_0x7c57('0x3b')](_0x1e12d6[_0x7c57('0x3d')],{'$or':_[_0x7c57('0x2b')](_0x1e12d6[_0x7c57('0x33')],function(_0x212cb3){var _0x58e771={};_0x58e771[_0x212cb3]={'$like':'%'+_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x3a')]+'%'};return _0x58e771;})});}_0x1e12d6=_[_0x7c57('0x3b')]({},_0x1e12d6,_0x2748b1[_0x7c57('0x46')]);return _0x22b65b['getTags'](_0x1e12d6);}})[_0x7c57('0x26')](function(_0x4d8dd3){if(_0x4d8dd3){_0x503883=_0x4d8dd3['length'];if(!_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x4f')]('nolimit')){_0x1e12d6[_0x7c57('0x1e')]=qs['limit'](_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x1e')]);_0x1e12d6['offset']=qs[_0x7c57('0x1d')](_0x2748b1[_0x7c57('0x2f')][_0x7c57('0x1d')]);}return _0x22b65b[_0x7c57('0x53')](_0x1e12d6);}})['then'](function(_0x58f2de){if(_0x58f2de){return _0x58f2de?{'count':_0x503883,'rows':_0x58f2de}:null;}})[_0x7c57('0x26')](respondWithResult(_0x17a481,null))[_0x7c57('0x43')](handleError(_0x17a481,null));};exports['setTags']=function(_0x396cde,_0x2c1e68,_0x272be3){if(_0x396cde['body']['id']){delete _0x396cde['body']['id'];}return db[_0x7c57('0x3e')][_0x7c57('0x4e')]({'where':{'id':_0x396cde['params']['id']}})[_0x7c57('0x26')](handleEntityNotFound(_0x2c1e68,null))[_0x7c57('0x26')](function(_0x578784){if(_0x578784){return _0x578784[_0x7c57('0x55')](_0x396cde['body'][_0x7c57('0x56')]||[]);}return null;})['then'](respondWithResult(_0x2c1e68,null))[_0x7c57('0x43')](handleError(_0x2c1e68,null));}; \ No newline at end of file +var _0x8b11=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','then','stack','name','send','index','map','DeskConfiguration','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','findOne','DeskField','rawAttributes','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x10a5a5,_0x4361b0){var _0x42f0d0=function(_0x1b9c99){while(--_0x1b9c99){_0x10a5a5['push'](_0x10a5a5['shift']());}};_0x42f0d0(++_0x4361b0);}(_0x8b11,0xe2));var _0x18b1=function(_0x1cfda3,_0x32e81){_0x1cfda3=_0x1cfda3-0x0;var _0x45a82f=_0x8b11[_0x1cfda3];return _0x45a82f;};'use strict';var emlformat=require(_0x18b1('0x0'));var rimraf=require(_0x18b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18b1('0x2'));var rp=require(_0x18b1('0x3'));var moment=require(_0x18b1('0x4'));var BPromise=require(_0x18b1('0x5'));var Mustache=require(_0x18b1('0x6'));var util=require('util');var path=require(_0x18b1('0x7'));var sox=require(_0x18b1('0x8'));var csv=require(_0x18b1('0x9'));var ejs=require(_0x18b1('0xa'));var fs=require('fs');var fs_extra=require(_0x18b1('0xb'));var _=require(_0x18b1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x18b1('0x9'));var querystring=require(_0x18b1('0xe'));var Papa=require(_0x18b1('0xf'));var Redis=require(_0x18b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x18b1('0x11'));var as=require(_0x18b1('0x12'));var hardwareService=require(_0x18b1('0x13'));var logger=require('../../config/logger')(_0x18b1('0x14'));var utils=require('../../config/utils');var config=require(_0x18b1('0x15'));var licenseUtil=require(_0x18b1('0x16'));var db=require(_0x18b1('0x17'))['db'];function respondWithStatusCode(_0x105a79,_0x36030d){_0x36030d=_0x36030d||0xcc;return function(_0x34e3a8){if(_0x34e3a8){return _0x105a79['sendStatus'](_0x36030d);}return _0x105a79[_0x18b1('0x18')](_0x36030d)[_0x18b1('0x19')]();};}function respondWithResult(_0x865940,_0x361f4f){_0x361f4f=_0x361f4f||0xc8;return function(_0x25e743){if(_0x25e743){return _0x865940[_0x18b1('0x18')](_0x361f4f)['json'](_0x25e743);}};}function respondWithFilteredResult(_0x47c820,_0x46ffc3){return function(_0x1d504c){if(_0x1d504c){var _0x1c7aef=typeof _0x46ffc3[_0x18b1('0x1a')]===_0x18b1('0x1b')&&typeof _0x46ffc3['limit']===_0x18b1('0x1b');var _0x39c188=_0x1d504c['count'];var _0x42cd0a=_0x1c7aef?0x0:_0x46ffc3[_0x18b1('0x1a')];var _0x61ec2=_0x1c7aef?_0x1d504c[_0x18b1('0x1c')]:_0x46ffc3['offset']+_0x46ffc3[_0x18b1('0x1d')];var _0x1e0e92;if(_0x61ec2>=_0x39c188){_0x61ec2=_0x39c188;_0x1e0e92=0xc8;}else{_0x1e0e92=0xce;}_0x47c820[_0x18b1('0x18')](_0x1e0e92);return _0x47c820[_0x18b1('0x1e')](_0x18b1('0x1f'),_0x42cd0a+'-'+_0x61ec2+'/'+_0x39c188)['json'](_0x1d504c);}return null;};}function patchUpdates(_0x3f3bf8){return function(_0x56ff3b){try{jsonpatch[_0x18b1('0x20')](_0x56ff3b,_0x3f3bf8,!![]);}catch(_0x2ef2f2){return BPromise[_0x18b1('0x21')](_0x2ef2f2);}return _0x56ff3b['save']();};}function saveUpdates(_0x4aeda3,_0x5817cb){return function(_0x1b0b20){if(_0x1b0b20){return _0x1b0b20['update'](_0x4aeda3)['then'](function(_0x1aad53){return _0x1aad53;});}return null;};}function removeEntity(_0x1cc104,_0x28bee1){return function(_0x1c308d){if(_0x1c308d){return _0x1c308d['destroy']()[_0x18b1('0x22')](function(){_0x1cc104['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x333746,_0x25351e){return function(_0x240e07){if(!_0x240e07){_0x333746['sendStatus'](0x194);}return _0x240e07;};}function handleError(_0x1dc397,_0x209763){_0x209763=_0x209763||0x1f4;return function(_0x2c09c6){logger['error'](_0x2c09c6[_0x18b1('0x23')]);if(_0x2c09c6['name']){delete _0x2c09c6[_0x18b1('0x24')];}_0x1dc397[_0x18b1('0x18')](_0x209763)[_0x18b1('0x25')](_0x2c09c6);};}exports[_0x18b1('0x26')]=function(_0x1e152b,_0x5e334e){var _0x42e20f={},_0x435a4f={},_0x1e21e6={'count':0x0,'rows':[]};var _0x1e809b=_[_0x18b1('0x27')](db[_0x18b1('0x28')]['rawAttributes'],function(_0x582430){return{'name':_0x582430[_0x18b1('0x29')],'type':_0x582430['type'][_0x18b1('0x2a')]};});_0x435a4f['model']=_['map'](_0x1e809b,_0x18b1('0x24'));_0x435a4f[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x1e152b[_0x18b1('0x2b')]);_0x435a4f[_0x18b1('0x2d')]=_[_0x18b1('0x2e')](_0x435a4f[_0x18b1('0x2f')],_0x435a4f[_0x18b1('0x2b')]);_0x42e20f[_0x18b1('0x30')]=_['intersection'](_0x435a4f[_0x18b1('0x2f')],qs[_0x18b1('0x31')](_0x1e152b[_0x18b1('0x2b')]['fields']));_0x42e20f[_0x18b1('0x30')]=_0x42e20f[_0x18b1('0x30')][_0x18b1('0x32')]?_0x42e20f['attributes']:_0x435a4f[_0x18b1('0x2f')];if(!_0x1e152b[_0x18b1('0x2b')][_0x18b1('0x33')](_0x18b1('0x34'))){_0x42e20f[_0x18b1('0x1d')]=qs[_0x18b1('0x1d')](_0x1e152b[_0x18b1('0x2b')]['limit']);_0x42e20f[_0x18b1('0x1a')]=qs[_0x18b1('0x1a')](_0x1e152b['query']['offset']);}_0x42e20f[_0x18b1('0x35')]=qs[_0x18b1('0x36')](_0x1e152b[_0x18b1('0x2b')][_0x18b1('0x36')]);_0x42e20f['where']=qs[_0x18b1('0x2d')](_[_0x18b1('0x37')](_0x1e152b[_0x18b1('0x2b')],_0x435a4f[_0x18b1('0x2d')]),_0x1e809b);if(_0x1e152b[_0x18b1('0x2b')][_0x18b1('0x38')]){_0x42e20f[_0x18b1('0x39')]=_[_0x18b1('0x3a')](_0x42e20f[_0x18b1('0x39')],{'$or':_['map'](_0x1e809b,function(_0x44511e){if(_0x44511e[_0x18b1('0x3b')]!==_0x18b1('0x3c')){var _0xd1cea3={};_0xd1cea3[_0x44511e['name']]={'$like':'%'+_0x1e152b[_0x18b1('0x2b')][_0x18b1('0x38')]+'%'};return _0xd1cea3;}})});}_0x42e20f=_[_0x18b1('0x3a')]({},_0x42e20f,_0x1e152b[_0x18b1('0x3d')]);var _0x3ba6e0={'where':_0x42e20f[_0x18b1('0x39')]};return db[_0x18b1('0x28')][_0x18b1('0x1c')](_0x3ba6e0)[_0x18b1('0x22')](function(_0x3ff729){_0x1e21e6[_0x18b1('0x1c')]=_0x3ff729;if(_0x1e152b['query'][_0x18b1('0x3e')]){_0x42e20f[_0x18b1('0x3f')]=[{'all':!![]}];}return db[_0x18b1('0x28')][_0x18b1('0x40')](_0x42e20f);})['then'](function(_0x376fe0){_0x1e21e6['rows']=_0x376fe0;return _0x1e21e6;})[_0x18b1('0x22')](respondWithFilteredResult(_0x5e334e,_0x42e20f))[_0x18b1('0x41')](handleError(_0x5e334e,null));};exports['show']=function(_0x2d2679,_0x13dfee){var _0xf19eb7={'raw':![],'where':{'id':_0x2d2679['params']['id']}},_0x232ca2={};_0x232ca2[_0x18b1('0x2f')]=_[_0x18b1('0x2c')](db['DeskConfiguration']['rawAttributes']);_0x232ca2[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x2d2679['query']);_0x232ca2['filters']=_[_0x18b1('0x2e')](_0x232ca2['model'],_0x232ca2[_0x18b1('0x2b')]);_0xf19eb7['attributes']=_[_0x18b1('0x2e')](_0x232ca2[_0x18b1('0x2f')],qs[_0x18b1('0x31')](_0x2d2679[_0x18b1('0x2b')]['fields']));_0xf19eb7['attributes']=_0xf19eb7[_0x18b1('0x30')][_0x18b1('0x32')]?_0xf19eb7[_0x18b1('0x30')]:_0x232ca2[_0x18b1('0x2f')];if(_0x2d2679['query'][_0x18b1('0x3e')]){_0xf19eb7[_0x18b1('0x3f')]=[{'all':!![]}];}_0xf19eb7=_[_0x18b1('0x3a')]({},_0xf19eb7,_0x2d2679['options']);return db[_0x18b1('0x28')]['find'](_0xf19eb7)['then'](handleEntityNotFound(_0x13dfee,null))['then'](respondWithResult(_0x13dfee,null))[_0x18b1('0x41')](handleError(_0x13dfee,null));};exports['create']=function(_0x3799e6,_0x3fbdc1){return db[_0x18b1('0x28')][_0x18b1('0x42')](_0x3799e6[_0x18b1('0x43')],{})[_0x18b1('0x22')](respondWithResult(_0x3fbdc1,0xc9))[_0x18b1('0x41')](handleError(_0x3fbdc1,null));};exports['update']=function(_0x283148,_0x5f3720){if(_0x283148[_0x18b1('0x43')]['id']){delete _0x283148[_0x18b1('0x43')]['id'];}return db[_0x18b1('0x28')][_0x18b1('0x44')]({'where':{'id':_0x283148[_0x18b1('0x45')]['id']}})[_0x18b1('0x22')](handleEntityNotFound(_0x5f3720,null))[_0x18b1('0x22')](saveUpdates(_0x283148[_0x18b1('0x43')],null))[_0x18b1('0x22')](respondWithResult(_0x5f3720,null))[_0x18b1('0x41')](handleError(_0x5f3720,null));};exports['destroy']=function(_0x841357,_0xf93250){return db[_0x18b1('0x28')]['find']({'where':{'id':_0x841357[_0x18b1('0x45')]['id']}})[_0x18b1('0x22')](handleEntityNotFound(_0xf93250,null))[_0x18b1('0x22')](removeEntity(_0xf93250,null))[_0x18b1('0x41')](handleError(_0xf93250,null));};exports['getFields']=function(_0x31b6bd,_0x35b88f,_0x526a60){var _0x5bcd39={};var _0xc4bdd4={};var _0x33813c;var _0x106113;return db[_0x18b1('0x28')][_0x18b1('0x46')]({'where':{'id':_0x31b6bd[_0x18b1('0x45')]['id']}})[_0x18b1('0x22')](handleEntityNotFound(_0x35b88f,null))[_0x18b1('0x22')](function(_0x4cf1fd){if(_0x4cf1fd){_0x33813c=_0x4cf1fd;_0xc4bdd4[_0x18b1('0x2f')]=_[_0x18b1('0x2c')](db[_0x18b1('0x47')][_0x18b1('0x48')]);_0xc4bdd4[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x31b6bd['query']);_0xc4bdd4[_0x18b1('0x2d')]=_[_0x18b1('0x2e')](_0xc4bdd4[_0x18b1('0x2f')],_0xc4bdd4[_0x18b1('0x2b')]);_0x5bcd39[_0x18b1('0x30')]=_['intersection'](_0xc4bdd4[_0x18b1('0x2f')],qs[_0x18b1('0x31')](_0x31b6bd[_0x18b1('0x2b')][_0x18b1('0x31')]));_0x5bcd39[_0x18b1('0x30')]=_0x5bcd39['attributes'][_0x18b1('0x32')]?_0x5bcd39[_0x18b1('0x30')]:_0xc4bdd4[_0x18b1('0x2f')];_0x5bcd39['order']=qs[_0x18b1('0x36')](_0x31b6bd[_0x18b1('0x2b')][_0x18b1('0x36')]);_0x5bcd39[_0x18b1('0x39')]=qs[_0x18b1('0x2d')](_[_0x18b1('0x37')](_0x31b6bd[_0x18b1('0x2b')],_0xc4bdd4['filters']));if(_0x31b6bd[_0x18b1('0x2b')][_0x18b1('0x38')]){_0x5bcd39['where']=_['merge'](_0x5bcd39['where'],{'$or':_[_0x18b1('0x27')](_0x5bcd39['attributes'],function(_0x53503a){var _0x33f740={};_0x33f740[_0x53503a]={'$like':'%'+_0x31b6bd[_0x18b1('0x2b')][_0x18b1('0x38')]+'%'};return _0x33f740;})});}_0x5bcd39=_[_0x18b1('0x3a')]({},_0x5bcd39,_0x31b6bd[_0x18b1('0x3d')]);return _0x33813c[_0x18b1('0x49')](_0x5bcd39);}})[_0x18b1('0x22')](function(_0x4e0612){if(_0x4e0612){_0x106113=_0x4e0612[_0x18b1('0x32')];if(!_0x31b6bd[_0x18b1('0x2b')][_0x18b1('0x33')](_0x18b1('0x34'))){_0x5bcd39[_0x18b1('0x1d')]=qs['limit'](_0x31b6bd['query'][_0x18b1('0x1d')]);_0x5bcd39[_0x18b1('0x1a')]=qs[_0x18b1('0x1a')](_0x31b6bd[_0x18b1('0x2b')]['offset']);}return _0x33813c[_0x18b1('0x49')](_0x5bcd39);}})[_0x18b1('0x22')](function(_0x531137){if(_0x531137){return _0x531137?{'count':_0x106113,'rows':_0x531137}:null;}})['then'](respondWithResult(_0x35b88f,null))[_0x18b1('0x41')](handleError(_0x35b88f,null));};exports[_0x18b1('0x4a')]=function(_0x200916,_0x419fea,_0x2073dd){var _0x46a910={};var _0x581c9d={};var _0x3916d6;var _0xe92846;return db['DeskConfiguration']['findOne']({'where':{'id':_0x200916['params']['id']}})['then'](handleEntityNotFound(_0x419fea,null))[_0x18b1('0x22')](function(_0x1b2400){if(_0x1b2400){_0x3916d6=_0x1b2400;_0x581c9d[_0x18b1('0x2f')]=_['keys'](db['DeskField']['rawAttributes']);_0x581c9d[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x200916['query']);_0x581c9d[_0x18b1('0x2d')]=_[_0x18b1('0x2e')](_0x581c9d[_0x18b1('0x2f')],_0x581c9d[_0x18b1('0x2b')]);_0x46a910[_0x18b1('0x30')]=_[_0x18b1('0x2e')](_0x581c9d[_0x18b1('0x2f')],qs[_0x18b1('0x31')](_0x200916[_0x18b1('0x2b')]['fields']));_0x46a910[_0x18b1('0x30')]=_0x46a910[_0x18b1('0x30')][_0x18b1('0x32')]?_0x46a910[_0x18b1('0x30')]:_0x581c9d[_0x18b1('0x2f')];_0x46a910[_0x18b1('0x35')]=qs[_0x18b1('0x36')](_0x200916[_0x18b1('0x2b')][_0x18b1('0x36')]);_0x46a910[_0x18b1('0x39')]=qs[_0x18b1('0x2d')](_['pick'](_0x200916[_0x18b1('0x2b')],_0x581c9d[_0x18b1('0x2d')]));if(_0x200916[_0x18b1('0x2b')][_0x18b1('0x38')]){_0x46a910[_0x18b1('0x39')]=_[_0x18b1('0x3a')](_0x46a910[_0x18b1('0x39')],{'$or':_[_0x18b1('0x27')](_0x46a910[_0x18b1('0x30')],function(_0x3dcc05){var _0x4c742b={};_0x4c742b[_0x3dcc05]={'$like':'%'+_0x200916[_0x18b1('0x2b')][_0x18b1('0x38')]+'%'};return _0x4c742b;})});}_0x46a910=_['merge']({},_0x46a910,_0x200916[_0x18b1('0x3d')]);return _0x3916d6['getSubjects'](_0x46a910);}})[_0x18b1('0x22')](function(_0x21b4cc){if(_0x21b4cc){_0xe92846=_0x21b4cc['length'];if(!_0x200916[_0x18b1('0x2b')]['hasOwnProperty'](_0x18b1('0x34'))){_0x46a910[_0x18b1('0x1d')]=qs[_0x18b1('0x1d')](_0x200916[_0x18b1('0x2b')][_0x18b1('0x1d')]);_0x46a910[_0x18b1('0x1a')]=qs[_0x18b1('0x1a')](_0x200916[_0x18b1('0x2b')][_0x18b1('0x1a')]);}return _0x3916d6[_0x18b1('0x4a')](_0x46a910);}})[_0x18b1('0x22')](function(_0x34a49d){if(_0x34a49d){return _0x34a49d?{'count':_0xe92846,'rows':_0x34a49d}:null;}})[_0x18b1('0x22')](respondWithResult(_0x419fea,null))[_0x18b1('0x41')](handleError(_0x419fea,null));};exports[_0x18b1('0x4b')]=function(_0x5c756f,_0x248001,_0x16e626){var _0x5125ab={};var _0x45f74f={};var _0x1c4450;var _0x571a6d;return db[_0x18b1('0x28')][_0x18b1('0x46')]({'where':{'id':_0x5c756f[_0x18b1('0x45')]['id']}})[_0x18b1('0x22')](handleEntityNotFound(_0x248001,null))[_0x18b1('0x22')](function(_0x304128){if(_0x304128){_0x1c4450=_0x304128;_0x45f74f[_0x18b1('0x2f')]=_[_0x18b1('0x2c')](db[_0x18b1('0x47')][_0x18b1('0x48')]);_0x45f74f[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x5c756f[_0x18b1('0x2b')]);_0x45f74f[_0x18b1('0x2d')]=_['intersection'](_0x45f74f[_0x18b1('0x2f')],_0x45f74f['query']);_0x5125ab[_0x18b1('0x30')]=_[_0x18b1('0x2e')](_0x45f74f['model'],qs[_0x18b1('0x31')](_0x5c756f[_0x18b1('0x2b')][_0x18b1('0x31')]));_0x5125ab[_0x18b1('0x30')]=_0x5125ab[_0x18b1('0x30')]['length']?_0x5125ab[_0x18b1('0x30')]:_0x45f74f[_0x18b1('0x2f')];_0x5125ab[_0x18b1('0x35')]=qs['sort'](_0x5c756f[_0x18b1('0x2b')][_0x18b1('0x36')]);_0x5125ab[_0x18b1('0x39')]=qs[_0x18b1('0x2d')](_[_0x18b1('0x37')](_0x5c756f[_0x18b1('0x2b')],_0x45f74f[_0x18b1('0x2d')]));if(_0x5c756f['query'][_0x18b1('0x38')]){_0x5125ab[_0x18b1('0x39')]=_['merge'](_0x5125ab['where'],{'$or':_[_0x18b1('0x27')](_0x5125ab[_0x18b1('0x30')],function(_0x250326){var _0x526749={};_0x526749[_0x250326]={'$like':'%'+_0x5c756f[_0x18b1('0x2b')][_0x18b1('0x38')]+'%'};return _0x526749;})});}_0x5125ab=_[_0x18b1('0x3a')]({},_0x5125ab,_0x5c756f[_0x18b1('0x3d')]);return _0x1c4450['getDescriptions'](_0x5125ab);}})[_0x18b1('0x22')](function(_0x3612b5){if(_0x3612b5){_0x571a6d=_0x3612b5[_0x18b1('0x32')];if(!_0x5c756f[_0x18b1('0x2b')][_0x18b1('0x33')](_0x18b1('0x34'))){_0x5125ab[_0x18b1('0x1d')]=qs[_0x18b1('0x1d')](_0x5c756f['query'][_0x18b1('0x1d')]);_0x5125ab['offset']=qs[_0x18b1('0x1a')](_0x5c756f[_0x18b1('0x2b')][_0x18b1('0x1a')]);}return _0x1c4450['getDescriptions'](_0x5125ab);}})[_0x18b1('0x22')](function(_0x2c4263){if(_0x2c4263){return _0x2c4263?{'count':_0x571a6d,'rows':_0x2c4263}:null;}})[_0x18b1('0x22')](respondWithResult(_0x248001,null))[_0x18b1('0x41')](handleError(_0x248001,null));};exports[_0x18b1('0x4c')]=function(_0x83307e,_0xb73b6,_0x276117){var _0x4c9137={};var _0x209b1b={};var _0x40d294;var _0x466290;return db[_0x18b1('0x28')][_0x18b1('0x46')]({'where':{'id':_0x83307e['params']['id']}})['then'](handleEntityNotFound(_0xb73b6,null))[_0x18b1('0x22')](function(_0x1035ad){if(_0x1035ad){_0x40d294=_0x1035ad;_0x209b1b[_0x18b1('0x2f')]=_['keys'](db[_0x18b1('0x4d')][_0x18b1('0x48')]);_0x209b1b[_0x18b1('0x2b')]=_[_0x18b1('0x2c')](_0x83307e[_0x18b1('0x2b')]);_0x209b1b[_0x18b1('0x2d')]=_[_0x18b1('0x2e')](_0x209b1b[_0x18b1('0x2f')],_0x209b1b['query']);_0x4c9137[_0x18b1('0x30')]=_['intersection'](_0x209b1b[_0x18b1('0x2f')],qs[_0x18b1('0x31')](_0x83307e[_0x18b1('0x2b')][_0x18b1('0x31')]));_0x4c9137[_0x18b1('0x30')]=_0x4c9137['attributes'][_0x18b1('0x32')]?_0x4c9137['attributes']:_0x209b1b[_0x18b1('0x2f')];_0x4c9137['order']=qs[_0x18b1('0x36')](_0x83307e[_0x18b1('0x2b')][_0x18b1('0x36')]);_0x4c9137[_0x18b1('0x39')]=qs[_0x18b1('0x2d')](_[_0x18b1('0x37')](_0x83307e[_0x18b1('0x2b')],_0x209b1b[_0x18b1('0x2d')]));if(_0x83307e[_0x18b1('0x2b')][_0x18b1('0x38')]){_0x4c9137[_0x18b1('0x39')]=_[_0x18b1('0x3a')](_0x4c9137['where'],{'$or':_[_0x18b1('0x27')](_0x4c9137[_0x18b1('0x30')],function(_0x2c84a3){var _0x23022b={};_0x23022b[_0x2c84a3]={'$like':'%'+_0x83307e['query'][_0x18b1('0x38')]+'%'};return _0x23022b;})});}_0x4c9137=_[_0x18b1('0x3a')]({},_0x4c9137,_0x83307e[_0x18b1('0x3d')]);return _0x40d294['getTags'](_0x4c9137);}})[_0x18b1('0x22')](function(_0x85bcc7){if(_0x85bcc7){_0x466290=_0x85bcc7[_0x18b1('0x32')];if(!_0x83307e[_0x18b1('0x2b')][_0x18b1('0x33')](_0x18b1('0x34'))){_0x4c9137[_0x18b1('0x1d')]=qs['limit'](_0x83307e['query']['limit']);_0x4c9137[_0x18b1('0x1a')]=qs[_0x18b1('0x1a')](_0x83307e[_0x18b1('0x2b')]['offset']);}return _0x40d294[_0x18b1('0x4c')](_0x4c9137);}})[_0x18b1('0x22')](function(_0xbc7a38){if(_0xbc7a38){return _0xbc7a38?{'count':_0x466290,'rows':_0xbc7a38}:null;}})[_0x18b1('0x22')](respondWithResult(_0xb73b6,null))[_0x18b1('0x41')](handleError(_0xb73b6,null));};exports[_0x18b1('0x4e')]=function(_0x5358a6,_0x177bc1,_0x2e114d){if(_0x5358a6[_0x18b1('0x43')]['id']){delete _0x5358a6['body']['id'];}return db['DeskConfiguration'][_0x18b1('0x46')]({'where':{'id':_0x5358a6[_0x18b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x177bc1,null))[_0x18b1('0x22')](function(_0x22f618){if(_0x22f618){return _0x22f618['setTags'](_0x5358a6[_0x18b1('0x43')][_0x18b1('0x4f')]||[]);}return null;})[_0x18b1('0x22')](respondWithResult(_0x177bc1,null))[_0x18b1('0x41')](handleError(_0x177bc1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f23412f..369361e 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 _0x2147=['exports','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1dcc26,_0x559fe7){var _0x21c51f=function(_0x5ecbdf){while(--_0x5ecbdf){_0x1dcc26['push'](_0x1dcc26['shift']());}};_0x21c51f(++_0x559fe7);}(_0x2147,0x7d));var _0x7214=function(_0x232cc4,_0x571cf7){_0x232cc4=_0x232cc4-0x0;var _0x1b3a60=_0x2147[_0x232cc4];return _0x1b3a60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7214('0x0'))(_0x7214('0x1'));var moment=require(_0x7214('0x2'));var BPromise=require(_0x7214('0x3'));var rp=require(_0x7214('0x4'));var fs=require('fs');var path=require(_0x7214('0x5'));var rimraf=require('rimraf');var config=require(_0x7214('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x7214('0x7')]=function(_0x5bb448,_0x19c389){return _0x5bb448[_0x7214('0x8')](_0x7214('0x9'),attributes,{'tableName':_0x7214('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3038=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','moment','bluebird'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x3038,0x11b));var _0x8303=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x3038[_0xe719ec];return _0x4842a1;};'use strict';var _=require('lodash');var util=require(_0x8303('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8303('0x1'));var BPromise=require(_0x8303('0x2'));var rp=require(_0x8303('0x3'));var fs=require('fs');var path=require(_0x8303('0x4'));var rimraf=require('rimraf');var config=require(_0x8303('0x5'));var attributes=require(_0x8303('0x6'));module[_0x8303('0x7')]=function(_0x1d43b1,_0x363d41){return _0x1d43b1[_0x8303('0x8')](_0x8303('0x9'),attributes,{'tableName':_0x8303('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 5ad8df6..5aa3ca0 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 _0xaec5=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5aec('0x0'));var util=require(_0x5aec('0x1'));var moment=require(_0x5aec('0x2'));var BPromise=require(_0x5aec('0x3'));var rs=require(_0x5aec('0x4'));var fs=require('fs');var Redis=require(_0x5aec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aec('0x6'));var logger=require(_0x5aec('0x7'))(_0x5aec('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476951,_0x3dae8d,_0x215103){return new BPromise(function(_0x28c362,_0x55c01e){return client[_0x5aec('0x9')](_0x476951,_0x215103)[_0x5aec('0xa')](function(_0x5b5bb3){logger[_0x5aec('0xb')](_0x5aec('0xc'),_0x3dae8d,_0x5aec('0xd'));logger[_0x5aec('0xe')](_0x5aec('0xf'),_0x3dae8d,_0x5aec('0xd'),JSON[_0x5aec('0x10')](_0x5b5bb3));if(_0x5b5bb3['error']){if(_0x5b5bb3['error'][_0x5aec('0x11')]===0x1f4){logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x55c01e(_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);}logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x28c362(_0x5b5bb3['error'][_0x5aec('0x13')]);}else{logger[_0x5aec('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x3dae8d,_0x5aec('0xd'));_0x28c362(_0x5b5bb3['result'][_0x5aec('0x13')]);}})[_0x5aec('0x14')](function(_0x28f415){logger[_0x5aec('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x3dae8d,_0x28f415);_0x55c01e(_0x28f415);});});} \ No newline at end of file +var _0xd906=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','moment'];(function(_0x10b2d5,_0x5a7743){var _0x14b8d1=function(_0x3b888c){while(--_0x3b888c){_0x10b2d5['push'](_0x10b2d5['shift']());}};_0x14b8d1(++_0x5a7743);}(_0xd906,0x6b));var _0x6d90=function(_0x3b3c70,_0xcf26b3){_0x3b3c70=_0x3b3c70-0x0;var _0x277699=_0xd906[_0x3b3c70];return _0x277699;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a674410..c842f6b 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 _0xd1ca=['multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','post','create','put','/:id','update','delete','exports'];(function(_0x418dc2,_0x1d3010){var _0x2dfa1b=function(_0x5e1f56){while(--_0x5e1f56){_0x418dc2['push'](_0x418dc2['shift']());}};_0x2dfa1b(++_0x1d3010);}(_0xd1ca,0x140));var _0xad1c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xd1ca[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad1c('0x2')]();var fs_extra=require(_0xad1c('0x3'));var auth=require(_0xad1c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xad1c('0x5'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xad1c('0x6')](),controller[_0xad1c('0x7')]);router[_0xad1c('0x8')]('/:id',auth[_0xad1c('0x6')](),controller['show']);router[_0xad1c('0x9')]('/',auth[_0xad1c('0x6')](),controller[_0xad1c('0xa')]);router[_0xad1c('0xb')](_0xad1c('0xc'),auth[_0xad1c('0x6')](),controller[_0xad1c('0xd')]);router[_0xad1c('0xe')](_0xad1c('0xc'),auth[_0xad1c('0x6')](),controller['destroy']);module[_0xad1c('0xf')]=router; \ No newline at end of file +var _0xb0d9=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get'];(function(_0x3cf983,_0x28742c){var _0x2e50f3=function(_0x17af3c){while(--_0x17af3c){_0x3cf983['push'](_0x3cf983['shift']());}};_0x2e50f3(++_0x28742c);}(_0xb0d9,0x87));var _0x9b0d=function(_0x24e4af,_0x4c2c20){_0x24e4af=_0x24e4af-0x0;var _0x567c16=_0xb0d9[_0x24e4af];return _0x567c16;};'use strict';var multer=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var path=require('path');var timeout=require(_0x9b0d('0x2'));var express=require(_0x9b0d('0x3'));var router=express[_0x9b0d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b0d('0x5'));var interaction=require(_0x9b0d('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0x9b0d('0x7')](),controller['index']);router[_0x9b0d('0x8')](_0x9b0d('0x9'),auth[_0x9b0d('0x7')](),controller[_0x9b0d('0xa')]);router[_0x9b0d('0xb')]('/',auth['isAuthenticated'](),controller[_0x9b0d('0xc')]);router[_0x9b0d('0xd')](_0x9b0d('0x9'),auth['isAuthenticated'](),controller[_0x9b0d('0xe')]);router[_0x9b0d('0xf')](_0x9b0d('0x9'),auth[_0x9b0d('0x7')](),controller[_0x9b0d('0x10')]);module[_0x9b0d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index db1db13..95c20dd 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 _0xa27c=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x26221a,_0x46d354){var _0x227a3f=function(_0x4bc5e3){while(--_0x4bc5e3){_0x26221a['push'](_0x26221a['shift']());}};_0x227a3f(++_0x46d354);}(_0xa27c,0x8c));var _0xca27=function(_0x1d7343,_0x5784ca){_0x1d7343=_0x1d7343-0x0;var _0x25f115=_0xa27c[_0x1d7343];return _0x25f115;};'use strict';var Sequelize=require(_0xca27('0x0'));module[_0xca27('0x1')]={'type':{'type':Sequelize[_0xca27('0x2')](_0xca27('0x3'),_0xca27('0x4'),_0xca27('0x5'),_0xca27('0x6'),_0xca27('0x7')),'defaultValue':_0xca27('0x3')},'content':{'type':Sequelize[_0xca27('0x8')]},'key':{'type':Sequelize[_0xca27('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xca27('0x5'))},'keyContent':{'type':Sequelize[_0xca27('0x8')]},'idField':{'type':Sequelize[_0xca27('0x8')]},'nameField':{'type':Sequelize[_0xca27('0x8')]},'customField':{'type':Sequelize[_0xca27('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xca27('0x8')]}}; \ No newline at end of file +var _0xf908=['ENUM','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x51c925,_0x551fd6){var _0x3a5e1e=function(_0x5e9a03){while(--_0x5e9a03){_0x51c925['push'](_0x51c925['shift']());}};_0x3a5e1e(++_0x551fd6);}(_0xf908,0x1df));var _0x8f90=function(_0x346c85,_0x43826c){_0x346c85=_0x346c85-0x0;var _0x41fdb0=_0xf908[_0x346c85];return _0x41fdb0;};'use strict';var Sequelize=require('sequelize');module[_0x8f90('0x0')]={'type':{'type':Sequelize[_0x8f90('0x1')]('string','variable',_0x8f90('0x2'),_0x8f90('0x3'),_0x8f90('0x4')),'defaultValue':_0x8f90('0x5')},'content':{'type':Sequelize[_0x8f90('0x6')]},'key':{'type':Sequelize[_0x8f90('0x6')]},'keyType':{'type':Sequelize[_0x8f90('0x1')](_0x8f90('0x5'),'variable',_0x8f90('0x2'))},'keyContent':{'type':Sequelize[_0x8f90('0x6')]},'idField':{'type':Sequelize[_0x8f90('0x6')]},'nameField':{'type':Sequelize[_0x8f90('0x6')]},'customField':{'type':Sequelize[_0x8f90('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f90('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 232c1be..01ba5e8 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 _0x4a03=['../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3bdebc,_0x557b51){var _0x57fb15=function(_0x434d5e){while(--_0x434d5e){_0x3bdebc['push'](_0x3bdebc['shift']());}};_0x57fb15(++_0x557b51);}(_0x4a03,0x16e));var _0x34a0=function(_0x168bb0,_0x3e7b13){_0x168bb0=_0x168bb0-0x0;var _0xf241b6=_0x4a03[_0x168bb0];return _0xf241b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34a0('0x0'));var zipdir=require(_0x34a0('0x1'));var jsonpatch=require(_0x34a0('0x2'));var rp=require('request-promise');var moment=require(_0x34a0('0x3'));var BPromise=require(_0x34a0('0x4'));var Mustache=require(_0x34a0('0x5'));var util=require('util');var path=require(_0x34a0('0x6'));var sox=require(_0x34a0('0x7'));var csv=require('to-csv');var ejs=require(_0x34a0('0x8'));var fs=require('fs');var fs_extra=require(_0x34a0('0x9'));var _=require('lodash');var squel=require(_0x34a0('0xa'));var crypto=require(_0x34a0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x34a0('0xc'));var toCsv=require(_0x34a0('0xd'));var querystring=require(_0x34a0('0xe'));var Papa=require(_0x34a0('0xf'));var Redis=require(_0x34a0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x34a0('0x11'));var as=require(_0x34a0('0x12'));var hardwareService=require(_0x34a0('0x13'));var logger=require(_0x34a0('0x14'))(_0x34a0('0x15'));var utils=require(_0x34a0('0x16'));var config=require(_0x34a0('0x17'));var licenseUtil=require(_0x34a0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5506cb,_0x9e08fb){_0x9e08fb=_0x9e08fb||0xcc;return function(_0x220f9a){if(_0x220f9a){return _0x5506cb['sendStatus'](_0x9e08fb);}return _0x5506cb[_0x34a0('0x19')](_0x9e08fb)[_0x34a0('0x1a')]();};}function respondWithResult(_0x126d89,_0x46c0e2){_0x46c0e2=_0x46c0e2||0xc8;return function(_0x1b647a){if(_0x1b647a){return _0x126d89[_0x34a0('0x19')](_0x46c0e2)[_0x34a0('0x1b')](_0x1b647a);}};}function respondWithFilteredResult(_0x1f3d7a,_0x3fb308){return function(_0x22eac3){if(_0x22eac3){var _0x148042=typeof _0x3fb308[_0x34a0('0x1c')]===_0x34a0('0x1d')&&typeof _0x3fb308[_0x34a0('0x1e')]===_0x34a0('0x1d');var _0x1ae2a8=_0x22eac3[_0x34a0('0x1f')];var _0x224cca=_0x148042?0x0:_0x3fb308[_0x34a0('0x1c')];var _0x2c5325=_0x148042?_0x22eac3['count']:_0x3fb308[_0x34a0('0x1c')]+_0x3fb308[_0x34a0('0x1e')];var _0x1d00ef;if(_0x2c5325>=_0x1ae2a8){_0x2c5325=_0x1ae2a8;_0x1d00ef=0xc8;}else{_0x1d00ef=0xce;}_0x1f3d7a[_0x34a0('0x19')](_0x1d00ef);return _0x1f3d7a[_0x34a0('0x20')](_0x34a0('0x21'),_0x224cca+'-'+_0x2c5325+'/'+_0x1ae2a8)['json'](_0x22eac3);}return null;};}function patchUpdates(_0x120780){return function(_0x21aafb){try{jsonpatch[_0x34a0('0x22')](_0x21aafb,_0x120780,!![]);}catch(_0x3943e3){return BPromise[_0x34a0('0x23')](_0x3943e3);}return _0x21aafb[_0x34a0('0x24')]();};}function saveUpdates(_0x518a0c,_0x4358d2){return function(_0xd668e3){if(_0xd668e3){return _0xd668e3[_0x34a0('0x25')](_0x518a0c)[_0x34a0('0x26')](function(_0x412031){return _0x412031;});}return null;};}function removeEntity(_0xbc5c86,_0x5354c7){return function(_0x2a25dd){if(_0x2a25dd){return _0x2a25dd[_0x34a0('0x27')]()['then'](function(){_0xbc5c86[_0x34a0('0x19')](0xcc)[_0x34a0('0x1a')]();});}};}function handleEntityNotFound(_0x4fdbc3,_0x41e278){return function(_0x14b3e8){if(!_0x14b3e8){_0x4fdbc3[_0x34a0('0x28')](0x194);}return _0x14b3e8;};}function handleError(_0x213632,_0x79046f){_0x79046f=_0x79046f||0x1f4;return function(_0x5c49be){logger[_0x34a0('0x29')](_0x5c49be[_0x34a0('0x2a')]);if(_0x5c49be[_0x34a0('0x2b')]){delete _0x5c49be[_0x34a0('0x2b')];}_0x213632[_0x34a0('0x19')](_0x79046f)[_0x34a0('0x2c')](_0x5c49be);};}exports['index']=function(_0x55d52a,_0x2b4c60){var _0x599c30={},_0x333ecf={},_0x2b35c8={'count':0x0,'rows':[]};var _0x11d4d2=_[_0x34a0('0x2d')](db[_0x34a0('0x2e')][_0x34a0('0x2f')],function(_0x5821f1){return{'name':_0x5821f1[_0x34a0('0x30')],'type':_0x5821f1[_0x34a0('0x31')][_0x34a0('0x32')]};});_0x333ecf[_0x34a0('0x33')]=_[_0x34a0('0x2d')](_0x11d4d2,_0x34a0('0x2b'));_0x333ecf[_0x34a0('0x34')]=_[_0x34a0('0x35')](_0x55d52a[_0x34a0('0x34')]);_0x333ecf[_0x34a0('0x36')]=_[_0x34a0('0x37')](_0x333ecf[_0x34a0('0x33')],_0x333ecf[_0x34a0('0x34')]);_0x599c30[_0x34a0('0x38')]=_['intersection'](_0x333ecf[_0x34a0('0x33')],qs[_0x34a0('0x39')](_0x55d52a[_0x34a0('0x34')]['fields']));_0x599c30[_0x34a0('0x38')]=_0x599c30['attributes'][_0x34a0('0x3a')]?_0x599c30[_0x34a0('0x38')]:_0x333ecf[_0x34a0('0x33')];if(!_0x55d52a[_0x34a0('0x34')][_0x34a0('0x3b')](_0x34a0('0x3c'))){_0x599c30['limit']=qs[_0x34a0('0x1e')](_0x55d52a['query'][_0x34a0('0x1e')]);_0x599c30[_0x34a0('0x1c')]=qs[_0x34a0('0x1c')](_0x55d52a['query'][_0x34a0('0x1c')]);}_0x599c30[_0x34a0('0x3d')]=qs[_0x34a0('0x3e')](_0x55d52a[_0x34a0('0x34')]['sort']);_0x599c30['where']=qs[_0x34a0('0x36')](_[_0x34a0('0x3f')](_0x55d52a['query'],_0x333ecf[_0x34a0('0x36')]),_0x11d4d2);if(_0x55d52a[_0x34a0('0x34')]['filter']){_0x599c30['where']=_['merge'](_0x599c30['where'],{'$or':_[_0x34a0('0x2d')](_0x11d4d2,function(_0x371bd1){if(_0x371bd1[_0x34a0('0x31')]!==_0x34a0('0x40')){var _0x253045={};_0x253045[_0x371bd1[_0x34a0('0x2b')]]={'$like':'%'+_0x55d52a[_0x34a0('0x34')][_0x34a0('0x41')]+'%'};return _0x253045;}})});}_0x599c30=_[_0x34a0('0x42')]({},_0x599c30,_0x55d52a[_0x34a0('0x43')]);var _0x2952b4={'where':_0x599c30['where']};return db[_0x34a0('0x2e')]['count'](_0x2952b4)['then'](function(_0x152c28){_0x2b35c8[_0x34a0('0x1f')]=_0x152c28;if(_0x55d52a[_0x34a0('0x34')][_0x34a0('0x44')]){_0x599c30[_0x34a0('0x45')]=[{'all':!![]}];}return db[_0x34a0('0x2e')][_0x34a0('0x46')](_0x599c30);})[_0x34a0('0x26')](function(_0x3c736){_0x2b35c8[_0x34a0('0x47')]=_0x3c736;return _0x2b35c8;})[_0x34a0('0x26')](respondWithFilteredResult(_0x2b4c60,_0x599c30))[_0x34a0('0x48')](handleError(_0x2b4c60,null));};exports[_0x34a0('0x49')]=function(_0x442da2,_0x368af5){var _0x253018={'raw':!![],'where':{'id':_0x442da2[_0x34a0('0x4a')]['id']}},_0x5cddc3={};_0x5cddc3[_0x34a0('0x33')]=_['keys'](db[_0x34a0('0x2e')]['rawAttributes']);_0x5cddc3[_0x34a0('0x34')]=_[_0x34a0('0x35')](_0x442da2[_0x34a0('0x34')]);_0x5cddc3[_0x34a0('0x36')]=_['intersection'](_0x5cddc3['model'],_0x5cddc3['query']);_0x253018[_0x34a0('0x38')]=_[_0x34a0('0x37')](_0x5cddc3['model'],qs[_0x34a0('0x39')](_0x442da2[_0x34a0('0x34')][_0x34a0('0x39')]));_0x253018[_0x34a0('0x38')]=_0x253018[_0x34a0('0x38')][_0x34a0('0x3a')]?_0x253018[_0x34a0('0x38')]:_0x5cddc3[_0x34a0('0x33')];if(_0x442da2['query'][_0x34a0('0x44')]){_0x253018[_0x34a0('0x45')]=[{'all':!![]}];}_0x253018=_[_0x34a0('0x42')]({},_0x253018,_0x442da2[_0x34a0('0x43')]);return db[_0x34a0('0x2e')]['find'](_0x253018)[_0x34a0('0x26')](handleEntityNotFound(_0x368af5,null))[_0x34a0('0x26')](respondWithResult(_0x368af5,null))[_0x34a0('0x48')](handleError(_0x368af5,null));};exports[_0x34a0('0x4b')]=function(_0x3397b4,_0x3bfdf4){return db[_0x34a0('0x2e')][_0x34a0('0x4b')](_0x3397b4[_0x34a0('0x4c')],{})[_0x34a0('0x26')](respondWithResult(_0x3bfdf4,0xc9))['catch'](handleError(_0x3bfdf4,null));};exports[_0x34a0('0x25')]=function(_0x47cfd3,_0x1483c4){if(_0x47cfd3[_0x34a0('0x4c')]['id']){delete _0x47cfd3['body']['id'];}return db['DeskField'][_0x34a0('0x4d')]({'where':{'id':_0x47cfd3[_0x34a0('0x4a')]['id']}})[_0x34a0('0x26')](handleEntityNotFound(_0x1483c4,null))['then'](saveUpdates(_0x47cfd3['body'],null))['then'](respondWithResult(_0x1483c4,null))[_0x34a0('0x48')](handleError(_0x1483c4,null));};exports['destroy']=function(_0x1ae2a5,_0x2a5c03){return db[_0x34a0('0x2e')][_0x34a0('0x4d')]({'where':{'id':_0x1ae2a5[_0x34a0('0x4a')]['id']}})[_0x34a0('0x26')](handleEntityNotFound(_0x2a5c03,null))[_0x34a0('0x26')](removeEntity(_0x2a5c03,null))[_0x34a0('0x48')](handleError(_0x2a5c03,null));}; \ No newline at end of file +var _0x1b65=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b65,0x1b4));var _0x51b6=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0x1b65[_0x1eb5da];return _0x579a2f;};'use strict';var emlformat=require(_0x51b6('0x0'));var rimraf=require(_0x51b6('0x1'));var zipdir=require(_0x51b6('0x2'));var jsonpatch=require(_0x51b6('0x3'));var rp=require('request-promise');var moment=require(_0x51b6('0x4'));var BPromise=require(_0x51b6('0x5'));var Mustache=require(_0x51b6('0x6'));var util=require(_0x51b6('0x7'));var path=require(_0x51b6('0x8'));var sox=require(_0x51b6('0x9'));var csv=require(_0x51b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51b6('0xb'));var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0xa'));var querystring=require('querystring');var Papa=require(_0x51b6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x11'));var as=require(_0x51b6('0x12'));var hardwareService=require(_0x51b6('0x13'));var logger=require(_0x51b6('0x14'))(_0x51b6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x17')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x18')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x19')](_0x2890ee)[_0x51b6('0x1a')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=typeof _0x23549b['offset']===_0x51b6('0x1b')&&typeof _0x23549b['limit']===_0x51b6('0x1b');var _0x22ffa3=_0x596863[_0x51b6('0x1c')];var _0x3ae3c7=_0x39583d?0x0:_0x23549b[_0x51b6('0x1d')];var _0x22c6da=_0x39583d?_0x596863['count']:_0x23549b[_0x51b6('0x1d')]+_0x23549b['limit'];var _0x2974f0;if(_0x22c6da>=_0x22ffa3){_0x22c6da=_0x22ffa3;_0x2974f0=0xc8;}else{_0x2974f0=0xce;}_0x4c6cd0[_0x51b6('0x19')](_0x2974f0);return _0x4c6cd0['set'](_0x51b6('0x1e'),_0x3ae3c7+'-'+_0x22c6da+'/'+_0x22ffa3)[_0x51b6('0x1a')](_0x596863);}return null;};}function patchUpdates(_0x3fee21){return function(_0x471783){try{jsonpatch[_0x51b6('0x1f')](_0x471783,_0x3fee21,!![]);}catch(_0x663b44){return BPromise[_0x51b6('0x20')](_0x663b44);}return _0x471783[_0x51b6('0x21')]();};}function saveUpdates(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x22')](_0x4ab876)[_0x51b6('0x23')](function(_0x53e709){return _0x53e709;});}return null;};}function removeEntity(_0x3d3456,_0x3680af){return function(_0x51c013){if(_0x51c013){return _0x51c013['destroy']()[_0x51b6('0x23')](function(){_0x3d3456[_0x51b6('0x19')](0xcc)[_0x51b6('0x18')]();});}};}function handleEntityNotFound(_0x59193e,_0x4c1825){return function(_0x22b91b){if(!_0x22b91b){_0x59193e[_0x51b6('0x17')](0x194);}return _0x22b91b;};}function handleError(_0x8c0881,_0x4a5ff8){_0x4a5ff8=_0x4a5ff8||0x1f4;return function(_0x2842b2){logger[_0x51b6('0x24')](_0x2842b2[_0x51b6('0x25')]);if(_0x2842b2[_0x51b6('0x26')]){delete _0x2842b2[_0x51b6('0x26')];}_0x8c0881[_0x51b6('0x19')](_0x4a5ff8)[_0x51b6('0x27')](_0x2842b2);};}exports[_0x51b6('0x28')]=function(_0x51b505,_0x2dc770){var _0x226018={},_0x276443={},_0x48eb13={'count':0x0,'rows':[]};var _0x38f855=_[_0x51b6('0x29')](db[_0x51b6('0x2a')][_0x51b6('0x2b')],function(_0x5c7c35){return{'name':_0x5c7c35[_0x51b6('0x2c')],'type':_0x5c7c35['type'][_0x51b6('0x2d')]};});_0x276443[_0x51b6('0x2e')]=_['map'](_0x38f855,'name');_0x276443[_0x51b6('0x2f')]=_[_0x51b6('0x30')](_0x51b505['query']);_0x276443[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x276443['model'],_0x276443[_0x51b6('0x2f')]);_0x226018[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x276443['model'],qs[_0x51b6('0x34')](_0x51b505['query'][_0x51b6('0x34')]));_0x226018[_0x51b6('0x33')]=_0x226018[_0x51b6('0x33')][_0x51b6('0x35')]?_0x226018[_0x51b6('0x33')]:_0x276443[_0x51b6('0x2e')];if(!_0x51b505[_0x51b6('0x2f')][_0x51b6('0x36')]('nolimit')){_0x226018[_0x51b6('0x37')]=qs[_0x51b6('0x37')](_0x51b505['query'][_0x51b6('0x37')]);_0x226018['offset']=qs[_0x51b6('0x1d')](_0x51b505[_0x51b6('0x2f')][_0x51b6('0x1d')]);}_0x226018['order']=qs[_0x51b6('0x38')](_0x51b505[_0x51b6('0x2f')]['sort']);_0x226018[_0x51b6('0x39')]=qs[_0x51b6('0x31')](_[_0x51b6('0x3a')](_0x51b505[_0x51b6('0x2f')],_0x276443[_0x51b6('0x31')]),_0x38f855);if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x3b')]){_0x226018[_0x51b6('0x39')]=_[_0x51b6('0x3c')](_0x226018[_0x51b6('0x39')],{'$or':_[_0x51b6('0x29')](_0x38f855,function(_0x234d5e){if(_0x234d5e[_0x51b6('0x3d')]!==_0x51b6('0x3e')){var _0x28d14f={};_0x28d14f[_0x234d5e[_0x51b6('0x26')]]={'$like':'%'+_0x51b505['query'][_0x51b6('0x3b')]+'%'};return _0x28d14f;}})});}_0x226018=_['merge']({},_0x226018,_0x51b505[_0x51b6('0x3f')]);var _0x4ad444={'where':_0x226018[_0x51b6('0x39')]};return db[_0x51b6('0x2a')]['count'](_0x4ad444)[_0x51b6('0x23')](function(_0x2b6dd6){_0x48eb13['count']=_0x2b6dd6;if(_0x51b505[_0x51b6('0x2f')][_0x51b6('0x40')]){_0x226018[_0x51b6('0x41')]=[{'all':!![]}];}return db[_0x51b6('0x2a')][_0x51b6('0x42')](_0x226018);})['then'](function(_0x588a05){_0x48eb13['rows']=_0x588a05;return _0x48eb13;})[_0x51b6('0x23')](respondWithFilteredResult(_0x2dc770,_0x226018))[_0x51b6('0x43')](handleError(_0x2dc770,null));};exports[_0x51b6('0x44')]=function(_0xda309d,_0x2c3f6e){var _0x588fc6={'raw':!![],'where':{'id':_0xda309d[_0x51b6('0x45')]['id']}},_0x498717={};_0x498717[_0x51b6('0x2e')]=_[_0x51b6('0x30')](db['DeskField'][_0x51b6('0x2b')]);_0x498717['query']=_[_0x51b6('0x30')](_0xda309d['query']);_0x498717[_0x51b6('0x31')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],_0x498717['query']);_0x588fc6[_0x51b6('0x33')]=_[_0x51b6('0x32')](_0x498717[_0x51b6('0x2e')],qs[_0x51b6('0x34')](_0xda309d[_0x51b6('0x2f')]['fields']));_0x588fc6[_0x51b6('0x33')]=_0x588fc6[_0x51b6('0x33')]['length']?_0x588fc6[_0x51b6('0x33')]:_0x498717[_0x51b6('0x2e')];if(_0xda309d['query']['includeAll']){_0x588fc6['include']=[{'all':!![]}];}_0x588fc6=_['merge']({},_0x588fc6,_0xda309d['options']);return db['DeskField'][_0x51b6('0x46')](_0x588fc6)['then'](handleEntityNotFound(_0x2c3f6e,null))[_0x51b6('0x23')](respondWithResult(_0x2c3f6e,null))[_0x51b6('0x43')](handleError(_0x2c3f6e,null));};exports[_0x51b6('0x47')]=function(_0x21a7ab,_0x4562c6){return db[_0x51b6('0x2a')]['create'](_0x21a7ab[_0x51b6('0x48')],{})['then'](respondWithResult(_0x4562c6,0xc9))[_0x51b6('0x43')](handleError(_0x4562c6,null));};exports[_0x51b6('0x22')]=function(_0x594bb2,_0x44f9d4){if(_0x594bb2[_0x51b6('0x48')]['id']){delete _0x594bb2[_0x51b6('0x48')]['id'];}return db[_0x51b6('0x2a')]['find']({'where':{'id':_0x594bb2[_0x51b6('0x45')]['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x44f9d4,null))[_0x51b6('0x23')](saveUpdates(_0x594bb2[_0x51b6('0x48')],null))[_0x51b6('0x23')](respondWithResult(_0x44f9d4,null))[_0x51b6('0x43')](handleError(_0x44f9d4,null));};exports[_0x51b6('0x49')]=function(_0x3c977a,_0x27a4e4){return db[_0x51b6('0x2a')][_0x51b6('0x46')]({'where':{'id':_0x3c977a['params']['id']}})[_0x51b6('0x23')](handleEntityNotFound(_0x27a4e4,null))[_0x51b6('0x23')](removeEntity(_0x27a4e4,null))[_0x51b6('0x43')](handleError(_0x27a4e4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fe0ee94..97575ff 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 _0x8bb2=['./intDeskField.attributes','define','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','../../config/environment'];(function(_0xec2241,_0x453d5c){var _0x201e24=function(_0x3988a5){while(--_0x3988a5){_0xec2241['push'](_0xec2241['shift']());}};_0x201e24(++_0x453d5c);}(_0x8bb2,0xf7));var _0x28bb=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x8bb2[_0x4492af];return _0x216729;};'use strict';var _=require(_0x28bb('0x0'));var util=require(_0x28bb('0x1'));var logger=require(_0x28bb('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28bb('0x3'));var fs=require('fs');var path=require(_0x28bb('0x4'));var rimraf=require('rimraf');var config=require(_0x28bb('0x5'));var attributes=require(_0x28bb('0x6'));module['exports']=function(_0x42d20c,_0x4baafd){return _0x42d20c[_0x28bb('0x7')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x28bb('0x8'),'fields':[_0x28bb('0x9'),_0x28bb('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83fd=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x83fd,0x6c));var _0xd83f=function(_0x2e8679,_0x1ab847){_0x2e8679=_0x2e8679-0x0;var _0x5cc70f=_0x83fd[_0x2e8679];return _0x5cc70f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd83f('0x0'))(_0xd83f('0x1'));var moment=require(_0xd83f('0x2'));var BPromise=require(_0xd83f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd83f('0x4'));var rimraf=require(_0xd83f('0x5'));var config=require(_0xd83f('0x6'));var attributes=require(_0xd83f('0x7'));module['exports']=function(_0x334cf0,_0x3598c3){return _0x334cf0['define'](_0xd83f('0x8'),attributes,{'tableName':_0xd83f('0x9'),'paranoid':![],'indexes':[{'name':_0xd83f('0xa'),'fields':[_0xd83f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index e8d1419..1534ece 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 _0x083a=['message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0xfcc292,_0x5f2934){var _0x3467eb=function(_0x188966){while(--_0x188966){_0xfcc292['push'](_0xfcc292['shift']());}};_0x3467eb(++_0x5f2934);}(_0x083a,0x17d));var _0xa083=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x083a[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xa083('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa083('0x1'));var rs=require(_0xa083('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa083('0x3'));var logger=require(_0xa083('0x4'))(_0xa083('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa083('0x6')][_0xa083('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fb1ae,_0x15b76d,_0x10070a){return new BPromise(function(_0x45064e,_0x3964f3){return client[_0xa083('0x8')](_0x2fb1ae,_0x10070a)[_0xa083('0x9')](function(_0x33f3c7){logger[_0xa083('0xa')](_0xa083('0xb'),_0x15b76d,_0xa083('0xc'));logger['debug'](_0xa083('0xd'),_0x15b76d,_0xa083('0xc'),JSON['stringify'](_0x33f3c7));if(_0x33f3c7[_0xa083('0xe')]){if(_0x33f3c7[_0xa083('0xe')]['code']===0x1f4){logger[_0xa083('0xe')](_0xa083('0xb'),_0x15b76d,_0x33f3c7[_0xa083('0xe')][_0xa083('0xf')]);return _0x3964f3(_0x33f3c7[_0xa083('0xe')]['message']);}logger['error'](_0xa083('0xb'),_0x15b76d,_0x33f3c7[_0xa083('0xe')][_0xa083('0xf')]);return _0x45064e(_0x33f3c7['error']['message']);}else{logger[_0xa083('0xa')](_0xa083('0xb'),_0x15b76d,'request\x20sent');_0x45064e(_0x33f3c7[_0xa083('0x10')][_0xa083('0xf')]);}})[_0xa083('0x11')](function(_0x47e997){logger[_0xa083('0xe')](_0xa083('0xb'),_0x15b76d,_0x47e997);_0x3964f3(_0x47e997);});});} \ No newline at end of file +var _0xbf75=['error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d7745,_0x4fe6a6){var _0xab8b8=function(_0x424d56){while(--_0x424d56){_0x2d7745['push'](_0x2d7745['shift']());}};_0xab8b8(++_0x4fe6a6);}(_0xbf75,0x16a));var _0x5bf7=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbf75[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x5bf7('0x0'));var util=require(_0x5bf7('0x1'));var moment=require(_0x5bf7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bf7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bf7('0x4'));var logger=require('../../config/logger')(_0x5bf7('0x5'));var config=require(_0x5bf7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5bf7('0x7')][_0x5bf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b3fcd,_0x57d06c,_0x51006f){return new BPromise(function(_0x34a8b0,_0x2e69e6){return client[_0x5bf7('0x9')](_0x3b3fcd,_0x51006f)[_0x5bf7('0xa')](function(_0x5df904){logger[_0x5bf7('0xb')](_0x5bf7('0xc'),_0x57d06c,'request\x20sent');logger[_0x5bf7('0xd')](_0x5bf7('0xe'),_0x57d06c,_0x5bf7('0xf'),JSON['stringify'](_0x5df904));if(_0x5df904[_0x5bf7('0x10')]){if(_0x5df904[_0x5bf7('0x10')][_0x5bf7('0x11')]===0x1f4){logger[_0x5bf7('0x10')](_0x5bf7('0xc'),_0x57d06c,_0x5df904['error'][_0x5bf7('0x12')]);return _0x2e69e6(_0x5df904[_0x5bf7('0x10')][_0x5bf7('0x12')]);}logger[_0x5bf7('0x10')]('DeskField,\x20%s,\x20%s',_0x57d06c,_0x5df904[_0x5bf7('0x10')][_0x5bf7('0x12')]);return _0x34a8b0(_0x5df904[_0x5bf7('0x10')][_0x5bf7('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x57d06c,_0x5bf7('0xf'));_0x34a8b0(_0x5df904[_0x5bf7('0x13')][_0x5bf7('0x12')]);}})[_0x5bf7('0x14')](function(_0x1de89e){logger[_0x5bf7('0x10')](_0x5bf7('0xc'),_0x57d06c,_0x1de89e);_0x2e69e6(_0x1de89e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 78d5b8c..1b814b3 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 _0x7903=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x7903,0x82));var _0x3790=function(_0x27b9ea,_0x5a4739){_0x27b9ea=_0x27b9ea-0x0;var _0x14af85=_0x7903[_0x27b9ea];return _0x14af85;};'use strict';var multer=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var path=require(_0x3790('0x2'));var timeout=require('connect-timeout');var express=require(_0x3790('0x3'));var router=express[_0x3790('0x4')]();var fs_extra=require(_0x3790('0x5'));var auth=require(_0x3790('0x6'));var interaction=require(_0x3790('0x7'));var config=require('../../config/environment');var controller=require(_0x3790('0x8'));router[_0x3790('0x9')]('/',auth[_0x3790('0xa')](),controller[_0x3790('0xb')]);router[_0x3790('0x9')](_0x3790('0xc'),auth[_0x3790('0xa')](),controller[_0x3790('0xd')]);router[_0x3790('0x9')](_0x3790('0xe'),auth[_0x3790('0xa')](),controller[_0x3790('0xf')]);router[_0x3790('0x9')](_0x3790('0x10'),auth[_0x3790('0xa')](),controller['getFields']);router[_0x3790('0x11')]('/',auth['isAuthenticated'](),controller[_0x3790('0x12')]);router[_0x3790('0x11')](_0x3790('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3790('0x13')](_0x3790('0xc'),auth[_0x3790('0xa')](),controller['update']);router[_0x3790('0x14')](_0x3790('0xc'),auth[_0x3790('0xa')](),controller[_0x3790('0x15')]);module[_0x3790('0x16')]=router; \ No newline at end of file +var _0x5681=['getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations'];(function(_0x21bf7e,_0x37317d){var _0x44af23=function(_0x28abad){while(--_0x28abad){_0x21bf7e['push'](_0x21bf7e['shift']());}};_0x44af23(++_0x37317d);}(_0x5681,0xf0));var _0x1568=function(_0x19e467,_0x48d9c4){_0x19e467=_0x19e467-0x0;var _0x125360=_0x5681[_0x19e467];return _0x125360;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1568('0x0'));var timeout=require(_0x1568('0x1'));var express=require(_0x1568('0x2'));var router=express[_0x1568('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1568('0x4'));var interaction=require(_0x1568('0x5'));var config=require(_0x1568('0x6'));var controller=require(_0x1568('0x7'));router[_0x1568('0x8')]('/',auth[_0x1568('0x9')](),controller['index']);router[_0x1568('0x8')]('/:id',auth[_0x1568('0x9')](),controller[_0x1568('0xa')]);router[_0x1568('0x8')](_0x1568('0xb'),auth[_0x1568('0x9')](),controller[_0x1568('0xc')]);router['get'](_0x1568('0xd'),auth[_0x1568('0x9')](),controller['getFields']);router[_0x1568('0xe')]('/',auth[_0x1568('0x9')](),controller[_0x1568('0xf')]);router[_0x1568('0xe')](_0x1568('0xb'),auth[_0x1568('0x9')](),controller[_0x1568('0x10')]);router[_0x1568('0x11')](_0x1568('0x12'),auth[_0x1568('0x9')](),controller['update']);router[_0x1568('0x13')](_0x1568('0x12'),auth[_0x1568('0x9')](),controller['destroy']);module[_0x1568('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d6df741..413625b 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 _0xc0a4=['exports','STRING','BOOLEAN'];(function(_0x5cee2c,_0xce0660){var _0x4b27a9=function(_0x3e9df8){while(--_0x3e9df8){_0x5cee2c['push'](_0x5cee2c['shift']());}};_0x4b27a9(++_0xce0660);}(_0xc0a4,0x147));var _0x4c0a=function(_0xcfc35c,_0x12c6c7){_0xcfc35c=_0xcfc35c-0x0;var _0x25f596=_0xc0a4[_0xcfc35c];return _0x25f596;};'use strict';var Sequelize=require('sequelize');module[_0x4c0a('0x0')]={'name':{'type':Sequelize[_0x4c0a('0x1')]},'username':{'type':Sequelize[_0x4c0a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4c0a('0x1')]},'tenantId':{'type':Sequelize[_0x4c0a('0x1')]},'clientId':{'type':Sequelize[_0x4c0a('0x1')]},'clientSecret':{'type':Sequelize[_0x4c0a('0x1')]},'serverUrl':{'type':Sequelize[_0x4c0a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4c0a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3714=['BOOLEAN','sequelize','exports','STRING'];(function(_0x29bc09,_0x5f4229){var _0x5ef13a=function(_0x9dbc87){while(--_0x9dbc87){_0x29bc09['push'](_0x29bc09['shift']());}};_0x5ef13a(++_0x5f4229);}(_0x3714,0x95));var _0x4371=function(_0x3533cb,_0x7a5294){_0x3533cb=_0x3533cb-0x0;var _0x27ec47=_0x3714[_0x3533cb];return _0x27ec47;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4371('0x2')]},'password':{'type':Sequelize[_0x4371('0x2')]},'remoteUri':{'type':Sequelize[_0x4371('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x4371('0x2')]},'clientSecret':{'type':Sequelize[_0x4371('0x2')]},'serverUrl':{'type':Sequelize[_0x4371('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x4371('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 629a7b8..fd50575 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 _0x4fc2=['actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','password','remoteUri','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','UserLocalizedLabel','Label','Value','DisplayName','TrueOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','includeAll','findAll','rows','show','params','keys','include','options','find','create','body','catch','getConfigurations','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','accountidname','accountidyominame'];(function(_0x27b127,_0x4dd728){var _0x16f9ed=function(_0x5cfb99){while(--_0x5cfb99){_0x27b127['push'](_0x27b127['shift']());}};_0x16f9ed(++_0x4dd728);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ec64d,_0x248423){_0x4ec64d=_0x4ec64d-0x0;var _0x246fc8=_0x4fc2[_0x4ec64d];return _0x246fc8;};'use strict';var rp=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var _=require(_0x24fc('0x2'));var qs=require(_0x24fc('0x3'));var logger=require('../../config/logger')(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var integrations=require(_0x24fc('0x6'));function respondWithResult(_0x541ad2,_0x126d90){_0x126d90=_0x126d90||0xc8;return function(_0x3772eb){if(_0x3772eb){return _0x541ad2['status'](_0x126d90)[_0x24fc('0x7')](_0x3772eb);}};}function respondWithFilteredResult(_0x12d602,_0x4889f4){return function(_0x115851){if(_0x115851){var _0x22a0c8=typeof _0x4889f4[_0x24fc('0x8')]===_0x24fc('0x9')&&typeof _0x4889f4[_0x24fc('0xa')]===_0x24fc('0x9');var _0x5afdf1=_0x115851[_0x24fc('0xb')];var _0x1819a5=_0x22a0c8?0x0:_0x4889f4[_0x24fc('0x8')];var _0x133438=_0x22a0c8?_0x115851[_0x24fc('0xb')]:_0x4889f4[_0x24fc('0x8')]+_0x4889f4[_0x24fc('0xa')];var _0x9a1673;if(_0x133438>=_0x5afdf1){_0x133438=_0x5afdf1;_0x9a1673=0xc8;}else{_0x9a1673=0xce;}_0x12d602['status'](_0x9a1673);return _0x12d602[_0x24fc('0xc')](_0x24fc('0xd'),_0x1819a5+'-'+_0x133438+'/'+_0x5afdf1)['json'](_0x115851);}return null;};}function saveUpdates(_0x306873){return function(_0x76cb25){if(_0x76cb25){return _0x76cb25[_0x24fc('0xe')](_0x306873)[_0x24fc('0xf')](function(_0x30f19b){return _0x30f19b;});}return null;};}function removeEntity(_0x326276){return function(_0x537b5c){if(_0x537b5c){return _0x537b5c[_0x24fc('0x10')]()[_0x24fc('0xf')](function(){_0x326276[_0x24fc('0x11')](0xcc)[_0x24fc('0x12')]();});}};}function handleEntityNotFound(_0x4acd36){return function(_0x2ac989){if(!_0x2ac989){_0x4acd36['sendStatus'](0x194);}return _0x2ac989;};}function handleError(_0x4af098,_0x3385c7){_0x3385c7=_0x3385c7||0x1f4;return function(_0x218fb6){logger[_0x24fc('0x13')](_0x218fb6[_0x24fc('0x14')]);if(_0x218fb6['name']){delete _0x218fb6[_0x24fc('0x15')];}_0x4af098[_0x24fc('0x11')](_0x3385c7)[_0x24fc('0x16')](_0x218fb6);};}exports[_0x24fc('0x17')]=function(_0x4c5a43,_0x5eabee){var _0x4073e0={},_0x304881={},_0x5b0516={'count':0x0,'rows':[]};var _0x32a57d=_[_0x24fc('0x18')](db[_0x24fc('0x19')][_0x24fc('0x1a')],function(_0x49a0ba){return{'name':_0x49a0ba[_0x24fc('0x1b')],'type':_0x49a0ba['type'][_0x24fc('0x1c')]};});_0x304881['model']=_[_0x24fc('0x18')](_0x32a57d,_0x24fc('0x15'));_0x304881[_0x24fc('0x1d')]=_['keys'](_0x4c5a43[_0x24fc('0x1d')]);_0x304881['filters']=_[_0x24fc('0x1e')](_0x304881[_0x24fc('0x1f')],_0x304881[_0x24fc('0x1d')]);_0x4073e0[_0x24fc('0x20')]=_[_0x24fc('0x1e')](_0x304881[_0x24fc('0x1f')],qs[_0x24fc('0x21')](_0x4c5a43[_0x24fc('0x1d')][_0x24fc('0x21')]));_0x4073e0[_0x24fc('0x20')]=_0x4073e0['attributes'][_0x24fc('0x22')]?_0x4073e0[_0x24fc('0x20')]:_0x304881[_0x24fc('0x1f')];if(!_0x4c5a43['query'][_0x24fc('0x23')](_0x24fc('0x24'))){_0x4073e0[_0x24fc('0xa')]=qs[_0x24fc('0xa')](_0x4c5a43[_0x24fc('0x1d')][_0x24fc('0xa')]);_0x4073e0['offset']=qs[_0x24fc('0x8')](_0x4c5a43[_0x24fc('0x1d')][_0x24fc('0x8')]);}_0x4073e0[_0x24fc('0x25')]=qs[_0x24fc('0x26')](_0x4c5a43['query']['sort']);_0x4073e0['where']=qs[_0x24fc('0x27')](_['pick'](_0x4c5a43[_0x24fc('0x1d')],_0x304881[_0x24fc('0x27')]),_0x32a57d);if(_0x4c5a43[_0x24fc('0x1d')][_0x24fc('0x28')]){_0x4073e0['where']=_[_0x24fc('0x29')](_0x4073e0[_0x24fc('0x2a')],{'$or':_['map'](_0x32a57d,function(_0xf46cd5){if(_0xf46cd5[_0x24fc('0x2b')]!=='VIRTUAL'){var _0x48c62a={};_0x48c62a[_0xf46cd5[_0x24fc('0x15')]]={'$like':'%'+_0x4c5a43['query'][_0x24fc('0x28')]+'%'};return _0x48c62a;}})});}_0x4073e0=_[_0x24fc('0x29')]({},_0x4073e0,_0x4c5a43['options']);var _0x2ae896={'where':_0x4073e0[_0x24fc('0x2a')]};return db[_0x24fc('0x19')][_0x24fc('0xb')](_0x2ae896)[_0x24fc('0xf')](function(_0x1e205d){_0x5b0516[_0x24fc('0xb')]=_0x1e205d;if(_0x4c5a43[_0x24fc('0x1d')][_0x24fc('0x2c')]){_0x4073e0['include']=[{'all':!![]}];}return db[_0x24fc('0x19')][_0x24fc('0x2d')](_0x4073e0);})[_0x24fc('0xf')](function(_0x316aa2){_0x5b0516[_0x24fc('0x2e')]=_0x316aa2;return _0x5b0516;})['then'](respondWithFilteredResult(_0x5eabee,_0x4073e0))['catch'](handleError(_0x5eabee,null));};exports[_0x24fc('0x2f')]=function(_0x5d48fe,_0x22ef18){var _0x38798d={'raw':![],'where':{'id':_0x5d48fe[_0x24fc('0x30')]['id']}},_0x10399f={};_0x10399f['model']=_[_0x24fc('0x31')](db['Dynamics365Account'][_0x24fc('0x1a')]);_0x10399f[_0x24fc('0x1d')]=_[_0x24fc('0x31')](_0x5d48fe[_0x24fc('0x1d')]);_0x10399f[_0x24fc('0x27')]=_['intersection'](_0x10399f[_0x24fc('0x1f')],_0x10399f[_0x24fc('0x1d')]);_0x38798d[_0x24fc('0x20')]=_[_0x24fc('0x1e')](_0x10399f['model'],qs[_0x24fc('0x21')](_0x5d48fe[_0x24fc('0x1d')]['fields']));_0x38798d[_0x24fc('0x20')]=_0x38798d['attributes'][_0x24fc('0x22')]?_0x38798d[_0x24fc('0x20')]:_0x10399f[_0x24fc('0x1f')];if(_0x5d48fe[_0x24fc('0x1d')][_0x24fc('0x2c')]){_0x38798d[_0x24fc('0x32')]=[{'all':!![]}];}_0x38798d=_[_0x24fc('0x29')]({},_0x38798d,_0x5d48fe[_0x24fc('0x33')]);return db['Dynamics365Account'][_0x24fc('0x34')](_0x38798d)[_0x24fc('0xf')](handleEntityNotFound(_0x22ef18,null))[_0x24fc('0xf')](respondWithResult(_0x22ef18,null))['catch'](handleError(_0x22ef18,null));};exports[_0x24fc('0x35')]=function(_0x1e3b52,_0x4ae4a7){return db[_0x24fc('0x19')][_0x24fc('0x35')](_0x1e3b52[_0x24fc('0x36')],{})['then'](respondWithResult(_0x4ae4a7,0xc9))[_0x24fc('0x37')](handleError(_0x4ae4a7,null));};exports[_0x24fc('0xe')]=function(_0x585e48,_0x35ccef){if(_0x585e48[_0x24fc('0x36')]['id']){delete _0x585e48[_0x24fc('0x36')]['id'];}return db[_0x24fc('0x19')]['find']({'where':{'id':_0x585e48[_0x24fc('0x30')]['id']}})[_0x24fc('0xf')](handleEntityNotFound(_0x35ccef,null))[_0x24fc('0xf')](saveUpdates(_0x585e48[_0x24fc('0x36')],null))[_0x24fc('0xf')](respondWithResult(_0x35ccef,null))['catch'](handleError(_0x35ccef,null));};exports[_0x24fc('0x10')]=function(_0x1b9c90,_0x17f683){return db[_0x24fc('0x19')]['find']({'where':{'id':_0x1b9c90[_0x24fc('0x30')]['id']}})[_0x24fc('0xf')](handleEntityNotFound(_0x17f683,null))['then'](removeEntity(_0x17f683,null))['catch'](handleError(_0x17f683,null));};exports[_0x24fc('0x38')]=function(_0x5ddde2,_0x5e2979){var _0x3380b2={};var _0x5879c2={};var _0x281194;var _0x264854;return db[_0x24fc('0x19')]['findOne']({'where':{'id':_0x5ddde2[_0x24fc('0x30')]['id']}})[_0x24fc('0xf')](handleEntityNotFound(_0x5e2979,null))[_0x24fc('0xf')](function(_0x1ad8d6){if(_0x1ad8d6){_0x281194=_0x1ad8d6;_0x5879c2[_0x24fc('0x1f')]=_[_0x24fc('0x31')](db[_0x24fc('0x39')][_0x24fc('0x1a')]);_0x5879c2['query']=_['keys'](_0x5ddde2[_0x24fc('0x1d')]);_0x5879c2[_0x24fc('0x27')]=_[_0x24fc('0x1e')](_0x5879c2['model'],_0x5879c2['query']);_0x3380b2[_0x24fc('0x20')]=_[_0x24fc('0x1e')](_0x5879c2[_0x24fc('0x1f')],qs[_0x24fc('0x21')](_0x5ddde2[_0x24fc('0x1d')][_0x24fc('0x21')]));_0x3380b2[_0x24fc('0x20')]=_0x3380b2[_0x24fc('0x20')][_0x24fc('0x22')]?_0x3380b2[_0x24fc('0x20')]:_0x5879c2[_0x24fc('0x1f')];_0x3380b2[_0x24fc('0x25')]=qs['sort'](_0x5ddde2[_0x24fc('0x1d')][_0x24fc('0x26')]);_0x3380b2[_0x24fc('0x2a')]=qs[_0x24fc('0x27')](_[_0x24fc('0x3a')](_0x5ddde2['query'],_0x5879c2[_0x24fc('0x27')]));if(_0x5ddde2['query'][_0x24fc('0x28')]){_0x3380b2[_0x24fc('0x2a')]=_[_0x24fc('0x29')](_0x3380b2[_0x24fc('0x2a')],{'$or':_[_0x24fc('0x18')](_0x3380b2[_0x24fc('0x20')],function(_0x4c9216){var _0xb1fb56={};_0xb1fb56[_0x4c9216]={'$like':'%'+_0x5ddde2[_0x24fc('0x1d')][_0x24fc('0x28')]+'%'};return _0xb1fb56;})});}_0x3380b2=_[_0x24fc('0x29')]({},_0x3380b2,_0x5ddde2[_0x24fc('0x33')]);return _0x281194[_0x24fc('0x38')](_0x3380b2);}})['then'](function(_0x36d500){if(_0x36d500){_0x264854=_0x36d500[_0x24fc('0x22')];if(!_0x5ddde2[_0x24fc('0x1d')][_0x24fc('0x23')](_0x24fc('0x24'))){_0x3380b2[_0x24fc('0xa')]=qs[_0x24fc('0xa')](_0x5ddde2['query'][_0x24fc('0xa')]);_0x3380b2[_0x24fc('0x8')]=qs['offset'](_0x5ddde2[_0x24fc('0x1d')][_0x24fc('0x8')]);}return _0x281194[_0x24fc('0x38')](_0x3380b2);}})[_0x24fc('0xf')](function(_0x36e159){if(_0x36e159){return _0x36e159?{'count':_0x264854,'rows':_0x36e159}:null;}})[_0x24fc('0xf')](respondWithResult(_0x5e2979,null))['catch'](handleError(_0x5e2979,null));};exports[_0x24fc('0x3b')]=function(_0x4a0524,_0x3e9644){if(_0x4a0524[_0x24fc('0x36')]['id']){delete _0x4a0524['body']['id'];}return db[_0x24fc('0x19')]['findOne']({'where':{'id':_0x4a0524[_0x24fc('0x30')]['id']}})['then'](handleEntityNotFound(_0x3e9644,null))[_0x24fc('0xf')](function(_0x27b612){if(_0x27b612){_0x4a0524['body'][_0x24fc('0x3c')]=_0x27b612['id'];_0x4a0524['body'][_0x24fc('0x3d')]=integrations[_0x24fc('0x3e')](_0x4a0524['body'][_0x24fc('0x3f')],_0x4a0524[_0x24fc('0x36')][_0x24fc('0x2b')]);_0x4a0524[_0x24fc('0x36')][_0x24fc('0x40')]=integrations['getDescriptions'](_0x4a0524[_0x24fc('0x36')][_0x24fc('0x3f')],_0x4a0524[_0x24fc('0x36')][_0x24fc('0x2b')]);return db[_0x24fc('0x39')]['create'](_0x4a0524['body'],{'include':[{'model':db[_0x24fc('0x41')],'as':_0x24fc('0x3d')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x24fc('0xf')](respondWithResult(_0x3e9644,null))[_0x24fc('0x37')](handleError(_0x3e9644,null));};function sanitizeRemoteUri(_0x28ef6a){var _0x1c47cd=_0x28ef6a['slice'](-0x1);if(_0x1c47cd==='/')return _0x28ef6a[_0x24fc('0x42')](0x0,_0x28ef6a[_0x24fc('0x43')](_0x1c47cd));return _0x28ef6a;}function getWebApiUrl(_0x14427b){return util[_0x24fc('0x44')](_0x24fc('0x45'),_0x14427b);}exports[_0x24fc('0x46')]=function(_0x26ac2e,_0xa80507){var _0xbe136e=_0x26ac2e[_0x24fc('0x1d')][_0x24fc('0x47')];var _0x456690=_0xbe136e===_0x24fc('0x48')?_0x24fc('0x49'):_0x24fc('0x4a');var _0x54ead5='';var _0xd53778='';var _0x3cff00='';var _0x46af2a='';var _0x223ca7='';var _0x3354f5='';var _0x2eb6dc='';var _0x10d148='';var _0x4659f9=['title',_0x24fc('0x4b'),_0x24fc('0x4c'),_0x24fc('0x4d'),_0x24fc('0x4e'),'subject',_0x24fc('0x4f'),_0x24fc('0x50'),'directioncode','phonecall_activity_parties'];var _0x4f97b7=[_0x24fc('0x51'),_0x24fc('0x52'),_0x24fc('0x53'),_0x24fc('0x54'),_0x24fc('0x55'),_0x24fc('0x56'),'contractdetailidname',_0x24fc('0x57'),_0x24fc('0x58'),'createdbyexternalpartyyominame','createdbyname',_0x24fc('0x59'),_0x24fc('0x5a'),_0x24fc('0x5b'),'createdonbehalfbyyominame',_0x24fc('0x5c'),_0x24fc('0x5d'),_0x24fc('0x5e'),'emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon',_0x24fc('0x5f'),_0x24fc('0x60'),_0x24fc('0x61'),_0x24fc('0x62'),'influencescore',_0x24fc('0x63'),'lastonholdtime',_0x24fc('0x64'),'modifiedbyexternalpartyname',_0x24fc('0x65'),_0x24fc('0x66'),_0x24fc('0x67'),_0x24fc('0x68'),_0x24fc('0x69'),_0x24fc('0x6a'),_0x24fc('0x6b'),'msdyn_iotalertname',_0x24fc('0x6c'),_0x24fc('0x6d'),_0x24fc('0x6e'),'owneridname','owneridtype',_0x24fc('0x6f'),_0x24fc('0x70'),'primarycontactidname',_0x24fc('0x71'),_0x24fc('0x72'),'productidname',_0x24fc('0x73'),_0x24fc('0x74'),'resolvebykpiidname',_0x24fc('0x75'),_0x24fc('0x76'),_0x24fc('0x77'),_0x24fc('0x78'),_0x24fc('0x79'),_0x24fc('0x7a'),'socialprofileidname','statecode',_0x24fc('0x7b'),'subjectidname',_0x24fc('0x7c'),'timezoneruleversionnumber','transactioncurrencyidname',_0x24fc('0x7d'),_0x24fc('0x7e'),_0x24fc('0x7f')];var _0x22235d=_0x4659f9[_0x24fc('0x80')](_0x4f97b7);return db[_0x24fc('0x19')][_0x24fc('0x81')]({'where':{'id':_0x26ac2e[_0x24fc('0x30')]['id']},'attributes':['id','username',_0x24fc('0x82'),_0x24fc('0x83'),'tenantId','clientId',_0x24fc('0x84'),_0x24fc('0x85')],'include':[{'model':db[_0x24fc('0x86')],'as':_0x24fc('0x86'),'attributes':['id',_0x24fc('0x87'),'data7']}]})[_0x24fc('0xf')](handleEntityNotFound(_0xa80507,null))[_0x24fc('0xf')](function(_0x5ca35b){if(_0x5ca35b){if(_0x5ca35b[_0x24fc('0x85')]){_0x5ca35b[_0x24fc('0x88')]=_0x5ca35b[_0x24fc('0x86')]['data5'];_0x10d148=sanitizeRemoteUri(_0x5ca35b[_0x24fc('0x86')][_0x24fc('0x89')]);_0x2eb6dc=getWebApiUrl(_0x10d148);return _0x5ca35b;}_0x10d148=sanitizeRemoteUri(_0x5ca35b[_0x24fc('0x83')]);_0x2eb6dc=getWebApiUrl(_0x10d148);var _0x2c573b={'method':_0x24fc('0x8a'),'uri':_0x24fc('0x8b')+_0x5ca35b[_0x24fc('0x8c')]+_0x24fc('0x8d'),'form':{'client_id':_0x5ca35b[_0x24fc('0x8e')],'resource':_0x10d148,'username':_0x5ca35b['username'],'password':_0x5ca35b[_0x24fc('0x82')],'grant_type':_0x24fc('0x82'),'client_secret':_0x5ca35b[_0x24fc('0x84')]},'json':!![]};return rp(_0x2c573b);}})['then'](function(_0x5dbdb8){_0x3354f5=_0x5dbdb8['access_token'];var _0x1c6e01={'method':'GET','uri':encodeURI(_0x2eb6dc+_0x24fc('0x8f')+_0x456690+'\x27'),'headers':{'Authorization':_0x24fc('0x90')+_0x3354f5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c6e01);})[_0x24fc('0xf')](function(_0x559692){var _0x41cef7=_0x559692['value'][0x0];var _0x24e912=_0x41cef7[_0x24fc('0x91')];var _0x1ef6f3={'method':_0x24fc('0x92'),'uri':_0x2eb6dc+_0x24fc('0x93')+_0x24e912+_0x24fc('0x94'),'headers':{'Authorization':'Bearer\x20'+_0x3354f5,'If-None-Match':null,'OData-Version':_0x24fc('0x95')},'json':!![]};return rp(_0x1ef6f3);})[_0x24fc('0xf')](function(_0xfc3b92){_0x54ead5=_0xfc3b92;_0xd53778=_0x54ead5[_0x24fc('0x96')];_0xd53778=_[_0x24fc('0x97')](_0xd53778,function(_0x328d4d){return!_0x22235d[_0x24fc('0x98')](_0x328d4d[_0x24fc('0x99')]);});var _0x1b3db1=[];var _0x5f4ec2=[];_0xd53778[_0x24fc('0x9a')](function(_0x211295){if(_0x211295[_0x24fc('0x9b')]){var _0x30ed50=_0x211295['@odata.type'][_0x24fc('0x42')](_0x211295[_0x24fc('0x9b')][_0x24fc('0x43')]('.')+0x1);if(_0x30ed50==='PicklistAttributeMetadata'){_0x1b3db1[_0x24fc('0x9c')](getSelectList(_0x2eb6dc,_0xbe136e,_0x5f4ec2,_0x54ead5['MetadataId'],_0x211295['MetadataId'],_0x3354f5));}}});return Promise['all'](_0x1b3db1);})[_0x24fc('0xf')](function(_0x49c35c){_0x3cff00=_0x49c35c[0x0];var _0x29f1c1=[];var _0x1236ab=[];_0xd53778[_0x24fc('0x9a')](function(_0x10abf7){if(!_['isNil'](_0x10abf7[_0x24fc('0x9b')])){var _0x315ce4=_0x10abf7[_0x24fc('0x9b')][_0x24fc('0x42')](_0x10abf7[_0x24fc('0x9b')]['lastIndexOf']('.')+0x1);if(_0x315ce4===_0x24fc('0x9d')){_0x29f1c1[_0x24fc('0x9c')](getBooleanList(_0x2eb6dc,_0xbe136e,_0x1236ab,_0x54ead5[_0x24fc('0x91')],_0x10abf7[_0x24fc('0x91')],_0x3354f5));}}});return Promise['all'](_0x29f1c1);})['then'](function(_0x2bf22b){_0x46af2a=_0x2bf22b[0x0];var _0x4216da=[];var _0x24e27e=[];_0xd53778[_0x24fc('0x9a')](function(_0x1f263c){if(_0x1f263c['@odata.type']){var _0x44e610=_0x1f263c[_0x24fc('0x9b')][_0x24fc('0x42')](_0x1f263c['@odata.type'][_0x24fc('0x43')]('.')+0x1);if(_0x44e610===_0x24fc('0x9e')||_0x44e610===_0x24fc('0x9f')||_0x44e610===_0x24fc('0xa0')||_0x44e610===_0x24fc('0xa1')||_0x44e610==='MemoAttributeMetadata'||_0x44e610==='DateTimeAttributeMetadata'||_0x44e610==='StatusAttributeMetadata'||_0x44e610===_0x24fc('0xa2')||_0x44e610===_0x24fc('0xa3')||_0x44e610===_0x24fc('0xa4')){_0x4216da[_0x24fc('0x9c')](getInputList(_0x2eb6dc,_0xbe136e,_0x44e610,_0x24e27e,_0x54ead5[_0x24fc('0x91')],_0x1f263c[_0x24fc('0x91')],_0x3354f5));}}});return Promise[_0x24fc('0xa5')](_0x4216da);})[_0x24fc('0xf')](function(_0x382a1c){_0x223ca7=_0x382a1c[0x0];var _0xfe780b=_0x3cff00[_0x24fc('0x80')](_0x46af2a)[_0x24fc('0x80')](_0x223ca7);var _0x5d01ab={'count':_0xfe780b['length'],'rows':_0xfe780b};return _0x5d01ab;})[_0x24fc('0xf')](respondWithResult(_0xa80507,null))['catch'](function(_0x46be68){var _0x13a54e=_0x26ac2e[_0x24fc('0x1d')][_0x24fc('0xa6')]?0x1f4:_0x46be68[_0x24fc('0xa7')]||0x1f4;logger[_0x24fc('0x13')](_0x46be68[_0x24fc('0x14')]);delete _0x46be68[_0x24fc('0x15')];if(_0x13a54e===0x191){_0x13a54e=0x190;}_0xa80507[_0x24fc('0x11')](_0x13a54e)['send'](_0x26ac2e[_0x24fc('0x1d')][_0x24fc('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x46be68['statusCode']}:_0x46be68);});};function getSelectList(_0xbad618,_0x62aab6,_0x5407a9,_0x45e87a,_0x9cecee,_0x6d6162){var _0x5331c9={'method':_0x24fc('0x92'),'uri':_0xbad618+_0x24fc('0x93')+_0x45e87a+_0x24fc('0xa8')+_0x9cecee+_0x24fc('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x24fc('0x90')+_0x6d6162,'If-None-Match':null,'OData-Version':_0x24fc('0x95')},'json':!![]};return rp(_0x5331c9)[_0x24fc('0xf')](function(_0x57b679){var _0xa8768e=[];var _0x238e55=_0x57b679[_0x24fc('0xaa')]['Options'];_0x238e55[_0x24fc('0x9a')](function(_0x123ffd){_0xa8768e['push']({'name':_0x123ffd['Label'][_0x24fc('0xab')][_0x24fc('0xac')],'value':String(_0x123ffd[_0x24fc('0xad')])});});var _0x2029cd={'id':_0x62aab6+'_'+_0x57b679[_0x24fc('0x99')],'name':_0x57b679[_0x24fc('0xae')]['UserLocalizedLabel'][_0x24fc('0xac')],'custom':![],'options':_0xa8768e};_0x5407a9[_0x24fc('0x9c')](_0x2029cd);return _0x5407a9;});}function getBooleanList(_0x17a6a9,_0xdfa562,_0x6f8974,_0x39994e,_0x478e0c,_0x4018d3){var _0x4a2522={'method':'GET','uri':_0x17a6a9+_0x24fc('0x93')+_0x39994e+_0x24fc('0xa8')+_0x478e0c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x24fc('0x90')+_0x4018d3,'If-None-Match':null,'OData-Version':_0x24fc('0x95')},'json':!![]};return rp(_0x4a2522)[_0x24fc('0xf')](function(_0x41d9c7){var _0x5d35ad=[];_0x5d35ad[_0x24fc('0x9c')]({'name':_0x41d9c7[_0x24fc('0xaa')][_0x24fc('0xaf')][_0x24fc('0xac')][_0x24fc('0xab')][_0x24fc('0xac')],'value':'true'},{'name':_0x41d9c7['OptionSet']['FalseOption'][_0x24fc('0xac')][_0x24fc('0xab')]['Label'],'value':_0x24fc('0xb0')});var _0x259d4f={'id':_0xdfa562+'_'+_0x41d9c7[_0x24fc('0x99')],'name':_0x41d9c7['DisplayName'][_0x24fc('0xab')][_0x24fc('0xac')],'custom':![],'options':_0x5d35ad};_0x6f8974['push'](_0x259d4f);return _0x6f8974;});}function getInputList(_0x57f986,_0x33c581,_0x613c11,_0x2cb370,_0x480c24,_0x2e4e38,_0x4bb9cd){var _0x525f0b={'method':_0x24fc('0x92'),'uri':_0x57f986+'EntityDefinitions('+_0x480c24+')/Attributes('+_0x2e4e38+_0x24fc('0xb1')+_0x613c11+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x24fc('0x90')+_0x4bb9cd,'If-None-Match':null,'OData-Version':_0x24fc('0x95')},'json':!![]};return rp(_0x525f0b)[_0x24fc('0xf')](function(_0x11eaeb){var _0x4ae346={'id':_0x33c581+'_'+_0x11eaeb[_0x24fc('0x99')],'name':_0x11eaeb[_0x24fc('0xae')]['UserLocalizedLabel']?_0x11eaeb[_0x24fc('0xae')][_0x24fc('0xab')][_0x24fc('0xac')]:_0x11eaeb[_0x24fc('0x99')],'custom':![],'options':[]};_0x2cb370[_0x24fc('0x9c')](_0x4ae346);return _0x2cb370;});} \ No newline at end of file +var _0xdceb=['order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','owneridname','owneridtype','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','remoteUri','POST','https://login.microsoftonline.com/','clientId','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','UserLocalizedLabel','Label','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xdceb,0x160));var _0xbdce=function(_0x72ffdb,_0x26feb8){_0x72ffdb=_0x72ffdb-0x0;var _0x5f3981=_0xdceb[_0x72ffdb];return _0x5f3981;};'use strict';var rp=require('request-promise');var util=require(_0xbdce('0x0'));var _=require('lodash');var qs=require(_0xbdce('0x1'));var logger=require(_0xbdce('0x2'))(_0xbdce('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbdce('0x4'));function respondWithResult(_0x1ea360,_0x5d5527){_0x5d5527=_0x5d5527||0xc8;return function(_0x3cffac){if(_0x3cffac){return _0x1ea360[_0xbdce('0x5')](_0x5d5527)[_0xbdce('0x6')](_0x3cffac);}};}function respondWithFilteredResult(_0x524881,_0x155cc6){return function(_0x311e09){if(_0x311e09){var _0x3c7791=typeof _0x155cc6[_0xbdce('0x7')]===_0xbdce('0x8')&&typeof _0x155cc6['limit']===_0xbdce('0x8');var _0x280e9d=_0x311e09[_0xbdce('0x9')];var _0x12537e=_0x3c7791?0x0:_0x155cc6[_0xbdce('0x7')];var _0x4234d9=_0x3c7791?_0x311e09['count']:_0x155cc6[_0xbdce('0x7')]+_0x155cc6[_0xbdce('0xa')];var _0x229bbb;if(_0x4234d9>=_0x280e9d){_0x4234d9=_0x280e9d;_0x229bbb=0xc8;}else{_0x229bbb=0xce;}_0x524881['status'](_0x229bbb);return _0x524881[_0xbdce('0xb')](_0xbdce('0xc'),_0x12537e+'-'+_0x4234d9+'/'+_0x280e9d)[_0xbdce('0x6')](_0x311e09);}return null;};}function saveUpdates(_0x2bb083){return function(_0xe8d414){if(_0xe8d414){return _0xe8d414[_0xbdce('0xd')](_0x2bb083)[_0xbdce('0xe')](function(_0x6f097d){return _0x6f097d;});}return null;};}function removeEntity(_0x516deb){return function(_0x99bd75){if(_0x99bd75){return _0x99bd75[_0xbdce('0xf')]()[_0xbdce('0xe')](function(){_0x516deb[_0xbdce('0x5')](0xcc)[_0xbdce('0x10')]();});}};}function handleEntityNotFound(_0x80dff2){return function(_0x2603d9){if(!_0x2603d9){_0x80dff2[_0xbdce('0x11')](0x194);}return _0x2603d9;};}function handleError(_0x6fb06e,_0xe76f1a){_0xe76f1a=_0xe76f1a||0x1f4;return function(_0xa1fbc5){logger[_0xbdce('0x12')](_0xa1fbc5[_0xbdce('0x13')]);if(_0xa1fbc5['name']){delete _0xa1fbc5[_0xbdce('0x14')];}_0x6fb06e[_0xbdce('0x5')](_0xe76f1a)[_0xbdce('0x15')](_0xa1fbc5);};}exports[_0xbdce('0x16')]=function(_0xdce605,_0x1b28ae){var _0x367b7c={},_0x34d6a8={},_0x54f978={'count':0x0,'rows':[]};var _0x33cceb=_[_0xbdce('0x17')](db[_0xbdce('0x18')][_0xbdce('0x19')],function(_0x233a3f){return{'name':_0x233a3f[_0xbdce('0x1a')],'type':_0x233a3f[_0xbdce('0x1b')][_0xbdce('0x1c')]};});_0x34d6a8[_0xbdce('0x1d')]=_[_0xbdce('0x17')](_0x33cceb,_0xbdce('0x14'));_0x34d6a8[_0xbdce('0x1e')]=_[_0xbdce('0x1f')](_0xdce605[_0xbdce('0x1e')]);_0x34d6a8[_0xbdce('0x20')]=_[_0xbdce('0x21')](_0x34d6a8['model'],_0x34d6a8['query']);_0x367b7c[_0xbdce('0x22')]=_[_0xbdce('0x21')](_0x34d6a8['model'],qs['fields'](_0xdce605[_0xbdce('0x1e')][_0xbdce('0x23')]));_0x367b7c[_0xbdce('0x22')]=_0x367b7c[_0xbdce('0x22')][_0xbdce('0x24')]?_0x367b7c[_0xbdce('0x22')]:_0x34d6a8[_0xbdce('0x1d')];if(!_0xdce605[_0xbdce('0x1e')]['hasOwnProperty'](_0xbdce('0x25'))){_0x367b7c[_0xbdce('0xa')]=qs[_0xbdce('0xa')](_0xdce605['query']['limit']);_0x367b7c['offset']=qs[_0xbdce('0x7')](_0xdce605[_0xbdce('0x1e')][_0xbdce('0x7')]);}_0x367b7c[_0xbdce('0x26')]=qs[_0xbdce('0x27')](_0xdce605[_0xbdce('0x1e')]['sort']);_0x367b7c[_0xbdce('0x28')]=qs[_0xbdce('0x20')](_[_0xbdce('0x29')](_0xdce605['query'],_0x34d6a8[_0xbdce('0x20')]),_0x33cceb);if(_0xdce605[_0xbdce('0x1e')][_0xbdce('0x2a')]){_0x367b7c[_0xbdce('0x28')]=_[_0xbdce('0x2b')](_0x367b7c[_0xbdce('0x28')],{'$or':_[_0xbdce('0x17')](_0x33cceb,function(_0x2c9434){if(_0x2c9434[_0xbdce('0x1b')]!==_0xbdce('0x2c')){var _0x2520ed={};_0x2520ed[_0x2c9434[_0xbdce('0x14')]]={'$like':'%'+_0xdce605['query'][_0xbdce('0x2a')]+'%'};return _0x2520ed;}})});}_0x367b7c=_['merge']({},_0x367b7c,_0xdce605[_0xbdce('0x2d')]);var _0x4fdfe6={'where':_0x367b7c['where']};return db[_0xbdce('0x18')][_0xbdce('0x9')](_0x4fdfe6)['then'](function(_0xc9bb88){_0x54f978['count']=_0xc9bb88;if(_0xdce605['query']['includeAll']){_0x367b7c['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xbdce('0x2e')](_0x367b7c);})[_0xbdce('0xe')](function(_0x367a0e){_0x54f978[_0xbdce('0x2f')]=_0x367a0e;return _0x54f978;})[_0xbdce('0xe')](respondWithFilteredResult(_0x1b28ae,_0x367b7c))[_0xbdce('0x30')](handleError(_0x1b28ae,null));};exports[_0xbdce('0x31')]=function(_0x3f18aa,_0x508f8b){var _0x1d7de2={'raw':![],'where':{'id':_0x3f18aa[_0xbdce('0x32')]['id']}},_0x1f1af6={};_0x1f1af6[_0xbdce('0x1d')]=_[_0xbdce('0x1f')](db[_0xbdce('0x18')][_0xbdce('0x19')]);_0x1f1af6[_0xbdce('0x1e')]=_[_0xbdce('0x1f')](_0x3f18aa[_0xbdce('0x1e')]);_0x1f1af6[_0xbdce('0x20')]=_[_0xbdce('0x21')](_0x1f1af6['model'],_0x1f1af6[_0xbdce('0x1e')]);_0x1d7de2[_0xbdce('0x22')]=_[_0xbdce('0x21')](_0x1f1af6[_0xbdce('0x1d')],qs['fields'](_0x3f18aa[_0xbdce('0x1e')][_0xbdce('0x23')]));_0x1d7de2['attributes']=_0x1d7de2[_0xbdce('0x22')][_0xbdce('0x24')]?_0x1d7de2[_0xbdce('0x22')]:_0x1f1af6[_0xbdce('0x1d')];if(_0x3f18aa[_0xbdce('0x1e')][_0xbdce('0x33')]){_0x1d7de2[_0xbdce('0x34')]=[{'all':!![]}];}_0x1d7de2=_[_0xbdce('0x2b')]({},_0x1d7de2,_0x3f18aa[_0xbdce('0x2d')]);return db[_0xbdce('0x18')][_0xbdce('0x35')](_0x1d7de2)['then'](handleEntityNotFound(_0x508f8b,null))[_0xbdce('0xe')](respondWithResult(_0x508f8b,null))[_0xbdce('0x30')](handleError(_0x508f8b,null));};exports[_0xbdce('0x36')]=function(_0x54be45,_0xad11a7){return db[_0xbdce('0x18')][_0xbdce('0x36')](_0x54be45[_0xbdce('0x37')],{})[_0xbdce('0xe')](respondWithResult(_0xad11a7,0xc9))[_0xbdce('0x30')](handleError(_0xad11a7,null));};exports[_0xbdce('0xd')]=function(_0x5b69f0,_0x553b91){if(_0x5b69f0[_0xbdce('0x37')]['id']){delete _0x5b69f0[_0xbdce('0x37')]['id'];}return db['Dynamics365Account'][_0xbdce('0x35')]({'where':{'id':_0x5b69f0[_0xbdce('0x32')]['id']}})[_0xbdce('0xe')](handleEntityNotFound(_0x553b91,null))[_0xbdce('0xe')](saveUpdates(_0x5b69f0[_0xbdce('0x37')],null))[_0xbdce('0xe')](respondWithResult(_0x553b91,null))[_0xbdce('0x30')](handleError(_0x553b91,null));};exports[_0xbdce('0xf')]=function(_0x1649fa,_0x1c4ee3){return db[_0xbdce('0x18')][_0xbdce('0x35')]({'where':{'id':_0x1649fa[_0xbdce('0x32')]['id']}})[_0xbdce('0xe')](handleEntityNotFound(_0x1c4ee3,null))[_0xbdce('0xe')](removeEntity(_0x1c4ee3,null))[_0xbdce('0x30')](handleError(_0x1c4ee3,null));};exports[_0xbdce('0x38')]=function(_0x13a8f0,_0x3271fa){var _0x572f78={};var _0x33d60f={};var _0xdba537;var _0x3b4dc6;return db['Dynamics365Account'][_0xbdce('0x39')]({'where':{'id':_0x13a8f0[_0xbdce('0x32')]['id']}})[_0xbdce('0xe')](handleEntityNotFound(_0x3271fa,null))['then'](function(_0x577ff4){if(_0x577ff4){_0xdba537=_0x577ff4;_0x33d60f['model']=_[_0xbdce('0x1f')](db[_0xbdce('0x3a')][_0xbdce('0x19')]);_0x33d60f['query']=_['keys'](_0x13a8f0[_0xbdce('0x1e')]);_0x33d60f['filters']=_[_0xbdce('0x21')](_0x33d60f[_0xbdce('0x1d')],_0x33d60f['query']);_0x572f78['attributes']=_[_0xbdce('0x21')](_0x33d60f[_0xbdce('0x1d')],qs['fields'](_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0x23')]));_0x572f78[_0xbdce('0x22')]=_0x572f78[_0xbdce('0x22')][_0xbdce('0x24')]?_0x572f78[_0xbdce('0x22')]:_0x33d60f['model'];_0x572f78[_0xbdce('0x26')]=qs[_0xbdce('0x27')](_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0x27')]);_0x572f78['where']=qs[_0xbdce('0x20')](_['pick'](_0x13a8f0[_0xbdce('0x1e')],_0x33d60f[_0xbdce('0x20')]));if(_0x13a8f0['query'][_0xbdce('0x2a')]){_0x572f78[_0xbdce('0x28')]=_['merge'](_0x572f78[_0xbdce('0x28')],{'$or':_[_0xbdce('0x17')](_0x572f78[_0xbdce('0x22')],function(_0x3cf8a6){var _0x224c8b={};_0x224c8b[_0x3cf8a6]={'$like':'%'+_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0x2a')]+'%'};return _0x224c8b;})});}_0x572f78=_[_0xbdce('0x2b')]({},_0x572f78,_0x13a8f0[_0xbdce('0x2d')]);return _0xdba537[_0xbdce('0x38')](_0x572f78);}})[_0xbdce('0xe')](function(_0x1acdcd){if(_0x1acdcd){_0x3b4dc6=_0x1acdcd['length'];if(!_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0x3b')](_0xbdce('0x25'))){_0x572f78['limit']=qs[_0xbdce('0xa')](_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0xa')]);_0x572f78[_0xbdce('0x7')]=qs['offset'](_0x13a8f0[_0xbdce('0x1e')][_0xbdce('0x7')]);}return _0xdba537['getConfigurations'](_0x572f78);}})[_0xbdce('0xe')](function(_0x4cda8d){if(_0x4cda8d){return _0x4cda8d?{'count':_0x3b4dc6,'rows':_0x4cda8d}:null;}})[_0xbdce('0xe')](respondWithResult(_0x3271fa,null))[_0xbdce('0x30')](handleError(_0x3271fa,null));};exports[_0xbdce('0x3c')]=function(_0x16dec5,_0x3d2180){if(_0x16dec5[_0xbdce('0x37')]['id']){delete _0x16dec5[_0xbdce('0x37')]['id'];}return db[_0xbdce('0x18')][_0xbdce('0x39')]({'where':{'id':_0x16dec5[_0xbdce('0x32')]['id']}})['then'](handleEntityNotFound(_0x3d2180,null))['then'](function(_0x88aca3){if(_0x88aca3){_0x16dec5[_0xbdce('0x37')][_0xbdce('0x3d')]=_0x88aca3['id'];_0x16dec5['body'][_0xbdce('0x3e')]=integrations[_0xbdce('0x3f')](_0x16dec5[_0xbdce('0x37')][_0xbdce('0x40')],_0x16dec5[_0xbdce('0x37')][_0xbdce('0x1b')]);_0x16dec5[_0xbdce('0x37')][_0xbdce('0x41')]=integrations[_0xbdce('0x42')](_0x16dec5[_0xbdce('0x37')][_0xbdce('0x40')],_0x16dec5['body'][_0xbdce('0x1b')]);return db[_0xbdce('0x3a')][_0xbdce('0x36')](_0x16dec5['body'],{'include':[{'model':db[_0xbdce('0x43')],'as':_0xbdce('0x3e')},{'model':db['Dynamics365Field'],'as':_0xbdce('0x41')}]});}return null;})[_0xbdce('0xe')](respondWithResult(_0x3d2180,null))['catch'](handleError(_0x3d2180,null));};function sanitizeRemoteUri(_0xc53c5a){var _0x1ebc5e=_0xc53c5a[_0xbdce('0x44')](-0x1);if(_0x1ebc5e==='/')return _0xc53c5a[_0xbdce('0x45')](0x0,_0xc53c5a['lastIndexOf'](_0x1ebc5e));return _0xc53c5a;}function getWebApiUrl(_0x1ebe46){return util[_0xbdce('0x46')](_0xbdce('0x47'),_0x1ebe46);}exports[_0xbdce('0x48')]=function(_0x21a753,_0x1cfbb6){var _0x249878=_0x21a753[_0xbdce('0x1e')][_0xbdce('0x49')];var _0xd1934a=_0x249878===_0xbdce('0x4a')?_0xbdce('0x4b'):_0xbdce('0x4c');var _0x1a7bf0='';var _0x5a1ab3='';var _0x250d43='';var _0x40b342='';var _0x26226e='';var _0xfd93c4='';var _0x3ce171='';var _0x115393='';var _0x103a3a=[_0xbdce('0x4d'),'description','customerid','ownerid',_0xbdce('0x4e'),_0xbdce('0x4f'),_0xbdce('0x50'),_0xbdce('0x51'),'directioncode',_0xbdce('0x52')];var _0x2f222d=[_0xbdce('0x53'),'accountidyominame',_0xbdce('0x54'),_0xbdce('0x55'),'contactidname',_0xbdce('0x56'),_0xbdce('0x57'),_0xbdce('0x58'),_0xbdce('0x59'),_0xbdce('0x5a'),_0xbdce('0x5b'),_0xbdce('0x5c'),'createdon',_0xbdce('0x5d'),_0xbdce('0x5e'),_0xbdce('0x5f'),'customeridtype',_0xbdce('0x60'),_0xbdce('0x61'),_0xbdce('0x62'),_0xbdce('0x63'),_0xbdce('0x64'),_0xbdce('0x65'),'exchangerate',_0xbdce('0x66'),_0xbdce('0x67'),_0xbdce('0x68'),_0xbdce('0x69'),_0xbdce('0x6a'),_0xbdce('0x6b'),_0xbdce('0x6c'),_0xbdce('0x6d'),_0xbdce('0x6e'),_0xbdce('0x6f'),_0xbdce('0x70'),_0xbdce('0x71'),_0xbdce('0x72'),_0xbdce('0x73'),'msdyn_incidenttypename',_0xbdce('0x74'),'numberofchildincidents','onholdtime','overriddencreatedon',_0xbdce('0x75'),_0xbdce('0x76'),'owneridyominame',_0xbdce('0x77'),_0xbdce('0x78'),'primarycontactidyominame','prioritycodename',_0xbdce('0x79'),_0xbdce('0x7a'),_0xbdce('0x7b'),_0xbdce('0x7c'),_0xbdce('0x7d'),_0xbdce('0x7e'),_0xbdce('0x7f'),_0xbdce('0x80'),_0xbdce('0x81'),_0xbdce('0x82'),_0xbdce('0x83'),_0xbdce('0x84'),_0xbdce('0x85'),_0xbdce('0x86'),_0xbdce('0x87'),_0xbdce('0x88'),_0xbdce('0x89'),_0xbdce('0x8a'),'utcconversiontimezonecode',_0xbdce('0x8b')];var _0x4efccf=_0x103a3a[_0xbdce('0x8c')](_0x2f222d);return db['Dynamics365Account'][_0xbdce('0x39')]({'where':{'id':_0x21a753[_0xbdce('0x32')]['id']},'attributes':['id','username',_0xbdce('0x8d'),'remoteUri',_0xbdce('0x8e'),'clientId',_0xbdce('0x8f'),_0xbdce('0x90')],'include':[{'model':db[_0xbdce('0x91')],'as':_0xbdce('0x91'),'attributes':['id',_0xbdce('0x92'),_0xbdce('0x93')]}]})['then'](handleEntityNotFound(_0x1cfbb6,null))[_0xbdce('0xe')](function(_0x20f2c5){if(_0x20f2c5){if(_0x20f2c5[_0xbdce('0x90')]){_0x20f2c5['access_token']=_0x20f2c5['CloudProvider']['data5'];_0x115393=sanitizeRemoteUri(_0x20f2c5['CloudProvider']['data7']);_0x3ce171=getWebApiUrl(_0x115393);return _0x20f2c5;}_0x115393=sanitizeRemoteUri(_0x20f2c5[_0xbdce('0x94')]);_0x3ce171=getWebApiUrl(_0x115393);var _0x47f98c={'method':_0xbdce('0x95'),'uri':_0xbdce('0x96')+_0x20f2c5[_0xbdce('0x8e')]+'/oauth2/token','form':{'client_id':_0x20f2c5[_0xbdce('0x97')],'resource':_0x115393,'username':_0x20f2c5[_0xbdce('0x98')],'password':_0x20f2c5[_0xbdce('0x8d')],'grant_type':_0xbdce('0x8d'),'client_secret':_0x20f2c5['clientSecret']},'json':!![]};return rp(_0x47f98c);}})['then'](function(_0x46eadb){_0xfd93c4=_0x46eadb['access_token'];var _0x284f14={'method':_0xbdce('0x99'),'uri':encodeURI(_0x3ce171+_0xbdce('0x9a')+_0xd1934a+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xfd93c4,'If-None-Match':null,'OData-Version':_0xbdce('0x9b')},'json':!![]};return rp(_0x284f14);})[_0xbdce('0xe')](function(_0x56ecbe){var _0x1b8f4a=_0x56ecbe[_0xbdce('0x9c')][0x0];var _0x2075b4=_0x1b8f4a[_0xbdce('0x9d')];var _0x59146a={'method':'GET','uri':_0x3ce171+'EntityDefinitions('+_0x2075b4+_0xbdce('0x9e'),'headers':{'Authorization':'Bearer\x20'+_0xfd93c4,'If-None-Match':null,'OData-Version':_0xbdce('0x9b')},'json':!![]};return rp(_0x59146a);})[_0xbdce('0xe')](function(_0xc66c69){_0x1a7bf0=_0xc66c69;_0x5a1ab3=_0x1a7bf0[_0xbdce('0x9f')];_0x5a1ab3=_[_0xbdce('0xa0')](_0x5a1ab3,function(_0x4cb729){return!_0x4efccf[_0xbdce('0xa1')](_0x4cb729[_0xbdce('0xa2')]);});var _0x23de29=[];var _0x18139d=[];_0x5a1ab3[_0xbdce('0xa3')](function(_0x2ce9c9){if(_0x2ce9c9[_0xbdce('0xa4')]){var _0xf26b64=_0x2ce9c9[_0xbdce('0xa4')][_0xbdce('0x45')](_0x2ce9c9[_0xbdce('0xa4')][_0xbdce('0xa5')]('.')+0x1);if(_0xf26b64===_0xbdce('0xa6')){_0x23de29[_0xbdce('0xa7')](getSelectList(_0x3ce171,_0x249878,_0x18139d,_0x1a7bf0['MetadataId'],_0x2ce9c9[_0xbdce('0x9d')],_0xfd93c4));}}});return Promise['all'](_0x23de29);})['then'](function(_0x23fae5){_0x250d43=_0x23fae5[0x0];var _0x1f495b=[];var _0x27b100=[];_0x5a1ab3['forEach'](function(_0x2f226a){if(!_[_0xbdce('0xa8')](_0x2f226a[_0xbdce('0xa4')])){var _0x1f0056=_0x2f226a[_0xbdce('0xa4')][_0xbdce('0x45')](_0x2f226a[_0xbdce('0xa4')][_0xbdce('0xa5')]('.')+0x1);if(_0x1f0056===_0xbdce('0xa9')){_0x1f495b[_0xbdce('0xa7')](getBooleanList(_0x3ce171,_0x249878,_0x27b100,_0x1a7bf0['MetadataId'],_0x2f226a['MetadataId'],_0xfd93c4));}}});return Promise[_0xbdce('0xaa')](_0x1f495b);})[_0xbdce('0xe')](function(_0x261724){_0x40b342=_0x261724[0x0];var _0x36f6a3=[];var _0x560344=[];_0x5a1ab3[_0xbdce('0xa3')](function(_0x4c1fe2){if(_0x4c1fe2[_0xbdce('0xa4')]){var _0x42ecf6=_0x4c1fe2[_0xbdce('0xa4')][_0xbdce('0x45')](_0x4c1fe2['@odata.type'][_0xbdce('0xa5')]('.')+0x1);if(_0x42ecf6==='StringAttributeMetadata'||_0x42ecf6===_0xbdce('0xab')||_0x42ecf6==='BigIntAttributeMetadata'||_0x42ecf6===_0xbdce('0xac')||_0x42ecf6===_0xbdce('0xad')||_0x42ecf6===_0xbdce('0xae')||_0x42ecf6==='StatusAttributeMetadata'||_0x42ecf6===_0xbdce('0xaf')||_0x42ecf6==='StateAttributeMetadata'||_0x42ecf6===_0xbdce('0xb0')){_0x36f6a3[_0xbdce('0xa7')](getInputList(_0x3ce171,_0x249878,_0x42ecf6,_0x560344,_0x1a7bf0['MetadataId'],_0x4c1fe2[_0xbdce('0x9d')],_0xfd93c4));}}});return Promise[_0xbdce('0xaa')](_0x36f6a3);})[_0xbdce('0xe')](function(_0x52903c){_0x26226e=_0x52903c[0x0];var _0x5a7a53=_0x250d43[_0xbdce('0x8c')](_0x40b342)[_0xbdce('0x8c')](_0x26226e);var _0x30297a={'count':_0x5a7a53[_0xbdce('0x24')],'rows':_0x5a7a53};return _0x30297a;})['then'](respondWithResult(_0x1cfbb6,null))[_0xbdce('0x30')](function(_0x21f357){var _0x44b0f9=_0x21a753[_0xbdce('0x1e')][_0xbdce('0xb1')]?0x1f4:_0x21f357['statusCode']||0x1f4;logger['error'](_0x21f357[_0xbdce('0x13')]);delete _0x21f357[_0xbdce('0x14')];if(_0x44b0f9===0x191){_0x44b0f9=0x190;}_0x1cfbb6[_0xbdce('0x5')](_0x44b0f9)[_0xbdce('0x15')](_0x21a753[_0xbdce('0x1e')][_0xbdce('0xb1')]?{'message':_0xbdce('0xb2'),'statusCode':_0x21f357['statusCode']}:_0x21f357);});};function getSelectList(_0x441f8e,_0x42b65b,_0x516331,_0x1d5ba9,_0x2d0d52,_0x3e45f4){var _0x3b4d18={'method':_0xbdce('0x99'),'uri':_0x441f8e+'EntityDefinitions('+_0x1d5ba9+_0xbdce('0xb3')+_0x2d0d52+_0xbdce('0xb4')+_0xbdce('0xb5'),'headers':{'Authorization':_0xbdce('0xb6')+_0x3e45f4,'If-None-Match':null,'OData-Version':_0xbdce('0x9b')},'json':!![]};return rp(_0x3b4d18)[_0xbdce('0xe')](function(_0xcbf2c2){var _0x340a5f=[];var _0x3ec1f4=_0xcbf2c2[_0xbdce('0xb7')][_0xbdce('0xb8')];_0x3ec1f4[_0xbdce('0xa3')](function(_0x275cd0){_0x340a5f['push']({'name':_0x275cd0['Label'][_0xbdce('0xb9')][_0xbdce('0xba')],'value':String(_0x275cd0['Value'])});});var _0x3a7506={'id':_0x42b65b+'_'+_0xcbf2c2[_0xbdce('0xa2')],'name':_0xcbf2c2['DisplayName'][_0xbdce('0xb9')]['Label'],'custom':![],'options':_0x340a5f};_0x516331[_0xbdce('0xa7')](_0x3a7506);return _0x516331;});}function getBooleanList(_0xc36022,_0x1221b3,_0xe18a1f,_0x1d90c7,_0x2cc3f2,_0x6da940){var _0xd286f2={'method':'GET','uri':_0xc36022+_0xbdce('0xbb')+_0x1d90c7+_0xbdce('0xb3')+_0x2cc3f2+_0xbdce('0xbc'),'headers':{'Authorization':_0xbdce('0xb6')+_0x6da940,'If-None-Match':null,'OData-Version':_0xbdce('0x9b')},'json':!![]};return rp(_0xd286f2)[_0xbdce('0xe')](function(_0x116e43){var _0xb9f8b7=[];_0xb9f8b7['push']({'name':_0x116e43[_0xbdce('0xb7')][_0xbdce('0xbd')][_0xbdce('0xba')][_0xbdce('0xb9')]['Label'],'value':_0xbdce('0xbe')},{'name':_0x116e43[_0xbdce('0xb7')][_0xbdce('0xbf')][_0xbdce('0xba')][_0xbdce('0xb9')][_0xbdce('0xba')],'value':_0xbdce('0xc0')});var _0x24978c={'id':_0x1221b3+'_'+_0x116e43['LogicalName'],'name':_0x116e43[_0xbdce('0xc1')][_0xbdce('0xb9')][_0xbdce('0xba')],'custom':![],'options':_0xb9f8b7};_0xe18a1f[_0xbdce('0xa7')](_0x24978c);return _0xe18a1f;});}function getInputList(_0xcfd748,_0x44381e,_0x5d4bfb,_0x43c935,_0x16c74b,_0x5b3844,_0x1eb9e0){var _0x1a117e={'method':_0xbdce('0x99'),'uri':_0xcfd748+_0xbdce('0xbb')+_0x16c74b+_0xbdce('0xb3')+_0x5b3844+')/Microsoft.Dynamics.CRM.'+_0x5d4bfb+_0xbdce('0xc2'),'headers':{'Authorization':_0xbdce('0xb6')+_0x1eb9e0,'If-None-Match':null,'OData-Version':_0xbdce('0x9b')},'json':!![]};return rp(_0x1a117e)['then'](function(_0x346179){var _0x4f4e54={'id':_0x44381e+'_'+_0x346179[_0xbdce('0xa2')],'name':_0x346179[_0xbdce('0xc1')][_0xbdce('0xb9')]?_0x346179[_0xbdce('0xc1')]['UserLocalizedLabel'][_0xbdce('0xba')]:_0x346179[_0xbdce('0xa2')],'custom':![],'options':[]};_0x43c935[_0xbdce('0xa7')](_0x4f4e54);return _0x43c935;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5351359..6430658 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xaee1a5,_0x2b59e7){var _0x26a39d=function(_0x30159f){while(--_0x30159f){_0xaee1a5['push'](_0xaee1a5['shift']());}};_0x26a39d(++_0x2b59e7);}(_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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x46eb6a,_0x5f3d9d){var _0x1e01a0=function(_0x2725eb){while(--_0x2725eb){_0x46eb6a['push'](_0x46eb6a['shift']());}};_0x1e01a0(++_0x5f3d9d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xcb91[_0x4551f6];return _0x581dc2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e30f03b..f61e9c3 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 _0xf5ab=['jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','Dynamics365Account','options','raw','where','attributes','include','map','model','debug','GetDynamics365Account','stringify','find','ShowDynamics365Account','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x54e5e9,_0x269f98){var _0x38f8f9=function(_0x400bf2){while(--_0x400bf2){_0x54e5e9['push'](_0x54e5e9['shift']());}};_0x38f8f9(++_0x269f98);}(_0xf5ab,0x100));var _0xbf5a=function(_0xcabaa2,_0x2607f1){_0xcabaa2=_0xcabaa2-0x0;var _0x35f97c=_0xf5ab[_0xcabaa2];return _0x35f97c;};'use strict';var _=require(_0xbf5a('0x0'));var util=require(_0xbf5a('0x1'));var moment=require(_0xbf5a('0x2'));var BPromise=require(_0xbf5a('0x3'));var rs=require(_0xbf5a('0x4'));var fs=require('fs');var Redis=require(_0xbf5a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf5a('0x6'))(_0xbf5a('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf5a('0x8'));var client=jayson[_0xbf5a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8dd6,_0x3a044d,_0x37edf6){return new BPromise(function(_0x4a8904,_0x1fb38a){return client[_0xbf5a('0xa')](_0x1a8dd6,_0x37edf6)[_0xbf5a('0xb')](function(_0x65c83e){logger[_0xbf5a('0xc')](_0xbf5a('0xd'),_0x3a044d,_0xbf5a('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3a044d,_0xbf5a('0xe'),JSON['stringify'](_0x65c83e));if(_0x65c83e[_0xbf5a('0xf')]){if(_0x65c83e[_0xbf5a('0xf')][_0xbf5a('0x10')]===0x1f4){logger['error'](_0xbf5a('0xd'),_0x3a044d,_0x65c83e[_0xbf5a('0xf')]['message']);return _0x1fb38a(_0x65c83e[_0xbf5a('0xf')]['message']);}logger[_0xbf5a('0xf')](_0xbf5a('0xd'),_0x3a044d,_0x65c83e[_0xbf5a('0xf')][_0xbf5a('0x11')]);return _0x4a8904(_0x65c83e[_0xbf5a('0xf')][_0xbf5a('0x11')]);}else{logger[_0xbf5a('0xc')](_0xbf5a('0xd'),_0x3a044d,_0xbf5a('0xe'));_0x4a8904(_0x65c83e[_0xbf5a('0x12')]['message']);}})['catch'](function(_0x103cf3){logger[_0xbf5a('0xf')](_0xbf5a('0xd'),_0x3a044d,_0x103cf3);_0x1fb38a(_0x103cf3);});});}exports['GetDynamics365Account']=function(_0x52f69c){var _0x46d41a=this;return new Promise(function(_0x5f56b4,_0x4a5668){return db[_0xbf5a('0x13')]['findAll']({'raw':_0x52f69c[_0xbf5a('0x14')]?_0x52f69c[_0xbf5a('0x14')][_0xbf5a('0x15')]===undefined?!![]:![]:!![],'where':_0x52f69c[_0xbf5a('0x14')]?_0x52f69c[_0xbf5a('0x14')][_0xbf5a('0x16')]||null:null,'attributes':_0x52f69c[_0xbf5a('0x14')]?_0x52f69c[_0xbf5a('0x14')][_0xbf5a('0x17')]||null:null,'limit':_0x52f69c[_0xbf5a('0x14')]?_0x52f69c[_0xbf5a('0x14')]['limit']||null:null,'include':_0x52f69c[_0xbf5a('0x14')]?_0x52f69c[_0xbf5a('0x14')][_0xbf5a('0x18')]?_[_0xbf5a('0x19')](_0x52f69c[_0xbf5a('0x14')][_0xbf5a('0x18')],function(_0x23e7d4){return{'model':db[_0x23e7d4[_0xbf5a('0x1a')]],'as':_0x23e7d4['as'],'attributes':_0x23e7d4[_0xbf5a('0x17')],'include':_0x23e7d4[_0xbf5a('0x18')]?_[_0xbf5a('0x19')](_0x23e7d4[_0xbf5a('0x18')],function(_0x5970d0){return{'model':db[_0x5970d0[_0xbf5a('0x1a')]],'as':_0x5970d0['as'],'attributes':_0x5970d0[_0xbf5a('0x17')],'include':_0x5970d0[_0xbf5a('0x18')]?_[_0xbf5a('0x19')](_0x5970d0[_0xbf5a('0x18')],function(_0x3c6479){return{'model':db[_0x3c6479[_0xbf5a('0x1a')]],'as':_0x3c6479['as'],'attributes':_0x3c6479[_0xbf5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbf5a('0xb')](function(_0x1d6a73){logger[_0xbf5a('0xc')]('GetDynamics365Account',_0x52f69c);logger[_0xbf5a('0x1b')](_0xbf5a('0x1c'),_0x52f69c,JSON[_0xbf5a('0x1d')](_0x1d6a73));_0x5f56b4(_0x1d6a73);})['catch'](function(_0x15a177){logger[_0xbf5a('0xf')](_0xbf5a('0x1c'),_0x15a177[_0xbf5a('0x11')],_0x52f69c);_0x4a5668(_0x46d41a[_0xbf5a('0xf')](0x1f4,_0x15a177[_0xbf5a('0x11')]));});});};exports['ShowDynamics365Account']=function(_0x1cf167){var _0x1e1edb=this;return new Promise(function(_0x4631f7,_0x15deea){return db[_0xbf5a('0x13')][_0xbf5a('0x1e')]({'raw':_0x1cf167[_0xbf5a('0x14')]?_0x1cf167[_0xbf5a('0x14')][_0xbf5a('0x15')]===undefined?!![]:![]:!![],'where':_0x1cf167[_0xbf5a('0x14')]?_0x1cf167[_0xbf5a('0x14')][_0xbf5a('0x16')]||null:null,'attributes':_0x1cf167[_0xbf5a('0x14')]?_0x1cf167['options'][_0xbf5a('0x17')]||null:null,'include':_0x1cf167[_0xbf5a('0x14')]?_0x1cf167[_0xbf5a('0x14')][_0xbf5a('0x18')]?_[_0xbf5a('0x19')](_0x1cf167[_0xbf5a('0x14')][_0xbf5a('0x18')],function(_0x264cc6){return{'model':db[_0x264cc6[_0xbf5a('0x1a')]],'as':_0x264cc6['as'],'attributes':_0x264cc6[_0xbf5a('0x17')],'include':_0x264cc6[_0xbf5a('0x18')]?_['map'](_0x264cc6[_0xbf5a('0x18')],function(_0x3bce60){return{'model':db[_0x3bce60[_0xbf5a('0x1a')]],'as':_0x3bce60['as'],'attributes':_0x3bce60[_0xbf5a('0x17')],'include':_0x3bce60[_0xbf5a('0x18')]?_[_0xbf5a('0x19')](_0x3bce60[_0xbf5a('0x18')],function(_0x34ab90){return{'model':db[_0x34ab90[_0xbf5a('0x1a')]],'as':_0x34ab90['as'],'attributes':_0x34ab90['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf5a('0xb')](function(_0x45f1fb){logger['info'](_0xbf5a('0x1f'),_0x1cf167);logger[_0xbf5a('0x1b')](_0xbf5a('0x1f'),_0x1cf167,JSON[_0xbf5a('0x1d')](_0x45f1fb));_0x4631f7(_0x45f1fb);})[_0xbf5a('0x20')](function(_0x3b3838){logger[_0xbf5a('0xf')](_0xbf5a('0x1f'),_0x3b3838[_0xbf5a('0x11')],_0x1cf167);_0x15deea(_0x1e1edb[_0xbf5a('0xf')](0x1f4,_0x3b3838[_0xbf5a('0x11')]));});});}; \ No newline at end of file +var _0x7ce3=['rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','then','GetDynamics365Account','stringify','find','map','ShowDynamics365Account','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x13b094,_0x5c783f){var _0xa947ce=function(_0x1ed666){while(--_0x1ed666){_0x13b094['push'](_0x13b094['shift']());}};_0xa947ce(++_0x5c783f);}(_0x7ce3,0xaa));var _0x37ce=function(_0xb15c26,_0x4177bf){_0xb15c26=_0xb15c26-0x0;var _0x1e96d2=_0x7ce3[_0xb15c26];return _0x1e96d2;};'use strict';var _=require(_0x37ce('0x0'));var util=require('util');var moment=require(_0x37ce('0x1'));var BPromise=require(_0x37ce('0x2'));var rs=require(_0x37ce('0x3'));var fs=require('fs');var Redis=require(_0x37ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37ce('0x5'));var config=require(_0x37ce('0x6'));var jayson=require(_0x37ce('0x7'));var client=jayson['client'][_0x37ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27d336,_0x2ecb43,_0x5cea25){return new BPromise(function(_0x4e61fc,_0x5bc82e){return client[_0x37ce('0x9')](_0x27d336,_0x5cea25)['then'](function(_0x478a2f){logger[_0x37ce('0xa')](_0x37ce('0xb'),_0x2ecb43,'request\x20sent');logger[_0x37ce('0xc')](_0x37ce('0xd'),_0x2ecb43,_0x37ce('0xe'),JSON['stringify'](_0x478a2f));if(_0x478a2f[_0x37ce('0xf')]){if(_0x478a2f['error'][_0x37ce('0x10')]===0x1f4){logger['error'](_0x37ce('0xb'),_0x2ecb43,_0x478a2f[_0x37ce('0xf')][_0x37ce('0x11')]);return _0x5bc82e(_0x478a2f[_0x37ce('0xf')][_0x37ce('0x11')]);}logger[_0x37ce('0xf')](_0x37ce('0xb'),_0x2ecb43,_0x478a2f[_0x37ce('0xf')]['message']);return _0x4e61fc(_0x478a2f['error']['message']);}else{logger[_0x37ce('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x2ecb43,'request\x20sent');_0x4e61fc(_0x478a2f[_0x37ce('0x12')][_0x37ce('0x11')]);}})[_0x37ce('0x13')](function(_0x5a7dcd){logger[_0x37ce('0xf')](_0x37ce('0xb'),_0x2ecb43,_0x5a7dcd);_0x5bc82e(_0x5a7dcd);});});}exports['GetDynamics365Account']=function(_0x4591e6){var _0x6aa6b7=this;return new Promise(function(_0x7155bd,_0x37a175){return db[_0x37ce('0x14')][_0x37ce('0x15')]({'raw':_0x4591e6['options']?_0x4591e6[_0x37ce('0x16')][_0x37ce('0x17')]===undefined?!![]:![]:!![],'where':_0x4591e6[_0x37ce('0x16')]?_0x4591e6[_0x37ce('0x16')][_0x37ce('0x18')]||null:null,'attributes':_0x4591e6[_0x37ce('0x16')]?_0x4591e6['options'][_0x37ce('0x19')]||null:null,'limit':_0x4591e6[_0x37ce('0x16')]?_0x4591e6[_0x37ce('0x16')][_0x37ce('0x1a')]||null:null,'include':_0x4591e6[_0x37ce('0x16')]?_0x4591e6[_0x37ce('0x16')][_0x37ce('0x1b')]?_['map'](_0x4591e6[_0x37ce('0x16')]['include'],function(_0x20e058){return{'model':db[_0x20e058[_0x37ce('0x1c')]],'as':_0x20e058['as'],'attributes':_0x20e058[_0x37ce('0x19')],'include':_0x20e058[_0x37ce('0x1b')]?_['map'](_0x20e058[_0x37ce('0x1b')],function(_0x3589f8){return{'model':db[_0x3589f8[_0x37ce('0x1c')]],'as':_0x3589f8['as'],'attributes':_0x3589f8[_0x37ce('0x19')],'include':_0x3589f8[_0x37ce('0x1b')]?_['map'](_0x3589f8[_0x37ce('0x1b')],function(_0xc4737a){return{'model':db[_0xc4737a['model']],'as':_0xc4737a['as'],'attributes':_0xc4737a[_0x37ce('0x19')]};}):[]};}):[]};}):[]:[]})[_0x37ce('0x1d')](function(_0x1f6c46){logger[_0x37ce('0xa')](_0x37ce('0x1e'),_0x4591e6);logger[_0x37ce('0xc')]('GetDynamics365Account',_0x4591e6,JSON[_0x37ce('0x1f')](_0x1f6c46));_0x7155bd(_0x1f6c46);})[_0x37ce('0x13')](function(_0x5520ab){logger[_0x37ce('0xf')]('GetDynamics365Account',_0x5520ab[_0x37ce('0x11')],_0x4591e6);_0x37a175(_0x6aa6b7['error'](0x1f4,_0x5520ab['message']));});});};exports['ShowDynamics365Account']=function(_0x4924fd){var _0xf71b57=this;return new Promise(function(_0x3b3157,_0x5977fa){return db[_0x37ce('0x14')][_0x37ce('0x20')]({'raw':_0x4924fd['options']?_0x4924fd[_0x37ce('0x16')][_0x37ce('0x17')]===undefined?!![]:![]:!![],'where':_0x4924fd[_0x37ce('0x16')]?_0x4924fd['options'][_0x37ce('0x18')]||null:null,'attributes':_0x4924fd['options']?_0x4924fd[_0x37ce('0x16')][_0x37ce('0x19')]||null:null,'include':_0x4924fd['options']?_0x4924fd[_0x37ce('0x16')][_0x37ce('0x1b')]?_[_0x37ce('0x21')](_0x4924fd['options'][_0x37ce('0x1b')],function(_0xd894e7){return{'model':db[_0xd894e7[_0x37ce('0x1c')]],'as':_0xd894e7['as'],'attributes':_0xd894e7[_0x37ce('0x19')],'include':_0xd894e7['include']?_[_0x37ce('0x21')](_0xd894e7['include'],function(_0x36a8f9){return{'model':db[_0x36a8f9[_0x37ce('0x1c')]],'as':_0x36a8f9['as'],'attributes':_0x36a8f9[_0x37ce('0x19')],'include':_0x36a8f9[_0x37ce('0x1b')]?_[_0x37ce('0x21')](_0x36a8f9['include'],function(_0x50d90e){return{'model':db[_0x50d90e[_0x37ce('0x1c')]],'as':_0x50d90e['as'],'attributes':_0x50d90e[_0x37ce('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e5dc){logger['info'](_0x37ce('0x22'),_0x4924fd);logger[_0x37ce('0xc')](_0x37ce('0x22'),_0x4924fd,JSON[_0x37ce('0x1f')](_0x59e5dc));_0x3b3157(_0x59e5dc);})['catch'](function(_0xacdb40){logger[_0x37ce('0xf')](_0x37ce('0x22'),_0xacdb40['message'],_0x4924fd);_0x5977fa(_0xf71b57['error'](0x1f4,_0xacdb40['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 460e7e9..67dc04b 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 _0xe306=['express','Router','fs-extra','isAuthenticated','index','/:id','show','get','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1e8fd2,_0x2ab84b){var _0x389a37=function(_0x21fb8c){while(--_0x21fb8c){_0x1e8fd2['push'](_0x1e8fd2['shift']());}};_0x389a37(++_0x2ab84b);}(_0xe306,0xad));var _0x6e30=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0xe306[_0x1d6a82];return _0x5834ac;};'use strict';var multer=require(_0x6e30('0x0'));var util=require(_0x6e30('0x1'));var path=require('path');var timeout=require(_0x6e30('0x2'));var express=require(_0x6e30('0x3'));var router=express[_0x6e30('0x4')]();var fs_extra=require(_0x6e30('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x6e30('0x6')](),controller[_0x6e30('0x7')]);router['get'](_0x6e30('0x8'),auth['isAuthenticated'](),controller[_0x6e30('0x9')]);router[_0x6e30('0xa')](_0x6e30('0xb'),auth[_0x6e30('0x6')](),controller['getFields']);router[_0x6e30('0xa')](_0x6e30('0xc'),auth['isAuthenticated'](),controller[_0x6e30('0xd')]);router[_0x6e30('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6e30('0xe')]);router[_0x6e30('0xf')]('/',auth[_0x6e30('0x6')](),controller[_0x6e30('0x10')]);router[_0x6e30('0x11')](_0x6e30('0x8'),auth[_0x6e30('0x6')](),controller[_0x6e30('0x12')]);router[_0x6e30('0x13')]('/:id',auth[_0x6e30('0x6')](),controller[_0x6e30('0x14')]);module[_0x6e30('0x15')]=router; \ No newline at end of file +var _0x5b0a=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer'];(function(_0x48ccc1,_0x55e9cb){var _0x9ffe13=function(_0x323a36){while(--_0x323a36){_0x48ccc1['push'](_0x48ccc1['shift']());}};_0x9ffe13(++_0x55e9cb);}(_0x5b0a,0x1af));var _0xa5b0=function(_0x50f177,_0x745f41){_0x50f177=_0x50f177-0x0;var _0x2a437a=_0x5b0a[_0x50f177];return _0x2a437a;};'use strict';var multer=require(_0xa5b0('0x0'));var util=require(_0xa5b0('0x1'));var path=require(_0xa5b0('0x2'));var timeout=require(_0xa5b0('0x3'));var express=require('express');var router=express[_0xa5b0('0x4')]();var fs_extra=require(_0xa5b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa5b0('0x6'));var config=require(_0xa5b0('0x7'));var controller=require(_0xa5b0('0x8'));router['get']('/',auth[_0xa5b0('0x9')](),controller['index']);router['get'](_0xa5b0('0xa'),auth['isAuthenticated'](),controller[_0xa5b0('0xb')]);router[_0xa5b0('0xc')](_0xa5b0('0xd'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0xe')]);router[_0xa5b0('0xc')](_0xa5b0('0xf'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x10')]);router[_0xa5b0('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa5b0('0x11')]);router[_0xa5b0('0x12')]('/',auth[_0xa5b0('0x9')](),controller['create']);router[_0xa5b0('0x13')](_0xa5b0('0xa'),auth['isAuthenticated'](),controller[_0xa5b0('0x14')]);router[_0xa5b0('0x15')]('/:id',auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x16')]);module[_0xa5b0('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 956b3d8..502f6eb 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 _0x6c39=['exports','STRING','incident','phonecall','ENUM','contact','nothing','sequelize'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x6c39,0x12f));var _0x96c3=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6c39[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0x96c3('0x0'));module[_0x96c3('0x1')]={'name':{'type':Sequelize[_0x96c3('0x2')]},'description':{'type':Sequelize[_0x96c3('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x96c3('0x3'),_0x96c3('0x4')),'defaultValue':_0x96c3('0x3')},'moduleCreate':{'type':Sequelize[_0x96c3('0x5')](_0x96c3('0x6'),_0x96c3('0x7')),'defaultValue':_0x96c3('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xa639=['exports','STRING','ENUM','incident','nothing'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa639,0x177));var _0x9a63=function(_0xa3059,_0x134e4a){_0xa3059=_0xa3059-0x0;var _0x57d2ed=_0xa639[_0xa3059];return _0x57d2ed;};'use strict';var Sequelize=require('sequelize');module[_0x9a63('0x0')]={'name':{'type':Sequelize[_0x9a63('0x1')]},'description':{'type':Sequelize[_0x9a63('0x1')]},'ticketType':{'type':Sequelize[_0x9a63('0x2')](_0x9a63('0x3'),'phonecall'),'defaultValue':_0x9a63('0x3')},'moduleCreate':{'type':Sequelize[_0x9a63('0x2')]('contact',_0x9a63('0x4')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9428a63..1187019 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 _0xc652=['Dynamics365Configuration','includeAll','include','findAll','catch','show','params','length','options','find','create','body','getFields','findOne','Dynamics365Field','pick','nolimit','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','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','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter'];(function(_0x275311,_0x502951){var _0xaf85aa=function(_0x1d1be7){while(--_0x1d1be7){_0x275311['push'](_0x275311['shift']());}};_0xaf85aa(++_0x502951);}(_0xc652,0x1ae));var _0x2c65=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0xc652[_0x4cefc3];return _0x1cc779;};'use strict';var emlformat=require(_0x2c65('0x0'));var rimraf=require(_0x2c65('0x1'));var zipdir=require(_0x2c65('0x2'));var jsonpatch=require(_0x2c65('0x3'));var rp=require(_0x2c65('0x4'));var moment=require('moment');var BPromise=require(_0x2c65('0x5'));var Mustache=require(_0x2c65('0x6'));var util=require(_0x2c65('0x7'));var path=require('path');var sox=require(_0x2c65('0x8'));var csv=require('to-csv');var ejs=require(_0x2c65('0x9'));var fs=require('fs');var fs_extra=require(_0x2c65('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c65('0xb'));var jsforce=require(_0x2c65('0xc'));var deskjs=require(_0x2c65('0xd'));var toCsv=require(_0x2c65('0xe'));var querystring=require(_0x2c65('0xf'));var Papa=require(_0x2c65('0x10'));var Redis=require(_0x2c65('0x11'));var authService=require(_0x2c65('0x12'));var qs=require(_0x2c65('0x13'));var as=require(_0x2c65('0x14'));var hardwareService=require(_0x2c65('0x15'));var logger=require('../../config/logger')(_0x2c65('0x16'));var utils=require('../../config/utils');var config=require(_0x2c65('0x17'));var licenseUtil=require(_0x2c65('0x18'));var db=require(_0x2c65('0x19'))['db'];function respondWithStatusCode(_0x5f502e,_0x52282e){_0x52282e=_0x52282e||0xcc;return function(_0x52d17d){if(_0x52d17d){return _0x5f502e[_0x2c65('0x1a')](_0x52282e);}return _0x5f502e[_0x2c65('0x1b')](_0x52282e)['end']();};}function respondWithResult(_0xe304b,_0x11e532){_0x11e532=_0x11e532||0xc8;return function(_0x404a61){if(_0x404a61){return _0xe304b[_0x2c65('0x1b')](_0x11e532)[_0x2c65('0x1c')](_0x404a61);}};}function respondWithFilteredResult(_0x629b9d,_0x3a687b){return function(_0xf44257){if(_0xf44257){var _0x4c8ffb=typeof _0x3a687b['offset']===_0x2c65('0x1d')&&typeof _0x3a687b[_0x2c65('0x1e')]===_0x2c65('0x1d');var _0x4077b8=_0xf44257[_0x2c65('0x1f')];var _0x48d255=_0x4c8ffb?0x0:_0x3a687b[_0x2c65('0x20')];var _0x1df4ca=_0x4c8ffb?_0xf44257[_0x2c65('0x1f')]:_0x3a687b[_0x2c65('0x20')]+_0x3a687b['limit'];var _0x30ad66;if(_0x1df4ca>=_0x4077b8){_0x1df4ca=_0x4077b8;_0x30ad66=0xc8;}else{_0x30ad66=0xce;}_0x629b9d[_0x2c65('0x1b')](_0x30ad66);return _0x629b9d[_0x2c65('0x21')](_0x2c65('0x22'),_0x48d255+'-'+_0x1df4ca+'/'+_0x4077b8)[_0x2c65('0x1c')](_0xf44257);}return null;};}function patchUpdates(_0x4bb73a){return function(_0x58d36b){try{jsonpatch['apply'](_0x58d36b,_0x4bb73a,!![]);}catch(_0xa385dd){return BPromise[_0x2c65('0x23')](_0xa385dd);}return _0x58d36b[_0x2c65('0x24')]();};}function saveUpdates(_0x8cd0ca,_0xe63843){return function(_0x299621){if(_0x299621){return _0x299621[_0x2c65('0x25')](_0x8cd0ca)[_0x2c65('0x26')](function(_0x593ece){return _0x593ece;});}return null;};}function removeEntity(_0x437992,_0x2ffd74){return function(_0x1da0c2){if(_0x1da0c2){return _0x1da0c2[_0x2c65('0x27')]()[_0x2c65('0x26')](function(){_0x437992[_0x2c65('0x1b')](0xcc)[_0x2c65('0x28')]();});}};}function handleEntityNotFound(_0x506e63,_0x50e2ef){return function(_0x4752c2){if(!_0x4752c2){_0x506e63[_0x2c65('0x1a')](0x194);}return _0x4752c2;};}function handleError(_0x101457,_0x4269c2){_0x4269c2=_0x4269c2||0x1f4;return function(_0x4d4076){logger[_0x2c65('0x29')](_0x4d4076[_0x2c65('0x2a')]);if(_0x4d4076[_0x2c65('0x2b')]){delete _0x4d4076[_0x2c65('0x2b')];}_0x101457['status'](_0x4269c2)[_0x2c65('0x2c')](_0x4d4076);};}exports[_0x2c65('0x2d')]=function(_0x119609,_0x32c78d){var _0x1cbca0={},_0x37723c={},_0x1215cf={'count':0x0,'rows':[]};var _0x14096f=_[_0x2c65('0x2e')](db['Dynamics365Configuration'][_0x2c65('0x2f')],function(_0x483e41){return{'name':_0x483e41[_0x2c65('0x30')],'type':_0x483e41['type']['key']};});_0x37723c['model']=_[_0x2c65('0x2e')](_0x14096f,'name');_0x37723c[_0x2c65('0x31')]=_[_0x2c65('0x32')](_0x119609['query']);_0x37723c[_0x2c65('0x33')]=_[_0x2c65('0x34')](_0x37723c[_0x2c65('0x35')],_0x37723c[_0x2c65('0x31')]);_0x1cbca0[_0x2c65('0x36')]=_[_0x2c65('0x34')](_0x37723c['model'],qs[_0x2c65('0x37')](_0x119609[_0x2c65('0x31')][_0x2c65('0x37')]));_0x1cbca0[_0x2c65('0x36')]=_0x1cbca0['attributes']['length']?_0x1cbca0['attributes']:_0x37723c[_0x2c65('0x35')];if(!_0x119609[_0x2c65('0x31')][_0x2c65('0x38')]('nolimit')){_0x1cbca0['limit']=qs['limit'](_0x119609['query'][_0x2c65('0x1e')]);_0x1cbca0['offset']=qs['offset'](_0x119609[_0x2c65('0x31')][_0x2c65('0x20')]);}_0x1cbca0['order']=qs[_0x2c65('0x39')](_0x119609[_0x2c65('0x31')][_0x2c65('0x39')]);_0x1cbca0[_0x2c65('0x3a')]=qs['filters'](_['pick'](_0x119609['query'],_0x37723c[_0x2c65('0x33')]),_0x14096f);if(_0x119609[_0x2c65('0x31')]['filter']){_0x1cbca0[_0x2c65('0x3a')]=_[_0x2c65('0x3b')](_0x1cbca0[_0x2c65('0x3a')],{'$or':_[_0x2c65('0x2e')](_0x14096f,function(_0xd5f905){if(_0xd5f905['type']!==_0x2c65('0x3c')){var _0x51250f={};_0x51250f[_0xd5f905['name']]={'$like':'%'+_0x119609['query'][_0x2c65('0x3d')]+'%'};return _0x51250f;}})});}_0x1cbca0=_[_0x2c65('0x3b')]({},_0x1cbca0,_0x119609['options']);var _0x1d6b21={'where':_0x1cbca0[_0x2c65('0x3a')]};return db[_0x2c65('0x3e')][_0x2c65('0x1f')](_0x1d6b21)[_0x2c65('0x26')](function(_0x1ae520){_0x1215cf['count']=_0x1ae520;if(_0x119609[_0x2c65('0x31')][_0x2c65('0x3f')]){_0x1cbca0[_0x2c65('0x40')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2c65('0x41')](_0x1cbca0);})['then'](function(_0x21441b){_0x1215cf['rows']=_0x21441b;return _0x1215cf;})[_0x2c65('0x26')](respondWithFilteredResult(_0x32c78d,_0x1cbca0))[_0x2c65('0x42')](handleError(_0x32c78d,null));};exports[_0x2c65('0x43')]=function(_0x5066a3,_0x5f2bbb){var _0x3ac6e2={'raw':![],'where':{'id':_0x5066a3[_0x2c65('0x44')]['id']}},_0x4f39c8={};_0x4f39c8[_0x2c65('0x35')]=_[_0x2c65('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0x4f39c8['query']=_[_0x2c65('0x32')](_0x5066a3[_0x2c65('0x31')]);_0x4f39c8[_0x2c65('0x33')]=_[_0x2c65('0x34')](_0x4f39c8[_0x2c65('0x35')],_0x4f39c8['query']);_0x3ac6e2[_0x2c65('0x36')]=_[_0x2c65('0x34')](_0x4f39c8[_0x2c65('0x35')],qs['fields'](_0x5066a3[_0x2c65('0x31')][_0x2c65('0x37')]));_0x3ac6e2[_0x2c65('0x36')]=_0x3ac6e2[_0x2c65('0x36')][_0x2c65('0x45')]?_0x3ac6e2['attributes']:_0x4f39c8['model'];if(_0x5066a3[_0x2c65('0x31')][_0x2c65('0x3f')]){_0x3ac6e2['include']=[{'all':!![]}];}_0x3ac6e2=_[_0x2c65('0x3b')]({},_0x3ac6e2,_0x5066a3[_0x2c65('0x46')]);return db[_0x2c65('0x3e')][_0x2c65('0x47')](_0x3ac6e2)['then'](handleEntityNotFound(_0x5f2bbb,null))[_0x2c65('0x26')](respondWithResult(_0x5f2bbb,null))[_0x2c65('0x42')](handleError(_0x5f2bbb,null));};exports[_0x2c65('0x48')]=function(_0x4023a5,_0x41a4d8){return db[_0x2c65('0x3e')][_0x2c65('0x48')](_0x4023a5[_0x2c65('0x49')],{})[_0x2c65('0x26')](respondWithResult(_0x41a4d8,0xc9))['catch'](handleError(_0x41a4d8,null));};exports[_0x2c65('0x25')]=function(_0x4b5233,_0x7b5e24){if(_0x4b5233[_0x2c65('0x49')]['id']){delete _0x4b5233[_0x2c65('0x49')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x4b5233[_0x2c65('0x44')]['id']}})[_0x2c65('0x26')](handleEntityNotFound(_0x7b5e24,null))[_0x2c65('0x26')](saveUpdates(_0x4b5233['body'],null))['then'](respondWithResult(_0x7b5e24,null))[_0x2c65('0x42')](handleError(_0x7b5e24,null));};exports[_0x2c65('0x27')]=function(_0x575cd4,_0x3fdfec){return db[_0x2c65('0x3e')][_0x2c65('0x47')]({'where':{'id':_0x575cd4[_0x2c65('0x44')]['id']}})[_0x2c65('0x26')](handleEntityNotFound(_0x3fdfec,null))[_0x2c65('0x26')](removeEntity(_0x3fdfec,null))[_0x2c65('0x42')](handleError(_0x3fdfec,null));};exports[_0x2c65('0x4a')]=function(_0x36175c,_0x1ba7ac,_0x1cfaec){var _0xc714ed={};var _0x22c658={};var _0x230ab1;var _0x3a9b6b;return db[_0x2c65('0x3e')][_0x2c65('0x4b')]({'where':{'id':_0x36175c[_0x2c65('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ba7ac,null))[_0x2c65('0x26')](function(_0x3d84c9){if(_0x3d84c9){_0x230ab1=_0x3d84c9;_0x22c658[_0x2c65('0x35')]=_[_0x2c65('0x32')](db[_0x2c65('0x4c')][_0x2c65('0x2f')]);_0x22c658[_0x2c65('0x31')]=_['keys'](_0x36175c['query']);_0x22c658[_0x2c65('0x33')]=_[_0x2c65('0x34')](_0x22c658[_0x2c65('0x35')],_0x22c658[_0x2c65('0x31')]);_0xc714ed[_0x2c65('0x36')]=_[_0x2c65('0x34')](_0x22c658[_0x2c65('0x35')],qs['fields'](_0x36175c['query'][_0x2c65('0x37')]));_0xc714ed['attributes']=_0xc714ed[_0x2c65('0x36')][_0x2c65('0x45')]?_0xc714ed[_0x2c65('0x36')]:_0x22c658['model'];_0xc714ed['order']=qs['sort'](_0x36175c[_0x2c65('0x31')][_0x2c65('0x39')]);_0xc714ed['where']=qs[_0x2c65('0x33')](_[_0x2c65('0x4d')](_0x36175c['query'],_0x22c658['filters']));if(_0x36175c[_0x2c65('0x31')][_0x2c65('0x3d')]){_0xc714ed[_0x2c65('0x3a')]=_[_0x2c65('0x3b')](_0xc714ed['where'],{'$or':_[_0x2c65('0x2e')](_0xc714ed[_0x2c65('0x36')],function(_0x317c51){var _0x3ec2d8={};_0x3ec2d8[_0x317c51]={'$like':'%'+_0x36175c[_0x2c65('0x31')][_0x2c65('0x3d')]+'%'};return _0x3ec2d8;})});}_0xc714ed=_[_0x2c65('0x3b')]({},_0xc714ed,_0x36175c['options']);return _0x230ab1[_0x2c65('0x4a')](_0xc714ed);}})[_0x2c65('0x26')](function(_0x2d4828){if(_0x2d4828){_0x3a9b6b=_0x2d4828['length'];if(!_0x36175c['query'][_0x2c65('0x38')](_0x2c65('0x4e'))){_0xc714ed[_0x2c65('0x1e')]=qs[_0x2c65('0x1e')](_0x36175c['query'][_0x2c65('0x1e')]);_0xc714ed['offset']=qs[_0x2c65('0x20')](_0x36175c[_0x2c65('0x31')][_0x2c65('0x20')]);}return _0x230ab1['getFields'](_0xc714ed);}})[_0x2c65('0x26')](function(_0x2e1cb1){if(_0x2e1cb1){return _0x2e1cb1?{'count':_0x3a9b6b,'rows':_0x2e1cb1}:null;}})['then'](respondWithResult(_0x1ba7ac,null))[_0x2c65('0x42')](handleError(_0x1ba7ac,null));};exports[_0x2c65('0x4f')]=function(_0x387feb,_0x121ce2,_0x55bc84){var _0x1c5351={};var _0x4f30ae={};var _0x1db283;var _0x46870d;return db['Dynamics365Configuration'][_0x2c65('0x4b')]({'where':{'id':_0x387feb[_0x2c65('0x44')]['id']}})[_0x2c65('0x26')](handleEntityNotFound(_0x121ce2,null))['then'](function(_0x1790f8){if(_0x1790f8){_0x1db283=_0x1790f8;_0x4f30ae[_0x2c65('0x35')]=_[_0x2c65('0x32')](db['Dynamics365Field']['rawAttributes']);_0x4f30ae[_0x2c65('0x31')]=_[_0x2c65('0x32')](_0x387feb['query']);_0x4f30ae[_0x2c65('0x33')]=_['intersection'](_0x4f30ae['model'],_0x4f30ae[_0x2c65('0x31')]);_0x1c5351[_0x2c65('0x36')]=_[_0x2c65('0x34')](_0x4f30ae[_0x2c65('0x35')],qs['fields'](_0x387feb[_0x2c65('0x31')][_0x2c65('0x37')]));_0x1c5351[_0x2c65('0x36')]=_0x1c5351['attributes']['length']?_0x1c5351[_0x2c65('0x36')]:_0x4f30ae[_0x2c65('0x35')];_0x1c5351[_0x2c65('0x50')]=qs[_0x2c65('0x39')](_0x387feb[_0x2c65('0x31')][_0x2c65('0x39')]);_0x1c5351[_0x2c65('0x3a')]=qs[_0x2c65('0x33')](_[_0x2c65('0x4d')](_0x387feb[_0x2c65('0x31')],_0x4f30ae[_0x2c65('0x33')]));if(_0x387feb['query'][_0x2c65('0x3d')]){_0x1c5351['where']=_[_0x2c65('0x3b')](_0x1c5351['where'],{'$or':_[_0x2c65('0x2e')](_0x1c5351[_0x2c65('0x36')],function(_0x1db213){var _0xd9dfd={};_0xd9dfd[_0x1db213]={'$like':'%'+_0x387feb['query'][_0x2c65('0x3d')]+'%'};return _0xd9dfd;})});}_0x1c5351=_[_0x2c65('0x3b')]({},_0x1c5351,_0x387feb[_0x2c65('0x46')]);return _0x1db283[_0x2c65('0x4f')](_0x1c5351);}})['then'](function(_0x4107fb){if(_0x4107fb){_0x46870d=_0x4107fb[_0x2c65('0x45')];if(!_0x387feb['query'][_0x2c65('0x38')](_0x2c65('0x4e'))){_0x1c5351[_0x2c65('0x1e')]=qs[_0x2c65('0x1e')](_0x387feb[_0x2c65('0x31')][_0x2c65('0x1e')]);_0x1c5351[_0x2c65('0x20')]=qs[_0x2c65('0x20')](_0x387feb['query']['offset']);}return _0x1db283[_0x2c65('0x4f')](_0x1c5351);}})[_0x2c65('0x26')](function(_0x94043c){if(_0x94043c){return _0x94043c?{'count':_0x46870d,'rows':_0x94043c}:null;}})[_0x2c65('0x26')](respondWithResult(_0x121ce2,null))[_0x2c65('0x42')](handleError(_0x121ce2,null));};exports[_0x2c65('0x51')]=function(_0x3b47c3,_0xb194f9,_0x3cfe6b){var _0xe51ebc={};var _0x3bd8e2={};var _0x4b992c;var _0x2be2dc;return db[_0x2c65('0x3e')][_0x2c65('0x4b')]({'where':{'id':_0x3b47c3['params']['id']}})[_0x2c65('0x26')](handleEntityNotFound(_0xb194f9,null))[_0x2c65('0x26')](function(_0x2b1adf){if(_0x2b1adf){_0x4b992c=_0x2b1adf;_0x3bd8e2[_0x2c65('0x35')]=_['keys'](db[_0x2c65('0x4c')][_0x2c65('0x2f')]);_0x3bd8e2['query']=_['keys'](_0x3b47c3['query']);_0x3bd8e2[_0x2c65('0x33')]=_[_0x2c65('0x34')](_0x3bd8e2[_0x2c65('0x35')],_0x3bd8e2[_0x2c65('0x31')]);_0xe51ebc[_0x2c65('0x36')]=_[_0x2c65('0x34')](_0x3bd8e2[_0x2c65('0x35')],qs[_0x2c65('0x37')](_0x3b47c3[_0x2c65('0x31')]['fields']));_0xe51ebc[_0x2c65('0x36')]=_0xe51ebc[_0x2c65('0x36')][_0x2c65('0x45')]?_0xe51ebc[_0x2c65('0x36')]:_0x3bd8e2['model'];_0xe51ebc[_0x2c65('0x50')]=qs[_0x2c65('0x39')](_0x3b47c3[_0x2c65('0x31')]['sort']);_0xe51ebc[_0x2c65('0x3a')]=qs['filters'](_[_0x2c65('0x4d')](_0x3b47c3['query'],_0x3bd8e2[_0x2c65('0x33')]));if(_0x3b47c3[_0x2c65('0x31')][_0x2c65('0x3d')]){_0xe51ebc[_0x2c65('0x3a')]=_[_0x2c65('0x3b')](_0xe51ebc[_0x2c65('0x3a')],{'$or':_['map'](_0xe51ebc[_0x2c65('0x36')],function(_0x3cceab){var _0x2b4f27={};_0x2b4f27[_0x3cceab]={'$like':'%'+_0x3b47c3['query'][_0x2c65('0x3d')]+'%'};return _0x2b4f27;})});}_0xe51ebc=_[_0x2c65('0x3b')]({},_0xe51ebc,_0x3b47c3['options']);return _0x4b992c[_0x2c65('0x51')](_0xe51ebc);}})[_0x2c65('0x26')](function(_0x543bf0){if(_0x543bf0){_0x2be2dc=_0x543bf0[_0x2c65('0x45')];if(!_0x3b47c3['query'][_0x2c65('0x38')](_0x2c65('0x4e'))){_0xe51ebc[_0x2c65('0x1e')]=qs['limit'](_0x3b47c3[_0x2c65('0x31')][_0x2c65('0x1e')]);_0xe51ebc[_0x2c65('0x20')]=qs[_0x2c65('0x20')](_0x3b47c3[_0x2c65('0x31')][_0x2c65('0x20')]);}return _0x4b992c[_0x2c65('0x51')](_0xe51ebc);}})['then'](function(_0x5b251b){if(_0x5b251b){return _0x5b251b?{'count':_0x2be2dc,'rows':_0x5b251b}:null;}})[_0x2c65('0x26')](respondWithResult(_0xb194f9,null))[_0x2c65('0x42')](handleError(_0xb194f9,null));}; \ No newline at end of file +var _0xa925=['undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','include','rows','show','params','includeAll','merge','find','catch','create','body','getFields','findOne','getSubjects','Dynamics365Field','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','end','json'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0xa925,0x11b));var _0x5a92=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa925[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a92('0x0'));var zipdir=require(_0x5a92('0x1'));var jsonpatch=require(_0x5a92('0x2'));var rp=require(_0x5a92('0x3'));var moment=require('moment');var BPromise=require(_0x5a92('0x4'));var Mustache=require('mustache');var util=require(_0x5a92('0x5'));var path=require(_0x5a92('0x6'));var sox=require('sox');var csv=require(_0x5a92('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a92('0x8'));var _=require(_0x5a92('0x9'));var squel=require(_0x5a92('0xa'));var crypto=require(_0x5a92('0xb'));var jsforce=require(_0x5a92('0xc'));var deskjs=require(_0x5a92('0xd'));var toCsv=require(_0x5a92('0x7'));var querystring=require(_0x5a92('0xe'));var Papa=require(_0x5a92('0xf'));var Redis=require(_0x5a92('0x10'));var authService=require(_0x5a92('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a92('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a92('0x13'))('api');var utils=require(_0x5a92('0x14'));var config=require(_0x5a92('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3594b4,_0x10aa5e){_0x10aa5e=_0x10aa5e||0xcc;return function(_0x40204a){if(_0x40204a){return _0x3594b4['sendStatus'](_0x10aa5e);}return _0x3594b4[_0x5a92('0x16')](_0x10aa5e)[_0x5a92('0x17')]();};}function respondWithResult(_0x512027,_0x175f2d){_0x175f2d=_0x175f2d||0xc8;return function(_0x50e514){if(_0x50e514){return _0x512027['status'](_0x175f2d)[_0x5a92('0x18')](_0x50e514);}};}function respondWithFilteredResult(_0x1ede89,_0x33ebb5){return function(_0x3fea05){if(_0x3fea05){var _0x594d6f=typeof _0x33ebb5['offset']===_0x5a92('0x19')&&typeof _0x33ebb5[_0x5a92('0x1a')]===_0x5a92('0x19');var _0x56ce1b=_0x3fea05[_0x5a92('0x1b')];var _0xaa1243=_0x594d6f?0x0:_0x33ebb5[_0x5a92('0x1c')];var _0x57bbec=_0x594d6f?_0x3fea05[_0x5a92('0x1b')]:_0x33ebb5[_0x5a92('0x1c')]+_0x33ebb5['limit'];var _0x4f09aa;if(_0x57bbec>=_0x56ce1b){_0x57bbec=_0x56ce1b;_0x4f09aa=0xc8;}else{_0x4f09aa=0xce;}_0x1ede89[_0x5a92('0x16')](_0x4f09aa);return _0x1ede89[_0x5a92('0x1d')]('Content-Range',_0xaa1243+'-'+_0x57bbec+'/'+_0x56ce1b)[_0x5a92('0x18')](_0x3fea05);}return null;};}function patchUpdates(_0x383060){return function(_0x2531d2){try{jsonpatch[_0x5a92('0x1e')](_0x2531d2,_0x383060,!![]);}catch(_0x429de2){return BPromise[_0x5a92('0x1f')](_0x429de2);}return _0x2531d2[_0x5a92('0x20')]();};}function saveUpdates(_0x3d1064,_0x1a2410){return function(_0x5f4a39){if(_0x5f4a39){return _0x5f4a39[_0x5a92('0x21')](_0x3d1064)[_0x5a92('0x22')](function(_0x507b7d){return _0x507b7d;});}return null;};}function removeEntity(_0x40086d,_0x24868b){return function(_0x2a612a){if(_0x2a612a){return _0x2a612a[_0x5a92('0x23')]()['then'](function(){_0x40086d[_0x5a92('0x16')](0xcc)[_0x5a92('0x17')]();});}};}function handleEntityNotFound(_0x103bb4,_0x40691a){return function(_0x52a9a7){if(!_0x52a9a7){_0x103bb4['sendStatus'](0x194);}return _0x52a9a7;};}function handleError(_0x898f5,_0x1d5185){_0x1d5185=_0x1d5185||0x1f4;return function(_0x76b1ba){logger[_0x5a92('0x24')](_0x76b1ba[_0x5a92('0x25')]);if(_0x76b1ba['name']){delete _0x76b1ba[_0x5a92('0x26')];}_0x898f5['status'](_0x1d5185)['send'](_0x76b1ba);};}exports[_0x5a92('0x27')]=function(_0x105c90,_0x3c5803){var _0x27ac86={},_0x2fe5e7={},_0x2bad24={'count':0x0,'rows':[]};var _0x19a65c=_[_0x5a92('0x28')](db[_0x5a92('0x29')][_0x5a92('0x2a')],function(_0x32cf99){return{'name':_0x32cf99[_0x5a92('0x2b')],'type':_0x32cf99[_0x5a92('0x2c')][_0x5a92('0x2d')]};});_0x2fe5e7[_0x5a92('0x2e')]=_[_0x5a92('0x28')](_0x19a65c,_0x5a92('0x26'));_0x2fe5e7[_0x5a92('0x2f')]=_[_0x5a92('0x30')](_0x105c90[_0x5a92('0x2f')]);_0x2fe5e7[_0x5a92('0x31')]=_['intersection'](_0x2fe5e7[_0x5a92('0x2e')],_0x2fe5e7['query']);_0x27ac86[_0x5a92('0x32')]=_[_0x5a92('0x33')](_0x2fe5e7[_0x5a92('0x2e')],qs[_0x5a92('0x34')](_0x105c90['query']['fields']));_0x27ac86[_0x5a92('0x32')]=_0x27ac86[_0x5a92('0x32')][_0x5a92('0x35')]?_0x27ac86[_0x5a92('0x32')]:_0x2fe5e7['model'];if(!_0x105c90[_0x5a92('0x2f')][_0x5a92('0x36')](_0x5a92('0x37'))){_0x27ac86[_0x5a92('0x1a')]=qs[_0x5a92('0x1a')](_0x105c90[_0x5a92('0x2f')][_0x5a92('0x1a')]);_0x27ac86[_0x5a92('0x1c')]=qs[_0x5a92('0x1c')](_0x105c90[_0x5a92('0x2f')][_0x5a92('0x1c')]);}_0x27ac86['order']=qs['sort'](_0x105c90[_0x5a92('0x2f')][_0x5a92('0x38')]);_0x27ac86[_0x5a92('0x39')]=qs[_0x5a92('0x31')](_[_0x5a92('0x3a')](_0x105c90[_0x5a92('0x2f')],_0x2fe5e7[_0x5a92('0x31')]),_0x19a65c);if(_0x105c90['query'][_0x5a92('0x3b')]){_0x27ac86[_0x5a92('0x39')]=_['merge'](_0x27ac86[_0x5a92('0x39')],{'$or':_[_0x5a92('0x28')](_0x19a65c,function(_0x41fa23){if(_0x41fa23['type']!=='VIRTUAL'){var _0x47f500={};_0x47f500[_0x41fa23[_0x5a92('0x26')]]={'$like':'%'+_0x105c90['query'][_0x5a92('0x3b')]+'%'};return _0x47f500;}})});}_0x27ac86=_['merge']({},_0x27ac86,_0x105c90[_0x5a92('0x3c')]);var _0x143715={'where':_0x27ac86[_0x5a92('0x39')]};return db[_0x5a92('0x29')][_0x5a92('0x1b')](_0x143715)['then'](function(_0x2fab9e){_0x2bad24['count']=_0x2fab9e;if(_0x105c90[_0x5a92('0x2f')]['includeAll']){_0x27ac86[_0x5a92('0x3d')]=[{'all':!![]}];}return db[_0x5a92('0x29')]['findAll'](_0x27ac86);})[_0x5a92('0x22')](function(_0x4be5db){_0x2bad24[_0x5a92('0x3e')]=_0x4be5db;return _0x2bad24;})[_0x5a92('0x22')](respondWithFilteredResult(_0x3c5803,_0x27ac86))['catch'](handleError(_0x3c5803,null));};exports[_0x5a92('0x3f')]=function(_0x3eca4a,_0x297127){var _0x25daf8={'raw':![],'where':{'id':_0x3eca4a[_0x5a92('0x40')]['id']}},_0x51ec8b={};_0x51ec8b['model']=_[_0x5a92('0x30')](db[_0x5a92('0x29')]['rawAttributes']);_0x51ec8b['query']=_[_0x5a92('0x30')](_0x3eca4a[_0x5a92('0x2f')]);_0x51ec8b['filters']=_[_0x5a92('0x33')](_0x51ec8b[_0x5a92('0x2e')],_0x51ec8b['query']);_0x25daf8['attributes']=_['intersection'](_0x51ec8b[_0x5a92('0x2e')],qs[_0x5a92('0x34')](_0x3eca4a[_0x5a92('0x2f')]['fields']));_0x25daf8[_0x5a92('0x32')]=_0x25daf8[_0x5a92('0x32')]['length']?_0x25daf8[_0x5a92('0x32')]:_0x51ec8b[_0x5a92('0x2e')];if(_0x3eca4a['query'][_0x5a92('0x41')]){_0x25daf8[_0x5a92('0x3d')]=[{'all':!![]}];}_0x25daf8=_[_0x5a92('0x42')]({},_0x25daf8,_0x3eca4a[_0x5a92('0x3c')]);return db[_0x5a92('0x29')][_0x5a92('0x43')](_0x25daf8)[_0x5a92('0x22')](handleEntityNotFound(_0x297127,null))[_0x5a92('0x22')](respondWithResult(_0x297127,null))[_0x5a92('0x44')](handleError(_0x297127,null));};exports[_0x5a92('0x45')]=function(_0x5a7ed9,_0x1d3558){return db[_0x5a92('0x29')]['create'](_0x5a7ed9[_0x5a92('0x46')],{})[_0x5a92('0x22')](respondWithResult(_0x1d3558,0xc9))[_0x5a92('0x44')](handleError(_0x1d3558,null));};exports[_0x5a92('0x21')]=function(_0x8cbd4f,_0x54e6ee){if(_0x8cbd4f[_0x5a92('0x46')]['id']){delete _0x8cbd4f[_0x5a92('0x46')]['id'];}return db[_0x5a92('0x29')]['find']({'where':{'id':_0x8cbd4f[_0x5a92('0x40')]['id']}})['then'](handleEntityNotFound(_0x54e6ee,null))[_0x5a92('0x22')](saveUpdates(_0x8cbd4f[_0x5a92('0x46')],null))[_0x5a92('0x22')](respondWithResult(_0x54e6ee,null))[_0x5a92('0x44')](handleError(_0x54e6ee,null));};exports[_0x5a92('0x23')]=function(_0x24bb79,_0x4e0156){return db[_0x5a92('0x29')][_0x5a92('0x43')]({'where':{'id':_0x24bb79[_0x5a92('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e0156,null))['then'](removeEntity(_0x4e0156,null))[_0x5a92('0x44')](handleError(_0x4e0156,null));};exports[_0x5a92('0x47')]=function(_0x2b6a18,_0x161f8e,_0x1eb5ce){var _0x78db86={};var _0x499baf={};var _0x20a3a7;var _0x202f37;return db[_0x5a92('0x29')][_0x5a92('0x48')]({'where':{'id':_0x2b6a18[_0x5a92('0x40')]['id']}})[_0x5a92('0x22')](handleEntityNotFound(_0x161f8e,null))[_0x5a92('0x22')](function(_0x5382df){if(_0x5382df){_0x20a3a7=_0x5382df;_0x499baf['model']=_[_0x5a92('0x30')](db['Dynamics365Field'][_0x5a92('0x2a')]);_0x499baf[_0x5a92('0x2f')]=_[_0x5a92('0x30')](_0x2b6a18['query']);_0x499baf[_0x5a92('0x31')]=_[_0x5a92('0x33')](_0x499baf[_0x5a92('0x2e')],_0x499baf[_0x5a92('0x2f')]);_0x78db86[_0x5a92('0x32')]=_[_0x5a92('0x33')](_0x499baf[_0x5a92('0x2e')],qs[_0x5a92('0x34')](_0x2b6a18['query'][_0x5a92('0x34')]));_0x78db86[_0x5a92('0x32')]=_0x78db86[_0x5a92('0x32')][_0x5a92('0x35')]?_0x78db86['attributes']:_0x499baf[_0x5a92('0x2e')];_0x78db86['order']=qs[_0x5a92('0x38')](_0x2b6a18[_0x5a92('0x2f')][_0x5a92('0x38')]);_0x78db86[_0x5a92('0x39')]=qs[_0x5a92('0x31')](_[_0x5a92('0x3a')](_0x2b6a18['query'],_0x499baf[_0x5a92('0x31')]));if(_0x2b6a18['query'][_0x5a92('0x3b')]){_0x78db86[_0x5a92('0x39')]=_[_0x5a92('0x42')](_0x78db86['where'],{'$or':_[_0x5a92('0x28')](_0x78db86[_0x5a92('0x32')],function(_0x41e18f){var _0x33b5e3={};_0x33b5e3[_0x41e18f]={'$like':'%'+_0x2b6a18[_0x5a92('0x2f')][_0x5a92('0x3b')]+'%'};return _0x33b5e3;})});}_0x78db86=_[_0x5a92('0x42')]({},_0x78db86,_0x2b6a18['options']);return _0x20a3a7[_0x5a92('0x47')](_0x78db86);}})['then'](function(_0xb1e404){if(_0xb1e404){_0x202f37=_0xb1e404[_0x5a92('0x35')];if(!_0x2b6a18['query']['hasOwnProperty'](_0x5a92('0x37'))){_0x78db86[_0x5a92('0x1a')]=qs[_0x5a92('0x1a')](_0x2b6a18[_0x5a92('0x2f')][_0x5a92('0x1a')]);_0x78db86[_0x5a92('0x1c')]=qs[_0x5a92('0x1c')](_0x2b6a18['query'][_0x5a92('0x1c')]);}return _0x20a3a7[_0x5a92('0x47')](_0x78db86);}})['then'](function(_0x337056){if(_0x337056){return _0x337056?{'count':_0x202f37,'rows':_0x337056}:null;}})[_0x5a92('0x22')](respondWithResult(_0x161f8e,null))[_0x5a92('0x44')](handleError(_0x161f8e,null));};exports[_0x5a92('0x49')]=function(_0x5edd41,_0x1c019b,_0x4f1278){var _0x25f155={};var _0x7627cb={};var _0x54767e;var _0x14a6e8;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5edd41[_0x5a92('0x40')]['id']}})[_0x5a92('0x22')](handleEntityNotFound(_0x1c019b,null))['then'](function(_0x28beed){if(_0x28beed){_0x54767e=_0x28beed;_0x7627cb[_0x5a92('0x2e')]=_[_0x5a92('0x30')](db[_0x5a92('0x4a')][_0x5a92('0x2a')]);_0x7627cb['query']=_[_0x5a92('0x30')](_0x5edd41[_0x5a92('0x2f')]);_0x7627cb[_0x5a92('0x31')]=_['intersection'](_0x7627cb['model'],_0x7627cb['query']);_0x25f155[_0x5a92('0x32')]=_[_0x5a92('0x33')](_0x7627cb[_0x5a92('0x2e')],qs[_0x5a92('0x34')](_0x5edd41[_0x5a92('0x2f')]['fields']));_0x25f155[_0x5a92('0x32')]=_0x25f155[_0x5a92('0x32')][_0x5a92('0x35')]?_0x25f155[_0x5a92('0x32')]:_0x7627cb[_0x5a92('0x2e')];_0x25f155[_0x5a92('0x4b')]=qs['sort'](_0x5edd41[_0x5a92('0x2f')][_0x5a92('0x38')]);_0x25f155[_0x5a92('0x39')]=qs['filters'](_[_0x5a92('0x3a')](_0x5edd41[_0x5a92('0x2f')],_0x7627cb[_0x5a92('0x31')]));if(_0x5edd41[_0x5a92('0x2f')][_0x5a92('0x3b')]){_0x25f155[_0x5a92('0x39')]=_[_0x5a92('0x42')](_0x25f155[_0x5a92('0x39')],{'$or':_[_0x5a92('0x28')](_0x25f155[_0x5a92('0x32')],function(_0xdece1b){var _0x1835be={};_0x1835be[_0xdece1b]={'$like':'%'+_0x5edd41[_0x5a92('0x2f')]['filter']+'%'};return _0x1835be;})});}_0x25f155=_[_0x5a92('0x42')]({},_0x25f155,_0x5edd41['options']);return _0x54767e[_0x5a92('0x49')](_0x25f155);}})['then'](function(_0x3ae86d){if(_0x3ae86d){_0x14a6e8=_0x3ae86d[_0x5a92('0x35')];if(!_0x5edd41['query']['hasOwnProperty'](_0x5a92('0x37'))){_0x25f155[_0x5a92('0x1a')]=qs[_0x5a92('0x1a')](_0x5edd41[_0x5a92('0x2f')][_0x5a92('0x1a')]);_0x25f155[_0x5a92('0x1c')]=qs['offset'](_0x5edd41[_0x5a92('0x2f')][_0x5a92('0x1c')]);}return _0x54767e[_0x5a92('0x49')](_0x25f155);}})[_0x5a92('0x22')](function(_0x38b19b){if(_0x38b19b){return _0x38b19b?{'count':_0x14a6e8,'rows':_0x38b19b}:null;}})[_0x5a92('0x22')](respondWithResult(_0x1c019b,null))[_0x5a92('0x44')](handleError(_0x1c019b,null));};exports[_0x5a92('0x4c')]=function(_0xc9c090,_0x32b378,_0x5e5084){var _0x28ea6e={};var _0xe18f8f={};var _0x50b871;var _0x28e380;return db[_0x5a92('0x29')]['findOne']({'where':{'id':_0xc9c090[_0x5a92('0x40')]['id']}})[_0x5a92('0x22')](handleEntityNotFound(_0x32b378,null))[_0x5a92('0x22')](function(_0x571dfa){if(_0x571dfa){_0x50b871=_0x571dfa;_0xe18f8f[_0x5a92('0x2e')]=_[_0x5a92('0x30')](db[_0x5a92('0x4a')]['rawAttributes']);_0xe18f8f['query']=_[_0x5a92('0x30')](_0xc9c090[_0x5a92('0x2f')]);_0xe18f8f[_0x5a92('0x31')]=_[_0x5a92('0x33')](_0xe18f8f[_0x5a92('0x2e')],_0xe18f8f[_0x5a92('0x2f')]);_0x28ea6e[_0x5a92('0x32')]=_[_0x5a92('0x33')](_0xe18f8f['model'],qs['fields'](_0xc9c090[_0x5a92('0x2f')][_0x5a92('0x34')]));_0x28ea6e[_0x5a92('0x32')]=_0x28ea6e[_0x5a92('0x32')][_0x5a92('0x35')]?_0x28ea6e[_0x5a92('0x32')]:_0xe18f8f['model'];_0x28ea6e[_0x5a92('0x4b')]=qs[_0x5a92('0x38')](_0xc9c090[_0x5a92('0x2f')][_0x5a92('0x38')]);_0x28ea6e[_0x5a92('0x39')]=qs[_0x5a92('0x31')](_['pick'](_0xc9c090[_0x5a92('0x2f')],_0xe18f8f['filters']));if(_0xc9c090[_0x5a92('0x2f')][_0x5a92('0x3b')]){_0x28ea6e[_0x5a92('0x39')]=_['merge'](_0x28ea6e[_0x5a92('0x39')],{'$or':_[_0x5a92('0x28')](_0x28ea6e[_0x5a92('0x32')],function(_0x52ca53){var _0x2bc1d1={};_0x2bc1d1[_0x52ca53]={'$like':'%'+_0xc9c090['query'][_0x5a92('0x3b')]+'%'};return _0x2bc1d1;})});}_0x28ea6e=_[_0x5a92('0x42')]({},_0x28ea6e,_0xc9c090[_0x5a92('0x3c')]);return _0x50b871['getDescriptions'](_0x28ea6e);}})['then'](function(_0x5454cb){if(_0x5454cb){_0x28e380=_0x5454cb[_0x5a92('0x35')];if(!_0xc9c090[_0x5a92('0x2f')]['hasOwnProperty']('nolimit')){_0x28ea6e['limit']=qs[_0x5a92('0x1a')](_0xc9c090[_0x5a92('0x2f')][_0x5a92('0x1a')]);_0x28ea6e[_0x5a92('0x1c')]=qs[_0x5a92('0x1c')](_0xc9c090[_0x5a92('0x2f')]['offset']);}return _0x50b871['getDescriptions'](_0x28ea6e);}})[_0x5a92('0x22')](function(_0x2f00a0){if(_0x2f00a0){return _0x2f00a0?{'count':_0x28e380,'rows':_0x2f00a0}:null;}})[_0x5a92('0x22')](respondWithResult(_0x32b378,null))[_0x5a92('0x44')](handleError(_0x32b378,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fb0968b..8427448 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x1280bc,_0x5602ee){var _0x4bca23=function(_0x206abe){while(--_0x206abe){_0x1280bc['push'](_0x1280bc['shift']());}};_0x4bca23(++_0x5602ee);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2d6f52,_0x24d93d){_0x2d6f52=_0x2d6f52-0x0;var _0x4a2575=_0xb43b[_0x2d6f52];return _0x4a2575;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1b0abf,_0xa52875){_0x1b0abf=_0x1b0abf-0x0;var _0x15b885=_0x6f0d[_0x1b0abf];return _0x15b885;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index b6ad4ca..f381192 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 _0x30e8=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x30e8,0x1d4));var _0x830e=function(_0x406aaa,_0x3e7c24){_0x406aaa=_0x406aaa-0x0;var _0x6cf281=_0x30e8[_0x406aaa];return _0x6cf281;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x830e('0x0'));var BPromise=require(_0x830e('0x1'));var rs=require(_0x830e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x830e('0x3'))['db'];var utils=require(_0x830e('0x4'));var logger=require(_0x830e('0x5'))(_0x830e('0x6'));var config=require('../../config/environment');var jayson=require(_0x830e('0x7'));var client=jayson[_0x830e('0x8')][_0x830e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21cecd,_0x21786a,_0x2745b5){return new BPromise(function(_0x4ca3e5,_0xaf402d){return client[_0x830e('0xa')](_0x21cecd,_0x2745b5)[_0x830e('0xb')](function(_0x168f2c){logger[_0x830e('0xc')](_0x830e('0xd'),_0x21786a,_0x830e('0xe'));logger[_0x830e('0xf')](_0x830e('0x10'),_0x21786a,_0x830e('0xe'),JSON['stringify'](_0x168f2c));if(_0x168f2c[_0x830e('0x11')]){if(_0x168f2c[_0x830e('0x11')][_0x830e('0x12')]===0x1f4){logger[_0x830e('0x11')](_0x830e('0xd'),_0x21786a,_0x168f2c[_0x830e('0x11')][_0x830e('0x13')]);return _0xaf402d(_0x168f2c[_0x830e('0x11')][_0x830e('0x13')]);}logger[_0x830e('0x11')](_0x830e('0xd'),_0x21786a,_0x168f2c[_0x830e('0x11')][_0x830e('0x13')]);return _0x4ca3e5(_0x168f2c['error'][_0x830e('0x13')]);}else{logger['info'](_0x830e('0xd'),_0x21786a,_0x830e('0xe'));_0x4ca3e5(_0x168f2c[_0x830e('0x14')][_0x830e('0x13')]);}})[_0x830e('0x15')](function(_0x364188){logger[_0x830e('0x11')](_0x830e('0xd'),_0x21786a,_0x364188);_0xaf402d(_0x364188);});});} \ No newline at end of file +var _0xdf5c=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x4f17a5,_0x92394f){var _0x4e711d=function(_0x16475d){while(--_0x16475d){_0x4f17a5['push'](_0x4f17a5['shift']());}};_0x4e711d(++_0x92394f);}(_0xdf5c,0x9c));var _0xcdf5=function(_0x319ab9,_0xad6320){_0x319ab9=_0x319ab9-0x0;var _0x4308eb=_0xdf5c[_0x319ab9];return _0x4308eb;};'use strict';var _=require(_0xcdf5('0x0'));var util=require('util');var moment=require(_0xcdf5('0x1'));var BPromise=require(_0xcdf5('0x2'));var rs=require(_0xcdf5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdf5('0x4'))['db'];var utils=require(_0xcdf5('0x5'));var logger=require(_0xcdf5('0x6'))(_0xcdf5('0x7'));var config=require(_0xcdf5('0x8'));var jayson=require(_0xcdf5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c31bb,_0x813784,_0x55e6a0){return new BPromise(function(_0x1f797a,_0x1f4932){return client[_0xcdf5('0xa')](_0x4c31bb,_0x55e6a0)[_0xcdf5('0xb')](function(_0x26df48){logger['info'](_0xcdf5('0xc'),_0x813784,_0xcdf5('0xd'));logger['debug'](_0xcdf5('0xe'),_0x813784,_0xcdf5('0xd'),JSON[_0xcdf5('0xf')](_0x26df48));if(_0x26df48[_0xcdf5('0x10')]){if(_0x26df48[_0xcdf5('0x10')]['code']===0x1f4){logger[_0xcdf5('0x10')](_0xcdf5('0xc'),_0x813784,_0x26df48[_0xcdf5('0x10')][_0xcdf5('0x11')]);return _0x1f4932(_0x26df48[_0xcdf5('0x10')]['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x813784,_0x26df48[_0xcdf5('0x10')]['message']);return _0x1f797a(_0x26df48[_0xcdf5('0x10')][_0xcdf5('0x11')]);}else{logger[_0xcdf5('0x12')](_0xcdf5('0xc'),_0x813784,_0xcdf5('0xd'));_0x1f797a(_0x26df48[_0xcdf5('0x13')][_0xcdf5('0x11')]);}})[_0xcdf5('0x14')](function(_0x310071){logger[_0xcdf5('0x10')](_0xcdf5('0xc'),_0x813784,_0x310071);_0x1f4932(_0x310071);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 266746a..6b60cbd 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 _0xeead=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x13bca0,_0x2b097c){var _0x228dab=function(_0x420e5e){while(--_0x420e5e){_0x13bca0['push'](_0x13bca0['shift']());}};_0x228dab(++_0x2b097c);}(_0xeead,0xed));var _0xdeea=function(_0x5dded4,_0x177469){_0x5dded4=_0x5dded4-0x0;var _0x3ccc1f=_0xeead[_0x5dded4];return _0x3ccc1f;};'use strict';var multer=require(_0xdeea('0x0'));var util=require(_0xdeea('0x1'));var path=require(_0xdeea('0x2'));var timeout=require(_0xdeea('0x3'));var express=require('express');var router=express[_0xdeea('0x4')]();var fs_extra=require(_0xdeea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdeea('0x6'));var config=require('../../config/environment');var controller=require(_0xdeea('0x7'));router[_0xdeea('0x8')]('/',auth['isAuthenticated'](),controller[_0xdeea('0x9')]);router[_0xdeea('0x8')]('/:id',auth[_0xdeea('0xa')](),controller[_0xdeea('0xb')]);router['post']('/',auth[_0xdeea('0xa')](),controller[_0xdeea('0xc')]);router[_0xdeea('0xd')](_0xdeea('0xe'),auth[_0xdeea('0xa')](),controller[_0xdeea('0xf')]);router['delete']('/:id',auth[_0xdeea('0xa')](),controller[_0xdeea('0x10')]);module[_0xdeea('0x11')]=router; \ No newline at end of file +var _0x13d1=['./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a6f0c,_0x299682){var _0x301002=function(_0x4a38be){while(--_0x4a38be){_0x3a6f0c['push'](_0x3a6f0c['shift']());}};_0x301002(++_0x299682);}(_0x13d1,0xa3));var _0x113d=function(_0x167f88,_0x1c838f){_0x167f88=_0x167f88-0x0;var _0x1e0216=_0x13d1[_0x167f88];return _0x1e0216;};'use strict';var multer=require(_0x113d('0x0'));var util=require(_0x113d('0x1'));var path=require(_0x113d('0x2'));var timeout=require('connect-timeout');var express=require(_0x113d('0x3'));var router=express[_0x113d('0x4')]();var fs_extra=require(_0x113d('0x5'));var auth=require(_0x113d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x113d('0x7'));var controller=require(_0x113d('0x8'));router[_0x113d('0x9')]('/',auth[_0x113d('0xa')](),controller[_0x113d('0xb')]);router['get'](_0x113d('0xc'),auth[_0x113d('0xa')](),controller[_0x113d('0xd')]);router[_0x113d('0xe')]('/',auth[_0x113d('0xa')](),controller['create']);router[_0x113d('0xf')](_0x113d('0xc'),auth[_0x113d('0xa')](),controller[_0x113d('0x10')]);router['delete']('/:id',auth[_0x113d('0xa')](),controller[_0x113d('0x11')]);module[_0x113d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index e96a7b5..fc86e9e 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 _0x1963=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x1963,0x169));var _0x3196=function(_0x3150ac,_0x5dfec7){_0x3150ac=_0x3150ac-0x0;var _0x15c346=_0x1963[_0x3150ac];return _0x15c346;};'use strict';var Sequelize=require(_0x3196('0x0'));module[_0x3196('0x1')]={'type':{'type':Sequelize[_0x3196('0x2')](_0x3196('0x3'),_0x3196('0x4'),_0x3196('0x5'),_0x3196('0x6'),'picklist'),'defaultValue':_0x3196('0x3')},'content':{'type':Sequelize[_0x3196('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3196('0x2')](_0x3196('0x3'),_0x3196('0x4'),_0x3196('0x5'))},'keyContent':{'type':Sequelize[_0x3196('0x7')]},'idField':{'type':Sequelize[_0x3196('0x7')]},'nameField':{'type':Sequelize[_0x3196('0x7')]},'customField':{'type':Sequelize[_0x3196('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7a3d=['exports','string','variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize'];(function(_0x57856c,_0x405c78){var _0x512e24=function(_0x2415c5){while(--_0x2415c5){_0x57856c['push'](_0x57856c['shift']());}};_0x512e24(++_0x405c78);}(_0x7a3d,0x98));var _0xd7a3=function(_0xbfa220,_0x550ac6){_0xbfa220=_0xbfa220-0x0;var _0x1f6363=_0x7a3d[_0xbfa220];return _0x1f6363;};'use strict';var Sequelize=require(_0xd7a3('0x0'));module[_0xd7a3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd7a3('0x2'),_0xd7a3('0x3'),'customVariable',_0xd7a3('0x4'),'picklist'),'defaultValue':_0xd7a3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd7a3('0x5')]},'keyType':{'type':Sequelize[_0xd7a3('0x6')](_0xd7a3('0x2'),'variable',_0xd7a3('0x7'))},'keyContent':{'type':Sequelize[_0xd7a3('0x5')]},'idField':{'type':Sequelize[_0xd7a3('0x5')]},'nameField':{'type':Sequelize[_0xd7a3('0x5')]},'customField':{'type':Sequelize[_0xd7a3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7a3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c47a94f..65d0936 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 _0x3064=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x53174f,_0x986a3b){var _0x1cbd1c=function(_0x5bbcb1){while(--_0x5bbcb1){_0x53174f['push'](_0x53174f['shift']());}};_0x1cbd1c(++_0x986a3b);}(_0x3064,0x13e));var _0x4306=function(_0x37d88a,_0x49adf9){_0x37d88a=_0x37d88a-0x0;var _0x1f4ea1=_0x3064[_0x37d88a];return _0x1f4ea1;};'use strict';var emlformat=require(_0x4306('0x0'));var rimraf=require(_0x4306('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4306('0x2'));var rp=require(_0x4306('0x3'));var moment=require(_0x4306('0x4'));var BPromise=require(_0x4306('0x5'));var Mustache=require(_0x4306('0x6'));var util=require('util');var path=require(_0x4306('0x7'));var sox=require(_0x4306('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4306('0x9'));var _=require(_0x4306('0xa'));var squel=require('squel');var crypto=require(_0x4306('0xb'));var jsforce=require(_0x4306('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4306('0xd'));var querystring=require(_0x4306('0xe'));var Papa=require(_0x4306('0xf'));var Redis=require(_0x4306('0x10'));var authService=require(_0x4306('0x11'));var qs=require(_0x4306('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4306('0x13'));var logger=require(_0x4306('0x14'))('api');var utils=require(_0x4306('0x15'));var config=require(_0x4306('0x16'));var licenseUtil=require(_0x4306('0x17'));var db=require(_0x4306('0x18'))['db'];function respondWithStatusCode(_0x4e2ace,_0x49d026){_0x49d026=_0x49d026||0xcc;return function(_0x477891){if(_0x477891){return _0x4e2ace['sendStatus'](_0x49d026);}return _0x4e2ace[_0x4306('0x19')](_0x49d026)['end']();};}function respondWithResult(_0x3b7e0f,_0x64c15c){_0x64c15c=_0x64c15c||0xc8;return function(_0x56bd4d){if(_0x56bd4d){return _0x3b7e0f[_0x4306('0x19')](_0x64c15c)[_0x4306('0x1a')](_0x56bd4d);}};}function respondWithFilteredResult(_0x53d2ab,_0x3f643e){return function(_0x18b7f9){if(_0x18b7f9){var _0x319ace=typeof _0x3f643e[_0x4306('0x1b')]==='undefined'&&typeof _0x3f643e[_0x4306('0x1c')]==='undefined';var _0x2f0064=_0x18b7f9[_0x4306('0x1d')];var _0xcf11e7=_0x319ace?0x0:_0x3f643e[_0x4306('0x1b')];var _0xe90221=_0x319ace?_0x18b7f9[_0x4306('0x1d')]:_0x3f643e[_0x4306('0x1b')]+_0x3f643e[_0x4306('0x1c')];var _0x3ccd98;if(_0xe90221>=_0x2f0064){_0xe90221=_0x2f0064;_0x3ccd98=0xc8;}else{_0x3ccd98=0xce;}_0x53d2ab['status'](_0x3ccd98);return _0x53d2ab[_0x4306('0x1e')](_0x4306('0x1f'),_0xcf11e7+'-'+_0xe90221+'/'+_0x2f0064)[_0x4306('0x1a')](_0x18b7f9);}return null;};}function patchUpdates(_0xb63314){return function(_0x2e832f){try{jsonpatch[_0x4306('0x20')](_0x2e832f,_0xb63314,!![]);}catch(_0x389f43){return BPromise['reject'](_0x389f43);}return _0x2e832f[_0x4306('0x21')]();};}function saveUpdates(_0x517d85,_0x25d59f){return function(_0x214df8){if(_0x214df8){return _0x214df8[_0x4306('0x22')](_0x517d85)['then'](function(_0x5b2455){return _0x5b2455;});}return null;};}function removeEntity(_0x3d3d7d,_0x1ca7a5){return function(_0x106f57){if(_0x106f57){return _0x106f57[_0x4306('0x23')]()[_0x4306('0x24')](function(){_0x3d3d7d[_0x4306('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f51a9,_0x123b11){return function(_0x25d626){if(!_0x25d626){_0x5f51a9['sendStatus'](0x194);}return _0x25d626;};}function handleError(_0x10015a,_0x50e4ad){_0x50e4ad=_0x50e4ad||0x1f4;return function(_0x44ce1a){logger[_0x4306('0x25')](_0x44ce1a['stack']);if(_0x44ce1a[_0x4306('0x26')]){delete _0x44ce1a[_0x4306('0x26')];}_0x10015a[_0x4306('0x19')](_0x50e4ad)[_0x4306('0x27')](_0x44ce1a);};}exports[_0x4306('0x28')]=function(_0x2c0431,_0x31c5ba){var _0x4cdf4f={},_0x12d4fb={},_0x2e385a={'count':0x0,'rows':[]};var _0x3d0f32=_[_0x4306('0x29')](db[_0x4306('0x2a')][_0x4306('0x2b')],function(_0x4f50b3){return{'name':_0x4f50b3[_0x4306('0x2c')],'type':_0x4f50b3[_0x4306('0x2d')][_0x4306('0x2e')]};});_0x12d4fb[_0x4306('0x2f')]=_[_0x4306('0x29')](_0x3d0f32,'name');_0x12d4fb[_0x4306('0x30')]=_[_0x4306('0x31')](_0x2c0431['query']);_0x12d4fb[_0x4306('0x32')]=_[_0x4306('0x33')](_0x12d4fb[_0x4306('0x2f')],_0x12d4fb[_0x4306('0x30')]);_0x4cdf4f[_0x4306('0x34')]=_['intersection'](_0x12d4fb[_0x4306('0x2f')],qs[_0x4306('0x35')](_0x2c0431[_0x4306('0x30')]['fields']));_0x4cdf4f[_0x4306('0x34')]=_0x4cdf4f[_0x4306('0x34')][_0x4306('0x36')]?_0x4cdf4f[_0x4306('0x34')]:_0x12d4fb['model'];if(!_0x2c0431[_0x4306('0x30')][_0x4306('0x37')]('nolimit')){_0x4cdf4f[_0x4306('0x1c')]=qs['limit'](_0x2c0431[_0x4306('0x30')]['limit']);_0x4cdf4f[_0x4306('0x1b')]=qs[_0x4306('0x1b')](_0x2c0431[_0x4306('0x30')][_0x4306('0x1b')]);}_0x4cdf4f[_0x4306('0x38')]=qs[_0x4306('0x39')](_0x2c0431['query']['sort']);_0x4cdf4f[_0x4306('0x3a')]=qs['filters'](_[_0x4306('0x3b')](_0x2c0431['query'],_0x12d4fb[_0x4306('0x32')]),_0x3d0f32);if(_0x2c0431[_0x4306('0x30')][_0x4306('0x3c')]){_0x4cdf4f[_0x4306('0x3a')]=_[_0x4306('0x3d')](_0x4cdf4f['where'],{'$or':_['map'](_0x3d0f32,function(_0x592ea7){if(_0x592ea7['type']!==_0x4306('0x3e')){var _0x2fbfa4={};_0x2fbfa4[_0x592ea7['name']]={'$like':'%'+_0x2c0431[_0x4306('0x30')][_0x4306('0x3c')]+'%'};return _0x2fbfa4;}})});}_0x4cdf4f=_[_0x4306('0x3d')]({},_0x4cdf4f,_0x2c0431[_0x4306('0x3f')]);var _0x5ebc59={'where':_0x4cdf4f[_0x4306('0x3a')]};return db[_0x4306('0x2a')][_0x4306('0x1d')](_0x5ebc59)['then'](function(_0x43ab91){_0x2e385a[_0x4306('0x1d')]=_0x43ab91;if(_0x2c0431[_0x4306('0x30')][_0x4306('0x40')]){_0x4cdf4f[_0x4306('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x4306('0x42')](_0x4cdf4f);})['then'](function(_0x1c67e9){_0x2e385a[_0x4306('0x43')]=_0x1c67e9;return _0x2e385a;})[_0x4306('0x24')](respondWithFilteredResult(_0x31c5ba,_0x4cdf4f))[_0x4306('0x44')](handleError(_0x31c5ba,null));};exports[_0x4306('0x45')]=function(_0x2d9eff,_0x12594f){var _0x56866e={'raw':!![],'where':{'id':_0x2d9eff['params']['id']}},_0x2611fd={};_0x2611fd['model']=_['keys'](db['Dynamics365Field'][_0x4306('0x2b')]);_0x2611fd[_0x4306('0x30')]=_['keys'](_0x2d9eff[_0x4306('0x30')]);_0x2611fd[_0x4306('0x32')]=_[_0x4306('0x33')](_0x2611fd[_0x4306('0x2f')],_0x2611fd[_0x4306('0x30')]);_0x56866e[_0x4306('0x34')]=_['intersection'](_0x2611fd[_0x4306('0x2f')],qs['fields'](_0x2d9eff[_0x4306('0x30')][_0x4306('0x35')]));_0x56866e[_0x4306('0x34')]=_0x56866e[_0x4306('0x34')][_0x4306('0x36')]?_0x56866e[_0x4306('0x34')]:_0x2611fd[_0x4306('0x2f')];if(_0x2d9eff[_0x4306('0x30')][_0x4306('0x40')]){_0x56866e[_0x4306('0x41')]=[{'all':!![]}];}_0x56866e=_[_0x4306('0x3d')]({},_0x56866e,_0x2d9eff[_0x4306('0x3f')]);return db[_0x4306('0x2a')][_0x4306('0x46')](_0x56866e)[_0x4306('0x24')](handleEntityNotFound(_0x12594f,null))[_0x4306('0x24')](respondWithResult(_0x12594f,null))[_0x4306('0x44')](handleError(_0x12594f,null));};exports[_0x4306('0x47')]=function(_0x1a9e3d,_0x538393){return db[_0x4306('0x2a')][_0x4306('0x47')](_0x1a9e3d[_0x4306('0x48')],{})[_0x4306('0x24')](respondWithResult(_0x538393,0xc9))[_0x4306('0x44')](handleError(_0x538393,null));};exports[_0x4306('0x22')]=function(_0x52ef52,_0x326dd8){if(_0x52ef52[_0x4306('0x48')]['id']){delete _0x52ef52[_0x4306('0x48')]['id'];}return db['Dynamics365Field'][_0x4306('0x46')]({'where':{'id':_0x52ef52['params']['id']}})['then'](handleEntityNotFound(_0x326dd8,null))[_0x4306('0x24')](saveUpdates(_0x52ef52['body'],null))[_0x4306('0x24')](respondWithResult(_0x326dd8,null))[_0x4306('0x44')](handleError(_0x326dd8,null));};exports[_0x4306('0x23')]=function(_0xef8c44,_0xba431f){return db[_0x4306('0x2a')][_0x4306('0x46')]({'where':{'id':_0xef8c44[_0x4306('0x49')]['id']}})[_0x4306('0x24')](handleEntityNotFound(_0xba431f,null))[_0x4306('0x24')](removeEntity(_0xba431f,null))[_0x4306('0x44')](handleError(_0xba431f,null));}; \ No newline at end of file +var _0xc9a1=['catch','show','params','length','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc9a1,0xf3));var _0x1c9a=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xc9a1[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x1c9a('0x0'));var rimraf=require(_0x1c9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c9a('0x2'));var rp=require(_0x1c9a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1c9a('0x4'));var util=require(_0x1c9a('0x5'));var path=require(_0x1c9a('0x6'));var sox=require(_0x1c9a('0x7'));var csv=require('to-csv');var ejs=require(_0x1c9a('0x8'));var fs=require('fs');var fs_extra=require(_0x1c9a('0x9'));var _=require(_0x1c9a('0xa'));var squel=require(_0x1c9a('0xb'));var crypto=require(_0x1c9a('0xc'));var jsforce=require(_0x1c9a('0xd'));var deskjs=require(_0x1c9a('0xe'));var toCsv=require(_0x1c9a('0xf'));var querystring=require(_0x1c9a('0x10'));var Papa=require('papaparse');var Redis=require(_0x1c9a('0x11'));var authService=require(_0x1c9a('0x12'));var qs=require(_0x1c9a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c9a('0x14'));var logger=require(_0x1c9a('0x15'))(_0x1c9a('0x16'));var utils=require(_0x1c9a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1c9a('0x18'));var db=require(_0x1c9a('0x19'))['db'];function respondWithStatusCode(_0x5a599b,_0x5ea588){_0x5ea588=_0x5ea588||0xcc;return function(_0xe92a6d){if(_0xe92a6d){return _0x5a599b['sendStatus'](_0x5ea588);}return _0x5a599b[_0x1c9a('0x1a')](_0x5ea588)[_0x1c9a('0x1b')]();};}function respondWithResult(_0x10e190,_0xb98c51){_0xb98c51=_0xb98c51||0xc8;return function(_0x669421){if(_0x669421){return _0x10e190[_0x1c9a('0x1a')](_0xb98c51)[_0x1c9a('0x1c')](_0x669421);}};}function respondWithFilteredResult(_0x574c2b,_0x2ed877){return function(_0x190786){if(_0x190786){var _0x1d0c34=typeof _0x2ed877['offset']===_0x1c9a('0x1d')&&typeof _0x2ed877['limit']===_0x1c9a('0x1d');var _0x30298f=_0x190786[_0x1c9a('0x1e')];var _0x1f613f=_0x1d0c34?0x0:_0x2ed877[_0x1c9a('0x1f')];var _0x481063=_0x1d0c34?_0x190786[_0x1c9a('0x1e')]:_0x2ed877[_0x1c9a('0x1f')]+_0x2ed877[_0x1c9a('0x20')];var _0x96bfee;if(_0x481063>=_0x30298f){_0x481063=_0x30298f;_0x96bfee=0xc8;}else{_0x96bfee=0xce;}_0x574c2b[_0x1c9a('0x1a')](_0x96bfee);return _0x574c2b[_0x1c9a('0x21')](_0x1c9a('0x22'),_0x1f613f+'-'+_0x481063+'/'+_0x30298f)[_0x1c9a('0x1c')](_0x190786);}return null;};}function patchUpdates(_0x93f563){return function(_0x2c84d1){try{jsonpatch[_0x1c9a('0x23')](_0x2c84d1,_0x93f563,!![]);}catch(_0x3588a1){return BPromise[_0x1c9a('0x24')](_0x3588a1);}return _0x2c84d1[_0x1c9a('0x25')]();};}function saveUpdates(_0x3332aa,_0x221f88){return function(_0x25c83e){if(_0x25c83e){return _0x25c83e[_0x1c9a('0x26')](_0x3332aa)['then'](function(_0x3ef200){return _0x3ef200;});}return null;};}function removeEntity(_0x4f04b6,_0x320edb){return function(_0x319bdd){if(_0x319bdd){return _0x319bdd['destroy']()[_0x1c9a('0x27')](function(){_0x4f04b6[_0x1c9a('0x1a')](0xcc)[_0x1c9a('0x1b')]();});}};}function handleEntityNotFound(_0x1fe228,_0x4d56ac){return function(_0x469c28){if(!_0x469c28){_0x1fe228[_0x1c9a('0x28')](0x194);}return _0x469c28;};}function handleError(_0xd2e6f,_0x299218){_0x299218=_0x299218||0x1f4;return function(_0x44bd21){logger[_0x1c9a('0x29')](_0x44bd21['stack']);if(_0x44bd21[_0x1c9a('0x2a')]){delete _0x44bd21[_0x1c9a('0x2a')];}_0xd2e6f[_0x1c9a('0x1a')](_0x299218)[_0x1c9a('0x2b')](_0x44bd21);};}exports[_0x1c9a('0x2c')]=function(_0x51521d,_0x3ca01f){var _0x420266={},_0x3f91cb={},_0x43131f={'count':0x0,'rows':[]};var _0x1c14d4=_[_0x1c9a('0x2d')](db[_0x1c9a('0x2e')][_0x1c9a('0x2f')],function(_0x226699){return{'name':_0x226699[_0x1c9a('0x30')],'type':_0x226699[_0x1c9a('0x31')]['key']};});_0x3f91cb['model']=_[_0x1c9a('0x2d')](_0x1c14d4,_0x1c9a('0x2a'));_0x3f91cb[_0x1c9a('0x32')]=_[_0x1c9a('0x33')](_0x51521d[_0x1c9a('0x32')]);_0x3f91cb['filters']=_['intersection'](_0x3f91cb[_0x1c9a('0x34')],_0x3f91cb[_0x1c9a('0x32')]);_0x420266[_0x1c9a('0x35')]=_[_0x1c9a('0x36')](_0x3f91cb[_0x1c9a('0x34')],qs[_0x1c9a('0x37')](_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x37')]));_0x420266[_0x1c9a('0x35')]=_0x420266[_0x1c9a('0x35')]['length']?_0x420266[_0x1c9a('0x35')]:_0x3f91cb['model'];if(!_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x38')](_0x1c9a('0x39'))){_0x420266['limit']=qs[_0x1c9a('0x20')](_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x20')]);_0x420266['offset']=qs[_0x1c9a('0x1f')](_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x1f')]);}_0x420266[_0x1c9a('0x3a')]=qs['sort'](_0x51521d[_0x1c9a('0x32')]['sort']);_0x420266[_0x1c9a('0x3b')]=qs[_0x1c9a('0x3c')](_[_0x1c9a('0x3d')](_0x51521d[_0x1c9a('0x32')],_0x3f91cb[_0x1c9a('0x3c')]),_0x1c14d4);if(_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x3e')]){_0x420266[_0x1c9a('0x3b')]=_[_0x1c9a('0x3f')](_0x420266[_0x1c9a('0x3b')],{'$or':_['map'](_0x1c14d4,function(_0x15880b){if(_0x15880b[_0x1c9a('0x31')]!==_0x1c9a('0x40')){var _0x5ff707={};_0x5ff707[_0x15880b['name']]={'$like':'%'+_0x51521d[_0x1c9a('0x32')]['filter']+'%'};return _0x5ff707;}})});}_0x420266=_[_0x1c9a('0x3f')]({},_0x420266,_0x51521d['options']);var _0xd89c6b={'where':_0x420266[_0x1c9a('0x3b')]};return db[_0x1c9a('0x2e')]['count'](_0xd89c6b)[_0x1c9a('0x27')](function(_0xb2f8e3){_0x43131f[_0x1c9a('0x1e')]=_0xb2f8e3;if(_0x51521d[_0x1c9a('0x32')][_0x1c9a('0x41')]){_0x420266[_0x1c9a('0x42')]=[{'all':!![]}];}return db[_0x1c9a('0x2e')][_0x1c9a('0x43')](_0x420266);})['then'](function(_0x262bde){_0x43131f[_0x1c9a('0x44')]=_0x262bde;return _0x43131f;})[_0x1c9a('0x27')](respondWithFilteredResult(_0x3ca01f,_0x420266))[_0x1c9a('0x45')](handleError(_0x3ca01f,null));};exports[_0x1c9a('0x46')]=function(_0x1b96cb,_0x178667){var _0x49b229={'raw':!![],'where':{'id':_0x1b96cb[_0x1c9a('0x47')]['id']}},_0x129908={};_0x129908[_0x1c9a('0x34')]=_[_0x1c9a('0x33')](db['Dynamics365Field']['rawAttributes']);_0x129908['query']=_['keys'](_0x1b96cb[_0x1c9a('0x32')]);_0x129908[_0x1c9a('0x3c')]=_['intersection'](_0x129908['model'],_0x129908[_0x1c9a('0x32')]);_0x49b229[_0x1c9a('0x35')]=_[_0x1c9a('0x36')](_0x129908[_0x1c9a('0x34')],qs[_0x1c9a('0x37')](_0x1b96cb[_0x1c9a('0x32')][_0x1c9a('0x37')]));_0x49b229['attributes']=_0x49b229[_0x1c9a('0x35')][_0x1c9a('0x48')]?_0x49b229[_0x1c9a('0x35')]:_0x129908['model'];if(_0x1b96cb[_0x1c9a('0x32')]['includeAll']){_0x49b229['include']=[{'all':!![]}];}_0x49b229=_[_0x1c9a('0x3f')]({},_0x49b229,_0x1b96cb[_0x1c9a('0x49')]);return db['Dynamics365Field'][_0x1c9a('0x4a')](_0x49b229)[_0x1c9a('0x27')](handleEntityNotFound(_0x178667,null))['then'](respondWithResult(_0x178667,null))['catch'](handleError(_0x178667,null));};exports['create']=function(_0x58083e,_0x291774){return db[_0x1c9a('0x2e')][_0x1c9a('0x4b')](_0x58083e[_0x1c9a('0x4c')],{})['then'](respondWithResult(_0x291774,0xc9))[_0x1c9a('0x45')](handleError(_0x291774,null));};exports['update']=function(_0x27d34a,_0x5887d2){if(_0x27d34a[_0x1c9a('0x4c')]['id']){delete _0x27d34a[_0x1c9a('0x4c')]['id'];}return db[_0x1c9a('0x2e')][_0x1c9a('0x4a')]({'where':{'id':_0x27d34a[_0x1c9a('0x47')]['id']}})[_0x1c9a('0x27')](handleEntityNotFound(_0x5887d2,null))['then'](saveUpdates(_0x27d34a['body'],null))['then'](respondWithResult(_0x5887d2,null))[_0x1c9a('0x45')](handleError(_0x5887d2,null));};exports[_0x1c9a('0x4d')]=function(_0x1fb8d5,_0x37ef9d){return db['Dynamics365Field'][_0x1c9a('0x4a')]({'where':{'id':_0x1fb8d5[_0x1c9a('0x47')]['id']}})[_0x1c9a('0x27')](handleEntityNotFound(_0x37ef9d,null))[_0x1c9a('0x27')](removeEntity(_0x37ef9d,null))['catch'](handleError(_0x37ef9d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 547f0c2..bb8180d 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 _0x01dc=['moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','FieldId','lodash','../../config/logger'];(function(_0x5e29c7,_0xc2f44e){var _0x5ba897=function(_0x650b47){while(--_0x650b47){_0x5e29c7['push'](_0x5e29c7['shift']());}};_0x5ba897(++_0xc2f44e);}(_0x01dc,0x73));var _0xc01d=function(_0x4fd9ad,_0x145ad4){_0x4fd9ad=_0x4fd9ad-0x0;var _0x44aa5c=_0x01dc[_0x4fd9ad];return _0x44aa5c;};'use strict';var _=require(_0xc01d('0x0'));var util=require('util');var logger=require(_0xc01d('0x1'))('api');var moment=require(_0xc01d('0x2'));var BPromise=require(_0xc01d('0x3'));var rp=require(_0xc01d('0x4'));var fs=require('fs');var path=require(_0xc01d('0x5'));var rimraf=require('rimraf');var config=require(_0xc01d('0x6'));var attributes=require(_0xc01d('0x7'));module[_0xc01d('0x8')]=function(_0x90b067,_0x3bfa71){return _0x90b067[_0xc01d('0x9')](_0xc01d('0xa'),attributes,{'tableName':_0xc01d('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xc01d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc87c=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash'];(function(_0x73ceda,_0x3bd4de){var _0x3da8c6=function(_0x406468){while(--_0x406468){_0x73ceda['push'](_0x73ceda['shift']());}};_0x3da8c6(++_0x3bd4de);}(_0xc87c,0x1ac));var _0xcc87=function(_0x43618d,_0x53e036){_0x43618d=_0x43618d-0x0;var _0x139371=_0xc87c[_0x43618d];return _0x139371;};'use strict';var _=require(_0xcc87('0x0'));var util=require(_0xcc87('0x1'));var logger=require(_0xcc87('0x2'))(_0xcc87('0x3'));var moment=require(_0xcc87('0x4'));var BPromise=require(_0xcc87('0x5'));var rp=require(_0xcc87('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc87('0x7'));var attributes=require(_0xcc87('0x8'));module['exports']=function(_0x4f2b4d,_0x556013){return _0x4f2b4d[_0xcc87('0x9')](_0xcc87('0xa'),attributes,{'tableName':_0xcc87('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xcc87('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 9606a42..84622da 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 _0x6ecc=['stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x309a39,_0x193cd4){var _0x36c085=function(_0x1f43f6){while(--_0x1f43f6){_0x309a39['push'](_0x309a39['shift']());}};_0x36c085(++_0x193cd4);}(_0x6ecc,0x70));var _0xc6ec=function(_0x45f629,_0x5260c8){_0x45f629=_0x45f629-0x0;var _0x202767=_0x6ecc[_0x45f629];return _0x202767;};'use strict';var _=require('lodash');var util=require(_0xc6ec('0x0'));var moment=require(_0xc6ec('0x1'));var BPromise=require(_0xc6ec('0x2'));var rs=require(_0xc6ec('0x3'));var fs=require('fs');var Redis=require(_0xc6ec('0x4'));var db=require(_0xc6ec('0x5'))['db'];var utils=require(_0xc6ec('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc6ec('0x7')][_0xc6ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe79b21,_0x42965d,_0x2b8eeb){return new BPromise(function(_0x4147b9,_0x579d24){return client[_0xc6ec('0x9')](_0xe79b21,_0x2b8eeb)[_0xc6ec('0xa')](function(_0x128a16){logger['info'](_0xc6ec('0xb'),_0x42965d,_0xc6ec('0xc'));logger['debug'](_0xc6ec('0xd'),_0x42965d,_0xc6ec('0xc'),JSON[_0xc6ec('0xe')](_0x128a16));if(_0x128a16[_0xc6ec('0xf')]){if(_0x128a16[_0xc6ec('0xf')][_0xc6ec('0x10')]===0x1f4){logger[_0xc6ec('0xf')](_0xc6ec('0xb'),_0x42965d,_0x128a16[_0xc6ec('0xf')][_0xc6ec('0x11')]);return _0x579d24(_0x128a16[_0xc6ec('0xf')][_0xc6ec('0x11')]);}logger[_0xc6ec('0xf')](_0xc6ec('0xb'),_0x42965d,_0x128a16['error'][_0xc6ec('0x11')]);return _0x4147b9(_0x128a16['error'][_0xc6ec('0x11')]);}else{logger['info'](_0xc6ec('0xb'),_0x42965d,_0xc6ec('0xc'));_0x4147b9(_0x128a16['result'][_0xc6ec('0x11')]);}})['catch'](function(_0x14ec5a){logger[_0xc6ec('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x42965d,_0x14ec5a);_0x579d24(_0x14ec5a);});});} \ No newline at end of file +var _0x3a69=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x41c5b3,_0x178cfc){var _0x25f6f6=function(_0x4a3ba2){while(--_0x4a3ba2){_0x41c5b3['push'](_0x41c5b3['shift']());}};_0x25f6f6(++_0x178cfc);}(_0x3a69,0xef));var _0x93a6=function(_0x2edb9f,_0x36fad0){_0x2edb9f=_0x2edb9f-0x0;var _0x4e5979=_0x3a69[_0x2edb9f];return _0x4e5979;};'use strict';var _=require(_0x93a6('0x0'));var util=require(_0x93a6('0x1'));var moment=require(_0x93a6('0x2'));var BPromise=require(_0x93a6('0x3'));var rs=require(_0x93a6('0x4'));var fs=require('fs');var Redis=require(_0x93a6('0x5'));var db=require(_0x93a6('0x6'))['db'];var utils=require(_0x93a6('0x7'));var logger=require(_0x93a6('0x8'))(_0x93a6('0x9'));var config=require(_0x93a6('0xa'));var jayson=require(_0x93a6('0xb'));var client=jayson[_0x93a6('0xc')][_0x93a6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5eecb2,_0x4e2013,_0x5d3040){return new BPromise(function(_0xb8e868,_0xb8056d){return client['request'](_0x5eecb2,_0x5d3040)['then'](function(_0x1f9ca3){logger['info'](_0x93a6('0xe'),_0x4e2013,'request\x20sent');logger[_0x93a6('0xf')](_0x93a6('0x10'),_0x4e2013,_0x93a6('0x11'),JSON[_0x93a6('0x12')](_0x1f9ca3));if(_0x1f9ca3[_0x93a6('0x13')]){if(_0x1f9ca3[_0x93a6('0x13')][_0x93a6('0x14')]===0x1f4){logger['error'](_0x93a6('0xe'),_0x4e2013,_0x1f9ca3[_0x93a6('0x13')]['message']);return _0xb8056d(_0x1f9ca3['error'][_0x93a6('0x15')]);}logger[_0x93a6('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x4e2013,_0x1f9ca3['error'][_0x93a6('0x15')]);return _0xb8e868(_0x1f9ca3['error'][_0x93a6('0x15')]);}else{logger[_0x93a6('0x16')]('Dynamics365Field,\x20%s,\x20%s',_0x4e2013,_0x93a6('0x11'));_0xb8e868(_0x1f9ca3[_0x93a6('0x17')][_0x93a6('0x15')]);}})['catch'](function(_0x21909a){logger[_0x93a6('0x13')](_0x93a6('0xe'),_0x4e2013,_0x21909a);_0xb8056d(_0x21909a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8cf6d42..e2b28ed 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 _0xb27e=['util','path','connect-timeout','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x4c20f2,_0x5ee4a6){var _0x576919=function(_0x142986){while(--_0x142986){_0x4c20f2['push'](_0x4c20f2['shift']());}};_0x576919(++_0x5ee4a6);}(_0xb27e,0x1a1));var _0xeb27=function(_0x580d30,_0x1c83ef){_0x580d30=_0x580d30-0x0;var _0x3c79c1=_0xb27e[_0x580d30];return _0x3c79c1;};'use strict';var multer=require(_0xeb27('0x0'));var util=require(_0xeb27('0x1'));var path=require(_0xeb27('0x2'));var timeout=require(_0xeb27('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb27('0x4'));var auth=require(_0xeb27('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb27('0x6'));router[_0xeb27('0x7')]('/',auth[_0xeb27('0x8')](),controller[_0xeb27('0x9')]);router[_0xeb27('0x7')](_0xeb27('0xa'),auth[_0xeb27('0x8')](),controller[_0xeb27('0xb')]);router[_0xeb27('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xeb27('0xc')]);router[_0xeb27('0x7')]('/:id/fields',auth[_0xeb27('0x8')](),controller['getFields']);router['post']('/',auth[_0xeb27('0x8')](),controller[_0xeb27('0xd')]);router[_0xeb27('0xe')](_0xeb27('0xf'),auth['isAuthenticated'](),controller[_0xeb27('0x10')]);router[_0xeb27('0x11')]('/:id',auth[_0xeb27('0x8')](),controller[_0xeb27('0x12')]);router[_0xeb27('0x13')](_0xeb27('0xa'),auth[_0xeb27('0x8')](),controller[_0xeb27('0x14')]);module[_0xeb27('0x15')]=router; \ No newline at end of file +var _0x8d47=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer'];(function(_0x18d52f,_0x23fb25){var _0x110c87=function(_0x3b1b58){while(--_0x3b1b58){_0x18d52f['push'](_0x18d52f['shift']());}};_0x110c87(++_0x23fb25);}(_0x8d47,0x113));var _0x78d4=function(_0x46bd32,_0x2ac06b){_0x46bd32=_0x46bd32-0x0;var _0x568909=_0x8d47[_0x46bd32];return _0x568909;};'use strict';var multer=require(_0x78d4('0x0'));var util=require(_0x78d4('0x1'));var path=require('path');var timeout=require(_0x78d4('0x2'));var express=require(_0x78d4('0x3'));var router=express[_0x78d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x78d4('0x5'));var interaction=require(_0x78d4('0x6'));var config=require(_0x78d4('0x7'));var controller=require(_0x78d4('0x8'));router[_0x78d4('0x9')]('/',auth[_0x78d4('0xa')](),controller[_0x78d4('0xb')]);router[_0x78d4('0x9')](_0x78d4('0xc'),auth[_0x78d4('0xa')](),controller[_0x78d4('0xd')]);router[_0x78d4('0x9')](_0x78d4('0xe'),auth[_0x78d4('0xa')](),controller['getConfigurations']);router[_0x78d4('0x9')](_0x78d4('0xf'),auth[_0x78d4('0xa')](),controller[_0x78d4('0x10')]);router[_0x78d4('0x11')]('/',auth['isAuthenticated'](),controller[_0x78d4('0x12')]);router[_0x78d4('0x11')](_0x78d4('0xe'),auth[_0x78d4('0xa')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x78d4('0x13')]);router[_0x78d4('0x14')](_0x78d4('0xc'),auth['isAuthenticated'](),controller[_0x78d4('0x15')]);module[_0x78d4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0facc7f..be15e15 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 _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x4e67e6,_0x48cd32){var _0x2b3cec=function(_0xb519de){while(--_0xb519de){_0x4e67e6['push'](_0x4e67e6['shift']());}};_0x2b3cec(++_0x48cd32);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x161b0c,_0x6772c6){_0x161b0c=_0x161b0c-0x0;var _0x3d194b=_0x4e2e[_0x161b0c];return _0x3d194b;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0424=['username','STRING'];(function(_0x383c94,_0x2c7402){var _0x149b61=function(_0x33dac0){while(--_0x33dac0){_0x383c94['push'](_0x383c94['shift']());}};_0x149b61(++_0x2c7402);}(_0x0424,0x159));var _0x4042=function(_0x56f604,_0x31e0fc){_0x56f604=_0x56f604-0x0;var _0x5c3f23=_0x0424[_0x56f604];return _0x5c3f23;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index c0840e0..f3ac9dd 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 _0xd84c=['toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','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/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s:X','apiKey'];(function(_0xca1585,_0x219dfb){var _0x117736=function(_0x386c85){while(--_0x386c85){_0xca1585['push'](_0xca1585['shift']());}};_0x117736(++_0x219dfb);}(_0xd84c,0x102));var _0xcd84=function(_0x599c60,_0x344f68){_0x599c60=_0x599c60-0x0;var _0x5275c2=_0xd84c[_0x599c60];return _0x5275c2;};'use strict';var emlformat=require(_0xcd84('0x0'));var rimraf=require(_0xcd84('0x1'));var zipdir=require(_0xcd84('0x2'));var jsonpatch=require(_0xcd84('0x3'));var rp=require(_0xcd84('0x4'));var moment=require(_0xcd84('0x5'));var BPromise=require(_0xcd84('0x6'));var Mustache=require(_0xcd84('0x7'));var util=require(_0xcd84('0x8'));var path=require('path');var sox=require(_0xcd84('0x9'));var csv=require(_0xcd84('0xa'));var ejs=require(_0xcd84('0xb'));var fs=require('fs');var fs_extra=require(_0xcd84('0xc'));var _=require('lodash');var squel=require(_0xcd84('0xd'));var crypto=require(_0xcd84('0xe'));var jsforce=require(_0xcd84('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcd84('0xa'));var querystring=require(_0xcd84('0x10'));var Papa=require(_0xcd84('0x11'));var Redis=require(_0xcd84('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcd84('0x13'));var as=require(_0xcd84('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd84('0x15'))(_0xcd84('0x16'));var utils=require(_0xcd84('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd84('0x18'));var db=require(_0xcd84('0x19'))['db'];var integrations=require(_0xcd84('0x1a'));function respondWithStatusCode(_0x116423,_0x4e1291){_0x4e1291=_0x4e1291||0xcc;return function(_0x222303){if(_0x222303){return _0x116423[_0xcd84('0x1b')](_0x4e1291);}return _0x116423[_0xcd84('0x1c')](_0x4e1291)[_0xcd84('0x1d')]();};}function respondWithResult(_0x1271b4,_0x100a7b){_0x100a7b=_0x100a7b||0xc8;return function(_0xea177a){if(_0xea177a){return _0x1271b4[_0xcd84('0x1c')](_0x100a7b)[_0xcd84('0x1e')](_0xea177a);}};}function respondWithFilteredResult(_0x45a92e,_0x223127){return function(_0x23b116){if(_0x23b116){var _0x1bd068=typeof _0x223127[_0xcd84('0x1f')]===_0xcd84('0x20')&&typeof _0x223127[_0xcd84('0x21')]===_0xcd84('0x20');var _0x9ddd5d=_0x23b116['count'];var _0x3c2d33=_0x1bd068?0x0:_0x223127[_0xcd84('0x1f')];var _0x4c9509=_0x1bd068?_0x23b116[_0xcd84('0x22')]:_0x223127[_0xcd84('0x1f')]+_0x223127[_0xcd84('0x21')];var _0xb4f1ee;if(_0x4c9509>=_0x9ddd5d){_0x4c9509=_0x9ddd5d;_0xb4f1ee=0xc8;}else{_0xb4f1ee=0xce;}_0x45a92e[_0xcd84('0x1c')](_0xb4f1ee);return _0x45a92e['set'](_0xcd84('0x23'),_0x3c2d33+'-'+_0x4c9509+'/'+_0x9ddd5d)[_0xcd84('0x1e')](_0x23b116);}return null;};}function patchUpdates(_0x225e15){return function(_0x53f8a0){try{jsonpatch['apply'](_0x53f8a0,_0x225e15,!![]);}catch(_0x98bf1f){return BPromise['reject'](_0x98bf1f);}return _0x53f8a0[_0xcd84('0x24')]();};}function saveUpdates(_0x20b0ce,_0x5cb006){return function(_0x454586){if(_0x454586){return _0x454586[_0xcd84('0x25')](_0x20b0ce)[_0xcd84('0x26')](function(_0x13996e){return _0x13996e;});}return null;};}function removeEntity(_0x14cf35,_0xfc2a17){return function(_0x49f7e8){if(_0x49f7e8){return _0x49f7e8[_0xcd84('0x27')]()[_0xcd84('0x26')](function(){_0x14cf35[_0xcd84('0x1c')](0xcc)[_0xcd84('0x1d')]();});}};}function handleEntityNotFound(_0x243368,_0x40d00a){return function(_0x5af4b9){if(!_0x5af4b9){_0x243368['sendStatus'](0x194);}return _0x5af4b9;};}function handleError(_0x5d610b,_0x1967f6){_0x1967f6=_0x1967f6||0x1f4;return function(_0x5c46c7){logger['error'](_0x5c46c7['stack']);if(_0x5c46c7[_0xcd84('0x28')]){delete _0x5c46c7[_0xcd84('0x28')];}_0x5d610b['status'](_0x1967f6)[_0xcd84('0x29')](_0x5c46c7);};}exports[_0xcd84('0x2a')]=function(_0x1f75ac,_0x5661a4){var _0x33fc4f={},_0x5d4bff={},_0x288cdd={'count':0x0,'rows':[]};var _0x71d465=_[_0xcd84('0x2b')](db[_0xcd84('0x2c')][_0xcd84('0x2d')],function(_0x3f10b1){return{'name':_0x3f10b1[_0xcd84('0x2e')],'type':_0x3f10b1[_0xcd84('0x2f')][_0xcd84('0x30')]};});_0x5d4bff[_0xcd84('0x31')]=_[_0xcd84('0x2b')](_0x71d465,_0xcd84('0x28'));_0x5d4bff['query']=_[_0xcd84('0x32')](_0x1f75ac[_0xcd84('0x33')]);_0x5d4bff[_0xcd84('0x34')]=_[_0xcd84('0x35')](_0x5d4bff['model'],_0x5d4bff[_0xcd84('0x33')]);_0x33fc4f[_0xcd84('0x36')]=_[_0xcd84('0x35')](_0x5d4bff[_0xcd84('0x31')],qs[_0xcd84('0x37')](_0x1f75ac['query'][_0xcd84('0x37')]));_0x33fc4f[_0xcd84('0x36')]=_0x33fc4f[_0xcd84('0x36')][_0xcd84('0x38')]?_0x33fc4f[_0xcd84('0x36')]:_0x5d4bff[_0xcd84('0x31')];if(!_0x1f75ac[_0xcd84('0x33')]['hasOwnProperty'](_0xcd84('0x39'))){_0x33fc4f[_0xcd84('0x21')]=qs['limit'](_0x1f75ac[_0xcd84('0x33')]['limit']);_0x33fc4f[_0xcd84('0x1f')]=qs[_0xcd84('0x1f')](_0x1f75ac[_0xcd84('0x33')][_0xcd84('0x1f')]);}_0x33fc4f[_0xcd84('0x3a')]=qs[_0xcd84('0x3b')](_0x1f75ac[_0xcd84('0x33')][_0xcd84('0x3b')]);_0x33fc4f[_0xcd84('0x3c')]=qs[_0xcd84('0x34')](_[_0xcd84('0x3d')](_0x1f75ac[_0xcd84('0x33')],_0x5d4bff[_0xcd84('0x34')]),_0x71d465);if(_0x1f75ac[_0xcd84('0x33')][_0xcd84('0x3e')]){_0x33fc4f['where']=_[_0xcd84('0x3f')](_0x33fc4f['where'],{'$or':_['map'](_0x71d465,function(_0xa8f23e){if(_0xa8f23e[_0xcd84('0x2f')]!==_0xcd84('0x40')){var _0x4d69b={};_0x4d69b[_0xa8f23e['name']]={'$like':'%'+_0x1f75ac['query'][_0xcd84('0x3e')]+'%'};return _0x4d69b;}})});}_0x33fc4f=_['merge']({},_0x33fc4f,_0x1f75ac[_0xcd84('0x41')]);var _0x40c5a7={'where':_0x33fc4f['where']};return db[_0xcd84('0x2c')]['count'](_0x40c5a7)[_0xcd84('0x26')](function(_0x1ccee1){_0x288cdd[_0xcd84('0x22')]=_0x1ccee1;if(_0x1f75ac['query']['includeAll']){_0x33fc4f[_0xcd84('0x42')]=[{'all':!![]}];}return db[_0xcd84('0x2c')][_0xcd84('0x43')](_0x33fc4f);})[_0xcd84('0x26')](function(_0x4c119c){_0x288cdd[_0xcd84('0x44')]=_0x4c119c;return _0x288cdd;})[_0xcd84('0x26')](respondWithFilteredResult(_0x5661a4,_0x33fc4f))[_0xcd84('0x45')](handleError(_0x5661a4,null));};exports[_0xcd84('0x46')]=function(_0x3fc17d,_0x1254cd){var _0x38d17d={'raw':![],'where':{'id':_0x3fc17d[_0xcd84('0x47')]['id']}},_0xabfe95={};_0xabfe95['model']=_[_0xcd84('0x32')](db['FreshdeskAccount'][_0xcd84('0x2d')]);_0xabfe95['query']=_[_0xcd84('0x32')](_0x3fc17d[_0xcd84('0x33')]);_0xabfe95['filters']=_['intersection'](_0xabfe95[_0xcd84('0x31')],_0xabfe95[_0xcd84('0x33')]);_0x38d17d[_0xcd84('0x36')]=_['intersection'](_0xabfe95['model'],qs[_0xcd84('0x37')](_0x3fc17d['query'][_0xcd84('0x37')]));_0x38d17d[_0xcd84('0x36')]=_0x38d17d['attributes'][_0xcd84('0x38')]?_0x38d17d[_0xcd84('0x36')]:_0xabfe95['model'];if(_0x3fc17d[_0xcd84('0x33')][_0xcd84('0x48')]){_0x38d17d[_0xcd84('0x42')]=[{'all':!![]}];}_0x38d17d=_['merge']({},_0x38d17d,_0x3fc17d['options']);return db['FreshdeskAccount'][_0xcd84('0x49')](_0x38d17d)[_0xcd84('0x26')](handleEntityNotFound(_0x1254cd,null))[_0xcd84('0x26')](respondWithResult(_0x1254cd,null))[_0xcd84('0x45')](handleError(_0x1254cd,null));};exports[_0xcd84('0x4a')]=function(_0x5d44ff,_0x4da28d){return db[_0xcd84('0x2c')][_0xcd84('0x4a')](_0x5d44ff['body'],{})['then'](respondWithResult(_0x4da28d,0xc9))[_0xcd84('0x45')](handleError(_0x4da28d,null));};exports[_0xcd84('0x25')]=function(_0x1b3ee1,_0x13bcc8){if(_0x1b3ee1[_0xcd84('0x4b')]['id']){delete _0x1b3ee1[_0xcd84('0x4b')]['id'];}return db[_0xcd84('0x2c')][_0xcd84('0x49')]({'where':{'id':_0x1b3ee1[_0xcd84('0x47')]['id']}})[_0xcd84('0x26')](handleEntityNotFound(_0x13bcc8,null))[_0xcd84('0x26')](saveUpdates(_0x1b3ee1['body'],null))[_0xcd84('0x26')](respondWithResult(_0x13bcc8,null))['catch'](handleError(_0x13bcc8,null));};exports[_0xcd84('0x27')]=function(_0x4c50df,_0x1e131a){return db['FreshdeskAccount'][_0xcd84('0x49')]({'where':{'id':_0x4c50df['params']['id']}})[_0xcd84('0x26')](handleEntityNotFound(_0x1e131a,null))[_0xcd84('0x26')](removeEntity(_0x1e131a,null))['catch'](handleError(_0x1e131a,null));};exports[_0xcd84('0x4c')]=function(_0x268fe5,_0x216c9,_0x5a3496){var _0x4c6c46={};var _0x402595={};var _0x3899dc;var _0x4f8e02;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x268fe5['params']['id']}})[_0xcd84('0x26')](handleEntityNotFound(_0x216c9,null))[_0xcd84('0x26')](function(_0x8ae28f){if(_0x8ae28f){_0x3899dc=_0x8ae28f;_0x402595['model']=_[_0xcd84('0x32')](db[_0xcd84('0x4d')][_0xcd84('0x2d')]);_0x402595[_0xcd84('0x33')]=_[_0xcd84('0x32')](_0x268fe5[_0xcd84('0x33')]);_0x402595[_0xcd84('0x34')]=_[_0xcd84('0x35')](_0x402595[_0xcd84('0x31')],_0x402595[_0xcd84('0x33')]);_0x4c6c46[_0xcd84('0x36')]=_[_0xcd84('0x35')](_0x402595[_0xcd84('0x31')],qs[_0xcd84('0x37')](_0x268fe5[_0xcd84('0x33')][_0xcd84('0x37')]));_0x4c6c46[_0xcd84('0x36')]=_0x4c6c46[_0xcd84('0x36')][_0xcd84('0x38')]?_0x4c6c46['attributes']:_0x402595[_0xcd84('0x31')];_0x4c6c46[_0xcd84('0x3a')]=qs[_0xcd84('0x3b')](_0x268fe5['query'][_0xcd84('0x3b')]);_0x4c6c46[_0xcd84('0x3c')]=qs[_0xcd84('0x34')](_[_0xcd84('0x3d')](_0x268fe5[_0xcd84('0x33')],_0x402595['filters']));if(_0x268fe5[_0xcd84('0x33')][_0xcd84('0x3e')]){_0x4c6c46[_0xcd84('0x3c')]=_[_0xcd84('0x3f')](_0x4c6c46[_0xcd84('0x3c')],{'$or':_['map'](_0x4c6c46[_0xcd84('0x36')],function(_0x325da1){var _0x452329={};_0x452329[_0x325da1]={'$like':'%'+_0x268fe5['query'][_0xcd84('0x3e')]+'%'};return _0x452329;})});}_0x4c6c46=_[_0xcd84('0x3f')]({},_0x4c6c46,_0x268fe5[_0xcd84('0x41')]);return _0x3899dc['getConfigurations'](_0x4c6c46);}})[_0xcd84('0x26')](function(_0x504918){if(_0x504918){_0x4f8e02=_0x504918[_0xcd84('0x38')];if(!_0x268fe5[_0xcd84('0x33')][_0xcd84('0x4e')]('nolimit')){_0x4c6c46[_0xcd84('0x21')]=qs[_0xcd84('0x21')](_0x268fe5[_0xcd84('0x33')][_0xcd84('0x21')]);_0x4c6c46[_0xcd84('0x1f')]=qs[_0xcd84('0x1f')](_0x268fe5['query']['offset']);}return _0x3899dc['getConfigurations'](_0x4c6c46);}})[_0xcd84('0x26')](function(_0x387c8f){if(_0x387c8f){return _0x387c8f?{'count':_0x4f8e02,'rows':_0x387c8f}:null;}})[_0xcd84('0x26')](respondWithResult(_0x216c9,null))[_0xcd84('0x45')](handleError(_0x216c9,null));};exports[_0xcd84('0x4f')]=function(_0x4ab032,_0x4e4f10,_0x58cdfd){if(_0x4ab032[_0xcd84('0x4b')]['id']){delete _0x4ab032[_0xcd84('0x4b')]['id'];}return db[_0xcd84('0x2c')][_0xcd84('0x50')]({'where':{'id':_0x4ab032[_0xcd84('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e4f10,null))['then'](function(_0xcc39ca){if(_0xcc39ca){_0x4ab032[_0xcd84('0x4b')][_0xcd84('0x51')]=_0xcc39ca['id'];_0x4ab032[_0xcd84('0x4b')][_0xcd84('0x52')]=integrations[_0xcd84('0x53')](_0x4ab032[_0xcd84('0x4b')][_0xcd84('0x54')],_0x4ab032[_0xcd84('0x4b')][_0xcd84('0x2f')]);_0x4ab032['body'][_0xcd84('0x55')]=integrations[_0xcd84('0x56')](_0x4ab032['body'][_0xcd84('0x54')],_0x4ab032[_0xcd84('0x4b')][_0xcd84('0x2f')]);return db[_0xcd84('0x4d')][_0xcd84('0x4a')](_0x4ab032[_0xcd84('0x4b')],{'include':[{'model':db[_0xcd84('0x57')],'as':_0xcd84('0x52')},{'model':db[_0xcd84('0x57')],'as':_0xcd84('0x55')}]});}return null;})[_0xcd84('0x26')](respondWithResult(_0x4e4f10,null))[_0xcd84('0x45')](handleError(_0x4e4f10,null));};exports[_0xcd84('0x58')]=function(_0x4e8536,_0x4b476e,_0x300cf7){var _0x273be1='';return db['FreshdeskAccount'][_0xcd84('0x50')]({'where':{'id':_0x4e8536[_0xcd84('0x47')]['id']},'attributes':['id',_0xcd84('0x59'),'apiKey']})['then'](handleEntityNotFound(_0x4b476e,null))['then'](function(_0x165a66){if(_0x165a66){_0x273be1=_0x165a66[_0xcd84('0x59')];var _0x1b7464=_0x273be1[_0xcd84('0x5a')](-0x1);if(_0x1b7464==='/'){_0x273be1=_0x273be1['substring'](0x0,_0x273be1[_0xcd84('0x5b')](_0x1b7464));}return rp({'method':_0xcd84('0x5c'),'uri':util['format']('%s/%s',_0x273be1,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xcd84('0x5d')]('Basic\x20%s',new Buffer(util[_0xcd84('0x5d')](_0xcd84('0x5e'),_0x165a66[_0xcd84('0x5f')]))[_0xcd84('0x60')](_0xcd84('0x61')))},'json':!![]});}})[_0xcd84('0x26')](function(_0xcf40cb){if(_0xcf40cb){var _0x1208d5=['requester',_0xcd84('0x62'),_0xcd84('0x63'),_0xcd84('0x64'),_0xcd84('0x1c'),_0xcd84('0x65'),_0xcd84('0x66'),_0xcd84('0x67'),_0xcd84('0x68'),_0xcd84('0x66'),_0xcd84('0x69')];_[_0xcd84('0x6a')](_0xcf40cb,function(_0x1bbcbf){return _0x1208d5[_0xcd84('0x6b')](_0x1bbcbf[_0xcd84('0x28')])||!_0x1bbcbf[_0xcd84('0x6c')]&&_0x1bbcbf[_0xcd84('0x2f')]!==_0xcd84('0x6d')&&_0x1bbcbf[_0xcd84('0x2f')]!=='custom_dropdown';});return{'count':_0xcf40cb['length'],'rows':_[_0xcd84('0x2b')](_0xcf40cb,function(_0xe94bff){return{'id':_0xe94bff['name'],'name':_0xe94bff[_0xcd84('0x6e')],'custom':!_0xe94bff[_0xcd84('0x6c')],'options':_0xe94bff[_0xcd84('0x6f')]?_[_0xcd84('0x2b')](_0xe94bff['choices'],function(_0x187057){return{'name':_[_0xcd84('0x70')](_0x187057),'value':_0x187057};}):[]};})};}})[_0xcd84('0x26')](respondWithResult(_0x4b476e,null))[_0xcd84('0x45')](function(_0x1b825f){var _0x43df4d=_0x4e8536['query'][_0xcd84('0x71')]?0x1f4:_0x1b825f['statusCode']||0x1f4;logger[_0xcd84('0x72')](_0xcd84('0x73'),_0xcd84('0x58'),_0x43df4d,JSON['stringify'](_0x1b825f));delete _0x1b825f['name'];if(_0x43df4d===0x191){_0x43df4d=0x190;}_0x4b476e['status'](_0x43df4d)['send'](_0x4e8536[_0xcd84('0x33')][_0xcd84('0x71')]?{'message':_0xcd84('0x74'),'statusCode':_0x1b825f[_0xcd84('0x75')]}:_0x1b825f);});}; \ No newline at end of file +var _0xad13=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','include','rows','catch','show','fields','includeAll','create','body','params','getConfigurations','FreshdeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','agent','description','priority','group','source','remove','custom_text','label','default','choices','capitalize'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xad13,0x79));var _0x3ad1=function(_0x4d3b25,_0x140a35){_0x4d3b25=_0x4d3b25-0x0;var _0x49e203=_0xad13[_0x4d3b25];return _0x49e203;};'use strict';var emlformat=require(_0x3ad1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ad1('0x1'));var jsonpatch=require(_0x3ad1('0x2'));var rp=require(_0x3ad1('0x3'));var moment=require(_0x3ad1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ad1('0x5'));var util=require(_0x3ad1('0x6'));var path=require(_0x3ad1('0x7'));var sox=require(_0x3ad1('0x8'));var csv=require(_0x3ad1('0x9'));var ejs=require(_0x3ad1('0xa'));var fs=require('fs');var fs_extra=require(_0x3ad1('0xb'));var _=require(_0x3ad1('0xc'));var squel=require(_0x3ad1('0xd'));var crypto=require(_0x3ad1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3ad1('0xf'));var toCsv=require(_0x3ad1('0x9'));var querystring=require(_0x3ad1('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ad1('0x11'));var authService=require(_0x3ad1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ad1('0x13'));var hardwareService=require(_0x3ad1('0x14'));var logger=require(_0x3ad1('0x15'))(_0x3ad1('0x16'));var utils=require(_0x3ad1('0x17'));var config=require(_0x3ad1('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3ad1('0x19'));function respondWithStatusCode(_0x42f6a0,_0x4544c0){_0x4544c0=_0x4544c0||0xcc;return function(_0x3eadf8){if(_0x3eadf8){return _0x42f6a0['sendStatus'](_0x4544c0);}return _0x42f6a0[_0x3ad1('0x1a')](_0x4544c0)['end']();};}function respondWithResult(_0x19b1db,_0x3b68de){_0x3b68de=_0x3b68de||0xc8;return function(_0x240584){if(_0x240584){return _0x19b1db[_0x3ad1('0x1a')](_0x3b68de)[_0x3ad1('0x1b')](_0x240584);}};}function respondWithFilteredResult(_0x4104aa,_0xce229){return function(_0x384ed5){if(_0x384ed5){var _0x44838b=typeof _0xce229[_0x3ad1('0x1c')]===_0x3ad1('0x1d')&&typeof _0xce229[_0x3ad1('0x1e')]==='undefined';var _0x244a93=_0x384ed5[_0x3ad1('0x1f')];var _0x79b791=_0x44838b?0x0:_0xce229[_0x3ad1('0x1c')];var _0x11e3ed=_0x44838b?_0x384ed5['count']:_0xce229[_0x3ad1('0x1c')]+_0xce229[_0x3ad1('0x1e')];var _0x57c4d1;if(_0x11e3ed>=_0x244a93){_0x11e3ed=_0x244a93;_0x57c4d1=0xc8;}else{_0x57c4d1=0xce;}_0x4104aa[_0x3ad1('0x1a')](_0x57c4d1);return _0x4104aa[_0x3ad1('0x20')](_0x3ad1('0x21'),_0x79b791+'-'+_0x11e3ed+'/'+_0x244a93)[_0x3ad1('0x1b')](_0x384ed5);}return null;};}function patchUpdates(_0x1f65ff){return function(_0x17640b){try{jsonpatch['apply'](_0x17640b,_0x1f65ff,!![]);}catch(_0x262fe0){return BPromise['reject'](_0x262fe0);}return _0x17640b[_0x3ad1('0x22')]();};}function saveUpdates(_0x5f1031,_0x21ed3b){return function(_0x34df3d){if(_0x34df3d){return _0x34df3d[_0x3ad1('0x23')](_0x5f1031)[_0x3ad1('0x24')](function(_0x2365f3){return _0x2365f3;});}return null;};}function removeEntity(_0x3a0166,_0x2fd5e6){return function(_0x591c61){if(_0x591c61){return _0x591c61[_0x3ad1('0x25')]()[_0x3ad1('0x24')](function(){_0x3a0166[_0x3ad1('0x1a')](0xcc)[_0x3ad1('0x26')]();});}};}function handleEntityNotFound(_0x1d82a8,_0x2cd135){return function(_0x58fdcf){if(!_0x58fdcf){_0x1d82a8['sendStatus'](0x194);}return _0x58fdcf;};}function handleError(_0x7b69e5,_0x5e1c03){_0x5e1c03=_0x5e1c03||0x1f4;return function(_0x57feeb){logger[_0x3ad1('0x27')](_0x57feeb[_0x3ad1('0x28')]);if(_0x57feeb[_0x3ad1('0x29')]){delete _0x57feeb[_0x3ad1('0x29')];}_0x7b69e5['status'](_0x5e1c03)[_0x3ad1('0x2a')](_0x57feeb);};}exports[_0x3ad1('0x2b')]=function(_0x402df6,_0x3753f1){var _0x345cb9={},_0x481816={},_0x50f934={'count':0x0,'rows':[]};var _0x199285=_['map'](db[_0x3ad1('0x2c')][_0x3ad1('0x2d')],function(_0x266d0d){return{'name':_0x266d0d[_0x3ad1('0x2e')],'type':_0x266d0d[_0x3ad1('0x2f')][_0x3ad1('0x30')]};});_0x481816[_0x3ad1('0x31')]=_[_0x3ad1('0x32')](_0x199285,_0x3ad1('0x29'));_0x481816['query']=_[_0x3ad1('0x33')](_0x402df6['query']);_0x481816[_0x3ad1('0x34')]=_[_0x3ad1('0x35')](_0x481816[_0x3ad1('0x31')],_0x481816[_0x3ad1('0x36')]);_0x345cb9[_0x3ad1('0x37')]=_[_0x3ad1('0x35')](_0x481816[_0x3ad1('0x31')],qs['fields'](_0x402df6[_0x3ad1('0x36')]['fields']));_0x345cb9['attributes']=_0x345cb9['attributes'][_0x3ad1('0x38')]?_0x345cb9[_0x3ad1('0x37')]:_0x481816[_0x3ad1('0x31')];if(!_0x402df6[_0x3ad1('0x36')][_0x3ad1('0x39')](_0x3ad1('0x3a'))){_0x345cb9['limit']=qs['limit'](_0x402df6[_0x3ad1('0x36')][_0x3ad1('0x1e')]);_0x345cb9[_0x3ad1('0x1c')]=qs[_0x3ad1('0x1c')](_0x402df6[_0x3ad1('0x36')]['offset']);}_0x345cb9['order']=qs['sort'](_0x402df6['query'][_0x3ad1('0x3b')]);_0x345cb9['where']=qs[_0x3ad1('0x34')](_[_0x3ad1('0x3c')](_0x402df6[_0x3ad1('0x36')],_0x481816['filters']),_0x199285);if(_0x402df6[_0x3ad1('0x36')][_0x3ad1('0x3d')]){_0x345cb9['where']=_[_0x3ad1('0x3e')](_0x345cb9['where'],{'$or':_[_0x3ad1('0x32')](_0x199285,function(_0x2fbe75){if(_0x2fbe75[_0x3ad1('0x2f')]!==_0x3ad1('0x3f')){var _0x4d445c={};_0x4d445c[_0x2fbe75['name']]={'$like':'%'+_0x402df6[_0x3ad1('0x36')][_0x3ad1('0x3d')]+'%'};return _0x4d445c;}})});}_0x345cb9=_[_0x3ad1('0x3e')]({},_0x345cb9,_0x402df6[_0x3ad1('0x40')]);var _0x5598c3={'where':_0x345cb9[_0x3ad1('0x41')]};return db[_0x3ad1('0x2c')][_0x3ad1('0x1f')](_0x5598c3)[_0x3ad1('0x24')](function(_0x48a66e){_0x50f934[_0x3ad1('0x1f')]=_0x48a66e;if(_0x402df6['query']['includeAll']){_0x345cb9[_0x3ad1('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x345cb9);})['then'](function(_0x475c20){_0x50f934[_0x3ad1('0x43')]=_0x475c20;return _0x50f934;})[_0x3ad1('0x24')](respondWithFilteredResult(_0x3753f1,_0x345cb9))[_0x3ad1('0x44')](handleError(_0x3753f1,null));};exports[_0x3ad1('0x45')]=function(_0x4e8808,_0x4bd3ae){var _0xf267d0={'raw':![],'where':{'id':_0x4e8808['params']['id']}},_0x44bdfd={};_0x44bdfd[_0x3ad1('0x31')]=_[_0x3ad1('0x33')](db['FreshdeskAccount'][_0x3ad1('0x2d')]);_0x44bdfd[_0x3ad1('0x36')]=_['keys'](_0x4e8808[_0x3ad1('0x36')]);_0x44bdfd['filters']=_[_0x3ad1('0x35')](_0x44bdfd[_0x3ad1('0x31')],_0x44bdfd[_0x3ad1('0x36')]);_0xf267d0[_0x3ad1('0x37')]=_[_0x3ad1('0x35')](_0x44bdfd[_0x3ad1('0x31')],qs[_0x3ad1('0x46')](_0x4e8808['query']['fields']));_0xf267d0[_0x3ad1('0x37')]=_0xf267d0[_0x3ad1('0x37')][_0x3ad1('0x38')]?_0xf267d0[_0x3ad1('0x37')]:_0x44bdfd['model'];if(_0x4e8808['query'][_0x3ad1('0x47')]){_0xf267d0['include']=[{'all':!![]}];}_0xf267d0=_[_0x3ad1('0x3e')]({},_0xf267d0,_0x4e8808['options']);return db[_0x3ad1('0x2c')]['find'](_0xf267d0)[_0x3ad1('0x24')](handleEntityNotFound(_0x4bd3ae,null))[_0x3ad1('0x24')](respondWithResult(_0x4bd3ae,null))[_0x3ad1('0x44')](handleError(_0x4bd3ae,null));};exports['create']=function(_0x29cbb4,_0xeea803){return db[_0x3ad1('0x2c')][_0x3ad1('0x48')](_0x29cbb4['body'],{})[_0x3ad1('0x24')](respondWithResult(_0xeea803,0xc9))[_0x3ad1('0x44')](handleError(_0xeea803,null));};exports[_0x3ad1('0x23')]=function(_0x456e31,_0xe37dc5){if(_0x456e31[_0x3ad1('0x49')]['id']){delete _0x456e31['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x456e31[_0x3ad1('0x4a')]['id']}})[_0x3ad1('0x24')](handleEntityNotFound(_0xe37dc5,null))['then'](saveUpdates(_0x456e31['body'],null))[_0x3ad1('0x24')](respondWithResult(_0xe37dc5,null))[_0x3ad1('0x44')](handleError(_0xe37dc5,null));};exports[_0x3ad1('0x25')]=function(_0x5f378b,_0x516a3d){return db[_0x3ad1('0x2c')]['find']({'where':{'id':_0x5f378b['params']['id']}})['then'](handleEntityNotFound(_0x516a3d,null))[_0x3ad1('0x24')](removeEntity(_0x516a3d,null))[_0x3ad1('0x44')](handleError(_0x516a3d,null));};exports[_0x3ad1('0x4b')]=function(_0x2ffd72,_0x3b8d66,_0x4a5425){var _0x373f4e={};var _0x72c1bd={};var _0x2745aa;var _0x4081d4;return db[_0x3ad1('0x2c')]['findOne']({'where':{'id':_0x2ffd72[_0x3ad1('0x4a')]['id']}})[_0x3ad1('0x24')](handleEntityNotFound(_0x3b8d66,null))[_0x3ad1('0x24')](function(_0x300faf){if(_0x300faf){_0x2745aa=_0x300faf;_0x72c1bd[_0x3ad1('0x31')]=_[_0x3ad1('0x33')](db[_0x3ad1('0x4c')][_0x3ad1('0x2d')]);_0x72c1bd[_0x3ad1('0x36')]=_[_0x3ad1('0x33')](_0x2ffd72['query']);_0x72c1bd['filters']=_[_0x3ad1('0x35')](_0x72c1bd['model'],_0x72c1bd[_0x3ad1('0x36')]);_0x373f4e[_0x3ad1('0x37')]=_[_0x3ad1('0x35')](_0x72c1bd['model'],qs[_0x3ad1('0x46')](_0x2ffd72['query'][_0x3ad1('0x46')]));_0x373f4e['attributes']=_0x373f4e[_0x3ad1('0x37')][_0x3ad1('0x38')]?_0x373f4e['attributes']:_0x72c1bd[_0x3ad1('0x31')];_0x373f4e[_0x3ad1('0x4d')]=qs[_0x3ad1('0x3b')](_0x2ffd72[_0x3ad1('0x36')][_0x3ad1('0x3b')]);_0x373f4e['where']=qs[_0x3ad1('0x34')](_['pick'](_0x2ffd72[_0x3ad1('0x36')],_0x72c1bd[_0x3ad1('0x34')]));if(_0x2ffd72[_0x3ad1('0x36')][_0x3ad1('0x3d')]){_0x373f4e[_0x3ad1('0x41')]=_[_0x3ad1('0x3e')](_0x373f4e[_0x3ad1('0x41')],{'$or':_[_0x3ad1('0x32')](_0x373f4e['attributes'],function(_0x29eec2){var _0x33a99e={};_0x33a99e[_0x29eec2]={'$like':'%'+_0x2ffd72[_0x3ad1('0x36')][_0x3ad1('0x3d')]+'%'};return _0x33a99e;})});}_0x373f4e=_[_0x3ad1('0x3e')]({},_0x373f4e,_0x2ffd72[_0x3ad1('0x40')]);return _0x2745aa['getConfigurations'](_0x373f4e);}})[_0x3ad1('0x24')](function(_0x1863e1){if(_0x1863e1){_0x4081d4=_0x1863e1[_0x3ad1('0x38')];if(!_0x2ffd72[_0x3ad1('0x36')][_0x3ad1('0x39')](_0x3ad1('0x3a'))){_0x373f4e[_0x3ad1('0x1e')]=qs['limit'](_0x2ffd72['query'][_0x3ad1('0x1e')]);_0x373f4e[_0x3ad1('0x1c')]=qs[_0x3ad1('0x1c')](_0x2ffd72[_0x3ad1('0x36')][_0x3ad1('0x1c')]);}return _0x2745aa[_0x3ad1('0x4b')](_0x373f4e);}})[_0x3ad1('0x24')](function(_0x51dedc){if(_0x51dedc){return _0x51dedc?{'count':_0x4081d4,'rows':_0x51dedc}:null;}})[_0x3ad1('0x24')](respondWithResult(_0x3b8d66,null))[_0x3ad1('0x44')](handleError(_0x3b8d66,null));};exports[_0x3ad1('0x4e')]=function(_0x2e2904,_0x569d9a,_0x4da588){if(_0x2e2904[_0x3ad1('0x49')]['id']){delete _0x2e2904['body']['id'];}return db[_0x3ad1('0x2c')][_0x3ad1('0x4f')]({'where':{'id':_0x2e2904['params']['id']}})[_0x3ad1('0x24')](handleEntityNotFound(_0x569d9a,null))[_0x3ad1('0x24')](function(_0x43ac0a){if(_0x43ac0a){_0x2e2904[_0x3ad1('0x49')][_0x3ad1('0x50')]=_0x43ac0a['id'];_0x2e2904[_0x3ad1('0x49')][_0x3ad1('0x51')]=integrations[_0x3ad1('0x52')](_0x2e2904[_0x3ad1('0x49')][_0x3ad1('0x53')],_0x2e2904[_0x3ad1('0x49')][_0x3ad1('0x2f')]);_0x2e2904['body']['Descriptions']=integrations[_0x3ad1('0x54')](_0x2e2904[_0x3ad1('0x49')][_0x3ad1('0x53')],_0x2e2904['body'][_0x3ad1('0x2f')]);return db['FreshdeskConfiguration'][_0x3ad1('0x48')](_0x2e2904[_0x3ad1('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x3ad1('0x51')},{'model':db[_0x3ad1('0x55')],'as':_0x3ad1('0x56')}]});}return null;})[_0x3ad1('0x24')](respondWithResult(_0x569d9a,null))['catch'](handleError(_0x569d9a,null));};exports[_0x3ad1('0x57')]=function(_0x1fcb70,_0xedbe1c,_0x211e1e){var _0x35212b='';return db[_0x3ad1('0x2c')][_0x3ad1('0x4f')]({'where':{'id':_0x1fcb70['params']['id']},'attributes':['id',_0x3ad1('0x58'),_0x3ad1('0x59')]})[_0x3ad1('0x24')](handleEntityNotFound(_0xedbe1c,null))['then'](function(_0x2c15b4){if(_0x2c15b4){_0x35212b=_0x2c15b4[_0x3ad1('0x58')];var _0x5b0efe=_0x35212b[_0x3ad1('0x5a')](-0x1);if(_0x5b0efe==='/'){_0x35212b=_0x35212b['substring'](0x0,_0x35212b[_0x3ad1('0x5b')](_0x5b0efe));}return rp({'method':_0x3ad1('0x5c'),'uri':util[_0x3ad1('0x5d')](_0x3ad1('0x5e'),_0x35212b,_0x3ad1('0x5f')),'headers':{'Authorization':util['format'](_0x3ad1('0x60'),new Buffer(util[_0x3ad1('0x5d')]('%s:X',_0x2c15b4[_0x3ad1('0x59')]))[_0x3ad1('0x61')](_0x3ad1('0x62')))},'json':!![]});}})[_0x3ad1('0x24')](function(_0x33b5c0){if(_0x33b5c0){var _0x2ff3a7=[_0x3ad1('0x63'),'subject',_0x3ad1('0x64'),_0x3ad1('0x65'),_0x3ad1('0x1a'),_0x3ad1('0x66'),_0x3ad1('0x67'),_0x3ad1('0x68'),'ticket_type',_0x3ad1('0x67'),'company'];_[_0x3ad1('0x69')](_0x33b5c0,function(_0x4e4f32){return _0x2ff3a7['includes'](_0x4e4f32[_0x3ad1('0x29')])||!_0x4e4f32['default']&&_0x4e4f32['type']!==_0x3ad1('0x6a')&&_0x4e4f32[_0x3ad1('0x2f')]!=='custom_dropdown';});return{'count':_0x33b5c0[_0x3ad1('0x38')],'rows':_[_0x3ad1('0x32')](_0x33b5c0,function(_0x1c2aa2){return{'id':_0x1c2aa2[_0x3ad1('0x29')],'name':_0x1c2aa2[_0x3ad1('0x6b')],'custom':!_0x1c2aa2[_0x3ad1('0x6c')],'options':_0x1c2aa2[_0x3ad1('0x6d')]?_[_0x3ad1('0x32')](_0x1c2aa2[_0x3ad1('0x6d')],function(_0xd03d1b){return{'name':_[_0x3ad1('0x6e')](_0xd03d1b),'value':_0xd03d1b};}):[]};})};}})[_0x3ad1('0x24')](respondWithResult(_0xedbe1c,null))[_0x3ad1('0x44')](function(_0x1ce624){var _0xdbfe62=_0x1fcb70[_0x3ad1('0x36')][_0x3ad1('0x6f')]?0x1f4:_0x1ce624[_0x3ad1('0x70')]||0x1f4;logger[_0x3ad1('0x27')](_0x3ad1('0x71'),_0x3ad1('0x57'),_0xdbfe62,JSON[_0x3ad1('0x72')](_0x1ce624));delete _0x1ce624[_0x3ad1('0x29')];if(_0xdbfe62===0x191){_0xdbfe62=0x190;}_0xedbe1c[_0x3ad1('0x1a')](_0xdbfe62)[_0x3ad1('0x2a')](_0x1fcb70[_0x3ad1('0x36')][_0x3ad1('0x6f')]?{'message':_0x3ad1('0x73'),'statusCode':_0x1ce624['statusCode']}:_0x1ce624);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 61f397b..6d12f4e 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 _0x46ad=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ce781,_0x736b15){var _0xa70499=function(_0x48558b){while(--_0x48558b){_0x5ce781['push'](_0x5ce781['shift']());}};_0xa70499(++_0x736b15);}(_0x46ad,0x19e));var _0xd46a=function(_0x26de98,_0x558653){_0x26de98=_0x26de98-0x0;var _0x1de3aa=_0x46ad[_0x26de98];return _0x1de3aa;};'use strict';var _=require(_0xd46a('0x0'));var util=require(_0xd46a('0x1'));var logger=require(_0xd46a('0x2'))(_0xd46a('0x3'));var moment=require(_0xd46a('0x4'));var BPromise=require(_0xd46a('0x5'));var rp=require(_0xd46a('0x6'));var fs=require('fs');var path=require(_0xd46a('0x7'));var rimraf=require(_0xd46a('0x8'));var config=require(_0xd46a('0x9'));var attributes=require(_0xd46a('0xa'));var integrations=require(_0xd46a('0xb'));module[_0xd46a('0xc')]=function(_0x33970c,_0x4adcec){return _0x33970c[_0xd46a('0xd')](_0xd46a('0xe'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bb5=['FreshdeskAccount','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4bb5,0x109));var _0x54bb=function(_0x21b3df,_0x34bd70){_0x21b3df=_0x21b3df-0x0;var _0x1e14d5=_0x4bb5[_0x21b3df];return _0x1e14d5;};'use strict';var _=require(_0x54bb('0x0'));var util=require(_0x54bb('0x1'));var logger=require('../../config/logger')(_0x54bb('0x2'));var moment=require('moment');var BPromise=require(_0x54bb('0x3'));var rp=require(_0x54bb('0x4'));var fs=require('fs');var path=require(_0x54bb('0x5'));var rimraf=require(_0x54bb('0x6'));var config=require(_0x54bb('0x7'));var attributes=require(_0x54bb('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x54bb('0x9')]=function(_0x459a40,_0x1584c7){return _0x459a40[_0x54bb('0xa')](_0x54bb('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 bb38c86..72913f0 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 _0xb9b3=['FreshdeskAccount','options','raw','where','attributes','limit','include','model','map','then','stringify','catch','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb9b3,0x1a6));var _0x3b9b=function(_0x413e7f,_0x908f1b){_0x413e7f=_0x413e7f-0x0;var _0x4b9b88=_0xb9b3[_0x413e7f];return _0x4b9b88;};'use strict';var _=require(_0x3b9b('0x0'));var util=require(_0x3b9b('0x1'));var moment=require('moment');var BPromise=require(_0x3b9b('0x2'));var rs=require(_0x3b9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b9b('0x4'));var logger=require(_0x3b9b('0x5'))(_0x3b9b('0x6'));var config=require(_0x3b9b('0x7'));var jayson=require(_0x3b9b('0x8'));var client=jayson['client'][_0x3b9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a355,_0x1b34b5,_0x3cd0eb){return new BPromise(function(_0x3269c5,_0x560a21){return client[_0x3b9b('0xa')](_0x58a355,_0x3cd0eb)['then'](function(_0x51e228){logger[_0x3b9b('0xb')](_0x3b9b('0xc'),_0x1b34b5,_0x3b9b('0xd'));logger['debug'](_0x3b9b('0xe'),_0x1b34b5,_0x3b9b('0xd'),JSON['stringify'](_0x51e228));if(_0x51e228['error']){if(_0x51e228[_0x3b9b('0xf')][_0x3b9b('0x10')]===0x1f4){logger[_0x3b9b('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x1b34b5,_0x51e228[_0x3b9b('0xf')][_0x3b9b('0x11')]);return _0x560a21(_0x51e228[_0x3b9b('0xf')][_0x3b9b('0x11')]);}logger[_0x3b9b('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x1b34b5,_0x51e228[_0x3b9b('0xf')]['message']);return _0x3269c5(_0x51e228[_0x3b9b('0xf')][_0x3b9b('0x11')]);}else{logger[_0x3b9b('0xb')](_0x3b9b('0xc'),_0x1b34b5,'request\x20sent');_0x3269c5(_0x51e228[_0x3b9b('0x12')][_0x3b9b('0x11')]);}})['catch'](function(_0xe43335){logger[_0x3b9b('0xf')](_0x3b9b('0xc'),_0x1b34b5,_0xe43335);_0x560a21(_0xe43335);});});}exports[_0x3b9b('0x13')]=function(_0xb98c02){var _0x28a2f3=this;return new Promise(function(_0x1b1c71,_0x21da71){return db[_0x3b9b('0x14')]['findAll']({'raw':_0xb98c02[_0x3b9b('0x15')]?_0xb98c02[_0x3b9b('0x15')][_0x3b9b('0x16')]===undefined?!![]:![]:!![],'where':_0xb98c02[_0x3b9b('0x15')]?_0xb98c02[_0x3b9b('0x15')][_0x3b9b('0x17')]||null:null,'attributes':_0xb98c02[_0x3b9b('0x15')]?_0xb98c02[_0x3b9b('0x15')][_0x3b9b('0x18')]||null:null,'limit':_0xb98c02['options']?_0xb98c02[_0x3b9b('0x15')][_0x3b9b('0x19')]||null:null,'include':_0xb98c02[_0x3b9b('0x15')]?_0xb98c02[_0x3b9b('0x15')]['include']?_['map'](_0xb98c02[_0x3b9b('0x15')][_0x3b9b('0x1a')],function(_0x329003){return{'model':db[_0x329003[_0x3b9b('0x1b')]],'as':_0x329003['as'],'attributes':_0x329003['attributes'],'include':_0x329003[_0x3b9b('0x1a')]?_[_0x3b9b('0x1c')](_0x329003[_0x3b9b('0x1a')],function(_0x338f22){return{'model':db[_0x338f22[_0x3b9b('0x1b')]],'as':_0x338f22['as'],'attributes':_0x338f22[_0x3b9b('0x18')],'include':_0x338f22[_0x3b9b('0x1a')]?_[_0x3b9b('0x1c')](_0x338f22[_0x3b9b('0x1a')],function(_0x328d13){return{'model':db[_0x328d13['model']],'as':_0x328d13['as'],'attributes':_0x328d13[_0x3b9b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b9b('0x1d')](function(_0x56f7e5){logger[_0x3b9b('0xb')](_0x3b9b('0x13'),_0xb98c02);logger['debug'](_0x3b9b('0x13'),_0xb98c02,JSON[_0x3b9b('0x1e')](_0x56f7e5));_0x1b1c71(_0x56f7e5);})[_0x3b9b('0x1f')](function(_0x5ab12a){logger[_0x3b9b('0xf')]('GetFreshdeskAccount',_0x5ab12a[_0x3b9b('0x11')],_0xb98c02);_0x21da71(_0x28a2f3[_0x3b9b('0xf')](0x1f4,_0x5ab12a[_0x3b9b('0x11')]));});});};exports[_0x3b9b('0x20')]=function(_0x5d6364){var _0x1edfb8=this;return new Promise(function(_0x542c21,_0x66fba1){return db[_0x3b9b('0x14')][_0x3b9b('0x21')]({'raw':_0x5d6364[_0x3b9b('0x15')]?_0x5d6364[_0x3b9b('0x15')][_0x3b9b('0x16')]===undefined?!![]:![]:!![],'where':_0x5d6364[_0x3b9b('0x15')]?_0x5d6364[_0x3b9b('0x15')][_0x3b9b('0x17')]||null:null,'attributes':_0x5d6364['options']?_0x5d6364[_0x3b9b('0x15')][_0x3b9b('0x18')]||null:null,'include':_0x5d6364[_0x3b9b('0x15')]?_0x5d6364[_0x3b9b('0x15')]['include']?_['map'](_0x5d6364['options'][_0x3b9b('0x1a')],function(_0x32ed0b){return{'model':db[_0x32ed0b['model']],'as':_0x32ed0b['as'],'attributes':_0x32ed0b[_0x3b9b('0x18')],'include':_0x32ed0b[_0x3b9b('0x1a')]?_[_0x3b9b('0x1c')](_0x32ed0b['include'],function(_0x4dd7e7){return{'model':db[_0x4dd7e7[_0x3b9b('0x1b')]],'as':_0x4dd7e7['as'],'attributes':_0x4dd7e7['attributes'],'include':_0x4dd7e7[_0x3b9b('0x1a')]?_[_0x3b9b('0x1c')](_0x4dd7e7[_0x3b9b('0x1a')],function(_0x3594e9){return{'model':db[_0x3594e9[_0x3b9b('0x1b')]],'as':_0x3594e9['as'],'attributes':_0x3594e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b9b('0x1d')](function(_0x2a97e2){logger[_0x3b9b('0xb')](_0x3b9b('0x20'),_0x5d6364);logger['debug'](_0x3b9b('0x20'),_0x5d6364,JSON[_0x3b9b('0x1e')](_0x2a97e2));_0x542c21(_0x2a97e2);})[_0x3b9b('0x1f')](function(_0x41f6f2){logger[_0x3b9b('0xf')]('ShowFreshdeskAccount',_0x41f6f2[_0x3b9b('0x11')],_0x5d6364);_0x66fba1(_0x1edfb8[_0x3b9b('0xf')](0x1f4,_0x41f6f2[_0x3b9b('0x11')]));});});}; \ No newline at end of file +var _0xf555=['raw','options','where','attributes','limit','include','map','model','stringify','catch','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','FreshdeskAccount','findAll'];(function(_0xdcf9c1,_0x1bc4a5){var _0x55a542=function(_0x9f5b6b){while(--_0x9f5b6b){_0xdcf9c1['push'](_0xdcf9c1['shift']());}};_0x55a542(++_0x1bc4a5);}(_0xf555,0xc1));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var moment=require(_0x5f55('0x2'));var BPromise=require(_0x5f55('0x3'));var rs=require(_0x5f55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f55('0x5'))['db'];var utils=require(_0x5f55('0x6'));var logger=require(_0x5f55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5f55('0x8'));var client=jayson[_0x5f55('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0466,_0x397102,_0x50ef6e){return new BPromise(function(_0x2f93a0,_0x4685dc){return client[_0x5f55('0xa')](_0x4b0466,_0x50ef6e)[_0x5f55('0xb')](function(_0x4fe6c7){logger[_0x5f55('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x397102,_0x5f55('0xd'));logger[_0x5f55('0xe')](_0x5f55('0xf'),_0x397102,'request\x20sent',JSON['stringify'](_0x4fe6c7));if(_0x4fe6c7[_0x5f55('0x10')]){if(_0x4fe6c7[_0x5f55('0x10')][_0x5f55('0x11')]===0x1f4){logger[_0x5f55('0x10')](_0x5f55('0x12'),_0x397102,_0x4fe6c7[_0x5f55('0x10')]['message']);return _0x4685dc(_0x4fe6c7[_0x5f55('0x10')]['message']);}logger['error'](_0x5f55('0x12'),_0x397102,_0x4fe6c7[_0x5f55('0x10')]['message']);return _0x2f93a0(_0x4fe6c7[_0x5f55('0x10')][_0x5f55('0x13')]);}else{logger[_0x5f55('0xc')](_0x5f55('0x12'),_0x397102,'request\x20sent');_0x2f93a0(_0x4fe6c7[_0x5f55('0x14')]['message']);}})['catch'](function(_0x306b57){logger[_0x5f55('0x10')](_0x5f55('0x12'),_0x397102,_0x306b57);_0x4685dc(_0x306b57);});});}exports['GetFreshdeskAccount']=function(_0x45363c){var _0x438a73=this;return new Promise(function(_0x528c7d,_0x3a9a64){return db[_0x5f55('0x15')][_0x5f55('0x16')]({'raw':_0x45363c['options']?_0x45363c['options'][_0x5f55('0x17')]===undefined?!![]:![]:!![],'where':_0x45363c[_0x5f55('0x18')]?_0x45363c[_0x5f55('0x18')][_0x5f55('0x19')]||null:null,'attributes':_0x45363c['options']?_0x45363c[_0x5f55('0x18')][_0x5f55('0x1a')]||null:null,'limit':_0x45363c[_0x5f55('0x18')]?_0x45363c['options'][_0x5f55('0x1b')]||null:null,'include':_0x45363c[_0x5f55('0x18')]?_0x45363c['options'][_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x45363c[_0x5f55('0x18')][_0x5f55('0x1c')],function(_0x2c3183){return{'model':db[_0x2c3183[_0x5f55('0x1e')]],'as':_0x2c3183['as'],'attributes':_0x2c3183[_0x5f55('0x1a')],'include':_0x2c3183[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x2c3183[_0x5f55('0x1c')],function(_0x479a3a){return{'model':db[_0x479a3a[_0x5f55('0x1e')]],'as':_0x479a3a['as'],'attributes':_0x479a3a[_0x5f55('0x1a')],'include':_0x479a3a[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x479a3a[_0x5f55('0x1c')],function(_0xdf7116){return{'model':db[_0xdf7116[_0x5f55('0x1e')]],'as':_0xdf7116['as'],'attributes':_0xdf7116[_0x5f55('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f55('0xb')](function(_0x5b9887){logger[_0x5f55('0xc')]('GetFreshdeskAccount',_0x45363c);logger[_0x5f55('0xe')]('GetFreshdeskAccount',_0x45363c,JSON[_0x5f55('0x1f')](_0x5b9887));_0x528c7d(_0x5b9887);})[_0x5f55('0x20')](function(_0x123294){logger['error'](_0x5f55('0x21'),_0x123294[_0x5f55('0x13')],_0x45363c);_0x3a9a64(_0x438a73['error'](0x1f4,_0x123294[_0x5f55('0x13')]));});});};exports[_0x5f55('0x22')]=function(_0x280817){var _0x21b566=this;return new Promise(function(_0x409ebe,_0x2c8d48){return db[_0x5f55('0x15')][_0x5f55('0x23')]({'raw':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x17')]===undefined?!![]:![]:!![],'where':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x19')]||null:null,'attributes':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x1a')]||null:null,'include':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x280817['options']['include'],function(_0x374019){return{'model':db[_0x374019[_0x5f55('0x1e')]],'as':_0x374019['as'],'attributes':_0x374019[_0x5f55('0x1a')],'include':_0x374019[_0x5f55('0x1c')]?_['map'](_0x374019[_0x5f55('0x1c')],function(_0x2d56bd){return{'model':db[_0x2d56bd[_0x5f55('0x1e')]],'as':_0x2d56bd['as'],'attributes':_0x2d56bd[_0x5f55('0x1a')],'include':_0x2d56bd[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x2d56bd[_0x5f55('0x1c')],function(_0x31eb39){return{'model':db[_0x31eb39[_0x5f55('0x1e')]],'as':_0x31eb39['as'],'attributes':_0x31eb39[_0x5f55('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f55('0xb')](function(_0x545c9f){logger[_0x5f55('0xc')](_0x5f55('0x22'),_0x280817);logger['debug'](_0x5f55('0x22'),_0x280817,JSON[_0x5f55('0x1f')](_0x545c9f));_0x409ebe(_0x545c9f);})[_0x5f55('0x20')](function(_0x32ff72){logger[_0x5f55('0x10')](_0x5f55('0x22'),_0x32ff72[_0x5f55('0x13')],_0x280817);_0x2c8d48(_0x21b566['error'](0x1f4,_0x32ff72[_0x5f55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 343f634..b27bd77 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 _0xd950=['post','create','setTags','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags'];(function(_0x4b1728,_0x23d216){var _0x9d91cc=function(_0x54c2b6){while(--_0x54c2b6){_0x4b1728['push'](_0x4b1728['shift']());}};_0x9d91cc(++_0x23d216);}(_0xd950,0x67));var _0x0d95=function(_0x3a1678,_0x59002e){_0x3a1678=_0x3a1678-0x0;var _0x263661=_0xd950[_0x3a1678];return _0x263661;};'use strict';var multer=require(_0x0d95('0x0'));var util=require(_0x0d95('0x1'));var path=require(_0x0d95('0x2'));var timeout=require(_0x0d95('0x3'));var express=require(_0x0d95('0x4'));var router=express[_0x0d95('0x5')]();var fs_extra=require(_0x0d95('0x6'));var auth=require(_0x0d95('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0d95('0x8'));var controller=require(_0x0d95('0x9'));router[_0x0d95('0xa')]('/',auth[_0x0d95('0xb')](),controller['index']);router[_0x0d95('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0d95('0xa')]('/:id/fields',auth[_0x0d95('0xb')](),controller[_0x0d95('0xc')]);router['get'](_0x0d95('0xd'),auth[_0x0d95('0xb')](),controller['getSubjects']);router['get'](_0x0d95('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0d95('0xa')](_0x0d95('0xf'),auth['isAuthenticated'](),controller[_0x0d95('0x10')]);router[_0x0d95('0x11')]('/',auth['isAuthenticated'](),controller[_0x0d95('0x12')]);router['post']('/:id/tags',auth[_0x0d95('0xb')](),controller[_0x0d95('0x13')]);router[_0x0d95('0x14')](_0x0d95('0x15'),auth[_0x0d95('0xb')](),controller[_0x0d95('0x16')]);router[_0x0d95('0x17')](_0x0d95('0x15'),auth[_0x0d95('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x34c408,_0x46bc05){var _0x5925cf=function(_0x191556){while(--_0x191556){_0x34c408['push'](_0x34c408['shift']());}};_0x5925cf(++_0x46bc05);}(_0x91f0,0x1f1));var _0x091f=function(_0x1b3f8a,_0x4adda9){_0x1b3f8a=_0x1b3f8a-0x0;var _0x499fa9=_0x91f0[_0x1b3f8a];return _0x499fa9;};'use strict';var multer=require(_0x091f('0x0'));var util=require(_0x091f('0x1'));var path=require(_0x091f('0x2'));var timeout=require(_0x091f('0x3'));var express=require(_0x091f('0x4'));var router=express[_0x091f('0x5')]();var fs_extra=require(_0x091f('0x6'));var auth=require(_0x091f('0x7'));var interaction=require(_0x091f('0x8'));var config=require(_0x091f('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x091f('0xa')]('/',auth[_0x091f('0xb')](),controller[_0x091f('0xc')]);router[_0x091f('0xa')](_0x091f('0xd'),auth[_0x091f('0xb')](),controller[_0x091f('0xe')]);router['get'](_0x091f('0xf'),auth[_0x091f('0xb')](),controller['getFields']);router['get'](_0x091f('0x10'),auth['isAuthenticated'](),controller[_0x091f('0x11')]);router[_0x091f('0xa')](_0x091f('0x12'),auth[_0x091f('0xb')](),controller[_0x091f('0x13')]);router[_0x091f('0xa')]('/:id/tags',auth[_0x091f('0xb')](),controller['getTags']);router[_0x091f('0x14')]('/',auth[_0x091f('0xb')](),controller[_0x091f('0x15')]);router[_0x091f('0x14')](_0x091f('0x16'),auth[_0x091f('0xb')](),controller[_0x091f('0x17')]);router[_0x091f('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x091f('0x19')]('/:id',auth[_0x091f('0xb')](),controller[_0x091f('0x1a')]);module[_0x091f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d4799a1..ca5f6d0 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 _0x213d=['STRING','sequelize','exports'];(function(_0x3a2562,_0x2acdef){var _0x59eb58=function(_0x1b5e69){while(--_0x1b5e69){_0x3a2562['push'](_0x3a2562['shift']());}};_0x59eb58(++_0x2acdef);}(_0x213d,0x178));var _0xd213=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x213d[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xd213('0x0'));module[_0xd213('0x1')]={'name':{'type':Sequelize[_0xd213('0x2')]},'description':{'type':Sequelize[_0xd213('0x2')]}}; \ No newline at end of file +var _0x778d=['exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x778d,0x198));var _0xd778=function(_0x25398a,_0x59be39){_0x25398a=_0x25398a-0x0;var _0x107e03=_0x778d[_0x25398a];return _0x107e03;};'use strict';var Sequelize=require('sequelize');module[_0xd778('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5915746..82f82c6 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 _0xf2ad=['sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','params','ids','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf2ad,0x72));var _0xdf2a=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0xf2ad[_0x364a36];return _0x5cd6fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf2a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdf2a('0x1'));var BPromise=require(_0xdf2a('0x2'));var Mustache=require(_0xdf2a('0x3'));var util=require('util');var path=require(_0xdf2a('0x4'));var sox=require(_0xdf2a('0x5'));var csv=require(_0xdf2a('0x6'));var ejs=require(_0xdf2a('0x7'));var fs=require('fs');var fs_extra=require(_0xdf2a('0x8'));var _=require(_0xdf2a('0x9'));var squel=require(_0xdf2a('0xa'));var crypto=require(_0xdf2a('0xb'));var jsforce=require(_0xdf2a('0xc'));var deskjs=require(_0xdf2a('0xd'));var toCsv=require(_0xdf2a('0x6'));var querystring=require('querystring');var Papa=require(_0xdf2a('0xe'));var Redis=require(_0xdf2a('0xf'));var authService=require(_0xdf2a('0x10'));var qs=require(_0xdf2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf2a('0x12'));var logger=require(_0xdf2a('0x13'))('api');var utils=require(_0xdf2a('0x14'));var config=require(_0xdf2a('0x15'));var licenseUtil=require(_0xdf2a('0x16'));var db=require(_0xdf2a('0x17'))['db'];function respondWithStatusCode(_0x159a74,_0x399c22){_0x399c22=_0x399c22||0xcc;return function(_0x53095b){if(_0x53095b){return _0x159a74[_0xdf2a('0x18')](_0x399c22);}return _0x159a74[_0xdf2a('0x19')](_0x399c22)[_0xdf2a('0x1a')]();};}function respondWithResult(_0x579b04,_0x19a20b){_0x19a20b=_0x19a20b||0xc8;return function(_0x4cc1a8){if(_0x4cc1a8){return _0x579b04['status'](_0x19a20b)[_0xdf2a('0x1b')](_0x4cc1a8);}};}function respondWithFilteredResult(_0x57e51d,_0x44f9de){return function(_0x37f3e9){if(_0x37f3e9){var _0x5966f6=typeof _0x44f9de[_0xdf2a('0x1c')]==='undefined'&&typeof _0x44f9de[_0xdf2a('0x1d')]===_0xdf2a('0x1e');var _0xa8f0b9=_0x37f3e9[_0xdf2a('0x1f')];var _0x5e591e=_0x5966f6?0x0:_0x44f9de[_0xdf2a('0x1c')];var _0x1a3782=_0x5966f6?_0x37f3e9[_0xdf2a('0x1f')]:_0x44f9de[_0xdf2a('0x1c')]+_0x44f9de[_0xdf2a('0x1d')];var _0x34307b;if(_0x1a3782>=_0xa8f0b9){_0x1a3782=_0xa8f0b9;_0x34307b=0xc8;}else{_0x34307b=0xce;}_0x57e51d[_0xdf2a('0x19')](_0x34307b);return _0x57e51d[_0xdf2a('0x20')](_0xdf2a('0x21'),_0x5e591e+'-'+_0x1a3782+'/'+_0xa8f0b9)[_0xdf2a('0x1b')](_0x37f3e9);}return null;};}function patchUpdates(_0x4c6ed4){return function(_0xfedbd9){try{jsonpatch['apply'](_0xfedbd9,_0x4c6ed4,!![]);}catch(_0x168ff1){return BPromise[_0xdf2a('0x22')](_0x168ff1);}return _0xfedbd9[_0xdf2a('0x23')]();};}function saveUpdates(_0x4468b0,_0x2f4534){return function(_0xfef05a){if(_0xfef05a){return _0xfef05a['update'](_0x4468b0)[_0xdf2a('0x24')](function(_0x640c4f){return _0x640c4f;});}return null;};}function removeEntity(_0x519835,_0x17b796){return function(_0x32dbff){if(_0x32dbff){return _0x32dbff[_0xdf2a('0x25')]()[_0xdf2a('0x24')](function(){_0x519835[_0xdf2a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14379d,_0x1f1d54){return function(_0x1f779c){if(!_0x1f779c){_0x14379d[_0xdf2a('0x18')](0x194);}return _0x1f779c;};}function handleError(_0x2bc0af,_0x1b6b15){_0x1b6b15=_0x1b6b15||0x1f4;return function(_0x4f321b){logger[_0xdf2a('0x26')](_0x4f321b[_0xdf2a('0x27')]);if(_0x4f321b['name']){delete _0x4f321b[_0xdf2a('0x28')];}_0x2bc0af[_0xdf2a('0x19')](_0x1b6b15)['send'](_0x4f321b);};}exports[_0xdf2a('0x29')]=function(_0x341251,_0x442a0e){var _0x19c783={},_0x2f781f={},_0x4ef560={'count':0x0,'rows':[]};var _0xe4e1ad=_[_0xdf2a('0x2a')](db[_0xdf2a('0x2b')][_0xdf2a('0x2c')],function(_0x26f3e9){return{'name':_0x26f3e9[_0xdf2a('0x2d')],'type':_0x26f3e9['type']['key']};});_0x2f781f[_0xdf2a('0x2e')]=_['map'](_0xe4e1ad,'name');_0x2f781f['query']=_[_0xdf2a('0x2f')](_0x341251[_0xdf2a('0x30')]);_0x2f781f[_0xdf2a('0x31')]=_[_0xdf2a('0x32')](_0x2f781f[_0xdf2a('0x2e')],_0x2f781f[_0xdf2a('0x30')]);_0x19c783[_0xdf2a('0x33')]=_['intersection'](_0x2f781f['model'],qs[_0xdf2a('0x34')](_0x341251[_0xdf2a('0x30')]['fields']));_0x19c783[_0xdf2a('0x33')]=_0x19c783[_0xdf2a('0x33')][_0xdf2a('0x35')]?_0x19c783[_0xdf2a('0x33')]:_0x2f781f['model'];if(!_0x341251[_0xdf2a('0x30')][_0xdf2a('0x36')]('nolimit')){_0x19c783[_0xdf2a('0x1d')]=qs[_0xdf2a('0x1d')](_0x341251[_0xdf2a('0x30')][_0xdf2a('0x1d')]);_0x19c783[_0xdf2a('0x1c')]=qs['offset'](_0x341251[_0xdf2a('0x30')]['offset']);}_0x19c783[_0xdf2a('0x37')]=qs[_0xdf2a('0x38')](_0x341251[_0xdf2a('0x30')]['sort']);_0x19c783[_0xdf2a('0x39')]=qs[_0xdf2a('0x31')](_[_0xdf2a('0x3a')](_0x341251[_0xdf2a('0x30')],_0x2f781f['filters']),_0xe4e1ad);if(_0x341251[_0xdf2a('0x30')][_0xdf2a('0x3b')]){_0x19c783[_0xdf2a('0x39')]=_[_0xdf2a('0x3c')](_0x19c783[_0xdf2a('0x39')],{'$or':_[_0xdf2a('0x2a')](_0xe4e1ad,function(_0x4ac9ab){if(_0x4ac9ab[_0xdf2a('0x3d')]!==_0xdf2a('0x3e')){var _0x5b32a2={};_0x5b32a2[_0x4ac9ab[_0xdf2a('0x28')]]={'$like':'%'+_0x341251['query'][_0xdf2a('0x3b')]+'%'};return _0x5b32a2;}})});}_0x19c783=_[_0xdf2a('0x3c')]({},_0x19c783,_0x341251['options']);var _0x277bdd={'where':_0x19c783[_0xdf2a('0x39')]};return db['FreshdeskConfiguration'][_0xdf2a('0x1f')](_0x277bdd)[_0xdf2a('0x24')](function(_0x939f77){_0x4ef560[_0xdf2a('0x1f')]=_0x939f77;if(_0x341251[_0xdf2a('0x30')][_0xdf2a('0x3f')]){_0x19c783[_0xdf2a('0x40')]=[{'all':!![]}];}return db[_0xdf2a('0x2b')][_0xdf2a('0x41')](_0x19c783);})['then'](function(_0x4cfd04){_0x4ef560[_0xdf2a('0x42')]=_0x4cfd04;return _0x4ef560;})[_0xdf2a('0x24')](respondWithFilteredResult(_0x442a0e,_0x19c783))[_0xdf2a('0x43')](handleError(_0x442a0e,null));};exports[_0xdf2a('0x44')]=function(_0x3be78e,_0x507565){var _0x4ce113={'raw':![],'where':{'id':_0x3be78e['params']['id']}},_0x4a9b1a={};_0x4a9b1a[_0xdf2a('0x2e')]=_[_0xdf2a('0x2f')](db[_0xdf2a('0x2b')][_0xdf2a('0x2c')]);_0x4a9b1a[_0xdf2a('0x30')]=_['keys'](_0x3be78e[_0xdf2a('0x30')]);_0x4a9b1a[_0xdf2a('0x31')]=_[_0xdf2a('0x32')](_0x4a9b1a[_0xdf2a('0x2e')],_0x4a9b1a[_0xdf2a('0x30')]);_0x4ce113[_0xdf2a('0x33')]=_[_0xdf2a('0x32')](_0x4a9b1a[_0xdf2a('0x2e')],qs[_0xdf2a('0x34')](_0x3be78e[_0xdf2a('0x30')][_0xdf2a('0x34')]));_0x4ce113['attributes']=_0x4ce113['attributes'][_0xdf2a('0x35')]?_0x4ce113[_0xdf2a('0x33')]:_0x4a9b1a[_0xdf2a('0x2e')];if(_0x3be78e[_0xdf2a('0x30')][_0xdf2a('0x3f')]){_0x4ce113['include']=[{'all':!![]}];}_0x4ce113=_[_0xdf2a('0x3c')]({},_0x4ce113,_0x3be78e[_0xdf2a('0x45')]);return db[_0xdf2a('0x2b')][_0xdf2a('0x46')](_0x4ce113)[_0xdf2a('0x24')](handleEntityNotFound(_0x507565,null))[_0xdf2a('0x24')](respondWithResult(_0x507565,null))['catch'](handleError(_0x507565,null));};exports[_0xdf2a('0x47')]=function(_0x17a364,_0x66bfcb){return db[_0xdf2a('0x2b')][_0xdf2a('0x47')](_0x17a364[_0xdf2a('0x48')],{})['then'](respondWithResult(_0x66bfcb,0xc9))[_0xdf2a('0x43')](handleError(_0x66bfcb,null));};exports[_0xdf2a('0x49')]=function(_0x167444,_0x210153){if(_0x167444[_0xdf2a('0x48')]['id']){delete _0x167444[_0xdf2a('0x48')]['id'];}return db['FreshdeskConfiguration'][_0xdf2a('0x46')]({'where':{'id':_0x167444['params']['id']}})[_0xdf2a('0x24')](handleEntityNotFound(_0x210153,null))[_0xdf2a('0x24')](saveUpdates(_0x167444['body'],null))[_0xdf2a('0x24')](respondWithResult(_0x210153,null))[_0xdf2a('0x43')](handleError(_0x210153,null));};exports[_0xdf2a('0x25')]=function(_0x18bab7,_0x13d7e3){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x18bab7['params']['id']}})['then'](handleEntityNotFound(_0x13d7e3,null))[_0xdf2a('0x24')](removeEntity(_0x13d7e3,null))[_0xdf2a('0x43')](handleError(_0x13d7e3,null));};exports[_0xdf2a('0x4a')]=function(_0x2c9646,_0x291fd4,_0x36c828){var _0x338e74={};var _0xed05c5={};var _0x37979d;var _0x31360a;return db['FreshdeskConfiguration'][_0xdf2a('0x4b')]({'where':{'id':_0x2c9646['params']['id']}})[_0xdf2a('0x24')](handleEntityNotFound(_0x291fd4,null))[_0xdf2a('0x24')](function(_0x5ac31d){if(_0x5ac31d){_0x37979d=_0x5ac31d;_0xed05c5[_0xdf2a('0x2e')]=_[_0xdf2a('0x2f')](db[_0xdf2a('0x4c')][_0xdf2a('0x2c')]);_0xed05c5[_0xdf2a('0x30')]=_['keys'](_0x2c9646[_0xdf2a('0x30')]);_0xed05c5[_0xdf2a('0x31')]=_[_0xdf2a('0x32')](_0xed05c5['model'],_0xed05c5[_0xdf2a('0x30')]);_0x338e74[_0xdf2a('0x33')]=_[_0xdf2a('0x32')](_0xed05c5['model'],qs[_0xdf2a('0x34')](_0x2c9646[_0xdf2a('0x30')][_0xdf2a('0x34')]));_0x338e74[_0xdf2a('0x33')]=_0x338e74[_0xdf2a('0x33')]['length']?_0x338e74[_0xdf2a('0x33')]:_0xed05c5[_0xdf2a('0x2e')];_0x338e74['order']=qs['sort'](_0x2c9646['query'][_0xdf2a('0x38')]);_0x338e74[_0xdf2a('0x39')]=qs[_0xdf2a('0x31')](_[_0xdf2a('0x3a')](_0x2c9646[_0xdf2a('0x30')],_0xed05c5['filters']));if(_0x2c9646[_0xdf2a('0x30')][_0xdf2a('0x3b')]){_0x338e74[_0xdf2a('0x39')]=_['merge'](_0x338e74[_0xdf2a('0x39')],{'$or':_[_0xdf2a('0x2a')](_0x338e74[_0xdf2a('0x33')],function(_0x1d6c10){var _0x56bb7a={};_0x56bb7a[_0x1d6c10]={'$like':'%'+_0x2c9646[_0xdf2a('0x30')][_0xdf2a('0x3b')]+'%'};return _0x56bb7a;})});}_0x338e74=_[_0xdf2a('0x3c')]({},_0x338e74,_0x2c9646[_0xdf2a('0x45')]);return _0x37979d[_0xdf2a('0x4a')](_0x338e74);}})[_0xdf2a('0x24')](function(_0xa5504c){if(_0xa5504c){_0x31360a=_0xa5504c['length'];if(!_0x2c9646[_0xdf2a('0x30')][_0xdf2a('0x36')](_0xdf2a('0x4d'))){_0x338e74['limit']=qs[_0xdf2a('0x1d')](_0x2c9646[_0xdf2a('0x30')][_0xdf2a('0x1d')]);_0x338e74[_0xdf2a('0x1c')]=qs['offset'](_0x2c9646[_0xdf2a('0x30')]['offset']);}return _0x37979d[_0xdf2a('0x4a')](_0x338e74);}})[_0xdf2a('0x24')](function(_0x370b65){if(_0x370b65){return _0x370b65?{'count':_0x31360a,'rows':_0x370b65}:null;}})[_0xdf2a('0x24')](respondWithResult(_0x291fd4,null))[_0xdf2a('0x43')](handleError(_0x291fd4,null));};exports[_0xdf2a('0x4e')]=function(_0x5e5733,_0x56d23e,_0x28223a){var _0x45adca={};var _0x2b0a00={};var _0x6e1c59;var _0x1c7b9b;return db[_0xdf2a('0x2b')][_0xdf2a('0x4b')]({'where':{'id':_0x5e5733['params']['id']}})['then'](handleEntityNotFound(_0x56d23e,null))[_0xdf2a('0x24')](function(_0x3c28b3){if(_0x3c28b3){_0x6e1c59=_0x3c28b3;_0x2b0a00[_0xdf2a('0x2e')]=_[_0xdf2a('0x2f')](db[_0xdf2a('0x4c')]['rawAttributes']);_0x2b0a00['query']=_[_0xdf2a('0x2f')](_0x5e5733[_0xdf2a('0x30')]);_0x2b0a00[_0xdf2a('0x31')]=_[_0xdf2a('0x32')](_0x2b0a00[_0xdf2a('0x2e')],_0x2b0a00[_0xdf2a('0x30')]);_0x45adca[_0xdf2a('0x33')]=_[_0xdf2a('0x32')](_0x2b0a00[_0xdf2a('0x2e')],qs[_0xdf2a('0x34')](_0x5e5733['query'][_0xdf2a('0x34')]));_0x45adca[_0xdf2a('0x33')]=_0x45adca[_0xdf2a('0x33')][_0xdf2a('0x35')]?_0x45adca[_0xdf2a('0x33')]:_0x2b0a00[_0xdf2a('0x2e')];_0x45adca['order']=qs['sort'](_0x5e5733[_0xdf2a('0x30')][_0xdf2a('0x38')]);_0x45adca[_0xdf2a('0x39')]=qs[_0xdf2a('0x31')](_[_0xdf2a('0x3a')](_0x5e5733[_0xdf2a('0x30')],_0x2b0a00[_0xdf2a('0x31')]));if(_0x5e5733[_0xdf2a('0x30')]['filter']){_0x45adca[_0xdf2a('0x39')]=_[_0xdf2a('0x3c')](_0x45adca[_0xdf2a('0x39')],{'$or':_['map'](_0x45adca[_0xdf2a('0x33')],function(_0x5171c2){var _0x394a91={};_0x394a91[_0x5171c2]={'$like':'%'+_0x5e5733[_0xdf2a('0x30')][_0xdf2a('0x3b')]+'%'};return _0x394a91;})});}_0x45adca=_[_0xdf2a('0x3c')]({},_0x45adca,_0x5e5733[_0xdf2a('0x45')]);return _0x6e1c59[_0xdf2a('0x4e')](_0x45adca);}})[_0xdf2a('0x24')](function(_0x58ca6d){if(_0x58ca6d){_0x1c7b9b=_0x58ca6d[_0xdf2a('0x35')];if(!_0x5e5733['query'][_0xdf2a('0x36')](_0xdf2a('0x4d'))){_0x45adca[_0xdf2a('0x1d')]=qs[_0xdf2a('0x1d')](_0x5e5733[_0xdf2a('0x30')][_0xdf2a('0x1d')]);_0x45adca[_0xdf2a('0x1c')]=qs[_0xdf2a('0x1c')](_0x5e5733[_0xdf2a('0x30')][_0xdf2a('0x1c')]);}return _0x6e1c59['getSubjects'](_0x45adca);}})[_0xdf2a('0x24')](function(_0x2188fa){if(_0x2188fa){return _0x2188fa?{'count':_0x1c7b9b,'rows':_0x2188fa}:null;}})[_0xdf2a('0x24')](respondWithResult(_0x56d23e,null))['catch'](handleError(_0x56d23e,null));};exports['getDescriptions']=function(_0x1a193c,_0x592bc8,_0x34b3a2){var _0x3f7597={};var _0x307acd={};var _0x314a55;var _0x5e24fa;return db[_0xdf2a('0x2b')][_0xdf2a('0x4b')]({'where':{'id':_0x1a193c['params']['id']}})[_0xdf2a('0x24')](handleEntityNotFound(_0x592bc8,null))[_0xdf2a('0x24')](function(_0x134335){if(_0x134335){_0x314a55=_0x134335;_0x307acd[_0xdf2a('0x2e')]=_[_0xdf2a('0x2f')](db['FreshdeskField']['rawAttributes']);_0x307acd['query']=_[_0xdf2a('0x2f')](_0x1a193c[_0xdf2a('0x30')]);_0x307acd[_0xdf2a('0x31')]=_[_0xdf2a('0x32')](_0x307acd[_0xdf2a('0x2e')],_0x307acd['query']);_0x3f7597[_0xdf2a('0x33')]=_['intersection'](_0x307acd[_0xdf2a('0x2e')],qs[_0xdf2a('0x34')](_0x1a193c[_0xdf2a('0x30')][_0xdf2a('0x34')]));_0x3f7597['attributes']=_0x3f7597['attributes']['length']?_0x3f7597[_0xdf2a('0x33')]:_0x307acd['model'];_0x3f7597[_0xdf2a('0x37')]=qs[_0xdf2a('0x38')](_0x1a193c[_0xdf2a('0x30')][_0xdf2a('0x38')]);_0x3f7597['where']=qs[_0xdf2a('0x31')](_[_0xdf2a('0x3a')](_0x1a193c[_0xdf2a('0x30')],_0x307acd[_0xdf2a('0x31')]));if(_0x1a193c[_0xdf2a('0x30')]['filter']){_0x3f7597[_0xdf2a('0x39')]=_[_0xdf2a('0x3c')](_0x3f7597[_0xdf2a('0x39')],{'$or':_[_0xdf2a('0x2a')](_0x3f7597[_0xdf2a('0x33')],function(_0x5091f8){var _0x3b1c94={};_0x3b1c94[_0x5091f8]={'$like':'%'+_0x1a193c[_0xdf2a('0x30')][_0xdf2a('0x3b')]+'%'};return _0x3b1c94;})});}_0x3f7597=_[_0xdf2a('0x3c')]({},_0x3f7597,_0x1a193c['options']);return _0x314a55[_0xdf2a('0x4f')](_0x3f7597);}})[_0xdf2a('0x24')](function(_0x2f4a8f){if(_0x2f4a8f){_0x5e24fa=_0x2f4a8f[_0xdf2a('0x35')];if(!_0x1a193c[_0xdf2a('0x30')][_0xdf2a('0x36')]('nolimit')){_0x3f7597[_0xdf2a('0x1d')]=qs['limit'](_0x1a193c[_0xdf2a('0x30')]['limit']);_0x3f7597[_0xdf2a('0x1c')]=qs[_0xdf2a('0x1c')](_0x1a193c[_0xdf2a('0x30')][_0xdf2a('0x1c')]);}return _0x314a55[_0xdf2a('0x4f')](_0x3f7597);}})['then'](function(_0x29bcda){if(_0x29bcda){return _0x29bcda?{'count':_0x5e24fa,'rows':_0x29bcda}:null;}})['then'](respondWithResult(_0x592bc8,null))[_0xdf2a('0x43')](handleError(_0x592bc8,null));};exports[_0xdf2a('0x50')]=function(_0x8ee181,_0x2ea3e3,_0x217dfc){var _0x5786b4={};var _0x3e1d9a={};var _0x249f3d;var _0x81a8ad;return db['FreshdeskConfiguration'][_0xdf2a('0x4b')]({'where':{'id':_0x8ee181['params']['id']}})[_0xdf2a('0x24')](handleEntityNotFound(_0x2ea3e3,null))[_0xdf2a('0x24')](function(_0x987da){if(_0x987da){_0x249f3d=_0x987da;_0x3e1d9a[_0xdf2a('0x2e')]=_[_0xdf2a('0x2f')](db[_0xdf2a('0x51')][_0xdf2a('0x2c')]);_0x3e1d9a[_0xdf2a('0x30')]=_[_0xdf2a('0x2f')](_0x8ee181[_0xdf2a('0x30')]);_0x3e1d9a['filters']=_['intersection'](_0x3e1d9a['model'],_0x3e1d9a[_0xdf2a('0x30')]);_0x5786b4[_0xdf2a('0x33')]=_[_0xdf2a('0x32')](_0x3e1d9a['model'],qs[_0xdf2a('0x34')](_0x8ee181[_0xdf2a('0x30')][_0xdf2a('0x34')]));_0x5786b4[_0xdf2a('0x33')]=_0x5786b4['attributes'][_0xdf2a('0x35')]?_0x5786b4[_0xdf2a('0x33')]:_0x3e1d9a['model'];_0x5786b4['order']=qs[_0xdf2a('0x38')](_0x8ee181[_0xdf2a('0x30')]['sort']);_0x5786b4[_0xdf2a('0x39')]=qs[_0xdf2a('0x31')](_['pick'](_0x8ee181['query'],_0x3e1d9a[_0xdf2a('0x31')]));if(_0x8ee181[_0xdf2a('0x30')]['filter']){_0x5786b4[_0xdf2a('0x39')]=_[_0xdf2a('0x3c')](_0x5786b4[_0xdf2a('0x39')],{'$or':_['map'](_0x5786b4[_0xdf2a('0x33')],function(_0x58f3ec){var _0xebff3e={};_0xebff3e[_0x58f3ec]={'$like':'%'+_0x8ee181[_0xdf2a('0x30')][_0xdf2a('0x3b')]+'%'};return _0xebff3e;})});}_0x5786b4=_[_0xdf2a('0x3c')]({},_0x5786b4,_0x8ee181[_0xdf2a('0x45')]);return _0x249f3d[_0xdf2a('0x50')](_0x5786b4);}})['then'](function(_0x3c00c9){if(_0x3c00c9){_0x81a8ad=_0x3c00c9[_0xdf2a('0x35')];if(!_0x8ee181['query'][_0xdf2a('0x36')]('nolimit')){_0x5786b4['limit']=qs[_0xdf2a('0x1d')](_0x8ee181[_0xdf2a('0x30')]['limit']);_0x5786b4['offset']=qs[_0xdf2a('0x1c')](_0x8ee181[_0xdf2a('0x30')][_0xdf2a('0x1c')]);}return _0x249f3d[_0xdf2a('0x50')](_0x5786b4);}})['then'](function(_0x498efa){if(_0x498efa){return _0x498efa?{'count':_0x81a8ad,'rows':_0x498efa}:null;}})['then'](respondWithResult(_0x2ea3e3,null))[_0xdf2a('0x43')](handleError(_0x2ea3e3,null));};exports[_0xdf2a('0x52')]=function(_0x481874,_0x926d67,_0x45edf5){if(_0x481874[_0xdf2a('0x48')]['id']){delete _0x481874[_0xdf2a('0x48')]['id'];}return db[_0xdf2a('0x2b')][_0xdf2a('0x4b')]({'where':{'id':_0x481874[_0xdf2a('0x53')]['id']}})[_0xdf2a('0x24')](handleEntityNotFound(_0x926d67,null))[_0xdf2a('0x24')](function(_0x114e02){if(_0x114e02){return _0x114e02[_0xdf2a('0x52')](_0x481874[_0xdf2a('0x48')][_0xdf2a('0x54')]||[]);}return null;})[_0xdf2a('0x24')](respondWithResult(_0x926d67,null))['catch'](handleError(_0x926d67,null));}; \ No newline at end of file +var _0x203e=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','include','rows','catch','params','merge','options','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x203e,0xc5));var _0xe203=function(_0x50028b,_0x194567){_0x50028b=_0x50028b-0x0;var _0x1f60b5=_0x203e[_0x50028b];return _0x1f60b5;};'use strict';var emlformat=require(_0xe203('0x0'));var rimraf=require(_0xe203('0x1'));var zipdir=require(_0xe203('0x2'));var jsonpatch=require(_0xe203('0x3'));var rp=require(_0xe203('0x4'));var moment=require(_0xe203('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe203('0x6'));var util=require(_0xe203('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe203('0x8'));var ejs=require(_0xe203('0x9'));var fs=require('fs');var fs_extra=require(_0xe203('0xa'));var _=require('lodash');var squel=require(_0xe203('0xb'));var crypto=require(_0xe203('0xc'));var jsforce=require(_0xe203('0xd'));var deskjs=require(_0xe203('0xe'));var toCsv=require(_0xe203('0x8'));var querystring=require(_0xe203('0xf'));var Papa=require(_0xe203('0x10'));var Redis=require(_0xe203('0x11'));var authService=require(_0xe203('0x12'));var qs=require(_0xe203('0x13'));var as=require(_0xe203('0x14'));var hardwareService=require(_0xe203('0x15'));var logger=require(_0xe203('0x16'))(_0xe203('0x17'));var utils=require(_0xe203('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe203('0x19'));var db=require(_0xe203('0x1a'))['db'];function respondWithStatusCode(_0x2209cc,_0x2ad954){_0x2ad954=_0x2ad954||0xcc;return function(_0x23be1f){if(_0x23be1f){return _0x2209cc['sendStatus'](_0x2ad954);}return _0x2209cc[_0xe203('0x1b')](_0x2ad954)[_0xe203('0x1c')]();};}function respondWithResult(_0x27477a,_0x35230e){_0x35230e=_0x35230e||0xc8;return function(_0x4759ba){if(_0x4759ba){return _0x27477a[_0xe203('0x1b')](_0x35230e)[_0xe203('0x1d')](_0x4759ba);}};}function respondWithFilteredResult(_0x5e6400,_0xc218f7){return function(_0x2c7fec){if(_0x2c7fec){var _0x5dedc1=typeof _0xc218f7[_0xe203('0x1e')]===_0xe203('0x1f')&&typeof _0xc218f7[_0xe203('0x20')]===_0xe203('0x1f');var _0x28a204=_0x2c7fec[_0xe203('0x21')];var _0x38d741=_0x5dedc1?0x0:_0xc218f7[_0xe203('0x1e')];var _0x391b7c=_0x5dedc1?_0x2c7fec['count']:_0xc218f7[_0xe203('0x1e')]+_0xc218f7[_0xe203('0x20')];var _0x4290ad;if(_0x391b7c>=_0x28a204){_0x391b7c=_0x28a204;_0x4290ad=0xc8;}else{_0x4290ad=0xce;}_0x5e6400[_0xe203('0x1b')](_0x4290ad);return _0x5e6400[_0xe203('0x22')]('Content-Range',_0x38d741+'-'+_0x391b7c+'/'+_0x28a204)[_0xe203('0x1d')](_0x2c7fec);}return null;};}function patchUpdates(_0x6df3eb){return function(_0x54e623){try{jsonpatch['apply'](_0x54e623,_0x6df3eb,!![]);}catch(_0x5ad913){return BPromise[_0xe203('0x23')](_0x5ad913);}return _0x54e623['save']();};}function saveUpdates(_0x12b0c5,_0x502bb2){return function(_0x57be1b){if(_0x57be1b){return _0x57be1b[_0xe203('0x24')](_0x12b0c5)[_0xe203('0x25')](function(_0x4b264b){return _0x4b264b;});}return null;};}function removeEntity(_0x4393a4,_0x57f42f){return function(_0xd9cf82){if(_0xd9cf82){return _0xd9cf82[_0xe203('0x26')]()[_0xe203('0x25')](function(){_0x4393a4[_0xe203('0x1b')](0xcc)[_0xe203('0x1c')]();});}};}function handleEntityNotFound(_0x5ee179,_0x28f3dc){return function(_0x3aced5){if(!_0x3aced5){_0x5ee179[_0xe203('0x27')](0x194);}return _0x3aced5;};}function handleError(_0x582c5d,_0x333e30){_0x333e30=_0x333e30||0x1f4;return function(_0x11f1e2){logger[_0xe203('0x28')](_0x11f1e2[_0xe203('0x29')]);if(_0x11f1e2[_0xe203('0x2a')]){delete _0x11f1e2['name'];}_0x582c5d['status'](_0x333e30)[_0xe203('0x2b')](_0x11f1e2);};}exports[_0xe203('0x2c')]=function(_0x814053,_0x95b927){var _0x55097f={},_0x34f77f={},_0xa569c9={'count':0x0,'rows':[]};var _0x2b2945=_[_0xe203('0x2d')](db[_0xe203('0x2e')][_0xe203('0x2f')],function(_0x2574f9){return{'name':_0x2574f9['fieldName'],'type':_0x2574f9['type'][_0xe203('0x30')]};});_0x34f77f[_0xe203('0x31')]=_[_0xe203('0x2d')](_0x2b2945,_0xe203('0x2a'));_0x34f77f[_0xe203('0x32')]=_[_0xe203('0x33')](_0x814053[_0xe203('0x32')]);_0x34f77f['filters']=_[_0xe203('0x34')](_0x34f77f['model'],_0x34f77f[_0xe203('0x32')]);_0x55097f[_0xe203('0x35')]=_[_0xe203('0x34')](_0x34f77f[_0xe203('0x31')],qs[_0xe203('0x36')](_0x814053[_0xe203('0x32')][_0xe203('0x36')]));_0x55097f[_0xe203('0x35')]=_0x55097f[_0xe203('0x35')][_0xe203('0x37')]?_0x55097f[_0xe203('0x35')]:_0x34f77f['model'];if(!_0x814053[_0xe203('0x32')][_0xe203('0x38')](_0xe203('0x39'))){_0x55097f[_0xe203('0x20')]=qs[_0xe203('0x20')](_0x814053[_0xe203('0x32')]['limit']);_0x55097f['offset']=qs[_0xe203('0x1e')](_0x814053[_0xe203('0x32')]['offset']);}_0x55097f[_0xe203('0x3a')]=qs['sort'](_0x814053[_0xe203('0x32')][_0xe203('0x3b')]);_0x55097f['where']=qs[_0xe203('0x3c')](_[_0xe203('0x3d')](_0x814053[_0xe203('0x32')],_0x34f77f[_0xe203('0x3c')]),_0x2b2945);if(_0x814053[_0xe203('0x32')][_0xe203('0x3e')]){_0x55097f[_0xe203('0x3f')]=_['merge'](_0x55097f[_0xe203('0x3f')],{'$or':_[_0xe203('0x2d')](_0x2b2945,function(_0x112640){if(_0x112640['type']!==_0xe203('0x40')){var _0x2b56eb={};_0x2b56eb[_0x112640[_0xe203('0x2a')]]={'$like':'%'+_0x814053[_0xe203('0x32')]['filter']+'%'};return _0x2b56eb;}})});}_0x55097f=_['merge']({},_0x55097f,_0x814053['options']);var _0x24abe6={'where':_0x55097f['where']};return db[_0xe203('0x2e')]['count'](_0x24abe6)[_0xe203('0x25')](function(_0x634e92){_0xa569c9[_0xe203('0x21')]=_0x634e92;if(_0x814053['query'][_0xe203('0x41')]){_0x55097f[_0xe203('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x55097f);})[_0xe203('0x25')](function(_0x28abb8){_0xa569c9[_0xe203('0x43')]=_0x28abb8;return _0xa569c9;})[_0xe203('0x25')](respondWithFilteredResult(_0x95b927,_0x55097f))[_0xe203('0x44')](handleError(_0x95b927,null));};exports['show']=function(_0x4f750d,_0x3a20ec){var _0x55b65a={'raw':![],'where':{'id':_0x4f750d[_0xe203('0x45')]['id']}},_0x2788d7={};_0x2788d7[_0xe203('0x31')]=_[_0xe203('0x33')](db[_0xe203('0x2e')][_0xe203('0x2f')]);_0x2788d7[_0xe203('0x32')]=_[_0xe203('0x33')](_0x4f750d[_0xe203('0x32')]);_0x2788d7[_0xe203('0x3c')]=_['intersection'](_0x2788d7[_0xe203('0x31')],_0x2788d7[_0xe203('0x32')]);_0x55b65a[_0xe203('0x35')]=_[_0xe203('0x34')](_0x2788d7['model'],qs[_0xe203('0x36')](_0x4f750d[_0xe203('0x32')][_0xe203('0x36')]));_0x55b65a['attributes']=_0x55b65a['attributes'][_0xe203('0x37')]?_0x55b65a[_0xe203('0x35')]:_0x2788d7[_0xe203('0x31')];if(_0x4f750d[_0xe203('0x32')]['includeAll']){_0x55b65a[_0xe203('0x42')]=[{'all':!![]}];}_0x55b65a=_[_0xe203('0x46')]({},_0x55b65a,_0x4f750d[_0xe203('0x47')]);return db[_0xe203('0x2e')]['find'](_0x55b65a)['then'](handleEntityNotFound(_0x3a20ec,null))[_0xe203('0x25')](respondWithResult(_0x3a20ec,null))['catch'](handleError(_0x3a20ec,null));};exports[_0xe203('0x48')]=function(_0x5bb93e,_0x3b00c5){return db[_0xe203('0x2e')]['create'](_0x5bb93e[_0xe203('0x49')],{})[_0xe203('0x25')](respondWithResult(_0x3b00c5,0xc9))[_0xe203('0x44')](handleError(_0x3b00c5,null));};exports[_0xe203('0x24')]=function(_0x4dd967,_0x170a04){if(_0x4dd967[_0xe203('0x49')]['id']){delete _0x4dd967['body']['id'];}return db[_0xe203('0x2e')][_0xe203('0x4a')]({'where':{'id':_0x4dd967[_0xe203('0x45')]['id']}})[_0xe203('0x25')](handleEntityNotFound(_0x170a04,null))['then'](saveUpdates(_0x4dd967[_0xe203('0x49')],null))[_0xe203('0x25')](respondWithResult(_0x170a04,null))[_0xe203('0x44')](handleError(_0x170a04,null));};exports[_0xe203('0x26')]=function(_0x590c84,_0x1e21af){return db[_0xe203('0x2e')][_0xe203('0x4a')]({'where':{'id':_0x590c84[_0xe203('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e21af,null))[_0xe203('0x25')](removeEntity(_0x1e21af,null))['catch'](handleError(_0x1e21af,null));};exports[_0xe203('0x4b')]=function(_0x48255a,_0x1dcfc1,_0x573fa9){var _0x476755={};var _0x51a68a={};var _0x589695;var _0xd93aa6;return db[_0xe203('0x2e')][_0xe203('0x4c')]({'where':{'id':_0x48255a[_0xe203('0x45')]['id']}})['then'](handleEntityNotFound(_0x1dcfc1,null))['then'](function(_0x34c5db){if(_0x34c5db){_0x589695=_0x34c5db;_0x51a68a[_0xe203('0x31')]=_['keys'](db[_0xe203('0x4d')][_0xe203('0x2f')]);_0x51a68a[_0xe203('0x32')]=_['keys'](_0x48255a[_0xe203('0x32')]);_0x51a68a[_0xe203('0x3c')]=_[_0xe203('0x34')](_0x51a68a[_0xe203('0x31')],_0x51a68a['query']);_0x476755['attributes']=_['intersection'](_0x51a68a[_0xe203('0x31')],qs[_0xe203('0x36')](_0x48255a[_0xe203('0x32')][_0xe203('0x36')]));_0x476755[_0xe203('0x35')]=_0x476755['attributes'][_0xe203('0x37')]?_0x476755[_0xe203('0x35')]:_0x51a68a[_0xe203('0x31')];_0x476755[_0xe203('0x3a')]=qs[_0xe203('0x3b')](_0x48255a['query'][_0xe203('0x3b')]);_0x476755[_0xe203('0x3f')]=qs['filters'](_[_0xe203('0x3d')](_0x48255a[_0xe203('0x32')],_0x51a68a[_0xe203('0x3c')]));if(_0x48255a['query'][_0xe203('0x3e')]){_0x476755[_0xe203('0x3f')]=_[_0xe203('0x46')](_0x476755[_0xe203('0x3f')],{'$or':_['map'](_0x476755[_0xe203('0x35')],function(_0x486ee4){var _0x3855c6={};_0x3855c6[_0x486ee4]={'$like':'%'+_0x48255a[_0xe203('0x32')][_0xe203('0x3e')]+'%'};return _0x3855c6;})});}_0x476755=_['merge']({},_0x476755,_0x48255a['options']);return _0x589695[_0xe203('0x4b')](_0x476755);}})[_0xe203('0x25')](function(_0x17456c){if(_0x17456c){_0xd93aa6=_0x17456c['length'];if(!_0x48255a[_0xe203('0x32')][_0xe203('0x38')](_0xe203('0x39'))){_0x476755[_0xe203('0x20')]=qs[_0xe203('0x20')](_0x48255a[_0xe203('0x32')]['limit']);_0x476755[_0xe203('0x1e')]=qs[_0xe203('0x1e')](_0x48255a['query'][_0xe203('0x1e')]);}return _0x589695[_0xe203('0x4b')](_0x476755);}})[_0xe203('0x25')](function(_0x464569){if(_0x464569){return _0x464569?{'count':_0xd93aa6,'rows':_0x464569}:null;}})['then'](respondWithResult(_0x1dcfc1,null))[_0xe203('0x44')](handleError(_0x1dcfc1,null));};exports[_0xe203('0x4e')]=function(_0x240a4e,_0x4fcec9,_0xdc0ae3){var _0x308e52={};var _0x12acf5={};var _0x58082c;var _0x281d98;return db[_0xe203('0x2e')][_0xe203('0x4c')]({'where':{'id':_0x240a4e['params']['id']}})['then'](handleEntityNotFound(_0x4fcec9,null))[_0xe203('0x25')](function(_0xb636fa){if(_0xb636fa){_0x58082c=_0xb636fa;_0x12acf5[_0xe203('0x31')]=_[_0xe203('0x33')](db[_0xe203('0x4d')][_0xe203('0x2f')]);_0x12acf5['query']=_[_0xe203('0x33')](_0x240a4e[_0xe203('0x32')]);_0x12acf5[_0xe203('0x3c')]=_[_0xe203('0x34')](_0x12acf5[_0xe203('0x31')],_0x12acf5['query']);_0x308e52[_0xe203('0x35')]=_[_0xe203('0x34')](_0x12acf5[_0xe203('0x31')],qs[_0xe203('0x36')](_0x240a4e[_0xe203('0x32')]['fields']));_0x308e52['attributes']=_0x308e52['attributes']['length']?_0x308e52['attributes']:_0x12acf5['model'];_0x308e52[_0xe203('0x3a')]=qs['sort'](_0x240a4e[_0xe203('0x32')][_0xe203('0x3b')]);_0x308e52[_0xe203('0x3f')]=qs[_0xe203('0x3c')](_[_0xe203('0x3d')](_0x240a4e['query'],_0x12acf5[_0xe203('0x3c')]));if(_0x240a4e['query']['filter']){_0x308e52['where']=_['merge'](_0x308e52[_0xe203('0x3f')],{'$or':_[_0xe203('0x2d')](_0x308e52['attributes'],function(_0x2c58d7){var _0x128f91={};_0x128f91[_0x2c58d7]={'$like':'%'+_0x240a4e[_0xe203('0x32')]['filter']+'%'};return _0x128f91;})});}_0x308e52=_[_0xe203('0x46')]({},_0x308e52,_0x240a4e[_0xe203('0x47')]);return _0x58082c[_0xe203('0x4e')](_0x308e52);}})[_0xe203('0x25')](function(_0x1dea5b){if(_0x1dea5b){_0x281d98=_0x1dea5b[_0xe203('0x37')];if(!_0x240a4e['query'][_0xe203('0x38')]('nolimit')){_0x308e52[_0xe203('0x20')]=qs[_0xe203('0x20')](_0x240a4e[_0xe203('0x32')][_0xe203('0x20')]);_0x308e52['offset']=qs[_0xe203('0x1e')](_0x240a4e[_0xe203('0x32')][_0xe203('0x1e')]);}return _0x58082c[_0xe203('0x4e')](_0x308e52);}})[_0xe203('0x25')](function(_0x55eb99){if(_0x55eb99){return _0x55eb99?{'count':_0x281d98,'rows':_0x55eb99}:null;}})[_0xe203('0x25')](respondWithResult(_0x4fcec9,null))[_0xe203('0x44')](handleError(_0x4fcec9,null));};exports[_0xe203('0x4f')]=function(_0x352509,_0x34082b,_0x3b9bf8){var _0x41f9bb={};var _0x3d0346={};var _0x194a13;var _0x5f1614;return db[_0xe203('0x2e')][_0xe203('0x4c')]({'where':{'id':_0x352509[_0xe203('0x45')]['id']}})[_0xe203('0x25')](handleEntityNotFound(_0x34082b,null))[_0xe203('0x25')](function(_0x5ef6b1){if(_0x5ef6b1){_0x194a13=_0x5ef6b1;_0x3d0346[_0xe203('0x31')]=_[_0xe203('0x33')](db[_0xe203('0x4d')][_0xe203('0x2f')]);_0x3d0346[_0xe203('0x32')]=_[_0xe203('0x33')](_0x352509[_0xe203('0x32')]);_0x3d0346[_0xe203('0x3c')]=_[_0xe203('0x34')](_0x3d0346[_0xe203('0x31')],_0x3d0346[_0xe203('0x32')]);_0x41f9bb[_0xe203('0x35')]=_['intersection'](_0x3d0346['model'],qs[_0xe203('0x36')](_0x352509[_0xe203('0x32')][_0xe203('0x36')]));_0x41f9bb['attributes']=_0x41f9bb[_0xe203('0x35')]['length']?_0x41f9bb[_0xe203('0x35')]:_0x3d0346[_0xe203('0x31')];_0x41f9bb[_0xe203('0x3a')]=qs['sort'](_0x352509['query'][_0xe203('0x3b')]);_0x41f9bb[_0xe203('0x3f')]=qs['filters'](_[_0xe203('0x3d')](_0x352509['query'],_0x3d0346[_0xe203('0x3c')]));if(_0x352509[_0xe203('0x32')][_0xe203('0x3e')]){_0x41f9bb[_0xe203('0x3f')]=_[_0xe203('0x46')](_0x41f9bb['where'],{'$or':_['map'](_0x41f9bb[_0xe203('0x35')],function(_0x383c0c){var _0x415423={};_0x415423[_0x383c0c]={'$like':'%'+_0x352509[_0xe203('0x32')][_0xe203('0x3e')]+'%'};return _0x415423;})});}_0x41f9bb=_[_0xe203('0x46')]({},_0x41f9bb,_0x352509[_0xe203('0x47')]);return _0x194a13[_0xe203('0x4f')](_0x41f9bb);}})[_0xe203('0x25')](function(_0x598055){if(_0x598055){_0x5f1614=_0x598055[_0xe203('0x37')];if(!_0x352509['query'][_0xe203('0x38')](_0xe203('0x39'))){_0x41f9bb[_0xe203('0x20')]=qs[_0xe203('0x20')](_0x352509['query']['limit']);_0x41f9bb[_0xe203('0x1e')]=qs[_0xe203('0x1e')](_0x352509[_0xe203('0x32')][_0xe203('0x1e')]);}return _0x194a13[_0xe203('0x4f')](_0x41f9bb);}})[_0xe203('0x25')](function(_0x5bf32a){if(_0x5bf32a){return _0x5bf32a?{'count':_0x5f1614,'rows':_0x5bf32a}:null;}})['then'](respondWithResult(_0x34082b,null))[_0xe203('0x44')](handleError(_0x34082b,null));};exports['getTags']=function(_0x3b3aaf,_0x34e26e,_0x43b4c4){var _0x2859ae={};var _0x294732={};var _0x3b69db;var _0x2a67e8;return db[_0xe203('0x2e')][_0xe203('0x4c')]({'where':{'id':_0x3b3aaf[_0xe203('0x45')]['id']}})[_0xe203('0x25')](handleEntityNotFound(_0x34e26e,null))['then'](function(_0x252550){if(_0x252550){_0x3b69db=_0x252550;_0x294732[_0xe203('0x31')]=_[_0xe203('0x33')](db['Tag'][_0xe203('0x2f')]);_0x294732['query']=_[_0xe203('0x33')](_0x3b3aaf['query']);_0x294732['filters']=_['intersection'](_0x294732[_0xe203('0x31')],_0x294732['query']);_0x2859ae[_0xe203('0x35')]=_[_0xe203('0x34')](_0x294732[_0xe203('0x31')],qs[_0xe203('0x36')](_0x3b3aaf[_0xe203('0x32')][_0xe203('0x36')]));_0x2859ae[_0xe203('0x35')]=_0x2859ae[_0xe203('0x35')][_0xe203('0x37')]?_0x2859ae[_0xe203('0x35')]:_0x294732[_0xe203('0x31')];_0x2859ae[_0xe203('0x3a')]=qs['sort'](_0x3b3aaf['query'][_0xe203('0x3b')]);_0x2859ae[_0xe203('0x3f')]=qs[_0xe203('0x3c')](_['pick'](_0x3b3aaf[_0xe203('0x32')],_0x294732[_0xe203('0x3c')]));if(_0x3b3aaf[_0xe203('0x32')][_0xe203('0x3e')]){_0x2859ae[_0xe203('0x3f')]=_[_0xe203('0x46')](_0x2859ae['where'],{'$or':_['map'](_0x2859ae[_0xe203('0x35')],function(_0x979eae){var _0x484e24={};_0x484e24[_0x979eae]={'$like':'%'+_0x3b3aaf[_0xe203('0x32')][_0xe203('0x3e')]+'%'};return _0x484e24;})});}_0x2859ae=_['merge']({},_0x2859ae,_0x3b3aaf[_0xe203('0x47')]);return _0x3b69db[_0xe203('0x50')](_0x2859ae);}})['then'](function(_0x552f59){if(_0x552f59){_0x2a67e8=_0x552f59[_0xe203('0x37')];if(!_0x3b3aaf[_0xe203('0x32')][_0xe203('0x38')](_0xe203('0x39'))){_0x2859ae[_0xe203('0x20')]=qs[_0xe203('0x20')](_0x3b3aaf['query']['limit']);_0x2859ae[_0xe203('0x1e')]=qs[_0xe203('0x1e')](_0x3b3aaf[_0xe203('0x32')][_0xe203('0x1e')]);}return _0x3b69db[_0xe203('0x50')](_0x2859ae);}})[_0xe203('0x25')](function(_0x3ecbdd){if(_0x3ecbdd){return _0x3ecbdd?{'count':_0x2a67e8,'rows':_0x3ecbdd}:null;}})[_0xe203('0x25')](respondWithResult(_0x34e26e,null))[_0xe203('0x44')](handleError(_0x34e26e,null));};exports[_0xe203('0x51')]=function(_0x42539c,_0x2cd1fc,_0x300651){if(_0x42539c[_0xe203('0x49')]['id']){delete _0x42539c[_0xe203('0x49')]['id'];}return db['FreshdeskConfiguration'][_0xe203('0x4c')]({'where':{'id':_0x42539c[_0xe203('0x45')]['id']}})[_0xe203('0x25')](handleEntityNotFound(_0x2cd1fc,null))[_0xe203('0x25')](function(_0x1e114d){if(_0x1e114d){return _0x1e114d[_0xe203('0x51')](_0x42539c[_0xe203('0x49')][_0xe203('0x52')]||[]);}return null;})[_0xe203('0x25')](respondWithResult(_0x2cd1fc,null))[_0xe203('0x44')](handleError(_0x2cd1fc,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f287b1e..77c1f5d 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 _0xda80=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x5bba0a,_0x4f87c4){var _0x5d84ce=function(_0x7aa985){while(--_0x7aa985){_0x5bba0a['push'](_0x5bba0a['shift']());}};_0x5d84ce(++_0x4f87c4);}(_0xda80,0xaf));var _0x0da8=function(_0x9a3de1,_0x48216a){_0x9a3de1=_0x9a3de1-0x0;var _0x3aa708=_0xda80[_0x9a3de1];return _0x3aa708;};'use strict';var _=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var logger=require(_0x0da8('0x2'))(_0x0da8('0x3'));var moment=require('moment');var BPromise=require(_0x0da8('0x4'));var rp=require(_0x0da8('0x5'));var fs=require('fs');var path=require(_0x0da8('0x6'));var rimraf=require('rimraf');var config=require(_0x0da8('0x7'));var attributes=require(_0x0da8('0x8'));module[_0x0da8('0x9')]=function(_0x4e5d8a,_0x557a66){return _0x4e5d8a['define'](_0x0da8('0xa'),attributes,{'tableName':_0x0da8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0604=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x0604,0xa0));var _0x4060=function(_0x2e5ef7,_0x5240b0){_0x2e5ef7=_0x2e5ef7-0x0;var _0x76bbf7=_0x0604[_0x2e5ef7];return _0x76bbf7;};'use strict';var _=require(_0x4060('0x0'));var util=require('util');var logger=require(_0x4060('0x1'))(_0x4060('0x2'));var moment=require('moment');var BPromise=require(_0x4060('0x3'));var rp=require(_0x4060('0x4'));var fs=require('fs');var path=require(_0x4060('0x5'));var rimraf=require(_0x4060('0x6'));var config=require(_0x4060('0x7'));var attributes=require(_0x4060('0x8'));module['exports']=function(_0x59c3a1,_0x420c35){return _0x59c3a1[_0x4060('0x9')](_0x4060('0xa'),attributes,{'tableName':_0x4060('0xb'),'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 a2e8ee6..227041d 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 _0x7600=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3e7d6a,_0x5bc165){var _0x173913=function(_0x26a3b0){while(--_0x26a3b0){_0x3e7d6a['push'](_0x3e7d6a['shift']());}};_0x173913(++_0x5bc165);}(_0x7600,0x1e7));var _0x0760=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x7600[_0x381589];return _0x2a075d;};'use strict';var _=require(_0x0760('0x0'));var util=require(_0x0760('0x1'));var moment=require(_0x0760('0x2'));var BPromise=require(_0x0760('0x3'));var rs=require(_0x0760('0x4'));var fs=require('fs');var Redis=require(_0x0760('0x5'));var db=require(_0x0760('0x6'))['db'];var utils=require(_0x0760('0x7'));var logger=require('../../config/logger')(_0x0760('0x8'));var config=require(_0x0760('0x9'));var jayson=require(_0x0760('0xa'));var client=jayson[_0x0760('0xb')][_0x0760('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d5449,_0x44f6af,_0x4482ef){return new BPromise(function(_0x50745c,_0x292e57){return client['request'](_0x2d5449,_0x4482ef)[_0x0760('0xd')](function(_0x5bdb63){logger['info'](_0x0760('0xe'),_0x44f6af,'request\x20sent');logger[_0x0760('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x44f6af,_0x0760('0x10'),JSON[_0x0760('0x11')](_0x5bdb63));if(_0x5bdb63['error']){if(_0x5bdb63[_0x0760('0x12')][_0x0760('0x13')]===0x1f4){logger['error'](_0x0760('0xe'),_0x44f6af,_0x5bdb63[_0x0760('0x12')][_0x0760('0x14')]);return _0x292e57(_0x5bdb63[_0x0760('0x12')][_0x0760('0x14')]);}logger[_0x0760('0x12')](_0x0760('0xe'),_0x44f6af,_0x5bdb63[_0x0760('0x12')][_0x0760('0x14')]);return _0x50745c(_0x5bdb63[_0x0760('0x12')][_0x0760('0x14')]);}else{logger[_0x0760('0x15')](_0x0760('0xe'),_0x44f6af,_0x0760('0x10'));_0x50745c(_0x5bdb63[_0x0760('0x16')][_0x0760('0x14')]);}})[_0x0760('0x17')](function(_0x3fafd1){logger[_0x0760('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x44f6af,_0x3fafd1);_0x292e57(_0x3fafd1);});});} \ No newline at end of file +var _0x4422=['stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4e0eb9,_0x4e8b98){var _0x1f8c3c=function(_0x37a4b7){while(--_0x37a4b7){_0x4e0eb9['push'](_0x4e0eb9['shift']());}};_0x1f8c3c(++_0x4e8b98);}(_0x4422,0x140));var _0x2442=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4422[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2442('0x0'));var util=require(_0x2442('0x1'));var moment=require(_0x2442('0x2'));var BPromise=require('bluebird');var rs=require(_0x2442('0x3'));var fs=require('fs');var Redis=require(_0x2442('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2442('0x5'));var logger=require(_0x2442('0x6'))(_0x2442('0x7'));var config=require(_0x2442('0x8'));var jayson=require(_0x2442('0x9'));var client=jayson[_0x2442('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c709,_0x33337f,_0x4bd4b7){return new BPromise(function(_0x8b4496,_0x5dc107){return client[_0x2442('0xb')](_0x20c709,_0x4bd4b7)[_0x2442('0xc')](function(_0x40ba3b){logger[_0x2442('0xd')](_0x2442('0xe'),_0x33337f,_0x2442('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x33337f,_0x2442('0xf'),JSON[_0x2442('0x10')](_0x40ba3b));if(_0x40ba3b[_0x2442('0x11')]){if(_0x40ba3b[_0x2442('0x11')][_0x2442('0x12')]===0x1f4){logger[_0x2442('0x11')](_0x2442('0xe'),_0x33337f,_0x40ba3b[_0x2442('0x11')]['message']);return _0x5dc107(_0x40ba3b[_0x2442('0x11')][_0x2442('0x13')]);}logger[_0x2442('0x11')](_0x2442('0xe'),_0x33337f,_0x40ba3b[_0x2442('0x11')][_0x2442('0x13')]);return _0x8b4496(_0x40ba3b[_0x2442('0x11')]['message']);}else{logger[_0x2442('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x33337f,_0x2442('0xf'));_0x8b4496(_0x40ba3b['result']['message']);}})[_0x2442('0x14')](function(_0x5a6389){logger[_0x2442('0x11')](_0x2442('0xe'),_0x33337f,_0x5a6389);_0x5dc107(_0x5a6389);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5bd5f55..3418f47 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 _0xdf8d=['../../config/environment','./intFreshdeskField.controller','get','index','/:id','show','post','create','update','delete','isAuthenticated','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x1af8d3,_0x544d86){var _0x3a50c5=function(_0x4179aa){while(--_0x4179aa){_0x1af8d3['push'](_0x1af8d3['shift']());}};_0x3a50c5(++_0x544d86);}(_0xdf8d,0x9c));var _0xddf8=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xdf8d[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0xddf8('0x0'));var util=require(_0xddf8('0x1'));var path=require('path');var timeout=require(_0xddf8('0x2'));var express=require('express');var router=express[_0xddf8('0x3')]();var fs_extra=require(_0xddf8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xddf8('0x5'));var config=require(_0xddf8('0x6'));var controller=require(_0xddf8('0x7'));router[_0xddf8('0x8')]('/',auth['isAuthenticated'](),controller[_0xddf8('0x9')]);router[_0xddf8('0x8')](_0xddf8('0xa'),auth['isAuthenticated'](),controller[_0xddf8('0xb')]);router[_0xddf8('0xc')]('/',auth['isAuthenticated'](),controller[_0xddf8('0xd')]);router['put'](_0xddf8('0xa'),auth['isAuthenticated'](),controller[_0xddf8('0xe')]);router[_0xddf8('0xf')](_0xddf8('0xa'),auth[_0xddf8('0x10')](),controller['destroy']);module[_0xddf8('0x11')]=router; \ No newline at end of file +var _0x2cc2=['../../components/auth/service','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x5350e5,_0x984d4a){var _0x3fa2a5=function(_0x27d59c){while(--_0x27d59c){_0x5350e5['push'](_0x5350e5['shift']());}};_0x3fa2a5(++_0x984d4a);}(_0x2cc2,0xd3));var _0x22cc=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x2cc2[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0x22cc('0x0'));var util=require('util');var path=require(_0x22cc('0x1'));var timeout=require(_0x22cc('0x2'));var express=require(_0x22cc('0x3'));var router=express['Router']();var fs_extra=require(_0x22cc('0x4'));var auth=require(_0x22cc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22cc('0x6'));router[_0x22cc('0x7')]('/',auth['isAuthenticated'](),controller[_0x22cc('0x8')]);router[_0x22cc('0x7')](_0x22cc('0x9'),auth[_0x22cc('0xa')](),controller[_0x22cc('0xb')]);router['post']('/',auth[_0x22cc('0xa')](),controller[_0x22cc('0xc')]);router[_0x22cc('0xd')](_0x22cc('0x9'),auth[_0x22cc('0xa')](),controller[_0x22cc('0xe')]);router[_0x22cc('0xf')]('/:id',auth[_0x22cc('0xa')](),controller[_0x22cc('0x10')]);module[_0x22cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index b5daca5..52c856b 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 _0x1fc8=['sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN'];(function(_0x237395,_0x2b11b4){var _0x1a67c4=function(_0xf7488b){while(--_0xf7488b){_0x237395['push'](_0x237395['shift']());}};_0x1a67c4(++_0x2b11b4);}(_0x1fc8,0x14a));var _0x81fc=function(_0x20ab6e,_0x8ae87f){_0x20ab6e=_0x20ab6e-0x0;var _0xb17e72=_0x1fc8[_0x20ab6e];return _0xb17e72;};'use strict';var Sequelize=require(_0x81fc('0x0'));module[_0x81fc('0x1')]={'type':{'type':Sequelize[_0x81fc('0x2')]('string','variable',_0x81fc('0x3'),_0x81fc('0x4'),_0x81fc('0x5')),'defaultValue':_0x81fc('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x81fc('0x7')]},'keyType':{'type':Sequelize[_0x81fc('0x2')](_0x81fc('0x6'),_0x81fc('0x8'),_0x81fc('0x3'))},'keyContent':{'type':Sequelize[_0x81fc('0x7')]},'idField':{'type':Sequelize[_0x81fc('0x7')]},'nameField':{'type':Sequelize[_0x81fc('0x7')]},'customField':{'type':Sequelize[_0x81fc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81fc('0x7')]}}; \ No newline at end of file +var _0xe87e=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x469c9d,_0x35c4d2){var _0x544965=function(_0x3376cf){while(--_0x3376cf){_0x469c9d['push'](_0x469c9d['shift']());}};_0x544965(++_0x35c4d2);}(_0xe87e,0xa5));var _0xee87=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xe87e[_0x476bf4];return _0x788ffe;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xee87('0x0')](_0xee87('0x1'),_0xee87('0x2'),_0xee87('0x3'),_0xee87('0x4'),_0xee87('0x5')),'defaultValue':_0xee87('0x1')},'content':{'type':Sequelize[_0xee87('0x6')]},'key':{'type':Sequelize[_0xee87('0x6')]},'keyType':{'type':Sequelize[_0xee87('0x0')]('string',_0xee87('0x2'),_0xee87('0x3'))},'keyContent':{'type':Sequelize[_0xee87('0x6')]},'idField':{'type':Sequelize[_0xee87('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xee87('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee87('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3f31218..ab8aee0 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 _0x6e6c=['set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','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'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_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(){_0x36ebfa[_0xc6e6('0x18')](0xcc)[_0xc6e6('0x26')]();});}};}function handleEntityNotFound(_0x2e5e0e,_0x64e1dc){return function(_0x53a1bf){if(!_0x53a1bf){_0x2e5e0e[_0xc6e6('0x17')](0x194);}return _0x53a1bf;};}function handleError(_0x5a5e47,_0x28577b){_0x28577b=_0x28577b||0x1f4;return function(_0x534745){logger[_0xc6e6('0x27')](_0x534745[_0xc6e6('0x28')]);if(_0x534745[_0xc6e6('0x29')]){delete _0x534745[_0xc6e6('0x29')];}_0x5a5e47[_0xc6e6('0x18')](_0x28577b)['send'](_0x534745);};}exports[_0xc6e6('0x2a')]=function(_0x1501bd,_0x166313){var _0x1af05c={},_0x4d1284={},_0x34ae96={'count':0x0,'rows':[]};var _0x50b735=_[_0xc6e6('0x2b')](db[_0xc6e6('0x2c')][_0xc6e6('0x2d')],function(_0xc578b3){return{'name':_0xc578b3[_0xc6e6('0x2e')],'type':_0xc578b3[_0xc6e6('0x2f')][_0xc6e6('0x30')]};});_0x4d1284[_0xc6e6('0x31')]=_[_0xc6e6('0x2b')](_0x50b735,_0xc6e6('0x29'));_0x4d1284[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x1501bd[_0xc6e6('0x32')]);_0x4d1284[_0xc6e6('0x34')]=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],_0x4d1284[_0xc6e6('0x32')]);_0x1af05c['attributes']=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],qs['fields'](_0x1501bd['query'][_0xc6e6('0x36')]));_0x1af05c[_0xc6e6('0x37')]=_0x1af05c[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x1af05c[_0xc6e6('0x37')]:_0x4d1284[_0xc6e6('0x31')];if(!_0x1501bd['query'][_0xc6e6('0x39')](_0xc6e6('0x3a'))){_0x1af05c[_0xc6e6('0x1c')]=qs['limit'](_0x1501bd['query'][_0xc6e6('0x1c')]);_0x1af05c[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x1501bd[_0xc6e6('0x32')]['offset']);}_0x1af05c['order']=qs[_0xc6e6('0x3b')](_0x1501bd['query'][_0xc6e6('0x3b')]);_0x1af05c['where']=qs[_0xc6e6('0x34')](_[_0xc6e6('0x3c')](_0x1501bd[_0xc6e6('0x32')],_0x4d1284[_0xc6e6('0x34')]),_0x50b735);if(_0x1501bd['query']['filter']){_0x1af05c[_0xc6e6('0x3d')]=_[_0xc6e6('0x3e')](_0x1af05c[_0xc6e6('0x3d')],{'$or':_[_0xc6e6('0x2b')](_0x50b735,function(_0x4bb732){if(_0x4bb732['type']!==_0xc6e6('0x3f')){var _0x1326c7={};_0x1326c7[_0x4bb732[_0xc6e6('0x29')]]={'$like':'%'+_0x1501bd[_0xc6e6('0x32')]['filter']+'%'};return _0x1326c7;}})});}_0x1af05c=_[_0xc6e6('0x3e')]({},_0x1af05c,_0x1501bd[_0xc6e6('0x40')]);var _0x5ddab4={'where':_0x1af05c['where']};return db[_0xc6e6('0x2c')]['count'](_0x5ddab4)[_0xc6e6('0x24')](function(_0x3817fc){_0x34ae96['count']=_0x3817fc;if(_0x1501bd[_0xc6e6('0x32')]['includeAll']){_0x1af05c[_0xc6e6('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xc6e6('0x42')](_0x1af05c);})[_0xc6e6('0x24')](function(_0x247076){_0x34ae96[_0xc6e6('0x43')]=_0x247076;return _0x34ae96;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x166313,_0x1af05c))[_0xc6e6('0x44')](handleError(_0x166313,null));};exports[_0xc6e6('0x45')]=function(_0x69766,_0x5ecf6c){var _0x5722db={'raw':!![],'where':{'id':_0x69766[_0xc6e6('0x46')]['id']}},_0x3e3da6={};_0x3e3da6[_0xc6e6('0x31')]=_[_0xc6e6('0x33')](db['FreshdeskField'][_0xc6e6('0x2d')]);_0x3e3da6[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x69766[_0xc6e6('0x32')]);_0x3e3da6['filters']=_[_0xc6e6('0x35')](_0x3e3da6[_0xc6e6('0x31')],_0x3e3da6[_0xc6e6('0x32')]);_0x5722db[_0xc6e6('0x37')]=_[_0xc6e6('0x35')](_0x3e3da6['model'],qs[_0xc6e6('0x36')](_0x69766['query'][_0xc6e6('0x36')]));_0x5722db['attributes']=_0x5722db[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x5722db[_0xc6e6('0x37')]:_0x3e3da6[_0xc6e6('0x31')];if(_0x69766[_0xc6e6('0x32')][_0xc6e6('0x47')]){_0x5722db[_0xc6e6('0x41')]=[{'all':!![]}];}_0x5722db=_[_0xc6e6('0x3e')]({},_0x5722db,_0x69766['options']);return db[_0xc6e6('0x2c')][_0xc6e6('0x48')](_0x5722db)[_0xc6e6('0x24')](handleEntityNotFound(_0x5ecf6c,null))['then'](respondWithResult(_0x5ecf6c,null))[_0xc6e6('0x44')](handleError(_0x5ecf6c,null));};exports[_0xc6e6('0x49')]=function(_0x38ecc3,_0x42ed90){return db[_0xc6e6('0x2c')][_0xc6e6('0x49')](_0x38ecc3[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x42ed90,0xc9))[_0xc6e6('0x44')](handleError(_0x42ed90,null));};exports[_0xc6e6('0x23')]=function(_0x3bfe85,_0x470167){if(_0x3bfe85[_0xc6e6('0x4a')]['id']){delete _0x3bfe85[_0xc6e6('0x4a')]['id'];}return db['FreshdeskField'][_0xc6e6('0x48')]({'where':{'id':_0x3bfe85['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x470167,null))[_0xc6e6('0x24')](saveUpdates(_0x3bfe85['body'],null))['then'](respondWithResult(_0x470167,null))['catch'](handleError(_0x470167,null));};exports['destroy']=function(_0x531dca,_0x3edc16){return db[_0xc6e6('0x2c')][_0xc6e6('0x48')]({'where':{'id':_0x531dca[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3edc16,null))['then'](removeEntity(_0x3edc16,null))['catch'](handleError(_0x3edc16,null));}; \ No newline at end of file +var _0x153f=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x3119f8,_0x37b2fa){var _0x56348c=function(_0x136a49){while(--_0x136a49){_0x3119f8['push'](_0x3119f8['shift']());}};_0x56348c(++_0x37b2fa);}(_0x153f,0x15b));var _0xf153=function(_0x4dc73f,_0x3dcbef){_0x4dc73f=_0x4dc73f-0x0;var _0x411685=_0x153f[_0x4dc73f];return _0x411685;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={},_0x339e96={},_0x258976={'count':0x0,'rows':[]};var _0x441436=_[_0xf153('0x2d')](db[_0xf153('0x2e')][_0xf153('0x2f')],function(_0x13b541){return{'name':_0x13b541[_0xf153('0x30')],'type':_0x13b541['type'][_0xf153('0x31')]};});_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2d')](_0x441436,_0xf153('0x2b'));_0x339e96['query']=_['keys'](_0x10295e[_0xf153('0x33')]);_0x339e96['filters']=_['intersection'](_0x339e96[_0xf153('0x32')],_0x339e96['query']);_0x2b9a9c[_0xf153('0x34')]=_['intersection'](_0x339e96[_0xf153('0x32')],qs[_0xf153('0x35')](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c[_0xf153('0x34')]=_0x2b9a9c[_0xf153('0x34')][_0xf153('0x36')]?_0x2b9a9c[_0xf153('0x34')]:_0x339e96[_0xf153('0x32')];if(!_0x10295e['query'][_0xf153('0x37')]('nolimit')){_0x2b9a9c[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x10295e[_0xf153('0x33')][_0xf153('0x20')]);_0x2b9a9c[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x10295e['query'][_0xf153('0x1f')]);}_0x2b9a9c[_0xf153('0x38')]=qs[_0xf153('0x39')](_0x10295e['query'][_0xf153('0x39')]);_0x2b9a9c[_0xf153('0x3a')]=qs[_0xf153('0x3b')](_[_0xf153('0x3c')](_0x10295e[_0xf153('0x33')],_0x339e96[_0xf153('0x3b')]),_0x441436);if(_0x10295e['query'][_0xf153('0x3d')]){_0x2b9a9c[_0xf153('0x3a')]=_['merge'](_0x2b9a9c[_0xf153('0x3a')],{'$or':_[_0xf153('0x2d')](_0x441436,function(_0x357666){if(_0x357666[_0xf153('0x3e')]!==_0xf153('0x3f')){var _0x42360a={};_0x42360a[_0x357666[_0xf153('0x2b')]]={'$like':'%'+_0x10295e['query'][_0xf153('0x3d')]+'%'};return _0x42360a;}})});}_0x2b9a9c=_[_0xf153('0x40')]({},_0x2b9a9c,_0x10295e[_0xf153('0x41')]);var _0x352e7c={'where':_0x2b9a9c[_0xf153('0x3a')]};return db[_0xf153('0x2e')]['count'](_0x352e7c)['then'](function(_0xa3922b){_0x258976['count']=_0xa3922b;if(_0x10295e[_0xf153('0x33')][_0xf153('0x42')]){_0x2b9a9c[_0xf153('0x43')]=[{'all':!![]}];}return db[_0xf153('0x2e')][_0xf153('0x44')](_0x2b9a9c);})[_0xf153('0x27')](function(_0x5599e5){_0x258976['rows']=_0x5599e5;return _0x258976;})[_0xf153('0x27')](respondWithFilteredResult(_0x261ac0,_0x2b9a9c))[_0xf153('0x45')](handleError(_0x261ac0,null));};exports['show']=function(_0x21529a,_0x1c77a6){var _0x1edf65={'raw':!![],'where':{'id':_0x21529a[_0xf153('0x46')]['id']}},_0x3a9cb2={};_0x3a9cb2[_0xf153('0x32')]=_[_0xf153('0x47')](db[_0xf153('0x2e')][_0xf153('0x2f')]);_0x3a9cb2[_0xf153('0x33')]=_[_0xf153('0x47')](_0x21529a[_0xf153('0x33')]);_0x3a9cb2['filters']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],_0x3a9cb2[_0xf153('0x33')]);_0x1edf65['attributes']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],qs['fields'](_0x21529a[_0xf153('0x33')]['fields']));_0x1edf65[_0xf153('0x34')]=_0x1edf65[_0xf153('0x34')][_0xf153('0x36')]?_0x1edf65['attributes']:_0x3a9cb2[_0xf153('0x32')];if(_0x21529a[_0xf153('0x33')][_0xf153('0x42')]){_0x1edf65[_0xf153('0x43')]=[{'all':!![]}];}_0x1edf65=_[_0xf153('0x40')]({},_0x1edf65,_0x21529a['options']);return db[_0xf153('0x2e')][_0xf153('0x49')](_0x1edf65)['then'](handleEntityNotFound(_0x1c77a6,null))[_0xf153('0x27')](respondWithResult(_0x1c77a6,null))[_0xf153('0x45')](handleError(_0x1c77a6,null));};exports[_0xf153('0x4a')]=function(_0x5599a6,_0x657403){return db[_0xf153('0x2e')][_0xf153('0x4a')](_0x5599a6[_0xf153('0x4b')],{})[_0xf153('0x27')](respondWithResult(_0x657403,0xc9))[_0xf153('0x45')](handleError(_0x657403,null));};exports[_0xf153('0x26')]=function(_0x33e48,_0x3b91ed){if(_0x33e48['body']['id']){delete _0x33e48[_0xf153('0x4b')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x33e48['params']['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x3b91ed,null))[_0xf153('0x27')](saveUpdates(_0x33e48['body'],null))[_0xf153('0x27')](respondWithResult(_0x3b91ed,null))[_0xf153('0x45')](handleError(_0x3b91ed,null));};exports['destroy']=function(_0x3f1ecb,_0xe6e023){return db[_0xf153('0x2e')][_0xf153('0x49')]({'where':{'id':_0x3f1ecb[_0xf153('0x46')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0xe6e023,null))['then'](removeEntity(_0xe6e023,null))[_0xf153('0x45')](handleError(_0xe6e023,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2ee3986..3873264 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 _0x2e2e=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1f74f6,_0x194920){var _0x7c9710=function(_0x3fb114){while(--_0x3fb114){_0x1f74f6['push'](_0x1f74f6['shift']());}};_0x7c9710(++_0x194920);}(_0x2e2e,0x138));var _0xe2e2=function(_0x4e9b86,_0x9148cb){_0x4e9b86=_0x4e9b86-0x0;var _0x42e296=_0x2e2e[_0x4e9b86];return _0x42e296;};'use strict';var _=require(_0xe2e2('0x0'));var util=require(_0xe2e2('0x1'));var logger=require(_0xe2e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe2e2('0x3'));var rp=require(_0xe2e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2e2('0x5'));var config=require(_0xe2e2('0x6'));var attributes=require(_0xe2e2('0x7'));module[_0xe2e2('0x8')]=function(_0x11271f,_0x4f2a56){return _0x11271f[_0xe2e2('0x9')]('FreshdeskField',attributes,{'tableName':_0xe2e2('0xa'),'paranoid':![],'indexes':[{'name':_0xe2e2('0xb'),'fields':['idField',_0xe2e2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa952=['moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x182f97,_0x5ef2a1){var _0x167598=function(_0x283cae){while(--_0x283cae){_0x182f97['push'](_0x182f97['shift']());}};_0x167598(++_0x5ef2a1);}(_0xa952,0x98));var _0x2a95=function(_0x2f1d70,_0x14763c){_0x2f1d70=_0x2f1d70-0x0;var _0x162fc5=_0xa952[_0x2f1d70];return _0x162fc5;};'use strict';var _=require(_0x2a95('0x0'));var util=require(_0x2a95('0x1'));var logger=require(_0x2a95('0x2'))(_0x2a95('0x3'));var moment=require(_0x2a95('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a95('0x6'));var config=require(_0x2a95('0x7'));var attributes=require(_0x2a95('0x8'));module[_0x2a95('0x9')]=function(_0x2cedc2,_0x3d5649){return _0x2cedc2[_0x2a95('0xa')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2a95('0xb'),'fields':['idField',_0x2a95('0xc')],'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 971b6e2..1d210b8 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 _0x1bb3=['../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','ioredis'];(function(_0x556d57,_0x27e9e8){var _0x44aa1f=function(_0x5f06d5){while(--_0x5f06d5){_0x556d57['push'](_0x556d57['shift']());}};_0x44aa1f(++_0x27e9e8);}(_0x1bb3,0x1e4));var _0x31bb=function(_0x25fc37,_0x4db964){_0x25fc37=_0x25fc37-0x0;var _0x33a05a=_0x1bb3[_0x25fc37];return _0x33a05a;};'use strict';var _=require(_0x31bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31bb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x31bb('0x2'));var jayson=require(_0x31bb('0x3'));var client=jayson[_0x31bb('0x4')][_0x31bb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x398f71,_0x473cd8,_0x11ef52){return new BPromise(function(_0x1425be,_0x3355b8){return client[_0x31bb('0x6')](_0x398f71,_0x11ef52)[_0x31bb('0x7')](function(_0x23ae4f){logger[_0x31bb('0x8')](_0x31bb('0x9'),_0x473cd8,_0x31bb('0xa'));logger['debug'](_0x31bb('0xb'),_0x473cd8,_0x31bb('0xa'),JSON[_0x31bb('0xc')](_0x23ae4f));if(_0x23ae4f[_0x31bb('0xd')]){if(_0x23ae4f['error'][_0x31bb('0xe')]===0x1f4){logger['error'](_0x31bb('0x9'),_0x473cd8,_0x23ae4f[_0x31bb('0xd')]['message']);return _0x3355b8(_0x23ae4f[_0x31bb('0xd')]['message']);}logger[_0x31bb('0xd')](_0x31bb('0x9'),_0x473cd8,_0x23ae4f[_0x31bb('0xd')]['message']);return _0x1425be(_0x23ae4f['error'][_0x31bb('0xf')]);}else{logger[_0x31bb('0x8')]('FreshdeskField,\x20%s,\x20%s',_0x473cd8,_0x31bb('0xa'));_0x1425be(_0x23ae4f[_0x31bb('0x10')][_0x31bb('0xf')]);}})[_0x31bb('0x11')](function(_0x475f8a){logger[_0x31bb('0xd')](_0x31bb('0x9'),_0x473cd8,_0x475f8a);_0x3355b8(_0x475f8a);});});} \ No newline at end of file +var _0x811e=['FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','debug'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x811e,0x72));var _0xe811=function(_0x1c9a9a,_0x30a12f){_0x1c9a9a=_0x1c9a9a-0x0;var _0xca3172=_0x811e[_0x1c9a9a];return _0xca3172;};'use strict';var _=require('lodash');var util=require(_0xe811('0x0'));var moment=require(_0xe811('0x1'));var BPromise=require(_0xe811('0x2'));var rs=require(_0xe811('0x3'));var fs=require('fs');var Redis=require(_0xe811('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe811('0x5'));var logger=require(_0xe811('0x6'))(_0xe811('0x7'));var config=require('../../config/environment');var jayson=require(_0xe811('0x8'));var client=jayson[_0xe811('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xecb9e3,_0x2903b2,_0x3af580){return new BPromise(function(_0x37ae89,_0x83591c){return client['request'](_0xecb9e3,_0x3af580)['then'](function(_0x31f9ef){logger[_0xe811('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x2903b2,'request\x20sent');logger[_0xe811('0xb')](_0xe811('0xc'),_0x2903b2,_0xe811('0xd'),JSON[_0xe811('0xe')](_0x31f9ef));if(_0x31f9ef['error']){if(_0x31f9ef[_0xe811('0xf')][_0xe811('0x10')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2903b2,_0x31f9ef[_0xe811('0xf')]['message']);return _0x83591c(_0x31f9ef[_0xe811('0xf')][_0xe811('0x11')]);}logger[_0xe811('0xf')](_0xe811('0x12'),_0x2903b2,_0x31f9ef['error'][_0xe811('0x11')]);return _0x37ae89(_0x31f9ef[_0xe811('0xf')]['message']);}else{logger[_0xe811('0xa')](_0xe811('0x12'),_0x2903b2,_0xe811('0xd'));_0x37ae89(_0x31f9ef[_0xe811('0x13')]['message']);}})[_0xe811('0x14')](function(_0x54b993){logger[_0xe811('0xf')](_0xe811('0x12'),_0x2903b2,_0x54b993);_0x83591c(_0x54b993);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 758642f..d7a63c3 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 _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x58682e,_0x48176d){var _0x533e59=function(_0x4a5513){while(--_0x4a5513){_0x58682e['push'](_0x58682e['shift']());}};_0x533e59(++_0x48176d);}(_0x44a3,0x1a9));var _0x344a=function(_0x154cbb,_0x43c57f){_0x154cbb=_0x154cbb-0x0;var _0x494584=_0x44a3[_0x154cbb];return _0x494584;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb9be=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x3ba237,_0x4c7242){var _0x48b9ce=function(_0x2ea18d){while(--_0x2ea18d){_0x3ba237['push'](_0x3ba237['shift']());}};_0x48b9ce(++_0x4c7242);}(_0xb9be,0xc5));var _0xeb9b=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xb9be[_0x40b493];return _0x548365;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x9')](_0xeb9b('0x10'),auth['isAuthenticated'](),controller[_0xeb9b('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);router[_0xeb9b('0x13')]('/:id/configurations',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x14')]);router[_0xeb9b('0x15')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 26be677..f0e3780 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 _0x1a85=['STRING','remoteUri'];(function(_0x740fde,_0x490c95){var _0x15199f=function(_0x2f731c){while(--_0x2f731c){_0x740fde['push'](_0x740fde['shift']());}};_0x15199f(++_0x490c95);}(_0x1a85,0x178));var _0x51a8=function(_0x42c7b5,_0x3f2ccf){_0x42c7b5=_0x42c7b5-0x0;var _0x3919b2=_0x1a85[_0x42c7b5];return _0x3919b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x57ca=['exports','STRING','username','remoteUri'];(function(_0x186e95,_0x2fbad4){var _0x2c75d1=function(_0x371933){while(--_0x371933){_0x186e95['push'](_0x186e95['shift']());}};_0x2c75d1(++_0x2fbad4);}(_0x57ca,0x108));var _0xa57c=function(_0x4ff819,_0x247bae){_0x4ff819=_0x4ff819-0x0;var _0x31bce6=_0x57ca[_0x4ff819];return _0x31bce6;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'name':{'type':Sequelize[_0xa57c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x2')},'apiKey':{'type':Sequelize[_0xa57c('0x1')]},'remoteUri':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 010c31a..52e0038 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 _0x67b8=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','offset','limit','set','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','index','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshsalesAccount','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','FreshsalesConfiguration','map','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','findOne','username','remoteUri','slice','substring','lastIndexOf','%s%s','/api/selector/owners','Token\x20token=','apiKey','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x1fd8f4,_0xaa4a62){var _0x9fcda2=function(_0x59b269){while(--_0x59b269){_0x1fd8f4['push'](_0x1fd8f4['shift']());}};_0x9fcda2(++_0xaa4a62);}(_0x67b8,0x18b));var _0x867b=function(_0x228b46,_0x6268b6){_0x228b46=_0x228b46-0x0;var _0x472296=_0x67b8[_0x228b46];return _0x472296;};'use strict';var emlformat=require(_0x867b('0x0'));var rimraf=require(_0x867b('0x1'));var zipdir=require(_0x867b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x867b('0x3'));var moment=require(_0x867b('0x4'));var BPromise=require(_0x867b('0x5'));var Mustache=require(_0x867b('0x6'));var util=require(_0x867b('0x7'));var path=require(_0x867b('0x8'));var sox=require(_0x867b('0x9'));var csv=require('to-csv');var ejs=require(_0x867b('0xa'));var fs=require('fs');var fs_extra=require(_0x867b('0xb'));var _=require(_0x867b('0xc'));var squel=require(_0x867b('0xd'));var crypto=require(_0x867b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x867b('0xf'));var toCsv=require(_0x867b('0x10'));var querystring=require(_0x867b('0x11'));var Papa=require(_0x867b('0x12'));var Redis=require(_0x867b('0x13'));var authService=require(_0x867b('0x14'));var qs=require(_0x867b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x867b('0x16'));var licenseUtil=require(_0x867b('0x17'));var db=require(_0x867b('0x18'))['db'];var integrations=require(_0x867b('0x19'));function respondWithStatusCode(_0x2b7845,_0x480c3d){_0x480c3d=_0x480c3d||0xcc;return function(_0x2c64a9){if(_0x2c64a9){return _0x2b7845['sendStatus'](_0x480c3d);}return _0x2b7845[_0x867b('0x1a')](_0x480c3d)['end']();};}function respondWithResult(_0x273bb5,_0x352f78){_0x352f78=_0x352f78||0xc8;return function(_0x357a24){if(_0x357a24){return _0x273bb5[_0x867b('0x1a')](_0x352f78)['json'](_0x357a24);}};}function respondWithFilteredResult(_0xd3d4cf,_0x7d013a){return function(_0x40cdf8){if(_0x40cdf8){var _0x158391=typeof _0x7d013a['offset']===_0x867b('0x1b')&&typeof _0x7d013a['limit']===_0x867b('0x1b');var _0x597b81=_0x40cdf8['count'];var _0x35c368=_0x158391?0x0:_0x7d013a[_0x867b('0x1c')];var _0x2b4b20=_0x158391?_0x40cdf8['count']:_0x7d013a['offset']+_0x7d013a[_0x867b('0x1d')];var _0x4e1854;if(_0x2b4b20>=_0x597b81){_0x2b4b20=_0x597b81;_0x4e1854=0xc8;}else{_0x4e1854=0xce;}_0xd3d4cf[_0x867b('0x1a')](_0x4e1854);return _0xd3d4cf[_0x867b('0x1e')]('Content-Range',_0x35c368+'-'+_0x2b4b20+'/'+_0x597b81)[_0x867b('0x1f')](_0x40cdf8);}return null;};}function patchUpdates(_0x1db604){return function(_0x34934e){try{jsonpatch[_0x867b('0x20')](_0x34934e,_0x1db604,!![]);}catch(_0x199e12){return BPromise[_0x867b('0x21')](_0x199e12);}return _0x34934e[_0x867b('0x22')]();};}function saveUpdates(_0x28d6e6,_0x273fe1){return function(_0x1301cc){if(_0x1301cc){return _0x1301cc[_0x867b('0x23')](_0x28d6e6)['then'](function(_0x3066c9){return _0x3066c9;});}return null;};}function removeEntity(_0x3f74fc,_0x5426f2){return function(_0x545ecc){if(_0x545ecc){return _0x545ecc[_0x867b('0x24')]()[_0x867b('0x25')](function(){_0x3f74fc[_0x867b('0x1a')](0xcc)[_0x867b('0x26')]();});}};}function handleEntityNotFound(_0x236f86,_0x12bbdc){return function(_0xa0cfa1){if(!_0xa0cfa1){_0x236f86[_0x867b('0x27')](0x194);}return _0xa0cfa1;};}function handleError(_0xb034f,_0x166905){_0x166905=_0x166905||0x1f4;return function(_0x1fea24){logger[_0x867b('0x28')](_0x1fea24[_0x867b('0x29')]);if(_0x1fea24[_0x867b('0x2a')]){delete _0x1fea24['name'];}_0xb034f[_0x867b('0x1a')](_0x166905)['send'](_0x1fea24);};}exports[_0x867b('0x2b')]=function(_0x5c5970,_0x8cd4ad){var _0x36af39={},_0x23c45d={},_0x10703c={'count':0x0,'rows':[]};var _0xd13434=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x43cb46){return{'name':_0x43cb46[_0x867b('0x2c')],'type':_0x43cb46['type'][_0x867b('0x2d')]};});_0x23c45d['model']=_['map'](_0xd13434,'name');_0x23c45d[_0x867b('0x2e')]=_[_0x867b('0x2f')](_0x5c5970[_0x867b('0x2e')]);_0x23c45d[_0x867b('0x30')]=_[_0x867b('0x31')](_0x23c45d[_0x867b('0x32')],_0x23c45d[_0x867b('0x2e')]);_0x36af39[_0x867b('0x33')]=_['intersection'](_0x23c45d[_0x867b('0x32')],qs[_0x867b('0x34')](_0x5c5970[_0x867b('0x2e')][_0x867b('0x34')]));_0x36af39[_0x867b('0x33')]=_0x36af39[_0x867b('0x33')][_0x867b('0x35')]?_0x36af39[_0x867b('0x33')]:_0x23c45d[_0x867b('0x32')];if(!_0x5c5970[_0x867b('0x2e')]['hasOwnProperty'](_0x867b('0x36'))){_0x36af39[_0x867b('0x1d')]=qs[_0x867b('0x1d')](_0x5c5970[_0x867b('0x2e')][_0x867b('0x1d')]);_0x36af39[_0x867b('0x1c')]=qs[_0x867b('0x1c')](_0x5c5970[_0x867b('0x2e')][_0x867b('0x1c')]);}_0x36af39['order']=qs['sort'](_0x5c5970[_0x867b('0x2e')][_0x867b('0x37')]);_0x36af39[_0x867b('0x38')]=qs[_0x867b('0x30')](_[_0x867b('0x39')](_0x5c5970[_0x867b('0x2e')],_0x23c45d[_0x867b('0x30')]),_0xd13434);if(_0x5c5970[_0x867b('0x2e')][_0x867b('0x3a')]){_0x36af39['where']=_[_0x867b('0x3b')](_0x36af39[_0x867b('0x38')],{'$or':_['map'](_0xd13434,function(_0x29783b){if(_0x29783b[_0x867b('0x3c')]!==_0x867b('0x3d')){var _0x5091a5={};_0x5091a5[_0x29783b[_0x867b('0x2a')]]={'$like':'%'+_0x5c5970[_0x867b('0x2e')]['filter']+'%'};return _0x5091a5;}})});}_0x36af39=_[_0x867b('0x3b')]({},_0x36af39,_0x5c5970[_0x867b('0x3e')]);var _0x2e2af0={'where':_0x36af39['where']};return db[_0x867b('0x3f')][_0x867b('0x40')](_0x2e2af0)[_0x867b('0x25')](function(_0xc1506c){_0x10703c[_0x867b('0x40')]=_0xc1506c;if(_0x5c5970[_0x867b('0x2e')][_0x867b('0x41')]){_0x36af39[_0x867b('0x42')]=[{'all':!![]}];}return db[_0x867b('0x3f')][_0x867b('0x43')](_0x36af39);})['then'](function(_0x183bcf){_0x10703c[_0x867b('0x44')]=_0x183bcf;return _0x10703c;})[_0x867b('0x25')](respondWithFilteredResult(_0x8cd4ad,_0x36af39))[_0x867b('0x45')](handleError(_0x8cd4ad,null));};exports['show']=function(_0x1e3407,_0x58e755){var _0x37ec23={'raw':![],'where':{'id':_0x1e3407[_0x867b('0x46')]['id']}},_0x9b6fb8={};_0x9b6fb8[_0x867b('0x32')]=_[_0x867b('0x2f')](db['FreshsalesAccount'][_0x867b('0x47')]);_0x9b6fb8[_0x867b('0x2e')]=_[_0x867b('0x2f')](_0x1e3407[_0x867b('0x2e')]);_0x9b6fb8[_0x867b('0x30')]=_[_0x867b('0x31')](_0x9b6fb8[_0x867b('0x32')],_0x9b6fb8[_0x867b('0x2e')]);_0x37ec23[_0x867b('0x33')]=_[_0x867b('0x31')](_0x9b6fb8[_0x867b('0x32')],qs[_0x867b('0x34')](_0x1e3407[_0x867b('0x2e')][_0x867b('0x34')]));_0x37ec23[_0x867b('0x33')]=_0x37ec23[_0x867b('0x33')][_0x867b('0x35')]?_0x37ec23['attributes']:_0x9b6fb8[_0x867b('0x32')];if(_0x1e3407[_0x867b('0x2e')][_0x867b('0x41')]){_0x37ec23['include']=[{'all':!![]}];}_0x37ec23=_['merge']({},_0x37ec23,_0x1e3407['options']);return db[_0x867b('0x3f')][_0x867b('0x48')](_0x37ec23)[_0x867b('0x25')](handleEntityNotFound(_0x58e755,null))[_0x867b('0x25')](respondWithResult(_0x58e755,null))['catch'](handleError(_0x58e755,null));};exports[_0x867b('0x49')]=function(_0x2d33c0,_0x5896b2){return db[_0x867b('0x3f')][_0x867b('0x49')](_0x2d33c0[_0x867b('0x4a')],{})[_0x867b('0x25')](respondWithResult(_0x5896b2,0xc9))[_0x867b('0x45')](handleError(_0x5896b2,null));};exports['update']=function(_0x327e0d,_0x1c50ce){if(_0x327e0d[_0x867b('0x4a')]['id']){delete _0x327e0d[_0x867b('0x4a')]['id'];}return db[_0x867b('0x3f')][_0x867b('0x48')]({'where':{'id':_0x327e0d[_0x867b('0x46')]['id']}})[_0x867b('0x25')](handleEntityNotFound(_0x1c50ce,null))[_0x867b('0x25')](saveUpdates(_0x327e0d[_0x867b('0x4a')],null))[_0x867b('0x25')](respondWithResult(_0x1c50ce,null))[_0x867b('0x45')](handleError(_0x1c50ce,null));};exports[_0x867b('0x24')]=function(_0x3824d9,_0x30e1af){return db[_0x867b('0x3f')][_0x867b('0x48')]({'where':{'id':_0x3824d9[_0x867b('0x46')]['id']}})['then'](handleEntityNotFound(_0x30e1af,null))[_0x867b('0x25')](removeEntity(_0x30e1af,null))['catch'](handleError(_0x30e1af,null));};exports[_0x867b('0x4b')]=function(_0x56d136,_0x2fcc3d,_0x4d3b3e){var _0x127d3f={};var _0x4a5255={};var _0x22fc94;var _0x44d280;return db[_0x867b('0x3f')]['findOne']({'where':{'id':_0x56d136[_0x867b('0x46')]['id']}})[_0x867b('0x25')](handleEntityNotFound(_0x2fcc3d,null))[_0x867b('0x25')](function(_0xbffa58){if(_0xbffa58){_0x22fc94=_0xbffa58;_0x4a5255[_0x867b('0x32')]=_[_0x867b('0x2f')](db[_0x867b('0x4c')][_0x867b('0x47')]);_0x4a5255['query']=_[_0x867b('0x2f')](_0x56d136[_0x867b('0x2e')]);_0x4a5255[_0x867b('0x30')]=_[_0x867b('0x31')](_0x4a5255[_0x867b('0x32')],_0x4a5255[_0x867b('0x2e')]);_0x127d3f[_0x867b('0x33')]=_[_0x867b('0x31')](_0x4a5255[_0x867b('0x32')],qs[_0x867b('0x34')](_0x56d136[_0x867b('0x2e')][_0x867b('0x34')]));_0x127d3f[_0x867b('0x33')]=_0x127d3f[_0x867b('0x33')][_0x867b('0x35')]?_0x127d3f[_0x867b('0x33')]:_0x4a5255[_0x867b('0x32')];_0x127d3f['order']=qs['sort'](_0x56d136[_0x867b('0x2e')][_0x867b('0x37')]);_0x127d3f[_0x867b('0x38')]=qs[_0x867b('0x30')](_['pick'](_0x56d136[_0x867b('0x2e')],_0x4a5255[_0x867b('0x30')]));if(_0x56d136['query'][_0x867b('0x3a')]){_0x127d3f['where']=_[_0x867b('0x3b')](_0x127d3f[_0x867b('0x38')],{'$or':_[_0x867b('0x4d')](_0x127d3f[_0x867b('0x33')],function(_0x2c4582){var _0x4fbb61={};_0x4fbb61[_0x2c4582]={'$like':'%'+_0x56d136[_0x867b('0x2e')][_0x867b('0x3a')]+'%'};return _0x4fbb61;})});}_0x127d3f=_['merge']({},_0x127d3f,_0x56d136[_0x867b('0x3e')]);return _0x22fc94[_0x867b('0x4b')](_0x127d3f);}})[_0x867b('0x25')](function(_0xb5e3cc){if(_0xb5e3cc){_0x44d280=_0xb5e3cc[_0x867b('0x35')];if(!_0x56d136['query']['hasOwnProperty']('nolimit')){_0x127d3f['limit']=qs[_0x867b('0x1d')](_0x56d136[_0x867b('0x2e')][_0x867b('0x1d')]);_0x127d3f[_0x867b('0x1c')]=qs[_0x867b('0x1c')](_0x56d136[_0x867b('0x2e')][_0x867b('0x1c')]);}return _0x22fc94['getConfigurations'](_0x127d3f);}})['then'](function(_0x18df15){if(_0x18df15){return _0x18df15?{'count':_0x44d280,'rows':_0x18df15}:null;}})[_0x867b('0x25')](respondWithResult(_0x2fcc3d,null))[_0x867b('0x45')](handleError(_0x2fcc3d,null));};exports[_0x867b('0x4e')]=function(_0x356e41,_0x54b0b4,_0x3e882f){if(_0x356e41[_0x867b('0x4a')]['id']){delete _0x356e41[_0x867b('0x4a')]['id'];}return db[_0x867b('0x3f')]['findOne']({'where':{'id':_0x356e41[_0x867b('0x46')]['id']}})[_0x867b('0x25')](handleEntityNotFound(_0x54b0b4,null))[_0x867b('0x25')](function(_0x16df0e){if(_0x16df0e){_0x356e41[_0x867b('0x4a')]['AccountId']=_0x16df0e['id'];_0x356e41['body'][_0x867b('0x4f')]=integrations[_0x867b('0x50')](_0x356e41[_0x867b('0x4a')]['channel'],_0x356e41[_0x867b('0x4a')][_0x867b('0x3c')]);_0x356e41['body'][_0x867b('0x51')]=integrations[_0x867b('0x52')](_0x356e41['body'][_0x867b('0x53')],_0x356e41[_0x867b('0x4a')][_0x867b('0x3c')]);return db[_0x867b('0x4c')][_0x867b('0x49')](_0x356e41[_0x867b('0x4a')],{'include':[{'model':db[_0x867b('0x54')],'as':_0x867b('0x4f')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x54b0b4,null))[_0x867b('0x45')](handleError(_0x54b0b4,null));};exports[_0x867b('0x55')]=function(_0xeb42b6,_0x189fd8,_0xeba785){var _0x247ac6='';var _0x3d6e0e='';return db['FreshsalesAccount'][_0x867b('0x56')]({'where':{'id':_0xeb42b6[_0x867b('0x46')]['id']},'attributes':['id',_0x867b('0x57'),'remoteUri','apiKey']})[_0x867b('0x25')](handleEntityNotFound(_0x189fd8,null))[_0x867b('0x25')](function(_0x56e53a){if(_0x56e53a){_0x3d6e0e=_0x56e53a['username'];_0x247ac6=_0x56e53a[_0x867b('0x58')];var _0x52f95c=_0x56e53a[_0x867b('0x58')][_0x867b('0x59')](-0x1);if(_0x52f95c==='/'){_0x247ac6=_0x247ac6[_0x867b('0x5a')](0x0,_0x247ac6[_0x867b('0x5b')](_0x52f95c));}return rp({'method':'GET','uri':util['format'](_0x867b('0x5c'),_0x247ac6,_0x867b('0x5d')),'headers':{'Authorization':_0x867b('0x5e')+_0x56e53a[_0x867b('0x5f')]},'json':!![]});}})['then'](function(_0x39fdab){if(_0x39fdab){var _0x201306=_0x39fdab['users'];var _0x2e075e=![];var _0x30f476=null;for(_0x30f476=0x0;_0x30f476<_0x201306[_0x867b('0x35')];_0x30f476++){if(_0x201306[_0x30f476]['email']===_0x3d6e0e){_0x2e075e=!![];}}if(_0x2e075e){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x867b('0x25')](respondWithResult(_0x189fd8,null))[_0x867b('0x45')](function(_0x3c6b1d){var _0x2f3ff8=_0xeb42b6['query'][_0x867b('0x60')]?0x1f4:_0x3c6b1d[_0x867b('0x61')]||0x1f4;logger[_0x867b('0x28')](_0x867b('0x62'),_0x867b('0x55'),_0x2f3ff8,JSON[_0x867b('0x63')](_0x3c6b1d));delete _0x3c6b1d['name'];if(_0x2f3ff8===0x191){_0x2f3ff8=0x190;}_0x189fd8[_0x867b('0x1a')](_0x2f3ff8)['send'](_0xeb42b6[_0x867b('0x2e')][_0x867b('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x3c6b1d[_0x867b('0x61')]}:_0x3c6b1d);});}; \ No newline at end of file +var _0x6c78=['getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshsalesField','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','apply','update','destroy','error','name','send','index','FreshsalesAccount','rawAttributes','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','keys','find','create','body','findOne','FreshsalesConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6c78,0x14a));var _0x86c7=function(_0x207ee7,_0x5ebaf6){_0x207ee7=_0x207ee7-0x0;var _0x593b42=_0x6c78[_0x207ee7];return _0x593b42;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86c7('0x0'));var jsonpatch=require(_0x86c7('0x1'));var rp=require(_0x86c7('0x2'));var moment=require(_0x86c7('0x3'));var BPromise=require(_0x86c7('0x4'));var Mustache=require('mustache');var util=require(_0x86c7('0x5'));var path=require(_0x86c7('0x6'));var sox=require('sox');var csv=require(_0x86c7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86c7('0x8'));var _=require(_0x86c7('0x9'));var squel=require(_0x86c7('0xa'));var crypto=require(_0x86c7('0xb'));var jsforce=require(_0x86c7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x86c7('0x7'));var querystring=require(_0x86c7('0xd'));var Papa=require(_0x86c7('0xe'));var Redis=require(_0x86c7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x86c7('0x10'));var as=require(_0x86c7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86c7('0x12'))(_0x86c7('0x13'));var utils=require(_0x86c7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x86c7('0x15'));var db=require(_0x86c7('0x16'))['db'];var integrations=require(_0x86c7('0x17'));function respondWithStatusCode(_0x3c5834,_0x234029){_0x234029=_0x234029||0xcc;return function(_0x544d9c){if(_0x544d9c){return _0x3c5834[_0x86c7('0x18')](_0x234029);}return _0x3c5834[_0x86c7('0x19')](_0x234029)[_0x86c7('0x1a')]();};}function respondWithResult(_0x33ad13,_0x82d831){_0x82d831=_0x82d831||0xc8;return function(_0x473d98){if(_0x473d98){return _0x33ad13[_0x86c7('0x19')](_0x82d831)[_0x86c7('0x1b')](_0x473d98);}};}function respondWithFilteredResult(_0x2e208e,_0xc87ed5){return function(_0xab59eb){if(_0xab59eb){var _0x1b29c8=typeof _0xc87ed5[_0x86c7('0x1c')]==='undefined'&&typeof _0xc87ed5[_0x86c7('0x1d')]==='undefined';var _0x341fa8=_0xab59eb[_0x86c7('0x1e')];var _0x27255d=_0x1b29c8?0x0:_0xc87ed5['offset'];var _0xdcbbed=_0x1b29c8?_0xab59eb[_0x86c7('0x1e')]:_0xc87ed5[_0x86c7('0x1c')]+_0xc87ed5['limit'];var _0x107e2e;if(_0xdcbbed>=_0x341fa8){_0xdcbbed=_0x341fa8;_0x107e2e=0xc8;}else{_0x107e2e=0xce;}_0x2e208e[_0x86c7('0x19')](_0x107e2e);return _0x2e208e[_0x86c7('0x1f')]('Content-Range',_0x27255d+'-'+_0xdcbbed+'/'+_0x341fa8)['json'](_0xab59eb);}return null;};}function patchUpdates(_0x170845){return function(_0x530027){try{jsonpatch[_0x86c7('0x20')](_0x530027,_0x170845,!![]);}catch(_0x1f8f7d){return BPromise['reject'](_0x1f8f7d);}return _0x530027['save']();};}function saveUpdates(_0x10f35,_0x43c274){return function(_0x2501b4){if(_0x2501b4){return _0x2501b4[_0x86c7('0x21')](_0x10f35)['then'](function(_0x1653c9){return _0x1653c9;});}return null;};}function removeEntity(_0x45be02,_0x2a8ec6){return function(_0x148016){if(_0x148016){return _0x148016[_0x86c7('0x22')]()['then'](function(){_0x45be02['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x477e9b,_0x3dbd7d){return function(_0x412c7f){if(!_0x412c7f){_0x477e9b['sendStatus'](0x194);}return _0x412c7f;};}function handleError(_0x37dc0d,_0x4da08c){_0x4da08c=_0x4da08c||0x1f4;return function(_0x40d463){logger[_0x86c7('0x23')](_0x40d463['stack']);if(_0x40d463[_0x86c7('0x24')]){delete _0x40d463['name'];}_0x37dc0d[_0x86c7('0x19')](_0x4da08c)[_0x86c7('0x25')](_0x40d463);};}exports[_0x86c7('0x26')]=function(_0x5477bb,_0x1fafc0){var _0x29c12e={},_0x5658a1={},_0x48d32d={'count':0x0,'rows':[]};var _0x2c4f90=_['map'](db[_0x86c7('0x27')][_0x86c7('0x28')],function(_0x517384){return{'name':_0x517384['fieldName'],'type':_0x517384['type'][_0x86c7('0x29')]};});_0x5658a1['model']=_[_0x86c7('0x2a')](_0x2c4f90,_0x86c7('0x24'));_0x5658a1[_0x86c7('0x2b')]=_['keys'](_0x5477bb[_0x86c7('0x2b')]);_0x5658a1[_0x86c7('0x2c')]=_['intersection'](_0x5658a1['model'],_0x5658a1[_0x86c7('0x2b')]);_0x29c12e[_0x86c7('0x2d')]=_[_0x86c7('0x2e')](_0x5658a1[_0x86c7('0x2f')],qs[_0x86c7('0x30')](_0x5477bb[_0x86c7('0x2b')]['fields']));_0x29c12e['attributes']=_0x29c12e[_0x86c7('0x2d')][_0x86c7('0x31')]?_0x29c12e[_0x86c7('0x2d')]:_0x5658a1[_0x86c7('0x2f')];if(!_0x5477bb['query'][_0x86c7('0x32')]('nolimit')){_0x29c12e['limit']=qs['limit'](_0x5477bb[_0x86c7('0x2b')][_0x86c7('0x1d')]);_0x29c12e[_0x86c7('0x1c')]=qs[_0x86c7('0x1c')](_0x5477bb['query'][_0x86c7('0x1c')]);}_0x29c12e[_0x86c7('0x33')]=qs[_0x86c7('0x34')](_0x5477bb['query'][_0x86c7('0x34')]);_0x29c12e[_0x86c7('0x35')]=qs[_0x86c7('0x2c')](_['pick'](_0x5477bb[_0x86c7('0x2b')],_0x5658a1[_0x86c7('0x2c')]),_0x2c4f90);if(_0x5477bb[_0x86c7('0x2b')][_0x86c7('0x36')]){_0x29c12e[_0x86c7('0x35')]=_[_0x86c7('0x37')](_0x29c12e['where'],{'$or':_[_0x86c7('0x2a')](_0x2c4f90,function(_0x4258b7){if(_0x4258b7[_0x86c7('0x38')]!==_0x86c7('0x39')){var _0x3c087b={};_0x3c087b[_0x4258b7[_0x86c7('0x24')]]={'$like':'%'+_0x5477bb['query'][_0x86c7('0x36')]+'%'};return _0x3c087b;}})});}_0x29c12e=_[_0x86c7('0x37')]({},_0x29c12e,_0x5477bb[_0x86c7('0x3a')]);var _0x34caa8={'where':_0x29c12e[_0x86c7('0x35')]};return db[_0x86c7('0x27')]['count'](_0x34caa8)['then'](function(_0x1294d6){_0x48d32d[_0x86c7('0x1e')]=_0x1294d6;if(_0x5477bb['query'][_0x86c7('0x3b')]){_0x29c12e[_0x86c7('0x3c')]=[{'all':!![]}];}return db[_0x86c7('0x27')][_0x86c7('0x3d')](_0x29c12e);})[_0x86c7('0x3e')](function(_0x2575f8){_0x48d32d[_0x86c7('0x3f')]=_0x2575f8;return _0x48d32d;})[_0x86c7('0x3e')](respondWithFilteredResult(_0x1fafc0,_0x29c12e))[_0x86c7('0x40')](handleError(_0x1fafc0,null));};exports[_0x86c7('0x41')]=function(_0x2280d8,_0x44075d){var _0x51a6db={'raw':![],'where':{'id':_0x2280d8[_0x86c7('0x42')]['id']}},_0x1fe04e={};_0x1fe04e[_0x86c7('0x2f')]=_[_0x86c7('0x43')](db['FreshsalesAccount'][_0x86c7('0x28')]);_0x1fe04e[_0x86c7('0x2b')]=_[_0x86c7('0x43')](_0x2280d8['query']);_0x1fe04e[_0x86c7('0x2c')]=_[_0x86c7('0x2e')](_0x1fe04e[_0x86c7('0x2f')],_0x1fe04e[_0x86c7('0x2b')]);_0x51a6db[_0x86c7('0x2d')]=_[_0x86c7('0x2e')](_0x1fe04e[_0x86c7('0x2f')],qs[_0x86c7('0x30')](_0x2280d8[_0x86c7('0x2b')]['fields']));_0x51a6db['attributes']=_0x51a6db[_0x86c7('0x2d')][_0x86c7('0x31')]?_0x51a6db[_0x86c7('0x2d')]:_0x1fe04e[_0x86c7('0x2f')];if(_0x2280d8[_0x86c7('0x2b')][_0x86c7('0x3b')]){_0x51a6db['include']=[{'all':!![]}];}_0x51a6db=_['merge']({},_0x51a6db,_0x2280d8[_0x86c7('0x3a')]);return db[_0x86c7('0x27')][_0x86c7('0x44')](_0x51a6db)[_0x86c7('0x3e')](handleEntityNotFound(_0x44075d,null))['then'](respondWithResult(_0x44075d,null))[_0x86c7('0x40')](handleError(_0x44075d,null));};exports['create']=function(_0x1ce54,_0x283536){return db['FreshsalesAccount'][_0x86c7('0x45')](_0x1ce54[_0x86c7('0x46')],{})[_0x86c7('0x3e')](respondWithResult(_0x283536,0xc9))[_0x86c7('0x40')](handleError(_0x283536,null));};exports['update']=function(_0x1972b0,_0x5a3d06){if(_0x1972b0['body']['id']){delete _0x1972b0[_0x86c7('0x46')]['id'];}return db[_0x86c7('0x27')]['find']({'where':{'id':_0x1972b0[_0x86c7('0x42')]['id']}})[_0x86c7('0x3e')](handleEntityNotFound(_0x5a3d06,null))[_0x86c7('0x3e')](saveUpdates(_0x1972b0[_0x86c7('0x46')],null))['then'](respondWithResult(_0x5a3d06,null))[_0x86c7('0x40')](handleError(_0x5a3d06,null));};exports[_0x86c7('0x22')]=function(_0x1645d4,_0x3ef66f){return db[_0x86c7('0x27')][_0x86c7('0x44')]({'where':{'id':_0x1645d4['params']['id']}})[_0x86c7('0x3e')](handleEntityNotFound(_0x3ef66f,null))[_0x86c7('0x3e')](removeEntity(_0x3ef66f,null))[_0x86c7('0x40')](handleError(_0x3ef66f,null));};exports['getConfigurations']=function(_0x50b961,_0x4aee81,_0x3aa8bf){var _0x15e3ef={};var _0x1aa7ca={};var _0x1a1fba;var _0x5acdb3;return db[_0x86c7('0x27')][_0x86c7('0x47')]({'where':{'id':_0x50b961[_0x86c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4aee81,null))[_0x86c7('0x3e')](function(_0x1d42da){if(_0x1d42da){_0x1a1fba=_0x1d42da;_0x1aa7ca[_0x86c7('0x2f')]=_['keys'](db[_0x86c7('0x48')][_0x86c7('0x28')]);_0x1aa7ca[_0x86c7('0x2b')]=_['keys'](_0x50b961[_0x86c7('0x2b')]);_0x1aa7ca['filters']=_[_0x86c7('0x2e')](_0x1aa7ca[_0x86c7('0x2f')],_0x1aa7ca[_0x86c7('0x2b')]);_0x15e3ef[_0x86c7('0x2d')]=_[_0x86c7('0x2e')](_0x1aa7ca[_0x86c7('0x2f')],qs[_0x86c7('0x30')](_0x50b961[_0x86c7('0x2b')][_0x86c7('0x30')]));_0x15e3ef[_0x86c7('0x2d')]=_0x15e3ef[_0x86c7('0x2d')][_0x86c7('0x31')]?_0x15e3ef[_0x86c7('0x2d')]:_0x1aa7ca['model'];_0x15e3ef[_0x86c7('0x33')]=qs['sort'](_0x50b961[_0x86c7('0x2b')]['sort']);_0x15e3ef[_0x86c7('0x35')]=qs[_0x86c7('0x2c')](_[_0x86c7('0x49')](_0x50b961[_0x86c7('0x2b')],_0x1aa7ca[_0x86c7('0x2c')]));if(_0x50b961[_0x86c7('0x2b')]['filter']){_0x15e3ef['where']=_[_0x86c7('0x37')](_0x15e3ef[_0x86c7('0x35')],{'$or':_['map'](_0x15e3ef['attributes'],function(_0x484f86){var _0x3c0148={};_0x3c0148[_0x484f86]={'$like':'%'+_0x50b961[_0x86c7('0x2b')]['filter']+'%'};return _0x3c0148;})});}_0x15e3ef=_[_0x86c7('0x37')]({},_0x15e3ef,_0x50b961[_0x86c7('0x3a')]);return _0x1a1fba[_0x86c7('0x4a')](_0x15e3ef);}})[_0x86c7('0x3e')](function(_0x55821e){if(_0x55821e){_0x5acdb3=_0x55821e[_0x86c7('0x31')];if(!_0x50b961[_0x86c7('0x2b')][_0x86c7('0x32')](_0x86c7('0x4b'))){_0x15e3ef[_0x86c7('0x1d')]=qs[_0x86c7('0x1d')](_0x50b961['query'][_0x86c7('0x1d')]);_0x15e3ef['offset']=qs[_0x86c7('0x1c')](_0x50b961['query'][_0x86c7('0x1c')]);}return _0x1a1fba[_0x86c7('0x4a')](_0x15e3ef);}})[_0x86c7('0x3e')](function(_0x4b6298){if(_0x4b6298){return _0x4b6298?{'count':_0x5acdb3,'rows':_0x4b6298}:null;}})[_0x86c7('0x3e')](respondWithResult(_0x4aee81,null))[_0x86c7('0x40')](handleError(_0x4aee81,null));};exports[_0x86c7('0x4c')]=function(_0x15ba08,_0x54ac2a,_0xab2bc8){if(_0x15ba08[_0x86c7('0x46')]['id']){delete _0x15ba08[_0x86c7('0x46')]['id'];}return db[_0x86c7('0x27')][_0x86c7('0x47')]({'where':{'id':_0x15ba08[_0x86c7('0x42')]['id']}})[_0x86c7('0x3e')](handleEntityNotFound(_0x54ac2a,null))[_0x86c7('0x3e')](function(_0x5499c7){if(_0x5499c7){_0x15ba08[_0x86c7('0x46')][_0x86c7('0x4d')]=_0x5499c7['id'];_0x15ba08[_0x86c7('0x46')]['Subjects']=integrations[_0x86c7('0x4e')](_0x15ba08[_0x86c7('0x46')]['channel'],_0x15ba08[_0x86c7('0x46')]['type']);_0x15ba08[_0x86c7('0x46')][_0x86c7('0x4f')]=integrations[_0x86c7('0x50')](_0x15ba08[_0x86c7('0x46')][_0x86c7('0x51')],_0x15ba08[_0x86c7('0x46')][_0x86c7('0x38')]);return db[_0x86c7('0x48')][_0x86c7('0x45')](_0x15ba08[_0x86c7('0x46')],{'include':[{'model':db['FreshsalesField'],'as':_0x86c7('0x52')},{'model':db[_0x86c7('0x53')],'as':'Descriptions'}]});}return null;})[_0x86c7('0x3e')](respondWithResult(_0x54ac2a,null))[_0x86c7('0x40')](handleError(_0x54ac2a,null));};exports[_0x86c7('0x54')]=function(_0x4c3ac1,_0x288af6,_0xf23219){var _0x3a1ce8='';var _0x23ce89='';return db[_0x86c7('0x27')]['findOne']({'where':{'id':_0x4c3ac1['params']['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x86c7('0x3e')](handleEntityNotFound(_0x288af6,null))[_0x86c7('0x3e')](function(_0x1017c6){if(_0x1017c6){_0x23ce89=_0x1017c6['username'];_0x3a1ce8=_0x1017c6[_0x86c7('0x55')];var _0x1acc98=_0x1017c6[_0x86c7('0x55')][_0x86c7('0x56')](-0x1);if(_0x1acc98==='/'){_0x3a1ce8=_0x3a1ce8[_0x86c7('0x57')](0x0,_0x3a1ce8[_0x86c7('0x58')](_0x1acc98));}return rp({'method':_0x86c7('0x59'),'uri':util['format'](_0x86c7('0x5a'),_0x3a1ce8,_0x86c7('0x5b')),'headers':{'Authorization':_0x86c7('0x5c')+_0x1017c6[_0x86c7('0x5d')]},'json':!![]});}})[_0x86c7('0x3e')](function(_0x37299e){if(_0x37299e){var _0x4c450=_0x37299e[_0x86c7('0x5e')];var _0x21bc4e=![];var _0x84b79b=null;for(_0x84b79b=0x0;_0x84b79b<_0x4c450['length'];_0x84b79b++){if(_0x4c450[_0x84b79b][_0x86c7('0x5f')]===_0x23ce89){_0x21bc4e=!![];}}if(_0x21bc4e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x86c7('0x60')});}}})[_0x86c7('0x3e')](respondWithResult(_0x288af6,null))[_0x86c7('0x40')](function(_0x5cd0e8){var _0x361059=_0x4c3ac1[_0x86c7('0x2b')][_0x86c7('0x61')]?0x1f4:_0x5cd0e8[_0x86c7('0x62')]||0x1f4;logger['error'](_0x86c7('0x63'),_0x86c7('0x54'),_0x361059,JSON[_0x86c7('0x64')](_0x5cd0e8));delete _0x5cd0e8[_0x86c7('0x24')];if(_0x361059===0x191){_0x361059=0x190;}_0x288af6[_0x86c7('0x19')](_0x361059)['send'](_0x4c3ac1[_0x86c7('0x2b')][_0x86c7('0x61')]?{'message':_0x86c7('0x65'),'statusCode':_0x5cd0e8[_0x86c7('0x62')]}:_0x5cd0e8);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 827ee12..7346ca8 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 _0x1893=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d2b66,_0x20c523){var _0x4f1c10=function(_0x3b41ef){while(--_0x3b41ef){_0x5d2b66['push'](_0x5d2b66['shift']());}};_0x4f1c10(++_0x20c523);}(_0x1893,0xa2));var _0x3189=function(_0x13f2b7,_0x224502){_0x13f2b7=_0x13f2b7-0x0;var _0x59c0d6=_0x1893[_0x13f2b7];return _0x59c0d6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));var integrations=require(_0x3189('0x8'));module[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return _0x4080a9[_0x3189('0xa')](_0x3189('0xb'),attributes,{'tableName':_0x3189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cc60e,_0x51f4f5){var _0x4474d7=function(_0x232f9a){while(--_0x232f9a){_0x4cc60e['push'](_0x4cc60e['shift']());}};_0x4474d7(++_0x51f4f5);}(_0x1893,0xa2));var _0x3189=function(_0x144049,_0x4e6ccf){_0x144049=_0x144049-0x0;var _0x517caa=_0x1893[_0x144049];return _0x517caa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));var integrations=require(_0x3189('0x8'));module[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return _0x4080a9[_0x3189('0xa')](_0x3189('0xb'),attributes,{'tableName':_0x3189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 2375169..9ae35e9 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 _0x81c6=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x585fbe,_0x369c77){var _0x5c3f3b=function(_0x4f3c31){while(--_0x4f3c31){_0x585fbe['push'](_0x585fbe['shift']());}};_0x5c3f3b(++_0x369c77);}(_0x81c6,0x1d5));var _0x681c=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x81c6[_0x44a64f];return _0x52024b;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['find']({'raw':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e783d[_0x681c('0x18')]?_0x2e783d[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x2e783d['options']?_0x2e783d[_0x681c('0x18')]['attributes']||null:null,'include':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['include']?_['map'](_0x2e783d[_0x681c('0x18')][_0x681c('0x1b')],function(_0x5a349a){return{'model':db[_0x5a349a[_0x681c('0x1d')]],'as':_0x5a349a['as'],'attributes':_0x5a349a['attributes'],'include':_0x5a349a['include']?_[_0x681c('0x1c')](_0x5a349a['include'],function(_0x35991d){return{'model':db[_0x35991d[_0x681c('0x1d')]],'as':_0x35991d['as'],'attributes':_0x35991d[_0x681c('0x1e')],'include':_0x35991d['include']?_['map'](_0x35991d[_0x681c('0x1b')],function(_0x4545ff){return{'model':db[_0x4545ff['model']],'as':_0x4545ff['as'],'attributes':_0x4545ff[_0x681c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x302dab){logger['info'](_0x681c('0x1f'),_0x2e783d);logger[_0x681c('0xb')]('ShowFreshsalesAccount',_0x2e783d,JSON[_0x681c('0xe')](_0x302dab));_0x385b14(_0x302dab);})[_0x681c('0x14')](function(_0x83953c){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x83953c['message'],_0x2e783d);_0x2179cd(_0x4af6aa['error'](0x1f4,_0x83953c[_0x681c('0x11')]));});});}; \ No newline at end of file +var _0x25e7=['find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x25e7,0x1d6));var _0x725e=function(_0x32b8a9,_0x59d62b){_0x32b8a9=_0x32b8a9-0x0;var _0x40105c=_0x25e7[_0x32b8a9];return _0x40105c;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')]({'raw':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x397e33[_0x725e('0x19')]?_0x397e33['options'][_0x725e('0x1b')]||null:null,'attributes':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1c')]||null:null,'limit':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')][_0x725e('0x1d')]||null:null,'include':_0x397e33[_0x725e('0x19')]?_0x397e33[_0x725e('0x19')]['include']?_[_0x725e('0x1e')](_0x397e33[_0x725e('0x19')][_0x725e('0x1f')],function(_0x3facae){return{'model':db[_0x3facae['model']],'as':_0x3facae['as'],'attributes':_0x3facae[_0x725e('0x1c')],'include':_0x3facae['include']?_['map'](_0x3facae['include'],function(_0x2aad7b){return{'model':db[_0x2aad7b[_0x725e('0x20')]],'as':_0x2aad7b['as'],'attributes':_0x2aad7b[_0x725e('0x1c')],'include':_0x2aad7b['include']?_[_0x725e('0x1e')](_0x2aad7b[_0x725e('0x1f')],function(_0x5a5bef){return{'model':db[_0x5a5bef[_0x725e('0x20')]],'as':_0x5a5bef['as'],'attributes':_0x5a5bef[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x378ace){logger['info']('GetFreshsalesAccount',_0x397e33);logger[_0x725e('0x10')]('GetFreshsalesAccount',_0x397e33,JSON[_0x725e('0x21')](_0x378ace));_0x2811e7(_0x378ace);})['catch'](function(_0x4de2e0){logger[_0x725e('0x12')](_0x725e('0x16'),_0x4de2e0[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438['error'](0x1f4,_0x4de2e0[_0x725e('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x85d29c){var _0x1ce9c8=this;return new Promise(function(_0x39932f,_0x28951f){return db[_0x725e('0x17')][_0x725e('0x22')]({'raw':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')][_0x725e('0x1a')]===undefined?!![]:![]:!![],'where':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['where']||null:null,'attributes':_0x85d29c[_0x725e('0x19')]?_0x85d29c[_0x725e('0x19')]['attributes']||null:null,'include':_0x85d29c[_0x725e('0x19')]?_0x85d29c['options'][_0x725e('0x1f')]?_['map'](_0x85d29c[_0x725e('0x19')][_0x725e('0x1f')],function(_0x1f2898){return{'model':db[_0x1f2898[_0x725e('0x20')]],'as':_0x1f2898['as'],'attributes':_0x1f2898[_0x725e('0x1c')],'include':_0x1f2898[_0x725e('0x1f')]?_['map'](_0x1f2898['include'],function(_0x35e5e7){return{'model':db[_0x35e5e7[_0x725e('0x20')]],'as':_0x35e5e7['as'],'attributes':_0x35e5e7[_0x725e('0x1c')],'include':_0x35e5e7['include']?_[_0x725e('0x1e')](_0x35e5e7['include'],function(_0x3ce327){return{'model':db[_0x3ce327[_0x725e('0x20')]],'as':_0x3ce327['as'],'attributes':_0x3ce327[_0x725e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x725e('0xc')](function(_0x4f15f3){logger['info'](_0x725e('0x23'),_0x85d29c);logger[_0x725e('0x10')](_0x725e('0x23'),_0x85d29c,JSON['stringify'](_0x4f15f3));_0x39932f(_0x4f15f3);})[_0x725e('0x15')](function(_0xec3b9d){logger[_0x725e('0x12')]('ShowFreshsalesAccount',_0xec3b9d[_0x725e('0x13')],_0x85d29c);_0x28951f(_0x1ce9c8['error'](0x1f4,_0xec3b9d[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8dbc286..5c538d0 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 _0xeabc=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','/:id','update','delete'];(function(_0x4fed5b,_0x47ebcd){var _0x438c2e=function(_0x2d2b9d){while(--_0x2d2b9d){_0x4fed5b['push'](_0x4fed5b['shift']());}};_0x438c2e(++_0x47ebcd);}(_0xeabc,0x9a));var _0xceab=function(_0x1b3da8,_0x474a4c){_0x1b3da8=_0x1b3da8-0x0;var _0x2fabfb=_0xeabc[_0x1b3da8];return _0x2fabfb;};'use strict';var multer=require(_0xceab('0x0'));var util=require(_0xceab('0x1'));var path=require('path');var timeout=require(_0xceab('0x2'));var express=require('express');var router=express[_0xceab('0x3')]();var fs_extra=require(_0xceab('0x4'));var auth=require(_0xceab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xceab('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xceab('0x7')]('/',auth[_0xceab('0x8')](),controller[_0xceab('0x9')]);router[_0xceab('0x7')]('/:id',auth[_0xceab('0x8')](),controller[_0xceab('0xa')]);router[_0xceab('0x7')](_0xceab('0xb'),auth['isAuthenticated'](),controller[_0xceab('0xc')]);router[_0xceab('0x7')](_0xceab('0xd'),auth['isAuthenticated'](),controller[_0xceab('0xe')]);router[_0xceab('0x7')](_0xceab('0xf'),auth[_0xceab('0x8')](),controller[_0xceab('0x10')]);router[_0xceab('0x11')]('/',auth[_0xceab('0x8')](),controller[_0xceab('0x12')]);router['put'](_0xceab('0x13'),auth[_0xceab('0x8')](),controller[_0xceab('0x14')]);router[_0xceab('0x15')](_0xceab('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcf6c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer'];(function(_0x47fcf6,_0x241b28){var _0x3f5b42=function(_0x32e64f){while(--_0x32e64f){_0x47fcf6['push'](_0x47fcf6['shift']());}};_0x3f5b42(++_0x241b28);}(_0xcf6c,0x133));var _0xccf6=function(_0x59ac27,_0x202e0e){_0x59ac27=_0x59ac27-0x0;var _0x4ed9b3=_0xcf6c[_0x59ac27];return _0x4ed9b3;};'use strict';var multer=require(_0xccf6('0x0'));var util=require(_0xccf6('0x1'));var path=require(_0xccf6('0x2'));var timeout=require(_0xccf6('0x3'));var express=require(_0xccf6('0x4'));var router=express[_0xccf6('0x5')]();var fs_extra=require(_0xccf6('0x6'));var auth=require(_0xccf6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xccf6('0x8'));var controller=require(_0xccf6('0x9'));router[_0xccf6('0xa')]('/',auth[_0xccf6('0xb')](),controller['index']);router[_0xccf6('0xa')]('/:id',auth[_0xccf6('0xb')](),controller['show']);router[_0xccf6('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xccf6('0xc')]);router['get'](_0xccf6('0xd'),auth[_0xccf6('0xb')](),controller['getDescriptions']);router[_0xccf6('0xa')](_0xccf6('0xe'),auth[_0xccf6('0xb')](),controller[_0xccf6('0xf')]);router[_0xccf6('0x10')]('/',auth[_0xccf6('0xb')](),controller[_0xccf6('0x11')]);router[_0xccf6('0x12')](_0xccf6('0x13'),auth[_0xccf6('0xb')](),controller[_0xccf6('0x14')]);router['delete'](_0xccf6('0x13'),auth[_0xccf6('0xb')](),controller[_0xccf6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 97296c7..ee09400 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 _0x7c85=['STRING','sequelize'];(function(_0x5cdde3,_0x9789ce){var _0x53619d=function(_0x418e43){while(--_0x418e43){_0x5cdde3['push'](_0x5cdde3['shift']());}};_0x53619d(++_0x9789ce);}(_0x7c85,0x1cf));var _0x57c8=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x7c85[_0xa8b370];return _0x643e37;};'use strict';var Sequelize=require(_0x57c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x57c8('0x1')]},'description':{'type':Sequelize[_0x57c8('0x1')]}}; \ No newline at end of file +var _0x5c33=['sequelize','exports','STRING'];(function(_0x3d29ab,_0x121616){var _0x10108e=function(_0x1d25e6){while(--_0x1d25e6){_0x3d29ab['push'](_0x3d29ab['shift']());}};_0x10108e(++_0x121616);}(_0x5c33,0x156));var _0x35c3=function(_0x1afeb1,_0x4ef5e7){_0x1afeb1=_0x1afeb1-0x0;var _0x397155=_0x5c33[_0x1afeb1];return _0x397155;};'use strict';var Sequelize=require(_0x35c3('0x0'));module[_0x35c3('0x1')]={'name':{'type':Sequelize[_0x35c3('0x2')]},'description':{'type':Sequelize[_0x35c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ad2f354..1868b83 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 _0x7908=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesConfiguration','findAll','rows','catch','params','find','create','body','destroy','FreshsalesField','getSubjects','getDescriptions','getFields','findOne','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','Content-Range','save','update','then','error','stack','name','send','index','map','rawAttributes'];(function(_0x37b08d,_0x2d9301){var _0x35c6dd=function(_0x576d38){while(--_0x576d38){_0x37b08d['push'](_0x37b08d['shift']());}};_0x35c6dd(++_0x2d9301);}(_0x7908,0x1a1));var _0x8790=function(_0x1a0405,_0x36cb81){_0x1a0405=_0x1a0405-0x0;var _0x220911=_0x7908[_0x1a0405];return _0x220911;};'use strict';var emlformat=require(_0x8790('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8790('0x1'));var moment=require(_0x8790('0x2'));var BPromise=require(_0x8790('0x3'));var Mustache=require(_0x8790('0x4'));var util=require('util');var path=require(_0x8790('0x5'));var sox=require(_0x8790('0x6'));var csv=require(_0x8790('0x7'));var ejs=require(_0x8790('0x8'));var fs=require('fs');var fs_extra=require(_0x8790('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8790('0xa'));var jsforce=require(_0x8790('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8790('0x7'));var querystring=require(_0x8790('0xc'));var Papa=require(_0x8790('0xd'));var Redis=require(_0x8790('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8790('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8790('0x10'));var utils=require(_0x8790('0x11'));var config=require(_0x8790('0x12'));var licenseUtil=require(_0x8790('0x13'));var db=require(_0x8790('0x14'))['db'];function respondWithStatusCode(_0x2af20e,_0x2a5a8e){_0x2a5a8e=_0x2a5a8e||0xcc;return function(_0x177a63){if(_0x177a63){return _0x2af20e[_0x8790('0x15')](_0x2a5a8e);}return _0x2af20e['status'](_0x2a5a8e)[_0x8790('0x16')]();};}function respondWithResult(_0x5a8f0c,_0x3eba85){_0x3eba85=_0x3eba85||0xc8;return function(_0xce2e85){if(_0xce2e85){return _0x5a8f0c[_0x8790('0x17')](_0x3eba85)['json'](_0xce2e85);}};}function respondWithFilteredResult(_0x245dc1,_0xba1ca1){return function(_0x81a844){if(_0x81a844){var _0x463555=typeof _0xba1ca1['offset']==='undefined'&&typeof _0xba1ca1[_0x8790('0x18')]===_0x8790('0x19');var _0x10db38=_0x81a844['count'];var _0x58b8a1=_0x463555?0x0:_0xba1ca1[_0x8790('0x1a')];var _0x18bf0f=_0x463555?_0x81a844[_0x8790('0x1b')]:_0xba1ca1[_0x8790('0x1a')]+_0xba1ca1['limit'];var _0x3a8e7d;if(_0x18bf0f>=_0x10db38){_0x18bf0f=_0x10db38;_0x3a8e7d=0xc8;}else{_0x3a8e7d=0xce;}_0x245dc1[_0x8790('0x17')](_0x3a8e7d);return _0x245dc1['set'](_0x8790('0x1c'),_0x58b8a1+'-'+_0x18bf0f+'/'+_0x10db38)['json'](_0x81a844);}return null;};}function patchUpdates(_0x23f67c){return function(_0x2b8270){try{jsonpatch['apply'](_0x2b8270,_0x23f67c,!![]);}catch(_0x57fb91){return BPromise['reject'](_0x57fb91);}return _0x2b8270[_0x8790('0x1d')]();};}function saveUpdates(_0x2afc32,_0x1b875d){return function(_0x3ae4a7){if(_0x3ae4a7){return _0x3ae4a7[_0x8790('0x1e')](_0x2afc32)[_0x8790('0x1f')](function(_0x3ce5b3){return _0x3ce5b3;});}return null;};}function removeEntity(_0x375c57,_0x3d60af){return function(_0x5738e4){if(_0x5738e4){return _0x5738e4['destroy']()[_0x8790('0x1f')](function(){_0x375c57[_0x8790('0x17')](0xcc)[_0x8790('0x16')]();});}};}function handleEntityNotFound(_0x4fb9a8,_0x2de1f1){return function(_0x5e1c20){if(!_0x5e1c20){_0x4fb9a8[_0x8790('0x15')](0x194);}return _0x5e1c20;};}function handleError(_0x537e90,_0x31d428){_0x31d428=_0x31d428||0x1f4;return function(_0x4d3516){logger[_0x8790('0x20')](_0x4d3516[_0x8790('0x21')]);if(_0x4d3516['name']){delete _0x4d3516[_0x8790('0x22')];}_0x537e90[_0x8790('0x17')](_0x31d428)[_0x8790('0x23')](_0x4d3516);};}exports[_0x8790('0x24')]=function(_0x26e611,_0x28a25f){var _0x530d40={},_0x5c96d8={},_0x5441e3={'count':0x0,'rows':[]};var _0xa5f1bc=_[_0x8790('0x25')](db['FreshsalesConfiguration'][_0x8790('0x26')],function(_0x49b091){return{'name':_0x49b091[_0x8790('0x27')],'type':_0x49b091[_0x8790('0x28')][_0x8790('0x29')]};});_0x5c96d8['model']=_[_0x8790('0x25')](_0xa5f1bc,_0x8790('0x22'));_0x5c96d8[_0x8790('0x2a')]=_[_0x8790('0x2b')](_0x26e611[_0x8790('0x2a')]);_0x5c96d8[_0x8790('0x2c')]=_[_0x8790('0x2d')](_0x5c96d8[_0x8790('0x2e')],_0x5c96d8['query']);_0x530d40[_0x8790('0x2f')]=_[_0x8790('0x2d')](_0x5c96d8[_0x8790('0x2e')],qs[_0x8790('0x30')](_0x26e611['query'][_0x8790('0x30')]));_0x530d40['attributes']=_0x530d40['attributes'][_0x8790('0x31')]?_0x530d40[_0x8790('0x2f')]:_0x5c96d8[_0x8790('0x2e')];if(!_0x26e611[_0x8790('0x2a')][_0x8790('0x32')](_0x8790('0x33'))){_0x530d40[_0x8790('0x18')]=qs['limit'](_0x26e611[_0x8790('0x2a')][_0x8790('0x18')]);_0x530d40[_0x8790('0x1a')]=qs[_0x8790('0x1a')](_0x26e611[_0x8790('0x2a')][_0x8790('0x1a')]);}_0x530d40[_0x8790('0x34')]=qs[_0x8790('0x35')](_0x26e611[_0x8790('0x2a')][_0x8790('0x35')]);_0x530d40[_0x8790('0x36')]=qs['filters'](_[_0x8790('0x37')](_0x26e611[_0x8790('0x2a')],_0x5c96d8[_0x8790('0x2c')]),_0xa5f1bc);if(_0x26e611[_0x8790('0x2a')][_0x8790('0x38')]){_0x530d40[_0x8790('0x36')]=_[_0x8790('0x39')](_0x530d40[_0x8790('0x36')],{'$or':_['map'](_0xa5f1bc,function(_0xc32181){if(_0xc32181[_0x8790('0x28')]!==_0x8790('0x3a')){var _0x75dc5a={};_0x75dc5a[_0xc32181['name']]={'$like':'%'+_0x26e611[_0x8790('0x2a')][_0x8790('0x38')]+'%'};return _0x75dc5a;}})});}_0x530d40=_['merge']({},_0x530d40,_0x26e611[_0x8790('0x3b')]);var _0x2a6c52={'where':_0x530d40[_0x8790('0x36')]};return db['FreshsalesConfiguration'][_0x8790('0x1b')](_0x2a6c52)[_0x8790('0x1f')](function(_0x4f4d77){_0x5441e3[_0x8790('0x1b')]=_0x4f4d77;if(_0x26e611['query'][_0x8790('0x3c')]){_0x530d40[_0x8790('0x3d')]=[{'all':!![]}];}return db[_0x8790('0x3e')][_0x8790('0x3f')](_0x530d40);})[_0x8790('0x1f')](function(_0x335bef){_0x5441e3[_0x8790('0x40')]=_0x335bef;return _0x5441e3;})['then'](respondWithFilteredResult(_0x28a25f,_0x530d40))[_0x8790('0x41')](handleError(_0x28a25f,null));};exports['show']=function(_0xaabba3,_0x24b3b7){var _0x535ae8={'raw':![],'where':{'id':_0xaabba3[_0x8790('0x42')]['id']}},_0x2d16ba={};_0x2d16ba[_0x8790('0x2e')]=_[_0x8790('0x2b')](db[_0x8790('0x3e')][_0x8790('0x26')]);_0x2d16ba[_0x8790('0x2a')]=_['keys'](_0xaabba3[_0x8790('0x2a')]);_0x2d16ba['filters']=_[_0x8790('0x2d')](_0x2d16ba['model'],_0x2d16ba[_0x8790('0x2a')]);_0x535ae8[_0x8790('0x2f')]=_[_0x8790('0x2d')](_0x2d16ba[_0x8790('0x2e')],qs[_0x8790('0x30')](_0xaabba3['query']['fields']));_0x535ae8[_0x8790('0x2f')]=_0x535ae8[_0x8790('0x2f')][_0x8790('0x31')]?_0x535ae8[_0x8790('0x2f')]:_0x2d16ba[_0x8790('0x2e')];if(_0xaabba3[_0x8790('0x2a')][_0x8790('0x3c')]){_0x535ae8[_0x8790('0x3d')]=[{'all':!![]}];}_0x535ae8=_[_0x8790('0x39')]({},_0x535ae8,_0xaabba3['options']);return db[_0x8790('0x3e')][_0x8790('0x43')](_0x535ae8)[_0x8790('0x1f')](handleEntityNotFound(_0x24b3b7,null))[_0x8790('0x1f')](respondWithResult(_0x24b3b7,null))[_0x8790('0x41')](handleError(_0x24b3b7,null));};exports[_0x8790('0x44')]=function(_0x2a2976,_0x1bc823){return db[_0x8790('0x3e')][_0x8790('0x44')](_0x2a2976[_0x8790('0x45')],{})[_0x8790('0x1f')](respondWithResult(_0x1bc823,0xc9))[_0x8790('0x41')](handleError(_0x1bc823,null));};exports['update']=function(_0x5e47ae,_0x485819){if(_0x5e47ae[_0x8790('0x45')]['id']){delete _0x5e47ae[_0x8790('0x45')]['id'];}return db[_0x8790('0x3e')]['find']({'where':{'id':_0x5e47ae[_0x8790('0x42')]['id']}})[_0x8790('0x1f')](handleEntityNotFound(_0x485819,null))[_0x8790('0x1f')](saveUpdates(_0x5e47ae[_0x8790('0x45')],null))[_0x8790('0x1f')](respondWithResult(_0x485819,null))['catch'](handleError(_0x485819,null));};exports[_0x8790('0x46')]=function(_0x35799d,_0xd4af4b){return db[_0x8790('0x3e')]['find']({'where':{'id':_0x35799d[_0x8790('0x42')]['id']}})[_0x8790('0x1f')](handleEntityNotFound(_0xd4af4b,null))['then'](removeEntity(_0xd4af4b,null))[_0x8790('0x41')](handleError(_0xd4af4b,null));};exports['getSubjects']=function(_0x1198c9,_0x31e552,_0x41a279){var _0xc7dc5e={};var _0x398609={};var _0x295892;var _0x1c806d;return db[_0x8790('0x3e')]['findOne']({'where':{'id':_0x1198c9[_0x8790('0x42')]['id']}})[_0x8790('0x1f')](handleEntityNotFound(_0x31e552,null))[_0x8790('0x1f')](function(_0x5af6cb){if(_0x5af6cb){_0x295892=_0x5af6cb;_0x398609['model']=_[_0x8790('0x2b')](db[_0x8790('0x47')][_0x8790('0x26')]);_0x398609[_0x8790('0x2a')]=_['keys'](_0x1198c9['query']);_0x398609[_0x8790('0x2c')]=_['intersection'](_0x398609[_0x8790('0x2e')],_0x398609[_0x8790('0x2a')]);_0xc7dc5e['attributes']=_['intersection'](_0x398609[_0x8790('0x2e')],qs['fields'](_0x1198c9[_0x8790('0x2a')][_0x8790('0x30')]));_0xc7dc5e[_0x8790('0x2f')]=_0xc7dc5e[_0x8790('0x2f')][_0x8790('0x31')]?_0xc7dc5e['attributes']:_0x398609[_0x8790('0x2e')];_0xc7dc5e[_0x8790('0x34')]=qs[_0x8790('0x35')](_0x1198c9[_0x8790('0x2a')][_0x8790('0x35')]);_0xc7dc5e['where']=qs[_0x8790('0x2c')](_[_0x8790('0x37')](_0x1198c9[_0x8790('0x2a')],_0x398609[_0x8790('0x2c')]));if(_0x1198c9[_0x8790('0x2a')][_0x8790('0x38')]){_0xc7dc5e[_0x8790('0x36')]=_['merge'](_0xc7dc5e[_0x8790('0x36')],{'$or':_[_0x8790('0x25')](_0xc7dc5e[_0x8790('0x2f')],function(_0x462ee9){var _0xa15c8={};_0xa15c8[_0x462ee9]={'$like':'%'+_0x1198c9[_0x8790('0x2a')]['filter']+'%'};return _0xa15c8;})});}_0xc7dc5e=_[_0x8790('0x39')]({},_0xc7dc5e,_0x1198c9['options']);return _0x295892[_0x8790('0x48')](_0xc7dc5e);}})['then'](function(_0x300b0c){if(_0x300b0c){_0x1c806d=_0x300b0c[_0x8790('0x31')];if(!_0x1198c9[_0x8790('0x2a')][_0x8790('0x32')]('nolimit')){_0xc7dc5e['limit']=qs[_0x8790('0x18')](_0x1198c9[_0x8790('0x2a')][_0x8790('0x18')]);_0xc7dc5e[_0x8790('0x1a')]=qs[_0x8790('0x1a')](_0x1198c9[_0x8790('0x2a')]['offset']);}return _0x295892[_0x8790('0x48')](_0xc7dc5e);}})[_0x8790('0x1f')](function(_0x534c4d){if(_0x534c4d){return _0x534c4d?{'count':_0x1c806d,'rows':_0x534c4d}:null;}})[_0x8790('0x1f')](respondWithResult(_0x31e552,null))[_0x8790('0x41')](handleError(_0x31e552,null));};exports[_0x8790('0x49')]=function(_0x34720f,_0x207e1b,_0x23a66b){var _0x375bd6={};var _0x32faa8={};var _0x3da851;var _0x174960;return db[_0x8790('0x3e')]['findOne']({'where':{'id':_0x34720f[_0x8790('0x42')]['id']}})['then'](handleEntityNotFound(_0x207e1b,null))[_0x8790('0x1f')](function(_0x2a5819){if(_0x2a5819){_0x3da851=_0x2a5819;_0x32faa8[_0x8790('0x2e')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x32faa8[_0x8790('0x2a')]=_[_0x8790('0x2b')](_0x34720f[_0x8790('0x2a')]);_0x32faa8['filters']=_[_0x8790('0x2d')](_0x32faa8[_0x8790('0x2e')],_0x32faa8[_0x8790('0x2a')]);_0x375bd6[_0x8790('0x2f')]=_[_0x8790('0x2d')](_0x32faa8[_0x8790('0x2e')],qs['fields'](_0x34720f[_0x8790('0x2a')][_0x8790('0x30')]));_0x375bd6[_0x8790('0x2f')]=_0x375bd6['attributes']['length']?_0x375bd6['attributes']:_0x32faa8['model'];_0x375bd6[_0x8790('0x34')]=qs[_0x8790('0x35')](_0x34720f[_0x8790('0x2a')][_0x8790('0x35')]);_0x375bd6[_0x8790('0x36')]=qs[_0x8790('0x2c')](_[_0x8790('0x37')](_0x34720f['query'],_0x32faa8[_0x8790('0x2c')]));if(_0x34720f[_0x8790('0x2a')][_0x8790('0x38')]){_0x375bd6[_0x8790('0x36')]=_[_0x8790('0x39')](_0x375bd6[_0x8790('0x36')],{'$or':_['map'](_0x375bd6[_0x8790('0x2f')],function(_0x126fb1){var _0x2765fe={};_0x2765fe[_0x126fb1]={'$like':'%'+_0x34720f['query']['filter']+'%'};return _0x2765fe;})});}_0x375bd6=_['merge']({},_0x375bd6,_0x34720f[_0x8790('0x3b')]);return _0x3da851['getDescriptions'](_0x375bd6);}})[_0x8790('0x1f')](function(_0x408635){if(_0x408635){_0x174960=_0x408635['length'];if(!_0x34720f[_0x8790('0x2a')][_0x8790('0x32')](_0x8790('0x33'))){_0x375bd6[_0x8790('0x18')]=qs[_0x8790('0x18')](_0x34720f[_0x8790('0x2a')][_0x8790('0x18')]);_0x375bd6['offset']=qs[_0x8790('0x1a')](_0x34720f[_0x8790('0x2a')][_0x8790('0x1a')]);}return _0x3da851[_0x8790('0x49')](_0x375bd6);}})[_0x8790('0x1f')](function(_0x3ee02a){if(_0x3ee02a){return _0x3ee02a?{'count':_0x174960,'rows':_0x3ee02a}:null;}})[_0x8790('0x1f')](respondWithResult(_0x207e1b,null))[_0x8790('0x41')](handleError(_0x207e1b,null));};exports[_0x8790('0x4a')]=function(_0x3af22b,_0x44eb3f,_0x5cf578){var _0x271075={};var _0xec9c09={};var _0xf8b5f6;var _0x2bf492;return db[_0x8790('0x3e')][_0x8790('0x4b')]({'where':{'id':_0x3af22b[_0x8790('0x42')]['id']}})[_0x8790('0x1f')](handleEntityNotFound(_0x44eb3f,null))['then'](function(_0x344c96){if(_0x344c96){_0xf8b5f6=_0x344c96;_0xec9c09['model']=_[_0x8790('0x2b')](db[_0x8790('0x47')][_0x8790('0x26')]);_0xec9c09['query']=_[_0x8790('0x2b')](_0x3af22b[_0x8790('0x2a')]);_0xec9c09['filters']=_['intersection'](_0xec9c09['model'],_0xec9c09[_0x8790('0x2a')]);_0x271075['attributes']=_[_0x8790('0x2d')](_0xec9c09[_0x8790('0x2e')],qs[_0x8790('0x30')](_0x3af22b[_0x8790('0x2a')]['fields']));_0x271075[_0x8790('0x2f')]=_0x271075[_0x8790('0x2f')]['length']?_0x271075[_0x8790('0x2f')]:_0xec9c09[_0x8790('0x2e')];_0x271075[_0x8790('0x34')]=qs['sort'](_0x3af22b[_0x8790('0x2a')][_0x8790('0x35')]);_0x271075['where']=qs['filters'](_[_0x8790('0x37')](_0x3af22b[_0x8790('0x2a')],_0xec9c09[_0x8790('0x2c')]));if(_0x3af22b[_0x8790('0x2a')][_0x8790('0x38')]){_0x271075[_0x8790('0x36')]=_[_0x8790('0x39')](_0x271075[_0x8790('0x36')],{'$or':_[_0x8790('0x25')](_0x271075[_0x8790('0x2f')],function(_0x49cded){var _0x34a9de={};_0x34a9de[_0x49cded]={'$like':'%'+_0x3af22b[_0x8790('0x2a')][_0x8790('0x38')]+'%'};return _0x34a9de;})});}_0x271075=_[_0x8790('0x39')]({},_0x271075,_0x3af22b[_0x8790('0x3b')]);return _0xf8b5f6[_0x8790('0x4a')](_0x271075);}})[_0x8790('0x1f')](function(_0x5520e6){if(_0x5520e6){_0x2bf492=_0x5520e6[_0x8790('0x31')];if(!_0x3af22b[_0x8790('0x2a')][_0x8790('0x32')](_0x8790('0x33'))){_0x271075[_0x8790('0x18')]=qs['limit'](_0x3af22b[_0x8790('0x2a')][_0x8790('0x18')]);_0x271075[_0x8790('0x1a')]=qs['offset'](_0x3af22b[_0x8790('0x2a')][_0x8790('0x1a')]);}return _0xf8b5f6[_0x8790('0x4a')](_0x271075);}})['then'](function(_0x49d8c0){if(_0x49d8c0){return _0x49d8c0?{'count':_0x2bf492,'rows':_0x49d8c0}:null;}})[_0x8790('0x1f')](respondWithResult(_0x44eb3f,null))[_0x8790('0x41')](handleError(_0x44eb3f,null));}; \ No newline at end of file +var _0x8a17=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','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','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','findOne','FreshsalesField','getSubjects','nolimit','getDescriptions','getFields'];(function(_0x4976eb,_0x1b736a){var _0x39429b=function(_0x366c7b){while(--_0x366c7b){_0x4976eb['push'](_0x4976eb['shift']());}};_0x39429b(++_0x1b736a);}(_0x8a17,0x1f2));var _0x78a1=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x8a17[_0x3f00ee];return _0x18a07e;};'use strict';var emlformat=require(_0x78a1('0x0'));var rimraf=require(_0x78a1('0x1'));var zipdir=require(_0x78a1('0x2'));var jsonpatch=require(_0x78a1('0x3'));var rp=require(_0x78a1('0x4'));var moment=require(_0x78a1('0x5'));var BPromise=require(_0x78a1('0x6'));var Mustache=require(_0x78a1('0x7'));var util=require('util');var path=require(_0x78a1('0x8'));var sox=require(_0x78a1('0x9'));var csv=require(_0x78a1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78a1('0xb'));var _=require(_0x78a1('0xc'));var squel=require(_0x78a1('0xd'));var crypto=require(_0x78a1('0xe'));var jsforce=require(_0x78a1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x78a1('0xa'));var querystring=require(_0x78a1('0x10'));var Papa=require(_0x78a1('0x11'));var Redis=require(_0x78a1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x78a1('0x13'));var as=require(_0x78a1('0x14'));var hardwareService=require(_0x78a1('0x15'));var logger=require(_0x78a1('0x16'))(_0x78a1('0x17'));var utils=require(_0x78a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x78a1('0x19'));var db=require(_0x78a1('0x1a'))['db'];function respondWithStatusCode(_0x5a01ce,_0x34dd5d){_0x34dd5d=_0x34dd5d||0xcc;return function(_0x4f62cd){if(_0x4f62cd){return _0x5a01ce[_0x78a1('0x1b')](_0x34dd5d);}return _0x5a01ce[_0x78a1('0x1c')](_0x34dd5d)[_0x78a1('0x1d')]();};}function respondWithResult(_0x2413be,_0x4d9962){_0x4d9962=_0x4d9962||0xc8;return function(_0x120a6c){if(_0x120a6c){return _0x2413be[_0x78a1('0x1c')](_0x4d9962)[_0x78a1('0x1e')](_0x120a6c);}};}function respondWithFilteredResult(_0x5e0411,_0x53f38a){return function(_0x24f707){if(_0x24f707){var _0x56e4e0=typeof _0x53f38a['offset']===_0x78a1('0x1f')&&typeof _0x53f38a[_0x78a1('0x20')]===_0x78a1('0x1f');var _0x22fe20=_0x24f707[_0x78a1('0x21')];var _0x40e45a=_0x56e4e0?0x0:_0x53f38a[_0x78a1('0x22')];var _0x37d5de=_0x56e4e0?_0x24f707[_0x78a1('0x21')]:_0x53f38a['offset']+_0x53f38a[_0x78a1('0x20')];var _0x309c21;if(_0x37d5de>=_0x22fe20){_0x37d5de=_0x22fe20;_0x309c21=0xc8;}else{_0x309c21=0xce;}_0x5e0411['status'](_0x309c21);return _0x5e0411[_0x78a1('0x23')](_0x78a1('0x24'),_0x40e45a+'-'+_0x37d5de+'/'+_0x22fe20)[_0x78a1('0x1e')](_0x24f707);}return null;};}function patchUpdates(_0x4ae523){return function(_0x869c64){try{jsonpatch[_0x78a1('0x25')](_0x869c64,_0x4ae523,!![]);}catch(_0x5a4a58){return BPromise['reject'](_0x5a4a58);}return _0x869c64[_0x78a1('0x26')]();};}function saveUpdates(_0x3bf37c,_0x3fa737){return function(_0x1e75d6){if(_0x1e75d6){return _0x1e75d6[_0x78a1('0x27')](_0x3bf37c)['then'](function(_0x19722c){return _0x19722c;});}return null;};}function removeEntity(_0x3a7685,_0x27035d){return function(_0x14aefa){if(_0x14aefa){return _0x14aefa[_0x78a1('0x28')]()[_0x78a1('0x29')](function(){_0x3a7685[_0x78a1('0x1c')](0xcc)[_0x78a1('0x1d')]();});}};}function handleEntityNotFound(_0x40c7b9,_0x20bbdd){return function(_0x3d0ae1){if(!_0x3d0ae1){_0x40c7b9[_0x78a1('0x1b')](0x194);}return _0x3d0ae1;};}function handleError(_0x44d505,_0x4adf1e){_0x4adf1e=_0x4adf1e||0x1f4;return function(_0x14732a){logger[_0x78a1('0x2a')](_0x14732a[_0x78a1('0x2b')]);if(_0x14732a['name']){delete _0x14732a[_0x78a1('0x2c')];}_0x44d505['status'](_0x4adf1e)[_0x78a1('0x2d')](_0x14732a);};}exports[_0x78a1('0x2e')]=function(_0x476e41,_0x625eff){var _0x288ce4={},_0x3b1cf5={},_0x4788ea={'count':0x0,'rows':[]};var _0x4d2149=_[_0x78a1('0x2f')](db[_0x78a1('0x30')][_0x78a1('0x31')],function(_0x17306c){return{'name':_0x17306c['fieldName'],'type':_0x17306c[_0x78a1('0x32')][_0x78a1('0x33')]};});_0x3b1cf5['model']=_[_0x78a1('0x2f')](_0x4d2149,_0x78a1('0x2c'));_0x3b1cf5[_0x78a1('0x34')]=_[_0x78a1('0x35')](_0x476e41[_0x78a1('0x34')]);_0x3b1cf5['filters']=_[_0x78a1('0x36')](_0x3b1cf5[_0x78a1('0x37')],_0x3b1cf5['query']);_0x288ce4[_0x78a1('0x38')]=_[_0x78a1('0x36')](_0x3b1cf5[_0x78a1('0x37')],qs['fields'](_0x476e41[_0x78a1('0x34')][_0x78a1('0x39')]));_0x288ce4[_0x78a1('0x38')]=_0x288ce4[_0x78a1('0x38')][_0x78a1('0x3a')]?_0x288ce4[_0x78a1('0x38')]:_0x3b1cf5['model'];if(!_0x476e41[_0x78a1('0x34')][_0x78a1('0x3b')]('nolimit')){_0x288ce4[_0x78a1('0x20')]=qs[_0x78a1('0x20')](_0x476e41[_0x78a1('0x34')][_0x78a1('0x20')]);_0x288ce4[_0x78a1('0x22')]=qs[_0x78a1('0x22')](_0x476e41['query'][_0x78a1('0x22')]);}_0x288ce4[_0x78a1('0x3c')]=qs[_0x78a1('0x3d')](_0x476e41['query'][_0x78a1('0x3d')]);_0x288ce4['where']=qs[_0x78a1('0x3e')](_[_0x78a1('0x3f')](_0x476e41['query'],_0x3b1cf5[_0x78a1('0x3e')]),_0x4d2149);if(_0x476e41['query'][_0x78a1('0x40')]){_0x288ce4[_0x78a1('0x41')]=_[_0x78a1('0x42')](_0x288ce4[_0x78a1('0x41')],{'$or':_[_0x78a1('0x2f')](_0x4d2149,function(_0x3224f9){if(_0x3224f9[_0x78a1('0x32')]!==_0x78a1('0x43')){var _0x57ac1b={};_0x57ac1b[_0x3224f9['name']]={'$like':'%'+_0x476e41[_0x78a1('0x34')][_0x78a1('0x40')]+'%'};return _0x57ac1b;}})});}_0x288ce4=_[_0x78a1('0x42')]({},_0x288ce4,_0x476e41[_0x78a1('0x44')]);var _0x59747d={'where':_0x288ce4[_0x78a1('0x41')]};return db['FreshsalesConfiguration'][_0x78a1('0x21')](_0x59747d)['then'](function(_0x521752){_0x4788ea[_0x78a1('0x21')]=_0x521752;if(_0x476e41['query'][_0x78a1('0x45')]){_0x288ce4[_0x78a1('0x46')]=[{'all':!![]}];}return db[_0x78a1('0x30')]['findAll'](_0x288ce4);})[_0x78a1('0x29')](function(_0x3ca25a){_0x4788ea[_0x78a1('0x47')]=_0x3ca25a;return _0x4788ea;})['then'](respondWithFilteredResult(_0x625eff,_0x288ce4))['catch'](handleError(_0x625eff,null));};exports[_0x78a1('0x48')]=function(_0x5c574,_0x1cfdcb){var _0x3559aa={'raw':![],'where':{'id':_0x5c574[_0x78a1('0x49')]['id']}},_0x4eade2={};_0x4eade2['model']=_['keys'](db[_0x78a1('0x30')][_0x78a1('0x31')]);_0x4eade2['query']=_[_0x78a1('0x35')](_0x5c574[_0x78a1('0x34')]);_0x4eade2[_0x78a1('0x3e')]=_[_0x78a1('0x36')](_0x4eade2[_0x78a1('0x37')],_0x4eade2['query']);_0x3559aa[_0x78a1('0x38')]=_[_0x78a1('0x36')](_0x4eade2[_0x78a1('0x37')],qs[_0x78a1('0x39')](_0x5c574['query'][_0x78a1('0x39')]));_0x3559aa[_0x78a1('0x38')]=_0x3559aa[_0x78a1('0x38')][_0x78a1('0x3a')]?_0x3559aa[_0x78a1('0x38')]:_0x4eade2[_0x78a1('0x37')];if(_0x5c574[_0x78a1('0x34')]['includeAll']){_0x3559aa[_0x78a1('0x46')]=[{'all':!![]}];}_0x3559aa=_[_0x78a1('0x42')]({},_0x3559aa,_0x5c574['options']);return db[_0x78a1('0x30')][_0x78a1('0x4a')](_0x3559aa)[_0x78a1('0x29')](handleEntityNotFound(_0x1cfdcb,null))[_0x78a1('0x29')](respondWithResult(_0x1cfdcb,null))[_0x78a1('0x4b')](handleError(_0x1cfdcb,null));};exports['create']=function(_0x2ad046,_0x29e9b1){return db[_0x78a1('0x30')]['create'](_0x2ad046['body'],{})[_0x78a1('0x29')](respondWithResult(_0x29e9b1,0xc9))[_0x78a1('0x4b')](handleError(_0x29e9b1,null));};exports[_0x78a1('0x27')]=function(_0x4ce99f,_0x5f574c){if(_0x4ce99f['body']['id']){delete _0x4ce99f[_0x78a1('0x4c')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4ce99f[_0x78a1('0x49')]['id']}})[_0x78a1('0x29')](handleEntityNotFound(_0x5f574c,null))[_0x78a1('0x29')](saveUpdates(_0x4ce99f[_0x78a1('0x4c')],null))[_0x78a1('0x29')](respondWithResult(_0x5f574c,null))[_0x78a1('0x4b')](handleError(_0x5f574c,null));};exports[_0x78a1('0x28')]=function(_0x2d93da,_0x564aa9){return db[_0x78a1('0x30')]['find']({'where':{'id':_0x2d93da[_0x78a1('0x49')]['id']}})['then'](handleEntityNotFound(_0x564aa9,null))['then'](removeEntity(_0x564aa9,null))[_0x78a1('0x4b')](handleError(_0x564aa9,null));};exports['getSubjects']=function(_0x35120e,_0x3a9202,_0x4f33c6){var _0x30073b={};var _0x5774d4={};var _0x1d5bea;var _0x147e41;return db['FreshsalesConfiguration'][_0x78a1('0x4d')]({'where':{'id':_0x35120e[_0x78a1('0x49')]['id']}})[_0x78a1('0x29')](handleEntityNotFound(_0x3a9202,null))['then'](function(_0x52036a){if(_0x52036a){_0x1d5bea=_0x52036a;_0x5774d4[_0x78a1('0x37')]=_['keys'](db[_0x78a1('0x4e')][_0x78a1('0x31')]);_0x5774d4[_0x78a1('0x34')]=_['keys'](_0x35120e[_0x78a1('0x34')]);_0x5774d4[_0x78a1('0x3e')]=_[_0x78a1('0x36')](_0x5774d4[_0x78a1('0x37')],_0x5774d4[_0x78a1('0x34')]);_0x30073b['attributes']=_['intersection'](_0x5774d4[_0x78a1('0x37')],qs['fields'](_0x35120e[_0x78a1('0x34')][_0x78a1('0x39')]));_0x30073b[_0x78a1('0x38')]=_0x30073b['attributes'][_0x78a1('0x3a')]?_0x30073b[_0x78a1('0x38')]:_0x5774d4[_0x78a1('0x37')];_0x30073b[_0x78a1('0x3c')]=qs[_0x78a1('0x3d')](_0x35120e[_0x78a1('0x34')][_0x78a1('0x3d')]);_0x30073b[_0x78a1('0x41')]=qs[_0x78a1('0x3e')](_[_0x78a1('0x3f')](_0x35120e[_0x78a1('0x34')],_0x5774d4[_0x78a1('0x3e')]));if(_0x35120e[_0x78a1('0x34')]['filter']){_0x30073b[_0x78a1('0x41')]=_[_0x78a1('0x42')](_0x30073b[_0x78a1('0x41')],{'$or':_['map'](_0x30073b[_0x78a1('0x38')],function(_0x4199b6){var _0x15d0c7={};_0x15d0c7[_0x4199b6]={'$like':'%'+_0x35120e[_0x78a1('0x34')][_0x78a1('0x40')]+'%'};return _0x15d0c7;})});}_0x30073b=_[_0x78a1('0x42')]({},_0x30073b,_0x35120e[_0x78a1('0x44')]);return _0x1d5bea[_0x78a1('0x4f')](_0x30073b);}})[_0x78a1('0x29')](function(_0x14cea2){if(_0x14cea2){_0x147e41=_0x14cea2[_0x78a1('0x3a')];if(!_0x35120e[_0x78a1('0x34')][_0x78a1('0x3b')](_0x78a1('0x50'))){_0x30073b['limit']=qs[_0x78a1('0x20')](_0x35120e[_0x78a1('0x34')][_0x78a1('0x20')]);_0x30073b[_0x78a1('0x22')]=qs[_0x78a1('0x22')](_0x35120e['query']['offset']);}return _0x1d5bea['getSubjects'](_0x30073b);}})['then'](function(_0x1b5282){if(_0x1b5282){return _0x1b5282?{'count':_0x147e41,'rows':_0x1b5282}:null;}})['then'](respondWithResult(_0x3a9202,null))[_0x78a1('0x4b')](handleError(_0x3a9202,null));};exports[_0x78a1('0x51')]=function(_0x308341,_0xbf8c49,_0x4f4b40){var _0x31ceaf={};var _0x296f2c={};var _0x3b165d;var _0x384379;return db[_0x78a1('0x30')]['findOne']({'where':{'id':_0x308341['params']['id']}})[_0x78a1('0x29')](handleEntityNotFound(_0xbf8c49,null))[_0x78a1('0x29')](function(_0x240c2f){if(_0x240c2f){_0x3b165d=_0x240c2f;_0x296f2c['model']=_[_0x78a1('0x35')](db['FreshsalesField']['rawAttributes']);_0x296f2c[_0x78a1('0x34')]=_['keys'](_0x308341[_0x78a1('0x34')]);_0x296f2c[_0x78a1('0x3e')]=_[_0x78a1('0x36')](_0x296f2c[_0x78a1('0x37')],_0x296f2c['query']);_0x31ceaf[_0x78a1('0x38')]=_[_0x78a1('0x36')](_0x296f2c['model'],qs[_0x78a1('0x39')](_0x308341[_0x78a1('0x34')][_0x78a1('0x39')]));_0x31ceaf['attributes']=_0x31ceaf['attributes'][_0x78a1('0x3a')]?_0x31ceaf['attributes']:_0x296f2c[_0x78a1('0x37')];_0x31ceaf[_0x78a1('0x3c')]=qs[_0x78a1('0x3d')](_0x308341['query'][_0x78a1('0x3d')]);_0x31ceaf[_0x78a1('0x41')]=qs['filters'](_[_0x78a1('0x3f')](_0x308341[_0x78a1('0x34')],_0x296f2c[_0x78a1('0x3e')]));if(_0x308341[_0x78a1('0x34')][_0x78a1('0x40')]){_0x31ceaf[_0x78a1('0x41')]=_['merge'](_0x31ceaf[_0x78a1('0x41')],{'$or':_['map'](_0x31ceaf[_0x78a1('0x38')],function(_0x4e5c50){var _0x3b9d38={};_0x3b9d38[_0x4e5c50]={'$like':'%'+_0x308341[_0x78a1('0x34')]['filter']+'%'};return _0x3b9d38;})});}_0x31ceaf=_[_0x78a1('0x42')]({},_0x31ceaf,_0x308341['options']);return _0x3b165d['getDescriptions'](_0x31ceaf);}})['then'](function(_0x4c15f8){if(_0x4c15f8){_0x384379=_0x4c15f8[_0x78a1('0x3a')];if(!_0x308341['query'][_0x78a1('0x3b')](_0x78a1('0x50'))){_0x31ceaf[_0x78a1('0x20')]=qs[_0x78a1('0x20')](_0x308341['query'][_0x78a1('0x20')]);_0x31ceaf[_0x78a1('0x22')]=qs[_0x78a1('0x22')](_0x308341[_0x78a1('0x34')]['offset']);}return _0x3b165d['getDescriptions'](_0x31ceaf);}})[_0x78a1('0x29')](function(_0x478766){if(_0x478766){return _0x478766?{'count':_0x384379,'rows':_0x478766}:null;}})[_0x78a1('0x29')](respondWithResult(_0xbf8c49,null))[_0x78a1('0x4b')](handleError(_0xbf8c49,null));};exports[_0x78a1('0x52')]=function(_0x4851d8,_0x48c800,_0x45bc60){var _0x2fb199={};var _0x2444a9={};var _0x1dce37;var _0x41ac64;return db[_0x78a1('0x30')][_0x78a1('0x4d')]({'where':{'id':_0x4851d8[_0x78a1('0x49')]['id']}})[_0x78a1('0x29')](handleEntityNotFound(_0x48c800,null))[_0x78a1('0x29')](function(_0x7d391e){if(_0x7d391e){_0x1dce37=_0x7d391e;_0x2444a9[_0x78a1('0x37')]=_[_0x78a1('0x35')](db[_0x78a1('0x4e')][_0x78a1('0x31')]);_0x2444a9[_0x78a1('0x34')]=_[_0x78a1('0x35')](_0x4851d8[_0x78a1('0x34')]);_0x2444a9[_0x78a1('0x3e')]=_['intersection'](_0x2444a9['model'],_0x2444a9[_0x78a1('0x34')]);_0x2fb199[_0x78a1('0x38')]=_[_0x78a1('0x36')](_0x2444a9[_0x78a1('0x37')],qs[_0x78a1('0x39')](_0x4851d8[_0x78a1('0x34')][_0x78a1('0x39')]));_0x2fb199[_0x78a1('0x38')]=_0x2fb199[_0x78a1('0x38')]['length']?_0x2fb199[_0x78a1('0x38')]:_0x2444a9['model'];_0x2fb199['order']=qs[_0x78a1('0x3d')](_0x4851d8[_0x78a1('0x34')]['sort']);_0x2fb199[_0x78a1('0x41')]=qs[_0x78a1('0x3e')](_[_0x78a1('0x3f')](_0x4851d8[_0x78a1('0x34')],_0x2444a9[_0x78a1('0x3e')]));if(_0x4851d8[_0x78a1('0x34')]['filter']){_0x2fb199[_0x78a1('0x41')]=_['merge'](_0x2fb199[_0x78a1('0x41')],{'$or':_[_0x78a1('0x2f')](_0x2fb199[_0x78a1('0x38')],function(_0x53193f){var _0x45cd66={};_0x45cd66[_0x53193f]={'$like':'%'+_0x4851d8[_0x78a1('0x34')][_0x78a1('0x40')]+'%'};return _0x45cd66;})});}_0x2fb199=_[_0x78a1('0x42')]({},_0x2fb199,_0x4851d8[_0x78a1('0x44')]);return _0x1dce37[_0x78a1('0x52')](_0x2fb199);}})[_0x78a1('0x29')](function(_0x24f028){if(_0x24f028){_0x41ac64=_0x24f028[_0x78a1('0x3a')];if(!_0x4851d8['query'][_0x78a1('0x3b')](_0x78a1('0x50'))){_0x2fb199[_0x78a1('0x20')]=qs[_0x78a1('0x20')](_0x4851d8[_0x78a1('0x34')][_0x78a1('0x20')]);_0x2fb199['offset']=qs['offset'](_0x4851d8['query']['offset']);}return _0x1dce37[_0x78a1('0x52')](_0x2fb199);}})['then'](function(_0x1230dc){if(_0x1230dc){return _0x1230dc?{'count':_0x41ac64,'rows':_0x1230dc}:null;}})[_0x78a1('0x29')](respondWithResult(_0x48c800,null))['catch'](handleError(_0x48c800,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 6d17170..6270d43 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 _0xe546=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x51b10b,_0x311567){var _0x45b2cf=function(_0xa17759){while(--_0xa17759){_0x51b10b['push'](_0x51b10b['shift']());}};_0x45b2cf(++_0x311567);}(_0xe546,0x14b));var _0x6e54=function(_0x2c0244,_0x541a4e){_0x2c0244=_0x2c0244-0x0;var _0xad7678=_0xe546[_0x2c0244];return _0xad7678;};'use strict';var _=require(_0x6e54('0x0'));var util=require('util');var logger=require(_0x6e54('0x1'))(_0x6e54('0x2'));var moment=require('moment');var BPromise=require(_0x6e54('0x3'));var rp=require(_0x6e54('0x4'));var fs=require('fs');var path=require(_0x6e54('0x5'));var rimraf=require(_0x6e54('0x6'));var config=require('../../config/environment');var attributes=require(_0x6e54('0x7'));module[_0x6e54('0x8')]=function(_0x388b9c,_0x25a4d9){return _0x388b9c[_0x6e54('0x9')](_0x6e54('0xa'),attributes,{'tableName':_0x6e54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9513=['FreshsalesConfiguration','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x9513,0x69));var _0x3951=function(_0x1f480c,_0x4ce48e){_0x1f480c=_0x1f480c-0x0;var _0x357483=_0x9513[_0x1f480c];return _0x357483;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3951('0x0'))('api');var moment=require(_0x3951('0x1'));var BPromise=require(_0x3951('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3951('0x3'));var config=require(_0x3951('0x4'));var attributes=require(_0x3951('0x5'));module['exports']=function(_0x40e8a3,_0x5e1da1){return _0x40e8a3[_0x3951('0x6')](_0x3951('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index f8614b0..823b372 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 _0x03b0=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x455dd2,_0x4cdc1f){var _0x193b05=function(_0x1c82b3){while(--_0x1c82b3){_0x455dd2['push'](_0x455dd2['shift']());}};_0x193b05(++_0x4cdc1f);}(_0x03b0,0xd2));var _0x003b=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x03b0[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x003b('0x0'));var util=require(_0x003b('0x1'));var moment=require(_0x003b('0x2'));var BPromise=require('bluebird');var rs=require(_0x003b('0x3'));var fs=require('fs');var Redis=require(_0x003b('0x4'));var db=require(_0x003b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x003b('0x6'));var config=require(_0x003b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x003b('0x8')][_0x003b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17fbf8,_0x46a87f,_0x4dcf53){return new BPromise(function(_0x6d44e3,_0x57bd45){return client[_0x003b('0xa')](_0x17fbf8,_0x4dcf53)[_0x003b('0xb')](function(_0x3de993){logger[_0x003b('0xc')](_0x003b('0xd'),_0x46a87f,_0x003b('0xe'));logger[_0x003b('0xf')](_0x003b('0x10'),_0x46a87f,'request\x20sent',JSON[_0x003b('0x11')](_0x3de993));if(_0x3de993[_0x003b('0x12')]){if(_0x3de993[_0x003b('0x12')]['code']===0x1f4){logger[_0x003b('0x12')](_0x003b('0xd'),_0x46a87f,_0x3de993['error'][_0x003b('0x13')]);return _0x57bd45(_0x3de993[_0x003b('0x12')][_0x003b('0x13')]);}logger[_0x003b('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x46a87f,_0x3de993[_0x003b('0x12')][_0x003b('0x13')]);return _0x6d44e3(_0x3de993[_0x003b('0x12')][_0x003b('0x13')]);}else{logger[_0x003b('0xc')](_0x003b('0xd'),_0x46a87f,'request\x20sent');_0x6d44e3(_0x3de993[_0x003b('0x14')][_0x003b('0x13')]);}})[_0x003b('0x15')](function(_0x388ba0){logger[_0x003b('0x12')](_0x003b('0xd'),_0x46a87f,_0x388ba0);_0x57bd45(_0x388ba0);});});} \ No newline at end of file +var _0x0b1c=['message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x0b1c,0x138));var _0xc0b1=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x0b1c[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xc0b1('0x0'));var util=require(_0xc0b1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0b1('0x2'));var db=require(_0xc0b1('0x3'))['db'];var utils=require(_0xc0b1('0x4'));var logger=require(_0xc0b1('0x5'))(_0xc0b1('0x6'));var config=require(_0xc0b1('0x7'));var jayson=require(_0xc0b1('0x8'));var client=jayson['client'][_0xc0b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x138823,_0x2d9a68,_0x5807d5){return new BPromise(function(_0x42310d,_0x481aaa){return client[_0xc0b1('0xa')](_0x138823,_0x5807d5)[_0xc0b1('0xb')](function(_0x5249bb){logger['info'](_0xc0b1('0xc'),_0x2d9a68,'request\x20sent');logger[_0xc0b1('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2d9a68,_0xc0b1('0xe'),JSON[_0xc0b1('0xf')](_0x5249bb));if(_0x5249bb['error']){if(_0x5249bb[_0xc0b1('0x10')][_0xc0b1('0x11')]===0x1f4){logger[_0xc0b1('0x10')](_0xc0b1('0xc'),_0x2d9a68,_0x5249bb[_0xc0b1('0x10')][_0xc0b1('0x12')]);return _0x481aaa(_0x5249bb[_0xc0b1('0x10')][_0xc0b1('0x12')]);}logger[_0xc0b1('0x10')](_0xc0b1('0xc'),_0x2d9a68,_0x5249bb[_0xc0b1('0x10')]['message']);return _0x42310d(_0x5249bb[_0xc0b1('0x10')][_0xc0b1('0x12')]);}else{logger[_0xc0b1('0x13')](_0xc0b1('0xc'),_0x2d9a68,_0xc0b1('0xe'));_0x42310d(_0x5249bb[_0xc0b1('0x14')][_0xc0b1('0x12')]);}})[_0xc0b1('0x15')](function(_0x5a4b22){logger[_0xc0b1('0x10')](_0xc0b1('0xc'),_0x2d9a68,_0x5a4b22);_0x481aaa(_0x5a4b22);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index fd2fffb..9678cb5 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 _0x81d5=['fs-extra','../../components/auth/service','./intFreshsalesField.controller','get','isAuthenticated','/:id','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4d5953,_0x515ef3){var _0x3e20b5=function(_0x2bfde8){while(--_0x2bfde8){_0x4d5953['push'](_0x4d5953['shift']());}};_0x3e20b5(++_0x515ef3);}(_0x81d5,0x1ab));var _0x581d=function(_0x5aeb99,_0x2ff42f){_0x5aeb99=_0x5aeb99-0x0;var _0x30e2cf=_0x81d5[_0x5aeb99];return _0x30e2cf;};'use strict';var multer=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var path=require('path');var timeout=require(_0x581d('0x2'));var express=require(_0x581d('0x3'));var router=express[_0x581d('0x4')]();var fs_extra=require(_0x581d('0x5'));var auth=require(_0x581d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x581d('0x7'));router[_0x581d('0x8')]('/',auth[_0x581d('0x9')](),controller['index']);router[_0x581d('0x8')](_0x581d('0xa'),auth[_0x581d('0x9')](),controller['show']);router[_0x581d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x581d('0xa'),auth[_0x581d('0x9')](),controller[_0x581d('0xc')]);router[_0x581d('0xd')](_0x581d('0xa'),auth['isAuthenticated'](),controller[_0x581d('0xe')]);module[_0x581d('0xf')]=router; \ No newline at end of file +var _0x9ffd=['isAuthenticated','get','/:id','show','post','create','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x599fdc,_0x1f1138){var _0x98ea0f=function(_0x2bfd54){while(--_0x2bfd54){_0x599fdc['push'](_0x599fdc['shift']());}};_0x98ea0f(++_0x1f1138);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x4f0307,_0x1a2ec4){_0x4f0307=_0x4f0307-0x0;var _0x1ff65f=_0x9ffd[_0x4f0307];return _0x1ff65f;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require(_0xd9ff('0x3'));var express=require('express');var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xd9ff('0x9')](),controller['index']);router[_0xd9ff('0xa')](_0xd9ff('0xb'),auth['isAuthenticated'](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0xd')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xe')]);router['put'](_0xd9ff('0xb'),auth[_0xd9ff('0x9')](),controller['update']);router[_0xd9ff('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 3399025..491fc08 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 _0x7b03=['STRING','ENUM','customVariable','BOOLEAN','sequelize','string','variable','keyValue','picklist'];(function(_0x2b4b94,_0x42f80e){var _0x5b4842=function(_0x290929){while(--_0x290929){_0x2b4b94['push'](_0x2b4b94['shift']());}};_0x5b4842(++_0x42f80e);}(_0x7b03,0x124));var _0x37b0=function(_0x18ae6d,_0x255d00){_0x18ae6d=_0x18ae6d-0x0;var _0x3deb94=_0x7b03[_0x18ae6d];return _0x3deb94;};'use strict';var Sequelize=require(_0x37b0('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x37b0('0x1'),_0x37b0('0x2'),'customVariable',_0x37b0('0x3'),_0x37b0('0x4')),'defaultValue':_0x37b0('0x1')},'content':{'type':Sequelize[_0x37b0('0x5')]},'key':{'type':Sequelize[_0x37b0('0x5')]},'keyType':{'type':Sequelize[_0x37b0('0x6')](_0x37b0('0x1'),_0x37b0('0x2'),_0x37b0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x37b0('0x5')]},'nameField':{'type':Sequelize[_0x37b0('0x5')]},'customField':{'type':Sequelize[_0x37b0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x37b0('0x5')]}}; \ No newline at end of file +var _0x1053=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x579bc0,_0x34c0cc){var _0x379218=function(_0x1afd20){while(--_0x1afd20){_0x579bc0['push'](_0x579bc0['shift']());}};_0x379218(++_0x34c0cc);}(_0x1053,0x124));var _0x3105=function(_0x3abce4,_0x34e488){_0x3abce4=_0x3abce4-0x0;var _0x2c25db=_0x1053[_0x3abce4];return _0x2c25db;};'use strict';var Sequelize=require(_0x3105('0x0'));module[_0x3105('0x1')]={'type':{'type':Sequelize[_0x3105('0x2')]('string',_0x3105('0x3'),_0x3105('0x4'),_0x3105('0x5'),'picklist'),'defaultValue':_0x3105('0x6')},'content':{'type':Sequelize[_0x3105('0x7')]},'key':{'type':Sequelize[_0x3105('0x7')]},'keyType':{'type':Sequelize[_0x3105('0x2')](_0x3105('0x6'),_0x3105('0x3'),_0x3105('0x4'))},'keyContent':{'type':Sequelize[_0x3105('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3105('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d2cf7e3..08a3688 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 _0x38fc=['index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','FreshsalesField','rows','catch','filters','fields','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x133792,_0xba2004){var _0x4dacb3=function(_0x38eb52){while(--_0x38eb52){_0x133792['push'](_0x133792['shift']());}};_0x4dacb3(++_0xba2004);}(_0x38fc,0xfd));var _0xc38f=function(_0x9cac6f,_0x26f533){_0x9cac6f=_0x9cac6f-0x0;var _0x2f1d40=_0x38fc[_0x9cac6f];return _0x2f1d40;};'use strict';var emlformat=require(_0xc38f('0x0'));var rimraf=require(_0xc38f('0x1'));var zipdir=require(_0xc38f('0x2'));var jsonpatch=require(_0xc38f('0x3'));var rp=require(_0xc38f('0x4'));var moment=require(_0xc38f('0x5'));var BPromise=require(_0xc38f('0x6'));var Mustache=require(_0xc38f('0x7'));var util=require(_0xc38f('0x8'));var path=require('path');var sox=require(_0xc38f('0x9'));var csv=require(_0xc38f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc38f('0xb'));var _=require(_0xc38f('0xc'));var squel=require(_0xc38f('0xd'));var crypto=require(_0xc38f('0xe'));var jsforce=require(_0xc38f('0xf'));var deskjs=require(_0xc38f('0x10'));var toCsv=require(_0xc38f('0xa'));var querystring=require(_0xc38f('0x11'));var Papa=require('papaparse');var Redis=require(_0xc38f('0x12'));var authService=require(_0xc38f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc38f('0x14'));var logger=require(_0xc38f('0x15'))(_0xc38f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc38f('0x17'))['db'];function respondWithStatusCode(_0x196424,_0x4dd9f5){_0x4dd9f5=_0x4dd9f5||0xcc;return function(_0x384144){if(_0x384144){return _0x196424[_0xc38f('0x18')](_0x4dd9f5);}return _0x196424[_0xc38f('0x19')](_0x4dd9f5)[_0xc38f('0x1a')]();};}function respondWithResult(_0x4c45b3,_0x4186fc){_0x4186fc=_0x4186fc||0xc8;return function(_0x5f5d56){if(_0x5f5d56){return _0x4c45b3[_0xc38f('0x19')](_0x4186fc)[_0xc38f('0x1b')](_0x5f5d56);}};}function respondWithFilteredResult(_0x566ee9,_0x3ec37b){return function(_0x307a6){if(_0x307a6){var _0x34c799=typeof _0x3ec37b[_0xc38f('0x1c')]==='undefined'&&typeof _0x3ec37b[_0xc38f('0x1d')]===_0xc38f('0x1e');var _0x14e849=_0x307a6[_0xc38f('0x1f')];var _0x8e238=_0x34c799?0x0:_0x3ec37b[_0xc38f('0x1c')];var _0x20da89=_0x34c799?_0x307a6[_0xc38f('0x1f')]:_0x3ec37b[_0xc38f('0x1c')]+_0x3ec37b[_0xc38f('0x1d')];var _0x1ced23;if(_0x20da89>=_0x14e849){_0x20da89=_0x14e849;_0x1ced23=0xc8;}else{_0x1ced23=0xce;}_0x566ee9[_0xc38f('0x19')](_0x1ced23);return _0x566ee9[_0xc38f('0x20')](_0xc38f('0x21'),_0x8e238+'-'+_0x20da89+'/'+_0x14e849)[_0xc38f('0x1b')](_0x307a6);}return null;};}function patchUpdates(_0x2eb992){return function(_0x19d059){try{jsonpatch[_0xc38f('0x22')](_0x19d059,_0x2eb992,!![]);}catch(_0x20612d){return BPromise['reject'](_0x20612d);}return _0x19d059[_0xc38f('0x23')]();};}function saveUpdates(_0x5b528e,_0x413d00){return function(_0x31a5ab){if(_0x31a5ab){return _0x31a5ab[_0xc38f('0x24')](_0x5b528e)[_0xc38f('0x25')](function(_0x179772){return _0x179772;});}return null;};}function removeEntity(_0x31bca1,_0x453b9a){return function(_0x1dec7f){if(_0x1dec7f){return _0x1dec7f[_0xc38f('0x26')]()[_0xc38f('0x25')](function(){_0x31bca1[_0xc38f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c60b0,_0x1c758e){return function(_0xffbbf2){if(!_0xffbbf2){_0x5c60b0['sendStatus'](0x194);}return _0xffbbf2;};}function handleError(_0x37ce33,_0x75c98){_0x75c98=_0x75c98||0x1f4;return function(_0x4a5a6d){logger[_0xc38f('0x27')](_0x4a5a6d[_0xc38f('0x28')]);if(_0x4a5a6d[_0xc38f('0x29')]){delete _0x4a5a6d['name'];}_0x37ce33[_0xc38f('0x19')](_0x75c98)[_0xc38f('0x2a')](_0x4a5a6d);};}exports[_0xc38f('0x2b')]=function(_0x5bf7fd,_0x1f70cf){var _0x3db6fc={},_0x2ed30f={},_0x12b44e={'count':0x0,'rows':[]};var _0x3f2933=_['map'](db['FreshsalesField'][_0xc38f('0x2c')],function(_0x485fc7){return{'name':_0x485fc7[_0xc38f('0x2d')],'type':_0x485fc7['type'][_0xc38f('0x2e')]};});_0x2ed30f['model']=_['map'](_0x3f2933,_0xc38f('0x29'));_0x2ed30f[_0xc38f('0x2f')]=_[_0xc38f('0x30')](_0x5bf7fd[_0xc38f('0x2f')]);_0x2ed30f['filters']=_[_0xc38f('0x31')](_0x2ed30f[_0xc38f('0x32')],_0x2ed30f[_0xc38f('0x2f')]);_0x3db6fc['attributes']=_[_0xc38f('0x31')](_0x2ed30f['model'],qs['fields'](_0x5bf7fd[_0xc38f('0x2f')]['fields']));_0x3db6fc[_0xc38f('0x33')]=_0x3db6fc[_0xc38f('0x33')][_0xc38f('0x34')]?_0x3db6fc[_0xc38f('0x33')]:_0x2ed30f[_0xc38f('0x32')];if(!_0x5bf7fd[_0xc38f('0x2f')][_0xc38f('0x35')](_0xc38f('0x36'))){_0x3db6fc[_0xc38f('0x1d')]=qs[_0xc38f('0x1d')](_0x5bf7fd['query'][_0xc38f('0x1d')]);_0x3db6fc[_0xc38f('0x1c')]=qs[_0xc38f('0x1c')](_0x5bf7fd[_0xc38f('0x2f')][_0xc38f('0x1c')]);}_0x3db6fc[_0xc38f('0x37')]=qs[_0xc38f('0x38')](_0x5bf7fd[_0xc38f('0x2f')]['sort']);_0x3db6fc[_0xc38f('0x39')]=qs['filters'](_[_0xc38f('0x3a')](_0x5bf7fd['query'],_0x2ed30f['filters']),_0x3f2933);if(_0x5bf7fd['query'][_0xc38f('0x3b')]){_0x3db6fc[_0xc38f('0x39')]=_[_0xc38f('0x3c')](_0x3db6fc[_0xc38f('0x39')],{'$or':_['map'](_0x3f2933,function(_0x22b030){if(_0x22b030['type']!==_0xc38f('0x3d')){var _0x587ac7={};_0x587ac7[_0x22b030[_0xc38f('0x29')]]={'$like':'%'+_0x5bf7fd['query'][_0xc38f('0x3b')]+'%'};return _0x587ac7;}})});}_0x3db6fc=_['merge']({},_0x3db6fc,_0x5bf7fd['options']);var _0x41a8eb={'where':_0x3db6fc[_0xc38f('0x39')]};return db['FreshsalesField'][_0xc38f('0x1f')](_0x41a8eb)[_0xc38f('0x25')](function(_0x51cc01){_0x12b44e[_0xc38f('0x1f')]=_0x51cc01;if(_0x5bf7fd[_0xc38f('0x2f')][_0xc38f('0x3e')]){_0x3db6fc[_0xc38f('0x3f')]=[{'all':!![]}];}return db[_0xc38f('0x40')]['findAll'](_0x3db6fc);})[_0xc38f('0x25')](function(_0x5e3b9a){_0x12b44e[_0xc38f('0x41')]=_0x5e3b9a;return _0x12b44e;})['then'](respondWithFilteredResult(_0x1f70cf,_0x3db6fc))[_0xc38f('0x42')](handleError(_0x1f70cf,null));};exports['show']=function(_0x7ae61c,_0x2088ac){var _0x493523={'raw':!![],'where':{'id':_0x7ae61c['params']['id']}},_0x1bf2e0={};_0x1bf2e0['model']=_[_0xc38f('0x30')](db[_0xc38f('0x40')][_0xc38f('0x2c')]);_0x1bf2e0[_0xc38f('0x2f')]=_[_0xc38f('0x30')](_0x7ae61c[_0xc38f('0x2f')]);_0x1bf2e0[_0xc38f('0x43')]=_[_0xc38f('0x31')](_0x1bf2e0['model'],_0x1bf2e0[_0xc38f('0x2f')]);_0x493523[_0xc38f('0x33')]=_[_0xc38f('0x31')](_0x1bf2e0[_0xc38f('0x32')],qs[_0xc38f('0x44')](_0x7ae61c[_0xc38f('0x2f')][_0xc38f('0x44')]));_0x493523[_0xc38f('0x33')]=_0x493523[_0xc38f('0x33')][_0xc38f('0x34')]?_0x493523[_0xc38f('0x33')]:_0x1bf2e0[_0xc38f('0x32')];if(_0x7ae61c['query'][_0xc38f('0x3e')]){_0x493523['include']=[{'all':!![]}];}_0x493523=_['merge']({},_0x493523,_0x7ae61c[_0xc38f('0x45')]);return db[_0xc38f('0x40')][_0xc38f('0x46')](_0x493523)[_0xc38f('0x25')](handleEntityNotFound(_0x2088ac,null))['then'](respondWithResult(_0x2088ac,null))[_0xc38f('0x42')](handleError(_0x2088ac,null));};exports['create']=function(_0x5e34e6,_0x3e6b73){return db[_0xc38f('0x40')][_0xc38f('0x47')](_0x5e34e6[_0xc38f('0x48')],{})[_0xc38f('0x25')](respondWithResult(_0x3e6b73,0xc9))[_0xc38f('0x42')](handleError(_0x3e6b73,null));};exports[_0xc38f('0x24')]=function(_0x4a7d66,_0x16fb4b){if(_0x4a7d66['body']['id']){delete _0x4a7d66[_0xc38f('0x48')]['id'];}return db[_0xc38f('0x40')]['find']({'where':{'id':_0x4a7d66['params']['id']}})[_0xc38f('0x25')](handleEntityNotFound(_0x16fb4b,null))[_0xc38f('0x25')](saveUpdates(_0x4a7d66[_0xc38f('0x48')],null))[_0xc38f('0x25')](respondWithResult(_0x16fb4b,null))[_0xc38f('0x42')](handleError(_0x16fb4b,null));};exports[_0xc38f('0x26')]=function(_0x1fc977,_0x415e9c){return db['FreshsalesField'][_0xc38f('0x46')]({'where':{'id':_0x1fc977[_0xc38f('0x49')]['id']}})[_0xc38f('0x25')](handleEntityNotFound(_0x415e9c,null))[_0xc38f('0x25')](removeEntity(_0x415e9c,null))[_0xc38f('0x42')](handleError(_0x415e9c,null));}; \ No newline at end of file +var _0x6210=['json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','query','intersection','model','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','FreshsalesField','findAll','rows','catch','params','keys','attributes','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range'];(function(_0x8e9c8a,_0x3356a5){var _0x36a3ba=function(_0x1368a7){while(--_0x1368a7){_0x8e9c8a['push'](_0x8e9c8a['shift']());}};_0x36a3ba(++_0x3356a5);}(_0x6210,0x1ed));var _0x0621=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6210[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x0621('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0621('0x1'));var jsonpatch=require(_0x0621('0x2'));var rp=require(_0x0621('0x3'));var moment=require('moment');var BPromise=require(_0x0621('0x4'));var Mustache=require(_0x0621('0x5'));var util=require(_0x0621('0x6'));var path=require(_0x0621('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0621('0x8'));var fs=require('fs');var fs_extra=require(_0x0621('0x9'));var _=require('lodash');var squel=require(_0x0621('0xa'));var crypto=require('crypto');var jsforce=require(_0x0621('0xb'));var deskjs=require(_0x0621('0xc'));var toCsv=require(_0x0621('0xd'));var querystring=require(_0x0621('0xe'));var Papa=require(_0x0621('0xf'));var Redis=require(_0x0621('0x10'));var authService=require(_0x0621('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0621('0x12'));var hardwareService=require(_0x0621('0x13'));var logger=require('../../config/logger')(_0x0621('0x14'));var utils=require(_0x0621('0x15'));var config=require(_0x0621('0x16'));var licenseUtil=require(_0x0621('0x17'));var db=require(_0x0621('0x18'))['db'];function respondWithStatusCode(_0x21b885,_0x385a64){_0x385a64=_0x385a64||0xcc;return function(_0x19c37a){if(_0x19c37a){return _0x21b885['sendStatus'](_0x385a64);}return _0x21b885[_0x0621('0x19')](_0x385a64)[_0x0621('0x1a')]();};}function respondWithResult(_0xa767c,_0x4d7544){_0x4d7544=_0x4d7544||0xc8;return function(_0x350ec1){if(_0x350ec1){return _0xa767c['status'](_0x4d7544)['json'](_0x350ec1);}};}function respondWithFilteredResult(_0x11f8c3,_0x17c9c9){return function(_0x4f07fe){if(_0x4f07fe){var _0x503b8e=typeof _0x17c9c9[_0x0621('0x1b')]===_0x0621('0x1c')&&typeof _0x17c9c9['limit']===_0x0621('0x1c');var _0x4aad78=_0x4f07fe[_0x0621('0x1d')];var _0x107941=_0x503b8e?0x0:_0x17c9c9[_0x0621('0x1b')];var _0x534fb9=_0x503b8e?_0x4f07fe[_0x0621('0x1d')]:_0x17c9c9['offset']+_0x17c9c9['limit'];var _0x55a859;if(_0x534fb9>=_0x4aad78){_0x534fb9=_0x4aad78;_0x55a859=0xc8;}else{_0x55a859=0xce;}_0x11f8c3[_0x0621('0x19')](_0x55a859);return _0x11f8c3[_0x0621('0x1e')](_0x0621('0x1f'),_0x107941+'-'+_0x534fb9+'/'+_0x4aad78)[_0x0621('0x20')](_0x4f07fe);}return null;};}function patchUpdates(_0x26ac48){return function(_0x3ac5ae){try{jsonpatch[_0x0621('0x21')](_0x3ac5ae,_0x26ac48,!![]);}catch(_0x33be1f){return BPromise[_0x0621('0x22')](_0x33be1f);}return _0x3ac5ae[_0x0621('0x23')]();};}function saveUpdates(_0x20cbb3,_0x41a669){return function(_0x1753cc){if(_0x1753cc){return _0x1753cc[_0x0621('0x24')](_0x20cbb3)[_0x0621('0x25')](function(_0x4d023f){return _0x4d023f;});}return null;};}function removeEntity(_0x3c52b3,_0x387790){return function(_0x195349){if(_0x195349){return _0x195349[_0x0621('0x26')]()[_0x0621('0x25')](function(){_0x3c52b3[_0x0621('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd814,_0x265f48){return function(_0x2a74fa){if(!_0x2a74fa){_0x3cd814['sendStatus'](0x194);}return _0x2a74fa;};}function handleError(_0x11b0c2,_0x3f8955){_0x3f8955=_0x3f8955||0x1f4;return function(_0x29a4b6){logger[_0x0621('0x27')](_0x29a4b6[_0x0621('0x28')]);if(_0x29a4b6['name']){delete _0x29a4b6[_0x0621('0x29')];}_0x11b0c2['status'](_0x3f8955)[_0x0621('0x2a')](_0x29a4b6);};}exports['index']=function(_0x3aadd0,_0x10beb5){var _0x2aadbb={},_0x18b4e3={},_0x119e9a={'count':0x0,'rows':[]};var _0x486d25=_[_0x0621('0x2b')](db['FreshsalesField'][_0x0621('0x2c')],function(_0x1d32f3){return{'name':_0x1d32f3['fieldName'],'type':_0x1d32f3[_0x0621('0x2d')][_0x0621('0x2e')]};});_0x18b4e3['model']=_[_0x0621('0x2b')](_0x486d25,_0x0621('0x29'));_0x18b4e3[_0x0621('0x2f')]=_['keys'](_0x3aadd0[_0x0621('0x2f')]);_0x18b4e3['filters']=_[_0x0621('0x30')](_0x18b4e3[_0x0621('0x31')],_0x18b4e3[_0x0621('0x2f')]);_0x2aadbb['attributes']=_[_0x0621('0x30')](_0x18b4e3['model'],qs[_0x0621('0x32')](_0x3aadd0[_0x0621('0x2f')][_0x0621('0x32')]));_0x2aadbb['attributes']=_0x2aadbb['attributes'][_0x0621('0x33')]?_0x2aadbb['attributes']:_0x18b4e3[_0x0621('0x31')];if(!_0x3aadd0['query']['hasOwnProperty'](_0x0621('0x34'))){_0x2aadbb[_0x0621('0x35')]=qs[_0x0621('0x35')](_0x3aadd0['query'][_0x0621('0x35')]);_0x2aadbb[_0x0621('0x1b')]=qs[_0x0621('0x1b')](_0x3aadd0[_0x0621('0x2f')][_0x0621('0x1b')]);}_0x2aadbb[_0x0621('0x36')]=qs[_0x0621('0x37')](_0x3aadd0['query'][_0x0621('0x37')]);_0x2aadbb[_0x0621('0x38')]=qs[_0x0621('0x39')](_[_0x0621('0x3a')](_0x3aadd0[_0x0621('0x2f')],_0x18b4e3[_0x0621('0x39')]),_0x486d25);if(_0x3aadd0[_0x0621('0x2f')][_0x0621('0x3b')]){_0x2aadbb[_0x0621('0x38')]=_[_0x0621('0x3c')](_0x2aadbb[_0x0621('0x38')],{'$or':_['map'](_0x486d25,function(_0x18e539){if(_0x18e539[_0x0621('0x2d')]!==_0x0621('0x3d')){var _0x26c8aa={};_0x26c8aa[_0x18e539[_0x0621('0x29')]]={'$like':'%'+_0x3aadd0[_0x0621('0x2f')][_0x0621('0x3b')]+'%'};return _0x26c8aa;}})});}_0x2aadbb=_[_0x0621('0x3c')]({},_0x2aadbb,_0x3aadd0[_0x0621('0x3e')]);var _0x4ac080={'where':_0x2aadbb[_0x0621('0x38')]};return db['FreshsalesField'][_0x0621('0x1d')](_0x4ac080)[_0x0621('0x25')](function(_0x1088c9){_0x119e9a[_0x0621('0x1d')]=_0x1088c9;if(_0x3aadd0[_0x0621('0x2f')][_0x0621('0x3f')]){_0x2aadbb['include']=[{'all':!![]}];}return db[_0x0621('0x40')][_0x0621('0x41')](_0x2aadbb);})[_0x0621('0x25')](function(_0x2ba634){_0x119e9a[_0x0621('0x42')]=_0x2ba634;return _0x119e9a;})['then'](respondWithFilteredResult(_0x10beb5,_0x2aadbb))[_0x0621('0x43')](handleError(_0x10beb5,null));};exports['show']=function(_0x4d9d3c,_0xf7f52c){var _0x591d48={'raw':!![],'where':{'id':_0x4d9d3c[_0x0621('0x44')]['id']}},_0x2cd853={};_0x2cd853[_0x0621('0x31')]=_['keys'](db[_0x0621('0x40')][_0x0621('0x2c')]);_0x2cd853['query']=_[_0x0621('0x45')](_0x4d9d3c[_0x0621('0x2f')]);_0x2cd853[_0x0621('0x39')]=_['intersection'](_0x2cd853[_0x0621('0x31')],_0x2cd853['query']);_0x591d48[_0x0621('0x46')]=_[_0x0621('0x30')](_0x2cd853[_0x0621('0x31')],qs[_0x0621('0x32')](_0x4d9d3c[_0x0621('0x2f')][_0x0621('0x32')]));_0x591d48[_0x0621('0x46')]=_0x591d48[_0x0621('0x46')][_0x0621('0x33')]?_0x591d48[_0x0621('0x46')]:_0x2cd853[_0x0621('0x31')];if(_0x4d9d3c[_0x0621('0x2f')][_0x0621('0x3f')]){_0x591d48[_0x0621('0x47')]=[{'all':!![]}];}_0x591d48=_[_0x0621('0x3c')]({},_0x591d48,_0x4d9d3c['options']);return db[_0x0621('0x40')][_0x0621('0x48')](_0x591d48)[_0x0621('0x25')](handleEntityNotFound(_0xf7f52c,null))[_0x0621('0x25')](respondWithResult(_0xf7f52c,null))[_0x0621('0x43')](handleError(_0xf7f52c,null));};exports['create']=function(_0x3d0edb,_0x19ae74){return db[_0x0621('0x40')][_0x0621('0x49')](_0x3d0edb['body'],{})['then'](respondWithResult(_0x19ae74,0xc9))[_0x0621('0x43')](handleError(_0x19ae74,null));};exports['update']=function(_0x42477d,_0x22b5aa){if(_0x42477d[_0x0621('0x4a')]['id']){delete _0x42477d[_0x0621('0x4a')]['id'];}return db[_0x0621('0x40')][_0x0621('0x48')]({'where':{'id':_0x42477d[_0x0621('0x44')]['id']}})[_0x0621('0x25')](handleEntityNotFound(_0x22b5aa,null))[_0x0621('0x25')](saveUpdates(_0x42477d[_0x0621('0x4a')],null))[_0x0621('0x25')](respondWithResult(_0x22b5aa,null))[_0x0621('0x43')](handleError(_0x22b5aa,null));};exports['destroy']=function(_0x185d7f,_0x4666a1){return db['FreshsalesField'][_0x0621('0x48')]({'where':{'id':_0x185d7f[_0x0621('0x44')]['id']}})['then'](handleEntityNotFound(_0x4666a1,null))[_0x0621('0x25')](removeEntity(_0x4666a1,null))['catch'](handleError(_0x4666a1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6cb217a..dcd7ab3 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 _0x0120=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4624c4,_0x2620c9){var _0x3c0d60=function(_0x18abbe){while(--_0x18abbe){_0x4624c4['push'](_0x4624c4['shift']());}};_0x3c0d60(++_0x2620c9);}(_0x0120,0x6f));var _0x0012=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0120[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[{'name':_0x0012('0xe'),'fields':[_0x0012('0xf'),_0x0012('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb875=['moment','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash'];(function(_0x2fafc9,_0x24d914){var _0x4d3f32=function(_0xdfd172){while(--_0xdfd172){_0x2fafc9['push'](_0x2fafc9['shift']());}};_0x4d3f32(++_0x24d914);}(_0xb875,0x167));var _0x5b87=function(_0x26a74d,_0x37ecfc){_0x26a74d=_0x26a74d-0x0;var _0xcbb1a3=_0xb875[_0x26a74d];return _0xcbb1a3;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b87('0x1'));var BPromise=require('bluebird');var rp=require(_0x5b87('0x2'));var fs=require('fs');var path=require(_0x5b87('0x3'));var rimraf=require('rimraf');var config=require(_0x5b87('0x4'));var attributes=require(_0x5b87('0x5'));module[_0x5b87('0x6')]=function(_0x32ed83,_0x253d91){return _0x32ed83[_0x5b87('0x7')](_0x5b87('0x8'),attributes,{'tableName':_0x5b87('0x9'),'paranoid':![],'indexes':[{'name':_0x5b87('0xa'),'fields':[_0x5b87('0xb'),'FieldId'],'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 7dccc1d..4616f41 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c2343,_0x37c3c5){var _0x47ae07=function(_0x4064f9){while(--_0x4064f9){_0x4c2343['push'](_0x4c2343['shift']());}};_0x47ae07(++_0x37c3c5);}(_0x326f,0xd1));var _0xf326=function(_0x86e931,_0x5df853){_0x86e931=_0x86e931-0x0;var _0x31b793=_0x326f[_0x86e931];return _0x31b793;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3439b4,_0x3c235c){var _0x38d9f8=function(_0x4a3a54){while(--_0x4a3a54){_0x3439b4['push'](_0x3439b4['shift']());}};_0x38d9f8(++_0x3c235c);}(_0x5d58,0x187));var _0x85d5=function(_0x401c4b,_0x3faf1f){_0x401c4b=_0x401c4b-0x0;var _0x1a818b=_0x5d58[_0x401c4b];return _0x1a818b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 050804f..e199c0e 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(_0x5bba34,_0x3bae14){var _0xbfc48a=function(_0xff1738){while(--_0xff1738){_0x5bba34['push'](_0x5bba34['shift']());}};_0xbfc48a(++_0x3bae14);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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(_0x5af606,_0x62116d){var _0x48dc00=function(_0x5519b4){while(--_0x5519b4){_0x5af606['push'](_0x5af606['shift']());}};_0x48dc00(++_0x62116d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8ae68e5..86244ba 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 _0x652a=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x652a,0x1ae));var _0xa652=function(_0x53bb90,_0x171d1c){_0x53bb90=_0x53bb90-0x0;var _0x361006=_0x652a[_0x53bb90];return _0x361006;};'use strict';var Sequelize=require(_0xa652('0x0'));module[_0xa652('0x1')]={'name':{'type':Sequelize[_0xa652('0x2')]},'description':{'type':Sequelize[_0xa652('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xa652('0x2')]},'password':{'type':Sequelize[_0xa652('0x2')]},'clientId':{'type':Sequelize[_0xa652('0x2')]},'clientSecret':{'type':Sequelize[_0xa652('0x2')]},'securityToken':{'type':Sequelize[_0xa652('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa652('0x3')](_0xa652('0x4'),_0xa652('0x5')),'defaultValue':_0xa652('0x4')}}; \ No newline at end of file +var _0xabad=['newTab','sequelize','STRING','ENUM','integrationTab'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xabad,0x150));var _0xdaba=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0xabad[_0x4fecb6];return _0xa9a47;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaba('0x1')]},'description':{'type':Sequelize[_0xdaba('0x1')]},'username':{'type':Sequelize[_0xdaba('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xdaba('0x1')]},'password':{'type':Sequelize[_0xdaba('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdaba('0x1')]},'securityToken':{'type':Sequelize[_0xdaba('0x1')]},'serverUrl':{'type':Sequelize[_0xdaba('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdaba('0x2')](_0xdaba('0x3'),_0xdaba('0x4')),'defaultValue':_0xdaba('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a19cba1..09c2606 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 _0xa72b=['sendStatus','error','name','send','map','SalesforceAccount','fieldName','type','model','keys','query','filters','intersection','fields','attributes','sort','where','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','merge','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','channel','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','apply','reject','update','then'];(function(_0x4b2172,_0x13fc35){var _0x4347e9=function(_0x4f7db3){while(--_0x4f7db3){_0x4b2172['push'](_0x4b2172['shift']());}};_0x4347e9(++_0x13fc35);}(_0xa72b,0xce));var _0xba72=function(_0x3b6e1f,_0x15f304){_0x3b6e1f=_0x3b6e1f-0x0;var _0x3ac3bb=_0xa72b[_0x3b6e1f];return _0x3ac3bb;};'use strict';var emlformat=require(_0xba72('0x0'));var rimraf=require(_0xba72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba72('0x2'));var rp=require(_0xba72('0x3'));var moment=require('moment');var BPromise=require(_0xba72('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba72('0x5'));var sox=require(_0xba72('0x6'));var csv=require('to-csv');var ejs=require(_0xba72('0x7'));var fs=require('fs');var fs_extra=require(_0xba72('0x8'));var _=require(_0xba72('0x9'));var squel=require(_0xba72('0xa'));var crypto=require(_0xba72('0xb'));var jsforce=require(_0xba72('0xc'));var deskjs=require(_0xba72('0xd'));var toCsv=require(_0xba72('0xe'));var querystring=require(_0xba72('0xf'));var Papa=require(_0xba72('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba72('0x11'));var as=require(_0xba72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba72('0x13'))(_0xba72('0x14'));var utils=require(_0xba72('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xba72('0x16'));var db=require(_0xba72('0x17'))['db'];var integrations=require(_0xba72('0x18'));function respondWithStatusCode(_0x3a75b2,_0x5b0b55){_0x5b0b55=_0x5b0b55||0xcc;return function(_0x278ee4){if(_0x278ee4){return _0x3a75b2['sendStatus'](_0x5b0b55);}return _0x3a75b2[_0xba72('0x19')](_0x5b0b55)[_0xba72('0x1a')]();};}function respondWithResult(_0x1e6df7,_0x1d3aa9){_0x1d3aa9=_0x1d3aa9||0xc8;return function(_0x4e858a){if(_0x4e858a){return _0x1e6df7[_0xba72('0x19')](_0x1d3aa9)[_0xba72('0x1b')](_0x4e858a);}};}function respondWithFilteredResult(_0x2cdcac,_0x53e751){return function(_0xf3d3b2){if(_0xf3d3b2){var _0x3e6d12=typeof _0x53e751['offset']===_0xba72('0x1c')&&typeof _0x53e751[_0xba72('0x1d')]===_0xba72('0x1c');var _0x52282d=_0xf3d3b2[_0xba72('0x1e')];var _0x51549f=_0x3e6d12?0x0:_0x53e751['offset'];var _0x98f31c=_0x3e6d12?_0xf3d3b2[_0xba72('0x1e')]:_0x53e751[_0xba72('0x1f')]+_0x53e751[_0xba72('0x1d')];var _0x30d255;if(_0x98f31c>=_0x52282d){_0x98f31c=_0x52282d;_0x30d255=0xc8;}else{_0x30d255=0xce;}_0x2cdcac[_0xba72('0x19')](_0x30d255);return _0x2cdcac['set']('Content-Range',_0x51549f+'-'+_0x98f31c+'/'+_0x52282d)[_0xba72('0x1b')](_0xf3d3b2);}return null;};}function patchUpdates(_0x1e376e){return function(_0x5c73b5){try{jsonpatch[_0xba72('0x20')](_0x5c73b5,_0x1e376e,!![]);}catch(_0x5dd9df){return BPromise[_0xba72('0x21')](_0x5dd9df);}return _0x5c73b5['save']();};}function saveUpdates(_0x23947a,_0x15841e){return function(_0x22dda7){if(_0x22dda7){return _0x22dda7[_0xba72('0x22')](_0x23947a)['then'](function(_0x3e158c){return _0x3e158c;});}return null;};}function removeEntity(_0x5ae29b,_0x261503){return function(_0x2a697a){if(_0x2a697a){return _0x2a697a['destroy']()[_0xba72('0x23')](function(){_0x5ae29b[_0xba72('0x19')](0xcc)[_0xba72('0x1a')]();});}};}function handleEntityNotFound(_0x202680,_0x3a7b2b){return function(_0x460c6a){if(!_0x460c6a){_0x202680[_0xba72('0x24')](0x194);}return _0x460c6a;};}function handleError(_0x18d7ea,_0x3f8d46){_0x3f8d46=_0x3f8d46||0x1f4;return function(_0x1aa13){logger[_0xba72('0x25')](_0x1aa13['stack']);if(_0x1aa13[_0xba72('0x26')]){delete _0x1aa13[_0xba72('0x26')];}_0x18d7ea[_0xba72('0x19')](_0x3f8d46)[_0xba72('0x27')](_0x1aa13);};}exports['index']=function(_0x2e1e1c,_0x340480){var _0x1fc4f2={},_0x2946b6={},_0x3829af={'count':0x0,'rows':[]};var _0x3a290e=_[_0xba72('0x28')](db[_0xba72('0x29')]['rawAttributes'],function(_0x31de92){return{'name':_0x31de92[_0xba72('0x2a')],'type':_0x31de92[_0xba72('0x2b')]['key']};});_0x2946b6[_0xba72('0x2c')]=_[_0xba72('0x28')](_0x3a290e,'name');_0x2946b6['query']=_[_0xba72('0x2d')](_0x2e1e1c[_0xba72('0x2e')]);_0x2946b6[_0xba72('0x2f')]=_[_0xba72('0x30')](_0x2946b6[_0xba72('0x2c')],_0x2946b6[_0xba72('0x2e')]);_0x1fc4f2['attributes']=_[_0xba72('0x30')](_0x2946b6[_0xba72('0x2c')],qs[_0xba72('0x31')](_0x2e1e1c[_0xba72('0x2e')][_0xba72('0x31')]));_0x1fc4f2[_0xba72('0x32')]=_0x1fc4f2[_0xba72('0x32')]['length']?_0x1fc4f2['attributes']:_0x2946b6[_0xba72('0x2c')];if(!_0x2e1e1c[_0xba72('0x2e')]['hasOwnProperty']('nolimit')){_0x1fc4f2[_0xba72('0x1d')]=qs[_0xba72('0x1d')](_0x2e1e1c[_0xba72('0x2e')][_0xba72('0x1d')]);_0x1fc4f2[_0xba72('0x1f')]=qs[_0xba72('0x1f')](_0x2e1e1c[_0xba72('0x2e')][_0xba72('0x1f')]);}_0x1fc4f2['order']=qs[_0xba72('0x33')](_0x2e1e1c[_0xba72('0x2e')]['sort']);_0x1fc4f2[_0xba72('0x34')]=qs[_0xba72('0x2f')](_['pick'](_0x2e1e1c['query'],_0x2946b6['filters']),_0x3a290e);if(_0x2e1e1c[_0xba72('0x2e')][_0xba72('0x35')]){_0x1fc4f2[_0xba72('0x34')]=_['merge'](_0x1fc4f2[_0xba72('0x34')],{'$or':_[_0xba72('0x28')](_0x3a290e,function(_0x27bd73){if(_0x27bd73[_0xba72('0x2b')]!=='VIRTUAL'){var _0x1a61c9={};_0x1a61c9[_0x27bd73[_0xba72('0x26')]]={'$like':'%'+_0x2e1e1c['query']['filter']+'%'};return _0x1a61c9;}})});}_0x1fc4f2=_['merge']({},_0x1fc4f2,_0x2e1e1c[_0xba72('0x36')]);var _0x416f15={'where':_0x1fc4f2[_0xba72('0x34')]};return db[_0xba72('0x29')][_0xba72('0x1e')](_0x416f15)[_0xba72('0x23')](function(_0x42fd76){_0x3829af['count']=_0x42fd76;if(_0x2e1e1c[_0xba72('0x2e')][_0xba72('0x37')]){_0x1fc4f2['include']=[{'all':!![]}];}return db[_0xba72('0x29')][_0xba72('0x38')](_0x1fc4f2);})[_0xba72('0x23')](function(_0x4ceffe){_0x3829af[_0xba72('0x39')]=_0x4ceffe;return _0x3829af;})[_0xba72('0x23')](respondWithFilteredResult(_0x340480,_0x1fc4f2))[_0xba72('0x3a')](handleError(_0x340480,null));};exports[_0xba72('0x3b')]=function(_0x32965d,_0x24624c){var _0xec8463={'raw':![],'where':{'id':_0x32965d[_0xba72('0x3c')]['id']}},_0x2a406b={};_0x2a406b[_0xba72('0x2c')]=_[_0xba72('0x2d')](db['SalesforceAccount'][_0xba72('0x3d')]);_0x2a406b[_0xba72('0x2e')]=_[_0xba72('0x2d')](_0x32965d[_0xba72('0x2e')]);_0x2a406b[_0xba72('0x2f')]=_[_0xba72('0x30')](_0x2a406b[_0xba72('0x2c')],_0x2a406b[_0xba72('0x2e')]);_0xec8463['attributes']=_[_0xba72('0x30')](_0x2a406b[_0xba72('0x2c')],qs[_0xba72('0x31')](_0x32965d[_0xba72('0x2e')][_0xba72('0x31')]));_0xec8463[_0xba72('0x32')]=_0xec8463[_0xba72('0x32')][_0xba72('0x3e')]?_0xec8463[_0xba72('0x32')]:_0x2a406b[_0xba72('0x2c')];if(_0x32965d[_0xba72('0x2e')][_0xba72('0x37')]){_0xec8463[_0xba72('0x3f')]=[{'all':!![]}];}_0xec8463=_[_0xba72('0x40')]({},_0xec8463,_0x32965d['options']);return db[_0xba72('0x29')][_0xba72('0x41')](_0xec8463)[_0xba72('0x23')](handleEntityNotFound(_0x24624c,null))[_0xba72('0x23')](respondWithResult(_0x24624c,null))[_0xba72('0x3a')](handleError(_0x24624c,null));};exports[_0xba72('0x42')]=function(_0x5d91a4,_0x10bb68){return db[_0xba72('0x29')]['create'](_0x5d91a4[_0xba72('0x43')],{})['then'](respondWithResult(_0x10bb68,0xc9))[_0xba72('0x3a')](handleError(_0x10bb68,null));};exports[_0xba72('0x22')]=function(_0x502f49,_0x137258){if(_0x502f49[_0xba72('0x43')]['id']){delete _0x502f49[_0xba72('0x43')]['id'];}return db['SalesforceAccount'][_0xba72('0x41')]({'where':{'id':_0x502f49[_0xba72('0x3c')]['id']}})[_0xba72('0x23')](handleEntityNotFound(_0x137258,null))[_0xba72('0x23')](saveUpdates(_0x502f49['body'],null))[_0xba72('0x23')](respondWithResult(_0x137258,null))['catch'](handleError(_0x137258,null));};exports['destroy']=function(_0x50ca0b,_0x31860e){return db['SalesforceAccount']['find']({'where':{'id':_0x50ca0b[_0xba72('0x3c')]['id']}})[_0xba72('0x23')](handleEntityNotFound(_0x31860e,null))[_0xba72('0x23')](removeEntity(_0x31860e,null))['catch'](handleError(_0x31860e,null));};exports[_0xba72('0x44')]=function(_0x1109c5,_0x5e8e53,_0x1ca86d){var _0x291b7a={};var _0x43af46={};var _0x4f9d70;var _0x281b4e;return db[_0xba72('0x29')][_0xba72('0x45')]({'where':{'id':_0x1109c5[_0xba72('0x3c')]['id']}})[_0xba72('0x23')](handleEntityNotFound(_0x5e8e53,null))[_0xba72('0x23')](function(_0x507551){if(_0x507551){_0x4f9d70=_0x507551;_0x43af46[_0xba72('0x2c')]=_['keys'](db[_0xba72('0x46')][_0xba72('0x3d')]);_0x43af46['query']=_[_0xba72('0x2d')](_0x1109c5[_0xba72('0x2e')]);_0x43af46[_0xba72('0x2f')]=_['intersection'](_0x43af46[_0xba72('0x2c')],_0x43af46['query']);_0x291b7a[_0xba72('0x32')]=_[_0xba72('0x30')](_0x43af46[_0xba72('0x2c')],qs['fields'](_0x1109c5[_0xba72('0x2e')][_0xba72('0x31')]));_0x291b7a[_0xba72('0x32')]=_0x291b7a[_0xba72('0x32')][_0xba72('0x3e')]?_0x291b7a[_0xba72('0x32')]:_0x43af46[_0xba72('0x2c')];_0x291b7a[_0xba72('0x47')]=qs[_0xba72('0x33')](_0x1109c5['query'][_0xba72('0x33')]);_0x291b7a[_0xba72('0x34')]=qs[_0xba72('0x2f')](_['pick'](_0x1109c5[_0xba72('0x2e')],_0x43af46['filters']));if(_0x1109c5[_0xba72('0x2e')][_0xba72('0x35')]){_0x291b7a[_0xba72('0x34')]=_['merge'](_0x291b7a['where'],{'$or':_[_0xba72('0x28')](_0x291b7a[_0xba72('0x32')],function(_0x46bbba){var _0x334dfe={};_0x334dfe[_0x46bbba]={'$like':'%'+_0x1109c5[_0xba72('0x2e')][_0xba72('0x35')]+'%'};return _0x334dfe;})});}_0x291b7a=_[_0xba72('0x40')]({},_0x291b7a,_0x1109c5[_0xba72('0x36')]);return _0x4f9d70['getConfigurations'](_0x291b7a);}})[_0xba72('0x23')](function(_0x4b452d){if(_0x4b452d){_0x281b4e=_0x4b452d[_0xba72('0x3e')];if(!_0x1109c5['query'][_0xba72('0x48')](_0xba72('0x49'))){_0x291b7a[_0xba72('0x1d')]=qs[_0xba72('0x1d')](_0x1109c5[_0xba72('0x2e')][_0xba72('0x1d')]);_0x291b7a[_0xba72('0x1f')]=qs[_0xba72('0x1f')](_0x1109c5['query'][_0xba72('0x1f')]);}return _0x4f9d70[_0xba72('0x44')](_0x291b7a);}})['then'](function(_0x473590){if(_0x473590){return _0x473590?{'count':_0x281b4e,'rows':_0x473590}:null;}})[_0xba72('0x23')](respondWithResult(_0x5e8e53,null))[_0xba72('0x3a')](handleError(_0x5e8e53,null));};exports[_0xba72('0x4a')]=function(_0x3bc78f,_0x476f76,_0x4fafed){if(_0x3bc78f[_0xba72('0x43')]['id']){delete _0x3bc78f[_0xba72('0x43')]['id'];}return db[_0xba72('0x29')]['findOne']({'where':{'id':_0x3bc78f['params']['id']}})['then'](handleEntityNotFound(_0x476f76,null))[_0xba72('0x23')](function(_0x6f29ea){if(_0x6f29ea){_0x3bc78f[_0xba72('0x43')][_0xba72('0x4b')]=_0x6f29ea['id'];_0x3bc78f[_0xba72('0x43')][_0xba72('0x4c')]=integrations['getSubjects'](_0x3bc78f['body']['channel'],_0x3bc78f['body'][_0xba72('0x2b')]);_0x3bc78f[_0xba72('0x43')][_0xba72('0x4d')]=integrations['getDescriptions'](_0x3bc78f[_0xba72('0x43')][_0xba72('0x4e')],_0x3bc78f[_0xba72('0x43')][_0xba72('0x2b')]);return db['SalesforceConfiguration'][_0xba72('0x42')](_0x3bc78f[_0xba72('0x43')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xba72('0x4f')],'as':_0xba72('0x4d')}]});}return null;})['then'](respondWithResult(_0x476f76,null))[_0xba72('0x3a')](handleError(_0x476f76,null));};exports['getFields']=function(_0x38f8a2,_0x353f55,_0x32f07b){var _0x1bf73b;var _0x151a79='';var _0x3bf917=_0xba72('0x50');return db[_0xba72('0x29')]['findOne']({'where':{'id':_0x38f8a2[_0xba72('0x3c')]['id']},'attributes':['id',_0xba72('0x51'),_0xba72('0x52'),_0xba72('0x53'),_0xba72('0x54'),_0xba72('0x55'),_0xba72('0x56')]})[_0xba72('0x23')](handleEntityNotFound(_0x353f55,null))[_0xba72('0x23')](function(_0x5e40d8){if(_0x5e40d8){_0x151a79=_0x5e40d8[_0xba72('0x51')];var _0x47ea59=_0x151a79[_0xba72('0x57')](-0x1);if(_0x47ea59==='/'){_0x151a79=_0x151a79['substring'](0x0,_0x151a79[_0xba72('0x58')](_0x47ea59));}_0x1bf73b=new jsforce[(_0xba72('0x59'))]({'oauth2':{'loginUrl':_0x151a79,'clientId':_0x5e40d8[_0xba72('0x52')],'clientSecret':_0x5e40d8['clientSecret']}});return _0x1bf73b[_0xba72('0x5a')](_0x5e40d8['username'],_0x5e40d8[_0xba72('0x55')][_0xba72('0x5b')](_0x5e40d8[_0xba72('0x56')]));}})[_0xba72('0x23')](function(_0x4c0f04){if(_0x4c0f04){if(!_[_0xba72('0x5c')](_0x38f8a2[_0xba72('0x2e')][_0xba72('0x5d')])){_0x3bf917=_0x38f8a2[_0xba72('0x2e')][_0xba72('0x5d')];}return _0x1bf73b['sobject'](_0x3bf917)[_0xba72('0x5e')]();}})[_0xba72('0x23')](function(_0x14646f){var _0x384c72=[_0xba72('0x5f'),_0xba72('0x60'),_0xba72('0x61'),'IsRecurrence',_0xba72('0x62'),'Description'];var _0x465a5b=[_0xba72('0x63'),_0xba72('0x64'),_0xba72('0x65'),_0xba72('0x66'),_0xba72('0x67'),_0xba72('0x68'),_0xba72('0x69')];if(_0x14646f){_[_0xba72('0x6a')](_0x14646f[_0xba72('0x31')],function(_0xde31bc){return _0x384c72[_0xba72('0x6b')](_0xde31bc[_0xba72('0x26')])||!_0x465a5b['includes'](_0xde31bc[_0xba72('0x2b')]);});return{'count':_0x14646f[_0xba72('0x31')][_0xba72('0x3e')],'rows':_[_0xba72('0x28')](_0x14646f[_0xba72('0x31')],function(_0x191ad8){return{'id':_0x191ad8['name'],'name':_0x191ad8['label'],'custom':_0x191ad8[_0xba72('0x6c')],'options':_0x191ad8[_0xba72('0x6d')][_0xba72('0x3e')]>0x0?_[_0xba72('0x28')](_0x191ad8[_0xba72('0x6d')],function(_0x5c52b0){return{'name':_0x5c52b0[_0xba72('0x6e')],'value':_0x5c52b0[_0xba72('0x6f')]};}):_0x191ad8[_0xba72('0x2b')]==_0xba72('0x66')?[{'name':'True','value':_0xba72('0x70')},{'name':_0xba72('0x71'),'value':_0xba72('0x72')}]:[]};})};}})[_0xba72('0x23')](respondWithResult(_0x353f55,null))['catch'](function(_0x62cfee){var _0x5bfe1c=_0x38f8a2[_0xba72('0x2e')][_0xba72('0x73')]?0x1f4:_0x62cfee[_0xba72('0x74')]||0x1f4;logger[_0xba72('0x25')](_0xba72('0x75'),_0xba72('0x76'),_0x5bfe1c,JSON[_0xba72('0x77')](_0x62cfee));delete _0x62cfee[_0xba72('0x26')];if(_0x5bfe1c===0x191){_0x5bfe1c=0x190;}_0x353f55[_0xba72('0x19')](_0x5bfe1c)[_0xba72('0x27')](_0x38f8a2[_0xba72('0x2e')]['test']?{'message':_0xba72('0x78'),'statusCode':_0x62cfee[_0xba72('0x74')]}:_0x62cfee);});}; \ No newline at end of file +var _0x8895=['fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','SalesforceConfiguration','nolimit','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','Subjects','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','phone','includes','type','custom','picklistValues','label','value','true','False','false','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf'];(function(_0x5218e4,_0x5b9e64){var _0x1bcf62=function(_0x56abd9){while(--_0x56abd9){_0x5218e4['push'](_0x5218e4['shift']());}};_0x1bcf62(++_0x5b9e64);}(_0x8895,0x166));var _0x5889=function(_0x24a556,_0x1c8286){_0x24a556=_0x24a556-0x0;var _0x67a815=_0x8895[_0x24a556];return _0x67a815;};'use strict';var emlformat=require(_0x5889('0x0'));var rimraf=require(_0x5889('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5889('0x2'));var rp=require(_0x5889('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5889('0x4'));var path=require('path');var sox=require(_0x5889('0x5'));var csv=require(_0x5889('0x6'));var ejs=require(_0x5889('0x7'));var fs=require('fs');var fs_extra=require(_0x5889('0x8'));var _=require(_0x5889('0x9'));var squel=require(_0x5889('0xa'));var crypto=require(_0x5889('0xb'));var jsforce=require(_0x5889('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5889('0xd'));var Papa=require(_0x5889('0xe'));var Redis=require('ioredis');var authService=require(_0x5889('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5889('0x10'));var hardwareService=require(_0x5889('0x11'));var logger=require(_0x5889('0x12'))(_0x5889('0x13'));var utils=require('../../config/utils');var config=require(_0x5889('0x14'));var licenseUtil=require(_0x5889('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5889('0x16'));function respondWithStatusCode(_0x1c9d1f,_0x46a211){_0x46a211=_0x46a211||0xcc;return function(_0x3c6505){if(_0x3c6505){return _0x1c9d1f[_0x5889('0x17')](_0x46a211);}return _0x1c9d1f[_0x5889('0x18')](_0x46a211)[_0x5889('0x19')]();};}function respondWithResult(_0x2aca9f,_0x604adb){_0x604adb=_0x604adb||0xc8;return function(_0x406dfa){if(_0x406dfa){return _0x2aca9f[_0x5889('0x18')](_0x604adb)[_0x5889('0x1a')](_0x406dfa);}};}function respondWithFilteredResult(_0x17e902,_0x24db7f){return function(_0x761a95){if(_0x761a95){var _0x19c670=typeof _0x24db7f[_0x5889('0x1b')]===_0x5889('0x1c')&&typeof _0x24db7f[_0x5889('0x1d')]==='undefined';var _0x27d1f5=_0x761a95[_0x5889('0x1e')];var _0x73166f=_0x19c670?0x0:_0x24db7f[_0x5889('0x1b')];var _0x2d23af=_0x19c670?_0x761a95[_0x5889('0x1e')]:_0x24db7f[_0x5889('0x1b')]+_0x24db7f[_0x5889('0x1d')];var _0x298707;if(_0x2d23af>=_0x27d1f5){_0x2d23af=_0x27d1f5;_0x298707=0xc8;}else{_0x298707=0xce;}_0x17e902[_0x5889('0x18')](_0x298707);return _0x17e902[_0x5889('0x1f')](_0x5889('0x20'),_0x73166f+'-'+_0x2d23af+'/'+_0x27d1f5)[_0x5889('0x1a')](_0x761a95);}return null;};}function patchUpdates(_0x469af9){return function(_0x5b95df){try{jsonpatch[_0x5889('0x21')](_0x5b95df,_0x469af9,!![]);}catch(_0x4f5c07){return BPromise[_0x5889('0x22')](_0x4f5c07);}return _0x5b95df[_0x5889('0x23')]();};}function saveUpdates(_0x1827f3,_0x315a96){return function(_0x528f37){if(_0x528f37){return _0x528f37[_0x5889('0x24')](_0x1827f3)[_0x5889('0x25')](function(_0x3d7334){return _0x3d7334;});}return null;};}function removeEntity(_0x149c32,_0x19ad61){return function(_0x2c7ac7){if(_0x2c7ac7){return _0x2c7ac7['destroy']()[_0x5889('0x25')](function(){_0x149c32[_0x5889('0x18')](0xcc)[_0x5889('0x19')]();});}};}function handleEntityNotFound(_0x3cf6e8,_0xb63277){return function(_0x147033){if(!_0x147033){_0x3cf6e8[_0x5889('0x17')](0x194);}return _0x147033;};}function handleError(_0x328c7a,_0x30801d){_0x30801d=_0x30801d||0x1f4;return function(_0x2aa380){logger[_0x5889('0x26')](_0x2aa380[_0x5889('0x27')]);if(_0x2aa380[_0x5889('0x28')]){delete _0x2aa380[_0x5889('0x28')];}_0x328c7a[_0x5889('0x18')](_0x30801d)['send'](_0x2aa380);};}exports[_0x5889('0x29')]=function(_0x3ddcef,_0x48e0d8){var _0x3ab699={},_0x56702f={},_0x47130b={'count':0x0,'rows':[]};var _0x4c1003=_['map'](db[_0x5889('0x2a')][_0x5889('0x2b')],function(_0x376544){return{'name':_0x376544[_0x5889('0x2c')],'type':_0x376544['type'][_0x5889('0x2d')]};});_0x56702f[_0x5889('0x2e')]=_[_0x5889('0x2f')](_0x4c1003,'name');_0x56702f[_0x5889('0x30')]=_[_0x5889('0x31')](_0x3ddcef['query']);_0x56702f[_0x5889('0x32')]=_[_0x5889('0x33')](_0x56702f[_0x5889('0x2e')],_0x56702f[_0x5889('0x30')]);_0x3ab699[_0x5889('0x34')]=_['intersection'](_0x56702f[_0x5889('0x2e')],qs[_0x5889('0x35')](_0x3ddcef[_0x5889('0x30')]['fields']));_0x3ab699[_0x5889('0x34')]=_0x3ab699[_0x5889('0x34')][_0x5889('0x36')]?_0x3ab699[_0x5889('0x34')]:_0x56702f['model'];if(!_0x3ddcef[_0x5889('0x30')][_0x5889('0x37')]('nolimit')){_0x3ab699[_0x5889('0x1d')]=qs['limit'](_0x3ddcef[_0x5889('0x30')][_0x5889('0x1d')]);_0x3ab699['offset']=qs[_0x5889('0x1b')](_0x3ddcef[_0x5889('0x30')][_0x5889('0x1b')]);}_0x3ab699[_0x5889('0x38')]=qs[_0x5889('0x39')](_0x3ddcef[_0x5889('0x30')][_0x5889('0x39')]);_0x3ab699[_0x5889('0x3a')]=qs[_0x5889('0x32')](_[_0x5889('0x3b')](_0x3ddcef[_0x5889('0x30')],_0x56702f[_0x5889('0x32')]),_0x4c1003);if(_0x3ddcef[_0x5889('0x30')][_0x5889('0x3c')]){_0x3ab699['where']=_[_0x5889('0x3d')](_0x3ab699[_0x5889('0x3a')],{'$or':_['map'](_0x4c1003,function(_0xab4e31){if(_0xab4e31['type']!=='VIRTUAL'){var _0x403af6={};_0x403af6[_0xab4e31['name']]={'$like':'%'+_0x3ddcef[_0x5889('0x30')][_0x5889('0x3c')]+'%'};return _0x403af6;}})});}_0x3ab699=_['merge']({},_0x3ab699,_0x3ddcef[_0x5889('0x3e')]);var _0x483aa4={'where':_0x3ab699[_0x5889('0x3a')]};return db[_0x5889('0x2a')]['count'](_0x483aa4)[_0x5889('0x25')](function(_0x58c4d5){_0x47130b[_0x5889('0x1e')]=_0x58c4d5;if(_0x3ddcef[_0x5889('0x30')][_0x5889('0x3f')]){_0x3ab699[_0x5889('0x40')]=[{'all':!![]}];}return db[_0x5889('0x2a')][_0x5889('0x41')](_0x3ab699);})[_0x5889('0x25')](function(_0x2c7856){_0x47130b['rows']=_0x2c7856;return _0x47130b;})[_0x5889('0x25')](respondWithFilteredResult(_0x48e0d8,_0x3ab699))[_0x5889('0x42')](handleError(_0x48e0d8,null));};exports[_0x5889('0x43')]=function(_0x4737fc,_0x4b8347){var _0x955e1={'raw':![],'where':{'id':_0x4737fc[_0x5889('0x44')]['id']}},_0x11d92c={};_0x11d92c[_0x5889('0x2e')]=_[_0x5889('0x31')](db['SalesforceAccount'][_0x5889('0x2b')]);_0x11d92c[_0x5889('0x30')]=_[_0x5889('0x31')](_0x4737fc[_0x5889('0x30')]);_0x11d92c[_0x5889('0x32')]=_[_0x5889('0x33')](_0x11d92c['model'],_0x11d92c['query']);_0x955e1['attributes']=_['intersection'](_0x11d92c['model'],qs['fields'](_0x4737fc[_0x5889('0x30')][_0x5889('0x35')]));_0x955e1[_0x5889('0x34')]=_0x955e1['attributes']['length']?_0x955e1[_0x5889('0x34')]:_0x11d92c[_0x5889('0x2e')];if(_0x4737fc[_0x5889('0x30')]['includeAll']){_0x955e1[_0x5889('0x40')]=[{'all':!![]}];}_0x955e1=_[_0x5889('0x3d')]({},_0x955e1,_0x4737fc[_0x5889('0x3e')]);return db[_0x5889('0x2a')][_0x5889('0x45')](_0x955e1)[_0x5889('0x25')](handleEntityNotFound(_0x4b8347,null))[_0x5889('0x25')](respondWithResult(_0x4b8347,null))['catch'](handleError(_0x4b8347,null));};exports[_0x5889('0x46')]=function(_0x3aece4,_0x4e4d3b){return db[_0x5889('0x2a')]['create'](_0x3aece4[_0x5889('0x47')],{})['then'](respondWithResult(_0x4e4d3b,0xc9))[_0x5889('0x42')](handleError(_0x4e4d3b,null));};exports['update']=function(_0x2d11b9,_0x186493){if(_0x2d11b9[_0x5889('0x47')]['id']){delete _0x2d11b9[_0x5889('0x47')]['id'];}return db[_0x5889('0x2a')][_0x5889('0x45')]({'where':{'id':_0x2d11b9['params']['id']}})[_0x5889('0x25')](handleEntityNotFound(_0x186493,null))[_0x5889('0x25')](saveUpdates(_0x2d11b9[_0x5889('0x47')],null))[_0x5889('0x25')](respondWithResult(_0x186493,null))[_0x5889('0x42')](handleError(_0x186493,null));};exports['destroy']=function(_0x3467f5,_0x1b2952){return db['SalesforceAccount'][_0x5889('0x45')]({'where':{'id':_0x3467f5[_0x5889('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b2952,null))[_0x5889('0x25')](removeEntity(_0x1b2952,null))[_0x5889('0x42')](handleError(_0x1b2952,null));};exports[_0x5889('0x48')]=function(_0x53cd3e,_0x5dad47,_0x5bbe5b){var _0x5a28b0={};var _0x140938={};var _0x45baff;var _0x40aff4;return db['SalesforceAccount']['findOne']({'where':{'id':_0x53cd3e[_0x5889('0x44')]['id']}})[_0x5889('0x25')](handleEntityNotFound(_0x5dad47,null))['then'](function(_0x308a4c){if(_0x308a4c){_0x45baff=_0x308a4c;_0x140938[_0x5889('0x2e')]=_['keys'](db[_0x5889('0x49')][_0x5889('0x2b')]);_0x140938['query']=_[_0x5889('0x31')](_0x53cd3e[_0x5889('0x30')]);_0x140938['filters']=_[_0x5889('0x33')](_0x140938[_0x5889('0x2e')],_0x140938[_0x5889('0x30')]);_0x5a28b0[_0x5889('0x34')]=_[_0x5889('0x33')](_0x140938['model'],qs['fields'](_0x53cd3e[_0x5889('0x30')][_0x5889('0x35')]));_0x5a28b0[_0x5889('0x34')]=_0x5a28b0[_0x5889('0x34')]['length']?_0x5a28b0[_0x5889('0x34')]:_0x140938['model'];_0x5a28b0[_0x5889('0x38')]=qs['sort'](_0x53cd3e[_0x5889('0x30')][_0x5889('0x39')]);_0x5a28b0[_0x5889('0x3a')]=qs['filters'](_[_0x5889('0x3b')](_0x53cd3e[_0x5889('0x30')],_0x140938['filters']));if(_0x53cd3e['query'][_0x5889('0x3c')]){_0x5a28b0['where']=_[_0x5889('0x3d')](_0x5a28b0[_0x5889('0x3a')],{'$or':_[_0x5889('0x2f')](_0x5a28b0[_0x5889('0x34')],function(_0x44d654){var _0x4d7c60={};_0x4d7c60[_0x44d654]={'$like':'%'+_0x53cd3e[_0x5889('0x30')][_0x5889('0x3c')]+'%'};return _0x4d7c60;})});}_0x5a28b0=_[_0x5889('0x3d')]({},_0x5a28b0,_0x53cd3e['options']);return _0x45baff[_0x5889('0x48')](_0x5a28b0);}})[_0x5889('0x25')](function(_0x2ee1dd){if(_0x2ee1dd){_0x40aff4=_0x2ee1dd[_0x5889('0x36')];if(!_0x53cd3e[_0x5889('0x30')]['hasOwnProperty'](_0x5889('0x4a'))){_0x5a28b0[_0x5889('0x1d')]=qs[_0x5889('0x1d')](_0x53cd3e[_0x5889('0x30')]['limit']);_0x5a28b0['offset']=qs[_0x5889('0x1b')](_0x53cd3e[_0x5889('0x30')][_0x5889('0x1b')]);}return _0x45baff[_0x5889('0x48')](_0x5a28b0);}})[_0x5889('0x25')](function(_0x5475dd){if(_0x5475dd){return _0x5475dd?{'count':_0x40aff4,'rows':_0x5475dd}:null;}})[_0x5889('0x25')](respondWithResult(_0x5dad47,null))[_0x5889('0x42')](handleError(_0x5dad47,null));};exports[_0x5889('0x4b')]=function(_0x5ca4ef,_0x46a09e,_0x5bff0c){if(_0x5ca4ef['body']['id']){delete _0x5ca4ef[_0x5889('0x47')]['id'];}return db['SalesforceAccount'][_0x5889('0x4c')]({'where':{'id':_0x5ca4ef[_0x5889('0x44')]['id']}})[_0x5889('0x25')](handleEntityNotFound(_0x46a09e,null))['then'](function(_0x4fe5a4){if(_0x4fe5a4){_0x5ca4ef['body'][_0x5889('0x4d')]=_0x4fe5a4['id'];_0x5ca4ef[_0x5889('0x47')]['Subjects']=integrations[_0x5889('0x4e')](_0x5ca4ef[_0x5889('0x47')][_0x5889('0x4f')],_0x5ca4ef[_0x5889('0x47')]['type']);_0x5ca4ef[_0x5889('0x47')][_0x5889('0x50')]=integrations['getDescriptions'](_0x5ca4ef[_0x5889('0x47')][_0x5889('0x4f')],_0x5ca4ef[_0x5889('0x47')]['type']);return db[_0x5889('0x49')][_0x5889('0x46')](_0x5ca4ef['body'],{'include':[{'model':db['SalesforceField'],'as':_0x5889('0x51')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x5889('0x25')](respondWithResult(_0x46a09e,null))[_0x5889('0x42')](handleError(_0x46a09e,null));};exports[_0x5889('0x52')]=function(_0x46aa3e,_0x438d91,_0x13b0e6){var _0x1e0091;var _0x2f0ceb='';var _0x7d4b12=_0x5889('0x53');return db[_0x5889('0x2a')][_0x5889('0x4c')]({'where':{'id':_0x46aa3e[_0x5889('0x44')]['id']},'attributes':['id',_0x5889('0x54'),_0x5889('0x55'),_0x5889('0x56'),'username',_0x5889('0x57'),_0x5889('0x58')]})[_0x5889('0x25')](handleEntityNotFound(_0x438d91,null))[_0x5889('0x25')](function(_0x54f67b){if(_0x54f67b){_0x2f0ceb=_0x54f67b['remoteUri'];var _0x1698e2=_0x2f0ceb['slice'](-0x1);if(_0x1698e2==='/'){_0x2f0ceb=_0x2f0ceb[_0x5889('0x59')](0x0,_0x2f0ceb[_0x5889('0x5a')](_0x1698e2));}_0x1e0091=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2f0ceb,'clientId':_0x54f67b['clientId'],'clientSecret':_0x54f67b[_0x5889('0x56')]}});return _0x1e0091['login'](_0x54f67b['username'],_0x54f67b[_0x5889('0x57')][_0x5889('0x5b')](_0x54f67b[_0x5889('0x58')]));}})[_0x5889('0x25')](function(_0x5b73c4){if(_0x5b73c4){if(!_[_0x5889('0x5c')](_0x46aa3e[_0x5889('0x30')][_0x5889('0x5d')])){_0x7d4b12=_0x46aa3e[_0x5889('0x30')]['ticketType'];}return _0x1e0091[_0x5889('0x5e')](_0x7d4b12)[_0x5889('0x5f')]();}})[_0x5889('0x25')](function(_0x41a983){var _0x5d75b0=[_0x5889('0x60'),_0x5889('0x61'),_0x5889('0x62'),_0x5889('0x63'),_0x5889('0x64'),'Description'];var _0x26da33=[_0x5889('0x65'),_0x5889('0x66'),_0x5889('0x67'),_0x5889('0x68'),_0x5889('0x69'),'textarea',_0x5889('0x6a')];if(_0x41a983){_['remove'](_0x41a983[_0x5889('0x35')],function(_0x46bae2){return _0x5d75b0[_0x5889('0x6b')](_0x46bae2[_0x5889('0x28')])||!_0x26da33[_0x5889('0x6b')](_0x46bae2[_0x5889('0x6c')]);});return{'count':_0x41a983[_0x5889('0x35')]['length'],'rows':_[_0x5889('0x2f')](_0x41a983[_0x5889('0x35')],function(_0x5ef889){return{'id':_0x5ef889[_0x5889('0x28')],'name':_0x5ef889['label'],'custom':_0x5ef889[_0x5889('0x6d')],'options':_0x5ef889[_0x5889('0x6e')][_0x5889('0x36')]>0x0?_[_0x5889('0x2f')](_0x5ef889[_0x5889('0x6e')],function(_0xc47dd5){return{'name':_0xc47dd5[_0x5889('0x6f')],'value':_0xc47dd5[_0x5889('0x70')]};}):_0x5ef889['type']=='boolean'?[{'name':'True','value':_0x5889('0x71')},{'name':_0x5889('0x72'),'value':_0x5889('0x73')}]:[]};})};}})[_0x5889('0x25')](respondWithResult(_0x438d91,null))['catch'](function(_0x372f07){var _0x871133=_0x46aa3e[_0x5889('0x30')]['test']?0x1f4:_0x372f07['statusCode']||0x1f4;logger[_0x5889('0x26')](_0x5889('0x74'),_0x5889('0x52'),_0x871133,JSON['stringify'](_0x372f07));delete _0x372f07[_0x5889('0x28')];if(_0x871133===0x191){_0x871133=0x190;}_0x438d91[_0x5889('0x18')](_0x871133)[_0x5889('0x75')](_0x46aa3e[_0x5889('0x30')][_0x5889('0x76')]?{'message':_0x5889('0x77'),'statusCode':_0x372f07['statusCode']}:_0x372f07);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6d0e80f..14cdb26 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 _0x9901=['api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9901,0x15e));var _0x1990=function(_0x3d7f7d,_0x5d57d7){_0x3d7f7d=_0x3d7f7d-0x0;var _0x59c78b=_0x9901[_0x3d7f7d];return _0x59c78b;};'use strict';var _=require('lodash');var util=require(_0x1990('0x0'));var logger=require('../../config/logger')(_0x1990('0x1'));var moment=require(_0x1990('0x2'));var BPromise=require(_0x1990('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1990('0x4'));var rimraf=require(_0x1990('0x5'));var config=require(_0x1990('0x6'));var attributes=require(_0x1990('0x7'));var integrations=require(_0x1990('0x8'));module[_0x1990('0x9')]=function(_0x29f5fb,_0x3c1260){return _0x29f5fb[_0x1990('0xa')](_0x1990('0xb'),attributes,{'tableName':_0x1990('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bae=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x22cb10,_0x20db4f){var _0x38a6f8=function(_0xdb4b16){while(--_0xdb4b16){_0x22cb10['push'](_0x22cb10['shift']());}};_0x38a6f8(++_0x20db4f);}(_0x9bae,0x7c));var _0xe9ba=function(_0x505eb9,_0x3abdc1){_0x505eb9=_0x505eb9-0x0;var _0x3ac1bf=_0x9bae[_0x505eb9];return _0x3ac1bf;};'use strict';var _=require(_0xe9ba('0x0'));var util=require(_0xe9ba('0x1'));var logger=require('../../config/logger')(_0xe9ba('0x2'));var moment=require(_0xe9ba('0x3'));var BPromise=require(_0xe9ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9ba('0x5'));var rimraf=require(_0xe9ba('0x6'));var config=require(_0xe9ba('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xe9ba('0x8'));module[_0xe9ba('0x9')]=function(_0x19bc82,_0x25030e){return _0x19bc82[_0xe9ba('0xa')](_0xe9ba('0xb'),attributes,{'tableName':_0xe9ba('0xc'),'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 13d0177..1a7c0ee 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 _0xbd8e=['result','SalesforceAccount','options','where','include','map','model','attributes','then','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','find','raw','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x4eaf72,_0x306e55){var _0x595136=function(_0x72a57b){while(--_0x72a57b){_0x4eaf72['push'](_0x4eaf72['shift']());}};_0x595136(++_0x306e55);}(_0xbd8e,0x1de));var _0xebd8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbd8e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xebd8('0x0'));var util=require('util');var moment=require(_0xebd8('0x1'));var BPromise=require(_0xebd8('0x2'));var rs=require(_0xebd8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xebd8('0x4'));var logger=require('../../config/logger')(_0xebd8('0x5'));var config=require('../../config/environment');var jayson=require(_0xebd8('0x6'));var client=jayson[_0xebd8('0x7')][_0xebd8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1995e5,_0x3cd56f,_0x4edbd7){return new BPromise(function(_0x133b58,_0x1820db){return client[_0xebd8('0x9')](_0x1995e5,_0x4edbd7)['then'](function(_0x294dcd){logger[_0xebd8('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x3cd56f,'request\x20sent');logger['debug'](_0xebd8('0xb'),_0x3cd56f,_0xebd8('0xc'),JSON['stringify'](_0x294dcd));if(_0x294dcd['error']){if(_0x294dcd[_0xebd8('0xd')][_0xebd8('0xe')]===0x1f4){logger[_0xebd8('0xd')](_0xebd8('0xf'),_0x3cd56f,_0x294dcd['error'][_0xebd8('0x10')]);return _0x1820db(_0x294dcd['error'][_0xebd8('0x10')]);}logger[_0xebd8('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x3cd56f,_0x294dcd[_0xebd8('0xd')][_0xebd8('0x10')]);return _0x133b58(_0x294dcd[_0xebd8('0xd')][_0xebd8('0x10')]);}else{logger[_0xebd8('0xa')](_0xebd8('0xf'),_0x3cd56f,_0xebd8('0xc'));_0x133b58(_0x294dcd[_0xebd8('0x11')][_0xebd8('0x10')]);}})['catch'](function(_0x2f90af){logger[_0xebd8('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x3cd56f,_0x2f90af);_0x1820db(_0x2f90af);});});}exports['GetSalesforceAccount']=function(_0x265656){var _0x55d351=this;return new Promise(function(_0x1ccf46,_0x5d993a){return db[_0xebd8('0x12')]['findAll']({'raw':_0x265656['options']?_0x265656[_0xebd8('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x265656[_0xebd8('0x13')]?_0x265656[_0xebd8('0x13')][_0xebd8('0x14')]||null:null,'attributes':_0x265656['options']?_0x265656[_0xebd8('0x13')]['attributes']||null:null,'limit':_0x265656[_0xebd8('0x13')]?_0x265656['options']['limit']||null:null,'include':_0x265656['options']?_0x265656['options'][_0xebd8('0x15')]?_[_0xebd8('0x16')](_0x265656[_0xebd8('0x13')]['include'],function(_0x405a14){return{'model':db[_0x405a14[_0xebd8('0x17')]],'as':_0x405a14['as'],'attributes':_0x405a14[_0xebd8('0x18')],'include':_0x405a14[_0xebd8('0x15')]?_[_0xebd8('0x16')](_0x405a14[_0xebd8('0x15')],function(_0x49ea27){return{'model':db[_0x49ea27[_0xebd8('0x17')]],'as':_0x49ea27['as'],'attributes':_0x49ea27['attributes'],'include':_0x49ea27[_0xebd8('0x15')]?_[_0xebd8('0x16')](_0x49ea27['include'],function(_0x5854b6){return{'model':db[_0x5854b6['model']],'as':_0x5854b6['as'],'attributes':_0x5854b6[_0xebd8('0x18')]};}):[]};}):[]};}):[]:[]})[_0xebd8('0x19')](function(_0x476526){logger[_0xebd8('0xa')](_0xebd8('0x1a'),_0x265656);logger[_0xebd8('0x1b')]('GetSalesforceAccount',_0x265656,JSON[_0xebd8('0x1c')](_0x476526));_0x1ccf46(_0x476526);})['catch'](function(_0x27f1d5){logger[_0xebd8('0xd')](_0xebd8('0x1a'),_0x27f1d5['message'],_0x265656);_0x5d993a(_0x55d351[_0xebd8('0xd')](0x1f4,_0x27f1d5[_0xebd8('0x10')]));});});};exports[_0xebd8('0x1d')]=function(_0x4d66ff){var _0x2e887e=this;return new Promise(function(_0x51e078,_0xfc0839){return db[_0xebd8('0x12')][_0xebd8('0x1e')]({'raw':_0x4d66ff['options']?_0x4d66ff[_0xebd8('0x13')][_0xebd8('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d66ff[_0xebd8('0x13')]?_0x4d66ff[_0xebd8('0x13')]['where']||null:null,'attributes':_0x4d66ff[_0xebd8('0x13')]?_0x4d66ff[_0xebd8('0x13')][_0xebd8('0x18')]||null:null,'include':_0x4d66ff['options']?_0x4d66ff[_0xebd8('0x13')][_0xebd8('0x15')]?_[_0xebd8('0x16')](_0x4d66ff[_0xebd8('0x13')][_0xebd8('0x15')],function(_0x22b68b){return{'model':db[_0x22b68b[_0xebd8('0x17')]],'as':_0x22b68b['as'],'attributes':_0x22b68b['attributes'],'include':_0x22b68b[_0xebd8('0x15')]?_[_0xebd8('0x16')](_0x22b68b[_0xebd8('0x15')],function(_0x4d37a7){return{'model':db[_0x4d37a7[_0xebd8('0x17')]],'as':_0x4d37a7['as'],'attributes':_0x4d37a7['attributes'],'include':_0x4d37a7['include']?_[_0xebd8('0x16')](_0x4d37a7[_0xebd8('0x15')],function(_0x26d4a0){return{'model':db[_0x26d4a0[_0xebd8('0x17')]],'as':_0x26d4a0['as'],'attributes':_0x26d4a0[_0xebd8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4ded){logger['info']('ShowSalesforceAccount',_0x4d66ff);logger[_0xebd8('0x1b')](_0xebd8('0x1d'),_0x4d66ff,JSON[_0xebd8('0x1c')](_0x1d4ded));_0x51e078(_0x1d4ded);})[_0xebd8('0x20')](function(_0x4472bd){logger[_0xebd8('0xd')]('ShowSalesforceAccount',_0x4472bd[_0xebd8('0x10')],_0x4d66ff);_0xfc0839(_0x2e887e[_0xebd8('0xd')](0x1f4,_0x4472bd[_0xebd8('0x10')]));});});}; \ No newline at end of file +var _0x884f=['model','debug','stringify','catch','ShowSalesforceAccount','find','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','map'];(function(_0x35cabc,_0xc0f89a){var _0x2af2b9=function(_0x7490fb){while(--_0x7490fb){_0x35cabc['push'](_0x35cabc['shift']());}};_0x2af2b9(++_0xc0f89a);}(_0x884f,0x116));var _0xf884=function(_0x48f991,_0x10b662){_0x48f991=_0x48f991-0x0;var _0x4bb1f5=_0x884f[_0x48f991];return _0x4bb1f5;};'use strict';var _=require('lodash');var util=require(_0xf884('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf884('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf884('0x2'))['db'];var utils=require(_0xf884('0x3'));var logger=require('../../config/logger')(_0xf884('0x4'));var config=require(_0xf884('0x5'));var jayson=require(_0xf884('0x6'));var client=jayson[_0xf884('0x7')][_0xf884('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32896a,_0x3c8fef,_0xf0c573){return new BPromise(function(_0x4959fd,_0x503714){return client[_0xf884('0x9')](_0x32896a,_0xf0c573)[_0xf884('0xa')](function(_0x87b240){logger[_0xf884('0xb')](_0xf884('0xc'),_0x3c8fef,_0xf884('0xd'));logger['debug'](_0xf884('0xe'),_0x3c8fef,_0xf884('0xd'),JSON['stringify'](_0x87b240));if(_0x87b240['error']){if(_0x87b240[_0xf884('0xf')][_0xf884('0x10')]===0x1f4){logger['error'](_0xf884('0xc'),_0x3c8fef,_0x87b240[_0xf884('0xf')]['message']);return _0x503714(_0x87b240[_0xf884('0xf')][_0xf884('0x11')]);}logger[_0xf884('0xf')](_0xf884('0xc'),_0x3c8fef,_0x87b240[_0xf884('0xf')][_0xf884('0x11')]);return _0x4959fd(_0x87b240[_0xf884('0xf')][_0xf884('0x11')]);}else{logger[_0xf884('0xb')](_0xf884('0xc'),_0x3c8fef,_0xf884('0xd'));_0x4959fd(_0x87b240[_0xf884('0x12')][_0xf884('0x11')]);}})['catch'](function(_0x2f2afd){logger[_0xf884('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x3c8fef,_0x2f2afd);_0x503714(_0x2f2afd);});});}exports[_0xf884('0x13')]=function(_0x26ba8f){var _0x3610f4=this;return new Promise(function(_0x409a4e,_0x4a44d0){return db[_0xf884('0x14')]['findAll']({'raw':_0x26ba8f[_0xf884('0x15')]?_0x26ba8f[_0xf884('0x15')][_0xf884('0x16')]===undefined?!![]:![]:!![],'where':_0x26ba8f[_0xf884('0x15')]?_0x26ba8f[_0xf884('0x15')][_0xf884('0x17')]||null:null,'attributes':_0x26ba8f[_0xf884('0x15')]?_0x26ba8f['options'][_0xf884('0x18')]||null:null,'limit':_0x26ba8f['options']?_0x26ba8f[_0xf884('0x15')][_0xf884('0x19')]||null:null,'include':_0x26ba8f[_0xf884('0x15')]?_0x26ba8f[_0xf884('0x15')][_0xf884('0x1a')]?_[_0xf884('0x1b')](_0x26ba8f[_0xf884('0x15')][_0xf884('0x1a')],function(_0xfbc55f){return{'model':db[_0xfbc55f[_0xf884('0x1c')]],'as':_0xfbc55f['as'],'attributes':_0xfbc55f[_0xf884('0x18')],'include':_0xfbc55f[_0xf884('0x1a')]?_[_0xf884('0x1b')](_0xfbc55f[_0xf884('0x1a')],function(_0x9c7331){return{'model':db[_0x9c7331['model']],'as':_0x9c7331['as'],'attributes':_0x9c7331[_0xf884('0x18')],'include':_0x9c7331['include']?_[_0xf884('0x1b')](_0x9c7331[_0xf884('0x1a')],function(_0x29d598){return{'model':db[_0x29d598[_0xf884('0x1c')]],'as':_0x29d598['as'],'attributes':_0x29d598['attributes']};}):[]};}):[]};}):[]:[]})[_0xf884('0xa')](function(_0x1b53e0){logger['info'](_0xf884('0x13'),_0x26ba8f);logger[_0xf884('0x1d')](_0xf884('0x13'),_0x26ba8f,JSON[_0xf884('0x1e')](_0x1b53e0));_0x409a4e(_0x1b53e0);})[_0xf884('0x1f')](function(_0x5ce8d1){logger[_0xf884('0xf')](_0xf884('0x13'),_0x5ce8d1[_0xf884('0x11')],_0x26ba8f);_0x4a44d0(_0x3610f4[_0xf884('0xf')](0x1f4,_0x5ce8d1[_0xf884('0x11')]));});});};exports[_0xf884('0x20')]=function(_0x21c3c7){var _0x3c7ae8=this;return new Promise(function(_0xebc592,_0xb6912a){return db[_0xf884('0x14')][_0xf884('0x21')]({'raw':_0x21c3c7[_0xf884('0x15')]?_0x21c3c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x21c3c7[_0xf884('0x15')]?_0x21c3c7[_0xf884('0x15')][_0xf884('0x17')]||null:null,'attributes':_0x21c3c7[_0xf884('0x15')]?_0x21c3c7[_0xf884('0x15')][_0xf884('0x18')]||null:null,'include':_0x21c3c7['options']?_0x21c3c7[_0xf884('0x15')]['include']?_['map'](_0x21c3c7[_0xf884('0x15')][_0xf884('0x1a')],function(_0x1c25d8){return{'model':db[_0x1c25d8['model']],'as':_0x1c25d8['as'],'attributes':_0x1c25d8[_0xf884('0x18')],'include':_0x1c25d8['include']?_[_0xf884('0x1b')](_0x1c25d8[_0xf884('0x1a')],function(_0x2b740f){return{'model':db[_0x2b740f[_0xf884('0x1c')]],'as':_0x2b740f['as'],'attributes':_0x2b740f[_0xf884('0x18')],'include':_0x2b740f[_0xf884('0x1a')]?_['map'](_0x2b740f[_0xf884('0x1a')],function(_0x2a5757){return{'model':db[_0x2a5757[_0xf884('0x1c')]],'as':_0x2a5757['as'],'attributes':_0x2a5757[_0xf884('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf884('0xa')](function(_0x4cdfcb){logger[_0xf884('0xb')](_0xf884('0x20'),_0x21c3c7);logger[_0xf884('0x1d')](_0xf884('0x20'),_0x21c3c7,JSON[_0xf884('0x1e')](_0x4cdfcb));_0xebc592(_0x4cdfcb);})[_0xf884('0x1f')](function(_0x3ca0f7){logger['error'](_0xf884('0x20'),_0x3ca0f7[_0xf884('0x11')],_0x21c3c7);_0xb6912a(_0x3c7ae8[_0xf884('0xf')](0x1f4,_0x3ca0f7[_0xf884('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index eaacc84..5bbb02b 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4c0cbe,_0xfcec6f){var _0x3abd40=function(_0xd1546f){while(--_0xd1546f){_0x4c0cbe['push'](_0x4c0cbe['shift']());}};_0x3abd40(++_0xfcec6f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35282c,_0x7eba5e){_0x35282c=_0x35282c-0x0;var _0x267b6d=_0x5f2f[_0x35282c];return _0x267b6d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _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(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x0b0e[_0x599e60];return _0x468e19;};'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 4d073e3..de70176 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 _0x55ad=['nothing','account','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x55ad,0x19a));var _0xd55a=function(_0x1f2c17,_0x309007){_0x1f2c17=_0x1f2c17-0x0;var _0x1c2adf=_0x55ad[_0x1f2c17];return _0x1c2adf;};'use strict';var Sequelize=require(_0xd55a('0x0'));module[_0xd55a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd55a('0x2')]},'ticketType':{'type':Sequelize[_0xd55a('0x3')](_0xd55a('0x4'),_0xd55a('0x5')),'defaultValue':_0xd55a('0x4')},'moduleSearch':{'type':Sequelize[_0xd55a('0x3')](_0xd55a('0x6'),_0xd55a('0x7'),_0xd55a('0x8'),_0xd55a('0x9'),'account'),'defaultValue':_0xd55a('0x6')},'moduleCreate':{'type':Sequelize[_0xd55a('0x3')](_0xd55a('0xa'),_0xd55a('0x7'),_0xd55a('0x8'),_0xd55a('0xb')),'defaultValue':_0xd55a('0x8')},'leadId':{'type':Sequelize[_0xd55a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd55a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd55a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd55a('0x2')]}}; \ No newline at end of file +var _0x6bdb=['STRING','ENUM','Task','Case','contact','lead','account_contact_lead','contact_lead','nothing','account','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bdb,0xaf));var _0xb6bd=function(_0x4c5ecd,_0x4d5135){_0x4c5ecd=_0x4c5ecd-0x0;var _0x18f443=_0x6bdb[_0x4c5ecd];return _0x18f443;};'use strict';var Sequelize=require(_0xb6bd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb6bd('0x1')]},'ticketType':{'type':Sequelize[_0xb6bd('0x2')](_0xb6bd('0x3'),_0xb6bd('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xb6bd('0x2')]('contact_lead',_0xb6bd('0x5'),_0xb6bd('0x6'),_0xb6bd('0x7'),'account'),'defaultValue':_0xb6bd('0x8')},'moduleCreate':{'type':Sequelize[_0xb6bd('0x2')](_0xb6bd('0x9'),_0xb6bd('0x5'),'lead',_0xb6bd('0xa')),'defaultValue':_0xb6bd('0x6')},'leadId':{'type':Sequelize[_0xb6bd('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xb6bd('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xb6bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d51bdaa..1e21aee 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 _0x315c=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','destroy','then','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','update','findOne','SalesforceField','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x5831cb,_0xa5d29e){var _0xff6e3e=function(_0x7d0959){while(--_0x7d0959){_0x5831cb['push'](_0x5831cb['shift']());}};_0xff6e3e(++_0xa5d29e);}(_0x315c,0xe1));var _0xc315=function(_0x47e970,_0x56640f){_0x47e970=_0x47e970-0x0;var _0x16c5b3=_0x315c[_0x47e970];return _0x16c5b3;};'use strict';var emlformat=require(_0xc315('0x0'));var rimraf=require(_0xc315('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc315('0x2'));var rp=require('request-promise');var moment=require(_0xc315('0x3'));var BPromise=require(_0xc315('0x4'));var Mustache=require(_0xc315('0x5'));var util=require(_0xc315('0x6'));var path=require(_0xc315('0x7'));var sox=require(_0xc315('0x8'));var csv=require(_0xc315('0x9'));var ejs=require(_0xc315('0xa'));var fs=require('fs');var fs_extra=require(_0xc315('0xb'));var _=require(_0xc315('0xc'));var squel=require(_0xc315('0xd'));var crypto=require(_0xc315('0xe'));var jsforce=require(_0xc315('0xf'));var deskjs=require(_0xc315('0x10'));var toCsv=require(_0xc315('0x9'));var querystring=require('querystring');var Papa=require(_0xc315('0x11'));var Redis=require(_0xc315('0x12'));var authService=require(_0xc315('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc315('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc315('0x15'));var utils=require(_0xc315('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc315('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1dba9,_0x4af8cb){_0x4af8cb=_0x4af8cb||0xcc;return function(_0x447c4a){if(_0x447c4a){return _0xd1dba9[_0xc315('0x18')](_0x4af8cb);}return _0xd1dba9['status'](_0x4af8cb)['end']();};}function respondWithResult(_0x5bfbe5,_0x16491c){_0x16491c=_0x16491c||0xc8;return function(_0x173cd0){if(_0x173cd0){return _0x5bfbe5['status'](_0x16491c)['json'](_0x173cd0);}};}function respondWithFilteredResult(_0x42a062,_0x40901e){return function(_0x535e81){if(_0x535e81){var _0x49cfa4=typeof _0x40901e[_0xc315('0x19')]==='undefined'&&typeof _0x40901e[_0xc315('0x1a')]===_0xc315('0x1b');var _0x1115d3=_0x535e81[_0xc315('0x1c')];var _0x4e4bdc=_0x49cfa4?0x0:_0x40901e[_0xc315('0x19')];var _0x39fa89=_0x49cfa4?_0x535e81[_0xc315('0x1c')]:_0x40901e['offset']+_0x40901e[_0xc315('0x1a')];var _0x457f59;if(_0x39fa89>=_0x1115d3){_0x39fa89=_0x1115d3;_0x457f59=0xc8;}else{_0x457f59=0xce;}_0x42a062[_0xc315('0x1d')](_0x457f59);return _0x42a062['set'](_0xc315('0x1e'),_0x4e4bdc+'-'+_0x39fa89+'/'+_0x1115d3)[_0xc315('0x1f')](_0x535e81);}return null;};}function patchUpdates(_0x36bf3b){return function(_0x2ae395){try{jsonpatch[_0xc315('0x20')](_0x2ae395,_0x36bf3b,!![]);}catch(_0x5db060){return BPromise[_0xc315('0x21')](_0x5db060);}return _0x2ae395[_0xc315('0x22')]();};}function saveUpdates(_0xf258cf,_0x285263){return function(_0x2820ab){if(_0x2820ab){return _0x2820ab['update'](_0xf258cf)['then'](function(_0x193279){return _0x193279;});}return null;};}function removeEntity(_0x30041b,_0x49ca2f){return function(_0x1752b2){if(_0x1752b2){return _0x1752b2[_0xc315('0x23')]()[_0xc315('0x24')](function(){_0x30041b['status'](0xcc)[_0xc315('0x25')]();});}};}function handleEntityNotFound(_0x418e84,_0x53dd3d){return function(_0x590540){if(!_0x590540){_0x418e84[_0xc315('0x18')](0x194);}return _0x590540;};}function handleError(_0x274264,_0x5072f2){_0x5072f2=_0x5072f2||0x1f4;return function(_0x111829){logger['error'](_0x111829[_0xc315('0x26')]);if(_0x111829['name']){delete _0x111829[_0xc315('0x27')];}_0x274264['status'](_0x5072f2)[_0xc315('0x28')](_0x111829);};}exports[_0xc315('0x29')]=function(_0x12cf9c,_0x5d23ad){var _0x59471c={},_0x594313={},_0x2d3766={'count':0x0,'rows':[]};var _0x1e975e=_[_0xc315('0x2a')](db[_0xc315('0x2b')][_0xc315('0x2c')],function(_0x5d114b){return{'name':_0x5d114b[_0xc315('0x2d')],'type':_0x5d114b[_0xc315('0x2e')]['key']};});_0x594313['model']=_[_0xc315('0x2a')](_0x1e975e,'name');_0x594313['query']=_[_0xc315('0x2f')](_0x12cf9c[_0xc315('0x30')]);_0x594313[_0xc315('0x31')]=_['intersection'](_0x594313['model'],_0x594313['query']);_0x59471c['attributes']=_['intersection'](_0x594313[_0xc315('0x32')],qs[_0xc315('0x33')](_0x12cf9c[_0xc315('0x30')][_0xc315('0x33')]));_0x59471c[_0xc315('0x34')]=_0x59471c[_0xc315('0x34')][_0xc315('0x35')]?_0x59471c[_0xc315('0x34')]:_0x594313[_0xc315('0x32')];if(!_0x12cf9c[_0xc315('0x30')][_0xc315('0x36')](_0xc315('0x37'))){_0x59471c[_0xc315('0x1a')]=qs[_0xc315('0x1a')](_0x12cf9c[_0xc315('0x30')][_0xc315('0x1a')]);_0x59471c[_0xc315('0x19')]=qs[_0xc315('0x19')](_0x12cf9c['query']['offset']);}_0x59471c[_0xc315('0x38')]=qs[_0xc315('0x39')](_0x12cf9c[_0xc315('0x30')]['sort']);_0x59471c[_0xc315('0x3a')]=qs['filters'](_['pick'](_0x12cf9c['query'],_0x594313[_0xc315('0x31')]),_0x1e975e);if(_0x12cf9c[_0xc315('0x30')][_0xc315('0x3b')]){_0x59471c[_0xc315('0x3a')]=_[_0xc315('0x3c')](_0x59471c[_0xc315('0x3a')],{'$or':_[_0xc315('0x2a')](_0x1e975e,function(_0x3c119f){if(_0x3c119f[_0xc315('0x2e')]!=='VIRTUAL'){var _0x46710e={};_0x46710e[_0x3c119f['name']]={'$like':'%'+_0x12cf9c['query'][_0xc315('0x3b')]+'%'};return _0x46710e;}})});}_0x59471c=_[_0xc315('0x3c')]({},_0x59471c,_0x12cf9c[_0xc315('0x3d')]);var _0x3e9b98={'where':_0x59471c[_0xc315('0x3a')]};return db[_0xc315('0x2b')]['count'](_0x3e9b98)['then'](function(_0x4abc57){_0x2d3766[_0xc315('0x1c')]=_0x4abc57;if(_0x12cf9c[_0xc315('0x30')][_0xc315('0x3e')]){_0x59471c[_0xc315('0x3f')]=[{'all':!![]}];}return db[_0xc315('0x2b')]['findAll'](_0x59471c);})['then'](function(_0x57da38){_0x2d3766['rows']=_0x57da38;return _0x2d3766;})[_0xc315('0x24')](respondWithFilteredResult(_0x5d23ad,_0x59471c))[_0xc315('0x40')](handleError(_0x5d23ad,null));};exports[_0xc315('0x41')]=function(_0x5a5e06,_0x112937){var _0x368a0e={'raw':![],'where':{'id':_0x5a5e06[_0xc315('0x42')]['id']}},_0x4825ac={};_0x4825ac[_0xc315('0x32')]=_[_0xc315('0x2f')](db['SalesforceConfiguration'][_0xc315('0x2c')]);_0x4825ac[_0xc315('0x30')]=_[_0xc315('0x2f')](_0x5a5e06[_0xc315('0x30')]);_0x4825ac[_0xc315('0x31')]=_['intersection'](_0x4825ac[_0xc315('0x32')],_0x4825ac[_0xc315('0x30')]);_0x368a0e[_0xc315('0x34')]=_[_0xc315('0x43')](_0x4825ac[_0xc315('0x32')],qs[_0xc315('0x33')](_0x5a5e06[_0xc315('0x30')]['fields']));_0x368a0e[_0xc315('0x34')]=_0x368a0e[_0xc315('0x34')][_0xc315('0x35')]?_0x368a0e[_0xc315('0x34')]:_0x4825ac[_0xc315('0x32')];if(_0x5a5e06[_0xc315('0x30')][_0xc315('0x3e')]){_0x368a0e[_0xc315('0x3f')]=[{'all':!![]}];}_0x368a0e=_[_0xc315('0x3c')]({},_0x368a0e,_0x5a5e06[_0xc315('0x3d')]);return db[_0xc315('0x2b')][_0xc315('0x44')](_0x368a0e)[_0xc315('0x24')](handleEntityNotFound(_0x112937,null))['then'](respondWithResult(_0x112937,null))[_0xc315('0x40')](handleError(_0x112937,null));};exports[_0xc315('0x45')]=function(_0x4fff18,_0xa8424d){return db['SalesforceConfiguration'][_0xc315('0x45')](_0x4fff18[_0xc315('0x46')],{})[_0xc315('0x24')](respondWithResult(_0xa8424d,0xc9))[_0xc315('0x40')](handleError(_0xa8424d,null));};exports[_0xc315('0x47')]=function(_0x2df45d,_0x37a849){if(_0x2df45d[_0xc315('0x46')]['id']){delete _0x2df45d[_0xc315('0x46')]['id'];}return db[_0xc315('0x2b')][_0xc315('0x44')]({'where':{'id':_0x2df45d[_0xc315('0x42')]['id']}})[_0xc315('0x24')](handleEntityNotFound(_0x37a849,null))[_0xc315('0x24')](saveUpdates(_0x2df45d['body'],null))[_0xc315('0x24')](respondWithResult(_0x37a849,null))[_0xc315('0x40')](handleError(_0x37a849,null));};exports['destroy']=function(_0x10a235,_0x69d0c2){return db[_0xc315('0x2b')][_0xc315('0x44')]({'where':{'id':_0x10a235[_0xc315('0x42')]['id']}})[_0xc315('0x24')](handleEntityNotFound(_0x69d0c2,null))[_0xc315('0x24')](removeEntity(_0x69d0c2,null))[_0xc315('0x40')](handleError(_0x69d0c2,null));};exports['getFields']=function(_0x25c66c,_0x4cd59d,_0x380c60){var _0x145cae={};var _0x3763a3={};var _0x5730bd;var _0x5518f2;return db['SalesforceConfiguration'][_0xc315('0x48')]({'where':{'id':_0x25c66c[_0xc315('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cd59d,null))[_0xc315('0x24')](function(_0x16fd4b){if(_0x16fd4b){_0x5730bd=_0x16fd4b;_0x3763a3['model']=_[_0xc315('0x2f')](db[_0xc315('0x49')]['rawAttributes']);_0x3763a3[_0xc315('0x30')]=_[_0xc315('0x2f')](_0x25c66c[_0xc315('0x30')]);_0x3763a3[_0xc315('0x31')]=_['intersection'](_0x3763a3[_0xc315('0x32')],_0x3763a3[_0xc315('0x30')]);_0x145cae[_0xc315('0x34')]=_[_0xc315('0x43')](_0x3763a3['model'],qs[_0xc315('0x33')](_0x25c66c[_0xc315('0x30')][_0xc315('0x33')]));_0x145cae[_0xc315('0x34')]=_0x145cae[_0xc315('0x34')][_0xc315('0x35')]?_0x145cae[_0xc315('0x34')]:_0x3763a3['model'];_0x145cae[_0xc315('0x38')]=qs[_0xc315('0x39')](_0x25c66c['query'][_0xc315('0x39')]);_0x145cae[_0xc315('0x3a')]=qs[_0xc315('0x31')](_[_0xc315('0x4a')](_0x25c66c['query'],_0x3763a3[_0xc315('0x31')]));if(_0x25c66c['query'][_0xc315('0x3b')]){_0x145cae[_0xc315('0x3a')]=_['merge'](_0x145cae[_0xc315('0x3a')],{'$or':_[_0xc315('0x2a')](_0x145cae['attributes'],function(_0x4a860f){var _0x1a88ae={};_0x1a88ae[_0x4a860f]={'$like':'%'+_0x25c66c[_0xc315('0x30')][_0xc315('0x3b')]+'%'};return _0x1a88ae;})});}_0x145cae=_[_0xc315('0x3c')]({},_0x145cae,_0x25c66c[_0xc315('0x3d')]);return _0x5730bd['getFields'](_0x145cae);}})[_0xc315('0x24')](function(_0x2a84c2){if(_0x2a84c2){_0x5518f2=_0x2a84c2[_0xc315('0x35')];if(!_0x25c66c[_0xc315('0x30')][_0xc315('0x36')](_0xc315('0x37'))){_0x145cae[_0xc315('0x1a')]=qs[_0xc315('0x1a')](_0x25c66c[_0xc315('0x30')][_0xc315('0x1a')]);_0x145cae[_0xc315('0x19')]=qs['offset'](_0x25c66c[_0xc315('0x30')][_0xc315('0x19')]);}return _0x5730bd[_0xc315('0x4b')](_0x145cae);}})[_0xc315('0x24')](function(_0xafbba){if(_0xafbba){return _0xafbba?{'count':_0x5518f2,'rows':_0xafbba}:null;}})['then'](respondWithResult(_0x4cd59d,null))['catch'](handleError(_0x4cd59d,null));};exports[_0xc315('0x4c')]=function(_0x4c3532,_0x3a21f8,_0x1bd5c4){var _0x350c9f={};var _0x189c53={};var _0x10c9a3;var _0x5c2640;return db[_0xc315('0x2b')][_0xc315('0x48')]({'where':{'id':_0x4c3532[_0xc315('0x42')]['id']}})[_0xc315('0x24')](handleEntityNotFound(_0x3a21f8,null))[_0xc315('0x24')](function(_0x3276a9){if(_0x3276a9){_0x10c9a3=_0x3276a9;_0x189c53[_0xc315('0x32')]=_[_0xc315('0x2f')](db[_0xc315('0x49')]['rawAttributes']);_0x189c53[_0xc315('0x30')]=_[_0xc315('0x2f')](_0x4c3532[_0xc315('0x30')]);_0x189c53['filters']=_['intersection'](_0x189c53['model'],_0x189c53[_0xc315('0x30')]);_0x350c9f[_0xc315('0x34')]=_[_0xc315('0x43')](_0x189c53[_0xc315('0x32')],qs['fields'](_0x4c3532[_0xc315('0x30')][_0xc315('0x33')]));_0x350c9f['attributes']=_0x350c9f[_0xc315('0x34')]['length']?_0x350c9f['attributes']:_0x189c53[_0xc315('0x32')];_0x350c9f['order']=qs['sort'](_0x4c3532[_0xc315('0x30')]['sort']);_0x350c9f[_0xc315('0x3a')]=qs[_0xc315('0x31')](_['pick'](_0x4c3532[_0xc315('0x30')],_0x189c53[_0xc315('0x31')]));if(_0x4c3532['query'][_0xc315('0x3b')]){_0x350c9f[_0xc315('0x3a')]=_[_0xc315('0x3c')](_0x350c9f['where'],{'$or':_[_0xc315('0x2a')](_0x350c9f['attributes'],function(_0x469104){var _0x2ca5c3={};_0x2ca5c3[_0x469104]={'$like':'%'+_0x4c3532['query']['filter']+'%'};return _0x2ca5c3;})});}_0x350c9f=_[_0xc315('0x3c')]({},_0x350c9f,_0x4c3532[_0xc315('0x3d')]);return _0x10c9a3['getSubjects'](_0x350c9f);}})[_0xc315('0x24')](function(_0x12c1fb){if(_0x12c1fb){_0x5c2640=_0x12c1fb['length'];if(!_0x4c3532[_0xc315('0x30')][_0xc315('0x36')](_0xc315('0x37'))){_0x350c9f[_0xc315('0x1a')]=qs[_0xc315('0x1a')](_0x4c3532[_0xc315('0x30')][_0xc315('0x1a')]);_0x350c9f['offset']=qs[_0xc315('0x19')](_0x4c3532[_0xc315('0x30')][_0xc315('0x19')]);}return _0x10c9a3[_0xc315('0x4c')](_0x350c9f);}})[_0xc315('0x24')](function(_0x4c8e00){if(_0x4c8e00){return _0x4c8e00?{'count':_0x5c2640,'rows':_0x4c8e00}:null;}})['then'](respondWithResult(_0x3a21f8,null))[_0xc315('0x40')](handleError(_0x3a21f8,null));};exports[_0xc315('0x4d')]=function(_0x524ce6,_0x30966e,_0x50bf32){var _0x3e7d14={};var _0x2a187b={};var _0x52430e;var _0x21a406;return db[_0xc315('0x2b')][_0xc315('0x48')]({'where':{'id':_0x524ce6[_0xc315('0x42')]['id']}})[_0xc315('0x24')](handleEntityNotFound(_0x30966e,null))[_0xc315('0x24')](function(_0x5d5572){if(_0x5d5572){_0x52430e=_0x5d5572;_0x2a187b[_0xc315('0x32')]=_[_0xc315('0x2f')](db[_0xc315('0x49')][_0xc315('0x2c')]);_0x2a187b[_0xc315('0x30')]=_[_0xc315('0x2f')](_0x524ce6[_0xc315('0x30')]);_0x2a187b[_0xc315('0x31')]=_[_0xc315('0x43')](_0x2a187b['model'],_0x2a187b[_0xc315('0x30')]);_0x3e7d14[_0xc315('0x34')]=_['intersection'](_0x2a187b[_0xc315('0x32')],qs[_0xc315('0x33')](_0x524ce6[_0xc315('0x30')][_0xc315('0x33')]));_0x3e7d14[_0xc315('0x34')]=_0x3e7d14[_0xc315('0x34')]['length']?_0x3e7d14[_0xc315('0x34')]:_0x2a187b['model'];_0x3e7d14[_0xc315('0x38')]=qs[_0xc315('0x39')](_0x524ce6['query'][_0xc315('0x39')]);_0x3e7d14[_0xc315('0x3a')]=qs[_0xc315('0x31')](_[_0xc315('0x4a')](_0x524ce6['query'],_0x2a187b[_0xc315('0x31')]));if(_0x524ce6['query'][_0xc315('0x3b')]){_0x3e7d14['where']=_[_0xc315('0x3c')](_0x3e7d14[_0xc315('0x3a')],{'$or':_['map'](_0x3e7d14[_0xc315('0x34')],function(_0x5ae402){var _0x100179={};_0x100179[_0x5ae402]={'$like':'%'+_0x524ce6[_0xc315('0x30')][_0xc315('0x3b')]+'%'};return _0x100179;})});}_0x3e7d14=_[_0xc315('0x3c')]({},_0x3e7d14,_0x524ce6[_0xc315('0x3d')]);return _0x52430e[_0xc315('0x4d')](_0x3e7d14);}})[_0xc315('0x24')](function(_0x12bf86){if(_0x12bf86){_0x21a406=_0x12bf86[_0xc315('0x35')];if(!_0x524ce6[_0xc315('0x30')][_0xc315('0x36')](_0xc315('0x37'))){_0x3e7d14['limit']=qs[_0xc315('0x1a')](_0x524ce6[_0xc315('0x30')]['limit']);_0x3e7d14[_0xc315('0x19')]=qs[_0xc315('0x19')](_0x524ce6[_0xc315('0x30')][_0xc315('0x19')]);}return _0x52430e[_0xc315('0x4d')](_0x3e7d14);}})['then'](function(_0x4683bd){if(_0x4683bd){return _0x4683bd?{'count':_0x21a406,'rows':_0x4683bd}:null;}})[_0xc315('0x24')](respondWithResult(_0x30966e,null))['catch'](handleError(_0x30966e,null));}; \ No newline at end of file +var _0xbd85=['sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','merge','options','include','rows','catch','show','create','body','find','destroy','params','getFields','findOne','SalesforceField','order','pick','filter','hasOwnProperty','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbd85,0x1f4));var _0x5bd8=function(_0xefdc1c,_0x10f40b){_0xefdc1c=_0xefdc1c-0x0;var _0x48581c=_0xbd85[_0xefdc1c];return _0x48581c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bd8('0x0'));var zipdir=require(_0x5bd8('0x1'));var jsonpatch=require(_0x5bd8('0x2'));var rp=require('request-promise');var moment=require(_0x5bd8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bd8('0x4'));var util=require(_0x5bd8('0x5'));var path=require('path');var sox=require(_0x5bd8('0x6'));var csv=require(_0x5bd8('0x7'));var ejs=require(_0x5bd8('0x8'));var fs=require('fs');var fs_extra=require(_0x5bd8('0x9'));var _=require(_0x5bd8('0xa'));var squel=require('squel');var crypto=require(_0x5bd8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bd8('0x7'));var querystring=require('querystring');var Papa=require(_0x5bd8('0xc'));var Redis=require('ioredis');var authService=require(_0x5bd8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5bd8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd8('0xf'))(_0x5bd8('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5bd8('0x11'))['db'];function respondWithStatusCode(_0x26dd59,_0x3666b7){_0x3666b7=_0x3666b7||0xcc;return function(_0x1b0767){if(_0x1b0767){return _0x26dd59[_0x5bd8('0x12')](_0x3666b7);}return _0x26dd59['status'](_0x3666b7)[_0x5bd8('0x13')]();};}function respondWithResult(_0x5266a5,_0x4bf4d6){_0x4bf4d6=_0x4bf4d6||0xc8;return function(_0x4a9d0a){if(_0x4a9d0a){return _0x5266a5[_0x5bd8('0x14')](_0x4bf4d6)['json'](_0x4a9d0a);}};}function respondWithFilteredResult(_0x1c4244,_0x40d423){return function(_0x59e54d){if(_0x59e54d){var _0x26ba74=typeof _0x40d423[_0x5bd8('0x15')]===_0x5bd8('0x16')&&typeof _0x40d423[_0x5bd8('0x17')]===_0x5bd8('0x16');var _0x241bf4=_0x59e54d[_0x5bd8('0x18')];var _0x1cb6cd=_0x26ba74?0x0:_0x40d423[_0x5bd8('0x15')];var _0x194819=_0x26ba74?_0x59e54d[_0x5bd8('0x18')]:_0x40d423['offset']+_0x40d423['limit'];var _0x4ced79;if(_0x194819>=_0x241bf4){_0x194819=_0x241bf4;_0x4ced79=0xc8;}else{_0x4ced79=0xce;}_0x1c4244[_0x5bd8('0x14')](_0x4ced79);return _0x1c4244[_0x5bd8('0x19')](_0x5bd8('0x1a'),_0x1cb6cd+'-'+_0x194819+'/'+_0x241bf4)[_0x5bd8('0x1b')](_0x59e54d);}return null;};}function patchUpdates(_0x4c0d29){return function(_0x7a6265){try{jsonpatch[_0x5bd8('0x1c')](_0x7a6265,_0x4c0d29,!![]);}catch(_0x328b20){return BPromise[_0x5bd8('0x1d')](_0x328b20);}return _0x7a6265['save']();};}function saveUpdates(_0x10c74c,_0x55c395){return function(_0x35a49f){if(_0x35a49f){return _0x35a49f[_0x5bd8('0x1e')](_0x10c74c)[_0x5bd8('0x1f')](function(_0x818127){return _0x818127;});}return null;};}function removeEntity(_0x268493,_0x122104){return function(_0x52c6a6){if(_0x52c6a6){return _0x52c6a6['destroy']()[_0x5bd8('0x1f')](function(){_0x268493[_0x5bd8('0x14')](0xcc)[_0x5bd8('0x13')]();});}};}function handleEntityNotFound(_0x466727,_0x3a53d5){return function(_0x1ba144){if(!_0x1ba144){_0x466727[_0x5bd8('0x12')](0x194);}return _0x1ba144;};}function handleError(_0xcaa2fd,_0x5905df){_0x5905df=_0x5905df||0x1f4;return function(_0x32d5ee){logger[_0x5bd8('0x20')](_0x32d5ee[_0x5bd8('0x21')]);if(_0x32d5ee['name']){delete _0x32d5ee[_0x5bd8('0x22')];}_0xcaa2fd['status'](_0x5905df)[_0x5bd8('0x23')](_0x32d5ee);};}exports[_0x5bd8('0x24')]=function(_0x5a6edd,_0x334c53){var _0x10e238={},_0x5abf50={},_0x136de9={'count':0x0,'rows':[]};var _0x5e6fa6=_[_0x5bd8('0x25')](db[_0x5bd8('0x26')][_0x5bd8('0x27')],function(_0xfa9d2e){return{'name':_0xfa9d2e[_0x5bd8('0x28')],'type':_0xfa9d2e[_0x5bd8('0x29')][_0x5bd8('0x2a')]};});_0x5abf50[_0x5bd8('0x2b')]=_[_0x5bd8('0x25')](_0x5e6fa6,_0x5bd8('0x22'));_0x5abf50[_0x5bd8('0x2c')]=_[_0x5bd8('0x2d')](_0x5a6edd['query']);_0x5abf50[_0x5bd8('0x2e')]=_[_0x5bd8('0x2f')](_0x5abf50[_0x5bd8('0x2b')],_0x5abf50[_0x5bd8('0x2c')]);_0x10e238['attributes']=_[_0x5bd8('0x2f')](_0x5abf50[_0x5bd8('0x2b')],qs['fields'](_0x5a6edd[_0x5bd8('0x2c')][_0x5bd8('0x30')]));_0x10e238[_0x5bd8('0x31')]=_0x10e238[_0x5bd8('0x31')][_0x5bd8('0x32')]?_0x10e238[_0x5bd8('0x31')]:_0x5abf50[_0x5bd8('0x2b')];if(!_0x5a6edd[_0x5bd8('0x2c')]['hasOwnProperty']('nolimit')){_0x10e238['limit']=qs['limit'](_0x5a6edd[_0x5bd8('0x2c')][_0x5bd8('0x17')]);_0x10e238['offset']=qs[_0x5bd8('0x15')](_0x5a6edd[_0x5bd8('0x2c')][_0x5bd8('0x15')]);}_0x10e238['order']=qs[_0x5bd8('0x33')](_0x5a6edd[_0x5bd8('0x2c')][_0x5bd8('0x33')]);_0x10e238[_0x5bd8('0x34')]=qs[_0x5bd8('0x2e')](_['pick'](_0x5a6edd['query'],_0x5abf50[_0x5bd8('0x2e')]),_0x5e6fa6);if(_0x5a6edd[_0x5bd8('0x2c')]['filter']){_0x10e238['where']=_[_0x5bd8('0x35')](_0x10e238['where'],{'$or':_[_0x5bd8('0x25')](_0x5e6fa6,function(_0x5f3f1c){if(_0x5f3f1c[_0x5bd8('0x29')]!=='VIRTUAL'){var _0x2c6c53={};_0x2c6c53[_0x5f3f1c[_0x5bd8('0x22')]]={'$like':'%'+_0x5a6edd[_0x5bd8('0x2c')]['filter']+'%'};return _0x2c6c53;}})});}_0x10e238=_['merge']({},_0x10e238,_0x5a6edd[_0x5bd8('0x36')]);var _0x482359={'where':_0x10e238[_0x5bd8('0x34')]};return db['SalesforceConfiguration'][_0x5bd8('0x18')](_0x482359)[_0x5bd8('0x1f')](function(_0x353efc){_0x136de9[_0x5bd8('0x18')]=_0x353efc;if(_0x5a6edd[_0x5bd8('0x2c')]['includeAll']){_0x10e238[_0x5bd8('0x37')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x10e238);})[_0x5bd8('0x1f')](function(_0x212cc6){_0x136de9[_0x5bd8('0x38')]=_0x212cc6;return _0x136de9;})[_0x5bd8('0x1f')](respondWithFilteredResult(_0x334c53,_0x10e238))[_0x5bd8('0x39')](handleError(_0x334c53,null));};exports[_0x5bd8('0x3a')]=function(_0x1ef11e,_0xbf683e){var _0x56daa2={'raw':![],'where':{'id':_0x1ef11e['params']['id']}},_0x1847c0={};_0x1847c0[_0x5bd8('0x2b')]=_[_0x5bd8('0x2d')](db['SalesforceConfiguration'][_0x5bd8('0x27')]);_0x1847c0[_0x5bd8('0x2c')]=_[_0x5bd8('0x2d')](_0x1ef11e[_0x5bd8('0x2c')]);_0x1847c0[_0x5bd8('0x2e')]=_[_0x5bd8('0x2f')](_0x1847c0[_0x5bd8('0x2b')],_0x1847c0[_0x5bd8('0x2c')]);_0x56daa2[_0x5bd8('0x31')]=_['intersection'](_0x1847c0[_0x5bd8('0x2b')],qs[_0x5bd8('0x30')](_0x1ef11e[_0x5bd8('0x2c')][_0x5bd8('0x30')]));_0x56daa2[_0x5bd8('0x31')]=_0x56daa2[_0x5bd8('0x31')][_0x5bd8('0x32')]?_0x56daa2[_0x5bd8('0x31')]:_0x1847c0['model'];if(_0x1ef11e[_0x5bd8('0x2c')]['includeAll']){_0x56daa2[_0x5bd8('0x37')]=[{'all':!![]}];}_0x56daa2=_[_0x5bd8('0x35')]({},_0x56daa2,_0x1ef11e[_0x5bd8('0x36')]);return db[_0x5bd8('0x26')]['find'](_0x56daa2)[_0x5bd8('0x1f')](handleEntityNotFound(_0xbf683e,null))[_0x5bd8('0x1f')](respondWithResult(_0xbf683e,null))[_0x5bd8('0x39')](handleError(_0xbf683e,null));};exports[_0x5bd8('0x3b')]=function(_0x1e6cb9,_0x3856cd){return db[_0x5bd8('0x26')]['create'](_0x1e6cb9[_0x5bd8('0x3c')],{})['then'](respondWithResult(_0x3856cd,0xc9))['catch'](handleError(_0x3856cd,null));};exports[_0x5bd8('0x1e')]=function(_0x193eca,_0x13c254){if(_0x193eca[_0x5bd8('0x3c')]['id']){delete _0x193eca['body']['id'];}return db['SalesforceConfiguration'][_0x5bd8('0x3d')]({'where':{'id':_0x193eca['params']['id']}})['then'](handleEntityNotFound(_0x13c254,null))[_0x5bd8('0x1f')](saveUpdates(_0x193eca[_0x5bd8('0x3c')],null))['then'](respondWithResult(_0x13c254,null))['catch'](handleError(_0x13c254,null));};exports[_0x5bd8('0x3e')]=function(_0x2af849,_0x2a2b65){return db['SalesforceConfiguration'][_0x5bd8('0x3d')]({'where':{'id':_0x2af849[_0x5bd8('0x3f')]['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x2a2b65,null))[_0x5bd8('0x1f')](removeEntity(_0x2a2b65,null))['catch'](handleError(_0x2a2b65,null));};exports[_0x5bd8('0x40')]=function(_0x17df54,_0x3081ae,_0x4f5c63){var _0x5d99ba={};var _0x5010dc={};var _0x310975;var _0x24753f;return db[_0x5bd8('0x26')][_0x5bd8('0x41')]({'where':{'id':_0x17df54[_0x5bd8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3081ae,null))[_0x5bd8('0x1f')](function(_0x17fc5f){if(_0x17fc5f){_0x310975=_0x17fc5f;_0x5010dc[_0x5bd8('0x2b')]=_['keys'](db[_0x5bd8('0x42')][_0x5bd8('0x27')]);_0x5010dc[_0x5bd8('0x2c')]=_[_0x5bd8('0x2d')](_0x17df54['query']);_0x5010dc[_0x5bd8('0x2e')]=_['intersection'](_0x5010dc[_0x5bd8('0x2b')],_0x5010dc[_0x5bd8('0x2c')]);_0x5d99ba[_0x5bd8('0x31')]=_[_0x5bd8('0x2f')](_0x5010dc[_0x5bd8('0x2b')],qs['fields'](_0x17df54['query'][_0x5bd8('0x30')]));_0x5d99ba['attributes']=_0x5d99ba[_0x5bd8('0x31')]['length']?_0x5d99ba[_0x5bd8('0x31')]:_0x5010dc[_0x5bd8('0x2b')];_0x5d99ba[_0x5bd8('0x43')]=qs[_0x5bd8('0x33')](_0x17df54[_0x5bd8('0x2c')][_0x5bd8('0x33')]);_0x5d99ba[_0x5bd8('0x34')]=qs[_0x5bd8('0x2e')](_[_0x5bd8('0x44')](_0x17df54[_0x5bd8('0x2c')],_0x5010dc['filters']));if(_0x17df54['query'][_0x5bd8('0x45')]){_0x5d99ba[_0x5bd8('0x34')]=_['merge'](_0x5d99ba['where'],{'$or':_[_0x5bd8('0x25')](_0x5d99ba[_0x5bd8('0x31')],function(_0x16bd4){var _0x5d67f9={};_0x5d67f9[_0x16bd4]={'$like':'%'+_0x17df54[_0x5bd8('0x2c')][_0x5bd8('0x45')]+'%'};return _0x5d67f9;})});}_0x5d99ba=_[_0x5bd8('0x35')]({},_0x5d99ba,_0x17df54[_0x5bd8('0x36')]);return _0x310975[_0x5bd8('0x40')](_0x5d99ba);}})['then'](function(_0x32f028){if(_0x32f028){_0x24753f=_0x32f028[_0x5bd8('0x32')];if(!_0x17df54[_0x5bd8('0x2c')][_0x5bd8('0x46')](_0x5bd8('0x47'))){_0x5d99ba[_0x5bd8('0x17')]=qs['limit'](_0x17df54[_0x5bd8('0x2c')][_0x5bd8('0x17')]);_0x5d99ba[_0x5bd8('0x15')]=qs[_0x5bd8('0x15')](_0x17df54[_0x5bd8('0x2c')][_0x5bd8('0x15')]);}return _0x310975['getFields'](_0x5d99ba);}})[_0x5bd8('0x1f')](function(_0x23cc05){if(_0x23cc05){return _0x23cc05?{'count':_0x24753f,'rows':_0x23cc05}:null;}})['then'](respondWithResult(_0x3081ae,null))['catch'](handleError(_0x3081ae,null));};exports[_0x5bd8('0x48')]=function(_0x4e3aad,_0x59bf54,_0x3af9fe){var _0x2bc260={};var _0x490aaa={};var _0x590c95;var _0x11a88a;return db[_0x5bd8('0x26')][_0x5bd8('0x41')]({'where':{'id':_0x4e3aad[_0x5bd8('0x3f')]['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x59bf54,null))[_0x5bd8('0x1f')](function(_0xb71b08){if(_0xb71b08){_0x590c95=_0xb71b08;_0x490aaa[_0x5bd8('0x2b')]=_[_0x5bd8('0x2d')](db['SalesforceField']['rawAttributes']);_0x490aaa['query']=_[_0x5bd8('0x2d')](_0x4e3aad[_0x5bd8('0x2c')]);_0x490aaa[_0x5bd8('0x2e')]=_['intersection'](_0x490aaa[_0x5bd8('0x2b')],_0x490aaa[_0x5bd8('0x2c')]);_0x2bc260['attributes']=_['intersection'](_0x490aaa[_0x5bd8('0x2b')],qs[_0x5bd8('0x30')](_0x4e3aad[_0x5bd8('0x2c')]['fields']));_0x2bc260[_0x5bd8('0x31')]=_0x2bc260['attributes']['length']?_0x2bc260['attributes']:_0x490aaa['model'];_0x2bc260[_0x5bd8('0x43')]=qs[_0x5bd8('0x33')](_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x33')]);_0x2bc260['where']=qs[_0x5bd8('0x2e')](_[_0x5bd8('0x44')](_0x4e3aad[_0x5bd8('0x2c')],_0x490aaa[_0x5bd8('0x2e')]));if(_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x45')]){_0x2bc260['where']=_['merge'](_0x2bc260[_0x5bd8('0x34')],{'$or':_['map'](_0x2bc260[_0x5bd8('0x31')],function(_0x1e9c96){var _0x5328a5={};_0x5328a5[_0x1e9c96]={'$like':'%'+_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x45')]+'%'};return _0x5328a5;})});}_0x2bc260=_['merge']({},_0x2bc260,_0x4e3aad['options']);return _0x590c95[_0x5bd8('0x48')](_0x2bc260);}})[_0x5bd8('0x1f')](function(_0x132ccc){if(_0x132ccc){_0x11a88a=_0x132ccc[_0x5bd8('0x32')];if(!_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x46')](_0x5bd8('0x47'))){_0x2bc260[_0x5bd8('0x17')]=qs[_0x5bd8('0x17')](_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x17')]);_0x2bc260[_0x5bd8('0x15')]=qs[_0x5bd8('0x15')](_0x4e3aad[_0x5bd8('0x2c')][_0x5bd8('0x15')]);}return _0x590c95[_0x5bd8('0x48')](_0x2bc260);}})['then'](function(_0xa0c847){if(_0xa0c847){return _0xa0c847?{'count':_0x11a88a,'rows':_0xa0c847}:null;}})['then'](respondWithResult(_0x59bf54,null))[_0x5bd8('0x39')](handleError(_0x59bf54,null));};exports[_0x5bd8('0x49')]=function(_0x205804,_0x2e6405,_0x201957){var _0x56eb80={};var _0x354925={};var _0x3488d6;var _0x4df4ec;return db[_0x5bd8('0x26')][_0x5bd8('0x41')]({'where':{'id':_0x205804['params']['id']}})['then'](handleEntityNotFound(_0x2e6405,null))['then'](function(_0x1dff70){if(_0x1dff70){_0x3488d6=_0x1dff70;_0x354925[_0x5bd8('0x2b')]=_[_0x5bd8('0x2d')](db[_0x5bd8('0x42')]['rawAttributes']);_0x354925['query']=_[_0x5bd8('0x2d')](_0x205804[_0x5bd8('0x2c')]);_0x354925[_0x5bd8('0x2e')]=_[_0x5bd8('0x2f')](_0x354925[_0x5bd8('0x2b')],_0x354925[_0x5bd8('0x2c')]);_0x56eb80[_0x5bd8('0x31')]=_[_0x5bd8('0x2f')](_0x354925['model'],qs[_0x5bd8('0x30')](_0x205804[_0x5bd8('0x2c')][_0x5bd8('0x30')]));_0x56eb80[_0x5bd8('0x31')]=_0x56eb80['attributes'][_0x5bd8('0x32')]?_0x56eb80[_0x5bd8('0x31')]:_0x354925['model'];_0x56eb80[_0x5bd8('0x43')]=qs[_0x5bd8('0x33')](_0x205804['query']['sort']);_0x56eb80[_0x5bd8('0x34')]=qs[_0x5bd8('0x2e')](_[_0x5bd8('0x44')](_0x205804[_0x5bd8('0x2c')],_0x354925[_0x5bd8('0x2e')]));if(_0x205804[_0x5bd8('0x2c')][_0x5bd8('0x45')]){_0x56eb80['where']=_[_0x5bd8('0x35')](_0x56eb80[_0x5bd8('0x34')],{'$or':_[_0x5bd8('0x25')](_0x56eb80[_0x5bd8('0x31')],function(_0x32af92){var _0x50bd55={};_0x50bd55[_0x32af92]={'$like':'%'+_0x205804[_0x5bd8('0x2c')][_0x5bd8('0x45')]+'%'};return _0x50bd55;})});}_0x56eb80=_[_0x5bd8('0x35')]({},_0x56eb80,_0x205804['options']);return _0x3488d6[_0x5bd8('0x49')](_0x56eb80);}})[_0x5bd8('0x1f')](function(_0x10c676){if(_0x10c676){_0x4df4ec=_0x10c676[_0x5bd8('0x32')];if(!_0x205804['query'][_0x5bd8('0x46')](_0x5bd8('0x47'))){_0x56eb80[_0x5bd8('0x17')]=qs[_0x5bd8('0x17')](_0x205804['query'][_0x5bd8('0x17')]);_0x56eb80[_0x5bd8('0x15')]=qs[_0x5bd8('0x15')](_0x205804[_0x5bd8('0x2c')][_0x5bd8('0x15')]);}return _0x3488d6[_0x5bd8('0x49')](_0x56eb80);}})['then'](function(_0x4f1d24){if(_0x4f1d24){return _0x4f1d24?{'count':_0x4df4ec,'rows':_0x4f1d24}:null;}})[_0x5bd8('0x1f')](respondWithResult(_0x2e6405,null))['catch'](handleError(_0x2e6405,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6ca8985..8bf9f7e 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 _0x6df9=['int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x6df9,0x1e1));var _0x96df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6df9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var logger=require(_0x96df('0x2'))('api');var moment=require(_0x96df('0x3'));var BPromise=require('bluebird');var rp=require(_0x96df('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x96df('0x5'));var attributes=require(_0x96df('0x6'));module[_0x96df('0x7')]=function(_0x338736,_0x3d645d){return _0x338736[_0x96df('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x96df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaca1=['path','../../config/environment','exports','define','SalesforceConfiguration','util','api','bluebird'];(function(_0x1cb09e,_0x54d2fd){var _0xb7d726=function(_0x1bbd2d){while(--_0x1bbd2d){_0x1cb09e['push'](_0x1cb09e['shift']());}};_0xb7d726(++_0x54d2fd);}(_0xaca1,0x16d));var _0x1aca=function(_0x17c47b,_0x4bc675){_0x17c47b=_0x17c47b-0x0;var _0x11b6b0=_0xaca1[_0x17c47b];return _0x11b6b0;};'use strict';var _=require('lodash');var util=require(_0x1aca('0x0'));var logger=require('../../config/logger')(_0x1aca('0x1'));var moment=require('moment');var BPromise=require(_0x1aca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1aca('0x3'));var rimraf=require('rimraf');var config=require(_0x1aca('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x1aca('0x5')]=function(_0x2fe4c0,_0x30355e){return _0x2fe4c0[_0x1aca('0x6')](_0x1aca('0x7'),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 a758476..e2ff974 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 _0xc6e3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x3226f4,_0x1bd77d){var _0x3d850f=function(_0xb51fa8){while(--_0xb51fa8){_0x3226f4['push'](_0x3226f4['shift']());}};_0x3d850f(++_0x1bd77d);}(_0xc6e3,0xbb));var _0x3c6e=function(_0x3b1b93,_0x5cfce0){_0x3b1b93=_0x3b1b93-0x0;var _0x5d8fb9=_0xc6e3[_0x3b1b93];return _0x5d8fb9;};'use strict';var _=require('lodash');var util=require(_0x3c6e('0x0'));var moment=require(_0x3c6e('0x1'));var BPromise=require(_0x3c6e('0x2'));var rs=require(_0x3c6e('0x3'));var fs=require('fs');var Redis=require(_0x3c6e('0x4'));var db=require(_0x3c6e('0x5'))['db'];var utils=require(_0x3c6e('0x6'));var logger=require(_0x3c6e('0x7'))(_0x3c6e('0x8'));var config=require(_0x3c6e('0x9'));var jayson=require(_0x3c6e('0xa'));var client=jayson['client'][_0x3c6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bfaac,_0x49b097,_0x2f822f){return new BPromise(function(_0x3adbdb,_0x1d62c1){return client[_0x3c6e('0xc')](_0x1bfaac,_0x2f822f)[_0x3c6e('0xd')](function(_0x29aa31){logger[_0x3c6e('0xe')](_0x3c6e('0xf'),_0x49b097,_0x3c6e('0x10'));logger[_0x3c6e('0x11')](_0x3c6e('0x12'),_0x49b097,_0x3c6e('0x10'),JSON[_0x3c6e('0x13')](_0x29aa31));if(_0x29aa31[_0x3c6e('0x14')]){if(_0x29aa31[_0x3c6e('0x14')][_0x3c6e('0x15')]===0x1f4){logger[_0x3c6e('0x14')](_0x3c6e('0xf'),_0x49b097,_0x29aa31[_0x3c6e('0x14')]['message']);return _0x1d62c1(_0x29aa31[_0x3c6e('0x14')][_0x3c6e('0x16')]);}logger[_0x3c6e('0x14')](_0x3c6e('0xf'),_0x49b097,_0x29aa31[_0x3c6e('0x14')][_0x3c6e('0x16')]);return _0x3adbdb(_0x29aa31[_0x3c6e('0x14')]['message']);}else{logger[_0x3c6e('0xe')](_0x3c6e('0xf'),_0x49b097,'request\x20sent');_0x3adbdb(_0x29aa31[_0x3c6e('0x17')]['message']);}})['catch'](function(_0x4d561a){logger['error'](_0x3c6e('0xf'),_0x49b097,_0x4d561a);_0x1d62c1(_0x4d561a);});});} \ No newline at end of file +var _0xbf99=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x251da8,_0x4adef4){var _0x1bd1ac=function(_0x1126bb){while(--_0x1126bb){_0x251da8['push'](_0x251da8['shift']());}};_0x1bd1ac(++_0x4adef4);}(_0xbf99,0x1ed));var _0x9bf9=function(_0x494b1a,_0x2bf8c1){_0x494b1a=_0x494b1a-0x0;var _0x4253ca=_0xbf99[_0x494b1a];return _0x4253ca;};'use strict';var _=require(_0x9bf9('0x0'));var util=require('util');var moment=require(_0x9bf9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bf9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bf9('0x3'))('rpc');var config=require(_0x9bf9('0x4'));var jayson=require(_0x9bf9('0x5'));var client=jayson[_0x9bf9('0x6')][_0x9bf9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4584c8,_0x33e5c4,_0x146473){return new BPromise(function(_0x15c285,_0x5a24c9){return client['request'](_0x4584c8,_0x146473)[_0x9bf9('0x8')](function(_0x568b2d){logger[_0x9bf9('0x9')](_0x9bf9('0xa'),_0x33e5c4,_0x9bf9('0xb'));logger[_0x9bf9('0xc')](_0x9bf9('0xd'),_0x33e5c4,_0x9bf9('0xb'),JSON['stringify'](_0x568b2d));if(_0x568b2d[_0x9bf9('0xe')]){if(_0x568b2d[_0x9bf9('0xe')]['code']===0x1f4){logger[_0x9bf9('0xe')](_0x9bf9('0xa'),_0x33e5c4,_0x568b2d[_0x9bf9('0xe')]['message']);return _0x5a24c9(_0x568b2d[_0x9bf9('0xe')]['message']);}logger[_0x9bf9('0xe')](_0x9bf9('0xa'),_0x33e5c4,_0x568b2d[_0x9bf9('0xe')][_0x9bf9('0xf')]);return _0x15c285(_0x568b2d[_0x9bf9('0xe')][_0x9bf9('0xf')]);}else{logger[_0x9bf9('0x9')](_0x9bf9('0xa'),_0x33e5c4,_0x9bf9('0xb'));_0x15c285(_0x568b2d[_0x9bf9('0x10')]['message']);}})[_0x9bf9('0x11')](function(_0x1710c6){logger[_0x9bf9('0xe')](_0x9bf9('0xa'),_0x33e5c4,_0x1710c6);_0x5a24c9(_0x1710c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index fdc6106..b4e3705 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 _0x0e94=['show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x1a027c,_0x118ef2){var _0x9d4825=function(_0x389be1){while(--_0x389be1){_0x1a027c['push'](_0x1a027c['shift']());}};_0x9d4825(++_0x118ef2);}(_0x0e94,0x8e));var _0x40e9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0e94[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x40e9('0x0'));var util=require(_0x40e9('0x1'));var path=require('path');var timeout=require(_0x40e9('0x2'));var express=require(_0x40e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x40e9('0x4'));var controller=require(_0x40e9('0x5'));router[_0x40e9('0x6')]('/',auth[_0x40e9('0x7')](),controller['index']);router[_0x40e9('0x6')]('/:id',auth[_0x40e9('0x7')](),controller[_0x40e9('0x8')]);router[_0x40e9('0x9')]('/',auth[_0x40e9('0x7')](),controller['create']);router[_0x40e9('0xa')](_0x40e9('0xb'),auth[_0x40e9('0x7')](),controller[_0x40e9('0xc')]);router[_0x40e9('0xd')]('/:id',auth[_0x40e9('0x7')](),controller[_0x40e9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0522=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','/:id','update','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0522,0x171));var _0x2052=function(_0x23589c,_0x24db81){_0x23589c=_0x23589c-0x0;var _0x8c18dd=_0x0522[_0x23589c];return _0x8c18dd;};'use strict';var multer=require(_0x2052('0x0'));var util=require('util');var path=require(_0x2052('0x1'));var timeout=require(_0x2052('0x2'));var express=require(_0x2052('0x3'));var router=express[_0x2052('0x4')]();var fs_extra=require(_0x2052('0x5'));var auth=require(_0x2052('0x6'));var interaction=require(_0x2052('0x7'));var config=require(_0x2052('0x8'));var controller=require(_0x2052('0x9'));router['get']('/',auth[_0x2052('0xa')](),controller[_0x2052('0xb')]);router['get'](_0x2052('0xc'),auth[_0x2052('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2052('0xc'),auth[_0x2052('0xa')](),controller[_0x2052('0xd')]);router['delete'](_0x2052('0xc'),auth['isAuthenticated'](),controller[_0x2052('0xe')]);module[_0x2052('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d347df4..ef787f4 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 _0x3b48=['keyValue','picklist','string','STRING','ENUM','sequelize','exports','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b48,0x95));var _0x83b4=function(_0x794b0f,_0x194dcf){_0x794b0f=_0x794b0f-0x0;var _0x232124=_0x3b48[_0x794b0f];return _0x232124;};'use strict';var Sequelize=require(_0x83b4('0x0'));module[_0x83b4('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x83b4('0x2'),_0x83b4('0x3'),_0x83b4('0x4'),_0x83b4('0x5')),'defaultValue':_0x83b4('0x6')},'content':{'type':Sequelize[_0x83b4('0x7')]},'key':{'type':Sequelize[_0x83b4('0x7')]},'keyType':{'type':Sequelize[_0x83b4('0x8')](_0x83b4('0x6'),_0x83b4('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x83b4('0x7')]},'idField':{'type':Sequelize[_0x83b4('0x7')]},'variableName':{'type':Sequelize[_0x83b4('0x7')]}}; \ No newline at end of file +var _0x10f0=['ENUM','string','variable','customVariable','picklist','STRING','exports'];(function(_0x1185d7,_0x1e7f20){var _0x318dc5=function(_0x2fc2d7){while(--_0x2fc2d7){_0x1185d7['push'](_0x1185d7['shift']());}};_0x318dc5(++_0x1e7f20);}(_0x10f0,0xc3));var _0x010f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x10f0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x010f('0x0')]={'type':{'type':Sequelize[_0x010f('0x1')](_0x010f('0x2'),_0x010f('0x3'),_0x010f('0x4'),'keyValue',_0x010f('0x5')),'defaultValue':_0x010f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x010f('0x6')]},'keyType':{'type':Sequelize[_0x010f('0x1')]('string',_0x010f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x010f('0x6')]},'idField':{'type':Sequelize[_0x010f('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 854c521..8244a01 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 _0xfcc7=['map','SalesforceField','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','length','find','create','body','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index'];(function(_0x20724d,_0x577485){var _0x39321d=function(_0x544cf3){while(--_0x544cf3){_0x20724d['push'](_0x20724d['shift']());}};_0x39321d(++_0x577485);}(_0xfcc7,0x6a));var _0x7fcc=function(_0x59f7b8,_0xb2ac21){_0x59f7b8=_0x59f7b8-0x0;var _0x7b28c5=_0xfcc7[_0x59f7b8];return _0x7b28c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fcc('0x0'));var jsonpatch=require(_0x7fcc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fcc('0x2'));var Mustache=require(_0x7fcc('0x3'));var util=require('util');var path=require(_0x7fcc('0x4'));var sox=require(_0x7fcc('0x5'));var csv=require(_0x7fcc('0x6'));var ejs=require(_0x7fcc('0x7'));var fs=require('fs');var fs_extra=require(_0x7fcc('0x8'));var _=require(_0x7fcc('0x9'));var squel=require(_0x7fcc('0xa'));var crypto=require('crypto');var jsforce=require(_0x7fcc('0xb'));var deskjs=require(_0x7fcc('0xc'));var toCsv=require(_0x7fcc('0x6'));var querystring=require(_0x7fcc('0xd'));var Papa=require(_0x7fcc('0xe'));var Redis=require(_0x7fcc('0xf'));var authService=require(_0x7fcc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7fcc('0x11'));var hardwareService=require(_0x7fcc('0x12'));var logger=require(_0x7fcc('0x13'))(_0x7fcc('0x14'));var utils=require(_0x7fcc('0x15'));var config=require(_0x7fcc('0x16'));var licenseUtil=require(_0x7fcc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48723b,_0x2d41b5){_0x2d41b5=_0x2d41b5||0xcc;return function(_0x263929){if(_0x263929){return _0x48723b[_0x7fcc('0x18')](_0x2d41b5);}return _0x48723b['status'](_0x2d41b5)[_0x7fcc('0x19')]();};}function respondWithResult(_0x299067,_0xbc2fe2){_0xbc2fe2=_0xbc2fe2||0xc8;return function(_0x1084ee){if(_0x1084ee){return _0x299067[_0x7fcc('0x1a')](_0xbc2fe2)[_0x7fcc('0x1b')](_0x1084ee);}};}function respondWithFilteredResult(_0xa2b458,_0x50c9b0){return function(_0x419d5a){if(_0x419d5a){var _0x3fec3f=typeof _0x50c9b0[_0x7fcc('0x1c')]===_0x7fcc('0x1d')&&typeof _0x50c9b0[_0x7fcc('0x1e')]===_0x7fcc('0x1d');var _0x128c28=_0x419d5a[_0x7fcc('0x1f')];var _0x3a5525=_0x3fec3f?0x0:_0x50c9b0['offset'];var _0xcc437a=_0x3fec3f?_0x419d5a[_0x7fcc('0x1f')]:_0x50c9b0[_0x7fcc('0x1c')]+_0x50c9b0['limit'];var _0x47dfd8;if(_0xcc437a>=_0x128c28){_0xcc437a=_0x128c28;_0x47dfd8=0xc8;}else{_0x47dfd8=0xce;}_0xa2b458[_0x7fcc('0x1a')](_0x47dfd8);return _0xa2b458[_0x7fcc('0x20')](_0x7fcc('0x21'),_0x3a5525+'-'+_0xcc437a+'/'+_0x128c28)[_0x7fcc('0x1b')](_0x419d5a);}return null;};}function patchUpdates(_0x4f9a18){return function(_0x4688d7){try{jsonpatch['apply'](_0x4688d7,_0x4f9a18,!![]);}catch(_0x353f2d){return BPromise[_0x7fcc('0x22')](_0x353f2d);}return _0x4688d7[_0x7fcc('0x23')]();};}function saveUpdates(_0x5e2db1,_0x5edd41){return function(_0x599df8){if(_0x599df8){return _0x599df8[_0x7fcc('0x24')](_0x5e2db1)['then'](function(_0x14fc58){return _0x14fc58;});}return null;};}function removeEntity(_0x435812,_0x3e3f6c){return function(_0x287994){if(_0x287994){return _0x287994[_0x7fcc('0x25')]()[_0x7fcc('0x26')](function(){_0x435812[_0x7fcc('0x1a')](0xcc)[_0x7fcc('0x19')]();});}};}function handleEntityNotFound(_0x218fb7,_0x250790){return function(_0x1f3fde){if(!_0x1f3fde){_0x218fb7['sendStatus'](0x194);}return _0x1f3fde;};}function handleError(_0x2a2d68,_0x148f15){_0x148f15=_0x148f15||0x1f4;return function(_0x5b42be){logger[_0x7fcc('0x27')](_0x5b42be[_0x7fcc('0x28')]);if(_0x5b42be[_0x7fcc('0x29')]){delete _0x5b42be[_0x7fcc('0x29')];}_0x2a2d68[_0x7fcc('0x1a')](_0x148f15)[_0x7fcc('0x2a')](_0x5b42be);};}exports[_0x7fcc('0x2b')]=function(_0x3d7b30,_0x4644d4){var _0x3f40c8={},_0x455cf8={},_0x5b4b30={'count':0x0,'rows':[]};var _0x3c4dd2=_[_0x7fcc('0x2c')](db[_0x7fcc('0x2d')]['rawAttributes'],function(_0x212385){return{'name':_0x212385[_0x7fcc('0x2e')],'type':_0x212385[_0x7fcc('0x2f')][_0x7fcc('0x30')]};});_0x455cf8[_0x7fcc('0x31')]=_[_0x7fcc('0x2c')](_0x3c4dd2,'name');_0x455cf8[_0x7fcc('0x32')]=_[_0x7fcc('0x33')](_0x3d7b30['query']);_0x455cf8['filters']=_[_0x7fcc('0x34')](_0x455cf8[_0x7fcc('0x31')],_0x455cf8['query']);_0x3f40c8[_0x7fcc('0x35')]=_[_0x7fcc('0x34')](_0x455cf8['model'],qs[_0x7fcc('0x36')](_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x36')]));_0x3f40c8['attributes']=_0x3f40c8[_0x7fcc('0x35')]['length']?_0x3f40c8[_0x7fcc('0x35')]:_0x455cf8['model'];if(!_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x37')]('nolimit')){_0x3f40c8[_0x7fcc('0x1e')]=qs[_0x7fcc('0x1e')](_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x1e')]);_0x3f40c8[_0x7fcc('0x1c')]=qs[_0x7fcc('0x1c')](_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x1c')]);}_0x3f40c8['order']=qs['sort'](_0x3d7b30['query']['sort']);_0x3f40c8[_0x7fcc('0x38')]=qs['filters'](_[_0x7fcc('0x39')](_0x3d7b30[_0x7fcc('0x32')],_0x455cf8['filters']),_0x3c4dd2);if(_0x3d7b30[_0x7fcc('0x32')]['filter']){_0x3f40c8['where']=_[_0x7fcc('0x3a')](_0x3f40c8[_0x7fcc('0x38')],{'$or':_[_0x7fcc('0x2c')](_0x3c4dd2,function(_0x1f8ced){if(_0x1f8ced[_0x7fcc('0x2f')]!==_0x7fcc('0x3b')){var _0xa67e93={};_0xa67e93[_0x1f8ced[_0x7fcc('0x29')]]={'$like':'%'+_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x3c')]+'%'};return _0xa67e93;}})});}_0x3f40c8=_[_0x7fcc('0x3a')]({},_0x3f40c8,_0x3d7b30[_0x7fcc('0x3d')]);var _0x5dc6a5={'where':_0x3f40c8['where']};return db[_0x7fcc('0x2d')]['count'](_0x5dc6a5)[_0x7fcc('0x26')](function(_0x852fd4){_0x5b4b30[_0x7fcc('0x1f')]=_0x852fd4;if(_0x3d7b30[_0x7fcc('0x32')][_0x7fcc('0x3e')]){_0x3f40c8[_0x7fcc('0x3f')]=[{'all':!![]}];}return db[_0x7fcc('0x2d')][_0x7fcc('0x40')](_0x3f40c8);})[_0x7fcc('0x26')](function(_0xd54bdc){_0x5b4b30[_0x7fcc('0x41')]=_0xd54bdc;return _0x5b4b30;})[_0x7fcc('0x26')](respondWithFilteredResult(_0x4644d4,_0x3f40c8))[_0x7fcc('0x42')](handleError(_0x4644d4,null));};exports[_0x7fcc('0x43')]=function(_0x29c11a,_0x18c2f9){var _0x12084b={'raw':!![],'where':{'id':_0x29c11a[_0x7fcc('0x44')]['id']}},_0x20bb35={};_0x20bb35['model']=_[_0x7fcc('0x33')](db[_0x7fcc('0x2d')][_0x7fcc('0x45')]);_0x20bb35[_0x7fcc('0x32')]=_[_0x7fcc('0x33')](_0x29c11a[_0x7fcc('0x32')]);_0x20bb35[_0x7fcc('0x46')]=_[_0x7fcc('0x34')](_0x20bb35[_0x7fcc('0x31')],_0x20bb35[_0x7fcc('0x32')]);_0x12084b[_0x7fcc('0x35')]=_['intersection'](_0x20bb35[_0x7fcc('0x31')],qs[_0x7fcc('0x36')](_0x29c11a['query'][_0x7fcc('0x36')]));_0x12084b[_0x7fcc('0x35')]=_0x12084b[_0x7fcc('0x35')][_0x7fcc('0x47')]?_0x12084b[_0x7fcc('0x35')]:_0x20bb35['model'];if(_0x29c11a['query']['includeAll']){_0x12084b['include']=[{'all':!![]}];}_0x12084b=_[_0x7fcc('0x3a')]({},_0x12084b,_0x29c11a[_0x7fcc('0x3d')]);return db[_0x7fcc('0x2d')][_0x7fcc('0x48')](_0x12084b)[_0x7fcc('0x26')](handleEntityNotFound(_0x18c2f9,null))[_0x7fcc('0x26')](respondWithResult(_0x18c2f9,null))[_0x7fcc('0x42')](handleError(_0x18c2f9,null));};exports[_0x7fcc('0x49')]=function(_0x40d97e,_0x342944){return db['SalesforceField'][_0x7fcc('0x49')](_0x40d97e[_0x7fcc('0x4a')],{})[_0x7fcc('0x26')](respondWithResult(_0x342944,0xc9))['catch'](handleError(_0x342944,null));};exports['update']=function(_0x39a5d6,_0x29fbda){if(_0x39a5d6[_0x7fcc('0x4a')]['id']){delete _0x39a5d6[_0x7fcc('0x4a')]['id'];}return db[_0x7fcc('0x2d')][_0x7fcc('0x48')]({'where':{'id':_0x39a5d6[_0x7fcc('0x44')]['id']}})[_0x7fcc('0x26')](handleEntityNotFound(_0x29fbda,null))[_0x7fcc('0x26')](saveUpdates(_0x39a5d6[_0x7fcc('0x4a')],null))[_0x7fcc('0x26')](respondWithResult(_0x29fbda,null))[_0x7fcc('0x42')](handleError(_0x29fbda,null));};exports[_0x7fcc('0x25')]=function(_0xa4e057,_0x2f83a1){return db[_0x7fcc('0x2d')][_0x7fcc('0x48')]({'where':{'id':_0xa4e057['params']['id']}})['then'](handleEntityNotFound(_0x2f83a1,null))[_0x7fcc('0x26')](removeEntity(_0x2f83a1,null))[_0x7fcc('0x42')](handleError(_0x2f83a1,null));}; \ No newline at end of file +var _0xe2dc=['nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','SalesforceField','findAll','rows','params','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4d4969,_0x505c3c){var _0x1de6ff=function(_0x25dbcf){while(--_0x25dbcf){_0x4d4969['push'](_0x4d4969['shift']());}};_0x1de6ff(++_0x505c3c);}(_0xe2dc,0x137));var _0xce2d=function(_0x167456,_0x555fdb){_0x167456=_0x167456-0x0;var _0x4160f9=_0xe2dc[_0x167456];return _0x4160f9;};'use strict';var emlformat=require(_0xce2d('0x0'));var rimraf=require(_0xce2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce2d('0x2'));var moment=require(_0xce2d('0x3'));var BPromise=require(_0xce2d('0x4'));var Mustache=require(_0xce2d('0x5'));var util=require(_0xce2d('0x6'));var path=require(_0xce2d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xce2d('0x8'));var fs=require('fs');var fs_extra=require(_0xce2d('0x9'));var _=require(_0xce2d('0xa'));var squel=require(_0xce2d('0xb'));var crypto=require(_0xce2d('0xc'));var jsforce=require(_0xce2d('0xd'));var deskjs=require(_0xce2d('0xe'));var toCsv=require(_0xce2d('0xf'));var querystring=require(_0xce2d('0x10'));var Papa=require('papaparse');var Redis=require(_0xce2d('0x11'));var authService=require(_0xce2d('0x12'));var qs=require(_0xce2d('0x13'));var as=require(_0xce2d('0x14'));var hardwareService=require(_0xce2d('0x15'));var logger=require(_0xce2d('0x16'))('api');var utils=require(_0xce2d('0x17'));var config=require(_0xce2d('0x18'));var licenseUtil=require(_0xce2d('0x19'));var db=require(_0xce2d('0x1a'))['db'];function respondWithStatusCode(_0x27f1e0,_0x4d5f76){_0x4d5f76=_0x4d5f76||0xcc;return function(_0x3c420e){if(_0x3c420e){return _0x27f1e0['sendStatus'](_0x4d5f76);}return _0x27f1e0[_0xce2d('0x1b')](_0x4d5f76)[_0xce2d('0x1c')]();};}function respondWithResult(_0x5bd837,_0x52c34c){_0x52c34c=_0x52c34c||0xc8;return function(_0xb07406){if(_0xb07406){return _0x5bd837[_0xce2d('0x1b')](_0x52c34c)[_0xce2d('0x1d')](_0xb07406);}};}function respondWithFilteredResult(_0x26d732,_0xdef950){return function(_0xec748f){if(_0xec748f){var _0x24449d=typeof _0xdef950[_0xce2d('0x1e')]==='undefined'&&typeof _0xdef950[_0xce2d('0x1f')]===_0xce2d('0x20');var _0x46c978=_0xec748f[_0xce2d('0x21')];var _0x1c0366=_0x24449d?0x0:_0xdef950[_0xce2d('0x1e')];var _0x12c056=_0x24449d?_0xec748f[_0xce2d('0x21')]:_0xdef950['offset']+_0xdef950[_0xce2d('0x1f')];var _0x19a895;if(_0x12c056>=_0x46c978){_0x12c056=_0x46c978;_0x19a895=0xc8;}else{_0x19a895=0xce;}_0x26d732[_0xce2d('0x1b')](_0x19a895);return _0x26d732['set']('Content-Range',_0x1c0366+'-'+_0x12c056+'/'+_0x46c978)['json'](_0xec748f);}return null;};}function patchUpdates(_0x567c8e){return function(_0x49c7da){try{jsonpatch['apply'](_0x49c7da,_0x567c8e,!![]);}catch(_0x2ba2b0){return BPromise[_0xce2d('0x22')](_0x2ba2b0);}return _0x49c7da[_0xce2d('0x23')]();};}function saveUpdates(_0x2fdbfc,_0xb8f211){return function(_0x51a500){if(_0x51a500){return _0x51a500[_0xce2d('0x24')](_0x2fdbfc)[_0xce2d('0x25')](function(_0x11fc0b){return _0x11fc0b;});}return null;};}function removeEntity(_0x250e39,_0x1fbb17){return function(_0x4fde2b){if(_0x4fde2b){return _0x4fde2b[_0xce2d('0x26')]()[_0xce2d('0x25')](function(){_0x250e39[_0xce2d('0x1b')](0xcc)[_0xce2d('0x1c')]();});}};}function handleEntityNotFound(_0x1c10a4,_0x25105c){return function(_0x381308){if(!_0x381308){_0x1c10a4[_0xce2d('0x27')](0x194);}return _0x381308;};}function handleError(_0x2ebeba,_0x237341){_0x237341=_0x237341||0x1f4;return function(_0x583a77){logger['error'](_0x583a77[_0xce2d('0x28')]);if(_0x583a77['name']){delete _0x583a77[_0xce2d('0x29')];}_0x2ebeba[_0xce2d('0x1b')](_0x237341)[_0xce2d('0x2a')](_0x583a77);};}exports['index']=function(_0x414a50,_0x20c99d){var _0x18f5cf={},_0x6966a2={},_0x272760={'count':0x0,'rows':[]};var _0x3500b7=_[_0xce2d('0x2b')](db['SalesforceField'][_0xce2d('0x2c')],function(_0x425b4b){return{'name':_0x425b4b['fieldName'],'type':_0x425b4b['type'][_0xce2d('0x2d')]};});_0x6966a2[_0xce2d('0x2e')]=_['map'](_0x3500b7,_0xce2d('0x29'));_0x6966a2['query']=_[_0xce2d('0x2f')](_0x414a50[_0xce2d('0x30')]);_0x6966a2['filters']=_[_0xce2d('0x31')](_0x6966a2['model'],_0x6966a2[_0xce2d('0x30')]);_0x18f5cf[_0xce2d('0x32')]=_[_0xce2d('0x31')](_0x6966a2[_0xce2d('0x2e')],qs[_0xce2d('0x33')](_0x414a50[_0xce2d('0x30')][_0xce2d('0x33')]));_0x18f5cf[_0xce2d('0x32')]=_0x18f5cf['attributes'][_0xce2d('0x34')]?_0x18f5cf[_0xce2d('0x32')]:_0x6966a2[_0xce2d('0x2e')];if(!_0x414a50['query'][_0xce2d('0x35')](_0xce2d('0x36'))){_0x18f5cf['limit']=qs[_0xce2d('0x1f')](_0x414a50[_0xce2d('0x30')][_0xce2d('0x1f')]);_0x18f5cf['offset']=qs[_0xce2d('0x1e')](_0x414a50[_0xce2d('0x30')]['offset']);}_0x18f5cf['order']=qs['sort'](_0x414a50[_0xce2d('0x30')][_0xce2d('0x37')]);_0x18f5cf[_0xce2d('0x38')]=qs[_0xce2d('0x39')](_[_0xce2d('0x3a')](_0x414a50['query'],_0x6966a2[_0xce2d('0x39')]),_0x3500b7);if(_0x414a50[_0xce2d('0x30')][_0xce2d('0x3b')]){_0x18f5cf[_0xce2d('0x38')]=_[_0xce2d('0x3c')](_0x18f5cf[_0xce2d('0x38')],{'$or':_[_0xce2d('0x2b')](_0x3500b7,function(_0x25da51){if(_0x25da51[_0xce2d('0x3d')]!=='VIRTUAL'){var _0x399b5b={};_0x399b5b[_0x25da51['name']]={'$like':'%'+_0x414a50[_0xce2d('0x30')][_0xce2d('0x3b')]+'%'};return _0x399b5b;}})});}_0x18f5cf=_[_0xce2d('0x3c')]({},_0x18f5cf,_0x414a50[_0xce2d('0x3e')]);var _0x27441e={'where':_0x18f5cf[_0xce2d('0x38')]};return db['SalesforceField'][_0xce2d('0x21')](_0x27441e)[_0xce2d('0x25')](function(_0x4d184e){_0x272760[_0xce2d('0x21')]=_0x4d184e;if(_0x414a50['query'][_0xce2d('0x3f')]){_0x18f5cf[_0xce2d('0x40')]=[{'all':!![]}];}return db[_0xce2d('0x41')][_0xce2d('0x42')](_0x18f5cf);})[_0xce2d('0x25')](function(_0x396ab5){_0x272760[_0xce2d('0x43')]=_0x396ab5;return _0x272760;})['then'](respondWithFilteredResult(_0x20c99d,_0x18f5cf))['catch'](handleError(_0x20c99d,null));};exports['show']=function(_0x56b5a1,_0x13c375){var _0x2af1ea={'raw':!![],'where':{'id':_0x56b5a1[_0xce2d('0x44')]['id']}},_0x4830a0={};_0x4830a0[_0xce2d('0x2e')]=_[_0xce2d('0x2f')](db[_0xce2d('0x41')][_0xce2d('0x2c')]);_0x4830a0['query']=_['keys'](_0x56b5a1[_0xce2d('0x30')]);_0x4830a0[_0xce2d('0x39')]=_[_0xce2d('0x31')](_0x4830a0[_0xce2d('0x2e')],_0x4830a0[_0xce2d('0x30')]);_0x2af1ea['attributes']=_['intersection'](_0x4830a0[_0xce2d('0x2e')],qs[_0xce2d('0x33')](_0x56b5a1['query'][_0xce2d('0x33')]));_0x2af1ea[_0xce2d('0x32')]=_0x2af1ea['attributes']['length']?_0x2af1ea[_0xce2d('0x32')]:_0x4830a0['model'];if(_0x56b5a1[_0xce2d('0x30')][_0xce2d('0x3f')]){_0x2af1ea['include']=[{'all':!![]}];}_0x2af1ea=_[_0xce2d('0x3c')]({},_0x2af1ea,_0x56b5a1['options']);return db[_0xce2d('0x41')]['find'](_0x2af1ea)['then'](handleEntityNotFound(_0x13c375,null))[_0xce2d('0x25')](respondWithResult(_0x13c375,null))[_0xce2d('0x45')](handleError(_0x13c375,null));};exports[_0xce2d('0x46')]=function(_0x2444ec,_0x44137f){return db['SalesforceField'][_0xce2d('0x46')](_0x2444ec[_0xce2d('0x47')],{})['then'](respondWithResult(_0x44137f,0xc9))[_0xce2d('0x45')](handleError(_0x44137f,null));};exports[_0xce2d('0x24')]=function(_0x5673c4,_0x16e643){if(_0x5673c4[_0xce2d('0x47')]['id']){delete _0x5673c4['body']['id'];}return db[_0xce2d('0x41')]['find']({'where':{'id':_0x5673c4[_0xce2d('0x44')]['id']}})['then'](handleEntityNotFound(_0x16e643,null))[_0xce2d('0x25')](saveUpdates(_0x5673c4[_0xce2d('0x47')],null))[_0xce2d('0x25')](respondWithResult(_0x16e643,null))[_0xce2d('0x45')](handleError(_0x16e643,null));};exports['destroy']=function(_0x17c76d,_0x3c9ac7){return db[_0xce2d('0x41')][_0xce2d('0x48')]({'where':{'id':_0x17c76d[_0xce2d('0x44')]['id']}})[_0xce2d('0x25')](handleEntityNotFound(_0x3c9ac7,null))[_0xce2d('0x25')](removeEntity(_0x3c9ac7,null))[_0xce2d('0x45')](handleError(_0x3c9ac7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e9f12be..e2d97cf 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 _0xa331=['api','moment','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa331,0xcf));var _0x1a33=function(_0x3e8e98,_0x4d6478){_0x3e8e98=_0x3e8e98-0x0;var _0x387c2f=_0xa331[_0x3e8e98];return _0x387c2f;};'use strict';var _=require(_0x1a33('0x0'));var util=require(_0x1a33('0x1'));var logger=require(_0x1a33('0x2'))(_0x1a33('0x3'));var moment=require(_0x1a33('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a33('0x5'));var rimraf=require(_0x1a33('0x6'));var config=require('../../config/environment');var attributes=require(_0x1a33('0x7'));module[_0x1a33('0x8')]=function(_0x4af820,_0x4234d9){return _0x4af820[_0x1a33('0x9')](_0x1a33('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1a33('0xb'),'fields':[_0x1a33('0xc'),_0x1a33('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd032=['lodash','util','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xd032,0x113));var _0x2d03=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd032[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x2d03('0x0'));var util=require(_0x2d03('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d03('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d03('0x3'));var config=require(_0x2d03('0x4'));var attributes=require(_0x2d03('0x5'));module[_0x2d03('0x6')]=function(_0x5892e4,_0x4b3526){return _0x5892e4['define'](_0x2d03('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x2d03('0x8'),'fields':[_0x2d03('0x9'),_0x2d03('0xa')],'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 a322c8f..4bf3b8e 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 _0x4b38=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SalesforceField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0x3d221d,_0x423b05){var _0x1b802b=function(_0x34563f){while(--_0x34563f){_0x3d221d['push'](_0x3d221d['shift']());}};_0x1b802b(++_0x423b05);}(_0x4b38,0xd1));var _0x84b3=function(_0x71b3ad,_0x3e7d70){_0x71b3ad=_0x71b3ad-0x0;var _0x55909d=_0x4b38[_0x71b3ad];return _0x55909d;};'use strict';var _=require(_0x84b3('0x0'));var util=require(_0x84b3('0x1'));var moment=require(_0x84b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x84b3('0x3'));var fs=require('fs');var Redis=require(_0x84b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x84b3('0x5'));var logger=require(_0x84b3('0x6'))(_0x84b3('0x7'));var config=require(_0x84b3('0x8'));var jayson=require(_0x84b3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x501995,_0x36a158,_0x20e926){return new BPromise(function(_0x2c5917,_0x335bab){return client[_0x84b3('0xa')](_0x501995,_0x20e926)[_0x84b3('0xb')](function(_0xace093){logger['info'](_0x84b3('0xc'),_0x36a158,'request\x20sent');logger[_0x84b3('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x36a158,_0x84b3('0xe'),JSON['stringify'](_0xace093));if(_0xace093[_0x84b3('0xf')]){if(_0xace093[_0x84b3('0xf')][_0x84b3('0x10')]===0x1f4){logger[_0x84b3('0xf')](_0x84b3('0xc'),_0x36a158,_0xace093[_0x84b3('0xf')][_0x84b3('0x11')]);return _0x335bab(_0xace093[_0x84b3('0xf')][_0x84b3('0x11')]);}logger[_0x84b3('0xf')](_0x84b3('0xc'),_0x36a158,_0xace093[_0x84b3('0xf')]['message']);return _0x2c5917(_0xace093[_0x84b3('0xf')][_0x84b3('0x11')]);}else{logger[_0x84b3('0x12')](_0x84b3('0xc'),_0x36a158,_0x84b3('0xe'));_0x2c5917(_0xace093['result']['message']);}})['catch'](function(_0x28700f){logger[_0x84b3('0xf')]('SalesforceField,\x20%s,\x20%s',_0x36a158,_0x28700f);_0x335bab(_0x28700f);});});} \ No newline at end of file +var _0x3144=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe0b1f8,_0x145aa4){var _0x3fb58f=function(_0xfdfcd4){while(--_0xfdfcd4){_0xe0b1f8['push'](_0xe0b1f8['shift']());}};_0x3fb58f(++_0x145aa4);}(_0x3144,0x1be));var _0x4314=function(_0x451d28,_0x1bca56){_0x451d28=_0x451d28-0x0;var _0x3a4497=_0x3144[_0x451d28];return _0x3a4497;};'use strict';var _=require(_0x4314('0x0'));var util=require(_0x4314('0x1'));var moment=require('moment');var BPromise=require(_0x4314('0x2'));var rs=require(_0x4314('0x3'));var fs=require('fs');var Redis=require(_0x4314('0x4'));var db=require(_0x4314('0x5'))['db'];var utils=require(_0x4314('0x6'));var logger=require('../../config/logger')(_0x4314('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4314('0x8')][_0x4314('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5812,_0x52feb4,_0x3201a8){return new BPromise(function(_0x2a1082,_0x16a3b0){return client[_0x4314('0xa')](_0x1b5812,_0x3201a8)[_0x4314('0xb')](function(_0x475343){logger[_0x4314('0xc')](_0x4314('0xd'),_0x52feb4,_0x4314('0xe'));logger[_0x4314('0xf')](_0x4314('0x10'),_0x52feb4,_0x4314('0xe'),JSON[_0x4314('0x11')](_0x475343));if(_0x475343[_0x4314('0x12')]){if(_0x475343['error'][_0x4314('0x13')]===0x1f4){logger['error'](_0x4314('0xd'),_0x52feb4,_0x475343[_0x4314('0x12')][_0x4314('0x14')]);return _0x16a3b0(_0x475343[_0x4314('0x12')][_0x4314('0x14')]);}logger[_0x4314('0x12')](_0x4314('0xd'),_0x52feb4,_0x475343[_0x4314('0x12')][_0x4314('0x14')]);return _0x2a1082(_0x475343[_0x4314('0x12')]['message']);}else{logger[_0x4314('0xc')](_0x4314('0xd'),_0x52feb4,_0x4314('0xe'));_0x2a1082(_0x475343['result'][_0x4314('0x14')]);}})[_0x4314('0x15')](function(_0x3c2ebf){logger[_0x4314('0x12')](_0x4314('0xd'),_0x52feb4,_0x3c2ebf);_0x16a3b0(_0x3c2ebf);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6b04cd6..b11a0ba 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 _0x9789=['index','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x4f6da2,_0x4a141){var _0x5c8fca=function(_0x3c24b0){while(--_0x3c24b0){_0x4f6da2['push'](_0x4f6da2['shift']());}};_0x5c8fca(++_0x4a141);}(_0x9789,0xc7));var _0x9978=function(_0x2a05bf,_0x55e3a4){_0x2a05bf=_0x2a05bf-0x0;var _0x38a62e=_0x9789[_0x2a05bf];return _0x38a62e;};'use strict';var multer=require(_0x9978('0x0'));var util=require(_0x9978('0x1'));var path=require(_0x9978('0x2'));var timeout=require('connect-timeout');var express=require(_0x9978('0x3'));var router=express[_0x9978('0x4')]();var fs_extra=require(_0x9978('0x5'));var auth=require(_0x9978('0x6'));var interaction=require(_0x9978('0x7'));var config=require(_0x9978('0x8'));var controller=require(_0x9978('0x9'));router[_0x9978('0xa')]('/',auth['isAuthenticated'](),controller[_0x9978('0xb')]);router[_0x9978('0xa')]('/:id',auth[_0x9978('0xc')](),controller['show']);router[_0x9978('0xa')](_0x9978('0xd'),auth['isAuthenticated'](),controller[_0x9978('0xe')]);router[_0x9978('0xa')]('/:id/fields',auth[_0x9978('0xc')](),controller[_0x9978('0xf')]);router[_0x9978('0x10')]('/',auth[_0x9978('0xc')](),controller['create']);router['post'](_0x9978('0xd'),auth['isAuthenticated'](),controller[_0x9978('0x11')]);router[_0x9978('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9978('0x13')]('/:id',auth[_0x9978('0xc')](),controller['destroy']);module[_0x9978('0x14')]=router; \ No newline at end of file +var _0xae1a=['create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post'];(function(_0x33e41d,_0x479399){var _0xaca04f=function(_0x624630){while(--_0x624630){_0x33e41d['push'](_0x33e41d['shift']());}};_0xaca04f(++_0x479399);}(_0xae1a,0x19f));var _0xaae1=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xae1a[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0xaae1('0x0'));var util=require(_0xaae1('0x1'));var path=require(_0xaae1('0x2'));var timeout=require(_0xaae1('0x3'));var express=require(_0xaae1('0x4'));var router=express[_0xaae1('0x5')]();var fs_extra=require(_0xaae1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaae1('0x7'));var config=require('../../config/environment');var controller=require(_0xaae1('0x8'));router[_0xaae1('0x9')]('/',auth[_0xaae1('0xa')](),controller[_0xaae1('0xb')]);router[_0xaae1('0x9')](_0xaae1('0xc'),auth[_0xaae1('0xa')](),controller['show']);router[_0xaae1('0x9')]('/:id/configurations',auth[_0xaae1('0xa')](),controller[_0xaae1('0xd')]);router['get'](_0xaae1('0xe'),auth[_0xaae1('0xa')](),controller[_0xaae1('0xf')]);router[_0xaae1('0x10')]('/',auth['isAuthenticated'](),controller[_0xaae1('0x11')]);router[_0xaae1('0x10')](_0xaae1('0x12'),auth[_0xaae1('0xa')](),controller[_0xaae1('0x13')]);router['put']('/:id',auth[_0xaae1('0xa')](),controller[_0xaae1('0x14')]);router[_0xaae1('0x15')](_0xaae1('0xc'),auth[_0xaae1('0xa')](),controller[_0xaae1('0x16')]);module[_0xaae1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index fd97f84..f2977cd 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 _0xe84f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x14cc34,_0x4f7ec9){var _0x5393fb=function(_0x1fc2ad){while(--_0x1fc2ad){_0x14cc34['push'](_0x14cc34['shift']());}};_0x5393fb(++_0x4f7ec9);}(_0xe84f,0x190));var _0xfe84=function(_0x20d7b4,_0x7fa6f9){_0x20d7b4=_0x20d7b4-0x0;var _0x4d3b8a=_0xe84f[_0x20d7b4];return _0x4d3b8a;};'use strict';var Sequelize=require(_0xfe84('0x0'));module[_0xfe84('0x1')]={'name':{'type':Sequelize[_0xfe84('0x2')]},'description':{'type':Sequelize[_0xfe84('0x2')]},'username':{'type':Sequelize[_0xfe84('0x2')],'unique':_0xfe84('0x3')},'password':{'type':Sequelize[_0xfe84('0x2')]},'email':{'type':Sequelize[_0xfe84('0x2')]},'remoteUri':{'type':Sequelize[_0xfe84('0x2')],'unique':_0xfe84('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6481=['sequelize','STRING','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6481,0xb7));var _0x1648=function(_0x469e4e,_0x26686a){_0x469e4e=_0x469e4e-0x0;var _0x230a33=_0x6481[_0x469e4e];return _0x230a33;};'use strict';var Sequelize=require(_0x1648('0x0'));module['exports']={'name':{'type':Sequelize[_0x1648('0x1')]},'description':{'type':Sequelize[_0x1648('0x1')]},'username':{'type':Sequelize[_0x1648('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x1648('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1648('0x1')],'unique':_0x1648('0x2')},'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 6f5ae29..a445865 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 _0x2040=['pick','addConfiguration','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','active','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','assign','remove','includes','forEach','internalType','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration'];(function(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0x2040,0x127));var _0x0204=function(_0x1f0ebd,_0x2005fb){_0x1f0ebd=_0x1f0ebd-0x0;var _0x5b35f7=_0x2040[_0x1f0ebd];return _0x5b35f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0204('0x0'));var zipdir=require(_0x0204('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0204('0x2'));var moment=require('moment');var BPromise=require(_0x0204('0x3'));var Mustache=require('mustache');var util=require(_0x0204('0x4'));var path=require(_0x0204('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0204('0x6'));var fs=require('fs');var fs_extra=require(_0x0204('0x7'));var _=require(_0x0204('0x8'));var squel=require(_0x0204('0x9'));var crypto=require(_0x0204('0xa'));var jsforce=require(_0x0204('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0204('0xc'));var querystring=require(_0x0204('0xd'));var Papa=require('papaparse');var Redis=require(_0x0204('0xe'));var authService=require(_0x0204('0xf'));var qs=require(_0x0204('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0204('0x11'));var logger=require('../../config/logger')(_0x0204('0x12'));var utils=require(_0x0204('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0204('0x14'));var db=require(_0x0204('0x15'))['db'];var integrations=require(_0x0204('0x16'));function respondWithStatusCode(_0x2e08a9,_0x1eba28){_0x1eba28=_0x1eba28||0xcc;return function(_0x1d6cb6){if(_0x1d6cb6){return _0x2e08a9[_0x0204('0x17')](_0x1eba28);}return _0x2e08a9['status'](_0x1eba28)[_0x0204('0x18')]();};}function respondWithResult(_0x22797d,_0x5923f8){_0x5923f8=_0x5923f8||0xc8;return function(_0x4df2f4){if(_0x4df2f4){return _0x22797d[_0x0204('0x19')](_0x5923f8)['json'](_0x4df2f4);}};}function respondWithFilteredResult(_0x37987e,_0x27b614){return function(_0x14b467){if(_0x14b467){var _0x2b631f=typeof _0x27b614[_0x0204('0x1a')]===_0x0204('0x1b')&&typeof _0x27b614['limit']===_0x0204('0x1b');var _0x1d7db7=_0x14b467[_0x0204('0x1c')];var _0x3013c0=_0x2b631f?0x0:_0x27b614[_0x0204('0x1a')];var _0x2d436d=_0x2b631f?_0x14b467['count']:_0x27b614[_0x0204('0x1a')]+_0x27b614[_0x0204('0x1d')];var _0x2a981d;if(_0x2d436d>=_0x1d7db7){_0x2d436d=_0x1d7db7;_0x2a981d=0xc8;}else{_0x2a981d=0xce;}_0x37987e[_0x0204('0x19')](_0x2a981d);return _0x37987e[_0x0204('0x1e')](_0x0204('0x1f'),_0x3013c0+'-'+_0x2d436d+'/'+_0x1d7db7)[_0x0204('0x20')](_0x14b467);}return null;};}function patchUpdates(_0x3158a5){return function(_0x1905a4){try{jsonpatch[_0x0204('0x21')](_0x1905a4,_0x3158a5,!![]);}catch(_0x10fac9){return BPromise[_0x0204('0x22')](_0x10fac9);}return _0x1905a4[_0x0204('0x23')]();};}function saveUpdates(_0x2cdef9,_0x2a46d3){return function(_0x1478af){if(_0x1478af){return _0x1478af['update'](_0x2cdef9)['then'](function(_0x1b9548){return _0x1b9548;});}return null;};}function removeEntity(_0x95ab74,_0x172ea5){return function(_0x2c8e5a){if(_0x2c8e5a){return _0x2c8e5a[_0x0204('0x24')]()[_0x0204('0x25')](function(){_0x95ab74[_0x0204('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208752,_0xda8f16){return function(_0x121fb1){if(!_0x121fb1){_0x208752[_0x0204('0x17')](0x194);}return _0x121fb1;};}function handleError(_0x2cdc1d,_0x161dbf){_0x161dbf=_0x161dbf||0x1f4;return function(_0x2a9a7f){logger[_0x0204('0x26')](_0x2a9a7f[_0x0204('0x27')]);if(_0x2a9a7f[_0x0204('0x28')]){delete _0x2a9a7f[_0x0204('0x28')];}_0x2cdc1d[_0x0204('0x19')](_0x161dbf)[_0x0204('0x29')](_0x2a9a7f);};}exports[_0x0204('0x2a')]=function(_0x6eb679,_0x1f29a5){var _0x4b761c={},_0x140dc9={},_0x210201={'count':0x0,'rows':[]};var _0x1ffbb9=_['map'](db[_0x0204('0x2b')][_0x0204('0x2c')],function(_0x1c7d43){return{'name':_0x1c7d43[_0x0204('0x2d')],'type':_0x1c7d43[_0x0204('0x2e')][_0x0204('0x2f')]};});_0x140dc9['model']=_['map'](_0x1ffbb9,_0x0204('0x28'));_0x140dc9[_0x0204('0x30')]=_['keys'](_0x6eb679[_0x0204('0x30')]);_0x140dc9[_0x0204('0x31')]=_[_0x0204('0x32')](_0x140dc9['model'],_0x140dc9[_0x0204('0x30')]);_0x4b761c[_0x0204('0x33')]=_[_0x0204('0x32')](_0x140dc9[_0x0204('0x34')],qs[_0x0204('0x35')](_0x6eb679[_0x0204('0x30')][_0x0204('0x35')]));_0x4b761c[_0x0204('0x33')]=_0x4b761c[_0x0204('0x33')][_0x0204('0x36')]?_0x4b761c[_0x0204('0x33')]:_0x140dc9[_0x0204('0x34')];if(!_0x6eb679['query']['hasOwnProperty'](_0x0204('0x37'))){_0x4b761c[_0x0204('0x1d')]=qs[_0x0204('0x1d')](_0x6eb679[_0x0204('0x30')][_0x0204('0x1d')]);_0x4b761c[_0x0204('0x1a')]=qs['offset'](_0x6eb679[_0x0204('0x30')]['offset']);}_0x4b761c[_0x0204('0x38')]=qs[_0x0204('0x39')](_0x6eb679[_0x0204('0x30')][_0x0204('0x39')]);_0x4b761c[_0x0204('0x3a')]=qs[_0x0204('0x31')](_['pick'](_0x6eb679['query'],_0x140dc9['filters']),_0x1ffbb9);if(_0x6eb679['query'][_0x0204('0x3b')]){_0x4b761c[_0x0204('0x3a')]=_['merge'](_0x4b761c[_0x0204('0x3a')],{'$or':_[_0x0204('0x3c')](_0x1ffbb9,function(_0x4d2214){if(_0x4d2214['type']!==_0x0204('0x3d')){var _0x3d861={};_0x3d861[_0x4d2214[_0x0204('0x28')]]={'$like':'%'+_0x6eb679[_0x0204('0x30')][_0x0204('0x3b')]+'%'};return _0x3d861;}})});}_0x4b761c=_[_0x0204('0x3e')]({},_0x4b761c,_0x6eb679[_0x0204('0x3f')]);var _0x47e72c={'where':_0x4b761c[_0x0204('0x3a')]};return db[_0x0204('0x2b')][_0x0204('0x1c')](_0x47e72c)['then'](function(_0x5516a8){_0x210201[_0x0204('0x1c')]=_0x5516a8;if(_0x6eb679['query'][_0x0204('0x40')]){_0x4b761c[_0x0204('0x41')]=[{'all':!![]}];}return db[_0x0204('0x2b')][_0x0204('0x42')](_0x4b761c);})[_0x0204('0x25')](function(_0x29b476){_0x210201[_0x0204('0x43')]=_0x29b476;return _0x210201;})[_0x0204('0x25')](respondWithFilteredResult(_0x1f29a5,_0x4b761c))[_0x0204('0x44')](handleError(_0x1f29a5,null));};exports[_0x0204('0x45')]=function(_0x3acc76,_0x49650c){var _0x587f21={'raw':![],'where':{'id':_0x3acc76[_0x0204('0x46')]['id']}},_0x443c50={};_0x443c50[_0x0204('0x34')]=_['keys'](db[_0x0204('0x2b')][_0x0204('0x2c')]);_0x443c50[_0x0204('0x30')]=_[_0x0204('0x47')](_0x3acc76[_0x0204('0x30')]);_0x443c50[_0x0204('0x31')]=_['intersection'](_0x443c50['model'],_0x443c50['query']);_0x587f21[_0x0204('0x33')]=_[_0x0204('0x32')](_0x443c50['model'],qs[_0x0204('0x35')](_0x3acc76[_0x0204('0x30')][_0x0204('0x35')]));_0x587f21[_0x0204('0x33')]=_0x587f21[_0x0204('0x33')][_0x0204('0x36')]?_0x587f21[_0x0204('0x33')]:_0x443c50[_0x0204('0x34')];if(_0x3acc76['query'][_0x0204('0x40')]){_0x587f21[_0x0204('0x41')]=[{'all':!![]}];}_0x587f21=_[_0x0204('0x3e')]({},_0x587f21,_0x3acc76[_0x0204('0x3f')]);return db['ServicenowAccount'][_0x0204('0x48')](_0x587f21)[_0x0204('0x25')](handleEntityNotFound(_0x49650c,null))[_0x0204('0x25')](respondWithResult(_0x49650c,null))[_0x0204('0x44')](handleError(_0x49650c,null));};exports[_0x0204('0x49')]=function(_0x39ad51,_0x3b7bcb){return db['ServicenowAccount'][_0x0204('0x49')](_0x39ad51[_0x0204('0x4a')],{})['then'](respondWithResult(_0x3b7bcb,0xc9))[_0x0204('0x44')](handleError(_0x3b7bcb,null));};exports[_0x0204('0x4b')]=function(_0x3b9976,_0x531109){if(_0x3b9976[_0x0204('0x4a')]['id']){delete _0x3b9976[_0x0204('0x4a')]['id'];}return db[_0x0204('0x2b')][_0x0204('0x48')]({'where':{'id':_0x3b9976[_0x0204('0x46')]['id']}})[_0x0204('0x25')](handleEntityNotFound(_0x531109,null))[_0x0204('0x25')](saveUpdates(_0x3b9976['body'],null))['then'](respondWithResult(_0x531109,null))[_0x0204('0x44')](handleError(_0x531109,null));};exports['destroy']=function(_0x2d405c,_0x1af7b4){return db[_0x0204('0x2b')]['find']({'where':{'id':_0x2d405c[_0x0204('0x46')]['id']}})[_0x0204('0x25')](handleEntityNotFound(_0x1af7b4,null))[_0x0204('0x25')](removeEntity(_0x1af7b4,null))['catch'](handleError(_0x1af7b4,null));};exports[_0x0204('0x4c')]=function(_0x534d0e,_0x37644f,_0x5eb71f){var _0x340763={};var _0x1625a5={};var _0x4e322e;var _0x4d4cf1;return db[_0x0204('0x2b')][_0x0204('0x4d')]({'where':{'id':_0x534d0e[_0x0204('0x46')]['id']}})['then'](handleEntityNotFound(_0x37644f,null))[_0x0204('0x25')](function(_0x5657dd){if(_0x5657dd){_0x4e322e=_0x5657dd;_0x1625a5[_0x0204('0x34')]=_[_0x0204('0x47')](db[_0x0204('0x4e')][_0x0204('0x2c')]);_0x1625a5[_0x0204('0x30')]=_[_0x0204('0x47')](_0x534d0e[_0x0204('0x30')]);_0x1625a5[_0x0204('0x31')]=_[_0x0204('0x32')](_0x1625a5[_0x0204('0x34')],_0x1625a5[_0x0204('0x30')]);_0x340763['attributes']=_['intersection'](_0x1625a5[_0x0204('0x34')],qs[_0x0204('0x35')](_0x534d0e[_0x0204('0x30')][_0x0204('0x35')]));_0x340763[_0x0204('0x33')]=_0x340763[_0x0204('0x33')][_0x0204('0x36')]?_0x340763['attributes']:_0x1625a5[_0x0204('0x34')];_0x340763[_0x0204('0x38')]=qs[_0x0204('0x39')](_0x534d0e[_0x0204('0x30')]['sort']);_0x340763[_0x0204('0x3a')]=qs[_0x0204('0x31')](_[_0x0204('0x4f')](_0x534d0e[_0x0204('0x30')],_0x1625a5[_0x0204('0x31')]));if(_0x534d0e['query'][_0x0204('0x3b')]){_0x340763[_0x0204('0x3a')]=_[_0x0204('0x3e')](_0x340763[_0x0204('0x3a')],{'$or':_[_0x0204('0x3c')](_0x340763[_0x0204('0x33')],function(_0x22f02e){var _0x307085={};_0x307085[_0x22f02e]={'$like':'%'+_0x534d0e[_0x0204('0x30')][_0x0204('0x3b')]+'%'};return _0x307085;})});}_0x340763=_['merge']({},_0x340763,_0x534d0e[_0x0204('0x3f')]);return _0x4e322e[_0x0204('0x4c')](_0x340763);}})[_0x0204('0x25')](function(_0xaece1f){if(_0xaece1f){_0x4d4cf1=_0xaece1f[_0x0204('0x36')];if(!_0x534d0e[_0x0204('0x30')]['hasOwnProperty'](_0x0204('0x37'))){_0x340763['limit']=qs[_0x0204('0x1d')](_0x534d0e[_0x0204('0x30')]['limit']);_0x340763[_0x0204('0x1a')]=qs['offset'](_0x534d0e[_0x0204('0x30')][_0x0204('0x1a')]);}return _0x4e322e['getConfigurations'](_0x340763);}})['then'](function(_0xb426df){if(_0xb426df){return _0xb426df?{'count':_0x4d4cf1,'rows':_0xb426df}:null;}})[_0x0204('0x25')](respondWithResult(_0x37644f,null))['catch'](handleError(_0x37644f,null));};exports[_0x0204('0x50')]=function(_0x2696b3,_0x1d86a5,_0x5e1e37){if(_0x2696b3[_0x0204('0x4a')]['id']){delete _0x2696b3[_0x0204('0x4a')]['id'];}return db['ServicenowAccount'][_0x0204('0x4d')]({'where':{'id':_0x2696b3[_0x0204('0x46')]['id']}})[_0x0204('0x25')](handleEntityNotFound(_0x1d86a5,null))[_0x0204('0x25')](function(_0x28aa1b){if(_0x28aa1b){_0x2696b3['body']['AccountId']=_0x28aa1b['id'];_0x2696b3[_0x0204('0x4a')]['Subjects']=integrations[_0x0204('0x51')](_0x2696b3['body'][_0x0204('0x52')],_0x2696b3[_0x0204('0x4a')]['type']);_0x2696b3[_0x0204('0x4a')][_0x0204('0x53')]=integrations['getDescriptions'](_0x2696b3['body']['channel'],_0x2696b3[_0x0204('0x4a')][_0x0204('0x2e')]);return db[_0x0204('0x4e')][_0x0204('0x49')](_0x2696b3[_0x0204('0x4a')],{'include':[{'model':db[_0x0204('0x54')],'as':_0x0204('0x55')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x0204('0x25')](respondWithResult(_0x1d86a5,null))[_0x0204('0x44')](handleError(_0x1d86a5,null));};exports[_0x0204('0x56')]=function(_0x585e2e,_0x49a4cf,_0x58b363){var _0x5b44b2=[_0x0204('0x57'),_0x0204('0x58'),_0x0204('0x59'),_0x0204('0x5a'),'close_code',_0x0204('0x5b'),_0x0204('0x5c'),'severity',_0x0204('0x5d')];var _0x4d77ea=[_0x0204('0x5e'),'made_sla',_0x0204('0x5f'),_0x0204('0x60'),_0x0204('0x61'),_0x0204('0x62'),_0x0204('0x63'),_0x0204('0x58'),_0x0204('0x64'),_0x0204('0x65'),_0x0204('0x66'),_0x0204('0x67'),_0x0204('0x68'),_0x0204('0x69'),_0x0204('0x6a'),_0x0204('0x6b'),'state','sys_created_by',_0x0204('0x59'),_0x0204('0x38'),_0x0204('0x6c'),_0x0204('0x6d'),'cmdb_ci','delivery_plan','impact',_0x0204('0x6e'),'work_notes_list','business_service',_0x0204('0x6f'),_0x0204('0x70'),_0x0204('0x71'),_0x0204('0x72'),'expected_start',_0x0204('0x73'),_0x0204('0x74'),_0x0204('0x75'),_0x0204('0x76'),_0x0204('0x77'),_0x0204('0x78'),_0x0204('0x79'),_0x0204('0x7a'),'subcategory',_0x0204('0x7b'),'short_description','close_code',_0x0204('0x7c'),'delivery_task',_0x0204('0x7d'),_0x0204('0x7e'),_0x0204('0x7f'),_0x0204('0x80'),_0x0204('0x81'),_0x0204('0x82'),_0x0204('0x5b'),_0x0204('0x83'),_0x0204('0x84'),_0x0204('0x85'),_0x0204('0x86'),_0x0204('0x87'),_0x0204('0x88'),'contact_type','reopened_by',_0x0204('0x5c'),_0x0204('0x89'),_0x0204('0x8a'),_0x0204('0x8b'),_0x0204('0x8c'),_0x0204('0x8d'),'assigned_to',_0x0204('0x8e'),_0x0204('0x8f'),_0x0204('0x90'),_0x0204('0x91'),_0x0204('0x92'),_0x0204('0x93'),_0x0204('0x94'),_0x0204('0x95'),'sys_tags','escalation',_0x0204('0x96'),_0x0204('0x97'),_0x0204('0x98'),'category'];var _0x27570a='';var _0x5e9058='';var _0x528df9=[];var _0x2d082d='';var _0x1cf9b6='';var _0x4360b3=[];var _0x53854='';var _0x312f4a='';var _0x378d47={};var _0x627e6='';return db[_0x0204('0x2b')]['findOne']({'where':{'id':_0x585e2e[_0x0204('0x46')]['id']},'attributes':['id',_0x0204('0x99'),_0x0204('0x9a'),_0x0204('0x9b'),_0x0204('0x9c'),_0x0204('0x9d')]})[_0x0204('0x25')](handleEntityNotFound(_0x49a4cf,null))['then'](function(_0x1623c9){if(_0x1623c9){_0x627e6=_0x1623c9[_0x0204('0x9c')];var _0xa219af=_0x627e6[_0x0204('0x9e')](-0x1);if(_0xa219af==='/'){_0x627e6=_0x627e6[_0x0204('0x9f')](0x0,_0x627e6['lastIndexOf'](_0xa219af));}_0x312f4a=util[_0x0204('0xa0')](_0x0204('0xa1'),_0x627e6);_0x53854=util[_0x0204('0xa0')](_0x0204('0xa2'),_0x627e6);_0x378d47={'user':_0x1623c9[_0x0204('0x99')],'pass':_0x1623c9[_0x0204('0x9a')]};var _0x16a440={'method':_0x0204('0xa3'),'uri':_0x312f4a+'incident?sysparm_display_value=all','auth':_0x378d47,'json':!![]};return rp(_0x16a440);}})[_0x0204('0x25')](function(_0x15db8b){if(_0x15db8b[_0x0204('0xa4')][_0x0204('0x36')]>0x0){_0x27570a=_0x15db8b[_0x0204('0xa4')];}console[_0x0204('0xa5')]('incident\x20table\x20objects',_0x27570a);_0x4360b3=[];_0x5e9058=Object[_0x0204('0xa6')]([],_0x27570a);_[_0x0204('0xa7')](_0x5e9058,function(_0x265471){return!_0x5b44b2[_0x0204('0xa8')](_0x265471[_0x0204('0x28')]);});_0x5e9058[_0x0204('0xa9')](function(_0x191b72){var _0x4f5f17=createFieldObject(_0x53854,_0x378d47,_0x191b72[_0x0204('0xaa')],_0x191b72['name'],_0x191b72['label'],![]);_0x4360b3['push'](_0x4f5f17);});return Promise[_0x0204('0xab')](_0x4360b3);})[_0x0204('0x25')](function(_0x1a1fb1){_0x528df9=_0x1a1fb1;_0x2d082d=Object[_0x0204('0xa6')]([],_0x27570a);console['log'](_0x0204('0xac'),_0x27570a);_[_0x0204('0xa7')](_0x2d082d,function(_0xd0a258){return _0x4d77ea[_0x0204('0xa8')](_0xd0a258[_0x0204('0x28')]);});console['log'](_0x0204('0xad'),_0x2d082d);_0x4360b3=[];_0x2d082d[_0x0204('0xa9')](function(_0x15c576){var _0x75e4ee=createFieldObject(_0x53854,_0x378d47,_0x15c576[_0x0204('0xaa')],_0x15c576[_0x0204('0x28')],_0x15c576[_0x0204('0xae')],!![]);_0x4360b3[_0x0204('0xaf')](_0x75e4ee);});return Promise[_0x0204('0xab')](_0x4360b3);})[_0x0204('0x25')](function(_0x16cb7c){_0x1cf9b6=_0x16cb7c;var _0x1ce93b=_0x528df9[_0x0204('0xb0')](_0x1cf9b6);return{'count':_0x1ce93b[_0x0204('0x36')],'rows':_0x1ce93b};})['then'](respondWithResult(_0x49a4cf,null))['catch'](function(_0x252d88){console[_0x0204('0xa5')]('ServiceNow\x20error:\x20'+_0x252d88);var _0x270704=_0x585e2e[_0x0204('0x30')][_0x0204('0xb1')]?0x1f4:_0x252d88[_0x0204('0xb2')]||0x1f4;logger[_0x0204('0x26')](_0x252d88[_0x0204('0x27')]);delete _0x252d88[_0x0204('0x28')];if(_0x270704===0x191){_0x270704=0x190;}_0x49a4cf[_0x0204('0x19')](_0x270704)['send'](_0x585e2e[_0x0204('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x252d88[_0x0204('0xb2')]}:_0x252d88);});};function createFieldObject(_0xc384d3,_0x3f9704,_0xf18b15,_0x338a2a,_0x19e563,_0x44d4dc){return new Promise(function(_0x2aa83b,_0x28dd56){var _0x488a9e={'id':_0x338a2a,'name':_0x19e563,'custom':_0x44d4dc};if(_0xf18b15===_0x0204('0xb3')){_0x488a9e[_0x0204('0x3f')]=[{'name':_0x0204('0xb4'),'value':_0x0204('0xb5')},{'name':_0x0204('0xb6'),'value':_0x0204('0xb7')}];_0x2aa83b(_0x488a9e);}else{var _0x43cf7c={'method':'GET','uri':_0xc384d3+_0x0204('0xb8')+_0x338a2a,'auth':_0x3f9704,'json':!![]};return rp(_0x43cf7c)['then'](function(_0x3647f9){var _0x1027c1=[];if(_0x3647f9['result'][_0x0204('0x36')]>0x0){_0x3647f9[_0x0204('0xa4')]['forEach'](function(_0xbb53c9){if(_0xbb53c9[_0x0204('0xb9')]===_0x0204('0xb7')){var _0x29de2b={'name':_0xbb53c9[_0x0204('0xae')],'value':_0xbb53c9[_0x0204('0xba')]};_0x1027c1[_0x0204('0xaf')](_0x29de2b);}});}_0x488a9e[_0x0204('0x3f')]=_0x1027c1;if(_0x488a9e['options'][_0x0204('0x36')]>0x0){_0x2aa83b(_0x488a9e);}else{if(_0x44d4dc==![]){_0x2aa83b();}else{_0x2aa83b(_0x488a9e);}}});}});} \ No newline at end of file +var _0x8911=['end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','show','params','includeAll','include','find','catch','create','body','findOne','ServicenowConfiguration','length','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_by','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','sys_class_name','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','due_date','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','internalType','push','all','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','label','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus'];(function(_0x13d8df,_0x10e163){var _0x37cf9f=function(_0x2533dd){while(--_0x2533dd){_0x13d8df['push'](_0x13d8df['shift']());}};_0x37cf9f(++_0x10e163);}(_0x8911,0x98));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1891('0x0'));var rimraf=require(_0x1891('0x1'));var zipdir=require(_0x1891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1891('0x3'));var moment=require(_0x1891('0x4'));var BPromise=require(_0x1891('0x5'));var Mustache=require(_0x1891('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1891('0x7'));var ejs=require(_0x1891('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1891('0x9'));var squel=require(_0x1891('0xa'));var crypto=require(_0x1891('0xb'));var jsforce=require(_0x1891('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1891('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1891('0xe'));var hardwareService=require(_0x1891('0xf'));var logger=require(_0x1891('0x10'))(_0x1891('0x11'));var utils=require(_0x1891('0x12'));var config=require(_0x1891('0x13'));var licenseUtil=require(_0x1891('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1891('0x15'));function respondWithStatusCode(_0x1070c5,_0xf10b4){_0xf10b4=_0xf10b4||0xcc;return function(_0x4b1912){if(_0x4b1912){return _0x1070c5[_0x1891('0x16')](_0xf10b4);}return _0x1070c5['status'](_0xf10b4)[_0x1891('0x17')]();};}function respondWithResult(_0x4a00ba,_0x248e52){_0x248e52=_0x248e52||0xc8;return function(_0x384b3c){if(_0x384b3c){return _0x4a00ba[_0x1891('0x18')](_0x248e52)[_0x1891('0x19')](_0x384b3c);}};}function respondWithFilteredResult(_0xde60e3,_0x20c676){return function(_0x26e738){if(_0x26e738){var _0x35da47=typeof _0x20c676[_0x1891('0x1a')]==='undefined'&&typeof _0x20c676[_0x1891('0x1b')]===_0x1891('0x1c');var _0x179edf=_0x26e738[_0x1891('0x1d')];var _0x4f1644=_0x35da47?0x0:_0x20c676[_0x1891('0x1a')];var _0x3b85d9=_0x35da47?_0x26e738[_0x1891('0x1d')]:_0x20c676[_0x1891('0x1a')]+_0x20c676[_0x1891('0x1b')];var _0x4b7e89;if(_0x3b85d9>=_0x179edf){_0x3b85d9=_0x179edf;_0x4b7e89=0xc8;}else{_0x4b7e89=0xce;}_0xde60e3['status'](_0x4b7e89);return _0xde60e3[_0x1891('0x1e')]('Content-Range',_0x4f1644+'-'+_0x3b85d9+'/'+_0x179edf)['json'](_0x26e738);}return null;};}function patchUpdates(_0x278f96){return function(_0x17c2e0){try{jsonpatch[_0x1891('0x1f')](_0x17c2e0,_0x278f96,!![]);}catch(_0x25c7d3){return BPromise[_0x1891('0x20')](_0x25c7d3);}return _0x17c2e0[_0x1891('0x21')]();};}function saveUpdates(_0x5e9e0b,_0x320074){return function(_0x4d6673){if(_0x4d6673){return _0x4d6673[_0x1891('0x22')](_0x5e9e0b)[_0x1891('0x23')](function(_0x3ea900){return _0x3ea900;});}return null;};}function removeEntity(_0x193f88,_0x1f7d2){return function(_0xdd2bb7){if(_0xdd2bb7){return _0xdd2bb7[_0x1891('0x24')]()[_0x1891('0x23')](function(){_0x193f88[_0x1891('0x18')](0xcc)[_0x1891('0x17')]();});}};}function handleEntityNotFound(_0x42857f,_0x3b8ed9){return function(_0x378d2d){if(!_0x378d2d){_0x42857f[_0x1891('0x16')](0x194);}return _0x378d2d;};}function handleError(_0x10ab7d,_0x9146fb){_0x9146fb=_0x9146fb||0x1f4;return function(_0x367f40){logger[_0x1891('0x25')](_0x367f40[_0x1891('0x26')]);if(_0x367f40[_0x1891('0x27')]){delete _0x367f40[_0x1891('0x27')];}_0x10ab7d['status'](_0x9146fb)[_0x1891('0x28')](_0x367f40);};}exports['index']=function(_0x464cfd,_0x421042){var _0x336c3b={},_0x25b8b3={},_0x47037f={'count':0x0,'rows':[]};var _0x571013=_[_0x1891('0x29')](db[_0x1891('0x2a')][_0x1891('0x2b')],function(_0x2e5ca4){return{'name':_0x2e5ca4[_0x1891('0x2c')],'type':_0x2e5ca4['type']['key']};});_0x25b8b3[_0x1891('0x2d')]=_[_0x1891('0x29')](_0x571013,_0x1891('0x27'));_0x25b8b3[_0x1891('0x2e')]=_[_0x1891('0x2f')](_0x464cfd[_0x1891('0x2e')]);_0x25b8b3[_0x1891('0x30')]=_[_0x1891('0x31')](_0x25b8b3['model'],_0x25b8b3[_0x1891('0x2e')]);_0x336c3b[_0x1891('0x32')]=_[_0x1891('0x31')](_0x25b8b3[_0x1891('0x2d')],qs[_0x1891('0x33')](_0x464cfd[_0x1891('0x2e')][_0x1891('0x33')]));_0x336c3b['attributes']=_0x336c3b[_0x1891('0x32')]['length']?_0x336c3b[_0x1891('0x32')]:_0x25b8b3[_0x1891('0x2d')];if(!_0x464cfd[_0x1891('0x2e')]['hasOwnProperty'](_0x1891('0x34'))){_0x336c3b['limit']=qs[_0x1891('0x1b')](_0x464cfd[_0x1891('0x2e')][_0x1891('0x1b')]);_0x336c3b[_0x1891('0x1a')]=qs[_0x1891('0x1a')](_0x464cfd[_0x1891('0x2e')]['offset']);}_0x336c3b[_0x1891('0x35')]=qs[_0x1891('0x36')](_0x464cfd['query'][_0x1891('0x36')]);_0x336c3b[_0x1891('0x37')]=qs[_0x1891('0x30')](_['pick'](_0x464cfd[_0x1891('0x2e')],_0x25b8b3[_0x1891('0x30')]),_0x571013);if(_0x464cfd['query'][_0x1891('0x38')]){_0x336c3b[_0x1891('0x37')]=_[_0x1891('0x39')](_0x336c3b['where'],{'$or':_['map'](_0x571013,function(_0x36fd3a){if(_0x36fd3a[_0x1891('0x3a')]!==_0x1891('0x3b')){var _0x2141b8={};_0x2141b8[_0x36fd3a[_0x1891('0x27')]]={'$like':'%'+_0x464cfd[_0x1891('0x2e')]['filter']+'%'};return _0x2141b8;}})});}_0x336c3b=_[_0x1891('0x39')]({},_0x336c3b,_0x464cfd[_0x1891('0x3c')]);var _0x4f446c={'where':_0x336c3b[_0x1891('0x37')]};return db[_0x1891('0x2a')][_0x1891('0x1d')](_0x4f446c)['then'](function(_0x5a6010){_0x47037f[_0x1891('0x1d')]=_0x5a6010;if(_0x464cfd[_0x1891('0x2e')]['includeAll']){_0x336c3b['include']=[{'all':!![]}];}return db[_0x1891('0x2a')][_0x1891('0x3d')](_0x336c3b);})[_0x1891('0x23')](function(_0x3e0776){_0x47037f['rows']=_0x3e0776;return _0x47037f;})[_0x1891('0x23')](respondWithFilteredResult(_0x421042,_0x336c3b))['catch'](handleError(_0x421042,null));};exports[_0x1891('0x3e')]=function(_0x1d4b60,_0x3a2a68){var _0x2b2a0={'raw':![],'where':{'id':_0x1d4b60[_0x1891('0x3f')]['id']}},_0x5c72de={};_0x5c72de[_0x1891('0x2d')]=_[_0x1891('0x2f')](db['ServicenowAccount'][_0x1891('0x2b')]);_0x5c72de['query']=_[_0x1891('0x2f')](_0x1d4b60[_0x1891('0x2e')]);_0x5c72de[_0x1891('0x30')]=_[_0x1891('0x31')](_0x5c72de[_0x1891('0x2d')],_0x5c72de[_0x1891('0x2e')]);_0x2b2a0[_0x1891('0x32')]=_[_0x1891('0x31')](_0x5c72de[_0x1891('0x2d')],qs['fields'](_0x1d4b60[_0x1891('0x2e')][_0x1891('0x33')]));_0x2b2a0[_0x1891('0x32')]=_0x2b2a0['attributes']['length']?_0x2b2a0['attributes']:_0x5c72de['model'];if(_0x1d4b60[_0x1891('0x2e')][_0x1891('0x40')]){_0x2b2a0[_0x1891('0x41')]=[{'all':!![]}];}_0x2b2a0=_[_0x1891('0x39')]({},_0x2b2a0,_0x1d4b60[_0x1891('0x3c')]);return db[_0x1891('0x2a')][_0x1891('0x42')](_0x2b2a0)[_0x1891('0x23')](handleEntityNotFound(_0x3a2a68,null))[_0x1891('0x23')](respondWithResult(_0x3a2a68,null))[_0x1891('0x43')](handleError(_0x3a2a68,null));};exports[_0x1891('0x44')]=function(_0x27cdc2,_0x3f7474){return db[_0x1891('0x2a')][_0x1891('0x44')](_0x27cdc2['body'],{})['then'](respondWithResult(_0x3f7474,0xc9))[_0x1891('0x43')](handleError(_0x3f7474,null));};exports[_0x1891('0x22')]=function(_0xb4771e,_0x33e2cf){if(_0xb4771e['body']['id']){delete _0xb4771e[_0x1891('0x45')]['id'];}return db[_0x1891('0x2a')]['find']({'where':{'id':_0xb4771e[_0x1891('0x3f')]['id']}})['then'](handleEntityNotFound(_0x33e2cf,null))['then'](saveUpdates(_0xb4771e[_0x1891('0x45')],null))['then'](respondWithResult(_0x33e2cf,null))[_0x1891('0x43')](handleError(_0x33e2cf,null));};exports[_0x1891('0x24')]=function(_0x19d403,_0x400663){return db[_0x1891('0x2a')][_0x1891('0x42')]({'where':{'id':_0x19d403['params']['id']}})[_0x1891('0x23')](handleEntityNotFound(_0x400663,null))[_0x1891('0x23')](removeEntity(_0x400663,null))[_0x1891('0x43')](handleError(_0x400663,null));};exports['getConfigurations']=function(_0x18792f,_0x3249ec,_0x12a97e){var _0x43d64c={};var _0xd30db7={};var _0x2c25ee;var _0x2272ea;return db[_0x1891('0x2a')][_0x1891('0x46')]({'where':{'id':_0x18792f[_0x1891('0x3f')]['id']}})[_0x1891('0x23')](handleEntityNotFound(_0x3249ec,null))[_0x1891('0x23')](function(_0x173ccd){if(_0x173ccd){_0x2c25ee=_0x173ccd;_0xd30db7[_0x1891('0x2d')]=_[_0x1891('0x2f')](db[_0x1891('0x47')][_0x1891('0x2b')]);_0xd30db7[_0x1891('0x2e')]=_[_0x1891('0x2f')](_0x18792f[_0x1891('0x2e')]);_0xd30db7[_0x1891('0x30')]=_['intersection'](_0xd30db7[_0x1891('0x2d')],_0xd30db7[_0x1891('0x2e')]);_0x43d64c['attributes']=_['intersection'](_0xd30db7[_0x1891('0x2d')],qs['fields'](_0x18792f['query'][_0x1891('0x33')]));_0x43d64c[_0x1891('0x32')]=_0x43d64c[_0x1891('0x32')][_0x1891('0x48')]?_0x43d64c[_0x1891('0x32')]:_0xd30db7[_0x1891('0x2d')];_0x43d64c[_0x1891('0x35')]=qs[_0x1891('0x36')](_0x18792f[_0x1891('0x2e')][_0x1891('0x36')]);_0x43d64c[_0x1891('0x37')]=qs[_0x1891('0x30')](_['pick'](_0x18792f[_0x1891('0x2e')],_0xd30db7['filters']));if(_0x18792f[_0x1891('0x2e')][_0x1891('0x38')]){_0x43d64c[_0x1891('0x37')]=_[_0x1891('0x39')](_0x43d64c[_0x1891('0x37')],{'$or':_[_0x1891('0x29')](_0x43d64c[_0x1891('0x32')],function(_0x2bdb19){var _0x972593={};_0x972593[_0x2bdb19]={'$like':'%'+_0x18792f['query']['filter']+'%'};return _0x972593;})});}_0x43d64c=_['merge']({},_0x43d64c,_0x18792f['options']);return _0x2c25ee[_0x1891('0x49')](_0x43d64c);}})['then'](function(_0xae228e){if(_0xae228e){_0x2272ea=_0xae228e['length'];if(!_0x18792f[_0x1891('0x2e')][_0x1891('0x4a')](_0x1891('0x34'))){_0x43d64c[_0x1891('0x1b')]=qs[_0x1891('0x1b')](_0x18792f['query'][_0x1891('0x1b')]);_0x43d64c[_0x1891('0x1a')]=qs[_0x1891('0x1a')](_0x18792f[_0x1891('0x2e')][_0x1891('0x1a')]);}return _0x2c25ee['getConfigurations'](_0x43d64c);}})[_0x1891('0x23')](function(_0x5e1667){if(_0x5e1667){return _0x5e1667?{'count':_0x2272ea,'rows':_0x5e1667}:null;}})[_0x1891('0x23')](respondWithResult(_0x3249ec,null))[_0x1891('0x43')](handleError(_0x3249ec,null));};exports[_0x1891('0x4b')]=function(_0x3677ad,_0x36076e,_0x5c5a6b){if(_0x3677ad[_0x1891('0x45')]['id']){delete _0x3677ad[_0x1891('0x45')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3677ad['params']['id']}})[_0x1891('0x23')](handleEntityNotFound(_0x36076e,null))[_0x1891('0x23')](function(_0x356666){if(_0x356666){_0x3677ad[_0x1891('0x45')][_0x1891('0x4c')]=_0x356666['id'];_0x3677ad['body'][_0x1891('0x4d')]=integrations['getSubjects'](_0x3677ad[_0x1891('0x45')]['channel'],_0x3677ad[_0x1891('0x45')][_0x1891('0x3a')]);_0x3677ad[_0x1891('0x45')][_0x1891('0x4e')]=integrations[_0x1891('0x4f')](_0x3677ad[_0x1891('0x45')][_0x1891('0x50')],_0x3677ad[_0x1891('0x45')]['type']);return db[_0x1891('0x47')][_0x1891('0x44')](_0x3677ad[_0x1891('0x45')],{'include':[{'model':db[_0x1891('0x51')],'as':_0x1891('0x4d')},{'model':db['ServicenowField'],'as':_0x1891('0x4e')}]});}return null;})[_0x1891('0x23')](respondWithResult(_0x36076e,null))[_0x1891('0x43')](handleError(_0x36076e,null));};exports[_0x1891('0x52')]=function(_0x45a37f,_0x474098,_0x4eefdf){var _0x14f585=[_0x1891('0x53'),_0x1891('0x54'),_0x1891('0x55'),_0x1891('0x56'),'close_code',_0x1891('0x57'),'incident_state',_0x1891('0x58'),_0x1891('0x59')];var _0x94910e=[_0x1891('0x5a'),'made_sla',_0x1891('0x5b'),_0x1891('0x5c'),'upon_reject',_0x1891('0x5d'),_0x1891('0x5e'),'hold_reason',_0x1891('0x5f'),_0x1891('0x60'),_0x1891('0x61'),_0x1891('0x62'),_0x1891('0x63'),_0x1891('0x64'),'sys_created_on','sys_domain','state',_0x1891('0x65'),_0x1891('0x55'),_0x1891('0x35'),'calendar_stc','closed_at',_0x1891('0x66'),_0x1891('0x67'),'impact','active',_0x1891('0x68'),_0x1891('0x69'),_0x1891('0x6a'),_0x1891('0x6b'),'rfc',_0x1891('0x6c'),_0x1891('0x6d'),'opened_at',_0x1891('0x6e'),_0x1891('0x6f'),_0x1891('0x70'),_0x1891('0x71'),_0x1891('0x72'),_0x1891('0x73'),_0x1891('0x74'),_0x1891('0x56'),_0x1891('0x75'),'short_description',_0x1891('0x76'),_0x1891('0x77'),_0x1891('0x78'),'work_start',_0x1891('0x79'),'business_stc',_0x1891('0x7a'),'description',_0x1891('0x7b'),_0x1891('0x57'),_0x1891('0x7c'),'close_notes','closed_by',_0x1891('0x7d'),_0x1891('0x7e'),'sys_id',_0x1891('0x7f'),_0x1891('0x80'),_0x1891('0x81'),_0x1891('0x82'),_0x1891('0x83'),_0x1891('0x84'),_0x1891('0x85'),_0x1891('0x86'),'assigned_to',_0x1891('0x58'),_0x1891('0x87'),_0x1891('0x88'),'approval','comments_and_work_notes',_0x1891('0x89'),'sys_mod_count',_0x1891('0x8a'),_0x1891('0x8b'),_0x1891('0x8c'),_0x1891('0x8d'),'correlation_id','location',_0x1891('0x59')];var _0x56aaee='';var _0x3683cd='';var _0x2f1a2f=[];var _0x4b1447='';var _0x5195d9='';var _0x5f0a56=[];var _0x589a6b='';var _0x310b36='';var _0x119c5a={};var _0x4a266d='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x45a37f[_0x1891('0x3f')]['id']},'attributes':['id',_0x1891('0x8e'),_0x1891('0x8f'),_0x1891('0x90'),_0x1891('0x91'),_0x1891('0x92')]})[_0x1891('0x23')](handleEntityNotFound(_0x474098,null))['then'](function(_0x227ab8){if(_0x227ab8){_0x4a266d=_0x227ab8[_0x1891('0x91')];var _0x40364d=_0x4a266d['slice'](-0x1);if(_0x40364d==='/'){_0x4a266d=_0x4a266d[_0x1891('0x93')](0x0,_0x4a266d['lastIndexOf'](_0x40364d));}_0x310b36=util[_0x1891('0x94')](_0x1891('0x95'),_0x4a266d);_0x589a6b=util[_0x1891('0x94')](_0x1891('0x96'),_0x4a266d);_0x119c5a={'user':_0x227ab8['username'],'pass':_0x227ab8['password']};var _0x3f3991={'method':_0x1891('0x97'),'uri':_0x310b36+_0x1891('0x98'),'auth':_0x119c5a,'json':!![]};return rp(_0x3f3991);}})['then'](function(_0x2b826d){if(_0x2b826d[_0x1891('0x99')][_0x1891('0x48')]>0x0){_0x56aaee=_0x2b826d[_0x1891('0x99')];}console[_0x1891('0x9a')]('incident\x20table\x20objects',_0x56aaee);_0x5f0a56=[];_0x3683cd=Object[_0x1891('0x9b')]([],_0x56aaee);_[_0x1891('0x9c')](_0x3683cd,function(_0x35d76c){return!_0x14f585['includes'](_0x35d76c[_0x1891('0x27')]);});_0x3683cd['forEach'](function(_0x241b9f){var _0x5f424c=createFieldObject(_0x589a6b,_0x119c5a,_0x241b9f[_0x1891('0x9d')],_0x241b9f[_0x1891('0x27')],_0x241b9f['label'],![]);_0x5f0a56[_0x1891('0x9e')](_0x5f424c);});return Promise[_0x1891('0x9f')](_0x5f0a56);})[_0x1891('0x23')](function(_0x916fe9){_0x2f1a2f=_0x916fe9;_0x4b1447=Object[_0x1891('0x9b')]([],_0x56aaee);console[_0x1891('0x9a')](_0x1891('0xa0'),_0x56aaee);_[_0x1891('0x9c')](_0x4b1447,function(_0x36b8b3){return _0x94910e['includes'](_0x36b8b3[_0x1891('0x27')]);});console[_0x1891('0x9a')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4b1447);_0x5f0a56=[];_0x4b1447[_0x1891('0xa1')](function(_0x471d02){var _0x18912c=createFieldObject(_0x589a6b,_0x119c5a,_0x471d02[_0x1891('0x9d')],_0x471d02[_0x1891('0x27')],_0x471d02['label'],!![]);_0x5f0a56['push'](_0x18912c);});return Promise[_0x1891('0x9f')](_0x5f0a56);})[_0x1891('0x23')](function(_0x4e8ce6){_0x5195d9=_0x4e8ce6;var _0x30c863=_0x2f1a2f[_0x1891('0xa2')](_0x5195d9);return{'count':_0x30c863[_0x1891('0x48')],'rows':_0x30c863};})[_0x1891('0x23')](respondWithResult(_0x474098,null))['catch'](function(_0x4b00f7){console['log'](_0x1891('0xa3')+_0x4b00f7);var _0x439a79=_0x45a37f[_0x1891('0x2e')][_0x1891('0xa4')]?0x1f4:_0x4b00f7[_0x1891('0xa5')]||0x1f4;logger[_0x1891('0x25')](_0x4b00f7['stack']);delete _0x4b00f7[_0x1891('0x27')];if(_0x439a79===0x191){_0x439a79=0x190;}_0x474098[_0x1891('0x18')](_0x439a79)[_0x1891('0x28')](_0x45a37f[_0x1891('0x2e')][_0x1891('0xa4')]?{'message':_0x1891('0xa6'),'statusCode':_0x4b00f7[_0x1891('0xa5')]}:_0x4b00f7);});};function createFieldObject(_0x138420,_0x3669f2,_0x121958,_0x398e04,_0x474036,_0x286141){return new Promise(function(_0x412880,_0x366850){var _0x1194ef={'id':_0x398e04,'name':_0x474036,'custom':_0x286141};if(_0x121958===_0x1891('0xa7')){_0x1194ef['options']=[{'name':_0x1891('0xa8'),'value':_0x1891('0xa9')},{'name':_0x1891('0xaa'),'value':_0x1891('0xab')}];_0x412880(_0x1194ef);}else{var _0xca2485={'method':_0x1891('0x97'),'uri':_0x138420+'sys_choice?sysparm_query=name=incident^element='+_0x398e04,'auth':_0x3669f2,'json':!![]};return rp(_0xca2485)[_0x1891('0x23')](function(_0xdc0d48){var _0x2db17d=[];if(_0xdc0d48['result'][_0x1891('0x48')]>0x0){_0xdc0d48['result'][_0x1891('0xa1')](function(_0x579d69){if(_0x579d69[_0x1891('0xac')]==='false'){var _0x5defe7={'name':_0x579d69[_0x1891('0xad')],'value':_0x579d69[_0x1891('0xae')]};_0x2db17d[_0x1891('0x9e')](_0x5defe7);}});}_0x1194ef[_0x1891('0x3c')]=_0x2db17d;if(_0x1194ef[_0x1891('0x3c')][_0x1891('0x48')]>0x0){_0x412880(_0x1194ef);}else{if(_0x286141==![]){_0x412880();}else{_0x412880(_0x1194ef);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4b200e5..8013916 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 _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5ccedb,_0x519aae){_0x5ccedb=_0x5ccedb-0x0;var _0x17b4f8=_0x3f8a[_0x5ccedb];return _0x17b4f8;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x60f860,_0x147356){var _0x442d46=function(_0x5796aa){while(--_0x5796aa){_0x60f860['push'](_0x60f860['shift']());}};_0x442d46(++_0x147356);}(_0x038b,0x114));var _0xb038=function(_0x13ef76,_0x108e0b){_0x13ef76=_0x13ef76-0x0;var _0x3796b0=_0x038b[_0x13ef76];return _0x3796b0;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 60fe89d..e973aea 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 _0x4af2=['request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetServicenowAccount','ServicenowAccount','findAll','raw','options','limit','map','include','model','attributes','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x4af2,0x1a4));var _0x24af=function(_0xb12ab6,_0x37ba97){_0xb12ab6=_0xb12ab6-0x0;var _0x595a04=_0x4af2[_0xb12ab6];return _0x595a04;};'use strict';var _=require(_0x24af('0x0'));var util=require(_0x24af('0x1'));var moment=require(_0x24af('0x2'));var BPromise=require(_0x24af('0x3'));var rs=require(_0x24af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24af('0x5'))['db'];var utils=require(_0x24af('0x6'));var logger=require(_0x24af('0x7'))(_0x24af('0x8'));var config=require(_0x24af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x24af('0xa')][_0x24af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44ca1c,_0x1122d9,_0x4ae1e8){return new BPromise(function(_0x436ff4,_0x36f580){return client[_0x24af('0xc')](_0x44ca1c,_0x4ae1e8)[_0x24af('0xd')](function(_0x279cd3){logger[_0x24af('0xe')](_0x24af('0xf'),_0x1122d9,'request\x20sent');logger[_0x24af('0x10')](_0x24af('0x11'),_0x1122d9,_0x24af('0x12'),JSON[_0x24af('0x13')](_0x279cd3));if(_0x279cd3[_0x24af('0x14')]){if(_0x279cd3[_0x24af('0x14')]['code']===0x1f4){logger['error'](_0x24af('0xf'),_0x1122d9,_0x279cd3[_0x24af('0x14')][_0x24af('0x15')]);return _0x36f580(_0x279cd3[_0x24af('0x14')][_0x24af('0x15')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1122d9,_0x279cd3[_0x24af('0x14')]['message']);return _0x436ff4(_0x279cd3[_0x24af('0x14')][_0x24af('0x15')]);}else{logger[_0x24af('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x1122d9,_0x24af('0x12'));_0x436ff4(_0x279cd3['result']['message']);}})[_0x24af('0x16')](function(_0x409b69){logger[_0x24af('0x14')](_0x24af('0xf'),_0x1122d9,_0x409b69);_0x36f580(_0x409b69);});});}exports[_0x24af('0x17')]=function(_0x770df3){var _0x20aff4=this;return new Promise(function(_0x55992b,_0x4c75a1){return db[_0x24af('0x18')][_0x24af('0x19')]({'raw':_0x770df3['options']?_0x770df3['options'][_0x24af('0x1a')]===undefined?!![]:![]:!![],'where':_0x770df3['options']?_0x770df3[_0x24af('0x1b')]['where']||null:null,'attributes':_0x770df3[_0x24af('0x1b')]?_0x770df3[_0x24af('0x1b')]['attributes']||null:null,'limit':_0x770df3[_0x24af('0x1b')]?_0x770df3[_0x24af('0x1b')][_0x24af('0x1c')]||null:null,'include':_0x770df3[_0x24af('0x1b')]?_0x770df3['options']['include']?_[_0x24af('0x1d')](_0x770df3[_0x24af('0x1b')][_0x24af('0x1e')],function(_0x139212){return{'model':db[_0x139212[_0x24af('0x1f')]],'as':_0x139212['as'],'attributes':_0x139212[_0x24af('0x20')],'include':_0x139212[_0x24af('0x1e')]?_['map'](_0x139212[_0x24af('0x1e')],function(_0x2b1e53){return{'model':db[_0x2b1e53[_0x24af('0x1f')]],'as':_0x2b1e53['as'],'attributes':_0x2b1e53[_0x24af('0x20')],'include':_0x2b1e53[_0x24af('0x1e')]?_[_0x24af('0x1d')](_0x2b1e53[_0x24af('0x1e')],function(_0x1ffc56){return{'model':db[_0x1ffc56[_0x24af('0x1f')]],'as':_0x1ffc56['as'],'attributes':_0x1ffc56['attributes']};}):[]};}):[]};}):[]:[]})[_0x24af('0xd')](function(_0x297638){logger[_0x24af('0xe')]('GetServicenowAccount',_0x770df3);logger['debug'](_0x24af('0x17'),_0x770df3,JSON[_0x24af('0x13')](_0x297638));_0x55992b(_0x297638);})[_0x24af('0x16')](function(_0x4c30c6){logger[_0x24af('0x14')](_0x24af('0x17'),_0x4c30c6[_0x24af('0x15')],_0x770df3);_0x4c75a1(_0x20aff4['error'](0x1f4,_0x4c30c6['message']));});});};exports[_0x24af('0x21')]=function(_0x340d0b){var _0x4839cd=this;return new Promise(function(_0x332b6e,_0x5781ca){return db[_0x24af('0x18')][_0x24af('0x22')]({'raw':_0x340d0b[_0x24af('0x1b')]?_0x340d0b[_0x24af('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x340d0b[_0x24af('0x1b')]?_0x340d0b[_0x24af('0x1b')][_0x24af('0x23')]||null:null,'attributes':_0x340d0b[_0x24af('0x1b')]?_0x340d0b[_0x24af('0x1b')][_0x24af('0x20')]||null:null,'include':_0x340d0b['options']?_0x340d0b['options'][_0x24af('0x1e')]?_['map'](_0x340d0b[_0x24af('0x1b')][_0x24af('0x1e')],function(_0x543391){return{'model':db[_0x543391['model']],'as':_0x543391['as'],'attributes':_0x543391['attributes'],'include':_0x543391[_0x24af('0x1e')]?_[_0x24af('0x1d')](_0x543391['include'],function(_0x246ac2){return{'model':db[_0x246ac2[_0x24af('0x1f')]],'as':_0x246ac2['as'],'attributes':_0x246ac2[_0x24af('0x20')],'include':_0x246ac2[_0x24af('0x1e')]?_[_0x24af('0x1d')](_0x246ac2[_0x24af('0x1e')],function(_0x4c4b82){return{'model':db[_0x4c4b82['model']],'as':_0x4c4b82['as'],'attributes':_0x4c4b82[_0x24af('0x20')]};}):[]};}):[]};}):[]:[]})[_0x24af('0xd')](function(_0x27e036){logger[_0x24af('0xe')](_0x24af('0x21'),_0x340d0b);logger[_0x24af('0x10')]('ShowServicenowAccount',_0x340d0b,JSON[_0x24af('0x13')](_0x27e036));_0x332b6e(_0x27e036);})[_0x24af('0x16')](function(_0x3cb406){logger[_0x24af('0x14')](_0x24af('0x21'),_0x3cb406['message'],_0x340d0b);_0x5781ca(_0x4839cd[_0x24af('0x14')](0x1f4,_0x3cb406[_0x24af('0x15')]));});});}; \ No newline at end of file +var _0x9aa5=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','ShowServicenowAccount','find','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x42779c,_0x4f12cf){var _0x101538=function(_0x19813a){while(--_0x19813a){_0x42779c['push'](_0x42779c['shift']());}};_0x101538(++_0x4f12cf);}(_0x9aa5,0xc9));var _0x59aa=function(_0x20522a,_0x11bb0){_0x20522a=_0x20522a-0x0;var _0x3105e0=_0x9aa5[_0x20522a];return _0x3105e0;};'use strict';var _=require(_0x59aa('0x0'));var util=require(_0x59aa('0x1'));var moment=require('moment');var BPromise=require(_0x59aa('0x2'));var rs=require(_0x59aa('0x3'));var fs=require('fs');var Redis=require(_0x59aa('0x4'));var db=require(_0x59aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x59aa('0x6'))(_0x59aa('0x7'));var config=require(_0x59aa('0x8'));var jayson=require(_0x59aa('0x9'));var client=jayson[_0x59aa('0xa')][_0x59aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ce4b9,_0x801ae1,_0x3a2263){return new BPromise(function(_0x4370d8,_0x38c4e6){return client['request'](_0x2ce4b9,_0x3a2263)[_0x59aa('0xc')](function(_0x185dc6){logger[_0x59aa('0xd')](_0x59aa('0xe'),_0x801ae1,_0x59aa('0xf'));logger[_0x59aa('0x10')](_0x59aa('0x11'),_0x801ae1,_0x59aa('0xf'),JSON[_0x59aa('0x12')](_0x185dc6));if(_0x185dc6['error']){if(_0x185dc6[_0x59aa('0x13')]['code']===0x1f4){logger['error'](_0x59aa('0xe'),_0x801ae1,_0x185dc6[_0x59aa('0x13')][_0x59aa('0x14')]);return _0x38c4e6(_0x185dc6['error'][_0x59aa('0x14')]);}logger[_0x59aa('0x13')](_0x59aa('0xe'),_0x801ae1,_0x185dc6[_0x59aa('0x13')][_0x59aa('0x14')]);return _0x4370d8(_0x185dc6['error'][_0x59aa('0x14')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x801ae1,_0x59aa('0xf'));_0x4370d8(_0x185dc6[_0x59aa('0x15')][_0x59aa('0x14')]);}})[_0x59aa('0x16')](function(_0x24071e){logger[_0x59aa('0x13')](_0x59aa('0xe'),_0x801ae1,_0x24071e);_0x38c4e6(_0x24071e);});});}exports[_0x59aa('0x17')]=function(_0x499be0){var _0x5d71fa=this;return new Promise(function(_0x36a81a,_0x242ea0){return db[_0x59aa('0x18')][_0x59aa('0x19')]({'raw':_0x499be0['options']?_0x499be0[_0x59aa('0x1a')][_0x59aa('0x1b')]===undefined?!![]:![]:!![],'where':_0x499be0[_0x59aa('0x1a')]?_0x499be0[_0x59aa('0x1a')][_0x59aa('0x1c')]||null:null,'attributes':_0x499be0[_0x59aa('0x1a')]?_0x499be0[_0x59aa('0x1a')][_0x59aa('0x1d')]||null:null,'limit':_0x499be0[_0x59aa('0x1a')]?_0x499be0[_0x59aa('0x1a')][_0x59aa('0x1e')]||null:null,'include':_0x499be0[_0x59aa('0x1a')]?_0x499be0['options'][_0x59aa('0x1f')]?_[_0x59aa('0x20')](_0x499be0[_0x59aa('0x1a')][_0x59aa('0x1f')],function(_0x5b4265){return{'model':db[_0x5b4265['model']],'as':_0x5b4265['as'],'attributes':_0x5b4265['attributes'],'include':_0x5b4265[_0x59aa('0x1f')]?_['map'](_0x5b4265['include'],function(_0x29514e){return{'model':db[_0x29514e['model']],'as':_0x29514e['as'],'attributes':_0x29514e[_0x59aa('0x1d')],'include':_0x29514e['include']?_['map'](_0x29514e[_0x59aa('0x1f')],function(_0x5520e0){return{'model':db[_0x5520e0['model']],'as':_0x5520e0['as'],'attributes':_0x5520e0[_0x59aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x59aa('0xc')](function(_0x4e2455){logger['info'](_0x59aa('0x17'),_0x499be0);logger[_0x59aa('0x10')](_0x59aa('0x17'),_0x499be0,JSON[_0x59aa('0x12')](_0x4e2455));_0x36a81a(_0x4e2455);})['catch'](function(_0x19b96e){logger['error'](_0x59aa('0x17'),_0x19b96e['message'],_0x499be0);_0x242ea0(_0x5d71fa['error'](0x1f4,_0x19b96e[_0x59aa('0x14')]));});});};exports[_0x59aa('0x21')]=function(_0x1222c1){var _0x3fa04c=this;return new Promise(function(_0x62cfbf,_0x1f6be3){return db['ServicenowAccount'][_0x59aa('0x22')]({'raw':_0x1222c1['options']?_0x1222c1[_0x59aa('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1222c1[_0x59aa('0x1a')]?_0x1222c1['options']['where']||null:null,'attributes':_0x1222c1[_0x59aa('0x1a')]?_0x1222c1[_0x59aa('0x1a')][_0x59aa('0x1d')]||null:null,'include':_0x1222c1[_0x59aa('0x1a')]?_0x1222c1['options'][_0x59aa('0x1f')]?_['map'](_0x1222c1[_0x59aa('0x1a')][_0x59aa('0x1f')],function(_0x105a76){return{'model':db[_0x105a76[_0x59aa('0x23')]],'as':_0x105a76['as'],'attributes':_0x105a76['attributes'],'include':_0x105a76[_0x59aa('0x1f')]?_[_0x59aa('0x20')](_0x105a76[_0x59aa('0x1f')],function(_0x2ddb60){return{'model':db[_0x2ddb60[_0x59aa('0x23')]],'as':_0x2ddb60['as'],'attributes':_0x2ddb60[_0x59aa('0x1d')],'include':_0x2ddb60[_0x59aa('0x1f')]?_['map'](_0x2ddb60[_0x59aa('0x1f')],function(_0x501c4a){return{'model':db[_0x501c4a[_0x59aa('0x23')]],'as':_0x501c4a['as'],'attributes':_0x501c4a[_0x59aa('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189582){logger[_0x59aa('0xd')](_0x59aa('0x21'),_0x1222c1);logger[_0x59aa('0x10')](_0x59aa('0x21'),_0x1222c1,JSON[_0x59aa('0x12')](_0x189582));_0x62cfbf(_0x189582);})[_0x59aa('0x16')](function(_0x3731a8){logger[_0x59aa('0x13')](_0x59aa('0x21'),_0x3731a8['message'],_0x1222c1);_0x1f6be3(_0x3fa04c['error'](0x1f4,_0x3731a8['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a6f2f91..9cba7a9 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 _0xd5e0=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5e0,0x81));var _0x0d5e=function(_0x55c376,_0x27204f){_0x55c376=_0x55c376-0x0;var _0x30502f=_0xd5e0[_0x55c376];return _0x30502f;};'use strict';var multer=require(_0x0d5e('0x0'));var util=require(_0x0d5e('0x1'));var path=require(_0x0d5e('0x2'));var timeout=require(_0x0d5e('0x3'));var express=require(_0x0d5e('0x4'));var router=express['Router']();var fs_extra=require(_0x0d5e('0x5'));var auth=require(_0x0d5e('0x6'));var interaction=require(_0x0d5e('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x0d5e('0x8')]('/',auth[_0x0d5e('0x9')](),controller['index']);router[_0x0d5e('0x8')]('/:id',auth[_0x0d5e('0x9')](),controller[_0x0d5e('0xa')]);router[_0x0d5e('0x8')](_0x0d5e('0xb'),auth[_0x0d5e('0x9')](),controller['getFields']);router[_0x0d5e('0x8')](_0x0d5e('0xc'),auth['isAuthenticated'](),controller[_0x0d5e('0xd')]);router[_0x0d5e('0x8')](_0x0d5e('0xe'),auth[_0x0d5e('0x9')](),controller['getDescriptions']);router[_0x0d5e('0xf')]('/',auth[_0x0d5e('0x9')](),controller['create']);router[_0x0d5e('0x10')](_0x0d5e('0x11'),auth[_0x0d5e('0x9')](),controller[_0x0d5e('0x12')]);router[_0x0d5e('0x13')]('/:id',auth[_0x0d5e('0x9')](),controller[_0x0d5e('0x14')]);module[_0x0d5e('0x15')]=router; \ No newline at end of file +var _0xf703=['post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x550e44,_0x33216e){var _0x3849ad=function(_0x2836e5){while(--_0x2836e5){_0x550e44['push'](_0x550e44['shift']());}};_0x3849ad(++_0x33216e);}(_0xf703,0x149));var _0x3f70=function(_0x24792b,_0x30694a){_0x24792b=_0x24792b-0x0;var _0x3e7e10=_0xf703[_0x24792b];return _0x3e7e10;};'use strict';var multer=require('multer');var util=require(_0x3f70('0x0'));var path=require(_0x3f70('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f70('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f70('0x3'));var interaction=require(_0x3f70('0x4'));var config=require(_0x3f70('0x5'));var controller=require(_0x3f70('0x6'));router[_0x3f70('0x7')]('/',auth[_0x3f70('0x8')](),controller[_0x3f70('0x9')]);router[_0x3f70('0x7')](_0x3f70('0xa'),auth[_0x3f70('0x8')](),controller[_0x3f70('0xb')]);router['get'](_0x3f70('0xc'),auth['isAuthenticated'](),controller[_0x3f70('0xd')]);router[_0x3f70('0x7')](_0x3f70('0xe'),auth[_0x3f70('0x8')](),controller['getSubjects']);router[_0x3f70('0x7')](_0x3f70('0xf'),auth[_0x3f70('0x8')](),controller['getDescriptions']);router[_0x3f70('0x10')]('/',auth[_0x3f70('0x8')](),controller[_0x3f70('0x11')]);router[_0x3f70('0x12')]('/:id',auth[_0x3f70('0x8')](),controller[_0x3f70('0x13')]);router[_0x3f70('0x14')](_0x3f70('0xa'),auth[_0x3f70('0x8')](),controller[_0x3f70('0x15')]);module[_0x3f70('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b9abb63..ca49c9c 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 _0x0413=['STRING','sequelize'];(function(_0x308c09,_0x2f26a1){var _0x29989b=function(_0x25bee6){while(--_0x25bee6){_0x308c09['push'](_0x308c09['shift']());}};_0x29989b(++_0x2f26a1);}(_0x0413,0x77));var _0x3041=function(_0x5a8d25,_0x35524f){_0x5a8d25=_0x5a8d25-0x0;var _0x9b1ee8=_0x0413[_0x5a8d25];return _0x9b1ee8;};'use strict';var Sequelize=require(_0x3041('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3041('0x1')]}}; \ No newline at end of file +var _0xf294=['STRING','sequelize','exports'];(function(_0x562205,_0x651b57){var _0x9703f9=function(_0x47d9fa){while(--_0x47d9fa){_0x562205['push'](_0x562205['shift']());}};_0x9703f9(++_0x651b57);}(_0xf294,0x169));var _0x4f29=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0xf294[_0x223bdb];return _0xef8e68;};'use strict';var Sequelize=require(_0x4f29('0x0'));module[_0x4f29('0x1')]={'name':{'type':Sequelize[_0x4f29('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 8de227f..5bd11d8 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 _0x7990=['show','params','keys','length','includeAll','find','catch','create','body','getFields','findOne','ServicenowField','order','merge','hasOwnProperty','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','nolimit','sort','where','filters','filter','VIRTUAL','options','count','include','findAll','rows'];(function(_0x136171,_0x393e90){var _0x5c228a=function(_0x1dfe3c){while(--_0x1dfe3c){_0x136171['push'](_0x136171['shift']());}};_0x5c228a(++_0x393e90);}(_0x7990,0xb2));var _0x0799=function(_0x50d3cd,_0x2d05c2){_0x50d3cd=_0x50d3cd-0x0;var _0x1a0ffd=_0x7990[_0x50d3cd];return _0x1a0ffd;};'use strict';var emlformat=require(_0x0799('0x0'));var rimraf=require(_0x0799('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0799('0x2'));var rp=require(_0x0799('0x3'));var moment=require('moment');var BPromise=require(_0x0799('0x4'));var Mustache=require(_0x0799('0x5'));var util=require(_0x0799('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0799('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0799('0x8'));var squel=require('squel');var crypto=require(_0x0799('0x9'));var jsforce=require(_0x0799('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0799('0xb'));var querystring=require('querystring');var Papa=require(_0x0799('0xc'));var Redis=require(_0x0799('0xd'));var authService=require(_0x0799('0xe'));var qs=require(_0x0799('0xf'));var as=require(_0x0799('0x10'));var hardwareService=require(_0x0799('0x11'));var logger=require(_0x0799('0x12'))('api');var utils=require(_0x0799('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0799('0x14'))['db'];function respondWithStatusCode(_0x5cde78,_0x1a8faf){_0x1a8faf=_0x1a8faf||0xcc;return function(_0x536ea4){if(_0x536ea4){return _0x5cde78[_0x0799('0x15')](_0x1a8faf);}return _0x5cde78[_0x0799('0x16')](_0x1a8faf)[_0x0799('0x17')]();};}function respondWithResult(_0x16676b,_0x217ef7){_0x217ef7=_0x217ef7||0xc8;return function(_0x478193){if(_0x478193){return _0x16676b[_0x0799('0x16')](_0x217ef7)[_0x0799('0x18')](_0x478193);}};}function respondWithFilteredResult(_0x5c6407,_0xd4140d){return function(_0x1ceda0){if(_0x1ceda0){var _0x5b0377=typeof _0xd4140d[_0x0799('0x19')]===_0x0799('0x1a')&&typeof _0xd4140d[_0x0799('0x1b')]===_0x0799('0x1a');var _0x351127=_0x1ceda0['count'];var _0x4dad04=_0x5b0377?0x0:_0xd4140d[_0x0799('0x19')];var _0x53a3d4=_0x5b0377?_0x1ceda0['count']:_0xd4140d['offset']+_0xd4140d['limit'];var _0x7b58ac;if(_0x53a3d4>=_0x351127){_0x53a3d4=_0x351127;_0x7b58ac=0xc8;}else{_0x7b58ac=0xce;}_0x5c6407[_0x0799('0x16')](_0x7b58ac);return _0x5c6407[_0x0799('0x1c')](_0x0799('0x1d'),_0x4dad04+'-'+_0x53a3d4+'/'+_0x351127)['json'](_0x1ceda0);}return null;};}function patchUpdates(_0x541c18){return function(_0xf981e8){try{jsonpatch[_0x0799('0x1e')](_0xf981e8,_0x541c18,!![]);}catch(_0x4f3c38){return BPromise[_0x0799('0x1f')](_0x4f3c38);}return _0xf981e8[_0x0799('0x20')]();};}function saveUpdates(_0x18166f,_0x180c13){return function(_0x3ac48e){if(_0x3ac48e){return _0x3ac48e['update'](_0x18166f)['then'](function(_0x4707a1){return _0x4707a1;});}return null;};}function removeEntity(_0x2795e2,_0x4959e9){return function(_0x57d292){if(_0x57d292){return _0x57d292[_0x0799('0x21')]()[_0x0799('0x22')](function(){_0x2795e2[_0x0799('0x16')](0xcc)[_0x0799('0x17')]();});}};}function handleEntityNotFound(_0x5f4b63,_0x38a54c){return function(_0x19aac1){if(!_0x19aac1){_0x5f4b63[_0x0799('0x15')](0x194);}return _0x19aac1;};}function handleError(_0x4e017e,_0x25a92c){_0x25a92c=_0x25a92c||0x1f4;return function(_0x219b32){logger[_0x0799('0x23')](_0x219b32[_0x0799('0x24')]);if(_0x219b32['name']){delete _0x219b32['name'];}_0x4e017e[_0x0799('0x16')](_0x25a92c)[_0x0799('0x25')](_0x219b32);};}exports[_0x0799('0x26')]=function(_0x587220,_0x54ddbc){var _0x2a80cd={},_0x4bdc57={},_0x23cab5={'count':0x0,'rows':[]};var _0x443960=_['map'](db[_0x0799('0x27')][_0x0799('0x28')],function(_0x1f3d04){return{'name':_0x1f3d04[_0x0799('0x29')],'type':_0x1f3d04[_0x0799('0x2a')][_0x0799('0x2b')]};});_0x4bdc57[_0x0799('0x2c')]=_[_0x0799('0x2d')](_0x443960,_0x0799('0x2e'));_0x4bdc57['query']=_['keys'](_0x587220[_0x0799('0x2f')]);_0x4bdc57['filters']=_['intersection'](_0x4bdc57[_0x0799('0x2c')],_0x4bdc57[_0x0799('0x2f')]);_0x2a80cd['attributes']=_[_0x0799('0x30')](_0x4bdc57[_0x0799('0x2c')],qs[_0x0799('0x31')](_0x587220[_0x0799('0x2f')]['fields']));_0x2a80cd[_0x0799('0x32')]=_0x2a80cd[_0x0799('0x32')]['length']?_0x2a80cd[_0x0799('0x32')]:_0x4bdc57[_0x0799('0x2c')];if(!_0x587220[_0x0799('0x2f')]['hasOwnProperty'](_0x0799('0x33'))){_0x2a80cd[_0x0799('0x1b')]=qs[_0x0799('0x1b')](_0x587220[_0x0799('0x2f')][_0x0799('0x1b')]);_0x2a80cd[_0x0799('0x19')]=qs[_0x0799('0x19')](_0x587220['query'][_0x0799('0x19')]);}_0x2a80cd['order']=qs[_0x0799('0x34')](_0x587220[_0x0799('0x2f')]['sort']);_0x2a80cd[_0x0799('0x35')]=qs[_0x0799('0x36')](_['pick'](_0x587220[_0x0799('0x2f')],_0x4bdc57['filters']),_0x443960);if(_0x587220['query'][_0x0799('0x37')]){_0x2a80cd['where']=_['merge'](_0x2a80cd[_0x0799('0x35')],{'$or':_['map'](_0x443960,function(_0x47633f){if(_0x47633f['type']!==_0x0799('0x38')){var _0x163f32={};_0x163f32[_0x47633f[_0x0799('0x2e')]]={'$like':'%'+_0x587220[_0x0799('0x2f')][_0x0799('0x37')]+'%'};return _0x163f32;}})});}_0x2a80cd=_['merge']({},_0x2a80cd,_0x587220[_0x0799('0x39')]);var _0x4797e1={'where':_0x2a80cd[_0x0799('0x35')]};return db[_0x0799('0x27')][_0x0799('0x3a')](_0x4797e1)[_0x0799('0x22')](function(_0x1670d6){_0x23cab5[_0x0799('0x3a')]=_0x1670d6;if(_0x587220[_0x0799('0x2f')]['includeAll']){_0x2a80cd[_0x0799('0x3b')]=[{'all':!![]}];}return db[_0x0799('0x27')][_0x0799('0x3c')](_0x2a80cd);})[_0x0799('0x22')](function(_0xf35bf9){_0x23cab5[_0x0799('0x3d')]=_0xf35bf9;return _0x23cab5;})[_0x0799('0x22')](respondWithFilteredResult(_0x54ddbc,_0x2a80cd))['catch'](handleError(_0x54ddbc,null));};exports[_0x0799('0x3e')]=function(_0x609750,_0x5d868e){var _0x30aa19={'raw':![],'where':{'id':_0x609750[_0x0799('0x3f')]['id']}},_0x296281={};_0x296281[_0x0799('0x2c')]=_['keys'](db[_0x0799('0x27')][_0x0799('0x28')]);_0x296281[_0x0799('0x2f')]=_[_0x0799('0x40')](_0x609750[_0x0799('0x2f')]);_0x296281[_0x0799('0x36')]=_[_0x0799('0x30')](_0x296281['model'],_0x296281[_0x0799('0x2f')]);_0x30aa19[_0x0799('0x32')]=_['intersection'](_0x296281[_0x0799('0x2c')],qs[_0x0799('0x31')](_0x609750[_0x0799('0x2f')][_0x0799('0x31')]));_0x30aa19[_0x0799('0x32')]=_0x30aa19[_0x0799('0x32')][_0x0799('0x41')]?_0x30aa19['attributes']:_0x296281[_0x0799('0x2c')];if(_0x609750[_0x0799('0x2f')][_0x0799('0x42')]){_0x30aa19[_0x0799('0x3b')]=[{'all':!![]}];}_0x30aa19=_['merge']({},_0x30aa19,_0x609750['options']);return db[_0x0799('0x27')][_0x0799('0x43')](_0x30aa19)[_0x0799('0x22')](handleEntityNotFound(_0x5d868e,null))[_0x0799('0x22')](respondWithResult(_0x5d868e,null))[_0x0799('0x44')](handleError(_0x5d868e,null));};exports['create']=function(_0x1e9645,_0x1b0e8b){return db[_0x0799('0x27')][_0x0799('0x45')](_0x1e9645['body'],{})[_0x0799('0x22')](respondWithResult(_0x1b0e8b,0xc9))[_0x0799('0x44')](handleError(_0x1b0e8b,null));};exports['update']=function(_0x430b92,_0x432fca){if(_0x430b92[_0x0799('0x46')]['id']){delete _0x430b92['body']['id'];}return db[_0x0799('0x27')][_0x0799('0x43')]({'where':{'id':_0x430b92[_0x0799('0x3f')]['id']}})[_0x0799('0x22')](handleEntityNotFound(_0x432fca,null))[_0x0799('0x22')](saveUpdates(_0x430b92[_0x0799('0x46')],null))[_0x0799('0x22')](respondWithResult(_0x432fca,null))[_0x0799('0x44')](handleError(_0x432fca,null));};exports[_0x0799('0x21')]=function(_0x52c62e,_0x4e5d34){return db[_0x0799('0x27')]['find']({'where':{'id':_0x52c62e[_0x0799('0x3f')]['id']}})[_0x0799('0x22')](handleEntityNotFound(_0x4e5d34,null))['then'](removeEntity(_0x4e5d34,null))[_0x0799('0x44')](handleError(_0x4e5d34,null));};exports[_0x0799('0x47')]=function(_0x4570c0,_0x3ecb58,_0x4b91ef){var _0x3cd27e={};var _0x51b823={};var _0x447064;var _0x466df1;return db[_0x0799('0x27')][_0x0799('0x48')]({'where':{'id':_0x4570c0[_0x0799('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ecb58,null))['then'](function(_0xd36219){if(_0xd36219){_0x447064=_0xd36219;_0x51b823[_0x0799('0x2c')]=_['keys'](db[_0x0799('0x49')][_0x0799('0x28')]);_0x51b823[_0x0799('0x2f')]=_[_0x0799('0x40')](_0x4570c0[_0x0799('0x2f')]);_0x51b823['filters']=_[_0x0799('0x30')](_0x51b823['model'],_0x51b823[_0x0799('0x2f')]);_0x3cd27e[_0x0799('0x32')]=_[_0x0799('0x30')](_0x51b823['model'],qs[_0x0799('0x31')](_0x4570c0[_0x0799('0x2f')]['fields']));_0x3cd27e[_0x0799('0x32')]=_0x3cd27e[_0x0799('0x32')][_0x0799('0x41')]?_0x3cd27e['attributes']:_0x51b823[_0x0799('0x2c')];_0x3cd27e[_0x0799('0x4a')]=qs[_0x0799('0x34')](_0x4570c0[_0x0799('0x2f')][_0x0799('0x34')]);_0x3cd27e[_0x0799('0x35')]=qs[_0x0799('0x36')](_['pick'](_0x4570c0[_0x0799('0x2f')],_0x51b823['filters']));if(_0x4570c0[_0x0799('0x2f')]['filter']){_0x3cd27e[_0x0799('0x35')]=_[_0x0799('0x4b')](_0x3cd27e['where'],{'$or':_[_0x0799('0x2d')](_0x3cd27e[_0x0799('0x32')],function(_0x1b7c65){var _0x31b0a1={};_0x31b0a1[_0x1b7c65]={'$like':'%'+_0x4570c0['query']['filter']+'%'};return _0x31b0a1;})});}_0x3cd27e=_[_0x0799('0x4b')]({},_0x3cd27e,_0x4570c0['options']);return _0x447064[_0x0799('0x47')](_0x3cd27e);}})[_0x0799('0x22')](function(_0x2adfbd){if(_0x2adfbd){_0x466df1=_0x2adfbd[_0x0799('0x41')];if(!_0x4570c0['query'][_0x0799('0x4c')](_0x0799('0x33'))){_0x3cd27e[_0x0799('0x1b')]=qs['limit'](_0x4570c0['query'][_0x0799('0x1b')]);_0x3cd27e[_0x0799('0x19')]=qs[_0x0799('0x19')](_0x4570c0[_0x0799('0x2f')][_0x0799('0x19')]);}return _0x447064['getFields'](_0x3cd27e);}})['then'](function(_0x1f829d){if(_0x1f829d){return _0x1f829d?{'count':_0x466df1,'rows':_0x1f829d}:null;}})[_0x0799('0x22')](respondWithResult(_0x3ecb58,null))[_0x0799('0x44')](handleError(_0x3ecb58,null));};exports[_0x0799('0x4d')]=function(_0x43a710,_0x2a275a,_0x1efae0){var _0x5de2cf={};var _0x2c596b={};var _0x3bc6f1;var _0x5df1a0;return db[_0x0799('0x27')][_0x0799('0x48')]({'where':{'id':_0x43a710[_0x0799('0x3f')]['id']}})[_0x0799('0x22')](handleEntityNotFound(_0x2a275a,null))[_0x0799('0x22')](function(_0x239056){if(_0x239056){_0x3bc6f1=_0x239056;_0x2c596b['model']=_[_0x0799('0x40')](db[_0x0799('0x49')][_0x0799('0x28')]);_0x2c596b[_0x0799('0x2f')]=_[_0x0799('0x40')](_0x43a710[_0x0799('0x2f')]);_0x2c596b['filters']=_[_0x0799('0x30')](_0x2c596b['model'],_0x2c596b[_0x0799('0x2f')]);_0x5de2cf[_0x0799('0x32')]=_[_0x0799('0x30')](_0x2c596b[_0x0799('0x2c')],qs['fields'](_0x43a710[_0x0799('0x2f')][_0x0799('0x31')]));_0x5de2cf[_0x0799('0x32')]=_0x5de2cf[_0x0799('0x32')][_0x0799('0x41')]?_0x5de2cf['attributes']:_0x2c596b[_0x0799('0x2c')];_0x5de2cf['order']=qs[_0x0799('0x34')](_0x43a710[_0x0799('0x2f')][_0x0799('0x34')]);_0x5de2cf[_0x0799('0x35')]=qs[_0x0799('0x36')](_[_0x0799('0x4e')](_0x43a710[_0x0799('0x2f')],_0x2c596b[_0x0799('0x36')]));if(_0x43a710[_0x0799('0x2f')][_0x0799('0x37')]){_0x5de2cf[_0x0799('0x35')]=_[_0x0799('0x4b')](_0x5de2cf[_0x0799('0x35')],{'$or':_['map'](_0x5de2cf['attributes'],function(_0x4213a2){var _0x284b7e={};_0x284b7e[_0x4213a2]={'$like':'%'+_0x43a710['query'][_0x0799('0x37')]+'%'};return _0x284b7e;})});}_0x5de2cf=_[_0x0799('0x4b')]({},_0x5de2cf,_0x43a710[_0x0799('0x39')]);return _0x3bc6f1[_0x0799('0x4d')](_0x5de2cf);}})[_0x0799('0x22')](function(_0x57e4c4){if(_0x57e4c4){_0x5df1a0=_0x57e4c4[_0x0799('0x41')];if(!_0x43a710[_0x0799('0x2f')][_0x0799('0x4c')](_0x0799('0x33'))){_0x5de2cf[_0x0799('0x1b')]=qs[_0x0799('0x1b')](_0x43a710['query']['limit']);_0x5de2cf['offset']=qs[_0x0799('0x19')](_0x43a710[_0x0799('0x2f')][_0x0799('0x19')]);}return _0x3bc6f1[_0x0799('0x4d')](_0x5de2cf);}})[_0x0799('0x22')](function(_0x1ba588){if(_0x1ba588){return _0x1ba588?{'count':_0x5df1a0,'rows':_0x1ba588}:null;}})[_0x0799('0x22')](respondWithResult(_0x2a275a,null))[_0x0799('0x44')](handleError(_0x2a275a,null));};exports[_0x0799('0x4f')]=function(_0x2de000,_0x53c9f3,_0x49ca8d){var _0x24c35e={};var _0x548daf={};var _0x5a40f1;var _0x7be13e;return db['ServicenowConfiguration'][_0x0799('0x48')]({'where':{'id':_0x2de000[_0x0799('0x3f')]['id']}})[_0x0799('0x22')](handleEntityNotFound(_0x53c9f3,null))[_0x0799('0x22')](function(_0x277aa3){if(_0x277aa3){_0x5a40f1=_0x277aa3;_0x548daf['model']=_[_0x0799('0x40')](db[_0x0799('0x49')][_0x0799('0x28')]);_0x548daf[_0x0799('0x2f')]=_[_0x0799('0x40')](_0x2de000[_0x0799('0x2f')]);_0x548daf[_0x0799('0x36')]=_[_0x0799('0x30')](_0x548daf['model'],_0x548daf['query']);_0x24c35e[_0x0799('0x32')]=_[_0x0799('0x30')](_0x548daf[_0x0799('0x2c')],qs['fields'](_0x2de000[_0x0799('0x2f')]['fields']));_0x24c35e[_0x0799('0x32')]=_0x24c35e[_0x0799('0x32')]['length']?_0x24c35e[_0x0799('0x32')]:_0x548daf['model'];_0x24c35e[_0x0799('0x4a')]=qs['sort'](_0x2de000[_0x0799('0x2f')][_0x0799('0x34')]);_0x24c35e[_0x0799('0x35')]=qs[_0x0799('0x36')](_[_0x0799('0x4e')](_0x2de000[_0x0799('0x2f')],_0x548daf[_0x0799('0x36')]));if(_0x2de000[_0x0799('0x2f')]['filter']){_0x24c35e[_0x0799('0x35')]=_[_0x0799('0x4b')](_0x24c35e[_0x0799('0x35')],{'$or':_[_0x0799('0x2d')](_0x24c35e[_0x0799('0x32')],function(_0x58f163){var _0x5cee95={};_0x5cee95[_0x58f163]={'$like':'%'+_0x2de000[_0x0799('0x2f')][_0x0799('0x37')]+'%'};return _0x5cee95;})});}_0x24c35e=_[_0x0799('0x4b')]({},_0x24c35e,_0x2de000[_0x0799('0x39')]);return _0x5a40f1[_0x0799('0x4f')](_0x24c35e);}})[_0x0799('0x22')](function(_0x57d992){if(_0x57d992){_0x7be13e=_0x57d992[_0x0799('0x41')];if(!_0x2de000['query']['hasOwnProperty'](_0x0799('0x33'))){_0x24c35e[_0x0799('0x1b')]=qs[_0x0799('0x1b')](_0x2de000['query'][_0x0799('0x1b')]);_0x24c35e[_0x0799('0x19')]=qs[_0x0799('0x19')](_0x2de000[_0x0799('0x2f')]['offset']);}return _0x5a40f1[_0x0799('0x4f')](_0x24c35e);}})[_0x0799('0x22')](function(_0x4e29b0){if(_0x4e29b0){return _0x4e29b0?{'count':_0x7be13e,'rows':_0x4e29b0}:null;}})[_0x0799('0x22')](respondWithResult(_0x53c9f3,null))[_0x0799('0x44')](handleError(_0x53c9f3,null));}; \ No newline at end of file +var _0x0f56=['getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','ServicenowField','pick','options'];(function(_0x5426e2,_0x5f2968){var _0x920dc=function(_0x3a87c6){while(--_0x3a87c6){_0x5426e2['push'](_0x5426e2['shift']());}};_0x920dc(++_0x5f2968);}(_0x0f56,0x1a7));var _0x60f5=function(_0x5cc438,_0x37a3b4){_0x5cc438=_0x5cc438-0x0;var _0x414f15=_0x0f56[_0x5cc438];return _0x414f15;};'use strict';var emlformat=require(_0x60f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60f5('0x1'));var rp=require(_0x60f5('0x2'));var moment=require(_0x60f5('0x3'));var BPromise=require(_0x60f5('0x4'));var Mustache=require(_0x60f5('0x5'));var util=require('util');var path=require(_0x60f5('0x6'));var sox=require(_0x60f5('0x7'));var csv=require(_0x60f5('0x8'));var ejs=require(_0x60f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60f5('0xa'));var squel=require(_0x60f5('0xb'));var crypto=require(_0x60f5('0xc'));var jsforce=require(_0x60f5('0xd'));var deskjs=require(_0x60f5('0xe'));var toCsv=require(_0x60f5('0x8'));var querystring=require(_0x60f5('0xf'));var Papa=require(_0x60f5('0x10'));var Redis=require(_0x60f5('0x11'));var authService=require(_0x60f5('0x12'));var qs=require(_0x60f5('0x13'));var as=require(_0x60f5('0x14'));var hardwareService=require(_0x60f5('0x15'));var logger=require(_0x60f5('0x16'))(_0x60f5('0x17'));var utils=require(_0x60f5('0x18'));var config=require(_0x60f5('0x19'));var licenseUtil=require(_0x60f5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19bac6,_0x330b74){_0x330b74=_0x330b74||0xcc;return function(_0x44e2ab){if(_0x44e2ab){return _0x19bac6[_0x60f5('0x1b')](_0x330b74);}return _0x19bac6[_0x60f5('0x1c')](_0x330b74)[_0x60f5('0x1d')]();};}function respondWithResult(_0x2a5ac3,_0xf86203){_0xf86203=_0xf86203||0xc8;return function(_0x23f58e){if(_0x23f58e){return _0x2a5ac3[_0x60f5('0x1c')](_0xf86203)[_0x60f5('0x1e')](_0x23f58e);}};}function respondWithFilteredResult(_0x11de0e,_0x1071ad){return function(_0x43aff8){if(_0x43aff8){var _0x18bf63=typeof _0x1071ad[_0x60f5('0x1f')]===_0x60f5('0x20')&&typeof _0x1071ad[_0x60f5('0x21')]===_0x60f5('0x20');var _0x104c6e=_0x43aff8[_0x60f5('0x22')];var _0x239bba=_0x18bf63?0x0:_0x1071ad[_0x60f5('0x1f')];var _0x31c5a=_0x18bf63?_0x43aff8[_0x60f5('0x22')]:_0x1071ad[_0x60f5('0x1f')]+_0x1071ad[_0x60f5('0x21')];var _0xa1bc05;if(_0x31c5a>=_0x104c6e){_0x31c5a=_0x104c6e;_0xa1bc05=0xc8;}else{_0xa1bc05=0xce;}_0x11de0e[_0x60f5('0x1c')](_0xa1bc05);return _0x11de0e[_0x60f5('0x23')](_0x60f5('0x24'),_0x239bba+'-'+_0x31c5a+'/'+_0x104c6e)[_0x60f5('0x1e')](_0x43aff8);}return null;};}function patchUpdates(_0x1cfd01){return function(_0x257e89){try{jsonpatch[_0x60f5('0x25')](_0x257e89,_0x1cfd01,!![]);}catch(_0x27cb44){return BPromise[_0x60f5('0x26')](_0x27cb44);}return _0x257e89[_0x60f5('0x27')]();};}function saveUpdates(_0x17d2a9,_0x55559f){return function(_0x381759){if(_0x381759){return _0x381759[_0x60f5('0x28')](_0x17d2a9)[_0x60f5('0x29')](function(_0x15229f){return _0x15229f;});}return null;};}function removeEntity(_0x3e4200,_0x2b67a6){return function(_0x12cfd5){if(_0x12cfd5){return _0x12cfd5[_0x60f5('0x2a')]()[_0x60f5('0x29')](function(){_0x3e4200[_0x60f5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f54b2,_0x5944d8){return function(_0x4ebbd3){if(!_0x4ebbd3){_0x3f54b2[_0x60f5('0x1b')](0x194);}return _0x4ebbd3;};}function handleError(_0x56a10b,_0x55ee05){_0x55ee05=_0x55ee05||0x1f4;return function(_0x5157ec){logger[_0x60f5('0x2b')](_0x5157ec[_0x60f5('0x2c')]);if(_0x5157ec[_0x60f5('0x2d')]){delete _0x5157ec[_0x60f5('0x2d')];}_0x56a10b[_0x60f5('0x1c')](_0x55ee05)['send'](_0x5157ec);};}exports[_0x60f5('0x2e')]=function(_0x1fb431,_0x2c067f){var _0x429d2b={},_0x292f7b={},_0x29dffd={'count':0x0,'rows':[]};var _0x2c42be=_[_0x60f5('0x2f')](db[_0x60f5('0x30')]['rawAttributes'],function(_0x4593de){return{'name':_0x4593de[_0x60f5('0x31')],'type':_0x4593de[_0x60f5('0x32')]['key']};});_0x292f7b[_0x60f5('0x33')]=_['map'](_0x2c42be,'name');_0x292f7b[_0x60f5('0x34')]=_[_0x60f5('0x35')](_0x1fb431[_0x60f5('0x34')]);_0x292f7b[_0x60f5('0x36')]=_[_0x60f5('0x37')](_0x292f7b[_0x60f5('0x33')],_0x292f7b['query']);_0x429d2b[_0x60f5('0x38')]=_[_0x60f5('0x37')](_0x292f7b[_0x60f5('0x33')],qs['fields'](_0x1fb431[_0x60f5('0x34')][_0x60f5('0x39')]));_0x429d2b[_0x60f5('0x38')]=_0x429d2b[_0x60f5('0x38')][_0x60f5('0x3a')]?_0x429d2b['attributes']:_0x292f7b[_0x60f5('0x33')];if(!_0x1fb431[_0x60f5('0x34')][_0x60f5('0x3b')](_0x60f5('0x3c'))){_0x429d2b[_0x60f5('0x21')]=qs['limit'](_0x1fb431[_0x60f5('0x34')][_0x60f5('0x21')]);_0x429d2b[_0x60f5('0x1f')]=qs[_0x60f5('0x1f')](_0x1fb431['query'][_0x60f5('0x1f')]);}_0x429d2b[_0x60f5('0x3d')]=qs['sort'](_0x1fb431['query'][_0x60f5('0x3e')]);_0x429d2b[_0x60f5('0x3f')]=qs[_0x60f5('0x36')](_['pick'](_0x1fb431[_0x60f5('0x34')],_0x292f7b[_0x60f5('0x36')]),_0x2c42be);if(_0x1fb431[_0x60f5('0x34')][_0x60f5('0x40')]){_0x429d2b['where']=_[_0x60f5('0x41')](_0x429d2b[_0x60f5('0x3f')],{'$or':_[_0x60f5('0x2f')](_0x2c42be,function(_0x5efd3f){if(_0x5efd3f[_0x60f5('0x32')]!==_0x60f5('0x42')){var _0x190751={};_0x190751[_0x5efd3f[_0x60f5('0x2d')]]={'$like':'%'+_0x1fb431[_0x60f5('0x34')][_0x60f5('0x40')]+'%'};return _0x190751;}})});}_0x429d2b=_[_0x60f5('0x41')]({},_0x429d2b,_0x1fb431['options']);var _0x20ef88={'where':_0x429d2b[_0x60f5('0x3f')]};return db[_0x60f5('0x30')][_0x60f5('0x22')](_0x20ef88)[_0x60f5('0x29')](function(_0x5ef351){_0x29dffd['count']=_0x5ef351;if(_0x1fb431[_0x60f5('0x34')]['includeAll']){_0x429d2b[_0x60f5('0x43')]=[{'all':!![]}];}return db[_0x60f5('0x30')]['findAll'](_0x429d2b);})[_0x60f5('0x29')](function(_0x4d242a){_0x29dffd[_0x60f5('0x44')]=_0x4d242a;return _0x29dffd;})['then'](respondWithFilteredResult(_0x2c067f,_0x429d2b))[_0x60f5('0x45')](handleError(_0x2c067f,null));};exports[_0x60f5('0x46')]=function(_0x324533,_0x4c08f8){var _0x28e7a9={'raw':![],'where':{'id':_0x324533[_0x60f5('0x47')]['id']}},_0x4bc7c0={};_0x4bc7c0[_0x60f5('0x33')]=_[_0x60f5('0x35')](db[_0x60f5('0x30')][_0x60f5('0x48')]);_0x4bc7c0['query']=_[_0x60f5('0x35')](_0x324533[_0x60f5('0x34')]);_0x4bc7c0[_0x60f5('0x36')]=_[_0x60f5('0x37')](_0x4bc7c0[_0x60f5('0x33')],_0x4bc7c0[_0x60f5('0x34')]);_0x28e7a9[_0x60f5('0x38')]=_['intersection'](_0x4bc7c0[_0x60f5('0x33')],qs['fields'](_0x324533[_0x60f5('0x34')][_0x60f5('0x39')]));_0x28e7a9['attributes']=_0x28e7a9[_0x60f5('0x38')][_0x60f5('0x3a')]?_0x28e7a9[_0x60f5('0x38')]:_0x4bc7c0[_0x60f5('0x33')];if(_0x324533['query'][_0x60f5('0x49')]){_0x28e7a9['include']=[{'all':!![]}];}_0x28e7a9=_[_0x60f5('0x41')]({},_0x28e7a9,_0x324533['options']);return db['ServicenowConfiguration'][_0x60f5('0x4a')](_0x28e7a9)[_0x60f5('0x29')](handleEntityNotFound(_0x4c08f8,null))[_0x60f5('0x29')](respondWithResult(_0x4c08f8,null))[_0x60f5('0x45')](handleError(_0x4c08f8,null));};exports[_0x60f5('0x4b')]=function(_0x23cf57,_0x1e6038){return db[_0x60f5('0x30')][_0x60f5('0x4b')](_0x23cf57[_0x60f5('0x4c')],{})[_0x60f5('0x29')](respondWithResult(_0x1e6038,0xc9))[_0x60f5('0x45')](handleError(_0x1e6038,null));};exports[_0x60f5('0x28')]=function(_0x41be69,_0x1f0df0){if(_0x41be69['body']['id']){delete _0x41be69[_0x60f5('0x4c')]['id'];}return db[_0x60f5('0x30')]['find']({'where':{'id':_0x41be69[_0x60f5('0x47')]['id']}})[_0x60f5('0x29')](handleEntityNotFound(_0x1f0df0,null))[_0x60f5('0x29')](saveUpdates(_0x41be69[_0x60f5('0x4c')],null))[_0x60f5('0x29')](respondWithResult(_0x1f0df0,null))[_0x60f5('0x45')](handleError(_0x1f0df0,null));};exports[_0x60f5('0x2a')]=function(_0x58e1c9,_0x1cc135){return db[_0x60f5('0x30')][_0x60f5('0x4a')]({'where':{'id':_0x58e1c9['params']['id']}})[_0x60f5('0x29')](handleEntityNotFound(_0x1cc135,null))[_0x60f5('0x29')](removeEntity(_0x1cc135,null))[_0x60f5('0x45')](handleError(_0x1cc135,null));};exports['getFields']=function(_0x147b68,_0x1b912a,_0x52ea9e){var _0x523da5={};var _0x28f53d={};var _0x168e02;var _0x182ea5;return db['ServicenowConfiguration'][_0x60f5('0x4d')]({'where':{'id':_0x147b68[_0x60f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b912a,null))[_0x60f5('0x29')](function(_0x3895df){if(_0x3895df){_0x168e02=_0x3895df;_0x28f53d[_0x60f5('0x33')]=_[_0x60f5('0x35')](db[_0x60f5('0x4e')][_0x60f5('0x48')]);_0x28f53d[_0x60f5('0x34')]=_[_0x60f5('0x35')](_0x147b68[_0x60f5('0x34')]);_0x28f53d[_0x60f5('0x36')]=_['intersection'](_0x28f53d['model'],_0x28f53d['query']);_0x523da5[_0x60f5('0x38')]=_['intersection'](_0x28f53d['model'],qs[_0x60f5('0x39')](_0x147b68[_0x60f5('0x34')][_0x60f5('0x39')]));_0x523da5[_0x60f5('0x38')]=_0x523da5[_0x60f5('0x38')][_0x60f5('0x3a')]?_0x523da5[_0x60f5('0x38')]:_0x28f53d[_0x60f5('0x33')];_0x523da5[_0x60f5('0x3d')]=qs['sort'](_0x147b68[_0x60f5('0x34')][_0x60f5('0x3e')]);_0x523da5[_0x60f5('0x3f')]=qs[_0x60f5('0x36')](_[_0x60f5('0x4f')](_0x147b68[_0x60f5('0x34')],_0x28f53d[_0x60f5('0x36')]));if(_0x147b68[_0x60f5('0x34')][_0x60f5('0x40')]){_0x523da5[_0x60f5('0x3f')]=_['merge'](_0x523da5[_0x60f5('0x3f')],{'$or':_[_0x60f5('0x2f')](_0x523da5['attributes'],function(_0x15ac50){var _0x271481={};_0x271481[_0x15ac50]={'$like':'%'+_0x147b68[_0x60f5('0x34')][_0x60f5('0x40')]+'%'};return _0x271481;})});}_0x523da5=_['merge']({},_0x523da5,_0x147b68[_0x60f5('0x50')]);return _0x168e02[_0x60f5('0x51')](_0x523da5);}})[_0x60f5('0x29')](function(_0x5bd0f6){if(_0x5bd0f6){_0x182ea5=_0x5bd0f6['length'];if(!_0x147b68['query'][_0x60f5('0x3b')](_0x60f5('0x3c'))){_0x523da5[_0x60f5('0x21')]=qs['limit'](_0x147b68[_0x60f5('0x34')][_0x60f5('0x21')]);_0x523da5['offset']=qs[_0x60f5('0x1f')](_0x147b68[_0x60f5('0x34')]['offset']);}return _0x168e02[_0x60f5('0x51')](_0x523da5);}})[_0x60f5('0x29')](function(_0xc31504){if(_0xc31504){return _0xc31504?{'count':_0x182ea5,'rows':_0xc31504}:null;}})['then'](respondWithResult(_0x1b912a,null))[_0x60f5('0x45')](handleError(_0x1b912a,null));};exports[_0x60f5('0x52')]=function(_0x34125b,_0x1bc3a8,_0x52d6cd){var _0x874ee5={};var _0x5eda44={};var _0x14f974;var _0x5b7c43;return db['ServicenowConfiguration'][_0x60f5('0x4d')]({'where':{'id':_0x34125b[_0x60f5('0x47')]['id']}})[_0x60f5('0x29')](handleEntityNotFound(_0x1bc3a8,null))[_0x60f5('0x29')](function(_0x258171){if(_0x258171){_0x14f974=_0x258171;_0x5eda44[_0x60f5('0x33')]=_[_0x60f5('0x35')](db[_0x60f5('0x4e')][_0x60f5('0x48')]);_0x5eda44['query']=_[_0x60f5('0x35')](_0x34125b[_0x60f5('0x34')]);_0x5eda44[_0x60f5('0x36')]=_[_0x60f5('0x37')](_0x5eda44['model'],_0x5eda44[_0x60f5('0x34')]);_0x874ee5[_0x60f5('0x38')]=_[_0x60f5('0x37')](_0x5eda44[_0x60f5('0x33')],qs[_0x60f5('0x39')](_0x34125b[_0x60f5('0x34')][_0x60f5('0x39')]));_0x874ee5['attributes']=_0x874ee5[_0x60f5('0x38')][_0x60f5('0x3a')]?_0x874ee5[_0x60f5('0x38')]:_0x5eda44[_0x60f5('0x33')];_0x874ee5['order']=qs[_0x60f5('0x3e')](_0x34125b['query'][_0x60f5('0x3e')]);_0x874ee5[_0x60f5('0x3f')]=qs['filters'](_[_0x60f5('0x4f')](_0x34125b[_0x60f5('0x34')],_0x5eda44[_0x60f5('0x36')]));if(_0x34125b['query']['filter']){_0x874ee5[_0x60f5('0x3f')]=_[_0x60f5('0x41')](_0x874ee5[_0x60f5('0x3f')],{'$or':_[_0x60f5('0x2f')](_0x874ee5[_0x60f5('0x38')],function(_0x540c17){var _0x452853={};_0x452853[_0x540c17]={'$like':'%'+_0x34125b[_0x60f5('0x34')][_0x60f5('0x40')]+'%'};return _0x452853;})});}_0x874ee5=_['merge']({},_0x874ee5,_0x34125b[_0x60f5('0x50')]);return _0x14f974[_0x60f5('0x52')](_0x874ee5);}})['then'](function(_0x5900c0){if(_0x5900c0){_0x5b7c43=_0x5900c0[_0x60f5('0x3a')];if(!_0x34125b[_0x60f5('0x34')][_0x60f5('0x3b')](_0x60f5('0x3c'))){_0x874ee5['limit']=qs[_0x60f5('0x21')](_0x34125b[_0x60f5('0x34')][_0x60f5('0x21')]);_0x874ee5[_0x60f5('0x1f')]=qs['offset'](_0x34125b[_0x60f5('0x34')][_0x60f5('0x1f')]);}return _0x14f974[_0x60f5('0x52')](_0x874ee5);}})[_0x60f5('0x29')](function(_0x4c776e){if(_0x4c776e){return _0x4c776e?{'count':_0x5b7c43,'rows':_0x4c776e}:null;}})[_0x60f5('0x29')](respondWithResult(_0x1bc3a8,null))[_0x60f5('0x45')](handleError(_0x1bc3a8,null));};exports[_0x60f5('0x53')]=function(_0x2b1efd,_0x13934a,_0x12006){var _0x47d33f={};var _0x58c311={};var _0x25ec3d;var _0x3678e9;return db[_0x60f5('0x30')][_0x60f5('0x4d')]({'where':{'id':_0x2b1efd[_0x60f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x13934a,null))[_0x60f5('0x29')](function(_0x1a26a0){if(_0x1a26a0){_0x25ec3d=_0x1a26a0;_0x58c311[_0x60f5('0x33')]=_[_0x60f5('0x35')](db[_0x60f5('0x4e')][_0x60f5('0x48')]);_0x58c311[_0x60f5('0x34')]=_[_0x60f5('0x35')](_0x2b1efd['query']);_0x58c311[_0x60f5('0x36')]=_[_0x60f5('0x37')](_0x58c311['model'],_0x58c311['query']);_0x47d33f[_0x60f5('0x38')]=_['intersection'](_0x58c311[_0x60f5('0x33')],qs[_0x60f5('0x39')](_0x2b1efd[_0x60f5('0x34')]['fields']));_0x47d33f[_0x60f5('0x38')]=_0x47d33f['attributes'][_0x60f5('0x3a')]?_0x47d33f[_0x60f5('0x38')]:_0x58c311['model'];_0x47d33f[_0x60f5('0x3d')]=qs[_0x60f5('0x3e')](_0x2b1efd[_0x60f5('0x34')][_0x60f5('0x3e')]);_0x47d33f[_0x60f5('0x3f')]=qs['filters'](_['pick'](_0x2b1efd[_0x60f5('0x34')],_0x58c311[_0x60f5('0x36')]));if(_0x2b1efd[_0x60f5('0x34')][_0x60f5('0x40')]){_0x47d33f['where']=_['merge'](_0x47d33f['where'],{'$or':_[_0x60f5('0x2f')](_0x47d33f[_0x60f5('0x38')],function(_0x5633af){var _0xd4ed19={};_0xd4ed19[_0x5633af]={'$like':'%'+_0x2b1efd['query']['filter']+'%'};return _0xd4ed19;})});}_0x47d33f=_[_0x60f5('0x41')]({},_0x47d33f,_0x2b1efd[_0x60f5('0x50')]);return _0x25ec3d[_0x60f5('0x53')](_0x47d33f);}})[_0x60f5('0x29')](function(_0x366e0b){if(_0x366e0b){_0x3678e9=_0x366e0b[_0x60f5('0x3a')];if(!_0x2b1efd[_0x60f5('0x34')][_0x60f5('0x3b')]('nolimit')){_0x47d33f[_0x60f5('0x21')]=qs[_0x60f5('0x21')](_0x2b1efd[_0x60f5('0x34')][_0x60f5('0x21')]);_0x47d33f[_0x60f5('0x1f')]=qs['offset'](_0x2b1efd[_0x60f5('0x34')][_0x60f5('0x1f')]);}return _0x25ec3d[_0x60f5('0x53')](_0x47d33f);}})[_0x60f5('0x29')](function(_0x1971b6){if(_0x1971b6){return _0x1971b6?{'count':_0x3678e9,'rows':_0x1971b6}:null;}})[_0x60f5('0x29')](respondWithResult(_0x13934a,null))[_0x60f5('0x45')](handleError(_0x13934a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2c4703b..5950a06 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 _0xcac2=['../../config/logger','moment','bluebird','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0xcac2,0x1e8));var _0x2cac=function(_0x37c9c7,_0x436ff0){_0x37c9c7=_0x37c9c7-0x0;var _0x23ff77=_0xcac2[_0x37c9c7];return _0x23ff77;};'use strict';var _=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var logger=require(_0x2cac('0x2'))('api');var moment=require(_0x2cac('0x3'));var BPromise=require(_0x2cac('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(_0x2cac('0x5'));module[_0x2cac('0x6')]=function(_0x26b741,_0x2ab257){return _0x26b741[_0x2cac('0x7')](_0x2cac('0x8'),attributes,{'tableName':_0x2cac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','ServicenowConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x5367b1,_0x43118d){var _0x439475=function(_0x2899cb){while(--_0x2899cb){_0x5367b1['push'](_0x5367b1['shift']());}};_0x439475(++_0x43118d);}(_0xe820,0xd2));var _0x0e82=function(_0x2e6194,_0x4b4dde){_0x2e6194=_0x2e6194-0x0;var _0x367b70=_0xe820[_0x2e6194];return _0x367b70;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),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 b2d500c..c4d6bfd 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 _0x1509=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0xd2bb3d,_0x8d10){var _0x36a213=function(_0x3f4848){while(--_0x3f4848){_0xd2bb3d['push'](_0xd2bb3d['shift']());}};_0x36a213(++_0x8d10);}(_0x1509,0x15c));var _0x9150=function(_0x3281d9,_0x2f0dcd){_0x3281d9=_0x3281d9-0x0;var _0x21a66f=_0x1509[_0x3281d9];return _0x21a66f;};'use strict';var _=require(_0x9150('0x0'));var util=require(_0x9150('0x1'));var moment=require(_0x9150('0x2'));var BPromise=require(_0x9150('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9150('0x4'));var db=require(_0x9150('0x5'))['db'];var utils=require(_0x9150('0x6'));var logger=require(_0x9150('0x7'))(_0x9150('0x8'));var config=require(_0x9150('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9150('0xa')][_0x9150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6a1075,_0x47281c,_0x4a45a8){return new BPromise(function(_0x25ea20,_0x300da8){return client['request'](_0x6a1075,_0x4a45a8)['then'](function(_0xdbf6fa){logger[_0x9150('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47281c,_0x9150('0xd'));logger[_0x9150('0xe')](_0x9150('0xf'),_0x47281c,_0x9150('0xd'),JSON[_0x9150('0x10')](_0xdbf6fa));if(_0xdbf6fa['error']){if(_0xdbf6fa[_0x9150('0x11')]['code']===0x1f4){logger[_0x9150('0x11')](_0x9150('0x12'),_0x47281c,_0xdbf6fa[_0x9150('0x11')][_0x9150('0x13')]);return _0x300da8(_0xdbf6fa['error'][_0x9150('0x13')]);}logger[_0x9150('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47281c,_0xdbf6fa[_0x9150('0x11')][_0x9150('0x13')]);return _0x25ea20(_0xdbf6fa[_0x9150('0x11')]['message']);}else{logger[_0x9150('0xc')](_0x9150('0x12'),_0x47281c,_0x9150('0xd'));_0x25ea20(_0xdbf6fa[_0x9150('0x14')][_0x9150('0x13')]);}})[_0x9150('0x15')](function(_0x4184bb){logger[_0x9150('0x11')](_0x9150('0x12'),_0x47281c,_0x4184bb);_0x300da8(_0x4184bb);});});} \ No newline at end of file +var _0x4b91=['message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x484814,_0x236dbf){var _0x43f5df=function(_0x507795){while(--_0x507795){_0x484814['push'](_0x484814['shift']());}};_0x43f5df(++_0x236dbf);}(_0x4b91,0xab));var _0x14b9=function(_0x5a0afd,_0x113988){_0x5a0afd=_0x5a0afd-0x0;var _0x4899fa=_0x4b91[_0x5a0afd];return _0x4899fa;};'use strict';var _=require(_0x14b9('0x0'));var util=require(_0x14b9('0x1'));var moment=require(_0x14b9('0x2'));var BPromise=require(_0x14b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14b9('0x4'));var db=require(_0x14b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14b9('0x6'))(_0x14b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x14b9('0x8'));var client=jayson[_0x14b9('0x9')][_0x14b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x354342,_0x28787f,_0x2922a4){return new BPromise(function(_0x1eda7f,_0x47e1be){return client['request'](_0x354342,_0x2922a4)[_0x14b9('0xb')](function(_0x2ac0ea){logger['info'](_0x14b9('0xc'),_0x28787f,'request\x20sent');logger[_0x14b9('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x28787f,_0x14b9('0xe'),JSON[_0x14b9('0xf')](_0x2ac0ea));if(_0x2ac0ea[_0x14b9('0x10')]){if(_0x2ac0ea[_0x14b9('0x10')][_0x14b9('0x11')]===0x1f4){logger[_0x14b9('0x10')](_0x14b9('0xc'),_0x28787f,_0x2ac0ea[_0x14b9('0x10')][_0x14b9('0x12')]);return _0x47e1be(_0x2ac0ea['error']['message']);}logger[_0x14b9('0x10')](_0x14b9('0xc'),_0x28787f,_0x2ac0ea[_0x14b9('0x10')]['message']);return _0x1eda7f(_0x2ac0ea[_0x14b9('0x10')][_0x14b9('0x12')]);}else{logger[_0x14b9('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x28787f,_0x14b9('0xe'));_0x1eda7f(_0x2ac0ea[_0x14b9('0x14')]['message']);}})['catch'](function(_0x1cb8fa){logger['error'](_0x14b9('0xc'),_0x28787f,_0x1cb8fa);_0x47e1be(_0x1cb8fa);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 29d280f..d5d3b6c 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 _0xf85e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29cc51,_0x147079){var _0x516703=function(_0x292c27){while(--_0x292c27){_0x29cc51['push'](_0x29cc51['shift']());}};_0x516703(++_0x147079);}(_0xf85e,0x129));var _0xef85=function(_0x209b99,_0x303841){_0x209b99=_0x209b99-0x0;var _0x4f9bde=_0xf85e[_0x209b99];return _0x4f9bde;};'use strict';var multer=require(_0xef85('0x0'));var util=require(_0xef85('0x1'));var path=require(_0xef85('0x2'));var timeout=require('connect-timeout');var express=require(_0xef85('0x3'));var router=express[_0xef85('0x4')]();var fs_extra=require(_0xef85('0x5'));var auth=require(_0xef85('0x6'));var interaction=require(_0xef85('0x7'));var config=require(_0xef85('0x8'));var controller=require('./intServicenowField.controller');router[_0xef85('0x9')]('/',auth[_0xef85('0xa')](),controller[_0xef85('0xb')]);router[_0xef85('0x9')](_0xef85('0xc'),auth[_0xef85('0xa')](),controller['show']);router[_0xef85('0xd')]('/',auth[_0xef85('0xa')](),controller[_0xef85('0xe')]);router[_0xef85('0xf')]('/:id',auth[_0xef85('0xa')](),controller[_0xef85('0x10')]);router[_0xef85('0x11')](_0xef85('0xc'),auth[_0xef85('0xa')](),controller[_0xef85('0x12')]);module[_0xef85('0x13')]=router; \ No newline at end of file +var _0x2192=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','create','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2192,0x1aa));var _0x2219=function(_0x5dc9f6,_0x4d86bd){_0x5dc9f6=_0x5dc9f6-0x0;var _0x2be4da=_0x2192[_0x5dc9f6];return _0x2be4da;};'use strict';var multer=require('multer');var util=require(_0x2219('0x0'));var path=require(_0x2219('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2219('0x2')]();var fs_extra=require(_0x2219('0x3'));var auth=require(_0x2219('0x4'));var interaction=require(_0x2219('0x5'));var config=require(_0x2219('0x6'));var controller=require(_0x2219('0x7'));router[_0x2219('0x8')]('/',auth['isAuthenticated'](),controller[_0x2219('0x9')]);router['get'](_0x2219('0xa'),auth[_0x2219('0xb')](),controller['show']);router[_0x2219('0xc')]('/',auth[_0x2219('0xb')](),controller[_0x2219('0xd')]);router['put']('/:id',auth[_0x2219('0xb')](),controller[_0x2219('0xe')]);router['delete']('/:id',auth[_0x2219('0xb')](),controller[_0x2219('0xf')]);module[_0x2219('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 ebb62ae..082b5a4 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 _0xc329=['ENUM','variable','keyValue','picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports'];(function(_0x3182f5,_0x31f86e){var _0x5ee63b=function(_0x533678){while(--_0x533678){_0x3182f5['push'](_0x3182f5['shift']());}};_0x5ee63b(++_0x31f86e);}(_0xc329,0x80));var _0x9c32=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xc329[_0x3d00db];return _0x41f115;};'use strict';var Sequelize=require(_0x9c32('0x0'));module[_0x9c32('0x1')]={'type':{'type':Sequelize[_0x9c32('0x2')]('string',_0x9c32('0x3'),'customVariable',_0x9c32('0x4'),_0x9c32('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c32('0x6')]},'keyType':{'type':Sequelize[_0x9c32('0x2')](_0x9c32('0x7'),_0x9c32('0x3'),_0x9c32('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9c32('0x6')]},'customField':{'type':Sequelize[_0x9c32('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc338=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x57c662,_0x2c9ffe){var _0x216916=function(_0x357ee8){while(--_0x357ee8){_0x57c662['push'](_0x57c662['shift']());}};_0x216916(++_0x2c9ffe);}(_0xc338,0x104));var _0x8c33=function(_0x2bcf35,_0x149eaa){_0x2bcf35=_0x2bcf35-0x0;var _0x192bed=_0xc338[_0x2bcf35];return _0x192bed;};'use strict';var Sequelize=require(_0x8c33('0x0'));module[_0x8c33('0x1')]={'type':{'type':Sequelize[_0x8c33('0x2')](_0x8c33('0x3'),_0x8c33('0x4'),_0x8c33('0x5'),'keyValue',_0x8c33('0x6')),'defaultValue':_0x8c33('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8c33('0x2')]('string',_0x8c33('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8c33('0x7')]},'idField':{'type':Sequelize[_0x8c33('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8c33('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c33('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 034ff07..c826319 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 _0x12ff=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','error','stack','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','name','options','then','includeAll','include','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x12ff,0x120));var _0xf12f=function(_0x32e93e,_0x2c7db2){_0x32e93e=_0x32e93e-0x0;var _0x182712=_0x12ff[_0x32e93e];return _0x182712;};'use strict';var emlformat=require(_0xf12f('0x0'));var rimraf=require(_0xf12f('0x1'));var zipdir=require(_0xf12f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf12f('0x3'));var moment=require(_0xf12f('0x4'));var BPromise=require(_0xf12f('0x5'));var Mustache=require(_0xf12f('0x6'));var util=require(_0xf12f('0x7'));var path=require(_0xf12f('0x8'));var sox=require(_0xf12f('0x9'));var csv=require(_0xf12f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf12f('0xb'));var _=require(_0xf12f('0xc'));var squel=require(_0xf12f('0xd'));var crypto=require(_0xf12f('0xe'));var jsforce=require(_0xf12f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf12f('0xa'));var querystring=require('querystring');var Papa=require(_0xf12f('0x10'));var Redis=require(_0xf12f('0x11'));var authService=require(_0xf12f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf12f('0x13'))(_0xf12f('0x14'));var utils=require(_0xf12f('0x15'));var config=require(_0xf12f('0x16'));var licenseUtil=require(_0xf12f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35cbd2,_0x2d092f){_0x2d092f=_0x2d092f||0xcc;return function(_0x4a808c){if(_0x4a808c){return _0x35cbd2[_0xf12f('0x18')](_0x2d092f);}return _0x35cbd2[_0xf12f('0x19')](_0x2d092f)[_0xf12f('0x1a')]();};}function respondWithResult(_0x35efeb,_0x207f68){_0x207f68=_0x207f68||0xc8;return function(_0x33075c){if(_0x33075c){return _0x35efeb['status'](_0x207f68)[_0xf12f('0x1b')](_0x33075c);}};}function respondWithFilteredResult(_0x2b2dba,_0x342e00){return function(_0xeb80b5){if(_0xeb80b5){var _0x315cef=typeof _0x342e00['offset']===_0xf12f('0x1c')&&typeof _0x342e00[_0xf12f('0x1d')]==='undefined';var _0x25bbc4=_0xeb80b5[_0xf12f('0x1e')];var _0x2ce16b=_0x315cef?0x0:_0x342e00['offset'];var _0x3939bc=_0x315cef?_0xeb80b5['count']:_0x342e00['offset']+_0x342e00['limit'];var _0x5cbebe;if(_0x3939bc>=_0x25bbc4){_0x3939bc=_0x25bbc4;_0x5cbebe=0xc8;}else{_0x5cbebe=0xce;}_0x2b2dba[_0xf12f('0x19')](_0x5cbebe);return _0x2b2dba[_0xf12f('0x1f')](_0xf12f('0x20'),_0x2ce16b+'-'+_0x3939bc+'/'+_0x25bbc4)[_0xf12f('0x1b')](_0xeb80b5);}return null;};}function patchUpdates(_0x3ca9a3){return function(_0x32b3c4){try{jsonpatch[_0xf12f('0x21')](_0x32b3c4,_0x3ca9a3,!![]);}catch(_0x34c0f3){return BPromise[_0xf12f('0x22')](_0x34c0f3);}return _0x32b3c4['save']();};}function saveUpdates(_0x327613,_0x14c047){return function(_0x456478){if(_0x456478){return _0x456478[_0xf12f('0x23')](_0x327613)['then'](function(_0x9528fe){return _0x9528fe;});}return null;};}function removeEntity(_0x59d774,_0xbea9d4){return function(_0x22482c){if(_0x22482c){return _0x22482c['destroy']()['then'](function(){_0x59d774['status'](0xcc)[_0xf12f('0x1a')]();});}};}function handleEntityNotFound(_0x4518ff,_0x1c88d2){return function(_0x795107){if(!_0x795107){_0x4518ff[_0xf12f('0x18')](0x194);}return _0x795107;};}function handleError(_0x5efd8e,_0x49a0d8){_0x49a0d8=_0x49a0d8||0x1f4;return function(_0x314ab6){logger[_0xf12f('0x24')](_0x314ab6[_0xf12f('0x25')]);if(_0x314ab6['name']){delete _0x314ab6['name'];}_0x5efd8e[_0xf12f('0x19')](_0x49a0d8)['send'](_0x314ab6);};}exports[_0xf12f('0x26')]=function(_0x1d9422,_0x19f7f5){var _0x46db04={},_0x5e84e1={},_0x4ed380={'count':0x0,'rows':[]};var _0x41bdeb=_[_0xf12f('0x27')](db[_0xf12f('0x28')][_0xf12f('0x29')],function(_0x8e81ae){return{'name':_0x8e81ae[_0xf12f('0x2a')],'type':_0x8e81ae[_0xf12f('0x2b')][_0xf12f('0x2c')]};});_0x5e84e1['model']=_[_0xf12f('0x27')](_0x41bdeb,'name');_0x5e84e1[_0xf12f('0x2d')]=_[_0xf12f('0x2e')](_0x1d9422[_0xf12f('0x2d')]);_0x5e84e1[_0xf12f('0x2f')]=_[_0xf12f('0x30')](_0x5e84e1[_0xf12f('0x31')],_0x5e84e1[_0xf12f('0x2d')]);_0x46db04[_0xf12f('0x32')]=_[_0xf12f('0x30')](_0x5e84e1['model'],qs[_0xf12f('0x33')](_0x1d9422[_0xf12f('0x2d')][_0xf12f('0x33')]));_0x46db04[_0xf12f('0x32')]=_0x46db04[_0xf12f('0x32')][_0xf12f('0x34')]?_0x46db04['attributes']:_0x5e84e1[_0xf12f('0x31')];if(!_0x1d9422['query'][_0xf12f('0x35')]('nolimit')){_0x46db04[_0xf12f('0x1d')]=qs['limit'](_0x1d9422[_0xf12f('0x2d')][_0xf12f('0x1d')]);_0x46db04[_0xf12f('0x36')]=qs[_0xf12f('0x36')](_0x1d9422[_0xf12f('0x2d')][_0xf12f('0x36')]);}_0x46db04[_0xf12f('0x37')]=qs[_0xf12f('0x38')](_0x1d9422[_0xf12f('0x2d')]['sort']);_0x46db04[_0xf12f('0x39')]=qs['filters'](_[_0xf12f('0x3a')](_0x1d9422[_0xf12f('0x2d')],_0x5e84e1[_0xf12f('0x2f')]),_0x41bdeb);if(_0x1d9422['query'][_0xf12f('0x3b')]){_0x46db04[_0xf12f('0x39')]=_[_0xf12f('0x3c')](_0x46db04['where'],{'$or':_[_0xf12f('0x27')](_0x41bdeb,function(_0x361006){if(_0x361006[_0xf12f('0x2b')]!=='VIRTUAL'){var _0xc02a27={};_0xc02a27[_0x361006[_0xf12f('0x3d')]]={'$like':'%'+_0x1d9422[_0xf12f('0x2d')][_0xf12f('0x3b')]+'%'};return _0xc02a27;}})});}_0x46db04=_['merge']({},_0x46db04,_0x1d9422[_0xf12f('0x3e')]);var _0x1fd875={'where':_0x46db04['where']};return db['ServicenowField'][_0xf12f('0x1e')](_0x1fd875)[_0xf12f('0x3f')](function(_0x2c917a){_0x4ed380[_0xf12f('0x1e')]=_0x2c917a;if(_0x1d9422[_0xf12f('0x2d')][_0xf12f('0x40')]){_0x46db04[_0xf12f('0x41')]=[{'all':!![]}];}return db[_0xf12f('0x28')]['findAll'](_0x46db04);})[_0xf12f('0x3f')](function(_0x362a75){_0x4ed380['rows']=_0x362a75;return _0x4ed380;})[_0xf12f('0x3f')](respondWithFilteredResult(_0x19f7f5,_0x46db04))[_0xf12f('0x42')](handleError(_0x19f7f5,null));};exports[_0xf12f('0x43')]=function(_0x37620e,_0x4686dd){var _0x6fdc99={'raw':!![],'where':{'id':_0x37620e[_0xf12f('0x44')]['id']}},_0x28cca4={};_0x28cca4[_0xf12f('0x31')]=_[_0xf12f('0x2e')](db[_0xf12f('0x28')][_0xf12f('0x29')]);_0x28cca4[_0xf12f('0x2d')]=_['keys'](_0x37620e[_0xf12f('0x2d')]);_0x28cca4[_0xf12f('0x2f')]=_[_0xf12f('0x30')](_0x28cca4[_0xf12f('0x31')],_0x28cca4[_0xf12f('0x2d')]);_0x6fdc99[_0xf12f('0x32')]=_['intersection'](_0x28cca4[_0xf12f('0x31')],qs['fields'](_0x37620e['query'][_0xf12f('0x33')]));_0x6fdc99['attributes']=_0x6fdc99[_0xf12f('0x32')]['length']?_0x6fdc99[_0xf12f('0x32')]:_0x28cca4[_0xf12f('0x31')];if(_0x37620e[_0xf12f('0x2d')][_0xf12f('0x40')]){_0x6fdc99['include']=[{'all':!![]}];}_0x6fdc99=_['merge']({},_0x6fdc99,_0x37620e[_0xf12f('0x3e')]);return db[_0xf12f('0x28')][_0xf12f('0x45')](_0x6fdc99)[_0xf12f('0x3f')](handleEntityNotFound(_0x4686dd,null))['then'](respondWithResult(_0x4686dd,null))[_0xf12f('0x42')](handleError(_0x4686dd,null));};exports['create']=function(_0x3e6744,_0x163afb){return db[_0xf12f('0x28')][_0xf12f('0x46')](_0x3e6744[_0xf12f('0x47')],{})['then'](respondWithResult(_0x163afb,0xc9))[_0xf12f('0x42')](handleError(_0x163afb,null));};exports['update']=function(_0x22a1df,_0x575229){if(_0x22a1df['body']['id']){delete _0x22a1df[_0xf12f('0x47')]['id'];}return db['ServicenowField'][_0xf12f('0x45')]({'where':{'id':_0x22a1df['params']['id']}})[_0xf12f('0x3f')](handleEntityNotFound(_0x575229,null))[_0xf12f('0x3f')](saveUpdates(_0x22a1df[_0xf12f('0x47')],null))[_0xf12f('0x3f')](respondWithResult(_0x575229,null))[_0xf12f('0x42')](handleError(_0x575229,null));};exports[_0xf12f('0x48')]=function(_0x5c9d44,_0x2e952b){return db[_0xf12f('0x28')][_0xf12f('0x45')]({'where':{'id':_0x5c9d44[_0xf12f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e952b,null))['then'](removeEntity(_0x2e952b,null))['catch'](handleError(_0x2e952b,null));}; \ No newline at end of file +var _0x1c72=['Content-Range','apply','reject','update','then','name','send','index','map','ServicenowField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x169f14,_0x279580){var _0x39b263=function(_0x258e50){while(--_0x258e50){_0x169f14['push'](_0x169f14['shift']());}};_0x39b263(++_0x279580);}(_0x1c72,0xb8));var _0x21c7=function(_0x8b5591,_0x379c8f){_0x8b5591=_0x8b5591-0x0;var _0x3d24bc=_0x1c72[_0x8b5591];return _0x3d24bc;};'use strict';var emlformat=require(_0x21c7('0x0'));var rimraf=require(_0x21c7('0x1'));var zipdir=require(_0x21c7('0x2'));var jsonpatch=require(_0x21c7('0x3'));var rp=require(_0x21c7('0x4'));var moment=require(_0x21c7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x21c7('0x6'));var util=require(_0x21c7('0x7'));var path=require(_0x21c7('0x8'));var sox=require('sox');var csv=require(_0x21c7('0x9'));var ejs=require(_0x21c7('0xa'));var fs=require('fs');var fs_extra=require(_0x21c7('0xb'));var _=require(_0x21c7('0xc'));var squel=require(_0x21c7('0xd'));var crypto=require(_0x21c7('0xe'));var jsforce=require(_0x21c7('0xf'));var deskjs=require(_0x21c7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21c7('0x11'));var Redis=require(_0x21c7('0x12'));var authService=require(_0x21c7('0x13'));var qs=require(_0x21c7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x21c7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21c7('0x16'));var db=require(_0x21c7('0x17'))['db'];function respondWithStatusCode(_0xd54733,_0x265821){_0x265821=_0x265821||0xcc;return function(_0x1e31f7){if(_0x1e31f7){return _0xd54733[_0x21c7('0x18')](_0x265821);}return _0xd54733[_0x21c7('0x19')](_0x265821)[_0x21c7('0x1a')]();};}function respondWithResult(_0x5507b1,_0x41c63e){_0x41c63e=_0x41c63e||0xc8;return function(_0xc3196b){if(_0xc3196b){return _0x5507b1['status'](_0x41c63e)[_0x21c7('0x1b')](_0xc3196b);}};}function respondWithFilteredResult(_0x5d6b0e,_0x1ed1cb){return function(_0x50bb41){if(_0x50bb41){var _0x27c723=typeof _0x1ed1cb[_0x21c7('0x1c')]==='undefined'&&typeof _0x1ed1cb[_0x21c7('0x1d')]==='undefined';var _0x1a92ab=_0x50bb41[_0x21c7('0x1e')];var _0x5b15b3=_0x27c723?0x0:_0x1ed1cb[_0x21c7('0x1c')];var _0x2b7739=_0x27c723?_0x50bb41[_0x21c7('0x1e')]:_0x1ed1cb[_0x21c7('0x1c')]+_0x1ed1cb[_0x21c7('0x1d')];var _0x1cd3a7;if(_0x2b7739>=_0x1a92ab){_0x2b7739=_0x1a92ab;_0x1cd3a7=0xc8;}else{_0x1cd3a7=0xce;}_0x5d6b0e[_0x21c7('0x19')](_0x1cd3a7);return _0x5d6b0e[_0x21c7('0x1f')](_0x21c7('0x20'),_0x5b15b3+'-'+_0x2b7739+'/'+_0x1a92ab)[_0x21c7('0x1b')](_0x50bb41);}return null;};}function patchUpdates(_0x46395a){return function(_0x2ce2c2){try{jsonpatch[_0x21c7('0x21')](_0x2ce2c2,_0x46395a,!![]);}catch(_0x8918ef){return BPromise[_0x21c7('0x22')](_0x8918ef);}return _0x2ce2c2['save']();};}function saveUpdates(_0x13e994,_0x461a0d){return function(_0x51b74d){if(_0x51b74d){return _0x51b74d[_0x21c7('0x23')](_0x13e994)[_0x21c7('0x24')](function(_0x4ed400){return _0x4ed400;});}return null;};}function removeEntity(_0x4859c1,_0x15ba0e){return function(_0x10ea1c){if(_0x10ea1c){return _0x10ea1c['destroy']()['then'](function(){_0x4859c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb6aea6,_0x2197c1){return function(_0x2b324a){if(!_0x2b324a){_0xb6aea6[_0x21c7('0x18')](0x194);}return _0x2b324a;};}function handleError(_0xe1f2c4,_0x68dffe){_0x68dffe=_0x68dffe||0x1f4;return function(_0x55b2a9){logger['error'](_0x55b2a9['stack']);if(_0x55b2a9[_0x21c7('0x25')]){delete _0x55b2a9[_0x21c7('0x25')];}_0xe1f2c4[_0x21c7('0x19')](_0x68dffe)[_0x21c7('0x26')](_0x55b2a9);};}exports[_0x21c7('0x27')]=function(_0x55d3f2,_0x2be12d){var _0x427ea8={},_0x179eaa={},_0x7600d9={'count':0x0,'rows':[]};var _0x31bb6a=_[_0x21c7('0x28')](db[_0x21c7('0x29')][_0x21c7('0x2a')],function(_0x438b39){return{'name':_0x438b39['fieldName'],'type':_0x438b39[_0x21c7('0x2b')][_0x21c7('0x2c')]};});_0x179eaa['model']=_[_0x21c7('0x28')](_0x31bb6a,_0x21c7('0x25'));_0x179eaa[_0x21c7('0x2d')]=_[_0x21c7('0x2e')](_0x55d3f2[_0x21c7('0x2d')]);_0x179eaa[_0x21c7('0x2f')]=_[_0x21c7('0x30')](_0x179eaa[_0x21c7('0x31')],_0x179eaa['query']);_0x427ea8['attributes']=_['intersection'](_0x179eaa[_0x21c7('0x31')],qs[_0x21c7('0x32')](_0x55d3f2[_0x21c7('0x2d')]['fields']));_0x427ea8[_0x21c7('0x33')]=_0x427ea8[_0x21c7('0x33')][_0x21c7('0x34')]?_0x427ea8['attributes']:_0x179eaa[_0x21c7('0x31')];if(!_0x55d3f2['query'][_0x21c7('0x35')]('nolimit')){_0x427ea8[_0x21c7('0x1d')]=qs[_0x21c7('0x1d')](_0x55d3f2[_0x21c7('0x2d')]['limit']);_0x427ea8[_0x21c7('0x1c')]=qs['offset'](_0x55d3f2['query'][_0x21c7('0x1c')]);}_0x427ea8['order']=qs[_0x21c7('0x36')](_0x55d3f2['query'][_0x21c7('0x36')]);_0x427ea8[_0x21c7('0x37')]=qs[_0x21c7('0x2f')](_[_0x21c7('0x38')](_0x55d3f2[_0x21c7('0x2d')],_0x179eaa[_0x21c7('0x2f')]),_0x31bb6a);if(_0x55d3f2[_0x21c7('0x2d')]['filter']){_0x427ea8[_0x21c7('0x37')]=_[_0x21c7('0x39')](_0x427ea8[_0x21c7('0x37')],{'$or':_[_0x21c7('0x28')](_0x31bb6a,function(_0x5a967e){if(_0x5a967e[_0x21c7('0x2b')]!==_0x21c7('0x3a')){var _0x45a55d={};_0x45a55d[_0x5a967e[_0x21c7('0x25')]]={'$like':'%'+_0x55d3f2[_0x21c7('0x2d')][_0x21c7('0x3b')]+'%'};return _0x45a55d;}})});}_0x427ea8=_[_0x21c7('0x39')]({},_0x427ea8,_0x55d3f2[_0x21c7('0x3c')]);var _0x2d6e9a={'where':_0x427ea8[_0x21c7('0x37')]};return db[_0x21c7('0x29')][_0x21c7('0x1e')](_0x2d6e9a)[_0x21c7('0x24')](function(_0x5dd772){_0x7600d9[_0x21c7('0x1e')]=_0x5dd772;if(_0x55d3f2[_0x21c7('0x2d')]['includeAll']){_0x427ea8[_0x21c7('0x3d')]=[{'all':!![]}];}return db[_0x21c7('0x29')][_0x21c7('0x3e')](_0x427ea8);})[_0x21c7('0x24')](function(_0x16baac){_0x7600d9[_0x21c7('0x3f')]=_0x16baac;return _0x7600d9;})[_0x21c7('0x24')](respondWithFilteredResult(_0x2be12d,_0x427ea8))[_0x21c7('0x40')](handleError(_0x2be12d,null));};exports[_0x21c7('0x41')]=function(_0x48bdcc,_0x140608){var _0x3c0c56={'raw':!![],'where':{'id':_0x48bdcc[_0x21c7('0x42')]['id']}},_0x96210={};_0x96210[_0x21c7('0x31')]=_[_0x21c7('0x2e')](db['ServicenowField']['rawAttributes']);_0x96210[_0x21c7('0x2d')]=_[_0x21c7('0x2e')](_0x48bdcc[_0x21c7('0x2d')]);_0x96210[_0x21c7('0x2f')]=_[_0x21c7('0x30')](_0x96210[_0x21c7('0x31')],_0x96210[_0x21c7('0x2d')]);_0x3c0c56['attributes']=_[_0x21c7('0x30')](_0x96210[_0x21c7('0x31')],qs[_0x21c7('0x32')](_0x48bdcc[_0x21c7('0x2d')]['fields']));_0x3c0c56[_0x21c7('0x33')]=_0x3c0c56[_0x21c7('0x33')][_0x21c7('0x34')]?_0x3c0c56[_0x21c7('0x33')]:_0x96210['model'];if(_0x48bdcc[_0x21c7('0x2d')][_0x21c7('0x43')]){_0x3c0c56['include']=[{'all':!![]}];}_0x3c0c56=_[_0x21c7('0x39')]({},_0x3c0c56,_0x48bdcc[_0x21c7('0x3c')]);return db[_0x21c7('0x29')][_0x21c7('0x44')](_0x3c0c56)['then'](handleEntityNotFound(_0x140608,null))[_0x21c7('0x24')](respondWithResult(_0x140608,null))['catch'](handleError(_0x140608,null));};exports[_0x21c7('0x45')]=function(_0x1ba9ae,_0x122797){return db[_0x21c7('0x29')][_0x21c7('0x45')](_0x1ba9ae[_0x21c7('0x46')],{})[_0x21c7('0x24')](respondWithResult(_0x122797,0xc9))[_0x21c7('0x40')](handleError(_0x122797,null));};exports[_0x21c7('0x23')]=function(_0x131c27,_0x256188){if(_0x131c27[_0x21c7('0x46')]['id']){delete _0x131c27['body']['id'];}return db['ServicenowField'][_0x21c7('0x44')]({'where':{'id':_0x131c27['params']['id']}})[_0x21c7('0x24')](handleEntityNotFound(_0x256188,null))[_0x21c7('0x24')](saveUpdates(_0x131c27[_0x21c7('0x46')],null))[_0x21c7('0x24')](respondWithResult(_0x256188,null))['catch'](handleError(_0x256188,null));};exports[_0x21c7('0x47')]=function(_0x1e4bc0,_0x2e151b){return db['ServicenowField'][_0x21c7('0x44')]({'where':{'id':_0x1e4bc0['params']['id']}})[_0x21c7('0x24')](handleEntityNotFound(_0x2e151b,null))['then'](removeEntity(_0x2e151b,null))[_0x21c7('0x40')](handleError(_0x2e151b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1cf32d4..d25b37e 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 _0x0659=['int_servicenow_fields','servicenow_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x4c8d62,_0x290549){var _0x55b5a2=function(_0x3ac230){while(--_0x3ac230){_0x4c8d62['push'](_0x4c8d62['shift']());}};_0x55b5a2(++_0x290549);}(_0x0659,0x9f));var _0x9065=function(_0x3b06f3,_0x349f69){_0x3b06f3=_0x3b06f3-0x0;var _0x4c9b1b=_0x0659[_0x3b06f3];return _0x4c9b1b;};'use strict';var _=require('lodash');var util=require(_0x9065('0x0'));var logger=require(_0x9065('0x1'))(_0x9065('0x2'));var moment=require(_0x9065('0x3'));var BPromise=require('bluebird');var rp=require(_0x9065('0x4'));var fs=require('fs');var path=require(_0x9065('0x5'));var rimraf=require(_0x9065('0x6'));var config=require(_0x9065('0x7'));var attributes=require(_0x9065('0x8'));module[_0x9065('0x9')]=function(_0x5bd970,_0x176103){return _0x5bd970['define']('ServicenowField',attributes,{'tableName':_0x9065('0xa'),'paranoid':![],'indexes':[{'name':_0x9065('0xb'),'fields':['idField',_0x9065('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb41=['int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x142964,_0x16108e){var _0x13ab9c=function(_0x1a4a8b){while(--_0x1a4a8b){_0x142964['push'](_0x142964['shift']());}};_0x13ab9c(++_0x16108e);}(_0xcb41,0x1df));var _0x1cb4=function(_0x21ab6a,_0x1e97f6){_0x21ab6a=_0x21ab6a-0x0;var _0x2ccd3f=_0xcb41[_0x21ab6a];return _0x2ccd3f;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var logger=require(_0x1cb4('0x2'))(_0x1cb4('0x3'));var moment=require('moment');var BPromise=require(_0x1cb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb4('0x5'));var rimraf=require(_0x1cb4('0x6'));var config=require(_0x1cb4('0x7'));var attributes=require(_0x1cb4('0x8'));module[_0x1cb4('0x9')]=function(_0x547f4,_0x2eaeb4){return _0x547f4[_0x1cb4('0xa')]('ServicenowField',attributes,{'tableName':_0x1cb4('0xb'),'paranoid':![],'indexes':[{'name':_0x1cb4('0xc'),'fields':['idField',_0x1cb4('0xd')],'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 1acfa23..b640f8e 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x15204b,_0x12d6af){var _0x410d73=function(_0x48e1df){while(--_0x48e1df){_0x15204b['push'](_0x15204b['shift']());}};_0x410d73(++_0x12d6af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _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(_0x55c653,_0x54ea13){var _0x120827=function(_0xd9f689){while(--_0xd9f689){_0x55c653['push'](_0x55c653['shift']());}};_0x120827(++_0x54ea13);}(_0xb43b,0x1b2));var _0xbb43=function(_0xd9b3cc,_0x5e1630){_0xd9b3cc=_0xd9b3cc-0x0;var _0x453ad5=_0xb43b[_0xd9b3cc];return _0x453ad5;};'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 757e5c3..64e5657 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(_0x2763b7,_0x4eed84){var _0x9f49c8=function(_0x318aa7){while(--_0x318aa7){_0x2763b7['push'](_0x2763b7['shift']());}};_0x9f49c8(++_0x4eed84);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4a8605,_0x201a0b){var _0x473809=function(_0x765fa3){while(--_0x765fa3){_0x4a8605['push'](_0x4a8605['shift']());}};_0x473809(++_0x201a0b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d0ffc22..4b136c3 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(_0x123f70,_0x245089){var _0x47f2ec=function(_0x3e6f3a){while(--_0x3e6f3a){_0x123f70['push'](_0x123f70['shift']());}};_0x47f2ec(++_0x245089);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x292de3,_0x44a992){var _0x536de3=function(_0x4b5805){while(--_0x4b5805){_0x292de3['push'](_0x292de3['shift']());}};_0x536de3(++_0x44a992);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 1fd49e4..ff4d32a 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 _0x4f4e=['description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','catch','SugarcrmConfiguration','merge','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x4f4e,0x193));var _0xe4f4=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x4f4e[_0x1460f6];return _0x46ce94;};'use strict';var emlformat=require(_0xe4f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4f4('0x1'));var jsonpatch=require(_0xe4f4('0x2'));var rp=require('request-promise');var moment=require(_0xe4f4('0x3'));var BPromise=require(_0xe4f4('0x4'));var Mustache=require(_0xe4f4('0x5'));var util=require(_0xe4f4('0x6'));var path=require(_0xe4f4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4f4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4f4('0x9'));var _=require(_0xe4f4('0xa'));var squel=require(_0xe4f4('0xb'));var crypto=require(_0xe4f4('0xc'));var jsforce=require(_0xe4f4('0xd'));var deskjs=require(_0xe4f4('0xe'));var toCsv=require(_0xe4f4('0xf'));var querystring=require(_0xe4f4('0x10'));var Papa=require(_0xe4f4('0x11'));var Redis=require(_0xe4f4('0x12'));var authService=require(_0xe4f4('0x13'));var qs=require(_0xe4f4('0x14'));var as=require(_0xe4f4('0x15'));var hardwareService=require(_0xe4f4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xe4f4('0x17'));var config=require(_0xe4f4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4f4('0x19'))['db'];var integrations=require(_0xe4f4('0x1a'));function respondWithStatusCode(_0x3a77a1,_0x33e388){_0x33e388=_0x33e388||0xcc;return function(_0x2b3fa6){if(_0x2b3fa6){return _0x3a77a1['sendStatus'](_0x33e388);}return _0x3a77a1['status'](_0x33e388)[_0xe4f4('0x1b')]();};}function respondWithResult(_0x217ff9,_0x1fb7a9){_0x1fb7a9=_0x1fb7a9||0xc8;return function(_0x51a4ea){if(_0x51a4ea){return _0x217ff9['status'](_0x1fb7a9)[_0xe4f4('0x1c')](_0x51a4ea);}};}function respondWithFilteredResult(_0x538d6d,_0x16ee77){return function(_0x11e3be){if(_0x11e3be){var _0x29c9d0=typeof _0x16ee77[_0xe4f4('0x1d')]===_0xe4f4('0x1e')&&typeof _0x16ee77[_0xe4f4('0x1f')]===_0xe4f4('0x1e');var _0x37a5a3=_0x11e3be[_0xe4f4('0x20')];var _0x3b0be5=_0x29c9d0?0x0:_0x16ee77[_0xe4f4('0x1d')];var _0x4e501f=_0x29c9d0?_0x11e3be[_0xe4f4('0x20')]:_0x16ee77[_0xe4f4('0x1d')]+_0x16ee77[_0xe4f4('0x1f')];var _0x7dcee8;if(_0x4e501f>=_0x37a5a3){_0x4e501f=_0x37a5a3;_0x7dcee8=0xc8;}else{_0x7dcee8=0xce;}_0x538d6d[_0xe4f4('0x21')](_0x7dcee8);return _0x538d6d[_0xe4f4('0x22')]('Content-Range',_0x3b0be5+'-'+_0x4e501f+'/'+_0x37a5a3)[_0xe4f4('0x1c')](_0x11e3be);}return null;};}function patchUpdates(_0x37cdea){return function(_0x400001){try{jsonpatch[_0xe4f4('0x23')](_0x400001,_0x37cdea,!![]);}catch(_0x322b97){return BPromise[_0xe4f4('0x24')](_0x322b97);}return _0x400001[_0xe4f4('0x25')]();};}function saveUpdates(_0x1ae299,_0x44a2a3){return function(_0x6f3f63){if(_0x6f3f63){return _0x6f3f63[_0xe4f4('0x26')](_0x1ae299)[_0xe4f4('0x27')](function(_0x479b25){return _0x479b25;});}return null;};}function removeEntity(_0x543085,_0x16cdf0){return function(_0x2faf3c){if(_0x2faf3c){return _0x2faf3c[_0xe4f4('0x28')]()[_0xe4f4('0x27')](function(){_0x543085[_0xe4f4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x97ab6a,_0x698b06){return function(_0x321a1c){if(!_0x321a1c){_0x97ab6a[_0xe4f4('0x29')](0x194);}return _0x321a1c;};}function handleError(_0x83cb66,_0x2859cd){_0x2859cd=_0x2859cd||0x1f4;return function(_0x2064d2){logger[_0xe4f4('0x2a')](_0x2064d2[_0xe4f4('0x2b')]);if(_0x2064d2[_0xe4f4('0x2c')]){delete _0x2064d2['name'];}_0x83cb66[_0xe4f4('0x21')](_0x2859cd)['send'](_0x2064d2);};}exports['index']=function(_0x1b9ad3,_0x5f436c){var _0x37ef={},_0x1adf40={},_0x10f621={'count':0x0,'rows':[]};var _0x2712ec=_[_0xe4f4('0x2d')](db[_0xe4f4('0x2e')][_0xe4f4('0x2f')],function(_0xd3d2e){return{'name':_0xd3d2e[_0xe4f4('0x30')],'type':_0xd3d2e[_0xe4f4('0x31')]['key']};});_0x1adf40[_0xe4f4('0x32')]=_[_0xe4f4('0x2d')](_0x2712ec,'name');_0x1adf40[_0xe4f4('0x33')]=_[_0xe4f4('0x34')](_0x1b9ad3['query']);_0x1adf40[_0xe4f4('0x35')]=_['intersection'](_0x1adf40['model'],_0x1adf40[_0xe4f4('0x33')]);_0x37ef[_0xe4f4('0x36')]=_[_0xe4f4('0x37')](_0x1adf40[_0xe4f4('0x32')],qs['fields'](_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x38')]));_0x37ef['attributes']=_0x37ef[_0xe4f4('0x36')][_0xe4f4('0x39')]?_0x37ef[_0xe4f4('0x36')]:_0x1adf40[_0xe4f4('0x32')];if(!_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x3a')](_0xe4f4('0x3b'))){_0x37ef[_0xe4f4('0x1f')]=qs[_0xe4f4('0x1f')](_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x1f')]);_0x37ef[_0xe4f4('0x1d')]=qs['offset'](_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x1d')]);}_0x37ef[_0xe4f4('0x3c')]=qs['sort'](_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x3d')]);_0x37ef[_0xe4f4('0x3e')]=qs[_0xe4f4('0x35')](_[_0xe4f4('0x3f')](_0x1b9ad3['query'],_0x1adf40['filters']),_0x2712ec);if(_0x1b9ad3[_0xe4f4('0x33')][_0xe4f4('0x40')]){_0x37ef[_0xe4f4('0x3e')]=_['merge'](_0x37ef['where'],{'$or':_[_0xe4f4('0x2d')](_0x2712ec,function(_0x44c6a4){if(_0x44c6a4[_0xe4f4('0x31')]!==_0xe4f4('0x41')){var _0x17a9a3={};_0x17a9a3[_0x44c6a4['name']]={'$like':'%'+_0x1b9ad3['query'][_0xe4f4('0x40')]+'%'};return _0x17a9a3;}})});}_0x37ef=_['merge']({},_0x37ef,_0x1b9ad3[_0xe4f4('0x42')]);var _0x3ff5d6={'where':_0x37ef[_0xe4f4('0x3e')]};return db[_0xe4f4('0x2e')]['count'](_0x3ff5d6)[_0xe4f4('0x27')](function(_0x2df33f){_0x10f621[_0xe4f4('0x20')]=_0x2df33f;if(_0x1b9ad3['query'][_0xe4f4('0x43')]){_0x37ef['include']=[{'all':!![]}];}return db[_0xe4f4('0x2e')][_0xe4f4('0x44')](_0x37ef);})[_0xe4f4('0x27')](function(_0x27510e){_0x10f621['rows']=_0x27510e;return _0x10f621;})['then'](respondWithFilteredResult(_0x5f436c,_0x37ef))['catch'](handleError(_0x5f436c,null));};exports[_0xe4f4('0x45')]=function(_0x4916f8,_0x4292c3){var _0x479203={'raw':![],'where':{'id':_0x4916f8[_0xe4f4('0x46')]['id']}},_0x28e7bc={};_0x28e7bc['model']=_[_0xe4f4('0x34')](db[_0xe4f4('0x2e')][_0xe4f4('0x2f')]);_0x28e7bc[_0xe4f4('0x33')]=_[_0xe4f4('0x34')](_0x4916f8[_0xe4f4('0x33')]);_0x28e7bc[_0xe4f4('0x35')]=_[_0xe4f4('0x37')](_0x28e7bc[_0xe4f4('0x32')],_0x28e7bc[_0xe4f4('0x33')]);_0x479203['attributes']=_[_0xe4f4('0x37')](_0x28e7bc['model'],qs[_0xe4f4('0x38')](_0x4916f8[_0xe4f4('0x33')]['fields']));_0x479203[_0xe4f4('0x36')]=_0x479203['attributes']['length']?_0x479203['attributes']:_0x28e7bc[_0xe4f4('0x32')];if(_0x4916f8[_0xe4f4('0x33')][_0xe4f4('0x43')]){_0x479203[_0xe4f4('0x47')]=[{'all':!![]}];}_0x479203=_['merge']({},_0x479203,_0x4916f8[_0xe4f4('0x42')]);return db[_0xe4f4('0x2e')][_0xe4f4('0x48')](_0x479203)[_0xe4f4('0x27')](handleEntityNotFound(_0x4292c3,null))[_0xe4f4('0x27')](respondWithResult(_0x4292c3,null))['catch'](handleError(_0x4292c3,null));};exports[_0xe4f4('0x49')]=function(_0x4daf8d,_0x44018c){return db[_0xe4f4('0x2e')]['create'](_0x4daf8d[_0xe4f4('0x4a')],{})[_0xe4f4('0x27')](respondWithResult(_0x44018c,0xc9))['catch'](handleError(_0x44018c,null));};exports[_0xe4f4('0x26')]=function(_0xa6eae3,_0x192964){if(_0xa6eae3[_0xe4f4('0x4a')]['id']){delete _0xa6eae3[_0xe4f4('0x4a')]['id'];}return db[_0xe4f4('0x2e')][_0xe4f4('0x48')]({'where':{'id':_0xa6eae3[_0xe4f4('0x46')]['id']}})[_0xe4f4('0x27')](handleEntityNotFound(_0x192964,null))[_0xe4f4('0x27')](saveUpdates(_0xa6eae3[_0xe4f4('0x4a')],null))[_0xe4f4('0x27')](respondWithResult(_0x192964,null))[_0xe4f4('0x4b')](handleError(_0x192964,null));};exports['destroy']=function(_0x49d616,_0x38a240){return db[_0xe4f4('0x2e')][_0xe4f4('0x48')]({'where':{'id':_0x49d616[_0xe4f4('0x46')]['id']}})[_0xe4f4('0x27')](handleEntityNotFound(_0x38a240,null))[_0xe4f4('0x27')](removeEntity(_0x38a240,null))[_0xe4f4('0x4b')](handleError(_0x38a240,null));};exports['getConfigurations']=function(_0x52b9bc,_0x1ee5d8,_0x41b414){var _0x1975a2={};var _0x354adb={};var _0x26fbaf;var _0x50f8c6;return db[_0xe4f4('0x2e')]['findOne']({'where':{'id':_0x52b9bc[_0xe4f4('0x46')]['id']}})[_0xe4f4('0x27')](handleEntityNotFound(_0x1ee5d8,null))[_0xe4f4('0x27')](function(_0x4691e0){if(_0x4691e0){_0x26fbaf=_0x4691e0;_0x354adb['model']=_[_0xe4f4('0x34')](db[_0xe4f4('0x4c')][_0xe4f4('0x2f')]);_0x354adb[_0xe4f4('0x33')]=_[_0xe4f4('0x34')](_0x52b9bc[_0xe4f4('0x33')]);_0x354adb[_0xe4f4('0x35')]=_['intersection'](_0x354adb[_0xe4f4('0x32')],_0x354adb[_0xe4f4('0x33')]);_0x1975a2['attributes']=_['intersection'](_0x354adb[_0xe4f4('0x32')],qs[_0xe4f4('0x38')](_0x52b9bc[_0xe4f4('0x33')]['fields']));_0x1975a2['attributes']=_0x1975a2[_0xe4f4('0x36')]['length']?_0x1975a2[_0xe4f4('0x36')]:_0x354adb['model'];_0x1975a2[_0xe4f4('0x3c')]=qs[_0xe4f4('0x3d')](_0x52b9bc[_0xe4f4('0x33')][_0xe4f4('0x3d')]);_0x1975a2[_0xe4f4('0x3e')]=qs['filters'](_['pick'](_0x52b9bc[_0xe4f4('0x33')],_0x354adb[_0xe4f4('0x35')]));if(_0x52b9bc['query']['filter']){_0x1975a2['where']=_['merge'](_0x1975a2[_0xe4f4('0x3e')],{'$or':_[_0xe4f4('0x2d')](_0x1975a2['attributes'],function(_0x58c380){var _0x35e17b={};_0x35e17b[_0x58c380]={'$like':'%'+_0x52b9bc[_0xe4f4('0x33')]['filter']+'%'};return _0x35e17b;})});}_0x1975a2=_[_0xe4f4('0x4d')]({},_0x1975a2,_0x52b9bc[_0xe4f4('0x42')]);return _0x26fbaf[_0xe4f4('0x4e')](_0x1975a2);}})[_0xe4f4('0x27')](function(_0x508359){if(_0x508359){_0x50f8c6=_0x508359[_0xe4f4('0x39')];if(!_0x52b9bc[_0xe4f4('0x33')][_0xe4f4('0x3a')](_0xe4f4('0x3b'))){_0x1975a2[_0xe4f4('0x1f')]=qs[_0xe4f4('0x1f')](_0x52b9bc[_0xe4f4('0x33')][_0xe4f4('0x1f')]);_0x1975a2[_0xe4f4('0x1d')]=qs[_0xe4f4('0x1d')](_0x52b9bc[_0xe4f4('0x33')][_0xe4f4('0x1d')]);}return _0x26fbaf['getConfigurations'](_0x1975a2);}})[_0xe4f4('0x27')](function(_0xa29296){if(_0xa29296){return _0xa29296?{'count':_0x50f8c6,'rows':_0xa29296}:null;}})[_0xe4f4('0x27')](respondWithResult(_0x1ee5d8,null))[_0xe4f4('0x4b')](handleError(_0x1ee5d8,null));};exports[_0xe4f4('0x4f')]=function(_0x3712f3,_0x81de71,_0x1cea86){if(_0x3712f3[_0xe4f4('0x4a')]['id']){delete _0x3712f3['body']['id'];}return db[_0xe4f4('0x2e')][_0xe4f4('0x50')]({'where':{'id':_0x3712f3[_0xe4f4('0x46')]['id']}})[_0xe4f4('0x27')](handleEntityNotFound(_0x81de71,null))[_0xe4f4('0x27')](function(_0x5b66fb){if(_0x5b66fb){_0x3712f3[_0xe4f4('0x4a')][_0xe4f4('0x51')]=_0x5b66fb['id'];_0x3712f3[_0xe4f4('0x4a')]['Subjects']=integrations[_0xe4f4('0x52')](_0x3712f3[_0xe4f4('0x4a')][_0xe4f4('0x53')],_0x3712f3[_0xe4f4('0x4a')][_0xe4f4('0x31')]);_0x3712f3[_0xe4f4('0x4a')][_0xe4f4('0x54')]=integrations[_0xe4f4('0x55')](_0x3712f3[_0xe4f4('0x4a')][_0xe4f4('0x53')],_0x3712f3['body'][_0xe4f4('0x31')]);return db['SugarcrmConfiguration'][_0xe4f4('0x49')](_0x3712f3['body'],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0xe4f4('0x56')],'as':'Descriptions'}]});}return null;})[_0xe4f4('0x27')](respondWithResult(_0x81de71,null))[_0xe4f4('0x4b')](handleError(_0x81de71,null));};exports[_0xe4f4('0x57')]=function(_0x3a9620,_0x19e851,_0x15ba8f){var _0xe0536d='';var _0x3d8e5e=['id',_0xe4f4('0x2c'),_0xe4f4('0x58'),'created_by',_0xe4f4('0x59'),_0xe4f4('0x5a'),_0xe4f4('0x5b'),'duration_minutes',_0xe4f4('0x5c'),_0xe4f4('0x5d'),_0xe4f4('0x5e'),_0xe4f4('0x5f')];return db[_0xe4f4('0x2e')][_0xe4f4('0x50')]({'where':{'id':_0x3a9620['params']['id']},'attributes':['id',_0xe4f4('0x60'),'password',_0xe4f4('0x61')]})['then'](handleEntityNotFound(_0x19e851,null))[_0xe4f4('0x27')](function(_0x223e75){if(_0x223e75){_0xe0536d=_0x223e75[_0xe4f4('0x61')];var _0x4bef5=_0xe0536d['slice'](-0x1);if(_0x4bef5==='/'){_0xe0536d=_0xe0536d[_0xe4f4('0x62')](0x0,_0xe0536d[_0xe4f4('0x63')](_0x4bef5));}return rp({'method':_0xe4f4('0x64'),'uri':util['format'](_0xe4f4('0x65'),_0xe0536d,_0xe4f4('0x66')),'json':!![],'form':{'method':_0xe4f4('0x67'),'input_type':_0xe4f4('0x68'),'response_type':_0xe4f4('0x68'),'rest_data':JSON[_0xe4f4('0x69')]({'user_auth':{'user_name':_0x223e75[_0xe4f4('0x60')],'password':_0x223e75[_0xe4f4('0x6a')],'encryption':_0xe4f4('0x6b')},'application':_0xe4f4('0x6c')})}});}})[_0xe4f4('0x27')](function(_0x291acf){if(_0x291acf&&_0x291acf['name']!==_0xe4f4('0x6d')&&_0x291acf[_0xe4f4('0x2c')]!==_0xe4f4('0x6e')){return rp({'method':_0xe4f4('0x64'),'uri':util['format']('%s%s',_0xe0536d,_0xe4f4('0x66')),'json':!![],'form':{'method':_0xe4f4('0x6f'),'input_type':_0xe4f4('0x68'),'response_type':'JSON','rest_data':JSON[_0xe4f4('0x69')]({'session':_0x291acf['id'],'module_name':_0xe4f4('0x70')})}})[_0xe4f4('0x27')](function(_0x1ecfcf){if(_0x1ecfcf){var _0x510a75=_[_0xe4f4('0x71')](_0x1ecfcf[_0xe4f4('0x72')]);_['remove'](_0x510a75,function(_0x49ae27){return _0x3d8e5e[_0xe4f4('0x73')](_0x49ae27[_0xe4f4('0x2c')]);});return{'count':_0x510a75['length'],'rows':_[_0xe4f4('0x2d')](_0x510a75,function(_0x19ea65){return{'id':_0x19ea65['name'],'name':_0x19ea65[_0xe4f4('0x74')],'custom':_[_0xe4f4('0x75')](_0x19ea65['name'],'_c')?!![]:![],'options':_0x19ea65[_0xe4f4('0x42')]?_[_0xe4f4('0x2d')](_['values'](_0x19ea65['options']),function(_0x3c59a5){return{'name':_0x3c59a5[_0xe4f4('0x76')],'value':_0x3c59a5[_0xe4f4('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x19e851,null))[_0xe4f4('0x4b')](function(_0x515be5){var _0x3aa0d4=_0x3a9620[_0xe4f4('0x33')][_0xe4f4('0x77')]?0x1f4:_0x515be5[_0xe4f4('0x78')]||0x1f4;logger[_0xe4f4('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xe4f4('0x57'),_0x3aa0d4,JSON[_0xe4f4('0x69')](_0x515be5));delete _0x515be5[_0xe4f4('0x2c')];if(_0x3aa0d4===0x191){_0x3aa0d4=0x190;}_0x19e851[_0xe4f4('0x21')](_0x3aa0d4)[_0xe4f4('0x79')](_0x3a9620[_0xe4f4('0x33')][_0xe4f4('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x515be5[_0xe4f4('0x78')]}:_0x515be5);});}else{var _0x338510=0x1f4;_0x19e851[_0xe4f4('0x21')](_0x338510)[_0xe4f4('0x79')]({'message':_0xe4f4('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd9a0=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','include','findAll','rows','params','includeAll','options','find','catch','create','body','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','password','remoteUri','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','Calls','module_fields','remove','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','squel','crypto'];(function(_0x34ff8d,_0x1d5a4c){var _0x510018=function(_0x3c2053){while(--_0x3c2053){_0x34ff8d['push'](_0x34ff8d['shift']());}};_0x510018(++_0x1d5a4c);}(_0xd9a0,0x68));var _0x0d9a=function(_0x5ac3df,_0xa60372){_0x5ac3df=_0x5ac3df-0x0;var _0x31aa04=_0xd9a0[_0x5ac3df];return _0x31aa04;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d9a('0x0'));var jsonpatch=require(_0x0d9a('0x1'));var rp=require(_0x0d9a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d9a('0x3'));var util=require(_0x0d9a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x0d9a('0x5'));var ejs=require(_0x0d9a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0d9a('0x7'));var crypto=require(_0x0d9a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0d9a('0x9'));var toCsv=require(_0x0d9a('0x5'));var querystring=require('querystring');var Papa=require(_0x0d9a('0xa'));var Redis=require(_0x0d9a('0xb'));var authService=require(_0x0d9a('0xc'));var qs=require(_0x0d9a('0xd'));var as=require(_0x0d9a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d9a('0xf'))(_0x0d9a('0x10'));var utils=require(_0x0d9a('0x11'));var config=require(_0x0d9a('0x12'));var licenseUtil=require(_0x0d9a('0x13'));var db=require(_0x0d9a('0x14'))['db'];var integrations=require(_0x0d9a('0x15'));function respondWithStatusCode(_0x57a9ed,_0x5a0bc0){_0x5a0bc0=_0x5a0bc0||0xcc;return function(_0x55f4af){if(_0x55f4af){return _0x57a9ed[_0x0d9a('0x16')](_0x5a0bc0);}return _0x57a9ed[_0x0d9a('0x17')](_0x5a0bc0)['end']();};}function respondWithResult(_0x48da9c,_0xdd2b9b){_0xdd2b9b=_0xdd2b9b||0xc8;return function(_0x2df179){if(_0x2df179){return _0x48da9c[_0x0d9a('0x17')](_0xdd2b9b)[_0x0d9a('0x18')](_0x2df179);}};}function respondWithFilteredResult(_0x67436b,_0x2cba54){return function(_0x31938d){if(_0x31938d){var _0x59e168=typeof _0x2cba54[_0x0d9a('0x19')]===_0x0d9a('0x1a')&&typeof _0x2cba54['limit']===_0x0d9a('0x1a');var _0x57ddf6=_0x31938d[_0x0d9a('0x1b')];var _0x2cc7d2=_0x59e168?0x0:_0x2cba54[_0x0d9a('0x19')];var _0x4de36b=_0x59e168?_0x31938d['count']:_0x2cba54[_0x0d9a('0x19')]+_0x2cba54[_0x0d9a('0x1c')];var _0x14936a;if(_0x4de36b>=_0x57ddf6){_0x4de36b=_0x57ddf6;_0x14936a=0xc8;}else{_0x14936a=0xce;}_0x67436b[_0x0d9a('0x17')](_0x14936a);return _0x67436b[_0x0d9a('0x1d')]('Content-Range',_0x2cc7d2+'-'+_0x4de36b+'/'+_0x57ddf6)['json'](_0x31938d);}return null;};}function patchUpdates(_0xf4fcdd){return function(_0x3c8e8e){try{jsonpatch['apply'](_0x3c8e8e,_0xf4fcdd,!![]);}catch(_0x1e3b88){return BPromise['reject'](_0x1e3b88);}return _0x3c8e8e[_0x0d9a('0x1e')]();};}function saveUpdates(_0x1b0ebd,_0x2741f4){return function(_0x474ce1){if(_0x474ce1){return _0x474ce1[_0x0d9a('0x1f')](_0x1b0ebd)[_0x0d9a('0x20')](function(_0x2722b7){return _0x2722b7;});}return null;};}function removeEntity(_0x5ef19e,_0x405c7f){return function(_0x38740b){if(_0x38740b){return _0x38740b[_0x0d9a('0x21')]()[_0x0d9a('0x20')](function(){_0x5ef19e[_0x0d9a('0x17')](0xcc)[_0x0d9a('0x22')]();});}};}function handleEntityNotFound(_0x311f08,_0x269fab){return function(_0xc83ca1){if(!_0xc83ca1){_0x311f08['sendStatus'](0x194);}return _0xc83ca1;};}function handleError(_0x2a9ff9,_0x5befd4){_0x5befd4=_0x5befd4||0x1f4;return function(_0x5ce2eb){logger['error'](_0x5ce2eb[_0x0d9a('0x23')]);if(_0x5ce2eb[_0x0d9a('0x24')]){delete _0x5ce2eb['name'];}_0x2a9ff9[_0x0d9a('0x17')](_0x5befd4)[_0x0d9a('0x25')](_0x5ce2eb);};}exports[_0x0d9a('0x26')]=function(_0x39393b,_0x1b3340){var _0x502d2e={},_0x1769a3={},_0x278d5a={'count':0x0,'rows':[]};var _0x4e661e=_[_0x0d9a('0x27')](db[_0x0d9a('0x28')][_0x0d9a('0x29')],function(_0x417843){return{'name':_0x417843['fieldName'],'type':_0x417843[_0x0d9a('0x2a')][_0x0d9a('0x2b')]};});_0x1769a3[_0x0d9a('0x2c')]=_['map'](_0x4e661e,_0x0d9a('0x24'));_0x1769a3['query']=_[_0x0d9a('0x2d')](_0x39393b[_0x0d9a('0x2e')]);_0x1769a3[_0x0d9a('0x2f')]=_[_0x0d9a('0x30')](_0x1769a3[_0x0d9a('0x2c')],_0x1769a3[_0x0d9a('0x2e')]);_0x502d2e['attributes']=_[_0x0d9a('0x30')](_0x1769a3[_0x0d9a('0x2c')],qs[_0x0d9a('0x31')](_0x39393b['query'][_0x0d9a('0x31')]));_0x502d2e[_0x0d9a('0x32')]=_0x502d2e['attributes'][_0x0d9a('0x33')]?_0x502d2e['attributes']:_0x1769a3['model'];if(!_0x39393b[_0x0d9a('0x2e')]['hasOwnProperty']('nolimit')){_0x502d2e[_0x0d9a('0x1c')]=qs[_0x0d9a('0x1c')](_0x39393b[_0x0d9a('0x2e')][_0x0d9a('0x1c')]);_0x502d2e['offset']=qs[_0x0d9a('0x19')](_0x39393b['query'][_0x0d9a('0x19')]);}_0x502d2e[_0x0d9a('0x34')]=qs[_0x0d9a('0x35')](_0x39393b[_0x0d9a('0x2e')][_0x0d9a('0x35')]);_0x502d2e[_0x0d9a('0x36')]=qs[_0x0d9a('0x2f')](_[_0x0d9a('0x37')](_0x39393b[_0x0d9a('0x2e')],_0x1769a3['filters']),_0x4e661e);if(_0x39393b[_0x0d9a('0x2e')][_0x0d9a('0x38')]){_0x502d2e[_0x0d9a('0x36')]=_['merge'](_0x502d2e[_0x0d9a('0x36')],{'$or':_[_0x0d9a('0x27')](_0x4e661e,function(_0x32033a){if(_0x32033a[_0x0d9a('0x2a')]!=='VIRTUAL'){var _0x1b9c8a={};_0x1b9c8a[_0x32033a[_0x0d9a('0x24')]]={'$like':'%'+_0x39393b[_0x0d9a('0x2e')][_0x0d9a('0x38')]+'%'};return _0x1b9c8a;}})});}_0x502d2e=_[_0x0d9a('0x39')]({},_0x502d2e,_0x39393b['options']);var _0x59f7f0={'where':_0x502d2e[_0x0d9a('0x36')]};return db['SugarcrmAccount'][_0x0d9a('0x1b')](_0x59f7f0)[_0x0d9a('0x20')](function(_0x3be239){_0x278d5a[_0x0d9a('0x1b')]=_0x3be239;if(_0x39393b[_0x0d9a('0x2e')]['includeAll']){_0x502d2e[_0x0d9a('0x3a')]=[{'all':!![]}];}return db[_0x0d9a('0x28')][_0x0d9a('0x3b')](_0x502d2e);})[_0x0d9a('0x20')](function(_0x49c2db){_0x278d5a[_0x0d9a('0x3c')]=_0x49c2db;return _0x278d5a;})[_0x0d9a('0x20')](respondWithFilteredResult(_0x1b3340,_0x502d2e))['catch'](handleError(_0x1b3340,null));};exports['show']=function(_0x56f884,_0x57cde5){var _0x28aa80={'raw':![],'where':{'id':_0x56f884[_0x0d9a('0x3d')]['id']}},_0x13decb={};_0x13decb['model']=_['keys'](db['SugarcrmAccount'][_0x0d9a('0x29')]);_0x13decb['query']=_[_0x0d9a('0x2d')](_0x56f884[_0x0d9a('0x2e')]);_0x13decb['filters']=_[_0x0d9a('0x30')](_0x13decb['model'],_0x13decb[_0x0d9a('0x2e')]);_0x28aa80[_0x0d9a('0x32')]=_[_0x0d9a('0x30')](_0x13decb[_0x0d9a('0x2c')],qs[_0x0d9a('0x31')](_0x56f884[_0x0d9a('0x2e')][_0x0d9a('0x31')]));_0x28aa80[_0x0d9a('0x32')]=_0x28aa80[_0x0d9a('0x32')][_0x0d9a('0x33')]?_0x28aa80['attributes']:_0x13decb['model'];if(_0x56f884['query'][_0x0d9a('0x3e')]){_0x28aa80[_0x0d9a('0x3a')]=[{'all':!![]}];}_0x28aa80=_[_0x0d9a('0x39')]({},_0x28aa80,_0x56f884[_0x0d9a('0x3f')]);return db[_0x0d9a('0x28')][_0x0d9a('0x40')](_0x28aa80)['then'](handleEntityNotFound(_0x57cde5,null))[_0x0d9a('0x20')](respondWithResult(_0x57cde5,null))[_0x0d9a('0x41')](handleError(_0x57cde5,null));};exports['create']=function(_0x26d112,_0x2c6a34){return db[_0x0d9a('0x28')][_0x0d9a('0x42')](_0x26d112[_0x0d9a('0x43')],{})[_0x0d9a('0x20')](respondWithResult(_0x2c6a34,0xc9))[_0x0d9a('0x41')](handleError(_0x2c6a34,null));};exports['update']=function(_0xbd0c85,_0x4f624b){if(_0xbd0c85[_0x0d9a('0x43')]['id']){delete _0xbd0c85[_0x0d9a('0x43')]['id'];}return db[_0x0d9a('0x28')][_0x0d9a('0x40')]({'where':{'id':_0xbd0c85[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x20')](handleEntityNotFound(_0x4f624b,null))[_0x0d9a('0x20')](saveUpdates(_0xbd0c85[_0x0d9a('0x43')],null))[_0x0d9a('0x20')](respondWithResult(_0x4f624b,null))[_0x0d9a('0x41')](handleError(_0x4f624b,null));};exports[_0x0d9a('0x21')]=function(_0x3ba824,_0x54ba19){return db[_0x0d9a('0x28')]['find']({'where':{'id':_0x3ba824[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x20')](handleEntityNotFound(_0x54ba19,null))[_0x0d9a('0x20')](removeEntity(_0x54ba19,null))['catch'](handleError(_0x54ba19,null));};exports['getConfigurations']=function(_0x4d9136,_0x32d388,_0x31b213){var _0x341054={};var _0x482185={};var _0x2a7ab5;var _0x8bfcd2;return db['SugarcrmAccount'][_0x0d9a('0x44')]({'where':{'id':_0x4d9136[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x20')](handleEntityNotFound(_0x32d388,null))[_0x0d9a('0x20')](function(_0x42171c){if(_0x42171c){_0x2a7ab5=_0x42171c;_0x482185[_0x0d9a('0x2c')]=_['keys'](db[_0x0d9a('0x45')][_0x0d9a('0x29')]);_0x482185['query']=_[_0x0d9a('0x2d')](_0x4d9136[_0x0d9a('0x2e')]);_0x482185[_0x0d9a('0x2f')]=_[_0x0d9a('0x30')](_0x482185[_0x0d9a('0x2c')],_0x482185[_0x0d9a('0x2e')]);_0x341054['attributes']=_[_0x0d9a('0x30')](_0x482185[_0x0d9a('0x2c')],qs[_0x0d9a('0x31')](_0x4d9136[_0x0d9a('0x2e')]['fields']));_0x341054['attributes']=_0x341054[_0x0d9a('0x32')][_0x0d9a('0x33')]?_0x341054[_0x0d9a('0x32')]:_0x482185['model'];_0x341054[_0x0d9a('0x34')]=qs[_0x0d9a('0x35')](_0x4d9136[_0x0d9a('0x2e')]['sort']);_0x341054[_0x0d9a('0x36')]=qs[_0x0d9a('0x2f')](_[_0x0d9a('0x37')](_0x4d9136[_0x0d9a('0x2e')],_0x482185[_0x0d9a('0x2f')]));if(_0x4d9136[_0x0d9a('0x2e')][_0x0d9a('0x38')]){_0x341054[_0x0d9a('0x36')]=_[_0x0d9a('0x39')](_0x341054[_0x0d9a('0x36')],{'$or':_['map'](_0x341054[_0x0d9a('0x32')],function(_0x9ca07e){var _0x4fee0f={};_0x4fee0f[_0x9ca07e]={'$like':'%'+_0x4d9136[_0x0d9a('0x2e')]['filter']+'%'};return _0x4fee0f;})});}_0x341054=_['merge']({},_0x341054,_0x4d9136[_0x0d9a('0x3f')]);return _0x2a7ab5['getConfigurations'](_0x341054);}})[_0x0d9a('0x20')](function(_0x5d08f6){if(_0x5d08f6){_0x8bfcd2=_0x5d08f6['length'];if(!_0x4d9136['query'][_0x0d9a('0x46')](_0x0d9a('0x47'))){_0x341054[_0x0d9a('0x1c')]=qs['limit'](_0x4d9136['query'][_0x0d9a('0x1c')]);_0x341054[_0x0d9a('0x19')]=qs['offset'](_0x4d9136[_0x0d9a('0x2e')][_0x0d9a('0x19')]);}return _0x2a7ab5['getConfigurations'](_0x341054);}})[_0x0d9a('0x20')](function(_0xa99403){if(_0xa99403){return _0xa99403?{'count':_0x8bfcd2,'rows':_0xa99403}:null;}})['then'](respondWithResult(_0x32d388,null))[_0x0d9a('0x41')](handleError(_0x32d388,null));};exports[_0x0d9a('0x48')]=function(_0xfb100f,_0x57fd6c,_0x40e195){if(_0xfb100f[_0x0d9a('0x43')]['id']){delete _0xfb100f[_0x0d9a('0x43')]['id'];}return db[_0x0d9a('0x28')][_0x0d9a('0x44')]({'where':{'id':_0xfb100f[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x20')](handleEntityNotFound(_0x57fd6c,null))[_0x0d9a('0x20')](function(_0x4ea268){if(_0x4ea268){_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x49')]=_0x4ea268['id'];_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x4a')]=integrations['getSubjects'](_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x4b')],_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x2a')]);_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x4c')]=integrations[_0x0d9a('0x4d')](_0xfb100f[_0x0d9a('0x43')][_0x0d9a('0x4b')],_0xfb100f['body']['type']);return db[_0x0d9a('0x45')][_0x0d9a('0x42')](_0xfb100f[_0x0d9a('0x43')],{'include':[{'model':db[_0x0d9a('0x4e')],'as':'Subjects'},{'model':db[_0x0d9a('0x4e')],'as':_0x0d9a('0x4c')}]});}return null;})[_0x0d9a('0x20')](respondWithResult(_0x57fd6c,null))['catch'](handleError(_0x57fd6c,null));};exports[_0x0d9a('0x4f')]=function(_0x25c47c,_0x2ba228,_0x271c29){var _0x43ae92='';var _0x3bf41c=['id',_0x0d9a('0x24'),_0x0d9a('0x50'),'created_by',_0x0d9a('0x51'),_0x0d9a('0x52'),_0x0d9a('0x53'),_0x0d9a('0x54'),_0x0d9a('0x55'),_0x0d9a('0x56'),'parent_name','direction'];return db[_0x0d9a('0x28')][_0x0d9a('0x44')]({'where':{'id':_0x25c47c['params']['id']},'attributes':['id','username',_0x0d9a('0x57'),_0x0d9a('0x58')]})['then'](handleEntityNotFound(_0x2ba228,null))[_0x0d9a('0x20')](function(_0x26c6f1){if(_0x26c6f1){_0x43ae92=_0x26c6f1['remoteUri'];var _0x14c1fb=_0x43ae92['slice'](-0x1);if(_0x14c1fb==='/'){_0x43ae92=_0x43ae92[_0x0d9a('0x59')](0x0,_0x43ae92[_0x0d9a('0x5a')](_0x14c1fb));}return rp({'method':_0x0d9a('0x5b'),'uri':util[_0x0d9a('0x5c')]('%s%s',_0x43ae92,_0x0d9a('0x5d')),'json':!![],'form':{'method':_0x0d9a('0x5e'),'input_type':'JSON','response_type':_0x0d9a('0x5f'),'rest_data':JSON[_0x0d9a('0x60')]({'user_auth':{'user_name':_0x26c6f1[_0x0d9a('0x61')],'password':_0x26c6f1[_0x0d9a('0x57')],'encryption':_0x0d9a('0x62')},'application':_0x0d9a('0x63')})}});}})[_0x0d9a('0x20')](function(_0xf99c48){if(_0xf99c48&&_0xf99c48[_0x0d9a('0x24')]!==_0x0d9a('0x64')&&_0xf99c48[_0x0d9a('0x24')]!==_0x0d9a('0x65')){return rp({'method':_0x0d9a('0x5b'),'uri':util[_0x0d9a('0x5c')](_0x0d9a('0x66'),_0x43ae92,_0x0d9a('0x5d')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0d9a('0x5f'),'response_type':_0x0d9a('0x5f'),'rest_data':JSON['stringify']({'session':_0xf99c48['id'],'module_name':_0x0d9a('0x67')})}})['then'](function(_0x1bcdd3){if(_0x1bcdd3){var _0x1df778=_['values'](_0x1bcdd3[_0x0d9a('0x68')]);_[_0x0d9a('0x69')](_0x1df778,function(_0x4a3d7e){return _0x3bf41c[_0x0d9a('0x6a')](_0x4a3d7e[_0x0d9a('0x24')]);});return{'count':_0x1df778[_0x0d9a('0x33')],'rows':_[_0x0d9a('0x27')](_0x1df778,function(_0x3a9df2){return{'id':_0x3a9df2[_0x0d9a('0x24')],'name':_0x3a9df2[_0x0d9a('0x6b')],'custom':_['endsWith'](_0x3a9df2[_0x0d9a('0x24')],'_c')?!![]:![],'options':_0x3a9df2[_0x0d9a('0x3f')]?_['map'](_['values'](_0x3a9df2[_0x0d9a('0x3f')]),function(_0x3b1487){return{'name':_0x3b1487[_0x0d9a('0x6c')],'value':_0x3b1487['name']};}):[]};})};}})[_0x0d9a('0x20')](respondWithResult(_0x2ba228,null))[_0x0d9a('0x41')](function(_0x45662a){var _0x18efd6=_0x25c47c[_0x0d9a('0x2e')][_0x0d9a('0x6d')]?0x1f4:_0x45662a[_0x0d9a('0x6e')]||0x1f4;logger['error'](_0x0d9a('0x6f'),_0x0d9a('0x4f'),_0x18efd6,JSON['stringify'](_0x45662a));delete _0x45662a[_0x0d9a('0x24')];if(_0x18efd6===0x191){_0x18efd6=0x190;}_0x2ba228[_0x0d9a('0x17')](_0x18efd6)[_0x0d9a('0x25')](_0x25c47c[_0x0d9a('0x2e')][_0x0d9a('0x6d')]?{'message':_0x0d9a('0x70'),'statusCode':_0x45662a[_0x0d9a('0x6e')]}:_0x45662a);});}else{var _0x304219=0x1f4;_0x2ba228[_0x0d9a('0x17')](_0x304219)[_0x0d9a('0x25')]({'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 85dc3d5..1700e60 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 _0xc0d7=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','api','moment','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x40745c,_0x5b12eb){_0x40745c=_0x40745c-0x0;var _0x4055c0=_0xc0d7[_0x40745c];return _0x4055c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7c0d('0x0'));var moment=require(_0x7c0d('0x1'));var BPromise=require(_0x7c0d('0x2'));var rp=require(_0x7c0d('0x3'));var fs=require('fs');var path=require(_0x7c0d('0x4'));var rimraf=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var attributes=require(_0x7c0d('0x7'));var integrations=require(_0x7c0d('0x8'));module['exports']=function(_0x507bc0,_0x14f205){return _0x507bc0[_0x7c0d('0x9')](_0x7c0d('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bf7=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x1a19a1,_0x2c4e77){var _0x51362a=function(_0xaf0daf){while(--_0xaf0daf){_0x1a19a1['push'](_0x1a19a1['shift']());}};_0x51362a(++_0x2c4e77);}(_0x0bf7,0x14a));var _0x70bf=function(_0x2fe1a9,_0x42ae9c){_0x2fe1a9=_0x2fe1a9-0x0;var _0x2a8108=_0x0bf7[_0x2fe1a9];return _0x2a8108;};'use strict';var _=require(_0x70bf('0x0'));var util=require('util');var logger=require(_0x70bf('0x1'))(_0x70bf('0x2'));var moment=require(_0x70bf('0x3'));var BPromise=require(_0x70bf('0x4'));var rp=require(_0x70bf('0x5'));var fs=require('fs');var path=require(_0x70bf('0x6'));var rimraf=require('rimraf');var config=require(_0x70bf('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4179e4,_0x410444){return _0x4179e4[_0x70bf('0x8')](_0x70bf('0x9'),attributes,{'tableName':_0x70bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index fee4446..8f7759e 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 _0x299a=['client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','SugarcrmAccount','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x299a,0x95));var _0xa299=function(_0x26090d,_0x85909b){_0x26090d=_0x26090d-0x0;var _0x147bbc=_0x299a[_0x26090d];return _0x147bbc;};'use strict';var _=require(_0xa299('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa299('0x1'));var fs=require('fs');var Redis=require(_0xa299('0x2'));var db=require(_0xa299('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa299('0x4'));var config=require(_0xa299('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa299('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578a2f,_0x124867,_0x46f6f6){return new BPromise(function(_0x1d3367,_0x37da58){return client[_0xa299('0x7')](_0x578a2f,_0x46f6f6)[_0xa299('0x8')](function(_0x395f40){logger[_0xa299('0x9')](_0xa299('0xa'),_0x124867,_0xa299('0xb'));logger[_0xa299('0xc')](_0xa299('0xd'),_0x124867,'request\x20sent',JSON[_0xa299('0xe')](_0x395f40));if(_0x395f40[_0xa299('0xf')]){if(_0x395f40[_0xa299('0xf')][_0xa299('0x10')]===0x1f4){logger['error'](_0xa299('0xa'),_0x124867,_0x395f40[_0xa299('0xf')]['message']);return _0x37da58(_0x395f40[_0xa299('0xf')][_0xa299('0x11')]);}logger[_0xa299('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x124867,_0x395f40[_0xa299('0xf')]['message']);return _0x1d3367(_0x395f40[_0xa299('0xf')][_0xa299('0x11')]);}else{logger[_0xa299('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x124867,_0xa299('0xb'));_0x1d3367(_0x395f40['result'][_0xa299('0x11')]);}})[_0xa299('0x12')](function(_0x424da6){logger[_0xa299('0xf')](_0xa299('0xa'),_0x124867,_0x424da6);_0x37da58(_0x424da6);});});}exports[_0xa299('0x13')]=function(_0x4d3e1e){var _0x1ea5be=this;return new Promise(function(_0x2827f7,_0x65c6){return db['SugarcrmAccount'][_0xa299('0x14')]({'raw':_0x4d3e1e[_0xa299('0x15')]?_0x4d3e1e[_0xa299('0x15')][_0xa299('0x16')]===undefined?!![]:![]:!![],'where':_0x4d3e1e[_0xa299('0x15')]?_0x4d3e1e[_0xa299('0x15')][_0xa299('0x17')]||null:null,'attributes':_0x4d3e1e['options']?_0x4d3e1e['options'][_0xa299('0x18')]||null:null,'limit':_0x4d3e1e[_0xa299('0x15')]?_0x4d3e1e['options'][_0xa299('0x19')]||null:null,'include':_0x4d3e1e[_0xa299('0x15')]?_0x4d3e1e['options'][_0xa299('0x1a')]?_['map'](_0x4d3e1e[_0xa299('0x15')][_0xa299('0x1a')],function(_0x52360f){return{'model':db[_0x52360f[_0xa299('0x1b')]],'as':_0x52360f['as'],'attributes':_0x52360f[_0xa299('0x18')],'include':_0x52360f['include']?_['map'](_0x52360f['include'],function(_0x4579bf){return{'model':db[_0x4579bf[_0xa299('0x1b')]],'as':_0x4579bf['as'],'attributes':_0x4579bf[_0xa299('0x18')],'include':_0x4579bf['include']?_[_0xa299('0x1c')](_0x4579bf[_0xa299('0x1a')],function(_0x11f1e7){return{'model':db[_0x11f1e7[_0xa299('0x1b')]],'as':_0x11f1e7['as'],'attributes':_0x11f1e7[_0xa299('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa299('0x8')](function(_0x433e9b){logger[_0xa299('0x9')](_0xa299('0x13'),_0x4d3e1e);logger['debug']('GetSugarcrmAccount',_0x4d3e1e,JSON[_0xa299('0xe')](_0x433e9b));_0x2827f7(_0x433e9b);})[_0xa299('0x12')](function(_0x30052c){logger['error'](_0xa299('0x13'),_0x30052c[_0xa299('0x11')],_0x4d3e1e);_0x65c6(_0x1ea5be[_0xa299('0xf')](0x1f4,_0x30052c['message']));});});};exports[_0xa299('0x1d')]=function(_0x4f19df){var _0x33a76f=this;return new Promise(function(_0x2839f0,_0x1c9a4f){return db[_0xa299('0x1e')]['find']({'raw':_0x4f19df['options']?_0x4f19df['options'][_0xa299('0x16')]===undefined?!![]:![]:!![],'where':_0x4f19df['options']?_0x4f19df[_0xa299('0x15')]['where']||null:null,'attributes':_0x4f19df[_0xa299('0x15')]?_0x4f19df[_0xa299('0x15')]['attributes']||null:null,'include':_0x4f19df[_0xa299('0x15')]?_0x4f19df[_0xa299('0x15')][_0xa299('0x1a')]?_[_0xa299('0x1c')](_0x4f19df[_0xa299('0x15')]['include'],function(_0x17fdb0){return{'model':db[_0x17fdb0['model']],'as':_0x17fdb0['as'],'attributes':_0x17fdb0['attributes'],'include':_0x17fdb0[_0xa299('0x1a')]?_[_0xa299('0x1c')](_0x17fdb0[_0xa299('0x1a')],function(_0x1c1c16){return{'model':db[_0x1c1c16[_0xa299('0x1b')]],'as':_0x1c1c16['as'],'attributes':_0x1c1c16['attributes'],'include':_0x1c1c16[_0xa299('0x1a')]?_[_0xa299('0x1c')](_0x1c1c16['include'],function(_0x59cf12){return{'model':db[_0x59cf12[_0xa299('0x1b')]],'as':_0x59cf12['as'],'attributes':_0x59cf12[_0xa299('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa299('0x8')](function(_0x324736){logger[_0xa299('0x9')]('ShowSugarcrmAccount',_0x4f19df);logger[_0xa299('0xc')]('ShowSugarcrmAccount',_0x4f19df,JSON['stringify'](_0x324736));_0x2839f0(_0x324736);})[_0xa299('0x12')](function(_0x43de56){logger['error'](_0xa299('0x1d'),_0x43de56['message'],_0x4f19df);_0x1c9a4f(_0x33a76f[_0xa299('0xf')](0x1f4,_0x43de56[_0xa299('0x11')]));});});}; \ No newline at end of file +var _0x469b=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','model','map','debug','ShowSugarcrmAccount','util','moment','randomstring','ioredis'];(function(_0x4d883a,_0x8afbc8){var _0x4219ce=function(_0x1ce35e){while(--_0x1ce35e){_0x4d883a['push'](_0x4d883a['shift']());}};_0x4219ce(++_0x8afbc8);}(_0x469b,0x74));var _0xb469=function(_0x435592,_0x363aed){_0x435592=_0x435592-0x0;var _0x2d544d=_0x469b[_0x435592];return _0x2d544d;};'use strict';var _=require('lodash');var util=require(_0xb469('0x0'));var moment=require(_0xb469('0x1'));var BPromise=require('bluebird');var rs=require(_0xb469('0x2'));var fs=require('fs');var Redis=require(_0xb469('0x3'));var db=require(_0xb469('0x4'))['db'];var utils=require(_0xb469('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb469('0x6'));var jayson=require(_0xb469('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a83c7,_0x28030f,_0xbe06e6){return new BPromise(function(_0x12ad8c,_0x13b472){return client['request'](_0x2a83c7,_0xbe06e6)[_0xb469('0x8')](function(_0x23f223){logger[_0xb469('0x9')](_0xb469('0xa'),_0x28030f,_0xb469('0xb'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x28030f,_0xb469('0xb'),JSON[_0xb469('0xc')](_0x23f223));if(_0x23f223['error']){if(_0x23f223[_0xb469('0xd')][_0xb469('0xe')]===0x1f4){logger['error'](_0xb469('0xa'),_0x28030f,_0x23f223[_0xb469('0xd')][_0xb469('0xf')]);return _0x13b472(_0x23f223[_0xb469('0xd')]['message']);}logger[_0xb469('0xd')](_0xb469('0xa'),_0x28030f,_0x23f223[_0xb469('0xd')]['message']);return _0x12ad8c(_0x23f223[_0xb469('0xd')][_0xb469('0xf')]);}else{logger['info'](_0xb469('0xa'),_0x28030f,_0xb469('0xb'));_0x12ad8c(_0x23f223[_0xb469('0x10')][_0xb469('0xf')]);}})[_0xb469('0x11')](function(_0x4ce3f7){logger['error'](_0xb469('0xa'),_0x28030f,_0x4ce3f7);_0x13b472(_0x4ce3f7);});});}exports[_0xb469('0x12')]=function(_0x3006d2){var _0x2252bc=this;return new Promise(function(_0x3a76bb,_0x161431){return db[_0xb469('0x13')][_0xb469('0x14')]({'raw':_0x3006d2['options']?_0x3006d2[_0xb469('0x15')][_0xb469('0x16')]===undefined?!![]:![]:!![],'where':_0x3006d2[_0xb469('0x15')]?_0x3006d2['options']['where']||null:null,'attributes':_0x3006d2[_0xb469('0x15')]?_0x3006d2['options'][_0xb469('0x17')]||null:null,'limit':_0x3006d2[_0xb469('0x15')]?_0x3006d2[_0xb469('0x15')][_0xb469('0x18')]||null:null,'include':_0x3006d2[_0xb469('0x15')]?_0x3006d2[_0xb469('0x15')][_0xb469('0x19')]?_['map'](_0x3006d2[_0xb469('0x15')][_0xb469('0x19')],function(_0x2c379d){return{'model':db[_0x2c379d[_0xb469('0x1a')]],'as':_0x2c379d['as'],'attributes':_0x2c379d[_0xb469('0x17')],'include':_0x2c379d[_0xb469('0x19')]?_[_0xb469('0x1b')](_0x2c379d[_0xb469('0x19')],function(_0x97159e){return{'model':db[_0x97159e[_0xb469('0x1a')]],'as':_0x97159e['as'],'attributes':_0x97159e['attributes'],'include':_0x97159e[_0xb469('0x19')]?_[_0xb469('0x1b')](_0x97159e[_0xb469('0x19')],function(_0x294834){return{'model':db[_0x294834[_0xb469('0x1a')]],'as':_0x294834['as'],'attributes':_0x294834[_0xb469('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb469('0x8')](function(_0x142c7d){logger[_0xb469('0x9')](_0xb469('0x12'),_0x3006d2);logger[_0xb469('0x1c')](_0xb469('0x12'),_0x3006d2,JSON[_0xb469('0xc')](_0x142c7d));_0x3a76bb(_0x142c7d);})[_0xb469('0x11')](function(_0x4055e5){logger['error'](_0xb469('0x12'),_0x4055e5['message'],_0x3006d2);_0x161431(_0x2252bc['error'](0x1f4,_0x4055e5['message']));});});};exports[_0xb469('0x1d')]=function(_0x257d1e){var _0x5d6ae9=this;return new Promise(function(_0x1011d4,_0x3a61fd){return db[_0xb469('0x13')]['find']({'raw':_0x257d1e[_0xb469('0x15')]?_0x257d1e[_0xb469('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x257d1e[_0xb469('0x15')]?_0x257d1e[_0xb469('0x15')]['where']||null:null,'attributes':_0x257d1e[_0xb469('0x15')]?_0x257d1e['options']['attributes']||null:null,'include':_0x257d1e[_0xb469('0x15')]?_0x257d1e[_0xb469('0x15')]['include']?_[_0xb469('0x1b')](_0x257d1e[_0xb469('0x15')][_0xb469('0x19')],function(_0x7a2e16){return{'model':db[_0x7a2e16[_0xb469('0x1a')]],'as':_0x7a2e16['as'],'attributes':_0x7a2e16[_0xb469('0x17')],'include':_0x7a2e16['include']?_[_0xb469('0x1b')](_0x7a2e16['include'],function(_0x13e621){return{'model':db[_0x13e621[_0xb469('0x1a')]],'as':_0x13e621['as'],'attributes':_0x13e621[_0xb469('0x17')],'include':_0x13e621[_0xb469('0x19')]?_[_0xb469('0x1b')](_0x13e621[_0xb469('0x19')],function(_0x379dcb){return{'model':db[_0x379dcb['model']],'as':_0x379dcb['as'],'attributes':_0x379dcb[_0xb469('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x318cc9){logger[_0xb469('0x9')](_0xb469('0x1d'),_0x257d1e);logger[_0xb469('0x1c')](_0xb469('0x1d'),_0x257d1e,JSON[_0xb469('0xc')](_0x318cc9));_0x1011d4(_0x318cc9);})[_0xb469('0x11')](function(_0x4eee7b){logger['error'](_0xb469('0x1d'),_0x4eee7b[_0xb469('0xf')],_0x257d1e);_0x3a61fd(_0x5d6ae9['error'](0x1f4,_0x4eee7b[_0xb469('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d066376..77ac2ae 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 _0x6291=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update'];(function(_0x14caee,_0x2d8f13){var _0x1ff3d7=function(_0x378593){while(--_0x378593){_0x14caee['push'](_0x14caee['shift']());}};_0x1ff3d7(++_0x2d8f13);}(_0x6291,0xba));var _0x1629=function(_0x5d547f,_0x50a029){_0x5d547f=_0x5d547f-0x0;var _0x66efe3=_0x6291[_0x5d547f];return _0x66efe3;};'use strict';var multer=require('multer');var util=require(_0x1629('0x0'));var path=require(_0x1629('0x1'));var timeout=require(_0x1629('0x2'));var express=require('express');var router=express[_0x1629('0x3')]();var fs_extra=require(_0x1629('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1629('0x5'));var config=require(_0x1629('0x6'));var controller=require(_0x1629('0x7'));router['get']('/',auth[_0x1629('0x8')](),controller[_0x1629('0x9')]);router['get']('/:id',auth[_0x1629('0x8')](),controller[_0x1629('0xa')]);router[_0x1629('0xb')](_0x1629('0xc'),auth[_0x1629('0x8')](),controller['getFields']);router[_0x1629('0xb')](_0x1629('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1629('0xb')](_0x1629('0xe'),auth[_0x1629('0x8')](),controller[_0x1629('0xf')]);router[_0x1629('0x10')]('/',auth['isAuthenticated'](),controller[_0x1629('0x11')]);router[_0x1629('0x12')](_0x1629('0x13'),auth[_0x1629('0x8')](),controller[_0x1629('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1629('0x15')]);module[_0x1629('0x16')]=router; \ No newline at end of file +var _0x0d0a=['Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0x0d0a,0x155));var _0xa0d0=function(_0x1e413b,_0x5c9684){_0x1e413b=_0x1e413b-0x0;var _0x4170e3=_0x0d0a[_0x1e413b];return _0x4170e3;};'use strict';var multer=require(_0xa0d0('0x0'));var util=require(_0xa0d0('0x1'));var path=require('path');var timeout=require(_0xa0d0('0x2'));var express=require(_0xa0d0('0x3'));var router=express[_0xa0d0('0x4')]();var fs_extra=require(_0xa0d0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0d0('0x6'));var controller=require(_0xa0d0('0x7'));router[_0xa0d0('0x8')]('/',auth[_0xa0d0('0x9')](),controller[_0xa0d0('0xa')]);router[_0xa0d0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa0d0('0xb')]);router[_0xa0d0('0x8')]('/:id/fields',auth[_0xa0d0('0x9')](),controller['getFields']);router[_0xa0d0('0x8')](_0xa0d0('0xc'),auth['isAuthenticated'](),controller[_0xa0d0('0xd')]);router[_0xa0d0('0x8')](_0xa0d0('0xe'),auth['isAuthenticated'](),controller[_0xa0d0('0xf')]);router[_0xa0d0('0x10')]('/',auth['isAuthenticated'](),controller[_0xa0d0('0x11')]);router[_0xa0d0('0x12')]('/:id',auth[_0xa0d0('0x9')](),controller[_0xa0d0('0x13')]);router[_0xa0d0('0x14')](_0xa0d0('0x15'),auth['isAuthenticated'](),controller[_0xa0d0('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5d8e862..80e12f3 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 _0xd063=['exports','STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd063,0x1ca));var _0x3d06=function(_0x37bbc6,_0x369467){_0x37bbc6=_0x37bbc6-0x0;var _0x209c9c=_0xd063[_0x37bbc6];return _0x209c9c;};'use strict';var Sequelize=require(_0x3d06('0x0'));module[_0x3d06('0x1')]={'name':{'type':Sequelize[_0x3d06('0x2')]},'description':{'type':Sequelize[_0x3d06('0x2')]}}; \ No newline at end of file +var _0x6f6c=['exports','sequelize'];(function(_0x4c0a86,_0x1b2198){var _0x1435f2=function(_0x554078){while(--_0x554078){_0x4c0a86['push'](_0x4c0a86['shift']());}};_0x1435f2(++_0x1b2198);}(_0x6f6c,0x187));var _0xc6f6=function(_0x385c75,_0x38aecd){_0x385c75=_0x385c75-0x0;var _0x5e57f6=_0x6f6c[_0x385c75];return _0x5e57f6;};'use strict';var Sequelize=require(_0xc6f6('0x0'));module[_0xc6f6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 44ca06d..3c2b84e 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 _0x9497=['attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','getFields','SugarcrmField','order','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','error','name','send','index','map','fieldName','key','query','filters','model','intersection','fields'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9497,0x1a5));var _0x7949=function(_0x512366,_0x241ec1){_0x512366=_0x512366-0x0;var _0x55edac=_0x9497[_0x512366];return _0x55edac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7949('0x0'));var zipdir=require(_0x7949('0x1'));var jsonpatch=require(_0x7949('0x2'));var rp=require(_0x7949('0x3'));var moment=require(_0x7949('0x4'));var BPromise=require(_0x7949('0x5'));var Mustache=require(_0x7949('0x6'));var util=require(_0x7949('0x7'));var path=require(_0x7949('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7949('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7949('0xa'));var squel=require(_0x7949('0xb'));var crypto=require('crypto');var jsforce=require(_0x7949('0xc'));var deskjs=require(_0x7949('0xd'));var toCsv=require(_0x7949('0xe'));var querystring=require(_0x7949('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7949('0x10'));var qs=require(_0x7949('0x11'));var as=require(_0x7949('0x12'));var hardwareService=require(_0x7949('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7949('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7949('0x15'))['db'];function respondWithStatusCode(_0x590d23,_0x1f436d){_0x1f436d=_0x1f436d||0xcc;return function(_0x179e45){if(_0x179e45){return _0x590d23[_0x7949('0x16')](_0x1f436d);}return _0x590d23[_0x7949('0x17')](_0x1f436d)[_0x7949('0x18')]();};}function respondWithResult(_0x1e6c50,_0x4dc3fb){_0x4dc3fb=_0x4dc3fb||0xc8;return function(_0x53986c){if(_0x53986c){return _0x1e6c50[_0x7949('0x17')](_0x4dc3fb)['json'](_0x53986c);}};}function respondWithFilteredResult(_0x59e12d,_0x25d577){return function(_0x5c2be3){if(_0x5c2be3){var _0x1b1dfa=typeof _0x25d577[_0x7949('0x19')]===_0x7949('0x1a')&&typeof _0x25d577['limit']===_0x7949('0x1a');var _0x5223b5=_0x5c2be3[_0x7949('0x1b')];var _0x5023ba=_0x1b1dfa?0x0:_0x25d577[_0x7949('0x19')];var _0x2c3474=_0x1b1dfa?_0x5c2be3[_0x7949('0x1b')]:_0x25d577[_0x7949('0x19')]+_0x25d577['limit'];var _0x4ef84c;if(_0x2c3474>=_0x5223b5){_0x2c3474=_0x5223b5;_0x4ef84c=0xc8;}else{_0x4ef84c=0xce;}_0x59e12d[_0x7949('0x17')](_0x4ef84c);return _0x59e12d[_0x7949('0x1c')](_0x7949('0x1d'),_0x5023ba+'-'+_0x2c3474+'/'+_0x5223b5)[_0x7949('0x1e')](_0x5c2be3);}return null;};}function patchUpdates(_0x19f881){return function(_0x5f4d2f){try{jsonpatch[_0x7949('0x1f')](_0x5f4d2f,_0x19f881,!![]);}catch(_0x8ab3fc){return BPromise['reject'](_0x8ab3fc);}return _0x5f4d2f['save']();};}function saveUpdates(_0x27676b,_0x133eb6){return function(_0x116ea1){if(_0x116ea1){return _0x116ea1[_0x7949('0x20')](_0x27676b)[_0x7949('0x21')](function(_0x322881){return _0x322881;});}return null;};}function removeEntity(_0x5b9542,_0x160492){return function(_0x18fbeb){if(_0x18fbeb){return _0x18fbeb[_0x7949('0x22')]()[_0x7949('0x21')](function(){_0x5b9542[_0x7949('0x17')](0xcc)[_0x7949('0x18')]();});}};}function handleEntityNotFound(_0x4b0205,_0x47f3d4){return function(_0x583632){if(!_0x583632){_0x4b0205[_0x7949('0x16')](0x194);}return _0x583632;};}function handleError(_0xc5d70f,_0x5e19d7){_0x5e19d7=_0x5e19d7||0x1f4;return function(_0x1d4146){logger[_0x7949('0x23')](_0x1d4146['stack']);if(_0x1d4146[_0x7949('0x24')]){delete _0x1d4146[_0x7949('0x24')];}_0xc5d70f[_0x7949('0x17')](_0x5e19d7)[_0x7949('0x25')](_0x1d4146);};}exports[_0x7949('0x26')]=function(_0xeb0522,_0x93770b){var _0x2b4b6e={},_0xa30d47={},_0x1e3c20={'count':0x0,'rows':[]};var _0xa09665=_[_0x7949('0x27')](db['SugarcrmConfiguration']['rawAttributes'],function(_0xd81c28){return{'name':_0xd81c28[_0x7949('0x28')],'type':_0xd81c28['type'][_0x7949('0x29')]};});_0xa30d47['model']=_[_0x7949('0x27')](_0xa09665,_0x7949('0x24'));_0xa30d47[_0x7949('0x2a')]=_['keys'](_0xeb0522[_0x7949('0x2a')]);_0xa30d47[_0x7949('0x2b')]=_['intersection'](_0xa30d47[_0x7949('0x2c')],_0xa30d47[_0x7949('0x2a')]);_0x2b4b6e['attributes']=_[_0x7949('0x2d')](_0xa30d47[_0x7949('0x2c')],qs['fields'](_0xeb0522[_0x7949('0x2a')][_0x7949('0x2e')]));_0x2b4b6e[_0x7949('0x2f')]=_0x2b4b6e[_0x7949('0x2f')][_0x7949('0x30')]?_0x2b4b6e[_0x7949('0x2f')]:_0xa30d47[_0x7949('0x2c')];if(!_0xeb0522[_0x7949('0x2a')][_0x7949('0x31')](_0x7949('0x32'))){_0x2b4b6e[_0x7949('0x33')]=qs[_0x7949('0x33')](_0xeb0522[_0x7949('0x2a')][_0x7949('0x33')]);_0x2b4b6e[_0x7949('0x19')]=qs[_0x7949('0x19')](_0xeb0522['query'][_0x7949('0x19')]);}_0x2b4b6e['order']=qs[_0x7949('0x34')](_0xeb0522[_0x7949('0x2a')]['sort']);_0x2b4b6e[_0x7949('0x35')]=qs[_0x7949('0x2b')](_[_0x7949('0x36')](_0xeb0522[_0x7949('0x2a')],_0xa30d47[_0x7949('0x2b')]),_0xa09665);if(_0xeb0522[_0x7949('0x2a')][_0x7949('0x37')]){_0x2b4b6e['where']=_[_0x7949('0x38')](_0x2b4b6e[_0x7949('0x35')],{'$or':_[_0x7949('0x27')](_0xa09665,function(_0x97cc14){if(_0x97cc14[_0x7949('0x39')]!==_0x7949('0x3a')){var _0x138b7a={};_0x138b7a[_0x97cc14[_0x7949('0x24')]]={'$like':'%'+_0xeb0522[_0x7949('0x2a')][_0x7949('0x37')]+'%'};return _0x138b7a;}})});}_0x2b4b6e=_['merge']({},_0x2b4b6e,_0xeb0522[_0x7949('0x3b')]);var _0x2e0697={'where':_0x2b4b6e['where']};return db[_0x7949('0x3c')][_0x7949('0x1b')](_0x2e0697)['then'](function(_0x515db4){_0x1e3c20[_0x7949('0x1b')]=_0x515db4;if(_0xeb0522['query'][_0x7949('0x3d')]){_0x2b4b6e['include']=[{'all':!![]}];}return db[_0x7949('0x3c')][_0x7949('0x3e')](_0x2b4b6e);})[_0x7949('0x21')](function(_0x3e16b9){_0x1e3c20[_0x7949('0x3f')]=_0x3e16b9;return _0x1e3c20;})[_0x7949('0x21')](respondWithFilteredResult(_0x93770b,_0x2b4b6e))[_0x7949('0x40')](handleError(_0x93770b,null));};exports[_0x7949('0x41')]=function(_0x26be44,_0x3e452a){var _0xba8ab7={'raw':![],'where':{'id':_0x26be44['params']['id']}},_0x50dbb9={};_0x50dbb9[_0x7949('0x2c')]=_[_0x7949('0x42')](db[_0x7949('0x3c')][_0x7949('0x43')]);_0x50dbb9[_0x7949('0x2a')]=_[_0x7949('0x42')](_0x26be44[_0x7949('0x2a')]);_0x50dbb9[_0x7949('0x2b')]=_[_0x7949('0x2d')](_0x50dbb9['model'],_0x50dbb9[_0x7949('0x2a')]);_0xba8ab7[_0x7949('0x2f')]=_[_0x7949('0x2d')](_0x50dbb9['model'],qs['fields'](_0x26be44[_0x7949('0x2a')][_0x7949('0x2e')]));_0xba8ab7[_0x7949('0x2f')]=_0xba8ab7['attributes'][_0x7949('0x30')]?_0xba8ab7[_0x7949('0x2f')]:_0x50dbb9[_0x7949('0x2c')];if(_0x26be44[_0x7949('0x2a')][_0x7949('0x3d')]){_0xba8ab7['include']=[{'all':!![]}];}_0xba8ab7=_[_0x7949('0x38')]({},_0xba8ab7,_0x26be44['options']);return db['SugarcrmConfiguration'][_0x7949('0x44')](_0xba8ab7)[_0x7949('0x21')](handleEntityNotFound(_0x3e452a,null))[_0x7949('0x21')](respondWithResult(_0x3e452a,null))[_0x7949('0x40')](handleError(_0x3e452a,null));};exports[_0x7949('0x45')]=function(_0x4b2ba6,_0x251d74){return db[_0x7949('0x3c')][_0x7949('0x45')](_0x4b2ba6[_0x7949('0x46')],{})[_0x7949('0x21')](respondWithResult(_0x251d74,0xc9))[_0x7949('0x40')](handleError(_0x251d74,null));};exports[_0x7949('0x20')]=function(_0x6b641d,_0x526fb3){if(_0x6b641d[_0x7949('0x46')]['id']){delete _0x6b641d['body']['id'];}return db[_0x7949('0x3c')][_0x7949('0x44')]({'where':{'id':_0x6b641d['params']['id']}})[_0x7949('0x21')](handleEntityNotFound(_0x526fb3,null))[_0x7949('0x21')](saveUpdates(_0x6b641d[_0x7949('0x46')],null))[_0x7949('0x21')](respondWithResult(_0x526fb3,null))[_0x7949('0x40')](handleError(_0x526fb3,null));};exports[_0x7949('0x22')]=function(_0x3da8f0,_0x30299b){return db[_0x7949('0x3c')][_0x7949('0x44')]({'where':{'id':_0x3da8f0[_0x7949('0x47')]['id']}})[_0x7949('0x21')](handleEntityNotFound(_0x30299b,null))[_0x7949('0x21')](removeEntity(_0x30299b,null))[_0x7949('0x40')](handleError(_0x30299b,null));};exports[_0x7949('0x48')]=function(_0x166670,_0x4cd5e0,_0x475b74){var _0x47f455={};var _0x20c852={};var _0x46d1ef;var _0xc0fe15;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x166670[_0x7949('0x47')]['id']}})[_0x7949('0x21')](handleEntityNotFound(_0x4cd5e0,null))[_0x7949('0x21')](function(_0x1af01f){if(_0x1af01f){_0x46d1ef=_0x1af01f;_0x20c852[_0x7949('0x2c')]=_[_0x7949('0x42')](db[_0x7949('0x49')][_0x7949('0x43')]);_0x20c852[_0x7949('0x2a')]=_[_0x7949('0x42')](_0x166670['query']);_0x20c852['filters']=_[_0x7949('0x2d')](_0x20c852[_0x7949('0x2c')],_0x20c852[_0x7949('0x2a')]);_0x47f455[_0x7949('0x2f')]=_[_0x7949('0x2d')](_0x20c852['model'],qs[_0x7949('0x2e')](_0x166670['query'][_0x7949('0x2e')]));_0x47f455[_0x7949('0x2f')]=_0x47f455[_0x7949('0x2f')][_0x7949('0x30')]?_0x47f455['attributes']:_0x20c852[_0x7949('0x2c')];_0x47f455[_0x7949('0x4a')]=qs[_0x7949('0x34')](_0x166670[_0x7949('0x2a')][_0x7949('0x34')]);_0x47f455[_0x7949('0x35')]=qs['filters'](_['pick'](_0x166670['query'],_0x20c852['filters']));if(_0x166670[_0x7949('0x2a')][_0x7949('0x37')]){_0x47f455[_0x7949('0x35')]=_[_0x7949('0x38')](_0x47f455['where'],{'$or':_['map'](_0x47f455[_0x7949('0x2f')],function(_0x340cf8){var _0x2387fe={};_0x2387fe[_0x340cf8]={'$like':'%'+_0x166670[_0x7949('0x2a')][_0x7949('0x37')]+'%'};return _0x2387fe;})});}_0x47f455=_[_0x7949('0x38')]({},_0x47f455,_0x166670['options']);return _0x46d1ef['getFields'](_0x47f455);}})['then'](function(_0x1e1eef){if(_0x1e1eef){_0xc0fe15=_0x1e1eef[_0x7949('0x30')];if(!_0x166670['query']['hasOwnProperty'](_0x7949('0x32'))){_0x47f455[_0x7949('0x33')]=qs[_0x7949('0x33')](_0x166670[_0x7949('0x2a')][_0x7949('0x33')]);_0x47f455[_0x7949('0x19')]=qs[_0x7949('0x19')](_0x166670[_0x7949('0x2a')][_0x7949('0x19')]);}return _0x46d1ef['getFields'](_0x47f455);}})['then'](function(_0x2cc73d){if(_0x2cc73d){return _0x2cc73d?{'count':_0xc0fe15,'rows':_0x2cc73d}:null;}})[_0x7949('0x21')](respondWithResult(_0x4cd5e0,null))[_0x7949('0x40')](handleError(_0x4cd5e0,null));};exports[_0x7949('0x4b')]=function(_0x3daa16,_0x4e7da3,_0x21a3bd){var _0x494746={};var _0x3a1ecf={};var _0x3f591d;var _0x2fc106;return db[_0x7949('0x3c')][_0x7949('0x4c')]({'where':{'id':_0x3daa16['params']['id']}})['then'](handleEntityNotFound(_0x4e7da3,null))[_0x7949('0x21')](function(_0x49ea68){if(_0x49ea68){_0x3f591d=_0x49ea68;_0x3a1ecf[_0x7949('0x2c')]=_[_0x7949('0x42')](db[_0x7949('0x49')][_0x7949('0x43')]);_0x3a1ecf[_0x7949('0x2a')]=_[_0x7949('0x42')](_0x3daa16[_0x7949('0x2a')]);_0x3a1ecf[_0x7949('0x2b')]=_[_0x7949('0x2d')](_0x3a1ecf[_0x7949('0x2c')],_0x3a1ecf[_0x7949('0x2a')]);_0x494746[_0x7949('0x2f')]=_[_0x7949('0x2d')](_0x3a1ecf['model'],qs[_0x7949('0x2e')](_0x3daa16[_0x7949('0x2a')][_0x7949('0x2e')]));_0x494746['attributes']=_0x494746[_0x7949('0x2f')][_0x7949('0x30')]?_0x494746[_0x7949('0x2f')]:_0x3a1ecf[_0x7949('0x2c')];_0x494746['order']=qs[_0x7949('0x34')](_0x3daa16[_0x7949('0x2a')]['sort']);_0x494746['where']=qs[_0x7949('0x2b')](_[_0x7949('0x36')](_0x3daa16[_0x7949('0x2a')],_0x3a1ecf['filters']));if(_0x3daa16[_0x7949('0x2a')][_0x7949('0x37')]){_0x494746[_0x7949('0x35')]=_[_0x7949('0x38')](_0x494746['where'],{'$or':_[_0x7949('0x27')](_0x494746[_0x7949('0x2f')],function(_0x147519){var _0x464239={};_0x464239[_0x147519]={'$like':'%'+_0x3daa16['query'][_0x7949('0x37')]+'%'};return _0x464239;})});}_0x494746=_[_0x7949('0x38')]({},_0x494746,_0x3daa16[_0x7949('0x3b')]);return _0x3f591d[_0x7949('0x4b')](_0x494746);}})[_0x7949('0x21')](function(_0x413e45){if(_0x413e45){_0x2fc106=_0x413e45[_0x7949('0x30')];if(!_0x3daa16[_0x7949('0x2a')][_0x7949('0x31')](_0x7949('0x32'))){_0x494746[_0x7949('0x33')]=qs[_0x7949('0x33')](_0x3daa16[_0x7949('0x2a')]['limit']);_0x494746[_0x7949('0x19')]=qs[_0x7949('0x19')](_0x3daa16[_0x7949('0x2a')][_0x7949('0x19')]);}return _0x3f591d['getSubjects'](_0x494746);}})[_0x7949('0x21')](function(_0x40e0f3){if(_0x40e0f3){return _0x40e0f3?{'count':_0x2fc106,'rows':_0x40e0f3}:null;}})[_0x7949('0x21')](respondWithResult(_0x4e7da3,null))[_0x7949('0x40')](handleError(_0x4e7da3,null));};exports[_0x7949('0x4d')]=function(_0x12ec6b,_0xec1edf,_0x3dd29e){var _0x3dfbbd={};var _0x4401ae={};var _0x3d5dd3;var _0x2d188e;return db['SugarcrmConfiguration'][_0x7949('0x4c')]({'where':{'id':_0x12ec6b[_0x7949('0x47')]['id']}})['then'](handleEntityNotFound(_0xec1edf,null))[_0x7949('0x21')](function(_0x5a4e6c){if(_0x5a4e6c){_0x3d5dd3=_0x5a4e6c;_0x4401ae[_0x7949('0x2c')]=_[_0x7949('0x42')](db[_0x7949('0x49')][_0x7949('0x43')]);_0x4401ae[_0x7949('0x2a')]=_[_0x7949('0x42')](_0x12ec6b[_0x7949('0x2a')]);_0x4401ae['filters']=_[_0x7949('0x2d')](_0x4401ae[_0x7949('0x2c')],_0x4401ae['query']);_0x3dfbbd[_0x7949('0x2f')]=_[_0x7949('0x2d')](_0x4401ae['model'],qs[_0x7949('0x2e')](_0x12ec6b[_0x7949('0x2a')][_0x7949('0x2e')]));_0x3dfbbd['attributes']=_0x3dfbbd[_0x7949('0x2f')][_0x7949('0x30')]?_0x3dfbbd[_0x7949('0x2f')]:_0x4401ae[_0x7949('0x2c')];_0x3dfbbd[_0x7949('0x4a')]=qs[_0x7949('0x34')](_0x12ec6b['query'][_0x7949('0x34')]);_0x3dfbbd[_0x7949('0x35')]=qs['filters'](_[_0x7949('0x36')](_0x12ec6b[_0x7949('0x2a')],_0x4401ae[_0x7949('0x2b')]));if(_0x12ec6b['query'][_0x7949('0x37')]){_0x3dfbbd['where']=_[_0x7949('0x38')](_0x3dfbbd[_0x7949('0x35')],{'$or':_[_0x7949('0x27')](_0x3dfbbd['attributes'],function(_0x51ded0){var _0x7d5caa={};_0x7d5caa[_0x51ded0]={'$like':'%'+_0x12ec6b[_0x7949('0x2a')][_0x7949('0x37')]+'%'};return _0x7d5caa;})});}_0x3dfbbd=_[_0x7949('0x38')]({},_0x3dfbbd,_0x12ec6b[_0x7949('0x3b')]);return _0x3d5dd3[_0x7949('0x4d')](_0x3dfbbd);}})[_0x7949('0x21')](function(_0x4dfbb0){if(_0x4dfbb0){_0x2d188e=_0x4dfbb0['length'];if(!_0x12ec6b[_0x7949('0x2a')]['hasOwnProperty'](_0x7949('0x32'))){_0x3dfbbd[_0x7949('0x33')]=qs[_0x7949('0x33')](_0x12ec6b[_0x7949('0x2a')][_0x7949('0x33')]);_0x3dfbbd['offset']=qs[_0x7949('0x19')](_0x12ec6b[_0x7949('0x2a')]['offset']);}return _0x3d5dd3[_0x7949('0x4d')](_0x3dfbbd);}})[_0x7949('0x21')](function(_0x28d350){if(_0x28d350){return _0x28d350?{'count':_0x2d188e,'rows':_0x28d350}:null;}})['then'](respondWithResult(_0xec1edf,null))['catch'](handleError(_0xec1edf,null));}; \ No newline at end of file +var _0xde21=['catch','show','params','rawAttributes','create','body','find','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','rows'];(function(_0x4bc299,_0x3db319){var _0x477dfa=function(_0x3ce6ed){while(--_0x3ce6ed){_0x4bc299['push'](_0x4bc299['shift']());}};_0x477dfa(++_0x3db319);}(_0xde21,0x183));var _0x1de2=function(_0x264621,_0x570ab8){_0x264621=_0x264621-0x0;var _0x145adb=_0xde21[_0x264621];return _0x145adb;};'use strict';var emlformat=require(_0x1de2('0x0'));var rimraf=require(_0x1de2('0x1'));var zipdir=require(_0x1de2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1de2('0x3'));var moment=require('moment');var BPromise=require(_0x1de2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1de2('0x5'));var sox=require('sox');var csv=require(_0x1de2('0x6'));var ejs=require(_0x1de2('0x7'));var fs=require('fs');var fs_extra=require(_0x1de2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1de2('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1de2('0xa'));var Papa=require(_0x1de2('0xb'));var Redis=require(_0x1de2('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1de2('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1de2('0xe'))(_0x1de2('0xf'));var utils=require(_0x1de2('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x1de2('0x11'));var db=require(_0x1de2('0x12'))['db'];function respondWithStatusCode(_0x6d486e,_0x367cba){_0x367cba=_0x367cba||0xcc;return function(_0x27afa4){if(_0x27afa4){return _0x6d486e[_0x1de2('0x13')](_0x367cba);}return _0x6d486e[_0x1de2('0x14')](_0x367cba)['end']();};}function respondWithResult(_0x3cbbe0,_0x38d094){_0x38d094=_0x38d094||0xc8;return function(_0x262117){if(_0x262117){return _0x3cbbe0[_0x1de2('0x14')](_0x38d094)[_0x1de2('0x15')](_0x262117);}};}function respondWithFilteredResult(_0x313105,_0x318adb){return function(_0x502f29){if(_0x502f29){var _0x109cb7=typeof _0x318adb[_0x1de2('0x16')]===_0x1de2('0x17')&&typeof _0x318adb[_0x1de2('0x18')]===_0x1de2('0x17');var _0xafb433=_0x502f29[_0x1de2('0x19')];var _0xb23bd=_0x109cb7?0x0:_0x318adb[_0x1de2('0x16')];var _0x513f7c=_0x109cb7?_0x502f29['count']:_0x318adb['offset']+_0x318adb[_0x1de2('0x18')];var _0x1799ef;if(_0x513f7c>=_0xafb433){_0x513f7c=_0xafb433;_0x1799ef=0xc8;}else{_0x1799ef=0xce;}_0x313105[_0x1de2('0x14')](_0x1799ef);return _0x313105[_0x1de2('0x1a')](_0x1de2('0x1b'),_0xb23bd+'-'+_0x513f7c+'/'+_0xafb433)['json'](_0x502f29);}return null;};}function patchUpdates(_0x489872){return function(_0x2b87fa){try{jsonpatch[_0x1de2('0x1c')](_0x2b87fa,_0x489872,!![]);}catch(_0x33cfb2){return BPromise[_0x1de2('0x1d')](_0x33cfb2);}return _0x2b87fa['save']();};}function saveUpdates(_0x38e729,_0x460e1d){return function(_0x165847){if(_0x165847){return _0x165847[_0x1de2('0x1e')](_0x38e729)[_0x1de2('0x1f')](function(_0xf5f250){return _0xf5f250;});}return null;};}function removeEntity(_0x1fc595,_0x3b843a){return function(_0x14f3cc){if(_0x14f3cc){return _0x14f3cc[_0x1de2('0x20')]()[_0x1de2('0x1f')](function(){_0x1fc595[_0x1de2('0x14')](0xcc)[_0x1de2('0x21')]();});}};}function handleEntityNotFound(_0x4d62f6,_0x54628f){return function(_0x4cfa99){if(!_0x4cfa99){_0x4d62f6[_0x1de2('0x13')](0x194);}return _0x4cfa99;};}function handleError(_0x5a69f9,_0x25ee99){_0x25ee99=_0x25ee99||0x1f4;return function(_0x194129){logger[_0x1de2('0x22')](_0x194129[_0x1de2('0x23')]);if(_0x194129[_0x1de2('0x24')]){delete _0x194129[_0x1de2('0x24')];}_0x5a69f9[_0x1de2('0x14')](_0x25ee99)[_0x1de2('0x25')](_0x194129);};}exports[_0x1de2('0x26')]=function(_0x4e0c97,_0xb004f1){var _0x4d4914={},_0x24970c={},_0x46b810={'count':0x0,'rows':[]};var _0x32734e=_[_0x1de2('0x27')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x3cf7a9){return{'name':_0x3cf7a9[_0x1de2('0x28')],'type':_0x3cf7a9['type']['key']};});_0x24970c[_0x1de2('0x29')]=_[_0x1de2('0x27')](_0x32734e,_0x1de2('0x24'));_0x24970c['query']=_[_0x1de2('0x2a')](_0x4e0c97[_0x1de2('0x2b')]);_0x24970c[_0x1de2('0x2c')]=_[_0x1de2('0x2d')](_0x24970c[_0x1de2('0x29')],_0x24970c[_0x1de2('0x2b')]);_0x4d4914[_0x1de2('0x2e')]=_[_0x1de2('0x2d')](_0x24970c[_0x1de2('0x29')],qs[_0x1de2('0x2f')](_0x4e0c97[_0x1de2('0x2b')]['fields']));_0x4d4914[_0x1de2('0x2e')]=_0x4d4914[_0x1de2('0x2e')][_0x1de2('0x30')]?_0x4d4914['attributes']:_0x24970c['model'];if(!_0x4e0c97['query'][_0x1de2('0x31')](_0x1de2('0x32'))){_0x4d4914[_0x1de2('0x18')]=qs[_0x1de2('0x18')](_0x4e0c97[_0x1de2('0x2b')][_0x1de2('0x18')]);_0x4d4914[_0x1de2('0x16')]=qs[_0x1de2('0x16')](_0x4e0c97[_0x1de2('0x2b')][_0x1de2('0x16')]);}_0x4d4914[_0x1de2('0x33')]=qs[_0x1de2('0x34')](_0x4e0c97['query'][_0x1de2('0x34')]);_0x4d4914[_0x1de2('0x35')]=qs[_0x1de2('0x2c')](_[_0x1de2('0x36')](_0x4e0c97[_0x1de2('0x2b')],_0x24970c[_0x1de2('0x2c')]),_0x32734e);if(_0x4e0c97['query'][_0x1de2('0x37')]){_0x4d4914[_0x1de2('0x35')]=_[_0x1de2('0x38')](_0x4d4914['where'],{'$or':_[_0x1de2('0x27')](_0x32734e,function(_0x19b2ac){if(_0x19b2ac['type']!==_0x1de2('0x39')){var _0x5bd015={};_0x5bd015[_0x19b2ac[_0x1de2('0x24')]]={'$like':'%'+_0x4e0c97[_0x1de2('0x2b')][_0x1de2('0x37')]+'%'};return _0x5bd015;}})});}_0x4d4914=_[_0x1de2('0x38')]({},_0x4d4914,_0x4e0c97[_0x1de2('0x3a')]);var _0x27dcc1={'where':_0x4d4914[_0x1de2('0x35')]};return db[_0x1de2('0x3b')][_0x1de2('0x19')](_0x27dcc1)[_0x1de2('0x1f')](function(_0x1411a8){_0x46b810[_0x1de2('0x19')]=_0x1411a8;if(_0x4e0c97['query'][_0x1de2('0x3c')]){_0x4d4914[_0x1de2('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x4d4914);})[_0x1de2('0x1f')](function(_0x51533f){_0x46b810[_0x1de2('0x3e')]=_0x51533f;return _0x46b810;})[_0x1de2('0x1f')](respondWithFilteredResult(_0xb004f1,_0x4d4914))[_0x1de2('0x3f')](handleError(_0xb004f1,null));};exports[_0x1de2('0x40')]=function(_0xfa0ad3,_0x56c500){var _0x2862b4={'raw':![],'where':{'id':_0xfa0ad3[_0x1de2('0x41')]['id']}},_0x2ce28a={};_0x2ce28a[_0x1de2('0x29')]=_[_0x1de2('0x2a')](db[_0x1de2('0x3b')][_0x1de2('0x42')]);_0x2ce28a['query']=_[_0x1de2('0x2a')](_0xfa0ad3['query']);_0x2ce28a[_0x1de2('0x2c')]=_[_0x1de2('0x2d')](_0x2ce28a['model'],_0x2ce28a[_0x1de2('0x2b')]);_0x2862b4['attributes']=_[_0x1de2('0x2d')](_0x2ce28a['model'],qs[_0x1de2('0x2f')](_0xfa0ad3[_0x1de2('0x2b')]['fields']));_0x2862b4['attributes']=_0x2862b4['attributes'][_0x1de2('0x30')]?_0x2862b4[_0x1de2('0x2e')]:_0x2ce28a[_0x1de2('0x29')];if(_0xfa0ad3[_0x1de2('0x2b')]['includeAll']){_0x2862b4[_0x1de2('0x3d')]=[{'all':!![]}];}_0x2862b4=_[_0x1de2('0x38')]({},_0x2862b4,_0xfa0ad3[_0x1de2('0x3a')]);return db[_0x1de2('0x3b')]['find'](_0x2862b4)[_0x1de2('0x1f')](handleEntityNotFound(_0x56c500,null))[_0x1de2('0x1f')](respondWithResult(_0x56c500,null))[_0x1de2('0x3f')](handleError(_0x56c500,null));};exports[_0x1de2('0x43')]=function(_0x1b65c2,_0x411c06){return db['SugarcrmConfiguration']['create'](_0x1b65c2['body'],{})[_0x1de2('0x1f')](respondWithResult(_0x411c06,0xc9))[_0x1de2('0x3f')](handleError(_0x411c06,null));};exports[_0x1de2('0x1e')]=function(_0x567d90,_0x482b98){if(_0x567d90[_0x1de2('0x44')]['id']){delete _0x567d90[_0x1de2('0x44')]['id'];}return db[_0x1de2('0x3b')][_0x1de2('0x45')]({'where':{'id':_0x567d90[_0x1de2('0x41')]['id']}})[_0x1de2('0x1f')](handleEntityNotFound(_0x482b98,null))[_0x1de2('0x1f')](saveUpdates(_0x567d90[_0x1de2('0x44')],null))[_0x1de2('0x1f')](respondWithResult(_0x482b98,null))['catch'](handleError(_0x482b98,null));};exports[_0x1de2('0x20')]=function(_0x5133c3,_0x8da8f0){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5133c3[_0x1de2('0x41')]['id']}})[_0x1de2('0x1f')](handleEntityNotFound(_0x8da8f0,null))[_0x1de2('0x1f')](removeEntity(_0x8da8f0,null))[_0x1de2('0x3f')](handleError(_0x8da8f0,null));};exports['getFields']=function(_0x2e5649,_0xb9ba3d,_0x20c458){var _0x809919={};var _0x3e392c={};var _0x237f2f;var _0x5f5d3e;return db['SugarcrmConfiguration'][_0x1de2('0x46')]({'where':{'id':_0x2e5649[_0x1de2('0x41')]['id']}})[_0x1de2('0x1f')](handleEntityNotFound(_0xb9ba3d,null))['then'](function(_0x511f6c){if(_0x511f6c){_0x237f2f=_0x511f6c;_0x3e392c[_0x1de2('0x29')]=_[_0x1de2('0x2a')](db[_0x1de2('0x47')][_0x1de2('0x42')]);_0x3e392c[_0x1de2('0x2b')]=_[_0x1de2('0x2a')](_0x2e5649['query']);_0x3e392c['filters']=_[_0x1de2('0x2d')](_0x3e392c[_0x1de2('0x29')],_0x3e392c[_0x1de2('0x2b')]);_0x809919[_0x1de2('0x2e')]=_[_0x1de2('0x2d')](_0x3e392c[_0x1de2('0x29')],qs[_0x1de2('0x2f')](_0x2e5649['query'][_0x1de2('0x2f')]));_0x809919[_0x1de2('0x2e')]=_0x809919[_0x1de2('0x2e')][_0x1de2('0x30')]?_0x809919[_0x1de2('0x2e')]:_0x3e392c['model'];_0x809919[_0x1de2('0x33')]=qs[_0x1de2('0x34')](_0x2e5649[_0x1de2('0x2b')][_0x1de2('0x34')]);_0x809919[_0x1de2('0x35')]=qs[_0x1de2('0x2c')](_[_0x1de2('0x36')](_0x2e5649[_0x1de2('0x2b')],_0x3e392c['filters']));if(_0x2e5649[_0x1de2('0x2b')][_0x1de2('0x37')]){_0x809919['where']=_['merge'](_0x809919['where'],{'$or':_[_0x1de2('0x27')](_0x809919[_0x1de2('0x2e')],function(_0x1be6d3){var _0x1d118a={};_0x1d118a[_0x1be6d3]={'$like':'%'+_0x2e5649[_0x1de2('0x2b')]['filter']+'%'};return _0x1d118a;})});}_0x809919=_[_0x1de2('0x38')]({},_0x809919,_0x2e5649[_0x1de2('0x3a')]);return _0x237f2f[_0x1de2('0x48')](_0x809919);}})[_0x1de2('0x1f')](function(_0x38a833){if(_0x38a833){_0x5f5d3e=_0x38a833['length'];if(!_0x2e5649[_0x1de2('0x2b')][_0x1de2('0x31')](_0x1de2('0x32'))){_0x809919[_0x1de2('0x18')]=qs[_0x1de2('0x18')](_0x2e5649[_0x1de2('0x2b')][_0x1de2('0x18')]);_0x809919[_0x1de2('0x16')]=qs[_0x1de2('0x16')](_0x2e5649[_0x1de2('0x2b')][_0x1de2('0x16')]);}return _0x237f2f[_0x1de2('0x48')](_0x809919);}})['then'](function(_0x451917){if(_0x451917){return _0x451917?{'count':_0x5f5d3e,'rows':_0x451917}:null;}})[_0x1de2('0x1f')](respondWithResult(_0xb9ba3d,null))[_0x1de2('0x3f')](handleError(_0xb9ba3d,null));};exports[_0x1de2('0x49')]=function(_0x3bdf8b,_0x42de1a,_0x2a88f5){var _0x12d706={};var _0x45cdb3={};var _0xc037b7;var _0x530439;return db[_0x1de2('0x3b')][_0x1de2('0x46')]({'where':{'id':_0x3bdf8b['params']['id']}})[_0x1de2('0x1f')](handleEntityNotFound(_0x42de1a,null))[_0x1de2('0x1f')](function(_0x50bb52){if(_0x50bb52){_0xc037b7=_0x50bb52;_0x45cdb3[_0x1de2('0x29')]=_['keys'](db[_0x1de2('0x47')][_0x1de2('0x42')]);_0x45cdb3[_0x1de2('0x2b')]=_['keys'](_0x3bdf8b[_0x1de2('0x2b')]);_0x45cdb3[_0x1de2('0x2c')]=_['intersection'](_0x45cdb3['model'],_0x45cdb3['query']);_0x12d706[_0x1de2('0x2e')]=_[_0x1de2('0x2d')](_0x45cdb3[_0x1de2('0x29')],qs[_0x1de2('0x2f')](_0x3bdf8b[_0x1de2('0x2b')][_0x1de2('0x2f')]));_0x12d706[_0x1de2('0x2e')]=_0x12d706[_0x1de2('0x2e')][_0x1de2('0x30')]?_0x12d706[_0x1de2('0x2e')]:_0x45cdb3[_0x1de2('0x29')];_0x12d706['order']=qs[_0x1de2('0x34')](_0x3bdf8b[_0x1de2('0x2b')]['sort']);_0x12d706['where']=qs[_0x1de2('0x2c')](_[_0x1de2('0x36')](_0x3bdf8b[_0x1de2('0x2b')],_0x45cdb3[_0x1de2('0x2c')]));if(_0x3bdf8b[_0x1de2('0x2b')][_0x1de2('0x37')]){_0x12d706[_0x1de2('0x35')]=_[_0x1de2('0x38')](_0x12d706[_0x1de2('0x35')],{'$or':_[_0x1de2('0x27')](_0x12d706['attributes'],function(_0x511d0d){var _0xdd8d5f={};_0xdd8d5f[_0x511d0d]={'$like':'%'+_0x3bdf8b[_0x1de2('0x2b')][_0x1de2('0x37')]+'%'};return _0xdd8d5f;})});}_0x12d706=_['merge']({},_0x12d706,_0x3bdf8b[_0x1de2('0x3a')]);return _0xc037b7[_0x1de2('0x49')](_0x12d706);}})[_0x1de2('0x1f')](function(_0x7bf222){if(_0x7bf222){_0x530439=_0x7bf222[_0x1de2('0x30')];if(!_0x3bdf8b[_0x1de2('0x2b')]['hasOwnProperty'](_0x1de2('0x32'))){_0x12d706[_0x1de2('0x18')]=qs[_0x1de2('0x18')](_0x3bdf8b[_0x1de2('0x2b')][_0x1de2('0x18')]);_0x12d706[_0x1de2('0x16')]=qs['offset'](_0x3bdf8b[_0x1de2('0x2b')][_0x1de2('0x16')]);}return _0xc037b7['getSubjects'](_0x12d706);}})[_0x1de2('0x1f')](function(_0x89ae97){if(_0x89ae97){return _0x89ae97?{'count':_0x530439,'rows':_0x89ae97}:null;}})[_0x1de2('0x1f')](respondWithResult(_0x42de1a,null))[_0x1de2('0x3f')](handleError(_0x42de1a,null));};exports[_0x1de2('0x4a')]=function(_0x4676f3,_0x37485c,_0x1dc543){var _0x54922a={};var _0x531aed={};var _0x569970;var _0x5c5c3e;return db[_0x1de2('0x3b')][_0x1de2('0x46')]({'where':{'id':_0x4676f3[_0x1de2('0x41')]['id']}})[_0x1de2('0x1f')](handleEntityNotFound(_0x37485c,null))[_0x1de2('0x1f')](function(_0x4a635e){if(_0x4a635e){_0x569970=_0x4a635e;_0x531aed[_0x1de2('0x29')]=_[_0x1de2('0x2a')](db[_0x1de2('0x47')]['rawAttributes']);_0x531aed['query']=_[_0x1de2('0x2a')](_0x4676f3[_0x1de2('0x2b')]);_0x531aed[_0x1de2('0x2c')]=_['intersection'](_0x531aed[_0x1de2('0x29')],_0x531aed[_0x1de2('0x2b')]);_0x54922a[_0x1de2('0x2e')]=_[_0x1de2('0x2d')](_0x531aed[_0x1de2('0x29')],qs['fields'](_0x4676f3['query'][_0x1de2('0x2f')]));_0x54922a[_0x1de2('0x2e')]=_0x54922a['attributes']['length']?_0x54922a['attributes']:_0x531aed[_0x1de2('0x29')];_0x54922a[_0x1de2('0x33')]=qs['sort'](_0x4676f3[_0x1de2('0x2b')][_0x1de2('0x34')]);_0x54922a[_0x1de2('0x35')]=qs[_0x1de2('0x2c')](_[_0x1de2('0x36')](_0x4676f3['query'],_0x531aed['filters']));if(_0x4676f3[_0x1de2('0x2b')][_0x1de2('0x37')]){_0x54922a[_0x1de2('0x35')]=_[_0x1de2('0x38')](_0x54922a['where'],{'$or':_[_0x1de2('0x27')](_0x54922a['attributes'],function(_0xf0eb1e){var _0x567d89={};_0x567d89[_0xf0eb1e]={'$like':'%'+_0x4676f3['query'][_0x1de2('0x37')]+'%'};return _0x567d89;})});}_0x54922a=_['merge']({},_0x54922a,_0x4676f3[_0x1de2('0x3a')]);return _0x569970['getDescriptions'](_0x54922a);}})[_0x1de2('0x1f')](function(_0x4525de){if(_0x4525de){_0x5c5c3e=_0x4525de[_0x1de2('0x30')];if(!_0x4676f3['query'][_0x1de2('0x31')](_0x1de2('0x32'))){_0x54922a[_0x1de2('0x18')]=qs[_0x1de2('0x18')](_0x4676f3[_0x1de2('0x2b')][_0x1de2('0x18')]);_0x54922a[_0x1de2('0x16')]=qs[_0x1de2('0x16')](_0x4676f3['query']['offset']);}return _0x569970[_0x1de2('0x4a')](_0x54922a);}})[_0x1de2('0x1f')](function(_0x9b3e02){if(_0x9b3e02){return _0x9b3e02?{'count':_0x5c5c3e,'rows':_0x9b3e02}:null;}})[_0x1de2('0x1f')](respondWithResult(_0x37485c,null))[_0x1de2('0x3f')](handleError(_0x37485c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index bab1f67..6c6960e 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 _0x9fc9=['../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5c2aec,_0x28b371){var _0x12a6ef=function(_0x199a25){while(--_0x199a25){_0x5c2aec['push'](_0x5c2aec['shift']());}};_0x12a6ef(++_0x28b371);}(_0x9fc9,0x95));var _0x99fc=function(_0x3ddc51,_0x27523f){_0x3ddc51=_0x3ddc51-0x0;var _0x20953c=_0x9fc9[_0x3ddc51];return _0x20953c;};'use strict';var _=require(_0x99fc('0x0'));var util=require(_0x99fc('0x1'));var logger=require(_0x99fc('0x2'))(_0x99fc('0x3'));var moment=require('moment');var BPromise=require(_0x99fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99fc('0x5'));var rimraf=require(_0x99fc('0x6'));var config=require(_0x99fc('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x99fc('0x8')]=function(_0xc21eae,_0x435ff7){return _0xc21eae[_0x99fc('0x9')](_0x99fc('0xa'),attributes,{'tableName':_0x99fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2b5=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2ca4a3,_0x3e8080){var _0x303b7f=function(_0x16d45b){while(--_0x16d45b){_0x2ca4a3['push'](_0x2ca4a3['shift']());}};_0x303b7f(++_0x3e8080);}(_0xe2b5,0x1a5));var _0x5e2b=function(_0x448a7e,_0x25d4b1){_0x448a7e=_0x448a7e-0x0;var _0x460433=_0xe2b5[_0x448a7e];return _0x460433;};'use strict';var _=require(_0x5e2b('0x0'));var util=require(_0x5e2b('0x1'));var logger=require(_0x5e2b('0x2'))(_0x5e2b('0x3'));var moment=require('moment');var BPromise=require(_0x5e2b('0x4'));var rp=require(_0x5e2b('0x5'));var fs=require('fs');var path=require(_0x5e2b('0x6'));var rimraf=require(_0x5e2b('0x7'));var config=require(_0x5e2b('0x8'));var attributes=require(_0x5e2b('0x9'));module[_0x5e2b('0xa')]=function(_0x4f1264,_0x4dd597){return _0x4f1264['define'](_0x5e2b('0xb'),attributes,{'tableName':_0x5e2b('0xc'),'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 ebc9533..e355782 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 _0x4edf=['SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x35c19b,_0x7a7bb2){var _0x335340=function(_0x5c5f61){while(--_0x5c5f61){_0x35c19b['push'](_0x35c19b['shift']());}};_0x335340(++_0x7a7bb2);}(_0x4edf,0x1d1));var _0xf4ed=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x4edf[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var moment=require(_0xf4ed('0x2'));var BPromise=require(_0xf4ed('0x3'));var rs=require(_0xf4ed('0x4'));var fs=require('fs');var Redis=require(_0xf4ed('0x5'));var db=require(_0xf4ed('0x6'))['db'];var utils=require(_0xf4ed('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf4ed('0x8'));var jayson=require(_0xf4ed('0x9'));var client=jayson['client'][_0xf4ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48cf18,_0x58ba8b,_0x4c3af1){return new BPromise(function(_0x2a4301,_0x369609){return client[_0xf4ed('0xb')](_0x48cf18,_0x4c3af1)[_0xf4ed('0xc')](function(_0x3636a8){logger[_0xf4ed('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58ba8b,_0xf4ed('0xe'));logger[_0xf4ed('0xf')](_0xf4ed('0x10'),_0x58ba8b,'request\x20sent',JSON['stringify'](_0x3636a8));if(_0x3636a8[_0xf4ed('0x11')]){if(_0x3636a8[_0xf4ed('0x11')][_0xf4ed('0x12')]===0x1f4){logger['error'](_0xf4ed('0x13'),_0x58ba8b,_0x3636a8['error'][_0xf4ed('0x14')]);return _0x369609(_0x3636a8['error'][_0xf4ed('0x14')]);}logger[_0xf4ed('0x11')](_0xf4ed('0x13'),_0x58ba8b,_0x3636a8[_0xf4ed('0x11')][_0xf4ed('0x14')]);return _0x2a4301(_0x3636a8[_0xf4ed('0x11')][_0xf4ed('0x14')]);}else{logger[_0xf4ed('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x58ba8b,_0xf4ed('0xe'));_0x2a4301(_0x3636a8[_0xf4ed('0x15')][_0xf4ed('0x14')]);}})['catch'](function(_0x41e323){logger[_0xf4ed('0x11')](_0xf4ed('0x13'),_0x58ba8b,_0x41e323);_0x369609(_0x41e323);});});} \ No newline at end of file +var _0x69c8=['result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x115176,_0x285042){var _0x2a2653=function(_0x454956){while(--_0x454956){_0x115176['push'](_0x115176['shift']());}};_0x2a2653(++_0x285042);}(_0x69c8,0x6a));var _0x869c=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x69c8[_0x568a61];return _0x334c3b;};'use strict';var _=require('lodash');var util=require(_0x869c('0x0'));var moment=require(_0x869c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x869c('0x2'));var db=require(_0x869c('0x3'))['db'];var utils=require(_0x869c('0x4'));var logger=require(_0x869c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x869c('0x6'));var client=jayson[_0x869c('0x7')][_0x869c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57b651,_0x3ff4e5,_0x2fa30d){return new BPromise(function(_0x2fcb64,_0x745d2){return client[_0x869c('0x9')](_0x57b651,_0x2fa30d)[_0x869c('0xa')](function(_0x4c23e7){logger[_0x869c('0xb')](_0x869c('0xc'),_0x3ff4e5,_0x869c('0xd'));logger[_0x869c('0xe')](_0x869c('0xf'),_0x3ff4e5,_0x869c('0xd'),JSON[_0x869c('0x10')](_0x4c23e7));if(_0x4c23e7[_0x869c('0x11')]){if(_0x4c23e7[_0x869c('0x11')][_0x869c('0x12')]===0x1f4){logger[_0x869c('0x11')](_0x869c('0xc'),_0x3ff4e5,_0x4c23e7[_0x869c('0x11')][_0x869c('0x13')]);return _0x745d2(_0x4c23e7['error'][_0x869c('0x13')]);}logger[_0x869c('0x11')](_0x869c('0xc'),_0x3ff4e5,_0x4c23e7[_0x869c('0x11')]['message']);return _0x2fcb64(_0x4c23e7[_0x869c('0x11')][_0x869c('0x13')]);}else{logger[_0x869c('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3ff4e5,'request\x20sent');_0x2fcb64(_0x4c23e7[_0x869c('0x14')][_0x869c('0x13')]);}})['catch'](function(_0x43fb33){logger[_0x869c('0x11')](_0x869c('0xc'),_0x3ff4e5,_0x43fb33);_0x745d2(_0x43fb33);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 8266d4a..5eb3379 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 _0x69a8=['Router','fs-extra','./intSugarcrmField.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','exports','multer','express'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x69a8,0x11f));var _0x869a=function(_0x25f747,_0x549699){_0x25f747=_0x25f747-0x0;var _0x212551=_0x69a8[_0x25f747];return _0x212551;};'use strict';var multer=require(_0x869a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x869a('0x1'));var router=express[_0x869a('0x2')]();var fs_extra=require(_0x869a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x869a('0x4'));router['get']('/',auth[_0x869a('0x5')](),controller[_0x869a('0x6')]);router[_0x869a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x869a('0x8')]);router[_0x869a('0x9')]('/',auth['isAuthenticated'](),controller[_0x869a('0xa')]);router[_0x869a('0xb')]('/:id',auth[_0x869a('0x5')](),controller[_0x869a('0xc')]);router[_0x869a('0xd')](_0x869a('0xe'),auth[_0x869a('0x5')](),controller[_0x869a('0xf')]);module[_0x869a('0x10')]=router; \ No newline at end of file +var _0x21af=['create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post'];(function(_0x14efc5,_0xab816b){var _0x55a29d=function(_0x2a225d){while(--_0x2a225d){_0x14efc5['push'](_0x14efc5['shift']());}};_0x55a29d(++_0xab816b);}(_0x21af,0x116));var _0xf21a=function(_0x3b0a27,_0x30467e){_0x3b0a27=_0x3b0a27-0x0;var _0x5b92b2=_0x21af[_0x3b0a27];return _0x5b92b2;};'use strict';var multer=require(_0xf21a('0x0'));var util=require(_0xf21a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf21a('0x2')]();var fs_extra=require(_0xf21a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf21a('0x4'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xf21a('0x5')]('/',auth['isAuthenticated'](),controller[_0xf21a('0x6')]);router[_0xf21a('0x5')](_0xf21a('0x7'),auth[_0xf21a('0x8')](),controller[_0xf21a('0x9')]);router[_0xf21a('0xa')]('/',auth['isAuthenticated'](),controller[_0xf21a('0xb')]);router[_0xf21a('0xc')](_0xf21a('0x7'),auth['isAuthenticated'](),controller[_0xf21a('0xd')]);router[_0xf21a('0xe')](_0xf21a('0x7'),auth[_0xf21a('0x8')](),controller[_0xf21a('0xf')]);module[_0xf21a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6539eb3..72e991d 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 _0x5699=['string','customVariable','keyValue','picklist','STRING','variable','exports','ENUM'];(function(_0x4fa0c7,_0x4a9abc){var _0x27234c=function(_0x530409){while(--_0x530409){_0x4fa0c7['push'](_0x4fa0c7['shift']());}};_0x27234c(++_0x4a9abc);}(_0x5699,0x1de));var _0x9569=function(_0x20b191,_0x5ef6b3){_0x20b191=_0x20b191-0x0;var _0x5a3f54=_0x5699[_0x20b191];return _0x5a3f54;};'use strict';var Sequelize=require('sequelize');module[_0x9569('0x0')]={'type':{'type':Sequelize[_0x9569('0x1')](_0x9569('0x2'),'variable',_0x9569('0x3'),_0x9569('0x4'),_0x9569('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9569('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9569('0x1')]('string',_0x9569('0x7'),_0x9569('0x3'))},'keyContent':{'type':Sequelize[_0x9569('0x6')]},'idField':{'type':Sequelize[_0x9569('0x6')]},'nameField':{'type':Sequelize[_0x9569('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9569('0x6')]}}; \ No newline at end of file +var _0x792d=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0x404fde,_0x3b1af2){var _0x296d3a=function(_0x2ca644){while(--_0x2ca644){_0x404fde['push'](_0x404fde['shift']());}};_0x296d3a(++_0x3b1af2);}(_0x792d,0x1c5));var _0xd792=function(_0x571a42,_0x2481e7){_0x571a42=_0x571a42-0x0;var _0x46c31b=_0x792d[_0x571a42];return _0x46c31b;};'use strict';var Sequelize=require(_0xd792('0x0'));module[_0xd792('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd792('0x2'),_0xd792('0x3'),_0xd792('0x4'),_0xd792('0x5'),'picklist'),'defaultValue':_0xd792('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd792('0x6')]},'keyType':{'type':Sequelize[_0xd792('0x7')](_0xd792('0x2'),_0xd792('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd792('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd792('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd792('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0b502c4..e388171 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 _0x31ae=['params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','send','map','SugarcrmField','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','catch','show','rawAttributes','intersection','includeAll','find','create','body'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x31ae,0x1c3));var _0xe31a=function(_0x35cf09,_0x5e86eb){_0x35cf09=_0x35cf09-0x0;var _0x3063f8=_0x31ae[_0x35cf09];return _0x3063f8;};'use strict';var emlformat=require(_0xe31a('0x0'));var rimraf=require(_0xe31a('0x1'));var zipdir=require(_0xe31a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe31a('0x3'));var moment=require('moment');var BPromise=require(_0xe31a('0x4'));var Mustache=require(_0xe31a('0x5'));var util=require(_0xe31a('0x6'));var path=require(_0xe31a('0x7'));var sox=require(_0xe31a('0x8'));var csv=require('to-csv');var ejs=require(_0xe31a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe31a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe31a('0xb'));var deskjs=require(_0xe31a('0xc'));var toCsv=require(_0xe31a('0xd'));var querystring=require('querystring');var Papa=require(_0xe31a('0xe'));var Redis=require(_0xe31a('0xf'));var authService=require(_0xe31a('0x10'));var qs=require(_0xe31a('0x11'));var as=require(_0xe31a('0x12'));var hardwareService=require(_0xe31a('0x13'));var logger=require(_0xe31a('0x14'))(_0xe31a('0x15'));var utils=require(_0xe31a('0x16'));var config=require(_0xe31a('0x17'));var licenseUtil=require(_0xe31a('0x18'));var db=require(_0xe31a('0x19'))['db'];function respondWithStatusCode(_0x36c597,_0x5c3c7a){_0x5c3c7a=_0x5c3c7a||0xcc;return function(_0x4c4c8){if(_0x4c4c8){return _0x36c597['sendStatus'](_0x5c3c7a);}return _0x36c597['status'](_0x5c3c7a)['end']();};}function respondWithResult(_0x14e867,_0xcdc9fa){_0xcdc9fa=_0xcdc9fa||0xc8;return function(_0x52ee0f){if(_0x52ee0f){return _0x14e867[_0xe31a('0x1a')](_0xcdc9fa)[_0xe31a('0x1b')](_0x52ee0f);}};}function respondWithFilteredResult(_0x128166,_0x222bbf){return function(_0x4cb3e1){if(_0x4cb3e1){var _0x4a8ac4=typeof _0x222bbf[_0xe31a('0x1c')]===_0xe31a('0x1d')&&typeof _0x222bbf['limit']==='undefined';var _0x21fbd4=_0x4cb3e1['count'];var _0x6e4330=_0x4a8ac4?0x0:_0x222bbf[_0xe31a('0x1c')];var _0x27484d=_0x4a8ac4?_0x4cb3e1[_0xe31a('0x1e')]:_0x222bbf['offset']+_0x222bbf[_0xe31a('0x1f')];var _0x5dff63;if(_0x27484d>=_0x21fbd4){_0x27484d=_0x21fbd4;_0x5dff63=0xc8;}else{_0x5dff63=0xce;}_0x128166[_0xe31a('0x1a')](_0x5dff63);return _0x128166[_0xe31a('0x20')]('Content-Range',_0x6e4330+'-'+_0x27484d+'/'+_0x21fbd4)[_0xe31a('0x1b')](_0x4cb3e1);}return null;};}function patchUpdates(_0x3ed182){return function(_0x41abb0){try{jsonpatch[_0xe31a('0x21')](_0x41abb0,_0x3ed182,!![]);}catch(_0x5ac110){return BPromise[_0xe31a('0x22')](_0x5ac110);}return _0x41abb0['save']();};}function saveUpdates(_0x58fef8,_0xd0c7f3){return function(_0xc1c9eb){if(_0xc1c9eb){return _0xc1c9eb[_0xe31a('0x23')](_0x58fef8)['then'](function(_0x130902){return _0x130902;});}return null;};}function removeEntity(_0x3fb037,_0x19bdba){return function(_0x3103f9){if(_0x3103f9){return _0x3103f9[_0xe31a('0x24')]()[_0xe31a('0x25')](function(){_0x3fb037['status'](0xcc)[_0xe31a('0x26')]();});}};}function handleEntityNotFound(_0x3bd7d4,_0x1eb69b){return function(_0x4a7ecc){if(!_0x4a7ecc){_0x3bd7d4[_0xe31a('0x27')](0x194);}return _0x4a7ecc;};}function handleError(_0x3abb91,_0x1e1a92){_0x1e1a92=_0x1e1a92||0x1f4;return function(_0x2965fe){logger[_0xe31a('0x28')](_0x2965fe[_0xe31a('0x29')]);if(_0x2965fe[_0xe31a('0x2a')]){delete _0x2965fe[_0xe31a('0x2a')];}_0x3abb91[_0xe31a('0x1a')](_0x1e1a92)[_0xe31a('0x2b')](_0x2965fe);};}exports['index']=function(_0x1012c4,_0x1228c2){var _0x2be414={},_0x11be1f={},_0x23f446={'count':0x0,'rows':[]};var _0x2be08e=_[_0xe31a('0x2c')](db[_0xe31a('0x2d')]['rawAttributes'],function(_0xbddf74){return{'name':_0xbddf74['fieldName'],'type':_0xbddf74[_0xe31a('0x2e')][_0xe31a('0x2f')]};});_0x11be1f['model']=_['map'](_0x2be08e,_0xe31a('0x2a'));_0x11be1f[_0xe31a('0x30')]=_[_0xe31a('0x31')](_0x1012c4[_0xe31a('0x30')]);_0x11be1f['filters']=_['intersection'](_0x11be1f[_0xe31a('0x32')],_0x11be1f['query']);_0x2be414[_0xe31a('0x33')]=_['intersection'](_0x11be1f[_0xe31a('0x32')],qs['fields'](_0x1012c4[_0xe31a('0x30')][_0xe31a('0x34')]));_0x2be414[_0xe31a('0x33')]=_0x2be414[_0xe31a('0x33')][_0xe31a('0x35')]?_0x2be414[_0xe31a('0x33')]:_0x11be1f[_0xe31a('0x32')];if(!_0x1012c4[_0xe31a('0x30')][_0xe31a('0x36')](_0xe31a('0x37'))){_0x2be414[_0xe31a('0x1f')]=qs[_0xe31a('0x1f')](_0x1012c4[_0xe31a('0x30')][_0xe31a('0x1f')]);_0x2be414[_0xe31a('0x1c')]=qs[_0xe31a('0x1c')](_0x1012c4[_0xe31a('0x30')][_0xe31a('0x1c')]);}_0x2be414[_0xe31a('0x38')]=qs[_0xe31a('0x39')](_0x1012c4[_0xe31a('0x30')]['sort']);_0x2be414['where']=qs[_0xe31a('0x3a')](_[_0xe31a('0x3b')](_0x1012c4['query'],_0x11be1f['filters']),_0x2be08e);if(_0x1012c4[_0xe31a('0x30')][_0xe31a('0x3c')]){_0x2be414[_0xe31a('0x3d')]=_[_0xe31a('0x3e')](_0x2be414[_0xe31a('0x3d')],{'$or':_['map'](_0x2be08e,function(_0x5a18e0){if(_0x5a18e0[_0xe31a('0x2e')]!==_0xe31a('0x3f')){var _0x20aa70={};_0x20aa70[_0x5a18e0[_0xe31a('0x2a')]]={'$like':'%'+_0x1012c4[_0xe31a('0x30')][_0xe31a('0x3c')]+'%'};return _0x20aa70;}})});}_0x2be414=_[_0xe31a('0x3e')]({},_0x2be414,_0x1012c4[_0xe31a('0x40')]);var _0x1cd09c={'where':_0x2be414[_0xe31a('0x3d')]};return db[_0xe31a('0x2d')][_0xe31a('0x1e')](_0x1cd09c)[_0xe31a('0x25')](function(_0x138403){_0x23f446[_0xe31a('0x1e')]=_0x138403;if(_0x1012c4[_0xe31a('0x30')]['includeAll']){_0x2be414[_0xe31a('0x41')]=[{'all':!![]}];}return db[_0xe31a('0x2d')]['findAll'](_0x2be414);})[_0xe31a('0x25')](function(_0x13fedb){_0x23f446['rows']=_0x13fedb;return _0x23f446;})[_0xe31a('0x25')](respondWithFilteredResult(_0x1228c2,_0x2be414))[_0xe31a('0x42')](handleError(_0x1228c2,null));};exports[_0xe31a('0x43')]=function(_0x3648c0,_0x1b966e){var _0x39369e={'raw':!![],'where':{'id':_0x3648c0['params']['id']}},_0x1488c3={};_0x1488c3[_0xe31a('0x32')]=_[_0xe31a('0x31')](db[_0xe31a('0x2d')][_0xe31a('0x44')]);_0x1488c3[_0xe31a('0x30')]=_[_0xe31a('0x31')](_0x3648c0['query']);_0x1488c3[_0xe31a('0x3a')]=_['intersection'](_0x1488c3[_0xe31a('0x32')],_0x1488c3[_0xe31a('0x30')]);_0x39369e[_0xe31a('0x33')]=_[_0xe31a('0x45')](_0x1488c3[_0xe31a('0x32')],qs[_0xe31a('0x34')](_0x3648c0[_0xe31a('0x30')][_0xe31a('0x34')]));_0x39369e[_0xe31a('0x33')]=_0x39369e[_0xe31a('0x33')][_0xe31a('0x35')]?_0x39369e[_0xe31a('0x33')]:_0x1488c3[_0xe31a('0x32')];if(_0x3648c0[_0xe31a('0x30')][_0xe31a('0x46')]){_0x39369e[_0xe31a('0x41')]=[{'all':!![]}];}_0x39369e=_[_0xe31a('0x3e')]({},_0x39369e,_0x3648c0[_0xe31a('0x40')]);return db[_0xe31a('0x2d')][_0xe31a('0x47')](_0x39369e)['then'](handleEntityNotFound(_0x1b966e,null))[_0xe31a('0x25')](respondWithResult(_0x1b966e,null))[_0xe31a('0x42')](handleError(_0x1b966e,null));};exports[_0xe31a('0x48')]=function(_0x518cf5,_0x4960da){return db[_0xe31a('0x2d')][_0xe31a('0x48')](_0x518cf5[_0xe31a('0x49')],{})['then'](respondWithResult(_0x4960da,0xc9))[_0xe31a('0x42')](handleError(_0x4960da,null));};exports[_0xe31a('0x23')]=function(_0x2e8706,_0x2fd15b){if(_0x2e8706[_0xe31a('0x49')]['id']){delete _0x2e8706['body']['id'];}return db[_0xe31a('0x2d')][_0xe31a('0x47')]({'where':{'id':_0x2e8706[_0xe31a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2fd15b,null))[_0xe31a('0x25')](saveUpdates(_0x2e8706[_0xe31a('0x49')],null))[_0xe31a('0x25')](respondWithResult(_0x2fd15b,null))[_0xe31a('0x42')](handleError(_0x2fd15b,null));};exports['destroy']=function(_0x141f56,_0x422904){return db[_0xe31a('0x2d')][_0xe31a('0x47')]({'where':{'id':_0x141f56['params']['id']}})[_0xe31a('0x25')](handleEntityNotFound(_0x422904,null))['then'](removeEntity(_0x422904,null))[_0xe31a('0x42')](handleError(_0x422904,null));}; \ No newline at end of file +var _0x5b74=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','filters','length','find','create','body','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../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','reject','save','update','then','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x5b74,0xa6));var _0x45b7=function(_0x56b963,_0x52279f){_0x56b963=_0x56b963-0x0;var _0x144fe4=_0x5b74[_0x56b963];return _0x144fe4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b7('0x0'));var zipdir=require(_0x45b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45b7('0x2'));var moment=require(_0x45b7('0x3'));var BPromise=require(_0x45b7('0x4'));var Mustache=require(_0x45b7('0x5'));var util=require(_0x45b7('0x6'));var path=require(_0x45b7('0x7'));var sox=require(_0x45b7('0x8'));var csv=require(_0x45b7('0x9'));var ejs=require(_0x45b7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45b7('0xb'));var squel=require(_0x45b7('0xc'));var crypto=require(_0x45b7('0xd'));var jsforce=require(_0x45b7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x45b7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x45b7('0x10'));var as=require(_0x45b7('0x11'));var hardwareService=require(_0x45b7('0x12'));var logger=require(_0x45b7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x45b7('0x14'));var licenseUtil=require(_0x45b7('0x15'));var db=require(_0x45b7('0x16'))['db'];function respondWithStatusCode(_0x2fd417,_0x3be13a){_0x3be13a=_0x3be13a||0xcc;return function(_0x10a1e8){if(_0x10a1e8){return _0x2fd417['sendStatus'](_0x3be13a);}return _0x2fd417[_0x45b7('0x17')](_0x3be13a)[_0x45b7('0x18')]();};}function respondWithResult(_0x4bf194,_0x3c0bc6){_0x3c0bc6=_0x3c0bc6||0xc8;return function(_0x57d234){if(_0x57d234){return _0x4bf194['status'](_0x3c0bc6)[_0x45b7('0x19')](_0x57d234);}};}function respondWithFilteredResult(_0x5e40c3,_0x1017c2){return function(_0x5f5353){if(_0x5f5353){var _0x3f5e48=typeof _0x1017c2[_0x45b7('0x1a')]===_0x45b7('0x1b')&&typeof _0x1017c2[_0x45b7('0x1c')]===_0x45b7('0x1b');var _0x19532e=_0x5f5353['count'];var _0xd6a4bf=_0x3f5e48?0x0:_0x1017c2[_0x45b7('0x1a')];var _0x489e01=_0x3f5e48?_0x5f5353[_0x45b7('0x1d')]:_0x1017c2[_0x45b7('0x1a')]+_0x1017c2[_0x45b7('0x1c')];var _0x509359;if(_0x489e01>=_0x19532e){_0x489e01=_0x19532e;_0x509359=0xc8;}else{_0x509359=0xce;}_0x5e40c3['status'](_0x509359);return _0x5e40c3[_0x45b7('0x1e')](_0x45b7('0x1f'),_0xd6a4bf+'-'+_0x489e01+'/'+_0x19532e)['json'](_0x5f5353);}return null;};}function patchUpdates(_0x2a8746){return function(_0x2016e8){try{jsonpatch[_0x45b7('0x20')](_0x2016e8,_0x2a8746,!![]);}catch(_0x52d895){return BPromise[_0x45b7('0x21')](_0x52d895);}return _0x2016e8[_0x45b7('0x22')]();};}function saveUpdates(_0x32e3a4,_0x34b3b3){return function(_0x456e4f){if(_0x456e4f){return _0x456e4f[_0x45b7('0x23')](_0x32e3a4)[_0x45b7('0x24')](function(_0x40e869){return _0x40e869;});}return null;};}function removeEntity(_0x4269fd,_0x282cd8){return function(_0x469305){if(_0x469305){return _0x469305['destroy']()[_0x45b7('0x24')](function(){_0x4269fd[_0x45b7('0x17')](0xcc)[_0x45b7('0x18')]();});}};}function handleEntityNotFound(_0x18efa3,_0x32590e){return function(_0x5a03f9){if(!_0x5a03f9){_0x18efa3['sendStatus'](0x194);}return _0x5a03f9;};}function handleError(_0x2f5f1f,_0x12001a){_0x12001a=_0x12001a||0x1f4;return function(_0x261d78){logger[_0x45b7('0x25')](_0x261d78['stack']);if(_0x261d78[_0x45b7('0x26')]){delete _0x261d78['name'];}_0x2f5f1f['status'](_0x12001a)[_0x45b7('0x27')](_0x261d78);};}exports[_0x45b7('0x28')]=function(_0x568ccd,_0x3e4113){var _0x2745f2={},_0x39e2d8={},_0x2f82dd={'count':0x0,'rows':[]};var _0x3d2215=_[_0x45b7('0x29')](db[_0x45b7('0x2a')][_0x45b7('0x2b')],function(_0xc81417){return{'name':_0xc81417[_0x45b7('0x2c')],'type':_0xc81417[_0x45b7('0x2d')][_0x45b7('0x2e')]};});_0x39e2d8[_0x45b7('0x2f')]=_[_0x45b7('0x29')](_0x3d2215,_0x45b7('0x26'));_0x39e2d8[_0x45b7('0x30')]=_[_0x45b7('0x31')](_0x568ccd[_0x45b7('0x30')]);_0x39e2d8['filters']=_[_0x45b7('0x32')](_0x39e2d8['model'],_0x39e2d8[_0x45b7('0x30')]);_0x2745f2[_0x45b7('0x33')]=_[_0x45b7('0x32')](_0x39e2d8[_0x45b7('0x2f')],qs[_0x45b7('0x34')](_0x568ccd[_0x45b7('0x30')][_0x45b7('0x34')]));_0x2745f2[_0x45b7('0x33')]=_0x2745f2[_0x45b7('0x33')]['length']?_0x2745f2['attributes']:_0x39e2d8[_0x45b7('0x2f')];if(!_0x568ccd[_0x45b7('0x30')][_0x45b7('0x35')]('nolimit')){_0x2745f2[_0x45b7('0x1c')]=qs[_0x45b7('0x1c')](_0x568ccd[_0x45b7('0x30')]['limit']);_0x2745f2['offset']=qs['offset'](_0x568ccd[_0x45b7('0x30')][_0x45b7('0x1a')]);}_0x2745f2[_0x45b7('0x36')]=qs['sort'](_0x568ccd[_0x45b7('0x30')][_0x45b7('0x37')]);_0x2745f2[_0x45b7('0x38')]=qs['filters'](_[_0x45b7('0x39')](_0x568ccd[_0x45b7('0x30')],_0x39e2d8['filters']),_0x3d2215);if(_0x568ccd[_0x45b7('0x30')][_0x45b7('0x3a')]){_0x2745f2['where']=_['merge'](_0x2745f2[_0x45b7('0x38')],{'$or':_[_0x45b7('0x29')](_0x3d2215,function(_0x1853a3){if(_0x1853a3[_0x45b7('0x2d')]!==_0x45b7('0x3b')){var _0x1b9ec9={};_0x1b9ec9[_0x1853a3[_0x45b7('0x26')]]={'$like':'%'+_0x568ccd[_0x45b7('0x30')][_0x45b7('0x3a')]+'%'};return _0x1b9ec9;}})});}_0x2745f2=_[_0x45b7('0x3c')]({},_0x2745f2,_0x568ccd[_0x45b7('0x3d')]);var _0x8ce7ec={'where':_0x2745f2[_0x45b7('0x38')]};return db[_0x45b7('0x2a')][_0x45b7('0x1d')](_0x8ce7ec)[_0x45b7('0x24')](function(_0x2a7f21){_0x2f82dd[_0x45b7('0x1d')]=_0x2a7f21;if(_0x568ccd[_0x45b7('0x30')][_0x45b7('0x3e')]){_0x2745f2[_0x45b7('0x3f')]=[{'all':!![]}];}return db[_0x45b7('0x2a')][_0x45b7('0x40')](_0x2745f2);})[_0x45b7('0x24')](function(_0x4c31bf){_0x2f82dd[_0x45b7('0x41')]=_0x4c31bf;return _0x2f82dd;})['then'](respondWithFilteredResult(_0x3e4113,_0x2745f2))[_0x45b7('0x42')](handleError(_0x3e4113,null));};exports['show']=function(_0x19f05c,_0x490042){var _0x5266d3={'raw':!![],'where':{'id':_0x19f05c[_0x45b7('0x43')]['id']}},_0x19980b={};_0x19980b['model']=_[_0x45b7('0x31')](db['SugarcrmField']['rawAttributes']);_0x19980b[_0x45b7('0x30')]=_['keys'](_0x19f05c['query']);_0x19980b[_0x45b7('0x44')]=_[_0x45b7('0x32')](_0x19980b[_0x45b7('0x2f')],_0x19980b[_0x45b7('0x30')]);_0x5266d3[_0x45b7('0x33')]=_[_0x45b7('0x32')](_0x19980b[_0x45b7('0x2f')],qs[_0x45b7('0x34')](_0x19f05c[_0x45b7('0x30')][_0x45b7('0x34')]));_0x5266d3[_0x45b7('0x33')]=_0x5266d3[_0x45b7('0x33')][_0x45b7('0x45')]?_0x5266d3[_0x45b7('0x33')]:_0x19980b[_0x45b7('0x2f')];if(_0x19f05c[_0x45b7('0x30')][_0x45b7('0x3e')]){_0x5266d3['include']=[{'all':!![]}];}_0x5266d3=_[_0x45b7('0x3c')]({},_0x5266d3,_0x19f05c[_0x45b7('0x3d')]);return db[_0x45b7('0x2a')][_0x45b7('0x46')](_0x5266d3)[_0x45b7('0x24')](handleEntityNotFound(_0x490042,null))['then'](respondWithResult(_0x490042,null))[_0x45b7('0x42')](handleError(_0x490042,null));};exports[_0x45b7('0x47')]=function(_0x4fc833,_0x43e4b6){return db['SugarcrmField']['create'](_0x4fc833['body'],{})[_0x45b7('0x24')](respondWithResult(_0x43e4b6,0xc9))[_0x45b7('0x42')](handleError(_0x43e4b6,null));};exports[_0x45b7('0x23')]=function(_0x2386b1,_0x54e85d){if(_0x2386b1[_0x45b7('0x48')]['id']){delete _0x2386b1[_0x45b7('0x48')]['id'];}return db[_0x45b7('0x2a')][_0x45b7('0x46')]({'where':{'id':_0x2386b1[_0x45b7('0x43')]['id']}})[_0x45b7('0x24')](handleEntityNotFound(_0x54e85d,null))[_0x45b7('0x24')](saveUpdates(_0x2386b1[_0x45b7('0x48')],null))['then'](respondWithResult(_0x54e85d,null))[_0x45b7('0x42')](handleError(_0x54e85d,null));};exports[_0x45b7('0x49')]=function(_0xebc60a,_0x2809aa){return db['SugarcrmField'][_0x45b7('0x46')]({'where':{'id':_0xebc60a[_0x45b7('0x43')]['id']}})[_0x45b7('0x24')](handleEntityNotFound(_0x2809aa,null))[_0x45b7('0x24')](removeEntity(_0x2809aa,null))[_0x45b7('0x42')](handleError(_0x2809aa,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 92a50d1..4828fca 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 _0x5939=['int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmField'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x5939,0x121));var _0x9593=function(_0x1d6550,_0x3d38b7){_0x1d6550=_0x1d6550-0x0;var _0x1f75cd=_0x5939[_0x1d6550];return _0x1f75cd;};'use strict';var _=require('lodash');var util=require(_0x9593('0x0'));var logger=require(_0x9593('0x1'))(_0x9593('0x2'));var moment=require('moment');var BPromise=require(_0x9593('0x3'));var rp=require(_0x9593('0x4'));var fs=require('fs');var path=require(_0x9593('0x5'));var rimraf=require(_0x9593('0x6'));var config=require(_0x9593('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x9593('0x8')]=function(_0x4eee49,_0x2b8ca5){return _0x4eee49['define'](_0x9593('0x9'),attributes,{'tableName':_0x9593('0xa'),'paranoid':![],'indexes':[{'name':_0x9593('0xb'),'fields':['idField',_0x9593('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xceee=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','../../config/logger','api','moment'];(function(_0x17598a,_0x4025ec){var _0x102a6e=function(_0x4bbf49){while(--_0x4bbf49){_0x17598a['push'](_0x17598a['shift']());}};_0x102a6e(++_0x4025ec);}(_0xceee,0x1af));var _0xecee=function(_0x1b92bb,_0x2a8a62){_0x1b92bb=_0x1b92bb-0x0;var _0x283607=_0xceee[_0x1b92bb];return _0x283607;};'use strict';var _=require(_0xecee('0x0'));var util=require('util');var logger=require(_0xecee('0x1'))(_0xecee('0x2'));var moment=require(_0xecee('0x3'));var BPromise=require(_0xecee('0x4'));var rp=require(_0xecee('0x5'));var fs=require('fs');var path=require(_0xecee('0x6'));var rimraf=require(_0xecee('0x7'));var config=require(_0xecee('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xecee('0x9')]=function(_0x985ece,_0xd530dc){return _0x985ece[_0xecee('0xa')](_0xecee('0xb'),attributes,{'tableName':_0xecee('0xc'),'paranoid':![],'indexes':[{'name':_0xecee('0xd'),'fields':[_0xecee('0xe'),'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 af2dd2f..baa533e 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 _0xd805=['error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x27e299,_0x4d8a2b){var _0x1d8c25=function(_0x5c9ef8){while(--_0x5c9ef8){_0x27e299['push'](_0x27e299['shift']());}};_0x1d8c25(++_0x4d8a2b);}(_0xd805,0xc1));var _0x5d80=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xd805[_0x587ba2];return _0x50ec73;};'use strict';var _=require(_0x5d80('0x0'));var util=require(_0x5d80('0x1'));var moment=require(_0x5d80('0x2'));var BPromise=require(_0x5d80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d80('0x4'));var db=require(_0x5d80('0x5'))['db'];var utils=require(_0x5d80('0x6'));var logger=require(_0x5d80('0x7'))('rpc');var config=require(_0x5d80('0x8'));var jayson=require(_0x5d80('0x9'));var client=jayson[_0x5d80('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d602a,_0x54f0f8,_0x2e8937){return new BPromise(function(_0x421504,_0x5c9707){return client['request'](_0x1d602a,_0x2e8937)[_0x5d80('0xb')](function(_0x3d8018){logger[_0x5d80('0xc')](_0x5d80('0xd'),_0x54f0f8,_0x5d80('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x54f0f8,_0x5d80('0xe'),JSON[_0x5d80('0xf')](_0x3d8018));if(_0x3d8018[_0x5d80('0x10')]){if(_0x3d8018[_0x5d80('0x10')]['code']===0x1f4){logger[_0x5d80('0x10')](_0x5d80('0xd'),_0x54f0f8,_0x3d8018['error']['message']);return _0x5c9707(_0x3d8018[_0x5d80('0x10')]['message']);}logger[_0x5d80('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x54f0f8,_0x3d8018[_0x5d80('0x10')][_0x5d80('0x11')]);return _0x421504(_0x3d8018[_0x5d80('0x10')][_0x5d80('0x11')]);}else{logger['info'](_0x5d80('0xd'),_0x54f0f8,_0x5d80('0xe'));_0x421504(_0x3d8018[_0x5d80('0x12')][_0x5d80('0x11')]);}})['catch'](function(_0x656719){logger[_0x5d80('0x10')](_0x5d80('0xd'),_0x54f0f8,_0x656719);_0x5c9707(_0x656719);});});} \ No newline at end of file +var _0xe53d=['stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0xb17208,_0x16f568){var _0x160444=function(_0x20e377){while(--_0x20e377){_0xb17208['push'](_0xb17208['shift']());}};_0x160444(++_0x16f568);}(_0xe53d,0xc4));var _0xde53=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xe53d[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0xde53('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde53('0x1'));var rs=require(_0xde53('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde53('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde53('0x4'));var config=require(_0xde53('0x5'));var jayson=require(_0xde53('0x6'));var client=jayson[_0xde53('0x7')][_0xde53('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x549143,_0x30bc86,_0x3b1122){return new BPromise(function(_0x3b9114,_0x5d6b12){return client[_0xde53('0x9')](_0x549143,_0x3b1122)[_0xde53('0xa')](function(_0x3f9765){logger[_0xde53('0xb')](_0xde53('0xc'),_0x30bc86,'request\x20sent');logger['debug'](_0xde53('0xd'),_0x30bc86,'request\x20sent',JSON[_0xde53('0xe')](_0x3f9765));if(_0x3f9765[_0xde53('0xf')]){if(_0x3f9765[_0xde53('0xf')][_0xde53('0x10')]===0x1f4){logger[_0xde53('0xf')](_0xde53('0xc'),_0x30bc86,_0x3f9765['error'][_0xde53('0x11')]);return _0x5d6b12(_0x3f9765['error'][_0xde53('0x11')]);}logger[_0xde53('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x30bc86,_0x3f9765[_0xde53('0xf')][_0xde53('0x11')]);return _0x3b9114(_0x3f9765['error'][_0xde53('0x11')]);}else{logger[_0xde53('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x30bc86,_0xde53('0x12'));_0x3b9114(_0x3f9765[_0xde53('0x13')]['message']);}})[_0xde53('0x14')](function(_0x1ac976){logger[_0xde53('0xf')](_0xde53('0xc'),_0x30bc86,_0x1ac976);_0x5d6b12(_0x1ac976);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e8aca44..07fd549 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 _0xcf84=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xcf84,0x175));var _0x4cf8=function(_0x447338,_0x31ddb3){_0x447338=_0x447338-0x0;var _0x5e4ffd=_0xcf84[_0x447338];return _0x5e4ffd;};'use strict';var multer=require(_0x4cf8('0x0'));var util=require(_0x4cf8('0x1'));var path=require(_0x4cf8('0x2'));var timeout=require(_0x4cf8('0x3'));var express=require(_0x4cf8('0x4'));var router=express[_0x4cf8('0x5')]();var fs_extra=require(_0x4cf8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4cf8('0x7'));var config=require('../../config/environment');var controller=require(_0x4cf8('0x8'));router[_0x4cf8('0x9')]('/',auth[_0x4cf8('0xa')](),controller['index']);router['get'](_0x4cf8('0xb'),auth[_0x4cf8('0xa')](),controller['show']);router[_0x4cf8('0x9')](_0x4cf8('0xc'),auth[_0x4cf8('0xa')](),controller[_0x4cf8('0xd')]);router[_0x4cf8('0x9')](_0x4cf8('0xe'),auth[_0x4cf8('0xa')](),controller[_0x4cf8('0xf')]);router[_0x4cf8('0x10')]('/',auth['isAuthenticated'](),controller[_0x4cf8('0x11')]);router[_0x4cf8('0x10')](_0x4cf8('0xc'),auth[_0x4cf8('0xa')](),controller[_0x4cf8('0x12')]);router[_0x4cf8('0x13')](_0x4cf8('0xb'),auth[_0x4cf8('0xa')](),controller[_0x4cf8('0x14')]);router[_0x4cf8('0x15')](_0x4cf8('0xb'),auth['isAuthenticated'](),controller[_0x4cf8('0x16')]);module[_0x4cf8('0x17')]=router; \ No newline at end of file +var _0x90c7=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','create','post','addConfiguration','put','delete'];(function(_0x26880f,_0x130975){var _0x8c72e6=function(_0x2cbb04){while(--_0x2cbb04){_0x26880f['push'](_0x26880f['shift']());}};_0x8c72e6(++_0x130975);}(_0x90c7,0x9c));var _0x790c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x90c7[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x790c('0x0'));var util=require(_0x790c('0x1'));var path=require(_0x790c('0x2'));var timeout=require(_0x790c('0x3'));var express=require(_0x790c('0x4'));var router=express[_0x790c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x790c('0x6'));var interaction=require(_0x790c('0x7'));var config=require('../../config/environment');var controller=require(_0x790c('0x8'));router[_0x790c('0x9')]('/',auth[_0x790c('0xa')](),controller['index']);router[_0x790c('0x9')](_0x790c('0xb'),auth[_0x790c('0xa')](),controller[_0x790c('0xc')]);router[_0x790c('0x9')](_0x790c('0xd'),auth[_0x790c('0xa')](),controller['getConfigurations']);router[_0x790c('0x9')](_0x790c('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x790c('0xa')](),controller[_0x790c('0xf')]);router[_0x790c('0x10')](_0x790c('0xd'),auth[_0x790c('0xa')](),controller[_0x790c('0x11')]);router[_0x790c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x790c('0x13')](_0x790c('0xb'),auth[_0x790c('0xa')](),controller[_0x790c('0x14')]);module[_0x790c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4e12d49..940c773 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 _0xae01=['sequelize','exports','STRING'];(function(_0x23bca9,_0x590fef){var _0x5eb135=function(_0x5e2e39){while(--_0x5e2e39){_0x23bca9['push'](_0x23bca9['shift']());}};_0x5eb135(++_0x590fef);}(_0xae01,0x1bc));var _0x1ae0=function(_0x38a66f,_0x2f4b6c){_0x38a66f=_0x38a66f-0x0;var _0x59b25a=_0xae01[_0x38a66f];return _0x59b25a;};'use strict';var Sequelize=require(_0x1ae0('0x0'));module[_0x1ae0('0x1')]={'name':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe0a9=['STRING','HelpDesk','exports'];(function(_0x47031c,_0x17a16f){var _0x543442=function(_0xc2c740){while(--_0xc2c740){_0x47031c['push'](_0x47031c['shift']());}};_0x543442(++_0x17a16f);}(_0xe0a9,0x1dc));var _0x9e0a=function(_0x4d0dcd,_0x272070){_0x4d0dcd=_0x4d0dcd-0x0;var _0x2f1e20=_0xe0a9[_0x4d0dcd];return _0x2f1e20;};'use strict';var Sequelize=require('sequelize');module[_0x9e0a('0x0')]={'name':{'type':Sequelize[_0x9e0a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9e0a('0x1')]},'username':{'type':Sequelize[_0x9e0a('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9e0a('0x1')],'allowNull':![],'defaultValue':_0x9e0a('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9e0a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9e0a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4ed215a..67f2c40 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 _0xfec7=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','update','then','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','merge','options','find','create','body','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','getchallenge','success','result','describe','sessionName','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x117d7f,_0x59b132){var _0x3481cc=function(_0x231315){while(--_0x231315){_0x117d7f['push'](_0x117d7f['shift']());}};_0x3481cc(++_0x59b132);}(_0xfec7,0x1b0));var _0x7fec=function(_0x2da2a7,_0x4ce051){_0x2da2a7=_0x2da2a7-0x0;var _0x336366=_0xfec7[_0x2da2a7];return _0x336366;};'use strict';var emlformat=require(_0x7fec('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(_0x7fec('0x1'));var Mustache=require(_0x7fec('0x2'));var util=require(_0x7fec('0x3'));var path=require(_0x7fec('0x4'));var sox=require('sox');var csv=require(_0x7fec('0x5'));var ejs=require(_0x7fec('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fec('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7fec('0x8'));var deskjs=require(_0x7fec('0x9'));var toCsv=require(_0x7fec('0x5'));var querystring=require(_0x7fec('0xa'));var Papa=require(_0x7fec('0xb'));var Redis=require(_0x7fec('0xc'));var authService=require(_0x7fec('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fec('0xe'));var logger=require(_0x7fec('0xf'))('api');var utils=require(_0x7fec('0x10'));var config=require(_0x7fec('0x11'));var licenseUtil=require(_0x7fec('0x12'));var db=require(_0x7fec('0x13'))['db'];var integrations=require(_0x7fec('0x14'));function respondWithStatusCode(_0x14714c,_0x160538){_0x160538=_0x160538||0xcc;return function(_0x137925){if(_0x137925){return _0x14714c[_0x7fec('0x15')](_0x160538);}return _0x14714c[_0x7fec('0x16')](_0x160538)[_0x7fec('0x17')]();};}function respondWithResult(_0x464615,_0x36fbc6){_0x36fbc6=_0x36fbc6||0xc8;return function(_0x1aeebc){if(_0x1aeebc){return _0x464615[_0x7fec('0x16')](_0x36fbc6)[_0x7fec('0x18')](_0x1aeebc);}};}function respondWithFilteredResult(_0x133472,_0x47e4dd){return function(_0x4bcde7){if(_0x4bcde7){var _0x468a49=typeof _0x47e4dd[_0x7fec('0x19')]==='undefined'&&typeof _0x47e4dd['limit']==='undefined';var _0x5743d7=_0x4bcde7['count'];var _0x4719c6=_0x468a49?0x0:_0x47e4dd[_0x7fec('0x19')];var _0x31fd2e=_0x468a49?_0x4bcde7[_0x7fec('0x1a')]:_0x47e4dd[_0x7fec('0x19')]+_0x47e4dd[_0x7fec('0x1b')];var _0x1b1ac6;if(_0x31fd2e>=_0x5743d7){_0x31fd2e=_0x5743d7;_0x1b1ac6=0xc8;}else{_0x1b1ac6=0xce;}_0x133472[_0x7fec('0x16')](_0x1b1ac6);return _0x133472['set'](_0x7fec('0x1c'),_0x4719c6+'-'+_0x31fd2e+'/'+_0x5743d7)['json'](_0x4bcde7);}return null;};}function patchUpdates(_0x5910e6){return function(_0x56a169){try{jsonpatch[_0x7fec('0x1d')](_0x56a169,_0x5910e6,!![]);}catch(_0x401a8a){return BPromise[_0x7fec('0x1e')](_0x401a8a);}return _0x56a169['save']();};}function saveUpdates(_0x497949,_0xb1fc1c){return function(_0x4a2440){if(_0x4a2440){return _0x4a2440[_0x7fec('0x1f')](_0x497949)[_0x7fec('0x20')](function(_0x308974){return _0x308974;});}return null;};}function removeEntity(_0x310cf6,_0xff98f4){return function(_0x3a24c2){if(_0x3a24c2){return _0x3a24c2['destroy']()[_0x7fec('0x20')](function(){_0x310cf6[_0x7fec('0x16')](0xcc)[_0x7fec('0x17')]();});}};}function handleEntityNotFound(_0x40b0cd,_0x5f3183){return function(_0x13b575){if(!_0x13b575){_0x40b0cd[_0x7fec('0x15')](0x194);}return _0x13b575;};}function handleError(_0x4673c7,_0xbcd6d9){_0xbcd6d9=_0xbcd6d9||0x1f4;return function(_0x48a22c){logger['error'](_0x48a22c['stack']);if(_0x48a22c[_0x7fec('0x21')]){delete _0x48a22c['name'];}_0x4673c7['status'](_0xbcd6d9)[_0x7fec('0x22')](_0x48a22c);};}exports['index']=function(_0x2e4b4d,_0x28e77e){var _0x3690bf={},_0x336490={},_0x1800d8={'count':0x0,'rows':[]};var _0x2dfab5=_[_0x7fec('0x23')](db[_0x7fec('0x24')][_0x7fec('0x25')],function(_0x3b4793){return{'name':_0x3b4793[_0x7fec('0x26')],'type':_0x3b4793['type'][_0x7fec('0x27')]};});_0x336490[_0x7fec('0x28')]=_[_0x7fec('0x23')](_0x2dfab5,_0x7fec('0x21'));_0x336490[_0x7fec('0x29')]=_[_0x7fec('0x2a')](_0x2e4b4d['query']);_0x336490[_0x7fec('0x2b')]=_[_0x7fec('0x2c')](_0x336490[_0x7fec('0x28')],_0x336490[_0x7fec('0x29')]);_0x3690bf[_0x7fec('0x2d')]=_[_0x7fec('0x2c')](_0x336490[_0x7fec('0x28')],qs[_0x7fec('0x2e')](_0x2e4b4d[_0x7fec('0x29')]['fields']));_0x3690bf[_0x7fec('0x2d')]=_0x3690bf[_0x7fec('0x2d')]['length']?_0x3690bf[_0x7fec('0x2d')]:_0x336490[_0x7fec('0x28')];if(!_0x2e4b4d[_0x7fec('0x29')]['hasOwnProperty'](_0x7fec('0x2f'))){_0x3690bf[_0x7fec('0x1b')]=qs['limit'](_0x2e4b4d[_0x7fec('0x29')][_0x7fec('0x1b')]);_0x3690bf[_0x7fec('0x19')]=qs[_0x7fec('0x19')](_0x2e4b4d[_0x7fec('0x29')]['offset']);}_0x3690bf[_0x7fec('0x30')]=qs[_0x7fec('0x31')](_0x2e4b4d['query']['sort']);_0x3690bf[_0x7fec('0x32')]=qs[_0x7fec('0x2b')](_[_0x7fec('0x33')](_0x2e4b4d['query'],_0x336490[_0x7fec('0x2b')]),_0x2dfab5);if(_0x2e4b4d[_0x7fec('0x29')][_0x7fec('0x34')]){_0x3690bf[_0x7fec('0x32')]=_['merge'](_0x3690bf[_0x7fec('0x32')],{'$or':_['map'](_0x2dfab5,function(_0x171593){if(_0x171593[_0x7fec('0x35')]!==_0x7fec('0x36')){var _0x4de6e4={};_0x4de6e4[_0x171593[_0x7fec('0x21')]]={'$like':'%'+_0x2e4b4d[_0x7fec('0x29')]['filter']+'%'};return _0x4de6e4;}})});}_0x3690bf=_['merge']({},_0x3690bf,_0x2e4b4d['options']);var _0x51924e={'where':_0x3690bf[_0x7fec('0x32')]};return db[_0x7fec('0x24')][_0x7fec('0x1a')](_0x51924e)[_0x7fec('0x20')](function(_0x29a0be){_0x1800d8['count']=_0x29a0be;if(_0x2e4b4d[_0x7fec('0x29')][_0x7fec('0x37')]){_0x3690bf[_0x7fec('0x38')]=[{'all':!![]}];}return db['VtigerAccount'][_0x7fec('0x39')](_0x3690bf);})[_0x7fec('0x20')](function(_0x13e994){_0x1800d8[_0x7fec('0x3a')]=_0x13e994;return _0x1800d8;})['then'](respondWithFilteredResult(_0x28e77e,_0x3690bf))[_0x7fec('0x3b')](handleError(_0x28e77e,null));};exports['show']=function(_0x3f5690,_0x1bdeef){var _0x5563aa={'raw':![],'where':{'id':_0x3f5690[_0x7fec('0x3c')]['id']}},_0x2938f6={};_0x2938f6[_0x7fec('0x28')]=_['keys'](db[_0x7fec('0x24')][_0x7fec('0x25')]);_0x2938f6[_0x7fec('0x29')]=_[_0x7fec('0x2a')](_0x3f5690[_0x7fec('0x29')]);_0x2938f6[_0x7fec('0x2b')]=_[_0x7fec('0x2c')](_0x2938f6[_0x7fec('0x28')],_0x2938f6[_0x7fec('0x29')]);_0x5563aa[_0x7fec('0x2d')]=_[_0x7fec('0x2c')](_0x2938f6[_0x7fec('0x28')],qs[_0x7fec('0x2e')](_0x3f5690[_0x7fec('0x29')][_0x7fec('0x2e')]));_0x5563aa[_0x7fec('0x2d')]=_0x5563aa['attributes'][_0x7fec('0x3d')]?_0x5563aa[_0x7fec('0x2d')]:_0x2938f6[_0x7fec('0x28')];if(_0x3f5690[_0x7fec('0x29')][_0x7fec('0x37')]){_0x5563aa['include']=[{'all':!![]}];}_0x5563aa=_[_0x7fec('0x3e')]({},_0x5563aa,_0x3f5690[_0x7fec('0x3f')]);return db['VtigerAccount'][_0x7fec('0x40')](_0x5563aa)['then'](handleEntityNotFound(_0x1bdeef,null))[_0x7fec('0x20')](respondWithResult(_0x1bdeef,null))['catch'](handleError(_0x1bdeef,null));};exports[_0x7fec('0x41')]=function(_0x4358da,_0x232121){return db[_0x7fec('0x24')][_0x7fec('0x41')](_0x4358da[_0x7fec('0x42')],{})[_0x7fec('0x20')](respondWithResult(_0x232121,0xc9))['catch'](handleError(_0x232121,null));};exports[_0x7fec('0x1f')]=function(_0x4f960f,_0x308e8c){if(_0x4f960f[_0x7fec('0x42')]['id']){delete _0x4f960f['body']['id'];}return db[_0x7fec('0x24')][_0x7fec('0x40')]({'where':{'id':_0x4f960f[_0x7fec('0x3c')]['id']}})[_0x7fec('0x20')](handleEntityNotFound(_0x308e8c,null))['then'](saveUpdates(_0x4f960f[_0x7fec('0x42')],null))[_0x7fec('0x20')](respondWithResult(_0x308e8c,null))[_0x7fec('0x3b')](handleError(_0x308e8c,null));};exports[_0x7fec('0x43')]=function(_0x5d675b,_0x24da5b){return db[_0x7fec('0x24')]['find']({'where':{'id':_0x5d675b[_0x7fec('0x3c')]['id']}})['then'](handleEntityNotFound(_0x24da5b,null))['then'](removeEntity(_0x24da5b,null))[_0x7fec('0x3b')](handleError(_0x24da5b,null));};exports['getConfigurations']=function(_0x2b23db,_0x50c02e,_0x58effa){var _0x387f20={};var _0x57b818={};var _0x1e6180;var _0x5078d7;return db[_0x7fec('0x24')][_0x7fec('0x44')]({'where':{'id':_0x2b23db[_0x7fec('0x3c')]['id']}})[_0x7fec('0x20')](handleEntityNotFound(_0x50c02e,null))[_0x7fec('0x20')](function(_0x3dacfa){if(_0x3dacfa){_0x1e6180=_0x3dacfa;_0x57b818['model']=_[_0x7fec('0x2a')](db['VtigerConfiguration'][_0x7fec('0x25')]);_0x57b818[_0x7fec('0x29')]=_[_0x7fec('0x2a')](_0x2b23db[_0x7fec('0x29')]);_0x57b818[_0x7fec('0x2b')]=_[_0x7fec('0x2c')](_0x57b818[_0x7fec('0x28')],_0x57b818[_0x7fec('0x29')]);_0x387f20[_0x7fec('0x2d')]=_[_0x7fec('0x2c')](_0x57b818[_0x7fec('0x28')],qs[_0x7fec('0x2e')](_0x2b23db[_0x7fec('0x29')][_0x7fec('0x2e')]));_0x387f20['attributes']=_0x387f20[_0x7fec('0x2d')]['length']?_0x387f20['attributes']:_0x57b818[_0x7fec('0x28')];_0x387f20[_0x7fec('0x30')]=qs[_0x7fec('0x31')](_0x2b23db[_0x7fec('0x29')][_0x7fec('0x31')]);_0x387f20[_0x7fec('0x32')]=qs['filters'](_[_0x7fec('0x33')](_0x2b23db['query'],_0x57b818[_0x7fec('0x2b')]));if(_0x2b23db['query'][_0x7fec('0x34')]){_0x387f20[_0x7fec('0x32')]=_['merge'](_0x387f20['where'],{'$or':_[_0x7fec('0x23')](_0x387f20['attributes'],function(_0x349a3a){var _0x415829={};_0x415829[_0x349a3a]={'$like':'%'+_0x2b23db[_0x7fec('0x29')][_0x7fec('0x34')]+'%'};return _0x415829;})});}_0x387f20=_['merge']({},_0x387f20,_0x2b23db[_0x7fec('0x3f')]);return _0x1e6180[_0x7fec('0x45')](_0x387f20);}})[_0x7fec('0x20')](function(_0x4a26cd){if(_0x4a26cd){_0x5078d7=_0x4a26cd['length'];if(!_0x2b23db['query']['hasOwnProperty'](_0x7fec('0x2f'))){_0x387f20['limit']=qs['limit'](_0x2b23db[_0x7fec('0x29')]['limit']);_0x387f20[_0x7fec('0x19')]=qs[_0x7fec('0x19')](_0x2b23db['query'][_0x7fec('0x19')]);}return _0x1e6180[_0x7fec('0x45')](_0x387f20);}})[_0x7fec('0x20')](function(_0x5dafc5){if(_0x5dafc5){return _0x5dafc5?{'count':_0x5078d7,'rows':_0x5dafc5}:null;}})[_0x7fec('0x20')](respondWithResult(_0x50c02e,null))[_0x7fec('0x3b')](handleError(_0x50c02e,null));};exports[_0x7fec('0x46')]=function(_0x3ef537,_0x343432,_0x97f9c9){if(_0x3ef537[_0x7fec('0x42')]['id']){delete _0x3ef537[_0x7fec('0x42')]['id'];}return db[_0x7fec('0x24')][_0x7fec('0x44')]({'where':{'id':_0x3ef537['params']['id']}})[_0x7fec('0x20')](handleEntityNotFound(_0x343432,null))[_0x7fec('0x20')](function(_0x4f1522){if(_0x4f1522){_0x3ef537[_0x7fec('0x42')][_0x7fec('0x47')]=_0x4f1522['id'];_0x3ef537[_0x7fec('0x42')][_0x7fec('0x48')]=integrations['getSubjects'](_0x3ef537[_0x7fec('0x42')][_0x7fec('0x49')],_0x3ef537[_0x7fec('0x42')]['type']);_0x3ef537[_0x7fec('0x42')]['Descriptions']=integrations[_0x7fec('0x4a')](_0x3ef537['body'][_0x7fec('0x49')],_0x3ef537[_0x7fec('0x42')][_0x7fec('0x35')]);return db[_0x7fec('0x4b')][_0x7fec('0x41')](_0x3ef537['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x7fec('0x4c')],'as':_0x7fec('0x4d')}]});}return null;})['then'](respondWithResult(_0x343432,null))[_0x7fec('0x3b')](handleError(_0x343432,null));};var md5=require(_0x7fec('0x4e'));exports[_0x7fec('0x4f')]=function(_0x3f1009,_0x4d418c,_0x542ce5){var _0x45909e=null;var _0x4616ae=null;var _0x56a5de=null;var _0x112767=null;var _0x19d6a1='';return db[_0x7fec('0x24')][_0x7fec('0x44')]({'where':{'id':_0x3f1009['params']['id']},'attributes':['id',_0x7fec('0x21'),_0x7fec('0x50'),_0x7fec('0x51'),_0x7fec('0x52'),_0x7fec('0x53'),_0x7fec('0x54'),_0x7fec('0x55')]})[_0x7fec('0x20')](handleEntityNotFound(_0x4d418c,null))[_0x7fec('0x20')](function(_0x11d20d){if(_0x11d20d){_0x45909e=_0x11d20d['username'];_0x4616ae=_0x11d20d[_0x7fec('0x55')];_0x56a5de=_0x11d20d['moduleName'];_0x19d6a1=_0x11d20d[_0x7fec('0x53')];var _0x48887a=_0x19d6a1['slice'](-0x1);if(_0x48887a==='/'){_0x19d6a1=_0x19d6a1[_0x7fec('0x56')](0x0,_0x19d6a1[_0x7fec('0x57')](_0x48887a));}_0x112767=util[_0x7fec('0x58')]('%s/webservice.php',_0x19d6a1);var _0x507bc2={'method':_0x7fec('0x59'),'uri':_0x112767,'qs':{'operation':_0x7fec('0x5a'),'username':_0x11d20d[_0x7fec('0x50')]},'json':!![]};return rp(_0x507bc2);}})[_0x7fec('0x20')](function(_0x4eb265){if(_0x4eb265[_0x7fec('0x5b')]){var _0x2fa074={'method':'POST','uri':_0x112767,'form':{'operation':'login','username':_0x45909e,'accessKey':md5(_0x4eb265[_0x7fec('0x5c')]['token']+_0x4616ae)},'json':!![]};return rp(_0x2fa074);}})[_0x7fec('0x20')](function(_0x51fe20){if(_0x51fe20['success']){var _0x93c12e={'method':'GET','uri':_0x112767,'qs':{'operation':_0x7fec('0x5d'),'username':_0x45909e,'sessionName':_0x51fe20['result'][_0x7fec('0x5e')],'elementType':_0x56a5de},'json':!![]};return rp(_0x93c12e);}})['then'](function(_0x6eaadd){if(_0x6eaadd[_0x7fec('0x5b')]){var _0x4c150d=['autogenerated','reference','owner'];_[_0x7fec('0x5f')](_0x6eaadd[_0x7fec('0x5c')][_0x7fec('0x2e')],function(_0x4c0d8c){return _0x4c150d[_0x7fec('0x60')](_0x4c0d8c[_0x7fec('0x35')][_0x7fec('0x21')]);});_[_0x7fec('0x5f')](_0x6eaadd[_0x7fec('0x5c')]['fields'],function(_0x5290cf){return _0x5290cf[_0x7fec('0x61')]===_0x7fec('0x62');});return{'count':_0x6eaadd['result'][_0x7fec('0x2e')][_0x7fec('0x3d')],'rows':_[_0x7fec('0x23')](_0x6eaadd['result'][_0x7fec('0x2e')],function(_0xb460e9){return{'id':_0xb460e9[_0x7fec('0x21')],'name':_0xb460e9[_0x7fec('0x63')],'custom':_[_0x7fec('0x64')](_0xb460e9[_0x7fec('0x21')],_0x7fec('0x65'))?!![]:![],'options':_0xb460e9[_0x7fec('0x35')]['name']===_0x7fec('0x66')&&_0xb460e9[_0x7fec('0x35')][_0x7fec('0x67')][_0x7fec('0x3d')]>0x0?_['map'](_0xb460e9[_0x7fec('0x35')]['picklistValues'],function(_0x376831){return{'name':_0x376831[_0x7fec('0x63')],'value':_0x376831['value']};}):[]};})};}})['then'](respondWithResult(_0x4d418c,null))[_0x7fec('0x3b')](function(_0x40c68e){console[_0x7fec('0x68')](_0x7fec('0x69')+_0x40c68e);var _0x52e5d0=_0x3f1009[_0x7fec('0x29')][_0x7fec('0x6a')]?0x1f4:_0x40c68e[_0x7fec('0x6b')]||0x1f4;logger[_0x7fec('0x6c')](_0x7fec('0x6d'),_0x7fec('0x4f'),_0x52e5d0,JSON[_0x7fec('0x6e')](_0x40c68e));delete _0x40c68e[_0x7fec('0x21')];if(_0x52e5d0===0x191){_0x52e5d0=0x190;}_0x4d418c[_0x7fec('0x16')](_0x52e5d0)[_0x7fec('0x22')](_0x3f1009[_0x7fec('0x29')][_0x7fec('0x6a')]?{'message':_0x7fec('0x6f'),'statusCode':_0x40c68e[_0x7fec('0x6b')]}:_0x40c68e);});}; \ No newline at end of file +var _0xbcc9=['error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','intersection','include','create','body','find','destroy','getConfigurations','findOne','order','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerConfiguration','VtigerField','Subjects','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','username','login','token','describe','success','autogenerated','reference','owner','remove','result','includes','editable','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','then'];(function(_0x50ff11,_0x323c97){var _0x1c4190=function(_0x5eb882){while(--_0x5eb882){_0x50ff11['push'](_0x50ff11['shift']());}};_0x1c4190(++_0x323c97);}(_0xbcc9,0xd0));var _0x9bcc=function(_0x143cfd,_0x1a336e){_0x143cfd=_0x143cfd-0x0;var _0x2cb5f5=_0xbcc9[_0x143cfd];return _0x2cb5f5;};'use strict';var emlformat=require(_0x9bcc('0x0'));var rimraf=require(_0x9bcc('0x1'));var zipdir=require(_0x9bcc('0x2'));var jsonpatch=require(_0x9bcc('0x3'));var rp=require(_0x9bcc('0x4'));var moment=require(_0x9bcc('0x5'));var BPromise=require(_0x9bcc('0x6'));var Mustache=require(_0x9bcc('0x7'));var util=require('util');var path=require(_0x9bcc('0x8'));var sox=require(_0x9bcc('0x9'));var csv=require(_0x9bcc('0xa'));var ejs=require(_0x9bcc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bcc('0xc'));var squel=require(_0x9bcc('0xd'));var crypto=require(_0x9bcc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9bcc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9bcc('0x10'));var Papa=require(_0x9bcc('0x11'));var Redis=require('ioredis');var authService=require(_0x9bcc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9bcc('0x13'));var hardwareService=require(_0x9bcc('0x14'));var logger=require(_0x9bcc('0x15'))(_0x9bcc('0x16'));var utils=require(_0x9bcc('0x17'));var config=require(_0x9bcc('0x18'));var licenseUtil=require(_0x9bcc('0x19'));var db=require(_0x9bcc('0x1a'))['db'];var integrations=require(_0x9bcc('0x1b'));function respondWithStatusCode(_0x582294,_0x34b835){_0x34b835=_0x34b835||0xcc;return function(_0x90b88f){if(_0x90b88f){return _0x582294[_0x9bcc('0x1c')](_0x34b835);}return _0x582294[_0x9bcc('0x1d')](_0x34b835)[_0x9bcc('0x1e')]();};}function respondWithResult(_0x51ff52,_0x4e0efa){_0x4e0efa=_0x4e0efa||0xc8;return function(_0x184087){if(_0x184087){return _0x51ff52[_0x9bcc('0x1d')](_0x4e0efa)['json'](_0x184087);}};}function respondWithFilteredResult(_0xa560b2,_0x91bcc9){return function(_0x50bbc9){if(_0x50bbc9){var _0x2ef86a=typeof _0x91bcc9[_0x9bcc('0x1f')]===_0x9bcc('0x20')&&typeof _0x91bcc9[_0x9bcc('0x21')]===_0x9bcc('0x20');var _0x5d8641=_0x50bbc9[_0x9bcc('0x22')];var _0x2db24f=_0x2ef86a?0x0:_0x91bcc9[_0x9bcc('0x1f')];var _0x5a6fc9=_0x2ef86a?_0x50bbc9['count']:_0x91bcc9[_0x9bcc('0x1f')]+_0x91bcc9[_0x9bcc('0x21')];var _0x4383e1;if(_0x5a6fc9>=_0x5d8641){_0x5a6fc9=_0x5d8641;_0x4383e1=0xc8;}else{_0x4383e1=0xce;}_0xa560b2[_0x9bcc('0x1d')](_0x4383e1);return _0xa560b2[_0x9bcc('0x23')]('Content-Range',_0x2db24f+'-'+_0x5a6fc9+'/'+_0x5d8641)[_0x9bcc('0x24')](_0x50bbc9);}return null;};}function patchUpdates(_0x5c901a){return function(_0xd9dcc4){try{jsonpatch['apply'](_0xd9dcc4,_0x5c901a,!![]);}catch(_0x3845b3){return BPromise[_0x9bcc('0x25')](_0x3845b3);}return _0xd9dcc4['save']();};}function saveUpdates(_0x2cdbe9,_0x331fa9){return function(_0x291c92){if(_0x291c92){return _0x291c92[_0x9bcc('0x26')](_0x2cdbe9)['then'](function(_0xa0ebdf){return _0xa0ebdf;});}return null;};}function removeEntity(_0x226037,_0xb8c282){return function(_0x148487){if(_0x148487){return _0x148487['destroy']()[_0x9bcc('0x27')](function(){_0x226037[_0x9bcc('0x1d')](0xcc)[_0x9bcc('0x1e')]();});}};}function handleEntityNotFound(_0x124985,_0x16c1c8){return function(_0x5354d5){if(!_0x5354d5){_0x124985[_0x9bcc('0x1c')](0x194);}return _0x5354d5;};}function handleError(_0x8f3711,_0x473adf){_0x473adf=_0x473adf||0x1f4;return function(_0x2c8782){logger[_0x9bcc('0x28')](_0x2c8782[_0x9bcc('0x29')]);if(_0x2c8782['name']){delete _0x2c8782[_0x9bcc('0x2a')];}_0x8f3711[_0x9bcc('0x1d')](_0x473adf)[_0x9bcc('0x2b')](_0x2c8782);};}exports[_0x9bcc('0x2c')]=function(_0x17b1f2,_0x22b73b){var _0x200824={},_0x127ebc={},_0x26d4f6={'count':0x0,'rows':[]};var _0x336f2a=_[_0x9bcc('0x2d')](db[_0x9bcc('0x2e')][_0x9bcc('0x2f')],function(_0x2d7012){return{'name':_0x2d7012[_0x9bcc('0x30')],'type':_0x2d7012[_0x9bcc('0x31')][_0x9bcc('0x32')]};});_0x127ebc[_0x9bcc('0x33')]=_[_0x9bcc('0x2d')](_0x336f2a,_0x9bcc('0x2a'));_0x127ebc[_0x9bcc('0x34')]=_[_0x9bcc('0x35')](_0x17b1f2[_0x9bcc('0x34')]);_0x127ebc[_0x9bcc('0x36')]=_['intersection'](_0x127ebc[_0x9bcc('0x33')],_0x127ebc[_0x9bcc('0x34')]);_0x200824[_0x9bcc('0x37')]=_['intersection'](_0x127ebc[_0x9bcc('0x33')],qs[_0x9bcc('0x38')](_0x17b1f2[_0x9bcc('0x34')]['fields']));_0x200824[_0x9bcc('0x37')]=_0x200824[_0x9bcc('0x37')][_0x9bcc('0x39')]?_0x200824['attributes']:_0x127ebc['model'];if(!_0x17b1f2[_0x9bcc('0x34')][_0x9bcc('0x3a')](_0x9bcc('0x3b'))){_0x200824[_0x9bcc('0x21')]=qs['limit'](_0x17b1f2['query'][_0x9bcc('0x21')]);_0x200824[_0x9bcc('0x1f')]=qs[_0x9bcc('0x1f')](_0x17b1f2['query']['offset']);}_0x200824['order']=qs[_0x9bcc('0x3c')](_0x17b1f2[_0x9bcc('0x34')][_0x9bcc('0x3c')]);_0x200824[_0x9bcc('0x3d')]=qs[_0x9bcc('0x36')](_['pick'](_0x17b1f2[_0x9bcc('0x34')],_0x127ebc['filters']),_0x336f2a);if(_0x17b1f2[_0x9bcc('0x34')][_0x9bcc('0x3e')]){_0x200824[_0x9bcc('0x3d')]=_['merge'](_0x200824[_0x9bcc('0x3d')],{'$or':_[_0x9bcc('0x2d')](_0x336f2a,function(_0x198379){if(_0x198379['type']!==_0x9bcc('0x3f')){var _0x2fffe3={};_0x2fffe3[_0x198379['name']]={'$like':'%'+_0x17b1f2['query']['filter']+'%'};return _0x2fffe3;}})});}_0x200824=_[_0x9bcc('0x40')]({},_0x200824,_0x17b1f2['options']);var _0x314b={'where':_0x200824[_0x9bcc('0x3d')]};return db[_0x9bcc('0x2e')]['count'](_0x314b)['then'](function(_0x140e81){_0x26d4f6[_0x9bcc('0x22')]=_0x140e81;if(_0x17b1f2['query'][_0x9bcc('0x41')]){_0x200824['include']=[{'all':!![]}];}return db[_0x9bcc('0x2e')]['findAll'](_0x200824);})['then'](function(_0x1106ad){_0x26d4f6[_0x9bcc('0x42')]=_0x1106ad;return _0x26d4f6;})['then'](respondWithFilteredResult(_0x22b73b,_0x200824))[_0x9bcc('0x43')](handleError(_0x22b73b,null));};exports[_0x9bcc('0x44')]=function(_0x25cdf5,_0x173356){var _0x37ef47={'raw':![],'where':{'id':_0x25cdf5[_0x9bcc('0x45')]['id']}},_0x38f089={};_0x38f089[_0x9bcc('0x33')]=_[_0x9bcc('0x35')](db[_0x9bcc('0x2e')][_0x9bcc('0x2f')]);_0x38f089['query']=_[_0x9bcc('0x35')](_0x25cdf5['query']);_0x38f089['filters']=_[_0x9bcc('0x46')](_0x38f089[_0x9bcc('0x33')],_0x38f089[_0x9bcc('0x34')]);_0x37ef47[_0x9bcc('0x37')]=_['intersection'](_0x38f089[_0x9bcc('0x33')],qs[_0x9bcc('0x38')](_0x25cdf5[_0x9bcc('0x34')][_0x9bcc('0x38')]));_0x37ef47[_0x9bcc('0x37')]=_0x37ef47['attributes'][_0x9bcc('0x39')]?_0x37ef47[_0x9bcc('0x37')]:_0x38f089[_0x9bcc('0x33')];if(_0x25cdf5['query']['includeAll']){_0x37ef47[_0x9bcc('0x47')]=[{'all':!![]}];}_0x37ef47=_['merge']({},_0x37ef47,_0x25cdf5['options']);return db['VtigerAccount']['find'](_0x37ef47)[_0x9bcc('0x27')](handleEntityNotFound(_0x173356,null))[_0x9bcc('0x27')](respondWithResult(_0x173356,null))['catch'](handleError(_0x173356,null));};exports[_0x9bcc('0x48')]=function(_0xb381f5,_0x586884){return db[_0x9bcc('0x2e')]['create'](_0xb381f5['body'],{})[_0x9bcc('0x27')](respondWithResult(_0x586884,0xc9))[_0x9bcc('0x43')](handleError(_0x586884,null));};exports[_0x9bcc('0x26')]=function(_0x199eda,_0x48d3d5){if(_0x199eda[_0x9bcc('0x49')]['id']){delete _0x199eda[_0x9bcc('0x49')]['id'];}return db[_0x9bcc('0x2e')][_0x9bcc('0x4a')]({'where':{'id':_0x199eda[_0x9bcc('0x45')]['id']}})[_0x9bcc('0x27')](handleEntityNotFound(_0x48d3d5,null))['then'](saveUpdates(_0x199eda[_0x9bcc('0x49')],null))[_0x9bcc('0x27')](respondWithResult(_0x48d3d5,null))['catch'](handleError(_0x48d3d5,null));};exports[_0x9bcc('0x4b')]=function(_0x49961b,_0x34a331){return db['VtigerAccount'][_0x9bcc('0x4a')]({'where':{'id':_0x49961b[_0x9bcc('0x45')]['id']}})[_0x9bcc('0x27')](handleEntityNotFound(_0x34a331,null))[_0x9bcc('0x27')](removeEntity(_0x34a331,null))[_0x9bcc('0x43')](handleError(_0x34a331,null));};exports[_0x9bcc('0x4c')]=function(_0x5298f3,_0x1dee68,_0x573332){var _0x5991a1={};var _0x199788={};var _0x3f05fd;var _0x2dd898;return db['VtigerAccount'][_0x9bcc('0x4d')]({'where':{'id':_0x5298f3[_0x9bcc('0x45')]['id']}})[_0x9bcc('0x27')](handleEntityNotFound(_0x1dee68,null))[_0x9bcc('0x27')](function(_0x4309aa){if(_0x4309aa){_0x3f05fd=_0x4309aa;_0x199788[_0x9bcc('0x33')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x199788[_0x9bcc('0x34')]=_[_0x9bcc('0x35')](_0x5298f3[_0x9bcc('0x34')]);_0x199788[_0x9bcc('0x36')]=_[_0x9bcc('0x46')](_0x199788[_0x9bcc('0x33')],_0x199788['query']);_0x5991a1['attributes']=_[_0x9bcc('0x46')](_0x199788['model'],qs[_0x9bcc('0x38')](_0x5298f3[_0x9bcc('0x34')][_0x9bcc('0x38')]));_0x5991a1['attributes']=_0x5991a1[_0x9bcc('0x37')][_0x9bcc('0x39')]?_0x5991a1[_0x9bcc('0x37')]:_0x199788[_0x9bcc('0x33')];_0x5991a1[_0x9bcc('0x4e')]=qs['sort'](_0x5298f3['query'][_0x9bcc('0x3c')]);_0x5991a1[_0x9bcc('0x3d')]=qs[_0x9bcc('0x36')](_['pick'](_0x5298f3[_0x9bcc('0x34')],_0x199788[_0x9bcc('0x36')]));if(_0x5298f3[_0x9bcc('0x34')][_0x9bcc('0x3e')]){_0x5991a1[_0x9bcc('0x3d')]=_['merge'](_0x5991a1[_0x9bcc('0x3d')],{'$or':_['map'](_0x5991a1[_0x9bcc('0x37')],function(_0x382563){var _0x3b441f={};_0x3b441f[_0x382563]={'$like':'%'+_0x5298f3[_0x9bcc('0x34')][_0x9bcc('0x3e')]+'%'};return _0x3b441f;})});}_0x5991a1=_[_0x9bcc('0x40')]({},_0x5991a1,_0x5298f3[_0x9bcc('0x4f')]);return _0x3f05fd['getConfigurations'](_0x5991a1);}})[_0x9bcc('0x27')](function(_0x1a9b0f){if(_0x1a9b0f){_0x2dd898=_0x1a9b0f[_0x9bcc('0x39')];if(!_0x5298f3['query'][_0x9bcc('0x3a')](_0x9bcc('0x3b'))){_0x5991a1[_0x9bcc('0x21')]=qs[_0x9bcc('0x21')](_0x5298f3[_0x9bcc('0x34')][_0x9bcc('0x21')]);_0x5991a1[_0x9bcc('0x1f')]=qs['offset'](_0x5298f3['query'][_0x9bcc('0x1f')]);}return _0x3f05fd[_0x9bcc('0x4c')](_0x5991a1);}})[_0x9bcc('0x27')](function(_0x10e186){if(_0x10e186){return _0x10e186?{'count':_0x2dd898,'rows':_0x10e186}:null;}})[_0x9bcc('0x27')](respondWithResult(_0x1dee68,null))[_0x9bcc('0x43')](handleError(_0x1dee68,null));};exports[_0x9bcc('0x50')]=function(_0x37514c,_0x2e605b,_0x55c6dc){if(_0x37514c[_0x9bcc('0x49')]['id']){delete _0x37514c[_0x9bcc('0x49')]['id'];}return db[_0x9bcc('0x2e')][_0x9bcc('0x4d')]({'where':{'id':_0x37514c[_0x9bcc('0x45')]['id']}})[_0x9bcc('0x27')](handleEntityNotFound(_0x2e605b,null))[_0x9bcc('0x27')](function(_0x4026d7){if(_0x4026d7){_0x37514c[_0x9bcc('0x49')][_0x9bcc('0x51')]=_0x4026d7['id'];_0x37514c['body']['Subjects']=integrations[_0x9bcc('0x52')](_0x37514c[_0x9bcc('0x49')][_0x9bcc('0x53')],_0x37514c[_0x9bcc('0x49')][_0x9bcc('0x31')]);_0x37514c['body'][_0x9bcc('0x54')]=integrations['getDescriptions'](_0x37514c[_0x9bcc('0x49')][_0x9bcc('0x53')],_0x37514c[_0x9bcc('0x49')][_0x9bcc('0x31')]);return db[_0x9bcc('0x55')]['create'](_0x37514c[_0x9bcc('0x49')],{'include':[{'model':db[_0x9bcc('0x56')],'as':_0x9bcc('0x57')},{'model':db['VtigerField'],'as':_0x9bcc('0x54')}]});}return null;})[_0x9bcc('0x27')](respondWithResult(_0x2e605b,null))[_0x9bcc('0x43')](handleError(_0x2e605b,null));};var md5=require(_0x9bcc('0x58'));exports[_0x9bcc('0x59')]=function(_0xed1a31,_0x3edea5,_0x1d85e5){var _0x347ac8=null;var _0x21dd9a=null;var _0x1bdd45=null;var _0x13829a=null;var _0x5b217a='';return db[_0x9bcc('0x2e')][_0x9bcc('0x4d')]({'where':{'id':_0xed1a31[_0x9bcc('0x45')]['id']},'attributes':['id',_0x9bcc('0x2a'),'username',_0x9bcc('0x5a'),_0x9bcc('0x5b'),_0x9bcc('0x5c'),_0x9bcc('0x5d'),_0x9bcc('0x5e')]})[_0x9bcc('0x27')](handleEntityNotFound(_0x3edea5,null))[_0x9bcc('0x27')](function(_0x5cfb77){if(_0x5cfb77){_0x347ac8=_0x5cfb77['username'];_0x21dd9a=_0x5cfb77[_0x9bcc('0x5e')];_0x1bdd45=_0x5cfb77[_0x9bcc('0x5b')];_0x5b217a=_0x5cfb77[_0x9bcc('0x5c')];var _0x1c37d8=_0x5b217a['slice'](-0x1);if(_0x1c37d8==='/'){_0x5b217a=_0x5b217a[_0x9bcc('0x5f')](0x0,_0x5b217a[_0x9bcc('0x60')](_0x1c37d8));}_0x13829a=util[_0x9bcc('0x61')]('%s/webservice.php',_0x5b217a);var _0x27c645={'method':_0x9bcc('0x62'),'uri':_0x13829a,'qs':{'operation':'getchallenge','username':_0x5cfb77[_0x9bcc('0x63')]},'json':!![]};return rp(_0x27c645);}})[_0x9bcc('0x27')](function(_0xfb2cf3){if(_0xfb2cf3['success']){var _0x965718={'method':'POST','uri':_0x13829a,'form':{'operation':_0x9bcc('0x64'),'username':_0x347ac8,'accessKey':md5(_0xfb2cf3['result'][_0x9bcc('0x65')]+_0x21dd9a)},'json':!![]};return rp(_0x965718);}})[_0x9bcc('0x27')](function(_0xe22349){if(_0xe22349['success']){var _0x1ecb22={'method':_0x9bcc('0x62'),'uri':_0x13829a,'qs':{'operation':_0x9bcc('0x66'),'username':_0x347ac8,'sessionName':_0xe22349['result']['sessionName'],'elementType':_0x1bdd45},'json':!![]};return rp(_0x1ecb22);}})[_0x9bcc('0x27')](function(_0xeb54a4){if(_0xeb54a4[_0x9bcc('0x67')]){var _0x41736e=[_0x9bcc('0x68'),_0x9bcc('0x69'),_0x9bcc('0x6a')];_[_0x9bcc('0x6b')](_0xeb54a4[_0x9bcc('0x6c')][_0x9bcc('0x38')],function(_0x5d7ef7){return _0x41736e[_0x9bcc('0x6d')](_0x5d7ef7[_0x9bcc('0x31')][_0x9bcc('0x2a')]);});_[_0x9bcc('0x6b')](_0xeb54a4[_0x9bcc('0x6c')][_0x9bcc('0x38')],function(_0x13bb70){return _0x13bb70[_0x9bcc('0x6e')]===_0x9bcc('0x6f');});return{'count':_0xeb54a4[_0x9bcc('0x6c')]['fields'][_0x9bcc('0x39')],'rows':_[_0x9bcc('0x2d')](_0xeb54a4[_0x9bcc('0x6c')][_0x9bcc('0x38')],function(_0x2f3735){return{'id':_0x2f3735[_0x9bcc('0x2a')],'name':_0x2f3735[_0x9bcc('0x70')],'custom':_['startsWith'](_0x2f3735[_0x9bcc('0x2a')],_0x9bcc('0x71'))?!![]:![],'options':_0x2f3735['type'][_0x9bcc('0x2a')]===_0x9bcc('0x72')&&_0x2f3735['type'][_0x9bcc('0x73')]['length']>0x0?_['map'](_0x2f3735[_0x9bcc('0x31')]['picklistValues'],function(_0x19e114){return{'name':_0x19e114[_0x9bcc('0x70')],'value':_0x19e114[_0x9bcc('0x74')]};}):[]};})};}})[_0x9bcc('0x27')](respondWithResult(_0x3edea5,null))[_0x9bcc('0x43')](function(_0x5c3e39){console[_0x9bcc('0x75')](_0x9bcc('0x76')+_0x5c3e39);var _0x2cb0e8=_0xed1a31[_0x9bcc('0x34')]['test']?0x1f4:_0x5c3e39['statusCode']||0x1f4;logger[_0x9bcc('0x28')](_0x9bcc('0x77'),_0x9bcc('0x59'),_0x2cb0e8,JSON[_0x9bcc('0x78')](_0x5c3e39));delete _0x5c3e39[_0x9bcc('0x2a')];if(_0x2cb0e8===0x191){_0x2cb0e8=0x190;}_0x3edea5['status'](_0x2cb0e8)[_0x9bcc('0x2b')](_0xed1a31['query'][_0x9bcc('0x79')]?{'message':_0x9bcc('0x7a'),'statusCode':_0x5c3e39[_0x9bcc('0x7b')]}:_0x5c3e39);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 62f18af..0bacb30 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 _0xf687=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','api','bluebird'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf687,0x8c));var _0x7f68=function(_0x5448a2,_0x2b48d2){_0x5448a2=_0x5448a2-0x0;var _0x2ecc64=_0xf687[_0x5448a2];return _0x2ecc64;};'use strict';var _=require('lodash');var util=require(_0x7f68('0x0'));var logger=require(_0x7f68('0x1'))(_0x7f68('0x2'));var moment=require('moment');var BPromise=require(_0x7f68('0x3'));var rp=require(_0x7f68('0x4'));var fs=require('fs');var path=require(_0x7f68('0x5'));var rimraf=require(_0x7f68('0x6'));var config=require(_0x7f68('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7f68('0x8'));module[_0x7f68('0x9')]=function(_0x47ed70,_0x2c3083){return _0x47ed70[_0x7f68('0xa')](_0x7f68('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a8=['int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x27afce,_0x5aa3ba){var _0x18bc33=function(_0x305cb9){while(--_0x305cb9){_0x27afce['push'](_0x27afce['shift']());}};_0x18bc33(++_0x5aa3ba);}(_0xd8a8,0x11f));var _0x8d8a=function(_0x5a5f1d,_0x3359d8){_0x5a5f1d=_0x5a5f1d-0x0;var _0x597cf4=_0xd8a8[_0x5a5f1d];return _0x597cf4;};'use strict';var _=require(_0x8d8a('0x0'));var util=require(_0x8d8a('0x1'));var logger=require(_0x8d8a('0x2'))('api');var moment=require(_0x8d8a('0x3'));var BPromise=require(_0x8d8a('0x4'));var rp=require(_0x8d8a('0x5'));var fs=require('fs');var path=require(_0x8d8a('0x6'));var rimraf=require('rimraf');var config=require(_0x8d8a('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x8d8a('0x8'));module[_0x8d8a('0x9')]=function(_0x4b6a3c,_0xfcf81e){return _0x4b6a3c[_0x8d8a('0xa')](_0x8d8a('0xb'),attributes,{'tableName':_0x8d8a('0xc'),'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 41d294d..b346165 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 _0x1be1=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x39d4ba,_0x8d5880){var _0x3a2b31=function(_0x4fb4c2){while(--_0x4fb4c2){_0x39d4ba['push'](_0x39d4ba['shift']());}};_0x3a2b31(++_0x8d5880);}(_0x1be1,0x192));var _0x11be=function(_0x223316,_0xda01d8){_0x223316=_0x223316-0x0;var _0x43ff9b=_0x1be1[_0x223316];return _0x43ff9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['VtigerAccount']['findAll']({'raw':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x56ab61[_0x11be('0x17')]?_0x56ab61['options'][_0x11be('0x19')]||null:null,'attributes':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'limit':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1b')]||null:null,'include':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')]?_['map'](_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')],function(_0x2fe43c){return{'model':db[_0x2fe43c['model']],'as':_0x2fe43c['as'],'attributes':_0x2fe43c['attributes'],'include':_0x2fe43c[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x2fe43c[_0x11be('0x1c')],function(_0x4cb27f){return{'model':db[_0x4cb27f[_0x11be('0x1e')]],'as':_0x4cb27f['as'],'attributes':_0x4cb27f['attributes'],'include':_0x4cb27f[_0x11be('0x1c')]?_['map'](_0x4cb27f[_0x11be('0x1c')],function(_0xb11f3d){return{'model':db[_0xb11f3d['model']],'as':_0xb11f3d['as'],'attributes':_0xb11f3d[_0x11be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1d3b5c){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x1d3b5c));_0xc3263c(_0x1d3b5c);})[_0x11be('0x15')](function(_0x5966c5){logger[_0x11be('0x11')]('GetVtigerAccount',_0x5966c5[_0x11be('0x13')],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x5966c5['message']));});});};exports['ShowVtigerAccount']=function(_0x49fd5c){var _0x265fc9=this;return new Promise(function(_0x5e8f9a,_0x66316d){return db[_0x11be('0x1f')][_0x11be('0x20')]({'raw':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x49fd5c['options']?_0x49fd5c[_0x11be('0x17')][_0x11be('0x19')]||null:null,'attributes':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'include':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c['options'][_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x49fd5c[_0x11be('0x17')][_0x11be('0x1c')],function(_0x228bd3){return{'model':db[_0x228bd3['model']],'as':_0x228bd3['as'],'attributes':_0x228bd3[_0x11be('0x1a')],'include':_0x228bd3[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x228bd3['include'],function(_0x2c6fb2){return{'model':db[_0x2c6fb2['model']],'as':_0x2c6fb2['as'],'attributes':_0x2c6fb2['attributes'],'include':_0x2c6fb2['include']?_['map'](_0x2c6fb2[_0x11be('0x1c')],function(_0x2c5715){return{'model':db[_0x2c5715[_0x11be('0x1e')]],'as':_0x2c5715['as'],'attributes':_0x2c5715['attributes']};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1866d8){logger['info'](_0x11be('0x21'),_0x49fd5c);logger['debug'](_0x11be('0x21'),_0x49fd5c,JSON['stringify'](_0x1866d8));_0x5e8f9a(_0x1866d8);})[_0x11be('0x15')](function(_0xa6d724){logger[_0x11be('0x11')](_0x11be('0x21'),_0xa6d724['message'],_0x49fd5c);_0x66316d(_0x265fc9[_0x11be('0x11')](0x1f4,_0xa6d724[_0x11be('0x13')]));});});}; \ No newline at end of file +var _0xac4a=['info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x553502,_0x4d2c0c){var _0x246c37=function(_0x36698a){while(--_0x36698a){_0x553502['push'](_0x553502['shift']());}};_0x246c37(++_0x4d2c0c);}(_0xac4a,0x13f));var _0xaac4=function(_0x5d48f0,_0x54429c){_0x5d48f0=_0x5d48f0-0x0;var _0x9374c5=_0xac4a[_0x5d48f0];return _0x9374c5;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')]({'raw':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x52085a['options']?_0x52085a[_0xaac4('0x18')]['attributes']||null:null,'limit':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1b')]||null:null,'include':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')]?_['map'](_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x174860){return{'model':db[_0x174860[_0xaac4('0x1d')]],'as':_0x174860['as'],'attributes':_0x174860[_0xaac4('0x1e')],'include':_0x174860[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x174860['include'],function(_0x24186b){return{'model':db[_0x24186b['model']],'as':_0x24186b['as'],'attributes':_0x24186b['attributes'],'include':_0x24186b['include']?_['map'](_0x24186b[_0xaac4('0x1c')],function(_0x17d25f){return{'model':db[_0x17d25f[_0xaac4('0x1d')]],'as':_0x17d25f['as'],'attributes':_0x17d25f[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0xa')](function(_0x249a5d){logger[_0xaac4('0xb')](_0xaac4('0x15'),_0x52085a);logger[_0xaac4('0xc')](_0xaac4('0x15'),_0x52085a,JSON['stringify'](_0x249a5d));_0x5b6fd6(_0x249a5d);})[_0xaac4('0x14')](function(_0x16b33c){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x16b33c[_0xaac4('0x12')],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x16b33c['message']));});});};exports[_0xaac4('0x20')]=function(_0x5d2c9a){var _0x2df7e3=this;return new Promise(function(_0xab5d04,_0x182343){return db[_0xaac4('0x16')]['find']({'raw':_0x5d2c9a['options']?_0x5d2c9a['options'][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1e')]||null:null,'include':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x3b93e5){return{'model':db[_0x3b93e5[_0xaac4('0x1d')]],'as':_0x3b93e5['as'],'attributes':_0x3b93e5['attributes'],'include':_0x3b93e5['include']?_[_0xaac4('0x1f')](_0x3b93e5[_0xaac4('0x1c')],function(_0xa07d0){return{'model':db[_0xa07d0['model']],'as':_0xa07d0['as'],'attributes':_0xa07d0[_0xaac4('0x1e')],'include':_0xa07d0[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0xa07d0[_0xaac4('0x1c')],function(_0x1ec59d){return{'model':db[_0x1ec59d[_0xaac4('0x1d')]],'as':_0x1ec59d['as'],'attributes':_0x1ec59d[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36591a){logger[_0xaac4('0xb')](_0xaac4('0x20'),_0x5d2c9a);logger['debug'](_0xaac4('0x20'),_0x5d2c9a,JSON['stringify'](_0x36591a));_0xab5d04(_0x36591a);})['catch'](function(_0x344d05){logger[_0xaac4('0x10')](_0xaac4('0x20'),_0x344d05['message'],_0x5d2c9a);_0x182343(_0x2df7e3['error'](0x1f4,_0x344d05[_0xaac4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6ed5b68..a2cfed1 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 _0xf268=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x51f95b,_0x1f1350){var _0x2d4c5e=function(_0x3ecef5){while(--_0x3ecef5){_0x51f95b['push'](_0x51f95b['shift']());}};_0x2d4c5e(++_0x1f1350);}(_0xf268,0xa2));var _0x8f26=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0xf268[_0x5962b4];return _0xe6443c;};'use strict';var multer=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var path=require(_0x8f26('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f26('0x3'));var router=express['Router']();var fs_extra=require(_0x8f26('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f26('0x5'));var config=require(_0x8f26('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0x8f26('0x7')]('/',auth['isAuthenticated'](),controller[_0x8f26('0x8')]);router[_0x8f26('0x7')](_0x8f26('0x9'),auth[_0x8f26('0xa')](),controller[_0x8f26('0xb')]);router[_0x8f26('0x7')](_0x8f26('0xc'),auth[_0x8f26('0xa')](),controller[_0x8f26('0xd')]);router[_0x8f26('0x7')]('/:id/subjects',auth[_0x8f26('0xa')](),controller['getSubjects']);router[_0x8f26('0x7')](_0x8f26('0xe'),auth[_0x8f26('0xa')](),controller[_0x8f26('0xf')]);router[_0x8f26('0x10')]('/',auth[_0x8f26('0xa')](),controller[_0x8f26('0x11')]);router[_0x8f26('0x12')]('/:id',auth[_0x8f26('0xa')](),controller[_0x8f26('0x13')]);router['delete'](_0x8f26('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x8f26('0x14')]=router; \ No newline at end of file +var _0xce39=['../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x28cd19,_0x2caa38){var _0x3f51bc=function(_0x428b15){while(--_0x428b15){_0x28cd19['push'](_0x28cd19['shift']());}};_0x3f51bc(++_0x2caa38);}(_0xce39,0x198));var _0x9ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9ce3('0x0'));var util=require(_0x9ce3('0x1'));var path=require(_0x9ce3('0x2'));var timeout=require(_0x9ce3('0x3'));var express=require('express');var router=express[_0x9ce3('0x4')]();var fs_extra=require(_0x9ce3('0x5'));var auth=require(_0x9ce3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ce3('0x7'));var controller=require(_0x9ce3('0x8'));router[_0x9ce3('0x9')]('/',auth[_0x9ce3('0xa')](),controller[_0x9ce3('0xb')]);router[_0x9ce3('0x9')](_0x9ce3('0xc'),auth['isAuthenticated'](),controller[_0x9ce3('0xd')]);router[_0x9ce3('0x9')](_0x9ce3('0xe'),auth[_0x9ce3('0xa')](),controller[_0x9ce3('0xf')]);router[_0x9ce3('0x9')]('/:id/subjects',auth[_0x9ce3('0xa')](),controller[_0x9ce3('0x10')]);router[_0x9ce3('0x9')](_0x9ce3('0x11'),auth[_0x9ce3('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x9ce3('0xa')](),controller[_0x9ce3('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9ce3('0x13')]);router[_0x9ce3('0x14')](_0x9ce3('0xc'),auth[_0x9ce3('0xa')](),controller[_0x9ce3('0x15')]);module[_0x9ce3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b6b36fe..50f5931 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 _0x6b10=['exports','sequelize'];(function(_0x18f65d,_0x32f166){var _0xf80f65=function(_0x311dec){while(--_0x311dec){_0x18f65d['push'](_0x18f65d['shift']());}};_0xf80f65(++_0x32f166);}(_0x6b10,0xb7));var _0x06b1=function(_0x2c897c,_0x10451a){_0x2c897c=_0x2c897c-0x0;var _0xc9e1f0=_0x6b10[_0x2c897c];return _0xc9e1f0;};'use strict';var Sequelize=require(_0x06b1('0x0'));module[_0x06b1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x090d=['exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x090d,0x96));var _0xd090=function(_0x467b3d,_0x4548df){_0x467b3d=_0x467b3d-0x0;var _0x4acaec=_0x090d[_0x467b3d];return _0x4acaec;};'use strict';var Sequelize=require('sequelize');module[_0xd090('0x0')]={'name':{'type':Sequelize[_0xd090('0x1')]},'description':{'type':Sequelize[_0xd090('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8e6e451..5863fd1 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 _0x79d3=['update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','VtigerField','rawAttributes','getFields','hasOwnProperty','getSubjects','findOne','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save'];(function(_0x218be4,_0x257ff7){var _0x105e54=function(_0x46d509){while(--_0x46d509){_0x218be4['push'](_0x218be4['shift']());}};_0x105e54(++_0x257ff7);}(_0x79d3,0x179));var _0x379d=function(_0x1accf6,_0x4a9854){_0x1accf6=_0x1accf6-0x0;var _0x24e446=_0x79d3[_0x1accf6];return _0x24e446;};'use strict';var emlformat=require(_0x379d('0x0'));var rimraf=require(_0x379d('0x1'));var zipdir=require(_0x379d('0x2'));var jsonpatch=require(_0x379d('0x3'));var rp=require(_0x379d('0x4'));var moment=require(_0x379d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x379d('0x6'));var util=require(_0x379d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x379d('0x8'));var ejs=require(_0x379d('0x9'));var fs=require('fs');var fs_extra=require(_0x379d('0xa'));var _=require(_0x379d('0xb'));var squel=require(_0x379d('0xc'));var crypto=require('crypto');var jsforce=require(_0x379d('0xd'));var deskjs=require(_0x379d('0xe'));var toCsv=require(_0x379d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x379d('0xf'));var authService=require(_0x379d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x379d('0x11'));var hardwareService=require(_0x379d('0x12'));var logger=require(_0x379d('0x13'))(_0x379d('0x14'));var utils=require('../../config/utils');var config=require(_0x379d('0x15'));var licenseUtil=require(_0x379d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380841,_0x9dc839){_0x9dc839=_0x9dc839||0xcc;return function(_0x4fae63){if(_0x4fae63){return _0x380841['sendStatus'](_0x9dc839);}return _0x380841[_0x379d('0x17')](_0x9dc839)['end']();};}function respondWithResult(_0x5f4947,_0x339aab){_0x339aab=_0x339aab||0xc8;return function(_0x4c36bb){if(_0x4c36bb){return _0x5f4947[_0x379d('0x17')](_0x339aab)['json'](_0x4c36bb);}};}function respondWithFilteredResult(_0x2957c8,_0x4150a1){return function(_0x1afe8e){if(_0x1afe8e){var _0x3e7fee=typeof _0x4150a1[_0x379d('0x18')]===_0x379d('0x19')&&typeof _0x4150a1[_0x379d('0x1a')]===_0x379d('0x19');var _0x462244=_0x1afe8e[_0x379d('0x1b')];var _0x58653d=_0x3e7fee?0x0:_0x4150a1['offset'];var _0x37f319=_0x3e7fee?_0x1afe8e[_0x379d('0x1b')]:_0x4150a1[_0x379d('0x18')]+_0x4150a1[_0x379d('0x1a')];var _0x2b1f1f;if(_0x37f319>=_0x462244){_0x37f319=_0x462244;_0x2b1f1f=0xc8;}else{_0x2b1f1f=0xce;}_0x2957c8[_0x379d('0x17')](_0x2b1f1f);return _0x2957c8['set'](_0x379d('0x1c'),_0x58653d+'-'+_0x37f319+'/'+_0x462244)[_0x379d('0x1d')](_0x1afe8e);}return null;};}function patchUpdates(_0x34f791){return function(_0x151e66){try{jsonpatch[_0x379d('0x1e')](_0x151e66,_0x34f791,!![]);}catch(_0x26348b){return BPromise[_0x379d('0x1f')](_0x26348b);}return _0x151e66[_0x379d('0x20')]();};}function saveUpdates(_0x1d1bdb,_0x139d23){return function(_0x34b0aa){if(_0x34b0aa){return _0x34b0aa[_0x379d('0x21')](_0x1d1bdb)[_0x379d('0x22')](function(_0x385417){return _0x385417;});}return null;};}function removeEntity(_0x32493f,_0x26b485){return function(_0x26e2b3){if(_0x26e2b3){return _0x26e2b3[_0x379d('0x23')]()[_0x379d('0x22')](function(){_0x32493f['status'](0xcc)[_0x379d('0x24')]();});}};}function handleEntityNotFound(_0x4d273c,_0x3a22b1){return function(_0x375ad8){if(!_0x375ad8){_0x4d273c[_0x379d('0x25')](0x194);}return _0x375ad8;};}function handleError(_0x20bd99,_0x10f0ed){_0x10f0ed=_0x10f0ed||0x1f4;return function(_0x15bccc){logger[_0x379d('0x26')](_0x15bccc[_0x379d('0x27')]);if(_0x15bccc[_0x379d('0x28')]){delete _0x15bccc['name'];}_0x20bd99['status'](_0x10f0ed)[_0x379d('0x29')](_0x15bccc);};}exports[_0x379d('0x2a')]=function(_0xa65ad2,_0x2030ec){var _0x3bbc12={},_0x35da33={},_0x3d527d={'count':0x0,'rows':[]};var _0x9f0b4a=_['map'](db[_0x379d('0x2b')]['rawAttributes'],function(_0xef62e7){return{'name':_0xef62e7[_0x379d('0x2c')],'type':_0xef62e7[_0x379d('0x2d')][_0x379d('0x2e')]};});_0x35da33[_0x379d('0x2f')]=_[_0x379d('0x30')](_0x9f0b4a,'name');_0x35da33[_0x379d('0x31')]=_[_0x379d('0x32')](_0xa65ad2[_0x379d('0x31')]);_0x35da33[_0x379d('0x33')]=_[_0x379d('0x34')](_0x35da33['model'],_0x35da33[_0x379d('0x31')]);_0x3bbc12[_0x379d('0x35')]=_[_0x379d('0x34')](_0x35da33['model'],qs[_0x379d('0x36')](_0xa65ad2[_0x379d('0x31')]['fields']));_0x3bbc12['attributes']=_0x3bbc12[_0x379d('0x35')][_0x379d('0x37')]?_0x3bbc12[_0x379d('0x35')]:_0x35da33[_0x379d('0x2f')];if(!_0xa65ad2[_0x379d('0x31')]['hasOwnProperty'](_0x379d('0x38'))){_0x3bbc12['limit']=qs[_0x379d('0x1a')](_0xa65ad2[_0x379d('0x31')][_0x379d('0x1a')]);_0x3bbc12['offset']=qs['offset'](_0xa65ad2[_0x379d('0x31')][_0x379d('0x18')]);}_0x3bbc12['order']=qs[_0x379d('0x39')](_0xa65ad2['query']['sort']);_0x3bbc12['where']=qs[_0x379d('0x33')](_[_0x379d('0x3a')](_0xa65ad2[_0x379d('0x31')],_0x35da33[_0x379d('0x33')]),_0x9f0b4a);if(_0xa65ad2[_0x379d('0x31')][_0x379d('0x3b')]){_0x3bbc12[_0x379d('0x3c')]=_[_0x379d('0x3d')](_0x3bbc12['where'],{'$or':_[_0x379d('0x30')](_0x9f0b4a,function(_0x182845){if(_0x182845['type']!==_0x379d('0x3e')){var _0x41b6dc={};_0x41b6dc[_0x182845[_0x379d('0x28')]]={'$like':'%'+_0xa65ad2['query'][_0x379d('0x3b')]+'%'};return _0x41b6dc;}})});}_0x3bbc12=_[_0x379d('0x3d')]({},_0x3bbc12,_0xa65ad2[_0x379d('0x3f')]);var _0x228f1f={'where':_0x3bbc12[_0x379d('0x3c')]};return db[_0x379d('0x2b')][_0x379d('0x1b')](_0x228f1f)['then'](function(_0x19156e){_0x3d527d[_0x379d('0x1b')]=_0x19156e;if(_0xa65ad2['query'][_0x379d('0x40')]){_0x3bbc12['include']=[{'all':!![]}];}return db[_0x379d('0x2b')][_0x379d('0x41')](_0x3bbc12);})[_0x379d('0x22')](function(_0x412afe){_0x3d527d[_0x379d('0x42')]=_0x412afe;return _0x3d527d;})['then'](respondWithFilteredResult(_0x2030ec,_0x3bbc12))[_0x379d('0x43')](handleError(_0x2030ec,null));};exports[_0x379d('0x44')]=function(_0x266a53,_0x11ba3f){var _0x7051e2={'raw':![],'where':{'id':_0x266a53[_0x379d('0x45')]['id']}},_0x458fa9={};_0x458fa9['model']=_[_0x379d('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x458fa9['query']=_[_0x379d('0x32')](_0x266a53['query']);_0x458fa9[_0x379d('0x33')]=_['intersection'](_0x458fa9[_0x379d('0x2f')],_0x458fa9[_0x379d('0x31')]);_0x7051e2['attributes']=_[_0x379d('0x34')](_0x458fa9[_0x379d('0x2f')],qs[_0x379d('0x36')](_0x266a53['query'][_0x379d('0x36')]));_0x7051e2[_0x379d('0x35')]=_0x7051e2[_0x379d('0x35')][_0x379d('0x37')]?_0x7051e2[_0x379d('0x35')]:_0x458fa9[_0x379d('0x2f')];if(_0x266a53[_0x379d('0x31')][_0x379d('0x40')]){_0x7051e2[_0x379d('0x46')]=[{'all':!![]}];}_0x7051e2=_[_0x379d('0x3d')]({},_0x7051e2,_0x266a53['options']);return db['VtigerConfiguration']['find'](_0x7051e2)['then'](handleEntityNotFound(_0x11ba3f,null))[_0x379d('0x22')](respondWithResult(_0x11ba3f,null))[_0x379d('0x43')](handleError(_0x11ba3f,null));};exports[_0x379d('0x47')]=function(_0x16207b,_0xf8a2dd){return db['VtigerConfiguration'][_0x379d('0x47')](_0x16207b[_0x379d('0x48')],{})[_0x379d('0x22')](respondWithResult(_0xf8a2dd,0xc9))[_0x379d('0x43')](handleError(_0xf8a2dd,null));};exports[_0x379d('0x21')]=function(_0x489e70,_0x265d24){if(_0x489e70[_0x379d('0x48')]['id']){delete _0x489e70[_0x379d('0x48')]['id'];}return db[_0x379d('0x2b')]['find']({'where':{'id':_0x489e70[_0x379d('0x45')]['id']}})['then'](handleEntityNotFound(_0x265d24,null))['then'](saveUpdates(_0x489e70[_0x379d('0x48')],null))[_0x379d('0x22')](respondWithResult(_0x265d24,null))[_0x379d('0x43')](handleError(_0x265d24,null));};exports['destroy']=function(_0x16457a,_0x50fcfe){return db[_0x379d('0x2b')][_0x379d('0x49')]({'where':{'id':_0x16457a[_0x379d('0x45')]['id']}})['then'](handleEntityNotFound(_0x50fcfe,null))[_0x379d('0x22')](removeEntity(_0x50fcfe,null))[_0x379d('0x43')](handleError(_0x50fcfe,null));};exports['getFields']=function(_0x28f66b,_0x3e34d2,_0x297af4){var _0x25e2e5={};var _0x297eb6={};var _0x585d77;var _0x39cc2b;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x28f66b[_0x379d('0x45')]['id']}})[_0x379d('0x22')](handleEntityNotFound(_0x3e34d2,null))[_0x379d('0x22')](function(_0x401d1e){if(_0x401d1e){_0x585d77=_0x401d1e;_0x297eb6['model']=_['keys'](db[_0x379d('0x4a')][_0x379d('0x4b')]);_0x297eb6[_0x379d('0x31')]=_[_0x379d('0x32')](_0x28f66b[_0x379d('0x31')]);_0x297eb6['filters']=_[_0x379d('0x34')](_0x297eb6[_0x379d('0x2f')],_0x297eb6[_0x379d('0x31')]);_0x25e2e5[_0x379d('0x35')]=_['intersection'](_0x297eb6['model'],qs['fields'](_0x28f66b[_0x379d('0x31')][_0x379d('0x36')]));_0x25e2e5[_0x379d('0x35')]=_0x25e2e5[_0x379d('0x35')][_0x379d('0x37')]?_0x25e2e5[_0x379d('0x35')]:_0x297eb6[_0x379d('0x2f')];_0x25e2e5['order']=qs[_0x379d('0x39')](_0x28f66b[_0x379d('0x31')][_0x379d('0x39')]);_0x25e2e5[_0x379d('0x3c')]=qs[_0x379d('0x33')](_[_0x379d('0x3a')](_0x28f66b[_0x379d('0x31')],_0x297eb6[_0x379d('0x33')]));if(_0x28f66b[_0x379d('0x31')][_0x379d('0x3b')]){_0x25e2e5[_0x379d('0x3c')]=_['merge'](_0x25e2e5[_0x379d('0x3c')],{'$or':_['map'](_0x25e2e5[_0x379d('0x35')],function(_0x4b312d){var _0x5c556b={};_0x5c556b[_0x4b312d]={'$like':'%'+_0x28f66b[_0x379d('0x31')]['filter']+'%'};return _0x5c556b;})});}_0x25e2e5=_['merge']({},_0x25e2e5,_0x28f66b['options']);return _0x585d77[_0x379d('0x4c')](_0x25e2e5);}})[_0x379d('0x22')](function(_0x5967c3){if(_0x5967c3){_0x39cc2b=_0x5967c3[_0x379d('0x37')];if(!_0x28f66b[_0x379d('0x31')][_0x379d('0x4d')](_0x379d('0x38'))){_0x25e2e5[_0x379d('0x1a')]=qs[_0x379d('0x1a')](_0x28f66b[_0x379d('0x31')][_0x379d('0x1a')]);_0x25e2e5[_0x379d('0x18')]=qs[_0x379d('0x18')](_0x28f66b['query'][_0x379d('0x18')]);}return _0x585d77[_0x379d('0x4c')](_0x25e2e5);}})[_0x379d('0x22')](function(_0x59d0d4){if(_0x59d0d4){return _0x59d0d4?{'count':_0x39cc2b,'rows':_0x59d0d4}:null;}})[_0x379d('0x22')](respondWithResult(_0x3e34d2,null))[_0x379d('0x43')](handleError(_0x3e34d2,null));};exports[_0x379d('0x4e')]=function(_0x1a1adb,_0x3230c4,_0x8a4692){var _0x190ee6={};var _0x2997ae={};var _0x4c5ad2;var _0x2908a7;return db[_0x379d('0x2b')][_0x379d('0x4f')]({'where':{'id':_0x1a1adb[_0x379d('0x45')]['id']}})[_0x379d('0x22')](handleEntityNotFound(_0x3230c4,null))['then'](function(_0x24a7d3){if(_0x24a7d3){_0x4c5ad2=_0x24a7d3;_0x2997ae[_0x379d('0x2f')]=_['keys'](db[_0x379d('0x4a')]['rawAttributes']);_0x2997ae[_0x379d('0x31')]=_[_0x379d('0x32')](_0x1a1adb['query']);_0x2997ae[_0x379d('0x33')]=_['intersection'](_0x2997ae[_0x379d('0x2f')],_0x2997ae[_0x379d('0x31')]);_0x190ee6[_0x379d('0x35')]=_[_0x379d('0x34')](_0x2997ae[_0x379d('0x2f')],qs[_0x379d('0x36')](_0x1a1adb[_0x379d('0x31')][_0x379d('0x36')]));_0x190ee6[_0x379d('0x35')]=_0x190ee6[_0x379d('0x35')][_0x379d('0x37')]?_0x190ee6['attributes']:_0x2997ae[_0x379d('0x2f')];_0x190ee6[_0x379d('0x50')]=qs['sort'](_0x1a1adb['query']['sort']);_0x190ee6[_0x379d('0x3c')]=qs[_0x379d('0x33')](_[_0x379d('0x3a')](_0x1a1adb[_0x379d('0x31')],_0x2997ae[_0x379d('0x33')]));if(_0x1a1adb[_0x379d('0x31')][_0x379d('0x3b')]){_0x190ee6[_0x379d('0x3c')]=_[_0x379d('0x3d')](_0x190ee6[_0x379d('0x3c')],{'$or':_['map'](_0x190ee6[_0x379d('0x35')],function(_0x43c784){var _0x305df2={};_0x305df2[_0x43c784]={'$like':'%'+_0x1a1adb[_0x379d('0x31')][_0x379d('0x3b')]+'%'};return _0x305df2;})});}_0x190ee6=_[_0x379d('0x3d')]({},_0x190ee6,_0x1a1adb[_0x379d('0x3f')]);return _0x4c5ad2[_0x379d('0x4e')](_0x190ee6);}})[_0x379d('0x22')](function(_0x36d323){if(_0x36d323){_0x2908a7=_0x36d323[_0x379d('0x37')];if(!_0x1a1adb[_0x379d('0x31')][_0x379d('0x4d')](_0x379d('0x38'))){_0x190ee6[_0x379d('0x1a')]=qs[_0x379d('0x1a')](_0x1a1adb[_0x379d('0x31')][_0x379d('0x1a')]);_0x190ee6[_0x379d('0x18')]=qs['offset'](_0x1a1adb[_0x379d('0x31')][_0x379d('0x18')]);}return _0x4c5ad2[_0x379d('0x4e')](_0x190ee6);}})['then'](function(_0x3cd036){if(_0x3cd036){return _0x3cd036?{'count':_0x2908a7,'rows':_0x3cd036}:null;}})[_0x379d('0x22')](respondWithResult(_0x3230c4,null))['catch'](handleError(_0x3230c4,null));};exports[_0x379d('0x51')]=function(_0x3ce1a1,_0xf919de,_0x25598b){var _0x115342={};var _0x1311fb={};var _0x45dcc9;var _0x137560;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x3ce1a1['params']['id']}})[_0x379d('0x22')](handleEntityNotFound(_0xf919de,null))[_0x379d('0x22')](function(_0x240717){if(_0x240717){_0x45dcc9=_0x240717;_0x1311fb[_0x379d('0x2f')]=_['keys'](db[_0x379d('0x4a')][_0x379d('0x4b')]);_0x1311fb[_0x379d('0x31')]=_[_0x379d('0x32')](_0x3ce1a1[_0x379d('0x31')]);_0x1311fb[_0x379d('0x33')]=_[_0x379d('0x34')](_0x1311fb[_0x379d('0x2f')],_0x1311fb['query']);_0x115342[_0x379d('0x35')]=_[_0x379d('0x34')](_0x1311fb[_0x379d('0x2f')],qs['fields'](_0x3ce1a1['query']['fields']));_0x115342[_0x379d('0x35')]=_0x115342['attributes'][_0x379d('0x37')]?_0x115342[_0x379d('0x35')]:_0x1311fb[_0x379d('0x2f')];_0x115342[_0x379d('0x50')]=qs[_0x379d('0x39')](_0x3ce1a1['query'][_0x379d('0x39')]);_0x115342[_0x379d('0x3c')]=qs[_0x379d('0x33')](_['pick'](_0x3ce1a1['query'],_0x1311fb['filters']));if(_0x3ce1a1['query'][_0x379d('0x3b')]){_0x115342['where']=_[_0x379d('0x3d')](_0x115342[_0x379d('0x3c')],{'$or':_[_0x379d('0x30')](_0x115342['attributes'],function(_0x4ebbca){var _0x43dc97={};_0x43dc97[_0x4ebbca]={'$like':'%'+_0x3ce1a1[_0x379d('0x31')][_0x379d('0x3b')]+'%'};return _0x43dc97;})});}_0x115342=_[_0x379d('0x3d')]({},_0x115342,_0x3ce1a1['options']);return _0x45dcc9[_0x379d('0x51')](_0x115342);}})[_0x379d('0x22')](function(_0x9bf7d5){if(_0x9bf7d5){_0x137560=_0x9bf7d5[_0x379d('0x37')];if(!_0x3ce1a1[_0x379d('0x31')][_0x379d('0x4d')](_0x379d('0x38'))){_0x115342[_0x379d('0x1a')]=qs[_0x379d('0x1a')](_0x3ce1a1[_0x379d('0x31')][_0x379d('0x1a')]);_0x115342['offset']=qs[_0x379d('0x18')](_0x3ce1a1['query']['offset']);}return _0x45dcc9['getDescriptions'](_0x115342);}})['then'](function(_0x542f16){if(_0x542f16){return _0x542f16?{'count':_0x137560,'rows':_0x542f16}:null;}})['then'](respondWithResult(_0xf919de,null))[_0x379d('0x43')](handleError(_0xf919de,null));}; \ No newline at end of file +var _0xa473=['stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','getFields','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x6e9028,_0x4f3ed8){var _0x489dad=function(_0x169fe4){while(--_0x169fe4){_0x6e9028['push'](_0x6e9028['shift']());}};_0x489dad(++_0x4f3ed8);}(_0xa473,0x1cb));var _0x3a47=function(_0x4badab,_0x4d18e5){_0x4badab=_0x4badab-0x0;var _0x1421a9=_0xa473[_0x4badab];return _0x1421a9;};'use strict';var emlformat=require(_0x3a47('0x0'));var rimraf=require(_0x3a47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a47('0x2'));var rp=require(_0x3a47('0x3'));var moment=require('moment');var BPromise=require(_0x3a47('0x4'));var Mustache=require(_0x3a47('0x5'));var util=require(_0x3a47('0x6'));var path=require(_0x3a47('0x7'));var sox=require(_0x3a47('0x8'));var csv=require('to-csv');var ejs=require(_0x3a47('0x9'));var fs=require('fs');var fs_extra=require(_0x3a47('0xa'));var _=require(_0x3a47('0xb'));var squel=require(_0x3a47('0xc'));var crypto=require(_0x3a47('0xd'));var jsforce=require(_0x3a47('0xe'));var deskjs=require(_0x3a47('0xf'));var toCsv=require(_0x3a47('0x10'));var querystring=require(_0x3a47('0x11'));var Papa=require(_0x3a47('0x12'));var Redis=require(_0x3a47('0x13'));var authService=require(_0x3a47('0x14'));var qs=require(_0x3a47('0x15'));var as=require(_0x3a47('0x16'));var hardwareService=require(_0x3a47('0x17'));var logger=require(_0x3a47('0x18'))(_0x3a47('0x19'));var utils=require(_0x3a47('0x1a'));var config=require(_0x3a47('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53aacc,_0x1aa412){_0x1aa412=_0x1aa412||0xcc;return function(_0x3bd420){if(_0x3bd420){return _0x53aacc[_0x3a47('0x1c')](_0x1aa412);}return _0x53aacc[_0x3a47('0x1d')](_0x1aa412)[_0x3a47('0x1e')]();};}function respondWithResult(_0xa23105,_0x17aa1e){_0x17aa1e=_0x17aa1e||0xc8;return function(_0x28c822){if(_0x28c822){return _0xa23105[_0x3a47('0x1d')](_0x17aa1e)[_0x3a47('0x1f')](_0x28c822);}};}function respondWithFilteredResult(_0x1c00a5,_0x57efe4){return function(_0x4d6964){if(_0x4d6964){var _0x48182c=typeof _0x57efe4['offset']===_0x3a47('0x20')&&typeof _0x57efe4[_0x3a47('0x21')]===_0x3a47('0x20');var _0xf44ccd=_0x4d6964[_0x3a47('0x22')];var _0x1d3347=_0x48182c?0x0:_0x57efe4['offset'];var _0x4a5418=_0x48182c?_0x4d6964['count']:_0x57efe4[_0x3a47('0x23')]+_0x57efe4[_0x3a47('0x21')];var _0x584c23;if(_0x4a5418>=_0xf44ccd){_0x4a5418=_0xf44ccd;_0x584c23=0xc8;}else{_0x584c23=0xce;}_0x1c00a5['status'](_0x584c23);return _0x1c00a5[_0x3a47('0x24')](_0x3a47('0x25'),_0x1d3347+'-'+_0x4a5418+'/'+_0xf44ccd)[_0x3a47('0x1f')](_0x4d6964);}return null;};}function patchUpdates(_0x16b16b){return function(_0x40c629){try{jsonpatch[_0x3a47('0x26')](_0x40c629,_0x16b16b,!![]);}catch(_0x5def0d){return BPromise[_0x3a47('0x27')](_0x5def0d);}return _0x40c629[_0x3a47('0x28')]();};}function saveUpdates(_0x257ec2,_0x79cdfd){return function(_0x2614b8){if(_0x2614b8){return _0x2614b8[_0x3a47('0x29')](_0x257ec2)[_0x3a47('0x2a')](function(_0x5dc1c7){return _0x5dc1c7;});}return null;};}function removeEntity(_0x66b78,_0x547831){return function(_0x519379){if(_0x519379){return _0x519379[_0x3a47('0x2b')]()[_0x3a47('0x2a')](function(){_0x66b78[_0x3a47('0x1d')](0xcc)[_0x3a47('0x1e')]();});}};}function handleEntityNotFound(_0x1db0ef,_0xb3adcf){return function(_0x2dad9a){if(!_0x2dad9a){_0x1db0ef['sendStatus'](0x194);}return _0x2dad9a;};}function handleError(_0x3cfecd,_0x5e68cf){_0x5e68cf=_0x5e68cf||0x1f4;return function(_0x105cb7){logger[_0x3a47('0x2c')](_0x105cb7[_0x3a47('0x2d')]);if(_0x105cb7[_0x3a47('0x2e')]){delete _0x105cb7['name'];}_0x3cfecd[_0x3a47('0x1d')](_0x5e68cf)['send'](_0x105cb7);};}exports['index']=function(_0x4259d1,_0x263f3f){var _0x1a9693={},_0x155fdf={},_0x4d97aa={'count':0x0,'rows':[]};var _0x43af39=_[_0x3a47('0x2f')](db[_0x3a47('0x30')][_0x3a47('0x31')],function(_0x573710){return{'name':_0x573710[_0x3a47('0x32')],'type':_0x573710[_0x3a47('0x33')]['key']};});_0x155fdf[_0x3a47('0x34')]=_[_0x3a47('0x2f')](_0x43af39,'name');_0x155fdf[_0x3a47('0x35')]=_[_0x3a47('0x36')](_0x4259d1['query']);_0x155fdf['filters']=_[_0x3a47('0x37')](_0x155fdf[_0x3a47('0x34')],_0x155fdf[_0x3a47('0x35')]);_0x1a9693[_0x3a47('0x38')]=_[_0x3a47('0x37')](_0x155fdf[_0x3a47('0x34')],qs[_0x3a47('0x39')](_0x4259d1[_0x3a47('0x35')][_0x3a47('0x39')]));_0x1a9693[_0x3a47('0x38')]=_0x1a9693[_0x3a47('0x38')]['length']?_0x1a9693['attributes']:_0x155fdf[_0x3a47('0x34')];if(!_0x4259d1[_0x3a47('0x35')][_0x3a47('0x3a')](_0x3a47('0x3b'))){_0x1a9693['limit']=qs[_0x3a47('0x21')](_0x4259d1[_0x3a47('0x35')][_0x3a47('0x21')]);_0x1a9693[_0x3a47('0x23')]=qs[_0x3a47('0x23')](_0x4259d1[_0x3a47('0x35')][_0x3a47('0x23')]);}_0x1a9693[_0x3a47('0x3c')]=qs['sort'](_0x4259d1[_0x3a47('0x35')][_0x3a47('0x3d')]);_0x1a9693[_0x3a47('0x3e')]=qs[_0x3a47('0x3f')](_[_0x3a47('0x40')](_0x4259d1[_0x3a47('0x35')],_0x155fdf[_0x3a47('0x3f')]),_0x43af39);if(_0x4259d1[_0x3a47('0x35')][_0x3a47('0x41')]){_0x1a9693[_0x3a47('0x3e')]=_[_0x3a47('0x42')](_0x1a9693[_0x3a47('0x3e')],{'$or':_[_0x3a47('0x2f')](_0x43af39,function(_0xbc8ef7){if(_0xbc8ef7[_0x3a47('0x33')]!==_0x3a47('0x43')){var _0xd4f927={};_0xd4f927[_0xbc8ef7['name']]={'$like':'%'+_0x4259d1['query'][_0x3a47('0x41')]+'%'};return _0xd4f927;}})});}_0x1a9693=_[_0x3a47('0x42')]({},_0x1a9693,_0x4259d1[_0x3a47('0x44')]);var _0x2984ef={'where':_0x1a9693[_0x3a47('0x3e')]};return db['VtigerConfiguration']['count'](_0x2984ef)[_0x3a47('0x2a')](function(_0x3a6e12){_0x4d97aa[_0x3a47('0x22')]=_0x3a6e12;if(_0x4259d1[_0x3a47('0x35')][_0x3a47('0x45')]){_0x1a9693[_0x3a47('0x46')]=[{'all':!![]}];}return db[_0x3a47('0x30')][_0x3a47('0x47')](_0x1a9693);})['then'](function(_0x3d1707){_0x4d97aa[_0x3a47('0x48')]=_0x3d1707;return _0x4d97aa;})['then'](respondWithFilteredResult(_0x263f3f,_0x1a9693))['catch'](handleError(_0x263f3f,null));};exports[_0x3a47('0x49')]=function(_0x4824b4,_0x4836e8){var _0x27b11a={'raw':![],'where':{'id':_0x4824b4['params']['id']}},_0x21571e={};_0x21571e[_0x3a47('0x34')]=_[_0x3a47('0x36')](db[_0x3a47('0x30')]['rawAttributes']);_0x21571e[_0x3a47('0x35')]=_[_0x3a47('0x36')](_0x4824b4[_0x3a47('0x35')]);_0x21571e[_0x3a47('0x3f')]=_['intersection'](_0x21571e['model'],_0x21571e[_0x3a47('0x35')]);_0x27b11a[_0x3a47('0x38')]=_[_0x3a47('0x37')](_0x21571e[_0x3a47('0x34')],qs[_0x3a47('0x39')](_0x4824b4[_0x3a47('0x35')][_0x3a47('0x39')]));_0x27b11a[_0x3a47('0x38')]=_0x27b11a[_0x3a47('0x38')][_0x3a47('0x4a')]?_0x27b11a[_0x3a47('0x38')]:_0x21571e['model'];if(_0x4824b4[_0x3a47('0x35')][_0x3a47('0x45')]){_0x27b11a[_0x3a47('0x46')]=[{'all':!![]}];}_0x27b11a=_[_0x3a47('0x42')]({},_0x27b11a,_0x4824b4[_0x3a47('0x44')]);return db[_0x3a47('0x30')]['find'](_0x27b11a)[_0x3a47('0x2a')](handleEntityNotFound(_0x4836e8,null))['then'](respondWithResult(_0x4836e8,null))[_0x3a47('0x4b')](handleError(_0x4836e8,null));};exports['create']=function(_0x5104fc,_0x1672ec){return db[_0x3a47('0x30')][_0x3a47('0x4c')](_0x5104fc[_0x3a47('0x4d')],{})[_0x3a47('0x2a')](respondWithResult(_0x1672ec,0xc9))[_0x3a47('0x4b')](handleError(_0x1672ec,null));};exports[_0x3a47('0x29')]=function(_0x32af01,_0x5b4275){if(_0x32af01[_0x3a47('0x4d')]['id']){delete _0x32af01[_0x3a47('0x4d')]['id'];}return db[_0x3a47('0x30')][_0x3a47('0x4e')]({'where':{'id':_0x32af01[_0x3a47('0x4f')]['id']}})[_0x3a47('0x2a')](handleEntityNotFound(_0x5b4275,null))[_0x3a47('0x2a')](saveUpdates(_0x32af01['body'],null))[_0x3a47('0x2a')](respondWithResult(_0x5b4275,null))[_0x3a47('0x4b')](handleError(_0x5b4275,null));};exports[_0x3a47('0x2b')]=function(_0x4afb77,_0x21cddb){return db[_0x3a47('0x30')][_0x3a47('0x4e')]({'where':{'id':_0x4afb77[_0x3a47('0x4f')]['id']}})[_0x3a47('0x2a')](handleEntityNotFound(_0x21cddb,null))['then'](removeEntity(_0x21cddb,null))[_0x3a47('0x4b')](handleError(_0x21cddb,null));};exports[_0x3a47('0x50')]=function(_0x119c72,_0x1475e9,_0x22d804){var _0x247170={};var _0xa7fa49={};var _0x13f639;var _0x5186bb;return db[_0x3a47('0x30')]['findOne']({'where':{'id':_0x119c72[_0x3a47('0x4f')]['id']}})[_0x3a47('0x2a')](handleEntityNotFound(_0x1475e9,null))[_0x3a47('0x2a')](function(_0x2a7d88){if(_0x2a7d88){_0x13f639=_0x2a7d88;_0xa7fa49[_0x3a47('0x34')]=_['keys'](db[_0x3a47('0x51')][_0x3a47('0x31')]);_0xa7fa49[_0x3a47('0x35')]=_['keys'](_0x119c72[_0x3a47('0x35')]);_0xa7fa49[_0x3a47('0x3f')]=_[_0x3a47('0x37')](_0xa7fa49['model'],_0xa7fa49[_0x3a47('0x35')]);_0x247170['attributes']=_[_0x3a47('0x37')](_0xa7fa49[_0x3a47('0x34')],qs[_0x3a47('0x39')](_0x119c72[_0x3a47('0x35')]['fields']));_0x247170[_0x3a47('0x38')]=_0x247170['attributes']['length']?_0x247170[_0x3a47('0x38')]:_0xa7fa49[_0x3a47('0x34')];_0x247170['order']=qs['sort'](_0x119c72[_0x3a47('0x35')][_0x3a47('0x3d')]);_0x247170[_0x3a47('0x3e')]=qs['filters'](_[_0x3a47('0x40')](_0x119c72['query'],_0xa7fa49[_0x3a47('0x3f')]));if(_0x119c72[_0x3a47('0x35')][_0x3a47('0x41')]){_0x247170[_0x3a47('0x3e')]=_[_0x3a47('0x42')](_0x247170[_0x3a47('0x3e')],{'$or':_[_0x3a47('0x2f')](_0x247170[_0x3a47('0x38')],function(_0x451797){var _0x50b7d4={};_0x50b7d4[_0x451797]={'$like':'%'+_0x119c72[_0x3a47('0x35')]['filter']+'%'};return _0x50b7d4;})});}_0x247170=_[_0x3a47('0x42')]({},_0x247170,_0x119c72[_0x3a47('0x44')]);return _0x13f639[_0x3a47('0x50')](_0x247170);}})[_0x3a47('0x2a')](function(_0x3c8597){if(_0x3c8597){_0x5186bb=_0x3c8597[_0x3a47('0x4a')];if(!_0x119c72[_0x3a47('0x35')][_0x3a47('0x3a')]('nolimit')){_0x247170[_0x3a47('0x21')]=qs[_0x3a47('0x21')](_0x119c72['query'][_0x3a47('0x21')]);_0x247170[_0x3a47('0x23')]=qs['offset'](_0x119c72[_0x3a47('0x35')][_0x3a47('0x23')]);}return _0x13f639[_0x3a47('0x50')](_0x247170);}})[_0x3a47('0x2a')](function(_0x59eb91){if(_0x59eb91){return _0x59eb91?{'count':_0x5186bb,'rows':_0x59eb91}:null;}})['then'](respondWithResult(_0x1475e9,null))[_0x3a47('0x4b')](handleError(_0x1475e9,null));};exports[_0x3a47('0x52')]=function(_0x151d9f,_0x20c0bd,_0x24bbac){var _0xb1d8f0={};var _0x5922cf={};var _0x3ac029;var _0x27b5a3;return db[_0x3a47('0x30')]['findOne']({'where':{'id':_0x151d9f[_0x3a47('0x4f')]['id']}})[_0x3a47('0x2a')](handleEntityNotFound(_0x20c0bd,null))[_0x3a47('0x2a')](function(_0x129e30){if(_0x129e30){_0x3ac029=_0x129e30;_0x5922cf[_0x3a47('0x34')]=_[_0x3a47('0x36')](db[_0x3a47('0x51')][_0x3a47('0x31')]);_0x5922cf[_0x3a47('0x35')]=_[_0x3a47('0x36')](_0x151d9f['query']);_0x5922cf[_0x3a47('0x3f')]=_[_0x3a47('0x37')](_0x5922cf[_0x3a47('0x34')],_0x5922cf[_0x3a47('0x35')]);_0xb1d8f0[_0x3a47('0x38')]=_[_0x3a47('0x37')](_0x5922cf[_0x3a47('0x34')],qs[_0x3a47('0x39')](_0x151d9f[_0x3a47('0x35')][_0x3a47('0x39')]));_0xb1d8f0[_0x3a47('0x38')]=_0xb1d8f0[_0x3a47('0x38')][_0x3a47('0x4a')]?_0xb1d8f0[_0x3a47('0x38')]:_0x5922cf[_0x3a47('0x34')];_0xb1d8f0[_0x3a47('0x3c')]=qs[_0x3a47('0x3d')](_0x151d9f['query'][_0x3a47('0x3d')]);_0xb1d8f0['where']=qs[_0x3a47('0x3f')](_[_0x3a47('0x40')](_0x151d9f[_0x3a47('0x35')],_0x5922cf[_0x3a47('0x3f')]));if(_0x151d9f['query'][_0x3a47('0x41')]){_0xb1d8f0[_0x3a47('0x3e')]=_[_0x3a47('0x42')](_0xb1d8f0['where'],{'$or':_['map'](_0xb1d8f0[_0x3a47('0x38')],function(_0x4f44db){var _0xd3ef3={};_0xd3ef3[_0x4f44db]={'$like':'%'+_0x151d9f['query']['filter']+'%'};return _0xd3ef3;})});}_0xb1d8f0=_[_0x3a47('0x42')]({},_0xb1d8f0,_0x151d9f['options']);return _0x3ac029[_0x3a47('0x52')](_0xb1d8f0);}})['then'](function(_0x36157d){if(_0x36157d){_0x27b5a3=_0x36157d[_0x3a47('0x4a')];if(!_0x151d9f[_0x3a47('0x35')][_0x3a47('0x3a')](_0x3a47('0x3b'))){_0xb1d8f0[_0x3a47('0x21')]=qs[_0x3a47('0x21')](_0x151d9f['query'][_0x3a47('0x21')]);_0xb1d8f0[_0x3a47('0x23')]=qs[_0x3a47('0x23')](_0x151d9f[_0x3a47('0x35')][_0x3a47('0x23')]);}return _0x3ac029[_0x3a47('0x52')](_0xb1d8f0);}})[_0x3a47('0x2a')](function(_0x113689){if(_0x113689){return _0x113689?{'count':_0x27b5a3,'rows':_0x113689}:null;}})[_0x3a47('0x2a')](respondWithResult(_0x20c0bd,null))[_0x3a47('0x4b')](handleError(_0x20c0bd,null));};exports[_0x3a47('0x53')]=function(_0x4f2700,_0x41fc35,_0x59310c){var _0x4b90c4={};var _0x58ea60={};var _0x695764;var _0x4ef6b5;return db[_0x3a47('0x30')]['findOne']({'where':{'id':_0x4f2700['params']['id']}})[_0x3a47('0x2a')](handleEntityNotFound(_0x41fc35,null))[_0x3a47('0x2a')](function(_0x37948b){if(_0x37948b){_0x695764=_0x37948b;_0x58ea60[_0x3a47('0x34')]=_[_0x3a47('0x36')](db['VtigerField'][_0x3a47('0x31')]);_0x58ea60[_0x3a47('0x35')]=_[_0x3a47('0x36')](_0x4f2700[_0x3a47('0x35')]);_0x58ea60[_0x3a47('0x3f')]=_['intersection'](_0x58ea60[_0x3a47('0x34')],_0x58ea60[_0x3a47('0x35')]);_0x4b90c4[_0x3a47('0x38')]=_[_0x3a47('0x37')](_0x58ea60[_0x3a47('0x34')],qs[_0x3a47('0x39')](_0x4f2700[_0x3a47('0x35')]['fields']));_0x4b90c4['attributes']=_0x4b90c4[_0x3a47('0x38')]['length']?_0x4b90c4['attributes']:_0x58ea60[_0x3a47('0x34')];_0x4b90c4[_0x3a47('0x3c')]=qs[_0x3a47('0x3d')](_0x4f2700[_0x3a47('0x35')][_0x3a47('0x3d')]);_0x4b90c4[_0x3a47('0x3e')]=qs[_0x3a47('0x3f')](_['pick'](_0x4f2700[_0x3a47('0x35')],_0x58ea60['filters']));if(_0x4f2700[_0x3a47('0x35')]['filter']){_0x4b90c4['where']=_[_0x3a47('0x42')](_0x4b90c4[_0x3a47('0x3e')],{'$or':_['map'](_0x4b90c4['attributes'],function(_0x19ba7a){var _0x1527e3={};_0x1527e3[_0x19ba7a]={'$like':'%'+_0x4f2700[_0x3a47('0x35')][_0x3a47('0x41')]+'%'};return _0x1527e3;})});}_0x4b90c4=_[_0x3a47('0x42')]({},_0x4b90c4,_0x4f2700['options']);return _0x695764['getDescriptions'](_0x4b90c4);}})[_0x3a47('0x2a')](function(_0x13054f){if(_0x13054f){_0x4ef6b5=_0x13054f[_0x3a47('0x4a')];if(!_0x4f2700[_0x3a47('0x35')][_0x3a47('0x3a')](_0x3a47('0x3b'))){_0x4b90c4[_0x3a47('0x21')]=qs[_0x3a47('0x21')](_0x4f2700['query']['limit']);_0x4b90c4['offset']=qs[_0x3a47('0x23')](_0x4f2700[_0x3a47('0x35')][_0x3a47('0x23')]);}return _0x695764['getDescriptions'](_0x4b90c4);}})['then'](function(_0x5bb5d5){if(_0x5bb5d5){return _0x5bb5d5?{'count':_0x4ef6b5,'rows':_0x5bb5d5}:null;}})[_0x3a47('0x2a')](respondWithResult(_0x41fc35,null))[_0x3a47('0x4b')](handleError(_0x41fc35,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d06b2ff..3e252d0 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 _0x12b0=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x12b0,0x7a));var _0x012b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x12b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x012b('0x0'));var util=require(_0x012b('0x1'));var logger=require('../../config/logger')(_0x012b('0x2'));var moment=require(_0x012b('0x3'));var BPromise=require(_0x012b('0x4'));var rp=require(_0x012b('0x5'));var fs=require('fs');var path=require(_0x012b('0x6'));var rimraf=require(_0x012b('0x7'));var config=require('../../config/environment');var attributes=require(_0x012b('0x8'));module[_0x012b('0x9')]=function(_0xf748f,_0x471939){return _0xf748f[_0x012b('0xa')](_0x012b('0xb'),attributes,{'tableName':_0x012b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x269e=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x269e,0x18e));var _0xe269=function(_0x51b9b9,_0x341f06){_0x51b9b9=_0x51b9b9-0x0;var _0xa6c5e0=_0x269e[_0x51b9b9];return _0xa6c5e0;};'use strict';var _=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var logger=require('../../config/logger')(_0xe269('0x2'));var moment=require(_0xe269('0x3'));var BPromise=require(_0xe269('0x4'));var rp=require(_0xe269('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe269('0x6'));var config=require(_0xe269('0x7'));var attributes=require(_0xe269('0x8'));module['exports']=function(_0x356a30,_0x2d1e1f){return _0x356a30['define'](_0xe269('0x9'),attributes,{'tableName':_0xe269('0xa'),'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 c8c5249..6dd7e5f 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 _0x8134=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','ioredis'];(function(_0x239886,_0x1d149e){var _0x485f72=function(_0xe2b124){while(--_0xe2b124){_0x239886['push'](_0x239886['shift']());}};_0x485f72(++_0x1d149e);}(_0x8134,0xb1));var _0x4813=function(_0x1a8c0c,_0x58ee9e){_0x1a8c0c=_0x1a8c0c-0x0;var _0x2c108b=_0x8134[_0x1a8c0c];return _0x2c108b;};'use strict';var _=require('lodash');var util=require(_0x4813('0x0'));var moment=require('moment');var BPromise=require(_0x4813('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4813('0x2'));var db=require(_0x4813('0x3'))['db'];var utils=require(_0x4813('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4813('0x5'));var jayson=require(_0x4813('0x6'));var client=jayson[_0x4813('0x7')][_0x4813('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37a4ed,_0x560cd2,_0x4901b7){return new BPromise(function(_0x30a948,_0x14bf03){return client['request'](_0x37a4ed,_0x4901b7)[_0x4813('0x9')](function(_0x47a6be){logger[_0x4813('0xa')](_0x4813('0xb'),_0x560cd2,_0x4813('0xc'));logger[_0x4813('0xd')](_0x4813('0xe'),_0x560cd2,_0x4813('0xc'),JSON['stringify'](_0x47a6be));if(_0x47a6be[_0x4813('0xf')]){if(_0x47a6be[_0x4813('0xf')][_0x4813('0x10')]===0x1f4){logger[_0x4813('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x560cd2,_0x47a6be['error'][_0x4813('0x11')]);return _0x14bf03(_0x47a6be[_0x4813('0xf')][_0x4813('0x11')]);}logger['error'](_0x4813('0xb'),_0x560cd2,_0x47a6be[_0x4813('0xf')][_0x4813('0x11')]);return _0x30a948(_0x47a6be[_0x4813('0xf')]['message']);}else{logger[_0x4813('0xa')](_0x4813('0xb'),_0x560cd2,_0x4813('0xc'));_0x30a948(_0x47a6be[_0x4813('0x12')][_0x4813('0x11')]);}})[_0x4813('0x13')](function(_0x7c15f4){logger[_0x4813('0xf')](_0x4813('0xb'),_0x560cd2,_0x7c15f4);_0x14bf03(_0x7c15f4);});});} \ No newline at end of file +var _0xdad6=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x187fdf,_0x100c80){var _0x1d9036=function(_0x22a351){while(--_0x22a351){_0x187fdf['push'](_0x187fdf['shift']());}};_0x1d9036(++_0x100c80);}(_0xdad6,0x103));var _0x6dad=function(_0x52570,_0xec72f7){_0x52570=_0x52570-0x0;var _0x4b335f=_0xdad6[_0x52570];return _0x4b335f;};'use strict';var _=require(_0x6dad('0x0'));var util=require(_0x6dad('0x1'));var moment=require('moment');var BPromise=require(_0x6dad('0x2'));var rs=require(_0x6dad('0x3'));var fs=require('fs');var Redis=require(_0x6dad('0x4'));var db=require(_0x6dad('0x5'))['db'];var utils=require(_0x6dad('0x6'));var logger=require('../../config/logger')(_0x6dad('0x7'));var config=require(_0x6dad('0x8'));var jayson=require(_0x6dad('0x9'));var client=jayson[_0x6dad('0xa')][_0x6dad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x499d63,_0x38d7c1,_0x2e3aae){return new BPromise(function(_0x173aca,_0x12fe58){return client[_0x6dad('0xc')](_0x499d63,_0x2e3aae)[_0x6dad('0xd')](function(_0x44d3ac){logger[_0x6dad('0xe')](_0x6dad('0xf'),_0x38d7c1,_0x6dad('0x10'));logger['debug'](_0x6dad('0x11'),_0x38d7c1,'request\x20sent',JSON[_0x6dad('0x12')](_0x44d3ac));if(_0x44d3ac[_0x6dad('0x13')]){if(_0x44d3ac[_0x6dad('0x13')][_0x6dad('0x14')]===0x1f4){logger[_0x6dad('0x13')](_0x6dad('0xf'),_0x38d7c1,_0x44d3ac[_0x6dad('0x13')]['message']);return _0x12fe58(_0x44d3ac[_0x6dad('0x13')][_0x6dad('0x15')]);}logger[_0x6dad('0x13')](_0x6dad('0xf'),_0x38d7c1,_0x44d3ac['error'][_0x6dad('0x15')]);return _0x173aca(_0x44d3ac[_0x6dad('0x13')][_0x6dad('0x15')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x38d7c1,'request\x20sent');_0x173aca(_0x44d3ac['result'][_0x6dad('0x15')]);}})[_0x6dad('0x16')](function(_0x1cff70){logger[_0x6dad('0x13')](_0x6dad('0xf'),_0x38d7c1,_0x1cff70);_0x12fe58(_0x1cff70);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index cad2b5a..07f8a60 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 _0xa996=['express','Router','../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa996,0x1ed));var _0x6a99=function(_0x3955c7,_0x5a892f){_0x3955c7=_0x3955c7-0x0;var _0x38cbb1=_0xa996[_0x3955c7];return _0x38cbb1;};'use strict';var multer=require(_0x6a99('0x0'));var util=require('util');var path=require(_0x6a99('0x1'));var timeout=require(_0x6a99('0x2'));var express=require(_0x6a99('0x3'));var router=express[_0x6a99('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a99('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6a99('0x6'));router[_0x6a99('0x7')]('/',auth[_0x6a99('0x8')](),controller[_0x6a99('0x9')]);router['get'](_0x6a99('0xa'),auth[_0x6a99('0x8')](),controller['show']);router[_0x6a99('0xb')]('/',auth[_0x6a99('0x8')](),controller[_0x6a99('0xc')]);router[_0x6a99('0xd')](_0x6a99('0xa'),auth[_0x6a99('0x8')](),controller[_0x6a99('0xe')]);router['delete'](_0x6a99('0xa'),auth[_0x6a99('0x8')](),controller[_0x6a99('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6ab7=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x6ab7,0x13f));var _0x76ab=function(_0x421ce6,_0x360b2f){_0x421ce6=_0x421ce6-0x0;var _0x41946e=_0x6ab7[_0x421ce6];return _0x41946e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76ab('0x0'));var timeout=require(_0x76ab('0x1'));var express=require(_0x76ab('0x2'));var router=express[_0x76ab('0x3')]();var fs_extra=require(_0x76ab('0x4'));var auth=require(_0x76ab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x76ab('0x6'));var controller=require('./intVtigerField.controller');router[_0x76ab('0x7')]('/',auth[_0x76ab('0x8')](),controller['index']);router[_0x76ab('0x7')](_0x76ab('0x9'),auth[_0x76ab('0x8')](),controller[_0x76ab('0xa')]);router[_0x76ab('0xb')]('/',auth[_0x76ab('0x8')](),controller[_0x76ab('0xc')]);router[_0x76ab('0xd')]('/:id',auth[_0x76ab('0x8')](),controller[_0x76ab('0xe')]);router[_0x76ab('0xf')]('/:id',auth[_0x76ab('0x8')](),controller[_0x76ab('0x10')]);module[_0x76ab('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8cf623b..6ffd089 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 _0xf837=['string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x552214,_0x272f86){var _0x3131a9=function(_0x3ddf50){while(--_0x3ddf50){_0x552214['push'](_0x552214['shift']());}};_0x3131a9(++_0x272f86);}(_0xf837,0x84));var _0x7f83=function(_0x1c6145,_0x410a9d){_0x1c6145=_0x1c6145-0x0;var _0x224655=_0xf837[_0x1c6145];return _0x224655;};'use strict';var Sequelize=require(_0x7f83('0x0'));module[_0x7f83('0x1')]={'type':{'type':Sequelize[_0x7f83('0x2')](_0x7f83('0x3'),_0x7f83('0x4'),'customVariable','keyValue',_0x7f83('0x5')),'defaultValue':_0x7f83('0x3')},'content':{'type':Sequelize[_0x7f83('0x6')]},'key':{'type':Sequelize[_0x7f83('0x6')]},'keyType':{'type':Sequelize[_0x7f83('0x2')]('string','variable',_0x7f83('0x7'))},'keyContent':{'type':Sequelize[_0x7f83('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7f83('0x6')]},'customField':{'type':Sequelize[_0x7f83('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd34=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x47e397,_0x3a9721){var _0x6528f2=function(_0x2814ac){while(--_0x2814ac){_0x47e397['push'](_0x47e397['shift']());}};_0x6528f2(++_0x3a9721);}(_0xfd34,0x1ec));var _0x4fd3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfd34[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x4fd3('0x0'));module['exports']={'type':{'type':Sequelize[_0x4fd3('0x1')](_0x4fd3('0x2'),_0x4fd3('0x3'),_0x4fd3('0x4'),_0x4fd3('0x5'),_0x4fd3('0x6')),'defaultValue':_0x4fd3('0x2')},'content':{'type':Sequelize[_0x4fd3('0x7')]},'key':{'type':Sequelize[_0x4fd3('0x7')]},'keyType':{'type':Sequelize[_0x4fd3('0x1')]('string','variable',_0x4fd3('0x4'))},'keyContent':{'type':Sequelize[_0x4fd3('0x7')]},'idField':{'type':Sequelize[_0x4fd3('0x7')]},'nameField':{'type':Sequelize[_0x4fd3('0x7')]},'customField':{'type':Sequelize[_0x4fd3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fd3('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 505ce35..6577c05 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 _0x3de4=['map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','VtigerField','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','model'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x3de4,0xab));var _0x43de=function(_0x643324,_0x1f51af){_0x643324=_0x643324-0x0;var _0x56f4cc=_0x3de4[_0x643324];return _0x56f4cc;};'use strict';var emlformat=require(_0x43de('0x0'));var rimraf=require(_0x43de('0x1'));var zipdir=require(_0x43de('0x2'));var jsonpatch=require(_0x43de('0x3'));var rp=require(_0x43de('0x4'));var moment=require(_0x43de('0x5'));var BPromise=require(_0x43de('0x6'));var Mustache=require(_0x43de('0x7'));var util=require(_0x43de('0x8'));var path=require(_0x43de('0x9'));var sox=require('sox');var csv=require(_0x43de('0xa'));var ejs=require(_0x43de('0xb'));var fs=require('fs');var fs_extra=require(_0x43de('0xc'));var _=require(_0x43de('0xd'));var squel=require(_0x43de('0xe'));var crypto=require(_0x43de('0xf'));var jsforce=require(_0x43de('0x10'));var deskjs=require(_0x43de('0x11'));var toCsv=require(_0x43de('0xa'));var querystring=require(_0x43de('0x12'));var Papa=require('papaparse');var Redis=require(_0x43de('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43de('0x14'));var hardwareService=require(_0x43de('0x15'));var logger=require('../../config/logger')(_0x43de('0x16'));var utils=require(_0x43de('0x17'));var config=require(_0x43de('0x18'));var licenseUtil=require(_0x43de('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498f5f,_0x3f1071){_0x3f1071=_0x3f1071||0xcc;return function(_0x5de63e){if(_0x5de63e){return _0x498f5f[_0x43de('0x1a')](_0x3f1071);}return _0x498f5f[_0x43de('0x1b')](_0x3f1071)[_0x43de('0x1c')]();};}function respondWithResult(_0x346b9f,_0x564b08){_0x564b08=_0x564b08||0xc8;return function(_0x3f9532){if(_0x3f9532){return _0x346b9f['status'](_0x564b08)[_0x43de('0x1d')](_0x3f9532);}};}function respondWithFilteredResult(_0x59e053,_0x5a9514){return function(_0x27b694){if(_0x27b694){var _0x4c03cd=typeof _0x5a9514['offset']===_0x43de('0x1e')&&typeof _0x5a9514['limit']===_0x43de('0x1e');var _0x59db15=_0x27b694[_0x43de('0x1f')];var _0x4fb406=_0x4c03cd?0x0:_0x5a9514['offset'];var _0x54a5fa=_0x4c03cd?_0x27b694['count']:_0x5a9514[_0x43de('0x20')]+_0x5a9514[_0x43de('0x21')];var _0x187f93;if(_0x54a5fa>=_0x59db15){_0x54a5fa=_0x59db15;_0x187f93=0xc8;}else{_0x187f93=0xce;}_0x59e053[_0x43de('0x1b')](_0x187f93);return _0x59e053[_0x43de('0x22')](_0x43de('0x23'),_0x4fb406+'-'+_0x54a5fa+'/'+_0x59db15)[_0x43de('0x1d')](_0x27b694);}return null;};}function patchUpdates(_0x4d5cdb){return function(_0x1fbde9){try{jsonpatch[_0x43de('0x24')](_0x1fbde9,_0x4d5cdb,!![]);}catch(_0x423be5){return BPromise[_0x43de('0x25')](_0x423be5);}return _0x1fbde9['save']();};}function saveUpdates(_0x3f0d1a,_0x255c94){return function(_0x2701fe){if(_0x2701fe){return _0x2701fe[_0x43de('0x26')](_0x3f0d1a)[_0x43de('0x27')](function(_0x952e7){return _0x952e7;});}return null;};}function removeEntity(_0x4a5e2d,_0x2e0a37){return function(_0x182e18){if(_0x182e18){return _0x182e18[_0x43de('0x28')]()['then'](function(){_0x4a5e2d[_0x43de('0x1b')](0xcc)[_0x43de('0x1c')]();});}};}function handleEntityNotFound(_0x228aae,_0x112141){return function(_0x34add8){if(!_0x34add8){_0x228aae['sendStatus'](0x194);}return _0x34add8;};}function handleError(_0x4dd5da,_0x5e32a1){_0x5e32a1=_0x5e32a1||0x1f4;return function(_0x2f62e4){logger['error'](_0x2f62e4[_0x43de('0x29')]);if(_0x2f62e4[_0x43de('0x2a')]){delete _0x2f62e4[_0x43de('0x2a')];}_0x4dd5da['status'](_0x5e32a1)[_0x43de('0x2b')](_0x2f62e4);};}exports['index']=function(_0x319177,_0x4c3350){var _0x3aa27b={},_0x1db5ca={},_0x16c22e={'count':0x0,'rows':[]};var _0x32fe0c=_['map'](db['VtigerField'][_0x43de('0x2c')],function(_0x2ef646){return{'name':_0x2ef646[_0x43de('0x2d')],'type':_0x2ef646[_0x43de('0x2e')]['key']};});_0x1db5ca[_0x43de('0x2f')]=_[_0x43de('0x30')](_0x32fe0c,_0x43de('0x2a'));_0x1db5ca[_0x43de('0x31')]=_['keys'](_0x319177[_0x43de('0x31')]);_0x1db5ca[_0x43de('0x32')]=_[_0x43de('0x33')](_0x1db5ca[_0x43de('0x2f')],_0x1db5ca[_0x43de('0x31')]);_0x3aa27b['attributes']=_['intersection'](_0x1db5ca[_0x43de('0x2f')],qs[_0x43de('0x34')](_0x319177['query'][_0x43de('0x34')]));_0x3aa27b[_0x43de('0x35')]=_0x3aa27b['attributes'][_0x43de('0x36')]?_0x3aa27b[_0x43de('0x35')]:_0x1db5ca['model'];if(!_0x319177[_0x43de('0x31')]['hasOwnProperty'](_0x43de('0x37'))){_0x3aa27b[_0x43de('0x21')]=qs['limit'](_0x319177['query'][_0x43de('0x21')]);_0x3aa27b['offset']=qs['offset'](_0x319177[_0x43de('0x31')]['offset']);}_0x3aa27b[_0x43de('0x38')]=qs[_0x43de('0x39')](_0x319177[_0x43de('0x31')]['sort']);_0x3aa27b[_0x43de('0x3a')]=qs[_0x43de('0x32')](_[_0x43de('0x3b')](_0x319177[_0x43de('0x31')],_0x1db5ca[_0x43de('0x32')]),_0x32fe0c);if(_0x319177['query'][_0x43de('0x3c')]){_0x3aa27b['where']=_['merge'](_0x3aa27b['where'],{'$or':_['map'](_0x32fe0c,function(_0x261ba8){if(_0x261ba8[_0x43de('0x2e')]!==_0x43de('0x3d')){var _0x18dffd={};_0x18dffd[_0x261ba8[_0x43de('0x2a')]]={'$like':'%'+_0x319177['query'][_0x43de('0x3c')]+'%'};return _0x18dffd;}})});}_0x3aa27b=_[_0x43de('0x3e')]({},_0x3aa27b,_0x319177[_0x43de('0x3f')]);var _0x84992c={'where':_0x3aa27b[_0x43de('0x3a')]};return db['VtigerField']['count'](_0x84992c)[_0x43de('0x27')](function(_0x4149d9){_0x16c22e[_0x43de('0x1f')]=_0x4149d9;if(_0x319177[_0x43de('0x31')][_0x43de('0x40')]){_0x3aa27b[_0x43de('0x41')]=[{'all':!![]}];}return db[_0x43de('0x42')]['findAll'](_0x3aa27b);})[_0x43de('0x27')](function(_0x3ef0ca){_0x16c22e[_0x43de('0x43')]=_0x3ef0ca;return _0x16c22e;})[_0x43de('0x27')](respondWithFilteredResult(_0x4c3350,_0x3aa27b))['catch'](handleError(_0x4c3350,null));};exports['show']=function(_0x95e9b8,_0x40e15d){var _0x564185={'raw':!![],'where':{'id':_0x95e9b8[_0x43de('0x44')]['id']}},_0x1409e5={};_0x1409e5[_0x43de('0x2f')]=_['keys'](db['VtigerField'][_0x43de('0x2c')]);_0x1409e5[_0x43de('0x31')]=_['keys'](_0x95e9b8['query']);_0x1409e5[_0x43de('0x32')]=_[_0x43de('0x33')](_0x1409e5[_0x43de('0x2f')],_0x1409e5[_0x43de('0x31')]);_0x564185['attributes']=_[_0x43de('0x33')](_0x1409e5[_0x43de('0x2f')],qs['fields'](_0x95e9b8[_0x43de('0x31')]['fields']));_0x564185[_0x43de('0x35')]=_0x564185[_0x43de('0x35')][_0x43de('0x36')]?_0x564185[_0x43de('0x35')]:_0x1409e5[_0x43de('0x2f')];if(_0x95e9b8['query'][_0x43de('0x40')]){_0x564185['include']=[{'all':!![]}];}_0x564185=_[_0x43de('0x3e')]({},_0x564185,_0x95e9b8[_0x43de('0x3f')]);return db[_0x43de('0x42')][_0x43de('0x45')](_0x564185)[_0x43de('0x27')](handleEntityNotFound(_0x40e15d,null))['then'](respondWithResult(_0x40e15d,null))[_0x43de('0x46')](handleError(_0x40e15d,null));};exports[_0x43de('0x47')]=function(_0xdd828b,_0x16f725){return db['VtigerField'][_0x43de('0x47')](_0xdd828b['body'],{})[_0x43de('0x27')](respondWithResult(_0x16f725,0xc9))[_0x43de('0x46')](handleError(_0x16f725,null));};exports['update']=function(_0x5894b1,_0x1c4781){if(_0x5894b1[_0x43de('0x48')]['id']){delete _0x5894b1[_0x43de('0x48')]['id'];}return db[_0x43de('0x42')]['find']({'where':{'id':_0x5894b1[_0x43de('0x44')]['id']}})[_0x43de('0x27')](handleEntityNotFound(_0x1c4781,null))[_0x43de('0x27')](saveUpdates(_0x5894b1[_0x43de('0x48')],null))[_0x43de('0x27')](respondWithResult(_0x1c4781,null))[_0x43de('0x46')](handleError(_0x1c4781,null));};exports[_0x43de('0x28')]=function(_0x127663,_0x5d1402){return db[_0x43de('0x42')][_0x43de('0x45')]({'where':{'id':_0x127663[_0x43de('0x44')]['id']}})[_0x43de('0x27')](handleEntityNotFound(_0x5d1402,null))[_0x43de('0x27')](removeEntity(_0x5d1402,null))[_0x43de('0x46')](handleError(_0x5d1402,null));}; \ No newline at end of file +var _0x37ab=['where','filter','merge','VIRTUAL','includeAll','VtigerField','findAll','rows','show','keys','include','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','destroy','then','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x37ab,0x193));var _0xb37a=function(_0x2c8972,_0x1aff63){_0x2c8972=_0x2c8972-0x0;var _0x5d1e22=_0x37ab[_0x2c8972];return _0x5d1e22;};'use strict';var emlformat=require(_0xb37a('0x0'));var rimraf=require(_0xb37a('0x1'));var zipdir=require(_0xb37a('0x2'));var jsonpatch=require(_0xb37a('0x3'));var rp=require('request-promise');var moment=require(_0xb37a('0x4'));var BPromise=require(_0xb37a('0x5'));var Mustache=require(_0xb37a('0x6'));var util=require(_0xb37a('0x7'));var path=require('path');var sox=require(_0xb37a('0x8'));var csv=require(_0xb37a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb37a('0xa'));var _=require(_0xb37a('0xb'));var squel=require(_0xb37a('0xc'));var crypto=require(_0xb37a('0xd'));var jsforce=require(_0xb37a('0xe'));var deskjs=require(_0xb37a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb37a('0x10'));var Papa=require(_0xb37a('0x11'));var Redis=require('ioredis');var authService=require(_0xb37a('0x12'));var qs=require(_0xb37a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb37a('0x14'));var logger=require(_0xb37a('0x15'))(_0xb37a('0x16'));var utils=require(_0xb37a('0x17'));var config=require(_0xb37a('0x18'));var licenseUtil=require(_0xb37a('0x19'));var db=require(_0xb37a('0x1a'))['db'];function respondWithStatusCode(_0x241609,_0x182dbc){_0x182dbc=_0x182dbc||0xcc;return function(_0x49cfec){if(_0x49cfec){return _0x241609[_0xb37a('0x1b')](_0x182dbc);}return _0x241609[_0xb37a('0x1c')](_0x182dbc)[_0xb37a('0x1d')]();};}function respondWithResult(_0x155be6,_0x5b68c1){_0x5b68c1=_0x5b68c1||0xc8;return function(_0x555057){if(_0x555057){return _0x155be6[_0xb37a('0x1c')](_0x5b68c1)[_0xb37a('0x1e')](_0x555057);}};}function respondWithFilteredResult(_0x2fe88e,_0x20c2fd){return function(_0x24e8e3){if(_0x24e8e3){var _0x544ca1=typeof _0x20c2fd['offset']===_0xb37a('0x1f')&&typeof _0x20c2fd[_0xb37a('0x20')]===_0xb37a('0x1f');var _0x27e137=_0x24e8e3[_0xb37a('0x21')];var _0x41e5ba=_0x544ca1?0x0:_0x20c2fd['offset'];var _0x314133=_0x544ca1?_0x24e8e3[_0xb37a('0x21')]:_0x20c2fd[_0xb37a('0x22')]+_0x20c2fd['limit'];var _0x255cc4;if(_0x314133>=_0x27e137){_0x314133=_0x27e137;_0x255cc4=0xc8;}else{_0x255cc4=0xce;}_0x2fe88e[_0xb37a('0x1c')](_0x255cc4);return _0x2fe88e[_0xb37a('0x23')]('Content-Range',_0x41e5ba+'-'+_0x314133+'/'+_0x27e137)['json'](_0x24e8e3);}return null;};}function patchUpdates(_0x593dba){return function(_0x3be898){try{jsonpatch['apply'](_0x3be898,_0x593dba,!![]);}catch(_0x39a24d){return BPromise[_0xb37a('0x24')](_0x39a24d);}return _0x3be898[_0xb37a('0x25')]();};}function saveUpdates(_0x1b996a,_0x181cfa){return function(_0x38d483){if(_0x38d483){return _0x38d483['update'](_0x1b996a)['then'](function(_0x39a8ad){return _0x39a8ad;});}return null;};}function removeEntity(_0xf96291,_0x145ecc){return function(_0x3e54ab){if(_0x3e54ab){return _0x3e54ab[_0xb37a('0x26')]()[_0xb37a('0x27')](function(){_0xf96291[_0xb37a('0x1c')](0xcc)[_0xb37a('0x1d')]();});}};}function handleEntityNotFound(_0x48bbbb,_0x34d6a1){return function(_0x4be7b4){if(!_0x4be7b4){_0x48bbbb[_0xb37a('0x1b')](0x194);}return _0x4be7b4;};}function handleError(_0x1409db,_0x13b027){_0x13b027=_0x13b027||0x1f4;return function(_0x546c90){logger[_0xb37a('0x28')](_0x546c90[_0xb37a('0x29')]);if(_0x546c90[_0xb37a('0x2a')]){delete _0x546c90['name'];}_0x1409db['status'](_0x13b027)[_0xb37a('0x2b')](_0x546c90);};}exports[_0xb37a('0x2c')]=function(_0x4a3da2,_0x4b2c5b){var _0x2576c4={},_0x283e95={},_0x288bc4={'count':0x0,'rows':[]};var _0x4350a8=_[_0xb37a('0x2d')](db['VtigerField']['rawAttributes'],function(_0x534446){return{'name':_0x534446['fieldName'],'type':_0x534446[_0xb37a('0x2e')][_0xb37a('0x2f')]};});_0x283e95[_0xb37a('0x30')]=_['map'](_0x4350a8,'name');_0x283e95[_0xb37a('0x31')]=_['keys'](_0x4a3da2['query']);_0x283e95[_0xb37a('0x32')]=_[_0xb37a('0x33')](_0x283e95['model'],_0x283e95[_0xb37a('0x31')]);_0x2576c4['attributes']=_[_0xb37a('0x33')](_0x283e95['model'],qs[_0xb37a('0x34')](_0x4a3da2[_0xb37a('0x31')]['fields']));_0x2576c4[_0xb37a('0x35')]=_0x2576c4[_0xb37a('0x35')][_0xb37a('0x36')]?_0x2576c4[_0xb37a('0x35')]:_0x283e95[_0xb37a('0x30')];if(!_0x4a3da2[_0xb37a('0x31')][_0xb37a('0x37')](_0xb37a('0x38'))){_0x2576c4[_0xb37a('0x20')]=qs[_0xb37a('0x20')](_0x4a3da2[_0xb37a('0x31')]['limit']);_0x2576c4[_0xb37a('0x22')]=qs[_0xb37a('0x22')](_0x4a3da2[_0xb37a('0x31')]['offset']);}_0x2576c4[_0xb37a('0x39')]=qs[_0xb37a('0x3a')](_0x4a3da2['query'][_0xb37a('0x3a')]);_0x2576c4[_0xb37a('0x3b')]=qs[_0xb37a('0x32')](_['pick'](_0x4a3da2['query'],_0x283e95[_0xb37a('0x32')]),_0x4350a8);if(_0x4a3da2[_0xb37a('0x31')][_0xb37a('0x3c')]){_0x2576c4[_0xb37a('0x3b')]=_[_0xb37a('0x3d')](_0x2576c4[_0xb37a('0x3b')],{'$or':_[_0xb37a('0x2d')](_0x4350a8,function(_0x419097){if(_0x419097[_0xb37a('0x2e')]!==_0xb37a('0x3e')){var _0x24e03f={};_0x24e03f[_0x419097[_0xb37a('0x2a')]]={'$like':'%'+_0x4a3da2[_0xb37a('0x31')][_0xb37a('0x3c')]+'%'};return _0x24e03f;}})});}_0x2576c4=_[_0xb37a('0x3d')]({},_0x2576c4,_0x4a3da2['options']);var _0x253782={'where':_0x2576c4[_0xb37a('0x3b')]};return db['VtigerField'][_0xb37a('0x21')](_0x253782)[_0xb37a('0x27')](function(_0x66cc82){_0x288bc4[_0xb37a('0x21')]=_0x66cc82;if(_0x4a3da2[_0xb37a('0x31')][_0xb37a('0x3f')]){_0x2576c4['include']=[{'all':!![]}];}return db[_0xb37a('0x40')][_0xb37a('0x41')](_0x2576c4);})[_0xb37a('0x27')](function(_0x44d159){_0x288bc4[_0xb37a('0x42')]=_0x44d159;return _0x288bc4;})[_0xb37a('0x27')](respondWithFilteredResult(_0x4b2c5b,_0x2576c4))['catch'](handleError(_0x4b2c5b,null));};exports[_0xb37a('0x43')]=function(_0x1bf426,_0x333d51){var _0x5b8fb7={'raw':!![],'where':{'id':_0x1bf426['params']['id']}},_0x57d4ed={};_0x57d4ed[_0xb37a('0x30')]=_[_0xb37a('0x44')](db[_0xb37a('0x40')]['rawAttributes']);_0x57d4ed[_0xb37a('0x31')]=_[_0xb37a('0x44')](_0x1bf426[_0xb37a('0x31')]);_0x57d4ed[_0xb37a('0x32')]=_[_0xb37a('0x33')](_0x57d4ed[_0xb37a('0x30')],_0x57d4ed[_0xb37a('0x31')]);_0x5b8fb7[_0xb37a('0x35')]=_[_0xb37a('0x33')](_0x57d4ed['model'],qs[_0xb37a('0x34')](_0x1bf426['query'][_0xb37a('0x34')]));_0x5b8fb7[_0xb37a('0x35')]=_0x5b8fb7[_0xb37a('0x35')][_0xb37a('0x36')]?_0x5b8fb7[_0xb37a('0x35')]:_0x57d4ed[_0xb37a('0x30')];if(_0x1bf426['query'][_0xb37a('0x3f')]){_0x5b8fb7[_0xb37a('0x45')]=[{'all':!![]}];}_0x5b8fb7=_[_0xb37a('0x3d')]({},_0x5b8fb7,_0x1bf426[_0xb37a('0x46')]);return db[_0xb37a('0x40')][_0xb37a('0x47')](_0x5b8fb7)[_0xb37a('0x27')](handleEntityNotFound(_0x333d51,null))[_0xb37a('0x27')](respondWithResult(_0x333d51,null))[_0xb37a('0x48')](handleError(_0x333d51,null));};exports['create']=function(_0x5dcd32,_0x591c6e){return db[_0xb37a('0x40')][_0xb37a('0x49')](_0x5dcd32[_0xb37a('0x4a')],{})['then'](respondWithResult(_0x591c6e,0xc9))[_0xb37a('0x48')](handleError(_0x591c6e,null));};exports[_0xb37a('0x4b')]=function(_0x323b4e,_0x12d076){if(_0x323b4e[_0xb37a('0x4a')]['id']){delete _0x323b4e[_0xb37a('0x4a')]['id'];}return db[_0xb37a('0x40')][_0xb37a('0x47')]({'where':{'id':_0x323b4e[_0xb37a('0x4c')]['id']}})[_0xb37a('0x27')](handleEntityNotFound(_0x12d076,null))[_0xb37a('0x27')](saveUpdates(_0x323b4e[_0xb37a('0x4a')],null))[_0xb37a('0x27')](respondWithResult(_0x12d076,null))[_0xb37a('0x48')](handleError(_0x12d076,null));};exports[_0xb37a('0x26')]=function(_0x3d1a5f,_0x585836){return db[_0xb37a('0x40')][_0xb37a('0x47')]({'where':{'id':_0x3d1a5f[_0xb37a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x585836,null))[_0xb37a('0x27')](removeEntity(_0x585836,null))[_0xb37a('0x48')](handleError(_0x585836,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2fb7597..b79f8a0 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 _0x45b5=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','idField','FieldId','lodash','util','api','moment'];(function(_0x875767,_0x3b3b94){var _0x13ec0d=function(_0x585958){while(--_0x585958){_0x875767['push'](_0x875767['shift']());}};_0x13ec0d(++_0x3b3b94);}(_0x45b5,0xec));var _0x545b=function(_0x466190,_0x516eec){_0x466190=_0x466190-0x0;var _0x22398e=_0x45b5[_0x466190];return _0x22398e;};'use strict';var _=require(_0x545b('0x0'));var util=require(_0x545b('0x1'));var logger=require('../../config/logger')(_0x545b('0x2'));var moment=require(_0x545b('0x3'));var BPromise=require(_0x545b('0x4'));var rp=require(_0x545b('0x5'));var fs=require('fs');var path=require(_0x545b('0x6'));var rimraf=require(_0x545b('0x7'));var config=require(_0x545b('0x8'));var attributes=require(_0x545b('0x9'));module[_0x545b('0xa')]=function(_0x3f24cf,_0xf5532e){return _0x3f24cf[_0x545b('0xb')]('VtigerField',attributes,{'tableName':_0x545b('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x545b('0xd'),_0x545b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f7a=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f7a,0xe3));var _0xa5f7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5f7a[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xa5f7('0x0'));var util=require(_0xa5f7('0x1'));var logger=require('../../config/logger')(_0xa5f7('0x2'));var moment=require(_0xa5f7('0x3'));var BPromise=require(_0xa5f7('0x4'));var rp=require(_0xa5f7('0x5'));var fs=require('fs');var path=require(_0xa5f7('0x6'));var rimraf=require(_0xa5f7('0x7'));var config=require('../../config/environment');var attributes=require(_0xa5f7('0x8'));module[_0xa5f7('0x9')]=function(_0x4f05a4,_0x4729b3){return _0x4f05a4['define'](_0xa5f7('0xa'),attributes,{'tableName':_0xa5f7('0xb'),'paranoid':![],'indexes':[{'name':_0xa5f7('0xc'),'fields':[_0xa5f7('0xd'),_0xa5f7('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 5e2b0d4..698661d 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 _0x629d=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x4a4fd8,_0x3d3ee7){var _0x236fcd=function(_0x2b663e){while(--_0x2b663e){_0x4a4fd8['push'](_0x4a4fd8['shift']());}};_0x236fcd(++_0x3d3ee7);}(_0x629d,0xa1));var _0xd629=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x629d[_0x25248b];return _0x509939;};'use strict';var _=require(_0xd629('0x0'));var util=require(_0xd629('0x1'));var moment=require(_0xd629('0x2'));var BPromise=require(_0xd629('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd629('0x4'))['db'];var utils=require(_0xd629('0x5'));var logger=require(_0xd629('0x6'))(_0xd629('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd629('0x8')][_0xd629('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2abf4a,_0x15838e,_0x523a6f){return new BPromise(function(_0x51cc23,_0x34f90a){return client[_0xd629('0xa')](_0x2abf4a,_0x523a6f)[_0xd629('0xb')](function(_0x5059e3){logger[_0xd629('0xc')](_0xd629('0xd'),_0x15838e,_0xd629('0xe'));logger[_0xd629('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x15838e,_0xd629('0xe'),JSON[_0xd629('0x10')](_0x5059e3));if(_0x5059e3[_0xd629('0x11')]){if(_0x5059e3[_0xd629('0x11')][_0xd629('0x12')]===0x1f4){logger[_0xd629('0x11')]('VtigerField,\x20%s,\x20%s',_0x15838e,_0x5059e3['error'][_0xd629('0x13')]);return _0x34f90a(_0x5059e3[_0xd629('0x11')]['message']);}logger[_0xd629('0x11')](_0xd629('0xd'),_0x15838e,_0x5059e3[_0xd629('0x11')][_0xd629('0x13')]);return _0x51cc23(_0x5059e3[_0xd629('0x11')]['message']);}else{logger[_0xd629('0xc')](_0xd629('0xd'),_0x15838e,_0xd629('0xe'));_0x51cc23(_0x5059e3[_0xd629('0x14')][_0xd629('0x13')]);}})[_0xd629('0x15')](function(_0x5d2531){logger[_0xd629('0x11')](_0xd629('0xd'),_0x15838e,_0x5d2531);_0x34f90a(_0x5d2531);});});} \ No newline at end of file +var _0x7ab7=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ab7,0x9d));var _0x77ab=function(_0x49d523,_0x15a757){_0x49d523=_0x49d523-0x0;var _0x5e3535=_0x7ab7[_0x49d523];return _0x5e3535;};'use strict';var _=require(_0x77ab('0x0'));var util=require(_0x77ab('0x1'));var moment=require(_0x77ab('0x2'));var BPromise=require(_0x77ab('0x3'));var rs=require(_0x77ab('0x4'));var fs=require('fs');var Redis=require(_0x77ab('0x5'));var db=require(_0x77ab('0x6'))['db'];var utils=require(_0x77ab('0x7'));var logger=require(_0x77ab('0x8'))('rpc');var config=require(_0x77ab('0x9'));var jayson=require(_0x77ab('0xa'));var client=jayson[_0x77ab('0xb')][_0x77ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56250e,_0x2768db,_0x14b0ad){return new BPromise(function(_0x11b1f2,_0x443959){return client['request'](_0x56250e,_0x14b0ad)[_0x77ab('0xd')](function(_0xc93bfc){logger['info'](_0x77ab('0xe'),_0x2768db,'request\x20sent');logger[_0x77ab('0xf')](_0x77ab('0x10'),_0x2768db,_0x77ab('0x11'),JSON[_0x77ab('0x12')](_0xc93bfc));if(_0xc93bfc['error']){if(_0xc93bfc[_0x77ab('0x13')][_0x77ab('0x14')]===0x1f4){logger[_0x77ab('0x13')]('VtigerField,\x20%s,\x20%s',_0x2768db,_0xc93bfc['error'][_0x77ab('0x15')]);return _0x443959(_0xc93bfc[_0x77ab('0x13')][_0x77ab('0x15')]);}logger[_0x77ab('0x13')]('VtigerField,\x20%s,\x20%s',_0x2768db,_0xc93bfc[_0x77ab('0x13')][_0x77ab('0x15')]);return _0x11b1f2(_0xc93bfc['error'][_0x77ab('0x15')]);}else{logger[_0x77ab('0x16')](_0x77ab('0xe'),_0x2768db,_0x77ab('0x11'));_0x11b1f2(_0xc93bfc[_0x77ab('0x17')][_0x77ab('0x15')]);}})[_0x77ab('0x18')](function(_0x1c7816){logger[_0x77ab('0x13')]('VtigerField,\x20%s,\x20%s',_0x2768db,_0x1c7816);_0x443959(_0x1c7816);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 983271a..ae07ea0 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 _0xf19c=['/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x2c31d7,_0x221c7b){var _0x113207=function(_0x12293f){while(--_0x12293f){_0x2c31d7['push'](_0x2c31d7['shift']());}};_0x113207(++_0x221c7b);}(_0xf19c,0x10b));var _0xcf19=function(_0x5f1541,_0x369ad6){_0x5f1541=_0x5f1541-0x0;var _0x132790=_0xf19c[_0x5f1541];return _0x132790;};'use strict';var multer=require(_0xcf19('0x0'));var util=require(_0xcf19('0x1'));var path=require(_0xcf19('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf19('0x3'));var router=express[_0xcf19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf19('0x5'));var interaction=require(_0xcf19('0x6'));var config=require(_0xcf19('0x7'));var controller=require(_0xcf19('0x8'));router[_0xcf19('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf19('0xa')]);router[_0xcf19('0x9')](_0xcf19('0xb'),auth[_0xcf19('0xc')](),controller[_0xcf19('0xd')]);router[_0xcf19('0x9')]('/:id/configurations',auth[_0xcf19('0xc')](),controller[_0xcf19('0xe')]);router[_0xcf19('0x9')](_0xcf19('0xf'),auth[_0xcf19('0xc')](),controller[_0xcf19('0x10')]);router[_0xcf19('0x11')]('/',auth[_0xcf19('0xc')](),controller[_0xcf19('0x12')]);router['post'](_0xcf19('0x13'),auth[_0xcf19('0xc')](),controller[_0xcf19('0x14')]);router[_0xcf19('0x15')](_0xcf19('0xb'),auth[_0xcf19('0xc')](),controller[_0xcf19('0x16')]);router[_0xcf19('0x17')](_0xcf19('0xb'),auth[_0xcf19('0xc')](),controller[_0xcf19('0x18')]);module[_0xcf19('0x19')]=router; \ No newline at end of file +var _0x961e=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','/:id'];(function(_0x58b4a3,_0x42403f){var _0xa2b097=function(_0x130ddc){while(--_0x130ddc){_0x58b4a3['push'](_0x58b4a3['shift']());}};_0xa2b097(++_0x42403f);}(_0x961e,0xd2));var _0xe961=function(_0x4d9e79,_0x5e7c1c){_0x4d9e79=_0x4d9e79-0x0;var _0x123259=_0x961e[_0x4d9e79];return _0x123259;};'use strict';var multer=require(_0xe961('0x0'));var util=require(_0xe961('0x1'));var path=require(_0xe961('0x2'));var timeout=require(_0xe961('0x3'));var express=require(_0xe961('0x4'));var router=express[_0xe961('0x5')]();var fs_extra=require(_0xe961('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe961('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xe961('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe961('0x8')](_0xe961('0x9'),auth[_0xe961('0xa')](),controller[_0xe961('0xb')]);router[_0xe961('0x8')](_0xe961('0xc'),auth[_0xe961('0xa')](),controller[_0xe961('0xd')]);router[_0xe961('0x8')](_0xe961('0xe'),auth[_0xe961('0xa')](),controller['getFields']);router[_0xe961('0xf')]('/',auth[_0xe961('0xa')](),controller[_0xe961('0x10')]);router[_0xe961('0xf')](_0xe961('0xc'),auth[_0xe961('0xa')](),controller[_0xe961('0x11')]);router['put'](_0xe961('0x9'),auth[_0xe961('0xa')](),controller[_0xe961('0x12')]);router[_0xe961('0x13')](_0xe961('0x9'),auth['isAuthenticated'](),controller[_0xe961('0x14')]);module[_0xe961('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3f2465a..55ae913 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 _0xe944=['password','token','integrationTab','newTab','sequelize','STRING','remoteUri','ENUM'];(function(_0x4671e3,_0x52202e){var _0x3c3a80=function(_0x361e1d){while(--_0x361e1d){_0x4671e3['push'](_0x4671e3['shift']());}};_0x3c3a80(++_0x52202e);}(_0xe944,0x174));var _0x4e94=function(_0x40c59e,_0x129ce0){_0x40c59e=_0x40c59e-0x0;var _0x58b432=_0xe944[_0x40c59e];return _0x58b432;};'use strict';var Sequelize=require(_0x4e94('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e94('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x4e94('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4e94('0x2')},'authType':{'type':Sequelize[_0x4e94('0x3')](_0x4e94('0x4'),_0x4e94('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x4e94('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4e94('0x3')](_0x4e94('0x6'),_0x4e94('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x583c=['exports','STRING','username','remoteUri','ENUM','token','password','newTab','integrationTab','sequelize'];(function(_0x1be053,_0x52a737){var _0x22732c=function(_0x34ae69){while(--_0x34ae69){_0x1be053['push'](_0x1be053['shift']());}};_0x22732c(++_0x52a737);}(_0x583c,0x12b));var _0xc583=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x583c[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'password':{'type':Sequelize[_0xc583('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc583('0x4')},'authType':{'type':Sequelize[_0xc583('0x5')]('password',_0xc583('0x6')),'defaultValue':_0xc583('0x7')},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc583('0x5')]('integrationTab',_0xc583('0x8')),'defaultValue':_0xc583('0x9')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 50164ec..5b248ae 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 _0x1339=['Sequelize','Unknown\x20authentication\x20type','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','name','send','map','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','destroy','params','findOne','pick','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','%s/%s','authType','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','base64'];(function(_0x524375,_0x3ca8d4){var _0x18e8a6=function(_0x4a6898){while(--_0x4a6898){_0x524375['push'](_0x524375['shift']());}};_0x18e8a6(++_0x3ca8d4);}(_0x1339,0x1ed));var _0x9133=function(_0x514d8a,_0x5af084){_0x514d8a=_0x514d8a-0x0;var _0x5c7987=_0x1339[_0x514d8a];return _0x5c7987;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9133('0x1a'));function respondWithStatusCode(_0x7cc59e,_0x4bbfdc){_0x4bbfdc=_0x4bbfdc||0xcc;return function(_0x5283a3){if(_0x5283a3){return _0x7cc59e[_0x9133('0x1b')](_0x4bbfdc);}return _0x7cc59e['status'](_0x4bbfdc)[_0x9133('0x1c')]();};}function respondWithResult(_0x439e1a,_0x17dfd1){_0x17dfd1=_0x17dfd1||0xc8;return function(_0x464ec5){if(_0x464ec5){return _0x439e1a[_0x9133('0x1d')](_0x17dfd1)[_0x9133('0x1e')](_0x464ec5);}};}function respondWithFilteredResult(_0x49cc5d,_0x13f8fc){return function(_0x1e23ce){if(_0x1e23ce){var _0x4f4f14=typeof _0x13f8fc[_0x9133('0x1f')]===_0x9133('0x20')&&typeof _0x13f8fc[_0x9133('0x21')]===_0x9133('0x20');var _0x4a2c4f=_0x1e23ce[_0x9133('0x22')];var _0x573998=_0x4f4f14?0x0:_0x13f8fc[_0x9133('0x1f')];var _0x5d4a77=_0x4f4f14?_0x1e23ce[_0x9133('0x22')]:_0x13f8fc[_0x9133('0x1f')]+_0x13f8fc['limit'];var _0x38dd60;if(_0x5d4a77>=_0x4a2c4f){_0x5d4a77=_0x4a2c4f;_0x38dd60=0xc8;}else{_0x38dd60=0xce;}_0x49cc5d['status'](_0x38dd60);return _0x49cc5d[_0x9133('0x23')]('Content-Range',_0x573998+'-'+_0x5d4a77+'/'+_0x4a2c4f)['json'](_0x1e23ce);}return null;};}function patchUpdates(_0x2f7354){return function(_0x577de4){try{jsonpatch[_0x9133('0x24')](_0x577de4,_0x2f7354,!![]);}catch(_0x4c1088){return BPromise['reject'](_0x4c1088);}return _0x577de4['save']();};}function saveUpdates(_0x2e99a1,_0x2dcfb8){return function(_0x4da09c){if(_0x4da09c){return _0x4da09c[_0x9133('0x25')](_0x2e99a1)[_0x9133('0x26')](function(_0xff08d5){return _0xff08d5;});}return null;};}function removeEntity(_0x26190c,_0x4f26e8){return function(_0xdb7a98){if(_0xdb7a98){return _0xdb7a98['destroy']()[_0x9133('0x26')](function(){_0x26190c[_0x9133('0x1d')](0xcc)[_0x9133('0x1c')]();});}};}function handleEntityNotFound(_0x14c1cb,_0x4483ef){return function(_0xe829b){if(!_0xe829b){_0x14c1cb[_0x9133('0x1b')](0x194);}return _0xe829b;};}function handleError(_0x313d43,_0x1b6b3e){_0x1b6b3e=_0x1b6b3e||0x1f4;return function(_0x46050b){logger['error'](_0x46050b['stack']);if(_0x46050b[_0x9133('0x27')]){delete _0x46050b[_0x9133('0x27')];}_0x313d43[_0x9133('0x1d')](_0x1b6b3e)[_0x9133('0x28')](_0x46050b);};}exports['index']=function(_0x4ecd9e,_0x3e2404){var _0x45966d={},_0x188c49={},_0x26d351={'count':0x0,'rows':[]};var _0x390f50=_[_0x9133('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x5a27c1){return{'name':_0x5a27c1[_0x9133('0x2a')],'type':_0x5a27c1['type'][_0x9133('0x2b')]};});_0x188c49[_0x9133('0x2c')]=_['map'](_0x390f50,_0x9133('0x27'));_0x188c49['query']=_[_0x9133('0x2d')](_0x4ecd9e[_0x9133('0x2e')]);_0x188c49[_0x9133('0x2f')]=_['intersection'](_0x188c49[_0x9133('0x2c')],_0x188c49[_0x9133('0x2e')]);_0x45966d[_0x9133('0x30')]=_['intersection'](_0x188c49[_0x9133('0x2c')],qs[_0x9133('0x31')](_0x4ecd9e[_0x9133('0x2e')]['fields']));_0x45966d[_0x9133('0x30')]=_0x45966d[_0x9133('0x30')][_0x9133('0x32')]?_0x45966d[_0x9133('0x30')]:_0x188c49['model'];if(!_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x33')]('nolimit')){_0x45966d[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x21')]);_0x45966d[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x1f')]);}_0x45966d[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4ecd9e[_0x9133('0x2e')]['sort']);_0x45966d[_0x9133('0x36')]=qs[_0x9133('0x2f')](_['pick'](_0x4ecd9e[_0x9133('0x2e')],_0x188c49[_0x9133('0x2f')]),_0x390f50);if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]){_0x45966d[_0x9133('0x36')]=_[_0x9133('0x38')](_0x45966d['where'],{'$or':_['map'](_0x390f50,function(_0x33c05b){if(_0x33c05b[_0x9133('0x39')]!==_0x9133('0x3a')){var _0x112514={};_0x112514[_0x33c05b[_0x9133('0x27')]]={'$like':'%'+_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]+'%'};return _0x112514;}})});}_0x45966d=_[_0x9133('0x38')]({},_0x45966d,_0x4ecd9e[_0x9133('0x3b')]);var _0x5a3f73={'where':_0x45966d[_0x9133('0x36')]};return db[_0x9133('0x3c')][_0x9133('0x22')](_0x5a3f73)[_0x9133('0x26')](function(_0x3df6ca){_0x26d351['count']=_0x3df6ca;if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x3d')]){_0x45966d[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x3c')]['findAll'](_0x45966d);})[_0x9133('0x26')](function(_0x1293f1){_0x26d351[_0x9133('0x3f')]=_0x1293f1;return _0x26d351;})[_0x9133('0x26')](respondWithFilteredResult(_0x3e2404,_0x45966d))[_0x9133('0x40')](handleError(_0x3e2404,null));};exports[_0x9133('0x41')]=function(_0x3b2287,_0x4ca1a3){var _0x7f6cd9={'raw':![],'where':{'id':_0x3b2287['params']['id']}},_0x5e0fde={};_0x5e0fde[_0x9133('0x2c')]=_[_0x9133('0x2d')](db[_0x9133('0x3c')][_0x9133('0x42')]);_0x5e0fde[_0x9133('0x2e')]=_[_0x9133('0x2d')](_0x3b2287[_0x9133('0x2e')]);_0x5e0fde[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x5e0fde['model'],_0x5e0fde[_0x9133('0x2e')]);_0x7f6cd9[_0x9133('0x30')]=_[_0x9133('0x43')](_0x5e0fde['model'],qs['fields'](_0x3b2287[_0x9133('0x2e')][_0x9133('0x31')]));_0x7f6cd9['attributes']=_0x7f6cd9[_0x9133('0x30')][_0x9133('0x32')]?_0x7f6cd9[_0x9133('0x30')]:_0x5e0fde[_0x9133('0x2c')];if(_0x3b2287[_0x9133('0x2e')]['includeAll']){_0x7f6cd9[_0x9133('0x3e')]=[{'all':!![]}];}_0x7f6cd9=_[_0x9133('0x38')]({},_0x7f6cd9,_0x3b2287[_0x9133('0x3b')]);return db['ZendeskAccount'][_0x9133('0x44')](_0x7f6cd9)[_0x9133('0x26')](handleEntityNotFound(_0x4ca1a3,null))['then'](respondWithResult(_0x4ca1a3,null))['catch'](handleError(_0x4ca1a3,null));};exports[_0x9133('0x45')]=function(_0x2cd935,_0x4446fe){return db[_0x9133('0x3c')][_0x9133('0x45')](_0x2cd935[_0x9133('0x46')],{})[_0x9133('0x26')](respondWithResult(_0x4446fe,0xc9))[_0x9133('0x40')](handleError(_0x4446fe,null));};exports[_0x9133('0x25')]=function(_0xf07fbb,_0x3d6a49){if(_0xf07fbb[_0x9133('0x46')]['id']){delete _0xf07fbb['body']['id'];}return db['ZendeskAccount'][_0x9133('0x44')]({'where':{'id':_0xf07fbb['params']['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3d6a49,null))[_0x9133('0x26')](saveUpdates(_0xf07fbb[_0x9133('0x46')],null))[_0x9133('0x26')](respondWithResult(_0x3d6a49,null))['catch'](handleError(_0x3d6a49,null));};exports[_0x9133('0x47')]=function(_0x25750f,_0x799772){return db['ZendeskAccount'][_0x9133('0x44')]({'where':{'id':_0x25750f[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x799772,null))['then'](removeEntity(_0x799772,null))[_0x9133('0x40')](handleError(_0x799772,null));};exports['getConfigurations']=function(_0x2342f4,_0x3c4b67,_0x304673){var _0x9fa963={};var _0x4f58fe={};var _0x4a346c;var _0x2f09f6;return db[_0x9133('0x3c')][_0x9133('0x49')]({'where':{'id':_0x2342f4[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3c4b67,null))['then'](function(_0x554bb9){if(_0x554bb9){_0x4a346c=_0x554bb9;_0x4f58fe[_0x9133('0x2c')]=_[_0x9133('0x2d')](db['ZendeskConfiguration'][_0x9133('0x42')]);_0x4f58fe[_0x9133('0x2e')]=_['keys'](_0x2342f4['query']);_0x4f58fe['filters']=_[_0x9133('0x43')](_0x4f58fe['model'],_0x4f58fe[_0x9133('0x2e')]);_0x9fa963[_0x9133('0x30')]=_[_0x9133('0x43')](_0x4f58fe[_0x9133('0x2c')],qs['fields'](_0x2342f4[_0x9133('0x2e')]['fields']));_0x9fa963[_0x9133('0x30')]=_0x9fa963[_0x9133('0x30')][_0x9133('0x32')]?_0x9fa963[_0x9133('0x30')]:_0x4f58fe[_0x9133('0x2c')];_0x9fa963[_0x9133('0x34')]=qs['sort'](_0x2342f4['query']['sort']);_0x9fa963[_0x9133('0x36')]=qs[_0x9133('0x2f')](_[_0x9133('0x4a')](_0x2342f4['query'],_0x4f58fe[_0x9133('0x2f')]));if(_0x2342f4[_0x9133('0x2e')][_0x9133('0x37')]){_0x9fa963[_0x9133('0x36')]=_[_0x9133('0x38')](_0x9fa963[_0x9133('0x36')],{'$or':_[_0x9133('0x29')](_0x9fa963[_0x9133('0x30')],function(_0x59bb26){var _0x464954={};_0x464954[_0x59bb26]={'$like':'%'+_0x2342f4['query'][_0x9133('0x37')]+'%'};return _0x464954;})});}_0x9fa963=_['merge']({},_0x9fa963,_0x2342f4[_0x9133('0x3b')]);return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x540b02){if(_0x540b02){_0x2f09f6=_0x540b02[_0x9133('0x32')];if(!_0x2342f4[_0x9133('0x2e')][_0x9133('0x33')](_0x9133('0x4c'))){_0x9fa963[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x2342f4[_0x9133('0x2e')][_0x9133('0x21')]);_0x9fa963[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x2342f4[_0x9133('0x2e')]['offset']);}return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x23d61f){if(_0x23d61f){return _0x23d61f?{'count':_0x2f09f6,'rows':_0x23d61f}:null;}})[_0x9133('0x26')](respondWithResult(_0x3c4b67,null))[_0x9133('0x40')](handleError(_0x3c4b67,null));};exports[_0x9133('0x4d')]=function(_0xd37001,_0x52d4c8,_0x35bc72){if(_0xd37001[_0x9133('0x46')]['id']){delete _0xd37001[_0x9133('0x46')]['id'];}return db[_0x9133('0x3c')]['findOne']({'where':{'id':_0xd37001[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x52d4c8,null))[_0x9133('0x26')](function(_0x31e978){if(_0x31e978){_0xd37001['body']['AccountId']=_0x31e978['id'];_0xd37001[_0x9133('0x46')][_0x9133('0x4e')]=integrations[_0x9133('0x4f')](_0xd37001[_0x9133('0x46')][_0x9133('0x50')],_0xd37001[_0x9133('0x46')]['type']);_0xd37001[_0x9133('0x46')][_0x9133('0x51')]=integrations[_0x9133('0x52')](_0xd37001[_0x9133('0x46')]['channel'],_0xd37001[_0x9133('0x46')]['type']);return db[_0x9133('0x53')][_0x9133('0x45')](_0xd37001[_0x9133('0x46')],{'include':[{'model':db[_0x9133('0x54')],'as':_0x9133('0x4e')},{'model':db[_0x9133('0x54')],'as':_0x9133('0x51')}]});}return null;})[_0x9133('0x26')](respondWithResult(_0x52d4c8,null))['catch'](handleError(_0x52d4c8,null));};exports[_0x9133('0x55')]=function(_0x1fcd01,_0x10afd7,_0x152283){var _0x406861='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x1fcd01['params']['id']},'attributes':['id',_0x9133('0x56'),_0x9133('0x57'),_0x9133('0x58'),'authType',_0x9133('0x59')]})[_0x9133('0x26')](handleEntityNotFound(_0x10afd7,null))[_0x9133('0x26')](function(_0x3e660c){if(_0x3e660c){_0x406861=_0x3e660c[_0x9133('0x59')];var _0x4cab23=_0x406861[_0x9133('0x5a')](-0x1);if(_0x4cab23==='/'){_0x406861=_0x406861[_0x9133('0x5b')](0x0,_0x406861['lastIndexOf'](_0x4cab23));}var _0x41f924={'method':_0x9133('0x5c'),'uri':util['format'](_0x9133('0x5d'),_0x406861,'ticket_fields'),'json':!![]};switch(_0x3e660c[_0x9133('0x5e')]){case _0x9133('0x57'):_0x41f924[_0x9133('0x5f')]={'Authorization':util[_0x9133('0x60')](_0x9133('0x61'),new Buffer(util['format'](_0x9133('0x62'),_0x3e660c[_0x9133('0x56')],_0x3e660c[_0x9133('0x57')]))[_0x9133('0x63')]('base64'))};break;case _0x9133('0x58'):_0x41f924[_0x9133('0x5f')]={'Authorization':util[_0x9133('0x60')](_0x9133('0x61'),new Buffer(util[_0x9133('0x60')](_0x9133('0x64'),_0x3e660c[_0x9133('0x56')],_0x3e660c[_0x9133('0x58')]))[_0x9133('0x63')](_0x9133('0x65')))};break;default:throw new db[(_0x9133('0x66'))]['ValidationError'](_0x9133('0x67'));}return rp(_0x41f924);}})[_0x9133('0x26')](function(_0x242974){if(_0x242974){var _0x12ae5f=['subject',_0x9133('0x68'),'group',_0x9133('0x69')];_[_0x9133('0x6a')](_0x242974[_0x9133('0x6b')],function(_0x530984){return _0x12ae5f[_0x9133('0x6c')](_0x530984[_0x9133('0x39')]);});return{'count':_0x242974[_0x9133('0x6b')]['length'],'rows':_[_0x9133('0x29')](_0x242974[_0x9133('0x6b')],function(_0x5013f8){return{'id':_0x5013f8['id'],'name':_0x5013f8[_0x9133('0x6d')]>0x7?_0x5013f8[_0x9133('0x6e')]:_0x5013f8[_0x9133('0x39')],'custom':_0x5013f8['position']>0x7?!![]:![],'options':_0x5013f8[_0x9133('0x6f')]?_0x5013f8['system_field_options']:_0x5013f8[_0x9133('0x70')]?_0x5013f8[_0x9133('0x70')]:[]};})};}})[_0x9133('0x26')](respondWithResult(_0x10afd7,null))['catch'](function(_0x2bd590){var _0x54f9ad=_0x1fcd01[_0x9133('0x2e')][_0x9133('0x71')]?0x1f4:_0x2bd590[_0x9133('0x72')]||0x1f4;logger[_0x9133('0x73')](_0x9133('0x74'),_0x9133('0x55'),_0x54f9ad,JSON[_0x9133('0x75')](_0x2bd590));delete _0x2bd590[_0x9133('0x27')];if(_0x54f9ad===0x191){_0x54f9ad=0x190;}_0x10afd7['status'](_0x54f9ad)[_0x9133('0x28')](_0x1fcd01[_0x9133('0x2e')][_0x9133('0x71')]?{'message':_0x9133('0x76'),'statusCode':_0x2bd590[_0x9133('0x72')]}:_0x2bd590);});}; \ No newline at end of file +var _0x84a0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','show','length','include','find','catch','create','body','update','params','findOne','ZendeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x19a076,_0x18a4f4){var _0xfdb153=function(_0x110d03){while(--_0x110d03){_0x19a076['push'](_0x19a076['shift']());}};_0xfdb153(++_0x18a4f4);}(_0x84a0,0x66));var _0x084a=function(_0x4cae38,_0x1f7372){_0x4cae38=_0x4cae38-0x0;var _0x4fc0d6=_0x84a0[_0x4cae38];return _0x4fc0d6;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];var integrations=require(_0x084a('0x18'));function respondWithStatusCode(_0xec90a5,_0x9245b1){_0x9245b1=_0x9245b1||0xcc;return function(_0x1bdfb8){if(_0x1bdfb8){return _0xec90a5[_0x084a('0x19')](_0x9245b1);}return _0xec90a5[_0x084a('0x1a')](_0x9245b1)[_0x084a('0x1b')]();};}function respondWithResult(_0x5aef40,_0x4277c9){_0x4277c9=_0x4277c9||0xc8;return function(_0x4b9cc5){if(_0x4b9cc5){return _0x5aef40[_0x084a('0x1a')](_0x4277c9)[_0x084a('0x1c')](_0x4b9cc5);}};}function respondWithFilteredResult(_0x366624,_0x2d35b8){return function(_0xd20527){if(_0xd20527){var _0x4cbd16=typeof _0x2d35b8[_0x084a('0x1d')]==='undefined'&&typeof _0x2d35b8[_0x084a('0x1e')]===_0x084a('0x1f');var _0x4af43e=_0xd20527[_0x084a('0x20')];var _0x32c729=_0x4cbd16?0x0:_0x2d35b8[_0x084a('0x1d')];var _0x14bb19=_0x4cbd16?_0xd20527[_0x084a('0x20')]:_0x2d35b8[_0x084a('0x1d')]+_0x2d35b8[_0x084a('0x1e')];var _0x34e86e;if(_0x14bb19>=_0x4af43e){_0x14bb19=_0x4af43e;_0x34e86e=0xc8;}else{_0x34e86e=0xce;}_0x366624[_0x084a('0x1a')](_0x34e86e);return _0x366624[_0x084a('0x21')](_0x084a('0x22'),_0x32c729+'-'+_0x14bb19+'/'+_0x4af43e)[_0x084a('0x1c')](_0xd20527);}return null;};}function patchUpdates(_0x116328){return function(_0x126efb){try{jsonpatch[_0x084a('0x23')](_0x126efb,_0x116328,!![]);}catch(_0x506f71){return BPromise[_0x084a('0x24')](_0x506f71);}return _0x126efb[_0x084a('0x25')]();};}function saveUpdates(_0x41a90f,_0x2d62bf){return function(_0x1c3f6c){if(_0x1c3f6c){return _0x1c3f6c['update'](_0x41a90f)[_0x084a('0x26')](function(_0x288e9e){return _0x288e9e;});}return null;};}function removeEntity(_0x6346a5,_0x1f2c9f){return function(_0x18b43d){if(_0x18b43d){return _0x18b43d[_0x084a('0x27')]()['then'](function(){_0x6346a5[_0x084a('0x1a')](0xcc)[_0x084a('0x1b')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x19')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x28')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x29')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x2a')](db['ZendeskAccount'][_0x084a('0x2b')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2c')][_0x084a('0x2d')]};});_0x3be7a6[_0x084a('0x2e')]=_[_0x084a('0x2a')](_0x378de6,_0x084a('0x28'));_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x4651e6[_0x084a('0x2f')]);_0x3be7a6[_0x084a('0x31')]=_[_0x084a('0x32')](_0x3be7a6[_0x084a('0x2e')],_0x3be7a6[_0x084a('0x2f')]);_0x2c4149[_0x084a('0x33')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x34')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x34')]));_0x2c4149[_0x084a('0x33')]=_0x2c4149[_0x084a('0x33')]['length']?_0x2c4149[_0x084a('0x33')]:_0x3be7a6[_0x084a('0x2e')];if(!_0x4651e6[_0x084a('0x2f')]['hasOwnProperty'](_0x084a('0x35'))){_0x2c4149[_0x084a('0x1e')]=qs[_0x084a('0x1e')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x1d')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x1d')]);}_0x2c4149['order']=qs[_0x084a('0x36')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x36')]);_0x2c4149[_0x084a('0x37')]=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0x4651e6[_0x084a('0x2f')],_0x3be7a6[_0x084a('0x31')]),_0x378de6);if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]){_0x2c4149[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x2c4149[_0x084a('0x37')],{'$or':_[_0x084a('0x2a')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3b')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x28')]]={'$like':'%'+_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x3a')]({},_0x2c4149,_0x4651e6[_0x084a('0x3c')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x37')]};return db['ZendeskAccount'][_0x084a('0x20')](_0x183e10)[_0x084a('0x26')](function(_0x25a081){_0x25a2a1[_0x084a('0x20')]=_0x25a081;if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x26')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x30')](db[_0x084a('0x3e')][_0x084a('0x2b')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xba1081[_0x084a('0x2f')]);_0xfb565c[_0x084a('0x31')]=_[_0x084a('0x32')](_0xfb565c[_0x084a('0x2e')],_0xfb565c[_0x084a('0x2f')]);_0x3e2b92[_0x084a('0x33')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x34')](_0xba1081[_0x084a('0x2f')][_0x084a('0x34')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x33')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x33')]:_0xfb565c[_0x084a('0x2e')];if(_0xba1081[_0x084a('0x2f')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3c')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x48')]=function(_0x31677b,_0x10856d){if(_0x31677b['body']['id']){delete _0x31677b[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x31677b[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x10856d,null))['then'](saveUpdates(_0x31677b[_0x084a('0x47')],null))[_0x084a('0x26')](respondWithResult(_0x10856d,null))[_0x084a('0x45')](handleError(_0x10856d,null));};exports[_0x084a('0x27')]=function(_0xf936e,_0x3b2df4){return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0xf936e[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x3b2df4,null))[_0x084a('0x26')](removeEntity(_0x3b2df4,null))[_0x084a('0x45')](handleError(_0x3b2df4,null));};exports['getConfigurations']=function(_0xcdd5b,_0x37fce4,_0x29fa4b){var _0x39edc1={};var _0x2091b1={};var _0x1c972c;var _0xa5362;return db['ZendeskAccount'][_0x084a('0x4a')]({'where':{'id':_0xcdd5b[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x37fce4,null))['then'](function(_0x54ca1f){if(_0x54ca1f){_0x1c972c=_0x54ca1f;_0x2091b1[_0x084a('0x2e')]=_['keys'](db[_0x084a('0x4b')][_0x084a('0x2b')]);_0x2091b1['query']=_[_0x084a('0x30')](_0xcdd5b['query']);_0x2091b1['filters']=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],_0x2091b1[_0x084a('0x2f')]);_0x39edc1[_0x084a('0x33')]=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],qs[_0x084a('0x34')](_0xcdd5b['query'][_0x084a('0x34')]));_0x39edc1[_0x084a('0x33')]=_0x39edc1[_0x084a('0x33')]['length']?_0x39edc1[_0x084a('0x33')]:_0x2091b1[_0x084a('0x2e')];_0x39edc1[_0x084a('0x4c')]=qs[_0x084a('0x36')](_0xcdd5b['query'][_0x084a('0x36')]);_0x39edc1['where']=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0xcdd5b[_0x084a('0x2f')],_0x2091b1['filters']));if(_0xcdd5b['query'][_0x084a('0x39')]){_0x39edc1[_0x084a('0x37')]=_['merge'](_0x39edc1[_0x084a('0x37')],{'$or':_['map'](_0x39edc1['attributes'],function(_0x195ae2){var _0x3f3fd7={};_0x3f3fd7[_0x195ae2]={'$like':'%'+_0xcdd5b[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x3f3fd7;})});}_0x39edc1=_[_0x084a('0x3a')]({},_0x39edc1,_0xcdd5b[_0x084a('0x3c')]);return _0x1c972c[_0x084a('0x4d')](_0x39edc1);}})[_0x084a('0x26')](function(_0x114aa5){if(_0x114aa5){_0xa5362=_0x114aa5['length'];if(!_0xcdd5b[_0x084a('0x2f')][_0x084a('0x4e')](_0x084a('0x35'))){_0x39edc1['limit']=qs[_0x084a('0x1e')](_0xcdd5b[_0x084a('0x2f')]['limit']);_0x39edc1[_0x084a('0x1d')]=qs['offset'](_0xcdd5b['query'][_0x084a('0x1d')]);}return _0x1c972c['getConfigurations'](_0x39edc1);}})['then'](function(_0x2368f5){if(_0x2368f5){return _0x2368f5?{'count':_0xa5362,'rows':_0x2368f5}:null;}})[_0x084a('0x26')](respondWithResult(_0x37fce4,null))[_0x084a('0x45')](handleError(_0x37fce4,null));};exports['addConfiguration']=function(_0xff6c9e,_0xbd063c,_0x2311f5){if(_0xff6c9e[_0x084a('0x47')]['id']){delete _0xff6c9e[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0xff6c9e['params']['id']}})['then'](handleEntityNotFound(_0xbd063c,null))[_0x084a('0x26')](function(_0x36ba24){if(_0x36ba24){_0xff6c9e['body'][_0x084a('0x4f')]=_0x36ba24['id'];_0xff6c9e[_0x084a('0x47')][_0x084a('0x50')]=integrations[_0x084a('0x51')](_0xff6c9e['body'][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);_0xff6c9e['body']['Descriptions']=integrations[_0x084a('0x53')](_0xff6c9e[_0x084a('0x47')][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);return db[_0x084a('0x4b')][_0x084a('0x46')](_0xff6c9e['body'],{'include':[{'model':db[_0x084a('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x084a('0x55')}]});}return null;})[_0x084a('0x26')](respondWithResult(_0xbd063c,null))[_0x084a('0x45')](handleError(_0xbd063c,null));};exports['getFields']=function(_0x163a5d,_0x57729c,_0x1eb7be){var _0x1054ea='';return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0x163a5d[_0x084a('0x49')]['id']},'attributes':['id',_0x084a('0x56'),'password','token',_0x084a('0x57'),_0x084a('0x58')]})[_0x084a('0x26')](handleEntityNotFound(_0x57729c,null))[_0x084a('0x26')](function(_0x22abf5){if(_0x22abf5){_0x1054ea=_0x22abf5[_0x084a('0x58')];var _0x5c655f=_0x1054ea[_0x084a('0x59')](-0x1);if(_0x5c655f==='/'){_0x1054ea=_0x1054ea[_0x084a('0x5a')](0x0,_0x1054ea[_0x084a('0x5b')](_0x5c655f));}var _0x33c040={'method':_0x084a('0x5c'),'uri':util[_0x084a('0x5d')](_0x084a('0x5e'),_0x1054ea,'ticket_fields'),'json':!![]};switch(_0x22abf5[_0x084a('0x57')]){case _0x084a('0x5f'):_0x33c040[_0x084a('0x60')]={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util[_0x084a('0x5d')](_0x084a('0x62'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x5f')]))[_0x084a('0x63')]('base64'))};break;case'token':_0x33c040['headers']={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util['format'](_0x084a('0x64'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x65')]))[_0x084a('0x63')]('base64'))};break;default:throw new db['Sequelize'][(_0x084a('0x66'))](_0x084a('0x67'));}return rp(_0x33c040);}})[_0x084a('0x26')](function(_0x37d05a){if(_0x37d05a){var _0x155450=[_0x084a('0x68'),_0x084a('0x69'),'group',_0x084a('0x6a')];_[_0x084a('0x6b')](_0x37d05a[_0x084a('0x6c')],function(_0x137bba){return _0x155450[_0x084a('0x6d')](_0x137bba[_0x084a('0x2c')]);});return{'count':_0x37d05a[_0x084a('0x6c')]['length'],'rows':_[_0x084a('0x2a')](_0x37d05a[_0x084a('0x6c')],function(_0x26a88c){return{'id':_0x26a88c['id'],'name':_0x26a88c[_0x084a('0x6e')]>0x7?_0x26a88c[_0x084a('0x6f')]:_0x26a88c[_0x084a('0x2c')],'custom':_0x26a88c[_0x084a('0x6e')]>0x7?!![]:![],'options':_0x26a88c[_0x084a('0x70')]?_0x26a88c[_0x084a('0x70')]:_0x26a88c[_0x084a('0x71')]?_0x26a88c[_0x084a('0x71')]:[]};})};}})['then'](respondWithResult(_0x57729c,null))[_0x084a('0x45')](function(_0x29916a){var _0x4b8f1f=_0x163a5d[_0x084a('0x2f')]['test']?0x1f4:_0x29916a['statusCode']||0x1f4;logger[_0x084a('0x72')](_0x084a('0x73'),'getFields',_0x4b8f1f,JSON[_0x084a('0x74')](_0x29916a));delete _0x29916a[_0x084a('0x28')];if(_0x4b8f1f===0x191){_0x4b8f1f=0x190;}_0x57729c[_0x084a('0x1a')](_0x4b8f1f)[_0x084a('0x75')](_0x163a5d[_0x084a('0x2f')][_0x084a('0x76')]?{'message':_0x084a('0x77'),'statusCode':_0x29916a[_0x084a('0x78')]}:_0x29916a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a019bb9..a7a63e3 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 _0x91ac=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x91ac,0x119));var _0xc91a=function(_0x320815,_0x2a89d8){_0x320815=_0x320815-0x0;var _0x2f096d=_0x91ac[_0x320815];return _0x2f096d;};'use strict';var _=require('lodash');var util=require(_0xc91a('0x0'));var logger=require(_0xc91a('0x1'))(_0xc91a('0x2'));var moment=require(_0xc91a('0x3'));var BPromise=require(_0xc91a('0x4'));var rp=require(_0xc91a('0x5'));var fs=require('fs');var path=require(_0xc91a('0x6'));var rimraf=require(_0xc91a('0x7'));var config=require(_0xc91a('0x8'));var attributes=require(_0xc91a('0x9'));var integrations=require(_0xc91a('0xa'));module[_0xc91a('0xb')]=function(_0x3e41f1,_0x21f0e4){return _0x3e41f1['define']('ZendeskAccount',attributes,{'tableName':_0xc91a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2064=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4c5b6e,_0x416ab5){var _0x2bef27=function(_0x1ea5c2){while(--_0x1ea5c2){_0x4c5b6e['push'](_0x4c5b6e['shift']());}};_0x2bef27(++_0x416ab5);}(_0x2064,0xab));var _0x4206=function(_0x3c26cb,_0x95cc31){_0x3c26cb=_0x3c26cb-0x0;var _0x27d9a2=_0x2064[_0x3c26cb];return _0x27d9a2;};'use strict';var _=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var logger=require(_0x4206('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4206('0x3'));var rp=require(_0x4206('0x4'));var fs=require('fs');var path=require(_0x4206('0x5'));var rimraf=require(_0x4206('0x6'));var config=require(_0x4206('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x4206('0x8'));module['exports']=function(_0x5610d1,_0x156339){return _0x5610d1[_0x4206('0x9')]('ZendeskAccount',attributes,{'tableName':_0x4206('0xa'),'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 8eb1b81..c42851a 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 _0x9146=['message','ZendeskAccount,\x20%s,\x20%s','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','limit','map','attributes','include','model','catch','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9146,0x16d));var _0x6914=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x9146[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0x6914('0x0'));var util=require(_0x6914('0x1'));var moment=require(_0x6914('0x2'));var BPromise=require('bluebird');var rs=require(_0x6914('0x3'));var fs=require('fs');var Redis=require(_0x6914('0x4'));var db=require(_0x6914('0x5'))['db'];var utils=require(_0x6914('0x6'));var logger=require(_0x6914('0x7'))(_0x6914('0x8'));var config=require(_0x6914('0x9'));var jayson=require(_0x6914('0xa'));var client=jayson[_0x6914('0xb')][_0x6914('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x470c1a,_0xb85d34,_0xb0435e){return new BPromise(function(_0x2a6a0a,_0x48caa3){return client[_0x6914('0xd')](_0x470c1a,_0xb0435e)[_0x6914('0xe')](function(_0x2ed660){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0xb85d34,'request\x20sent');logger[_0x6914('0xf')](_0x6914('0x10'),_0xb85d34,_0x6914('0x11'),JSON[_0x6914('0x12')](_0x2ed660));if(_0x2ed660[_0x6914('0x13')]){if(_0x2ed660['error']['code']===0x1f4){logger[_0x6914('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0xb85d34,_0x2ed660[_0x6914('0x13')][_0x6914('0x14')]);return _0x48caa3(_0x2ed660[_0x6914('0x13')][_0x6914('0x14')]);}logger[_0x6914('0x13')](_0x6914('0x15'),_0xb85d34,_0x2ed660['error'][_0x6914('0x14')]);return _0x2a6a0a(_0x2ed660[_0x6914('0x13')][_0x6914('0x14')]);}else{logger[_0x6914('0x16')](_0x6914('0x15'),_0xb85d34,_0x6914('0x11'));_0x2a6a0a(_0x2ed660[_0x6914('0x17')][_0x6914('0x14')]);}})['catch'](function(_0x314808){logger[_0x6914('0x13')](_0x6914('0x15'),_0xb85d34,_0x314808);_0x48caa3(_0x314808);});});}exports[_0x6914('0x18')]=function(_0x212345){var _0x1b7340=this;return new Promise(function(_0xcfc7ac,_0xf233b){return db[_0x6914('0x19')][_0x6914('0x1a')]({'raw':_0x212345[_0x6914('0x1b')]?_0x212345[_0x6914('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x212345[_0x6914('0x1b')]?_0x212345[_0x6914('0x1b')]['where']||null:null,'attributes':_0x212345[_0x6914('0x1b')]?_0x212345[_0x6914('0x1b')]['attributes']||null:null,'limit':_0x212345[_0x6914('0x1b')]?_0x212345[_0x6914('0x1b')][_0x6914('0x1c')]||null:null,'include':_0x212345[_0x6914('0x1b')]?_0x212345[_0x6914('0x1b')]['include']?_[_0x6914('0x1d')](_0x212345[_0x6914('0x1b')]['include'],function(_0x5c7eb3){return{'model':db[_0x5c7eb3['model']],'as':_0x5c7eb3['as'],'attributes':_0x5c7eb3[_0x6914('0x1e')],'include':_0x5c7eb3[_0x6914('0x1f')]?_[_0x6914('0x1d')](_0x5c7eb3[_0x6914('0x1f')],function(_0x3aa998){return{'model':db[_0x3aa998[_0x6914('0x20')]],'as':_0x3aa998['as'],'attributes':_0x3aa998['attributes'],'include':_0x3aa998[_0x6914('0x1f')]?_['map'](_0x3aa998['include'],function(_0x3f726b){return{'model':db[_0x3f726b[_0x6914('0x20')]],'as':_0x3f726b['as'],'attributes':_0x3f726b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6914('0xe')](function(_0x4f1554){logger['info'](_0x6914('0x18'),_0x212345);logger[_0x6914('0xf')](_0x6914('0x18'),_0x212345,JSON[_0x6914('0x12')](_0x4f1554));_0xcfc7ac(_0x4f1554);})[_0x6914('0x21')](function(_0x26d744){logger[_0x6914('0x13')]('GetZendeskAccount',_0x26d744[_0x6914('0x14')],_0x212345);_0xf233b(_0x1b7340[_0x6914('0x13')](0x1f4,_0x26d744[_0x6914('0x14')]));});});};exports[_0x6914('0x22')]=function(_0x3bc31a){var _0x462375=this;return new Promise(function(_0x367e6d,_0x54865f){return db[_0x6914('0x19')]['find']({'raw':_0x3bc31a[_0x6914('0x1b')]?_0x3bc31a[_0x6914('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3bc31a[_0x6914('0x1b')]?_0x3bc31a[_0x6914('0x1b')]['where']||null:null,'attributes':_0x3bc31a['options']?_0x3bc31a[_0x6914('0x1b')][_0x6914('0x1e')]||null:null,'include':_0x3bc31a[_0x6914('0x1b')]?_0x3bc31a[_0x6914('0x1b')][_0x6914('0x1f')]?_[_0x6914('0x1d')](_0x3bc31a[_0x6914('0x1b')][_0x6914('0x1f')],function(_0x2e6382){return{'model':db[_0x2e6382['model']],'as':_0x2e6382['as'],'attributes':_0x2e6382[_0x6914('0x1e')],'include':_0x2e6382[_0x6914('0x1f')]?_[_0x6914('0x1d')](_0x2e6382[_0x6914('0x1f')],function(_0x8dd360){return{'model':db[_0x8dd360[_0x6914('0x20')]],'as':_0x8dd360['as'],'attributes':_0x8dd360[_0x6914('0x1e')],'include':_0x8dd360['include']?_['map'](_0x8dd360['include'],function(_0x254942){return{'model':db[_0x254942[_0x6914('0x20')]],'as':_0x254942['as'],'attributes':_0x254942[_0x6914('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3f411){logger[_0x6914('0x16')](_0x6914('0x22'),_0x3bc31a);logger[_0x6914('0xf')](_0x6914('0x22'),_0x3bc31a,JSON[_0x6914('0x12')](_0xc3f411));_0x367e6d(_0xc3f411);})['catch'](function(_0x3f6861){logger['error']('ShowZendeskAccount',_0x3f6861[_0x6914('0x14')],_0x3bc31a);_0x54865f(_0x462375['error'](0x1f4,_0x3f6861[_0x6914('0x14')]));});});}; \ No newline at end of file +var _0x555d=['GetZendeskAccount','findAll','options','where','limit','map','include','model','attributes','catch','ZendeskAccount','find','raw','ShowZendeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1a46fb,_0xfe84af){var _0x3ca3b1=function(_0x5b8aa2){while(--_0x5b8aa2){_0x1a46fb['push'](_0x1a46fb['shift']());}};_0x3ca3b1(++_0xfe84af);}(_0x555d,0x103));var _0xd555=function(_0x48e24c,_0x14d0e9){_0x48e24c=_0x48e24c-0x0;var _0x55ddd4=_0x555d[_0x48e24c];return _0x55ddd4;};'use strict';var _=require(_0xd555('0x0'));var util=require('util');var moment=require(_0xd555('0x1'));var BPromise=require(_0xd555('0x2'));var rs=require(_0xd555('0x3'));var fs=require('fs');var Redis=require(_0xd555('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd555('0x5'))(_0xd555('0x6'));var config=require(_0xd555('0x7'));var jayson=require(_0xd555('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x254b72,_0x4c7012,_0x3a4c3a){return new BPromise(function(_0xef6a1f,_0x48bbb7){return client[_0xd555('0x9')](_0x254b72,_0x3a4c3a)[_0xd555('0xa')](function(_0x2e454f){logger[_0xd555('0xb')](_0xd555('0xc'),_0x4c7012,'request\x20sent');logger[_0xd555('0xd')](_0xd555('0xe'),_0x4c7012,_0xd555('0xf'),JSON[_0xd555('0x10')](_0x2e454f));if(_0x2e454f[_0xd555('0x11')]){if(_0x2e454f['error'][_0xd555('0x12')]===0x1f4){logger[_0xd555('0x11')](_0xd555('0xc'),_0x4c7012,_0x2e454f[_0xd555('0x11')][_0xd555('0x13')]);return _0x48bbb7(_0x2e454f['error'][_0xd555('0x13')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4c7012,_0x2e454f[_0xd555('0x11')][_0xd555('0x13')]);return _0xef6a1f(_0x2e454f['error']['message']);}else{logger[_0xd555('0xb')](_0xd555('0xc'),_0x4c7012,_0xd555('0xf'));_0xef6a1f(_0x2e454f[_0xd555('0x14')][_0xd555('0x13')]);}})['catch'](function(_0x1e7951){logger[_0xd555('0x11')](_0xd555('0xc'),_0x4c7012,_0x1e7951);_0x48bbb7(_0x1e7951);});});}exports[_0xd555('0x15')]=function(_0x4cea15){var _0x3fa137=this;return new Promise(function(_0x489e15,_0x414b62){return db['ZendeskAccount'][_0xd555('0x16')]({'raw':_0x4cea15['options']?_0x4cea15[_0xd555('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4cea15[_0xd555('0x17')]?_0x4cea15[_0xd555('0x17')][_0xd555('0x18')]||null:null,'attributes':_0x4cea15[_0xd555('0x17')]?_0x4cea15[_0xd555('0x17')]['attributes']||null:null,'limit':_0x4cea15[_0xd555('0x17')]?_0x4cea15[_0xd555('0x17')][_0xd555('0x19')]||null:null,'include':_0x4cea15[_0xd555('0x17')]?_0x4cea15[_0xd555('0x17')]['include']?_[_0xd555('0x1a')](_0x4cea15['options'][_0xd555('0x1b')],function(_0xd36d9c){return{'model':db[_0xd36d9c[_0xd555('0x1c')]],'as':_0xd36d9c['as'],'attributes':_0xd36d9c['attributes'],'include':_0xd36d9c[_0xd555('0x1b')]?_['map'](_0xd36d9c[_0xd555('0x1b')],function(_0x97b5be){return{'model':db[_0x97b5be[_0xd555('0x1c')]],'as':_0x97b5be['as'],'attributes':_0x97b5be[_0xd555('0x1d')],'include':_0x97b5be[_0xd555('0x1b')]?_['map'](_0x97b5be[_0xd555('0x1b')],function(_0x3ba790){return{'model':db[_0x3ba790['model']],'as':_0x3ba790['as'],'attributes':_0x3ba790[_0xd555('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd555('0xa')](function(_0x2903da){logger[_0xd555('0xb')](_0xd555('0x15'),_0x4cea15);logger[_0xd555('0xd')](_0xd555('0x15'),_0x4cea15,JSON[_0xd555('0x10')](_0x2903da));_0x489e15(_0x2903da);})[_0xd555('0x1e')](function(_0x35645b){logger[_0xd555('0x11')]('GetZendeskAccount',_0x35645b['message'],_0x4cea15);_0x414b62(_0x3fa137[_0xd555('0x11')](0x1f4,_0x35645b[_0xd555('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x455247){var _0x4502dd=this;return new Promise(function(_0x512b69,_0x28f488){return db[_0xd555('0x1f')][_0xd555('0x20')]({'raw':_0x455247[_0xd555('0x17')]?_0x455247[_0xd555('0x17')][_0xd555('0x21')]===undefined?!![]:![]:!![],'where':_0x455247[_0xd555('0x17')]?_0x455247['options']['where']||null:null,'attributes':_0x455247[_0xd555('0x17')]?_0x455247[_0xd555('0x17')]['attributes']||null:null,'include':_0x455247['options']?_0x455247[_0xd555('0x17')]['include']?_[_0xd555('0x1a')](_0x455247[_0xd555('0x17')]['include'],function(_0x547664){return{'model':db[_0x547664[_0xd555('0x1c')]],'as':_0x547664['as'],'attributes':_0x547664[_0xd555('0x1d')],'include':_0x547664['include']?_[_0xd555('0x1a')](_0x547664[_0xd555('0x1b')],function(_0x31e327){return{'model':db[_0x31e327['model']],'as':_0x31e327['as'],'attributes':_0x31e327[_0xd555('0x1d')],'include':_0x31e327[_0xd555('0x1b')]?_['map'](_0x31e327[_0xd555('0x1b')],function(_0xda38a1){return{'model':db[_0xda38a1[_0xd555('0x1c')]],'as':_0xda38a1['as'],'attributes':_0xda38a1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd555('0xa')](function(_0x4cad90){logger[_0xd555('0xb')]('ShowZendeskAccount',_0x455247);logger[_0xd555('0xd')](_0xd555('0x22'),_0x455247,JSON[_0xd555('0x10')](_0x4cad90));_0x512b69(_0x4cad90);})[_0xd555('0x1e')](function(_0x88a810){logger['error'](_0xd555('0x22'),_0x88a810['message'],_0x455247);_0x28f488(_0x4502dd[_0xd555('0x11')](0x1f4,_0x88a810[_0xd555('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ac1e29c..9086505 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x2e19a8,_0x572ed2){var _0x2ee152=function(_0x145d4e){while(--_0x145d4e){_0x2e19a8['push'](_0x2e19a8['shift']());}};_0x2ee152(++_0x572ed2);}(_0xe706,0xa3));var _0x6e70=function(_0x44db60,_0x4ec8ca){_0x44db60=_0x44db60-0x0;var _0x3fa929=_0xe706[_0x44db60];return _0x3fa929;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0xa')](_0x6e70('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6e70('0xa')](_0x6e70('0x14'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x16')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x17')]);router[_0x6e70('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x6e70('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth[_0x6e70('0xb')](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x5ec0e6,_0x45ddca){var _0x47036e=function(_0x1a2f7c){while(--_0x1a2f7c){_0x5ec0e6['push'](_0x5ec0e6['shift']());}};_0x47036e(++_0x45ddca);}(_0xda3f,0xec));var _0xfda3=function(_0x440a1f,_0x5ec3a8){_0x440a1f=_0x440a1f-0x0;var _0x42331c=_0xda3f[_0x440a1f];return _0x42331c;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 7a70989..23823cb 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 _0xb630=['STRING','sequelize','exports'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xb630,0x88));var _0x0b63=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0xb630[_0x3ceb54];return _0x26d8a6;};'use strict';var Sequelize=require(_0x0b63('0x0'));module[_0x0b63('0x1')]={'name':{'type':Sequelize[_0x0b63('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a70=['exports','STRING','sequelize'];(function(_0x505faa,_0x11145c){var _0x3645bc=function(_0x3b2b64){while(--_0x3b2b64){_0x505faa['push'](_0x505faa['shift']());}};_0x3645bc(++_0x11145c);}(_0x0a70,0x176));var _0x00a7=function(_0x5c76d8,_0x28b1c2){_0x5c76d8=_0x5c76d8-0x0;var _0x4fd5a5=_0x0a70[_0x5c76d8];return _0x4fd5a5;};'use strict';var Sequelize=require(_0x00a7('0x0'));module[_0x00a7('0x1')]={'name':{'type':Sequelize[_0x00a7('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 86dd680..ae4a137 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 _0xb10e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','count','Content-Range','json','save','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','key','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZendeskConfiguration','findAll','rows','catch','show','params','includeAll','include','find','create','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0xafbe24,_0x577086){var _0x1fbcc2=function(_0x478e8e){while(--_0x478e8e){_0xafbe24['push'](_0xafbe24['shift']());}};_0x1fbcc2(++_0x577086);}(_0xb10e,0xec));var _0xeb10=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xb10e[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb10('0x0'));var zipdir=require(_0xeb10('0x1'));var jsonpatch=require(_0xeb10('0x2'));var rp=require('request-promise');var moment=require(_0xeb10('0x3'));var BPromise=require(_0xeb10('0x4'));var Mustache=require(_0xeb10('0x5'));var util=require('util');var path=require(_0xeb10('0x6'));var sox=require(_0xeb10('0x7'));var csv=require('to-csv');var ejs=require(_0xeb10('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb10('0x9'));var squel=require(_0xeb10('0xa'));var crypto=require(_0xeb10('0xb'));var jsforce=require(_0xeb10('0xc'));var deskjs=require(_0xeb10('0xd'));var toCsv=require(_0xeb10('0xe'));var querystring=require(_0xeb10('0xf'));var Papa=require(_0xeb10('0x10'));var Redis=require(_0xeb10('0x11'));var authService=require(_0xeb10('0x12'));var qs=require(_0xeb10('0x13'));var as=require(_0xeb10('0x14'));var hardwareService=require(_0xeb10('0x15'));var logger=require('../../config/logger')(_0xeb10('0x16'));var utils=require(_0xeb10('0x17'));var config=require(_0xeb10('0x18'));var licenseUtil=require(_0xeb10('0x19'));var db=require(_0xeb10('0x1a'))['db'];function respondWithStatusCode(_0x2df3b6,_0x4b1444){_0x4b1444=_0x4b1444||0xcc;return function(_0x284288){if(_0x284288){return _0x2df3b6['sendStatus'](_0x4b1444);}return _0x2df3b6['status'](_0x4b1444)['end']();};}function respondWithResult(_0xa55663,_0x3e8299){_0x3e8299=_0x3e8299||0xc8;return function(_0x41122d){if(_0x41122d){return _0xa55663[_0xeb10('0x1b')](_0x3e8299)['json'](_0x41122d);}};}function respondWithFilteredResult(_0x1266f2,_0x34c46b){return function(_0x4ddbd5){if(_0x4ddbd5){var _0x3b06cb=typeof _0x34c46b[_0xeb10('0x1c')]==='undefined'&&typeof _0x34c46b[_0xeb10('0x1d')]==='undefined';var _0x25bbb8=_0x4ddbd5['count'];var _0x4d97b7=_0x3b06cb?0x0:_0x34c46b[_0xeb10('0x1c')];var _0x46feb9=_0x3b06cb?_0x4ddbd5[_0xeb10('0x1e')]:_0x34c46b['offset']+_0x34c46b[_0xeb10('0x1d')];var _0x53b9e5;if(_0x46feb9>=_0x25bbb8){_0x46feb9=_0x25bbb8;_0x53b9e5=0xc8;}else{_0x53b9e5=0xce;}_0x1266f2[_0xeb10('0x1b')](_0x53b9e5);return _0x1266f2['set'](_0xeb10('0x1f'),_0x4d97b7+'-'+_0x46feb9+'/'+_0x25bbb8)[_0xeb10('0x20')](_0x4ddbd5);}return null;};}function patchUpdates(_0x8f58cf){return function(_0x34236d){try{jsonpatch['apply'](_0x34236d,_0x8f58cf,!![]);}catch(_0x195178){return BPromise['reject'](_0x195178);}return _0x34236d[_0xeb10('0x21')]();};}function saveUpdates(_0x4a98e5,_0x260cd6){return function(_0x508fd0){if(_0x508fd0){return _0x508fd0[_0xeb10('0x22')](_0x4a98e5)[_0xeb10('0x23')](function(_0x53a1b6){return _0x53a1b6;});}return null;};}function removeEntity(_0x599d94,_0x32fd47){return function(_0x2ee8de){if(_0x2ee8de){return _0x2ee8de[_0xeb10('0x24')]()[_0xeb10('0x23')](function(){_0x599d94[_0xeb10('0x1b')](0xcc)[_0xeb10('0x25')]();});}};}function handleEntityNotFound(_0x26d268,_0x2ad126){return function(_0x1c7afc){if(!_0x1c7afc){_0x26d268[_0xeb10('0x26')](0x194);}return _0x1c7afc;};}function handleError(_0x280882,_0x2aa2fa){_0x2aa2fa=_0x2aa2fa||0x1f4;return function(_0xb31064){logger['error'](_0xb31064['stack']);if(_0xb31064[_0xeb10('0x27')]){delete _0xb31064['name'];}_0x280882[_0xeb10('0x1b')](_0x2aa2fa)[_0xeb10('0x28')](_0xb31064);};}exports[_0xeb10('0x29')]=function(_0x4262bb,_0x39ca04){var _0x553eda={},_0x12cf9b={},_0x27bee3={'count':0x0,'rows':[]};var _0x5c482a=_[_0xeb10('0x2a')](db['ZendeskConfiguration'][_0xeb10('0x2b')],function(_0x55ecba){return{'name':_0x55ecba[_0xeb10('0x2c')],'type':_0x55ecba['type'][_0xeb10('0x2d')]};});_0x12cf9b['model']=_[_0xeb10('0x2a')](_0x5c482a,_0xeb10('0x27'));_0x12cf9b['query']=_[_0xeb10('0x2e')](_0x4262bb['query']);_0x12cf9b[_0xeb10('0x2f')]=_['intersection'](_0x12cf9b['model'],_0x12cf9b['query']);_0x553eda['attributes']=_[_0xeb10('0x30')](_0x12cf9b[_0xeb10('0x31')],qs[_0xeb10('0x32')](_0x4262bb[_0xeb10('0x33')][_0xeb10('0x32')]));_0x553eda['attributes']=_0x553eda[_0xeb10('0x34')][_0xeb10('0x35')]?_0x553eda[_0xeb10('0x34')]:_0x12cf9b[_0xeb10('0x31')];if(!_0x4262bb['query'][_0xeb10('0x36')]('nolimit')){_0x553eda['limit']=qs['limit'](_0x4262bb[_0xeb10('0x33')][_0xeb10('0x1d')]);_0x553eda[_0xeb10('0x1c')]=qs[_0xeb10('0x1c')](_0x4262bb['query']['offset']);}_0x553eda[_0xeb10('0x37')]=qs[_0xeb10('0x38')](_0x4262bb[_0xeb10('0x33')][_0xeb10('0x38')]);_0x553eda[_0xeb10('0x39')]=qs['filters'](_[_0xeb10('0x3a')](_0x4262bb[_0xeb10('0x33')],_0x12cf9b[_0xeb10('0x2f')]),_0x5c482a);if(_0x4262bb[_0xeb10('0x33')][_0xeb10('0x3b')]){_0x553eda[_0xeb10('0x39')]=_[_0xeb10('0x3c')](_0x553eda[_0xeb10('0x39')],{'$or':_[_0xeb10('0x2a')](_0x5c482a,function(_0x5ebae4){if(_0x5ebae4[_0xeb10('0x3d')]!==_0xeb10('0x3e')){var _0x4a8a41={};_0x4a8a41[_0x5ebae4['name']]={'$like':'%'+_0x4262bb[_0xeb10('0x33')][_0xeb10('0x3b')]+'%'};return _0x4a8a41;}})});}_0x553eda=_[_0xeb10('0x3c')]({},_0x553eda,_0x4262bb[_0xeb10('0x3f')]);var _0x4924c8={'where':_0x553eda[_0xeb10('0x39')]};return db[_0xeb10('0x40')][_0xeb10('0x1e')](_0x4924c8)[_0xeb10('0x23')](function(_0x5dda18){_0x27bee3[_0xeb10('0x1e')]=_0x5dda18;if(_0x4262bb[_0xeb10('0x33')]['includeAll']){_0x553eda['include']=[{'all':!![]}];}return db[_0xeb10('0x40')][_0xeb10('0x41')](_0x553eda);})[_0xeb10('0x23')](function(_0x262a07){_0x27bee3[_0xeb10('0x42')]=_0x262a07;return _0x27bee3;})[_0xeb10('0x23')](respondWithFilteredResult(_0x39ca04,_0x553eda))[_0xeb10('0x43')](handleError(_0x39ca04,null));};exports[_0xeb10('0x44')]=function(_0x5b6be5,_0x243d7d){var _0x28509c={'raw':![],'where':{'id':_0x5b6be5[_0xeb10('0x45')]['id']}},_0x3fefa5={};_0x3fefa5[_0xeb10('0x31')]=_[_0xeb10('0x2e')](db[_0xeb10('0x40')][_0xeb10('0x2b')]);_0x3fefa5['query']=_[_0xeb10('0x2e')](_0x5b6be5[_0xeb10('0x33')]);_0x3fefa5[_0xeb10('0x2f')]=_[_0xeb10('0x30')](_0x3fefa5['model'],_0x3fefa5[_0xeb10('0x33')]);_0x28509c[_0xeb10('0x34')]=_['intersection'](_0x3fefa5['model'],qs['fields'](_0x5b6be5[_0xeb10('0x33')][_0xeb10('0x32')]));_0x28509c[_0xeb10('0x34')]=_0x28509c['attributes'][_0xeb10('0x35')]?_0x28509c[_0xeb10('0x34')]:_0x3fefa5[_0xeb10('0x31')];if(_0x5b6be5['query'][_0xeb10('0x46')]){_0x28509c[_0xeb10('0x47')]=[{'all':!![]}];}_0x28509c=_[_0xeb10('0x3c')]({},_0x28509c,_0x5b6be5[_0xeb10('0x3f')]);return db[_0xeb10('0x40')][_0xeb10('0x48')](_0x28509c)[_0xeb10('0x23')](handleEntityNotFound(_0x243d7d,null))[_0xeb10('0x23')](respondWithResult(_0x243d7d,null))[_0xeb10('0x43')](handleError(_0x243d7d,null));};exports[_0xeb10('0x49')]=function(_0x46f09e,_0x4f2475){return db[_0xeb10('0x40')]['create'](_0x46f09e['body'],{})[_0xeb10('0x23')](respondWithResult(_0x4f2475,0xc9))['catch'](handleError(_0x4f2475,null));};exports['update']=function(_0xacf21c,_0x5ef3f0){if(_0xacf21c['body']['id']){delete _0xacf21c['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0xacf21c['params']['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0x5ef3f0,null))['then'](saveUpdates(_0xacf21c['body'],null))['then'](respondWithResult(_0x5ef3f0,null))['catch'](handleError(_0x5ef3f0,null));};exports['destroy']=function(_0x32fbcf,_0x155cf7){return db[_0xeb10('0x40')][_0xeb10('0x48')]({'where':{'id':_0x32fbcf[_0xeb10('0x45')]['id']}})['then'](handleEntityNotFound(_0x155cf7,null))['then'](removeEntity(_0x155cf7,null))[_0xeb10('0x43')](handleError(_0x155cf7,null));};exports[_0xeb10('0x4a')]=function(_0x3937b9,_0x3d70d2,_0x1f9aca){var _0x55709d={};var _0x3b2210={};var _0x340e45;var _0x4b051d;return db[_0xeb10('0x40')][_0xeb10('0x4b')]({'where':{'id':_0x3937b9['params']['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0x3d70d2,null))[_0xeb10('0x23')](function(_0x474b7e){if(_0x474b7e){_0x340e45=_0x474b7e;_0x3b2210['model']=_[_0xeb10('0x2e')](db[_0xeb10('0x4c')][_0xeb10('0x2b')]);_0x3b2210[_0xeb10('0x33')]=_['keys'](_0x3937b9[_0xeb10('0x33')]);_0x3b2210[_0xeb10('0x2f')]=_[_0xeb10('0x30')](_0x3b2210[_0xeb10('0x31')],_0x3b2210[_0xeb10('0x33')]);_0x55709d['attributes']=_[_0xeb10('0x30')](_0x3b2210[_0xeb10('0x31')],qs[_0xeb10('0x32')](_0x3937b9[_0xeb10('0x33')][_0xeb10('0x32')]));_0x55709d[_0xeb10('0x34')]=_0x55709d[_0xeb10('0x34')]['length']?_0x55709d['attributes']:_0x3b2210[_0xeb10('0x31')];_0x55709d[_0xeb10('0x37')]=qs[_0xeb10('0x38')](_0x3937b9[_0xeb10('0x33')][_0xeb10('0x38')]);_0x55709d[_0xeb10('0x39')]=qs[_0xeb10('0x2f')](_[_0xeb10('0x3a')](_0x3937b9['query'],_0x3b2210['filters']));if(_0x3937b9['query'][_0xeb10('0x3b')]){_0x55709d[_0xeb10('0x39')]=_['merge'](_0x55709d[_0xeb10('0x39')],{'$or':_['map'](_0x55709d[_0xeb10('0x34')],function(_0x2ba278){var _0x4226be={};_0x4226be[_0x2ba278]={'$like':'%'+_0x3937b9[_0xeb10('0x33')][_0xeb10('0x3b')]+'%'};return _0x4226be;})});}_0x55709d=_['merge']({},_0x55709d,_0x3937b9[_0xeb10('0x3f')]);return _0x340e45[_0xeb10('0x4a')](_0x55709d);}})[_0xeb10('0x23')](function(_0x241f62){if(_0x241f62){_0x4b051d=_0x241f62[_0xeb10('0x35')];if(!_0x3937b9[_0xeb10('0x33')][_0xeb10('0x36')](_0xeb10('0x4d'))){_0x55709d[_0xeb10('0x1d')]=qs[_0xeb10('0x1d')](_0x3937b9[_0xeb10('0x33')][_0xeb10('0x1d')]);_0x55709d[_0xeb10('0x1c')]=qs['offset'](_0x3937b9[_0xeb10('0x33')]['offset']);}return _0x340e45['getFields'](_0x55709d);}})[_0xeb10('0x23')](function(_0x52cb35){if(_0x52cb35){return _0x52cb35?{'count':_0x4b051d,'rows':_0x52cb35}:null;}})[_0xeb10('0x23')](respondWithResult(_0x3d70d2,null))['catch'](handleError(_0x3d70d2,null));};exports[_0xeb10('0x4e')]=function(_0x37a146,_0x4f120c,_0x4583bf){var _0x137579={};var _0x31fd85={};var _0x4f8bf3;var _0x3c4c08;return db['ZendeskConfiguration'][_0xeb10('0x4b')]({'where':{'id':_0x37a146[_0xeb10('0x45')]['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0x4f120c,null))[_0xeb10('0x23')](function(_0xe5e0b3){if(_0xe5e0b3){_0x4f8bf3=_0xe5e0b3;_0x31fd85['model']=_[_0xeb10('0x2e')](db[_0xeb10('0x4c')][_0xeb10('0x2b')]);_0x31fd85[_0xeb10('0x33')]=_[_0xeb10('0x2e')](_0x37a146[_0xeb10('0x33')]);_0x31fd85[_0xeb10('0x2f')]=_[_0xeb10('0x30')](_0x31fd85[_0xeb10('0x31')],_0x31fd85[_0xeb10('0x33')]);_0x137579[_0xeb10('0x34')]=_[_0xeb10('0x30')](_0x31fd85[_0xeb10('0x31')],qs[_0xeb10('0x32')](_0x37a146[_0xeb10('0x33')][_0xeb10('0x32')]));_0x137579[_0xeb10('0x34')]=_0x137579['attributes']['length']?_0x137579['attributes']:_0x31fd85[_0xeb10('0x31')];_0x137579['order']=qs[_0xeb10('0x38')](_0x37a146[_0xeb10('0x33')][_0xeb10('0x38')]);_0x137579['where']=qs[_0xeb10('0x2f')](_[_0xeb10('0x3a')](_0x37a146['query'],_0x31fd85[_0xeb10('0x2f')]));if(_0x37a146[_0xeb10('0x33')][_0xeb10('0x3b')]){_0x137579['where']=_[_0xeb10('0x3c')](_0x137579['where'],{'$or':_[_0xeb10('0x2a')](_0x137579[_0xeb10('0x34')],function(_0x2d2551){var _0x544bf0={};_0x544bf0[_0x2d2551]={'$like':'%'+_0x37a146['query'][_0xeb10('0x3b')]+'%'};return _0x544bf0;})});}_0x137579=_[_0xeb10('0x3c')]({},_0x137579,_0x37a146[_0xeb10('0x3f')]);return _0x4f8bf3['getSubjects'](_0x137579);}})[_0xeb10('0x23')](function(_0x253c61){if(_0x253c61){_0x3c4c08=_0x253c61[_0xeb10('0x35')];if(!_0x37a146['query'][_0xeb10('0x36')](_0xeb10('0x4d'))){_0x137579[_0xeb10('0x1d')]=qs[_0xeb10('0x1d')](_0x37a146['query'][_0xeb10('0x1d')]);_0x137579['offset']=qs[_0xeb10('0x1c')](_0x37a146['query'][_0xeb10('0x1c')]);}return _0x4f8bf3[_0xeb10('0x4e')](_0x137579);}})[_0xeb10('0x23')](function(_0xa9e260){if(_0xa9e260){return _0xa9e260?{'count':_0x3c4c08,'rows':_0xa9e260}:null;}})[_0xeb10('0x23')](respondWithResult(_0x4f120c,null))[_0xeb10('0x43')](handleError(_0x4f120c,null));};exports[_0xeb10('0x4f')]=function(_0x563824,_0xb01c48,_0x1e1a80){var _0x1cebb6={};var _0x26fdcb={};var _0x10dc94;var _0x375ff5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x563824[_0xeb10('0x45')]['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0xb01c48,null))[_0xeb10('0x23')](function(_0x5e8007){if(_0x5e8007){_0x10dc94=_0x5e8007;_0x26fdcb[_0xeb10('0x31')]=_[_0xeb10('0x2e')](db[_0xeb10('0x4c')][_0xeb10('0x2b')]);_0x26fdcb[_0xeb10('0x33')]=_[_0xeb10('0x2e')](_0x563824[_0xeb10('0x33')]);_0x26fdcb[_0xeb10('0x2f')]=_['intersection'](_0x26fdcb[_0xeb10('0x31')],_0x26fdcb[_0xeb10('0x33')]);_0x1cebb6['attributes']=_[_0xeb10('0x30')](_0x26fdcb['model'],qs[_0xeb10('0x32')](_0x563824[_0xeb10('0x33')][_0xeb10('0x32')]));_0x1cebb6[_0xeb10('0x34')]=_0x1cebb6[_0xeb10('0x34')][_0xeb10('0x35')]?_0x1cebb6['attributes']:_0x26fdcb[_0xeb10('0x31')];_0x1cebb6[_0xeb10('0x37')]=qs['sort'](_0x563824[_0xeb10('0x33')][_0xeb10('0x38')]);_0x1cebb6[_0xeb10('0x39')]=qs[_0xeb10('0x2f')](_['pick'](_0x563824[_0xeb10('0x33')],_0x26fdcb['filters']));if(_0x563824[_0xeb10('0x33')]['filter']){_0x1cebb6[_0xeb10('0x39')]=_['merge'](_0x1cebb6[_0xeb10('0x39')],{'$or':_['map'](_0x1cebb6[_0xeb10('0x34')],function(_0x1ee1d6){var _0x204d84={};_0x204d84[_0x1ee1d6]={'$like':'%'+_0x563824[_0xeb10('0x33')][_0xeb10('0x3b')]+'%'};return _0x204d84;})});}_0x1cebb6=_[_0xeb10('0x3c')]({},_0x1cebb6,_0x563824[_0xeb10('0x3f')]);return _0x10dc94[_0xeb10('0x4f')](_0x1cebb6);}})[_0xeb10('0x23')](function(_0x19a74c){if(_0x19a74c){_0x375ff5=_0x19a74c[_0xeb10('0x35')];if(!_0x563824[_0xeb10('0x33')][_0xeb10('0x36')]('nolimit')){_0x1cebb6['limit']=qs[_0xeb10('0x1d')](_0x563824['query']['limit']);_0x1cebb6[_0xeb10('0x1c')]=qs[_0xeb10('0x1c')](_0x563824[_0xeb10('0x33')]['offset']);}return _0x10dc94['getDescriptions'](_0x1cebb6);}})[_0xeb10('0x23')](function(_0x3e6281){if(_0x3e6281){return _0x3e6281?{'count':_0x375ff5,'rows':_0x3e6281}:null;}})['then'](respondWithResult(_0xb01c48,null))[_0xeb10('0x43')](handleError(_0xb01c48,null));};exports[_0xeb10('0x50')]=function(_0xe7c83b,_0x374cf6,_0x543f44){var _0x3815ae={};var _0x29cd4b={};var _0x3cec02;var _0x116ccc;return db['ZendeskConfiguration'][_0xeb10('0x4b')]({'where':{'id':_0xe7c83b['params']['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0x374cf6,null))[_0xeb10('0x23')](function(_0x9c7622){if(_0x9c7622){_0x3cec02=_0x9c7622;_0x29cd4b['model']=_[_0xeb10('0x2e')](db[_0xeb10('0x51')][_0xeb10('0x2b')]);_0x29cd4b[_0xeb10('0x33')]=_[_0xeb10('0x2e')](_0xe7c83b[_0xeb10('0x33')]);_0x29cd4b[_0xeb10('0x2f')]=_[_0xeb10('0x30')](_0x29cd4b[_0xeb10('0x31')],_0x29cd4b[_0xeb10('0x33')]);_0x3815ae[_0xeb10('0x34')]=_[_0xeb10('0x30')](_0x29cd4b['model'],qs[_0xeb10('0x32')](_0xe7c83b[_0xeb10('0x33')][_0xeb10('0x32')]));_0x3815ae['attributes']=_0x3815ae[_0xeb10('0x34')]['length']?_0x3815ae[_0xeb10('0x34')]:_0x29cd4b[_0xeb10('0x31')];_0x3815ae[_0xeb10('0x37')]=qs[_0xeb10('0x38')](_0xe7c83b['query'][_0xeb10('0x38')]);_0x3815ae[_0xeb10('0x39')]=qs[_0xeb10('0x2f')](_[_0xeb10('0x3a')](_0xe7c83b['query'],_0x29cd4b[_0xeb10('0x2f')]));if(_0xe7c83b[_0xeb10('0x33')][_0xeb10('0x3b')]){_0x3815ae['where']=_[_0xeb10('0x3c')](_0x3815ae[_0xeb10('0x39')],{'$or':_[_0xeb10('0x2a')](_0x3815ae[_0xeb10('0x34')],function(_0x30454c){var _0x553937={};_0x553937[_0x30454c]={'$like':'%'+_0xe7c83b[_0xeb10('0x33')]['filter']+'%'};return _0x553937;})});}_0x3815ae=_[_0xeb10('0x3c')]({},_0x3815ae,_0xe7c83b[_0xeb10('0x3f')]);return _0x3cec02[_0xeb10('0x50')](_0x3815ae);}})[_0xeb10('0x23')](function(_0x3205f3){if(_0x3205f3){_0x116ccc=_0x3205f3['length'];if(!_0xe7c83b[_0xeb10('0x33')][_0xeb10('0x36')](_0xeb10('0x4d'))){_0x3815ae['limit']=qs['limit'](_0xe7c83b[_0xeb10('0x33')][_0xeb10('0x1d')]);_0x3815ae[_0xeb10('0x1c')]=qs[_0xeb10('0x1c')](_0xe7c83b[_0xeb10('0x33')]['offset']);}return _0x3cec02[_0xeb10('0x50')](_0x3815ae);}})[_0xeb10('0x23')](function(_0x1a12d0){if(_0x1a12d0){return _0x1a12d0?{'count':_0x116ccc,'rows':_0x1a12d0}:null;}})['then'](respondWithResult(_0x374cf6,null))[_0xeb10('0x43')](handleError(_0x374cf6,null));};exports[_0xeb10('0x52')]=function(_0x4dc2f9,_0x10be09,_0xdc2d5e){if(_0x4dc2f9['body']['id']){delete _0x4dc2f9['body']['id'];}return db[_0xeb10('0x40')][_0xeb10('0x4b')]({'where':{'id':_0x4dc2f9[_0xeb10('0x45')]['id']}})[_0xeb10('0x23')](handleEntityNotFound(_0x10be09,null))[_0xeb10('0x23')](function(_0x61c4ba){if(_0x61c4ba){return _0x61c4ba[_0xeb10('0x52')](_0x4dc2f9['body'][_0xeb10('0x53')]||[]);}return null;})[_0xeb10('0x23')](respondWithResult(_0x10be09,null))['catch'](handleError(_0x10be09,null));}; \ No newline at end of file +var _0x18c2=['then','destroy','error','stack','name','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','findOne','ZendeskField','filter','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update'];(function(_0x2a50fc,_0x792726){var _0x5aa6a2=function(_0x26ca83){while(--_0x26ca83){_0x2a50fc['push'](_0x2a50fc['shift']());}};_0x5aa6a2(++_0x792726);}(_0x18c2,0x134));var _0x218c=function(_0x38bd6e,_0x3f0e56){_0x38bd6e=_0x38bd6e-0x0;var _0x18e42d=_0x18c2[_0x38bd6e];return _0x18e42d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x218c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x218c('0x1'));var rp=require(_0x218c('0x2'));var moment=require(_0x218c('0x3'));var BPromise=require(_0x218c('0x4'));var Mustache=require(_0x218c('0x5'));var util=require(_0x218c('0x6'));var path=require(_0x218c('0x7'));var sox=require(_0x218c('0x8'));var csv=require(_0x218c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x218c('0xa'));var _=require(_0x218c('0xb'));var squel=require(_0x218c('0xc'));var crypto=require(_0x218c('0xd'));var jsforce=require(_0x218c('0xe'));var deskjs=require(_0x218c('0xf'));var toCsv=require(_0x218c('0x9'));var querystring=require(_0x218c('0x10'));var Papa=require(_0x218c('0x11'));var Redis=require('ioredis');var authService=require(_0x218c('0x12'));var qs=require(_0x218c('0x13'));var as=require(_0x218c('0x14'));var hardwareService=require(_0x218c('0x15'));var logger=require(_0x218c('0x16'))(_0x218c('0x17'));var utils=require(_0x218c('0x18'));var config=require(_0x218c('0x19'));var licenseUtil=require(_0x218c('0x1a'));var db=require(_0x218c('0x1b'))['db'];function respondWithStatusCode(_0x586ce0,_0xdda587){_0xdda587=_0xdda587||0xcc;return function(_0x4e5540){if(_0x4e5540){return _0x586ce0[_0x218c('0x1c')](_0xdda587);}return _0x586ce0['status'](_0xdda587)[_0x218c('0x1d')]();};}function respondWithResult(_0x5c0454,_0x18c156){_0x18c156=_0x18c156||0xc8;return function(_0x1d4088){if(_0x1d4088){return _0x5c0454[_0x218c('0x1e')](_0x18c156)[_0x218c('0x1f')](_0x1d4088);}};}function respondWithFilteredResult(_0x50d889,_0x4fd0fb){return function(_0x12ab1d){if(_0x12ab1d){var _0x4dd570=typeof _0x4fd0fb[_0x218c('0x20')]===_0x218c('0x21')&&typeof _0x4fd0fb['limit']===_0x218c('0x21');var _0x58b8e1=_0x12ab1d[_0x218c('0x22')];var _0x7b8c15=_0x4dd570?0x0:_0x4fd0fb['offset'];var _0x310c8a=_0x4dd570?_0x12ab1d[_0x218c('0x22')]:_0x4fd0fb[_0x218c('0x20')]+_0x4fd0fb['limit'];var _0x154c1d;if(_0x310c8a>=_0x58b8e1){_0x310c8a=_0x58b8e1;_0x154c1d=0xc8;}else{_0x154c1d=0xce;}_0x50d889['status'](_0x154c1d);return _0x50d889['set'](_0x218c('0x23'),_0x7b8c15+'-'+_0x310c8a+'/'+_0x58b8e1)[_0x218c('0x1f')](_0x12ab1d);}return null;};}function patchUpdates(_0x4606ae){return function(_0x44bc96){try{jsonpatch[_0x218c('0x24')](_0x44bc96,_0x4606ae,!![]);}catch(_0x47932d){return BPromise[_0x218c('0x25')](_0x47932d);}return _0x44bc96[_0x218c('0x26')]();};}function saveUpdates(_0x2fcd02,_0x19d1a1){return function(_0x49fa58){if(_0x49fa58){return _0x49fa58[_0x218c('0x27')](_0x2fcd02)[_0x218c('0x28')](function(_0x423c81){return _0x423c81;});}return null;};}function removeEntity(_0x45dde9,_0x2f3694){return function(_0x432d40){if(_0x432d40){return _0x432d40[_0x218c('0x29')]()[_0x218c('0x28')](function(){_0x45dde9[_0x218c('0x1e')](0xcc)[_0x218c('0x1d')]();});}};}function handleEntityNotFound(_0x322b6f,_0x4bd476){return function(_0x562c64){if(!_0x562c64){_0x322b6f[_0x218c('0x1c')](0x194);}return _0x562c64;};}function handleError(_0x6ab28,_0x4d2d33){_0x4d2d33=_0x4d2d33||0x1f4;return function(_0x51c160){logger[_0x218c('0x2a')](_0x51c160[_0x218c('0x2b')]);if(_0x51c160[_0x218c('0x2c')]){delete _0x51c160[_0x218c('0x2c')];}_0x6ab28['status'](_0x4d2d33)['send'](_0x51c160);};}exports['index']=function(_0x37d790,_0xf11116){var _0x8af8f0={},_0x16060d={},_0x21b17a={'count':0x0,'rows':[]};var _0x769ce1=_['map'](db[_0x218c('0x2d')][_0x218c('0x2e')],function(_0x327993){return{'name':_0x327993[_0x218c('0x2f')],'type':_0x327993[_0x218c('0x30')][_0x218c('0x31')]};});_0x16060d[_0x218c('0x32')]=_[_0x218c('0x33')](_0x769ce1,_0x218c('0x2c'));_0x16060d[_0x218c('0x34')]=_[_0x218c('0x35')](_0x37d790[_0x218c('0x34')]);_0x16060d[_0x218c('0x36')]=_['intersection'](_0x16060d['model'],_0x16060d[_0x218c('0x34')]);_0x8af8f0[_0x218c('0x37')]=_[_0x218c('0x38')](_0x16060d[_0x218c('0x32')],qs[_0x218c('0x39')](_0x37d790[_0x218c('0x34')]['fields']));_0x8af8f0[_0x218c('0x37')]=_0x8af8f0[_0x218c('0x37')][_0x218c('0x3a')]?_0x8af8f0[_0x218c('0x37')]:_0x16060d['model'];if(!_0x37d790[_0x218c('0x34')][_0x218c('0x3b')](_0x218c('0x3c'))){_0x8af8f0['limit']=qs[_0x218c('0x3d')](_0x37d790['query'][_0x218c('0x3d')]);_0x8af8f0[_0x218c('0x20')]=qs[_0x218c('0x20')](_0x37d790['query'][_0x218c('0x20')]);}_0x8af8f0[_0x218c('0x3e')]=qs[_0x218c('0x3f')](_0x37d790[_0x218c('0x34')][_0x218c('0x3f')]);_0x8af8f0[_0x218c('0x40')]=qs[_0x218c('0x36')](_[_0x218c('0x41')](_0x37d790[_0x218c('0x34')],_0x16060d[_0x218c('0x36')]),_0x769ce1);if(_0x37d790[_0x218c('0x34')]['filter']){_0x8af8f0['where']=_[_0x218c('0x42')](_0x8af8f0['where'],{'$or':_[_0x218c('0x33')](_0x769ce1,function(_0xac4aa9){if(_0xac4aa9[_0x218c('0x30')]!==_0x218c('0x43')){var _0x56b92d={};_0x56b92d[_0xac4aa9[_0x218c('0x2c')]]={'$like':'%'+_0x37d790['query']['filter']+'%'};return _0x56b92d;}})});}_0x8af8f0=_[_0x218c('0x42')]({},_0x8af8f0,_0x37d790[_0x218c('0x44')]);var _0x535f2c={'where':_0x8af8f0[_0x218c('0x40')]};return db[_0x218c('0x2d')]['count'](_0x535f2c)['then'](function(_0x358c6b){_0x21b17a['count']=_0x358c6b;if(_0x37d790['query'][_0x218c('0x45')]){_0x8af8f0[_0x218c('0x46')]=[{'all':!![]}];}return db[_0x218c('0x2d')]['findAll'](_0x8af8f0);})[_0x218c('0x28')](function(_0x41b35c){_0x21b17a['rows']=_0x41b35c;return _0x21b17a;})[_0x218c('0x28')](respondWithFilteredResult(_0xf11116,_0x8af8f0))[_0x218c('0x47')](handleError(_0xf11116,null));};exports[_0x218c('0x48')]=function(_0x1484c3,_0x361f54){var _0x1e7010={'raw':![],'where':{'id':_0x1484c3[_0x218c('0x49')]['id']}},_0x3c3f7c={};_0x3c3f7c['model']=_[_0x218c('0x35')](db[_0x218c('0x2d')][_0x218c('0x2e')]);_0x3c3f7c['query']=_[_0x218c('0x35')](_0x1484c3[_0x218c('0x34')]);_0x3c3f7c['filters']=_[_0x218c('0x38')](_0x3c3f7c[_0x218c('0x32')],_0x3c3f7c[_0x218c('0x34')]);_0x1e7010['attributes']=_['intersection'](_0x3c3f7c['model'],qs[_0x218c('0x39')](_0x1484c3[_0x218c('0x34')]['fields']));_0x1e7010[_0x218c('0x37')]=_0x1e7010['attributes']['length']?_0x1e7010['attributes']:_0x3c3f7c[_0x218c('0x32')];if(_0x1484c3[_0x218c('0x34')][_0x218c('0x45')]){_0x1e7010[_0x218c('0x46')]=[{'all':!![]}];}_0x1e7010=_['merge']({},_0x1e7010,_0x1484c3[_0x218c('0x44')]);return db[_0x218c('0x2d')][_0x218c('0x4a')](_0x1e7010)[_0x218c('0x28')](handleEntityNotFound(_0x361f54,null))[_0x218c('0x28')](respondWithResult(_0x361f54,null))[_0x218c('0x47')](handleError(_0x361f54,null));};exports[_0x218c('0x4b')]=function(_0x12469d,_0xa5fbc4){return db[_0x218c('0x2d')][_0x218c('0x4b')](_0x12469d[_0x218c('0x4c')],{})[_0x218c('0x28')](respondWithResult(_0xa5fbc4,0xc9))[_0x218c('0x47')](handleError(_0xa5fbc4,null));};exports[_0x218c('0x27')]=function(_0x2fb7d7,_0x354da6){if(_0x2fb7d7[_0x218c('0x4c')]['id']){delete _0x2fb7d7[_0x218c('0x4c')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x2fb7d7[_0x218c('0x49')]['id']}})['then'](handleEntityNotFound(_0x354da6,null))['then'](saveUpdates(_0x2fb7d7['body'],null))['then'](respondWithResult(_0x354da6,null))[_0x218c('0x47')](handleError(_0x354da6,null));};exports[_0x218c('0x29')]=function(_0x27100c,_0x42c632){return db[_0x218c('0x2d')][_0x218c('0x4a')]({'where':{'id':_0x27100c[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x42c632,null))['then'](removeEntity(_0x42c632,null))[_0x218c('0x47')](handleError(_0x42c632,null));};exports['getFields']=function(_0x552dc5,_0x79c8db,_0x128daa){var _0x3f8058={};var _0x415ab1={};var _0x3e85a3;var _0x27a5c8;return db[_0x218c('0x2d')][_0x218c('0x4d')]({'where':{'id':_0x552dc5[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x79c8db,null))[_0x218c('0x28')](function(_0x296a44){if(_0x296a44){_0x3e85a3=_0x296a44;_0x415ab1[_0x218c('0x32')]=_['keys'](db[_0x218c('0x4e')][_0x218c('0x2e')]);_0x415ab1[_0x218c('0x34')]=_['keys'](_0x552dc5['query']);_0x415ab1[_0x218c('0x36')]=_[_0x218c('0x38')](_0x415ab1[_0x218c('0x32')],_0x415ab1[_0x218c('0x34')]);_0x3f8058[_0x218c('0x37')]=_[_0x218c('0x38')](_0x415ab1['model'],qs[_0x218c('0x39')](_0x552dc5[_0x218c('0x34')][_0x218c('0x39')]));_0x3f8058[_0x218c('0x37')]=_0x3f8058['attributes']['length']?_0x3f8058[_0x218c('0x37')]:_0x415ab1['model'];_0x3f8058[_0x218c('0x3e')]=qs['sort'](_0x552dc5[_0x218c('0x34')][_0x218c('0x3f')]);_0x3f8058['where']=qs['filters'](_[_0x218c('0x41')](_0x552dc5[_0x218c('0x34')],_0x415ab1['filters']));if(_0x552dc5[_0x218c('0x34')][_0x218c('0x4f')]){_0x3f8058[_0x218c('0x40')]=_[_0x218c('0x42')](_0x3f8058[_0x218c('0x40')],{'$or':_[_0x218c('0x33')](_0x3f8058[_0x218c('0x37')],function(_0xf6ba1b){var _0x3da612={};_0x3da612[_0xf6ba1b]={'$like':'%'+_0x552dc5['query'][_0x218c('0x4f')]+'%'};return _0x3da612;})});}_0x3f8058=_['merge']({},_0x3f8058,_0x552dc5[_0x218c('0x44')]);return _0x3e85a3[_0x218c('0x50')](_0x3f8058);}})[_0x218c('0x28')](function(_0x14a092){if(_0x14a092){_0x27a5c8=_0x14a092[_0x218c('0x3a')];if(!_0x552dc5[_0x218c('0x34')][_0x218c('0x3b')](_0x218c('0x3c'))){_0x3f8058[_0x218c('0x3d')]=qs[_0x218c('0x3d')](_0x552dc5[_0x218c('0x34')][_0x218c('0x3d')]);_0x3f8058[_0x218c('0x20')]=qs[_0x218c('0x20')](_0x552dc5[_0x218c('0x34')][_0x218c('0x20')]);}return _0x3e85a3[_0x218c('0x50')](_0x3f8058);}})['then'](function(_0x5a96b8){if(_0x5a96b8){return _0x5a96b8?{'count':_0x27a5c8,'rows':_0x5a96b8}:null;}})[_0x218c('0x28')](respondWithResult(_0x79c8db,null))[_0x218c('0x47')](handleError(_0x79c8db,null));};exports[_0x218c('0x51')]=function(_0x37a4eb,_0x59800e,_0x31b3e7){var _0x4a6437={};var _0x2716cb={};var _0x4c4e45;var _0xba9b91;return db['ZendeskConfiguration'][_0x218c('0x4d')]({'where':{'id':_0x37a4eb[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x59800e,null))[_0x218c('0x28')](function(_0x5afde3){if(_0x5afde3){_0x4c4e45=_0x5afde3;_0x2716cb[_0x218c('0x32')]=_[_0x218c('0x35')](db[_0x218c('0x4e')][_0x218c('0x2e')]);_0x2716cb[_0x218c('0x34')]=_[_0x218c('0x35')](_0x37a4eb[_0x218c('0x34')]);_0x2716cb[_0x218c('0x36')]=_[_0x218c('0x38')](_0x2716cb[_0x218c('0x32')],_0x2716cb['query']);_0x4a6437[_0x218c('0x37')]=_[_0x218c('0x38')](_0x2716cb['model'],qs[_0x218c('0x39')](_0x37a4eb[_0x218c('0x34')][_0x218c('0x39')]));_0x4a6437['attributes']=_0x4a6437[_0x218c('0x37')]['length']?_0x4a6437[_0x218c('0x37')]:_0x2716cb[_0x218c('0x32')];_0x4a6437[_0x218c('0x3e')]=qs[_0x218c('0x3f')](_0x37a4eb[_0x218c('0x34')][_0x218c('0x3f')]);_0x4a6437[_0x218c('0x40')]=qs[_0x218c('0x36')](_[_0x218c('0x41')](_0x37a4eb[_0x218c('0x34')],_0x2716cb['filters']));if(_0x37a4eb[_0x218c('0x34')][_0x218c('0x4f')]){_0x4a6437[_0x218c('0x40')]=_['merge'](_0x4a6437[_0x218c('0x40')],{'$or':_[_0x218c('0x33')](_0x4a6437[_0x218c('0x37')],function(_0x560961){var _0x58f44b={};_0x58f44b[_0x560961]={'$like':'%'+_0x37a4eb[_0x218c('0x34')][_0x218c('0x4f')]+'%'};return _0x58f44b;})});}_0x4a6437=_[_0x218c('0x42')]({},_0x4a6437,_0x37a4eb[_0x218c('0x44')]);return _0x4c4e45[_0x218c('0x51')](_0x4a6437);}})[_0x218c('0x28')](function(_0x11c506){if(_0x11c506){_0xba9b91=_0x11c506[_0x218c('0x3a')];if(!_0x37a4eb[_0x218c('0x34')][_0x218c('0x3b')](_0x218c('0x3c'))){_0x4a6437[_0x218c('0x3d')]=qs['limit'](_0x37a4eb[_0x218c('0x34')][_0x218c('0x3d')]);_0x4a6437['offset']=qs[_0x218c('0x20')](_0x37a4eb['query'][_0x218c('0x20')]);}return _0x4c4e45[_0x218c('0x51')](_0x4a6437);}})[_0x218c('0x28')](function(_0x4342d9){if(_0x4342d9){return _0x4342d9?{'count':_0xba9b91,'rows':_0x4342d9}:null;}})[_0x218c('0x28')](respondWithResult(_0x59800e,null))[_0x218c('0x47')](handleError(_0x59800e,null));};exports[_0x218c('0x52')]=function(_0x397f40,_0x2ecb55,_0x5d7e4a){var _0x5330d5={};var _0x55515c={};var _0x2cef84;var _0x4f1d93;return db[_0x218c('0x2d')]['findOne']({'where':{'id':_0x397f40[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x2ecb55,null))['then'](function(_0x24ad8a){if(_0x24ad8a){_0x2cef84=_0x24ad8a;_0x55515c[_0x218c('0x32')]=_['keys'](db[_0x218c('0x4e')][_0x218c('0x2e')]);_0x55515c[_0x218c('0x34')]=_[_0x218c('0x35')](_0x397f40[_0x218c('0x34')]);_0x55515c[_0x218c('0x36')]=_['intersection'](_0x55515c[_0x218c('0x32')],_0x55515c[_0x218c('0x34')]);_0x5330d5[_0x218c('0x37')]=_[_0x218c('0x38')](_0x55515c[_0x218c('0x32')],qs['fields'](_0x397f40[_0x218c('0x34')][_0x218c('0x39')]));_0x5330d5[_0x218c('0x37')]=_0x5330d5[_0x218c('0x37')][_0x218c('0x3a')]?_0x5330d5[_0x218c('0x37')]:_0x55515c[_0x218c('0x32')];_0x5330d5[_0x218c('0x3e')]=qs[_0x218c('0x3f')](_0x397f40[_0x218c('0x34')][_0x218c('0x3f')]);_0x5330d5[_0x218c('0x40')]=qs[_0x218c('0x36')](_['pick'](_0x397f40['query'],_0x55515c[_0x218c('0x36')]));if(_0x397f40[_0x218c('0x34')][_0x218c('0x4f')]){_0x5330d5[_0x218c('0x40')]=_[_0x218c('0x42')](_0x5330d5['where'],{'$or':_[_0x218c('0x33')](_0x5330d5['attributes'],function(_0x4dcbd6){var _0x5a6057={};_0x5a6057[_0x4dcbd6]={'$like':'%'+_0x397f40[_0x218c('0x34')][_0x218c('0x4f')]+'%'};return _0x5a6057;})});}_0x5330d5=_[_0x218c('0x42')]({},_0x5330d5,_0x397f40[_0x218c('0x44')]);return _0x2cef84[_0x218c('0x52')](_0x5330d5);}})[_0x218c('0x28')](function(_0x402274){if(_0x402274){_0x4f1d93=_0x402274[_0x218c('0x3a')];if(!_0x397f40[_0x218c('0x34')][_0x218c('0x3b')](_0x218c('0x3c'))){_0x5330d5[_0x218c('0x3d')]=qs[_0x218c('0x3d')](_0x397f40[_0x218c('0x34')]['limit']);_0x5330d5[_0x218c('0x20')]=qs[_0x218c('0x20')](_0x397f40[_0x218c('0x34')][_0x218c('0x20')]);}return _0x2cef84[_0x218c('0x52')](_0x5330d5);}})['then'](function(_0x233d55){if(_0x233d55){return _0x233d55?{'count':_0x4f1d93,'rows':_0x233d55}:null;}})['then'](respondWithResult(_0x2ecb55,null))['catch'](handleError(_0x2ecb55,null));};exports[_0x218c('0x53')]=function(_0x107a17,_0x50ecea,_0x40d6fe){var _0x16f643={};var _0x15f06f={};var _0x65eb03;var _0x11dda8;return db[_0x218c('0x2d')][_0x218c('0x4d')]({'where':{'id':_0x107a17[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x50ecea,null))[_0x218c('0x28')](function(_0x1f990b){if(_0x1f990b){_0x65eb03=_0x1f990b;_0x15f06f[_0x218c('0x32')]=_['keys'](db[_0x218c('0x54')][_0x218c('0x2e')]);_0x15f06f[_0x218c('0x34')]=_[_0x218c('0x35')](_0x107a17[_0x218c('0x34')]);_0x15f06f[_0x218c('0x36')]=_[_0x218c('0x38')](_0x15f06f['model'],_0x15f06f['query']);_0x16f643[_0x218c('0x37')]=_['intersection'](_0x15f06f[_0x218c('0x32')],qs[_0x218c('0x39')](_0x107a17[_0x218c('0x34')][_0x218c('0x39')]));_0x16f643[_0x218c('0x37')]=_0x16f643[_0x218c('0x37')][_0x218c('0x3a')]?_0x16f643['attributes']:_0x15f06f[_0x218c('0x32')];_0x16f643[_0x218c('0x3e')]=qs['sort'](_0x107a17[_0x218c('0x34')][_0x218c('0x3f')]);_0x16f643[_0x218c('0x40')]=qs[_0x218c('0x36')](_['pick'](_0x107a17['query'],_0x15f06f[_0x218c('0x36')]));if(_0x107a17[_0x218c('0x34')][_0x218c('0x4f')]){_0x16f643[_0x218c('0x40')]=_[_0x218c('0x42')](_0x16f643[_0x218c('0x40')],{'$or':_['map'](_0x16f643[_0x218c('0x37')],function(_0x45605c){var _0x493a04={};_0x493a04[_0x45605c]={'$like':'%'+_0x107a17['query'][_0x218c('0x4f')]+'%'};return _0x493a04;})});}_0x16f643=_[_0x218c('0x42')]({},_0x16f643,_0x107a17['options']);return _0x65eb03[_0x218c('0x53')](_0x16f643);}})[_0x218c('0x28')](function(_0x25dafa){if(_0x25dafa){_0x11dda8=_0x25dafa['length'];if(!_0x107a17[_0x218c('0x34')][_0x218c('0x3b')](_0x218c('0x3c'))){_0x16f643[_0x218c('0x3d')]=qs[_0x218c('0x3d')](_0x107a17[_0x218c('0x34')][_0x218c('0x3d')]);_0x16f643[_0x218c('0x20')]=qs[_0x218c('0x20')](_0x107a17[_0x218c('0x34')][_0x218c('0x20')]);}return _0x65eb03[_0x218c('0x53')](_0x16f643);}})[_0x218c('0x28')](function(_0x50ff08){if(_0x50ff08){return _0x50ff08?{'count':_0x11dda8,'rows':_0x50ff08}:null;}})[_0x218c('0x28')](respondWithResult(_0x50ecea,null))['catch'](handleError(_0x50ecea,null));};exports[_0x218c('0x55')]=function(_0x232332,_0x1c73af,_0x863b78){if(_0x232332[_0x218c('0x4c')]['id']){delete _0x232332[_0x218c('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x218c('0x4d')]({'where':{'id':_0x232332[_0x218c('0x49')]['id']}})[_0x218c('0x28')](handleEntityNotFound(_0x1c73af,null))['then'](function(_0x172f58){if(_0x172f58){return _0x172f58['setTags'](_0x232332[_0x218c('0x4c')][_0x218c('0x56')]||[]);}return null;})[_0x218c('0x28')](respondWithResult(_0x1c73af,null))['catch'](handleError(_0x1c73af,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0dba08e..9c5a7ca 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 _0x13f6=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','lodash','util','moment','bluebird'];(function(_0x265aae,_0x3edce6){var _0x1e0177=function(_0x398191){while(--_0x398191){_0x265aae['push'](_0x265aae['shift']());}};_0x1e0177(++_0x3edce6);}(_0x13f6,0x124));var _0x613f=function(_0x440f3a,_0x639689){_0x440f3a=_0x440f3a-0x0;var _0x457152=_0x13f6[_0x440f3a];return _0x457152;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x613f('0x2'));var BPromise=require(_0x613f('0x3'));var rp=require(_0x613f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var attributes=require(_0x613f('0x7'));module['exports']=function(_0x3f3525,_0x2367b3){return _0x3f3525['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x4ccf93,_0x47be1a){var _0x4a0f82=function(_0x593462){while(--_0x593462){_0x4ccf93['push'](_0x4ccf93['shift']());}};_0x4a0f82(++_0x47be1a);}(_0xda2d,0x102));var _0xdda2=function(_0x1908f5,_0x2b7a35){_0x1908f5=_0x1908f5-0x0;var _0x59847e=_0xda2d[_0x1908f5];return _0x59847e;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'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 79629d1..dc96577 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 _0xc510=['stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x67464f,_0x432c68){var _0x14c459=function(_0x37f456){while(--_0x37f456){_0x67464f['push'](_0x67464f['shift']());}};_0x14c459(++_0x432c68);}(_0xc510,0x190));var _0x0c51=function(_0x576cc7,_0x3c6b04){_0x576cc7=_0x576cc7-0x0;var _0x2686f0=_0xc510[_0x576cc7];return _0x2686f0;};'use strict';var _=require(_0x0c51('0x0'));var util=require('util');var moment=require(_0x0c51('0x1'));var BPromise=require(_0x0c51('0x2'));var rs=require(_0x0c51('0x3'));var fs=require('fs');var Redis=require(_0x0c51('0x4'));var db=require(_0x0c51('0x5'))['db'];var utils=require(_0x0c51('0x6'));var logger=require(_0x0c51('0x7'))(_0x0c51('0x8'));var config=require(_0x0c51('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0c51('0xa')][_0x0c51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a486,_0x1ea031,_0x15c05d){return new BPromise(function(_0x5604a8,_0x51b79f){return client[_0x0c51('0xc')](_0x44a486,_0x15c05d)['then'](function(_0x1dd492){logger[_0x0c51('0xd')](_0x0c51('0xe'),_0x1ea031,'request\x20sent');logger[_0x0c51('0xf')](_0x0c51('0x10'),_0x1ea031,_0x0c51('0x11'),JSON[_0x0c51('0x12')](_0x1dd492));if(_0x1dd492['error']){if(_0x1dd492[_0x0c51('0x13')]['code']===0x1f4){logger[_0x0c51('0x13')](_0x0c51('0xe'),_0x1ea031,_0x1dd492['error'][_0x0c51('0x14')]);return _0x51b79f(_0x1dd492[_0x0c51('0x13')][_0x0c51('0x14')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x1ea031,_0x1dd492[_0x0c51('0x13')][_0x0c51('0x14')]);return _0x5604a8(_0x1dd492[_0x0c51('0x13')][_0x0c51('0x14')]);}else{logger['info'](_0x0c51('0xe'),_0x1ea031,_0x0c51('0x11'));_0x5604a8(_0x1dd492['result'][_0x0c51('0x14')]);}})[_0x0c51('0x15')](function(_0x33d322){logger[_0x0c51('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1ea031,_0x33d322);_0x51b79f(_0x33d322);});});} \ No newline at end of file +var _0xc931=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xc931,0x9c));var _0x1c93=function(_0x2801b2,_0x1dbe10){_0x2801b2=_0x2801b2-0x0;var _0x1eb39a=_0xc931[_0x2801b2];return _0x1eb39a;};'use strict';var _=require(_0x1c93('0x0'));var util=require(_0x1c93('0x1'));var moment=require('moment');var BPromise=require(_0x1c93('0x2'));var rs=require(_0x1c93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c93('0x4'))['db'];var utils=require(_0x1c93('0x5'));var logger=require(_0x1c93('0x6'))(_0x1c93('0x7'));var config=require(_0x1c93('0x8'));var jayson=require(_0x1c93('0x9'));var client=jayson[_0x1c93('0xa')][_0x1c93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f3272,_0x461438,_0x157c63){return new BPromise(function(_0x3f1116,_0x367d3a){return client[_0x1c93('0xc')](_0x2f3272,_0x157c63)[_0x1c93('0xd')](function(_0x45afad){logger[_0x1c93('0xe')](_0x1c93('0xf'),_0x461438,_0x1c93('0x10'));logger[_0x1c93('0x11')](_0x1c93('0x12'),_0x461438,_0x1c93('0x10'),JSON[_0x1c93('0x13')](_0x45afad));if(_0x45afad['error']){if(_0x45afad[_0x1c93('0x14')][_0x1c93('0x15')]===0x1f4){logger[_0x1c93('0x14')](_0x1c93('0xf'),_0x461438,_0x45afad[_0x1c93('0x14')][_0x1c93('0x16')]);return _0x367d3a(_0x45afad[_0x1c93('0x14')][_0x1c93('0x16')]);}logger[_0x1c93('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x461438,_0x45afad[_0x1c93('0x14')]['message']);return _0x3f1116(_0x45afad[_0x1c93('0x14')]['message']);}else{logger['info'](_0x1c93('0xf'),_0x461438,_0x1c93('0x10'));_0x3f1116(_0x45afad['result'][_0x1c93('0x16')]);}})['catch'](function(_0x4b07bf){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x461438,_0x4b07bf);_0x367d3a(_0x4b07bf);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fc063d3..7565e65 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 _0xcf8b=['update','delete','destroy','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','post','put','/:id'];(function(_0x28ea33,_0x197124){var _0x475761=function(_0x3480d9){while(--_0x3480d9){_0x28ea33['push'](_0x28ea33['shift']());}};_0x475761(++_0x197124);}(_0xcf8b,0x99));var _0xbcf8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf8b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xbcf8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbcf8('0x1'));var router=express[_0xbcf8('0x2')]();var fs_extra=require(_0xbcf8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbcf8('0x4'));var config=require(_0xbcf8('0x5'));var controller=require(_0xbcf8('0x6'));router[_0xbcf8('0x7')]('/',auth[_0xbcf8('0x8')](),controller['index']);router[_0xbcf8('0x7')]('/:id',auth[_0xbcf8('0x8')](),controller['show']);router[_0xbcf8('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbcf8('0xa')](_0xbcf8('0xb'),auth[_0xbcf8('0x8')](),controller[_0xbcf8('0xc')]);router[_0xbcf8('0xd')]('/:id',auth[_0xbcf8('0x8')](),controller[_0xbcf8('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7cb6=['put','/:id','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7cb6,0x94));var _0x67cb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7cb6[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x67cb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x67cb('0x1'));var router=express[_0x67cb('0x2')]();var fs_extra=require(_0x67cb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x67cb('0x4'));var config=require(_0x67cb('0x5'));var controller=require(_0x67cb('0x6'));router[_0x67cb('0x7')]('/',auth[_0x67cb('0x8')](),controller[_0x67cb('0x9')]);router[_0x67cb('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x67cb('0xa')]);router['post']('/',auth[_0x67cb('0x8')](),controller[_0x67cb('0xb')]);router[_0x67cb('0xc')](_0x67cb('0xd'),auth[_0x67cb('0x8')](),controller['update']);router['delete'](_0x67cb('0xd'),auth['isAuthenticated'](),controller[_0x67cb('0xe')]);module[_0x67cb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5a1da4e..9f3700b 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 _0x3ddc=['string','variable','customVariable','ENUM','STRING','BOOLEAN','sequelize','exports'];(function(_0x50453f,_0xfa8c33){var _0x21c6b4=function(_0x13984f){while(--_0x13984f){_0x50453f['push'](_0x50453f['shift']());}};_0x21c6b4(++_0xfa8c33);}(_0x3ddc,0xce));var _0xc3dd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ddc[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xc3dd('0x0'));module[_0xc3dd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc3dd('0x2'),_0xc3dd('0x3'),_0xc3dd('0x4'),'keyValue','picklist'),'defaultValue':_0xc3dd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc3dd('0x5')](_0xc3dd('0x2'),_0xc3dd('0x3'),_0xc3dd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc3dd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc3dd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc3dd('0x6')]}}; \ No newline at end of file +var _0x5dbf=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','picklist','string'];(function(_0x4e10fc,_0x4b3fa2){var _0x503d36=function(_0x57e9ac){while(--_0x57e9ac){_0x4e10fc['push'](_0x4e10fc['shift']());}};_0x503d36(++_0x4b3fa2);}(_0x5dbf,0x19a));var _0xf5db=function(_0x4723eb,_0x7f6b1e){_0x4723eb=_0x4723eb-0x0;var _0x37e188=_0x5dbf[_0x4723eb];return _0x37e188;};'use strict';var Sequelize=require('sequelize');module[_0xf5db('0x0')]={'type':{'type':Sequelize[_0xf5db('0x1')]('string',_0xf5db('0x2'),_0xf5db('0x3'),'keyValue',_0xf5db('0x4')),'defaultValue':_0xf5db('0x5')},'content':{'type':Sequelize[_0xf5db('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf5db('0x1')]('string',_0xf5db('0x2'),_0xf5db('0x3'))},'keyContent':{'type':Sequelize[_0xf5db('0x6')]},'idField':{'type':Sequelize[_0xf5db('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf5db('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5db('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9595fdf..cd80056 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 _0x79e0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','stack','name','index','map','ZendeskField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x197491,_0x506e8c){var _0x24e8a1=function(_0xc9a7f8){while(--_0xc9a7f8){_0x197491['push'](_0x197491['shift']());}};_0x24e8a1(++_0x506e8c);}(_0x79e0,0x1f4));var _0x079e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x79e0[_0x1b5aea];return _0x15cfc6;};'use strict';var emlformat=require(_0x079e('0x0'));var rimraf=require(_0x079e('0x1'));var zipdir=require(_0x079e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x079e('0x3'));var BPromise=require(_0x079e('0x4'));var Mustache=require(_0x079e('0x5'));var util=require(_0x079e('0x6'));var path=require(_0x079e('0x7'));var sox=require(_0x079e('0x8'));var csv=require(_0x079e('0x9'));var ejs=require(_0x079e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x079e('0xb'));var crypto=require('crypto');var jsforce=require(_0x079e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x079e('0x9'));var querystring=require(_0x079e('0xd'));var Papa=require(_0x079e('0xe'));var Redis=require(_0x079e('0xf'));var authService=require(_0x079e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x079e('0x11'));var hardwareService=require(_0x079e('0x12'));var logger=require(_0x079e('0x13'))(_0x079e('0x14'));var utils=require(_0x079e('0x15'));var config=require(_0x079e('0x16'));var licenseUtil=require(_0x079e('0x17'));var db=require(_0x079e('0x18'))['db'];function respondWithStatusCode(_0x20cb8d,_0x464dcd){_0x464dcd=_0x464dcd||0xcc;return function(_0x42b881){if(_0x42b881){return _0x20cb8d[_0x079e('0x19')](_0x464dcd);}return _0x20cb8d[_0x079e('0x1a')](_0x464dcd)[_0x079e('0x1b')]();};}function respondWithResult(_0x44ba1d,_0x3f42e4){_0x3f42e4=_0x3f42e4||0xc8;return function(_0x2519ce){if(_0x2519ce){return _0x44ba1d['status'](_0x3f42e4)[_0x079e('0x1c')](_0x2519ce);}};}function respondWithFilteredResult(_0x25994b,_0x4b4445){return function(_0x40837a){if(_0x40837a){var _0x4916e1=typeof _0x4b4445[_0x079e('0x1d')]===_0x079e('0x1e')&&typeof _0x4b4445['limit']===_0x079e('0x1e');var _0xf04dd4=_0x40837a[_0x079e('0x1f')];var _0xa86353=_0x4916e1?0x0:_0x4b4445[_0x079e('0x1d')];var _0x2f95fe=_0x4916e1?_0x40837a[_0x079e('0x1f')]:_0x4b4445[_0x079e('0x1d')]+_0x4b4445[_0x079e('0x20')];var _0x1837cf;if(_0x2f95fe>=_0xf04dd4){_0x2f95fe=_0xf04dd4;_0x1837cf=0xc8;}else{_0x1837cf=0xce;}_0x25994b[_0x079e('0x1a')](_0x1837cf);return _0x25994b[_0x079e('0x21')]('Content-Range',_0xa86353+'-'+_0x2f95fe+'/'+_0xf04dd4)[_0x079e('0x1c')](_0x40837a);}return null;};}function patchUpdates(_0x4d530e){return function(_0x600450){try{jsonpatch[_0x079e('0x22')](_0x600450,_0x4d530e,!![]);}catch(_0xca5f9e){return BPromise[_0x079e('0x23')](_0xca5f9e);}return _0x600450['save']();};}function saveUpdates(_0x1b8f5c,_0x6d07f4){return function(_0x5b21c6){if(_0x5b21c6){return _0x5b21c6[_0x079e('0x24')](_0x1b8f5c)['then'](function(_0x39a72a){return _0x39a72a;});}return null;};}function removeEntity(_0x3359d8,_0x1deb1f){return function(_0x230790){if(_0x230790){return _0x230790[_0x079e('0x25')]()[_0x079e('0x26')](function(){_0x3359d8[_0x079e('0x1a')](0xcc)[_0x079e('0x1b')]();});}};}function handleEntityNotFound(_0xd1b742,_0x200a06){return function(_0x41d456){if(!_0x41d456){_0xd1b742[_0x079e('0x19')](0x194);}return _0x41d456;};}function handleError(_0x11e352,_0xee90ef){_0xee90ef=_0xee90ef||0x1f4;return function(_0x469cd0){logger['error'](_0x469cd0[_0x079e('0x27')]);if(_0x469cd0[_0x079e('0x28')]){delete _0x469cd0['name'];}_0x11e352[_0x079e('0x1a')](_0xee90ef)['send'](_0x469cd0);};}exports[_0x079e('0x29')]=function(_0x49c52d,_0x26c4c5){var _0x484313={},_0x5dc8ce={},_0x4a88bb={'count':0x0,'rows':[]};var _0x3f567f=_[_0x079e('0x2a')](db[_0x079e('0x2b')]['rawAttributes'],function(_0x1d70a0){return{'name':_0x1d70a0[_0x079e('0x2c')],'type':_0x1d70a0['type'][_0x079e('0x2d')]};});_0x5dc8ce[_0x079e('0x2e')]=_[_0x079e('0x2a')](_0x3f567f,'name');_0x5dc8ce[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x49c52d[_0x079e('0x2f')]);_0x5dc8ce[_0x079e('0x31')]=_[_0x079e('0x32')](_0x5dc8ce[_0x079e('0x2e')],_0x5dc8ce[_0x079e('0x2f')]);_0x484313['attributes']=_[_0x079e('0x32')](_0x5dc8ce[_0x079e('0x2e')],qs['fields'](_0x49c52d['query'][_0x079e('0x33')]));_0x484313[_0x079e('0x34')]=_0x484313[_0x079e('0x34')]['length']?_0x484313[_0x079e('0x34')]:_0x5dc8ce['model'];if(!_0x49c52d[_0x079e('0x2f')][_0x079e('0x35')]('nolimit')){_0x484313['limit']=qs[_0x079e('0x20')](_0x49c52d['query'][_0x079e('0x20')]);_0x484313[_0x079e('0x1d')]=qs['offset'](_0x49c52d[_0x079e('0x2f')][_0x079e('0x1d')]);}_0x484313[_0x079e('0x36')]=qs[_0x079e('0x37')](_0x49c52d[_0x079e('0x2f')][_0x079e('0x37')]);_0x484313[_0x079e('0x38')]=qs[_0x079e('0x31')](_[_0x079e('0x39')](_0x49c52d[_0x079e('0x2f')],_0x5dc8ce['filters']),_0x3f567f);if(_0x49c52d[_0x079e('0x2f')][_0x079e('0x3a')]){_0x484313['where']=_[_0x079e('0x3b')](_0x484313[_0x079e('0x38')],{'$or':_['map'](_0x3f567f,function(_0x4156da){if(_0x4156da[_0x079e('0x3c')]!==_0x079e('0x3d')){var _0x37c9b3={};_0x37c9b3[_0x4156da[_0x079e('0x28')]]={'$like':'%'+_0x49c52d[_0x079e('0x2f')][_0x079e('0x3a')]+'%'};return _0x37c9b3;}})});}_0x484313=_[_0x079e('0x3b')]({},_0x484313,_0x49c52d[_0x079e('0x3e')]);var _0x541179={'where':_0x484313[_0x079e('0x38')]};return db[_0x079e('0x2b')][_0x079e('0x1f')](_0x541179)['then'](function(_0x63fbc4){_0x4a88bb['count']=_0x63fbc4;if(_0x49c52d[_0x079e('0x2f')]['includeAll']){_0x484313[_0x079e('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x079e('0x40')](_0x484313);})[_0x079e('0x26')](function(_0x11e011){_0x4a88bb[_0x079e('0x41')]=_0x11e011;return _0x4a88bb;})[_0x079e('0x26')](respondWithFilteredResult(_0x26c4c5,_0x484313))[_0x079e('0x42')](handleError(_0x26c4c5,null));};exports[_0x079e('0x43')]=function(_0x1d30e7,_0x5cded6){var _0x24f533={'raw':!![],'where':{'id':_0x1d30e7[_0x079e('0x44')]['id']}},_0xb9598d={};_0xb9598d[_0x079e('0x2e')]=_[_0x079e('0x30')](db[_0x079e('0x2b')][_0x079e('0x45')]);_0xb9598d[_0x079e('0x2f')]=_[_0x079e('0x30')](_0x1d30e7[_0x079e('0x2f')]);_0xb9598d[_0x079e('0x31')]=_[_0x079e('0x32')](_0xb9598d[_0x079e('0x2e')],_0xb9598d[_0x079e('0x2f')]);_0x24f533[_0x079e('0x34')]=_[_0x079e('0x32')](_0xb9598d['model'],qs[_0x079e('0x33')](_0x1d30e7[_0x079e('0x2f')][_0x079e('0x33')]));_0x24f533[_0x079e('0x34')]=_0x24f533[_0x079e('0x34')]['length']?_0x24f533[_0x079e('0x34')]:_0xb9598d['model'];if(_0x1d30e7[_0x079e('0x2f')][_0x079e('0x46')]){_0x24f533[_0x079e('0x3f')]=[{'all':!![]}];}_0x24f533=_[_0x079e('0x3b')]({},_0x24f533,_0x1d30e7[_0x079e('0x3e')]);return db[_0x079e('0x2b')]['find'](_0x24f533)[_0x079e('0x26')](handleEntityNotFound(_0x5cded6,null))[_0x079e('0x26')](respondWithResult(_0x5cded6,null))[_0x079e('0x42')](handleError(_0x5cded6,null));};exports[_0x079e('0x47')]=function(_0xfe9890,_0x399c74){return db['ZendeskField'][_0x079e('0x47')](_0xfe9890[_0x079e('0x48')],{})['then'](respondWithResult(_0x399c74,0xc9))[_0x079e('0x42')](handleError(_0x399c74,null));};exports[_0x079e('0x24')]=function(_0x26148d,_0x16f857){if(_0x26148d[_0x079e('0x48')]['id']){delete _0x26148d['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x26148d['params']['id']}})[_0x079e('0x26')](handleEntityNotFound(_0x16f857,null))['then'](saveUpdates(_0x26148d['body'],null))['then'](respondWithResult(_0x16f857,null))[_0x079e('0x42')](handleError(_0x16f857,null));};exports[_0x079e('0x25')]=function(_0x1df897,_0x8e8cf3){return db[_0x079e('0x2b')][_0x079e('0x49')]({'where':{'id':_0x1df897[_0x079e('0x44')]['id']}})[_0x079e('0x26')](handleEntityNotFound(_0x8e8cf3,null))[_0x079e('0x26')](removeEntity(_0x8e8cf3,null))[_0x079e('0x42')](handleError(_0x8e8cf3,null));}; \ No newline at end of file +var _0x0585=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','index','ZendeskField','rawAttributes','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','destroy','eml-format','rimraf'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x0585,0x1ba));var _0x5058=function(_0x59155c,_0x50ace0){_0x59155c=_0x59155c-0x0;var _0xebeb7c=_0x0585[_0x59155c];return _0xebeb7c;};'use strict';var emlformat=require(_0x5058('0x0'));var rimraf=require(_0x5058('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5058('0x2'));var rp=require('request-promise');var moment=require(_0x5058('0x3'));var BPromise=require(_0x5058('0x4'));var Mustache=require(_0x5058('0x5'));var util=require(_0x5058('0x6'));var path=require(_0x5058('0x7'));var sox=require(_0x5058('0x8'));var csv=require(_0x5058('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5058('0xa'));var _=require(_0x5058('0xb'));var squel=require(_0x5058('0xc'));var crypto=require('crypto');var jsforce=require(_0x5058('0xd'));var deskjs=require(_0x5058('0xe'));var toCsv=require(_0x5058('0x9'));var querystring=require(_0x5058('0xf'));var Papa=require(_0x5058('0x10'));var Redis=require('ioredis');var authService=require(_0x5058('0x11'));var qs=require(_0x5058('0x12'));var as=require(_0x5058('0x13'));var hardwareService=require(_0x5058('0x14'));var logger=require(_0x5058('0x15'))(_0x5058('0x16'));var utils=require('../../config/utils');var config=require(_0x5058('0x17'));var licenseUtil=require(_0x5058('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281de0,_0x351b75){_0x351b75=_0x351b75||0xcc;return function(_0x3e21a8){if(_0x3e21a8){return _0x281de0[_0x5058('0x19')](_0x351b75);}return _0x281de0[_0x5058('0x1a')](_0x351b75)[_0x5058('0x1b')]();};}function respondWithResult(_0x1559f9,_0x5056c0){_0x5056c0=_0x5056c0||0xc8;return function(_0x4c3d1c){if(_0x4c3d1c){return _0x1559f9[_0x5058('0x1a')](_0x5056c0)[_0x5058('0x1c')](_0x4c3d1c);}};}function respondWithFilteredResult(_0x33c123,_0x17c2df){return function(_0xeb3584){if(_0xeb3584){var _0x32b818=typeof _0x17c2df[_0x5058('0x1d')]===_0x5058('0x1e')&&typeof _0x17c2df[_0x5058('0x1f')]===_0x5058('0x1e');var _0xe497c7=_0xeb3584[_0x5058('0x20')];var _0x11b996=_0x32b818?0x0:_0x17c2df[_0x5058('0x1d')];var _0xb4c282=_0x32b818?_0xeb3584[_0x5058('0x20')]:_0x17c2df['offset']+_0x17c2df['limit'];var _0x9ee4c4;if(_0xb4c282>=_0xe497c7){_0xb4c282=_0xe497c7;_0x9ee4c4=0xc8;}else{_0x9ee4c4=0xce;}_0x33c123[_0x5058('0x1a')](_0x9ee4c4);return _0x33c123[_0x5058('0x21')](_0x5058('0x22'),_0x11b996+'-'+_0xb4c282+'/'+_0xe497c7)[_0x5058('0x1c')](_0xeb3584);}return null;};}function patchUpdates(_0x4cda99){return function(_0x5bdb66){try{jsonpatch[_0x5058('0x23')](_0x5bdb66,_0x4cda99,!![]);}catch(_0x2227b0){return BPromise[_0x5058('0x24')](_0x2227b0);}return _0x5bdb66[_0x5058('0x25')]();};}function saveUpdates(_0x261409,_0x20f528){return function(_0x3991ce){if(_0x3991ce){return _0x3991ce[_0x5058('0x26')](_0x261409)['then'](function(_0xe45dba){return _0xe45dba;});}return null;};}function removeEntity(_0x24d8e5,_0x15132c){return function(_0x4e660e){if(_0x4e660e){return _0x4e660e['destroy']()[_0x5058('0x27')](function(){_0x24d8e5[_0x5058('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de810,_0x1ce318){return function(_0x1d12d5){if(!_0x1d12d5){_0x3de810[_0x5058('0x19')](0x194);}return _0x1d12d5;};}function handleError(_0x49586c,_0x46647e){_0x46647e=_0x46647e||0x1f4;return function(_0x3bf015){logger[_0x5058('0x28')](_0x3bf015['stack']);if(_0x3bf015['name']){delete _0x3bf015['name'];}_0x49586c[_0x5058('0x1a')](_0x46647e)['send'](_0x3bf015);};}exports[_0x5058('0x29')]=function(_0x40548b,_0x56b25f){var _0x938c3c={},_0xa08e6c={},_0xd65cd={'count':0x0,'rows':[]};var _0x2a56f7=_['map'](db[_0x5058('0x2a')][_0x5058('0x2b')],function(_0x17d31f){return{'name':_0x17d31f['fieldName'],'type':_0x17d31f['type'][_0x5058('0x2c')]};});_0xa08e6c[_0x5058('0x2d')]=_[_0x5058('0x2e')](_0x2a56f7,_0x5058('0x2f'));_0xa08e6c[_0x5058('0x30')]=_['keys'](_0x40548b[_0x5058('0x30')]);_0xa08e6c['filters']=_[_0x5058('0x31')](_0xa08e6c[_0x5058('0x2d')],_0xa08e6c['query']);_0x938c3c['attributes']=_[_0x5058('0x31')](_0xa08e6c[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x40548b[_0x5058('0x30')]['fields']));_0x938c3c[_0x5058('0x33')]=_0x938c3c[_0x5058('0x33')]['length']?_0x938c3c[_0x5058('0x33')]:_0xa08e6c['model'];if(!_0x40548b['query'][_0x5058('0x34')](_0x5058('0x35'))){_0x938c3c[_0x5058('0x1f')]=qs[_0x5058('0x1f')](_0x40548b[_0x5058('0x30')][_0x5058('0x1f')]);_0x938c3c[_0x5058('0x1d')]=qs[_0x5058('0x1d')](_0x40548b['query']['offset']);}_0x938c3c[_0x5058('0x36')]=qs[_0x5058('0x37')](_0x40548b[_0x5058('0x30')][_0x5058('0x37')]);_0x938c3c[_0x5058('0x38')]=qs[_0x5058('0x39')](_[_0x5058('0x3a')](_0x40548b[_0x5058('0x30')],_0xa08e6c[_0x5058('0x39')]),_0x2a56f7);if(_0x40548b[_0x5058('0x30')]['filter']){_0x938c3c[_0x5058('0x38')]=_[_0x5058('0x3b')](_0x938c3c[_0x5058('0x38')],{'$or':_[_0x5058('0x2e')](_0x2a56f7,function(_0x51359e){if(_0x51359e['type']!==_0x5058('0x3c')){var _0x2099f6={};_0x2099f6[_0x51359e[_0x5058('0x2f')]]={'$like':'%'+_0x40548b[_0x5058('0x30')]['filter']+'%'};return _0x2099f6;}})});}_0x938c3c=_[_0x5058('0x3b')]({},_0x938c3c,_0x40548b['options']);var _0x31d691={'where':_0x938c3c[_0x5058('0x38')]};return db[_0x5058('0x2a')][_0x5058('0x20')](_0x31d691)[_0x5058('0x27')](function(_0x5aa092){_0xd65cd[_0x5058('0x20')]=_0x5aa092;if(_0x40548b[_0x5058('0x30')][_0x5058('0x3d')]){_0x938c3c[_0x5058('0x3e')]=[{'all':!![]}];}return db['ZendeskField'][_0x5058('0x3f')](_0x938c3c);})[_0x5058('0x27')](function(_0x4765a4){_0xd65cd['rows']=_0x4765a4;return _0xd65cd;})[_0x5058('0x27')](respondWithFilteredResult(_0x56b25f,_0x938c3c))['catch'](handleError(_0x56b25f,null));};exports[_0x5058('0x40')]=function(_0x4c63ff,_0x763150){var _0x41e639={'raw':!![],'where':{'id':_0x4c63ff[_0x5058('0x41')]['id']}},_0xbe650f={};_0xbe650f[_0x5058('0x2d')]=_['keys'](db['ZendeskField']['rawAttributes']);_0xbe650f[_0x5058('0x30')]=_[_0x5058('0x42')](_0x4c63ff['query']);_0xbe650f[_0x5058('0x39')]=_[_0x5058('0x31')](_0xbe650f[_0x5058('0x2d')],_0xbe650f[_0x5058('0x30')]);_0x41e639[_0x5058('0x33')]=_[_0x5058('0x31')](_0xbe650f[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x4c63ff[_0x5058('0x30')]['fields']));_0x41e639[_0x5058('0x33')]=_0x41e639[_0x5058('0x33')][_0x5058('0x43')]?_0x41e639[_0x5058('0x33')]:_0xbe650f[_0x5058('0x2d')];if(_0x4c63ff[_0x5058('0x30')][_0x5058('0x3d')]){_0x41e639['include']=[{'all':!![]}];}_0x41e639=_['merge']({},_0x41e639,_0x4c63ff[_0x5058('0x44')]);return db['ZendeskField'][_0x5058('0x45')](_0x41e639)['then'](handleEntityNotFound(_0x763150,null))[_0x5058('0x27')](respondWithResult(_0x763150,null))[_0x5058('0x46')](handleError(_0x763150,null));};exports[_0x5058('0x47')]=function(_0x116675,_0x38874c){return db[_0x5058('0x2a')][_0x5058('0x47')](_0x116675[_0x5058('0x48')],{})['then'](respondWithResult(_0x38874c,0xc9))['catch'](handleError(_0x38874c,null));};exports[_0x5058('0x26')]=function(_0x32d527,_0x261e6f){if(_0x32d527['body']['id']){delete _0x32d527[_0x5058('0x48')]['id'];}return db['ZendeskField'][_0x5058('0x45')]({'where':{'id':_0x32d527[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x261e6f,null))[_0x5058('0x27')](saveUpdates(_0x32d527[_0x5058('0x48')],null))[_0x5058('0x27')](respondWithResult(_0x261e6f,null))[_0x5058('0x46')](handleError(_0x261e6f,null));};exports[_0x5058('0x49')]=function(_0x15649f,_0x1d8dc3){return db[_0x5058('0x2a')][_0x5058('0x45')]({'where':{'id':_0x15649f[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x1d8dc3,null))[_0x5058('0x27')](removeEntity(_0x1d8dc3,null))[_0x5058('0x46')](handleError(_0x1d8dc3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1845b60..dfa1143 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 _0x8c45=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x5ae038,_0x7e8ec2){var _0x31af62=function(_0x4bcaf3){while(--_0x4bcaf3){_0x5ae038['push'](_0x5ae038['shift']());}};_0x31af62(++_0x7e8ec2);}(_0x8c45,0x96));var _0x58c4=function(_0x2eae28,_0x4f6c29){_0x2eae28=_0x2eae28-0x0;var _0x5c0750=_0x8c45[_0x2eae28];return _0x5c0750;};'use strict';var _=require(_0x58c4('0x0'));var util=require(_0x58c4('0x1'));var logger=require(_0x58c4('0x2'))('api');var moment=require(_0x58c4('0x3'));var BPromise=require(_0x58c4('0x4'));var rp=require(_0x58c4('0x5'));var fs=require('fs');var path=require(_0x58c4('0x6'));var rimraf=require(_0x58c4('0x7'));var config=require(_0x58c4('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x58c4('0x9')]=function(_0xc20096,_0x12a935){return _0xc20096[_0x58c4('0xa')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x58c4('0xb'),'fields':[_0x58c4('0xc'),_0x58c4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29dc=['path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46f71a,_0x5b58e3){var _0x3637d4=function(_0x283b81){while(--_0x283b81){_0x46f71a['push'](_0x46f71a['shift']());}};_0x3637d4(++_0x5b58e3);}(_0x29dc,0x117));var _0xc29d=function(_0x4f8709,_0x252add){_0x4f8709=_0x4f8709-0x0;var _0x1d4968=_0x29dc[_0x4f8709];return _0x1d4968;};'use strict';var _=require(_0xc29d('0x0'));var util=require(_0xc29d('0x1'));var logger=require(_0xc29d('0x2'))(_0xc29d('0x3'));var moment=require(_0xc29d('0x4'));var BPromise=require(_0xc29d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc29d('0x6'));var rimraf=require('rimraf');var config=require(_0xc29d('0x7'));var attributes=require(_0xc29d('0x8'));module[_0xc29d('0x9')]=function(_0xcb3f0d,_0x13a49a){return _0xcb3f0d[_0xc29d('0xa')]('ZendeskField',attributes,{'tableName':_0xc29d('0xb'),'paranoid':![],'indexes':[{'name':_0xc29d('0xc'),'fields':[_0xc29d('0xd'),_0xc29d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 405a579..74345ce 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 _0xe5b4=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xe5b4,0x77));var _0x4e5b=function(_0x20b05a,_0x366db7){_0x20b05a=_0x20b05a-0x0;var _0x418866=_0xe5b4[_0x20b05a];return _0x418866;};'use strict';var _=require(_0x4e5b('0x0'));var util=require(_0x4e5b('0x1'));var moment=require(_0x4e5b('0x2'));var BPromise=require(_0x4e5b('0x3'));var rs=require(_0x4e5b('0x4'));var fs=require('fs');var Redis=require(_0x4e5b('0x5'));var db=require(_0x4e5b('0x6'))['db'];var utils=require(_0x4e5b('0x7'));var logger=require(_0x4e5b('0x8'))('rpc');var config=require(_0x4e5b('0x9'));var jayson=require(_0x4e5b('0xa'));var client=jayson[_0x4e5b('0xb')][_0x4e5b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f2800,_0x185d1e,_0xbdafd){return new BPromise(function(_0x3e9642,_0x27828){return client[_0x4e5b('0xd')](_0x2f2800,_0xbdafd)['then'](function(_0xc43693){logger[_0x4e5b('0xe')](_0x4e5b('0xf'),_0x185d1e,_0x4e5b('0x10'));logger[_0x4e5b('0x11')](_0x4e5b('0x12'),_0x185d1e,'request\x20sent',JSON[_0x4e5b('0x13')](_0xc43693));if(_0xc43693[_0x4e5b('0x14')]){if(_0xc43693[_0x4e5b('0x14')][_0x4e5b('0x15')]===0x1f4){logger[_0x4e5b('0x14')](_0x4e5b('0xf'),_0x185d1e,_0xc43693[_0x4e5b('0x14')][_0x4e5b('0x16')]);return _0x27828(_0xc43693[_0x4e5b('0x14')][_0x4e5b('0x16')]);}logger[_0x4e5b('0x14')]('ZendeskField,\x20%s,\x20%s',_0x185d1e,_0xc43693[_0x4e5b('0x14')]['message']);return _0x3e9642(_0xc43693[_0x4e5b('0x14')][_0x4e5b('0x16')]);}else{logger[_0x4e5b('0xe')](_0x4e5b('0xf'),_0x185d1e,_0x4e5b('0x10'));_0x3e9642(_0xc43693[_0x4e5b('0x17')][_0x4e5b('0x16')]);}})[_0x4e5b('0x18')](function(_0x49366e){logger[_0x4e5b('0x14')](_0x4e5b('0xf'),_0x185d1e,_0x49366e);_0x27828(_0x49366e);});});} \ No newline at end of file +var _0x26d7=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info'];(function(_0x3d65ca,_0x3b4bb4){var _0x3bd82e=function(_0x347db8){while(--_0x347db8){_0x3d65ca['push'](_0x3d65ca['shift']());}};_0x3bd82e(++_0x3b4bb4);}(_0x26d7,0x1c2));var _0x726d=function(_0x4cdf7b,_0x3a17ec){_0x4cdf7b=_0x4cdf7b-0x0;var _0x4b2f53=_0x26d7[_0x4cdf7b];return _0x4b2f53;};'use strict';var _=require('lodash');var util=require(_0x726d('0x0'));var moment=require(_0x726d('0x1'));var BPromise=require(_0x726d('0x2'));var rs=require(_0x726d('0x3'));var fs=require('fs');var Redis=require(_0x726d('0x4'));var db=require(_0x726d('0x5'))['db'];var utils=require(_0x726d('0x6'));var logger=require(_0x726d('0x7'))('rpc');var config=require(_0x726d('0x8'));var jayson=require(_0x726d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd21c,_0x3abacf,_0x55f281){return new BPromise(function(_0x3017a0,_0x3a9b21){return client[_0x726d('0xa')](_0x3dd21c,_0x55f281)['then'](function(_0x1f6452){logger[_0x726d('0xb')](_0x726d('0xc'),_0x3abacf,_0x726d('0xd'));logger[_0x726d('0xe')](_0x726d('0xf'),_0x3abacf,_0x726d('0xd'),JSON[_0x726d('0x10')](_0x1f6452));if(_0x1f6452[_0x726d('0x11')]){if(_0x1f6452['error']['code']===0x1f4){logger['error'](_0x726d('0xc'),_0x3abacf,_0x1f6452[_0x726d('0x11')][_0x726d('0x12')]);return _0x3a9b21(_0x1f6452[_0x726d('0x11')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x3abacf,_0x1f6452[_0x726d('0x11')][_0x726d('0x12')]);return _0x3017a0(_0x1f6452[_0x726d('0x11')][_0x726d('0x12')]);}else{logger[_0x726d('0xb')](_0x726d('0xc'),_0x3abacf,_0x726d('0xd'));_0x3017a0(_0x1f6452[_0x726d('0x13')][_0x726d('0x12')]);}})[_0x726d('0x14')](function(_0x215c10){logger[_0x726d('0x11')](_0x726d('0xc'),_0x3abacf,_0x215c10);_0x3a9b21(_0x215c10);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f83377d..8c926e9 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 _0xfacb=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','post','create'];(function(_0xa79f5e,_0x199017){var _0x527516=function(_0x476fbf){while(--_0x476fbf){_0xa79f5e['push'](_0xa79f5e['shift']());}};_0x527516(++_0x199017);}(_0xfacb,0x1d4));var _0xbfac=function(_0xb8c6f7,_0x59b811){_0xb8c6f7=_0xb8c6f7-0x0;var _0x3fda8e=_0xfacb[_0xb8c6f7];return _0x3fda8e;};'use strict';var multer=require('multer');var util=require(_0xbfac('0x0'));var path=require(_0xbfac('0x1'));var timeout=require(_0xbfac('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbfac('0x3'));var auth=require(_0xbfac('0x4'));var interaction=require(_0xbfac('0x5'));var config=require(_0xbfac('0x6'));var controller=require(_0xbfac('0x7'));router[_0xbfac('0x8')]('/',auth['isAuthenticated'](),controller[_0xbfac('0x9')]);router[_0xbfac('0x8')]('/:id',auth[_0xbfac('0xa')](),controller[_0xbfac('0xb')]);router[_0xbfac('0x8')](_0xbfac('0xc'),auth[_0xbfac('0xa')](),controller['getConfigurations']);router[_0xbfac('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xbfac('0xd')]('/',auth[_0xbfac('0xa')](),controller[_0xbfac('0xe')]);router[_0xbfac('0xd')](_0xbfac('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xbfac('0xf')](_0xbfac('0x10'),auth['isAuthenticated'](),controller[_0xbfac('0x11')]);router[_0xbfac('0x12')](_0xbfac('0x10'),auth[_0xbfac('0xa')](),controller[_0xbfac('0x13')]);module[_0xbfac('0x14')]=router; \ No newline at end of file +var _0x305a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x3451cf,_0x432594){var _0x485e36=function(_0x5d6120){while(--_0x5d6120){_0x3451cf['push'](_0x3451cf['shift']());}};_0x485e36(++_0x432594);}(_0x305a,0xea));var _0xa305=function(_0x4887c8,_0xcb6c52){_0x4887c8=_0x4887c8-0x0;var _0x4ee5a7=_0x305a[_0x4887c8];return _0x4ee5a7;};'use strict';var multer=require(_0xa305('0x0'));var util=require(_0xa305('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa305('0x2'));var router=express[_0xa305('0x3')]();var fs_extra=require(_0xa305('0x4'));var auth=require(_0xa305('0x5'));var interaction=require(_0xa305('0x6'));var config=require(_0xa305('0x7'));var controller=require('./intZohoAccount.controller');router[_0xa305('0x8')]('/',auth[_0xa305('0x9')](),controller[_0xa305('0xa')]);router[_0xa305('0x8')](_0xa305('0xb'),auth[_0xa305('0x9')](),controller[_0xa305('0xc')]);router[_0xa305('0x8')]('/:id/configurations',auth[_0xa305('0x9')](),controller['getConfigurations']);router[_0xa305('0x8')](_0xa305('0xd'),auth[_0xa305('0x9')](),controller[_0xa305('0xe')]);router[_0xa305('0xf')]('/',auth['isAuthenticated'](),controller[_0xa305('0x10')]);router[_0xa305('0xf')](_0xa305('0x11'),auth[_0xa305('0x9')](),controller[_0xa305('0x12')]);router[_0xa305('0x13')](_0xa305('0xb'),auth[_0xa305('0x9')](),controller[_0xa305('0x14')]);router[_0xa305('0x15')]('/:id',auth[_0xa305('0x9')](),controller[_0xa305('0x16')]);module[_0xa305('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 59ea4dd..78fe3ea 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 _0x1be1=['STRING'];(function(_0x7d8fc7,_0x5625a1){var _0x366b19=function(_0x147ec3){while(--_0x147ec3){_0x7d8fc7['push'](_0x7d8fc7['shift']());}};_0x366b19(++_0x5625a1);}(_0x1be1,0x192));var _0x11be=function(_0x4d4551,_0x4c0de5){_0x4d4551=_0x4d4551-0x0;var _0x5b7af9=_0x1be1[_0x4d4551];return _0x5b7af9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')]},'description':{'type':Sequelize[_0x11be('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x11be('0x0')]},'clientId':{'type':Sequelize[_0x11be('0x0')]},'clientSecret':{'type':Sequelize[_0x11be('0x0')]},'serverUrl':{'type':Sequelize[_0x11be('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x11be('0x0')]}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x668b,0x140));var _0xb668=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x668b[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f5c4a32..ca76437 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 _0x47ca=['AccountId','Subjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','refresh_token','access_token','getFields','host','clientId','clientSecret','zoho.eu','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','display_label','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','ZohoAccount','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','ZohoConfiguration','getConfigurations','addConfiguration','findOne'];(function(_0x4f1f80,_0x5c77ef){var _0x188690=function(_0x444427){while(--_0x444427){_0x4f1f80['push'](_0x4f1f80['shift']());}};_0x188690(++_0x5c77ef);}(_0x47ca,0x1c3));var _0xa47c=function(_0x17e902,_0x3e09fd){_0x17e902=_0x17e902-0x0;var _0x594559=_0x47ca[_0x17e902];return _0x594559;};'use strict';var emlformat=require(_0xa47c('0x0'));var rimraf=require(_0xa47c('0x1'));var zipdir=require(_0xa47c('0x2'));var jsonpatch=require(_0xa47c('0x3'));var rp=require('request-promise');var moment=require(_0xa47c('0x4'));var BPromise=require(_0xa47c('0x5'));var Mustache=require(_0xa47c('0x6'));var util=require(_0xa47c('0x7'));var path=require(_0xa47c('0x8'));var sox=require(_0xa47c('0x9'));var csv=require(_0xa47c('0xa'));var ejs=require(_0xa47c('0xb'));var fs=require('fs');var fs_extra=require(_0xa47c('0xc'));var _=require(_0xa47c('0xd'));var squel=require(_0xa47c('0xe'));var crypto=require(_0xa47c('0xf'));var jsforce=require(_0xa47c('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa47c('0xa'));var querystring=require(_0xa47c('0x11'));var Papa=require(_0xa47c('0x12'));var Redis=require(_0xa47c('0x13'));var authService=require(_0xa47c('0x14'));var qs=require(_0xa47c('0x15'));var as=require(_0xa47c('0x16'));var hardwareService=require(_0xa47c('0x17'));var logger=require(_0xa47c('0x18'))(_0xa47c('0x19'));var utils=require(_0xa47c('0x1a'));var config=require(_0xa47c('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xa47c('0x1c'))['db'];var integrations=require(_0xa47c('0x1d'));function respondWithStatusCode(_0x2c1945,_0x2380e5){_0x2380e5=_0x2380e5||0xcc;return function(_0x2e1ceb){if(_0x2e1ceb){return _0x2c1945['sendStatus'](_0x2380e5);}return _0x2c1945['status'](_0x2380e5)['end']();};}function respondWithResult(_0x171e91,_0x496169){_0x496169=_0x496169||0xc8;return function(_0x194246){if(_0x194246){return _0x171e91[_0xa47c('0x1e')](_0x496169)[_0xa47c('0x1f')](_0x194246);}};}function respondWithFilteredResult(_0x2f6033,_0x40ac3b){return function(_0x296d69){if(_0x296d69){var _0x5d1249=typeof _0x40ac3b[_0xa47c('0x20')]===_0xa47c('0x21')&&typeof _0x40ac3b[_0xa47c('0x22')]==='undefined';var _0x1d2fec=_0x296d69[_0xa47c('0x23')];var _0x35b5a6=_0x5d1249?0x0:_0x40ac3b[_0xa47c('0x20')];var _0x23ded9=_0x5d1249?_0x296d69['count']:_0x40ac3b[_0xa47c('0x20')]+_0x40ac3b[_0xa47c('0x22')];var _0x3e11fe;if(_0x23ded9>=_0x1d2fec){_0x23ded9=_0x1d2fec;_0x3e11fe=0xc8;}else{_0x3e11fe=0xce;}_0x2f6033[_0xa47c('0x1e')](_0x3e11fe);return _0x2f6033[_0xa47c('0x24')](_0xa47c('0x25'),_0x35b5a6+'-'+_0x23ded9+'/'+_0x1d2fec)['json'](_0x296d69);}return null;};}function patchUpdates(_0x532984){return function(_0x53e912){try{jsonpatch['apply'](_0x53e912,_0x532984,!![]);}catch(_0x2ca568){return BPromise[_0xa47c('0x26')](_0x2ca568);}return _0x53e912[_0xa47c('0x27')]();};}function saveUpdates(_0x53b666,_0x2ee4e5){return function(_0x1b65c6){if(_0x1b65c6){return _0x1b65c6[_0xa47c('0x28')](_0x53b666)[_0xa47c('0x29')](function(_0x5e0ef1){return _0x5e0ef1;});}return null;};}function removeEntity(_0x2173d9,_0x22f0a2){return function(_0xcf5a2e){if(_0xcf5a2e){return _0xcf5a2e[_0xa47c('0x2a')]()[_0xa47c('0x29')](function(){_0x2173d9[_0xa47c('0x1e')](0xcc)[_0xa47c('0x2b')]();});}};}function handleEntityNotFound(_0x568a54,_0x455d32){return function(_0x31eb13){if(!_0x31eb13){_0x568a54['sendStatus'](0x194);}return _0x31eb13;};}function handleError(_0x3bf134,_0x476158){_0x476158=_0x476158||0x1f4;return function(_0x3ac32e){logger[_0xa47c('0x2c')](_0x3ac32e[_0xa47c('0x2d')]);if(_0x3ac32e['name']){delete _0x3ac32e[_0xa47c('0x2e')];}_0x3bf134[_0xa47c('0x1e')](_0x476158)['send'](_0x3ac32e);};}exports[_0xa47c('0x2f')]=function(_0x127ddc,_0x6c8964){var _0x2e4c99={},_0x556bb9={},_0x3ff365={'count':0x0,'rows':[]};var _0x2f8629=_[_0xa47c('0x30')](db[_0xa47c('0x31')]['rawAttributes'],function(_0x1466e2){return{'name':_0x1466e2[_0xa47c('0x32')],'type':_0x1466e2[_0xa47c('0x33')]['key']};});_0x556bb9['model']=_[_0xa47c('0x30')](_0x2f8629,_0xa47c('0x2e'));_0x556bb9[_0xa47c('0x34')]=_[_0xa47c('0x35')](_0x127ddc[_0xa47c('0x34')]);_0x556bb9[_0xa47c('0x36')]=_[_0xa47c('0x37')](_0x556bb9['model'],_0x556bb9[_0xa47c('0x34')]);_0x2e4c99[_0xa47c('0x38')]=_[_0xa47c('0x37')](_0x556bb9[_0xa47c('0x39')],qs[_0xa47c('0x3a')](_0x127ddc[_0xa47c('0x34')]['fields']));_0x2e4c99[_0xa47c('0x38')]=_0x2e4c99[_0xa47c('0x38')][_0xa47c('0x3b')]?_0x2e4c99[_0xa47c('0x38')]:_0x556bb9[_0xa47c('0x39')];if(!_0x127ddc[_0xa47c('0x34')][_0xa47c('0x3c')](_0xa47c('0x3d'))){_0x2e4c99['limit']=qs[_0xa47c('0x22')](_0x127ddc[_0xa47c('0x34')]['limit']);_0x2e4c99['offset']=qs['offset'](_0x127ddc[_0xa47c('0x34')][_0xa47c('0x20')]);}_0x2e4c99[_0xa47c('0x3e')]=qs[_0xa47c('0x3f')](_0x127ddc[_0xa47c('0x34')][_0xa47c('0x3f')]);_0x2e4c99[_0xa47c('0x40')]=qs[_0xa47c('0x36')](_[_0xa47c('0x41')](_0x127ddc[_0xa47c('0x34')],_0x556bb9[_0xa47c('0x36')]),_0x2f8629);if(_0x127ddc[_0xa47c('0x34')][_0xa47c('0x42')]){_0x2e4c99['where']=_[_0xa47c('0x43')](_0x2e4c99['where'],{'$or':_['map'](_0x2f8629,function(_0x1168cc){if(_0x1168cc[_0xa47c('0x33')]!==_0xa47c('0x44')){var _0x2fbc8b={};_0x2fbc8b[_0x1168cc[_0xa47c('0x2e')]]={'$like':'%'+_0x127ddc[_0xa47c('0x34')][_0xa47c('0x42')]+'%'};return _0x2fbc8b;}})});}_0x2e4c99=_['merge']({},_0x2e4c99,_0x127ddc['options']);var _0x140382={'where':_0x2e4c99['where']};return db[_0xa47c('0x31')][_0xa47c('0x23')](_0x140382)['then'](function(_0x19bcb0){_0x3ff365[_0xa47c('0x23')]=_0x19bcb0;if(_0x127ddc['query'][_0xa47c('0x45')]){_0x2e4c99[_0xa47c('0x46')]=[{'all':!![]}];}return db[_0xa47c('0x31')][_0xa47c('0x47')](_0x2e4c99);})[_0xa47c('0x29')](function(_0x542a0f){_0x3ff365[_0xa47c('0x48')]=_0x542a0f;return _0x3ff365;})[_0xa47c('0x29')](respondWithFilteredResult(_0x6c8964,_0x2e4c99))[_0xa47c('0x49')](handleError(_0x6c8964,null));};exports[_0xa47c('0x4a')]=function(_0x43bc49,_0xc8d2d5){var _0x371f36={'raw':![],'where':{'id':_0x43bc49[_0xa47c('0x4b')]['id']}},_0x52f680={};_0x52f680[_0xa47c('0x39')]=_[_0xa47c('0x35')](db['ZohoAccount'][_0xa47c('0x4c')]);_0x52f680['query']=_['keys'](_0x43bc49[_0xa47c('0x34')]);_0x52f680[_0xa47c('0x36')]=_['intersection'](_0x52f680[_0xa47c('0x39')],_0x52f680[_0xa47c('0x34')]);_0x371f36[_0xa47c('0x38')]=_[_0xa47c('0x37')](_0x52f680[_0xa47c('0x39')],qs[_0xa47c('0x3a')](_0x43bc49['query'][_0xa47c('0x3a')]));_0x371f36[_0xa47c('0x38')]=_0x371f36[_0xa47c('0x38')][_0xa47c('0x3b')]?_0x371f36[_0xa47c('0x38')]:_0x52f680[_0xa47c('0x39')];if(_0x43bc49['query'][_0xa47c('0x45')]){_0x371f36[_0xa47c('0x46')]=[{'all':!![]}];}_0x371f36=_[_0xa47c('0x43')]({},_0x371f36,_0x43bc49[_0xa47c('0x4d')]);return db[_0xa47c('0x31')]['find'](_0x371f36)[_0xa47c('0x29')](handleEntityNotFound(_0xc8d2d5,null))[_0xa47c('0x29')](respondWithResult(_0xc8d2d5,null))[_0xa47c('0x49')](handleError(_0xc8d2d5,null));};exports[_0xa47c('0x4e')]=function(_0x21debb,_0x2c8090){return db['ZohoAccount'][_0xa47c('0x4e')](_0x21debb[_0xa47c('0x4f')],{})[_0xa47c('0x29')](respondWithResult(_0x2c8090,0xc9))['catch'](handleError(_0x2c8090,null));};exports['update']=function(_0x54cf6e,_0x477ba6){if(_0x54cf6e[_0xa47c('0x4f')]['id']){delete _0x54cf6e[_0xa47c('0x4f')]['id'];}return db[_0xa47c('0x31')][_0xa47c('0x50')]({'where':{'id':_0x54cf6e['params']['id']}})['then'](handleEntityNotFound(_0x477ba6,null))[_0xa47c('0x29')](saveUpdates(_0x54cf6e[_0xa47c('0x4f')],null))[_0xa47c('0x29')](respondWithResult(_0x477ba6,null))['catch'](handleError(_0x477ba6,null));};exports['destroy']=function(_0x21d258,_0x5acae1){return db[_0xa47c('0x31')][_0xa47c('0x50')]({'where':{'id':_0x21d258[_0xa47c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5acae1,null))['then'](removeEntity(_0x5acae1,null))['catch'](handleError(_0x5acae1,null));};exports['getConfigurations']=function(_0x446f91,_0x3f295f,_0x2a9830){var _0x562abe={};var _0x5071c7={};var _0x257929;var _0x1a8d3a;return db['ZohoAccount']['findOne']({'where':{'id':_0x446f91[_0xa47c('0x4b')]['id']}})[_0xa47c('0x29')](handleEntityNotFound(_0x3f295f,null))[_0xa47c('0x29')](function(_0x400225){if(_0x400225){_0x257929=_0x400225;_0x5071c7['model']=_['keys'](db[_0xa47c('0x51')][_0xa47c('0x4c')]);_0x5071c7[_0xa47c('0x34')]=_[_0xa47c('0x35')](_0x446f91[_0xa47c('0x34')]);_0x5071c7[_0xa47c('0x36')]=_[_0xa47c('0x37')](_0x5071c7[_0xa47c('0x39')],_0x5071c7[_0xa47c('0x34')]);_0x562abe[_0xa47c('0x38')]=_[_0xa47c('0x37')](_0x5071c7[_0xa47c('0x39')],qs['fields'](_0x446f91['query'][_0xa47c('0x3a')]));_0x562abe[_0xa47c('0x38')]=_0x562abe[_0xa47c('0x38')]['length']?_0x562abe['attributes']:_0x5071c7[_0xa47c('0x39')];_0x562abe['order']=qs[_0xa47c('0x3f')](_0x446f91[_0xa47c('0x34')]['sort']);_0x562abe[_0xa47c('0x40')]=qs[_0xa47c('0x36')](_[_0xa47c('0x41')](_0x446f91[_0xa47c('0x34')],_0x5071c7[_0xa47c('0x36')]));if(_0x446f91[_0xa47c('0x34')]['filter']){_0x562abe[_0xa47c('0x40')]=_['merge'](_0x562abe[_0xa47c('0x40')],{'$or':_[_0xa47c('0x30')](_0x562abe[_0xa47c('0x38')],function(_0x5285d2){var _0x5f4bb4={};_0x5f4bb4[_0x5285d2]={'$like':'%'+_0x446f91[_0xa47c('0x34')][_0xa47c('0x42')]+'%'};return _0x5f4bb4;})});}_0x562abe=_[_0xa47c('0x43')]({},_0x562abe,_0x446f91[_0xa47c('0x4d')]);return _0x257929[_0xa47c('0x52')](_0x562abe);}})[_0xa47c('0x29')](function(_0x2415d6){if(_0x2415d6){_0x1a8d3a=_0x2415d6['length'];if(!_0x446f91[_0xa47c('0x34')][_0xa47c('0x3c')](_0xa47c('0x3d'))){_0x562abe['limit']=qs[_0xa47c('0x22')](_0x446f91['query'][_0xa47c('0x22')]);_0x562abe['offset']=qs['offset'](_0x446f91['query'][_0xa47c('0x20')]);}return _0x257929[_0xa47c('0x52')](_0x562abe);}})[_0xa47c('0x29')](function(_0x5ed2f0){if(_0x5ed2f0){return _0x5ed2f0?{'count':_0x1a8d3a,'rows':_0x5ed2f0}:null;}})['then'](respondWithResult(_0x3f295f,null))['catch'](handleError(_0x3f295f,null));};exports[_0xa47c('0x53')]=function(_0x2f7696,_0x1bf7af,_0x826539){if(_0x2f7696[_0xa47c('0x4f')]['id']){delete _0x2f7696[_0xa47c('0x4f')]['id'];}return db[_0xa47c('0x31')][_0xa47c('0x54')]({'where':{'id':_0x2f7696[_0xa47c('0x4b')]['id']}})[_0xa47c('0x29')](handleEntityNotFound(_0x1bf7af,null))['then'](function(_0x2477ea){if(_0x2477ea){_0x2f7696['body'][_0xa47c('0x55')]=_0x2477ea['id'];_0x2f7696['body'][_0xa47c('0x56')]=integrations['getSubjects'](_0x2f7696[_0xa47c('0x4f')][_0xa47c('0x57')],_0x2f7696[_0xa47c('0x4f')][_0xa47c('0x33')]);_0x2f7696['body']['Descriptions']=integrations['getDescriptions'](_0x2f7696[_0xa47c('0x4f')][_0xa47c('0x57')],_0x2f7696[_0xa47c('0x4f')][_0xa47c('0x33')]);return db[_0xa47c('0x51')]['create'](_0x2f7696[_0xa47c('0x4f')],{'include':[{'model':db[_0xa47c('0x58')],'as':_0xa47c('0x56')},{'model':db[_0xa47c('0x58')],'as':_0xa47c('0x59')}]});}return null;})['then'](respondWithResult(_0x1bf7af,null))[_0xa47c('0x49')](handleError(_0x1bf7af,null));};function getAccessToken(_0x2e3358){return new Promise(function(_0x16d89f,_0x16ca83){var _0x1a2618;switch(_0x2e3358[_0xa47c('0x5a')]){case'US':_0x1a2618=_0xa47c('0x5b');break;case'AU':_0x1a2618=_0xa47c('0x5c');break;case'EU':_0x1a2618='https://accounts.zoho.eu';break;case'IN':_0x1a2618=_0xa47c('0x5d');break;case'CN':_0x1a2618='https://accounts.zoho.com.cn';break;default:_0x1a2618=_0xa47c('0x5e');break;}var _0x517703={'method':_0xa47c('0x5f'),'uri':_0x1a2618+_0xa47c('0x60'),'qs':{'refresh_token':_0x2e3358[_0xa47c('0x61')],'client_id':_0x2e3358['clientId'],'client_secret':_0x2e3358['clientSecret'],'grant_type':_0xa47c('0x62')},'json':!![]};return rp(_0x517703)['then'](function(_0x7c0f12){if(_0x7c0f12[_0xa47c('0x63')]){_0x16d89f(_0x7c0f12[_0xa47c('0x63')]);}else{_0x16ca83('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x150e19){_0x16ca83(_0x150e19);});});}exports[_0xa47c('0x64')]=function(_0x5b8718,_0x5b63d5,_0x25bb0c){var _0x5c1498,_0x3af30f,_0x3cec98,_0x516264,_0x2229a0;return db[_0xa47c('0x31')]['findOne']({'where':{'id':_0x5b8718['params']['id']},'attributes':['id',_0xa47c('0x65'),_0xa47c('0x5a'),_0xa47c('0x66'),_0xa47c('0x67'),'serverUrl','code',_0xa47c('0x61')]})[_0xa47c('0x29')](handleEntityNotFound(_0x5b63d5,null))[_0xa47c('0x29')](function(_0x25e89f){_0x2229a0=_0x25e89f;_0x5c1498=_0x2229a0[_0xa47c('0x65')];_0x3af30f=_0x5c1498===_0xa47c('0x68')?'eu':'com';_0x3cec98=_0x2229a0[_0xa47c('0x69')];var _0x55f544=_0x3cec98[_0xa47c('0x6a')](-0x1);if(_0x55f544==='/'||_0x55f544==='\x5c'||_0x55f544===':'){_0x3cec98=_0x3cec98['substring'](0x0,_0x3cec98[_0xa47c('0x6b')](_0x55f544));}if(!_0x2229a0[_0xa47c('0x61')]){throw new Error(_0xa47c('0x6c'));}return getAccessToken(_0x2229a0);})[_0xa47c('0x29')](function(_0x1a06ff){if(_0x1a06ff){return rp({'method':_0xa47c('0x6d'),'uri':util[_0xa47c('0x6e')](_0xa47c('0x6f'),_0x3af30f),'qs':{'module':_0xa47c('0x70')},'headers':{'Authorization':_0xa47c('0x71')+_0x1a06ff},'json':!![]});}})[_0xa47c('0x29')](function(_0xfddaed){if(_0xfddaed){if(_0xfddaed[_0xa47c('0x72')]&&_0xfddaed[_0xa47c('0x72')][_0xa47c('0x2c')]){throw new Error(_0xfddaed[_0xa47c('0x72')][_0xa47c('0x2c')][_0xa47c('0x73')]);}var _0x1bc348=[];var _0x3b5768=[];var _0x23def5=['Owner',_0xa47c('0x74'),_0xa47c('0x75'),_0xa47c('0x76'),'Call_Duration',_0xa47c('0x77'),_0xa47c('0x78'),_0xa47c('0x79')];_0x3b5768=_['remove'](_0xfddaed['fields'],function(_0x2ea886){return _0x23def5[_0xa47c('0x7a')](_0x2ea886['api_name']);});for(var _0x57a4b5=0x0;_0x57a4b5<_0x3b5768[_0xa47c('0x3b')];_0x57a4b5++){if(_0x3b5768[_0x57a4b5][_0xa47c('0x7b')]===![]){_0x1bc348[_0xa47c('0x7c')]({'id':_0x3b5768[_0x57a4b5]['id'],'name':_0x3b5768[_0x57a4b5][_0xa47c('0x7d')],'custom':_0x3b5768[_0x57a4b5]['custom_field'],'options':_0x3b5768[_0x57a4b5]['data_type']===_0xa47c('0x7e')&&_0x3b5768[_0x57a4b5][_0xa47c('0x7f')][_0xa47c('0x3b')]>-0x1?_[_0xa47c('0x30')](_0x3b5768[_0x57a4b5][_0xa47c('0x7f')],function(_0x5b0b2f){return{'name':_0x5b0b2f,'value':_0x5b0b2f};}):[]});}}return{'count':_0x1bc348[_0xa47c('0x3b')],'rows':_0x1bc348};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5b63d5,null))[_0xa47c('0x49')](function(_0x483bf7){var _0x38bbaa=_0x5b8718['query'][_0xa47c('0x80')]?0x1f4:_0x483bf7[_0xa47c('0x81')]||0x1f4;logger[_0xa47c('0x2c')](_0xa47c('0x82'),_0xa47c('0x64'),_0x38bbaa,JSON[_0xa47c('0x83')](_0x483bf7));delete _0x483bf7[_0xa47c('0x2e')];if(_0x38bbaa===0x191){_0x38bbaa=0x190;}_0x5b63d5[_0xa47c('0x1e')](_0x38bbaa)[_0xa47c('0x84')](_0x5b8718[_0xa47c('0x34')][_0xa47c('0x80')]?{'message':_0xa47c('0x85'),'statusCode':_0x483bf7[_0xa47c('0x81')]}:_0x483bf7);});}; \ No newline at end of file +var _0x4acc=['include','find','create','body','findOne','sort','filter','getConfigurations','hasOwnProperty','nolimit','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','status','send','index','rawAttributes','map','query','keys','filters','intersection','model','fields','attributes','order','where','pick','merge','options','ZohoAccount','count','includeAll','findAll','rows','catch','params','length'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x4acc,0xcb));var _0xc4ac=function(_0x54461f,_0x158f49){_0x54461f=_0x54461f-0x0;var _0x5944d8=_0x4acc[_0x54461f];return _0x5944d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4ac('0x0'));var zipdir=require(_0xc4ac('0x1'));var jsonpatch=require(_0xc4ac('0x2'));var rp=require(_0xc4ac('0x3'));var moment=require(_0xc4ac('0x4'));var BPromise=require(_0xc4ac('0x5'));var Mustache=require(_0xc4ac('0x6'));var util=require(_0xc4ac('0x7'));var path=require('path');var sox=require(_0xc4ac('0x8'));var csv=require(_0xc4ac('0x9'));var ejs=require(_0xc4ac('0xa'));var fs=require('fs');var fs_extra=require(_0xc4ac('0xb'));var _=require(_0xc4ac('0xc'));var squel=require(_0xc4ac('0xd'));var crypto=require(_0xc4ac('0xe'));var jsforce=require(_0xc4ac('0xf'));var deskjs=require(_0xc4ac('0x10'));var toCsv=require(_0xc4ac('0x9'));var querystring=require(_0xc4ac('0x11'));var Papa=require(_0xc4ac('0x12'));var Redis=require(_0xc4ac('0x13'));var authService=require(_0xc4ac('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc4ac('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4ac('0x16'))(_0xc4ac('0x17'));var utils=require(_0xc4ac('0x18'));var config=require(_0xc4ac('0x19'));var licenseUtil=require(_0xc4ac('0x1a'));var db=require(_0xc4ac('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4c6f40,_0xbec3e4){_0xbec3e4=_0xbec3e4||0xcc;return function(_0x3a9c68){if(_0x3a9c68){return _0x4c6f40[_0xc4ac('0x1c')](_0xbec3e4);}return _0x4c6f40['status'](_0xbec3e4)[_0xc4ac('0x1d')]();};}function respondWithResult(_0x3dec7c,_0x56feec){_0x56feec=_0x56feec||0xc8;return function(_0x5df72c){if(_0x5df72c){return _0x3dec7c['status'](_0x56feec)[_0xc4ac('0x1e')](_0x5df72c);}};}function respondWithFilteredResult(_0xce79f4,_0x1b8c17){return function(_0x3ceac4){if(_0x3ceac4){var _0x33246c=typeof _0x1b8c17[_0xc4ac('0x1f')]===_0xc4ac('0x20')&&typeof _0x1b8c17[_0xc4ac('0x21')]===_0xc4ac('0x20');var _0x23f8d7=_0x3ceac4['count'];var _0x430bdf=_0x33246c?0x0:_0x1b8c17[_0xc4ac('0x1f')];var _0x237bac=_0x33246c?_0x3ceac4['count']:_0x1b8c17[_0xc4ac('0x1f')]+_0x1b8c17['limit'];var _0x27dba6;if(_0x237bac>=_0x23f8d7){_0x237bac=_0x23f8d7;_0x27dba6=0xc8;}else{_0x27dba6=0xce;}_0xce79f4['status'](_0x27dba6);return _0xce79f4[_0xc4ac('0x22')](_0xc4ac('0x23'),_0x430bdf+'-'+_0x237bac+'/'+_0x23f8d7)[_0xc4ac('0x1e')](_0x3ceac4);}return null;};}function patchUpdates(_0x24cff0){return function(_0x42ac01){try{jsonpatch[_0xc4ac('0x24')](_0x42ac01,_0x24cff0,!![]);}catch(_0x5c0ee8){return BPromise[_0xc4ac('0x25')](_0x5c0ee8);}return _0x42ac01[_0xc4ac('0x26')]();};}function saveUpdates(_0x2ca3d5,_0x103fc1){return function(_0x7be381){if(_0x7be381){return _0x7be381[_0xc4ac('0x27')](_0x2ca3d5)['then'](function(_0x2ab9ae){return _0x2ab9ae;});}return null;};}function removeEntity(_0x35d269,_0x4df263){return function(_0x14a151){if(_0x14a151){return _0x14a151['destroy']()[_0xc4ac('0x28')](function(){_0x35d269['status'](0xcc)[_0xc4ac('0x1d')]();});}};}function handleEntityNotFound(_0x15a3fe,_0x407729){return function(_0x55ef37){if(!_0x55ef37){_0x15a3fe['sendStatus'](0x194);}return _0x55ef37;};}function handleError(_0x38978f,_0x2394c6){_0x2394c6=_0x2394c6||0x1f4;return function(_0x11062f){logger[_0xc4ac('0x29')](_0x11062f[_0xc4ac('0x2a')]);if(_0x11062f[_0xc4ac('0x2b')]){delete _0x11062f[_0xc4ac('0x2b')];}_0x38978f[_0xc4ac('0x2c')](_0x2394c6)[_0xc4ac('0x2d')](_0x11062f);};}exports[_0xc4ac('0x2e')]=function(_0x1adb50,_0x5b182d){var _0x5046c6={},_0x59f6bd={},_0x308326={'count':0x0,'rows':[]};var _0x14e2f2=_['map'](db['ZohoAccount'][_0xc4ac('0x2f')],function(_0x57dd1e){return{'name':_0x57dd1e['fieldName'],'type':_0x57dd1e['type']['key']};});_0x59f6bd['model']=_[_0xc4ac('0x30')](_0x14e2f2,_0xc4ac('0x2b'));_0x59f6bd[_0xc4ac('0x31')]=_[_0xc4ac('0x32')](_0x1adb50[_0xc4ac('0x31')]);_0x59f6bd[_0xc4ac('0x33')]=_[_0xc4ac('0x34')](_0x59f6bd['model'],_0x59f6bd['query']);_0x5046c6['attributes']=_[_0xc4ac('0x34')](_0x59f6bd[_0xc4ac('0x35')],qs[_0xc4ac('0x36')](_0x1adb50[_0xc4ac('0x31')][_0xc4ac('0x36')]));_0x5046c6['attributes']=_0x5046c6['attributes']['length']?_0x5046c6[_0xc4ac('0x37')]:_0x59f6bd[_0xc4ac('0x35')];if(!_0x1adb50[_0xc4ac('0x31')]['hasOwnProperty']('nolimit')){_0x5046c6[_0xc4ac('0x21')]=qs['limit'](_0x1adb50[_0xc4ac('0x31')]['limit']);_0x5046c6[_0xc4ac('0x1f')]=qs[_0xc4ac('0x1f')](_0x1adb50[_0xc4ac('0x31')][_0xc4ac('0x1f')]);}_0x5046c6[_0xc4ac('0x38')]=qs['sort'](_0x1adb50[_0xc4ac('0x31')]['sort']);_0x5046c6[_0xc4ac('0x39')]=qs['filters'](_[_0xc4ac('0x3a')](_0x1adb50['query'],_0x59f6bd[_0xc4ac('0x33')]),_0x14e2f2);if(_0x1adb50['query']['filter']){_0x5046c6[_0xc4ac('0x39')]=_[_0xc4ac('0x3b')](_0x5046c6[_0xc4ac('0x39')],{'$or':_[_0xc4ac('0x30')](_0x14e2f2,function(_0x576079){if(_0x576079['type']!=='VIRTUAL'){var _0x498a8d={};_0x498a8d[_0x576079[_0xc4ac('0x2b')]]={'$like':'%'+_0x1adb50[_0xc4ac('0x31')]['filter']+'%'};return _0x498a8d;}})});}_0x5046c6=_[_0xc4ac('0x3b')]({},_0x5046c6,_0x1adb50[_0xc4ac('0x3c')]);var _0x1eaf7a={'where':_0x5046c6['where']};return db[_0xc4ac('0x3d')][_0xc4ac('0x3e')](_0x1eaf7a)[_0xc4ac('0x28')](function(_0x487214){_0x308326[_0xc4ac('0x3e')]=_0x487214;if(_0x1adb50[_0xc4ac('0x31')][_0xc4ac('0x3f')]){_0x5046c6['include']=[{'all':!![]}];}return db[_0xc4ac('0x3d')][_0xc4ac('0x40')](_0x5046c6);})[_0xc4ac('0x28')](function(_0x4bdc2b){_0x308326[_0xc4ac('0x41')]=_0x4bdc2b;return _0x308326;})[_0xc4ac('0x28')](respondWithFilteredResult(_0x5b182d,_0x5046c6))[_0xc4ac('0x42')](handleError(_0x5b182d,null));};exports['show']=function(_0x45d5ce,_0x49718d){var _0x2d7232={'raw':![],'where':{'id':_0x45d5ce[_0xc4ac('0x43')]['id']}},_0x3981ef={};_0x3981ef['model']=_[_0xc4ac('0x32')](db[_0xc4ac('0x3d')][_0xc4ac('0x2f')]);_0x3981ef[_0xc4ac('0x31')]=_[_0xc4ac('0x32')](_0x45d5ce[_0xc4ac('0x31')]);_0x3981ef[_0xc4ac('0x33')]=_[_0xc4ac('0x34')](_0x3981ef['model'],_0x3981ef[_0xc4ac('0x31')]);_0x2d7232[_0xc4ac('0x37')]=_[_0xc4ac('0x34')](_0x3981ef['model'],qs[_0xc4ac('0x36')](_0x45d5ce[_0xc4ac('0x31')][_0xc4ac('0x36')]));_0x2d7232['attributes']=_0x2d7232[_0xc4ac('0x37')][_0xc4ac('0x44')]?_0x2d7232['attributes']:_0x3981ef[_0xc4ac('0x35')];if(_0x45d5ce[_0xc4ac('0x31')]['includeAll']){_0x2d7232[_0xc4ac('0x45')]=[{'all':!![]}];}_0x2d7232=_['merge']({},_0x2d7232,_0x45d5ce[_0xc4ac('0x3c')]);return db[_0xc4ac('0x3d')][_0xc4ac('0x46')](_0x2d7232)[_0xc4ac('0x28')](handleEntityNotFound(_0x49718d,null))['then'](respondWithResult(_0x49718d,null))[_0xc4ac('0x42')](handleError(_0x49718d,null));};exports[_0xc4ac('0x47')]=function(_0x10ba64,_0x161812){return db[_0xc4ac('0x3d')][_0xc4ac('0x47')](_0x10ba64[_0xc4ac('0x48')],{})[_0xc4ac('0x28')](respondWithResult(_0x161812,0xc9))[_0xc4ac('0x42')](handleError(_0x161812,null));};exports[_0xc4ac('0x27')]=function(_0x22a8a2,_0xffdd03){if(_0x22a8a2[_0xc4ac('0x48')]['id']){delete _0x22a8a2['body']['id'];}return db['ZohoAccount'][_0xc4ac('0x46')]({'where':{'id':_0x22a8a2[_0xc4ac('0x43')]['id']}})[_0xc4ac('0x28')](handleEntityNotFound(_0xffdd03,null))['then'](saveUpdates(_0x22a8a2[_0xc4ac('0x48')],null))[_0xc4ac('0x28')](respondWithResult(_0xffdd03,null))[_0xc4ac('0x42')](handleError(_0xffdd03,null));};exports['destroy']=function(_0xfabc55,_0x32f6d3){return db[_0xc4ac('0x3d')]['find']({'where':{'id':_0xfabc55[_0xc4ac('0x43')]['id']}})[_0xc4ac('0x28')](handleEntityNotFound(_0x32f6d3,null))[_0xc4ac('0x28')](removeEntity(_0x32f6d3,null))['catch'](handleError(_0x32f6d3,null));};exports['getConfigurations']=function(_0x3b6c92,_0x2c71f6,_0x45da2d){var _0x1efec8={};var _0x4baf2f={};var _0x3a24ec;var _0x1bdf18;return db[_0xc4ac('0x3d')][_0xc4ac('0x49')]({'where':{'id':_0x3b6c92[_0xc4ac('0x43')]['id']}})[_0xc4ac('0x28')](handleEntityNotFound(_0x2c71f6,null))['then'](function(_0x279171){if(_0x279171){_0x3a24ec=_0x279171;_0x4baf2f[_0xc4ac('0x35')]=_[_0xc4ac('0x32')](db['ZohoConfiguration'][_0xc4ac('0x2f')]);_0x4baf2f['query']=_[_0xc4ac('0x32')](_0x3b6c92[_0xc4ac('0x31')]);_0x4baf2f[_0xc4ac('0x33')]=_[_0xc4ac('0x34')](_0x4baf2f['model'],_0x4baf2f[_0xc4ac('0x31')]);_0x1efec8[_0xc4ac('0x37')]=_[_0xc4ac('0x34')](_0x4baf2f[_0xc4ac('0x35')],qs[_0xc4ac('0x36')](_0x3b6c92[_0xc4ac('0x31')][_0xc4ac('0x36')]));_0x1efec8[_0xc4ac('0x37')]=_0x1efec8[_0xc4ac('0x37')][_0xc4ac('0x44')]?_0x1efec8['attributes']:_0x4baf2f[_0xc4ac('0x35')];_0x1efec8[_0xc4ac('0x38')]=qs['sort'](_0x3b6c92['query'][_0xc4ac('0x4a')]);_0x1efec8[_0xc4ac('0x39')]=qs['filters'](_['pick'](_0x3b6c92[_0xc4ac('0x31')],_0x4baf2f[_0xc4ac('0x33')]));if(_0x3b6c92[_0xc4ac('0x31')][_0xc4ac('0x4b')]){_0x1efec8[_0xc4ac('0x39')]=_['merge'](_0x1efec8[_0xc4ac('0x39')],{'$or':_[_0xc4ac('0x30')](_0x1efec8[_0xc4ac('0x37')],function(_0x57132b){var _0x2b0f31={};_0x2b0f31[_0x57132b]={'$like':'%'+_0x3b6c92[_0xc4ac('0x31')][_0xc4ac('0x4b')]+'%'};return _0x2b0f31;})});}_0x1efec8=_['merge']({},_0x1efec8,_0x3b6c92[_0xc4ac('0x3c')]);return _0x3a24ec[_0xc4ac('0x4c')](_0x1efec8);}})[_0xc4ac('0x28')](function(_0xff769c){if(_0xff769c){_0x1bdf18=_0xff769c[_0xc4ac('0x44')];if(!_0x3b6c92[_0xc4ac('0x31')][_0xc4ac('0x4d')](_0xc4ac('0x4e'))){_0x1efec8[_0xc4ac('0x21')]=qs[_0xc4ac('0x21')](_0x3b6c92[_0xc4ac('0x31')]['limit']);_0x1efec8[_0xc4ac('0x1f')]=qs[_0xc4ac('0x1f')](_0x3b6c92[_0xc4ac('0x31')]['offset']);}return _0x3a24ec[_0xc4ac('0x4c')](_0x1efec8);}})[_0xc4ac('0x28')](function(_0x305dea){if(_0x305dea){return _0x305dea?{'count':_0x1bdf18,'rows':_0x305dea}:null;}})[_0xc4ac('0x28')](respondWithResult(_0x2c71f6,null))[_0xc4ac('0x42')](handleError(_0x2c71f6,null));};exports['addConfiguration']=function(_0xf74183,_0x5eea05,_0xc51d56){if(_0xf74183['body']['id']){delete _0xf74183[_0xc4ac('0x48')]['id'];}return db[_0xc4ac('0x3d')][_0xc4ac('0x49')]({'where':{'id':_0xf74183['params']['id']}})[_0xc4ac('0x28')](handleEntityNotFound(_0x5eea05,null))['then'](function(_0x5ef6a0){if(_0x5ef6a0){_0xf74183[_0xc4ac('0x48')][_0xc4ac('0x4f')]=_0x5ef6a0['id'];_0xf74183[_0xc4ac('0x48')]['Subjects']=integrations[_0xc4ac('0x50')](_0xf74183[_0xc4ac('0x48')][_0xc4ac('0x51')],_0xf74183[_0xc4ac('0x48')][_0xc4ac('0x52')]);_0xf74183[_0xc4ac('0x48')][_0xc4ac('0x53')]=integrations[_0xc4ac('0x54')](_0xf74183[_0xc4ac('0x48')][_0xc4ac('0x51')],_0xf74183[_0xc4ac('0x48')]['type']);return db[_0xc4ac('0x55')][_0xc4ac('0x47')](_0xf74183[_0xc4ac('0x48')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xc4ac('0x56')],'as':_0xc4ac('0x53')}]});}return null;})[_0xc4ac('0x28')](respondWithResult(_0x5eea05,null))[_0xc4ac('0x42')](handleError(_0x5eea05,null));};function getAccessToken(_0x1b56c0){return new Promise(function(_0xc66b61,_0x58e6d4){var _0x3b3054;switch(_0x1b56c0['zone']){case'US':_0x3b3054=_0xc4ac('0x57');break;case'AU':_0x3b3054=_0xc4ac('0x58');break;case'EU':_0x3b3054=_0xc4ac('0x59');break;case'IN':_0x3b3054=_0xc4ac('0x5a');break;case'CN':_0x3b3054=_0xc4ac('0x5b');break;default:_0x3b3054=_0xc4ac('0x59');break;}var _0x48b5c5={'method':_0xc4ac('0x5c'),'uri':_0x3b3054+_0xc4ac('0x5d'),'qs':{'refresh_token':_0x1b56c0[_0xc4ac('0x5e')],'client_id':_0x1b56c0[_0xc4ac('0x5f')],'client_secret':_0x1b56c0[_0xc4ac('0x60')],'grant_type':_0xc4ac('0x61')},'json':!![]};return rp(_0x48b5c5)[_0xc4ac('0x28')](function(_0x43e21f){if(_0x43e21f[_0xc4ac('0x62')]){_0xc66b61(_0x43e21f[_0xc4ac('0x62')]);}else{_0x58e6d4('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x25df5c){_0x58e6d4(_0x25df5c);});});}exports['getFields']=function(_0x19136c,_0x2fdf42,_0x426c3a){var _0x43ad52,_0x52dbcd,_0x17a73b,_0x4231a9,_0x4f9cd7;return db[_0xc4ac('0x3d')][_0xc4ac('0x49')]({'where':{'id':_0x19136c['params']['id']},'attributes':['id',_0xc4ac('0x63'),_0xc4ac('0x64'),_0xc4ac('0x5f'),_0xc4ac('0x60'),_0xc4ac('0x65'),_0xc4ac('0x66'),'refreshToken']})['then'](handleEntityNotFound(_0x2fdf42,null))[_0xc4ac('0x28')](function(_0x38c5af){_0x4f9cd7=_0x38c5af;_0x43ad52=_0x4f9cd7[_0xc4ac('0x63')];_0x52dbcd=_0x43ad52===_0xc4ac('0x67')?'eu':_0xc4ac('0x68');_0x17a73b=_0x4f9cd7[_0xc4ac('0x65')];var _0x145cd4=_0x17a73b[_0xc4ac('0x69')](-0x1);if(_0x145cd4==='/'||_0x145cd4==='\x5c'||_0x145cd4===':'){_0x17a73b=_0x17a73b[_0xc4ac('0x6a')](0x0,_0x17a73b[_0xc4ac('0x6b')](_0x145cd4));}if(!_0x4f9cd7[_0xc4ac('0x5e')]){throw new Error(_0xc4ac('0x6c'));}return getAccessToken(_0x4f9cd7);})[_0xc4ac('0x28')](function(_0x2cd71a){if(_0x2cd71a){return rp({'method':_0xc4ac('0x6d'),'uri':util[_0xc4ac('0x6e')](_0xc4ac('0x6f'),_0x52dbcd),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc4ac('0x70')+_0x2cd71a},'json':!![]});}})['then'](function(_0x1ee41a){if(_0x1ee41a){if(_0x1ee41a[_0xc4ac('0x71')]&&_0x1ee41a[_0xc4ac('0x71')][_0xc4ac('0x29')]){throw new Error(_0x1ee41a[_0xc4ac('0x71')]['error'][_0xc4ac('0x72')]);}var _0x1aad77=[];var _0x4a0576=[];var _0x10ef81=[_0xc4ac('0x73'),_0xc4ac('0x74'),_0xc4ac('0x75'),_0xc4ac('0x76'),_0xc4ac('0x77'),_0xc4ac('0x78'),'Call_Start_Time',_0xc4ac('0x79')];_0x4a0576=_[_0xc4ac('0x7a')](_0x1ee41a['fields'],function(_0xe65322){return _0x10ef81[_0xc4ac('0x7b')](_0xe65322[_0xc4ac('0x7c')]);});for(var _0x46729a=0x0;_0x46729a<_0x4a0576['length'];_0x46729a++){if(_0x4a0576[_0x46729a]['system_mandatory']===![]){_0x1aad77[_0xc4ac('0x7d')]({'id':_0x4a0576[_0x46729a]['id'],'name':_0x4a0576[_0x46729a][_0xc4ac('0x7e')],'custom':_0x4a0576[_0x46729a][_0xc4ac('0x7f')],'options':_0x4a0576[_0x46729a][_0xc4ac('0x80')]===_0xc4ac('0x81')&&_0x4a0576[_0x46729a][_0xc4ac('0x82')][_0xc4ac('0x44')]>-0x1?_[_0xc4ac('0x30')](_0x4a0576[_0x46729a][_0xc4ac('0x82')],function(_0x5c9e25){return{'name':_0x5c9e25,'value':_0x5c9e25};}):[]});}}return{'count':_0x1aad77[_0xc4ac('0x44')],'rows':_0x1aad77};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2fdf42,null))['catch'](function(_0x29054f){var _0x2db045=_0x19136c[_0xc4ac('0x31')][_0xc4ac('0x83')]?0x1f4:_0x29054f[_0xc4ac('0x84')]||0x1f4;logger[_0xc4ac('0x29')](_0xc4ac('0x85'),'getFields',_0x2db045,JSON[_0xc4ac('0x86')](_0x29054f));delete _0x29054f['name'];if(_0x2db045===0x191){_0x2db045=0x190;}_0x2fdf42[_0xc4ac('0x2c')](_0x2db045)[_0xc4ac('0x2d')](_0x19136c['query'][_0xc4ac('0x83')]?{'message':_0xc4ac('0x87'),'statusCode':_0x29054f['statusCode']}:_0x29054f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2a8fe82..a3d44b3 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 _0xd858=['zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','refresh_token','lodash','util','../../config/logger','api','request-promise','path','../../components/integrations/configuration','exports','define','ZohoAccount','changed'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xd858,0x70));var _0x8d85=function(_0xe74934,_0x30a90f){_0xe74934=_0xe74934-0x0;var _0x3039cf=_0xd858[_0xe74934];return _0x3039cf;};'use strict';var _=require(_0x8d85('0x0'));var util=require(_0x8d85('0x1'));var logger=require(_0x8d85('0x2'))(_0x8d85('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d85('0x4'));var fs=require('fs');var path=require(_0x8d85('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8d85('0x6'));module[_0x8d85('0x7')]=function(_0x5a8abc,_0x9a926){return _0x5a8abc[_0x8d85('0x8')](_0x8d85('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5367f4,_0x52a74a,_0x16d044){if(_0x5367f4[_0x8d85('0xa')](_0x8d85('0xb'))||_0x5367f4[_0x8d85('0xa')](_0x8d85('0xc'))||_0x5367f4[_0x8d85('0xa')](_0x8d85('0xd'))||_0x5367f4[_0x8d85('0xa')](_0x8d85('0xe'))||_0x5367f4[_0x8d85('0xa')](_0x8d85('0xf'))||_0x5367f4[_0x8d85('0xa')](_0x8d85('0x10'))){var _0x59248d,_0x518b6a;_0x59248d=_0x5367f4[_0x8d85('0xc')];var _0x267143=_0x59248d[_0x8d85('0x11')](-0x1);if(_0x267143==='/'||_0x267143==='\x5c'||_0x267143===':'){_0x59248d=_0x59248d[_0x8d85('0x12')](0x0,_0x59248d[_0x8d85('0x13')](_0x267143));}switch(_0x5367f4[_0x8d85('0xb')]){case'US':_0x518b6a=_0x8d85('0x14');break;case'AU':_0x518b6a=_0x8d85('0x15');break;case'IN':_0x518b6a=_0x8d85('0x16');break;case'CN':_0x518b6a=_0x8d85('0x17');break;default:_0x518b6a=_0x8d85('0x18');break;}var _0x29be0b={'method':_0x8d85('0x19'),'uri':_0x518b6a+_0x8d85('0x1a'),'form':{'grant_type':_0x8d85('0x1b'),'client_id':_0x5367f4[_0x8d85('0xd')],'client_secret':_0x5367f4[_0x8d85('0xe')],'redirect_uri':_0x5367f4[_0x8d85('0xc')],'code':_0x5367f4[_0x8d85('0xf')]},'headers':{'Content-Type':_0x8d85('0x1c')}};return rp(_0x29be0b)[_0x8d85('0x1d')](function(_0x1e5958){var _0x21e3cf=JSON[_0x8d85('0x1e')](_0x1e5958);if(_0x21e3cf['refresh_token']){_0x5367f4[_0x8d85('0x1f')]=_0x21e3cf['refresh_token'];logger[_0x8d85('0x20')](util['format'](_0x8d85('0x21'),_0x5367f4[_0x8d85('0x22')],_0x5367f4['id']));}else{logger[_0x8d85('0x23')](util[_0x8d85('0x24')](_0x8d85('0x25'),_0x5367f4[_0x8d85('0x22')],_0x5367f4['id']),util['inspect'](_0x21e3cf,{'showHidden':![],'depth':null}));}return _0x16d044(null,_0x52a74a);})[_0x8d85('0x26')](function(_0x4301c0){logger[_0x8d85('0x23')](util[_0x8d85('0x24')](_0x8d85('0x25'),_0x5367f4['name'],_0x5367f4['id']),util[_0x8d85('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x16d044(_0x4301c0);});}else{return _0x16d044(null,_0x52a74a);}},'beforeUpdate':function(_0x32d952,_0x1b4a36,_0x450f69){if(_0x32d952[_0x8d85('0xa')](_0x8d85('0xb'))||_0x32d952[_0x8d85('0xa')]('serverUrl')||_0x32d952['changed'](_0x8d85('0xd'))||_0x32d952[_0x8d85('0xa')](_0x8d85('0xe'))||_0x32d952[_0x8d85('0xa')](_0x8d85('0xf'))||_0x32d952[_0x8d85('0xa')]('host')){var _0x16919f,_0x1de00f;_0x16919f=_0x32d952[_0x8d85('0xc')];var _0x209e37=_0x16919f[_0x8d85('0x11')](-0x1);if(_0x209e37==='/'||_0x209e37==='\x5c'||_0x209e37===':'){_0x16919f=_0x16919f['substring'](0x0,_0x16919f['lastIndexOf'](_0x209e37));}switch(_0x32d952[_0x8d85('0xb')]){case'US':_0x1de00f='https://accounts.zoho.com';break;case'AU':_0x1de00f=_0x8d85('0x15');break;case'IN':_0x1de00f='https://accounts.zoho.in';break;case'CN':_0x1de00f=_0x8d85('0x17');break;default:_0x1de00f=_0x8d85('0x18');break;}var _0x317441={'method':_0x8d85('0x19'),'uri':_0x1de00f+_0x8d85('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x32d952[_0x8d85('0xd')],'client_secret':_0x32d952[_0x8d85('0xe')],'redirect_uri':_0x32d952[_0x8d85('0xc')],'code':_0x32d952[_0x8d85('0xf')]},'headers':{'Content-Type':_0x8d85('0x1c')}};return rp(_0x317441)[_0x8d85('0x1d')](function(_0x53cff1){var _0x56bbfa=JSON[_0x8d85('0x1e')](_0x53cff1);if(_0x56bbfa[_0x8d85('0x28')]){_0x32d952[_0x8d85('0x1f')]=_0x56bbfa[_0x8d85('0x28')];logger['info'](util[_0x8d85('0x24')](_0x8d85('0x21'),_0x32d952[_0x8d85('0x22')],_0x32d952['id']));}else{logger[_0x8d85('0x23')](util[_0x8d85('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x32d952[_0x8d85('0x22')],_0x32d952['id']),util[_0x8d85('0x27')](_0x56bbfa,{'showHidden':![],'depth':null}));}return _0x450f69(null,_0x1b4a36);})[_0x8d85('0x26')](function(_0x1ebda0){logger[_0x8d85('0x23')](util[_0x8d85('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x32d952['name'],_0x32d952['id']),util[_0x8d85('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x450f69(_0x1ebda0);});}else{return _0x450f69(null,_0x1b4a36);}}}});}; \ No newline at end of file +var _0x07f1=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','host','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0x07f1,0x111));var _0x107f=function(_0x5068d3,_0x36e143){_0x5068d3=_0x5068d3-0x0;var _0x38bf72=_0x07f1[_0x5068d3];return _0x38bf72;};'use strict';var _=require(_0x107f('0x0'));var util=require(_0x107f('0x1'));var logger=require(_0x107f('0x2'))(_0x107f('0x3'));var moment=require(_0x107f('0x4'));var BPromise=require('bluebird');var rp=require(_0x107f('0x5'));var fs=require('fs');var path=require(_0x107f('0x6'));var rimraf=require(_0x107f('0x7'));var config=require('../../config/environment');var attributes=require(_0x107f('0x8'));var integrations=require(_0x107f('0x9'));module[_0x107f('0xa')]=function(_0x20ba17,_0x49b7fd){return _0x20ba17[_0x107f('0xb')](_0x107f('0xc'),attributes,{'tableName':_0x107f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c7a04,_0x3ac476,_0x1993c4){if(_0x2c7a04[_0x107f('0xe')](_0x107f('0xf'))||_0x2c7a04[_0x107f('0xe')](_0x107f('0x10'))||_0x2c7a04[_0x107f('0xe')](_0x107f('0x11'))||_0x2c7a04[_0x107f('0xe')](_0x107f('0x12'))||_0x2c7a04[_0x107f('0xe')](_0x107f('0x13'))||_0x2c7a04[_0x107f('0xe')]('host')){var _0x58e1c3,_0x36cb6b;_0x58e1c3=_0x2c7a04[_0x107f('0x10')];var _0x1078d6=_0x58e1c3[_0x107f('0x14')](-0x1);if(_0x1078d6==='/'||_0x1078d6==='\x5c'||_0x1078d6===':'){_0x58e1c3=_0x58e1c3[_0x107f('0x15')](0x0,_0x58e1c3[_0x107f('0x16')](_0x1078d6));}switch(_0x2c7a04[_0x107f('0xf')]){case'US':_0x36cb6b=_0x107f('0x17');break;case'AU':_0x36cb6b=_0x107f('0x18');break;case'IN':_0x36cb6b=_0x107f('0x19');break;case'CN':_0x36cb6b=_0x107f('0x1a');break;default:_0x36cb6b=_0x107f('0x1b');break;}var _0x571c53={'method':_0x107f('0x1c'),'uri':_0x36cb6b+_0x107f('0x1d'),'form':{'grant_type':_0x107f('0x1e'),'client_id':_0x2c7a04['clientId'],'client_secret':_0x2c7a04['clientSecret'],'redirect_uri':_0x2c7a04['serverUrl'],'code':_0x2c7a04[_0x107f('0x13')]},'headers':{'Content-Type':_0x107f('0x1f')}};return rp(_0x571c53)['then'](function(_0xbb8fd3){var _0x14b3e7=JSON[_0x107f('0x20')](_0xbb8fd3);if(_0x14b3e7['refresh_token']){_0x2c7a04[_0x107f('0x21')]=_0x14b3e7[_0x107f('0x22')];logger[_0x107f('0x23')](util[_0x107f('0x24')](_0x107f('0x25'),_0x2c7a04['name'],_0x2c7a04['id']));}else{logger[_0x107f('0x26')](util[_0x107f('0x24')](_0x107f('0x27'),_0x2c7a04[_0x107f('0x28')],_0x2c7a04['id']),util[_0x107f('0x29')](_0x14b3e7,{'showHidden':![],'depth':null}));}return _0x1993c4(null,_0x3ac476);})[_0x107f('0x2a')](function(_0x41a732){logger[_0x107f('0x26')](util[_0x107f('0x24')](_0x107f('0x27'),_0x2c7a04[_0x107f('0x28')],_0x2c7a04['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1993c4(_0x41a732);});}else{return _0x1993c4(null,_0x3ac476);}},'beforeUpdate':function(_0x411cb9,_0x2e960b,_0x147890){if(_0x411cb9[_0x107f('0xe')](_0x107f('0xf'))||_0x411cb9[_0x107f('0xe')](_0x107f('0x10'))||_0x411cb9['changed'](_0x107f('0x11'))||_0x411cb9[_0x107f('0xe')](_0x107f('0x12'))||_0x411cb9[_0x107f('0xe')](_0x107f('0x13'))||_0x411cb9[_0x107f('0xe')](_0x107f('0x2b'))){var _0x2cbeb0,_0x4edbd2;_0x2cbeb0=_0x411cb9[_0x107f('0x10')];var _0xbfa700=_0x2cbeb0[_0x107f('0x14')](-0x1);if(_0xbfa700==='/'||_0xbfa700==='\x5c'||_0xbfa700===':'){_0x2cbeb0=_0x2cbeb0[_0x107f('0x15')](0x0,_0x2cbeb0[_0x107f('0x16')](_0xbfa700));}switch(_0x411cb9['zone']){case'US':_0x4edbd2=_0x107f('0x17');break;case'AU':_0x4edbd2=_0x107f('0x18');break;case'IN':_0x4edbd2=_0x107f('0x19');break;case'CN':_0x4edbd2=_0x107f('0x1a');break;default:_0x4edbd2=_0x107f('0x1b');break;}var _0x580323={'method':_0x107f('0x1c'),'uri':_0x4edbd2+_0x107f('0x1d'),'form':{'grant_type':_0x107f('0x1e'),'client_id':_0x411cb9[_0x107f('0x11')],'client_secret':_0x411cb9[_0x107f('0x12')],'redirect_uri':_0x411cb9[_0x107f('0x10')],'code':_0x411cb9[_0x107f('0x13')]},'headers':{'Content-Type':_0x107f('0x1f')}};return rp(_0x580323)['then'](function(_0x3850f2){var _0x21f783=JSON[_0x107f('0x20')](_0x3850f2);if(_0x21f783[_0x107f('0x22')]){_0x411cb9[_0x107f('0x21')]=_0x21f783[_0x107f('0x22')];logger['info'](util[_0x107f('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x411cb9[_0x107f('0x28')],_0x411cb9['id']));}else{logger[_0x107f('0x26')](util[_0x107f('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x411cb9[_0x107f('0x28')],_0x411cb9['id']),util[_0x107f('0x29')](_0x21f783,{'showHidden':![],'depth':null}));}return _0x147890(null,_0x2e960b);})[_0x107f('0x2a')](function(_0x27d148){logger[_0x107f('0x26')](util[_0x107f('0x24')](_0x107f('0x27'),_0x411cb9['name'],_0x411cb9['id']),util[_0x107f('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x147890(_0x27d148);});}else{return _0x147890(null,_0x2e960b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b691f82..8b85a4a 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 _0x6365=['ZohoAccount','options','raw','where','attributes','limit','include','model','map','catch','find','debug','ShowZohoAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetZohoAccount'];(function(_0x421a99,_0x239c08){var _0x16a86c=function(_0x2a3d4c){while(--_0x2a3d4c){_0x421a99['push'](_0x421a99['shift']());}};_0x16a86c(++_0x239c08);}(_0x6365,0x148));var _0x5636=function(_0x5cc58f,_0xe7d059){_0x5cc58f=_0x5cc58f-0x0;var _0x344816=_0x6365[_0x5cc58f];return _0x344816;};'use strict';var _=require(_0x5636('0x0'));var util=require(_0x5636('0x1'));var moment=require(_0x5636('0x2'));var BPromise=require(_0x5636('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5636('0x4'));var db=require(_0x5636('0x5'))['db'];var utils=require(_0x5636('0x6'));var logger=require(_0x5636('0x7'))(_0x5636('0x8'));var config=require('../../config/environment');var jayson=require(_0x5636('0x9'));var client=jayson[_0x5636('0xa')][_0x5636('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3575b7,_0x53d5b4,_0x17439f){return new BPromise(function(_0x10769f,_0x54eb5c){return client['request'](_0x3575b7,_0x17439f)[_0x5636('0xc')](function(_0x43e880){logger[_0x5636('0xd')](_0x5636('0xe'),_0x53d5b4,'request\x20sent');logger['debug'](_0x5636('0xf'),_0x53d5b4,'request\x20sent',JSON[_0x5636('0x10')](_0x43e880));if(_0x43e880[_0x5636('0x11')]){if(_0x43e880[_0x5636('0x11')][_0x5636('0x12')]===0x1f4){logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x43e880['error'][_0x5636('0x13')]);return _0x54eb5c(_0x43e880[_0x5636('0x11')]['message']);}logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x43e880['error']['message']);return _0x10769f(_0x43e880[_0x5636('0x11')][_0x5636('0x13')]);}else{logger[_0x5636('0xd')](_0x5636('0xe'),_0x53d5b4,_0x5636('0x14'));_0x10769f(_0x43e880['result'][_0x5636('0x13')]);}})['catch'](function(_0x55de40){logger[_0x5636('0x11')](_0x5636('0xe'),_0x53d5b4,_0x55de40);_0x54eb5c(_0x55de40);});});}exports[_0x5636('0x15')]=function(_0x287675){var _0x4683c6=this;return new Promise(function(_0x2e375d,_0x17cdc4){return db[_0x5636('0x16')]['findAll']({'raw':_0x287675['options']?_0x287675[_0x5636('0x17')][_0x5636('0x18')]===undefined?!![]:![]:!![],'where':_0x287675[_0x5636('0x17')]?_0x287675['options'][_0x5636('0x19')]||null:null,'attributes':_0x287675[_0x5636('0x17')]?_0x287675[_0x5636('0x17')][_0x5636('0x1a')]||null:null,'limit':_0x287675[_0x5636('0x17')]?_0x287675['options'][_0x5636('0x1b')]||null:null,'include':_0x287675[_0x5636('0x17')]?_0x287675[_0x5636('0x17')][_0x5636('0x1c')]?_['map'](_0x287675['options'][_0x5636('0x1c')],function(_0x4d8f1c){return{'model':db[_0x4d8f1c[_0x5636('0x1d')]],'as':_0x4d8f1c['as'],'attributes':_0x4d8f1c[_0x5636('0x1a')],'include':_0x4d8f1c[_0x5636('0x1c')]?_[_0x5636('0x1e')](_0x4d8f1c['include'],function(_0x3a1575){return{'model':db[_0x3a1575['model']],'as':_0x3a1575['as'],'attributes':_0x3a1575[_0x5636('0x1a')],'include':_0x3a1575['include']?_[_0x5636('0x1e')](_0x3a1575[_0x5636('0x1c')],function(_0x10f3ea){return{'model':db[_0x10f3ea[_0x5636('0x1d')]],'as':_0x10f3ea['as'],'attributes':_0x10f3ea['attributes']};}):[]};}):[]};}):[]:[]})[_0x5636('0xc')](function(_0x1ff533){logger[_0x5636('0xd')](_0x5636('0x15'),_0x287675);logger['debug'](_0x5636('0x15'),_0x287675,JSON['stringify'](_0x1ff533));_0x2e375d(_0x1ff533);})[_0x5636('0x1f')](function(_0x54726e){logger[_0x5636('0x11')]('GetZohoAccount',_0x54726e[_0x5636('0x13')],_0x287675);_0x17cdc4(_0x4683c6['error'](0x1f4,_0x54726e[_0x5636('0x13')]));});});};exports['ShowZohoAccount']=function(_0x183f69){var _0x29e56a=this;return new Promise(function(_0x3987e2,_0x573e86){return db[_0x5636('0x16')][_0x5636('0x20')]({'raw':_0x183f69[_0x5636('0x17')]?_0x183f69['options'][_0x5636('0x18')]===undefined?!![]:![]:!![],'where':_0x183f69[_0x5636('0x17')]?_0x183f69[_0x5636('0x17')][_0x5636('0x19')]||null:null,'attributes':_0x183f69[_0x5636('0x17')]?_0x183f69[_0x5636('0x17')]['attributes']||null:null,'include':_0x183f69['options']?_0x183f69[_0x5636('0x17')]['include']?_[_0x5636('0x1e')](_0x183f69['options'][_0x5636('0x1c')],function(_0x3825ca){return{'model':db[_0x3825ca[_0x5636('0x1d')]],'as':_0x3825ca['as'],'attributes':_0x3825ca[_0x5636('0x1a')],'include':_0x3825ca['include']?_[_0x5636('0x1e')](_0x3825ca['include'],function(_0x1885c5){return{'model':db[_0x1885c5[_0x5636('0x1d')]],'as':_0x1885c5['as'],'attributes':_0x1885c5[_0x5636('0x1a')],'include':_0x1885c5['include']?_['map'](_0x1885c5[_0x5636('0x1c')],function(_0x41604e){return{'model':db[_0x41604e[_0x5636('0x1d')]],'as':_0x41604e['as'],'attributes':_0x41604e[_0x5636('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5636('0xc')](function(_0x154eb6){logger[_0x5636('0xd')]('ShowZohoAccount',_0x183f69);logger[_0x5636('0x21')]('ShowZohoAccount',_0x183f69,JSON['stringify'](_0x154eb6));_0x3987e2(_0x154eb6);})[_0x5636('0x1f')](function(_0x276972){logger[_0x5636('0x11')](_0x5636('0x22'),_0x276972[_0x5636('0x13')],_0x183f69);_0x573e86(_0x29e56a[_0x5636('0x11')](0x1f4,_0x276972[_0x5636('0x13')]));});});}; \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZohoAccount','find'];(function(_0x139790,_0x466283){var _0x23d99d=function(_0x1463c2){while(--_0x1463c2){_0x139790['push'](_0x139790['shift']());}};_0x23d99d(++_0x466283);}(_0x77d4,0x108));var _0x477d=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0x77d4[_0x236912];return _0x582904;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowZohoAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 39b7a58..ba8c94a 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 _0x7fed=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','exports','multer','util','path','express'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x7fed,0xec));var _0xd7fe=function(_0x5dd6d2,_0xa6e079){_0x5dd6d2=_0x5dd6d2-0x0;var _0x2ee77b=_0x7fed[_0x5dd6d2];return _0x2ee77b;};'use strict';var multer=require(_0xd7fe('0x0'));var util=require(_0xd7fe('0x1'));var path=require(_0xd7fe('0x2'));var timeout=require('connect-timeout');var express=require(_0xd7fe('0x3'));var router=express[_0xd7fe('0x4')]();var fs_extra=require(_0xd7fe('0x5'));var auth=require(_0xd7fe('0x6'));var interaction=require(_0xd7fe('0x7'));var config=require(_0xd7fe('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xd7fe('0x9')]('/',auth[_0xd7fe('0xa')](),controller[_0xd7fe('0xb')]);router['get'](_0xd7fe('0xc'),auth[_0xd7fe('0xa')](),controller[_0xd7fe('0xd')]);router['get'](_0xd7fe('0xe'),auth['isAuthenticated'](),controller[_0xd7fe('0xf')]);router[_0xd7fe('0x9')](_0xd7fe('0x10'),auth['isAuthenticated'](),controller[_0xd7fe('0x11')]);router[_0xd7fe('0x9')](_0xd7fe('0x12'),auth[_0xd7fe('0xa')](),controller['getDescriptions']);router[_0xd7fe('0x13')]('/',auth['isAuthenticated'](),controller[_0xd7fe('0x14')]);router[_0xd7fe('0x15')](_0xd7fe('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd7fe('0x16')](_0xd7fe('0xc'),auth[_0xd7fe('0xa')](),controller['destroy']);module[_0xd7fe('0x17')]=router; \ No newline at end of file +var _0x420b=['put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create'];(function(_0x37f8cf,_0x364fb3){var _0x40f300=function(_0x1fc894){while(--_0x1fc894){_0x37f8cf['push'](_0x37f8cf['shift']());}};_0x40f300(++_0x364fb3);}(_0x420b,0xa3));var _0xb420=function(_0x537692,_0x473881){_0x537692=_0x537692-0x0;var _0x443441=_0x420b[_0x537692];return _0x443441;};'use strict';var multer=require(_0xb420('0x0'));var util=require(_0xb420('0x1'));var path=require(_0xb420('0x2'));var timeout=require(_0xb420('0x3'));var express=require(_0xb420('0x4'));var router=express['Router']();var fs_extra=require(_0xb420('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb420('0x6'));var config=require('../../config/environment');var controller=require(_0xb420('0x7'));router[_0xb420('0x8')]('/',auth[_0xb420('0x9')](),controller['index']);router[_0xb420('0x8')](_0xb420('0xa'),auth[_0xb420('0x9')](),controller['show']);router[_0xb420('0x8')](_0xb420('0xb'),auth[_0xb420('0x9')](),controller['getFields']);router[_0xb420('0x8')](_0xb420('0xc'),auth[_0xb420('0x9')](),controller[_0xb420('0xd')]);router['get'](_0xb420('0xe'),auth[_0xb420('0x9')](),controller[_0xb420('0xf')]);router['post']('/',auth[_0xb420('0x9')](),controller[_0xb420('0x10')]);router[_0xb420('0x11')](_0xb420('0xa'),auth['isAuthenticated'](),controller[_0xb420('0x12')]);router['delete'](_0xb420('0xa'),auth[_0xb420('0x9')](),controller[_0xb420('0x13')]);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 e7b3ddf..d77cc3e 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 _0x5a81=['contact_lead','contact','exports','STRING','ENUM','lead'];(function(_0x4969fa,_0x1e63b6){var _0x1e9157=function(_0x43a104){while(--_0x43a104){_0x4969fa['push'](_0x4969fa['shift']());}};_0x1e9157(++_0x1e63b6);}(_0x5a81,0x92));var _0x15a8=function(_0x2b1e5b,_0x43b03a){_0x2b1e5b=_0x2b1e5b-0x0;var _0x2a07be=_0x5a81[_0x2b1e5b];return _0x2a07be;};'use strict';var Sequelize=require('sequelize');module[_0x15a8('0x0')]={'name':{'type':Sequelize[_0x15a8('0x1')]},'moduleCreate':{'type':Sequelize[_0x15a8('0x2')]('lead','contact','nothing'),'defaultValue':_0x15a8('0x3')},'moduleSearch':{'type':Sequelize[_0x15a8('0x2')](_0x15a8('0x4'),_0x15a8('0x5'),_0x15a8('0x3')),'defaultValue':_0x15a8('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f1f=['ENUM','contact_lead','STRING','sequelize','exports','contact','nothing'];(function(_0x3be658,_0x5b5905){var _0x8382ed=function(_0x361b7d){while(--_0x361b7d){_0x3be658['push'](_0x3be658['shift']());}};_0x8382ed(++_0x5b5905);}(_0x5f1f,0x1a0));var _0xf5f1=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x5f1f[_0xa3fadc];return _0x23ecb8;};'use strict';var Sequelize=require(_0xf5f1('0x0'));module[_0xf5f1('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xf5f1('0x2'),_0xf5f1('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xf5f1('0x4')](_0xf5f1('0x5'),_0xf5f1('0x2'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf5f1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9f86b8d..6d23e71 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 _0xc11c=['rawAttributes','length','find','create','body','getFields','findOne','ZohoField','pick','options','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoConfiguration','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x5c24a2,_0x54e610){var _0x207b4a=function(_0x1ec959){while(--_0x1ec959){_0x5c24a2['push'](_0x5c24a2['shift']());}};_0x207b4a(++_0x54e610);}(_0xc11c,0x141));var _0xcc11=function(_0x476c6f,_0x5dc8b9){_0x476c6f=_0x476c6f-0x0;var _0x53e534=_0xc11c[_0x476c6f];return _0x53e534;};'use strict';var emlformat=require(_0xcc11('0x0'));var rimraf=require(_0xcc11('0x1'));var zipdir=require(_0xcc11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc11('0x3'));var util=require('util');var path=require(_0xcc11('0x4'));var sox=require(_0xcc11('0x5'));var csv=require(_0xcc11('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc11('0x7'));var squel=require('squel');var crypto=require(_0xcc11('0x8'));var jsforce=require(_0xcc11('0x9'));var deskjs=require(_0xcc11('0xa'));var toCsv=require(_0xcc11('0x6'));var querystring=require(_0xcc11('0xb'));var Papa=require(_0xcc11('0xc'));var Redis=require(_0xcc11('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcc11('0xe'));var as=require(_0xcc11('0xf'));var hardwareService=require(_0xcc11('0x10'));var logger=require(_0xcc11('0x11'))(_0xcc11('0x12'));var utils=require('../../config/utils');var config=require(_0xcc11('0x13'));var licenseUtil=require(_0xcc11('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x194182,_0x4bd511){_0x4bd511=_0x4bd511||0xcc;return function(_0x1c0e03){if(_0x1c0e03){return _0x194182[_0xcc11('0x15')](_0x4bd511);}return _0x194182[_0xcc11('0x16')](_0x4bd511)['end']();};}function respondWithResult(_0xd50d22,_0x315e9b){_0x315e9b=_0x315e9b||0xc8;return function(_0x29d02f){if(_0x29d02f){return _0xd50d22['status'](_0x315e9b)[_0xcc11('0x17')](_0x29d02f);}};}function respondWithFilteredResult(_0x11549c,_0x2b7ab6){return function(_0x248d52){if(_0x248d52){var _0x2b0dbe=typeof _0x2b7ab6['offset']===_0xcc11('0x18')&&typeof _0x2b7ab6['limit']===_0xcc11('0x18');var _0xbf0baa=_0x248d52[_0xcc11('0x19')];var _0x3fe2f3=_0x2b0dbe?0x0:_0x2b7ab6['offset'];var _0x589e76=_0x2b0dbe?_0x248d52['count']:_0x2b7ab6[_0xcc11('0x1a')]+_0x2b7ab6[_0xcc11('0x1b')];var _0x4b910f;if(_0x589e76>=_0xbf0baa){_0x589e76=_0xbf0baa;_0x4b910f=0xc8;}else{_0x4b910f=0xce;}_0x11549c[_0xcc11('0x16')](_0x4b910f);return _0x11549c[_0xcc11('0x1c')]('Content-Range',_0x3fe2f3+'-'+_0x589e76+'/'+_0xbf0baa)[_0xcc11('0x17')](_0x248d52);}return null;};}function patchUpdates(_0x376f7f){return function(_0x2c4572){try{jsonpatch[_0xcc11('0x1d')](_0x2c4572,_0x376f7f,!![]);}catch(_0x57f995){return BPromise[_0xcc11('0x1e')](_0x57f995);}return _0x2c4572[_0xcc11('0x1f')]();};}function saveUpdates(_0x49f37a,_0x1ebc98){return function(_0x54e019){if(_0x54e019){return _0x54e019[_0xcc11('0x20')](_0x49f37a)[_0xcc11('0x21')](function(_0x5c91f9){return _0x5c91f9;});}return null;};}function removeEntity(_0x51d50e,_0x5e5bc7){return function(_0xca2cdb){if(_0xca2cdb){return _0xca2cdb[_0xcc11('0x22')]()['then'](function(){_0x51d50e[_0xcc11('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3972ee,_0x23245a){return function(_0xa2e381){if(!_0xa2e381){_0x3972ee[_0xcc11('0x15')](0x194);}return _0xa2e381;};}function handleError(_0x4def9b,_0x5096f3){_0x5096f3=_0x5096f3||0x1f4;return function(_0x5c2967){logger[_0xcc11('0x23')](_0x5c2967['stack']);if(_0x5c2967[_0xcc11('0x24')]){delete _0x5c2967[_0xcc11('0x24')];}_0x4def9b[_0xcc11('0x16')](_0x5096f3)[_0xcc11('0x25')](_0x5c2967);};}exports[_0xcc11('0x26')]=function(_0x3be405,_0x2e9a1e){var _0x20078c={},_0x2c89b6={},_0x394a6c={'count':0x0,'rows':[]};var _0x5ddd72=_[_0xcc11('0x27')](db[_0xcc11('0x28')]['rawAttributes'],function(_0x587df9){return{'name':_0x587df9[_0xcc11('0x29')],'type':_0x587df9['type']['key']};});_0x2c89b6[_0xcc11('0x2a')]=_['map'](_0x5ddd72,'name');_0x2c89b6['query']=_['keys'](_0x3be405[_0xcc11('0x2b')]);_0x2c89b6[_0xcc11('0x2c')]=_[_0xcc11('0x2d')](_0x2c89b6[_0xcc11('0x2a')],_0x2c89b6[_0xcc11('0x2b')]);_0x20078c[_0xcc11('0x2e')]=_['intersection'](_0x2c89b6[_0xcc11('0x2a')],qs[_0xcc11('0x2f')](_0x3be405[_0xcc11('0x2b')][_0xcc11('0x2f')]));_0x20078c[_0xcc11('0x2e')]=_0x20078c['attributes']['length']?_0x20078c['attributes']:_0x2c89b6[_0xcc11('0x2a')];if(!_0x3be405[_0xcc11('0x2b')][_0xcc11('0x30')]('nolimit')){_0x20078c['limit']=qs[_0xcc11('0x1b')](_0x3be405['query']['limit']);_0x20078c[_0xcc11('0x1a')]=qs['offset'](_0x3be405[_0xcc11('0x2b')][_0xcc11('0x1a')]);}_0x20078c[_0xcc11('0x31')]=qs[_0xcc11('0x32')](_0x3be405[_0xcc11('0x2b')]['sort']);_0x20078c[_0xcc11('0x33')]=qs[_0xcc11('0x2c')](_['pick'](_0x3be405[_0xcc11('0x2b')],_0x2c89b6[_0xcc11('0x2c')]),_0x5ddd72);if(_0x3be405['query'][_0xcc11('0x34')]){_0x20078c[_0xcc11('0x33')]=_['merge'](_0x20078c[_0xcc11('0x33')],{'$or':_['map'](_0x5ddd72,function(_0x1f3517){if(_0x1f3517[_0xcc11('0x35')]!==_0xcc11('0x36')){var _0x28ef4a={};_0x28ef4a[_0x1f3517[_0xcc11('0x24')]]={'$like':'%'+_0x3be405['query'][_0xcc11('0x34')]+'%'};return _0x28ef4a;}})});}_0x20078c=_[_0xcc11('0x37')]({},_0x20078c,_0x3be405['options']);var _0x1aa14f={'where':_0x20078c[_0xcc11('0x33')]};return db[_0xcc11('0x28')][_0xcc11('0x19')](_0x1aa14f)[_0xcc11('0x21')](function(_0x2f01f0){_0x394a6c['count']=_0x2f01f0;if(_0x3be405[_0xcc11('0x2b')][_0xcc11('0x38')]){_0x20078c[_0xcc11('0x39')]=[{'all':!![]}];}return db[_0xcc11('0x28')][_0xcc11('0x3a')](_0x20078c);})[_0xcc11('0x21')](function(_0x243821){_0x394a6c[_0xcc11('0x3b')]=_0x243821;return _0x394a6c;})[_0xcc11('0x21')](respondWithFilteredResult(_0x2e9a1e,_0x20078c))[_0xcc11('0x3c')](handleError(_0x2e9a1e,null));};exports[_0xcc11('0x3d')]=function(_0x16a3d4,_0xff9f58){var _0x4daaaf={'raw':![],'where':{'id':_0x16a3d4[_0xcc11('0x3e')]['id']}},_0x5b5612={};_0x5b5612['model']=_[_0xcc11('0x3f')](db[_0xcc11('0x28')][_0xcc11('0x40')]);_0x5b5612[_0xcc11('0x2b')]=_[_0xcc11('0x3f')](_0x16a3d4[_0xcc11('0x2b')]);_0x5b5612[_0xcc11('0x2c')]=_[_0xcc11('0x2d')](_0x5b5612[_0xcc11('0x2a')],_0x5b5612['query']);_0x4daaaf['attributes']=_[_0xcc11('0x2d')](_0x5b5612[_0xcc11('0x2a')],qs['fields'](_0x16a3d4['query']['fields']));_0x4daaaf['attributes']=_0x4daaaf[_0xcc11('0x2e')][_0xcc11('0x41')]?_0x4daaaf[_0xcc11('0x2e')]:_0x5b5612[_0xcc11('0x2a')];if(_0x16a3d4[_0xcc11('0x2b')][_0xcc11('0x38')]){_0x4daaaf['include']=[{'all':!![]}];}_0x4daaaf=_[_0xcc11('0x37')]({},_0x4daaaf,_0x16a3d4['options']);return db[_0xcc11('0x28')][_0xcc11('0x42')](_0x4daaaf)[_0xcc11('0x21')](handleEntityNotFound(_0xff9f58,null))[_0xcc11('0x21')](respondWithResult(_0xff9f58,null))['catch'](handleError(_0xff9f58,null));};exports[_0xcc11('0x43')]=function(_0x3df569,_0x5c7815){return db['ZohoConfiguration']['create'](_0x3df569['body'],{})['then'](respondWithResult(_0x5c7815,0xc9))['catch'](handleError(_0x5c7815,null));};exports[_0xcc11('0x20')]=function(_0x3b5d65,_0x44d083){if(_0x3b5d65[_0xcc11('0x44')]['id']){delete _0x3b5d65[_0xcc11('0x44')]['id'];}return db[_0xcc11('0x28')][_0xcc11('0x42')]({'where':{'id':_0x3b5d65[_0xcc11('0x3e')]['id']}})['then'](handleEntityNotFound(_0x44d083,null))[_0xcc11('0x21')](saveUpdates(_0x3b5d65['body'],null))['then'](respondWithResult(_0x44d083,null))[_0xcc11('0x3c')](handleError(_0x44d083,null));};exports['destroy']=function(_0x5b13a4,_0x15f0e7){return db[_0xcc11('0x28')]['find']({'where':{'id':_0x5b13a4['params']['id']}})[_0xcc11('0x21')](handleEntityNotFound(_0x15f0e7,null))[_0xcc11('0x21')](removeEntity(_0x15f0e7,null))[_0xcc11('0x3c')](handleError(_0x15f0e7,null));};exports[_0xcc11('0x45')]=function(_0x4703f7,_0x8e4a4d,_0x3e16d6){var _0xd241a5={};var _0x1ac9e2={};var _0x4ea42a;var _0x3dca94;return db[_0xcc11('0x28')][_0xcc11('0x46')]({'where':{'id':_0x4703f7[_0xcc11('0x3e')]['id']}})['then'](handleEntityNotFound(_0x8e4a4d,null))[_0xcc11('0x21')](function(_0x5021a5){if(_0x5021a5){_0x4ea42a=_0x5021a5;_0x1ac9e2[_0xcc11('0x2a')]=_['keys'](db[_0xcc11('0x47')]['rawAttributes']);_0x1ac9e2[_0xcc11('0x2b')]=_[_0xcc11('0x3f')](_0x4703f7[_0xcc11('0x2b')]);_0x1ac9e2[_0xcc11('0x2c')]=_[_0xcc11('0x2d')](_0x1ac9e2[_0xcc11('0x2a')],_0x1ac9e2[_0xcc11('0x2b')]);_0xd241a5[_0xcc11('0x2e')]=_[_0xcc11('0x2d')](_0x1ac9e2[_0xcc11('0x2a')],qs[_0xcc11('0x2f')](_0x4703f7['query'][_0xcc11('0x2f')]));_0xd241a5[_0xcc11('0x2e')]=_0xd241a5['attributes']['length']?_0xd241a5[_0xcc11('0x2e')]:_0x1ac9e2[_0xcc11('0x2a')];_0xd241a5[_0xcc11('0x31')]=qs[_0xcc11('0x32')](_0x4703f7[_0xcc11('0x2b')][_0xcc11('0x32')]);_0xd241a5['where']=qs[_0xcc11('0x2c')](_[_0xcc11('0x48')](_0x4703f7['query'],_0x1ac9e2[_0xcc11('0x2c')]));if(_0x4703f7[_0xcc11('0x2b')][_0xcc11('0x34')]){_0xd241a5[_0xcc11('0x33')]=_[_0xcc11('0x37')](_0xd241a5[_0xcc11('0x33')],{'$or':_[_0xcc11('0x27')](_0xd241a5['attributes'],function(_0x229af9){var _0x589950={};_0x589950[_0x229af9]={'$like':'%'+_0x4703f7[_0xcc11('0x2b')][_0xcc11('0x34')]+'%'};return _0x589950;})});}_0xd241a5=_[_0xcc11('0x37')]({},_0xd241a5,_0x4703f7[_0xcc11('0x49')]);return _0x4ea42a[_0xcc11('0x45')](_0xd241a5);}})['then'](function(_0x407f3f){if(_0x407f3f){_0x3dca94=_0x407f3f[_0xcc11('0x41')];if(!_0x4703f7[_0xcc11('0x2b')][_0xcc11('0x30')](_0xcc11('0x4a'))){_0xd241a5[_0xcc11('0x1b')]=qs['limit'](_0x4703f7['query'][_0xcc11('0x1b')]);_0xd241a5['offset']=qs[_0xcc11('0x1a')](_0x4703f7[_0xcc11('0x2b')][_0xcc11('0x1a')]);}return _0x4ea42a['getFields'](_0xd241a5);}})[_0xcc11('0x21')](function(_0x499291){if(_0x499291){return _0x499291?{'count':_0x3dca94,'rows':_0x499291}:null;}})[_0xcc11('0x21')](respondWithResult(_0x8e4a4d,null))[_0xcc11('0x3c')](handleError(_0x8e4a4d,null));};exports[_0xcc11('0x4b')]=function(_0x50c659,_0x20fbb2,_0x2051a6){var _0x2f958a={};var _0x6ea33d={};var _0x4e2684;var _0x1e8129;return db[_0xcc11('0x28')][_0xcc11('0x46')]({'where':{'id':_0x50c659['params']['id']}})[_0xcc11('0x21')](handleEntityNotFound(_0x20fbb2,null))[_0xcc11('0x21')](function(_0x29fde5){if(_0x29fde5){_0x4e2684=_0x29fde5;_0x6ea33d[_0xcc11('0x2a')]=_[_0xcc11('0x3f')](db[_0xcc11('0x47')][_0xcc11('0x40')]);_0x6ea33d[_0xcc11('0x2b')]=_[_0xcc11('0x3f')](_0x50c659['query']);_0x6ea33d['filters']=_['intersection'](_0x6ea33d[_0xcc11('0x2a')],_0x6ea33d[_0xcc11('0x2b')]);_0x2f958a[_0xcc11('0x2e')]=_[_0xcc11('0x2d')](_0x6ea33d['model'],qs[_0xcc11('0x2f')](_0x50c659[_0xcc11('0x2b')][_0xcc11('0x2f')]));_0x2f958a[_0xcc11('0x2e')]=_0x2f958a[_0xcc11('0x2e')][_0xcc11('0x41')]?_0x2f958a[_0xcc11('0x2e')]:_0x6ea33d['model'];_0x2f958a['order']=qs[_0xcc11('0x32')](_0x50c659['query'][_0xcc11('0x32')]);_0x2f958a[_0xcc11('0x33')]=qs['filters'](_['pick'](_0x50c659[_0xcc11('0x2b')],_0x6ea33d[_0xcc11('0x2c')]));if(_0x50c659['query']['filter']){_0x2f958a[_0xcc11('0x33')]=_[_0xcc11('0x37')](_0x2f958a['where'],{'$or':_[_0xcc11('0x27')](_0x2f958a[_0xcc11('0x2e')],function(_0x43ffab){var _0x24184a={};_0x24184a[_0x43ffab]={'$like':'%'+_0x50c659[_0xcc11('0x2b')][_0xcc11('0x34')]+'%'};return _0x24184a;})});}_0x2f958a=_[_0xcc11('0x37')]({},_0x2f958a,_0x50c659[_0xcc11('0x49')]);return _0x4e2684['getSubjects'](_0x2f958a);}})[_0xcc11('0x21')](function(_0x52468a){if(_0x52468a){_0x1e8129=_0x52468a[_0xcc11('0x41')];if(!_0x50c659[_0xcc11('0x2b')]['hasOwnProperty'](_0xcc11('0x4a'))){_0x2f958a['limit']=qs['limit'](_0x50c659[_0xcc11('0x2b')]['limit']);_0x2f958a[_0xcc11('0x1a')]=qs[_0xcc11('0x1a')](_0x50c659['query'][_0xcc11('0x1a')]);}return _0x4e2684[_0xcc11('0x4b')](_0x2f958a);}})[_0xcc11('0x21')](function(_0x51a9f8){if(_0x51a9f8){return _0x51a9f8?{'count':_0x1e8129,'rows':_0x51a9f8}:null;}})[_0xcc11('0x21')](respondWithResult(_0x20fbb2,null))[_0xcc11('0x3c')](handleError(_0x20fbb2,null));};exports[_0xcc11('0x4c')]=function(_0x20bfea,_0x5eb69b,_0x33bc43){var _0x710229={};var _0x538273={};var _0x3d1a88;var _0x1a6fd4;return db['ZohoConfiguration'][_0xcc11('0x46')]({'where':{'id':_0x20bfea['params']['id']}})[_0xcc11('0x21')](handleEntityNotFound(_0x5eb69b,null))[_0xcc11('0x21')](function(_0x2ba5d5){if(_0x2ba5d5){_0x3d1a88=_0x2ba5d5;_0x538273[_0xcc11('0x2a')]=_[_0xcc11('0x3f')](db[_0xcc11('0x47')][_0xcc11('0x40')]);_0x538273[_0xcc11('0x2b')]=_[_0xcc11('0x3f')](_0x20bfea['query']);_0x538273[_0xcc11('0x2c')]=_['intersection'](_0x538273[_0xcc11('0x2a')],_0x538273[_0xcc11('0x2b')]);_0x710229['attributes']=_[_0xcc11('0x2d')](_0x538273['model'],qs[_0xcc11('0x2f')](_0x20bfea['query']['fields']));_0x710229[_0xcc11('0x2e')]=_0x710229[_0xcc11('0x2e')][_0xcc11('0x41')]?_0x710229['attributes']:_0x538273['model'];_0x710229[_0xcc11('0x31')]=qs[_0xcc11('0x32')](_0x20bfea['query']['sort']);_0x710229['where']=qs[_0xcc11('0x2c')](_[_0xcc11('0x48')](_0x20bfea[_0xcc11('0x2b')],_0x538273[_0xcc11('0x2c')]));if(_0x20bfea[_0xcc11('0x2b')]['filter']){_0x710229[_0xcc11('0x33')]=_[_0xcc11('0x37')](_0x710229[_0xcc11('0x33')],{'$or':_['map'](_0x710229[_0xcc11('0x2e')],function(_0x1747c3){var _0x135a49={};_0x135a49[_0x1747c3]={'$like':'%'+_0x20bfea[_0xcc11('0x2b')][_0xcc11('0x34')]+'%'};return _0x135a49;})});}_0x710229=_[_0xcc11('0x37')]({},_0x710229,_0x20bfea[_0xcc11('0x49')]);return _0x3d1a88[_0xcc11('0x4c')](_0x710229);}})['then'](function(_0x218edc){if(_0x218edc){_0x1a6fd4=_0x218edc[_0xcc11('0x41')];if(!_0x20bfea[_0xcc11('0x2b')][_0xcc11('0x30')](_0xcc11('0x4a'))){_0x710229[_0xcc11('0x1b')]=qs['limit'](_0x20bfea['query'][_0xcc11('0x1b')]);_0x710229['offset']=qs[_0xcc11('0x1a')](_0x20bfea[_0xcc11('0x2b')]['offset']);}return _0x3d1a88[_0xcc11('0x4c')](_0x710229);}})[_0xcc11('0x21')](function(_0x34c70a){if(_0x34c70a){return _0x34c70a?{'count':_0x1a6fd4,'rows':_0x34c70a}:null;}})['then'](respondWithResult(_0x5eb69b,null))[_0xcc11('0x3c')](handleError(_0x5eb69b,null));}; \ No newline at end of file +var _0x0749=['destroy','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ZohoField','sort','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0749,0x7d));var _0x9074=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0749[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9074('0x0'));var zipdir=require(_0x9074('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9074('0x2'));var moment=require(_0x9074('0x3'));var BPromise=require(_0x9074('0x4'));var Mustache=require(_0x9074('0x5'));var util=require('util');var path=require(_0x9074('0x6'));var sox=require(_0x9074('0x7'));var csv=require(_0x9074('0x8'));var ejs=require(_0x9074('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9074('0xa'));var squel=require('squel');var crypto=require(_0x9074('0xb'));var jsforce=require(_0x9074('0xc'));var deskjs=require(_0x9074('0xd'));var toCsv=require(_0x9074('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9074('0xe'));var authService=require(_0x9074('0xf'));var qs=require(_0x9074('0x10'));var as=require(_0x9074('0x11'));var hardwareService=require(_0x9074('0x12'));var logger=require('../../config/logger')(_0x9074('0x13'));var utils=require(_0x9074('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9074('0x15'));var db=require(_0x9074('0x16'))['db'];function respondWithStatusCode(_0x14532d,_0x9a78ee){_0x9a78ee=_0x9a78ee||0xcc;return function(_0x32eb7f){if(_0x32eb7f){return _0x14532d[_0x9074('0x17')](_0x9a78ee);}return _0x14532d['status'](_0x9a78ee)[_0x9074('0x18')]();};}function respondWithResult(_0x38a55f,_0x19e4dc){_0x19e4dc=_0x19e4dc||0xc8;return function(_0x571dc6){if(_0x571dc6){return _0x38a55f[_0x9074('0x19')](_0x19e4dc)['json'](_0x571dc6);}};}function respondWithFilteredResult(_0x7530a0,_0x2bde92){return function(_0x2843a6){if(_0x2843a6){var _0x2901a4=typeof _0x2bde92['offset']===_0x9074('0x1a')&&typeof _0x2bde92[_0x9074('0x1b')]===_0x9074('0x1a');var _0x365375=_0x2843a6[_0x9074('0x1c')];var _0x3e8ac8=_0x2901a4?0x0:_0x2bde92[_0x9074('0x1d')];var _0x22911e=_0x2901a4?_0x2843a6[_0x9074('0x1c')]:_0x2bde92[_0x9074('0x1d')]+_0x2bde92[_0x9074('0x1b')];var _0x479648;if(_0x22911e>=_0x365375){_0x22911e=_0x365375;_0x479648=0xc8;}else{_0x479648=0xce;}_0x7530a0[_0x9074('0x19')](_0x479648);return _0x7530a0[_0x9074('0x1e')](_0x9074('0x1f'),_0x3e8ac8+'-'+_0x22911e+'/'+_0x365375)['json'](_0x2843a6);}return null;};}function patchUpdates(_0x263cf6){return function(_0x4c2e6a){try{jsonpatch[_0x9074('0x20')](_0x4c2e6a,_0x263cf6,!![]);}catch(_0xd75fcf){return BPromise[_0x9074('0x21')](_0xd75fcf);}return _0x4c2e6a[_0x9074('0x22')]();};}function saveUpdates(_0x28e33a,_0x3d1093){return function(_0x4b9473){if(_0x4b9473){return _0x4b9473[_0x9074('0x23')](_0x28e33a)[_0x9074('0x24')](function(_0x259849){return _0x259849;});}return null;};}function removeEntity(_0x4dd0d9,_0x810c84){return function(_0x143075){if(_0x143075){return _0x143075[_0x9074('0x25')]()[_0x9074('0x24')](function(){_0x4dd0d9[_0x9074('0x19')](0xcc)[_0x9074('0x18')]();});}};}function handleEntityNotFound(_0x4191cd,_0x184a46){return function(_0x59aea){if(!_0x59aea){_0x4191cd[_0x9074('0x17')](0x194);}return _0x59aea;};}function handleError(_0x4cccfe,_0x4a9a63){_0x4a9a63=_0x4a9a63||0x1f4;return function(_0x49fa1f){logger[_0x9074('0x26')](_0x49fa1f['stack']);if(_0x49fa1f[_0x9074('0x27')]){delete _0x49fa1f[_0x9074('0x27')];}_0x4cccfe[_0x9074('0x19')](_0x4a9a63)[_0x9074('0x28')](_0x49fa1f);};}exports[_0x9074('0x29')]=function(_0x3d9b9a,_0x9a5161){var _0x2db0c6={},_0x176bf6={},_0x486b6c={'count':0x0,'rows':[]};var _0x375f60=_[_0x9074('0x2a')](db[_0x9074('0x2b')][_0x9074('0x2c')],function(_0xd13811){return{'name':_0xd13811[_0x9074('0x2d')],'type':_0xd13811[_0x9074('0x2e')][_0x9074('0x2f')]};});_0x176bf6[_0x9074('0x30')]=_[_0x9074('0x2a')](_0x375f60,_0x9074('0x27'));_0x176bf6[_0x9074('0x31')]=_[_0x9074('0x32')](_0x3d9b9a[_0x9074('0x31')]);_0x176bf6['filters']=_[_0x9074('0x33')](_0x176bf6[_0x9074('0x30')],_0x176bf6[_0x9074('0x31')]);_0x2db0c6[_0x9074('0x34')]=_[_0x9074('0x33')](_0x176bf6[_0x9074('0x30')],qs[_0x9074('0x35')](_0x3d9b9a[_0x9074('0x31')][_0x9074('0x35')]));_0x2db0c6[_0x9074('0x34')]=_0x2db0c6['attributes'][_0x9074('0x36')]?_0x2db0c6[_0x9074('0x34')]:_0x176bf6['model'];if(!_0x3d9b9a[_0x9074('0x31')][_0x9074('0x37')](_0x9074('0x38'))){_0x2db0c6[_0x9074('0x1b')]=qs[_0x9074('0x1b')](_0x3d9b9a[_0x9074('0x31')]['limit']);_0x2db0c6['offset']=qs[_0x9074('0x1d')](_0x3d9b9a[_0x9074('0x31')][_0x9074('0x1d')]);}_0x2db0c6[_0x9074('0x39')]=qs['sort'](_0x3d9b9a[_0x9074('0x31')]['sort']);_0x2db0c6[_0x9074('0x3a')]=qs[_0x9074('0x3b')](_[_0x9074('0x3c')](_0x3d9b9a['query'],_0x176bf6[_0x9074('0x3b')]),_0x375f60);if(_0x3d9b9a[_0x9074('0x31')][_0x9074('0x3d')]){_0x2db0c6[_0x9074('0x3a')]=_[_0x9074('0x3e')](_0x2db0c6[_0x9074('0x3a')],{'$or':_[_0x9074('0x2a')](_0x375f60,function(_0xf816f){if(_0xf816f['type']!==_0x9074('0x3f')){var _0x957fe9={};_0x957fe9[_0xf816f[_0x9074('0x27')]]={'$like':'%'+_0x3d9b9a[_0x9074('0x31')][_0x9074('0x3d')]+'%'};return _0x957fe9;}})});}_0x2db0c6=_['merge']({},_0x2db0c6,_0x3d9b9a[_0x9074('0x40')]);var _0x206096={'where':_0x2db0c6[_0x9074('0x3a')]};return db['ZohoConfiguration']['count'](_0x206096)[_0x9074('0x24')](function(_0x11b25a){_0x486b6c['count']=_0x11b25a;if(_0x3d9b9a['query'][_0x9074('0x41')]){_0x2db0c6[_0x9074('0x42')]=[{'all':!![]}];}return db[_0x9074('0x2b')][_0x9074('0x43')](_0x2db0c6);})[_0x9074('0x24')](function(_0x2fa209){_0x486b6c[_0x9074('0x44')]=_0x2fa209;return _0x486b6c;})[_0x9074('0x24')](respondWithFilteredResult(_0x9a5161,_0x2db0c6))[_0x9074('0x45')](handleError(_0x9a5161,null));};exports[_0x9074('0x46')]=function(_0x12d693,_0xb76426){var _0xb97324={'raw':![],'where':{'id':_0x12d693[_0x9074('0x47')]['id']}},_0x2de1b1={};_0x2de1b1['model']=_[_0x9074('0x32')](db[_0x9074('0x2b')][_0x9074('0x2c')]);_0x2de1b1[_0x9074('0x31')]=_['keys'](_0x12d693[_0x9074('0x31')]);_0x2de1b1[_0x9074('0x3b')]=_['intersection'](_0x2de1b1[_0x9074('0x30')],_0x2de1b1['query']);_0xb97324[_0x9074('0x34')]=_[_0x9074('0x33')](_0x2de1b1['model'],qs[_0x9074('0x35')](_0x12d693[_0x9074('0x31')][_0x9074('0x35')]));_0xb97324[_0x9074('0x34')]=_0xb97324['attributes'][_0x9074('0x36')]?_0xb97324[_0x9074('0x34')]:_0x2de1b1[_0x9074('0x30')];if(_0x12d693[_0x9074('0x31')][_0x9074('0x41')]){_0xb97324[_0x9074('0x42')]=[{'all':!![]}];}_0xb97324=_[_0x9074('0x3e')]({},_0xb97324,_0x12d693[_0x9074('0x40')]);return db[_0x9074('0x2b')][_0x9074('0x48')](_0xb97324)[_0x9074('0x24')](handleEntityNotFound(_0xb76426,null))[_0x9074('0x24')](respondWithResult(_0xb76426,null))[_0x9074('0x45')](handleError(_0xb76426,null));};exports[_0x9074('0x49')]=function(_0x4f2dfd,_0x19c54b){return db[_0x9074('0x2b')]['create'](_0x4f2dfd['body'],{})[_0x9074('0x24')](respondWithResult(_0x19c54b,0xc9))[_0x9074('0x45')](handleError(_0x19c54b,null));};exports[_0x9074('0x23')]=function(_0x1196d7,_0x5e8203){if(_0x1196d7[_0x9074('0x4a')]['id']){delete _0x1196d7[_0x9074('0x4a')]['id'];}return db[_0x9074('0x2b')][_0x9074('0x48')]({'where':{'id':_0x1196d7[_0x9074('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e8203,null))[_0x9074('0x24')](saveUpdates(_0x1196d7[_0x9074('0x4a')],null))[_0x9074('0x24')](respondWithResult(_0x5e8203,null))[_0x9074('0x45')](handleError(_0x5e8203,null));};exports[_0x9074('0x25')]=function(_0x259a09,_0x56a9b8){return db['ZohoConfiguration'][_0x9074('0x48')]({'where':{'id':_0x259a09[_0x9074('0x47')]['id']}})[_0x9074('0x24')](handleEntityNotFound(_0x56a9b8,null))[_0x9074('0x24')](removeEntity(_0x56a9b8,null))[_0x9074('0x45')](handleError(_0x56a9b8,null));};exports[_0x9074('0x4b')]=function(_0x457927,_0x3784cc,_0x4e3f20){var _0x5d4021={};var _0x520722={};var _0x3f14de;var _0x3eb282;return db[_0x9074('0x2b')][_0x9074('0x4c')]({'where':{'id':_0x457927[_0x9074('0x47')]['id']}})[_0x9074('0x24')](handleEntityNotFound(_0x3784cc,null))[_0x9074('0x24')](function(_0x280061){if(_0x280061){_0x3f14de=_0x280061;_0x520722['model']=_['keys'](db[_0x9074('0x4d')][_0x9074('0x2c')]);_0x520722[_0x9074('0x31')]=_[_0x9074('0x32')](_0x457927[_0x9074('0x31')]);_0x520722[_0x9074('0x3b')]=_[_0x9074('0x33')](_0x520722[_0x9074('0x30')],_0x520722['query']);_0x5d4021[_0x9074('0x34')]=_['intersection'](_0x520722[_0x9074('0x30')],qs[_0x9074('0x35')](_0x457927[_0x9074('0x31')]['fields']));_0x5d4021[_0x9074('0x34')]=_0x5d4021['attributes']['length']?_0x5d4021['attributes']:_0x520722[_0x9074('0x30')];_0x5d4021[_0x9074('0x39')]=qs[_0x9074('0x4e')](_0x457927['query']['sort']);_0x5d4021['where']=qs[_0x9074('0x3b')](_[_0x9074('0x3c')](_0x457927[_0x9074('0x31')],_0x520722[_0x9074('0x3b')]));if(_0x457927[_0x9074('0x31')][_0x9074('0x3d')]){_0x5d4021[_0x9074('0x3a')]=_[_0x9074('0x3e')](_0x5d4021[_0x9074('0x3a')],{'$or':_[_0x9074('0x2a')](_0x5d4021[_0x9074('0x34')],function(_0x148882){var _0x3e3224={};_0x3e3224[_0x148882]={'$like':'%'+_0x457927[_0x9074('0x31')][_0x9074('0x3d')]+'%'};return _0x3e3224;})});}_0x5d4021=_[_0x9074('0x3e')]({},_0x5d4021,_0x457927[_0x9074('0x40')]);return _0x3f14de['getFields'](_0x5d4021);}})[_0x9074('0x24')](function(_0x2cd4b0){if(_0x2cd4b0){_0x3eb282=_0x2cd4b0[_0x9074('0x36')];if(!_0x457927['query'][_0x9074('0x37')](_0x9074('0x38'))){_0x5d4021[_0x9074('0x1b')]=qs['limit'](_0x457927[_0x9074('0x31')][_0x9074('0x1b')]);_0x5d4021[_0x9074('0x1d')]=qs[_0x9074('0x1d')](_0x457927['query'][_0x9074('0x1d')]);}return _0x3f14de['getFields'](_0x5d4021);}})[_0x9074('0x24')](function(_0x55b400){if(_0x55b400){return _0x55b400?{'count':_0x3eb282,'rows':_0x55b400}:null;}})[_0x9074('0x24')](respondWithResult(_0x3784cc,null))[_0x9074('0x45')](handleError(_0x3784cc,null));};exports['getSubjects']=function(_0x528ceb,_0x2c3c37,_0x4e91b7){var _0x47a495={};var _0xd1660c={};var _0x15fa9f;var _0x3b7a94;return db[_0x9074('0x2b')][_0x9074('0x4c')]({'where':{'id':_0x528ceb['params']['id']}})['then'](handleEntityNotFound(_0x2c3c37,null))[_0x9074('0x24')](function(_0x5d2442){if(_0x5d2442){_0x15fa9f=_0x5d2442;_0xd1660c[_0x9074('0x30')]=_[_0x9074('0x32')](db[_0x9074('0x4d')][_0x9074('0x2c')]);_0xd1660c[_0x9074('0x31')]=_[_0x9074('0x32')](_0x528ceb[_0x9074('0x31')]);_0xd1660c[_0x9074('0x3b')]=_[_0x9074('0x33')](_0xd1660c[_0x9074('0x30')],_0xd1660c['query']);_0x47a495[_0x9074('0x34')]=_[_0x9074('0x33')](_0xd1660c[_0x9074('0x30')],qs['fields'](_0x528ceb[_0x9074('0x31')]['fields']));_0x47a495[_0x9074('0x34')]=_0x47a495[_0x9074('0x34')][_0x9074('0x36')]?_0x47a495[_0x9074('0x34')]:_0xd1660c[_0x9074('0x30')];_0x47a495[_0x9074('0x39')]=qs[_0x9074('0x4e')](_0x528ceb['query']['sort']);_0x47a495[_0x9074('0x3a')]=qs[_0x9074('0x3b')](_[_0x9074('0x3c')](_0x528ceb[_0x9074('0x31')],_0xd1660c[_0x9074('0x3b')]));if(_0x528ceb[_0x9074('0x31')][_0x9074('0x3d')]){_0x47a495[_0x9074('0x3a')]=_[_0x9074('0x3e')](_0x47a495[_0x9074('0x3a')],{'$or':_[_0x9074('0x2a')](_0x47a495[_0x9074('0x34')],function(_0x1523d1){var _0x3ae924={};_0x3ae924[_0x1523d1]={'$like':'%'+_0x528ceb[_0x9074('0x31')][_0x9074('0x3d')]+'%'};return _0x3ae924;})});}_0x47a495=_['merge']({},_0x47a495,_0x528ceb[_0x9074('0x40')]);return _0x15fa9f[_0x9074('0x4f')](_0x47a495);}})[_0x9074('0x24')](function(_0x2b9aa0){if(_0x2b9aa0){_0x3b7a94=_0x2b9aa0[_0x9074('0x36')];if(!_0x528ceb[_0x9074('0x31')][_0x9074('0x37')](_0x9074('0x38'))){_0x47a495[_0x9074('0x1b')]=qs[_0x9074('0x1b')](_0x528ceb[_0x9074('0x31')][_0x9074('0x1b')]);_0x47a495[_0x9074('0x1d')]=qs[_0x9074('0x1d')](_0x528ceb[_0x9074('0x31')][_0x9074('0x1d')]);}return _0x15fa9f[_0x9074('0x4f')](_0x47a495);}})[_0x9074('0x24')](function(_0x37821d){if(_0x37821d){return _0x37821d?{'count':_0x3b7a94,'rows':_0x37821d}:null;}})['then'](respondWithResult(_0x2c3c37,null))['catch'](handleError(_0x2c3c37,null));};exports[_0x9074('0x50')]=function(_0x1419dc,_0xee0640,_0x1e9879){var _0x5bf9f4={};var _0x2aef28={};var _0x416205;var _0x12a84b;return db['ZohoConfiguration'][_0x9074('0x4c')]({'where':{'id':_0x1419dc[_0x9074('0x47')]['id']}})['then'](handleEntityNotFound(_0xee0640,null))[_0x9074('0x24')](function(_0x4c1c01){if(_0x4c1c01){_0x416205=_0x4c1c01;_0x2aef28['model']=_[_0x9074('0x32')](db['ZohoField'][_0x9074('0x2c')]);_0x2aef28[_0x9074('0x31')]=_['keys'](_0x1419dc['query']);_0x2aef28['filters']=_[_0x9074('0x33')](_0x2aef28[_0x9074('0x30')],_0x2aef28[_0x9074('0x31')]);_0x5bf9f4['attributes']=_[_0x9074('0x33')](_0x2aef28['model'],qs[_0x9074('0x35')](_0x1419dc[_0x9074('0x31')][_0x9074('0x35')]));_0x5bf9f4['attributes']=_0x5bf9f4[_0x9074('0x34')][_0x9074('0x36')]?_0x5bf9f4['attributes']:_0x2aef28[_0x9074('0x30')];_0x5bf9f4[_0x9074('0x39')]=qs[_0x9074('0x4e')](_0x1419dc[_0x9074('0x31')][_0x9074('0x4e')]);_0x5bf9f4['where']=qs[_0x9074('0x3b')](_[_0x9074('0x3c')](_0x1419dc[_0x9074('0x31')],_0x2aef28['filters']));if(_0x1419dc[_0x9074('0x31')][_0x9074('0x3d')]){_0x5bf9f4[_0x9074('0x3a')]=_[_0x9074('0x3e')](_0x5bf9f4[_0x9074('0x3a')],{'$or':_[_0x9074('0x2a')](_0x5bf9f4['attributes'],function(_0x1d5074){var _0x1e83c3={};_0x1e83c3[_0x1d5074]={'$like':'%'+_0x1419dc[_0x9074('0x31')][_0x9074('0x3d')]+'%'};return _0x1e83c3;})});}_0x5bf9f4=_['merge']({},_0x5bf9f4,_0x1419dc[_0x9074('0x40')]);return _0x416205[_0x9074('0x50')](_0x5bf9f4);}})['then'](function(_0x1110d9){if(_0x1110d9){_0x12a84b=_0x1110d9['length'];if(!_0x1419dc['query'][_0x9074('0x37')]('nolimit')){_0x5bf9f4['limit']=qs[_0x9074('0x1b')](_0x1419dc['query'][_0x9074('0x1b')]);_0x5bf9f4['offset']=qs['offset'](_0x1419dc[_0x9074('0x31')]['offset']);}return _0x416205[_0x9074('0x50')](_0x5bf9f4);}})[_0x9074('0x24')](function(_0x518e6a){if(_0x518e6a){return _0x518e6a?{'count':_0x12a84b,'rows':_0x518e6a}:null;}})[_0x9074('0x24')](respondWithResult(_0xee0640,null))['catch'](handleError(_0xee0640,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8869d0a..5b97f40 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 _0x334d=['./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x47d3bd,_0x3cadba){var _0xefba50=function(_0x15565c){while(--_0x15565c){_0x47d3bd['push'](_0x47d3bd['shift']());}};_0xefba50(++_0x3cadba);}(_0x334d,0x12e));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd334('0x0'));var util=require(_0xd334('0x1'));var logger=require(_0xd334('0x2'))(_0xd334('0x3'));var moment=require(_0xd334('0x4'));var BPromise=require(_0xd334('0x5'));var rp=require(_0xd334('0x6'));var fs=require('fs');var path=require(_0xd334('0x7'));var rimraf=require(_0xd334('0x8'));var config=require(_0xd334('0x9'));var attributes=require(_0xd334('0xa'));module['exports']=function(_0x7ba16f,_0x2a941d){return _0x7ba16f[_0xd334('0xb')](_0xd334('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0081=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x0081,0x6c));var _0x1008=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0081[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x1008('0x0'));var util=require(_0x1008('0x1'));var logger=require(_0x1008('0x2'))(_0x1008('0x3'));var moment=require(_0x1008('0x4'));var BPromise=require(_0x1008('0x5'));var rp=require(_0x1008('0x6'));var fs=require('fs');var path=require(_0x1008('0x7'));var rimraf=require(_0x1008('0x8'));var config=require(_0x1008('0x9'));var attributes=require(_0x1008('0xa'));module[_0x1008('0xb')]=function(_0x14912a,_0x461d5b){return _0x14912a[_0x1008('0xc')](_0x1008('0xd'),attributes,{'tableName':_0x1008('0xe'),'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 134e16a..2a4cac8 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 _0x6a76=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x35ee30,_0x54da97){var _0x2bda98=function(_0x5ed1a1){while(--_0x5ed1a1){_0x35ee30['push'](_0x35ee30['shift']());}};_0x2bda98(++_0x54da97);}(_0x6a76,0x1a6));var _0x66a7=function(_0x3068c8,_0x1f5504){_0x3068c8=_0x3068c8-0x0;var _0x40c6e4=_0x6a76[_0x3068c8];return _0x40c6e4;};'use strict';var _=require(_0x66a7('0x0'));var util=require(_0x66a7('0x1'));var moment=require(_0x66a7('0x2'));var BPromise=require(_0x66a7('0x3'));var rs=require(_0x66a7('0x4'));var fs=require('fs');var Redis=require(_0x66a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x66a7('0x6'));var logger=require('../../config/logger')(_0x66a7('0x7'));var config=require(_0x66a7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14ed70,_0x4c1ee2,_0x291773){return new BPromise(function(_0xb9f3bf,_0x23979b){return client[_0x66a7('0xa')](_0x14ed70,_0x291773)[_0x66a7('0xb')](function(_0x5a8dc8){logger[_0x66a7('0xc')](_0x66a7('0xd'),_0x4c1ee2,_0x66a7('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4c1ee2,_0x66a7('0xe'),JSON[_0x66a7('0xf')](_0x5a8dc8));if(_0x5a8dc8['error']){if(_0x5a8dc8[_0x66a7('0x10')][_0x66a7('0x11')]===0x1f4){logger[_0x66a7('0x10')](_0x66a7('0xd'),_0x4c1ee2,_0x5a8dc8[_0x66a7('0x10')][_0x66a7('0x12')]);return _0x23979b(_0x5a8dc8[_0x66a7('0x10')]['message']);}logger[_0x66a7('0x10')](_0x66a7('0xd'),_0x4c1ee2,_0x5a8dc8[_0x66a7('0x10')][_0x66a7('0x12')]);return _0xb9f3bf(_0x5a8dc8[_0x66a7('0x10')]['message']);}else{logger[_0x66a7('0xc')](_0x66a7('0xd'),_0x4c1ee2,_0x66a7('0xe'));_0xb9f3bf(_0x5a8dc8['result'][_0x66a7('0x12')]);}})[_0x66a7('0x13')](function(_0x56f064){logger[_0x66a7('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4c1ee2,_0x56f064);_0x23979b(_0x56f064);});});} \ No newline at end of file +var _0xce5b=['../../config/environment','jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce5b,0x182));var _0xbce5=function(_0x290149,_0x1d6fbc){_0x290149=_0x290149-0x0;var _0x1a781b=_0xce5b[_0x290149];return _0x1a781b;};'use strict';var _=require(_0xbce5('0x0'));var util=require(_0xbce5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbce5('0x2'))['db'];var utils=require(_0xbce5('0x3'));var logger=require('../../config/logger')(_0xbce5('0x4'));var config=require(_0xbce5('0x5'));var jayson=require(_0xbce5('0x6'));var client=jayson[_0xbce5('0x7')][_0xbce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20a541,_0x37709c,_0x47418a){return new BPromise(function(_0x2a7d95,_0x521be5){return client['request'](_0x20a541,_0x47418a)['then'](function(_0x5911a8){logger[_0xbce5('0x9')](_0xbce5('0xa'),_0x37709c,_0xbce5('0xb'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x37709c,_0xbce5('0xb'),JSON[_0xbce5('0xc')](_0x5911a8));if(_0x5911a8['error']){if(_0x5911a8[_0xbce5('0xd')][_0xbce5('0xe')]===0x1f4){logger[_0xbce5('0xd')](_0xbce5('0xa'),_0x37709c,_0x5911a8[_0xbce5('0xd')][_0xbce5('0xf')]);return _0x521be5(_0x5911a8[_0xbce5('0xd')][_0xbce5('0xf')]);}logger[_0xbce5('0xd')](_0xbce5('0xa'),_0x37709c,_0x5911a8[_0xbce5('0xd')][_0xbce5('0xf')]);return _0x2a7d95(_0x5911a8['error'][_0xbce5('0xf')]);}else{logger[_0xbce5('0x9')](_0xbce5('0xa'),_0x37709c,_0xbce5('0xb'));_0x2a7d95(_0x5911a8[_0xbce5('0x10')][_0xbce5('0xf')]);}})['catch'](function(_0x47694e){logger['error'](_0xbce5('0xa'),_0x37709c,_0x47694e);_0x521be5(_0x47694e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d68c239..c215b25 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 _0x031d=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','index','/:id','show','post','isAuthenticated','put','update','destroy','multer','util','connect-timeout','Router'];(function(_0x2e9f03,_0x1b42d4){var _0x5d62a2=function(_0x36e299){while(--_0x36e299){_0x2e9f03['push'](_0x2e9f03['shift']());}};_0x5d62a2(++_0x1b42d4);}(_0x031d,0x11c));var _0xd031=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x031d[_0x479160];return _0x47ac6d;};'use strict';var multer=require(_0xd031('0x0'));var util=require(_0xd031('0x1'));var path=require('path');var timeout=require(_0xd031('0x2'));var express=require('express');var router=express[_0xd031('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd031('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd031('0x5'));var controller=require(_0xd031('0x6'));router[_0xd031('0x7')]('/',auth['isAuthenticated'](),controller[_0xd031('0x8')]);router[_0xd031('0x7')](_0xd031('0x9'),auth['isAuthenticated'](),controller[_0xd031('0xa')]);router[_0xd031('0xb')]('/',auth[_0xd031('0xc')](),controller['create']);router[_0xd031('0xd')]('/:id',auth[_0xd031('0xc')](),controller[_0xd031('0xe')]);router['delete'](_0xd031('0x9'),auth['isAuthenticated'](),controller[_0xd031('0xf')]);module['exports']=router; \ No newline at end of file +var _0x845c=['create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x5c7fb3,_0xe27c4e){var _0x1e59fe=function(_0x421b2a){while(--_0x421b2a){_0x5c7fb3['push'](_0x5c7fb3['shift']());}};_0x1e59fe(++_0xe27c4e);}(_0x845c,0xa7));var _0xc845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x845c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc845('0x0'));var util=require(_0xc845('0x1'));var path=require(_0xc845('0x2'));var timeout=require('connect-timeout');var express=require(_0xc845('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc845('0x4'));var interaction=require(_0xc845('0x5'));var config=require(_0xc845('0x6'));var controller=require(_0xc845('0x7'));router['get']('/',auth[_0xc845('0x8')](),controller['index']);router[_0xc845('0x9')](_0xc845('0xa'),auth[_0xc845('0x8')](),controller[_0xc845('0xb')]);router[_0xc845('0xc')]('/',auth[_0xc845('0x8')](),controller[_0xc845('0xd')]);router[_0xc845('0xe')](_0xc845('0xa'),auth['isAuthenticated'](),controller[_0xc845('0xf')]);router['delete'](_0xc845('0xa'),auth[_0xc845('0x8')](),controller[_0xc845('0x10')]);module[_0xc845('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a52381d..c77c65c 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 _0xc4e3=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x48f5e7,_0x58962d){var _0x57406b=function(_0x2f260c){while(--_0x2f260c){_0x48f5e7['push'](_0x48f5e7['shift']());}};_0x57406b(++_0x58962d);}(_0xc4e3,0x186));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c4e('0x0'));module[_0x3c4e('0x1')]={'type':{'type':Sequelize[_0x3c4e('0x2')](_0x3c4e('0x3'),_0x3c4e('0x4'),_0x3c4e('0x5'),_0x3c4e('0x6'),_0x3c4e('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3c4e('0x8')]},'key':{'type':Sequelize[_0x3c4e('0x8')]},'keyType':{'type':Sequelize[_0x3c4e('0x2')]('string',_0x3c4e('0x4'),_0x3c4e('0x5'))},'keyContent':{'type':Sequelize[_0x3c4e('0x8')]},'idField':{'type':Sequelize[_0x3c4e('0x8')]},'nameField':{'type':Sequelize[_0x3c4e('0x8')]},'customField':{'type':Sequelize[_0x3c4e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c4e('0x8')]}}; \ No newline at end of file +var _0xe9b3=['exports','customVariable','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x44164d,_0x53e829){var _0x521174=function(_0x401297){while(--_0x401297){_0x44164d['push'](_0x44164d['shift']());}};_0x521174(++_0x53e829);}(_0xe9b3,0x1af));var _0x3e9b=function(_0x27dcbe,_0x5a0349){_0x27dcbe=_0x27dcbe-0x0;var _0x5a5d8b=_0xe9b3[_0x27dcbe];return _0x5a5d8b;};'use strict';var Sequelize=require(_0x3e9b('0x0'));module[_0x3e9b('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x3e9b('0x2'),'keyValue',_0x3e9b('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3e9b('0x4')]},'keyType':{'type':Sequelize[_0x3e9b('0x5')]('string',_0x3e9b('0x6'),_0x3e9b('0x2'))},'keyContent':{'type':Sequelize[_0x3e9b('0x4')]},'idField':{'type':Sequelize[_0x3e9b('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3e9b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e9b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index edf76a1..76c4edc 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 _0x9d01=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','save','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x11b232,_0x243189){var _0x5f5866=function(_0x2d8541){while(--_0x2d8541){_0x11b232['push'](_0x11b232['shift']());}};_0x5f5866(++_0x243189);}(_0x9d01,0x1ec));var _0x19d0=function(_0x305551,_0x868339){_0x305551=_0x305551-0x0;var _0x115ce2=_0x9d01[_0x305551];return _0x115ce2;};'use strict';var emlformat=require(_0x19d0('0x0'));var rimraf=require(_0x19d0('0x1'));var zipdir=require(_0x19d0('0x2'));var jsonpatch=require(_0x19d0('0x3'));var rp=require(_0x19d0('0x4'));var moment=require(_0x19d0('0x5'));var BPromise=require(_0x19d0('0x6'));var Mustache=require(_0x19d0('0x7'));var util=require('util');var path=require(_0x19d0('0x8'));var sox=require('sox');var csv=require(_0x19d0('0x9'));var ejs=require(_0x19d0('0xa'));var fs=require('fs');var fs_extra=require(_0x19d0('0xb'));var _=require('lodash');var squel=require(_0x19d0('0xc'));var crypto=require(_0x19d0('0xd'));var jsforce=require(_0x19d0('0xe'));var deskjs=require(_0x19d0('0xf'));var toCsv=require(_0x19d0('0x9'));var querystring=require(_0x19d0('0x10'));var Papa=require(_0x19d0('0x11'));var Redis=require(_0x19d0('0x12'));var authService=require(_0x19d0('0x13'));var qs=require(_0x19d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19d0('0x15'))(_0x19d0('0x16'));var utils=require(_0x19d0('0x17'));var config=require(_0x19d0('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235544,_0x4f92ea){_0x4f92ea=_0x4f92ea||0xcc;return function(_0x133764){if(_0x133764){return _0x235544[_0x19d0('0x19')](_0x4f92ea);}return _0x235544[_0x19d0('0x1a')](_0x4f92ea)['end']();};}function respondWithResult(_0x142063,_0x102cba){_0x102cba=_0x102cba||0xc8;return function(_0x23d608){if(_0x23d608){return _0x142063['status'](_0x102cba)[_0x19d0('0x1b')](_0x23d608);}};}function respondWithFilteredResult(_0x2bd961,_0xf4f375){return function(_0x3afaf9){if(_0x3afaf9){var _0x2b3fc5=typeof _0xf4f375['offset']==='undefined'&&typeof _0xf4f375[_0x19d0('0x1c')]===_0x19d0('0x1d');var _0x30458c=_0x3afaf9[_0x19d0('0x1e')];var _0x1f8c4b=_0x2b3fc5?0x0:_0xf4f375[_0x19d0('0x1f')];var _0x5f232d=_0x2b3fc5?_0x3afaf9[_0x19d0('0x1e')]:_0xf4f375[_0x19d0('0x1f')]+_0xf4f375['limit'];var _0x2fce80;if(_0x5f232d>=_0x30458c){_0x5f232d=_0x30458c;_0x2fce80=0xc8;}else{_0x2fce80=0xce;}_0x2bd961['status'](_0x2fce80);return _0x2bd961['set'](_0x19d0('0x20'),_0x1f8c4b+'-'+_0x5f232d+'/'+_0x30458c)[_0x19d0('0x1b')](_0x3afaf9);}return null;};}function patchUpdates(_0x138d86){return function(_0x50da4a){try{jsonpatch[_0x19d0('0x21')](_0x50da4a,_0x138d86,!![]);}catch(_0x3cd2e7){return BPromise['reject'](_0x3cd2e7);}return _0x50da4a[_0x19d0('0x22')]();};}function saveUpdates(_0x18ed8b,_0x2d4b9c){return function(_0x2bad70){if(_0x2bad70){return _0x2bad70['update'](_0x18ed8b)[_0x19d0('0x23')](function(_0x2061d5){return _0x2061d5;});}return null;};}function removeEntity(_0x8c7e04,_0x195383){return function(_0x54ee0c){if(_0x54ee0c){return _0x54ee0c[_0x19d0('0x24')]()[_0x19d0('0x23')](function(){_0x8c7e04['status'](0xcc)[_0x19d0('0x25')]();});}};}function handleEntityNotFound(_0x4e34d7,_0x1cf5df){return function(_0x21fe03){if(!_0x21fe03){_0x4e34d7['sendStatus'](0x194);}return _0x21fe03;};}function handleError(_0x7f14e4,_0xde2bc2){_0xde2bc2=_0xde2bc2||0x1f4;return function(_0x54dbd5){logger[_0x19d0('0x26')](_0x54dbd5['stack']);if(_0x54dbd5['name']){delete _0x54dbd5[_0x19d0('0x27')];}_0x7f14e4[_0x19d0('0x1a')](_0xde2bc2)[_0x19d0('0x28')](_0x54dbd5);};}exports[_0x19d0('0x29')]=function(_0x116fd2,_0x49e4bf){var _0x5ca234={},_0x5c9090={},_0x4eab77={'count':0x0,'rows':[]};var _0x488436=_[_0x19d0('0x2a')](db[_0x19d0('0x2b')][_0x19d0('0x2c')],function(_0x436635){return{'name':_0x436635[_0x19d0('0x2d')],'type':_0x436635['type'][_0x19d0('0x2e')]};});_0x5c9090[_0x19d0('0x2f')]=_['map'](_0x488436,_0x19d0('0x27'));_0x5c9090['query']=_[_0x19d0('0x30')](_0x116fd2[_0x19d0('0x31')]);_0x5c9090[_0x19d0('0x32')]=_['intersection'](_0x5c9090[_0x19d0('0x2f')],_0x5c9090[_0x19d0('0x31')]);_0x5ca234['attributes']=_[_0x19d0('0x33')](_0x5c9090[_0x19d0('0x2f')],qs[_0x19d0('0x34')](_0x116fd2['query']['fields']));_0x5ca234[_0x19d0('0x35')]=_0x5ca234[_0x19d0('0x35')][_0x19d0('0x36')]?_0x5ca234['attributes']:_0x5c9090['model'];if(!_0x116fd2['query'][_0x19d0('0x37')](_0x19d0('0x38'))){_0x5ca234[_0x19d0('0x1c')]=qs[_0x19d0('0x1c')](_0x116fd2['query'][_0x19d0('0x1c')]);_0x5ca234[_0x19d0('0x1f')]=qs[_0x19d0('0x1f')](_0x116fd2[_0x19d0('0x31')][_0x19d0('0x1f')]);}_0x5ca234[_0x19d0('0x39')]=qs['sort'](_0x116fd2[_0x19d0('0x31')][_0x19d0('0x3a')]);_0x5ca234[_0x19d0('0x3b')]=qs[_0x19d0('0x32')](_[_0x19d0('0x3c')](_0x116fd2[_0x19d0('0x31')],_0x5c9090[_0x19d0('0x32')]),_0x488436);if(_0x116fd2['query']['filter']){_0x5ca234[_0x19d0('0x3b')]=_['merge'](_0x5ca234[_0x19d0('0x3b')],{'$or':_[_0x19d0('0x2a')](_0x488436,function(_0x48425a){if(_0x48425a['type']!==_0x19d0('0x3d')){var _0x156821={};_0x156821[_0x48425a[_0x19d0('0x27')]]={'$like':'%'+_0x116fd2[_0x19d0('0x31')][_0x19d0('0x3e')]+'%'};return _0x156821;}})});}_0x5ca234=_[_0x19d0('0x3f')]({},_0x5ca234,_0x116fd2[_0x19d0('0x40')]);var _0x3f2686={'where':_0x5ca234[_0x19d0('0x3b')]};return db[_0x19d0('0x2b')][_0x19d0('0x1e')](_0x3f2686)[_0x19d0('0x23')](function(_0x2bb4ee){_0x4eab77[_0x19d0('0x1e')]=_0x2bb4ee;if(_0x116fd2['query'][_0x19d0('0x41')]){_0x5ca234['include']=[{'all':!![]}];}return db[_0x19d0('0x2b')][_0x19d0('0x42')](_0x5ca234);})[_0x19d0('0x23')](function(_0x303abc){_0x4eab77[_0x19d0('0x43')]=_0x303abc;return _0x4eab77;})['then'](respondWithFilteredResult(_0x49e4bf,_0x5ca234))[_0x19d0('0x44')](handleError(_0x49e4bf,null));};exports[_0x19d0('0x45')]=function(_0x2c0ad2,_0x5506cb){var _0xd71d6={'raw':!![],'where':{'id':_0x2c0ad2['params']['id']}},_0x2d19fb={};_0x2d19fb[_0x19d0('0x2f')]=_[_0x19d0('0x30')](db['ZohoField'][_0x19d0('0x2c')]);_0x2d19fb[_0x19d0('0x31')]=_[_0x19d0('0x30')](_0x2c0ad2[_0x19d0('0x31')]);_0x2d19fb['filters']=_[_0x19d0('0x33')](_0x2d19fb['model'],_0x2d19fb[_0x19d0('0x31')]);_0xd71d6[_0x19d0('0x35')]=_[_0x19d0('0x33')](_0x2d19fb[_0x19d0('0x2f')],qs[_0x19d0('0x34')](_0x2c0ad2[_0x19d0('0x31')]['fields']));_0xd71d6['attributes']=_0xd71d6[_0x19d0('0x35')]['length']?_0xd71d6['attributes']:_0x2d19fb['model'];if(_0x2c0ad2['query'][_0x19d0('0x41')]){_0xd71d6['include']=[{'all':!![]}];}_0xd71d6=_[_0x19d0('0x3f')]({},_0xd71d6,_0x2c0ad2[_0x19d0('0x40')]);return db[_0x19d0('0x2b')]['find'](_0xd71d6)['then'](handleEntityNotFound(_0x5506cb,null))[_0x19d0('0x23')](respondWithResult(_0x5506cb,null))['catch'](handleError(_0x5506cb,null));};exports['create']=function(_0x317843,_0x4f026f){return db[_0x19d0('0x2b')][_0x19d0('0x46')](_0x317843[_0x19d0('0x47')],{})[_0x19d0('0x23')](respondWithResult(_0x4f026f,0xc9))['catch'](handleError(_0x4f026f,null));};exports['update']=function(_0x2ee2ac,_0x2e903c){if(_0x2ee2ac[_0x19d0('0x47')]['id']){delete _0x2ee2ac[_0x19d0('0x47')]['id'];}return db[_0x19d0('0x2b')][_0x19d0('0x48')]({'where':{'id':_0x2ee2ac['params']['id']}})[_0x19d0('0x23')](handleEntityNotFound(_0x2e903c,null))[_0x19d0('0x23')](saveUpdates(_0x2ee2ac[_0x19d0('0x47')],null))[_0x19d0('0x23')](respondWithResult(_0x2e903c,null))['catch'](handleError(_0x2e903c,null));};exports['destroy']=function(_0x3fb9cb,_0x2df82c){return db['ZohoField'][_0x19d0('0x48')]({'where':{'id':_0x3fb9cb['params']['id']}})['then'](handleEntityNotFound(_0x2df82c,null))[_0x19d0('0x23')](removeEntity(_0x2df82c,null))[_0x19d0('0x44')](handleError(_0x2df82c,null));}; \ No newline at end of file +var _0x01d7=['include','catch','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','send','index','map','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','ZohoField','includeAll'];(function(_0x2e8dc5,_0x5c4151){var _0x2137a1=function(_0x5029e1){while(--_0x5029e1){_0x2e8dc5['push'](_0x2e8dc5['shift']());}};_0x2137a1(++_0x5c4151);}(_0x01d7,0x9f));var _0x701d=function(_0x5182c2,_0x56999d){_0x5182c2=_0x5182c2-0x0;var _0x16d629=_0x01d7[_0x5182c2];return _0x16d629;};'use strict';var emlformat=require(_0x701d('0x0'));var rimraf=require(_0x701d('0x1'));var zipdir=require(_0x701d('0x2'));var jsonpatch=require(_0x701d('0x3'));var rp=require(_0x701d('0x4'));var moment=require(_0x701d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x701d('0x6'));var util=require(_0x701d('0x7'));var path=require(_0x701d('0x8'));var sox=require(_0x701d('0x9'));var csv=require(_0x701d('0xa'));var ejs=require(_0x701d('0xb'));var fs=require('fs');var fs_extra=require(_0x701d('0xc'));var _=require(_0x701d('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x701d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x701d('0xf'));var Papa=require(_0x701d('0x10'));var Redis=require(_0x701d('0x11'));var authService=require(_0x701d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x701d('0x13'));var hardwareService=require(_0x701d('0x14'));var logger=require(_0x701d('0x15'))(_0x701d('0x16'));var utils=require('../../config/utils');var config=require(_0x701d('0x17'));var licenseUtil=require(_0x701d('0x18'));var db=require(_0x701d('0x19'))['db'];function respondWithStatusCode(_0x9578f,_0x545dfe){_0x545dfe=_0x545dfe||0xcc;return function(_0x35ce87){if(_0x35ce87){return _0x9578f[_0x701d('0x1a')](_0x545dfe);}return _0x9578f[_0x701d('0x1b')](_0x545dfe)[_0x701d('0x1c')]();};}function respondWithResult(_0xa96a52,_0x368c62){_0x368c62=_0x368c62||0xc8;return function(_0x43b6c4){if(_0x43b6c4){return _0xa96a52['status'](_0x368c62)['json'](_0x43b6c4);}};}function respondWithFilteredResult(_0x33f2a2,_0x5163d4){return function(_0x5c26ae){if(_0x5c26ae){var _0x5d28ca=typeof _0x5163d4[_0x701d('0x1d')]===_0x701d('0x1e')&&typeof _0x5163d4[_0x701d('0x1f')]===_0x701d('0x1e');var _0x42e3b0=_0x5c26ae[_0x701d('0x20')];var _0xacb0a6=_0x5d28ca?0x0:_0x5163d4[_0x701d('0x1d')];var _0x58a1aa=_0x5d28ca?_0x5c26ae['count']:_0x5163d4[_0x701d('0x1d')]+_0x5163d4[_0x701d('0x1f')];var _0x47c061;if(_0x58a1aa>=_0x42e3b0){_0x58a1aa=_0x42e3b0;_0x47c061=0xc8;}else{_0x47c061=0xce;}_0x33f2a2[_0x701d('0x1b')](_0x47c061);return _0x33f2a2[_0x701d('0x21')](_0x701d('0x22'),_0xacb0a6+'-'+_0x58a1aa+'/'+_0x42e3b0)[_0x701d('0x23')](_0x5c26ae);}return null;};}function patchUpdates(_0x49dff2){return function(_0x49f3cc){try{jsonpatch[_0x701d('0x24')](_0x49f3cc,_0x49dff2,!![]);}catch(_0x30704b){return BPromise[_0x701d('0x25')](_0x30704b);}return _0x49f3cc[_0x701d('0x26')]();};}function saveUpdates(_0xcea23a,_0x5bde80){return function(_0x134fe7){if(_0x134fe7){return _0x134fe7[_0x701d('0x27')](_0xcea23a)[_0x701d('0x28')](function(_0x14768f){return _0x14768f;});}return null;};}function removeEntity(_0x29e3e1,_0x4adb07){return function(_0x47b0ad){if(_0x47b0ad){return _0x47b0ad['destroy']()['then'](function(){_0x29e3e1[_0x701d('0x1b')](0xcc)[_0x701d('0x1c')]();});}};}function handleEntityNotFound(_0xa4d75d,_0x3a0256){return function(_0x2c5949){if(!_0x2c5949){_0xa4d75d[_0x701d('0x1a')](0x194);}return _0x2c5949;};}function handleError(_0x54cac5,_0x54ee9c){_0x54ee9c=_0x54ee9c||0x1f4;return function(_0x5538e8){logger[_0x701d('0x29')](_0x5538e8[_0x701d('0x2a')]);if(_0x5538e8['name']){delete _0x5538e8['name'];}_0x54cac5[_0x701d('0x1b')](_0x54ee9c)[_0x701d('0x2b')](_0x5538e8);};}exports[_0x701d('0x2c')]=function(_0x19ac1a,_0xf7af1c){var _0x179c9a={},_0x5e7ad7={},_0x3f072f={'count':0x0,'rows':[]};var _0x13d61b=_[_0x701d('0x2d')](db['ZohoField']['rawAttributes'],function(_0x27f00d){return{'name':_0x27f00d[_0x701d('0x2e')],'type':_0x27f00d[_0x701d('0x2f')][_0x701d('0x30')]};});_0x5e7ad7[_0x701d('0x31')]=_[_0x701d('0x2d')](_0x13d61b,_0x701d('0x32'));_0x5e7ad7['query']=_[_0x701d('0x33')](_0x19ac1a[_0x701d('0x34')]);_0x5e7ad7['filters']=_[_0x701d('0x35')](_0x5e7ad7[_0x701d('0x31')],_0x5e7ad7[_0x701d('0x34')]);_0x179c9a[_0x701d('0x36')]=_[_0x701d('0x35')](_0x5e7ad7[_0x701d('0x31')],qs[_0x701d('0x37')](_0x19ac1a[_0x701d('0x34')][_0x701d('0x37')]));_0x179c9a[_0x701d('0x36')]=_0x179c9a[_0x701d('0x36')][_0x701d('0x38')]?_0x179c9a['attributes']:_0x5e7ad7['model'];if(!_0x19ac1a[_0x701d('0x34')][_0x701d('0x39')](_0x701d('0x3a'))){_0x179c9a['limit']=qs[_0x701d('0x1f')](_0x19ac1a[_0x701d('0x34')][_0x701d('0x1f')]);_0x179c9a[_0x701d('0x1d')]=qs[_0x701d('0x1d')](_0x19ac1a[_0x701d('0x34')][_0x701d('0x1d')]);}_0x179c9a[_0x701d('0x3b')]=qs[_0x701d('0x3c')](_0x19ac1a[_0x701d('0x34')][_0x701d('0x3c')]);_0x179c9a[_0x701d('0x3d')]=qs[_0x701d('0x3e')](_[_0x701d('0x3f')](_0x19ac1a[_0x701d('0x34')],_0x5e7ad7['filters']),_0x13d61b);if(_0x19ac1a[_0x701d('0x34')]['filter']){_0x179c9a[_0x701d('0x3d')]=_[_0x701d('0x40')](_0x179c9a[_0x701d('0x3d')],{'$or':_[_0x701d('0x2d')](_0x13d61b,function(_0x595079){if(_0x595079[_0x701d('0x2f')]!==_0x701d('0x41')){var _0x56823c={};_0x56823c[_0x595079[_0x701d('0x32')]]={'$like':'%'+_0x19ac1a['query'][_0x701d('0x42')]+'%'};return _0x56823c;}})});}_0x179c9a=_[_0x701d('0x40')]({},_0x179c9a,_0x19ac1a['options']);var _0x1d2e09={'where':_0x179c9a[_0x701d('0x3d')]};return db[_0x701d('0x43')][_0x701d('0x20')](_0x1d2e09)[_0x701d('0x28')](function(_0x5e4d4d){_0x3f072f['count']=_0x5e4d4d;if(_0x19ac1a[_0x701d('0x34')][_0x701d('0x44')]){_0x179c9a[_0x701d('0x45')]=[{'all':!![]}];}return db[_0x701d('0x43')]['findAll'](_0x179c9a);})[_0x701d('0x28')](function(_0x134808){_0x3f072f['rows']=_0x134808;return _0x3f072f;})[_0x701d('0x28')](respondWithFilteredResult(_0xf7af1c,_0x179c9a))[_0x701d('0x46')](handleError(_0xf7af1c,null));};exports['show']=function(_0x9a51a5,_0x26c669){var _0x3126e6={'raw':!![],'where':{'id':_0x9a51a5[_0x701d('0x47')]['id']}},_0xac643c={};_0xac643c[_0x701d('0x31')]=_[_0x701d('0x33')](db[_0x701d('0x43')]['rawAttributes']);_0xac643c['query']=_['keys'](_0x9a51a5[_0x701d('0x34')]);_0xac643c[_0x701d('0x3e')]=_[_0x701d('0x35')](_0xac643c[_0x701d('0x31')],_0xac643c['query']);_0x3126e6[_0x701d('0x36')]=_[_0x701d('0x35')](_0xac643c[_0x701d('0x31')],qs[_0x701d('0x37')](_0x9a51a5[_0x701d('0x34')][_0x701d('0x37')]));_0x3126e6[_0x701d('0x36')]=_0x3126e6[_0x701d('0x36')][_0x701d('0x38')]?_0x3126e6['attributes']:_0xac643c[_0x701d('0x31')];if(_0x9a51a5[_0x701d('0x34')][_0x701d('0x44')]){_0x3126e6[_0x701d('0x45')]=[{'all':!![]}];}_0x3126e6=_[_0x701d('0x40')]({},_0x3126e6,_0x9a51a5[_0x701d('0x48')]);return db[_0x701d('0x43')]['find'](_0x3126e6)['then'](handleEntityNotFound(_0x26c669,null))[_0x701d('0x28')](respondWithResult(_0x26c669,null))[_0x701d('0x46')](handleError(_0x26c669,null));};exports[_0x701d('0x49')]=function(_0x54c472,_0x56d2b0){return db[_0x701d('0x43')][_0x701d('0x49')](_0x54c472[_0x701d('0x4a')],{})[_0x701d('0x28')](respondWithResult(_0x56d2b0,0xc9))[_0x701d('0x46')](handleError(_0x56d2b0,null));};exports['update']=function(_0x5bdb69,_0xb3fc57){if(_0x5bdb69[_0x701d('0x4a')]['id']){delete _0x5bdb69['body']['id'];}return db[_0x701d('0x43')][_0x701d('0x4b')]({'where':{'id':_0x5bdb69[_0x701d('0x47')]['id']}})['then'](handleEntityNotFound(_0xb3fc57,null))[_0x701d('0x28')](saveUpdates(_0x5bdb69[_0x701d('0x4a')],null))['then'](respondWithResult(_0xb3fc57,null))[_0x701d('0x46')](handleError(_0xb3fc57,null));};exports['destroy']=function(_0x2f4ae4,_0x6c2967){return db[_0x701d('0x43')]['find']({'where':{'id':_0x2f4ae4[_0x701d('0x47')]['id']}})['then'](handleEntityNotFound(_0x6c2967,null))[_0x701d('0x28')](removeEntity(_0x6c2967,null))[_0x701d('0x46')](handleError(_0x6c2967,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1aa572d..534cecc 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 _0xafc4=['bluebird','request-promise','path','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x35014d,_0x15f124){var _0x2d827c=function(_0x481f04){while(--_0x481f04){_0x35014d['push'](_0x35014d['shift']());}};_0x2d827c(++_0x15f124);}(_0xafc4,0x69));var _0x4afc=function(_0x1fd442,_0x3251c8){_0x1fd442=_0x1fd442-0x0;var _0x3b4c82=_0xafc4[_0x1fd442];return _0x3b4c82;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4afc('0xa'),_0x4afc('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['moment','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash'];(function(_0x3a36f3,_0x4f0d75){var _0x1ce268=function(_0x136ea9){while(--_0x136ea9){_0x3a36f3['push'](_0x3a36f3['shift']());}};_0x1ce268(++_0x4f0d75);}(_0x6a55,0xdb));var _0x56a5=function(_0x46d8b2,_0x3829c4){_0x46d8b2=_0x46d8b2-0x0;var _0x1a351f=_0x6a55[_0x46d8b2];return _0x1a351f;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intZohoField.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'paranoid':![],'indexes':[{'name':_0x56a5('0x8'),'fields':[_0x56a5('0x9'),'FieldId'],'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 57e8f00..1483ca5 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 _0xa635=['../../config/logger','../../config/environment','jayson/promise','client','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x8fbe27,_0x2b27a5){var _0x401de7=function(_0x1ee9fa){while(--_0x1ee9fa){_0x8fbe27['push'](_0x8fbe27['shift']());}};_0x401de7(++_0x2b27a5);}(_0xa635,0xcc));var _0x5a63=function(_0x835a38,_0x4cde34){_0x835a38=_0x835a38-0x0;var _0x50e539=_0xa635[_0x835a38];return _0x50e539;};'use strict';var _=require(_0x5a63('0x0'));var util=require('util');var moment=require(_0x5a63('0x1'));var BPromise=require(_0x5a63('0x2'));var rs=require(_0x5a63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a63('0x4'))['db'];var utils=require(_0x5a63('0x5'));var logger=require(_0x5a63('0x6'))('rpc');var config=require(_0x5a63('0x7'));var jayson=require(_0x5a63('0x8'));var client=jayson[_0x5a63('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc2e0f1,_0x57a462,_0x1ba59a){return new BPromise(function(_0x4afabb,_0x2a59dd){return client['request'](_0xc2e0f1,_0x1ba59a)[_0x5a63('0xa')](function(_0x544190){logger['info'](_0x5a63('0xb'),_0x57a462,_0x5a63('0xc'));logger[_0x5a63('0xd')](_0x5a63('0xe'),_0x57a462,_0x5a63('0xc'),JSON[_0x5a63('0xf')](_0x544190));if(_0x544190[_0x5a63('0x10')]){if(_0x544190[_0x5a63('0x10')][_0x5a63('0x11')]===0x1f4){logger['error'](_0x5a63('0xb'),_0x57a462,_0x544190[_0x5a63('0x10')][_0x5a63('0x12')]);return _0x2a59dd(_0x544190[_0x5a63('0x10')][_0x5a63('0x12')]);}logger[_0x5a63('0x10')](_0x5a63('0xb'),_0x57a462,_0x544190[_0x5a63('0x10')][_0x5a63('0x12')]);return _0x4afabb(_0x544190[_0x5a63('0x10')][_0x5a63('0x12')]);}else{logger['info'](_0x5a63('0xb'),_0x57a462,_0x5a63('0xc'));_0x4afabb(_0x544190[_0x5a63('0x13')]['message']);}})[_0x5a63('0x14')](function(_0xf5823f){logger[_0x5a63('0x10')](_0x5a63('0xb'),_0x57a462,_0xf5823f);_0x2a59dd(_0xf5823f);});});} \ No newline at end of file +var _0xee91=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2432b7,_0x36e347){var _0x2ca311=function(_0x681068){while(--_0x681068){_0x2432b7['push'](_0x2432b7['shift']());}};_0x2ca311(++_0x36e347);}(_0xee91,0x165));var _0x1ee9=function(_0x5a29d0,_0x4ce81f){_0x5a29d0=_0x5a29d0-0x0;var _0x5064f6=_0xee91[_0x5a29d0];return _0x5064f6;};'use strict';var _=require(_0x1ee9('0x0'));var util=require(_0x1ee9('0x1'));var moment=require(_0x1ee9('0x2'));var BPromise=require(_0x1ee9('0x3'));var rs=require(_0x1ee9('0x4'));var fs=require('fs');var Redis=require(_0x1ee9('0x5'));var db=require(_0x1ee9('0x6'))['db'];var utils=require(_0x1ee9('0x7'));var logger=require(_0x1ee9('0x8'))(_0x1ee9('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ee9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1047ff,_0x1d22bd,_0x49836d){return new BPromise(function(_0x39d01a,_0x193bf2){return client[_0x1ee9('0xb')](_0x1047ff,_0x49836d)[_0x1ee9('0xc')](function(_0x44d273){logger[_0x1ee9('0xd')](_0x1ee9('0xe'),_0x1d22bd,_0x1ee9('0xf'));logger[_0x1ee9('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1d22bd,_0x1ee9('0xf'),JSON[_0x1ee9('0x11')](_0x44d273));if(_0x44d273[_0x1ee9('0x12')]){if(_0x44d273['error'][_0x1ee9('0x13')]===0x1f4){logger[_0x1ee9('0x12')](_0x1ee9('0xe'),_0x1d22bd,_0x44d273[_0x1ee9('0x12')][_0x1ee9('0x14')]);return _0x193bf2(_0x44d273[_0x1ee9('0x12')][_0x1ee9('0x14')]);}logger[_0x1ee9('0x12')](_0x1ee9('0xe'),_0x1d22bd,_0x44d273[_0x1ee9('0x12')][_0x1ee9('0x14')]);return _0x39d01a(_0x44d273[_0x1ee9('0x12')][_0x1ee9('0x14')]);}else{logger[_0x1ee9('0xd')](_0x1ee9('0xe'),_0x1d22bd,_0x1ee9('0xf'));_0x39d01a(_0x44d273['result'][_0x1ee9('0x14')]);}})['catch'](function(_0x5f2732){logger[_0x1ee9('0x12')](_0x1ee9('0xe'),_0x1d22bd,_0x5f2732);_0x193bf2(_0x5f2732);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f448771..6c472e6 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d3440,_0x57a606){var _0x4a3828=function(_0x344aa0){while(--_0x344aa0){_0x3d3440['push'](_0x3d3440['shift']());}};_0x4a3828(++_0x57a606);}(_0xe706,0xa3));var _0x6e70=function(_0x37f053,_0x4b2ad0){_0x37f053=_0x37f053-0x0;var _0x78f6a0=_0xe706[_0x37f053];return _0x78f6a0;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c47e6,_0x5aba0){var _0x4022b3=function(_0x202604){while(--_0x202604){_0x2c47e6['push'](_0x2c47e6['shift']());}};_0x4022b3(++_0x5aba0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a8bcd4c..dff3a43 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 _0x9386=['INTEGER','state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x6e68b9,_0x41d225){var _0x18ac2a=function(_0x225a64){while(--_0x225a64){_0x6e68b9['push'](_0x6e68b9['shift']());}};_0x18ac2a(++_0x41d225);}(_0x9386,0x6b));var _0x6938=function(_0x259536,_0x3bfdc9){_0x259536=_0x259536-0x0;var _0x4bb0bf=_0x9386[_0x259536];return _0x4bb0bf;};'use strict';var Sequelize=require(_0x6938('0x0'));module[_0x6938('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6938('0x2')},'version':{'type':Sequelize[_0x6938('0x3')],'allowNull':![],'unique':_0x6938('0x2')},'main':{'type':Sequelize[_0x6938('0x3')],'defaultValue':_0x6938('0x4')},'filename':{'type':Sequelize[_0x6938('0x3')]},'path':{'type':Sequelize[_0x6938('0x3')]},'type':{'type':Sequelize[_0x6938('0x3')]},'size':{'type':Sequelize[_0x6938('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x6938('0x3')]},'logo':{'type':Sequelize[_0x6938('0x3')]},'state':{'type':Sequelize[_0x6938('0x3')],'unique':_0x6938('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x6938('0x3')]},'remoteUri':{'type':Sequelize[_0x6938('0x3')]},'link':{'type':Sequelize[_0x6938('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x38ff=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x832288,_0x13bbfd){var _0x43074e=function(_0x5b998d){while(--_0x5b998d){_0x832288['push'](_0x832288['shift']());}};_0x43074e(++_0x13bbfd);}(_0x38ff,0x173));var _0xf38f=function(_0x2af0bd,_0x30c3ac){_0x2af0bd=_0x2af0bd-0x0;var _0x1f52cd=_0x38ff[_0x2af0bd];return _0x1f52cd;};'use strict';var Sequelize=require(_0xf38f('0x0'));module[_0xf38f('0x1')]={'name':{'type':Sequelize[_0xf38f('0x2')],'allowNull':![],'unique':_0xf38f('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf38f('0x3')},'main':{'type':Sequelize[_0xf38f('0x2')],'defaultValue':_0xf38f('0x4')},'filename':{'type':Sequelize[_0xf38f('0x2')]},'path':{'type':Sequelize[_0xf38f('0x2')]},'type':{'type':Sequelize[_0xf38f('0x2')]},'size':{'type':Sequelize[_0xf38f('0x5')]},'active':{'type':Sequelize[_0xf38f('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf38f('0x2')],'unique':_0xf38f('0x7')},'description':{'type':Sequelize[_0xf38f('0x2')]},'title':{'type':Sequelize[_0xf38f('0x2')]},'remoteUri':{'type':Sequelize[_0xf38f('0x2')]},'link':{'type':Sequelize[_0xf38f('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 6724a17..7d689ce 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 _0x90b1=['map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','Integration','includeAll','rows','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index'];(function(_0x289622,_0x2896f3){var _0x2d24ae=function(_0x55167a){while(--_0x55167a){_0x289622['push'](_0x289622['shift']());}};_0x2d24ae(++_0x2896f3);}(_0x90b1,0x1bb));var _0x190b=function(_0x517c97,_0x3fd275){_0x517c97=_0x517c97-0x0;var _0x244ef3=_0x90b1[_0x517c97];return _0x244ef3;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['Integration'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['Integration'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));}; \ No newline at end of file +var _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x12331d,_0x5ea5dc){var _0x4e0a8c=function(_0x262ee3){while(--_0x262ee3){_0x12331d['push'](_0x12331d['shift']());}};_0x4e0a8c(++_0x5ea5dc);}(_0x6343,0x168));var _0x3634=function(_0x5d53f6,_0x288aeb){_0x5d53f6=_0x5d53f6-0x0;var _0x3b1dd3=_0x6343[_0x5d53f6];return _0x3b1dd3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 19add49..8c332cd 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 _0x498e=['api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','lodash','../../config/logger'];(function(_0xe54bf9,_0x27a75c){var _0x2d735c=function(_0x72aa42){while(--_0x72aa42){_0xe54bf9['push'](_0xe54bf9['shift']());}};_0x2d735c(++_0x27a75c);}(_0x498e,0x196));var _0xe498=function(_0x4b9e96,_0x58ccd5){_0x4b9e96=_0x4b9e96-0x0;var _0x2b1e49=_0x498e[_0x4b9e96];return _0x2b1e49;};'use strict';var _=require(_0xe498('0x0'));var util=require('util');var logger=require(_0xe498('0x1'))(_0xe498('0x2'));var moment=require(_0xe498('0x3'));var BPromise=require(_0xe498('0x4'));var rp=require(_0xe498('0x5'));var fs=require('fs');var path=require(_0xe498('0x6'));var rimraf=require('rimraf');var config=require(_0xe498('0x7'));var attributes=require(_0xe498('0x8'));module[_0xe498('0x9')]=function(_0x367f31,_0x3e1c57){return _0x367f31[_0xe498('0xa')](_0xe498('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef63=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef63,0x1df));var _0x3ef6=function(_0x4e09d1,_0x5f48ee){_0x4e09d1=_0x4e09d1-0x0;var _0x21b5c3=_0xef63[_0x4e09d1];return _0x21b5c3;};'use strict';var _=require(_0x3ef6('0x0'));var util=require(_0x3ef6('0x1'));var logger=require(_0x3ef6('0x2'))(_0x3ef6('0x3'));var moment=require(_0x3ef6('0x4'));var BPromise=require(_0x3ef6('0x5'));var rp=require(_0x3ef6('0x6'));var fs=require('fs');var path=require(_0x3ef6('0x7'));var rimraf=require(_0x3ef6('0x8'));var config=require(_0x3ef6('0x9'));var attributes=require(_0x3ef6('0xa'));module[_0x3ef6('0xb')]=function(_0x411013,_0x4277d5){return _0x411013[_0x3ef6('0xc')](_0x3ef6('0xd'),attributes,{'tableName':_0x3ef6('0xe'),'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 9518c0e..d774938 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x589061,_0xa264f7){var _0x437761=function(_0x13d14f){while(--_0x13d14f){_0x589061['push'](_0x589061['shift']());}};_0x437761(++_0xa264f7);}(_0x66fa,0x117));var _0xa66f=function(_0x2d371e,_0x144df2){_0x2d371e=_0x2d371e-0x0;var _0x1fd1aa=_0x66fa[_0x2d371e];return _0x1fd1aa;};'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});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x59a21e,_0x1128a3){var _0x4b6934=function(_0x2f6965){while(--_0x2f6965){_0x59a21e['push'](_0x59a21e['shift']());}};_0x4b6934(++_0x1128a3);}(_0x1a85,0x178));var _0x51a8=function(_0x1a887f,_0x28423c){_0x1a887f=_0x1a887f-0x0;var _0x1841ff=_0x1a85[_0x1a887f];return _0x1841ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e573006..e875c30 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 _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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0295,0x1f0));var _0x5029=function(_0x48baa3,_0x3cebbf){_0x48baa3=_0x48baa3-0x0;var _0x394bba=_0x0295[_0x48baa3];return _0x394bba;};'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 +var _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x5f4585,_0x287c9f){var _0x32b347=function(_0x301639){while(--_0x301639){_0x5f4585['push'](_0x5f4585['shift']());}};_0x32b347(++_0x287c9f);}(_0x187d,0x93));var _0xd187=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x187d[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6086253..fe9baf8 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 _0xeec6=['DATE','BOOLEAN','TEXT','ENUM','FAILED','sequelize','STRING','INTEGER'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xeec6,0x125));var _0x6eec=function(_0x50af9c,_0xf03b1e){_0x50af9c=_0x50af9c-0x0;var _0x5b5e5a=_0xeec6[_0x50af9c];return _0x5b5e5a;};'use strict';var Sequelize=require(_0x6eec('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x6eec('0x1')]},'ticketId':{'type':Sequelize[_0x6eec('0x1')]},'integrationId':{'type':Sequelize[_0x6eec('0x2')]},'contacts':{'type':Sequelize[_0x6eec('0x1')]},'uniqueid':{'type':Sequelize[_0x6eec('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6eec('0x1')]},'queue':{'type':Sequelize[_0x6eec('0x1')]},'interface':{'type':Sequelize[_0x6eec('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6eec('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x6eec('0x2')]},'agentacw':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6eec('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x6eec('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6eec('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6eec('0x1')]},'channel':{'type':Sequelize[_0x6eec('0x1')]},'channelstate':{'type':Sequelize[_0x6eec('0x2')]},'channelstatedesc':{'type':Sequelize[_0x6eec('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6eec('0x1')]},'connectedlinename':{'type':Sequelize[_0x6eec('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6eec('0x1')]},'context':{'type':Sequelize[_0x6eec('0x1')]},'exten':{'type':Sequelize[_0x6eec('0x1')]},'priority':{'type':Sequelize[_0x6eec('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6eec('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6eec('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6eec('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6eec('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6eec('0x1')]},'destlanguage':{'type':Sequelize[_0x6eec('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6eec('0x1')]},'destexten':{'type':Sequelize[_0x6eec('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6eec('0x1')]},'messageId':{'type':Sequelize[_0x6eec('0x1')]},'inReplyTo':{'type':Sequelize[_0x6eec('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x6eec('0x1')]},'to':{'type':Sequelize[_0x6eec('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6eec('0x5')]},'html':{'type':Sequelize[_0x6eec('0x5')]},'text':{'type':Sequelize[_0x6eec('0x5')]},'status':{'type':Sequelize[_0x6eec('0x6')]('SENT','SENDING','RECEIVED',_0x6eec('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x6eec('0x1')]},'appdata':{'type':Sequelize[_0x6eec('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf2cf=['ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xcf7841,_0x147346){var _0x2d07d7=function(_0x16144d){while(--_0x16144d){_0xcf7841['push'](_0xcf7841['shift']());}};_0x2d07d7(++_0x147346);}(_0xf2cf,0x1bd));var _0xff2c=function(_0x22ec10,_0x11c591){_0x22ec10=_0x22ec10-0x0;var _0x11f230=_0xf2cf[_0x22ec10];return _0x11f230;};'use strict';var Sequelize=require('sequelize');module[_0xff2c('0x0')]={'integration':{'type':Sequelize[_0xff2c('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xff2c('0x1')]},'ticketId':{'type':Sequelize[_0xff2c('0x1')]},'integrationId':{'type':Sequelize[_0xff2c('0x2')]},'contacts':{'type':Sequelize[_0xff2c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xff2c('0x1')]},'interface':{'type':Sequelize[_0xff2c('0x1')]},'membername':{'type':Sequelize[_0xff2c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xff2c('0x3')]},'agentconnectAt':{'type':Sequelize[_0xff2c('0x3')]},'holdtime':{'type':Sequelize[_0xff2c('0x2')]},'agentcomplete':{'type':Sequelize[_0xff2c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xff2c('0x3')]},'talktime':{'type':Sequelize[_0xff2c('0x2')]},'agentacw':{'type':Sequelize[_0xff2c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xff2c('0x2')]},'reason':{'type':Sequelize[_0xff2c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xff2c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xff2c('0x3')]},'agentdump':{'type':Sequelize[_0xff2c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xff2c('0x3')]},'lastevent':{'type':Sequelize[_0xff2c('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xff2c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xff2c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xff2c('0x1')]},'accountcode':{'type':Sequelize[_0xff2c('0x1')]},'context':{'type':Sequelize[_0xff2c('0x1')]},'exten':{'type':Sequelize[_0xff2c('0x1')]},'priority':{'type':Sequelize[_0xff2c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xff2c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xff2c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xff2c('0x1')]},'destcalleridname':{'type':Sequelize[_0xff2c('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xff2c('0x1')]},'destaccountcode':{'type':Sequelize[_0xff2c('0x1')]},'destcontext':{'type':Sequelize[_0xff2c('0x1')]},'destexten':{'type':Sequelize[_0xff2c('0x1')]},'destpriority':{'type':Sequelize[_0xff2c('0x1')]},'destuniqueid':{'type':Sequelize[_0xff2c('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xff2c('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xff2c('0x1')]},'cc':{'type':Sequelize[_0xff2c('0x1')]},'attachment':{'type':Sequelize[_0xff2c('0x5')]},'html':{'type':Sequelize[_0xff2c('0x5')]},'text':{'type':Sequelize[_0xff2c('0x5')]},'status':{'type':Sequelize[_0xff2c('0x6')](_0xff2c('0x7'),_0xff2c('0x8'),_0xff2c('0x9'),_0xff2c('0xa'))},'url':{'type':Sequelize[_0xff2c('0x1')]},'app':{'type':Sequelize[_0xff2c('0x1')]},'appdata':{'type':Sequelize[_0xff2c('0x1')]},'projectId':{'type':Sequelize[_0xff2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b8de4a8..e2a43e7 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 _0x1502=['length','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','IntegrationReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x59c476,_0x5cd7fb){var _0x5c6e4f=function(_0x1e95c5){while(--_0x1e95c5){_0x59c476['push'](_0x59c476['shift']());}};_0x5c6e4f(++_0x5cd7fb);}(_0x1502,0x177));var _0x2150=function(_0x5519e8,_0x205071){_0x5519e8=_0x5519e8-0x0;var _0x5e122c=_0x1502[_0x5519e8];return _0x5e122c;};'use strict';var emlformat=require(_0x2150('0x0'));var rimraf=require(_0x2150('0x1'));var zipdir=require(_0x2150('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2150('0x3'));var util=require('util');var path=require(_0x2150('0x4'));var sox=require(_0x2150('0x5'));var csv=require(_0x2150('0x6'));var ejs=require(_0x2150('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2150('0x8'));var squel=require(_0x2150('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2150('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2150('0xb'));var Papa=require(_0x2150('0xc'));var Redis=require(_0x2150('0xd'));var authService=require(_0x2150('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2150('0xf'));var hardwareService=require(_0x2150('0x10'));var logger=require(_0x2150('0x11'))(_0x2150('0x12'));var utils=require(_0x2150('0x13'));var config=require(_0x2150('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2150('0x15'))['db'];function respondWithStatusCode(_0x1036fd,_0x57aaff){_0x57aaff=_0x57aaff||0xcc;return function(_0x4ffe2c){if(_0x4ffe2c){return _0x1036fd[_0x2150('0x16')](_0x57aaff);}return _0x1036fd[_0x2150('0x17')](_0x57aaff)[_0x2150('0x18')]();};}function respondWithResult(_0x2288fd,_0x113bf9){_0x113bf9=_0x113bf9||0xc8;return function(_0x414da1){if(_0x414da1){return _0x2288fd[_0x2150('0x17')](_0x113bf9)[_0x2150('0x19')](_0x414da1);}};}function respondWithFilteredResult(_0x116fd9,_0x1dfc02){return function(_0x1a08e1){if(_0x1a08e1){var _0x5e7f4c=typeof _0x1dfc02[_0x2150('0x1a')]===_0x2150('0x1b')&&typeof _0x1dfc02[_0x2150('0x1c')]===_0x2150('0x1b');var _0x3b33f7=_0x1a08e1[_0x2150('0x1d')];var _0x4ab31a=_0x5e7f4c?0x0:_0x1dfc02[_0x2150('0x1a')];var _0x1e68ce=_0x5e7f4c?_0x1a08e1['count']:_0x1dfc02['offset']+_0x1dfc02['limit'];var _0x3ed4e4;if(_0x1e68ce>=_0x3b33f7){_0x1e68ce=_0x3b33f7;_0x3ed4e4=0xc8;}else{_0x3ed4e4=0xce;}_0x116fd9[_0x2150('0x17')](_0x3ed4e4);return _0x116fd9[_0x2150('0x1e')](_0x2150('0x1f'),_0x4ab31a+'-'+_0x1e68ce+'/'+_0x3b33f7)[_0x2150('0x19')](_0x1a08e1);}return null;};}function patchUpdates(_0x250735){return function(_0x5e9489){try{jsonpatch[_0x2150('0x20')](_0x5e9489,_0x250735,!![]);}catch(_0x51453d){return BPromise[_0x2150('0x21')](_0x51453d);}return _0x5e9489[_0x2150('0x22')]();};}function saveUpdates(_0xcbaf13,_0x457a65){return function(_0xd7d460){if(_0xd7d460){return _0xd7d460[_0x2150('0x23')](_0xcbaf13)[_0x2150('0x24')](function(_0x348d56){return _0x348d56;});}return null;};}function removeEntity(_0x327a68,_0x28c851){return function(_0x2d3563){if(_0x2d3563){return _0x2d3563[_0x2150('0x25')]()[_0x2150('0x24')](function(){_0x327a68[_0x2150('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa51e5,_0x39ab15){return function(_0x5e8cb3){if(!_0x5e8cb3){_0xfa51e5[_0x2150('0x16')](0x194);}return _0x5e8cb3;};}function handleError(_0x2943dd,_0x237b25){_0x237b25=_0x237b25||0x1f4;return function(_0x5f1dab){logger['error'](_0x5f1dab['stack']);if(_0x5f1dab[_0x2150('0x26')]){delete _0x5f1dab[_0x2150('0x26')];}_0x2943dd['status'](_0x237b25)[_0x2150('0x27')](_0x5f1dab);};}exports['index']=function(_0x2516dc,_0x55bc99){var _0x585fcd={},_0x2a9fbf={},_0x434540={'count':0x0,'rows':[]};var _0x30a025=_[_0x2150('0x28')](db[_0x2150('0x29')][_0x2150('0x2a')],function(_0x10b612){return{'name':_0x10b612['fieldName'],'type':_0x10b612[_0x2150('0x2b')][_0x2150('0x2c')]};});_0x2a9fbf['model']=_[_0x2150('0x28')](_0x30a025,_0x2150('0x26'));_0x2a9fbf[_0x2150('0x2d')]=_['keys'](_0x2516dc[_0x2150('0x2d')]);_0x2a9fbf[_0x2150('0x2e')]=_[_0x2150('0x2f')](_0x2a9fbf[_0x2150('0x30')],_0x2a9fbf[_0x2150('0x2d')]);_0x585fcd[_0x2150('0x31')]=_[_0x2150('0x2f')](_0x2a9fbf[_0x2150('0x30')],qs[_0x2150('0x32')](_0x2516dc[_0x2150('0x2d')]['fields']));_0x585fcd[_0x2150('0x31')]=_0x585fcd[_0x2150('0x31')][_0x2150('0x33')]?_0x585fcd[_0x2150('0x31')]:_0x2a9fbf[_0x2150('0x30')];if(!_0x2516dc[_0x2150('0x2d')]['hasOwnProperty'](_0x2150('0x34'))){_0x585fcd[_0x2150('0x1c')]=qs[_0x2150('0x1c')](_0x2516dc[_0x2150('0x2d')][_0x2150('0x1c')]);_0x585fcd[_0x2150('0x1a')]=qs[_0x2150('0x1a')](_0x2516dc[_0x2150('0x2d')][_0x2150('0x1a')]);}_0x585fcd[_0x2150('0x35')]=qs[_0x2150('0x36')](_0x2516dc[_0x2150('0x2d')][_0x2150('0x36')]);_0x585fcd[_0x2150('0x37')]=qs[_0x2150('0x2e')](_['pick'](_0x2516dc[_0x2150('0x2d')],_0x2a9fbf[_0x2150('0x2e')]),_0x30a025);if(_0x2516dc[_0x2150('0x2d')][_0x2150('0x38')]){_0x585fcd[_0x2150('0x37')]=_[_0x2150('0x39')](_0x585fcd[_0x2150('0x37')],{'$or':_[_0x2150('0x28')](_0x30a025,function(_0x1ab1f8){if(_0x1ab1f8[_0x2150('0x2b')]!=='VIRTUAL'){var _0x42b0e2={};_0x42b0e2[_0x1ab1f8[_0x2150('0x26')]]={'$like':'%'+_0x2516dc[_0x2150('0x2d')][_0x2150('0x38')]+'%'};return _0x42b0e2;}})});}_0x585fcd=_[_0x2150('0x39')]({},_0x585fcd,_0x2516dc[_0x2150('0x3a')]);var _0x1bed8d={'where':_0x585fcd[_0x2150('0x37')]};return db[_0x2150('0x29')][_0x2150('0x1d')](_0x1bed8d)['then'](function(_0x39a491){_0x434540[_0x2150('0x1d')]=_0x39a491;if(_0x2516dc[_0x2150('0x2d')]['includeAll']){_0x585fcd[_0x2150('0x3b')]=[{'all':!![]}];}return db[_0x2150('0x29')][_0x2150('0x3c')](_0x585fcd);})[_0x2150('0x24')](function(_0x5f5d9e){_0x434540[_0x2150('0x3d')]=_0x5f5d9e;return _0x434540;})[_0x2150('0x24')](respondWithFilteredResult(_0x55bc99,_0x585fcd))['catch'](handleError(_0x55bc99,null));};exports[_0x2150('0x3e')]=function(_0x457d23,_0x2e75c2){var _0x43029f={'raw':![],'where':{'id':_0x457d23[_0x2150('0x3f')]['id']}},_0x2f24eb={};_0x2f24eb['model']=_[_0x2150('0x40')](db[_0x2150('0x29')][_0x2150('0x2a')]);_0x2f24eb['query']=_['keys'](_0x457d23[_0x2150('0x2d')]);_0x2f24eb[_0x2150('0x2e')]=_[_0x2150('0x2f')](_0x2f24eb[_0x2150('0x30')],_0x2f24eb[_0x2150('0x2d')]);_0x43029f[_0x2150('0x31')]=_[_0x2150('0x2f')](_0x2f24eb['model'],qs[_0x2150('0x32')](_0x457d23['query']['fields']));_0x43029f[_0x2150('0x31')]=_0x43029f[_0x2150('0x31')][_0x2150('0x33')]?_0x43029f[_0x2150('0x31')]:_0x2f24eb[_0x2150('0x30')];if(_0x457d23[_0x2150('0x2d')][_0x2150('0x41')]){_0x43029f[_0x2150('0x3b')]=[{'all':!![]}];}_0x43029f=_['merge']({},_0x43029f,_0x457d23[_0x2150('0x3a')]);return db[_0x2150('0x29')]['find'](_0x43029f)[_0x2150('0x24')](handleEntityNotFound(_0x2e75c2,null))['then'](respondWithResult(_0x2e75c2,null))[_0x2150('0x42')](handleError(_0x2e75c2,null));};exports[_0x2150('0x43')]=function(_0xa23cb9,_0x293bc3){return db['IntegrationReport'][_0x2150('0x43')](_0xa23cb9[_0x2150('0x44')],{})[_0x2150('0x24')](respondWithResult(_0x293bc3,0xc9))[_0x2150('0x42')](handleError(_0x293bc3,null));};exports[_0x2150('0x23')]=function(_0xbc1ebd,_0x3f24f3){if(_0xbc1ebd[_0x2150('0x44')]['id']){delete _0xbc1ebd['body']['id'];}return db[_0x2150('0x29')][_0x2150('0x45')]({'where':{'id':_0xbc1ebd[_0x2150('0x3f')]['id']}})[_0x2150('0x24')](handleEntityNotFound(_0x3f24f3,null))[_0x2150('0x24')](saveUpdates(_0xbc1ebd[_0x2150('0x44')],null))[_0x2150('0x24')](respondWithResult(_0x3f24f3,null))[_0x2150('0x42')](handleError(_0x3f24f3,null));};exports['destroy']=function(_0xd1e061,_0x1e67a8){return db[_0x2150('0x29')][_0x2150('0x45')]({'where':{'id':_0xd1e061[_0x2150('0x3f')]['id']}})[_0x2150('0x24')](handleEntityNotFound(_0x1e67a8,null))[_0x2150('0x24')](removeEntity(_0x1e67a8,null))['catch'](handleError(_0x1e67a8,null));};exports[_0x2150('0x46')]=function(_0x5164d4,_0x164f98){return db[_0x2150('0x29')]['describe']()[_0x2150('0x24')](respondWithResult(_0x164f98,null))['catch'](handleError(_0x164f98,null));}; \ No newline at end of file +var _0x80e7=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xb935ec,_0x2e217e){var _0x309513=function(_0x20339f){while(--_0x20339f){_0xb935ec['push'](_0xb935ec['shift']());}};_0x309513(++_0x2e217e);}(_0x80e7,0x11e));var _0x780e=function(_0x551b73,_0x5251eb){_0x551b73=_0x551b73-0x0;var _0x35d234=_0x80e7[_0x551b73];return _0x35d234;};'use strict';var emlformat=require(_0x780e('0x0'));var rimraf=require(_0x780e('0x1'));var zipdir=require(_0x780e('0x2'));var jsonpatch=require(_0x780e('0x3'));var rp=require(_0x780e('0x4'));var moment=require(_0x780e('0x5'));var BPromise=require(_0x780e('0x6'));var Mustache=require(_0x780e('0x7'));var util=require(_0x780e('0x8'));var path=require(_0x780e('0x9'));var sox=require('sox');var csv=require(_0x780e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x780e('0xb'));var _=require(_0x780e('0xc'));var squel=require('squel');var crypto=require(_0x780e('0xd'));var jsforce=require(_0x780e('0xe'));var deskjs=require(_0x780e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x780e('0x10'));var Redis=require(_0x780e('0x11'));var authService=require(_0x780e('0x12'));var qs=require(_0x780e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x780e('0x14'));var logger=require(_0x780e('0x15'))(_0x780e('0x16'));var utils=require(_0x780e('0x17'));var config=require(_0x780e('0x18'));var licenseUtil=require(_0x780e('0x19'));var db=require(_0x780e('0x1a'))['db'];function respondWithStatusCode(_0x3ff225,_0x58ef65){_0x58ef65=_0x58ef65||0xcc;return function(_0x57bb19){if(_0x57bb19){return _0x3ff225['sendStatus'](_0x58ef65);}return _0x3ff225[_0x780e('0x1b')](_0x58ef65)[_0x780e('0x1c')]();};}function respondWithResult(_0x4eb219,_0x1a230b){_0x1a230b=_0x1a230b||0xc8;return function(_0x42daf1){if(_0x42daf1){return _0x4eb219[_0x780e('0x1b')](_0x1a230b)[_0x780e('0x1d')](_0x42daf1);}};}function respondWithFilteredResult(_0x1c1a53,_0x38747d){return function(_0x578e32){if(_0x578e32){var _0x273c23=typeof _0x38747d['offset']===_0x780e('0x1e')&&typeof _0x38747d[_0x780e('0x1f')]===_0x780e('0x1e');var _0xa260c7=_0x578e32[_0x780e('0x20')];var _0x106568=_0x273c23?0x0:_0x38747d[_0x780e('0x21')];var _0x2ebee3=_0x273c23?_0x578e32[_0x780e('0x20')]:_0x38747d['offset']+_0x38747d['limit'];var _0x41d1b6;if(_0x2ebee3>=_0xa260c7){_0x2ebee3=_0xa260c7;_0x41d1b6=0xc8;}else{_0x41d1b6=0xce;}_0x1c1a53[_0x780e('0x1b')](_0x41d1b6);return _0x1c1a53['set'](_0x780e('0x22'),_0x106568+'-'+_0x2ebee3+'/'+_0xa260c7)[_0x780e('0x1d')](_0x578e32);}return null;};}function patchUpdates(_0x31c082){return function(_0x5084b3){try{jsonpatch[_0x780e('0x23')](_0x5084b3,_0x31c082,!![]);}catch(_0x48c598){return BPromise[_0x780e('0x24')](_0x48c598);}return _0x5084b3['save']();};}function saveUpdates(_0x52b006,_0x5e320b){return function(_0x33627e){if(_0x33627e){return _0x33627e['update'](_0x52b006)[_0x780e('0x25')](function(_0x40ba91){return _0x40ba91;});}return null;};}function removeEntity(_0x4bf227,_0x43aa27){return function(_0x58390e){if(_0x58390e){return _0x58390e[_0x780e('0x26')]()[_0x780e('0x25')](function(){_0x4bf227[_0x780e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d31f8,_0x46aea7){return function(_0x2612bd){if(!_0x2612bd){_0x4d31f8[_0x780e('0x27')](0x194);}return _0x2612bd;};}function handleError(_0x4f2009,_0x31fe4a){_0x31fe4a=_0x31fe4a||0x1f4;return function(_0x3dd745){logger[_0x780e('0x28')](_0x3dd745[_0x780e('0x29')]);if(_0x3dd745['name']){delete _0x3dd745[_0x780e('0x2a')];}_0x4f2009['status'](_0x31fe4a)['send'](_0x3dd745);};}exports['index']=function(_0x192a18,_0x582cdd){var _0x49aabb={},_0x2a0916={},_0x389ba0={'count':0x0,'rows':[]};var _0xef1a82=_[_0x780e('0x2b')](db[_0x780e('0x2c')][_0x780e('0x2d')],function(_0x4fe3e1){return{'name':_0x4fe3e1[_0x780e('0x2e')],'type':_0x4fe3e1[_0x780e('0x2f')][_0x780e('0x30')]};});_0x2a0916[_0x780e('0x31')]=_[_0x780e('0x2b')](_0xef1a82,_0x780e('0x2a'));_0x2a0916[_0x780e('0x32')]=_[_0x780e('0x33')](_0x192a18['query']);_0x2a0916[_0x780e('0x34')]=_[_0x780e('0x35')](_0x2a0916[_0x780e('0x31')],_0x2a0916[_0x780e('0x32')]);_0x49aabb[_0x780e('0x36')]=_[_0x780e('0x35')](_0x2a0916[_0x780e('0x31')],qs['fields'](_0x192a18[_0x780e('0x32')][_0x780e('0x37')]));_0x49aabb['attributes']=_0x49aabb[_0x780e('0x36')][_0x780e('0x38')]?_0x49aabb[_0x780e('0x36')]:_0x2a0916['model'];if(!_0x192a18[_0x780e('0x32')]['hasOwnProperty'](_0x780e('0x39'))){_0x49aabb[_0x780e('0x1f')]=qs[_0x780e('0x1f')](_0x192a18[_0x780e('0x32')][_0x780e('0x1f')]);_0x49aabb['offset']=qs[_0x780e('0x21')](_0x192a18['query'][_0x780e('0x21')]);}_0x49aabb[_0x780e('0x3a')]=qs[_0x780e('0x3b')](_0x192a18[_0x780e('0x32')][_0x780e('0x3b')]);_0x49aabb[_0x780e('0x3c')]=qs[_0x780e('0x34')](_[_0x780e('0x3d')](_0x192a18[_0x780e('0x32')],_0x2a0916[_0x780e('0x34')]),_0xef1a82);if(_0x192a18['query'][_0x780e('0x3e')]){_0x49aabb[_0x780e('0x3c')]=_[_0x780e('0x3f')](_0x49aabb[_0x780e('0x3c')],{'$or':_[_0x780e('0x2b')](_0xef1a82,function(_0x5004e0){if(_0x5004e0[_0x780e('0x2f')]!==_0x780e('0x40')){var _0x37b20a={};_0x37b20a[_0x5004e0['name']]={'$like':'%'+_0x192a18['query']['filter']+'%'};return _0x37b20a;}})});}_0x49aabb=_['merge']({},_0x49aabb,_0x192a18[_0x780e('0x41')]);var _0x5cf090={'where':_0x49aabb[_0x780e('0x3c')]};return db[_0x780e('0x2c')][_0x780e('0x20')](_0x5cf090)[_0x780e('0x25')](function(_0x58808e){_0x389ba0[_0x780e('0x20')]=_0x58808e;if(_0x192a18[_0x780e('0x32')][_0x780e('0x42')]){_0x49aabb[_0x780e('0x43')]=[{'all':!![]}];}return db[_0x780e('0x2c')][_0x780e('0x44')](_0x49aabb);})[_0x780e('0x25')](function(_0x561009){_0x389ba0['rows']=_0x561009;return _0x389ba0;})[_0x780e('0x25')](respondWithFilteredResult(_0x582cdd,_0x49aabb))[_0x780e('0x45')](handleError(_0x582cdd,null));};exports[_0x780e('0x46')]=function(_0x51fd6d,_0xa51c33){var _0x669f89={'raw':![],'where':{'id':_0x51fd6d[_0x780e('0x47')]['id']}},_0x45a733={};_0x45a733['model']=_[_0x780e('0x33')](db['IntegrationReport']['rawAttributes']);_0x45a733['query']=_[_0x780e('0x33')](_0x51fd6d[_0x780e('0x32')]);_0x45a733[_0x780e('0x34')]=_[_0x780e('0x35')](_0x45a733['model'],_0x45a733[_0x780e('0x32')]);_0x669f89[_0x780e('0x36')]=_['intersection'](_0x45a733[_0x780e('0x31')],qs['fields'](_0x51fd6d[_0x780e('0x32')][_0x780e('0x37')]));_0x669f89[_0x780e('0x36')]=_0x669f89[_0x780e('0x36')]['length']?_0x669f89['attributes']:_0x45a733[_0x780e('0x31')];if(_0x51fd6d[_0x780e('0x32')][_0x780e('0x42')]){_0x669f89[_0x780e('0x43')]=[{'all':!![]}];}_0x669f89=_[_0x780e('0x3f')]({},_0x669f89,_0x51fd6d['options']);return db['IntegrationReport'][_0x780e('0x48')](_0x669f89)[_0x780e('0x25')](handleEntityNotFound(_0xa51c33,null))['then'](respondWithResult(_0xa51c33,null))[_0x780e('0x45')](handleError(_0xa51c33,null));};exports[_0x780e('0x49')]=function(_0x5aace9,_0x3ce23a){return db[_0x780e('0x2c')]['create'](_0x5aace9[_0x780e('0x4a')],{})['then'](respondWithResult(_0x3ce23a,0xc9))[_0x780e('0x45')](handleError(_0x3ce23a,null));};exports[_0x780e('0x4b')]=function(_0x1bf4da,_0x57ddd9){if(_0x1bf4da[_0x780e('0x4a')]['id']){delete _0x1bf4da[_0x780e('0x4a')]['id'];}return db[_0x780e('0x2c')][_0x780e('0x48')]({'where':{'id':_0x1bf4da[_0x780e('0x47')]['id']}})[_0x780e('0x25')](handleEntityNotFound(_0x57ddd9,null))['then'](saveUpdates(_0x1bf4da[_0x780e('0x4a')],null))[_0x780e('0x25')](respondWithResult(_0x57ddd9,null))['catch'](handleError(_0x57ddd9,null));};exports[_0x780e('0x26')]=function(_0xff0685,_0xbc7d1c){return db['IntegrationReport'][_0x780e('0x48')]({'where':{'id':_0xff0685[_0x780e('0x47')]['id']}})[_0x780e('0x25')](handleEntityNotFound(_0xbc7d1c,null))[_0x780e('0x25')](removeEntity(_0xbc7d1c,null))['catch'](handleError(_0xbc7d1c,null));};exports[_0x780e('0x4c')]=function(_0x4bdd47,_0x184e31){return db[_0x780e('0x2c')][_0x780e('0x4c')]()['then'](respondWithResult(_0x184e31,null))[_0x780e('0x45')](handleError(_0x184e31,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6878923..8f540ef 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 _0x4ee7=['exports','define','IntegrationReport','report_integration','lodash','api','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ee7,0x17c));var _0x74ee=function(_0x4a06e3,_0x215889){_0x4a06e3=_0x4a06e3-0x0;var _0x1320ef=_0x4ee7[_0x4a06e3];return _0x1320ef;};'use strict';var _=require(_0x74ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x74ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74ee('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74ee('0x3'));var attributes=require('./integrationReport.attributes');module[_0x74ee('0x4')]=function(_0xb52978,_0x10af4e){return _0xb52978[_0x74ee('0x5')](_0x74ee('0x6'),attributes,{'tableName':_0x74ee('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c1=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x12306d,_0x2b8f14){var _0x16804f=function(_0x2a6dee){while(--_0x2a6dee){_0x12306d['push'](_0x12306d['shift']());}};_0x16804f(++_0x2b8f14);}(_0x63c1,0x142));var _0x163c=function(_0x2003ab,_0x45d0a1){_0x2003ab=_0x2003ab-0x0;var _0x4153b5=_0x63c1[_0x2003ab];return _0x4153b5;};'use strict';var _=require('lodash');var util=require(_0x163c('0x0'));var logger=require(_0x163c('0x1'))(_0x163c('0x2'));var moment=require(_0x163c('0x3'));var BPromise=require(_0x163c('0x4'));var rp=require(_0x163c('0x5'));var fs=require('fs');var path=require(_0x163c('0x6'));var rimraf=require('rimraf');var config=require(_0x163c('0x7'));var attributes=require('./integrationReport.attributes');module[_0x163c('0x8')]=function(_0x1bd363,_0x591796){return _0x1bd363[_0x163c('0x9')](_0x163c('0xa'),attributes,{'tableName':_0x163c('0xb'),'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 d5c923a..3ee3b90 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(_0x3379af,_0x416f71){var _0x30134e=function(_0x1e017a){while(--_0x1e017a){_0x3379af['push'](_0x3379af['shift']());}};_0x30134e(++_0x416f71);}(_0x31f0,0xb7));var _0x031f=function(_0x38a533,_0x13b2d3){_0x38a533=_0x38a533-0x0;var _0x918f56=_0x31f0[_0x38a533];return _0x918f56;};'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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x53ec,0x192));var _0xc53e=function(_0x1d0458,_0x389f29){_0x1d0458=_0x1d0458-0x0;var _0x35eea4=_0x53ec[_0x1d0458];return _0x35eea4;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index bb2b61d..65b60d3 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 _0xc029=['show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc029,0x1df));var _0x9c02=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0xc029[_0x1a2ef3];return _0x34f4a4;};'use strict';var multer=require(_0x9c02('0x0'));var util=require(_0x9c02('0x1'));var path=require(_0x9c02('0x2'));var timeout=require(_0x9c02('0x3'));var express=require(_0x9c02('0x4'));var router=express[_0x9c02('0x5')]();var fs_extra=require(_0x9c02('0x6'));var auth=require(_0x9c02('0x7'));var interaction=require(_0x9c02('0x8'));var config=require(_0x9c02('0x9'));var controller=require(_0x9c02('0xa'));router[_0x9c02('0xb')]('/',auth[_0x9c02('0xc')](),controller[_0x9c02('0xd')]);router[_0x9c02('0xb')](_0x9c02('0xe'),auth[_0x9c02('0xc')](),controller[_0x9c02('0xf')]);router['get'](_0x9c02('0x10'),auth['isAuthenticated'](),controller[_0x9c02('0x11')]);router[_0x9c02('0x12')]('/',auth[_0x9c02('0xc')](),controller[_0x9c02('0x13')]);router['post'](_0x9c02('0x10'),auth['isAuthenticated'](),controller[_0x9c02('0x14')]);router['post'](_0x9c02('0x15'),auth[_0x9c02('0xc')](),controller['addIntervals']);router[_0x9c02('0x16')](_0x9c02('0xe'),auth['isAuthenticated'](),controller[_0x9c02('0x17')]);router[_0x9c02('0x18')](_0x9c02('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9c02('0x19')]=router; \ No newline at end of file +var _0x6f76=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','getIntervals','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f76,0x14a));var _0x66f7=function(_0x4cbcc6,_0x142bde){_0x4cbcc6=_0x4cbcc6-0x0;var _0x596000=_0x6f76[_0x4cbcc6];return _0x596000;};'use strict';var multer=require(_0x66f7('0x0'));var util=require('util');var path=require(_0x66f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x66f7('0x2'));var router=express[_0x66f7('0x3')]();var fs_extra=require(_0x66f7('0x4'));var auth=require(_0x66f7('0x5'));var interaction=require(_0x66f7('0x6'));var config=require('../../config/environment');var controller=require(_0x66f7('0x7'));router[_0x66f7('0x8')]('/',auth[_0x66f7('0x9')](),controller[_0x66f7('0xa')]);router[_0x66f7('0x8')](_0x66f7('0xb'),auth[_0x66f7('0x9')](),controller['show']);router['get']('/:id/sub_intervals',auth[_0x66f7('0x9')](),controller[_0x66f7('0xc')]);router[_0x66f7('0xd')]('/',auth[_0x66f7('0x9')](),controller[_0x66f7('0xe')]);router['post']('/:id/sub_intervals',auth[_0x66f7('0x9')](),controller[_0x66f7('0xf')]);router['post'](_0x66f7('0x10'),auth[_0x66f7('0x9')](),controller[_0x66f7('0x11')]);router[_0x66f7('0x12')](_0x66f7('0xb'),auth['isAuthenticated'](),controller[_0x66f7('0x13')]);router[_0x66f7('0x14')]('/:id',auth[_0x66f7('0x9')](),controller[_0x66f7('0x15')]);module[_0x66f7('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f260397..fe2d90f 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 _0xe751=['exports','STRING','sequelize'];(function(_0x55e205,_0x38b0c1){var _0x14e333=function(_0x38a1f2){while(--_0x38a1f2){_0x55e205['push'](_0x55e205['shift']());}};_0x14e333(++_0x38b0c1);}(_0xe751,0xe9));var _0x1e75=function(_0x318db2,_0x589fbf){_0x318db2=_0x318db2-0x0;var _0x2fba39=_0xe751[_0x318db2];return _0x2fba39;};'use strict';var Sequelize=require(_0x1e75('0x0'));module[_0x1e75('0x1')]={'name':{'type':Sequelize[_0x1e75('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1e75('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x039e=['STRING','sequelize','exports'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x039e,0x178));var _0xe039=function(_0x3164e7,_0x2a1559){_0x3164e7=_0x3164e7-0x0;var _0x5068c0=_0x039e[_0x3164e7];return _0x5068c0;};'use strict';var Sequelize=require(_0xe039('0x0'));module[_0xe039('0x1')]={'name':{'type':Sequelize[_0xe039('0x2')]},'description':{'type':Sequelize[_0xe039('0x2')]},'interval':{'type':Sequelize[_0xe039('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 250fc0c..aa9cd1c 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 _0xd309=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','end','name','Interval','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include','findAll','rows','show','params','keys','fields','options','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','create','error','IntervalId','getIntervals','findOne','pick','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd309,0x14b));var _0x9d30=function(_0x494a34,_0x48394c){_0x494a34=_0x494a34-0x0;var _0x1e73b3=_0xd309[_0x494a34];return _0x1e73b3;};'use strict';var emlformat=require(_0x9d30('0x0'));var rimraf=require(_0x9d30('0x1'));var zipdir=require(_0x9d30('0x2'));var jsonpatch=require(_0x9d30('0x3'));var rp=require(_0x9d30('0x4'));var moment=require(_0x9d30('0x5'));var BPromise=require(_0x9d30('0x6'));var Mustache=require(_0x9d30('0x7'));var util=require('util');var path=require(_0x9d30('0x8'));var sox=require(_0x9d30('0x9'));var csv=require(_0x9d30('0xa'));var ejs=require(_0x9d30('0xb'));var fs=require('fs');var fs_extra=require(_0x9d30('0xc'));var _=require(_0x9d30('0xd'));var squel=require('squel');var crypto=require(_0x9d30('0xe'));var jsforce=require(_0x9d30('0xf'));var deskjs=require(_0x9d30('0x10'));var toCsv=require(_0x9d30('0xa'));var querystring=require('querystring');var Papa=require(_0x9d30('0x11'));var Redis=require(_0x9d30('0x12'));var authService=require(_0x9d30('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9d30('0x14'));var hardwareService=require(_0x9d30('0x15'));var logger=require(_0x9d30('0x16'))('api');var utils=require(_0x9d30('0x17'));var config=require(_0x9d30('0x18'));var licenseUtil=require(_0x9d30('0x19'));var db=require(_0x9d30('0x1a'))['db'];var extensions=require(_0x9d30('0x1b'));function respondWithStatusCode(_0x22509c,_0x40c628){_0x40c628=_0x40c628||0xcc;return function(_0x3c5f42){if(_0x3c5f42){return _0x22509c[_0x9d30('0x1c')](_0x40c628);}return _0x22509c[_0x9d30('0x1d')](_0x40c628)['end']();};}function respondWithResult(_0x415943,_0x1e9a33){_0x1e9a33=_0x1e9a33||0xc8;return function(_0x109ab1){if(_0x109ab1){return _0x415943[_0x9d30('0x1d')](_0x1e9a33)['json'](_0x109ab1);}};}function respondWithFilteredResult(_0xdfb97a,_0x4dd76e){return function(_0x589e99){if(_0x589e99){var _0x1a121e=typeof _0x4dd76e[_0x9d30('0x1e')]===_0x9d30('0x1f')&&typeof _0x4dd76e['limit']===_0x9d30('0x1f');var _0x5ca628=_0x589e99[_0x9d30('0x20')];var _0x3763e2=_0x1a121e?0x0:_0x4dd76e[_0x9d30('0x1e')];var _0x5636d2=_0x1a121e?_0x589e99[_0x9d30('0x20')]:_0x4dd76e['offset']+_0x4dd76e[_0x9d30('0x21')];var _0x512bdc;if(_0x5636d2>=_0x5ca628){_0x5636d2=_0x5ca628;_0x512bdc=0xc8;}else{_0x512bdc=0xce;}_0xdfb97a[_0x9d30('0x1d')](_0x512bdc);return _0xdfb97a['set'](_0x9d30('0x22'),_0x3763e2+'-'+_0x5636d2+'/'+_0x5ca628)['json'](_0x589e99);}return null;};}function patchUpdates(_0x53258a){return function(_0x2bd510){try{jsonpatch[_0x9d30('0x23')](_0x2bd510,_0x53258a,!![]);}catch(_0x5541f2){return BPromise[_0x9d30('0x24')](_0x5541f2);}return _0x2bd510[_0x9d30('0x25')]();};}function saveUpdates(_0x393378,_0x3f6ba6){return function(_0x2cbb6a){if(_0x2cbb6a){return _0x2cbb6a['update'](_0x393378)[_0x9d30('0x26')](function(_0x5d06df){return _0x5d06df;});}return null;};}function removeEntity(_0x49ad8e,_0x5231be){return function(_0x2d0494){if(_0x2d0494){return _0x2d0494[_0x9d30('0x27')]()['then'](function(){var _0x35762d=_0x2d0494[_0x9d30('0x28')]({'plain':!![]});var _0x2c404e=_0x9d30('0x29');return db[_0x9d30('0x2a')]['destroy']({'where':{'type':_0x2c404e,'resourceId':_0x35762d['id']}})[_0x9d30('0x26')](function(){return _0x2d0494;});})['then'](function(){_0x49ad8e[_0x9d30('0x1d')](0xcc)[_0x9d30('0x2b')]();});}};}function handleEntityNotFound(_0x587eb4,_0x526463){return function(_0x183d38){if(!_0x183d38){_0x587eb4['sendStatus'](0x194);}return _0x183d38;};}function handleError(_0x4d8a01,_0x4ae568){_0x4ae568=_0x4ae568||0x1f4;return function(_0x324f5b){logger['error'](_0x324f5b['stack']);if(_0x324f5b[_0x9d30('0x2c')]){delete _0x324f5b[_0x9d30('0x2c')];}_0x4d8a01['status'](_0x4ae568)['send'](_0x324f5b);};}exports['index']=function(_0x416b57,_0x2bd959){var _0x57e24b={},_0x1831ea={},_0x1d7dd3={'count':0x0,'rows':[]};var _0x3b5481=_['map'](db[_0x9d30('0x2d')][_0x9d30('0x2e')],function(_0x4b5ca7){return{'name':_0x4b5ca7[_0x9d30('0x2f')],'type':_0x4b5ca7['type']['key']};});_0x1831ea[_0x9d30('0x30')]=_[_0x9d30('0x31')](_0x3b5481,_0x9d30('0x2c'));_0x1831ea[_0x9d30('0x32')]=_['keys'](_0x416b57[_0x9d30('0x32')]);_0x1831ea[_0x9d30('0x33')]=_['intersection'](_0x1831ea[_0x9d30('0x30')],_0x1831ea['query']);_0x57e24b[_0x9d30('0x34')]=_[_0x9d30('0x35')](_0x1831ea['model'],qs['fields'](_0x416b57[_0x9d30('0x32')]['fields']));_0x57e24b['attributes']=_0x57e24b[_0x9d30('0x34')][_0x9d30('0x36')]?_0x57e24b[_0x9d30('0x34')]:_0x1831ea[_0x9d30('0x30')];if(!_0x416b57[_0x9d30('0x32')][_0x9d30('0x37')](_0x9d30('0x38'))){_0x57e24b['limit']=qs[_0x9d30('0x21')](_0x416b57[_0x9d30('0x32')][_0x9d30('0x21')]);_0x57e24b[_0x9d30('0x1e')]=qs['offset'](_0x416b57[_0x9d30('0x32')][_0x9d30('0x1e')]);}_0x57e24b[_0x9d30('0x39')]=qs[_0x9d30('0x3a')](_0x416b57[_0x9d30('0x32')]['sort']);_0x57e24b[_0x9d30('0x3b')]=qs[_0x9d30('0x33')](_['pick'](_0x416b57['query'],_0x1831ea[_0x9d30('0x33')]),_0x3b5481);if(_0x416b57[_0x9d30('0x32')][_0x9d30('0x3c')]){_0x57e24b[_0x9d30('0x3b')]=_['merge'](_0x57e24b[_0x9d30('0x3b')],{'$or':_[_0x9d30('0x31')](_0x3b5481,function(_0x4c6c58){if(_0x4c6c58[_0x9d30('0x3d')]!=='VIRTUAL'){var _0x58f0cd={};_0x58f0cd[_0x4c6c58[_0x9d30('0x2c')]]={'$like':'%'+_0x416b57[_0x9d30('0x32')]['filter']+'%'};return _0x58f0cd;}})});}_0x57e24b=_[_0x9d30('0x3e')]({},_0x57e24b,_0x416b57['options']);var _0x943697={'where':_0x57e24b['where']};return db[_0x9d30('0x2d')]['count'](_0x943697)['then'](function(_0x9ae72c){_0x1d7dd3[_0x9d30('0x20')]=_0x9ae72c;if(_0x416b57[_0x9d30('0x32')][_0x9d30('0x3f')]){_0x57e24b[_0x9d30('0x40')]=[{'all':!![]}];}return db[_0x9d30('0x2d')][_0x9d30('0x41')](_0x57e24b);})[_0x9d30('0x26')](function(_0x5cb65d){_0x1d7dd3[_0x9d30('0x42')]=_0x5cb65d;return _0x1d7dd3;})['then'](respondWithFilteredResult(_0x2bd959,_0x57e24b))['catch'](handleError(_0x2bd959,null));};exports[_0x9d30('0x43')]=function(_0x2577e9,_0x514116){var _0x2fa098={'raw':!![],'where':{'id':_0x2577e9[_0x9d30('0x44')]['id']}},_0xe2d657={};_0xe2d657[_0x9d30('0x30')]=_['keys'](db[_0x9d30('0x2d')]['rawAttributes']);_0xe2d657[_0x9d30('0x32')]=_[_0x9d30('0x45')](_0x2577e9[_0x9d30('0x32')]);_0xe2d657[_0x9d30('0x33')]=_[_0x9d30('0x35')](_0xe2d657[_0x9d30('0x30')],_0xe2d657[_0x9d30('0x32')]);_0x2fa098[_0x9d30('0x34')]=_[_0x9d30('0x35')](_0xe2d657[_0x9d30('0x30')],qs[_0x9d30('0x46')](_0x2577e9[_0x9d30('0x32')][_0x9d30('0x46')]));_0x2fa098[_0x9d30('0x34')]=_0x2fa098[_0x9d30('0x34')][_0x9d30('0x36')]?_0x2fa098[_0x9d30('0x34')]:_0xe2d657[_0x9d30('0x30')];if(_0x2577e9['query'][_0x9d30('0x3f')]){_0x2fa098[_0x9d30('0x40')]=[{'all':!![]}];}_0x2fa098=_[_0x9d30('0x3e')]({},_0x2fa098,_0x2577e9[_0x9d30('0x47')]);return db[_0x9d30('0x2d')][_0x9d30('0x48')](_0x2fa098)['then'](handleEntityNotFound(_0x514116,null))[_0x9d30('0x26')](respondWithResult(_0x514116,null))[_0x9d30('0x49')](handleError(_0x514116,null));};exports['create']=function(_0x5103ea,_0x479a59){return db['Interval']['create'](_0x5103ea[_0x9d30('0x4a')],{})[_0x9d30('0x26')](function(_0x1484ea){var _0x349e79=_0x5103ea['user']['get']({'plain':!![]});if(!_0x349e79)throw new Error(_0x9d30('0x4b'));if(_0x349e79[_0x9d30('0x4c')]===_0x9d30('0x4d')){var _0x10b1ca=_0x1484ea[_0x9d30('0x28')]({'plain':!![]});var _0x4ca225=_0x9d30('0x29');return db['UserProfileSection'][_0x9d30('0x48')]({'where':{'name':_0x4ca225,'userProfileId':_0x349e79[_0x9d30('0x4e')]},'raw':!![]})['then'](function(_0x5bbb71){if(_0x5bbb71&&_0x5bbb71[_0x9d30('0x4f')]===0x0){return db['UserProfileResource'][_0x9d30('0x50')]({'name':_0x10b1ca[_0x9d30('0x2c')],'resourceId':_0x10b1ca['id'],'type':_0x5bbb71[_0x9d30('0x2c')],'sectionId':_0x5bbb71['id']},{})[_0x9d30('0x26')](function(){return _0x1484ea;});}else{return _0x1484ea;}})['catch'](function(_0x29b55f){logger[_0x9d30('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29b55f);throw _0x29b55f;});}return _0x1484ea;})[_0x9d30('0x26')](respondWithResult(_0x479a59,0xc9))[_0x9d30('0x49')](handleError(_0x479a59,null));};exports['update']=function(_0x8ee47,_0x29ffdb){if(_0x8ee47[_0x9d30('0x4a')]['id']){delete _0x8ee47['body']['id'];}return db['Interval'][_0x9d30('0x48')]({'where':{'id':_0x8ee47[_0x9d30('0x44')]['id']}})['then'](handleEntityNotFound(_0x29ffdb,null))[_0x9d30('0x26')](saveUpdates(_0x8ee47['body'],null))[_0x9d30('0x26')](respondWithResult(_0x29ffdb,null))['catch'](handleError(_0x29ffdb,null));};exports[_0x9d30('0x27')]=function(_0x1414a2,_0x6dd097){return db[_0x9d30('0x2d')][_0x9d30('0x48')]({'where':{'id':_0x1414a2[_0x9d30('0x44')]['id']}})[_0x9d30('0x26')](handleEntityNotFound(_0x6dd097,null))['then'](removeEntity(_0x6dd097,null))[_0x9d30('0x49')](handleError(_0x6dd097,null));};exports['addInterval']=function(_0x3536ca,_0x5d3183,_0x4795a7){if(_0x3536ca['body']['id']){delete _0x3536ca[_0x9d30('0x4a')]['id'];}return db[_0x9d30('0x2d')]['find']({'where':{'id':_0x3536ca[_0x9d30('0x44')]['id']}})[_0x9d30('0x26')](handleEntityNotFound(_0x5d3183,null))['then'](function(_0x50ddcc){if(_0x50ddcc){_0x3536ca[_0x9d30('0x4a')][_0x9d30('0x52')]=_0x50ddcc['id'];return db[_0x9d30('0x2d')][_0x9d30('0x50')](_0x3536ca[_0x9d30('0x4a')]);}})['then'](respondWithResult(_0x5d3183,null))[_0x9d30('0x49')](handleError(_0x5d3183,null));};exports[_0x9d30('0x53')]=function(_0x25eebf,_0x243c6d,_0x23611d){var _0x3ea63a={};var _0x2e0409={};var _0x33a461;var _0x526f69;return db[_0x9d30('0x2d')][_0x9d30('0x54')]({'where':{'id':_0x25eebf[_0x9d30('0x44')]['id']}})['then'](handleEntityNotFound(_0x243c6d,null))[_0x9d30('0x26')](function(_0x447030){if(_0x447030){_0x33a461=_0x447030;_0x2e0409[_0x9d30('0x30')]=_[_0x9d30('0x45')](db['Interval'][_0x9d30('0x2e')]);_0x2e0409[_0x9d30('0x32')]=_['keys'](_0x25eebf[_0x9d30('0x32')]);_0x2e0409[_0x9d30('0x33')]=_['intersection'](_0x2e0409[_0x9d30('0x30')],_0x2e0409[_0x9d30('0x32')]);_0x3ea63a[_0x9d30('0x34')]=_[_0x9d30('0x35')](_0x2e0409[_0x9d30('0x30')],qs['fields'](_0x25eebf['query']['fields']));_0x3ea63a['attributes']=_0x3ea63a[_0x9d30('0x34')][_0x9d30('0x36')]?_0x3ea63a[_0x9d30('0x34')]:_0x2e0409[_0x9d30('0x30')];_0x3ea63a[_0x9d30('0x39')]=qs[_0x9d30('0x3a')](_0x25eebf[_0x9d30('0x32')][_0x9d30('0x3a')]);_0x3ea63a[_0x9d30('0x3b')]=qs[_0x9d30('0x33')](_[_0x9d30('0x55')](_0x25eebf[_0x9d30('0x32')],_0x2e0409[_0x9d30('0x33')]));if(_0x25eebf[_0x9d30('0x32')][_0x9d30('0x3c')]){_0x3ea63a[_0x9d30('0x3b')]=_[_0x9d30('0x3e')](_0x3ea63a[_0x9d30('0x3b')],{'$or':_['map'](_0x3ea63a[_0x9d30('0x34')],function(_0x4fd111){var _0x571cd7={};_0x571cd7[_0x4fd111]={'$like':'%'+_0x25eebf[_0x9d30('0x32')][_0x9d30('0x3c')]+'%'};return _0x571cd7;})});}_0x3ea63a=_['merge']({},_0x3ea63a,_0x25eebf[_0x9d30('0x47')]);return _0x33a461[_0x9d30('0x53')](_0x3ea63a);}})['then'](function(_0x4c7f49){if(_0x4c7f49){_0x526f69=_0x4c7f49['length'];if(!_0x25eebf[_0x9d30('0x32')][_0x9d30('0x37')](_0x9d30('0x38'))){_0x3ea63a[_0x9d30('0x21')]=qs[_0x9d30('0x21')](_0x25eebf[_0x9d30('0x32')][_0x9d30('0x21')]);_0x3ea63a['offset']=qs[_0x9d30('0x1e')](_0x25eebf[_0x9d30('0x32')]['offset']);}return _0x33a461[_0x9d30('0x53')](_0x3ea63a);}})[_0x9d30('0x26')](function(_0x20689b){if(_0x20689b){return _0x20689b?{'count':_0x526f69,'rows':_0x20689b}:null;}})[_0x9d30('0x26')](respondWithResult(_0x243c6d,null))[_0x9d30('0x49')](handleError(_0x243c6d,null));};exports['addIntervals']=function(_0x5005d3,_0x22a80a,_0x6a9d99){return db[_0x9d30('0x2d')][_0x9d30('0x54')]({'where':{'id':_0x5005d3[_0x9d30('0x44')]['id']}})['then'](handleEntityNotFound(_0x22a80a,null))[_0x9d30('0x26')](function(_0x2be135){if(_0x2be135){return db[_0x9d30('0x56')]['transaction'](function(_0x25796a){return db[_0x9d30('0x2d')][_0x9d30('0x27')]({'where':{'IntervalId':_0x5005d3['params']['id']},'transaction':_0x25796a})['then'](function(_0x1c9f42){var _0x48180f=_[_0x9d30('0x31')](_0x5005d3[_0x9d30('0x4a')],function(_0x1535fa){delete _0x1535fa['id'];_0x1535fa['IntervalId']=_0x5005d3[_0x9d30('0x44')]['id'];return _0x1535fa;});return db[_0x9d30('0x2d')]['bulkCreate'](_0x48180f,{'transaction':_0x25796a});});})[_0x9d30('0x26')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x5005d3[_0x9d30('0x44')]['id']}});});}})[_0x9d30('0x26')](respondWithResult(_0x22a80a,null))['catch'](handleError(_0x22a80a,null));}; \ No newline at end of file +var _0x8b5b=['transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','Intervals','destroy','end','sendStatus','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','pick','addIntervals','sequelize'];(function(_0x4632ac,_0x5decf9){var _0x690cfc=function(_0x5caa6c){while(--_0x5caa6c){_0x4632ac['push'](_0x4632ac['shift']());}};_0x690cfc(++_0x5decf9);}(_0x8b5b,0x1ba));var _0xb8b5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8b5b[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xb8b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8b5('0x1'));var rp=require(_0xb8b5('0x2'));var moment=require(_0xb8b5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb8b5('0x4'));var sox=require(_0xb8b5('0x5'));var csv=require(_0xb8b5('0x6'));var ejs=require(_0xb8b5('0x7'));var fs=require('fs');var fs_extra=require(_0xb8b5('0x8'));var _=require(_0xb8b5('0x9'));var squel=require(_0xb8b5('0xa'));var crypto=require(_0xb8b5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8b5('0xc'));var Redis=require(_0xb8b5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb8b5('0xe'));var as=require(_0xb8b5('0xf'));var hardwareService=require(_0xb8b5('0x10'));var logger=require(_0xb8b5('0x11'))(_0xb8b5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb8b5('0x13'));var db=require(_0xb8b5('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x8f3806,_0x37766b){_0x37766b=_0x37766b||0xcc;return function(_0x28f6a0){if(_0x28f6a0){return _0x8f3806['sendStatus'](_0x37766b);}return _0x8f3806[_0xb8b5('0x15')](_0x37766b)['end']();};}function respondWithResult(_0x4b76d2,_0x353894){_0x353894=_0x353894||0xc8;return function(_0x1419be){if(_0x1419be){return _0x4b76d2[_0xb8b5('0x15')](_0x353894)[_0xb8b5('0x16')](_0x1419be);}};}function respondWithFilteredResult(_0x46e653,_0x4fa972){return function(_0x9b2d21){if(_0x9b2d21){var _0x215a0c=typeof _0x4fa972[_0xb8b5('0x17')]===_0xb8b5('0x18')&&typeof _0x4fa972[_0xb8b5('0x19')]==='undefined';var _0x3760fb=_0x9b2d21[_0xb8b5('0x1a')];var _0x2cbc5e=_0x215a0c?0x0:_0x4fa972[_0xb8b5('0x17')];var _0x54c37c=_0x215a0c?_0x9b2d21[_0xb8b5('0x1a')]:_0x4fa972[_0xb8b5('0x17')]+_0x4fa972[_0xb8b5('0x19')];var _0x7ccfb3;if(_0x54c37c>=_0x3760fb){_0x54c37c=_0x3760fb;_0x7ccfb3=0xc8;}else{_0x7ccfb3=0xce;}_0x46e653[_0xb8b5('0x15')](_0x7ccfb3);return _0x46e653[_0xb8b5('0x1b')](_0xb8b5('0x1c'),_0x2cbc5e+'-'+_0x54c37c+'/'+_0x3760fb)[_0xb8b5('0x16')](_0x9b2d21);}return null;};}function patchUpdates(_0xcbfd4b){return function(_0x44d866){try{jsonpatch[_0xb8b5('0x1d')](_0x44d866,_0xcbfd4b,!![]);}catch(_0x2b409a){return BPromise['reject'](_0x2b409a);}return _0x44d866['save']();};}function saveUpdates(_0x36aaf9,_0x3f01a4){return function(_0x2c0a77){if(_0x2c0a77){return _0x2c0a77[_0xb8b5('0x1e')](_0x36aaf9)['then'](function(_0xea7b0e){return _0xea7b0e;});}return null;};}function removeEntity(_0x5986c4,_0x20be53){return function(_0x315191){if(_0x315191){return _0x315191['destroy']()[_0xb8b5('0x1f')](function(){var _0x5b94cc=_0x315191[_0xb8b5('0x20')]({'plain':!![]});var _0x1b6c17=_0xb8b5('0x21');return db['UserProfileResource'][_0xb8b5('0x22')]({'where':{'type':_0x1b6c17,'resourceId':_0x5b94cc['id']}})[_0xb8b5('0x1f')](function(){return _0x315191;});})['then'](function(){_0x5986c4[_0xb8b5('0x15')](0xcc)[_0xb8b5('0x23')]();});}};}function handleEntityNotFound(_0x237355,_0x44f0f4){return function(_0x563169){if(!_0x563169){_0x237355[_0xb8b5('0x24')](0x194);}return _0x563169;};}function handleError(_0x2201e5,_0x2115fc){_0x2115fc=_0x2115fc||0x1f4;return function(_0xe73de3){logger['error'](_0xe73de3[_0xb8b5('0x25')]);if(_0xe73de3['name']){delete _0xe73de3[_0xb8b5('0x26')];}_0x2201e5[_0xb8b5('0x15')](_0x2115fc)[_0xb8b5('0x27')](_0xe73de3);};}exports[_0xb8b5('0x28')]=function(_0x5dbed1,_0x586fd6){var _0x143f76={},_0x5ba156={},_0x32fd52={'count':0x0,'rows':[]};var _0x4e632b=_[_0xb8b5('0x29')](db[_0xb8b5('0x2a')][_0xb8b5('0x2b')],function(_0x2b13e6){return{'name':_0x2b13e6['fieldName'],'type':_0x2b13e6[_0xb8b5('0x2c')][_0xb8b5('0x2d')]};});_0x5ba156[_0xb8b5('0x2e')]=_[_0xb8b5('0x29')](_0x4e632b,_0xb8b5('0x26'));_0x5ba156[_0xb8b5('0x2f')]=_[_0xb8b5('0x30')](_0x5dbed1[_0xb8b5('0x2f')]);_0x5ba156[_0xb8b5('0x31')]=_['intersection'](_0x5ba156[_0xb8b5('0x2e')],_0x5ba156['query']);_0x143f76[_0xb8b5('0x32')]=_[_0xb8b5('0x33')](_0x5ba156[_0xb8b5('0x2e')],qs['fields'](_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x34')]));_0x143f76[_0xb8b5('0x32')]=_0x143f76[_0xb8b5('0x32')][_0xb8b5('0x35')]?_0x143f76[_0xb8b5('0x32')]:_0x5ba156['model'];if(!_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x36')](_0xb8b5('0x37'))){_0x143f76[_0xb8b5('0x19')]=qs[_0xb8b5('0x19')](_0x5dbed1[_0xb8b5('0x2f')]['limit']);_0x143f76[_0xb8b5('0x17')]=qs['offset'](_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x17')]);}_0x143f76['order']=qs[_0xb8b5('0x38')](_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x38')]);_0x143f76[_0xb8b5('0x39')]=qs[_0xb8b5('0x31')](_['pick'](_0x5dbed1[_0xb8b5('0x2f')],_0x5ba156['filters']),_0x4e632b);if(_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x3a')]){_0x143f76['where']=_['merge'](_0x143f76[_0xb8b5('0x39')],{'$or':_[_0xb8b5('0x29')](_0x4e632b,function(_0x1a51f6){if(_0x1a51f6[_0xb8b5('0x2c')]!==_0xb8b5('0x3b')){var _0x15eabd={};_0x15eabd[_0x1a51f6[_0xb8b5('0x26')]]={'$like':'%'+_0x5dbed1[_0xb8b5('0x2f')][_0xb8b5('0x3a')]+'%'};return _0x15eabd;}})});}_0x143f76=_['merge']({},_0x143f76,_0x5dbed1[_0xb8b5('0x3c')]);var _0x15b372={'where':_0x143f76[_0xb8b5('0x39')]};return db[_0xb8b5('0x2a')]['count'](_0x15b372)[_0xb8b5('0x1f')](function(_0x2da74c){_0x32fd52[_0xb8b5('0x1a')]=_0x2da74c;if(_0x5dbed1[_0xb8b5('0x2f')]['includeAll']){_0x143f76[_0xb8b5('0x3d')]=[{'all':!![]}];}return db[_0xb8b5('0x2a')][_0xb8b5('0x3e')](_0x143f76);})[_0xb8b5('0x1f')](function(_0x2532f3){_0x32fd52[_0xb8b5('0x3f')]=_0x2532f3;return _0x32fd52;})['then'](respondWithFilteredResult(_0x586fd6,_0x143f76))[_0xb8b5('0x40')](handleError(_0x586fd6,null));};exports['show']=function(_0x5efa0a,_0x353022){var _0x36d71f={'raw':!![],'where':{'id':_0x5efa0a[_0xb8b5('0x41')]['id']}},_0x47845a={};_0x47845a['model']=_[_0xb8b5('0x30')](db['Interval'][_0xb8b5('0x2b')]);_0x47845a[_0xb8b5('0x2f')]=_[_0xb8b5('0x30')](_0x5efa0a['query']);_0x47845a[_0xb8b5('0x31')]=_[_0xb8b5('0x33')](_0x47845a[_0xb8b5('0x2e')],_0x47845a[_0xb8b5('0x2f')]);_0x36d71f['attributes']=_[_0xb8b5('0x33')](_0x47845a['model'],qs[_0xb8b5('0x34')](_0x5efa0a[_0xb8b5('0x2f')][_0xb8b5('0x34')]));_0x36d71f[_0xb8b5('0x32')]=_0x36d71f[_0xb8b5('0x32')][_0xb8b5('0x35')]?_0x36d71f[_0xb8b5('0x32')]:_0x47845a['model'];if(_0x5efa0a[_0xb8b5('0x2f')]['includeAll']){_0x36d71f['include']=[{'all':!![]}];}_0x36d71f=_[_0xb8b5('0x42')]({},_0x36d71f,_0x5efa0a[_0xb8b5('0x3c')]);return db[_0xb8b5('0x2a')]['find'](_0x36d71f)[_0xb8b5('0x1f')](handleEntityNotFound(_0x353022,null))[_0xb8b5('0x1f')](respondWithResult(_0x353022,null))[_0xb8b5('0x40')](handleError(_0x353022,null));};exports[_0xb8b5('0x43')]=function(_0x564790,_0x20277f){return db['Interval'][_0xb8b5('0x43')](_0x564790[_0xb8b5('0x44')],{})['then'](function(_0x1cd975){var _0x3c4ee1=_0x564790[_0xb8b5('0x45')][_0xb8b5('0x20')]({'plain':!![]});if(!_0x3c4ee1)throw new Error(_0xb8b5('0x46'));if(_0x3c4ee1[_0xb8b5('0x47')]===_0xb8b5('0x45')){var _0x187b52=_0x1cd975[_0xb8b5('0x20')]({'plain':!![]});var _0x5ccf43='Intervals';return db['UserProfileSection'][_0xb8b5('0x48')]({'where':{'name':_0x5ccf43,'userProfileId':_0x3c4ee1[_0xb8b5('0x49')]},'raw':!![]})['then'](function(_0x4aeccb){if(_0x4aeccb&&_0x4aeccb[_0xb8b5('0x4a')]===0x0){return db[_0xb8b5('0x4b')][_0xb8b5('0x43')]({'name':_0x187b52[_0xb8b5('0x26')],'resourceId':_0x187b52['id'],'type':_0x4aeccb['name'],'sectionId':_0x4aeccb['id']},{})[_0xb8b5('0x1f')](function(){return _0x1cd975;});}else{return _0x1cd975;}})[_0xb8b5('0x40')](function(_0x1fc759){logger[_0xb8b5('0x4c')](_0xb8b5('0x4d'),_0x1fc759);throw _0x1fc759;});}return _0x1cd975;})[_0xb8b5('0x1f')](respondWithResult(_0x20277f,0xc9))['catch'](handleError(_0x20277f,null));};exports[_0xb8b5('0x1e')]=function(_0x1f01ea,_0x11c95e){if(_0x1f01ea['body']['id']){delete _0x1f01ea[_0xb8b5('0x44')]['id'];}return db[_0xb8b5('0x2a')][_0xb8b5('0x48')]({'where':{'id':_0x1f01ea[_0xb8b5('0x41')]['id']}})[_0xb8b5('0x1f')](handleEntityNotFound(_0x11c95e,null))[_0xb8b5('0x1f')](saveUpdates(_0x1f01ea['body'],null))[_0xb8b5('0x1f')](respondWithResult(_0x11c95e,null))[_0xb8b5('0x40')](handleError(_0x11c95e,null));};exports[_0xb8b5('0x22')]=function(_0x4cd336,_0x1480b2){return db['Interval'][_0xb8b5('0x48')]({'where':{'id':_0x4cd336[_0xb8b5('0x41')]['id']}})[_0xb8b5('0x1f')](handleEntityNotFound(_0x1480b2,null))['then'](removeEntity(_0x1480b2,null))[_0xb8b5('0x40')](handleError(_0x1480b2,null));};exports[_0xb8b5('0x4e')]=function(_0xd7be5c,_0x2fcc51,_0x592c41){if(_0xd7be5c[_0xb8b5('0x44')]['id']){delete _0xd7be5c[_0xb8b5('0x44')]['id'];}return db[_0xb8b5('0x2a')]['find']({'where':{'id':_0xd7be5c[_0xb8b5('0x41')]['id']}})[_0xb8b5('0x1f')](handleEntityNotFound(_0x2fcc51,null))[_0xb8b5('0x1f')](function(_0x3992cd){if(_0x3992cd){_0xd7be5c['body'][_0xb8b5('0x4f')]=_0x3992cd['id'];return db[_0xb8b5('0x2a')]['create'](_0xd7be5c[_0xb8b5('0x44')]);}})['then'](respondWithResult(_0x2fcc51,null))[_0xb8b5('0x40')](handleError(_0x2fcc51,null));};exports[_0xb8b5('0x50')]=function(_0x1ea911,_0x2c4547,_0x474b49){var _0x3ed04f={};var _0x3bfad0={};var _0x30551f;var _0x5c72d3;return db[_0xb8b5('0x2a')][_0xb8b5('0x51')]({'where':{'id':_0x1ea911['params']['id']}})[_0xb8b5('0x1f')](handleEntityNotFound(_0x2c4547,null))[_0xb8b5('0x1f')](function(_0x2dafc5){if(_0x2dafc5){_0x30551f=_0x2dafc5;_0x3bfad0[_0xb8b5('0x2e')]=_['keys'](db[_0xb8b5('0x2a')][_0xb8b5('0x2b')]);_0x3bfad0[_0xb8b5('0x2f')]=_[_0xb8b5('0x30')](_0x1ea911['query']);_0x3bfad0['filters']=_[_0xb8b5('0x33')](_0x3bfad0[_0xb8b5('0x2e')],_0x3bfad0[_0xb8b5('0x2f')]);_0x3ed04f[_0xb8b5('0x32')]=_['intersection'](_0x3bfad0['model'],qs[_0xb8b5('0x34')](_0x1ea911[_0xb8b5('0x2f')][_0xb8b5('0x34')]));_0x3ed04f[_0xb8b5('0x32')]=_0x3ed04f[_0xb8b5('0x32')]['length']?_0x3ed04f[_0xb8b5('0x32')]:_0x3bfad0[_0xb8b5('0x2e')];_0x3ed04f[_0xb8b5('0x52')]=qs[_0xb8b5('0x38')](_0x1ea911[_0xb8b5('0x2f')]['sort']);_0x3ed04f[_0xb8b5('0x39')]=qs[_0xb8b5('0x31')](_[_0xb8b5('0x53')](_0x1ea911[_0xb8b5('0x2f')],_0x3bfad0[_0xb8b5('0x31')]));if(_0x1ea911[_0xb8b5('0x2f')][_0xb8b5('0x3a')]){_0x3ed04f[_0xb8b5('0x39')]=_['merge'](_0x3ed04f[_0xb8b5('0x39')],{'$or':_['map'](_0x3ed04f[_0xb8b5('0x32')],function(_0x4fa44e){var _0x22bbf1={};_0x22bbf1[_0x4fa44e]={'$like':'%'+_0x1ea911['query'][_0xb8b5('0x3a')]+'%'};return _0x22bbf1;})});}_0x3ed04f=_['merge']({},_0x3ed04f,_0x1ea911[_0xb8b5('0x3c')]);return _0x30551f[_0xb8b5('0x50')](_0x3ed04f);}})['then'](function(_0x39bf83){if(_0x39bf83){_0x5c72d3=_0x39bf83[_0xb8b5('0x35')];if(!_0x1ea911[_0xb8b5('0x2f')][_0xb8b5('0x36')]('nolimit')){_0x3ed04f[_0xb8b5('0x19')]=qs['limit'](_0x1ea911[_0xb8b5('0x2f')][_0xb8b5('0x19')]);_0x3ed04f[_0xb8b5('0x17')]=qs['offset'](_0x1ea911[_0xb8b5('0x2f')][_0xb8b5('0x17')]);}return _0x30551f[_0xb8b5('0x50')](_0x3ed04f);}})[_0xb8b5('0x1f')](function(_0x147bc1){if(_0x147bc1){return _0x147bc1?{'count':_0x5c72d3,'rows':_0x147bc1}:null;}})[_0xb8b5('0x1f')](respondWithResult(_0x2c4547,null))[_0xb8b5('0x40')](handleError(_0x2c4547,null));};exports[_0xb8b5('0x54')]=function(_0x40e8a9,_0x37a561,_0x29aa39){return db[_0xb8b5('0x2a')][_0xb8b5('0x51')]({'where':{'id':_0x40e8a9[_0xb8b5('0x41')]['id']}})[_0xb8b5('0x1f')](handleEntityNotFound(_0x37a561,null))[_0xb8b5('0x1f')](function(_0x41af5b){if(_0x41af5b){return db[_0xb8b5('0x55')][_0xb8b5('0x56')](function(_0x32f560){return db[_0xb8b5('0x2a')]['destroy']({'where':{'IntervalId':_0x40e8a9[_0xb8b5('0x41')]['id']},'transaction':_0x32f560})[_0xb8b5('0x1f')](function(_0x1ca8f4){var _0x3f4cee=_[_0xb8b5('0x29')](_0x40e8a9[_0xb8b5('0x44')],function(_0x3271d6){delete _0x3271d6['id'];_0x3271d6[_0xb8b5('0x4f')]=_0x40e8a9[_0xb8b5('0x41')]['id'];return _0x3271d6;});return db['Interval'][_0xb8b5('0x57')](_0x3f4cee,{'transaction':_0x32f560});});})['then'](function(){return db[_0xb8b5('0x2a')]['findAll']({'where':{'IntervalId':_0x40e8a9['params']['id']}});});}})[_0xb8b5('0x1f')](respondWithResult(_0x37a561,null))[_0xb8b5('0x40')](handleError(_0x37a561,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 155fba4..28644f5 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 _0x49c1=['../../config/logger','api','moment','request-promise','path','../../config/environment','./interval.attributes','exports','define','tools_intervals','rewrite','lodash'];(function(_0x387ddb,_0x6af1b7){var _0x288939=function(_0x1cef11){while(--_0x1cef11){_0x387ddb['push'](_0x387ddb['shift']());}};_0x288939(++_0x6af1b7);}(_0x49c1,0xef));var _0x149c=function(_0x269d86,_0x549d58){_0x269d86=_0x269d86-0x0;var _0x1b0470=_0x49c1[_0x269d86];return _0x1b0470;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require(_0x149c('0x3'));var BPromise=require('bluebird');var rp=require(_0x149c('0x4'));var fs=require('fs');var path=require(_0x149c('0x5'));var rimraf=require('rimraf');var config=require(_0x149c('0x6'));var attributes=require(_0x149c('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x149c('0x8')]=function(_0x561d00,_0x33fa87){return _0x561d00[_0x149c('0x9')]('Interval',attributes,{'tableName':_0x149c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xfe0da6,_0x54bcc5){extensions[_0x149c('0xb')](_0x561d00,_0xfe0da6);},'afterBulkCreate':function(_0x350050,_0x486451,_0x3dc08d){_0x3dc08d();extensions[_0x149c('0xb')](_0x561d00,_0x350050[0x0]);},'afterUpdate':function(_0x44941e,_0x2c0c8b){extensions['rewrite'](_0x561d00,_0x44941e);},'afterDestroy':function(_0x307cb3,_0x172440){extensions[_0x149c('0xb')](_0x561d00,_0x307cb3);}}});}; \ No newline at end of file +var _0xb76f=['../../components/extensions/rewrite','exports','define','Interval','rewrite','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x32d88c,_0x33d140){var _0x239cae=function(_0x552534){while(--_0x552534){_0x32d88c['push'](_0x32d88c['shift']());}};_0x239cae(++_0x33d140);}(_0xb76f,0x94));var _0xfb76=function(_0x24da5f,_0x1c30ad){_0x24da5f=_0x24da5f-0x0;var _0x54882a=_0xb76f[_0x24da5f];return _0x54882a;};'use strict';var _=require('lodash');var util=require(_0xfb76('0x0'));var logger=require(_0xfb76('0x1'))('api');var moment=require(_0xfb76('0x2'));var BPromise=require(_0xfb76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb76('0x4'));var rimraf=require(_0xfb76('0x5'));var config=require(_0xfb76('0x6'));var attributes=require(_0xfb76('0x7'));var extensions=require(_0xfb76('0x8'));module[_0xfb76('0x9')]=function(_0x5216aa,_0x2ae776){return _0x5216aa[_0xfb76('0xa')](_0xfb76('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x288510,_0x292a46){extensions[_0xfb76('0xc')](_0x5216aa,_0x288510);},'afterBulkCreate':function(_0x385511,_0x2a08bf,_0x2246c7){_0x2246c7();extensions['rewrite'](_0x5216aa,_0x385511[0x0]);},'afterUpdate':function(_0x4dfada,_0x4c3f13){extensions[_0xfb76('0xc')](_0x5216aa,_0x4dfada);},'afterDestroy':function(_0x613854,_0x6ae640){extensions[_0xfb76('0xc')](_0x5216aa,_0x613854);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8fb84bb..ba7f548 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(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 13da294..7798553 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x474f47,_0x2303b7){var _0x21bfe6=function(_0x1121d1){while(--_0x1121d1){_0x474f47['push'](_0x474f47['shift']());}};_0x21bfe6(++_0x2303b7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c2c45,_0x14cc73){_0x5c2c45=_0x5c2c45-0x0;var _0x44e8dc=_0x5f2f[_0x5c2c45];return _0x44e8dc;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb10b,0x12a));var _0xbb10=function(_0x5be791,_0x94dd5a){_0x5be791=_0x5be791-0x0;var _0x2ea8b8=_0xb10b[_0x5be791];return _0x2ea8b8;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0d78961..411df52 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 _0xec8a=['../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','connection','socket','remoteAddress','bluebird','https'];(function(_0x50e97b,_0xf85ac8){var _0x1caf44=function(_0x5db84a){while(--_0x5db84a){_0x50e97b['push'](_0x50e97b['shift']());}};_0x1caf44(++_0xf85ac8);}(_0xec8a,0x124));var _0xaec8=function(_0x41e771,_0xb6f77c){_0x41e771=_0x41e771-0x0;var _0x17b517=_0xec8a[_0x41e771];return _0x17b517;};'use strict';var BPromise=require(_0xaec8('0x0'));var https=require(_0xaec8('0x1'));var logger=require(_0xaec8('0x2'))(_0xaec8('0x3'));var USERNAME=_0xaec8('0x4');var PASSWORD=_0xaec8('0x5');function openIssue(_0x1210bd,_0x43b251){var _0x1e87a4={'fields':{'project':{'key':_0x1210bd['key']||_0xaec8('0x6')},'summary':(_0x1210bd['summary']||_0xaec8('0x7'))+_0xaec8('0x8')+_0x1210bd['ip'],'description':_0x1210bd[_0xaec8('0x9')]||JSON[_0xaec8('0xa')](_0x1210bd),'issuetype':{'name':_0x1210bd[_0xaec8('0xb')]||'Bug'}}};_0x1e87a4[_0xaec8('0xc')][_0xaec8('0xd')]=_0x1210bd[_0xaec8('0xe')];_0x1e87a4[_0xaec8('0xc')][_0xaec8('0xf')]=_0x1210bd['oldToken'];_0x1e87a4[_0xaec8('0xc')]['customfield_11502']=_0x1210bd[_0xaec8('0x10')];_0x1e87a4[_0xaec8('0xc')][_0xaec8('0x11')]=_0x1210bd['name'];_0x1e87a4[_0xaec8('0xc')][_0xaec8('0x12')]=_0x1210bd[_0xaec8('0x13')];_0x1e87a4['fields'][_0xaec8('0x14')]=_0x1210bd['ip'];var _0x34ec04={'host':_0xaec8('0x15'),'port':0x1bb,'path':_0xaec8('0x16'),'method':_0xaec8('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xaec8('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xaec8('0x19')](_0xaec8('0x1a'))}};var _0x1edb7b=JSON[_0xaec8('0xa')](_0x1e87a4);var _0x136714=https[_0xaec8('0x1b')](_0x34ec04,function(_0x349120){_0x349120['setEncoding']('utf8');var _0x142806='';_0x349120['on'](_0xaec8('0x1c'),function(_0x44fd5f){_0x142806+=_0x44fd5f;});_0x349120['on'](_0xaec8('0x1d'),function(){if(_0x43b251){return _0x43b251[_0xaec8('0x1e')](_0x349120[_0xaec8('0x1f')])['json'](JSON['parse'](_0x142806));}});});_0x136714['on']('error',function(_0x40dbf2){if(_0x43b251){return _0x43b251['status'](0x1f4)[_0xaec8('0x20')]({'errors':[{'message':_0xaec8('0x21'),'type':_0xaec8('0x22')}]});}});_0x136714[_0xaec8('0x23')](_0x1edb7b);_0x136714[_0xaec8('0x1d')]();}exports[_0xaec8('0x24')]=openIssue;exports[_0xaec8('0x25')]=function(_0x5df134,_0x204f47){_0x5df134[_0xaec8('0x26')]['ip']=_0x5df134['headers']['x-forwarded-for']||_0x5df134[_0xaec8('0x27')]['remoteAddress']||_0x5df134[_0xaec8('0x28')][_0xaec8('0x29')]||_0x5df134[_0xaec8('0x27')][_0xaec8('0x28')][_0xaec8('0x29')];return openIssue(_0x5df134['body'],_0x204f47);}; \ No newline at end of file +var _0x5d9d=['data','end','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding'];(function(_0x47610b,_0x4e7a86){var _0x3a0848=function(_0x353fcd){while(--_0x353fcd){_0x47610b['push'](_0x47610b['shift']());}};_0x3a0848(++_0x4e7a86);}(_0x5d9d,0x69));var _0xd5d9=function(_0x1dedf3,_0x2b6a14){_0x1dedf3=_0x1dedf3-0x0;var _0x47231e=_0x5d9d[_0x1dedf3];return _0x47231e;};'use strict';var BPromise=require('bluebird');var https=require(_0xd5d9('0x0'));var logger=require(_0xd5d9('0x1'))(_0xd5d9('0x2'));var USERNAME=_0xd5d9('0x3');var PASSWORD=_0xd5d9('0x4');function openIssue(_0x284e32,_0x594efb){var _0x45e9e7={'fields':{'project':{'key':_0x284e32[_0xd5d9('0x5')]||_0xd5d9('0x6')},'summary':(_0x284e32[_0xd5d9('0x7')]||_0xd5d9('0x8'))+_0xd5d9('0x9')+_0x284e32['ip'],'description':_0x284e32[_0xd5d9('0xa')]||JSON['stringify'](_0x284e32),'issuetype':{'name':_0x284e32[_0xd5d9('0xb')]||_0xd5d9('0xc')}}};_0x45e9e7[_0xd5d9('0xd')][_0xd5d9('0xe')]=_0x284e32[_0xd5d9('0xf')];_0x45e9e7['fields'][_0xd5d9('0x10')]=_0x284e32[_0xd5d9('0x11')];_0x45e9e7[_0xd5d9('0xd')][_0xd5d9('0x12')]=_0x284e32[_0xd5d9('0x13')];_0x45e9e7[_0xd5d9('0xd')][_0xd5d9('0x14')]=_0x284e32[_0xd5d9('0x15')];_0x45e9e7[_0xd5d9('0xd')]['customfield_11504']=_0x284e32[_0xd5d9('0x16')];_0x45e9e7[_0xd5d9('0xd')][_0xd5d9('0x17')]=_0x284e32['ip'];var _0x3cd4eb={'host':_0xd5d9('0x18'),'port':0x1bb,'path':_0xd5d9('0x19'),'method':_0xd5d9('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xd5d9('0x1b'),'Authorization':_0xd5d9('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0xd5d9('0x1d')](_0xd5d9('0x1e'))}};var _0x41b534=JSON[_0xd5d9('0x1f')](_0x45e9e7);var _0x248a37=https['request'](_0x3cd4eb,function(_0x264e9e){_0x264e9e[_0xd5d9('0x20')]('utf8');var _0xa7f37b='';_0x264e9e['on'](_0xd5d9('0x21'),function(_0x5d0be3){_0xa7f37b+=_0x5d0be3;});_0x264e9e['on'](_0xd5d9('0x22'),function(){if(_0x594efb){return _0x594efb[_0xd5d9('0x23')](_0x264e9e['statusCode'])[_0xd5d9('0x24')](JSON['parse'](_0xa7f37b));}});});_0x248a37['on']('error',function(_0xb50f96){if(_0x594efb){return _0x594efb[_0xd5d9('0x23')](0x1f4)[_0xd5d9('0x24')]({'errors':[{'message':_0xd5d9('0x25'),'type':'api.jira'}]});}});_0x248a37[_0xd5d9('0x26')](_0x41b534);_0x248a37[_0xd5d9('0x22')]();}exports[_0xd5d9('0x27')]=openIssue;exports[_0xd5d9('0x28')]=function(_0x1b6954,_0x11ee1b){_0x1b6954[_0xd5d9('0x29')]['ip']=_0x1b6954['headers'][_0xd5d9('0x2a')]||_0x1b6954[_0xd5d9('0x2b')][_0xd5d9('0x2c')]||_0x1b6954[_0xd5d9('0x2d')][_0xd5d9('0x2c')]||_0x1b6954[_0xd5d9('0x2b')][_0xd5d9('0x2d')]['remoteAddress'];return openIssue(_0x1b6954[_0xd5d9('0x29')],_0x11ee1b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 559d2be..7b25fac 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 _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x4c87d8,_0x590f51){var _0x286a0e=function(_0x5ba47e){while(--_0x5ba47e){_0x4c87d8['push'](_0x4c87d8['shift']());}};_0x286a0e(++_0x590f51);}(_0x9bde,0xe1));var _0xe9bd=function(_0x290733,_0x503a42){_0x290733=_0x290733-0x0;var _0x6ddb2e=_0x9bde[_0x290733];return _0x6ddb2e;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5ff3=['/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x2b89d0,_0x955545){var _0x1ff7c2=function(_0x4b4acc){while(--_0x4b4acc){_0x2b89d0['push'](_0x2b89d0['shift']());}};_0x1ff7c2(++_0x955545);}(_0x5ff3,0x17d));var _0x35ff=function(_0x14553c,_0x97e038){_0x14553c=_0x14553c-0x0;var _0x55e1b1=_0x5ff3[_0x14553c];return _0x55e1b1;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var fs_extra=require(_0x35ff('0x3'));var auth=require(_0x35ff('0x4'));var interaction=require(_0x35ff('0x5'));var config=require('../../config/environment');var controller=require(_0x35ff('0x6'));router[_0x35ff('0x7')]('/',auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0x7')]('/describe',auth[_0x35ff('0x8')](),controller['describe']);router[_0x35ff('0x7')](_0x35ff('0xa'),auth[_0x35ff('0x8')](),controller['show']);router[_0x35ff('0xb')]('/',auth['isAuthenticated'](),controller[_0x35ff('0xc')]);router[_0x35ff('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x35ff('0xf')]);module[_0x35ff('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f8a0606..bced167 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x4dab63,_0x4e1903){_0x4dab63=_0x4dab63-0x0;var _0x405814=_0x7a54[_0x4dab63];return _0x405814;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x27ce96,_0x1d0b86){_0x27ce96=_0x27ce96-0x0;var _0x45bc37=_0x7a54[_0x27ce96];return _0x45bc37;};'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 ec641e9..0c507b9 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 _0xe7de=['limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','rows','catch','show','params','include','merge','find','create','body','describe','eml-format','rimraf','zip-dir','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xe7de,0x165));var _0xee7d=function(_0x2dac8b,_0x3a8fa7){_0x2dac8b=_0x2dac8b-0x0;var _0x31c7ab=_0xe7de[_0x2dac8b];return _0x31c7ab;};'use strict';var emlformat=require(_0xee7d('0x0'));var rimraf=require(_0xee7d('0x1'));var zipdir=require(_0xee7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee7d('0x3'));var BPromise=require(_0xee7d('0x4'));var Mustache=require(_0xee7d('0x5'));var util=require(_0xee7d('0x6'));var path=require(_0xee7d('0x7'));var sox=require(_0xee7d('0x8'));var csv=require(_0xee7d('0x9'));var ejs=require(_0xee7d('0xa'));var fs=require('fs');var fs_extra=require(_0xee7d('0xb'));var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];function respondWithStatusCode(_0xdfb04b,_0xb4c933){_0xb4c933=_0xb4c933||0xcc;return function(_0x3e9daa){if(_0x3e9daa){return _0xdfb04b[_0xee7d('0x1c')](_0xb4c933);}return _0xdfb04b[_0xee7d('0x1d')](_0xb4c933)[_0xee7d('0x1e')]();};}function respondWithResult(_0x41ca24,_0x47eb16){_0x47eb16=_0x47eb16||0xc8;return function(_0x4bfdab){if(_0x4bfdab){return _0x41ca24[_0xee7d('0x1d')](_0x47eb16)[_0xee7d('0x1f')](_0x4bfdab);}};}function respondWithFilteredResult(_0x4ab8a6,_0x1211a1){return function(_0x1a2976){if(_0x1a2976){var _0x1dc47c=typeof _0x1211a1['offset']===_0xee7d('0x20')&&typeof _0x1211a1[_0xee7d('0x21')]===_0xee7d('0x20');var _0x62d1ec=_0x1a2976[_0xee7d('0x22')];var _0x25f3e0=_0x1dc47c?0x0:_0x1211a1['offset'];var _0x152dd6=_0x1dc47c?_0x1a2976[_0xee7d('0x22')]:_0x1211a1[_0xee7d('0x23')]+_0x1211a1['limit'];var _0x277738;if(_0x152dd6>=_0x62d1ec){_0x152dd6=_0x62d1ec;_0x277738=0xc8;}else{_0x277738=0xce;}_0x4ab8a6['status'](_0x277738);return _0x4ab8a6[_0xee7d('0x24')](_0xee7d('0x25'),_0x25f3e0+'-'+_0x152dd6+'/'+_0x62d1ec)[_0xee7d('0x1f')](_0x1a2976);}return null;};}function patchUpdates(_0x4f6445){return function(_0x113a05){try{jsonpatch['apply'](_0x113a05,_0x4f6445,!![]);}catch(_0x20aeaa){return BPromise[_0xee7d('0x26')](_0x20aeaa);}return _0x113a05[_0xee7d('0x27')]();};}function saveUpdates(_0xed4f9f,_0x52eaf4){return function(_0x32ad6e){if(_0x32ad6e){return _0x32ad6e[_0xee7d('0x28')](_0xed4f9f)[_0xee7d('0x29')](function(_0x136a7b){return _0x136a7b;});}return null;};}function removeEntity(_0x33613a,_0x4d0efb){return function(_0x172850){if(_0x172850){return _0x172850[_0xee7d('0x2a')]()[_0xee7d('0x29')](function(){_0x33613a['status'](0xcc)[_0xee7d('0x1e')]();});}};}function handleEntityNotFound(_0x293382,_0x379de9){return function(_0x576d56){if(!_0x576d56){_0x293382[_0xee7d('0x1c')](0x194);}return _0x576d56;};}function handleError(_0x38e6a6,_0x4532cb){_0x4532cb=_0x4532cb||0x1f4;return function(_0x2b9482){logger[_0xee7d('0x2b')](_0x2b9482[_0xee7d('0x2c')]);if(_0x2b9482[_0xee7d('0x2d')]){delete _0x2b9482[_0xee7d('0x2d')];}_0x38e6a6[_0xee7d('0x1d')](_0x4532cb)['send'](_0x2b9482);};}exports[_0xee7d('0x2e')]=function(_0x4e1bf5,_0x5ca947){var _0x2a5b06={},_0x4d4ff0={},_0x151094={'count':0x0,'rows':[]};var _0xc2e2c1=_['map'](db[_0xee7d('0x2f')][_0xee7d('0x30')],function(_0xac47ec){return{'name':_0xac47ec[_0xee7d('0x31')],'type':_0xac47ec[_0xee7d('0x32')]['key']};});_0x4d4ff0[_0xee7d('0x33')]=_[_0xee7d('0x34')](_0xc2e2c1,_0xee7d('0x2d'));_0x4d4ff0[_0xee7d('0x35')]=_[_0xee7d('0x36')](_0x4e1bf5[_0xee7d('0x35')]);_0x4d4ff0[_0xee7d('0x37')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],_0x4d4ff0[_0xee7d('0x35')]);_0x2a5b06[_0xee7d('0x39')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],qs[_0xee7d('0x3a')](_0x4e1bf5['query'][_0xee7d('0x3a')]));_0x2a5b06[_0xee7d('0x39')]=_0x2a5b06['attributes']['length']?_0x2a5b06[_0xee7d('0x39')]:_0x4d4ff0['model'];if(!_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3b')](_0xee7d('0x3c'))){_0x2a5b06[_0xee7d('0x21')]=qs[_0xee7d('0x21')](_0x4e1bf5['query']['limit']);_0x2a5b06[_0xee7d('0x23')]=qs['offset'](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x23')]);}_0x2a5b06[_0xee7d('0x3d')]=qs[_0xee7d('0x3e')](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3e')]);_0x2a5b06[_0xee7d('0x3f')]=qs[_0xee7d('0x37')](_[_0xee7d('0x40')](_0x4e1bf5[_0xee7d('0x35')],_0x4d4ff0[_0xee7d('0x37')]),_0xc2e2c1);if(_0x4e1bf5[_0xee7d('0x35')]['filter']){_0x2a5b06[_0xee7d('0x3f')]=_['merge'](_0x2a5b06[_0xee7d('0x3f')],{'$or':_[_0xee7d('0x34')](_0xc2e2c1,function(_0x13f7d2){if(_0x13f7d2['type']!==_0xee7d('0x41')){var _0x2944ac={};_0x2944ac[_0x13f7d2[_0xee7d('0x2d')]]={'$like':'%'+_0x4e1bf5['query'][_0xee7d('0x42')]+'%'};return _0x2944ac;}})});}_0x2a5b06=_['merge']({},_0x2a5b06,_0x4e1bf5[_0xee7d('0x43')]);var _0x4a1c11={'where':_0x2a5b06['where']};return db[_0xee7d('0x2f')][_0xee7d('0x22')](_0x4a1c11)[_0xee7d('0x29')](function(_0x281d7d){_0x151094['count']=_0x281d7d;if(_0x4e1bf5[_0xee7d('0x35')]['includeAll']){_0x2a5b06['include']=[{'all':!![]}];}return db[_0xee7d('0x2f')]['findAll'](_0x2a5b06);})[_0xee7d('0x29')](function(_0x527339){_0x151094[_0xee7d('0x44')]=_0x527339;return _0x151094;})[_0xee7d('0x29')](respondWithFilteredResult(_0x5ca947,_0x2a5b06))[_0xee7d('0x45')](handleError(_0x5ca947,null));};exports[_0xee7d('0x46')]=function(_0x55775d,_0x203ec5){var _0x33643d={'raw':!![],'where':{'id':_0x55775d[_0xee7d('0x47')]['id']}},_0x24bb87={};_0x24bb87[_0xee7d('0x33')]=_[_0xee7d('0x36')](db['JscriptyAnswerReport'][_0xee7d('0x30')]);_0x24bb87[_0xee7d('0x35')]=_[_0xee7d('0x36')](_0x55775d[_0xee7d('0x35')]);_0x24bb87['filters']=_[_0xee7d('0x38')](_0x24bb87['model'],_0x24bb87[_0xee7d('0x35')]);_0x33643d['attributes']=_[_0xee7d('0x38')](_0x24bb87[_0xee7d('0x33')],qs[_0xee7d('0x3a')](_0x55775d['query'][_0xee7d('0x3a')]));_0x33643d['attributes']=_0x33643d[_0xee7d('0x39')]['length']?_0x33643d[_0xee7d('0x39')]:_0x24bb87[_0xee7d('0x33')];if(_0x55775d[_0xee7d('0x35')]['includeAll']){_0x33643d[_0xee7d('0x48')]=[{'all':!![]}];}_0x33643d=_[_0xee7d('0x49')]({},_0x33643d,_0x55775d['options']);return db['JscriptyAnswerReport'][_0xee7d('0x4a')](_0x33643d)[_0xee7d('0x29')](handleEntityNotFound(_0x203ec5,null))['then'](respondWithResult(_0x203ec5,null))[_0xee7d('0x45')](handleError(_0x203ec5,null));};exports[_0xee7d('0x4b')]=function(_0x238fbb,_0x48470e){return db['JscriptyAnswerReport'][_0xee7d('0x4b')](_0x238fbb[_0xee7d('0x4c')],{})[_0xee7d('0x29')](respondWithResult(_0x48470e,0xc9))[_0xee7d('0x45')](handleError(_0x48470e,null));};exports[_0xee7d('0x28')]=function(_0xd13c3a,_0x486cfc){if(_0xd13c3a[_0xee7d('0x4c')]['id']){delete _0xd13c3a[_0xee7d('0x4c')]['id'];}return db[_0xee7d('0x2f')][_0xee7d('0x4a')]({'where':{'id':_0xd13c3a[_0xee7d('0x47')]['id']}})[_0xee7d('0x29')](handleEntityNotFound(_0x486cfc,null))[_0xee7d('0x29')](saveUpdates(_0xd13c3a[_0xee7d('0x4c')],null))[_0xee7d('0x29')](respondWithResult(_0x486cfc,null))[_0xee7d('0x45')](handleError(_0x486cfc,null));};exports['destroy']=function(_0x56bc0c,_0x336a1c){return db[_0xee7d('0x2f')][_0xee7d('0x4a')]({'where':{'id':_0x56bc0c[_0xee7d('0x47')]['id']}})[_0xee7d('0x29')](handleEntityNotFound(_0x336a1c,null))[_0xee7d('0x29')](removeEntity(_0x336a1c,null))[_0xee7d('0x45')](handleError(_0x336a1c,null));};exports['describe']=function(_0x1544e7,_0x52c85c){return db[_0xee7d('0x2f')][_0xee7d('0x4d')]()['then'](respondWithResult(_0x52c85c,null))['catch'](handleError(_0x52c85c,null));}; \ No newline at end of file +var _0xf23b=['where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter'];(function(_0x2d9f68,_0x490c6){var _0x2b7d59=function(_0x2a7b6b){while(--_0x2a7b6b){_0x2d9f68['push'](_0x2d9f68['shift']());}};_0x2b7d59(++_0x490c6);}(_0xf23b,0x133));var _0xbf23=function(_0x3de35a,_0x1b21ed){_0x3de35a=_0x3de35a-0x0;var _0x517408=_0xf23b[_0x3de35a];return _0x517408;};'use strict';var emlformat=require(_0xbf23('0x0'));var rimraf=require(_0xbf23('0x1'));var zipdir=require(_0xbf23('0x2'));var jsonpatch=require(_0xbf23('0x3'));var rp=require(_0xbf23('0x4'));var moment=require('moment');var BPromise=require(_0xbf23('0x5'));var Mustache=require(_0xbf23('0x6'));var util=require(_0xbf23('0x7'));var path=require('path');var sox=require(_0xbf23('0x8'));var csv=require(_0xbf23('0x9'));var ejs=require(_0xbf23('0xa'));var fs=require('fs');var fs_extra=require(_0xbf23('0xb'));var _=require(_0xbf23('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbf23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbf23('0x9'));var querystring=require(_0xbf23('0xe'));var Papa=require(_0xbf23('0xf'));var Redis=require(_0xbf23('0x10'));var authService=require(_0xbf23('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbf23('0x12'));var hardwareService=require(_0xbf23('0x13'));var logger=require(_0xbf23('0x14'))(_0xbf23('0x15'));var utils=require(_0xbf23('0x16'));var config=require(_0xbf23('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf23('0x18'))['db'];function respondWithStatusCode(_0x51e816,_0xd01a98){_0xd01a98=_0xd01a98||0xcc;return function(_0x4aea28){if(_0x4aea28){return _0x51e816[_0xbf23('0x19')](_0xd01a98);}return _0x51e816[_0xbf23('0x1a')](_0xd01a98)['end']();};}function respondWithResult(_0xb6880,_0x5a738f){_0x5a738f=_0x5a738f||0xc8;return function(_0x4db531){if(_0x4db531){return _0xb6880[_0xbf23('0x1a')](_0x5a738f)[_0xbf23('0x1b')](_0x4db531);}};}function respondWithFilteredResult(_0x5dd4f9,_0x4cb2a8){return function(_0x1cc52b){if(_0x1cc52b){var _0x581f9a=typeof _0x4cb2a8[_0xbf23('0x1c')]===_0xbf23('0x1d')&&typeof _0x4cb2a8[_0xbf23('0x1e')]===_0xbf23('0x1d');var _0x4c1cca=_0x1cc52b['count'];var _0x58b78f=_0x581f9a?0x0:_0x4cb2a8[_0xbf23('0x1c')];var _0x39f4f3=_0x581f9a?_0x1cc52b[_0xbf23('0x1f')]:_0x4cb2a8[_0xbf23('0x1c')]+_0x4cb2a8['limit'];var _0x9259ca;if(_0x39f4f3>=_0x4c1cca){_0x39f4f3=_0x4c1cca;_0x9259ca=0xc8;}else{_0x9259ca=0xce;}_0x5dd4f9[_0xbf23('0x1a')](_0x9259ca);return _0x5dd4f9[_0xbf23('0x20')]('Content-Range',_0x58b78f+'-'+_0x39f4f3+'/'+_0x4c1cca)[_0xbf23('0x1b')](_0x1cc52b);}return null;};}function patchUpdates(_0x3b6f7e){return function(_0x2bc340){try{jsonpatch[_0xbf23('0x21')](_0x2bc340,_0x3b6f7e,!![]);}catch(_0x570c84){return BPromise[_0xbf23('0x22')](_0x570c84);}return _0x2bc340['save']();};}function saveUpdates(_0xc683e8,_0x5858c7){return function(_0x190d99){if(_0x190d99){return _0x190d99[_0xbf23('0x23')](_0xc683e8)[_0xbf23('0x24')](function(_0x16e0f8){return _0x16e0f8;});}return null;};}function removeEntity(_0x5a4852,_0x5e65c8){return function(_0x5c6e8c){if(_0x5c6e8c){return _0x5c6e8c[_0xbf23('0x25')]()[_0xbf23('0x24')](function(){_0x5a4852['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1896f1,_0xa39dbc){return function(_0x130be4){if(!_0x130be4){_0x1896f1[_0xbf23('0x19')](0x194);}return _0x130be4;};}function handleError(_0x2faf90,_0x1fa3f3){_0x1fa3f3=_0x1fa3f3||0x1f4;return function(_0x30ce6a){logger[_0xbf23('0x26')](_0x30ce6a[_0xbf23('0x27')]);if(_0x30ce6a[_0xbf23('0x28')]){delete _0x30ce6a[_0xbf23('0x28')];}_0x2faf90['status'](_0x1fa3f3)['send'](_0x30ce6a);};}exports[_0xbf23('0x29')]=function(_0x5e6804,_0x2a7baf){var _0x16189f={},_0x58d130={},_0x9e2440={'count':0x0,'rows':[]};var _0x55b1e2=_['map'](db[_0xbf23('0x2a')]['rawAttributes'],function(_0xe59053){return{'name':_0xe59053[_0xbf23('0x2b')],'type':_0xe59053[_0xbf23('0x2c')][_0xbf23('0x2d')]};});_0x58d130[_0xbf23('0x2e')]=_[_0xbf23('0x2f')](_0x55b1e2,_0xbf23('0x28'));_0x58d130[_0xbf23('0x30')]=_['keys'](_0x5e6804[_0xbf23('0x30')]);_0x58d130[_0xbf23('0x31')]=_['intersection'](_0x58d130['model'],_0x58d130[_0xbf23('0x30')]);_0x16189f['attributes']=_[_0xbf23('0x32')](_0x58d130[_0xbf23('0x2e')],qs[_0xbf23('0x33')](_0x5e6804[_0xbf23('0x30')][_0xbf23('0x33')]));_0x16189f[_0xbf23('0x34')]=_0x16189f['attributes']['length']?_0x16189f[_0xbf23('0x34')]:_0x58d130[_0xbf23('0x2e')];if(!_0x5e6804['query'][_0xbf23('0x35')]('nolimit')){_0x16189f['limit']=qs[_0xbf23('0x1e')](_0x5e6804[_0xbf23('0x30')][_0xbf23('0x1e')]);_0x16189f[_0xbf23('0x1c')]=qs['offset'](_0x5e6804[_0xbf23('0x30')][_0xbf23('0x1c')]);}_0x16189f[_0xbf23('0x36')]=qs[_0xbf23('0x37')](_0x5e6804[_0xbf23('0x30')]['sort']);_0x16189f['where']=qs['filters'](_[_0xbf23('0x38')](_0x5e6804[_0xbf23('0x30')],_0x58d130['filters']),_0x55b1e2);if(_0x5e6804['query'][_0xbf23('0x39')]){_0x16189f[_0xbf23('0x3a')]=_['merge'](_0x16189f[_0xbf23('0x3a')],{'$or':_[_0xbf23('0x2f')](_0x55b1e2,function(_0x4d2ba4){if(_0x4d2ba4[_0xbf23('0x2c')]!==_0xbf23('0x3b')){var _0x122e9e={};_0x122e9e[_0x4d2ba4['name']]={'$like':'%'+_0x5e6804['query'][_0xbf23('0x39')]+'%'};return _0x122e9e;}})});}_0x16189f=_[_0xbf23('0x3c')]({},_0x16189f,_0x5e6804[_0xbf23('0x3d')]);var _0x2c361e={'where':_0x16189f[_0xbf23('0x3a')]};return db[_0xbf23('0x2a')]['count'](_0x2c361e)[_0xbf23('0x24')](function(_0x5881db){_0x9e2440[_0xbf23('0x1f')]=_0x5881db;if(_0x5e6804[_0xbf23('0x30')][_0xbf23('0x3e')]){_0x16189f[_0xbf23('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x16189f);})['then'](function(_0x5614b3){_0x9e2440[_0xbf23('0x40')]=_0x5614b3;return _0x9e2440;})['then'](respondWithFilteredResult(_0x2a7baf,_0x16189f))[_0xbf23('0x41')](handleError(_0x2a7baf,null));};exports[_0xbf23('0x42')]=function(_0x5cd2fd,_0x436337){var _0x2c9cf4={'raw':!![],'where':{'id':_0x5cd2fd[_0xbf23('0x43')]['id']}},_0x166054={};_0x166054[_0xbf23('0x2e')]=_[_0xbf23('0x44')](db['JscriptyAnswerReport']['rawAttributes']);_0x166054[_0xbf23('0x30')]=_[_0xbf23('0x44')](_0x5cd2fd[_0xbf23('0x30')]);_0x166054[_0xbf23('0x31')]=_['intersection'](_0x166054['model'],_0x166054['query']);_0x2c9cf4[_0xbf23('0x34')]=_[_0xbf23('0x32')](_0x166054[_0xbf23('0x2e')],qs[_0xbf23('0x33')](_0x5cd2fd[_0xbf23('0x30')][_0xbf23('0x33')]));_0x2c9cf4['attributes']=_0x2c9cf4[_0xbf23('0x34')]['length']?_0x2c9cf4[_0xbf23('0x34')]:_0x166054[_0xbf23('0x2e')];if(_0x5cd2fd[_0xbf23('0x30')][_0xbf23('0x3e')]){_0x2c9cf4[_0xbf23('0x3f')]=[{'all':!![]}];}_0x2c9cf4=_[_0xbf23('0x3c')]({},_0x2c9cf4,_0x5cd2fd[_0xbf23('0x3d')]);return db[_0xbf23('0x2a')]['find'](_0x2c9cf4)[_0xbf23('0x24')](handleEntityNotFound(_0x436337,null))['then'](respondWithResult(_0x436337,null))[_0xbf23('0x41')](handleError(_0x436337,null));};exports[_0xbf23('0x45')]=function(_0x3400ca,_0x5dc245){return db[_0xbf23('0x2a')][_0xbf23('0x45')](_0x3400ca[_0xbf23('0x46')],{})['then'](respondWithResult(_0x5dc245,0xc9))[_0xbf23('0x41')](handleError(_0x5dc245,null));};exports[_0xbf23('0x23')]=function(_0x58e991,_0x4c7254){if(_0x58e991[_0xbf23('0x46')]['id']){delete _0x58e991[_0xbf23('0x46')]['id'];}return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x58e991[_0xbf23('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c7254,null))[_0xbf23('0x24')](saveUpdates(_0x58e991['body'],null))['then'](respondWithResult(_0x4c7254,null))[_0xbf23('0x41')](handleError(_0x4c7254,null));};exports[_0xbf23('0x25')]=function(_0x3626e7,_0x168856){return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x3626e7[_0xbf23('0x43')]['id']}})[_0xbf23('0x24')](handleEntityNotFound(_0x168856,null))[_0xbf23('0x24')](removeEntity(_0x168856,null))[_0xbf23('0x41')](handleError(_0x168856,null));};exports[_0xbf23('0x48')]=function(_0x49f8be,_0x93199){return db[_0xbf23('0x2a')][_0xbf23('0x48')]()[_0xbf23('0x24')](respondWithResult(_0x93199,null))[_0xbf23('0x41')](handleError(_0x93199,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cf8e74b..f986478 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 _0x63ed=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','moment'];(function(_0x3d97bd,_0x4366f1){var _0x13a3f5=function(_0x20f9b2){while(--_0x20f9b2){_0x3d97bd['push'](_0x3d97bd['shift']());}};_0x13a3f5(++_0x4366f1);}(_0x63ed,0x1d2));var _0xd63e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x63ed[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd63e('0x0'))('api');var moment=require(_0xd63e('0x1'));var BPromise=require(_0xd63e('0x2'));var rp=require(_0xd63e('0x3'));var fs=require('fs');var path=require(_0xd63e('0x4'));var rimraf=require(_0xd63e('0x5'));var config=require(_0xd63e('0x6'));var attributes=require(_0xd63e('0x7'));module[_0xd63e('0x8')]=function(_0x3ecec9,_0x590b7b){return _0x3ecec9[_0xd63e('0x9')](_0xd63e('0xa'),attributes,{'tableName':_0xd63e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f28=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x49fe93,_0x56eb06){var _0x3c0829=function(_0x326a85){while(--_0x326a85){_0x49fe93['push'](_0x49fe93['shift']());}};_0x3c0829(++_0x56eb06);}(_0x5f28,0xc7));var _0x85f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85f2('0x0'));var util=require(_0x85f2('0x1'));var logger=require('../../config/logger')(_0x85f2('0x2'));var moment=require(_0x85f2('0x3'));var BPromise=require(_0x85f2('0x4'));var rp=require(_0x85f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85f2('0x6'));var config=require(_0x85f2('0x7'));var attributes=require(_0x85f2('0x8'));module[_0x85f2('0x9')]=function(_0x3f8df2,_0x46ff82){return _0x3f8df2[_0x85f2('0xa')](_0x85f2('0xb'),attributes,{'tableName':_0x85f2('0xc'),'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 8ef1295..a1c3410 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 _0xb95a=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4dd31a,_0x54046f){var _0x2645cc=function(_0x447a2b){while(--_0x447a2b){_0x4dd31a['push'](_0x4dd31a['shift']());}};_0x2645cc(++_0x54046f);}(_0xb95a,0xea));var _0xab95=function(_0xc893a8,_0x5edd06){_0xc893a8=_0xc893a8-0x0;var _0x18a88a=_0xb95a[_0xc893a8];return _0x18a88a;};'use strict';var _=require(_0xab95('0x0'));var util=require(_0xab95('0x1'));var moment=require(_0xab95('0x2'));var BPromise=require('bluebird');var rs=require(_0xab95('0x3'));var fs=require('fs');var Redis=require(_0xab95('0x4'));var db=require(_0xab95('0x5'))['db'];var utils=require(_0xab95('0x6'));var logger=require('../../config/logger')(_0xab95('0x7'));var config=require(_0xab95('0x8'));var jayson=require(_0xab95('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17fe83,_0x1fe332,_0x1bd1ec){return new BPromise(function(_0x593b61,_0x226190){return client['request'](_0x17fe83,_0x1bd1ec)[_0xab95('0xa')](function(_0x204db){logger[_0xab95('0xb')](_0xab95('0xc'),_0x1fe332,_0xab95('0xd'));logger[_0xab95('0xe')](_0xab95('0xf'),_0x1fe332,'request\x20sent',JSON[_0xab95('0x10')](_0x204db));if(_0x204db[_0xab95('0x11')]){if(_0x204db[_0xab95('0x11')]['code']===0x1f4){logger[_0xab95('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fe332,_0x204db[_0xab95('0x11')][_0xab95('0x12')]);return _0x226190(_0x204db[_0xab95('0x11')][_0xab95('0x12')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fe332,_0x204db['error']['message']);return _0x593b61(_0x204db[_0xab95('0x11')][_0xab95('0x12')]);}else{logger[_0xab95('0xb')](_0xab95('0xc'),_0x1fe332,'request\x20sent');_0x593b61(_0x204db[_0xab95('0x13')][_0xab95('0x12')]);}})[_0xab95('0x14')](function(_0x14a295){logger[_0xab95('0x11')](_0xab95('0xc'),_0x1fe332,_0x14a295);_0x226190(_0x14a295);});});} \ No newline at end of file +var _0x9e68=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3d7d62,_0x24d5df){var _0x2f563b=function(_0x38888c){while(--_0x38888c){_0x3d7d62['push'](_0x3d7d62['shift']());}};_0x2f563b(++_0x24d5df);}(_0x9e68,0x140));var _0x89e6=function(_0x2b2591,_0x54edaf){_0x2b2591=_0x2b2591-0x0;var _0x158944=_0x9e68[_0x2b2591];return _0x158944;};'use strict';var _=require(_0x89e6('0x0'));var util=require(_0x89e6('0x1'));var moment=require(_0x89e6('0x2'));var BPromise=require(_0x89e6('0x3'));var rs=require(_0x89e6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x89e6('0x6'))(_0x89e6('0x7'));var config=require(_0x89e6('0x8'));var jayson=require(_0x89e6('0x9'));var client=jayson[_0x89e6('0xa')][_0x89e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6eaf,_0x30c56d,_0x140ecd){return new BPromise(function(_0x551768,_0x34ee12){return client[_0x89e6('0xc')](_0x2d6eaf,_0x140ecd)['then'](function(_0x1fb0d9){logger[_0x89e6('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x30c56d,_0x89e6('0xe'));logger[_0x89e6('0xf')](_0x89e6('0x10'),_0x30c56d,'request\x20sent',JSON[_0x89e6('0x11')](_0x1fb0d9));if(_0x1fb0d9['error']){if(_0x1fb0d9[_0x89e6('0x12')]['code']===0x1f4){logger[_0x89e6('0x12')](_0x89e6('0x13'),_0x30c56d,_0x1fb0d9[_0x89e6('0x12')][_0x89e6('0x14')]);return _0x34ee12(_0x1fb0d9[_0x89e6('0x12')][_0x89e6('0x14')]);}logger[_0x89e6('0x12')](_0x89e6('0x13'),_0x30c56d,_0x1fb0d9['error']['message']);return _0x551768(_0x1fb0d9[_0x89e6('0x12')][_0x89e6('0x14')]);}else{logger['info'](_0x89e6('0x13'),_0x30c56d,_0x89e6('0xe'));_0x551768(_0x1fb0d9[_0x89e6('0x15')]['message']);}})[_0x89e6('0x16')](function(_0x45551f){logger[_0x89e6('0x12')](_0x89e6('0x13'),_0x30c56d,_0x45551f);_0x34ee12(_0x45551f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8b14ed7..5f821f0 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 _0x333d=['create','post','clone','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0x333d,0x9a));var _0xd333=function(_0x2ef644,_0x2ab0ff){_0x2ef644=_0x2ef644-0x0;var _0x11f00e=_0x333d[_0x2ef644];return _0x11f00e;};'use strict';var multer=require(_0xd333('0x0'));var util=require('util');var path=require(_0xd333('0x1'));var timeout=require(_0xd333('0x2'));var express=require(_0xd333('0x3'));var router=express[_0xd333('0x4')]();var fs_extra=require(_0xd333('0x5'));var auth=require(_0xd333('0x6'));var interaction=require(_0xd333('0x7'));var config=require(_0xd333('0x8'));var controller=require(_0xd333('0x9'));router[_0xd333('0xa')]('/',auth[_0xd333('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd333('0xc')]);router[_0xd333('0xa')](_0xd333('0xd'),auth[_0xd333('0xb')](),controller[_0xd333('0xe')]);router[_0xd333('0xa')](_0xd333('0xf'),auth['isAuthenticated'](),controller[_0xd333('0x10')]);router[_0xd333('0xa')](_0xd333('0x11'),auth[_0xd333('0xb')](),timeout(_0xd333('0x12')),controller[_0xd333('0x13')]);router['post']('/',auth[_0xd333('0xb')](),controller[_0xd333('0x14')]);router[_0xd333('0x15')]('/:id/clone',auth[_0xd333('0xb')](),controller[_0xd333('0x16')]);router[_0xd333('0x17')](_0xd333('0x18'),auth[_0xd333('0xb')](),controller[_0xd333('0x19')]);router[_0xd333('0x1a')](_0xd333('0x18'),auth[_0xd333('0xb')](),controller[_0xd333('0x1b')]);module[_0xd333('0x1c')]=router; \ No newline at end of file +var _0x4b91=['getSessions','/:id/answers','isAuthenticated','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','index','/:id','/:id/sessions'];(function(_0x9ddf37,_0xf84902){var _0x4e5595=function(_0x54101a){while(--_0x54101a){_0x9ddf37['push'](_0x9ddf37['shift']());}};_0x4e5595(++_0xf84902);}(_0x4b91,0x114));var _0x14b9=function(_0x1e1a64,_0x9a058a){_0x1e1a64=_0x1e1a64-0x0;var _0x41c9a0=_0x4b91[_0x1e1a64];return _0x41c9a0;};'use strict';var multer=require(_0x14b9('0x0'));var util=require(_0x14b9('0x1'));var path=require(_0x14b9('0x2'));var timeout=require(_0x14b9('0x3'));var express=require(_0x14b9('0x4'));var router=express[_0x14b9('0x5')]();var fs_extra=require(_0x14b9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x14b9('0x7'));router[_0x14b9('0x8')]('/',auth['isAuthenticated'](),controller[_0x14b9('0x9')]);router['get'](_0x14b9('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x14b9('0x8')](_0x14b9('0xb'),auth['isAuthenticated'](),controller[_0x14b9('0xc')]);router['get'](_0x14b9('0xd'),auth[_0x14b9('0xe')](),controller['getAnswers']);router['get'](_0x14b9('0xf'),auth[_0x14b9('0xe')](),timeout(_0x14b9('0x10')),controller[_0x14b9('0x11')]);router['post']('/',auth[_0x14b9('0xe')](),controller['create']);router[_0x14b9('0x12')](_0x14b9('0x13'),auth['isAuthenticated'](),controller[_0x14b9('0x14')]);router[_0x14b9('0x15')](_0x14b9('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x14b9('0x16')](_0x14b9('0xa'),auth[_0x14b9('0xe')](),controller['destroy']);module[_0x14b9('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1223039..025136b 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 _0xcd1e=['long','isObjectLike','formData','isString','setDataValue','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xcd1e,0xe8));var _0xecd1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xcd1e[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xecd1('0x0'));var _=require(_0xecd1('0x1'));var util=require(_0xecd1('0x2'));module[_0xecd1('0x3')]={'name':{'type':Sequelize[_0xecd1('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xecd1('0x4')]},'formData':{'type':Sequelize[_0xecd1('0x5')](_0xecd1('0x6')),'set':function(_0x314881){if(_[_0xecd1('0x7')](_0x314881)){this['setDataValue'](_0xecd1('0x8'),JSON['stringify'](_0x314881));}else if(_[_0xecd1('0x9')](_0x314881)){this[_0xecd1('0xa')](_0xecd1('0x8'),_0x314881);}else{this[_0xecd1('0xa')](_0xecd1('0x8'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xecd1('0xb')]('name')||'',this[_0xecd1('0xb')](_0xecd1('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xecd1('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xecd1('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x6cb1=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','TEXT','setDataValue','formData'];(function(_0x224cf1,_0xf5212d){var _0x427d47=function(_0x4c8a9a){while(--_0x4c8a9a){_0x224cf1['push'](_0x224cf1['shift']());}};_0x427d47(++_0xf5212d);}(_0x6cb1,0x192));var _0x16cb=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6cb1[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x16cb('0x0'));var _=require('lodash');var util=require('util');module[_0x16cb('0x1')]={'name':{'type':Sequelize[_0x16cb('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x16cb('0x2')]},'formData':{'type':Sequelize[_0x16cb('0x3')]('long'),'set':function(_0x170af7){if(_['isObjectLike'](_0x170af7)){this[_0x16cb('0x4')](_0x16cb('0x5'),JSON['stringify'](_0x170af7));}else if(_[_0x16cb('0x6')](_0x170af7)){this[_0x16cb('0x4')](_0x16cb('0x5'),_0x170af7);}else{this[_0x16cb('0x4')](_0x16cb('0x5'),util[_0x16cb('0x7')](_0x16cb('0x8'),this[_0x16cb('0x9')]('name')||'',this[_0x16cb('0x9')](_0x16cb('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x16cb('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x16cb('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 58e4901..ad269ea 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 _0x9ffd=['where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','find','create','user','get','Projects','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','body','updatedAt','role','destroy','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','hasOwnProperty','order','number','fromCharCode','indexOf','toString','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x3452eb,_0x44035e){var _0x4244fd=function(_0x48564b){while(--_0x48564b){_0x3452eb['push'](_0x3452eb['shift']());}};_0x4244fd(++_0x44035e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x56c8fa,_0x73403e){_0x56c8fa=_0x56c8fa-0x0;var _0x33a640=_0x9ffd[_0x56c8fa];return _0x33a640;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var hardwareService=require(_0xd9ff('0x13'));var logger=require(_0xd9ff('0x14'))(_0xd9ff('0x15'));var utils=require(_0xd9ff('0x16'));var config=require(_0xd9ff('0x17'));var licenseUtil=require(_0xd9ff('0x18'));var db=require(_0xd9ff('0x19'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1b')](_0x47b0d7)[_0xd9ff('0x1c')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1b')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=typeof _0x5db010['offset']===_0xd9ff('0x1d')&&typeof _0x5db010['limit']===_0xd9ff('0x1d');var _0xa30fd2=_0x4ffe54[_0xd9ff('0x1e')];var _0x3afd19=_0x547e28?0x0:_0x5db010[_0xd9ff('0x1f')];var _0x2d4df1=_0x547e28?_0x4ffe54[_0xd9ff('0x1e')]:_0x5db010[_0xd9ff('0x1f')]+_0x5db010[_0xd9ff('0x20')];var _0x1f028f;if(_0x2d4df1>=_0xa30fd2){_0x2d4df1=_0xa30fd2;_0x1f028f=0xc8;}else{_0x1f028f=0xce;}_0xf14c9f[_0xd9ff('0x1b')](_0x1f028f);return _0xf14c9f[_0xd9ff('0x21')](_0xd9ff('0x22'),_0x3afd19+'-'+_0x2d4df1+'/'+_0xa30fd2)['json'](_0x4ffe54);}return null;};}function patchUpdates(_0x4cf8ec){return function(_0x264a3d){try{jsonpatch[_0xd9ff('0x23')](_0x264a3d,_0x4cf8ec,!![]);}catch(_0x4eea4d){return BPromise['reject'](_0x4eea4d);}return _0x264a3d['save']();};}function saveUpdates(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')](_0x4b1477)[_0xd9ff('0x25')](function(_0x291f52){return _0x291f52;});}return null;};}function removeEntity(_0x9f074e,_0x278b66){return function(_0x42a828){if(_0x42a828){return _0x42a828['destroy']()['then'](function(){var _0x1136e9=_0x42a828['get']({'plain':!![]});var _0x3ca906='Projects';return db[_0xd9ff('0x26')]['destroy']({'where':{'type':_0x3ca906,'resourceId':_0x1136e9['id']}})[_0xd9ff('0x25')](function(){return _0x42a828;});})[_0xd9ff('0x25')](function(){_0x9f074e[_0xd9ff('0x1b')](0xcc)[_0xd9ff('0x1c')]();});}};}function handleEntityNotFound(_0x5d685e,_0x11a17b){return function(_0xe11f88){if(!_0xe11f88){_0x5d685e[_0xd9ff('0x1a')](0x194);}return _0xe11f88;};}function handleError(_0x4390f7,_0x5c1c1f){_0x5c1c1f=_0x5c1c1f||0x1f4;return function(_0x1d3684){logger[_0xd9ff('0x27')](_0x1d3684[_0xd9ff('0x28')]);if(_0x1d3684[_0xd9ff('0x29')]){delete _0x1d3684[_0xd9ff('0x29')];}_0x4390f7[_0xd9ff('0x1b')](_0x5c1c1f)[_0xd9ff('0x2a')](_0x1d3684);};}exports[_0xd9ff('0x2b')]=function(_0x3dc443,_0x5706cf){var _0xcea5db={},_0x4ba2be={},_0x1d55fd={'count':0x0,'rows':[]};var _0x29c532=_[_0xd9ff('0x2c')](db['JscriptyProject'][_0xd9ff('0x2d')],function(_0x3b26da){return{'name':_0x3b26da[_0xd9ff('0x2e')],'type':_0x3b26da[_0xd9ff('0x2f')]['key']};});_0x4ba2be[_0xd9ff('0x30')]=_['map'](_0x29c532,_0xd9ff('0x29'));_0x4ba2be[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3dc443[_0xd9ff('0x31')]);_0x4ba2be[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],_0x4ba2be[_0xd9ff('0x31')]);_0xcea5db[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x4ba2be[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0xcea5db['attributes']=_0xcea5db[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0xcea5db[_0xd9ff('0x35')]:_0x4ba2be['model'];if(!_0x3dc443[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0xcea5db['limit']=qs[_0xd9ff('0x20')](_0x3dc443['query'][_0xd9ff('0x20')]);_0xcea5db[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3dc443['query']['offset']);}_0xcea5db['order']=qs[_0xd9ff('0x39')](_0x3dc443[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0xcea5db[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3dc443['query'],_0x4ba2be['filters']),_0x29c532);if(_0x3dc443['query'][_0xd9ff('0x3c')]){_0xcea5db[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0xcea5db[_0xd9ff('0x3a')],{'$or':_['map'](_0x29c532,function(_0x2692c0){if(_0x2692c0['type']!==_0xd9ff('0x3e')){var _0x3e2beb={};_0x3e2beb[_0x2692c0[_0xd9ff('0x29')]]={'$like':'%'+_0x3dc443[_0xd9ff('0x31')]['filter']+'%'};return _0x3e2beb;}})});}_0xcea5db=_[_0xd9ff('0x3d')]({},_0xcea5db,_0x3dc443[_0xd9ff('0x3f')]);var _0x4961a7={'where':_0xcea5db[_0xd9ff('0x3a')]};return db[_0xd9ff('0x40')][_0xd9ff('0x1e')](_0x4961a7)[_0xd9ff('0x25')](function(_0x1fe44d){_0x1d55fd[_0xd9ff('0x1e')]=_0x1fe44d;if(_0x3dc443['query'][_0xd9ff('0x41')]){_0xcea5db[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x40')][_0xd9ff('0x43')](_0xcea5db);})[_0xd9ff('0x25')](function(_0x52aab8){_0x1d55fd[_0xd9ff('0x44')]=_0x52aab8;return _0x1d55fd;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x5706cf,_0xcea5db))[_0xd9ff('0x45')](handleError(_0x5706cf,null));};exports['show']=function(_0x5d06dd,_0x36843b){var _0x7eb1a={'raw':![],'where':{'id':_0x5d06dd[_0xd9ff('0x46')]['id']}},_0x18d1c4={};_0x18d1c4[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db['JscriptyProject'][_0xd9ff('0x2d')]);_0x18d1c4[_0xd9ff('0x31')]=_['keys'](_0x5d06dd[_0xd9ff('0x31')]);_0x18d1c4[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x18d1c4[_0xd9ff('0x30')],_0x18d1c4[_0xd9ff('0x31')]);_0x7eb1a['attributes']=_['intersection'](_0x18d1c4['model'],qs[_0xd9ff('0x36')](_0x5d06dd['query'][_0xd9ff('0x36')]));_0x7eb1a[_0xd9ff('0x35')]=_0x7eb1a[_0xd9ff('0x35')]['length']?_0x7eb1a[_0xd9ff('0x35')]:_0x18d1c4[_0xd9ff('0x30')];if(_0x5d06dd['query'][_0xd9ff('0x41')]){_0x7eb1a[_0xd9ff('0x42')]=[{'all':!![]}];}_0x7eb1a=_[_0xd9ff('0x3d')]({},_0x7eb1a,_0x5d06dd[_0xd9ff('0x3f')]);return db['JscriptyProject'][_0xd9ff('0x47')](_0x7eb1a)['then'](handleEntityNotFound(_0x36843b,null))[_0xd9ff('0x25')](respondWithResult(_0x36843b,null))['catch'](handleError(_0x36843b,null));};exports[_0xd9ff('0x48')]=function(_0x3d91e6,_0x2bf37a){return db[_0xd9ff('0x40')][_0xd9ff('0x48')](_0x3d91e6['body'],{})[_0xd9ff('0x25')](function(_0x3d6f11){var _0x2fbe53=_0x3d91e6[_0xd9ff('0x49')]['get']({'plain':!![]});if(!_0x2fbe53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbe53['role']===_0xd9ff('0x49')){var _0x40be56=_0x3d6f11[_0xd9ff('0x4a')]({'plain':!![]});var _0x572618=_0xd9ff('0x4b');return db[_0xd9ff('0x4c')][_0xd9ff('0x47')]({'where':{'name':_0x572618,'userProfileId':_0x2fbe53[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x40d391){if(_0x40d391&&_0x40d391[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x40be56[_0xd9ff('0x29')],'resourceId':_0x40be56['id'],'type':_0x40d391[_0xd9ff('0x29')],'sectionId':_0x40d391['id']},{})[_0xd9ff('0x25')](function(){return _0x3d6f11;});}else{return _0x3d6f11;}})[_0xd9ff('0x45')](function(_0x487b07){logger[_0xd9ff('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b07);throw _0x487b07;});}return _0x3d6f11;})[_0xd9ff('0x25')](respondWithResult(_0x2bf37a,0xc9))['catch'](handleError(_0x2bf37a,null));};exports[_0xd9ff('0x4f')]=function(_0x49623d,_0xc82610){var _0x5624a0={'where':{'id':_0x49623d['params']['id']}},_0x3aea70={};_0x3aea70[_0xd9ff('0x30')]=_['keys'](db[_0xd9ff('0x40')]['rawAttributes']);_0x5624a0[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x3aea70[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x49623d['query'][_0xd9ff('0x36')]));_0x5624a0[_0xd9ff('0x35')]=_0x5624a0[_0xd9ff('0x35')]['length']?_0x5624a0[_0xd9ff('0x35')]:_0x3aea70[_0xd9ff('0x30')];if(_0x49623d[_0xd9ff('0x31')][_0xd9ff('0x41')]){_0x5624a0[_0xd9ff('0x42')]=[{'all':!![]}];}_0x5624a0=_['merge']({},_0x5624a0,_0x49623d[_0xd9ff('0x3f')]);return db[_0xd9ff('0x40')][_0xd9ff('0x47')](_0x5624a0)[_0xd9ff('0x25')](handleEntityNotFound(_0xc82610,null))[_0xd9ff('0x25')](function(_0x2b36e8){if(_0x2b36e8){var _0x458fd4=_0x2b36e8['get']({'plain':!![]});_0x458fd4=qs[_0xd9ff('0x50')](_0x458fd4,['id',_0xd9ff('0x51'),'updatedAt']);_0x49623d[_0xd9ff('0x52')]=_[_0xd9ff('0x50')](_0x49623d['body'],['id',_0xd9ff('0x51'),_0xd9ff('0x53')]);return db[_0xd9ff('0x40')]['create'](_['merge'](_0x458fd4,_0x49623d[_0xd9ff('0x52')]),{'include':_0x49623d['query'][_0xd9ff('0x41')]?[{'all':!![]}]:undefined})[_0xd9ff('0x25')](function(_0x31907e){var _0x102aea=_0x49623d['user']['get']({'plain':!![]});if(!_0x102aea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102aea[_0xd9ff('0x54')]===_0xd9ff('0x49')){var _0x2e7781=_0x31907e[_0xd9ff('0x4a')]({'plain':!![]});var _0x27dad3='Projects';return db[_0xd9ff('0x4c')]['find']({'where':{'name':_0x27dad3,'userProfileId':_0x102aea[_0xd9ff('0x4d')]},'raw':!![]})[_0xd9ff('0x25')](function(_0x3f92c3){if(_0x3f92c3&&_0x3f92c3[_0xd9ff('0x4e')]===0x0){return db[_0xd9ff('0x26')][_0xd9ff('0x48')]({'name':_0x2e7781[_0xd9ff('0x29')],'resourceId':_0x2e7781['id'],'type':_0x3f92c3[_0xd9ff('0x29')],'sectionId':_0x3f92c3['id']},{})['then'](function(){return _0x31907e;});}else{return _0x31907e;}})[_0xd9ff('0x45')](function(_0x29e2f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29e2f6);throw _0x29e2f6;});}return _0x31907e;});}})[_0xd9ff('0x25')](respondWithResult(_0xc82610,0xc9))['catch'](handleError(_0xc82610,null));};exports[_0xd9ff('0x24')]=function(_0x34fca4,_0x5b62a7){if(_0x34fca4[_0xd9ff('0x52')]['id']){delete _0x34fca4[_0xd9ff('0x52')]['id'];}return db[_0xd9ff('0x40')][_0xd9ff('0x47')]({'where':{'id':_0x34fca4[_0xd9ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b62a7,null))[_0xd9ff('0x25')](saveUpdates(_0x34fca4['body'],null))['then'](respondWithResult(_0x5b62a7,null))[_0xd9ff('0x45')](handleError(_0x5b62a7,null));};exports[_0xd9ff('0x55')]=function(_0x1a08a9,_0x2fe00b){return db['JscriptyProject'][_0xd9ff('0x47')]({'where':{'id':_0x1a08a9[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x2fe00b,null))[_0xd9ff('0x25')](removeEntity(_0x2fe00b,null))[_0xd9ff('0x45')](handleError(_0x2fe00b,null));};exports[_0xd9ff('0x56')]=function(_0x2f12f7,_0x1d80f1,_0x4ac056){var _0x4c6b9d={'raw':!![],'where':{}};var _0x5e04d3={};var _0x275fb9={'count':0x0,'rows':[]};return db[_0xd9ff('0x40')]['findOne']({'where':{'id':_0x2f12f7[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x1d80f1,null))[_0xd9ff('0x25')](function(_0xd42dcb){if(_0xd42dcb){_0x5e04d3[_0xd9ff('0x30')]=_[_0xd9ff('0x32')](db[_0xd9ff('0x57')][_0xd9ff('0x2d')]);_0x5e04d3['query']=_[_0xd9ff('0x32')](_0x2f12f7[_0xd9ff('0x31')]);_0x5e04d3[_0xd9ff('0x33')]=_['intersection'](_0x5e04d3[_0xd9ff('0x30')],_0x5e04d3['query']);_0x4c6b9d[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x5e04d3[_0xd9ff('0x30')],qs['fields'](_0x2f12f7[_0xd9ff('0x31')][_0xd9ff('0x36')]));_0x4c6b9d[_0xd9ff('0x35')]=_0x4c6b9d[_0xd9ff('0x35')]['length']?_0x4c6b9d[_0xd9ff('0x35')]:_0x5e04d3[_0xd9ff('0x30')];if(!_0x2f12f7[_0xd9ff('0x31')]['hasOwnProperty'](_0xd9ff('0x38'))){_0x4c6b9d[_0xd9ff('0x20')]=qs[_0xd9ff('0x20')](_0x2f12f7['query'][_0xd9ff('0x20')]);_0x4c6b9d[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x2f12f7[_0xd9ff('0x31')][_0xd9ff('0x1f')]);}_0x4c6b9d['order']=qs[_0xd9ff('0x39')](_0x2f12f7[_0xd9ff('0x31')]['sort']);_0x4c6b9d[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x2f12f7['query'],_0x5e04d3[_0xd9ff('0x33')]));_0x4c6b9d['where'][_0xd9ff('0x58')]=_0xd42dcb['id'];if(_0x2f12f7['query'][_0xd9ff('0x3c')]){_0x4c6b9d[_0xd9ff('0x3a')]=_[_0xd9ff('0x3d')](_0x4c6b9d[_0xd9ff('0x3a')],{'$or':_[_0xd9ff('0x2c')](_0x4c6b9d[_0xd9ff('0x35')],function(_0xda0003){var _0x518c8c={};_0x518c8c[_0xda0003]={'$like':'%'+_0x2f12f7[_0xd9ff('0x31')][_0xd9ff('0x3c')]+'%'};return _0x518c8c;})});}_0x4c6b9d=_['merge']({},_0x4c6b9d,_0x2f12f7[_0xd9ff('0x3f')]);return db[_0xd9ff('0x57')][_0xd9ff('0x1e')]({'where':_0x4c6b9d[_0xd9ff('0x3a')]})[_0xd9ff('0x25')](function(_0x43eadb){_0x275fb9['count']=_0x43eadb;if(_0x2f12f7['query'][_0xd9ff('0x41')]){_0x4c6b9d[_0xd9ff('0x42')]=[{'all':!![]}];}return db[_0xd9ff('0x57')][_0xd9ff('0x43')](_0x4c6b9d);})[_0xd9ff('0x25')](function(_0x183199){_0x275fb9['rows']=_0x183199;return _0x275fb9;});}})[_0xd9ff('0x25')](respondWithFilteredResult(_0x1d80f1,_0x4c6b9d))[_0xd9ff('0x45')](handleError(_0x1d80f1,null));};exports[_0xd9ff('0x59')]=function(_0x3d4953,_0x14c89f,_0x32aa19){var _0x498544={'raw':!![],'where':{}};var _0x124214={};var _0x3aef79={'count':0x0,'rows':[]};return db[_0xd9ff('0x40')][_0xd9ff('0x5a')]({'where':{'id':_0x3d4953[_0xd9ff('0x46')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x14c89f,null))[_0xd9ff('0x25')](function(_0x468c50){if(_0x468c50){_0x124214['model']=_[_0xd9ff('0x32')](db['JscriptyAnswerReport'][_0xd9ff('0x2d')]);_0x124214[_0xd9ff('0x31')]=_[_0xd9ff('0x32')](_0x3d4953[_0xd9ff('0x31')]);_0x124214[_0xd9ff('0x33')]=_[_0xd9ff('0x34')](_0x124214[_0xd9ff('0x30')],_0x124214[_0xd9ff('0x31')]);_0x498544[_0xd9ff('0x35')]=_[_0xd9ff('0x34')](_0x124214[_0xd9ff('0x30')],qs[_0xd9ff('0x36')](_0x3d4953[_0xd9ff('0x31')]['fields']));_0x498544[_0xd9ff('0x35')]=_0x498544[_0xd9ff('0x35')][_0xd9ff('0x37')]?_0x498544[_0xd9ff('0x35')]:_0x124214['model'];if(!_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x5b')]('nolimit')){_0x498544[_0xd9ff('0x20')]=qs[_0xd9ff('0x20')](_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x20')]);_0x498544[_0xd9ff('0x1f')]=qs[_0xd9ff('0x1f')](_0x3d4953[_0xd9ff('0x31')]['offset']);}_0x498544[_0xd9ff('0x5c')]=qs['sort'](_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x39')]);_0x498544[_0xd9ff('0x3a')]=qs[_0xd9ff('0x33')](_[_0xd9ff('0x3b')](_0x3d4953[_0xd9ff('0x31')],_0x124214[_0xd9ff('0x33')]));_0x498544[_0xd9ff('0x3a')][_0xd9ff('0x58')]=_0x468c50['id'];if(_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x3c')]){_0x498544['where']=_[_0xd9ff('0x3d')](_0x498544[_0xd9ff('0x3a')],{'$or':_['map'](_0x498544[_0xd9ff('0x35')],function(_0x41e545){var _0x3b3511={};_0x3b3511[_0x41e545]={'$like':'%'+_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x3c')]+'%'};return _0x3b3511;})});}_0x498544=_[_0xd9ff('0x3d')]({},_0x498544,_0x3d4953['options']);return db['JscriptyAnswerReport'][_0xd9ff('0x1e')]({'where':_0x498544['where']})['then'](function(_0x4a55c1){_0x3aef79['count']=_0x4a55c1;if(_0x3d4953[_0xd9ff('0x31')][_0xd9ff('0x41')]){_0x498544[_0xd9ff('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x498544);})[_0xd9ff('0x25')](function(_0x5e7f52){_0x3aef79[_0xd9ff('0x44')]=_0x5e7f52;return _0x3aef79;});}})['then'](respondWithFilteredResult(_0x14c89f,_0x498544))[_0xd9ff('0x45')](handleError(_0x14c89f,null));};function char(_0x3ec460){return _0xd9ff('0x5d')===typeof _0x3ec460?String[_0xd9ff('0x5e')][_0xd9ff('0x23')](null,arguments):_0x3ec460;}function needsEncapsulation(_0x4e6dd2){return!!_0x4e6dd2&&(_0x4e6dd2['toString']()[_0xd9ff('0x5f')](char(0xd))>=0x0||_0x4e6dd2[_0xd9ff('0x60')]()[_0xd9ff('0x5f')](char(0xa))>=0x0||_0x4e6dd2[_0xd9ff('0x60')]()[_0xd9ff('0x5f')](char(0x2c))>=0x0||_0x4e6dd2['toString']()[_0xd9ff('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x19403d){var _0x9cb608=char(0x22),_0x7fdc57='\x5c'+char(0x22),_0x42018e=_0x19403d[_0xd9ff('0x60')]()[_0xd9ff('0x61')](new RegExp(_0x9cb608,'g'),_0x7fdc57);return _0x9cb608+_0x42018e+_0x9cb608;}exports[_0xd9ff('0x62')]=function(_0x28ba2c,_0x41b7e3,_0x280134){var _0x311b25,_0x1ec695;var _0x5baff1={'where':{'ProjectId':_0x28ba2c[_0xd9ff('0x46')]['id']}};if(_0x28ba2c[_0xd9ff('0x31')]['startTime']){_0x5baff1['where'][_0xd9ff('0x63')]=JSON[_0xd9ff('0x64')](_0x28ba2c['query'][_0xd9ff('0x65')]);}return db[_0xd9ff('0x57')][_0xd9ff('0x43')](_0x5baff1)[_0xd9ff('0x25')](handleEntityNotFound(_0x41b7e3,null))[_0xd9ff('0x25')](function(_0x36b1d5){if(_0x36b1d5){_0x311b25=_0x36b1d5;return db[_0xd9ff('0x66')][_0xd9ff('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x311b25,'id')},'ProjectId':_0x28ba2c['params']['id']},'order':'-createdAt'});}})[_0xd9ff('0x25')](handleEntityNotFound(_0x41b7e3,null))[_0xd9ff('0x25')](function(_0x8fa0d3){if(_0x8fa0d3){_0x1ec695=_0x8fa0d3;var _0x59a429={};for(var _0xe5ef9c=0x0,_0x709054=_0x1ec695[_0xd9ff('0x37')];_0xe5ef9c<_0x709054;_0xe5ef9c++){if(!_0x59a429[_0xd9ff('0x5b')](_0x1ec695[_0xe5ef9c][_0xd9ff('0x67')])){_0x59a429[_0x1ec695[_0xe5ef9c][_0xd9ff('0x67')]]=needsEncapsulation(_0x1ec695[_0xe5ef9c]['question'])?encapsulate(_0x1ec695[_0xe5ef9c][_0xd9ff('0x68')]):_0x1ec695[_0xe5ef9c]['question'];}}var _0x5cb3af=[],_0x5fc38d={};for(var _0x3d4b20=0x0,_0x2780bf=_0x311b25['length'];_0x3d4b20<_0x2780bf;_0x3d4b20++){_0x5fc38d={'ProjectId':_0x28ba2c[_0xd9ff('0x46')]['id'],'SessionId':_0x311b25[_0x3d4b20]['id'],'StartTime':moment(_0x311b25[_0x3d4b20][_0xd9ff('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4aa6d5=0x0,_0x11840a=_0x1ec695[_0xd9ff('0x37')];_0x4aa6d5<_0x11840a;_0x4aa6d5++){if(_0x1ec695[_0x4aa6d5]['SessionId']==_0x311b25[_0x3d4b20]['id']&&_0x59a429[_0xd9ff('0x5b')](_0x1ec695[_0x4aa6d5][_0xd9ff('0x67')])){_0x5fc38d[_0x59a429[_0x1ec695[_0x4aa6d5][_0xd9ff('0x67')]]]=_0x1ec695[_0x4aa6d5]['answer'];}}for(var _0x4a05f8 in _0x59a429){if(!_0x5fc38d['hasOwnProperty'](_0x59a429[_0x4a05f8])){_0x5fc38d[_0x59a429[_0x4a05f8]]=null;}}_0x5cb3af[_0xd9ff('0x69')](_0x5fc38d);}return _0x5cb3af;}})['then'](function(_0x27e71b){if(!_[_0xd9ff('0x6a')](_0x27e71b)){var _0x5c8224=toCsv(_0x27e71b);var _0x1b048b=Date[_0xd9ff('0x6b')]();fs[_0xd9ff('0x6c')](util[_0xd9ff('0x6d')](_0xd9ff('0x6e'),_0x28ba2c['params']['id'],_0x1b048b),_0x5c8224);_0x41b7e3[_0xd9ff('0x6f')]('Content-disposition','attachment;\x20filename='+util['format'](_0xd9ff('0x70'),_0x28ba2c[_0xd9ff('0x46')]['id'],_0x1b048b));_0x41b7e3[_0xd9ff('0x6f')](_0xd9ff('0x71'),'text/csv');return _0x41b7e3['download'](util[_0xd9ff('0x6d')](_0xd9ff('0x6e'),_0x28ba2c[_0xd9ff('0x46')]['id'],_0x1b048b));}else{return _0x41b7e3[_0xd9ff('0x1a')](0xcc);}})[_0xd9ff('0x45')](handleError(_0x41b7e3,null));}; \ No newline at end of file +var _0x215d=['body','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','omit','createdAt','updatedAt','role','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Projects','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','JscriptyProject','findAll','catch','find','create'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x215d,0x187));var _0xd215=function(_0x1e94d8,_0x399286){_0x1e94d8=_0x1e94d8-0x0;var _0x18d901=_0x215d[_0x1e94d8];return _0x18d901;};'use strict';var emlformat=require(_0xd215('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd215('0x1'));var jsonpatch=require(_0xd215('0x2'));var rp=require(_0xd215('0x3'));var moment=require(_0xd215('0x4'));var BPromise=require(_0xd215('0x5'));var Mustache=require(_0xd215('0x6'));var util=require('util');var path=require(_0xd215('0x7'));var sox=require('sox');var csv=require(_0xd215('0x8'));var ejs=require(_0xd215('0x9'));var fs=require('fs');var fs_extra=require(_0xd215('0xa'));var _=require('lodash');var squel=require(_0xd215('0xb'));var crypto=require('crypto');var jsforce=require(_0xd215('0xc'));var deskjs=require(_0xd215('0xd'));var toCsv=require(_0xd215('0x8'));var querystring=require('querystring');var Papa=require(_0xd215('0xe'));var Redis=require(_0xd215('0xf'));var authService=require(_0xd215('0x10'));var qs=require(_0xd215('0x11'));var as=require(_0xd215('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd215('0x13'))(_0xd215('0x14'));var utils=require(_0xd215('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd215('0x16'));var db=require(_0xd215('0x17'))['db'];function respondWithStatusCode(_0x1526b8,_0x463e70){_0x463e70=_0x463e70||0xcc;return function(_0x389bb4){if(_0x389bb4){return _0x1526b8['sendStatus'](_0x463e70);}return _0x1526b8[_0xd215('0x18')](_0x463e70)[_0xd215('0x19')]();};}function respondWithResult(_0x306a45,_0x10e90f){_0x10e90f=_0x10e90f||0xc8;return function(_0x1c0e74){if(_0x1c0e74){return _0x306a45[_0xd215('0x18')](_0x10e90f)[_0xd215('0x1a')](_0x1c0e74);}};}function respondWithFilteredResult(_0x1e586a,_0x59fbdb){return function(_0x37b60e){if(_0x37b60e){var _0x302696=typeof _0x59fbdb[_0xd215('0x1b')]===_0xd215('0x1c')&&typeof _0x59fbdb[_0xd215('0x1d')]===_0xd215('0x1c');var _0x2fb885=_0x37b60e[_0xd215('0x1e')];var _0x8d43f2=_0x302696?0x0:_0x59fbdb['offset'];var _0x2a31e8=_0x302696?_0x37b60e[_0xd215('0x1e')]:_0x59fbdb[_0xd215('0x1b')]+_0x59fbdb[_0xd215('0x1d')];var _0xbccdaa;if(_0x2a31e8>=_0x2fb885){_0x2a31e8=_0x2fb885;_0xbccdaa=0xc8;}else{_0xbccdaa=0xce;}_0x1e586a[_0xd215('0x18')](_0xbccdaa);return _0x1e586a[_0xd215('0x1f')]('Content-Range',_0x8d43f2+'-'+_0x2a31e8+'/'+_0x2fb885)[_0xd215('0x1a')](_0x37b60e);}return null;};}function patchUpdates(_0x1d3afa){return function(_0x2130a3){try{jsonpatch['apply'](_0x2130a3,_0x1d3afa,!![]);}catch(_0xccab6){return BPromise[_0xd215('0x20')](_0xccab6);}return _0x2130a3[_0xd215('0x21')]();};}function saveUpdates(_0x36b85e,_0x4cc057){return function(_0x23b1fb){if(_0x23b1fb){return _0x23b1fb[_0xd215('0x22')](_0x36b85e)[_0xd215('0x23')](function(_0x31466e){return _0x31466e;});}return null;};}function removeEntity(_0x4c3768,_0x50a23f){return function(_0x5e0b42){if(_0x5e0b42){return _0x5e0b42[_0xd215('0x24')]()[_0xd215('0x23')](function(){var _0xf28d85=_0x5e0b42[_0xd215('0x25')]({'plain':!![]});var _0x527fca=_0xd215('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x527fca,'resourceId':_0xf28d85['id']}})[_0xd215('0x23')](function(){return _0x5e0b42;});})[_0xd215('0x23')](function(){_0x4c3768[_0xd215('0x18')](0xcc)[_0xd215('0x19')]();});}};}function handleEntityNotFound(_0x638b93,_0x473f7d){return function(_0x4d806c){if(!_0x4d806c){_0x638b93[_0xd215('0x27')](0x194);}return _0x4d806c;};}function handleError(_0x23828b,_0xeed23){_0xeed23=_0xeed23||0x1f4;return function(_0x3ca288){logger[_0xd215('0x28')](_0x3ca288[_0xd215('0x29')]);if(_0x3ca288[_0xd215('0x2a')]){delete _0x3ca288[_0xd215('0x2a')];}_0x23828b[_0xd215('0x18')](_0xeed23)[_0xd215('0x2b')](_0x3ca288);};}exports[_0xd215('0x2c')]=function(_0x44f799,_0x2a9c61){var _0x5bc727={},_0x507e44={},_0x252efb={'count':0x0,'rows':[]};var _0x47a371=_[_0xd215('0x2d')](db['JscriptyProject'][_0xd215('0x2e')],function(_0x1e5c58){return{'name':_0x1e5c58[_0xd215('0x2f')],'type':_0x1e5c58[_0xd215('0x30')]['key']};});_0x507e44['model']=_[_0xd215('0x2d')](_0x47a371,'name');_0x507e44[_0xd215('0x31')]=_[_0xd215('0x32')](_0x44f799['query']);_0x507e44[_0xd215('0x33')]=_[_0xd215('0x34')](_0x507e44['model'],_0x507e44['query']);_0x5bc727['attributes']=_[_0xd215('0x34')](_0x507e44[_0xd215('0x35')],qs[_0xd215('0x36')](_0x44f799[_0xd215('0x31')][_0xd215('0x36')]));_0x5bc727[_0xd215('0x37')]=_0x5bc727[_0xd215('0x37')][_0xd215('0x38')]?_0x5bc727[_0xd215('0x37')]:_0x507e44[_0xd215('0x35')];if(!_0x44f799[_0xd215('0x31')][_0xd215('0x39')](_0xd215('0x3a'))){_0x5bc727[_0xd215('0x1d')]=qs[_0xd215('0x1d')](_0x44f799[_0xd215('0x31')]['limit']);_0x5bc727['offset']=qs[_0xd215('0x1b')](_0x44f799[_0xd215('0x31')][_0xd215('0x1b')]);}_0x5bc727[_0xd215('0x3b')]=qs['sort'](_0x44f799[_0xd215('0x31')][_0xd215('0x3c')]);_0x5bc727[_0xd215('0x3d')]=qs[_0xd215('0x33')](_[_0xd215('0x3e')](_0x44f799[_0xd215('0x31')],_0x507e44['filters']),_0x47a371);if(_0x44f799[_0xd215('0x31')]['filter']){_0x5bc727[_0xd215('0x3d')]=_[_0xd215('0x3f')](_0x5bc727[_0xd215('0x3d')],{'$or':_[_0xd215('0x2d')](_0x47a371,function(_0x25b6da){if(_0x25b6da[_0xd215('0x30')]!==_0xd215('0x40')){var _0x21ec44={};_0x21ec44[_0x25b6da[_0xd215('0x2a')]]={'$like':'%'+_0x44f799['query'][_0xd215('0x41')]+'%'};return _0x21ec44;}})});}_0x5bc727=_[_0xd215('0x3f')]({},_0x5bc727,_0x44f799[_0xd215('0x42')]);var _0x3807d8={'where':_0x5bc727[_0xd215('0x3d')]};return db['JscriptyProject']['count'](_0x3807d8)[_0xd215('0x23')](function(_0x53684d){_0x252efb['count']=_0x53684d;if(_0x44f799[_0xd215('0x31')][_0xd215('0x43')]){_0x5bc727['include']=[{'all':!![]}];}return db[_0xd215('0x44')][_0xd215('0x45')](_0x5bc727);})['then'](function(_0x1b5c8c){_0x252efb['rows']=_0x1b5c8c;return _0x252efb;})[_0xd215('0x23')](respondWithFilteredResult(_0x2a9c61,_0x5bc727))[_0xd215('0x46')](handleError(_0x2a9c61,null));};exports['show']=function(_0x54154e,_0x5cbf3e){var _0x7bafff={'raw':![],'where':{'id':_0x54154e['params']['id']}},_0x4a31a0={};_0x4a31a0[_0xd215('0x35')]=_['keys'](db[_0xd215('0x44')][_0xd215('0x2e')]);_0x4a31a0['query']=_['keys'](_0x54154e[_0xd215('0x31')]);_0x4a31a0[_0xd215('0x33')]=_[_0xd215('0x34')](_0x4a31a0[_0xd215('0x35')],_0x4a31a0['query']);_0x7bafff['attributes']=_[_0xd215('0x34')](_0x4a31a0['model'],qs[_0xd215('0x36')](_0x54154e[_0xd215('0x31')][_0xd215('0x36')]));_0x7bafff[_0xd215('0x37')]=_0x7bafff[_0xd215('0x37')][_0xd215('0x38')]?_0x7bafff[_0xd215('0x37')]:_0x4a31a0[_0xd215('0x35')];if(_0x54154e['query'][_0xd215('0x43')]){_0x7bafff['include']=[{'all':!![]}];}_0x7bafff=_['merge']({},_0x7bafff,_0x54154e[_0xd215('0x42')]);return db[_0xd215('0x44')][_0xd215('0x47')](_0x7bafff)[_0xd215('0x23')](handleEntityNotFound(_0x5cbf3e,null))[_0xd215('0x23')](respondWithResult(_0x5cbf3e,null))[_0xd215('0x46')](handleError(_0x5cbf3e,null));};exports['create']=function(_0x8b3ed8,_0x5887cb){return db['JscriptyProject'][_0xd215('0x48')](_0x8b3ed8[_0xd215('0x49')],{})[_0xd215('0x23')](function(_0x7a8d0d){var _0x4bf821=_0x8b3ed8[_0xd215('0x4a')]['get']({'plain':!![]});if(!_0x4bf821)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bf821['role']===_0xd215('0x4a')){var _0x4035d3=_0x7a8d0d['get']({'plain':!![]});var _0x4b16f3='Projects';return db['UserProfileSection'][_0xd215('0x47')]({'where':{'name':_0x4b16f3,'userProfileId':_0x4bf821[_0xd215('0x4b')]},'raw':!![]})[_0xd215('0x23')](function(_0x5478c9){if(_0x5478c9&&_0x5478c9['autoAssociation']===0x0){return db[_0xd215('0x4c')][_0xd215('0x48')]({'name':_0x4035d3['name'],'resourceId':_0x4035d3['id'],'type':_0x5478c9[_0xd215('0x2a')],'sectionId':_0x5478c9['id']},{})[_0xd215('0x23')](function(){return _0x7a8d0d;});}else{return _0x7a8d0d;}})['catch'](function(_0x1a6512){logger[_0xd215('0x28')](_0xd215('0x4d'),_0x1a6512);throw _0x1a6512;});}return _0x7a8d0d;})[_0xd215('0x23')](respondWithResult(_0x5887cb,0xc9))[_0xd215('0x46')](handleError(_0x5887cb,null));};exports[_0xd215('0x4e')]=function(_0x524a02,_0x1e7a0b){var _0x4615ed={'where':{'id':_0x524a02[_0xd215('0x4f')]['id']}},_0x45fa89={};_0x45fa89[_0xd215('0x35')]=_['keys'](db[_0xd215('0x44')][_0xd215('0x2e')]);_0x4615ed[_0xd215('0x37')]=_[_0xd215('0x34')](_0x45fa89[_0xd215('0x35')],qs['fields'](_0x524a02[_0xd215('0x31')][_0xd215('0x36')]));_0x4615ed[_0xd215('0x37')]=_0x4615ed['attributes']['length']?_0x4615ed[_0xd215('0x37')]:_0x45fa89['model'];if(_0x524a02['query'][_0xd215('0x43')]){_0x4615ed[_0xd215('0x50')]=[{'all':!![]}];}_0x4615ed=_['merge']({},_0x4615ed,_0x524a02[_0xd215('0x42')]);return db[_0xd215('0x44')]['find'](_0x4615ed)[_0xd215('0x23')](handleEntityNotFound(_0x1e7a0b,null))[_0xd215('0x23')](function(_0x41fae0){if(_0x41fae0){var _0x549829=_0x41fae0[_0xd215('0x25')]({'plain':!![]});_0x549829=qs[_0xd215('0x51')](_0x549829,['id',_0xd215('0x52'),_0xd215('0x53')]);_0x524a02[_0xd215('0x49')]=_['omit'](_0x524a02[_0xd215('0x49')],['id','createdAt',_0xd215('0x53')]);return db[_0xd215('0x44')][_0xd215('0x48')](_['merge'](_0x549829,_0x524a02['body']),{'include':_0x524a02[_0xd215('0x31')][_0xd215('0x43')]?[{'all':!![]}]:undefined})[_0xd215('0x23')](function(_0x239d56){var _0x21535e=_0x524a02[_0xd215('0x4a')][_0xd215('0x25')]({'plain':!![]});if(!_0x21535e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21535e[_0xd215('0x54')]===_0xd215('0x4a')){var _0x4ab28d=_0x239d56['get']({'plain':!![]});var _0x46cddb=_0xd215('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x46cddb,'userProfileId':_0x21535e[_0xd215('0x4b')]},'raw':!![]})[_0xd215('0x23')](function(_0x47399b){if(_0x47399b&&_0x47399b[_0xd215('0x55')]===0x0){return db[_0xd215('0x4c')][_0xd215('0x48')]({'name':_0x4ab28d['name'],'resourceId':_0x4ab28d['id'],'type':_0x47399b[_0xd215('0x2a')],'sectionId':_0x47399b['id']},{})[_0xd215('0x23')](function(){return _0x239d56;});}else{return _0x239d56;}})[_0xd215('0x46')](function(_0x3daa33){logger[_0xd215('0x28')](_0xd215('0x4d'),_0x3daa33);throw _0x3daa33;});}return _0x239d56;});}})['then'](respondWithResult(_0x1e7a0b,0xc9))[_0xd215('0x46')](handleError(_0x1e7a0b,null));};exports['update']=function(_0x596eff,_0x33d14a){if(_0x596eff[_0xd215('0x49')]['id']){delete _0x596eff[_0xd215('0x49')]['id'];}return db[_0xd215('0x44')]['find']({'where':{'id':_0x596eff[_0xd215('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33d14a,null))['then'](saveUpdates(_0x596eff['body'],null))[_0xd215('0x23')](respondWithResult(_0x33d14a,null))[_0xd215('0x46')](handleError(_0x33d14a,null));};exports['destroy']=function(_0x10a762,_0x2dd477){return db['JscriptyProject'][_0xd215('0x47')]({'where':{'id':_0x10a762[_0xd215('0x4f')]['id']}})[_0xd215('0x23')](handleEntityNotFound(_0x2dd477,null))[_0xd215('0x23')](removeEntity(_0x2dd477,null))['catch'](handleError(_0x2dd477,null));};exports[_0xd215('0x56')]=function(_0x3624f0,_0x5aebe7,_0x138c09){var _0x88de67={'raw':!![],'where':{}};var _0x5e676c={};var _0x5db6e8={'count':0x0,'rows':[]};return db[_0xd215('0x44')][_0xd215('0x57')]({'where':{'id':_0x3624f0['params']['id']}})['then'](handleEntityNotFound(_0x5aebe7,null))['then'](function(_0xc4be48){if(_0xc4be48){_0x5e676c[_0xd215('0x35')]=_[_0xd215('0x32')](db[_0xd215('0x58')]['rawAttributes']);_0x5e676c[_0xd215('0x31')]=_[_0xd215('0x32')](_0x3624f0[_0xd215('0x31')]);_0x5e676c['filters']=_['intersection'](_0x5e676c['model'],_0x5e676c['query']);_0x88de67['attributes']=_[_0xd215('0x34')](_0x5e676c[_0xd215('0x35')],qs['fields'](_0x3624f0['query']['fields']));_0x88de67['attributes']=_0x88de67[_0xd215('0x37')][_0xd215('0x38')]?_0x88de67[_0xd215('0x37')]:_0x5e676c[_0xd215('0x35')];if(!_0x3624f0[_0xd215('0x31')][_0xd215('0x39')](_0xd215('0x3a'))){_0x88de67[_0xd215('0x1d')]=qs[_0xd215('0x1d')](_0x3624f0[_0xd215('0x31')][_0xd215('0x1d')]);_0x88de67['offset']=qs['offset'](_0x3624f0[_0xd215('0x31')][_0xd215('0x1b')]);}_0x88de67[_0xd215('0x3b')]=qs[_0xd215('0x3c')](_0x3624f0[_0xd215('0x31')][_0xd215('0x3c')]);_0x88de67[_0xd215('0x3d')]=qs[_0xd215('0x33')](_['pick'](_0x3624f0['query'],_0x5e676c[_0xd215('0x33')]));_0x88de67[_0xd215('0x3d')][_0xd215('0x59')]=_0xc4be48['id'];if(_0x3624f0[_0xd215('0x31')][_0xd215('0x41')]){_0x88de67['where']=_['merge'](_0x88de67[_0xd215('0x3d')],{'$or':_[_0xd215('0x2d')](_0x88de67[_0xd215('0x37')],function(_0x53702b){var _0x5015d7={};_0x5015d7[_0x53702b]={'$like':'%'+_0x3624f0[_0xd215('0x31')]['filter']+'%'};return _0x5015d7;})});}_0x88de67=_['merge']({},_0x88de67,_0x3624f0[_0xd215('0x42')]);return db[_0xd215('0x58')]['count']({'where':_0x88de67[_0xd215('0x3d')]})['then'](function(_0x582421){_0x5db6e8[_0xd215('0x1e')]=_0x582421;if(_0x3624f0[_0xd215('0x31')][_0xd215('0x43')]){_0x88de67[_0xd215('0x50')]=[{'all':!![]}];}return db[_0xd215('0x58')][_0xd215('0x45')](_0x88de67);})[_0xd215('0x23')](function(_0x1c3a21){_0x5db6e8[_0xd215('0x5a')]=_0x1c3a21;return _0x5db6e8;});}})['then'](respondWithFilteredResult(_0x5aebe7,_0x88de67))[_0xd215('0x46')](handleError(_0x5aebe7,null));};exports[_0xd215('0x5b')]=function(_0x24d37f,_0x3dd58d,_0x4fbeab){var _0x3eb492={'raw':!![],'where':{}};var _0x1c838f={};var _0x27cbf7={'count':0x0,'rows':[]};return db[_0xd215('0x44')][_0xd215('0x57')]({'where':{'id':_0x24d37f[_0xd215('0x4f')]['id']}})[_0xd215('0x23')](handleEntityNotFound(_0x3dd58d,null))[_0xd215('0x23')](function(_0x5da039){if(_0x5da039){_0x1c838f[_0xd215('0x35')]=_['keys'](db[_0xd215('0x5c')][_0xd215('0x2e')]);_0x1c838f['query']=_[_0xd215('0x32')](_0x24d37f['query']);_0x1c838f[_0xd215('0x33')]=_[_0xd215('0x34')](_0x1c838f['model'],_0x1c838f['query']);_0x3eb492[_0xd215('0x37')]=_[_0xd215('0x34')](_0x1c838f[_0xd215('0x35')],qs[_0xd215('0x36')](_0x24d37f[_0xd215('0x31')][_0xd215('0x36')]));_0x3eb492[_0xd215('0x37')]=_0x3eb492[_0xd215('0x37')][_0xd215('0x38')]?_0x3eb492[_0xd215('0x37')]:_0x1c838f[_0xd215('0x35')];if(!_0x24d37f[_0xd215('0x31')][_0xd215('0x39')](_0xd215('0x3a'))){_0x3eb492['limit']=qs[_0xd215('0x1d')](_0x24d37f['query'][_0xd215('0x1d')]);_0x3eb492['offset']=qs[_0xd215('0x1b')](_0x24d37f[_0xd215('0x31')][_0xd215('0x1b')]);}_0x3eb492[_0xd215('0x3b')]=qs[_0xd215('0x3c')](_0x24d37f[_0xd215('0x31')][_0xd215('0x3c')]);_0x3eb492[_0xd215('0x3d')]=qs[_0xd215('0x33')](_[_0xd215('0x3e')](_0x24d37f['query'],_0x1c838f[_0xd215('0x33')]));_0x3eb492[_0xd215('0x3d')][_0xd215('0x59')]=_0x5da039['id'];if(_0x24d37f[_0xd215('0x31')][_0xd215('0x41')]){_0x3eb492['where']=_['merge'](_0x3eb492[_0xd215('0x3d')],{'$or':_[_0xd215('0x2d')](_0x3eb492[_0xd215('0x37')],function(_0x57b6ff){var _0x4cd6ba={};_0x4cd6ba[_0x57b6ff]={'$like':'%'+_0x24d37f[_0xd215('0x31')]['filter']+'%'};return _0x4cd6ba;})});}_0x3eb492=_[_0xd215('0x3f')]({},_0x3eb492,_0x24d37f[_0xd215('0x42')]);return db[_0xd215('0x5c')][_0xd215('0x1e')]({'where':_0x3eb492[_0xd215('0x3d')]})[_0xd215('0x23')](function(_0xc9a79b){_0x27cbf7[_0xd215('0x1e')]=_0xc9a79b;if(_0x24d37f[_0xd215('0x31')][_0xd215('0x43')]){_0x3eb492['include']=[{'all':!![]}];}return db[_0xd215('0x5c')][_0xd215('0x45')](_0x3eb492);})[_0xd215('0x23')](function(_0x2f613c){_0x27cbf7['rows']=_0x2f613c;return _0x27cbf7;});}})[_0xd215('0x23')](respondWithFilteredResult(_0x3dd58d,_0x3eb492))['catch'](handleError(_0x3dd58d,null));};function char(_0xde75db){return _0xd215('0x5d')===typeof _0xde75db?String['fromCharCode']['apply'](null,arguments):_0xde75db;}function needsEncapsulation(_0x5a1a21){return!!_0x5a1a21&&(_0x5a1a21[_0xd215('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x5a1a21[_0xd215('0x5e')]()[_0xd215('0x5f')](char(0xa))>=0x0||_0x5a1a21['toString']()[_0xd215('0x5f')](char(0x2c))>=0x0||_0x5a1a21[_0xd215('0x5e')]()[_0xd215('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x1d3734){var _0x299007=char(0x22),_0x497e5a='\x5c'+char(0x22),_0x150a7c=_0x1d3734['toString']()[_0xd215('0x60')](new RegExp(_0x299007,'g'),_0x497e5a);return _0x299007+_0x150a7c+_0x299007;}exports['getSummary']=function(_0x104696,_0x420df1,_0x4d773f){var _0x48b7e5,_0x224f80;var _0x485526={'where':{'ProjectId':_0x104696[_0xd215('0x4f')]['id']}};if(_0x104696[_0xd215('0x31')][_0xd215('0x61')]){_0x485526['where'][_0xd215('0x62')]=JSON['parse'](_0x104696[_0xd215('0x31')][_0xd215('0x61')]);}return db[_0xd215('0x58')][_0xd215('0x45')](_0x485526)[_0xd215('0x23')](handleEntityNotFound(_0x420df1,null))['then'](function(_0x6aa4ea){if(_0x6aa4ea){_0x48b7e5=_0x6aa4ea;return db['JscriptyQuestionReport'][_0xd215('0x45')]({'where':{'SessionId':{'$in':_[_0xd215('0x2d')](_0x48b7e5,'id')},'ProjectId':_0x104696[_0xd215('0x4f')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x420df1,null))[_0xd215('0x23')](function(_0x64b707){if(_0x64b707){_0x224f80=_0x64b707;var _0x215688={};for(var _0x111653=0x0,_0x19fb6a=_0x224f80[_0xd215('0x38')];_0x111653<_0x19fb6a;_0x111653++){if(!_0x215688[_0xd215('0x39')](_0x224f80[_0x111653][_0xd215('0x63')])){_0x215688[_0x224f80[_0x111653][_0xd215('0x63')]]=needsEncapsulation(_0x224f80[_0x111653][_0xd215('0x64')])?encapsulate(_0x224f80[_0x111653][_0xd215('0x64')]):_0x224f80[_0x111653][_0xd215('0x64')];}}var _0x21a2ab=[],_0x55ef50={};for(var _0x3f2b83=0x0,_0x3cb9f3=_0x48b7e5[_0xd215('0x38')];_0x3f2b83<_0x3cb9f3;_0x3f2b83++){_0x55ef50={'ProjectId':_0x104696[_0xd215('0x4f')]['id'],'SessionId':_0x48b7e5[_0x3f2b83]['id'],'StartTime':moment(_0x48b7e5[_0x3f2b83]['starttime'])[_0xd215('0x65')](_0xd215('0x66'))};for(var _0x289740=0x0,_0x5290fe=_0x224f80[_0xd215('0x38')];_0x289740<_0x5290fe;_0x289740++){if(_0x224f80[_0x289740]['SessionId']==_0x48b7e5[_0x3f2b83]['id']&&_0x215688[_0xd215('0x39')](_0x224f80[_0x289740]['questionId'])){_0x55ef50[_0x215688[_0x224f80[_0x289740][_0xd215('0x63')]]]=_0x224f80[_0x289740][_0xd215('0x67')];}}for(var _0x433eea in _0x215688){if(!_0x55ef50[_0xd215('0x39')](_0x215688[_0x433eea])){_0x55ef50[_0x215688[_0x433eea]]=null;}}_0x21a2ab[_0xd215('0x68')](_0x55ef50);}return _0x21a2ab;}})['then'](function(_0x12c65f){if(!_[_0xd215('0x69')](_0x12c65f)){var _0x56c3ca=toCsv(_0x12c65f);var _0x480ed3=Date[_0xd215('0x6a')]();fs[_0xd215('0x6b')](util[_0xd215('0x65')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x104696['params']['id'],_0x480ed3),_0x56c3ca);_0x420df1[_0xd215('0x6c')](_0xd215('0x6d'),_0xd215('0x6e')+util[_0xd215('0x65')](_0xd215('0x6f'),_0x104696[_0xd215('0x4f')]['id'],_0x480ed3));_0x420df1['setHeader'](_0xd215('0x70'),_0xd215('0x71'));return _0x420df1[_0xd215('0x72')](util[_0xd215('0x65')](_0xd215('0x73'),_0x104696[_0xd215('0x4f')]['id'],_0x480ed3));}else{return _0x420df1['sendStatus'](0xcc);}})[_0xd215('0x46')](handleError(_0x420df1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 215dc49..725e500 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 _0x23ea=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x37d172,_0x55b556){var _0xc6dac3=function(_0x2a5742){while(--_0x2a5742){_0x37d172['push'](_0x37d172['shift']());}};_0xc6dac3(++_0x55b556);}(_0x23ea,0xc3));var _0xa23e=function(_0x54f253,_0x13acb1){_0x54f253=_0x54f253-0x0;var _0x207e8d=_0x23ea[_0x54f253];return _0x207e8d;};'use strict';var _=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var moment=require(_0xa23e('0x4'));var BPromise=require(_0xa23e('0x5'));var rp=require(_0xa23e('0x6'));var fs=require('fs');var path=require(_0xa23e('0x7'));var rimraf=require(_0xa23e('0x8'));var config=require(_0xa23e('0x9'));var attributes=require(_0xa23e('0xa'));module['exports']=function(_0x3baf3d,_0x423454){return _0x3baf3d[_0xa23e('0xb')](_0xa23e('0xc'),attributes,{'tableName':_0xa23e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b20=['../../config/environment','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x100dc4,_0x3761ef){var _0xda3fe7=function(_0x132011){while(--_0x132011){_0x100dc4['push'](_0x100dc4['shift']());}};_0xda3fe7(++_0x3761ef);}(_0x5b20,0x86));var _0x05b2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5b20[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var logger=require(_0x05b2('0x2'))(_0x05b2('0x3'));var moment=require(_0x05b2('0x4'));var BPromise=require(_0x05b2('0x5'));var rp=require(_0x05b2('0x6'));var fs=require('fs');var path=require(_0x05b2('0x7'));var rimraf=require(_0x05b2('0x8'));var config=require(_0x05b2('0x9'));var attributes=require(_0x05b2('0xa'));module['exports']=function(_0x22e0e2,_0x83fd18){return _0x22e0e2['define'](_0x05b2('0xb'),attributes,{'tableName':_0x05b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index ad5f940..548eeed 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(_0x5b34d9,_0x3ab99e){var _0x146fcf=function(_0x3a27fd){while(--_0x3a27fd){_0x5b34d9['push'](_0x5b34d9['shift']());}};_0x146fcf(++_0x3ab99e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xcb91[_0x685346];return _0x52e15b;};'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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x17cb24,_0x4ceb9b){var _0x273b9d=function(_0x1afa5f){while(--_0x1afa5f){_0x17cb24['push'](_0x17cb24['shift']());}};_0x273b9d(++_0x4ceb9b);}(_0x70e0,0x17b));var _0x070e=function(_0x119f73,_0x53531a){_0x119f73=_0x119f73-0x0;var _0x255756=_0x70e0[_0x119f73];return _0x255756;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d44862d..6388f28 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 _0xddb9=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','post','create','put','/:id','update','delete','destroy'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xddb9,0x141));var _0x9ddb=function(_0x1a676d,_0x2978ed){_0x1a676d=_0x1a676d-0x0;var _0x23db8d=_0xddb9[_0x1a676d];return _0x23db8d;};'use strict';var multer=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var path=require('path');var timeout=require(_0x9ddb('0x2'));var express=require(_0x9ddb('0x3'));var router=express[_0x9ddb('0x4')]();var fs_extra=require(_0x9ddb('0x5'));var auth=require(_0x9ddb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ddb('0x7'));var controller=require(_0x9ddb('0x8'));router['get']('/',auth[_0x9ddb('0x9')](),controller['index']);router[_0x9ddb('0xa')](_0x9ddb('0xb'),auth[_0x9ddb('0x9')](),controller['describe']);router[_0x9ddb('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9ddb('0xc')]('/',auth[_0x9ddb('0x9')](),controller[_0x9ddb('0xd')]);router[_0x9ddb('0xe')](_0x9ddb('0xf'),auth['isAuthenticated'](),controller[_0x9ddb('0x10')]);router[_0x9ddb('0x11')](_0x9ddb('0xf'),auth['isAuthenticated'](),controller[_0x9ddb('0x12')]);module[_0x9ddb('0x13')]=router; \ No newline at end of file +var _0xebc8=['index','/describe','describe','get','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x1e1343,_0xad5782){var _0xae9286=function(_0x25bcce){while(--_0x25bcce){_0x1e1343['push'](_0x1e1343['shift']());}};_0xae9286(++_0xad5782);}(_0xebc8,0x187));var _0x8ebc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xebc8[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x8ebc('0x0'));var util=require(_0x8ebc('0x1'));var path=require(_0x8ebc('0x2'));var timeout=require(_0x8ebc('0x3'));var express=require(_0x8ebc('0x4'));var router=express[_0x8ebc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8ebc('0x6'));var interaction=require(_0x8ebc('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x8ebc('0x8')](),controller[_0x8ebc('0x9')]);router['get'](_0x8ebc('0xa'),auth[_0x8ebc('0x8')](),controller[_0x8ebc('0xb')]);router[_0x8ebc('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8ebc('0xd')]);router[_0x8ebc('0xe')](_0x8ebc('0xf'),auth[_0x8ebc('0x8')](),controller[_0x8ebc('0x10')]);router[_0x8ebc('0x11')](_0x8ebc('0xf'),auth[_0x8ebc('0x8')](),controller[_0x8ebc('0x12')]);module[_0x8ebc('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 732ec08..ac22982 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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x4bcc60,_0x54cdcb){_0x4bcc60=_0x4bcc60-0x0;var _0x52d7ab=_0x7a54[_0x4bcc60];return _0x52d7ab;};'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(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0x3f0756,_0x41c9e5){_0x3f0756=_0x3f0756-0x0;var _0xb2fd15=_0x7a54[_0x3f0756];return _0xb2fd15;};'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 e215185..98e9764 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 _0x79d1=['sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','json','update','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x79d1,0x136));var _0x179d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x79d1[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x179d('0x0'));var jsonpatch=require(_0x179d('0x1'));var rp=require(_0x179d('0x2'));var moment=require(_0x179d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x179d('0x4'));var util=require(_0x179d('0x5'));var path=require(_0x179d('0x6'));var sox=require(_0x179d('0x7'));var csv=require(_0x179d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x179d('0x9'));var _=require(_0x179d('0xa'));var squel=require(_0x179d('0xb'));var crypto=require(_0x179d('0xc'));var jsforce=require(_0x179d('0xd'));var deskjs=require(_0x179d('0xe'));var toCsv=require(_0x179d('0x8'));var querystring=require('querystring');var Papa=require(_0x179d('0xf'));var Redis=require(_0x179d('0x10'));var authService=require(_0x179d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x179d('0x12'));var hardwareService=require(_0x179d('0x13'));var logger=require(_0x179d('0x14'))(_0x179d('0x15'));var utils=require(_0x179d('0x16'));var config=require(_0x179d('0x17'));var licenseUtil=require(_0x179d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x111f27,_0x1f006c){_0x1f006c=_0x1f006c||0xcc;return function(_0x3202fb){if(_0x3202fb){return _0x111f27[_0x179d('0x19')](_0x1f006c);}return _0x111f27[_0x179d('0x1a')](_0x1f006c)[_0x179d('0x1b')]();};}function respondWithResult(_0x38ca49,_0x57d8b0){_0x57d8b0=_0x57d8b0||0xc8;return function(_0x3e2b9e){if(_0x3e2b9e){return _0x38ca49['status'](_0x57d8b0)['json'](_0x3e2b9e);}};}function respondWithFilteredResult(_0x12fbc1,_0x5053cd){return function(_0x1babc3){if(_0x1babc3){var _0x237854=typeof _0x5053cd[_0x179d('0x1c')]==='undefined'&&typeof _0x5053cd[_0x179d('0x1d')]==='undefined';var _0x5095c4=_0x1babc3['count'];var _0x1fefe4=_0x237854?0x0:_0x5053cd[_0x179d('0x1c')];var _0x2e17b8=_0x237854?_0x1babc3['count']:_0x5053cd[_0x179d('0x1c')]+_0x5053cd[_0x179d('0x1d')];var _0x2e864e;if(_0x2e17b8>=_0x5095c4){_0x2e17b8=_0x5095c4;_0x2e864e=0xc8;}else{_0x2e864e=0xce;}_0x12fbc1[_0x179d('0x1a')](_0x2e864e);return _0x12fbc1[_0x179d('0x1e')]('Content-Range',_0x1fefe4+'-'+_0x2e17b8+'/'+_0x5095c4)[_0x179d('0x1f')](_0x1babc3);}return null;};}function patchUpdates(_0x22b096){return function(_0x3a93bf){try{jsonpatch['apply'](_0x3a93bf,_0x22b096,!![]);}catch(_0x29dd2b){return BPromise['reject'](_0x29dd2b);}return _0x3a93bf['save']();};}function saveUpdates(_0x49961a,_0x13a6d8){return function(_0x1c688b){if(_0x1c688b){return _0x1c688b[_0x179d('0x20')](_0x49961a)[_0x179d('0x21')](function(_0x1840a7){return _0x1840a7;});}return null;};}function removeEntity(_0x4c6ba0,_0xc4be31){return function(_0x117473){if(_0x117473){return _0x117473[_0x179d('0x22')]()[_0x179d('0x21')](function(){_0x4c6ba0[_0x179d('0x1a')](0xcc)[_0x179d('0x1b')]();});}};}function handleEntityNotFound(_0x40d0dd,_0x426ba5){return function(_0x200832){if(!_0x200832){_0x40d0dd['sendStatus'](0x194);}return _0x200832;};}function handleError(_0x57956a,_0x5b5e30){_0x5b5e30=_0x5b5e30||0x1f4;return function(_0x2aa201){logger[_0x179d('0x23')](_0x2aa201[_0x179d('0x24')]);if(_0x2aa201[_0x179d('0x25')]){delete _0x2aa201[_0x179d('0x25')];}_0x57956a[_0x179d('0x1a')](_0x5b5e30)['send'](_0x2aa201);};}exports[_0x179d('0x26')]=function(_0x5884f3,_0x32b8ac){var _0x5367ea={},_0xb82de0={},_0xbbd1aa={'count':0x0,'rows':[]};var _0xbfc173=_[_0x179d('0x27')](db[_0x179d('0x28')][_0x179d('0x29')],function(_0x3f2e63){return{'name':_0x3f2e63[_0x179d('0x2a')],'type':_0x3f2e63[_0x179d('0x2b')][_0x179d('0x2c')]};});_0xb82de0['model']=_[_0x179d('0x27')](_0xbfc173,_0x179d('0x25'));_0xb82de0[_0x179d('0x2d')]=_['keys'](_0x5884f3[_0x179d('0x2d')]);_0xb82de0[_0x179d('0x2e')]=_[_0x179d('0x2f')](_0xb82de0[_0x179d('0x30')],_0xb82de0[_0x179d('0x2d')]);_0x5367ea[_0x179d('0x31')]=_[_0x179d('0x2f')](_0xb82de0[_0x179d('0x30')],qs[_0x179d('0x32')](_0x5884f3[_0x179d('0x2d')][_0x179d('0x32')]));_0x5367ea[_0x179d('0x31')]=_0x5367ea[_0x179d('0x31')][_0x179d('0x33')]?_0x5367ea[_0x179d('0x31')]:_0xb82de0['model'];if(!_0x5884f3['query'][_0x179d('0x34')](_0x179d('0x35'))){_0x5367ea[_0x179d('0x1d')]=qs[_0x179d('0x1d')](_0x5884f3['query'][_0x179d('0x1d')]);_0x5367ea[_0x179d('0x1c')]=qs[_0x179d('0x1c')](_0x5884f3[_0x179d('0x2d')][_0x179d('0x1c')]);}_0x5367ea[_0x179d('0x36')]=qs[_0x179d('0x37')](_0x5884f3[_0x179d('0x2d')][_0x179d('0x37')]);_0x5367ea[_0x179d('0x38')]=qs['filters'](_[_0x179d('0x39')](_0x5884f3['query'],_0xb82de0[_0x179d('0x2e')]),_0xbfc173);if(_0x5884f3[_0x179d('0x2d')][_0x179d('0x3a')]){_0x5367ea[_0x179d('0x38')]=_['merge'](_0x5367ea[_0x179d('0x38')],{'$or':_[_0x179d('0x27')](_0xbfc173,function(_0x3ff2bd){if(_0x3ff2bd[_0x179d('0x2b')]!=='VIRTUAL'){var _0x32ab10={};_0x32ab10[_0x3ff2bd['name']]={'$like':'%'+_0x5884f3['query']['filter']+'%'};return _0x32ab10;}})});}_0x5367ea=_[_0x179d('0x3b')]({},_0x5367ea,_0x5884f3[_0x179d('0x3c')]);var _0x3a067e={'where':_0x5367ea[_0x179d('0x38')]};return db[_0x179d('0x28')][_0x179d('0x3d')](_0x3a067e)[_0x179d('0x21')](function(_0x362290){_0xbbd1aa[_0x179d('0x3d')]=_0x362290;if(_0x5884f3[_0x179d('0x2d')][_0x179d('0x3e')]){_0x5367ea[_0x179d('0x3f')]=[{'all':!![]}];}return db[_0x179d('0x28')][_0x179d('0x40')](_0x5367ea);})[_0x179d('0x21')](function(_0x1195ce){_0xbbd1aa[_0x179d('0x41')]=_0x1195ce;return _0xbbd1aa;})[_0x179d('0x21')](respondWithFilteredResult(_0x32b8ac,_0x5367ea))['catch'](handleError(_0x32b8ac,null));};exports['show']=function(_0xb759a,_0xdb6317){var _0x161934={'raw':!![],'where':{'id':_0xb759a[_0x179d('0x42')]['id']}},_0x3cbea9={};_0x3cbea9[_0x179d('0x30')]=_[_0x179d('0x43')](db[_0x179d('0x28')][_0x179d('0x29')]);_0x3cbea9[_0x179d('0x2d')]=_[_0x179d('0x43')](_0xb759a[_0x179d('0x2d')]);_0x3cbea9['filters']=_[_0x179d('0x2f')](_0x3cbea9[_0x179d('0x30')],_0x3cbea9[_0x179d('0x2d')]);_0x161934['attributes']=_[_0x179d('0x2f')](_0x3cbea9[_0x179d('0x30')],qs[_0x179d('0x32')](_0xb759a[_0x179d('0x2d')][_0x179d('0x32')]));_0x161934[_0x179d('0x31')]=_0x161934[_0x179d('0x31')][_0x179d('0x33')]?_0x161934[_0x179d('0x31')]:_0x3cbea9['model'];if(_0xb759a[_0x179d('0x2d')][_0x179d('0x3e')]){_0x161934['include']=[{'all':!![]}];}_0x161934=_[_0x179d('0x3b')]({},_0x161934,_0xb759a[_0x179d('0x3c')]);return db[_0x179d('0x28')][_0x179d('0x44')](_0x161934)[_0x179d('0x21')](handleEntityNotFound(_0xdb6317,null))[_0x179d('0x21')](respondWithResult(_0xdb6317,null))[_0x179d('0x45')](handleError(_0xdb6317,null));};exports[_0x179d('0x46')]=function(_0x5a15df,_0x117fbd){return db[_0x179d('0x28')][_0x179d('0x46')](_0x5a15df[_0x179d('0x47')],{})['then'](respondWithResult(_0x117fbd,0xc9))[_0x179d('0x45')](handleError(_0x117fbd,null));};exports[_0x179d('0x20')]=function(_0x53cf93,_0x23ecbd){if(_0x53cf93[_0x179d('0x47')]['id']){delete _0x53cf93[_0x179d('0x47')]['id'];}return db[_0x179d('0x28')]['find']({'where':{'id':_0x53cf93[_0x179d('0x42')]['id']}})[_0x179d('0x21')](handleEntityNotFound(_0x23ecbd,null))[_0x179d('0x21')](saveUpdates(_0x53cf93[_0x179d('0x47')],null))[_0x179d('0x21')](respondWithResult(_0x23ecbd,null))[_0x179d('0x45')](handleError(_0x23ecbd,null));};exports['destroy']=function(_0x14b757,_0x4b9da5){return db[_0x179d('0x28')][_0x179d('0x44')]({'where':{'id':_0x14b757['params']['id']}})['then'](handleEntityNotFound(_0x4b9da5,null))[_0x179d('0x21')](removeEntity(_0x4b9da5,null))[_0x179d('0x45')](handleError(_0x4b9da5,null));};exports[_0x179d('0x48')]=function(_0x4cceac,_0x18bc86){return db['JscriptyQuestionReport'][_0x179d('0x48')]()['then'](respondWithResult(_0x18bc86,null))[_0x179d('0x45')](handleError(_0x18bc86,null));}; \ No newline at end of file +var _0x7697=['rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','describe'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7697,0x1aa));var _0x7769=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x7697[_0x19a49f];return _0x5351ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7769('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7769('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7769('0x2'));var Mustache=require(_0x7769('0x3'));var util=require(_0x7769('0x4'));var path=require(_0x7769('0x5'));var sox=require(_0x7769('0x6'));var csv=require(_0x7769('0x7'));var ejs=require(_0x7769('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7769('0x9'));var squel=require(_0x7769('0xa'));var crypto=require('crypto');var jsforce=require(_0x7769('0xb'));var deskjs=require(_0x7769('0xc'));var toCsv=require(_0x7769('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7769('0xd'));var authService=require(_0x7769('0xe'));var qs=require(_0x7769('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7769('0x10'));var logger=require(_0x7769('0x11'))('api');var utils=require(_0x7769('0x12'));var config=require(_0x7769('0x13'));var licenseUtil=require(_0x7769('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfd4bfe,_0xddb580){_0xddb580=_0xddb580||0xcc;return function(_0x50b304){if(_0x50b304){return _0xfd4bfe[_0x7769('0x15')](_0xddb580);}return _0xfd4bfe[_0x7769('0x16')](_0xddb580)[_0x7769('0x17')]();};}function respondWithResult(_0x3cf426,_0x47c900){_0x47c900=_0x47c900||0xc8;return function(_0x463e81){if(_0x463e81){return _0x3cf426[_0x7769('0x16')](_0x47c900)['json'](_0x463e81);}};}function respondWithFilteredResult(_0x524471,_0xe7081a){return function(_0x3db105){if(_0x3db105){var _0x303d84=typeof _0xe7081a[_0x7769('0x18')]===_0x7769('0x19')&&typeof _0xe7081a[_0x7769('0x1a')]==='undefined';var _0x5a468b=_0x3db105[_0x7769('0x1b')];var _0x46bb80=_0x303d84?0x0:_0xe7081a[_0x7769('0x18')];var _0x524ba2=_0x303d84?_0x3db105['count']:_0xe7081a[_0x7769('0x18')]+_0xe7081a[_0x7769('0x1a')];var _0x40a554;if(_0x524ba2>=_0x5a468b){_0x524ba2=_0x5a468b;_0x40a554=0xc8;}else{_0x40a554=0xce;}_0x524471[_0x7769('0x16')](_0x40a554);return _0x524471['set'](_0x7769('0x1c'),_0x46bb80+'-'+_0x524ba2+'/'+_0x5a468b)['json'](_0x3db105);}return null;};}function patchUpdates(_0x5be338){return function(_0x5c0f1c){try{jsonpatch[_0x7769('0x1d')](_0x5c0f1c,_0x5be338,!![]);}catch(_0xafb5fd){return BPromise['reject'](_0xafb5fd);}return _0x5c0f1c[_0x7769('0x1e')]();};}function saveUpdates(_0x172fc1,_0x5196e1){return function(_0x170e35){if(_0x170e35){return _0x170e35['update'](_0x172fc1)[_0x7769('0x1f')](function(_0x3fee13){return _0x3fee13;});}return null;};}function removeEntity(_0x223ebb,_0x17107f){return function(_0x1c764e){if(_0x1c764e){return _0x1c764e[_0x7769('0x20')]()[_0x7769('0x1f')](function(){_0x223ebb[_0x7769('0x16')](0xcc)[_0x7769('0x17')]();});}};}function handleEntityNotFound(_0x5f1669,_0x481893){return function(_0x2947b6){if(!_0x2947b6){_0x5f1669[_0x7769('0x15')](0x194);}return _0x2947b6;};}function handleError(_0x5b1f8d,_0x52d9c9){_0x52d9c9=_0x52d9c9||0x1f4;return function(_0x2d9632){logger[_0x7769('0x21')](_0x2d9632[_0x7769('0x22')]);if(_0x2d9632[_0x7769('0x23')]){delete _0x2d9632['name'];}_0x5b1f8d[_0x7769('0x16')](_0x52d9c9)[_0x7769('0x24')](_0x2d9632);};}exports[_0x7769('0x25')]=function(_0x22c443,_0x46452c){var _0xb29de6={},_0x208f40={},_0xb805={'count':0x0,'rows':[]};var _0x2564ae=_['map'](db[_0x7769('0x26')]['rawAttributes'],function(_0x52cd44){return{'name':_0x52cd44[_0x7769('0x27')],'type':_0x52cd44[_0x7769('0x28')][_0x7769('0x29')]};});_0x208f40['model']=_[_0x7769('0x2a')](_0x2564ae,_0x7769('0x23'));_0x208f40['query']=_[_0x7769('0x2b')](_0x22c443[_0x7769('0x2c')]);_0x208f40[_0x7769('0x2d')]=_[_0x7769('0x2e')](_0x208f40['model'],_0x208f40[_0x7769('0x2c')]);_0xb29de6[_0x7769('0x2f')]=_['intersection'](_0x208f40['model'],qs['fields'](_0x22c443[_0x7769('0x2c')][_0x7769('0x30')]));_0xb29de6[_0x7769('0x2f')]=_0xb29de6[_0x7769('0x2f')][_0x7769('0x31')]?_0xb29de6[_0x7769('0x2f')]:_0x208f40[_0x7769('0x32')];if(!_0x22c443['query'][_0x7769('0x33')](_0x7769('0x34'))){_0xb29de6[_0x7769('0x1a')]=qs[_0x7769('0x1a')](_0x22c443[_0x7769('0x2c')][_0x7769('0x1a')]);_0xb29de6['offset']=qs['offset'](_0x22c443['query'][_0x7769('0x18')]);}_0xb29de6['order']=qs[_0x7769('0x35')](_0x22c443[_0x7769('0x2c')]['sort']);_0xb29de6[_0x7769('0x36')]=qs[_0x7769('0x2d')](_['pick'](_0x22c443[_0x7769('0x2c')],_0x208f40[_0x7769('0x2d')]),_0x2564ae);if(_0x22c443[_0x7769('0x2c')]['filter']){_0xb29de6[_0x7769('0x36')]=_['merge'](_0xb29de6['where'],{'$or':_[_0x7769('0x2a')](_0x2564ae,function(_0x4c9886){if(_0x4c9886[_0x7769('0x28')]!==_0x7769('0x37')){var _0x38d8c4={};_0x38d8c4[_0x4c9886['name']]={'$like':'%'+_0x22c443[_0x7769('0x2c')][_0x7769('0x38')]+'%'};return _0x38d8c4;}})});}_0xb29de6=_[_0x7769('0x39')]({},_0xb29de6,_0x22c443['options']);var _0x319a99={'where':_0xb29de6[_0x7769('0x36')]};return db[_0x7769('0x26')][_0x7769('0x1b')](_0x319a99)['then'](function(_0x329f13){_0xb805[_0x7769('0x1b')]=_0x329f13;if(_0x22c443[_0x7769('0x2c')]['includeAll']){_0xb29de6[_0x7769('0x3a')]=[{'all':!![]}];}return db[_0x7769('0x26')][_0x7769('0x3b')](_0xb29de6);})[_0x7769('0x1f')](function(_0x4bb79c){_0xb805[_0x7769('0x3c')]=_0x4bb79c;return _0xb805;})[_0x7769('0x1f')](respondWithFilteredResult(_0x46452c,_0xb29de6))[_0x7769('0x3d')](handleError(_0x46452c,null));};exports[_0x7769('0x3e')]=function(_0x5e2c36,_0x3a6a2f){var _0x2941e3={'raw':!![],'where':{'id':_0x5e2c36['params']['id']}},_0x173c3d={};_0x173c3d[_0x7769('0x32')]=_[_0x7769('0x2b')](db[_0x7769('0x26')][_0x7769('0x3f')]);_0x173c3d[_0x7769('0x2c')]=_[_0x7769('0x2b')](_0x5e2c36[_0x7769('0x2c')]);_0x173c3d[_0x7769('0x2d')]=_['intersection'](_0x173c3d[_0x7769('0x32')],_0x173c3d['query']);_0x2941e3['attributes']=_[_0x7769('0x2e')](_0x173c3d[_0x7769('0x32')],qs[_0x7769('0x30')](_0x5e2c36[_0x7769('0x2c')][_0x7769('0x30')]));_0x2941e3[_0x7769('0x2f')]=_0x2941e3[_0x7769('0x2f')][_0x7769('0x31')]?_0x2941e3[_0x7769('0x2f')]:_0x173c3d[_0x7769('0x32')];if(_0x5e2c36[_0x7769('0x2c')][_0x7769('0x40')]){_0x2941e3['include']=[{'all':!![]}];}_0x2941e3=_[_0x7769('0x39')]({},_0x2941e3,_0x5e2c36['options']);return db[_0x7769('0x26')][_0x7769('0x41')](_0x2941e3)['then'](handleEntityNotFound(_0x3a6a2f,null))[_0x7769('0x1f')](respondWithResult(_0x3a6a2f,null))['catch'](handleError(_0x3a6a2f,null));};exports[_0x7769('0x42')]=function(_0x373929,_0x54b406){return db[_0x7769('0x26')][_0x7769('0x42')](_0x373929[_0x7769('0x43')],{})[_0x7769('0x1f')](respondWithResult(_0x54b406,0xc9))[_0x7769('0x3d')](handleError(_0x54b406,null));};exports[_0x7769('0x44')]=function(_0x19697b,_0x449041){if(_0x19697b[_0x7769('0x43')]['id']){delete _0x19697b[_0x7769('0x43')]['id'];}return db[_0x7769('0x26')][_0x7769('0x41')]({'where':{'id':_0x19697b[_0x7769('0x45')]['id']}})[_0x7769('0x1f')](handleEntityNotFound(_0x449041,null))[_0x7769('0x1f')](saveUpdates(_0x19697b[_0x7769('0x43')],null))[_0x7769('0x1f')](respondWithResult(_0x449041,null))[_0x7769('0x3d')](handleError(_0x449041,null));};exports['destroy']=function(_0x8d2adb,_0x598449){return db[_0x7769('0x26')]['find']({'where':{'id':_0x8d2adb[_0x7769('0x45')]['id']}})['then'](handleEntityNotFound(_0x598449,null))['then'](removeEntity(_0x598449,null))[_0x7769('0x3d')](handleError(_0x598449,null));};exports[_0x7769('0x46')]=function(_0x1ef75b,_0xdcb379){return db[_0x7769('0x26')][_0x7769('0x46')]()[_0x7769('0x1f')](respondWithResult(_0xdcb379,null))[_0x7769('0x3d')](handleError(_0xdcb379,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0b391c8..237ab0f 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 _0x6aee=['lodash','util','../../config/logger','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x56569c,_0x1cecb7){var _0x28a064=function(_0x31a647){while(--_0x31a647){_0x56569c['push'](_0x56569c['shift']());}};_0x28a064(++_0x1cecb7);}(_0x6aee,0x87));var _0xe6ae=function(_0x10127e,_0x57713e){_0x10127e=_0x10127e-0x0;var _0x23b1f9=_0x6aee[_0x10127e];return _0x23b1f9;};'use strict';var _=require(_0xe6ae('0x0'));var util=require(_0xe6ae('0x1'));var logger=require(_0xe6ae('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(_0xe6ae('0x3'));var config=require(_0xe6ae('0x4'));var attributes=require(_0xe6ae('0x5'));module[_0xe6ae('0x6')]=function(_0x2f373b,_0x31fbb4){return _0x2f373b[_0xe6ae('0x7')](_0xe6ae('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d66=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x439ad2,_0x58bcec){var _0x3579e7=function(_0x283133){while(--_0x283133){_0x439ad2['push'](_0x439ad2['shift']());}};_0x3579e7(++_0x58bcec);}(_0x0d66,0x112));var _0x60d6=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0x0d66[_0x5a8aa3];return _0x5d0458;};'use strict';var _=require(_0x60d6('0x0'));var util=require(_0x60d6('0x1'));var logger=require(_0x60d6('0x2'))(_0x60d6('0x3'));var moment=require(_0x60d6('0x4'));var BPromise=require(_0x60d6('0x5'));var rp=require(_0x60d6('0x6'));var fs=require('fs');var path=require(_0x60d6('0x7'));var rimraf=require(_0x60d6('0x8'));var config=require(_0x60d6('0x9'));var attributes=require(_0x60d6('0xa'));module[_0x60d6('0xb')]=function(_0x15fb51,_0x4ac0d8){return _0x15fb51[_0x60d6('0xc')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 8fe55e8..d1ff5a4 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 _0xd8a8=['rpc','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x472378,_0x327f94){var _0x4c1e48=function(_0x300b1c){while(--_0x300b1c){_0x472378['push'](_0x472378['shift']());}};_0x4c1e48(++_0x327f94);}(_0xd8a8,0x197));var _0x8d8a=function(_0x2f5d4c,_0x1ddba4){_0x2f5d4c=_0x2f5d4c-0x0;var _0x5e3c51=_0xd8a8[_0x2f5d4c];return _0x5e3c51;};'use strict';var _=require('lodash');var util=require(_0x8d8a('0x0'));var moment=require(_0x8d8a('0x1'));var BPromise=require(_0x8d8a('0x2'));var rs=require(_0x8d8a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d8a('0x4'))['db'];var utils=require(_0x8d8a('0x5'));var logger=require(_0x8d8a('0x6'))(_0x8d8a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8d8a('0x8'));var client=jayson[_0x8d8a('0x9')][_0x8d8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2f4f,_0x5daaf1,_0x508f34){return new BPromise(function(_0x33f915,_0x5859a6){return client[_0x8d8a('0xb')](_0x5d2f4f,_0x508f34)[_0x8d8a('0xc')](function(_0xefa427){logger['info'](_0x8d8a('0xd'),_0x5daaf1,_0x8d8a('0xe'));logger[_0x8d8a('0xf')](_0x8d8a('0x10'),_0x5daaf1,'request\x20sent',JSON[_0x8d8a('0x11')](_0xefa427));if(_0xefa427[_0x8d8a('0x12')]){if(_0xefa427[_0x8d8a('0x12')][_0x8d8a('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5daaf1,_0xefa427[_0x8d8a('0x12')][_0x8d8a('0x14')]);return _0x5859a6(_0xefa427[_0x8d8a('0x12')][_0x8d8a('0x14')]);}logger[_0x8d8a('0x12')](_0x8d8a('0xd'),_0x5daaf1,_0xefa427[_0x8d8a('0x12')]['message']);return _0x33f915(_0xefa427[_0x8d8a('0x12')][_0x8d8a('0x14')]);}else{logger[_0x8d8a('0x15')](_0x8d8a('0xd'),_0x5daaf1,_0x8d8a('0xe'));_0x33f915(_0xefa427[_0x8d8a('0x16')][_0x8d8a('0x14')]);}})['catch'](function(_0x15b359){logger[_0x8d8a('0x12')](_0x8d8a('0xd'),_0x5daaf1,_0x15b359);_0x5859a6(_0x15b359);});});} \ No newline at end of file +var _0xf4f4=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0xf4f4,0xc6));var _0x4f4f=function(_0x15e86d,_0x19f542){_0x15e86d=_0x15e86d-0x0;var _0x1905c2=_0xf4f4[_0x15e86d];return _0x1905c2;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require(_0x4f4f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f4f('0x6'))(_0x4f4f('0x7'));var config=require(_0x4f4f('0x8'));var jayson=require(_0x4f4f('0x9'));var client=jayson[_0x4f4f('0xa')][_0x4f4f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21069e,_0x1b67e5,_0x246c10){return new BPromise(function(_0x27a0bb,_0x2974fe){return client[_0x4f4f('0xc')](_0x21069e,_0x246c10)[_0x4f4f('0xd')](function(_0x220a88){logger[_0x4f4f('0xe')](_0x4f4f('0xf'),_0x1b67e5,'request\x20sent');logger['debug'](_0x4f4f('0x10'),_0x1b67e5,_0x4f4f('0x11'),JSON[_0x4f4f('0x12')](_0x220a88));if(_0x220a88[_0x4f4f('0x13')]){if(_0x220a88[_0x4f4f('0x13')][_0x4f4f('0x14')]===0x1f4){logger['error'](_0x4f4f('0xf'),_0x1b67e5,_0x220a88['error'][_0x4f4f('0x15')]);return _0x2974fe(_0x220a88[_0x4f4f('0x13')][_0x4f4f('0x15')]);}logger[_0x4f4f('0x13')](_0x4f4f('0xf'),_0x1b67e5,_0x220a88[_0x4f4f('0x13')][_0x4f4f('0x15')]);return _0x27a0bb(_0x220a88[_0x4f4f('0x13')]['message']);}else{logger[_0x4f4f('0xe')](_0x4f4f('0xf'),_0x1b67e5,'request\x20sent');_0x27a0bb(_0x220a88[_0x4f4f('0x16')][_0x4f4f('0x15')]);}})[_0x4f4f('0x17')](function(_0x472662){logger[_0x4f4f('0x13')](_0x4f4f('0xf'),_0x1b67e5,_0x472662);_0x2974fe(_0x472662);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9bacb4b..0051b76 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 _0xda41=['put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getQuestions','post','create'];(function(_0x52ac6b,_0xb00fc8){var _0x2473af=function(_0x1b36b7){while(--_0x1b36b7){_0x52ac6b['push'](_0x52ac6b['shift']());}};_0x2473af(++_0xb00fc8);}(_0xda41,0xc1));var _0x1da4=function(_0x3fefa0,_0x135236){_0x3fefa0=_0x3fefa0-0x0;var _0xba4821=_0xda41[_0x3fefa0];return _0xba4821;};'use strict';var multer=require('multer');var util=require(_0x1da4('0x0'));var path=require('path');var timeout=require(_0x1da4('0x1'));var express=require(_0x1da4('0x2'));var router=express[_0x1da4('0x3')]();var fs_extra=require(_0x1da4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1da4('0x5'));var controller=require(_0x1da4('0x6'));router[_0x1da4('0x7')]('/',auth['isAuthenticated'](),controller[_0x1da4('0x8')]);router[_0x1da4('0x7')](_0x1da4('0x9'),auth[_0x1da4('0xa')](),controller[_0x1da4('0xb')]);router[_0x1da4('0x7')](_0x1da4('0xc'),auth[_0x1da4('0xa')](),controller[_0x1da4('0xd')]);router[_0x1da4('0x7')]('/:id/questions',auth[_0x1da4('0xa')](),controller[_0x1da4('0xe')]);router[_0x1da4('0xf')]('/',auth[_0x1da4('0xa')](),controller[_0x1da4('0x10')]);router[_0x1da4('0x11')](_0x1da4('0xc'),auth['isAuthenticated'](),controller[_0x1da4('0x12')]);router[_0x1da4('0x13')](_0x1da4('0xc'),auth[_0x1da4('0xa')](),controller['destroy']);module[_0x1da4('0x14')]=router; \ No newline at end of file +var _0xa7b0=['describe','/:id','/:id/questions','getQuestions','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1aa5eb,_0x4efec4){var _0x45f0fa=function(_0x35e7d4){while(--_0x35e7d4){_0x1aa5eb['push'](_0x1aa5eb['shift']());}};_0x45f0fa(++_0x4efec4);}(_0xa7b0,0x113));var _0x0a7b=function(_0x580238,_0x2adec2){_0x580238=_0x580238-0x0;var _0x3d5608=_0xa7b0[_0x580238];return _0x3d5608;};'use strict';var multer=require('multer');var util=require(_0x0a7b('0x0'));var path=require('path');var timeout=require(_0x0a7b('0x1'));var express=require(_0x0a7b('0x2'));var router=express[_0x0a7b('0x3')]();var fs_extra=require(_0x0a7b('0x4'));var auth=require(_0x0a7b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a7b('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x0a7b('0x7')]('/',auth[_0x0a7b('0x8')](),controller[_0x0a7b('0x9')]);router[_0x0a7b('0x7')]('/describe',auth[_0x0a7b('0x8')](),controller[_0x0a7b('0xa')]);router[_0x0a7b('0x7')](_0x0a7b('0xb'),auth[_0x0a7b('0x8')](),controller['show']);router[_0x0a7b('0x7')](_0x0a7b('0xc'),auth['isAuthenticated'](),controller[_0x0a7b('0xd')]);router[_0x0a7b('0xe')]('/',auth[_0x0a7b('0x8')](),controller[_0x0a7b('0xf')]);router[_0x0a7b('0x10')](_0x0a7b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0a7b('0x11')](_0x0a7b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0a7b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9cbafee..1a1bba5 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 _0x5564=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','starttime'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5564,0x1ca));var _0x4556=function(_0x34a7dd,_0x2aa42f){_0x34a7dd=_0x34a7dd-0x0;var _0x48c43c=_0x5564[_0x34a7dd];return _0x48c43c;};'use strict';var moment=require(_0x4556('0x0'));var Sequelize=require(_0x4556('0x1'));module[_0x4556('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1e7881){this['setDataValue'](_0x4556('0x3'),_0x1e7881);this['setDataValue']('endtime',moment()['format'](_0x4556('0x4')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x4556('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4556('0x5')]},'uniqueid':{'type':Sequelize[_0x4556('0x5')]},'calleridname':{'type':Sequelize[_0x4556('0x5')]},'calleridnum':{'type':Sequelize[_0x4556('0x5')]},'completed':{'type':Sequelize[_0x4556('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c11=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports'];(function(_0x377756,_0x393726){var _0x5c4f4c=function(_0x32fb00){while(--_0x32fb00){_0x377756['push'](_0x377756['shift']());}};_0x5c4f4c(++_0x393726);}(_0x0c11,0x179));var _0x10c1=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x0c11[_0x43776a];return _0x18eb8f;};'use strict';var moment=require(_0x10c1('0x0'));var Sequelize=require(_0x10c1('0x1'));module[_0x10c1('0x2')]={'starttime':{'type':Sequelize[_0x10c1('0x3')],'set':function(_0x2f0b46){this[_0x10c1('0x4')](_0x10c1('0x5'),_0x2f0b46);this[_0x10c1('0x4')](_0x10c1('0x6'),moment()[_0x10c1('0x7')](_0x10c1('0x8')));}},'endtime':{'type':Sequelize[_0x10c1('0x3')]},'membername':{'type':Sequelize[_0x10c1('0x9')]},'projectname':{'type':Sequelize[_0x10c1('0x9')]},'queue':{'type':Sequelize[_0x10c1('0x9')]},'uniqueid':{'type':Sequelize[_0x10c1('0x9')]},'calleridname':{'type':Sequelize[_0x10c1('0x9')]},'calleridnum':{'type':Sequelize[_0x10c1('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e6d866c..3401e6b 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 _0x4832=['sendStatus','status','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','describe','getQuestions','findOne','JscriptyQuestionReport','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x470376,_0x23a277){var _0x3159d8=function(_0x3b38ba){while(--_0x3b38ba){_0x470376['push'](_0x470376['shift']());}};_0x3159d8(++_0x23a277);}(_0x4832,0xcc));var _0x2483=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x4832[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2483('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2483('0x1'));var rp=require(_0x2483('0x2'));var moment=require(_0x2483('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2483('0x4'));var path=require(_0x2483('0x5'));var sox=require('sox');var csv=require(_0x2483('0x6'));var ejs=require(_0x2483('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2483('0x8'));var crypto=require(_0x2483('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2483('0xa'));var toCsv=require(_0x2483('0x6'));var querystring=require('querystring');var Papa=require(_0x2483('0xb'));var Redis=require(_0x2483('0xc'));var authService=require(_0x2483('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2483('0xe'));var logger=require(_0x2483('0xf'))(_0x2483('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2483('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d5fb4,_0x4a7b48){_0x4a7b48=_0x4a7b48||0xcc;return function(_0x22bc52){if(_0x22bc52){return _0x4d5fb4[_0x2483('0x12')](_0x4a7b48);}return _0x4d5fb4[_0x2483('0x13')](_0x4a7b48)['end']();};}function respondWithResult(_0x5a8c9c,_0x54bc0b){_0x54bc0b=_0x54bc0b||0xc8;return function(_0x3f817f){if(_0x3f817f){return _0x5a8c9c[_0x2483('0x13')](_0x54bc0b)['json'](_0x3f817f);}};}function respondWithFilteredResult(_0xc240d0,_0x2d6467){return function(_0x454756){if(_0x454756){var _0x4278d9=typeof _0x2d6467['offset']===_0x2483('0x14')&&typeof _0x2d6467[_0x2483('0x15')]==='undefined';var _0xa28476=_0x454756['count'];var _0x505598=_0x4278d9?0x0:_0x2d6467['offset'];var _0x4a071a=_0x4278d9?_0x454756[_0x2483('0x16')]:_0x2d6467['offset']+_0x2d6467[_0x2483('0x15')];var _0xdb27c7;if(_0x4a071a>=_0xa28476){_0x4a071a=_0xa28476;_0xdb27c7=0xc8;}else{_0xdb27c7=0xce;}_0xc240d0[_0x2483('0x13')](_0xdb27c7);return _0xc240d0[_0x2483('0x17')](_0x2483('0x18'),_0x505598+'-'+_0x4a071a+'/'+_0xa28476)[_0x2483('0x19')](_0x454756);}return null;};}function patchUpdates(_0x176138){return function(_0xc6f18){try{jsonpatch[_0x2483('0x1a')](_0xc6f18,_0x176138,!![]);}catch(_0x41d5b8){return BPromise['reject'](_0x41d5b8);}return _0xc6f18[_0x2483('0x1b')]();};}function saveUpdates(_0x25f6e9,_0x45676a){return function(_0x5e8d7f){if(_0x5e8d7f){return _0x5e8d7f[_0x2483('0x1c')](_0x25f6e9)[_0x2483('0x1d')](function(_0x475759){return _0x475759;});}return null;};}function removeEntity(_0x51763b,_0x383ded){return function(_0x36170b){if(_0x36170b){return _0x36170b[_0x2483('0x1e')]()[_0x2483('0x1d')](function(){_0x51763b[_0x2483('0x13')](0xcc)[_0x2483('0x1f')]();});}};}function handleEntityNotFound(_0x123dd0,_0x331058){return function(_0x51dcfa){if(!_0x51dcfa){_0x123dd0[_0x2483('0x12')](0x194);}return _0x51dcfa;};}function handleError(_0x49d8c6,_0x44433a){_0x44433a=_0x44433a||0x1f4;return function(_0x392924){logger[_0x2483('0x20')](_0x392924[_0x2483('0x21')]);if(_0x392924[_0x2483('0x22')]){delete _0x392924[_0x2483('0x22')];}_0x49d8c6[_0x2483('0x13')](_0x44433a)[_0x2483('0x23')](_0x392924);};}exports[_0x2483('0x24')]=function(_0x3160f8,_0x3b2f90){var _0x218cf7={},_0x47aae6={},_0x4b17ac={'count':0x0,'rows':[]};var _0xac006f=_[_0x2483('0x25')](db[_0x2483('0x26')][_0x2483('0x27')],function(_0x30e47a){return{'name':_0x30e47a[_0x2483('0x28')],'type':_0x30e47a[_0x2483('0x29')]['key']};});_0x47aae6['model']=_[_0x2483('0x25')](_0xac006f,_0x2483('0x22'));_0x47aae6[_0x2483('0x2a')]=_[_0x2483('0x2b')](_0x3160f8[_0x2483('0x2a')]);_0x47aae6['filters']=_[_0x2483('0x2c')](_0x47aae6[_0x2483('0x2d')],_0x47aae6['query']);_0x218cf7[_0x2483('0x2e')]=_[_0x2483('0x2c')](_0x47aae6['model'],qs['fields'](_0x3160f8[_0x2483('0x2a')][_0x2483('0x2f')]));_0x218cf7['attributes']=_0x218cf7[_0x2483('0x2e')][_0x2483('0x30')]?_0x218cf7[_0x2483('0x2e')]:_0x47aae6[_0x2483('0x2d')];if(!_0x3160f8[_0x2483('0x2a')]['hasOwnProperty'](_0x2483('0x31'))){_0x218cf7['limit']=qs[_0x2483('0x15')](_0x3160f8[_0x2483('0x2a')]['limit']);_0x218cf7[_0x2483('0x32')]=qs[_0x2483('0x32')](_0x3160f8[_0x2483('0x2a')][_0x2483('0x32')]);}_0x218cf7[_0x2483('0x33')]=qs[_0x2483('0x34')](_0x3160f8['query'][_0x2483('0x34')]);_0x218cf7[_0x2483('0x35')]=qs[_0x2483('0x36')](_[_0x2483('0x37')](_0x3160f8[_0x2483('0x2a')],_0x47aae6[_0x2483('0x36')]),_0xac006f);if(_0x3160f8[_0x2483('0x2a')][_0x2483('0x38')]){_0x218cf7[_0x2483('0x35')]=_[_0x2483('0x39')](_0x218cf7[_0x2483('0x35')],{'$or':_[_0x2483('0x25')](_0xac006f,function(_0x5db2eb){if(_0x5db2eb[_0x2483('0x29')]!==_0x2483('0x3a')){var _0x3d5320={};_0x3d5320[_0x5db2eb[_0x2483('0x22')]]={'$like':'%'+_0x3160f8[_0x2483('0x2a')][_0x2483('0x38')]+'%'};return _0x3d5320;}})});}_0x218cf7=_[_0x2483('0x39')]({},_0x218cf7,_0x3160f8[_0x2483('0x3b')]);var _0x421779={'where':_0x218cf7['where']};return db[_0x2483('0x26')][_0x2483('0x16')](_0x421779)[_0x2483('0x1d')](function(_0x3e66db){_0x4b17ac[_0x2483('0x16')]=_0x3e66db;if(_0x3160f8[_0x2483('0x2a')][_0x2483('0x3c')]){_0x218cf7[_0x2483('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2483('0x3e')](_0x218cf7);})[_0x2483('0x1d')](function(_0x263efd){_0x4b17ac[_0x2483('0x3f')]=_0x263efd;return _0x4b17ac;})[_0x2483('0x1d')](respondWithFilteredResult(_0x3b2f90,_0x218cf7))['catch'](handleError(_0x3b2f90,null));};exports[_0x2483('0x40')]=function(_0x16527f,_0x3909c2){var _0x481edb={'raw':!![],'where':{'id':_0x16527f['params']['id']}},_0x4b2737={};_0x4b2737[_0x2483('0x2d')]=_[_0x2483('0x2b')](db['JscriptySessionReport'][_0x2483('0x27')]);_0x4b2737[_0x2483('0x2a')]=_[_0x2483('0x2b')](_0x16527f['query']);_0x4b2737[_0x2483('0x36')]=_['intersection'](_0x4b2737[_0x2483('0x2d')],_0x4b2737['query']);_0x481edb[_0x2483('0x2e')]=_[_0x2483('0x2c')](_0x4b2737['model'],qs[_0x2483('0x2f')](_0x16527f[_0x2483('0x2a')][_0x2483('0x2f')]));_0x481edb[_0x2483('0x2e')]=_0x481edb[_0x2483('0x2e')][_0x2483('0x30')]?_0x481edb[_0x2483('0x2e')]:_0x4b2737['model'];if(_0x16527f[_0x2483('0x2a')][_0x2483('0x3c')]){_0x481edb[_0x2483('0x3d')]=[{'all':!![]}];}_0x481edb=_[_0x2483('0x39')]({},_0x481edb,_0x16527f[_0x2483('0x3b')]);return db[_0x2483('0x26')][_0x2483('0x41')](_0x481edb)[_0x2483('0x1d')](handleEntityNotFound(_0x3909c2,null))[_0x2483('0x1d')](respondWithResult(_0x3909c2,null))['catch'](handleError(_0x3909c2,null));};exports[_0x2483('0x42')]=function(_0xcb2de8,_0x39148c){return db[_0x2483('0x26')][_0x2483('0x42')](_0xcb2de8[_0x2483('0x43')],{})[_0x2483('0x1d')](respondWithResult(_0x39148c,0xc9))[_0x2483('0x44')](handleError(_0x39148c,null));};exports[_0x2483('0x1c')]=function(_0x24a656,_0xca0fc3){if(_0x24a656['body']['id']){delete _0x24a656[_0x2483('0x43')]['id'];}return db[_0x2483('0x26')][_0x2483('0x41')]({'where':{'id':_0x24a656['params']['id']}})[_0x2483('0x1d')](handleEntityNotFound(_0xca0fc3,null))[_0x2483('0x1d')](saveUpdates(_0x24a656[_0x2483('0x43')],null))[_0x2483('0x1d')](respondWithResult(_0xca0fc3,null))[_0x2483('0x44')](handleError(_0xca0fc3,null));};exports[_0x2483('0x1e')]=function(_0x48a9d7,_0x57acaf){return db[_0x2483('0x26')][_0x2483('0x41')]({'where':{'id':_0x48a9d7[_0x2483('0x45')]['id']}})[_0x2483('0x1d')](handleEntityNotFound(_0x57acaf,null))[_0x2483('0x1d')](removeEntity(_0x57acaf,null))[_0x2483('0x44')](handleError(_0x57acaf,null));};exports[_0x2483('0x46')]=function(_0x435e35,_0x15b10c){return db[_0x2483('0x26')][_0x2483('0x46')]()[_0x2483('0x1d')](respondWithResult(_0x15b10c,null))['catch'](handleError(_0x15b10c,null));};exports[_0x2483('0x47')]=function(_0x3f1280,_0x59321c,_0x34787b){var _0x58860b={'raw':!![],'where':{}};var _0x3f3e50={};var _0x5dd1f0={'count':0x0,'rows':[]};return db[_0x2483('0x26')][_0x2483('0x48')]({'where':{'id':_0x3f1280['params']['id']}})[_0x2483('0x1d')](handleEntityNotFound(_0x59321c,null))[_0x2483('0x1d')](function(_0x3b5161){if(_0x3b5161){_0x3f3e50[_0x2483('0x2d')]=_[_0x2483('0x2b')](db[_0x2483('0x49')]['rawAttributes']);_0x3f3e50[_0x2483('0x2a')]=_[_0x2483('0x2b')](_0x3f1280[_0x2483('0x2a')]);_0x3f3e50[_0x2483('0x36')]=_[_0x2483('0x2c')](_0x3f3e50[_0x2483('0x2d')],_0x3f3e50[_0x2483('0x2a')]);_0x58860b['attributes']=_[_0x2483('0x2c')](_0x3f3e50['model'],qs[_0x2483('0x2f')](_0x3f1280[_0x2483('0x2a')][_0x2483('0x2f')]));_0x58860b[_0x2483('0x2e')]=_0x58860b[_0x2483('0x2e')][_0x2483('0x30')]?_0x58860b['attributes']:_0x3f3e50['model'];if(!_0x3f1280[_0x2483('0x2a')]['hasOwnProperty'](_0x2483('0x31'))){_0x58860b[_0x2483('0x15')]=qs[_0x2483('0x15')](_0x3f1280['query'][_0x2483('0x15')]);_0x58860b[_0x2483('0x32')]=qs['offset'](_0x3f1280['query']['offset']);}_0x58860b[_0x2483('0x33')]=qs[_0x2483('0x34')](_0x3f1280[_0x2483('0x2a')]['sort']);_0x58860b[_0x2483('0x35')]=qs['filters'](_['pick'](_0x3f1280[_0x2483('0x2a')],_0x3f3e50[_0x2483('0x36')]));_0x58860b[_0x2483('0x35')]['SessionId']=_0x3b5161['id'];if(_0x3f1280[_0x2483('0x2a')][_0x2483('0x38')]){_0x58860b[_0x2483('0x35')]=_['merge'](_0x58860b[_0x2483('0x35')],{'$or':_[_0x2483('0x25')](_0x58860b[_0x2483('0x2e')],function(_0x37aada){var _0x1dedf2={};_0x1dedf2[_0x37aada]={'$like':'%'+_0x3f1280[_0x2483('0x2a')]['filter']+'%'};return _0x1dedf2;})});}_0x58860b=_[_0x2483('0x39')]({},_0x58860b,_0x3f1280[_0x2483('0x3b')]);return db[_0x2483('0x49')][_0x2483('0x16')]({'where':_0x58860b['where']})[_0x2483('0x1d')](function(_0x1f0594){_0x5dd1f0[_0x2483('0x16')]=_0x1f0594;if(_0x3f1280[_0x2483('0x2a')][_0x2483('0x3c')]){_0x58860b['include']=[{'all':!![]}];}return db[_0x2483('0x49')]['findAll'](_0x58860b);})['then'](function(_0x5d7552){_0x5dd1f0[_0x2483('0x3f')]=_0x5d7552;return _0x5dd1f0;});}})[_0x2483('0x1d')](respondWithFilteredResult(_0x59321c,_0x58860b))[_0x2483('0x44')](handleError(_0x59321c,null));}; \ No newline at end of file +var _0x7a93=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','includeAll','include','rows','show','params','keys','fields','merge','find','create','catch','body','describe','getQuestions','JscriptyQuestionReport','SessionId','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a93,0x8c));var _0x37a9=function(_0x3c0572,_0x5bbabd){_0x3c0572=_0x3c0572-0x0;var _0x1dc0a6=_0x7a93[_0x3c0572];return _0x1dc0a6;};'use strict';var emlformat=require(_0x37a9('0x0'));var rimraf=require(_0x37a9('0x1'));var zipdir=require(_0x37a9('0x2'));var jsonpatch=require(_0x37a9('0x3'));var rp=require(_0x37a9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x37a9('0x5'));var util=require(_0x37a9('0x6'));var path=require(_0x37a9('0x7'));var sox=require(_0x37a9('0x8'));var csv=require(_0x37a9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37a9('0xa'));var _=require(_0x37a9('0xb'));var squel=require(_0x37a9('0xc'));var crypto=require(_0x37a9('0xd'));var jsforce=require(_0x37a9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x37a9('0x9'));var querystring=require(_0x37a9('0xf'));var Papa=require(_0x37a9('0x10'));var Redis=require(_0x37a9('0x11'));var authService=require(_0x37a9('0x12'));var qs=require(_0x37a9('0x13'));var as=require(_0x37a9('0x14'));var hardwareService=require(_0x37a9('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x37a9('0x16'));var db=require(_0x37a9('0x17'))['db'];function respondWithStatusCode(_0x51a3ec,_0x29c968){_0x29c968=_0x29c968||0xcc;return function(_0x4a18bd){if(_0x4a18bd){return _0x51a3ec[_0x37a9('0x18')](_0x29c968);}return _0x51a3ec[_0x37a9('0x19')](_0x29c968)[_0x37a9('0x1a')]();};}function respondWithResult(_0x4c08f6,_0x528f89){_0x528f89=_0x528f89||0xc8;return function(_0x11eade){if(_0x11eade){return _0x4c08f6[_0x37a9('0x19')](_0x528f89)['json'](_0x11eade);}};}function respondWithFilteredResult(_0x3fc716,_0x98d640){return function(_0x2e83db){if(_0x2e83db){var _0x1b1545=typeof _0x98d640[_0x37a9('0x1b')]===_0x37a9('0x1c')&&typeof _0x98d640[_0x37a9('0x1d')]===_0x37a9('0x1c');var _0x355656=_0x2e83db[_0x37a9('0x1e')];var _0x43e0e5=_0x1b1545?0x0:_0x98d640[_0x37a9('0x1b')];var _0x53b57b=_0x1b1545?_0x2e83db['count']:_0x98d640['offset']+_0x98d640[_0x37a9('0x1d')];var _0x2d80bc;if(_0x53b57b>=_0x355656){_0x53b57b=_0x355656;_0x2d80bc=0xc8;}else{_0x2d80bc=0xce;}_0x3fc716[_0x37a9('0x19')](_0x2d80bc);return _0x3fc716[_0x37a9('0x1f')]('Content-Range',_0x43e0e5+'-'+_0x53b57b+'/'+_0x355656)[_0x37a9('0x20')](_0x2e83db);}return null;};}function patchUpdates(_0x91313b){return function(_0x9dae62){try{jsonpatch[_0x37a9('0x21')](_0x9dae62,_0x91313b,!![]);}catch(_0x374d96){return BPromise['reject'](_0x374d96);}return _0x9dae62[_0x37a9('0x22')]();};}function saveUpdates(_0x5f4ec7,_0x49e96a){return function(_0x559b2d){if(_0x559b2d){return _0x559b2d[_0x37a9('0x23')](_0x5f4ec7)['then'](function(_0x2e3f19){return _0x2e3f19;});}return null;};}function removeEntity(_0x32e0da,_0x5dadc0){return function(_0x112d23){if(_0x112d23){return _0x112d23['destroy']()[_0x37a9('0x24')](function(){_0x32e0da[_0x37a9('0x19')](0xcc)[_0x37a9('0x1a')]();});}};}function handleEntityNotFound(_0x2da225,_0x18e5d4){return function(_0x54a5ed){if(!_0x54a5ed){_0x2da225[_0x37a9('0x18')](0x194);}return _0x54a5ed;};}function handleError(_0x2a467a,_0xe16d94){_0xe16d94=_0xe16d94||0x1f4;return function(_0x5511a0){logger[_0x37a9('0x25')](_0x5511a0[_0x37a9('0x26')]);if(_0x5511a0[_0x37a9('0x27')]){delete _0x5511a0['name'];}_0x2a467a['status'](_0xe16d94)[_0x37a9('0x28')](_0x5511a0);};}exports['index']=function(_0x3dfe4e,_0xfb90c4){var _0x1d3a63={},_0x3dc5e5={},_0x17c193={'count':0x0,'rows':[]};var _0x3d4f4f=_[_0x37a9('0x29')](db[_0x37a9('0x2a')][_0x37a9('0x2b')],function(_0x5b6d5d){return{'name':_0x5b6d5d[_0x37a9('0x2c')],'type':_0x5b6d5d['type'][_0x37a9('0x2d')]};});_0x3dc5e5[_0x37a9('0x2e')]=_['map'](_0x3d4f4f,_0x37a9('0x27'));_0x3dc5e5[_0x37a9('0x2f')]=_['keys'](_0x3dfe4e[_0x37a9('0x2f')]);_0x3dc5e5[_0x37a9('0x30')]=_[_0x37a9('0x31')](_0x3dc5e5[_0x37a9('0x2e')],_0x3dc5e5[_0x37a9('0x2f')]);_0x1d3a63[_0x37a9('0x32')]=_[_0x37a9('0x31')](_0x3dc5e5[_0x37a9('0x2e')],qs['fields'](_0x3dfe4e[_0x37a9('0x2f')]['fields']));_0x1d3a63[_0x37a9('0x32')]=_0x1d3a63['attributes'][_0x37a9('0x33')]?_0x1d3a63[_0x37a9('0x32')]:_0x3dc5e5[_0x37a9('0x2e')];if(!_0x3dfe4e[_0x37a9('0x2f')][_0x37a9('0x34')](_0x37a9('0x35'))){_0x1d3a63[_0x37a9('0x1d')]=qs[_0x37a9('0x1d')](_0x3dfe4e['query']['limit']);_0x1d3a63[_0x37a9('0x1b')]=qs[_0x37a9('0x1b')](_0x3dfe4e[_0x37a9('0x2f')][_0x37a9('0x1b')]);}_0x1d3a63[_0x37a9('0x36')]=qs[_0x37a9('0x37')](_0x3dfe4e[_0x37a9('0x2f')][_0x37a9('0x37')]);_0x1d3a63[_0x37a9('0x38')]=qs[_0x37a9('0x30')](_[_0x37a9('0x39')](_0x3dfe4e['query'],_0x3dc5e5['filters']),_0x3d4f4f);if(_0x3dfe4e[_0x37a9('0x2f')][_0x37a9('0x3a')]){_0x1d3a63[_0x37a9('0x38')]=_['merge'](_0x1d3a63['where'],{'$or':_[_0x37a9('0x29')](_0x3d4f4f,function(_0x4a2238){if(_0x4a2238[_0x37a9('0x3b')]!=='VIRTUAL'){var _0x1417a0={};_0x1417a0[_0x4a2238[_0x37a9('0x27')]]={'$like':'%'+_0x3dfe4e[_0x37a9('0x2f')][_0x37a9('0x3a')]+'%'};return _0x1417a0;}})});}_0x1d3a63=_['merge']({},_0x1d3a63,_0x3dfe4e['options']);var _0x567a89={'where':_0x1d3a63[_0x37a9('0x38')]};return db[_0x37a9('0x2a')]['count'](_0x567a89)['then'](function(_0x47f162){_0x17c193[_0x37a9('0x1e')]=_0x47f162;if(_0x3dfe4e['query'][_0x37a9('0x3c')]){_0x1d3a63[_0x37a9('0x3d')]=[{'all':!![]}];}return db[_0x37a9('0x2a')]['findAll'](_0x1d3a63);})['then'](function(_0x2ace15){_0x17c193[_0x37a9('0x3e')]=_0x2ace15;return _0x17c193;})[_0x37a9('0x24')](respondWithFilteredResult(_0xfb90c4,_0x1d3a63))['catch'](handleError(_0xfb90c4,null));};exports[_0x37a9('0x3f')]=function(_0x5354ac,_0x2d05bc){var _0xe87633={'raw':!![],'where':{'id':_0x5354ac[_0x37a9('0x40')]['id']}},_0x2cbc3={};_0x2cbc3[_0x37a9('0x2e')]=_[_0x37a9('0x41')](db['JscriptySessionReport'][_0x37a9('0x2b')]);_0x2cbc3['query']=_[_0x37a9('0x41')](_0x5354ac[_0x37a9('0x2f')]);_0x2cbc3[_0x37a9('0x30')]=_['intersection'](_0x2cbc3[_0x37a9('0x2e')],_0x2cbc3[_0x37a9('0x2f')]);_0xe87633[_0x37a9('0x32')]=_[_0x37a9('0x31')](_0x2cbc3[_0x37a9('0x2e')],qs[_0x37a9('0x42')](_0x5354ac['query'][_0x37a9('0x42')]));_0xe87633[_0x37a9('0x32')]=_0xe87633[_0x37a9('0x32')]['length']?_0xe87633['attributes']:_0x2cbc3[_0x37a9('0x2e')];if(_0x5354ac[_0x37a9('0x2f')][_0x37a9('0x3c')]){_0xe87633[_0x37a9('0x3d')]=[{'all':!![]}];}_0xe87633=_[_0x37a9('0x43')]({},_0xe87633,_0x5354ac['options']);return db[_0x37a9('0x2a')][_0x37a9('0x44')](_0xe87633)[_0x37a9('0x24')](handleEntityNotFound(_0x2d05bc,null))['then'](respondWithResult(_0x2d05bc,null))['catch'](handleError(_0x2d05bc,null));};exports[_0x37a9('0x45')]=function(_0x3673eb,_0x3b42e6){return db[_0x37a9('0x2a')][_0x37a9('0x45')](_0x3673eb['body'],{})[_0x37a9('0x24')](respondWithResult(_0x3b42e6,0xc9))[_0x37a9('0x46')](handleError(_0x3b42e6,null));};exports[_0x37a9('0x23')]=function(_0x3c110c,_0x5155c3){if(_0x3c110c[_0x37a9('0x47')]['id']){delete _0x3c110c[_0x37a9('0x47')]['id'];}return db[_0x37a9('0x2a')][_0x37a9('0x44')]({'where':{'id':_0x3c110c['params']['id']}})[_0x37a9('0x24')](handleEntityNotFound(_0x5155c3,null))[_0x37a9('0x24')](saveUpdates(_0x3c110c['body'],null))[_0x37a9('0x24')](respondWithResult(_0x5155c3,null))[_0x37a9('0x46')](handleError(_0x5155c3,null));};exports['destroy']=function(_0x14bff8,_0x1ff0af){return db[_0x37a9('0x2a')][_0x37a9('0x44')]({'where':{'id':_0x14bff8['params']['id']}})[_0x37a9('0x24')](handleEntityNotFound(_0x1ff0af,null))[_0x37a9('0x24')](removeEntity(_0x1ff0af,null))[_0x37a9('0x46')](handleError(_0x1ff0af,null));};exports[_0x37a9('0x48')]=function(_0x1c2fb5,_0x5afa3b){return db[_0x37a9('0x2a')][_0x37a9('0x48')]()[_0x37a9('0x24')](respondWithResult(_0x5afa3b,null))[_0x37a9('0x46')](handleError(_0x5afa3b,null));};exports[_0x37a9('0x49')]=function(_0x55eafe,_0x41a1df,_0x3e148e){var _0x4525f8={'raw':!![],'where':{}};var _0x3a2804={};var _0x1e7f72={'count':0x0,'rows':[]};return db[_0x37a9('0x2a')]['findOne']({'where':{'id':_0x55eafe[_0x37a9('0x40')]['id']}})['then'](handleEntityNotFound(_0x41a1df,null))['then'](function(_0x59d5d4){if(_0x59d5d4){_0x3a2804[_0x37a9('0x2e')]=_[_0x37a9('0x41')](db[_0x37a9('0x4a')]['rawAttributes']);_0x3a2804['query']=_[_0x37a9('0x41')](_0x55eafe[_0x37a9('0x2f')]);_0x3a2804[_0x37a9('0x30')]=_[_0x37a9('0x31')](_0x3a2804[_0x37a9('0x2e')],_0x3a2804[_0x37a9('0x2f')]);_0x4525f8[_0x37a9('0x32')]=_[_0x37a9('0x31')](_0x3a2804[_0x37a9('0x2e')],qs[_0x37a9('0x42')](_0x55eafe['query']['fields']));_0x4525f8[_0x37a9('0x32')]=_0x4525f8[_0x37a9('0x32')]['length']?_0x4525f8[_0x37a9('0x32')]:_0x3a2804[_0x37a9('0x2e')];if(!_0x55eafe[_0x37a9('0x2f')][_0x37a9('0x34')](_0x37a9('0x35'))){_0x4525f8[_0x37a9('0x1d')]=qs[_0x37a9('0x1d')](_0x55eafe[_0x37a9('0x2f')]['limit']);_0x4525f8[_0x37a9('0x1b')]=qs['offset'](_0x55eafe[_0x37a9('0x2f')][_0x37a9('0x1b')]);}_0x4525f8[_0x37a9('0x36')]=qs[_0x37a9('0x37')](_0x55eafe['query'][_0x37a9('0x37')]);_0x4525f8['where']=qs[_0x37a9('0x30')](_[_0x37a9('0x39')](_0x55eafe[_0x37a9('0x2f')],_0x3a2804[_0x37a9('0x30')]));_0x4525f8['where'][_0x37a9('0x4b')]=_0x59d5d4['id'];if(_0x55eafe[_0x37a9('0x2f')][_0x37a9('0x3a')]){_0x4525f8[_0x37a9('0x38')]=_['merge'](_0x4525f8[_0x37a9('0x38')],{'$or':_[_0x37a9('0x29')](_0x4525f8[_0x37a9('0x32')],function(_0x1ec5d3){var _0x4e79ab={};_0x4e79ab[_0x1ec5d3]={'$like':'%'+_0x55eafe['query']['filter']+'%'};return _0x4e79ab;})});}_0x4525f8=_[_0x37a9('0x43')]({},_0x4525f8,_0x55eafe[_0x37a9('0x4c')]);return db[_0x37a9('0x4a')][_0x37a9('0x1e')]({'where':_0x4525f8[_0x37a9('0x38')]})[_0x37a9('0x24')](function(_0x1341e8){_0x1e7f72[_0x37a9('0x1e')]=_0x1341e8;if(_0x55eafe[_0x37a9('0x2f')][_0x37a9('0x3c')]){_0x4525f8[_0x37a9('0x3d')]=[{'all':!![]}];}return db[_0x37a9('0x4a')]['findAll'](_0x4525f8);})[_0x37a9('0x24')](function(_0x4936a2){_0x1e7f72[_0x37a9('0x3e')]=_0x4936a2;return _0x1e7f72;});}})['then'](respondWithFilteredResult(_0x41a1df,_0x4525f8))[_0x37a9('0x46')](handleError(_0x41a1df,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0adee29..8039bc9 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 _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x390846,_0x3eb289){var _0x4e7977=function(_0x23f0e4){while(--_0x23f0e4){_0x390846['push'](_0x390846['shift']());}};_0x4e7977(++_0x3eb289);}(_0xfcf0,0x138));var _0x0fcf=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xfcf0[_0x239b31];return _0x41c8be;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf006=['bluebird','path','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','../../config/logger','api'];(function(_0x12a18b,_0x450ee5){var _0x331c1d=function(_0x3d7e99){while(--_0x3d7e99){_0x12a18b['push'](_0x12a18b['shift']());}};_0x331c1d(++_0x450ee5);}(_0xf006,0x146));var _0x6f00=function(_0x194355,_0x3c42a4){_0x194355=_0x194355-0x0;var _0x5e6285=_0xf006[_0x194355];return _0x5e6285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('JscriptySessionReport',attributes,{'tableName':_0x6f00('0x7'),'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 bfd65b5..34948a9 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 _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x1967,0x173));var _0x7196=function(_0x346706,_0x4cec69){_0x346706=_0x346706-0x0;var _0x1a9673=_0x1967[_0x346706];return _0x1a9673;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5843d6,_0x39e58d){var _0x544543=function(_0x26bcb5){while(--_0x26bcb5){_0x5843d6['push'](_0x5843d6['shift']());}};_0x544543(++_0x39e58d);}(_0x2a07,0x74));var _0x72a0=function(_0x45fb8f,_0x46da98){_0x45fb8f=_0x45fb8f-0x0;var _0x3d906b=_0x2a07[_0x45fb8f];return _0x3d906b;};'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')]('JscriptySessionReport,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f6d434e..83e4362 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 _0xed04=['put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xed04,0x123));var _0x4ed0=function(_0x554ed5,_0x374b43){_0x554ed5=_0x554ed5-0x0;var _0x3fddb5=_0xed04[_0x554ed5];return _0x3fddb5;};'use strict';var multer=require(_0x4ed0('0x0'));var util=require('util');var path=require(_0x4ed0('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ed0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4ed0('0x3'));var interaction=require(_0x4ed0('0x4'));var config=require(_0x4ed0('0x5'));var controller=require(_0x4ed0('0x6'));router[_0x4ed0('0x7')]('/',controller[_0x4ed0('0x8')]);router[_0x4ed0('0x9')](_0x4ed0('0xa'),auth[_0x4ed0('0xb')](),controller[_0x4ed0('0xc')]);router[_0x4ed0('0x7')](_0x4ed0('0xd'),auth[_0x4ed0('0xb')](),controller[_0x4ed0('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc674=['/download_log_file','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','get'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0xc674,0x9b));var _0x4c67=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xc674[_0x41b0a8];return _0x3a83d4;};'use strict';var multer=require(_0x4c67('0x0'));var util=require('util');var path=require(_0x4c67('0x1'));var timeout=require(_0x4c67('0x2'));var express=require(_0x4c67('0x3'));var router=express['Router']();var fs_extra=require(_0x4c67('0x4'));var auth=require(_0x4c67('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c67('0x6'));var controller=require(_0x4c67('0x7'));router['get']('/',controller[_0x4c67('0x8')]);router[_0x4c67('0x9')]('/:id',auth[_0x4c67('0xa')](),controller[_0x4c67('0xb')]);router[_0x4c67('0xc')](_0x4c67('0xd'),auth[_0x4c67('0xa')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index df84e7f..41eeade 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 _0xd2db=['STRING','INTEGER','exports','TEXT'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xd2db,0x18a));var _0xbd2d=function(_0x4256d5,_0x11d4a8){_0x4256d5=_0x4256d5-0x0;var _0x28695b=_0xd2db[_0x4256d5];return _0x28695b;};'use strict';var Sequelize=require('sequelize');module[_0xbd2d('0x0')]={'license':{'type':Sequelize[_0xbd2d('0x1')]},'data1':{'type':Sequelize[_0xbd2d('0x2')]},'data2':{'type':Sequelize[_0xbd2d('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xbd2d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe4ea=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x2cc953,_0x3468d5){var _0x1c1227=function(_0x1abfaf){while(--_0x1abfaf){_0x2cc953['push'](_0x2cc953['shift']());}};_0x1c1227(++_0x3468d5);}(_0xe4ea,0x6e));var _0xae4e=function(_0x4a4975,_0x57a98c){_0x4a4975=_0x4a4975-0x0;var _0x25ce64=_0xe4ea[_0x4a4975];return _0x25ce64;};'use strict';var Sequelize=require(_0xae4e('0x0'));module[_0xae4e('0x1')]={'license':{'type':Sequelize[_0xae4e('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xae4e('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xae4e('0x4')],'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 d2460a3..6a79cd2 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 _0x39f4=['util','path','to-csv','ejs','lodash','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','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','error','name','send','index','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','merge','catch','body','License','find','params','get','demo','license-info.log','/var','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x584789,_0xb3c3a3){var _0x3030cc=function(_0x1ede41){while(--_0x1ede41){_0x584789['push'](_0x584789['shift']());}};_0x3030cc(++_0xb3c3a3);}(_0x39f4,0x187));var _0x439f=function(_0x20c1eb,_0x52c46d){_0x20c1eb=_0x20c1eb-0x0;var _0x1d1e3e=_0x39f4[_0x20c1eb];return _0x1d1e3e;};'use strict';var emlformat=require(_0x439f('0x0'));var rimraf=require(_0x439f('0x1'));var zipdir=require(_0x439f('0x2'));var jsonpatch=require(_0x439f('0x3'));var rp=require(_0x439f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x439f('0x5'));var path=require(_0x439f('0x6'));var sox=require('sox');var csv=require(_0x439f('0x7'));var ejs=require(_0x439f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x439f('0x9'));var squel=require(_0x439f('0xa'));var crypto=require(_0x439f('0xb'));var jsforce=require(_0x439f('0xc'));var deskjs=require(_0x439f('0xd'));var toCsv=require(_0x439f('0x7'));var querystring=require(_0x439f('0xe'));var Papa=require(_0x439f('0xf'));var Redis=require(_0x439f('0x10'));var authService=require(_0x439f('0x11'));var qs=require(_0x439f('0x12'));var as=require(_0x439f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x439f('0x14'));var utils=require(_0x439f('0x15'));var config=require(_0x439f('0x16'));var licenseUtil=require(_0x439f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117eb7,_0x193181){_0x193181=_0x193181||0xcc;return function(_0x3ff740){if(_0x3ff740){return _0x117eb7[_0x439f('0x18')](_0x193181);}return _0x117eb7[_0x439f('0x19')](_0x193181)['end']();};}function respondWithResult(_0x160704,_0x4c9bbc){_0x4c9bbc=_0x4c9bbc||0xc8;return function(_0x424782){if(_0x424782){return _0x160704[_0x439f('0x19')](_0x4c9bbc)[_0x439f('0x1a')](_0x424782);}};}function respondWithFilteredResult(_0x396312,_0x56e3c8){return function(_0xb2b5d5){if(_0xb2b5d5){var _0x3f9763=typeof _0x56e3c8[_0x439f('0x1b')]==='undefined'&&typeof _0x56e3c8[_0x439f('0x1c')]==='undefined';var _0x5c6f5e=_0xb2b5d5[_0x439f('0x1d')];var _0x5f4cde=_0x3f9763?0x0:_0x56e3c8[_0x439f('0x1b')];var _0xf091bd=_0x3f9763?_0xb2b5d5[_0x439f('0x1d')]:_0x56e3c8['offset']+_0x56e3c8[_0x439f('0x1c')];var _0x2c70bc;if(_0xf091bd>=_0x5c6f5e){_0xf091bd=_0x5c6f5e;_0x2c70bc=0xc8;}else{_0x2c70bc=0xce;}_0x396312[_0x439f('0x19')](_0x2c70bc);return _0x396312[_0x439f('0x1e')]('Content-Range',_0x5f4cde+'-'+_0xf091bd+'/'+_0x5c6f5e)[_0x439f('0x1a')](_0xb2b5d5);}return null;};}function patchUpdates(_0x1e910a){return function(_0x313c08){try{jsonpatch[_0x439f('0x1f')](_0x313c08,_0x1e910a,!![]);}catch(_0x3f2752){return BPromise[_0x439f('0x20')](_0x3f2752);}return _0x313c08[_0x439f('0x21')]();};}function saveUpdates(_0xe5015e,_0x4bbf91){return function(_0x100237){if(_0x100237){return _0x100237[_0x439f('0x22')](_0xe5015e)['then'](function(_0x22f08c){return _0x22f08c;});}return null;};}function removeEntity(_0xd25438,_0x2f5dde){return function(_0x3d7991){if(_0x3d7991){return _0x3d7991[_0x439f('0x23')]()[_0x439f('0x24')](function(){_0xd25438[_0x439f('0x19')](0xcc)[_0x439f('0x25')]();});}};}function handleEntityNotFound(_0x3fffd7,_0x1d9473){return function(_0x141e1b){if(!_0x141e1b){_0x3fffd7[_0x439f('0x18')](0x194);}return _0x141e1b;};}function handleError(_0x103346,_0x17f94a){_0x17f94a=_0x17f94a||0x1f4;return function(_0x3311ba){logger[_0x439f('0x26')](_0x3311ba['stack']);if(_0x3311ba['name']){delete _0x3311ba[_0x439f('0x27')];}_0x103346['status'](_0x17f94a)[_0x439f('0x28')](_0x3311ba);};}var utilLicense=require(_0x439f('0x17'));exports[_0x439f('0x29')]=function(_0x3703d8,_0x349963){var _0x460dac={'raw':!![],'where':{'id':0x1}},_0x2a6860={};_0x2a6860[_0x439f('0x2a')]=_[_0x439f('0x2b')](db['License'][_0x439f('0x2c')]);_0x2a6860[_0x439f('0x2d')]=_['keys'](_0x3703d8['query']);_0x2a6860[_0x439f('0x2e')]=_[_0x439f('0x2f')](_0x2a6860['model'],_0x2a6860[_0x439f('0x2d')]);_0x460dac['attributes']=_[_0x439f('0x2f')](_0x2a6860['model'],qs[_0x439f('0x30')](_0x3703d8[_0x439f('0x2d')][_0x439f('0x30')]));_0x460dac[_0x439f('0x31')]=_0x460dac[_0x439f('0x31')][_0x439f('0x32')]?_0x460dac[_0x439f('0x31')]:_0x2a6860[_0x439f('0x2a')];_0x460dac=_[_0x439f('0x33')]({},_0x460dac,_0x3703d8['options']);return utilLicense['getLicense'](_0x460dac)[_0x439f('0x24')](respondWithResult(_0x349963,null))[_0x439f('0x34')](handleError(_0x349963,null));};exports[_0x439f('0x22')]=function(_0x54545,_0x2accca){if(_0x54545[_0x439f('0x35')]['id']){delete _0x54545[_0x439f('0x35')]['id'];}return db[_0x439f('0x36')][_0x439f('0x37')]({'where':{'id':_0x54545[_0x439f('0x38')]['id']}})[_0x439f('0x24')](handleEntityNotFound(_0x2accca,null))[_0x439f('0x24')](function(_0x5570a6){var _0x48deee=_0x5570a6[_0x439f('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x48deee,_0x54545[_0x439f('0x35')]['key']);})[_0x439f('0x24')](function(_0x4d10dd){if(!_0x4d10dd[_0x439f('0x3a')]){return saveUpdates(_0x54545[_0x439f('0x35')],null);}return _0x4d10dd;})[_0x439f('0x24')](respondWithResult(_0x2accca,null))['catch'](handleError(_0x2accca,null));};exports['downloadLogFile']=function(_0x532c76,_0x2b04eb){var _0x51d6fb=_0x439f('0x3b');var _0x235180=path['join'](_0x439f('0x3c'),'log','xcally',_0x51d6fb);_0x2b04eb['setHeader'](_0x439f('0x3d'),_0x439f('0x3e')+_0x51d6fb);_0x2b04eb[_0x439f('0x1e')](_0x439f('0x3f'),_0x439f('0x40'));_0x2b04eb[_0x439f('0x41')](_0x235180);}; \ No newline at end of file +var _0x2ad4=['index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','body','params','then','get','checkLicense','key','catch','downloadLogFile','license-info.log','join','log','xcally','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','send'];(function(_0x346fe1,_0x5adfcc){var _0x293d29=function(_0x2069c7){while(--_0x2069c7){_0x346fe1['push'](_0x346fe1['shift']());}};_0x293d29(++_0x5adfcc);}(_0x2ad4,0x64));var _0x42ad=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x2ad4[_0x3a441a];return _0x3128a2;};'use strict';var emlformat=require(_0x42ad('0x0'));var rimraf=require(_0x42ad('0x1'));var zipdir=require(_0x42ad('0x2'));var jsonpatch=require(_0x42ad('0x3'));var rp=require(_0x42ad('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x42ad('0x5'));var util=require(_0x42ad('0x6'));var path=require(_0x42ad('0x7'));var sox=require(_0x42ad('0x8'));var csv=require(_0x42ad('0x9'));var ejs=require(_0x42ad('0xa'));var fs=require('fs');var fs_extra=require(_0x42ad('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x42ad('0xc'));var jsforce=require(_0x42ad('0xd'));var deskjs=require(_0x42ad('0xe'));var toCsv=require(_0x42ad('0x9'));var querystring=require(_0x42ad('0xf'));var Papa=require(_0x42ad('0x10'));var Redis=require('ioredis');var authService=require(_0x42ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x42ad('0x12'));var hardwareService=require(_0x42ad('0x13'));var logger=require(_0x42ad('0x14'))(_0x42ad('0x15'));var utils=require(_0x42ad('0x16'));var config=require(_0x42ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x42ad('0x18'))['db'];function respondWithStatusCode(_0x3854ca,_0x12998b){_0x12998b=_0x12998b||0xcc;return function(_0x368361){if(_0x368361){return _0x3854ca[_0x42ad('0x19')](_0x12998b);}return _0x3854ca['status'](_0x12998b)['end']();};}function respondWithResult(_0x2445c2,_0x4b5c9e){_0x4b5c9e=_0x4b5c9e||0xc8;return function(_0x6a48da){if(_0x6a48da){return _0x2445c2[_0x42ad('0x1a')](_0x4b5c9e)[_0x42ad('0x1b')](_0x6a48da);}};}function respondWithFilteredResult(_0x44d44d,_0x42c0c8){return function(_0x4c32c9){if(_0x4c32c9){var _0x1427ac=typeof _0x42c0c8[_0x42ad('0x1c')]===_0x42ad('0x1d')&&typeof _0x42c0c8[_0x42ad('0x1e')]===_0x42ad('0x1d');var _0x59c9a3=_0x4c32c9[_0x42ad('0x1f')];var _0x5afe5e=_0x1427ac?0x0:_0x42c0c8[_0x42ad('0x1c')];var _0x4366e4=_0x1427ac?_0x4c32c9['count']:_0x42c0c8[_0x42ad('0x1c')]+_0x42c0c8[_0x42ad('0x1e')];var _0x192555;if(_0x4366e4>=_0x59c9a3){_0x4366e4=_0x59c9a3;_0x192555=0xc8;}else{_0x192555=0xce;}_0x44d44d[_0x42ad('0x1a')](_0x192555);return _0x44d44d['set'](_0x42ad('0x20'),_0x5afe5e+'-'+_0x4366e4+'/'+_0x59c9a3)['json'](_0x4c32c9);}return null;};}function patchUpdates(_0xcf165e){return function(_0x475a6){try{jsonpatch[_0x42ad('0x21')](_0x475a6,_0xcf165e,!![]);}catch(_0x25899b){return BPromise[_0x42ad('0x22')](_0x25899b);}return _0x475a6[_0x42ad('0x23')]();};}function saveUpdates(_0x1e58cd,_0x40ed56){return function(_0x4fa72d){if(_0x4fa72d){return _0x4fa72d[_0x42ad('0x24')](_0x1e58cd)['then'](function(_0x340df3){return _0x340df3;});}return null;};}function removeEntity(_0x2bc269,_0x5135c5){return function(_0x4927e8){if(_0x4927e8){return _0x4927e8[_0x42ad('0x25')]()['then'](function(){_0x2bc269[_0x42ad('0x1a')](0xcc)[_0x42ad('0x26')]();});}};}function handleEntityNotFound(_0x3ca586,_0x3d473c){return function(_0x456f02){if(!_0x456f02){_0x3ca586[_0x42ad('0x19')](0x194);}return _0x456f02;};}function handleError(_0x3432ca,_0x32b6b5){_0x32b6b5=_0x32b6b5||0x1f4;return function(_0x760ed1){logger['error'](_0x760ed1[_0x42ad('0x27')]);if(_0x760ed1[_0x42ad('0x28')]){delete _0x760ed1[_0x42ad('0x28')];}_0x3432ca['status'](_0x32b6b5)[_0x42ad('0x29')](_0x760ed1);};}var utilLicense=require('../../config/license/util');exports[_0x42ad('0x2a')]=function(_0x4fc30c,_0x495a24){var _0x5acd21={'raw':!![],'where':{'id':0x1}},_0x5111ad={};_0x5111ad[_0x42ad('0x2b')]=_[_0x42ad('0x2c')](db[_0x42ad('0x2d')][_0x42ad('0x2e')]);_0x5111ad[_0x42ad('0x2f')]=_['keys'](_0x4fc30c[_0x42ad('0x2f')]);_0x5111ad[_0x42ad('0x30')]=_[_0x42ad('0x31')](_0x5111ad['model'],_0x5111ad[_0x42ad('0x2f')]);_0x5acd21[_0x42ad('0x32')]=_['intersection'](_0x5111ad[_0x42ad('0x2b')],qs[_0x42ad('0x33')](_0x4fc30c[_0x42ad('0x2f')][_0x42ad('0x33')]));_0x5acd21[_0x42ad('0x32')]=_0x5acd21[_0x42ad('0x32')][_0x42ad('0x34')]?_0x5acd21[_0x42ad('0x32')]:_0x5111ad['model'];_0x5acd21=_[_0x42ad('0x35')]({},_0x5acd21,_0x4fc30c[_0x42ad('0x36')]);return utilLicense[_0x42ad('0x37')](_0x5acd21)['then'](respondWithResult(_0x495a24,null))['catch'](handleError(_0x495a24,null));};exports['update']=function(_0x2cf94a,_0x1d74ca){if(_0x2cf94a[_0x42ad('0x38')]['id']){delete _0x2cf94a[_0x42ad('0x38')]['id'];}return db[_0x42ad('0x2d')]['find']({'where':{'id':_0x2cf94a[_0x42ad('0x39')]['id']}})[_0x42ad('0x3a')](handleEntityNotFound(_0x1d74ca,null))[_0x42ad('0x3a')](function(_0x5bd8ac){var _0x347449=_0x5bd8ac[_0x42ad('0x3b')]({'plain':!![]});return utilLicense[_0x42ad('0x3c')](_0x347449,_0x2cf94a[_0x42ad('0x38')][_0x42ad('0x3d')]);})['then'](function(_0x1703a8){if(!_0x1703a8['demo']){return saveUpdates(_0x2cf94a['body'],null);}return _0x1703a8;})[_0x42ad('0x3a')](respondWithResult(_0x1d74ca,null))[_0x42ad('0x3e')](handleError(_0x1d74ca,null));};exports[_0x42ad('0x3f')]=function(_0x395841,_0x9e28c8){var _0x53bdb7=_0x42ad('0x40');var _0x4ea235=path[_0x42ad('0x41')]('/var',_0x42ad('0x42'),_0x42ad('0x43'),_0x53bdb7);_0x9e28c8['setHeader']('Content-disposition',_0x42ad('0x44')+_0x53bdb7);_0x9e28c8['set'](_0x42ad('0x45'),_0x42ad('0x46'));_0x9e28c8['download'](_0x4ea235);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d761f55..c2deb7b 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 _0xbbca=['bluebird','path','rimraf','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','moment'];(function(_0x596ba2,_0x51b08b){var _0x4bdae6=function(_0x7de5f4){while(--_0x7de5f4){_0x596ba2['push'](_0x596ba2['shift']());}};_0x4bdae6(++_0x51b08b);}(_0xbbca,0x188));var _0xabbc=function(_0x3ed7df,_0xb4e77d){_0x3ed7df=_0x3ed7df-0x0;var _0x52d35d=_0xbbca[_0x3ed7df];return _0x52d35d;};'use strict';var _=require(_0xabbc('0x0'));var util=require(_0xabbc('0x1'));var logger=require(_0xabbc('0x2'))('api');var moment=require(_0xabbc('0x3'));var BPromise=require(_0xabbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabbc('0x5'));var rimraf=require(_0xabbc('0x6'));var config=require('../../config/environment');var attributes=require(_0xabbc('0x7'));module[_0xabbc('0x8')]=function(_0x298ae9,_0x31b8ca){return _0x298ae9[_0xabbc('0x9')](_0xabbc('0xa'),attributes,{'tableName':_0xabbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b08=['exports','define','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x360cac,_0x4c0c26){var _0x5406f0=function(_0x410b65){while(--_0x410b65){_0x360cac['push'](_0x360cac['shift']());}};_0x5406f0(++_0x4c0c26);}(_0x8b08,0x16a));var _0x88b0=function(_0x595cb1,_0x27a734){_0x595cb1=_0x595cb1-0x0;var _0x4ca357=_0x8b08[_0x595cb1];return _0x4ca357;};'use strict';var _=require('lodash');var util=require(_0x88b0('0x0'));var logger=require(_0x88b0('0x1'))(_0x88b0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x88b0('0x3'));var fs=require('fs');var path=require(_0x88b0('0x4'));var rimraf=require(_0x88b0('0x5'));var config=require(_0x88b0('0x6'));var attributes=require(_0x88b0('0x7'));module[_0x88b0('0x8')]=function(_0x45933d,_0x4288c8){return _0x45933d[_0x88b0('0x9')]('License',attributes,{'tableName':'license','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 ec1977c..59e9ebf 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 _0x2b53=['client','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','util','moment','randomstring','../../mysqldb','rpc','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b53,0xd6));var _0x32b5=function(_0x1c4b51,_0x2d014f){_0x1c4b51=_0x1c4b51-0x0;var _0xcf249c=_0x2b53[_0x1c4b51];return _0xcf249c;};'use strict';var _=require('lodash');var util=require(_0x32b5('0x0'));var moment=require(_0x32b5('0x1'));var BPromise=require('bluebird');var rs=require(_0x32b5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32b5('0x4'));var config=require('../../config/environment');var jayson=require(_0x32b5('0x5'));var client=jayson[_0x32b5('0x6')][_0x32b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bbe6d,_0xc60232,_0x276c33){return new BPromise(function(_0x5ef525,_0x478e1e){return client[_0x32b5('0x8')](_0x5bbe6d,_0x276c33)[_0x32b5('0x9')](function(_0x4a5c93){logger['info'](_0x32b5('0xa'),_0xc60232,_0x32b5('0xb'));logger['debug'](_0x32b5('0xc'),_0xc60232,'request\x20sent',JSON[_0x32b5('0xd')](_0x4a5c93));if(_0x4a5c93['error']){if(_0x4a5c93['error'][_0x32b5('0xe')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0xc60232,_0x4a5c93[_0x32b5('0xf')][_0x32b5('0x10')]);return _0x478e1e(_0x4a5c93[_0x32b5('0xf')][_0x32b5('0x10')]);}logger[_0x32b5('0xf')]('License,\x20%s,\x20%s',_0xc60232,_0x4a5c93[_0x32b5('0xf')][_0x32b5('0x10')]);return _0x5ef525(_0x4a5c93[_0x32b5('0xf')][_0x32b5('0x10')]);}else{logger[_0x32b5('0x11')](_0x32b5('0xa'),_0xc60232,_0x32b5('0xb'));_0x5ef525(_0x4a5c93[_0x32b5('0x12')][_0x32b5('0x10')]);}})[_0x32b5('0x13')](function(_0x33b93f){logger['error'](_0x32b5('0xa'),_0xc60232,_0x33b93f);_0x478e1e(_0x33b93f);});});} \ No newline at end of file +var _0x37e3=['http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x53fd8a,_0x247296){var _0x9fa13a=function(_0x35faf5){while(--_0x35faf5){_0x53fd8a['push'](_0x53fd8a['shift']());}};_0x9fa13a(++_0x247296);}(_0x37e3,0x121));var _0x337e=function(_0x4fb839,_0x4f2987){_0x4fb839=_0x4fb839-0x0;var _0x2a8e6f=_0x37e3[_0x4fb839];return _0x2a8e6f;};'use strict';var _=require(_0x337e('0x0'));var util=require(_0x337e('0x1'));var moment=require('moment');var BPromise=require(_0x337e('0x2'));var rs=require(_0x337e('0x3'));var fs=require('fs');var Redis=require(_0x337e('0x4'));var db=require(_0x337e('0x5'))['db'];var utils=require(_0x337e('0x6'));var logger=require('../../config/logger')(_0x337e('0x7'));var config=require(_0x337e('0x8'));var jayson=require(_0x337e('0x9'));var client=jayson['client'][_0x337e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33df32,_0x14980f,_0x46fa84){return new BPromise(function(_0x51a0ce,_0x3c99d7){return client[_0x337e('0xb')](_0x33df32,_0x46fa84)[_0x337e('0xc')](function(_0x19983e){logger[_0x337e('0xd')](_0x337e('0xe'),_0x14980f,_0x337e('0xf'));logger[_0x337e('0x10')](_0x337e('0x11'),_0x14980f,'request\x20sent',JSON[_0x337e('0x12')](_0x19983e));if(_0x19983e[_0x337e('0x13')]){if(_0x19983e['error']['code']===0x1f4){logger[_0x337e('0x13')](_0x337e('0xe'),_0x14980f,_0x19983e[_0x337e('0x13')][_0x337e('0x14')]);return _0x3c99d7(_0x19983e[_0x337e('0x13')][_0x337e('0x14')]);}logger[_0x337e('0x13')](_0x337e('0xe'),_0x14980f,_0x19983e[_0x337e('0x13')]['message']);return _0x51a0ce(_0x19983e[_0x337e('0x13')][_0x337e('0x14')]);}else{logger[_0x337e('0xd')]('License,\x20%s,\x20%s',_0x14980f,'request\x20sent');_0x51a0ce(_0x19983e[_0x337e('0x15')][_0x337e('0x14')]);}})[_0x337e('0x16')](function(_0x342833){logger['error'](_0x337e('0xe'),_0x14980f,_0x342833);_0x3c99d7(_0x342833);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2322aab..6de3399 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 _0x503d=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','addSmtp','/:id/interactions','addInteraction','addApplications','send','addAgents','update','removeDispositions','delete','removeImap','removeSmtp','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x39b2eb,_0x4faaf6){var _0xe04429=function(_0x18a0a8){while(--_0x18a0a8){_0x39b2eb['push'](_0x39b2eb['shift']());}};_0xe04429(++_0x4faaf6);}(_0x503d,0x19b));var _0xd503=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0x503d[_0x3c04d7];return _0x2fb24;};'use strict';var multer=require('multer');var util=require(_0xd503('0x0'));var path=require(_0xd503('0x1'));var timeout=require(_0xd503('0x2'));var express=require(_0xd503('0x3'));var router=express[_0xd503('0x4')]();var fs_extra=require(_0xd503('0x5'));var auth=require(_0xd503('0x6'));var interaction=require(_0xd503('0x7'));var config=require('../../config/environment');var controller=require(_0xd503('0x8'));router[_0xd503('0x9')]('/',auth[_0xd503('0xa')](),controller[_0xd503('0xb')]);router[_0xd503('0x9')](_0xd503('0xc'),auth[_0xd503('0xa')](),controller[_0xd503('0xd')]);router[_0xd503('0x9')](_0xd503('0xe'),auth[_0xd503('0xa')](),controller[_0xd503('0xf')]);router[_0xd503('0x9')](_0xd503('0x10'),auth['isAuthenticated'](),controller[_0xd503('0x11')]);router[_0xd503('0x9')](_0xd503('0x12'),auth[_0xd503('0xa')](),controller[_0xd503('0x13')]);router[_0xd503('0x9')](_0xd503('0x14'),auth[_0xd503('0xa')](),controller[_0xd503('0x15')]);router[_0xd503('0x9')](_0xd503('0x16'),auth[_0xd503('0xa')](),controller[_0xd503('0x17')]);router[_0xd503('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xd503('0x18')]);router[_0xd503('0x9')](_0xd503('0x19'),auth[_0xd503('0xa')](),controller[_0xd503('0x1a')]);router[_0xd503('0x9')](_0xd503('0x1b'),auth[_0xd503('0xa')](),controller[_0xd503('0x1c')]);router[_0xd503('0x9')](_0xd503('0x1d'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0xd503('0x9')](_0xd503('0x1e'),auth[_0xd503('0xa')](),controller['getAgents']);router[_0xd503('0x1f')](_0xd503('0x10'),auth[_0xd503('0xa')](),controller[_0xd503('0x20')]);router[_0xd503('0x1f')](_0xd503('0x12'),auth['isAuthenticated'](),controller[_0xd503('0x21')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd503('0x22')]);router[_0xd503('0x1f')]('/:id/in_servers',auth[_0xd503('0xa')](),controller['addImap']);router[_0xd503('0x1f')](_0xd503('0x16'),auth['isAuthenticated'](),controller[_0xd503('0x23')]);router[_0xd503('0x1f')](_0xd503('0x24'),auth[_0xd503('0xa')](),controller[_0xd503('0x25')]);router[_0xd503('0x1f')](_0xd503('0x19'),auth['isAuthenticated'](),controller[_0xd503('0x26')]);router[_0xd503('0x1f')]('/:id/send',auth[_0xd503('0xa')](),controller[_0xd503('0x27')]);router[_0xd503('0x1f')]('/:id/users',auth[_0xd503('0xa')](),controller[_0xd503('0x28')]);router['put'](_0xd503('0xe'),auth[_0xd503('0xa')](),controller[_0xd503('0x29')]);router['delete'](_0xd503('0x10'),auth[_0xd503('0xa')](),controller[_0xd503('0x2a')]);router[_0xd503('0x2b')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xd503('0x14'),auth['isAuthenticated'](),controller[_0xd503('0x2c')]);router['delete']('/:id/out_servers',auth[_0xd503('0xa')](),controller[_0xd503('0x2d')]);router[_0xd503('0x2b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd503('0x2b')]('/:id/users',auth[_0xd503('0xa')](),controller[_0xd503('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x1dee=['getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addAnswer','post','create','/:id/out_servers','addSmtp','/:id/applications','addApplications','/:id/send','send','addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/dispositions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1dee,0x1ce));var _0xe1de=function(_0x1fe01f,_0x19144b){_0x1fe01f=_0x1fe01f-0x0;var _0x54ae18=_0x1dee[_0x1fe01f];return _0x54ae18;};'use strict';var multer=require(_0xe1de('0x0'));var util=require(_0xe1de('0x1'));var path=require('path');var timeout=require(_0xe1de('0x2'));var express=require(_0xe1de('0x3'));var router=express['Router']();var fs_extra=require(_0xe1de('0x4'));var auth=require(_0xe1de('0x5'));var interaction=require(_0xe1de('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xe1de('0x7')]('/',auth[_0xe1de('0x8')](),controller['index']);router['get']('/describe',auth[_0xe1de('0x8')](),controller['describe']);router[_0xe1de('0x7')]('/:id',auth[_0xe1de('0x8')](),controller[_0xe1de('0x9')]);router['get'](_0xe1de('0xa'),auth['isAuthenticated'](),controller[_0xe1de('0xb')]);router[_0xe1de('0x7')](_0xe1de('0xc'),auth[_0xe1de('0x8')](),controller[_0xe1de('0xd')]);router[_0xe1de('0x7')](_0xe1de('0xe'),auth[_0xe1de('0x8')](),controller[_0xe1de('0xf')]);router[_0xe1de('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xe1de('0x7')](_0xe1de('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe1de('0x7')]('/:id/applications',auth[_0xe1de('0x8')](),controller['getApplications']);router['get'](_0xe1de('0x11'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x12')]);router['get'](_0xe1de('0x13'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x14')]);router['get'](_0xe1de('0x15'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x16')]);router['post'](_0xe1de('0xa'),auth[_0xe1de('0x8')](),controller['addDisposition']);router['post'](_0xe1de('0xc'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x17')]);router[_0xe1de('0x18')]('/',auth[_0xe1de('0x8')](),controller[_0xe1de('0x19')]);router[_0xe1de('0x18')](_0xe1de('0xe'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0xe1de('0x1a'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x1b')]);router[_0xe1de('0x18')](_0xe1de('0x10'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe1de('0x18')](_0xe1de('0x1c'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x1d')]);router['post'](_0xe1de('0x1e'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x1f')]);router[_0xe1de('0x18')](_0xe1de('0x15'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x20')]);router[_0xe1de('0x21')](_0xe1de('0x22'),auth['isAuthenticated'](),controller[_0xe1de('0x23')]);router['delete'](_0xe1de('0xa'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x24')]);router[_0xe1de('0x25')](_0xe1de('0xc'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x26')]);router[_0xe1de('0x25')](_0xe1de('0xe'),auth[_0xe1de('0x8')](),controller['removeImap']);router[_0xe1de('0x25')](_0xe1de('0x1a'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x27')]);router['delete'](_0xe1de('0x22'),auth['isAuthenticated'](),controller[_0xe1de('0x28')]);router[_0xe1de('0x25')](_0xe1de('0x15'),auth[_0xe1de('0x8')](),controller[_0xe1de('0x29')]);module[_0xe1de('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 37cdbb7..98ac80d 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 _0xf991=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','custom','getDataValue','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x46d208,_0x3654d0){var _0x3bc42f=function(_0x4722bf){while(--_0x4722bf){_0x46d208['push'](_0x46d208['shift']());}};_0x3bc42f(++_0x3654d0);}(_0xf991,0x14f));var _0x1f99=function(_0x4e0d05,_0x1252ef){_0x4e0d05=_0x4e0d05-0x0;var _0x568b50=_0xf991[_0x4e0d05];return _0x568b50;};'use strict';var Sequelize=require('sequelize');module[_0x1f99('0x0')]={'description':{'type':Sequelize[_0x1f99('0x1')]},'name':{'type':Sequelize[_0x1f99('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x1f99('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1f99('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1f99('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1f99('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x1f99('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1f99('0x1')],'allowNull':![],'defaultValue':_0x1f99('0x4')},'fontSize':{'type':Sequelize[_0x1f99('0x5')](0x2)[_0x1f99('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1f99('0x3')],'defaultValue':function(){return _0x1f99('0x7');}},'notificationSound':{'type':Sequelize[_0x1f99('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f99('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f99('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f99('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f99('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1f99('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x1f99('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5816fc){if(!_0x5816fc)this[_0x1f99('0x9')](_0x1f99('0xa'),null);this[_0x1f99('0x9')](_0x1f99('0xb'),_0x5816fc);}},'provider':{'type':Sequelize[_0x1f99('0xc')](_0x1f99('0xd'),_0x1f99('0xe'),_0x1f99('0xf'),_0x1f99('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x1f99('0x11');return this[_0x1f99('0x12')]('provider');},'set':function(_0x226384){if(_0x226384==='custom')_0x226384=null;return this[_0x1f99('0x9')](_0x1f99('0x13'),_0x226384);}}}; \ No newline at end of file +var _0x5330=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','hotmail','yahoo','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x530ec8,_0x3b402d){var _0xdd83a5=function(_0x55b080){while(--_0x55b080){_0x530ec8['push'](_0x530ec8['shift']());}};_0xdd83a5(++_0x3b402d);}(_0x5330,0x1b6));var _0x0533=function(_0x59c66e,_0x501d5b){_0x59c66e=_0x59c66e-0x0;var _0x55ae76=_0x5330[_0x59c66e];return _0x55ae76;};'use strict';var Sequelize=require(_0x0533('0x0'));module['exports']={'description':{'type':Sequelize[_0x0533('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0533('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0533('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x0533('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0533('0x1')],'allowNull':![],'defaultValue':_0x0533('0x4')},'fontSize':{'type':Sequelize[_0x0533('0x5')](0x2)[_0x0533('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0533('0x7');}},'notificationSound':{'type':Sequelize[_0x0533('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0533('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0533('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0533('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0533('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0533('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x0533('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0533('0x2')],'defaultValue':![],'comment':_0x0533('0x9'),'set':function(_0xfa1673){if(!_0xfa1673)this[_0x0533('0xa')]('mandatoryDispositionPauseId',null);this[_0x0533('0xa')](_0x0533('0xb'),_0xfa1673);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x0533('0xc'),_0x0533('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x0533('0xe')](_0x0533('0xf')))return'custom';return this[_0x0533('0xe')](_0x0533('0xf'));},'set':function(_0x3878ec){if(_0x3878ec===_0x0533('0x10'))_0x3878ec=null;return this[_0x0533('0xa')](_0x0533('0xf'),_0x3878ec);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f05a45e..0ebbde5 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 _0xf30a=['verifySmtp','CloudProvider','custom','OAuth2','VerifySmtp','Sequelize','ValidationError','addAgents','omit','spread','userMailAccount:save','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','stack','name','send','index','Imap','MailServerOut','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','Pause','find','body','modernAuthentication','Smtp','CloudProviderId','describe','addDisposition','MailAccountId','create','findOne','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','provider','email','isNil','active','user','password','pass','service','host','authentication','port','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','Interaction','Messages'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0xf30a,0x17d));var _0xaf30=function(_0x531318,_0x17f403){_0x531318=_0x531318-0x0;var _0x3109d3=_0xf30a[_0x531318];return _0x3109d3;};'use strict';var moment=require(_0xaf30('0x0'));var BPromise=require(_0xaf30('0x1'));var util=require('util');var path=require(_0xaf30('0x2'));var _=require(_0xaf30('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xaf30('0x4'));var logger=require(_0xaf30('0x5'))(_0xaf30('0x6'));var config=require(_0xaf30('0x7'));var db=require(_0xaf30('0x8'))['db'];config[_0xaf30('0x9')]=_[_0xaf30('0xa')](config[_0xaf30('0x9')],{'host':_0xaf30('0xb'),'port':0x18eb});var socket=require(_0xaf30('0xc'))(new Redis(config['redis']));require(_0xaf30('0xd'))[_0xaf30('0xe')](socket);var jayson=require(_0xaf30('0xf'));var client=jayson[_0xaf30('0x10')][_0xaf30('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x1c1bda,_0x4e7f5c,_0x248518,_0x2bb484){return new BPromise(function(_0x35b5a5,_0x4a1cf4){var _0x2789dc=_0x2bb484||client;return _0x2789dc[_0xaf30('0x12')](_0x1c1bda,_0x248518)[_0xaf30('0x13')](function(_0x4fccfb){logger['info'](_0xaf30('0x14'),_0x4e7f5c,_0xaf30('0x15'));logger[_0xaf30('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4e7f5c,_0xaf30('0x15'),JSON[_0xaf30('0x17')](_0x4fccfb));if(_0x4fccfb['error']){if(_0x4fccfb[_0xaf30('0x18')][_0xaf30('0x19')]===0x1f4){logger[_0xaf30('0x18')](_0xaf30('0x14'),_0x4e7f5c,_0x4fccfb['error']['message']);return _0x4a1cf4(_0x4fccfb[_0xaf30('0x18')][_0xaf30('0x1a')]);}logger['error'](_0xaf30('0x14'),_0x4e7f5c,_0x4fccfb[_0xaf30('0x18')][_0xaf30('0x1a')]);return _0x35b5a5(_0x4fccfb[_0xaf30('0x18')][_0xaf30('0x1a')]);}else{logger[_0xaf30('0x1b')](_0xaf30('0x14'),_0x4e7f5c,_0xaf30('0x15'));_0x35b5a5(_0x4fccfb[_0xaf30('0x1c')][_0xaf30('0x1a')]);}})[_0xaf30('0x1d')](function(_0x5e8b1b){logger[_0xaf30('0x18')](_0xaf30('0x14'),_0x4e7f5c,_0x5e8b1b);_0x4a1cf4(_0x5e8b1b);});});}function respondWithStatusCode(_0x16c174,_0x5c2a53){_0x5c2a53=_0x5c2a53||0xcc;return function(_0x40a4ac){if(_0x40a4ac){return _0x16c174[_0xaf30('0x1e')](_0x5c2a53);}return _0x16c174[_0xaf30('0x1f')](_0x5c2a53)[_0xaf30('0x20')]();};}function respondWithResult(_0x3bf92f,_0x14a5f4){_0x14a5f4=_0x14a5f4||0xc8;return function(_0x5affeb){if(_0x5affeb){return _0x3bf92f[_0xaf30('0x1f')](_0x14a5f4)['json'](_0x5affeb);}};}function respondWithFilteredResult(_0x296076,_0x5d9ee5){return function(_0x3ac058){if(_0x3ac058){var _0x45f15c=typeof _0x5d9ee5[_0xaf30('0x21')]===_0xaf30('0x22')&&typeof _0x5d9ee5[_0xaf30('0x23')]===_0xaf30('0x22');var _0x3b2bda=_0x3ac058['count'];var _0x5c4d12=_0x45f15c?0x0:_0x5d9ee5['offset'];var _0x4d1939=_0x45f15c?_0x3ac058[_0xaf30('0x24')]:_0x5d9ee5[_0xaf30('0x21')]+_0x5d9ee5['limit'];var _0x584e58;if(_0x4d1939>=_0x3b2bda){_0x4d1939=_0x3b2bda;_0x584e58=0xc8;}else{_0x584e58=0xce;}_0x296076['status'](_0x584e58);return _0x296076['set'](_0xaf30('0x25'),_0x5c4d12+'-'+_0x4d1939+'/'+_0x3b2bda)['json'](_0x3ac058);}return null;};}function saveUpdates(_0x4a52a4){return function(_0x11e422){if(_0x11e422){return _0x11e422[_0xaf30('0x26')](_0x4a52a4)[_0xaf30('0x13')](function(_0x210fe0){return _0x210fe0;});}return null;};}function removeEntity(_0x52e7ff){return function(_0x21ff2d){if(_0x21ff2d){return _0x21ff2d[_0xaf30('0x27')]()['then'](function(){var _0x2b9726=_0x21ff2d[_0xaf30('0x28')]({'plain':!![]});var _0x36ba67=_0xaf30('0x29');return db['UserProfileResource'][_0xaf30('0x27')]({'where':{'type':_0x36ba67,'resourceId':_0x2b9726['id']}})[_0xaf30('0x13')](function(){return _0x21ff2d;});})['then'](function(){_0x52e7ff[_0xaf30('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x439197){return function(_0x41fc87){if(!_0x41fc87){_0x439197[_0xaf30('0x1e')](0x194);}return _0x41fc87;};}function handleError(_0x49fe8e,_0x42cb36){_0x42cb36=_0x42cb36||0x1f4;return function(_0x4637da){logger['error'](_0x4637da[_0xaf30('0x2a')]);if(_0x4637da['name']){delete _0x4637da[_0xaf30('0x2b')];}_0x49fe8e[_0xaf30('0x1f')](_0x42cb36)[_0xaf30('0x2c')](_0x4637da);};}exports[_0xaf30('0x2d')]=function(_0x2f9815,_0x5b77ab){var _0x1e9b41={'include':[{'model':db['MailServerIn'],'as':_0xaf30('0x2e')},{'model':db[_0xaf30('0x2f')],'as':'Smtp'},{'model':db['Pause'],'as':_0xaf30('0x30')}]},_0x504a87={},_0xf42919={'count':0x0,'rows':[]};var _0x38e05a=_['map'](db[_0xaf30('0x31')][_0xaf30('0x32')],function(_0x218529){return{'name':_0x218529[_0xaf30('0x33')],'type':_0x218529[_0xaf30('0x34')][_0xaf30('0x35')]};});_0x504a87[_0xaf30('0x36')]=_[_0xaf30('0x37')](_0x38e05a,_0xaf30('0x2b'));_0x504a87[_0xaf30('0x38')]=_[_0xaf30('0x39')](_0x2f9815[_0xaf30('0x38')]);_0x504a87[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x504a87[_0xaf30('0x36')],_0x504a87[_0xaf30('0x38')]);_0x1e9b41['attributes']=_[_0xaf30('0x3b')](_0x504a87[_0xaf30('0x36')],qs[_0xaf30('0x3c')](_0x2f9815[_0xaf30('0x38')]['fields']));_0x1e9b41[_0xaf30('0x3d')]=_0x1e9b41[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x1e9b41[_0xaf30('0x3d')]:_0x504a87[_0xaf30('0x36')];if(!_0x2f9815[_0xaf30('0x38')][_0xaf30('0x3f')](_0xaf30('0x40'))){_0x1e9b41[_0xaf30('0x23')]=qs[_0xaf30('0x23')](_0x2f9815['query'][_0xaf30('0x23')]);_0x1e9b41['offset']=qs[_0xaf30('0x21')](_0x2f9815[_0xaf30('0x38')][_0xaf30('0x21')]);}_0x1e9b41[_0xaf30('0x41')]=qs[_0xaf30('0x42')](_0x2f9815[_0xaf30('0x38')]['sort']);_0x1e9b41[_0xaf30('0x43')]=qs['filters'](_['pick'](_0x2f9815['query'],_0x504a87[_0xaf30('0x3a')]),_0x38e05a);if(_0x2f9815[_0xaf30('0x38')][_0xaf30('0x44')]){_0x1e9b41[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x1e9b41[_0xaf30('0x43')],{'$or':_[_0xaf30('0x37')](_0x38e05a,function(_0x2bf296){if(_0x2bf296[_0xaf30('0x34')]!==_0xaf30('0x46')){var _0x4b4b80={};_0x4b4b80[_0x2bf296[_0xaf30('0x2b')]]={'$like':'%'+_0x2f9815['query']['filter']+'%'};return _0x4b4b80;}})});}_0x1e9b41=_[_0xaf30('0x45')]({},_0x1e9b41,_0x2f9815[_0xaf30('0x47')]);var _0x565f32={'where':_0x1e9b41['where']};return db[_0xaf30('0x31')][_0xaf30('0x24')](_0x565f32)[_0xaf30('0x13')](function(_0x6ea37f){_0xf42919[_0xaf30('0x24')]=_0x6ea37f;if(_0x2f9815[_0xaf30('0x38')][_0xaf30('0x48')]){_0x1e9b41[_0xaf30('0x49')]=[{'all':!![]}];}return db['MailAccount'][_0xaf30('0x4a')](_0x1e9b41);})[_0xaf30('0x13')](function(_0x84cb33){_0xf42919[_0xaf30('0x4b')]=_0x84cb33;return _0xf42919;})[_0xaf30('0x13')](respondWithFilteredResult(_0x5b77ab,_0x1e9b41))[_0xaf30('0x1d')](handleError(_0x5b77ab,null));};exports['show']=function(_0x2c727d,_0x205956){var _0x12df06={'raw':![],'where':{'id':_0x2c727d[_0xaf30('0x4c')]['id']},'include':[{'model':db[_0xaf30('0x4d')],'as':_0xaf30('0x2e')},{'model':db[_0xaf30('0x2f')],'as':'Smtp'},{'model':db[_0xaf30('0x4e')],'as':_0xaf30('0x30')}]},_0x539b11={};_0x539b11[_0xaf30('0x36')]=_[_0xaf30('0x39')](db[_0xaf30('0x31')][_0xaf30('0x32')]);_0x539b11[_0xaf30('0x38')]=_[_0xaf30('0x39')](_0x2c727d[_0xaf30('0x38')]);_0x539b11[_0xaf30('0x3a')]=_['intersection'](_0x539b11[_0xaf30('0x36')],_0x539b11[_0xaf30('0x38')]);_0x12df06[_0xaf30('0x3d')]=_[_0xaf30('0x3b')](_0x539b11[_0xaf30('0x36')],qs[_0xaf30('0x3c')](_0x2c727d[_0xaf30('0x38')][_0xaf30('0x3c')]));_0x12df06['attributes']=_0x12df06[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x12df06[_0xaf30('0x3d')]:_0x539b11[_0xaf30('0x36')];if(_0x2c727d['query'][_0xaf30('0x48')]){_0x12df06[_0xaf30('0x49')]=[{'all':!![]}];}_0x12df06=_[_0xaf30('0x45')]({},_0x12df06,_0x2c727d[_0xaf30('0x47')]);return db[_0xaf30('0x31')][_0xaf30('0x4f')](_0x12df06)[_0xaf30('0x13')](handleEntityNotFound(_0x205956,null))[_0xaf30('0x13')](respondWithResult(_0x205956,null))[_0xaf30('0x1d')](handleError(_0x205956,null));};exports['update']=function(_0x462ec5,_0x5f0a9b){if(_0x462ec5[_0xaf30('0x50')]['id']){delete _0x462ec5[_0xaf30('0x50')]['id'];}if(_0x462ec5[_0xaf30('0x50')]['Imap']){if(!_0x462ec5[_0xaf30('0x50')][_0xaf30('0x2e')][_0xaf30('0x51')]){_0x462ec5[_0xaf30('0x50')][_0xaf30('0x2e')]['CloudProviderId']=null;}}if(_0x462ec5['body']['Smtp']){if(!_0x462ec5['body']['Smtp'][_0xaf30('0x51')]){_0x462ec5['body'][_0xaf30('0x52')][_0xaf30('0x53')]=null;}}return db['MailAccount'][_0xaf30('0x4f')]({'where':{'id':_0x462ec5['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xaf30('0x2e')},{'model':db[_0xaf30('0x2f')],'as':_0xaf30('0x52')},{'model':db[_0xaf30('0x4e')],'as':'mandatoryDispositionPause'}]})[_0xaf30('0x13')](handleEntityNotFound(_0x5f0a9b,null))['then'](saveUpdates(_0x462ec5[_0xaf30('0x50')],null))[_0xaf30('0x13')](function(_0x462506){if(_0x462506&&_0x462ec5[_0xaf30('0x50')][_0xaf30('0x2e')]){return db['MailServerIn'][_0xaf30('0x26')](_0x462ec5['body'][_0xaf30('0x2e')],{'where':{'MailAccountId':_0x462506['id']}})[_0xaf30('0x13')](function(){return _0x462506;});}return _0x462506;})[_0xaf30('0x13')](function(_0x52d44a){if(_0x52d44a&&_0x462ec5[_0xaf30('0x50')]['Smtp']){return db[_0xaf30('0x2f')][_0xaf30('0x26')](_0x462ec5[_0xaf30('0x50')][_0xaf30('0x52')],{'where':{'MailAccountId':_0x52d44a['id']}})[_0xaf30('0x13')](function(){return _0x52d44a;});}return _0x52d44a;})[_0xaf30('0x13')](respondWithResult(_0x5f0a9b,null))[_0xaf30('0x1d')](handleError(_0x5f0a9b,null));};exports[_0xaf30('0x54')]=function(_0x3eda4b,_0x51ccca){return db[_0xaf30('0x31')][_0xaf30('0x54')]()[_0xaf30('0x13')](respondWithResult(_0x51ccca,null))['catch'](handleError(_0x51ccca,null));};exports[_0xaf30('0x55')]=function(_0x4c780d,_0x5dab47){if(_0x4c780d['body']['id']){delete _0x4c780d[_0xaf30('0x50')]['id'];}return db[_0xaf30('0x31')]['find']({'where':{'id':_0x4c780d[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x5dab47,null))[_0xaf30('0x13')](function(_0x459a69){if(_0x459a69){_0x4c780d[_0xaf30('0x50')][_0xaf30('0x56')]=_0x459a69['id'];return db['Disposition'][_0xaf30('0x57')](_0x4c780d[_0xaf30('0x50')]);}})['then'](respondWithResult(_0x5dab47,null))['catch'](handleError(_0x5dab47,null));};exports['getDispositions']=function(_0x431bc1,_0x4261e1){var _0x31e52d={'raw':![],'where':{}};var _0x53d86a={};var _0x41101c={'count':0x0,'rows':[]};return db[_0xaf30('0x31')][_0xaf30('0x58')]({'where':{'id':_0x431bc1[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x4261e1,null))[_0xaf30('0x13')](function(_0x59911e){if(_0x59911e){_0x53d86a[_0xaf30('0x36')]=_[_0xaf30('0x39')](db[_0xaf30('0x59')][_0xaf30('0x32')]);_0x53d86a['query']=_[_0xaf30('0x39')](_0x431bc1['query']);_0x53d86a[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x53d86a[_0xaf30('0x36')],_0x53d86a[_0xaf30('0x38')]);_0x31e52d[_0xaf30('0x3d')]=_['intersection'](_0x53d86a['model'],qs[_0xaf30('0x3c')](_0x431bc1[_0xaf30('0x38')]['fields']));_0x31e52d['attributes']=_0x31e52d[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x31e52d[_0xaf30('0x3d')]:_0x53d86a['model'];if(!_0x431bc1['query']['hasOwnProperty'](_0xaf30('0x40'))){_0x31e52d[_0xaf30('0x23')]=qs[_0xaf30('0x23')](_0x431bc1['query'][_0xaf30('0x23')]);_0x31e52d[_0xaf30('0x21')]=qs[_0xaf30('0x21')](_0x431bc1[_0xaf30('0x38')][_0xaf30('0x21')]);}_0x31e52d[_0xaf30('0x41')]=qs[_0xaf30('0x42')](_0x431bc1[_0xaf30('0x38')]['sort']);_0x31e52d['where']=qs[_0xaf30('0x3a')](_[_0xaf30('0x5a')](_0x431bc1[_0xaf30('0x38')],_0x53d86a[_0xaf30('0x3a')]));_0x31e52d['where']['MailAccountId']=_0x59911e['id'];if(_0x431bc1[_0xaf30('0x38')][_0xaf30('0x44')]){_0x31e52d[_0xaf30('0x43')]=_['merge'](_0x31e52d['where'],{'$or':_[_0xaf30('0x37')](_0x31e52d[_0xaf30('0x3d')],function(_0x1e3547){var _0x19c388={};_0x19c388[_0x1e3547]={'$like':'%'+_0x431bc1[_0xaf30('0x38')][_0xaf30('0x44')]+'%'};return _0x19c388;})});}_0x31e52d=_[_0xaf30('0x45')]({},_0x31e52d,_0x431bc1[_0xaf30('0x47')]);return db['Disposition'][_0xaf30('0x24')]({'where':_0x31e52d[_0xaf30('0x43')]})[_0xaf30('0x13')](function(_0x2752f4){_0x41101c['count']=_0x2752f4;if(_0x431bc1[_0xaf30('0x38')]['includeAll']){_0x31e52d[_0xaf30('0x49')]=[{'all':!![]}];}return db[_0xaf30('0x59')][_0xaf30('0x4a')](_0x31e52d);})[_0xaf30('0x13')](function(_0x4998ea){_0x41101c['rows']=_0x4998ea;return _0x41101c;});}})['then'](respondWithFilteredResult(_0x4261e1,_0x31e52d))['catch'](handleError(_0x4261e1,null));};exports[_0xaf30('0x5b')]=function(_0x3e1115,_0x4543e9){return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x3e1115[_0xaf30('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4543e9,null))['then'](function(_0x3c5259){if(_0x3c5259){return _0x3c5259[_0xaf30('0x5b')](_0x3e1115[_0xaf30('0x38')][_0xaf30('0x5c')]);}})[_0xaf30('0x13')](respondWithStatusCode(_0x4543e9,null))[_0xaf30('0x1d')](handleError(_0x4543e9,null));};exports[_0xaf30('0x5d')]=function(_0x5b2403,_0x3530a8){if(_0x5b2403['body']['id']){delete _0x5b2403[_0xaf30('0x50')]['id'];}return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x5b2403[_0xaf30('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3530a8,null))[_0xaf30('0x13')](function(_0x40b4bd){if(_0x40b4bd){_0x5b2403[_0xaf30('0x50')][_0xaf30('0x56')]=_0x40b4bd['id'];return db[_0xaf30('0x5e')][_0xaf30('0x57')](_0x5b2403[_0xaf30('0x50')]);}})['then'](respondWithResult(_0x3530a8,null))[_0xaf30('0x1d')](handleError(_0x3530a8,null));};exports[_0xaf30('0x5f')]=function(_0x3eca4b,_0x15c417){var _0x4a19c2={'raw':![],'where':{}};var _0x54bb27={};var _0x388e85={'count':0x0,'rows':[]};return db[_0xaf30('0x31')][_0xaf30('0x58')]({'where':{'id':_0x3eca4b['params']['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x15c417,null))['then'](function(_0x41ded5){if(_0x41ded5){_0x54bb27[_0xaf30('0x36')]=_[_0xaf30('0x39')](db[_0xaf30('0x5e')][_0xaf30('0x32')]);_0x54bb27[_0xaf30('0x38')]=_[_0xaf30('0x39')](_0x3eca4b[_0xaf30('0x38')]);_0x54bb27[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x54bb27['model'],_0x54bb27[_0xaf30('0x38')]);_0x4a19c2['attributes']=_[_0xaf30('0x3b')](_0x54bb27[_0xaf30('0x36')],qs[_0xaf30('0x3c')](_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x3c')]));_0x4a19c2[_0xaf30('0x3d')]=_0x4a19c2[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x4a19c2[_0xaf30('0x3d')]:_0x54bb27[_0xaf30('0x36')];if(!_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x3f')]('nolimit')){_0x4a19c2[_0xaf30('0x23')]=qs[_0xaf30('0x23')](_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x23')]);_0x4a19c2['offset']=qs[_0xaf30('0x21')](_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x21')]);}_0x4a19c2[_0xaf30('0x41')]=qs[_0xaf30('0x42')](_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x42')]);_0x4a19c2[_0xaf30('0x43')]=qs[_0xaf30('0x3a')](_[_0xaf30('0x5a')](_0x3eca4b[_0xaf30('0x38')],_0x54bb27[_0xaf30('0x3a')]));_0x4a19c2[_0xaf30('0x43')][_0xaf30('0x56')]=_0x41ded5['id'];if(_0x3eca4b[_0xaf30('0x38')]['filter']){_0x4a19c2[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x4a19c2[_0xaf30('0x43')],{'$or':_[_0xaf30('0x37')](_0x4a19c2['attributes'],function(_0x590136){var _0x2d512e={};_0x2d512e[_0x590136]={'$like':'%'+_0x3eca4b[_0xaf30('0x38')][_0xaf30('0x44')]+'%'};return _0x2d512e;})});}_0x4a19c2=_[_0xaf30('0x45')]({},_0x4a19c2,_0x3eca4b[_0xaf30('0x47')]);return db[_0xaf30('0x5e')][_0xaf30('0x24')]({'where':_0x4a19c2['where']})[_0xaf30('0x13')](function(_0x33e616){_0x388e85[_0xaf30('0x24')]=_0x33e616;if(_0x3eca4b[_0xaf30('0x38')]['includeAll']){_0x4a19c2[_0xaf30('0x49')]=[{'all':!![]}];}return db[_0xaf30('0x5e')][_0xaf30('0x4a')](_0x4a19c2);})[_0xaf30('0x13')](function(_0x477c26){_0x388e85[_0xaf30('0x4b')]=_0x477c26;return _0x388e85;});}})[_0xaf30('0x13')](respondWithFilteredResult(_0x15c417,_0x4a19c2))[_0xaf30('0x1d')](handleError(_0x15c417,null));};exports[_0xaf30('0x60')]=function(_0x35ebfd,_0x299f5a){return db['MailAccount']['find']({'where':{'id':_0x35ebfd[_0xaf30('0x4c')]['id']}})['then'](handleEntityNotFound(_0x299f5a,null))['then'](function(_0xd5fa01){if(_0xd5fa01){return _0xd5fa01[_0xaf30('0x60')](_0x35ebfd[_0xaf30('0x38')]['ids']);}})[_0xaf30('0x13')](respondWithStatusCode(_0x299f5a,null))[_0xaf30('0x1d')](handleError(_0x299f5a,null));};exports[_0xaf30('0x57')]=function(_0x31ca9e,_0x5c4a1f){var _0xcb185d={'name':_0x31ca9e['body'][_0xaf30('0x2b')],'key':_0x31ca9e[_0xaf30('0x50')]['key'],'provider':_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x61')]==='custom'?null:_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x61')],'email':_0x31ca9e['body'][_0xaf30('0x62')],'ListId':_0x31ca9e['body']['ListId'],'active':!_[_0xaf30('0x63')](_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x64')])?_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x64')]:!![],'description':_0x31ca9e[_0xaf30('0x50')]['description']||null,'Imap':{},'Smtp':{}};if(_0xcb185d['provider']){_0xcb185d[_0xaf30('0x2e')]['user']=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x65')]=_0x31ca9e[_0xaf30('0x50')]['username'];_0xcb185d['Imap'][_0xaf30('0x66')]=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x67')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x66')];if(_0x31ca9e['body'][_0xaf30('0x51')]){_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x51')]=_0xcb185d[_0xaf30('0x52')]['modernAuthentication']=!![];_0xcb185d[_0xaf30('0x2e')]['CloudProviderId']=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x53')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x53')];_0xcb185d['Imap'][_0xaf30('0x66')]=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x67')]=null;}else{_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x53')]=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x53')]=null;}_0xcb185d['Imap'][_0xaf30('0x68')]=_0xcb185d['Smtp']['service']=null;_0xcb185d['Imap'][_0xaf30('0x69')]=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x69')]=null;_0xcb185d['Imap']['port']=_0xcb185d['Smtp']['port']=null;}else{if(_0x31ca9e['body'][_0xaf30('0x6a')]){_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x65')]=_0xcb185d['Smtp'][_0xaf30('0x65')]=_0x31ca9e[_0xaf30('0x50')]['username'];_0xcb185d['Imap']['password']=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x67')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x66')];}else{_0xcb185d[_0xaf30('0x2e')]['authentication']=_0xcb185d[_0xaf30('0x52')]['authentication']=![];_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x65')]=_0xcb185d[_0xaf30('0x52')]['user']=null;_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x66')]=_0xcb185d[_0xaf30('0x52')][_0xaf30('0x67')]=null;}_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x69')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x2e')][_0xaf30('0x69')];_0xcb185d[_0xaf30('0x2e')][_0xaf30('0x6b')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x2e')][_0xaf30('0x6b')];_0xcb185d[_0xaf30('0x52')][_0xaf30('0x69')]=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x52')][_0xaf30('0x69')];_0xcb185d['Smtp']['port']=_0x31ca9e[_0xaf30('0x50')][_0xaf30('0x52')][_0xaf30('0x6b')];}return db[_0xaf30('0x31')][_0xaf30('0x57')](_0xcb185d,{'include':[{'model':db[_0xaf30('0x2f')],'as':_0xaf30('0x52')},{'model':db[_0xaf30('0x4d')],'as':_0xaf30('0x2e')}]})[_0xaf30('0x13')](function(_0x3ec9d0){var _0x48c1ab=_0x31ca9e[_0xaf30('0x65')][_0xaf30('0x28')]({'plain':!![]});if(!_0x48c1ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48c1ab[_0xaf30('0x6c')]===_0xaf30('0x65')){var _0x3734de=_0x3ec9d0[_0xaf30('0x28')]({'plain':!![]});return db[_0xaf30('0x6d')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x48c1ab[_0xaf30('0x6e')]},'raw':!![]})['then'](function(_0x248e7f){if(_0x248e7f&&_0x248e7f['autoAssociation']===0x0){return db[_0xaf30('0x6f')]['create']({'name':_0x3734de[_0xaf30('0x2b')],'resourceId':_0x3734de['id'],'type':_0x248e7f['name'],'sectionId':_0x248e7f['id']},{})[_0xaf30('0x13')](function(){return _0x3ec9d0;});}else{return _0x3ec9d0;}})[_0xaf30('0x1d')](function(_0x2134ad){logger[_0xaf30('0x18')](_0xaf30('0x70'),_0x2134ad);throw _0x2134ad;});}return _0x3ec9d0;})['then'](respondWithResult(_0x5c4a1f,0xc9))[_0xaf30('0x1d')](handleError(_0x5c4a1f,null));};exports[_0xaf30('0x71')]=function(_0xec0c80,_0x35405c){return db['MailAccount'][_0xaf30('0x58')]({'where':{'id':_0xec0c80['params']['id']}})['then'](handleEntityNotFound(_0x35405c,null))[_0xaf30('0x13')](function(_0x55173f){if(_0x55173f){return _0x55173f[_0xaf30('0x71')]();}return null;})[_0xaf30('0x13')](respondWithResult(_0x35405c,null))[_0xaf30('0x1d')](handleError(_0x35405c,null));};exports[_0xaf30('0x72')]=function(_0x1fae54,_0x57a961){if(_0x1fae54[_0xaf30('0x50')]['id']){delete _0x1fae54[_0xaf30('0x50')]['id'];}return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x1fae54[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x57a961,null))[_0xaf30('0x13')](function(_0x20de80){if(_0x20de80){_0x1fae54[_0xaf30('0x50')][_0xaf30('0x56')]=_0x20de80['id'];return db[_0xaf30('0x4d')][_0xaf30('0x57')](_0x1fae54['body']);}})[_0xaf30('0x13')](respondWithResult(_0x57a961,null))[_0xaf30('0x1d')](handleError(_0x57a961,null));};exports[_0xaf30('0x73')]=function(_0x8a669a,_0x210389){return db[_0xaf30('0x31')]['findOne']({'where':{'id':_0x8a669a[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x210389,null))[_0xaf30('0x13')](function(_0x1dd26f){if(_0x1dd26f){return _0x1dd26f['setImap'](null);}return null;})[_0xaf30('0x13')](respondWithStatusCode(_0x210389,null))[_0xaf30('0x1d')](handleError(_0x210389,null));};exports[_0xaf30('0x74')]=function(_0x20e5c8,_0x550304){return db['MailAccount'][_0xaf30('0x58')]({'where':{'id':_0x20e5c8['params']['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x550304,null))['then'](function(_0x37eeb1){if(_0x37eeb1){return _0x37eeb1[_0xaf30('0x74')]();}return null;})[_0xaf30('0x13')](respondWithResult(_0x550304,null))[_0xaf30('0x1d')](handleError(_0x550304,null));};exports[_0xaf30('0x75')]=function(_0x24138c,_0x58a46f){if(_0x24138c[_0xaf30('0x50')]['id']){delete _0x24138c[_0xaf30('0x50')]['id'];}return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x24138c[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x58a46f,null))['then'](function(_0x3a3fc5){if(_0x3a3fc5){_0x24138c[_0xaf30('0x50')][_0xaf30('0x56')]=_0x3a3fc5['id'];return db['MailServerOut'][_0xaf30('0x57')](_0x24138c[_0xaf30('0x50')]);}})[_0xaf30('0x13')](respondWithResult(_0x58a46f,null))[_0xaf30('0x1d')](handleError(_0x58a46f,null));};exports[_0xaf30('0x76')]=function(_0x448eea,_0x3c9928){return db[_0xaf30('0x31')][_0xaf30('0x58')]({'where':{'id':_0x448eea[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x3c9928,null))[_0xaf30('0x13')](function(_0xe336bb){if(_0xe336bb){return _0xe336bb['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x3c9928,null))[_0xaf30('0x1d')](handleError(_0x3c9928,null));};exports[_0xaf30('0x77')]=function(_0x49ef00,_0x54f17d){return db[_0xaf30('0x78')][_0xaf30('0x4f')]({'where':{'id':_0x49ef00[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x54f17d,null))[_0xaf30('0x13')](function(_0x971680){if(_0x971680){return _0x971680[_0xaf30('0x77')](_0x49ef00[_0xaf30('0x50')][_0xaf30('0x5c')],_['omit'](_0x49ef00['body'],[_0xaf30('0x5c'),'id'])||{});}})[_0xaf30('0x13')](respondWithResult(_0x54f17d,null))[_0xaf30('0x1d')](handleError(_0x54f17d,null));};exports[_0xaf30('0x79')]=function(_0x364833,_0x3b29aa){var _0x47d292={'raw':![],'where':{}};var _0x2f54ef={};var _0x6a6bc6={'count':0x0,'rows':[]};return db[_0xaf30('0x31')]['findOne']({'where':{'id':_0x364833[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x3b29aa,null))[_0xaf30('0x13')](function(_0x3ddb63){if(_0x3ddb63){_0x2f54ef['model']=_[_0xaf30('0x39')](db[_0xaf30('0x78')][_0xaf30('0x32')]);_0x2f54ef['query']=_['keys'](_0x364833['query']);_0x2f54ef[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x2f54ef[_0xaf30('0x36')],_0x2f54ef[_0xaf30('0x38')]);_0x47d292[_0xaf30('0x3d')]=_['intersection'](_0x2f54ef['model'],qs[_0xaf30('0x3c')](_0x364833[_0xaf30('0x38')]['fields']));_0x47d292['attributes']=_0x47d292[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x47d292[_0xaf30('0x3d')]:_0x2f54ef[_0xaf30('0x36')];if(!_0x364833[_0xaf30('0x38')][_0xaf30('0x3f')](_0xaf30('0x40'))){_0x47d292['limit']=qs['limit'](_0x364833[_0xaf30('0x38')]['limit']);_0x47d292[_0xaf30('0x21')]=qs[_0xaf30('0x21')](_0x364833['query'][_0xaf30('0x21')]);}_0x47d292['order']=qs['sort'](_0x364833[_0xaf30('0x38')][_0xaf30('0x42')]);_0x47d292[_0xaf30('0x43')]=qs[_0xaf30('0x3a')](_[_0xaf30('0x5a')](_0x364833['query'],_0x2f54ef[_0xaf30('0x3a')]));_0x47d292[_0xaf30('0x43')][_0xaf30('0x56')]=_0x3ddb63['id'];if(_0x364833[_0xaf30('0x38')][_0xaf30('0x44')]){_0x47d292[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x47d292[_0xaf30('0x43')],{'$or':_['map'](_0x47d292[_0xaf30('0x3d')],function(_0x4145f7){var _0x2fd845={};_0x2fd845[_0x4145f7]={'$like':'%'+_0x364833[_0xaf30('0x38')][_0xaf30('0x44')]+'%'};return _0x2fd845;})});}_0x47d292=_[_0xaf30('0x45')]({},_0x47d292,_0x364833[_0xaf30('0x47')]);return db[_0xaf30('0x78')][_0xaf30('0x24')]({'where':_0x47d292[_0xaf30('0x43')]})['then'](function(_0x278fb4){_0x6a6bc6[_0xaf30('0x24')]=_0x278fb4;if(_0x364833[_0xaf30('0x38')]['includeAll']){_0x47d292[_0xaf30('0x49')]=[{'model':db[_0xaf30('0x7a')],'as':_0xaf30('0x7b'),'required':![]},{'model':db[_0xaf30('0x7c')],'as':_0xaf30('0x7d'),'attributes':[_0xaf30('0x2b'),_0xaf30('0x7e'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xaf30('0x7f'),'attributes':['id',_0xaf30('0x2b'),'color'],'where':_0x364833[_0xaf30('0x38')]['tag']?{'id':_0x364833[_0xaf30('0x38')][_0xaf30('0x80')]}:undefined,'required':_0x364833[_0xaf30('0x38')][_0xaf30('0x80')]?!![]:![]}];}return db[_0xaf30('0x78')][_0xaf30('0x4a')](_0x47d292);})['then'](function(_0x5c7b07){_0x6a6bc6['rows']=_0x5c7b07;return _0x6a6bc6;});}})[_0xaf30('0x13')](respondWithFilteredResult(_0x3b29aa,_0x47d292))[_0xaf30('0x1d')](handleError(_0x3b29aa,null));};exports['addApplications']=function addApplications(_0x4e196e,_0x295e1a){var _0x30625e=_0x4e196e['params']['id'];var _0x120d88=_0x4e196e[_0xaf30('0x50')];var _0x5cab24=0xc8;var _0x5876c2=null;return db[_0xaf30('0x81')][_0xaf30('0x82')]({'isolationLevel':db[_0xaf30('0x81')]['Transaction'][_0xaf30('0x83')][_0xaf30('0x84')]},function(_0x5b6892){return db[_0xaf30('0x31')]['findOne']({'where':{'id':_0x30625e},'transaction':_0x5b6892})['then'](function(_0x49ef71){if(_0x49ef71){return db[_0xaf30('0x85')]['destroy']({'where':{'MailAccountId':_0x30625e},'transaction':_0x5b6892})[_0xaf30('0x13')](function(){var _0x24ff8c=_[_0xaf30('0x37')](_0x120d88,function(_0x277aa9){_0x277aa9[_0xaf30('0x56')]=_0x30625e;return _0x277aa9;});return db[_0xaf30('0x85')]['bulkCreate'](_0x24ff8c,{'transaction':_0x5b6892});});}else{_0x5cab24=0x194;_0x5876c2=[];}});})[_0xaf30('0x13')](function(){if(_0x5cab24!==0x194){return db[_0xaf30('0x85')][_0xaf30('0x86')]({'where':{'MailAccountId':_0x30625e},'order':_0xaf30('0x87')})[_0xaf30('0x13')](function(_0x4a24ec){_0x5876c2=_0x4a24ec;});}})[_0xaf30('0x1d')](function(_0x36c472){_0x5cab24=0x1f4;logger[_0xaf30('0x18')](_0x36c472[_0xaf30('0x2a')]);if(_0x36c472[_0xaf30('0x2b')]){delete _0x36c472[_0xaf30('0x2b')];}_0x5876c2=_0x36c472;})[_0xaf30('0x88')](function(){if(_0x5876c2===null){_0x295e1a['sendStatus'](_0x5cab24);}else{if(_0x5cab24===0x1f4){_0x295e1a[_0xaf30('0x1f')](_0x5cab24)[_0xaf30('0x2c')](_0x5876c2);}else{_0x295e1a[_0xaf30('0x1f')](_0x5cab24)[_0xaf30('0x89')](_0x5876c2);}}});};exports['getApplications']=function(_0x30b6f3,_0x47078c){var _0x1c9cf5={};var _0x5dd2ef={};var _0x230553;var _0x25685b;return db['MailAccount'][_0xaf30('0x58')]({'where':{'id':_0x30b6f3[_0xaf30('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47078c,null))['then'](function(_0x57d034){if(_0x57d034){_0x230553=_0x57d034;_0x5dd2ef[_0xaf30('0x36')]=_[_0xaf30('0x39')](db['MailApplication'][_0xaf30('0x32')]);_0x5dd2ef[_0xaf30('0x38')]=_[_0xaf30('0x39')](_0x30b6f3['query']);_0x5dd2ef[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x5dd2ef[_0xaf30('0x36')],_0x5dd2ef['query']);_0x1c9cf5[_0xaf30('0x3d')]=_['intersection'](_0x5dd2ef[_0xaf30('0x36')],qs['fields'](_0x30b6f3[_0xaf30('0x38')][_0xaf30('0x3c')]));_0x1c9cf5[_0xaf30('0x3d')]=_0x1c9cf5[_0xaf30('0x3d')]['length']?_0x1c9cf5[_0xaf30('0x3d')]:_0x5dd2ef['model'];_0x1c9cf5[_0xaf30('0x41')]=qs['sort'](_0x30b6f3['query']['sort']);_0x1c9cf5[_0xaf30('0x43')]=qs[_0xaf30('0x3a')](_[_0xaf30('0x5a')](_0x30b6f3[_0xaf30('0x38')],_0x5dd2ef['filters']));if(_0x30b6f3['query'][_0xaf30('0x44')]){_0x1c9cf5[_0xaf30('0x43')]=_['merge'](_0x1c9cf5[_0xaf30('0x43')],{'$or':_[_0xaf30('0x37')](_0x1c9cf5[_0xaf30('0x3d')],function(_0x311657){var _0x58ff25={};_0x58ff25[_0x311657]={'$like':'%'+_0x30b6f3['query'][_0xaf30('0x44')]+'%'};return _0x58ff25;})});}_0x1c9cf5=_['merge']({},_0x1c9cf5,_0x30b6f3[_0xaf30('0x47')]);return _0x230553['getApplications'](_0x1c9cf5);}})['then'](function(_0x1eae9b){if(_0x1eae9b){_0x25685b=_0x1eae9b[_0xaf30('0x3e')];if(!_0x30b6f3[_0xaf30('0x38')][_0xaf30('0x3f')]('nolimit')){_0x1c9cf5[_0xaf30('0x23')]=qs['limit'](_0x30b6f3[_0xaf30('0x38')][_0xaf30('0x23')]);_0x1c9cf5[_0xaf30('0x21')]=qs['offset'](_0x30b6f3['query'][_0xaf30('0x21')]);}return _0x230553[_0xaf30('0x8a')](_0x1c9cf5);}})[_0xaf30('0x13')](function(_0x5c1983){if(_0x5c1983){return _0x5c1983?{'count':_0x25685b,'rows':_0x5c1983}:null;}})[_0xaf30('0x13')](respondWithResult(_0x47078c,null))['catch'](handleError(_0x47078c,null));};exports[_0xaf30('0x8b')]=function(_0x3f5f0a,_0x26f179){var _0x50c091={'raw':!![],'where':{}};var _0x575a89={};var _0x496963={'count':0x0,'rows':[]};return db['MailAccount'][_0xaf30('0x58')]({'where':{'id':_0x3f5f0a[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x26f179,null))['then'](function(_0x28e68d){if(_0x28e68d){_0x575a89[_0xaf30('0x36')]=_[_0xaf30('0x39')](db[_0xaf30('0x8c')]['rawAttributes']);_0x575a89[_0xaf30('0x38')]=_[_0xaf30('0x39')](_0x3f5f0a[_0xaf30('0x38')]);_0x575a89[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x575a89[_0xaf30('0x36')],_0x575a89['query']);_0x50c091['attributes']=_['intersection'](_0x575a89[_0xaf30('0x36')],qs[_0xaf30('0x3c')](_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x3c')]));_0x50c091[_0xaf30('0x3d')]=_0x50c091['attributes']['length']?_0x50c091[_0xaf30('0x3d')]:_0x575a89['model'];if(!_0x3f5f0a[_0xaf30('0x38')]['hasOwnProperty'](_0xaf30('0x40'))){_0x50c091[_0xaf30('0x23')]=qs[_0xaf30('0x23')](_0x3f5f0a[_0xaf30('0x38')]['limit']);_0x50c091['offset']=qs[_0xaf30('0x21')](_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x21')]);}_0x50c091[_0xaf30('0x41')]=qs[_0xaf30('0x42')](_0x3f5f0a['query'][_0xaf30('0x42')]);_0x50c091[_0xaf30('0x43')]=qs['filters'](_[_0xaf30('0x5a')](_0x3f5f0a[_0xaf30('0x38')],_0x575a89['filters']));_0x50c091[_0xaf30('0x43')][_0xaf30('0x56')]=_0x28e68d['id'];if(_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x44')]){_0x50c091[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x50c091[_0xaf30('0x43')],{'$or':_[_0xaf30('0x37')](_0x50c091[_0xaf30('0x3d')],function(_0x134bee){var _0x40a050={};_0x40a050[_0x134bee]={'$like':'%'+_0x3f5f0a['query']['filter']+'%'};return _0x40a050;})});}if(_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x8d')]){var _0x416068=_0x3f5f0a[_0xaf30('0x38')]['$gte'][_0xaf30('0x8e')](',');var _0x178ab8={};_0x178ab8[_0x416068[0x0]]={'$gte':moment(_0x416068[0x1])[_0xaf30('0x8f')](_0xaf30('0x90'))};_0x50c091[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x50c091[_0xaf30('0x43')],_0x178ab8);}_0x50c091=_['merge']({},_0x50c091,_0x3f5f0a[_0xaf30('0x47')]);return db[_0xaf30('0x8c')][_0xaf30('0x24')]({'where':_0x50c091['where']})[_0xaf30('0x13')](function(_0x4a3156){_0x496963[_0xaf30('0x24')]=_0x4a3156;if(_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x48')]){_0x50c091[_0xaf30('0x49')]=[{'all':!![]}];}return db[_0xaf30('0x8c')][_0xaf30('0x4a')](_0x50c091);})[_0xaf30('0x13')](function(_0x24f06f){if(_0x3f5f0a[_0xaf30('0x38')][_0xaf30('0x91')]==='true'){for(var _0x3fc31e=0x0;_0x3fc31e<_0x24f06f[_0xaf30('0x3e')];_0x3fc31e++){_0x24f06f[_0x3fc31e][_0xaf30('0x50')]=juice(_0x24f06f[_0x3fc31e][_0xaf30('0x50')]);}}_0x496963[_0xaf30('0x4b')]=_0x24f06f;return _0x496963;});}})[_0xaf30('0x13')](respondWithFilteredResult(_0x26f179,_0x50c091))[_0xaf30('0x1d')](handleError(_0x26f179,null));};exports[_0xaf30('0x2c')]=function(_0x1ee570,_0x6d2101){var _0x129e29,_0x3b96fc={},_0x2bd863;if(_0x1ee570[_0xaf30('0x50')]['to']){_0x2bd863=_0x1ee570[_0xaf30('0x50')]['to'][_0xaf30('0x8e')](',')[0x0];}return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x1ee570[_0xaf30('0x4c')]['id']},'include':[{'model':db[_0xaf30('0x92')],'as':_0xaf30('0x93'),'include':[{'model':db['CmContact'],'as':_0xaf30('0x94'),'where':{'email':_0x2bd863},'limit':0x1,'order':[[_0xaf30('0x95'),'DESC']]}]},{'model':db[_0xaf30('0x2f')],'as':'Smtp','raw':!![]}]})[_0xaf30('0x13')](handleEntityNotFound(_0x6d2101,null))[_0xaf30('0x13')](function(_0x1d52c4){if(_0x1d52c4){_0x129e29=_0x1d52c4;if(_0x1d52c4[_0xaf30('0x52')]){if(_[_0xaf30('0x63')](_0x1ee570[_0xaf30('0x50')][_0xaf30('0x96')])){_0x1ee570[_0xaf30('0x50')][_0xaf30('0x96')]=util['format'](_0xaf30('0x97'),_0x1d52c4[_0xaf30('0x2b')],_0x1d52c4[_0xaf30('0x62')]||_0x1d52c4[_0xaf30('0x52')][_0xaf30('0x65')]);}if(_0x1ee570['body']['attachments']&&_0x1ee570[_0xaf30('0x50')][_0xaf30('0x98')]['length']){for(var _0x15ec6d=0x0;_0x15ec6d<_0x1ee570[_0xaf30('0x50')][_0xaf30('0x98')][_0xaf30('0x3e')];_0x15ec6d+=0x1){_0x1ee570[_0xaf30('0x50')][_0xaf30('0x98')][_0x15ec6d]={'filename':_0x1ee570[_0xaf30('0x50')][_0xaf30('0x98')][_0x15ec6d]['name'],'path':path[_0xaf30('0x99')](config[_0xaf30('0x9a')],_0xaf30('0x9b'),_0x1ee570[_0xaf30('0x50')][_0xaf30('0x98')][_0x15ec6d][_0xaf30('0x9c')])};}}var _0xddbf65={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1d52c4[_0xaf30('0x52')][_0xaf30('0x68')])){if(_0x1d52c4['Smtp'][_0xaf30('0x6a')]){_0xddbf65[_0xaf30('0x9d')]={'user':_0x1d52c4[_0xaf30('0x52')]['user'],'pass':_0x1d52c4['Smtp'][_0xaf30('0x67')]};}_0xddbf65['host']=_0x1d52c4['Smtp']['host'];_0xddbf65[_0xaf30('0x6b')]=_0x1d52c4[_0xaf30('0x52')]['port'];_0xddbf65[_0xaf30('0x9e')]=_0x1d52c4[_0xaf30('0x52')]['secure'];}else{_0xddbf65[_0xaf30('0x68')]=_0x1d52c4[_0xaf30('0x52')][_0xaf30('0x68')];_0xddbf65[_0xaf30('0x9d')]={'user':_0x1d52c4[_0xaf30('0x52')]['user'],'pass':_0x1d52c4['Smtp']['pass']};}return respondWithRpcPromise(_0xaf30('0x9f'),_0xaf30('0xa0'),{'account':_0xddbf65,'message':_0x1ee570[_0xaf30('0x50')]});}else{throw new Error(_0xaf30('0xa1'));}}})[_0xaf30('0x13')](function(_0x15da96){if(_0x15da96){_0x3b96fc=_0x15da96;if(_0x129e29[_0xaf30('0x93')]){if(_0x129e29[_0xaf30('0x93')][_0xaf30('0x94')]['length']){return _0x129e29[_0xaf30('0x93')][_0xaf30('0x94')][0x0];}else{return db['CmContact'][_0xaf30('0x57')](_[_0xaf30('0xa')](_0x1ee570[_0xaf30('0x50')],{'firstName':_0x1ee570[_0xaf30('0x50')]['to'],'email':_0x1ee570['body']['to'],'phone':_0x1ee570['body']['to'],'ListId':_0x129e29[_0xaf30('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xaf30('0x13')](function(_0x4743d3){if(_0x4743d3){var _0x49e5e7={'UserId':_0x1ee570[_0xaf30('0x65')]['id'],'ContactId':_0x4743d3['id'],'MailAccountId':_0x129e29['id'],'inReplyTo':_0x3b96fc[_0xaf30('0xa3')],'to':_0x1ee570[_0xaf30('0x50')][_0xaf30('0x96')],'cc':_0x1ee570['body']['cc'],'subject':_0x1ee570[_0xaf30('0x50')][_0xaf30('0xa4')],'attach':_0x1ee570[_0xaf30('0x50')][_0xaf30('0xa5')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xaf30('0x90')),'lastMsgDirection':'out','Messages':[_['merge'](_0x1ee570[_0xaf30('0x50')],{'messageId':_0x3b96fc[_0xaf30('0xa3')],'sentAt':moment()[_0xaf30('0x8f')](_0xaf30('0x90')),'read':!![],'MailAccountId':_0x129e29['id'],'UserId':_0x1ee570['user']['id'],'ContactId':_0x4743d3['id']})]};if(_0x1ee570['body'][_0xaf30('0xa6')]){_0x49e5e7=_[_0xaf30('0x45')](_0x49e5e7,_0x1ee570[_0xaf30('0x50')][_0xaf30('0xa6')]);}return db[_0xaf30('0x78')][_0xaf30('0x57')](_0x49e5e7,{'include':[{'model':db['MailMessage'],'as':_0xaf30('0xa7')}]});}})['then'](respondWithResult(_0x6d2101,null))[_0xaf30('0x1d')](handleError(_0x6d2101,null));};exports[_0xaf30('0xa8')]=function(_0x36a7c0,_0x4c308f){return db[_0xaf30('0x31')]['find']({'where':{'id':_0x36a7c0[_0xaf30('0x4c')]['id']},'include':[{'model':db[_0xaf30('0x2f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaf30('0xa9')],'as':_0xaf30('0xa9'),'raw':!![]}]}]})[_0xaf30('0x13')](handleEntityNotFound(_0x4c308f,null))[_0xaf30('0x13')](function(_0x26e07a){if(!_0x26e07a[_0xaf30('0x52')])return;var _0x303c91={'id':_0x26e07a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x26e07a['provider']!==_0xaf30('0xaa')){_0x303c91[_0xaf30('0x68')]=_0x26e07a[_0xaf30('0x61')];}else{_0x303c91[_0xaf30('0x69')]=_0x26e07a[_0xaf30('0x52')]['host'];_0x303c91[_0xaf30('0x6b')]=_0x26e07a[_0xaf30('0x52')]['port'];_0x303c91[_0xaf30('0x9e')]=_0x26e07a['Smtp'][_0xaf30('0x9e')];}if(_0x26e07a[_0xaf30('0x52')]['authentication']){if(_0x26e07a[_0xaf30('0x52')][_0xaf30('0x51')]){_0x303c91[_0xaf30('0x9d')]={'type':_0xaf30('0xab'),'user':_0x26e07a[_0xaf30('0x52')][_0xaf30('0x65')],'accessToken':_0x26e07a[_0xaf30('0x52')][_0xaf30('0xa9')]['data5']};}else{_0x303c91[_0xaf30('0x9d')]={'user':_0x26e07a[_0xaf30('0x52')][_0xaf30('0x65')],'pass':_0x26e07a['Smtp']['pass']};}}return respondWithRpcPromise(_0xaf30('0xac'),_0xaf30('0xa8'),{'account':_0x303c91});})[_0xaf30('0x13')](respondWithResult(_0x4c308f,null))[_0xaf30('0x1d')](handleError(_0x4c308f,null));};exports[_0xaf30('0x27')]=function(_0x5ea215,_0x5303e1){return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x5ea215[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0x5303e1,null))[_0xaf30('0x13')](function(_0x5c07c1){if(_0x5c07c1&&_0x5c07c1['service']){throw new db[(_0xaf30('0xad'))][(_0xaf30('0xae'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5c07c1;})['then'](removeEntity(_0x5303e1,null))[_0xaf30('0x1d')](handleError(_0x5303e1,null));};exports[_0xaf30('0xaf')]=function(_0x5ef089,_0x2c869d){return db[_0xaf30('0x31')]['find']({'where':{'id':_0x5ef089['params']['id']}})['then'](handleEntityNotFound(_0x2c869d,null))['then'](function(_0x1c90a0){if(_0x1c90a0){return _0x1c90a0[_0xaf30('0xaf')](_0x5ef089[_0xaf30('0x50')]['ids'],_[_0xaf30('0xb0')](_0x5ef089[_0xaf30('0x50')],[_0xaf30('0x5c'),'id'])||{})[_0xaf30('0xb1')](function(_0x1f0495){for(var _0x1704ad=0x0;_0x1704ad<_0x5ef089[_0xaf30('0x50')][_0xaf30('0x5c')][_0xaf30('0x3e')];_0x1704ad+=0x1){socket['emit'](_0xaf30('0xb2'),{'UserId':Number(_0x5ef089[_0xaf30('0x50')]['ids'][_0x1704ad]),'MailAccountId':Number(_0x5ef089[_0xaf30('0x4c')]['id'])});}return _0x1f0495;});}})[_0xaf30('0x13')](respondWithResult(_0x2c869d,null))[_0xaf30('0x1d')](handleError(_0x2c869d,null));};exports['removeAgents']=function(_0x461b90,_0x27cd5f){return db[_0xaf30('0x31')][_0xaf30('0x4f')]({'where':{'id':_0x461b90[_0xaf30('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27cd5f,null))[_0xaf30('0x13')](function(_0x5990a0){if(_0x5990a0){return _0x5990a0['removeAgents'](_0x461b90['query'][_0xaf30('0x5c')])['then'](function(){if(_[_0xaf30('0xb3')](_0x461b90['query'][_0xaf30('0x5c')])){for(var _0x5b270d=0x0;_0x5b270d<_0x461b90[_0xaf30('0x38')]['ids']['length'];_0x5b270d+=0x1){socket[_0xaf30('0xb4')](_0xaf30('0xb5'),{'UserId':Number(_0x461b90['query'][_0xaf30('0x5c')][_0x5b270d]),'MailAccountId':Number(_0x461b90[_0xaf30('0x4c')]['id'])});}}else{socket[_0xaf30('0xb4')]('userMailAccount:remove',{'UserId':Number(_0x461b90[_0xaf30('0x38')][_0xaf30('0x5c')]),'MailAccountId':Number(_0x461b90[_0xaf30('0x4c')]['id'])});}});}})[_0xaf30('0x13')](respondWithStatusCode(_0x27cd5f,null))[_0xaf30('0x1d')](handleError(_0x27cd5f,null));};exports['getAgents']=function(_0x1fa72a,_0xaed57d){var _0x58cc33={};var _0x1ff9f9={};var _0x59d730;var _0x4a50f1;return db[_0xaf30('0x31')]['findOne']({'where':{'id':_0x1fa72a[_0xaf30('0x4c')]['id']}})[_0xaf30('0x13')](handleEntityNotFound(_0xaed57d,null))['then'](function(_0x278bc9){if(_0x278bc9){_0x59d730=_0x278bc9;_0x1ff9f9[_0xaf30('0x36')]=_[_0xaf30('0x39')](db[_0xaf30('0x7c')][_0xaf30('0x32')]);_0x1ff9f9[_0xaf30('0x38')]=_['keys'](_0x1fa72a[_0xaf30('0x38')]);_0x1ff9f9[_0xaf30('0x3a')]=_[_0xaf30('0x3b')](_0x1ff9f9[_0xaf30('0x36')],_0x1ff9f9[_0xaf30('0x38')]);_0x58cc33[_0xaf30('0x3d')]=_[_0xaf30('0x3b')](_0x1ff9f9['model'],qs['fields'](_0x1fa72a[_0xaf30('0x38')]['fields']));_0x58cc33['attributes']=_0x58cc33[_0xaf30('0x3d')][_0xaf30('0x3e')]?_0x58cc33[_0xaf30('0x3d')]:_0x1ff9f9['model'];_0x58cc33[_0xaf30('0x41')]=qs[_0xaf30('0x42')](_0x1fa72a[_0xaf30('0x38')]['sort']);_0x58cc33[_0xaf30('0x43')]=qs[_0xaf30('0x3a')](_[_0xaf30('0x5a')](_0x1fa72a[_0xaf30('0x38')],_0x1ff9f9['filters']));if(_0x1fa72a[_0xaf30('0x38')][_0xaf30('0x44')]){_0x58cc33[_0xaf30('0x43')]=_[_0xaf30('0x45')](_0x58cc33[_0xaf30('0x43')],{'$or':_[_0xaf30('0x37')](_0x58cc33['attributes'],function(_0xcb2f88){var _0x5a5205={};_0x5a5205[_0xcb2f88]={'$like':'%'+_0x1fa72a[_0xaf30('0x38')]['filter']+'%'};return _0x5a5205;})});}_0x58cc33=_[_0xaf30('0x45')]({},_0x58cc33,_0x1fa72a[_0xaf30('0x47')]);return _0x59d730['getAgents'](_0x58cc33);}})['then'](function(_0xc6605e){if(_0xc6605e){_0x4a50f1=_0xc6605e['length'];if(!_0x1fa72a[_0xaf30('0x38')][_0xaf30('0x3f')]('nolimit')){_0x58cc33[_0xaf30('0x23')]=qs[_0xaf30('0x23')](_0x1fa72a['query'][_0xaf30('0x23')]);_0x58cc33['offset']=qs[_0xaf30('0x21')](_0x1fa72a['query'][_0xaf30('0x21')]);}return _0x59d730[_0xaf30('0xb6')](_0x58cc33);}})[_0xaf30('0x13')](function(_0x126c0c){if(_0x126c0c){return _0x126c0c?{'count':_0x4a50f1,'rows':_0x126c0c}:null;}})[_0xaf30('0x13')](respondWithResult(_0xaed57d,null))['catch'](handleError(_0xaed57d,null));}; \ No newline at end of file +var _0xa75b=['UserProfileResource','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','List','Contacts','updatedAt','DESC','from','format','attachments','join','server/files/attachments','basename','secure','SendMail','sendMail','List\x20not\x20found','defaults','subject','attach','out','messageId','Interaction','Messages','CloudProvider','custom','OAuth2','data5','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','http','request','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','stack','name','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','Imap','Smtp','rawAttributes','find','body','CloudProviderId','modernAuthentication','MailServerIn','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','key','provider','email','ListId','isNil','active','description','user','username','pass','password','service','host','port','authentication','role','UserProfileSection','MailAccounts','userProfileId'];(function(_0x239ad9,_0xc388ca){var _0x277524=function(_0x585520){while(--_0x585520){_0x239ad9['push'](_0x239ad9['shift']());}};_0x277524(++_0xc388ca);}(_0xa75b,0xfd));var _0xba75=function(_0x48db3e,_0x39d466){_0x48db3e=_0x48db3e-0x0;var _0x5b9eda=_0xa75b[_0x48db3e];return _0x5b9eda;};'use strict';var moment=require(_0xba75('0x0'));var BPromise=require(_0xba75('0x1'));var util=require('util');var path=require('path');var _=require(_0xba75('0x2'));var juice=require('juice');var Redis=require(_0xba75('0x3'));var qs=require(_0xba75('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xba75('0x5'));var db=require(_0xba75('0x6'))['db'];config[_0xba75('0x7')]=_['defaults'](config[_0xba75('0x7')],{'host':_0xba75('0x8'),'port':0x18eb});var socket=require(_0xba75('0x9'))(new Redis(config[_0xba75('0x7')]));require('./mailAccount.socket')[_0xba75('0xa')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xba75('0xb')]({'port':0x232b});function respondWithRpcPromise(_0x1e8b20,_0x1d37cb,_0x21bbfa,_0x1bb74f){return new BPromise(function(_0x2ca448,_0x38a1bd){var _0x8f7ff5=_0x1bb74f||client;return _0x8f7ff5[_0xba75('0xc')](_0x1e8b20,_0x21bbfa)[_0xba75('0xd')](function(_0x47e7a1){logger[_0xba75('0xe')]('MailAccount,\x20%s,\x20%s',_0x1d37cb,_0xba75('0xf'));logger[_0xba75('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1d37cb,_0xba75('0xf'),JSON[_0xba75('0x11')](_0x47e7a1));if(_0x47e7a1[_0xba75('0x12')]){if(_0x47e7a1[_0xba75('0x12')][_0xba75('0x13')]===0x1f4){logger[_0xba75('0x12')](_0xba75('0x14'),_0x1d37cb,_0x47e7a1[_0xba75('0x12')][_0xba75('0x15')]);return _0x38a1bd(_0x47e7a1['error'][_0xba75('0x15')]);}logger[_0xba75('0x12')](_0xba75('0x14'),_0x1d37cb,_0x47e7a1[_0xba75('0x12')][_0xba75('0x15')]);return _0x2ca448(_0x47e7a1['error'][_0xba75('0x15')]);}else{logger[_0xba75('0xe')](_0xba75('0x14'),_0x1d37cb,_0xba75('0xf'));_0x2ca448(_0x47e7a1['result']['message']);}})[_0xba75('0x16')](function(_0xc60216){logger['error'](_0xba75('0x14'),_0x1d37cb,_0xc60216);_0x38a1bd(_0xc60216);});});}function respondWithStatusCode(_0x1769d6,_0x3240b6){_0x3240b6=_0x3240b6||0xcc;return function(_0x26631a){if(_0x26631a){return _0x1769d6[_0xba75('0x17')](_0x3240b6);}return _0x1769d6['status'](_0x3240b6)[_0xba75('0x18')]();};}function respondWithResult(_0x15ab87,_0x2ad1fd){_0x2ad1fd=_0x2ad1fd||0xc8;return function(_0x22e671){if(_0x22e671){return _0x15ab87[_0xba75('0x19')](_0x2ad1fd)['json'](_0x22e671);}};}function respondWithFilteredResult(_0x5cce4c,_0x4bbd38){return function(_0x2681c2){if(_0x2681c2){var _0x1f78ae=typeof _0x4bbd38[_0xba75('0x1a')]===_0xba75('0x1b')&&typeof _0x4bbd38[_0xba75('0x1c')]===_0xba75('0x1b');var _0x1bf306=_0x2681c2[_0xba75('0x1d')];var _0x5d887d=_0x1f78ae?0x0:_0x4bbd38['offset'];var _0x1fa654=_0x1f78ae?_0x2681c2[_0xba75('0x1d')]:_0x4bbd38[_0xba75('0x1a')]+_0x4bbd38[_0xba75('0x1c')];var _0x402201;if(_0x1fa654>=_0x1bf306){_0x1fa654=_0x1bf306;_0x402201=0xc8;}else{_0x402201=0xce;}_0x5cce4c[_0xba75('0x19')](_0x402201);return _0x5cce4c[_0xba75('0x1e')](_0xba75('0x1f'),_0x5d887d+'-'+_0x1fa654+'/'+_0x1bf306)[_0xba75('0x20')](_0x2681c2);}return null;};}function saveUpdates(_0x1453c4){return function(_0x241350){if(_0x241350){return _0x241350[_0xba75('0x21')](_0x1453c4)[_0xba75('0xd')](function(_0x2f055d){return _0x2f055d;});}return null;};}function removeEntity(_0x3f39c6){return function(_0x406233){if(_0x406233){return _0x406233[_0xba75('0x22')]()[_0xba75('0xd')](function(){var _0x528c5a=_0x406233[_0xba75('0x23')]({'plain':!![]});var _0x5a9864='MailAccounts';return db['UserProfileResource'][_0xba75('0x22')]({'where':{'type':_0x5a9864,'resourceId':_0x528c5a['id']}})[_0xba75('0xd')](function(){return _0x406233;});})['then'](function(){_0x3f39c6[_0xba75('0x19')](0xcc)[_0xba75('0x18')]();});}};}function handleEntityNotFound(_0x2b7dc4){return function(_0x2186c5){if(!_0x2186c5){_0x2b7dc4['sendStatus'](0x194);}return _0x2186c5;};}function handleError(_0x3270d6,_0x199ed4){_0x199ed4=_0x199ed4||0x1f4;return function(_0x17ee66){logger[_0xba75('0x12')](_0x17ee66[_0xba75('0x24')]);if(_0x17ee66[_0xba75('0x25')]){delete _0x17ee66[_0xba75('0x25')];}_0x3270d6[_0xba75('0x19')](_0x199ed4)['send'](_0x17ee66);};}exports[_0xba75('0x26')]=function(_0x2f8b63,_0x1f5439){var _0x402aa7={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xba75('0x27')],'as':'Smtp'},{'model':db[_0xba75('0x28')],'as':_0xba75('0x29')}]},_0x9883f5={},_0x406ad9={'count':0x0,'rows':[]};var _0x24bb26=_[_0xba75('0x2a')](db[_0xba75('0x2b')]['rawAttributes'],function(_0xfc87c5){return{'name':_0xfc87c5['fieldName'],'type':_0xfc87c5[_0xba75('0x2c')]['key']};});_0x9883f5['model']=_[_0xba75('0x2a')](_0x24bb26,'name');_0x9883f5[_0xba75('0x2d')]=_[_0xba75('0x2e')](_0x2f8b63[_0xba75('0x2d')]);_0x9883f5[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x9883f5[_0xba75('0x31')],_0x9883f5[_0xba75('0x2d')]);_0x402aa7[_0xba75('0x32')]=_[_0xba75('0x30')](_0x9883f5[_0xba75('0x31')],qs[_0xba75('0x33')](_0x2f8b63[_0xba75('0x2d')]['fields']));_0x402aa7[_0xba75('0x32')]=_0x402aa7['attributes'][_0xba75('0x34')]?_0x402aa7['attributes']:_0x9883f5[_0xba75('0x31')];if(!_0x2f8b63[_0xba75('0x2d')][_0xba75('0x35')](_0xba75('0x36'))){_0x402aa7[_0xba75('0x1c')]=qs[_0xba75('0x1c')](_0x2f8b63[_0xba75('0x2d')]['limit']);_0x402aa7[_0xba75('0x1a')]=qs['offset'](_0x2f8b63[_0xba75('0x2d')][_0xba75('0x1a')]);}_0x402aa7[_0xba75('0x37')]=qs[_0xba75('0x38')](_0x2f8b63[_0xba75('0x2d')][_0xba75('0x38')]);_0x402aa7['where']=qs[_0xba75('0x2f')](_[_0xba75('0x39')](_0x2f8b63[_0xba75('0x2d')],_0x9883f5[_0xba75('0x2f')]),_0x24bb26);if(_0x2f8b63[_0xba75('0x2d')][_0xba75('0x3a')]){_0x402aa7[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x402aa7[_0xba75('0x3b')],{'$or':_[_0xba75('0x2a')](_0x24bb26,function(_0x165593){if(_0x165593[_0xba75('0x2c')]!==_0xba75('0x3d')){var _0x115702={};_0x115702[_0x165593['name']]={'$like':'%'+_0x2f8b63['query'][_0xba75('0x3a')]+'%'};return _0x115702;}})});}_0x402aa7=_[_0xba75('0x3c')]({},_0x402aa7,_0x2f8b63[_0xba75('0x3e')]);var _0x4e7860={'where':_0x402aa7[_0xba75('0x3b')]};return db[_0xba75('0x2b')][_0xba75('0x1d')](_0x4e7860)[_0xba75('0xd')](function(_0x1d5e46){_0x406ad9[_0xba75('0x1d')]=_0x1d5e46;if(_0x2f8b63[_0xba75('0x2d')][_0xba75('0x3f')]){_0x402aa7[_0xba75('0x40')]=[{'all':!![]}];}return db[_0xba75('0x2b')]['findAll'](_0x402aa7);})['then'](function(_0x45fb4d){_0x406ad9[_0xba75('0x41')]=_0x45fb4d;return _0x406ad9;})[_0xba75('0xd')](respondWithFilteredResult(_0x1f5439,_0x402aa7))[_0xba75('0x16')](handleError(_0x1f5439,null));};exports[_0xba75('0x42')]=function(_0x182207,_0x405b12){var _0x5e068f={'raw':![],'where':{'id':_0x182207[_0xba75('0x43')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xba75('0x44')},{'model':db['MailServerOut'],'as':_0xba75('0x45')},{'model':db[_0xba75('0x28')],'as':'mandatoryDispositionPause'}]},_0x4ea18f={};_0x4ea18f['model']=_[_0xba75('0x2e')](db[_0xba75('0x2b')][_0xba75('0x46')]);_0x4ea18f[_0xba75('0x2d')]=_[_0xba75('0x2e')](_0x182207['query']);_0x4ea18f[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x4ea18f['model'],_0x4ea18f[_0xba75('0x2d')]);_0x5e068f[_0xba75('0x32')]=_[_0xba75('0x30')](_0x4ea18f[_0xba75('0x31')],qs['fields'](_0x182207['query'][_0xba75('0x33')]));_0x5e068f[_0xba75('0x32')]=_0x5e068f[_0xba75('0x32')][_0xba75('0x34')]?_0x5e068f['attributes']:_0x4ea18f[_0xba75('0x31')];if(_0x182207[_0xba75('0x2d')]['includeAll']){_0x5e068f['include']=[{'all':!![]}];}_0x5e068f=_['merge']({},_0x5e068f,_0x182207['options']);return db[_0xba75('0x2b')][_0xba75('0x47')](_0x5e068f)[_0xba75('0xd')](handleEntityNotFound(_0x405b12,null))[_0xba75('0xd')](respondWithResult(_0x405b12,null))[_0xba75('0x16')](handleError(_0x405b12,null));};exports['update']=function(_0x2c9f5a,_0x479a53){if(_0x2c9f5a[_0xba75('0x48')]['id']){delete _0x2c9f5a[_0xba75('0x48')]['id'];}if(_0x2c9f5a['body'][_0xba75('0x44')]){if(!_0x2c9f5a[_0xba75('0x48')]['Imap']['modernAuthentication']){_0x2c9f5a[_0xba75('0x48')][_0xba75('0x44')][_0xba75('0x49')]=null;}}if(_0x2c9f5a['body'][_0xba75('0x45')]){if(!_0x2c9f5a[_0xba75('0x48')][_0xba75('0x45')][_0xba75('0x4a')]){_0x2c9f5a[_0xba75('0x48')][_0xba75('0x45')][_0xba75('0x49')]=null;}}return db['MailAccount'][_0xba75('0x47')]({'where':{'id':_0x2c9f5a['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xba75('0x44')},{'model':db[_0xba75('0x27')],'as':_0xba75('0x45')},{'model':db[_0xba75('0x28')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x479a53,null))[_0xba75('0xd')](saveUpdates(_0x2c9f5a[_0xba75('0x48')],null))[_0xba75('0xd')](function(_0xa416d6){if(_0xa416d6&&_0x2c9f5a[_0xba75('0x48')][_0xba75('0x44')]){return db[_0xba75('0x4b')][_0xba75('0x21')](_0x2c9f5a[_0xba75('0x48')][_0xba75('0x44')],{'where':{'MailAccountId':_0xa416d6['id']}})[_0xba75('0xd')](function(){return _0xa416d6;});}return _0xa416d6;})[_0xba75('0xd')](function(_0x14126a){if(_0x14126a&&_0x2c9f5a[_0xba75('0x48')][_0xba75('0x45')]){return db[_0xba75('0x27')]['update'](_0x2c9f5a[_0xba75('0x48')][_0xba75('0x45')],{'where':{'MailAccountId':_0x14126a['id']}})[_0xba75('0xd')](function(){return _0x14126a;});}return _0x14126a;})['then'](respondWithResult(_0x479a53,null))[_0xba75('0x16')](handleError(_0x479a53,null));};exports['describe']=function(_0x1d5a95,_0x580c14){return db[_0xba75('0x2b')][_0xba75('0x4c')]()[_0xba75('0xd')](respondWithResult(_0x580c14,null))[_0xba75('0x16')](handleError(_0x580c14,null));};exports[_0xba75('0x4d')]=function(_0x8317e5,_0x2436ce){if(_0x8317e5[_0xba75('0x48')]['id']){delete _0x8317e5['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x8317e5[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x2436ce,null))[_0xba75('0xd')](function(_0x48e1d1){if(_0x48e1d1){_0x8317e5['body'][_0xba75('0x4e')]=_0x48e1d1['id'];return db[_0xba75('0x4f')][_0xba75('0x50')](_0x8317e5[_0xba75('0x48')]);}})['then'](respondWithResult(_0x2436ce,null))['catch'](handleError(_0x2436ce,null));};exports[_0xba75('0x51')]=function(_0x328d43,_0x5c1fa0){var _0x3ec8a3={'raw':![],'where':{}};var _0x1dfab7={};var _0x247e4e={'count':0x0,'rows':[]};return db[_0xba75('0x2b')]['findOne']({'where':{'id':_0x328d43['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x5c1fa0,null))[_0xba75('0xd')](function(_0x447de6){if(_0x447de6){_0x1dfab7[_0xba75('0x31')]=_[_0xba75('0x2e')](db[_0xba75('0x4f')][_0xba75('0x46')]);_0x1dfab7[_0xba75('0x2d')]=_[_0xba75('0x2e')](_0x328d43[_0xba75('0x2d')]);_0x1dfab7[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x1dfab7[_0xba75('0x31')],_0x1dfab7[_0xba75('0x2d')]);_0x3ec8a3[_0xba75('0x32')]=_[_0xba75('0x30')](_0x1dfab7[_0xba75('0x31')],qs[_0xba75('0x33')](_0x328d43[_0xba75('0x2d')]['fields']));_0x3ec8a3['attributes']=_0x3ec8a3[_0xba75('0x32')]['length']?_0x3ec8a3[_0xba75('0x32')]:_0x1dfab7[_0xba75('0x31')];if(!_0x328d43[_0xba75('0x2d')][_0xba75('0x35')](_0xba75('0x36'))){_0x3ec8a3['limit']=qs['limit'](_0x328d43[_0xba75('0x2d')][_0xba75('0x1c')]);_0x3ec8a3[_0xba75('0x1a')]=qs[_0xba75('0x1a')](_0x328d43['query'][_0xba75('0x1a')]);}_0x3ec8a3['order']=qs[_0xba75('0x38')](_0x328d43[_0xba75('0x2d')][_0xba75('0x38')]);_0x3ec8a3[_0xba75('0x3b')]=qs[_0xba75('0x2f')](_['pick'](_0x328d43[_0xba75('0x2d')],_0x1dfab7['filters']));_0x3ec8a3[_0xba75('0x3b')][_0xba75('0x4e')]=_0x447de6['id'];if(_0x328d43['query'][_0xba75('0x3a')]){_0x3ec8a3[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x3ec8a3[_0xba75('0x3b')],{'$or':_[_0xba75('0x2a')](_0x3ec8a3['attributes'],function(_0x253c51){var _0x180966={};_0x180966[_0x253c51]={'$like':'%'+_0x328d43['query'][_0xba75('0x3a')]+'%'};return _0x180966;})});}_0x3ec8a3=_[_0xba75('0x3c')]({},_0x3ec8a3,_0x328d43[_0xba75('0x3e')]);return db['Disposition']['count']({'where':_0x3ec8a3[_0xba75('0x3b')]})[_0xba75('0xd')](function(_0x1d9987){_0x247e4e[_0xba75('0x1d')]=_0x1d9987;if(_0x328d43[_0xba75('0x2d')][_0xba75('0x3f')]){_0x3ec8a3[_0xba75('0x40')]=[{'all':!![]}];}return db[_0xba75('0x4f')][_0xba75('0x52')](_0x3ec8a3);})[_0xba75('0xd')](function(_0x6ee584){_0x247e4e[_0xba75('0x41')]=_0x6ee584;return _0x247e4e;});}})[_0xba75('0xd')](respondWithFilteredResult(_0x5c1fa0,_0x3ec8a3))[_0xba75('0x16')](handleError(_0x5c1fa0,null));};exports[_0xba75('0x53')]=function(_0x3fbec1,_0x5cdc52){return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x3fbec1[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x5cdc52,null))[_0xba75('0xd')](function(_0x1f9ea8){if(_0x1f9ea8){return _0x1f9ea8[_0xba75('0x53')](_0x3fbec1['query'][_0xba75('0x54')]);}})[_0xba75('0xd')](respondWithStatusCode(_0x5cdc52,null))['catch'](handleError(_0x5cdc52,null));};exports[_0xba75('0x55')]=function(_0x282ea7,_0x47b1e2){if(_0x282ea7[_0xba75('0x48')]['id']){delete _0x282ea7[_0xba75('0x48')]['id'];}return db['MailAccount'][_0xba75('0x47')]({'where':{'id':_0x282ea7[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x47b1e2,null))[_0xba75('0xd')](function(_0x25ead3){if(_0x25ead3){_0x282ea7[_0xba75('0x48')]['MailAccountId']=_0x25ead3['id'];return db[_0xba75('0x56')][_0xba75('0x50')](_0x282ea7[_0xba75('0x48')]);}})['then'](respondWithResult(_0x47b1e2,null))[_0xba75('0x16')](handleError(_0x47b1e2,null));};exports[_0xba75('0x57')]=function(_0x5ebab5,_0x3ea37b){var _0x221c63={'raw':![],'where':{}};var _0x37dc2c={};var _0x283814={'count':0x0,'rows':[]};return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x5ebab5[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x3ea37b,null))['then'](function(_0x1a2d8c){if(_0x1a2d8c){_0x37dc2c['model']=_[_0xba75('0x2e')](db[_0xba75('0x56')][_0xba75('0x46')]);_0x37dc2c[_0xba75('0x2d')]=_['keys'](_0x5ebab5[_0xba75('0x2d')]);_0x37dc2c[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x37dc2c[_0xba75('0x31')],_0x37dc2c[_0xba75('0x2d')]);_0x221c63[_0xba75('0x32')]=_[_0xba75('0x30')](_0x37dc2c[_0xba75('0x31')],qs[_0xba75('0x33')](_0x5ebab5[_0xba75('0x2d')][_0xba75('0x33')]));_0x221c63[_0xba75('0x32')]=_0x221c63[_0xba75('0x32')][_0xba75('0x34')]?_0x221c63[_0xba75('0x32')]:_0x37dc2c[_0xba75('0x31')];if(!_0x5ebab5[_0xba75('0x2d')]['hasOwnProperty'](_0xba75('0x36'))){_0x221c63['limit']=qs[_0xba75('0x1c')](_0x5ebab5['query'][_0xba75('0x1c')]);_0x221c63['offset']=qs[_0xba75('0x1a')](_0x5ebab5['query'][_0xba75('0x1a')]);}_0x221c63[_0xba75('0x37')]=qs[_0xba75('0x38')](_0x5ebab5['query'][_0xba75('0x38')]);_0x221c63[_0xba75('0x3b')]=qs[_0xba75('0x2f')](_[_0xba75('0x39')](_0x5ebab5[_0xba75('0x2d')],_0x37dc2c[_0xba75('0x2f')]));_0x221c63[_0xba75('0x3b')][_0xba75('0x4e')]=_0x1a2d8c['id'];if(_0x5ebab5[_0xba75('0x2d')][_0xba75('0x3a')]){_0x221c63[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x221c63[_0xba75('0x3b')],{'$or':_[_0xba75('0x2a')](_0x221c63['attributes'],function(_0x2de130){var _0x3383ca={};_0x3383ca[_0x2de130]={'$like':'%'+_0x5ebab5['query'][_0xba75('0x3a')]+'%'};return _0x3383ca;})});}_0x221c63=_[_0xba75('0x3c')]({},_0x221c63,_0x5ebab5[_0xba75('0x3e')]);return db[_0xba75('0x56')][_0xba75('0x1d')]({'where':_0x221c63['where']})[_0xba75('0xd')](function(_0x58155b){_0x283814['count']=_0x58155b;if(_0x5ebab5['query'][_0xba75('0x3f')]){_0x221c63['include']=[{'all':!![]}];}return db[_0xba75('0x56')][_0xba75('0x52')](_0x221c63);})[_0xba75('0xd')](function(_0x44b7ab){_0x283814[_0xba75('0x41')]=_0x44b7ab;return _0x283814;});}})[_0xba75('0xd')](respondWithFilteredResult(_0x3ea37b,_0x221c63))[_0xba75('0x16')](handleError(_0x3ea37b,null));};exports[_0xba75('0x59')]=function(_0xbf9f59,_0x1b07d4){return db['MailAccount'][_0xba75('0x47')]({'where':{'id':_0xbf9f59['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x1b07d4,null))[_0xba75('0xd')](function(_0x6e57fa){if(_0x6e57fa){return _0x6e57fa[_0xba75('0x59')](_0xbf9f59[_0xba75('0x2d')][_0xba75('0x54')]);}})[_0xba75('0xd')](respondWithStatusCode(_0x1b07d4,null))['catch'](handleError(_0x1b07d4,null));};exports['create']=function(_0x247b82,_0x20aa90){var _0x4b7014={'name':_0x247b82['body']['name'],'key':_0x247b82['body'][_0xba75('0x5a')],'provider':_0x247b82[_0xba75('0x48')][_0xba75('0x5b')]==='custom'?null:_0x247b82[_0xba75('0x48')][_0xba75('0x5b')],'email':_0x247b82[_0xba75('0x48')][_0xba75('0x5c')],'ListId':_0x247b82[_0xba75('0x48')][_0xba75('0x5d')],'active':!_[_0xba75('0x5e')](_0x247b82[_0xba75('0x48')][_0xba75('0x5f')])?_0x247b82['body'][_0xba75('0x5f')]:!![],'description':_0x247b82[_0xba75('0x48')][_0xba75('0x60')]||null,'Imap':{},'Smtp':{}};if(_0x4b7014[_0xba75('0x5b')]){_0x4b7014['Imap'][_0xba75('0x61')]=_0x4b7014[_0xba75('0x45')]['user']=_0x247b82[_0xba75('0x48')][_0xba75('0x62')];_0x4b7014[_0xba75('0x44')]['password']=_0x4b7014[_0xba75('0x45')][_0xba75('0x63')]=_0x247b82[_0xba75('0x48')][_0xba75('0x64')];if(_0x247b82[_0xba75('0x48')][_0xba75('0x4a')]){_0x4b7014['Imap'][_0xba75('0x4a')]=_0x4b7014[_0xba75('0x45')][_0xba75('0x4a')]=!![];_0x4b7014[_0xba75('0x44')]['CloudProviderId']=_0x4b7014[_0xba75('0x45')][_0xba75('0x49')]=_0x247b82[_0xba75('0x48')]['CloudProviderId'];_0x4b7014[_0xba75('0x44')]['password']=_0x4b7014[_0xba75('0x45')][_0xba75('0x63')]=null;}else{_0x4b7014['Imap'][_0xba75('0x49')]=_0x4b7014['Smtp']['CloudProviderId']=null;}_0x4b7014['Imap'][_0xba75('0x65')]=_0x4b7014[_0xba75('0x45')]['service']=null;_0x4b7014[_0xba75('0x44')][_0xba75('0x66')]=_0x4b7014[_0xba75('0x45')][_0xba75('0x66')]=null;_0x4b7014[_0xba75('0x44')][_0xba75('0x67')]=_0x4b7014[_0xba75('0x45')]['port']=null;}else{if(_0x247b82[_0xba75('0x48')]['authentication']){_0x4b7014[_0xba75('0x44')]['user']=_0x4b7014[_0xba75('0x45')]['user']=_0x247b82[_0xba75('0x48')][_0xba75('0x62')];_0x4b7014[_0xba75('0x44')][_0xba75('0x64')]=_0x4b7014['Smtp'][_0xba75('0x63')]=_0x247b82['body'][_0xba75('0x64')];}else{_0x4b7014[_0xba75('0x44')][_0xba75('0x68')]=_0x4b7014['Smtp'][_0xba75('0x68')]=![];_0x4b7014[_0xba75('0x44')][_0xba75('0x61')]=_0x4b7014[_0xba75('0x45')]['user']=null;_0x4b7014[_0xba75('0x44')][_0xba75('0x64')]=_0x4b7014['Smtp']['pass']=null;}_0x4b7014[_0xba75('0x44')]['host']=_0x247b82[_0xba75('0x48')]['Imap'][_0xba75('0x66')];_0x4b7014[_0xba75('0x44')]['port']=_0x247b82[_0xba75('0x48')]['Imap'][_0xba75('0x67')];_0x4b7014[_0xba75('0x45')]['host']=_0x247b82[_0xba75('0x48')][_0xba75('0x45')][_0xba75('0x66')];_0x4b7014[_0xba75('0x45')][_0xba75('0x67')]=_0x247b82[_0xba75('0x48')]['Smtp'][_0xba75('0x67')];}return db[_0xba75('0x2b')][_0xba75('0x50')](_0x4b7014,{'include':[{'model':db[_0xba75('0x27')],'as':_0xba75('0x45')},{'model':db[_0xba75('0x4b')],'as':_0xba75('0x44')}]})['then'](function(_0x1a3676){var _0x35cb9b=_0x247b82[_0xba75('0x61')][_0xba75('0x23')]({'plain':!![]});if(!_0x35cb9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35cb9b[_0xba75('0x69')]===_0xba75('0x61')){var _0xf570c5=_0x1a3676['get']({'plain':!![]});return db[_0xba75('0x6a')][_0xba75('0x47')]({'where':{'name':_0xba75('0x6b'),'userProfileId':_0x35cb9b[_0xba75('0x6c')]},'raw':!![]})['then'](function(_0x3b73ac){if(_0x3b73ac&&_0x3b73ac['autoAssociation']===0x0){return db[_0xba75('0x6d')][_0xba75('0x50')]({'name':_0xf570c5['name'],'resourceId':_0xf570c5['id'],'type':_0x3b73ac[_0xba75('0x25')],'sectionId':_0x3b73ac['id']},{})[_0xba75('0xd')](function(){return _0x1a3676;});}else{return _0x1a3676;}})[_0xba75('0x16')](function(_0x1a05a0){logger[_0xba75('0x12')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a05a0);throw _0x1a05a0;});}return _0x1a3676;})[_0xba75('0xd')](respondWithResult(_0x20aa90,0xc9))['catch'](handleError(_0x20aa90,null));};exports['getImap']=function(_0x3b9f79,_0x22fa58){return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x3b9f79[_0xba75('0x43')]['id']}})['then'](handleEntityNotFound(_0x22fa58,null))[_0xba75('0xd')](function(_0x377cee){if(_0x377cee){return _0x377cee['getImap']();}return null;})[_0xba75('0xd')](respondWithResult(_0x22fa58,null))[_0xba75('0x16')](handleError(_0x22fa58,null));};exports['addImap']=function(_0x1fa0e1,_0x4b885b){if(_0x1fa0e1['body']['id']){delete _0x1fa0e1[_0xba75('0x48')]['id'];}return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x1fa0e1[_0xba75('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b885b,null))[_0xba75('0xd')](function(_0x53097f){if(_0x53097f){_0x1fa0e1[_0xba75('0x48')]['MailAccountId']=_0x53097f['id'];return db[_0xba75('0x4b')][_0xba75('0x50')](_0x1fa0e1[_0xba75('0x48')]);}})[_0xba75('0xd')](respondWithResult(_0x4b885b,null))[_0xba75('0x16')](handleError(_0x4b885b,null));};exports[_0xba75('0x6e')]=function(_0x1a63a2,_0x262a60){return db[_0xba75('0x2b')]['findOne']({'where':{'id':_0x1a63a2['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x262a60,null))[_0xba75('0xd')](function(_0x253586){if(_0x253586){return _0x253586[_0xba75('0x6f')](null);}return null;})[_0xba75('0xd')](respondWithStatusCode(_0x262a60,null))[_0xba75('0x16')](handleError(_0x262a60,null));};exports['getSmtp']=function(_0x1f7533,_0x18812a){return db[_0xba75('0x2b')]['findOne']({'where':{'id':_0x1f7533[_0xba75('0x43')]['id']}})['then'](handleEntityNotFound(_0x18812a,null))['then'](function(_0x30d428){if(_0x30d428){return _0x30d428[_0xba75('0x70')]();}return null;})['then'](respondWithResult(_0x18812a,null))[_0xba75('0x16')](handleError(_0x18812a,null));};exports[_0xba75('0x71')]=function(_0x140df2,_0x522bb3){if(_0x140df2['body']['id']){delete _0x140df2[_0xba75('0x48')]['id'];}return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x140df2['params']['id']}})['then'](handleEntityNotFound(_0x522bb3,null))[_0xba75('0xd')](function(_0x244418){if(_0x244418){_0x140df2['body'][_0xba75('0x4e')]=_0x244418['id'];return db[_0xba75('0x27')][_0xba75('0x50')](_0x140df2[_0xba75('0x48')]);}})[_0xba75('0xd')](respondWithResult(_0x522bb3,null))[_0xba75('0x16')](handleError(_0x522bb3,null));};exports[_0xba75('0x72')]=function(_0x381e80,_0x5994bd){return db[_0xba75('0x2b')]['findOne']({'where':{'id':_0x381e80[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x5994bd,null))[_0xba75('0xd')](function(_0x1a623f){if(_0x1a623f){return _0x1a623f['setSmtp'](null);}return null;})[_0xba75('0xd')](respondWithStatusCode(_0x5994bd,null))[_0xba75('0x16')](handleError(_0x5994bd,null));};exports[_0xba75('0x73')]=function(_0x390595,_0x297f02){return db[_0xba75('0x74')]['find']({'where':{'id':_0x390595['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x297f02,null))['then'](function(_0x7d43d4){if(_0x7d43d4){return _0x7d43d4[_0xba75('0x73')](_0x390595[_0xba75('0x48')][_0xba75('0x54')],_[_0xba75('0x75')](_0x390595[_0xba75('0x48')],['ids','id'])||{});}})[_0xba75('0xd')](respondWithResult(_0x297f02,null))[_0xba75('0x16')](handleError(_0x297f02,null));};exports['getInteractions']=function(_0x5eb253,_0x4cfd8a){var _0x560f79={'raw':![],'where':{}};var _0x101d83={};var _0x1d80bd={'count':0x0,'rows':[]};return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x5eb253['params']['id']}})['then'](handleEntityNotFound(_0x4cfd8a,null))['then'](function(_0x1ea84d){if(_0x1ea84d){_0x101d83[_0xba75('0x31')]=_['keys'](db[_0xba75('0x74')][_0xba75('0x46')]);_0x101d83[_0xba75('0x2d')]=_[_0xba75('0x2e')](_0x5eb253[_0xba75('0x2d')]);_0x101d83[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x101d83[_0xba75('0x31')],_0x101d83[_0xba75('0x2d')]);_0x560f79[_0xba75('0x32')]=_[_0xba75('0x30')](_0x101d83['model'],qs['fields'](_0x5eb253[_0xba75('0x2d')]['fields']));_0x560f79['attributes']=_0x560f79[_0xba75('0x32')][_0xba75('0x34')]?_0x560f79['attributes']:_0x101d83[_0xba75('0x31')];if(!_0x5eb253[_0xba75('0x2d')][_0xba75('0x35')](_0xba75('0x36'))){_0x560f79[_0xba75('0x1c')]=qs[_0xba75('0x1c')](_0x5eb253['query'][_0xba75('0x1c')]);_0x560f79[_0xba75('0x1a')]=qs[_0xba75('0x1a')](_0x5eb253[_0xba75('0x2d')][_0xba75('0x1a')]);}_0x560f79['order']=qs['sort'](_0x5eb253['query']['sort']);_0x560f79['where']=qs[_0xba75('0x2f')](_['pick'](_0x5eb253[_0xba75('0x2d')],_0x101d83[_0xba75('0x2f')]));_0x560f79['where'][_0xba75('0x4e')]=_0x1ea84d['id'];if(_0x5eb253[_0xba75('0x2d')][_0xba75('0x3a')]){_0x560f79[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x560f79[_0xba75('0x3b')],{'$or':_[_0xba75('0x2a')](_0x560f79[_0xba75('0x32')],function(_0x3e1777){var _0x3a58b8={};_0x3a58b8[_0x3e1777]={'$like':'%'+_0x5eb253[_0xba75('0x2d')][_0xba75('0x3a')]+'%'};return _0x3a58b8;})});}_0x560f79=_[_0xba75('0x3c')]({},_0x560f79,_0x5eb253[_0xba75('0x3e')]);return db['MailInteraction'][_0xba75('0x1d')]({'where':_0x560f79[_0xba75('0x3b')]})[_0xba75('0xd')](function(_0x2fc9c2){_0x1d80bd[_0xba75('0x1d')]=_0x2fc9c2;if(_0x5eb253['query'][_0xba75('0x3f')]){_0x560f79['include']=[{'model':db[_0xba75('0x76')],'as':_0xba75('0x77'),'required':![]},{'model':db[_0xba75('0x78')],'as':_0xba75('0x79'),'attributes':['name',_0xba75('0x7a'),'internal'],'required':![]},{'model':db[_0xba75('0x7b')],'as':_0xba75('0x7c'),'attributes':['id',_0xba75('0x25'),_0xba75('0x7d')],'where':_0x5eb253[_0xba75('0x2d')]['tag']?{'id':_0x5eb253[_0xba75('0x2d')][_0xba75('0x7e')]}:undefined,'required':_0x5eb253['query']['tag']?!![]:![]}];}return db[_0xba75('0x74')][_0xba75('0x52')](_0x560f79);})[_0xba75('0xd')](function(_0x1b1541){_0x1d80bd[_0xba75('0x41')]=_0x1b1541;return _0x1d80bd;});}})[_0xba75('0xd')](respondWithFilteredResult(_0x4cfd8a,_0x560f79))[_0xba75('0x16')](handleError(_0x4cfd8a,null));};exports[_0xba75('0x7f')]=function addApplications(_0x9ed0e,_0x5aac75){var _0x5867a8=_0x9ed0e[_0xba75('0x43')]['id'];var _0x3fba4e=_0x9ed0e[_0xba75('0x48')];var _0x57fd24=0xc8;var _0x3963e3=null;return db['sequelize'][_0xba75('0x80')]({'isolationLevel':db['sequelize'][_0xba75('0x81')][_0xba75('0x82')][_0xba75('0x83')]},function(_0x8d71d5){return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x5867a8},'transaction':_0x8d71d5})['then'](function(_0x5a3fff){if(_0x5a3fff){return db[_0xba75('0x84')][_0xba75('0x22')]({'where':{'MailAccountId':_0x5867a8},'transaction':_0x8d71d5})['then'](function(){var _0x45de53=_[_0xba75('0x2a')](_0x3fba4e,function(_0x1ba87e){_0x1ba87e[_0xba75('0x4e')]=_0x5867a8;return _0x1ba87e;});return db[_0xba75('0x84')][_0xba75('0x85')](_0x45de53,{'transaction':_0x8d71d5});});}else{_0x57fd24=0x194;_0x3963e3=[];}});})[_0xba75('0xd')](function(){if(_0x57fd24!==0x194){return db[_0xba75('0x84')][_0xba75('0x86')]({'where':{'MailAccountId':_0x5867a8},'order':_0xba75('0x87')})[_0xba75('0xd')](function(_0x45a8a7){_0x3963e3=_0x45a8a7;});}})[_0xba75('0x16')](function(_0x35f58b){_0x57fd24=0x1f4;logger[_0xba75('0x12')](_0x35f58b[_0xba75('0x24')]);if(_0x35f58b[_0xba75('0x25')]){delete _0x35f58b[_0xba75('0x25')];}_0x3963e3=_0x35f58b;})[_0xba75('0x88')](function(){if(_0x3963e3===null){_0x5aac75[_0xba75('0x17')](_0x57fd24);}else{if(_0x57fd24===0x1f4){_0x5aac75[_0xba75('0x19')](_0x57fd24)[_0xba75('0x89')](_0x3963e3);}else{_0x5aac75['status'](_0x57fd24)[_0xba75('0x20')](_0x3963e3);}}});};exports['getApplications']=function(_0x5ecf07,_0x279fa0){var _0x2c7cd5={};var _0x5a322f={};var _0x623c0b;var _0x55eef1;return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x5ecf07[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x279fa0,null))[_0xba75('0xd')](function(_0x4d8cb3){if(_0x4d8cb3){_0x623c0b=_0x4d8cb3;_0x5a322f[_0xba75('0x31')]=_[_0xba75('0x2e')](db[_0xba75('0x84')][_0xba75('0x46')]);_0x5a322f['query']=_[_0xba75('0x2e')](_0x5ecf07[_0xba75('0x2d')]);_0x5a322f[_0xba75('0x2f')]=_['intersection'](_0x5a322f[_0xba75('0x31')],_0x5a322f[_0xba75('0x2d')]);_0x2c7cd5[_0xba75('0x32')]=_[_0xba75('0x30')](_0x5a322f[_0xba75('0x31')],qs[_0xba75('0x33')](_0x5ecf07[_0xba75('0x2d')][_0xba75('0x33')]));_0x2c7cd5['attributes']=_0x2c7cd5['attributes'][_0xba75('0x34')]?_0x2c7cd5[_0xba75('0x32')]:_0x5a322f[_0xba75('0x31')];_0x2c7cd5[_0xba75('0x37')]=qs[_0xba75('0x38')](_0x5ecf07[_0xba75('0x2d')][_0xba75('0x38')]);_0x2c7cd5['where']=qs[_0xba75('0x2f')](_[_0xba75('0x39')](_0x5ecf07['query'],_0x5a322f[_0xba75('0x2f')]));if(_0x5ecf07['query']['filter']){_0x2c7cd5[_0xba75('0x3b')]=_['merge'](_0x2c7cd5[_0xba75('0x3b')],{'$or':_['map'](_0x2c7cd5[_0xba75('0x32')],function(_0x1c5572){var _0x461783={};_0x461783[_0x1c5572]={'$like':'%'+_0x5ecf07['query'][_0xba75('0x3a')]+'%'};return _0x461783;})});}_0x2c7cd5=_[_0xba75('0x3c')]({},_0x2c7cd5,_0x5ecf07['options']);return _0x623c0b[_0xba75('0x8a')](_0x2c7cd5);}})[_0xba75('0xd')](function(_0x53ea0b){if(_0x53ea0b){_0x55eef1=_0x53ea0b['length'];if(!_0x5ecf07[_0xba75('0x2d')][_0xba75('0x35')]('nolimit')){_0x2c7cd5['limit']=qs['limit'](_0x5ecf07[_0xba75('0x2d')][_0xba75('0x1c')]);_0x2c7cd5[_0xba75('0x1a')]=qs['offset'](_0x5ecf07[_0xba75('0x2d')][_0xba75('0x1a')]);}return _0x623c0b[_0xba75('0x8a')](_0x2c7cd5);}})[_0xba75('0xd')](function(_0x15d994){if(_0x15d994){return _0x15d994?{'count':_0x55eef1,'rows':_0x15d994}:null;}})['then'](respondWithResult(_0x279fa0,null))[_0xba75('0x16')](handleError(_0x279fa0,null));};exports[_0xba75('0x8b')]=function(_0x512de6,_0xb5a470){var _0x90f158={'raw':!![],'where':{}};var _0x1560be={};var _0x657e05={'count':0x0,'rows':[]};return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x512de6[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0xb5a470,null))[_0xba75('0xd')](function(_0x342652){if(_0x342652){_0x1560be[_0xba75('0x31')]=_[_0xba75('0x2e')](db[_0xba75('0x8c')][_0xba75('0x46')]);_0x1560be['query']=_['keys'](_0x512de6[_0xba75('0x2d')]);_0x1560be[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x1560be['model'],_0x1560be[_0xba75('0x2d')]);_0x90f158[_0xba75('0x32')]=_[_0xba75('0x30')](_0x1560be[_0xba75('0x31')],qs[_0xba75('0x33')](_0x512de6[_0xba75('0x2d')][_0xba75('0x33')]));_0x90f158[_0xba75('0x32')]=_0x90f158[_0xba75('0x32')][_0xba75('0x34')]?_0x90f158[_0xba75('0x32')]:_0x1560be['model'];if(!_0x512de6['query'][_0xba75('0x35')]('nolimit')){_0x90f158['limit']=qs[_0xba75('0x1c')](_0x512de6['query'][_0xba75('0x1c')]);_0x90f158[_0xba75('0x1a')]=qs[_0xba75('0x1a')](_0x512de6['query']['offset']);}_0x90f158[_0xba75('0x37')]=qs[_0xba75('0x38')](_0x512de6[_0xba75('0x2d')]['sort']);_0x90f158['where']=qs[_0xba75('0x2f')](_['pick'](_0x512de6[_0xba75('0x2d')],_0x1560be['filters']));_0x90f158[_0xba75('0x3b')][_0xba75('0x4e')]=_0x342652['id'];if(_0x512de6['query'][_0xba75('0x3a')]){_0x90f158[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x90f158['where'],{'$or':_['map'](_0x90f158[_0xba75('0x32')],function(_0x5580c2){var _0x11cf01={};_0x11cf01[_0x5580c2]={'$like':'%'+_0x512de6['query'][_0xba75('0x3a')]+'%'};return _0x11cf01;})});}if(_0x512de6[_0xba75('0x2d')][_0xba75('0x8d')]){var _0x55084f=_0x512de6[_0xba75('0x2d')]['$gte']['split'](',');var _0x18ae35={};_0x18ae35[_0x55084f[0x0]]={'$gte':moment(_0x55084f[0x1])['format'](_0xba75('0x8e'))};_0x90f158[_0xba75('0x3b')]=_[_0xba75('0x3c')](_0x90f158['where'],_0x18ae35);}_0x90f158=_[_0xba75('0x3c')]({},_0x90f158,_0x512de6[_0xba75('0x3e')]);return db[_0xba75('0x8c')][_0xba75('0x1d')]({'where':_0x90f158[_0xba75('0x3b')]})[_0xba75('0xd')](function(_0x1be4cf){_0x657e05['count']=_0x1be4cf;if(_0x512de6[_0xba75('0x2d')][_0xba75('0x3f')]){_0x90f158['include']=[{'all':!![]}];}return db[_0xba75('0x8c')]['findAll'](_0x90f158);})[_0xba75('0xd')](function(_0x3093e4){if(_0x512de6[_0xba75('0x2d')][_0xba75('0x8f')]==='true'){for(var _0x1665af=0x0;_0x1665af<_0x3093e4[_0xba75('0x34')];_0x1665af++){_0x3093e4[_0x1665af][_0xba75('0x48')]=juice(_0x3093e4[_0x1665af][_0xba75('0x48')]);}}_0x657e05['rows']=_0x3093e4;return _0x657e05;});}})['then'](respondWithFilteredResult(_0xb5a470,_0x90f158))[_0xba75('0x16')](handleError(_0xb5a470,null));};exports[_0xba75('0x89')]=function(_0x4bdc39,_0x3abd18){var _0x4f91f3,_0x2af7c5={},_0x2f06d4;if(_0x4bdc39['body']['to']){_0x2f06d4=_0x4bdc39['body']['to'][_0xba75('0x90')](',')[0x0];}return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x4bdc39['params']['id']},'include':[{'model':db['CmList'],'as':_0xba75('0x91'),'include':[{'model':db['CmContact'],'as':_0xba75('0x92'),'where':{'email':_0x2f06d4},'limit':0x1,'order':[[_0xba75('0x93'),_0xba75('0x94')]]}]},{'model':db[_0xba75('0x27')],'as':_0xba75('0x45'),'raw':!![]}]})[_0xba75('0xd')](handleEntityNotFound(_0x3abd18,null))[_0xba75('0xd')](function(_0x313f1c){if(_0x313f1c){_0x4f91f3=_0x313f1c;if(_0x313f1c[_0xba75('0x45')]){if(_[_0xba75('0x5e')](_0x4bdc39[_0xba75('0x48')][_0xba75('0x95')])){_0x4bdc39[_0xba75('0x48')][_0xba75('0x95')]=util[_0xba75('0x96')]('%s\x20<%s>',_0x313f1c[_0xba75('0x25')],_0x313f1c['email']||_0x313f1c[_0xba75('0x45')]['user']);}if(_0x4bdc39[_0xba75('0x48')][_0xba75('0x97')]&&_0x4bdc39[_0xba75('0x48')][_0xba75('0x97')][_0xba75('0x34')]){for(var _0x283e3d=0x0;_0x283e3d<_0x4bdc39[_0xba75('0x48')][_0xba75('0x97')]['length'];_0x283e3d+=0x1){_0x4bdc39['body'][_0xba75('0x97')][_0x283e3d]={'filename':_0x4bdc39[_0xba75('0x48')][_0xba75('0x97')][_0x283e3d][_0xba75('0x25')],'path':path[_0xba75('0x98')](config['root'],_0xba75('0x99'),_0x4bdc39[_0xba75('0x48')][_0xba75('0x97')][_0x283e3d][_0xba75('0x9a')])};}}var _0x38e86b={'tls':{'rejectUnauthorized':![]}};if(_[_0xba75('0x5e')](_0x313f1c['Smtp']['service'])){if(_0x313f1c[_0xba75('0x45')][_0xba75('0x68')]){_0x38e86b['auth']={'user':_0x313f1c[_0xba75('0x45')][_0xba75('0x61')],'pass':_0x313f1c['Smtp'][_0xba75('0x63')]};}_0x38e86b['host']=_0x313f1c[_0xba75('0x45')][_0xba75('0x66')];_0x38e86b['port']=_0x313f1c[_0xba75('0x45')][_0xba75('0x67')];_0x38e86b['secure']=_0x313f1c[_0xba75('0x45')][_0xba75('0x9b')];}else{_0x38e86b[_0xba75('0x65')]=_0x313f1c[_0xba75('0x45')]['service'];_0x38e86b['auth']={'user':_0x313f1c[_0xba75('0x45')][_0xba75('0x61')],'pass':_0x313f1c[_0xba75('0x45')][_0xba75('0x63')]};}return respondWithRpcPromise(_0xba75('0x9c'),_0xba75('0x9d'),{'account':_0x38e86b,'message':_0x4bdc39['body']});}else{throw new Error(_0xba75('0x9e'));}}})['then'](function(_0x58e47e){if(_0x58e47e){_0x2af7c5=_0x58e47e;if(_0x4f91f3[_0xba75('0x91')]){if(_0x4f91f3[_0xba75('0x91')][_0xba75('0x92')][_0xba75('0x34')]){return _0x4f91f3[_0xba75('0x91')][_0xba75('0x92')][0x0];}else{return db[_0xba75('0x76')][_0xba75('0x50')](_[_0xba75('0x9f')](_0x4bdc39[_0xba75('0x48')],{'firstName':_0x4bdc39['body']['to'],'email':_0x4bdc39[_0xba75('0x48')]['to'],'phone':_0x4bdc39[_0xba75('0x48')]['to'],'ListId':_0x4f91f3['ListId']}));}}else{throw new Error(_0xba75('0x9e'));}}})[_0xba75('0xd')](function(_0xaf813e){if(_0xaf813e){var _0x11e468={'UserId':_0x4bdc39[_0xba75('0x61')]['id'],'ContactId':_0xaf813e['id'],'MailAccountId':_0x4f91f3['id'],'inReplyTo':_0x2af7c5['messageId'],'to':_0x4bdc39['body'][_0xba75('0x95')],'cc':_0x4bdc39[_0xba75('0x48')]['cc'],'subject':_0x4bdc39['body'][_0xba75('0xa0')],'attach':_0x4bdc39[_0xba75('0x48')][_0xba75('0xa1')],'firstMsgDirection':_0xba75('0xa2'),'lastMsgAt':moment()['format'](_0xba75('0x8e')),'lastMsgDirection':_0xba75('0xa2'),'Messages':[_[_0xba75('0x3c')](_0x4bdc39[_0xba75('0x48')],{'messageId':_0x2af7c5[_0xba75('0xa3')],'sentAt':moment()[_0xba75('0x96')](_0xba75('0x8e')),'read':!![],'MailAccountId':_0x4f91f3['id'],'UserId':_0x4bdc39[_0xba75('0x61')]['id'],'ContactId':_0xaf813e['id']})]};if(_0x4bdc39[_0xba75('0x48')][_0xba75('0xa4')]){_0x11e468=_[_0xba75('0x3c')](_0x11e468,_0x4bdc39[_0xba75('0x48')]['Interaction']);}return db[_0xba75('0x74')][_0xba75('0x50')](_0x11e468,{'include':[{'model':db[_0xba75('0x8c')],'as':_0xba75('0xa5')}]});}})[_0xba75('0xd')](respondWithResult(_0x3abd18,null))[_0xba75('0x16')](handleError(_0x3abd18,null));};exports['verifySmtp']=function(_0x9755d,_0x54ba2c){return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x9755d[_0xba75('0x43')]['id']},'include':[{'model':db[_0xba75('0x27')],'as':_0xba75('0x45'),'raw':!![],'include':[{'model':db[_0xba75('0xa6')],'as':_0xba75('0xa6'),'raw':!![]}]}]})[_0xba75('0xd')](handleEntityNotFound(_0x54ba2c,null))[_0xba75('0xd')](function(_0xc8fd6){if(!_0xc8fd6[_0xba75('0x45')])return;var _0x2f1ea4={'id':_0xc8fd6['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc8fd6[_0xba75('0x5b')]!==_0xba75('0xa7')){_0x2f1ea4['service']=_0xc8fd6[_0xba75('0x5b')];}else{_0x2f1ea4[_0xba75('0x66')]=_0xc8fd6[_0xba75('0x45')][_0xba75('0x66')];_0x2f1ea4['port']=_0xc8fd6[_0xba75('0x45')][_0xba75('0x67')];_0x2f1ea4[_0xba75('0x9b')]=_0xc8fd6['Smtp'][_0xba75('0x9b')];}if(_0xc8fd6['Smtp'][_0xba75('0x68')]){if(_0xc8fd6[_0xba75('0x45')][_0xba75('0x4a')]){_0x2f1ea4['auth']={'type':_0xba75('0xa8'),'user':_0xc8fd6[_0xba75('0x45')][_0xba75('0x61')],'accessToken':_0xc8fd6[_0xba75('0x45')][_0xba75('0xa6')][_0xba75('0xa9')]};}else{_0x2f1ea4['auth']={'user':_0xc8fd6['Smtp'][_0xba75('0x61')],'pass':_0xc8fd6[_0xba75('0x45')]['pass']};}}return respondWithRpcPromise(_0xba75('0xaa'),'verifySmtp',{'account':_0x2f1ea4});})[_0xba75('0xd')](respondWithResult(_0x54ba2c,null))['catch'](handleError(_0x54ba2c,null));};exports[_0xba75('0x22')]=function(_0x41aeb0,_0x430647){return db[_0xba75('0x2b')]['find']({'where':{'id':_0x41aeb0[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x430647,null))[_0xba75('0xd')](function(_0x16bb2b){if(_0x16bb2b&&_0x16bb2b[_0xba75('0x65')]){throw new db['Sequelize'][(_0xba75('0xab'))](_0xba75('0xac'));}return _0x16bb2b;})[_0xba75('0xd')](removeEntity(_0x430647,null))[_0xba75('0x16')](handleError(_0x430647,null));};exports[_0xba75('0xad')]=function(_0x528797,_0x2165dc){return db[_0xba75('0x2b')]['find']({'where':{'id':_0x528797['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x2165dc,null))[_0xba75('0xd')](function(_0x32af9d){if(_0x32af9d){return _0x32af9d[_0xba75('0xad')](_0x528797[_0xba75('0x48')]['ids'],_[_0xba75('0x75')](_0x528797[_0xba75('0x48')],[_0xba75('0x54'),'id'])||{})[_0xba75('0xae')](function(_0x523ef4){for(var _0x530be1=0x0;_0x530be1<_0x528797[_0xba75('0x48')][_0xba75('0x54')][_0xba75('0x34')];_0x530be1+=0x1){socket[_0xba75('0xaf')](_0xba75('0xb0'),{'UserId':Number(_0x528797[_0xba75('0x48')]['ids'][_0x530be1]),'MailAccountId':Number(_0x528797['params']['id'])});}return _0x523ef4;});}})['then'](respondWithResult(_0x2165dc,null))[_0xba75('0x16')](handleError(_0x2165dc,null));};exports['removeAgents']=function(_0x1b4cd1,_0x599c9f){return db[_0xba75('0x2b')][_0xba75('0x47')]({'where':{'id':_0x1b4cd1['params']['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x599c9f,null))[_0xba75('0xd')](function(_0xc182a8){if(_0xc182a8){return _0xc182a8[_0xba75('0xb1')](_0x1b4cd1[_0xba75('0x2d')][_0xba75('0x54')])[_0xba75('0xd')](function(){if(_[_0xba75('0xb2')](_0x1b4cd1[_0xba75('0x2d')][_0xba75('0x54')])){for(var _0x2b2048=0x0;_0x2b2048<_0x1b4cd1[_0xba75('0x2d')][_0xba75('0x54')][_0xba75('0x34')];_0x2b2048+=0x1){socket[_0xba75('0xaf')](_0xba75('0xb3'),{'UserId':Number(_0x1b4cd1[_0xba75('0x2d')]['ids'][_0x2b2048]),'MailAccountId':Number(_0x1b4cd1[_0xba75('0x43')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x1b4cd1['query'][_0xba75('0x54')]),'MailAccountId':Number(_0x1b4cd1[_0xba75('0x43')]['id'])});}});}})[_0xba75('0xd')](respondWithStatusCode(_0x599c9f,null))['catch'](handleError(_0x599c9f,null));};exports[_0xba75('0xb4')]=function(_0x933413,_0x247856){var _0x2ff240={};var _0x20c61d={};var _0x5d8334;var _0x1c17f5;return db[_0xba75('0x2b')][_0xba75('0x58')]({'where':{'id':_0x933413[_0xba75('0x43')]['id']}})[_0xba75('0xd')](handleEntityNotFound(_0x247856,null))[_0xba75('0xd')](function(_0x326d06){if(_0x326d06){_0x5d8334=_0x326d06;_0x20c61d[_0xba75('0x31')]=_[_0xba75('0x2e')](db[_0xba75('0x78')][_0xba75('0x46')]);_0x20c61d['query']=_[_0xba75('0x2e')](_0x933413[_0xba75('0x2d')]);_0x20c61d[_0xba75('0x2f')]=_[_0xba75('0x30')](_0x20c61d['model'],_0x20c61d[_0xba75('0x2d')]);_0x2ff240['attributes']=_['intersection'](_0x20c61d[_0xba75('0x31')],qs[_0xba75('0x33')](_0x933413[_0xba75('0x2d')]['fields']));_0x2ff240[_0xba75('0x32')]=_0x2ff240[_0xba75('0x32')][_0xba75('0x34')]?_0x2ff240['attributes']:_0x20c61d[_0xba75('0x31')];_0x2ff240['order']=qs[_0xba75('0x38')](_0x933413[_0xba75('0x2d')][_0xba75('0x38')]);_0x2ff240[_0xba75('0x3b')]=qs[_0xba75('0x2f')](_[_0xba75('0x39')](_0x933413['query'],_0x20c61d[_0xba75('0x2f')]));if(_0x933413[_0xba75('0x2d')][_0xba75('0x3a')]){_0x2ff240['where']=_[_0xba75('0x3c')](_0x2ff240[_0xba75('0x3b')],{'$or':_[_0xba75('0x2a')](_0x2ff240[_0xba75('0x32')],function(_0x32e423){var _0x26063b={};_0x26063b[_0x32e423]={'$like':'%'+_0x933413[_0xba75('0x2d')]['filter']+'%'};return _0x26063b;})});}_0x2ff240=_[_0xba75('0x3c')]({},_0x2ff240,_0x933413[_0xba75('0x3e')]);return _0x5d8334[_0xba75('0xb4')](_0x2ff240);}})[_0xba75('0xd')](function(_0x41b386){if(_0x41b386){_0x1c17f5=_0x41b386[_0xba75('0x34')];if(!_0x933413[_0xba75('0x2d')]['hasOwnProperty'](_0xba75('0x36'))){_0x2ff240['limit']=qs[_0xba75('0x1c')](_0x933413[_0xba75('0x2d')][_0xba75('0x1c')]);_0x2ff240[_0xba75('0x1a')]=qs[_0xba75('0x1a')](_0x933413['query'][_0xba75('0x1a')]);}return _0x5d8334['getAgents'](_0x2ff240);}})['then'](function(_0x335cd8){if(_0x335cd8){return _0x335cd8?{'count':_0x1c17f5,'rows':_0x335cd8}:null;}})[_0xba75('0xd')](respondWithResult(_0x247856,null))[_0xba75('0x16')](handleError(_0x247856,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 957b584..f4c36fd 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 _0xb091=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','MailAccount'];(function(_0x5be41b,_0x333257){var _0x11c96e=function(_0x3fff04){while(--_0x3fff04){_0x5be41b['push'](_0x5be41b['shift']());}};_0x11c96e(++_0x333257);}(_0xb091,0x16e));var _0x1b09=function(_0x37425a,_0x1c99ad){_0x37425a=_0x37425a-0x0;var _0x5a0e3b=_0xb091[_0x37425a];return _0x5a0e3b;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1b09('0x0'))['db'][_0x1b09('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1b09('0x2')](0x0);var events={'afterCreate':_0x1b09('0x3'),'afterUpdate':'update','afterDestroy':_0x1b09('0x4')};function emitEvent(_0x59af61){return function(_0x5aa3b0,_0x295863,_0x24d22c){MailAccountEvents['emit'](_0x59af61+':'+_0x5aa3b0['id'],_0x5aa3b0);MailAccountEvents[_0x1b09('0x5')](_0x59af61,_0x5aa3b0);_0x24d22c(null);};}for(var e in events){if(events[_0x1b09('0x6')](e)){var event=events[e];MailAccount[_0x1b09('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x022a=['hasOwnProperty','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x363d62,_0xdad2dc){var _0xef4ccb=function(_0x4dec98){while(--_0x4dec98){_0x363d62['push'](_0x363d62['shift']());}};_0xef4ccb(++_0xdad2dc);}(_0x022a,0x1f0));var _0xa022=function(_0xa9dc6f,_0x27d8f0){_0xa9dc6f=_0xa9dc6f-0x0;var _0x201588=_0x022a[_0xa9dc6f];return _0x201588;};'use strict';var EventEmitter=require(_0xa022('0x0'));var MailAccount=require(_0xa022('0x1'))['db'][_0xa022('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa022('0x3')](0x0);var events={'afterCreate':_0xa022('0x4'),'afterUpdate':_0xa022('0x5'),'afterDestroy':_0xa022('0x6')};function emitEvent(_0x23dd57){return function(_0x16516a,_0x233c8d,_0x395b24){MailAccountEvents[_0xa022('0x7')](_0x23dd57+':'+_0x16516a['id'],_0x16516a);MailAccountEvents['emit'](_0x23dd57,_0x16516a);_0x395b24(null);};}for(var e in events){if(events[_0xa022('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d645df3..9f604b7 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 _0xf378=['define','MailAccount','mail_accounts','lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports'];(function(_0x351d63,_0x53e576){var _0x2002a4=function(_0x1224db){while(--_0x1224db){_0x351d63['push'](_0x351d63['shift']());}};_0x2002a4(++_0x53e576);}(_0xf378,0x1d7));var _0x8f37=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xf378[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x8f37('0x0'));var util=require(_0x8f37('0x1'));var logger=require('../../config/logger')(_0x8f37('0x2'));var moment=require('moment');var BPromise=require(_0x8f37('0x3'));var rp=require(_0x8f37('0x4'));var fs=require('fs');var path=require(_0x8f37('0x5'));var rimraf=require('rimraf');var config=require(_0x8f37('0x6'));var attributes=require(_0x8f37('0x7'));module[_0x8f37('0x8')]=function(_0x1dfdf3,_0x159083){return _0x1dfdf3[_0x8f37('0x9')](_0x8f37('0xa'),attributes,{'tableName':_0x8f37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc85a=['../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xc85a,0x95));var _0xac85=function(_0x237b58,_0x4f9e42){_0x237b58=_0x237b58-0x0;var _0x373250=_0xc85a[_0x237b58];return _0x373250;};'use strict';var _=require(_0xac85('0x0'));var util=require(_0xac85('0x1'));var logger=require(_0xac85('0x2'))('api');var moment=require(_0xac85('0x3'));var BPromise=require(_0xac85('0x4'));var rp=require(_0xac85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac85('0x6'));var config=require(_0xac85('0x7'));var attributes=require(_0xac85('0x8'));module['exports']=function(_0x4eaef4,_0x5b7cb1){return _0x4eaef4[_0xac85('0x9')](_0xac85('0xa'),attributes,{'tableName':_0xac85('0xb'),'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 5e7f253..0383b8f 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 _0x3a6d=['ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','Smtp','get','account','list','applications','orderBy','priority','asc','close','autoclose','length','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','update','subject','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','CompanyId'];(function(_0x2adb04,_0x4d4356){var _0x3c1bca=function(_0x5e3b88){while(--_0x5e3b88){_0x2adb04['push'](_0x2adb04['shift']());}};_0x3c1bca(++_0x4d4356);}(_0x3a6d,0x1e9));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require(_0xd3a6('0x2'));var BPromise=require(_0xd3a6('0x3'));var rs=require(_0xd3a6('0x4'));var fs=require('fs');var Redis=require(_0xd3a6('0x5'));var db=require(_0xd3a6('0x6'))['db'];var utils=require(_0xd3a6('0x7'));var logger=require(_0xd3a6('0x8'))(_0xd3a6('0x9'));var config=require(_0xd3a6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd3a6('0xb')][_0xd3a6('0xc')]({'port':0x232c});config[_0xd3a6('0xd')]=_[_0xd3a6('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd3a6('0xf'))(new Redis(config[_0xd3a6('0xd')]));require(_0xd3a6('0x10'))[_0xd3a6('0x11')](socket);function respondWithRpcPromise(_0x504b59,_0x597727,_0x382b05){return new BPromise(function(_0x1c0721,_0x48deec){return client[_0xd3a6('0x12')](_0x504b59,_0x382b05)['then'](function(_0x485c47){logger[_0xd3a6('0x13')](_0xd3a6('0x14'),_0x597727,_0xd3a6('0x15'));logger[_0xd3a6('0x16')](_0xd3a6('0x17'),_0x597727,_0xd3a6('0x15'),JSON[_0xd3a6('0x18')](_0x485c47));if(_0x485c47[_0xd3a6('0x19')]){if(_0x485c47[_0xd3a6('0x19')][_0xd3a6('0x1a')]===0x1f4){logger['error'](_0xd3a6('0x14'),_0x597727,_0x485c47['error'][_0xd3a6('0x1b')]);return _0x48deec(_0x485c47[_0xd3a6('0x19')][_0xd3a6('0x1b')]);}logger['error'](_0xd3a6('0x14'),_0x597727,_0x485c47['error'][_0xd3a6('0x1b')]);return _0x1c0721(_0x485c47['error'][_0xd3a6('0x1b')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x597727,'request\x20sent');_0x1c0721(_0x485c47[_0xd3a6('0x1c')]['message']);}})[_0xd3a6('0x1d')](function(_0xfad1bc){logger[_0xd3a6('0x19')](_0xd3a6('0x14'),_0x597727,_0xfad1bc);_0x48deec(_0xfad1bc);});});}exports[_0xd3a6('0x1e')]=function(_0x2e8d5e){var _0x39322a=this;return new Promise(function(_0x30c1b6,_0x10d4e1){return db[_0xd3a6('0x1f')][_0xd3a6('0x20')]({'raw':_0x2e8d5e[_0xd3a6('0x21')]?_0x2e8d5e['options'][_0xd3a6('0x22')]===undefined?!![]:![]:!![],'where':_0x2e8d5e[_0xd3a6('0x21')]?_0x2e8d5e['options'][_0xd3a6('0x23')]||null:null,'attributes':_0x2e8d5e[_0xd3a6('0x21')]?_0x2e8d5e[_0xd3a6('0x21')][_0xd3a6('0x24')]||null:null,'limit':_0x2e8d5e[_0xd3a6('0x21')]?_0x2e8d5e['options'][_0xd3a6('0x25')]||null:null,'include':_0x2e8d5e[_0xd3a6('0x21')]?_0x2e8d5e[_0xd3a6('0x21')][_0xd3a6('0x26')]?_[_0xd3a6('0x27')](_0x2e8d5e[_0xd3a6('0x21')][_0xd3a6('0x26')],function(_0x1bf644){return{'model':db[_0x1bf644[_0xd3a6('0x28')]],'as':_0x1bf644['as'],'attributes':_0x1bf644[_0xd3a6('0x24')],'include':_0x1bf644[_0xd3a6('0x26')]?_[_0xd3a6('0x27')](_0x1bf644['include'],function(_0x1df839){return{'model':db[_0x1df839['model']],'as':_0x1df839['as'],'attributes':_0x1df839['attributes'],'include':_0x1df839[_0xd3a6('0x26')]?_[_0xd3a6('0x27')](_0x1df839[_0xd3a6('0x26')],function(_0x5c7c26){return{'model':db[_0x5c7c26[_0xd3a6('0x28')]],'as':_0x5c7c26['as'],'attributes':_0x5c7c26[_0xd3a6('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd3a6('0x29')](function(_0x4aab9c){logger['info'](_0xd3a6('0x1e'),_0x2e8d5e);logger[_0xd3a6('0x16')](_0xd3a6('0x1e'),_0x2e8d5e,JSON[_0xd3a6('0x18')](_0x4aab9c));_0x30c1b6(_0x4aab9c);})[_0xd3a6('0x1d')](function(_0x2790cc){logger['error']('GetMailAccount',_0x2790cc[_0xd3a6('0x1b')],_0x2e8d5e);_0x10d4e1(_0x39322a[_0xd3a6('0x19')](0x1f4,_0x2790cc['message']));});});};exports[_0xd3a6('0x2a')]=function(_0x461497){var _0x4c556c=this;return new Promise(function(_0x141f59,_0x330527){return db[_0xd3a6('0x1f')][_0xd3a6('0x2b')]({'raw':_0x461497[_0xd3a6('0x21')]?_0x461497[_0xd3a6('0x21')][_0xd3a6('0x22')]===undefined?!![]:![]:!![],'where':_0x461497['options']?_0x461497[_0xd3a6('0x21')][_0xd3a6('0x23')]||null:null,'attributes':_0x461497[_0xd3a6('0x21')]?_0x461497[_0xd3a6('0x21')][_0xd3a6('0x24')]||null:null,'include':_0x461497[_0xd3a6('0x21')]?_0x461497['options'][_0xd3a6('0x26')]?_['map'](_0x461497[_0xd3a6('0x21')][_0xd3a6('0x26')],function(_0x499764){return{'model':db[_0x499764[_0xd3a6('0x28')]],'as':_0x499764['as'],'attributes':_0x499764[_0xd3a6('0x24')],'include':_0x499764[_0xd3a6('0x26')]?_[_0xd3a6('0x27')](_0x499764[_0xd3a6('0x26')],function(_0x35232a){return{'model':db[_0x35232a[_0xd3a6('0x28')]],'as':_0x35232a['as'],'attributes':_0x35232a['attributes'],'include':_0x35232a[_0xd3a6('0x26')]?_[_0xd3a6('0x27')](_0x35232a['include'],function(_0x1a3305){return{'model':db[_0x1a3305[_0xd3a6('0x28')]],'as':_0x1a3305['as'],'attributes':_0x1a3305['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3a6('0x29')](function(_0x43318d){logger[_0xd3a6('0x13')](_0xd3a6('0x2a'),_0x461497);logger[_0xd3a6('0x16')](_0xd3a6('0x2a'),_0x461497,JSON[_0xd3a6('0x18')](_0x43318d));_0x141f59(_0x43318d);})[_0xd3a6('0x1d')](function(_0x251373){logger['error'](_0xd3a6('0x2a'),_0x251373['message'],_0x461497);_0x330527(_0x4c556c[_0xd3a6('0x19')](0x1f4,_0x251373['message']));});});};exports[_0xd3a6('0x2c')]=function(_0x212711){var _0x1e4150=this;return new Promise(function(_0x2ca903,_0xbaefdd){var _0x5afc14={'body':_0x212711[_0xd3a6('0x2d')],'channel':_0xd3a6('0x2e')};var _0x3a7259=_[_0xd3a6('0x2f')](_['keys'](db['CmContact'][_0xd3a6('0x30')]),[_0xd3a6('0x31'),'updatedAt',_0xd3a6('0x32'),_0xd3a6('0x33')]);var _0x4969cf=![];if(_0x212711[_0xd3a6('0x2d')]['id']){delete _0x212711['body']['id'];}if(_['isNil'](_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x34')])){return _0xbaefdd(_0x1e4150[_0xd3a6('0x19')](0x1f4,_0xd3a6('0x35')));}if(_[_0xd3a6('0x36')](_0x212711['body'][_0xd3a6('0x2d')])||_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x2d')]===''){return _0xbaefdd(_0x1e4150[_0xd3a6('0x19')](0x1f4,_0xd3a6('0x37')));}if(_[_0xd3a6('0x36')](_0x212711['body'][_0xd3a6('0x38')])){return _0xbaefdd(_0x1e4150['error'](0x1f4,_0xd3a6('0x39')+_0x3a7259));}if(!_[_0xd3a6('0x3a')](_0x3a7259,_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x38')])){return _0xbaefdd(_0x1e4150[_0xd3a6('0x19')](0x1f4,_0xd3a6('0x3b')+_0x3a7259));}var _0x1a7d64={};_0x1a7d64[_0x212711['body'][_0xd3a6('0x38')]]=_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x34')];return db['MailAccount']['find']({'where':{'id':_0x212711['account']['id']},'include':[{'model':db[_0xd3a6('0x3c')],'as':_0xd3a6('0x3d'),'include':[{'model':db[_0xd3a6('0x3e')],'as':_0xd3a6('0x3f'),'where':_0x1a7d64,'limit':0x1,'order':[['updatedAt',_0xd3a6('0x40')]]}]},{'model':db['MailApplication'],'as':_0xd3a6('0x41')},{'model':db['MailServerOut'],'as':_0xd3a6('0x42')}]})[_0xd3a6('0x29')](function(_0x397c28){if(_0x397c28&&_0x397c28[_0xd3a6('0x3d')]){var _0x2aef86=_0x397c28[_0xd3a6('0x43')]({'plain':!![]});_0x5afc14[_0xd3a6('0x44')]=_['omit'](_0x2aef86,[_0xd3a6('0x41'),_0xd3a6('0x3d')]);_0x5afc14['applications']=_0x2aef86['Applications'];_0x5afc14[_0xd3a6('0x45')]=_0x2aef86[_0xd3a6('0x3d')];_0x5afc14[_0xd3a6('0x46')]=_[_0xd3a6('0x47')](_0x5afc14[_0xd3a6('0x46')],[_0xd3a6('0x48')],[_0xd3a6('0x49')]);if(_0x5afc14['account']&&_0x5afc14[_0xd3a6('0x44')]['autoclose']){_0x5afc14[_0xd3a6('0x46')]['push']({'id':0x0,'priority':_0x5afc14[_0xd3a6('0x46')]['length']+0x1,'app':_0xd3a6('0x4a'),'appdata':_0xd3a6('0x4b'),'interval':'*,*,*,*'});}if(_0x5afc14[_0xd3a6('0x44')][_0xd3a6('0x41')]){delete _0x5afc14['account']['Applications'];}if(_0x5afc14['account'][_0xd3a6('0x3d')]){delete _0x5afc14[_0xd3a6('0x44')][_0xd3a6('0x3d')];}if(_0x2aef86[_0xd3a6('0x3d')]['Contacts'][_0xd3a6('0x4c')]){return _0x2aef86[_0xd3a6('0x3d')][_0xd3a6('0x3f')][0x0];}var _0x101f09=_[_0xd3a6('0xe')](_0x212711[_0xd3a6('0x2d')],{'firstName':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x34')],'ListId':_0x2aef86['ListId']});_0x101f09[_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x38')]]=_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x34')];return db[_0xd3a6('0x3e')][_0xd3a6('0x4d')](_0x101f09);}else{throw new Error(_0xd3a6('0x4e'));}})[_0xd3a6('0x29')](function(_0x6b8c0c){_0x5afc14['contact']=_0x6b8c0c;if(_0x6b8c0c){if(!_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x4f')]){_0x212711['body'][_0xd3a6('0x1b')][_0xd3a6('0x4f')]=rs[_0xd3a6('0x50')]()+'\x20'+_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['from'];}var _0x13be91={'ContactId':_0x6b8c0c['id'],'MailAccountId':_0x212711[_0xd3a6('0x44')]['id'],'inReplyTo':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['messageId'],'to':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['from'],'cc':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['cc'],'subject':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['subject'],'attach':_0x212711['body'][_0xd3a6('0x1b')][_0xd3a6('0x51')],'lastMsgAt':moment()[_0xd3a6('0x52')](_0xd3a6('0x53')),'lastMsgDirection':'in'};return db[_0xd3a6('0x54')][_0xd3a6('0x2b')]({'where':{'closed':![],'MailAccountId':_0x212711[_0xd3a6('0x44')]['id']},'include':[{'model':db[_0xd3a6('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x212711['body'][_0xd3a6('0x1b')][_0xd3a6('0x56')]}}]})[_0xd3a6('0x29')](function(_0x1efd03){if(_0x1efd03){return[_0x1efd03,![]];}return db[_0xd3a6('0x54')][_0xd3a6('0x4d')](_0x13be91)['then'](function(_0x4f6cd4){return[_0x4f6cd4,!![]];});});}else{throw new Error(_0xd3a6('0x57'));}})['spread'](function(_0x361c5e,_0x2055b0){if(_0x361c5e){_0x4969cf=_0x2055b0;if(!_0x2055b0){return _0x361c5e[_0xd3a6('0x58')]({'inReplyTo':_0x212711[_0xd3a6('0x2d')]['message'][_0xd3a6('0x4f')],'to':_0x212711['body'][_0xd3a6('0x1b')][_0xd3a6('0x34')],'cc':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['cc'],'subject':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x59')],'attach':_0x361c5e[_0xd3a6('0x51')]?_0x361c5e[_0xd3a6('0x51')]:_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x51')],'substatus':null,'substatusAt':moment()[_0xd3a6('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xd3a6('0x52')](_0xd3a6('0x53')),'lastMsgDirection':'in'});}else{return _0x361c5e;}}})['then'](function(_0x2696f1){_0x5afc14[_0xd3a6('0x5a')]=_0x2696f1['get']({'plain':!![]});_0x5afc14[_0xd3a6('0x5a')][_0xd3a6('0x5b')]=_0x4969cf;return db[_0xd3a6('0x55')][_0xd3a6('0x4d')]({'body':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x2d')],'MailAccountId':_0x212711[_0xd3a6('0x44')]['id'],'MailInteractionId':_0x2696f1['id'],'direction':'in','ContactId':_0x5afc14['contact']['id'],'messageId':_0x212711[_0xd3a6('0x2d')]['message'][_0xd3a6('0x4f')],'from':_0x212711['body']['message'][_0xd3a6('0x34')],'to':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['to'],'cc':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')]['cc'],'subject':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x59')],'attach':_0x212711['body']['message']['attach'],'Attachments':_0x212711[_0xd3a6('0x2d')]['message']['attachments'],'originTo':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x5c')],'originCc':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x5d')],'bcc':_0x212711[_0xd3a6('0x2d')]['message'][_0xd3a6('0x5e')],'ChatWebsiteId':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x5f')]||null,'originChannel':_0x212711[_0xd3a6('0x2d')][_0xd3a6('0x1b')][_0xd3a6('0x60')]||_0xd3a6('0x61'),'ChatOfflineMessageId':_0x212711['body']['message'][_0xd3a6('0x62')]||null},{'include':[{'model':db[_0xd3a6('0x63')],'as':_0xd3a6('0x64')}]});})[_0xd3a6('0x29')](function(_0x4c97a4){_0x5afc14[_0xd3a6('0x1b')]=_0x4c97a4;if(_0x5afc14[_0xd3a6('0x5a')]['UserId']){return db[_0xd3a6('0x65')][_0xd3a6('0x2b')]({'attributes':['id',_0xd3a6('0x66')],'where':{'id':_0x5afc14[_0xd3a6('0x5a')]['UserId']}})['then'](function(_0xf7a604){if(_0xf7a604){_0x5afc14[_0xd3a6('0x46')][_0xd3a6('0x67')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf7a604[_0xd3a6('0x66')]+','+(_0x5afc14[_0xd3a6('0x44')][_0xd3a6('0x68')]||0xa),'interval':_0xd3a6('0x69')});}return respondWithRpcPromise(_0xd3a6('0x6a'),_0xd3a6('0x6b'),_0x5afc14);});}return respondWithRpcPromise(_0xd3a6('0x6a'),_0xd3a6('0x6b'),_0x5afc14);})[_0xd3a6('0x29')](function(_0x2189a3){_0x2ca903(_0x2189a3);})[_0xd3a6('0x1d')](function(_0x32f9ea){_0xbaefdd(_0x1e4150[_0xd3a6('0x19')](0x1f4,_0x32f9ea[_0xd3a6('0x1b')]));});});}; \ No newline at end of file +var _0xe4d7=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','raw','body','mail','difference','keys','CmContact','rawAttributes','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','MailAccount','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','Applications','applications','asc','autoclose','length','close','account','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','interaction','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','util'];(function(_0x106a5f,_0x286a32){var _0x283338=function(_0x57d6ae){while(--_0x57d6ae){_0x106a5f['push'](_0x106a5f['shift']());}};_0x283338(++_0x286a32);}(_0xe4d7,0x1f2));var _0x7e4d=function(_0x3fed7c,_0x287f6d){_0x3fed7c=_0x3fed7c-0x0;var _0x3d7389=_0xe4d7[_0x3fed7c];return _0x3d7389;};'use strict';var _=require(_0x7e4d('0x0'));var util=require(_0x7e4d('0x1'));var moment=require('moment');var BPromise=require(_0x7e4d('0x2'));var rs=require(_0x7e4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e4d('0x4'))['db'];var utils=require(_0x7e4d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7e4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7e4d('0x7')][_0x7e4d('0x8')]({'port':0x232c});config['redis']=_['defaults'](config[_0x7e4d('0x9')],{'host':_0x7e4d('0xa'),'port':0x18eb});var socket=require(_0x7e4d('0xb'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x7e4d('0xc')](socket);function respondWithRpcPromise(_0x4a5005,_0x9f6f81,_0x193988){return new BPromise(function(_0x57beac,_0x162125){return client[_0x7e4d('0xd')](_0x4a5005,_0x193988)[_0x7e4d('0xe')](function(_0x1db5ee){logger[_0x7e4d('0xf')]('MailAccount,\x20%s,\x20%s',_0x9f6f81,'request\x20sent');logger[_0x7e4d('0x10')](_0x7e4d('0x11'),_0x9f6f81,_0x7e4d('0x12'),JSON[_0x7e4d('0x13')](_0x1db5ee));if(_0x1db5ee[_0x7e4d('0x14')]){if(_0x1db5ee[_0x7e4d('0x14')][_0x7e4d('0x15')]===0x1f4){logger[_0x7e4d('0x14')](_0x7e4d('0x16'),_0x9f6f81,_0x1db5ee[_0x7e4d('0x14')][_0x7e4d('0x17')]);return _0x162125(_0x1db5ee[_0x7e4d('0x14')][_0x7e4d('0x17')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x9f6f81,_0x1db5ee[_0x7e4d('0x14')]['message']);return _0x57beac(_0x1db5ee[_0x7e4d('0x14')][_0x7e4d('0x17')]);}else{logger[_0x7e4d('0xf')]('MailAccount,\x20%s,\x20%s',_0x9f6f81,'request\x20sent');_0x57beac(_0x1db5ee[_0x7e4d('0x18')][_0x7e4d('0x17')]);}})[_0x7e4d('0x19')](function(_0x5aeb00){logger[_0x7e4d('0x14')]('MailAccount,\x20%s,\x20%s',_0x9f6f81,_0x5aeb00);_0x162125(_0x5aeb00);});});}exports['GetMailAccount']=function(_0x347624){var _0x4cd753=this;return new Promise(function(_0x1908e6,_0x3c4c77){return db['MailAccount']['findAll']({'raw':_0x347624['options']?_0x347624[_0x7e4d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x347624[_0x7e4d('0x1a')]?_0x347624[_0x7e4d('0x1a')][_0x7e4d('0x1b')]||null:null,'attributes':_0x347624[_0x7e4d('0x1a')]?_0x347624[_0x7e4d('0x1a')][_0x7e4d('0x1c')]||null:null,'limit':_0x347624[_0x7e4d('0x1a')]?_0x347624[_0x7e4d('0x1a')][_0x7e4d('0x1d')]||null:null,'include':_0x347624[_0x7e4d('0x1a')]?_0x347624[_0x7e4d('0x1a')][_0x7e4d('0x1e')]?_[_0x7e4d('0x1f')](_0x347624[_0x7e4d('0x1a')][_0x7e4d('0x1e')],function(_0x456793){return{'model':db[_0x456793[_0x7e4d('0x20')]],'as':_0x456793['as'],'attributes':_0x456793[_0x7e4d('0x1c')],'include':_0x456793[_0x7e4d('0x1e')]?_[_0x7e4d('0x1f')](_0x456793[_0x7e4d('0x1e')],function(_0xf6db6f){return{'model':db[_0xf6db6f[_0x7e4d('0x20')]],'as':_0xf6db6f['as'],'attributes':_0xf6db6f[_0x7e4d('0x1c')],'include':_0xf6db6f['include']?_[_0x7e4d('0x1f')](_0xf6db6f[_0x7e4d('0x1e')],function(_0x13c31f){return{'model':db[_0x13c31f[_0x7e4d('0x20')]],'as':_0x13c31f['as'],'attributes':_0x13c31f[_0x7e4d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7e4d('0xe')](function(_0x23fc69){logger[_0x7e4d('0xf')]('GetMailAccount',_0x347624);logger[_0x7e4d('0x10')](_0x7e4d('0x21'),_0x347624,JSON['stringify'](_0x23fc69));_0x1908e6(_0x23fc69);})[_0x7e4d('0x19')](function(_0x460228){logger[_0x7e4d('0x14')](_0x7e4d('0x21'),_0x460228['message'],_0x347624);_0x3c4c77(_0x4cd753[_0x7e4d('0x14')](0x1f4,_0x460228[_0x7e4d('0x17')]));});});};exports[_0x7e4d('0x22')]=function(_0x521612){var _0x11dc7c=this;return new Promise(function(_0x524198,_0x47272a){return db['MailAccount'][_0x7e4d('0x23')]({'raw':_0x521612[_0x7e4d('0x1a')]?_0x521612[_0x7e4d('0x1a')][_0x7e4d('0x24')]===undefined?!![]:![]:!![],'where':_0x521612[_0x7e4d('0x1a')]?_0x521612[_0x7e4d('0x1a')][_0x7e4d('0x1b')]||null:null,'attributes':_0x521612['options']?_0x521612['options'][_0x7e4d('0x1c')]||null:null,'include':_0x521612[_0x7e4d('0x1a')]?_0x521612['options'][_0x7e4d('0x1e')]?_[_0x7e4d('0x1f')](_0x521612[_0x7e4d('0x1a')][_0x7e4d('0x1e')],function(_0x3557d7){return{'model':db[_0x3557d7[_0x7e4d('0x20')]],'as':_0x3557d7['as'],'attributes':_0x3557d7[_0x7e4d('0x1c')],'include':_0x3557d7[_0x7e4d('0x1e')]?_[_0x7e4d('0x1f')](_0x3557d7[_0x7e4d('0x1e')],function(_0x55b1fd){return{'model':db[_0x55b1fd[_0x7e4d('0x20')]],'as':_0x55b1fd['as'],'attributes':_0x55b1fd[_0x7e4d('0x1c')],'include':_0x55b1fd[_0x7e4d('0x1e')]?_[_0x7e4d('0x1f')](_0x55b1fd[_0x7e4d('0x1e')],function(_0x4f8402){return{'model':db[_0x4f8402['model']],'as':_0x4f8402['as'],'attributes':_0x4f8402[_0x7e4d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7e4d('0xe')](function(_0x462787){logger['info'](_0x7e4d('0x22'),_0x521612);logger[_0x7e4d('0x10')](_0x7e4d('0x22'),_0x521612,JSON[_0x7e4d('0x13')](_0x462787));_0x524198(_0x462787);})[_0x7e4d('0x19')](function(_0x540bba){logger[_0x7e4d('0x14')](_0x7e4d('0x22'),_0x540bba[_0x7e4d('0x17')],_0x521612);_0x47272a(_0x11dc7c[_0x7e4d('0x14')](0x1f4,_0x540bba['message']));});});};exports['NotifyMailAccount']=function(_0x5124b9){var _0x3ec154=this;return new Promise(function(_0x23bbb7,_0x2ca77e){var _0x4b7e35={'body':_0x5124b9[_0x7e4d('0x25')],'channel':_0x7e4d('0x26')};var _0x5f3a9f=_[_0x7e4d('0x27')](_[_0x7e4d('0x28')](db[_0x7e4d('0x29')][_0x7e4d('0x2a')]),['createdAt',_0x7e4d('0x2b'),_0x7e4d('0x2c'),_0x7e4d('0x2d')]);var _0x577d9e=![];if(_0x5124b9[_0x7e4d('0x25')]['id']){delete _0x5124b9['body']['id'];}if(_[_0x7e4d('0x2e')](_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x2f')])){return _0x2ca77e(_0x3ec154['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7e4d('0x2e')](_0x5124b9['body'][_0x7e4d('0x25')])||_0x5124b9['body'][_0x7e4d('0x25')]===''){return _0x2ca77e(_0x3ec154[_0x7e4d('0x14')](0x1f4,_0x7e4d('0x30')));}if(_[_0x7e4d('0x2e')](_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x31')])){return _0x2ca77e(_0x3ec154[_0x7e4d('0x14')](0x1f4,_0x7e4d('0x32')+_0x5f3a9f));}if(!_[_0x7e4d('0x33')](_0x5f3a9f,_0x5124b9[_0x7e4d('0x25')]['mapKey'])){return _0x2ca77e(_0x3ec154[_0x7e4d('0x14')](0x1f4,_0x7e4d('0x34')+_0x5f3a9f));}var _0x3fccf4={};_0x3fccf4[_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x31')]]=_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x2f')];return db[_0x7e4d('0x35')][_0x7e4d('0x23')]({'where':{'id':_0x5124b9['account']['id']},'include':[{'model':db[_0x7e4d('0x36')],'as':_0x7e4d('0x37'),'include':[{'model':db[_0x7e4d('0x29')],'as':_0x7e4d('0x38'),'where':_0x3fccf4,'limit':0x1,'order':[['updatedAt',_0x7e4d('0x39')]]}]},{'model':db[_0x7e4d('0x3a')],'as':'Applications'},{'model':db[_0x7e4d('0x3b')],'as':_0x7e4d('0x3c')}]})[_0x7e4d('0xe')](function(_0x402799){if(_0x402799&&_0x402799[_0x7e4d('0x37')]){var _0x611b42=_0x402799[_0x7e4d('0x3d')]({'plain':!![]});_0x4b7e35['account']=_['omit'](_0x611b42,[_0x7e4d('0x3e'),_0x7e4d('0x37')]);_0x4b7e35[_0x7e4d('0x3f')]=_0x611b42[_0x7e4d('0x3e')];_0x4b7e35['list']=_0x611b42[_0x7e4d('0x37')];_0x4b7e35['applications']=_['orderBy'](_0x4b7e35[_0x7e4d('0x3f')],['priority'],[_0x7e4d('0x40')]);if(_0x4b7e35['account']&&_0x4b7e35['account'][_0x7e4d('0x41')]){_0x4b7e35['applications']['push']({'id':0x0,'priority':_0x4b7e35[_0x7e4d('0x3f')][_0x7e4d('0x42')]+0x1,'app':_0x7e4d('0x43'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4b7e35[_0x7e4d('0x44')]['Applications']){delete _0x4b7e35[_0x7e4d('0x44')]['Applications'];}if(_0x4b7e35['account']['List']){delete _0x4b7e35[_0x7e4d('0x44')]['List'];}if(_0x611b42[_0x7e4d('0x37')][_0x7e4d('0x38')][_0x7e4d('0x42')]){return _0x611b42[_0x7e4d('0x37')]['Contacts'][0x0];}var _0x1db84c=_[_0x7e4d('0x45')](_0x5124b9[_0x7e4d('0x25')],{'firstName':_0x5124b9['body'][_0x7e4d('0x2f')],'ListId':_0x611b42['ListId']});_0x1db84c[_0x5124b9[_0x7e4d('0x25')]['mapKey']]=_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x2f')];return db['CmContact'][_0x7e4d('0x46')](_0x1db84c);}else{throw new Error(_0x7e4d('0x47'));}})['then'](function(_0x17b1dc){_0x4b7e35[_0x7e4d('0x48')]=_0x17b1dc;if(_0x17b1dc){if(!_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x49')]){_0x5124b9[_0x7e4d('0x25')]['message'][_0x7e4d('0x49')]=rs[_0x7e4d('0x4a')]()+'\x20'+_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x2f')];}var _0x49d581={'ContactId':_0x17b1dc['id'],'MailAccountId':_0x5124b9[_0x7e4d('0x44')]['id'],'inReplyTo':_0x5124b9[_0x7e4d('0x25')]['message'][_0x7e4d('0x49')],'to':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x2f')],'cc':_0x5124b9['body']['message']['cc'],'subject':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')]['subject'],'attach':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x4b')],'lastMsgAt':moment()[_0x7e4d('0x4c')](_0x7e4d('0x4d')),'lastMsgDirection':'in'};return db[_0x7e4d('0x4e')][_0x7e4d('0x23')]({'where':{'closed':![],'MailAccountId':_0x5124b9[_0x7e4d('0x44')]['id']},'include':[{'model':db[_0x7e4d('0x4f')],'as':_0x7e4d('0x50'),'attributes':['messageId'],'where':{'messageId':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x51')]}}]})[_0x7e4d('0xe')](function(_0x3d5622){if(_0x3d5622){return[_0x3d5622,![]];}return db[_0x7e4d('0x4e')][_0x7e4d('0x46')](_0x49d581)['then'](function(_0x1a4c7e){return[_0x1a4c7e,!![]];});});}else{throw new Error(_0x7e4d('0x52'));}})[_0x7e4d('0x53')](function(_0x5fb0f9,_0x3b36e0){if(_0x5fb0f9){_0x577d9e=_0x3b36e0;if(!_0x3b36e0){return _0x5fb0f9['update']({'inReplyTo':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x49')],'to':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x2f')],'cc':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')]['cc'],'subject':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x54')],'attach':_0x5fb0f9['attach']?_0x5fb0f9[_0x7e4d('0x4b')]:_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x4b')],'substatus':null,'substatusAt':moment()[_0x7e4d('0x4c')](_0x7e4d('0x4d')),'lastMsgAt':moment()[_0x7e4d('0x4c')](_0x7e4d('0x4d')),'lastMsgDirection':'in'});}else{return _0x5fb0f9;}}})['then'](function(_0x5d6c13){_0x4b7e35[_0x7e4d('0x55')]=_0x5d6c13[_0x7e4d('0x3d')]({'plain':!![]});_0x4b7e35['interaction']['created']=_0x577d9e;return db[_0x7e4d('0x4f')]['create']({'body':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x25')],'MailAccountId':_0x5124b9[_0x7e4d('0x44')]['id'],'MailInteractionId':_0x5d6c13['id'],'direction':'in','ContactId':_0x4b7e35[_0x7e4d('0x48')]['id'],'messageId':_0x5124b9['body']['message'][_0x7e4d('0x49')],'from':_0x5124b9['body'][_0x7e4d('0x17')]['from'],'to':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')]['to'],'cc':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')]['cc'],'subject':_0x5124b9['body']['message'][_0x7e4d('0x54')],'attach':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x4b')],'Attachments':_0x5124b9['body'][_0x7e4d('0x17')][_0x7e4d('0x56')],'originTo':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x57')],'originCc':_0x5124b9['body'][_0x7e4d('0x17')]['originCc'],'bcc':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x58')],'ChatWebsiteId':_0x5124b9['body'][_0x7e4d('0x17')][_0x7e4d('0x59')]||null,'originChannel':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')][_0x7e4d('0x5a')]||_0x7e4d('0x5b'),'ChatOfflineMessageId':_0x5124b9[_0x7e4d('0x25')][_0x7e4d('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7e4d('0x5c')],'as':_0x7e4d('0x5d')}]});})[_0x7e4d('0xe')](function(_0x286764){_0x4b7e35[_0x7e4d('0x17')]=_0x286764;if(_0x4b7e35[_0x7e4d('0x55')]['UserId']){return db[_0x7e4d('0x5e')][_0x7e4d('0x23')]({'attributes':['id',_0x7e4d('0x5f')],'where':{'id':_0x4b7e35[_0x7e4d('0x55')][_0x7e4d('0x60')]}})['then'](function(_0x1d3d0f){if(_0x1d3d0f){_0x4b7e35[_0x7e4d('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d3d0f[_0x7e4d('0x5f')]+','+(_0x4b7e35[_0x7e4d('0x44')]['waitForTheAssignedAgent']||0xa),'interval':_0x7e4d('0x61')});}return respondWithRpcPromise(_0x7e4d('0x62'),'startRouting',_0x4b7e35);});}return respondWithRpcPromise(_0x7e4d('0x62'),_0x7e4d('0x63'),_0x4b7e35);})[_0x7e4d('0xe')](function(_0xc74e56){_0x23bbb7(_0xc74e56);})[_0x7e4d('0x19')](function(_0x1a613c){_0x2ca77e(_0x3ec154[_0x7e4d('0x14')](0x1f4,_0x1a613c[_0x7e4d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index cdd9f62..299210e 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 _0xb033=['save','remove','update','emit','removeListener','register','length','./mailAccount.events'];(function(_0x483909,_0x37a61d){var _0x2595df=function(_0x45a5fb){while(--_0x45a5fb){_0x483909['push'](_0x483909['shift']());}};_0x2595df(++_0x37a61d);}(_0xb033,0x9f));var _0x3b03=function(_0x1acb75,_0x4cfb8f){_0x1acb75=_0x1acb75-0x0;var _0xdba49=_0xb033[_0x1acb75];return _0xdba49;};'use strict';var MailAccountEvents=require(_0x3b03('0x0'));var events=[_0x3b03('0x1'),_0x3b03('0x2'),_0x3b03('0x3')];function createListener(_0x3ce571,_0x24bc18){return function(_0x9d8205){_0x24bc18[_0x3b03('0x4')](_0x3ce571,_0x9d8205);};}function removeListener(_0x11f4ce,_0x4555b5){return function(){MailAccountEvents[_0x3b03('0x5')](_0x11f4ce,_0x4555b5);};}exports[_0x3b03('0x6')]=function(_0x2ac9c8){for(var _0x50dbe6=0x0,_0x320f0a=events[_0x3b03('0x7')];_0x50dbe6<_0x320f0a;_0x50dbe6++){var _0x534948=events[_0x50dbe6];var _0x345aee=createListener('mailAccount:'+_0x534948,_0x2ac9c8);MailAccountEvents['on'](_0x534948,_0x345aee);}}; \ No newline at end of file +var _0x74e6=['save','remove','update','emit','removeListener','length','./mailAccount.events'];(function(_0x42f30b,_0x468227){var _0x31d065=function(_0x465d56){while(--_0x465d56){_0x42f30b['push'](_0x42f30b['shift']());}};_0x31d065(++_0x468227);}(_0x74e6,0xed));var _0x674e=function(_0x43c728,_0x50dce3){_0x43c728=_0x43c728-0x0;var _0x491fae=_0x74e6[_0x43c728];return _0x491fae;};'use strict';var MailAccountEvents=require(_0x674e('0x0'));var events=[_0x674e('0x1'),_0x674e('0x2'),_0x674e('0x3')];function createListener(_0x4bbe5b,_0x12cf6c){return function(_0x4c60e8){_0x12cf6c[_0x674e('0x4')](_0x4bbe5b,_0x4c60e8);};}function removeListener(_0x2de17f,_0x202116){return function(){MailAccountEvents[_0x674e('0x5')](_0x2de17f,_0x202116);};}exports['register']=function(_0x26f3d2){for(var _0x4a0500=0x0,_0x16264d=events[_0x674e('0x6')];_0x4a0500<_0x16264d;_0x4a0500++){var _0x2ad27d=events[_0x4a0500];var _0x58379f=createListener('mailAccount:'+_0x2ad27d,_0x26f3d2);MailAccountEvents['on'](_0x2ad27d,_0x58379f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d95868d..9aff5d8 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 _0x9ff2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','update','destroy','multer','util'];(function(_0x4bca06,_0x181cee){var _0x3e291d=function(_0xaa7638){while(--_0xaa7638){_0x4bca06['push'](_0x4bca06['shift']());}};_0x3e291d(++_0x181cee);}(_0x9ff2,0xd0));var _0x29ff=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x9ff2[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x29ff('0x0'));var util=require(_0x29ff('0x1'));var path=require(_0x29ff('0x2'));var timeout=require(_0x29ff('0x3'));var express=require(_0x29ff('0x4'));var router=express[_0x29ff('0x5')]();var fs_extra=require(_0x29ff('0x6'));var auth=require(_0x29ff('0x7'));var interaction=require(_0x29ff('0x8'));var config=require(_0x29ff('0x9'));var controller=require(_0x29ff('0xa'));router['get'](_0x29ff('0xb'),auth[_0x29ff('0xc')](),controller['show']);router['put'](_0x29ff('0xb'),auth[_0x29ff('0xc')](),controller[_0x29ff('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x29ff('0xe')]);module['exports']=router; \ No newline at end of file +var _0x646b=['./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x1fa270,_0x44326f){var _0x3f5957=function(_0x46cb31){while(--_0x46cb31){_0x1fa270['push'](_0x1fa270['shift']());}};_0x3f5957(++_0x44326f);}(_0x646b,0x87));var _0xb646=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0x646b[_0x509c83];return _0x534626;};'use strict';var multer=require('multer');var util=require(_0xb646('0x0'));var path=require(_0xb646('0x1'));var timeout=require(_0xb646('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb646('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb646('0x4'));var controller=require(_0xb646('0x5'));router[_0xb646('0x6')]('/:id',auth[_0xb646('0x7')](),controller[_0xb646('0x8')]);router[_0xb646('0x9')](_0xb646('0xa'),auth['isAuthenticated'](),controller[_0xb646('0xb')]);router['delete'](_0xb646('0xa'),auth[_0xb646('0x7')](),controller[_0xb646('0xc')]);module[_0xb646('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9c4ee46..80fa2e0 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 _0x9222=['INTEGER','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2a2fc8,_0x2b2af8){var _0x321184=function(_0x40f865){while(--_0x40f865){_0x2a2fc8['push'](_0x2a2fc8['shift']());}};_0x321184(++_0x2b2af8);}(_0x9222,0x144));var _0x2922=function(_0x1291f8,_0xf7fdf6){_0x1291f8=_0x1291f8-0x0;var _0x5cd122=_0x9222[_0x1291f8];return _0x5cd122;};'use strict';var Sequelize=require(_0x2922('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2922('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2922('0x2')},'appdata':{'type':Sequelize[_0x2922('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2922('0x4')}}; \ No newline at end of file +var _0x507e=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x30949f,_0xe08c1d){var _0x1cc545=function(_0x4e74f5){while(--_0x4e74f5){_0x30949f['push'](_0x30949f['shift']());}};_0x1cc545(++_0xe08c1d);}(_0x507e,0x1c2));var _0xe507=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x507e[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0xe507('0x0'));module[_0xe507('0x1')]={'priority':{'type':Sequelize[_0xe507('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe507('0x3')],'allowNull':![],'defaultValue':_0xe507('0x4')},'appdata':{'type':Sequelize[_0xe507('0x5')]()},'description':{'type':Sequelize[_0xe507('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe507('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c70e545..089beba 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x5055ef,_0x365395){var _0x37fac3=function(_0x143a52){while(--_0x143a52){_0x5055ef['push'](_0x5055ef['shift']());}};_0x37fac3(++_0x365395);}(_0xac4a,0x13f));var _0xaac4=function(_0x2ee818,_0x2bd04f){_0x2ee818=_0x2ee818-0x0;var _0x5e1d3c=_0xac4a[_0x2ee818];return _0x5e1d3c;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _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(_0x39ff5c,_0x3de001){var _0x1eba54=function(_0x1fcfaa){while(--_0x1fcfaa){_0x39ff5c['push'](_0x39ff5c['shift']());}};_0x1eba54(++_0x3de001);}(_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 e7a9fab..ab19d5a 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 _0xd8c0=['../../config/environment','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x403c57,_0x280a51){var _0x35fa69=function(_0x13a356){while(--_0x13a356){_0x403c57['push'](_0x403c57['shift']());}};_0x35fa69(++_0x280a51);}(_0xd8c0,0x17a));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d8c('0x0'));var util=require('util');var logger=require(_0x0d8c('0x1'))(_0x0d8c('0x2'));var moment=require(_0x0d8c('0x3'));var BPromise=require(_0x0d8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d8c('0x5'));var rimraf=require('rimraf');var config=require(_0x0d8c('0x6'));var attributes=require('./mailApplication.attributes');module[_0x0d8c('0x7')]=function(_0x2c92a0,_0x3bccbf){return _0x2c92a0['define'](_0x0d8c('0x8'),attributes,{'tableName':_0x0d8c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8c('0xa'),'collate':_0x0d8c('0xb')});}; \ No newline at end of file +var _0x4b47=['utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x47a982,_0x1e0302){var _0x2da870=function(_0x2a915a){while(--_0x2a915a){_0x47a982['push'](_0x47a982['shift']());}};_0x2da870(++_0x1e0302);}(_0x4b47,0x1bd));var _0x74b4=function(_0x30b148,_0x10da07){_0x30b148=_0x30b148-0x0;var _0x39b26a=_0x4b47[_0x30b148];return _0x39b26a;};'use strict';var _=require(_0x74b4('0x0'));var util=require(_0x74b4('0x1'));var logger=require(_0x74b4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74b4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74b4('0x4'));var config=require(_0x74b4('0x5'));var attributes=require(_0x74b4('0x6'));module[_0x74b4('0x7')]=function(_0x1f24b6,_0x5b2c9a){return _0x1f24b6[_0x74b4('0x8')](_0x74b4('0x9'),attributes,{'tableName':_0x74b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x74b4('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 18e48d5..0effe69 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 _0xbcc2=['error','code','message','request\x20sent','result','catch','UpdateMailApplication','body','options','where','attributes','stringify','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xbcc2,0x93));var _0x2bcc=function(_0x54813d,_0x101c1f){_0x54813d=_0x54813d-0x0;var _0x561eea=_0xbcc2[_0x54813d];return _0x561eea;};'use strict';var _=require(_0x2bcc('0x0'));var util=require('util');var moment=require(_0x2bcc('0x1'));var BPromise=require('bluebird');var rs=require(_0x2bcc('0x2'));var fs=require('fs');var Redis=require(_0x2bcc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2bcc('0x4'))(_0x2bcc('0x5'));var config=require(_0x2bcc('0x6'));var jayson=require(_0x2bcc('0x7'));var client=jayson['client'][_0x2bcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x281d82,_0x1eef23,_0x3e2446){return new BPromise(function(_0x31af6a,_0x5e14eb){return client[_0x2bcc('0x9')](_0x281d82,_0x3e2446)[_0x2bcc('0xa')](function(_0x1b5f75){logger[_0x2bcc('0xb')](_0x2bcc('0xc'),_0x1eef23,'request\x20sent');logger[_0x2bcc('0xd')](_0x2bcc('0xe'),_0x1eef23,'request\x20sent',JSON['stringify'](_0x1b5f75));if(_0x1b5f75[_0x2bcc('0xf')]){if(_0x1b5f75[_0x2bcc('0xf')][_0x2bcc('0x10')]===0x1f4){logger['error'](_0x2bcc('0xc'),_0x1eef23,_0x1b5f75['error'][_0x2bcc('0x11')]);return _0x5e14eb(_0x1b5f75[_0x2bcc('0xf')][_0x2bcc('0x11')]);}logger[_0x2bcc('0xf')]('MailApplication,\x20%s,\x20%s',_0x1eef23,_0x1b5f75['error'][_0x2bcc('0x11')]);return _0x31af6a(_0x1b5f75[_0x2bcc('0xf')]['message']);}else{logger[_0x2bcc('0xb')](_0x2bcc('0xc'),_0x1eef23,_0x2bcc('0x12'));_0x31af6a(_0x1b5f75[_0x2bcc('0x13')][_0x2bcc('0x11')]);}})[_0x2bcc('0x14')](function(_0x5378c9){logger[_0x2bcc('0xf')](_0x2bcc('0xc'),_0x1eef23,_0x5378c9);_0x5e14eb(_0x5378c9);});});}exports[_0x2bcc('0x15')]=function(_0x5f6a59){var _0x2b4f73=this;return new Promise(function(_0x5dc187,_0x4aa7f5){return db['MailApplication']['update'](_0x5f6a59[_0x2bcc('0x16')],{'raw':_0x5f6a59[_0x2bcc('0x17')]?_0x5f6a59[_0x2bcc('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f6a59[_0x2bcc('0x17')]?_0x5f6a59[_0x2bcc('0x17')][_0x2bcc('0x18')]||null:null,'attributes':_0x5f6a59[_0x2bcc('0x17')]?_0x5f6a59[_0x2bcc('0x17')][_0x2bcc('0x19')]||null:null,'limit':_0x5f6a59[_0x2bcc('0x17')]?_0x5f6a59[_0x2bcc('0x17')]['limit']||null:null})[_0x2bcc('0xa')](function(_0x30bc5b){logger[_0x2bcc('0xb')](_0x2bcc('0x15'),_0x5f6a59);logger['debug']('UpdateMailApplication',_0x5f6a59,JSON[_0x2bcc('0x1a')](_0x30bc5b));_0x5dc187(_0x30bc5b);})[_0x2bcc('0x14')](function(_0x267937){logger[_0x2bcc('0xf')](_0x2bcc('0x15'),_0x267937['message'],_0x5f6a59);_0x4aa7f5(_0x2b4f73['error'](0x1f4,_0x267937['message']));});});}; \ No newline at end of file +var _0x0494=['jayson/promise','client','http','request','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','body','options','where','limit','info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x519378,_0x6bec08){var _0x278456=function(_0x51980e){while(--_0x51980e){_0x519378['push'](_0x519378['shift']());}};_0x278456(++_0x6bec08);}(_0x0494,0x1ab));var _0x4049=function(_0xaa19d3,_0x462ce9){_0xaa19d3=_0xaa19d3-0x0;var _0x52f187=_0x0494[_0xaa19d3];return _0x52f187;};'use strict';var _=require(_0x4049('0x0'));var util=require(_0x4049('0x1'));var moment=require(_0x4049('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4049('0x3'));var db=require(_0x4049('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4049('0x5'))(_0x4049('0x6'));var config=require(_0x4049('0x7'));var jayson=require(_0x4049('0x8'));var client=jayson[_0x4049('0x9')][_0x4049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25c62c,_0x35ac2a,_0x6e97ca){return new BPromise(function(_0x1658a4,_0x47800a){return client[_0x4049('0xb')](_0x25c62c,_0x6e97ca)[_0x4049('0xc')](function(_0x121296){logger['info']('MailApplication,\x20%s,\x20%s',_0x35ac2a,_0x4049('0xd'));logger[_0x4049('0xe')](_0x4049('0xf'),_0x35ac2a,'request\x20sent',JSON[_0x4049('0x10')](_0x121296));if(_0x121296[_0x4049('0x11')]){if(_0x121296[_0x4049('0x11')]['code']===0x1f4){logger[_0x4049('0x11')](_0x4049('0x12'),_0x35ac2a,_0x121296[_0x4049('0x11')][_0x4049('0x13')]);return _0x47800a(_0x121296[_0x4049('0x11')]['message']);}logger['error'](_0x4049('0x12'),_0x35ac2a,_0x121296[_0x4049('0x11')][_0x4049('0x13')]);return _0x1658a4(_0x121296['error'][_0x4049('0x13')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x35ac2a,_0x4049('0xd'));_0x1658a4(_0x121296[_0x4049('0x14')][_0x4049('0x13')]);}})[_0x4049('0x15')](function(_0x527a05){logger[_0x4049('0x11')](_0x4049('0x12'),_0x35ac2a,_0x527a05);_0x47800a(_0x527a05);});});}exports[_0x4049('0x16')]=function(_0x56d5d3){var _0x2de699=this;return new Promise(function(_0xc69b66,_0x4cf41a){return db[_0x4049('0x17')]['update'](_0x56d5d3[_0x4049('0x18')],{'raw':_0x56d5d3[_0x4049('0x19')]?_0x56d5d3[_0x4049('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56d5d3[_0x4049('0x19')]?_0x56d5d3['options'][_0x4049('0x1a')]||null:null,'attributes':_0x56d5d3[_0x4049('0x19')]?_0x56d5d3[_0x4049('0x19')]['attributes']||null:null,'limit':_0x56d5d3['options']?_0x56d5d3[_0x4049('0x19')][_0x4049('0x1b')]||null:null})[_0x4049('0xc')](function(_0x78c17c){logger[_0x4049('0x1c')](_0x4049('0x16'),_0x56d5d3);logger[_0x4049('0xe')]('UpdateMailApplication',_0x56d5d3,JSON['stringify'](_0x78c17c));_0xc69b66(_0x78c17c);})[_0x4049('0x15')](function(_0x187d1c){logger['error']('UpdateMailApplication',_0x187d1c[_0x4049('0x13')],_0x56d5d3);_0x4cf41a(_0x2de699['error'](0x1f4,_0x187d1c[_0x4049('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f175952..d690947 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 _0x9592=['../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','mailinteraction:destroy','destroy','delete','exports','express','Router'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x9592,0x127));var _0x2959=function(_0x42b7ab,_0x50af64){_0x42b7ab=_0x42b7ab-0x0;var _0x4ce843=_0x9592[_0x42b7ab];return _0x4ce843;};'use strict';var express=require(_0x2959('0x0'));var router=express[_0x2959('0x1')]();var auth=require(_0x2959('0x2'));var interaction=require(_0x2959('0x3'));var controller=require(_0x2959('0x4'));router[_0x2959('0x5')]('/',auth[_0x2959('0x6')](),controller[_0x2959('0x7')]);router[_0x2959('0x5')](_0x2959('0x8'),auth[_0x2959('0x6')](),controller[_0x2959('0x9')]);router[_0x2959('0x5')](_0x2959('0xa'),auth[_0x2959('0x6')](),controller['show']);router[_0x2959('0x5')](_0x2959('0xb'),auth[_0x2959('0x6')](),controller['getMessages']);router[_0x2959('0x5')](_0x2959('0xc'),auth[_0x2959('0x6')](),controller[_0x2959('0xd')]);router[_0x2959('0xe')]('/',auth[_0x2959('0x6')](),controller[_0x2959('0xf')]);router['post'](_0x2959('0xb'),auth[_0x2959('0x6')](),controller[_0x2959('0x10')]);router[_0x2959('0xe')](_0x2959('0x11'),auth[_0x2959('0x6')](),interaction[_0x2959('0x12')](_0x2959('0x13'),'mailinteraction:addtags'),controller[_0x2959('0x14')]);router[_0x2959('0x15')]('/:id',auth[_0x2959('0x6')](),interaction[_0x2959('0x12')](_0x2959('0x13'),_0x2959('0x16')),controller['update']);router['delete'](_0x2959('0xa'),auth['isAuthenticated'](),interaction[_0x2959('0x12')](_0x2959('0x13'),_0x2959('0x17')),controller[_0x2959('0x18')]);router[_0x2959('0x19')](_0x2959('0x11'),auth[_0x2959('0x6')](),controller['removeTags']);module[_0x2959('0x1a')]=router; \ No newline at end of file +var _0x1ceb=['delete','mail','mailinteraction:destroy','destroy','removeTags','exports','express','Router','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','create','post','addMessage','/:id/tags','mailinteraction:addtags','put','tracked'];(function(_0x10e7cf,_0x2ec348){var _0x276901=function(_0x299899){while(--_0x299899){_0x10e7cf['push'](_0x10e7cf['shift']());}};_0x276901(++_0x2ec348);}(_0x1ceb,0x15f));var _0xb1ce=function(_0x415b1c,_0x1f37e7){_0x415b1c=_0x415b1c-0x0;var _0x70a4b6=_0x1ceb[_0x415b1c];return _0x70a4b6;};'use strict';var express=require(_0xb1ce('0x0'));var router=express[_0xb1ce('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xb1ce('0x2'));router[_0xb1ce('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb1ce('0x3')](_0xb1ce('0x4'),auth[_0xb1ce('0x5')](),controller[_0xb1ce('0x6')]);router[_0xb1ce('0x3')](_0xb1ce('0x7'),auth[_0xb1ce('0x5')](),controller['show']);router[_0xb1ce('0x3')](_0xb1ce('0x8'),auth['isAuthenticated'](),controller[_0xb1ce('0x9')]);router[_0xb1ce('0x3')]('/:id/download',auth[_0xb1ce('0x5')](),controller['download']);router['post']('/',auth[_0xb1ce('0x5')](),controller[_0xb1ce('0xa')]);router[_0xb1ce('0xb')](_0xb1ce('0x8'),auth[_0xb1ce('0x5')](),controller[_0xb1ce('0xc')]);router[_0xb1ce('0xb')](_0xb1ce('0xd'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xb1ce('0xe')),controller['addTags']);router[_0xb1ce('0xf')](_0xb1ce('0x7'),auth[_0xb1ce('0x5')](),interaction[_0xb1ce('0x10')]('mail','mailinteraction:update'),controller['update']);router[_0xb1ce('0x11')](_0xb1ce('0x7'),auth[_0xb1ce('0x5')](),interaction['tracked'](_0xb1ce('0x12'),_0xb1ce('0x13')),controller[_0xb1ce('0x14')]);router['delete'](_0xb1ce('0xd'),auth[_0xb1ce('0x5')](),controller[_0xb1ce('0x15')]);module[_0xb1ce('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9cc3a21..e434cc5 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 _0x3dd1=['TEXT','long','out','ENUM','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x7dd16a,_0x3dbf26){var _0x12ce84=function(_0x3d581d){while(--_0x3d581d){_0x7dd16a['push'](_0x7dd16a['shift']());}};_0x12ce84(++_0x3dbf26);}(_0x3dd1,0x112));var _0x13dd=function(_0x3a2877,_0x3be85e){_0x3a2877=_0x3a2877-0x0;var _0x2c7f78=_0x3dd1[_0x3a2877];return _0x2c7f78;};'use strict';var Sequelize=require(_0x13dd('0x0'));var iconv=require(_0x13dd('0x1'));module[_0x13dd('0x2')]={'closed':{'type':Sequelize[_0x13dd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x13dd('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x13dd('0x5')]},'thirdDisposition':{'type':Sequelize[_0x13dd('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x13dd('0x6')](_0x13dd('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x13dd('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x13dd('0x4')]},'substatus':{'type':Sequelize[_0x13dd('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x13dd('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x13dd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x13dd('0x9')]('in',_0x13dd('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x13dd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f0a=['BOOLEAN','ENUM','out','iconv','exports','DATE','STRING','TEXT'];(function(_0x289210,_0x59d1be){var _0x4547df=function(_0x4de743){while(--_0x4de743){_0x289210['push'](_0x289210['shift']());}};_0x4547df(++_0x59d1be);}(_0x9f0a,0x9b));var _0xa9f0=function(_0x4ab84b,_0x503754){_0x4ab84b=_0x4ab84b-0x0;var _0x2eac97=_0x9f0a[_0x4ab84b];return _0x2eac97;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xa9f0('0x0'));module[_0xa9f0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa9f0('0x2')]},'disposition':{'type':Sequelize[_0xa9f0('0x3')]},'secondDisposition':{'type':Sequelize[_0xa9f0('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa9f0('0x3')]},'inReplyTo':{'type':Sequelize[_0xa9f0('0x3')](0x1fe)},'to':{'type':Sequelize[_0xa9f0('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xa9f0('0x4')]()},'attach':{'type':Sequelize[_0xa9f0('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa9f0('0x2')]},'substatus':{'type':Sequelize[_0xa9f0('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xa9f0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa9f0('0x6')]('in',_0xa9f0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa9f0('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa9f0('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ba0d490..2992978 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 _0xfd2e=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','SELECT','clone','contactName','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','rows','show','params','rawAttributes','include','options','create','body','describe','addMessage','omit','ids','getMessages','nolimit','MailInteractionId','format','includeAll','inlineCss','addTags','spread','findAll','emit','removeTags','download','unix','join','root','files','transcript-%d-%s.zip','attachments','Messages','bcc','subject','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','bluebird','path','lodash','squel','juice','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','answered','total','closed','UserId','waiting','talking','unmanaged','index','MailInteraction','key','model','query','filters','intersection','fields','attributes','order','sort','where','select','field','color','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','u.id\x20=\x20ui.UserId','mail_interactions','left_join','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','start','buildExpression','type','keys','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfd2e,0x6e));var _0xefd2=function(_0x1fe5fb,_0x1d24c5){_0x1fe5fb=_0x1fe5fb-0x0;var _0x2c98ad=_0xfd2e[_0x1fe5fb];return _0x2c98ad;};'use strict';var emlformat=require(_0xefd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefd2('0x1'));var moment=require('moment');var BPromise=require(_0xefd2('0x2'));var util=require('util');var path=require(_0xefd2('0x3'));var fs=require('fs');var _=require(_0xefd2('0x4'));var squel=require(_0xefd2('0x5'));var juice=require(_0xefd2('0x6'));var Redis=require(_0xefd2('0x7'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0xefd2('0x8'))('api');var config=require('../../config/environment');var db=require(_0xefd2('0x9'))['db'];var htmlEntities=require('html-entities');config[_0xefd2('0xa')]=_[_0xefd2('0xb')](config[_0xefd2('0xa')],{'host':_0xefd2('0xc'),'port':0x18eb});var socket=require(_0xefd2('0xd'))(new Redis(config[_0xefd2('0xa')]));require(_0xefd2('0xe'))['register'](socket);function respondWithStatusCode(_0x2d8eff,_0x349eea){_0x349eea=_0x349eea||0xcc;return function(_0xd765f7){if(_0xd765f7){return _0x2d8eff[_0xefd2('0xf')](_0x349eea);}return _0x2d8eff[_0xefd2('0x10')](_0x349eea)[_0xefd2('0x11')]();};}function respondWithResult(_0x11aab0,_0x2f1472){_0x2f1472=_0x2f1472||0xc8;return function(_0x53d09b){if(_0x53d09b){return _0x11aab0['status'](_0x2f1472)[_0xefd2('0x12')](_0x53d09b);}};}function respondWithFilteredResult(_0x4ddfd2,_0x58effd){return function(_0x87493c){if(_0x87493c){var _0x2b4d24=typeof _0x58effd[_0xefd2('0x13')]===_0xefd2('0x14')&&typeof _0x58effd[_0xefd2('0x15')]==='undefined';var _0x1a35b7=_0x87493c[_0xefd2('0x16')];var _0x2e706a=_0x2b4d24?0x0:_0x58effd[_0xefd2('0x13')];var _0x293c78=_0x2b4d24?_0x87493c[_0xefd2('0x16')]:_0x58effd['offset']+_0x58effd['limit'];var _0xd75a31;if(_0x293c78>=_0x1a35b7){_0x293c78=_0x1a35b7;_0xd75a31=0xc8;}else{_0xd75a31=0xce;}_0x4ddfd2[_0xefd2('0x10')](_0xd75a31);return _0x4ddfd2[_0xefd2('0x17')](_0xefd2('0x18'),_0x2e706a+'-'+_0x293c78+'/'+_0x1a35b7)[_0xefd2('0x12')](_0x87493c);}return null;};}function saveUpdates(_0x5080a8){return function(_0x129ada){if(_0x129ada){return _0x129ada[_0xefd2('0x19')](_0x5080a8)[_0xefd2('0x1a')](function(_0x11baea){return _0x11baea;});}return null;};}function removeEntity(_0x4d2e38){return function(_0x115ad8){if(_0x115ad8){return _0x115ad8[_0xefd2('0x1b')]()[_0xefd2('0x1a')](function(){_0x4d2e38[_0xefd2('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x292b2d){return function(_0xb5b076){if(!_0xb5b076){_0x292b2d[_0xefd2('0xf')](0x194);}return _0xb5b076;};}function handleError(_0x25196e,_0x2aaa1b){_0x2aaa1b=_0x2aaa1b||0x1f4;return function(_0x3cbff0){logger[_0xefd2('0x1c')](_0x3cbff0['stack']);if(_0x3cbff0['name']){delete _0x3cbff0[_0xefd2('0x1d')];}_0x25196e[_0xefd2('0x10')](_0x2aaa1b)[_0xefd2('0x1e')](_0x3cbff0);};}function getInteractionUsers(_0x16421b,_0x1d294c){return new BPromise(function(_0x470684,_0x42e4e6){try{if(_0x1d294c[_0x16421b['id']]){_0x16421b[_0xefd2('0x1f')]=_[_0xefd2('0x20')](_0x1d294c[_0x16421b['id']],function(_0x519d9){return{'id':_0x519d9['id'],'fullname':_0x519d9[_0xefd2('0x21')]};});}}catch(_0x50dc75){_0x42e4e6(_0x50dc75);}_0x470684(_0x16421b);});}function getInteractionTags(_0x348019,_0x37feb6){return new BPromise(function(_0x127e4f,_0x398ce2){try{if(_0x348019[_0xefd2('0x22')]){_0x348019[_0xefd2('0x23')]=[];_0x348019[_0xefd2('0x22')]['split'](',')[_0xefd2('0x24')](function(_0x12a0f5){_0x348019[_0xefd2('0x23')][_0xefd2('0x25')](_0x37feb6[_0x12a0f5]);});}delete _0x348019[_0xefd2('0x22')];}catch(_0x50b245){_0x398ce2(_0x50b245);}_0x127e4f(_0x348019);});}function getLastMessageText(_0x315f58){return new BPromise(function(_0x328714,_0x573197){return db[_0xefd2('0x26')][_0xefd2('0x27')]({'where':{'$and':[{'MailInteractionId':_0x315f58['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xefd2('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xefd2('0x29')],'order':_0xefd2('0x2a'),'raw':!![]})[_0xefd2('0x1a')](function(_0x5b9f03){if(_0x5b9f03&&_0x5b9f03[_0xefd2('0x29')]){_0x315f58[_0xefd2('0x2b')]=_[_0xefd2('0x2c')](_0x5b9f03[_0xefd2('0x29')]);}_0x328714(_0x315f58);})['catch'](function(_0x25644c){_0x573197(_0x25644c);});});}function updateMailInteraction(_0x329737,_0x36f439,_0x25d94d,_0x2ffbf3){return new BPromise(function(_0x37ff34,_0x2712cc){return getInteractionUsers(_0x329737,_0x25d94d)[_0xefd2('0x1a')](function(_0x1d5fad){return getInteractionTags(_0x1d5fad,_0x36f439);})[_0xefd2('0x1a')](function(_0x384395){return getStateInteraction(_0x384395);})['then'](function(_0x20b1dd){if(_0x2ffbf3){_0x37ff34(getLastMessageText(_0x20b1dd));}else{_0x37ff34(_0x20b1dd);}})[_0xefd2('0x2d')](function(_0x4fdba9){_0x2712cc(_0x4fdba9);});});}function getStateInteraction(_0x38ed70){return new BPromise(function(_0xd54536){_0x38ed70['waiting']=0x0;_0x38ed70['talking']=0x0;_0x38ed70[_0xefd2('0x2e')]=0x0;_0x38ed70['unmanaged']=0x0;_0x38ed70[_0xefd2('0x2f')]=0x0;if(!_0x38ed70[_0xefd2('0x30')]&&!_0x38ed70[_0xefd2('0x31')]){_0x38ed70[_0xefd2('0x32')]+=0x1;}if(!_0x38ed70[_0xefd2('0x30')]&&_0x38ed70['UserId']){_0x38ed70[_0xefd2('0x33')]+=0x1;if(_0x38ed70[_0xefd2('0x32')]){_0x38ed70[_0xefd2('0x32')]-=0x1;}}if(_0x38ed70[_0xefd2('0x30')]&&_0x38ed70[_0xefd2('0x31')]){_0x38ed70[_0xefd2('0x2e')]+=0x1;if(_0x38ed70[_0xefd2('0x33')]){_0x38ed70[_0xefd2('0x33')]-=0x1;}}if(_0x38ed70[_0xefd2('0x30')]&&!_0x38ed70[_0xefd2('0x31')]){_0x38ed70[_0xefd2('0x34')]+=0x1;if(_0x38ed70[_0xefd2('0x32')]){_0x38ed70[_0xefd2('0x32')]-=0x1;}}_0x38ed70[_0xefd2('0x2f')]+=0x1;_0xd54536(_0x38ed70);});}exports[_0xefd2('0x35')]=function(_0x40f773,_0x2f0ba9){var _0x1d3204={},_0x155772={},_0x16612d={'count':0x0,'rows':[]};var _0x3b61bd=_['map'](db[_0xefd2('0x36')]['rawAttributes'],function(_0x46495b){return{'name':_0x46495b['fieldName'],'type':_0x46495b['type'][_0xefd2('0x37')]};});_0x155772[_0xefd2('0x38')]=_[_0xefd2('0x20')](_0x3b61bd,_0xefd2('0x1d'));_0x155772[_0xefd2('0x39')]=_['keys'](_0x40f773['query']);_0x155772[_0xefd2('0x3a')]=_['intersection'](_0x155772[_0xefd2('0x38')],_0x155772[_0xefd2('0x39')]);_0x1d3204['attributes']=_[_0xefd2('0x3b')](_0x155772[_0xefd2('0x38')],qs[_0xefd2('0x3c')](_0x40f773[_0xefd2('0x39')]['fields']));_0x1d3204[_0xefd2('0x3d')]=_0x1d3204[_0xefd2('0x3d')]['length']?_0x1d3204[_0xefd2('0x3d')]:_0x155772['model'];if(!_0x40f773[_0xefd2('0x39')]['hasOwnProperty']('nolimit')){_0x1d3204[_0xefd2('0x15')]=qs[_0xefd2('0x15')](_0x40f773['query'][_0xefd2('0x15')]);_0x1d3204['offset']=qs[_0xefd2('0x13')](_0x40f773['query'][_0xefd2('0x13')]);}_0x1d3204[_0xefd2('0x3e')]=qs[_0xefd2('0x3f')](_0x40f773['query'][_0xefd2('0x3f')]);_0x1d3204[_0xefd2('0x40')]=qs['filters'](_['pick'](_0x40f773[_0xefd2('0x39')],_0x155772[_0xefd2('0x3a')]),_0x3b61bd);var _0x4fad61=[];var _0x212875=squel[_0xefd2('0x41')]()[_0xefd2('0x42')]('id')[_0xefd2('0x42')]('name')[_0xefd2('0x42')](_0xefd2('0x43'))[_0xefd2('0x44')]('tools_tags');var _0x1b85dd=squel['select']()[_0xefd2('0x42')]('u.id')[_0xefd2('0x42')](_0xefd2('0x45'))['field'](_0xefd2('0x46'))[_0xefd2('0x44')](_0xefd2('0x47'),'ui')['left_join']('users','u',_0xefd2('0x48'));var _0x5c4606=squel[_0xefd2('0x41')]()[_0xefd2('0x44')](_0xefd2('0x49'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xefd2('0x4a')](_0xefd2('0x4b'),'o',_0xefd2('0x4c'))[_0xefd2('0x4a')](_0xefd2('0x4d'),'a','a.id\x20=\x20i.MailAccountId')[_0xefd2('0x4a')](_0xefd2('0x4e'),'me',_0xefd2('0x4f'))[_0xefd2('0x4a')](_0xefd2('0x50'),'it',_0xefd2('0x51'))[_0xefd2('0x4a')](_0xefd2('0x52'),'t',_0xefd2('0x53'));var _0x13d657=squel[_0xefd2('0x54')]();var _0x40a8be=[];var _0x1445ed=squel[_0xefd2('0x54')]();var _0x3343a5;if(_0x40f773[_0xefd2('0x39')][_0xefd2('0x55')]){_0x3343a5=as[_0xefd2('0x56')](_0x40f773[_0xefd2('0x39')]['search']);var _0x11a00f=_0x3343a5[_0xefd2('0x57')];for(var _0x21fbe8=0x0;_0x21fbe8<_0x3343a5[_0xefd2('0x58')]['length'];_0x21fbe8++){var _0x2d9c3b=_0x3343a5[_0xefd2('0x58')][_0x21fbe8];var _0x1037c4='i';var _0x421906=_[_0xefd2('0x59')](_0x3b61bd,[_0xefd2('0x1d'),_0x2d9c3b[_0xefd2('0x42')]]);if(!_0x421906){switch(_0x2d9c3b[_0xefd2('0x42')]){case _0xefd2('0x5a'):if(_0x2d9c3b[_0xefd2('0x5b')]==0x1){_0x5c4606[_0xefd2('0x5c')]('`'+_0x2d9c3b['field']+_0xefd2('0x5d'));}else{_0x5c4606[_0xefd2('0x5c')]('`'+_0x2d9c3b[_0xefd2('0x42')]+_0xefd2('0x5e'));}break;case _0xefd2('0x5f'):if(_0x2d9c3b[_0xefd2('0x60')]===_0xefd2('0x61')){if(_0x2d9c3b[_0xefd2('0x5b')][_0xefd2('0x62')]('\x20')[_0xefd2('0x63')]>0x1){_0x13d657[_0x11a00f](_0xefd2('0x64'),qs[_0xefd2('0x65')](_0x2d9c3b[_0xefd2('0x5b')]),null);}else{var _0x38b642='%'+_0x2d9c3b['value']+'%';_0x13d657[_0x11a00f](_0xefd2('0x66'),_0x38b642,_0x38b642,_0x38b642);}}else{_0x421906=_[_0xefd2('0x59')](_0x3b61bd,['name',_0xefd2('0x67')]);_0x2d9c3b[_0xefd2('0x42')]=_0xefd2('0x67');_0x22f531=as['buildExpression'](_0x1037c4,_0x421906['type'],_0x2d9c3b);_0x13d657[_0x11a00f](_0x22f531[_0xefd2('0x68')],_0x22f531[_0xefd2('0x5b')]['start'],_0x22f531[_0xefd2('0x5b')][_0xefd2('0x11')]);}break;case _0xefd2('0x69'):var _0x5cb14c=_0x2d9c3b['value'][_0xefd2('0x62')](',')[_0xefd2('0x20')](function(_0x559c64){return Number(_0x559c64);});_0x5cb14c[_0xefd2('0x24')](function(_0x2c6273){_0x1445ed['or'](_0xefd2('0x6a'),'%,'+_0x2c6273+',%');});_0x40a8be=_[_0xefd2('0x6b')](_0x40a8be,_0x5cb14c);break;case'User':if(_0x2d9c3b[_0xefd2('0x60')]==='$substring'){_0x13d657[_0x11a00f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d9c3b['value']+'%',null);}else{_0x421906=_[_0xefd2('0x59')](_0x3b61bd,[_0xefd2('0x1d'),_0xefd2('0x31')]);_0x2d9c3b['field']='UserId';_0x22f531=as['buildExpression'](_0x1037c4,_0x421906['type'],_0x2d9c3b);_0x13d657[_0x11a00f](_0x22f531[_0xefd2('0x68')],_0x22f531[_0xefd2('0x5b')][_0xefd2('0x6c')],_0x22f531[_0xefd2('0x5b')][_0xefd2('0x11')]);}break;case _0xefd2('0x29'):_0x22f531=as['buildExpression']('me',null,_0x2d9c3b);_0x13d657[_0x11a00f](_0x22f531[_0xefd2('0x68')],_0x22f531[_0xefd2('0x5b')]['start'],_0x22f531[_0xefd2('0x5b')]['end']);break;}}else{var _0x22f531=as[_0xefd2('0x6d')](_0x1037c4,_0x421906[_0xefd2('0x6e')],_0x2d9c3b);_0x13d657[_0x11a00f](_0x22f531['text'],_0x22f531['value']['start'],_0x22f531['value'][_0xefd2('0x11')]);}}}else{var _0x267d79=_(_0x40f773[_0xefd2('0x39')])[_0xefd2('0x6f')]()[_0xefd2('0x20')](function(_0x921366){return _['some'](_0x3b61bd,[_0xefd2('0x1d'),_0x921366])?_0x921366:undefined;})[_0xefd2('0x70')]()['value']();if(!_[_0xefd2('0x71')](_0x267d79)){_0x267d79[_0xefd2('0x24')](function(_0xdbcd5e){if(_0xdbcd5e===_0xefd2('0x72')){_0x5c4606[_0xefd2('0x40')](_0xefd2('0x73'),[][_0xefd2('0x74')](_0x40f773[_0xefd2('0x39')][_0xdbcd5e]));}else if(_0xdbcd5e===_0xefd2('0x75')){var _0x3756b4=JSON[_0xefd2('0x76')](_0x40f773[_0xefd2('0x39')][_0xdbcd5e])[_0xefd2('0x77')];var _0x4d90ce=JSON[_0xefd2('0x76')](_0x40f773[_0xefd2('0x39')][_0xdbcd5e])[_0xefd2('0x78')];_0x5c4606['where'](_0xefd2('0x79'),_0x3756b4,_0x4d90ce);}else{if(_0x40f773[_0xefd2('0x39')][_0xdbcd5e]===_0xefd2('0x7a')){_0x5c4606[_0xefd2('0x40')]('i.'+_0xdbcd5e+_0xefd2('0x7b'));}else{_0x5c4606[_0xefd2('0x40')]('i.'+_0xdbcd5e+_0xefd2('0x7c'),_0x40f773[_0xefd2('0x39')][_0xdbcd5e]);}}});}if(_0x40f773[_0xefd2('0x39')]['read']){if(_0x40f773[_0xefd2('0x39')][_0xefd2('0x7d')]==0x1){_0x5c4606[_0xefd2('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x5c4606[_0xefd2('0x5c')](_0xefd2('0x7e'));}}if(_0x40f773[_0xefd2('0x39')]['tag']){_0x40a8be=_[_0xefd2('0x7f')](_0x40f773[_0xefd2('0x39')]['tag'])?_0x40f773['query'][_0xefd2('0x80')]:new Array(_0x40f773['query'][_0xefd2('0x80')]);_0x40a8be['forEach'](function(_0x426849){_0x1445ed['or'](_0xefd2('0x6a'),'%,'+_0x426849+',%');});}if(_0x40f773[_0xefd2('0x39')][_0xefd2('0x81')]){var _0x24bd09=_0x40f773['query'][_0xefd2('0x81')][_0xefd2('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xefd2('0x83')](_0x24bd09)){_0x13d657['or'](_0xefd2('0x84'),_0x24bd09+'%');}else if(qs[_0xefd2('0x85')](_0x24bd09)){_0x13d657['or']('c.email\x20LIKE\x20?',_0x24bd09+'%');}else{_0x13d657['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xefd2('0x65')](_0x24bd09))['or'](_0xefd2('0x86'),qs[_0xefd2('0x65')](_0x24bd09));}}}_0x5c4606[_0xefd2('0x40')](_0x13d657);_0x5c4606['group'](_0xefd2('0x87'));var _0x3695a6={'type':db[_0xefd2('0x88')]['QueryTypes'][_0xefd2('0x89')],'raw':!![]};var _0x74ee72=_0x5c4606[_0xefd2('0x8a')]();_0x74ee72['field'](_0xefd2('0x87'));_0x74ee72[_0xefd2('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xefd2('0x5a'));if(_0x1d3204[_0xefd2('0x3e')]){_0x1d3204[_0xefd2('0x3e')][_0xefd2('0x24')](function(_0x535e8e){var _0x1ad0a5=_0x535e8e[0x0]===_0xefd2('0x8b')?_0x535e8e[0x0]:'i.'+_0x535e8e[0x0];_0x5c4606[_0xefd2('0x3e')](_0x1ad0a5,_0x535e8e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xefd2('0x71')](_0x40a8be)){_0x5c4606[_0xefd2('0x5c')](_0x1445ed);_0x74ee72[_0xefd2('0x40')](_0xefd2('0x8c'),_0x40a8be);}BPromise['resolve']()[_0xefd2('0x1a')](function(){if(!_0x3343a5){if(_0x40f773['query'][_0xefd2('0x72')])return;_0x74ee72['where'](_0xefd2('0x8d'));_0x5c4606[_0xefd2('0x40')](_0xefd2('0x8d'));return;}if(_0x40f773[_0xefd2('0x8e')][_0xefd2('0x8f')]!==_0xefd2('0x90'))return;return _0x40f773[_0xefd2('0x8e')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xefd2('0x1a')](function(_0x31c88e){if(_['isEmpty'](_0x31c88e)){_0x74ee72['where'](_0xefd2('0x91'));_0x5c4606['where'](_0xefd2('0x91'));}else{_0x74ee72['where'](_0xefd2('0x73'),_[_0xefd2('0x20')](_0x31c88e,'id'));_0x5c4606[_0xefd2('0x40')](_0xefd2('0x73'),_[_0xefd2('0x20')](_0x31c88e,'id'));}});})[_0xefd2('0x1a')](function(){if(_0x40f773[_0xefd2('0x8e')][_0xefd2('0x8f')]==='agent'&&!_0x3343a5&&!_0x40f773['query'][_0xefd2('0x72')])return[];return db[_0xefd2('0x92')][_0xefd2('0x39')](_0x74ee72[_0xefd2('0x93')](),_0x3695a6);})[_0xefd2('0x1a')](function(_0x57f32b){_0x16612d[_0xefd2('0x16')]=_0x57f32b['length'];if(_0x16612d[_0xefd2('0x16')]===0x0)return[];return db[_0xefd2('0x92')][_0xefd2('0x39')](_0x212875[_0xefd2('0x93')](),_0x3695a6)[_0xefd2('0x1a')](function(_0x319475){_0x4fad61=_[_0xefd2('0x94')](_0x319475,'id');_0x3695a6=_[_0xefd2('0x95')](_0x3695a6,{'model':db[_0xefd2('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40f773[_0xefd2('0x39')][_0xefd2('0x3c')]){_0x1d3204['attributes'][_0xefd2('0x24')](function(_0x2c87ce){_0x5c4606['field']('i.'+_0x2c87ce);});}else{_0x5c4606[_0xefd2('0x42')](_0xefd2('0x96'),'unreadMessages');_0x5c4606[_0xefd2('0x42')](_0xefd2('0x97'),_0xefd2('0x98'));_0x5c4606['field'](_0xefd2('0x99'),_0xefd2('0x9a'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0x9b'),_0xefd2('0x8b'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0x87'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0x9c'));_0x5c4606['field'](_0xefd2('0x9d'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0x9e'));_0x5c4606['field'](_0xefd2('0x9f'));_0x5c4606['field'](_0xefd2('0xa0'));_0x5c4606[_0xefd2('0x42')]('i.lastMsgAt');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa1'));_0x5c4606['field'](_0xefd2('0xa2'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa3'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa4'));_0x5c4606['field'](_0xefd2('0xa5'));_0x5c4606[_0xefd2('0x42')]('i.substatus');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa6'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa7'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa8'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xa9'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xaa'),'Contact.firstName');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xab'),_0xefd2('0xac'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xad'),_0xefd2('0xae'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xaf'),'Contact.phone');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xb0'),'Contact.mobile');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xb1'),'Contact.fax');_0x5c4606['field'](_0xefd2('0xb2'),_0xefd2('0xb3'));_0x5c4606[_0xefd2('0x42')](_0xefd2('0xb4'),'Owner.internal');_0x5c4606[_0xefd2('0x42')](_0xefd2('0xb5'),_0xefd2('0x22'));}if(_0x1d3204[_0xefd2('0x15')])_0x5c4606[_0xefd2('0x15')](_0x1d3204[_0xefd2('0x15')]);if(_0x1d3204[_0xefd2('0x13')])_0x5c4606[_0xefd2('0x13')](_0x1d3204[_0xefd2('0x13')]);return db['sequelize'][_0xefd2('0x39')](_0x5c4606[_0xefd2('0x93')](),_0x3695a6);})[_0xefd2('0x1a')](function(_0x489241){if(_0x489241[_0xefd2('0x63')]>0x0)_0x1b85dd[_0xefd2('0x40')]('ui.MailInteractionId\x20IN\x20?',_[_0xefd2('0x20')](_0x489241,'id'));return db['sequelize'][_0xefd2('0x39')](_0x1b85dd[_0xefd2('0x93')](),_0x3695a6)[_0xefd2('0x1a')](function(_0x384876){var _0x3f772c=_[_0xefd2('0xb6')](_0x384876,'MailInteractionId');var _0x4a1fa2=[];return db[_0xefd2('0xb7')]['findOne']({'attributes':[_0xefd2('0xb8')],'raw':!![]})['then'](function(_0x2dbc2f){var _0x100575=_0x2dbc2f[_0xefd2('0xb8')];_0x489241[_0xefd2('0x24')](function(_0x43b751){_0x4a1fa2['push'](updateMailInteraction(_0x43b751,_0x4fad61,_0x3f772c,_0x100575));});return BPromise['all'](_0x4a1fa2);});});});})[_0xefd2('0x1a')](function(_0x507b30){_0x16612d[_0xefd2('0xb9')]=_0x507b30;return _0x16612d;})[_0xefd2('0x1a')](respondWithFilteredResult(_0x2f0ba9,_0x1d3204))[_0xefd2('0x2d')](handleError(_0x2f0ba9,null));};exports[_0xefd2('0xba')]=function(_0x3e101a,_0x46fdc9){var _0xfbac4b={'raw':![],'where':{'id':_0x3e101a[_0xefd2('0xbb')]['id']}},_0x276bc2={};_0x276bc2[_0xefd2('0x38')]=_['keys'](db['MailInteraction'][_0xefd2('0xbc')]);_0x276bc2[_0xefd2('0x39')]=_[_0xefd2('0x6f')](_0x3e101a['query']);_0x276bc2['filters']=_[_0xefd2('0x3b')](_0x276bc2[_0xefd2('0x38')],_0x276bc2[_0xefd2('0x39')]);_0xfbac4b['attributes']=_[_0xefd2('0x3b')](_0x276bc2[_0xefd2('0x38')],qs[_0xefd2('0x3c')](_0x3e101a['query'][_0xefd2('0x3c')]));_0xfbac4b[_0xefd2('0x3d')]=_0xfbac4b['attributes'][_0xefd2('0x63')]?_0xfbac4b['attributes']:_0x276bc2[_0xefd2('0x38')];if(_0x3e101a[_0xefd2('0x39')]['includeAll']){_0xfbac4b[_0xefd2('0xbd')]=[{'all':!![]}];}_0xfbac4b=_[_0xefd2('0x95')]({},_0xfbac4b,_0x3e101a[_0xefd2('0xbe')]);return db['MailInteraction'][_0xefd2('0x59')](_0xfbac4b)['then'](handleEntityNotFound(_0x46fdc9,null))['then'](respondWithResult(_0x46fdc9,null))[_0xefd2('0x2d')](handleError(_0x46fdc9,null));};exports[_0xefd2('0xbf')]=function(_0x45c4cf,_0x5417c9){return db['MailInteraction'][_0xefd2('0xbf')](_0x45c4cf[_0xefd2('0xc0')],{})[_0xefd2('0x1a')](respondWithResult(_0x5417c9,0xc9))[_0xefd2('0x2d')](handleError(_0x5417c9,null));};exports['update']=function(_0x28a0e2,_0x531a61){if(_0x28a0e2['body']['id']){delete _0x28a0e2[_0xefd2('0xc0')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x28a0e2[_0xefd2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x531a61,null))[_0xefd2('0x1a')](saveUpdates(_0x28a0e2[_0xefd2('0xc0')],null))[_0xefd2('0x1a')](respondWithResult(_0x531a61,null))[_0xefd2('0x2d')](handleError(_0x531a61,null));};exports[_0xefd2('0x1b')]=function(_0x7dc059,_0x1ee6e4){return db[_0xefd2('0x36')][_0xefd2('0x59')]({'where':{'id':_0x7dc059[_0xefd2('0xbb')]['id']}})[_0xefd2('0x1a')](handleEntityNotFound(_0x1ee6e4,null))['then'](removeEntity(_0x1ee6e4,null))[_0xefd2('0x2d')](handleError(_0x1ee6e4,null));};exports[_0xefd2('0xc1')]=function(_0x142fdb,_0x5cea58){return db[_0xefd2('0x36')][_0xefd2('0xc1')]()[_0xefd2('0x1a')](respondWithResult(_0x5cea58,null))[_0xefd2('0x2d')](handleError(_0x5cea58,null));};exports[_0xefd2('0xc2')]=function(_0x578c48,_0x274526){return db['MailMessage'][_0xefd2('0x59')]({'where':{'id':_0x578c48['params']['id']}})[_0xefd2('0x1a')](handleEntityNotFound(_0x274526,null))['then'](function(_0x37b787){if(_0x37b787){return _0x37b787[_0xefd2('0xc2')](_0x578c48['body']['ids'],_[_0xefd2('0xc3')](_0x578c48[_0xefd2('0xc0')],[_0xefd2('0xc4'),'id'])||{});}})[_0xefd2('0x1a')](respondWithResult(_0x274526,null))['catch'](handleError(_0x274526,null));};exports[_0xefd2('0xc5')]=function(_0x353402,_0x596da4){var _0x5bf641={'raw':![],'where':{}};var _0x5a24eb={};var _0x38506a={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x353402[_0xefd2('0xbb')]['id']}})[_0xefd2('0x1a')](handleEntityNotFound(_0x596da4,null))[_0xefd2('0x1a')](function(_0xeddb71){if(_0xeddb71){_0x5a24eb[_0xefd2('0x38')]=_['keys'](db[_0xefd2('0x26')][_0xefd2('0xbc')]);_0x5a24eb[_0xefd2('0x39')]=_[_0xefd2('0x6f')](_0x353402[_0xefd2('0x39')]);_0x5a24eb[_0xefd2('0x3a')]=_[_0xefd2('0x3b')](_0x5a24eb[_0xefd2('0x38')],_0x5a24eb[_0xefd2('0x39')]);_0x5bf641['attributes']=_['intersection'](_0x5a24eb[_0xefd2('0x38')],qs[_0xefd2('0x3c')](_0x353402['query'][_0xefd2('0x3c')]));_0x5bf641[_0xefd2('0x3d')]=_0x5bf641['attributes'][_0xefd2('0x63')]?_0x5bf641[_0xefd2('0x3d')]:_0x5a24eb[_0xefd2('0x38')];if(!_0x353402[_0xefd2('0x39')]['hasOwnProperty'](_0xefd2('0xc6'))){_0x5bf641[_0xefd2('0x15')]=qs['limit'](_0x353402[_0xefd2('0x39')][_0xefd2('0x15')]);_0x5bf641[_0xefd2('0x13')]=qs[_0xefd2('0x13')](_0x353402[_0xefd2('0x39')]['offset']);}_0x5bf641[_0xefd2('0x3e')]=qs[_0xefd2('0x3f')](_0x353402[_0xefd2('0x39')][_0xefd2('0x3f')]);_0x5bf641[_0xefd2('0x40')]=qs[_0xefd2('0x3a')](_['pick'](_0x353402[_0xefd2('0x39')],_0x5a24eb[_0xefd2('0x3a')]));_0x5bf641[_0xefd2('0x40')][_0xefd2('0xc7')]=_0xeddb71['id'];if(_0x353402['query']['filter']){_0x5bf641[_0xefd2('0x40')]=_[_0xefd2('0x95')](_0x5bf641[_0xefd2('0x40')],{'$or':_[_0xefd2('0x20')](_0x5bf641[_0xefd2('0x3d')],function(_0x149ef4){var _0x5c2a2e={};_0x5c2a2e[_0x149ef4]={'$like':'%'+_0x353402[_0xefd2('0x39')]['filter']+'%'};return _0x5c2a2e;})});}if(_0x353402[_0xefd2('0x39')][_0xefd2('0x77')]){var _0x21a673=_0x353402[_0xefd2('0x39')]['$gte'][_0xefd2('0x62')](',');var _0x59daa3={};_0x59daa3[_0x21a673[0x0]]={'$gte':moment(_0x21a673[0x1])[_0xefd2('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5bf641[_0xefd2('0x40')]=_['merge'](_0x5bf641[_0xefd2('0x40')],_0x59daa3);}_0x5bf641=_[_0xefd2('0x95')]({},_0x5bf641,_0x353402[_0xefd2('0xbe')]);return db[_0xefd2('0x26')]['count']({'where':_0x5bf641[_0xefd2('0x40')]})[_0xefd2('0x1a')](function(_0x3c0e74){_0x38506a[_0xefd2('0x16')]=_0x3c0e74;if(_0x353402[_0xefd2('0x39')][_0xefd2('0xc9')]){_0x5bf641[_0xefd2('0xbd')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x5bf641);})[_0xefd2('0x1a')](function(_0x4e3673){if(_0x353402[_0xefd2('0x39')][_0xefd2('0xca')]==='true'){for(var _0x418c65=0x0;_0x418c65<_0x4e3673[_0xefd2('0x63')];_0x418c65++){_0x4e3673[_0x418c65][_0xefd2('0xc0')]=juice(_0x4e3673[_0x418c65][_0xefd2('0xc0')]);}}_0x38506a[_0xefd2('0xb9')]=_0x4e3673;return _0x38506a;});}})[_0xefd2('0x1a')](respondWithFilteredResult(_0x596da4,_0x5bf641))[_0xefd2('0x2d')](handleError(_0x596da4,null));};exports[_0xefd2('0xcb')]=function(_0xd0e8d9,_0x2ada37){return db[_0xefd2('0x36')][_0xefd2('0x59')]({'where':{'id':_0xd0e8d9[_0xefd2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x2ada37,null))[_0xefd2('0x1a')](function(_0xc348e6){if(_0xc348e6){return _0xc348e6['setTags'](_0xd0e8d9['body']['ids'],_[_0xefd2('0xc3')](_0xd0e8d9[_0xefd2('0xc0')],[_0xefd2('0xc4'),'id'])||{})[_0xefd2('0xcc')](function(){return db['Tag'][_0xefd2('0xcd')]({'attributes':['id',_0xefd2('0x1d'),_0xefd2('0x43')],'where':{'id':_0xd0e8d9[_0xefd2('0xc0')][_0xefd2('0xc4')]}});})[_0xefd2('0x1a')](function(_0x30b664){socket[_0xefd2('0xce')]('mailInteractionTags:save',{'id':Number(_0xd0e8d9[_0xefd2('0xbb')]['id']),'tags':_0x30b664||[]});return{'id':Number(_0xd0e8d9[_0xefd2('0xbb')]['id']),'tags':_0x30b664||[]};});}})['then'](respondWithResult(_0x2ada37,null))[_0xefd2('0x2d')](handleError(_0x2ada37,null));};exports[_0xefd2('0xcf')]=function(_0x538d35,_0x331d68){return db[_0xefd2('0x36')][_0xefd2('0x59')]({'where':{'id':_0x538d35[_0xefd2('0xbb')]['id']}})[_0xefd2('0x1a')](handleEntityNotFound(_0x331d68,null))[_0xefd2('0x1a')](function(_0x377546){if(_0x377546){return _0x377546['removeTags'](_0x538d35[_0xefd2('0x39')][_0xefd2('0xc4')]);}})[_0xefd2('0x1a')](respondWithStatusCode(_0x331d68,null))[_0xefd2('0x2d')](handleError(_0x331d68,null));};exports[_0xefd2('0xd0')]=function(_0x58ece7,_0x2a6d7e){var _0x346951=moment()[_0xefd2('0xd1')]()[_0xefd2('0x93')]();var _0xbb8901=path[_0xefd2('0xd2')](config[_0xefd2('0xd3')],'server',_0xefd2('0xd4'),'tmp');var _0x1c8219=path['join'](config['root'],'server',_0xefd2('0xd4'),'attachments');var _0x384154=path[_0xefd2('0xd2')](_0xbb8901,_0x346951);var _0x33dd02=util['format'](_0xefd2('0xd5'),_0x58ece7['params']['id'],_0x346951);var _0x3e8496=path[_0xefd2('0xd2')](_0xbb8901,_0x33dd02);var _0x1daebb=[];if(_0x58ece7[_0xefd2('0x39')][_0xefd2('0xd6')]){_0x1daebb[_0xefd2('0x25')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x3f44e5=[{'model':db[_0xefd2('0x26')],'as':_0xefd2('0xd7'),'attributes':['id','body',_0xefd2('0x44'),'to','cc',_0xefd2('0xd8'),_0xefd2('0xd9'),_0xefd2('0x75')],'where':{'secret':![]},'order':qs[_0xefd2('0x3f')]('id'),'include':_0x1daebb}];return db['MailInteraction']['find']({'where':{'id':_0x58ece7[_0xefd2('0xbb')]['id']},'include':_0x3f44e5})['then'](handleEntityNotFound(_0x2a6d7e,null))[_0xefd2('0x1a')](function(_0x100d5c){if(_0x100d5c&&_0x100d5c[_0xefd2('0xd7')]){var _0x5133ca=_0x100d5c[_0xefd2('0xda')]({'plain':!![]});fs['mkdirSync'](_0x384154);return BPromise[_0xefd2('0xdb')](_0x5133ca[_0xefd2('0xd7')],function(_0x2eeac2,_0x510b75){var _0x2b767d={'from':_0x2eeac2[_0xefd2('0x44')],'to':_0x2eeac2['to'],'subject':_0x2eeac2[_0xefd2('0xd9')],'html':htmlEntities[_0xefd2('0xdc')](_0x2eeac2[_0xefd2('0xc0')]),'headers':{'Date':moment(_0x2eeac2[_0xefd2('0x75')])[_0xefd2('0xc8')](_0xefd2('0xdd'))},'attachments':[]};if(_0x2eeac2['cc']){_0x2b767d[_0xefd2('0xde')]['Cc']=_0x2eeac2['cc'];}if(_0x2eeac2[_0xefd2('0xd8')]){_0x2b767d[_0xefd2('0xde')][_0xefd2('0xdf')]=_0x2eeac2['bcc'];}return new BPromise(function(_0x29bf4e,_0x123d60){if(_0x2eeac2[_0xefd2('0xe0')]){for(var _0x287687=0x0;_0x287687<_0x2eeac2[_0xefd2('0xe0')][_0xefd2('0x63')];_0x287687++){var _0x8d0895=_0x2eeac2[_0xefd2('0xe0')][_0x287687];var _0x59e4f1=path[_0xefd2('0xd2')](_0x1c8219,_0x8d0895[_0xefd2('0xe1')]);if(fs[_0xefd2('0xe2')](_0x59e4f1)){_0x2b767d[_0xefd2('0xd6')][_0xefd2('0x25')]({'name':_0x8d0895[_0xefd2('0x1d')],'contentType':_0x8d0895['type'],'data':fs[_0xefd2('0xe3')](_0x59e4f1)});}}}emlformat[_0xefd2('0xe4')](_0x2b767d,function(_0x10f735,_0x5edf2c){if(_0x10f735)return _0x123d60(_0x10f735);fs['writeFileSync'](path[_0xefd2('0xd2')](_0x384154,util[_0xefd2('0xc8')](_0xefd2('0xe5'),_0x510b75)),_0x5edf2c);return _0x29bf4e(_0x5edf2c);});});})['then'](function(){return new BPromise(function(_0x29e797,_0x4dcad3){zipdir(_0x384154,{'saveTo':_0x3e8496},function(_0x5db277,_0x4761a1){if(_0x5db277)return _0x4dcad3(_0x5db277);return _0x29e797(_0x4761a1);});})[_0xefd2('0x1a')](function(){return new BPromise(function(_0x31b723,_0x49e993){rimraf(_0x384154,function(_0x22d92a){if(_0x22d92a)_0x49e993(_0x22d92a);return _0x31b723();});});})[_0xefd2('0x1a')](function(){return _0x2a6d7e[_0xefd2('0xd0')](_0x3e8496,_0x33dd02,function(_0x82b45e){if(!_0x82b45e)fs[_0xefd2('0xe6')](_0x3e8496);});});});}else{return _0x2a6d7e[_0xefd2('0xf')](0xc8);}})['catch'](handleError(_0x2a6d7e,null));}; \ No newline at end of file +var _0xda19=['sendStatus','status','json','undefined','count','offset','limit','set','update','then','end','error','stack','name','send','map','TagIds','Tags','push','findOne','out','-id','plainBody','lastMsgText','trimStart','waiting','answered','unmanaged','total','closed','UserId','talking','index','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','forEach','User','start','text','some','isEmpty','MailAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','enableEmailPreview','catch','show','params','MailInteraction','options','create','body','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','include','inlineCss','true','rows','addTags','spread','findAll','emit','removeTags','unix','root','server','files','tmp','attachments','join','Attachment','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','bluebird','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','localhost','redis','./mailInteraction.socket','register'];(function(_0x271eac,_0x401f28){var _0x2030f0=function(_0x24ca8d){while(--_0x24ca8d){_0x271eac['push'](_0x271eac['shift']());}};_0x2030f0(++_0x401f28);}(_0xda19,0xd5));var _0x9da1=function(_0x229e01,_0x3b7170){_0x229e01=_0x229e01-0x0;var _0x2d405f=_0xda19[_0x229e01];return _0x2d405f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var moment=require('moment');var BPromise=require(_0x9da1('0x2'));var util=require('util');var path=require(_0x9da1('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9da1('0x4'));var juice=require(_0x9da1('0x5'));var Redis=require(_0x9da1('0x6'));var qs=require(_0x9da1('0x7'));var as=require(_0x9da1('0x8'));var logger=require(_0x9da1('0x9'))(_0x9da1('0xa'));var config=require(_0x9da1('0xb'));var db=require(_0x9da1('0xc'))['db'];var htmlEntities=require(_0x9da1('0xd'));config['redis']=_['defaults'](config['redis'],{'host':_0x9da1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9da1('0xf')]));require(_0x9da1('0x10'))[_0x9da1('0x11')](socket);function respondWithStatusCode(_0x1ab988,_0x418af0){_0x418af0=_0x418af0||0xcc;return function(_0x396e23){if(_0x396e23){return _0x1ab988[_0x9da1('0x12')](_0x418af0);}return _0x1ab988['status'](_0x418af0)['end']();};}function respondWithResult(_0x3114f7,_0x596b6b){_0x596b6b=_0x596b6b||0xc8;return function(_0x4735c7){if(_0x4735c7){return _0x3114f7[_0x9da1('0x13')](_0x596b6b)[_0x9da1('0x14')](_0x4735c7);}};}function respondWithFilteredResult(_0x1ffa2a,_0x4b75cc){return function(_0x2837e3){if(_0x2837e3){var _0x535a13=typeof _0x4b75cc['offset']===_0x9da1('0x15')&&typeof _0x4b75cc['limit']===_0x9da1('0x15');var _0x43c093=_0x2837e3[_0x9da1('0x16')];var _0x1a1a6b=_0x535a13?0x0:_0x4b75cc[_0x9da1('0x17')];var _0x514d8e=_0x535a13?_0x2837e3[_0x9da1('0x16')]:_0x4b75cc[_0x9da1('0x17')]+_0x4b75cc[_0x9da1('0x18')];var _0x77347a;if(_0x514d8e>=_0x43c093){_0x514d8e=_0x43c093;_0x77347a=0xc8;}else{_0x77347a=0xce;}_0x1ffa2a[_0x9da1('0x13')](_0x77347a);return _0x1ffa2a[_0x9da1('0x19')]('Content-Range',_0x1a1a6b+'-'+_0x514d8e+'/'+_0x43c093)['json'](_0x2837e3);}return null;};}function saveUpdates(_0x17205d){return function(_0x8da712){if(_0x8da712){return _0x8da712[_0x9da1('0x1a')](_0x17205d)[_0x9da1('0x1b')](function(_0x40a967){return _0x40a967;});}return null;};}function removeEntity(_0x3b1645){return function(_0xe56279){if(_0xe56279){return _0xe56279['destroy']()[_0x9da1('0x1b')](function(){_0x3b1645[_0x9da1('0x13')](0xcc)[_0x9da1('0x1c')]();});}};}function handleEntityNotFound(_0xacba30){return function(_0x1fc065){if(!_0x1fc065){_0xacba30['sendStatus'](0x194);}return _0x1fc065;};}function handleError(_0x5454d3,_0x14793b){_0x14793b=_0x14793b||0x1f4;return function(_0x3e6f85){logger[_0x9da1('0x1d')](_0x3e6f85[_0x9da1('0x1e')]);if(_0x3e6f85[_0x9da1('0x1f')]){delete _0x3e6f85[_0x9da1('0x1f')];}_0x5454d3['status'](_0x14793b)[_0x9da1('0x20')](_0x3e6f85);};}function getInteractionUsers(_0x3bfa40,_0x4fd25a){return new BPromise(function(_0x45fcce,_0x3f5680){try{if(_0x4fd25a[_0x3bfa40['id']]){_0x3bfa40['Users']=_[_0x9da1('0x21')](_0x4fd25a[_0x3bfa40['id']],function(_0x16e12f){return{'id':_0x16e12f['id'],'fullname':_0x16e12f['fullname']};});}}catch(_0x36b87a){_0x3f5680(_0x36b87a);}_0x45fcce(_0x3bfa40);});}function getInteractionTags(_0x1d6af5,_0x55cd3d){return new BPromise(function(_0x5c09ed,_0x67dbc8){try{if(_0x1d6af5[_0x9da1('0x22')]){_0x1d6af5['Tags']=[];_0x1d6af5[_0x9da1('0x22')]['split'](',')['forEach'](function(_0x5a59c2){_0x1d6af5[_0x9da1('0x23')][_0x9da1('0x24')](_0x55cd3d[_0x5a59c2]);});}delete _0x1d6af5[_0x9da1('0x22')];}catch(_0x26dd58){_0x67dbc8(_0x26dd58);}_0x5c09ed(_0x1d6af5);});}function getLastMessageText(_0x140c6c){return new BPromise(function(_0x4c0ade,_0x269628){return db['MailMessage'][_0x9da1('0x25')]({'where':{'$and':[{'MailInteractionId':_0x140c6c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9da1('0x26')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x9da1('0x27'),'raw':!![]})[_0x9da1('0x1b')](function(_0x4f318b){if(_0x4f318b&&_0x4f318b[_0x9da1('0x28')]){_0x140c6c[_0x9da1('0x29')]=_[_0x9da1('0x2a')](_0x4f318b[_0x9da1('0x28')]);}_0x4c0ade(_0x140c6c);})['catch'](function(_0x4859c0){_0x269628(_0x4859c0);});});}function updateMailInteraction(_0x4733c3,_0x354733,_0x1ea84f,_0x3ddd57){return new BPromise(function(_0x193273,_0x559645){return getInteractionUsers(_0x4733c3,_0x1ea84f)[_0x9da1('0x1b')](function(_0x343c64){return getInteractionTags(_0x343c64,_0x354733);})[_0x9da1('0x1b')](function(_0x1d2106){return getStateInteraction(_0x1d2106);})[_0x9da1('0x1b')](function(_0x266ee8){if(_0x3ddd57){_0x193273(getLastMessageText(_0x266ee8));}else{_0x193273(_0x266ee8);}})['catch'](function(_0xa43301){_0x559645(_0xa43301);});});}function getStateInteraction(_0x5af570){return new BPromise(function(_0x4dd43b){_0x5af570[_0x9da1('0x2b')]=0x0;_0x5af570['talking']=0x0;_0x5af570[_0x9da1('0x2c')]=0x0;_0x5af570[_0x9da1('0x2d')]=0x0;_0x5af570[_0x9da1('0x2e')]=0x0;if(!_0x5af570[_0x9da1('0x2f')]&&!_0x5af570[_0x9da1('0x30')]){_0x5af570[_0x9da1('0x2b')]+=0x1;}if(!_0x5af570[_0x9da1('0x2f')]&&_0x5af570[_0x9da1('0x30')]){_0x5af570['talking']+=0x1;if(_0x5af570[_0x9da1('0x2b')]){_0x5af570['waiting']-=0x1;}}if(_0x5af570[_0x9da1('0x2f')]&&_0x5af570['UserId']){_0x5af570['answered']+=0x1;if(_0x5af570[_0x9da1('0x31')]){_0x5af570['talking']-=0x1;}}if(_0x5af570[_0x9da1('0x2f')]&&!_0x5af570[_0x9da1('0x30')]){_0x5af570['unmanaged']+=0x1;if(_0x5af570[_0x9da1('0x2b')]){_0x5af570[_0x9da1('0x2b')]-=0x1;}}_0x5af570[_0x9da1('0x2e')]+=0x1;_0x4dd43b(_0x5af570);});}exports[_0x9da1('0x32')]=function(_0x56bd49,_0x257c2e){var _0x5e7846={},_0x2bb9e4={},_0x4bdaf1={'count':0x0,'rows':[]};var _0x26e8d3=_[_0x9da1('0x21')](db['MailInteraction'][_0x9da1('0x33')],function(_0xca8d9b){return{'name':_0xca8d9b[_0x9da1('0x34')],'type':_0xca8d9b['type']['key']};});_0x2bb9e4['model']=_[_0x9da1('0x21')](_0x26e8d3,'name');_0x2bb9e4[_0x9da1('0x35')]=_[_0x9da1('0x36')](_0x56bd49[_0x9da1('0x35')]);_0x2bb9e4[_0x9da1('0x37')]=_['intersection'](_0x2bb9e4[_0x9da1('0x38')],_0x2bb9e4[_0x9da1('0x35')]);_0x5e7846[_0x9da1('0x39')]=_[_0x9da1('0x3a')](_0x2bb9e4[_0x9da1('0x38')],qs[_0x9da1('0x3b')](_0x56bd49[_0x9da1('0x35')]['fields']));_0x5e7846[_0x9da1('0x39')]=_0x5e7846['attributes'][_0x9da1('0x3c')]?_0x5e7846['attributes']:_0x2bb9e4[_0x9da1('0x38')];if(!_0x56bd49[_0x9da1('0x35')]['hasOwnProperty'](_0x9da1('0x3d'))){_0x5e7846[_0x9da1('0x18')]=qs['limit'](_0x56bd49[_0x9da1('0x35')]['limit']);_0x5e7846[_0x9da1('0x17')]=qs[_0x9da1('0x17')](_0x56bd49['query']['offset']);}_0x5e7846[_0x9da1('0x3e')]=qs[_0x9da1('0x3f')](_0x56bd49[_0x9da1('0x35')][_0x9da1('0x3f')]);_0x5e7846[_0x9da1('0x40')]=qs[_0x9da1('0x37')](_[_0x9da1('0x41')](_0x56bd49[_0x9da1('0x35')],_0x2bb9e4['filters']),_0x26e8d3);var _0xd7fb0a=[];var _0x23b445=squel[_0x9da1('0x42')]()['field']('id')[_0x9da1('0x43')](_0x9da1('0x1f'))[_0x9da1('0x43')]('color')[_0x9da1('0x44')](_0x9da1('0x45'));var _0x28b1b0=squel['select']()[_0x9da1('0x43')]('u.id')['field'](_0x9da1('0x46'))[_0x9da1('0x43')]('ui.MailInteractionId')[_0x9da1('0x44')](_0x9da1('0x47'),'ui')['left_join'](_0x9da1('0x48'),'u',_0x9da1('0x49'));var _0x1984f7=squel[_0x9da1('0x42')]()[_0x9da1('0x44')](_0x9da1('0x4a'),'i')[_0x9da1('0x4b')](_0x9da1('0x4c'),'c',_0x9da1('0x4d'))['left_join'](_0x9da1('0x48'),'o',_0x9da1('0x4e'))[_0x9da1('0x4b')](_0x9da1('0x4f'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0x9da1('0x50'),'me',_0x9da1('0x51'))[_0x9da1('0x4b')](_0x9da1('0x52'),'it',_0x9da1('0x53'))[_0x9da1('0x4b')](_0x9da1('0x45'),'t',_0x9da1('0x54'));var _0x34327e=squel[_0x9da1('0x55')]();var _0x868167=[];var _0x19f1ca=squel[_0x9da1('0x55')]();var _0x20bd88;if(_0x56bd49['query'][_0x9da1('0x56')]){_0x20bd88=as[_0x9da1('0x57')](_0x56bd49['query'][_0x9da1('0x56')]);var _0x4a1e45=_0x20bd88[_0x9da1('0x58')];for(var _0x4f4980=0x0;_0x4f4980<_0x20bd88[_0x9da1('0x59')][_0x9da1('0x3c')];_0x4f4980++){var _0x11e5dd=_0x20bd88[_0x9da1('0x59')][_0x4f4980];var _0x32d131='i';var _0x2cb7a4=_[_0x9da1('0x5a')](_0x26e8d3,[_0x9da1('0x1f'),_0x11e5dd[_0x9da1('0x43')]]);if(!_0x2cb7a4){switch(_0x11e5dd[_0x9da1('0x43')]){case'unreadMessages':if(_0x11e5dd[_0x9da1('0x5b')]==0x1){_0x1984f7[_0x9da1('0x5c')]('`'+_0x11e5dd[_0x9da1('0x43')]+_0x9da1('0x5d'));}else{_0x1984f7[_0x9da1('0x5c')]('`'+_0x11e5dd[_0x9da1('0x43')]+_0x9da1('0x5e'));}break;case _0x9da1('0x5f'):if(_0x11e5dd[_0x9da1('0x60')]===_0x9da1('0x61')){if(_0x11e5dd['value'][_0x9da1('0x62')]('\x20')[_0x9da1('0x3c')]>0x1){_0x34327e[_0x4a1e45]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9da1('0x63')](_0x11e5dd[_0x9da1('0x5b')]),null);}else{var _0x1eeece='%'+_0x11e5dd[_0x9da1('0x5b')]+'%';_0x34327e[_0x4a1e45](_0x9da1('0x64'),_0x1eeece,_0x1eeece,_0x1eeece);}}else{_0x2cb7a4=_[_0x9da1('0x5a')](_0x26e8d3,[_0x9da1('0x1f'),'ContactId']);_0x11e5dd[_0x9da1('0x43')]=_0x9da1('0x65');_0x32ec1a=as[_0x9da1('0x66')](_0x32d131,_0x2cb7a4[_0x9da1('0x67')],_0x11e5dd);_0x34327e[_0x4a1e45](_0x32ec1a['text'],_0x32ec1a[_0x9da1('0x5b')]['start'],_0x32ec1a[_0x9da1('0x5b')][_0x9da1('0x1c')]);}break;case _0x9da1('0x68'):var _0x432c8b=_0x11e5dd[_0x9da1('0x5b')][_0x9da1('0x62')](',')['map'](function(_0x5f5dc2){return Number(_0x5f5dc2);});_0x432c8b[_0x9da1('0x69')](function(_0x47bfc3){_0x19f1ca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x47bfc3+',%');});_0x868167=_['union'](_0x868167,_0x432c8b);break;case _0x9da1('0x6a'):if(_0x11e5dd['operator']===_0x9da1('0x61')){_0x34327e[_0x4a1e45]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x11e5dd[_0x9da1('0x5b')]+'%',null);}else{_0x2cb7a4=_[_0x9da1('0x5a')](_0x26e8d3,['name',_0x9da1('0x30')]);_0x11e5dd[_0x9da1('0x43')]='UserId';_0x32ec1a=as[_0x9da1('0x66')](_0x32d131,_0x2cb7a4[_0x9da1('0x67')],_0x11e5dd);_0x34327e[_0x4a1e45](_0x32ec1a['text'],_0x32ec1a['value'][_0x9da1('0x6b')],_0x32ec1a[_0x9da1('0x5b')][_0x9da1('0x1c')]);}break;case _0x9da1('0x28'):_0x32ec1a=as[_0x9da1('0x66')]('me',null,_0x11e5dd);_0x34327e[_0x4a1e45](_0x32ec1a[_0x9da1('0x6c')],_0x32ec1a['value'][_0x9da1('0x6b')],_0x32ec1a['value']['end']);break;}}else{var _0x32ec1a=as[_0x9da1('0x66')](_0x32d131,_0x2cb7a4[_0x9da1('0x67')],_0x11e5dd);_0x34327e[_0x4a1e45](_0x32ec1a[_0x9da1('0x6c')],_0x32ec1a[_0x9da1('0x5b')][_0x9da1('0x6b')],_0x32ec1a[_0x9da1('0x5b')][_0x9da1('0x1c')]);}}}else{var _0x1971f0=_(_0x56bd49['query'])[_0x9da1('0x36')]()[_0x9da1('0x21')](function(_0x2e77e8){return _[_0x9da1('0x6d')](_0x26e8d3,[_0x9da1('0x1f'),_0x2e77e8])?_0x2e77e8:undefined;})['compact']()[_0x9da1('0x5b')]();if(!_[_0x9da1('0x6e')](_0x1971f0)){_0x1971f0[_0x9da1('0x69')](function(_0x86db4e){if(_0x86db4e===_0x9da1('0x6f')){_0x1984f7[_0x9da1('0x40')]('i.MailAccountId\x20IN\x20?',[][_0x9da1('0x70')](_0x56bd49['query'][_0x86db4e]));}else if(_0x86db4e===_0x9da1('0x71')){var _0x5b6d9f=JSON[_0x9da1('0x72')](_0x56bd49[_0x9da1('0x35')][_0x86db4e])[_0x9da1('0x73')];var _0x23209b=JSON['parse'](_0x56bd49['query'][_0x86db4e])['$lte'];_0x1984f7[_0x9da1('0x40')](_0x9da1('0x74'),_0x5b6d9f,_0x23209b);}else{if(_0x56bd49[_0x9da1('0x35')][_0x86db4e]===_0x9da1('0x75')){_0x1984f7['where']('i.'+_0x86db4e+'\x20IS\x20NULL');}else{_0x1984f7[_0x9da1('0x40')]('i.'+_0x86db4e+_0x9da1('0x76'),_0x56bd49[_0x9da1('0x35')][_0x86db4e]);}}});}if(_0x56bd49['query']['read']){if(_0x56bd49[_0x9da1('0x35')][_0x9da1('0x77')]==0x1){_0x1984f7[_0x9da1('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x1984f7['having'](_0x9da1('0x78'));}}if(_0x56bd49[_0x9da1('0x35')][_0x9da1('0x79')]){_0x868167=_[_0x9da1('0x7a')](_0x56bd49[_0x9da1('0x35')]['tag'])?_0x56bd49[_0x9da1('0x35')][_0x9da1('0x79')]:new Array(_0x56bd49[_0x9da1('0x35')][_0x9da1('0x79')]);_0x868167['forEach'](function(_0x409116){_0x19f1ca['or'](_0x9da1('0x7b'),'%,'+_0x409116+',%');});}if(_0x56bd49[_0x9da1('0x35')]['filter']){var _0x3ce47d=_0x56bd49[_0x9da1('0x35')][_0x9da1('0x7c')]['replace']('\x5c','\x5c\x5c')[_0x9da1('0x7d')](/'/g,'\x27\x27');if(qs[_0x9da1('0x7e')](_0x3ce47d)){_0x34327e['or']('i.id\x20LIKE\x20?',_0x3ce47d+'%');}else if(qs[_0x9da1('0x7f')](_0x3ce47d)){_0x34327e['or']('c.email\x20LIKE\x20?',_0x3ce47d+'%');}else{_0x34327e['or'](_0x9da1('0x80'),qs['getFullTextValue'](_0x3ce47d))['or'](_0x9da1('0x81'),qs[_0x9da1('0x63')](_0x3ce47d));}}}_0x1984f7[_0x9da1('0x40')](_0x34327e);_0x1984f7[_0x9da1('0x82')](_0x9da1('0x83'));var _0x3a03cd={'type':db[_0x9da1('0x84')][_0x9da1('0x85')][_0x9da1('0x86')],'raw':!![]};var _0x457b45=_0x1984f7[_0x9da1('0x87')]();_0x457b45[_0x9da1('0x43')](_0x9da1('0x83'));_0x457b45['field'](_0x9da1('0x88'),_0x9da1('0x89'));if(_0x5e7846[_0x9da1('0x3e')]){_0x5e7846[_0x9da1('0x3e')][_0x9da1('0x69')](function(_0x4f39bc){var _0x1ca102=_0x4f39bc[0x0]===_0x9da1('0x8a')?_0x4f39bc[0x0]:'i.'+_0x4f39bc[0x0];_0x1984f7['order'](_0x1ca102,_0x4f39bc[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9da1('0x6e')](_0x868167)){_0x1984f7[_0x9da1('0x5c')](_0x19f1ca);_0x457b45[_0x9da1('0x40')](_0x9da1('0x8b'),_0x868167);}BPromise[_0x9da1('0x8c')]()[_0x9da1('0x1b')](function(){if(!_0x20bd88){if(_0x56bd49[_0x9da1('0x35')][_0x9da1('0x6f')])return;_0x457b45[_0x9da1('0x40')](_0x9da1('0x8d'));_0x1984f7[_0x9da1('0x40')](_0x9da1('0x8d'));return;}if(_0x56bd49[_0x9da1('0x8e')]['role']!==_0x9da1('0x8f'))return;return _0x56bd49[_0x9da1('0x8e')][_0x9da1('0x90')]({'attributes':['id'],'raw':!![]})[_0x9da1('0x1b')](function(_0x20ccc5){if(_['isEmpty'](_0x20ccc5)){_0x457b45[_0x9da1('0x40')](_0x9da1('0x91'));_0x1984f7['where'](_0x9da1('0x91'));}else{_0x457b45['where'](_0x9da1('0x92'),_['map'](_0x20ccc5,'id'));_0x1984f7[_0x9da1('0x40')](_0x9da1('0x92'),_[_0x9da1('0x21')](_0x20ccc5,'id'));}});})[_0x9da1('0x1b')](function(){if(_0x56bd49[_0x9da1('0x8e')][_0x9da1('0x93')]===_0x9da1('0x8f')&&!_0x20bd88&&!_0x56bd49[_0x9da1('0x35')][_0x9da1('0x6f')])return[];return db[_0x9da1('0x94')][_0x9da1('0x35')](_0x457b45[_0x9da1('0x95')](),_0x3a03cd);})['then'](function(_0xd47cd7){_0x4bdaf1[_0x9da1('0x16')]=_0xd47cd7[_0x9da1('0x3c')];if(_0x4bdaf1[_0x9da1('0x16')]===0x0)return[];return db[_0x9da1('0x94')][_0x9da1('0x35')](_0x23b445['toString'](),_0x3a03cd)['then'](function(_0x3d0544){_0xd7fb0a=_[_0x9da1('0x96')](_0x3d0544,'id');_0x3a03cd=_[_0x9da1('0x97')](_0x3a03cd,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56bd49[_0x9da1('0x35')][_0x9da1('0x3b')]){_0x5e7846[_0x9da1('0x39')][_0x9da1('0x69')](function(_0x210e49){_0x1984f7[_0x9da1('0x43')]('i.'+_0x210e49);});}else{_0x1984f7[_0x9da1('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9da1('0x89'));_0x1984f7[_0x9da1('0x43')]('a.key','Account.key');_0x1984f7[_0x9da1('0x43')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x1984f7[_0x9da1('0x43')](_0x9da1('0x98'),_0x9da1('0x8a'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x83'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x99'));_0x1984f7[_0x9da1('0x43')]('i.updatedAt');_0x1984f7['field'](_0x9da1('0x9a'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x9b'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x9c'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x9d'));_0x1984f7[_0x9da1('0x43')]('i.lastMsgDirection');_0x1984f7[_0x9da1('0x43')]('i.subject');_0x1984f7[_0x9da1('0x43')](_0x9da1('0x9e'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0x9f'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa0'));_0x1984f7[_0x9da1('0x43')]('i.substatus');_0x1984f7[_0x9da1('0x43')]('i.to');_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa1'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa2'));_0x1984f7['field'](_0x9da1('0xa3'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa4'),_0x9da1('0xa5'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa6'),_0x9da1('0xa7'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xa8'),_0x9da1('0xa9'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xaa'),_0x9da1('0xab'));_0x1984f7[_0x9da1('0x43')]('c.mobile',_0x9da1('0xac'));_0x1984f7['field'](_0x9da1('0xad'),'Contact.fax');_0x1984f7[_0x9da1('0x43')](_0x9da1('0xae'),_0x9da1('0xaf'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xb0'),_0x9da1('0xb1'));_0x1984f7[_0x9da1('0x43')](_0x9da1('0xb2'),'TagIds');}if(_0x5e7846[_0x9da1('0x18')])_0x1984f7[_0x9da1('0x18')](_0x5e7846['limit']);if(_0x5e7846[_0x9da1('0x17')])_0x1984f7[_0x9da1('0x17')](_0x5e7846[_0x9da1('0x17')]);return db['sequelize']['query'](_0x1984f7['toString'](),_0x3a03cd);})[_0x9da1('0x1b')](function(_0x3b17aa){if(_0x3b17aa[_0x9da1('0x3c')]>0x0)_0x28b1b0['where']('ui.MailInteractionId\x20IN\x20?',_[_0x9da1('0x21')](_0x3b17aa,'id'));return db[_0x9da1('0x94')]['query'](_0x28b1b0[_0x9da1('0x95')](),_0x3a03cd)['then'](function(_0x4a83d1){var _0x4e5893=_[_0x9da1('0xb3')](_0x4a83d1,_0x9da1('0xb4'));var _0x4afbae=[];return db[_0x9da1('0xb5')][_0x9da1('0x25')]({'attributes':[_0x9da1('0xb6')],'raw':!![]})[_0x9da1('0x1b')](function(_0x193ddc){var _0x7d09c5=_0x193ddc[_0x9da1('0xb6')];_0x3b17aa[_0x9da1('0x69')](function(_0x47d4ca){_0x4afbae['push'](updateMailInteraction(_0x47d4ca,_0xd7fb0a,_0x4e5893,_0x7d09c5));});return BPromise['all'](_0x4afbae);});});});})[_0x9da1('0x1b')](function(_0x24a7f6){_0x4bdaf1['rows']=_0x24a7f6;return _0x4bdaf1;})[_0x9da1('0x1b')](respondWithFilteredResult(_0x257c2e,_0x5e7846))[_0x9da1('0xb7')](handleError(_0x257c2e,null));};exports[_0x9da1('0xb8')]=function(_0x21ade1,_0x207863){var _0x1e4725={'raw':![],'where':{'id':_0x21ade1[_0x9da1('0xb9')]['id']}},_0x8a6925={};_0x8a6925['model']=_[_0x9da1('0x36')](db[_0x9da1('0xba')][_0x9da1('0x33')]);_0x8a6925[_0x9da1('0x35')]=_[_0x9da1('0x36')](_0x21ade1['query']);_0x8a6925[_0x9da1('0x37')]=_['intersection'](_0x8a6925[_0x9da1('0x38')],_0x8a6925[_0x9da1('0x35')]);_0x1e4725[_0x9da1('0x39')]=_['intersection'](_0x8a6925['model'],qs[_0x9da1('0x3b')](_0x21ade1[_0x9da1('0x35')][_0x9da1('0x3b')]));_0x1e4725['attributes']=_0x1e4725[_0x9da1('0x39')][_0x9da1('0x3c')]?_0x1e4725['attributes']:_0x8a6925[_0x9da1('0x38')];if(_0x21ade1[_0x9da1('0x35')]['includeAll']){_0x1e4725['include']=[{'all':!![]}];}_0x1e4725=_['merge']({},_0x1e4725,_0x21ade1[_0x9da1('0xbb')]);return db['MailInteraction'][_0x9da1('0x5a')](_0x1e4725)[_0x9da1('0x1b')](handleEntityNotFound(_0x207863,null))[_0x9da1('0x1b')](respondWithResult(_0x207863,null))[_0x9da1('0xb7')](handleError(_0x207863,null));};exports[_0x9da1('0xbc')]=function(_0x14acb4,_0x53412e){return db[_0x9da1('0xba')][_0x9da1('0xbc')](_0x14acb4['body'],{})[_0x9da1('0x1b')](respondWithResult(_0x53412e,0xc9))[_0x9da1('0xb7')](handleError(_0x53412e,null));};exports[_0x9da1('0x1a')]=function(_0x1b6d98,_0x5c5368){if(_0x1b6d98[_0x9da1('0xbd')]['id']){delete _0x1b6d98[_0x9da1('0xbd')]['id'];}return db[_0x9da1('0xba')][_0x9da1('0x5a')]({'where':{'id':_0x1b6d98[_0x9da1('0xb9')]['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x5c5368,null))[_0x9da1('0x1b')](saveUpdates(_0x1b6d98[_0x9da1('0xbd')],null))['then'](respondWithResult(_0x5c5368,null))[_0x9da1('0xb7')](handleError(_0x5c5368,null));};exports['destroy']=function(_0x3dd3e0,_0x356d6d){return db[_0x9da1('0xba')][_0x9da1('0x5a')]({'where':{'id':_0x3dd3e0[_0x9da1('0xb9')]['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x356d6d,null))[_0x9da1('0x1b')](removeEntity(_0x356d6d,null))[_0x9da1('0xb7')](handleError(_0x356d6d,null));};exports['describe']=function(_0x1b0359,_0x52e4a6){return db[_0x9da1('0xba')]['describe']()['then'](respondWithResult(_0x52e4a6,null))[_0x9da1('0xb7')](handleError(_0x52e4a6,null));};exports['addMessage']=function(_0x4aa903,_0x55d7f2){return db['MailMessage']['find']({'where':{'id':_0x4aa903[_0x9da1('0xb9')]['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x55d7f2,null))[_0x9da1('0x1b')](function(_0x3212ad){if(_0x3212ad){return _0x3212ad['addMessage'](_0x4aa903[_0x9da1('0xbd')][_0x9da1('0xbe')],_[_0x9da1('0xbf')](_0x4aa903[_0x9da1('0xbd')],[_0x9da1('0xbe'),'id'])||{});}})[_0x9da1('0x1b')](respondWithResult(_0x55d7f2,null))[_0x9da1('0xb7')](handleError(_0x55d7f2,null));};exports[_0x9da1('0xc0')]=function(_0x34ea5d,_0x1dc626){var _0x1bc79b={'raw':![],'where':{}};var _0x505908={};var _0x25021d={'count':0x0,'rows':[]};return db[_0x9da1('0xba')]['findOne']({'where':{'id':_0x34ea5d['params']['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x1dc626,null))[_0x9da1('0x1b')](function(_0x1c4269){if(_0x1c4269){_0x505908[_0x9da1('0x38')]=_[_0x9da1('0x36')](db['MailMessage'][_0x9da1('0x33')]);_0x505908['query']=_[_0x9da1('0x36')](_0x34ea5d[_0x9da1('0x35')]);_0x505908['filters']=_[_0x9da1('0x3a')](_0x505908[_0x9da1('0x38')],_0x505908[_0x9da1('0x35')]);_0x1bc79b[_0x9da1('0x39')]=_['intersection'](_0x505908[_0x9da1('0x38')],qs['fields'](_0x34ea5d['query']['fields']));_0x1bc79b[_0x9da1('0x39')]=_0x1bc79b[_0x9da1('0x39')][_0x9da1('0x3c')]?_0x1bc79b['attributes']:_0x505908[_0x9da1('0x38')];if(!_0x34ea5d[_0x9da1('0x35')]['hasOwnProperty'](_0x9da1('0x3d'))){_0x1bc79b['limit']=qs[_0x9da1('0x18')](_0x34ea5d['query']['limit']);_0x1bc79b['offset']=qs[_0x9da1('0x17')](_0x34ea5d['query'][_0x9da1('0x17')]);}_0x1bc79b[_0x9da1('0x3e')]=qs['sort'](_0x34ea5d['query'][_0x9da1('0x3f')]);_0x1bc79b['where']=qs[_0x9da1('0x37')](_[_0x9da1('0x41')](_0x34ea5d['query'],_0x505908['filters']));_0x1bc79b[_0x9da1('0x40')][_0x9da1('0xb4')]=_0x1c4269['id'];if(_0x34ea5d[_0x9da1('0x35')][_0x9da1('0x7c')]){_0x1bc79b['where']=_['merge'](_0x1bc79b[_0x9da1('0x40')],{'$or':_[_0x9da1('0x21')](_0x1bc79b[_0x9da1('0x39')],function(_0x3b0a84){var _0xd01f08={};_0xd01f08[_0x3b0a84]={'$like':'%'+_0x34ea5d['query']['filter']+'%'};return _0xd01f08;})});}if(_0x34ea5d[_0x9da1('0x35')][_0x9da1('0x73')]){var _0x49a7aa=_0x34ea5d[_0x9da1('0x35')]['$gte'][_0x9da1('0x62')](',');var _0xd68396={};_0xd68396[_0x49a7aa[0x0]]={'$gte':moment(_0x49a7aa[0x1])[_0x9da1('0xc1')](_0x9da1('0xc2'))};_0x1bc79b[_0x9da1('0x40')]=_[_0x9da1('0x97')](_0x1bc79b['where'],_0xd68396);}_0x1bc79b=_[_0x9da1('0x97')]({},_0x1bc79b,_0x34ea5d[_0x9da1('0xbb')]);return db[_0x9da1('0xc3')][_0x9da1('0x16')]({'where':_0x1bc79b['where']})[_0x9da1('0x1b')](function(_0x465713){_0x25021d[_0x9da1('0x16')]=_0x465713;if(_0x34ea5d['query']['includeAll']){_0x1bc79b[_0x9da1('0xc4')]=[{'all':!![]}];}return db[_0x9da1('0xc3')]['findAll'](_0x1bc79b);})['then'](function(_0x24650c){if(_0x34ea5d[_0x9da1('0x35')][_0x9da1('0xc5')]===_0x9da1('0xc6')){for(var _0x220358=0x0;_0x220358<_0x24650c['length'];_0x220358++){_0x24650c[_0x220358][_0x9da1('0xbd')]=juice(_0x24650c[_0x220358]['body']);}}_0x25021d[_0x9da1('0xc7')]=_0x24650c;return _0x25021d;});}})[_0x9da1('0x1b')](respondWithFilteredResult(_0x1dc626,_0x1bc79b))[_0x9da1('0xb7')](handleError(_0x1dc626,null));};exports[_0x9da1('0xc8')]=function(_0x5b7d11,_0x5c16b3){return db[_0x9da1('0xba')][_0x9da1('0x5a')]({'where':{'id':_0x5b7d11[_0x9da1('0xb9')]['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x5c16b3,null))[_0x9da1('0x1b')](function(_0x2fd38e){if(_0x2fd38e){return _0x2fd38e['setTags'](_0x5b7d11[_0x9da1('0xbd')][_0x9da1('0xbe')],_[_0x9da1('0xbf')](_0x5b7d11[_0x9da1('0xbd')],[_0x9da1('0xbe'),'id'])||{})[_0x9da1('0xc9')](function(){return db['Tag'][_0x9da1('0xca')]({'attributes':['id',_0x9da1('0x1f'),'color'],'where':{'id':_0x5b7d11['body']['ids']}});})[_0x9da1('0x1b')](function(_0x2d2aa3){socket[_0x9da1('0xcb')]('mailInteractionTags:save',{'id':Number(_0x5b7d11[_0x9da1('0xb9')]['id']),'tags':_0x2d2aa3||[]});return{'id':Number(_0x5b7d11[_0x9da1('0xb9')]['id']),'tags':_0x2d2aa3||[]};});}})[_0x9da1('0x1b')](respondWithResult(_0x5c16b3,null))[_0x9da1('0xb7')](handleError(_0x5c16b3,null));};exports[_0x9da1('0xcc')]=function(_0x5c31d2,_0x9765f2){return db['MailInteraction']['find']({'where':{'id':_0x5c31d2[_0x9da1('0xb9')]['id']}})[_0x9da1('0x1b')](handleEntityNotFound(_0x9765f2,null))[_0x9da1('0x1b')](function(_0x38c78b){if(_0x38c78b){return _0x38c78b[_0x9da1('0xcc')](_0x5c31d2['query'][_0x9da1('0xbe')]);}})[_0x9da1('0x1b')](respondWithStatusCode(_0x9765f2,null))[_0x9da1('0xb7')](handleError(_0x9765f2,null));};exports['download']=function(_0xa9f7c8,_0x29f1a8){var _0x3a8449=moment()[_0x9da1('0xcd')]()['toString']();var _0x38d638=path['join'](config[_0x9da1('0xce')],_0x9da1('0xcf'),_0x9da1('0xd0'),_0x9da1('0xd1'));var _0x3d9332=path['join'](config[_0x9da1('0xce')],_0x9da1('0xcf'),'files',_0x9da1('0xd2'));var _0x13f4b9=path[_0x9da1('0xd3')](_0x38d638,_0x3a8449);var _0x26b36a=util[_0x9da1('0xc1')]('transcript-%d-%s.zip',_0xa9f7c8[_0x9da1('0xb9')]['id'],_0x3a8449);var _0x46fb08=path[_0x9da1('0xd3')](_0x38d638,_0x26b36a);var _0x16d5aa=[];if(_0xa9f7c8[_0x9da1('0x35')][_0x9da1('0xd2')]){_0x16d5aa['push']({'model':db[_0x9da1('0xd4')],'as':'Attachments','raw':!![]});}var _0x1297ce=[{'model':db[_0x9da1('0xc3')],'as':_0x9da1('0xd5'),'attributes':['id',_0x9da1('0xbd'),_0x9da1('0x44'),'to','cc',_0x9da1('0xd6'),_0x9da1('0xd7'),_0x9da1('0x71')],'where':{'secret':![]},'order':qs[_0x9da1('0x3f')]('id'),'include':_0x16d5aa}];return db[_0x9da1('0xba')][_0x9da1('0x5a')]({'where':{'id':_0xa9f7c8[_0x9da1('0xb9')]['id']},'include':_0x1297ce})[_0x9da1('0x1b')](handleEntityNotFound(_0x29f1a8,null))['then'](function(_0x23b791){if(_0x23b791&&_0x23b791[_0x9da1('0xd5')]){var _0xefd8c1=_0x23b791[_0x9da1('0xd8')]({'plain':!![]});fs[_0x9da1('0xd9')](_0x13f4b9);return BPromise[_0x9da1('0xda')](_0xefd8c1[_0x9da1('0xd5')],function(_0x1a0f57,_0x38865e){var _0x4df006={'from':_0x1a0f57['from'],'to':_0x1a0f57['to'],'subject':_0x1a0f57[_0x9da1('0xd7')],'html':htmlEntities[_0x9da1('0xdb')](_0x1a0f57[_0x9da1('0xbd')]),'headers':{'Date':moment(_0x1a0f57[_0x9da1('0x71')])[_0x9da1('0xc1')](_0x9da1('0xdc'))},'attachments':[]};if(_0x1a0f57['cc']){_0x4df006[_0x9da1('0xdd')]['Cc']=_0x1a0f57['cc'];}if(_0x1a0f57[_0x9da1('0xd6')]){_0x4df006[_0x9da1('0xdd')][_0x9da1('0xde')]=_0x1a0f57[_0x9da1('0xd6')];}return new BPromise(function(_0xe5952c,_0x41a9d8){if(_0x1a0f57[_0x9da1('0xdf')]){for(var _0xdc1495=0x0;_0xdc1495<_0x1a0f57[_0x9da1('0xdf')][_0x9da1('0x3c')];_0xdc1495++){var _0x473a36=_0x1a0f57[_0x9da1('0xdf')][_0xdc1495];var _0x4eb804=path[_0x9da1('0xd3')](_0x3d9332,_0x473a36['basename']);if(fs[_0x9da1('0xe0')](_0x4eb804)){_0x4df006[_0x9da1('0xd2')][_0x9da1('0x24')]({'name':_0x473a36[_0x9da1('0x1f')],'contentType':_0x473a36['type'],'data':fs[_0x9da1('0xe1')](_0x4eb804)});}}}emlformat[_0x9da1('0xe2')](_0x4df006,function(_0x2cd3ba,_0x43eac1){if(_0x2cd3ba)return _0x41a9d8(_0x2cd3ba);fs[_0x9da1('0xe3')](path[_0x9da1('0xd3')](_0x13f4b9,util[_0x9da1('0xc1')](_0x9da1('0xe4'),_0x38865e)),_0x43eac1);return _0xe5952c(_0x43eac1);});});})['then'](function(){return new BPromise(function(_0x35d0b3,_0x3eab5d){zipdir(_0x13f4b9,{'saveTo':_0x46fb08},function(_0x22fe11,_0xb90c10){if(_0x22fe11)return _0x3eab5d(_0x22fe11);return _0x35d0b3(_0xb90c10);});})[_0x9da1('0x1b')](function(){return new BPromise(function(_0x4b9bf8,_0x991281){rimraf(_0x13f4b9,function(_0x4a4990){if(_0x4a4990)_0x991281(_0x4a4990);return _0x4b9bf8();});});})[_0x9da1('0x1b')](function(){return _0x29f1a8[_0x9da1('0xe5')](_0x46fb08,_0x26b36a,function(_0x34a17f){if(!_0x34a17f)fs[_0x9da1('0xe6')](_0x46fb08);});});});}else{return _0x29f1a8['sendStatus'](0xc8);}})[_0x9da1('0xb7')](handleError(_0x29f1a8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 485bb6f..5c42a81 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 _0x2ef7=['hasOwnProperty','hook','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x2ef7,0x182));var _0x72ef=function(_0x2dc387,_0x506fe8){_0x2dc387=_0x2dc387-0x0;var _0x4f48ef=_0x2ef7[_0x2dc387];return _0x4f48ef;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x72ef('0x0'))['db'][_0x72ef('0x1')];var MailMessage=require(_0x72ef('0x0'))['db'][_0x72ef('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x72ef('0x3')](0x0);var events={'afterCreate':_0x72ef('0x4'),'afterUpdate':'update','afterDestroy':_0x72ef('0x5')};function emitEvent(_0xc1d7fb){return function(_0x4cbb25,_0x341891,_0x57c607){_0x4cbb25[_0x72ef('0x6')]({'attributes':['id'],'raw':!![]})[_0x72ef('0x7')](function(_0x23b63f){_0x4cbb25[_0x72ef('0x8')](_0x72ef('0x9'),_0x23b63f[_0x72ef('0xa')](function(_0x1c8c51){return{'id':_0x1c8c51['id']};}));return MailMessage[_0x72ef('0xb')]({'where':{'MailInteractionId':_0x4cbb25['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72ef('0x7')](function(_0x172e19){_0x4cbb25[_0x72ef('0x8')]('unreadMessages',_0x172e19[_0x72ef('0xc')]);MailInteractionEvents[_0x72ef('0xd')](_0xc1d7fb+':'+_0x4cbb25['id'],_0x4cbb25);MailInteractionEvents[_0x72ef('0xd')](_0xc1d7fb,_0x4cbb25);_0x57c607(null);})['catch'](_0x57c607(null));};}for(var e in events){if(events[_0x72ef('0xe')](e)){var event=events[e];MailInteraction[_0x72ef('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x6d48=['getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0x6d48,0xca));var _0x86d4=function(_0x4318de,_0x32e804){_0x4318de=_0x4318de-0x0;var _0x57b497=_0x6d48[_0x4318de];return _0x57b497;};'use strict';var EventEmitter=require(_0x86d4('0x0'));var MailInteraction=require(_0x86d4('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x86d4('0x1'))['db'][_0x86d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x86d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x86d4('0x4'),'afterDestroy':_0x86d4('0x5')};function emitEvent(_0x51fc0c){return function(_0x68d9ba,_0xd499ae,_0x1ca25a){_0x68d9ba[_0x86d4('0x6')]({'attributes':['id'],'raw':!![]})[_0x86d4('0x7')](function(_0x22d98e){_0x68d9ba[_0x86d4('0x8')](_0x86d4('0x9'),_0x22d98e[_0x86d4('0xa')](function(_0x426119){return{'id':_0x426119['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x68d9ba['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1e00ca){_0x68d9ba[_0x86d4('0x8')](_0x86d4('0xb'),_0x1e00ca[_0x86d4('0xc')]);MailInteractionEvents[_0x86d4('0xd')](_0x51fc0c+':'+_0x68d9ba['id'],_0x68d9ba);MailInteractionEvents['emit'](_0x51fc0c,_0x68d9ba);_0x1ca25a(null);})['catch'](_0x1ca25a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x86d4('0xe')](e,emitEvent(event));}}module[_0x86d4('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6fbf5bf..8d22491 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 _0x3894=['../../config/environment','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','path'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x3894,0x1db));var _0x4389=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x3894[_0x26393b];return _0x57230a;};'use strict';var _=require(_0x4389('0x0'));var util=require(_0x4389('0x1'));var logger=require(_0x4389('0x2'))(_0x4389('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4389('0x4'));var rimraf=require('rimraf');var config=require(_0x4389('0x5'));var attributes=require(_0x4389('0x6'));module['exports']=function(_0x53d3c1,_0x63d44c){return _0x53d3c1['define']('MailInteraction',attributes,{'tableName':_0x4389('0x7'),'paranoid':![],'indexes':[{'name':_0x4389('0x8'),'fields':[_0x4389('0x9'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ad304,_0x1a170b,_0x15ab84){if(_0x3ad304[_0x4389('0xa')]){_0x3ad304[_0x4389('0xb')]=moment()[_0x4389('0xc')](_0x4389('0xd'));}if(_0x3ad304[_0x4389('0xe')]){_0x3ad304[_0x4389('0xf')]=moment()[_0x4389('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15ab84(null,_0x1a170b);},'beforeUpdate':function(_0x2472ed,_0x396df2,_0x4ae8fb){if(_0x2472ed['changed'](_0x4389('0xa'))){_0x2472ed[_0x4389('0xb')]=_0x2472ed['substatus']?moment()['format'](_0x4389('0xd')):null;}if(_0x2472ed[_0x4389('0x10')](_0x4389('0xe'))){_0x2472ed[_0x4389('0xf')]=moment()[_0x4389('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x2472ed['substatus']=null;_0x2472ed[_0x4389('0xb')]=null;}_0x4ae8fb(null,_0x2472ed);},'afterUpdate':function(_0x588391,_0x19f017,_0xee5d7f){var _0x2701bd=_0x53d3c1[_0x4389('0x11')];var _0x19c312=_0x588391[_0x4389('0x12')]({'plain':!![]});if(_0x19c312[_0x4389('0xe')]){return _0x2701bd[_0x4389('0x13')][_0x4389('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x19c312['id']}})[_0x4389('0x15')](function(){_0xee5d7f();})[_0x4389('0x16')](function(_0x138f7c){_0xee5d7f(_0x138f7c);});}else{_0xee5d7f();}}},'charset':_0x4389('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd632=['substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','closedAt','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','mail_interactions','FULLTEXT'];(function(_0x10e074,_0x21fe97){var _0x461094=function(_0x5414ea){while(--_0x5414ea){_0x10e074['push'](_0x10e074['shift']());}};_0x461094(++_0x21fe97);}(_0xd632,0x80));var _0x2d63=function(_0x5b083b,_0x145a9b){_0x5b083b=_0x5b083b-0x0;var _0x6c2225=_0xd632[_0x5b083b];return _0x6c2225;};'use strict';var _=require(_0x2d63('0x0'));var util=require('util');var logger=require(_0x2d63('0x1'))(_0x2d63('0x2'));var moment=require('moment');var BPromise=require(_0x2d63('0x3'));var rp=require(_0x2d63('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d63('0x5'));var config=require(_0x2d63('0x6'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x668be,_0x2fb446){return _0x668be[_0x2d63('0x7')]('MailInteraction',attributes,{'tableName':_0x2d63('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x2d63('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3bbdff,_0x200c20,_0x414b39){if(_0x3bbdff[_0x2d63('0xa')]){_0x3bbdff['substatusAt']=moment()[_0x2d63('0xb')](_0x2d63('0xc'));}if(_0x3bbdff[_0x2d63('0xd')]){_0x3bbdff['closedAt']=moment()[_0x2d63('0xb')](_0x2d63('0xc'));}_0x414b39(null,_0x200c20);},'beforeUpdate':function(_0x5e088b,_0x4c6178,_0x2271e9){if(_0x5e088b[_0x2d63('0xe')](_0x2d63('0xa'))){_0x5e088b[_0x2d63('0xf')]=_0x5e088b[_0x2d63('0xa')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5e088b[_0x2d63('0xe')](_0x2d63('0xd'))){_0x5e088b[_0x2d63('0x10')]=moment()[_0x2d63('0xb')](_0x2d63('0xc'));_0x5e088b[_0x2d63('0xa')]=null;_0x5e088b[_0x2d63('0xf')]=null;}_0x2271e9(null,_0x5e088b);},'afterUpdate':function(_0x49c76c,_0x26b06f,_0x50245b){var _0x5c1948=_0x668be[_0x2d63('0x11')];var _0x552020=_0x49c76c[_0x2d63('0x12')]({'plain':!![]});if(_0x552020[_0x2d63('0xd')]){return _0x5c1948['MailMessage'][_0x2d63('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x552020['id']}})[_0x2d63('0x14')](function(){_0x50245b();})['catch'](function(_0x34fa9f){_0x50245b(_0x34fa9f);});}else{_0x50245b();}}},'charset':_0x2d63('0x15'),'collate':_0x2d63('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3241675..ad74f3d 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 _0x22ed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','limit','info','UpdateMailInteraction','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x50fb3f,_0x4724f4){var _0x1ce4c3=function(_0x2cb60b){while(--_0x2cb60b){_0x50fb3f['push'](_0x50fb3f['shift']());}};_0x1ce4c3(++_0x4724f4);}(_0x22ed,0x1a9));var _0xd22e=function(_0x26ffd4,_0x46cf5b){_0x26ffd4=_0x26ffd4-0x0;var _0x5a38a8=_0x22ed[_0x26ffd4];return _0x5a38a8;};'use strict';var _=require(_0xd22e('0x0'));var util=require(_0xd22e('0x1'));var moment=require(_0xd22e('0x2'));var BPromise=require(_0xd22e('0x3'));var rs=require(_0xd22e('0x4'));var fs=require('fs');var Redis=require(_0xd22e('0x5'));var db=require(_0xd22e('0x6'))['db'];var utils=require(_0xd22e('0x7'));var logger=require(_0xd22e('0x8'))(_0xd22e('0x9'));var config=require(_0xd22e('0xa'));var jayson=require(_0xd22e('0xb'));var client=jayson['client'][_0xd22e('0xc')]({'port':0x232a});config[_0xd22e('0xd')]=_['defaults'](config[_0xd22e('0xd')],{'host':_0xd22e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd22e('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xb51f40,_0x57630d,_0x4bd798){return new BPromise(function(_0x54c27d,_0x15ad97){return client[_0xd22e('0xf')](_0xb51f40,_0x4bd798)[_0xd22e('0x10')](function(_0x1c57a9){logger['info'](_0xd22e('0x11'),_0x57630d,_0xd22e('0x12'));logger[_0xd22e('0x13')](_0xd22e('0x14'),_0x57630d,_0xd22e('0x12'),JSON[_0xd22e('0x15')](_0x1c57a9));if(_0x1c57a9['error']){if(_0x1c57a9[_0xd22e('0x16')][_0xd22e('0x17')]===0x1f4){logger[_0xd22e('0x16')]('MailInteraction,\x20%s,\x20%s',_0x57630d,_0x1c57a9[_0xd22e('0x16')]['message']);return _0x15ad97(_0x1c57a9[_0xd22e('0x16')][_0xd22e('0x18')]);}logger[_0xd22e('0x16')](_0xd22e('0x11'),_0x57630d,_0x1c57a9[_0xd22e('0x16')][_0xd22e('0x18')]);return _0x54c27d(_0x1c57a9[_0xd22e('0x16')][_0xd22e('0x18')]);}else{logger['info'](_0xd22e('0x11'),_0x57630d,_0xd22e('0x12'));_0x54c27d(_0x1c57a9[_0xd22e('0x19')][_0xd22e('0x18')]);}})[_0xd22e('0x1a')](function(_0x2ccd36){logger['error'](_0xd22e('0x11'),_0x57630d,_0x2ccd36);_0x15ad97(_0x2ccd36);});});}exports['UpdateMailInteraction']=function(_0x3a840c){var _0x4d70b6=this;return new Promise(function(_0x5898d1,_0x198189){return db['MailInteraction']['update'](_0x3a840c[_0xd22e('0x1b')],{'raw':_0x3a840c[_0xd22e('0x1c')]?_0x3a840c[_0xd22e('0x1c')][_0xd22e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a840c['options']?_0x3a840c[_0xd22e('0x1c')][_0xd22e('0x1e')]||null:null,'attributes':_0x3a840c[_0xd22e('0x1c')]?_0x3a840c['options'][_0xd22e('0x1f')]||null:null,'limit':_0x3a840c[_0xd22e('0x1c')]?_0x3a840c[_0xd22e('0x1c')][_0xd22e('0x20')]||null:null})['then'](function(_0x54058a){logger[_0xd22e('0x21')](_0xd22e('0x22'),_0x3a840c);logger[_0xd22e('0x13')](_0xd22e('0x22'),_0x3a840c,JSON[_0xd22e('0x15')](_0x54058a));_0x5898d1(_0x54058a);})[_0xd22e('0x1a')](function(_0x4b7ed5){logger[_0xd22e('0x16')](_0xd22e('0x22'),_0x4b7ed5[_0xd22e('0x18')],_0x3a840c);_0x198189(_0x4d70b6[_0xd22e('0x16')](0x1f4,_0x4b7ed5[_0xd22e('0x18')]));});});};exports[_0xd22e('0x23')]=function(_0x1ea198){return new Promise(function(_0x4b9424,_0x59bc61){return db[_0xd22e('0x24')][_0xd22e('0x25')]({'where':_0x1ea198[_0xd22e('0x1c')]?_0x1ea198[_0xd22e('0x1c')]['where']||null:null})['then'](function(_0x14c636){if(_0x14c636){return _0x14c636[_0xd22e('0x26')](_0x1ea198[_0xd22e('0x1b')][_0xd22e('0x27')],_[_0xd22e('0x28')](_0x1ea198[_0xd22e('0x1b')],['ids','id'])||{});}})[_0xd22e('0x29')](function(_0x510c90){logger['info']('AddTags',_0x1ea198);logger[_0xd22e('0x13')](_0xd22e('0x2a'),_0x1ea198,JSON[_0xd22e('0x15')](_0x510c90));_0x4b9424(_0x510c90);})[_0xd22e('0x1a')](function(_0x471a0d){logger[_0xd22e('0x16')]('AddTags',_0x471a0d['message'],_0x1ea198);_0x59bc61(_this[_0xd22e('0x16')](0x1f4,_0x471a0d[_0xd22e('0x18')]));});});}; \ No newline at end of file +var _0x3dec=['code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49448b,_0x1b0813){var _0x3f974c=function(_0x5bda34){while(--_0x5bda34){_0x49448b['push'](_0x49448b['shift']());}};_0x3f974c(++_0x1b0813);}(_0x3dec,0x8e));var _0xc3de=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0x3dec[_0x244e2d];return _0x3df084;};'use strict';var _=require(_0xc3de('0x0'));var util=require(_0xc3de('0x1'));var moment=require(_0xc3de('0x2'));var BPromise=require(_0xc3de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3de('0x4'))['db'];var utils=require(_0xc3de('0x5'));var logger=require('../../config/logger')(_0xc3de('0x6'));var config=require(_0xc3de('0x7'));var jayson=require(_0xc3de('0x8'));var client=jayson[_0xc3de('0x9')]['http']({'port':0x232a});config[_0xc3de('0xa')]=_[_0xc3de('0xb')](config[_0xc3de('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3de('0xc'))(new Redis(config[_0xc3de('0xa')]));require(_0xc3de('0xd'))[_0xc3de('0xe')](socket);function respondWithRpcPromise(_0x2588b8,_0x107c90,_0xa0af11){return new BPromise(function(_0x34a8e9,_0x3adec8){return client['request'](_0x2588b8,_0xa0af11)['then'](function(_0x251326){logger[_0xc3de('0xf')](_0xc3de('0x10'),_0x107c90,_0xc3de('0x11'));logger[_0xc3de('0x12')](_0xc3de('0x13'),_0x107c90,_0xc3de('0x11'),JSON[_0xc3de('0x14')](_0x251326));if(_0x251326[_0xc3de('0x15')]){if(_0x251326[_0xc3de('0x15')][_0xc3de('0x16')]===0x1f4){logger['error'](_0xc3de('0x10'),_0x107c90,_0x251326['error'][_0xc3de('0x17')]);return _0x3adec8(_0x251326[_0xc3de('0x15')]['message']);}logger[_0xc3de('0x15')](_0xc3de('0x10'),_0x107c90,_0x251326[_0xc3de('0x15')][_0xc3de('0x17')]);return _0x34a8e9(_0x251326[_0xc3de('0x15')][_0xc3de('0x17')]);}else{logger[_0xc3de('0xf')](_0xc3de('0x10'),_0x107c90,'request\x20sent');_0x34a8e9(_0x251326['result'][_0xc3de('0x17')]);}})[_0xc3de('0x18')](function(_0x45699c){logger[_0xc3de('0x15')](_0xc3de('0x10'),_0x107c90,_0x45699c);_0x3adec8(_0x45699c);});});}exports[_0xc3de('0x19')]=function(_0x2ebfd9){var _0x2a2d05=this;return new Promise(function(_0x18f5d4,_0xc0fae8){return db[_0xc3de('0x1a')][_0xc3de('0x1b')](_0x2ebfd9['body'],{'raw':_0x2ebfd9[_0xc3de('0x1c')]?_0x2ebfd9[_0xc3de('0x1c')][_0xc3de('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ebfd9[_0xc3de('0x1c')]?_0x2ebfd9[_0xc3de('0x1c')][_0xc3de('0x1e')]||null:null,'attributes':_0x2ebfd9[_0xc3de('0x1c')]?_0x2ebfd9[_0xc3de('0x1c')][_0xc3de('0x1f')]||null:null,'limit':_0x2ebfd9[_0xc3de('0x1c')]?_0x2ebfd9[_0xc3de('0x1c')][_0xc3de('0x20')]||null:null})[_0xc3de('0x21')](function(_0x7abed0){logger[_0xc3de('0xf')](_0xc3de('0x19'),_0x2ebfd9);logger[_0xc3de('0x12')](_0xc3de('0x19'),_0x2ebfd9,JSON[_0xc3de('0x14')](_0x7abed0));_0x18f5d4(_0x7abed0);})[_0xc3de('0x18')](function(_0x3b11ce){logger[_0xc3de('0x15')]('UpdateMailInteraction',_0x3b11ce[_0xc3de('0x17')],_0x2ebfd9);_0xc0fae8(_0x2a2d05[_0xc3de('0x15')](0x1f4,_0x3b11ce['message']));});});};exports[_0xc3de('0x22')]=function(_0x579b56){return new Promise(function(_0x2f89b8,_0x5ece11){return db[_0xc3de('0x1a')]['find']({'where':_0x579b56[_0xc3de('0x1c')]?_0x579b56[_0xc3de('0x1c')][_0xc3de('0x1e')]||null:null})[_0xc3de('0x21')](function(_0x12ba58){if(_0x12ba58){return _0x12ba58[_0xc3de('0x23')](_0x579b56[_0xc3de('0x24')][_0xc3de('0x25')],_[_0xc3de('0x26')](_0x579b56['body'],['ids','id'])||{});}})[_0xc3de('0x27')](function(_0x262bf8){logger[_0xc3de('0xf')](_0xc3de('0x28'),_0x579b56);logger[_0xc3de('0x12')](_0xc3de('0x28'),_0x579b56,JSON[_0xc3de('0x14')](_0x262bf8));_0x2f89b8(_0x262bf8);})[_0xc3de('0x18')](function(_0x539eb9){logger[_0xc3de('0x15')](_0xc3de('0x28'),_0x539eb9[_0xc3de('0x17')],_0x579b56);_0x5ece11(_this[_0xc3de('0x15')](0x1f4,_0x539eb9[_0xc3de('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0fb2988..8ce0260 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 _0x0acb=['remove','update','emit','removeListener','register','./mailInteraction.events','save'];(function(_0x17f124,_0x4e8a1b){var _0x248f97=function(_0x4e84b1){while(--_0x4e84b1){_0x17f124['push'](_0x17f124['shift']());}};_0x248f97(++_0x4e8a1b);}(_0x0acb,0x8a));var _0xb0ac=function(_0x415dec,_0x132ffb){_0x415dec=_0x415dec-0x0;var _0x40d4e9=_0x0acb[_0x415dec];return _0x40d4e9;};'use strict';var MailInteractionEvents=require(_0xb0ac('0x0'));var events=[_0xb0ac('0x1'),_0xb0ac('0x2'),_0xb0ac('0x3')];function createListener(_0x2cc2c0,_0x23331d){return function(_0x5eea53){_0x23331d[_0xb0ac('0x4')](_0x2cc2c0,_0x5eea53);};}function removeListener(_0x5b9ce1,_0x4612fb){return function(){MailInteractionEvents[_0xb0ac('0x5')](_0x5b9ce1,_0x4612fb);};}exports[_0xb0ac('0x6')]=function(_0x28ff4c){for(var _0x33dbf2=0x0,_0x30ddc9=events['length'];_0x33dbf2<_0x30ddc9;_0x33dbf2++){var _0x4eeafd=events[_0x33dbf2];var _0x19a800=createListener('mailInteraction:'+_0x4eeafd,_0x28ff4c);MailInteractionEvents['on'](_0x4eeafd,_0x19a800);}}; \ No newline at end of file +var _0xed38=['emit','removeListener','register','length','./mailInteraction.events','save','update'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0xed38,0x9e));var _0x8ed3=function(_0x3fc242,_0x2b69cd){_0x3fc242=_0x3fc242-0x0;var _0x405645=_0xed38[_0x3fc242];return _0x405645;};'use strict';var MailInteractionEvents=require(_0x8ed3('0x0'));var events=[_0x8ed3('0x1'),'remove',_0x8ed3('0x2')];function createListener(_0x790cb7,_0x537222){return function(_0x3c6afe){_0x537222[_0x8ed3('0x3')](_0x790cb7,_0x3c6afe);};}function removeListener(_0x1f7b00,_0x1b8e1d){return function(){MailInteractionEvents[_0x8ed3('0x4')](_0x1f7b00,_0x1b8e1d);};}exports[_0x8ed3('0x5')]=function(_0x3d3990){for(var _0x1724e8=0x0,_0x2b9ed8=events[_0x8ed3('0x6')];_0x1724e8<_0x2b9ed8;_0x1724e8++){var _0x523732=events[_0x1724e8];var _0x59ef73=createListener('mailInteraction:'+_0x523732,_0x3d3990);MailInteractionEvents['on'](_0x523732,_0x59ef73);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 21c3886..0c8d388 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 _0xa9cd=['show','/:id/download','download','post','mail','mailmessage:create','update','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0x34a818,_0x1d288a){var _0x5f480f=function(_0x554f41){while(--_0x554f41){_0x34a818['push'](_0x34a818['shift']());}};_0x5f480f(++_0x1d288a);}(_0xa9cd,0x187));var _0xda9c=function(_0x1befa2,_0x732d85){_0x1befa2=_0x1befa2-0x0;var _0x120c70=_0xa9cd[_0x1befa2];return _0x120c70;};'use strict';var multer=require(_0xda9c('0x0'));var util=require(_0xda9c('0x1'));var path=require(_0xda9c('0x2'));var timeout=require(_0xda9c('0x3'));var express=require(_0xda9c('0x4'));var router=express[_0xda9c('0x5')]();var fs_extra=require(_0xda9c('0x6'));var auth=require(_0xda9c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xda9c('0x8'));var controller=require(_0xda9c('0x9'));router[_0xda9c('0xa')]('/',auth[_0xda9c('0xb')](),controller[_0xda9c('0xc')]);router[_0xda9c('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xda9c('0xa')](_0xda9c('0xd'),auth[_0xda9c('0xb')](),controller[_0xda9c('0xe')]);router['get'](_0xda9c('0xf'),auth[_0xda9c('0xb')](),controller[_0xda9c('0x10')]);router[_0xda9c('0x11')]('/',auth[_0xda9c('0xb')](),interaction['tracked'](_0xda9c('0x12'),_0xda9c('0x13')),controller['create']);router['put'](_0xda9c('0xd'),auth[_0xda9c('0xb')](),controller[_0xda9c('0x14')]);router[_0xda9c('0x15')]('/:id/accept',auth[_0xda9c('0xb')](),controller['accept']);router['put'](_0xda9c('0x16'),auth[_0xda9c('0xb')](),controller[_0xda9c('0x17')]);router[_0xda9c('0x18')](_0xda9c('0xd'),auth['isAuthenticated'](),controller[_0xda9c('0x19')]);module[_0xda9c('0x1a')]=router; \ No newline at end of file +var _0x4cdf=['./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','update','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x4cdf,0x180));var _0xf4cd=function(_0x388811,_0x2525be){_0x388811=_0x388811-0x0;var _0x252cdb=_0x4cdf[_0x388811];return _0x252cdb;};'use strict';var multer=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var path=require(_0xf4cd('0x2'));var timeout=require(_0xf4cd('0x3'));var express=require(_0xf4cd('0x4'));var router=express[_0xf4cd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf4cd('0x6'));var interaction=require(_0xf4cd('0x7'));var config=require('../../config/environment');var controller=require(_0xf4cd('0x8'));router[_0xf4cd('0x9')]('/',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0xb')]);router[_0xf4cd('0x9')]('/describe',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0xc')]);router[_0xf4cd('0x9')](_0xf4cd('0xd'),auth['isAuthenticated'](),controller[_0xf4cd('0xe')]);router[_0xf4cd('0x9')](_0xf4cd('0xf'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x10')]);router[_0xf4cd('0x11')]('/',auth[_0xf4cd('0xa')](),interaction['tracked'](_0xf4cd('0x12'),_0xf4cd('0x13')),controller[_0xf4cd('0x14')]);router['put']('/:id',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x15')]);router[_0xf4cd('0x16')]('/:id/accept',auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x17')]);router[_0xf4cd('0x16')](_0xf4cd('0x18'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x19')]);router['delete'](_0xf4cd('0xd'),auth[_0xf4cd('0xa')](),controller[_0xf4cd('0x1a')]);module[_0xf4cd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f54e503..aecbafd 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 _0xc7db=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x328ab2,_0x4dfd97){var _0x5e8a9=function(_0x434654){while(--_0x434654){_0x328ab2['push'](_0x328ab2['shift']());}};_0x5e8a9(++_0x4dfd97);}(_0xc7db,0x197));var _0xbc7d=function(_0x548ac1,_0x27178f){_0x548ac1=_0x548ac1-0x0;var _0x89687b=_0xc7db[_0x548ac1];return _0x89687b;};'use strict';var Sequelize=require(_0xbc7d('0x0'));var _=require(_0xbc7d('0x1'));module[_0xbc7d('0x2')]={'body':{'type':Sequelize[_0xbc7d('0x3')](_0xbc7d('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbc7d('0x3')](_0xbc7d('0x5'))},'read':{'type':Sequelize[_0xbc7d('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc7d('0x7')]('in',_0xbc7d('0x8')),'defaultValue':_0xbc7d('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xbc7d('0x3')](_0xbc7d('0x4'))},'cc':{'type':Sequelize[_0xbc7d('0x3')](_0xbc7d('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xbc7d('0x3')]},'sentAt':{'type':Sequelize[_0xbc7d('0x9')]},'attach':{'type':Sequelize[_0xbc7d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xbc7d('0x3')](_0xbc7d('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xbc7d('0x4'))},'originChannel':{'type':Sequelize[_0xbc7d('0x7')](_0xbc7d('0xb'),_0xbc7d('0xc')),'defaultValue':_0xbc7d('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xf58a=['BOOLEAN','ENUM','out','STRING','TEXT','DATE','INTEGER','Email','Chat','long'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xf58a,0x18f));var _0xaf58=function(_0x1e83d7,_0x47e926){_0x1e83d7=_0x1e83d7-0x0;var _0x210b5e=_0xf58a[_0x1e83d7];return _0x210b5e;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0xaf58('0x0')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xaf58('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf58('0x2')]('in',_0xaf58('0x3')),'defaultValue':_0xaf58('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf58('0x4')](0x1fe)},'from':{'type':Sequelize[_0xaf58('0x4')]},'to':{'type':Sequelize['TEXT'](_0xaf58('0x0'))},'cc':{'type':Sequelize[_0xaf58('0x5')](_0xaf58('0x0'))},'bcc':{'type':Sequelize[_0xaf58('0x5')](_0xaf58('0x0'))},'subject':{'type':Sequelize[_0xaf58('0x5')]},'sentAt':{'type':Sequelize[_0xaf58('0x6')]},'attach':{'type':Sequelize[_0xaf58('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaf58('0x1')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf58('0x6')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xaf58('0x5')](_0xaf58('0x0'))},'originChannel':{'type':Sequelize[_0xaf58('0x2')](_0xaf58('0x8'),_0xaf58('0x9')),'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 8d85822..7c24a14 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 _0xe58e=['headers','Bcc','existsSync','build','writeFileSync','eml-format','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','then','destroy','sendStatus','stack','name','send','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','where','filter','merge','VIRTUAL','includeAll','include','MailMessage','rows','show','params','rawAttributes','options','find','update','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','Contacts','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','motionChannel','channel','event','fromString','EventManager','acceptmessage','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','internal','reject','rejectmessage','download','unix','toString','server','files','root','bcc','subject','Attachment','Attachments','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x229cb4,_0x3980b4){var _0x429401=function(_0x5745ff){while(--_0x5745ff){_0x229cb4['push'](_0x229cb4['shift']());}};_0x429401(++_0x3980b4);}(_0xe58e,0x1e2));var _0xee58=function(_0x17eae1,_0x528337){_0x17eae1=_0x17eae1-0x0;var _0x23c2a4=_0xe58e[_0x17eae1];return _0x23c2a4;};'use strict';var emlformat=require(_0xee58('0x0'));var moment=require('moment');var BPromise=require(_0xee58('0x1'));var util=require(_0xee58('0x2'));var path=require(_0xee58('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xee58('0x4'));var htmlToText=require(_0xee58('0x5'));var qs=require(_0xee58('0x6'));var logger=require(_0xee58('0x7'))(_0xee58('0x8'));var interaction_log=require('../../config/logger')(_0xee58('0x9'));var config=require(_0xee58('0xa'));var db=require(_0xee58('0xb'))['db'];config[_0xee58('0xc')]=_[_0xee58('0xd')](config[_0xee58('0xc')],{'host':_0xee58('0xe'),'port':0x18eb});var socket=require(_0xee58('0xf'))(new Redis(config[_0xee58('0xc')]));var htmlEntities=require(_0xee58('0x10'));require('./mailMessage.socket')[_0xee58('0x11')](socket);var jayson=require(_0xee58('0x12'));var client=jayson[_0xee58('0x13')]['http']({'port':0x232c});var client9003=jayson[_0xee58('0x13')]['http']({'port':0x232b});var client9002=jayson[_0xee58('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8769,_0x58656f,_0x43d055,_0x4ebd66){return new BPromise(function(_0x388f4b,_0x103bed){var _0x26df23=_0x4ebd66||client;return _0x26df23[_0xee58('0x14')](_0x3c8769,_0x43d055)['then'](function(_0x2eeee1){logger[_0xee58('0x15')]('MailMessage,\x20%s,\x20%s',_0x58656f,_0xee58('0x16'));logger[_0xee58('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x58656f,_0xee58('0x16'),JSON[_0xee58('0x18')](_0x2eeee1));if(_0x2eeee1[_0xee58('0x19')]){if(_0x2eeee1['error'][_0xee58('0x1a')]===0x1f4){logger[_0xee58('0x19')](_0xee58('0x1b'),_0x58656f,_0x2eeee1['error'][_0xee58('0x1c')]);return _0x103bed(_0x2eeee1['error'][_0xee58('0x1c')]);}logger['error'](_0xee58('0x1b'),_0x58656f,_0x2eeee1['error']['message']);return _0x388f4b(_0x2eeee1['error']['message']);}else{logger[_0xee58('0x15')](_0xee58('0x1b'),_0x58656f,'request\x20sent');_0x388f4b(_0x2eeee1['result']['message']);}})[_0xee58('0x1d')](function(_0x1b236a){logger['error'](_0xee58('0x1b'),_0x58656f,_0x1b236a);_0x103bed(_0x1b236a);});});}function respondWithResult(_0x5d71de,_0x40299a){_0x40299a=_0x40299a||0xc8;return function(_0x3a2ab3){if(_0x3a2ab3){return _0x5d71de[_0xee58('0x1e')](_0x40299a)[_0xee58('0x1f')](_0x3a2ab3);}};}function respondWithFilteredResult(_0x57d608,_0x1ade51){return function(_0x3d5cbf){if(_0x3d5cbf){var _0x1ee60a=typeof _0x1ade51[_0xee58('0x20')]===_0xee58('0x21')&&typeof _0x1ade51[_0xee58('0x22')]===_0xee58('0x21');var _0x537731=_0x3d5cbf[_0xee58('0x23')];var _0x37bd0f=_0x1ee60a?0x0:_0x1ade51[_0xee58('0x20')];var _0x15b036=_0x1ee60a?_0x3d5cbf['count']:_0x1ade51[_0xee58('0x20')]+_0x1ade51['limit'];var _0x644954;if(_0x15b036>=_0x537731){_0x15b036=_0x537731;_0x644954=0xc8;}else{_0x644954=0xce;}_0x57d608[_0xee58('0x1e')](_0x644954);return _0x57d608[_0xee58('0x24')]('Content-Range',_0x37bd0f+'-'+_0x15b036+'/'+_0x537731)['json'](_0x3d5cbf);}return null;};}function saveUpdates(_0x53ec08){return function(_0x2ace20){if(_0x2ace20){return _0x2ace20['update'](_0x53ec08)[_0xee58('0x25')](function(_0x4353ea){return _0x4353ea;});}return null;};}function removeEntity(_0x311201){return function(_0x1a9074){if(_0x1a9074){return _0x1a9074[_0xee58('0x26')]()['then'](function(){_0x311201[_0xee58('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160406){return function(_0x4b450a){if(!_0x4b450a){_0x160406[_0xee58('0x27')](0x194);}return _0x4b450a;};}function handleError(_0x439bdf,_0x1285ae){_0x1285ae=_0x1285ae||0x1f4;return function(_0x2ceb5d){logger[_0xee58('0x19')](_0x2ceb5d[_0xee58('0x28')]);if(_0x2ceb5d[_0xee58('0x29')]){delete _0x2ceb5d[_0xee58('0x29')];}_0x439bdf[_0xee58('0x1e')](_0x1285ae)[_0xee58('0x2a')](_0x2ceb5d);};}exports['index']=function(_0x11de9b,_0x1f014d){var _0x358f53={},_0x38c559={},_0x198504={'count':0x0,'rows':[]};var _0x3703e9=_[_0xee58('0x2b')](db['MailMessage']['rawAttributes'],function(_0x17b9f6){return{'name':_0x17b9f6['fieldName'],'type':_0x17b9f6[_0xee58('0x2c')][_0xee58('0x2d')]};});_0x38c559[_0xee58('0x2e')]=_[_0xee58('0x2b')](_0x3703e9,'name');_0x38c559[_0xee58('0x2f')]=_[_0xee58('0x30')](_0x11de9b[_0xee58('0x2f')]);_0x38c559[_0xee58('0x31')]=_[_0xee58('0x32')](_0x38c559[_0xee58('0x2e')],_0x38c559[_0xee58('0x2f')]);_0x358f53['attributes']=_[_0xee58('0x32')](_0x38c559[_0xee58('0x2e')],qs[_0xee58('0x33')](_0x11de9b[_0xee58('0x2f')][_0xee58('0x33')]));_0x358f53[_0xee58('0x34')]=_0x358f53[_0xee58('0x34')][_0xee58('0x35')]?_0x358f53[_0xee58('0x34')]:_0x38c559[_0xee58('0x2e')];if(!_0x11de9b[_0xee58('0x2f')]['hasOwnProperty']('nolimit')){_0x358f53[_0xee58('0x22')]=qs['limit'](_0x11de9b[_0xee58('0x2f')][_0xee58('0x22')]);_0x358f53[_0xee58('0x20')]=qs[_0xee58('0x20')](_0x11de9b[_0xee58('0x2f')][_0xee58('0x20')]);}_0x358f53[_0xee58('0x36')]=qs['sort'](_0x11de9b['query']['sort']);_0x358f53[_0xee58('0x37')]=qs[_0xee58('0x31')](_['pick'](_0x11de9b[_0xee58('0x2f')],_0x38c559['filters']),_0x3703e9);if(_0x11de9b[_0xee58('0x2f')][_0xee58('0x38')]){_0x358f53['where']=_[_0xee58('0x39')](_0x358f53[_0xee58('0x37')],{'$or':_[_0xee58('0x2b')](_0x3703e9,function(_0x5b3dd8){if(_0x5b3dd8[_0xee58('0x2c')]!==_0xee58('0x3a')){var _0x2282ac={};_0x2282ac[_0x5b3dd8[_0xee58('0x29')]]={'$like':'%'+_0x11de9b[_0xee58('0x2f')][_0xee58('0x38')]+'%'};return _0x2282ac;}})});}_0x358f53=_[_0xee58('0x39')]({},_0x358f53,_0x11de9b['options']);var _0x528b7a={'where':_0x358f53[_0xee58('0x37')]};return db['MailMessage'][_0xee58('0x23')](_0x528b7a)[_0xee58('0x25')](function(_0x585ad4){_0x198504[_0xee58('0x23')]=_0x585ad4;if(_0x11de9b[_0xee58('0x2f')][_0xee58('0x3b')]){_0x358f53[_0xee58('0x3c')]=[{'all':!![]}];}return db[_0xee58('0x3d')]['findAll'](_0x358f53);})[_0xee58('0x25')](function(_0x1761b0){_0x198504[_0xee58('0x3e')]=_0x1761b0;return _0x198504;})[_0xee58('0x25')](respondWithFilteredResult(_0x1f014d,_0x358f53))[_0xee58('0x1d')](handleError(_0x1f014d,null));};exports[_0xee58('0x3f')]=function(_0x2393d8,_0x1c80f1){var _0x230fa6={'raw':!![],'where':{'id':_0x2393d8[_0xee58('0x40')]['id']}},_0x5a5081={};_0x5a5081[_0xee58('0x2e')]=_['keys'](db[_0xee58('0x3d')][_0xee58('0x41')]);_0x5a5081[_0xee58('0x2f')]=_[_0xee58('0x30')](_0x2393d8[_0xee58('0x2f')]);_0x5a5081[_0xee58('0x31')]=_[_0xee58('0x32')](_0x5a5081[_0xee58('0x2e')],_0x5a5081[_0xee58('0x2f')]);_0x230fa6[_0xee58('0x34')]=_[_0xee58('0x32')](_0x5a5081[_0xee58('0x2e')],qs[_0xee58('0x33')](_0x2393d8[_0xee58('0x2f')][_0xee58('0x33')]));_0x230fa6[_0xee58('0x34')]=_0x230fa6[_0xee58('0x34')][_0xee58('0x35')]?_0x230fa6[_0xee58('0x34')]:_0x5a5081[_0xee58('0x2e')];if(_0x2393d8[_0xee58('0x2f')][_0xee58('0x3b')]){_0x230fa6[_0xee58('0x3c')]=[{'all':!![]}];}_0x230fa6=_[_0xee58('0x39')]({},_0x230fa6,_0x2393d8[_0xee58('0x42')]);return db[_0xee58('0x3d')][_0xee58('0x43')](_0x230fa6)[_0xee58('0x25')](handleEntityNotFound(_0x1c80f1,null))['then'](respondWithResult(_0x1c80f1,null))['catch'](handleError(_0x1c80f1,null));};exports[_0xee58('0x44')]=function(_0x3619a0,_0x435654){if(_0x3619a0[_0xee58('0x45')]['id']){delete _0x3619a0[_0xee58('0x45')]['id'];}return db[_0xee58('0x3d')][_0xee58('0x43')]({'where':{'id':_0x3619a0[_0xee58('0x40')]['id']}})[_0xee58('0x25')](handleEntityNotFound(_0x435654,null))['then'](saveUpdates(_0x3619a0[_0xee58('0x45')],null))[_0xee58('0x25')](respondWithResult(_0x435654,null))['catch'](handleError(_0x435654,null));};exports[_0xee58('0x26')]=function(_0x2dd8f6,_0x1a7b8e){return db[_0xee58('0x3d')]['find']({'where':{'id':_0x2dd8f6[_0xee58('0x40')]['id']}})[_0xee58('0x25')](handleEntityNotFound(_0x1a7b8e,null))[_0xee58('0x25')](removeEntity(_0x1a7b8e,null))[_0xee58('0x1d')](handleError(_0x1a7b8e,null));};exports[_0xee58('0x46')]=function(_0x349407,_0x299f55){return db['MailMessage'][_0xee58('0x46')]()[_0xee58('0x25')](respondWithResult(_0x299f55,null))[_0xee58('0x1d')](handleError(_0x299f55,null));};exports[_0xee58('0x47')]=function(_0x599bb3,_0x37a99e){return db['MailMessage'][_0xee58('0x47')](_0x599bb3[_0xee58('0x45')])['then'](function(_0x13ae68){if(_0x13ae68){if(_0x13ae68[_0xee58('0x48')]===_0xee58('0x49')&&!_0x13ae68[_0xee58('0x4a')]){var _0x3316a3,_0x36e00c,_0x347de9;if(_0x599bb3['body']['to']){_0x36e00c=_0x599bb3[_0xee58('0x45')]['to'][_0xee58('0x4b')](',')[0x0];}return db[_0xee58('0x4c')]['findOne']({'where':{'id':_0x13ae68[_0xee58('0x4d')]},'include':[{'model':db[_0xee58('0x4e')],'as':_0xee58('0x4f'),'include':[{'model':db[_0xee58('0x50')],'as':'Contacts','where':{'email':_0x36e00c},'limit':0x1,'order':[[_0xee58('0x51'),_0xee58('0x52')]]}]},{'model':db[_0xee58('0x53')],'as':_0xee58('0x54'),'raw':!![]}]})[_0xee58('0x25')](function(_0x15e555){_0x3316a3=_0x15e555;if(_0x3316a3&&_0x3316a3[_0xee58('0x54')]){var _0x9bec23={'tls':{'rejectUnauthorized':![]}};if(_[_0xee58('0x55')](_0x3316a3['Smtp'][_0xee58('0x56')])){_0x9bec23[_0xee58('0x57')]=_0x3316a3['Smtp'][_0xee58('0x57')];_0x9bec23['port']=_0x3316a3[_0xee58('0x54')]['port'];_0x9bec23[_0xee58('0x58')]=_0x3316a3['Smtp']['secure'];if(_0x3316a3[_0xee58('0x54')][_0xee58('0x59')]){_0x9bec23[_0xee58('0x5a')]={'user':_0x3316a3[_0xee58('0x54')][_0xee58('0x5b')],'pass':_0x3316a3[_0xee58('0x54')][_0xee58('0x5c')]};}}else{_0x9bec23[_0xee58('0x56')]=_0x3316a3[_0xee58('0x54')][_0xee58('0x56')];_0x9bec23[_0xee58('0x5a')]={'user':_0x3316a3[_0xee58('0x54')][_0xee58('0x5b')],'pass':_0x3316a3[_0xee58('0x54')][_0xee58('0x5c')]};_0x9bec23['secure']=_0x3316a3[_0xee58('0x54')]['secure'];}if(_0x599bb3['body'][_0xee58('0x5d')]&&_0x599bb3['body'][_0xee58('0x5d')]['length']){for(var _0x495f85=0x0;_0x495f85<_0x599bb3[_0xee58('0x45')][_0xee58('0x5d')][_0xee58('0x35')];_0x495f85+=0x1){_0x599bb3[_0xee58('0x45')][_0xee58('0x5d')][_0x495f85]={'filename':_0x599bb3[_0xee58('0x45')][_0xee58('0x5d')][_0x495f85][_0xee58('0x29')],'path':path[_0xee58('0x5e')](config['root'],_0xee58('0x5f'),_0x599bb3[_0xee58('0x45')][_0xee58('0x5d')][_0x495f85][_0xee58('0x60')])};}}_0x347de9={'account':_0x9bec23,'message':_0x599bb3[_0xee58('0x45')]};return;}})[_0xee58('0x25')](function(){if(_0x3316a3['List']){if(_0x3316a3[_0xee58('0x4f')][_0xee58('0x61')][_0xee58('0x35')]){return _0x3316a3[_0xee58('0x4f')][_0xee58('0x61')][0x0];}else{return db[_0xee58('0x50')]['create'](_[_0xee58('0xd')](_0x599bb3[_0xee58('0x45')],{'firstName':_0x599bb3['body']['to'],'email':_0x599bb3['body']['to'],'phone':_0x599bb3[_0xee58('0x45')]['to'],'ListId':_0x3316a3['ListId']}));}}else{throw new Error(_0xee58('0x62'));}})['then'](function(){if(_0x347de9){return respondWithRpcPromise(_0xee58('0x63'),_0xee58('0x64'),_0x347de9,client9003)[_0xee58('0x25')](function(_0x7b3ae){return _0x13ae68[_0xee58('0x44')]({'read':!![],'messageId':_0x7b3ae['messageId'],'sentAt':moment()[_0xee58('0x65')](_0xee58('0x66'))});})[_0xee58('0x1d')](function(_0x47aea4){logger[_0xee58('0x19')]('%s',JSON[_0xee58('0x18')](_0x47aea4));return _0x13ae68;});}return _0x13ae68;});}return _0x13ae68;}})['then'](respondWithResult(_0x37a99e,0xc9))[_0xee58('0x1d')](handleError(_0x37a99e,null));};exports[_0xee58('0x67')]=function(_0x23c0b4,_0x36db3f){var _0xe8f889={'agent':{},'channel':_0xee58('0x68')};if(_0x23c0b4[_0xee58('0x45')]['id']){delete _0x23c0b4[_0xee58('0x45')]['id'];}_0x23c0b4['body'][_0xee58('0x69')]=!![];_0x23c0b4['body'][_0xee58('0x6a')]=moment()[_0xee58('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x23c0b4[_0xee58('0x45')]['UserId']=_0x23c0b4['body'][_0xee58('0x6b')]||_0x23c0b4[_0xee58('0x5b')]['id'];_0xe8f889[_0xee58('0x6c')]['id']=_0x23c0b4[_0xee58('0x45')][_0xee58('0x6b')];return db[_0xee58('0x3d')][_0xee58('0x43')]({'where':{'id':_0x23c0b4[_0xee58('0x40')]['id'],'UserId':null}})[_0xee58('0x25')](handleEntityNotFound(_0x36db3f,null))[_0xee58('0x25')](saveUpdates(_0x23c0b4[_0xee58('0x45')],null))[_0xee58('0x25')](function(_0x38ab5e){if(_0x38ab5e){_0xe8f889[_0xee58('0x1c')]=_0x38ab5e[_0xee58('0x6d')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x38ab5e['MailInteractionId']}});}return null;})[_0xee58('0x25')](handleEntityNotFound(_0x36db3f,null))[_0xee58('0x25')](function(_0x345416){if(_0x345416){return _0x345416[_0xee58('0x44')]({'UserId':_0x23c0b4[_0xee58('0x45')][_0xee58('0x6b')],'read1stAt':_[_0xee58('0x55')](_0x345416['read1stAt'])?moment()['format'](_0xee58('0x66')):undefined});}return null;})[_0xee58('0x25')](function(_0x5047ab){if(_0x5047ab){_0xe8f889['interaction']=_0x5047ab['get']({'plain':!![]});interaction_log['info'](_0xee58('0x6e'),_0x23c0b4[_0xee58('0x5b')]['id'],_0x23c0b4[_0xee58('0x5b')]['name'],_0x23c0b4[_0xee58('0x5b')]['role'],_0xe8f889[_0xee58('0x6f')]['id'],_0x23c0b4['body']?JSON['stringify'](_0x23c0b4['body']):_0xee58('0x70'));return respondWithRpcPromise(_0xee58('0x71'),_0xee58('0x72'),_0xe8f889);}return null;})[_0xee58('0x25')](function(_0x48d36e){var _0x7893df=_0xee58('0x73')+_0x48d36e[_0xee58('0x1c')]['ContactId'];return db[_0xee58('0x74')][_0xee58('0x2f')](_0x7893df,{'type':db[_0xee58('0x75')][_0xee58('0x76')][_0xee58('0x77')],'raw':!![]})[_0xee58('0x25')](function(_0x9d956f){return _0x9d956f;});})[_0xee58('0x25')](function(_0x34281d){if(_0x34281d){_0xe8f889['message'][_0xee58('0x78')]=_0x34281d[0x0];if(!_0x23c0b4[_0xee58('0x45')][_0xee58('0x6b')])return;return db[_0xee58('0x79')][_0xee58('0x43')]({'where':{'id':_0x23c0b4[_0xee58('0x45')][_0xee58('0x6b')],'role':_0xee58('0x6c')},'attributes':['id',_0xee58('0x29'),'fullname',_0xee58('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3f45a0){if(!_0x3f45a0)return null;_0xe8f889[_0xee58('0x1c')][_0xee58('0x6c')]=_0x3f45a0;return _0xe8f889;})[_0xee58('0x25')](function(_0x151b19){if(_0x151b19){if(_0x23c0b4[_0xee58('0x45')][_0xee58('0x7b')]){_0xe8f889[_0xee58('0x1c')][_0xee58('0x7c')]=util[_0xee58('0x65')](_0xee58('0x7d'),_0x23c0b4[_0xee58('0x5b')][_0xee58('0x29')]);_0xe8f889['message']['channel']=_0xe8f889['channel'];_0xe8f889[_0xee58('0x1c')][_0xee58('0x7e')]=_0xe8f889[_0xee58('0x7f')];_0xe8f889[_0xee58('0x1c')][_0xee58('0x80')]=_0xee58('0x67');_0xe8f889[_0xee58('0x1c')][_0xee58('0x45')]=htmlToText[_0xee58('0x81')](_0xe8f889[_0xee58('0x1c')][_0xee58('0x45')]);return respondWithRpcPromise(_0xee58('0x82'),'EventManager',{'event':_0xee58('0x83'),'message':_0xe8f889[_0xee58('0x1c')]},client9002)['then'](function(){return _0xe8f889;});}return _0xe8f889;}return null;})[_0xee58('0x25')](respondWithResult(_0x36db3f,null))[_0xee58('0x1d')](handleError(_0x36db3f,null));};exports['reject']=function(_0x40e846,_0x36b014){var _0x3ad5e9={'agent':{},'channel':_0xee58('0x68')};if(_0x40e846[_0xee58('0x45')]['id']){delete _0x40e846[_0xee58('0x45')]['id'];}_0x40e846['body'][_0xee58('0x6b')]=_0x40e846['body']['UserId']||_0x40e846[_0xee58('0x5b')]['id'];_0x3ad5e9['agent']['id']=_0x40e846[_0xee58('0x45')][_0xee58('0x6b')];return db[_0xee58('0x3d')]['find']({'where':{'id':_0x40e846['params']['id'],'UserId':null}})[_0xee58('0x25')](handleEntityNotFound(_0x36b014,null))['then'](function(_0x453379){if(_0x453379){_0x3ad5e9[_0xee58('0x1c')]=_0x453379[_0xee58('0x6d')]({'plain':!![]});return db[_0xee58('0x84')][_0xee58('0x43')]({'where':{'id':_0x453379[_0xee58('0x85')]}});}return null;})[_0xee58('0x25')](handleEntityNotFound(_0x36b014,null))[_0xee58('0x25')](function(_0x5c3b59){if(_0x5c3b59){_0x3ad5e9[_0xee58('0x6f')]=_0x5c3b59['get']({'plain':!![]});interaction_log[_0xee58('0x15')](_0xee58('0x86'),_0x40e846[_0xee58('0x5b')]['id'],_0x40e846[_0xee58('0x5b')][_0xee58('0x29')],_0x40e846[_0xee58('0x5b')][_0xee58('0x87')],_0x3ad5e9[_0xee58('0x6f')]['id'],_0x40e846['body']?JSON[_0xee58('0x18')](_0x40e846[_0xee58('0x45')]):_0xee58('0x70'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3ad5e9);}return null;})[_0xee58('0x25')](function(_0x2748d0){var _0x3b5f10='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2748d0[_0xee58('0x1c')][_0xee58('0x88')];return db[_0xee58('0x74')][_0xee58('0x2f')](_0x3b5f10,{'type':db[_0xee58('0x75')][_0xee58('0x76')][_0xee58('0x77')],'raw':!![]})[_0xee58('0x25')](function(_0x5ebebd){return _0x5ebebd;});})[_0xee58('0x25')](function(_0x2ac080){if(_0x2ac080){_0x3ad5e9['message'][_0xee58('0x78')]=_0x2ac080[0x0];if(!_0x40e846[_0xee58('0x45')]['UserId'])return;return db[_0xee58('0x79')][_0xee58('0x43')]({'where':{'id':_0x40e846[_0xee58('0x45')][_0xee58('0x6b')],'role':_0xee58('0x6c')},'attributes':['id',_0xee58('0x29'),'fullname',_0xee58('0x7a'),_0xee58('0x89')],'raw':!![]});}return null;})['then'](function(_0x8c87ec){if(!_0x8c87ec)return null;_0x3ad5e9['message'][_0xee58('0x6c')]=_0x8c87ec;return _0x3ad5e9;})[_0xee58('0x25')](function(_0x287600){if(_0x287600){_0x287600[_0xee58('0x1c')][_0xee58('0x7c')]=util[_0xee58('0x65')](_0xee58('0x7d'),_0x40e846['user'][_0xee58('0x29')]);_0x287600[_0xee58('0x1c')][_0xee58('0x7f')]=_0x3ad5e9['channel'];_0x287600['message'][_0xee58('0x7e')]=_0x3ad5e9[_0xee58('0x7f')];_0x287600[_0xee58('0x1c')][_0xee58('0x80')]=_0xee58('0x8a');_0x287600[_0xee58('0x1c')][_0xee58('0x45')]=htmlToText[_0xee58('0x81')](_0x3ad5e9['message'][_0xee58('0x45')]);respondWithRpcPromise(_0xee58('0x82'),_0xee58('0x82'),{'event':_0xee58('0x8b'),'message':_0x287600[_0xee58('0x1c')]},client9002);return _0x3ad5e9;}return null;})['then'](respondWithResult(_0x36b014,null))[_0xee58('0x1d')](handleError(_0x36b014,null));};exports[_0xee58('0x8c')]=function(_0x55e5c2,_0x45889e){var _0x572169=moment()[_0xee58('0x8d')]()[_0xee58('0x8e')]();var _0x5dd670=path[_0xee58('0x5e')](config['root'],_0xee58('0x8f'),_0xee58('0x90'),'tmp');var _0x25e8a9=path[_0xee58('0x5e')](config[_0xee58('0x91')],'server',_0xee58('0x90'),_0xee58('0x5d'));var _0x130378=util[_0xee58('0x65')]('message-%s.eml',_0x572169);return db[_0xee58('0x3d')][_0xee58('0x43')]({'where':{'id':_0x55e5c2[_0xee58('0x40')]['id']},'attributes':['id',_0xee58('0x45'),'from','to','cc',_0xee58('0x92'),_0xee58('0x93'),'createdAt'],'include':_0x55e5c2[_0xee58('0x2f')][_0xee58('0x5d')]?[{'model':db[_0xee58('0x94')],'as':_0xee58('0x95')}]:undefined})[_0xee58('0x25')](handleEntityNotFound(_0x45889e,null))['then'](function(_0x47a8e3){if(_0x47a8e3){var _0x2d5c5e=_0x47a8e3;var _0x328e6b={'from':_0x2d5c5e[_0xee58('0x96')],'to':_0x2d5c5e['to'],'subject':_0x2d5c5e[_0xee58('0x93')],'html':htmlEntities[_0xee58('0x97')](_0x2d5c5e[_0xee58('0x45')]),'headers':{'Date':moment(_0x2d5c5e[_0xee58('0x98')])[_0xee58('0x65')](_0xee58('0x99'))},'attachments':[]};if(_0x47a8e3['cc']){_0x328e6b[_0xee58('0x9a')]['Cc']=_0x47a8e3['cc'];}if(_0x47a8e3['bcc']){_0x328e6b[_0xee58('0x9a')][_0xee58('0x9b')]=_0x47a8e3['bcc'];}return new BPromise(function(_0x13503a,_0x514345){if(_0x47a8e3[_0xee58('0x95')]){for(var _0x13dd64=0x0;_0x13dd64<_0x47a8e3['Attachments']['length'];_0x13dd64++){var _0x16347f=_0x47a8e3['Attachments'][_0x13dd64];var _0x3f91d4=path['join'](_0x25e8a9,_0x16347f[_0xee58('0x60')]);if(fs[_0xee58('0x9c')](_0x3f91d4)){_0x328e6b[_0xee58('0x5d')]['push']({'name':_0x16347f[_0xee58('0x29')],'contentType':_0x16347f[_0xee58('0x2c')],'data':fs['readFileSync'](_0x3f91d4)});}}}emlformat[_0xee58('0x9d')](_0x328e6b,function(_0x1c400d,_0x2d43f3){if(_0x1c400d)return _0x514345(_0x1c400d);fs[_0xee58('0x9e')](path[_0xee58('0x5e')](_0x5dd670,_0x130378),_0x2d43f3);return _0x13503a(_0x2d43f3);});});}})['then'](function(_0x3fa187){if(_0x3fa187){return _0x45889e[_0xee58('0x8c')](path[_0xee58('0x5e')](_0x5dd670,_0x130378),_0x130378,function(_0x116b93){if(!_0x116b93)fs['unlinkSync'](path[_0xee58('0x5e')](_0x5dd670,_0x130378));});}})['catch'](handleError(_0x45889e,null));}; \ No newline at end of file +var _0x569b=['http','request','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','json','undefined','offset','count','limit','set','Content-Range','then','destroy','status','end','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','MailMessage','includeAll','rows','catch','show','params','include','update','body','find','describe','create','direction','out','split','MailAccount','findOne','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','service','pass','attachments','join','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','read','UserId','agent','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','internal','manual','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','User','fullname','email','reject','rejectmessage','unix','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','download','unlinkSync','eml-format','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client'];(function(_0x5526ac,_0x5931c5){var _0xaf2793=function(_0x2ae05e){while(--_0x2ae05e){_0x5526ac['push'](_0x5526ac['shift']());}};_0xaf2793(++_0x5931c5);}(_0x569b,0x91));var _0xb569=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x569b[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xb569('0x0'));var moment=require('moment');var BPromise=require(_0xb569('0x1'));var util=require('util');var path=require(_0xb569('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb569('0x3'));var htmlToText=require(_0xb569('0x4'));var qs=require(_0xb569('0x5'));var logger=require(_0xb569('0x6'))('api');var interaction_log=require(_0xb569('0x6'))(_0xb569('0x7'));var config=require(_0xb569('0x8'));var db=require(_0xb569('0x9'))['db'];config[_0xb569('0xa')]=_['defaults'](config[_0xb569('0xa')],{'host':_0xb569('0xb'),'port':0x18eb});var socket=require(_0xb569('0xc'))(new Redis(config['redis']));var htmlEntities=require(_0xb569('0xd'));require(_0xb569('0xe'))[_0xb569('0xf')](socket);var jayson=require(_0xb569('0x10'));var client=jayson[_0xb569('0x11')]['http']({'port':0x232c});var client9003=jayson[_0xb569('0x11')]['http']({'port':0x232b});var client9002=jayson['client'][_0xb569('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5a2cea,_0x3cce9d,_0x5c45b7,_0x133027){return new BPromise(function(_0x225e05,_0x2ddc04){var _0x453097=_0x133027||client;return _0x453097[_0xb569('0x13')](_0x5a2cea,_0x5c45b7)['then'](function(_0x505c34){logger[_0xb569('0x14')](_0xb569('0x15'),_0x3cce9d,'request\x20sent');logger['debug'](_0xb569('0x16'),_0x3cce9d,_0xb569('0x17'),JSON['stringify'](_0x505c34));if(_0x505c34[_0xb569('0x18')]){if(_0x505c34[_0xb569('0x18')]['code']===0x1f4){logger[_0xb569('0x18')](_0xb569('0x15'),_0x3cce9d,_0x505c34[_0xb569('0x18')][_0xb569('0x19')]);return _0x2ddc04(_0x505c34[_0xb569('0x18')]['message']);}logger[_0xb569('0x18')](_0xb569('0x15'),_0x3cce9d,_0x505c34[_0xb569('0x18')][_0xb569('0x19')]);return _0x225e05(_0x505c34['error']['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3cce9d,_0xb569('0x17'));_0x225e05(_0x505c34[_0xb569('0x1a')]['message']);}})['catch'](function(_0x398262){logger[_0xb569('0x18')](_0xb569('0x15'),_0x3cce9d,_0x398262);_0x2ddc04(_0x398262);});});}function respondWithResult(_0x582c25,_0x207b18){_0x207b18=_0x207b18||0xc8;return function(_0x2bd94a){if(_0x2bd94a){return _0x582c25['status'](_0x207b18)[_0xb569('0x1b')](_0x2bd94a);}};}function respondWithFilteredResult(_0x521214,_0x439a4e){return function(_0xd11c7d){if(_0xd11c7d){var _0x1c0199=typeof _0x439a4e['offset']===_0xb569('0x1c')&&typeof _0x439a4e['limit']==='undefined';var _0x327c6b=_0xd11c7d['count'];var _0x2d46ea=_0x1c0199?0x0:_0x439a4e[_0xb569('0x1d')];var _0x3b7b2d=_0x1c0199?_0xd11c7d[_0xb569('0x1e')]:_0x439a4e['offset']+_0x439a4e[_0xb569('0x1f')];var _0x292287;if(_0x3b7b2d>=_0x327c6b){_0x3b7b2d=_0x327c6b;_0x292287=0xc8;}else{_0x292287=0xce;}_0x521214['status'](_0x292287);return _0x521214[_0xb569('0x20')](_0xb569('0x21'),_0x2d46ea+'-'+_0x3b7b2d+'/'+_0x327c6b)[_0xb569('0x1b')](_0xd11c7d);}return null;};}function saveUpdates(_0x396373){return function(_0x47896f){if(_0x47896f){return _0x47896f['update'](_0x396373)[_0xb569('0x22')](function(_0x4a5860){return _0x4a5860;});}return null;};}function removeEntity(_0x18f2bc){return function(_0x4b7cdc){if(_0x4b7cdc){return _0x4b7cdc[_0xb569('0x23')]()[_0xb569('0x22')](function(){_0x18f2bc[_0xb569('0x24')](0xcc)[_0xb569('0x25')]();});}};}function handleEntityNotFound(_0x4bcb33){return function(_0x552e3f){if(!_0x552e3f){_0x4bcb33['sendStatus'](0x194);}return _0x552e3f;};}function handleError(_0x1e3979,_0x7af96e){_0x7af96e=_0x7af96e||0x1f4;return function(_0x4b030b){logger[_0xb569('0x18')](_0x4b030b[_0xb569('0x26')]);if(_0x4b030b[_0xb569('0x27')]){delete _0x4b030b['name'];}_0x1e3979[_0xb569('0x24')](_0x7af96e)[_0xb569('0x28')](_0x4b030b);};}exports['index']=function(_0xbeeba6,_0x30df76){var _0x1ccc4d={},_0x183df9={},_0x10cd34={'count':0x0,'rows':[]};var _0x53394d=_[_0xb569('0x29')](db['MailMessage']['rawAttributes'],function(_0x4e9d00){return{'name':_0x4e9d00[_0xb569('0x2a')],'type':_0x4e9d00[_0xb569('0x2b')]['key']};});_0x183df9[_0xb569('0x2c')]=_['map'](_0x53394d,_0xb569('0x27'));_0x183df9[_0xb569('0x2d')]=_[_0xb569('0x2e')](_0xbeeba6[_0xb569('0x2d')]);_0x183df9[_0xb569('0x2f')]=_[_0xb569('0x30')](_0x183df9[_0xb569('0x2c')],_0x183df9['query']);_0x1ccc4d[_0xb569('0x31')]=_[_0xb569('0x30')](_0x183df9[_0xb569('0x2c')],qs[_0xb569('0x32')](_0xbeeba6[_0xb569('0x2d')][_0xb569('0x32')]));_0x1ccc4d[_0xb569('0x31')]=_0x1ccc4d['attributes'][_0xb569('0x33')]?_0x1ccc4d[_0xb569('0x31')]:_0x183df9[_0xb569('0x2c')];if(!_0xbeeba6[_0xb569('0x2d')][_0xb569('0x34')](_0xb569('0x35'))){_0x1ccc4d[_0xb569('0x1f')]=qs[_0xb569('0x1f')](_0xbeeba6[_0xb569('0x2d')][_0xb569('0x1f')]);_0x1ccc4d['offset']=qs['offset'](_0xbeeba6['query'][_0xb569('0x1d')]);}_0x1ccc4d[_0xb569('0x36')]=qs[_0xb569('0x37')](_0xbeeba6[_0xb569('0x2d')][_0xb569('0x37')]);_0x1ccc4d[_0xb569('0x38')]=qs[_0xb569('0x2f')](_[_0xb569('0x39')](_0xbeeba6[_0xb569('0x2d')],_0x183df9['filters']),_0x53394d);if(_0xbeeba6['query']['filter']){_0x1ccc4d[_0xb569('0x38')]=_[_0xb569('0x3a')](_0x1ccc4d[_0xb569('0x38')],{'$or':_[_0xb569('0x29')](_0x53394d,function(_0x32566d){if(_0x32566d[_0xb569('0x2b')]!==_0xb569('0x3b')){var _0x2fbca3={};_0x2fbca3[_0x32566d[_0xb569('0x27')]]={'$like':'%'+_0xbeeba6[_0xb569('0x2d')]['filter']+'%'};return _0x2fbca3;}})});}_0x1ccc4d=_[_0xb569('0x3a')]({},_0x1ccc4d,_0xbeeba6[_0xb569('0x3c')]);var _0x65762b={'where':_0x1ccc4d[_0xb569('0x38')]};return db[_0xb569('0x3d')][_0xb569('0x1e')](_0x65762b)[_0xb569('0x22')](function(_0x1815e4){_0x10cd34[_0xb569('0x1e')]=_0x1815e4;if(_0xbeeba6[_0xb569('0x2d')][_0xb569('0x3e')]){_0x1ccc4d['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1ccc4d);})['then'](function(_0x2b66c2){_0x10cd34[_0xb569('0x3f')]=_0x2b66c2;return _0x10cd34;})[_0xb569('0x22')](respondWithFilteredResult(_0x30df76,_0x1ccc4d))[_0xb569('0x40')](handleError(_0x30df76,null));};exports[_0xb569('0x41')]=function(_0x52125c,_0x54b83e){var _0x505067={'raw':!![],'where':{'id':_0x52125c[_0xb569('0x42')]['id']}},_0x3df9b2={};_0x3df9b2[_0xb569('0x2c')]=_[_0xb569('0x2e')](db[_0xb569('0x3d')]['rawAttributes']);_0x3df9b2[_0xb569('0x2d')]=_[_0xb569('0x2e')](_0x52125c['query']);_0x3df9b2['filters']=_['intersection'](_0x3df9b2['model'],_0x3df9b2[_0xb569('0x2d')]);_0x505067[_0xb569('0x31')]=_[_0xb569('0x30')](_0x3df9b2[_0xb569('0x2c')],qs[_0xb569('0x32')](_0x52125c['query'][_0xb569('0x32')]));_0x505067[_0xb569('0x31')]=_0x505067['attributes'][_0xb569('0x33')]?_0x505067[_0xb569('0x31')]:_0x3df9b2[_0xb569('0x2c')];if(_0x52125c['query'][_0xb569('0x3e')]){_0x505067[_0xb569('0x43')]=[{'all':!![]}];}_0x505067=_[_0xb569('0x3a')]({},_0x505067,_0x52125c[_0xb569('0x3c')]);return db[_0xb569('0x3d')]['find'](_0x505067)[_0xb569('0x22')](handleEntityNotFound(_0x54b83e,null))[_0xb569('0x22')](respondWithResult(_0x54b83e,null))[_0xb569('0x40')](handleError(_0x54b83e,null));};exports[_0xb569('0x44')]=function(_0x33ca4c,_0x5de81d){if(_0x33ca4c['body']['id']){delete _0x33ca4c[_0xb569('0x45')]['id'];}return db[_0xb569('0x3d')]['find']({'where':{'id':_0x33ca4c[_0xb569('0x42')]['id']}})['then'](handleEntityNotFound(_0x5de81d,null))['then'](saveUpdates(_0x33ca4c[_0xb569('0x45')],null))[_0xb569('0x22')](respondWithResult(_0x5de81d,null))[_0xb569('0x40')](handleError(_0x5de81d,null));};exports[_0xb569('0x23')]=function(_0x98c304,_0x3a64fe){return db[_0xb569('0x3d')][_0xb569('0x46')]({'where':{'id':_0x98c304[_0xb569('0x42')]['id']}})[_0xb569('0x22')](handleEntityNotFound(_0x3a64fe,null))[_0xb569('0x22')](removeEntity(_0x3a64fe,null))[_0xb569('0x40')](handleError(_0x3a64fe,null));};exports[_0xb569('0x47')]=function(_0x3e167d,_0x5540d4){return db[_0xb569('0x3d')][_0xb569('0x47')]()['then'](respondWithResult(_0x5540d4,null))[_0xb569('0x40')](handleError(_0x5540d4,null));};exports['create']=function(_0x31b0a7,_0x7f8dfa){return db[_0xb569('0x3d')][_0xb569('0x48')](_0x31b0a7[_0xb569('0x45')])[_0xb569('0x22')](function(_0x180668){if(_0x180668){if(_0x180668[_0xb569('0x49')]===_0xb569('0x4a')&&!_0x180668['secret']){var _0x1f0d8f,_0x1b91b8,_0xfd3469;if(_0x31b0a7[_0xb569('0x45')]['to']){_0x1b91b8=_0x31b0a7[_0xb569('0x45')]['to'][_0xb569('0x4b')](',')[0x0];}return db[_0xb569('0x4c')][_0xb569('0x4d')]({'where':{'id':_0x180668[_0xb569('0x4e')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb569('0x4f')],'as':_0xb569('0x50'),'where':{'email':_0x1b91b8},'limit':0x1,'order':[[_0xb569('0x51'),_0xb569('0x52')]]}]},{'model':db[_0xb569('0x53')],'as':_0xb569('0x54'),'raw':!![]}]})['then'](function(_0x4eab97){_0x1f0d8f=_0x4eab97;if(_0x1f0d8f&&_0x1f0d8f['Smtp']){var _0x4332d7={'tls':{'rejectUnauthorized':![]}};if(_[_0xb569('0x55')](_0x1f0d8f[_0xb569('0x54')]['service'])){_0x4332d7[_0xb569('0x56')]=_0x1f0d8f['Smtp']['host'];_0x4332d7[_0xb569('0x57')]=_0x1f0d8f[_0xb569('0x54')]['port'];_0x4332d7[_0xb569('0x58')]=_0x1f0d8f[_0xb569('0x54')]['secure'];if(_0x1f0d8f[_0xb569('0x54')][_0xb569('0x59')]){_0x4332d7[_0xb569('0x5a')]={'user':_0x1f0d8f[_0xb569('0x54')][_0xb569('0x5b')],'pass':_0x1f0d8f[_0xb569('0x54')]['pass']};}}else{_0x4332d7[_0xb569('0x5c')]=_0x1f0d8f[_0xb569('0x54')][_0xb569('0x5c')];_0x4332d7['auth']={'user':_0x1f0d8f[_0xb569('0x54')][_0xb569('0x5b')],'pass':_0x1f0d8f[_0xb569('0x54')][_0xb569('0x5d')]};_0x4332d7[_0xb569('0x58')]=_0x1f0d8f['Smtp'][_0xb569('0x58')];}if(_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')]&&_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')][_0xb569('0x33')]){for(var _0x47f1b6=0x0;_0x47f1b6<_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')][_0xb569('0x33')];_0x47f1b6+=0x1){_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')][_0x47f1b6]={'filename':_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')][_0x47f1b6][_0xb569('0x27')],'path':path[_0xb569('0x5f')](config[_0xb569('0x60')],_0xb569('0x61'),_0x31b0a7[_0xb569('0x45')][_0xb569('0x5e')][_0x47f1b6][_0xb569('0x62')])};}}_0xfd3469={'account':_0x4332d7,'message':_0x31b0a7[_0xb569('0x45')]};return;}})[_0xb569('0x22')](function(){if(_0x1f0d8f[_0xb569('0x63')]){if(_0x1f0d8f[_0xb569('0x63')]['Contacts'][_0xb569('0x33')]){return _0x1f0d8f[_0xb569('0x63')][_0xb569('0x50')][0x0];}else{return db[_0xb569('0x4f')]['create'](_[_0xb569('0x64')](_0x31b0a7[_0xb569('0x45')],{'firstName':_0x31b0a7[_0xb569('0x45')]['to'],'email':_0x31b0a7[_0xb569('0x45')]['to'],'phone':_0x31b0a7[_0xb569('0x45')]['to'],'ListId':_0x1f0d8f[_0xb569('0x65')]}));}}else{throw new Error(_0xb569('0x66'));}})[_0xb569('0x22')](function(){if(_0xfd3469){return respondWithRpcPromise('SendMail','sendMail',_0xfd3469,client9003)[_0xb569('0x22')](function(_0x147c71){return _0x180668['update']({'read':!![],'messageId':_0x147c71[_0xb569('0x67')],'sentAt':moment()[_0xb569('0x68')](_0xb569('0x69'))});})[_0xb569('0x40')](function(_0x290949){logger[_0xb569('0x18')]('%s',JSON[_0xb569('0x6a')](_0x290949));return _0x180668;});}return _0x180668;});}return _0x180668;}})['then'](respondWithResult(_0x7f8dfa,0xc9))['catch'](handleError(_0x7f8dfa,null));};exports['accept']=function(_0x5673f8,_0x158f0c){var _0x11aa25={'agent':{},'channel':_0xb569('0x6b')};if(_0x5673f8[_0xb569('0x45')]['id']){delete _0x5673f8[_0xb569('0x45')]['id'];}_0x5673f8[_0xb569('0x45')][_0xb569('0x6c')]=!![];_0x5673f8[_0xb569('0x45')]['readAt']=moment()[_0xb569('0x68')](_0xb569('0x69'));_0x5673f8['body'][_0xb569('0x6d')]=_0x5673f8[_0xb569('0x45')][_0xb569('0x6d')]||_0x5673f8['user']['id'];_0x11aa25[_0xb569('0x6e')]['id']=_0x5673f8[_0xb569('0x45')][_0xb569('0x6d')];return db[_0xb569('0x3d')][_0xb569('0x46')]({'where':{'id':_0x5673f8['params']['id'],'UserId':null}})[_0xb569('0x22')](handleEntityNotFound(_0x158f0c,null))['then'](saveUpdates(_0x5673f8[_0xb569('0x45')],null))[_0xb569('0x22')](function(_0x155c72){if(_0x155c72){_0x11aa25[_0xb569('0x19')]=_0x155c72['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x155c72[_0xb569('0x6f')]}});}return null;})[_0xb569('0x22')](handleEntityNotFound(_0x158f0c,null))[_0xb569('0x22')](function(_0x34b056){if(_0x34b056){return _0x34b056[_0xb569('0x44')]({'UserId':_0x5673f8[_0xb569('0x45')][_0xb569('0x6d')],'read1stAt':_[_0xb569('0x55')](_0x34b056[_0xb569('0x70')])?moment()[_0xb569('0x68')](_0xb569('0x69')):undefined});}return null;})[_0xb569('0x22')](function(_0x4b01c6){if(_0x4b01c6){_0x11aa25['interaction']=_0x4b01c6[_0xb569('0x71')]({'plain':!![]});interaction_log[_0xb569('0x14')](_0xb569('0x72'),_0x5673f8[_0xb569('0x5b')]['id'],_0x5673f8[_0xb569('0x5b')]['name'],_0x5673f8[_0xb569('0x5b')]['role'],_0x11aa25['interaction']['id'],_0x5673f8[_0xb569('0x45')]?JSON[_0xb569('0x6a')](_0x5673f8[_0xb569('0x45')]):_0xb569('0x73'));return respondWithRpcPromise(_0xb569('0x74'),_0xb569('0x75'),_0x11aa25);}return null;})[_0xb569('0x22')](function(_0x467149){var _0xa77a89=_0xb569('0x76')+_0x467149[_0xb569('0x19')]['ContactId'];return db[_0xb569('0x77')][_0xb569('0x2d')](_0xa77a89,{'type':db[_0xb569('0x78')][_0xb569('0x79')][_0xb569('0x7a')],'raw':!![]})[_0xb569('0x22')](function(_0x5d5767){return _0x5d5767;});})[_0xb569('0x22')](function(_0x176348){if(_0x176348){_0x11aa25['message'][_0xb569('0x7b')]=_0x176348[0x0];if(!_0x5673f8[_0xb569('0x45')][_0xb569('0x6d')])return;return db['User'][_0xb569('0x46')]({'where':{'id':_0x5673f8[_0xb569('0x45')][_0xb569('0x6d')],'role':'agent'},'attributes':['id',_0xb569('0x27'),'fullname','email',_0xb569('0x7c')],'raw':!![]});}return null;})[_0xb569('0x22')](function(_0x1174f5){if(!_0x1174f5)return null;_0x11aa25[_0xb569('0x19')][_0xb569('0x6e')]=_0x1174f5;return _0x11aa25;})[_0xb569('0x22')](function(_0x1bfc26){if(_0x1bfc26){if(_0x5673f8[_0xb569('0x45')][_0xb569('0x7d')]){_0x11aa25['message']['interface']=util[_0xb569('0x68')](_0xb569('0x7e'),_0x5673f8[_0xb569('0x5b')][_0xb569('0x27')]);_0x11aa25[_0xb569('0x19')][_0xb569('0x7f')]=_0x11aa25['channel'];_0x11aa25['message'][_0xb569('0x80')]=_0x11aa25[_0xb569('0x7f')];_0x11aa25[_0xb569('0x19')][_0xb569('0x81')]=_0xb569('0x82');_0x11aa25[_0xb569('0x19')][_0xb569('0x45')]=htmlToText[_0xb569('0x83')](_0x11aa25[_0xb569('0x19')][_0xb569('0x45')]);return respondWithRpcPromise(_0xb569('0x84'),'EventManager',{'event':_0xb569('0x85'),'message':_0x11aa25['message']},client9002)[_0xb569('0x22')](function(){return _0x11aa25;});}return _0x11aa25;}return null;})[_0xb569('0x22')](respondWithResult(_0x158f0c,null))[_0xb569('0x40')](handleError(_0x158f0c,null));};exports['reject']=function(_0xf9a1b1,_0x87b876){var _0x416fd3={'agent':{},'channel':_0xb569('0x6b')};if(_0xf9a1b1[_0xb569('0x45')]['id']){delete _0xf9a1b1[_0xb569('0x45')]['id'];}_0xf9a1b1[_0xb569('0x45')][_0xb569('0x6d')]=_0xf9a1b1['body'][_0xb569('0x6d')]||_0xf9a1b1[_0xb569('0x5b')]['id'];_0x416fd3[_0xb569('0x6e')]['id']=_0xf9a1b1[_0xb569('0x45')][_0xb569('0x6d')];return db[_0xb569('0x3d')]['find']({'where':{'id':_0xf9a1b1[_0xb569('0x42')]['id'],'UserId':null}})[_0xb569('0x22')](handleEntityNotFound(_0x87b876,null))['then'](function(_0x1600ae){if(_0x1600ae){_0x416fd3[_0xb569('0x19')]=_0x1600ae[_0xb569('0x71')]({'plain':!![]});return db['MailInteraction'][_0xb569('0x46')]({'where':{'id':_0x1600ae[_0xb569('0x6f')]}});}return null;})[_0xb569('0x22')](handleEntityNotFound(_0x87b876,null))[_0xb569('0x22')](function(_0x5906eb){if(_0x5906eb){_0x416fd3[_0xb569('0x86')]=_0x5906eb['get']({'plain':!![]});interaction_log[_0xb569('0x14')](_0xb569('0x87'),_0xf9a1b1[_0xb569('0x5b')]['id'],_0xf9a1b1[_0xb569('0x5b')][_0xb569('0x27')],_0xf9a1b1[_0xb569('0x5b')][_0xb569('0x88')],_0x416fd3[_0xb569('0x86')]['id'],_0xf9a1b1[_0xb569('0x45')]?JSON[_0xb569('0x6a')](_0xf9a1b1[_0xb569('0x45')]):_0xb569('0x73'));return respondWithRpcPromise(_0xb569('0x89'),_0xb569('0x8a'),_0x416fd3);}return null;})['then'](function(_0x4d1ce9){var _0x4f2922='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d1ce9[_0xb569('0x19')][_0xb569('0x8b')];return db[_0xb569('0x77')][_0xb569('0x2d')](_0x4f2922,{'type':db[_0xb569('0x78')][_0xb569('0x79')][_0xb569('0x7a')],'raw':!![]})['then'](function(_0x255080){return _0x255080;});})['then'](function(_0x1677f9){if(_0x1677f9){_0x416fd3['message']['contact']=_0x1677f9[0x0];if(!_0xf9a1b1[_0xb569('0x45')][_0xb569('0x6d')])return;return db[_0xb569('0x8c')][_0xb569('0x46')]({'where':{'id':_0xf9a1b1[_0xb569('0x45')][_0xb569('0x6d')],'role':_0xb569('0x6e')},'attributes':['id','name',_0xb569('0x8d'),_0xb569('0x8e'),_0xb569('0x7c')],'raw':!![]});}return null;})[_0xb569('0x22')](function(_0x4e5175){if(!_0x4e5175)return null;_0x416fd3['message']['agent']=_0x4e5175;return _0x416fd3;})['then'](function(_0x15703d){if(_0x15703d){_0x15703d[_0xb569('0x19')]['interface']=util[_0xb569('0x68')](_0xb569('0x7e'),_0xf9a1b1['user']['name']);_0x15703d['message']['channel']=_0x416fd3[_0xb569('0x7f')];_0x15703d[_0xb569('0x19')][_0xb569('0x80')]=_0x416fd3['channel'];_0x15703d[_0xb569('0x19')]['event']=_0xb569('0x8f');_0x15703d[_0xb569('0x19')][_0xb569('0x45')]=htmlToText[_0xb569('0x83')](_0x416fd3[_0xb569('0x19')]['body']);respondWithRpcPromise(_0xb569('0x84'),_0xb569('0x84'),{'event':_0xb569('0x90'),'message':_0x15703d['message']},client9002);return _0x416fd3;}return null;})['then'](respondWithResult(_0x87b876,null))['catch'](handleError(_0x87b876,null));};exports['download']=function(_0xa84aea,_0x35fad5){var _0x38985f=moment()[_0xb569('0x91')]()[_0xb569('0x92')]();var _0x1c74a7=path[_0xb569('0x5f')](config[_0xb569('0x60')],_0xb569('0x93'),_0xb569('0x94'),'tmp');var _0x18628d=path[_0xb569('0x5f')](config[_0xb569('0x60')],_0xb569('0x93'),_0xb569('0x94'),_0xb569('0x5e'));var _0x40ea7a=util['format'](_0xb569('0x95'),_0x38985f);return db[_0xb569('0x3d')][_0xb569('0x46')]({'where':{'id':_0xa84aea[_0xb569('0x42')]['id']},'attributes':['id',_0xb569('0x45'),'from','to','cc',_0xb569('0x96'),_0xb569('0x97'),_0xb569('0x98')],'include':_0xa84aea[_0xb569('0x2d')][_0xb569('0x5e')]?[{'model':db[_0xb569('0x99')],'as':_0xb569('0x9a')}]:undefined})[_0xb569('0x22')](handleEntityNotFound(_0x35fad5,null))[_0xb569('0x22')](function(_0x24a05c){if(_0x24a05c){var _0x1e5dba=_0x24a05c;var _0x1c5f7={'from':_0x1e5dba[_0xb569('0x9b')],'to':_0x1e5dba['to'],'subject':_0x1e5dba['subject'],'html':htmlEntities[_0xb569('0x9c')](_0x1e5dba[_0xb569('0x45')]),'headers':{'Date':moment(_0x1e5dba[_0xb569('0x98')])[_0xb569('0x68')](_0xb569('0x9d'))},'attachments':[]};if(_0x24a05c['cc']){_0x1c5f7[_0xb569('0x9e')]['Cc']=_0x24a05c['cc'];}if(_0x24a05c[_0xb569('0x96')]){_0x1c5f7[_0xb569('0x9e')]['Bcc']=_0x24a05c[_0xb569('0x96')];}return new BPromise(function(_0x5225ff,_0x4f15ae){if(_0x24a05c[_0xb569('0x9a')]){for(var _0x50e417=0x0;_0x50e417<_0x24a05c['Attachments']['length'];_0x50e417++){var _0x3588ef=_0x24a05c[_0xb569('0x9a')][_0x50e417];var _0xd5f173=path[_0xb569('0x5f')](_0x18628d,_0x3588ef[_0xb569('0x62')]);if(fs[_0xb569('0x9f')](_0xd5f173)){_0x1c5f7[_0xb569('0x5e')]['push']({'name':_0x3588ef[_0xb569('0x27')],'contentType':_0x3588ef['type'],'data':fs['readFileSync'](_0xd5f173)});}}}emlformat[_0xb569('0xa0')](_0x1c5f7,function(_0xd3455b,_0x23e1f4){if(_0xd3455b)return _0x4f15ae(_0xd3455b);fs['writeFileSync'](path[_0xb569('0x5f')](_0x1c74a7,_0x40ea7a),_0x23e1f4);return _0x5225ff(_0x23e1f4);});});}})['then'](function(_0x249043){if(_0x249043){return _0x35fad5[_0xb569('0xa1')](path[_0xb569('0x5f')](_0x1c74a7,_0x40ea7a),_0x40ea7a,function(_0x43f3eb){if(!_0x43f3eb)fs[_0xb569('0xa2')](path[_0xb569('0x5f')](_0x1c74a7,_0x40ea7a));});}})[_0xb569('0x40')](handleError(_0x35fad5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 10ec1f2..368e81e 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 _0x14f7=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0x14f7,0x126));var _0x714f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x14f7[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0x714f('0x0'));var MailMessage=require(_0x714f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x714f('0x2')](0x0);var events={'afterCreate':_0x714f('0x3'),'afterUpdate':_0x714f('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd3438c){return function(_0x45c707,_0x188dba,_0x2df7c9){MailMessageEvents[_0x714f('0x5')](_0xd3438c+':'+_0x45c707['id'],_0x45c707);MailMessageEvents['emit'](_0xd3438c,_0x45c707);_0x2df7c9(null);};}for(var e in events){if(events[_0x714f('0x6')](e)){var event=events[e];MailMessage[_0x714f('0x7')](e,emitEvent(event));}}module[_0x714f('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x4eef=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4a08af,_0x5a8b39){var _0x24732b=function(_0x488606){while(--_0x488606){_0x4a08af['push'](_0x4a08af['shift']());}};_0x24732b(++_0x5a8b39);}(_0x4eef,0x1e3));var _0xf4ee=function(_0x5eb856,_0x2a3dd9){_0x5eb856=_0x5eb856-0x0;var _0x7bdeab=_0x4eef[_0x5eb856];return _0x7bdeab;};'use strict';var EventEmitter=require(_0xf4ee('0x0'));var MailMessage=require(_0xf4ee('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf4ee('0x2')](0x0);var events={'afterCreate':_0xf4ee('0x3'),'afterUpdate':'update','afterDestroy':_0xf4ee('0x4')};function emitEvent(_0xde107){return function(_0x35f4df,_0x149505,_0x308f4f){MailMessageEvents[_0xf4ee('0x5')](_0xde107+':'+_0x35f4df['id'],_0x35f4df);MailMessageEvents['emit'](_0xde107,_0x35f4df);_0x308f4f(null);};}for(var e in events){if(events[_0xf4ee('0x6')](e)){var event=events[e];MailMessage[_0xf4ee('0x7')](e,emitEvent(event));}}module[_0xf4ee('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e6fe4ae..2e47485 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 _0xba67=['lodash','util','../../config/logger','api','moment','bluebird','html-to-text','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x11937f,_0x4cf7a7){var _0x4d473f=function(_0x2c384e){while(--_0x2c384e){_0x11937f['push'](_0x11937f['shift']());}};_0x4d473f(++_0x4cf7a7);}(_0xba67,0x118));var _0x7ba6=function(_0x319b4b,_0x220e4a){_0x319b4b=_0x319b4b-0x0;var _0x544c49=_0xba67[_0x319b4b];return _0x544c49;};'use strict';var _=require(_0x7ba6('0x0'));var util=require(_0x7ba6('0x1'));var logger=require(_0x7ba6('0x2'))(_0x7ba6('0x3'));var moment=require(_0x7ba6('0x4'));var BPromise=require(_0x7ba6('0x5'));var rp=require('request-promise');var htmlToText=require(_0x7ba6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ba6('0x7'));var config=require(_0x7ba6('0x8'));var attributes=require('./mailMessage.attributes');module[_0x7ba6('0x9')]=function(_0x20c041,_0x16052b){return _0x20c041[_0x7ba6('0xa')](_0x7ba6('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x7ba6('0xc'),'fields':[_0x7ba6('0xc')]},{'name':_0x7ba6('0xd'),'fields':[_0x7ba6('0xe'),_0x7ba6('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x581a57,_0xd605b4,_0x5e0b2c){if(_0x581a57[_0x7ba6('0x10')]){_0x581a57[_0x7ba6('0xe')]=htmlToText[_0x7ba6('0x11')](_0x581a57[_0x7ba6('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5e0b2c(null,_0xd605b4);},'afterCreate':function(_0x2b67eb,_0x18a2b1,_0xdd4203){var _0x8d6fbe=_0x20c041[_0x7ba6('0x12')];var _0x3b8e49=_0x2b67eb[_0x7ba6('0x13')]({'plain':!![]});if(_0x3b8e49['direction'][_0x7ba6('0x14')]()==='in'||_0x3b8e49[_0x7ba6('0x15')]['toLowerCase']()===_0x7ba6('0x16')&&!_0x3b8e49[_0x7ba6('0x17')]&&!_[_0x7ba6('0x18')](_0x3b8e49['UserId'])){_0x8d6fbe[_0x7ba6('0x19')][_0x7ba6('0x1a')]({'where':{'id':_0x3b8e49[_0x7ba6('0x1b')]}})[_0x7ba6('0x1c')](function(_0x894f4b){if(_0x894f4b){_0x894f4b[_0x7ba6('0x1d')]({'lastMsgAt':_0x3b8e49[_0x7ba6('0x1e')],'lastMsgDirection':_0x3b8e49['direction'][_0x7ba6('0x14')]()});}})[_0x7ba6('0x1f')](function(_0x4a2f07){console[_0x7ba6('0x20')](_0x4a2f07);});}_0xdd4203();}},'charset':_0x7ba6('0x21'),'collate':_0x7ba6('0x22')});}; \ No newline at end of file +var _0xd2ab=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','toLowerCase','direction','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt'];(function(_0xc8ba7f,_0x52d312){var _0x266d3b=function(_0x45466d){while(--_0x45466d){_0xc8ba7f['push'](_0xc8ba7f['shift']());}};_0x266d3b(++_0x52d312);}(_0xd2ab,0x11c));var _0xbd2a=function(_0xc4a1f9,_0xe4a638){_0xc4a1f9=_0xc4a1f9-0x0;var _0x360425=_0xd2ab[_0xc4a1f9];return _0x360425;};'use strict';var _=require(_0xbd2a('0x0'));var util=require(_0xbd2a('0x1'));var logger=require(_0xbd2a('0x2'))(_0xbd2a('0x3'));var moment=require(_0xbd2a('0x4'));var BPromise=require(_0xbd2a('0x5'));var rp=require(_0xbd2a('0x6'));var htmlToText=require(_0xbd2a('0x7'));var fs=require('fs');var path=require(_0xbd2a('0x8'));var rimraf=require(_0xbd2a('0x9'));var config=require(_0xbd2a('0xa'));var attributes=require(_0xbd2a('0xb'));module['exports']=function(_0xdea3cd,_0x5e9447){return _0xdea3cd['define'](_0xbd2a('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbd2a('0xd')]},{'name':_0xbd2a('0xe'),'fields':[_0xbd2a('0xf'),_0xbd2a('0x10')],'type':_0xbd2a('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43cdf2,_0x120584,_0x382cd6){if(_0x43cdf2['body']){_0x43cdf2[_0xbd2a('0xf')]=htmlToText[_0xbd2a('0x12')](_0x43cdf2[_0xbd2a('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x382cd6(null,_0x120584);},'afterCreate':function(_0x2e71ff,_0x1cdc9a,_0x26cf12){var _0x3b2be4=_0xdea3cd[_0xbd2a('0x14')];var _0x49e769=_0x2e71ff['get']({'plain':!![]});if(_0x49e769['direction'][_0xbd2a('0x15')]()==='in'||_0x49e769[_0xbd2a('0x16')][_0xbd2a('0x15')]()==='out'&&!_0x49e769[_0xbd2a('0x17')]&&!_[_0xbd2a('0x18')](_0x49e769[_0xbd2a('0x19')])){_0x3b2be4[_0xbd2a('0x1a')]['findOne']({'where':{'id':_0x49e769[_0xbd2a('0x1b')]}})[_0xbd2a('0x1c')](function(_0x293d60){if(_0x293d60){_0x293d60[_0xbd2a('0x1d')]({'lastMsgAt':_0x49e769[_0xbd2a('0x1e')],'lastMsgDirection':_0x49e769[_0xbd2a('0x16')][_0xbd2a('0x15')]()});}})[_0xbd2a('0x1f')](function(_0x36d80d){console[_0xbd2a('0x20')](_0x36d80d);});}_0x26cf12();}},'charset':_0xbd2a('0x21'),'collate':_0xbd2a('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e925d66..94afc69 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 _0x3de3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateMailMessage','MailMessage','create','options','catch','lodash','moment','bluebird'];(function(_0x5f0f73,_0x250743){var _0x188358=function(_0x163737){while(--_0x163737){_0x5f0f73['push'](_0x5f0f73['shift']());}};_0x188358(++_0x250743);}(_0x3de3,0x1ce));var _0x33de=function(_0x4c1d05,_0x5c5bc3){_0x4c1d05=_0x4c1d05-0x0;var _0x1a38ed=_0x3de3[_0x4c1d05];return _0x1a38ed;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});config['redis']=_[_0x33de('0xa')](config[_0x33de('0xb')],{'host':_0x33de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33de('0xb')]));require(_0x33de('0xd'))[_0x33de('0xe')](socket);function respondWithRpcPromise(_0x5e1be7,_0x2cbf35,_0x348720){return new BPromise(function(_0x8b655d,_0x241211){return client[_0x33de('0xf')](_0x5e1be7,_0x348720)[_0x33de('0x10')](function(_0x8dfa3b){logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,_0x33de('0x13'));logger[_0x33de('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2cbf35,_0x33de('0x13'),JSON[_0x33de('0x15')](_0x8dfa3b));if(_0x8dfa3b['error']){if(_0x8dfa3b['error'][_0x33de('0x16')]===0x1f4){logger[_0x33de('0x17')](_0x33de('0x12'),_0x2cbf35,_0x8dfa3b[_0x33de('0x17')]['message']);return _0x241211(_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);return _0x8b655d(_0x8dfa3b[_0x33de('0x17')]['message']);}else{logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,'request\x20sent');_0x8b655d(_0x8dfa3b[_0x33de('0x19')][_0x33de('0x18')]);}})['catch'](function(_0x5bb74e){logger[_0x33de('0x17')]('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x5bb74e);_0x241211(_0x5bb74e);});});}exports[_0x33de('0x1a')]=function(_0x2f0529){var _0x3810b5=this;return new Promise(function(_0x315c9b,_0xc4f1a4){return db[_0x33de('0x1b')][_0x33de('0x1c')](_0x2f0529['body'],{'raw':_0x2f0529['options']?_0x2f0529[_0x33de('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x33de('0x10')](function(_0x4cd8db){logger[_0x33de('0x11')](_0x33de('0x1a'),_0x2f0529);logger['debug'](_0x33de('0x1a'),_0x2f0529,JSON['stringify'](_0x4cd8db));_0x315c9b(_0x4cd8db);})[_0x33de('0x1e')](function(_0x5c602d){logger[_0x33de('0x17')](_0x33de('0x1a'),_0x5c602d[_0x33de('0x18')],_0x2f0529);_0xc4f1a4(_0x3810b5['error'](0x1f4,_0x5c602d[_0x33de('0x18')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body'];(function(_0xc01d53,_0x593cf9){var _0x3e393f=function(_0x109599){while(--_0x109599){_0xc01d53['push'](_0xc01d53['shift']());}};_0x3e393f(++_0x593cf9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xb10b[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index dd3a521..f369dee 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 _0x94dc=['register','mailMessage:','./mailMessage.events','remove','removeListener'];(function(_0x162c5e,_0x348792){var _0x21b45d=function(_0x28668b){while(--_0x28668b){_0x162c5e['push'](_0x162c5e['shift']());}};_0x21b45d(++_0x348792);}(_0x94dc,0xb1));var _0xc94d=function(_0x457da3,_0x22273e){_0x457da3=_0x457da3-0x0;var _0x237f45=_0x94dc[_0x457da3];return _0x237f45;};'use strict';var MailMessageEvents=require(_0xc94d('0x0'));var events=['save',_0xc94d('0x1'),'update'];function createListener(_0x1645b0,_0x1b2070){return function(_0x40e7d8){_0x1b2070['emit'](_0x1645b0,_0x40e7d8);};}function removeListener(_0x306706,_0x41d4ec){return function(){MailMessageEvents[_0xc94d('0x2')](_0x306706,_0x41d4ec);};}exports[_0xc94d('0x3')]=function(_0x3c0601){for(var _0x344188=0x0,_0xb7275c=events['length'];_0x344188<_0xb7275c;_0x344188++){var _0x2f9757=events[_0x344188];var _0xbe5904=createListener(_0xc94d('0x4')+_0x2f9757,_0x3c0601);MailMessageEvents['on'](_0x2f9757,_0xbe5904);}}; \ No newline at end of file +var _0xcf95=['./mailMessage.events','save','emit','removeListener','register','length','mailMessage:'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x5cf9('0x0'));var events=[_0x5cf9('0x1'),'remove','update'];function createListener(_0x548d0c,_0x431989){return function(_0xfeb22f){_0x431989[_0x5cf9('0x2')](_0x548d0c,_0xfeb22f);};}function removeListener(_0x102b24,_0x53e2a1){return function(){MailMessageEvents[_0x5cf9('0x3')](_0x102b24,_0x53e2a1);};}exports[_0x5cf9('0x4')]=function(_0x5b060f){for(var _0x498d14=0x0,_0x1c0c3a=events[_0x5cf9('0x5')];_0x498d14<_0x1c0c3a;_0x498d14++){var _0x51acd7=events[_0x498d14];var _0x26b0de=createListener(_0x5cf9('0x6')+_0x51acd7,_0x5b060f);MailMessageEvents['on'](_0x51acd7,_0x26b0de);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3afa6d8..b127842 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 _0x5391=['create','addTeams','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x336082,_0x5c364b){var _0x2ea2eb=function(_0x4c6c53){while(--_0x4c6c53){_0x336082['push'](_0x336082['shift']());}};_0x2ea2eb(++_0x5c364b);}(_0x5391,0x13b));var _0x1539=function(_0x3679fa,_0x1728f5){_0x3679fa=_0x3679fa-0x0;var _0x233bb1=_0x5391[_0x3679fa];return _0x233bb1;};'use strict';var multer=require(_0x1539('0x0'));var util=require(_0x1539('0x1'));var path=require(_0x1539('0x2'));var timeout=require(_0x1539('0x3'));var express=require(_0x1539('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1539('0x5'));var interaction=require(_0x1539('0x6'));var config=require(_0x1539('0x7'));var controller=require('./mailQueue.controller');router[_0x1539('0x8')]('/',auth['isAuthenticated'](),controller[_0x1539('0x9')]);router['get'](_0x1539('0xa'),auth[_0x1539('0xb')](),controller[_0x1539('0xc')]);router[_0x1539('0x8')](_0x1539('0xd'),auth[_0x1539('0xb')](),controller[_0x1539('0xe')]);router[_0x1539('0x8')]('/:id/members',auth[_0x1539('0xb')](),controller[_0x1539('0xf')]);router[_0x1539('0x8')](_0x1539('0x10'),auth[_0x1539('0xb')](),controller[_0x1539('0x11')]);router[_0x1539('0x8')](_0x1539('0x12'),auth['isAuthenticated'](),controller[_0x1539('0x13')]);router[_0x1539('0x14')]('/',auth[_0x1539('0xb')](),controller[_0x1539('0x15')]);router['post'](_0x1539('0x10'),auth[_0x1539('0xb')](),controller[_0x1539('0x16')]);router[_0x1539('0x14')](_0x1539('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1539('0x17')](_0x1539('0xd'),auth['isAuthenticated'](),controller[_0x1539('0x18')]);router[_0x1539('0x19')](_0x1539('0xd'),auth[_0x1539('0xb')](),controller[_0x1539('0x1a')]);router[_0x1539('0x19')](_0x1539('0x10'),auth[_0x1539('0xb')](),controller[_0x1539('0x1b')]);router[_0x1539('0x19')](_0x1539('0x12'),auth[_0x1539('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb447=['../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','getTeams','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','/:id/users','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2c6717,_0x240ba5){var _0x5395f6=function(_0x4184c5){while(--_0x4184c5){_0x2c6717['push'](_0x2c6717['shift']());}};_0x5395f6(++_0x240ba5);}(_0xb447,0xe4));var _0x7b44=function(_0x3ab9d2,_0x82be6b){_0x3ab9d2=_0x3ab9d2-0x0;var _0x4c0cdb=_0xb447[_0x3ab9d2];return _0x4c0cdb;};'use strict';var multer=require(_0x7b44('0x0'));var util=require(_0x7b44('0x1'));var path=require(_0x7b44('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b44('0x3'));var router=express[_0x7b44('0x4')]();var fs_extra=require(_0x7b44('0x5'));var auth=require(_0x7b44('0x6'));var interaction=require(_0x7b44('0x7'));var config=require('../../config/environment');var controller=require(_0x7b44('0x8'));router[_0x7b44('0x9')]('/',auth[_0x7b44('0xa')](),controller[_0x7b44('0xb')]);router[_0x7b44('0x9')](_0x7b44('0xc'),auth[_0x7b44('0xa')](),controller['describe']);router[_0x7b44('0x9')](_0x7b44('0xd'),auth[_0x7b44('0xa')](),controller['show']);router[_0x7b44('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x7b44('0xe')]);router[_0x7b44('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7b44('0xf')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7b44('0x10')]);router[_0x7b44('0x11')]('/',auth['isAuthenticated'](),controller[_0x7b44('0x12')]);router[_0x7b44('0x11')]('/:id/teams',auth[_0x7b44('0xa')](),controller['addTeams']);router[_0x7b44('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x7b44('0x13')]);router['put']('/:id',auth[_0x7b44('0xa')](),controller[_0x7b44('0x14')]);router[_0x7b44('0x15')](_0x7b44('0xd'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x16')]);router[_0x7b44('0x15')]('/:id/teams',auth[_0x7b44('0xa')](),controller[_0x7b44('0x17')]);router['delete'](_0x7b44('0x18'),auth[_0x7b44('0xa')](),controller['removeAgents']);module[_0x7b44('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 06b3cf1..e2f50d6 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 _0xb02f=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x30bfeb,_0x4c2f77){var _0x5e2f23=function(_0x170997){while(--_0x170997){_0x30bfeb['push'](_0x30bfeb['shift']());}};_0x5e2f23(++_0x4c2f77);}(_0xb02f,0xc2));var _0xfb02=function(_0x368a8c,_0x3c8ec5){_0x368a8c=_0x368a8c-0x0;var _0x80de7f=_0xb02f[_0x368a8c];return _0x80de7f;};'use strict';var Sequelize=require(_0xfb02('0x0'));module[_0xfb02('0x1')]={'name':{'type':Sequelize[_0xfb02('0x2')],'unique':_0xfb02('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfb02('0x2')]},'timeout':{'type':Sequelize[_0xfb02('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfb02('0x5')]('rrmemory',_0xfb02('0x6'),_0xfb02('0x7'))}}; \ No newline at end of file +var _0x0b90=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x5ca4b6,_0x4ddb0b){var _0x1637f2=function(_0x302e00){while(--_0x302e00){_0x5ca4b6['push'](_0x5ca4b6['shift']());}};_0x1637f2(++_0x4ddb0b);}(_0x0b90,0x12f));var _0x00b9=function(_0x499ce0,_0x43713c){_0x499ce0=_0x499ce0-0x0;var _0x270eba=_0x0b90[_0x499ce0];return _0x270eba;};'use strict';var Sequelize=require(_0x00b9('0x0'));module[_0x00b9('0x1')]={'name':{'type':Sequelize[_0x00b9('0x2')],'unique':_0x00b9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x00b9('0x2')]},'timeout':{'type':Sequelize[_0x00b9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x00b9('0x5')](_0x00b9('0x6'),_0x00b9('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a56e921..2768f6d 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 _0x1948=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','findAll','findAndCountAll','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','sort','Agents','online','flatMap','sequelize','transaction','addTeams','emit','userMailQueue:save','User','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','ids','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','error','name','index','MailQueue','fieldName','type','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filters','merge','where','VIRTUAL','filter','options','includeAll','include','show','params','rawAttributes','find','create','body','user'];(function(_0x366ef8,_0x474475){var _0x494f3c=function(_0x54b998){while(--_0x54b998){_0x366ef8['push'](_0x366ef8['shift']());}};_0x494f3c(++_0x474475);}(_0x1948,0x145));var _0x8194=function(_0x485067,_0x810f77){_0x485067=_0x485067-0x0;var _0x195d06=_0x1948[_0x485067];return _0x195d06;};'use strict';var emlformat=require(_0x8194('0x0'));var rimraf=require(_0x8194('0x1'));var zipdir=require(_0x8194('0x2'));var jsonpatch=require(_0x8194('0x3'));var rp=require(_0x8194('0x4'));var moment=require('moment');var BPromise=require(_0x8194('0x5'));var Mustache=require(_0x8194('0x6'));var util=require(_0x8194('0x7'));var path=require(_0x8194('0x8'));var sox=require(_0x8194('0x9'));var csv=require(_0x8194('0xa'));var ejs=require(_0x8194('0xb'));var fs=require('fs');var fs_extra=require(_0x8194('0xc'));var _=require('lodash');var squel=require(_0x8194('0xd'));var crypto=require(_0x8194('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8194('0xf'));var toCsv=require(_0x8194('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8194('0x10'));var authService=require(_0x8194('0x11'));var qs=require(_0x8194('0x12'));var as=require(_0x8194('0x13'));var hardwareService=require(_0x8194('0x14'));var logger=require('../../config/logger')(_0x8194('0x15'));var utils=require(_0x8194('0x16'));var config=require(_0x8194('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8194('0x18'))['db'];config[_0x8194('0x19')]=_[_0x8194('0x1a')](config[_0x8194('0x19')],{'host':_0x8194('0x1b'),'port':0x18eb});var socket=require(_0x8194('0x1c'))(new Redis(config['redis']));require(_0x8194('0x1d'))[_0x8194('0x1e')](socket);function respondWithStatusCode(_0xfd031c,_0x2ab425){_0x2ab425=_0x2ab425||0xcc;return function(_0x2d4463){if(_0x2d4463){return _0xfd031c[_0x8194('0x1f')](_0x2ab425);}return _0xfd031c[_0x8194('0x20')](_0x2ab425)[_0x8194('0x21')]();};}function respondWithResult(_0x19c23e,_0x5abd09){_0x5abd09=_0x5abd09||0xc8;return function(_0x49731d){if(_0x49731d){return _0x19c23e[_0x8194('0x20')](_0x5abd09)['json'](_0x49731d);}};}function respondWithFilteredResult(_0x41a11e,_0x4afbe3){return function(_0x55e4c2){if(_0x55e4c2){var _0x5f2172=typeof _0x4afbe3[_0x8194('0x22')]===_0x8194('0x23')&&typeof _0x4afbe3[_0x8194('0x24')]===_0x8194('0x23');var _0x956c6a=_0x55e4c2[_0x8194('0x25')];var _0x599712=_0x5f2172?0x0:_0x4afbe3['offset'];var _0xe8f563=_0x5f2172?_0x55e4c2['count']:_0x4afbe3[_0x8194('0x22')]+_0x4afbe3[_0x8194('0x24')];var _0x9421f5;if(_0xe8f563>=_0x956c6a){_0xe8f563=_0x956c6a;_0x9421f5=0xc8;}else{_0x9421f5=0xce;}_0x41a11e['status'](_0x9421f5);return _0x41a11e[_0x8194('0x26')](_0x8194('0x27'),_0x599712+'-'+_0xe8f563+'/'+_0x956c6a)[_0x8194('0x28')](_0x55e4c2);}return null;};}function patchUpdates(_0x28df4f){return function(_0x1babf1){try{jsonpatch[_0x8194('0x29')](_0x1babf1,_0x28df4f,!![]);}catch(_0x2c5061){return BPromise[_0x8194('0x2a')](_0x2c5061);}return _0x1babf1[_0x8194('0x2b')]();};}function saveUpdates(_0x263093,_0xbb64b7){return function(_0x300491){if(_0x300491){return _0x300491['update'](_0x263093)[_0x8194('0x2c')](function(_0x1216b1){return _0x1216b1;});}return null;};}function removeEntity(_0x21e92d,_0x46a242){return function(_0x55b0d9){if(_0x55b0d9){return _0x55b0d9[_0x8194('0x2d')]()[_0x8194('0x2c')](function(){var _0x425a1d=_0x55b0d9[_0x8194('0x2e')]({'plain':!![]});var _0x3e8cb3='MailQueues';return db['UserProfileResource'][_0x8194('0x2d')]({'where':{'type':_0x3e8cb3,'resourceId':_0x425a1d['id']}})[_0x8194('0x2c')](function(){return _0x55b0d9;});})[_0x8194('0x2c')](function(){_0x21e92d[_0x8194('0x20')](0xcc)[_0x8194('0x21')]();});}};}function handleEntityNotFound(_0x56c512,_0x4af9cc){return function(_0x5624a0){if(!_0x5624a0){_0x56c512[_0x8194('0x1f')](0x194);}return _0x5624a0;};}function handleError(_0x56b5bc,_0x490a37){_0x490a37=_0x490a37||0x1f4;return function(_0xb8910b){logger[_0x8194('0x2f')](_0xb8910b['stack']);if(_0xb8910b[_0x8194('0x30')]){delete _0xb8910b['name'];}_0x56b5bc[_0x8194('0x20')](_0x490a37)['send'](_0xb8910b);};}exports[_0x8194('0x31')]=function(_0x1a8bf9,_0x126795){var _0x2c3514={},_0x4ae934={},_0x4c1993={'count':0x0,'rows':[]};var _0x1721a1=_['map'](db[_0x8194('0x32')]['rawAttributes'],function(_0x2558cc){return{'name':_0x2558cc[_0x8194('0x33')],'type':_0x2558cc[_0x8194('0x34')]['key']};});_0x4ae934['model']=_[_0x8194('0x35')](_0x1721a1,_0x8194('0x30'));_0x4ae934[_0x8194('0x36')]=_[_0x8194('0x37')](_0x1a8bf9['query']);_0x4ae934['filters']=_['intersection'](_0x4ae934[_0x8194('0x38')],_0x4ae934[_0x8194('0x36')]);_0x2c3514[_0x8194('0x39')]=_[_0x8194('0x3a')](_0x4ae934[_0x8194('0x38')],qs[_0x8194('0x3b')](_0x1a8bf9['query'][_0x8194('0x3b')]));_0x2c3514[_0x8194('0x39')]=_0x2c3514[_0x8194('0x39')][_0x8194('0x3c')]?_0x2c3514[_0x8194('0x39')]:_0x4ae934[_0x8194('0x38')];if(!_0x1a8bf9[_0x8194('0x36')][_0x8194('0x3d')](_0x8194('0x3e'))){_0x2c3514[_0x8194('0x24')]=qs[_0x8194('0x24')](_0x1a8bf9[_0x8194('0x36')]['limit']);_0x2c3514[_0x8194('0x22')]=qs['offset'](_0x1a8bf9['query'][_0x8194('0x22')]);}_0x2c3514[_0x8194('0x3f')]=qs['sort'](_0x1a8bf9['query']['sort']);_0x2c3514['where']=qs['filters'](_[_0x8194('0x40')](_0x1a8bf9[_0x8194('0x36')],_0x4ae934[_0x8194('0x41')]),_0x1721a1);if(_0x1a8bf9['query']['filter']){_0x2c3514['where']=_[_0x8194('0x42')](_0x2c3514[_0x8194('0x43')],{'$or':_[_0x8194('0x35')](_0x1721a1,function(_0x2256d8){if(_0x2256d8['type']!==_0x8194('0x44')){var _0x14c450={};_0x14c450[_0x2256d8[_0x8194('0x30')]]={'$like':'%'+_0x1a8bf9[_0x8194('0x36')][_0x8194('0x45')]+'%'};return _0x14c450;}})});}_0x2c3514=_['merge']({},_0x2c3514,_0x1a8bf9[_0x8194('0x46')]);var _0xc20525={'where':_0x2c3514[_0x8194('0x43')]};return db[_0x8194('0x32')][_0x8194('0x25')](_0xc20525)[_0x8194('0x2c')](function(_0x36789b){_0x4c1993['count']=_0x36789b;if(_0x1a8bf9[_0x8194('0x36')][_0x8194('0x47')]){_0x2c3514[_0x8194('0x48')]=[{'all':!![]}];}return db[_0x8194('0x32')]['findAll'](_0x2c3514);})['then'](function(_0x1fac16){_0x4c1993['rows']=_0x1fac16;return _0x4c1993;})[_0x8194('0x2c')](respondWithFilteredResult(_0x126795,_0x2c3514))['catch'](handleError(_0x126795,null));};exports[_0x8194('0x49')]=function(_0x573003,_0x1200c8){var _0x3e7ab2={'raw':!![],'where':{'id':_0x573003[_0x8194('0x4a')]['id']}},_0x958766={};_0x958766['model']=_[_0x8194('0x37')](db[_0x8194('0x32')][_0x8194('0x4b')]);_0x958766['query']=_[_0x8194('0x37')](_0x573003[_0x8194('0x36')]);_0x958766[_0x8194('0x41')]=_[_0x8194('0x3a')](_0x958766[_0x8194('0x38')],_0x958766['query']);_0x3e7ab2[_0x8194('0x39')]=_['intersection'](_0x958766[_0x8194('0x38')],qs[_0x8194('0x3b')](_0x573003[_0x8194('0x36')][_0x8194('0x3b')]));_0x3e7ab2[_0x8194('0x39')]=_0x3e7ab2[_0x8194('0x39')][_0x8194('0x3c')]?_0x3e7ab2[_0x8194('0x39')]:_0x958766[_0x8194('0x38')];if(_0x573003[_0x8194('0x36')][_0x8194('0x47')]){_0x3e7ab2[_0x8194('0x48')]=[{'all':!![]}];}_0x3e7ab2=_[_0x8194('0x42')]({},_0x3e7ab2,_0x573003[_0x8194('0x46')]);return db[_0x8194('0x32')][_0x8194('0x4c')](_0x3e7ab2)[_0x8194('0x2c')](handleEntityNotFound(_0x1200c8,null))[_0x8194('0x2c')](respondWithResult(_0x1200c8,null))['catch'](handleError(_0x1200c8,null));};exports[_0x8194('0x4d')]=function(_0x33c0f8,_0x5542ed){return db['MailQueue'][_0x8194('0x4d')](_0x33c0f8[_0x8194('0x4e')],{})[_0x8194('0x2c')](function(_0x3029fe){var _0x3f85af=_0x33c0f8[_0x8194('0x4f')][_0x8194('0x2e')]({'plain':!![]});if(!_0x3f85af)throw new Error(_0x8194('0x50'));if(_0x3f85af[_0x8194('0x51')]===_0x8194('0x4f')){var _0x5aa280=_0x3029fe['get']({'plain':!![]});var _0x510f6d='MailQueues';return db[_0x8194('0x52')][_0x8194('0x4c')]({'where':{'name':_0x510f6d,'userProfileId':_0x3f85af[_0x8194('0x53')]},'raw':!![]})[_0x8194('0x2c')](function(_0x381091){if(_0x381091&&_0x381091[_0x8194('0x54')]===0x0){return db[_0x8194('0x55')][_0x8194('0x4d')]({'name':_0x5aa280[_0x8194('0x30')],'resourceId':_0x5aa280['id'],'type':_0x381091['name'],'sectionId':_0x381091['id']},{})['then'](function(){return _0x3029fe;});}else{return _0x3029fe;}})[_0x8194('0x56')](function(_0x156aff){logger[_0x8194('0x2f')](_0x8194('0x57'),_0x156aff);throw _0x156aff;});}return _0x3029fe;})[_0x8194('0x2c')](respondWithResult(_0x5542ed,0xc9))[_0x8194('0x56')](handleError(_0x5542ed,null));};exports['update']=function(_0x40c82c,_0x10b854){if(_0x40c82c[_0x8194('0x4e')]['id']){delete _0x40c82c[_0x8194('0x4e')]['id'];}return db[_0x8194('0x32')][_0x8194('0x4c')]({'where':{'id':_0x40c82c[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x10b854,null))['then'](saveUpdates(_0x40c82c[_0x8194('0x4e')],null))[_0x8194('0x2c')](respondWithResult(_0x10b854,null))[_0x8194('0x56')](handleError(_0x10b854,null));};exports[_0x8194('0x2d')]=function(_0x3105cb,_0x2044f3){return db[_0x8194('0x32')][_0x8194('0x4c')]({'where':{'id':_0x3105cb[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x2044f3,null))[_0x8194('0x2c')](removeEntity(_0x2044f3,null))['catch'](handleError(_0x2044f3,null));};exports[_0x8194('0x58')]=function(_0x27f041,_0x317da7){return db[_0x8194('0x32')]['describe']()['then'](respondWithResult(_0x317da7,null))[_0x8194('0x56')](handleError(_0x317da7,null));};exports[_0x8194('0x59')]=function(_0x3554b5,_0x5a1d9e,_0x46136d){var _0x4cf5cc={'raw':!![],'where':{}},_0x3eb9be={},_0xb8ad36;return db[_0x8194('0x32')][_0x8194('0x5a')]({'where':{'id':_0x3554b5[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x5a1d9e,null))[_0x8194('0x2c')](function(_0x186898){if(_0x186898){_0xb8ad36=_0x186898[_0x8194('0x2e')]({'plain':!![]});_0x3eb9be[_0x8194('0x38')]=_[_0x8194('0x37')](db[_0x8194('0x5b')][_0x8194('0x4b')]);_0x3eb9be['query']=_['keys'](_0x3554b5['query']);_0x3eb9be[_0x8194('0x41')]=_[_0x8194('0x3a')](_0x3eb9be[_0x8194('0x38')],_0x3eb9be['query']);_0x4cf5cc[_0x8194('0x39')]=_[_0x8194('0x3a')](_0x3eb9be['model'],qs[_0x8194('0x3b')](_0x3554b5['query']['fields']));_0x4cf5cc['attributes']=_0x4cf5cc['attributes'][_0x8194('0x3c')]?_0x4cf5cc[_0x8194('0x39')]:_0x3eb9be[_0x8194('0x38')];if(!_0x3554b5[_0x8194('0x36')]['hasOwnProperty'](_0x8194('0x3e'))){_0x4cf5cc[_0x8194('0x24')]=qs[_0x8194('0x24')](_0x3554b5[_0x8194('0x36')][_0x8194('0x24')]);_0x4cf5cc[_0x8194('0x22')]=qs[_0x8194('0x22')](_0x3554b5[_0x8194('0x36')][_0x8194('0x22')]);}_0x4cf5cc[_0x8194('0x3f')]=qs['sort'](_0x3554b5['query']['sort']);_0x4cf5cc[_0x8194('0x43')]=qs[_0x8194('0x41')](_['pick'](_0x3554b5[_0x8194('0x36')],_0x3eb9be[_0x8194('0x41')]));_0x4cf5cc['where']['MailQueueId']=_0x186898['id'];if(_0x3554b5[_0x8194('0x36')][_0x8194('0x45')]){_0x4cf5cc[_0x8194('0x43')]=_[_0x8194('0x42')](_0x4cf5cc[_0x8194('0x43')],{'$or':_['map'](_0x4cf5cc['attributes'],function(_0x5bfb4c){var _0x429a8b={};_0x429a8b[_0x5bfb4c]={'$like':'%'+_0x3554b5[_0x8194('0x36')][_0x8194('0x45')]+'%'};return _0x429a8b;})});}_0x4cf5cc=_['merge']({},_0x4cf5cc,_0x3554b5[_0x8194('0x46')]);return db['UserMailQueue'][_0x8194('0x5c')](_0x4cf5cc);}})[_0x8194('0x2c')](function(_0x3da585){if(_0x3da585){return db['User'][_0x8194('0x5d')]({'where':{'id':_['map'](_0x3da585,'UserId'),'role':'agent'},'attributes':['id',_0x8194('0x30'),_0x8194('0x5e'),_0x8194('0x5f'),_0x8194('0x60')]});}})['then'](function(_0x7f3a6c){if(_0x7f3a6c){return{'count':_0x7f3a6c['count'],'rows':_[_0x8194('0x35')](_0x7f3a6c[_0x8194('0x61')],function(_0x1b137b){return{'membername':_0x1b137b['name'],'UserId':_0x1b137b['id'],'queue_name':_0xb8ad36['name'],'MailQueueId':_0xb8ad36['id'],'interface':util[_0x8194('0x62')](_0x8194('0x63'),_0x8194('0x64'),_0x1b137b[_0x8194('0x30')]),'penalty':0x0,'paused':_0x1b137b[_0x8194('0x5e')],'createdAt':_0x1b137b[_0x8194('0x60')],'updatedAt':_0x1b137b[_0x8194('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8194('0x2c')](respondWithFilteredResult(_0x5a1d9e,_0x4cf5cc))[_0x8194('0x56')](handleError(_0x5a1d9e,null));};exports[_0x8194('0x65')]=function(_0x26bd94,_0x47cc54,_0x54e292){var _0x5e5eff={};var _0x34dd0c={};var _0x453894;var _0x4114f2;return db['MailQueue'][_0x8194('0x5a')]({'where':{'id':_0x26bd94[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x47cc54,null))['then'](function(_0x1f159d){if(_0x1f159d){_0x453894=_0x1f159d;_0x34dd0c[_0x8194('0x38')]=_[_0x8194('0x37')](db[_0x8194('0x66')][_0x8194('0x4b')]);_0x34dd0c['query']=_[_0x8194('0x37')](_0x26bd94[_0x8194('0x36')]);_0x34dd0c['filters']=_[_0x8194('0x3a')](_0x34dd0c['model'],_0x34dd0c[_0x8194('0x36')]);_0x5e5eff[_0x8194('0x39')]=_[_0x8194('0x3a')](_0x34dd0c[_0x8194('0x38')],qs[_0x8194('0x3b')](_0x26bd94[_0x8194('0x36')][_0x8194('0x3b')]));_0x5e5eff[_0x8194('0x39')]=_0x5e5eff['attributes'][_0x8194('0x3c')]?_0x5e5eff[_0x8194('0x39')]:_0x34dd0c['model'];_0x5e5eff['order']=qs[_0x8194('0x67')](_0x26bd94[_0x8194('0x36')][_0x8194('0x67')]);_0x5e5eff[_0x8194('0x43')]=qs[_0x8194('0x41')](_['pick'](_0x26bd94[_0x8194('0x36')],_0x34dd0c[_0x8194('0x41')]));if(_0x26bd94['query'][_0x8194('0x45')]){_0x5e5eff['where']=_[_0x8194('0x42')](_0x5e5eff['where'],{'$or':_[_0x8194('0x35')](_0x5e5eff[_0x8194('0x39')],function(_0x286d9d){var _0x57a13b={};_0x57a13b[_0x286d9d]={'$like':'%'+_0x26bd94['query'][_0x8194('0x45')]+'%'};return _0x57a13b;})});}_0x5e5eff=_[_0x8194('0x42')]({},_0x5e5eff,_0x26bd94[_0x8194('0x46')]);return _0x453894[_0x8194('0x65')](_0x5e5eff);}})[_0x8194('0x2c')](function(_0x225f77){if(_0x225f77){_0x4114f2=_0x225f77[_0x8194('0x3c')];if(!_0x26bd94[_0x8194('0x36')][_0x8194('0x3d')](_0x8194('0x3e'))){_0x5e5eff[_0x8194('0x24')]=qs[_0x8194('0x24')](_0x26bd94[_0x8194('0x36')][_0x8194('0x24')]);_0x5e5eff[_0x8194('0x22')]=qs[_0x8194('0x22')](_0x26bd94['query'][_0x8194('0x22')]);}return _0x453894[_0x8194('0x65')](_0x5e5eff);}})['then'](function(_0x28c384){if(_0x28c384){return _0x28c384?{'count':_0x4114f2,'rows':_0x28c384}:null;}})[_0x8194('0x2c')](respondWithResult(_0x47cc54,null))[_0x8194('0x56')](handleError(_0x47cc54,null));};exports['addTeams']=function(_0x18341e,_0x47e5dc,_0x7a9086){var _0x1480a0=_0x18341e[_0x8194('0x4e')]['ids'];return db['Team'][_0x8194('0x5c')]({'where':{'id':_0x1480a0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8194('0x68'),'attributes':['id',_0x8194('0x30'),_0x8194('0x69'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x2b623c){if(_0x2b623c){var _0x234147=_[_0x8194('0x6a')](_0x2b623c,function(_0x523745){var _0x37ab09=_0x523745[_0x8194('0x2e')]({'plain':!![]});return _0x37ab09[_0x8194('0x68')];});return db[_0x8194('0x32')][_0x8194('0x4c')]({'where':{'id':_0x18341e['params']['id']}})[_0x8194('0x2c')](function(_0x3df59a){return db[_0x8194('0x6b')][_0x8194('0x6c')](function(_0x415d1e){return _0x3df59a[_0x8194('0x6d')](_0x1480a0,{'transaction':_0x415d1e})['then'](function(){return BPromise['each'](_0x234147,function(_0x3cc996){return db[_0x8194('0x5b')]['findOrCreate']({'where':{'UserId':_0x3cc996['id'],'MailQueueId':_0x18341e['params']['id']},'transaction':_0x415d1e});});})[_0x8194('0x2c')](function(){_0x234147['forEach'](function(_0x38c8e7){socket[_0x8194('0x6e')](_0x8194('0x6f'),{'UserId':_0x38c8e7['id'],'MailQueueId':_0x3df59a['id']});});});});});}})[_0x8194('0x2c')](respondWithStatusCode(_0x47e5dc,null))['catch'](handleError(_0x47e5dc,null));};exports['removeTeams']=function(_0x354ff2,_0x3189a0,_0x4fae53){return db[_0x8194('0x66')][_0x8194('0x5c')]({'where':{'id':_0x354ff2[_0x8194('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8194('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3189a0,null))[_0x8194('0x2c')](function(_0x26de6d){var _0x183488=_[_0x8194('0x35')](_0x26de6d,'id');var _0x5a35e6=[];var _0x1e03f0=[];var _0x240324=squel[_0x8194('0x71')]();_0x240324['field'](_0x8194('0x72'))[_0x8194('0x73')](_0x8194('0x74'),'tq')['join'](_0x8194('0x75'),'ut',_0x8194('0x76'))['where'](_0x8194('0x77'),_0x354ff2[_0x8194('0x4a')]['id']);for(var _0x1b4567=0x0;_0x1b4567<_0x26de6d[_0x8194('0x3c')];_0x1b4567+=0x1){let _0x5dd849=_0x26de6d[_0x1b4567];for(var _0x3de436=0x0;_0x3de436<_0x5dd849[_0x8194('0x68')]['length'];_0x3de436+=0x1){let _0x678b41=_0x5dd849[_0x8194('0x68')][_0x3de436];var _0x315d95=_0x240324[_0x8194('0x78')]();_0x315d95[_0x8194('0x43')]('ut.UserId\x20=\x20?',_0x678b41['id']);_0x1e03f0[_0x8194('0x79')](db['sequelize']['query'](_0x315d95['toString'](),{'type':db[_0x8194('0x6b')][_0x8194('0x7a')][_0x8194('0x7b')]})[_0x8194('0x2c')](function(_0x2fd54d){if(_0x2fd54d[_0x8194('0x3c')]===0x1){return _0x678b41['id'];}else{var _0x1d57dc=_['every'](_[_0x8194('0x35')](_0x2fd54d,_0x8194('0x7c')),function(_0x4052ba){return _['includes'](_0x183488,_0x4052ba);});if(_0x1d57dc){return _0x678b41['id'];}}}));}}return BPromise[_0x8194('0x7d')](_0x1e03f0)['then'](function(_0x26daa9){_0x5a35e6=_(_0x5a35e6)['union'](_0x26daa9)[_0x8194('0x7e')]()['value']();return db['MailQueue'][_0x8194('0x4c')]({'where':{'id':_0x354ff2[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](function(_0x27511e){return db[_0x8194('0x6b')]['transaction'](function(_0xa10616){return _0x27511e['removeTeams'](_0x354ff2[_0x8194('0x36')]['ids'],{'transaction':_0xa10616})[_0x8194('0x2c')](function(){if(!_[_0x8194('0x7f')](_0x5a35e6)){return _0x27511e[_0x8194('0x80')](_0x5a35e6,{'transaction':_0xa10616});}})['then'](function(){_0x5a35e6['forEach'](function(_0x47c632){socket['emit'](_0x8194('0x81'),{'UserId':_0x47c632,'MailQueueId':_0x27511e['id']});});});});});});})[_0x8194('0x2c')](respondWithStatusCode(_0x3189a0,null))['catch'](handleError(_0x3189a0,null));};exports[_0x8194('0x82')]=function(_0x2c88a7,_0x7c3851,_0x4c818a){return db[_0x8194('0x32')]['find']({'where':{'id':_0x2c88a7[_0x8194('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7c3851,null))[_0x8194('0x2c')](function(_0x3b0577){if(_0x3b0577){return _0x3b0577[_0x8194('0x82')](_0x2c88a7[_0x8194('0x4e')][_0x8194('0x83')],_[_0x8194('0x84')](_0x2c88a7[_0x8194('0x4e')],[_0x8194('0x83'),'id'])||{})['spread'](function(_0x54b26b){for(var _0x3ba60f=0x0;_0x3ba60f<_0x2c88a7[_0x8194('0x4e')][_0x8194('0x83')][_0x8194('0x3c')];_0x3ba60f+=0x1){socket['emit'](_0x8194('0x6f'),{'UserId':Number(_0x2c88a7[_0x8194('0x4e')][_0x8194('0x83')][_0x3ba60f]),'MailQueueId':Number(_0x2c88a7['params']['id'])});}return _0x54b26b;});}})[_0x8194('0x2c')](respondWithResult(_0x7c3851,null))[_0x8194('0x56')](handleError(_0x7c3851,null));};exports[_0x8194('0x80')]=function(_0x4749e0,_0x5b38cc,_0x10d490){return db[_0x8194('0x32')][_0x8194('0x4c')]({'where':{'id':_0x4749e0[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x5b38cc,null))['then'](function(_0x73e287){if(_0x73e287){return _0x73e287['removeAgents'](_0x4749e0['query'][_0x8194('0x83')])[_0x8194('0x2c')](function(){if(_[_0x8194('0x85')](_0x4749e0[_0x8194('0x36')][_0x8194('0x83')])){for(var _0x165078=0x0;_0x165078<_0x4749e0[_0x8194('0x36')][_0x8194('0x83')]['length'];_0x165078+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4749e0[_0x8194('0x36')][_0x8194('0x83')][_0x165078]),'MailQueueId':Number(_0x4749e0[_0x8194('0x4a')]['id'])});}}else{socket[_0x8194('0x6e')](_0x8194('0x81'),{'UserId':Number(_0x4749e0['query'][_0x8194('0x83')]),'MailQueueId':Number(_0x4749e0[_0x8194('0x4a')]['id'])});}});}})[_0x8194('0x2c')](respondWithStatusCode(_0x5b38cc,null))[_0x8194('0x56')](handleError(_0x5b38cc,null));};exports['getAgents']=function(_0x5d388c,_0x53296a,_0xef8b0e){var _0x15e148={};var _0x47c371={};var _0x534431;var _0x32f7bb;return db[_0x8194('0x32')][_0x8194('0x5a')]({'where':{'id':_0x5d388c[_0x8194('0x4a')]['id']}})[_0x8194('0x2c')](handleEntityNotFound(_0x53296a,null))[_0x8194('0x2c')](function(_0x59a6d5){if(_0x59a6d5){_0x534431=_0x59a6d5;_0x47c371[_0x8194('0x38')]=_[_0x8194('0x37')](db[_0x8194('0x70')][_0x8194('0x4b')]);_0x47c371[_0x8194('0x36')]=_[_0x8194('0x37')](_0x5d388c['query']);_0x47c371[_0x8194('0x41')]=_['intersection'](_0x47c371['model'],_0x47c371[_0x8194('0x36')]);_0x15e148[_0x8194('0x39')]=_[_0x8194('0x3a')](_0x47c371[_0x8194('0x38')],qs['fields'](_0x5d388c[_0x8194('0x36')][_0x8194('0x3b')]));_0x15e148[_0x8194('0x39')]=_0x15e148[_0x8194('0x39')][_0x8194('0x3c')]?_0x15e148['attributes']:_0x47c371[_0x8194('0x38')];_0x15e148[_0x8194('0x3f')]=qs[_0x8194('0x67')](_0x5d388c[_0x8194('0x36')][_0x8194('0x67')]);_0x15e148['where']=qs[_0x8194('0x41')](_[_0x8194('0x40')](_0x5d388c[_0x8194('0x36')],_0x47c371[_0x8194('0x41')]));if(_0x5d388c['query'][_0x8194('0x45')]){_0x15e148[_0x8194('0x43')]=_[_0x8194('0x42')](_0x15e148[_0x8194('0x43')],{'$or':_[_0x8194('0x35')](_0x15e148['attributes'],function(_0x5340a1){var _0x208b96={};_0x208b96[_0x5340a1]={'$like':'%'+_0x5d388c['query'][_0x8194('0x45')]+'%'};return _0x208b96;})});}_0x15e148=_['merge']({},_0x15e148,_0x5d388c[_0x8194('0x46')]);return _0x534431[_0x8194('0x86')](_0x15e148);}})[_0x8194('0x2c')](function(_0x328b06){if(_0x328b06){_0x32f7bb=_0x328b06[_0x8194('0x3c')];if(!_0x5d388c[_0x8194('0x36')][_0x8194('0x3d')](_0x8194('0x3e'))){_0x15e148['limit']=qs[_0x8194('0x24')](_0x5d388c[_0x8194('0x36')][_0x8194('0x24')]);_0x15e148[_0x8194('0x22')]=qs['offset'](_0x5d388c[_0x8194('0x36')][_0x8194('0x22')]);}return _0x534431[_0x8194('0x86')](_0x15e148);}})[_0x8194('0x2c')](function(_0x2dbd14){if(_0x2dbd14){return _0x2dbd14?{'count':_0x32f7bb,'rows':_0x2dbd14}:null;}})['then'](respondWithResult(_0x53296a,null))[_0x8194('0x56')](handleError(_0x53296a,null));}; \ No newline at end of file +var _0x9b7e=['ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','omit','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','attributes','intersection','fields','query','hasOwnProperty','order','sort','pick','filters','filter','where','merge','options','MailQueue','findAll','rows','catch','show','params','length','includeAll','include','find','create','role','UserProfileSection','autoAssociation','error','body','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','format','SIP','createdAt','Team','getTeams','User','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone'];(function(_0x556ae4,_0x191132){var _0x2836be=function(_0x39f14e){while(--_0x39f14e){_0x556ae4['push'](_0x556ae4['shift']());}};_0x2836be(++_0x191132);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x9b7e[_0x79a6e8];return _0xeeb993;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9b7('0x0'));var zipdir=require(_0xe9b7('0x1'));var jsonpatch=require(_0xe9b7('0x2'));var rp=require(_0xe9b7('0x3'));var moment=require(_0xe9b7('0x4'));var BPromise=require(_0xe9b7('0x5'));var Mustache=require(_0xe9b7('0x6'));var util=require(_0xe9b7('0x7'));var path=require(_0xe9b7('0x8'));var sox=require(_0xe9b7('0x9'));var csv=require('to-csv');var ejs=require(_0xe9b7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9b7('0xb'));var squel=require('squel');var crypto=require(_0xe9b7('0xc'));var jsforce=require(_0xe9b7('0xd'));var deskjs=require(_0xe9b7('0xe'));var toCsv=require(_0xe9b7('0xf'));var querystring=require(_0xe9b7('0x10'));var Papa=require(_0xe9b7('0x11'));var Redis=require(_0xe9b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe9b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9b7('0x14'));var logger=require('../../config/logger')(_0xe9b7('0x15'));var utils=require(_0xe9b7('0x16'));var config=require(_0xe9b7('0x17'));var licenseUtil=require(_0xe9b7('0x18'));var db=require(_0xe9b7('0x19'))['db'];config[_0xe9b7('0x1a')]=_[_0xe9b7('0x1b')](config[_0xe9b7('0x1a')],{'host':_0xe9b7('0x1c'),'port':0x18eb});var socket=require(_0xe9b7('0x1d'))(new Redis(config[_0xe9b7('0x1a')]));require(_0xe9b7('0x1e'))['register'](socket);function respondWithStatusCode(_0xc8a0d5,_0x1fae77){_0x1fae77=_0x1fae77||0xcc;return function(_0x155021){if(_0x155021){return _0xc8a0d5[_0xe9b7('0x1f')](_0x1fae77);}return _0xc8a0d5[_0xe9b7('0x20')](_0x1fae77)[_0xe9b7('0x21')]();};}function respondWithResult(_0x4dbb6b,_0x375782){_0x375782=_0x375782||0xc8;return function(_0x117cbd){if(_0x117cbd){return _0x4dbb6b[_0xe9b7('0x20')](_0x375782)[_0xe9b7('0x22')](_0x117cbd);}};}function respondWithFilteredResult(_0x3f17ca,_0x36fff9){return function(_0x103963){if(_0x103963){var _0x3664fa=typeof _0x36fff9['offset']==='undefined'&&typeof _0x36fff9[_0xe9b7('0x23')]===_0xe9b7('0x24');var _0x409cc6=_0x103963[_0xe9b7('0x25')];var _0x26c710=_0x3664fa?0x0:_0x36fff9[_0xe9b7('0x26')];var _0x2b84e2=_0x3664fa?_0x103963[_0xe9b7('0x25')]:_0x36fff9[_0xe9b7('0x26')]+_0x36fff9[_0xe9b7('0x23')];var _0x4217c2;if(_0x2b84e2>=_0x409cc6){_0x2b84e2=_0x409cc6;_0x4217c2=0xc8;}else{_0x4217c2=0xce;}_0x3f17ca[_0xe9b7('0x20')](_0x4217c2);return _0x3f17ca['set']('Content-Range',_0x26c710+'-'+_0x2b84e2+'/'+_0x409cc6)[_0xe9b7('0x22')](_0x103963);}return null;};}function patchUpdates(_0x15c2d5){return function(_0x3e61d6){try{jsonpatch[_0xe9b7('0x27')](_0x3e61d6,_0x15c2d5,!![]);}catch(_0x59ead6){return BPromise[_0xe9b7('0x28')](_0x59ead6);}return _0x3e61d6[_0xe9b7('0x29')]();};}function saveUpdates(_0x5076fb,_0x52bcd0){return function(_0x5229ae){if(_0x5229ae){return _0x5229ae[_0xe9b7('0x2a')](_0x5076fb)[_0xe9b7('0x2b')](function(_0x569dc8){return _0x569dc8;});}return null;};}function removeEntity(_0x29cf7f,_0x2bd682){return function(_0x3d7b22){if(_0x3d7b22){return _0x3d7b22[_0xe9b7('0x2c')]()[_0xe9b7('0x2b')](function(){var _0x34e70e=_0x3d7b22[_0xe9b7('0x2d')]({'plain':!![]});var _0x4df2c2=_0xe9b7('0x2e');return db[_0xe9b7('0x2f')]['destroy']({'where':{'type':_0x4df2c2,'resourceId':_0x34e70e['id']}})[_0xe9b7('0x2b')](function(){return _0x3d7b22;});})['then'](function(){_0x29cf7f[_0xe9b7('0x20')](0xcc)[_0xe9b7('0x21')]();});}};}function handleEntityNotFound(_0x5629ff,_0x2b5f0e){return function(_0x12fd60){if(!_0x12fd60){_0x5629ff[_0xe9b7('0x1f')](0x194);}return _0x12fd60;};}function handleError(_0x183845,_0x36610d){_0x36610d=_0x36610d||0x1f4;return function(_0x4b1c34){logger['error'](_0x4b1c34[_0xe9b7('0x30')]);if(_0x4b1c34['name']){delete _0x4b1c34[_0xe9b7('0x31')];}_0x183845[_0xe9b7('0x20')](_0x36610d)[_0xe9b7('0x32')](_0x4b1c34);};}exports[_0xe9b7('0x33')]=function(_0x2488db,_0x567d00){var _0x398272={},_0x114986={},_0x3d4eb5={'count':0x0,'rows':[]};var _0x3e9bdb=_['map'](db['MailQueue'][_0xe9b7('0x34')],function(_0x6b65b5){return{'name':_0x6b65b5[_0xe9b7('0x35')],'type':_0x6b65b5[_0xe9b7('0x36')][_0xe9b7('0x37')]};});_0x114986[_0xe9b7('0x38')]=_[_0xe9b7('0x39')](_0x3e9bdb,_0xe9b7('0x31'));_0x114986['query']=_[_0xe9b7('0x3a')](_0x2488db['query']);_0x114986['filters']=_['intersection'](_0x114986[_0xe9b7('0x38')],_0x114986['query']);_0x398272[_0xe9b7('0x3b')]=_[_0xe9b7('0x3c')](_0x114986['model'],qs[_0xe9b7('0x3d')](_0x2488db[_0xe9b7('0x3e')][_0xe9b7('0x3d')]));_0x398272[_0xe9b7('0x3b')]=_0x398272['attributes']['length']?_0x398272['attributes']:_0x114986[_0xe9b7('0x38')];if(!_0x2488db[_0xe9b7('0x3e')][_0xe9b7('0x3f')]('nolimit')){_0x398272['limit']=qs[_0xe9b7('0x23')](_0x2488db[_0xe9b7('0x3e')]['limit']);_0x398272[_0xe9b7('0x26')]=qs['offset'](_0x2488db[_0xe9b7('0x3e')][_0xe9b7('0x26')]);}_0x398272[_0xe9b7('0x40')]=qs['sort'](_0x2488db[_0xe9b7('0x3e')][_0xe9b7('0x41')]);_0x398272['where']=qs['filters'](_[_0xe9b7('0x42')](_0x2488db[_0xe9b7('0x3e')],_0x114986[_0xe9b7('0x43')]),_0x3e9bdb);if(_0x2488db[_0xe9b7('0x3e')][_0xe9b7('0x44')]){_0x398272[_0xe9b7('0x45')]=_[_0xe9b7('0x46')](_0x398272[_0xe9b7('0x45')],{'$or':_[_0xe9b7('0x39')](_0x3e9bdb,function(_0x51398b){if(_0x51398b[_0xe9b7('0x36')]!=='VIRTUAL'){var _0x34a3d7={};_0x34a3d7[_0x51398b['name']]={'$like':'%'+_0x2488db['query'][_0xe9b7('0x44')]+'%'};return _0x34a3d7;}})});}_0x398272=_[_0xe9b7('0x46')]({},_0x398272,_0x2488db[_0xe9b7('0x47')]);var _0x1fbba7={'where':_0x398272[_0xe9b7('0x45')]};return db[_0xe9b7('0x48')][_0xe9b7('0x25')](_0x1fbba7)[_0xe9b7('0x2b')](function(_0x2c899d){_0x3d4eb5[_0xe9b7('0x25')]=_0x2c899d;if(_0x2488db[_0xe9b7('0x3e')]['includeAll']){_0x398272['include']=[{'all':!![]}];}return db[_0xe9b7('0x48')][_0xe9b7('0x49')](_0x398272);})[_0xe9b7('0x2b')](function(_0x37591a){_0x3d4eb5[_0xe9b7('0x4a')]=_0x37591a;return _0x3d4eb5;})[_0xe9b7('0x2b')](respondWithFilteredResult(_0x567d00,_0x398272))[_0xe9b7('0x4b')](handleError(_0x567d00,null));};exports[_0xe9b7('0x4c')]=function(_0x22f1bb,_0x25b792){var _0xef532a={'raw':!![],'where':{'id':_0x22f1bb[_0xe9b7('0x4d')]['id']}},_0xfa5105={};_0xfa5105[_0xe9b7('0x38')]=_['keys'](db[_0xe9b7('0x48')][_0xe9b7('0x34')]);_0xfa5105[_0xe9b7('0x3e')]=_[_0xe9b7('0x3a')](_0x22f1bb[_0xe9b7('0x3e')]);_0xfa5105['filters']=_[_0xe9b7('0x3c')](_0xfa5105[_0xe9b7('0x38')],_0xfa5105[_0xe9b7('0x3e')]);_0xef532a[_0xe9b7('0x3b')]=_[_0xe9b7('0x3c')](_0xfa5105[_0xe9b7('0x38')],qs[_0xe9b7('0x3d')](_0x22f1bb[_0xe9b7('0x3e')][_0xe9b7('0x3d')]));_0xef532a['attributes']=_0xef532a[_0xe9b7('0x3b')][_0xe9b7('0x4e')]?_0xef532a[_0xe9b7('0x3b')]:_0xfa5105[_0xe9b7('0x38')];if(_0x22f1bb['query'][_0xe9b7('0x4f')]){_0xef532a[_0xe9b7('0x50')]=[{'all':!![]}];}_0xef532a=_['merge']({},_0xef532a,_0x22f1bb[_0xe9b7('0x47')]);return db['MailQueue'][_0xe9b7('0x51')](_0xef532a)[_0xe9b7('0x2b')](handleEntityNotFound(_0x25b792,null))['then'](respondWithResult(_0x25b792,null))[_0xe9b7('0x4b')](handleError(_0x25b792,null));};exports[_0xe9b7('0x52')]=function(_0x2fa5b9,_0x37139b){return db[_0xe9b7('0x48')]['create'](_0x2fa5b9['body'],{})[_0xe9b7('0x2b')](function(_0x2c609e){var _0x1a83b8=_0x2fa5b9['user']['get']({'plain':!![]});if(!_0x1a83b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a83b8[_0xe9b7('0x53')]==='user'){var _0x34d4e2=_0x2c609e[_0xe9b7('0x2d')]({'plain':!![]});var _0x2cca89=_0xe9b7('0x2e');return db[_0xe9b7('0x54')]['find']({'where':{'name':_0x2cca89,'userProfileId':_0x1a83b8['userProfileId']},'raw':!![]})[_0xe9b7('0x2b')](function(_0x388eb8){if(_0x388eb8&&_0x388eb8[_0xe9b7('0x55')]===0x0){return db[_0xe9b7('0x2f')][_0xe9b7('0x52')]({'name':_0x34d4e2[_0xe9b7('0x31')],'resourceId':_0x34d4e2['id'],'type':_0x388eb8[_0xe9b7('0x31')],'sectionId':_0x388eb8['id']},{})['then'](function(){return _0x2c609e;});}else{return _0x2c609e;}})[_0xe9b7('0x4b')](function(_0x1da497){logger[_0xe9b7('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1da497);throw _0x1da497;});}return _0x2c609e;})[_0xe9b7('0x2b')](respondWithResult(_0x37139b,0xc9))[_0xe9b7('0x4b')](handleError(_0x37139b,null));};exports[_0xe9b7('0x2a')]=function(_0x119ff,_0x3ccf66){if(_0x119ff[_0xe9b7('0x57')]['id']){delete _0x119ff[_0xe9b7('0x57')]['id'];}return db[_0xe9b7('0x48')][_0xe9b7('0x51')]({'where':{'id':_0x119ff[_0xe9b7('0x4d')]['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x3ccf66,null))[_0xe9b7('0x2b')](saveUpdates(_0x119ff['body'],null))['then'](respondWithResult(_0x3ccf66,null))[_0xe9b7('0x4b')](handleError(_0x3ccf66,null));};exports[_0xe9b7('0x2c')]=function(_0x1e1c38,_0x485634){return db[_0xe9b7('0x48')]['find']({'where':{'id':_0x1e1c38['params']['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x485634,null))[_0xe9b7('0x2b')](removeEntity(_0x485634,null))[_0xe9b7('0x4b')](handleError(_0x485634,null));};exports[_0xe9b7('0x58')]=function(_0x59ecee,_0x3a817d){return db[_0xe9b7('0x48')][_0xe9b7('0x58')]()[_0xe9b7('0x2b')](respondWithResult(_0x3a817d,null))[_0xe9b7('0x4b')](handleError(_0x3a817d,null));};exports[_0xe9b7('0x59')]=function(_0x4978ec,_0x2e9345,_0x34d7d7){var _0x51332c={'raw':!![],'where':{}},_0x2953bf={},_0x113150;return db[_0xe9b7('0x48')][_0xe9b7('0x5a')]({'where':{'id':_0x4978ec[_0xe9b7('0x4d')]['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x2e9345,null))[_0xe9b7('0x2b')](function(_0x28d48f){if(_0x28d48f){_0x113150=_0x28d48f[_0xe9b7('0x2d')]({'plain':!![]});_0x2953bf[_0xe9b7('0x38')]=_['keys'](db[_0xe9b7('0x5b')][_0xe9b7('0x34')]);_0x2953bf[_0xe9b7('0x3e')]=_[_0xe9b7('0x3a')](_0x4978ec['query']);_0x2953bf[_0xe9b7('0x43')]=_[_0xe9b7('0x3c')](_0x2953bf['model'],_0x2953bf[_0xe9b7('0x3e')]);_0x51332c[_0xe9b7('0x3b')]=_['intersection'](_0x2953bf[_0xe9b7('0x38')],qs[_0xe9b7('0x3d')](_0x4978ec[_0xe9b7('0x3e')][_0xe9b7('0x3d')]));_0x51332c[_0xe9b7('0x3b')]=_0x51332c[_0xe9b7('0x3b')][_0xe9b7('0x4e')]?_0x51332c[_0xe9b7('0x3b')]:_0x2953bf[_0xe9b7('0x38')];if(!_0x4978ec['query'][_0xe9b7('0x3f')](_0xe9b7('0x5c'))){_0x51332c[_0xe9b7('0x23')]=qs['limit'](_0x4978ec[_0xe9b7('0x3e')][_0xe9b7('0x23')]);_0x51332c[_0xe9b7('0x26')]=qs['offset'](_0x4978ec['query'][_0xe9b7('0x26')]);}_0x51332c[_0xe9b7('0x40')]=qs[_0xe9b7('0x41')](_0x4978ec['query'][_0xe9b7('0x41')]);_0x51332c['where']=qs['filters'](_[_0xe9b7('0x42')](_0x4978ec[_0xe9b7('0x3e')],_0x2953bf[_0xe9b7('0x43')]));_0x51332c['where'][_0xe9b7('0x5d')]=_0x28d48f['id'];if(_0x4978ec[_0xe9b7('0x3e')]['filter']){_0x51332c[_0xe9b7('0x45')]=_[_0xe9b7('0x46')](_0x51332c[_0xe9b7('0x45')],{'$or':_[_0xe9b7('0x39')](_0x51332c[_0xe9b7('0x3b')],function(_0x1c75f7){var _0x23d75d={};_0x23d75d[_0x1c75f7]={'$like':'%'+_0x4978ec[_0xe9b7('0x3e')][_0xe9b7('0x44')]+'%'};return _0x23d75d;})});}_0x51332c=_[_0xe9b7('0x46')]({},_0x51332c,_0x4978ec['options']);return db[_0xe9b7('0x5b')][_0xe9b7('0x49')](_0x51332c);}})['then'](function(_0x32e216){if(_0x32e216){return db['User'][_0xe9b7('0x5e')]({'where':{'id':_[_0xe9b7('0x39')](_0x32e216,_0xe9b7('0x5f')),'role':_0xe9b7('0x60')},'attributes':['id',_0xe9b7('0x31'),_0xe9b7('0x61'),_0xe9b7('0x62'),'createdAt']});}})[_0xe9b7('0x2b')](function(_0x29be42){if(_0x29be42){return{'count':_0x29be42['count'],'rows':_['map'](_0x29be42[_0xe9b7('0x4a')],function(_0x27e347){return{'membername':_0x27e347[_0xe9b7('0x31')],'UserId':_0x27e347['id'],'queue_name':_0x113150[_0xe9b7('0x31')],'MailQueueId':_0x113150['id'],'interface':util[_0xe9b7('0x63')]('%s/%s',_0xe9b7('0x64'),_0x27e347[_0xe9b7('0x31')]),'penalty':0x0,'paused':_0x27e347[_0xe9b7('0x61')],'createdAt':_0x27e347[_0xe9b7('0x65')],'updatedAt':_0x27e347[_0xe9b7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe9b7('0x2b')](respondWithFilteredResult(_0x2e9345,_0x51332c))[_0xe9b7('0x4b')](handleError(_0x2e9345,null));};exports['getTeams']=function(_0x4f5bec,_0x45e0db,_0x1d2b42){var _0x1c465f={};var _0x5d0b68={};var _0x2d42e1;var _0x3a152f;return db[_0xe9b7('0x48')][_0xe9b7('0x5a')]({'where':{'id':_0x4f5bec[_0xe9b7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45e0db,null))[_0xe9b7('0x2b')](function(_0x3c42ce){if(_0x3c42ce){_0x2d42e1=_0x3c42ce;_0x5d0b68[_0xe9b7('0x38')]=_['keys'](db[_0xe9b7('0x66')][_0xe9b7('0x34')]);_0x5d0b68[_0xe9b7('0x3e')]=_[_0xe9b7('0x3a')](_0x4f5bec[_0xe9b7('0x3e')]);_0x5d0b68[_0xe9b7('0x43')]=_[_0xe9b7('0x3c')](_0x5d0b68['model'],_0x5d0b68[_0xe9b7('0x3e')]);_0x1c465f[_0xe9b7('0x3b')]=_['intersection'](_0x5d0b68[_0xe9b7('0x38')],qs['fields'](_0x4f5bec[_0xe9b7('0x3e')]['fields']));_0x1c465f[_0xe9b7('0x3b')]=_0x1c465f[_0xe9b7('0x3b')][_0xe9b7('0x4e')]?_0x1c465f[_0xe9b7('0x3b')]:_0x5d0b68[_0xe9b7('0x38')];_0x1c465f[_0xe9b7('0x40')]=qs['sort'](_0x4f5bec[_0xe9b7('0x3e')][_0xe9b7('0x41')]);_0x1c465f[_0xe9b7('0x45')]=qs['filters'](_[_0xe9b7('0x42')](_0x4f5bec['query'],_0x5d0b68[_0xe9b7('0x43')]));if(_0x4f5bec[_0xe9b7('0x3e')][_0xe9b7('0x44')]){_0x1c465f[_0xe9b7('0x45')]=_[_0xe9b7('0x46')](_0x1c465f[_0xe9b7('0x45')],{'$or':_[_0xe9b7('0x39')](_0x1c465f[_0xe9b7('0x3b')],function(_0x34f7d4){var _0x43bb17={};_0x43bb17[_0x34f7d4]={'$like':'%'+_0x4f5bec[_0xe9b7('0x3e')]['filter']+'%'};return _0x43bb17;})});}_0x1c465f=_[_0xe9b7('0x46')]({},_0x1c465f,_0x4f5bec[_0xe9b7('0x47')]);return _0x2d42e1[_0xe9b7('0x67')](_0x1c465f);}})[_0xe9b7('0x2b')](function(_0x41d1b9){if(_0x41d1b9){_0x3a152f=_0x41d1b9[_0xe9b7('0x4e')];if(!_0x4f5bec[_0xe9b7('0x3e')]['hasOwnProperty'](_0xe9b7('0x5c'))){_0x1c465f[_0xe9b7('0x23')]=qs[_0xe9b7('0x23')](_0x4f5bec[_0xe9b7('0x3e')][_0xe9b7('0x23')]);_0x1c465f[_0xe9b7('0x26')]=qs['offset'](_0x4f5bec['query'][_0xe9b7('0x26')]);}return _0x2d42e1[_0xe9b7('0x67')](_0x1c465f);}})[_0xe9b7('0x2b')](function(_0x34c4fc){if(_0x34c4fc){return _0x34c4fc?{'count':_0x3a152f,'rows':_0x34c4fc}:null;}})[_0xe9b7('0x2b')](respondWithResult(_0x45e0db,null))['catch'](handleError(_0x45e0db,null));};exports['addTeams']=function(_0x58f003,_0x331d39,_0x47c5b1){var _0x143d96=_0x58f003[_0xe9b7('0x57')]['ids'];return db[_0xe9b7('0x66')]['findAll']({'where':{'id':_0x143d96},'attributes':['id'],'include':[{'model':db[_0xe9b7('0x68')],'as':_0xe9b7('0x69'),'attributes':['id',_0xe9b7('0x31'),_0xe9b7('0x6a'),'voicePause',_0xe9b7('0x6b')],'raw':!![]}]})[_0xe9b7('0x2b')](function(_0x380d1f){if(_0x380d1f){var _0x32c3fa=_[_0xe9b7('0x6c')](_0x380d1f,function(_0x2702b5){var _0x1a8c3f=_0x2702b5['get']({'plain':!![]});return _0x1a8c3f[_0xe9b7('0x69')];});return db['MailQueue']['find']({'where':{'id':_0x58f003['params']['id']}})[_0xe9b7('0x2b')](function(_0xd2b296){return db[_0xe9b7('0x6d')][_0xe9b7('0x6e')](function(_0x3948ee){return _0xd2b296[_0xe9b7('0x6f')](_0x143d96,{'transaction':_0x3948ee})['then'](function(){return BPromise[_0xe9b7('0x70')](_0x32c3fa,function(_0x5830b7){return db[_0xe9b7('0x5b')][_0xe9b7('0x71')]({'where':{'UserId':_0x5830b7['id'],'MailQueueId':_0x58f003[_0xe9b7('0x4d')]['id']},'transaction':_0x3948ee});});})['then'](function(){_0x32c3fa['forEach'](function(_0x3ad116){socket[_0xe9b7('0x72')](_0xe9b7('0x73'),{'UserId':_0x3ad116['id'],'MailQueueId':_0xd2b296['id']});});});});});}})[_0xe9b7('0x2b')](respondWithStatusCode(_0x331d39,null))[_0xe9b7('0x4b')](handleError(_0x331d39,null));};exports[_0xe9b7('0x74')]=function(_0x3c0469,_0x87656d,_0x401acf){return db[_0xe9b7('0x66')][_0xe9b7('0x49')]({'where':{'id':_0x3c0469[_0xe9b7('0x3e')][_0xe9b7('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe9b7('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x87656d,null))[_0xe9b7('0x2b')](function(_0x18d234){var _0x40215c=_[_0xe9b7('0x39')](_0x18d234,'id');var _0xc20252=[];var _0x5338e7=[];var _0x5a4c4b=squel[_0xe9b7('0x76')]();_0x5a4c4b[_0xe9b7('0x77')](_0xe9b7('0x78'))[_0xe9b7('0x79')]('team_has_mail_queues','tq')[_0xe9b7('0x7a')](_0xe9b7('0x7b'),'ut',_0xe9b7('0x7c'))[_0xe9b7('0x45')](_0xe9b7('0x7d'),_0x3c0469[_0xe9b7('0x4d')]['id']);for(var _0xbf112=0x0;_0xbf112<_0x18d234['length'];_0xbf112+=0x1){let _0x3c0d59=_0x18d234[_0xbf112];for(var _0xf82116=0x0;_0xf82116<_0x3c0d59[_0xe9b7('0x69')]['length'];_0xf82116+=0x1){let _0x3a4e5a=_0x3c0d59[_0xe9b7('0x69')][_0xf82116];var _0x986177=_0x5a4c4b[_0xe9b7('0x7e')]();_0x986177[_0xe9b7('0x45')](_0xe9b7('0x7f'),_0x3a4e5a['id']);_0x5338e7[_0xe9b7('0x80')](db[_0xe9b7('0x6d')][_0xe9b7('0x3e')](_0x986177['toString'](),{'type':db[_0xe9b7('0x6d')][_0xe9b7('0x81')]['SELECT']})[_0xe9b7('0x2b')](function(_0x3a060a){if(_0x3a060a[_0xe9b7('0x4e')]===0x1){return _0x3a4e5a['id'];}else{var _0x521f5a=_[_0xe9b7('0x82')](_[_0xe9b7('0x39')](_0x3a060a,_0xe9b7('0x83')),function(_0x1ad6fd){return _[_0xe9b7('0x84')](_0x40215c,_0x1ad6fd);});if(_0x521f5a){return _0x3a4e5a['id'];}}}));}}return BPromise[_0xe9b7('0x85')](_0x5338e7)[_0xe9b7('0x2b')](function(_0x3ba484){_0xc20252=_(_0xc20252)[_0xe9b7('0x86')](_0x3ba484)['compact']()[_0xe9b7('0x87')]();return db['MailQueue'][_0xe9b7('0x51')]({'where':{'id':_0x3c0469['params']['id']}})['then'](function(_0xc69eae){return db[_0xe9b7('0x6d')][_0xe9b7('0x6e')](function(_0xac9965){return _0xc69eae['removeTeams'](_0x3c0469[_0xe9b7('0x3e')]['ids'],{'transaction':_0xac9965})[_0xe9b7('0x2b')](function(){if(!_[_0xe9b7('0x88')](_0xc20252)){return _0xc69eae[_0xe9b7('0x89')](_0xc20252,{'transaction':_0xac9965});}})[_0xe9b7('0x2b')](function(){_0xc20252[_0xe9b7('0x8a')](function(_0x1bf0f4){socket[_0xe9b7('0x72')]('userMailQueue:remove',{'UserId':_0x1bf0f4,'MailQueueId':_0xc69eae['id']});});});});});});})[_0xe9b7('0x2b')](respondWithStatusCode(_0x87656d,null))['catch'](handleError(_0x87656d,null));};exports['addAgents']=function(_0x3198f7,_0x36981b,_0x308d58){return db[_0xe9b7('0x48')][_0xe9b7('0x51')]({'where':{'id':_0x3198f7[_0xe9b7('0x4d')]['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x36981b,null))[_0xe9b7('0x2b')](function(_0x260d40){if(_0x260d40){return _0x260d40['addAgents'](_0x3198f7[_0xe9b7('0x57')]['ids'],_[_0xe9b7('0x8b')](_0x3198f7[_0xe9b7('0x57')],[_0xe9b7('0x75'),'id'])||{})['spread'](function(_0x2ba3c7){for(var _0x7e21c3=0x0;_0x7e21c3<_0x3198f7[_0xe9b7('0x57')]['ids'][_0xe9b7('0x4e')];_0x7e21c3+=0x1){socket[_0xe9b7('0x72')]('userMailQueue:save',{'UserId':Number(_0x3198f7[_0xe9b7('0x57')]['ids'][_0x7e21c3]),'MailQueueId':Number(_0x3198f7[_0xe9b7('0x4d')]['id'])});}return _0x2ba3c7;});}})[_0xe9b7('0x2b')](respondWithResult(_0x36981b,null))['catch'](handleError(_0x36981b,null));};exports[_0xe9b7('0x89')]=function(_0x35a20,_0x25f6e2,_0x5a7278){return db['MailQueue']['find']({'where':{'id':_0x35a20['params']['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x25f6e2,null))[_0xe9b7('0x2b')](function(_0x5bc314){if(_0x5bc314){return _0x5bc314[_0xe9b7('0x89')](_0x35a20[_0xe9b7('0x3e')][_0xe9b7('0x75')])[_0xe9b7('0x2b')](function(){if(_[_0xe9b7('0x8c')](_0x35a20[_0xe9b7('0x3e')][_0xe9b7('0x75')])){for(var _0xf0f666=0x0;_0xf0f666<_0x35a20['query'][_0xe9b7('0x75')][_0xe9b7('0x4e')];_0xf0f666+=0x1){socket['emit'](_0xe9b7('0x8d'),{'UserId':Number(_0x35a20['query']['ids'][_0xf0f666]),'MailQueueId':Number(_0x35a20[_0xe9b7('0x4d')]['id'])});}}else{socket['emit'](_0xe9b7('0x8d'),{'UserId':Number(_0x35a20[_0xe9b7('0x3e')]['ids']),'MailQueueId':Number(_0x35a20['params']['id'])});}});}})[_0xe9b7('0x2b')](respondWithStatusCode(_0x25f6e2,null))['catch'](handleError(_0x25f6e2,null));};exports[_0xe9b7('0x8e')]=function(_0x233917,_0x3d66f5,_0x29e363){var _0x3aa14a={};var _0x21ba81={};var _0x3cf25c;var _0x491d61;return db[_0xe9b7('0x48')][_0xe9b7('0x5a')]({'where':{'id':_0x233917[_0xe9b7('0x4d')]['id']}})[_0xe9b7('0x2b')](handleEntityNotFound(_0x3d66f5,null))['then'](function(_0x51d3fb){if(_0x51d3fb){_0x3cf25c=_0x51d3fb;_0x21ba81[_0xe9b7('0x38')]=_[_0xe9b7('0x3a')](db[_0xe9b7('0x68')][_0xe9b7('0x34')]);_0x21ba81[_0xe9b7('0x3e')]=_[_0xe9b7('0x3a')](_0x233917[_0xe9b7('0x3e')]);_0x21ba81[_0xe9b7('0x43')]=_[_0xe9b7('0x3c')](_0x21ba81[_0xe9b7('0x38')],_0x21ba81[_0xe9b7('0x3e')]);_0x3aa14a[_0xe9b7('0x3b')]=_[_0xe9b7('0x3c')](_0x21ba81[_0xe9b7('0x38')],qs[_0xe9b7('0x3d')](_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x3d')]));_0x3aa14a[_0xe9b7('0x3b')]=_0x3aa14a['attributes']['length']?_0x3aa14a[_0xe9b7('0x3b')]:_0x21ba81[_0xe9b7('0x38')];_0x3aa14a['order']=qs[_0xe9b7('0x41')](_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x41')]);_0x3aa14a[_0xe9b7('0x45')]=qs['filters'](_[_0xe9b7('0x42')](_0x233917[_0xe9b7('0x3e')],_0x21ba81[_0xe9b7('0x43')]));if(_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x44')]){_0x3aa14a[_0xe9b7('0x45')]=_['merge'](_0x3aa14a[_0xe9b7('0x45')],{'$or':_[_0xe9b7('0x39')](_0x3aa14a[_0xe9b7('0x3b')],function(_0x5c267b){var _0x37b930={};_0x37b930[_0x5c267b]={'$like':'%'+_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x44')]+'%'};return _0x37b930;})});}_0x3aa14a=_[_0xe9b7('0x46')]({},_0x3aa14a,_0x233917['options']);return _0x3cf25c[_0xe9b7('0x8e')](_0x3aa14a);}})[_0xe9b7('0x2b')](function(_0x5448cc){if(_0x5448cc){_0x491d61=_0x5448cc[_0xe9b7('0x4e')];if(!_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x3f')]('nolimit')){_0x3aa14a[_0xe9b7('0x23')]=qs[_0xe9b7('0x23')](_0x233917['query'][_0xe9b7('0x23')]);_0x3aa14a[_0xe9b7('0x26')]=qs[_0xe9b7('0x26')](_0x233917[_0xe9b7('0x3e')][_0xe9b7('0x26')]);}return _0x3cf25c['getAgents'](_0x3aa14a);}})[_0xe9b7('0x2b')](function(_0x8b397b){if(_0x8b397b){return _0x8b397b?{'count':_0x491d61,'rows':_0x8b397b}:null;}})['then'](respondWithResult(_0x3d66f5,null))['catch'](handleError(_0x3d66f5,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index dc06397..09cde64 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 _0xb43a=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xb43a,0x15f));var _0xab43=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xb43a[_0x548627];return _0x844a84;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xab43('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xab43('0x1')](0x0);var events={'afterCreate':_0xab43('0x2'),'afterUpdate':_0xab43('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49239c){return function(_0x498be2,_0x20d525,_0x490af2){MailQueueEvents[_0xab43('0x4')](_0x49239c+':'+_0x498be2['id'],_0x498be2);MailQueueEvents['emit'](_0x49239c,_0x498be2);_0x490af2(null);};}for(var e in events){if(events[_0xab43('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xab43('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x97d3=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x3219d7,_0x29473b){var _0x5ff369=function(_0x45b694){while(--_0x45b694){_0x3219d7['push'](_0x3219d7['shift']());}};_0x5ff369(++_0x29473b);}(_0x97d3,0x161));var _0x397d=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x97d3[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x397d('0x0'));var MailQueue=require(_0x397d('0x1'))['db'][_0x397d('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x397d('0x3')](0x0);var events={'afterCreate':_0x397d('0x4'),'afterUpdate':'update','afterDestroy':_0x397d('0x5')};function emitEvent(_0x107d6d){return function(_0x276977,_0x743b09,_0x1d2e6b){MailQueueEvents['emit'](_0x107d6d+':'+_0x276977['id'],_0x276977);MailQueueEvents['emit'](_0x107d6d,_0x276977);_0x1d2e6b(null);};}for(var e in events){if(events[_0x397d('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x397d('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index fa8961a..56fdf9c 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 _0xccfe=['path','rimraf','./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2c43bb,_0x1138d7){var _0x2a0fd3=function(_0x5a4c56){while(--_0x5a4c56){_0x2c43bb['push'](_0x2c43bb['shift']());}};_0x2a0fd3(++_0x1138d7);}(_0xccfe,0x186));var _0xeccf=function(_0x2c0889,_0x397d7e){_0x2c0889=_0x2c0889-0x0;var _0x55eee2=_0xccfe[_0x2c0889];return _0x55eee2;};'use strict';var _=require(_0xeccf('0x0'));var util=require(_0xeccf('0x1'));var logger=require(_0xeccf('0x2'))(_0xeccf('0x3'));var moment=require(_0xeccf('0x4'));var BPromise=require(_0xeccf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeccf('0x6'));var rimraf=require(_0xeccf('0x7'));var config=require('../../config/environment');var attributes=require(_0xeccf('0x8'));module[_0xeccf('0x9')]=function(_0x2db794,_0xb0df78){return _0x2db794[_0xeccf('0xa')]('MailQueue',attributes,{'tableName':_0xeccf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x399a=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x399a,0xd0));var _0xa399=function(_0x12e075,_0x2f6b9c){_0x12e075=_0x12e075-0x0;var _0xacd6dd=_0x399a[_0x12e075];return _0xacd6dd;};'use strict';var _=require(_0xa399('0x0'));var util=require(_0xa399('0x1'));var logger=require('../../config/logger')(_0xa399('0x2'));var moment=require(_0xa399('0x3'));var BPromise=require(_0xa399('0x4'));var rp=require(_0xa399('0x5'));var fs=require('fs');var path=require(_0xa399('0x6'));var rimraf=require(_0xa399('0x7'));var config=require('../../config/environment');var attributes=require(_0xa399('0x8'));module[_0xa399('0x9')]=function(_0x21b81f,_0x3ba45f){return _0x21b81f[_0xa399('0xa')](_0xa399('0xb'),attributes,{'tableName':_0xa399('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 299a9b4..769e94e 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 _0x6a2b=['socket.io-emitter','./mailQueue.socket','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','find','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x5d7439,_0x29e8e5){var _0x8b3624=function(_0x311c52){while(--_0x311c52){_0x5d7439['push'](_0x5d7439['shift']());}};_0x8b3624(++_0x29e8e5);}(_0x6a2b,0x1e2));var _0xb6a2=function(_0x3c7999,_0x36868d){_0x3c7999=_0x3c7999-0x0;var _0x4723b4=_0x6a2b[_0x3c7999];return _0x4723b4;};'use strict';var _=require('lodash');var util=require(_0xb6a2('0x0'));var moment=require(_0xb6a2('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6a2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a2('0x3'))['db'];var utils=require(_0xb6a2('0x4'));var logger=require(_0xb6a2('0x5'))(_0xb6a2('0x6'));var config=require('../../config/environment');var jayson=require(_0xb6a2('0x7'));var client=jayson[_0xb6a2('0x8')][_0xb6a2('0x9')]({'port':0x232a});config[_0xb6a2('0xa')]=_['defaults'](config[_0xb6a2('0xa')],{'host':_0xb6a2('0xb'),'port':0x18eb});var socket=require(_0xb6a2('0xc'))(new Redis(config[_0xb6a2('0xa')]));require(_0xb6a2('0xd'))['register'](socket);function respondWithRpcPromise(_0x3008e7,_0x281af3,_0x2b8cb7){return new BPromise(function(_0x188479,_0x4751d1){return client['request'](_0x3008e7,_0x2b8cb7)['then'](function(_0x4b430c){logger[_0xb6a2('0xe')](_0xb6a2('0xf'),_0x281af3,_0xb6a2('0x10'));logger['debug'](_0xb6a2('0x11'),_0x281af3,'request\x20sent',JSON[_0xb6a2('0x12')](_0x4b430c));if(_0x4b430c[_0xb6a2('0x13')]){if(_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x14')]===0x1f4){logger[_0xb6a2('0x13')]('MailQueue,\x20%s,\x20%s',_0x281af3,_0x4b430c['error'][_0xb6a2('0x15')]);return _0x4751d1(_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x15')]);}logger[_0xb6a2('0x13')]('MailQueue,\x20%s,\x20%s',_0x281af3,_0x4b430c[_0xb6a2('0x13')][_0xb6a2('0x15')]);return _0x188479(_0x4b430c[_0xb6a2('0x13')]['message']);}else{logger[_0xb6a2('0xe')](_0xb6a2('0xf'),_0x281af3,'request\x20sent');_0x188479(_0x4b430c['result']['message']);}})[_0xb6a2('0x16')](function(_0x4ad5c7){logger[_0xb6a2('0x13')](_0xb6a2('0xf'),_0x281af3,_0x4ad5c7);_0x4751d1(_0x4ad5c7);});});}exports['GetMailQueue']=function(_0x2f684a){var _0x29bc34=this;return new Promise(function(_0x4e523c,_0x495316){return db[_0xb6a2('0x17')][_0xb6a2('0x18')]({'raw':_0x2f684a[_0xb6a2('0x19')]?_0x2f684a['options'][_0xb6a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f684a[_0xb6a2('0x19')]?_0x2f684a[_0xb6a2('0x19')][_0xb6a2('0x1b')]||null:null,'attributes':_0x2f684a[_0xb6a2('0x19')]?_0x2f684a[_0xb6a2('0x19')][_0xb6a2('0x1c')]||null:null,'limit':_0x2f684a[_0xb6a2('0x19')]?_0x2f684a[_0xb6a2('0x19')][_0xb6a2('0x1d')]||null:null,'include':_0x2f684a['options']?_0x2f684a[_0xb6a2('0x19')][_0xb6a2('0x1e')]?_[_0xb6a2('0x1f')](_0x2f684a[_0xb6a2('0x19')][_0xb6a2('0x1e')],function(_0x5fa4dc){return{'model':db[_0x5fa4dc['model']],'as':_0x5fa4dc['as'],'attributes':_0x5fa4dc[_0xb6a2('0x1c')],'include':_0x5fa4dc[_0xb6a2('0x1e')]?_[_0xb6a2('0x1f')](_0x5fa4dc['include'],function(_0x2e6844){return{'model':db[_0x2e6844['model']],'as':_0x2e6844['as'],'attributes':_0x2e6844['attributes'],'include':_0x2e6844[_0xb6a2('0x1e')]?_[_0xb6a2('0x1f')](_0x2e6844['include'],function(_0x4dd5f5){return{'model':db[_0x4dd5f5[_0xb6a2('0x20')]],'as':_0x4dd5f5['as'],'attributes':_0x4dd5f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6a2('0x21')](function(_0x17b97a){logger[_0xb6a2('0xe')](_0xb6a2('0x22'),_0x2f684a);logger['debug'](_0xb6a2('0x22'),_0x2f684a,JSON[_0xb6a2('0x12')](_0x17b97a));_0x4e523c(_0x17b97a);})[_0xb6a2('0x16')](function(_0xf56f60){logger['error'](_0xb6a2('0x22'),_0xf56f60[_0xb6a2('0x15')],_0x2f684a);_0x495316(_0x29bc34['error'](0x1f4,_0xf56f60[_0xb6a2('0x15')]));});});};exports[_0xb6a2('0x23')]=function(_0xbabfca){var _0x1c47e4=this;return new Promise(function(_0x1f4ff9,_0x41570d){return db[_0xb6a2('0x17')][_0xb6a2('0x24')]({'raw':_0xbabfca[_0xb6a2('0x19')]?_0xbabfca[_0xb6a2('0x19')][_0xb6a2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbabfca['options']?_0xbabfca[_0xb6a2('0x19')][_0xb6a2('0x1b')]||null:null,'attributes':_0xbabfca['options']?_0xbabfca[_0xb6a2('0x19')]['attributes']||null:null,'include':_0xbabfca[_0xb6a2('0x19')]?_0xbabfca['options']['include']?_[_0xb6a2('0x1f')](_0xbabfca[_0xb6a2('0x19')][_0xb6a2('0x1e')],function(_0x3197d7){return{'model':db[_0x3197d7[_0xb6a2('0x20')]],'as':_0x3197d7['as'],'attributes':_0x3197d7[_0xb6a2('0x1c')],'include':_0x3197d7['include']?_[_0xb6a2('0x1f')](_0x3197d7[_0xb6a2('0x1e')],function(_0x2e09ec){return{'model':db[_0x2e09ec[_0xb6a2('0x20')]],'as':_0x2e09ec['as'],'attributes':_0x2e09ec[_0xb6a2('0x1c')],'include':_0x2e09ec['include']?_[_0xb6a2('0x1f')](_0x2e09ec[_0xb6a2('0x1e')],function(_0x171937){return{'model':db[_0x171937['model']],'as':_0x171937['as'],'attributes':_0x171937[_0xb6a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb6a2('0x21')](function(_0xf7143b){logger['info'](_0xb6a2('0x23'),_0xbabfca);logger[_0xb6a2('0x25')](_0xb6a2('0x23'),_0xbabfca,JSON[_0xb6a2('0x12')](_0xf7143b));_0x1f4ff9(_0xf7143b);})[_0xb6a2('0x16')](function(_0x3da607){logger[_0xb6a2('0x13')](_0xb6a2('0x23'),_0x3da607['message'],_0xbabfca);_0x41570d(_0x1c47e4[_0xb6a2('0x13')](0x1f4,_0x3da607[_0xb6a2('0x15')]));});});}; \ No newline at end of file +var _0xd52d=['stringify','ShowMailQueue','find','raw','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue'];(function(_0x4068a3,_0x1c2cd3){var _0xcdea1=function(_0x1eabe1){while(--_0x1eabe1){_0x4068a3['push'](_0x4068a3['shift']());}};_0xcdea1(++_0x1c2cd3);}(_0xd52d,0x1c7));var _0xdd52=function(_0x253d49,_0x243917){_0x253d49=_0x253d49-0x0;var _0x328bde=_0xd52d[_0x253d49];return _0x328bde;};'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);});});}exports['GetMailQueue']=function(_0xb81a36){var _0x4d8a9c=this;return new Promise(function(_0x305cab,_0x56e1db){return db[_0xdd52('0x1b')][_0xdd52('0x1c')]({'raw':_0xb81a36['options']?_0xb81a36[_0xdd52('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xb81a36[_0xdd52('0x1d')]?_0xb81a36['options'][_0xdd52('0x1e')]||null:null,'attributes':_0xb81a36[_0xdd52('0x1d')]?_0xb81a36[_0xdd52('0x1d')][_0xdd52('0x1f')]||null:null,'limit':_0xb81a36[_0xdd52('0x1d')]?_0xb81a36[_0xdd52('0x1d')][_0xdd52('0x20')]||null:null,'include':_0xb81a36[_0xdd52('0x1d')]?_0xb81a36['options'][_0xdd52('0x21')]?_[_0xdd52('0x22')](_0xb81a36['options'][_0xdd52('0x21')],function(_0x353fde){return{'model':db[_0x353fde[_0xdd52('0x23')]],'as':_0x353fde['as'],'attributes':_0x353fde[_0xdd52('0x1f')],'include':_0x353fde['include']?_[_0xdd52('0x22')](_0x353fde[_0xdd52('0x21')],function(_0x70ed7b){return{'model':db[_0x70ed7b['model']],'as':_0x70ed7b['as'],'attributes':_0x70ed7b['attributes'],'include':_0x70ed7b[_0xdd52('0x21')]?_['map'](_0x70ed7b[_0xdd52('0x21')],function(_0x3f96bd){return{'model':db[_0x3f96bd[_0xdd52('0x23')]],'as':_0x3f96bd['as'],'attributes':_0x3f96bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0a2d){logger[_0xdd52('0x11')](_0xdd52('0x24'),_0xb81a36);logger['debug']('GetMailQueue',_0xb81a36,JSON[_0xdd52('0x25')](_0x2a0a2d));_0x305cab(_0x2a0a2d);})['catch'](function(_0x29c940){logger[_0xdd52('0x16')](_0xdd52('0x24'),_0x29c940[_0xdd52('0x18')],_0xb81a36);_0x56e1db(_0x4d8a9c[_0xdd52('0x16')](0x1f4,_0x29c940[_0xdd52('0x18')]));});});};exports[_0xdd52('0x26')]=function(_0x23c9bc){var _0x294f84=this;return new Promise(function(_0x470b1f,_0x20556c){return db[_0xdd52('0x1b')][_0xdd52('0x27')]({'raw':_0x23c9bc[_0xdd52('0x1d')]?_0x23c9bc[_0xdd52('0x1d')][_0xdd52('0x28')]===undefined?!![]:![]:!![],'where':_0x23c9bc[_0xdd52('0x1d')]?_0x23c9bc[_0xdd52('0x1d')][_0xdd52('0x1e')]||null:null,'attributes':_0x23c9bc[_0xdd52('0x1d')]?_0x23c9bc[_0xdd52('0x1d')]['attributes']||null:null,'include':_0x23c9bc[_0xdd52('0x1d')]?_0x23c9bc[_0xdd52('0x1d')]['include']?_['map'](_0x23c9bc['options'][_0xdd52('0x21')],function(_0x10d053){return{'model':db[_0x10d053[_0xdd52('0x23')]],'as':_0x10d053['as'],'attributes':_0x10d053[_0xdd52('0x1f')],'include':_0x10d053[_0xdd52('0x21')]?_[_0xdd52('0x22')](_0x10d053[_0xdd52('0x21')],function(_0x1638ee){return{'model':db[_0x1638ee[_0xdd52('0x23')]],'as':_0x1638ee['as'],'attributes':_0x1638ee[_0xdd52('0x1f')],'include':_0x1638ee['include']?_[_0xdd52('0x22')](_0x1638ee[_0xdd52('0x21')],function(_0x19ab35){return{'model':db[_0x19ab35[_0xdd52('0x23')]],'as':_0x19ab35['as'],'attributes':_0x19ab35[_0xdd52('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdd52('0x10')](function(_0x26da1d){logger[_0xdd52('0x11')](_0xdd52('0x26'),_0x23c9bc);logger[_0xdd52('0x14')](_0xdd52('0x26'),_0x23c9bc,JSON[_0xdd52('0x25')](_0x26da1d));_0x470b1f(_0x26da1d);})[_0xdd52('0x1a')](function(_0x334a7e){logger[_0xdd52('0x16')](_0xdd52('0x26'),_0x334a7e[_0xdd52('0x18')],_0x23c9bc);_0x20556c(_0x294f84[_0xdd52('0x16')](0x1f4,_0x334a7e[_0xdd52('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 75ad1ae..c01c70f 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 _0xb887=['./mailQueue.events','update','removeListener','length','mailQueue:'];(function(_0x32214a,_0x24fb09){var _0x1ce1a5=function(_0x58a5ea){while(--_0x58a5ea){_0x32214a['push'](_0x32214a['shift']());}};_0x1ce1a5(++_0x24fb09);}(_0xb887,0xaf));var _0x7b88=function(_0x39eb44,_0x2d6aa7){_0x39eb44=_0x39eb44-0x0;var _0x51d782=_0xb887[_0x39eb44];return _0x51d782;};'use strict';var MailQueueEvents=require(_0x7b88('0x0'));var events=['save','remove',_0x7b88('0x1')];function createListener(_0x24cd4d,_0x4cfaa6){return function(_0x5e7582){_0x4cfaa6['emit'](_0x24cd4d,_0x5e7582);};}function removeListener(_0x436d9b,_0x1f3a1c){return function(){MailQueueEvents[_0x7b88('0x2')](_0x436d9b,_0x1f3a1c);};}exports['register']=function(_0x2e8267){for(var _0x234357=0x0,_0x57f8a6=events[_0x7b88('0x3')];_0x234357<_0x57f8a6;_0x234357++){var _0x4b356f=events[_0x234357];var _0x2f4ca0=createListener(_0x7b88('0x4')+_0x4b356f,_0x2e8267);MailQueueEvents['on'](_0x4b356f,_0x2f4ca0);}}; \ No newline at end of file +var _0x09e4=['./mailQueue.events','save','remove','update','emit','length','mailQueue:'];(function(_0x5534b7,_0xbe6ba4){var _0x34af05=function(_0x2f8d94){while(--_0x2f8d94){_0x5534b7['push'](_0x5534b7['shift']());}};_0x34af05(++_0xbe6ba4);}(_0x09e4,0x1ce));var _0x409e=function(_0x495235,_0x3bc3dc){_0x495235=_0x495235-0x0;var _0x51cb41=_0x09e4[_0x495235];return _0x51cb41;};'use strict';var MailQueueEvents=require(_0x409e('0x0'));var events=[_0x409e('0x1'),_0x409e('0x2'),_0x409e('0x3')];function createListener(_0x1a9124,_0x134ffa){return function(_0x3eb08e){_0x134ffa[_0x409e('0x4')](_0x1a9124,_0x3eb08e);};}function removeListener(_0x5be558,_0x15d98d){return function(){MailQueueEvents['removeListener'](_0x5be558,_0x15d98d);};}exports['register']=function(_0x3f9689){for(var _0xcc494d=0x0,_0xcb9d17=events[_0x409e('0x5')];_0xcc494d<_0xcb9d17;_0xcc494d++){var _0x5d718e=events[_0xcc494d];var _0x21255d=createListener(_0x409e('0x6')+_0x5d718e,_0x3f9689);MailQueueEvents['on'](_0x5d718e,_0x21255d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5eef878..3586ebe 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 _0x2217=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x5aafa6,_0x4981f3){var _0x4a8198=function(_0x27ede9){while(--_0x27ede9){_0x5aafa6['push'](_0x5aafa6['shift']());}};_0x4a8198(++_0x4981f3);}(_0x2217,0xc0));var _0x7221=function(_0x513d6c,_0x678bb1){_0x513d6c=_0x513d6c-0x0;var _0x2dde47=_0x2217[_0x513d6c];return _0x2dde47;};'use strict';var multer=require(_0x7221('0x0'));var util=require(_0x7221('0x1'));var path=require(_0x7221('0x2'));var timeout=require(_0x7221('0x3'));var express=require(_0x7221('0x4'));var router=express['Router']();var fs_extra=require(_0x7221('0x5'));var auth=require(_0x7221('0x6'));var interaction=require(_0x7221('0x7'));var config=require(_0x7221('0x8'));var controller=require('./mailQueueReport.controller');router[_0x7221('0x9')]('/',auth['isAuthenticated'](),controller[_0x7221('0xa')]);router[_0x7221('0x9')](_0x7221('0xb'),auth[_0x7221('0xc')](),controller[_0x7221('0xd')]);router[_0x7221('0x9')](_0x7221('0xe'),auth[_0x7221('0xc')](),controller[_0x7221('0xf')]);router['post']('/',auth[_0x7221('0xc')](),controller[_0x7221('0x10')]);router[_0x7221('0x11')](_0x7221('0xe'),auth[_0x7221('0xc')](),controller['update']);router[_0x7221('0x12')](_0x7221('0xe'),auth[_0x7221('0xc')](),controller[_0x7221('0x13')]);module[_0x7221('0x14')]=router; \ No newline at end of file +var _0xa7cb=['/describe','describe','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xa7cb,0x129));var _0xba7c=function(_0x3bd1fd,_0x1472ce){_0x3bd1fd=_0x3bd1fd-0x0;var _0x28ea80=_0xa7cb[_0x3bd1fd];return _0x28ea80;};'use strict';var multer=require('multer');var util=require(_0xba7c('0x0'));var path=require(_0xba7c('0x1'));var timeout=require(_0xba7c('0x2'));var express=require(_0xba7c('0x3'));var router=express[_0xba7c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba7c('0x5'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xba7c('0x6')](),controller[_0xba7c('0x7')]);router[_0xba7c('0x8')](_0xba7c('0x9'),auth[_0xba7c('0x6')](),controller[_0xba7c('0xa')]);router['get']('/:id',auth[_0xba7c('0x6')](),controller['show']);router['post']('/',auth[_0xba7c('0x6')](),controller[_0xba7c('0xb')]);router[_0xba7c('0xc')](_0xba7c('0xd'),auth['isAuthenticated'](),controller[_0xba7c('0xe')]);router[_0xba7c('0xf')](_0xba7c('0xd'),auth[_0xba7c('0x6')](),controller[_0xba7c('0x10')]);module[_0xba7c('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9c3b940..5360a74 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 _0x4fb3=['DATE','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4fb3,0xbd));var _0x34fb=function(_0x417071,_0x5cc28c){_0x417071=_0x417071-0x0;var _0x5d0318=_0x4fb3[_0x417071];return _0x5d0318;};'use strict';var moment=require('moment');var Sequelize=require(_0x34fb('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x34fb('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd5b2=['STRING','DATE','moment','sequelize','exports'];(function(_0x199e45,_0x2735d2){var _0x5d3e81=function(_0x480b9f){while(--_0x480b9f){_0x199e45['push'](_0x199e45['shift']());}};_0x5d3e81(++_0x2735d2);}(_0xd5b2,0x1f1));var _0x2d5b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd5b2[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x2d5b('0x0'));var Sequelize=require(_0x2d5b('0x1'));module[_0x2d5b('0x2')]={'uniqueid':{'type':Sequelize[_0x2d5b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2d5b('0x3')]},'joinAt':{'type':Sequelize[_0x2d5b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2d5b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 3be0e02..5b1e686 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 _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x159f91,_0xe8a30f){var _0x26bd65=function(_0x5680d1){while(--_0x5680d1){_0x159f91['push'](_0x159f91['shift']());}};_0x26bd65(++_0xe8a30f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['MailQueueReport'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['MailQueueReport'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':!![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 93626e6..17cc387 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 _0xfbd1=['uniqueid','../../config/logger','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xfbd1,0x1c3));var _0x1fbd=function(_0x4ab32c,_0x44ab5e){_0x4ab32c=_0x4ab32c-0x0;var _0x2b9644=_0xfbd1[_0x4ab32c];return _0x2b9644;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1fbd('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1fbd('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1fbd('0x2'));var config=require(_0x1fbd('0x3'));var attributes=require(_0x1fbd('0x4'));module[_0x1fbd('0x5')]=function(_0x5eaf55,_0x35d062){return _0x5eaf55[_0x1fbd('0x6')](_0x1fbd('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x1fbd('0x8'),'fields':[_0x1fbd('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6877=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','report_mail_queue','uniqueid','lodash'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x6877,0xa4));var _0x7687=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x6877[_0x2f62aa];return _0x1a341f;};'use strict';var _=require(_0x7687('0x0'));var util=require(_0x7687('0x1'));var logger=require(_0x7687('0x2'))('api');var moment=require(_0x7687('0x3'));var BPromise=require('bluebird');var rp=require(_0x7687('0x4'));var fs=require('fs');var path=require(_0x7687('0x5'));var rimraf=require(_0x7687('0x6'));var config=require(_0x7687('0x7'));var attributes=require(_0x7687('0x8'));module['exports']=function(_0x3db535,_0x234f7b){return _0x3db535['define']('MailQueueReport',attributes,{'tableName':_0x7687('0x9'),'paranoid':![],'indexes':[{'name':_0x7687('0xa'),'fields':[_0x7687('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0b59428..11aa4f6 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(_0xbc0a41,_0x347e6e){var _0x58b569=function(_0x1a0995){while(--_0x1a0995){_0xbc0a41['push'](_0xbc0a41['shift']());}};_0x58b569(++_0x347e6e);}(_0x7a54,0x106));var _0x47a5=function(_0x2187c7,_0x42ff32){_0x2187c7=_0x2187c7-0x0;var _0x2a22e6=_0x7a54[_0x2187c7];return _0x2a22e6;};'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(_0x23ea54,_0x13a1d1){var _0x210684=function(_0x2be800){while(--_0x2be800){_0x23ea54['push'](_0x23ea54['shift']());}};_0x210684(++_0x13a1d1);}(_0x326f,0xd1));var _0xf326=function(_0x55a980,_0x5ea075){_0x55a980=_0x55a980-0x0;var _0x44b461=_0x326f[_0x55a980];return _0x44b461;};'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 66b03e2..42e2566 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5300b9,_0x2890ab){var _0x5db92e=function(_0x4a5054){while(--_0x4a5054){_0x5300b9['push'](_0x5300b9['shift']());}};_0x5db92e(++_0x2890ab);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x547122,_0x2ada8e){var _0xde25c4=function(_0x469c7c){while(--_0x469c7c){_0x547122['push'](_0x547122['shift']());}};_0xde25c4(++_0x2ada8e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xcb91[_0x43a1b8];return _0x324ecc;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 447650c..9660e31 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 _0x8ae2=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x42749b,_0x16a7ba){var _0x19db46=function(_0x43d724){while(--_0x43d724){_0x42749b['push'](_0x42749b['shift']());}};_0x19db46(++_0x16a7ba);}(_0x8ae2,0x121));var _0x28ae=function(_0x1594de,_0x5d33b5){_0x1594de=_0x1594de-0x0;var _0x5af371=_0x8ae2[_0x1594de];return _0x5af371;};'use strict';var Sequelize=require(_0x28ae('0x0'));module[_0x28ae('0x1')]={'description':{'type':Sequelize[_0x28ae('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x28ae('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x28ae('0x2')]},'port':{'type':Sequelize[_0x28ae('0x4')]},'tls':{'type':Sequelize[_0x28ae('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x28ae('0x2')],'defaultValue':_0x28ae('0x5')},'connTimeout':{'type':Sequelize[_0x28ae('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x28ae('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x28ae('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0140=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x1c334b,_0x2c4f22){var _0x42502f=function(_0x4bf318){while(--_0x4bf318){_0x1c334b['push'](_0x1c334b['shift']());}};_0x42502f(++_0x2c4f22);}(_0x0140,0x1d5));var _0x0014=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x0140[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0x0014('0x0'));module[_0x0014('0x1')]={'description':{'type':Sequelize[_0x0014('0x2')]},'host':{'type':Sequelize[_0x0014('0x2')]},'authentication':{'type':Sequelize[_0x0014('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0014('0x2')]},'password':{'type':Sequelize[_0x0014('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x0014('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0014('0x2')],'defaultValue':_0x0014('0x4')},'connTimeout':{'type':Sequelize[_0x0014('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0014('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f1f7d50..f16cc96 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 _0x859a=['bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x859a,0xcd));var _0xa859=function(_0x586634,_0x4fa98e){_0x586634=_0x586634-0x0;var _0x65eca5=_0x859a[_0x586634];return _0x65eca5;};'use strict';var _=require(_0xa859('0x0'));var util=require(_0xa859('0x1'));var logger=require(_0xa859('0x2'))(_0xa859('0x3'));var moment=require(_0xa859('0x4'));var BPromise=require(_0xa859('0x5'));var rp=require(_0xa859('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa859('0x7'));var config=require(_0xa859('0x8'));var attributes=require(_0xa859('0x9'));module[_0xa859('0xa')]=function(_0x1d717a,_0x37d1d2){return _0x1d717a[_0xa859('0xb')](_0xa859('0xc'),attributes,{'tableName':_0xa859('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d31=['MailServerIn','mail_servers_in','lodash','util','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x3d31,0x86));var _0x13d3=function(_0x53076e,_0x464002){_0x53076e=_0x53076e-0x0;var _0x256afe=_0x3d31[_0x53076e];return _0x256afe;};'use strict';var _=require(_0x13d3('0x0'));var util=require(_0x13d3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x13d3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13d3('0x3'));var rimraf=require(_0x13d3('0x4'));var config=require(_0x13d3('0x5'));var attributes=require(_0x13d3('0x6'));module[_0x13d3('0x7')]=function(_0x56cf23,_0x5b4666){return _0x56cf23[_0x13d3('0x8')](_0x13d3('0x9'),attributes,{'tableName':_0x13d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 7a8efc0..bdd2917 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 _0xe3bd=['rpc','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','where','limit','include','map','model','attributes','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5d64f3,_0x9f069c){var _0x26ca1d=function(_0x5e1b6c){while(--_0x5e1b6c){_0x5d64f3['push'](_0x5d64f3['shift']());}};_0x26ca1d(++_0x9f069c);}(_0xe3bd,0x126));var _0xde3b=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xe3bd[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0xde3b('0x0'));var moment=require(_0xde3b('0x1'));var BPromise=require(_0xde3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde3b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde3b('0x4'));var logger=require(_0xde3b('0x5'))(_0xde3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xde3b('0x7'));var client=jayson['client'][_0xde3b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47ad7f,_0x19a343,_0x29cdcc){return new BPromise(function(_0x202089,_0x2e0337){return client[_0xde3b('0x9')](_0x47ad7f,_0x29cdcc)[_0xde3b('0xa')](function(_0x5ab20e){logger[_0xde3b('0xb')](_0xde3b('0xc'),_0x19a343,_0xde3b('0xd'));logger[_0xde3b('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x19a343,_0xde3b('0xd'),JSON[_0xde3b('0xf')](_0x5ab20e));if(_0x5ab20e[_0xde3b('0x10')]){if(_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x11')]===0x1f4){logger['error'](_0xde3b('0xc'),_0x19a343,_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);return _0x2e0337(_0x5ab20e['error']['message']);}logger[_0xde3b('0x10')](_0xde3b('0xc'),_0x19a343,_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);return _0x202089(_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);}else{logger[_0xde3b('0xb')](_0xde3b('0xc'),_0x19a343,_0xde3b('0xd'));_0x202089(_0x5ab20e['result']['message']);}})['catch'](function(_0x36defd){logger['error']('MailServerIn,\x20%s,\x20%s',_0x19a343,_0x36defd);_0x2e0337(_0x36defd);});});}exports[_0xde3b('0x13')]=function(_0x1b6244){var _0x18479a=this;return new Promise(function(_0x1d5f53,_0x314026){return db[_0xde3b('0x14')][_0xde3b('0x15')]({'raw':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6244[_0xde3b('0x16')]?_0x1b6244['options'][_0xde3b('0x17')]||null:null,'attributes':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')]['attributes']||null:null,'limit':_0x1b6244['options']?_0x1b6244[_0xde3b('0x16')][_0xde3b('0x18')]||null:null,'include':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')][_0xde3b('0x19')]?_[_0xde3b('0x1a')](_0x1b6244['options'][_0xde3b('0x19')],function(_0x2ba3b5){return{'model':db[_0x2ba3b5[_0xde3b('0x1b')]],'as':_0x2ba3b5['as'],'attributes':_0x2ba3b5[_0xde3b('0x1c')],'include':_0x2ba3b5[_0xde3b('0x19')]?_[_0xde3b('0x1a')](_0x2ba3b5[_0xde3b('0x19')],function(_0x1210be){return{'model':db[_0x1210be[_0xde3b('0x1b')]],'as':_0x1210be['as'],'attributes':_0x1210be[_0xde3b('0x1c')],'include':_0x1210be[_0xde3b('0x19')]?_['map'](_0x1210be[_0xde3b('0x19')],function(_0x50d34a){return{'model':db[_0x50d34a[_0xde3b('0x1b')]],'as':_0x50d34a['as'],'attributes':_0x50d34a[_0xde3b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde3b('0xa')](function(_0x49a19c){logger['info'](_0xde3b('0x13'),_0x1b6244);logger[_0xde3b('0xe')](_0xde3b('0x13'),_0x1b6244,JSON[_0xde3b('0xf')](_0x49a19c));_0x1d5f53(_0x49a19c);})[_0xde3b('0x1d')](function(_0x372711){logger[_0xde3b('0x10')](_0xde3b('0x13'),_0x372711['message'],_0x1b6244);_0x314026(_0x18479a[_0xde3b('0x10')](0x1f4,_0x372711[_0xde3b('0x12')]));});});}; \ No newline at end of file +var _0x3cd1=['MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','findAll','options','raw','attributes','limit','model','include','map','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug'];(function(_0x24b04d,_0x4429c7){var _0x450816=function(_0x430af6){while(--_0x430af6){_0x24b04d['push'](_0x24b04d['shift']());}};_0x450816(++_0x4429c7);}(_0x3cd1,0x112));var _0x13cd=function(_0x1ef224,_0x604ca1){_0x1ef224=_0x1ef224-0x0;var _0x426a03=_0x3cd1[_0x1ef224];return _0x426a03;};'use strict';var _=require('lodash');var util=require(_0x13cd('0x0'));var moment=require(_0x13cd('0x1'));var BPromise=require(_0x13cd('0x2'));var rs=require(_0x13cd('0x3'));var fs=require('fs');var Redis=require(_0x13cd('0x4'));var db=require(_0x13cd('0x5'))['db'];var utils=require(_0x13cd('0x6'));var logger=require(_0x13cd('0x7'))('rpc');var config=require(_0x13cd('0x8'));var jayson=require(_0x13cd('0x9'));var client=jayson[_0x13cd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55cac0,_0x461fe5,_0x427fb0){return new BPromise(function(_0x258008,_0x64751a){return client['request'](_0x55cac0,_0x427fb0)[_0x13cd('0xb')](function(_0x334e06){logger[_0x13cd('0xc')]('MailServerIn,\x20%s,\x20%s',_0x461fe5,'request\x20sent');logger[_0x13cd('0xd')](_0x13cd('0xe'),_0x461fe5,_0x13cd('0xf'),JSON[_0x13cd('0x10')](_0x334e06));if(_0x334e06[_0x13cd('0x11')]){if(_0x334e06[_0x13cd('0x11')][_0x13cd('0x12')]===0x1f4){logger['error'](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')]['message']);return _0x64751a(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);return _0x258008(_0x334e06[_0x13cd('0x11')][_0x13cd('0x14')]);}else{logger['info'](_0x13cd('0x13'),_0x461fe5,'request\x20sent');_0x258008(_0x334e06[_0x13cd('0x15')][_0x13cd('0x14')]);}})['catch'](function(_0x1bd779){logger[_0x13cd('0x11')](_0x13cd('0x13'),_0x461fe5,_0x1bd779);_0x64751a(_0x1bd779);});});}exports[_0x13cd('0x16')]=function(_0x1442eb){var _0x50557f=this;return new Promise(function(_0x45b9de,_0x446a31){return db['MailServerIn'][_0x13cd('0x17')]({'raw':_0x1442eb['options']?_0x1442eb[_0x13cd('0x18')][_0x13cd('0x19')]===undefined?!![]:![]:!![],'where':_0x1442eb[_0x13cd('0x18')]?_0x1442eb[_0x13cd('0x18')]['where']||null:null,'attributes':_0x1442eb[_0x13cd('0x18')]?_0x1442eb['options'][_0x13cd('0x1a')]||null:null,'limit':_0x1442eb[_0x13cd('0x18')]?_0x1442eb[_0x13cd('0x18')][_0x13cd('0x1b')]||null:null,'include':_0x1442eb[_0x13cd('0x18')]?_0x1442eb[_0x13cd('0x18')]['include']?_['map'](_0x1442eb[_0x13cd('0x18')]['include'],function(_0x5144cc){return{'model':db[_0x5144cc[_0x13cd('0x1c')]],'as':_0x5144cc['as'],'attributes':_0x5144cc[_0x13cd('0x1a')],'include':_0x5144cc[_0x13cd('0x1d')]?_['map'](_0x5144cc[_0x13cd('0x1d')],function(_0x11124f){return{'model':db[_0x11124f[_0x13cd('0x1c')]],'as':_0x11124f['as'],'attributes':_0x11124f[_0x13cd('0x1a')],'include':_0x11124f[_0x13cd('0x1d')]?_[_0x13cd('0x1e')](_0x11124f[_0x13cd('0x1d')],function(_0x23019d){return{'model':db[_0x23019d['model']],'as':_0x23019d['as'],'attributes':_0x23019d[_0x13cd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4462f6){logger[_0x13cd('0xc')]('GetMailServerIn',_0x1442eb);logger[_0x13cd('0xd')](_0x13cd('0x16'),_0x1442eb,JSON[_0x13cd('0x10')](_0x4462f6));_0x45b9de(_0x4462f6);})[_0x13cd('0x1f')](function(_0x3fd1f6){logger[_0x13cd('0x11')](_0x13cd('0x16'),_0x3fd1f6['message'],_0x1442eb);_0x446a31(_0x50557f[_0x13cd('0x11')](0x1f4,_0x3fd1f6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index da7363e..f3ad968 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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x2d4998,_0x3b1552){_0x2d4998=_0x2d4998-0x0;var _0x3e77a7=_0x7a54[_0x2d4998];return _0x3e77a7;};'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(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7a54,0x106));var _0x47a5=function(_0x42d2bb,_0x757fc6){_0x42d2bb=_0x42d2bb-0x0;var _0x12b8d9=_0x7a54[_0x42d2bb];return _0x12b8d9;};'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 d183c32..e3a5169 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 _0xe706=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x1831a8,_0x9adbf){var _0x57c792=function(_0x12420d){while(--_0x12420d){_0x1831a8['push'](_0x1831a8['shift']());}};_0x57c792(++_0x9adbf);}(_0xe706,0xa3));var _0x6e70=function(_0x4f229e,_0x1b1e6c){_0x4f229e=_0x4f229e-0x0;var _0x407c5e=_0xe706[_0x4f229e];return _0x407c5e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'description':{'type':Sequelize[_0x6e70('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6e70('0x2')]},'pass':{'type':Sequelize[_0x6e70('0x2')]},'port':{'type':Sequelize[_0x6e70('0x3')]},'secure':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6e70('0x2')]},'authentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3423=['INTEGER','BOOLEAN','STRING'];(function(_0x25ead1,_0x53c173){var _0x4d899d=function(_0x17df59){while(--_0x17df59){_0x25ead1['push'](_0x25ead1['shift']());}};_0x4d899d(++_0x53c173);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3342('0x0')]},'host':{'type':Sequelize[_0x3342('0x0')]},'user':{'type':Sequelize[_0x3342('0x0')]},'pass':{'type':Sequelize[_0x3342('0x0')]},'port':{'type':Sequelize[_0x3342('0x1')]},'secure':{'type':Sequelize[_0x3342('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3342('0x0')]},'authentication':{'type':Sequelize[_0x3342('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3342('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8d14ad5..a516c78 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 _0xfbd6=['../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','MailServerOut','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xcb0171,_0x4d3679){var _0x19d60d=function(_0xb34434){while(--_0xb34434){_0xcb0171['push'](_0xcb0171['shift']());}};_0x19d60d(++_0x4d3679);}(_0xfbd6,0x19b));var _0x6fbd=function(_0x4a1238,_0x50bc2b){_0x4a1238=_0x4a1238-0x0;var _0x1b5080=_0xfbd6[_0x4a1238];return _0x1b5080;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fbd('0x0'));var zipdir=require(_0x6fbd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fbd('0x2'));var moment=require(_0x6fbd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6fbd('0x4'));var util=require('util');var path=require(_0x6fbd('0x5'));var sox=require(_0x6fbd('0x6'));var csv=require(_0x6fbd('0x7'));var ejs=require(_0x6fbd('0x8'));var fs=require('fs');var fs_extra=require(_0x6fbd('0x9'));var _=require(_0x6fbd('0xa'));var squel=require(_0x6fbd('0xb'));var crypto=require(_0x6fbd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6fbd('0xd'));var toCsv=require(_0x6fbd('0x7'));var querystring=require(_0x6fbd('0xe'));var Papa=require(_0x6fbd('0xf'));var Redis=require(_0x6fbd('0x10'));var authService=require(_0x6fbd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6fbd('0x12'));var hardwareService=require(_0x6fbd('0x13'));var logger=require(_0x6fbd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6fbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fbd('0x16'))['db'];function respondWithStatusCode(_0x216f11,_0x6725f7){_0x6725f7=_0x6725f7||0xcc;return function(_0x3ec144){if(_0x3ec144){return _0x216f11[_0x6fbd('0x17')](_0x6725f7);}return _0x216f11['status'](_0x6725f7)[_0x6fbd('0x18')]();};}function respondWithResult(_0x25297d,_0x585220){_0x585220=_0x585220||0xc8;return function(_0x502668){if(_0x502668){return _0x25297d['status'](_0x585220)['json'](_0x502668);}};}function respondWithFilteredResult(_0x4868e7,_0x153cb1){return function(_0x4aa87a){if(_0x4aa87a){var _0x4d16e4=typeof _0x153cb1[_0x6fbd('0x19')]===_0x6fbd('0x1a')&&typeof _0x153cb1[_0x6fbd('0x1b')]==='undefined';var _0x1cfa7a=_0x4aa87a[_0x6fbd('0x1c')];var _0xfa9016=_0x4d16e4?0x0:_0x153cb1[_0x6fbd('0x19')];var _0x5b2d71=_0x4d16e4?_0x4aa87a[_0x6fbd('0x1c')]:_0x153cb1['offset']+_0x153cb1[_0x6fbd('0x1b')];var _0x41d799;if(_0x5b2d71>=_0x1cfa7a){_0x5b2d71=_0x1cfa7a;_0x41d799=0xc8;}else{_0x41d799=0xce;}_0x4868e7[_0x6fbd('0x1d')](_0x41d799);return _0x4868e7['set'](_0x6fbd('0x1e'),_0xfa9016+'-'+_0x5b2d71+'/'+_0x1cfa7a)[_0x6fbd('0x1f')](_0x4aa87a);}return null;};}function patchUpdates(_0x1b82f9){return function(_0xe320af){try{jsonpatch[_0x6fbd('0x20')](_0xe320af,_0x1b82f9,!![]);}catch(_0x5d1ab9){return BPromise[_0x6fbd('0x21')](_0x5d1ab9);}return _0xe320af[_0x6fbd('0x22')]();};}function saveUpdates(_0x33d48c,_0x54bfa3){return function(_0x3202ef){if(_0x3202ef){return _0x3202ef[_0x6fbd('0x23')](_0x33d48c)[_0x6fbd('0x24')](function(_0x4dbf33){return _0x4dbf33;});}return null;};}function removeEntity(_0x50d7f5,_0x621856){return function(_0x1bd952){if(_0x1bd952){return _0x1bd952[_0x6fbd('0x25')]()['then'](function(){_0x50d7f5[_0x6fbd('0x1d')](0xcc)[_0x6fbd('0x18')]();});}};}function handleEntityNotFound(_0x4faa84,_0x47ad87){return function(_0x135ec6){if(!_0x135ec6){_0x4faa84[_0x6fbd('0x17')](0x194);}return _0x135ec6;};}function handleError(_0x38c681,_0x4168f9){_0x4168f9=_0x4168f9||0x1f4;return function(_0x437c3e){logger['error'](_0x437c3e[_0x6fbd('0x26')]);if(_0x437c3e[_0x6fbd('0x27')]){delete _0x437c3e['name'];}_0x38c681[_0x6fbd('0x1d')](_0x4168f9)[_0x6fbd('0x28')](_0x437c3e);};}exports[_0x6fbd('0x29')]=function(_0x304ef2,_0x243cc3){var _0x412ef6={},_0x409abf={},_0x1c8c26={'count':0x0,'rows':[]};var _0x55b942=_['map'](db[_0x6fbd('0x2a')]['rawAttributes'],function(_0x230562){return{'name':_0x230562[_0x6fbd('0x2b')],'type':_0x230562['type'][_0x6fbd('0x2c')]};});_0x409abf[_0x6fbd('0x2d')]=_[_0x6fbd('0x2e')](_0x55b942,_0x6fbd('0x27'));_0x409abf['query']=_['keys'](_0x304ef2[_0x6fbd('0x2f')]);_0x409abf[_0x6fbd('0x30')]=_[_0x6fbd('0x31')](_0x409abf[_0x6fbd('0x2d')],_0x409abf[_0x6fbd('0x2f')]);_0x412ef6[_0x6fbd('0x32')]=_[_0x6fbd('0x31')](_0x409abf[_0x6fbd('0x2d')],qs[_0x6fbd('0x33')](_0x304ef2['query'][_0x6fbd('0x33')]));_0x412ef6[_0x6fbd('0x32')]=_0x412ef6[_0x6fbd('0x32')][_0x6fbd('0x34')]?_0x412ef6[_0x6fbd('0x32')]:_0x409abf['model'];if(!_0x304ef2[_0x6fbd('0x2f')][_0x6fbd('0x35')]('nolimit')){_0x412ef6[_0x6fbd('0x1b')]=qs[_0x6fbd('0x1b')](_0x304ef2[_0x6fbd('0x2f')][_0x6fbd('0x1b')]);_0x412ef6[_0x6fbd('0x19')]=qs[_0x6fbd('0x19')](_0x304ef2['query'][_0x6fbd('0x19')]);}_0x412ef6[_0x6fbd('0x36')]=qs[_0x6fbd('0x37')](_0x304ef2[_0x6fbd('0x2f')][_0x6fbd('0x37')]);_0x412ef6[_0x6fbd('0x38')]=qs[_0x6fbd('0x30')](_[_0x6fbd('0x39')](_0x304ef2[_0x6fbd('0x2f')],_0x409abf[_0x6fbd('0x30')]),_0x55b942);if(_0x304ef2['query'][_0x6fbd('0x3a')]){_0x412ef6[_0x6fbd('0x38')]=_[_0x6fbd('0x3b')](_0x412ef6[_0x6fbd('0x38')],{'$or':_[_0x6fbd('0x2e')](_0x55b942,function(_0x4608e5){if(_0x4608e5[_0x6fbd('0x3c')]!=='VIRTUAL'){var _0x5c9af4={};_0x5c9af4[_0x4608e5[_0x6fbd('0x27')]]={'$like':'%'+_0x304ef2['query']['filter']+'%'};return _0x5c9af4;}})});}_0x412ef6=_[_0x6fbd('0x3b')]({},_0x412ef6,_0x304ef2[_0x6fbd('0x3d')]);var _0x4c5b43={'where':_0x412ef6[_0x6fbd('0x38')]};return db[_0x6fbd('0x2a')][_0x6fbd('0x1c')](_0x4c5b43)[_0x6fbd('0x24')](function(_0x473ec0){_0x1c8c26[_0x6fbd('0x1c')]=_0x473ec0;if(_0x304ef2['query'][_0x6fbd('0x3e')]){_0x412ef6[_0x6fbd('0x3f')]=[{'all':!![]}];}return db[_0x6fbd('0x2a')][_0x6fbd('0x40')](_0x412ef6);})[_0x6fbd('0x24')](function(_0x32bfb1){_0x1c8c26['rows']=_0x32bfb1;return _0x1c8c26;})['then'](respondWithFilteredResult(_0x243cc3,_0x412ef6))[_0x6fbd('0x41')](handleError(_0x243cc3,null));};exports[_0x6fbd('0x42')]=function(_0x253359,_0x4c713b){var _0x276995={'raw':!![],'where':{'id':_0x253359[_0x6fbd('0x43')]['id']}},_0x2dd7c4={};_0x2dd7c4[_0x6fbd('0x2d')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x2dd7c4[_0x6fbd('0x2f')]=_[_0x6fbd('0x44')](_0x253359[_0x6fbd('0x2f')]);_0x2dd7c4['filters']=_['intersection'](_0x2dd7c4['model'],_0x2dd7c4['query']);_0x276995[_0x6fbd('0x32')]=_[_0x6fbd('0x31')](_0x2dd7c4[_0x6fbd('0x2d')],qs[_0x6fbd('0x33')](_0x253359[_0x6fbd('0x2f')]['fields']));_0x276995[_0x6fbd('0x32')]=_0x276995[_0x6fbd('0x32')][_0x6fbd('0x34')]?_0x276995['attributes']:_0x2dd7c4[_0x6fbd('0x2d')];if(_0x253359[_0x6fbd('0x2f')][_0x6fbd('0x3e')]){_0x276995['include']=[{'all':!![]}];}_0x276995=_[_0x6fbd('0x3b')]({},_0x276995,_0x253359[_0x6fbd('0x3d')]);return db[_0x6fbd('0x2a')][_0x6fbd('0x45')](_0x276995)[_0x6fbd('0x24')](handleEntityNotFound(_0x4c713b,null))[_0x6fbd('0x24')](respondWithResult(_0x4c713b,null))[_0x6fbd('0x41')](handleError(_0x4c713b,null));};exports[_0x6fbd('0x46')]=function(_0x2802d6,_0x3eb669){return db[_0x6fbd('0x2a')][_0x6fbd('0x46')](_0x2802d6[_0x6fbd('0x47')],{})[_0x6fbd('0x24')](respondWithResult(_0x3eb669,0xc9))[_0x6fbd('0x41')](handleError(_0x3eb669,null));};exports[_0x6fbd('0x23')]=function(_0x1b8157,_0x412456){if(_0x1b8157[_0x6fbd('0x47')]['id']){delete _0x1b8157[_0x6fbd('0x47')]['id'];}return db[_0x6fbd('0x2a')][_0x6fbd('0x45')]({'where':{'id':_0x1b8157[_0x6fbd('0x43')]['id']}})[_0x6fbd('0x24')](handleEntityNotFound(_0x412456,null))[_0x6fbd('0x24')](saveUpdates(_0x1b8157[_0x6fbd('0x47')],null))[_0x6fbd('0x24')](respondWithResult(_0x412456,null))[_0x6fbd('0x41')](handleError(_0x412456,null));};exports[_0x6fbd('0x25')]=function(_0xe081fb,_0x350187){return db[_0x6fbd('0x2a')][_0x6fbd('0x45')]({'where':{'id':_0xe081fb[_0x6fbd('0x43')]['id']}})['then'](handleEntityNotFound(_0x350187,null))['then'](removeEntity(_0x350187,null))['catch'](handleError(_0x350187,null));}; \ No newline at end of file +var _0xb348=['query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','then','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key'];(function(_0x55b93c,_0x79f915){var _0x801985=function(_0x1cdbc0){while(--_0x1cdbc0){_0x55b93c['push'](_0x55b93c['shift']());}};_0x801985(++_0x79f915);}(_0xb348,0xf1));var _0x8b34=function(_0x484118,_0x549487){_0x484118=_0x484118-0x0;var _0x4a65a9=_0xb348[_0x484118];return _0x4a65a9;};'use strict';var emlformat=require(_0x8b34('0x0'));var rimraf=require(_0x8b34('0x1'));var zipdir=require(_0x8b34('0x2'));var jsonpatch=require(_0x8b34('0x3'));var rp=require(_0x8b34('0x4'));var moment=require(_0x8b34('0x5'));var BPromise=require(_0x8b34('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8b34('0x7'));var sox=require(_0x8b34('0x8'));var csv=require(_0x8b34('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b34('0xa'));var _=require('lodash');var squel=require(_0x8b34('0xb'));var crypto=require(_0x8b34('0xc'));var jsforce=require(_0x8b34('0xd'));var deskjs=require(_0x8b34('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b34('0xf'));var Papa=require(_0x8b34('0x10'));var Redis=require(_0x8b34('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8b34('0x12'));var as=require(_0x8b34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8b34('0x14'));var config=require(_0x8b34('0x15'));var licenseUtil=require(_0x8b34('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d6d27,_0xac2d31){_0xac2d31=_0xac2d31||0xcc;return function(_0x1de092){if(_0x1de092){return _0x2d6d27[_0x8b34('0x17')](_0xac2d31);}return _0x2d6d27[_0x8b34('0x18')](_0xac2d31)[_0x8b34('0x19')]();};}function respondWithResult(_0x5c26a2,_0x558535){_0x558535=_0x558535||0xc8;return function(_0x128600){if(_0x128600){return _0x5c26a2[_0x8b34('0x18')](_0x558535)[_0x8b34('0x1a')](_0x128600);}};}function respondWithFilteredResult(_0x5471d4,_0x426548){return function(_0x5552e8){if(_0x5552e8){var _0x55af15=typeof _0x426548['offset']===_0x8b34('0x1b')&&typeof _0x426548[_0x8b34('0x1c')]===_0x8b34('0x1b');var _0x359998=_0x5552e8[_0x8b34('0x1d')];var _0x378eb0=_0x55af15?0x0:_0x426548[_0x8b34('0x1e')];var _0x5c3e2c=_0x55af15?_0x5552e8[_0x8b34('0x1d')]:_0x426548[_0x8b34('0x1e')]+_0x426548[_0x8b34('0x1c')];var _0xeed88f;if(_0x5c3e2c>=_0x359998){_0x5c3e2c=_0x359998;_0xeed88f=0xc8;}else{_0xeed88f=0xce;}_0x5471d4[_0x8b34('0x18')](_0xeed88f);return _0x5471d4[_0x8b34('0x1f')](_0x8b34('0x20'),_0x378eb0+'-'+_0x5c3e2c+'/'+_0x359998)['json'](_0x5552e8);}return null;};}function patchUpdates(_0x1c8d67){return function(_0x342517){try{jsonpatch[_0x8b34('0x21')](_0x342517,_0x1c8d67,!![]);}catch(_0x703945){return BPromise[_0x8b34('0x22')](_0x703945);}return _0x342517['save']();};}function saveUpdates(_0x16cf17,_0x40741d){return function(_0x50165a){if(_0x50165a){return _0x50165a[_0x8b34('0x23')](_0x16cf17)['then'](function(_0x1a181c){return _0x1a181c;});}return null;};}function removeEntity(_0x44656f,_0x19d5f8){return function(_0x54679c){if(_0x54679c){return _0x54679c['destroy']()['then'](function(){_0x44656f[_0x8b34('0x18')](0xcc)[_0x8b34('0x19')]();});}};}function handleEntityNotFound(_0x26fbdd,_0x5b0c65){return function(_0x188925){if(!_0x188925){_0x26fbdd[_0x8b34('0x17')](0x194);}return _0x188925;};}function handleError(_0x356b7a,_0xcc401){_0xcc401=_0xcc401||0x1f4;return function(_0x194bcc){logger[_0x8b34('0x24')](_0x194bcc[_0x8b34('0x25')]);if(_0x194bcc[_0x8b34('0x26')]){delete _0x194bcc['name'];}_0x356b7a[_0x8b34('0x18')](_0xcc401)[_0x8b34('0x27')](_0x194bcc);};}exports[_0x8b34('0x28')]=function(_0x205d8c,_0x4969f5){var _0x3ce486={},_0x4cde8c={},_0x5e3505={'count':0x0,'rows':[]};var _0x3b1e44=_[_0x8b34('0x29')](db[_0x8b34('0x2a')][_0x8b34('0x2b')],function(_0x100846){return{'name':_0x100846[_0x8b34('0x2c')],'type':_0x100846[_0x8b34('0x2d')][_0x8b34('0x2e')]};});_0x4cde8c['model']=_[_0x8b34('0x29')](_0x3b1e44,_0x8b34('0x26'));_0x4cde8c[_0x8b34('0x2f')]=_[_0x8b34('0x30')](_0x205d8c[_0x8b34('0x2f')]);_0x4cde8c[_0x8b34('0x31')]=_['intersection'](_0x4cde8c['model'],_0x4cde8c['query']);_0x3ce486[_0x8b34('0x32')]=_[_0x8b34('0x33')](_0x4cde8c[_0x8b34('0x34')],qs[_0x8b34('0x35')](_0x205d8c[_0x8b34('0x2f')]['fields']));_0x3ce486[_0x8b34('0x32')]=_0x3ce486['attributes'][_0x8b34('0x36')]?_0x3ce486[_0x8b34('0x32')]:_0x4cde8c[_0x8b34('0x34')];if(!_0x205d8c['query'][_0x8b34('0x37')](_0x8b34('0x38'))){_0x3ce486[_0x8b34('0x1c')]=qs['limit'](_0x205d8c[_0x8b34('0x2f')][_0x8b34('0x1c')]);_0x3ce486[_0x8b34('0x1e')]=qs[_0x8b34('0x1e')](_0x205d8c[_0x8b34('0x2f')][_0x8b34('0x1e')]);}_0x3ce486['order']=qs[_0x8b34('0x39')](_0x205d8c['query'][_0x8b34('0x39')]);_0x3ce486[_0x8b34('0x3a')]=qs[_0x8b34('0x31')](_['pick'](_0x205d8c['query'],_0x4cde8c[_0x8b34('0x31')]),_0x3b1e44);if(_0x205d8c[_0x8b34('0x2f')][_0x8b34('0x3b')]){_0x3ce486[_0x8b34('0x3a')]=_[_0x8b34('0x3c')](_0x3ce486[_0x8b34('0x3a')],{'$or':_[_0x8b34('0x29')](_0x3b1e44,function(_0x1a51b9){if(_0x1a51b9[_0x8b34('0x2d')]!==_0x8b34('0x3d')){var _0x4e7117={};_0x4e7117[_0x1a51b9[_0x8b34('0x26')]]={'$like':'%'+_0x205d8c[_0x8b34('0x2f')]['filter']+'%'};return _0x4e7117;}})});}_0x3ce486=_[_0x8b34('0x3c')]({},_0x3ce486,_0x205d8c[_0x8b34('0x3e')]);var _0x31b420={'where':_0x3ce486[_0x8b34('0x3a')]};return db[_0x8b34('0x2a')][_0x8b34('0x1d')](_0x31b420)['then'](function(_0x44b402){_0x5e3505[_0x8b34('0x1d')]=_0x44b402;if(_0x205d8c[_0x8b34('0x2f')][_0x8b34('0x3f')]){_0x3ce486[_0x8b34('0x40')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x3ce486);})[_0x8b34('0x41')](function(_0x441180){_0x5e3505['rows']=_0x441180;return _0x5e3505;})[_0x8b34('0x41')](respondWithFilteredResult(_0x4969f5,_0x3ce486))['catch'](handleError(_0x4969f5,null));};exports['show']=function(_0x4fb748,_0x2629a3){var _0x7cbc14={'raw':!![],'where':{'id':_0x4fb748[_0x8b34('0x42')]['id']}},_0x2fd4ab={};_0x2fd4ab['model']=_[_0x8b34('0x30')](db[_0x8b34('0x2a')][_0x8b34('0x2b')]);_0x2fd4ab[_0x8b34('0x2f')]=_[_0x8b34('0x30')](_0x4fb748[_0x8b34('0x2f')]);_0x2fd4ab[_0x8b34('0x31')]=_[_0x8b34('0x33')](_0x2fd4ab[_0x8b34('0x34')],_0x2fd4ab[_0x8b34('0x2f')]);_0x7cbc14['attributes']=_['intersection'](_0x2fd4ab[_0x8b34('0x34')],qs[_0x8b34('0x35')](_0x4fb748['query'][_0x8b34('0x35')]));_0x7cbc14['attributes']=_0x7cbc14[_0x8b34('0x32')][_0x8b34('0x36')]?_0x7cbc14[_0x8b34('0x32')]:_0x2fd4ab[_0x8b34('0x34')];if(_0x4fb748[_0x8b34('0x2f')][_0x8b34('0x3f')]){_0x7cbc14[_0x8b34('0x40')]=[{'all':!![]}];}_0x7cbc14=_[_0x8b34('0x3c')]({},_0x7cbc14,_0x4fb748[_0x8b34('0x3e')]);return db['MailServerOut'][_0x8b34('0x43')](_0x7cbc14)[_0x8b34('0x41')](handleEntityNotFound(_0x2629a3,null))[_0x8b34('0x41')](respondWithResult(_0x2629a3,null))[_0x8b34('0x44')](handleError(_0x2629a3,null));};exports[_0x8b34('0x45')]=function(_0x4c8553,_0x516cf5){return db[_0x8b34('0x2a')][_0x8b34('0x45')](_0x4c8553['body'],{})[_0x8b34('0x41')](respondWithResult(_0x516cf5,0xc9))[_0x8b34('0x44')](handleError(_0x516cf5,null));};exports[_0x8b34('0x23')]=function(_0x3240a0,_0x441e1d){if(_0x3240a0['body']['id']){delete _0x3240a0['body']['id'];}return db[_0x8b34('0x2a')][_0x8b34('0x43')]({'where':{'id':_0x3240a0[_0x8b34('0x42')]['id']}})[_0x8b34('0x41')](handleEntityNotFound(_0x441e1d,null))[_0x8b34('0x41')](saveUpdates(_0x3240a0[_0x8b34('0x46')],null))[_0x8b34('0x41')](respondWithResult(_0x441e1d,null))['catch'](handleError(_0x441e1d,null));};exports[_0x8b34('0x47')]=function(_0x2de08b,_0x40f64a){return db[_0x8b34('0x2a')][_0x8b34('0x43')]({'where':{'id':_0x2de08b[_0x8b34('0x42')]['id']}})[_0x8b34('0x41')](handleEntityNotFound(_0x40f64a,null))[_0x8b34('0x41')](removeEntity(_0x40f64a,null))[_0x8b34('0x44')](handleError(_0x40f64a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e8119c5..761355a 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 _0xe64b=['exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe64b,0x1f1));var _0xbe64=function(_0x4a5111,_0x212e4c){_0x4a5111=_0x4a5111-0x0;var _0x36288a=_0xe64b[_0x4a5111];return _0x36288a;};'use strict';var _=require(_0xbe64('0x0'));var util=require(_0xbe64('0x1'));var logger=require(_0xbe64('0x2'))('api');var moment=require(_0xbe64('0x3'));var BPromise=require(_0xbe64('0x4'));var rp=require(_0xbe64('0x5'));var fs=require('fs');var path=require(_0xbe64('0x6'));var rimraf=require(_0xbe64('0x7'));var config=require(_0xbe64('0x8'));var attributes=require(_0xbe64('0x9'));module[_0xbe64('0xa')]=function(_0x4bb437,_0x5981e3){return _0x4bb437['define'](_0xbe64('0xb'),attributes,{'tableName':_0xbe64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcff=['MailServerOut','mail_servers_out','lodash','util','moment','request-promise','path','exports','define'];(function(_0x55ae2d,_0x2432bd){var _0x26c015=function(_0x1339f3){while(--_0x1339f3){_0x55ae2d['push'](_0x55ae2d['shift']());}};_0x26c015(++_0x2432bd);}(_0xbcff,0x110));var _0xfbcf=function(_0x25b5b0,_0xc3c161){_0x25b5b0=_0x25b5b0-0x0;var _0x20c743=_0xbcff[_0x25b5b0];return _0x20c743;};'use strict';var _=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfbcf('0x2'));var BPromise=require('bluebird');var rp=require(_0xfbcf('0x3'));var fs=require('fs');var path=require(_0xfbcf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0xfbcf('0x5')]=function(_0x4f58e2,_0x4667d2){return _0x4f58e2[_0xfbcf('0x6')](_0xfbcf('0x7'),attributes,{'tableName':_0xfbcf('0x8'),'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 4868445..28b4bd9 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x58e2d2,_0x4ff59b){var _0x249768=function(_0x1c9e31){while(--_0x1c9e31){_0x58e2d2['push'](_0x58e2d2['shift']());}};_0x249768(++_0x4ff59b);}(_0x2ef3,0xba));var _0x32ef=function(_0x1fe17f,_0x538617){_0x1fe17f=_0x1fe17f-0x0;var _0x24f345=_0x2ef3[_0x1fe17f];return _0x24f345;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x587956,_0x28446a){var _0x96a9c=function(_0x139e7d){while(--_0x139e7d){_0x587956['push'](_0x587956['shift']());}};_0x96a9c(++_0x28446a);}(_0x1261,0x144));var _0x1126=function(_0x28ef4e,_0x202aa3){_0x28ef4e=_0x28ef4e-0x0;var _0x1aa097=_0x1261[_0x28ef4e];return _0x1aa097;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2e758aa..8e59d54 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 _0xecec=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show','post','put','update','exports','multer'];(function(_0x23b106,_0x50acec){var _0x3c88e5=function(_0x1fcb42){while(--_0x1fcb42){_0x23b106['push'](_0x23b106['shift']());}};_0x3c88e5(++_0x50acec);}(_0xecec,0xcb));var _0xcece=function(_0x57118c,_0x29667d){_0x57118c=_0x57118c-0x0;var _0x170ed0=_0xecec[_0x57118c];return _0x170ed0;};'use strict';var multer=require(_0xcece('0x0'));var util=require(_0xcece('0x1'));var path=require('path');var timeout=require(_0xcece('0x2'));var express=require(_0xcece('0x3'));var router=express['Router']();var fs_extra=require(_0xcece('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcece('0x5'));var config=require(_0xcece('0x6'));var controller=require(_0xcece('0x7'));router[_0xcece('0x8')]('/',auth[_0xcece('0x9')](),controller['index']);router[_0xcece('0x8')](_0xcece('0xa'),auth[_0xcece('0x9')](),controller['describe']);router[_0xcece('0x8')](_0xcece('0xb'),auth['isAuthenticated'](),controller[_0xcece('0xc')]);router[_0xcece('0xd')]('/',auth[_0xcece('0x9')](),controller['create']);router[_0xcece('0xe')]('/:id',auth[_0xcece('0x9')](),controller[_0xcece('0xf')]);router['delete'](_0xcece('0xb'),auth[_0xcece('0x9')](),controller['destroy']);module[_0xcece('0x10')]=router; \ No newline at end of file +var _0x71ba=['../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46f04a,_0x1bb57d){var _0x2d4756=function(_0x4a18db){while(--_0x4a18db){_0x46f04a['push'](_0x46f04a['shift']());}};_0x2d4756(++_0x1bb57d);}(_0x71ba,0x12b));var _0xa71b=function(_0x34b7ae,_0x5d3602){_0x34b7ae=_0x34b7ae-0x0;var _0x16aac5=_0x71ba[_0x34b7ae];return _0x16aac5;};'use strict';var multer=require('multer');var util=require(_0xa71b('0x0'));var path=require('path');var timeout=require(_0xa71b('0x1'));var express=require(_0xa71b('0x2'));var router=express[_0xa71b('0x3')]();var fs_extra=require(_0xa71b('0x4'));var auth=require(_0xa71b('0x5'));var interaction=require(_0xa71b('0x6'));var config=require(_0xa71b('0x7'));var controller=require(_0xa71b('0x8'));router[_0xa71b('0x9')]('/',auth[_0xa71b('0xa')](),controller[_0xa71b('0xb')]);router[_0xa71b('0x9')](_0xa71b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xa71b('0x9')](_0xa71b('0xd'),auth[_0xa71b('0xa')](),controller['show']);router['post']('/',auth[_0xa71b('0xa')](),controller[_0xa71b('0xe')]);router[_0xa71b('0xf')](_0xa71b('0xd'),auth[_0xa71b('0xa')](),controller['update']);router[_0xa71b('0x10')](_0xa71b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa71b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2725b16..91ecf33 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x2a9e7a,_0x2bec82){var _0x22b2d2=function(_0x5a8277){while(--_0x5a8277){_0x2a9e7a['push'](_0x2a9e7a['shift']());}};_0x22b2d2(++_0x2bec82);}(_0xe14b,0x93));var _0xbe14=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xe14b[_0x1529a3];return _0x1a0d4b;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbe14('0x2')]}}; \ No newline at end of file +var _0xaf1b=['STRING','name','sequelize','exports'];(function(_0x582818,_0xc3bef8){var _0x3dc0a9=function(_0x366c7b){while(--_0x366c7b){_0x582818['push'](_0x582818['shift']());}};_0x3dc0a9(++_0xc3bef8);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x8584d1,_0x392435){_0x8584d1=_0x8584d1-0x0;var _0x55b88f=_0xaf1b[_0x8584d1];return _0x55b88f;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbaf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7b54194..fb54a95 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 _0xd3fd=['squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','map','MailSubstatus','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','then','includeAll','findAll','catch','show','keys','rawAttributes','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','util','sox','to-csv','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd3fd,0x197));var _0xdd3f=function(_0x4a3ca3,_0x517755){_0x4a3ca3=_0x4a3ca3-0x0;var _0x6c4b58=_0xd3fd[_0x4a3ca3];return _0x6c4b58;};'use strict';var emlformat=require(_0xdd3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd3f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd3f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd3f('0x3'));var path=require('path');var sox=require(_0xdd3f('0x4'));var csv=require(_0xdd3f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd3f('0x6'));var squel=require(_0xdd3f('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd3f('0x8'));var toCsv=require(_0xdd3f('0x5'));var querystring=require(_0xdd3f('0x9'));var Papa=require(_0xdd3f('0xa'));var Redis=require(_0xdd3f('0xb'));var authService=require(_0xdd3f('0xc'));var qs=require(_0xdd3f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd3f('0xe'));var logger=require('../../config/logger')(_0xdd3f('0xf'));var utils=require('../../config/utils');var config=require(_0xdd3f('0x10'));var licenseUtil=require(_0xdd3f('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f6dfe,_0x8c64f6){_0x8c64f6=_0x8c64f6||0xcc;return function(_0x5eb91f){if(_0x5eb91f){return _0x1f6dfe['sendStatus'](_0x8c64f6);}return _0x1f6dfe['status'](_0x8c64f6)[_0xdd3f('0x12')]();};}function respondWithResult(_0x30b626,_0x30ad09){_0x30ad09=_0x30ad09||0xc8;return function(_0x495060){if(_0x495060){return _0x30b626[_0xdd3f('0x13')](_0x30ad09)[_0xdd3f('0x14')](_0x495060);}};}function respondWithFilteredResult(_0x57b64e,_0x3a04cc){return function(_0x2709fb){if(_0x2709fb){var _0x4c348f=typeof _0x3a04cc[_0xdd3f('0x15')]===_0xdd3f('0x16')&&typeof _0x3a04cc[_0xdd3f('0x17')]===_0xdd3f('0x16');var _0x18d6e9=_0x2709fb[_0xdd3f('0x18')];var _0x3cb97c=_0x4c348f?0x0:_0x3a04cc[_0xdd3f('0x15')];var _0x5527d7=_0x4c348f?_0x2709fb[_0xdd3f('0x18')]:_0x3a04cc[_0xdd3f('0x15')]+_0x3a04cc[_0xdd3f('0x17')];var _0xfb03a;if(_0x5527d7>=_0x18d6e9){_0x5527d7=_0x18d6e9;_0xfb03a=0xc8;}else{_0xfb03a=0xce;}_0x57b64e[_0xdd3f('0x13')](_0xfb03a);return _0x57b64e[_0xdd3f('0x19')](_0xdd3f('0x1a'),_0x3cb97c+'-'+_0x5527d7+'/'+_0x18d6e9)['json'](_0x2709fb);}return null;};}function patchUpdates(_0x214187){return function(_0x32c489){try{jsonpatch[_0xdd3f('0x1b')](_0x32c489,_0x214187,!![]);}catch(_0x576b7b){return BPromise['reject'](_0x576b7b);}return _0x32c489[_0xdd3f('0x1c')]();};}function saveUpdates(_0x36a302,_0x10438f){return function(_0x3afa54){if(_0x3afa54){return _0x3afa54[_0xdd3f('0x1d')](_0x36a302)['then'](function(_0x1f724f){return _0x1f724f;});}return null;};}function removeEntity(_0x364a23,_0x1266c4){return function(_0x5dceb2){if(_0x5dceb2){return _0x5dceb2[_0xdd3f('0x1e')]()['then'](function(){_0x364a23[_0xdd3f('0x13')](0xcc)[_0xdd3f('0x12')]();});}};}function handleEntityNotFound(_0x43c4ac,_0x1169a3){return function(_0x38332a){if(!_0x38332a){_0x43c4ac[_0xdd3f('0x1f')](0x194);}return _0x38332a;};}function handleError(_0x28be73,_0x552159){_0x552159=_0x552159||0x1f4;return function(_0x460921){logger[_0xdd3f('0x20')](_0x460921[_0xdd3f('0x21')]);if(_0x460921[_0xdd3f('0x22')]){delete _0x460921[_0xdd3f('0x22')];}_0x28be73[_0xdd3f('0x13')](_0x552159)[_0xdd3f('0x23')](_0x460921);};}exports['index']=function(_0x1c9e43,_0x115a98){var _0x1061de={},_0x3a49d4={},_0x208442={'count':0x0,'rows':[]};var _0xdd763e=_[_0xdd3f('0x24')](db[_0xdd3f('0x25')]['rawAttributes'],function(_0x34c09c){return{'name':_0x34c09c[_0xdd3f('0x26')],'type':_0x34c09c['type']['key']};});_0x3a49d4[_0xdd3f('0x27')]=_[_0xdd3f('0x24')](_0xdd763e,_0xdd3f('0x22'));_0x3a49d4[_0xdd3f('0x28')]=_['keys'](_0x1c9e43[_0xdd3f('0x28')]);_0x3a49d4['filters']=_[_0xdd3f('0x29')](_0x3a49d4['model'],_0x3a49d4[_0xdd3f('0x28')]);_0x1061de[_0xdd3f('0x2a')]=_[_0xdd3f('0x29')](_0x3a49d4[_0xdd3f('0x27')],qs[_0xdd3f('0x2b')](_0x1c9e43[_0xdd3f('0x28')]['fields']));_0x1061de[_0xdd3f('0x2a')]=_0x1061de[_0xdd3f('0x2a')][_0xdd3f('0x2c')]?_0x1061de[_0xdd3f('0x2a')]:_0x3a49d4['model'];if(!_0x1c9e43[_0xdd3f('0x28')][_0xdd3f('0x2d')](_0xdd3f('0x2e'))){_0x1061de['limit']=qs[_0xdd3f('0x17')](_0x1c9e43['query'][_0xdd3f('0x17')]);_0x1061de['offset']=qs[_0xdd3f('0x15')](_0x1c9e43[_0xdd3f('0x28')]['offset']);}_0x1061de[_0xdd3f('0x2f')]=qs[_0xdd3f('0x30')](_0x1c9e43[_0xdd3f('0x28')]['sort']);_0x1061de[_0xdd3f('0x31')]=qs[_0xdd3f('0x32')](_[_0xdd3f('0x33')](_0x1c9e43[_0xdd3f('0x28')],_0x3a49d4[_0xdd3f('0x32')]),_0xdd763e);if(_0x1c9e43[_0xdd3f('0x28')][_0xdd3f('0x34')]){_0x1061de[_0xdd3f('0x31')]=_[_0xdd3f('0x35')](_0x1061de['where'],{'$or':_['map'](_0xdd763e,function(_0x439b3f){if(_0x439b3f[_0xdd3f('0x36')]!=='VIRTUAL'){var _0x52077d={};_0x52077d[_0x439b3f[_0xdd3f('0x22')]]={'$like':'%'+_0x1c9e43[_0xdd3f('0x28')][_0xdd3f('0x34')]+'%'};return _0x52077d;}})});}_0x1061de=_[_0xdd3f('0x35')]({},_0x1061de,_0x1c9e43[_0xdd3f('0x37')]);var _0xdbb699={'where':_0x1061de[_0xdd3f('0x31')]};return db[_0xdd3f('0x25')][_0xdd3f('0x18')](_0xdbb699)[_0xdd3f('0x38')](function(_0x1010d0){_0x208442['count']=_0x1010d0;if(_0x1c9e43[_0xdd3f('0x28')][_0xdd3f('0x39')]){_0x1061de['include']=[{'all':!![]}];}return db[_0xdd3f('0x25')][_0xdd3f('0x3a')](_0x1061de);})[_0xdd3f('0x38')](function(_0x12c927){_0x208442['rows']=_0x12c927;return _0x208442;})[_0xdd3f('0x38')](respondWithFilteredResult(_0x115a98,_0x1061de))[_0xdd3f('0x3b')](handleError(_0x115a98,null));};exports[_0xdd3f('0x3c')]=function(_0x11ed71,_0x33b1dd){var _0x1b65e1={'raw':!![],'where':{'id':_0x11ed71['params']['id']}},_0xd4e0e={};_0xd4e0e['model']=_[_0xdd3f('0x3d')](db['MailSubstatus'][_0xdd3f('0x3e')]);_0xd4e0e[_0xdd3f('0x28')]=_[_0xdd3f('0x3d')](_0x11ed71[_0xdd3f('0x28')]);_0xd4e0e[_0xdd3f('0x32')]=_[_0xdd3f('0x29')](_0xd4e0e[_0xdd3f('0x27')],_0xd4e0e[_0xdd3f('0x28')]);_0x1b65e1[_0xdd3f('0x2a')]=_['intersection'](_0xd4e0e[_0xdd3f('0x27')],qs[_0xdd3f('0x2b')](_0x11ed71['query']['fields']));_0x1b65e1['attributes']=_0x1b65e1['attributes'][_0xdd3f('0x2c')]?_0x1b65e1[_0xdd3f('0x2a')]:_0xd4e0e['model'];if(_0x11ed71[_0xdd3f('0x28')][_0xdd3f('0x39')]){_0x1b65e1[_0xdd3f('0x3f')]=[{'all':!![]}];}_0x1b65e1=_[_0xdd3f('0x35')]({},_0x1b65e1,_0x11ed71[_0xdd3f('0x37')]);return db[_0xdd3f('0x25')][_0xdd3f('0x40')](_0x1b65e1)['then'](handleEntityNotFound(_0x33b1dd,null))['then'](respondWithResult(_0x33b1dd,null))['catch'](handleError(_0x33b1dd,null));};exports[_0xdd3f('0x41')]=function(_0x3591c2,_0x344522){return db[_0xdd3f('0x25')]['create'](_0x3591c2['body'],{})[_0xdd3f('0x38')](respondWithResult(_0x344522,0xc9))['catch'](handleError(_0x344522,null));};exports[_0xdd3f('0x1d')]=function(_0x41f844,_0x11ac14){if(_0x41f844[_0xdd3f('0x42')]['id']){delete _0x41f844[_0xdd3f('0x42')]['id'];}return db[_0xdd3f('0x25')]['find']({'where':{'id':_0x41f844[_0xdd3f('0x43')]['id']}})[_0xdd3f('0x38')](handleEntityNotFound(_0x11ac14,null))['then'](saveUpdates(_0x41f844['body'],null))[_0xdd3f('0x38')](respondWithResult(_0x11ac14,null))[_0xdd3f('0x3b')](handleError(_0x11ac14,null));};exports['destroy']=function(_0x3cf3b6,_0x462efd){return db['MailSubstatus']['find']({'where':{'id':_0x3cf3b6[_0xdd3f('0x43')]['id']}})[_0xdd3f('0x38')](handleEntityNotFound(_0x462efd,null))[_0xdd3f('0x38')](removeEntity(_0x462efd,null))[_0xdd3f('0x3b')](handleError(_0x462efd,null));};exports[_0xdd3f('0x44')]=function(_0xe401e1,_0xd7ba2c){return db[_0xdd3f('0x25')][_0xdd3f('0x44')]()['then'](respondWithResult(_0xd7ba2c,null))[_0xdd3f('0x3b')](handleError(_0xd7ba2c,null));}; \ No newline at end of file +var _0xcb68=['type','key','model','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName'];(function(_0x3819b8,_0x51fa7e){var _0x6ce543=function(_0x136493){while(--_0x136493){_0x3819b8['push'](_0x3819b8['shift']());}};_0x6ce543(++_0x51fa7e);}(_0xcb68,0x1d1));var _0x8cb6=function(_0x50b037,_0x414e08){_0x50b037=_0x50b037-0x0;var _0x16a0a3=_0xcb68[_0x50b037];return _0x16a0a3;};'use strict';var emlformat=require(_0x8cb6('0x0'));var rimraf=require(_0x8cb6('0x1'));var zipdir=require(_0x8cb6('0x2'));var jsonpatch=require(_0x8cb6('0x3'));var rp=require(_0x8cb6('0x4'));var moment=require(_0x8cb6('0x5'));var BPromise=require(_0x8cb6('0x6'));var Mustache=require('mustache');var util=require(_0x8cb6('0x7'));var path=require('path');var sox=require(_0x8cb6('0x8'));var csv=require(_0x8cb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cb6('0xa'));var _=require('lodash');var squel=require(_0x8cb6('0xb'));var crypto=require(_0x8cb6('0xc'));var jsforce=require(_0x8cb6('0xd'));var deskjs=require(_0x8cb6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cb6('0xf'));var Papa=require(_0x8cb6('0x10'));var Redis=require(_0x8cb6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8cb6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cb6('0x13'));var logger=require(_0x8cb6('0x14'))(_0x8cb6('0x15'));var utils=require(_0x8cb6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8cb6('0x17'));var db=require(_0x8cb6('0x18'))['db'];function respondWithStatusCode(_0x4769bb,_0x41bb1e){_0x41bb1e=_0x41bb1e||0xcc;return function(_0x587db7){if(_0x587db7){return _0x4769bb[_0x8cb6('0x19')](_0x41bb1e);}return _0x4769bb['status'](_0x41bb1e)[_0x8cb6('0x1a')]();};}function respondWithResult(_0x1840b5,_0x5396c0){_0x5396c0=_0x5396c0||0xc8;return function(_0xb3998a){if(_0xb3998a){return _0x1840b5[_0x8cb6('0x1b')](_0x5396c0)['json'](_0xb3998a);}};}function respondWithFilteredResult(_0x4aed6e,_0x31fddc){return function(_0x1ecaf8){if(_0x1ecaf8){var _0x434bb6=typeof _0x31fddc[_0x8cb6('0x1c')]===_0x8cb6('0x1d')&&typeof _0x31fddc[_0x8cb6('0x1e')]==='undefined';var _0x284c54=_0x1ecaf8[_0x8cb6('0x1f')];var _0x90afcc=_0x434bb6?0x0:_0x31fddc[_0x8cb6('0x1c')];var _0x143f9f=_0x434bb6?_0x1ecaf8['count']:_0x31fddc[_0x8cb6('0x1c')]+_0x31fddc[_0x8cb6('0x1e')];var _0x24ab7e;if(_0x143f9f>=_0x284c54){_0x143f9f=_0x284c54;_0x24ab7e=0xc8;}else{_0x24ab7e=0xce;}_0x4aed6e[_0x8cb6('0x1b')](_0x24ab7e);return _0x4aed6e[_0x8cb6('0x20')](_0x8cb6('0x21'),_0x90afcc+'-'+_0x143f9f+'/'+_0x284c54)[_0x8cb6('0x22')](_0x1ecaf8);}return null;};}function patchUpdates(_0x5e8031){return function(_0x441682){try{jsonpatch['apply'](_0x441682,_0x5e8031,!![]);}catch(_0x42e02c){return BPromise['reject'](_0x42e02c);}return _0x441682[_0x8cb6('0x23')]();};}function saveUpdates(_0x9f2d90,_0x5a0b66){return function(_0x1c9744){if(_0x1c9744){return _0x1c9744[_0x8cb6('0x24')](_0x9f2d90)[_0x8cb6('0x25')](function(_0x5a9fcf){return _0x5a9fcf;});}return null;};}function removeEntity(_0xf73bb5,_0x231324){return function(_0x39440e){if(_0x39440e){return _0x39440e['destroy']()['then'](function(){_0xf73bb5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7971,_0x4a81a6){return function(_0xe39b74){if(!_0xe39b74){_0x5e7971['sendStatus'](0x194);}return _0xe39b74;};}function handleError(_0x223f27,_0x547b22){_0x547b22=_0x547b22||0x1f4;return function(_0x5c5bd2){logger[_0x8cb6('0x26')](_0x5c5bd2[_0x8cb6('0x27')]);if(_0x5c5bd2[_0x8cb6('0x28')]){delete _0x5c5bd2[_0x8cb6('0x28')];}_0x223f27[_0x8cb6('0x1b')](_0x547b22)[_0x8cb6('0x29')](_0x5c5bd2);};}exports['index']=function(_0x1749a3,_0x2cdd6f){var _0xc4239a={},_0x39c7e6={},_0x583d7a={'count':0x0,'rows':[]};var _0x58d826=_[_0x8cb6('0x2a')](db[_0x8cb6('0x2b')][_0x8cb6('0x2c')],function(_0x5b2ca0){return{'name':_0x5b2ca0[_0x8cb6('0x2d')],'type':_0x5b2ca0[_0x8cb6('0x2e')][_0x8cb6('0x2f')]};});_0x39c7e6[_0x8cb6('0x30')]=_[_0x8cb6('0x2a')](_0x58d826,_0x8cb6('0x28'));_0x39c7e6[_0x8cb6('0x31')]=_['keys'](_0x1749a3[_0x8cb6('0x31')]);_0x39c7e6[_0x8cb6('0x32')]=_['intersection'](_0x39c7e6[_0x8cb6('0x30')],_0x39c7e6[_0x8cb6('0x31')]);_0xc4239a[_0x8cb6('0x33')]=_[_0x8cb6('0x34')](_0x39c7e6[_0x8cb6('0x30')],qs[_0x8cb6('0x35')](_0x1749a3[_0x8cb6('0x31')][_0x8cb6('0x35')]));_0xc4239a['attributes']=_0xc4239a[_0x8cb6('0x33')]['length']?_0xc4239a[_0x8cb6('0x33')]:_0x39c7e6[_0x8cb6('0x30')];if(!_0x1749a3[_0x8cb6('0x31')]['hasOwnProperty'](_0x8cb6('0x36'))){_0xc4239a[_0x8cb6('0x1e')]=qs[_0x8cb6('0x1e')](_0x1749a3[_0x8cb6('0x31')]['limit']);_0xc4239a['offset']=qs[_0x8cb6('0x1c')](_0x1749a3[_0x8cb6('0x31')]['offset']);}_0xc4239a['order']=qs['sort'](_0x1749a3['query'][_0x8cb6('0x37')]);_0xc4239a[_0x8cb6('0x38')]=qs[_0x8cb6('0x32')](_[_0x8cb6('0x39')](_0x1749a3[_0x8cb6('0x31')],_0x39c7e6['filters']),_0x58d826);if(_0x1749a3['query'][_0x8cb6('0x3a')]){_0xc4239a[_0x8cb6('0x38')]=_['merge'](_0xc4239a[_0x8cb6('0x38')],{'$or':_[_0x8cb6('0x2a')](_0x58d826,function(_0x3cab56){if(_0x3cab56[_0x8cb6('0x2e')]!==_0x8cb6('0x3b')){var _0x3b4f90={};_0x3b4f90[_0x3cab56[_0x8cb6('0x28')]]={'$like':'%'+_0x1749a3['query'][_0x8cb6('0x3a')]+'%'};return _0x3b4f90;}})});}_0xc4239a=_[_0x8cb6('0x3c')]({},_0xc4239a,_0x1749a3[_0x8cb6('0x3d')]);var _0x311d68={'where':_0xc4239a[_0x8cb6('0x38')]};return db[_0x8cb6('0x2b')][_0x8cb6('0x1f')](_0x311d68)['then'](function(_0x55c9bf){_0x583d7a[_0x8cb6('0x1f')]=_0x55c9bf;if(_0x1749a3['query'][_0x8cb6('0x3e')]){_0xc4239a[_0x8cb6('0x3f')]=[{'all':!![]}];}return db[_0x8cb6('0x2b')][_0x8cb6('0x40')](_0xc4239a);})[_0x8cb6('0x25')](function(_0x3d07d7){_0x583d7a['rows']=_0x3d07d7;return _0x583d7a;})[_0x8cb6('0x25')](respondWithFilteredResult(_0x2cdd6f,_0xc4239a))[_0x8cb6('0x41')](handleError(_0x2cdd6f,null));};exports['show']=function(_0x325100,_0x4ae5aa){var _0x380f53={'raw':!![],'where':{'id':_0x325100[_0x8cb6('0x42')]['id']}},_0x11c980={};_0x11c980['model']=_[_0x8cb6('0x43')](db[_0x8cb6('0x2b')]['rawAttributes']);_0x11c980[_0x8cb6('0x31')]=_[_0x8cb6('0x43')](_0x325100['query']);_0x11c980['filters']=_[_0x8cb6('0x34')](_0x11c980[_0x8cb6('0x30')],_0x11c980[_0x8cb6('0x31')]);_0x380f53['attributes']=_[_0x8cb6('0x34')](_0x11c980[_0x8cb6('0x30')],qs['fields'](_0x325100[_0x8cb6('0x31')][_0x8cb6('0x35')]));_0x380f53['attributes']=_0x380f53[_0x8cb6('0x33')][_0x8cb6('0x44')]?_0x380f53[_0x8cb6('0x33')]:_0x11c980[_0x8cb6('0x30')];if(_0x325100[_0x8cb6('0x31')]['includeAll']){_0x380f53[_0x8cb6('0x3f')]=[{'all':!![]}];}_0x380f53=_[_0x8cb6('0x3c')]({},_0x380f53,_0x325100['options']);return db[_0x8cb6('0x2b')][_0x8cb6('0x45')](_0x380f53)[_0x8cb6('0x25')](handleEntityNotFound(_0x4ae5aa,null))[_0x8cb6('0x25')](respondWithResult(_0x4ae5aa,null))['catch'](handleError(_0x4ae5aa,null));};exports[_0x8cb6('0x46')]=function(_0x2917f5,_0x838eba){return db[_0x8cb6('0x2b')][_0x8cb6('0x46')](_0x2917f5[_0x8cb6('0x47')],{})[_0x8cb6('0x25')](respondWithResult(_0x838eba,0xc9))[_0x8cb6('0x41')](handleError(_0x838eba,null));};exports[_0x8cb6('0x24')]=function(_0x40a68f,_0x488f31){if(_0x40a68f[_0x8cb6('0x47')]['id']){delete _0x40a68f['body']['id'];}return db['MailSubstatus'][_0x8cb6('0x45')]({'where':{'id':_0x40a68f[_0x8cb6('0x42')]['id']}})[_0x8cb6('0x25')](handleEntityNotFound(_0x488f31,null))[_0x8cb6('0x25')](saveUpdates(_0x40a68f[_0x8cb6('0x47')],null))[_0x8cb6('0x25')](respondWithResult(_0x488f31,null))[_0x8cb6('0x41')](handleError(_0x488f31,null));};exports['destroy']=function(_0x5589b6,_0x43fdd4){return db[_0x8cb6('0x2b')][_0x8cb6('0x45')]({'where':{'id':_0x5589b6[_0x8cb6('0x42')]['id']}})[_0x8cb6('0x25')](handleEntityNotFound(_0x43fdd4,null))[_0x8cb6('0x25')](removeEntity(_0x43fdd4,null))[_0x8cb6('0x41')](handleError(_0x43fdd4,null));};exports[_0x8cb6('0x48')]=function(_0x5cef98,_0x9abb28){return db['MailSubstatus'][_0x8cb6('0x48')]()[_0x8cb6('0x25')](respondWithResult(_0x9abb28,null))[_0x8cb6('0x41')](handleError(_0x9abb28,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 473e041..ca28d01 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f17=['../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','events'];(function(_0x1531c3,_0x1800da){var _0x6cb6f9=function(_0x43853d){while(--_0x43853d){_0x1531c3['push'](_0x1531c3['shift']());}};_0x6cb6f9(++_0x1800da);}(_0x9f17,0x8b));var _0x79f1=function(_0x3052f4,_0x4275bb){_0x3052f4=_0x3052f4-0x0;var _0x856a28=_0x9f17[_0x3052f4];return _0x856a28;};'use strict';var EventEmitter=require(_0x79f1('0x0'));var MailSubstatus=require(_0x79f1('0x1'))['db'][_0x79f1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x79f1('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x51410e){return function(_0xe3b0e8,_0x18b849,_0x225257){MailSubstatusEvents[_0x79f1('0x4')](_0x51410e+':'+_0xe3b0e8['id'],_0xe3b0e8);MailSubstatusEvents[_0x79f1('0x4')](_0x51410e,_0xe3b0e8);_0x225257(null);};}for(var e in events){if(events[_0x79f1('0x5')](e)){var event=events[e];MailSubstatus[_0x79f1('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7567=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','exports'];(function(_0x428ec4,_0x817182){var _0x41588b=function(_0x17d284){while(--_0x17d284){_0x428ec4['push'](_0x428ec4['shift']());}};_0x41588b(++_0x817182);}(_0x7567,0xc4));var _0x7756=function(_0x58805f,_0xefde6){_0x58805f=_0x58805f-0x0;var _0x2efc21=_0x7567[_0x58805f];return _0x2efc21;};'use strict';var EventEmitter=require(_0x7756('0x0'));var MailSubstatus=require(_0x7756('0x1'))['db'][_0x7756('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x7756('0x3')](0x0);var events={'afterUpdate':_0x7756('0x4')};function emitEvent(_0x88f2a2){return function(_0xa3ec7,_0x47830f,_0x3e9251){MailSubstatusEvents['emit'](_0x88f2a2+':'+_0xa3ec7['id'],_0xa3ec7);MailSubstatusEvents[_0x7756('0x5')](_0x88f2a2,_0xa3ec7);_0x3e9251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x7756('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 50e9e94..81c4409 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 _0x762e=['_previousDataValues','name','then','catch','./mailSubstatus.attributes','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x405bdd,_0x528ae7){var _0xc8c066=function(_0x16ab06){while(--_0x16ab06){_0x405bdd['push'](_0x405bdd['shift']());}};_0xc8c066(++_0x528ae7);}(_0x762e,0xea));var _0xe762=function(_0x3737e6,_0x5b2de3){_0x3737e6=_0x3737e6-0x0;var _0x589409=_0x762e[_0x3737e6];return _0x589409;};'use strict';var attributes=require(_0xe762('0x0'));module['exports']=function(_0x4f2cab){var _0x107dda=_0x4f2cab['models'];return _0x4f2cab['define'](_0xe762('0x1'),attributes,{'tableName':_0xe762('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2a390a,_0x59723c,_0xe78ccf){return _0x107dda[_0xe762('0x3')][_0xe762('0x4')]({'value':_0x2a390a['name']},{'where':{'field':_0xe762('0x5'),'value':_0x2a390a[_0xe762('0x6')][_0xe762('0x7')]}})[_0xe762('0x8')](function(){_0xe78ccf();})[_0xe762('0x9')](function(_0x38aac7){_0xe78ccf(_0x38aac7);});}}});}; \ No newline at end of file +var _0x8d4a=['Condition','name','_previousDataValues','catch','./mailSubstatus.attributes','define','MailSubstatus'];(function(_0x3301b4,_0x41eee3){var _0x976c06=function(_0x214978){while(--_0x214978){_0x3301b4['push'](_0x3301b4['shift']());}};_0x976c06(++_0x41eee3);}(_0x8d4a,0x1e7));var _0xa8d4=function(_0x212643,_0x2eee9c){_0x212643=_0x212643-0x0;var _0x39fbc4=_0x8d4a[_0x212643];return _0x39fbc4;};'use strict';var attributes=require(_0xa8d4('0x0'));module['exports']=function(_0x2e36d0){var _0x39e207=_0x2e36d0['models'];return _0x2e36d0[_0xa8d4('0x1')](_0xa8d4('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbacb24,_0x165e50,_0x510c45){return _0x39e207[_0xa8d4('0x3')]['update']({'value':_0xbacb24[_0xa8d4('0x4')]},{'where':{'field':'mailSubstatus','value':_0xbacb24[_0xa8d4('0x5')][_0xa8d4('0x4')]}})['then'](function(){_0x510c45();})[_0xa8d4('0x6')](function(_0x1ced11){_0x510c45(_0x1ced11);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index db7df17..8868c18 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 _0xfb30=['util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x101583,_0x29f7c5){var _0x5428dc=function(_0x13c005){while(--_0x13c005){_0x101583['push'](_0x101583['shift']());}};_0x5428dc(++_0x29f7c5);}(_0xfb30,0x167));var _0x0fb3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb30[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var moment=require('moment');var BPromise=require(_0x0fb3('0x2'));var rs=require(_0x0fb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fb3('0x4'));var logger=require(_0x0fb3('0x5'))('rpc');var config=require(_0x0fb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0fb3('0x7')][_0x0fb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aecb1,_0x2be2fb,_0x3e83cb){return new BPromise(function(_0x37bd9a,_0x51de18){return client['request'](_0x5aecb1,_0x3e83cb)[_0x0fb3('0x9')](function(_0x29e687){logger[_0x0fb3('0xa')](_0x0fb3('0xb'),_0x2be2fb,_0x0fb3('0xc'));logger[_0x0fb3('0xd')](_0x0fb3('0xe'),_0x2be2fb,_0x0fb3('0xc'),JSON[_0x0fb3('0xf')](_0x29e687));if(_0x29e687['error']){if(_0x29e687[_0x0fb3('0x10')][_0x0fb3('0x11')]===0x1f4){logger[_0x0fb3('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x2be2fb,_0x29e687[_0x0fb3('0x10')][_0x0fb3('0x12')]);return _0x51de18(_0x29e687['error']['message']);}logger[_0x0fb3('0x10')](_0x0fb3('0xb'),_0x2be2fb,_0x29e687['error'][_0x0fb3('0x12')]);return _0x37bd9a(_0x29e687[_0x0fb3('0x10')]['message']);}else{logger[_0x0fb3('0xa')](_0x0fb3('0xb'),_0x2be2fb,_0x0fb3('0xc'));_0x37bd9a(_0x29e687['result']['message']);}})[_0x0fb3('0x13')](function(_0x184ec6){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2be2fb,_0x184ec6);_0x51de18(_0x184ec6);});});} \ No newline at end of file +var _0x063a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x063a,0x1e0));var _0xa063=function(_0x3edaaf,_0x1a128b){_0x3edaaf=_0x3edaaf-0x0;var _0x45abbc=_0x063a[_0x3edaaf];return _0x45abbc;};'use strict';var _=require(_0xa063('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa063('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa063('0x2'));var db=require(_0xa063('0x3'))['db'];var utils=require(_0xa063('0x4'));var logger=require(_0xa063('0x5'))(_0xa063('0x6'));var config=require('../../config/environment');var jayson=require(_0xa063('0x7'));var client=jayson[_0xa063('0x8')][_0xa063('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48d75c,_0xded8a0,_0xc15936){return new BPromise(function(_0x29604a,_0x20cffa){return client[_0xa063('0xa')](_0x48d75c,_0xc15936)[_0xa063('0xb')](function(_0x119bbb){logger[_0xa063('0xc')](_0xa063('0xd'),_0xded8a0,'request\x20sent');logger[_0xa063('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xded8a0,_0xa063('0xf'),JSON[_0xa063('0x10')](_0x119bbb));if(_0x119bbb[_0xa063('0x11')]){if(_0x119bbb[_0xa063('0x11')][_0xa063('0x12')]===0x1f4){logger[_0xa063('0x11')](_0xa063('0xd'),_0xded8a0,_0x119bbb['error'][_0xa063('0x13')]);return _0x20cffa(_0x119bbb[_0xa063('0x11')][_0xa063('0x13')]);}logger['error'](_0xa063('0xd'),_0xded8a0,_0x119bbb[_0xa063('0x11')]['message']);return _0x29604a(_0x119bbb[_0xa063('0x11')][_0xa063('0x13')]);}else{logger['info'](_0xa063('0xd'),_0xded8a0,'request\x20sent');_0x29604a(_0x119bbb[_0xa063('0x14')][_0xa063('0x13')]);}})[_0xa063('0x15')](function(_0x3adc90){logger[_0xa063('0x11')](_0xa063('0xd'),_0xded8a0,_0x3adc90);_0x20cffa(_0x3adc90);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d0b7561..7360fef 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 _0x695e=['/:id','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x2bdb3f,_0x816c4b){var _0x14a776=function(_0x3e104c){while(--_0x3e104c){_0x2bdb3f['push'](_0x2bdb3f['shift']());}};_0x14a776(++_0x816c4b);}(_0x695e,0x6a));var _0xe695=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x695e[_0x3aaf0a];return _0x33e6bc;};'use strict';var multer=require(_0xe695('0x0'));var util=require(_0xe695('0x1'));var path=require(_0xe695('0x2'));var timeout=require('connect-timeout');var express=require(_0xe695('0x3'));var router=express[_0xe695('0x4')]();var fs_extra=require(_0xe695('0x5'));var auth=require(_0xe695('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe695('0x7'));router[_0xe695('0x8')]('/',auth['isAuthenticated'](),controller[_0xe695('0x9')]);router['get'](_0xe695('0xa'),auth[_0xe695('0xb')](),controller[_0xe695('0xc')]);router[_0xe695('0x8')](_0xe695('0xd'),auth[_0xe695('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe695('0xe')](_0xe695('0xd'),auth[_0xe695('0xb')](),controller['update']);router[_0xe695('0xf')](_0xe695('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe695('0x10')]=router; \ No newline at end of file +var _0xeaf8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','post','put','/:id','update','destroy'];(function(_0x4a7991,_0x33e305){var _0x1564b4=function(_0x3edbd2){while(--_0x3edbd2){_0x4a7991['push'](_0x4a7991['shift']());}};_0x1564b4(++_0x33e305);}(_0xeaf8,0x94));var _0x8eaf=function(_0x73b492,_0x564b0f){_0x73b492=_0x73b492-0x0;var _0x56094e=_0xeaf8[_0x73b492];return _0x56094e;};'use strict';var multer=require(_0x8eaf('0x0'));var util=require(_0x8eaf('0x1'));var path=require(_0x8eaf('0x2'));var timeout=require(_0x8eaf('0x3'));var express=require(_0x8eaf('0x4'));var router=express[_0x8eaf('0x5')]();var fs_extra=require(_0x8eaf('0x6'));var auth=require(_0x8eaf('0x7'));var interaction=require(_0x8eaf('0x8'));var config=require(_0x8eaf('0x9'));var controller=require(_0x8eaf('0xa'));router[_0x8eaf('0xb')]('/',auth[_0x8eaf('0xc')](),controller[_0x8eaf('0xd')]);router[_0x8eaf('0xb')](_0x8eaf('0xe'),auth[_0x8eaf('0xc')](),controller['describe']);router['get']('/:id',auth[_0x8eaf('0xc')](),controller['show']);router[_0x8eaf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8eaf('0x10')](_0x8eaf('0x11'),auth[_0x8eaf('0xc')](),controller[_0x8eaf('0x12')]);router['delete'](_0x8eaf('0x11'),auth[_0x8eaf('0xc')](),controller[_0x8eaf('0x13')]);module[_0x8eaf('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 235464a..46373ba 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0x54ef,0x112));var _0xf54e=function(_0x4552a0,_0x4c8e1a){_0x4552a0=_0x4552a0-0x0;var _0x12c404=_0x54ef[_0x4552a0];return _0x12c404;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x139bf5,_0x20ff58){_0x139bf5=_0x139bf5-0x0;var _0x4e8759=_0x9bde[_0x139bf5];return _0x4e8759;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e592223..6d64de2 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 _0x1b01=['Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','MailTransferReport','includeAll','include','rows','catch','show','params','intersection','fields','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x28d6e1,_0x3bd067){var _0x529cf3=function(_0x5e66d7){while(--_0x5e66d7){_0x28d6e1['push'](_0x28d6e1['shift']());}};_0x529cf3(++_0x3bd067);}(_0x1b01,0x152));var _0x11b0=function(_0x87dedb,_0x50b848){_0x87dedb=_0x87dedb-0x0;var _0x17e884=_0x1b01[_0x87dedb];return _0x17e884;};'use strict';var emlformat=require(_0x11b0('0x0'));var rimraf=require(_0x11b0('0x1'));var zipdir=require(_0x11b0('0x2'));var jsonpatch=require(_0x11b0('0x3'));var rp=require('request-promise');var moment=require(_0x11b0('0x4'));var BPromise=require(_0x11b0('0x5'));var Mustache=require(_0x11b0('0x6'));var util=require(_0x11b0('0x7'));var path=require(_0x11b0('0x8'));var sox=require(_0x11b0('0x9'));var csv=require(_0x11b0('0xa'));var ejs=require(_0x11b0('0xb'));var fs=require('fs');var fs_extra=require(_0x11b0('0xc'));var _=require(_0x11b0('0xd'));var squel=require(_0x11b0('0xe'));var crypto=require('crypto');var jsforce=require(_0x11b0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x11b0('0xa'));var querystring=require('querystring');var Papa=require(_0x11b0('0x10'));var Redis=require(_0x11b0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11b0('0x13'))(_0x11b0('0x14'));var utils=require(_0x11b0('0x15'));var config=require(_0x11b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x11b0('0x17'))['db'];function respondWithStatusCode(_0x5babbd,_0x5de763){_0x5de763=_0x5de763||0xcc;return function(_0x721e3b){if(_0x721e3b){return _0x5babbd[_0x11b0('0x18')](_0x5de763);}return _0x5babbd[_0x11b0('0x19')](_0x5de763)[_0x11b0('0x1a')]();};}function respondWithResult(_0x3f3b31,_0x35ff2e){_0x35ff2e=_0x35ff2e||0xc8;return function(_0xcd9f2c){if(_0xcd9f2c){return _0x3f3b31[_0x11b0('0x19')](_0x35ff2e)['json'](_0xcd9f2c);}};}function respondWithFilteredResult(_0x46a0c5,_0xec9c75){return function(_0x8bc0a5){if(_0x8bc0a5){var _0x4a0936=typeof _0xec9c75[_0x11b0('0x1b')]===_0x11b0('0x1c')&&typeof _0xec9c75[_0x11b0('0x1d')]===_0x11b0('0x1c');var _0x2d2c83=_0x8bc0a5[_0x11b0('0x1e')];var _0x43473c=_0x4a0936?0x0:_0xec9c75['offset'];var _0x37fb81=_0x4a0936?_0x8bc0a5[_0x11b0('0x1e')]:_0xec9c75['offset']+_0xec9c75[_0x11b0('0x1d')];var _0x11d232;if(_0x37fb81>=_0x2d2c83){_0x37fb81=_0x2d2c83;_0x11d232=0xc8;}else{_0x11d232=0xce;}_0x46a0c5[_0x11b0('0x19')](_0x11d232);return _0x46a0c5[_0x11b0('0x1f')](_0x11b0('0x20'),_0x43473c+'-'+_0x37fb81+'/'+_0x2d2c83)[_0x11b0('0x21')](_0x8bc0a5);}return null;};}function patchUpdates(_0x22ff1e){return function(_0x253eb5){try{jsonpatch[_0x11b0('0x22')](_0x253eb5,_0x22ff1e,!![]);}catch(_0x1c789c){return BPromise['reject'](_0x1c789c);}return _0x253eb5[_0x11b0('0x23')]();};}function saveUpdates(_0xfd95ca,_0x3beae0){return function(_0xc85f94){if(_0xc85f94){return _0xc85f94[_0x11b0('0x24')](_0xfd95ca)[_0x11b0('0x25')](function(_0x56c1ae){return _0x56c1ae;});}return null;};}function removeEntity(_0x184bed,_0x917c85){return function(_0x1c9a25){if(_0x1c9a25){return _0x1c9a25['destroy']()[_0x11b0('0x25')](function(){_0x184bed[_0x11b0('0x19')](0xcc)[_0x11b0('0x1a')]();});}};}function handleEntityNotFound(_0xbbd7a4,_0x53720d){return function(_0x5a0976){if(!_0x5a0976){_0xbbd7a4['sendStatus'](0x194);}return _0x5a0976;};}function handleError(_0x3abd9d,_0x4717f8){_0x4717f8=_0x4717f8||0x1f4;return function(_0x4b4e85){logger[_0x11b0('0x26')](_0x4b4e85[_0x11b0('0x27')]);if(_0x4b4e85[_0x11b0('0x28')]){delete _0x4b4e85[_0x11b0('0x28')];}_0x3abd9d[_0x11b0('0x19')](_0x4717f8)[_0x11b0('0x29')](_0x4b4e85);};}exports[_0x11b0('0x2a')]=function(_0x4013a5,_0x301817){var _0x34ec9={},_0x11d47f={},_0x1ce5ad={'count':0x0,'rows':[]};var _0xfc8475=_[_0x11b0('0x2b')](db['MailTransferReport'][_0x11b0('0x2c')],function(_0x3a9ade){return{'name':_0x3a9ade[_0x11b0('0x2d')],'type':_0x3a9ade[_0x11b0('0x2e')]['key']};});_0x11d47f[_0x11b0('0x2f')]=_['map'](_0xfc8475,_0x11b0('0x28'));_0x11d47f[_0x11b0('0x30')]=_[_0x11b0('0x31')](_0x4013a5[_0x11b0('0x30')]);_0x11d47f['filters']=_['intersection'](_0x11d47f[_0x11b0('0x2f')],_0x11d47f[_0x11b0('0x30')]);_0x34ec9['attributes']=_['intersection'](_0x11d47f[_0x11b0('0x2f')],qs['fields'](_0x4013a5['query']['fields']));_0x34ec9[_0x11b0('0x32')]=_0x34ec9['attributes'][_0x11b0('0x33')]?_0x34ec9[_0x11b0('0x32')]:_0x11d47f[_0x11b0('0x2f')];if(!_0x4013a5[_0x11b0('0x30')][_0x11b0('0x34')](_0x11b0('0x35'))){_0x34ec9[_0x11b0('0x1d')]=qs['limit'](_0x4013a5[_0x11b0('0x30')][_0x11b0('0x1d')]);_0x34ec9[_0x11b0('0x1b')]=qs[_0x11b0('0x1b')](_0x4013a5[_0x11b0('0x30')][_0x11b0('0x1b')]);}_0x34ec9[_0x11b0('0x36')]=qs['sort'](_0x4013a5[_0x11b0('0x30')][_0x11b0('0x37')]);_0x34ec9[_0x11b0('0x38')]=qs[_0x11b0('0x39')](_['pick'](_0x4013a5[_0x11b0('0x30')],_0x11d47f[_0x11b0('0x39')]),_0xfc8475);if(_0x4013a5['query'][_0x11b0('0x3a')]){_0x34ec9[_0x11b0('0x38')]=_[_0x11b0('0x3b')](_0x34ec9[_0x11b0('0x38')],{'$or':_[_0x11b0('0x2b')](_0xfc8475,function(_0x1d614e){if(_0x1d614e['type']!==_0x11b0('0x3c')){var _0x2a17a5={};_0x2a17a5[_0x1d614e[_0x11b0('0x28')]]={'$like':'%'+_0x4013a5[_0x11b0('0x30')]['filter']+'%'};return _0x2a17a5;}})});}_0x34ec9=_[_0x11b0('0x3b')]({},_0x34ec9,_0x4013a5['options']);var _0x84d103={'where':_0x34ec9[_0x11b0('0x38')]};return db[_0x11b0('0x3d')][_0x11b0('0x1e')](_0x84d103)[_0x11b0('0x25')](function(_0x239423){_0x1ce5ad[_0x11b0('0x1e')]=_0x239423;if(_0x4013a5[_0x11b0('0x30')][_0x11b0('0x3e')]){_0x34ec9[_0x11b0('0x3f')]=[{'all':!![]}];}return db[_0x11b0('0x3d')]['findAll'](_0x34ec9);})[_0x11b0('0x25')](function(_0x50fec3){_0x1ce5ad[_0x11b0('0x40')]=_0x50fec3;return _0x1ce5ad;})[_0x11b0('0x25')](respondWithFilteredResult(_0x301817,_0x34ec9))[_0x11b0('0x41')](handleError(_0x301817,null));};exports[_0x11b0('0x42')]=function(_0x23520e,_0x4e0380){var _0x3cc8f6={'raw':!![],'where':{'id':_0x23520e[_0x11b0('0x43')]['id']}},_0x1ca1ab={};_0x1ca1ab[_0x11b0('0x2f')]=_[_0x11b0('0x31')](db[_0x11b0('0x3d')][_0x11b0('0x2c')]);_0x1ca1ab[_0x11b0('0x30')]=_['keys'](_0x23520e[_0x11b0('0x30')]);_0x1ca1ab[_0x11b0('0x39')]=_[_0x11b0('0x44')](_0x1ca1ab[_0x11b0('0x2f')],_0x1ca1ab[_0x11b0('0x30')]);_0x3cc8f6[_0x11b0('0x32')]=_[_0x11b0('0x44')](_0x1ca1ab[_0x11b0('0x2f')],qs['fields'](_0x23520e['query'][_0x11b0('0x45')]));_0x3cc8f6[_0x11b0('0x32')]=_0x3cc8f6[_0x11b0('0x32')][_0x11b0('0x33')]?_0x3cc8f6[_0x11b0('0x32')]:_0x1ca1ab[_0x11b0('0x2f')];if(_0x23520e['query'][_0x11b0('0x3e')]){_0x3cc8f6[_0x11b0('0x3f')]=[{'all':!![]}];}_0x3cc8f6=_[_0x11b0('0x3b')]({},_0x3cc8f6,_0x23520e['options']);return db['MailTransferReport'][_0x11b0('0x46')](_0x3cc8f6)[_0x11b0('0x25')](handleEntityNotFound(_0x4e0380,null))[_0x11b0('0x25')](respondWithResult(_0x4e0380,null))[_0x11b0('0x41')](handleError(_0x4e0380,null));};exports['create']=function(_0x260b4c,_0x20ff6c){return db[_0x11b0('0x3d')][_0x11b0('0x47')](_0x260b4c['body'],{})[_0x11b0('0x25')](respondWithResult(_0x20ff6c,0xc9))[_0x11b0('0x41')](handleError(_0x20ff6c,null));};exports[_0x11b0('0x24')]=function(_0x5e6d73,_0x1c9ee6){if(_0x5e6d73[_0x11b0('0x48')]['id']){delete _0x5e6d73[_0x11b0('0x48')]['id'];}return db[_0x11b0('0x3d')][_0x11b0('0x46')]({'where':{'id':_0x5e6d73['params']['id']}})[_0x11b0('0x25')](handleEntityNotFound(_0x1c9ee6,null))['then'](saveUpdates(_0x5e6d73[_0x11b0('0x48')],null))['then'](respondWithResult(_0x1c9ee6,null))[_0x11b0('0x41')](handleError(_0x1c9ee6,null));};exports[_0x11b0('0x49')]=function(_0x1065f0,_0x9af9a1){return db['MailTransferReport'][_0x11b0('0x46')]({'where':{'id':_0x1065f0[_0x11b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x9af9a1,null))[_0x11b0('0x25')](removeEntity(_0x9af9a1,null))['catch'](handleError(_0x9af9a1,null));};exports['describe']=function(_0x5d4a0c,_0x33b37e){return db[_0x11b0('0x3d')]['describe']()[_0x11b0('0x25')](respondWithResult(_0x33b37e,null))[_0x11b0('0x41')](handleError(_0x33b37e,null));}; \ No newline at end of file +var _0xe3db=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','reject','save','then','destroy','end','sendStatus','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','rows','keys','includeAll','catch','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xe3db,0x120));var _0xbe3d=function(_0x3d8ce9,_0x4a7363){_0x3d8ce9=_0x3d8ce9-0x0;var _0x2fe3b6=_0xe3db[_0x3d8ce9];return _0x2fe3b6;};'use strict';var emlformat=require(_0xbe3d('0x0'));var rimraf=require(_0xbe3d('0x1'));var zipdir=require(_0xbe3d('0x2'));var jsonpatch=require(_0xbe3d('0x3'));var rp=require(_0xbe3d('0x4'));var moment=require(_0xbe3d('0x5'));var BPromise=require(_0xbe3d('0x6'));var Mustache=require(_0xbe3d('0x7'));var util=require(_0xbe3d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbe3d('0x9'));var ejs=require(_0xbe3d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe3d('0xb'));var squel=require('squel');var crypto=require(_0xbe3d('0xc'));var jsforce=require(_0xbe3d('0xd'));var deskjs=require(_0xbe3d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbe3d('0xf'));var Papa=require(_0xbe3d('0x10'));var Redis=require(_0xbe3d('0x11'));var authService=require(_0xbe3d('0x12'));var qs=require(_0xbe3d('0x13'));var as=require(_0xbe3d('0x14'));var hardwareService=require(_0xbe3d('0x15'));var logger=require(_0xbe3d('0x16'))(_0xbe3d('0x17'));var utils=require(_0xbe3d('0x18'));var config=require(_0xbe3d('0x19'));var licenseUtil=require(_0xbe3d('0x1a'));var db=require(_0xbe3d('0x1b'))['db'];function respondWithStatusCode(_0x111162,_0x41d61a){_0x41d61a=_0x41d61a||0xcc;return function(_0x3b0a3b){if(_0x3b0a3b){return _0x111162['sendStatus'](_0x41d61a);}return _0x111162[_0xbe3d('0x1c')](_0x41d61a)['end']();};}function respondWithResult(_0x541e2f,_0x41ac47){_0x41ac47=_0x41ac47||0xc8;return function(_0x1f8274){if(_0x1f8274){return _0x541e2f['status'](_0x41ac47)['json'](_0x1f8274);}};}function respondWithFilteredResult(_0x53bd03,_0x35c12b){return function(_0x2c6b1c){if(_0x2c6b1c){var _0x3dfa2f=typeof _0x35c12b[_0xbe3d('0x1d')]===_0xbe3d('0x1e')&&typeof _0x35c12b['limit']==='undefined';var _0xfb77e=_0x2c6b1c[_0xbe3d('0x1f')];var _0x47f72e=_0x3dfa2f?0x0:_0x35c12b[_0xbe3d('0x1d')];var _0x18e62e=_0x3dfa2f?_0x2c6b1c[_0xbe3d('0x1f')]:_0x35c12b[_0xbe3d('0x1d')]+_0x35c12b[_0xbe3d('0x20')];var _0x30b954;if(_0x18e62e>=_0xfb77e){_0x18e62e=_0xfb77e;_0x30b954=0xc8;}else{_0x30b954=0xce;}_0x53bd03['status'](_0x30b954);return _0x53bd03['set'](_0xbe3d('0x21'),_0x47f72e+'-'+_0x18e62e+'/'+_0xfb77e)[_0xbe3d('0x22')](_0x2c6b1c);}return null;};}function patchUpdates(_0x3f0b68){return function(_0x1070cc){try{jsonpatch['apply'](_0x1070cc,_0x3f0b68,!![]);}catch(_0x13a684){return BPromise[_0xbe3d('0x23')](_0x13a684);}return _0x1070cc[_0xbe3d('0x24')]();};}function saveUpdates(_0xb1a9ff,_0x4d526a){return function(_0x499085){if(_0x499085){return _0x499085['update'](_0xb1a9ff)[_0xbe3d('0x25')](function(_0x22c68d){return _0x22c68d;});}return null;};}function removeEntity(_0x3bbf3e,_0x56eb00){return function(_0x2f7400){if(_0x2f7400){return _0x2f7400[_0xbe3d('0x26')]()[_0xbe3d('0x25')](function(){_0x3bbf3e[_0xbe3d('0x1c')](0xcc)[_0xbe3d('0x27')]();});}};}function handleEntityNotFound(_0x1f749e,_0x748e70){return function(_0x3a66e2){if(!_0x3a66e2){_0x1f749e[_0xbe3d('0x28')](0x194);}return _0x3a66e2;};}function handleError(_0x286518,_0x3f5c8b){_0x3f5c8b=_0x3f5c8b||0x1f4;return function(_0x497d80){logger['error'](_0x497d80['stack']);if(_0x497d80[_0xbe3d('0x29')]){delete _0x497d80[_0xbe3d('0x29')];}_0x286518[_0xbe3d('0x1c')](_0x3f5c8b)[_0xbe3d('0x2a')](_0x497d80);};}exports['index']=function(_0x338119,_0x1b0c2a){var _0xe2503b={},_0x1d1c48={},_0x4a1eb5={'count':0x0,'rows':[]};var _0x3cf917=_[_0xbe3d('0x2b')](db[_0xbe3d('0x2c')][_0xbe3d('0x2d')],function(_0x2139e1){return{'name':_0x2139e1[_0xbe3d('0x2e')],'type':_0x2139e1[_0xbe3d('0x2f')][_0xbe3d('0x30')]};});_0x1d1c48[_0xbe3d('0x31')]=_['map'](_0x3cf917,_0xbe3d('0x29'));_0x1d1c48[_0xbe3d('0x32')]=_['keys'](_0x338119[_0xbe3d('0x32')]);_0x1d1c48[_0xbe3d('0x33')]=_[_0xbe3d('0x34')](_0x1d1c48[_0xbe3d('0x31')],_0x1d1c48['query']);_0xe2503b[_0xbe3d('0x35')]=_[_0xbe3d('0x34')](_0x1d1c48[_0xbe3d('0x31')],qs[_0xbe3d('0x36')](_0x338119[_0xbe3d('0x32')]['fields']));_0xe2503b['attributes']=_0xe2503b[_0xbe3d('0x35')][_0xbe3d('0x37')]?_0xe2503b['attributes']:_0x1d1c48['model'];if(!_0x338119[_0xbe3d('0x32')][_0xbe3d('0x38')]('nolimit')){_0xe2503b[_0xbe3d('0x20')]=qs[_0xbe3d('0x20')](_0x338119[_0xbe3d('0x32')][_0xbe3d('0x20')]);_0xe2503b[_0xbe3d('0x1d')]=qs[_0xbe3d('0x1d')](_0x338119[_0xbe3d('0x32')]['offset']);}_0xe2503b[_0xbe3d('0x39')]=qs[_0xbe3d('0x3a')](_0x338119[_0xbe3d('0x32')][_0xbe3d('0x3a')]);_0xe2503b[_0xbe3d('0x3b')]=qs[_0xbe3d('0x33')](_['pick'](_0x338119['query'],_0x1d1c48['filters']),_0x3cf917);if(_0x338119[_0xbe3d('0x32')]['filter']){_0xe2503b[_0xbe3d('0x3b')]=_[_0xbe3d('0x3c')](_0xe2503b[_0xbe3d('0x3b')],{'$or':_[_0xbe3d('0x2b')](_0x3cf917,function(_0x1b6ba5){if(_0x1b6ba5[_0xbe3d('0x2f')]!==_0xbe3d('0x3d')){var _0x57b90c={};_0x57b90c[_0x1b6ba5['name']]={'$like':'%'+_0x338119[_0xbe3d('0x32')][_0xbe3d('0x3e')]+'%'};return _0x57b90c;}})});}_0xe2503b=_[_0xbe3d('0x3c')]({},_0xe2503b,_0x338119[_0xbe3d('0x3f')]);var _0x122468={'where':_0xe2503b[_0xbe3d('0x3b')]};return db[_0xbe3d('0x2c')][_0xbe3d('0x1f')](_0x122468)[_0xbe3d('0x25')](function(_0x120706){_0x4a1eb5[_0xbe3d('0x1f')]=_0x120706;if(_0x338119['query']['includeAll']){_0xe2503b[_0xbe3d('0x40')]=[{'all':!![]}];}return db[_0xbe3d('0x2c')]['findAll'](_0xe2503b);})[_0xbe3d('0x25')](function(_0x4879d3){_0x4a1eb5[_0xbe3d('0x41')]=_0x4879d3;return _0x4a1eb5;})[_0xbe3d('0x25')](respondWithFilteredResult(_0x1b0c2a,_0xe2503b))['catch'](handleError(_0x1b0c2a,null));};exports['show']=function(_0x295d91,_0x5d9425){var _0x339b6b={'raw':!![],'where':{'id':_0x295d91['params']['id']}},_0x42e920={};_0x42e920[_0xbe3d('0x31')]=_[_0xbe3d('0x42')](db['MailTransferReport'][_0xbe3d('0x2d')]);_0x42e920[_0xbe3d('0x32')]=_[_0xbe3d('0x42')](_0x295d91[_0xbe3d('0x32')]);_0x42e920['filters']=_[_0xbe3d('0x34')](_0x42e920[_0xbe3d('0x31')],_0x42e920['query']);_0x339b6b['attributes']=_[_0xbe3d('0x34')](_0x42e920['model'],qs[_0xbe3d('0x36')](_0x295d91['query'][_0xbe3d('0x36')]));_0x339b6b['attributes']=_0x339b6b['attributes']['length']?_0x339b6b[_0xbe3d('0x35')]:_0x42e920[_0xbe3d('0x31')];if(_0x295d91[_0xbe3d('0x32')][_0xbe3d('0x43')]){_0x339b6b[_0xbe3d('0x40')]=[{'all':!![]}];}_0x339b6b=_[_0xbe3d('0x3c')]({},_0x339b6b,_0x295d91['options']);return db['MailTransferReport']['find'](_0x339b6b)['then'](handleEntityNotFound(_0x5d9425,null))[_0xbe3d('0x25')](respondWithResult(_0x5d9425,null))[_0xbe3d('0x44')](handleError(_0x5d9425,null));};exports[_0xbe3d('0x45')]=function(_0x5e2608,_0xce6f6c){return db[_0xbe3d('0x2c')][_0xbe3d('0x45')](_0x5e2608[_0xbe3d('0x46')],{})[_0xbe3d('0x25')](respondWithResult(_0xce6f6c,0xc9))['catch'](handleError(_0xce6f6c,null));};exports[_0xbe3d('0x47')]=function(_0x4deadd,_0x52a093){if(_0x4deadd[_0xbe3d('0x46')]['id']){delete _0x4deadd[_0xbe3d('0x46')]['id'];}return db[_0xbe3d('0x2c')][_0xbe3d('0x48')]({'where':{'id':_0x4deadd[_0xbe3d('0x49')]['id']}})[_0xbe3d('0x25')](handleEntityNotFound(_0x52a093,null))['then'](saveUpdates(_0x4deadd[_0xbe3d('0x46')],null))[_0xbe3d('0x25')](respondWithResult(_0x52a093,null))[_0xbe3d('0x44')](handleError(_0x52a093,null));};exports[_0xbe3d('0x26')]=function(_0x5d27ae,_0x50d801){return db[_0xbe3d('0x2c')][_0xbe3d('0x48')]({'where':{'id':_0x5d27ae[_0xbe3d('0x49')]['id']}})['then'](handleEntityNotFound(_0x50d801,null))['then'](removeEntity(_0x50d801,null))[_0xbe3d('0x44')](handleError(_0x50d801,null));};exports[_0xbe3d('0x4a')]=function(_0x4349af,_0x22ebea){return db[_0xbe3d('0x2c')][_0xbe3d('0x4a')]()['then'](respondWithResult(_0x22ebea,null))[_0xbe3d('0x44')](handleError(_0x22ebea,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index dea67e7..3fda8d5 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 _0x528f=['util','../../config/logger','api','moment','bluebird','path','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x1d7265,_0xa62261){var _0x209267=function(_0x5bfc98){while(--_0x5bfc98){_0x1d7265['push'](_0x1d7265['shift']());}};_0x209267(++_0xa62261);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf528('0x0'));var logger=require(_0xf528('0x1'))(_0xf528('0x2'));var moment=require(_0xf528('0x3'));var BPromise=require(_0xf528('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf528('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf528('0x6'));module['exports']=function(_0x2a4f5b,_0x17c8c8){return _0x2a4f5b['define'](_0xf528('0x7'),attributes,{'tableName':_0xf528('0x8'),'paranoid':![],'indexes':[{'name':_0xf528('0x9'),'fields':[_0xf528('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x897d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x897d,0x80));var _0xd897=function(_0x1d5299,_0x599477){_0x1d5299=_0x1d5299-0x0;var _0x3c6a79=_0x897d[_0x1d5299];return _0x3c6a79;};'use strict';var _=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var logger=require(_0xd897('0x2'))(_0xd897('0x3'));var moment=require(_0xd897('0x4'));var BPromise=require(_0xd897('0x5'));var rp=require(_0xd897('0x6'));var fs=require('fs');var path=require(_0xd897('0x7'));var rimraf=require(_0xd897('0x8'));var config=require(_0xd897('0x9'));var attributes=require(_0xd897('0xa'));module[_0xd897('0xb')]=function(_0x3e1cc5,_0x386bc2){return _0x3e1cc5[_0xd897('0xc')](_0xd897('0xd'),attributes,{'tableName':_0xd897('0xe'),'paranoid':![],'indexes':[{'name':_0xd897('0xf'),'fields':[_0xd897('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4bbdd0d..a260cd6 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 _0x8f95=['stringify','error','code','message','result','randomstring','../../mysqldb','../../config/utils','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'];(function(_0x520308,_0x262c4c){var _0x2305c7=function(_0x2fdc53){while(--_0x2fdc53){_0x520308['push'](_0x520308['shift']());}};_0x2305c7(++_0x262c4c);}(_0x8f95,0x11d));var _0x58f9=function(_0x3f81d9,_0x3fa571){_0x3f81d9=_0x3f81d9-0x0;var _0x293025=_0x8f95[_0x3f81d9];return _0x293025;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x58f9('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f9('0x1'))['db'];var utils=require(_0x58f9('0x2'));var logger=require('../../config/logger')(_0x58f9('0x3'));var config=require(_0x58f9('0x4'));var jayson=require(_0x58f9('0x5'));var client=jayson[_0x58f9('0x6')][_0x58f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c7bce,_0x412e17,_0x56810c){return new BPromise(function(_0x18fbdd,_0x50d1b4){return client[_0x58f9('0x8')](_0x2c7bce,_0x56810c)[_0x58f9('0x9')](function(_0x2cbbf4){logger[_0x58f9('0xa')](_0x58f9('0xb'),_0x412e17,_0x58f9('0xc'));logger[_0x58f9('0xd')](_0x58f9('0xe'),_0x412e17,_0x58f9('0xc'),JSON[_0x58f9('0xf')](_0x2cbbf4));if(_0x2cbbf4[_0x58f9('0x10')]){if(_0x2cbbf4[_0x58f9('0x10')][_0x58f9('0x11')]===0x1f4){logger[_0x58f9('0x10')](_0x58f9('0xb'),_0x412e17,_0x2cbbf4[_0x58f9('0x10')][_0x58f9('0x12')]);return _0x50d1b4(_0x2cbbf4['error'][_0x58f9('0x12')]);}logger[_0x58f9('0x10')](_0x58f9('0xb'),_0x412e17,_0x2cbbf4[_0x58f9('0x10')][_0x58f9('0x12')]);return _0x18fbdd(_0x2cbbf4[_0x58f9('0x10')]['message']);}else{logger[_0x58f9('0xa')](_0x58f9('0xb'),_0x412e17,_0x58f9('0xc'));_0x18fbdd(_0x2cbbf4[_0x58f9('0x13')]['message']);}})['catch'](function(_0x587312){logger[_0x58f9('0x10')](_0x58f9('0xb'),_0x412e17,_0x587312);_0x50d1b4(_0x587312);});});} \ No newline at end of file +var _0x01cf=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util'];(function(_0x544016,_0x3537de){var _0x4ed00f=function(_0x5f2ce8){while(--_0x5f2ce8){_0x544016['push'](_0x544016['shift']());}};_0x4ed00f(++_0x3537de);}(_0x01cf,0x10f));var _0xf01c=function(_0x28ad28,_0x9b4b65){_0x28ad28=_0x28ad28-0x0;var _0x9197cb=_0x01cf[_0x28ad28];return _0x9197cb;};'use strict';var _=require(_0xf01c('0x0'));var util=require(_0xf01c('0x1'));var moment=require(_0xf01c('0x2'));var BPromise=require(_0xf01c('0x3'));var rs=require(_0xf01c('0x4'));var fs=require('fs');var Redis=require(_0xf01c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf01c('0x6'))(_0xf01c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf01c('0x8'));var client=jayson[_0xf01c('0x9')][_0xf01c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x373ae2,_0x458ce5,_0xe9f20b){return new BPromise(function(_0x1dcd6e,_0x4cab90){return client[_0xf01c('0xb')](_0x373ae2,_0xe9f20b)[_0xf01c('0xc')](function(_0x3fd957){logger['info'](_0xf01c('0xd'),_0x458ce5,_0xf01c('0xe'));logger['debug'](_0xf01c('0xf'),_0x458ce5,_0xf01c('0xe'),JSON[_0xf01c('0x10')](_0x3fd957));if(_0x3fd957['error']){if(_0x3fd957[_0xf01c('0x11')]['code']===0x1f4){logger[_0xf01c('0x11')](_0xf01c('0xd'),_0x458ce5,_0x3fd957[_0xf01c('0x11')][_0xf01c('0x12')]);return _0x4cab90(_0x3fd957[_0xf01c('0x11')][_0xf01c('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x458ce5,_0x3fd957['error'][_0xf01c('0x12')]);return _0x1dcd6e(_0x3fd957[_0xf01c('0x11')][_0xf01c('0x12')]);}else{logger[_0xf01c('0x13')](_0xf01c('0xd'),_0x458ce5,_0xf01c('0xe'));_0x1dcd6e(_0x3fd957[_0xf01c('0x14')][_0xf01c('0x12')]);}})['catch'](function(_0x2046a5){logger[_0xf01c('0x11')](_0xf01c('0xd'),_0x458ce5,_0x2046a5);_0x4cab90(_0x2046a5);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 41f5e26..3445373 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 _0xf649=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0xcc468c,_0x469dfb){var _0xcf785f=function(_0x10bc26){while(--_0x10bc26){_0xcc468c['push'](_0xcc468c['shift']());}};_0xcf785f(++_0x469dfb);}(_0xf649,0xba));var _0x9f64=function(_0x5090f,_0x5abf30){_0x5090f=_0x5090f-0x0;var _0x3b657a=_0xf649[_0x5090f];return _0x3b657a;};'use strict';var multer=require(_0x9f64('0x0'));var util=require(_0x9f64('0x1'));var path=require(_0x9f64('0x2'));var timeout=require(_0x9f64('0x3'));var express=require(_0x9f64('0x4'));var router=express[_0x9f64('0x5')]();var fs_extra=require(_0x9f64('0x6'));var auth=require(_0x9f64('0x7'));var interaction=require(_0x9f64('0x8'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x9f64('0x9')]('/',auth[_0x9f64('0xa')](),controller[_0x9f64('0xb')]);router[_0x9f64('0x9')](_0x9f64('0xc'),auth[_0x9f64('0xa')](),controller[_0x9f64('0xd')]);router[_0x9f64('0x9')](_0x9f64('0xe'),auth[_0x9f64('0xa')](),controller[_0x9f64('0xf')]);router[_0x9f64('0x10')]('/',auth[_0x9f64('0xa')](),controller['create']);router[_0x9f64('0x11')](_0x9f64('0xe'),auth[_0x9f64('0xa')](),controller[_0x9f64('0x12')]);router['delete'](_0x9f64('0xe'),auth[_0x9f64('0xa')](),controller[_0x9f64('0x13')]);module[_0x9f64('0x14')]=router; \ No newline at end of file +var _0x916f=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','destroy','exports'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0x916f,0x17c));var _0xf916=function(_0x4b45ea,_0x3463b4){_0x4b45ea=_0x4b45ea-0x0;var _0x1bf6f3=_0x916f[_0x4b45ea];return _0x1bf6f3;};'use strict';var multer=require(_0xf916('0x0'));var util=require('util');var path=require(_0xf916('0x1'));var timeout=require(_0xf916('0x2'));var express=require('express');var router=express[_0xf916('0x3')]();var fs_extra=require(_0xf916('0x4'));var auth=require(_0xf916('0x5'));var interaction=require(_0xf916('0x6'));var config=require('../../config/environment');var controller=require(_0xf916('0x7'));router['get']('/',auth[_0xf916('0x8')](),controller[_0xf916('0x9')]);router[_0xf916('0xa')](_0xf916('0xb'),auth[_0xf916('0x8')](),controller[_0xf916('0xc')]);router[_0xf916('0xa')](_0xf916('0xd'),auth[_0xf916('0x8')](),controller[_0xf916('0xe')]);router[_0xf916('0xf')]('/',auth[_0xf916('0x8')](),controller['create']);router[_0xf916('0x10')]('/:id',auth[_0xf916('0x8')](),controller['update']);router['delete'](_0xf916('0xd'),auth[_0xf916('0x8')](),controller[_0xf916('0x11')]);module[_0xf916('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 044e14a..9e8eb35 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 _0x0ffd=['getDataValue','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4ea932,_0x33eccf){var _0x31de3c=function(_0x20623a){while(--_0x20623a){_0x4ea932['push'](_0x4ea932['shift']());}};_0x31de3c(++_0x33eccf);}(_0x0ffd,0x129));var _0xd0ff=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x0ffd[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd0ff('0x0'));module[_0xd0ff('0x1')]={'channel':{'type':Sequelize[_0xd0ff('0x2')]},'membername':{'type':Sequelize[_0xd0ff('0x2')]},'interface':{'type':Sequelize[_0xd0ff('0x2')]},'type':{'type':Sequelize[_0xd0ff('0x2')],'defaultValue':_0xd0ff('0x3'),'comment':_0xd0ff('0x4')},'duration':{'type':Sequelize[_0xd0ff('0x5')]},'enterAt':{'type':Sequelize[_0xd0ff('0x6')]},'exitAt':{'type':Sequelize[_0xd0ff('0x6')],'set':function(_0x2317ad){var _0x21a490=moment(_0x2317ad);var _0x170890=moment(this[_0xd0ff('0x7')](_0xd0ff('0x8')));var _0x4aea6e=_0x21a490[_0xd0ff('0x9')](_0x170890,_0xd0ff('0xa'));this['setDataValue']('exitAt',_0x2317ad);this[_0xd0ff('0xb')]('duration',_0x4aea6e>=0x0?_0x4aea6e:null);}},'data1':{'type':Sequelize[_0xd0ff('0x2')],'comment':_0xd0ff('0xc')},'data2':{'type':Sequelize[_0xd0ff('0x2')],'comment':_0xd0ff('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xd0ff('0xe')},'data4':{'type':Sequelize[_0xd0ff('0x2')],'comment':_0xd0ff('0xf')},'data5':{'type':Sequelize[_0xd0ff('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xd0ff('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xd0ff('0x2')]}}; \ No newline at end of file +var _0x823c=['enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x823c,0x16f));var _0xc823=function(_0x4f0932,_0x191aa7){_0x4f0932=_0x4f0932-0x0;var _0x5d8b47=_0x823c[_0x4f0932];return _0x5d8b47;};'use strict';var Sequelize=require(_0xc823('0x0'));var moment=require(_0xc823('0x1'));module[_0xc823('0x2')]={'channel':{'type':Sequelize[_0xc823('0x3')]},'membername':{'type':Sequelize[_0xc823('0x3')]},'interface':{'type':Sequelize[_0xc823('0x3')]},'type':{'type':Sequelize[_0xc823('0x3')],'defaultValue':_0xc823('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xc823('0x5')]},'enterAt':{'type':Sequelize[_0xc823('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x522f73){var _0x119d71=moment(_0x522f73);var _0x21678d=moment(this['getDataValue'](_0xc823('0x7')));var _0x3b38d5=_0x119d71[_0xc823('0x8')](_0x21678d,_0xc823('0x9'));this[_0xc823('0xa')]('exitAt',_0x522f73);this[_0xc823('0xa')](_0xc823('0xb'),_0x3b38d5>=0x0?_0x3b38d5:null);}},'data1':{'type':Sequelize[_0xc823('0x3')],'comment':_0xc823('0xc')},'data2':{'type':Sequelize[_0xc823('0x3')],'comment':_0xc823('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xc823('0xe')},'data4':{'type':Sequelize[_0xc823('0x3')],'comment':_0xc823('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xc823('0x10')},'role':{'type':Sequelize[_0xc823('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc823('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8051696..4669266 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xedd9,0xfc));var _0x9edd=function(_0xb6e9c7,_0x14898e){_0xb6e9c7=_0xb6e9c7-0x0;var _0x42d031=_0xedd9[_0xb6e9c7];return _0x42d031;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x3f2df0,_0x225067){var _0xe1f8bd=function(_0x38cc04){while(--_0x38cc04){_0x3f2df0['push'](_0x3f2df0['shift']());}};_0xe1f8bd(++_0x225067);}(_0x7217,0x19e));var _0x7721=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7217[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index b35aa75..a10d1a1 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 _0x6c79=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface'];(function(_0x494c24,_0x4918c2){var _0x3a52f0=function(_0x2c78e2){while(--_0x2c78e2){_0x494c24['push'](_0x494c24['shift']());}};_0x3a52f0(++_0x4918c2);}(_0x6c79,0x1d1));var _0x96c7=function(_0x546074,_0x2633ed){_0x546074=_0x546074-0x0;var _0xc39c10=_0x6c79[_0x546074];return _0xc39c10;};'use strict';var _=require(_0x96c7('0x0'));var util=require(_0x96c7('0x1'));var logger=require(_0x96c7('0x2'))(_0x96c7('0x3'));var moment=require(_0x96c7('0x4'));var BPromise=require(_0x96c7('0x5'));var rp=require(_0x96c7('0x6'));var fs=require('fs');var path=require(_0x96c7('0x7'));var rimraf=require('rimraf');var config=require(_0x96c7('0x8'));var attributes=require(_0x96c7('0x9'));module[_0x96c7('0xa')]=function(_0x205875,_0x2fea1e){return _0x205875['define'](_0x96c7('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x96c7('0xc'),'fields':[_0x96c7('0xd'),_0x96c7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc06=['request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc06,0x6a));var _0x6fc0=function(_0x21ef09,_0x1ab6c2){_0x21ef09=_0x21ef09-0x0;var _0x506fe6=_0xfc06[_0x21ef09];return _0x506fe6;};'use strict';var _=require(_0x6fc0('0x0'));var util=require(_0x6fc0('0x1'));var logger=require(_0x6fc0('0x2'))(_0x6fc0('0x3'));var moment=require(_0x6fc0('0x4'));var BPromise=require(_0x6fc0('0x5'));var rp=require(_0x6fc0('0x6'));var fs=require('fs');var path=require(_0x6fc0('0x7'));var rimraf=require(_0x6fc0('0x8'));var config=require(_0x6fc0('0x9'));var attributes=require(_0x6fc0('0xa'));module[_0x6fc0('0xb')]=function(_0x9dc4bd,_0x462896){return _0x9dc4bd[_0x6fc0('0xc')](_0x6fc0('0xd'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6fc0('0xe'),'fields':[_0x6fc0('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 807581f..64a037e 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 _0xc9b0=['result','GetMemberReport','findAll','options','raw','where','attributes','include','map','model','catch','CreateMemberReport','create','body','then','UpdateMemberReport','MemberReport','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc9b0,0x143));var _0x0c9b=function(_0x4a70ae,_0x8dfcbb){_0x4a70ae=_0x4a70ae-0x0;var _0x16b7cb=_0xc9b0[_0x4a70ae];return _0x16b7cb;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var moment=require(_0x0c9b('0x2'));var BPromise=require(_0x0c9b('0x3'));var rs=require(_0x0c9b('0x4'));var fs=require('fs');var Redis=require(_0x0c9b('0x5'));var db=require(_0x0c9b('0x6'))['db'];var utils=require(_0x0c9b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c9b('0x8'));var jayson=require(_0x0c9b('0x9'));var client=jayson[_0x0c9b('0xa')][_0x0c9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd53c,_0x16779e,_0x363958){return new BPromise(function(_0x44bcd5,_0x170820){return client['request'](_0x1bd53c,_0x363958)['then'](function(_0x4e4a0d){logger[_0x0c9b('0xc')](_0x0c9b('0xd'),_0x16779e,_0x0c9b('0xe'));logger[_0x0c9b('0xf')](_0x0c9b('0x10'),_0x16779e,_0x0c9b('0xe'),JSON['stringify'](_0x4e4a0d));if(_0x4e4a0d[_0x0c9b('0x11')]){if(_0x4e4a0d[_0x0c9b('0x11')]['code']===0x1f4){logger[_0x0c9b('0x11')]('MemberReport,\x20%s,\x20%s',_0x16779e,_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);return _0x170820(_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);}logger[_0x0c9b('0x11')](_0x0c9b('0xd'),_0x16779e,_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);return _0x44bcd5(_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x16779e,'request\x20sent');_0x44bcd5(_0x4e4a0d[_0x0c9b('0x13')][_0x0c9b('0x12')]);}})['catch'](function(_0xa7bda1){logger[_0x0c9b('0x11')](_0x0c9b('0xd'),_0x16779e,_0xa7bda1);_0x170820(_0xa7bda1);});});}exports[_0x0c9b('0x14')]=function(_0x2b2f65){var _0x4619b3=this;return new Promise(function(_0x39218d,_0x4bd2d8){return db['MemberReport'][_0x0c9b('0x15')]({'raw':_0x2b2f65['options']?_0x2b2f65[_0x0c9b('0x16')][_0x0c9b('0x17')]===undefined?!![]:![]:!![],'where':_0x2b2f65[_0x0c9b('0x16')]?_0x2b2f65[_0x0c9b('0x16')][_0x0c9b('0x18')]||null:null,'attributes':_0x2b2f65[_0x0c9b('0x16')]?_0x2b2f65[_0x0c9b('0x16')][_0x0c9b('0x19')]||null:null,'limit':_0x2b2f65[_0x0c9b('0x16')]?_0x2b2f65[_0x0c9b('0x16')]['limit']||null:null,'include':_0x2b2f65[_0x0c9b('0x16')]?_0x2b2f65[_0x0c9b('0x16')][_0x0c9b('0x1a')]?_['map'](_0x2b2f65[_0x0c9b('0x16')][_0x0c9b('0x1a')],function(_0x2409c6){return{'model':db[_0x2409c6['model']],'as':_0x2409c6['as'],'attributes':_0x2409c6[_0x0c9b('0x19')],'include':_0x2409c6['include']?_[_0x0c9b('0x1b')](_0x2409c6[_0x0c9b('0x1a')],function(_0x2d1ce5){return{'model':db[_0x2d1ce5[_0x0c9b('0x1c')]],'as':_0x2d1ce5['as'],'attributes':_0x2d1ce5[_0x0c9b('0x19')],'include':_0x2d1ce5[_0x0c9b('0x1a')]?_[_0x0c9b('0x1b')](_0x2d1ce5[_0x0c9b('0x1a')],function(_0x476c59){return{'model':db[_0x476c59[_0x0c9b('0x1c')]],'as':_0x476c59['as'],'attributes':_0x476c59[_0x0c9b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x594710){logger[_0x0c9b('0xc')](_0x0c9b('0x14'),_0x2b2f65);logger[_0x0c9b('0xf')](_0x0c9b('0x14'),_0x2b2f65,JSON['stringify'](_0x594710));_0x39218d(_0x594710);})[_0x0c9b('0x1d')](function(_0x1391d1){logger['error'](_0x0c9b('0x14'),_0x1391d1[_0x0c9b('0x12')],_0x2b2f65);_0x4bd2d8(_0x4619b3[_0x0c9b('0x11')](0x1f4,_0x1391d1[_0x0c9b('0x12')]));});});};exports[_0x0c9b('0x1e')]=function(_0x30027c){var _0x523fad=this;return new Promise(function(_0x2eeea7,_0x125c55){return db['MemberReport'][_0x0c9b('0x1f')](_0x30027c[_0x0c9b('0x20')],{'raw':_0x30027c[_0x0c9b('0x16')]?_0x30027c[_0x0c9b('0x16')][_0x0c9b('0x17')]===undefined?!![]:![]:!![]})[_0x0c9b('0x21')](function(_0x21a348){logger[_0x0c9b('0xc')](_0x0c9b('0x1e'),_0x30027c);logger[_0x0c9b('0xf')](_0x0c9b('0x1e'),_0x30027c,JSON['stringify'](_0x21a348));_0x2eeea7(_0x21a348);})['catch'](function(_0x9629be){logger[_0x0c9b('0x11')](_0x0c9b('0x1e'),_0x9629be[_0x0c9b('0x12')],_0x30027c);_0x125c55(_0x523fad[_0x0c9b('0x11')](0x1f4,_0x9629be[_0x0c9b('0x12')]));});});};exports[_0x0c9b('0x22')]=function(_0x265fae){var _0x414fda=this;return new Promise(function(_0xe8e702,_0x535ab7){return db[_0x0c9b('0x23')]['update'](_0x265fae[_0x0c9b('0x20')],{'raw':_0x265fae[_0x0c9b('0x16')]?_0x265fae[_0x0c9b('0x16')][_0x0c9b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x265fae[_0x0c9b('0x16')]?_0x265fae['options'][_0x0c9b('0x18')]||null:null,'attributes':_0x265fae['options']?_0x265fae['options'][_0x0c9b('0x19')]||null:null,'limit':_0x265fae['options']?_0x265fae[_0x0c9b('0x16')][_0x0c9b('0x24')]||null:null})[_0x0c9b('0x21')](function(_0x3df8b5){logger[_0x0c9b('0xc')](_0x0c9b('0x22'),_0x265fae);logger[_0x0c9b('0xf')](_0x0c9b('0x22'),_0x265fae,JSON[_0x0c9b('0x25')](_0x3df8b5));_0xe8e702(_0x3df8b5);})[_0x0c9b('0x1d')](function(_0x2514f6){logger[_0x0c9b('0x11')]('UpdateMemberReport',_0x2514f6[_0x0c9b('0x12')],_0x265fae);_0x535ab7(_0x414fda[_0x0c9b('0x11')](0x1f4,_0x2514f6[_0x0c9b('0x12')]));});});}; \ No newline at end of file +var _0x87f1=['error','code','message','catch','MemberReport','options','raw','attributes','limit','include','map','model','debug','GetMemberReport','CreateMemberReport','body','update','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x213b03,_0x3855cb){var _0x3767f8=function(_0x208237){while(--_0x208237){_0x213b03['push'](_0x213b03['shift']());}};_0x3767f8(++_0x3855cb);}(_0x87f1,0x170));var _0x187f=function(_0x37b327,_0x47b877){_0x37b327=_0x37b327-0x0;var _0x184e2f=_0x87f1[_0x37b327];return _0x184e2f;};'use strict';var _=require('lodash');var util=require(_0x187f('0x0'));var moment=require(_0x187f('0x1'));var BPromise=require(_0x187f('0x2'));var rs=require(_0x187f('0x3'));var fs=require('fs');var Redis=require(_0x187f('0x4'));var db=require(_0x187f('0x5'))['db'];var utils=require(_0x187f('0x6'));var logger=require('../../config/logger')(_0x187f('0x7'));var config=require('../../config/environment');var jayson=require(_0x187f('0x8'));var client=jayson['client'][_0x187f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58ab4a,_0x135f20,_0x349f6e){return new BPromise(function(_0xb61ae,_0x2e3158){return client[_0x187f('0xa')](_0x58ab4a,_0x349f6e)[_0x187f('0xb')](function(_0x570b6e){logger[_0x187f('0xc')](_0x187f('0xd'),_0x135f20,'request\x20sent');logger['debug'](_0x187f('0xe'),_0x135f20,_0x187f('0xf'),JSON[_0x187f('0x10')](_0x570b6e));if(_0x570b6e[_0x187f('0x11')]){if(_0x570b6e[_0x187f('0x11')][_0x187f('0x12')]===0x1f4){logger[_0x187f('0x11')](_0x187f('0xd'),_0x135f20,_0x570b6e[_0x187f('0x11')][_0x187f('0x13')]);return _0x2e3158(_0x570b6e['error']['message']);}logger[_0x187f('0x11')](_0x187f('0xd'),_0x135f20,_0x570b6e[_0x187f('0x11')][_0x187f('0x13')]);return _0xb61ae(_0x570b6e[_0x187f('0x11')][_0x187f('0x13')]);}else{logger[_0x187f('0xc')]('MemberReport,\x20%s,\x20%s',_0x135f20,_0x187f('0xf'));_0xb61ae(_0x570b6e['result']['message']);}})[_0x187f('0x14')](function(_0x1d7014){logger['error'](_0x187f('0xd'),_0x135f20,_0x1d7014);_0x2e3158(_0x1d7014);});});}exports['GetMemberReport']=function(_0x50e6cc){var _0x1666dc=this;return new Promise(function(_0x195931,_0x24849c){return db[_0x187f('0x15')]['findAll']({'raw':_0x50e6cc['options']?_0x50e6cc[_0x187f('0x16')][_0x187f('0x17')]===undefined?!![]:![]:!![],'where':_0x50e6cc[_0x187f('0x16')]?_0x50e6cc['options']['where']||null:null,'attributes':_0x50e6cc['options']?_0x50e6cc[_0x187f('0x16')][_0x187f('0x18')]||null:null,'limit':_0x50e6cc['options']?_0x50e6cc[_0x187f('0x16')][_0x187f('0x19')]||null:null,'include':_0x50e6cc[_0x187f('0x16')]?_0x50e6cc['options'][_0x187f('0x1a')]?_['map'](_0x50e6cc[_0x187f('0x16')][_0x187f('0x1a')],function(_0x2a8299){return{'model':db[_0x2a8299['model']],'as':_0x2a8299['as'],'attributes':_0x2a8299[_0x187f('0x18')],'include':_0x2a8299[_0x187f('0x1a')]?_[_0x187f('0x1b')](_0x2a8299[_0x187f('0x1a')],function(_0x2b0e76){return{'model':db[_0x2b0e76['model']],'as':_0x2b0e76['as'],'attributes':_0x2b0e76['attributes'],'include':_0x2b0e76[_0x187f('0x1a')]?_[_0x187f('0x1b')](_0x2b0e76[_0x187f('0x1a')],function(_0x372080){return{'model':db[_0x372080[_0x187f('0x1c')]],'as':_0x372080['as'],'attributes':_0x372080[_0x187f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x187f('0xb')](function(_0x32378d){logger[_0x187f('0xc')]('GetMemberReport',_0x50e6cc);logger[_0x187f('0x1d')](_0x187f('0x1e'),_0x50e6cc,JSON['stringify'](_0x32378d));_0x195931(_0x32378d);})[_0x187f('0x14')](function(_0x3c00dd){logger[_0x187f('0x11')](_0x187f('0x1e'),_0x3c00dd[_0x187f('0x13')],_0x50e6cc);_0x24849c(_0x1666dc['error'](0x1f4,_0x3c00dd[_0x187f('0x13')]));});});};exports[_0x187f('0x1f')]=function(_0x4943ed){var _0x1feac4=this;return new Promise(function(_0x3b48e9,_0x38283f){return db['MemberReport']['create'](_0x4943ed[_0x187f('0x20')],{'raw':_0x4943ed[_0x187f('0x16')]?_0x4943ed['options']['raw']===undefined?!![]:![]:!![]})[_0x187f('0xb')](function(_0x18d64c){logger[_0x187f('0xc')](_0x187f('0x1f'),_0x4943ed);logger[_0x187f('0x1d')](_0x187f('0x1f'),_0x4943ed,JSON[_0x187f('0x10')](_0x18d64c));_0x3b48e9(_0x18d64c);})[_0x187f('0x14')](function(_0x65ffab){logger[_0x187f('0x11')](_0x187f('0x1f'),_0x65ffab[_0x187f('0x13')],_0x4943ed);_0x38283f(_0x1feac4[_0x187f('0x11')](0x1f4,_0x65ffab[_0x187f('0x13')]));});});};exports['UpdateMemberReport']=function(_0x4f0b0b){var _0x13729c=this;return new Promise(function(_0x166fe2,_0x3b7878){return db[_0x187f('0x15')][_0x187f('0x21')](_0x4f0b0b[_0x187f('0x20')],{'raw':_0x4f0b0b[_0x187f('0x16')]?_0x4f0b0b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0b0b[_0x187f('0x16')]?_0x4f0b0b[_0x187f('0x16')]['where']||null:null,'attributes':_0x4f0b0b[_0x187f('0x16')]?_0x4f0b0b[_0x187f('0x16')]['attributes']||null:null,'limit':_0x4f0b0b[_0x187f('0x16')]?_0x4f0b0b[_0x187f('0x16')][_0x187f('0x19')]||null:null})[_0x187f('0xb')](function(_0x416805){logger[_0x187f('0xc')](_0x187f('0x22'),_0x4f0b0b);logger['debug'](_0x187f('0x22'),_0x4f0b0b,JSON[_0x187f('0x10')](_0x416805));_0x166fe2(_0x416805);})[_0x187f('0x14')](function(_0x48af52){logger[_0x187f('0x11')](_0x187f('0x22'),_0x48af52[_0x187f('0x13')],_0x4f0b0b);_0x3b7878(_0x13729c[_0x187f('0x11')](0x1f4,_0x48af52['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d181b9d..b581b0b 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 _0xe407=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','multer','util'];(function(_0x500938,_0x6852ec){var _0x577c5e=function(_0x445e75){while(--_0x445e75){_0x500938['push'](_0x500938['shift']());}};_0x577c5e(++_0x6852ec);}(_0xe407,0x181));var _0x7e40=function(_0x2a0bec,_0x1cab51){_0x2a0bec=_0x2a0bec-0x0;var _0xe48b0e=_0xe407[_0x2a0bec];return _0xe48b0e;};'use strict';var multer=require(_0x7e40('0x0'));var util=require(_0x7e40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e40('0x2'));var router=express[_0x7e40('0x3')]();var fs_extra=require(_0x7e40('0x4'));var auth=require(_0x7e40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e40('0x6'));var controller=require(_0x7e40('0x7'));router['get']('/',controller[_0x7e40('0x8')]);module['exports']=router; \ No newline at end of file +var _0xb957=['index','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x5efeed,_0x166b27){var _0x41517b=function(_0x201fb1){while(--_0x201fb1){_0x5efeed['push'](_0x5efeed['shift']());}};_0x41517b(++_0x166b27);}(_0xb957,0x6d));var _0x7b95=function(_0x27840a,_0x443f63){_0x27840a=_0x27840a-0x0;var _0x330726=_0xb957[_0x27840a];return _0x330726;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b95('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b95('0x1'));var router=express[_0x7b95('0x2')]();var fs_extra=require(_0x7b95('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var controller=require(_0x7b95('0x6'));router[_0x7b95('0x7')]('/',controller[_0x7b95('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 01c675f..ac9a8c6 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 _0x5092=['version','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5092,0xa9));var _0x2509=function(_0x37a543,_0x36382d){_0x37a543=_0x37a543-0x0;var _0x33915c=_0x5092[_0x37a543];return _0x33915c;};'use strict';var Sequelize=require('sequelize');module[_0x2509('0x0')]={'version':{'type':Sequelize[_0x2509('0x1')],'unique':_0x2509('0x2')}}; \ No newline at end of file +var _0xe87f=['sequelize','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe87f,0xa0));var _0xfe87=function(_0x391130,_0x386612){_0x391130=_0x391130-0x0;var _0x8ab627=_0xe87f[_0x391130];return _0x8ab627;};'use strict';var Sequelize=require(_0xfe87('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xfe87('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7db319f..72e517e 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 _0x9255=['then','destroy','stack','name','send','index','map','Migration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x9255,0x19c));var _0x5925=function(_0xd3c515,_0x27b9bf){_0xd3c515=_0xd3c515-0x0;var _0x526fac=_0x9255[_0xd3c515];return _0x526fac;};'use strict';var emlformat=require(_0x5925('0x0'));var rimraf=require(_0x5925('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5925('0x2'));var rp=require(_0x5925('0x3'));var moment=require(_0x5925('0x4'));var BPromise=require(_0x5925('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5925('0x6'));var csv=require(_0x5925('0x7'));var ejs=require(_0x5925('0x8'));var fs=require('fs');var fs_extra=require(_0x5925('0x9'));var _=require(_0x5925('0xa'));var squel=require(_0x5925('0xb'));var crypto=require(_0x5925('0xc'));var jsforce=require(_0x5925('0xd'));var deskjs=require(_0x5925('0xe'));var toCsv=require(_0x5925('0x7'));var querystring=require(_0x5925('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5925('0x10'));var qs=require(_0x5925('0x11'));var as=require(_0x5925('0x12'));var hardwareService=require(_0x5925('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5925('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5925('0x15'));var db=require(_0x5925('0x16'))['db'];function respondWithStatusCode(_0x22ac93,_0x45012d){_0x45012d=_0x45012d||0xcc;return function(_0x1a1eea){if(_0x1a1eea){return _0x22ac93[_0x5925('0x17')](_0x45012d);}return _0x22ac93[_0x5925('0x18')](_0x45012d)[_0x5925('0x19')]();};}function respondWithResult(_0x23a073,_0x2de46b){_0x2de46b=_0x2de46b||0xc8;return function(_0x23ea54){if(_0x23ea54){return _0x23a073['status'](_0x2de46b)[_0x5925('0x1a')](_0x23ea54);}};}function respondWithFilteredResult(_0x8cb148,_0x3f44a1){return function(_0x307c4a){if(_0x307c4a){var _0x26a5c1=typeof _0x3f44a1[_0x5925('0x1b')]===_0x5925('0x1c')&&typeof _0x3f44a1[_0x5925('0x1d')]===_0x5925('0x1c');var _0x1e13e6=_0x307c4a['count'];var _0x9e8d18=_0x26a5c1?0x0:_0x3f44a1[_0x5925('0x1b')];var _0xd75951=_0x26a5c1?_0x307c4a[_0x5925('0x1e')]:_0x3f44a1['offset']+_0x3f44a1[_0x5925('0x1d')];var _0x222d70;if(_0xd75951>=_0x1e13e6){_0xd75951=_0x1e13e6;_0x222d70=0xc8;}else{_0x222d70=0xce;}_0x8cb148[_0x5925('0x18')](_0x222d70);return _0x8cb148[_0x5925('0x1f')](_0x5925('0x20'),_0x9e8d18+'-'+_0xd75951+'/'+_0x1e13e6)[_0x5925('0x1a')](_0x307c4a);}return null;};}function patchUpdates(_0x2db740){return function(_0x1482c5){try{jsonpatch[_0x5925('0x21')](_0x1482c5,_0x2db740,!![]);}catch(_0x3f1271){return BPromise['reject'](_0x3f1271);}return _0x1482c5[_0x5925('0x22')]();};}function saveUpdates(_0x2bc197,_0x3477e2){return function(_0x5c2a50){if(_0x5c2a50){return _0x5c2a50[_0x5925('0x23')](_0x2bc197)[_0x5925('0x24')](function(_0x545b12){return _0x545b12;});}return null;};}function removeEntity(_0x587ae6,_0x39d9e4){return function(_0x3e0de2){if(_0x3e0de2){return _0x3e0de2[_0x5925('0x25')]()['then'](function(){_0x587ae6[_0x5925('0x18')](0xcc)[_0x5925('0x19')]();});}};}function handleEntityNotFound(_0x3d8245,_0x501147){return function(_0x57c570){if(!_0x57c570){_0x3d8245[_0x5925('0x17')](0x194);}return _0x57c570;};}function handleError(_0x2f685d,_0x3b881c){_0x3b881c=_0x3b881c||0x1f4;return function(_0x4b0f96){logger['error'](_0x4b0f96[_0x5925('0x26')]);if(_0x4b0f96[_0x5925('0x27')]){delete _0x4b0f96['name'];}_0x2f685d[_0x5925('0x18')](_0x3b881c)[_0x5925('0x28')](_0x4b0f96);};}exports[_0x5925('0x29')]=function(_0x3f8a29,_0x1d842d){var _0x963021={},_0x42a721={},_0x5b8f57={'count':0x0,'rows':[]};var _0x9afe09=_[_0x5925('0x2a')](db[_0x5925('0x2b')][_0x5925('0x2c')],function(_0x4f95ee){return{'name':_0x4f95ee['fieldName'],'type':_0x4f95ee[_0x5925('0x2d')][_0x5925('0x2e')]};});_0x42a721['model']=_[_0x5925('0x2a')](_0x9afe09,_0x5925('0x27'));_0x42a721[_0x5925('0x2f')]=_[_0x5925('0x30')](_0x3f8a29[_0x5925('0x2f')]);_0x42a721[_0x5925('0x31')]=_[_0x5925('0x32')](_0x42a721[_0x5925('0x33')],_0x42a721[_0x5925('0x2f')]);_0x963021[_0x5925('0x34')]=_[_0x5925('0x32')](_0x42a721[_0x5925('0x33')],qs[_0x5925('0x35')](_0x3f8a29[_0x5925('0x2f')][_0x5925('0x35')]));_0x963021[_0x5925('0x34')]=_0x963021[_0x5925('0x34')][_0x5925('0x36')]?_0x963021['attributes']:_0x42a721[_0x5925('0x33')];if(!_0x3f8a29['query']['hasOwnProperty']('nolimit')){_0x963021[_0x5925('0x1d')]=qs['limit'](_0x3f8a29['query'][_0x5925('0x1d')]);_0x963021[_0x5925('0x1b')]=qs[_0x5925('0x1b')](_0x3f8a29[_0x5925('0x2f')]['offset']);}_0x963021['order']=qs[_0x5925('0x37')](_0x3f8a29[_0x5925('0x2f')][_0x5925('0x37')]);_0x963021['where']=qs['filters'](_['pick'](_0x3f8a29[_0x5925('0x2f')],_0x42a721[_0x5925('0x31')]),_0x9afe09);if(_0x3f8a29[_0x5925('0x2f')]['filter']){_0x963021[_0x5925('0x38')]=_[_0x5925('0x39')](_0x963021[_0x5925('0x38')],{'$or':_[_0x5925('0x2a')](_0x9afe09,function(_0x31ef3d){if(_0x31ef3d[_0x5925('0x2d')]!==_0x5925('0x3a')){var _0x4c5330={};_0x4c5330[_0x31ef3d[_0x5925('0x27')]]={'$like':'%'+_0x3f8a29['query']['filter']+'%'};return _0x4c5330;}})});}_0x963021=_['merge']({},_0x963021,_0x3f8a29[_0x5925('0x3b')]);var _0x5e53dd={'where':_0x963021[_0x5925('0x38')]};return db['Migration'][_0x5925('0x1e')](_0x5e53dd)[_0x5925('0x24')](function(_0x504835){_0x5b8f57[_0x5925('0x1e')]=_0x504835;if(_0x3f8a29[_0x5925('0x2f')][_0x5925('0x3c')]){_0x963021[_0x5925('0x3d')]=[{'all':!![]}];}return db[_0x5925('0x2b')][_0x5925('0x3e')](_0x963021);})[_0x5925('0x24')](function(_0x2ec0fa){_0x5b8f57['rows']=_0x2ec0fa;return _0x5b8f57;})['then'](respondWithFilteredResult(_0x1d842d,_0x963021))[_0x5925('0x3f')](handleError(_0x1d842d,null));}; \ No newline at end of file +var _0x0b87=['send','map','Migration','rawAttributes','type','query','keys','intersection','model','attributes','fields','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','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/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','then','destroy','end','stack','name'];(function(_0x55f8bd,_0x1d6f3a){var _0x21fda4=function(_0x5d6fa7){while(--_0x5d6fa7){_0x55f8bd['push'](_0x55f8bd['shift']());}};_0x21fda4(++_0x1d6f3a);}(_0x0b87,0x123));var _0x70b8=function(_0x1e16df,_0x32ac46){_0x1e16df=_0x1e16df-0x0;var _0xb1aa0e=_0x0b87[_0x1e16df];return _0xb1aa0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70b8('0x0'));var zipdir=require(_0x70b8('0x1'));var jsonpatch=require(_0x70b8('0x2'));var rp=require(_0x70b8('0x3'));var moment=require(_0x70b8('0x4'));var BPromise=require(_0x70b8('0x5'));var Mustache=require(_0x70b8('0x6'));var util=require(_0x70b8('0x7'));var path=require(_0x70b8('0x8'));var sox=require(_0x70b8('0x9'));var csv=require(_0x70b8('0xa'));var ejs=require(_0x70b8('0xb'));var fs=require('fs');var fs_extra=require(_0x70b8('0xc'));var _=require(_0x70b8('0xd'));var squel=require(_0x70b8('0xe'));var crypto=require(_0x70b8('0xf'));var jsforce=require(_0x70b8('0x10'));var deskjs=require(_0x70b8('0x11'));var toCsv=require(_0x70b8('0xa'));var querystring=require(_0x70b8('0x12'));var Papa=require(_0x70b8('0x13'));var Redis=require(_0x70b8('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70b8('0x15'));var hardwareService=require(_0x70b8('0x16'));var logger=require(_0x70b8('0x17'))(_0x70b8('0x18'));var utils=require(_0x70b8('0x19'));var config=require(_0x70b8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x70b8('0x1b'))['db'];function respondWithStatusCode(_0x2e2019,_0x3d27fa){_0x3d27fa=_0x3d27fa||0xcc;return function(_0x3cc416){if(_0x3cc416){return _0x2e2019[_0x70b8('0x1c')](_0x3d27fa);}return _0x2e2019[_0x70b8('0x1d')](_0x3d27fa)['end']();};}function respondWithResult(_0x4ab9c2,_0x7c739c){_0x7c739c=_0x7c739c||0xc8;return function(_0x5e66b2){if(_0x5e66b2){return _0x4ab9c2[_0x70b8('0x1d')](_0x7c739c)[_0x70b8('0x1e')](_0x5e66b2);}};}function respondWithFilteredResult(_0x2d5b73,_0x4c5203){return function(_0x45ec49){if(_0x45ec49){var _0x39d843=typeof _0x4c5203[_0x70b8('0x1f')]===_0x70b8('0x20')&&typeof _0x4c5203[_0x70b8('0x21')]===_0x70b8('0x20');var _0x34b4bc=_0x45ec49[_0x70b8('0x22')];var _0x3f511e=_0x39d843?0x0:_0x4c5203['offset'];var _0x302e4c=_0x39d843?_0x45ec49[_0x70b8('0x22')]:_0x4c5203[_0x70b8('0x1f')]+_0x4c5203[_0x70b8('0x21')];var _0x487712;if(_0x302e4c>=_0x34b4bc){_0x302e4c=_0x34b4bc;_0x487712=0xc8;}else{_0x487712=0xce;}_0x2d5b73[_0x70b8('0x1d')](_0x487712);return _0x2d5b73[_0x70b8('0x23')](_0x70b8('0x24'),_0x3f511e+'-'+_0x302e4c+'/'+_0x34b4bc)[_0x70b8('0x1e')](_0x45ec49);}return null;};}function patchUpdates(_0x2e0d5a){return function(_0x50ca4c){try{jsonpatch[_0x70b8('0x25')](_0x50ca4c,_0x2e0d5a,!![]);}catch(_0x3bbe89){return BPromise[_0x70b8('0x26')](_0x3bbe89);}return _0x50ca4c['save']();};}function saveUpdates(_0x55d7e3,_0x159fa5){return function(_0x3c869e){if(_0x3c869e){return _0x3c869e['update'](_0x55d7e3)[_0x70b8('0x27')](function(_0x5a7c72){return _0x5a7c72;});}return null;};}function removeEntity(_0x436637,_0x43c21d){return function(_0x45d1c4){if(_0x45d1c4){return _0x45d1c4[_0x70b8('0x28')]()['then'](function(){_0x436637[_0x70b8('0x1d')](0xcc)[_0x70b8('0x29')]();});}};}function handleEntityNotFound(_0x519340,_0x15195d){return function(_0x4b22b3){if(!_0x4b22b3){_0x519340[_0x70b8('0x1c')](0x194);}return _0x4b22b3;};}function handleError(_0x1d4827,_0x4e0aad){_0x4e0aad=_0x4e0aad||0x1f4;return function(_0x4c8375){logger['error'](_0x4c8375[_0x70b8('0x2a')]);if(_0x4c8375[_0x70b8('0x2b')]){delete _0x4c8375[_0x70b8('0x2b')];}_0x1d4827[_0x70b8('0x1d')](_0x4e0aad)[_0x70b8('0x2c')](_0x4c8375);};}exports['index']=function(_0x1d9752,_0x1286c9){var _0x55e9c0={},_0x243d8a={},_0x309d55={'count':0x0,'rows':[]};var _0x1d4647=_[_0x70b8('0x2d')](db[_0x70b8('0x2e')][_0x70b8('0x2f')],function(_0x75354c){return{'name':_0x75354c['fieldName'],'type':_0x75354c[_0x70b8('0x30')]['key']};});_0x243d8a['model']=_['map'](_0x1d4647,_0x70b8('0x2b'));_0x243d8a[_0x70b8('0x31')]=_[_0x70b8('0x32')](_0x1d9752['query']);_0x243d8a['filters']=_[_0x70b8('0x33')](_0x243d8a[_0x70b8('0x34')],_0x243d8a[_0x70b8('0x31')]);_0x55e9c0[_0x70b8('0x35')]=_['intersection'](_0x243d8a[_0x70b8('0x34')],qs[_0x70b8('0x36')](_0x1d9752[_0x70b8('0x31')][_0x70b8('0x36')]));_0x55e9c0[_0x70b8('0x35')]=_0x55e9c0['attributes']['length']?_0x55e9c0[_0x70b8('0x35')]:_0x243d8a[_0x70b8('0x34')];if(!_0x1d9752[_0x70b8('0x31')]['hasOwnProperty']('nolimit')){_0x55e9c0[_0x70b8('0x21')]=qs[_0x70b8('0x21')](_0x1d9752[_0x70b8('0x31')]['limit']);_0x55e9c0[_0x70b8('0x1f')]=qs[_0x70b8('0x1f')](_0x1d9752[_0x70b8('0x31')][_0x70b8('0x1f')]);}_0x55e9c0[_0x70b8('0x37')]=qs['sort'](_0x1d9752['query'][_0x70b8('0x38')]);_0x55e9c0[_0x70b8('0x39')]=qs[_0x70b8('0x3a')](_[_0x70b8('0x3b')](_0x1d9752['query'],_0x243d8a['filters']),_0x1d4647);if(_0x1d9752[_0x70b8('0x31')][_0x70b8('0x3c')]){_0x55e9c0[_0x70b8('0x39')]=_['merge'](_0x55e9c0['where'],{'$or':_[_0x70b8('0x2d')](_0x1d4647,function(_0x4bbc87){if(_0x4bbc87[_0x70b8('0x30')]!=='VIRTUAL'){var _0x4e7181={};_0x4e7181[_0x4bbc87[_0x70b8('0x2b')]]={'$like':'%'+_0x1d9752['query'][_0x70b8('0x3c')]+'%'};return _0x4e7181;}})});}_0x55e9c0=_['merge']({},_0x55e9c0,_0x1d9752[_0x70b8('0x3d')]);var _0x21d866={'where':_0x55e9c0[_0x70b8('0x39')]};return db[_0x70b8('0x2e')][_0x70b8('0x22')](_0x21d866)[_0x70b8('0x27')](function(_0x22ce55){_0x309d55[_0x70b8('0x22')]=_0x22ce55;if(_0x1d9752['query'][_0x70b8('0x3e')]){_0x55e9c0[_0x70b8('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x70b8('0x40')](_0x55e9c0);})[_0x70b8('0x27')](function(_0x137917){_0x309d55[_0x70b8('0x41')]=_0x137917;return _0x309d55;})[_0x70b8('0x27')](respondWithFilteredResult(_0x1286c9,_0x55e9c0))[_0x70b8('0x42')](handleError(_0x1286c9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7a2a494..66a72fc 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 _0x3ec4=['define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./migration.attributes','exports'];(function(_0x150d68,_0x13061c){var _0xd65277=function(_0x2c121e){while(--_0x2c121e){_0x150d68['push'](_0x150d68['shift']());}};_0xd65277(++_0x13061c);}(_0x3ec4,0x1e4));var _0x43ec=function(_0xf5da60,_0x4f7b51){_0xf5da60=_0xf5da60-0x0;var _0x216adc=_0x3ec4[_0xf5da60];return _0x216adc;};'use strict';var _=require(_0x43ec('0x0'));var util=require(_0x43ec('0x1'));var logger=require(_0x43ec('0x2'))(_0x43ec('0x3'));var moment=require(_0x43ec('0x4'));var BPromise=require(_0x43ec('0x5'));var rp=require(_0x43ec('0x6'));var fs=require('fs');var path=require(_0x43ec('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43ec('0x8'));module[_0x43ec('0x9')]=function(_0x44bdf8,_0x79a431){return _0x44bdf8[_0x43ec('0xa')](_0x43ec('0xb'),attributes,{'tableName':_0x43ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb48=['rimraf','exports','Migration','migrations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x9ab282,_0x224526){var _0x3ae406=function(_0x23c911){while(--_0x23c911){_0x9ab282['push'](_0x9ab282['shift']());}};_0x3ae406(++_0x224526);}(_0xeb48,0x1cf));var _0x8eb4=function(_0x5a7f40,_0x11c596){_0x5a7f40=_0x5a7f40-0x0;var _0x226737=_0xeb48[_0x5a7f40];return _0x226737;};'use strict';var _=require('lodash');var util=require(_0x8eb4('0x0'));var logger=require(_0x8eb4('0x1'))('api');var moment=require(_0x8eb4('0x2'));var BPromise=require(_0x8eb4('0x3'));var rp=require(_0x8eb4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8eb4('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x8eb4('0x6')]=function(_0x50d85f,_0x230a9c){return _0x50d85f['define'](_0x8eb4('0x7'),attributes,{'tableName':_0x8eb4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e489e9a..0dd4dea 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 _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ea3c3,_0x13e26b){var _0x15ea17=function(_0x3a1ce7){while(--_0x3a1ce7){_0x2ea3c3['push'](_0x2ea3c3['shift']());}};_0x15ea17(++_0x13e26b);}(_0x7980,0xab));var _0x0798=function(_0x2d563d,_0x18d7f8){_0x2d563d=_0x2d563d-0x0;var _0x15601a=_0x7980[_0x2d563d];return _0x15601a;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('Migration,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file +var _0x9f3e=['request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x14efb7,_0x582ffe){_0x14efb7=_0x14efb7-0x0;var _0x352243=_0x9f3e[_0x14efb7];return _0x352243;};'use strict';var _=require(_0xe9f3('0x0'));var util=require(_0xe9f3('0x1'));var moment=require(_0xe9f3('0x2'));var BPromise=require(_0xe9f3('0x3'));var rs=require(_0xe9f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe9f3('0x5'))('rpc');var config=require(_0xe9f3('0x6'));var jayson=require(_0xe9f3('0x7'));var client=jayson[_0xe9f3('0x8')][_0xe9f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46e25d,_0x1611eb,_0x407123){return new BPromise(function(_0x4014b1,_0x1fe4af){return client[_0xe9f3('0xa')](_0x46e25d,_0x407123)[_0xe9f3('0xb')](function(_0x30e00e){logger[_0xe9f3('0xc')]('Migration,\x20%s,\x20%s',_0x1611eb,_0xe9f3('0xd'));logger[_0xe9f3('0xe')](_0xe9f3('0xf'),_0x1611eb,_0xe9f3('0xd'),JSON[_0xe9f3('0x10')](_0x30e00e));if(_0x30e00e['error']){if(_0x30e00e[_0xe9f3('0x11')][_0xe9f3('0x12')]===0x1f4){logger['error'](_0xe9f3('0x13'),_0x1611eb,_0x30e00e['error'][_0xe9f3('0x14')]);return _0x1fe4af(_0x30e00e[_0xe9f3('0x11')][_0xe9f3('0x14')]);}logger['error']('Migration,\x20%s,\x20%s',_0x1611eb,_0x30e00e[_0xe9f3('0x11')][_0xe9f3('0x14')]);return _0x4014b1(_0x30e00e['error'][_0xe9f3('0x14')]);}else{logger[_0xe9f3('0xc')](_0xe9f3('0x13'),_0x1611eb,_0xe9f3('0xd'));_0x4014b1(_0x30e00e[_0xe9f3('0x15')]['message']);}})['catch'](function(_0x32e9ae){logger[_0xe9f3('0x11')](_0xe9f3('0x13'),_0x1611eb,_0x32e9ae);_0x1fe4af(_0x32e9ae);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fdad9d2..dba0bad 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 _0xd92a=['get','index','/:id','isAuthenticated','show','post','create','delete','exports','util','path','connect-timeout','Router','fs-extra','./network.controller'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0xd92a,0x1bc));var _0xad92=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd92a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xad92('0x0'));var path=require(_0xad92('0x1'));var timeout=require(_0xad92('0x2'));var express=require('express');var router=express[_0xad92('0x3')]();var fs_extra=require(_0xad92('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad92('0x5'));router[_0xad92('0x6')]('/',auth['isAuthenticated'](),controller[_0xad92('0x7')]);router[_0xad92('0x6')](_0xad92('0x8'),auth[_0xad92('0x9')](),controller[_0xad92('0xa')]);router[_0xad92('0xb')]('/',auth[_0xad92('0x9')](),controller[_0xad92('0xc')]);router['put'](_0xad92('0x8'),auth[_0xad92('0x9')](),controller['update']);router[_0xad92('0xd')](_0xad92('0x8'),auth[_0xad92('0x9')](),controller['destroy']);module[_0xad92('0xe')]=router; \ No newline at end of file +var _0x236e=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post'];(function(_0x58cdd7,_0x14018b){var _0x2bf7f5=function(_0x4bc90c){while(--_0x4bc90c){_0x58cdd7['push'](_0x58cdd7['shift']());}};_0x2bf7f5(++_0x14018b);}(_0x236e,0x148));var _0xe236=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x236e[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0xe236('0x0'));var util=require(_0xe236('0x1'));var path=require(_0xe236('0x2'));var timeout=require(_0xe236('0x3'));var express=require('express');var router=express[_0xe236('0x4')]();var fs_extra=require(_0xe236('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe236('0x6'));var config=require(_0xe236('0x7'));var controller=require(_0xe236('0x8'));router[_0xe236('0x9')]('/',auth[_0xe236('0xa')](),controller[_0xe236('0xb')]);router[_0xe236('0x9')](_0xe236('0xc'),auth[_0xe236('0xa')](),controller['show']);router[_0xe236('0xd')]('/',auth[_0xe236('0xa')](),controller['create']);router[_0xe236('0xe')](_0xe236('0xc'),auth[_0xe236('0xa')](),controller[_0xe236('0xf')]);router[_0xe236('0x10')]('/:id',auth[_0xe236('0xa')](),controller[_0xe236('0x11')]);module[_0xe236('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 4649a4a..3f933aa 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 _0x133d=['STRING','sequelize','exports','ENUM','externip','stun','turn'];(function(_0x3eb969,_0x11c187){var _0x5e62e0=function(_0x4eb12d){while(--_0x4eb12d){_0x3eb969['push'](_0x3eb969['shift']());}};_0x5e62e0(++_0x11c187);}(_0x133d,0x189));var _0xd133=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x133d[_0x55c1f0];return _0x1530fa;};'use strict';var Sequelize=require(_0xd133('0x0'));module[_0xd133('0x1')]={'type':{'type':Sequelize[_0xd133('0x2')]('localnet',_0xd133('0x3'),_0xd133('0x4'),_0xd133('0x5'))},'value':{'type':Sequelize[_0xd133('0x6')]},'username':{'type':Sequelize[_0xd133('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc67c=['exports','ENUM','localnet','externip','turn','STRING','sequelize'];(function(_0x465529,_0x18530d){var _0x3ce2be=function(_0x6b33f6){while(--_0x6b33f6){_0x465529['push'](_0x465529['shift']());}};_0x3ce2be(++_0x18530d);}(_0xc67c,0xa7));var _0xcc67=function(_0x1a87d0,_0x57608a){_0x1a87d0=_0x1a87d0-0x0;var _0x3e3002=_0xc67c[_0x1a87d0];return _0x3e3002;};'use strict';var Sequelize=require(_0xcc67('0x0'));module[_0xcc67('0x1')]={'type':{'type':Sequelize[_0xcc67('0x2')](_0xcc67('0x3'),_0xcc67('0x4'),'stun',_0xcc67('0x5'))},'value':{'type':Sequelize[_0xcc67('0x6')]},'username':{'type':Sequelize[_0xcc67('0x6')]},'password':{'type':Sequelize[_0xcc67('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 2eb044f..70041dc 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 _0x88eb=['Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','format','chan_sip.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/turn_multiple.ejs','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','Network','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x88eb,0x76));var _0xb88e=function(_0x4d8f8b,_0x4bc669){_0x4d8f8b=_0x4d8f8b-0x0;var _0x4156b6=_0x88eb[_0x4d8f8b];return _0x4156b6;};'use strict';var emlformat=require(_0xb88e('0x0'));var rimraf=require(_0xb88e('0x1'));var zipdir=require(_0xb88e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb88e('0x3'));var moment=require('moment');var BPromise=require(_0xb88e('0x4'));var Mustache=require(_0xb88e('0x5'));var util=require(_0xb88e('0x6'));var path=require(_0xb88e('0x7'));var sox=require(_0xb88e('0x8'));var csv=require(_0xb88e('0x9'));var ejs=require(_0xb88e('0xa'));var fs=require('fs');var fs_extra=require(_0xb88e('0xb'));var _=require(_0xb88e('0xc'));var squel=require(_0xb88e('0xd'));var crypto=require(_0xb88e('0xe'));var jsforce=require(_0xb88e('0xf'));var deskjs=require(_0xb88e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb88e('0x11'));var Papa=require('papaparse');var Redis=require(_0xb88e('0x12'));var authService=require(_0xb88e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb88e('0x14'));var hardwareService=require(_0xb88e('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb88e('0x16'));var licenseUtil=require(_0xb88e('0x17'));var db=require(_0xb88e('0x18'))['db'];var jayson=require(_0xb88e('0x19'));var client=jayson[_0xb88e('0x1a')][_0xb88e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1bd062,_0x5adf94,_0x43f552,_0x57c4f1){return new BPromise(function(_0x998c0c,_0x49f646){var _0x490331=_0x57c4f1||client;return _0x490331[_0xb88e('0x1c')](_0x1bd062,_0x43f552)['then'](function(_0x4281fa){logger[_0xb88e('0x1d')](_0xb88e('0x1e'),_0x5adf94,_0xb88e('0x1f'));logger[_0xb88e('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x5adf94,'request\x20sent',JSON[_0xb88e('0x21')](_0x4281fa));if(_0x4281fa[_0xb88e('0x22')]){if(_0x4281fa[_0xb88e('0x22')][_0xb88e('0x23')]===0x1f4){logger[_0xb88e('0x22')]('Network,\x20%s,\x20%s',_0x5adf94,_0x4281fa[_0xb88e('0x22')][_0xb88e('0x24')]);return _0x49f646(_0x4281fa['error'][_0xb88e('0x24')]);}logger[_0xb88e('0x22')](_0xb88e('0x1e'),_0x5adf94,_0x4281fa['error'][_0xb88e('0x24')]);return _0x998c0c(_0x4281fa['error'][_0xb88e('0x24')]);}else{logger['info'](_0xb88e('0x1e'),_0x5adf94,'request\x20sent');_0x998c0c(_0x4281fa['result'][_0xb88e('0x24')]);}})[_0xb88e('0x25')](function(_0x5dfe8c){logger[_0xb88e('0x22')]('Network,\x20%s,\x20%s',_0x5adf94,_0x5dfe8c);_0x49f646(_0x5dfe8c);});});}function respondWithStatusCode(_0x39854c,_0x593c2e){_0x593c2e=_0x593c2e||0xcc;return function(_0x4c6d8d){if(_0x4c6d8d){return _0x39854c[_0xb88e('0x26')](_0x593c2e);}return _0x39854c['status'](_0x593c2e)[_0xb88e('0x27')]();};}function respondWithResult(_0x39611f,_0x4d2055){_0x4d2055=_0x4d2055||0xc8;return function(_0x17397f){if(_0x17397f){return _0x39611f[_0xb88e('0x28')](_0x4d2055)[_0xb88e('0x29')](_0x17397f);}};}function respondWithFilteredResult(_0xdc28db,_0x313524){return function(_0x4d0648){if(_0x4d0648){var _0x1c202a=typeof _0x313524[_0xb88e('0x2a')]==='undefined'&&typeof _0x313524[_0xb88e('0x2b')]===_0xb88e('0x2c');var _0x34e96b=_0x4d0648['count'];var _0x39be73=_0x1c202a?0x0:_0x313524['offset'];var _0x4f1552=_0x1c202a?_0x4d0648[_0xb88e('0x2d')]:_0x313524[_0xb88e('0x2a')]+_0x313524[_0xb88e('0x2b')];var _0x388552;if(_0x4f1552>=_0x34e96b){_0x4f1552=_0x34e96b;_0x388552=0xc8;}else{_0x388552=0xce;}_0xdc28db['status'](_0x388552);return _0xdc28db[_0xb88e('0x2e')](_0xb88e('0x2f'),_0x39be73+'-'+_0x4f1552+'/'+_0x34e96b)[_0xb88e('0x29')](_0x4d0648);}return null;};}function patchUpdates(_0x332ba7){return function(_0x50be93){try{jsonpatch[_0xb88e('0x30')](_0x50be93,_0x332ba7,!![]);}catch(_0x59b12c){return BPromise['reject'](_0x59b12c);}return _0x50be93['save']();};}function saveUpdates(_0x54f928,_0x1d0de5){return function(_0x483cf9){if(_0x483cf9){return _0x483cf9[_0xb88e('0x31')](_0x54f928)[_0xb88e('0x32')](function(_0xa77065){return _0xa77065;});}return null;};}function removeEntity(_0x2a1966,_0x2fbd0f){return function(_0x1a7550){if(_0x1a7550){return _0x1a7550[_0xb88e('0x33')]()[_0xb88e('0x32')](function(){_0x2a1966['status'](0xcc)[_0xb88e('0x27')]();});}};}function handleEntityNotFound(_0x3a30f4,_0x247e38){return function(_0x6c6e5d){if(!_0x6c6e5d){_0x3a30f4['sendStatus'](0x194);}return _0x6c6e5d;};}function handleError(_0x16b47d,_0x141c8d){_0x141c8d=_0x141c8d||0x1f4;return function(_0x40a945){logger[_0xb88e('0x22')](_0x40a945[_0xb88e('0x34')]);if(_0x40a945[_0xb88e('0x35')]){delete _0x40a945['name'];}_0x16b47d['status'](_0x141c8d)[_0xb88e('0x36')](_0x40a945);};}exports[_0xb88e('0x37')]=function(_0x4ba906,_0x104ab3){var _0x309b5c={},_0x337bd7={},_0x17294f={'count':0x0,'rows':[]};var _0x370405=_[_0xb88e('0x38')](db[_0xb88e('0x39')][_0xb88e('0x3a')],function(_0xf1df33){return{'name':_0xf1df33['fieldName'],'type':_0xf1df33[_0xb88e('0x3b')][_0xb88e('0x3c')]};});_0x337bd7['model']=_[_0xb88e('0x38')](_0x370405,_0xb88e('0x35'));_0x337bd7['query']=_['keys'](_0x4ba906[_0xb88e('0x3d')]);_0x337bd7[_0xb88e('0x3e')]=_[_0xb88e('0x3f')](_0x337bd7[_0xb88e('0x40')],_0x337bd7[_0xb88e('0x3d')]);_0x309b5c[_0xb88e('0x41')]=_[_0xb88e('0x3f')](_0x337bd7[_0xb88e('0x40')],qs['fields'](_0x4ba906[_0xb88e('0x3d')][_0xb88e('0x42')]));_0x309b5c[_0xb88e('0x41')]=_0x309b5c['attributes']['length']?_0x309b5c[_0xb88e('0x41')]:_0x337bd7[_0xb88e('0x40')];if(!_0x4ba906[_0xb88e('0x3d')][_0xb88e('0x43')](_0xb88e('0x44'))){_0x309b5c[_0xb88e('0x2b')]=qs[_0xb88e('0x2b')](_0x4ba906[_0xb88e('0x3d')]['limit']);_0x309b5c[_0xb88e('0x2a')]=qs['offset'](_0x4ba906[_0xb88e('0x3d')][_0xb88e('0x2a')]);}_0x309b5c[_0xb88e('0x45')]=qs['sort'](_0x4ba906['query']['sort']);_0x309b5c[_0xb88e('0x46')]=qs['filters'](_['pick'](_0x4ba906['query'],_0x337bd7['filters']),_0x370405);if(_0x4ba906[_0xb88e('0x3d')][_0xb88e('0x47')]){_0x309b5c[_0xb88e('0x46')]=_['merge'](_0x309b5c[_0xb88e('0x46')],{'$or':_[_0xb88e('0x38')](_0x370405,function(_0x24df40){if(_0x24df40[_0xb88e('0x3b')]!==_0xb88e('0x48')){var _0x3b8716={};_0x3b8716[_0x24df40[_0xb88e('0x35')]]={'$like':'%'+_0x4ba906[_0xb88e('0x3d')][_0xb88e('0x47')]+'%'};return _0x3b8716;}})});}_0x309b5c=_[_0xb88e('0x49')]({},_0x309b5c,_0x4ba906[_0xb88e('0x4a')]);var _0x1e94f5={'where':_0x309b5c[_0xb88e('0x46')]};return db[_0xb88e('0x39')][_0xb88e('0x2d')](_0x1e94f5)[_0xb88e('0x32')](function(_0x6c8e36){_0x17294f[_0xb88e('0x2d')]=_0x6c8e36;if(_0x4ba906['query'][_0xb88e('0x4b')]){_0x309b5c[_0xb88e('0x4c')]=[{'all':!![]}];}return db[_0xb88e('0x39')][_0xb88e('0x4d')](_0x309b5c);})[_0xb88e('0x32')](function(_0x6bcaf9){_0x17294f[_0xb88e('0x4e')]=_0x6bcaf9;return _0x17294f;})[_0xb88e('0x32')](respondWithFilteredResult(_0x104ab3,_0x309b5c))['catch'](handleError(_0x104ab3,null));};exports[_0xb88e('0x4f')]=function(_0x571b84,_0x1d2f09){var _0x51039d={'raw':!![],'where':{'id':_0x571b84[_0xb88e('0x50')]['id']}},_0x265dca={};_0x265dca[_0xb88e('0x40')]=_['keys'](db['Network'][_0xb88e('0x3a')]);_0x265dca['query']=_[_0xb88e('0x51')](_0x571b84[_0xb88e('0x3d')]);_0x265dca[_0xb88e('0x3e')]=_['intersection'](_0x265dca[_0xb88e('0x40')],_0x265dca['query']);_0x51039d[_0xb88e('0x41')]=_[_0xb88e('0x3f')](_0x265dca['model'],qs['fields'](_0x571b84[_0xb88e('0x3d')][_0xb88e('0x42')]));_0x51039d[_0xb88e('0x41')]=_0x51039d['attributes'][_0xb88e('0x52')]?_0x51039d[_0xb88e('0x41')]:_0x265dca['model'];if(_0x571b84[_0xb88e('0x3d')]['includeAll']){_0x51039d['include']=[{'all':!![]}];}_0x51039d=_[_0xb88e('0x49')]({},_0x51039d,_0x571b84[_0xb88e('0x4a')]);return db[_0xb88e('0x39')][_0xb88e('0x53')](_0x51039d)['then'](handleEntityNotFound(_0x1d2f09,null))['then'](respondWithResult(_0x1d2f09,null))[_0xb88e('0x25')](handleError(_0x1d2f09,null));};exports[_0xb88e('0x54')]=function(_0x1ba2d9,_0x4a30d8,_0x54ffe2){var _0x579eee;return db[_0xb88e('0x55')][_0xb88e('0x56')](function(_0x36eea5){return db['Network'][_0xb88e('0x54')](_0x1ba2d9[_0xb88e('0x57')],{'raw':!![]})[_0xb88e('0x32')](function(_0x426cf4){_0x579eee=_0x426cf4;return db[_0xb88e('0x39')][_0xb88e('0x4d')]({'where':{'type':_0x1ba2d9[_0xb88e('0x57')]['type']},'raw':!![]});})[_0xb88e('0x32')](function(_0x1b913c){if(_0x579eee[_0xb88e('0x3b')][_0xb88e('0x58')]()==_0xb88e('0x59')){var _0x2db9fc=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x5d')),_0xb88e('0x5e'));var _0x448852=ejs[_0xb88e('0x5f')](_0x2db9fc,{'networks':_0x1b913c||[]});fs[_0xb88e('0x60')](_0xb88e('0x61'),_0x448852);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x54'),{'module':_0xb88e('0x63')});}else if(_0x579eee[_0xb88e('0x3b')][_0xb88e('0x58')]()==_0xb88e('0x64')){var _0x479e9d=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],'server/files/templates/turn_multiple.ejs'),_0xb88e('0x5e'));var _0x235fa0=ejs[_0xb88e('0x5f')](_0x479e9d,{'networks':_0x1b913c||[]});fs['writeFileSync'](_0xb88e('0x65'),_0x235fa0);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x54'),{'module':_0xb88e('0x63')});}else{var _0x4e07ea=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],'server/files/templates/network.ejs'),_0xb88e('0x5e'));var _0x1e179a=ejs['render'](_0x4e07ea,{'networks':_0x1b913c||[]});fs['writeFileSync'](util[_0xb88e('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x1ba2d9[_0xb88e('0x57')][_0xb88e('0x3b')]['toLowerCase']()),_0x1e179a);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x54'),{'module':_0xb88e('0x67')});}return null;})[_0xb88e('0x32')](function(){return _0x579eee;});})['then'](respondWithResult(_0x4a30d8,0xc9))['catch'](handleError(_0x4a30d8,null));};exports['update']=function(_0x5dbc68,_0x1f6c26,_0x363bc5){var _0x56f4e8;return db[_0xb88e('0x55')][_0xb88e('0x56')](function(_0x50de41){return db[_0xb88e('0x39')][_0xb88e('0x53')]({'where':{'id':_0x5dbc68[_0xb88e('0x50')]['id']}})[_0xb88e('0x32')](handleEntityNotFound(_0x1f6c26,null))[_0xb88e('0x32')](saveUpdates(_0x5dbc68[_0xb88e('0x57')],null))[_0xb88e('0x32')](function(_0x169083){if(_0x169083){_0x56f4e8=_0x169083;return db[_0xb88e('0x39')][_0xb88e('0x4d')]({'where':{'type':_0x56f4e8['type']},'raw':!![]});}return null;})['then'](function(_0xe2d044){if(_0x56f4e8[_0xb88e('0x3b')][_0xb88e('0x58')]()==_0xb88e('0x59')){var _0x5bb2a4=fs['readFileSync'](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x5d')),'utf8');var _0x24b6be=ejs[_0xb88e('0x5f')](_0x5bb2a4,{'networks':_0xe2d044||[]});fs['writeFileSync'](_0xb88e('0x61'),_0x24b6be);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x31'),{'module':_0xb88e('0x63')});}else if(_0x56f4e8['type']['toUpperCase']()=='TURN'){var _0x1ded75=fs['readFileSync'](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],'server/files/templates/turn_multiple.ejs'),_0xb88e('0x5e'));var _0x253854=ejs[_0xb88e('0x5f')](_0x1ded75,{'networks':_0xe2d044||[]});fs[_0xb88e('0x60')]('/etc/asterisk/turn_xcally.conf',_0x253854);return respondWithRpcPromise('Reload','update',{'module':'res_stun_monitor.so'});}else{var _0x532836=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x68')),_0xb88e('0x5e'));var _0x4e37be=ejs[_0xb88e('0x5f')](_0x532836,{'networks':_0xe2d044||[]});fs[_0xb88e('0x60')](util[_0xb88e('0x66')](_0xb88e('0x69'),_0x5dbc68[_0xb88e('0x57')]['type'][_0xb88e('0x6a')]()),_0x4e37be);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x31'),{'module':_0xb88e('0x67')});}return null;})[_0xb88e('0x32')](function(_0x2036e9){if(_0x2036e9){return _0x56f4e8;}return null;});})[_0xb88e('0x32')](respondWithResult(_0x1f6c26,null))[_0xb88e('0x25')](handleError(_0x1f6c26,null));};exports['destroy']=function(_0x245be0,_0x388893,_0x361786){var _0x13b4ce;return db[_0xb88e('0x39')]['find']({'where':{'id':_0x245be0[_0xb88e('0x50')]['id']}})[_0xb88e('0x32')](function(_0x3ed313){_0x13b4ce=_0x3ed313;return _0x3ed313;})[_0xb88e('0x32')](handleEntityNotFound(_0x388893,null))[_0xb88e('0x32')](removeEntity(_0x388893,null))[_0xb88e('0x32')](function(){if(_0x13b4ce){return db[_0xb88e('0x39')][_0xb88e('0x4d')]({'where':{'type':_0x13b4ce[_0xb88e('0x3b')]},'raw':!![]});}})[_0xb88e('0x32')](function(_0x50d9a8){if(_0x13b4ce['type'][_0xb88e('0x58')]()==_0xb88e('0x59')){var _0x2dd5db=fs['readFileSync'](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x5d')),_0xb88e('0x5e'));var _0x2d78ae=ejs['render'](_0x2dd5db,{'networks':_0x50d9a8||[]});fs[_0xb88e('0x60')](_0xb88e('0x61'),_0x2d78ae);return respondWithRpcPromise('Reload',_0xb88e('0x33'),{'module':_0xb88e('0x63')});}else if(_0x13b4ce[_0xb88e('0x3b')][_0xb88e('0x58')]()==_0xb88e('0x64')){var _0x522ea2=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x6b')),_0xb88e('0x5e'));var _0x27bf60=ejs[_0xb88e('0x5f')](_0x522ea2,{'networks':_0x50d9a8||[]});fs['writeFileSync'](_0xb88e('0x65'),_0x27bf60);return respondWithRpcPromise('Reload',_0xb88e('0x33'),{'module':_0xb88e('0x63')});}else{var _0x158a3f=fs[_0xb88e('0x5a')](path[_0xb88e('0x5b')](config[_0xb88e('0x5c')],_0xb88e('0x68')),_0xb88e('0x5e'));var _0x58ad6e=ejs['render'](_0x158a3f,{'networks':_0x50d9a8||[]});fs[_0xb88e('0x60')](util[_0xb88e('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x245be0[_0xb88e('0x57')][_0xb88e('0x3b')][_0xb88e('0x6a')]()),_0x58ad6e);return respondWithRpcPromise(_0xb88e('0x62'),_0xb88e('0x33'),{'module':'chan_sip.so'});}return null;})[_0xb88e('0x25')](handleError(_0x388893,null));}; \ No newline at end of file +var _0x18ae=['find','create','transaction','body','toUpperCase','STUN','readFileSync','utf8','render','/etc/asterisk/stun_xcally.conf','join','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','root','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','TURN','server/files/templates/network.ejs','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params'];(function(_0x48dc4c,_0x1be414){var _0x336e6f=function(_0x307d4a){while(--_0x307d4a){_0x48dc4c['push'](_0x48dc4c['shift']());}};_0x336e6f(++_0x1be414);}(_0x18ae,0x1c5));var _0xe18a=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x18ae[_0xabfec4];return _0x7bafa2;};'use strict';var emlformat=require(_0xe18a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe18a('0x1'));var moment=require(_0xe18a('0x2'));var BPromise=require(_0xe18a('0x3'));var Mustache=require(_0xe18a('0x4'));var util=require(_0xe18a('0x5'));var path=require(_0xe18a('0x6'));var sox=require(_0xe18a('0x7'));var csv=require(_0xe18a('0x8'));var ejs=require(_0xe18a('0x9'));var fs=require('fs');var fs_extra=require(_0xe18a('0xa'));var _=require(_0xe18a('0xb'));var squel=require(_0xe18a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe18a('0xd'));var toCsv=require(_0xe18a('0x8'));var querystring=require(_0xe18a('0xe'));var Papa=require(_0xe18a('0xf'));var Redis=require(_0xe18a('0x10'));var authService=require(_0xe18a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe18a('0x12'));var hardwareService=require(_0xe18a('0x13'));var logger=require(_0xe18a('0x14'))('api');var utils=require(_0xe18a('0x15'));var config=require(_0xe18a('0x16'));var licenseUtil=require(_0xe18a('0x17'));var db=require(_0xe18a('0x18'))['db'];var jayson=require(_0xe18a('0x19'));var client=jayson[_0xe18a('0x1a')][_0xe18a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3773d0,_0x1720bc,_0x3823fa,_0x20d0ff){return new BPromise(function(_0x48824c,_0x2a8840){var _0x5d453d=_0x20d0ff||client;return _0x5d453d['request'](_0x3773d0,_0x3823fa)[_0xe18a('0x1c')](function(_0x38791d){logger[_0xe18a('0x1d')](_0xe18a('0x1e'),_0x1720bc,_0xe18a('0x1f'));logger[_0xe18a('0x20')](_0xe18a('0x21'),_0x1720bc,_0xe18a('0x1f'),JSON[_0xe18a('0x22')](_0x38791d));if(_0x38791d[_0xe18a('0x23')]){if(_0x38791d[_0xe18a('0x23')][_0xe18a('0x24')]===0x1f4){logger[_0xe18a('0x23')](_0xe18a('0x1e'),_0x1720bc,_0x38791d[_0xe18a('0x23')][_0xe18a('0x25')]);return _0x2a8840(_0x38791d[_0xe18a('0x23')][_0xe18a('0x25')]);}logger[_0xe18a('0x23')](_0xe18a('0x1e'),_0x1720bc,_0x38791d[_0xe18a('0x23')][_0xe18a('0x25')]);return _0x48824c(_0x38791d[_0xe18a('0x23')][_0xe18a('0x25')]);}else{logger[_0xe18a('0x1d')](_0xe18a('0x1e'),_0x1720bc,_0xe18a('0x1f'));_0x48824c(_0x38791d[_0xe18a('0x26')][_0xe18a('0x25')]);}})[_0xe18a('0x27')](function(_0x93c93){logger[_0xe18a('0x23')]('Network,\x20%s,\x20%s',_0x1720bc,_0x93c93);_0x2a8840(_0x93c93);});});}function respondWithStatusCode(_0x89853c,_0x464b5a){_0x464b5a=_0x464b5a||0xcc;return function(_0x318cf8){if(_0x318cf8){return _0x89853c['sendStatus'](_0x464b5a);}return _0x89853c[_0xe18a('0x28')](_0x464b5a)[_0xe18a('0x29')]();};}function respondWithResult(_0x1cbac1,_0x532c5b){_0x532c5b=_0x532c5b||0xc8;return function(_0x168c19){if(_0x168c19){return _0x1cbac1[_0xe18a('0x28')](_0x532c5b)[_0xe18a('0x2a')](_0x168c19);}};}function respondWithFilteredResult(_0x1de90c,_0x3c1040){return function(_0x12fec9){if(_0x12fec9){var _0x1a48f9=typeof _0x3c1040['offset']===_0xe18a('0x2b')&&typeof _0x3c1040[_0xe18a('0x2c')]==='undefined';var _0x45a5d0=_0x12fec9[_0xe18a('0x2d')];var _0x1a3fd4=_0x1a48f9?0x0:_0x3c1040[_0xe18a('0x2e')];var _0x46cb7d=_0x1a48f9?_0x12fec9[_0xe18a('0x2d')]:_0x3c1040[_0xe18a('0x2e')]+_0x3c1040[_0xe18a('0x2c')];var _0x523ae5;if(_0x46cb7d>=_0x45a5d0){_0x46cb7d=_0x45a5d0;_0x523ae5=0xc8;}else{_0x523ae5=0xce;}_0x1de90c[_0xe18a('0x28')](_0x523ae5);return _0x1de90c[_0xe18a('0x2f')](_0xe18a('0x30'),_0x1a3fd4+'-'+_0x46cb7d+'/'+_0x45a5d0)['json'](_0x12fec9);}return null;};}function patchUpdates(_0x4e5953){return function(_0x79ae60){try{jsonpatch[_0xe18a('0x31')](_0x79ae60,_0x4e5953,!![]);}catch(_0x61c9b){return BPromise['reject'](_0x61c9b);}return _0x79ae60[_0xe18a('0x32')]();};}function saveUpdates(_0x1f112b,_0x3cfcf9){return function(_0x555c74){if(_0x555c74){return _0x555c74[_0xe18a('0x33')](_0x1f112b)[_0xe18a('0x1c')](function(_0x348d58){return _0x348d58;});}return null;};}function removeEntity(_0x20ddbb,_0x5656a5){return function(_0x347edd){if(_0x347edd){return _0x347edd[_0xe18a('0x34')]()[_0xe18a('0x1c')](function(){_0x20ddbb[_0xe18a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7fff,_0x5ce421){return function(_0x2cb808){if(!_0x2cb808){_0x4e7fff['sendStatus'](0x194);}return _0x2cb808;};}function handleError(_0x3d6fa2,_0x52eff7){_0x52eff7=_0x52eff7||0x1f4;return function(_0x2fae2c){logger['error'](_0x2fae2c[_0xe18a('0x35')]);if(_0x2fae2c[_0xe18a('0x36')]){delete _0x2fae2c[_0xe18a('0x36')];}_0x3d6fa2[_0xe18a('0x28')](_0x52eff7)['send'](_0x2fae2c);};}exports[_0xe18a('0x37')]=function(_0x377d61,_0x20c26a){var _0x44109b={},_0x2c84b6={},_0x100168={'count':0x0,'rows':[]};var _0x5b7787=_['map'](db['Network'][_0xe18a('0x38')],function(_0x79f678){return{'name':_0x79f678['fieldName'],'type':_0x79f678[_0xe18a('0x39')][_0xe18a('0x3a')]};});_0x2c84b6[_0xe18a('0x3b')]=_['map'](_0x5b7787,'name');_0x2c84b6[_0xe18a('0x3c')]=_[_0xe18a('0x3d')](_0x377d61[_0xe18a('0x3c')]);_0x2c84b6[_0xe18a('0x3e')]=_['intersection'](_0x2c84b6[_0xe18a('0x3b')],_0x2c84b6[_0xe18a('0x3c')]);_0x44109b['attributes']=_[_0xe18a('0x3f')](_0x2c84b6[_0xe18a('0x3b')],qs[_0xe18a('0x40')](_0x377d61['query'][_0xe18a('0x40')]));_0x44109b[_0xe18a('0x41')]=_0x44109b[_0xe18a('0x41')][_0xe18a('0x42')]?_0x44109b[_0xe18a('0x41')]:_0x2c84b6['model'];if(!_0x377d61['query'][_0xe18a('0x43')](_0xe18a('0x44'))){_0x44109b[_0xe18a('0x2c')]=qs['limit'](_0x377d61['query'][_0xe18a('0x2c')]);_0x44109b[_0xe18a('0x2e')]=qs[_0xe18a('0x2e')](_0x377d61[_0xe18a('0x3c')]['offset']);}_0x44109b['order']=qs[_0xe18a('0x45')](_0x377d61[_0xe18a('0x3c')]['sort']);_0x44109b[_0xe18a('0x46')]=qs[_0xe18a('0x3e')](_[_0xe18a('0x47')](_0x377d61['query'],_0x2c84b6[_0xe18a('0x3e')]),_0x5b7787);if(_0x377d61[_0xe18a('0x3c')]['filter']){_0x44109b[_0xe18a('0x46')]=_[_0xe18a('0x48')](_0x44109b[_0xe18a('0x46')],{'$or':_['map'](_0x5b7787,function(_0x57a1bc){if(_0x57a1bc[_0xe18a('0x39')]!==_0xe18a('0x49')){var _0x11c288={};_0x11c288[_0x57a1bc[_0xe18a('0x36')]]={'$like':'%'+_0x377d61[_0xe18a('0x3c')]['filter']+'%'};return _0x11c288;}})});}_0x44109b=_['merge']({},_0x44109b,_0x377d61[_0xe18a('0x4a')]);var _0x23e992={'where':_0x44109b['where']};return db[_0xe18a('0x4b')][_0xe18a('0x2d')](_0x23e992)[_0xe18a('0x1c')](function(_0x58d39a){_0x100168[_0xe18a('0x2d')]=_0x58d39a;if(_0x377d61[_0xe18a('0x3c')][_0xe18a('0x4c')]){_0x44109b[_0xe18a('0x4d')]=[{'all':!![]}];}return db[_0xe18a('0x4b')][_0xe18a('0x4e')](_0x44109b);})['then'](function(_0x79fba5){_0x100168[_0xe18a('0x4f')]=_0x79fba5;return _0x100168;})[_0xe18a('0x1c')](respondWithFilteredResult(_0x20c26a,_0x44109b))[_0xe18a('0x27')](handleError(_0x20c26a,null));};exports[_0xe18a('0x50')]=function(_0x223669,_0x59cdad){var _0x2602fb={'raw':!![],'where':{'id':_0x223669[_0xe18a('0x51')]['id']}},_0x59d0b0={};_0x59d0b0[_0xe18a('0x3b')]=_[_0xe18a('0x3d')](db[_0xe18a('0x4b')]['rawAttributes']);_0x59d0b0[_0xe18a('0x3c')]=_[_0xe18a('0x3d')](_0x223669[_0xe18a('0x3c')]);_0x59d0b0[_0xe18a('0x3e')]=_[_0xe18a('0x3f')](_0x59d0b0['model'],_0x59d0b0['query']);_0x2602fb[_0xe18a('0x41')]=_[_0xe18a('0x3f')](_0x59d0b0[_0xe18a('0x3b')],qs[_0xe18a('0x40')](_0x223669['query'][_0xe18a('0x40')]));_0x2602fb[_0xe18a('0x41')]=_0x2602fb[_0xe18a('0x41')][_0xe18a('0x42')]?_0x2602fb['attributes']:_0x59d0b0[_0xe18a('0x3b')];if(_0x223669['query'][_0xe18a('0x4c')]){_0x2602fb[_0xe18a('0x4d')]=[{'all':!![]}];}_0x2602fb=_[_0xe18a('0x48')]({},_0x2602fb,_0x223669[_0xe18a('0x4a')]);return db[_0xe18a('0x4b')][_0xe18a('0x52')](_0x2602fb)[_0xe18a('0x1c')](handleEntityNotFound(_0x59cdad,null))['then'](respondWithResult(_0x59cdad,null))['catch'](handleError(_0x59cdad,null));};exports[_0xe18a('0x53')]=function(_0x596677,_0x5bd6f9,_0x56ed58){var _0x2ad14b;return db['sequelize'][_0xe18a('0x54')](function(_0x1a7e0a){return db[_0xe18a('0x4b')][_0xe18a('0x53')](_0x596677[_0xe18a('0x55')],{'raw':!![]})[_0xe18a('0x1c')](function(_0x290559){_0x2ad14b=_0x290559;return db[_0xe18a('0x4b')][_0xe18a('0x4e')]({'where':{'type':_0x596677[_0xe18a('0x55')]['type']},'raw':!![]});})[_0xe18a('0x1c')](function(_0x52da49){if(_0x2ad14b[_0xe18a('0x39')][_0xe18a('0x56')]()==_0xe18a('0x57')){var _0x398a2b=fs[_0xe18a('0x58')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe18a('0x59'));var _0x1c48f8=ejs[_0xe18a('0x5a')](_0x398a2b,{'networks':_0x52da49||[]});fs['writeFileSync'](_0xe18a('0x5b'),_0x1c48f8);return respondWithRpcPromise('Reload',_0xe18a('0x53'),{'module':'res_stun_monitor.so'});}else if(_0x2ad14b['type']['toUpperCase']()=='TURN'){var _0x678f87=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config['root'],_0xe18a('0x5d')),_0xe18a('0x59'));var _0xdcfe51=ejs[_0xe18a('0x5a')](_0x678f87,{'networks':_0x52da49||[]});fs[_0xe18a('0x5e')](_0xe18a('0x5f'),_0xdcfe51);return respondWithRpcPromise(_0xe18a('0x60'),_0xe18a('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x4803fb=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config['root'],'server/files/templates/network.ejs'),_0xe18a('0x59'));var _0x1a1ab5=ejs[_0xe18a('0x5a')](_0x4803fb,{'networks':_0x52da49||[]});fs[_0xe18a('0x5e')](util[_0xe18a('0x61')](_0xe18a('0x62'),_0x596677[_0xe18a('0x55')][_0xe18a('0x39')][_0xe18a('0x63')]()),_0x1a1ab5);return respondWithRpcPromise(_0xe18a('0x60'),_0xe18a('0x53'),{'module':_0xe18a('0x64')});}return null;})[_0xe18a('0x1c')](function(){return _0x2ad14b;});})[_0xe18a('0x1c')](respondWithResult(_0x5bd6f9,0xc9))['catch'](handleError(_0x5bd6f9,null));};exports[_0xe18a('0x33')]=function(_0x6e10a8,_0x5e521f,_0x1270cf){var _0x25ef8c;return db[_0xe18a('0x65')][_0xe18a('0x54')](function(_0x2dbb82){return db[_0xe18a('0x4b')][_0xe18a('0x52')]({'where':{'id':_0x6e10a8[_0xe18a('0x51')]['id']}})[_0xe18a('0x1c')](handleEntityNotFound(_0x5e521f,null))[_0xe18a('0x1c')](saveUpdates(_0x6e10a8[_0xe18a('0x55')],null))[_0xe18a('0x1c')](function(_0x44d399){if(_0x44d399){_0x25ef8c=_0x44d399;return db[_0xe18a('0x4b')][_0xe18a('0x4e')]({'where':{'type':_0x25ef8c[_0xe18a('0x39')]},'raw':!![]});}return null;})[_0xe18a('0x1c')](function(_0x3a1b1e){if(_0x25ef8c['type'][_0xe18a('0x56')]()==_0xe18a('0x57')){var _0x221ea7=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config[_0xe18a('0x66')],_0xe18a('0x67')),_0xe18a('0x59'));var _0x35a7e6=ejs[_0xe18a('0x5a')](_0x221ea7,{'networks':_0x3a1b1e||[]});fs[_0xe18a('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x35a7e6);return respondWithRpcPromise('Reload',_0xe18a('0x33'),{'module':_0xe18a('0x68')});}else if(_0x25ef8c['type']['toUpperCase']()==_0xe18a('0x69')){var _0x3db167=fs['readFileSync'](path[_0xe18a('0x5c')](config[_0xe18a('0x66')],_0xe18a('0x5d')),_0xe18a('0x59'));var _0x1ea766=ejs[_0xe18a('0x5a')](_0x3db167,{'networks':_0x3a1b1e||[]});fs['writeFileSync'](_0xe18a('0x5f'),_0x1ea766);return respondWithRpcPromise(_0xe18a('0x60'),_0xe18a('0x33'),{'module':_0xe18a('0x68')});}else{var _0x2d4ab5=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config['root'],_0xe18a('0x6a')),'utf8');var _0x4652b3=ejs[_0xe18a('0x5a')](_0x2d4ab5,{'networks':_0x3a1b1e||[]});fs['writeFileSync'](util['format'](_0xe18a('0x62'),_0x6e10a8[_0xe18a('0x55')][_0xe18a('0x39')]['toLowerCase']()),_0x4652b3);return respondWithRpcPromise('Reload',_0xe18a('0x33'),{'module':_0xe18a('0x64')});}return null;})['then'](function(_0xb90105){if(_0xb90105){return _0x25ef8c;}return null;});})['then'](respondWithResult(_0x5e521f,null))[_0xe18a('0x27')](handleError(_0x5e521f,null));};exports[_0xe18a('0x34')]=function(_0x30314f,_0x35e243,_0x44172c){var _0x1862ce;return db[_0xe18a('0x4b')]['find']({'where':{'id':_0x30314f['params']['id']}})[_0xe18a('0x1c')](function(_0x3cf3f0){_0x1862ce=_0x3cf3f0;return _0x3cf3f0;})[_0xe18a('0x1c')](handleEntityNotFound(_0x35e243,null))[_0xe18a('0x1c')](removeEntity(_0x35e243,null))['then'](function(){if(_0x1862ce){return db[_0xe18a('0x4b')][_0xe18a('0x4e')]({'where':{'type':_0x1862ce[_0xe18a('0x39')]},'raw':!![]});}})['then'](function(_0x2bf02d){if(_0x1862ce[_0xe18a('0x39')][_0xe18a('0x56')]()=='STUN'){var _0x2200a6=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config[_0xe18a('0x66')],_0xe18a('0x67')),'utf8');var _0x32be80=ejs[_0xe18a('0x5a')](_0x2200a6,{'networks':_0x2bf02d||[]});fs[_0xe18a('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x32be80);return respondWithRpcPromise(_0xe18a('0x60'),_0xe18a('0x34'),{'module':'res_stun_monitor.so'});}else if(_0x1862ce['type'][_0xe18a('0x56')]()==_0xe18a('0x69')){var _0x39fef8=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config[_0xe18a('0x66')],'server/files/templates/turn_multiple.ejs'),_0xe18a('0x59'));var _0x12846c=ejs[_0xe18a('0x5a')](_0x39fef8,{'networks':_0x2bf02d||[]});fs[_0xe18a('0x5e')](_0xe18a('0x5f'),_0x12846c);return respondWithRpcPromise('Reload',_0xe18a('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x59a524=fs[_0xe18a('0x58')](path[_0xe18a('0x5c')](config[_0xe18a('0x66')],_0xe18a('0x6a')),_0xe18a('0x59'));var _0x262cb0=ejs['render'](_0x59a524,{'networks':_0x2bf02d||[]});fs[_0xe18a('0x5e')](util['format'](_0xe18a('0x62'),_0x30314f[_0xe18a('0x55')][_0xe18a('0x39')][_0xe18a('0x63')]()),_0x262cb0);return respondWithRpcPromise(_0xe18a('0x60'),_0xe18a('0x34'),{'module':_0xe18a('0x64')});}return null;})[_0xe18a('0x27')](handleError(_0x35e243,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 5e9fdfa..1a3d968 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 _0x1d2d=['../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util'];(function(_0x59ee85,_0x21000a){var _0x9d1121=function(_0x59c5fb){while(--_0x59c5fb){_0x59ee85['push'](_0x59ee85['shift']());}};_0x9d1121(++_0x21000a);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x594ca4,_0x15f380){_0x594ca4=_0x594ca4-0x0;var _0x1516ff=_0x1d2d[_0x594ca4];return _0x1516ff;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var moment=require(_0xd1d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd1d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1d2('0x6'));var attributes=require(_0xd1d2('0x7'));module[_0xd1d2('0x8')]=function(_0x269613,_0x2f930d){return _0x269613[_0xd1d2('0x9')]('Network',attributes,{'tableName':_0xd1d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb248=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./network.attributes','exports','define','network'];(function(_0x4343ca,_0x2a4453){var _0x42590d=function(_0x413144){while(--_0x413144){_0x4343ca['push'](_0x4343ca['shift']());}};_0x42590d(++_0x2a4453);}(_0xb248,0xc6));var _0x8b24=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xb248[_0x279d37];return _0x530173;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var logger=require(_0x8b24('0x1'))(_0x8b24('0x2'));var moment=require(_0x8b24('0x3'));var BPromise=require(_0x8b24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b24('0x5'));var rimraf=require(_0x8b24('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b24('0x7'));module[_0x8b24('0x8')]=function(_0x4cc3c4,_0x6da5b7){return _0x4cc3c4[_0x8b24('0x9')]('Network',attributes,{'tableName':_0x8b24('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 9fac897..9ba0e5f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x524e78,_0x9862d0){_0x524e78=_0x524e78-0x0;var _0x576950=_0x7a54[_0x524e78];return _0x576950;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e0468,_0x10ad86){var _0xb8d884=function(_0x4c28a1){while(--_0x4c28a1){_0x4e0468['push'](_0x4e0468['shift']());}};_0xb8d884(++_0x10ad86);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 db9f31f..fd0e811 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 _0xe4d1=['/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xe4d1,0xf5));var _0x1e4d=function(_0x2b591c,_0x117b3c){_0x2b591c=_0x2b591c-0x0;var _0x9ef65d=_0xe4d1[_0x2b591c];return _0x9ef65d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e4d('0x0'));var router=express[_0x1e4d('0x1')]();var fs_extra=require(_0x1e4d('0x2'));var auth=require(_0x1e4d('0x3'));var interaction=require(_0x1e4d('0x4'));var config=require(_0x1e4d('0x5'));var controller=require(_0x1e4d('0x6'));router[_0x1e4d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e4d('0x7')](_0x1e4d('0x8'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0xa')]);router['get'](_0x1e4d('0xb'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0xc')]);router[_0x1e4d('0x7')](_0x1e4d('0xd'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0xe')]);router['get'](_0x1e4d('0xf'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x10')]);router['get'](_0x1e4d('0x11'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x12')]);router[_0x1e4d('0x7')](_0x1e4d('0x13'),auth['isAuthenticated'](),controller[_0x1e4d('0x14')]);router['get'](_0x1e4d('0x15'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x16')]);router[_0x1e4d('0x17')]('/',auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x18')]);router[_0x1e4d('0x17')](_0x1e4d('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x1e4d('0x17')](_0x1e4d('0xf'),auth['isAuthenticated'](),controller[_0x1e4d('0x19')]);router[_0x1e4d('0x17')](_0x1e4d('0x1a'),controller[_0x1e4d('0x1b')]);router[_0x1e4d('0x17')](_0x1e4d('0x11'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x1c')]);router['post'](_0x1e4d('0x15'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x1d')]);router[_0x1e4d('0x17')](_0x1e4d('0x1e'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x1f')]);router[_0x1e4d('0x20')](_0x1e4d('0xb'),auth[_0x1e4d('0x9')](),controller['update']);router[_0x1e4d('0x21')]('/:id',auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x22')]);router[_0x1e4d('0x21')](_0x1e4d('0xd'),auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x23')]);router[_0x1e4d('0x21')]('/:id/canned_answers',auth[_0x1e4d('0x9')](),controller[_0x1e4d('0x24')]);router[_0x1e4d('0x21')](_0x1e4d('0x15'),auth[_0x1e4d('0x9')](),controller['removeAgents']);module[_0x1e4d('0x25')]=router; \ No newline at end of file +var _0xf9c6=['notify','/:id/applications','addApplications','addAgents','send','put','/:id','update','delete','removeDispositions','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','post','addAnswer'];(function(_0x2253e6,_0x290ef6){var _0x439d95=function(_0x504e91){while(--_0x504e91){_0x2253e6['push'](_0x2253e6['shift']());}};_0x439d95(++_0x290ef6);}(_0xf9c6,0x155));var _0x6f9c=function(_0x23a8b3,_0x4f44d4){_0x23a8b3=_0x23a8b3-0x0;var _0x5f161c=_0xf9c6[_0x23a8b3];return _0x5f161c;};'use strict';var multer=require('multer');var util=require(_0x6f9c('0x0'));var path=require('path');var timeout=require(_0x6f9c('0x1'));var express=require(_0x6f9c('0x2'));var router=express[_0x6f9c('0x3')]();var fs_extra=require(_0x6f9c('0x4'));var auth=require(_0x6f9c('0x5'));var interaction=require(_0x6f9c('0x6'));var config=require(_0x6f9c('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x9')]);router[_0x6f9c('0xa')]('/describe',auth[_0x6f9c('0x8')](),controller[_0x6f9c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6f9c('0xc')]);router['get'](_0x6f9c('0xd'),auth[_0x6f9c('0x8')](),controller[_0x6f9c('0xe')]);router['get'](_0x6f9c('0xf'),auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x10')]);router['get']('/:id/applications',auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x11')]);router[_0x6f9c('0xa')](_0x6f9c('0x12'),auth[_0x6f9c('0x8')](),controller['getInteractions']);router['get'](_0x6f9c('0x13'),auth[_0x6f9c('0x8')](),controller['getAgents']);router[_0x6f9c('0x14')]('/',auth[_0x6f9c('0x8')](),controller['create']);router[_0x6f9c('0x14')](_0x6f9c('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x6f9c('0x14')]('/:id/canned_answers',auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x15')]);router[_0x6f9c('0x14')]('/:id/notify',controller[_0x6f9c('0x16')]);router[_0x6f9c('0x14')](_0x6f9c('0x17'),auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x18')]);router[_0x6f9c('0x14')](_0x6f9c('0x13'),auth['isAuthenticated'](),controller[_0x6f9c('0x19')]);router[_0x6f9c('0x14')]('/:id/send',auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x1a')]);router[_0x6f9c('0x1b')](_0x6f9c('0x1c'),auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x1d')]);router[_0x6f9c('0x1e')](_0x6f9c('0x1c'),auth['isAuthenticated'](),controller['destroy']);router[_0x6f9c('0x1e')](_0x6f9c('0xd'),auth[_0x6f9c('0x8')](),controller[_0x6f9c('0x1f')]);router['delete'](_0x6f9c('0xf'),auth[_0x6f9c('0x8')](),controller['removeAnswers']);router[_0x6f9c('0x1e')](_0x6f9c('0x13'),auth['isAuthenticated'](),controller[_0x6f9c('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0266e99..3080134 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 _0x2e8c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1e3f34,_0x4b2222){var _0x334f67=function(_0x595b6c){while(--_0x595b6c){_0x1e3f34['push'](_0x1e3f34['shift']());}};_0x334f67(++_0x4b2222);}(_0x2e8c,0x101));var _0xc2e8=function(_0x21c857,_0x1f9812){_0x21c857=_0x21c857-0x0;var _0x2e6516=_0x2e8c[_0x21c857];return _0x2e6516;};'use strict';var Sequelize=require(_0xc2e8('0x0'));var rs=require(_0xc2e8('0x1'));module[_0xc2e8('0x2')]={'name':{'type':Sequelize[_0xc2e8('0x3')],'unique':_0xc2e8('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc2e8('0x3')]},'token':{'type':Sequelize[_0xc2e8('0x3')],'defaultValue':function(){return rs[_0xc2e8('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc2e8('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc2e8('0x6')],'defaultValue':function(){return _0xc2e8('0x7');}},'notificationSound':{'type':Sequelize[_0xc2e8('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc2e8('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc2e8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc2e8('0x3')]},'queueTransfer':{'type':Sequelize[_0xc2e8('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc2e8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc2e8('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc2e8('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc2e8('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xc2e8('0x8')],'defaultValue':![],'comment':_0xc2e8('0xb'),'set':function(_0x1eb72d){if(!_0x1eb72d)this[_0xc2e8('0xc')]('mandatoryDispositionPauseId',null);this[_0xc2e8('0xc')](_0xc2e8('0xd'),_0x1eb72d);}}}; \ No newline at end of file +var _0x02a0=['name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING'];(function(_0x5e1820,_0x222ac3){var _0x183383=function(_0x1c2000){while(--_0x1c2000){_0x5e1820['push'](_0x5e1820['shift']());}};_0x183383(++_0x222ac3);}(_0x02a0,0x165));var _0x002a=function(_0x5ff556,_0x10026b){_0x5ff556=_0x5ff556-0x0;var _0x132e3d=_0x02a0[_0x5ff556];return _0x132e3d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x002a('0x0'));module[_0x002a('0x1')]={'name':{'type':Sequelize[_0x002a('0x2')],'unique':_0x002a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x002a('0x2')]},'token':{'type':Sequelize[_0x002a('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x002a('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x002a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x002a('0x4')],'defaultValue':function(){return _0x002a('0x5');}},'notificationSound':{'type':Sequelize[_0x002a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x002a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x002a('0x2')]},'queueTransfer':{'type':Sequelize[_0x002a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x002a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x002a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x002a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x002a('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x002a('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x002a('0x9'),'set':function(_0x29f84d){if(!_0x29f84d)this[_0x002a('0xa')](_0x002a('0xb'),null);this[_0x002a('0xa')]('mandatoryDisposition',_0x29f84d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a2f09e8..7c078b0 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 _0x8101=['findOne','hasOwnProperty','nolimit','OpenchannelAccountId','ids','CannedAnswer','getAnswers','order','includeAll','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','updatedAt','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','addApplications','sequelize','transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','tag','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','Pause','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','sort','where','pick','filter','merge','options','OpenchannelAccount','include','findAll','rows','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions'];(function(_0x223daf,_0x57678f){var _0x2bad68=function(_0x4da80a){while(--_0x4da80a){_0x223daf['push'](_0x223daf['shift']());}};_0x2bad68(++_0x57678f);}(_0x8101,0x10b));var _0x1810=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0x8101[_0x425b19];return _0x15ecab;};'use strict';var emlformat=require(_0x1810('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1810('0x1'));var jsonpatch=require(_0x1810('0x2'));var rp=require(_0x1810('0x3'));var moment=require(_0x1810('0x4'));var BPromise=require(_0x1810('0x5'));var Mustache=require(_0x1810('0x6'));var util=require(_0x1810('0x7'));var path=require(_0x1810('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1810('0x9'));var fs=require('fs');var fs_extra=require(_0x1810('0xa'));var _=require(_0x1810('0xb'));var squel=require(_0x1810('0xc'));var crypto=require(_0x1810('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1810('0xe'));var toCsv=require(_0x1810('0xf'));var querystring=require(_0x1810('0x10'));var Papa=require(_0x1810('0x11'));var Redis=require('ioredis');var authService=require(_0x1810('0x12'));var qs=require(_0x1810('0x13'));var as=require(_0x1810('0x14'));var hardwareService=require(_0x1810('0x15'));var logger=require('../../config/logger')(_0x1810('0x16'));var utils=require(_0x1810('0x17'));var config=require(_0x1810('0x18'));var licenseUtil=require(_0x1810('0x19'));var db=require('../../mysqldb')['db'];config[_0x1810('0x1a')]=_[_0x1810('0x1b')](config[_0x1810('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1810('0x1c'))(new Redis(config[_0x1810('0x1a')]));require(_0x1810('0x1d'))['register'](socket);var jayson=require(_0x1810('0x1e'));var client=jayson[_0x1810('0x1f')][_0x1810('0x20')]({'port':0x232c});var client9002=jayson[_0x1810('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x60c9d9,_0x5ce6db,_0x22d881,_0x433615){return new BPromise(function(_0xd27b40,_0x1dce22){var _0xfa10a7=_0x433615||client;return _0xfa10a7['request'](_0x60c9d9,_0x22d881)['then'](function(_0x41cd45){logger[_0x1810('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ce6db,_0x1810('0x22'));logger[_0x1810('0x23')](_0x1810('0x24'),_0x5ce6db,_0x1810('0x22'),JSON[_0x1810('0x25')](_0x41cd45));if(_0x41cd45[_0x1810('0x26')]){if(_0x41cd45[_0x1810('0x26')]['code']===0x1f4){logger[_0x1810('0x26')](_0x1810('0x27'),_0x5ce6db,_0x41cd45[_0x1810('0x26')][_0x1810('0x28')]);return _0x1dce22(_0x41cd45[_0x1810('0x26')][_0x1810('0x28')]);}logger[_0x1810('0x26')](_0x1810('0x27'),_0x5ce6db,_0x41cd45[_0x1810('0x26')]['message']);return _0xd27b40(_0x41cd45[_0x1810('0x26')][_0x1810('0x28')]);}else{logger[_0x1810('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ce6db,_0x1810('0x22'));_0xd27b40(_0x41cd45[_0x1810('0x29')][_0x1810('0x28')]);}})[_0x1810('0x2a')](function(_0x2c8620){logger['error'](_0x1810('0x27'),_0x5ce6db,_0x2c8620);_0x1dce22(_0x2c8620);});});}function respondWithStatusCode(_0x3954fa,_0x1d5012){_0x1d5012=_0x1d5012||0xcc;return function(_0x6c5c41){if(_0x6c5c41){return _0x3954fa['sendStatus'](_0x1d5012);}return _0x3954fa[_0x1810('0x2b')](_0x1d5012)[_0x1810('0x2c')]();};}function respondWithResult(_0x582b66,_0x11fc49){_0x11fc49=_0x11fc49||0xc8;return function(_0xdd7a46){if(_0xdd7a46){return _0x582b66[_0x1810('0x2b')](_0x11fc49)['json'](_0xdd7a46);}};}function respondWithFilteredResult(_0x1f1dec,_0xcae248){return function(_0x2d7a20){if(_0x2d7a20){var _0x58415e=typeof _0xcae248[_0x1810('0x2d')]===_0x1810('0x2e')&&typeof _0xcae248[_0x1810('0x2f')]===_0x1810('0x2e');var _0x5104a2=_0x2d7a20[_0x1810('0x30')];var _0x5901c0=_0x58415e?0x0:_0xcae248[_0x1810('0x2d')];var _0x1b134c=_0x58415e?_0x2d7a20[_0x1810('0x30')]:_0xcae248[_0x1810('0x2d')]+_0xcae248['limit'];var _0x57e6a2;if(_0x1b134c>=_0x5104a2){_0x1b134c=_0x5104a2;_0x57e6a2=0xc8;}else{_0x57e6a2=0xce;}_0x1f1dec[_0x1810('0x2b')](_0x57e6a2);return _0x1f1dec['set'](_0x1810('0x31'),_0x5901c0+'-'+_0x1b134c+'/'+_0x5104a2)[_0x1810('0x32')](_0x2d7a20);}return null;};}function patchUpdates(_0x1ba484){return function(_0x176c22){try{jsonpatch[_0x1810('0x33')](_0x176c22,_0x1ba484,!![]);}catch(_0x2c9be6){return BPromise[_0x1810('0x34')](_0x2c9be6);}return _0x176c22['save']();};}function saveUpdates(_0x1a4b4b,_0x143cd5){return function(_0x3fa20e){if(_0x3fa20e){return _0x3fa20e[_0x1810('0x35')](_0x1a4b4b)['then'](function(_0x2d555b){return _0x2d555b;});}return null;};}function removeEntity(_0x139192,_0x252e31){return function(_0x3917bf){if(_0x3917bf){return _0x3917bf['destroy']()[_0x1810('0x36')](function(){var _0x472d39=_0x3917bf[_0x1810('0x37')]({'plain':!![]});var _0x3bcf64=_0x1810('0x38');return db[_0x1810('0x39')][_0x1810('0x3a')]({'where':{'type':_0x3bcf64,'resourceId':_0x472d39['id']}})[_0x1810('0x36')](function(){return _0x3917bf;});})[_0x1810('0x36')](function(){_0x139192['status'](0xcc)[_0x1810('0x2c')]();});}};}function handleEntityNotFound(_0x4a59ff,_0x1c31df){return function(_0x38fe1d){if(!_0x38fe1d){_0x4a59ff[_0x1810('0x3b')](0x194);}return _0x38fe1d;};}function handleError(_0x5a7245,_0x56b9a1){_0x56b9a1=_0x56b9a1||0x1f4;return function(_0x1b1a6b){logger['error'](_0x1b1a6b[_0x1810('0x3c')]);if(_0x1b1a6b[_0x1810('0x3d')]){delete _0x1b1a6b[_0x1810('0x3d')];}_0x5a7245[_0x1810('0x2b')](_0x56b9a1)[_0x1810('0x3e')](_0x1b1a6b);};}exports['index']=function(_0x4e1369,_0x54f06d){var _0x44a1b8={'include':[{'model':db[_0x1810('0x3f')],'as':'mandatoryDispositionPause'}]},_0xebce34={},_0x157107={'count':0x0,'rows':[]};var _0x5e211e=_[_0x1810('0x40')](db['OpenchannelAccount'][_0x1810('0x41')],function(_0x481b2e){return{'name':_0x481b2e[_0x1810('0x42')],'type':_0x481b2e[_0x1810('0x43')][_0x1810('0x44')]};});_0xebce34['model']=_[_0x1810('0x40')](_0x5e211e,_0x1810('0x3d'));_0xebce34['query']=_[_0x1810('0x45')](_0x4e1369[_0x1810('0x46')]);_0xebce34[_0x1810('0x47')]=_[_0x1810('0x48')](_0xebce34[_0x1810('0x49')],_0xebce34[_0x1810('0x46')]);_0x44a1b8[_0x1810('0x4a')]=_['intersection'](_0xebce34[_0x1810('0x49')],qs['fields'](_0x4e1369[_0x1810('0x46')][_0x1810('0x4b')]));_0x44a1b8['attributes']=_0x44a1b8[_0x1810('0x4a')]['length']?_0x44a1b8[_0x1810('0x4a')]:_0xebce34[_0x1810('0x49')];if(!_0x4e1369[_0x1810('0x46')]['hasOwnProperty']('nolimit')){_0x44a1b8['limit']=qs[_0x1810('0x2f')](_0x4e1369[_0x1810('0x46')][_0x1810('0x2f')]);_0x44a1b8[_0x1810('0x2d')]=qs[_0x1810('0x2d')](_0x4e1369[_0x1810('0x46')][_0x1810('0x2d')]);}_0x44a1b8['order']=qs['sort'](_0x4e1369[_0x1810('0x46')][_0x1810('0x4c')]);_0x44a1b8[_0x1810('0x4d')]=qs[_0x1810('0x47')](_[_0x1810('0x4e')](_0x4e1369[_0x1810('0x46')],_0xebce34['filters']),_0x5e211e);if(_0x4e1369[_0x1810('0x46')][_0x1810('0x4f')]){_0x44a1b8[_0x1810('0x4d')]=_[_0x1810('0x50')](_0x44a1b8[_0x1810('0x4d')],{'$or':_['map'](_0x5e211e,function(_0x2587d){if(_0x2587d[_0x1810('0x43')]!=='VIRTUAL'){var _0x559da2={};_0x559da2[_0x2587d['name']]={'$like':'%'+_0x4e1369[_0x1810('0x46')]['filter']+'%'};return _0x559da2;}})});}_0x44a1b8=_[_0x1810('0x50')]({},_0x44a1b8,_0x4e1369[_0x1810('0x51')]);var _0x9c5cfb={'where':_0x44a1b8[_0x1810('0x4d')]};return db[_0x1810('0x52')][_0x1810('0x30')](_0x9c5cfb)[_0x1810('0x36')](function(_0x2eb879){_0x157107['count']=_0x2eb879;if(_0x4e1369[_0x1810('0x46')]['includeAll']){_0x44a1b8[_0x1810('0x53')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1810('0x54')](_0x44a1b8);})[_0x1810('0x36')](function(_0x164966){_0x157107[_0x1810('0x55')]=_0x164966;return _0x157107;})['then'](respondWithFilteredResult(_0x54f06d,_0x44a1b8))[_0x1810('0x2a')](handleError(_0x54f06d,null));};exports[_0x1810('0x56')]=function(_0x32554d,_0x8eb923){var _0x5c0f94={'raw':![],'where':{'id':_0x32554d['params']['id']},'include':[{'model':db[_0x1810('0x3f')],'as':'mandatoryDispositionPause'}]},_0x259a9a={};_0x259a9a[_0x1810('0x49')]=_[_0x1810('0x45')](db[_0x1810('0x52')][_0x1810('0x41')]);_0x259a9a[_0x1810('0x46')]=_[_0x1810('0x45')](_0x32554d[_0x1810('0x46')]);_0x259a9a['filters']=_[_0x1810('0x48')](_0x259a9a[_0x1810('0x49')],_0x259a9a[_0x1810('0x46')]);_0x5c0f94[_0x1810('0x4a')]=_[_0x1810('0x48')](_0x259a9a[_0x1810('0x49')],qs[_0x1810('0x4b')](_0x32554d[_0x1810('0x46')]['fields']));_0x5c0f94[_0x1810('0x4a')]=_0x5c0f94[_0x1810('0x4a')][_0x1810('0x57')]?_0x5c0f94[_0x1810('0x4a')]:_0x259a9a['model'];if(_0x32554d['query']['includeAll']){_0x5c0f94[_0x1810('0x53')]=[{'all':!![]}];}_0x5c0f94=_[_0x1810('0x50')]({},_0x5c0f94,_0x32554d['options']);return db[_0x1810('0x52')][_0x1810('0x58')](_0x5c0f94)[_0x1810('0x36')](handleEntityNotFound(_0x8eb923,null))[_0x1810('0x36')](respondWithResult(_0x8eb923,null))['catch'](handleError(_0x8eb923,null));};exports[_0x1810('0x59')]=function(_0x2e0b9e,_0x3e85f6){return db['OpenchannelAccount']['create'](_0x2e0b9e[_0x1810('0x5a')],{})['then'](function(_0x12a582){var _0x46cef3=_0x2e0b9e[_0x1810('0x5b')][_0x1810('0x37')]({'plain':!![]});if(!_0x46cef3)throw new Error(_0x1810('0x5c'));if(_0x46cef3[_0x1810('0x5d')]===_0x1810('0x5b')){var _0x2fc54b=_0x12a582['get']({'plain':!![]});var _0x40897c=_0x1810('0x38');return db[_0x1810('0x5e')][_0x1810('0x58')]({'where':{'name':_0x40897c,'userProfileId':_0x46cef3[_0x1810('0x5f')]},'raw':!![]})[_0x1810('0x36')](function(_0x5f3305){if(_0x5f3305&&_0x5f3305[_0x1810('0x60')]===0x0){return db[_0x1810('0x39')]['create']({'name':_0x2fc54b['name'],'resourceId':_0x2fc54b['id'],'type':_0x5f3305[_0x1810('0x3d')],'sectionId':_0x5f3305['id']},{})[_0x1810('0x36')](function(){return _0x12a582;});}else{return _0x12a582;}})[_0x1810('0x2a')](function(_0x264365){logger[_0x1810('0x26')](_0x1810('0x61'),_0x264365);throw _0x264365;});}return _0x12a582;})['then'](respondWithResult(_0x3e85f6,0xc9))[_0x1810('0x2a')](handleError(_0x3e85f6,null));};exports['update']=function(_0x49f232,_0x444191){if(_0x49f232[_0x1810('0x5a')]['id']){delete _0x49f232[_0x1810('0x5a')]['id'];}return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x49f232[_0x1810('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x1810('0x36')](handleEntityNotFound(_0x444191,null))[_0x1810('0x36')](saveUpdates(_0x49f232[_0x1810('0x5a')],null))[_0x1810('0x36')](respondWithResult(_0x444191,null))[_0x1810('0x2a')](handleError(_0x444191,null));};exports['destroy']=function(_0x17b12e,_0x346043){return db[_0x1810('0x52')]['find']({'where':{'id':_0x17b12e[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x346043,null))[_0x1810('0x36')](removeEntity(_0x346043,null))['catch'](handleError(_0x346043,null));};exports[_0x1810('0x63')]=function(_0x3d78cc,_0x5958b7){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x5958b7,null))[_0x1810('0x2a')](handleError(_0x5958b7,null));};exports[_0x1810('0x64')]=function(_0x5becd0,_0x4f0321,_0x5a88bc){if(_0x5becd0['body']['id']){delete _0x5becd0[_0x1810('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x5becd0[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x4f0321,null))['then'](function(_0x3b5f73){if(_0x3b5f73){_0x5becd0['body']['OpenchannelAccountId']=_0x3b5f73['id'];return db[_0x1810('0x65')][_0x1810('0x59')](_0x5becd0[_0x1810('0x5a')]);}})[_0x1810('0x36')](respondWithResult(_0x4f0321,null))[_0x1810('0x2a')](handleError(_0x4f0321,null));};exports[_0x1810('0x66')]=function(_0x57964a,_0x320c31,_0x1edb2a){var _0x4588d7={'raw':![],'where':{}};var _0x2422cb={};var _0x112379={'count':0x0,'rows':[]};return db[_0x1810('0x52')][_0x1810('0x67')]({'where':{'id':_0x57964a[_0x1810('0x62')]['id']}})['then'](handleEntityNotFound(_0x320c31,null))[_0x1810('0x36')](function(_0x2e1b35){if(_0x2e1b35){_0x2422cb[_0x1810('0x49')]=_[_0x1810('0x45')](db[_0x1810('0x65')][_0x1810('0x41')]);_0x2422cb[_0x1810('0x46')]=_[_0x1810('0x45')](_0x57964a['query']);_0x2422cb[_0x1810('0x47')]=_[_0x1810('0x48')](_0x2422cb[_0x1810('0x49')],_0x2422cb[_0x1810('0x46')]);_0x4588d7[_0x1810('0x4a')]=_[_0x1810('0x48')](_0x2422cb['model'],qs[_0x1810('0x4b')](_0x57964a[_0x1810('0x46')][_0x1810('0x4b')]));_0x4588d7['attributes']=_0x4588d7[_0x1810('0x4a')][_0x1810('0x57')]?_0x4588d7[_0x1810('0x4a')]:_0x2422cb[_0x1810('0x49')];if(!_0x57964a[_0x1810('0x46')][_0x1810('0x68')](_0x1810('0x69'))){_0x4588d7[_0x1810('0x2f')]=qs['limit'](_0x57964a[_0x1810('0x46')][_0x1810('0x2f')]);_0x4588d7[_0x1810('0x2d')]=qs['offset'](_0x57964a[_0x1810('0x46')]['offset']);}_0x4588d7['order']=qs[_0x1810('0x4c')](_0x57964a[_0x1810('0x46')][_0x1810('0x4c')]);_0x4588d7[_0x1810('0x4d')]=qs[_0x1810('0x47')](_[_0x1810('0x4e')](_0x57964a[_0x1810('0x46')],_0x2422cb[_0x1810('0x47')]));_0x4588d7['where'][_0x1810('0x6a')]=_0x2e1b35['id'];if(_0x57964a[_0x1810('0x46')][_0x1810('0x4f')]){_0x4588d7['where']=_[_0x1810('0x50')](_0x4588d7['where'],{'$or':_[_0x1810('0x40')](_0x4588d7[_0x1810('0x4a')],function(_0x5c089a){var _0x11fa7d={};_0x11fa7d[_0x5c089a]={'$like':'%'+_0x57964a[_0x1810('0x46')][_0x1810('0x4f')]+'%'};return _0x11fa7d;})});}_0x4588d7=_['merge']({},_0x4588d7,_0x57964a[_0x1810('0x51')]);return db[_0x1810('0x65')]['count']({'where':_0x4588d7[_0x1810('0x4d')]})[_0x1810('0x36')](function(_0x2bd2a8){_0x112379[_0x1810('0x30')]=_0x2bd2a8;if(_0x57964a[_0x1810('0x46')]['includeAll']){_0x4588d7['include']=[{'all':!![]}];}return db[_0x1810('0x65')]['findAll'](_0x4588d7);})[_0x1810('0x36')](function(_0x5cd0c1){_0x112379['rows']=_0x5cd0c1;return _0x112379;});}})[_0x1810('0x36')](respondWithFilteredResult(_0x320c31,_0x4588d7))[_0x1810('0x2a')](handleError(_0x320c31,null));};exports['removeDispositions']=function(_0x4afcff,_0x20fa86,_0x364e91){return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x4afcff['params']['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x20fa86,null))[_0x1810('0x36')](function(_0x438d27){if(_0x438d27){return _0x438d27['removeDispositions'](_0x4afcff[_0x1810('0x46')][_0x1810('0x6b')]);}})[_0x1810('0x36')](respondWithStatusCode(_0x20fa86,null))[_0x1810('0x2a')](handleError(_0x20fa86,null));};exports['addAnswer']=function(_0x2d54fb,_0x4e2304,_0x3c31cd){if(_0x2d54fb[_0x1810('0x5a')]['id']){delete _0x2d54fb[_0x1810('0x5a')]['id'];}return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x2d54fb[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x4e2304,null))[_0x1810('0x36')](function(_0x879e2f){if(_0x879e2f){_0x2d54fb[_0x1810('0x5a')][_0x1810('0x6a')]=_0x879e2f['id'];return db[_0x1810('0x6c')][_0x1810('0x59')](_0x2d54fb['body']);}})['then'](respondWithResult(_0x4e2304,null))[_0x1810('0x2a')](handleError(_0x4e2304,null));};exports[_0x1810('0x6d')]=function(_0x183c69,_0x19905a,_0x5cd3b3){var _0xf6ccfa={'raw':![],'where':{}};var _0x2998bf={};var _0x68e98b={'count':0x0,'rows':[]};return db[_0x1810('0x52')][_0x1810('0x67')]({'where':{'id':_0x183c69[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x19905a,null))[_0x1810('0x36')](function(_0xbdef73){if(_0xbdef73){_0x2998bf[_0x1810('0x49')]=_[_0x1810('0x45')](db[_0x1810('0x6c')][_0x1810('0x41')]);_0x2998bf[_0x1810('0x46')]=_['keys'](_0x183c69[_0x1810('0x46')]);_0x2998bf['filters']=_[_0x1810('0x48')](_0x2998bf[_0x1810('0x49')],_0x2998bf[_0x1810('0x46')]);_0xf6ccfa['attributes']=_[_0x1810('0x48')](_0x2998bf[_0x1810('0x49')],qs[_0x1810('0x4b')](_0x183c69[_0x1810('0x46')][_0x1810('0x4b')]));_0xf6ccfa[_0x1810('0x4a')]=_0xf6ccfa[_0x1810('0x4a')][_0x1810('0x57')]?_0xf6ccfa[_0x1810('0x4a')]:_0x2998bf[_0x1810('0x49')];if(!_0x183c69['query'][_0x1810('0x68')](_0x1810('0x69'))){_0xf6ccfa['limit']=qs[_0x1810('0x2f')](_0x183c69[_0x1810('0x46')][_0x1810('0x2f')]);_0xf6ccfa['offset']=qs['offset'](_0x183c69[_0x1810('0x46')][_0x1810('0x2d')]);}_0xf6ccfa[_0x1810('0x6e')]=qs[_0x1810('0x4c')](_0x183c69[_0x1810('0x46')][_0x1810('0x4c')]);_0xf6ccfa[_0x1810('0x4d')]=qs[_0x1810('0x47')](_[_0x1810('0x4e')](_0x183c69[_0x1810('0x46')],_0x2998bf[_0x1810('0x47')]));_0xf6ccfa[_0x1810('0x4d')][_0x1810('0x6a')]=_0xbdef73['id'];if(_0x183c69['query']['filter']){_0xf6ccfa[_0x1810('0x4d')]=_['merge'](_0xf6ccfa[_0x1810('0x4d')],{'$or':_[_0x1810('0x40')](_0xf6ccfa[_0x1810('0x4a')],function(_0x23b20a){var _0x4bcf71={};_0x4bcf71[_0x23b20a]={'$like':'%'+_0x183c69['query'][_0x1810('0x4f')]+'%'};return _0x4bcf71;})});}_0xf6ccfa=_[_0x1810('0x50')]({},_0xf6ccfa,_0x183c69[_0x1810('0x51')]);return db[_0x1810('0x6c')][_0x1810('0x30')]({'where':_0xf6ccfa[_0x1810('0x4d')]})['then'](function(_0x352903){_0x68e98b[_0x1810('0x30')]=_0x352903;if(_0x183c69[_0x1810('0x46')][_0x1810('0x6f')]){_0xf6ccfa[_0x1810('0x53')]=[{'all':!![]}];}return db[_0x1810('0x6c')][_0x1810('0x54')](_0xf6ccfa);})[_0x1810('0x36')](function(_0x33c407){_0x68e98b[_0x1810('0x55')]=_0x33c407;return _0x68e98b;});}})[_0x1810('0x36')](respondWithFilteredResult(_0x19905a,_0xf6ccfa))[_0x1810('0x2a')](handleError(_0x19905a,null));};exports[_0x1810('0x70')]=function(_0x282426,_0x3c50c4,_0x4a4fd3){return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x282426[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x3c50c4,null))[_0x1810('0x36')](function(_0x200516){if(_0x200516){return _0x200516[_0x1810('0x70')](_0x282426['query'][_0x1810('0x6b')]);}})['then'](respondWithStatusCode(_0x3c50c4,null))[_0x1810('0x2a')](handleError(_0x3c50c4,null));};exports[_0x1810('0x71')]=function(_0x716907,_0x48a74c,_0x14ecb8){var _0x27c482={'body':_0x716907[_0x1810('0x5a')],'channel':'openchannel'};var _0x4ead8f=[];var _0x59b353=[];var _0x441c33={};var _0x208515=![];return db[_0x1810('0x72')]['describe']()[_0x1810('0x36')](function(_0x12b646){if(!_0x12b646){throw new db[(_0x1810('0x73'))][(_0x1810('0x74'))](_0x1810('0x75'));}_0x4ead8f=_[_0x1810('0x76')](_[_0x1810('0x45')](_0x12b646),[_0x1810('0x77'),'updatedAt']);_0x59b353=_[_0x1810('0x76')](_[_0x1810('0x45')](_0x12b646),[_0x1810('0x77'),'updatedAt',_0x1810('0x78'),_0x1810('0x79')]);if(_0x716907[_0x1810('0x5a')]['id']){delete _0x716907[_0x1810('0x5a')]['id'];}if(_[_0x1810('0x7a')](_0x716907['body']['from'])){throw new db[(_0x1810('0x73'))][(_0x1810('0x74'))]('from\x20is\x20mandatory');}if(_[_0x1810('0x7a')](_0x716907[_0x1810('0x5a')][_0x1810('0x5a')])||_0x716907['body'][_0x1810('0x5a')]===''){throw new db[(_0x1810('0x73'))][(_0x1810('0x74'))](_0x1810('0x7b'));}if(_[_0x1810('0x7a')](_0x716907['body'][_0x1810('0x7c')])){throw new db[(_0x1810('0x73'))]['ValidationError'](_0x1810('0x7d')+_0x59b353);}if(!_['includes'](_0x59b353,_0x716907['body'][_0x1810('0x7c')])){throw new db['Sequelize']['ValidationError'](_0x1810('0x7e')+_0x59b353);}_0x441c33[_0x716907[_0x1810('0x5a')][_0x1810('0x7c')]]=_0x716907[_0x1810('0x5a')][_0x1810('0x7f')];})[_0x1810('0x36')](function(){return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x716907[_0x1810('0x62')]['id']},'include':[{'model':db[_0x1810('0x80')],'as':'List','include':[{'model':db[_0x1810('0x72')],'as':'Contacts','where':_0x441c33,'limit':0x1,'order':[[_0x1810('0x81'),_0x1810('0x82')]]}]},{'model':db[_0x1810('0x83')],'as':_0x1810('0x84')}]});})[_0x1810('0x36')](handleEntityNotFound(_0x48a74c,null))['then'](function(_0x1d4ce3){if(_0x1d4ce3&&_0x1d4ce3[_0x1810('0x85')]){_0x27c482[_0x1810('0x86')]=_0x1d4ce3;_0x27c482[_0x1810('0x87')]=_0x1d4ce3[_0x1810('0x84')];_0x27c482[_0x1810('0x88')]=_0x1d4ce3['List'];_0x27c482['applications']=_[_0x1810('0x89')](_0x27c482[_0x1810('0x87')],[_0x1810('0x8a')],['asc']);if(_0x27c482['account'][_0x1810('0x84')]){delete _0x27c482[_0x1810('0x86')][_0x1810('0x84')];}if(_0x27c482[_0x1810('0x86')][_0x1810('0x85')]&&_0x27c482['account']['List']['Contacts'][_0x1810('0x57')]){return _0x27c482[_0x1810('0x86')][_0x1810('0x85')][_0x1810('0x8b')][0x0];}var _0x81e2c7=_[_0x1810('0x1b')](_0x716907[_0x1810('0x5a')],{'firstName':_0x716907[_0x1810('0x5a')][_0x1810('0x7f')],'ListId':_0x1d4ce3[_0x1810('0x79')]});_0x81e2c7[_0x716907[_0x1810('0x5a')]['mapKey']]=_0x716907[_0x1810('0x5a')][_0x1810('0x7f')];return db[_0x1810('0x72')][_0x1810('0x59')](_0x81e2c7,{'fields':_0x4ead8f,'raw':!![]});}})['then'](handleEntityNotFound(_0x48a74c,null))['then'](function(_0x1545b2){_0x27c482[_0x1810('0x8c')]=_0x1545b2;if(_0x1545b2){var _0x45ff17={'ContactId':_0x1545b2['id'],'OpenchannelAccountId':_0x716907[_0x1810('0x62')]['id'],'from':(_0x1545b2[_0x1810('0x8d')]||'')+'\x20'+(_0x1545b2['lastName']||'')};var _0x2dd3a4={'OpenchannelAccountId':_0x716907['params']['id'],'closed':![]};if(_0x716907[_0x1810('0x5a')][_0x1810('0x8e')]){_0x2dd3a4[_0x1810('0x8e')]=_0x716907[_0x1810('0x5a')][_0x1810('0x8e')];return db[_0x1810('0x8f')][_0x1810('0x58')]({'where':_0x2dd3a4})[_0x1810('0x36')](function(_0xf719af){if(_0xf719af){return[_0xf719af,![]];}_0x45ff17[_0x1810('0x8e')]=_0x716907['body'][_0x1810('0x8e')];_0x45ff17[_0x1810('0x90')]=_0x716907[_0x1810('0x5a')][_0x1810('0x90')];return db[_0x1810('0x8f')][_0x1810('0x59')](_0x45ff17)[_0x1810('0x36')](function(_0x6dfac6){return[_0x6dfac6,!![]];});});}else{_0x2dd3a4[_0x1810('0x8e')]=null;}_0x2dd3a4['ContactId']=_0x1545b2['id'];return db[_0x1810('0x8f')][_0x1810('0x58')]({'where':_0x2dd3a4})['then'](function(_0x5212d0){if(_0x5212d0){return[_0x5212d0,![]];}return db[_0x1810('0x8f')]['create'](_0x45ff17)['then'](function(_0x283cb3){return[_0x283cb3,!![]];});});}})[_0x1810('0x91')](function(_0x459b5d,_0x17dadf){if(_0x459b5d){_0x208515=_0x17dadf;if(!_0x17dadf){var _0xd19717={'from':(_0x27c482['contact'][_0x1810('0x8d')]||'')+'\x20'+(_0x27c482[_0x1810('0x8c')][_0x1810('0x92')]||'')};if(_0x716907['body']['threadId']&&_0x716907['body'][_0x1810('0x93')]&&_0x716907[_0x1810('0x5a')][_0x1810('0x8e')]!=_0x716907['body'][_0x1810('0x93')]){_0xd19717[_0x1810('0x8e')]=_0x716907[_0x1810('0x5a')][_0x1810('0x93')];}return _0x459b5d[_0x1810('0x35')](_0xd19717);}else{return _0x459b5d;}}})['then'](function(_0x5b639e){_0x27c482[_0x1810('0x94')]=_0x5b639e[_0x1810('0x37')]({'plain':!![]});_0x27c482[_0x1810('0x94')][_0x1810('0x95')]=_0x208515;if(_0x27c482['interaction'][_0x1810('0x95')]){if(_0x27c482[_0x1810('0x86')][_0x1810('0x96')]){_0x27c482[_0x1810('0x87')]['push']({'id':0x0,'priority':_0x27c482[_0x1810('0x87')][_0x1810('0x57')]+0x1,'app':_0x1810('0x97'),'appdata':_0x1810('0x98'),'interval':_0x1810('0x99')});}}return db[_0x1810('0x9a')]['create']({'body':_0x716907['body'][_0x1810('0x5a')],'OpenchannelAccountId':_0x716907['params']['id'],'OpenchannelInteractionId':_0x5b639e['id'],'direction':'in','ContactId':_0x27c482[_0x1810('0x8c')]['id'],'AttachmentId':_0x716907[_0x1810('0x5a')]['AttachmentId']});})[_0x1810('0x36')](function(_0x2c667d){_0x27c482[_0x1810('0x28')]=_0x2c667d;if(_0x27c482[_0x1810('0x94')][_0x1810('0x9b')]){return db[_0x1810('0x9c')][_0x1810('0x58')]({'attributes':['id',_0x1810('0x3d')],'where':{'id':_0x27c482[_0x1810('0x94')][_0x1810('0x9b')]}})['then'](function(_0x13526b){if(_0x13526b){_0x27c482[_0x1810('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1810('0x9d'),'appdata':_0x13526b['name']+','+(_0x27c482[_0x1810('0x86')][_0x1810('0x9e')]||0xa),'interval':_0x1810('0x99')});_0x27c482[_0x1810('0x9f')]=![];}return respondWithRpcPromise(_0x1810('0xa0'),'startRouting',_0x27c482);});}return respondWithRpcPromise(_0x1810('0xa0'),_0x1810('0xa1'),_0x27c482);})['then'](function(_0x405f11){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1810('0x71'),'message':_0x405f11},client9002);return _0x405f11;})[_0x1810('0x36')](respondWithResult(_0x48a74c,null))[_0x1810('0x2a')](handleError(_0x48a74c,null));};exports[_0x1810('0xa2')]=function(_0x2bb1d2,_0x53e8ed){var _0x25e2db=_0x2bb1d2['params']['id'];var _0x3e6ef9=_0x2bb1d2['body'];var _0x4e5e0d=0xc8;var _0xa578ae=null;return db[_0x1810('0xa3')][_0x1810('0xa4')]({'isolationLevel':db[_0x1810('0xa3')]['Transaction'][_0x1810('0xa5')]['READ_COMMITTED']},function(_0x1d957b){return db[_0x1810('0x52')][_0x1810('0x67')]({'where':{'id':_0x25e2db},'transaction':_0x1d957b})[_0x1810('0x36')](function(_0x494dd3){if(_0x494dd3){return db[_0x1810('0x83')][_0x1810('0x3a')]({'where':{'OpenchannelAccountId':_0x25e2db},'transaction':_0x1d957b})[_0x1810('0x36')](function(){var _0x98a528=_[_0x1810('0x40')](_0x3e6ef9,function(_0x483db0){_0x483db0[_0x1810('0x6a')]=_0x25e2db;return _0x483db0;});return db['OpenchannelApplication']['bulkCreate'](_0x98a528,{'transaction':_0x1d957b});});}else{_0x4e5e0d=0x194;_0xa578ae=[];}});})[_0x1810('0x36')](function(){if(_0x4e5e0d!==0x194){return db[_0x1810('0x83')][_0x1810('0xa6')]({'where':{'OpenchannelAccountId':_0x25e2db},'order':'priority'})['then'](function(_0x281028){_0xa578ae=_0x281028;});}})[_0x1810('0x2a')](function(_0x2b6d5a){_0x4e5e0d=0x1f4;logger['error'](_0x2b6d5a[_0x1810('0x3c')]);if(_0x2b6d5a[_0x1810('0x3d')]){delete _0x2b6d5a['name'];}_0xa578ae=_0x2b6d5a;})[_0x1810('0xa7')](function(){if(_0xa578ae===null){_0x53e8ed[_0x1810('0x3b')](_0x4e5e0d);}else{if(_0x4e5e0d===0x1f4){_0x53e8ed[_0x1810('0x2b')](_0x4e5e0d)[_0x1810('0x3e')](_0xa578ae);}else{_0x53e8ed[_0x1810('0x2b')](_0x4e5e0d)[_0x1810('0x32')](_0xa578ae);}}});};exports[_0x1810('0xa8')]=function(_0x1969c4,_0x580201,_0x262bd5){var _0x3ae7eb={};var _0x339bbd={};var _0x298b01;var _0x5b918f;return db[_0x1810('0x52')][_0x1810('0x67')]({'where':{'id':_0x1969c4['params']['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x580201,null))[_0x1810('0x36')](function(_0x3e51fe){if(_0x3e51fe){_0x298b01=_0x3e51fe;_0x339bbd[_0x1810('0x49')]=_[_0x1810('0x45')](db[_0x1810('0x83')][_0x1810('0x41')]);_0x339bbd[_0x1810('0x46')]=_[_0x1810('0x45')](_0x1969c4['query']);_0x339bbd['filters']=_[_0x1810('0x48')](_0x339bbd['model'],_0x339bbd[_0x1810('0x46')]);_0x3ae7eb[_0x1810('0x4a')]=_[_0x1810('0x48')](_0x339bbd['model'],qs[_0x1810('0x4b')](_0x1969c4['query'][_0x1810('0x4b')]));_0x3ae7eb[_0x1810('0x4a')]=_0x3ae7eb[_0x1810('0x4a')][_0x1810('0x57')]?_0x3ae7eb[_0x1810('0x4a')]:_0x339bbd[_0x1810('0x49')];_0x3ae7eb[_0x1810('0x6e')]=qs[_0x1810('0x4c')](_0x1969c4[_0x1810('0x46')][_0x1810('0x4c')]);_0x3ae7eb[_0x1810('0x4d')]=qs[_0x1810('0x47')](_[_0x1810('0x4e')](_0x1969c4['query'],_0x339bbd[_0x1810('0x47')]));if(_0x1969c4[_0x1810('0x46')][_0x1810('0x4f')]){_0x3ae7eb[_0x1810('0x4d')]=_[_0x1810('0x50')](_0x3ae7eb[_0x1810('0x4d')],{'$or':_[_0x1810('0x40')](_0x3ae7eb[_0x1810('0x4a')],function(_0x7c2f32){var _0x1551b9={};_0x1551b9[_0x7c2f32]={'$like':'%'+_0x1969c4[_0x1810('0x46')]['filter']+'%'};return _0x1551b9;})});}_0x3ae7eb=_[_0x1810('0x50')]({},_0x3ae7eb,_0x1969c4[_0x1810('0x51')]);return _0x298b01['getApplications'](_0x3ae7eb);}})[_0x1810('0x36')](function(_0x1e5bf3){if(_0x1e5bf3){_0x5b918f=_0x1e5bf3[_0x1810('0x57')];if(!_0x1969c4[_0x1810('0x46')][_0x1810('0x68')](_0x1810('0x69'))){_0x3ae7eb[_0x1810('0x2f')]=qs[_0x1810('0x2f')](_0x1969c4[_0x1810('0x46')][_0x1810('0x2f')]);_0x3ae7eb[_0x1810('0x2d')]=qs[_0x1810('0x2d')](_0x1969c4[_0x1810('0x46')][_0x1810('0x2d')]);}return _0x298b01[_0x1810('0xa8')](_0x3ae7eb);}})[_0x1810('0x36')](function(_0x38aa27){if(_0x38aa27){return _0x38aa27?{'count':_0x5b918f,'rows':_0x38aa27}:null;}})[_0x1810('0x36')](respondWithResult(_0x580201,null))[_0x1810('0x2a')](handleError(_0x580201,null));};exports[_0x1810('0xa9')]=function(_0x724bac,_0x3776a0,_0x252234){var _0x5293c6={'raw':![],'where':{}};var _0xd7ecd5={};var _0xe96ff1={'count':0x0,'rows':[]};return db[_0x1810('0x52')][_0x1810('0x67')]({'where':{'id':_0x724bac[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x3776a0,null))[_0x1810('0x36')](function(_0x4f0546){if(_0x4f0546){_0xd7ecd5[_0x1810('0x49')]=_['keys'](db[_0x1810('0x8f')][_0x1810('0x41')]);_0xd7ecd5['query']=_[_0x1810('0x45')](_0x724bac[_0x1810('0x46')]);_0xd7ecd5[_0x1810('0x47')]=_[_0x1810('0x48')](_0xd7ecd5['model'],_0xd7ecd5['query']);_0x5293c6['attributes']=_[_0x1810('0x48')](_0xd7ecd5[_0x1810('0x49')],qs['fields'](_0x724bac[_0x1810('0x46')][_0x1810('0x4b')]));_0x5293c6[_0x1810('0x4a')]=_0x5293c6['attributes'][_0x1810('0x57')]?_0x5293c6['attributes']:_0xd7ecd5[_0x1810('0x49')];if(!_0x724bac[_0x1810('0x46')][_0x1810('0x68')](_0x1810('0x69'))){_0x5293c6[_0x1810('0x2f')]=qs[_0x1810('0x2f')](_0x724bac[_0x1810('0x46')][_0x1810('0x2f')]);_0x5293c6[_0x1810('0x2d')]=qs[_0x1810('0x2d')](_0x724bac['query'][_0x1810('0x2d')]);}_0x5293c6[_0x1810('0x6e')]=qs[_0x1810('0x4c')](_0x724bac['query'][_0x1810('0x4c')]);_0x5293c6[_0x1810('0x4d')]=qs[_0x1810('0x47')](_[_0x1810('0x4e')](_0x724bac[_0x1810('0x46')],_0xd7ecd5['filters']));_0x5293c6[_0x1810('0x4d')][_0x1810('0x6a')]=_0x4f0546['id'];if(_0x724bac[_0x1810('0x46')]['filter']){_0x5293c6['where']=_[_0x1810('0x50')](_0x5293c6[_0x1810('0x4d')],{'$or':_[_0x1810('0x40')](_0x5293c6[_0x1810('0x4a')],function(_0x32670a){var _0x3dfc16={};_0x3dfc16[_0x32670a]={'$like':'%'+_0x724bac[_0x1810('0x46')][_0x1810('0x4f')]+'%'};return _0x3dfc16;})});}_0x5293c6=_[_0x1810('0x50')]({},_0x5293c6,_0x724bac[_0x1810('0x51')]);return db['OpenchannelInteraction'][_0x1810('0x30')]({'where':_0x5293c6[_0x1810('0x4d')]})['then'](function(_0x56f9f2){_0xe96ff1[_0x1810('0x30')]=_0x56f9f2;if(_0x724bac[_0x1810('0x46')]['includeAll']){_0x5293c6[_0x1810('0x53')]=[{'model':db[_0x1810('0x72')],'as':_0x1810('0xaa'),'required':![]},{'model':db[_0x1810('0x9c')],'as':_0x1810('0xab'),'attributes':[_0x1810('0x3d'),_0x1810('0xac'),'internal'],'required':![]},{'model':db[_0x1810('0xad')],'as':'Tags','attributes':['id',_0x1810('0x3d'),'color'],'where':_0x724bac['query']['tag']?{'id':_0x724bac[_0x1810('0x46')][_0x1810('0xae')]}:undefined,'required':_0x724bac[_0x1810('0x46')][_0x1810('0xae')]?!![]:![]}];}return db[_0x1810('0x8f')][_0x1810('0x54')](_0x5293c6);})[_0x1810('0x36')](function(_0x116743){_0xe96ff1[_0x1810('0x55')]=_0x116743;return _0xe96ff1;});}})['then'](respondWithFilteredResult(_0x3776a0,_0x5293c6))[_0x1810('0x2a')](handleError(_0x3776a0,null));};exports['addAgents']=function(_0x58e3b4,_0x254a0f,_0x4c0cda){return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x58e3b4['params']['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x254a0f,null))[_0x1810('0x36')](function(_0x5e713c){if(_0x5e713c){return _0x5e713c['addAgents'](_0x58e3b4[_0x1810('0x5a')][_0x1810('0x6b')],_[_0x1810('0xaf')](_0x58e3b4[_0x1810('0x5a')],['ids','id'])||{})['spread'](function(_0x15ebc9){for(var _0x2d77c4=0x0;_0x2d77c4<_0x58e3b4[_0x1810('0x5a')][_0x1810('0x6b')][_0x1810('0x57')];_0x2d77c4+=0x1){socket['emit'](_0x1810('0xb0'),{'UserId':Number(_0x58e3b4[_0x1810('0x5a')][_0x1810('0x6b')][_0x2d77c4]),'OpenchannelAccountId':Number(_0x58e3b4[_0x1810('0x62')]['id'])});}return _0x15ebc9;});}})[_0x1810('0x36')](respondWithResult(_0x254a0f,null))[_0x1810('0x2a')](handleError(_0x254a0f,null));};exports[_0x1810('0xb1')]=function(_0x2eb248,_0x30cef9,_0x1212dd){return db[_0x1810('0x52')][_0x1810('0x58')]({'where':{'id':_0x2eb248[_0x1810('0x62')]['id']}})['then'](handleEntityNotFound(_0x30cef9,null))[_0x1810('0x36')](function(_0x46d564){if(_0x46d564){return _0x46d564[_0x1810('0xb1')](_0x2eb248[_0x1810('0x46')][_0x1810('0x6b')])['then'](function(){if(_[_0x1810('0xb2')](_0x2eb248['query'][_0x1810('0x6b')])){for(var _0x176226=0x0;_0x176226<_0x2eb248[_0x1810('0x46')][_0x1810('0x6b')]['length'];_0x176226+=0x1){socket['emit'](_0x1810('0xb3'),{'UserId':Number(_0x2eb248[_0x1810('0x46')]['ids'][_0x176226]),'OpenchannelAccountId':Number(_0x2eb248[_0x1810('0x62')]['id'])});}}else{socket[_0x1810('0xb4')](_0x1810('0xb3'),{'UserId':Number(_0x2eb248[_0x1810('0x46')]['ids']),'OpenchannelAccountId':Number(_0x2eb248[_0x1810('0x62')]['id'])});}});}})[_0x1810('0x36')](respondWithStatusCode(_0x30cef9,null))['catch'](handleError(_0x30cef9,null));};exports[_0x1810('0xb5')]=function(_0x141a71,_0x278349,_0x1e4fe1){var _0x348228={};var _0x1d00ad={};var _0x3610a4;var _0x253103;return db['OpenchannelAccount'][_0x1810('0x67')]({'where':{'id':_0x141a71[_0x1810('0x62')]['id']}})['then'](handleEntityNotFound(_0x278349,null))[_0x1810('0x36')](function(_0x3f2711){if(_0x3f2711){_0x3610a4=_0x3f2711;_0x1d00ad[_0x1810('0x49')]=_[_0x1810('0x45')](db[_0x1810('0x9c')][_0x1810('0x41')]);_0x1d00ad[_0x1810('0x46')]=_['keys'](_0x141a71[_0x1810('0x46')]);_0x1d00ad[_0x1810('0x47')]=_[_0x1810('0x48')](_0x1d00ad[_0x1810('0x49')],_0x1d00ad['query']);_0x348228[_0x1810('0x4a')]=_[_0x1810('0x48')](_0x1d00ad[_0x1810('0x49')],qs['fields'](_0x141a71['query'][_0x1810('0x4b')]));_0x348228['attributes']=_0x348228[_0x1810('0x4a')][_0x1810('0x57')]?_0x348228['attributes']:_0x1d00ad[_0x1810('0x49')];_0x348228['order']=qs[_0x1810('0x4c')](_0x141a71[_0x1810('0x46')]['sort']);_0x348228[_0x1810('0x4d')]=qs['filters'](_[_0x1810('0x4e')](_0x141a71[_0x1810('0x46')],_0x1d00ad[_0x1810('0x47')]));if(_0x141a71[_0x1810('0x46')][_0x1810('0x4f')]){_0x348228[_0x1810('0x4d')]=_[_0x1810('0x50')](_0x348228[_0x1810('0x4d')],{'$or':_['map'](_0x348228['attributes'],function(_0x5bb353){var _0x11dd6a={};_0x11dd6a[_0x5bb353]={'$like':'%'+_0x141a71[_0x1810('0x46')]['filter']+'%'};return _0x11dd6a;})});}_0x348228=_[_0x1810('0x50')]({},_0x348228,_0x141a71[_0x1810('0x51')]);return _0x3610a4[_0x1810('0xb5')](_0x348228);}})[_0x1810('0x36')](function(_0x1670b5){if(_0x1670b5){_0x253103=_0x1670b5[_0x1810('0x57')];if(!_0x141a71['query'][_0x1810('0x68')](_0x1810('0x69'))){_0x348228[_0x1810('0x2f')]=qs[_0x1810('0x2f')](_0x141a71[_0x1810('0x46')][_0x1810('0x2f')]);_0x348228[_0x1810('0x2d')]=qs[_0x1810('0x2d')](_0x141a71['query'][_0x1810('0x2d')]);}return _0x3610a4[_0x1810('0xb5')](_0x348228);}})[_0x1810('0x36')](function(_0xe2ae5f){if(_0xe2ae5f){return _0xe2ae5f?{'count':_0x253103,'rows':_0xe2ae5f}:null;}})[_0x1810('0x36')](respondWithResult(_0x278349,null))[_0x1810('0x2a')](handleError(_0x278349,null));};exports[_0x1810('0x3e')]=function(_0x302133,_0x578417,_0x2b7f1b){var _0x43b737,_0x26e77a,_0x2451b9;if(_[_0x1810('0x7a')](_0x302133[_0x1810('0x5a')][_0x1810('0x5a')])||_0x302133[_0x1810('0x5a')][_0x1810('0x5a')]===''){throw new db[(_0x1810('0x73'))][(_0x1810('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x302133[_0x1810('0x5a')]['to'])){}_0x43b737=_0x302133[_0x1810('0x5a')]['to'];return db[_0x1810('0x52')]['findOne']({'where':{'id':_0x302133[_0x1810('0x62')]['id']}})[_0x1810('0x36')](handleEntityNotFound(_0x578417,null))['then'](function(_0x13ce0e){if(_0x13ce0e){return db['OpenchannelAccount'][_0x1810('0x58')]({'where':{'id':_0x13ce0e['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1810('0x72')],'as':'Contacts','where':{[_0x13ce0e[_0x1810('0x7c')]]:_0x43b737},'limit':0x1,'order':[[_0x1810('0x81'),_0x1810('0x82')]]}]}]})['then'](handleEntityNotFound(_0x578417,null))[_0x1810('0x36')](function(_0x42fbd2){if(_0x42fbd2&&_0x42fbd2[_0x1810('0x85')]){_0x26e77a=_0x42fbd2[_0x1810('0x37')]({'plain':!![]});if(_0x26e77a[_0x1810('0x85')]&&_0x26e77a[_0x1810('0x85')]['Contacts']['length']){return _0x26e77a['List'][_0x1810('0x8b')][0x0];}return db[_0x1810('0x72')][_0x1810('0x59')](_['defaults'](_0x302133[_0x1810('0x5a')],{'firstName':_0x43b737,[_0x42fbd2[_0x1810('0x7c')]]:_0x43b737,'phone':_0x43b737,'ListId':_0x26e77a[_0x1810('0x79')]}));}})[_0x1810('0x36')](handleEntityNotFound(_0x578417,null))[_0x1810('0x36')](function(_0x21da0b){if(_0x21da0b){_0x2451b9=_0x21da0b;return db[_0x1810('0x8f')]['find']({'where':{'ContactId':_0x2451b9['id'],'closed':![],'OpenchannelAccountId':_0x26e77a['id']}})[_0x1810('0x36')](function(_0x4336e9){if(_0x4336e9){return[_0x4336e9,![]];}return db[_0x1810('0x8f')][_0x1810('0x59')]({'UserId':_0x302133['user']['id'],'ContactId':_0x2451b9['id'],'OpenchannelAccountId':_0x26e77a['id'],'lastMsgDirection':'out','Messages':[_[_0x1810('0x50')](_0x302133['body'],{'read':![],'body':_0x302133[_0x1810('0x5a')][_0x1810('0x5a')],'OpenchannelAccountId':_0x26e77a['id'],'UserId':_0x302133['user']['id'],'ContactId':_0x2451b9['id']})]},{'include':[{'model':db[_0x1810('0x9a')],'as':_0x1810('0xb6')}]})[_0x1810('0x36')](function(_0x2f532c){return[_0x2f532c,!![]];});});}})[_0x1810('0x91')](function(_0x3307d3,_0x1e63c7){if(_0x1e63c7){return _0x3307d3;}return db[_0x1810('0x9a')]['create'](_[_0x1810('0x50')](_0x302133['body'],{'read':![],'body':_0x302133[_0x1810('0x5a')][_0x1810('0x5a')],'OpenchannelAccountId':_0x26e77a['id'],'OpenchannelInteractionId':_0x3307d3['id'],'UserId':_0x302133['user']['id'],'ContactId':_0x2451b9['id']}))[_0x1810('0x36')](function(_0xe33250){_0x3307d3['dataValues'][_0x1810('0xb6')]=[];_0x3307d3[_0x1810('0xb7')][_0x1810('0xb6')][_0x1810('0xb8')](_0xe33250[_0x1810('0xb7')]);return _0x3307d3;});});}})['then'](respondWithResult(_0x578417,null))[_0x1810('0x2a')](handleError(_0x578417,null));}; \ No newline at end of file +var _0xde96=['rows','show','params','Pause','mandatoryDispositionPause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','priority','asc','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','User','Owner','fullname','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','map','OpenchannelAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde96,0x124));var _0x6de9=function(_0x76e6f1,_0x39dc67){_0x76e6f1=_0x76e6f1-0x0;var _0x59a36f=_0xde96[_0x76e6f1];return _0x59a36f;};'use strict';var emlformat=require(_0x6de9('0x0'));var rimraf=require(_0x6de9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6de9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6de9('0x3'));var util=require(_0x6de9('0x4'));var path=require(_0x6de9('0x5'));var sox=require(_0x6de9('0x6'));var csv=require(_0x6de9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6de9('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6de9('0x9'));var jsforce=require(_0x6de9('0xa'));var deskjs=require(_0x6de9('0xb'));var toCsv=require(_0x6de9('0x7'));var querystring=require(_0x6de9('0xc'));var Papa=require(_0x6de9('0xd'));var Redis=require('ioredis');var authService=require(_0x6de9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6de9('0xf'));var hardwareService=require(_0x6de9('0x10'));var logger=require(_0x6de9('0x11'))('api');var utils=require(_0x6de9('0x12'));var config=require(_0x6de9('0x13'));var licenseUtil=require(_0x6de9('0x14'));var db=require(_0x6de9('0x15'))['db'];config['redis']=_[_0x6de9('0x16')](config[_0x6de9('0x17')],{'host':_0x6de9('0x18'),'port':0x18eb});var socket=require(_0x6de9('0x19'))(new Redis(config[_0x6de9('0x17')]));require(_0x6de9('0x1a'))[_0x6de9('0x1b')](socket);var jayson=require(_0x6de9('0x1c'));var client=jayson[_0x6de9('0x1d')][_0x6de9('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x6de9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x170c09,_0x1c090b,_0x1571f1,_0x39f7fb){return new BPromise(function(_0x58bfab,_0x22adee){var _0x3ad4f2=_0x39f7fb||client;return _0x3ad4f2[_0x6de9('0x1f')](_0x170c09,_0x1571f1)[_0x6de9('0x20')](function(_0xb97164){logger[_0x6de9('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x1c090b,'request\x20sent');logger[_0x6de9('0x22')](_0x6de9('0x23'),_0x1c090b,_0x6de9('0x24'),JSON['stringify'](_0xb97164));if(_0xb97164[_0x6de9('0x25')]){if(_0xb97164[_0x6de9('0x25')][_0x6de9('0x26')]===0x1f4){logger[_0x6de9('0x25')](_0x6de9('0x27'),_0x1c090b,_0xb97164[_0x6de9('0x25')][_0x6de9('0x28')]);return _0x22adee(_0xb97164[_0x6de9('0x25')][_0x6de9('0x28')]);}logger[_0x6de9('0x25')](_0x6de9('0x27'),_0x1c090b,_0xb97164[_0x6de9('0x25')]['message']);return _0x58bfab(_0xb97164[_0x6de9('0x25')][_0x6de9('0x28')]);}else{logger[_0x6de9('0x21')](_0x6de9('0x27'),_0x1c090b,_0x6de9('0x24'));_0x58bfab(_0xb97164['result'][_0x6de9('0x28')]);}})[_0x6de9('0x29')](function(_0x2f44d1){logger[_0x6de9('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x1c090b,_0x2f44d1);_0x22adee(_0x2f44d1);});});}function respondWithStatusCode(_0x476321,_0x4e09c2){_0x4e09c2=_0x4e09c2||0xcc;return function(_0x435bea){if(_0x435bea){return _0x476321[_0x6de9('0x2a')](_0x4e09c2);}return _0x476321['status'](_0x4e09c2)['end']();};}function respondWithResult(_0x540c9b,_0x2e3b81){_0x2e3b81=_0x2e3b81||0xc8;return function(_0x4f337e){if(_0x4f337e){return _0x540c9b[_0x6de9('0x2b')](_0x2e3b81)[_0x6de9('0x2c')](_0x4f337e);}};}function respondWithFilteredResult(_0x8b20dc,_0x2a6654){return function(_0x32525d){if(_0x32525d){var _0x50705e=typeof _0x2a6654['offset']===_0x6de9('0x2d')&&typeof _0x2a6654[_0x6de9('0x2e')]==='undefined';var _0x1c94c3=_0x32525d[_0x6de9('0x2f')];var _0x31091c=_0x50705e?0x0:_0x2a6654[_0x6de9('0x30')];var _0x3f8b75=_0x50705e?_0x32525d[_0x6de9('0x2f')]:_0x2a6654[_0x6de9('0x30')]+_0x2a6654[_0x6de9('0x2e')];var _0x4574ed;if(_0x3f8b75>=_0x1c94c3){_0x3f8b75=_0x1c94c3;_0x4574ed=0xc8;}else{_0x4574ed=0xce;}_0x8b20dc[_0x6de9('0x2b')](_0x4574ed);return _0x8b20dc[_0x6de9('0x31')](_0x6de9('0x32'),_0x31091c+'-'+_0x3f8b75+'/'+_0x1c94c3)[_0x6de9('0x2c')](_0x32525d);}return null;};}function patchUpdates(_0xc2d9e){return function(_0x14f0f8){try{jsonpatch[_0x6de9('0x33')](_0x14f0f8,_0xc2d9e,!![]);}catch(_0x4e7e60){return BPromise['reject'](_0x4e7e60);}return _0x14f0f8[_0x6de9('0x34')]();};}function saveUpdates(_0x56f3a8,_0x5b2663){return function(_0x33411d){if(_0x33411d){return _0x33411d['update'](_0x56f3a8)[_0x6de9('0x20')](function(_0x2a26d3){return _0x2a26d3;});}return null;};}function removeEntity(_0x15681d,_0xf48066){return function(_0x26563f){if(_0x26563f){return _0x26563f[_0x6de9('0x35')]()[_0x6de9('0x20')](function(){var _0x3fc4d8=_0x26563f[_0x6de9('0x36')]({'plain':!![]});var _0x4e95ea=_0x6de9('0x37');return db[_0x6de9('0x38')][_0x6de9('0x35')]({'where':{'type':_0x4e95ea,'resourceId':_0x3fc4d8['id']}})[_0x6de9('0x20')](function(){return _0x26563f;});})[_0x6de9('0x20')](function(){_0x15681d[_0x6de9('0x2b')](0xcc)[_0x6de9('0x39')]();});}};}function handleEntityNotFound(_0x3a9925,_0x174be6){return function(_0x17f8fc){if(!_0x17f8fc){_0x3a9925[_0x6de9('0x2a')](0x194);}return _0x17f8fc;};}function handleError(_0x297b29,_0x2cce23){_0x2cce23=_0x2cce23||0x1f4;return function(_0x122ee2){logger[_0x6de9('0x25')](_0x122ee2[_0x6de9('0x3a')]);if(_0x122ee2[_0x6de9('0x3b')]){delete _0x122ee2['name'];}_0x297b29['status'](_0x2cce23)[_0x6de9('0x3c')](_0x122ee2);};}exports[_0x6de9('0x3d')]=function(_0x29ad8a,_0x5c79cb){var _0xaf14af={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x272ca7={},_0x51083b={'count':0x0,'rows':[]};var _0x15da0c=_[_0x6de9('0x3e')](db[_0x6de9('0x3f')][_0x6de9('0x40')],function(_0x423433){return{'name':_0x423433['fieldName'],'type':_0x423433['type'][_0x6de9('0x41')]};});_0x272ca7[_0x6de9('0x42')]=_[_0x6de9('0x3e')](_0x15da0c,_0x6de9('0x3b'));_0x272ca7['query']=_[_0x6de9('0x43')](_0x29ad8a[_0x6de9('0x44')]);_0x272ca7[_0x6de9('0x45')]=_[_0x6de9('0x46')](_0x272ca7[_0x6de9('0x42')],_0x272ca7[_0x6de9('0x44')]);_0xaf14af[_0x6de9('0x47')]=_[_0x6de9('0x46')](_0x272ca7[_0x6de9('0x42')],qs[_0x6de9('0x48')](_0x29ad8a[_0x6de9('0x44')][_0x6de9('0x48')]));_0xaf14af[_0x6de9('0x47')]=_0xaf14af['attributes'][_0x6de9('0x49')]?_0xaf14af[_0x6de9('0x47')]:_0x272ca7[_0x6de9('0x42')];if(!_0x29ad8a['query'][_0x6de9('0x4a')](_0x6de9('0x4b'))){_0xaf14af['limit']=qs[_0x6de9('0x2e')](_0x29ad8a[_0x6de9('0x44')][_0x6de9('0x2e')]);_0xaf14af[_0x6de9('0x30')]=qs[_0x6de9('0x30')](_0x29ad8a[_0x6de9('0x44')][_0x6de9('0x30')]);}_0xaf14af[_0x6de9('0x4c')]=qs[_0x6de9('0x4d')](_0x29ad8a[_0x6de9('0x44')]['sort']);_0xaf14af[_0x6de9('0x4e')]=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0x29ad8a[_0x6de9('0x44')],_0x272ca7[_0x6de9('0x45')]),_0x15da0c);if(_0x29ad8a['query'][_0x6de9('0x50')]){_0xaf14af[_0x6de9('0x4e')]=_[_0x6de9('0x51')](_0xaf14af[_0x6de9('0x4e')],{'$or':_['map'](_0x15da0c,function(_0x222f5a){if(_0x222f5a[_0x6de9('0x52')]!==_0x6de9('0x53')){var _0x2bdb21={};_0x2bdb21[_0x222f5a[_0x6de9('0x3b')]]={'$like':'%'+_0x29ad8a[_0x6de9('0x44')]['filter']+'%'};return _0x2bdb21;}})});}_0xaf14af=_[_0x6de9('0x51')]({},_0xaf14af,_0x29ad8a[_0x6de9('0x54')]);var _0x12f4c5={'where':_0xaf14af[_0x6de9('0x4e')]};return db[_0x6de9('0x3f')]['count'](_0x12f4c5)[_0x6de9('0x20')](function(_0x80617a){_0x51083b['count']=_0x80617a;if(_0x29ad8a[_0x6de9('0x44')][_0x6de9('0x55')]){_0xaf14af[_0x6de9('0x56')]=[{'all':!![]}];}return db[_0x6de9('0x3f')][_0x6de9('0x57')](_0xaf14af);})['then'](function(_0x16a6d2){_0x51083b[_0x6de9('0x58')]=_0x16a6d2;return _0x51083b;})['then'](respondWithFilteredResult(_0x5c79cb,_0xaf14af))['catch'](handleError(_0x5c79cb,null));};exports[_0x6de9('0x59')]=function(_0x40e2ea,_0x39c5ad){var _0x4aa3e2={'raw':![],'where':{'id':_0x40e2ea[_0x6de9('0x5a')]['id']},'include':[{'model':db[_0x6de9('0x5b')],'as':_0x6de9('0x5c')}]},_0x446448={};_0x446448[_0x6de9('0x42')]=_['keys'](db[_0x6de9('0x3f')]['rawAttributes']);_0x446448[_0x6de9('0x44')]=_[_0x6de9('0x43')](_0x40e2ea[_0x6de9('0x44')]);_0x446448[_0x6de9('0x45')]=_[_0x6de9('0x46')](_0x446448[_0x6de9('0x42')],_0x446448[_0x6de9('0x44')]);_0x4aa3e2[_0x6de9('0x47')]=_[_0x6de9('0x46')](_0x446448['model'],qs[_0x6de9('0x48')](_0x40e2ea[_0x6de9('0x44')][_0x6de9('0x48')]));_0x4aa3e2[_0x6de9('0x47')]=_0x4aa3e2[_0x6de9('0x47')][_0x6de9('0x49')]?_0x4aa3e2[_0x6de9('0x47')]:_0x446448[_0x6de9('0x42')];if(_0x40e2ea['query'][_0x6de9('0x55')]){_0x4aa3e2['include']=[{'all':!![]}];}_0x4aa3e2=_[_0x6de9('0x51')]({},_0x4aa3e2,_0x40e2ea['options']);return db[_0x6de9('0x3f')][_0x6de9('0x5d')](_0x4aa3e2)[_0x6de9('0x20')](handleEntityNotFound(_0x39c5ad,null))[_0x6de9('0x20')](respondWithResult(_0x39c5ad,null))[_0x6de9('0x29')](handleError(_0x39c5ad,null));};exports['create']=function(_0x4afd4b,_0x5e1da9){return db[_0x6de9('0x3f')][_0x6de9('0x5e')](_0x4afd4b['body'],{})['then'](function(_0x2085a4){var _0x22b3c3=_0x4afd4b[_0x6de9('0x5f')]['get']({'plain':!![]});if(!_0x22b3c3)throw new Error(_0x6de9('0x60'));if(_0x22b3c3[_0x6de9('0x61')]==='user'){var _0x15d40a=_0x2085a4[_0x6de9('0x36')]({'plain':!![]});var _0x4aa961=_0x6de9('0x37');return db[_0x6de9('0x62')][_0x6de9('0x5d')]({'where':{'name':_0x4aa961,'userProfileId':_0x22b3c3[_0x6de9('0x63')]},'raw':!![]})['then'](function(_0x353b78){if(_0x353b78&&_0x353b78[_0x6de9('0x64')]===0x0){return db[_0x6de9('0x38')][_0x6de9('0x5e')]({'name':_0x15d40a['name'],'resourceId':_0x15d40a['id'],'type':_0x353b78[_0x6de9('0x3b')],'sectionId':_0x353b78['id']},{})[_0x6de9('0x20')](function(){return _0x2085a4;});}else{return _0x2085a4;}})[_0x6de9('0x29')](function(_0x12f1f7){logger[_0x6de9('0x25')](_0x6de9('0x65'),_0x12f1f7);throw _0x12f1f7;});}return _0x2085a4;})[_0x6de9('0x20')](respondWithResult(_0x5e1da9,0xc9))[_0x6de9('0x29')](handleError(_0x5e1da9,null));};exports[_0x6de9('0x66')]=function(_0x3e142b,_0x386bd6){if(_0x3e142b['body']['id']){delete _0x3e142b[_0x6de9('0x67')]['id'];}return db['OpenchannelAccount'][_0x6de9('0x5d')]({'where':{'id':_0x3e142b[_0x6de9('0x5a')]['id']},'include':[{'model':db[_0x6de9('0x5b')],'as':_0x6de9('0x5c')}]})[_0x6de9('0x20')](handleEntityNotFound(_0x386bd6,null))[_0x6de9('0x20')](saveUpdates(_0x3e142b[_0x6de9('0x67')],null))[_0x6de9('0x20')](respondWithResult(_0x386bd6,null))[_0x6de9('0x29')](handleError(_0x386bd6,null));};exports[_0x6de9('0x35')]=function(_0x455a8b,_0x113cd5){return db['OpenchannelAccount'][_0x6de9('0x5d')]({'where':{'id':_0x455a8b[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x113cd5,null))[_0x6de9('0x20')](removeEntity(_0x113cd5,null))[_0x6de9('0x29')](handleError(_0x113cd5,null));};exports[_0x6de9('0x68')]=function(_0x17ad52,_0x2bca48){return db[_0x6de9('0x3f')][_0x6de9('0x68')]()[_0x6de9('0x20')](respondWithResult(_0x2bca48,null))['catch'](handleError(_0x2bca48,null));};exports[_0x6de9('0x69')]=function(_0x471194,_0x23cb1c,_0x38c504){if(_0x471194[_0x6de9('0x67')]['id']){delete _0x471194[_0x6de9('0x67')]['id'];}return db[_0x6de9('0x3f')]['find']({'where':{'id':_0x471194[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x23cb1c,null))[_0x6de9('0x20')](function(_0x4acfe9){if(_0x4acfe9){_0x471194[_0x6de9('0x67')][_0x6de9('0x6a')]=_0x4acfe9['id'];return db[_0x6de9('0x6b')][_0x6de9('0x5e')](_0x471194[_0x6de9('0x67')]);}})['then'](respondWithResult(_0x23cb1c,null))['catch'](handleError(_0x23cb1c,null));};exports[_0x6de9('0x6c')]=function(_0x1597aa,_0x538917,_0x19b4ea){var _0x2ceefd={'raw':![],'where':{}};var _0x2bd43c={};var _0x263a0d={'count':0x0,'rows':[]};return db[_0x6de9('0x3f')]['findOne']({'where':{'id':_0x1597aa[_0x6de9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x538917,null))['then'](function(_0x4d5582){if(_0x4d5582){_0x2bd43c['model']=_[_0x6de9('0x43')](db[_0x6de9('0x6b')][_0x6de9('0x40')]);_0x2bd43c[_0x6de9('0x44')]=_['keys'](_0x1597aa['query']);_0x2bd43c[_0x6de9('0x45')]=_['intersection'](_0x2bd43c[_0x6de9('0x42')],_0x2bd43c['query']);_0x2ceefd[_0x6de9('0x47')]=_['intersection'](_0x2bd43c[_0x6de9('0x42')],qs['fields'](_0x1597aa['query'][_0x6de9('0x48')]));_0x2ceefd[_0x6de9('0x47')]=_0x2ceefd[_0x6de9('0x47')][_0x6de9('0x49')]?_0x2ceefd[_0x6de9('0x47')]:_0x2bd43c['model'];if(!_0x1597aa[_0x6de9('0x44')]['hasOwnProperty']('nolimit')){_0x2ceefd[_0x6de9('0x2e')]=qs[_0x6de9('0x2e')](_0x1597aa[_0x6de9('0x44')][_0x6de9('0x2e')]);_0x2ceefd[_0x6de9('0x30')]=qs[_0x6de9('0x30')](_0x1597aa['query']['offset']);}_0x2ceefd[_0x6de9('0x4c')]=qs[_0x6de9('0x4d')](_0x1597aa[_0x6de9('0x44')]['sort']);_0x2ceefd['where']=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0x1597aa['query'],_0x2bd43c['filters']));_0x2ceefd[_0x6de9('0x4e')][_0x6de9('0x6a')]=_0x4d5582['id'];if(_0x1597aa[_0x6de9('0x44')][_0x6de9('0x50')]){_0x2ceefd[_0x6de9('0x4e')]=_['merge'](_0x2ceefd['where'],{'$or':_[_0x6de9('0x3e')](_0x2ceefd[_0x6de9('0x47')],function(_0x376f71){var _0x59bd47={};_0x59bd47[_0x376f71]={'$like':'%'+_0x1597aa[_0x6de9('0x44')]['filter']+'%'};return _0x59bd47;})});}_0x2ceefd=_[_0x6de9('0x51')]({},_0x2ceefd,_0x1597aa[_0x6de9('0x54')]);return db[_0x6de9('0x6b')][_0x6de9('0x2f')]({'where':_0x2ceefd[_0x6de9('0x4e')]})[_0x6de9('0x20')](function(_0x2c13f2){_0x263a0d[_0x6de9('0x2f')]=_0x2c13f2;if(_0x1597aa[_0x6de9('0x44')]['includeAll']){_0x2ceefd['include']=[{'all':!![]}];}return db['Disposition'][_0x6de9('0x57')](_0x2ceefd);})['then'](function(_0x53b800){_0x263a0d['rows']=_0x53b800;return _0x263a0d;});}})[_0x6de9('0x20')](respondWithFilteredResult(_0x538917,_0x2ceefd))[_0x6de9('0x29')](handleError(_0x538917,null));};exports['removeDispositions']=function(_0x271043,_0x471a9a,_0x412071){return db['OpenchannelAccount']['find']({'where':{'id':_0x271043[_0x6de9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x471a9a,null))[_0x6de9('0x20')](function(_0x11e312){if(_0x11e312){return _0x11e312[_0x6de9('0x6d')](_0x271043['query'][_0x6de9('0x6e')]);}})[_0x6de9('0x20')](respondWithStatusCode(_0x471a9a,null))[_0x6de9('0x29')](handleError(_0x471a9a,null));};exports['addAnswer']=function(_0x15d6a3,_0x227392,_0x527650){if(_0x15d6a3[_0x6de9('0x67')]['id']){delete _0x15d6a3[_0x6de9('0x67')]['id'];}return db[_0x6de9('0x3f')]['find']({'where':{'id':_0x15d6a3[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x227392,null))[_0x6de9('0x20')](function(_0xc5f203){if(_0xc5f203){_0x15d6a3[_0x6de9('0x67')][_0x6de9('0x6a')]=_0xc5f203['id'];return db[_0x6de9('0x6f')][_0x6de9('0x5e')](_0x15d6a3[_0x6de9('0x67')]);}})[_0x6de9('0x20')](respondWithResult(_0x227392,null))[_0x6de9('0x29')](handleError(_0x227392,null));};exports[_0x6de9('0x70')]=function(_0x18d421,_0x346df9,_0x3cbada){var _0x14aced={'raw':![],'where':{}};var _0x30caca={};var _0x2ac933={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6de9('0x71')]({'where':{'id':_0x18d421[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x346df9,null))['then'](function(_0x1573c5){if(_0x1573c5){_0x30caca['model']=_[_0x6de9('0x43')](db[_0x6de9('0x6f')][_0x6de9('0x40')]);_0x30caca[_0x6de9('0x44')]=_[_0x6de9('0x43')](_0x18d421[_0x6de9('0x44')]);_0x30caca[_0x6de9('0x45')]=_[_0x6de9('0x46')](_0x30caca[_0x6de9('0x42')],_0x30caca[_0x6de9('0x44')]);_0x14aced['attributes']=_['intersection'](_0x30caca[_0x6de9('0x42')],qs['fields'](_0x18d421[_0x6de9('0x44')][_0x6de9('0x48')]));_0x14aced[_0x6de9('0x47')]=_0x14aced[_0x6de9('0x47')][_0x6de9('0x49')]?_0x14aced[_0x6de9('0x47')]:_0x30caca[_0x6de9('0x42')];if(!_0x18d421['query'][_0x6de9('0x4a')](_0x6de9('0x4b'))){_0x14aced[_0x6de9('0x2e')]=qs[_0x6de9('0x2e')](_0x18d421[_0x6de9('0x44')][_0x6de9('0x2e')]);_0x14aced[_0x6de9('0x30')]=qs[_0x6de9('0x30')](_0x18d421[_0x6de9('0x44')][_0x6de9('0x30')]);}_0x14aced[_0x6de9('0x4c')]=qs['sort'](_0x18d421['query'][_0x6de9('0x4d')]);_0x14aced['where']=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0x18d421[_0x6de9('0x44')],_0x30caca[_0x6de9('0x45')]));_0x14aced[_0x6de9('0x4e')][_0x6de9('0x6a')]=_0x1573c5['id'];if(_0x18d421[_0x6de9('0x44')][_0x6de9('0x50')]){_0x14aced['where']=_[_0x6de9('0x51')](_0x14aced[_0x6de9('0x4e')],{'$or':_[_0x6de9('0x3e')](_0x14aced[_0x6de9('0x47')],function(_0x3f445d){var _0x485b4b={};_0x485b4b[_0x3f445d]={'$like':'%'+_0x18d421['query'][_0x6de9('0x50')]+'%'};return _0x485b4b;})});}_0x14aced=_[_0x6de9('0x51')]({},_0x14aced,_0x18d421['options']);return db[_0x6de9('0x6f')]['count']({'where':_0x14aced[_0x6de9('0x4e')]})[_0x6de9('0x20')](function(_0x375c84){_0x2ac933[_0x6de9('0x2f')]=_0x375c84;if(_0x18d421[_0x6de9('0x44')]['includeAll']){_0x14aced[_0x6de9('0x56')]=[{'all':!![]}];}return db[_0x6de9('0x6f')]['findAll'](_0x14aced);})[_0x6de9('0x20')](function(_0x7866d1){_0x2ac933[_0x6de9('0x58')]=_0x7866d1;return _0x2ac933;});}})[_0x6de9('0x20')](respondWithFilteredResult(_0x346df9,_0x14aced))['catch'](handleError(_0x346df9,null));};exports[_0x6de9('0x72')]=function(_0x6d3c89,_0x80df6c,_0x2977b0){return db[_0x6de9('0x3f')]['find']({'where':{'id':_0x6d3c89['params']['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x80df6c,null))[_0x6de9('0x20')](function(_0x140428){if(_0x140428){return _0x140428[_0x6de9('0x72')](_0x6d3c89[_0x6de9('0x44')][_0x6de9('0x6e')]);}})[_0x6de9('0x20')](respondWithStatusCode(_0x80df6c,null))[_0x6de9('0x29')](handleError(_0x80df6c,null));};exports[_0x6de9('0x73')]=function(_0x39e1bc,_0x32c066,_0x5cd8ea){var _0x58fd14={'body':_0x39e1bc[_0x6de9('0x67')],'channel':'openchannel'};var _0x28ec0b=[];var _0x506bd1=[];var _0x473617={};var _0xbe0dd8=![];return db[_0x6de9('0x74')]['describe']()[_0x6de9('0x20')](function(_0x3e58df){if(!_0x3e58df){throw new db[(_0x6de9('0x75'))][(_0x6de9('0x76'))](_0x6de9('0x77'));}_0x28ec0b=_['difference'](_[_0x6de9('0x43')](_0x3e58df),[_0x6de9('0x78'),'updatedAt']);_0x506bd1=_[_0x6de9('0x79')](_['keys'](_0x3e58df),[_0x6de9('0x78'),_0x6de9('0x7a'),_0x6de9('0x7b'),_0x6de9('0x7c')]);if(_0x39e1bc[_0x6de9('0x67')]['id']){delete _0x39e1bc['body']['id'];}if(_[_0x6de9('0x7d')](_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x7e')])){throw new db['Sequelize'][(_0x6de9('0x76'))]('from\x20is\x20mandatory');}if(_[_0x6de9('0x7d')](_0x39e1bc[_0x6de9('0x67')]['body'])||_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x67')]===''){throw new db[(_0x6de9('0x75'))][(_0x6de9('0x76'))](_0x6de9('0x7f'));}if(_[_0x6de9('0x7d')](_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x80')])){throw new db[(_0x6de9('0x75'))][(_0x6de9('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x506bd1);}if(!_[_0x6de9('0x81')](_0x506bd1,_0x39e1bc['body'][_0x6de9('0x80')])){throw new db[(_0x6de9('0x75'))][(_0x6de9('0x76'))](_0x6de9('0x82')+_0x506bd1);}_0x473617[_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x80')]]=_0x39e1bc['body'][_0x6de9('0x7e')];})[_0x6de9('0x20')](function(){return db[_0x6de9('0x3f')][_0x6de9('0x5d')]({'where':{'id':_0x39e1bc[_0x6de9('0x5a')]['id']},'include':[{'model':db[_0x6de9('0x83')],'as':_0x6de9('0x84'),'include':[{'model':db[_0x6de9('0x74')],'as':_0x6de9('0x85'),'where':_0x473617,'limit':0x1,'order':[[_0x6de9('0x7a'),_0x6de9('0x86')]]}]},{'model':db[_0x6de9('0x87')],'as':_0x6de9('0x88')}]});})[_0x6de9('0x20')](handleEntityNotFound(_0x32c066,null))[_0x6de9('0x20')](function(_0x3aa33e){if(_0x3aa33e&&_0x3aa33e[_0x6de9('0x84')]){_0x58fd14['account']=_0x3aa33e;_0x58fd14[_0x6de9('0x89')]=_0x3aa33e['Applications'];_0x58fd14['list']=_0x3aa33e[_0x6de9('0x84')];_0x58fd14[_0x6de9('0x89')]=_['orderBy'](_0x58fd14[_0x6de9('0x89')],[_0x6de9('0x8a')],[_0x6de9('0x8b')]);if(_0x58fd14[_0x6de9('0x8c')]['Applications']){delete _0x58fd14[_0x6de9('0x8c')][_0x6de9('0x88')];}if(_0x58fd14['account']['List']&&_0x58fd14[_0x6de9('0x8c')]['List'][_0x6de9('0x85')][_0x6de9('0x49')]){return _0x58fd14['account'][_0x6de9('0x84')][_0x6de9('0x85')][0x0];}var _0x1451a9=_[_0x6de9('0x16')](_0x39e1bc[_0x6de9('0x67')],{'firstName':_0x39e1bc[_0x6de9('0x67')]['from'],'ListId':_0x3aa33e[_0x6de9('0x7c')]});_0x1451a9[_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x80')]]=_0x39e1bc[_0x6de9('0x67')]['from'];return db['CmContact'][_0x6de9('0x5e')](_0x1451a9,{'fields':_0x28ec0b,'raw':!![]});}})['then'](handleEntityNotFound(_0x32c066,null))[_0x6de9('0x20')](function(_0xd8f1e3){_0x58fd14[_0x6de9('0x8d')]=_0xd8f1e3;if(_0xd8f1e3){var _0x16c08f={'ContactId':_0xd8f1e3['id'],'OpenchannelAccountId':_0x39e1bc[_0x6de9('0x5a')]['id'],'from':(_0xd8f1e3[_0x6de9('0x8e')]||'')+'\x20'+(_0xd8f1e3['lastName']||'')};var _0x445f42={'OpenchannelAccountId':_0x39e1bc['params']['id'],'closed':![]};if(_0x39e1bc[_0x6de9('0x67')]['threadId']){_0x445f42['threadId']=_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x8f')];return db[_0x6de9('0x90')][_0x6de9('0x5d')]({'where':_0x445f42})[_0x6de9('0x20')](function(_0x58eb32){if(_0x58eb32){return[_0x58eb32,![]];}_0x16c08f[_0x6de9('0x8f')]=_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x8f')];_0x16c08f[_0x6de9('0x91')]=_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x91')];return db[_0x6de9('0x90')][_0x6de9('0x5e')](_0x16c08f)[_0x6de9('0x20')](function(_0x2ee189){return[_0x2ee189,!![]];});});}else{_0x445f42[_0x6de9('0x8f')]=null;}_0x445f42[_0x6de9('0x92')]=_0xd8f1e3['id'];return db[_0x6de9('0x90')][_0x6de9('0x5d')]({'where':_0x445f42})[_0x6de9('0x20')](function(_0x2fb961){if(_0x2fb961){return[_0x2fb961,![]];}return db[_0x6de9('0x90')][_0x6de9('0x5e')](_0x16c08f)['then'](function(_0xe438ab){return[_0xe438ab,!![]];});});}})[_0x6de9('0x93')](function(_0x359b99,_0x581696){if(_0x359b99){_0xbe0dd8=_0x581696;if(!_0x581696){var _0x1a9fc4={'from':(_0x58fd14[_0x6de9('0x8d')][_0x6de9('0x8e')]||'')+'\x20'+(_0x58fd14[_0x6de9('0x8d')][_0x6de9('0x94')]||'')};if(_0x39e1bc['body'][_0x6de9('0x8f')]&&_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x95')]&&_0x39e1bc[_0x6de9('0x67')]['threadId']!=_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x95')]){_0x1a9fc4[_0x6de9('0x8f')]=_0x39e1bc[_0x6de9('0x67')]['messageId'];}return _0x359b99[_0x6de9('0x66')](_0x1a9fc4);}else{return _0x359b99;}}})[_0x6de9('0x20')](function(_0x3f6871){_0x58fd14[_0x6de9('0x96')]=_0x3f6871['get']({'plain':!![]});_0x58fd14[_0x6de9('0x96')][_0x6de9('0x97')]=_0xbe0dd8;if(_0x58fd14[_0x6de9('0x96')][_0x6de9('0x97')]){if(_0x58fd14[_0x6de9('0x8c')]['autoclose']){_0x58fd14[_0x6de9('0x89')]['push']({'id':0x0,'priority':_0x58fd14[_0x6de9('0x89')]['length']+0x1,'app':'close','appdata':_0x6de9('0x98'),'interval':_0x6de9('0x99')});}}return db[_0x6de9('0x9a')][_0x6de9('0x5e')]({'body':_0x39e1bc[_0x6de9('0x67')]['body'],'OpenchannelAccountId':_0x39e1bc[_0x6de9('0x5a')]['id'],'OpenchannelInteractionId':_0x3f6871['id'],'direction':'in','ContactId':_0x58fd14['contact']['id'],'AttachmentId':_0x39e1bc[_0x6de9('0x67')][_0x6de9('0x9b')]});})[_0x6de9('0x20')](function(_0x627825){_0x58fd14[_0x6de9('0x28')]=_0x627825;if(_0x58fd14[_0x6de9('0x96')][_0x6de9('0x9c')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x58fd14[_0x6de9('0x96')][_0x6de9('0x9c')]}})['then'](function(_0x19675f){if(_0x19675f){_0x58fd14[_0x6de9('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x19675f[_0x6de9('0x3b')]+','+(_0x58fd14[_0x6de9('0x8c')][_0x6de9('0x9d')]||0xa),'interval':'*,*,*,*'});_0x58fd14[_0x6de9('0x9e')]=![];}return respondWithRpcPromise(_0x6de9('0x9f'),_0x6de9('0xa0'),_0x58fd14);});}return respondWithRpcPromise(_0x6de9('0x9f'),'startRouting',_0x58fd14);})[_0x6de9('0x20')](function(_0x36d1d3){respondWithRpcPromise(_0x6de9('0xa1'),_0x6de9('0xa1'),{'event':'notify','message':_0x36d1d3},client9002);return _0x36d1d3;})[_0x6de9('0x20')](respondWithResult(_0x32c066,null))[_0x6de9('0x29')](handleError(_0x32c066,null));};exports[_0x6de9('0xa2')]=function(_0x5a0cbd,_0xfde24b){var _0x532811=_0x5a0cbd[_0x6de9('0x5a')]['id'];var _0x5e7173=_0x5a0cbd[_0x6de9('0x67')];var _0x131e41=0xc8;var _0x2630af=null;return db['sequelize'][_0x6de9('0xa3')]({'isolationLevel':db[_0x6de9('0xa4')][_0x6de9('0xa5')][_0x6de9('0xa6')][_0x6de9('0xa7')]},function(_0x4f18d7){return db[_0x6de9('0x3f')][_0x6de9('0x71')]({'where':{'id':_0x532811},'transaction':_0x4f18d7})['then'](function(_0x65992){if(_0x65992){return db[_0x6de9('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x532811},'transaction':_0x4f18d7})[_0x6de9('0x20')](function(){var _0x309477=_[_0x6de9('0x3e')](_0x5e7173,function(_0x42b1e1){_0x42b1e1[_0x6de9('0x6a')]=_0x532811;return _0x42b1e1;});return db['OpenchannelApplication'][_0x6de9('0xa8')](_0x309477,{'transaction':_0x4f18d7});});}else{_0x131e41=0x194;_0x2630af=[];}});})[_0x6de9('0x20')](function(){if(_0x131e41!==0x194){return db[_0x6de9('0x87')][_0x6de9('0xa9')]({'where':{'OpenchannelAccountId':_0x532811},'order':'priority'})[_0x6de9('0x20')](function(_0x435fdd){_0x2630af=_0x435fdd;});}})['catch'](function(_0x394fdf){_0x131e41=0x1f4;logger[_0x6de9('0x25')](_0x394fdf[_0x6de9('0x3a')]);if(_0x394fdf[_0x6de9('0x3b')]){delete _0x394fdf[_0x6de9('0x3b')];}_0x2630af=_0x394fdf;})[_0x6de9('0xaa')](function(){if(_0x2630af===null){_0xfde24b[_0x6de9('0x2a')](_0x131e41);}else{if(_0x131e41===0x1f4){_0xfde24b[_0x6de9('0x2b')](_0x131e41)[_0x6de9('0x3c')](_0x2630af);}else{_0xfde24b['status'](_0x131e41)['json'](_0x2630af);}}});};exports[_0x6de9('0xab')]=function(_0x17f2f3,_0x466e6f,_0x3c759a){var _0x277cbd={};var _0x519302={};var _0x4547d3;var _0x201235;return db['OpenchannelAccount'][_0x6de9('0x71')]({'where':{'id':_0x17f2f3[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x466e6f,null))[_0x6de9('0x20')](function(_0x3884e5){if(_0x3884e5){_0x4547d3=_0x3884e5;_0x519302['model']=_[_0x6de9('0x43')](db[_0x6de9('0x87')][_0x6de9('0x40')]);_0x519302[_0x6de9('0x44')]=_[_0x6de9('0x43')](_0x17f2f3[_0x6de9('0x44')]);_0x519302[_0x6de9('0x45')]=_['intersection'](_0x519302['model'],_0x519302[_0x6de9('0x44')]);_0x277cbd['attributes']=_['intersection'](_0x519302[_0x6de9('0x42')],qs[_0x6de9('0x48')](_0x17f2f3[_0x6de9('0x44')]['fields']));_0x277cbd[_0x6de9('0x47')]=_0x277cbd[_0x6de9('0x47')][_0x6de9('0x49')]?_0x277cbd[_0x6de9('0x47')]:_0x519302[_0x6de9('0x42')];_0x277cbd[_0x6de9('0x4c')]=qs['sort'](_0x17f2f3[_0x6de9('0x44')]['sort']);_0x277cbd[_0x6de9('0x4e')]=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0x17f2f3[_0x6de9('0x44')],_0x519302[_0x6de9('0x45')]));if(_0x17f2f3[_0x6de9('0x44')][_0x6de9('0x50')]){_0x277cbd[_0x6de9('0x4e')]=_[_0x6de9('0x51')](_0x277cbd[_0x6de9('0x4e')],{'$or':_[_0x6de9('0x3e')](_0x277cbd[_0x6de9('0x47')],function(_0x5e968c){var _0x1ad1b5={};_0x1ad1b5[_0x5e968c]={'$like':'%'+_0x17f2f3[_0x6de9('0x44')][_0x6de9('0x50')]+'%'};return _0x1ad1b5;})});}_0x277cbd=_['merge']({},_0x277cbd,_0x17f2f3[_0x6de9('0x54')]);return _0x4547d3[_0x6de9('0xab')](_0x277cbd);}})[_0x6de9('0x20')](function(_0x43a31e){if(_0x43a31e){_0x201235=_0x43a31e[_0x6de9('0x49')];if(!_0x17f2f3['query'][_0x6de9('0x4a')](_0x6de9('0x4b'))){_0x277cbd[_0x6de9('0x2e')]=qs[_0x6de9('0x2e')](_0x17f2f3[_0x6de9('0x44')][_0x6de9('0x2e')]);_0x277cbd[_0x6de9('0x30')]=qs[_0x6de9('0x30')](_0x17f2f3[_0x6de9('0x44')][_0x6de9('0x30')]);}return _0x4547d3['getApplications'](_0x277cbd);}})[_0x6de9('0x20')](function(_0x3d9986){if(_0x3d9986){return _0x3d9986?{'count':_0x201235,'rows':_0x3d9986}:null;}})[_0x6de9('0x20')](respondWithResult(_0x466e6f,null))[_0x6de9('0x29')](handleError(_0x466e6f,null));};exports[_0x6de9('0xac')]=function(_0xc5ada1,_0x2f9d61,_0x49a362){var _0x15523e={'raw':![],'where':{}};var _0x365435={};var _0x2ef234={'count':0x0,'rows':[]};return db[_0x6de9('0x3f')][_0x6de9('0x71')]({'where':{'id':_0xc5ada1[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x2f9d61,null))[_0x6de9('0x20')](function(_0x5b68a6){if(_0x5b68a6){_0x365435[_0x6de9('0x42')]=_[_0x6de9('0x43')](db[_0x6de9('0x90')][_0x6de9('0x40')]);_0x365435[_0x6de9('0x44')]=_[_0x6de9('0x43')](_0xc5ada1[_0x6de9('0x44')]);_0x365435[_0x6de9('0x45')]=_[_0x6de9('0x46')](_0x365435[_0x6de9('0x42')],_0x365435['query']);_0x15523e['attributes']=_[_0x6de9('0x46')](_0x365435[_0x6de9('0x42')],qs[_0x6de9('0x48')](_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x48')]));_0x15523e['attributes']=_0x15523e[_0x6de9('0x47')][_0x6de9('0x49')]?_0x15523e[_0x6de9('0x47')]:_0x365435[_0x6de9('0x42')];if(!_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x4a')](_0x6de9('0x4b'))){_0x15523e[_0x6de9('0x2e')]=qs[_0x6de9('0x2e')](_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x2e')]);_0x15523e[_0x6de9('0x30')]=qs[_0x6de9('0x30')](_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x30')]);}_0x15523e[_0x6de9('0x4c')]=qs[_0x6de9('0x4d')](_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x4d')]);_0x15523e['where']=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0xc5ada1['query'],_0x365435[_0x6de9('0x45')]));_0x15523e[_0x6de9('0x4e')]['OpenchannelAccountId']=_0x5b68a6['id'];if(_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x50')]){_0x15523e['where']=_['merge'](_0x15523e[_0x6de9('0x4e')],{'$or':_[_0x6de9('0x3e')](_0x15523e['attributes'],function(_0x2d246d){var _0x449803={};_0x449803[_0x2d246d]={'$like':'%'+_0xc5ada1[_0x6de9('0x44')][_0x6de9('0x50')]+'%'};return _0x449803;})});}_0x15523e=_[_0x6de9('0x51')]({},_0x15523e,_0xc5ada1[_0x6de9('0x54')]);return db[_0x6de9('0x90')][_0x6de9('0x2f')]({'where':_0x15523e['where']})[_0x6de9('0x20')](function(_0x54dd43){_0x2ef234[_0x6de9('0x2f')]=_0x54dd43;if(_0xc5ada1[_0x6de9('0x44')]['includeAll']){_0x15523e[_0x6de9('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6de9('0xad')],'as':_0x6de9('0xae'),'attributes':[_0x6de9('0x3b'),_0x6de9('0xaf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x6de9('0xb0'),'attributes':['id',_0x6de9('0x3b'),'color'],'where':_0xc5ada1['query'][_0x6de9('0xb1')]?{'id':_0xc5ada1[_0x6de9('0x44')]['tag']}:undefined,'required':_0xc5ada1[_0x6de9('0x44')][_0x6de9('0xb1')]?!![]:![]}];}return db[_0x6de9('0x90')][_0x6de9('0x57')](_0x15523e);})[_0x6de9('0x20')](function(_0x2e755d){_0x2ef234['rows']=_0x2e755d;return _0x2ef234;});}})[_0x6de9('0x20')](respondWithFilteredResult(_0x2f9d61,_0x15523e))[_0x6de9('0x29')](handleError(_0x2f9d61,null));};exports[_0x6de9('0xb2')]=function(_0x1a73d7,_0x36e9fd,_0x1ecc21){return db[_0x6de9('0x3f')][_0x6de9('0x5d')]({'where':{'id':_0x1a73d7['params']['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x36e9fd,null))['then'](function(_0x261250){if(_0x261250){return _0x261250[_0x6de9('0xb2')](_0x1a73d7[_0x6de9('0x67')]['ids'],_[_0x6de9('0xb3')](_0x1a73d7['body'],[_0x6de9('0x6e'),'id'])||{})[_0x6de9('0x93')](function(_0x284d9e){for(var _0x10e9b5=0x0;_0x10e9b5<_0x1a73d7['body'][_0x6de9('0x6e')][_0x6de9('0x49')];_0x10e9b5+=0x1){socket[_0x6de9('0xb4')](_0x6de9('0xb5'),{'UserId':Number(_0x1a73d7[_0x6de9('0x67')][_0x6de9('0x6e')][_0x10e9b5]),'OpenchannelAccountId':Number(_0x1a73d7[_0x6de9('0x5a')]['id'])});}return _0x284d9e;});}})['then'](respondWithResult(_0x36e9fd,null))[_0x6de9('0x29')](handleError(_0x36e9fd,null));};exports[_0x6de9('0xb6')]=function(_0x3ccd0d,_0x46da98,_0x550124){return db[_0x6de9('0x3f')][_0x6de9('0x5d')]({'where':{'id':_0x3ccd0d[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x46da98,null))['then'](function(_0x5c1230){if(_0x5c1230){return _0x5c1230['removeAgents'](_0x3ccd0d[_0x6de9('0x44')][_0x6de9('0x6e')])[_0x6de9('0x20')](function(){if(_[_0x6de9('0xb7')](_0x3ccd0d['query']['ids'])){for(var _0x23bb9b=0x0;_0x23bb9b<_0x3ccd0d[_0x6de9('0x44')][_0x6de9('0x6e')]['length'];_0x23bb9b+=0x1){socket[_0x6de9('0xb4')](_0x6de9('0xb8'),{'UserId':Number(_0x3ccd0d[_0x6de9('0x44')]['ids'][_0x23bb9b]),'OpenchannelAccountId':Number(_0x3ccd0d[_0x6de9('0x5a')]['id'])});}}else{socket['emit'](_0x6de9('0xb8'),{'UserId':Number(_0x3ccd0d['query'][_0x6de9('0x6e')]),'OpenchannelAccountId':Number(_0x3ccd0d[_0x6de9('0x5a')]['id'])});}});}})[_0x6de9('0x20')](respondWithStatusCode(_0x46da98,null))[_0x6de9('0x29')](handleError(_0x46da98,null));};exports[_0x6de9('0xb9')]=function(_0x2449a7,_0x14aa5e,_0x3945aa){var _0x345f2a={};var _0x10247d={};var _0x4150d8;var _0x10dfa0;return db[_0x6de9('0x3f')][_0x6de9('0x71')]({'where':{'id':_0x2449a7[_0x6de9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14aa5e,null))[_0x6de9('0x20')](function(_0x2bc7e0){if(_0x2bc7e0){_0x4150d8=_0x2bc7e0;_0x10247d[_0x6de9('0x42')]=_[_0x6de9('0x43')](db[_0x6de9('0xad')][_0x6de9('0x40')]);_0x10247d[_0x6de9('0x44')]=_[_0x6de9('0x43')](_0x2449a7[_0x6de9('0x44')]);_0x10247d[_0x6de9('0x45')]=_[_0x6de9('0x46')](_0x10247d[_0x6de9('0x42')],_0x10247d[_0x6de9('0x44')]);_0x345f2a[_0x6de9('0x47')]=_[_0x6de9('0x46')](_0x10247d['model'],qs[_0x6de9('0x48')](_0x2449a7[_0x6de9('0x44')][_0x6de9('0x48')]));_0x345f2a['attributes']=_0x345f2a['attributes'][_0x6de9('0x49')]?_0x345f2a[_0x6de9('0x47')]:_0x10247d['model'];_0x345f2a[_0x6de9('0x4c')]=qs[_0x6de9('0x4d')](_0x2449a7[_0x6de9('0x44')][_0x6de9('0x4d')]);_0x345f2a[_0x6de9('0x4e')]=qs[_0x6de9('0x45')](_[_0x6de9('0x4f')](_0x2449a7[_0x6de9('0x44')],_0x10247d[_0x6de9('0x45')]));if(_0x2449a7[_0x6de9('0x44')][_0x6de9('0x50')]){_0x345f2a[_0x6de9('0x4e')]=_['merge'](_0x345f2a[_0x6de9('0x4e')],{'$or':_[_0x6de9('0x3e')](_0x345f2a['attributes'],function(_0x31eb53){var _0x15d1cf={};_0x15d1cf[_0x31eb53]={'$like':'%'+_0x2449a7['query'][_0x6de9('0x50')]+'%'};return _0x15d1cf;})});}_0x345f2a=_[_0x6de9('0x51')]({},_0x345f2a,_0x2449a7['options']);return _0x4150d8['getAgents'](_0x345f2a);}})['then'](function(_0x212b3c){if(_0x212b3c){_0x10dfa0=_0x212b3c[_0x6de9('0x49')];if(!_0x2449a7['query'][_0x6de9('0x4a')](_0x6de9('0x4b'))){_0x345f2a[_0x6de9('0x2e')]=qs['limit'](_0x2449a7['query'][_0x6de9('0x2e')]);_0x345f2a[_0x6de9('0x30')]=qs['offset'](_0x2449a7[_0x6de9('0x44')][_0x6de9('0x30')]);}return _0x4150d8[_0x6de9('0xb9')](_0x345f2a);}})['then'](function(_0x39f28c){if(_0x39f28c){return _0x39f28c?{'count':_0x10dfa0,'rows':_0x39f28c}:null;}})[_0x6de9('0x20')](respondWithResult(_0x14aa5e,null))[_0x6de9('0x29')](handleError(_0x14aa5e,null));};exports['send']=function(_0x3761fa,_0x13d9b0,_0x157957){var _0x340852,_0x50832c,_0x3252a6;if(_[_0x6de9('0x7d')](_0x3761fa['body'][_0x6de9('0x67')])||_0x3761fa[_0x6de9('0x67')][_0x6de9('0x67')]===''){throw new db[(_0x6de9('0x75'))][(_0x6de9('0x76'))](_0x6de9('0x7f'));}if(_[_0x6de9('0x7d')](_0x3761fa['body']['to'])){}_0x340852=_0x3761fa['body']['to'];return db[_0x6de9('0x3f')][_0x6de9('0x71')]({'where':{'id':_0x3761fa[_0x6de9('0x5a')]['id']}})[_0x6de9('0x20')](handleEntityNotFound(_0x13d9b0,null))[_0x6de9('0x20')](function(_0x3480bd){if(_0x3480bd){return db['OpenchannelAccount']['find']({'where':{'id':_0x3480bd['id']},'include':[{'model':db['CmList'],'as':_0x6de9('0x84'),'include':[{'model':db['CmContact'],'as':_0x6de9('0x85'),'where':{[_0x3480bd['mapKey']]:_0x340852},'limit':0x1,'order':[[_0x6de9('0x7a'),'DESC']]}]}]})[_0x6de9('0x20')](handleEntityNotFound(_0x13d9b0,null))['then'](function(_0x3e42ce){if(_0x3e42ce&&_0x3e42ce[_0x6de9('0x84')]){_0x50832c=_0x3e42ce[_0x6de9('0x36')]({'plain':!![]});if(_0x50832c[_0x6de9('0x84')]&&_0x50832c['List'][_0x6de9('0x85')]['length']){return _0x50832c[_0x6de9('0x84')][_0x6de9('0x85')][0x0];}return db[_0x6de9('0x74')][_0x6de9('0x5e')](_[_0x6de9('0x16')](_0x3761fa[_0x6de9('0x67')],{'firstName':_0x340852,[_0x3e42ce[_0x6de9('0x80')]]:_0x340852,'phone':_0x340852,'ListId':_0x50832c[_0x6de9('0x7c')]}));}})[_0x6de9('0x20')](handleEntityNotFound(_0x13d9b0,null))[_0x6de9('0x20')](function(_0x553926){if(_0x553926){_0x3252a6=_0x553926;return db[_0x6de9('0x90')][_0x6de9('0x5d')]({'where':{'ContactId':_0x3252a6['id'],'closed':![],'OpenchannelAccountId':_0x50832c['id']}})[_0x6de9('0x20')](function(_0x4733c0){if(_0x4733c0){return[_0x4733c0,![]];}return db[_0x6de9('0x90')][_0x6de9('0x5e')]({'UserId':_0x3761fa['user']['id'],'ContactId':_0x3252a6['id'],'OpenchannelAccountId':_0x50832c['id'],'lastMsgDirection':_0x6de9('0xba'),'Messages':[_[_0x6de9('0x51')](_0x3761fa[_0x6de9('0x67')],{'read':![],'body':_0x3761fa['body'][_0x6de9('0x67')],'OpenchannelAccountId':_0x50832c['id'],'UserId':_0x3761fa[_0x6de9('0x5f')]['id'],'ContactId':_0x3252a6['id']})]},{'include':[{'model':db[_0x6de9('0x9a')],'as':_0x6de9('0xbb')}]})[_0x6de9('0x20')](function(_0x3d24dd){return[_0x3d24dd,!![]];});});}})[_0x6de9('0x93')](function(_0x1dd0b1,_0x181b0f){if(_0x181b0f){return _0x1dd0b1;}return db[_0x6de9('0x9a')][_0x6de9('0x5e')](_['merge'](_0x3761fa[_0x6de9('0x67')],{'read':![],'body':_0x3761fa[_0x6de9('0x67')]['body'],'OpenchannelAccountId':_0x50832c['id'],'OpenchannelInteractionId':_0x1dd0b1['id'],'UserId':_0x3761fa[_0x6de9('0x5f')]['id'],'ContactId':_0x3252a6['id']}))[_0x6de9('0x20')](function(_0x43fa77){_0x1dd0b1[_0x6de9('0xbc')]['Messages']=[];_0x1dd0b1[_0x6de9('0xbc')][_0x6de9('0xbb')][_0x6de9('0xbd')](_0x43fa77[_0x6de9('0xbc')]);return _0x1dd0b1;});});}})[_0x6de9('0x20')](respondWithResult(_0x13d9b0,null))[_0x6de9('0x29')](handleError(_0x13d9b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3d70798..22d736f 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 _0x96cc=['remove','emit','hook','exports','events','OpenchannelAccount','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x1ec7aa,_0x2506df){_0x1ec7aa=_0x1ec7aa-0x0;var _0x4bafb7=_0x96cc[_0x1ec7aa];return _0x4bafb7;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc96c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x3d1476,_0x3d8dcf){var _0x6fcbf2=function(_0x1289f0){while(--_0x1289f0){_0x3d1476['push'](_0x3d1476['shift']());}};_0x6fcbf2(++_0x3d8dcf);}(_0x153f,0x15b));var _0xf153=function(_0x247cfe,_0xa34d17){_0x247cfe=_0x247cfe-0x0;var _0x309b4d=_0x153f[_0x247cfe];return _0x309b4d;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 290e2a9..23033ac 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(_0x31cc77,_0x264c70){var _0x2f26f6=function(_0x56cb48){while(--_0x56cb48){_0x31cc77['push'](_0x31cc77['shift']());}};_0x2f26f6(++_0x264c70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x3b0296,_0x2db735){var _0x7f0a14=function(_0x32d76c){while(--_0x32d76c){_0x3b0296['push'](_0x3b0296['shift']());}};_0x7f0a14(++_0x2db735);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e3bd055..c872402 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 _0x9d9b=['./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x52d0f6,_0x6ff744){var _0x1597f0=function(_0x524ac8){while(--_0x524ac8){_0x52d0f6['push'](_0x52d0f6['shift']());}};_0x1597f0(++_0x6ff744);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0xae3b80,_0xf38b6){_0xae3b80=_0xae3b80-0x0;var _0x2702d3=_0x9d9b[_0xae3b80];return _0x2702d3;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var moment=require(_0xb9d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9d9('0x3'))['db'];var utils=require(_0xb9d9('0x4'));var logger=require(_0xb9d9('0x5'))('rpc');var config=require(_0xb9d9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9d9('0x7')][_0xb9d9('0x8')]({'port':0x232a});config['redis']=_[_0xb9d9('0x9')](config[_0xb9d9('0xa')],{'host':_0xb9d9('0xb'),'port':0x18eb});var socket=require(_0xb9d9('0xc'))(new Redis(config[_0xb9d9('0xa')]));require(_0xb9d9('0xd'))[_0xb9d9('0xe')](socket);function respondWithRpcPromise(_0x5a9c18,_0x5b591e,_0x5f14e7){return new BPromise(function(_0x4cde40,_0x45f507){return client[_0xb9d9('0xf')](_0x5a9c18,_0x5f14e7)[_0xb9d9('0x10')](function(_0x5e226e){logger[_0xb9d9('0x11')](_0xb9d9('0x12'),_0x5b591e,'request\x20sent');logger[_0xb9d9('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'),JSON[_0xb9d9('0x15')](_0x5e226e));if(_0x5e226e[_0xb9d9('0x16')]){if(_0x5e226e[_0xb9d9('0x16')][_0xb9d9('0x17')]===0x1f4){logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x45f507(_0x5e226e['error'][_0xb9d9('0x18')]);}logger[_0xb9d9('0x16')](_0xb9d9('0x12'),_0x5b591e,_0x5e226e[_0xb9d9('0x16')]['message']);return _0x4cde40(_0x5e226e['error'][_0xb9d9('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0xb9d9('0x14'));_0x4cde40(_0x5e226e[_0xb9d9('0x19')][_0xb9d9('0x18')]);}})['catch'](function(_0x473b89){logger[_0xb9d9('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b591e,_0x473b89);_0x45f507(_0x473b89);});});} \ No newline at end of file +var _0xd914=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info'];(function(_0x4e3544,_0x48e713){var _0x409440=function(_0x5a4ad2){while(--_0x5a4ad2){_0x4e3544['push'](_0x4e3544['shift']());}};_0x409440(++_0x48e713);}(_0xd914,0x17f));var _0x4d91=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0xd914[_0x46b22a];return _0x44c2e8;};'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('./openchannelAccount.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);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5c8ebbf..571a2c3 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 _0x0b25=['remove','update','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x47f484,_0x951b23){var _0xfe3ad2=function(_0x143fb7){while(--_0x143fb7){_0x47f484['push'](_0x47f484['shift']());}};_0xfe3ad2(++_0x951b23);}(_0x0b25,0x155));var _0x50b2=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x0b25[_0x144b30];return _0x1bb7bc;};'use strict';var OpenchannelAccountEvents=require(_0x50b2('0x0'));var events=[_0x50b2('0x1'),_0x50b2('0x2'),_0x50b2('0x3')];function createListener(_0x2877f1,_0x21c9cc){return function(_0x3cdbb9){_0x21c9cc['emit'](_0x2877f1,_0x3cdbb9);};}function removeListener(_0x4bf98b,_0x2e34c1){return function(){OpenchannelAccountEvents['removeListener'](_0x4bf98b,_0x2e34c1);};}exports[_0x50b2('0x4')]=function(_0x1b77e0){for(var _0x3cbc65=0x0,_0x29278f=events[_0x50b2('0x5')];_0x3cbc65<_0x29278f;_0x3cbc65++){var _0x550cfd=events[_0x3cbc65];var _0x2aeeb0=createListener(_0x50b2('0x6')+_0x550cfd,_0x1b77e0);OpenchannelAccountEvents['on'](_0x550cfd,_0x2aeeb0);}}; \ No newline at end of file +var _0xfaa4=['update','emit','removeListener','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x17f1ff,_0xbcbeda){var _0x2fff32=function(_0x2a7917){while(--_0x2a7917){_0x17f1ff['push'](_0x17f1ff['shift']());}};_0x2fff32(++_0xbcbeda);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x304c18,_0x3116cc){_0x304c18=_0x304c18-0x0;var _0x2ec54f=_0xfaa4[_0x304c18];return _0x2ec54f;};'use strict';var OpenchannelAccountEvents=require(_0x4faa('0x0'));var events=[_0x4faa('0x1'),_0x4faa('0x2'),_0x4faa('0x3')];function createListener(_0x122c51,_0x1f79b7){return function(_0x5141d1){_0x1f79b7[_0x4faa('0x4')](_0x122c51,_0x5141d1);};}function removeListener(_0x819149,_0x144600){return function(){OpenchannelAccountEvents[_0x4faa('0x5')](_0x819149,_0x144600);};}exports['register']=function(_0x8117c3){for(var _0x6df371=0x0,_0xa46a7d=events['length'];_0x6df371<_0xa46a7d;_0x6df371++){var _0x528871=events[_0x6df371];var _0x5d476f=createListener(_0x4faa('0x6')+_0x528871,_0x8117c3);OpenchannelAccountEvents['on'](_0x528871,_0x5d476f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4c9b925..de1f898 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 _0x9637=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','multer','util','express','Router'];(function(_0x3f848a,_0x57e33f){var _0x504c7b=function(_0x4157e9){while(--_0x4157e9){_0x3f848a['push'](_0x3f848a['shift']());}};_0x504c7b(++_0x57e33f);}(_0x9637,0x1bc));var _0x7963=function(_0x329768,_0x11a2da){_0x329768=_0x329768-0x0;var _0x25d978=_0x9637[_0x329768];return _0x25d978;};'use strict';var multer=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7963('0x2'));var router=express[_0x7963('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7963('0x4'));var interaction=require(_0x7963('0x5'));var config=require(_0x7963('0x6'));var controller=require(_0x7963('0x7'));router[_0x7963('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7963('0x8')](_0x7963('0x9'),auth[_0x7963('0xa')](),controller[_0x7963('0xb')]);router[_0x7963('0xc')]('/',auth[_0x7963('0xa')](),controller[_0x7963('0xd')]);router[_0x7963('0xe')]('/:id',auth[_0x7963('0xa')](),controller[_0x7963('0xf')]);router['delete'](_0x7963('0x9'),auth[_0x7963('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7202=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x26b719,_0x34159a){var _0x3bcb46=function(_0x3cbf1e){while(--_0x3cbf1e){_0x26b719['push'](_0x26b719['shift']());}};_0x3bcb46(++_0x34159a);}(_0x7202,0x184));var _0x2720=function(_0x6c496d,_0x455f33){_0x6c496d=_0x6c496d-0x0;var _0x34eba6=_0x7202[_0x6c496d];return _0x34eba6;};'use strict';var multer=require('multer');var util=require(_0x2720('0x0'));var path=require('path');var timeout=require(_0x2720('0x1'));var express=require('express');var router=express[_0x2720('0x2')]();var fs_extra=require(_0x2720('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2720('0x4'));var config=require(_0x2720('0x5'));var controller=require(_0x2720('0x6'));router['get']('/',auth[_0x2720('0x7')](),controller[_0x2720('0x8')]);router[_0x2720('0x9')](_0x2720('0xa'),auth[_0x2720('0x7')](),controller[_0x2720('0xb')]);router[_0x2720('0xc')]('/',auth[_0x2720('0x7')](),controller[_0x2720('0xd')]);router[_0x2720('0xe')](_0x2720('0xa'),auth[_0x2720('0x7')](),controller[_0x2720('0xf')]);router[_0x2720('0x10')](_0x2720('0xa'),auth[_0x2720('0x7')](),controller[_0x2720('0x11')]);module[_0x2720('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 7d0a8ef..f67572c 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 _0xaff3=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4b7540,_0x39bca0){var _0x208ccf=function(_0x21aede){while(--_0x21aede){_0x4b7540['push'](_0x4b7540['shift']());}};_0x208ccf(++_0x39bca0);}(_0xaff3,0x134));var _0x3aff=function(_0x240989,_0x5ecec0){_0x240989=_0x240989-0x0;var _0x57d5f9=_0xaff3[_0x240989];return _0x57d5f9;};'use strict';var Sequelize=require(_0x3aff('0x0'));module[_0x3aff('0x1')]={'priority':{'type':Sequelize[_0x3aff('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3aff('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3aff('0x4')]()},'description':{'type':Sequelize[_0x3aff('0x3')]},'interval':{'type':Sequelize[_0x3aff('0x3')],'defaultValue':_0x3aff('0x5')}}; \ No newline at end of file +var _0x1430=['STRING','*,*,*,*','exports','TEXT'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x1430,0x72));var _0x0143=function(_0x2a1f5c,_0x49b13f){_0x2a1f5c=_0x2a1f5c-0x0;var _0x43ce3d=_0x1430[_0x2a1f5c];return _0x43ce3d;};'use strict';var Sequelize=require('sequelize');module[_0x0143('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0143('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0143('0x2')],'defaultValue':_0x0143('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 357f872..d493918 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 _0x4981=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','stack','name','index','map','OpenchannelApplication','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options'];(function(_0x4f5af0,_0x2710d0){var _0x1ad6c4=function(_0x5101a9){while(--_0x5101a9){_0x4f5af0['push'](_0x4f5af0['shift']());}};_0x1ad6c4(++_0x2710d0);}(_0x4981,0x95));var _0x1498=function(_0x473119,_0x5258c2){_0x473119=_0x473119-0x0;var _0x2d8107=_0x4981[_0x473119];return _0x2d8107;};'use strict';var emlformat=require(_0x1498('0x0'));var rimraf=require(_0x1498('0x1'));var zipdir=require(_0x1498('0x2'));var jsonpatch=require(_0x1498('0x3'));var rp=require('request-promise');var moment=require(_0x1498('0x4'));var BPromise=require(_0x1498('0x5'));var Mustache=require(_0x1498('0x6'));var util=require('util');var path=require(_0x1498('0x7'));var sox=require(_0x1498('0x8'));var csv=require('to-csv');var ejs=require(_0x1498('0x9'));var fs=require('fs');var fs_extra=require(_0x1498('0xa'));var _=require('lodash');var squel=require(_0x1498('0xb'));var crypto=require(_0x1498('0xc'));var jsforce=require(_0x1498('0xd'));var deskjs=require(_0x1498('0xe'));var toCsv=require(_0x1498('0xf'));var querystring=require(_0x1498('0x10'));var Papa=require(_0x1498('0x11'));var Redis=require(_0x1498('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1498('0x13'));var as=require(_0x1498('0x14'));var hardwareService=require(_0x1498('0x15'));var logger=require(_0x1498('0x16'))(_0x1498('0x17'));var utils=require(_0x1498('0x18'));var config=require(_0x1498('0x19'));var licenseUtil=require(_0x1498('0x1a'));var db=require(_0x1498('0x1b'))['db'];function respondWithStatusCode(_0x3cf59b,_0x141382){_0x141382=_0x141382||0xcc;return function(_0x203aac){if(_0x203aac){return _0x3cf59b[_0x1498('0x1c')](_0x141382);}return _0x3cf59b[_0x1498('0x1d')](_0x141382)[_0x1498('0x1e')]();};}function respondWithResult(_0x4d9238,_0xc9a9e0){_0xc9a9e0=_0xc9a9e0||0xc8;return function(_0x3b11ca){if(_0x3b11ca){return _0x4d9238['status'](_0xc9a9e0)[_0x1498('0x1f')](_0x3b11ca);}};}function respondWithFilteredResult(_0x3138ac,_0x59ce8a){return function(_0x58031e){if(_0x58031e){var _0x1e51dd=typeof _0x59ce8a[_0x1498('0x20')]===_0x1498('0x21')&&typeof _0x59ce8a[_0x1498('0x22')]===_0x1498('0x21');var _0x59e66e=_0x58031e[_0x1498('0x23')];var _0x5b8263=_0x1e51dd?0x0:_0x59ce8a[_0x1498('0x20')];var _0x4edcf0=_0x1e51dd?_0x58031e['count']:_0x59ce8a[_0x1498('0x20')]+_0x59ce8a[_0x1498('0x22')];var _0x9d6ba;if(_0x4edcf0>=_0x59e66e){_0x4edcf0=_0x59e66e;_0x9d6ba=0xc8;}else{_0x9d6ba=0xce;}_0x3138ac[_0x1498('0x1d')](_0x9d6ba);return _0x3138ac['set'](_0x1498('0x24'),_0x5b8263+'-'+_0x4edcf0+'/'+_0x59e66e)['json'](_0x58031e);}return null;};}function patchUpdates(_0x29d894){return function(_0x157b18){try{jsonpatch['apply'](_0x157b18,_0x29d894,!![]);}catch(_0x2373f4){return BPromise[_0x1498('0x25')](_0x2373f4);}return _0x157b18[_0x1498('0x26')]();};}function saveUpdates(_0x5811f9,_0x56ffec){return function(_0x2874c1){if(_0x2874c1){return _0x2874c1[_0x1498('0x27')](_0x5811f9)[_0x1498('0x28')](function(_0x3ad75c){return _0x3ad75c;});}return null;};}function removeEntity(_0xe4e0f2,_0x49f67b){return function(_0x15a5a0){if(_0x15a5a0){return _0x15a5a0['destroy']()[_0x1498('0x28')](function(){_0xe4e0f2[_0x1498('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a7df,_0x8d49e1){return function(_0x543bd0){if(!_0x543bd0){_0x11a7df['sendStatus'](0x194);}return _0x543bd0;};}function handleError(_0x5ec979,_0x541ab2){_0x541ab2=_0x541ab2||0x1f4;return function(_0x3a1594){logger['error'](_0x3a1594[_0x1498('0x29')]);if(_0x3a1594[_0x1498('0x2a')]){delete _0x3a1594[_0x1498('0x2a')];}_0x5ec979['status'](_0x541ab2)['send'](_0x3a1594);};}exports[_0x1498('0x2b')]=function(_0x3751fb,_0x42cdd0){var _0x5dd1e5={},_0x3a0c36={},_0xdb532a={'count':0x0,'rows':[]};var _0x417c23=_[_0x1498('0x2c')](db[_0x1498('0x2d')]['rawAttributes'],function(_0x183b7f){return{'name':_0x183b7f['fieldName'],'type':_0x183b7f['type']['key']};});_0x3a0c36[_0x1498('0x2e')]=_['map'](_0x417c23,_0x1498('0x2a'));_0x3a0c36[_0x1498('0x2f')]=_['keys'](_0x3751fb[_0x1498('0x2f')]);_0x3a0c36[_0x1498('0x30')]=_[_0x1498('0x31')](_0x3a0c36[_0x1498('0x2e')],_0x3a0c36['query']);_0x5dd1e5[_0x1498('0x32')]=_[_0x1498('0x31')](_0x3a0c36[_0x1498('0x2e')],qs[_0x1498('0x33')](_0x3751fb[_0x1498('0x2f')]['fields']));_0x5dd1e5[_0x1498('0x32')]=_0x5dd1e5[_0x1498('0x32')][_0x1498('0x34')]?_0x5dd1e5['attributes']:_0x3a0c36[_0x1498('0x2e')];if(!_0x3751fb['query'][_0x1498('0x35')](_0x1498('0x36'))){_0x5dd1e5[_0x1498('0x22')]=qs[_0x1498('0x22')](_0x3751fb['query'][_0x1498('0x22')]);_0x5dd1e5[_0x1498('0x20')]=qs[_0x1498('0x20')](_0x3751fb['query']['offset']);}_0x5dd1e5[_0x1498('0x37')]=qs[_0x1498('0x38')](_0x3751fb[_0x1498('0x2f')]['sort']);_0x5dd1e5[_0x1498('0x39')]=qs[_0x1498('0x30')](_['pick'](_0x3751fb[_0x1498('0x2f')],_0x3a0c36[_0x1498('0x30')]),_0x417c23);if(_0x3751fb[_0x1498('0x2f')][_0x1498('0x3a')]){_0x5dd1e5[_0x1498('0x39')]=_[_0x1498('0x3b')](_0x5dd1e5[_0x1498('0x39')],{'$or':_[_0x1498('0x2c')](_0x417c23,function(_0x4e751a){if(_0x4e751a['type']!==_0x1498('0x3c')){var _0x381b53={};_0x381b53[_0x4e751a['name']]={'$like':'%'+_0x3751fb[_0x1498('0x2f')]['filter']+'%'};return _0x381b53;}})});}_0x5dd1e5=_[_0x1498('0x3b')]({},_0x5dd1e5,_0x3751fb['options']);var _0x766743={'where':_0x5dd1e5[_0x1498('0x39')]};return db[_0x1498('0x2d')][_0x1498('0x23')](_0x766743)['then'](function(_0x352293){_0xdb532a[_0x1498('0x23')]=_0x352293;if(_0x3751fb[_0x1498('0x2f')][_0x1498('0x3d')]){_0x5dd1e5[_0x1498('0x3e')]=[{'all':!![]}];}return db[_0x1498('0x2d')][_0x1498('0x3f')](_0x5dd1e5);})[_0x1498('0x28')](function(_0xe420d1){_0xdb532a[_0x1498('0x40')]=_0xe420d1;return _0xdb532a;})[_0x1498('0x28')](respondWithFilteredResult(_0x42cdd0,_0x5dd1e5))[_0x1498('0x41')](handleError(_0x42cdd0,null));};exports[_0x1498('0x42')]=function(_0x327549,_0x29c832){var _0x1cc8c7={'raw':!![],'where':{'id':_0x327549[_0x1498('0x43')]['id']}},_0x1d0876={};_0x1d0876[_0x1498('0x2e')]=_[_0x1498('0x44')](db[_0x1498('0x2d')]['rawAttributes']);_0x1d0876[_0x1498('0x2f')]=_['keys'](_0x327549[_0x1498('0x2f')]);_0x1d0876[_0x1498('0x30')]=_['intersection'](_0x1d0876[_0x1498('0x2e')],_0x1d0876[_0x1498('0x2f')]);_0x1cc8c7[_0x1498('0x32')]=_[_0x1498('0x31')](_0x1d0876['model'],qs['fields'](_0x327549[_0x1498('0x2f')]['fields']));_0x1cc8c7[_0x1498('0x32')]=_0x1cc8c7[_0x1498('0x32')][_0x1498('0x34')]?_0x1cc8c7[_0x1498('0x32')]:_0x1d0876['model'];if(_0x327549['query']['includeAll']){_0x1cc8c7[_0x1498('0x3e')]=[{'all':!![]}];}_0x1cc8c7=_[_0x1498('0x3b')]({},_0x1cc8c7,_0x327549[_0x1498('0x45')]);return db['OpenchannelApplication'][_0x1498('0x46')](_0x1cc8c7)[_0x1498('0x28')](handleEntityNotFound(_0x29c832,null))[_0x1498('0x28')](respondWithResult(_0x29c832,null))[_0x1498('0x41')](handleError(_0x29c832,null));};exports[_0x1498('0x47')]=function(_0x47b04a,_0x47139b){return db[_0x1498('0x2d')][_0x1498('0x47')](_0x47b04a['body'],{})[_0x1498('0x28')](respondWithResult(_0x47139b,0xc9))[_0x1498('0x41')](handleError(_0x47139b,null));};exports[_0x1498('0x27')]=function(_0x4a6828,_0x436e18){if(_0x4a6828[_0x1498('0x48')]['id']){delete _0x4a6828[_0x1498('0x48')]['id'];}return db['OpenchannelApplication'][_0x1498('0x46')]({'where':{'id':_0x4a6828[_0x1498('0x43')]['id']}})['then'](handleEntityNotFound(_0x436e18,null))[_0x1498('0x28')](saveUpdates(_0x4a6828['body'],null))['then'](respondWithResult(_0x436e18,null))[_0x1498('0x41')](handleError(_0x436e18,null));};exports['destroy']=function(_0x3ad0c9,_0x5913ee){return db[_0x1498('0x2d')]['find']({'where':{'id':_0x3ad0c9[_0x1498('0x43')]['id']}})['then'](handleEntityNotFound(_0x5913ee,null))[_0x1498('0x28')](removeEntity(_0x5913ee,null))[_0x1498('0x41')](handleError(_0x5913ee,null));}; \ No newline at end of file +var _0xc74f=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelApplication','findAll','rows','show','params','find','create','update','body','catch','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0xc74f,0x142));var _0xfc74=function(_0x3f9de4,_0x5d2200){_0x3f9de4=_0x3f9de4-0x0;var _0x4379bb=_0xc74f[_0x3f9de4];return _0x4379bb;};'use strict';var emlformat=require(_0xfc74('0x0'));var rimraf=require(_0xfc74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc74('0x2'));var moment=require('moment');var BPromise=require(_0xfc74('0x3'));var Mustache=require('mustache');var util=require(_0xfc74('0x4'));var path=require(_0xfc74('0x5'));var sox=require(_0xfc74('0x6'));var csv=require(_0xfc74('0x7'));var ejs=require(_0xfc74('0x8'));var fs=require('fs');var fs_extra=require(_0xfc74('0x9'));var _=require(_0xfc74('0xa'));var squel=require(_0xfc74('0xb'));var crypto=require(_0xfc74('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfc74('0xd'));var toCsv=require(_0xfc74('0x7'));var querystring=require(_0xfc74('0xe'));var Papa=require(_0xfc74('0xf'));var Redis=require(_0xfc74('0x10'));var authService=require(_0xfc74('0x11'));var qs=require(_0xfc74('0x12'));var as=require(_0xfc74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc74('0x14'))(_0xfc74('0x15'));var utils=require(_0xfc74('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfc74('0x17'));var db=require(_0xfc74('0x18'))['db'];function respondWithStatusCode(_0x3a6343,_0x38e6df){_0x38e6df=_0x38e6df||0xcc;return function(_0x459845){if(_0x459845){return _0x3a6343['sendStatus'](_0x38e6df);}return _0x3a6343[_0xfc74('0x19')](_0x38e6df)[_0xfc74('0x1a')]();};}function respondWithResult(_0x4cbb06,_0x17af83){_0x17af83=_0x17af83||0xc8;return function(_0x386032){if(_0x386032){return _0x4cbb06[_0xfc74('0x19')](_0x17af83)[_0xfc74('0x1b')](_0x386032);}};}function respondWithFilteredResult(_0x35223d,_0x2d2831){return function(_0x48fea4){if(_0x48fea4){var _0x4f7245=typeof _0x2d2831[_0xfc74('0x1c')]===_0xfc74('0x1d')&&typeof _0x2d2831[_0xfc74('0x1e')]===_0xfc74('0x1d');var _0x2d24b1=_0x48fea4[_0xfc74('0x1f')];var _0x180b8e=_0x4f7245?0x0:_0x2d2831[_0xfc74('0x1c')];var _0x415f11=_0x4f7245?_0x48fea4[_0xfc74('0x1f')]:_0x2d2831[_0xfc74('0x1c')]+_0x2d2831[_0xfc74('0x1e')];var _0x3cac47;if(_0x415f11>=_0x2d24b1){_0x415f11=_0x2d24b1;_0x3cac47=0xc8;}else{_0x3cac47=0xce;}_0x35223d['status'](_0x3cac47);return _0x35223d[_0xfc74('0x20')]('Content-Range',_0x180b8e+'-'+_0x415f11+'/'+_0x2d24b1)['json'](_0x48fea4);}return null;};}function patchUpdates(_0x383619){return function(_0x5367ba){try{jsonpatch[_0xfc74('0x21')](_0x5367ba,_0x383619,!![]);}catch(_0x375dfe){return BPromise[_0xfc74('0x22')](_0x375dfe);}return _0x5367ba['save']();};}function saveUpdates(_0x8a989a,_0xbb7d28){return function(_0x5afe5f){if(_0x5afe5f){return _0x5afe5f['update'](_0x8a989a)[_0xfc74('0x23')](function(_0x4a77ad){return _0x4a77ad;});}return null;};}function removeEntity(_0x32e83a,_0x97602e){return function(_0x4d1253){if(_0x4d1253){return _0x4d1253[_0xfc74('0x24')]()['then'](function(){_0x32e83a[_0xfc74('0x19')](0xcc)[_0xfc74('0x1a')]();});}};}function handleEntityNotFound(_0x37127e,_0x2e0413){return function(_0x5b42da){if(!_0x5b42da){_0x37127e[_0xfc74('0x25')](0x194);}return _0x5b42da;};}function handleError(_0x106bd0,_0x285a2a){_0x285a2a=_0x285a2a||0x1f4;return function(_0x38d552){logger[_0xfc74('0x26')](_0x38d552['stack']);if(_0x38d552['name']){delete _0x38d552[_0xfc74('0x27')];}_0x106bd0['status'](_0x285a2a)[_0xfc74('0x28')](_0x38d552);};}exports[_0xfc74('0x29')]=function(_0x3b0df9,_0x115cba){var _0x3bd30c={},_0x1cf3b2={},_0x5d4aba={'count':0x0,'rows':[]};var _0x335f1c=_[_0xfc74('0x2a')](db['OpenchannelApplication'][_0xfc74('0x2b')],function(_0x4b7200){return{'name':_0x4b7200[_0xfc74('0x2c')],'type':_0x4b7200[_0xfc74('0x2d')][_0xfc74('0x2e')]};});_0x1cf3b2[_0xfc74('0x2f')]=_[_0xfc74('0x2a')](_0x335f1c,_0xfc74('0x27'));_0x1cf3b2['query']=_[_0xfc74('0x30')](_0x3b0df9[_0xfc74('0x31')]);_0x1cf3b2[_0xfc74('0x32')]=_[_0xfc74('0x33')](_0x1cf3b2[_0xfc74('0x2f')],_0x1cf3b2['query']);_0x3bd30c['attributes']=_['intersection'](_0x1cf3b2[_0xfc74('0x2f')],qs[_0xfc74('0x34')](_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x34')]));_0x3bd30c[_0xfc74('0x35')]=_0x3bd30c[_0xfc74('0x35')][_0xfc74('0x36')]?_0x3bd30c[_0xfc74('0x35')]:_0x1cf3b2[_0xfc74('0x2f')];if(!_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x37')](_0xfc74('0x38'))){_0x3bd30c[_0xfc74('0x1e')]=qs[_0xfc74('0x1e')](_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x1e')]);_0x3bd30c[_0xfc74('0x1c')]=qs[_0xfc74('0x1c')](_0x3b0df9['query'][_0xfc74('0x1c')]);}_0x3bd30c['order']=qs[_0xfc74('0x39')](_0x3b0df9['query']['sort']);_0x3bd30c[_0xfc74('0x3a')]=qs[_0xfc74('0x32')](_[_0xfc74('0x3b')](_0x3b0df9[_0xfc74('0x31')],_0x1cf3b2[_0xfc74('0x32')]),_0x335f1c);if(_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x3c')]){_0x3bd30c[_0xfc74('0x3a')]=_[_0xfc74('0x3d')](_0x3bd30c[_0xfc74('0x3a')],{'$or':_['map'](_0x335f1c,function(_0x536a0e){if(_0x536a0e['type']!==_0xfc74('0x3e')){var _0x3e1eb4={};_0x3e1eb4[_0x536a0e[_0xfc74('0x27')]]={'$like':'%'+_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x3c')]+'%'};return _0x3e1eb4;}})});}_0x3bd30c=_[_0xfc74('0x3d')]({},_0x3bd30c,_0x3b0df9[_0xfc74('0x3f')]);var _0x4e471c={'where':_0x3bd30c[_0xfc74('0x3a')]};return db['OpenchannelApplication'][_0xfc74('0x1f')](_0x4e471c)[_0xfc74('0x23')](function(_0x8890b1){_0x5d4aba[_0xfc74('0x1f')]=_0x8890b1;if(_0x3b0df9[_0xfc74('0x31')][_0xfc74('0x40')]){_0x3bd30c[_0xfc74('0x41')]=[{'all':!![]}];}return db[_0xfc74('0x42')][_0xfc74('0x43')](_0x3bd30c);})['then'](function(_0x176144){_0x5d4aba[_0xfc74('0x44')]=_0x176144;return _0x5d4aba;})[_0xfc74('0x23')](respondWithFilteredResult(_0x115cba,_0x3bd30c))['catch'](handleError(_0x115cba,null));};exports[_0xfc74('0x45')]=function(_0x15b4c3,_0x43d332){var _0x298265={'raw':!![],'where':{'id':_0x15b4c3[_0xfc74('0x46')]['id']}},_0x161763={};_0x161763[_0xfc74('0x2f')]=_[_0xfc74('0x30')](db[_0xfc74('0x42')][_0xfc74('0x2b')]);_0x161763[_0xfc74('0x31')]=_[_0xfc74('0x30')](_0x15b4c3[_0xfc74('0x31')]);_0x161763[_0xfc74('0x32')]=_['intersection'](_0x161763[_0xfc74('0x2f')],_0x161763[_0xfc74('0x31')]);_0x298265[_0xfc74('0x35')]=_['intersection'](_0x161763[_0xfc74('0x2f')],qs[_0xfc74('0x34')](_0x15b4c3[_0xfc74('0x31')][_0xfc74('0x34')]));_0x298265['attributes']=_0x298265[_0xfc74('0x35')][_0xfc74('0x36')]?_0x298265[_0xfc74('0x35')]:_0x161763['model'];if(_0x15b4c3[_0xfc74('0x31')]['includeAll']){_0x298265[_0xfc74('0x41')]=[{'all':!![]}];}_0x298265=_[_0xfc74('0x3d')]({},_0x298265,_0x15b4c3[_0xfc74('0x3f')]);return db[_0xfc74('0x42')][_0xfc74('0x47')](_0x298265)[_0xfc74('0x23')](handleEntityNotFound(_0x43d332,null))[_0xfc74('0x23')](respondWithResult(_0x43d332,null))['catch'](handleError(_0x43d332,null));};exports[_0xfc74('0x48')]=function(_0x19c336,_0x21710c){return db[_0xfc74('0x42')][_0xfc74('0x48')](_0x19c336['body'],{})['then'](respondWithResult(_0x21710c,0xc9))['catch'](handleError(_0x21710c,null));};exports[_0xfc74('0x49')]=function(_0x2d5b7c,_0x1ed8af){if(_0x2d5b7c[_0xfc74('0x4a')]['id']){delete _0x2d5b7c[_0xfc74('0x4a')]['id'];}return db[_0xfc74('0x42')][_0xfc74('0x47')]({'where':{'id':_0x2d5b7c['params']['id']}})[_0xfc74('0x23')](handleEntityNotFound(_0x1ed8af,null))[_0xfc74('0x23')](saveUpdates(_0x2d5b7c[_0xfc74('0x4a')],null))[_0xfc74('0x23')](respondWithResult(_0x1ed8af,null))[_0xfc74('0x4b')](handleError(_0x1ed8af,null));};exports['destroy']=function(_0x24e4b6,_0x1a1ec9){return db[_0xfc74('0x42')]['find']({'where':{'id':_0x24e4b6[_0xfc74('0x46')]['id']}})[_0xfc74('0x23')](handleEntityNotFound(_0x1a1ec9,null))['then'](removeEntity(_0x1a1ec9,null))[_0xfc74('0x4b')](handleError(_0x1a1ec9,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b077e89..1e04958 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 _0xc841=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x25e94a,_0x2c4b4f){var _0x5dba67=function(_0x2b27a7){while(--_0x2b27a7){_0x25e94a['push'](_0x25e94a['shift']());}};_0x5dba67(++_0x2c4b4f);}(_0xc841,0x17a));var _0x1c84=function(_0x387ab7,_0x308ba1){_0x387ab7=_0x387ab7-0x0;var _0x1e7f43=_0xc841[_0x387ab7];return _0x1e7f43;};'use strict';var _=require(_0x1c84('0x0'));var util=require(_0x1c84('0x1'));var logger=require(_0x1c84('0x2'))(_0x1c84('0x3'));var moment=require(_0x1c84('0x4'));var BPromise=require(_0x1c84('0x5'));var rp=require(_0x1c84('0x6'));var fs=require('fs');var path=require(_0x1c84('0x7'));var rimraf=require(_0x1c84('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x1fe757,_0x4b0625){return _0x1fe757[_0x1c84('0x9')](_0x1c84('0xa'),attributes,{'tableName':_0x1c84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c84('0xc'),'collate':_0x1c84('0xd')});}; \ No newline at end of file +var _0xd4a7=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelApplication','utf8mb4','lodash'];(function(_0x1b8b04,_0x2d8e31){var _0x295de1=function(_0x1677a9){while(--_0x1677a9){_0x1b8b04['push'](_0x1b8b04['shift']());}};_0x295de1(++_0x2d8e31);}(_0xd4a7,0x13e));var _0x7d4a=function(_0xc9defb,_0x3199c9){_0xc9defb=_0xc9defb-0x0;var _0x4f0310=_0xd4a7[_0xc9defb];return _0x4f0310;};'use strict';var _=require(_0x7d4a('0x0'));var util=require(_0x7d4a('0x1'));var logger=require(_0x7d4a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d4a('0x3'));var rp=require(_0x7d4a('0x4'));var fs=require('fs');var path=require(_0x7d4a('0x5'));var rimraf=require(_0x7d4a('0x6'));var config=require(_0x7d4a('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x7d4a('0x8')]=function(_0x620fc7,_0x124d18){return _0x620fc7['define'](_0x7d4a('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d4a('0xa'),'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 4455412..e95d55e 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 _0xdc69=['rpc','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','where','attributes','then','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e89d4,_0x178435){var _0x1ac198=function(_0x2fb9ff){while(--_0x2fb9ff){_0x4e89d4['push'](_0x4e89d4['shift']());}};_0x1ac198(++_0x178435);}(_0xdc69,0x156));var _0x9dc6=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xdc69[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0x9dc6('0x0'));var util=require('util');var moment=require(_0x9dc6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc6('0x2'));var db=require(_0x9dc6('0x3'))['db'];var utils=require(_0x9dc6('0x4'));var logger=require(_0x9dc6('0x5'))(_0x9dc6('0x6'));var config=require('../../config/environment');var jayson=require(_0x9dc6('0x7'));var client=jayson[_0x9dc6('0x8')][_0x9dc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15c6ad,_0x35f627,_0x10dcc1){return new BPromise(function(_0x184485,_0x505274){return client[_0x9dc6('0xa')](_0x15c6ad,_0x10dcc1)['then'](function(_0x1f58bb){logger[_0x9dc6('0xb')](_0x9dc6('0xc'),_0x35f627,_0x9dc6('0xd'));logger[_0x9dc6('0xe')](_0x9dc6('0xf'),_0x35f627,_0x9dc6('0xd'),JSON[_0x9dc6('0x10')](_0x1f58bb));if(_0x1f58bb[_0x9dc6('0x11')]){if(_0x1f58bb[_0x9dc6('0x11')][_0x9dc6('0x12')]===0x1f4){logger[_0x9dc6('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x35f627,_0x1f58bb[_0x9dc6('0x11')][_0x9dc6('0x13')]);return _0x505274(_0x1f58bb['error'][_0x9dc6('0x13')]);}logger['error'](_0x9dc6('0xc'),_0x35f627,_0x1f58bb[_0x9dc6('0x11')][_0x9dc6('0x13')]);return _0x184485(_0x1f58bb['error'][_0x9dc6('0x13')]);}else{logger[_0x9dc6('0xb')](_0x9dc6('0xc'),_0x35f627,_0x9dc6('0xd'));_0x184485(_0x1f58bb[_0x9dc6('0x14')][_0x9dc6('0x13')]);}})[_0x9dc6('0x15')](function(_0xfafc3){logger['error'](_0x9dc6('0xc'),_0x35f627,_0xfafc3);_0x505274(_0xfafc3);});});}exports[_0x9dc6('0x16')]=function(_0x291352){var _0x77cc13=this;return new Promise(function(_0x98c789,_0x11670b){return db[_0x9dc6('0x17')][_0x9dc6('0x18')](_0x291352['body'],{'raw':_0x291352[_0x9dc6('0x19')]?_0x291352[_0x9dc6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x291352['options']?_0x291352[_0x9dc6('0x19')][_0x9dc6('0x1a')]||null:null,'attributes':_0x291352['options']?_0x291352[_0x9dc6('0x19')][_0x9dc6('0x1b')]||null:null,'limit':_0x291352[_0x9dc6('0x19')]?_0x291352[_0x9dc6('0x19')]['limit']||null:null})[_0x9dc6('0x1c')](function(_0x1313cc){logger[_0x9dc6('0xb')](_0x9dc6('0x16'),_0x291352);logger[_0x9dc6('0xe')]('UpdateOpenchannelApplication',_0x291352,JSON['stringify'](_0x1313cc));_0x98c789(_0x1313cc);})[_0x9dc6('0x15')](function(_0xdb2fc2){logger[_0x9dc6('0x11')](_0x9dc6('0x16'),_0xdb2fc2[_0x9dc6('0x13')],_0x291352);_0x11670b(_0x77cc13[_0x9dc6('0x11')](0x1f4,_0xdb2fc2[_0x9dc6('0x13')]));});});}; \ No newline at end of file +var _0x1ec0=['rpc','../../config/environment','client','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd960db,_0x22b6f1){var _0x113309=function(_0x2c273f){while(--_0x2c273f){_0xd960db['push'](_0xd960db['shift']());}};_0x113309(++_0x22b6f1);}(_0x1ec0,0x19c));var _0x01ec=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0x1ec0[_0x19a90e];return _0xa49b11;};'use strict';var _=require(_0x01ec('0x0'));var util=require('util');var moment=require(_0x01ec('0x1'));var BPromise=require(_0x01ec('0x2'));var rs=require(_0x01ec('0x3'));var fs=require('fs');var Redis=require(_0x01ec('0x4'));var db=require(_0x01ec('0x5'))['db'];var utils=require(_0x01ec('0x6'));var logger=require(_0x01ec('0x7'))(_0x01ec('0x8'));var config=require(_0x01ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x01ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280603,_0x497ce6,_0x25fc0b){return new BPromise(function(_0x7eebcf,_0x1c4146){return client[_0x01ec('0xb')](_0x280603,_0x25fc0b)[_0x01ec('0xc')](function(_0x4f1806){logger[_0x01ec('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x497ce6,_0x01ec('0xe'));logger[_0x01ec('0xf')](_0x01ec('0x10'),_0x497ce6,_0x01ec('0xe'),JSON[_0x01ec('0x11')](_0x4f1806));if(_0x4f1806[_0x01ec('0x12')]){if(_0x4f1806['error']['code']===0x1f4){logger['error'](_0x01ec('0x13'),_0x497ce6,_0x4f1806['error'][_0x01ec('0x14')]);return _0x1c4146(_0x4f1806[_0x01ec('0x12')][_0x01ec('0x14')]);}logger[_0x01ec('0x12')](_0x01ec('0x13'),_0x497ce6,_0x4f1806[_0x01ec('0x12')][_0x01ec('0x14')]);return _0x7eebcf(_0x4f1806[_0x01ec('0x12')][_0x01ec('0x14')]);}else{logger[_0x01ec('0xd')](_0x01ec('0x13'),_0x497ce6,'request\x20sent');_0x7eebcf(_0x4f1806[_0x01ec('0x15')][_0x01ec('0x14')]);}})[_0x01ec('0x16')](function(_0x37a3b8){logger[_0x01ec('0x12')](_0x01ec('0x13'),_0x497ce6,_0x37a3b8);_0x1c4146(_0x37a3b8);});});}exports[_0x01ec('0x17')]=function(_0x521d21){var _0x5aced5=this;return new Promise(function(_0x382f47,_0xf25d12){return db[_0x01ec('0x18')][_0x01ec('0x19')](_0x521d21[_0x01ec('0x1a')],{'raw':_0x521d21['options']?_0x521d21[_0x01ec('0x1b')][_0x01ec('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521d21[_0x01ec('0x1b')]?_0x521d21[_0x01ec('0x1b')][_0x01ec('0x1d')]||null:null,'attributes':_0x521d21[_0x01ec('0x1b')]?_0x521d21[_0x01ec('0x1b')]['attributes']||null:null,'limit':_0x521d21[_0x01ec('0x1b')]?_0x521d21[_0x01ec('0x1b')]['limit']||null:null})[_0x01ec('0xc')](function(_0x5772d6){logger['info'](_0x01ec('0x17'),_0x521d21);logger[_0x01ec('0xf')](_0x01ec('0x17'),_0x521d21,JSON['stringify'](_0x5772d6));_0x382f47(_0x5772d6);})['catch'](function(_0x275b34){logger[_0x01ec('0x12')](_0x01ec('0x17'),_0x275b34[_0x01ec('0x14')],_0x521d21);_0xf25d12(_0x5aced5[_0x01ec('0x12')](0x1f4,_0x275b34[_0x01ec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9d68024..f788d10 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 _0xfa2e=['create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0xfa2e,0x10d));var _0xefa2=function(_0x3c12e0,_0x2a4ee9){_0x3c12e0=_0x3c12e0-0x0;var _0x463436=_0xfa2e[_0x3c12e0];return _0x463436;};'use strict';var multer=require('multer');var util=require(_0xefa2('0x0'));var path=require(_0xefa2('0x1'));var timeout=require(_0xefa2('0x2'));var express=require(_0xefa2('0x3'));var router=express[_0xefa2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xefa2('0x5'));var interaction=require(_0xefa2('0x6'));var config=require(_0xefa2('0x7'));var controller=require(_0xefa2('0x8'));router[_0xefa2('0x9')]('/',auth['isAuthenticated'](),controller[_0xefa2('0xa')]);router[_0xefa2('0x9')](_0xefa2('0xb'),auth[_0xefa2('0xc')](),controller[_0xefa2('0xd')]);router[_0xefa2('0x9')](_0xefa2('0xe'),auth[_0xefa2('0xc')](),controller[_0xefa2('0xf')]);router['get']('/:id/messages',auth[_0xefa2('0xc')](),controller['getMessages']);router[_0xefa2('0x9')](_0xefa2('0x10'),auth['isAuthenticated'](),controller[_0xefa2('0x11')]);router[_0xefa2('0x12')]('/',auth['isAuthenticated'](),controller[_0xefa2('0x13')]);router[_0xefa2('0x12')](_0xefa2('0x14'),auth[_0xefa2('0xc')](),controller[_0xefa2('0x15')]);router[_0xefa2('0x12')](_0xefa2('0x16'),auth['isAuthenticated'](),interaction[_0xefa2('0x17')](_0xefa2('0x18'),'openchannelinteraction:addtags'),controller[_0xefa2('0x19')]);router[_0xefa2('0x1a')]('/:id',auth[_0xefa2('0xc')](),interaction[_0xefa2('0x17')](_0xefa2('0x18'),_0xefa2('0x1b')),controller['update']);router[_0xefa2('0x1c')](_0xefa2('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xefa2('0x18'),'openchannelinteraction:destroy'),controller[_0xefa2('0x1d')]);router['delete'](_0xefa2('0x16'),auth['isAuthenticated'](),controller[_0xefa2('0x1e')]);module[_0xefa2('0x1f')]=router; \ No newline at end of file +var _0x77cf=['update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel'];(function(_0xa133cb,_0x8f569a){var _0x1b2768=function(_0x44798e){while(--_0x44798e){_0xa133cb['push'](_0xa133cb['shift']());}};_0x1b2768(++_0x8f569a);}(_0x77cf,0x1d7));var _0xf77c=function(_0x201357,_0x1df061){_0x201357=_0x201357-0x0;var _0x39da12=_0x77cf[_0x201357];return _0x39da12;};'use strict';var multer=require('multer');var util=require(_0xf77c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf77c('0x1'));var router=express['Router']();var fs_extra=require(_0xf77c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xf77c('0x3'));var config=require(_0xf77c('0x4'));var controller=require(_0xf77c('0x5'));router[_0xf77c('0x6')]('/',auth[_0xf77c('0x7')](),controller[_0xf77c('0x8')]);router[_0xf77c('0x6')](_0xf77c('0x9'),auth[_0xf77c('0x7')](),controller[_0xf77c('0xa')]);router[_0xf77c('0x6')](_0xf77c('0xb'),auth[_0xf77c('0x7')](),controller[_0xf77c('0xc')]);router[_0xf77c('0x6')]('/:id/messages',auth[_0xf77c('0x7')](),controller[_0xf77c('0xd')]);router[_0xf77c('0x6')](_0xf77c('0xe'),auth[_0xf77c('0x7')](),controller[_0xf77c('0xf')]);router[_0xf77c('0x10')]('/',auth[_0xf77c('0x7')](),controller[_0xf77c('0x11')]);router[_0xf77c('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf77c('0x12')]);router['post'](_0xf77c('0x13'),auth['isAuthenticated'](),interaction[_0xf77c('0x14')]('openchannel',_0xf77c('0x15')),controller[_0xf77c('0x16')]);router[_0xf77c('0x17')](_0xf77c('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf77c('0x18'),'openchannelinteraction:update'),controller[_0xf77c('0x19')]);router['delete'](_0xf77c('0xb'),auth[_0xf77c('0x7')](),interaction['tracked'](_0xf77c('0x18'),_0xf77c('0x1a')),controller[_0xf77c('0x1b')]);router[_0xf77c('0x1c')](_0xf77c('0x13'),auth[_0xf77c('0x7')](),controller[_0xf77c('0x1d')]);module[_0xf77c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e2964e8..58291e9 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 _0xaa0b=['DATE','STRING','ENUM','sequelize','exports'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xaa0b,0x1b1));var _0xbaa0=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xaa0b[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xbaa0('0x0'));module[_0xbaa0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbaa0('0x2')]},'disposition':{'type':Sequelize[_0xbaa0('0x3')]},'secondDisposition':{'type':Sequelize[_0xbaa0('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbaa0('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbaa0('0x2')]},'threadId':{'type':Sequelize[_0xbaa0('0x3')]},'externalUrl':{'type':Sequelize[_0xbaa0('0x3')]},'lastMsgAt':{'type':Sequelize[_0xbaa0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbaa0('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbaa0('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x406f=['STRING','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x406f,0xe8));var _0xf406=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x406f[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0xf406('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf406('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf406('0x2')]},'secondDisposition':{'type':Sequelize[_0xf406('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf406('0x2')]},'note':{'type':Sequelize[_0xf406('0x2')]},'read1stAt':{'type':Sequelize[_0xf406('0x3')]},'threadId':{'type':Sequelize[_0xf406('0x2')]},'externalUrl':{'type':Sequelize[_0xf406('0x2')]},'lastMsgAt':{'type':Sequelize[_0xf406('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf406('0x4')]('in',_0xf406('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xf406('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 45dd900..b4d4d6c 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 _0xc320=['query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','pick','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','unreadMessages','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)','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','text','body','buildExpression','some','compact','isEmpty','OpenchannelAccountId','where','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','sequelize','toString','count','keyBy','merge','a.key','Account.key','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.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','rows','show','params','includeAll','options','create','update','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','join','server','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','limit','undefined','offset','apply','save','then','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','catch','total','UserId','waiting','closed','talking','unmanaged','index','OpenchannelInteraction','rawAttributes','type','key','model'];(function(_0x5da87b,_0x2015c3){var _0x1a1f02=function(_0x2db746){while(--_0x2db746){_0x5da87b['push'](_0x5da87b['shift']());}};_0x1a1f02(++_0x2015c3);}(_0xc320,0xb4));var _0x0c32=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc320[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x0c32('0x0'));var rimraf=require(_0x0c32('0x1'));var zipdir=require(_0x0c32('0x2'));var jsonpatch=require(_0x0c32('0x3'));var rp=require(_0x0c32('0x4'));var moment=require(_0x0c32('0x5'));var BPromise=require(_0x0c32('0x6'));var Mustache=require('mustache');var util=require(_0x0c32('0x7'));var path=require('path');var sox=require(_0x0c32('0x8'));var csv=require(_0x0c32('0x9'));var ejs=require(_0x0c32('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c32('0xb'));var squel=require(_0x0c32('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c32('0xd'));var toCsv=require(_0x0c32('0x9'));var querystring=require(_0x0c32('0xe'));var Papa=require(_0x0c32('0xf'));var Redis=require('ioredis');var authService=require(_0x0c32('0x10'));var qs=require(_0x0c32('0x11'));var as=require(_0x0c32('0x12'));var pdf=require(_0x0c32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c32('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0c32('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c32('0x16'))['db'];config[_0x0c32('0x17')]=_[_0x0c32('0x18')](config[_0x0c32('0x17')],{'host':_0x0c32('0x19'),'port':0x18eb});var socket=require(_0x0c32('0x1a'))(new Redis(config[_0x0c32('0x17')]));require(_0x0c32('0x1b'))['register'](socket);function respondWithStatusCode(_0x52b10d,_0x2c5930){_0x2c5930=_0x2c5930||0xcc;return function(_0x160819){if(_0x160819){return _0x52b10d['sendStatus'](_0x2c5930);}return _0x52b10d[_0x0c32('0x1c')](_0x2c5930)[_0x0c32('0x1d')]();};}function respondWithResult(_0x328947,_0x3a3be2){_0x3a3be2=_0x3a3be2||0xc8;return function(_0x67aa7e){if(_0x67aa7e){return _0x328947[_0x0c32('0x1c')](_0x3a3be2)[_0x0c32('0x1e')](_0x67aa7e);}};}function respondWithFilteredResult(_0x1ae5df,_0x52313d){return function(_0x2d0efc){if(_0x2d0efc){var _0x49b25d=typeof _0x52313d['offset']==='undefined'&&typeof _0x52313d[_0x0c32('0x1f')]===_0x0c32('0x20');var _0x220f2f=_0x2d0efc['count'];var _0x463983=_0x49b25d?0x0:_0x52313d[_0x0c32('0x21')];var _0x229169=_0x49b25d?_0x2d0efc['count']:_0x52313d[_0x0c32('0x21')]+_0x52313d['limit'];var _0x252f54;if(_0x229169>=_0x220f2f){_0x229169=_0x220f2f;_0x252f54=0xc8;}else{_0x252f54=0xce;}_0x1ae5df[_0x0c32('0x1c')](_0x252f54);return _0x1ae5df['set']('Content-Range',_0x463983+'-'+_0x229169+'/'+_0x220f2f)[_0x0c32('0x1e')](_0x2d0efc);}return null;};}function patchUpdates(_0x2b66bc){return function(_0x2ed925){try{jsonpatch[_0x0c32('0x22')](_0x2ed925,_0x2b66bc,!![]);}catch(_0x420596){return BPromise['reject'](_0x420596);}return _0x2ed925[_0x0c32('0x23')]();};}function saveUpdates(_0x22bb71,_0x48c6f2){return function(_0x446cc6){if(_0x446cc6){return _0x446cc6['update'](_0x22bb71)['then'](function(_0x2750f4){return _0x2750f4;});}return null;};}function removeEntity(_0x1ef2a6,_0x2e3fea){return function(_0xf6c6ed){if(_0xf6c6ed){return _0xf6c6ed['destroy']()[_0x0c32('0x24')](function(){_0x1ef2a6[_0x0c32('0x1c')](0xcc)[_0x0c32('0x1d')]();});}};}function handleEntityNotFound(_0xf51d73,_0xfc3985){return function(_0x10e5bd){if(!_0x10e5bd){_0xf51d73['sendStatus'](0x194);}return _0x10e5bd;};}function handleError(_0x5cf7d9,_0x5ba493){_0x5ba493=_0x5ba493||0x1f4;return function(_0x14e62c){logger[_0x0c32('0x25')](_0x14e62c[_0x0c32('0x26')]);if(_0x14e62c[_0x0c32('0x27')]){delete _0x14e62c[_0x0c32('0x27')];}_0x5cf7d9[_0x0c32('0x1c')](_0x5ba493)[_0x0c32('0x28')](_0x14e62c);};}function getInteractionUsers(_0x42a725,_0x19b304){return new BPromise(function(_0x2ec25a,_0x179409){try{if(_0x19b304[_0x42a725['id']]){_0x42a725[_0x0c32('0x29')]=_[_0x0c32('0x2a')](_0x19b304[_0x42a725['id']],function(_0x2a2d2d){return{'id':_0x2a2d2d['id'],'fullname':_0x2a2d2d['fullname']};});}}catch(_0x567080){_0x179409(_0x567080);}_0x2ec25a(_0x42a725);});}function getInteractionTags(_0x2a8795,_0x141a8c){return new BPromise(function(_0x216d41,_0x215792){try{if(_0x2a8795[_0x0c32('0x2b')]){_0x2a8795['Tags']=[];_0x2a8795['TagIds'][_0x0c32('0x2c')](',')[_0x0c32('0x2d')](function(_0x4413b4){_0x2a8795[_0x0c32('0x2e')]['push'](_0x141a8c[_0x4413b4]);});}delete _0x2a8795['TagIds'];}catch(_0x173379){_0x215792(_0x173379);}_0x216d41(_0x2a8795);});}function updateOpenchannelInteraction(_0x3d8b62,_0x3d4759,_0xeef22b){return new BPromise(function(_0x4b794c,_0x220ef5){return getInteractionUsers(_0x3d8b62,_0xeef22b)['then'](function(_0x55b5f3){return getInteractionTags(_0x55b5f3,_0x3d4759);})[_0x0c32('0x24')](function(_0x5387bd){return getStateInteraction(_0x5387bd);})['then'](function(_0x42cd35){_0x4b794c(_0x42cd35);})[_0x0c32('0x2f')](function(_0x2bceed){_0x220ef5(_0x2bceed);});});}function getStateInteraction(_0x781fb3){return new BPromise(function(_0x154b65){_0x781fb3['waiting']=0x0;_0x781fb3['talking']=0x0;_0x781fb3['answered']=0x0;_0x781fb3['unmanaged']=0x0;_0x781fb3[_0x0c32('0x30')]=0x0;if(!_0x781fb3['closed']&&!_0x781fb3[_0x0c32('0x31')]){_0x781fb3[_0x0c32('0x32')]+=0x1;}if(!_0x781fb3[_0x0c32('0x33')]&&_0x781fb3[_0x0c32('0x31')]){_0x781fb3[_0x0c32('0x34')]+=0x1;if(_0x781fb3[_0x0c32('0x32')]){_0x781fb3[_0x0c32('0x32')]-=0x1;}}if(_0x781fb3[_0x0c32('0x33')]&&_0x781fb3[_0x0c32('0x31')]){_0x781fb3['answered']+=0x1;if(_0x781fb3[_0x0c32('0x34')]){_0x781fb3['talking']-=0x1;}}if(_0x781fb3[_0x0c32('0x33')]&&!_0x781fb3[_0x0c32('0x31')]){_0x781fb3[_0x0c32('0x35')]+=0x1;if(_0x781fb3['waiting']){_0x781fb3[_0x0c32('0x32')]-=0x1;}}_0x781fb3[_0x0c32('0x30')]+=0x1;_0x154b65(_0x781fb3);});}exports[_0x0c32('0x36')]=function(_0x2d091d,_0x511a98){var _0x535300={},_0x25acad={},_0x43a4bb={'count':0x0,'rows':[]};var _0x2e8745=_[_0x0c32('0x2a')](db[_0x0c32('0x37')][_0x0c32('0x38')],function(_0x92948e){return{'name':_0x92948e['fieldName'],'type':_0x92948e[_0x0c32('0x39')][_0x0c32('0x3a')]};});_0x25acad[_0x0c32('0x3b')]=_['map'](_0x2e8745,'name');_0x25acad[_0x0c32('0x3c')]=_[_0x0c32('0x3d')](_0x2d091d['query']);_0x25acad[_0x0c32('0x3e')]=_[_0x0c32('0x3f')](_0x25acad[_0x0c32('0x3b')],_0x25acad['query']);_0x535300['attributes']=_[_0x0c32('0x3f')](_0x25acad[_0x0c32('0x3b')],qs[_0x0c32('0x40')](_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x40')]));_0x535300['attributes']=_0x535300['attributes'][_0x0c32('0x41')]?_0x535300[_0x0c32('0x42')]:_0x25acad[_0x0c32('0x3b')];if(!_0x2d091d['query']['hasOwnProperty'](_0x0c32('0x43'))){_0x535300['limit']=qs[_0x0c32('0x1f')](_0x2d091d['query'][_0x0c32('0x1f')]);_0x535300['offset']=qs['offset'](_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x21')]);}_0x535300[_0x0c32('0x44')]=qs[_0x0c32('0x45')](_0x2d091d[_0x0c32('0x3c')]['sort']);_0x535300['where']=qs[_0x0c32('0x3e')](_[_0x0c32('0x46')](_0x2d091d[_0x0c32('0x3c')],_0x25acad['filters']),_0x2e8745);var _0x19a23d=[];var _0xd003b0=squel[_0x0c32('0x47')]()['field']('id')[_0x0c32('0x48')](_0x0c32('0x27'))[_0x0c32('0x48')](_0x0c32('0x49'))[_0x0c32('0x4a')]('tools_tags');var _0x504768=squel[_0x0c32('0x47')]()[_0x0c32('0x48')](_0x0c32('0x4b'))[_0x0c32('0x48')]('u.fullname')[_0x0c32('0x48')](_0x0c32('0x4c'))[_0x0c32('0x4a')](_0x0c32('0x4d'),'ui')[_0x0c32('0x4e')]('users','u',_0x0c32('0x4f'));var _0x2ec297=squel[_0x0c32('0x47')]()[_0x0c32('0x4a')]('openchannel_interactions','i')[_0x0c32('0x4e')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0c32('0x4e')]('users','o',_0x0c32('0x50'))[_0x0c32('0x4e')](_0x0c32('0x51'),'a',_0x0c32('0x52'))[_0x0c32('0x4e')]('openchannel_messages','me',_0x0c32('0x53'))[_0x0c32('0x4e')]('openchannel_interaction_has_tags','it',_0x0c32('0x54'))[_0x0c32('0x4e')](_0x0c32('0x55'),'t',_0x0c32('0x56'));var _0x2c811b=squel['expr']();var _0x452311=[];var _0x1c7cb8=squel[_0x0c32('0x57')]();var _0x17f974;if(_0x2d091d[_0x0c32('0x3c')]['search']){_0x17f974=as[_0x0c32('0x58')](_0x2d091d['query']['search']);var _0x5877ff=_0x17f974['sqlOperator'];for(var _0x28e317=0x0;_0x28e317<_0x17f974[_0x0c32('0x59')]['length'];_0x28e317++){var _0x32e477=_0x17f974[_0x0c32('0x59')][_0x28e317];var _0x504886='i';var _0x514c68=_[_0x0c32('0x5a')](_0x2e8745,[_0x0c32('0x27'),_0x32e477[_0x0c32('0x48')]]);if(!_0x514c68){switch(_0x32e477['field']){case _0x0c32('0x5b'):if(_0x32e477[_0x0c32('0x5c')]==0x1){_0x2ec297[_0x0c32('0x5d')]('`'+_0x32e477[_0x0c32('0x48')]+_0x0c32('0x5e'));}else{_0x2ec297['having']('`'+_0x32e477[_0x0c32('0x48')]+_0x0c32('0x5f'));}break;case'Contact':if(_0x32e477[_0x0c32('0x60')]===_0x0c32('0x61')){if(_0x32e477[_0x0c32('0x5c')]['split']('\x20')[_0x0c32('0x41')]>0x1){_0x2c811b[_0x5877ff](_0x0c32('0x62'),qs['getFullTextValue'](_0x32e477[_0x0c32('0x5c')]),null);}else{var _0x3f9f18='%'+_0x32e477[_0x0c32('0x5c')]+'%';_0x2c811b[_0x5877ff]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f9f18,_0x3f9f18,_0x3f9f18);}}else{_0x514c68=_[_0x0c32('0x5a')](_0x2e8745,[_0x0c32('0x27'),'ContactId']);_0x32e477['field']=_0x0c32('0x63');_0x20c3c8=as['buildExpression'](_0x504886,_0x514c68[_0x0c32('0x39')],_0x32e477);_0x2c811b[_0x5877ff](_0x20c3c8['text'],_0x20c3c8[_0x0c32('0x5c')][_0x0c32('0x64')],_0x20c3c8['value'][_0x0c32('0x1d')]);}break;case _0x0c32('0x65'):var _0xc6efb1=_0x32e477[_0x0c32('0x5c')]['split'](',')[_0x0c32('0x2a')](function(_0x1cd6f){return Number(_0x1cd6f);});_0xc6efb1[_0x0c32('0x2d')](function(_0x1b7756){_0x1c7cb8['or'](_0x0c32('0x66'),'%,'+_0x1b7756+',%');});_0x452311=_[_0x0c32('0x67')](_0x452311,_0xc6efb1);break;case _0x0c32('0x68'):if(_0x32e477['operator']===_0x0c32('0x61')){_0x2c811b[_0x5877ff]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x32e477[_0x0c32('0x5c')]+'%',null);}else{_0x514c68=_[_0x0c32('0x5a')](_0x2e8745,[_0x0c32('0x27'),_0x0c32('0x31')]);_0x32e477[_0x0c32('0x48')]=_0x0c32('0x31');_0x20c3c8=as['buildExpression'](_0x504886,_0x514c68[_0x0c32('0x39')],_0x32e477);_0x2c811b[_0x5877ff](_0x20c3c8[_0x0c32('0x69')],_0x20c3c8['value'][_0x0c32('0x64')],_0x20c3c8['value'][_0x0c32('0x1d')]);}break;case _0x0c32('0x6a'):_0x20c3c8=as[_0x0c32('0x6b')]('me',null,_0x32e477);_0x2c811b[_0x5877ff](_0x20c3c8[_0x0c32('0x69')],_0x20c3c8['value'][_0x0c32('0x64')],_0x20c3c8[_0x0c32('0x5c')]['end']);break;}}else{var _0x20c3c8=as[_0x0c32('0x6b')](_0x504886,_0x514c68[_0x0c32('0x39')],_0x32e477);_0x2c811b[_0x5877ff](_0x20c3c8[_0x0c32('0x69')],_0x20c3c8['value'][_0x0c32('0x64')],_0x20c3c8['value'][_0x0c32('0x1d')]);}}}else{var _0x3a6ad6=_(_0x2d091d[_0x0c32('0x3c')])[_0x0c32('0x3d')]()[_0x0c32('0x2a')](function(_0x5dab0f){return _[_0x0c32('0x6c')](_0x2e8745,[_0x0c32('0x27'),_0x5dab0f])?_0x5dab0f:undefined;})[_0x0c32('0x6d')]()[_0x0c32('0x5c')]();if(!_[_0x0c32('0x6e')](_0x3a6ad6)){_0x3a6ad6[_0x0c32('0x2d')](function(_0x297d9f){if(_0x297d9f===_0x0c32('0x6f')){_0x2ec297[_0x0c32('0x70')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0c32('0x71')](_0x2d091d[_0x0c32('0x3c')][_0x297d9f]));}else if(_0x297d9f===_0x0c32('0x72')){var _0x2a0fd6=JSON[_0x0c32('0x73')](_0x2d091d[_0x0c32('0x3c')][_0x297d9f])[_0x0c32('0x74')];var _0x69dfa=JSON[_0x0c32('0x73')](_0x2d091d['query'][_0x297d9f])[_0x0c32('0x75')];_0x2ec297[_0x0c32('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a0fd6,_0x69dfa);}else{if(_0x2d091d[_0x0c32('0x3c')][_0x297d9f]===_0x0c32('0x76')){_0x2ec297[_0x0c32('0x70')]('i.'+_0x297d9f+_0x0c32('0x77'));}else{_0x2ec297[_0x0c32('0x70')]('i.'+_0x297d9f+_0x0c32('0x78'),_0x2d091d[_0x0c32('0x3c')][_0x297d9f]);}}});}if(_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x79')]){if(_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x79')]==0x1){_0x2ec297['having'](_0x0c32('0x7a'));}else{_0x2ec297['having'](_0x0c32('0x7b'));}}if(_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x7c')]){_0x452311=_[_0x0c32('0x7d')](_0x2d091d['query'][_0x0c32('0x7c')])?_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x7c')]:new Array(_0x2d091d[_0x0c32('0x3c')]['tag']);_0x452311[_0x0c32('0x2d')](function(_0x95b747){_0x1c7cb8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x95b747+',%');});}if(_0x2d091d['query'][_0x0c32('0x7e')]){var _0x336eb1=_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x0c32('0x7f')](/'/g,'\x27\x27');if(qs[_0x0c32('0x80')](_0x336eb1)){_0x2c811b['or'](_0x0c32('0x81'),_0x336eb1+'%');}else{_0x2c811b['or'](_0x0c32('0x82'),qs['getFullTextValue'](_0x336eb1))['or'](_0x0c32('0x83'),_0x336eb1+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x336eb1+'%');}}}_0x2ec297[_0x0c32('0x70')](_0x2c811b);_0x2ec297[_0x0c32('0x84')](_0x0c32('0x85'));var _0x26be3d={'type':db['Sequelize'][_0x0c32('0x86')]['SELECT'],'raw':!![]};var _0x4eccf6=_0x2ec297['clone']();_0x4eccf6[_0x0c32('0x48')](_0x0c32('0x85'));_0x4eccf6[_0x0c32('0x48')](_0x0c32('0x87'),_0x0c32('0x5b'));if(_0x535300[_0x0c32('0x44')]){_0x535300['order']['forEach'](function(_0x27ce5b){var _0x2eff2a=_0x27ce5b[0x0]===_0x0c32('0x88')?_0x27ce5b[0x0]:'i.'+_0x27ce5b[0x0];_0x2ec297[_0x0c32('0x44')](_0x2eff2a,_0x27ce5b[0x1]===_0x0c32('0x89')?![]:!![]);});}if(!_[_0x0c32('0x6e')](_0x452311)){_0x2ec297[_0x0c32('0x5d')](_0x1c7cb8);_0x4eccf6['where']('t.id\x20IN\x20?',_0x452311);}BPromise[_0x0c32('0x8a')]()[_0x0c32('0x24')](function(){if(!_0x17f974){if(_0x2d091d['query'][_0x0c32('0x6f')])return;_0x4eccf6[_0x0c32('0x70')](_0x0c32('0x8b'));_0x2ec297['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2d091d['user'][_0x0c32('0x8c')]!==_0x0c32('0x8d'))return;return _0x2d091d['user'][_0x0c32('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10b9f8){if(_[_0x0c32('0x6e')](_0x10b9f8)){_0x4eccf6[_0x0c32('0x70')](_0x0c32('0x8f'));_0x2ec297[_0x0c32('0x70')](_0x0c32('0x8f'));}else{_0x4eccf6[_0x0c32('0x70')](_0x0c32('0x90'),_['map'](_0x10b9f8,'id'));_0x2ec297[_0x0c32('0x70')](_0x0c32('0x90'),_[_0x0c32('0x2a')](_0x10b9f8,'id'));}});})[_0x0c32('0x24')](function(){if(_0x2d091d[_0x0c32('0x91')]['role']==='agent'&&!_0x17f974&&!_0x2d091d['query']['OpenchannelAccountId'])return[];return db[_0x0c32('0x92')][_0x0c32('0x3c')](_0x4eccf6[_0x0c32('0x93')](),_0x26be3d);})['then'](function(_0x14c485){_0x43a4bb[_0x0c32('0x94')]=_0x14c485['length'];if(_0x43a4bb[_0x0c32('0x94')]===0x0)return[];return db['sequelize'][_0x0c32('0x3c')](_0xd003b0[_0x0c32('0x93')](),_0x26be3d)['then'](function(_0x1482f6){_0x19a23d=_[_0x0c32('0x95')](_0x1482f6,'id');_0x26be3d=_[_0x0c32('0x96')](_0x26be3d,{'model':db[_0x0c32('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d091d[_0x0c32('0x3c')][_0x0c32('0x40')]){_0x535300[_0x0c32('0x42')][_0x0c32('0x2d')](function(_0x9989e3){_0x2ec297['field']('i.'+_0x9989e3);});}else{_0x2ec297[_0x0c32('0x48')](_0x0c32('0x87'),'unreadMessages');_0x2ec297[_0x0c32('0x48')](_0x0c32('0x97'),_0x0c32('0x98'));_0x2ec297['field']('a.mandatoryDisposition',_0x0c32('0x99'));_0x2ec297[_0x0c32('0x48')](_0x0c32('0x9a'),'contactName');_0x2ec297[_0x0c32('0x48')](_0x0c32('0x9b'));_0x2ec297['field']('c.firstName','Contact.firstName');_0x2ec297[_0x0c32('0x48')](_0x0c32('0x9c'),_0x0c32('0x9d'));_0x2ec297[_0x0c32('0x48')](_0x0c32('0x9e'),_0x0c32('0x9f'));_0x2ec297[_0x0c32('0x48')](_0x0c32('0xa0'),_0x0c32('0xa1'));_0x2ec297['field'](_0x0c32('0xa2'),_0x0c32('0xa3'));_0x2ec297[_0x0c32('0x48')](_0x0c32('0xa4'),_0x0c32('0xa5'));_0x2ec297['field'](_0x0c32('0xa6'),_0x0c32('0xa7'));_0x2ec297['field'](_0x0c32('0xa8'),'Owner.internal');_0x2ec297['field'](_0x0c32('0xa9'),_0x0c32('0x2b'));}if(_0x535300['limit'])_0x2ec297[_0x0c32('0x1f')](_0x535300['limit']);if(_0x535300[_0x0c32('0x21')])_0x2ec297[_0x0c32('0x21')](_0x535300[_0x0c32('0x21')]);return db[_0x0c32('0x92')]['query'](_0x2ec297[_0x0c32('0x93')](),_0x26be3d);})[_0x0c32('0x24')](function(_0x5b4f4f){if(_0x5b4f4f[_0x0c32('0x41')]>0x0)_0x504768['where'](_0x0c32('0xaa'),_[_0x0c32('0x2a')](_0x5b4f4f,'id'));return db[_0x0c32('0x92')][_0x0c32('0x3c')](_0x504768[_0x0c32('0x93')](),_0x26be3d)[_0x0c32('0x24')](function(_0xc12387){var _0x22bd27=_[_0x0c32('0xab')](_0xc12387,_0x0c32('0xac'));var _0x10d98e=[];_0x5b4f4f[_0x0c32('0x2d')](function(_0x114934){_0x10d98e[_0x0c32('0xad')](updateOpenchannelInteraction(_0x114934,_0x19a23d,_0x22bd27));});return BPromise['all'](_0x10d98e);});});})[_0x0c32('0x24')](function(_0x307687){_0x43a4bb[_0x0c32('0xae')]=_0x307687;return _0x43a4bb;})[_0x0c32('0x24')](respondWithFilteredResult(_0x511a98,_0x535300))[_0x0c32('0x2f')](handleError(_0x511a98,null));};exports[_0x0c32('0xaf')]=function(_0x7f81c1,_0x395a5d){var _0x2c07db={};if(_0x7f81c1['query']['type']&&_0x7f81c1[_0x0c32('0x3c')][_0x0c32('0x39')]==='from'){_0x2c07db[_0x0c32('0x4a')]=_0x7f81c1[_0x0c32('0xb0')]['id'];}else{_0x2c07db['id']=_0x7f81c1[_0x0c32('0xb0')]['id'];}var _0x529471={'raw':![],'where':_0x2c07db},_0x59a834={};_0x59a834[_0x0c32('0x3b')]=_[_0x0c32('0x3d')](db[_0x0c32('0x37')][_0x0c32('0x38')]);_0x59a834['query']=_[_0x0c32('0x3d')](_0x7f81c1[_0x0c32('0x3c')]);_0x59a834[_0x0c32('0x3e')]=_[_0x0c32('0x3f')](_0x59a834[_0x0c32('0x3b')],_0x59a834['query']);_0x529471[_0x0c32('0x42')]=_['intersection'](_0x59a834[_0x0c32('0x3b')],qs[_0x0c32('0x40')](_0x7f81c1[_0x0c32('0x3c')][_0x0c32('0x40')]));_0x529471['attributes']=_0x529471[_0x0c32('0x42')][_0x0c32('0x41')]?_0x529471[_0x0c32('0x42')]:_0x59a834[_0x0c32('0x3b')];if(_0x7f81c1['query'][_0x0c32('0xb1')]){_0x529471['include']=[{'all':!![]}];}_0x529471=_[_0x0c32('0x96')]({},_0x529471,_0x7f81c1[_0x0c32('0xb2')]);return db[_0x0c32('0x37')][_0x0c32('0x5a')](_0x529471)[_0x0c32('0x24')](handleEntityNotFound(_0x395a5d,null))['then'](respondWithResult(_0x395a5d,null))['catch'](handleError(_0x395a5d,null));};exports[_0x0c32('0xb3')]=function(_0x422bc3,_0x5c7ba2){return db['OpenchannelInteraction']['create'](_0x422bc3['body'],{})[_0x0c32('0x24')](respondWithResult(_0x5c7ba2,0xc9))[_0x0c32('0x2f')](handleError(_0x5c7ba2,null));};exports[_0x0c32('0xb4')]=function(_0xb45b52,_0x132826){if(_0xb45b52[_0x0c32('0x6a')]['id']){delete _0xb45b52['body']['id'];}return db[_0x0c32('0x37')][_0x0c32('0x5a')]({'where':{'id':_0xb45b52[_0x0c32('0xb0')]['id']}})[_0x0c32('0x24')](handleEntityNotFound(_0x132826,null))[_0x0c32('0x24')](saveUpdates(_0xb45b52[_0x0c32('0x6a')],null))[_0x0c32('0x24')](respondWithResult(_0x132826,null))[_0x0c32('0x2f')](handleError(_0x132826,null));};exports[_0x0c32('0xb5')]=function(_0x1f7a83,_0x3a88b1){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1f7a83['params']['id']}})[_0x0c32('0x24')](handleEntityNotFound(_0x3a88b1,null))['then'](removeEntity(_0x3a88b1,null))[_0x0c32('0x2f')](handleError(_0x3a88b1,null));};exports[_0x0c32('0xb6')]=function(_0x42e55f,_0xbc191d){return db[_0x0c32('0x37')][_0x0c32('0xb6')]()['then'](respondWithResult(_0xbc191d,null))[_0x0c32('0x2f')](handleError(_0xbc191d,null));};exports[_0x0c32('0xb7')]=function(_0x504ecd,_0x293020,_0x5da4e1){return db[_0x0c32('0xb8')][_0x0c32('0x5a')]({'where':{'id':_0x504ecd['params']['id']}})[_0x0c32('0x24')](handleEntityNotFound(_0x293020,null))[_0x0c32('0x24')](function(_0x4bf0fc){if(_0x4bf0fc){return _0x4bf0fc['addMessage'](_0x504ecd[_0x0c32('0x6a')][_0x0c32('0xb9')],_[_0x0c32('0xba')](_0x504ecd[_0x0c32('0x6a')],[_0x0c32('0xb9'),'id'])||{});}})[_0x0c32('0x24')](respondWithResult(_0x293020,null))[_0x0c32('0x2f')](handleError(_0x293020,null));};exports[_0x0c32('0xbb')]=function(_0x252afa,_0x58c380,_0x577a36){var _0x534fdb={'raw':![],'where':{}};var _0x2e0a38={};var _0x35426e={'count':0x0,'rows':[]};return db[_0x0c32('0x37')]['findOne']({'where':{'id':_0x252afa[_0x0c32('0xb0')]['id']}})[_0x0c32('0x24')](handleEntityNotFound(_0x58c380,null))[_0x0c32('0x24')](function(_0x13d1af){if(_0x13d1af){_0x2e0a38[_0x0c32('0x3b')]=_[_0x0c32('0x3d')](db[_0x0c32('0xb8')][_0x0c32('0x38')]);_0x2e0a38['query']=_[_0x0c32('0x3d')](_0x252afa[_0x0c32('0x3c')]);_0x2e0a38[_0x0c32('0x3e')]=_[_0x0c32('0x3f')](_0x2e0a38[_0x0c32('0x3b')],_0x2e0a38[_0x0c32('0x3c')]);_0x534fdb['attributes']=_[_0x0c32('0x3f')](_0x2e0a38[_0x0c32('0x3b')],qs['fields'](_0x252afa['query'][_0x0c32('0x40')]));_0x534fdb[_0x0c32('0x42')]=_0x534fdb[_0x0c32('0x42')][_0x0c32('0x41')]?_0x534fdb[_0x0c32('0x42')]:_0x2e0a38[_0x0c32('0x3b')];if(!_0x252afa['query'][_0x0c32('0xbc')](_0x0c32('0x43'))){_0x534fdb['limit']=qs[_0x0c32('0x1f')](_0x252afa[_0x0c32('0x3c')][_0x0c32('0x1f')]);_0x534fdb['offset']=qs[_0x0c32('0x21')](_0x252afa[_0x0c32('0x3c')]['offset']);}_0x534fdb[_0x0c32('0x44')]=qs[_0x0c32('0x45')](_0x252afa[_0x0c32('0x3c')][_0x0c32('0x45')]);_0x534fdb[_0x0c32('0x70')]=qs[_0x0c32('0x3e')](_[_0x0c32('0x46')](_0x252afa[_0x0c32('0x3c')],_0x2e0a38['filters']));_0x534fdb['where'][_0x0c32('0xac')]=_0x13d1af['id'];if(_0x252afa[_0x0c32('0x3c')][_0x0c32('0x7e')]){_0x534fdb[_0x0c32('0x70')]=_[_0x0c32('0x96')](_0x534fdb[_0x0c32('0x70')],{'$or':_[_0x0c32('0x2a')](_0x534fdb[_0x0c32('0x42')],function(_0x14cc74){var _0x2ff40b={};_0x2ff40b[_0x14cc74]={'$like':'%'+_0x252afa[_0x0c32('0x3c')][_0x0c32('0x7e')]+'%'};return _0x2ff40b;})});}if(_0x252afa[_0x0c32('0x3c')][_0x0c32('0x74')]){var _0x4e1dcf=_0x252afa['query'][_0x0c32('0x74')][_0x0c32('0x2c')](',');var _0x173291={};_0x173291[_0x4e1dcf[0x0]]={'$gte':moment(_0x4e1dcf[0x1])[_0x0c32('0xbd')](_0x0c32('0xbe'))};_0x534fdb['where']=_[_0x0c32('0x96')](_0x534fdb[_0x0c32('0x70')],_0x173291);}_0x534fdb=_[_0x0c32('0x96')]({},_0x534fdb,_0x252afa[_0x0c32('0xb2')]);return db['OpenchannelMessage'][_0x0c32('0x94')]({'where':_0x534fdb[_0x0c32('0x70')]})['then'](function(_0x291889){_0x35426e[_0x0c32('0x94')]=_0x291889;if(_0x252afa[_0x0c32('0x3c')][_0x0c32('0xb1')]){_0x534fdb[_0x0c32('0xbf')]=[{'all':!![]}];}return db[_0x0c32('0xb8')][_0x0c32('0xc0')](_0x534fdb);})[_0x0c32('0x24')](function(_0x5a0cad){_0x35426e[_0x0c32('0xae')]=_0x5a0cad;return _0x35426e;});}})[_0x0c32('0x24')](respondWithFilteredResult(_0x58c380,_0x534fdb))[_0x0c32('0x2f')](handleError(_0x58c380,null));};exports[_0x0c32('0xc1')]=function(_0x4654e9,_0x47bc6f,_0x5ad79b){return db[_0x0c32('0x37')][_0x0c32('0x5a')]({'where':{'id':_0x4654e9[_0x0c32('0xb0')]['id']}})[_0x0c32('0x24')](handleEntityNotFound(_0x47bc6f,null))[_0x0c32('0x24')](function(_0x51f88e){if(_0x51f88e){return _0x51f88e['setTags'](_0x4654e9['body']['ids'],_[_0x0c32('0xba')](_0x4654e9[_0x0c32('0x6a')],[_0x0c32('0xb9'),'id'])||{})[_0x0c32('0xc2')](function(){return db[_0x0c32('0x65')][_0x0c32('0xc0')]({'attributes':['id',_0x0c32('0x27'),'color'],'where':{'id':_0x4654e9['body'][_0x0c32('0xb9')]}});})[_0x0c32('0x24')](function(_0x570409){socket[_0x0c32('0xc3')](_0x0c32('0xc4'),{'id':Number(_0x4654e9[_0x0c32('0xb0')]['id']),'tags':_0x570409||[]});return{'id':Number(_0x4654e9[_0x0c32('0xb0')]['id']),'tags':_0x570409||[]};});}})[_0x0c32('0x24')](respondWithResult(_0x47bc6f,null))['catch'](handleError(_0x47bc6f,null));};exports[_0x0c32('0xc5')]=function(_0x5756d7,_0x255665,_0x484c43){return db[_0x0c32('0x37')][_0x0c32('0x5a')]({'where':{'id':_0x5756d7[_0x0c32('0xb0')]['id']}})['then'](handleEntityNotFound(_0x255665,null))[_0x0c32('0x24')](function(_0x5eaf20){if(_0x5eaf20){return _0x5eaf20[_0x0c32('0xc5')](_0x5756d7[_0x0c32('0x3c')][_0x0c32('0xb9')]);}})['then'](respondWithStatusCode(_0x255665,null))[_0x0c32('0x2f')](handleError(_0x255665,null));};exports[_0x0c32('0xc6')]=function(_0x3777d0,_0x1d64b1){var _0x29ebf9=moment()[_0x0c32('0xc7')]()[_0x0c32('0x93')]();var _0x2f7e07=path['join'](config[_0x0c32('0xc8')],'server',_0x0c32('0xc9'),'tmp');var _0x60793c=path[_0x0c32('0xca')](config[_0x0c32('0xc8')],_0x0c32('0xcb'),_0x0c32('0xc9'),'attachments');var _0x45069a=path[_0x0c32('0xca')](_0x2f7e07,_0x29ebf9);var _0x43a54f=util[_0x0c32('0xbd')](_0x0c32('0xcc'),_0x3777d0[_0x0c32('0xb0')]['id'],_0x29ebf9);var _0x57f421=path[_0x0c32('0xca')](_0x2f7e07,_0x43a54f);var _0x3cc28a=[];_0x3cc28a['push']({'model':db[_0x0c32('0x68')],'as':_0x0c32('0x68'),'attributes':['id',_0x0c32('0xcd')],'raw':!![]});_0x3cc28a[_0x0c32('0xad')]({'model':db[_0x0c32('0xce')],'as':_0x0c32('0xcf'),'attributes':['id',_0x0c32('0xd0'),_0x0c32('0xd1')],'raw':!![]});if(_0x3777d0[_0x0c32('0x3c')][_0x0c32('0xd2')]){_0x3cc28a['push']({'model':db[_0x0c32('0xd3')],'as':_0x0c32('0xd3'),'raw':!![]});}var _0x2f1eb2=[{'model':db[_0x0c32('0xb8')],'as':'Messages','attributes':['id','body','createdAt',_0x0c32('0xd4'),_0x0c32('0xd5'),_0x0c32('0x79')],'include':_0x3cc28a}];_0x2f1eb2[_0x0c32('0xad')]({'model':db[_0x0c32('0xd6')],'as':_0x0c32('0xd7'),'attributes':['id',_0x0c32('0x27')]});_0x2f1eb2['push']({'model':db[_0x0c32('0x68')],'as':_0x0c32('0xd8'),'attributes':['id',_0x0c32('0xcd')]});return db['OpenchannelInteraction'][_0x0c32('0x5a')]({'where':{'id':_0x3777d0['params']['id']},'include':_0x2f1eb2})[_0x0c32('0x24')](handleEntityNotFound(_0x1d64b1,null))[_0x0c32('0x24')](function(_0xa8b036){if(_0xa8b036){var _0xfedf52=_0xa8b036['get']({'plain':!![]});fs[_0x0c32('0xd9')](_0x45069a);var _0x4b1eec={'channel':_0x0c32('0xda'),'account':_0xfedf52[_0x0c32('0xd7')][_0x0c32('0x27')],'agent':_0xfedf52[_0x0c32('0xd8')]?_0xfedf52[_0x0c32('0xd8')][_0x0c32('0xcd')]:'N.A.','createdAt':moment(_0xfedf52[_0x0c32('0x72')])[_0x0c32('0xbd')](_0x0c32('0xbe'))[_0x0c32('0x93')](),'closedAt':_0xfedf52[_0x0c32('0x33')]?moment(_0xfedf52[_0x0c32('0xdb')])[_0x0c32('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0c32('0x93')]():'','disposition':_0xfedf52[_0x0c32('0xdc')],'visibility':_0xfedf52[_0x0c32('0xdd')]?_0x0c32('0xde'):_0x0c32('0xdf'),'messages':_(_0xfedf52[_0x0c32('0xe0')])['filter']({'secret':![]})['map'](function(_0x3def98){if(_0x3def98[_0x0c32('0xd3')]){var _0x2a5883=path[_0x0c32('0xca')](_0x60793c,_0x3def98[_0x0c32('0xd3')][_0x0c32('0xe1')]);if(fs[_0x0c32('0xe2')](_0x2a5883)){fs[_0x0c32('0xe3')](_0x2a5883)[_0x0c32('0xe4')](fs['createWriteStream'](path['join'](_0x45069a,_0x3def98[_0x0c32('0xd3')][_0x0c32('0xe1')])));}}return{'date':moment(_0x3def98['createdAt'])['format'](_0x0c32('0xbe'))[_0x0c32('0x93')](),'sender':_0x3def98['direction']===_0x0c32('0xe5')?_0x3def98[_0x0c32('0x68')]?_0x3def98['User'][_0x0c32('0xcd')]:_0x0c32('0xe6'):_0x3def98[_0x0c32('0xcf')][_0x0c32('0xd0')]+(_0x3def98[_0x0c32('0xcf')]['lastName']?'\x20'+_0x3def98[_0x0c32('0xcf')][_0x0c32('0xd1')]:''),'body':_0x3def98['Attachment']?_0x3def98[_0x0c32('0xd3')][_0x0c32('0xe1')]:_0x3def98['body'],'direction':_0x3def98[_0x0c32('0xd4')]==='out'?'A':'C','secret':_0x3def98[_0x0c32('0xd5')],'read':_0x3def98[_0x0c32('0x79')],'attachment':_0x3def98[_0x0c32('0xd3')]};})['value']()};return ejs[_0x0c32('0xe7')](path['join'](config[_0x0c32('0xc8')],_0x0c32('0xcb'),_0x0c32('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x4b1eec})[_0x0c32('0x24')](function(_0x4179a1){var _0x4d3425=path[_0x0c32('0xca')](_0x45069a,_0x0c32('0xe9')+_0xfedf52['id']+'-'+_0x29ebf9+_0x0c32('0xea'));var _0x5e1c87={'path':_0x4d3425,'channel':'Openchannel','interactionId':_0xfedf52['id']};return pdf[_0x0c32('0xeb')](_0x4179a1,_0x5e1c87);})[_0x0c32('0x24')](function(){return new BPromise(function(_0x1c5bc8,_0x32d90f){zipdir(_0x45069a,{'saveTo':_0x57f421},function(_0x325af9,_0x11e730){if(_0x325af9)return _0x32d90f(_0x325af9);return _0x1c5bc8(_0x11e730);});})[_0x0c32('0x24')](function(){return new BPromise(function(_0x23b566,_0x47e725){rimraf(_0x45069a,function(_0x4de60e){if(_0x4de60e)_0x47e725(_0x4de60e);return _0x23b566();});});})['then'](function(){return _0x1d64b1[_0x0c32('0xc6')](_0x57f421,_0x43a54f,function(_0x161f54){if(_0x161f54){console[_0x0c32('0xec')](_0x0c32('0xed'),_0x161f54);}else{fs[_0x0c32('0xee')](_0x57f421);}});});});}else{return _0x1d64b1[_0x0c32('0xef')](0xc8);}})['catch'](handleError(_0x1d64b1,null));}; \ No newline at end of file +var _0xcfb9=['from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','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','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','length','keyBy','merge','OpenchannelInteraction','Account.key','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','contactName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','Account','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Public','Private','direction','out','System','basename','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','closed','UserId','waiting','total','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','select','field','color'];(function(_0x38cffd,_0x3b6a1b){var _0xa37293=function(_0x435214){while(--_0x435214){_0x38cffd['push'](_0x38cffd['shift']());}};_0xa37293(++_0x3b6a1b);}(_0xcfb9,0xa3));var _0x9cfb=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0xcfb9[_0x8b631b];return _0x3e6832;};'use strict';var emlformat=require(_0x9cfb('0x0'));var rimraf=require(_0x9cfb('0x1'));var zipdir=require(_0x9cfb('0x2'));var jsonpatch=require(_0x9cfb('0x3'));var rp=require(_0x9cfb('0x4'));var moment=require(_0x9cfb('0x5'));var BPromise=require(_0x9cfb('0x6'));var Mustache=require(_0x9cfb('0x7'));var util=require(_0x9cfb('0x8'));var path=require(_0x9cfb('0x9'));var sox=require(_0x9cfb('0xa'));var csv=require('to-csv');var ejs=require(_0x9cfb('0xb'));var fs=require('fs');var fs_extra=require(_0x9cfb('0xc'));var _=require('lodash');var squel=require(_0x9cfb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9cfb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9cfb('0xf'));var Redis=require(_0x9cfb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9cfb('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9cfb('0x12'));var hardwareService=require(_0x9cfb('0x13'));var logger=require(_0x9cfb('0x14'))(_0x9cfb('0x15'));var utils=require(_0x9cfb('0x16'));var config=require(_0x9cfb('0x17'));var licenseUtil=require(_0x9cfb('0x18'));var db=require('../../mysqldb')['db'];config[_0x9cfb('0x19')]=_[_0x9cfb('0x1a')](config[_0x9cfb('0x19')],{'host':_0x9cfb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cfb('0x19')]));require(_0x9cfb('0x1c'))[_0x9cfb('0x1d')](socket);function respondWithStatusCode(_0x4fbb36,_0xbfc507){_0xbfc507=_0xbfc507||0xcc;return function(_0x1cfe49){if(_0x1cfe49){return _0x4fbb36[_0x9cfb('0x1e')](_0xbfc507);}return _0x4fbb36[_0x9cfb('0x1f')](_0xbfc507)[_0x9cfb('0x20')]();};}function respondWithResult(_0xfd9c64,_0x22458c){_0x22458c=_0x22458c||0xc8;return function(_0x1a6d58){if(_0x1a6d58){return _0xfd9c64[_0x9cfb('0x1f')](_0x22458c)[_0x9cfb('0x21')](_0x1a6d58);}};}function respondWithFilteredResult(_0xbed8f7,_0x1be06f){return function(_0x8fe564){if(_0x8fe564){var _0x531e9b=typeof _0x1be06f[_0x9cfb('0x22')]===_0x9cfb('0x23')&&typeof _0x1be06f[_0x9cfb('0x24')]===_0x9cfb('0x23');var _0x28df99=_0x8fe564[_0x9cfb('0x25')];var _0x22bb9e=_0x531e9b?0x0:_0x1be06f[_0x9cfb('0x22')];var _0x5c9348=_0x531e9b?_0x8fe564['count']:_0x1be06f[_0x9cfb('0x22')]+_0x1be06f[_0x9cfb('0x24')];var _0x1b7c5a;if(_0x5c9348>=_0x28df99){_0x5c9348=_0x28df99;_0x1b7c5a=0xc8;}else{_0x1b7c5a=0xce;}_0xbed8f7[_0x9cfb('0x1f')](_0x1b7c5a);return _0xbed8f7[_0x9cfb('0x26')](_0x9cfb('0x27'),_0x22bb9e+'-'+_0x5c9348+'/'+_0x28df99)['json'](_0x8fe564);}return null;};}function patchUpdates(_0x470bf8){return function(_0x9c31f3){try{jsonpatch['apply'](_0x9c31f3,_0x470bf8,!![]);}catch(_0x3f675f){return BPromise[_0x9cfb('0x28')](_0x3f675f);}return _0x9c31f3[_0x9cfb('0x29')]();};}function saveUpdates(_0x3c2e02,_0x5cd732){return function(_0x175a7a){if(_0x175a7a){return _0x175a7a[_0x9cfb('0x2a')](_0x3c2e02)[_0x9cfb('0x2b')](function(_0x302d12){return _0x302d12;});}return null;};}function removeEntity(_0x4d3f13,_0x580527){return function(_0x590589){if(_0x590589){return _0x590589[_0x9cfb('0x2c')]()[_0x9cfb('0x2b')](function(){_0x4d3f13[_0x9cfb('0x1f')](0xcc)[_0x9cfb('0x20')]();});}};}function handleEntityNotFound(_0x4cde3b,_0x59816f){return function(_0x22909d){if(!_0x22909d){_0x4cde3b[_0x9cfb('0x1e')](0x194);}return _0x22909d;};}function handleError(_0x111cba,_0x2129a7){_0x2129a7=_0x2129a7||0x1f4;return function(_0x5766ef){logger['error'](_0x5766ef[_0x9cfb('0x2d')]);if(_0x5766ef[_0x9cfb('0x2e')]){delete _0x5766ef[_0x9cfb('0x2e')];}_0x111cba[_0x9cfb('0x1f')](_0x2129a7)[_0x9cfb('0x2f')](_0x5766ef);};}function getInteractionUsers(_0x1e5eba,_0x416624){return new BPromise(function(_0x1ea055,_0xe30959){try{if(_0x416624[_0x1e5eba['id']]){_0x1e5eba[_0x9cfb('0x30')]=_[_0x9cfb('0x31')](_0x416624[_0x1e5eba['id']],function(_0x1d417c){return{'id':_0x1d417c['id'],'fullname':_0x1d417c['fullname']};});}}catch(_0x4d89ed){_0xe30959(_0x4d89ed);}_0x1ea055(_0x1e5eba);});}function getInteractionTags(_0x1c1d1a,_0x18c8f7){return new BPromise(function(_0x2f7cc2,_0xe56cb1){try{if(_0x1c1d1a[_0x9cfb('0x32')]){_0x1c1d1a[_0x9cfb('0x33')]=[];_0x1c1d1a[_0x9cfb('0x32')][_0x9cfb('0x34')](',')[_0x9cfb('0x35')](function(_0x47ef8a){_0x1c1d1a[_0x9cfb('0x33')][_0x9cfb('0x36')](_0x18c8f7[_0x47ef8a]);});}delete _0x1c1d1a[_0x9cfb('0x32')];}catch(_0x51cdd8){_0xe56cb1(_0x51cdd8);}_0x2f7cc2(_0x1c1d1a);});}function updateOpenchannelInteraction(_0xc1d54d,_0x481cd1,_0x4b38f7){return new BPromise(function(_0x12309a,_0x2820ba){return getInteractionUsers(_0xc1d54d,_0x4b38f7)[_0x9cfb('0x2b')](function(_0x1e4ba4){return getInteractionTags(_0x1e4ba4,_0x481cd1);})['then'](function(_0x13b84c){return getStateInteraction(_0x13b84c);})[_0x9cfb('0x2b')](function(_0x236170){_0x12309a(_0x236170);})[_0x9cfb('0x37')](function(_0x5f2e21){_0x2820ba(_0x5f2e21);});});}function getStateInteraction(_0x3926d4){return new BPromise(function(_0x47da84){_0x3926d4['waiting']=0x0;_0x3926d4[_0x9cfb('0x38')]=0x0;_0x3926d4[_0x9cfb('0x39')]=0x0;_0x3926d4[_0x9cfb('0x3a')]=0x0;_0x3926d4['total']=0x0;if(!_0x3926d4[_0x9cfb('0x3b')]&&!_0x3926d4[_0x9cfb('0x3c')]){_0x3926d4[_0x9cfb('0x3d')]+=0x1;}if(!_0x3926d4[_0x9cfb('0x3b')]&&_0x3926d4[_0x9cfb('0x3c')]){_0x3926d4['talking']+=0x1;if(_0x3926d4[_0x9cfb('0x3d')]){_0x3926d4[_0x9cfb('0x3d')]-=0x1;}}if(_0x3926d4[_0x9cfb('0x3b')]&&_0x3926d4['UserId']){_0x3926d4['answered']+=0x1;if(_0x3926d4[_0x9cfb('0x38')]){_0x3926d4[_0x9cfb('0x38')]-=0x1;}}if(_0x3926d4[_0x9cfb('0x3b')]&&!_0x3926d4[_0x9cfb('0x3c')]){_0x3926d4[_0x9cfb('0x3a')]+=0x1;if(_0x3926d4[_0x9cfb('0x3d')]){_0x3926d4[_0x9cfb('0x3d')]-=0x1;}}_0x3926d4[_0x9cfb('0x3e')]+=0x1;_0x47da84(_0x3926d4);});}exports['index']=function(_0x1b9789,_0xfa75c4){var _0x4f3f64={},_0x437af7={},_0x109ba2={'count':0x0,'rows':[]};var _0x5e0ac9=_[_0x9cfb('0x31')](db['OpenchannelInteraction'][_0x9cfb('0x3f')],function(_0x324ea7){return{'name':_0x324ea7['fieldName'],'type':_0x324ea7[_0x9cfb('0x40')][_0x9cfb('0x41')]};});_0x437af7[_0x9cfb('0x42')]=_['map'](_0x5e0ac9,_0x9cfb('0x2e'));_0x437af7[_0x9cfb('0x43')]=_[_0x9cfb('0x44')](_0x1b9789[_0x9cfb('0x43')]);_0x437af7[_0x9cfb('0x45')]=_[_0x9cfb('0x46')](_0x437af7[_0x9cfb('0x42')],_0x437af7[_0x9cfb('0x43')]);_0x4f3f64[_0x9cfb('0x47')]=_[_0x9cfb('0x46')](_0x437af7['model'],qs['fields'](_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x48')]));_0x4f3f64[_0x9cfb('0x47')]=_0x4f3f64[_0x9cfb('0x47')]['length']?_0x4f3f64[_0x9cfb('0x47')]:_0x437af7[_0x9cfb('0x42')];if(!_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x49')](_0x9cfb('0x4a'))){_0x4f3f64[_0x9cfb('0x24')]=qs[_0x9cfb('0x24')](_0x1b9789[_0x9cfb('0x43')]['limit']);_0x4f3f64[_0x9cfb('0x22')]=qs[_0x9cfb('0x22')](_0x1b9789[_0x9cfb('0x43')]['offset']);}_0x4f3f64['order']=qs[_0x9cfb('0x4b')](_0x1b9789['query'][_0x9cfb('0x4b')]);_0x4f3f64[_0x9cfb('0x4c')]=qs['filters'](_[_0x9cfb('0x4d')](_0x1b9789[_0x9cfb('0x43')],_0x437af7[_0x9cfb('0x45')]),_0x5e0ac9);var _0x26ce76=[];var _0x16d299=squel[_0x9cfb('0x4e')]()[_0x9cfb('0x4f')]('id')[_0x9cfb('0x4f')](_0x9cfb('0x2e'))['field'](_0x9cfb('0x50'))[_0x9cfb('0x51')]('tools_tags');var _0x2ce91b=squel[_0x9cfb('0x4e')]()['field'](_0x9cfb('0x52'))['field'](_0x9cfb('0x53'))[_0x9cfb('0x4f')](_0x9cfb('0x54'))[_0x9cfb('0x51')](_0x9cfb('0x55'),'ui')[_0x9cfb('0x56')]('users','u','u.id\x20=\x20ui.UserId');var _0x260978=squel['select']()[_0x9cfb('0x51')](_0x9cfb('0x57'),'i')[_0x9cfb('0x56')](_0x9cfb('0x58'),'c',_0x9cfb('0x59'))[_0x9cfb('0x56')](_0x9cfb('0x5a'),'o',_0x9cfb('0x5b'))[_0x9cfb('0x56')](_0x9cfb('0x5c'),'a',_0x9cfb('0x5d'))[_0x9cfb('0x56')](_0x9cfb('0x5e'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x9cfb('0x56')](_0x9cfb('0x5f'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x9cfb('0x56')](_0x9cfb('0x60'),'t',_0x9cfb('0x61'));var _0xde3763=squel['expr']();var _0x3cf5c6=[];var _0x421dae=squel[_0x9cfb('0x62')]();var _0x329e78;if(_0x1b9789['query'][_0x9cfb('0x63')]){_0x329e78=as['parseSearch'](_0x1b9789[_0x9cfb('0x43')]['search']);var _0x3570a0=_0x329e78[_0x9cfb('0x64')];for(var _0x34c6c1=0x0;_0x34c6c1<_0x329e78[_0x9cfb('0x65')]['length'];_0x34c6c1++){var _0x3aaa38=_0x329e78['conditions'][_0x34c6c1];var _0xc20610='i';var _0x2854d8=_[_0x9cfb('0x66')](_0x5e0ac9,[_0x9cfb('0x2e'),_0x3aaa38[_0x9cfb('0x4f')]]);if(!_0x2854d8){switch(_0x3aaa38[_0x9cfb('0x4f')]){case'unreadMessages':if(_0x3aaa38[_0x9cfb('0x67')]==0x1){_0x260978['having']('`'+_0x3aaa38[_0x9cfb('0x4f')]+'`\x20=\x200');}else{_0x260978[_0x9cfb('0x68')]('`'+_0x3aaa38[_0x9cfb('0x4f')]+'`\x20>\x200');}break;case _0x9cfb('0x69'):if(_0x3aaa38[_0x9cfb('0x6a')]===_0x9cfb('0x6b')){if(_0x3aaa38[_0x9cfb('0x67')][_0x9cfb('0x34')]('\x20')['length']>0x1){_0xde3763[_0x3570a0](_0x9cfb('0x6c'),qs[_0x9cfb('0x6d')](_0x3aaa38[_0x9cfb('0x67')]),null);}else{var _0x2c08cf='%'+_0x3aaa38[_0x9cfb('0x67')]+'%';_0xde3763[_0x3570a0](_0x9cfb('0x6e'),_0x2c08cf,_0x2c08cf,_0x2c08cf);}}else{_0x2854d8=_[_0x9cfb('0x66')](_0x5e0ac9,[_0x9cfb('0x2e'),_0x9cfb('0x6f')]);_0x3aaa38[_0x9cfb('0x4f')]=_0x9cfb('0x6f');_0x58d4e6=as[_0x9cfb('0x70')](_0xc20610,_0x2854d8[_0x9cfb('0x40')],_0x3aaa38);_0xde3763[_0x3570a0](_0x58d4e6[_0x9cfb('0x71')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x72')],_0x58d4e6['value'][_0x9cfb('0x20')]);}break;case _0x9cfb('0x73'):var _0x32fbb3=_0x3aaa38[_0x9cfb('0x67')][_0x9cfb('0x34')](',')[_0x9cfb('0x31')](function(_0x5978ee){return Number(_0x5978ee);});_0x32fbb3[_0x9cfb('0x35')](function(_0x1f47ca){_0x421dae['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f47ca+',%');});_0x3cf5c6=_['union'](_0x3cf5c6,_0x32fbb3);break;case _0x9cfb('0x74'):if(_0x3aaa38[_0x9cfb('0x6a')]==='$substring'){_0xde3763[_0x3570a0](_0x9cfb('0x75'),'%'+_0x3aaa38[_0x9cfb('0x67')]+'%',null);}else{_0x2854d8=_[_0x9cfb('0x66')](_0x5e0ac9,['name','UserId']);_0x3aaa38[_0x9cfb('0x4f')]=_0x9cfb('0x3c');_0x58d4e6=as[_0x9cfb('0x70')](_0xc20610,_0x2854d8[_0x9cfb('0x40')],_0x3aaa38);_0xde3763[_0x3570a0](_0x58d4e6[_0x9cfb('0x71')],_0x58d4e6['value'][_0x9cfb('0x72')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x20')]);}break;case _0x9cfb('0x76'):_0x58d4e6=as[_0x9cfb('0x70')]('me',null,_0x3aaa38);_0xde3763[_0x3570a0](_0x58d4e6[_0x9cfb('0x71')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x72')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x20')]);break;}}else{var _0x58d4e6=as[_0x9cfb('0x70')](_0xc20610,_0x2854d8[_0x9cfb('0x40')],_0x3aaa38);_0xde3763[_0x3570a0](_0x58d4e6[_0x9cfb('0x71')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x72')],_0x58d4e6[_0x9cfb('0x67')][_0x9cfb('0x20')]);}}}else{var _0x2da575=_(_0x1b9789[_0x9cfb('0x43')])[_0x9cfb('0x44')]()[_0x9cfb('0x31')](function(_0x505cfc){return _[_0x9cfb('0x77')](_0x5e0ac9,[_0x9cfb('0x2e'),_0x505cfc])?_0x505cfc:undefined;})[_0x9cfb('0x78')]()[_0x9cfb('0x67')]();if(!_[_0x9cfb('0x79')](_0x2da575)){_0x2da575[_0x9cfb('0x35')](function(_0x54a5ee){if(_0x54a5ee==='OpenchannelAccountId'){_0x260978[_0x9cfb('0x4c')](_0x9cfb('0x7a'),[][_0x9cfb('0x7b')](_0x1b9789[_0x9cfb('0x43')][_0x54a5ee]));}else if(_0x54a5ee===_0x9cfb('0x7c')){var _0x457956=JSON['parse'](_0x1b9789[_0x9cfb('0x43')][_0x54a5ee])[_0x9cfb('0x7d')];var _0x5221b2=JSON[_0x9cfb('0x7e')](_0x1b9789[_0x9cfb('0x43')][_0x54a5ee])[_0x9cfb('0x7f')];_0x260978['where'](_0x9cfb('0x80'),_0x457956,_0x5221b2);}else{if(_0x1b9789[_0x9cfb('0x43')][_0x54a5ee]===_0x9cfb('0x81')){_0x260978[_0x9cfb('0x4c')]('i.'+_0x54a5ee+_0x9cfb('0x82'));}else{_0x260978[_0x9cfb('0x4c')]('i.'+_0x54a5ee+_0x9cfb('0x83'),_0x1b9789[_0x9cfb('0x43')][_0x54a5ee]);}}});}if(_0x1b9789[_0x9cfb('0x43')]['read']){if(_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x84')]==0x1){_0x260978[_0x9cfb('0x68')](_0x9cfb('0x85'));}else{_0x260978['having'](_0x9cfb('0x86'));}}if(_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x87')]){_0x3cf5c6=_[_0x9cfb('0x88')](_0x1b9789['query'][_0x9cfb('0x87')])?_0x1b9789['query'][_0x9cfb('0x87')]:new Array(_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x87')]);_0x3cf5c6[_0x9cfb('0x35')](function(_0x35d526){_0x421dae['or'](_0x9cfb('0x89'),'%,'+_0x35d526+',%');});}if(_0x1b9789[_0x9cfb('0x43')][_0x9cfb('0x8a')]){var _0x4f2baf=_0x1b9789[_0x9cfb('0x43')]['filter'][_0x9cfb('0x8b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4f2baf)){_0xde3763['or']('i.id\x20LIKE\x20?',_0x4f2baf+'%');}else{_0xde3763['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4f2baf))['or'](_0x9cfb('0x8c'),_0x4f2baf+'%')['or'](_0x9cfb('0x8d'),_0x4f2baf+'%');}}}_0x260978['where'](_0xde3763);_0x260978['group'](_0x9cfb('0x8e'));var _0x592b05={'type':db[_0x9cfb('0x8f')][_0x9cfb('0x90')][_0x9cfb('0x91')],'raw':!![]};var _0x2dbfd6=_0x260978[_0x9cfb('0x92')]();_0x2dbfd6['field'](_0x9cfb('0x8e'));_0x2dbfd6['field'](_0x9cfb('0x93'),_0x9cfb('0x94'));if(_0x4f3f64['order']){_0x4f3f64[_0x9cfb('0x95')]['forEach'](function(_0x41799f){var _0x111af6=_0x41799f[0x0]==='contactName'?_0x41799f[0x0]:'i.'+_0x41799f[0x0];_0x260978[_0x9cfb('0x95')](_0x111af6,_0x41799f[0x1]===_0x9cfb('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x3cf5c6)){_0x260978[_0x9cfb('0x68')](_0x421dae);_0x2dbfd6[_0x9cfb('0x4c')](_0x9cfb('0x97'),_0x3cf5c6);}BPromise[_0x9cfb('0x98')]()[_0x9cfb('0x2b')](function(){if(!_0x329e78){if(_0x1b9789['query'][_0x9cfb('0x99')])return;_0x2dbfd6[_0x9cfb('0x4c')](_0x9cfb('0x9a'));_0x260978[_0x9cfb('0x4c')](_0x9cfb('0x9a'));return;}if(_0x1b9789[_0x9cfb('0x9b')]['role']!==_0x9cfb('0x9c'))return;return _0x1b9789[_0x9cfb('0x9b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5f173c){if(_[_0x9cfb('0x79')](_0x5f173c)){_0x2dbfd6['where'](_0x9cfb('0x9d'));_0x260978['where'](_0x9cfb('0x9d'));}else{_0x2dbfd6[_0x9cfb('0x4c')](_0x9cfb('0x7a'),_['map'](_0x5f173c,'id'));_0x260978[_0x9cfb('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5f173c,'id'));}});})[_0x9cfb('0x2b')](function(){if(_0x1b9789[_0x9cfb('0x9b')][_0x9cfb('0x9e')]===_0x9cfb('0x9c')&&!_0x329e78&&!_0x1b9789[_0x9cfb('0x43')]['OpenchannelAccountId'])return[];return db[_0x9cfb('0x9f')][_0x9cfb('0x43')](_0x2dbfd6[_0x9cfb('0xa0')](),_0x592b05);})['then'](function(_0x583e41){_0x109ba2[_0x9cfb('0x25')]=_0x583e41[_0x9cfb('0xa1')];if(_0x109ba2[_0x9cfb('0x25')]===0x0)return[];return db[_0x9cfb('0x9f')][_0x9cfb('0x43')](_0x16d299[_0x9cfb('0xa0')](),_0x592b05)[_0x9cfb('0x2b')](function(_0x4a7a82){_0x26ce76=_[_0x9cfb('0xa2')](_0x4a7a82,'id');_0x592b05=_[_0x9cfb('0xa3')](_0x592b05,{'model':db[_0x9cfb('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b9789[_0x9cfb('0x43')]['fields']){_0x4f3f64['attributes'][_0x9cfb('0x35')](function(_0x6f9696){_0x260978[_0x9cfb('0x4f')]('i.'+_0x6f9696);});}else{_0x260978['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9cfb('0x94'));_0x260978['field']('a.key',_0x9cfb('0xa5'));_0x260978['field']('a.mandatoryDisposition',_0x9cfb('0xa6'));_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xa7'),_0x9cfb('0xa8'));_0x260978[_0x9cfb('0x4f')]('i.*');_0x260978['field']('c.firstName','Contact.firstName');_0x260978[_0x9cfb('0x4f')]('c.lastName',_0x9cfb('0xa9'));_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xaa'),_0x9cfb('0xab'));_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xac'),_0x9cfb('0xad'));_0x260978[_0x9cfb('0x4f')]('c.mobile','Contact.mobile');_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xae'),_0x9cfb('0xaf'));_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xb0'),_0x9cfb('0xb1'));_0x260978[_0x9cfb('0x4f')](_0x9cfb('0xb2'),_0x9cfb('0xb3'));_0x260978['field'](_0x9cfb('0xb4'),_0x9cfb('0x32'));}if(_0x4f3f64[_0x9cfb('0x24')])_0x260978[_0x9cfb('0x24')](_0x4f3f64['limit']);if(_0x4f3f64[_0x9cfb('0x22')])_0x260978[_0x9cfb('0x22')](_0x4f3f64['offset']);return db['sequelize']['query'](_0x260978[_0x9cfb('0xa0')](),_0x592b05);})[_0x9cfb('0x2b')](function(_0x27eee4){if(_0x27eee4[_0x9cfb('0xa1')]>0x0)_0x2ce91b['where'](_0x9cfb('0xb5'),_[_0x9cfb('0x31')](_0x27eee4,'id'));return db[_0x9cfb('0x9f')]['query'](_0x2ce91b[_0x9cfb('0xa0')](),_0x592b05)['then'](function(_0x2be1e6){var _0x13e1f5=_['groupBy'](_0x2be1e6,_0x9cfb('0xb6'));var _0x14c551=[];_0x27eee4[_0x9cfb('0x35')](function(_0xbe9a08){_0x14c551['push'](updateOpenchannelInteraction(_0xbe9a08,_0x26ce76,_0x13e1f5));});return BPromise[_0x9cfb('0xb7')](_0x14c551);});});})['then'](function(_0x15d795){_0x109ba2[_0x9cfb('0xb8')]=_0x15d795;return _0x109ba2;})[_0x9cfb('0x2b')](respondWithFilteredResult(_0xfa75c4,_0x4f3f64))[_0x9cfb('0x37')](handleError(_0xfa75c4,null));};exports[_0x9cfb('0xb9')]=function(_0x246e07,_0x31ba00){var _0x53247b={};if(_0x246e07[_0x9cfb('0x43')][_0x9cfb('0x40')]&&_0x246e07[_0x9cfb('0x43')][_0x9cfb('0x40')]===_0x9cfb('0x51')){_0x53247b[_0x9cfb('0x51')]=_0x246e07['params']['id'];}else{_0x53247b['id']=_0x246e07[_0x9cfb('0xba')]['id'];}var _0x28e864={'raw':![],'where':_0x53247b},_0x9f8607={};_0x9f8607['model']=_[_0x9cfb('0x44')](db[_0x9cfb('0xa4')][_0x9cfb('0x3f')]);_0x9f8607['query']=_['keys'](_0x246e07['query']);_0x9f8607['filters']=_[_0x9cfb('0x46')](_0x9f8607['model'],_0x9f8607['query']);_0x28e864[_0x9cfb('0x47')]=_[_0x9cfb('0x46')](_0x9f8607[_0x9cfb('0x42')],qs[_0x9cfb('0x48')](_0x246e07[_0x9cfb('0x43')]['fields']));_0x28e864[_0x9cfb('0x47')]=_0x28e864['attributes'][_0x9cfb('0xa1')]?_0x28e864[_0x9cfb('0x47')]:_0x9f8607['model'];if(_0x246e07['query'][_0x9cfb('0xbb')]){_0x28e864[_0x9cfb('0xbc')]=[{'all':!![]}];}_0x28e864=_['merge']({},_0x28e864,_0x246e07[_0x9cfb('0xbd')]);return db[_0x9cfb('0xa4')]['find'](_0x28e864)[_0x9cfb('0x2b')](handleEntityNotFound(_0x31ba00,null))['then'](respondWithResult(_0x31ba00,null))[_0x9cfb('0x37')](handleError(_0x31ba00,null));};exports[_0x9cfb('0xbe')]=function(_0x3fe089,_0x43d26e){return db[_0x9cfb('0xa4')][_0x9cfb('0xbe')](_0x3fe089[_0x9cfb('0x76')],{})[_0x9cfb('0x2b')](respondWithResult(_0x43d26e,0xc9))['catch'](handleError(_0x43d26e,null));};exports[_0x9cfb('0x2a')]=function(_0x306b1c,_0x5d9ee5){if(_0x306b1c[_0x9cfb('0x76')]['id']){delete _0x306b1c[_0x9cfb('0x76')]['id'];}return db[_0x9cfb('0xa4')][_0x9cfb('0x66')]({'where':{'id':_0x306b1c[_0x9cfb('0xba')]['id']}})[_0x9cfb('0x2b')](handleEntityNotFound(_0x5d9ee5,null))['then'](saveUpdates(_0x306b1c[_0x9cfb('0x76')],null))[_0x9cfb('0x2b')](respondWithResult(_0x5d9ee5,null))[_0x9cfb('0x37')](handleError(_0x5d9ee5,null));};exports[_0x9cfb('0x2c')]=function(_0x4cfbcf,_0x48f5c0){return db['OpenchannelInteraction'][_0x9cfb('0x66')]({'where':{'id':_0x4cfbcf[_0x9cfb('0xba')]['id']}})[_0x9cfb('0x2b')](handleEntityNotFound(_0x48f5c0,null))['then'](removeEntity(_0x48f5c0,null))[_0x9cfb('0x37')](handleError(_0x48f5c0,null));};exports[_0x9cfb('0xbf')]=function(_0x481398,_0x93e1e1){return db['OpenchannelInteraction'][_0x9cfb('0xbf')]()[_0x9cfb('0x2b')](respondWithResult(_0x93e1e1,null))[_0x9cfb('0x37')](handleError(_0x93e1e1,null));};exports[_0x9cfb('0xc0')]=function(_0x2fece1,_0x129d46,_0x4eed3b){return db[_0x9cfb('0xc1')][_0x9cfb('0x66')]({'where':{'id':_0x2fece1[_0x9cfb('0xba')]['id']}})[_0x9cfb('0x2b')](handleEntityNotFound(_0x129d46,null))[_0x9cfb('0x2b')](function(_0x375cf9){if(_0x375cf9){return _0x375cf9[_0x9cfb('0xc0')](_0x2fece1[_0x9cfb('0x76')]['ids'],_[_0x9cfb('0xc2')](_0x2fece1['body'],[_0x9cfb('0xc3'),'id'])||{});}})[_0x9cfb('0x2b')](respondWithResult(_0x129d46,null))[_0x9cfb('0x37')](handleError(_0x129d46,null));};exports[_0x9cfb('0xc4')]=function(_0x81ec02,_0x210dae,_0x16a8a1){var _0x51285d={'raw':![],'where':{}};var _0x4f0a90={};var _0x48f3d8={'count':0x0,'rows':[]};return db[_0x9cfb('0xa4')][_0x9cfb('0xc5')]({'where':{'id':_0x81ec02[_0x9cfb('0xba')]['id']}})[_0x9cfb('0x2b')](handleEntityNotFound(_0x210dae,null))['then'](function(_0x15d74f){if(_0x15d74f){_0x4f0a90[_0x9cfb('0x42')]=_[_0x9cfb('0x44')](db[_0x9cfb('0xc1')][_0x9cfb('0x3f')]);_0x4f0a90['query']=_[_0x9cfb('0x44')](_0x81ec02[_0x9cfb('0x43')]);_0x4f0a90['filters']=_[_0x9cfb('0x46')](_0x4f0a90[_0x9cfb('0x42')],_0x4f0a90[_0x9cfb('0x43')]);_0x51285d[_0x9cfb('0x47')]=_[_0x9cfb('0x46')](_0x4f0a90['model'],qs[_0x9cfb('0x48')](_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x48')]));_0x51285d[_0x9cfb('0x47')]=_0x51285d['attributes']['length']?_0x51285d[_0x9cfb('0x47')]:_0x4f0a90[_0x9cfb('0x42')];if(!_0x81ec02[_0x9cfb('0x43')]['hasOwnProperty'](_0x9cfb('0x4a'))){_0x51285d[_0x9cfb('0x24')]=qs[_0x9cfb('0x24')](_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x24')]);_0x51285d[_0x9cfb('0x22')]=qs[_0x9cfb('0x22')](_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x22')]);}_0x51285d[_0x9cfb('0x95')]=qs[_0x9cfb('0x4b')](_0x81ec02['query'][_0x9cfb('0x4b')]);_0x51285d['where']=qs[_0x9cfb('0x45')](_[_0x9cfb('0x4d')](_0x81ec02[_0x9cfb('0x43')],_0x4f0a90[_0x9cfb('0x45')]));_0x51285d[_0x9cfb('0x4c')][_0x9cfb('0xb6')]=_0x15d74f['id'];if(_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x8a')]){_0x51285d[_0x9cfb('0x4c')]=_[_0x9cfb('0xa3')](_0x51285d[_0x9cfb('0x4c')],{'$or':_[_0x9cfb('0x31')](_0x51285d[_0x9cfb('0x47')],function(_0x4304d6){var _0x3853ec={};_0x3853ec[_0x4304d6]={'$like':'%'+_0x81ec02['query']['filter']+'%'};return _0x3853ec;})});}if(_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x7d')]){var _0x2e20f8=_0x81ec02[_0x9cfb('0x43')][_0x9cfb('0x7d')][_0x9cfb('0x34')](',');var _0x31be14={};_0x31be14[_0x2e20f8[0x0]]={'$gte':moment(_0x2e20f8[0x1])['format'](_0x9cfb('0xc6'))};_0x51285d[_0x9cfb('0x4c')]=_['merge'](_0x51285d[_0x9cfb('0x4c')],_0x31be14);}_0x51285d=_[_0x9cfb('0xa3')]({},_0x51285d,_0x81ec02[_0x9cfb('0xbd')]);return db[_0x9cfb('0xc1')]['count']({'where':_0x51285d[_0x9cfb('0x4c')]})[_0x9cfb('0x2b')](function(_0x5d98ef){_0x48f3d8[_0x9cfb('0x25')]=_0x5d98ef;if(_0x81ec02['query'][_0x9cfb('0xbb')]){_0x51285d[_0x9cfb('0xbc')]=[{'all':!![]}];}return db[_0x9cfb('0xc1')][_0x9cfb('0xc7')](_0x51285d);})['then'](function(_0x5290f2){_0x48f3d8[_0x9cfb('0xb8')]=_0x5290f2;return _0x48f3d8;});}})[_0x9cfb('0x2b')](respondWithFilteredResult(_0x210dae,_0x51285d))[_0x9cfb('0x37')](handleError(_0x210dae,null));};exports[_0x9cfb('0xc8')]=function(_0x320f8b,_0x3b4475,_0x430df9){return db['OpenchannelInteraction'][_0x9cfb('0x66')]({'where':{'id':_0x320f8b[_0x9cfb('0xba')]['id']}})['then'](handleEntityNotFound(_0x3b4475,null))['then'](function(_0x51ff77){if(_0x51ff77){return _0x51ff77[_0x9cfb('0xc9')](_0x320f8b[_0x9cfb('0x76')][_0x9cfb('0xc3')],_[_0x9cfb('0xc2')](_0x320f8b[_0x9cfb('0x76')],[_0x9cfb('0xc3'),'id'])||{})[_0x9cfb('0xca')](function(){return db[_0x9cfb('0x73')][_0x9cfb('0xc7')]({'attributes':['id','name','color'],'where':{'id':_0x320f8b[_0x9cfb('0x76')][_0x9cfb('0xc3')]}});})[_0x9cfb('0x2b')](function(_0x7fac96){socket[_0x9cfb('0xcb')](_0x9cfb('0xcc'),{'id':Number(_0x320f8b[_0x9cfb('0xba')]['id']),'tags':_0x7fac96||[]});return{'id':Number(_0x320f8b['params']['id']),'tags':_0x7fac96||[]};});}})[_0x9cfb('0x2b')](respondWithResult(_0x3b4475,null))[_0x9cfb('0x37')](handleError(_0x3b4475,null));};exports[_0x9cfb('0xcd')]=function(_0xeeee2a,_0x5c7972,_0xc3dd1c){return db[_0x9cfb('0xa4')]['find']({'where':{'id':_0xeeee2a[_0x9cfb('0xba')]['id']}})[_0x9cfb('0x2b')](handleEntityNotFound(_0x5c7972,null))['then'](function(_0x4517b7){if(_0x4517b7){return _0x4517b7[_0x9cfb('0xcd')](_0xeeee2a['query'][_0x9cfb('0xc3')]);}})[_0x9cfb('0x2b')](respondWithStatusCode(_0x5c7972,null))[_0x9cfb('0x37')](handleError(_0x5c7972,null));};exports[_0x9cfb('0xce')]=function(_0x444edd,_0x42eeca){var _0xce85ca=moment()[_0x9cfb('0xcf')]()['toString']();var _0x8354ea=path['join'](config[_0x9cfb('0xd0')],_0x9cfb('0xd1'),_0x9cfb('0xd2'),_0x9cfb('0xd3'));var _0x5e23a1=path[_0x9cfb('0xd4')](config[_0x9cfb('0xd0')],_0x9cfb('0xd1'),'files',_0x9cfb('0xd5'));var _0x3f1a4a=path[_0x9cfb('0xd4')](_0x8354ea,_0xce85ca);var _0x33da8f=util[_0x9cfb('0xd6')](_0x9cfb('0xd7'),_0x444edd[_0x9cfb('0xba')]['id'],_0xce85ca);var _0x23eea9=path['join'](_0x8354ea,_0x33da8f);var _0x1a3a8a=[];_0x1a3a8a[_0x9cfb('0x36')]({'model':db['User'],'as':_0x9cfb('0x74'),'attributes':['id',_0x9cfb('0xd8')],'raw':!![]});_0x1a3a8a[_0x9cfb('0x36')]({'model':db[_0x9cfb('0xd9')],'as':_0x9cfb('0x69'),'attributes':['id',_0x9cfb('0xda'),_0x9cfb('0xdb')],'raw':!![]});if(_0x444edd[_0x9cfb('0x43')][_0x9cfb('0xd5')]){_0x1a3a8a[_0x9cfb('0x36')]({'model':db[_0x9cfb('0xdc')],'as':_0x9cfb('0xdc'),'raw':!![]});}var _0x22959b=[{'model':db[_0x9cfb('0xc1')],'as':_0x9cfb('0xdd'),'attributes':['id','body','createdAt','direction','secret',_0x9cfb('0x84')],'include':_0x1a3a8a}];_0x22959b['push']({'model':db['OpenchannelAccount'],'as':_0x9cfb('0xde'),'attributes':['id','name']});_0x22959b['push']({'model':db[_0x9cfb('0x74')],'as':'Owner','attributes':['id',_0x9cfb('0xd8')]});return db['OpenchannelInteraction'][_0x9cfb('0x66')]({'where':{'id':_0x444edd[_0x9cfb('0xba')]['id']},'include':_0x22959b})[_0x9cfb('0x2b')](handleEntityNotFound(_0x42eeca,null))[_0x9cfb('0x2b')](function(_0x2b0ffc){if(_0x2b0ffc){var _0x412cc3=_0x2b0ffc['get']({'plain':!![]});fs['mkdirSync'](_0x3f1a4a);var _0x4499f2={'channel':_0x9cfb('0xdf'),'account':_0x412cc3[_0x9cfb('0xde')]['name'],'agent':_0x412cc3[_0x9cfb('0xe0')]?_0x412cc3[_0x9cfb('0xe0')][_0x9cfb('0xd8')]:_0x9cfb('0xe1'),'createdAt':moment(_0x412cc3[_0x9cfb('0x7c')])[_0x9cfb('0xd6')](_0x9cfb('0xc6'))[_0x9cfb('0xa0')](),'closedAt':_0x412cc3['closed']?moment(_0x412cc3[_0x9cfb('0xe2')])[_0x9cfb('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x412cc3[_0x9cfb('0xe3')],'visibility':_0x412cc3[_0x9cfb('0xe4')]?_0x9cfb('0xe5'):_0x9cfb('0xe6'),'messages':_(_0x412cc3[_0x9cfb('0xdd')])[_0x9cfb('0x8a')]({'secret':![]})[_0x9cfb('0x31')](function(_0x59f176){if(_0x59f176[_0x9cfb('0xdc')]){var _0x48939c=path['join'](_0x5e23a1,_0x59f176['Attachment']['basename']);if(fs['existsSync'](_0x48939c)){fs['createReadStream'](_0x48939c)['pipe'](fs['createWriteStream'](path[_0x9cfb('0xd4')](_0x3f1a4a,_0x59f176[_0x9cfb('0xdc')]['basename'])));}}return{'date':moment(_0x59f176[_0x9cfb('0x7c')])[_0x9cfb('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9cfb('0xa0')](),'sender':_0x59f176[_0x9cfb('0xe7')]===_0x9cfb('0xe8')?_0x59f176['User']?_0x59f176[_0x9cfb('0x74')][_0x9cfb('0xd8')]:_0x9cfb('0xe9'):_0x59f176[_0x9cfb('0x69')][_0x9cfb('0xda')]+(_0x59f176['Contact'][_0x9cfb('0xdb')]?'\x20'+_0x59f176[_0x9cfb('0x69')][_0x9cfb('0xdb')]:''),'body':_0x59f176[_0x9cfb('0xdc')]?_0x59f176[_0x9cfb('0xdc')][_0x9cfb('0xea')]:_0x59f176[_0x9cfb('0x76')],'direction':_0x59f176[_0x9cfb('0xe7')]===_0x9cfb('0xe8')?'A':'C','secret':_0x59f176[_0x9cfb('0xeb')],'read':_0x59f176[_0x9cfb('0x84')],'attachment':_0x59f176[_0x9cfb('0xdc')]};})[_0x9cfb('0x67')]()};return ejs[_0x9cfb('0xec')](path[_0x9cfb('0xd4')](config[_0x9cfb('0xd0')],_0x9cfb('0xd1'),_0x9cfb('0xed'),_0x9cfb('0xee')),{'interaction':_0x4499f2})[_0x9cfb('0x2b')](function(_0x16586d){var _0x18265f=path[_0x9cfb('0xd4')](_0x3f1a4a,_0x9cfb('0xef')+_0x412cc3['id']+'-'+_0xce85ca+_0x9cfb('0xf0'));var _0x2f00a3={'path':_0x18265f,'channel':_0x9cfb('0xdf'),'interactionId':_0x412cc3['id']};return pdf[_0x9cfb('0xf1')](_0x16586d,_0x2f00a3);})['then'](function(){return new BPromise(function(_0x105705,_0x56471c){zipdir(_0x3f1a4a,{'saveTo':_0x23eea9},function(_0x3b5a42,_0x40a558){if(_0x3b5a42)return _0x56471c(_0x3b5a42);return _0x105705(_0x40a558);});})[_0x9cfb('0x2b')](function(){return new BPromise(function(_0x2ab612,_0x228068){rimraf(_0x3f1a4a,function(_0x413c98){if(_0x413c98)_0x228068(_0x413c98);return _0x2ab612();});});})['then'](function(){return _0x42eeca[_0x9cfb('0xce')](_0x23eea9,_0x33da8f,function(_0x25c2e1){if(_0x25c2e1){console['log'](_0x9cfb('0xf2'),_0x25c2e1);}else{fs[_0x9cfb('0xf3')](_0x23eea9);}});});});}else{return _0x42eeca[_0x9cfb('0x1e')](0xc8);}})[_0x9cfb('0x37')](handleError(_0x42eeca,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 952c14c..bd994f2 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 _0x357e=['../../mysqldb','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hook','exports','events','OpenchannelInteraction'];(function(_0x2c0ac4,_0x4e0dd1){var _0x4eba00=function(_0x1a298c){while(--_0x1a298c){_0x2c0ac4['push'](_0x2c0ac4['shift']());}};_0x4eba00(++_0x4e0dd1);}(_0x357e,0xa0));var _0xe357=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x357e[_0x13b8f3];return _0x1a6d06;};'use strict';var EventEmitter=require(_0xe357('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xe357('0x1')];var OpenchannelMessage=require(_0xe357('0x2'))['db'][_0xe357('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe357('0x4'),'afterUpdate':_0xe357('0x5'),'afterDestroy':_0xe357('0x6')};function emitEvent(_0x5c9c54){return function(_0x2ca127,_0x967007,_0x671178){_0x2ca127[_0xe357('0x7')]({'attributes':['id'],'raw':!![]})[_0xe357('0x8')](function(_0x595ec9){_0x2ca127[_0xe357('0x9')](_0xe357('0xa'),_0x595ec9[_0xe357('0xb')](function(_0x5f0f66){return{'id':_0x5f0f66['id']};}));return OpenchannelMessage[_0xe357('0xc')]({'where':{'OpenchannelInteractionId':_0x2ca127['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x25b50a){_0x2ca127[_0xe357('0x9')](_0xe357('0xd'),_0x25b50a[_0xe357('0xe')]);OpenchannelInteractionEvents[_0xe357('0xf')](_0x5c9c54+':'+_0x2ca127['id'],_0x2ca127);OpenchannelInteractionEvents[_0xe357('0xf')](_0x5c9c54,_0x2ca127);_0x671178(null);})['catch'](_0x671178(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe357('0x10')](e,emitEvent(event));}}module[_0xe357('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5be2=['setDataValue','Users','map','findAll','then','unreadMessages','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update'];(function(_0xad9a42,_0x3af815){var _0x38d2fe=function(_0x1e01f9){while(--_0x1e01f9){_0xad9a42['push'](_0xad9a42['shift']());}};_0x38d2fe(++_0x3af815);}(_0x5be2,0x112));var _0x25be=function(_0x2c207e,_0x2fa982){_0x2c207e=_0x2c207e-0x0;var _0x4d286e=_0x5be2[_0x2c207e];return _0x4d286e;};'use strict';var EventEmitter=require(_0x25be('0x0'));var OpenchannelInteraction=require(_0x25be('0x1'))['db'][_0x25be('0x2')];var OpenchannelMessage=require(_0x25be('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x25be('0x3')](0x0);var events={'afterCreate':_0x25be('0x4'),'afterUpdate':_0x25be('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10b020){return function(_0xe49efb,_0x45e520,_0x16c7b3){_0xe49efb['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5c58ba){_0xe49efb[_0x25be('0x6')](_0x25be('0x7'),_0x5c58ba[_0x25be('0x8')](function(_0x6bf667){return{'id':_0x6bf667['id']};}));return OpenchannelMessage[_0x25be('0x9')]({'where':{'OpenchannelInteractionId':_0xe49efb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x25be('0xa')](function(_0x17233c){_0xe49efb[_0x25be('0x6')](_0x25be('0xb'),_0x17233c['length']);OpenchannelInteractionEvents['emit'](_0x10b020+':'+_0xe49efb['id'],_0xe49efb);OpenchannelInteractionEvents['emit'](_0x10b020,_0xe49efb);_0x16c7b3(null);})['catch'](_0x16c7b3(null));};}for(var e in events){if(events[_0x25be('0xc')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x25be('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 2c2610e..aad00e5 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 _0xf6cd=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf6cd,0x16b));var _0xdf6c=function(_0x37768b,_0xedcc5a){_0x37768b=_0x37768b-0x0;var _0x1f3c43=_0xf6cd[_0x37768b];return _0x1f3c43;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf6c('0x0'))(_0xdf6c('0x1'));var moment=require(_0xdf6c('0x2'));var BPromise=require(_0xdf6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf6c('0x4'));var rimraf=require(_0xdf6c('0x5'));var config=require(_0xdf6c('0x6'));var attributes=require(_0xdf6c('0x7'));module[_0xdf6c('0x8')]=function(_0x5dbf5e,_0x24fe48){return _0x5dbf5e[_0xdf6c('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0xdf6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf6c('0xb'),'collate':_0xdf6c('0xc'),'hooks':{'beforeUpdate':function(_0x313b69,_0x21af6b,_0x3a608d){if(_0x313b69[_0xdf6c('0xd')](_0xdf6c('0xe'))){_0x313b69[_0xdf6c('0xf')]=moment()[_0xdf6c('0x10')](_0xdf6c('0x11'));}_0x3a608d(null,_0x313b69);}}});}; \ No newline at end of file +var _0xbcd9=['utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4'];(function(_0x229d75,_0x2ee496){var _0x4d5620=function(_0x30bf28){while(--_0x30bf28){_0x229d75['push'](_0x229d75['shift']());}};_0x4d5620(++_0x2ee496);}(_0xbcd9,0x105));var _0x9bcd=function(_0x1fe971,_0x54632b){_0x1fe971=_0x1fe971-0x0;var _0x20ea46=_0xbcd9[_0x1fe971];return _0x20ea46;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9bcd('0x0'));var moment=require(_0x9bcd('0x1'));var BPromise=require(_0x9bcd('0x2'));var rp=require(_0x9bcd('0x3'));var fs=require('fs');var path=require(_0x9bcd('0x4'));var rimraf=require('rimraf');var config=require(_0x9bcd('0x5'));var attributes=require(_0x9bcd('0x6'));module[_0x9bcd('0x7')]=function(_0x21779f,_0x49b73b){return _0x21779f[_0x9bcd('0x8')](_0x9bcd('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bcd('0xa'),'collate':_0x9bcd('0xb'),'hooks':{'beforeUpdate':function(_0x3e3680,_0x469cbd,_0xa6583e){if(_0x3e3680[_0x9bcd('0xc')]('closed')){_0x3e3680[_0x9bcd('0xd')]=moment()[_0x9bcd('0xe')](_0x9bcd('0xf'));}_0xa6583e(null,_0x3e3680);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 0b413f7..ae8bd35 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 _0x686d=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction','update','body','options','where','attributes','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring'];(function(_0x21f912,_0x309fa0){var _0x150b47=function(_0x1d484e){while(--_0x1d484e){_0x21f912['push'](_0x21f912['shift']());}};_0x150b47(++_0x309fa0);}(_0x686d,0x9d));var _0xd686=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x686d[_0x36f243];return _0x426436;};'use strict';var _=require('lodash');var util=require(_0xd686('0x0'));var moment=require('moment');var BPromise=require(_0xd686('0x1'));var rs=require(_0xd686('0x2'));var fs=require('fs');var Redis=require(_0xd686('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd686('0x4'));var logger=require(_0xd686('0x5'))(_0xd686('0x6'));var config=require('../../config/environment');var jayson=require(_0xd686('0x7'));var client=jayson[_0xd686('0x8')]['http']({'port':0x232a});config['redis']=_[_0xd686('0x9')](config[_0xd686('0xa')],{'host':_0xd686('0xb'),'port':0x18eb});var socket=require(_0xd686('0xc'))(new Redis(config[_0xd686('0xa')]));require('./openchannelInteraction.socket')[_0xd686('0xd')](socket);function respondWithRpcPromise(_0x16d442,_0x4e91f0,_0x958aa7){return new BPromise(function(_0x5ae8e6,_0x1b5770){return client[_0xd686('0xe')](_0x16d442,_0x958aa7)[_0xd686('0xf')](function(_0x418d1e){logger[_0xd686('0x10')](_0xd686('0x11'),_0x4e91f0,_0xd686('0x12'));logger[_0xd686('0x13')](_0xd686('0x14'),_0x4e91f0,_0xd686('0x12'),JSON[_0xd686('0x15')](_0x418d1e));if(_0x418d1e[_0xd686('0x16')]){if(_0x418d1e['error'][_0xd686('0x17')]===0x1f4){logger[_0xd686('0x16')](_0xd686('0x11'),_0x4e91f0,_0x418d1e['error'][_0xd686('0x18')]);return _0x1b5770(_0x418d1e[_0xd686('0x16')][_0xd686('0x18')]);}logger[_0xd686('0x16')](_0xd686('0x11'),_0x4e91f0,_0x418d1e['error'][_0xd686('0x18')]);return _0x5ae8e6(_0x418d1e['error'][_0xd686('0x18')]);}else{logger['info'](_0xd686('0x11'),_0x4e91f0,_0xd686('0x12'));_0x5ae8e6(_0x418d1e['result'][_0xd686('0x18')]);}})['catch'](function(_0x1fbe70){logger[_0xd686('0x16')](_0xd686('0x11'),_0x4e91f0,_0x1fbe70);_0x1b5770(_0x1fbe70);});});}exports['UpdateOpenchannelInteraction']=function(_0x2ceebf){var _0xb52024=this;return new Promise(function(_0x81c053,_0x2b3c3c){return db[_0xd686('0x19')][_0xd686('0x1a')](_0x2ceebf[_0xd686('0x1b')],{'raw':_0x2ceebf[_0xd686('0x1c')]?_0x2ceebf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ceebf[_0xd686('0x1c')]?_0x2ceebf['options'][_0xd686('0x1d')]||null:null,'attributes':_0x2ceebf[_0xd686('0x1c')]?_0x2ceebf[_0xd686('0x1c')][_0xd686('0x1e')]||null:null,'limit':_0x2ceebf[_0xd686('0x1c')]?_0x2ceebf[_0xd686('0x1c')]['limit']||null:null})[_0xd686('0xf')](function(_0x4f0210){logger[_0xd686('0x10')](_0xd686('0x1f'),_0x2ceebf);logger[_0xd686('0x13')](_0xd686('0x1f'),_0x2ceebf,JSON[_0xd686('0x15')](_0x4f0210));_0x81c053(_0x4f0210);})[_0xd686('0x20')](function(_0x3f9deb){logger[_0xd686('0x16')](_0xd686('0x1f'),_0x3f9deb['message'],_0x2ceebf);_0x2b3c3c(_0xb52024[_0xd686('0x16')](0x1f4,_0x3f9deb[_0xd686('0x18')]));});});};exports[_0xd686('0x21')]=function(_0x397f9b){return new Promise(function(_0x3251d7,_0x1f918a){return db[_0xd686('0x19')][_0xd686('0x22')]({'where':_0x397f9b['options']?_0x397f9b[_0xd686('0x1c')]['where']||null:null})[_0xd686('0xf')](function(_0x351b6c){if(_0x351b6c){return _0x351b6c[_0xd686('0x23')](_0x397f9b[_0xd686('0x1b')][_0xd686('0x24')],_[_0xd686('0x25')](_0x397f9b[_0xd686('0x1b')],[_0xd686('0x24'),'id'])||{});}})[_0xd686('0x26')](function(_0x165e4c){logger[_0xd686('0x10')]('AddTags',_0x397f9b);logger[_0xd686('0x13')](_0xd686('0x27'),_0x397f9b,JSON[_0xd686('0x15')](_0x165e4c));_0x3251d7(_0x165e4c);})['catch'](function(_0x48588c){logger[_0xd686('0x16')]('AddTags',_0x48588c[_0xd686('0x18')],_0x397f9b);_0x1f918a(_this[_0xd686('0x16')](0x1f4,_0x48588c['message']));});});}; \ No newline at end of file +var _0x5801=['result','catch','OpenchannelInteraction','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','find','then','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','code','error','message','info'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5801,0x93));var _0x1580=function(_0x4145dd,_0xc1721e){_0x4145dd=_0x4145dd-0x0;var _0x3e3ae6=_0x5801[_0x4145dd];return _0x3e3ae6;};'use strict';var _=require(_0x1580('0x0'));var util=require(_0x1580('0x1'));var moment=require(_0x1580('0x2'));var BPromise=require(_0x1580('0x3'));var rs=require(_0x1580('0x4'));var fs=require('fs');var Redis=require(_0x1580('0x5'));var db=require(_0x1580('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1580('0x7'))(_0x1580('0x8'));var config=require(_0x1580('0x9'));var jayson=require(_0x1580('0xa'));var client=jayson[_0x1580('0xb')][_0x1580('0xc')]({'port':0x232a});config[_0x1580('0xd')]=_['defaults'](config[_0x1580('0xd')],{'host':_0x1580('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1580('0xd')]));require('./openchannelInteraction.socket')[_0x1580('0xf')](socket);function respondWithRpcPromise(_0x524eaf,_0xc899dd,_0x32a578){return new BPromise(function(_0x3285a7,_0x19bbf8){return client[_0x1580('0x10')](_0x524eaf,_0x32a578)['then'](function(_0x3fa730){logger['info'](_0x1580('0x11'),_0xc899dd,_0x1580('0x12'));logger[_0x1580('0x13')](_0x1580('0x14'),_0xc899dd,_0x1580('0x12'),JSON['stringify'](_0x3fa730));if(_0x3fa730['error']){if(_0x3fa730['error'][_0x1580('0x15')]===0x1f4){logger['error'](_0x1580('0x11'),_0xc899dd,_0x3fa730[_0x1580('0x16')][_0x1580('0x17')]);return _0x19bbf8(_0x3fa730[_0x1580('0x16')]['message']);}logger[_0x1580('0x16')](_0x1580('0x11'),_0xc899dd,_0x3fa730['error'][_0x1580('0x17')]);return _0x3285a7(_0x3fa730[_0x1580('0x16')][_0x1580('0x17')]);}else{logger[_0x1580('0x18')](_0x1580('0x11'),_0xc899dd,_0x1580('0x12'));_0x3285a7(_0x3fa730[_0x1580('0x19')][_0x1580('0x17')]);}})[_0x1580('0x1a')](function(_0x4d9a1f){logger['error'](_0x1580('0x11'),_0xc899dd,_0x4d9a1f);_0x19bbf8(_0x4d9a1f);});});}exports['UpdateOpenchannelInteraction']=function(_0x77dd9c){var _0xc2b3e9=this;return new Promise(function(_0x3dff80,_0x366271){return db[_0x1580('0x1b')]['update'](_0x77dd9c['body'],{'raw':_0x77dd9c[_0x1580('0x1c')]?_0x77dd9c[_0x1580('0x1c')][_0x1580('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x77dd9c[_0x1580('0x1c')]?_0x77dd9c[_0x1580('0x1c')][_0x1580('0x1e')]||null:null,'attributes':_0x77dd9c['options']?_0x77dd9c[_0x1580('0x1c')][_0x1580('0x1f')]||null:null,'limit':_0x77dd9c['options']?_0x77dd9c['options'][_0x1580('0x20')]||null:null})['then'](function(_0x3f0edf){logger['info']('UpdateOpenchannelInteraction',_0x77dd9c);logger['debug'](_0x1580('0x21'),_0x77dd9c,JSON[_0x1580('0x22')](_0x3f0edf));_0x3dff80(_0x3f0edf);})['catch'](function(_0xa606c7){logger[_0x1580('0x16')](_0x1580('0x21'),_0xa606c7[_0x1580('0x17')],_0x77dd9c);_0x366271(_0xc2b3e9['error'](0x1f4,_0xa606c7['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x14c5f3){return new Promise(function(_0x5f100f,_0x47f414){return db['OpenchannelInteraction'][_0x1580('0x23')]({'where':_0x14c5f3['options']?_0x14c5f3['options'][_0x1580('0x1e')]||null:null})[_0x1580('0x24')](function(_0x4fb6cd){if(_0x4fb6cd){return _0x4fb6cd[_0x1580('0x25')](_0x14c5f3[_0x1580('0x26')][_0x1580('0x27')],_[_0x1580('0x28')](_0x14c5f3[_0x1580('0x26')],[_0x1580('0x27'),'id'])||{});}})[_0x1580('0x29')](function(_0x454736){logger[_0x1580('0x18')]('AddTags',_0x14c5f3);logger[_0x1580('0x13')]('AddTags',_0x14c5f3,JSON[_0x1580('0x22')](_0x454736));_0x5f100f(_0x454736);})['catch'](function(_0x2a3e7e){logger['error'](_0x1580('0x2a'),_0x2a3e7e[_0x1580('0x17')],_0x14c5f3);_0x47f414(_this[_0x1580('0x16')](0x1f4,_0x2a3e7e[_0x1580('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f8c0c24..702d4a8 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 _0x3c31=['save','update','emit','length','./openchannelInteraction.events'];(function(_0x1e62b3,_0x3f4c47){var _0xabf3f7=function(_0x445284){while(--_0x445284){_0x1e62b3['push'](_0x1e62b3['shift']());}};_0xabf3f7(++_0x3f4c47);}(_0x3c31,0x1b2));var _0x13c3=function(_0x6b64d1,_0x4cbf6d){_0x6b64d1=_0x6b64d1-0x0;var _0x2a2d95=_0x3c31[_0x6b64d1];return _0x2a2d95;};'use strict';var OpenchannelInteractionEvents=require(_0x13c3('0x0'));var events=[_0x13c3('0x1'),'remove',_0x13c3('0x2')];function createListener(_0x1cbba6,_0x161c8d){return function(_0x4dfcac){_0x161c8d[_0x13c3('0x3')](_0x1cbba6,_0x4dfcac);};}function removeListener(_0x5193da,_0x51f726){return function(){OpenchannelInteractionEvents['removeListener'](_0x5193da,_0x51f726);};}exports['register']=function(_0x12655b){for(var _0x40a41b=0x0,_0x9267a5=events[_0x13c3('0x4')];_0x40a41b<_0x9267a5;_0x40a41b++){var _0x209d26=events[_0x40a41b];var _0x173497=createListener('openchannelInteraction:'+_0x209d26,_0x12655b);OpenchannelInteractionEvents['on'](_0x209d26,_0x173497);}}; \ No newline at end of file +var _0xc55a=['update','removeListener','register','openchannelInteraction:','remove'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xc55a,0xb8));var _0xac55=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xc55a[_0x1a9204];return _0x17ca68;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xac55('0x0'),_0xac55('0x1')];function createListener(_0x4a7152,_0x337716){return function(_0x471d4b){_0x337716['emit'](_0x4a7152,_0x471d4b);};}function removeListener(_0x5db325,_0xec0d98){return function(){OpenchannelInteractionEvents[_0xac55('0x2')](_0x5db325,_0xec0d98);};}exports[_0xac55('0x3')]=function(_0x2c97ba){for(var _0x14bdad=0x0,_0x5ab109=events['length'];_0x14bdad<_0x5ab109;_0x14bdad++){var _0x215ea6=events[_0x14bdad];var _0x101f7f=createListener(_0xac55('0x4')+_0x215ea6,_0x2c97ba);OpenchannelInteractionEvents['on'](_0x215ea6,_0x101f7f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c38353e..1620505 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x1a5296,_0x57bc78){var _0x5e68a0=function(_0x238846){while(--_0x238846){_0x1a5296['push'](_0x1a5296['shift']());}};_0x5e68a0(++_0x57bc78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x5ef654,_0xc38bf9){_0x5ef654=_0x5ef654-0x0;var _0x16180e=_0x70e0[_0x5ef654];return _0x16180e;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c756e88..d75cac3 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 _0xbb59=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb59,0xec));var _0x9bb5=function(_0x3bbf79,_0x4093f0){_0x3bbf79=_0x3bbf79-0x0;var _0x597080=_0xbb59[_0x3bbf79];return _0x597080;};'use strict';var Sequelize=require(_0x9bb5('0x0'));module[_0x9bb5('0x1')]={'body':{'type':Sequelize[_0x9bb5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9bb5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9bb5('0x4')]('in',_0x9bb5('0x5')),'defaultValue':_0x9bb5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9bb5('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9bb5('0x2')]}}; \ No newline at end of file +var _0x0664=['DATE','STRING','TEXT','exports','medium','BOOLEAN','ENUM','out'];(function(_0x34f085,_0x158023){var _0x4d01d3=function(_0x598bea){while(--_0x598bea){_0x34f085['push'](_0x34f085['shift']());}};_0x4d01d3(++_0x158023);}(_0x0664,0x93));var _0x4066=function(_0x42f30b,_0x468227){_0x42f30b=_0x42f30b-0x0;var _0x31d065=_0x0664[_0x42f30b];return _0x31d065;};'use strict';var Sequelize=require('sequelize');module[_0x4066('0x0')]={'body':{'type':Sequelize['TEXT'](_0x4066('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4066('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4066('0x3')]('in',_0x4066('0x4')),'defaultValue':_0x4066('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4066('0x5')]},'providerName':{'type':Sequelize[_0x4066('0x6')]},'providerResponse':{'type':Sequelize[_0x4066('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8a14e0a..bb6dc42 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 _0xd307=['rejectMessage','User','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','../../config/logger','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd307,0x110));var _0x7d30=function(_0x178bcc,_0x15aa2b){_0x178bcc=_0x178bcc-0x0;var _0xddf332=_0xd307[_0x178bcc];return _0xddf332;};'use strict';var emlformat=require(_0x7d30('0x0'));var rimraf=require(_0x7d30('0x1'));var zipdir=require(_0x7d30('0x2'));var jsonpatch=require(_0x7d30('0x3'));var rp=require(_0x7d30('0x4'));var moment=require(_0x7d30('0x5'));var BPromise=require(_0x7d30('0x6'));var Mustache=require(_0x7d30('0x7'));var util=require('util');var path=require(_0x7d30('0x8'));var sox=require(_0x7d30('0x9'));var csv=require('to-csv');var ejs=require(_0x7d30('0xa'));var fs=require('fs');var fs_extra=require(_0x7d30('0xb'));var _=require(_0x7d30('0xc'));var squel=require(_0x7d30('0xd'));var crypto=require(_0x7d30('0xe'));var jsforce=require(_0x7d30('0xf'));var deskjs=require(_0x7d30('0x10'));var toCsv=require(_0x7d30('0x11'));var querystring=require('querystring');var Papa=require(_0x7d30('0x12'));var Redis=require(_0x7d30('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7d30('0x14'));var as=require(_0x7d30('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d30('0x16'));var utils=require(_0x7d30('0x17'));var config=require(_0x7d30('0x18'));var licenseUtil=require(_0x7d30('0x19'));var db=require(_0x7d30('0x1a'))['db'];config['redis']=_[_0x7d30('0x1b')](config[_0x7d30('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d30('0x1d'))(new Redis(config[_0x7d30('0x1c')]));require('./openchannelMessage.socket')[_0x7d30('0x1e')](socket);var jayson=require(_0x7d30('0x1f'));var client=jayson[_0x7d30('0x20')][_0x7d30('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x7d30('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x29a2e9,_0x3ad4e7,_0x5ced4f,_0x52157d){return new BPromise(function(_0x5027b3,_0x147860){var _0x183e1c=_0x52157d||client;return _0x183e1c['request'](_0x29a2e9,_0x5ced4f)[_0x7d30('0x22')](function(_0x549c69){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3ad4e7,_0x7d30('0x23'));logger[_0x7d30('0x24')](_0x7d30('0x25'),_0x3ad4e7,'request\x20sent',JSON[_0x7d30('0x26')](_0x549c69));if(_0x549c69[_0x7d30('0x27')]){if(_0x549c69[_0x7d30('0x27')][_0x7d30('0x28')]===0x1f4){logger[_0x7d30('0x27')](_0x7d30('0x29'),_0x3ad4e7,_0x549c69[_0x7d30('0x27')][_0x7d30('0x2a')]);return _0x147860(_0x549c69['error'][_0x7d30('0x2a')]);}logger[_0x7d30('0x27')](_0x7d30('0x29'),_0x3ad4e7,_0x549c69[_0x7d30('0x27')][_0x7d30('0x2a')]);return _0x5027b3(_0x549c69[_0x7d30('0x27')][_0x7d30('0x2a')]);}else{logger[_0x7d30('0x2b')](_0x7d30('0x29'),_0x3ad4e7,_0x7d30('0x23'));_0x5027b3(_0x549c69[_0x7d30('0x2c')]['message']);}})[_0x7d30('0x2d')](function(_0x592aa0){logger['error'](_0x7d30('0x29'),_0x3ad4e7,_0x592aa0);_0x147860(_0x592aa0);});});}function respondWithStatusCode(_0x191bfa,_0x422a44){_0x422a44=_0x422a44||0xcc;return function(_0x271c0c){if(_0x271c0c){return _0x191bfa[_0x7d30('0x2e')](_0x422a44);}return _0x191bfa[_0x7d30('0x2f')](_0x422a44)['end']();};}function respondWithResult(_0x1ce727,_0x201536){_0x201536=_0x201536||0xc8;return function(_0x2e2f3d){if(_0x2e2f3d){return _0x1ce727[_0x7d30('0x2f')](_0x201536)['json'](_0x2e2f3d);}};}function respondWithFilteredResult(_0x5a7b9f,_0x33ccb1){return function(_0x13e6c6){if(_0x13e6c6){var _0x866f0c=typeof _0x33ccb1[_0x7d30('0x30')]===_0x7d30('0x31')&&typeof _0x33ccb1[_0x7d30('0x32')]===_0x7d30('0x31');var _0x489084=_0x13e6c6[_0x7d30('0x33')];var _0x3af4dd=_0x866f0c?0x0:_0x33ccb1['offset'];var _0x9d5473=_0x866f0c?_0x13e6c6[_0x7d30('0x33')]:_0x33ccb1[_0x7d30('0x30')]+_0x33ccb1['limit'];var _0x5bca01;if(_0x9d5473>=_0x489084){_0x9d5473=_0x489084;_0x5bca01=0xc8;}else{_0x5bca01=0xce;}_0x5a7b9f['status'](_0x5bca01);return _0x5a7b9f[_0x7d30('0x34')](_0x7d30('0x35'),_0x3af4dd+'-'+_0x9d5473+'/'+_0x489084)[_0x7d30('0x36')](_0x13e6c6);}return null;};}function patchUpdates(_0x7e362a){return function(_0x51aeba){try{jsonpatch['apply'](_0x51aeba,_0x7e362a,!![]);}catch(_0x44a2fc){return BPromise[_0x7d30('0x37')](_0x44a2fc);}return _0x51aeba[_0x7d30('0x38')]();};}function saveUpdates(_0x19cbb6,_0x4d9526){return function(_0x5a1613){if(_0x5a1613){return _0x5a1613[_0x7d30('0x39')](_0x19cbb6)[_0x7d30('0x22')](function(_0x48dba8){return _0x48dba8;});}return null;};}function removeEntity(_0x39ebbc,_0x128cae){return function(_0x303b9d){if(_0x303b9d){return _0x303b9d[_0x7d30('0x3a')]()['then'](function(){_0x39ebbc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eba7,_0x48703d){return function(_0x1c4610){if(!_0x1c4610){_0x44eba7['sendStatus'](0x194);}return _0x1c4610;};}function handleError(_0x533490,_0x11d4ea){_0x11d4ea=_0x11d4ea||0x1f4;return function(_0x35cf70){logger[_0x7d30('0x27')](_0x35cf70[_0x7d30('0x3b')]);if(_0x35cf70[_0x7d30('0x3c')]){delete _0x35cf70[_0x7d30('0x3c')];}_0x533490['status'](_0x11d4ea)[_0x7d30('0x3d')](_0x35cf70);};}exports[_0x7d30('0x3e')]=function(_0x1b10a9,_0x40c674){var _0x40e7d4={},_0x344562={},_0x3f619d={'count':0x0,'rows':[]};var _0xebf8de=_['map'](db[_0x7d30('0x3f')][_0x7d30('0x40')],function(_0x57bcad){return{'name':_0x57bcad[_0x7d30('0x41')],'type':_0x57bcad[_0x7d30('0x42')][_0x7d30('0x43')]};});_0x344562[_0x7d30('0x44')]=_[_0x7d30('0x45')](_0xebf8de,_0x7d30('0x3c'));_0x344562[_0x7d30('0x46')]=_[_0x7d30('0x47')](_0x1b10a9[_0x7d30('0x46')]);_0x344562[_0x7d30('0x48')]=_[_0x7d30('0x49')](_0x344562[_0x7d30('0x44')],_0x344562[_0x7d30('0x46')]);_0x40e7d4[_0x7d30('0x4a')]=_['intersection'](_0x344562[_0x7d30('0x44')],qs[_0x7d30('0x4b')](_0x1b10a9[_0x7d30('0x46')]['fields']));_0x40e7d4[_0x7d30('0x4a')]=_0x40e7d4[_0x7d30('0x4a')][_0x7d30('0x4c')]?_0x40e7d4[_0x7d30('0x4a')]:_0x344562['model'];if(!_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x4d')]('nolimit')){_0x40e7d4[_0x7d30('0x32')]=qs['limit'](_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x32')]);_0x40e7d4[_0x7d30('0x30')]=qs['offset'](_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x30')]);}_0x40e7d4['order']=qs[_0x7d30('0x4e')](_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x4e')]);_0x40e7d4[_0x7d30('0x4f')]=qs[_0x7d30('0x48')](_[_0x7d30('0x50')](_0x1b10a9['query'],_0x344562['filters']),_0xebf8de);if(_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x51')]){_0x40e7d4['where']=_[_0x7d30('0x52')](_0x40e7d4['where'],{'$or':_[_0x7d30('0x45')](_0xebf8de,function(_0x30a38a){if(_0x30a38a[_0x7d30('0x42')]!==_0x7d30('0x53')){var _0x1be4a5={};_0x1be4a5[_0x30a38a[_0x7d30('0x3c')]]={'$like':'%'+_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x51')]+'%'};return _0x1be4a5;}})});}_0x40e7d4=_[_0x7d30('0x52')]({},_0x40e7d4,_0x1b10a9[_0x7d30('0x54')]);var _0x5f4034={'where':_0x40e7d4[_0x7d30('0x4f')]};return db[_0x7d30('0x3f')]['count'](_0x5f4034)['then'](function(_0x28bf00){_0x3f619d['count']=_0x28bf00;if(_0x1b10a9[_0x7d30('0x46')][_0x7d30('0x55')]){_0x40e7d4[_0x7d30('0x56')]=[{'all':!![]}];}return db[_0x7d30('0x3f')][_0x7d30('0x57')](_0x40e7d4);})[_0x7d30('0x22')](function(_0x256f25){_0x3f619d[_0x7d30('0x58')]=_0x256f25;return _0x3f619d;})['then'](respondWithFilteredResult(_0x40c674,_0x40e7d4))[_0x7d30('0x2d')](handleError(_0x40c674,null));};exports[_0x7d30('0x59')]=function(_0x5ba179,_0x18aba7){var _0x3bb329={'raw':!![],'where':{'id':_0x5ba179[_0x7d30('0x5a')]['id']}},_0x34338a={};_0x34338a['model']=_['keys'](db[_0x7d30('0x3f')][_0x7d30('0x40')]);_0x34338a[_0x7d30('0x46')]=_['keys'](_0x5ba179[_0x7d30('0x46')]);_0x34338a[_0x7d30('0x48')]=_['intersection'](_0x34338a['model'],_0x34338a[_0x7d30('0x46')]);_0x3bb329[_0x7d30('0x4a')]=_[_0x7d30('0x49')](_0x34338a['model'],qs[_0x7d30('0x4b')](_0x5ba179[_0x7d30('0x46')]['fields']));_0x3bb329[_0x7d30('0x4a')]=_0x3bb329[_0x7d30('0x4a')][_0x7d30('0x4c')]?_0x3bb329[_0x7d30('0x4a')]:_0x34338a[_0x7d30('0x44')];if(_0x5ba179[_0x7d30('0x46')]['includeAll']){_0x3bb329[_0x7d30('0x56')]=[{'all':!![]}];}_0x3bb329=_['merge']({},_0x3bb329,_0x5ba179['options']);return db[_0x7d30('0x3f')][_0x7d30('0x5b')](_0x3bb329)[_0x7d30('0x22')](handleEntityNotFound(_0x18aba7,null))['then'](respondWithResult(_0x18aba7,null))['catch'](handleError(_0x18aba7,null));};exports[_0x7d30('0x5c')]=function(_0x5156c5,_0x13ae96){return db[_0x7d30('0x3f')]['create'](_0x5156c5[_0x7d30('0x5d')],{})['then'](respondWithResult(_0x13ae96,0xc9))['catch'](handleError(_0x13ae96,null));};exports[_0x7d30('0x39')]=function(_0x300d16,_0x5ee7f9){if(_0x300d16['body']['id']){delete _0x300d16['body']['id'];}return db[_0x7d30('0x3f')][_0x7d30('0x5b')]({'where':{'id':_0x300d16['params']['id']}})[_0x7d30('0x22')](handleEntityNotFound(_0x5ee7f9,null))[_0x7d30('0x22')](saveUpdates(_0x300d16[_0x7d30('0x5d')],null))[_0x7d30('0x22')](respondWithResult(_0x5ee7f9,null))[_0x7d30('0x2d')](handleError(_0x5ee7f9,null));};exports[_0x7d30('0x3a')]=function(_0x512367,_0x376686){return db['OpenchannelMessage'][_0x7d30('0x5b')]({'where':{'id':_0x512367[_0x7d30('0x5a')]['id']}})[_0x7d30('0x22')](handleEntityNotFound(_0x376686,null))['then'](removeEntity(_0x376686,null))[_0x7d30('0x2d')](handleError(_0x376686,null));};exports['describe']=function(_0x2d6c09,_0x528221){return db[_0x7d30('0x3f')][_0x7d30('0x5e')]()['then'](respondWithResult(_0x528221,null))['catch'](handleError(_0x528221,null));};var interaction_log=require(_0x7d30('0x5f'))(_0x7d30('0x60'));exports[_0x7d30('0x61')]=function(_0x6b2209,_0xc4ae6e,_0x9e0693){var _0x276b02={'agent':{},'channel':'openchannel'};if(_0x6b2209['body']['id']){delete _0x6b2209[_0x7d30('0x5d')]['id'];}_0x6b2209[_0x7d30('0x5d')][_0x7d30('0x62')]=!![];_0x6b2209[_0x7d30('0x5d')][_0x7d30('0x63')]=moment()[_0x7d30('0x64')](_0x7d30('0x65'));_0x6b2209['body'][_0x7d30('0x66')]=_0x6b2209['body'][_0x7d30('0x66')]||_0x6b2209[_0x7d30('0x67')]['id'];_0x276b02[_0x7d30('0x68')]['id']=_0x6b2209[_0x7d30('0x5d')][_0x7d30('0x66')];return db[_0x7d30('0x3f')][_0x7d30('0x5b')]({'where':{'id':_0x6b2209[_0x7d30('0x5a')]['id'],'UserId':null}})[_0x7d30('0x22')](handleEntityNotFound(_0xc4ae6e,null))[_0x7d30('0x22')](saveUpdates(_0x6b2209[_0x7d30('0x5d')],null))['then'](function(_0x22224e){if(_0x22224e){_0x276b02[_0x7d30('0x2a')]=_0x22224e[_0x7d30('0x69')]({'plain':!![]});return db[_0x7d30('0x6a')][_0x7d30('0x5b')]({'where':{'id':_0x22224e[_0x7d30('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0xc4ae6e,null))[_0x7d30('0x22')](function(_0x2011fc){if(_0x2011fc){return _0x2011fc['update']({'UserId':_0x6b2209[_0x7d30('0x5d')]['UserId'],'read1stAt':_[_0x7d30('0x6c')](_0x2011fc[_0x7d30('0x6d')])?moment()['format'](_0x7d30('0x65')):undefined});}return null;})[_0x7d30('0x22')](function(_0x52c3a2){if(_0x52c3a2){_0x276b02[_0x7d30('0x6e')]=_0x52c3a2['get']({'plain':!![]});interaction_log['info'](_0x7d30('0x6f'),_0x6b2209[_0x7d30('0x67')]['id'],_0x6b2209[_0x7d30('0x67')][_0x7d30('0x3c')],_0x6b2209['user'][_0x7d30('0x70')],_0x276b02['interaction']['id'],_0x6b2209[_0x7d30('0x5d')]?JSON[_0x7d30('0x26')](_0x6b2209['body']):_0x7d30('0x71'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x276b02);}return null;})[_0x7d30('0x22')](function(_0x15cbb1){var _0x33a0db=_0x7d30('0x72')+_0x15cbb1['message']['ContactId'];return db[_0x7d30('0x73')][_0x7d30('0x46')](_0x33a0db,{'type':db[_0x7d30('0x74')][_0x7d30('0x75')][_0x7d30('0x76')],'raw':!![]})['then'](function(_0x1ecbfb){return _0x1ecbfb;});})[_0x7d30('0x22')](function(_0x46b76f){if(_0x46b76f){_0x276b02['message'][_0x7d30('0x77')]=_0x46b76f[0x0];if(!_0x6b2209[_0x7d30('0x5d')][_0x7d30('0x66')])return;return db['User'][_0x7d30('0x5b')]({'where':{'id':_0x6b2209[_0x7d30('0x5d')]['UserId'],'role':_0x7d30('0x68')},'attributes':['id',_0x7d30('0x3c'),_0x7d30('0x78'),_0x7d30('0x79'),_0x7d30('0x7a')],'raw':!![]});}return null;})[_0x7d30('0x22')](function(_0x5ed111){if(!_0x5ed111)return null;_0x276b02['message'][_0x7d30('0x68')]=_0x5ed111;return _0x276b02;})['then'](function(_0x145b1b){if(_0x145b1b){if(_0x6b2209[_0x7d30('0x5d')][_0x7d30('0x7b')]){_0x276b02[_0x7d30('0x2a')]['interface']=util[_0x7d30('0x64')](_0x7d30('0x7c'),_0x6b2209['user']['name']);_0x276b02['message'][_0x7d30('0x7d')]=_0x276b02['channel'];_0x276b02[_0x7d30('0x2a')][_0x7d30('0x7e')]=_0x276b02[_0x7d30('0x7d')];_0x276b02[_0x7d30('0x2a')]['event']=_0x7d30('0x61');return respondWithRpcPromise(_0x7d30('0x7f'),_0x7d30('0x7f'),{'event':_0x7d30('0x80'),'message':_0x276b02[_0x7d30('0x2a')]},client9002)['then'](function(){return _0x276b02;});}return _0x276b02;}return null;})[_0x7d30('0x22')](respondWithResult(_0xc4ae6e,null))[_0x7d30('0x2d')](handleError(_0xc4ae6e,null));};var interaction_log=require(_0x7d30('0x5f'))(_0x7d30('0x60'));exports[_0x7d30('0x37')]=function(_0x457e12,_0x597c8b,_0x221093){var _0x34851f={'agent':{},'channel':'openchannel'};if(_0x457e12['body']['id']){delete _0x457e12[_0x7d30('0x5d')]['id'];}_0x457e12['body'][_0x7d30('0x66')]=_0x457e12['body'][_0x7d30('0x66')]||_0x457e12[_0x7d30('0x67')]['id'];_0x34851f[_0x7d30('0x68')]['id']=_0x457e12[_0x7d30('0x5d')][_0x7d30('0x66')];return db[_0x7d30('0x3f')][_0x7d30('0x5b')]({'where':{'id':_0x457e12[_0x7d30('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x597c8b,null))['then'](function(_0x11141b){if(_0x11141b){_0x34851f['message']=_0x11141b[_0x7d30('0x69')]({'plain':!![]});return db[_0x7d30('0x6a')][_0x7d30('0x5b')]({'where':{'id':_0x11141b['OpenchannelInteractionId']}});}return null;})[_0x7d30('0x22')](handleEntityNotFound(_0x597c8b,null))[_0x7d30('0x22')](function(_0x11e8f3){if(_0x11e8f3){_0x34851f[_0x7d30('0x6e')]=_0x11e8f3['get']({'plain':!![]});interaction_log[_0x7d30('0x2b')](_0x7d30('0x81'),_0x457e12[_0x7d30('0x67')]['id'],_0x457e12[_0x7d30('0x67')][_0x7d30('0x3c')],_0x457e12[_0x7d30('0x67')]['role'],_0x34851f[_0x7d30('0x6e')]['id'],_0x457e12[_0x7d30('0x5d')]?JSON[_0x7d30('0x26')](_0x457e12[_0x7d30('0x5d')]):'null');return respondWithRpcPromise('RejectMessage',_0x7d30('0x82'),_0x34851f);}return null;})['then'](function(_0x3a483a){var _0x5810b0=_0x7d30('0x72')+_0x3a483a[_0x7d30('0x2a')]['ContactId'];return db[_0x7d30('0x73')]['query'](_0x5810b0,{'type':db['Sequelize'][_0x7d30('0x75')][_0x7d30('0x76')],'raw':!![]})[_0x7d30('0x22')](function(_0x6d8ba7){return _0x6d8ba7;});})[_0x7d30('0x22')](function(_0x52e7b3){if(_0x52e7b3){_0x34851f[_0x7d30('0x2a')][_0x7d30('0x77')]=_0x52e7b3[0x0];if(!_0x457e12['body'][_0x7d30('0x66')])return;return db[_0x7d30('0x83')]['find']({'where':{'id':_0x457e12[_0x7d30('0x5d')][_0x7d30('0x66')],'role':_0x7d30('0x68')},'attributes':['id',_0x7d30('0x3c'),_0x7d30('0x78'),_0x7d30('0x79'),'internal'],'raw':!![]});}return null;})[_0x7d30('0x22')](function(_0x480a1e){if(!_0x480a1e)return null;_0x34851f[_0x7d30('0x2a')]['agent']=_0x480a1e;return _0x34851f;})[_0x7d30('0x22')](function(_0x59db36){if(_0x59db36){_0x59db36[_0x7d30('0x2a')]['interface']=util['format'](_0x7d30('0x7c'),_0x457e12[_0x7d30('0x67')][_0x7d30('0x3c')]);_0x59db36[_0x7d30('0x2a')][_0x7d30('0x7d')]=_0x34851f[_0x7d30('0x7d')];_0x59db36[_0x7d30('0x2a')]['motionChannel']=_0x34851f['channel'];_0x59db36[_0x7d30('0x2a')][_0x7d30('0x84')]='reject';respondWithRpcPromise(_0x7d30('0x7f'),_0x7d30('0x7f'),{'event':_0x7d30('0x85'),'message':_0x59db36[_0x7d30('0x2a')]},client9002);return _0x34851f;}return null;})[_0x7d30('0x22')](respondWithResult(_0x597c8b,null))['catch'](handleError(_0x597c8b,null));}; \ No newline at end of file +var _0x3161=['sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x1615d4,_0x3b60b0){var _0x5a52d7=function(_0x431a02){while(--_0x431a02){_0x1615d4['push'](_0x1615d4['shift']());}};_0x5a52d7(++_0x3b60b0);}(_0x3161,0xd8));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x1316('0x0'));var rimraf=require(_0x1316('0x1'));var zipdir=require(_0x1316('0x2'));var jsonpatch=require(_0x1316('0x3'));var rp=require(_0x1316('0x4'));var moment=require(_0x1316('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1316('0x6'));var util=require(_0x1316('0x7'));var path=require('path');var sox=require(_0x1316('0x8'));var csv=require(_0x1316('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1316('0xa'));var _=require('lodash');var squel=require(_0x1316('0xb'));var crypto=require(_0x1316('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1316('0xd'));var toCsv=require(_0x1316('0x9'));var querystring=require(_0x1316('0xe'));var Papa=require(_0x1316('0xf'));var Redis=require(_0x1316('0x10'));var authService=require(_0x1316('0x11'));var qs=require(_0x1316('0x12'));var as=require(_0x1316('0x13'));var hardwareService=require(_0x1316('0x14'));var logger=require(_0x1316('0x15'))(_0x1316('0x16'));var utils=require('../../config/utils');var config=require(_0x1316('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1316('0x18'))['db'];config[_0x1316('0x19')]=_[_0x1316('0x1a')](config['redis'],{'host':_0x1316('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1316('0x19')]));require(_0x1316('0x1c'))[_0x1316('0x1d')](socket);var jayson=require(_0x1316('0x1e'));var client=jayson[_0x1316('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1316('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50d24b,_0x21c690,_0x365f36,_0x1531ff){return new BPromise(function(_0x13e2f5,_0x30ccad){var _0x2a5a20=_0x1531ff||client;return _0x2a5a20['request'](_0x50d24b,_0x365f36)[_0x1316('0x21')](function(_0x524e5e){logger[_0x1316('0x22')](_0x1316('0x23'),_0x21c690,_0x1316('0x24'));logger['debug'](_0x1316('0x25'),_0x21c690,_0x1316('0x24'),JSON['stringify'](_0x524e5e));if(_0x524e5e['error']){if(_0x524e5e[_0x1316('0x26')][_0x1316('0x27')]===0x1f4){logger[_0x1316('0x26')](_0x1316('0x23'),_0x21c690,_0x524e5e[_0x1316('0x26')][_0x1316('0x28')]);return _0x30ccad(_0x524e5e[_0x1316('0x26')]['message']);}logger[_0x1316('0x26')](_0x1316('0x23'),_0x21c690,_0x524e5e['error']['message']);return _0x13e2f5(_0x524e5e[_0x1316('0x26')][_0x1316('0x28')]);}else{logger[_0x1316('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x21c690,_0x1316('0x24'));_0x13e2f5(_0x524e5e['result'][_0x1316('0x28')]);}})[_0x1316('0x29')](function(_0x30f778){logger['error'](_0x1316('0x23'),_0x21c690,_0x30f778);_0x30ccad(_0x30f778);});});}function respondWithStatusCode(_0x44c93e,_0x224555){_0x224555=_0x224555||0xcc;return function(_0x14fffa){if(_0x14fffa){return _0x44c93e['sendStatus'](_0x224555);}return _0x44c93e['status'](_0x224555)[_0x1316('0x2a')]();};}function respondWithResult(_0x472499,_0x316db6){_0x316db6=_0x316db6||0xc8;return function(_0x36900b){if(_0x36900b){return _0x472499[_0x1316('0x2b')](_0x316db6)[_0x1316('0x2c')](_0x36900b);}};}function respondWithFilteredResult(_0x5c3123,_0x226f7b){return function(_0x245b7e){if(_0x245b7e){var _0x434920=typeof _0x226f7b[_0x1316('0x2d')]===_0x1316('0x2e')&&typeof _0x226f7b[_0x1316('0x2f')]==='undefined';var _0x57c15b=_0x245b7e[_0x1316('0x30')];var _0x1f0b5f=_0x434920?0x0:_0x226f7b['offset'];var _0xafcb14=_0x434920?_0x245b7e[_0x1316('0x30')]:_0x226f7b['offset']+_0x226f7b[_0x1316('0x2f')];var _0x4b4cbc;if(_0xafcb14>=_0x57c15b){_0xafcb14=_0x57c15b;_0x4b4cbc=0xc8;}else{_0x4b4cbc=0xce;}_0x5c3123['status'](_0x4b4cbc);return _0x5c3123['set'](_0x1316('0x31'),_0x1f0b5f+'-'+_0xafcb14+'/'+_0x57c15b)[_0x1316('0x2c')](_0x245b7e);}return null;};}function patchUpdates(_0x6dc64b){return function(_0x56bd16){try{jsonpatch[_0x1316('0x32')](_0x56bd16,_0x6dc64b,!![]);}catch(_0x4ea48e){return BPromise[_0x1316('0x33')](_0x4ea48e);}return _0x56bd16[_0x1316('0x34')]();};}function saveUpdates(_0x1e862a,_0x5db287){return function(_0x44a83c){if(_0x44a83c){return _0x44a83c[_0x1316('0x35')](_0x1e862a)[_0x1316('0x21')](function(_0x543164){return _0x543164;});}return null;};}function removeEntity(_0x4c6777,_0x1a7358){return function(_0x107c02){if(_0x107c02){return _0x107c02['destroy']()[_0x1316('0x21')](function(){_0x4c6777[_0x1316('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x140fe6,_0x49fe4d){return function(_0x23e398){if(!_0x23e398){_0x140fe6[_0x1316('0x36')](0x194);}return _0x23e398;};}function handleError(_0x25cf9b,_0x24405d){_0x24405d=_0x24405d||0x1f4;return function(_0x24512d){logger['error'](_0x24512d[_0x1316('0x37')]);if(_0x24512d[_0x1316('0x38')]){delete _0x24512d['name'];}_0x25cf9b[_0x1316('0x2b')](_0x24405d)[_0x1316('0x39')](_0x24512d);};}exports[_0x1316('0x3a')]=function(_0x4eb2db,_0x5f226e){var _0xfabec2={},_0x393a98={},_0x524c5f={'count':0x0,'rows':[]};var _0x304794=_['map'](db[_0x1316('0x3b')][_0x1316('0x3c')],function(_0x3acd84){return{'name':_0x3acd84['fieldName'],'type':_0x3acd84['type']['key']};});_0x393a98[_0x1316('0x3d')]=_[_0x1316('0x3e')](_0x304794,'name');_0x393a98['query']=_[_0x1316('0x3f')](_0x4eb2db[_0x1316('0x40')]);_0x393a98[_0x1316('0x41')]=_[_0x1316('0x42')](_0x393a98[_0x1316('0x3d')],_0x393a98[_0x1316('0x40')]);_0xfabec2[_0x1316('0x43')]=_[_0x1316('0x42')](_0x393a98[_0x1316('0x3d')],qs[_0x1316('0x44')](_0x4eb2db[_0x1316('0x40')][_0x1316('0x44')]));_0xfabec2[_0x1316('0x43')]=_0xfabec2[_0x1316('0x43')][_0x1316('0x45')]?_0xfabec2[_0x1316('0x43')]:_0x393a98[_0x1316('0x3d')];if(!_0x4eb2db[_0x1316('0x40')][_0x1316('0x46')](_0x1316('0x47'))){_0xfabec2[_0x1316('0x2f')]=qs['limit'](_0x4eb2db[_0x1316('0x40')]['limit']);_0xfabec2[_0x1316('0x2d')]=qs['offset'](_0x4eb2db[_0x1316('0x40')]['offset']);}_0xfabec2[_0x1316('0x48')]=qs['sort'](_0x4eb2db[_0x1316('0x40')]['sort']);_0xfabec2[_0x1316('0x49')]=qs[_0x1316('0x41')](_[_0x1316('0x4a')](_0x4eb2db[_0x1316('0x40')],_0x393a98[_0x1316('0x41')]),_0x304794);if(_0x4eb2db[_0x1316('0x40')][_0x1316('0x4b')]){_0xfabec2['where']=_[_0x1316('0x4c')](_0xfabec2[_0x1316('0x49')],{'$or':_[_0x1316('0x3e')](_0x304794,function(_0x359644){if(_0x359644[_0x1316('0x4d')]!==_0x1316('0x4e')){var _0x59f45f={};_0x59f45f[_0x359644[_0x1316('0x38')]]={'$like':'%'+_0x4eb2db[_0x1316('0x40')][_0x1316('0x4b')]+'%'};return _0x59f45f;}})});}_0xfabec2=_[_0x1316('0x4c')]({},_0xfabec2,_0x4eb2db[_0x1316('0x4f')]);var _0x3d5608={'where':_0xfabec2['where']};return db[_0x1316('0x3b')][_0x1316('0x30')](_0x3d5608)[_0x1316('0x21')](function(_0x3aaff3){_0x524c5f['count']=_0x3aaff3;if(_0x4eb2db[_0x1316('0x40')][_0x1316('0x50')]){_0xfabec2[_0x1316('0x51')]=[{'all':!![]}];}return db[_0x1316('0x3b')][_0x1316('0x52')](_0xfabec2);})[_0x1316('0x21')](function(_0x5c5ee7){_0x524c5f[_0x1316('0x53')]=_0x5c5ee7;return _0x524c5f;})[_0x1316('0x21')](respondWithFilteredResult(_0x5f226e,_0xfabec2))[_0x1316('0x29')](handleError(_0x5f226e,null));};exports[_0x1316('0x54')]=function(_0x33736c,_0x46ba64){var _0x4b5ebf={'raw':!![],'where':{'id':_0x33736c[_0x1316('0x55')]['id']}},_0x2baa0e={};_0x2baa0e['model']=_[_0x1316('0x3f')](db[_0x1316('0x3b')]['rawAttributes']);_0x2baa0e[_0x1316('0x40')]=_[_0x1316('0x3f')](_0x33736c[_0x1316('0x40')]);_0x2baa0e['filters']=_[_0x1316('0x42')](_0x2baa0e['model'],_0x2baa0e[_0x1316('0x40')]);_0x4b5ebf[_0x1316('0x43')]=_[_0x1316('0x42')](_0x2baa0e['model'],qs[_0x1316('0x44')](_0x33736c[_0x1316('0x40')][_0x1316('0x44')]));_0x4b5ebf[_0x1316('0x43')]=_0x4b5ebf['attributes'][_0x1316('0x45')]?_0x4b5ebf[_0x1316('0x43')]:_0x2baa0e['model'];if(_0x33736c[_0x1316('0x40')]['includeAll']){_0x4b5ebf['include']=[{'all':!![]}];}_0x4b5ebf=_[_0x1316('0x4c')]({},_0x4b5ebf,_0x33736c['options']);return db['OpenchannelMessage'][_0x1316('0x56')](_0x4b5ebf)[_0x1316('0x21')](handleEntityNotFound(_0x46ba64,null))['then'](respondWithResult(_0x46ba64,null))[_0x1316('0x29')](handleError(_0x46ba64,null));};exports[_0x1316('0x57')]=function(_0x4b9629,_0x2b9a1e){return db[_0x1316('0x3b')][_0x1316('0x57')](_0x4b9629[_0x1316('0x58')],{})[_0x1316('0x21')](respondWithResult(_0x2b9a1e,0xc9))['catch'](handleError(_0x2b9a1e,null));};exports['update']=function(_0x1e1ab6,_0x46d985){if(_0x1e1ab6[_0x1316('0x58')]['id']){delete _0x1e1ab6[_0x1316('0x58')]['id'];}return db[_0x1316('0x3b')][_0x1316('0x56')]({'where':{'id':_0x1e1ab6[_0x1316('0x55')]['id']}})[_0x1316('0x21')](handleEntityNotFound(_0x46d985,null))[_0x1316('0x21')](saveUpdates(_0x1e1ab6[_0x1316('0x58')],null))[_0x1316('0x21')](respondWithResult(_0x46d985,null))[_0x1316('0x29')](handleError(_0x46d985,null));};exports[_0x1316('0x59')]=function(_0x336c5d,_0x5bb725){return db['OpenchannelMessage'][_0x1316('0x56')]({'where':{'id':_0x336c5d[_0x1316('0x55')]['id']}})[_0x1316('0x21')](handleEntityNotFound(_0x5bb725,null))[_0x1316('0x21')](removeEntity(_0x5bb725,null))['catch'](handleError(_0x5bb725,null));};exports[_0x1316('0x5a')]=function(_0x2c8a95,_0x167626){return db[_0x1316('0x3b')][_0x1316('0x5a')]()[_0x1316('0x21')](respondWithResult(_0x167626,null))[_0x1316('0x29')](handleError(_0x167626,null));};var interaction_log=require(_0x1316('0x15'))(_0x1316('0x5b'));exports['accept']=function(_0x557d34,_0x9fc6f5,_0x1ae1f7){var _0x5deb26={'agent':{},'channel':'openchannel'};if(_0x557d34[_0x1316('0x58')]['id']){delete _0x557d34[_0x1316('0x58')]['id'];}_0x557d34[_0x1316('0x58')][_0x1316('0x5c')]=!![];_0x557d34[_0x1316('0x58')][_0x1316('0x5d')]=moment()[_0x1316('0x5e')](_0x1316('0x5f'));_0x557d34['body']['UserId']=_0x557d34[_0x1316('0x58')][_0x1316('0x60')]||_0x557d34[_0x1316('0x61')]['id'];_0x5deb26[_0x1316('0x62')]['id']=_0x557d34['body']['UserId'];return db[_0x1316('0x3b')][_0x1316('0x56')]({'where':{'id':_0x557d34['params']['id'],'UserId':null}})[_0x1316('0x21')](handleEntityNotFound(_0x9fc6f5,null))[_0x1316('0x21')](saveUpdates(_0x557d34[_0x1316('0x58')],null))[_0x1316('0x21')](function(_0x24443f){if(_0x24443f){_0x5deb26['message']=_0x24443f[_0x1316('0x63')]({'plain':!![]});return db[_0x1316('0x64')][_0x1316('0x56')]({'where':{'id':_0x24443f[_0x1316('0x65')]}});}return null;})[_0x1316('0x21')](handleEntityNotFound(_0x9fc6f5,null))['then'](function(_0x1b1511){if(_0x1b1511){return _0x1b1511[_0x1316('0x35')]({'UserId':_0x557d34[_0x1316('0x58')][_0x1316('0x60')],'read1stAt':_[_0x1316('0x66')](_0x1b1511[_0x1316('0x67')])?moment()[_0x1316('0x5e')](_0x1316('0x5f')):undefined});}return null;})['then'](function(_0x19a249){if(_0x19a249){_0x5deb26[_0x1316('0x68')]=_0x19a249[_0x1316('0x63')]({'plain':!![]});interaction_log['info'](_0x1316('0x69'),_0x557d34[_0x1316('0x61')]['id'],_0x557d34[_0x1316('0x61')]['name'],_0x557d34[_0x1316('0x61')][_0x1316('0x6a')],_0x5deb26[_0x1316('0x68')]['id'],_0x557d34['body']?JSON[_0x1316('0x6b')](_0x557d34[_0x1316('0x58')]):_0x1316('0x6c'));return respondWithRpcPromise(_0x1316('0x6d'),_0x1316('0x6e'),_0x5deb26);}return null;})[_0x1316('0x21')](function(_0x531ea5){var _0x475d01=_0x1316('0x6f')+_0x531ea5[_0x1316('0x28')][_0x1316('0x70')];return db[_0x1316('0x71')][_0x1316('0x40')](_0x475d01,{'type':db['Sequelize'][_0x1316('0x72')][_0x1316('0x73')],'raw':!![]})[_0x1316('0x21')](function(_0x3678ce){return _0x3678ce;});})[_0x1316('0x21')](function(_0x3452b4){if(_0x3452b4){_0x5deb26[_0x1316('0x28')][_0x1316('0x74')]=_0x3452b4[0x0];if(!_0x557d34[_0x1316('0x58')][_0x1316('0x60')])return;return db['User'][_0x1316('0x56')]({'where':{'id':_0x557d34[_0x1316('0x58')][_0x1316('0x60')],'role':_0x1316('0x62')},'attributes':['id',_0x1316('0x38'),_0x1316('0x75'),_0x1316('0x76'),_0x1316('0x77')],'raw':!![]});}return null;})[_0x1316('0x21')](function(_0x579ecd){if(!_0x579ecd)return null;_0x5deb26[_0x1316('0x28')][_0x1316('0x62')]=_0x579ecd;return _0x5deb26;})[_0x1316('0x21')](function(_0x12c354){if(_0x12c354){if(_0x557d34[_0x1316('0x58')]['manual']){_0x5deb26[_0x1316('0x28')][_0x1316('0x78')]=util[_0x1316('0x5e')](_0x1316('0x79'),_0x557d34[_0x1316('0x61')][_0x1316('0x38')]);_0x5deb26[_0x1316('0x28')][_0x1316('0x7a')]=_0x5deb26[_0x1316('0x7a')];_0x5deb26[_0x1316('0x28')][_0x1316('0x7b')]=_0x5deb26[_0x1316('0x7a')];_0x5deb26[_0x1316('0x28')][_0x1316('0x7c')]=_0x1316('0x7d');return respondWithRpcPromise(_0x1316('0x7e'),'EventManager',{'event':_0x1316('0x7f'),'message':_0x5deb26['message']},client9002)[_0x1316('0x21')](function(){return _0x5deb26;});}return _0x5deb26;}return null;})[_0x1316('0x21')](respondWithResult(_0x9fc6f5,null))['catch'](handleError(_0x9fc6f5,null));};var interaction_log=require(_0x1316('0x15'))('openchannel-interactions');exports[_0x1316('0x33')]=function(_0x2bfe69,_0x1f8c1b,_0x27d09e){var _0x161210={'agent':{},'channel':_0x1316('0x80')};if(_0x2bfe69[_0x1316('0x58')]['id']){delete _0x2bfe69[_0x1316('0x58')]['id'];}_0x2bfe69[_0x1316('0x58')][_0x1316('0x60')]=_0x2bfe69['body'][_0x1316('0x60')]||_0x2bfe69['user']['id'];_0x161210['agent']['id']=_0x2bfe69[_0x1316('0x58')][_0x1316('0x60')];return db[_0x1316('0x3b')][_0x1316('0x56')]({'where':{'id':_0x2bfe69['params']['id'],'UserId':null}})[_0x1316('0x21')](handleEntityNotFound(_0x1f8c1b,null))[_0x1316('0x21')](function(_0x5d7b14){if(_0x5d7b14){_0x161210[_0x1316('0x28')]=_0x5d7b14[_0x1316('0x63')]({'plain':!![]});return db[_0x1316('0x64')]['find']({'where':{'id':_0x5d7b14[_0x1316('0x65')]}});}return null;})[_0x1316('0x21')](handleEntityNotFound(_0x1f8c1b,null))['then'](function(_0x46002e){if(_0x46002e){_0x161210[_0x1316('0x68')]=_0x46002e[_0x1316('0x63')]({'plain':!![]});interaction_log[_0x1316('0x22')](_0x1316('0x81'),_0x2bfe69[_0x1316('0x61')]['id'],_0x2bfe69[_0x1316('0x61')][_0x1316('0x38')],_0x2bfe69[_0x1316('0x61')][_0x1316('0x6a')],_0x161210[_0x1316('0x68')]['id'],_0x2bfe69['body']?JSON[_0x1316('0x6b')](_0x2bfe69[_0x1316('0x58')]):_0x1316('0x6c'));return respondWithRpcPromise(_0x1316('0x82'),_0x1316('0x83'),_0x161210);}return null;})[_0x1316('0x21')](function(_0x311071){var _0x366a55=_0x1316('0x6f')+_0x311071[_0x1316('0x28')]['ContactId'];return db[_0x1316('0x71')][_0x1316('0x40')](_0x366a55,{'type':db[_0x1316('0x84')][_0x1316('0x72')][_0x1316('0x73')],'raw':!![]})['then'](function(_0x2e9d2a){return _0x2e9d2a;});})['then'](function(_0x54c423){if(_0x54c423){_0x161210[_0x1316('0x28')][_0x1316('0x74')]=_0x54c423[0x0];if(!_0x2bfe69['body']['UserId'])return;return db[_0x1316('0x85')][_0x1316('0x56')]({'where':{'id':_0x2bfe69[_0x1316('0x58')][_0x1316('0x60')],'role':_0x1316('0x62')},'attributes':['id',_0x1316('0x38'),'fullname','email',_0x1316('0x77')],'raw':!![]});}return null;})[_0x1316('0x21')](function(_0x1c4bad){if(!_0x1c4bad)return null;_0x161210[_0x1316('0x28')][_0x1316('0x62')]=_0x1c4bad;return _0x161210;})['then'](function(_0x375f5b){if(_0x375f5b){_0x375f5b[_0x1316('0x28')][_0x1316('0x78')]=util[_0x1316('0x5e')](_0x1316('0x79'),_0x2bfe69[_0x1316('0x61')][_0x1316('0x38')]);_0x375f5b[_0x1316('0x28')][_0x1316('0x7a')]=_0x161210[_0x1316('0x7a')];_0x375f5b[_0x1316('0x28')][_0x1316('0x7b')]=_0x161210[_0x1316('0x7a')];_0x375f5b['message'][_0x1316('0x7c')]=_0x1316('0x33');respondWithRpcPromise('EventManager',_0x1316('0x7e'),{'event':_0x1316('0x86'),'message':_0x375f5b[_0x1316('0x28')]},client9002);return _0x161210;}return null;})[_0x1316('0x21')](respondWithResult(_0x1f8c1b,null))['catch'](handleError(_0x1f8c1b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7f9b91b..3e38076 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 _0x2362=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x2e8c3a,_0x56ab17){var _0x4d7311=function(_0x12e45d){while(--_0x12e45d){_0x2e8c3a['push'](_0x2e8c3a['shift']());}};_0x4d7311(++_0x56ab17);}(_0x2362,0x1e7));var _0x2236=function(_0x4a9a80,_0x4069cf){_0x4a9a80=_0x4a9a80-0x0;var _0x53affa=_0x2362[_0x4a9a80];return _0x53affa;};'use strict';var EventEmitter=require(_0x2236('0x0'));var OpenchannelMessage=require(_0x2236('0x1'))['db'][_0x2236('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2236('0x3')](0x0);var events={'afterCreate':_0x2236('0x4'),'afterUpdate':_0x2236('0x5'),'afterDestroy':_0x2236('0x6')};function emitEvent(_0x2413b2){return function(_0x2fde78,_0x4b150f,_0x2648e3){OpenchannelMessageEvents[_0x2236('0x7')](_0x2413b2+':'+_0x2fde78['id'],_0x2fde78);OpenchannelMessageEvents[_0x2236('0x7')](_0x2413b2,_0x2fde78);_0x2648e3(null);};}for(var e in events){if(events[_0x2236('0x8')](e)){var event=events[e];OpenchannelMessage[_0x2236('0x9')](e,emitEvent(event));}}module[_0x2236('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x01b0=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x31c687,_0x534832){var _0x227684=function(_0x22cd0c){while(--_0x22cd0c){_0x31c687['push'](_0x31c687['shift']());}};_0x227684(++_0x534832);}(_0x01b0,0x91));var _0x001b=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x01b0[_0x45518f];return _0x198175;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x001b('0x0'))['db'][_0x001b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x001b('0x2')](0x0);var events={'afterCreate':_0x001b('0x3'),'afterUpdate':_0x001b('0x4'),'afterDestroy':_0x001b('0x5')};function emitEvent(_0x494db8){return function(_0x38bc46,_0x2859fa,_0x4a4287){OpenchannelMessageEvents[_0x001b('0x6')](_0x494db8+':'+_0x38bc46['id'],_0x38bc46);OpenchannelMessageEvents['emit'](_0x494db8,_0x38bc46);_0x4a4287(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x001b('0x7')](e,emitEvent(event));}}module[_0x001b('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6aad8c8..a2ed6ce 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 _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x2eb7ec,_0x2dddb1){var _0x5016a9=function(_0x113c00){while(--_0x113c00){_0x2eb7ec['push'](_0x2eb7ec['shift']());}};_0x5016a9(++_0x2dddb1);}(_0x1a85,0x178));var _0x51a8=function(_0x385b70,_0x52974f){_0x385b70=_0x385b70-0x0;var _0x33e2ef=_0x1a85[_0x385b70];return _0x33e2ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file +var _0x7916=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','method','GET','POST','body','threadId','error','afterCreate','inspect','finally'];(function(_0xbb1b4a,_0x31eaab){var _0x13292e=function(_0x38e08b){while(--_0x38e08b){_0xbb1b4a['push'](_0xbb1b4a['shift']());}};_0x13292e(++_0x31eaab);}(_0x7916,0x128));var _0x6791=function(_0x4ab378,_0xd66244){_0x4ab378=_0x4ab378-0x0;var _0x589ca4=_0x7916[_0x4ab378];return _0x589ca4;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6791('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a9915,_0x198a64,_0x579950){var _0xbc3bc6=_0x3ca328[_0x6791('0xa')];var _0x2aeae9=_0x2a9915['get']({'plain':!![]});if(_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()==='in'||_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()===_0x6791('0xd')&&!_0x2aeae9[_0x6791('0xe')]&&!_[_0x6791('0xf')](_0x2aeae9[_0x6791('0x10')])){_0xbc3bc6[_0x6791('0x11')][_0x6791('0x12')]({'where':{'id':_0x2aeae9[_0x6791('0x13')]}})['then'](function(_0x4b1719){if(_0x4b1719){_0x4b1719[_0x6791('0x14')]({'lastMsgAt':_0x2aeae9['createdAt'],'lastMsgDirection':_0x2aeae9[_0x6791('0xb')]['toLowerCase']()});}})[_0x6791('0x15')](function(_0x163898){console['error'](_0x163898);});}if(_0x2aeae9[_0x6791('0xb')]==='out'&&!_0x2aeae9[_0x6791('0xe')]){var _0x150d1f;_0xbc3bc6['CmContact'][_0x6791('0x16')]()[_0x6791('0x17')](function(_0x5bec14){return _0xbc3bc6[_0x6791('0x18')]['find']({'where':{'id':_0x2aeae9[_0x6791('0x19')]},'include':[{'model':_0xbc3bc6[_0x6791('0x11')],'as':_0x6791('0x1a'),'where':{'id':_0x2aeae9[_0x6791('0x13')]},'limit':0x1,'include':[{'model':_0xbc3bc6[_0x6791('0x1b')],'as':_0x6791('0x1c'),'attributes':_[_0x6791('0x1d')](_0x5bec14)}]}]});})['then'](function(_0x4a2922){_0x150d1f=_0x4a2922[_0x6791('0x1e')]({'plain':!![]});if(_0x150d1f&&_0x150d1f['replyUri']){logger[_0x6791('0x1f')](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')](_0x6791('0x22'),_0x2aeae9['id'],_0x150d1f[_0x6791('0x23')]));if(_0x150d1f[_0x6791('0x1a')]&&_0x150d1f['Interactions'][_0x6791('0x24')]){_0x2aeae9[_0x6791('0x25')]=_['omit'](_0x150d1f['Interactions'][0x0],'Contact');_0x2aeae9[_0x6791('0x1c')]=_0x150d1f['Interactions'][0x0][_0x6791('0x1c')];}var _0x198a64={'method':'POST','uri':encodeURI(_0x150d1f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x198a64[_0x6791('0x26')]){case _0x6791('0x27'):_0x198a64['qs']=_0x2aeae9;break;case _0x6791('0x28'):_0x198a64['body']=_0x2aeae9;break;}return rp(_0x198a64)[_0x6791('0x17')](function(_0x30cc17){logger['info'](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2aeae9['id'],_0x150d1f['replyUri']));if(_0x30cc17[_0x6791('0x29')]['threadId']&&_0x30cc17[_0x6791('0x29')][_0x6791('0x2a')]!=_0x2aeae9['Interaction'][_0x6791('0x2a')]){return _0xbc3bc6[_0x6791('0x11')][_0x6791('0x14')]({'threadId':_0x30cc17[_0x6791('0x29')]['threadId']},{'logging':!![],'where':{'id':_0x2aeae9['Interaction']['id']}});}else{return;}})[_0x6791('0x17')](function(){return _0x2a9915['update']({'read':!![]});})[_0x6791('0x15')](function(_0x338d09){logger[_0x6791('0x2b')](_0x6791('0x20'),_0x6791('0x2c'),util[_0x6791('0x2d')](_0x338d09,{'showHidden':![],'depth':null}));_0x579950();});}else{_0x579950();}})[_0x6791('0x2e')](function(){_0x579950();});}else{_0x579950();}}},'charset':_0x6791('0x2f'),'collate':_0x6791('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ddde96d..52659b7 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x213a8d,_0x55fbcf){var _0x5ebce6=function(_0x3f8083){while(--_0x3f8083){_0x213a8d['push'](_0x213a8d['shift']());}};_0x5ebce6(++_0x55fbcf);}(_0xadb5,0xad));var _0x5adb=function(_0x296928,_0x31976c){_0x296928=_0x296928-0x0;var _0x4da592=_0xadb5[_0x296928];return _0x4da592;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x475b47,_0x162d2b){var _0x5cefc0=function(_0x414020){while(--_0x414020){_0x475b47['push'](_0x475b47['shift']());}};_0x5cefc0(++_0x162d2b);}(_0xadb5,0xad));var _0x5adb=function(_0x3e186a,_0x2fd71c){_0x3e186a=_0x3e186a-0x0;var _0x435a88=_0xadb5[_0x3e186a];return _0x435a88;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 059804e..c561ac1 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 _0x45b3=['remove','update','emit','length','openchannelMessage:','save'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x45b3,0x179));var _0x345b=function(_0xf0ee74,_0xa0720){_0xf0ee74=_0xf0ee74-0x0;var _0x4a3e6b=_0x45b3[_0xf0ee74];return _0x4a3e6b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x345b('0x0'),_0x345b('0x1'),_0x345b('0x2')];function createListener(_0x18a48d,_0x4766e7){return function(_0x380e6b){_0x4766e7[_0x345b('0x3')](_0x18a48d,_0x380e6b);};}function removeListener(_0x1958d3,_0x32f665){return function(){OpenchannelMessageEvents['removeListener'](_0x1958d3,_0x32f665);};}exports['register']=function(_0x1a19f5){for(var _0xf99195=0x0,_0x45755a=events[_0x345b('0x4')];_0xf99195<_0x45755a;_0xf99195++){var _0x1e3308=events[_0xf99195];var _0x3d95d5=createListener(_0x345b('0x5')+_0x1e3308,_0x1a19f5);OpenchannelMessageEvents['on'](_0x1e3308,_0x3d95d5);}}; \ No newline at end of file +var _0x3809=['remove','update','removeListener','register','length','openchannelMessage:','save'];(function(_0x4f918e,_0xcd500e){var _0x15ee0c=function(_0x1a2fb2){while(--_0x1a2fb2){_0x4f918e['push'](_0x4f918e['shift']());}};_0x15ee0c(++_0xcd500e);}(_0x3809,0xca));var _0x9380=function(_0xa44bc1,_0x2df53c){_0xa44bc1=_0xa44bc1-0x0;var _0x2ac98a=_0x3809[_0xa44bc1];return _0x2ac98a;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9380('0x0'),_0x9380('0x1'),_0x9380('0x2')];function createListener(_0x4b23a3,_0x395f70){return function(_0x192df8){_0x395f70['emit'](_0x4b23a3,_0x192df8);};}function removeListener(_0x543db6,_0x1b2648){return function(){OpenchannelMessageEvents[_0x9380('0x3')](_0x543db6,_0x1b2648);};}exports[_0x9380('0x4')]=function(_0x2466bd){for(var _0x26f7f7=0x0,_0x313608=events[_0x9380('0x5')];_0x26f7f7<_0x313608;_0x26f7f7++){var _0x434e35=events[_0x26f7f7];var _0x3ec24b=createListener(_0x9380('0x6')+_0x434e35,_0x2466bd);OpenchannelMessageEvents['on'](_0x434e35,_0x3ec24b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 23141f9..dea68e9 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 _0xc383=['getAgents','create','addTeams','post','addAgents','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4e2a84,_0x5b69a8){var _0x1ab18a=function(_0x4bb756){while(--_0x4bb756){_0x4e2a84['push'](_0x4e2a84['shift']());}};_0x1ab18a(++_0x5b69a8);}(_0xc383,0x136));var _0x3c38=function(_0x37f2a1,_0x4a98c5){_0x37f2a1=_0x37f2a1-0x0;var _0x387ae8=_0xc383[_0x37f2a1];return _0x387ae8;};'use strict';var multer=require(_0x3c38('0x0'));var util=require(_0x3c38('0x1'));var path=require(_0x3c38('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c38('0x3'));var router=express['Router']();var fs_extra=require(_0x3c38('0x4'));var auth=require(_0x3c38('0x5'));var interaction=require(_0x3c38('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x3c38('0x7')]('/',auth[_0x3c38('0x8')](),controller[_0x3c38('0x9')]);router['get']('/describe',auth[_0x3c38('0x8')](),controller[_0x3c38('0xa')]);router[_0x3c38('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3c38('0x7')]('/:id/members',auth[_0x3c38('0x8')](),controller[_0x3c38('0xb')]);router['get'](_0x3c38('0xc'),auth['isAuthenticated'](),controller[_0x3c38('0xd')]);router['get'](_0x3c38('0xe'),auth[_0x3c38('0x8')](),controller[_0x3c38('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3c38('0x10')]);router['post'](_0x3c38('0xc'),auth['isAuthenticated'](),controller[_0x3c38('0x11')]);router[_0x3c38('0x12')](_0x3c38('0xe'),auth[_0x3c38('0x8')](),controller[_0x3c38('0x13')]);router[_0x3c38('0x14')](_0x3c38('0x15'),auth[_0x3c38('0x8')](),controller[_0x3c38('0x16')]);router[_0x3c38('0x17')](_0x3c38('0x15'),auth[_0x3c38('0x8')](),controller['destroy']);router[_0x3c38('0x17')](_0x3c38('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3c38('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x3c38('0x18')]=router; \ No newline at end of file +var _0x8ba1=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams'];(function(_0x5cf472,_0x5bca87){var _0x3af1b8=function(_0x42526b){while(--_0x42526b){_0x5cf472['push'](_0x5cf472['shift']());}};_0x3af1b8(++_0x5bca87);}(_0x8ba1,0x15d));var _0x18ba=function(_0x153f7f,_0x1487fd){_0x153f7f=_0x153f7f-0x0;var _0x1c8f41=_0x8ba1[_0x153f7f];return _0x1c8f41;};'use strict';var multer=require(_0x18ba('0x0'));var util=require('util');var path=require(_0x18ba('0x1'));var timeout=require(_0x18ba('0x2'));var express=require(_0x18ba('0x3'));var router=express[_0x18ba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18ba('0x5'));var interaction=require(_0x18ba('0x6'));var config=require(_0x18ba('0x7'));var controller=require(_0x18ba('0x8'));router[_0x18ba('0x9')]('/',auth[_0x18ba('0xa')](),controller[_0x18ba('0xb')]);router[_0x18ba('0x9')](_0x18ba('0xc'),auth[_0x18ba('0xa')](),controller[_0x18ba('0xd')]);router[_0x18ba('0x9')](_0x18ba('0xe'),auth[_0x18ba('0xa')](),controller['show']);router[_0x18ba('0x9')](_0x18ba('0xf'),auth[_0x18ba('0xa')](),controller[_0x18ba('0x10')]);router[_0x18ba('0x9')]('/:id/teams',auth[_0x18ba('0xa')](),controller[_0x18ba('0x11')]);router[_0x18ba('0x9')](_0x18ba('0x12'),auth[_0x18ba('0xa')](),controller[_0x18ba('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x18ba('0x14')]);router['post'](_0x18ba('0x15'),auth[_0x18ba('0xa')](),controller[_0x18ba('0x16')]);router['post']('/:id/users',auth[_0x18ba('0xa')](),controller[_0x18ba('0x17')]);router[_0x18ba('0x18')](_0x18ba('0xe'),auth[_0x18ba('0xa')](),controller['update']);router[_0x18ba('0x19')](_0x18ba('0xe'),auth[_0x18ba('0xa')](),controller[_0x18ba('0x1a')]);router[_0x18ba('0x19')]('/:id/teams',auth[_0x18ba('0xa')](),controller[_0x18ba('0x1b')]);router[_0x18ba('0x19')](_0x18ba('0x12'),auth[_0x18ba('0xa')](),controller['removeAgents']);module[_0x18ba('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ec6dff9..7fe58f7 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 _0xbfb7=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x15ec03,_0x10baf9){var _0x2cf15c=function(_0x112c28){while(--_0x112c28){_0x15ec03['push'](_0x15ec03['shift']());}};_0x2cf15c(++_0x10baf9);}(_0xbfb7,0x188));var _0x7bfb=function(_0x382602,_0x5e9d2d){_0x382602=_0x382602-0x0;var _0x14dda6=_0xbfb7[_0x382602];return _0x14dda6;};'use strict';var Sequelize=require(_0x7bfb('0x0'));module[_0x7bfb('0x1')]={'name':{'type':Sequelize[_0x7bfb('0x2')],'unique':_0x7bfb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7bfb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7bfb('0x5')](_0x7bfb('0x6'),'beepall',_0x7bfb('0x7'))}}; \ No newline at end of file +var _0x947c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x230469,_0x187146){var _0x19aa05=function(_0x32195a){while(--_0x32195a){_0x230469['push'](_0x230469['shift']());}};_0x19aa05(++_0x187146);}(_0x947c,0x70));var _0xc947=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x947c[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xc947('0x0'));module[_0xc947('0x1')]={'name':{'type':Sequelize[_0xc947('0x2')],'unique':_0xc947('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc947('0x2')]},'timeout':{'type':Sequelize[_0xc947('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc947('0x5')](_0xc947('0x6'),_0xc947('0x7'),_0xc947('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 023d724..8e5897e 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 _0x752b=['rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','options','includeAll','include','rows','show','keys','length','find','catch','user','role','OpenchannelQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','OpenchannelQueue'];(function(_0x1654f5,_0x5e1214){var _0x37cd7d=function(_0x9d544e){while(--_0x9d544e){_0x1654f5['push'](_0x1654f5['shift']());}};_0x37cd7d(++_0x5e1214);}(_0x752b,0x1f3));var _0xb752=function(_0x3ea427,_0x5cb3b3){_0x3ea427=_0x3ea427-0x0;var _0x1317f6=_0x752b[_0x3ea427];return _0x1317f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb752('0x0'));var zipdir=require(_0xb752('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb752('0x2'));var moment=require('moment');var BPromise=require(_0xb752('0x3'));var Mustache=require(_0xb752('0x4'));var util=require(_0xb752('0x5'));var path=require('path');var sox=require(_0xb752('0x6'));var csv=require(_0xb752('0x7'));var ejs=require(_0xb752('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb752('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb752('0xa'));var toCsv=require(_0xb752('0x7'));var querystring=require('querystring');var Papa=require(_0xb752('0xb'));var Redis=require(_0xb752('0xc'));var authService=require(_0xb752('0xd'));var qs=require(_0xb752('0xe'));var as=require(_0xb752('0xf'));var hardwareService=require(_0xb752('0x10'));var logger=require('../../config/logger')(_0xb752('0x11'));var utils=require(_0xb752('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb752('0x13'));var db=require(_0xb752('0x14'))['db'];config[_0xb752('0x15')]=_[_0xb752('0x16')](config['redis'],{'host':_0xb752('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb752('0x18'))[_0xb752('0x19')](socket);function respondWithStatusCode(_0x3d6058,_0x427328){_0x427328=_0x427328||0xcc;return function(_0x205496){if(_0x205496){return _0x3d6058['sendStatus'](_0x427328);}return _0x3d6058['status'](_0x427328)[_0xb752('0x1a')]();};}function respondWithResult(_0x776873,_0x52e0cd){_0x52e0cd=_0x52e0cd||0xc8;return function(_0x52dc21){if(_0x52dc21){return _0x776873[_0xb752('0x1b')](_0x52e0cd)['json'](_0x52dc21);}};}function respondWithFilteredResult(_0x8252ce,_0x1a50b7){return function(_0x4ca34e){if(_0x4ca34e){var _0x391d8e=typeof _0x1a50b7[_0xb752('0x1c')]==='undefined'&&typeof _0x1a50b7['limit']===_0xb752('0x1d');var _0x1d7232=_0x4ca34e[_0xb752('0x1e')];var _0x2b983f=_0x391d8e?0x0:_0x1a50b7[_0xb752('0x1c')];var _0x4df00a=_0x391d8e?_0x4ca34e[_0xb752('0x1e')]:_0x1a50b7[_0xb752('0x1c')]+_0x1a50b7[_0xb752('0x1f')];var _0x242f20;if(_0x4df00a>=_0x1d7232){_0x4df00a=_0x1d7232;_0x242f20=0xc8;}else{_0x242f20=0xce;}_0x8252ce['status'](_0x242f20);return _0x8252ce[_0xb752('0x20')](_0xb752('0x21'),_0x2b983f+'-'+_0x4df00a+'/'+_0x1d7232)[_0xb752('0x22')](_0x4ca34e);}return null;};}function patchUpdates(_0x774c54){return function(_0x2fd091){try{jsonpatch[_0xb752('0x23')](_0x2fd091,_0x774c54,!![]);}catch(_0x31d109){return BPromise[_0xb752('0x24')](_0x31d109);}return _0x2fd091[_0xb752('0x25')]();};}function saveUpdates(_0x393161,_0x3f9a60){return function(_0x6594ee){if(_0x6594ee){return _0x6594ee[_0xb752('0x26')](_0x393161)[_0xb752('0x27')](function(_0x2c64af){return _0x2c64af;});}return null;};}function removeEntity(_0x110e72,_0x3f2ace){return function(_0x357534){if(_0x357534){return _0x357534['destroy']()[_0xb752('0x27')](function(){var _0x225610=_0x357534[_0xb752('0x28')]({'plain':!![]});var _0x52ca27='OpenchannelQueues';return db[_0xb752('0x29')][_0xb752('0x2a')]({'where':{'type':_0x52ca27,'resourceId':_0x225610['id']}})[_0xb752('0x27')](function(){return _0x357534;});})[_0xb752('0x27')](function(){_0x110e72[_0xb752('0x1b')](0xcc)[_0xb752('0x1a')]();});}};}function handleEntityNotFound(_0x1c7341,_0x1a55f0){return function(_0x4656cd){if(!_0x4656cd){_0x1c7341['sendStatus'](0x194);}return _0x4656cd;};}function handleError(_0x218243,_0x5488f1){_0x5488f1=_0x5488f1||0x1f4;return function(_0xb9b8e0){logger[_0xb752('0x2b')](_0xb9b8e0['stack']);if(_0xb9b8e0[_0xb752('0x2c')]){delete _0xb9b8e0[_0xb752('0x2c')];}_0x218243[_0xb752('0x1b')](_0x5488f1)[_0xb752('0x2d')](_0xb9b8e0);};}exports[_0xb752('0x2e')]=function(_0x3cd7aa,_0x3c42ef){var _0x4aa8ed={},_0x48d2fc={},_0x12dab6={'count':0x0,'rows':[]};var _0x59f8c8=_[_0xb752('0x2f')](db[_0xb752('0x30')][_0xb752('0x31')],function(_0x1f1d2b){return{'name':_0x1f1d2b[_0xb752('0x32')],'type':_0x1f1d2b['type'][_0xb752('0x33')]};});_0x48d2fc[_0xb752('0x34')]=_[_0xb752('0x2f')](_0x59f8c8,'name');_0x48d2fc[_0xb752('0x35')]=_['keys'](_0x3cd7aa['query']);_0x48d2fc[_0xb752('0x36')]=_[_0xb752('0x37')](_0x48d2fc[_0xb752('0x34')],_0x48d2fc['query']);_0x4aa8ed['attributes']=_[_0xb752('0x37')](_0x48d2fc[_0xb752('0x34')],qs['fields'](_0x3cd7aa['query'][_0xb752('0x38')]));_0x4aa8ed['attributes']=_0x4aa8ed[_0xb752('0x39')]['length']?_0x4aa8ed[_0xb752('0x39')]:_0x48d2fc['model'];if(!_0x3cd7aa['query'][_0xb752('0x3a')](_0xb752('0x3b'))){_0x4aa8ed[_0xb752('0x1f')]=qs[_0xb752('0x1f')](_0x3cd7aa['query'][_0xb752('0x1f')]);_0x4aa8ed[_0xb752('0x1c')]=qs['offset'](_0x3cd7aa[_0xb752('0x35')][_0xb752('0x1c')]);}_0x4aa8ed[_0xb752('0x3c')]=qs[_0xb752('0x3d')](_0x3cd7aa[_0xb752('0x35')]['sort']);_0x4aa8ed['where']=qs[_0xb752('0x36')](_[_0xb752('0x3e')](_0x3cd7aa[_0xb752('0x35')],_0x48d2fc['filters']),_0x59f8c8);if(_0x3cd7aa[_0xb752('0x35')][_0xb752('0x3f')]){_0x4aa8ed['where']=_[_0xb752('0x40')](_0x4aa8ed[_0xb752('0x41')],{'$or':_[_0xb752('0x2f')](_0x59f8c8,function(_0x58e37c){if(_0x58e37c[_0xb752('0x42')]!=='VIRTUAL'){var _0x49cb10={};_0x49cb10[_0x58e37c[_0xb752('0x2c')]]={'$like':'%'+_0x3cd7aa[_0xb752('0x35')][_0xb752('0x3f')]+'%'};return _0x49cb10;}})});}_0x4aa8ed=_[_0xb752('0x40')]({},_0x4aa8ed,_0x3cd7aa[_0xb752('0x43')]);var _0x3871ae={'where':_0x4aa8ed[_0xb752('0x41')]};return db['OpenchannelQueue'][_0xb752('0x1e')](_0x3871ae)[_0xb752('0x27')](function(_0x458570){_0x12dab6['count']=_0x458570;if(_0x3cd7aa[_0xb752('0x35')][_0xb752('0x44')]){_0x4aa8ed[_0xb752('0x45')]=[{'all':!![]}];}return db[_0xb752('0x30')]['findAll'](_0x4aa8ed);})['then'](function(_0x4fe132){_0x12dab6[_0xb752('0x46')]=_0x4fe132;return _0x12dab6;})['then'](respondWithFilteredResult(_0x3c42ef,_0x4aa8ed))['catch'](handleError(_0x3c42ef,null));};exports[_0xb752('0x47')]=function(_0x5904e5,_0x12701f){var _0x46f98d={'raw':!![],'where':{'id':_0x5904e5['params']['id']}},_0x471c03={};_0x471c03[_0xb752('0x34')]=_[_0xb752('0x48')](db[_0xb752('0x30')][_0xb752('0x31')]);_0x471c03[_0xb752('0x35')]=_[_0xb752('0x48')](_0x5904e5[_0xb752('0x35')]);_0x471c03['filters']=_[_0xb752('0x37')](_0x471c03[_0xb752('0x34')],_0x471c03['query']);_0x46f98d[_0xb752('0x39')]=_[_0xb752('0x37')](_0x471c03['model'],qs['fields'](_0x5904e5[_0xb752('0x35')][_0xb752('0x38')]));_0x46f98d[_0xb752('0x39')]=_0x46f98d['attributes'][_0xb752('0x49')]?_0x46f98d[_0xb752('0x39')]:_0x471c03['model'];if(_0x5904e5['query'][_0xb752('0x44')]){_0x46f98d[_0xb752('0x45')]=[{'all':!![]}];}_0x46f98d=_['merge']({},_0x46f98d,_0x5904e5[_0xb752('0x43')]);return db[_0xb752('0x30')][_0xb752('0x4a')](_0x46f98d)[_0xb752('0x27')](handleEntityNotFound(_0x12701f,null))[_0xb752('0x27')](respondWithResult(_0x12701f,null))[_0xb752('0x4b')](handleError(_0x12701f,null));};exports['create']=function(_0x1207d9,_0x1fe9fd){return db['OpenchannelQueue']['create'](_0x1207d9['body'],{})[_0xb752('0x27')](function(_0x516882){var _0x1673d8=_0x1207d9[_0xb752('0x4c')][_0xb752('0x28')]({'plain':!![]});if(!_0x1673d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1673d8[_0xb752('0x4d')]===_0xb752('0x4c')){var _0x2d3f78=_0x516882['get']({'plain':!![]});var _0x55ab73=_0xb752('0x4e');return db['UserProfileSection'][_0xb752('0x4a')]({'where':{'name':_0x55ab73,'userProfileId':_0x1673d8[_0xb752('0x4f')]},'raw':!![]})[_0xb752('0x27')](function(_0x297d8e){if(_0x297d8e&&_0x297d8e[_0xb752('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d3f78[_0xb752('0x2c')],'resourceId':_0x2d3f78['id'],'type':_0x297d8e['name'],'sectionId':_0x297d8e['id']},{})[_0xb752('0x27')](function(){return _0x516882;});}else{return _0x516882;}})['catch'](function(_0x36c7ef){logger[_0xb752('0x2b')](_0xb752('0x51'),_0x36c7ef);throw _0x36c7ef;});}return _0x516882;})[_0xb752('0x27')](respondWithResult(_0x1fe9fd,0xc9))[_0xb752('0x4b')](handleError(_0x1fe9fd,null));};exports['update']=function(_0x1afdfb,_0x27e942){if(_0x1afdfb['body']['id']){delete _0x1afdfb[_0xb752('0x52')]['id'];}return db[_0xb752('0x30')][_0xb752('0x4a')]({'where':{'id':_0x1afdfb['params']['id']}})[_0xb752('0x27')](handleEntityNotFound(_0x27e942,null))[_0xb752('0x27')](saveUpdates(_0x1afdfb[_0xb752('0x52')],null))[_0xb752('0x27')](respondWithResult(_0x27e942,null))[_0xb752('0x4b')](handleError(_0x27e942,null));};exports['destroy']=function(_0x198f4f,_0x225b97){return db[_0xb752('0x30')]['find']({'where':{'id':_0x198f4f[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0x225b97,null))[_0xb752('0x27')](removeEntity(_0x225b97,null))[_0xb752('0x4b')](handleError(_0x225b97,null));};exports[_0xb752('0x54')]=function(_0x246ae0,_0x33d008){return db[_0xb752('0x30')]['describe']()[_0xb752('0x27')](respondWithResult(_0x33d008,null))[_0xb752('0x4b')](handleError(_0x33d008,null));};exports[_0xb752('0x55')]=function(_0x362c65,_0x5ce2b3,_0x313dc5){var _0x83f2a9={'raw':!![],'where':{}},_0x33c205={},_0x3a495a;return db[_0xb752('0x30')][_0xb752('0x56')]({'where':{'id':_0x362c65[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0x5ce2b3,null))[_0xb752('0x27')](function(_0x23d3a5){if(_0x23d3a5){_0x3a495a=_0x23d3a5[_0xb752('0x28')]({'plain':!![]});_0x33c205['model']=_[_0xb752('0x48')](db['UserOpenchannelQueue'][_0xb752('0x31')]);_0x33c205['query']=_[_0xb752('0x48')](_0x362c65[_0xb752('0x35')]);_0x33c205['filters']=_[_0xb752('0x37')](_0x33c205[_0xb752('0x34')],_0x33c205[_0xb752('0x35')]);_0x83f2a9[_0xb752('0x39')]=_[_0xb752('0x37')](_0x33c205[_0xb752('0x34')],qs[_0xb752('0x38')](_0x362c65[_0xb752('0x35')][_0xb752('0x38')]));_0x83f2a9[_0xb752('0x39')]=_0x83f2a9[_0xb752('0x39')][_0xb752('0x49')]?_0x83f2a9[_0xb752('0x39')]:_0x33c205[_0xb752('0x34')];if(!_0x362c65[_0xb752('0x35')][_0xb752('0x3a')]('nolimit')){_0x83f2a9[_0xb752('0x1f')]=qs[_0xb752('0x1f')](_0x362c65[_0xb752('0x35')][_0xb752('0x1f')]);_0x83f2a9[_0xb752('0x1c')]=qs[_0xb752('0x1c')](_0x362c65[_0xb752('0x35')]['offset']);}_0x83f2a9[_0xb752('0x3c')]=qs[_0xb752('0x3d')](_0x362c65['query'][_0xb752('0x3d')]);_0x83f2a9[_0xb752('0x41')]=qs[_0xb752('0x36')](_[_0xb752('0x3e')](_0x362c65[_0xb752('0x35')],_0x33c205[_0xb752('0x36')]));_0x83f2a9['where'][_0xb752('0x57')]=_0x23d3a5['id'];if(_0x362c65[_0xb752('0x35')][_0xb752('0x3f')]){_0x83f2a9[_0xb752('0x41')]=_['merge'](_0x83f2a9['where'],{'$or':_[_0xb752('0x2f')](_0x83f2a9[_0xb752('0x39')],function(_0x1b1726){var _0x7a1cf0={};_0x7a1cf0[_0x1b1726]={'$like':'%'+_0x362c65[_0xb752('0x35')][_0xb752('0x3f')]+'%'};return _0x7a1cf0;})});}_0x83f2a9=_[_0xb752('0x40')]({},_0x83f2a9,_0x362c65['options']);return db[_0xb752('0x58')]['findAll'](_0x83f2a9);}})['then'](function(_0x179d91){if(_0x179d91){return db['User'][_0xb752('0x59')]({'where':{'id':_[_0xb752('0x2f')](_0x179d91,_0xb752('0x5a')),'role':_0xb752('0x5b')},'attributes':['id',_0xb752('0x2c'),_0xb752('0x5c'),_0xb752('0x5d'),_0xb752('0x5e')]});}})[_0xb752('0x27')](function(_0x242612){if(_0x242612){return{'count':_0x242612[_0xb752('0x1e')],'rows':_[_0xb752('0x2f')](_0x242612[_0xb752('0x46')],function(_0x2c0390){return{'membername':_0x2c0390[_0xb752('0x2c')],'UserId':_0x2c0390['id'],'queue_name':_0x3a495a[_0xb752('0x2c')],'OpenchannelQueueId':_0x3a495a['id'],'interface':util['format']('%s/%s',_0xb752('0x5f'),_0x2c0390['name']),'penalty':0x0,'paused':_0x2c0390[_0xb752('0x5c')],'createdAt':_0x2c0390[_0xb752('0x5e')],'updatedAt':_0x2c0390[_0xb752('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb752('0x27')](respondWithFilteredResult(_0x5ce2b3,_0x83f2a9))[_0xb752('0x4b')](handleError(_0x5ce2b3,null));};exports[_0xb752('0x60')]=function(_0x1aaae1,_0xa9582,_0x443a1d){var _0x5aa045={};var _0x513ac2={};var _0xa19a66;var _0xe62de8;return db[_0xb752('0x30')][_0xb752('0x56')]({'where':{'id':_0x1aaae1[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0xa9582,null))[_0xb752('0x27')](function(_0x11ce00){if(_0x11ce00){_0xa19a66=_0x11ce00;_0x513ac2[_0xb752('0x34')]=_[_0xb752('0x48')](db[_0xb752('0x61')]['rawAttributes']);_0x513ac2[_0xb752('0x35')]=_[_0xb752('0x48')](_0x1aaae1[_0xb752('0x35')]);_0x513ac2[_0xb752('0x36')]=_[_0xb752('0x37')](_0x513ac2[_0xb752('0x34')],_0x513ac2[_0xb752('0x35')]);_0x5aa045['attributes']=_[_0xb752('0x37')](_0x513ac2[_0xb752('0x34')],qs['fields'](_0x1aaae1[_0xb752('0x35')]['fields']));_0x5aa045[_0xb752('0x39')]=_0x5aa045['attributes'][_0xb752('0x49')]?_0x5aa045['attributes']:_0x513ac2[_0xb752('0x34')];_0x5aa045[_0xb752('0x3c')]=qs[_0xb752('0x3d')](_0x1aaae1[_0xb752('0x35')][_0xb752('0x3d')]);_0x5aa045[_0xb752('0x41')]=qs[_0xb752('0x36')](_[_0xb752('0x3e')](_0x1aaae1['query'],_0x513ac2[_0xb752('0x36')]));if(_0x1aaae1[_0xb752('0x35')]['filter']){_0x5aa045[_0xb752('0x41')]=_['merge'](_0x5aa045['where'],{'$or':_['map'](_0x5aa045[_0xb752('0x39')],function(_0x190277){var _0x5dcef7={};_0x5dcef7[_0x190277]={'$like':'%'+_0x1aaae1['query'][_0xb752('0x3f')]+'%'};return _0x5dcef7;})});}_0x5aa045=_['merge']({},_0x5aa045,_0x1aaae1[_0xb752('0x43')]);return _0xa19a66[_0xb752('0x60')](_0x5aa045);}})['then'](function(_0x1cb823){if(_0x1cb823){_0xe62de8=_0x1cb823[_0xb752('0x49')];if(!_0x1aaae1[_0xb752('0x35')][_0xb752('0x3a')](_0xb752('0x3b'))){_0x5aa045[_0xb752('0x1f')]=qs['limit'](_0x1aaae1[_0xb752('0x35')][_0xb752('0x1f')]);_0x5aa045['offset']=qs['offset'](_0x1aaae1[_0xb752('0x35')]['offset']);}return _0xa19a66[_0xb752('0x60')](_0x5aa045);}})[_0xb752('0x27')](function(_0x39c54d){if(_0x39c54d){return _0x39c54d?{'count':_0xe62de8,'rows':_0x39c54d}:null;}})[_0xb752('0x27')](respondWithResult(_0xa9582,null))['catch'](handleError(_0xa9582,null));};exports[_0xb752('0x62')]=function(_0x2c5a0c,_0x3b57de,_0x14c48c){var _0x3b7971=_0x2c5a0c[_0xb752('0x52')][_0xb752('0x63')];return db[_0xb752('0x61')][_0xb752('0x64')]({'where':{'id':_0x3b7971},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb752('0x65'),'attributes':['id',_0xb752('0x2c'),_0xb752('0x66'),_0xb752('0x67'),_0xb752('0x68')],'raw':!![]}]})[_0xb752('0x27')](function(_0x989379){if(_0x989379){var _0x186c3a=_[_0xb752('0x69')](_0x989379,function(_0x37d515){var _0xf98298=_0x37d515[_0xb752('0x28')]({'plain':!![]});return _0xf98298[_0xb752('0x65')];});return db['OpenchannelQueue'][_0xb752('0x4a')]({'where':{'id':_0x2c5a0c[_0xb752('0x53')]['id']}})[_0xb752('0x27')](function(_0x21b839){return db[_0xb752('0x6a')][_0xb752('0x6b')](function(_0xe5e907){return _0x21b839[_0xb752('0x62')](_0x3b7971,{'transaction':_0xe5e907})[_0xb752('0x27')](function(){return BPromise[_0xb752('0x6c')](_0x186c3a,function(_0x1749bc){return db['UserOpenchannelQueue'][_0xb752('0x6d')]({'where':{'UserId':_0x1749bc['id'],'OpenchannelQueueId':_0x2c5a0c['params']['id']},'transaction':_0xe5e907});});})[_0xb752('0x27')](function(){_0x186c3a[_0xb752('0x6e')](function(_0x3da950){socket[_0xb752('0x6f')](_0xb752('0x70'),{'UserId':_0x3da950['id'],'OpenchannelQueueId':_0x21b839['id']});});});});});}})['then'](respondWithStatusCode(_0x3b57de,null))[_0xb752('0x4b')](handleError(_0x3b57de,null));};exports[_0xb752('0x71')]=function(_0x27e77b,_0x28a065,_0x5043f8){return db[_0xb752('0x61')][_0xb752('0x64')]({'where':{'id':_0x27e77b['query'][_0xb752('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb752('0x65'),'attributes':['id'],'raw':!![]}]})[_0xb752('0x27')](handleEntityNotFound(_0x28a065,null))[_0xb752('0x27')](function(_0x2f612d){var _0x2aa000=_[_0xb752('0x2f')](_0x2f612d,'id');var _0x3ceb8d=[];var _0x4470ae=[];var _0x516741=squel[_0xb752('0x72')]();_0x516741[_0xb752('0x73')](_0xb752('0x74'))[_0xb752('0x75')]('team_has_openchannel_queues','tq')[_0xb752('0x76')](_0xb752('0x77'),'ut',_0xb752('0x78'))['where'](_0xb752('0x79'),_0x27e77b[_0xb752('0x53')]['id']);for(var _0x2b14f4=0x0;_0x2b14f4<_0x2f612d[_0xb752('0x49')];_0x2b14f4+=0x1){let _0x5e6792=_0x2f612d[_0x2b14f4];for(var _0x183628=0x0;_0x183628<_0x5e6792[_0xb752('0x65')][_0xb752('0x49')];_0x183628+=0x1){let _0x511da5=_0x5e6792['Agents'][_0x183628];var _0x2fab41=_0x516741['clone']();_0x2fab41[_0xb752('0x41')](_0xb752('0x7a'),_0x511da5['id']);_0x4470ae[_0xb752('0x7b')](db[_0xb752('0x6a')][_0xb752('0x35')](_0x2fab41[_0xb752('0x7c')](),{'type':db[_0xb752('0x6a')][_0xb752('0x7d')][_0xb752('0x7e')]})[_0xb752('0x27')](function(_0x776050){if(_0x776050[_0xb752('0x49')]===0x1){return _0x511da5['id'];}else{var _0x22ce13=_[_0xb752('0x7f')](_[_0xb752('0x2f')](_0x776050,'TeamId'),function(_0x532868){return _[_0xb752('0x80')](_0x2aa000,_0x532868);});if(_0x22ce13){return _0x511da5['id'];}}}));}}return BPromise['all'](_0x4470ae)[_0xb752('0x27')](function(_0x4d4c85){_0x3ceb8d=_(_0x3ceb8d)['union'](_0x4d4c85)['compact']()[_0xb752('0x81')]();return db[_0xb752('0x30')][_0xb752('0x4a')]({'where':{'id':_0x27e77b[_0xb752('0x53')]['id']}})[_0xb752('0x27')](function(_0x128474){return db[_0xb752('0x6a')][_0xb752('0x6b')](function(_0x447218){return _0x128474[_0xb752('0x71')](_0x27e77b[_0xb752('0x35')][_0xb752('0x63')],{'transaction':_0x447218})['then'](function(){if(!_[_0xb752('0x82')](_0x3ceb8d)){return _0x128474['removeAgents'](_0x3ceb8d,{'transaction':_0x447218});}})[_0xb752('0x27')](function(){_0x3ceb8d[_0xb752('0x6e')](function(_0x261ac1){socket[_0xb752('0x6f')](_0xb752('0x83'),{'UserId':_0x261ac1,'OpenchannelQueueId':_0x128474['id']});});});});});});})['then'](respondWithStatusCode(_0x28a065,null))[_0xb752('0x4b')](handleError(_0x28a065,null));};exports[_0xb752('0x84')]=function(_0x2d917f,_0x4510fa,_0x5d60ef){return db['OpenchannelQueue'][_0xb752('0x4a')]({'where':{'id':_0x2d917f[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0x4510fa,null))[_0xb752('0x27')](function(_0x397d07){if(_0x397d07){return _0x397d07[_0xb752('0x84')](_0x2d917f[_0xb752('0x52')][_0xb752('0x63')],_[_0xb752('0x85')](_0x2d917f[_0xb752('0x52')],['ids','id'])||{})['spread'](function(_0x58fabf){for(var _0x224691=0x0;_0x224691<_0x2d917f[_0xb752('0x52')]['ids']['length'];_0x224691+=0x1){socket[_0xb752('0x6f')](_0xb752('0x70'),{'UserId':Number(_0x2d917f['body'][_0xb752('0x63')][_0x224691]),'OpenchannelQueueId':Number(_0x2d917f['params']['id'])});}return _0x58fabf;});}})[_0xb752('0x27')](respondWithResult(_0x4510fa,null))['catch'](handleError(_0x4510fa,null));};exports[_0xb752('0x86')]=function(_0x1ec13e,_0x20c565,_0x20a2e7){return db[_0xb752('0x30')][_0xb752('0x4a')]({'where':{'id':_0x1ec13e[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0x20c565,null))[_0xb752('0x27')](function(_0x38c924){if(_0x38c924){return _0x38c924[_0xb752('0x86')](_0x1ec13e[_0xb752('0x35')][_0xb752('0x63')])[_0xb752('0x27')](function(){if(_[_0xb752('0x87')](_0x1ec13e[_0xb752('0x35')][_0xb752('0x63')])){for(var _0x2f27ed=0x0;_0x2f27ed<_0x1ec13e[_0xb752('0x35')][_0xb752('0x63')][_0xb752('0x49')];_0x2f27ed+=0x1){socket[_0xb752('0x6f')](_0xb752('0x83'),{'UserId':Number(_0x1ec13e[_0xb752('0x35')][_0xb752('0x63')][_0x2f27ed]),'OpenchannelQueueId':Number(_0x1ec13e[_0xb752('0x53')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x1ec13e['query']['ids']),'OpenchannelQueueId':Number(_0x1ec13e[_0xb752('0x53')]['id'])});}});}})[_0xb752('0x27')](respondWithStatusCode(_0x20c565,null))[_0xb752('0x4b')](handleError(_0x20c565,null));};exports[_0xb752('0x88')]=function(_0x38ee3a,_0xf1e24,_0x38191f){var _0x4d147c={};var _0x27d312={};var _0x1795b2;var _0x2cd933;return db[_0xb752('0x30')][_0xb752('0x56')]({'where':{'id':_0x38ee3a[_0xb752('0x53')]['id']}})[_0xb752('0x27')](handleEntityNotFound(_0xf1e24,null))['then'](function(_0x136042){if(_0x136042){_0x1795b2=_0x136042;_0x27d312[_0xb752('0x34')]=_['keys'](db['User'][_0xb752('0x31')]);_0x27d312[_0xb752('0x35')]=_['keys'](_0x38ee3a[_0xb752('0x35')]);_0x27d312[_0xb752('0x36')]=_[_0xb752('0x37')](_0x27d312[_0xb752('0x34')],_0x27d312[_0xb752('0x35')]);_0x4d147c[_0xb752('0x39')]=_[_0xb752('0x37')](_0x27d312[_0xb752('0x34')],qs[_0xb752('0x38')](_0x38ee3a['query'][_0xb752('0x38')]));_0x4d147c['attributes']=_0x4d147c[_0xb752('0x39')][_0xb752('0x49')]?_0x4d147c[_0xb752('0x39')]:_0x27d312[_0xb752('0x34')];_0x4d147c[_0xb752('0x3c')]=qs[_0xb752('0x3d')](_0x38ee3a[_0xb752('0x35')][_0xb752('0x3d')]);_0x4d147c[_0xb752('0x41')]=qs['filters'](_['pick'](_0x38ee3a[_0xb752('0x35')],_0x27d312[_0xb752('0x36')]));if(_0x38ee3a[_0xb752('0x35')][_0xb752('0x3f')]){_0x4d147c[_0xb752('0x41')]=_[_0xb752('0x40')](_0x4d147c['where'],{'$or':_[_0xb752('0x2f')](_0x4d147c['attributes'],function(_0x13349b){var _0x109871={};_0x109871[_0x13349b]={'$like':'%'+_0x38ee3a['query'][_0xb752('0x3f')]+'%'};return _0x109871;})});}_0x4d147c=_[_0xb752('0x40')]({},_0x4d147c,_0x38ee3a[_0xb752('0x43')]);return _0x1795b2[_0xb752('0x88')](_0x4d147c);}})[_0xb752('0x27')](function(_0x16542f){if(_0x16542f){_0x2cd933=_0x16542f[_0xb752('0x49')];if(!_0x38ee3a['query'][_0xb752('0x3a')]('nolimit')){_0x4d147c[_0xb752('0x1f')]=qs[_0xb752('0x1f')](_0x38ee3a[_0xb752('0x35')]['limit']);_0x4d147c[_0xb752('0x1c')]=qs[_0xb752('0x1c')](_0x38ee3a[_0xb752('0x35')][_0xb752('0x1c')]);}return _0x1795b2['getAgents'](_0x4d147c);}})[_0xb752('0x27')](function(_0x1c92c0){if(_0x1c92c0){return _0x1c92c0?{'count':_0x2cd933,'rows':_0x1c92c0}:null;}})[_0xb752('0x27')](respondWithResult(_0xf1e24,null))['catch'](handleError(_0xf1e24,null));}; \ No newline at end of file +var _0x9765=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','OpenchannelQueues','error','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','map','merge','options','includeAll','include','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAll','User','findAndCountAll','agent','rows','format','SIP','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','addAgents','spread','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x9765,0x198));var _0x5976=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x9765[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5976('0x0'));var zipdir=require(_0x5976('0x1'));var jsonpatch=require(_0x5976('0x2'));var rp=require(_0x5976('0x3'));var moment=require(_0x5976('0x4'));var BPromise=require(_0x5976('0x5'));var Mustache=require('mustache');var util=require(_0x5976('0x6'));var path=require(_0x5976('0x7'));var sox=require(_0x5976('0x8'));var csv=require(_0x5976('0x9'));var ejs=require(_0x5976('0xa'));var fs=require('fs');var fs_extra=require(_0x5976('0xb'));var _=require(_0x5976('0xc'));var squel=require(_0x5976('0xd'));var crypto=require(_0x5976('0xe'));var jsforce=require(_0x5976('0xf'));var deskjs=require(_0x5976('0x10'));var toCsv=require(_0x5976('0x9'));var querystring=require('querystring');var Papa=require(_0x5976('0x11'));var Redis=require(_0x5976('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5976('0x13'));var hardwareService=require(_0x5976('0x14'));var logger=require(_0x5976('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5976('0x16'));var licenseUtil=require(_0x5976('0x17'));var db=require(_0x5976('0x18'))['db'];config[_0x5976('0x19')]=_[_0x5976('0x1a')](config[_0x5976('0x19')],{'host':_0x5976('0x1b'),'port':0x18eb});var socket=require(_0x5976('0x1c'))(new Redis(config[_0x5976('0x19')]));require('./openchannelQueue.socket')[_0x5976('0x1d')](socket);function respondWithStatusCode(_0x599885,_0x2dded1){_0x2dded1=_0x2dded1||0xcc;return function(_0x1469d3){if(_0x1469d3){return _0x599885[_0x5976('0x1e')](_0x2dded1);}return _0x599885[_0x5976('0x1f')](_0x2dded1)[_0x5976('0x20')]();};}function respondWithResult(_0x778b44,_0x2aad38){_0x2aad38=_0x2aad38||0xc8;return function(_0x22fab0){if(_0x22fab0){return _0x778b44[_0x5976('0x1f')](_0x2aad38)[_0x5976('0x21')](_0x22fab0);}};}function respondWithFilteredResult(_0x37b890,_0x30e19c){return function(_0x10bbe6){if(_0x10bbe6){var _0x125792=typeof _0x30e19c[_0x5976('0x22')]===_0x5976('0x23')&&typeof _0x30e19c[_0x5976('0x24')]===_0x5976('0x23');var _0x3c878e=_0x10bbe6['count'];var _0x44e8e3=_0x125792?0x0:_0x30e19c['offset'];var _0x38d02d=_0x125792?_0x10bbe6[_0x5976('0x25')]:_0x30e19c[_0x5976('0x22')]+_0x30e19c['limit'];var _0x2cd027;if(_0x38d02d>=_0x3c878e){_0x38d02d=_0x3c878e;_0x2cd027=0xc8;}else{_0x2cd027=0xce;}_0x37b890[_0x5976('0x1f')](_0x2cd027);return _0x37b890[_0x5976('0x26')](_0x5976('0x27'),_0x44e8e3+'-'+_0x38d02d+'/'+_0x3c878e)[_0x5976('0x21')](_0x10bbe6);}return null;};}function patchUpdates(_0x34bcd3){return function(_0x386717){try{jsonpatch['apply'](_0x386717,_0x34bcd3,!![]);}catch(_0x404d12){return BPromise[_0x5976('0x28')](_0x404d12);}return _0x386717[_0x5976('0x29')]();};}function saveUpdates(_0x1efeb5,_0x31cf90){return function(_0x3cb8fe){if(_0x3cb8fe){return _0x3cb8fe['update'](_0x1efeb5)[_0x5976('0x2a')](function(_0x45c501){return _0x45c501;});}return null;};}function removeEntity(_0x4aac22,_0x595427){return function(_0x1d2b89){if(_0x1d2b89){return _0x1d2b89[_0x5976('0x2b')]()[_0x5976('0x2a')](function(){var _0x113824=_0x1d2b89[_0x5976('0x2c')]({'plain':!![]});var _0x975281=_0x5976('0x2d');return db['UserProfileResource'][_0x5976('0x2b')]({'where':{'type':_0x975281,'resourceId':_0x113824['id']}})['then'](function(){return _0x1d2b89;});})[_0x5976('0x2a')](function(){_0x4aac22[_0x5976('0x1f')](0xcc)[_0x5976('0x20')]();});}};}function handleEntityNotFound(_0x262ee2,_0x26d910){return function(_0x35ca7c){if(!_0x35ca7c){_0x262ee2['sendStatus'](0x194);}return _0x35ca7c;};}function handleError(_0x17b09b,_0x5d969e){_0x5d969e=_0x5d969e||0x1f4;return function(_0x4f41e8){logger[_0x5976('0x2e')](_0x4f41e8[_0x5976('0x2f')]);if(_0x4f41e8['name']){delete _0x4f41e8[_0x5976('0x30')];}_0x17b09b[_0x5976('0x1f')](_0x5d969e)[_0x5976('0x31')](_0x4f41e8);};}exports[_0x5976('0x32')]=function(_0x1c9b09,_0x4ff9a0){var _0x5c44ee={},_0x59de75={},_0x5c13a7={'count':0x0,'rows':[]};var _0x2f0994=_['map'](db[_0x5976('0x33')][_0x5976('0x34')],function(_0x17a734){return{'name':_0x17a734['fieldName'],'type':_0x17a734[_0x5976('0x35')][_0x5976('0x36')]};});_0x59de75[_0x5976('0x37')]=_['map'](_0x2f0994,_0x5976('0x30'));_0x59de75['query']=_[_0x5976('0x38')](_0x1c9b09[_0x5976('0x39')]);_0x59de75['filters']=_[_0x5976('0x3a')](_0x59de75['model'],_0x59de75[_0x5976('0x39')]);_0x5c44ee[_0x5976('0x3b')]=_['intersection'](_0x59de75['model'],qs['fields'](_0x1c9b09[_0x5976('0x39')][_0x5976('0x3c')]));_0x5c44ee['attributes']=_0x5c44ee[_0x5976('0x3b')][_0x5976('0x3d')]?_0x5c44ee[_0x5976('0x3b')]:_0x59de75['model'];if(!_0x1c9b09[_0x5976('0x39')]['hasOwnProperty'](_0x5976('0x3e'))){_0x5c44ee[_0x5976('0x24')]=qs[_0x5976('0x24')](_0x1c9b09['query']['limit']);_0x5c44ee['offset']=qs[_0x5976('0x22')](_0x1c9b09['query']['offset']);}_0x5c44ee[_0x5976('0x3f')]=qs['sort'](_0x1c9b09['query'][_0x5976('0x40')]);_0x5c44ee[_0x5976('0x41')]=qs[_0x5976('0x42')](_[_0x5976('0x43')](_0x1c9b09[_0x5976('0x39')],_0x59de75[_0x5976('0x42')]),_0x2f0994);if(_0x1c9b09[_0x5976('0x39')][_0x5976('0x44')]){_0x5c44ee['where']=_['merge'](_0x5c44ee[_0x5976('0x41')],{'$or':_[_0x5976('0x45')](_0x2f0994,function(_0x552cbb){if(_0x552cbb[_0x5976('0x35')]!=='VIRTUAL'){var _0x1de2cb={};_0x1de2cb[_0x552cbb[_0x5976('0x30')]]={'$like':'%'+_0x1c9b09['query'][_0x5976('0x44')]+'%'};return _0x1de2cb;}})});}_0x5c44ee=_[_0x5976('0x46')]({},_0x5c44ee,_0x1c9b09[_0x5976('0x47')]);var _0x43268b={'where':_0x5c44ee[_0x5976('0x41')]};return db['OpenchannelQueue'][_0x5976('0x25')](_0x43268b)[_0x5976('0x2a')](function(_0x3e1db6){_0x5c13a7[_0x5976('0x25')]=_0x3e1db6;if(_0x1c9b09[_0x5976('0x39')][_0x5976('0x48')]){_0x5c44ee[_0x5976('0x49')]=[{'all':!![]}];}return db[_0x5976('0x33')]['findAll'](_0x5c44ee);})['then'](function(_0x40e4a0){_0x5c13a7['rows']=_0x40e4a0;return _0x5c13a7;})['then'](respondWithFilteredResult(_0x4ff9a0,_0x5c44ee))[_0x5976('0x4a')](handleError(_0x4ff9a0,null));};exports[_0x5976('0x4b')]=function(_0x112a81,_0x8e6ac6){var _0x3e1197={'raw':!![],'where':{'id':_0x112a81[_0x5976('0x4c')]['id']}},_0x153098={};_0x153098[_0x5976('0x37')]=_[_0x5976('0x38')](db[_0x5976('0x33')]['rawAttributes']);_0x153098[_0x5976('0x39')]=_[_0x5976('0x38')](_0x112a81['query']);_0x153098[_0x5976('0x42')]=_[_0x5976('0x3a')](_0x153098['model'],_0x153098[_0x5976('0x39')]);_0x3e1197[_0x5976('0x3b')]=_['intersection'](_0x153098[_0x5976('0x37')],qs['fields'](_0x112a81[_0x5976('0x39')][_0x5976('0x3c')]));_0x3e1197[_0x5976('0x3b')]=_0x3e1197[_0x5976('0x3b')]['length']?_0x3e1197[_0x5976('0x3b')]:_0x153098['model'];if(_0x112a81[_0x5976('0x39')][_0x5976('0x48')]){_0x3e1197[_0x5976('0x49')]=[{'all':!![]}];}_0x3e1197=_[_0x5976('0x46')]({},_0x3e1197,_0x112a81[_0x5976('0x47')]);return db[_0x5976('0x33')][_0x5976('0x4d')](_0x3e1197)[_0x5976('0x2a')](handleEntityNotFound(_0x8e6ac6,null))[_0x5976('0x2a')](respondWithResult(_0x8e6ac6,null))['catch'](handleError(_0x8e6ac6,null));};exports[_0x5976('0x4e')]=function(_0x5c8b74,_0x43f7e2){return db[_0x5976('0x33')][_0x5976('0x4e')](_0x5c8b74['body'],{})[_0x5976('0x2a')](function(_0x3a1ec1){var _0x177bce=_0x5c8b74[_0x5976('0x4f')]['get']({'plain':!![]});if(!_0x177bce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x177bce[_0x5976('0x50')]==='user'){var _0x27afae=_0x3a1ec1[_0x5976('0x2c')]({'plain':!![]});var _0x222b98=_0x5976('0x2d');return db[_0x5976('0x51')]['find']({'where':{'name':_0x222b98,'userProfileId':_0x177bce[_0x5976('0x52')]},'raw':!![]})[_0x5976('0x2a')](function(_0x4522ee){if(_0x4522ee&&_0x4522ee[_0x5976('0x53')]===0x0){return db['UserProfileResource'][_0x5976('0x4e')]({'name':_0x27afae[_0x5976('0x30')],'resourceId':_0x27afae['id'],'type':_0x4522ee[_0x5976('0x30')],'sectionId':_0x4522ee['id']},{})['then'](function(){return _0x3a1ec1;});}else{return _0x3a1ec1;}})[_0x5976('0x4a')](function(_0x2ba4a0){logger[_0x5976('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ba4a0);throw _0x2ba4a0;});}return _0x3a1ec1;})[_0x5976('0x2a')](respondWithResult(_0x43f7e2,0xc9))[_0x5976('0x4a')](handleError(_0x43f7e2,null));};exports['update']=function(_0x1dacaf,_0x3b5126){if(_0x1dacaf['body']['id']){delete _0x1dacaf[_0x5976('0x54')]['id'];}return db[_0x5976('0x33')]['find']({'where':{'id':_0x1dacaf[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x3b5126,null))['then'](saveUpdates(_0x1dacaf['body'],null))[_0x5976('0x2a')](respondWithResult(_0x3b5126,null))[_0x5976('0x4a')](handleError(_0x3b5126,null));};exports['destroy']=function(_0xae4dc1,_0x111d75){return db[_0x5976('0x33')][_0x5976('0x4d')]({'where':{'id':_0xae4dc1[_0x5976('0x4c')]['id']}})['then'](handleEntityNotFound(_0x111d75,null))['then'](removeEntity(_0x111d75,null))[_0x5976('0x4a')](handleError(_0x111d75,null));};exports['describe']=function(_0x55ea2f,_0x112666){return db['OpenchannelQueue'][_0x5976('0x55')]()['then'](respondWithResult(_0x112666,null))[_0x5976('0x4a')](handleError(_0x112666,null));};exports[_0x5976('0x56')]=function(_0x3a51ad,_0x1b83fa,_0x2b3aed){var _0x5090fa={'raw':!![],'where':{}},_0x3295de={},_0x4588c2;return db[_0x5976('0x33')][_0x5976('0x57')]({'where':{'id':_0x3a51ad[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x1b83fa,null))[_0x5976('0x2a')](function(_0x351a76){if(_0x351a76){_0x4588c2=_0x351a76['get']({'plain':!![]});_0x3295de['model']=_['keys'](db[_0x5976('0x58')][_0x5976('0x34')]);_0x3295de[_0x5976('0x39')]=_[_0x5976('0x38')](_0x3a51ad[_0x5976('0x39')]);_0x3295de['filters']=_[_0x5976('0x3a')](_0x3295de[_0x5976('0x37')],_0x3295de['query']);_0x5090fa[_0x5976('0x3b')]=_['intersection'](_0x3295de[_0x5976('0x37')],qs[_0x5976('0x3c')](_0x3a51ad['query'][_0x5976('0x3c')]));_0x5090fa[_0x5976('0x3b')]=_0x5090fa[_0x5976('0x3b')][_0x5976('0x3d')]?_0x5090fa[_0x5976('0x3b')]:_0x3295de['model'];if(!_0x3a51ad[_0x5976('0x39')][_0x5976('0x59')](_0x5976('0x3e'))){_0x5090fa['limit']=qs['limit'](_0x3a51ad[_0x5976('0x39')][_0x5976('0x24')]);_0x5090fa[_0x5976('0x22')]=qs[_0x5976('0x22')](_0x3a51ad[_0x5976('0x39')][_0x5976('0x22')]);}_0x5090fa[_0x5976('0x3f')]=qs[_0x5976('0x40')](_0x3a51ad['query'][_0x5976('0x40')]);_0x5090fa[_0x5976('0x41')]=qs['filters'](_[_0x5976('0x43')](_0x3a51ad[_0x5976('0x39')],_0x3295de[_0x5976('0x42')]));_0x5090fa[_0x5976('0x41')][_0x5976('0x5a')]=_0x351a76['id'];if(_0x3a51ad['query']['filter']){_0x5090fa[_0x5976('0x41')]=_[_0x5976('0x46')](_0x5090fa[_0x5976('0x41')],{'$or':_[_0x5976('0x45')](_0x5090fa[_0x5976('0x3b')],function(_0x22c150){var _0x5269f0={};_0x5269f0[_0x22c150]={'$like':'%'+_0x3a51ad[_0x5976('0x39')]['filter']+'%'};return _0x5269f0;})});}_0x5090fa=_[_0x5976('0x46')]({},_0x5090fa,_0x3a51ad[_0x5976('0x47')]);return db[_0x5976('0x58')][_0x5976('0x5b')](_0x5090fa);}})[_0x5976('0x2a')](function(_0x4ceaa7){if(_0x4ceaa7){return db[_0x5976('0x5c')][_0x5976('0x5d')]({'where':{'id':_[_0x5976('0x45')](_0x4ceaa7,'UserId'),'role':_0x5976('0x5e')},'attributes':['id',_0x5976('0x30'),'openchannelPause','updatedAt','createdAt']});}})['then'](function(_0x27b866){if(_0x27b866){return{'count':_0x27b866[_0x5976('0x25')],'rows':_['map'](_0x27b866[_0x5976('0x5f')],function(_0xdca9aa){return{'membername':_0xdca9aa[_0x5976('0x30')],'UserId':_0xdca9aa['id'],'queue_name':_0x4588c2[_0x5976('0x30')],'OpenchannelQueueId':_0x4588c2['id'],'interface':util[_0x5976('0x60')]('%s/%s',_0x5976('0x61'),_0xdca9aa['name']),'penalty':0x0,'paused':_0xdca9aa['openchannelPause'],'createdAt':_0xdca9aa[_0x5976('0x62')],'updatedAt':_0xdca9aa[_0x5976('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5976('0x2a')](respondWithFilteredResult(_0x1b83fa,_0x5090fa))[_0x5976('0x4a')](handleError(_0x1b83fa,null));};exports['getTeams']=function(_0xf99214,_0x3d78aa,_0x67ceb2){var _0x206ff4={};var _0xf0230e={};var _0xb8d5f5;var _0x431e03;return db[_0x5976('0x33')]['findOne']({'where':{'id':_0xf99214['params']['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x3d78aa,null))[_0x5976('0x2a')](function(_0x4f1a18){if(_0x4f1a18){_0xb8d5f5=_0x4f1a18;_0xf0230e[_0x5976('0x37')]=_[_0x5976('0x38')](db['Team'][_0x5976('0x34')]);_0xf0230e[_0x5976('0x39')]=_[_0x5976('0x38')](_0xf99214[_0x5976('0x39')]);_0xf0230e[_0x5976('0x42')]=_[_0x5976('0x3a')](_0xf0230e[_0x5976('0x37')],_0xf0230e[_0x5976('0x39')]);_0x206ff4[_0x5976('0x3b')]=_[_0x5976('0x3a')](_0xf0230e[_0x5976('0x37')],qs[_0x5976('0x3c')](_0xf99214[_0x5976('0x39')]['fields']));_0x206ff4[_0x5976('0x3b')]=_0x206ff4[_0x5976('0x3b')][_0x5976('0x3d')]?_0x206ff4[_0x5976('0x3b')]:_0xf0230e[_0x5976('0x37')];_0x206ff4[_0x5976('0x3f')]=qs[_0x5976('0x40')](_0xf99214[_0x5976('0x39')][_0x5976('0x40')]);_0x206ff4[_0x5976('0x41')]=qs[_0x5976('0x42')](_[_0x5976('0x43')](_0xf99214[_0x5976('0x39')],_0xf0230e[_0x5976('0x42')]));if(_0xf99214[_0x5976('0x39')]['filter']){_0x206ff4[_0x5976('0x41')]=_[_0x5976('0x46')](_0x206ff4[_0x5976('0x41')],{'$or':_['map'](_0x206ff4[_0x5976('0x3b')],function(_0x2b2668){var _0x2ddeaf={};_0x2ddeaf[_0x2b2668]={'$like':'%'+_0xf99214[_0x5976('0x39')][_0x5976('0x44')]+'%'};return _0x2ddeaf;})});}_0x206ff4=_['merge']({},_0x206ff4,_0xf99214[_0x5976('0x47')]);return _0xb8d5f5[_0x5976('0x64')](_0x206ff4);}})[_0x5976('0x2a')](function(_0x13119a){if(_0x13119a){_0x431e03=_0x13119a[_0x5976('0x3d')];if(!_0xf99214[_0x5976('0x39')]['hasOwnProperty']('nolimit')){_0x206ff4[_0x5976('0x24')]=qs[_0x5976('0x24')](_0xf99214['query'][_0x5976('0x24')]);_0x206ff4['offset']=qs[_0x5976('0x22')](_0xf99214[_0x5976('0x39')][_0x5976('0x22')]);}return _0xb8d5f5['getTeams'](_0x206ff4);}})[_0x5976('0x2a')](function(_0xd2a571){if(_0xd2a571){return _0xd2a571?{'count':_0x431e03,'rows':_0xd2a571}:null;}})[_0x5976('0x2a')](respondWithResult(_0x3d78aa,null))[_0x5976('0x4a')](handleError(_0x3d78aa,null));};exports[_0x5976('0x65')]=function(_0x11e90e,_0x29e83c,_0x53bcb2){var _0x9210fa=_0x11e90e['body'][_0x5976('0x66')];return db[_0x5976('0x67')][_0x5976('0x5b')]({'where':{'id':_0x9210fa},'attributes':['id'],'include':[{'model':db[_0x5976('0x5c')],'as':_0x5976('0x68'),'attributes':['id',_0x5976('0x30'),_0x5976('0x69'),'voicePause','interface'],'raw':!![]}]})[_0x5976('0x2a')](function(_0x34ec2b){if(_0x34ec2b){var _0x373c7f=_[_0x5976('0x6a')](_0x34ec2b,function(_0x89f3fc){var _0x18439a=_0x89f3fc[_0x5976('0x2c')]({'plain':!![]});return _0x18439a[_0x5976('0x68')];});return db[_0x5976('0x33')]['find']({'where':{'id':_0x11e90e[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](function(_0x9d41ea){return db[_0x5976('0x6b')][_0x5976('0x6c')](function(_0x13cc42){return _0x9d41ea[_0x5976('0x65')](_0x9210fa,{'transaction':_0x13cc42})[_0x5976('0x2a')](function(){return BPromise[_0x5976('0x6d')](_0x373c7f,function(_0xfcf737){return db[_0x5976('0x58')][_0x5976('0x6e')]({'where':{'UserId':_0xfcf737['id'],'OpenchannelQueueId':_0x11e90e[_0x5976('0x4c')]['id']},'transaction':_0x13cc42});});})[_0x5976('0x2a')](function(){_0x373c7f[_0x5976('0x6f')](function(_0x42b259){socket['emit'](_0x5976('0x70'),{'UserId':_0x42b259['id'],'OpenchannelQueueId':_0x9d41ea['id']});});});});});}})['then'](respondWithStatusCode(_0x29e83c,null))[_0x5976('0x4a')](handleError(_0x29e83c,null));};exports[_0x5976('0x71')]=function(_0x68a33e,_0x314cc9,_0x386db0){return db['Team'][_0x5976('0x5b')]({'where':{'id':_0x68a33e[_0x5976('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5976('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5976('0x2a')](handleEntityNotFound(_0x314cc9,null))[_0x5976('0x2a')](function(_0xb5553c){var _0x51c6d5=_[_0x5976('0x45')](_0xb5553c,'id');var _0x2930de=[];var _0x3a5d22=[];var _0x3b562a=squel[_0x5976('0x72')]();_0x3b562a['field']('tq.TeamId')['from'](_0x5976('0x73'),'tq')[_0x5976('0x74')](_0x5976('0x75'),'ut',_0x5976('0x76'))['where']('OpenchannelQueueId\x20=\x20?',_0x68a33e[_0x5976('0x4c')]['id']);for(var _0x524221=0x0;_0x524221<_0xb5553c[_0x5976('0x3d')];_0x524221+=0x1){let _0x1ffc91=_0xb5553c[_0x524221];for(var _0x43c6e5=0x0;_0x43c6e5<_0x1ffc91[_0x5976('0x68')][_0x5976('0x3d')];_0x43c6e5+=0x1){let _0x5613ca=_0x1ffc91[_0x5976('0x68')][_0x43c6e5];var _0x1b1f31=_0x3b562a[_0x5976('0x77')]();_0x1b1f31['where'](_0x5976('0x78'),_0x5613ca['id']);_0x3a5d22[_0x5976('0x79')](db[_0x5976('0x6b')][_0x5976('0x39')](_0x1b1f31[_0x5976('0x7a')](),{'type':db[_0x5976('0x6b')][_0x5976('0x7b')][_0x5976('0x7c')]})[_0x5976('0x2a')](function(_0x3f4465){if(_0x3f4465['length']===0x1){return _0x5613ca['id'];}else{var _0x314d3c=_[_0x5976('0x7d')](_['map'](_0x3f4465,_0x5976('0x7e')),function(_0x57d8d9){return _[_0x5976('0x7f')](_0x51c6d5,_0x57d8d9);});if(_0x314d3c){return _0x5613ca['id'];}}}));}}return BPromise[_0x5976('0x80')](_0x3a5d22)[_0x5976('0x2a')](function(_0x38b99d){_0x2930de=_(_0x2930de)['union'](_0x38b99d)[_0x5976('0x81')]()[_0x5976('0x82')]();return db[_0x5976('0x33')][_0x5976('0x4d')]({'where':{'id':_0x68a33e['params']['id']}})[_0x5976('0x2a')](function(_0x15c17e){return db[_0x5976('0x6b')]['transaction'](function(_0x32c4e4){return _0x15c17e[_0x5976('0x71')](_0x68a33e[_0x5976('0x39')]['ids'],{'transaction':_0x32c4e4})['then'](function(){if(!_[_0x5976('0x83')](_0x2930de)){return _0x15c17e[_0x5976('0x84')](_0x2930de,{'transaction':_0x32c4e4});}})[_0x5976('0x2a')](function(){_0x2930de[_0x5976('0x6f')](function(_0x31c0b8){socket[_0x5976('0x85')]('userOpenchannelQueue:remove',{'UserId':_0x31c0b8,'OpenchannelQueueId':_0x15c17e['id']});});});});});});})[_0x5976('0x2a')](respondWithStatusCode(_0x314cc9,null))[_0x5976('0x4a')](handleError(_0x314cc9,null));};exports[_0x5976('0x86')]=function(_0x18106e,_0x10be33,_0x5df6ef){return db['OpenchannelQueue'][_0x5976('0x4d')]({'where':{'id':_0x18106e[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x10be33,null))['then'](function(_0x1e99cd){if(_0x1e99cd){return _0x1e99cd[_0x5976('0x86')](_0x18106e[_0x5976('0x54')]['ids'],_['omit'](_0x18106e[_0x5976('0x54')],['ids','id'])||{})[_0x5976('0x87')](function(_0x3a5537){for(var _0x274940=0x0;_0x274940<_0x18106e[_0x5976('0x54')]['ids'][_0x5976('0x3d')];_0x274940+=0x1){socket[_0x5976('0x85')]('userOpenchannelQueue:save',{'UserId':Number(_0x18106e[_0x5976('0x54')][_0x5976('0x66')][_0x274940]),'OpenchannelQueueId':Number(_0x18106e[_0x5976('0x4c')]['id'])});}return _0x3a5537;});}})['then'](respondWithResult(_0x10be33,null))[_0x5976('0x4a')](handleError(_0x10be33,null));};exports[_0x5976('0x84')]=function(_0xf28ea1,_0x56aef0,_0x490495){return db[_0x5976('0x33')][_0x5976('0x4d')]({'where':{'id':_0xf28ea1[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x56aef0,null))[_0x5976('0x2a')](function(_0x4bcba9){if(_0x4bcba9){return _0x4bcba9[_0x5976('0x84')](_0xf28ea1['query'][_0x5976('0x66')])[_0x5976('0x2a')](function(){if(_['isArray'](_0xf28ea1['query'][_0x5976('0x66')])){for(var _0x7af5a6=0x0;_0x7af5a6<_0xf28ea1['query'][_0x5976('0x66')][_0x5976('0x3d')];_0x7af5a6+=0x1){socket[_0x5976('0x85')](_0x5976('0x88'),{'UserId':Number(_0xf28ea1[_0x5976('0x39')][_0x5976('0x66')][_0x7af5a6]),'OpenchannelQueueId':Number(_0xf28ea1['params']['id'])});}}else{socket[_0x5976('0x85')](_0x5976('0x88'),{'UserId':Number(_0xf28ea1[_0x5976('0x39')][_0x5976('0x66')]),'OpenchannelQueueId':Number(_0xf28ea1[_0x5976('0x4c')]['id'])});}});}})[_0x5976('0x2a')](respondWithStatusCode(_0x56aef0,null))[_0x5976('0x4a')](handleError(_0x56aef0,null));};exports['getAgents']=function(_0x4022ab,_0x5af9a2,_0x4ceb7b){var _0x51acda={};var _0x3c53d5={};var _0x31dd32;var _0x490bcd;return db['OpenchannelQueue'][_0x5976('0x57')]({'where':{'id':_0x4022ab[_0x5976('0x4c')]['id']}})[_0x5976('0x2a')](handleEntityNotFound(_0x5af9a2,null))[_0x5976('0x2a')](function(_0x2fc417){if(_0x2fc417){_0x31dd32=_0x2fc417;_0x3c53d5[_0x5976('0x37')]=_[_0x5976('0x38')](db[_0x5976('0x5c')]['rawAttributes']);_0x3c53d5[_0x5976('0x39')]=_['keys'](_0x4022ab[_0x5976('0x39')]);_0x3c53d5[_0x5976('0x42')]=_['intersection'](_0x3c53d5['model'],_0x3c53d5[_0x5976('0x39')]);_0x51acda[_0x5976('0x3b')]=_[_0x5976('0x3a')](_0x3c53d5['model'],qs[_0x5976('0x3c')](_0x4022ab[_0x5976('0x39')]['fields']));_0x51acda['attributes']=_0x51acda['attributes'][_0x5976('0x3d')]?_0x51acda[_0x5976('0x3b')]:_0x3c53d5[_0x5976('0x37')];_0x51acda[_0x5976('0x3f')]=qs['sort'](_0x4022ab[_0x5976('0x39')][_0x5976('0x40')]);_0x51acda[_0x5976('0x41')]=qs[_0x5976('0x42')](_['pick'](_0x4022ab[_0x5976('0x39')],_0x3c53d5['filters']));if(_0x4022ab[_0x5976('0x39')][_0x5976('0x44')]){_0x51acda['where']=_[_0x5976('0x46')](_0x51acda[_0x5976('0x41')],{'$or':_[_0x5976('0x45')](_0x51acda[_0x5976('0x3b')],function(_0x309640){var _0x30e673={};_0x30e673[_0x309640]={'$like':'%'+_0x4022ab[_0x5976('0x39')][_0x5976('0x44')]+'%'};return _0x30e673;})});}_0x51acda=_['merge']({},_0x51acda,_0x4022ab[_0x5976('0x47')]);return _0x31dd32[_0x5976('0x89')](_0x51acda);}})[_0x5976('0x2a')](function(_0x18ab83){if(_0x18ab83){_0x490bcd=_0x18ab83['length'];if(!_0x4022ab['query'][_0x5976('0x59')](_0x5976('0x3e'))){_0x51acda[_0x5976('0x24')]=qs[_0x5976('0x24')](_0x4022ab[_0x5976('0x39')]['limit']);_0x51acda[_0x5976('0x22')]=qs[_0x5976('0x22')](_0x4022ab['query']['offset']);}return _0x31dd32[_0x5976('0x89')](_0x51acda);}})[_0x5976('0x2a')](function(_0x3ff3d5){if(_0x3ff3d5){return _0x3ff3d5?{'count':_0x490bcd,'rows':_0x3ff3d5}:null;}})[_0x5976('0x2a')](respondWithResult(_0x5af9a2,null))['catch'](handleError(_0x5af9a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d0352c0..5d46fa5 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 _0x8152=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8152,0x81));var _0x2815=function(_0x100e19,_0x3c9a36){_0x100e19=_0x100e19-0x0;var _0x2000ae=_0x8152[_0x100e19];return _0x2000ae;};'use strict';var EventEmitter=require(_0x2815('0x0'));var OpenchannelQueue=require(_0x2815('0x1'))['db'][_0x2815('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2815('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2815('0x4'),'afterDestroy':_0x2815('0x5')};function emitEvent(_0x1a183f){return function(_0x5117c1,_0x48094d,_0x41448d){OpenchannelQueueEvents['emit'](_0x1a183f+':'+_0x5117c1['id'],_0x5117c1);OpenchannelQueueEvents[_0x2815('0x6')](_0x1a183f,_0x5117c1);_0x41448d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2815('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x8c4a=['events','../../mysqldb','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8c4a,0xb0));var _0xa8c4=function(_0x4016ab,_0x22e1bb){_0x4016ab=_0x4016ab-0x0;var _0x3c5e56=_0x8c4a[_0x4016ab];return _0x3c5e56;};'use strict';var EventEmitter=require(_0xa8c4('0x0'));var OpenchannelQueue=require(_0xa8c4('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa8c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8c4('0x3'),'afterDestroy':_0xa8c4('0x4')};function emitEvent(_0x2022d8){return function(_0x2c2208,_0x150847,_0x236364){OpenchannelQueueEvents['emit'](_0x2022d8+':'+_0x2c2208['id'],_0x2c2208);OpenchannelQueueEvents['emit'](_0x2022d8,_0x2c2208);_0x236364(null);};}for(var e in events){if(events[_0xa8c4('0x5')](e)){var event=events[e];OpenchannelQueue[_0xa8c4('0x6')](e,emitEvent(event));}}module[_0xa8c4('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index bcbc8e5..6d193df 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 _0xfe3f=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe3f,0x108));var _0xffe3=function(_0x50a905,_0x3b16da){_0x50a905=_0x50a905-0x0;var _0x36ea13=_0xfe3f[_0x50a905];return _0x36ea13;};'use strict';var _=require(_0xffe3('0x0'));var util=require('util');var logger=require(_0xffe3('0x1'))(_0xffe3('0x2'));var moment=require('moment');var BPromise=require(_0xffe3('0x3'));var rp=require(_0xffe3('0x4'));var fs=require('fs');var path=require(_0xffe3('0x5'));var rimraf=require(_0xffe3('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0xffe3('0x7')]=function(_0x2c4c0c,_0x562195){return _0x2c4c0c[_0xffe3('0x8')](_0xffe3('0x9'),attributes,{'tableName':_0xffe3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf64=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcf64,0xae));var _0x4cf6=function(_0x129b97,_0x55185e){_0x129b97=_0x129b97-0x0;var _0x4a50df=_0xcf64[_0x129b97];return _0x4a50df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4cf6('0x0'))(_0x4cf6('0x1'));var moment=require(_0x4cf6('0x2'));var BPromise=require(_0x4cf6('0x3'));var rp=require(_0x4cf6('0x4'));var fs=require('fs');var path=require(_0x4cf6('0x5'));var rimraf=require(_0x4cf6('0x6'));var config=require(_0x4cf6('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x4cf6('0x8')]=function(_0x35e852,_0x295817){return _0x35e852['define'](_0x4cf6('0x9'),attributes,{'tableName':_0x4cf6('0xa'),'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 02c8bb4..33c4b96 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 _0x621f=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowOpenchannelQueue','find','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x621f,0x1d3));var _0xf621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x621f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf621('0x0'));var util=require(_0xf621('0x1'));var moment=require(_0xf621('0x2'));var BPromise=require('bluebird');var rs=require(_0xf621('0x3'));var fs=require('fs');var Redis=require(_0xf621('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf621('0x5'))(_0xf621('0x6'));var config=require(_0xf621('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf621('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf621('0x9')](config[_0xf621('0xa')],{'host':_0xf621('0xb'),'port':0x18eb});var socket=require(_0xf621('0xc'))(new Redis(config[_0xf621('0xa')]));require(_0xf621('0xd'))[_0xf621('0xe')](socket);function respondWithRpcPromise(_0x220bbf,_0x18e98e,_0x363fc6){return new BPromise(function(_0x4b0fb5,_0x589b5a){return client[_0xf621('0xf')](_0x220bbf,_0x363fc6)[_0xf621('0x10')](function(_0xeb9f67){logger[_0xf621('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x18e98e,'request\x20sent');logger[_0xf621('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x18e98e,_0xf621('0x13'),JSON[_0xf621('0x14')](_0xeb9f67));if(_0xeb9f67[_0xf621('0x15')]){if(_0xeb9f67['error'][_0xf621('0x16')]===0x1f4){logger[_0xf621('0x15')](_0xf621('0x17'),_0x18e98e,_0xeb9f67['error'][_0xf621('0x18')]);return _0x589b5a(_0xeb9f67[_0xf621('0x15')][_0xf621('0x18')]);}logger[_0xf621('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x18e98e,_0xeb9f67[_0xf621('0x15')][_0xf621('0x18')]);return _0x4b0fb5(_0xeb9f67[_0xf621('0x15')]['message']);}else{logger[_0xf621('0x11')](_0xf621('0x17'),_0x18e98e,'request\x20sent');_0x4b0fb5(_0xeb9f67[_0xf621('0x19')][_0xf621('0x18')]);}})[_0xf621('0x1a')](function(_0x29a69c){logger[_0xf621('0x15')](_0xf621('0x17'),_0x18e98e,_0x29a69c);_0x589b5a(_0x29a69c);});});}exports[_0xf621('0x1b')]=function(_0x1e97f2){var _0x1eafd3=this;return new Promise(function(_0x30423a,_0xb7889d){return db['OpenchannelQueue'][_0xf621('0x1c')]({'raw':_0x1e97f2['options']?_0x1e97f2[_0xf621('0x1d')][_0xf621('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e97f2['options']?_0x1e97f2[_0xf621('0x1d')][_0xf621('0x1f')]||null:null,'attributes':_0x1e97f2[_0xf621('0x1d')]?_0x1e97f2[_0xf621('0x1d')][_0xf621('0x20')]||null:null,'limit':_0x1e97f2[_0xf621('0x1d')]?_0x1e97f2[_0xf621('0x1d')][_0xf621('0x21')]||null:null,'include':_0x1e97f2[_0xf621('0x1d')]?_0x1e97f2[_0xf621('0x1d')][_0xf621('0x22')]?_['map'](_0x1e97f2[_0xf621('0x1d')][_0xf621('0x22')],function(_0x17a1f5){return{'model':db[_0x17a1f5[_0xf621('0x23')]],'as':_0x17a1f5['as'],'attributes':_0x17a1f5['attributes'],'include':_0x17a1f5['include']?_[_0xf621('0x24')](_0x17a1f5[_0xf621('0x22')],function(_0x74597d){return{'model':db[_0x74597d[_0xf621('0x23')]],'as':_0x74597d['as'],'attributes':_0x74597d[_0xf621('0x20')],'include':_0x74597d[_0xf621('0x22')]?_['map'](_0x74597d[_0xf621('0x22')],function(_0x115ffe){return{'model':db[_0x115ffe[_0xf621('0x23')]],'as':_0x115ffe['as'],'attributes':_0x115ffe[_0xf621('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf621('0x10')](function(_0x53385a){logger['info'](_0xf621('0x1b'),_0x1e97f2);logger[_0xf621('0x12')]('GetOpenchannelQueue',_0x1e97f2,JSON['stringify'](_0x53385a));_0x30423a(_0x53385a);})[_0xf621('0x1a')](function(_0x83eb73){logger[_0xf621('0x15')](_0xf621('0x1b'),_0x83eb73['message'],_0x1e97f2);_0xb7889d(_0x1eafd3[_0xf621('0x15')](0x1f4,_0x83eb73['message']));});});};exports[_0xf621('0x25')]=function(_0x53f6bf){var _0x44040c=this;return new Promise(function(_0x9f109a,_0x34282d){return db['OpenchannelQueue'][_0xf621('0x26')]({'raw':_0x53f6bf[_0xf621('0x1d')]?_0x53f6bf['options'][_0xf621('0x1e')]===undefined?!![]:![]:!![],'where':_0x53f6bf[_0xf621('0x1d')]?_0x53f6bf['options'][_0xf621('0x1f')]||null:null,'attributes':_0x53f6bf[_0xf621('0x1d')]?_0x53f6bf[_0xf621('0x1d')][_0xf621('0x20')]||null:null,'include':_0x53f6bf[_0xf621('0x1d')]?_0x53f6bf['options'][_0xf621('0x22')]?_[_0xf621('0x24')](_0x53f6bf[_0xf621('0x1d')]['include'],function(_0x2ecde5){return{'model':db[_0x2ecde5[_0xf621('0x23')]],'as':_0x2ecde5['as'],'attributes':_0x2ecde5[_0xf621('0x20')],'include':_0x2ecde5[_0xf621('0x22')]?_['map'](_0x2ecde5[_0xf621('0x22')],function(_0x34d1dd){return{'model':db[_0x34d1dd[_0xf621('0x23')]],'as':_0x34d1dd['as'],'attributes':_0x34d1dd['attributes'],'include':_0x34d1dd['include']?_['map'](_0x34d1dd[_0xf621('0x22')],function(_0x5c27da){return{'model':db[_0x5c27da[_0xf621('0x23')]],'as':_0x5c27da['as'],'attributes':_0x5c27da[_0xf621('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf621('0x10')](function(_0x2b154a){logger[_0xf621('0x11')](_0xf621('0x25'),_0x53f6bf);logger[_0xf621('0x12')]('ShowOpenchannelQueue',_0x53f6bf,JSON['stringify'](_0x2b154a));_0x9f109a(_0x2b154a);})[_0xf621('0x1a')](function(_0x43aac8){logger['error'](_0xf621('0x25'),_0x43aac8[_0xf621('0x18')],_0x53f6bf);_0x34282d(_0x44040c[_0xf621('0x15')](0x1f4,_0x43aac8[_0xf621('0x18')]));});});}; \ No newline at end of file +var _0x5ce3=['catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x12711a,_0x455f94){var _0x175027=function(_0x456248){while(--_0x456248){_0x12711a['push'](_0x12711a['shift']());}};_0x175027(++_0x455f94);}(_0x5ce3,0x1ee));var _0x35ce=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0x5ce3[_0x2f89c0];return _0x164223;};'use strict';var _=require(_0x35ce('0x0'));var util=require('util');var moment=require(_0x35ce('0x1'));var BPromise=require(_0x35ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ce('0x3'));var db=require(_0x35ce('0x4'))['db'];var utils=require(_0x35ce('0x5'));var logger=require(_0x35ce('0x6'))('rpc');var config=require(_0x35ce('0x7'));var jayson=require(_0x35ce('0x8'));var client=jayson[_0x35ce('0x9')][_0x35ce('0xa')]({'port':0x232a});config[_0x35ce('0xb')]=_[_0x35ce('0xc')](config[_0x35ce('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x35ce('0xd'))(new Redis(config[_0x35ce('0xb')]));require(_0x35ce('0xe'))[_0x35ce('0xf')](socket);function respondWithRpcPromise(_0x5844ca,_0x25c98f,_0x25bec2){return new BPromise(function(_0x8b7053,_0x4fcb38){return client[_0x35ce('0x10')](_0x5844ca,_0x25bec2)[_0x35ce('0x11')](function(_0x1d4356){logger[_0x35ce('0x12')](_0x35ce('0x13'),_0x25c98f,_0x35ce('0x14'));logger[_0x35ce('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x25c98f,_0x35ce('0x14'),JSON[_0x35ce('0x16')](_0x1d4356));if(_0x1d4356[_0x35ce('0x17')]){if(_0x1d4356[_0x35ce('0x17')]['code']===0x1f4){logger[_0x35ce('0x17')](_0x35ce('0x13'),_0x25c98f,_0x1d4356['error']['message']);return _0x4fcb38(_0x1d4356['error'][_0x35ce('0x18')]);}logger[_0x35ce('0x17')](_0x35ce('0x13'),_0x25c98f,_0x1d4356[_0x35ce('0x17')]['message']);return _0x8b7053(_0x1d4356[_0x35ce('0x17')][_0x35ce('0x18')]);}else{logger[_0x35ce('0x12')](_0x35ce('0x13'),_0x25c98f,_0x35ce('0x14'));_0x8b7053(_0x1d4356[_0x35ce('0x19')][_0x35ce('0x18')]);}})[_0x35ce('0x1a')](function(_0x47714e){logger[_0x35ce('0x17')](_0x35ce('0x13'),_0x25c98f,_0x47714e);_0x4fcb38(_0x47714e);});});}exports[_0x35ce('0x1b')]=function(_0xd41fb3){var _0x9f8feb=this;return new Promise(function(_0x16d315,_0x56d723){return db[_0x35ce('0x1c')][_0x35ce('0x1d')]({'raw':_0xd41fb3['options']?_0xd41fb3[_0x35ce('0x1e')][_0x35ce('0x1f')]===undefined?!![]:![]:!![],'where':_0xd41fb3[_0x35ce('0x1e')]?_0xd41fb3['options']['where']||null:null,'attributes':_0xd41fb3[_0x35ce('0x1e')]?_0xd41fb3['options'][_0x35ce('0x20')]||null:null,'limit':_0xd41fb3['options']?_0xd41fb3[_0x35ce('0x1e')][_0x35ce('0x21')]||null:null,'include':_0xd41fb3[_0x35ce('0x1e')]?_0xd41fb3[_0x35ce('0x1e')][_0x35ce('0x22')]?_[_0x35ce('0x23')](_0xd41fb3['options'][_0x35ce('0x22')],function(_0x80633e){return{'model':db[_0x80633e[_0x35ce('0x24')]],'as':_0x80633e['as'],'attributes':_0x80633e[_0x35ce('0x20')],'include':_0x80633e['include']?_['map'](_0x80633e['include'],function(_0x362e55){return{'model':db[_0x362e55['model']],'as':_0x362e55['as'],'attributes':_0x362e55[_0x35ce('0x20')],'include':_0x362e55['include']?_['map'](_0x362e55[_0x35ce('0x22')],function(_0x5a446a){return{'model':db[_0x5a446a[_0x35ce('0x24')]],'as':_0x5a446a['as'],'attributes':_0x5a446a['attributes']};}):[]};}):[]};}):[]:[]})[_0x35ce('0x11')](function(_0x2e5574){logger[_0x35ce('0x12')]('GetOpenchannelQueue',_0xd41fb3);logger[_0x35ce('0x15')](_0x35ce('0x1b'),_0xd41fb3,JSON[_0x35ce('0x16')](_0x2e5574));_0x16d315(_0x2e5574);})[_0x35ce('0x1a')](function(_0x1d479d){logger[_0x35ce('0x17')](_0x35ce('0x1b'),_0x1d479d[_0x35ce('0x18')],_0xd41fb3);_0x56d723(_0x9f8feb[_0x35ce('0x17')](0x1f4,_0x1d479d[_0x35ce('0x18')]));});});};exports[_0x35ce('0x25')]=function(_0x58af53){var _0x2350b6=this;return new Promise(function(_0x18567d,_0x452dc7){return db[_0x35ce('0x1c')][_0x35ce('0x26')]({'raw':_0x58af53[_0x35ce('0x1e')]?_0x58af53[_0x35ce('0x1e')][_0x35ce('0x1f')]===undefined?!![]:![]:!![],'where':_0x58af53[_0x35ce('0x1e')]?_0x58af53['options'][_0x35ce('0x27')]||null:null,'attributes':_0x58af53[_0x35ce('0x1e')]?_0x58af53[_0x35ce('0x1e')][_0x35ce('0x20')]||null:null,'include':_0x58af53[_0x35ce('0x1e')]?_0x58af53[_0x35ce('0x1e')]['include']?_[_0x35ce('0x23')](_0x58af53[_0x35ce('0x1e')][_0x35ce('0x22')],function(_0x129dc1){return{'model':db[_0x129dc1[_0x35ce('0x24')]],'as':_0x129dc1['as'],'attributes':_0x129dc1[_0x35ce('0x20')],'include':_0x129dc1[_0x35ce('0x22')]?_[_0x35ce('0x23')](_0x129dc1[_0x35ce('0x22')],function(_0x3f81c3){return{'model':db[_0x3f81c3['model']],'as':_0x3f81c3['as'],'attributes':_0x3f81c3[_0x35ce('0x20')],'include':_0x3f81c3[_0x35ce('0x22')]?_[_0x35ce('0x23')](_0x3f81c3['include'],function(_0x495a9c){return{'model':db[_0x495a9c[_0x35ce('0x24')]],'as':_0x495a9c['as'],'attributes':_0x495a9c[_0x35ce('0x20')]};}):[]};}):[]};}):[]:[]})[_0x35ce('0x11')](function(_0x2a95c5){logger[_0x35ce('0x12')]('ShowOpenchannelQueue',_0x58af53);logger[_0x35ce('0x15')](_0x35ce('0x25'),_0x58af53,JSON[_0x35ce('0x16')](_0x2a95c5));_0x18567d(_0x2a95c5);})[_0x35ce('0x1a')](function(_0x421479){logger[_0x35ce('0x17')]('ShowOpenchannelQueue',_0x421479[_0x35ce('0x18')],_0x58af53);_0x452dc7(_0x2350b6[_0x35ce('0x17')](0x1f4,_0x421479['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 88e5dc2..84834a5 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 _0x969d=['removeListener','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x50792d,_0x3ac0da){var _0x19cf5d=function(_0x4e914){while(--_0x4e914){_0x50792d['push'](_0x50792d['shift']());}};_0x19cf5d(++_0x3ac0da);}(_0x969d,0xf7));var _0xd969=function(_0x2b9fbf,_0x32600d){_0x2b9fbf=_0x2b9fbf-0x0;var _0x319289=_0x969d[_0x2b9fbf];return _0x319289;};'use strict';var OpenchannelQueueEvents=require(_0xd969('0x0'));var events=[_0xd969('0x1'),_0xd969('0x2'),_0xd969('0x3')];function createListener(_0x599450,_0x291589){return function(_0x4a56c4){_0x291589[_0xd969('0x4')](_0x599450,_0x4a56c4);};}function removeListener(_0x5139f0,_0x5443a2){return function(){OpenchannelQueueEvents[_0xd969('0x5')](_0x5139f0,_0x5443a2);};}exports['register']=function(_0x5a2d42){for(var _0x2e1b2a=0x0,_0x46ffc2=events['length'];_0x2e1b2a<_0x46ffc2;_0x2e1b2a++){var _0x106f36=events[_0x2e1b2a];var _0xded38a=createListener(_0xd969('0x6')+_0x106f36,_0x5a2d42);OpenchannelQueueEvents['on'](_0x106f36,_0xded38a);}}; \ No newline at end of file +var _0xa7be=['update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0xa7be,0xfc));var _0xea7b=function(_0x131851,_0x4bf59f){_0x131851=_0x131851-0x0;var _0x49137d=_0xa7be[_0x131851];return _0x49137d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0xea7b('0x0')];function createListener(_0x2131d6,_0x62a6a5){return function(_0x242c8e){_0x62a6a5[_0xea7b('0x1')](_0x2131d6,_0x242c8e);};}function removeListener(_0x39cd98,_0x181a5e){return function(){OpenchannelQueueEvents[_0xea7b('0x2')](_0x39cd98,_0x181a5e);};}exports[_0xea7b('0x3')]=function(_0x55de9b){for(var _0x4d1580=0x0,_0x37249d=events[_0xea7b('0x4')];_0x4d1580<_0x37249d;_0x4d1580++){var _0x178af8=events[_0x4d1580];var _0x4c60f4=createListener(_0xea7b('0x5')+_0x178af8,_0x55de9b);OpenchannelQueueEvents['on'](_0x178af8,_0x4c60f4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index eaed3f0..bc6f91f 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 _0x21bf=['multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','destroy','exports'];(function(_0x5b29ad,_0x5e9074){var _0x39cd19=function(_0x47a991){while(--_0x47a991){_0x5b29ad['push'](_0x5b29ad['shift']());}};_0x39cd19(++_0x5e9074);}(_0x21bf,0x17c));var _0xf21b=function(_0x40b508,_0x40ae66){_0x40b508=_0x40b508-0x0;var _0x7772c7=_0x21bf[_0x40b508];return _0x7772c7;};'use strict';var multer=require(_0xf21b('0x0'));var util=require(_0xf21b('0x1'));var path=require('path');var timeout=require(_0xf21b('0x2'));var express=require(_0xf21b('0x3'));var router=express[_0xf21b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf21b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xf21b('0x6')]('/',auth[_0xf21b('0x7')](),controller[_0xf21b('0x8')]);router[_0xf21b('0x6')](_0xf21b('0x9'),auth[_0xf21b('0x7')](),controller[_0xf21b('0xa')]);router[_0xf21b('0x6')]('/:id',auth[_0xf21b('0x7')](),controller[_0xf21b('0xb')]);router[_0xf21b('0xc')]('/',auth[_0xf21b('0x7')](),controller[_0xf21b('0xd')]);router[_0xf21b('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf21b('0xf')](_0xf21b('0x10'),auth[_0xf21b('0x7')](),controller[_0xf21b('0x11')]);module[_0xf21b('0x12')]=router; \ No newline at end of file +var _0x510a=['index','get','/describe','describe','/:id','show','post','create','put','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x510a,0x117));var _0xa510=function(_0x9aeb29,_0x5365f7){_0x9aeb29=_0x9aeb29-0x0;var _0x40b517=_0x510a[_0x9aeb29];return _0x40b517;};'use strict';var multer=require(_0xa510('0x0'));var util=require(_0xa510('0x1'));var path=require(_0xa510('0x2'));var timeout=require('connect-timeout');var express=require(_0xa510('0x3'));var router=express['Router']();var fs_extra=require(_0xa510('0x4'));var auth=require(_0xa510('0x5'));var interaction=require(_0xa510('0x6'));var config=require(_0xa510('0x7'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xa510('0x8')](),controller[_0xa510('0x9')]);router[_0xa510('0xa')](_0xa510('0xb'),auth[_0xa510('0x8')](),controller[_0xa510('0xc')]);router[_0xa510('0xa')](_0xa510('0xd'),auth[_0xa510('0x8')](),controller[_0xa510('0xe')]);router[_0xa510('0xf')]('/',auth[_0xa510('0x8')](),controller[_0xa510('0x10')]);router[_0xa510('0x11')]('/:id',auth[_0xa510('0x8')](),controller['update']);router['delete'](_0xa510('0xd'),auth[_0xa510('0x8')](),controller['destroy']);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 82430d2..82de39e 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 _0x0a0e=['DATE','moment','sequelize','exports','STRING'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x0a0e,0x1cd));var _0xe0a0=function(_0x481471,_0x26356b){_0x481471=_0x481471-0x0;var _0x1e92e0=_0x0a0e[_0x481471];return _0x1e92e0;};'use strict';var moment=require(_0xe0a0('0x0'));var Sequelize=require(_0xe0a0('0x1'));module[_0xe0a0('0x2')]={'uniqueid':{'type':Sequelize[_0xe0a0('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe0a0('0x4')]},'leaveAt':{'type':Sequelize[_0xe0a0('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe0a0('0x4')]},'reason':{'type':Sequelize[_0xe0a0('0x3')]}}; \ No newline at end of file +var _0xb815=['moment','sequelize','STRING','DATE'];(function(_0x5649c2,_0x5c8d04){var _0x28b072=function(_0x17c1a0){while(--_0x17c1a0){_0x5649c2['push'](_0x5649c2['shift']());}};_0x28b072(++_0x5c8d04);}(_0xb815,0x160));var _0x5b81=function(_0x5126aa,_0x5dd4b8){_0x5126aa=_0x5126aa-0x0;var _0x35329b=_0xb815[_0x5126aa];return _0x35329b;};'use strict';var moment=require(_0x5b81('0x0'));var Sequelize=require(_0x5b81('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5b81('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5b81('0x3')]},'acceptAt':{'type':Sequelize[_0x5b81('0x3')]},'exitAt':{'type':Sequelize[_0x5b81('0x3')]},'reason':{'type':Sequelize[_0x5b81('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 116a4ba..12749ed 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 _0xf84a=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','then','stack','name','send','index','OpenchannelQueueReport','fieldName','type','model','map','query','keys','filters','attributes','fields','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0xf84a,0x199));var _0xaf84=function(_0x167d2d,_0x1f1cf0){_0x167d2d=_0x167d2d-0x0;var _0x42bd5f=_0xf84a[_0x167d2d];return _0x42bd5f;};'use strict';var emlformat=require(_0xaf84('0x0'));var rimraf=require(_0xaf84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf84('0x2'));var rp=require(_0xaf84('0x3'));var moment=require(_0xaf84('0x4'));var BPromise=require(_0xaf84('0x5'));var Mustache=require(_0xaf84('0x6'));var util=require(_0xaf84('0x7'));var path=require('path');var sox=require(_0xaf84('0x8'));var csv=require(_0xaf84('0x9'));var ejs=require(_0xaf84('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf84('0xb'));var crypto=require(_0xaf84('0xc'));var jsforce=require(_0xaf84('0xd'));var deskjs=require(_0xaf84('0xe'));var toCsv=require(_0xaf84('0x9'));var querystring=require(_0xaf84('0xf'));var Papa=require(_0xaf84('0x10'));var Redis=require(_0xaf84('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaf84('0x12'));var hardwareService=require(_0xaf84('0x13'));var logger=require('../../config/logger')(_0xaf84('0x14'));var utils=require(_0xaf84('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf84('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15eeb6,_0x5f81df){_0x5f81df=_0x5f81df||0xcc;return function(_0x358f86){if(_0x358f86){return _0x15eeb6[_0xaf84('0x17')](_0x5f81df);}return _0x15eeb6[_0xaf84('0x18')](_0x5f81df)[_0xaf84('0x19')]();};}function respondWithResult(_0xcc33fd,_0x4ddcb0){_0x4ddcb0=_0x4ddcb0||0xc8;return function(_0x22725e){if(_0x22725e){return _0xcc33fd[_0xaf84('0x18')](_0x4ddcb0)[_0xaf84('0x1a')](_0x22725e);}};}function respondWithFilteredResult(_0x3afcc5,_0x3cddec){return function(_0x43773d){if(_0x43773d){var _0x2ae45d=typeof _0x3cddec['offset']===_0xaf84('0x1b')&&typeof _0x3cddec['limit']===_0xaf84('0x1b');var _0x4bca50=_0x43773d[_0xaf84('0x1c')];var _0x58c946=_0x2ae45d?0x0:_0x3cddec[_0xaf84('0x1d')];var _0x4ca64a=_0x2ae45d?_0x43773d['count']:_0x3cddec[_0xaf84('0x1d')]+_0x3cddec['limit'];var _0x25964e;if(_0x4ca64a>=_0x4bca50){_0x4ca64a=_0x4bca50;_0x25964e=0xc8;}else{_0x25964e=0xce;}_0x3afcc5[_0xaf84('0x18')](_0x25964e);return _0x3afcc5[_0xaf84('0x1e')](_0xaf84('0x1f'),_0x58c946+'-'+_0x4ca64a+'/'+_0x4bca50)['json'](_0x43773d);}return null;};}function patchUpdates(_0x2ba42e){return function(_0x4d44ee){try{jsonpatch[_0xaf84('0x20')](_0x4d44ee,_0x2ba42e,!![]);}catch(_0x33ac61){return BPromise['reject'](_0x33ac61);}return _0x4d44ee['save']();};}function saveUpdates(_0x3f0074,_0xdad505){return function(_0xd4d125){if(_0xd4d125){return _0xd4d125['update'](_0x3f0074)[_0xaf84('0x21')](function(_0x4bc496){return _0x4bc496;});}return null;};}function removeEntity(_0x3b1824,_0x41026e){return function(_0x498567){if(_0x498567){return _0x498567['destroy']()[_0xaf84('0x21')](function(){_0x3b1824['status'](0xcc)[_0xaf84('0x19')]();});}};}function handleEntityNotFound(_0x2ca700,_0x2ee3c3){return function(_0x4a6968){if(!_0x4a6968){_0x2ca700[_0xaf84('0x17')](0x194);}return _0x4a6968;};}function handleError(_0x5b4e31,_0x99995f){_0x99995f=_0x99995f||0x1f4;return function(_0x4b29de){logger['error'](_0x4b29de[_0xaf84('0x22')]);if(_0x4b29de[_0xaf84('0x23')]){delete _0x4b29de[_0xaf84('0x23')];}_0x5b4e31[_0xaf84('0x18')](_0x99995f)[_0xaf84('0x24')](_0x4b29de);};}exports[_0xaf84('0x25')]=function(_0x2478b7,_0xa3ffe9){var _0x45b067={},_0x4e2c97={},_0x3d60b6={'count':0x0,'rows':[]};var _0x1ea654=_['map'](db[_0xaf84('0x26')]['rawAttributes'],function(_0x4eecd2){return{'name':_0x4eecd2[_0xaf84('0x27')],'type':_0x4eecd2[_0xaf84('0x28')]['key']};});_0x4e2c97[_0xaf84('0x29')]=_[_0xaf84('0x2a')](_0x1ea654,_0xaf84('0x23'));_0x4e2c97[_0xaf84('0x2b')]=_[_0xaf84('0x2c')](_0x2478b7[_0xaf84('0x2b')]);_0x4e2c97[_0xaf84('0x2d')]=_['intersection'](_0x4e2c97[_0xaf84('0x29')],_0x4e2c97[_0xaf84('0x2b')]);_0x45b067[_0xaf84('0x2e')]=_['intersection'](_0x4e2c97[_0xaf84('0x29')],qs['fields'](_0x2478b7[_0xaf84('0x2b')][_0xaf84('0x2f')]));_0x45b067[_0xaf84('0x2e')]=_0x45b067[_0xaf84('0x2e')]['length']?_0x45b067['attributes']:_0x4e2c97[_0xaf84('0x29')];if(!_0x2478b7[_0xaf84('0x2b')][_0xaf84('0x30')]('nolimit')){_0x45b067['limit']=qs[_0xaf84('0x31')](_0x2478b7['query'][_0xaf84('0x31')]);_0x45b067[_0xaf84('0x1d')]=qs['offset'](_0x2478b7[_0xaf84('0x2b')]['offset']);}_0x45b067['order']=qs[_0xaf84('0x32')](_0x2478b7[_0xaf84('0x2b')][_0xaf84('0x32')]);_0x45b067['where']=qs[_0xaf84('0x2d')](_[_0xaf84('0x33')](_0x2478b7[_0xaf84('0x2b')],_0x4e2c97[_0xaf84('0x2d')]),_0x1ea654);if(_0x2478b7[_0xaf84('0x2b')]['filter']){_0x45b067[_0xaf84('0x34')]=_[_0xaf84('0x35')](_0x45b067[_0xaf84('0x34')],{'$or':_['map'](_0x1ea654,function(_0x4e80bb){if(_0x4e80bb['type']!==_0xaf84('0x36')){var _0x39d175={};_0x39d175[_0x4e80bb[_0xaf84('0x23')]]={'$like':'%'+_0x2478b7['query'][_0xaf84('0x37')]+'%'};return _0x39d175;}})});}_0x45b067=_[_0xaf84('0x35')]({},_0x45b067,_0x2478b7[_0xaf84('0x38')]);var _0xffcab2={'where':_0x45b067[_0xaf84('0x34')]};return db['OpenchannelQueueReport'][_0xaf84('0x1c')](_0xffcab2)[_0xaf84('0x21')](function(_0x46525b){_0x3d60b6[_0xaf84('0x1c')]=_0x46525b;if(_0x2478b7[_0xaf84('0x2b')][_0xaf84('0x39')]){_0x45b067[_0xaf84('0x3a')]=[{'all':!![]}];}return db[_0xaf84('0x26')][_0xaf84('0x3b')](_0x45b067);})['then'](function(_0x546a8d){_0x3d60b6[_0xaf84('0x3c')]=_0x546a8d;return _0x3d60b6;})[_0xaf84('0x21')](respondWithFilteredResult(_0xa3ffe9,_0x45b067))[_0xaf84('0x3d')](handleError(_0xa3ffe9,null));};exports[_0xaf84('0x3e')]=function(_0x289af8,_0x20dac5){var _0x3d5b49={'raw':!![],'where':{'id':_0x289af8[_0xaf84('0x3f')]['id']}},_0x3df851={};_0x3df851[_0xaf84('0x29')]=_['keys'](db[_0xaf84('0x26')][_0xaf84('0x40')]);_0x3df851[_0xaf84('0x2b')]=_['keys'](_0x289af8[_0xaf84('0x2b')]);_0x3df851[_0xaf84('0x2d')]=_[_0xaf84('0x41')](_0x3df851[_0xaf84('0x29')],_0x3df851['query']);_0x3d5b49[_0xaf84('0x2e')]=_[_0xaf84('0x41')](_0x3df851['model'],qs['fields'](_0x289af8[_0xaf84('0x2b')][_0xaf84('0x2f')]));_0x3d5b49[_0xaf84('0x2e')]=_0x3d5b49[_0xaf84('0x2e')][_0xaf84('0x42')]?_0x3d5b49[_0xaf84('0x2e')]:_0x3df851[_0xaf84('0x29')];if(_0x289af8[_0xaf84('0x2b')][_0xaf84('0x39')]){_0x3d5b49[_0xaf84('0x3a')]=[{'all':!![]}];}_0x3d5b49=_[_0xaf84('0x35')]({},_0x3d5b49,_0x289af8[_0xaf84('0x38')]);return db[_0xaf84('0x26')][_0xaf84('0x43')](_0x3d5b49)[_0xaf84('0x21')](handleEntityNotFound(_0x20dac5,null))[_0xaf84('0x21')](respondWithResult(_0x20dac5,null))[_0xaf84('0x3d')](handleError(_0x20dac5,null));};exports['create']=function(_0x19b28e,_0x26a0ea){return db[_0xaf84('0x26')]['create'](_0x19b28e[_0xaf84('0x44')],{})[_0xaf84('0x21')](respondWithResult(_0x26a0ea,0xc9))[_0xaf84('0x3d')](handleError(_0x26a0ea,null));};exports[_0xaf84('0x45')]=function(_0x354924,_0x5edbf1){if(_0x354924[_0xaf84('0x44')]['id']){delete _0x354924['body']['id'];}return db[_0xaf84('0x26')][_0xaf84('0x43')]({'where':{'id':_0x354924[_0xaf84('0x3f')]['id']}})[_0xaf84('0x21')](handleEntityNotFound(_0x5edbf1,null))[_0xaf84('0x21')](saveUpdates(_0x354924[_0xaf84('0x44')],null))[_0xaf84('0x21')](respondWithResult(_0x5edbf1,null))[_0xaf84('0x3d')](handleError(_0x5edbf1,null));};exports['destroy']=function(_0x4b899d,_0x37935e){return db[_0xaf84('0x26')]['find']({'where':{'id':_0x4b899d[_0xaf84('0x3f')]['id']}})['then'](handleEntityNotFound(_0x37935e,null))[_0xaf84('0x21')](removeEntity(_0x37935e,null))[_0xaf84('0x3d')](handleError(_0x37935e,null));};exports[_0xaf84('0x46')]=function(_0x41e639,_0x2685a2){return db[_0xaf84('0x26')][_0xaf84('0x46')]()['then'](respondWithResult(_0x2685a2,null))[_0xaf84('0x3d')](handleError(_0x2685a2,null));}; \ No newline at end of file +var _0x1260=['limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','include','rows','catch','keys','includeAll','options','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1260,0x78));var _0x0126=function(_0x422723,_0x492e0e){_0x422723=_0x422723-0x0;var _0x38e88c=_0x1260[_0x422723];return _0x38e88c;};'use strict';var emlformat=require(_0x0126('0x0'));var rimraf=require(_0x0126('0x1'));var zipdir=require(_0x0126('0x2'));var jsonpatch=require(_0x0126('0x3'));var rp=require(_0x0126('0x4'));var moment=require(_0x0126('0x5'));var BPromise=require(_0x0126('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0126('0x7'));var sox=require(_0x0126('0x8'));var csv=require('to-csv');var ejs=require(_0x0126('0x9'));var fs=require('fs');var fs_extra=require(_0x0126('0xa'));var _=require(_0x0126('0xb'));var squel=require(_0x0126('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0126('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0126('0xe'));var Papa=require(_0x0126('0xf'));var Redis=require('ioredis');var authService=require(_0x0126('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0126('0x11'));var hardwareService=require(_0x0126('0x12'));var logger=require(_0x0126('0x13'))(_0x0126('0x14'));var utils=require('../../config/utils');var config=require(_0x0126('0x15'));var licenseUtil=require(_0x0126('0x16'));var db=require(_0x0126('0x17'))['db'];function respondWithStatusCode(_0x48775e,_0x581a6d){_0x581a6d=_0x581a6d||0xcc;return function(_0x3259dd){if(_0x3259dd){return _0x48775e[_0x0126('0x18')](_0x581a6d);}return _0x48775e[_0x0126('0x19')](_0x581a6d)[_0x0126('0x1a')]();};}function respondWithResult(_0x123678,_0x99d90d){_0x99d90d=_0x99d90d||0xc8;return function(_0x1cca74){if(_0x1cca74){return _0x123678[_0x0126('0x19')](_0x99d90d)[_0x0126('0x1b')](_0x1cca74);}};}function respondWithFilteredResult(_0x41304b,_0x5578b6){return function(_0xe574ce){if(_0xe574ce){var _0x3b1c03=typeof _0x5578b6[_0x0126('0x1c')]===_0x0126('0x1d')&&typeof _0x5578b6[_0x0126('0x1e')]===_0x0126('0x1d');var _0x48e17e=_0xe574ce['count'];var _0xce6c3=_0x3b1c03?0x0:_0x5578b6[_0x0126('0x1c')];var _0x5a0f1e=_0x3b1c03?_0xe574ce[_0x0126('0x1f')]:_0x5578b6[_0x0126('0x1c')]+_0x5578b6['limit'];var _0x4ce6eb;if(_0x5a0f1e>=_0x48e17e){_0x5a0f1e=_0x48e17e;_0x4ce6eb=0xc8;}else{_0x4ce6eb=0xce;}_0x41304b[_0x0126('0x19')](_0x4ce6eb);return _0x41304b['set'](_0x0126('0x20'),_0xce6c3+'-'+_0x5a0f1e+'/'+_0x48e17e)[_0x0126('0x1b')](_0xe574ce);}return null;};}function patchUpdates(_0x182378){return function(_0x506f28){try{jsonpatch[_0x0126('0x21')](_0x506f28,_0x182378,!![]);}catch(_0x4b7b85){return BPromise[_0x0126('0x22')](_0x4b7b85);}return _0x506f28[_0x0126('0x23')]();};}function saveUpdates(_0x3b1299,_0x4bc5f7){return function(_0x552615){if(_0x552615){return _0x552615[_0x0126('0x24')](_0x3b1299)[_0x0126('0x25')](function(_0x1c3ca7){return _0x1c3ca7;});}return null;};}function removeEntity(_0x780846,_0x130846){return function(_0x1d75a7){if(_0x1d75a7){return _0x1d75a7['destroy']()[_0x0126('0x25')](function(){_0x780846[_0x0126('0x19')](0xcc)[_0x0126('0x1a')]();});}};}function handleEntityNotFound(_0x3ff31a,_0x394037){return function(_0x4e8807){if(!_0x4e8807){_0x3ff31a[_0x0126('0x18')](0x194);}return _0x4e8807;};}function handleError(_0x16683b,_0x438589){_0x438589=_0x438589||0x1f4;return function(_0x4d0a44){logger[_0x0126('0x26')](_0x4d0a44[_0x0126('0x27')]);if(_0x4d0a44[_0x0126('0x28')]){delete _0x4d0a44[_0x0126('0x28')];}_0x16683b[_0x0126('0x19')](_0x438589)[_0x0126('0x29')](_0x4d0a44);};}exports[_0x0126('0x2a')]=function(_0x3df17f,_0x7cd947){var _0x5dd22c={},_0x3e0cf9={},_0x2a89c7={'count':0x0,'rows':[]};var _0x3c69a8=_[_0x0126('0x2b')](db[_0x0126('0x2c')][_0x0126('0x2d')],function(_0x3e054c){return{'name':_0x3e054c[_0x0126('0x2e')],'type':_0x3e054c['type']['key']};});_0x3e0cf9[_0x0126('0x2f')]=_[_0x0126('0x2b')](_0x3c69a8,_0x0126('0x28'));_0x3e0cf9['query']=_['keys'](_0x3df17f[_0x0126('0x30')]);_0x3e0cf9[_0x0126('0x31')]=_[_0x0126('0x32')](_0x3e0cf9[_0x0126('0x2f')],_0x3e0cf9[_0x0126('0x30')]);_0x5dd22c[_0x0126('0x33')]=_[_0x0126('0x32')](_0x3e0cf9[_0x0126('0x2f')],qs['fields'](_0x3df17f[_0x0126('0x30')][_0x0126('0x34')]));_0x5dd22c[_0x0126('0x33')]=_0x5dd22c['attributes'][_0x0126('0x35')]?_0x5dd22c['attributes']:_0x3e0cf9['model'];if(!_0x3df17f['query'][_0x0126('0x36')](_0x0126('0x37'))){_0x5dd22c[_0x0126('0x1e')]=qs['limit'](_0x3df17f[_0x0126('0x30')]['limit']);_0x5dd22c[_0x0126('0x1c')]=qs[_0x0126('0x1c')](_0x3df17f[_0x0126('0x30')][_0x0126('0x1c')]);}_0x5dd22c[_0x0126('0x38')]=qs[_0x0126('0x39')](_0x3df17f[_0x0126('0x30')][_0x0126('0x39')]);_0x5dd22c['where']=qs['filters'](_['pick'](_0x3df17f['query'],_0x3e0cf9[_0x0126('0x31')]),_0x3c69a8);if(_0x3df17f[_0x0126('0x30')][_0x0126('0x3a')]){_0x5dd22c[_0x0126('0x3b')]=_['merge'](_0x5dd22c[_0x0126('0x3b')],{'$or':_[_0x0126('0x2b')](_0x3c69a8,function(_0x5517e2){if(_0x5517e2[_0x0126('0x3c')]!==_0x0126('0x3d')){var _0x40c690={};_0x40c690[_0x5517e2[_0x0126('0x28')]]={'$like':'%'+_0x3df17f['query'][_0x0126('0x3a')]+'%'};return _0x40c690;}})});}_0x5dd22c=_[_0x0126('0x3e')]({},_0x5dd22c,_0x3df17f['options']);var _0x406349={'where':_0x5dd22c[_0x0126('0x3b')]};return db[_0x0126('0x2c')][_0x0126('0x1f')](_0x406349)[_0x0126('0x25')](function(_0x53b779){_0x2a89c7['count']=_0x53b779;if(_0x3df17f[_0x0126('0x30')]['includeAll']){_0x5dd22c[_0x0126('0x3f')]=[{'all':!![]}];}return db[_0x0126('0x2c')]['findAll'](_0x5dd22c);})[_0x0126('0x25')](function(_0x4c0670){_0x2a89c7[_0x0126('0x40')]=_0x4c0670;return _0x2a89c7;})[_0x0126('0x25')](respondWithFilteredResult(_0x7cd947,_0x5dd22c))[_0x0126('0x41')](handleError(_0x7cd947,null));};exports['show']=function(_0x389054,_0x1fa761){var _0x598ba4={'raw':!![],'where':{'id':_0x389054['params']['id']}},_0x5f33ac={};_0x5f33ac[_0x0126('0x2f')]=_[_0x0126('0x42')](db['OpenchannelQueueReport']['rawAttributes']);_0x5f33ac[_0x0126('0x30')]=_['keys'](_0x389054[_0x0126('0x30')]);_0x5f33ac[_0x0126('0x31')]=_[_0x0126('0x32')](_0x5f33ac[_0x0126('0x2f')],_0x5f33ac[_0x0126('0x30')]);_0x598ba4['attributes']=_['intersection'](_0x5f33ac[_0x0126('0x2f')],qs[_0x0126('0x34')](_0x389054[_0x0126('0x30')][_0x0126('0x34')]));_0x598ba4[_0x0126('0x33')]=_0x598ba4[_0x0126('0x33')]['length']?_0x598ba4['attributes']:_0x5f33ac[_0x0126('0x2f')];if(_0x389054[_0x0126('0x30')][_0x0126('0x43')]){_0x598ba4[_0x0126('0x3f')]=[{'all':!![]}];}_0x598ba4=_[_0x0126('0x3e')]({},_0x598ba4,_0x389054[_0x0126('0x44')]);return db['OpenchannelQueueReport'][_0x0126('0x45')](_0x598ba4)[_0x0126('0x25')](handleEntityNotFound(_0x1fa761,null))[_0x0126('0x25')](respondWithResult(_0x1fa761,null))[_0x0126('0x41')](handleError(_0x1fa761,null));};exports[_0x0126('0x46')]=function(_0xee97b4,_0x59225a){return db[_0x0126('0x2c')][_0x0126('0x46')](_0xee97b4[_0x0126('0x47')],{})['then'](respondWithResult(_0x59225a,0xc9))[_0x0126('0x41')](handleError(_0x59225a,null));};exports[_0x0126('0x24')]=function(_0x29b9e5,_0xb2effc){if(_0x29b9e5['body']['id']){delete _0x29b9e5[_0x0126('0x47')]['id'];}return db[_0x0126('0x2c')][_0x0126('0x45')]({'where':{'id':_0x29b9e5['params']['id']}})[_0x0126('0x25')](handleEntityNotFound(_0xb2effc,null))[_0x0126('0x25')](saveUpdates(_0x29b9e5['body'],null))[_0x0126('0x25')](respondWithResult(_0xb2effc,null))['catch'](handleError(_0xb2effc,null));};exports[_0x0126('0x48')]=function(_0x5e8284,_0x46d145){return db[_0x0126('0x2c')]['find']({'where':{'id':_0x5e8284[_0x0126('0x49')]['id']}})['then'](handleEntityNotFound(_0x46d145,null))['then'](removeEntity(_0x46d145,null))[_0x0126('0x41')](handleError(_0x46d145,null));};exports['describe']=function(_0x2a493a,_0x26fb16){return db[_0x0126('0x2c')][_0x0126('0x4a')]()['then'](respondWithResult(_0x26fb16,null))[_0x0126('0x41')](handleError(_0x26fb16,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index fc8f76a..af57470 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(_0x483653,_0x5c28b1){var _0x19bc80=function(_0x2ec7e9){while(--_0x2ec7e9){_0x483653['push'](_0x483653['shift']());}};_0x19bc80(++_0x5c28b1);}(_0x326f,0xd1));var _0xf326=function(_0x3ac2e6,_0x255b10){_0x3ac2e6=_0x3ac2e6-0x0;var _0x4ee43c=_0x326f[_0x3ac2e6];return _0x4ee43c;};'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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x59901b,_0x52016b){var _0x5d775e=function(_0xea3504){while(--_0xea3504){_0x59901b['push'](_0x59901b['shift']());}};_0x5d775e(++_0x52016b);}(_0xe14b,0x93));var _0xbe14=function(_0x551dc9,_0x296706){_0x551dc9=_0x551dc9-0x0;var _0x223eb9=_0xe14b[_0x551dc9];return _0x223eb9;};'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/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 19a9186..2820cdc 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 _0x3266=['message','body','options','raw','catch','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x3266,0x6a));var _0x6326=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3266[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));var BPromise=require(_0x6326('0x3'));var rs=require(_0x6326('0x4'));var fs=require('fs');var Redis=require(_0x6326('0x5'));var db=require(_0x6326('0x6'))['db'];var utils=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('rpc');var config=require(_0x6326('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6326('0xa')][_0x6326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14208e,_0x5402e5,_0x161f4e){return new BPromise(function(_0x5730e7,_0x2af571){return client[_0x6326('0xc')](_0x14208e,_0x161f4e)[_0x6326('0xd')](function(_0x1aee60){logger[_0x6326('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5402e5,_0x6326('0xf'));logger[_0x6326('0x10')](_0x6326('0x11'),_0x5402e5,_0x6326('0xf'),JSON[_0x6326('0x12')](_0x1aee60));if(_0x1aee60[_0x6326('0x13')]){if(_0x1aee60[_0x6326('0x13')][_0x6326('0x14')]===0x1f4){logger[_0x6326('0x13')](_0x6326('0x15'),_0x5402e5,_0x1aee60['error']['message']);return _0x2af571(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}logger['error'](_0x6326('0x15'),_0x5402e5,_0x1aee60['error'][_0x6326('0x16')]);return _0x5730e7(_0x1aee60[_0x6326('0x13')][_0x6326('0x16')]);}else{logger[_0x6326('0xe')](_0x6326('0x15'),_0x5402e5,_0x6326('0xf'));_0x5730e7(_0x1aee60['result'][_0x6326('0x16')]);}})['catch'](function(_0x5945ee){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5402e5,_0x5945ee);_0x2af571(_0x5945ee);});});}exports['CreateOpenchannelQueueReport']=function(_0x58e960){var _0xdf5ced=this;return new Promise(function(_0x1f4c11,_0x2be78e){return db['OpenchannelQueueReport']['create'](_0x58e960[_0x6326('0x17')],{'raw':_0x58e960[_0x6326('0x18')]?_0x58e960[_0x6326('0x18')][_0x6326('0x19')]===undefined?!![]:![]:!![]})[_0x6326('0xd')](function(_0x25957a){logger[_0x6326('0xe')]('CreateOpenchannelQueueReport',_0x58e960);logger[_0x6326('0x10')]('CreateOpenchannelQueueReport',_0x58e960,JSON[_0x6326('0x12')](_0x25957a));_0x1f4c11(_0x25957a);})[_0x6326('0x1a')](function(_0x2482ef){logger[_0x6326('0x13')](_0x6326('0x1b'),_0x2482ef[_0x6326('0x16')],_0x58e960);_0x2be78e(_0xdf5ced[_0x6326('0x13')](0x1f4,_0x2482ef[_0x6326('0x16')]));});});};exports[_0x6326('0x1c')]=function(_0x2d0d00){var _0x34954b=this;return new Promise(function(_0x4933e1,_0x72d020){return db[_0x6326('0x1d')]['update'](_0x2d0d00['body'],{'raw':_0x2d0d00['options']?_0x2d0d00[_0x6326('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0d00[_0x6326('0x18')]?_0x2d0d00[_0x6326('0x18')]['where']||null:null,'attributes':_0x2d0d00[_0x6326('0x18')]?_0x2d0d00[_0x6326('0x18')][_0x6326('0x1e')]||null:null,'limit':_0x2d0d00[_0x6326('0x18')]?_0x2d0d00[_0x6326('0x18')][_0x6326('0x1f')]||null:null})[_0x6326('0xd')](function(_0x27802c){logger[_0x6326('0xe')](_0x6326('0x1c'),_0x2d0d00);logger[_0x6326('0x10')](_0x6326('0x1c'),_0x2d0d00,JSON[_0x6326('0x12')](_0x27802c));_0x4933e1(_0x27802c);})[_0x6326('0x1a')](function(_0x2e0445){logger[_0x6326('0x13')]('UpdateOpenchannelQueueReport',_0x2e0445[_0x6326('0x16')],_0x2d0d00);_0x72d020(_0x34954b[_0x6326('0x13')](0x1f4,_0x2e0445[_0x6326('0x16')]));});});}; \ No newline at end of file +var _0x351d=['result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','then','UpdateOpenchannelQueueReport','body','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message'];(function(_0x569294,_0x196aad){var _0x3daeaf=function(_0x561c43){while(--_0x561c43){_0x569294['push'](_0x569294['shift']());}};_0x3daeaf(++_0x196aad);}(_0x351d,0x90));var _0xd351=function(_0x464de5,_0x260ef8){_0x464de5=_0x464de5-0x0;var _0x57eeba=_0x351d[_0x464de5];return _0x57eeba;};'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')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('OpenchannelQueueReport,\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')](_0x4e0164['body'],{'raw':_0x4e0164[_0xd351('0x16')]?_0x4e0164['options']['raw']===undefined?!![]:![]:!![]})[_0xd351('0x17')](function(_0x4a427b){logger[_0xd351('0xb')](_0xd351('0x13'),_0x4e0164);logger[_0xd351('0xd')](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x4a427b));_0x1e1a3c(_0x4a427b);})['catch'](function(_0x18625b){logger[_0xd351('0xf')](_0xd351('0x13'),_0x18625b['message'],_0x4e0164);_0x2bfc53(_0x4c6693[_0xd351('0xf')](0x1f4,_0x18625b[_0xd351('0x11')]));});});};exports[_0xd351('0x18')]=function(_0x59fb6d){var _0x1ce279=this;return new Promise(function(_0x34a5cb,_0x4626c4){return db[_0xd351('0x14')]['update'](_0x59fb6d[_0xd351('0x19')],{'raw':_0x59fb6d['options']?_0x59fb6d[_0xd351('0x16')][_0xd351('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59fb6d['options']?_0x59fb6d[_0xd351('0x16')]['where']||null:null,'attributes':_0x59fb6d['options']?_0x59fb6d[_0xd351('0x16')]['attributes']||null:null,'limit':_0x59fb6d['options']?_0x59fb6d[_0xd351('0x16')]['limit']||null:null})[_0xd351('0x17')](function(_0x2ddae8){logger[_0xd351('0xb')]('UpdateOpenchannelQueueReport',_0x59fb6d);logger[_0xd351('0xd')]('UpdateOpenchannelQueueReport',_0x59fb6d,JSON[_0xd351('0xe')](_0x2ddae8));_0x34a5cb(_0x2ddae8);})['catch'](function(_0x5f07b1){logger[_0xd351('0xf')](_0xd351('0x18'),_0x5f07b1[_0xd351('0x11')],_0x59fb6d);_0x4626c4(_0x1ce279[_0xd351('0xf')](0x1f4,_0x5f07b1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 88d973d..af02a38 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 _0x31f5=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x3e8a42,_0x571c1c){var _0x2e30f6=function(_0x5dcbe6){while(--_0x5dcbe6){_0x3e8a42['push'](_0x3e8a42['shift']());}};_0x2e30f6(++_0x571c1c);}(_0x31f5,0x6b));var _0x531f=function(_0x242005,_0xc9c464){_0x242005=_0x242005-0x0;var _0x5bb233=_0x31f5[_0x242005];return _0x5bb233;};'use strict';var multer=require(_0x531f('0x0'));var util=require(_0x531f('0x1'));var path=require(_0x531f('0x2'));var timeout=require(_0x531f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x531f('0x4'));var interaction=require(_0x531f('0x5'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x531f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x531f('0x6')](_0x531f('0x7'),auth[_0x531f('0x8')](),controller[_0x531f('0x9')]);router[_0x531f('0x6')](_0x531f('0xa'),auth[_0x531f('0x8')](),controller[_0x531f('0xb')]);router[_0x531f('0xc')]('/',auth[_0x531f('0x8')](),controller[_0x531f('0xd')]);router[_0x531f('0xe')](_0x531f('0xa'),auth[_0x531f('0x8')](),controller[_0x531f('0xf')]);router['delete']('/:id',auth[_0x531f('0x8')](),controller[_0x531f('0x10')]);module[_0x531f('0x11')]=router; \ No newline at end of file +var _0x4fb2=['post','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','describe','show'];(function(_0x15f27e,_0x547fea){var _0x18da4f=function(_0x1b88aa){while(--_0x1b88aa){_0x15f27e['push'](_0x15f27e['shift']());}};_0x18da4f(++_0x547fea);}(_0x4fb2,0x102));var _0x24fb=function(_0x4b07f0,_0x15a0b5){_0x4b07f0=_0x4b07f0-0x0;var _0x55c645=_0x4fb2[_0x4b07f0];return _0x55c645;};'use strict';var multer=require(_0x24fb('0x0'));var util=require(_0x24fb('0x1'));var path=require('path');var timeout=require(_0x24fb('0x2'));var express=require(_0x24fb('0x3'));var router=express[_0x24fb('0x4')]();var fs_extra=require(_0x24fb('0x5'));var auth=require(_0x24fb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x24fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x24fb('0x8')]);router[_0x24fb('0x7')]('/describe',auth[_0x24fb('0x9')](),controller[_0x24fb('0xa')]);router['get']('/:id',auth[_0x24fb('0x9')](),controller[_0x24fb('0xb')]);router[_0x24fb('0xc')]('/',auth[_0x24fb('0x9')](),controller['create']);router[_0x24fb('0xd')](_0x24fb('0xe'),auth[_0x24fb('0x9')](),controller[_0x24fb('0xf')]);router[_0x24fb('0x10')](_0x24fb('0xe'),auth[_0x24fb('0x9')](),controller['destroy']);module[_0x24fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index c090d50..ced175f 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xa69733,_0x2aa122){var _0xca5645=function(_0x3a2729){while(--_0x3a2729){_0xa69733['push'](_0xa69733['shift']());}};_0xca5645(++_0x2aa122);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x18ee80,_0x2adf1c){var _0x2f60c2=function(_0x2bd265){while(--_0x2bd265){_0x18ee80['push'](_0x18ee80['shift']());}};_0x2f60c2(++_0x2adf1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 7c63b51..e0ba453 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 _0x4dfb=['show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','rows','catch'];(function(_0x37b596,_0x19a66b){var _0x4e0b4c=function(_0x3778ae){while(--_0x3778ae){_0x37b596['push'](_0x37b596['shift']());}};_0x4e0b4c(++_0x19a66b);}(_0x4dfb,0x11b));var _0xb4df=function(_0x1a23e5,_0x4520f3){_0x1a23e5=_0x1a23e5-0x0;var _0x595ad7=_0x4dfb[_0x1a23e5];return _0x595ad7;};'use strict';var emlformat=require(_0xb4df('0x0'));var rimraf=require(_0xb4df('0x1'));var zipdir=require(_0xb4df('0x2'));var jsonpatch=require(_0xb4df('0x3'));var rp=require('request-promise');var moment=require(_0xb4df('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb4df('0x5'));var sox=require('sox');var csv=require(_0xb4df('0x6'));var ejs=require(_0xb4df('0x7'));var fs=require('fs');var fs_extra=require(_0xb4df('0x8'));var _=require(_0xb4df('0x9'));var squel=require(_0xb4df('0xa'));var crypto=require(_0xb4df('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb4df('0x6'));var querystring=require(_0xb4df('0xc'));var Papa=require(_0xb4df('0xd'));var Redis=require(_0xb4df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb4df('0xf'));var as=require(_0xb4df('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb4df('0x11'));var config=require(_0xb4df('0x12'));var licenseUtil=require(_0xb4df('0x13'));var db=require(_0xb4df('0x14'))['db'];function respondWithStatusCode(_0x4e9e87,_0x3fd36d){_0x3fd36d=_0x3fd36d||0xcc;return function(_0x74c3aa){if(_0x74c3aa){return _0x4e9e87[_0xb4df('0x15')](_0x3fd36d);}return _0x4e9e87[_0xb4df('0x16')](_0x3fd36d)['end']();};}function respondWithResult(_0x40c259,_0xbe5c3b){_0xbe5c3b=_0xbe5c3b||0xc8;return function(_0x176f73){if(_0x176f73){return _0x40c259['status'](_0xbe5c3b)[_0xb4df('0x17')](_0x176f73);}};}function respondWithFilteredResult(_0xa543e6,_0x4ccfff){return function(_0x22bcb3){if(_0x22bcb3){var _0x4fb06a=typeof _0x4ccfff[_0xb4df('0x18')]==='undefined'&&typeof _0x4ccfff[_0xb4df('0x19')]===_0xb4df('0x1a');var _0x1a9277=_0x22bcb3[_0xb4df('0x1b')];var _0x49bae9=_0x4fb06a?0x0:_0x4ccfff[_0xb4df('0x18')];var _0x126952=_0x4fb06a?_0x22bcb3[_0xb4df('0x1b')]:_0x4ccfff[_0xb4df('0x18')]+_0x4ccfff['limit'];var _0x3620ca;if(_0x126952>=_0x1a9277){_0x126952=_0x1a9277;_0x3620ca=0xc8;}else{_0x3620ca=0xce;}_0xa543e6[_0xb4df('0x16')](_0x3620ca);return _0xa543e6[_0xb4df('0x1c')](_0xb4df('0x1d'),_0x49bae9+'-'+_0x126952+'/'+_0x1a9277)['json'](_0x22bcb3);}return null;};}function patchUpdates(_0x5cc3cf){return function(_0x29dca0){try{jsonpatch['apply'](_0x29dca0,_0x5cc3cf,!![]);}catch(_0x33c394){return BPromise[_0xb4df('0x1e')](_0x33c394);}return _0x29dca0[_0xb4df('0x1f')]();};}function saveUpdates(_0x5599b1,_0xcc8fab){return function(_0x197d1a){if(_0x197d1a){return _0x197d1a[_0xb4df('0x20')](_0x5599b1)[_0xb4df('0x21')](function(_0x43638e){return _0x43638e;});}return null;};}function removeEntity(_0x5e121d,_0x84410){return function(_0x93a57c){if(_0x93a57c){return _0x93a57c[_0xb4df('0x22')]()[_0xb4df('0x21')](function(){_0x5e121d['status'](0xcc)[_0xb4df('0x23')]();});}};}function handleEntityNotFound(_0x3d4167,_0x4dc8c2){return function(_0x285238){if(!_0x285238){_0x3d4167['sendStatus'](0x194);}return _0x285238;};}function handleError(_0x1f999d,_0x2ccd4b){_0x2ccd4b=_0x2ccd4b||0x1f4;return function(_0x54b03a){logger[_0xb4df('0x24')](_0x54b03a[_0xb4df('0x25')]);if(_0x54b03a[_0xb4df('0x26')]){delete _0x54b03a['name'];}_0x1f999d['status'](_0x2ccd4b)[_0xb4df('0x27')](_0x54b03a);};}exports['index']=function(_0x439fab,_0x2ec279){var _0x53ed0b={},_0x4d2d5c={},_0x247b3e={'count':0x0,'rows':[]};var _0x200013=_[_0xb4df('0x28')](db[_0xb4df('0x29')][_0xb4df('0x2a')],function(_0x13ede9){return{'name':_0x13ede9[_0xb4df('0x2b')],'type':_0x13ede9['type'][_0xb4df('0x2c')]};});_0x4d2d5c[_0xb4df('0x2d')]=_[_0xb4df('0x28')](_0x200013,_0xb4df('0x26'));_0x4d2d5c[_0xb4df('0x2e')]=_[_0xb4df('0x2f')](_0x439fab[_0xb4df('0x2e')]);_0x4d2d5c[_0xb4df('0x30')]=_[_0xb4df('0x31')](_0x4d2d5c[_0xb4df('0x2d')],_0x4d2d5c[_0xb4df('0x2e')]);_0x53ed0b['attributes']=_[_0xb4df('0x31')](_0x4d2d5c['model'],qs[_0xb4df('0x32')](_0x439fab[_0xb4df('0x2e')][_0xb4df('0x32')]));_0x53ed0b[_0xb4df('0x33')]=_0x53ed0b['attributes'][_0xb4df('0x34')]?_0x53ed0b[_0xb4df('0x33')]:_0x4d2d5c[_0xb4df('0x2d')];if(!_0x439fab[_0xb4df('0x2e')]['hasOwnProperty']('nolimit')){_0x53ed0b[_0xb4df('0x19')]=qs[_0xb4df('0x19')](_0x439fab[_0xb4df('0x2e')][_0xb4df('0x19')]);_0x53ed0b['offset']=qs[_0xb4df('0x18')](_0x439fab['query'][_0xb4df('0x18')]);}_0x53ed0b[_0xb4df('0x35')]=qs['sort'](_0x439fab[_0xb4df('0x2e')][_0xb4df('0x36')]);_0x53ed0b[_0xb4df('0x37')]=qs[_0xb4df('0x30')](_[_0xb4df('0x38')](_0x439fab['query'],_0x4d2d5c[_0xb4df('0x30')]),_0x200013);if(_0x439fab['query'][_0xb4df('0x39')]){_0x53ed0b[_0xb4df('0x37')]=_[_0xb4df('0x3a')](_0x53ed0b['where'],{'$or':_[_0xb4df('0x28')](_0x200013,function(_0x12d092){if(_0x12d092['type']!==_0xb4df('0x3b')){var _0x5175b5={};_0x5175b5[_0x12d092[_0xb4df('0x26')]]={'$like':'%'+_0x439fab[_0xb4df('0x2e')][_0xb4df('0x39')]+'%'};return _0x5175b5;}})});}_0x53ed0b=_[_0xb4df('0x3a')]({},_0x53ed0b,_0x439fab['options']);var _0xe3b0e={'where':_0x53ed0b[_0xb4df('0x37')]};return db[_0xb4df('0x29')][_0xb4df('0x1b')](_0xe3b0e)[_0xb4df('0x21')](function(_0x31e8ca){_0x247b3e['count']=_0x31e8ca;if(_0x439fab[_0xb4df('0x2e')]['includeAll']){_0x53ed0b['include']=[{'all':!![]}];}return db[_0xb4df('0x29')]['findAll'](_0x53ed0b);})[_0xb4df('0x21')](function(_0x4ae77b){_0x247b3e[_0xb4df('0x3c')]=_0x4ae77b;return _0x247b3e;})['then'](respondWithFilteredResult(_0x2ec279,_0x53ed0b))[_0xb4df('0x3d')](handleError(_0x2ec279,null));};exports[_0xb4df('0x3e')]=function(_0x5005ce,_0x4f3bd0){var _0x5d4a6f={'raw':!![],'where':{'id':_0x5005ce[_0xb4df('0x3f')]['id']}},_0x1b0552={};_0x1b0552['model']=_['keys'](db[_0xb4df('0x29')][_0xb4df('0x2a')]);_0x1b0552[_0xb4df('0x2e')]=_[_0xb4df('0x2f')](_0x5005ce['query']);_0x1b0552[_0xb4df('0x30')]=_['intersection'](_0x1b0552[_0xb4df('0x2d')],_0x1b0552[_0xb4df('0x2e')]);_0x5d4a6f['attributes']=_[_0xb4df('0x31')](_0x1b0552[_0xb4df('0x2d')],qs[_0xb4df('0x32')](_0x5005ce[_0xb4df('0x2e')][_0xb4df('0x32')]));_0x5d4a6f[_0xb4df('0x33')]=_0x5d4a6f['attributes'][_0xb4df('0x34')]?_0x5d4a6f[_0xb4df('0x33')]:_0x1b0552[_0xb4df('0x2d')];if(_0x5005ce[_0xb4df('0x2e')]['includeAll']){_0x5d4a6f['include']=[{'all':!![]}];}_0x5d4a6f=_['merge']({},_0x5d4a6f,_0x5005ce[_0xb4df('0x40')]);return db[_0xb4df('0x29')][_0xb4df('0x41')](_0x5d4a6f)['then'](handleEntityNotFound(_0x4f3bd0,null))['then'](respondWithResult(_0x4f3bd0,null))['catch'](handleError(_0x4f3bd0,null));};exports['create']=function(_0x4c24ff,_0x5103d5){return db['OpenchannelTransferReport'][_0xb4df('0x42')](_0x4c24ff[_0xb4df('0x43')],{})[_0xb4df('0x21')](respondWithResult(_0x5103d5,0xc9))[_0xb4df('0x3d')](handleError(_0x5103d5,null));};exports[_0xb4df('0x20')]=function(_0x1d1cfc,_0x3ea188){if(_0x1d1cfc[_0xb4df('0x43')]['id']){delete _0x1d1cfc[_0xb4df('0x43')]['id'];}return db[_0xb4df('0x29')][_0xb4df('0x41')]({'where':{'id':_0x1d1cfc['params']['id']}})[_0xb4df('0x21')](handleEntityNotFound(_0x3ea188,null))[_0xb4df('0x21')](saveUpdates(_0x1d1cfc[_0xb4df('0x43')],null))['then'](respondWithResult(_0x3ea188,null))[_0xb4df('0x3d')](handleError(_0x3ea188,null));};exports[_0xb4df('0x22')]=function(_0x45ee02,_0x39fb40){return db['OpenchannelTransferReport'][_0xb4df('0x41')]({'where':{'id':_0x45ee02[_0xb4df('0x3f')]['id']}})[_0xb4df('0x21')](handleEntityNotFound(_0x39fb40,null))[_0xb4df('0x21')](removeEntity(_0x39fb40,null))['catch'](handleError(_0x39fb40,null));};exports[_0xb4df('0x44')]=function(_0xf812b4,_0x1788c6){return db['OpenchannelTransferReport'][_0xb4df('0x44')]()['then'](respondWithResult(_0x1788c6,null))[_0xb4df('0x3d')](handleError(_0x1788c6,null));}; \ No newline at end of file +var _0x70c1=['fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','OpenchannelTransferReport','rawAttributes'];(function(_0x28dfe7,_0xbd7b81){var _0x3dc093=function(_0x4ed9f4){while(--_0x4ed9f4){_0x28dfe7['push'](_0x28dfe7['shift']());}};_0x3dc093(++_0xbd7b81);}(_0x70c1,0x10e));var _0x170c=function(_0x3db0da,_0x10ef73){_0x3db0da=_0x3db0da-0x0;var _0x57507b=_0x70c1[_0x3db0da];return _0x57507b;};'use strict';var emlformat=require(_0x170c('0x0'));var rimraf=require(_0x170c('0x1'));var zipdir=require(_0x170c('0x2'));var jsonpatch=require(_0x170c('0x3'));var rp=require(_0x170c('0x4'));var moment=require(_0x170c('0x5'));var BPromise=require(_0x170c('0x6'));var Mustache=require(_0x170c('0x7'));var util=require(_0x170c('0x8'));var path=require(_0x170c('0x9'));var sox=require(_0x170c('0xa'));var csv=require('to-csv');var ejs=require(_0x170c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x170c('0xc'));var crypto=require(_0x170c('0xd'));var jsforce=require(_0x170c('0xe'));var deskjs=require(_0x170c('0xf'));var toCsv=require(_0x170c('0x10'));var querystring=require(_0x170c('0x11'));var Papa=require(_0x170c('0x12'));var Redis=require(_0x170c('0x13'));var authService=require(_0x170c('0x14'));var qs=require(_0x170c('0x15'));var as=require(_0x170c('0x16'));var hardwareService=require(_0x170c('0x17'));var logger=require(_0x170c('0x18'))('api');var utils=require(_0x170c('0x19'));var config=require(_0x170c('0x1a'));var licenseUtil=require(_0x170c('0x1b'));var db=require(_0x170c('0x1c'))['db'];function respondWithStatusCode(_0x1b825b,_0x262032){_0x262032=_0x262032||0xcc;return function(_0x330c65){if(_0x330c65){return _0x1b825b[_0x170c('0x1d')](_0x262032);}return _0x1b825b[_0x170c('0x1e')](_0x262032)[_0x170c('0x1f')]();};}function respondWithResult(_0x1d1328,_0x5b7d33){_0x5b7d33=_0x5b7d33||0xc8;return function(_0x50656b){if(_0x50656b){return _0x1d1328['status'](_0x5b7d33)[_0x170c('0x20')](_0x50656b);}};}function respondWithFilteredResult(_0x4eb2a2,_0x8c649d){return function(_0x1f447e){if(_0x1f447e){var _0xc274cf=typeof _0x8c649d[_0x170c('0x21')]===_0x170c('0x22')&&typeof _0x8c649d[_0x170c('0x23')]==='undefined';var _0x37054d=_0x1f447e[_0x170c('0x24')];var _0x361427=_0xc274cf?0x0:_0x8c649d[_0x170c('0x21')];var _0x156347=_0xc274cf?_0x1f447e[_0x170c('0x24')]:_0x8c649d[_0x170c('0x21')]+_0x8c649d['limit'];var _0xbaf8b;if(_0x156347>=_0x37054d){_0x156347=_0x37054d;_0xbaf8b=0xc8;}else{_0xbaf8b=0xce;}_0x4eb2a2[_0x170c('0x1e')](_0xbaf8b);return _0x4eb2a2[_0x170c('0x25')](_0x170c('0x26'),_0x361427+'-'+_0x156347+'/'+_0x37054d)[_0x170c('0x20')](_0x1f447e);}return null;};}function patchUpdates(_0x3d070d){return function(_0x3cf729){try{jsonpatch['apply'](_0x3cf729,_0x3d070d,!![]);}catch(_0x263adf){return BPromise[_0x170c('0x27')](_0x263adf);}return _0x3cf729[_0x170c('0x28')]();};}function saveUpdates(_0x100e7e,_0x554027){return function(_0x2cda32){if(_0x2cda32){return _0x2cda32[_0x170c('0x29')](_0x100e7e)[_0x170c('0x2a')](function(_0x3a98ef){return _0x3a98ef;});}return null;};}function removeEntity(_0x4ec921,_0x39e43b){return function(_0x3e623f){if(_0x3e623f){return _0x3e623f[_0x170c('0x2b')]()[_0x170c('0x2a')](function(){_0x4ec921[_0x170c('0x1e')](0xcc)[_0x170c('0x1f')]();});}};}function handleEntityNotFound(_0x5c2e26,_0xea4ecd){return function(_0x44ae16){if(!_0x44ae16){_0x5c2e26['sendStatus'](0x194);}return _0x44ae16;};}function handleError(_0x1ef180,_0x352e6a){_0x352e6a=_0x352e6a||0x1f4;return function(_0x58c32c){logger[_0x170c('0x2c')](_0x58c32c['stack']);if(_0x58c32c[_0x170c('0x2d')]){delete _0x58c32c['name'];}_0x1ef180[_0x170c('0x1e')](_0x352e6a)[_0x170c('0x2e')](_0x58c32c);};}exports[_0x170c('0x2f')]=function(_0x96c5d3,_0x2ba305){var _0x3961f4={},_0x2661a4={},_0x18c930={'count':0x0,'rows':[]};var _0x4c3297=_['map'](db[_0x170c('0x30')][_0x170c('0x31')],function(_0x49b099){return{'name':_0x49b099[_0x170c('0x32')],'type':_0x49b099[_0x170c('0x33')]['key']};});_0x2661a4[_0x170c('0x34')]=_[_0x170c('0x35')](_0x4c3297,_0x170c('0x2d'));_0x2661a4[_0x170c('0x36')]=_[_0x170c('0x37')](_0x96c5d3['query']);_0x2661a4['filters']=_[_0x170c('0x38')](_0x2661a4[_0x170c('0x34')],_0x2661a4['query']);_0x3961f4[_0x170c('0x39')]=_['intersection'](_0x2661a4['model'],qs[_0x170c('0x3a')](_0x96c5d3[_0x170c('0x36')][_0x170c('0x3a')]));_0x3961f4[_0x170c('0x39')]=_0x3961f4[_0x170c('0x39')][_0x170c('0x3b')]?_0x3961f4['attributes']:_0x2661a4[_0x170c('0x34')];if(!_0x96c5d3['query'][_0x170c('0x3c')](_0x170c('0x3d'))){_0x3961f4[_0x170c('0x23')]=qs[_0x170c('0x23')](_0x96c5d3[_0x170c('0x36')][_0x170c('0x23')]);_0x3961f4[_0x170c('0x21')]=qs[_0x170c('0x21')](_0x96c5d3['query'][_0x170c('0x21')]);}_0x3961f4[_0x170c('0x3e')]=qs[_0x170c('0x3f')](_0x96c5d3[_0x170c('0x36')]['sort']);_0x3961f4['where']=qs[_0x170c('0x40')](_[_0x170c('0x41')](_0x96c5d3[_0x170c('0x36')],_0x2661a4[_0x170c('0x40')]),_0x4c3297);if(_0x96c5d3[_0x170c('0x36')][_0x170c('0x42')]){_0x3961f4[_0x170c('0x43')]=_[_0x170c('0x44')](_0x3961f4[_0x170c('0x43')],{'$or':_[_0x170c('0x35')](_0x4c3297,function(_0x28a5fd){if(_0x28a5fd[_0x170c('0x33')]!==_0x170c('0x45')){var _0x486d45={};_0x486d45[_0x28a5fd[_0x170c('0x2d')]]={'$like':'%'+_0x96c5d3['query']['filter']+'%'};return _0x486d45;}})});}_0x3961f4=_[_0x170c('0x44')]({},_0x3961f4,_0x96c5d3[_0x170c('0x46')]);var _0x2329e2={'where':_0x3961f4['where']};return db[_0x170c('0x30')][_0x170c('0x24')](_0x2329e2)[_0x170c('0x2a')](function(_0x1df08c){_0x18c930['count']=_0x1df08c;if(_0x96c5d3[_0x170c('0x36')][_0x170c('0x47')]){_0x3961f4[_0x170c('0x48')]=[{'all':!![]}];}return db[_0x170c('0x30')][_0x170c('0x49')](_0x3961f4);})['then'](function(_0x27f459){_0x18c930['rows']=_0x27f459;return _0x18c930;})['then'](respondWithFilteredResult(_0x2ba305,_0x3961f4))[_0x170c('0x4a')](handleError(_0x2ba305,null));};exports['show']=function(_0x3f56bc,_0x3af537){var _0x25a7ad={'raw':!![],'where':{'id':_0x3f56bc['params']['id']}},_0x6e76b5={};_0x6e76b5[_0x170c('0x34')]=_[_0x170c('0x37')](db[_0x170c('0x30')][_0x170c('0x31')]);_0x6e76b5[_0x170c('0x36')]=_[_0x170c('0x37')](_0x3f56bc['query']);_0x6e76b5[_0x170c('0x40')]=_[_0x170c('0x38')](_0x6e76b5[_0x170c('0x34')],_0x6e76b5['query']);_0x25a7ad[_0x170c('0x39')]=_[_0x170c('0x38')](_0x6e76b5[_0x170c('0x34')],qs[_0x170c('0x3a')](_0x3f56bc[_0x170c('0x36')][_0x170c('0x3a')]));_0x25a7ad[_0x170c('0x39')]=_0x25a7ad[_0x170c('0x39')][_0x170c('0x3b')]?_0x25a7ad[_0x170c('0x39')]:_0x6e76b5[_0x170c('0x34')];if(_0x3f56bc[_0x170c('0x36')]['includeAll']){_0x25a7ad['include']=[{'all':!![]}];}_0x25a7ad=_[_0x170c('0x44')]({},_0x25a7ad,_0x3f56bc[_0x170c('0x46')]);return db[_0x170c('0x30')][_0x170c('0x4b')](_0x25a7ad)[_0x170c('0x2a')](handleEntityNotFound(_0x3af537,null))[_0x170c('0x2a')](respondWithResult(_0x3af537,null))['catch'](handleError(_0x3af537,null));};exports[_0x170c('0x4c')]=function(_0x1fe229,_0x40b1e8){return db['OpenchannelTransferReport'][_0x170c('0x4c')](_0x1fe229[_0x170c('0x4d')],{})[_0x170c('0x2a')](respondWithResult(_0x40b1e8,0xc9))[_0x170c('0x4a')](handleError(_0x40b1e8,null));};exports[_0x170c('0x29')]=function(_0x46a7d0,_0x46dc4f){if(_0x46a7d0[_0x170c('0x4d')]['id']){delete _0x46a7d0['body']['id'];}return db[_0x170c('0x30')]['find']({'where':{'id':_0x46a7d0[_0x170c('0x4e')]['id']}})[_0x170c('0x2a')](handleEntityNotFound(_0x46dc4f,null))[_0x170c('0x2a')](saveUpdates(_0x46a7d0['body'],null))[_0x170c('0x2a')](respondWithResult(_0x46dc4f,null))['catch'](handleError(_0x46dc4f,null));};exports['destroy']=function(_0x4d2858,_0x14987f){return db[_0x170c('0x30')][_0x170c('0x4b')]({'where':{'id':_0x4d2858[_0x170c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x14987f,null))[_0x170c('0x2a')](removeEntity(_0x14987f,null))['catch'](handleError(_0x14987f,null));};exports['describe']=function(_0x2ab677,_0x5cc10d){return db['OpenchannelTransferReport'][_0x170c('0x4f')]()[_0x170c('0x2a')](respondWithResult(_0x5cc10d,null))['catch'](handleError(_0x5cc10d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f40564e..b52e90c 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 _0xab3f=['./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6f7c64,_0x4a8555){var _0x16753a=function(_0xbb964c){while(--_0xbb964c){_0x6f7c64['push'](_0x6f7c64['shift']());}};_0x16753a(++_0x4a8555);}(_0xab3f,0x1dd));var _0xfab3=function(_0x43a569,_0x4276cd){_0x43a569=_0x43a569-0x0;var _0x1408e0=_0xab3f[_0x43a569];return _0x1408e0;};'use strict';var _=require(_0xfab3('0x0'));var util=require(_0xfab3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfab3('0x2'));var rp=require(_0xfab3('0x3'));var fs=require('fs');var path=require(_0xfab3('0x4'));var rimraf=require(_0xfab3('0x5'));var config=require(_0xfab3('0x6'));var attributes=require(_0xfab3('0x7'));module['exports']=function(_0x19f03c,_0x4e0f27){return _0x19f03c['define'](_0xfab3('0x8'),attributes,{'tableName':_0xfab3('0x9'),'paranoid':![],'indexes':[{'name':_0xfab3('0xa'),'fields':[_0xfab3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5369=['exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes'];(function(_0x173c84,_0x1b2613){var _0x1ebc7b=function(_0x13e801){while(--_0x13e801){_0x173c84['push'](_0x173c84['shift']());}};_0x1ebc7b(++_0x1b2613);}(_0x5369,0x118));var _0x9536=function(_0x302f4e,_0x187160){_0x302f4e=_0x302f4e-0x0;var _0x349807=_0x5369[_0x302f4e];return _0x349807;};'use strict';var _=require(_0x9536('0x0'));var util=require(_0x9536('0x1'));var logger=require(_0x9536('0x2'))('api');var moment=require(_0x9536('0x3'));var BPromise=require(_0x9536('0x4'));var rp=require(_0x9536('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9536('0x6'));var config=require('../../config/environment');var attributes=require(_0x9536('0x7'));module[_0x9536('0x8')]=function(_0x1d9184,_0x123ae5){return _0x1d9184['define'](_0x9536('0x9'),attributes,{'tableName':_0x9536('0xa'),'paranoid':![],'indexes':[{'name':_0x9536('0xb'),'fields':[_0x9536('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 090ffaa..6adce0c 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 _0x383d=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1bdb86,_0x41e065){var _0x7b6c9c=function(_0x36f4d4){while(--_0x36f4d4){_0x1bdb86['push'](_0x1bdb86['shift']());}};_0x7b6c9c(++_0x41e065);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd383('0x0'));var BPromise=require(_0xd383('0x1'));var rs=require(_0xd383('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd383('0x3'))['db'];var utils=require(_0xd383('0x4'));var logger=require(_0xd383('0x5'))(_0xd383('0x6'));var config=require(_0xd383('0x7'));var jayson=require(_0xd383('0x8'));var client=jayson['client'][_0xd383('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30ba82,_0x9922e9,_0x470d8d){return new BPromise(function(_0xffa778,_0x5d4e0f){return client['request'](_0x30ba82,_0x470d8d)[_0xd383('0xa')](function(_0xb3ff62){logger['info'](_0xd383('0xb'),_0x9922e9,_0xd383('0xc'));logger[_0xd383('0xd')](_0xd383('0xe'),_0x9922e9,_0xd383('0xc'),JSON[_0xd383('0xf')](_0xb3ff62));if(_0xb3ff62['error']){if(_0xb3ff62[_0xd383('0x10')][_0xd383('0x11')]===0x1f4){logger[_0xd383('0x10')](_0xd383('0xb'),_0x9922e9,_0xb3ff62['error'][_0xd383('0x12')]);return _0x5d4e0f(_0xb3ff62[_0xd383('0x10')][_0xd383('0x12')]);}logger[_0xd383('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x9922e9,_0xb3ff62[_0xd383('0x10')]['message']);return _0xffa778(_0xb3ff62[_0xd383('0x10')][_0xd383('0x12')]);}else{logger[_0xd383('0x13')](_0xd383('0xb'),_0x9922e9,_0xd383('0xc'));_0xffa778(_0xb3ff62[_0xd383('0x14')]['message']);}})['catch'](function(_0x3905c1){logger[_0xd383('0x10')](_0xd383('0xb'),_0x9922e9,_0x3905c1);_0x5d4e0f(_0x3905c1);});});} \ No newline at end of file +var _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4148,0xc6));var _0x8414=function(_0x179cce,_0x239422){_0x179cce=_0x179cce-0x0;var _0x54ac6d=_0x4148[_0x179cce];return _0x54ac6d;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b438924..cc9bbfc 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 _0x2227=['/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get'];(function(_0x490203,_0x2b548e){var _0x33c716=function(_0x471b7d){while(--_0x471b7d){_0x490203['push'](_0x490203['shift']());}};_0x33c716(++_0x2b548e);}(_0x2227,0x143));var _0x7222=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x2227[_0x2fe689];return _0x35ea44;};'use strict';var multer=require(_0x7222('0x0'));var util=require('util');var path=require(_0x7222('0x1'));var timeout=require(_0x7222('0x2'));var express=require(_0x7222('0x3'));var router=express[_0x7222('0x4')]();var fs_extra=require(_0x7222('0x5'));var auth=require(_0x7222('0x6'));var interaction=require(_0x7222('0x7'));var config=require(_0x7222('0x8'));var controller=require(_0x7222('0x9'));router['get']('/',auth[_0x7222('0xa')](),controller[_0x7222('0xb')]);router[_0x7222('0xc')](_0x7222('0xd'),auth['isAuthenticated'](),controller[_0x7222('0xe')]);router[_0x7222('0xf')]('/',auth[_0x7222('0xa')](),controller[_0x7222('0x10')]);router[_0x7222('0x11')]('/:id',auth[_0x7222('0xa')](),controller[_0x7222('0x12')]);router[_0x7222('0x13')](_0x7222('0xd'),auth[_0x7222('0xa')](),controller['destroy']);module[_0x7222('0x14')]=router; \ No newline at end of file +var _0xdf88=['/:id','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','./pause.controller','get','isAuthenticated','index'];(function(_0x5e776d,_0x313f8c){var _0x2e065a=function(_0x56d060){while(--_0x56d060){_0x5e776d['push'](_0x5e776d['shift']());}};_0x2e065a(++_0x313f8c);}(_0xdf88,0x87));var _0x8df8=function(_0x2dd27d,_0x5c3d74){_0x2dd27d=_0x2dd27d-0x0;var _0x2c6323=_0xdf88[_0x2dd27d];return _0x2c6323;};'use strict';var multer=require('multer');var util=require(_0x8df8('0x0'));var path=require(_0x8df8('0x1'));var timeout=require('connect-timeout');var express=require(_0x8df8('0x2'));var router=express[_0x8df8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8df8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8df8('0x5'));router[_0x8df8('0x6')]('/',auth[_0x8df8('0x7')](),controller[_0x8df8('0x8')]);router[_0x8df8('0x6')](_0x8df8('0x9'),auth[_0x8df8('0x7')](),controller['show']);router['post']('/',auth[_0x8df8('0x7')](),controller[_0x8df8('0xa')]);router[_0x8df8('0xb')]('/:id',auth[_0x8df8('0x7')](),controller[_0x8df8('0xc')]);router[_0x8df8('0xd')](_0x8df8('0x9'),auth[_0x8df8('0x7')](),controller[_0x8df8('0xe')]);module[_0x8df8('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index a2dbe90..9e89b74 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 _0x5afd=['exports','STRING','name'];(function(_0x115bce,_0x5f1f5d){var _0x46d47d=function(_0x4060b5){while(--_0x4060b5){_0x115bce['push'](_0x115bce['shift']());}};_0x46d47d(++_0x5f1f5d);}(_0x5afd,0x1e9));var _0xd5af=function(_0x564adf,_0x861a9){_0x564adf=_0x564adf-0x0;var _0x506f27=_0x5afd[_0x564adf];return _0x506f27;};'use strict';var Sequelize=require('sequelize');module[_0xd5af('0x0')]={'name':{'type':Sequelize[_0xd5af('0x1')],'unique':_0xd5af('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd5af('0x1')]}}; \ No newline at end of file +var _0xb602=['sequelize','exports','STRING','name'];(function(_0x29b222,_0xc1344){var _0x48fdaf=function(_0x5ef663){while(--_0x5ef663){_0x29b222['push'](_0x29b222['shift']());}};_0x48fdaf(++_0xc1344);}(_0xb602,0x15c));var _0x2b60=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xb602[_0x352e09];return _0x1b7094;};'use strict';var Sequelize=require(_0x2b60('0x0'));module[_0x2b60('0x1')]={'name':{'type':Sequelize[_0x2b60('0x2')],'unique':_0x2b60('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3e6af4f..78eac47 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 _0xf499=['rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format'];(function(_0x38dd10,_0x3bc54c){var _0x42dcac=function(_0x1754b7){while(--_0x1754b7){_0x38dd10['push'](_0x38dd10['shift']());}};_0x42dcac(++_0x3bc54c);}(_0xf499,0x199));var _0x9f49=function(_0x5d821b,_0x51af51){_0x5d821b=_0x5d821b-0x0;var _0x94b98d=_0xf499[_0x5d821b];return _0x94b98d;};'use strict';var emlformat=require(_0x9f49('0x0'));var rimraf=require(_0x9f49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f49('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9f49('0x3'));var Mustache=require(_0x9f49('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9f49('0x5'));var csv=require(_0x9f49('0x6'));var ejs=require(_0x9f49('0x7'));var fs=require('fs');var fs_extra=require(_0x9f49('0x8'));var _=require(_0x9f49('0x9'));var squel=require(_0x9f49('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f49('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9f49('0xc'));var Papa=require(_0x9f49('0xd'));var Redis=require(_0x9f49('0xe'));var authService=require(_0x9f49('0xf'));var qs=require(_0x9f49('0x10'));var as=require(_0x9f49('0x11'));var hardwareService=require(_0x9f49('0x12'));var logger=require(_0x9f49('0x13'))(_0x9f49('0x14'));var utils=require('../../config/utils');var config=require(_0x9f49('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f49('0x16'))['db'];function respondWithStatusCode(_0x2b8349,_0x20941c){_0x20941c=_0x20941c||0xcc;return function(_0x26ce2f){if(_0x26ce2f){return _0x2b8349['sendStatus'](_0x20941c);}return _0x2b8349[_0x9f49('0x17')](_0x20941c)['end']();};}function respondWithResult(_0x5ac3b4,_0x47992c){_0x47992c=_0x47992c||0xc8;return function(_0x41d718){if(_0x41d718){return _0x5ac3b4[_0x9f49('0x17')](_0x47992c)['json'](_0x41d718);}};}function respondWithFilteredResult(_0x12a7ae,_0x5f045e){return function(_0x41cfae){if(_0x41cfae){var _0x179f1d=typeof _0x5f045e['offset']==='undefined'&&typeof _0x5f045e[_0x9f49('0x18')]===_0x9f49('0x19');var _0x3254a0=_0x41cfae[_0x9f49('0x1a')];var _0x2a9bed=_0x179f1d?0x0:_0x5f045e['offset'];var _0x34a935=_0x179f1d?_0x41cfae[_0x9f49('0x1a')]:_0x5f045e[_0x9f49('0x1b')]+_0x5f045e[_0x9f49('0x18')];var _0x393be9;if(_0x34a935>=_0x3254a0){_0x34a935=_0x3254a0;_0x393be9=0xc8;}else{_0x393be9=0xce;}_0x12a7ae[_0x9f49('0x17')](_0x393be9);return _0x12a7ae['set'](_0x9f49('0x1c'),_0x2a9bed+'-'+_0x34a935+'/'+_0x3254a0)[_0x9f49('0x1d')](_0x41cfae);}return null;};}function patchUpdates(_0x5ce9bd){return function(_0x20e091){try{jsonpatch[_0x9f49('0x1e')](_0x20e091,_0x5ce9bd,!![]);}catch(_0x128eec){return BPromise[_0x9f49('0x1f')](_0x128eec);}return _0x20e091[_0x9f49('0x20')]();};}function saveUpdates(_0x408693,_0x574f3e){return function(_0x598054){if(_0x598054){return _0x598054[_0x9f49('0x21')](_0x408693)[_0x9f49('0x22')](function(_0x3a4c44){return _0x3a4c44;});}return null;};}function removeEntity(_0x27884c,_0x2af623){return function(_0x200a98){if(_0x200a98){return _0x200a98[_0x9f49('0x23')]()[_0x9f49('0x22')](function(){var _0x2d4f1e=_0x200a98[_0x9f49('0x24')]({'plain':!![]});var _0x4a0bd8=_0x9f49('0x25');return db[_0x9f49('0x26')][_0x9f49('0x23')]({'where':{'type':_0x4a0bd8,'resourceId':_0x2d4f1e['id']}})[_0x9f49('0x22')](function(){return _0x200a98;});})[_0x9f49('0x22')](function(){_0x27884c[_0x9f49('0x17')](0xcc)[_0x9f49('0x27')]();});}};}function handleEntityNotFound(_0x204a13,_0x528db7){return function(_0x63ddd9){if(!_0x63ddd9){_0x204a13[_0x9f49('0x28')](0x194);}return _0x63ddd9;};}function handleError(_0x5e4adc,_0x22693c){_0x22693c=_0x22693c||0x1f4;return function(_0x5e8416){logger['error'](_0x5e8416['stack']);if(_0x5e8416[_0x9f49('0x29')]){delete _0x5e8416[_0x9f49('0x29')];}_0x5e4adc[_0x9f49('0x17')](_0x22693c)[_0x9f49('0x2a')](_0x5e8416);};}exports[_0x9f49('0x2b')]=function(_0x3d7c21,_0x4dd163){var _0x3b6fa5={},_0x39d1af={},_0x43b6fc={'count':0x0,'rows':[]};var _0x5f0dfb=_['map'](db[_0x9f49('0x2c')][_0x9f49('0x2d')],function(_0x38165d){return{'name':_0x38165d[_0x9f49('0x2e')],'type':_0x38165d[_0x9f49('0x2f')][_0x9f49('0x30')]};});_0x39d1af[_0x9f49('0x31')]=_[_0x9f49('0x32')](_0x5f0dfb,_0x9f49('0x29'));_0x39d1af['query']=_[_0x9f49('0x33')](_0x3d7c21[_0x9f49('0x34')]);_0x39d1af[_0x9f49('0x35')]=_['intersection'](_0x39d1af['model'],_0x39d1af['query']);_0x3b6fa5[_0x9f49('0x36')]=_[_0x9f49('0x37')](_0x39d1af[_0x9f49('0x31')],qs['fields'](_0x3d7c21[_0x9f49('0x34')][_0x9f49('0x38')]));_0x3b6fa5[_0x9f49('0x36')]=_0x3b6fa5[_0x9f49('0x36')][_0x9f49('0x39')]?_0x3b6fa5['attributes']:_0x39d1af[_0x9f49('0x31')];if(!_0x3d7c21[_0x9f49('0x34')][_0x9f49('0x3a')](_0x9f49('0x3b'))){_0x3b6fa5['limit']=qs['limit'](_0x3d7c21[_0x9f49('0x34')][_0x9f49('0x18')]);_0x3b6fa5[_0x9f49('0x1b')]=qs[_0x9f49('0x1b')](_0x3d7c21['query'][_0x9f49('0x1b')]);}_0x3b6fa5[_0x9f49('0x3c')]=qs[_0x9f49('0x3d')](_0x3d7c21['query'][_0x9f49('0x3d')]);_0x3b6fa5[_0x9f49('0x3e')]=qs[_0x9f49('0x35')](_['pick'](_0x3d7c21[_0x9f49('0x34')],_0x39d1af[_0x9f49('0x35')]),_0x5f0dfb);if(_0x3d7c21[_0x9f49('0x34')]['filter']){_0x3b6fa5[_0x9f49('0x3e')]=_[_0x9f49('0x3f')](_0x3b6fa5[_0x9f49('0x3e')],{'$or':_[_0x9f49('0x32')](_0x5f0dfb,function(_0x2a2638){if(_0x2a2638['type']!=='VIRTUAL'){var _0x4c2c3b={};_0x4c2c3b[_0x2a2638[_0x9f49('0x29')]]={'$like':'%'+_0x3d7c21[_0x9f49('0x34')][_0x9f49('0x40')]+'%'};return _0x4c2c3b;}})});}_0x3b6fa5=_['merge']({},_0x3b6fa5,_0x3d7c21[_0x9f49('0x41')]);var _0x50e8d7={'where':_0x3b6fa5[_0x9f49('0x3e')]};return db['Pause'][_0x9f49('0x1a')](_0x50e8d7)[_0x9f49('0x22')](function(_0x56663a){_0x43b6fc[_0x9f49('0x1a')]=_0x56663a;if(_0x3d7c21[_0x9f49('0x34')]['includeAll']){_0x3b6fa5[_0x9f49('0x42')]=[{'all':!![]}];}return db[_0x9f49('0x2c')]['findAll'](_0x3b6fa5);})[_0x9f49('0x22')](function(_0x164b77){_0x43b6fc[_0x9f49('0x43')]=_0x164b77;return _0x43b6fc;})['then'](respondWithFilteredResult(_0x4dd163,_0x3b6fa5))[_0x9f49('0x44')](handleError(_0x4dd163,null));};exports[_0x9f49('0x45')]=function(_0x12e33a,_0x3bd184){var _0x52e20c={'raw':!![],'where':{'id':_0x12e33a['params']['id']}},_0x2e0490={};_0x2e0490[_0x9f49('0x31')]=_['keys'](db[_0x9f49('0x2c')][_0x9f49('0x2d')]);_0x2e0490[_0x9f49('0x34')]=_[_0x9f49('0x33')](_0x12e33a[_0x9f49('0x34')]);_0x2e0490[_0x9f49('0x35')]=_['intersection'](_0x2e0490[_0x9f49('0x31')],_0x2e0490[_0x9f49('0x34')]);_0x52e20c[_0x9f49('0x36')]=_[_0x9f49('0x37')](_0x2e0490['model'],qs[_0x9f49('0x38')](_0x12e33a[_0x9f49('0x34')]['fields']));_0x52e20c['attributes']=_0x52e20c['attributes'][_0x9f49('0x39')]?_0x52e20c[_0x9f49('0x36')]:_0x2e0490[_0x9f49('0x31')];if(_0x12e33a[_0x9f49('0x34')][_0x9f49('0x46')]){_0x52e20c[_0x9f49('0x42')]=[{'all':!![]}];}_0x52e20c=_['merge']({},_0x52e20c,_0x12e33a[_0x9f49('0x41')]);return db[_0x9f49('0x2c')][_0x9f49('0x47')](_0x52e20c)['then'](handleEntityNotFound(_0x3bd184,null))[_0x9f49('0x22')](respondWithResult(_0x3bd184,null))['catch'](handleError(_0x3bd184,null));};exports[_0x9f49('0x48')]=function(_0x270238,_0x185cc7){return db[_0x9f49('0x2c')][_0x9f49('0x48')](_0x270238['body'],{})[_0x9f49('0x22')](function(_0xa7c337){var _0x155c4a=_0x270238[_0x9f49('0x49')][_0x9f49('0x24')]({'plain':!![]});if(!_0x155c4a)throw new Error(_0x9f49('0x4a'));if(_0x155c4a['role']===_0x9f49('0x49')){var _0x3054d7=_0xa7c337[_0x9f49('0x24')]({'plain':!![]});var _0x1c5746=_0x9f49('0x25');return db[_0x9f49('0x4b')][_0x9f49('0x47')]({'where':{'name':_0x1c5746,'userProfileId':_0x155c4a[_0x9f49('0x4c')]},'raw':!![]})['then'](function(_0xb2f1df){if(_0xb2f1df&&_0xb2f1df[_0x9f49('0x4d')]===0x0){return db['UserProfileResource'][_0x9f49('0x48')]({'name':_0x3054d7[_0x9f49('0x29')],'resourceId':_0x3054d7['id'],'type':_0xb2f1df['name'],'sectionId':_0xb2f1df['id']},{})[_0x9f49('0x22')](function(){return _0xa7c337;});}else{return _0xa7c337;}})[_0x9f49('0x44')](function(_0x587712){logger[_0x9f49('0x4e')](_0x9f49('0x4f'),_0x587712);throw _0x587712;});}return _0xa7c337;})[_0x9f49('0x22')](respondWithResult(_0x185cc7,0xc9))[_0x9f49('0x44')](handleError(_0x185cc7,null));};exports[_0x9f49('0x21')]=function(_0x501b71,_0x20cdde){if(_0x501b71[_0x9f49('0x50')]['id']){delete _0x501b71[_0x9f49('0x50')]['id'];}return db[_0x9f49('0x2c')][_0x9f49('0x47')]({'where':{'id':_0x501b71[_0x9f49('0x51')]['id']}})[_0x9f49('0x22')](handleEntityNotFound(_0x20cdde,null))[_0x9f49('0x22')](saveUpdates(_0x501b71[_0x9f49('0x50')],null))[_0x9f49('0x22')](respondWithResult(_0x20cdde,null))[_0x9f49('0x44')](handleError(_0x20cdde,null));};exports[_0x9f49('0x23')]=function(_0x247394,_0x2f5752){return db['Pause'][_0x9f49('0x47')]({'where':{'id':_0x247394[_0x9f49('0x51')]['id']}})[_0x9f49('0x22')](handleEntityNotFound(_0x2f5752,null))[_0x9f49('0x22')](removeEntity(_0x2f5752,null))[_0x9f49('0x44')](handleError(_0x2f5752,null));}; \ No newline at end of file +var _0xd0c7=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','send','index','map','Pause','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd0c7,0x6f));var _0x7d0c=function(_0x132216,_0x195eeb){_0x132216=_0x132216-0x0;var _0xd36cdb=_0xd0c7[_0x132216];return _0xd36cdb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d0c('0x0'));var jsonpatch=require(_0x7d0c('0x1'));var rp=require(_0x7d0c('0x2'));var moment=require(_0x7d0c('0x3'));var BPromise=require(_0x7d0c('0x4'));var Mustache=require(_0x7d0c('0x5'));var util=require(_0x7d0c('0x6'));var path=require('path');var sox=require(_0x7d0c('0x7'));var csv=require('to-csv');var ejs=require(_0x7d0c('0x8'));var fs=require('fs');var fs_extra=require(_0x7d0c('0x9'));var _=require(_0x7d0c('0xa'));var squel=require(_0x7d0c('0xb'));var crypto=require(_0x7d0c('0xc'));var jsforce=require(_0x7d0c('0xd'));var deskjs=require(_0x7d0c('0xe'));var toCsv=require(_0x7d0c('0xf'));var querystring=require(_0x7d0c('0x10'));var Papa=require(_0x7d0c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d0c('0x12'));var hardwareService=require(_0x7d0c('0x13'));var logger=require(_0x7d0c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7d0c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d0c('0x16'))['db'];function respondWithStatusCode(_0x40f009,_0x285c26){_0x285c26=_0x285c26||0xcc;return function(_0x30129d){if(_0x30129d){return _0x40f009[_0x7d0c('0x17')](_0x285c26);}return _0x40f009[_0x7d0c('0x18')](_0x285c26)[_0x7d0c('0x19')]();};}function respondWithResult(_0x11543c,_0x1adf11){_0x1adf11=_0x1adf11||0xc8;return function(_0x5589cf){if(_0x5589cf){return _0x11543c['status'](_0x1adf11)[_0x7d0c('0x1a')](_0x5589cf);}};}function respondWithFilteredResult(_0x5c6aea,_0x16a599){return function(_0x2f3d39){if(_0x2f3d39){var _0x2d74cf=typeof _0x16a599[_0x7d0c('0x1b')]===_0x7d0c('0x1c')&&typeof _0x16a599[_0x7d0c('0x1d')]===_0x7d0c('0x1c');var _0x39023e=_0x2f3d39[_0x7d0c('0x1e')];var _0x354b14=_0x2d74cf?0x0:_0x16a599[_0x7d0c('0x1b')];var _0xfc0b58=_0x2d74cf?_0x2f3d39[_0x7d0c('0x1e')]:_0x16a599[_0x7d0c('0x1b')]+_0x16a599['limit'];var _0x559441;if(_0xfc0b58>=_0x39023e){_0xfc0b58=_0x39023e;_0x559441=0xc8;}else{_0x559441=0xce;}_0x5c6aea[_0x7d0c('0x18')](_0x559441);return _0x5c6aea[_0x7d0c('0x1f')](_0x7d0c('0x20'),_0x354b14+'-'+_0xfc0b58+'/'+_0x39023e)[_0x7d0c('0x1a')](_0x2f3d39);}return null;};}function patchUpdates(_0x2f44c1){return function(_0x4b5eef){try{jsonpatch[_0x7d0c('0x21')](_0x4b5eef,_0x2f44c1,!![]);}catch(_0x3e4a50){return BPromise[_0x7d0c('0x22')](_0x3e4a50);}return _0x4b5eef[_0x7d0c('0x23')]();};}function saveUpdates(_0x3369e4,_0xbe0f8a){return function(_0x3357b5){if(_0x3357b5){return _0x3357b5[_0x7d0c('0x24')](_0x3369e4)[_0x7d0c('0x25')](function(_0x4c9ad4){return _0x4c9ad4;});}return null;};}function removeEntity(_0x54c355,_0x3dde6f){return function(_0x4f22da){if(_0x4f22da){return _0x4f22da[_0x7d0c('0x26')]()[_0x7d0c('0x25')](function(){var _0x1c001a=_0x4f22da[_0x7d0c('0x27')]({'plain':!![]});var _0x151628=_0x7d0c('0x28');return db[_0x7d0c('0x29')][_0x7d0c('0x26')]({'where':{'type':_0x151628,'resourceId':_0x1c001a['id']}})[_0x7d0c('0x25')](function(){return _0x4f22da;});})[_0x7d0c('0x25')](function(){_0x54c355['status'](0xcc)[_0x7d0c('0x19')]();});}};}function handleEntityNotFound(_0x42d426,_0x5330dc){return function(_0x10af49){if(!_0x10af49){_0x42d426[_0x7d0c('0x17')](0x194);}return _0x10af49;};}function handleError(_0xa2d5fe,_0x3d1855){_0x3d1855=_0x3d1855||0x1f4;return function(_0x29f42e){logger[_0x7d0c('0x2a')](_0x29f42e[_0x7d0c('0x2b')]);if(_0x29f42e['name']){delete _0x29f42e['name'];}_0xa2d5fe[_0x7d0c('0x18')](_0x3d1855)[_0x7d0c('0x2c')](_0x29f42e);};}exports[_0x7d0c('0x2d')]=function(_0x2a2e4f,_0x422384){var _0x35ee20={},_0x4c29c0={},_0x1c629a={'count':0x0,'rows':[]};var _0x358786=_[_0x7d0c('0x2e')](db[_0x7d0c('0x2f')][_0x7d0c('0x30')],function(_0x4cffdf){return{'name':_0x4cffdf[_0x7d0c('0x31')],'type':_0x4cffdf[_0x7d0c('0x32')][_0x7d0c('0x33')]};});_0x4c29c0[_0x7d0c('0x34')]=_['map'](_0x358786,_0x7d0c('0x35'));_0x4c29c0[_0x7d0c('0x36')]=_['keys'](_0x2a2e4f['query']);_0x4c29c0[_0x7d0c('0x37')]=_[_0x7d0c('0x38')](_0x4c29c0[_0x7d0c('0x34')],_0x4c29c0['query']);_0x35ee20[_0x7d0c('0x39')]=_[_0x7d0c('0x38')](_0x4c29c0[_0x7d0c('0x34')],qs[_0x7d0c('0x3a')](_0x2a2e4f[_0x7d0c('0x36')][_0x7d0c('0x3a')]));_0x35ee20['attributes']=_0x35ee20[_0x7d0c('0x39')][_0x7d0c('0x3b')]?_0x35ee20[_0x7d0c('0x39')]:_0x4c29c0[_0x7d0c('0x34')];if(!_0x2a2e4f[_0x7d0c('0x36')][_0x7d0c('0x3c')](_0x7d0c('0x3d'))){_0x35ee20[_0x7d0c('0x1d')]=qs['limit'](_0x2a2e4f[_0x7d0c('0x36')]['limit']);_0x35ee20[_0x7d0c('0x1b')]=qs[_0x7d0c('0x1b')](_0x2a2e4f[_0x7d0c('0x36')][_0x7d0c('0x1b')]);}_0x35ee20[_0x7d0c('0x3e')]=qs['sort'](_0x2a2e4f[_0x7d0c('0x36')][_0x7d0c('0x3f')]);_0x35ee20[_0x7d0c('0x40')]=qs[_0x7d0c('0x37')](_[_0x7d0c('0x41')](_0x2a2e4f[_0x7d0c('0x36')],_0x4c29c0[_0x7d0c('0x37')]),_0x358786);if(_0x2a2e4f['query'][_0x7d0c('0x42')]){_0x35ee20[_0x7d0c('0x40')]=_[_0x7d0c('0x43')](_0x35ee20['where'],{'$or':_['map'](_0x358786,function(_0xff0820){if(_0xff0820['type']!==_0x7d0c('0x44')){var _0x1d107b={};_0x1d107b[_0xff0820[_0x7d0c('0x35')]]={'$like':'%'+_0x2a2e4f[_0x7d0c('0x36')][_0x7d0c('0x42')]+'%'};return _0x1d107b;}})});}_0x35ee20=_[_0x7d0c('0x43')]({},_0x35ee20,_0x2a2e4f['options']);var _0x4e5f83={'where':_0x35ee20['where']};return db[_0x7d0c('0x2f')][_0x7d0c('0x1e')](_0x4e5f83)[_0x7d0c('0x25')](function(_0x3df666){_0x1c629a[_0x7d0c('0x1e')]=_0x3df666;if(_0x2a2e4f['query'][_0x7d0c('0x45')]){_0x35ee20[_0x7d0c('0x46')]=[{'all':!![]}];}return db[_0x7d0c('0x2f')][_0x7d0c('0x47')](_0x35ee20);})[_0x7d0c('0x25')](function(_0xf3a610){_0x1c629a['rows']=_0xf3a610;return _0x1c629a;})['then'](respondWithFilteredResult(_0x422384,_0x35ee20))[_0x7d0c('0x48')](handleError(_0x422384,null));};exports[_0x7d0c('0x49')]=function(_0x52adaf,_0x134faa){var _0x45e35c={'raw':!![],'where':{'id':_0x52adaf[_0x7d0c('0x4a')]['id']}},_0x373833={};_0x373833[_0x7d0c('0x34')]=_['keys'](db['Pause'][_0x7d0c('0x30')]);_0x373833[_0x7d0c('0x36')]=_[_0x7d0c('0x4b')](_0x52adaf[_0x7d0c('0x36')]);_0x373833[_0x7d0c('0x37')]=_['intersection'](_0x373833[_0x7d0c('0x34')],_0x373833['query']);_0x45e35c[_0x7d0c('0x39')]=_[_0x7d0c('0x38')](_0x373833[_0x7d0c('0x34')],qs['fields'](_0x52adaf[_0x7d0c('0x36')][_0x7d0c('0x3a')]));_0x45e35c[_0x7d0c('0x39')]=_0x45e35c[_0x7d0c('0x39')]['length']?_0x45e35c[_0x7d0c('0x39')]:_0x373833[_0x7d0c('0x34')];if(_0x52adaf[_0x7d0c('0x36')][_0x7d0c('0x45')]){_0x45e35c['include']=[{'all':!![]}];}_0x45e35c=_[_0x7d0c('0x43')]({},_0x45e35c,_0x52adaf[_0x7d0c('0x4c')]);return db['Pause'][_0x7d0c('0x4d')](_0x45e35c)['then'](handleEntityNotFound(_0x134faa,null))['then'](respondWithResult(_0x134faa,null))[_0x7d0c('0x48')](handleError(_0x134faa,null));};exports['create']=function(_0x4feef6,_0x302064){return db[_0x7d0c('0x2f')][_0x7d0c('0x4e')](_0x4feef6['body'],{})[_0x7d0c('0x25')](function(_0x1bfb53){var _0x4b7000=_0x4feef6[_0x7d0c('0x4f')][_0x7d0c('0x27')]({'plain':!![]});if(!_0x4b7000)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b7000[_0x7d0c('0x50')]===_0x7d0c('0x4f')){var _0x493b81=_0x1bfb53['get']({'plain':!![]});var _0x29f0aa=_0x7d0c('0x28');return db[_0x7d0c('0x51')][_0x7d0c('0x4d')]({'where':{'name':_0x29f0aa,'userProfileId':_0x4b7000[_0x7d0c('0x52')]},'raw':!![]})[_0x7d0c('0x25')](function(_0x17c2d2){if(_0x17c2d2&&_0x17c2d2['autoAssociation']===0x0){return db[_0x7d0c('0x29')]['create']({'name':_0x493b81[_0x7d0c('0x35')],'resourceId':_0x493b81['id'],'type':_0x17c2d2[_0x7d0c('0x35')],'sectionId':_0x17c2d2['id']},{})['then'](function(){return _0x1bfb53;});}else{return _0x1bfb53;}})[_0x7d0c('0x48')](function(_0xd0eb58){logger['error'](_0x7d0c('0x53'),_0xd0eb58);throw _0xd0eb58;});}return _0x1bfb53;})[_0x7d0c('0x25')](respondWithResult(_0x302064,0xc9))[_0x7d0c('0x48')](handleError(_0x302064,null));};exports['update']=function(_0xce1e24,_0x20bba3){if(_0xce1e24[_0x7d0c('0x54')]['id']){delete _0xce1e24[_0x7d0c('0x54')]['id'];}return db[_0x7d0c('0x2f')][_0x7d0c('0x4d')]({'where':{'id':_0xce1e24[_0x7d0c('0x4a')]['id']}})[_0x7d0c('0x25')](handleEntityNotFound(_0x20bba3,null))[_0x7d0c('0x25')](saveUpdates(_0xce1e24[_0x7d0c('0x54')],null))['then'](respondWithResult(_0x20bba3,null))['catch'](handleError(_0x20bba3,null));};exports[_0x7d0c('0x26')]=function(_0x3c5ca8,_0xa7bae6){return db['Pause'][_0x7d0c('0x4d')]({'where':{'id':_0x3c5ca8[_0x7d0c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa7bae6,null))[_0x7d0c('0x25')](removeEntity(_0xa7bae6,null))['catch'](handleError(_0xa7bae6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f3f8db0..96ba81a 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x33a5ec,_0x10c014){_0x33a5ec=_0x33a5ec-0x0;var _0x38f89c=_0x7fbe[_0x33a5ec];return _0x38f89c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x50ac2f,_0x32d154){var _0x18511e=function(_0x129a3c){while(--_0x129a3c){_0x50ac2f['push'](_0x50ac2f['shift']());}};_0x18511e(++_0x32d154);}(_0x8ef6,0xf2));var _0x68ef=function(_0x49f3db,_0x3752e2){_0x49f3db=_0x49f3db-0x0;var _0x1f53fb=_0x8ef6[_0x49f3db];return _0x1f53fb;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 4f7dd3c..cf06770 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(_0x4a4c1d,_0x26510b){var _0x3bd8a0=function(_0x1b54e7){while(--_0x1b54e7){_0x4a4c1d['push'](_0x4a4c1d['shift']());}};_0x3bd8a0(++_0x26510b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0xb10b[_0x4254e7];return _0x5e0844;};'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(_0x4e8bd7,_0x344542){var _0x1a7b33=function(_0x532c7b){while(--_0x532c7b){_0x4e8bd7['push'](_0x4e8bd7['shift']());}};_0x1a7b33(++_0x344542);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fa66c,_0x51f9a3){_0x4fa66c=_0x4fa66c-0x0;var _0x9b192b=_0xb10b[_0x4fa66c];return _0x9b192b;};'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 dbbdfa7..de0d6c5 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x278a9d,_0x4589d4){var _0x956b6f=function(_0x275dc2){while(--_0x275dc2){_0x278a9d['push'](_0x278a9d['shift']());}};_0x956b6f(++_0x4589d4);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0xcb99[_0x4e6cbb];return _0x15ced4;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4bc3=['single','file','webhookPost','put','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x2f3b29,_0x10c754){var _0x22b78b=function(_0x124427){while(--_0x124427){_0x2f3b29['push'](_0x2f3b29['shift']());}};_0x22b78b(++_0x10c754);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x4bc3[_0x4a7631];return _0x1a5a6f;};'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')]('/webhook',controller['webhookGet']);router[_0x34bc('0x9')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xc')]);router[_0x34bc('0x9')](_0x34bc('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x34bc('0xe')]({'destination':function(_0x33025c,_0x2a35f3,_0x5a608a){_0x5a608a(null,path[_0x34bc('0xf')](config['root'],_0x34bc('0x10')));},'filename':function(_0x124b87,_0x164fb2,_0x536ebd){_0x164fb2[_0x34bc('0x11')]=_0x164fb2['originalname'][_0x34bc('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x536ebd(null,util[_0x34bc('0x13')](_0x34bc('0x14'),path['basename'](_0x164fb2['originalname'],path[_0x34bc('0x15')](_0x164fb2['originalname'])),Date[_0x34bc('0x16')](),path[_0x34bc('0x15')](_0x164fb2[_0x34bc('0x11')])));}})});router[_0x34bc('0x17')]('/',upload[_0x34bc('0x18')](_0x34bc('0x19')),controller['upload']);router['post']('/webhook',controller[_0x34bc('0x1a')]);router[_0x34bc('0x1b')](_0x34bc('0xb'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x1c')](_0x34bc('0xb'),auth['isAuthenticated'](),controller[_0x34bc('0x1c')]);module[_0x34bc('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 52a584b..b582ce5 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 _0xfe9d=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never'];(function(_0x6af1d6,_0x350b0a){var _0x10c00b=function(_0x1a0523){while(--_0x1a0523){_0x6af1d6['push'](_0x6af1d6['shift']());}};_0x10c00b(++_0x350b0a);}(_0xfe9d,0x1a1));var _0xdfe9=function(_0x2b44d0,_0x4df26c){_0x2b44d0=_0x2b44d0-0x0;var _0x45fc61=_0xfe9d[_0x2b44d0];return _0x45fc61;};'use strict';var Sequelize=require(_0xdfe9('0x0'));module[_0xdfe9('0x1')]={'name':{'type':Sequelize[_0xdfe9('0x2')]},'type':{'type':Sequelize[_0xdfe9('0x3')](_0xdfe9('0x4'),_0xdfe9('0x5'))},'description':{'type':Sequelize[_0xdfe9('0x6')]},'version':{'type':Sequelize[_0xdfe9('0x6')]},'path':{'type':Sequelize[_0xdfe9('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xdfe9('0x7')],'defaultValue':0x0,'comment':_0xdfe9('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xdfe9('0x9'),'agentOnly',_0xdfe9('0xa'),_0xdfe9('0xb')),'defaultValue':'always','comment':_0xdfe9('0xc')},'icon':{'type':Sequelize[_0xdfe9('0x2')]},'adminUrl':{'type':Sequelize[_0xdfe9('0x2')]},'agentUrl':{'type':Sequelize[_0xdfe9('0x2')]},'scriptName':{'type':Sequelize[_0xdfe9('0x2')]},'scriptPath':{'type':Sequelize[_0xdfe9('0x2')]}}; \ No newline at end of file +var _0xaf44=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING','ENUM','html','script','TEXT'];(function(_0x2bb368,_0x4d133d){var _0x1a67d6=function(_0x53f85f){while(--_0x53f85f){_0x2bb368['push'](_0x2bb368['shift']());}};_0x1a67d6(++_0x4d133d);}(_0xaf44,0x139));var _0x4af4=function(_0xcfcf00,_0xf16dd0){_0xcfcf00=_0xcfcf00-0x0;var _0x4d9b6b=_0xaf44[_0xcfcf00];return _0x4d9b6b;};'use strict';var Sequelize=require('sequelize');module[_0x4af4('0x0')]={'name':{'type':Sequelize[_0x4af4('0x1')]},'type':{'type':Sequelize[_0x4af4('0x2')](_0x4af4('0x3'),_0x4af4('0x4'))},'description':{'type':Sequelize[_0x4af4('0x5')]},'version':{'type':Sequelize[_0x4af4('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4af4('0x6')},'sidebar':{'type':Sequelize[_0x4af4('0x2')](_0x4af4('0x7'),_0x4af4('0x8'),_0x4af4('0x9'),_0x4af4('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4af4('0x1')]},'adminUrl':{'type':Sequelize[_0x4af4('0x1')]},'agentUrl':{'type':Sequelize[_0x4af4('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4af4('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2e62219..0b67398 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 _0x1eb1=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','http://localhost:','method','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','extract-zip','archiver','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','./plugin.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','keys','includeAll','include','options','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','admin','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Plugins'];(function(_0x3a0633,_0x120c59){var _0x58341e=function(_0x1ecb29){while(--_0x1ecb29){_0x3a0633['push'](_0x3a0633['shift']());}};_0x58341e(++_0x120c59);}(_0x1eb1,0xc7));var _0x11eb=function(_0x208bf0,_0x34c7ca){_0x208bf0=_0x208bf0-0x0;var _0x37b822=_0x1eb1[_0x208bf0];return _0x37b822;};'use strict';var emlformat=require(_0x11eb('0x0'));var rimraf=require(_0x11eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x11eb('0x2'));var moment=require(_0x11eb('0x3'));var BPromise=require(_0x11eb('0x4'));var Mustache=require('mustache');var util=require(_0x11eb('0x5'));var path=require(_0x11eb('0x6'));var sox=require(_0x11eb('0x7'));var csv=require(_0x11eb('0x8'));var ejs=require(_0x11eb('0x9'));var fs=require('fs');var fs_extra=require(_0x11eb('0xa'));var _=require('lodash');var squel=require(_0x11eb('0xb'));var crypto=require('crypto');var jsforce=require(_0x11eb('0xc'));var deskjs=require(_0x11eb('0xd'));var toCsv=require(_0x11eb('0x8'));var querystring=require('querystring');var Papa=require(_0x11eb('0xe'));var extract=require(_0x11eb('0xf'));var rimraf=require(_0x11eb('0x1'));var archiver=require(_0x11eb('0x10'));var Redis=require(_0x11eb('0x11'));var authService=require(_0x11eb('0x12'));var qs=require(_0x11eb('0x13'));var as=require(_0x11eb('0x14'));var hardwareService=require(_0x11eb('0x15'));var logger=require(_0x11eb('0x16'))(_0x11eb('0x17'));var utils=require('../../config/utils');var config=require(_0x11eb('0x18'));var licenseUtil=require(_0x11eb('0x19'));var db=require('../../mysqldb')['db'];config[_0x11eb('0x1a')]=_[_0x11eb('0x1b')](config[_0x11eb('0x1a')],{'host':_0x11eb('0x1c'),'port':0x18eb});var socket=require(_0x11eb('0x1d'))(new Redis(config['redis']));require(_0x11eb('0x1e'))['register'](socket);function respondWithStatusCode(_0x13661e,_0x407eaa){_0x407eaa=_0x407eaa||0xcc;return function(_0x5cad32){if(_0x5cad32){return _0x13661e[_0x11eb('0x1f')](_0x407eaa);}return _0x13661e['status'](_0x407eaa)[_0x11eb('0x20')]();};}function respondWithResult(_0x58f8f3,_0x226546){_0x226546=_0x226546||0xc8;return function(_0x12393e){if(_0x12393e){return _0x58f8f3[_0x11eb('0x21')](_0x226546)[_0x11eb('0x22')](_0x12393e);}};}function respondWithFilteredResult(_0x33790b,_0x2d5715){return function(_0x33199b){if(_0x33199b){var _0x21c080=typeof _0x2d5715[_0x11eb('0x23')]===_0x11eb('0x24')&&typeof _0x2d5715[_0x11eb('0x25')]===_0x11eb('0x24');var _0x5b11b8=_0x33199b[_0x11eb('0x26')];var _0x5cd146=_0x21c080?0x0:_0x2d5715['offset'];var _0x14a5c7=_0x21c080?_0x33199b['count']:_0x2d5715[_0x11eb('0x23')]+_0x2d5715[_0x11eb('0x25')];var _0x1d1845;if(_0x14a5c7>=_0x5b11b8){_0x14a5c7=_0x5b11b8;_0x1d1845=0xc8;}else{_0x1d1845=0xce;}_0x33790b[_0x11eb('0x21')](_0x1d1845);return _0x33790b[_0x11eb('0x27')](_0x11eb('0x28'),_0x5cd146+'-'+_0x14a5c7+'/'+_0x5b11b8)['json'](_0x33199b);}return null;};}function patchUpdates(_0x3d6336){return function(_0x22ed79){try{jsonpatch['apply'](_0x22ed79,_0x3d6336,!![]);}catch(_0x29a845){return BPromise['reject'](_0x29a845);}return _0x22ed79[_0x11eb('0x29')]();};}function saveUpdates(_0x9e1841,_0x71696f){return function(_0x513703){if(_0x513703){return _0x513703[_0x11eb('0x2a')](_0x9e1841)[_0x11eb('0x2b')](function(_0x284bec){return _0x284bec;});}return null;};}function removeEntity(_0x38197b,_0x34e1b1){return function(_0x3b761d){if(_0x3b761d){return _0x3b761d[_0x11eb('0x2c')]()['then'](function(){var _0x3ec7e9=_0x3b761d['get']({'plain':!![]});var _0x63f192='Plugins';return db[_0x11eb('0x2d')]['destroy']({'where':{'type':_0x63f192,'resourceId':_0x3ec7e9['id']}})[_0x11eb('0x2b')](function(){return _0x3b761d;});})[_0x11eb('0x2b')](function(){_0x38197b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4155c3,_0x1e50fd){return function(_0x34a0d2){if(!_0x34a0d2){_0x4155c3[_0x11eb('0x1f')](0x194);}return _0x34a0d2;};}function handleError(_0x1c06ea,_0x1a0d12){_0x1a0d12=_0x1a0d12||0x1f4;return function(_0x15477c){logger[_0x11eb('0x2e')](_0x15477c[_0x11eb('0x2f')]);if(_0x15477c[_0x11eb('0x30')]){delete _0x15477c[_0x11eb('0x30')];}_0x1c06ea['status'](_0x1a0d12)['send'](_0x15477c);};}exports[_0x11eb('0x31')]=function(_0x189471,_0x51776d){var _0x2d146f={},_0x92b620={},_0x35a5da={'count':0x0,'rows':[]};var _0x31e05e=_[_0x11eb('0x32')](db[_0x11eb('0x33')]['rawAttributes'],function(_0x2a2b62){return{'name':_0x2a2b62[_0x11eb('0x34')],'type':_0x2a2b62[_0x11eb('0x35')][_0x11eb('0x36')]};});_0x92b620[_0x11eb('0x37')]=_['map'](_0x31e05e,'name');_0x92b620[_0x11eb('0x38')]=_['keys'](_0x189471['query']);_0x92b620[_0x11eb('0x39')]=_[_0x11eb('0x3a')](_0x92b620[_0x11eb('0x37')],_0x92b620[_0x11eb('0x38')]);_0x2d146f['attributes']=_[_0x11eb('0x3a')](_0x92b620[_0x11eb('0x37')],qs[_0x11eb('0x3b')](_0x189471[_0x11eb('0x38')][_0x11eb('0x3b')]));_0x2d146f[_0x11eb('0x3c')]=_0x2d146f[_0x11eb('0x3c')][_0x11eb('0x3d')]?_0x2d146f[_0x11eb('0x3c')]:_0x92b620['model'];if(!_0x189471[_0x11eb('0x38')][_0x11eb('0x3e')](_0x11eb('0x3f'))){_0x2d146f[_0x11eb('0x25')]=qs[_0x11eb('0x25')](_0x189471['query'][_0x11eb('0x25')]);_0x2d146f['offset']=qs[_0x11eb('0x23')](_0x189471[_0x11eb('0x38')][_0x11eb('0x23')]);}_0x2d146f[_0x11eb('0x40')]=qs[_0x11eb('0x41')](_0x189471[_0x11eb('0x38')][_0x11eb('0x41')]);_0x2d146f[_0x11eb('0x42')]=qs[_0x11eb('0x39')](_[_0x11eb('0x43')](_0x189471[_0x11eb('0x38')],_0x92b620[_0x11eb('0x39')]),_0x31e05e);if(_0x189471['query'][_0x11eb('0x44')]){_0x2d146f[_0x11eb('0x42')]=_[_0x11eb('0x45')](_0x2d146f[_0x11eb('0x42')],{'$or':_['map'](_0x31e05e,function(_0x5a9cdf){if(_0x5a9cdf['type']!==_0x11eb('0x46')){var _0x5607e3={};_0x5607e3[_0x5a9cdf[_0x11eb('0x30')]]={'$like':'%'+_0x189471['query'][_0x11eb('0x44')]+'%'};return _0x5607e3;}})});}_0x2d146f=_[_0x11eb('0x45')]({},_0x2d146f,_0x189471['options']);var _0x59c74c={'where':_0x2d146f['where']};return db['Plugin'][_0x11eb('0x26')](_0x59c74c)[_0x11eb('0x2b')](function(_0x4388fa){_0x35a5da[_0x11eb('0x26')]=_0x4388fa;if(_0x189471['query']['includeAll']){_0x2d146f['include']=[{'all':!![]}];}return db['Plugin'][_0x11eb('0x47')](_0x2d146f);})[_0x11eb('0x2b')](function(_0x492040){_0x35a5da['rows']=_0x492040;return _0x35a5da;})[_0x11eb('0x2b')](respondWithFilteredResult(_0x51776d,_0x2d146f))[_0x11eb('0x48')](handleError(_0x51776d,null));};exports[_0x11eb('0x49')]=function(_0x1acfa1,_0x48b637){var _0x378161={'raw':!![],'where':{'id':_0x1acfa1[_0x11eb('0x4a')]['id']}},_0x1e5f1d={};_0x1e5f1d[_0x11eb('0x37')]=_['keys'](db[_0x11eb('0x33')]['rawAttributes']);_0x1e5f1d[_0x11eb('0x38')]=_[_0x11eb('0x4b')](_0x1acfa1[_0x11eb('0x38')]);_0x1e5f1d[_0x11eb('0x39')]=_[_0x11eb('0x3a')](_0x1e5f1d['model'],_0x1e5f1d[_0x11eb('0x38')]);_0x378161['attributes']=_['intersection'](_0x1e5f1d[_0x11eb('0x37')],qs[_0x11eb('0x3b')](_0x1acfa1[_0x11eb('0x38')][_0x11eb('0x3b')]));_0x378161[_0x11eb('0x3c')]=_0x378161[_0x11eb('0x3c')][_0x11eb('0x3d')]?_0x378161[_0x11eb('0x3c')]:_0x1e5f1d[_0x11eb('0x37')];if(_0x1acfa1[_0x11eb('0x38')][_0x11eb('0x4c')]){_0x378161[_0x11eb('0x4d')]=[{'all':!![]}];}_0x378161=_[_0x11eb('0x45')]({},_0x378161,_0x1acfa1[_0x11eb('0x4e')]);return db[_0x11eb('0x33')]['find'](_0x378161)[_0x11eb('0x2b')](handleEntityNotFound(_0x48b637,null))[_0x11eb('0x2b')](respondWithResult(_0x48b637,null))[_0x11eb('0x48')](handleError(_0x48b637,null));};exports[_0x11eb('0x4f')]=function(_0x4017d3,_0x1e613a,_0xf264ac){return db[_0x11eb('0x33')]['find']({'where':{'id':_0x4017d3[_0x11eb('0x4a')]['id']},'attributes':[_0x11eb('0x30'),_0x11eb('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x1e613a,null))[_0x11eb('0x2b')](function(_0x368497){if(_0x368497){var _0x2050f5=path[_0x11eb('0x50')](config[_0x11eb('0x51')],_0x11eb('0x52'),util[_0x11eb('0x53')]('%s.zip',path[_0x11eb('0x54')](_0x368497['path'])));var _0x521c58=fs[_0x11eb('0x55')](_0x2050f5);var _0x28710f=archiver(_0x11eb('0x56'),{'zlib':{'level':0x9}});_0x28710f['on'](_0x11eb('0x57'),function(_0x25f284){if(_0x25f284[_0x11eb('0x58')]==='ENOENT'){logger[_0x11eb('0x2e')](_0x25f284);}else{throw new db[(_0x11eb('0x59'))][(_0x11eb('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x28710f['on'](_0x11eb('0x2e'),function(_0x36eb07){throw new db['Sequelize'][(_0x11eb('0x5a'))](_0x11eb('0x5b'));});_0x28710f[_0x11eb('0x5c')](_0x521c58);_0x28710f['glob'](_0x11eb('0x5d'),{'cwd':path[_0x11eb('0x50')](config[_0x11eb('0x51')],'server/files/plugins',path[_0x11eb('0x5e')](_0x368497[_0x11eb('0x6')])),'ignore':[path[_0x11eb('0x50')](path[_0x11eb('0x54')](_0x368497[_0x11eb('0x6')]),'node_modules/**/*'),path[_0x11eb('0x50')](path[_0x11eb('0x54')](_0x368497[_0x11eb('0x6')]),_0x11eb('0x5f'))],'nodir':!![]})['finalize']();_0x521c58['on'](_0x11eb('0x60'),function(){if(!fs[_0x11eb('0x61')](_0x2050f5)){throw new db[(_0x11eb('0x59'))][(_0x11eb('0x5a'))](_0x11eb('0x62'));}return _0x1e613a[_0x11eb('0x4f')](_0x2050f5,util[_0x11eb('0x53')](_0x11eb('0x63'),path[_0x11eb('0x54')](_0x368497[_0x11eb('0x6')])),function(_0x22cb0f){if(_0x22cb0f){throw new db[(_0x11eb('0x59'))]['Error'](_0x11eb('0x64'));}fs['unlinkSync'](_0x2050f5);logger['info'](_0x11eb('0x65'));logger['info'](_0x11eb('0x66'));});});}return null;})[_0x11eb('0x48')](handleError(_0x1e613a,null));};exports[_0x11eb('0x67')]=function(_0x3b1f54,_0x375301,_0x388825){var _0x43a6e4=path[_0x11eb('0x54')](_0x3b1f54[_0x11eb('0x68')][_0x11eb('0x69')],path[_0x11eb('0x6a')](_0x3b1f54[_0x11eb('0x68')][_0x11eb('0x69')]));var _0x1155ff=path['join'](config[_0x11eb('0x51')],_0x11eb('0x52'),_0x3b1f54[_0x11eb('0x68')][_0x11eb('0x69')]);var _0x47140a=path[_0x11eb('0x50')](config['root'],_0x11eb('0x52'),_0x43a6e4);logger[_0x11eb('0x6b')](_0x11eb('0x6c'),_0x1155ff);logger[_0x11eb('0x6b')](_0x11eb('0x6d'),_0x47140a);try{fs[_0x11eb('0x6e')](_0x1155ff,parseInt('0777',0x8));extract(_0x1155ff,{'dir':_0x47140a},function(_0x4f7628){if(_0x4f7628){logger[_0x11eb('0x2e')](_0x4f7628);handleError(_0x4f7628,!![]);};var _0x408298=fs[_0x11eb('0x6f')](_0x47140a);if(_0x408298['length']>0x1){removeReferences(_0x1155ff,_0x47140a);logger[_0x11eb('0x2e')](_0x11eb('0x70'));return _0x388825(new Error('Invalid\x20plugin\x20structure'));}var _0x13973b=fs[_0x11eb('0x71')](path[_0x11eb('0x50')](_0x47140a,_0x408298[0x0]));if(_0x13973b[_0x11eb('0x72')]()){removeReferences(_0x1155ff,_0x47140a);logger[_0x11eb('0x2e')](_0x11eb('0x70'));return _0x388825(new Error(_0x11eb('0x70')));}if(_0x13973b[_0x11eb('0x73')]()){var _0x2f2877=fs[_0x11eb('0x6f')](path[_0x11eb('0x50')](_0x47140a,_0x408298[0x0]));if(_0x2f2877[_0x11eb('0x3d')]===0x0){removeReferences(_0x1155ff,_0x47140a);logger[_0x11eb('0x2e')](_0x11eb('0x70'));return _0x388825(new Error(_0x11eb('0x70')));}var _0x4c6109=_0x2f2877[_0x11eb('0x74')](function(_0x46f5ac){return _0x46f5ac===_0x11eb('0x75');});if(!_0x4c6109){return _0x388825(new Error('Plugin\x20manifest\x20missing'));}var _0x51a4d9=fs[_0x11eb('0x76')](path['join'](_0x47140a,_0x408298[0x0],'manifest.json'));var _0x4eac42=JSON[_0x11eb('0x77')](_0x51a4d9);if('undefined'==typeof _0x4eac42['name']){return _0x388825(new Error(_0x11eb('0x78')));}if(_0x11eb('0x24')==typeof _0x4eac42['type']){return _0x388825(new Error(_0x11eb('0x79')));}if('undefined'==typeof _0x4eac42['version']){return _0x388825(new Error(_0x11eb('0x7a')));}if('undefined'==typeof _0x4eac42[_0x11eb('0x7b')]){return _0x388825(new Error(_0x11eb('0x7c')));}if(_0x4eac42[_0x11eb('0x35')]===_0x11eb('0x7d')){if('undefined'==typeof _0x4eac42[_0x11eb('0x7b')]['views']){return _0x388825(new Error(_0x11eb('0x7e')));}if(_0x11eb('0x24')==typeof _0x4eac42['parameters'][_0x11eb('0x7f')]['admin']&&_0x11eb('0x24')==typeof _0x4eac42[_0x11eb('0x7b')]['views'][_0x11eb('0x80')]){return _0x388825(new Error(_0x11eb('0x81')));}}else if(_0x4eac42[_0x11eb('0x35')]===_0x11eb('0x82')){if(_0x11eb('0x24')==typeof _0x4eac42[_0x11eb('0x7b')]['scriptName']){return _0x388825(new Error(_0x11eb('0x83')));}if(_0x11eb('0x24')==typeof _0x4eac42['parameters'][_0x11eb('0x84')]){return _0x388825(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x388825(new Error(_0x11eb('0x85')));}var _0x2ac20d=_0x4eac42[_0x11eb('0x30')];var _0x3d0beb=_0x4eac42[_0x11eb('0x86')];var _0x20e5d1=_0x4eac42[_0x11eb('0x35')];var _0x1cd344=_0x4eac42[_0x11eb('0x87')]?_0x4eac42[_0x11eb('0x87')]:_0x11eb('0x88');var _0x1ff5cc=_0x4eac42[_0x11eb('0x89')]?_0x4eac42[_0x11eb('0x89')]:_0x11eb('0x8a');var _0x5e62f3='';var _0x285c7d='';var _0x2c8739='';var _0x159167='';var _0x123b39=_0x4eac42[_0x11eb('0x8b')];if(_0x20e5d1===_0x11eb('0x7d')){if(_0x11eb('0x24')!=typeof _0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')]['admin']){var _0x246520=_0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')][_0x11eb('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x11eb('0x8d')](_0x246520)){_0x5e62f3=path[_0x11eb('0x50')]('plugins',_0x43a6e4,_0x408298[0x0],_0x246520);}else{_0x5e62f3=_0x246520;}}else{logger[_0x11eb('0x6b')](_0x11eb('0x8e'));}if(_0x11eb('0x24')!=typeof _0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')]['agent']){var _0x1a3b75=_0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')][_0x11eb('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x11eb('0x8d')](_0x1a3b75)){_0x285c7d=path[_0x11eb('0x50')]('plugins',_0x43a6e4,_0x408298[0x0],_0x1a3b75);}else{_0x285c7d=_0x1a3b75;}}else{logger[_0x11eb('0x6b')](_0x11eb('0x8f'));}}else if(_0x20e5d1===_0x11eb('0x82')){_0x2c8739=_0x4eac42[_0x11eb('0x7b')][_0x11eb('0x90')];_0x159167=_0x4eac42[_0x11eb('0x7b')][_0x11eb('0x84')];if(_0x11eb('0x24')!=typeof _0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')]){if(_0x11eb('0x24')!=typeof _0x4eac42[_0x11eb('0x7b')]['views']['admin']){var _0x246520=_0x4eac42[_0x11eb('0x7b')]['views'][_0x11eb('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x246520)){_0x5e62f3=path['join']('plugins',_0x43a6e4,_0x408298[0x0],_0x246520);}else{_0x5e62f3=_0x246520;}}if(_0x11eb('0x24')!=typeof _0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')][_0x11eb('0x80')]){var _0x1a3b75=_0x4eac42[_0x11eb('0x7b')][_0x11eb('0x7f')][_0x11eb('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x11eb('0x8d')](_0x1a3b75)){_0x285c7d=path[_0x11eb('0x50')]('plugins',_0x43a6e4,_0x408298[0x0],_0x1a3b75);}else{_0x285c7d=_0x1a3b75;}}}}var _0x20f1e4={'name':_0x2ac20d,'description':_0x3d0beb,'path':path['join'](_0x43a6e4,_0x408298[0x0]),'type':_0x20e5d1,'sidebar':_0x1cd344,'icon':_0x1ff5cc,'adminUrl':_0x5e62f3,'agentUrl':_0x285c7d,'scriptName':_0x2c8739,'scriptPath':_0x159167,'version':_0x123b39};removeReferences(_0x1155ff,null);return db[_0x11eb('0x33')][_0x11eb('0x91')](_0x20f1e4)['then'](function(_0x3cc128){var _0x2b5b48={'role':_0x3b1f54[_0x11eb('0x92')]['role'],'userProfileId':_0x3b1f54['body'][_0x11eb('0x93')]};if(!_0x2b5b48)throw new Error(_0x11eb('0x94'));if(_0x2b5b48[_0x11eb('0x95')]==='user'){var _0x29fe54=_0x3cc128['get']({'plain':!![]});return db[_0x11eb('0x96')][_0x11eb('0x97')]({'where':{'name':_0x11eb('0x98'),'userProfileId':_0x2b5b48[_0x11eb('0x93')]},'raw':!![]})[_0x11eb('0x2b')](function(_0x409c67){if(_0x409c67&&_0x409c67[_0x11eb('0x99')]===0x0){return db[_0x11eb('0x2d')][_0x11eb('0x91')]({'name':_0x29fe54[_0x11eb('0x30')],'resourceId':_0x29fe54['id'],'type':_0x409c67[_0x11eb('0x30')],'sectionId':_0x409c67['id']},{})[_0x11eb('0x2b')](function(){return _0x3cc128;});}else{return _0x3cc128;}})[_0x11eb('0x48')](function(_0x3f202a){logger[_0x11eb('0x2e')](_0x11eb('0x9a'),_0x3f202a);throw _0x3f202a;});}return _0x3cc128;})['then'](respondWithResult(_0x375301,null))['catch'](handleError(_0x375301,null));}});}catch(_0x110d08){_0x375301['status'](0x1f4)['send'](_0x110d08);}};function removeReferences(_0x5e585d,_0x54a619){try{if(_0x5e585d){fs[_0x11eb('0x9b')](_0x5e585d);logger[_0x11eb('0x6b')](_0x11eb('0x9c'));}if(_0x54a619){rimraf(_0x54a619,function(){});logger['info'](_0x11eb('0x9d'));}}catch(_0x817e59){logger[_0x11eb('0x2e')](_0x817e59);}}exports['update']=function(_0x4a915a,_0x42b95c,_0x8fc3e){return db[_0x11eb('0x33')]['find']({'where':{'id':_0x4a915a['params']['id']}})[_0x11eb('0x2b')](handleEntityNotFound(_0x42b95c,null))[_0x11eb('0x2b')](saveUpdates(_0x4a915a[_0x11eb('0x92')],null))[_0x11eb('0x2b')](respondWithResult(_0x42b95c,null))[_0x11eb('0x48')](handleError(_0x42b95c,null));};exports[_0x11eb('0x9e')]=function(_0x2f00bf,_0x4e5fdb,_0x79457f){return db['Plugin'][_0x11eb('0x97')]({'where':{'id':_0x2f00bf[_0x11eb('0x4a')]['id']}})['then'](function(_0x35b135){if(_0x35b135){return _0x35b135[_0x11eb('0x2c')]();}})[_0x11eb('0x2b')](function(_0x3df639){rimraf(path[_0x11eb('0x50')](config[_0x11eb('0x51')],_0x11eb('0x52'),path[_0x11eb('0x5e')](_0x3df639['path'])),function(){});return _0x3df639;})[_0x11eb('0x2b')](handleEntityNotFound(_0x4e5fdb,null))['then'](respondWithStatusCode(_0x4e5fdb,null))[_0x11eb('0x48')](handleError(_0x4e5fdb,null));};exports[_0x11eb('0x9f')]=function(_0x4d2e54,_0x5ddaa5,_0x14a315){return BPromise[_0x11eb('0xa0')]()[_0x11eb('0x2b')](function(){if(!_0x4d2e54[_0x11eb('0x38')][_0x11eb('0x6')]){throw new Error(_0x11eb('0xa1'));}if(!_0x4d2e54[_0x11eb('0x38')]['port']){throw new Error(_0x11eb('0xa2'));}var _0x45edee=_0x4d2e54['query'][_0x11eb('0xa3')]?_0x4d2e54[_0x11eb('0x38')][_0x11eb('0xa3')]+':'+_0x4d2e54[_0x11eb('0x38')][_0x11eb('0xa4')]:'http://localhost:'+_0x4d2e54['query'][_0x11eb('0xa4')];var _0x4d6341=_0x4d2e54[_0x11eb('0x38')]['json']?_0x4d2e54[_0x11eb('0x38')][_0x11eb('0x22')]:!![];var _0x217480=_0x4d2e54[_0x11eb('0x38')]['encoding']?_0x4d2e54[_0x11eb('0x38')][_0x11eb('0xa5')]:null;var _0x386f1e={'method':_0x4d2e54['method'],'uri':util[_0x11eb('0x53')](_0x11eb('0xa6'),_0x45edee,_0x4d2e54['query'][_0x11eb('0x6')]),'json':_0x4d6341,'resolveWithFullResponse':!![],'encoding':_0x217480,'qs':_0x4d2e54[_0x11eb('0x38')]};if(_0x4d2e54[_0x11eb('0xa7')]){_0x386f1e['headers']=_0x4d2e54[_0x11eb('0xa7')];if(_0x386f1e[_0x11eb('0xa7')][_0x11eb('0xa8')]){delete _0x386f1e['headers'][_0x11eb('0xa8')];}}if(_0x386f1e['headers']['content-type']){delete _0x386f1e['headers'][_0x11eb('0xa9')];}return rp(_0x386f1e);})[_0x11eb('0x2b')](function(_0x14de6a){if(_0x14de6a){_0x5ddaa5['set'](_0x14de6a['headers']);logger['info'](_0x14de6a['body']);if(_[_0x11eb('0xaa')](_0x4d2e54[_0x11eb('0x38')][_0x11eb('0x6')],_0x11eb('0x4f'))&&_0x14de6a['statusCode']==0x1f4){return _0x5ddaa5[_0x11eb('0x1f')](_0x14de6a[_0x11eb('0xab')]);}else{return _0x5ddaa5[_0x11eb('0x21')](_0x14de6a[_0x11eb('0xab')])[_0x11eb('0xac')](_0x14de6a[_0x11eb('0x92')]);}}else{return _0x5ddaa5['sendStatus'](0xc8);}})[_0x11eb('0x48')](handleError(_0x5ddaa5,null));};exports[_0x11eb('0xad')]=function(_0x5addc9,_0x2217d2,_0x242bc6){return BPromise['resolve']()['then'](function(){if(!_0x5addc9[_0x11eb('0x38')][_0x11eb('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5addc9[_0x11eb('0x38')][_0x11eb('0xa4')]){throw new Error(_0x11eb('0xa2'));}var _0x9b01dd=_0x5addc9[_0x11eb('0x38')][_0x11eb('0xa3')]?_0x5addc9[_0x11eb('0x38')][_0x11eb('0xa3')]+':'+_0x5addc9[_0x11eb('0x38')]['port']:_0x11eb('0xae')+_0x5addc9[_0x11eb('0x38')][_0x11eb('0xa4')];var _0x2bbcf2=_0x5addc9[_0x11eb('0x38')]['json']?_0x5addc9[_0x11eb('0x38')]['json']:!![];var _0x520dbc=_0x5addc9[_0x11eb('0x38')]['encoding']?_0x5addc9[_0x11eb('0x38')]['encoding']:null;var _0x34939a={'method':_0x5addc9[_0x11eb('0xaf')],'uri':util[_0x11eb('0x53')]('%s%s',_0x9b01dd,_0x5addc9[_0x11eb('0x38')][_0x11eb('0x6')]),'json':_0x2bbcf2,'resolveWithFullResponse':!![],'encoding':_0x520dbc,'body':_0x5addc9[_0x11eb('0x92')]};if(_0x5addc9['headers']){_0x34939a['headers']=_0x5addc9['headers'];if(_0x34939a['headers']['content-length']){delete _0x34939a[_0x11eb('0xa7')]['content-length'];}}if(_0x34939a[_0x11eb('0xa7')][_0x11eb('0xa9')]){delete _0x34939a['headers']['content-type'];}return rp(_0x34939a);})['then'](function(_0x303750){if(_0x303750){_0x2217d2['set'](_0x303750[_0x11eb('0xa7')]);logger[_0x11eb('0x6b')](_0x303750['body']);return _0x2217d2[_0x11eb('0x21')](_0x303750[_0x11eb('0xab')])[_0x11eb('0xac')](_0x303750[_0x11eb('0x92')]);}else{return _0x2217d2['sendStatus'](0xc8);}})['catch'](handleError(_0x2217d2,null));}; \ No newline at end of file +var _0x68b9=['to-csv','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','get','Plugins','UserProfileResource','destroy','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','merge','include','findAll','rows','params','includeAll','options','catch','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','upload','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-length','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x283e4d,_0xd4043c){var _0x3ee73a=function(_0x3aaaaa){while(--_0x3aaaaa){_0x283e4d['push'](_0x283e4d['shift']());}};_0x3ee73a(++_0xd4043c);}(_0x68b9,0x143));var _0x968b=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x68b9[_0x23a8ba];return _0x468389;};'use strict';var emlformat=require(_0x968b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x968b('0x1'));var jsonpatch=require(_0x968b('0x2'));var rp=require('request-promise');var moment=require(_0x968b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x968b('0x4'));var path=require(_0x968b('0x5'));var sox=require(_0x968b('0x6'));var csv=require('to-csv');var ejs=require(_0x968b('0x7'));var fs=require('fs');var fs_extra=require(_0x968b('0x8'));var _=require(_0x968b('0x9'));var squel=require(_0x968b('0xa'));var crypto=require(_0x968b('0xb'));var jsforce=require(_0x968b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x968b('0xd'));var querystring=require(_0x968b('0xe'));var Papa=require(_0x968b('0xf'));var extract=require(_0x968b('0x10'));var rimraf=require(_0x968b('0x11'));var archiver=require(_0x968b('0x12'));var Redis=require(_0x968b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x968b('0x14'));var as=require(_0x968b('0x15'));var hardwareService=require(_0x968b('0x16'));var logger=require(_0x968b('0x17'))('api');var utils=require(_0x968b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x968b('0x19'));var db=require(_0x968b('0x1a'))['db'];config[_0x968b('0x1b')]=_['defaults'](config[_0x968b('0x1b')],{'host':_0x968b('0x1c'),'port':0x18eb});var socket=require(_0x968b('0x1d'))(new Redis(config[_0x968b('0x1b')]));require(_0x968b('0x1e'))[_0x968b('0x1f')](socket);function respondWithStatusCode(_0x23fd5d,_0x21ce2d){_0x21ce2d=_0x21ce2d||0xcc;return function(_0x5ad726){if(_0x5ad726){return _0x23fd5d[_0x968b('0x20')](_0x21ce2d);}return _0x23fd5d['status'](_0x21ce2d)[_0x968b('0x21')]();};}function respondWithResult(_0x512ca9,_0x5067f8){_0x5067f8=_0x5067f8||0xc8;return function(_0x56f0c5){if(_0x56f0c5){return _0x512ca9['status'](_0x5067f8)[_0x968b('0x22')](_0x56f0c5);}};}function respondWithFilteredResult(_0x2d2d16,_0x3eec20){return function(_0x166fbe){if(_0x166fbe){var _0x7c25c7=typeof _0x3eec20[_0x968b('0x23')]===_0x968b('0x24')&&typeof _0x3eec20[_0x968b('0x25')]===_0x968b('0x24');var _0x175fd5=_0x166fbe[_0x968b('0x26')];var _0x1ca62b=_0x7c25c7?0x0:_0x3eec20[_0x968b('0x23')];var _0x490b51=_0x7c25c7?_0x166fbe[_0x968b('0x26')]:_0x3eec20[_0x968b('0x23')]+_0x3eec20[_0x968b('0x25')];var _0x33d7af;if(_0x490b51>=_0x175fd5){_0x490b51=_0x175fd5;_0x33d7af=0xc8;}else{_0x33d7af=0xce;}_0x2d2d16[_0x968b('0x27')](_0x33d7af);return _0x2d2d16[_0x968b('0x28')]('Content-Range',_0x1ca62b+'-'+_0x490b51+'/'+_0x175fd5)['json'](_0x166fbe);}return null;};}function patchUpdates(_0x1b502f){return function(_0x33548a){try{jsonpatch['apply'](_0x33548a,_0x1b502f,!![]);}catch(_0x2e4807){return BPromise[_0x968b('0x29')](_0x2e4807);}return _0x33548a[_0x968b('0x2a')]();};}function saveUpdates(_0x4e265f,_0x43854c){return function(_0x476df1){if(_0x476df1){return _0x476df1['update'](_0x4e265f)[_0x968b('0x2b')](function(_0x2ffc16){return _0x2ffc16;});}return null;};}function removeEntity(_0x1b361a,_0x293831){return function(_0x30e509){if(_0x30e509){return _0x30e509['destroy']()['then'](function(){var _0x29d3e0=_0x30e509[_0x968b('0x2c')]({'plain':!![]});var _0x3fafae=_0x968b('0x2d');return db[_0x968b('0x2e')][_0x968b('0x2f')]({'where':{'type':_0x3fafae,'resourceId':_0x29d3e0['id']}})['then'](function(){return _0x30e509;});})['then'](function(){_0x1b361a[_0x968b('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b09f,_0x1efed5){return function(_0x17f98a){if(!_0x17f98a){_0x13b09f[_0x968b('0x20')](0x194);}return _0x17f98a;};}function handleError(_0x5be33c,_0x5985d4){_0x5985d4=_0x5985d4||0x1f4;return function(_0x2a6178){logger[_0x968b('0x30')](_0x2a6178[_0x968b('0x31')]);if(_0x2a6178[_0x968b('0x32')]){delete _0x2a6178['name'];}_0x5be33c[_0x968b('0x27')](_0x5985d4)[_0x968b('0x33')](_0x2a6178);};}exports[_0x968b('0x34')]=function(_0xb689de,_0x3c2ac6){var _0x76cee5={},_0x14be9e={},_0xef8573={'count':0x0,'rows':[]};var _0x4cf79e=_[_0x968b('0x35')](db[_0x968b('0x36')][_0x968b('0x37')],function(_0x251356){return{'name':_0x251356['fieldName'],'type':_0x251356[_0x968b('0x38')][_0x968b('0x39')]};});_0x14be9e['model']=_[_0x968b('0x35')](_0x4cf79e,'name');_0x14be9e[_0x968b('0x3a')]=_[_0x968b('0x3b')](_0xb689de['query']);_0x14be9e['filters']=_[_0x968b('0x3c')](_0x14be9e['model'],_0x14be9e['query']);_0x76cee5[_0x968b('0x3d')]=_[_0x968b('0x3c')](_0x14be9e[_0x968b('0x3e')],qs[_0x968b('0x3f')](_0xb689de['query'][_0x968b('0x3f')]));_0x76cee5[_0x968b('0x3d')]=_0x76cee5['attributes'][_0x968b('0x40')]?_0x76cee5['attributes']:_0x14be9e[_0x968b('0x3e')];if(!_0xb689de[_0x968b('0x3a')]['hasOwnProperty'](_0x968b('0x41'))){_0x76cee5[_0x968b('0x25')]=qs[_0x968b('0x25')](_0xb689de['query'][_0x968b('0x25')]);_0x76cee5[_0x968b('0x23')]=qs[_0x968b('0x23')](_0xb689de[_0x968b('0x3a')][_0x968b('0x23')]);}_0x76cee5[_0x968b('0x42')]=qs[_0x968b('0x43')](_0xb689de[_0x968b('0x3a')]['sort']);_0x76cee5[_0x968b('0x44')]=qs['filters'](_['pick'](_0xb689de[_0x968b('0x3a')],_0x14be9e[_0x968b('0x45')]),_0x4cf79e);if(_0xb689de[_0x968b('0x3a')]['filter']){_0x76cee5['where']=_['merge'](_0x76cee5[_0x968b('0x44')],{'$or':_[_0x968b('0x35')](_0x4cf79e,function(_0x303446){if(_0x303446[_0x968b('0x38')]!=='VIRTUAL'){var _0x2c80b4={};_0x2c80b4[_0x303446[_0x968b('0x32')]]={'$like':'%'+_0xb689de[_0x968b('0x3a')]['filter']+'%'};return _0x2c80b4;}})});}_0x76cee5=_[_0x968b('0x46')]({},_0x76cee5,_0xb689de['options']);var _0x72a198={'where':_0x76cee5[_0x968b('0x44')]};return db[_0x968b('0x36')][_0x968b('0x26')](_0x72a198)['then'](function(_0x47c27f){_0xef8573[_0x968b('0x26')]=_0x47c27f;if(_0xb689de['query']['includeAll']){_0x76cee5[_0x968b('0x47')]=[{'all':!![]}];}return db[_0x968b('0x36')][_0x968b('0x48')](_0x76cee5);})[_0x968b('0x2b')](function(_0x1a453d){_0xef8573[_0x968b('0x49')]=_0x1a453d;return _0xef8573;})[_0x968b('0x2b')](respondWithFilteredResult(_0x3c2ac6,_0x76cee5))['catch'](handleError(_0x3c2ac6,null));};exports['show']=function(_0xa54749,_0x5021b5){var _0x225faa={'raw':!![],'where':{'id':_0xa54749[_0x968b('0x4a')]['id']}},_0x1aa7d2={};_0x1aa7d2[_0x968b('0x3e')]=_[_0x968b('0x3b')](db[_0x968b('0x36')][_0x968b('0x37')]);_0x1aa7d2[_0x968b('0x3a')]=_[_0x968b('0x3b')](_0xa54749[_0x968b('0x3a')]);_0x1aa7d2[_0x968b('0x45')]=_[_0x968b('0x3c')](_0x1aa7d2['model'],_0x1aa7d2[_0x968b('0x3a')]);_0x225faa[_0x968b('0x3d')]=_[_0x968b('0x3c')](_0x1aa7d2['model'],qs[_0x968b('0x3f')](_0xa54749[_0x968b('0x3a')][_0x968b('0x3f')]));_0x225faa[_0x968b('0x3d')]=_0x225faa[_0x968b('0x3d')][_0x968b('0x40')]?_0x225faa[_0x968b('0x3d')]:_0x1aa7d2['model'];if(_0xa54749[_0x968b('0x3a')][_0x968b('0x4b')]){_0x225faa['include']=[{'all':!![]}];}_0x225faa=_[_0x968b('0x46')]({},_0x225faa,_0xa54749[_0x968b('0x4c')]);return db[_0x968b('0x36')]['find'](_0x225faa)[_0x968b('0x2b')](handleEntityNotFound(_0x5021b5,null))[_0x968b('0x2b')](respondWithResult(_0x5021b5,null))[_0x968b('0x4d')](handleError(_0x5021b5,null));};exports[_0x968b('0x4e')]=function(_0x5508a9,_0x2ee8e2,_0x5ac224){return db['Plugin'][_0x968b('0x4f')]({'where':{'id':_0x5508a9[_0x968b('0x4a')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x2ee8e2,null))[_0x968b('0x2b')](function(_0x568b6c){if(_0x568b6c){var _0xb07f2f=path[_0x968b('0x50')](config[_0x968b('0x51')],_0x968b('0x52'),util[_0x968b('0x53')](_0x968b('0x54'),path[_0x968b('0x55')](_0x568b6c[_0x968b('0x5')])));var _0x440b3a=fs[_0x968b('0x56')](_0xb07f2f);var _0x457dcb=archiver('zip',{'zlib':{'level':0x9}});_0x457dcb['on'](_0x968b('0x57'),function(_0x483d22){if(_0x483d22[_0x968b('0x58')]===_0x968b('0x59')){logger[_0x968b('0x30')](_0x483d22);}else{throw new db[(_0x968b('0x5a'))][(_0x968b('0x5b'))](_0x968b('0x5c'));}});_0x457dcb['on']('error',function(_0x1cb85d){throw new db[(_0x968b('0x5a'))][(_0x968b('0x5b'))](_0x968b('0x5c'));});_0x457dcb[_0x968b('0x5d')](_0x440b3a);_0x457dcb[_0x968b('0x5e')](_0x968b('0x5f'),{'cwd':path[_0x968b('0x50')](config[_0x968b('0x51')],_0x968b('0x52'),path[_0x968b('0x60')](_0x568b6c[_0x968b('0x5')])),'ignore':[path['join'](path['basename'](_0x568b6c[_0x968b('0x5')]),_0x968b('0x61')),path[_0x968b('0x50')](path[_0x968b('0x55')](_0x568b6c[_0x968b('0x5')]),'attachments/**/*')],'nodir':!![]})[_0x968b('0x62')]();_0x440b3a['on'](_0x968b('0x63'),function(){if(!fs[_0x968b('0x64')](_0xb07f2f)){throw new db[(_0x968b('0x5a'))][(_0x968b('0x5b'))](_0x968b('0x65'));}return _0x2ee8e2[_0x968b('0x4e')](_0xb07f2f,util[_0x968b('0x53')]('%s.zip',path['basename'](_0x568b6c['path'])),function(_0x8e34ef){if(_0x8e34ef){throw new db[(_0x968b('0x5a'))]['Error'](_0x968b('0x66'));}fs[_0x968b('0x67')](_0xb07f2f);logger['info'](_0x968b('0x68'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x968b('0x4d')](handleError(_0x2ee8e2,null));};exports[_0x968b('0x69')]=function(_0x3de457,_0x4fcab1,_0x5f2019){var _0x34d3d9=path[_0x968b('0x55')](_0x3de457[_0x968b('0x6a')][_0x968b('0x6b')],path[_0x968b('0x6c')](_0x3de457[_0x968b('0x6a')][_0x968b('0x6b')]));var _0x23b597=path['join'](config[_0x968b('0x51')],_0x968b('0x52'),_0x3de457[_0x968b('0x6a')][_0x968b('0x6b')]);var _0x1f8b6b=path[_0x968b('0x50')](config['root'],_0x968b('0x52'),_0x34d3d9);logger[_0x968b('0x6d')](_0x968b('0x6e'),_0x23b597);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x1f8b6b);try{fs[_0x968b('0x6f')](_0x23b597,parseInt(_0x968b('0x70'),0x8));extract(_0x23b597,{'dir':_0x1f8b6b},function(_0x202cf0){if(_0x202cf0){logger[_0x968b('0x30')](_0x202cf0);handleError(_0x202cf0,!![]);};var _0x4b19ad=fs[_0x968b('0x71')](_0x1f8b6b);if(_0x4b19ad[_0x968b('0x40')]>0x1){removeReferences(_0x23b597,_0x1f8b6b);logger[_0x968b('0x30')]('Invalid\x20plugin\x20structure');return _0x5f2019(new Error('Invalid\x20plugin\x20structure'));}var _0x1413a1=fs[_0x968b('0x72')](path['join'](_0x1f8b6b,_0x4b19ad[0x0]));if(_0x1413a1['isFile']()){removeReferences(_0x23b597,_0x1f8b6b);logger[_0x968b('0x30')](_0x968b('0x73'));return _0x5f2019(new Error('Invalid\x20plugin\x20structure'));}if(_0x1413a1[_0x968b('0x74')]()){var _0x194fb6=fs[_0x968b('0x71')](path[_0x968b('0x50')](_0x1f8b6b,_0x4b19ad[0x0]));if(_0x194fb6[_0x968b('0x40')]===0x0){removeReferences(_0x23b597,_0x1f8b6b);logger[_0x968b('0x30')](_0x968b('0x73'));return _0x5f2019(new Error(_0x968b('0x73')));}var _0x3cbbec=_0x194fb6[_0x968b('0x75')](function(_0x552018){return _0x552018==='manifest.json';});if(!_0x3cbbec){return _0x5f2019(new Error(_0x968b('0x76')));}var _0x56d7c4=fs[_0x968b('0x77')](path['join'](_0x1f8b6b,_0x4b19ad[0x0],_0x968b('0x78')));var _0x82008b=JSON[_0x968b('0x79')](_0x56d7c4);if(_0x968b('0x24')==typeof _0x82008b[_0x968b('0x32')]){return _0x5f2019(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x968b('0x24')==typeof _0x82008b['type']){return _0x5f2019(new Error(_0x968b('0x7a')));}if('undefined'==typeof _0x82008b[_0x968b('0x7b')]){return _0x5f2019(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x82008b[_0x968b('0x7c')]){return _0x5f2019(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x82008b[_0x968b('0x38')]===_0x968b('0x7d')){if(_0x968b('0x24')==typeof _0x82008b['parameters']['views']){return _0x5f2019(new Error(_0x968b('0x7e')));}if(_0x968b('0x24')==typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x7f')]['admin']&&_0x968b('0x24')==typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x80')]){return _0x5f2019(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x82008b['type']==='script'){if(_0x968b('0x24')==typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x81')]){return _0x5f2019(new Error(_0x968b('0x82')));}if(_0x968b('0x24')==typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x83')]){return _0x5f2019(new Error(_0x968b('0x84')));}}else{return _0x5f2019(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x406717=_0x82008b[_0x968b('0x32')];var _0x36c147=_0x82008b[_0x968b('0x85')];var _0x547ea1=_0x82008b[_0x968b('0x38')];var _0x4c3af6=_0x82008b['sidebar']?_0x82008b[_0x968b('0x86')]:_0x968b('0x87');var _0x17f2c5=_0x82008b['icon']?_0x82008b[_0x968b('0x88')]:'icon-apps';var _0x5eaa86='';var _0x1a033a='';var _0x6c85e='';var _0x1b4546='';var _0x14497c=_0x82008b[_0x968b('0x7b')];if(_0x547ea1===_0x968b('0x7d')){if(_0x968b('0x24')!=typeof _0x82008b['parameters'][_0x968b('0x7f')][_0x968b('0x89')]){var _0x4a3201=_0x82008b[_0x968b('0x7c')][_0x968b('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x968b('0x8a')](_0x4a3201)){_0x5eaa86=path[_0x968b('0x50')](_0x968b('0x8b'),_0x34d3d9,_0x4b19ad[0x0],_0x4a3201);}else{_0x5eaa86=_0x4a3201;}}else{logger['info'](_0x968b('0x8c'));}if(_0x968b('0x24')!=typeof _0x82008b[_0x968b('0x7c')]['views']['agent']){var _0x3d4635=_0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x968b('0x8a')](_0x3d4635)){_0x1a033a=path[_0x968b('0x50')](_0x968b('0x8b'),_0x34d3d9,_0x4b19ad[0x0],_0x3d4635);}else{_0x1a033a=_0x3d4635;}}else{logger[_0x968b('0x6d')](_0x968b('0x8d'));}}else if(_0x547ea1===_0x968b('0x8e')){_0x6c85e=_0x82008b[_0x968b('0x7c')]['scriptName'];_0x1b4546=_0x82008b['parameters'][_0x968b('0x83')];if(_0x968b('0x24')!=typeof _0x82008b['parameters'][_0x968b('0x7f')]){if(_0x968b('0x24')!=typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x89')]){var _0x4a3201=_0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x968b('0x8a')](_0x4a3201)){_0x5eaa86=path[_0x968b('0x50')](_0x968b('0x8b'),_0x34d3d9,_0x4b19ad[0x0],_0x4a3201);}else{_0x5eaa86=_0x4a3201;}}if(_0x968b('0x24')!=typeof _0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x80')]){var _0x3d4635=_0x82008b[_0x968b('0x7c')][_0x968b('0x7f')][_0x968b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x968b('0x8a')](_0x3d4635)){_0x1a033a=path[_0x968b('0x50')](_0x968b('0x8b'),_0x34d3d9,_0x4b19ad[0x0],_0x3d4635);}else{_0x1a033a=_0x3d4635;}}}}var _0x332c52={'name':_0x406717,'description':_0x36c147,'path':path[_0x968b('0x50')](_0x34d3d9,_0x4b19ad[0x0]),'type':_0x547ea1,'sidebar':_0x4c3af6,'icon':_0x17f2c5,'adminUrl':_0x5eaa86,'agentUrl':_0x1a033a,'scriptName':_0x6c85e,'scriptPath':_0x1b4546,'version':_0x14497c};removeReferences(_0x23b597,null);return db[_0x968b('0x36')][_0x968b('0x8f')](_0x332c52)[_0x968b('0x2b')](function(_0x28d9d9){var _0x57037f={'role':_0x3de457[_0x968b('0x90')]['role'],'userProfileId':_0x3de457['body'][_0x968b('0x91')]};if(!_0x57037f)throw new Error(_0x968b('0x92'));if(_0x57037f[_0x968b('0x93')]==='user'){var _0x381f48=_0x28d9d9[_0x968b('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0x968b('0x4f')]({'where':{'name':_0x968b('0x2d'),'userProfileId':_0x57037f['userProfileId']},'raw':!![]})['then'](function(_0x738f74){if(_0x738f74&&_0x738f74[_0x968b('0x94')]===0x0){return db['UserProfileResource']['create']({'name':_0x381f48['name'],'resourceId':_0x381f48['id'],'type':_0x738f74[_0x968b('0x32')],'sectionId':_0x738f74['id']},{})['then'](function(){return _0x28d9d9;});}else{return _0x28d9d9;}})['catch'](function(_0x2b9ac3){logger[_0x968b('0x30')](_0x968b('0x95'),_0x2b9ac3);throw _0x2b9ac3;});}return _0x28d9d9;})[_0x968b('0x2b')](respondWithResult(_0x4fcab1,null))['catch'](handleError(_0x4fcab1,null));}});}catch(_0x5d1ae4){_0x4fcab1[_0x968b('0x27')](0x1f4)['send'](_0x5d1ae4);}};function removeReferences(_0x30ab1b,_0x2ef758){try{if(_0x30ab1b){fs[_0x968b('0x67')](_0x30ab1b);logger[_0x968b('0x6d')](_0x968b('0x96'));}if(_0x2ef758){rimraf(_0x2ef758,function(){});logger[_0x968b('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x8b98f){logger[_0x968b('0x30')](_0x8b98f);}}exports[_0x968b('0x97')]=function(_0x7e9dd6,_0x368382,_0x275bad){return db[_0x968b('0x36')][_0x968b('0x4f')]({'where':{'id':_0x7e9dd6[_0x968b('0x4a')]['id']}})[_0x968b('0x2b')](handleEntityNotFound(_0x368382,null))[_0x968b('0x2b')](saveUpdates(_0x7e9dd6[_0x968b('0x90')],null))[_0x968b('0x2b')](respondWithResult(_0x368382,null))['catch'](handleError(_0x368382,null));};exports[_0x968b('0x98')]=function(_0x67b26d,_0x35cef8,_0x6f8840){return db[_0x968b('0x36')][_0x968b('0x4f')]({'where':{'id':_0x67b26d['params']['id']}})[_0x968b('0x2b')](function(_0x216561){if(_0x216561){return _0x216561['destroy']();}})[_0x968b('0x2b')](function(_0x15adbe){rimraf(path[_0x968b('0x50')](config[_0x968b('0x51')],'server/files/plugins',path[_0x968b('0x60')](_0x15adbe[_0x968b('0x5')])),function(){});return _0x15adbe;})[_0x968b('0x2b')](handleEntityNotFound(_0x35cef8,null))[_0x968b('0x2b')](respondWithStatusCode(_0x35cef8,null))[_0x968b('0x4d')](handleError(_0x35cef8,null));};exports[_0x968b('0x99')]=function(_0x4607ad,_0x329960,_0x1a78a9){return BPromise['resolve']()[_0x968b('0x2b')](function(){if(!_0x4607ad['query'][_0x968b('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4607ad[_0x968b('0x3a')][_0x968b('0x9a')]){throw new Error(_0x968b('0x9b'));}var _0x355d87=_0x4607ad['query'][_0x968b('0x9c')]?_0x4607ad[_0x968b('0x3a')]['hostname']+':'+_0x4607ad['query'][_0x968b('0x9a')]:_0x968b('0x9d')+_0x4607ad['query']['port'];var _0x705e59=_0x4607ad['query'][_0x968b('0x22')]?_0x4607ad[_0x968b('0x3a')][_0x968b('0x22')]:!![];var _0x115345=_0x4607ad[_0x968b('0x3a')][_0x968b('0x9e')]?_0x4607ad[_0x968b('0x3a')][_0x968b('0x9e')]:null;var _0x538b26={'method':_0x4607ad[_0x968b('0x9f')],'uri':util['format'](_0x968b('0xa0'),_0x355d87,_0x4607ad[_0x968b('0x3a')]['path']),'json':_0x705e59,'resolveWithFullResponse':!![],'encoding':_0x115345,'qs':_0x4607ad[_0x968b('0x3a')]};if(_0x4607ad['headers']){_0x538b26[_0x968b('0xa1')]=_0x4607ad[_0x968b('0xa1')];if(_0x538b26[_0x968b('0xa1')]['content-length']){delete _0x538b26['headers']['content-length'];}}if(_0x538b26['headers'][_0x968b('0xa2')]){delete _0x538b26[_0x968b('0xa1')][_0x968b('0xa2')];}return rp(_0x538b26);})['then'](function(_0x2d0ac7){if(_0x2d0ac7){_0x329960[_0x968b('0x28')](_0x2d0ac7[_0x968b('0xa1')]);logger[_0x968b('0x6d')](_0x2d0ac7[_0x968b('0x90')]);if(_[_0x968b('0xa3')](_0x4607ad[_0x968b('0x3a')][_0x968b('0x5')],_0x968b('0x4e'))&&_0x2d0ac7['statusCode']==0x1f4){return _0x329960[_0x968b('0x20')](_0x2d0ac7[_0x968b('0xa4')]);}else{return _0x329960['status'](_0x2d0ac7[_0x968b('0xa4')])[_0x968b('0x33')](_0x2d0ac7[_0x968b('0x90')]);}}else{return _0x329960[_0x968b('0x20')](0xc8);}})[_0x968b('0x4d')](handleError(_0x329960,null));};exports[_0x968b('0xa5')]=function(_0x20d3aa,_0x439dfe,_0x54ff4c){return BPromise['resolve']()[_0x968b('0x2b')](function(){if(!_0x20d3aa[_0x968b('0x3a')]['path']){throw new Error(_0x968b('0xa6'));}if(!_0x20d3aa[_0x968b('0x3a')][_0x968b('0x9a')]){throw new Error(_0x968b('0x9b'));}var _0x3528cd=_0x20d3aa[_0x968b('0x3a')][_0x968b('0x9c')]?_0x20d3aa[_0x968b('0x3a')]['hostname']+':'+_0x20d3aa[_0x968b('0x3a')][_0x968b('0x9a')]:_0x968b('0x9d')+_0x20d3aa[_0x968b('0x3a')][_0x968b('0x9a')];var _0x3e3471=_0x20d3aa[_0x968b('0x3a')]['json']?_0x20d3aa[_0x968b('0x3a')][_0x968b('0x22')]:!![];var _0x208171=_0x20d3aa[_0x968b('0x3a')][_0x968b('0x9e')]?_0x20d3aa[_0x968b('0x3a')]['encoding']:null;var _0x10e2c8={'method':_0x20d3aa[_0x968b('0x9f')],'uri':util[_0x968b('0x53')](_0x968b('0xa0'),_0x3528cd,_0x20d3aa[_0x968b('0x3a')][_0x968b('0x5')]),'json':_0x3e3471,'resolveWithFullResponse':!![],'encoding':_0x208171,'body':_0x20d3aa['body']};if(_0x20d3aa['headers']){_0x10e2c8[_0x968b('0xa1')]=_0x20d3aa[_0x968b('0xa1')];if(_0x10e2c8[_0x968b('0xa1')]['content-length']){delete _0x10e2c8[_0x968b('0xa1')][_0x968b('0xa7')];}}if(_0x10e2c8[_0x968b('0xa1')][_0x968b('0xa2')]){delete _0x10e2c8[_0x968b('0xa1')]['content-type'];}return rp(_0x10e2c8);})['then'](function(_0x10a34a){if(_0x10a34a){_0x439dfe[_0x968b('0x28')](_0x10a34a['headers']);logger[_0x968b('0x6d')](_0x10a34a[_0x968b('0x90')]);return _0x439dfe[_0x968b('0x27')](_0x10a34a['statusCode'])[_0x968b('0x33')](_0x10a34a[_0x968b('0x90')]);}else{return _0x439dfe[_0x968b('0x20')](0xc8);}})[_0x968b('0x4d')](handleError(_0x439dfe,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 44909dd..53c5b7b 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 _0xdcd5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdcd5,0x110));var _0x5dcd=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0xdcd5[_0x2cde0a];return _0x260610;};'use strict';var EventEmitter=require(_0x5dcd('0x0'));var Plugin=require(_0x5dcd('0x1'))['db'][_0x5dcd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5dcd('0x3')](0x0);var events={'afterCreate':_0x5dcd('0x4'),'afterUpdate':_0x5dcd('0x5'),'afterDestroy':_0x5dcd('0x6')};function emitEvent(_0x5447ba){return function(_0x1c13f5,_0x245dc8,_0x3e2af0){PluginEvents[_0x5dcd('0x7')](_0x5447ba+':'+_0x1c13f5['id'],_0x1c13f5);PluginEvents[_0x5dcd('0x7')](_0x5447ba,_0x1c13f5);_0x3e2af0(null);};}for(var e in events){if(events[_0x5dcd('0x8')](e)){var event=events[e];Plugin[_0x5dcd('0x9')](e,emitEvent(event));}}module[_0x5dcd('0xa')]=PluginEvents; \ No newline at end of file +var _0x1dcc=['hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','update','emit'];(function(_0x166bea,_0x1a833b){var _0x375c3c=function(_0x1ba90a){while(--_0x1ba90a){_0x166bea['push'](_0x166bea['shift']());}};_0x375c3c(++_0x1a833b);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x4bab2b,_0x3dd042){_0x4bab2b=_0x4bab2b-0x0;var _0x483db7=_0x1dcc[_0x4bab2b];return _0x483db7;};'use strict';var EventEmitter=require(_0xc1dc('0x0'));var Plugin=require(_0xc1dc('0x1'))['db'][_0xc1dc('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xc1dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1dc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20abc9){return function(_0x3eb139,_0x2a8ff9,_0x5deaf7){PluginEvents['emit'](_0x20abc9+':'+_0x3eb139['id'],_0x3eb139);PluginEvents[_0xc1dc('0x5')](_0x20abc9,_0x3eb139);_0x5deaf7(null);};}for(var e in events){if(events[_0xc1dc('0x6')](e)){var event=events[e];Plugin[_0xc1dc('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 29d07d7..07393ef 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 _0xe2e2=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes'];(function(_0x52dcde,_0x165900){var _0xb30748=function(_0x3bb19e){while(--_0x3bb19e){_0x52dcde['push'](_0x52dcde['shift']());}};_0xb30748(++_0x165900);}(_0xe2e2,0xe4));var _0x2e2e=function(_0x5bc1b7,_0x14b385){_0x5bc1b7=_0x5bc1b7-0x0;var _0x23fb83=_0xe2e2[_0x5bc1b7];return _0x23fb83;};'use strict';var _=require(_0x2e2e('0x0'));var util=require(_0x2e2e('0x1'));var logger=require(_0x2e2e('0x2'))(_0x2e2e('0x3'));var moment=require(_0x2e2e('0x4'));var BPromise=require(_0x2e2e('0x5'));var rp=require(_0x2e2e('0x6'));var fs=require('fs');var path=require(_0x2e2e('0x7'));var rimraf=require('rimraf');var config=require(_0x2e2e('0x8'));var attributes=require(_0x2e2e('0x9'));module[_0x2e2e('0xa')]=function(_0x21ef51,_0x45e61b){return _0x21ef51[_0x2e2e('0xb')](_0x2e2e('0xc'),attributes,{'tableName':_0x2e2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa72e=['bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util','api','moment'];(function(_0x4ae98c,_0x4347ba){var _0x7f171c=function(_0x16aa6e){while(--_0x16aa6e){_0x4ae98c['push'](_0x4ae98c['shift']());}};_0x7f171c(++_0x4347ba);}(_0xa72e,0xa4));var _0xea72=function(_0x383433,_0x13850f){_0x383433=_0x383433-0x0;var _0x3f91ca=_0xa72e[_0x383433];return _0x3f91ca;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var logger=require('../../config/logger')(_0xea72('0x2'));var moment=require(_0xea72('0x3'));var BPromise=require(_0xea72('0x4'));var rp=require(_0xea72('0x5'));var fs=require('fs');var path=require(_0xea72('0x6'));var rimraf=require('rimraf');var config=require(_0xea72('0x7'));var attributes=require(_0xea72('0x8'));module[_0xea72('0x9')]=function(_0x3b0d7e,_0x93ea2b){return _0x3b0d7e[_0xea72('0xa')]('Plugin',attributes,{'tableName':_0xea72('0xb'),'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 8e80b7b..72102a7 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 _0x769d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreatePlugin'];(function(_0x3e7a41,_0x5c2cdf){var _0x157206=function(_0x4dd076){while(--_0x4dd076){_0x3e7a41['push'](_0x3e7a41['shift']());}};_0x157206(++_0x5c2cdf);}(_0x769d,0x132));var _0xd769=function(_0x823d82,_0x4caf84){_0x823d82=_0x823d82-0x0;var _0x2cd260=_0x769d[_0x823d82];return _0x2cd260;};'use strict';var _=require(_0xd769('0x0'));var util=require(_0xd769('0x1'));var moment=require(_0xd769('0x2'));var BPromise=require(_0xd769('0x3'));var rs=require(_0xd769('0x4'));var fs=require('fs');var Redis=require(_0xd769('0x5'));var db=require(_0xd769('0x6'))['db'];var utils=require(_0xd769('0x7'));var logger=require(_0xd769('0x8'))(_0xd769('0x9'));var config=require('../../config/environment');var jayson=require(_0xd769('0xa'));var client=jayson[_0xd769('0xb')][_0xd769('0xc')]({'port':0x232a});config[_0xd769('0xd')]=_[_0xd769('0xe')](config[_0xd769('0xd')],{'host':_0xd769('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xd769('0x10')](socket);function respondWithRpcPromise(_0x3d890c,_0x354de8,_0x5d4317){return new BPromise(function(_0x11b051,_0x5a5660){return client[_0xd769('0x11')](_0x3d890c,_0x5d4317)[_0xd769('0x12')](function(_0x51f2df){logger[_0xd769('0x13')]('Plugin,\x20%s,\x20%s',_0x354de8,_0xd769('0x14'));logger[_0xd769('0x15')](_0xd769('0x16'),_0x354de8,_0xd769('0x14'),JSON[_0xd769('0x17')](_0x51f2df));if(_0x51f2df['error']){if(_0x51f2df[_0xd769('0x18')]['code']===0x1f4){logger[_0xd769('0x18')](_0xd769('0x19'),_0x354de8,_0x51f2df[_0xd769('0x18')][_0xd769('0x1a')]);return _0x5a5660(_0x51f2df[_0xd769('0x18')][_0xd769('0x1a')]);}logger[_0xd769('0x18')](_0xd769('0x19'),_0x354de8,_0x51f2df['error']['message']);return _0x11b051(_0x51f2df['error'][_0xd769('0x1a')]);}else{logger['info'](_0xd769('0x19'),_0x354de8,'request\x20sent');_0x11b051(_0x51f2df[_0xd769('0x1b')][_0xd769('0x1a')]);}})[_0xd769('0x1c')](function(_0x43a7d2){logger['error']('Plugin,\x20%s,\x20%s',_0x354de8,_0x43a7d2);_0x5a5660(_0x43a7d2);});});}exports['CreatePlugin']=function(_0x112594){var _0x32ded4=this;return new Promise(function(_0x30a1c9,_0x322771){return db['Plugin'][_0xd769('0x1d')](_0x112594[_0xd769('0x1e')],{'raw':_0x112594['options']?_0x112594[_0xd769('0x1f')][_0xd769('0x20')]===undefined?!![]:![]:!![]})[_0xd769('0x12')](function(_0x4d00dd){logger[_0xd769('0x13')](_0xd769('0x21'),_0x112594);logger[_0xd769('0x15')]('CreatePlugin',_0x112594,JSON[_0xd769('0x17')](_0x4d00dd));_0x30a1c9(_0x4d00dd);})['catch'](function(_0x5b9ac8){logger[_0xd769('0x18')](_0xd769('0x21'),_0x5b9ac8[_0xd769('0x1a')],_0x112594);_0x322771(_0x32ded4[_0xd769('0x18')](0x1f4,_0x5b9ac8[_0xd769('0x1a')]));});});}; \ No newline at end of file +var _0x1172=['CreatePlugin','Plugin','create','body','options','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0xfdb7af,_0x1a0ee8){var _0x29fc8c=function(_0x27215a){while(--_0x27215a){_0xfdb7af['push'](_0xfdb7af['shift']());}};_0x29fc8c(++_0x1a0ee8);}(_0x1172,0xe7));var _0x2117=function(_0x1228a6,_0x3cec7d){_0x1228a6=_0x1228a6-0x0;var _0x2cd570=_0x1172[_0x1228a6];return _0x2cd570;};'use strict';var _=require(_0x2117('0x0'));var util=require(_0x2117('0x1'));var moment=require(_0x2117('0x2'));var BPromise=require('bluebird');var rs=require(_0x2117('0x3'));var fs=require('fs');var Redis=require(_0x2117('0x4'));var db=require(_0x2117('0x5'))['db'];var utils=require(_0x2117('0x6'));var logger=require(_0x2117('0x7'))(_0x2117('0x8'));var config=require('../../config/environment');var jayson=require(_0x2117('0x9'));var client=jayson[_0x2117('0xa')][_0x2117('0xb')]({'port':0x232a});config[_0x2117('0xc')]=_[_0x2117('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2117('0xc')]));require('./plugin.socket')[_0x2117('0xe')](socket);function respondWithRpcPromise(_0x128733,_0x44079a,_0x2f3628){return new BPromise(function(_0x317d61,_0x50e1b8){return client[_0x2117('0xf')](_0x128733,_0x2f3628)[_0x2117('0x10')](function(_0x1e554c){logger[_0x2117('0x11')](_0x2117('0x12'),_0x44079a,'request\x20sent');logger[_0x2117('0x13')](_0x2117('0x14'),_0x44079a,'request\x20sent',JSON['stringify'](_0x1e554c));if(_0x1e554c[_0x2117('0x15')]){if(_0x1e554c[_0x2117('0x15')]['code']===0x1f4){logger[_0x2117('0x15')](_0x2117('0x12'),_0x44079a,_0x1e554c[_0x2117('0x15')][_0x2117('0x16')]);return _0x50e1b8(_0x1e554c[_0x2117('0x15')][_0x2117('0x16')]);}logger[_0x2117('0x15')](_0x2117('0x12'),_0x44079a,_0x1e554c[_0x2117('0x15')][_0x2117('0x16')]);return _0x317d61(_0x1e554c[_0x2117('0x15')][_0x2117('0x16')]);}else{logger[_0x2117('0x11')](_0x2117('0x12'),_0x44079a,_0x2117('0x17'));_0x317d61(_0x1e554c[_0x2117('0x18')][_0x2117('0x16')]);}})['catch'](function(_0x1e8b91){logger[_0x2117('0x15')](_0x2117('0x12'),_0x44079a,_0x1e8b91);_0x50e1b8(_0x1e8b91);});});}exports[_0x2117('0x19')]=function(_0x1d665b){var _0x460d70=this;return new Promise(function(_0x105ca7,_0x57b6be){return db[_0x2117('0x1a')][_0x2117('0x1b')](_0x1d665b[_0x2117('0x1c')],{'raw':_0x1d665b[_0x2117('0x1d')]?_0x1d665b[_0x2117('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1f119c){logger[_0x2117('0x11')](_0x2117('0x19'),_0x1d665b);logger[_0x2117('0x13')]('CreatePlugin',_0x1d665b,JSON[_0x2117('0x1e')](_0x1f119c));_0x105ca7(_0x1f119c);})[_0x2117('0x1f')](function(_0x1f08cc){logger[_0x2117('0x15')](_0x2117('0x19'),_0x1f08cc['message'],_0x1d665b);_0x57b6be(_0x460d70[_0x2117('0x15')](0x1f4,_0x1f08cc[_0x2117('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dc08ae0..7f53bec 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 _0xbe0b=['./plugin.events','save','remove','emit','register'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xbe0b,0x15e));var _0xbbe0=function(_0x274253,_0x2aabdf){_0x274253=_0x274253-0x0;var _0x353ad9=_0xbe0b[_0x274253];return _0x353ad9;};'use strict';var PluginEvents=require(_0xbbe0('0x0'));var events=[_0xbbe0('0x1'),_0xbbe0('0x2'),'update'];function createListener(_0xe9cb1c,_0x2fcc7b){return function(_0x9efff9){_0x2fcc7b[_0xbbe0('0x3')](_0xe9cb1c,_0x9efff9);};}function removeListener(_0x3845b6,_0x2c9b7a){return function(){PluginEvents['removeListener'](_0x3845b6,_0x2c9b7a);};}exports[_0xbbe0('0x4')]=function(_0x55ab72){for(var _0xd60702=0x0,_0x558334=events['length'];_0xd60702<_0x558334;_0xd60702++){var _0x52ea1c=events[_0xd60702];var _0x3fe3e4=createListener('plugin:'+_0x52ea1c,_0x55ab72);PluginEvents['on'](_0x52ea1c,_0x3fe3e4);}}; \ No newline at end of file +var _0xc6de=['./plugin.events','save','update','emit','register','length','plugin:'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xc6de,0x1e3));var _0xec6d=function(_0x47ad1a,_0x467d68){_0x47ad1a=_0x47ad1a-0x0;var _0x586211=_0xc6de[_0x47ad1a];return _0x586211;};'use strict';var PluginEvents=require(_0xec6d('0x0'));var events=[_0xec6d('0x1'),'remove',_0xec6d('0x2')];function createListener(_0x25724f,_0x1e4fc8){return function(_0x163bac){_0x1e4fc8[_0xec6d('0x3')](_0x25724f,_0x163bac);};}function removeListener(_0x4fd7f9,_0x52c7c2){return function(){PluginEvents['removeListener'](_0x4fd7f9,_0x52c7c2);};}exports[_0xec6d('0x4')]=function(_0x2c0077){for(var _0x31d319=0x0,_0x3c84e3=events[_0xec6d('0x5')];_0x31d319<_0x3c84e3;_0x31d319++){var _0x141dce=events[_0x31d319];var _0xb363a=createListener(_0xec6d('0x6')+_0x141dce,_0x2c0077);PluginEvents['on'](_0x141dce,_0xb363a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 49520de..5509948 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(_0x36d45d,_0x183513){var _0x203085=function(_0x82efe0){while(--_0x82efe0){_0x36d45d['push'](_0x36d45d['shift']());}};_0x203085(++_0x183513);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x4554f9,_0xe56c6f){var _0x11394a=function(_0x2ac716){while(--_0x2ac716){_0x4554f9['push'](_0x4554f9['shift']());}};_0x11394a(++_0xe56c6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 20a994e..71baa26 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 _0x0565=['script','../../files/plugins','cwd','chdir','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','npm\x20install','index','list','then','reject','express','length','catch','show','describe','body'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0565,0xf2));var _0x5056=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0565[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x5056('0x0'));var pm2=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var path=require(_0x5056('0x4'));var exec=require(_0x5056('0x5'))[_0x5056('0x6')];var BPromise=require(_0x5056('0x7'));function handleEntityNotFound(_0x3657a8,_0x2b0883){return function(_0x554040){if(!_0x554040){_0x3657a8[_0x5056('0x8')](0x194);;}return _0x554040;};}function respondWithResult(_0x105ea8,_0x1143df){_0x1143df=_0x1143df||0xc8;return function(_0x22afb7){if(_0x22afb7){return _0x105ea8['status'](_0x1143df)['json'](_0x22afb7);}return null;};}function handleError(_0x38f74,_0x223c92){_0x223c92=_0x223c92||0x1f4;return function(_0x417065){logger[_0x5056('0x9')](_0x417065[_0x5056('0xa')]);if(_0x417065[_0x5056('0xb')]){delete _0x417065[_0x5056('0xb')];}_0x38f74[_0x5056('0xc')](_0x223c92)['send'](_0x417065);};}function execChildProcess(){return new BPromise(function(_0x78f7e4,_0xf04ea3){exec(_0x5056('0xd'),function(_0x5ab4b2,_0x4c0255,_0x17f43e){logger['info'](_0x4c0255);logger['info'](_0x17f43e);if(_0x5ab4b2){logger['error'](_0x5ab4b2);return _0xf04ea3(_0x5ab4b2);}return _0x78f7e4(_0x4c0255);});});}exports[_0x5056('0xe')]=function(_0x4b183a,_0x3e523b){return pm2[_0x5056('0xf')]()[_0x5056('0x10')](function(_0x543cee){if(_0x543cee){var _0x1e8b64=_[_0x5056('0x11')](_0x543cee,function(_0x15f52d){return _0x15f52d[_0x5056('0xb')]===_0x5056('0x12')||_0x15f52d[_0x5056('0xb')]==='motion2';});return{'rows':_0x1e8b64,'count':_0x1e8b64[_0x5056('0x13')]};}return null;})['then'](respondWithResult(_0x3e523b,null))[_0x5056('0x14')](handleError(_0x3e523b,null));};exports[_0x5056('0x15')]=function(_0x1c0ee9,_0x1f2ac6){return pm2[_0x5056('0x16')](_0x1c0ee9['params']['id'])[_0x5056('0x10')](respondWithResult(_0x1f2ac6,null))[_0x5056('0x10')](handleEntityNotFound(_0x1f2ac6,null))['catch'](handleError(_0x1f2ac6,null));};exports['create']=function(_0x20776c,_0x517bf3){if(_0x20776c[_0x5056('0x17')][_0x5056('0xb')]&&_0x20776c[_0x5056('0x17')][_0x5056('0x18')]){var _0x33035c=path['join'](__dirname,_0x5056('0x19'),_0x20776c[_0x5056('0x17')]['script']);var _0x271efc=process[_0x5056('0x1a')]();process[_0x5056('0x1b')](path['dirname'](_0x33035c));return execChildProcess()[_0x5056('0x10')](function(_0x26a3c2){process['chdir'](_0x271efc);return pm2['start']({'name':_0x20776c[_0x5056('0x17')][_0x5056('0xb')],'script':_0x33035c});})[_0x5056('0x10')](function(_0x37f7b5){pm2['dump']();return _0x37f7b5[0x0];})[_0x5056('0x10')](respondWithResult(_0x517bf3,0xc9))[_0x5056('0x14')](handleError(_0x517bf3,null));}else{return _0x517bf3['status'](0x1f4)[_0x5056('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5056('0x1d')]=function(_0x39d539,_0x1106e5){if(_0x39d539[_0x5056('0x17')]['id']){delete _0x39d539[_0x5056('0x17')]['id'];}var _0x50f2a8={'online':_0x5056('0x1e'),'stopped':_0x5056('0x1f')};if(_0x50f2a8[_0x5056('0x20')](_0x39d539[_0x5056('0x17')]['status'])){return pm2[_0x50f2a8[_0x39d539[_0x5056('0x17')]['status']]](_0x39d539[_0x5056('0x21')]['id'])['then'](respondWithResult(_0x1106e5,0xc8))['catch'](handleError(_0x1106e5,null));}else{return _0x1106e5['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x22')});}};exports['destroy']=function(_0x27f4be,_0x2c5728){if(_0x27f4be[_0x5056('0x17')]['id']){delete _0x27f4be[_0x5056('0x17')]['id'];}if(_0x27f4be[_0x5056('0x21')]['id']){return pm2[_0x5056('0x23')](_0x27f4be[_0x5056('0x21')]['id'])[_0x5056('0x10')](function(_0xd1aa24){pm2[_0x5056('0x24')]();return _0xd1aa24[0x0];})[_0x5056('0x10')](respondWithResult(_0x2c5728,null))['catch'](handleError(_0x2c5728,null));}else{return _0x2c5728['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x25')});}}; \ No newline at end of file +var _0x3c81=['../../config/pm2','api','path','sendStatus','status','error','stack','name','send','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3c81,0x102));var _0x13c8=function(_0x14a0cc,_0x492e9d){_0x14a0cc=_0x14a0cc-0x0;var _0x941813=_0x3c81[_0x14a0cc];return _0x941813;};'use strict';var _=require(_0x13c8('0x0'));var pm2=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var path=require(_0x13c8('0x3'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x548599,_0x101d4f){return function(_0x3ec886){if(!_0x3ec886){_0x548599[_0x13c8('0x4')](0x194);;}return _0x3ec886;};}function respondWithResult(_0x1c16f1,_0x2a4d66){_0x2a4d66=_0x2a4d66||0xc8;return function(_0x3f0bd2){if(_0x3f0bd2){return _0x1c16f1[_0x13c8('0x5')](_0x2a4d66)['json'](_0x3f0bd2);}return null;};}function handleError(_0x17c228,_0x4905c3){_0x4905c3=_0x4905c3||0x1f4;return function(_0x380aed){logger[_0x13c8('0x6')](_0x380aed[_0x13c8('0x7')]);if(_0x380aed[_0x13c8('0x8')]){delete _0x380aed[_0x13c8('0x8')];}_0x17c228[_0x13c8('0x5')](_0x4905c3)[_0x13c8('0x9')](_0x380aed);};}function execChildProcess(){return new BPromise(function(_0x2ce95a,_0x26e7d9){exec(_0x13c8('0xa'),function(_0x3ca0a6,_0x2468b3,_0x28417e){logger[_0x13c8('0xb')](_0x2468b3);logger['info'](_0x28417e);if(_0x3ca0a6){logger[_0x13c8('0x6')](_0x3ca0a6);return _0x26e7d9(_0x3ca0a6);}return _0x2ce95a(_0x2468b3);});});}exports[_0x13c8('0xc')]=function(_0x2304b5,_0x1f9b6f){return pm2['list']()[_0x13c8('0xd')](function(_0x515681){if(_0x515681){var _0x4d7a88=_['reject'](_0x515681,function(_0x126359){return _0x126359['name']===_0x13c8('0xe')||_0x126359[_0x13c8('0x8')]===_0x13c8('0xf');});return{'rows':_0x4d7a88,'count':_0x4d7a88[_0x13c8('0x10')]};}return null;})['then'](respondWithResult(_0x1f9b6f,null))[_0x13c8('0x11')](handleError(_0x1f9b6f,null));};exports[_0x13c8('0x12')]=function(_0x31ae02,_0x3bc5a9){return pm2[_0x13c8('0x13')](_0x31ae02[_0x13c8('0x14')]['id'])[_0x13c8('0xd')](respondWithResult(_0x3bc5a9,null))[_0x13c8('0xd')](handleEntityNotFound(_0x3bc5a9,null))[_0x13c8('0x11')](handleError(_0x3bc5a9,null));};exports[_0x13c8('0x15')]=function(_0xe9386a,_0x5ac776){if(_0xe9386a[_0x13c8('0x16')][_0x13c8('0x8')]&&_0xe9386a[_0x13c8('0x16')][_0x13c8('0x17')]){var _0x513085=path[_0x13c8('0x18')](__dirname,_0x13c8('0x19'),_0xe9386a[_0x13c8('0x16')][_0x13c8('0x17')]);var _0x436d5d=process[_0x13c8('0x1a')]();process['chdir'](path[_0x13c8('0x1b')](_0x513085));return execChildProcess()[_0x13c8('0xd')](function(_0x315d6c){process[_0x13c8('0x1c')](_0x436d5d);return pm2['start']({'name':_0xe9386a[_0x13c8('0x16')][_0x13c8('0x8')],'script':_0x513085});})['then'](function(_0x49b552){pm2[_0x13c8('0x1d')]();return _0x49b552[0x0];})[_0x13c8('0xd')](respondWithResult(_0x5ac776,0xc9))['catch'](handleError(_0x5ac776,null));}else{return _0x5ac776['status'](0x1f4)[_0x13c8('0x9')]({'message':_0x13c8('0x1e')});}};exports['update']=function(_0x4df077,_0x196983){if(_0x4df077['body']['id']){delete _0x4df077['body']['id'];}var _0x1c7dc4={'online':_0x13c8('0x1f'),'stopped':_0x13c8('0x20')};if(_0x1c7dc4['hasOwnProperty'](_0x4df077['body'][_0x13c8('0x5')])){return pm2[_0x1c7dc4[_0x4df077[_0x13c8('0x16')][_0x13c8('0x5')]]](_0x4df077[_0x13c8('0x14')]['id'])[_0x13c8('0xd')](respondWithResult(_0x196983,0xc8))[_0x13c8('0x11')](handleError(_0x196983,null));}else{return _0x196983[_0x13c8('0x5')](0x1f4)['send']({'message':_0x13c8('0x21')});}};exports[_0x13c8('0x22')]=function(_0x5a5911,_0x5c85e4){if(_0x5a5911[_0x13c8('0x16')]['id']){delete _0x5a5911[_0x13c8('0x16')]['id'];}if(_0x5a5911['params']['id']){return pm2[_0x13c8('0x23')](_0x5a5911[_0x13c8('0x14')]['id'])['then'](function(_0x21224a){pm2[_0x13c8('0x1d')]();return _0x21224a[0x0];})[_0x13c8('0xd')](respondWithResult(_0x5c85e4,null))[_0x13c8('0x11')](handleError(_0x5c85e4,null));}else{return _0x5c85e4[_0x13c8('0x5')](0x1f4)[_0x13c8('0x9')]({'message':_0x13c8('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 08f6d09..f8ec24d 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 _0x7e4e=['isAuthenticated','getAgents','/queues','getQueues','express','Router','../../components/auth/service','get','/agents'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x7e4e,0x1b4));var _0xe7e4=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0x7e4e[_0x4da382];return _0x10073f;};'use strict';var express=require(_0xe7e4('0x0'));var router=express[_0xe7e4('0x1')]();var auth=require(_0xe7e4('0x2'));var controller=require('./realtime.controller');router[_0xe7e4('0x3')](_0xe7e4('0x4'),auth[_0xe7e4('0x5')](),controller[_0xe7e4('0x6')]);router[_0xe7e4('0x3')](_0xe7e4('0x7'),auth[_0xe7e4('0x5')](),controller[_0xe7e4('0x8')]);module['exports']=router; \ No newline at end of file +var _0xc448=['/agents','isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service','get'];(function(_0x480633,_0x8daa0){var _0x3a9ec1=function(_0x399354){while(--_0x399354){_0x480633['push'](_0x480633['shift']());}};_0x3a9ec1(++_0x8daa0);}(_0xc448,0x11d));var _0x8c44=function(_0x34fe31,_0x38cbf3){_0x34fe31=_0x34fe31-0x0;var _0x2b2f83=_0xc448[_0x34fe31];return _0x2b2f83;};'use strict';var express=require('express');var router=express[_0x8c44('0x0')]();var auth=require(_0x8c44('0x1'));var controller=require('./realtime.controller');router[_0x8c44('0x2')](_0x8c44('0x3'),auth[_0x8c44('0x4')](),controller[_0x8c44('0x5')]);router['get'](_0x8c44('0x6'),auth[_0x8c44('0x4')](),controller[_0x8c44('0x7')]);module[_0x8c44('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 1b55ae9..3771841 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 _0x2eb2=['voice','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','agents','loggedInDb','waiting','talking','busy','merge','pick','filter','queue','length','connectedlinenum','internal','toString','find','getMembers','UserId','accountcode','online','voiceStatus','User','startCase','Pause','unknown','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','every','idle','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','lastLoginAt','lastPauseAt','pauseType','address','mailPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','type','query','role','getOptions','raw','user','agent','nolimit','sort','UserProfile','findAndCountAll','rows','omit','globalStatus','pauseTypeFilter','getQueues','mail','fax','whatsapp','Invalid\x20channel','key','Queues','getResources','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','set','Content-Range','error','stack','name','status','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x2eb2[_0x1c546c];return _0x2cc384;};'use strict';var util=require('util');var _=require(_0x22eb('0x0'));var jayson=require(_0x22eb('0x1'));var qs=require(_0x22eb('0x2'));var logger=require(_0x22eb('0x3'))(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var amiClient=jayson['client'][_0x22eb('0x6')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x1dfef7,_0x10e116){return function(_0x35dd5b){if(_0x35dd5b){var _0x2a9850=typeof _0x10e116[_0x22eb('0x7')]===_0x22eb('0x8')&&typeof _0x10e116[_0x22eb('0x9')]===_0x22eb('0x8');var _0x419601=_0x35dd5b[_0x22eb('0xa')];var _0xb9c8a4=_0x2a9850?0x0:_0x10e116[_0x22eb('0x7')];var _0x489260=_0x2a9850?_0x35dd5b[_0x22eb('0xa')]:_0x10e116['offset']+_0x10e116['limit'];var _0x1aa348;if(_0x489260>=_0x419601){_0x489260=_0x419601;_0x1aa348=0xc8;}else{_0x1aa348=0xce;}_0x1dfef7['status'](_0x1aa348);return _0x1dfef7[_0x22eb('0xb')](_0x22eb('0xc'),_0xb9c8a4+'-'+_0x489260+'/'+_0x419601)['json'](_0x35dd5b);}return null;};}function handleError(_0x5068ea,_0x1f286c){_0x1f286c=_0x1f286c||0x1f4;return function(_0x189f05){logger[_0x22eb('0xd')](_0x189f05[_0x22eb('0xe')]);if(_0x189f05[_0x22eb('0xf')]){delete _0x189f05['name'];}_0x5068ea[_0x22eb('0x10')](_0x1f286c)['send'](_0x189f05);};}function getRealtimeAgents(){return new Promise(function(_0x1f5089,_0x55ede8){return amiClient[_0x22eb('0x11')](_0x22eb('0x12'),{})['then'](function(_0x48b63c){if(_0x48b63c['error'])throw new Error(_0x22eb('0x13'));var _0x5245fe=_0x48b63c['result'];return routingClient[_0x22eb('0x11')]('Agents',{})['then'](function(_0xb7a73a){if(_0xb7a73a[_0x22eb('0xd')])throw new Error(_0x22eb('0x14'));var _0x1ff041=_0xb7a73a[_0x22eb('0x15')];return _0x1f5089(_['merge']({},_0x5245fe,_0x1ff041));});})[_0x22eb('0x16')](function(_0x12bbd1){_0x55ede8(_0x12bbd1);});});}function getRealtimeQueues(_0x10d182,_0x410c25){return new Promise(function(_0x36be50,_0x517313){var _0x2eb115=_0x410c25===_0x22eb('0x17')?amiClient:routingClient;return _0x2eb115[_0x22eb('0x11')](_['startCase'](_0x410c25)+'Queues',_0x10d182)[_0x22eb('0x18')](function(_0x267d97){if(_0x267d97[_0x22eb('0xd')])throw new Error(util[_0x22eb('0x19')](_0x22eb('0x1a'),_0x410c25));return _0x36be50(_0x267d97[_0x22eb('0x15')]);})[_0x22eb('0x16')](function(_0x4e7e69){_0x517313(_0x4e7e69);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2e8f7c,_0x11edbd){return amiClient[_0x22eb('0x11')](_0x22eb('0x1b'),{})[_0x22eb('0x18')](function(_0x4da252){if(_0x4da252[_0x22eb('0xd')])throw new Error(_0x22eb('0x1c'));return _0x2e8f7c(_0x4da252[_0x22eb('0x15')]);})['catch'](function(_0xe0783c){_0x11edbd(_0xe0783c);});});}function initializeQueues(_0x259847,_0x4b409a,_0x32a4b6,_0x222ef3){var _0x1e3015=[_0x22eb('0x1d'),_0x22eb('0x1e'),'waiting','talking',_0x22eb('0x1f')];if(_0x32a4b6===_0x22eb('0x17')&&_0x222ef3===_0x22eb('0x20')){_0x1e3015[_0x22eb('0x21')](_0x22eb('0x22'),_0x22eb('0x23'),_0x22eb('0x24'),_0x22eb('0x25'),_0x22eb('0x26'),_0x22eb('0x27'),_0x22eb('0x28'),_0x22eb('0x29'),'erlangCalls',_0x22eb('0x2a'),'erlangAbandonmentRate',_0x22eb('0x2b'),_0x22eb('0x2c'),_0x22eb('0x2d'),_0x22eb('0x2e'),_0x22eb('0x2f'),_0x22eb('0x30'),_0x22eb('0x31'),_0x22eb('0x32'),_0x22eb('0x33'),_0x22eb('0x34'),'predictiveIntervalAvgTalktime');}return _0x259847['map'](function(_0x239a41){var _0x5ceec1=_0x239a41['get']({'plain':!![]});_0x5ceec1[_0x22eb('0x35')]=[];_0x5ceec1[_0x22eb('0x1f')]=0x0;_0x5ceec1[_0x22eb('0x36')]=0x0;_0x5ceec1[_0x22eb('0x1d')]=0x0;_0x5ceec1[_0x22eb('0x1e')]=0x0;_0x5ceec1[_0x22eb('0x37')]=0x0;if(_0x32a4b6===_0x22eb('0x17')){_0x5ceec1[_0x22eb('0x38')]=0x0;_0x5ceec1[_0x22eb('0x39')]=0x0;if(_0x222ef3===_0x22eb('0x20')){_0x5ceec1['pTalking']=0x0;_0x5ceec1[_0x22eb('0x23')]=0x0;}}var _0x47be01=_['find'](_0x4b409a,['id',_0x5ceec1['id']]);if(_0x47be01)_[_0x22eb('0x3a')](_0x5ceec1,_[_0x22eb('0x3b')](_0x47be01,_0x1e3015));return _0x5ceec1;});}function updateAgentVoiceStatus(_0x48e47e,_0x42e9bd,_0x121c04){var _0x236def=_[_0x22eb('0x3c')](_0x121c04,[_0x22eb('0x3d'),_0x42e9bd['name']]);if(_0x236def[_0x22eb('0x3e')]===0x0)return _0x48e47e[_0x22eb('0x39')]=!![];if(_['some'](_0x236def,[_0x22eb('0x3f'),_0x48e47e[_0x22eb('0x40')][_0x22eb('0x41')]()]))return _0x48e47e[_0x22eb('0x38')]=!![];if(!_0x48e47e[_0x22eb('0x38')])return _0x48e47e['busy']=!![];}function getVoiceQueueAgents(_0x51c8b5,_0x2b1ae1,_0x6cd651,_0x541153){var _0x595d76=_[_0x22eb('0x42')](_0x2b1ae1,['id',_0x51c8b5['id']]);if(!_0x595d76)return _0x51c8b5;return _0x595d76[_0x22eb('0x43')]({'raw':!![]})['then'](function(_0x1d977c){for(var _0x3377eb=0x0;_0x3377eb<_0x1d977c[_0x22eb('0x3e')];_0x3377eb++){var _0x2a8517=_[_0x22eb('0x42')](_0x6cd651,['id',_0x1d977c[_0x3377eb][_0x22eb('0x44')]]);if(!_0x2a8517){_0x2a8517={'id':_0x1d977c[_0x3377eb]['UserId'],'name':_0x1d977c[_0x3377eb][_0x22eb('0x44')],'accountcode':'','online':![]};}var _0x3d2d1d={'id':_0x2a8517['id'],'name':_0x2a8517['name'],'internal':_0x2a8517[_0x22eb('0x45')],'online':Boolean(_0x2a8517[_0x22eb('0x46')]),'paused':Boolean(_0x1d977c[_0x3377eb][_0x22eb('0x1f')])};if(_0x2a8517[_0x22eb('0x47')]===_0x22eb('0x38'))updateAgentVoiceStatus(_0x3d2d1d,_0x51c8b5,_0x541153);if(_0x3d2d1d[_0x22eb('0x46')])_0x51c8b5[_0x22eb('0x36')]++;if(_0x3d2d1d[_0x22eb('0x39')])_0x51c8b5[_0x22eb('0x39')]++;if(_0x3d2d1d[_0x22eb('0x1f')]&&!_0x3d2d1d[_0x22eb('0x39')]&&!_0x3d2d1d[_0x22eb('0x38')])_0x51c8b5[_0x22eb('0x1f')]++;_0x51c8b5[_0x22eb('0x35')][_0x22eb('0x21')](_0x3d2d1d);}return _0x51c8b5;});}function getQueueAgents(_0x471657,_0x6996b4,_0x46e3ec){var _0x507f21=_0x22eb('0x48')+_[_0x22eb('0x49')](_0x46e3ec)+'Queue';var _0x10462d=_0x46e3ec+_0x22eb('0x4a');return db[_0x507f21]['findAll']({'where':{[_['startCase'](_0x46e3ec)+'QueueId']:_0x471657['id']},'raw':!![]})[_0x22eb('0x18')](function(_0x1efc65){for(var _0x4e4c6d=0x0;_0x4e4c6d<_0x1efc65['length'];_0x4e4c6d++){var _0xa7c642=_[_0x22eb('0x42')](_0x6996b4,['id',_0x1efc65[_0x4e4c6d][_0x22eb('0x44')]]);if(!_0xa7c642){_0xa7c642={'id':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'name':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'online':![],['pauseField']:![]};}var _0x3b30a3={'id':_0xa7c642['id'],'name':_0xa7c642[_0x22eb('0xf')],'online':Boolean(_0xa7c642[_0x22eb('0x46')]),'paused':Boolean(_0xa7c642[_0x10462d])};if(_0x3b30a3['online'])_0x471657['loggedInDb']++;_0x471657[_0x22eb('0x35')]['push'](_0x3b30a3);}return _0x471657;});}function isIdle(_0x5e695c){return _0x5e695c==='idle'||_0x5e695c===_0x22eb('0x4b')||_0x5e695c==='unavailable'||_0x5e695c==='ringing'||_['isNil'](_0x5e695c);}function isAgentPaused(_0x517784,_0x36b174){var _0x4b5c03=[_0x517784[_0x22eb('0x4c')],_0x517784[_0x22eb('0x4d')],_0x517784['mailPause'],_0x517784[_0x22eb('0x4e')],_0x517784['smsPause'],_0x517784[_0x22eb('0x4f')],_0x517784[_0x22eb('0x50')]];if(!_0x36b174)return _[_0x22eb('0x51')](_0x4b5c03);var _0x111cbe=_[_0x22eb('0x3c')](_0x4b5c03);return _0x111cbe[_0x22eb('0x3e')]>0x0&&_0x111cbe[_0x22eb('0x3e')]<_0x4b5c03[_0x22eb('0x3e')]?!![]:![];}function isAgentIdle(_0x11942d){if(_0x11942d['voiceStatus']!==_0x22eb('0x52')&&_0x11942d[_0x22eb('0x4f')]){_0x11942d['voiceStatus']=_0x22eb('0x53');return![];}return _[_0x22eb('0x51')]([_0x11942d[_0x22eb('0x54')],_0x11942d[_0x22eb('0x55')],_0x11942d['mailStatus'],_0x11942d[_0x22eb('0x56')],_0x11942d[_0x22eb('0x57')],_0x11942d[_0x22eb('0x47')],_0x11942d[_0x22eb('0x58')]],isIdle);}function getAgentStatus(_0x447177){var _0x10393b='unknown';if(isAgentPaused(_0x447177))_0x10393b=_0x22eb('0x53');else if(isAgentPaused(_0x447177,!![]))_0x10393b='*pause';else if(isAgentIdle(_0x447177))_0x10393b=_0x22eb('0x52');else _0x10393b='busy';return _0x10393b;}exports[_0x22eb('0x59')]=function(_0x254b53,_0x4028ef){var _0x2c1b87={'count':0x0,'rows':[]},_0x3f03df={},_0x4aa0c5,_0x4896ed,_0xfbf2e7=['userpic',_0x22eb('0x46'),_0x22eb('0x5a'),_0x22eb('0x5b'),_0x22eb('0x5c'),_0x22eb('0x5b'),_0x22eb('0x40'),_0x22eb('0x5d'),_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),'whatsappPause',_0x22eb('0x4d'),_0x22eb('0x4f'),_0x22eb('0x60'),_0x22eb('0x61'),_0x22eb('0x62'),_0x22eb('0x63'),_0x22eb('0x64'),_0x22eb('0x65'),_0x22eb('0x66'),_0x22eb('0x67'),_0x22eb('0x68'),_0x22eb('0x69'),_0x22eb('0x6a'),_0x22eb('0x6b'),'chatStatus','openchannelStatus',_0x22eb('0x6c'),_0x22eb('0x57'),_0x22eb('0x58'),_0x22eb('0x55'),_0x22eb('0x47'),'chatStatusTime',_0x22eb('0x6d'),_0x22eb('0x6e'),'smsStatusTime','whatsappStatusTime',_0x22eb('0x6f'),_0x22eb('0x70'),_0x22eb('0x3d'),_0x22eb('0x71'),_0x22eb('0x72'),_0x22eb('0x73'),_0x22eb('0x74'),_0x22eb('0x75')],_0x8e3864=[_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),_0x22eb('0x50'),_0x22eb('0x4d'),'voicePause',_0x22eb('0x46')];Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){var _0x5dbc43=_[_0x22eb('0x77')](db['User'][_0x22eb('0x78')],function(_0x5347b4){return{'name':_0x5347b4[_0x22eb('0x79')],'type':_0x5347b4[_0x22eb('0x7a')]['key']};});_0x254b53[_0x22eb('0x7b')][_0x22eb('0x7c')]='agent';_0x254b53['query'][_0x22eb('0x46')]=!![];_0x3f03df=qs[_0x22eb('0x7d')](_0x5dbc43,_0x254b53);_0x3f03df[_0x22eb('0x7e')]=!![];if(_0x254b53[_0x22eb('0x7f')][_0x22eb('0x7c')]===_0x22eb('0x7f')){var _0x4f5eee={'params':{'id':_0x254b53[_0x22eb('0x7f')]['userProfileId']},'query':{'section':'Agents','role':_0x22eb('0x80'),'online':!![],'nolimit':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x81')],'sort':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x82')],'filter':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x3c')],'raw':!![]}};return db[_0x22eb('0x83')]['getResources'](_0x4f5eee);}return db['User'][_0x22eb('0x84')](_0x3f03df);})[_0x22eb('0x18')](function(_0x49f182){_0x2c1b87[_0x22eb('0xa')]=_0x49f182[_0x22eb('0xa')];_0x4aa0c5=_0x49f182[_0x22eb('0x85')];return getRealtimeAgents();})[_0x22eb('0x18')](function(_0x40faf6){_0x4896ed=_0x40faf6[_0x22eb('0x85')];return _0x4aa0c5['map'](function(_0x3dd49b){var _0x29d4a7=_[_0x22eb('0x42')](_0x4896ed,['id',_0x3dd49b['id']]);if(_0x29d4a7)_['merge'](_0x3dd49b,_['pick'](_[_0x22eb('0x86')](_0x29d4a7,_0x8e3864),_0xfbf2e7));_0x3dd49b[_0x22eb('0x87')]=getAgentStatus(_0x3dd49b);return _0x3dd49b;});})[_0x22eb('0x18')](function(_0x5ebeb5){if(_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']){var _0x1a305d=_[_0x22eb('0x3c')](_0x5ebeb5,[_0x22eb('0x87'),_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']]);if(_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]){_0x1a305d=_[_0x22eb('0x3c')](_0x1a305d,[_0x22eb('0x5c'),_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]]);}}_0x2c1b87[_0x22eb('0x85')]=_0x1a305d||_0x5ebeb5;return _0x2c1b87;})[_0x22eb('0x18')](respondWithFilteredResult(_0x4028ef,_0x3f03df))[_0x22eb('0x16')](handleError(_0x4028ef,null));};exports[_0x22eb('0x89')]=function(_0x14006f,_0x5b4e6a){var _0x1d0749=[_0x22eb('0x8a'),'chat','sms','openchannel',_0x22eb('0x8b'),_0x22eb('0x8c'),'voice'];var _0x10726f={'count':0x0,'rows':[]},_0x15e08a={},_0xe6e71d,_0x41c50e,_0x8cbc83,_0x4ab4f8,_0x5e01b5;Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){if(_0x14006f[_0x22eb('0x7b')]['channel']){if(!_['includes'](_0x1d0749,_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']()))throw new Error(_0x22eb('0x8d'));_0xe6e71d=_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']();}var _0x1e393a=_[_0x22eb('0x49')](_0xe6e71d)+'Queue';var _0x17f51b=_[_0x22eb('0x77')](db[_0x1e393a][_0x22eb('0x78')],function(_0x5823d0){return{'name':_0x5823d0[_0x22eb('0x79')],'type':_0x5823d0[_0x22eb('0x7a')][_0x22eb('0x8e')]};});_0x15e08a=qs[_0x22eb('0x7d')](_0x17f51b,_0x14006f);if(_0x14006f[_0x22eb('0x7f')]['role']===_0x22eb('0x7f')){var _0x2ecc24={'params':{'id':_0x14006f[_0x22eb('0x7f')]['userProfileId']},'query':{'section':_0xe6e71d==='voice'&&_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]===_0x22eb('0x20')?'QueueCampaigns':_[_0x22eb('0x49')](_0xe6e71d)+_0x22eb('0x8f'),'type':_0x14006f[_0x22eb('0x7b')]['type'],'nolimit':!![],'sort':_0x22eb('0xf'),'filter':_0x14006f['query']['filter']}};return db[_0x22eb('0x83')][_0x22eb('0x90')](_0x2ecc24);}return db[_0x1e393a][_0x22eb('0x84')](_0x15e08a);})['then'](function(_0x3fc402){_0x10726f[_0x22eb('0xa')]=_0x3fc402[_0x22eb('0xa')];_0x41c50e=_0x3fc402[_0x22eb('0x85')];return getRealtimeQueues(_0x14006f,_0xe6e71d);})[_0x22eb('0x18')](function(_0x545c0a){_0x4ab4f8=_0x545c0a[_0x22eb('0x85')];return getRealtimeAgents();})['then'](function(_0x36dde2){_0x8cbc83=_0x36dde2[_0x22eb('0x85')];if(_0xe6e71d!=_0x22eb('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0xe19621){_0x5e01b5=_0xe19621?_0xe19621[_0x22eb('0x85')]:[];return initializeQueues(_0x41c50e,_0x4ab4f8,_0xe6e71d,_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]);})[_0x22eb('0x18')](function(_0xeaf655){var _0x45b691=_0xeaf655[_0x22eb('0x77')](function(_0x1ef974){if(_0xe6e71d===_0x22eb('0x17'))return getVoiceQueueAgents(_0x1ef974,_0x41c50e,_0x8cbc83,_0x5e01b5);else return getQueueAgents(_0x1ef974,_0x8cbc83,_0xe6e71d);});return Promise[_0x22eb('0x91')](_0x45b691);})['then'](function(_0x30e721){_0x10726f[_0x22eb('0x85')]=_0x30e721;return _0x10726f;})[_0x22eb('0x18')](respondWithFilteredResult(_0x5b4e6a,_0x15e08a))[_0x22eb('0x16')](handleError(_0x5b4e6a,null));}; \ No newline at end of file +var _0x8958=['includes','toLowerCase','Queue','QueueCampaigns','all','lodash','../../mysqldb','http','client','offset','undefined','count','limit','set','Content-Range','json','stack','name','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','outbound','push','pTalking','originated','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','loggedInDb','talking','busy','find','pick','filter','some','internal','toString','getMembers','length','UserId','online','paused','User','Pause','QueueId','unknown','unavailable','ringing','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','idle','getAgents','userpic','lastPauseAt','pauseType','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','whatsappPause','resolve','rawAttributes','fieldName','type','key','query','role','agent','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','chat','openchannel','fax','channel'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x8958,0x93));var _0x8895=function(_0xfeeea8,_0x2de8be){_0xfeeea8=_0xfeeea8-0x0;var _0x3bda8e=_0x8958[_0xfeeea8];return _0x3bda8e;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var db=require(_0x8895('0x1'))['db'];var amiClient=jayson['client'][_0x8895('0x2')]({'port':0x232a});var routingClient=jayson[_0x8895('0x3')][_0x8895('0x2')]({'port':0x232c});function respondWithFilteredResult(_0x59e641,_0x22fa52){return function(_0x2f03ad){if(_0x2f03ad){var _0x124e1e=typeof _0x22fa52[_0x8895('0x4')]===_0x8895('0x5')&&typeof _0x22fa52['limit']===_0x8895('0x5');var _0xc2be9f=_0x2f03ad[_0x8895('0x6')];var _0x24fe49=_0x124e1e?0x0:_0x22fa52[_0x8895('0x4')];var _0x29c126=_0x124e1e?_0x2f03ad[_0x8895('0x6')]:_0x22fa52[_0x8895('0x4')]+_0x22fa52[_0x8895('0x7')];var _0x107d86;if(_0x29c126>=_0xc2be9f){_0x29c126=_0xc2be9f;_0x107d86=0xc8;}else{_0x107d86=0xce;}_0x59e641['status'](_0x107d86);return _0x59e641[_0x8895('0x8')](_0x8895('0x9'),_0x24fe49+'-'+_0x29c126+'/'+_0xc2be9f)[_0x8895('0xa')](_0x2f03ad);}return null;};}function handleError(_0x301bec,_0x446e1a){_0x446e1a=_0x446e1a||0x1f4;return function(_0xaf93bc){logger['error'](_0xaf93bc[_0x8895('0xb')]);if(_0xaf93bc[_0x8895('0xc')]){delete _0xaf93bc[_0x8895('0xc')];}_0x301bec['status'](_0x446e1a)['send'](_0xaf93bc);};}function getRealtimeAgents(){return new Promise(function(_0x9191b8,_0x4e8f53){return amiClient[_0x8895('0xd')](_0x8895('0xe'),{})[_0x8895('0xf')](function(_0x3d7b59){if(_0x3d7b59[_0x8895('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x4128e2=_0x3d7b59[_0x8895('0x11')];return routingClient[_0x8895('0xd')](_0x8895('0xe'),{})[_0x8895('0xf')](function(_0x1b5c82){if(_0x1b5c82[_0x8895('0x10')])throw new Error(_0x8895('0x12'));var _0x135c11=_0x1b5c82[_0x8895('0x11')];return _0x9191b8(_[_0x8895('0x13')]({},_0x4128e2,_0x135c11));});})[_0x8895('0x14')](function(_0x2df795){_0x4e8f53(_0x2df795);});});}function getRealtimeQueues(_0x54e6d4,_0x522a4e){return new Promise(function(_0x4fcbc3,_0x3daf43){var _0x456282=_0x522a4e===_0x8895('0x15')?amiClient:routingClient;return _0x456282[_0x8895('0xd')](_[_0x8895('0x16')](_0x522a4e)+_0x8895('0x17'),_0x54e6d4)[_0x8895('0xf')](function(_0xc1ce17){if(_0xc1ce17['error'])throw new Error(util[_0x8895('0x18')](_0x8895('0x19'),_0x522a4e));return _0x4fcbc3(_0xc1ce17[_0x8895('0x11')]);})[_0x8895('0x14')](function(_0x29223d){_0x3daf43(_0x29223d);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4d092d,_0x5d354a){return amiClient[_0x8895('0xd')](_0x8895('0x1a'),{})[_0x8895('0xf')](function(_0x24a376){if(_0x24a376['error'])throw new Error(_0x8895('0x1b'));return _0x4d092d(_0x24a376[_0x8895('0x11')]);})[_0x8895('0x14')](function(_0x5486a6){_0x5d354a(_0x5486a6);});});}function initializeQueues(_0x4aee03,_0x78b57,_0x555e60,_0x3d51b0){var _0x3e3b48=[_0x8895('0x1c'),_0x8895('0x1d'),_0x8895('0x1e'),'talking','paused'];if(_0x555e60===_0x8895('0x15')&&_0x3d51b0===_0x8895('0x1f')){_0x3e3b48[_0x8895('0x20')](_0x8895('0x21'),_0x8895('0x22'),'message','dialActive',_0x8895('0x23'),_0x8895('0x24'),_0x8895('0x25'),_0x8895('0x26'),_0x8895('0x27'),'erlangCallToSecond',_0x8895('0x28'),'erlangBusyFactor',_0x8895('0x29'),'dialPredictiveIntervalMaxThreshold',_0x8895('0x2a'),_0x8895('0x2b'),_0x8895('0x2c'),_0x8895('0x2d'),_0x8895('0x2e'),'predictiveIntervalDroppedCallsCallersExit',_0x8895('0x2f'),_0x8895('0x30'));}return _0x4aee03[_0x8895('0x31')](function(_0x34cb11){var _0x330692=_0x34cb11['get']({'plain':!![]});_0x330692[_0x8895('0x32')]=[];_0x330692['paused']=0x0;_0x330692[_0x8895('0x33')]=0x0;_0x330692['loggedIn']=0x0;_0x330692[_0x8895('0x1d')]=0x0;_0x330692[_0x8895('0x1e')]=0x0;if(_0x555e60===_0x8895('0x15')){_0x330692[_0x8895('0x34')]=0x0;_0x330692[_0x8895('0x35')]=0x0;if(_0x3d51b0==='outbound'){_0x330692[_0x8895('0x21')]=0x0;_0x330692['originated']=0x0;}}var _0x57f58a=_[_0x8895('0x36')](_0x78b57,['id',_0x330692['id']]);if(_0x57f58a)_[_0x8895('0x13')](_0x330692,_[_0x8895('0x37')](_0x57f58a,_0x3e3b48));return _0x330692;});}function updateAgentVoiceStatus(_0x25fa39,_0x16e110,_0x4b7fe0){var _0x23e30c=_[_0x8895('0x38')](_0x4b7fe0,['queue',_0x16e110[_0x8895('0xc')]]);if(_0x23e30c['length']===0x0)return _0x25fa39[_0x8895('0x35')]=!![];if(_[_0x8895('0x39')](_0x23e30c,['connectedlinenum',_0x25fa39[_0x8895('0x3a')][_0x8895('0x3b')]()]))return _0x25fa39['talking']=!![];if(!_0x25fa39['talking'])return _0x25fa39[_0x8895('0x35')]=!![];}function getVoiceQueueAgents(_0xf0b378,_0x55aacc,_0x331a9e,_0x39944f){var _0x4917d1=_[_0x8895('0x36')](_0x55aacc,['id',_0xf0b378['id']]);if(!_0x4917d1)return _0xf0b378;return _0x4917d1[_0x8895('0x3c')]({'raw':!![]})[_0x8895('0xf')](function(_0x10005f){for(var _0x1d9e26=0x0;_0x1d9e26<_0x10005f[_0x8895('0x3d')];_0x1d9e26++){var _0x4a7e22=_[_0x8895('0x36')](_0x331a9e,['id',_0x10005f[_0x1d9e26]['UserId']]);if(!_0x4a7e22){_0x4a7e22={'id':_0x10005f[_0x1d9e26][_0x8895('0x3e')],'name':_0x10005f[_0x1d9e26][_0x8895('0x3e')],'accountcode':'','online':![]};}var _0x526d90={'id':_0x4a7e22['id'],'name':_0x4a7e22[_0x8895('0xc')],'internal':_0x4a7e22['accountcode'],'online':Boolean(_0x4a7e22[_0x8895('0x3f')]),'paused':Boolean(_0x10005f[_0x1d9e26]['paused'])};if(_0x4a7e22['voiceStatus']==='talking')updateAgentVoiceStatus(_0x526d90,_0xf0b378,_0x39944f);if(_0x526d90['online'])_0xf0b378['loggedInDb']++;if(_0x526d90['busy'])_0xf0b378[_0x8895('0x35')]++;if(_0x526d90[_0x8895('0x40')]&&!_0x526d90['busy']&&!_0x526d90['talking'])_0xf0b378[_0x8895('0x40')]++;_0xf0b378[_0x8895('0x32')]['push'](_0x526d90);}return _0xf0b378;});}function getQueueAgents(_0xb44bec,_0x349f96,_0x39e42a){var _0x3b873b=_0x8895('0x41')+_['startCase'](_0x39e42a)+'Queue';var _0x558c55=_0x39e42a+_0x8895('0x42');return db[_0x3b873b]['findAll']({'where':{[_[_0x8895('0x16')](_0x39e42a)+_0x8895('0x43')]:_0xb44bec['id']},'raw':!![]})[_0x8895('0xf')](function(_0x28aaa9){for(var _0x587ccb=0x0;_0x587ccb<_0x28aaa9[_0x8895('0x3d')];_0x587ccb++){var _0x1ea91a=_[_0x8895('0x36')](_0x349f96,['id',_0x28aaa9[_0x587ccb][_0x8895('0x3e')]]);if(!_0x1ea91a){_0x1ea91a={'id':_0x28aaa9[_0x587ccb][_0x8895('0x3e')],'name':_0x28aaa9[_0x587ccb][_0x8895('0x3e')],'online':![],['pauseField']:![]};}var _0x14295a={'id':_0x1ea91a['id'],'name':_0x1ea91a[_0x8895('0xc')],'online':Boolean(_0x1ea91a['online']),'paused':Boolean(_0x1ea91a[_0x558c55])};if(_0x14295a[_0x8895('0x3f')])_0xb44bec[_0x8895('0x33')]++;_0xb44bec['agents'][_0x8895('0x20')](_0x14295a);}return _0xb44bec;});}function isIdle(_0x55bd4a){return _0x55bd4a==='idle'||_0x55bd4a===_0x8895('0x44')||_0x55bd4a===_0x8895('0x45')||_0x55bd4a===_0x8895('0x46')||_['isNil'](_0x55bd4a);}function isAgentPaused(_0x227587,_0x4d65f5){var _0x39a20c=[_0x227587[_0x8895('0x47')],_0x227587[_0x8895('0x48')],_0x227587[_0x8895('0x49')],_0x227587[_0x8895('0x4a')],_0x227587[_0x8895('0x4b')],_0x227587[_0x8895('0x4c')],_0x227587['whatsappPause']];if(!_0x4d65f5)return _['every'](_0x39a20c);var _0x2a933c=_[_0x8895('0x38')](_0x39a20c);return _0x2a933c['length']>0x0&&_0x2a933c[_0x8895('0x3d')]<_0x39a20c['length']?!![]:![];}function isAgentIdle(_0x4e8af3){if(_0x4e8af3[_0x8895('0x4d')]!=='idle'&&_0x4e8af3[_0x8895('0x4c')]){_0x4e8af3[_0x8895('0x4d')]=_0x8895('0x4e');return![];}return _[_0x8895('0x4f')]([_0x4e8af3[_0x8895('0x50')],_0x4e8af3[_0x8895('0x51')],_0x4e8af3[_0x8895('0x52')],_0x4e8af3[_0x8895('0x53')],_0x4e8af3['smsStatus'],_0x4e8af3[_0x8895('0x4d')],_0x4e8af3[_0x8895('0x54')]],isIdle);}function getAgentStatus(_0x2f81f7){var _0x5a5bc6=_0x8895('0x44');if(isAgentPaused(_0x2f81f7))_0x5a5bc6=_0x8895('0x4e');else if(isAgentPaused(_0x2f81f7,!![]))_0x5a5bc6=_0x8895('0x55');else if(isAgentIdle(_0x2f81f7))_0x5a5bc6=_0x8895('0x56');else _0x5a5bc6=_0x8895('0x35');return _0x5a5bc6;}exports[_0x8895('0x57')]=function(_0x434ab8,_0x216e6e){var _0x13488f={'count':0x0,'rows':[]},_0x27e9db={},_0x4fe2c4,_0x2fe39c,_0x17256c=[_0x8895('0x58'),_0x8895('0x3f'),'lastLoginAt',_0x8895('0x59'),_0x8895('0x5a'),_0x8895('0x59'),_0x8895('0x3a'),_0x8895('0x5b'),'chatPause',_0x8895('0x4a'),_0x8895('0x49'),_0x8895('0x4b'),'whatsappPause',_0x8895('0x48'),_0x8895('0x4c'),_0x8895('0x5c'),'openchannelCapacity',_0x8895('0x5d'),_0x8895('0x5e'),'whatsappCapacity',_0x8895('0x5f'),_0x8895('0x60'),'openchannelCurrentCapacity',_0x8895('0x61'),_0x8895('0x62'),_0x8895('0x63'),_0x8895('0x64'),'chatStatus','openchannelStatus',_0x8895('0x52'),_0x8895('0x65'),_0x8895('0x54'),'faxStatus',_0x8895('0x4d'),_0x8895('0x66'),'openchannelStatusTime',_0x8895('0x67'),'smsStatusTime',_0x8895('0x68'),_0x8895('0x69'),_0x8895('0x6a'),_0x8895('0x6b'),_0x8895('0x6c'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x8895('0x6d'),_0x8895('0x6e')],_0xb3d1ab=['chatPause',_0x8895('0x4a'),_0x8895('0x49'),_0x8895('0x4b'),_0x8895('0x6f'),'faxPause',_0x8895('0x4c'),_0x8895('0x3f')];Promise[_0x8895('0x70')]()[_0x8895('0xf')](function(){var _0x407b23=_[_0x8895('0x31')](db[_0x8895('0x41')][_0x8895('0x71')],function(_0x2bffd7){return{'name':_0x2bffd7[_0x8895('0x72')],'type':_0x2bffd7[_0x8895('0x73')][_0x8895('0x74')]};});_0x434ab8[_0x8895('0x75')][_0x8895('0x76')]=_0x8895('0x77');_0x434ab8['query']['online']=!![];_0x27e9db=qs['getOptions'](_0x407b23,_0x434ab8);_0x27e9db[_0x8895('0x78')]=!![];if(_0x434ab8[_0x8895('0x79')][_0x8895('0x76')]===_0x8895('0x79')){var _0x148951={'params':{'id':_0x434ab8['user'][_0x8895('0x7a')]},'query':{'section':_0x8895('0xe'),'role':'agent','online':!![],'nolimit':_0x434ab8[_0x8895('0x75')][_0x8895('0x7b')],'sort':_0x434ab8[_0x8895('0x75')][_0x8895('0x7c')],'filter':_0x434ab8[_0x8895('0x75')]['filter'],'raw':!![]}};return db[_0x8895('0x7d')][_0x8895('0x7e')](_0x148951);}return db[_0x8895('0x41')][_0x8895('0x7f')](_0x27e9db);})[_0x8895('0xf')](function(_0x7a312c){_0x13488f[_0x8895('0x6')]=_0x7a312c['count'];_0x4fe2c4=_0x7a312c[_0x8895('0x80')];return getRealtimeAgents();})[_0x8895('0xf')](function(_0x49dcab){_0x2fe39c=_0x49dcab[_0x8895('0x80')];return _0x4fe2c4[_0x8895('0x31')](function(_0x46efed){var _0x3e58a7=_[_0x8895('0x36')](_0x2fe39c,['id',_0x46efed['id']]);if(_0x3e58a7)_['merge'](_0x46efed,_[_0x8895('0x37')](_['omit'](_0x3e58a7,_0xb3d1ab),_0x17256c));_0x46efed[_0x8895('0x81')]=getAgentStatus(_0x46efed);return _0x46efed;});})[_0x8895('0xf')](function(_0x5d2fb0){if(_0x434ab8[_0x8895('0x75')][_0x8895('0x82')]){var _0x140b2a=_[_0x8895('0x38')](_0x5d2fb0,['globalStatus',_0x434ab8[_0x8895('0x75')]['globalStatusFilter']]);if(_0x434ab8['query'][_0x8895('0x83')]){_0x140b2a=_[_0x8895('0x38')](_0x140b2a,[_0x8895('0x5a'),_0x434ab8['query'][_0x8895('0x83')]]);}}_0x13488f['rows']=_0x140b2a||_0x5d2fb0;return _0x13488f;})[_0x8895('0xf')](respondWithFilteredResult(_0x216e6e,_0x27e9db))[_0x8895('0x14')](handleError(_0x216e6e,null));};exports[_0x8895('0x84')]=function(_0x42d342,_0x2cc5fa){var _0x56455a=['mail',_0x8895('0x85'),'sms',_0x8895('0x86'),_0x8895('0x87'),'whatsapp',_0x8895('0x15')];var _0xd9637a={'count':0x0,'rows':[]},_0x3ace6f={},_0xc4c8dc,_0x166e9a,_0x4f80a3,_0xb2d055,_0x5af076;Promise['resolve']()[_0x8895('0xf')](function(){if(_0x42d342['query'][_0x8895('0x88')]){if(!_[_0x8895('0x89')](_0x56455a,_0x42d342[_0x8895('0x75')][_0x8895('0x88')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0xc4c8dc=_0x42d342['query'][_0x8895('0x88')][_0x8895('0x8a')]();}var _0x1e0fa4=_[_0x8895('0x16')](_0xc4c8dc)+_0x8895('0x8b');var _0x3fed83=_['map'](db[_0x1e0fa4][_0x8895('0x71')],function(_0x102b48){return{'name':_0x102b48[_0x8895('0x72')],'type':_0x102b48['type'][_0x8895('0x74')]};});_0x3ace6f=qs['getOptions'](_0x3fed83,_0x42d342);if(_0x42d342[_0x8895('0x79')]['role']===_0x8895('0x79')){var _0x452756={'params':{'id':_0x42d342['user'][_0x8895('0x7a')]},'query':{'section':_0xc4c8dc===_0x8895('0x15')&&_0x42d342['query'][_0x8895('0x73')]===_0x8895('0x1f')?_0x8895('0x8c'):_[_0x8895('0x16')](_0xc4c8dc)+_0x8895('0x17'),'type':_0x42d342[_0x8895('0x75')][_0x8895('0x73')],'nolimit':!![],'sort':'name','filter':_0x42d342[_0x8895('0x75')]['filter']}};return db[_0x8895('0x7d')][_0x8895('0x7e')](_0x452756);}return db[_0x1e0fa4][_0x8895('0x7f')](_0x3ace6f);})[_0x8895('0xf')](function(_0x4e6691){_0xd9637a[_0x8895('0x6')]=_0x4e6691[_0x8895('0x6')];_0x166e9a=_0x4e6691[_0x8895('0x80')];return getRealtimeQueues(_0x42d342,_0xc4c8dc);})[_0x8895('0xf')](function(_0x2d803b){_0xb2d055=_0x2d803b[_0x8895('0x80')];return getRealtimeAgents();})[_0x8895('0xf')](function(_0x2661ff){_0x4f80a3=_0x2661ff['rows'];if(_0xc4c8dc!=_0x8895('0x15'))return;return getRealtimeVoiceQueueChannels();})[_0x8895('0xf')](function(_0x55f4b6){_0x5af076=_0x55f4b6?_0x55f4b6['rows']:[];return initializeQueues(_0x166e9a,_0xb2d055,_0xc4c8dc,_0x42d342[_0x8895('0x75')][_0x8895('0x73')]);})[_0x8895('0xf')](function(_0xfbb2){var _0x52cf28=_0xfbb2['map'](function(_0x12fa59){if(_0xc4c8dc===_0x8895('0x15'))return getVoiceQueueAgents(_0x12fa59,_0x166e9a,_0x4f80a3,_0x5af076);else return getQueueAgents(_0x12fa59,_0x4f80a3,_0xc4c8dc);});return Promise[_0x8895('0x8d')](_0x52cf28);})[_0x8895('0xf')](function(_0x3a7f0b){_0xd9637a['rows']=_0x3a7f0b;return _0xd9637a;})[_0x8895('0xf')](respondWithFilteredResult(_0x2cc5fa,_0x3ace6f))[_0x8895('0x14')](handleError(_0x2cc5fa,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 70cd027..9da06d7 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4cbac3,_0x1c73d0){var _0x31451b=function(_0x47500f){while(--_0x47500f){_0x4cbac3['push'](_0x4cbac3['shift']());}};_0x31451b(++_0x1c73d0);}(_0xe706,0xa3));var _0x6e70=function(_0x2cc374,_0x21c582){_0x2cc374=_0x2cc374-0x0;var _0x306658=_0xe706[_0x2cc374];return _0x306658;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x386f1f,_0x450a45){var _0x3395e8=function(_0x2a54e5){while(--_0x2a54e5){_0x386f1f['push'](_0x386f1f['shift']());}};_0x3395e8(++_0x450a45);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xcb91[_0x3b7b8a];return _0x441206;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a178378..c283bb3 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 _0x0e76=['sequelize','STRING','DATE','INTEGER'];(function(_0x3c4fd5,_0x1de0bc){var _0x448cea=function(_0x1da63d){while(--_0x1da63d){_0x3c4fd5['push'](_0x3c4fd5['shift']());}};_0x448cea(++_0x1de0bc);}(_0x0e76,0xc4));var _0x60e7=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x0e76[_0x17cb63];return _0x4340bc;};'use strict';var Sequelize=require(_0x60e7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x60e7('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x60e7('0x1')]},'starttime':{'type':Sequelize[_0x60e7('0x2')]},'responsetime':{'type':Sequelize[_0x60e7('0x2')]},'ringtime':{'type':Sequelize[_0x60e7('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x60e7('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x60e7('0x1')]}}; \ No newline at end of file +var _0x84e7=['DATE','STRING','exports','INTEGER'];(function(_0x3ecf64,_0x481d58){var _0x55990b=function(_0x262304){while(--_0x262304){_0x3ecf64['push'](_0x3ecf64['shift']());}};_0x55990b(++_0x481d58);}(_0x84e7,0x122));var _0x784e=function(_0x217cd1,_0x10c0a5){_0x217cd1=_0x217cd1-0x0;var _0x515315=_0x84e7[_0x217cd1];return _0x515315;};'use strict';var Sequelize=require('sequelize');module[_0x784e('0x0')]={'state':{'type':Sequelize[_0x784e('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x784e('0x2')]},'uniqueid':{'type':Sequelize[_0x784e('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x784e('0x2')]},'ringtime':{'type':Sequelize[_0x784e('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x784e('0x3')]},'campaigntype':{'type':Sequelize[_0x784e('0x3')]},'membername':{'type':Sequelize[_0x784e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index aba03ed..880e03a 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 _0x0c57=['api','bluebird','request-promise','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0c57,0x1d4));var _0x70c5=function(_0x226e3c,_0x17928e){_0x226e3c=_0x226e3c-0x0;var _0x334a4a=_0x0c57[_0x226e3c];return _0x334a4a;};'use strict';var _=require(_0x70c5('0x0'));var util=require('util');var logger=require(_0x70c5('0x1'))(_0x70c5('0x2'));var moment=require('moment');var BPromise=require(_0x70c5('0x3'));var rp=require(_0x70c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70c5('0x5'));var config=require('../../config/environment');var attributes=require(_0x70c5('0x6'));module[_0x70c5('0x7')]=function(_0xdc0037,_0x2c039e){return _0xdc0037['define'](_0x70c5('0x8'),attributes,{'tableName':_0x70c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x850c=['ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x850c,0x156));var _0xc850=function(_0x5c5220,_0x11846e){_0x5c5220=_0x5c5220-0x0;var _0x1ef8ce=_0x850c[_0x5c5220];return _0x1ef8ce;};'use strict';var _=require(_0xc850('0x0'));var util=require('util');var logger=require(_0xc850('0x1'))(_0xc850('0x2'));var moment=require(_0xc850('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc850('0x4'));var rimraf=require(_0xc850('0x5'));var config=require(_0xc850('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xc850('0x7')]=function(_0x12c563,_0x386846){return _0x12c563['define'](_0xc850('0x8'),attributes,{'tableName':_0xc850('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c5a2e4f..8104839 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 _0xf202=['body','options','raw','stringify','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf202,0xb3));var _0x2f20=function(_0x8e736f,_0x5e637b){_0x8e736f=_0x8e736f-0x0;var _0x1c5747=_0xf202[_0x8e736f];return _0x1c5747;};'use strict';var _=require(_0x2f20('0x0'));var util=require(_0x2f20('0x1'));var moment=require('moment');var BPromise=require(_0x2f20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f20('0x4'));var logger=require(_0x2f20('0x5'))(_0x2f20('0x6'));var config=require('../../config/environment');var jayson=require(_0x2f20('0x7'));var client=jayson[_0x2f20('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd06a8,_0x2739a0,_0x3fccfc){return new BPromise(function(_0x459c55,_0x50da6a){return client[_0x2f20('0x9')](_0xcd06a8,_0x3fccfc)[_0x2f20('0xa')](function(_0xf96232){logger['info'](_0x2f20('0xb'),_0x2739a0,_0x2f20('0xc'));logger[_0x2f20('0xd')](_0x2f20('0xe'),_0x2739a0,'request\x20sent',JSON['stringify'](_0xf96232));if(_0xf96232[_0x2f20('0xf')]){if(_0xf96232['error']['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2739a0,_0xf96232[_0x2f20('0xf')][_0x2f20('0x10')]);return _0x50da6a(_0xf96232['error'][_0x2f20('0x10')]);}logger['error'](_0x2f20('0xb'),_0x2739a0,_0xf96232[_0x2f20('0xf')]['message']);return _0x459c55(_0xf96232[_0x2f20('0xf')][_0x2f20('0x10')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x2739a0,'request\x20sent');_0x459c55(_0xf96232[_0x2f20('0x11')][_0x2f20('0x10')]);}})['catch'](function(_0x649df3){logger[_0x2f20('0xf')](_0x2f20('0xb'),_0x2739a0,_0x649df3);_0x50da6a(_0x649df3);});});}exports[_0x2f20('0x12')]=function(_0x5d42bf){var _0x12b0f7=this;return new Promise(function(_0x7d389e,_0x3e106a){return db[_0x2f20('0x13')][_0x2f20('0x14')](_0x5d42bf[_0x2f20('0x15')],{'raw':_0x5d42bf[_0x2f20('0x16')]?_0x5d42bf[_0x2f20('0x16')][_0x2f20('0x17')]===undefined?!![]:![]:!![]})[_0x2f20('0xa')](function(_0x13d113){logger['info'](_0x2f20('0x12'),_0x5d42bf);logger['debug'](_0x2f20('0x12'),_0x5d42bf,JSON[_0x2f20('0x18')](_0x13d113));_0x7d389e(_0x13d113);})['catch'](function(_0xb47ed7){logger[_0x2f20('0xf')](_0x2f20('0x12'),_0xb47ed7['message'],_0x5d42bf);_0x3e106a(_0x12b0f7[_0x2f20('0xf')](0x1f4,_0xb47ed7[_0x2f20('0x10')]));});});}; \ No newline at end of file +var _0xa14f=['message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2a4553,_0x124001){var _0x495ae5=function(_0x3b6a9b){while(--_0x3b6a9b){_0x2a4553['push'](_0x2a4553['shift']());}};_0x495ae5(++_0x124001);}(_0xa14f,0xde));var _0xfa14=function(_0x5b7d9c,_0x2a5eb8){_0x5b7d9c=_0x5b7d9c-0x0;var _0x37dfb5=_0xa14f[_0x5b7d9c];return _0x37dfb5;};'use strict';var _=require(_0xfa14('0x0'));var util=require(_0xfa14('0x1'));var moment=require(_0xfa14('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa14('0x3'));var db=require(_0xfa14('0x4'))['db'];var utils=require(_0xfa14('0x5'));var logger=require('../../config/logger')(_0xfa14('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa14('0x7'));var client=jayson[_0xfa14('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c25e5,_0x3d8681,_0x5326ac){return new BPromise(function(_0x45ded5,_0x3d2f13){return client[_0xfa14('0x9')](_0x5c25e5,_0x5326ac)[_0xfa14('0xa')](function(_0xc99b19){logger[_0xfa14('0xb')](_0xfa14('0xc'),_0x3d8681,_0xfa14('0xd'));logger[_0xfa14('0xe')](_0xfa14('0xf'),_0x3d8681,_0xfa14('0xd'),JSON['stringify'](_0xc99b19));if(_0xc99b19['error']){if(_0xc99b19[_0xfa14('0x10')][_0xfa14('0x11')]===0x1f4){logger[_0xfa14('0x10')](_0xfa14('0xc'),_0x3d8681,_0xc99b19[_0xfa14('0x10')]['message']);return _0x3d2f13(_0xc99b19[_0xfa14('0x10')]['message']);}logger[_0xfa14('0x10')](_0xfa14('0xc'),_0x3d8681,_0xc99b19['error'][_0xfa14('0x12')]);return _0x45ded5(_0xc99b19[_0xfa14('0x10')]['message']);}else{logger['info'](_0xfa14('0xc'),_0x3d8681,_0xfa14('0xd'));_0x45ded5(_0xc99b19['result'][_0xfa14('0x12')]);}})['catch'](function(_0x203d65){logger[_0xfa14('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x3d8681,_0x203d65);_0x3d2f13(_0x203d65);});});}exports[_0xfa14('0x13')]=function(_0x1237e5){var _0x1c11a9=this;return new Promise(function(_0x4341e8,_0x28d04e){return db[_0xfa14('0x14')][_0xfa14('0x15')](_0x1237e5[_0xfa14('0x16')],{'raw':_0x1237e5[_0xfa14('0x17')]?_0x1237e5[_0xfa14('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x532203){logger[_0xfa14('0xb')](_0xfa14('0x13'),_0x1237e5);logger['debug'](_0xfa14('0x13'),_0x1237e5,JSON['stringify'](_0x532203));_0x4341e8(_0x532203);})['catch'](function(_0x420afd){logger['error'](_0xfa14('0x13'),_0x420afd['message'],_0x1237e5);_0x28d04e(_0x1c11a9[_0xfa14('0x10')](0x1f4,_0x420afd[_0xfa14('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 44a7a3e..09960a5 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 _0x0344=['showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x0344,0x14b));var _0x4034=function(_0x192a6b,_0x1b84c2){_0x192a6b=_0x192a6b-0x0;var _0x124061=_0x0344[_0x192a6b];return _0x124061;};'use strict';var multer=require(_0x4034('0x0'));var util=require(_0x4034('0x1'));var path=require('path');var express=require(_0x4034('0x2'));var router=express[_0x4034('0x3')]();var auth=require(_0x4034('0x4'));var controller=require(_0x4034('0x5'));router['get'](_0x4034('0x6'),auth['isAuthenticated'](),controller[_0x4034('0x7')]);router[_0x4034('0x8')](_0x4034('0x9'),auth[_0x4034('0xa')](),controller[_0x4034('0xb')]);router[_0x4034('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4034('0xa')](),controller['voiceChannelStopMixMonitor']);router[_0x4034('0x8')](_0x4034('0xc'),auth[_0x4034('0xa')](),controller[_0x4034('0xd')]);router[_0x4034('0x8')]('/chat/queues',auth[_0x4034('0xa')](),controller[_0x4034('0xe')]);router[_0x4034('0x8')](_0x4034('0xf'),auth[_0x4034('0xa')](),controller[_0x4034('0x10')]);router[_0x4034('0x8')](_0x4034('0x11'),auth[_0x4034('0xa')](),controller[_0x4034('0x12')]);router[_0x4034('0x8')](_0x4034('0x13'),auth[_0x4034('0xa')](),controller[_0x4034('0x14')]);router[_0x4034('0x8')](_0x4034('0x15'),auth[_0x4034('0xa')](),controller[_0x4034('0x16')]);router[_0x4034('0x8')](_0x4034('0x17'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x4034('0x8')](_0x4034('0x18'),auth[_0x4034('0xa')](),controller[_0x4034('0x19')]);router['get'](_0x4034('0x1a'),auth[_0x4034('0xa')](),controller[_0x4034('0x1b')]);router[_0x4034('0x8')]('/voice/queues/channels',auth[_0x4034('0xa')](),controller[_0x4034('0x1c')]);router[_0x4034('0x8')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x4034('0x1d')]);router[_0x4034('0x8')](_0x4034('0x1e'),auth[_0x4034('0xa')](),controller[_0x4034('0x1f')]);router[_0x4034('0x8')](_0x4034('0x20'),auth[_0x4034('0xa')](),controller[_0x4034('0x21')]);router[_0x4034('0x8')](_0x4034('0x22'),auth[_0x4034('0xa')](),controller[_0x4034('0x23')]);router[_0x4034('0x24')]('/voice/queues/:id',auth[_0x4034('0xa')](),controller['updateVoiceQueue']);router['get'](_0x4034('0x25'),auth[_0x4034('0xa')](),controller[_0x4034('0x26')]);router[_0x4034('0x8')](_0x4034('0x27'),auth['isAuthenticated'](),controller[_0x4034('0x28')]);router['get'](_0x4034('0x29'),auth[_0x4034('0xa')](),controller[_0x4034('0x2a')]);router['put'](_0x4034('0x2b'),auth[_0x4034('0xa')](),controller[_0x4034('0x2c')]);router['get'](_0x4034('0x2d'),auth[_0x4034('0xa')](),controller[_0x4034('0x2e')]);router['get']('/trunks',auth[_0x4034('0xa')](),controller[_0x4034('0x2f')]);router[_0x4034('0x8')]('/campaigns',auth[_0x4034('0xa')](),controller[_0x4034('0x30')]);router['get'](_0x4034('0x31'),auth[_0x4034('0xa')](),controller[_0x4034('0x32')]);router[_0x4034('0x8')](_0x4034('0x33'),auth[_0x4034('0xa')](),controller['chatQueuesWaitingInteractions']);router[_0x4034('0x8')](_0x4034('0x34'),auth[_0x4034('0xa')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x4034('0x35'),auth[_0x4034('0xa')](),controller['openchannelQueuesWaitingInteractions']);router[_0x4034('0x8')](_0x4034('0x36'),auth[_0x4034('0xa')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x4034('0x8')](_0x4034('0x37'),auth[_0x4034('0xa')](),controller['smsQueuesWaitingInteractions']);router[_0x4034('0x8')]('/whatsapp/queues/waitinginteractions',auth[_0x4034('0xa')](),controller[_0x4034('0x38')]);router[_0x4034('0x8')](_0x4034('0x39'),auth[_0x4034('0xa')](),controller[_0x4034('0x3a')]);router[_0x4034('0x3b')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4034('0x3c')](_0x4034('0x3d')));router[_0x4034('0x8')](_0x4034('0x3e'),auth[_0x4034('0xa')](),controller[_0x4034('0x3f')]);router[_0x4034('0x3b')](_0x4034('0x40'),auth[_0x4034('0xa')](),controller[_0x4034('0x3c')](_0x4034('0x41')));router[_0x4034('0x8')](_0x4034('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router['post'](_0x4034('0x43'),auth['isAuthenticated'](),controller[_0x4034('0x3c')](_0x4034('0x44')));router[_0x4034('0x8')](_0x4034('0x45'),auth[_0x4034('0xa')](),controller['showFaxQueues']);router[_0x4034('0x3b')](_0x4034('0x46'),auth[_0x4034('0xa')](),controller[_0x4034('0x3c')](_0x4034('0x47')));router[_0x4034('0x8')](_0x4034('0x48'),auth[_0x4034('0xa')](),controller[_0x4034('0x49')]);router[_0x4034('0x3b')](_0x4034('0x4a'),auth[_0x4034('0xa')](),controller[_0x4034('0x3c')](_0x4034('0x4b')));router[_0x4034('0x3b')]('/whatsapp/queues/:id/notify',auth[_0x4034('0xa')](),controller['queueNotify'](_0x4034('0x4c')));router[_0x4034('0x8')](_0x4034('0x4d'),auth['isAuthenticated'](),controller[_0x4034('0x4e')]);router[_0x4034('0x8')]('/whatsapp/queues/:id',auth[_0x4034('0xa')](),controller[_0x4034('0x4f')]);router[_0x4034('0x3b')](_0x4034('0x50'),auth[_0x4034('0xa')](),controller[_0x4034('0x51')]);module['exports']=router; \ No newline at end of file +var _0xcbcd=['updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xcbcd[_0x22e9fe];return _0x47cd19;};'use strict';var multer=require('multer');var util=require(_0xdcbc('0x0'));var path=require(_0xdcbc('0x1'));var express=require(_0xdcbc('0x2'));var router=express[_0xdcbc('0x3')]();var auth=require(_0xdcbc('0x4'));var controller=require(_0xdcbc('0x5'));router['get'](_0xdcbc('0x6'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x8')]);router[_0xdcbc('0x9')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0xa')]);router['get'](_0xdcbc('0xb'),auth['isAuthenticated'](),controller[_0xdcbc('0xc')]);router[_0xdcbc('0x9')]('/voice/queues',auth['isAuthenticated'](),controller[_0xdcbc('0xd')]);router[_0xdcbc('0x9')](_0xdcbc('0xe'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0xf')]);router[_0xdcbc('0x9')](_0xdcbc('0x10'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x11')]);router[_0xdcbc('0x9')](_0xdcbc('0x12'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x13')]);router['get'](_0xdcbc('0x14'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x15')]);router[_0xdcbc('0x9')](_0xdcbc('0x16'),auth['isAuthenticated'](),controller[_0xdcbc('0x17')]);router[_0xdcbc('0x9')](_0xdcbc('0x18'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x19')]);router[_0xdcbc('0x9')](_0xdcbc('0x1a'),auth[_0xdcbc('0x7')](),controller['faxQueues']);router[_0xdcbc('0x9')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xdcbc('0x1b')]);router['get'](_0xdcbc('0x1c'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x1d')]);router[_0xdcbc('0x9')](_0xdcbc('0x1e'),auth[_0xdcbc('0x7')](),controller['voiceQueuesChannel']);router[_0xdcbc('0x9')](_0xdcbc('0x1f'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x20')]);router[_0xdcbc('0x9')](_0xdcbc('0x21'),auth[_0xdcbc('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xdcbc('0x9')](_0xdcbc('0x22'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x23')]);router[_0xdcbc('0x24')]('/voice/queues/:id',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x25')]);router[_0xdcbc('0x9')](_0xdcbc('0x26'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x27')]);router[_0xdcbc('0x9')](_0xdcbc('0x28'),auth[_0xdcbc('0x7')](),controller['outboundChannels']);router[_0xdcbc('0x9')](_0xdcbc('0x29'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x2a')]);router[_0xdcbc('0x24')](_0xdcbc('0x2b'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x2c')]);router['get']('/telephones',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x2d')]);router[_0xdcbc('0x9')]('/trunks',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x2e')]);router['get'](_0xdcbc('0x2f'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x30')]);router[_0xdcbc('0x9')](_0xdcbc('0x31'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x32')]);router[_0xdcbc('0x9')](_0xdcbc('0x33'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x34')]);router['get'](_0xdcbc('0x35'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x36')]);router[_0xdcbc('0x9')](_0xdcbc('0x37'),auth['isAuthenticated'](),controller[_0xdcbc('0x38')]);router[_0xdcbc('0x9')]('/openchannel/queues/:id/waitinginteractions',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x39')]);router[_0xdcbc('0x9')]('/sms/queues/waitinginteractions',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x3a')]);router[_0xdcbc('0x9')]('/whatsapp/queues/waitinginteractions',auth[_0xdcbc('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xdcbc('0x9')](_0xdcbc('0x3b'),auth[_0xdcbc('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xdcbc('0x3c')]('/mail/queues/:id/notify',auth[_0xdcbc('0x7')](),controller['queueNotify'](_0xdcbc('0x3d')));router[_0xdcbc('0x9')](_0xdcbc('0x3e'),auth['isAuthenticated'](),controller[_0xdcbc('0x3f')]);router['post']('/chat/queues/:id/notify',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x40')](_0xdcbc('0x41')));router[_0xdcbc('0x9')](_0xdcbc('0x42'),auth[_0xdcbc('0x7')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x40')](_0xdcbc('0x43')));router[_0xdcbc('0x9')](_0xdcbc('0x44'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x45')]);router['post'](_0xdcbc('0x46'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x40')](_0xdcbc('0x47')));router['get'](_0xdcbc('0x48'),auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x49')]);router[_0xdcbc('0x3c')]('/sms/queues/:id/notify',auth[_0xdcbc('0x7')](),controller['queueNotify'](_0xdcbc('0x4a')));router['post'](_0xdcbc('0x4b'),auth['isAuthenticated'](),controller[_0xdcbc('0x40')](_0xdcbc('0x4c')));router['get']('/sms/queues/:id',auth[_0xdcbc('0x7')](),controller[_0xdcbc('0x4d')]);router[_0xdcbc('0x9')]('/whatsapp/queues/:id',auth[_0xdcbc('0x7')](),controller['showWhatsappQueues']);router['post'](_0xdcbc('0x4e'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xdcbc('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1df336c..8249ce3 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 _0xbd51=['chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','error','code','message','catch','status','json','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x28094e,_0x177dea){var _0x391994=function(_0x5a9b1a){while(--_0x5a9b1a){_0x28094e['push'](_0x28094e['shift']());}};_0x391994(++_0x177dea);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3798fd,_0x5de55b){_0x3798fd=_0x3798fd-0x0;var _0x436e24=_0xbd51[_0x3798fd];return _0x436e24;};'use strict';var BPromise=require(_0x1bd5('0x0'));var moment=require('moment');var _=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var db=require(_0x1bd5('0x3'))['db'];var logger=require(_0x1bd5('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232b});var routingClient=jayson[_0x1bd5('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=_0x19077c?_0x19077c:amiClient;return _0x4a7f90[_0x1bd5('0x7')](_0x29abea,_0x30a385)['then'](function(_0x2bd975){if(_0x2bd975[_0x1bd5('0x8')]){if(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0x9')]===0x1f4){return _0xd8418f(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0xa')]);}return _0x27d58f(_0x2bd975['error'][_0x1bd5('0xa')]);}else{_0x27d58f(_0x2bd975['result']);}})[_0x1bd5('0xb')](function(_0x24e38c){_0xd8418f(_0x24e38c);});});}function respondWithResult(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xc8;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0xc')](_0x14606b)[_0x1bd5('0xd')](_0x177be0);}return _0x37e8e1['sendStatus'](0x194);};}function handleError(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0x1f4;return function(_0x6d2c40){logger[_0x1bd5('0x8')](_0x6d2c40[_0x1bd5('0xe')]);if(_0x6d2c40['name']){delete _0x6d2c40['name'];}_0x5650b5[_0x1bd5('0xc')](_0x8b2390)[_0x1bd5('0xf')](_0x6d2c40);};}function findById(_0x2b2c57){return function(_0x4793dd){if(!_[_0x1bd5('0x10')](_0x2b2c57)&&!_[_0x1bd5('0x10')](_0x4793dd)&&!_[_0x1bd5('0x10')](_0x4793dd[_0x1bd5('0x11')])){return _[_0x1bd5('0x12')](_0x4793dd['rows'],function(_0x53ad5e){return _0x53ad5e['id']==_0x2b2c57;});}return null;};}exports[_0x1bd5('0x13')]=function(_0x260827,_0x476bd1){return respondWithRpcPromise(_0x1bd5('0x14'),_0x260827[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x476bd1,null))[_0x1bd5('0xb')](handleError(_0x476bd1,null));};exports[_0x1bd5('0x17')]=function(_0x456051,_0xb1ac1e){return respondWithRpcPromise(_0x1bd5('0x18'),_[_0x1bd5('0x19')](_0x456051[_0x1bd5('0x15')],_0x456051[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0xb1ac1e,null))[_0x1bd5('0xb')](handleError(_0xb1ac1e,null));};exports[_0x1bd5('0x1b')]=function(_0x29c340,_0x5567c9){return respondWithRpcPromise(_0x1bd5('0x1c'),_['merge'](_0x29c340[_0x1bd5('0x15')],_0x29c340[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x5567c9,null))['catch'](handleError(_0x5567c9,null));};exports[_0x1bd5('0x1d')]=function(_0x4fa37c,_0x2ed551){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x4fa37c[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x2ed551,null))['catch'](handleError(_0x2ed551,null));};exports[_0x1bd5('0x1f')]=function(_0x69bb17,_0x20245c){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x69bb17['query'])[_0x1bd5('0x16')](findById(_0x69bb17[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x20245c,null))[_0x1bd5('0xb')](handleError(_0x20245c,null));};exports[_0x1bd5('0x20')]=function(_0xc73670,_0x4e72b2){return respondWithRpcPromise(_0x1bd5('0x21'),_[_0x1bd5('0x19')](_0xc73670[_0x1bd5('0x22')],_0xc73670['params']))[_0x1bd5('0x16')](respondWithResult(_0x4e72b2,null))[_0x1bd5('0xb')](handleError(_0x4e72b2,null));};exports[_0x1bd5('0x23')]=function(_0x3430bf,_0x1f4456){return respondWithRpcPromise(_0x1bd5('0x24'),_['merge'](_0x3430bf['query'],_0x3430bf[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x1f4456,null))['catch'](handleError(_0x1f4456,null));};exports[_0x1bd5('0x25')]=function(_0x198b88,_0x1efa8c){return respondWithRpcPromise(_0x1bd5('0x26'),_0x198b88['query'])[_0x1bd5('0x16')](respondWithResult(_0x1efa8c,null))[_0x1bd5('0xb')](handleError(_0x1efa8c,null));};exports[_0x1bd5('0x27')]=function(_0x233743,_0x209ce1){return respondWithRpcPromise(_0x1bd5('0x28'),_[_0x1bd5('0x19')](_0x233743[_0x1bd5('0x15')],_0x233743['params']))[_0x1bd5('0x16')](respondWithResult(_0x209ce1,null))[_0x1bd5('0xb')](handleError(_0x209ce1,null));};exports[_0x1bd5('0x29')]=function(_0x24c92e,_0x11a6d2){return respondWithRpcPromise(_0x1bd5('0x2a'),_[_0x1bd5('0x19')](_0x24c92e['query'],_0x24c92e[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x11a6d2,null))[_0x1bd5('0xb')](handleError(_0x11a6d2,null));};exports[_0x1bd5('0x2b')]=function(_0x3cf898,_0x192ca7){return respondWithRpcPromise(_0x1bd5('0x2c'),_['merge'](_0x3cf898['query'],_0x3cf898[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x192ca7,null))[_0x1bd5('0xb')](handleError(_0x192ca7,null));};exports['outbound']=function(_0x4595a0,_0x5af974){return respondWithRpcPromise(_0x1bd5('0x2d'),_0x4595a0[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5af974,null))[_0x1bd5('0xb')](handleError(_0x5af974,null));};exports[_0x1bd5('0x2e')]=function(_0x2470ec,_0x41096d){return respondWithRpcPromise(_0x1bd5('0x2f'),_0x2470ec['query'])[_0x1bd5('0x16')](respondWithResult(_0x41096d,null))[_0x1bd5('0xb')](handleError(_0x41096d,null));};exports['agents']=function(_0x3b5a0d,_0x77ebcf){var _0x20b25c;return respondWithRpcPromise('Agents',_0x3b5a0d[_0x1bd5('0x15')])[_0x1bd5('0x16')](function(_0x2997a2){_0x20b25c=_0x2997a2;return respondWithRpcPromise(_0x1bd5('0x30'),_0x3b5a0d['query'],routingClient);})[_0x1bd5('0x16')](function(_0x22f437){return _[_0x1bd5('0x19')]({},_0x22f437,_0x20b25c);})[_0x1bd5('0x16')](respondWithResult(_0x77ebcf,null))['catch'](handleError(_0x77ebcf,null));};exports['agentCapacity']=function(_0x40eeff,_0x35afc7){if(_0x40eeff[_0x1bd5('0x22')]&&_0x40eeff['body'][_0x1bd5('0x31')]&&_0x40eeff[_0x1bd5('0x32')]&&_0x40eeff['user'][_0x1bd5('0x33')]){for(var _0x5761b8 in _0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')]){if(_0x40eeff['body'][_0x1bd5('0x31')][_0x1bd5('0x34')](_0x5761b8)){db[_0x1bd5('0x35')][_0x1bd5('0x36')]({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'exitAt':null,'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]&&_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x1bd5('0x38')]?{'$notIn':_0x40eeff['body'][_0x1bd5('0x31')][_0x5761b8]}:{'$ne':null}}})[_0x1bd5('0x16')](function(_0x335125){var _0x52ade4=moment()[_0x1bd5('0x39')](_0x1bd5('0x3a'));for(var _0x5bb8a6=0x0,_0x1dbde9=_0x335125['length'];_0x5bb8a6<_0x1dbde9;_0x5bb8a6+=0x1){_0x335125[_0x5bb8a6][_0x1bd5('0x3b')]({'exitAt':_0x52ade4});}});for(var _0x558fec=0x0;_0x558fec<_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]['length'];_0x558fec+=0x1){db[_0x1bd5('0x35')]['findOrCreate']({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x558fec],'exitAt':null},'defaults':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'interface':_[_0x1bd5('0x10')](_0x40eeff['user'][_0x1bd5('0x3c')])?util[_0x1bd5('0x39')](_0x1bd5('0x3d'),_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')]):_0x40eeff[_0x1bd5('0x32')]['interface'],'type':_0x1bd5('0x37'),'enterAt':moment()[_0x1bd5('0x39')](_0x1bd5('0x3a')),'role':_0x1bd5('0x3e'),'internal':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x3f')],'uniqueid':_0x40eeff[_0x1bd5('0x22')]['interaction'][_0x5761b8][_0x558fec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x40eeff[_0x1bd5('0x1a')]['id'],'capacity':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x40')]},routingClient)['then'](respondWithResult(_0x35afc7,null))[_0x1bd5('0xb')](handleError(_0x35afc7,null));};exports[_0x1bd5('0x41')]=function(_0x1ad2ff,_0x1f2d7e){return respondWithRpcPromise(_0x1bd5('0x42'),_0x1ad2ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x1f2d7e,null))['catch'](handleError(_0x1f2d7e,null));};exports[_0x1bd5('0x43')]=function(_0x2bcd23,_0x4f2d91){return respondWithRpcPromise(_0x1bd5('0x44'),_0x2bcd23['query'])[_0x1bd5('0x16')](respondWithResult(_0x4f2d91,null))['catch'](handleError(_0x4f2d91,null));};exports[_0x1bd5('0x45')]=function(_0x555ba1,_0x5a011e){return respondWithRpcPromise(_0x1bd5('0x46'),_0x555ba1[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5a011e,null))[_0x1bd5('0xb')](handleError(_0x5a011e,null));};exports[_0x1bd5('0x47')]=function(_0x33f011,_0x35c478){return respondWithRpcPromise('ChatQueues',_0x33f011[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x35c478,null))[_0x1bd5('0xb')](handleError(_0x35c478,null));};exports[_0x1bd5('0x48')]=function(_0x2cc5ba,_0x5a8132){return respondWithRpcPromise('ChatQueues',_0x2cc5ba[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x2cc5ba[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x5a8132,null))[_0x1bd5('0xb')](handleError(_0x5a8132,null));};exports[_0x1bd5('0x49')]=function(_0x46e36c,_0x383a68){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x46e36c[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x383a68,null))[_0x1bd5('0xb')](handleError(_0x383a68,null));};exports['showMailQueues']=function(_0x2fe8f4,_0x34d93b){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x2fe8f4['query'],routingClient)[_0x1bd5('0x16')](findById(_0x2fe8f4[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0x1bd5('0x4b')]=function(_0x10103a,_0x39f973){return respondWithRpcPromise(_0x1bd5('0x4c'),_0x10103a['query'],mailClient)['then'](respondWithResult(_0x39f973,null))[_0x1bd5('0xb')](handleError(_0x39f973,null));};exports[_0x1bd5('0x4d')]=function(_0x1790af,_0x54a8c4){return respondWithRpcPromise('OpenchannelQueues',_0x1790af[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x54a8c4,null))[_0x1bd5('0xb')](handleError(_0x54a8c4,null));};exports[_0x1bd5('0x4e')]=function(_0x5068ae,_0x32f646){return respondWithRpcPromise('OpenchannelQueues',_0x5068ae[_0x1bd5('0x15')],routingClient)['then'](findById(_0x5068ae[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x32f646,null))['catch'](handleError(_0x32f646,null));};exports[_0x1bd5('0x4f')]=function(_0x19f765,_0x47ca3f){return respondWithRpcPromise('SmsQueues',_0x19f765[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x47ca3f,null))['catch'](handleError(_0x47ca3f,null));};exports[_0x1bd5('0x50')]=function(_0x40b508,_0x5da595){return respondWithRpcPromise('SmsQueues',_0x40b508[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x40b508[_0x1bd5('0x1a')]['id']))['then'](respondWithResult(_0x5da595,null))[_0x1bd5('0xb')](handleError(_0x5da595,null));};exports[_0x1bd5('0x51')]=function(_0x5c1db7,_0x4b317d){return respondWithRpcPromise(_0x1bd5('0x52'),_0x5c1db7[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x4b317d,null))[_0x1bd5('0xb')](handleError(_0x4b317d,null));};exports[_0x1bd5('0x53')]=function(_0x53c6de,_0x3827d7){return respondWithRpcPromise('WhatsappQueues',_0x53c6de[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x53c6de[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x3827d7,null))['catch'](handleError(_0x3827d7,null));};exports['faxQueues']=function(_0x3a7dd6,_0x36d62e){return respondWithRpcPromise(_0x1bd5('0x54'),_0x3a7dd6[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x36d62e,null))[_0x1bd5('0xb')](handleError(_0x36d62e,null));};exports[_0x1bd5('0x55')]=function(_0xc080d5,_0x1a35cf){return respondWithRpcPromise(_0x1bd5('0x54'),_0xc080d5[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0xc080d5[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x1a35cf,null))[_0x1bd5('0xb')](handleError(_0x1a35cf,null));};exports[_0x1bd5('0x56')]=function(_0x1b99ff,_0x195176){return respondWithRpcPromise(_0x1bd5('0x57'),_0x1b99ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x195176,null))[_0x1bd5('0xb')](handleError(_0x195176,null));};exports[_0x1bd5('0x58')]=function(_0x3ddf27,_0x56e99c){return respondWithRpcPromise(_0x1bd5('0x59'),_0x3ddf27[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x56e99c,null))[_0x1bd5('0xb')](handleError(_0x56e99c,null));};exports[_0x1bd5('0x5a')]=function(_0x37a6f3,_0x1e282c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x37a6f3[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x1e282c,null))[_0x1bd5('0xb')](handleError(_0x1e282c,null));};exports[_0x1bd5('0x5b')]=function(_0x590b3d,_0x2ed59d){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x590b3d[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x2ed59d,null))[_0x1bd5('0xb')](handleError(_0x2ed59d,null));};exports[_0x1bd5('0x5d')]=function(_0x32a878,_0x4cc7a5){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x32a878['query'],routingClient)['then'](function(_0x34f98c){if(_0x32a878['query'][_0x1bd5('0x5e')]!==undefined){var _0x1a4ee6=_(_0x34f98c['rows'])[_0x1bd5('0x5f')]([_0x32a878[_0x1bd5('0x15')][_0x1bd5('0x5e')],_0x32a878[_0x1bd5('0x1a')]['id']])[_0x1bd5('0x60')](_0x1bd5('0x61'))['uniq']()[_0x1bd5('0x62')]();return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x1c9cec){return _0x1a4ee6['indexOf'](_0x1c9cec['queue_id'])>-0x1;});}else{return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x2fe037){return _0x2fe037[_0x1bd5('0x61')]===parseInt(_0x32a878['params']['id']);});}})[_0x1bd5('0x16')](respondWithResult(_0x4cc7a5,null))['catch'](handleError(_0x4cc7a5,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a203f,_0x5045f9){return respondWithRpcPromise(_0x1bd5('0x63'),_0x3a203f[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x5045f9,null))[_0x1bd5('0xb')](handleError(_0x5045f9,null));};exports[_0x1bd5('0x64')]=function(_0xab4ed6,_0x232077){return respondWithRpcPromise(_0x1bd5('0x65'),_0xab4ed6[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x232077,null))[_0x1bd5('0xb')](handleError(_0x232077,null));};exports['faxQueuesWaitingInteractions']=function(_0x58c715,_0x59b491){return respondWithRpcPromise(_0x1bd5('0x66'),_0x58c715['query'],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x59b491,null))[_0x1bd5('0xb')](handleError(_0x59b491,null));};exports[_0x1bd5('0x67')]=function(_0x4a3f74){return function(_0x201968,_0x91bcf8){var _0x3410f8,_0x52cd5f;var _0xfc9282=_['capitalize'](_0x4a3f74);var _0x327eb6=_0x4a3f74===_0x1bd5('0x68')?_0x1bd5('0x69'):'Account';return db[_0xfc9282+'Queue'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x201968['params']['id']}})[_0x1bd5('0x16')](function(_0x53be05){if(_[_0x1bd5('0x10')](_0x53be05)){throw new Error(_0xfc9282+_0x1bd5('0x6b'));}_0x3410f8=_0x53be05;return db[_0xfc9282+_0x1bd5('0x6c')][_0x1bd5('0x6a')]({'where':{'id':_0x201968[_0x1bd5('0x22')][_0x1bd5('0x6d')]},'include':[{'model':db[_0xfc9282+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0xfc9282+_0x327eb6],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x3c90dc){if(_[_0x1bd5('0x10')](_0x3c90dc)){throw new Error(_0xfc9282+_0x1bd5('0x70'));}_0x52cd5f=_0x3c90dc;return _0x3c90dc[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a1b4a={'uniqueid':_0x4a3f74+'.'+_0x52cd5f['id']+'.'+_0x52cd5f[_0x1bd5('0x6e')]['id'],'FromUserId':_0x201968[_0x1bd5('0x32')]['id'],'type':'queue'};_0x2a1b4a[_0xfc9282+_0x1bd5('0x72')]=_0x52cd5f['id'];_0x2a1b4a[_0xfc9282+_0x1bd5('0x73')]=_0x52cd5f['Interaction']['id'];_0x2a1b4a[_0x1bd5('0x74')+_0xfc9282+_0x327eb6+'Id']=_0x52cd5f[_0x1bd5('0x6f')]['id'];_0x2a1b4a['To'+_0xfc9282+_0x1bd5('0x75')]=_0x3410f8['id'];return db[_0xfc9282+'TransferReport'][_0x1bd5('0x76')](_0x2a1b4a);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x4a3f74,'interaction':_0x52cd5f[_0x1bd5('0x6e')],'message':_0x52cd5f,'account':_0x52cd5f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x78'),'appdata':_0x3410f8[_0x1bd5('0x33')]+','+(_0x52cd5f[_0x1bd5('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x91bcf8,null))['catch'](handleError(_0x91bcf8,null));};};exports['agentNotify']=function(_0x4230e9,_0x182d75){var _0x5c9098,_0x5d6b17;if(_[_0x1bd5('0x10')](_0x4230e9['body']['channel'])){throw new Error(_0x1bd5('0x7a'));}var _0x5cb13d=_0x4230e9[_0x1bd5('0x22')][_0x1bd5('0x7b')];var _0x5df043=_[_0x1bd5('0x7c')](_0x5cb13d);var _0x254c8d=_0x5cb13d===_0x1bd5('0x68')?'Website':_0x1bd5('0x6f');return db['User'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x4230e9[_0x1bd5('0x1a')]['id'],'role':_0x1bd5('0x3e')}})[_0x1bd5('0x16')](function(_0x2f9dff){if(_['isNil'](_0x2f9dff)){throw new Error(_0x1bd5('0x7d'));}_0x5c9098=_0x2f9dff;return db[_0x5df043+'Message'][_0x1bd5('0x6a')]({'where':{'id':_0x4230e9['body']['messageId']},'include':[{'model':db[_0x5df043+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0x5df043+_0x254c8d],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x4c9931){if(_[_0x1bd5('0x10')](_0x4c9931)){throw new Error(_0x5df043+_0x1bd5('0x70'));}_0x5d6b17=_0x4c9931;return _0x4c9931[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1bd5('0x16')](function(){var _0x15e584={'uniqueid':_0x5cb13d+'.'+_0x5d6b17['id']+'.'+_0x5d6b17[_0x1bd5('0x6e')]['id'],'FromUserId':_0x4230e9[_0x1bd5('0x32')]['id'],'type':_0x1bd5('0x78'),'ToUserId':_0x5c9098['id']};_0x15e584[_0x5df043+_0x1bd5('0x72')]=_0x5d6b17['id'];_0x15e584[_0x5df043+_0x1bd5('0x73')]=_0x5d6b17[_0x1bd5('0x6e')]['id'];_0x15e584[_0x1bd5('0x74')+_0x5df043+_0x254c8d+'Id']=_0x5d6b17[_0x1bd5('0x6f')]['id'];return db[_0x5df043+_0x1bd5('0x7e')]['create'](_0x15e584);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x5cb13d,'interaction':_0x5d6b17[_0x1bd5('0x6e')],'message':_0x5d6b17,'account':_0x5d6b17[_0x1bd5('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x3e'),'appdata':_0x5c9098[_0x1bd5('0x33')]+','+(_0x5d6b17[_0x1bd5('0x6f')][_0x1bd5('0x7f')]||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x182d75,null))[_0x1bd5('0xb')](handleError(_0x182d75,null));}; \ No newline at end of file +var _0x9c5a=['Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','Start','bluebird','moment','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','merge','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','updateAttributes','findOrCreate','SIP/%s','format','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x162e94,_0x27073a){_0x162e94=_0x162e94-0x0;var _0x30d1bb=_0x9c5a[_0x162e94];return _0x30d1bb;};'use strict';var BPromise=require(_0xa9c5('0x0'));var moment=require(_0xa9c5('0x1'));var _=require('lodash');var util=require(_0xa9c5('0x2'));var db=require(_0xa9c5('0x3'))['db'];var logger=require(_0xa9c5('0x4'))(_0xa9c5('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9c5('0x6')][_0xa9c5('0x7')]({'port':0x232a});var mailClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0xa9c5('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){var _0x52afb2=_0x4b6db6?_0x4b6db6:amiClient;return _0x52afb2[_0xa9c5('0x8')](_0x3df556,_0x4cb597)[_0xa9c5('0x9')](function(_0x51c14c){if(_0x51c14c[_0xa9c5('0xa')]){if(_0x51c14c[_0xa9c5('0xa')]['code']===0x1f4){return _0x16f331(_0x51c14c['error'][_0xa9c5('0xb')]);}return _0x3d6b50(_0x51c14c[_0xa9c5('0xa')][_0xa9c5('0xb')]);}else{_0x3d6b50(_0x51c14c[_0xa9c5('0xc')]);}})[_0xa9c5('0xd')](function(_0x4492a4){_0x16f331(_0x4492a4);});});}function respondWithResult(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xc8;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0xe')](_0x42d5cf)['json'](_0x3c5ac7);}return _0x51c8d[_0xa9c5('0xf')](0x194);};}function handleError(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0x1f4;return function(_0x3806c4){logger[_0xa9c5('0xa')](_0x3806c4[_0xa9c5('0x10')]);if(_0x3806c4[_0xa9c5('0x11')]){delete _0x3806c4[_0xa9c5('0x11')];}_0x1276d2[_0xa9c5('0xe')](_0x7df76d)[_0xa9c5('0x12')](_0x3806c4);};}function findById(_0x4bb57e){return function(_0x2b0d73){if(!_[_0xa9c5('0x13')](_0x4bb57e)&&!_[_0xa9c5('0x13')](_0x2b0d73)&&!_['isNil'](_0x2b0d73[_0xa9c5('0x14')])){return _[_0xa9c5('0x15')](_0x2b0d73[_0xa9c5('0x14')],function(_0x3b8cf7){return _0x3b8cf7['id']==_0x4bb57e;});}return null;};}exports[_0xa9c5('0x16')]=function(_0x349f27,_0x3b8d4d){return respondWithRpcPromise(_0xa9c5('0x17'),_0x349f27[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x3b8d4d,null))[_0xa9c5('0xd')](handleError(_0x3b8d4d,null));};exports[_0xa9c5('0x19')]=function(_0x54f8b9,_0x1115ad){return respondWithRpcPromise(_0xa9c5('0x1a'),_['merge'](_0x54f8b9['query'],_0x54f8b9[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x1115ad,null))[_0xa9c5('0xd')](handleError(_0x1115ad,null));};exports[_0xa9c5('0x1c')]=function(_0xc0bca3,_0xd4b8a1){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0xc0bca3[_0xa9c5('0x18')],_0xc0bca3[_0xa9c5('0x1b')]))['then'](respondWithResult(_0xd4b8a1,null))[_0xa9c5('0xd')](handleError(_0xd4b8a1,null));};exports[_0xa9c5('0x1d')]=function(_0x306c9b,_0x32fc7d){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x306c9b[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x32fc7d,null))['catch'](handleError(_0x32fc7d,null));};exports['showVoiceQueues']=function(_0x242771,_0x4cd5e6){return respondWithRpcPromise(_0xa9c5('0x1e'),_0x242771[_0xa9c5('0x18')])['then'](findById(_0x242771[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4cd5e6,null))['catch'](handleError(_0x4cd5e6,null));};exports[_0xa9c5('0x1f')]=function(_0x32baf9,_0x198cdf){return respondWithRpcPromise(_0xa9c5('0x20'),_[_0xa9c5('0x21')](_0x32baf9['body'],_0x32baf9[_0xa9c5('0x1b')]))['then'](respondWithResult(_0x198cdf,null))[_0xa9c5('0xd')](handleError(_0x198cdf,null));};exports[_0xa9c5('0x22')]=function(_0x2eeed1,_0x541475){return respondWithRpcPromise(_0xa9c5('0x23'),_[_0xa9c5('0x21')](_0x2eeed1['query'],_0x2eeed1[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x541475,null))[_0xa9c5('0xd')](handleError(_0x541475,null));};exports[_0xa9c5('0x24')]=function(_0x22ee21,_0x3392d0){return respondWithRpcPromise(_0xa9c5('0x25'),_0x22ee21['query'])[_0xa9c5('0x9')](respondWithResult(_0x3392d0,null))[_0xa9c5('0xd')](handleError(_0x3392d0,null));};exports[_0xa9c5('0x26')]=function(_0x1c01f9,_0x1c617c){return respondWithRpcPromise(_0xa9c5('0x27'),_[_0xa9c5('0x21')](_0x1c01f9[_0xa9c5('0x18')],_0x1c01f9['params']))['then'](respondWithResult(_0x1c617c,null))[_0xa9c5('0xd')](handleError(_0x1c617c,null));};exports[_0xa9c5('0x28')]=function(_0xf2bebc,_0x1313b2){return respondWithRpcPromise(_0xa9c5('0x29'),_[_0xa9c5('0x21')](_0xf2bebc['query'],_0xf2bebc['params']))['then'](respondWithResult(_0x1313b2,null))[_0xa9c5('0xd')](handleError(_0x1313b2,null));};exports[_0xa9c5('0x2a')]=function(_0x5087e4,_0x13a1f5){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa9c5('0x21')](_0x5087e4[_0xa9c5('0x18')],_0x5087e4[_0xa9c5('0x1b')]))[_0xa9c5('0x9')](respondWithResult(_0x13a1f5,null))['catch'](handleError(_0x13a1f5,null));};exports[_0xa9c5('0x2b')]=function(_0x2cd721,_0x191153){return respondWithRpcPromise(_0xa9c5('0x2c'),_0x2cd721[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x191153,null))[_0xa9c5('0xd')](handleError(_0x191153,null));};exports[_0xa9c5('0x2d')]=function(_0x573fc0,_0x11b2b2){return respondWithRpcPromise(_0xa9c5('0x2e'),_0x573fc0[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x11b2b2,null))[_0xa9c5('0xd')](handleError(_0x11b2b2,null));};exports[_0xa9c5('0x2f')]=function(_0x493b20,_0x307736){var _0x5b7a0a;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'])[_0xa9c5('0x9')](function(_0xd4305d){_0x5b7a0a=_0xd4305d;return respondWithRpcPromise(_0xa9c5('0x30'),_0x493b20['query'],routingClient);})[_0xa9c5('0x9')](function(_0x1ddd72){return _[_0xa9c5('0x21')]({},_0x1ddd72,_0x5b7a0a);})[_0xa9c5('0x9')](respondWithResult(_0x307736,null))['catch'](handleError(_0x307736,null));};exports[_0xa9c5('0x31')]=function(_0x97803f,_0x3db918){if(_0x97803f[_0xa9c5('0x32')]&&_0x97803f[_0xa9c5('0x32')]['interaction']&&_0x97803f[_0xa9c5('0x33')]&&_0x97803f['user'][_0xa9c5('0x11')]){for(var _0x397614 in _0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')]){if(_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0xa9c5('0x35')](_0x397614)){db[_0xa9c5('0x36')][_0xa9c5('0x37')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'type':_0xa9c5('0x38'),'exitAt':null,'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614]&&_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')]?{'$notIn':_0x97803f['body'][_0xa9c5('0x34')][_0x397614]}:{'$ne':null}}})[_0xa9c5('0x9')](function(_0x557c21){var _0x52cfbf=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4e97bf=0x0,_0x160020=_0x557c21[_0xa9c5('0x39')];_0x4e97bf<_0x160020;_0x4e97bf+=0x1){_0x557c21[_0x4e97bf][_0xa9c5('0x3a')]({'exitAt':_0x52cfbf});}});for(var _0x1e8f5f=0x0;_0x1e8f5f<_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0xa9c5('0x39')];_0x1e8f5f+=0x1){db[_0xa9c5('0x36')][_0xa9c5('0x3b')]({'where':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')],'type':_0xa9c5('0x38'),'uniqueid':_0x97803f[_0xa9c5('0x32')]['interaction'][_0x397614][_0x1e8f5f],'exitAt':null},'defaults':{'channel':_0x397614,'membername':_0x97803f[_0xa9c5('0x33')]['name'],'interface':_[_0xa9c5('0x13')](_0x97803f[_0xa9c5('0x33')]['interface'])?util['format'](_0xa9c5('0x3c'),_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x11')]):_0x97803f['user']['interface'],'type':_0xa9c5('0x38'),'enterAt':moment()[_0xa9c5('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa9c5('0x3e'),'internal':_0x97803f[_0xa9c5('0x33')][_0xa9c5('0x3f')],'uniqueid':_0x97803f[_0xa9c5('0x32')][_0xa9c5('0x34')][_0x397614][_0x1e8f5f]}});}}}}return respondWithRpcPromise(_0xa9c5('0x40'),{'id':_0x97803f['params']['id'],'capacity':_0x97803f['body']['capacity']},routingClient)[_0xa9c5('0x9')](respondWithResult(_0x3db918,null))[_0xa9c5('0xd')](handleError(_0x3db918,null));};exports[_0xa9c5('0x41')]=function(_0xef4d2,_0x380266){return respondWithRpcPromise(_0xa9c5('0x42'),_0xef4d2['query'])[_0xa9c5('0x9')](respondWithResult(_0x380266,null))[_0xa9c5('0xd')](handleError(_0x380266,null));};exports[_0xa9c5('0x43')]=function(_0x2bdc77,_0xa0b458){return respondWithRpcPromise(_0xa9c5('0x44'),_0x2bdc77['query'])['then'](respondWithResult(_0xa0b458,null))[_0xa9c5('0xd')](handleError(_0xa0b458,null));};exports['campaigns']=function(_0x1b158f,_0x5ea9b0){return respondWithRpcPromise(_0xa9c5('0x45'),_0x1b158f[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x46')]=function(_0xe5390f,_0x1a75f3){return respondWithRpcPromise(_0xa9c5('0x47'),_0xe5390f['query'],routingClient)['then'](respondWithResult(_0x1a75f3,null))[_0xa9c5('0xd')](handleError(_0x1a75f3,null));};exports[_0xa9c5('0x48')]=function(_0x3205f2,_0x5b4323){return respondWithRpcPromise(_0xa9c5('0x47'),_0x3205f2[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x3205f2[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x5b4323,null))[_0xa9c5('0xd')](handleError(_0x5b4323,null));};exports[_0xa9c5('0x49')]=function(_0x298b3d,_0x5a7f0a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x298b3d['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5a7f0a,null))[_0xa9c5('0xd')](handleError(_0x5a7f0a,null));};exports[_0xa9c5('0x4b')]=function(_0x4dfe3a,_0x4d475a){return respondWithRpcPromise(_0xa9c5('0x4a'),_0x4dfe3a['query'],routingClient)[_0xa9c5('0x9')](findById(_0x4dfe3a[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4d475a,null))[_0xa9c5('0xd')](handleError(_0x4d475a,null));};exports['mailAccounts']=function(_0x3505d3,_0x222091){return respondWithRpcPromise(_0xa9c5('0x4c'),_0x3505d3[_0xa9c5('0x18')],mailClient)['then'](respondWithResult(_0x222091,null))['catch'](handleError(_0x222091,null));};exports[_0xa9c5('0x4d')]=function(_0x3deb64,_0x67c1f8){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x3deb64[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x67c1f8,null))['catch'](handleError(_0x67c1f8,null));};exports[_0xa9c5('0x4f')]=function(_0x1e787e,_0x2497e1){return respondWithRpcPromise(_0xa9c5('0x4e'),_0x1e787e[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1e787e[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x2497e1,null))[_0xa9c5('0xd')](handleError(_0x2497e1,null));};exports[_0xa9c5('0x50')]=function(_0x50d438,_0x5e17a2){return respondWithRpcPromise(_0xa9c5('0x51'),_0x50d438[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5e17a2,null))[_0xa9c5('0xd')](handleError(_0x5e17a2,null));};exports['showSmsQueues']=function(_0x1c2478,_0x4aa699){return respondWithRpcPromise(_0xa9c5('0x51'),_0x1c2478[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1c2478[_0xa9c5('0x1b')]['id']))[_0xa9c5('0x9')](respondWithResult(_0x4aa699,null))[_0xa9c5('0xd')](handleError(_0x4aa699,null));};exports[_0xa9c5('0x52')]=function(_0x3890b4,_0x2f323e){return respondWithRpcPromise(_0xa9c5('0x53'),_0x3890b4[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2f323e,null))['catch'](handleError(_0x2f323e,null));};exports[_0xa9c5('0x54')]=function(_0x1a4aa7,_0x15eb25){return respondWithRpcPromise(_0xa9c5('0x53'),_0x1a4aa7[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](findById(_0x1a4aa7[_0xa9c5('0x1b')]['id']))['then'](respondWithResult(_0x15eb25,null))['catch'](handleError(_0x15eb25,null));};exports[_0xa9c5('0x55')]=function(_0x502a00,_0x2ae087){return respondWithRpcPromise(_0xa9c5('0x56'),_0x502a00['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2ae087,null))[_0xa9c5('0xd')](handleError(_0x2ae087,null));};exports['showFaxQueues']=function(_0x4f8d9e,_0x14c4f2){return respondWithRpcPromise(_0xa9c5('0x56'),_0x4f8d9e[_0xa9c5('0x18')],routingClient)['then'](findById(_0x4f8d9e['params']['id']))[_0xa9c5('0x9')](respondWithResult(_0x14c4f2,null))[_0xa9c5('0xd')](handleError(_0x14c4f2,null));};exports['faxAccounts']=function(_0xd0371c,_0x393b00){return respondWithRpcPromise(_0xa9c5('0x57'),_0xd0371c[_0xa9c5('0x18')])[_0xa9c5('0x9')](respondWithResult(_0x393b00,null))[_0xa9c5('0xd')](handleError(_0x393b00,null));};exports['chatQueuesWaitingInteractions']=function(_0x44d969,_0x3aeb3c){return respondWithRpcPromise(_0xa9c5('0x58'),_0x44d969[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x3aeb3c,null))[_0xa9c5('0xd')](handleError(_0x3aeb3c,null));};exports[_0xa9c5('0x59')]=function(_0x59e917,_0x112d64){return respondWithRpcPromise(_0xa9c5('0x5a'),_0x59e917[_0xa9c5('0x18')],routingClient)['then'](respondWithResult(_0x112d64,null))[_0xa9c5('0xd')](handleError(_0x112d64,null));};exports[_0xa9c5('0x5b')]=function(_0x18dbfa,_0x2e00f5){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x18dbfa[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x2e00f5,null))['catch'](handleError(_0x2e00f5,null));};exports[_0xa9c5('0x5d')]=function(_0x40468b,_0x7f9e83){return respondWithRpcPromise(_0xa9c5('0x5c'),_0x40468b[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](function(_0x39fae1){if(_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')]!==undefined){var _0x7d0e85=_(_0x39fae1[_0xa9c5('0x14')])['filter']([_0x40468b[_0xa9c5('0x18')][_0xa9c5('0x5e')],_0x40468b['params']['id']])[_0xa9c5('0x5f')](_0xa9c5('0x60'))[_0xa9c5('0x61')]()['value']();return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x22dfd7){return _0x7d0e85[_0xa9c5('0x63')](_0x22dfd7['queue_id'])>-0x1;});}else{return _0x39fae1[_0xa9c5('0x14')][_0xa9c5('0x62')](function(_0x4f4fa1){return _0x4f4fa1['queue_id']===parseInt(_0x40468b['params']['id']);});}})['then'](respondWithResult(_0x7f9e83,null))['catch'](handleError(_0x7f9e83,null));};exports['smsQueuesWaitingInteractions']=function(_0x5277ee,_0x54c8f5){return respondWithRpcPromise(_0xa9c5('0x64'),_0x5277ee[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x54c8f5,null))[_0xa9c5('0xd')](handleError(_0x54c8f5,null));};exports[_0xa9c5('0x65')]=function(_0x592594,_0x4d7772){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x592594['query'],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x4d7772,null))[_0xa9c5('0xd')](handleError(_0x4d7772,null));};exports[_0xa9c5('0x66')]=function(_0x2eda17,_0x5253e8){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2eda17[_0xa9c5('0x18')],routingClient)[_0xa9c5('0x9')](respondWithResult(_0x5253e8,null))[_0xa9c5('0xd')](handleError(_0x5253e8,null));};exports[_0xa9c5('0x67')]=function(_0x1d89ec){return function(_0x5673f1,_0x2b69b9){var _0x43ae9,_0xd063cf;var _0x58de52=_[_0xa9c5('0x68')](_0x1d89ec);var _0x2741df=_0x1d89ec===_0xa9c5('0x69')?_0xa9c5('0x6a'):'Account';return db[_0x58de52+_0xa9c5('0x6b')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5673f1['params']['id']}})['then'](function(_0x2f1e9f){if(_['isNil'](_0x2f1e9f)){throw new Error(_0x58de52+'\x20Queue\x20not\x20found');}_0x43ae9=_0x2f1e9f;return db[_0x58de52+_0xa9c5('0x6d')][_0xa9c5('0x6c')]({'where':{'id':_0x5673f1[_0xa9c5('0x32')][_0xa9c5('0x6e')]},'include':[{'model':db[_0x58de52+_0xa9c5('0x6f')],'as':'Interaction'},{'model':db[_0x58de52+_0x2741df],'as':_0xa9c5('0x70')}]});})['then'](function(_0x129157){if(_[_0xa9c5('0x13')](_0x129157)){throw new Error(_0x58de52+_0xa9c5('0x71'));}_0xd063cf=_0x129157;return _0x129157[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4b056e={'uniqueid':_0x1d89ec+'.'+_0xd063cf['id']+'.'+_0xd063cf[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5673f1['user']['id'],'type':'queue'};_0x4b056e[_0x58de52+_0xa9c5('0x73')]=_0xd063cf['id'];_0x4b056e[_0x58de52+_0xa9c5('0x74')]=_0xd063cf['Interaction']['id'];_0x4b056e['From'+_0x58de52+_0x2741df+'Id']=_0xd063cf[_0xa9c5('0x70')]['id'];_0x4b056e['To'+_0x58de52+_0xa9c5('0x75')]=_0x43ae9['id'];return db[_0x58de52+_0xa9c5('0x76')][_0xa9c5('0x77')](_0x4b056e);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x1d89ec,'interaction':_0xd063cf[_0xa9c5('0x6f')],'message':_0xd063cf,'account':_0xd063cf[_0xa9c5('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x78'),'appdata':_0x43ae9[_0xa9c5('0x11')]+','+(_0xd063cf[_0xa9c5('0x70')][_0xa9c5('0x79')]||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})['then'](respondWithResult(_0x2b69b9,null))[_0xa9c5('0xd')](handleError(_0x2b69b9,null));};};exports[_0xa9c5('0x7b')]=function(_0x5065e2,_0x328869){var _0x2488aa,_0x5544d8;if(_[_0xa9c5('0x13')](_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')])){throw new Error(_0xa9c5('0x7d'));}var _0x21e3ba=_0x5065e2[_0xa9c5('0x32')][_0xa9c5('0x7c')];var _0x13e233=_[_0xa9c5('0x68')](_0x21e3ba);var _0x24a6d3=_0x21e3ba===_0xa9c5('0x69')?_0xa9c5('0x6a'):_0xa9c5('0x70');return db[_0xa9c5('0x7e')][_0xa9c5('0x6c')]({'raw':!![],'where':{'id':_0x5065e2[_0xa9c5('0x1b')]['id'],'role':_0xa9c5('0x3e')}})['then'](function(_0x425b92){if(_[_0xa9c5('0x13')](_0x425b92)){throw new Error(_0xa9c5('0x7f'));}_0x2488aa=_0x425b92;return db[_0x13e233+'Message'][_0xa9c5('0x6c')]({'where':{'id':_0x5065e2[_0xa9c5('0x32')]['messageId']},'include':[{'model':db[_0x13e233+_0xa9c5('0x6f')],'as':_0xa9c5('0x6f')},{'model':db[_0x13e233+_0x24a6d3],'as':_0xa9c5('0x70')}]});})[_0xa9c5('0x9')](function(_0x343b35){if(_[_0xa9c5('0x13')](_0x343b35)){throw new Error(_0x13e233+_0xa9c5('0x71'));}_0x5544d8=_0x343b35;return _0x343b35[_0xa9c5('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa9c5('0x9')](function(){var _0xb09d88={'uniqueid':_0x21e3ba+'.'+_0x5544d8['id']+'.'+_0x5544d8[_0xa9c5('0x6f')]['id'],'FromUserId':_0x5065e2[_0xa9c5('0x33')]['id'],'type':_0xa9c5('0x78'),'ToUserId':_0x2488aa['id']};_0xb09d88[_0x13e233+'MessageId']=_0x5544d8['id'];_0xb09d88[_0x13e233+'InteractionId']=_0x5544d8[_0xa9c5('0x6f')]['id'];_0xb09d88[_0xa9c5('0x80')+_0x13e233+_0x24a6d3+'Id']=_0x5544d8['Account']['id'];return db[_0x13e233+_0xa9c5('0x76')][_0xa9c5('0x77')](_0xb09d88);})[_0xa9c5('0x9')](function(){return respondWithRpcPromise(_0xa9c5('0x81'),{'channel':_0x21e3ba,'interaction':_0x5544d8['Interaction'],'message':_0x5544d8,'account':_0x5544d8['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa9c5('0x3e'),'appdata':_0x2488aa[_0xa9c5('0x11')]+','+(_0x5544d8[_0xa9c5('0x70')]['agentTransferTimeout']||0x12c),'interval':_0xa9c5('0x7a')}]},routingClient);})[_0xa9c5('0x9')](respondWithResult(_0x328869,null))[_0xa9c5('0xd')](handleError(_0x328869,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index dcf489b..184dc4b 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 _0x24bd=['../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','create','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x25467b,_0x45c7c2){var _0x27310b=function(_0x245b88){while(--_0x245b88){_0x25467b['push'](_0x25467b['shift']());}};_0x27310b(++_0x45c7c2);}(_0x24bd,0x10a));var _0xd24b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x24bd[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xd24b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd24b('0x1'));var express=require(_0xd24b('0x2'));var router=express[_0xd24b('0x3')]();var fs_extra=require(_0xd24b('0x4'));var auth=require(_0xd24b('0x5'));var interaction=require(_0xd24b('0x6'));var config=require(_0xd24b('0x7'));var controller=require(_0xd24b('0x8'));router[_0xd24b('0x9')]('/',auth[_0xd24b('0xa')](),controller[_0xd24b('0xb')]);router['get'](_0xd24b('0xc'),auth[_0xd24b('0xa')](),controller['show']);router[_0xd24b('0x9')](_0xd24b('0xd'),auth[_0xd24b('0xa')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller[_0xd24b('0xe')]);router['put']('/:id',auth[_0xd24b('0xa')](),controller[_0xd24b('0xf')]);router['delete'](_0xd24b('0xc'),auth[_0xd24b('0xa')](),controller['destroy']);module[_0xd24b('0x10')]=router; \ No newline at end of file +var _0x9560=['show','isAuthenticated','run','post','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9560,0x1aa));var _0x0956=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x9560[_0x7880d2];return _0x35ebbe;};'use strict';var multer=require('multer');var util=require(_0x0956('0x0'));var path=require(_0x0956('0x1'));var timeout=require(_0x0956('0x2'));var express=require(_0x0956('0x3'));var router=express[_0x0956('0x4')]();var fs_extra=require(_0x0956('0x5'));var auth=require(_0x0956('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0956('0x7'));var controller=require(_0x0956('0x8'));router[_0x0956('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0956('0x9')](_0x0956('0xa'),auth['isAuthenticated'](),controller[_0x0956('0xb')]);router[_0x0956('0x9')]('/:id/run',auth[_0x0956('0xc')](),controller[_0x0956('0xd')]);router[_0x0956('0xe')]('/',auth[_0x0956('0xc')](),controller['create']);router[_0x0956('0xf')](_0x0956('0xa'),auth[_0x0956('0xc')](),controller[_0x0956('0x10')]);router[_0x0956('0x11')]('/:id',auth[_0x0956('0xc')](),controller['destroy']);module[_0x0956('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 012e1fa..83e746c 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 _0x10e7=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','days','hours','minutes','pdf','csv','custom','default','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10e7,0x88));var _0x710e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x10e7[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x710e('0x0')]},'active':{'type':Sequelize[_0x710e('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x710e('0x0')],'allowNull':![],'defaultValue':_0x710e('0x2')},'startAt':{'type':Sequelize[_0x710e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x710e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x710e('0x5')](_0x710e('0x6'),_0x710e('0x7'),'months',_0x710e('0x8'),_0x710e('0x9'),_0x710e('0xa'),_0x710e('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x710e('0x5')]('csv',_0x710e('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x710e('0xd')},'type':{'type':Sequelize[_0x710e('0x5')](_0x710e('0xe'),_0x710e('0xf')),'allowNull':![],'defaultValue':_0x710e('0xe')},'sendMail':{'type':Sequelize[_0x710e('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x710e('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x710e('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x710e('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02ab=['quarters','months','weeks','days','minutes','ENUM','csv','pdf','xlsx','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','years'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x02ab,0x85));var _0xb02a=function(_0x18a581,_0x505c50){_0x18a581=_0x18a581-0x0;var _0x3066dd=_0x02ab[_0x18a581];return _0x3066dd;};'use strict';var Sequelize=require(_0xb02a('0x0'));module[_0xb02a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb02a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb02a('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xb02a('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb02a('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xb02a('0x6'),_0xb02a('0x7'),_0xb02a('0x8'),_0xb02a('0x9'),_0xb02a('0xa'),'hours',_0xb02a('0xb')),'allowNull':![],'defaultValue':_0xb02a('0xa')},'output':{'type':Sequelize[_0xb02a('0xc')](_0xb02a('0xd'),_0xb02a('0xe'),_0xb02a('0xf')),'allowNull':![],'defaultValue':_0xb02a('0xd')},'type':{'type':Sequelize[_0xb02a('0xc')]('custom',_0xb02a('0x10')),'allowNull':![],'defaultValue':_0xb02a('0x11')},'sendMail':{'type':Sequelize[_0xb02a('0x12')],'defaultValue':![]},'email':{'type':Sequelize[_0xb02a('0x2')]},'cc':{'type':Sequelize[_0xb02a('0x13')]},'bcc':{'type':Sequelize[_0xb02a('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index e68edd5..5f5a052 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 _0xd8aa=['type','key','model','map','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','keys','fields','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','name','send','Schedule','rawAttributes'];(function(_0x197a1e,_0x1e2cc7){var _0x49de13=function(_0x543164){while(--_0x543164){_0x197a1e['push'](_0x197a1e['shift']());}};_0x49de13(++_0x1e2cc7);}(_0xd8aa,0x119));var _0xad8a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd8aa[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad8a('0x0'));var zipdir=require(_0xad8a('0x1'));var jsonpatch=require(_0xad8a('0x2'));var rp=require(_0xad8a('0x3'));var moment=require(_0xad8a('0x4'));var BPromise=require(_0xad8a('0x5'));var Mustache=require(_0xad8a('0x6'));var util=require('util');var path=require('path');var sox=require(_0xad8a('0x7'));var csv=require(_0xad8a('0x8'));var ejs=require(_0xad8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad8a('0xa'));var crypto=require('crypto');var jsforce=require(_0xad8a('0xb'));var deskjs=require(_0xad8a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad8a('0xd'));var Redis=require(_0xad8a('0xe'));var authService=require(_0xad8a('0xf'));var qs=require(_0xad8a('0x10'));var as=require(_0xad8a('0x11'));var hardwareService=require(_0xad8a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xad8a('0x13'));var db=require(_0xad8a('0x14'))['db'];function respondWithStatusCode(_0x5684ac,_0x4a1c62){_0x4a1c62=_0x4a1c62||0xcc;return function(_0x144522){if(_0x144522){return _0x5684ac[_0xad8a('0x15')](_0x4a1c62);}return _0x5684ac[_0xad8a('0x16')](_0x4a1c62)['end']();};}function respondWithResult(_0x12de49,_0x4a4ad8){_0x4a4ad8=_0x4a4ad8||0xc8;return function(_0x2df48c){if(_0x2df48c){return _0x12de49[_0xad8a('0x16')](_0x4a4ad8)[_0xad8a('0x17')](_0x2df48c);}};}function respondWithFilteredResult(_0x1f7b71,_0x2e9c1c){return function(_0x3d66d4){if(_0x3d66d4){var _0x51c023=typeof _0x2e9c1c[_0xad8a('0x18')]==='undefined'&&typeof _0x2e9c1c[_0xad8a('0x19')]===_0xad8a('0x1a');var _0x28970c=_0x3d66d4['count'];var _0x2e403b=_0x51c023?0x0:_0x2e9c1c[_0xad8a('0x18')];var _0x6901f0=_0x51c023?_0x3d66d4[_0xad8a('0x1b')]:_0x2e9c1c[_0xad8a('0x18')]+_0x2e9c1c[_0xad8a('0x19')];var _0x5edd8e;if(_0x6901f0>=_0x28970c){_0x6901f0=_0x28970c;_0x5edd8e=0xc8;}else{_0x5edd8e=0xce;}_0x1f7b71[_0xad8a('0x16')](_0x5edd8e);return _0x1f7b71[_0xad8a('0x1c')](_0xad8a('0x1d'),_0x2e403b+'-'+_0x6901f0+'/'+_0x28970c)[_0xad8a('0x17')](_0x3d66d4);}return null;};}function patchUpdates(_0x1e60ee){return function(_0x3f6c5d){try{jsonpatch['apply'](_0x3f6c5d,_0x1e60ee,!![]);}catch(_0x15f326){return BPromise[_0xad8a('0x1e')](_0x15f326);}return _0x3f6c5d[_0xad8a('0x1f')]();};}function saveUpdates(_0x1eb72e,_0x186581){return function(_0x3239c2){if(_0x3239c2){return _0x3239c2['update'](_0x1eb72e)['then'](function(_0x3208f9){return _0x3208f9;});}return null;};}function removeEntity(_0x411d27,_0x49bf78){return function(_0x1df8c9){if(_0x1df8c9){return _0x1df8c9['destroy']()[_0xad8a('0x20')](function(){var _0x43e739=_0x1df8c9['get']({'plain':!![]});var _0x388b15='Scheduler';return db['UserProfileResource'][_0xad8a('0x21')]({'where':{'type':_0x388b15,'resourceId':_0x43e739['id']}})[_0xad8a('0x20')](function(){return _0x1df8c9;});})[_0xad8a('0x20')](function(){_0x411d27[_0xad8a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd8dfc,_0x5bb034){return function(_0x377a94){if(!_0x377a94){_0xdd8dfc[_0xad8a('0x15')](0x194);}return _0x377a94;};}function handleError(_0x12e6a4,_0x4938ad){_0x4938ad=_0x4938ad||0x1f4;return function(_0x48cded){logger[_0xad8a('0x22')](_0x48cded['stack']);if(_0x48cded[_0xad8a('0x23')]){delete _0x48cded[_0xad8a('0x23')];}_0x12e6a4[_0xad8a('0x16')](_0x4938ad)[_0xad8a('0x24')](_0x48cded);};}exports['index']=function(_0x36e6d9,_0x2695a4){var _0x6beac8={},_0x1a0d34={},_0x2ed34f={'count':0x0,'rows':[]};var _0x206614=_['map'](db[_0xad8a('0x25')][_0xad8a('0x26')],function(_0x56a226){return{'name':_0x56a226['fieldName'],'type':_0x56a226[_0xad8a('0x27')][_0xad8a('0x28')]};});_0x1a0d34[_0xad8a('0x29')]=_[_0xad8a('0x2a')](_0x206614,'name');_0x1a0d34[_0xad8a('0x2b')]=_['keys'](_0x36e6d9[_0xad8a('0x2b')]);_0x1a0d34['filters']=_[_0xad8a('0x2c')](_0x1a0d34[_0xad8a('0x29')],_0x1a0d34[_0xad8a('0x2b')]);_0x6beac8[_0xad8a('0x2d')]=_[_0xad8a('0x2c')](_0x1a0d34['model'],qs['fields'](_0x36e6d9[_0xad8a('0x2b')]['fields']));_0x6beac8[_0xad8a('0x2d')]=_0x6beac8['attributes']['length']?_0x6beac8[_0xad8a('0x2d')]:_0x1a0d34[_0xad8a('0x29')];if(!_0x36e6d9['query'][_0xad8a('0x2e')]('nolimit')){_0x6beac8[_0xad8a('0x19')]=qs[_0xad8a('0x19')](_0x36e6d9['query']['limit']);_0x6beac8['offset']=qs[_0xad8a('0x18')](_0x36e6d9[_0xad8a('0x2b')][_0xad8a('0x18')]);}_0x6beac8[_0xad8a('0x2f')]=qs[_0xad8a('0x30')](_0x36e6d9[_0xad8a('0x2b')]['sort']);_0x6beac8[_0xad8a('0x31')]=qs[_0xad8a('0x32')](_[_0xad8a('0x33')](_0x36e6d9['query'],_0x1a0d34['filters']),_0x206614);if(_0x36e6d9[_0xad8a('0x2b')][_0xad8a('0x34')]){_0x6beac8[_0xad8a('0x31')]=_[_0xad8a('0x35')](_0x6beac8[_0xad8a('0x31')],{'$or':_[_0xad8a('0x2a')](_0x206614,function(_0x9c6cbd){if(_0x9c6cbd['type']!==_0xad8a('0x36')){var _0x50f8a0={};_0x50f8a0[_0x9c6cbd['name']]={'$like':'%'+_0x36e6d9[_0xad8a('0x2b')][_0xad8a('0x34')]+'%'};return _0x50f8a0;}})});}_0x6beac8=_[_0xad8a('0x35')]({},_0x6beac8,_0x36e6d9[_0xad8a('0x37')]);var _0x88399c={'where':_0x6beac8[_0xad8a('0x31')]};return db[_0xad8a('0x25')][_0xad8a('0x1b')](_0x88399c)[_0xad8a('0x20')](function(_0x4d46de){_0x2ed34f[_0xad8a('0x1b')]=_0x4d46de;if(_0x36e6d9[_0xad8a('0x2b')]['includeAll']){_0x6beac8[_0xad8a('0x38')]=[{'all':!![]}];}return db[_0xad8a('0x25')][_0xad8a('0x39')](_0x6beac8);})['then'](function(_0x4ce35d){_0x2ed34f['rows']=_0x4ce35d;return _0x2ed34f;})[_0xad8a('0x20')](respondWithFilteredResult(_0x2695a4,_0x6beac8))[_0xad8a('0x3a')](handleError(_0x2695a4,null));};exports[_0xad8a('0x3b')]=function(_0xd9b4f5,_0x4fdf2f){var _0x4cdb5b={'raw':![],'where':{'id':_0xd9b4f5['params']['id']}},_0x3938f4={};_0x3938f4[_0xad8a('0x29')]=_[_0xad8a('0x3c')](db[_0xad8a('0x25')][_0xad8a('0x26')]);_0x3938f4[_0xad8a('0x2b')]=_[_0xad8a('0x3c')](_0xd9b4f5['query']);_0x3938f4['filters']=_[_0xad8a('0x2c')](_0x3938f4[_0xad8a('0x29')],_0x3938f4['query']);_0x4cdb5b[_0xad8a('0x2d')]=_['intersection'](_0x3938f4[_0xad8a('0x29')],qs['fields'](_0xd9b4f5[_0xad8a('0x2b')][_0xad8a('0x3d')]));_0x4cdb5b['attributes']=_0x4cdb5b[_0xad8a('0x2d')][_0xad8a('0x3e')]?_0x4cdb5b[_0xad8a('0x2d')]:_0x3938f4[_0xad8a('0x29')];if(_0xd9b4f5[_0xad8a('0x2b')][_0xad8a('0x3f')]){_0x4cdb5b['include']=[{'all':!![]}];}_0x4cdb5b=_['merge']({},_0x4cdb5b,_0xd9b4f5[_0xad8a('0x37')]);return db[_0xad8a('0x25')][_0xad8a('0x40')](_0x4cdb5b)[_0xad8a('0x20')](handleEntityNotFound(_0x4fdf2f,null))['then'](respondWithResult(_0x4fdf2f,null))['catch'](handleError(_0x4fdf2f,null));};exports[_0xad8a('0x41')]=function(_0x1ee838,_0x428382){return db[_0xad8a('0x25')][_0xad8a('0x41')](_0x1ee838[_0xad8a('0x42')],{})['then'](function(_0x516df5){var _0x52b100=_0x1ee838['user'][_0xad8a('0x43')]({'plain':!![]});if(!_0x52b100)throw new Error(_0xad8a('0x44'));if(_0x52b100[_0xad8a('0x45')]===_0xad8a('0x46')){var _0x5079b4=_0x516df5[_0xad8a('0x43')]({'plain':!![]});var _0xc44f96=_0xad8a('0x47');return db[_0xad8a('0x48')]['find']({'where':{'name':_0xc44f96,'userProfileId':_0x52b100['userProfileId']},'raw':!![]})['then'](function(_0x455d13){if(_0x455d13&&_0x455d13[_0xad8a('0x49')]===0x0){return db[_0xad8a('0x4a')][_0xad8a('0x41')]({'name':_0x5079b4[_0xad8a('0x23')],'resourceId':_0x5079b4['id'],'type':_0x455d13[_0xad8a('0x23')],'sectionId':_0x455d13['id']},{})[_0xad8a('0x20')](function(){return _0x516df5;});}else{return _0x516df5;}})[_0xad8a('0x3a')](function(_0x47231b){logger[_0xad8a('0x22')](_0xad8a('0x4b'),_0x47231b);throw _0x47231b;});}return _0x516df5;})[_0xad8a('0x20')](respondWithResult(_0x428382,0xc9))[_0xad8a('0x3a')](handleError(_0x428382,null));};exports[_0xad8a('0x4c')]=function(_0x2dc736,_0xf53ba9){if(_0x2dc736[_0xad8a('0x42')]['id']){delete _0x2dc736['body']['id'];}return db[_0xad8a('0x25')][_0xad8a('0x40')]({'where':{'id':_0x2dc736[_0xad8a('0x4d')]['id']}})[_0xad8a('0x20')](handleEntityNotFound(_0xf53ba9,null))[_0xad8a('0x20')](saveUpdates(_0x2dc736[_0xad8a('0x42')],null))[_0xad8a('0x20')](respondWithResult(_0xf53ba9,null))['catch'](handleError(_0xf53ba9,null));};exports[_0xad8a('0x21')]=function(_0xa653c3,_0x475b80){return db['Schedule'][_0xad8a('0x40')]({'where':{'id':_0xa653c3[_0xad8a('0x4d')]['id']}})[_0xad8a('0x20')](handleEntityNotFound(_0x475b80,null))[_0xad8a('0x20')](removeEntity(_0x475b80,null))[_0xad8a('0x3a')](handleError(_0x475b80,null));};exports[_0xad8a('0x4e')]=function(_0x59df0f,_0x1e5c9a,_0x1036d4){var _0x58908c=require(_0xad8a('0x4f'));return db['Schedule']['find']({'where':{'id':_0x59df0f[_0xad8a('0x4d')]['id']},'raw':!![]})[_0xad8a('0x20')](handleEntityNotFound(_0x1e5c9a,null))[_0xad8a('0x20')](function(){_0x58908c[_0xad8a('0x4e')](_0x59df0f[_0xad8a('0x4d')]['id']);})['then'](respondWithStatusCode(_0x1e5c9a,null))['catch'](handleError(_0x1e5c9a,null));}; \ No newline at end of file +var _0xe956=['sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','get','Scheduler','UserProfileResource','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','query','intersection','fields','attributes','order','sort','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','Schedule','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1f7ac2,_0x4c8009){var _0x525553=function(_0x20cf93){while(--_0x20cf93){_0x1f7ac2['push'](_0x1f7ac2['shift']());}};_0x525553(++_0x4c8009);}(_0xe956,0x1d2));var _0x6e95=function(_0x4cafdb,_0x5f4589){_0x4cafdb=_0x4cafdb-0x0;var _0x4345e1=_0xe956[_0x4cafdb];return _0x4345e1;};'use strict';var emlformat=require(_0x6e95('0x0'));var rimraf=require(_0x6e95('0x1'));var zipdir=require(_0x6e95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e95('0x3'));var moment=require(_0x6e95('0x4'));var BPromise=require(_0x6e95('0x5'));var Mustache=require(_0x6e95('0x6'));var util=require(_0x6e95('0x7'));var path=require(_0x6e95('0x8'));var sox=require(_0x6e95('0x9'));var csv=require(_0x6e95('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e95('0xb'));var _=require(_0x6e95('0xc'));var squel=require(_0x6e95('0xd'));var crypto=require('crypto');var jsforce=require(_0x6e95('0xe'));var deskjs=require(_0x6e95('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e95('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e95('0x11'));var authService=require(_0x6e95('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6e95('0x13'));var hardwareService=require(_0x6e95('0x14'));var logger=require(_0x6e95('0x15'))(_0x6e95('0x16'));var utils=require(_0x6e95('0x17'));var config=require(_0x6e95('0x18'));var licenseUtil=require(_0x6e95('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d7f28,_0x1d05b5){_0x1d05b5=_0x1d05b5||0xcc;return function(_0xfed154){if(_0xfed154){return _0x2d7f28[_0x6e95('0x1a')](_0x1d05b5);}return _0x2d7f28[_0x6e95('0x1b')](_0x1d05b5)['end']();};}function respondWithResult(_0xc65389,_0xe528c){_0xe528c=_0xe528c||0xc8;return function(_0x151f78){if(_0x151f78){return _0xc65389[_0x6e95('0x1b')](_0xe528c)['json'](_0x151f78);}};}function respondWithFilteredResult(_0x50be99,_0x5bdbec){return function(_0xf6246b){if(_0xf6246b){var _0x5da936=typeof _0x5bdbec[_0x6e95('0x1c')]===_0x6e95('0x1d')&&typeof _0x5bdbec[_0x6e95('0x1e')]===_0x6e95('0x1d');var _0x533279=_0xf6246b[_0x6e95('0x1f')];var _0x4cd371=_0x5da936?0x0:_0x5bdbec[_0x6e95('0x1c')];var _0x1e542f=_0x5da936?_0xf6246b[_0x6e95('0x1f')]:_0x5bdbec['offset']+_0x5bdbec[_0x6e95('0x1e')];var _0x4ededa;if(_0x1e542f>=_0x533279){_0x1e542f=_0x533279;_0x4ededa=0xc8;}else{_0x4ededa=0xce;}_0x50be99[_0x6e95('0x1b')](_0x4ededa);return _0x50be99['set'](_0x6e95('0x20'),_0x4cd371+'-'+_0x1e542f+'/'+_0x533279)[_0x6e95('0x21')](_0xf6246b);}return null;};}function patchUpdates(_0x3a1157){return function(_0x503ba3){try{jsonpatch[_0x6e95('0x22')](_0x503ba3,_0x3a1157,!![]);}catch(_0x577d11){return BPromise['reject'](_0x577d11);}return _0x503ba3[_0x6e95('0x23')]();};}function saveUpdates(_0x5d6351,_0x4a39b0){return function(_0x4129a1){if(_0x4129a1){return _0x4129a1[_0x6e95('0x24')](_0x5d6351)[_0x6e95('0x25')](function(_0x227a5b){return _0x227a5b;});}return null;};}function removeEntity(_0x35673f,_0x4ac977){return function(_0x39a704){if(_0x39a704){return _0x39a704['destroy']()[_0x6e95('0x25')](function(){var _0xb490a5=_0x39a704[_0x6e95('0x26')]({'plain':!![]});var _0xa7ab01=_0x6e95('0x27');return db[_0x6e95('0x28')][_0x6e95('0x29')]({'where':{'type':_0xa7ab01,'resourceId':_0xb490a5['id']}})[_0x6e95('0x25')](function(){return _0x39a704;});})[_0x6e95('0x25')](function(){_0x35673f[_0x6e95('0x1b')](0xcc)[_0x6e95('0x2a')]();});}};}function handleEntityNotFound(_0x355a06,_0x46a352){return function(_0x2edff2){if(!_0x2edff2){_0x355a06[_0x6e95('0x1a')](0x194);}return _0x2edff2;};}function handleError(_0x214e46,_0x37ff48){_0x37ff48=_0x37ff48||0x1f4;return function(_0x16ce87){logger[_0x6e95('0x2b')](_0x16ce87[_0x6e95('0x2c')]);if(_0x16ce87[_0x6e95('0x2d')]){delete _0x16ce87['name'];}_0x214e46['status'](_0x37ff48)[_0x6e95('0x2e')](_0x16ce87);};}exports[_0x6e95('0x2f')]=function(_0x24b7dc,_0x44855e){var _0x4d105a={},_0x56b8e0={},_0x2beb54={'count':0x0,'rows':[]};var _0x4d5ae4=_['map'](db['Schedule']['rawAttributes'],function(_0x9304e){return{'name':_0x9304e[_0x6e95('0x30')],'type':_0x9304e[_0x6e95('0x31')][_0x6e95('0x32')]};});_0x56b8e0[_0x6e95('0x33')]=_[_0x6e95('0x34')](_0x4d5ae4,_0x6e95('0x2d'));_0x56b8e0[_0x6e95('0x35')]=_['keys'](_0x24b7dc[_0x6e95('0x35')]);_0x56b8e0['filters']=_[_0x6e95('0x36')](_0x56b8e0['model'],_0x56b8e0[_0x6e95('0x35')]);_0x4d105a['attributes']=_[_0x6e95('0x36')](_0x56b8e0[_0x6e95('0x33')],qs[_0x6e95('0x37')](_0x24b7dc[_0x6e95('0x35')][_0x6e95('0x37')]));_0x4d105a[_0x6e95('0x38')]=_0x4d105a['attributes']['length']?_0x4d105a[_0x6e95('0x38')]:_0x56b8e0['model'];if(!_0x24b7dc[_0x6e95('0x35')]['hasOwnProperty']('nolimit')){_0x4d105a[_0x6e95('0x1e')]=qs[_0x6e95('0x1e')](_0x24b7dc[_0x6e95('0x35')][_0x6e95('0x1e')]);_0x4d105a[_0x6e95('0x1c')]=qs['offset'](_0x24b7dc['query']['offset']);}_0x4d105a[_0x6e95('0x39')]=qs[_0x6e95('0x3a')](_0x24b7dc['query']['sort']);_0x4d105a['where']=qs['filters'](_['pick'](_0x24b7dc['query'],_0x56b8e0[_0x6e95('0x3b')]),_0x4d5ae4);if(_0x24b7dc['query'][_0x6e95('0x3c')]){_0x4d105a['where']=_[_0x6e95('0x3d')](_0x4d105a['where'],{'$or':_[_0x6e95('0x34')](_0x4d5ae4,function(_0x410270){if(_0x410270[_0x6e95('0x31')]!=='VIRTUAL'){var _0x53d2dc={};_0x53d2dc[_0x410270[_0x6e95('0x2d')]]={'$like':'%'+_0x24b7dc['query'][_0x6e95('0x3c')]+'%'};return _0x53d2dc;}})});}_0x4d105a=_[_0x6e95('0x3d')]({},_0x4d105a,_0x24b7dc[_0x6e95('0x3e')]);var _0x3dfb7f={'where':_0x4d105a['where']};return db['Schedule'][_0x6e95('0x1f')](_0x3dfb7f)[_0x6e95('0x25')](function(_0x6abb52){_0x2beb54[_0x6e95('0x1f')]=_0x6abb52;if(_0x24b7dc[_0x6e95('0x35')][_0x6e95('0x3f')]){_0x4d105a[_0x6e95('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x6e95('0x41')](_0x4d105a);})['then'](function(_0x396846){_0x2beb54[_0x6e95('0x42')]=_0x396846;return _0x2beb54;})[_0x6e95('0x25')](respondWithFilteredResult(_0x44855e,_0x4d105a))[_0x6e95('0x43')](handleError(_0x44855e,null));};exports['show']=function(_0x58de36,_0x2b67cb){var _0x4b5873={'raw':![],'where':{'id':_0x58de36[_0x6e95('0x44')]['id']}},_0xb7dc31={};_0xb7dc31['model']=_['keys'](db[_0x6e95('0x45')]['rawAttributes']);_0xb7dc31[_0x6e95('0x35')]=_[_0x6e95('0x46')](_0x58de36[_0x6e95('0x35')]);_0xb7dc31[_0x6e95('0x3b')]=_[_0x6e95('0x36')](_0xb7dc31['model'],_0xb7dc31[_0x6e95('0x35')]);_0x4b5873[_0x6e95('0x38')]=_[_0x6e95('0x36')](_0xb7dc31['model'],qs[_0x6e95('0x37')](_0x58de36[_0x6e95('0x35')][_0x6e95('0x37')]));_0x4b5873[_0x6e95('0x38')]=_0x4b5873[_0x6e95('0x38')]['length']?_0x4b5873[_0x6e95('0x38')]:_0xb7dc31[_0x6e95('0x33')];if(_0x58de36[_0x6e95('0x35')][_0x6e95('0x3f')]){_0x4b5873[_0x6e95('0x40')]=[{'all':!![]}];}_0x4b5873=_[_0x6e95('0x3d')]({},_0x4b5873,_0x58de36['options']);return db[_0x6e95('0x45')][_0x6e95('0x47')](_0x4b5873)[_0x6e95('0x25')](handleEntityNotFound(_0x2b67cb,null))[_0x6e95('0x25')](respondWithResult(_0x2b67cb,null))['catch'](handleError(_0x2b67cb,null));};exports[_0x6e95('0x48')]=function(_0x2eb538,_0x29d860){return db['Schedule'][_0x6e95('0x48')](_0x2eb538[_0x6e95('0x49')],{})['then'](function(_0x3058fa){var _0x4203ba=_0x2eb538['user'][_0x6e95('0x26')]({'plain':!![]});if(!_0x4203ba)throw new Error(_0x6e95('0x4a'));if(_0x4203ba[_0x6e95('0x4b')]===_0x6e95('0x4c')){var _0x173bbd=_0x3058fa['get']({'plain':!![]});var _0x4db984=_0x6e95('0x27');return db[_0x6e95('0x4d')][_0x6e95('0x47')]({'where':{'name':_0x4db984,'userProfileId':_0x4203ba[_0x6e95('0x4e')]},'raw':!![]})[_0x6e95('0x25')](function(_0x349be2){if(_0x349be2&&_0x349be2[_0x6e95('0x4f')]===0x0){return db[_0x6e95('0x28')][_0x6e95('0x48')]({'name':_0x173bbd[_0x6e95('0x2d')],'resourceId':_0x173bbd['id'],'type':_0x349be2[_0x6e95('0x2d')],'sectionId':_0x349be2['id']},{})[_0x6e95('0x25')](function(){return _0x3058fa;});}else{return _0x3058fa;}})[_0x6e95('0x43')](function(_0x2a950a){logger[_0x6e95('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a950a);throw _0x2a950a;});}return _0x3058fa;})[_0x6e95('0x25')](respondWithResult(_0x29d860,0xc9))[_0x6e95('0x43')](handleError(_0x29d860,null));};exports['update']=function(_0x617467,_0x43cef6){if(_0x617467['body']['id']){delete _0x617467[_0x6e95('0x49')]['id'];}return db[_0x6e95('0x45')]['find']({'where':{'id':_0x617467[_0x6e95('0x44')]['id']}})[_0x6e95('0x25')](handleEntityNotFound(_0x43cef6,null))[_0x6e95('0x25')](saveUpdates(_0x617467['body'],null))[_0x6e95('0x25')](respondWithResult(_0x43cef6,null))[_0x6e95('0x43')](handleError(_0x43cef6,null));};exports[_0x6e95('0x29')]=function(_0x374a39,_0x24d461){return db[_0x6e95('0x45')][_0x6e95('0x47')]({'where':{'id':_0x374a39[_0x6e95('0x44')]['id']}})['then'](handleEntityNotFound(_0x24d461,null))['then'](removeEntity(_0x24d461,null))[_0x6e95('0x43')](handleError(_0x24d461,null));};exports[_0x6e95('0x50')]=function(_0x321915,_0x563807,_0x148e5e){var _0x5b8534=require(_0x6e95('0x51'));return db['Schedule'][_0x6e95('0x47')]({'where':{'id':_0x321915[_0x6e95('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x563807,null))[_0x6e95('0x25')](function(){_0x5b8534['run'](_0x321915['params']['id']);})[_0x6e95('0x25')](respondWithStatusCode(_0x563807,null))['catch'](handleError(_0x563807,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0fb4836..58a315f 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 _0x1b14=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','Schedule','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x2a9036,_0x5f3ebd){var _0x27f456=function(_0xcb2983){while(--_0xcb2983){_0x2a9036['push'](_0x2a9036['shift']());}};_0x27f456(++_0x5f3ebd);}(_0x1b14,0x14c));var _0x41b1=function(_0x11023a,_0x3fcbd5){_0x11023a=_0x11023a-0x0;var _0x2a0f9d=_0x1b14[_0x11023a];return _0x2a0f9d;};'use strict';var _=require(_0x41b1('0x0'));var util=require(_0x41b1('0x1'));var logger=require(_0x41b1('0x2'))(_0x41b1('0x3'));var moment=require('moment');var BPromise=require(_0x41b1('0x4'));var rp=require(_0x41b1('0x5'));var fs=require('fs');var path=require(_0x41b1('0x6'));var rimraf=require(_0x41b1('0x7'));var config=require(_0x41b1('0x8'));var attributes=require(_0x41b1('0x9'));module['exports']=function(_0x11953c,_0x3eb6a7){return _0x11953c['define'](_0x41b1('0xa'),attributes,{'tableName':_0x41b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x947a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x5799c9,_0x6f4fc5){var _0x16d83d=function(_0x3edccc){while(--_0x3edccc){_0x5799c9['push'](_0x5799c9['shift']());}};_0x16d83d(++_0x6f4fc5);}(_0x947a,0x77));var _0xa947=function(_0x1afeb1,_0x4ef5e7){_0x1afeb1=_0x1afeb1-0x0;var _0x397155=_0x947a[_0x1afeb1];return _0x397155;};'use strict';var _=require(_0xa947('0x0'));var util=require(_0xa947('0x1'));var logger=require(_0xa947('0x2'))(_0xa947('0x3'));var moment=require(_0xa947('0x4'));var BPromise=require(_0xa947('0x5'));var rp=require(_0xa947('0x6'));var fs=require('fs');var path=require(_0xa947('0x7'));var rimraf=require(_0xa947('0x8'));var config=require(_0xa947('0x9'));var attributes=require(_0xa947('0xa'));module[_0xa947('0xb')]=function(_0xc6cca4,_0x27989d){return _0xc6cca4[_0xa947('0xc')](_0xa947('0xd'),attributes,{'tableName':_0xa947('0xe'),'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 dd9c12e..c914491 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 _0x3d4c=['jayson/promise','http','then','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','../../config/logger','rpc','../../config/environment'];(function(_0x3cb21e,_0x11849a){var _0xeacd6a=function(_0xef5a2e){while(--_0xef5a2e){_0x3cb21e['push'](_0x3cb21e['shift']());}};_0xeacd6a(++_0x11849a);}(_0x3d4c,0x14e));var _0xc3d4=function(_0x6447ff,_0x367c10){_0x6447ff=_0x6447ff-0x0;var _0x3a8aed=_0x3d4c[_0x6447ff];return _0x3a8aed;};'use strict';var _=require(_0xc3d4('0x0'));var util=require('util');var moment=require(_0xc3d4('0x1'));var BPromise=require(_0xc3d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3d4('0x3'))(_0xc3d4('0x4'));var config=require(_0xc3d4('0x5'));var jayson=require(_0xc3d4('0x6'));var client=jayson['client'][_0xc3d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41c990,_0x278a53,_0x456df7){return new BPromise(function(_0x2e330f,_0x3b13e2){return client['request'](_0x41c990,_0x456df7)[_0xc3d4('0x8')](function(_0xde9319){logger['info'](_0xc3d4('0x9'),_0x278a53,_0xc3d4('0xa'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x278a53,_0xc3d4('0xa'),JSON[_0xc3d4('0xb')](_0xde9319));if(_0xde9319[_0xc3d4('0xc')]){if(_0xde9319[_0xc3d4('0xc')][_0xc3d4('0xd')]===0x1f4){logger[_0xc3d4('0xc')](_0xc3d4('0x9'),_0x278a53,_0xde9319[_0xc3d4('0xc')]['message']);return _0x3b13e2(_0xde9319[_0xc3d4('0xc')]['message']);}logger[_0xc3d4('0xc')]('Schedule,\x20%s,\x20%s',_0x278a53,_0xde9319[_0xc3d4('0xc')][_0xc3d4('0xe')]);return _0x2e330f(_0xde9319[_0xc3d4('0xc')][_0xc3d4('0xe')]);}else{logger[_0xc3d4('0xf')]('Schedule,\x20%s,\x20%s',_0x278a53,'request\x20sent');_0x2e330f(_0xde9319['result'][_0xc3d4('0xe')]);}})[_0xc3d4('0x10')](function(_0x36224e){logger[_0xc3d4('0xc')](_0xc3d4('0x9'),_0x278a53,_0x36224e);_0x3b13e2(_0x36224e);});});} \ No newline at end of file +var _0x2404=['request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x55e548,_0x1be586){var _0x2e656a=function(_0xa04854){while(--_0xa04854){_0x55e548['push'](_0x55e548['shift']());}};_0x2e656a(++_0x1be586);}(_0x2404,0xfd));var _0x4240=function(_0x586dde,_0x34d261){_0x586dde=_0x586dde-0x0;var _0x3ef4a0=_0x2404[_0x586dde];return _0x3ef4a0;};'use strict';var _=require(_0x4240('0x0'));var util=require(_0x4240('0x1'));var moment=require(_0x4240('0x2'));var BPromise=require(_0x4240('0x3'));var rs=require(_0x4240('0x4'));var fs=require('fs');var Redis=require(_0x4240('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4240('0x6'));var logger=require('../../config/logger')(_0x4240('0x7'));var config=require(_0x4240('0x8'));var jayson=require(_0x4240('0x9'));var client=jayson[_0x4240('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d687b,_0x1f85fd,_0x5e1d12){return new BPromise(function(_0xc8839e,_0x3e1c0a){return client[_0x4240('0xb')](_0x2d687b,_0x5e1d12)[_0x4240('0xc')](function(_0x1fc6ba){logger[_0x4240('0xd')]('Schedule,\x20%s,\x20%s',_0x1f85fd,_0x4240('0xe'));logger['debug'](_0x4240('0xf'),_0x1f85fd,_0x4240('0xe'),JSON[_0x4240('0x10')](_0x1fc6ba));if(_0x1fc6ba[_0x4240('0x11')]){if(_0x1fc6ba['error'][_0x4240('0x12')]===0x1f4){logger['error'](_0x4240('0x13'),_0x1f85fd,_0x1fc6ba[_0x4240('0x11')]['message']);return _0x3e1c0a(_0x1fc6ba[_0x4240('0x11')][_0x4240('0x14')]);}logger[_0x4240('0x11')]('Schedule,\x20%s,\x20%s',_0x1f85fd,_0x1fc6ba[_0x4240('0x11')]['message']);return _0xc8839e(_0x1fc6ba['error'][_0x4240('0x14')]);}else{logger[_0x4240('0xd')](_0x4240('0x13'),_0x1f85fd,'request\x20sent');_0xc8839e(_0x1fc6ba['result']['message']);}})[_0x4240('0x15')](function(_0x322972){logger[_0x4240('0x11')](_0x4240('0x13'),_0x1f85fd,_0x322972);_0x3e1c0a(_0x322972);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2baf231..3f43868 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 _0xab3c=['get','/describe','/:id','isAuthenticated','download','post','create','update','delete','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xab3c,0x1e7));var _0xcab3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab3c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcab3('0x0'));var util=require('util');var path=require(_0xcab3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcab3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xcab3('0x3'));var config=require(_0xcab3('0x4'));var controller=require(_0xcab3('0x5'));router[_0xcab3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcab3('0x6')](_0xcab3('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xcab3('0x6')](_0xcab3('0x8'),auth[_0xcab3('0x9')](),controller['show']);router[_0xcab3('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0xcab3('0xa')]);router[_0xcab3('0xb')]('/',auth[_0xcab3('0x9')](),controller[_0xcab3('0xc')]);router['put']('/:id',auth[_0xcab3('0x9')](),controller[_0xcab3('0xd')]);router[_0xcab3('0xe')](_0xcab3('0x8'),auth['isAuthenticated'](),controller[_0xcab3('0xf')]);module[_0xcab3('0x10')]=router; \ No newline at end of file +var _0xd84f=['put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','post','create'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd84f,0xe0));var _0xfd84=function(_0x252a8c,_0x125df7){_0x252a8c=_0x252a8c-0x0;var _0x32389b=_0xd84f[_0x252a8c];return _0x32389b;};'use strict';var multer=require('multer');var util=require(_0xfd84('0x0'));var path=require(_0xfd84('0x1'));var timeout=require(_0xfd84('0x2'));var express=require(_0xfd84('0x3'));var router=express['Router']();var fs_extra=require(_0xfd84('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfd84('0x5'));var config=require(_0xfd84('0x6'));var controller=require(_0xfd84('0x7'));router['get']('/',auth[_0xfd84('0x8')](),controller['index']);router[_0xfd84('0x9')](_0xfd84('0xa'),auth[_0xfd84('0x8')](),controller['describe']);router[_0xfd84('0x9')](_0xfd84('0xb'),auth[_0xfd84('0x8')](),controller[_0xfd84('0xc')]);router['get'](_0xfd84('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xfd84('0xe')]('/',auth[_0xfd84('0x8')](),controller[_0xfd84('0xf')]);router[_0xfd84('0x10')]('/:id',auth[_0xfd84('0x8')](),controller['update']);router[_0xfd84('0x11')]('/:id',auth[_0xfd84('0x8')](),controller[_0xfd84('0x12')]);module[_0xfd84('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c1db2f8..3d45a00 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 _0x202a=['createdAt','updatedAt','moment','path','../../config/environment','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','toString','DATE','MM-DD-YYYY\x20HH:mm'];(function(_0x493cc4,_0x43b1d6){var _0x13fba3=function(_0x497ffc){while(--_0x497ffc){_0x493cc4['push'](_0x493cc4['shift']());}};_0x13fba3(++_0x43b1d6);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa202('0x0'));var path=require(_0xa202('0x1'));var config=require(_0xa202('0x2'));module['exports']={'format':{'type':Sequelize[_0xa202('0x3')],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0xa202('0x4')](_0xa202('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa202('0x6')],'set':function(_0x4cb469){var _0x4f0a59=_0x4cb469['replace'](/\\/g,'/');this[_0xa202('0x7')](_0xa202('0x5'),_0x4f0a59);}},'rating':{'type':Sequelize[_0xa202('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa202('0x8')],'set':function(_0x572036){this['setDataValue'](_0xa202('0x9'),moment()[_0xa202('0xa')](_0x572036,'ms'));this[_0xa202('0x7')](_0xa202('0xb'),moment());this['setDataValue'](_0xa202('0xc'),_0x572036);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa202('0x4')](_0xa202('0x9')))[_0xa202('0xd')]('MM-DD-YYYY\x20HH:mm')[_0xa202('0xe')]();}},'closedAt':{'type':Sequelize[_0xa202('0xf')],'get':function(){return moment(this[_0xa202('0x4')](_0xa202('0xb')))[_0xa202('0xd')](_0xa202('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xa202('0xf')],'get':function(){return moment(this[_0xa202('0x4')](_0xa202('0x11')))[_0xa202('0xd')](_0xa202('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa202('0xf')],'get':function(){return moment(this[_0xa202('0x4')](_0xa202('0x12')))[_0xa202('0xd')](_0xa202('0x10'))[_0xa202('0xe')]();}}}; \ No newline at end of file +var _0x0eeb=['startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','extname','getDataValue','value','STRING','replace','INTEGER','setDataValue'];(function(_0x5da01d,_0x4654d6){var _0x358254=function(_0x2d192c){while(--_0x2d192c){_0x5da01d['push'](_0x5da01d['shift']());}};_0x358254(++_0x4654d6);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eeb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb0ee('0x0'));var moment=require(_0xb0ee('0x1'));var path=require(_0xb0ee('0x2'));var config=require(_0xb0ee('0x3'));module[_0xb0ee('0x4')]={'format':{'type':Sequelize[_0xb0ee('0x5')],'get':function(){return this['getDataValue']('value')?path[_0xb0ee('0x6')](this[_0xb0ee('0x7')](_0xb0ee('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0xb0ee('0x9')]},'channel':{'type':Sequelize[_0xb0ee('0x9')]},'value':{'type':Sequelize[_0xb0ee('0x9')],'set':function(_0x17f445){var _0x5377b4=_0x17f445[_0xb0ee('0xa')](/\\/g,'/');this['setDataValue'](_0xb0ee('0x8'),_0x5377b4);}},'rating':{'type':Sequelize[_0xb0ee('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb0ee('0xb')],'set':function(_0x308603){this[_0xb0ee('0xc')](_0xb0ee('0xd'),moment()['subtract'](_0x308603,'ms'));this['setDataValue'](_0xb0ee('0xe'),moment());this[_0xb0ee('0xc')]('duration',_0x308603);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb0ee('0x7')](_0xb0ee('0xd')))[_0xb0ee('0xf')](_0xb0ee('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xb0ee('0x11')],'get':function(){return moment(this['getDataValue']('closedAt'))['format'](_0xb0ee('0x10'))[_0xb0ee('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb0ee('0x7')](_0xb0ee('0x13')))[_0xb0ee('0xf')](_0xb0ee('0x10'))[_0xb0ee('0x12')]();}},'updatedAt':{'type':Sequelize[_0xb0ee('0x11')],'get':function(){return moment(this[_0xb0ee('0x7')](_0xb0ee('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb0ee('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 89c092d..7305601 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 _0x24ca=['server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','ScreenRecording','include','findAll','rows','catch','show','model','includeAll','find','create','body','duration','createdAt','closedAt','params','describe','download','uniqueid','value','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','join'];(function(_0x2df95c,_0x2e9f21){var _0x29eeb0=function(_0x2d78dc){while(--_0x2d78dc){_0x2df95c['push'](_0x2df95c['shift']());}};_0x29eeb0(++_0x2e9f21);}(_0x24ca,0x1bc));var _0xa24c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x24ca[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['ScreenRecording'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x32')](_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c')),['format']);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x28675f[_0xa24c('0x33')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x33')]);_0x12dbdc[_0xa24c('0x36')]=_['intersection'](_0x5e491e['model'],qs[_0xa24c('0x37')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x37')]));_0x12dbdc[_0xa24c('0x36')]=_0x12dbdc[_0xa24c('0x36')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x36')]:_0x5e491e['model'];if(!_0x28675f[_0xa24c('0x33')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x33')]['offset']);}_0x12dbdc[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x3c')]);_0x12dbdc['where']=qs['filters'](_[_0xa24c('0x3d')](_0x28675f['query'],_0x5e491e[_0xa24c('0x3e')]),_0xc96ce7);if(_0x28675f[_0xa24c('0x33')][_0xa24c('0x3f')]){_0x12dbdc[_0xa24c('0x40')]=_[_0xa24c('0x41')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x3121e){if(_0x3121e[_0xa24c('0x42')]!==_0xa24c('0x43')){var _0x213dc3={};_0x213dc3[_0x3121e[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x33')]['filter']+'%'};return _0x213dc3;}})});}_0x12dbdc=_['merge']({},_0x12dbdc,_0x28675f[_0xa24c('0x44')]);var _0x1ce83e={'where':_0x12dbdc[_0xa24c('0x40')]};return db[_0xa24c('0x45')][_0xa24c('0x20')](_0x1ce83e)['then'](function(_0x171c51){_0x21d2a8[_0xa24c('0x20')]=_0x171c51;if(_0x28675f['query']['includeAll']){_0x12dbdc[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x45')][_0xa24c('0x47')](_0x12dbdc);})['then'](function(_0x58ac8b){_0x21d2a8[_0xa24c('0x48')]=_0x58ac8b;return _0x21d2a8;})[_0xa24c('0x27')](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x49')](handleError(_0x152120,null));};exports[_0xa24c('0x4a')]=function(_0x3f640e,_0x1b7faf){var _0x23d1e0={'raw':![],'where':{'id':_0x3f640e['params']['id']}},_0x394d19={};_0x394d19['model']=_[_0xa24c('0x34')](db[_0xa24c('0x45')][_0xa24c('0x2f')]);_0x394d19['query']=_[_0xa24c('0x34')](_0x3f640e[_0xa24c('0x33')]);_0x394d19[_0xa24c('0x3e')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],_0x394d19[_0xa24c('0x33')]);_0x23d1e0[_0xa24c('0x36')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],qs[_0xa24c('0x37')](_0x3f640e['query'][_0xa24c('0x37')]));_0x23d1e0[_0xa24c('0x36')]=_0x23d1e0[_0xa24c('0x36')]['length']?_0x23d1e0[_0xa24c('0x36')]:_0x394d19[_0xa24c('0x4b')];if(_0x3f640e[_0xa24c('0x33')][_0xa24c('0x4c')]){_0x23d1e0[_0xa24c('0x46')]=[{'all':!![]}];}_0x23d1e0=_[_0xa24c('0x41')]({},_0x23d1e0,_0x3f640e[_0xa24c('0x44')]);return db[_0xa24c('0x45')][_0xa24c('0x4d')](_0x23d1e0)[_0xa24c('0x27')](handleEntityNotFound(_0x1b7faf,null))[_0xa24c('0x27')](respondWithResult(_0x1b7faf,null))['catch'](handleError(_0x1b7faf,null));};exports[_0xa24c('0x4e')]=function(_0x96b977,_0x42028b){return db[_0xa24c('0x45')][_0xa24c('0x4e')](_0x96b977[_0xa24c('0x4f')],{})[_0xa24c('0x27')](respondWithResult(_0x42028b,0xc9))[_0xa24c('0x49')](handleError(_0x42028b,null));};exports[_0xa24c('0x26')]=function(_0x4f56ae,_0x540da8){if(_0x4f56ae[_0xa24c('0x4f')]['id']){delete _0x4f56ae['body']['id'];}delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x50')];delete _0x4f56ae['body'][_0xa24c('0x51')];delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x52')];delete _0x4f56ae['body']['value'];return db[_0xa24c('0x45')]['find']({'where':{'id':_0x4f56ae[_0xa24c('0x53')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x540da8,null))[_0xa24c('0x27')](saveUpdates(_0x4f56ae[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x540da8,null))[_0xa24c('0x49')](handleError(_0x540da8,null));};exports[_0xa24c('0x54')]=function(_0x286d57,_0x22a0db){return db[_0xa24c('0x45')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x22a0db,null))[_0xa24c('0x49')](handleError(_0x22a0db,null));};exports[_0xa24c('0x55')]=function(_0x513271,_0x5bde94,_0x487cc9){var _0x2da4f0=require('../../components/encryptor');var _0x4757ff=![];var _0x21d0fc={};if(_0x513271['query'][_0xa24c('0x42')]&&_0x513271[_0xa24c('0x33')][_0xa24c('0x42')]===_0xa24c('0x56')){_0x21d0fc[_0xa24c('0x56')]=_0x513271[_0xa24c('0x53')]['id'];}else{_0x21d0fc['id']=_0x513271[_0xa24c('0x53')]['id'];}return db[_0xa24c('0x45')]['find']({'where':_0x21d0fc,'attributes':['id',_0xa24c('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5bde94,null))['then'](function(_0x565f0a){if(_0x565f0a){var _0x5bd2af=path['join'](config[_0xa24c('0x58')],'server/files/screen_recordings',_0x565f0a[_0xa24c('0x57')]);var _0x3fd3f9=util[_0xa24c('0x59')](_0xa24c('0x5a'),_0x5bd2af);if(fs[_0xa24c('0x5b')](_0x3fd3f9)){_0x4757ff=!![];return _0x2da4f0[_0xa24c('0x5c')](_0x3fd3f9,_0x5bd2af,config[_0xa24c('0x5d')][_0xa24c('0x5e')])[_0xa24c('0x27')](function(){return _0x565f0a;});}return _0x565f0a;}})[_0xa24c('0x27')](function(_0x303b7d){if(_0x303b7d){var _0x37dbbd=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x303b7d['value']);if(!fs[_0xa24c('0x5b')](_0x37dbbd)){throw new db[(_0xa24c('0x61'))]['ValidationError'](_0xa24c('0x62'));}if(_0x303b7d[_0xa24c('0x63')]){return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,_0x303b7d[_0xa24c('0x63')]+path['extname'](_0x37dbbd),function(){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}else{return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,function(_0x5e9631){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}}})[_0xa24c('0x49')](function(_0x2515b1){if(_0x2515b1[_0xa24c('0x64')]===_0xa24c('0x62')){_0x5bde94['status'](0x194)['send'](_0xa24c('0x65'));}else{return handleError(_0x5bde94,null);}});};exports['destroy']=function(_0x52a895,_0xfcc193){return db[_0xa24c('0x45')][_0xa24c('0x4d')]({'where':{'id':_0x52a895['params']['id']}})[_0xa24c('0x27')](function(_0x128e5b){if(_['isNil'](_0x128e5b)){throw new ReferenceError(_0xa24c('0x66'));}return _0x128e5b;})[_0xa24c('0x27')](function(_0x3096bf){var _0x4bee5c=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x3096bf[_0xa24c('0x57')]);logger[_0xa24c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x4bee5c);if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs[_0xa24c('0x5b')](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}_0x4bee5c=_0x4bee5c+'.cypher';if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs['existsSync'](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}return _0x3096bf;})[_0xa24c('0x27')](function(_0x3a241a){if(!_0x3a241a)throw new InternalError();return _0x3a241a[_0xa24c('0x28')]();})[_0xa24c('0x27')](function(){_0xfcc193[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})['catch'](handleError(_0xfcc193,null));}; \ No newline at end of file +var _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x385d89,_0x2fe099){_0x385d89=_0x385d89-0x0;var _0x1454e8=_0xd0bb[_0x385d89];return _0x1454e8;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d5d5efe..bc03dca 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 _0x2ee0=['ScreenRecording','screen_recordings','interactionid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x2ee0,0x1a7));var _0x02ee=function(_0x1b8e16,_0x39132e){_0x1b8e16=_0x1b8e16-0x0;var _0x28eb39=_0x2ee0[_0x1b8e16];return _0x28eb39;};'use strict';var _=require(_0x02ee('0x0'));var util=require(_0x02ee('0x1'));var logger=require('../../config/logger')(_0x02ee('0x2'));var moment=require('moment');var BPromise=require(_0x02ee('0x3'));var rp=require(_0x02ee('0x4'));var fs=require('fs');var path=require(_0x02ee('0x5'));var rimraf=require(_0x02ee('0x6'));var config=require(_0x02ee('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0xa8cc52,_0x1c0c6e){return _0xa8cc52[_0x02ee('0x8')](_0x02ee('0x9'),attributes,{'tableName':_0x02ee('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x02ee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x961e=['bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x961e,0x1b9));var _0xe961=function(_0x55bb67,_0x126103){_0x55bb67=_0x55bb67-0x0;var _0xf923a4=_0x961e[_0x55bb67];return _0xf923a4;};'use strict';var _=require('lodash');var util=require(_0xe961('0x0'));var logger=require(_0xe961('0x1'))('api');var moment=require(_0xe961('0x2'));var BPromise=require(_0xe961('0x3'));var rp=require(_0xe961('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe961('0x5'));var config=require(_0xe961('0x6'));var attributes=require(_0xe961('0x7'));module[_0xe961('0x8')]=function(_0x15e956,_0x46d5ef){return _0x15e956['define'](_0xe961('0x9'),attributes,{'tableName':_0xe961('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xe961('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 9ddc940..f43acea 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 _0x575a=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x8b7be0,_0x2450a1){var _0x25eeef=function(_0x1e01a9){while(--_0x1e01a9){_0x8b7be0['push'](_0x8b7be0['shift']());}};_0x25eeef(++_0x2450a1);}(_0x575a,0xe7));var _0xa575=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0x575a[_0x10e840];return _0x405caa;};'use strict';var _=require(_0xa575('0x0'));var util=require('util');var moment=require(_0xa575('0x1'));var BPromise=require(_0xa575('0x2'));var rs=require(_0xa575('0x3'));var fs=require('fs');var Redis=require(_0xa575('0x4'));var db=require(_0xa575('0x5'))['db'];var utils=require(_0xa575('0x6'));var logger=require(_0xa575('0x7'))(_0xa575('0x8'));var config=require('../../config/environment');var jayson=require(_0xa575('0x9'));var client=jayson[_0xa575('0xa')][_0xa575('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdb953d,_0x329cd7,_0x9f169b){return new BPromise(function(_0x21de6d,_0x37a41b){return client[_0xa575('0xc')](_0xdb953d,_0x9f169b)['then'](function(_0x41be22){logger['info'](_0xa575('0xd'),_0x329cd7,_0xa575('0xe'));logger[_0xa575('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x329cd7,_0xa575('0xe'),JSON[_0xa575('0x10')](_0x41be22));if(_0x41be22[_0xa575('0x11')]){if(_0x41be22['error'][_0xa575('0x12')]===0x1f4){logger['error'](_0xa575('0xd'),_0x329cd7,_0x41be22[_0xa575('0x11')][_0xa575('0x13')]);return _0x37a41b(_0x41be22[_0xa575('0x11')][_0xa575('0x13')]);}logger[_0xa575('0x11')](_0xa575('0xd'),_0x329cd7,_0x41be22[_0xa575('0x11')][_0xa575('0x13')]);return _0x21de6d(_0x41be22[_0xa575('0x11')][_0xa575('0x13')]);}else{logger[_0xa575('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x329cd7,_0xa575('0xe'));_0x21de6d(_0x41be22[_0xa575('0x15')]['message']);}})[_0xa575('0x16')](function(_0x4e5d3e){logger[_0xa575('0x11')](_0xa575('0xd'),_0x329cd7,_0x4e5d3e);_0x37a41b(_0x4e5d3e);});});} \ No newline at end of file +var _0x890f=['catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x521da0,_0x4986a4){var _0x159674=function(_0x59ae8a){while(--_0x59ae8a){_0x521da0['push'](_0x521da0['shift']());}};_0x159674(++_0x4986a4);}(_0x890f,0x6f));var _0xf890=function(_0x3327e2,_0x251554){_0x3327e2=_0x3327e2-0x0;var _0x59fb5c=_0x890f[_0x3327e2];return _0x59fb5c;};'use strict';var _=require(_0xf890('0x0'));var util=require(_0xf890('0x1'));var moment=require(_0xf890('0x2'));var BPromise=require(_0xf890('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf890('0x4'));var logger=require('../../config/logger')(_0xf890('0x5'));var config=require(_0xf890('0x6'));var jayson=require(_0xf890('0x7'));var client=jayson[_0xf890('0x8')][_0xf890('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276fee,_0x8b8d90,_0x50c02d){return new BPromise(function(_0x25b0b4,_0x445f46){return client['request'](_0x276fee,_0x50c02d)[_0xf890('0xa')](function(_0x266b64){logger[_0xf890('0xb')](_0xf890('0xc'),_0x8b8d90,'request\x20sent');logger[_0xf890('0xd')](_0xf890('0xe'),_0x8b8d90,_0xf890('0xf'),JSON[_0xf890('0x10')](_0x266b64));if(_0x266b64[_0xf890('0x11')]){if(_0x266b64[_0xf890('0x11')][_0xf890('0x12')]===0x1f4){logger[_0xf890('0x11')](_0xf890('0xc'),_0x8b8d90,_0x266b64[_0xf890('0x11')][_0xf890('0x13')]);return _0x445f46(_0x266b64[_0xf890('0x11')][_0xf890('0x13')]);}logger[_0xf890('0x11')](_0xf890('0xc'),_0x8b8d90,_0x266b64['error']['message']);return _0x25b0b4(_0x266b64['error']['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x8b8d90,'request\x20sent');_0x25b0b4(_0x266b64[_0xf890('0x14')][_0xf890('0x13')]);}})[_0xf890('0x15')](function(_0x34facf){logger[_0xf890('0x11')](_0xf890('0xc'),_0x8b8d90,_0x34facf);_0x445f46(_0x34facf);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 635dc61..3526dff 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 _0xa9a5=['join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','addLogo','single','file','preferred','addPreferred','addFavicon','put','update','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa9a5,0x1d9));var _0x5a9a=function(_0x15ae4a,_0x3db5fa){_0x15ae4a=_0x15ae4a-0x0;var _0x25aa72=_0xa9a5[_0x15ae4a];return _0x25aa72;};'use strict';var multer=require(_0x5a9a('0x0'));var util=require(_0x5a9a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a9a('0x2'));var router=express['Router']();var fs_extra=require(_0x5a9a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5a9a('0x4'));var config=require(_0x5a9a('0x5'));var controller=require(_0x5a9a('0x6'));router[_0x5a9a('0x7')]('/',auth[_0x5a9a('0x8')](),controller['index']);router['get'](_0x5a9a('0x9'),controller[_0x5a9a('0xa')]);router[_0x5a9a('0x7')]('/:id',controller['show']);router[_0x5a9a('0x7')](_0x5a9a('0xb'),controller[_0x5a9a('0xc')]);router[_0x5a9a('0x7')](_0x5a9a('0xd'),controller[_0x5a9a('0xe')]);router['get']('/:id/gdpr',controller[_0x5a9a('0xf')]);router[_0x5a9a('0x7')](_0x5a9a('0x10'),controller[_0x5a9a('0x11')]);router['get'](_0x5a9a('0x12'),controller[_0x5a9a('0x13')]);var upload=multer({'storage':multer[_0x5a9a('0x14')]({'destination':function(_0x236aeb,_0x392df6,_0xeec1e8){_0xeec1e8(null,path[_0x5a9a('0x15')](config[_0x5a9a('0x16')],_0x5a9a('0x17')));},'filename':function(_0x45887a,_0x19e881,_0x56d60d){_0x56d60d(null,util[_0x5a9a('0x18')](_0x5a9a('0x19'),_0x5a9a('0x1a'),path[_0x5a9a('0x1b')](_0x19e881[_0x5a9a('0x1c')])));}})});router[_0x5a9a('0x1d')](_0x5a9a('0xb'),upload['single']('file'),controller[_0x5a9a('0x1e')]);var upload=multer({'storage':multer[_0x5a9a('0x14')]({'destination':function(_0x4b3a14,_0x200dd3,_0xc32d3a){_0xc32d3a(null,path[_0x5a9a('0x15')](config[_0x5a9a('0x16')],_0x5a9a('0x17')));},'filename':function(_0xa83700,_0x21e0cf,_0xf2e2aa){_0xf2e2aa(null,util[_0x5a9a('0x18')](_0x5a9a('0x19'),'logologin',path[_0x5a9a('0x1b')](_0x21e0cf[_0x5a9a('0x1c')])));}})});router[_0x5a9a('0x1d')]('/:id/logo_login',upload[_0x5a9a('0x1f')](_0x5a9a('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x5a9a('0x14')]({'destination':function(_0x11ad04,_0x4550a6,_0x50ee05){_0x50ee05(null,path['join'](config[_0x5a9a('0x16')],_0x5a9a('0x17')));},'filename':function(_0x357407,_0xe9b71f,_0x59faa3){_0x59faa3(null,util[_0x5a9a('0x18')](_0x5a9a('0x19'),_0x5a9a('0x21'),path[_0x5a9a('0x1b')](_0xe9b71f['originalname'])));}})});router[_0x5a9a('0x1d')](_0x5a9a('0x10'),upload[_0x5a9a('0x1f')]('file'),controller[_0x5a9a('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x424341,_0x2100ec,_0x5dcb30){_0x5dcb30(null,path['join'](config['root'],_0x5a9a('0x17')));},'filename':function(_0x3dc08c,_0x4d3429,_0x62228f){_0x62228f(null,util[_0x5a9a('0x18')](_0x5a9a('0x19'),'favicon',path[_0x5a9a('0x1b')](_0x4d3429[_0x5a9a('0x1c')])));}})});router[_0x5a9a('0x1d')](_0x5a9a('0x12'),upload['single'](_0x5a9a('0x20')),controller[_0x5a9a('0x23')]);router[_0x5a9a('0x24')]('/:id',auth[_0x5a9a('0x8')](),controller[_0x5a9a('0x25')]);module['exports']=router; \ No newline at end of file +var _0x49d6=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','extname','originalname','post','single','file','server/files/images/logos/','logologin','addLogoLogin','addPreferred','favicon','addFavicon','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','getDate','/:id','/:id/logo'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x49d6,0x117));var _0x649d=function(_0x5cb92d,_0x2521e2){_0x5cb92d=_0x5cb92d-0x0;var _0x4c96b9=_0x49d6[_0x5cb92d];return _0x4c96b9;};'use strict';var multer=require(_0x649d('0x0'));var util=require(_0x649d('0x1'));var path=require(_0x649d('0x2'));var timeout=require(_0x649d('0x3'));var express=require(_0x649d('0x4'));var router=express['Router']();var fs_extra=require(_0x649d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x649d('0x6'));var config=require(_0x649d('0x7'));var controller=require(_0x649d('0x8'));router['get']('/',auth[_0x649d('0x9')](),controller[_0x649d('0xa')]);router[_0x649d('0xb')]('/now',controller[_0x649d('0xc')]);router[_0x649d('0xb')](_0x649d('0xd'),controller['show']);router['get'](_0x649d('0xe'),controller[_0x649d('0xf')]);router['get'](_0x649d('0x10'),controller[_0x649d('0x11')]);router[_0x649d('0xb')](_0x649d('0x12'),controller[_0x649d('0x13')]);router[_0x649d('0xb')](_0x649d('0x14'),controller[_0x649d('0x15')]);router[_0x649d('0xb')](_0x649d('0x16'),controller[_0x649d('0x17')]);var upload=multer({'storage':multer[_0x649d('0x18')]({'destination':function(_0x1b919f,_0x21d457,_0x5847a7){_0x5847a7(null,path[_0x649d('0x19')](config[_0x649d('0x1a')],'server/files/images/logos/'));},'filename':function(_0x56083f,_0x392dfe,_0x4db1bb){_0x4db1bb(null,util[_0x649d('0x1b')](_0x649d('0x1c'),'logo',path[_0x649d('0x1d')](_0x392dfe[_0x649d('0x1e')])));}})});router[_0x649d('0x1f')](_0x649d('0xe'),upload[_0x649d('0x20')](_0x649d('0x21')),controller['addLogo']);var upload=multer({'storage':multer[_0x649d('0x18')]({'destination':function(_0x43c0a0,_0x144282,_0x58441f){_0x58441f(null,path[_0x649d('0x19')](config[_0x649d('0x1a')],_0x649d('0x22')));},'filename':function(_0xc1fdbe,_0x1b8fa3,_0xd5df8a){_0xd5df8a(null,util[_0x649d('0x1b')](_0x649d('0x1c'),_0x649d('0x23'),path[_0x649d('0x1d')](_0x1b8fa3[_0x649d('0x1e')])));}})});router[_0x649d('0x1f')](_0x649d('0x10'),upload[_0x649d('0x20')]('file'),controller[_0x649d('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x331cce,_0x34ad83,_0x34e19e){_0x34e19e(null,path['join'](config[_0x649d('0x1a')],_0x649d('0x22')));},'filename':function(_0x282200,_0x2b8d10,_0x4f5ea4){_0x4f5ea4(null,util[_0x649d('0x1b')](_0x649d('0x1c'),'preferred',path[_0x649d('0x1d')](_0x2b8d10[_0x649d('0x1e')])));}})});router['post'](_0x649d('0x14'),upload[_0x649d('0x20')]('file'),controller[_0x649d('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x427c5b,_0x405671,_0x2f98b5){_0x2f98b5(null,path[_0x649d('0x19')](config[_0x649d('0x1a')],'server/files/images/logos/'));},'filename':function(_0x978e82,_0xa52b5b,_0x320242){_0x320242(null,util[_0x649d('0x1b')](_0x649d('0x1c'),_0x649d('0x26'),path[_0x649d('0x1d')](_0xa52b5b['originalname'])));}})});router[_0x649d('0x1f')](_0x649d('0x16'),upload['single'](_0x649d('0x21')),controller[_0x649d('0x27')]);router[_0x649d('0x28')](_0x649d('0xd'),auth[_0x649d('0x9')](),controller['update']);module[_0x649d('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e054ddb..e746ec7 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 _0x184d=['alternate','UNSIGNED','exports','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x337641,_0x26ba45){var _0xcf00de=function(_0x14ca1f){while(--_0x14ca1f){_0x337641['push'](_0x337641['shift']());}};_0xcf00de(++_0x26ba45);}(_0x184d,0x1d0));var _0xd184=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x184d[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require('sequelize');module[_0xd184('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd184('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd184('0x2')],'defaultValue':_0xd184('0x3')},'logo':{'type':Sequelize[_0xd184('0x2')]},'defaultLogo':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd184('0x2')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xd184('0x2')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xd184('0x2')]},'defaultPageTitle':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd184('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd184('0x2')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd184('0x5')},'chatTimeout':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd184('0x2')]},'defaultPreferred':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd184('0x2')]},'defaultFavicon':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd184('0x1')]},'transcribeRegion':{'type':Sequelize[_0xd184('0x2')]},'sentiment':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd184('0x2')]},'bucket':{'type':Sequelize[_0xd184('0x2')]},'googleSsoEnabled':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd184('0x1')](0x2)[_0xd184('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xd184('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xd184('0x1')](0x2)[_0xd184('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd184('0x1')](0x2)[_0xd184('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xd184('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xd184('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xd184('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file +var _0xde1a=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x5f6e07,_0x69ad27){var _0x11b425=function(_0x1374c7){while(--_0x1374c7){_0x5f6e07['push'](_0x5f6e07['shift']());}};_0x11b425(++_0x69ad27);}(_0xde1a,0xfd));var _0xade1=function(_0xc2ceeb,_0x4e70c7){_0xc2ceeb=_0xc2ceeb-0x0;var _0x44197c=_0xde1a[_0xc2ceeb];return _0x44197c;};'use strict';var Sequelize=require('sequelize');module[_0xade1('0x0')]={'min_internal':{'type':Sequelize[_0xade1('0x1')](0xb),'unique':_0xade1('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xade1('0x1')](0xb),'unique':_0xade1('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xade1('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xade1('0x4')],'defaultValue':_0xade1('0x5')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xade1('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xade1('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xade1('0x4')]},'turnaddr':{'type':Sequelize[_0xade1('0x4')]},'turnusername':{'type':Sequelize[_0xade1('0x4')]},'turnpassword':{'type':Sequelize[_0xade1('0x4')]},'pageTitle':{'type':Sequelize[_0xade1('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xade1('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xade1('0x4')],'defaultValue':_0xade1('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xade1('0x4')],'defaultValue':_0xade1('0x8')},'chatTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xade1('0x4')]},'defaultPreferred':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xade1('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xade1('0x4')]},'defaultFavicon':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xade1('0x1')]},'transcribeRegion':{'type':Sequelize[_0xade1('0x4')]},'sentiment':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xade1('0x1')]},'sentimentRegion':{'type':Sequelize[_0xade1('0x4')]},'language':{'type':Sequelize[_0xade1('0x4')]},'bucket':{'type':Sequelize[_0xade1('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xade1('0x1')](0x2)[_0xade1('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xade1('0x1')](0x2)[_0xade1('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xade1('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xade1('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xade1('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xade1('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xade1('0x1')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f208240..dc273be 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 _0xb223=['options','includeAll','rows','catch','find','body','params','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','default','existsSync','Sequelize','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','ValidationError','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge'];(function(_0x24655b,_0x347615){var _0x3b0ee0=function(_0x57c537){while(--_0x57c537){_0x24655b['push'](_0x24655b['shift']());}};_0x3b0ee0(++_0x347615);}(_0xb223,0x194));var _0x3b22=function(_0x81696c,_0x57ce72){_0x81696c=_0x81696c-0x0;var _0x2f7233=_0xb223[_0x81696c];return _0x2f7233;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b22('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b22('0x1'));var moment=require(_0x3b22('0x2'));var BPromise=require(_0x3b22('0x3'));var Mustache=require(_0x3b22('0x4'));var util=require(_0x3b22('0x5'));var path=require('path');var sox=require(_0x3b22('0x6'));var csv=require(_0x3b22('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b22('0x8'));var _=require(_0x3b22('0x9'));var squel=require(_0x3b22('0xa'));var crypto=require(_0x3b22('0xb'));var jsforce=require(_0x3b22('0xc'));var deskjs=require(_0x3b22('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3b22('0xe'));var Papa=require(_0x3b22('0xf'));var Redis=require(_0x3b22('0x10'));var authService=require(_0x3b22('0x11'));var qs=require(_0x3b22('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b22('0x13'));var utils=require(_0x3b22('0x14'));var config=require(_0x3b22('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b22('0x16'))['db'];var jayson=require(_0x3b22('0x17'));var client=jayson[_0x3b22('0x18')][_0x3b22('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x58e2c0,_0x4ea4a1,_0x273c50,_0x7a4f85){return new BPromise(function(_0x185aba,_0x3495b9){var _0x4501be=_0x7a4f85||client;return _0x4501be['request'](_0x58e2c0,_0x273c50)['then'](function(_0x35ae87){logger[_0x3b22('0x1a')](_0x3b22('0x1b'),_0x4ea4a1,_0x3b22('0x1c'));logger[_0x3b22('0x1d')](_0x3b22('0x1e'),_0x4ea4a1,_0x3b22('0x1c'),JSON['stringify'](_0x35ae87));if(_0x35ae87[_0x3b22('0x1f')]){if(_0x35ae87[_0x3b22('0x1f')]['code']===0x1f4){logger[_0x3b22('0x1f')](_0x3b22('0x1b'),_0x4ea4a1,_0x35ae87[_0x3b22('0x1f')]['message']);return _0x3495b9(_0x35ae87[_0x3b22('0x1f')][_0x3b22('0x20')]);}logger['error'](_0x3b22('0x1b'),_0x4ea4a1,_0x35ae87[_0x3b22('0x1f')][_0x3b22('0x20')]);return _0x185aba(_0x35ae87[_0x3b22('0x1f')]['message']);}else{logger['info'](_0x3b22('0x1b'),_0x4ea4a1,_0x3b22('0x1c'));_0x185aba(_0x35ae87[_0x3b22('0x21')][_0x3b22('0x20')]);}})['catch'](function(_0x32e767){logger[_0x3b22('0x1f')](_0x3b22('0x1b'),_0x4ea4a1,_0x32e767);_0x3495b9(_0x32e767);});});}function respondWithStatusCode(_0x2a3bff,_0x4e0c86){_0x4e0c86=_0x4e0c86||0xcc;return function(_0x28a284){if(_0x28a284){return _0x2a3bff[_0x3b22('0x22')](_0x4e0c86);}return _0x2a3bff[_0x3b22('0x23')](_0x4e0c86)[_0x3b22('0x24')]();};}function respondWithResult(_0x53d9c6,_0x30a949){_0x30a949=_0x30a949||0xc8;return function(_0x1ac4e8){if(_0x1ac4e8){return _0x53d9c6[_0x3b22('0x23')](_0x30a949)[_0x3b22('0x25')](_0x1ac4e8);}};}function respondWithFilteredResult(_0x4bd052,_0x2705f0){return function(_0x3b87de){if(_0x3b87de){var _0x151410=typeof _0x2705f0[_0x3b22('0x26')]===_0x3b22('0x27')&&typeof _0x2705f0[_0x3b22('0x28')]===_0x3b22('0x27');var _0x377d74=_0x3b87de[_0x3b22('0x29')];var _0x17260d=_0x151410?0x0:_0x2705f0[_0x3b22('0x26')];var _0x21aaaf=_0x151410?_0x3b87de[_0x3b22('0x29')]:_0x2705f0['offset']+_0x2705f0[_0x3b22('0x28')];var _0x40a6d3;if(_0x21aaaf>=_0x377d74){_0x21aaaf=_0x377d74;_0x40a6d3=0xc8;}else{_0x40a6d3=0xce;}_0x4bd052[_0x3b22('0x23')](_0x40a6d3);return _0x4bd052['set'](_0x3b22('0x2a'),_0x17260d+'-'+_0x21aaaf+'/'+_0x377d74)['json'](_0x3b87de);}return null;};}function patchUpdates(_0x3775ea){return function(_0x72a0c1){try{jsonpatch[_0x3b22('0x2b')](_0x72a0c1,_0x3775ea,!![]);}catch(_0x4e509b){return BPromise[_0x3b22('0x2c')](_0x4e509b);}return _0x72a0c1['save']();};}function saveUpdates(_0x4d370f,_0x43d051){return function(_0x129dca){if(_0x129dca){return _0x129dca[_0x3b22('0x2d')](_0x4d370f)[_0x3b22('0x2e')](function(_0x33ae05){return _0x33ae05;});}return null;};}function removeEntity(_0x3101cb,_0x353554){return function(_0x23cef4){if(_0x23cef4){return _0x23cef4[_0x3b22('0x2f')]()[_0x3b22('0x2e')](function(){_0x3101cb['status'](0xcc)[_0x3b22('0x24')]();});}};}function handleEntityNotFound(_0x342e3f,_0xac56ee){return function(_0x4a919f){if(!_0x4a919f){_0x342e3f[_0x3b22('0x22')](0x194);}return _0x4a919f;};}function handleError(_0x14600f,_0x26d70a){_0x26d70a=_0x26d70a||0x1f4;return function(_0x2a129f){logger['error'](_0x2a129f[_0x3b22('0x30')]);if(_0x2a129f[_0x3b22('0x31')]){delete _0x2a129f[_0x3b22('0x31')];}_0x14600f[_0x3b22('0x23')](_0x26d70a)[_0x3b22('0x32')](_0x2a129f);};}exports[_0x3b22('0x33')]=function(_0x5a7fc4,_0x218147){var _0x281c5c={},_0x2d6a61={},_0x56dde3={'count':0x0,'rows':[]};var _0x382f3a=_[_0x3b22('0x34')](db[_0x3b22('0x35')][_0x3b22('0x36')],function(_0x429864){return{'name':_0x429864[_0x3b22('0x37')],'type':_0x429864[_0x3b22('0x38')][_0x3b22('0x39')]};});_0x2d6a61[_0x3b22('0x3a')]=_[_0x3b22('0x34')](_0x382f3a,_0x3b22('0x31'));_0x2d6a61[_0x3b22('0x3b')]=_[_0x3b22('0x3c')](_0x5a7fc4[_0x3b22('0x3b')]);_0x2d6a61[_0x3b22('0x3d')]=_[_0x3b22('0x3e')](_0x2d6a61[_0x3b22('0x3a')],_0x2d6a61[_0x3b22('0x3b')]);_0x281c5c[_0x3b22('0x3f')]=_[_0x3b22('0x3e')](_0x2d6a61[_0x3b22('0x3a')],qs[_0x3b22('0x40')](_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x40')]));_0x281c5c[_0x3b22('0x3f')]=_0x281c5c[_0x3b22('0x3f')][_0x3b22('0x41')]?_0x281c5c['attributes']:_0x2d6a61['model'];if(!_0x5a7fc4[_0x3b22('0x3b')]['hasOwnProperty']('nolimit')){_0x281c5c[_0x3b22('0x28')]=qs[_0x3b22('0x28')](_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x28')]);_0x281c5c[_0x3b22('0x26')]=qs[_0x3b22('0x26')](_0x5a7fc4['query'][_0x3b22('0x26')]);}_0x281c5c[_0x3b22('0x42')]=qs['sort'](_0x5a7fc4[_0x3b22('0x3b')]['sort']);_0x281c5c[_0x3b22('0x43')]=qs['filters'](_[_0x3b22('0x44')](_0x5a7fc4[_0x3b22('0x3b')],_0x2d6a61['filters']),_0x382f3a);if(_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x45')]){_0x281c5c[_0x3b22('0x43')]=_['merge'](_0x281c5c[_0x3b22('0x43')],{'$or':_['map'](_0x382f3a,function(_0x410d6d){if(_0x410d6d['type']!==_0x3b22('0x46')){var _0x21549f={};_0x21549f[_0x410d6d['name']]={'$like':'%'+_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x45')]+'%'};return _0x21549f;}})});}_0x281c5c=_[_0x3b22('0x47')]({},_0x281c5c,_0x5a7fc4[_0x3b22('0x48')]);var _0xffff1={'where':_0x281c5c[_0x3b22('0x43')]};return db[_0x3b22('0x35')][_0x3b22('0x29')](_0xffff1)[_0x3b22('0x2e')](function(_0x1aeb00){_0x56dde3[_0x3b22('0x29')]=_0x1aeb00;if(_0x5a7fc4[_0x3b22('0x3b')][_0x3b22('0x49')]){_0x281c5c['include']=[{'all':!![]}];}return db[_0x3b22('0x35')]['findAll'](_0x281c5c);})['then'](function(_0xcf11b8){_0x56dde3[_0x3b22('0x4a')]=_0xcf11b8;return _0x56dde3;})['then'](respondWithFilteredResult(_0x218147,_0x281c5c))[_0x3b22('0x4b')](handleError(_0x218147,null));};exports['show']=function(_0x51a618,_0x503df6){var _0x45c4fb={'raw':![],'where':{'id':_0x51a618['params']['id']}},_0x55e02a={};_0x55e02a[_0x3b22('0x3a')]=_[_0x3b22('0x3c')](db[_0x3b22('0x35')][_0x3b22('0x36')]);_0x55e02a['query']=_[_0x3b22('0x3c')](_0x51a618[_0x3b22('0x3b')]);_0x55e02a['filters']=_[_0x3b22('0x3e')](_0x55e02a['model'],_0x55e02a[_0x3b22('0x3b')]);_0x45c4fb[_0x3b22('0x3f')]=_['intersection'](_0x55e02a[_0x3b22('0x3a')],qs[_0x3b22('0x40')](_0x51a618[_0x3b22('0x3b')][_0x3b22('0x40')]));_0x45c4fb['attributes']=_0x45c4fb[_0x3b22('0x3f')][_0x3b22('0x41')]?_0x45c4fb[_0x3b22('0x3f')]:_0x55e02a[_0x3b22('0x3a')];if(_0x51a618['query'][_0x3b22('0x49')]){_0x45c4fb['include']=[{'all':!![]}];}_0x45c4fb=_[_0x3b22('0x47')]({},_0x45c4fb,_0x51a618[_0x3b22('0x48')]);return db[_0x3b22('0x35')][_0x3b22('0x4c')](_0x45c4fb)['then'](handleEntityNotFound(_0x503df6,null))[_0x3b22('0x2e')](respondWithResult(_0x503df6,null))[_0x3b22('0x4b')](handleError(_0x503df6,null));};exports[_0x3b22('0x2d')]=function(_0x20a5c3,_0xbb15f2){if(_0x20a5c3[_0x3b22('0x4d')]['id']){delete _0x20a5c3[_0x3b22('0x4d')]['id'];}return db['Setting']['find']({'where':{'id':_0x20a5c3[_0x3b22('0x4e')]['id']}})['then'](handleEntityNotFound(_0xbb15f2,null))[_0x3b22('0x2e')](saveUpdates(_0x20a5c3['body'],null))[_0x3b22('0x2e')](respondWithResult(_0xbb15f2,null))[_0x3b22('0x4b')](handleError(_0xbb15f2,null));};exports['addLogo']=function(_0x3f5e9e,_0x30615e,_0x15c788){if(_0x3f5e9e[_0x3b22('0x4f')]&&_0x3f5e9e['file'][_0x3b22('0x50')]){_0x3f5e9e[_0x3b22('0x4d')]['logo']=_0x3f5e9e[_0x3b22('0x4f')][_0x3b22('0x50')];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x3f5e9e[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x30615e,null))['then'](saveUpdates(_0x3f5e9e[_0x3b22('0x4d')],null))[_0x3b22('0x2e')](respondWithResult(_0x30615e,null))[_0x3b22('0x4b')](handleError(_0x30615e,null));};exports[_0x3b22('0x51')]=function(_0x1d381c,_0x3cbc3a,_0x3b0fd3){if(_0x1d381c[_0x3b22('0x4f')]&&_0x1d381c['file']['filename']){_0x1d381c[_0x3b22('0x4d')][_0x3b22('0x52')]=_0x1d381c[_0x3b22('0x4f')][_0x3b22('0x50')];}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x1d381c[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x3cbc3a,null))['then'](saveUpdates(_0x1d381c[_0x3b22('0x4d')],null))[_0x3b22('0x2e')](respondWithResult(_0x3cbc3a,null))['catch'](handleError(_0x3cbc3a,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x54')]=function(_0x4ae2bf,_0x11ce75,_0x2de5d6){var _0x2cc01c='server/files/images/logos';var _0x490392={'custom':![]};return utilLicense[_0x3b22('0x55')]()[_0x3b22('0x2e')](function(_0x20cf72){if(_0x20cf72){_0x490392=_0x20cf72;}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x4ae2bf[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x56'),'loginLogo',_0x3b22('0x57'),_0x3b22('0x58'),'defaultLogo',_0x3b22('0x59'),_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x11ce75,null))[_0x3b22('0x2e')](function(_0x417958){if(_0x417958){var _0xe331f9=_0x417958[_0x3b22('0x56')]&&fs['existsSync'](path['join'](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')](_0x417958[_0x3b22('0x56')])))?path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x2cc01c,_['toLower'](_0x417958[_0x3b22('0x56')])):path['join'](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')](_0x3b22('0x5f')));var _0x4c8414=_0x3b22('0x60')+_['upperFirst'](_0x3b22('0x56'));if(_0x417958[_0x4c8414]||!_0x490392['custom']){_0xe331f9=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x2cc01c,_[_0x3b22('0x5d')]('default_logo.svg'));}if(!fs[_0x3b22('0x61')](_0xe331f9)){throw new db[(_0x3b22('0x62'))]['ValidationError'](_[_0x3b22('0x63')](_0x3b22('0x56'))+_0x3b22('0x64'));}return _0x11ce75[_0x3b22('0x65')](_0xe331f9);}})[_0x3b22('0x4b')](handleError(_0x11ce75,null));};var utilLicense=require('../../config/license/util');exports[_0x3b22('0x66')]=function(_0x236964,_0x4476df,_0x65f98f){var _0x53ee5=_0x3b22('0x67');var _0x7f06d8={'custom':![]};return utilLicense[_0x3b22('0x55')]()[_0x3b22('0x2e')](function(_0x221c52){if(_0x221c52){_0x7f06d8=_0x221c52;}return db['Setting'][_0x3b22('0x4c')]({'where':{'id':_0x236964['params']['id']},'attributes':['logo',_0x3b22('0x52'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})[_0x3b22('0x2e')](handleEntityNotFound(_0x4476df,null))[_0x3b22('0x2e')](function(_0x28fbff){if(_0x28fbff){var _0x317164=_0x28fbff[_0x3b22('0x52')]&&fs['existsSync'](path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x28fbff[_0x3b22('0x52')])))?path['join'](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x28fbff['loginLogo'])):path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x3b22('0x68')));var _0x4ffb90=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x52'));if(_0x28fbff[_0x4ffb90]||!_0x7f06d8[_0x3b22('0x69')]){_0x317164=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x53ee5,_[_0x3b22('0x5d')](_0x3b22('0x68')));}if(!fs['existsSync'](_0x317164)){throw new db[(_0x3b22('0x62'))][(_0x3b22('0x6a'))](_['upperFirst']('loginLogo')+_0x3b22('0x64'));}return _0x4476df[_0x3b22('0x65')](_0x317164);}})[_0x3b22('0x4b')](handleError(_0x4476df,null));};exports['gdpr']=function(_0x32d6dd,_0x53475a){return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x32d6dd[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x6b')]})[_0x3b22('0x2e')](respondWithResult(_0x53475a,null))['catch'](handleError(_0x53475a,null));};exports[_0x3b22('0x6c')]=function(_0xb660f7,_0x1025fd,_0x2f1355){if(_0xb660f7[_0x3b22('0x4f')]&&_0xb660f7[_0x3b22('0x4f')]['filename']){_0xb660f7['body'][_0x3b22('0x57')]=_0xb660f7['file'][_0x3b22('0x50')];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0xb660f7[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x1025fd,null))[_0x3b22('0x2e')](saveUpdates(_0xb660f7[_0x3b22('0x4d')],null))['then'](respondWithResult(_0x1025fd,null))[_0x3b22('0x4b')](handleError(_0x1025fd,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x6d')]=function(_0xb534e9,_0x539192,_0x403938){var _0x5462b3=_0x3b22('0x67');var _0x1f22e6={'custom':![]};return utilLicense['getLicense']()[_0x3b22('0x2e')](function(_0x4ecaca){if(_0x4ecaca){_0x1f22e6=_0x4ecaca;}return db[_0x3b22('0x35')]['find']({'where':{'id':_0xb534e9[_0x3b22('0x4e')]['id']},'attributes':['logo','loginLogo',_0x3b22('0x57'),_0x3b22('0x58'),_0x3b22('0x6e'),'defaultLoginLogo',_0x3b22('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x539192,null))[_0x3b22('0x2e')](function(_0x19eb92){if(_0x19eb92){var _0x56796b=_0x19eb92[_0x3b22('0x57')]&&fs[_0x3b22('0x61')](path['join'](config['root'],_0x5462b3,_[_0x3b22('0x5d')](_0x19eb92[_0x3b22('0x57')])))?path['join'](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x19eb92['preferred'])):path['join'](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x3b22('0x6f')));var _0x2d4313=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x57'));if(_0x19eb92[_0x2d4313]||!_0x1f22e6[_0x3b22('0x69')]||!_0x1f22e6['preferred']){_0x56796b=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x5462b3,_[_0x3b22('0x5d')](_0x3b22('0x6f')));}if(!fs['existsSync'](_0x56796b)){throw new db['Sequelize'][(_0x3b22('0x6a'))](_[_0x3b22('0x63')]('preferred')+_0x3b22('0x64'));}return _0x539192[_0x3b22('0x65')](_0x56796b);}})[_0x3b22('0x4b')](handleError(_0x539192,null));};exports[_0x3b22('0x70')]=function(_0x33d4dd,_0x386b89,_0x2c5231){if(_0x33d4dd[_0x3b22('0x4f')]&&_0x33d4dd[_0x3b22('0x4f')]['filename']){_0x33d4dd[_0x3b22('0x4d')][_0x3b22('0x58')]=_0x33d4dd[_0x3b22('0x4f')]['filename'];}return db[_0x3b22('0x35')][_0x3b22('0x4c')]({'where':{'id':_0x33d4dd[_0x3b22('0x4e')]['id']}})[_0x3b22('0x2e')](handleEntityNotFound(_0x386b89,null))[_0x3b22('0x2e')](saveUpdates(_0x33d4dd['body'],null))[_0x3b22('0x2e')](respondWithResult(_0x386b89,null))[_0x3b22('0x4b')](handleError(_0x386b89,null));};var utilLicense=require(_0x3b22('0x53'));exports[_0x3b22('0x71')]=function(_0x351ee4,_0x3812e7,_0x4ccf59){var _0x1f5241=_0x3b22('0x67');var _0x5bc3d8={'custom':![]};return utilLicense['getLicense']()[_0x3b22('0x2e')](function(_0x3c35a8){if(_0x3c35a8){_0x5bc3d8=_0x3c35a8;}return db[_0x3b22('0x35')]['find']({'where':{'id':_0x351ee4[_0x3b22('0x4e')]['id']},'attributes':[_0x3b22('0x56'),_0x3b22('0x52'),_0x3b22('0x57'),_0x3b22('0x58'),_0x3b22('0x6e'),_0x3b22('0x59'),_0x3b22('0x5a'),_0x3b22('0x5b')],'raw':!![]});})[_0x3b22('0x2e')](handleEntityNotFound(_0x3812e7,null))[_0x3b22('0x2e')](function(_0x57879a){if(_0x57879a){var _0x4122eb=_0x57879a[_0x3b22('0x58')]&&fs[_0x3b22('0x61')](path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_[_0x3b22('0x5d')](_0x57879a['favicon'])))?path['join'](config['root'],_0x1f5241,_['toLower'](_0x57879a[_0x3b22('0x58')])):path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_['toLower'](_0x3b22('0x72')));var _0x405c70=_0x3b22('0x60')+_[_0x3b22('0x63')](_0x3b22('0x58'));if(_0x57879a[_0x405c70]||!_0x5bc3d8[_0x3b22('0x69')]){_0x4122eb=path[_0x3b22('0x5e')](config[_0x3b22('0x5c')],_0x1f5241,_[_0x3b22('0x5d')](_0x3b22('0x72')));}if(!fs[_0x3b22('0x61')](_0x4122eb)){throw new db[(_0x3b22('0x62'))][(_0x3b22('0x6a'))](_[_0x3b22('0x63')](_0x3b22('0x58'))+'\x20not\x20found');}return _0x3812e7[_0x3b22('0x65')](_0x4122eb);}})['catch'](handleError(_0x3812e7,null));};exports['getDate']=function(_0x185562,_0x37b9bc){var _0x3a98db={'offset':moment()[_0x3b22('0x73')]()};_0x3a98db[_0x3b22('0x74')]=moment()[_0x3b22('0x73')](_0x3a98db[_0x3b22('0x26')])[_0x3b22('0x75')](_0x3b22('0x76'));return _0x37b9bc[_0x3b22('0x23')](0xc8)[_0x3b22('0x32')](_0x3a98db);}; \ No newline at end of file +var _0x6e80=['code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','name','send','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','map','filter','options','Setting','includeAll','include','findAll','rows','show','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','getLogoLogin','server/files/images/logos','defaultPreferred','default_loginLogo.svg','custom','download','gdpr','securePassword','preferred','getPreferred','getLicense','default_preferred.png','Sequelize','ValidationError','\x20not\x20found','addFavicon','getFavicon','defaultFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2abc68,_0x2220c0){var _0x1e75ee=function(_0x47cd4b){while(--_0x47cd4b){_0x2abc68['push'](_0x2abc68['shift']());}};_0x1e75ee(++_0x2220c0);}(_0x6e80,0x1cd));var _0x06e8=function(_0x262c3d,_0x16e6e8){_0x262c3d=_0x262c3d-0x0;var _0x2ee224=_0x6e80[_0x262c3d];return _0x2ee224;};'use strict';var emlformat=require(_0x06e8('0x0'));var rimraf=require(_0x06e8('0x1'));var zipdir=require(_0x06e8('0x2'));var jsonpatch=require(_0x06e8('0x3'));var rp=require(_0x06e8('0x4'));var moment=require('moment');var BPromise=require(_0x06e8('0x5'));var Mustache=require(_0x06e8('0x6'));var util=require(_0x06e8('0x7'));var path=require('path');var sox=require(_0x06e8('0x8'));var csv=require(_0x06e8('0x9'));var ejs=require(_0x06e8('0xa'));var fs=require('fs');var fs_extra=require(_0x06e8('0xb'));var _=require(_0x06e8('0xc'));var squel=require(_0x06e8('0xd'));var crypto=require(_0x06e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x06e8('0xf'));var toCsv=require(_0x06e8('0x9'));var querystring=require(_0x06e8('0x10'));var Papa=require(_0x06e8('0x11'));var Redis=require('ioredis');var authService=require(_0x06e8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x06e8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06e8('0x14'))(_0x06e8('0x15'));var utils=require(_0x06e8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x06e8('0x17'));var db=require(_0x06e8('0x18'))['db'];var jayson=require(_0x06e8('0x19'));var client=jayson[_0x06e8('0x1a')][_0x06e8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x6f0dd1,_0x49d548,_0x15e4a9,_0x2d0999){return new BPromise(function(_0x374928,_0xbd3983){var _0x1097c0=_0x2d0999||client;return _0x1097c0['request'](_0x6f0dd1,_0x15e4a9)[_0x06e8('0x1c')](function(_0x2d33c3){logger[_0x06e8('0x1d')]('Setting,\x20%s,\x20%s',_0x49d548,_0x06e8('0x1e'));logger[_0x06e8('0x1f')](_0x06e8('0x20'),_0x49d548,_0x06e8('0x1e'),JSON[_0x06e8('0x21')](_0x2d33c3));if(_0x2d33c3[_0x06e8('0x22')]){if(_0x2d33c3[_0x06e8('0x22')][_0x06e8('0x23')]===0x1f4){logger[_0x06e8('0x22')](_0x06e8('0x24'),_0x49d548,_0x2d33c3[_0x06e8('0x22')]['message']);return _0xbd3983(_0x2d33c3['error'][_0x06e8('0x25')]);}logger[_0x06e8('0x22')](_0x06e8('0x24'),_0x49d548,_0x2d33c3[_0x06e8('0x22')]['message']);return _0x374928(_0x2d33c3[_0x06e8('0x22')][_0x06e8('0x25')]);}else{logger[_0x06e8('0x1d')](_0x06e8('0x24'),_0x49d548,_0x06e8('0x1e'));_0x374928(_0x2d33c3[_0x06e8('0x26')][_0x06e8('0x25')]);}})[_0x06e8('0x27')](function(_0x4bb51d){logger[_0x06e8('0x22')](_0x06e8('0x24'),_0x49d548,_0x4bb51d);_0xbd3983(_0x4bb51d);});});}function respondWithStatusCode(_0x5aab8a,_0x3c0a30){_0x3c0a30=_0x3c0a30||0xcc;return function(_0x1fe148){if(_0x1fe148){return _0x5aab8a[_0x06e8('0x28')](_0x3c0a30);}return _0x5aab8a[_0x06e8('0x29')](_0x3c0a30)[_0x06e8('0x2a')]();};}function respondWithResult(_0x3ebb0d,_0x2864bf){_0x2864bf=_0x2864bf||0xc8;return function(_0x4a0500){if(_0x4a0500){return _0x3ebb0d['status'](_0x2864bf)[_0x06e8('0x2b')](_0x4a0500);}};}function respondWithFilteredResult(_0x80b4ab,_0x2ddd5e){return function(_0x2dcab1){if(_0x2dcab1){var _0x3c4cef=typeof _0x2ddd5e['offset']===_0x06e8('0x2c')&&typeof _0x2ddd5e[_0x06e8('0x2d')]==='undefined';var _0x13506b=_0x2dcab1[_0x06e8('0x2e')];var _0x5adc1f=_0x3c4cef?0x0:_0x2ddd5e[_0x06e8('0x2f')];var _0x39a6bd=_0x3c4cef?_0x2dcab1['count']:_0x2ddd5e['offset']+_0x2ddd5e['limit'];var _0x438d24;if(_0x39a6bd>=_0x13506b){_0x39a6bd=_0x13506b;_0x438d24=0xc8;}else{_0x438d24=0xce;}_0x80b4ab['status'](_0x438d24);return _0x80b4ab['set'](_0x06e8('0x30'),_0x5adc1f+'-'+_0x39a6bd+'/'+_0x13506b)[_0x06e8('0x2b')](_0x2dcab1);}return null;};}function patchUpdates(_0x308743){return function(_0x255681){try{jsonpatch['apply'](_0x255681,_0x308743,!![]);}catch(_0x3b44aa){return BPromise[_0x06e8('0x31')](_0x3b44aa);}return _0x255681['save']();};}function saveUpdates(_0x588ffc,_0x4e3ba4){return function(_0x49d30a){if(_0x49d30a){return _0x49d30a[_0x06e8('0x32')](_0x588ffc)[_0x06e8('0x1c')](function(_0x262a65){return _0x262a65;});}return null;};}function removeEntity(_0x1ba1a8,_0x1273e7){return function(_0x4c7e7c){if(_0x4c7e7c){return _0x4c7e7c[_0x06e8('0x33')]()[_0x06e8('0x1c')](function(){_0x1ba1a8['status'](0xcc)[_0x06e8('0x2a')]();});}};}function handleEntityNotFound(_0x22f7e1,_0x2b56a3){return function(_0x4d848d){if(!_0x4d848d){_0x22f7e1[_0x06e8('0x28')](0x194);}return _0x4d848d;};}function handleError(_0x28da21,_0x37bf33){_0x37bf33=_0x37bf33||0x1f4;return function(_0x52e8f1){logger['error'](_0x52e8f1['stack']);if(_0x52e8f1['name']){delete _0x52e8f1[_0x06e8('0x34')];}_0x28da21[_0x06e8('0x29')](_0x37bf33)[_0x06e8('0x35')](_0x52e8f1);};}exports[_0x06e8('0x36')]=function(_0x20c7cd,_0x53c720){var _0x182327={},_0x5c3b65={},_0x13e4c7={'count':0x0,'rows':[]};var _0x5ee758=_['map'](db['Setting'][_0x06e8('0x37')],function(_0x4b9935){return{'name':_0x4b9935[_0x06e8('0x38')],'type':_0x4b9935[_0x06e8('0x39')][_0x06e8('0x3a')]};});_0x5c3b65[_0x06e8('0x3b')]=_['map'](_0x5ee758,_0x06e8('0x34'));_0x5c3b65[_0x06e8('0x3c')]=_['keys'](_0x20c7cd[_0x06e8('0x3c')]);_0x5c3b65[_0x06e8('0x3d')]=_[_0x06e8('0x3e')](_0x5c3b65[_0x06e8('0x3b')],_0x5c3b65['query']);_0x182327['attributes']=_['intersection'](_0x5c3b65[_0x06e8('0x3b')],qs[_0x06e8('0x3f')](_0x20c7cd[_0x06e8('0x3c')][_0x06e8('0x3f')]));_0x182327['attributes']=_0x182327[_0x06e8('0x40')][_0x06e8('0x41')]?_0x182327[_0x06e8('0x40')]:_0x5c3b65[_0x06e8('0x3b')];if(!_0x20c7cd[_0x06e8('0x3c')]['hasOwnProperty'](_0x06e8('0x42'))){_0x182327[_0x06e8('0x2d')]=qs[_0x06e8('0x2d')](_0x20c7cd[_0x06e8('0x3c')]['limit']);_0x182327[_0x06e8('0x2f')]=qs[_0x06e8('0x2f')](_0x20c7cd[_0x06e8('0x3c')]['offset']);}_0x182327['order']=qs[_0x06e8('0x43')](_0x20c7cd[_0x06e8('0x3c')][_0x06e8('0x43')]);_0x182327[_0x06e8('0x44')]=qs[_0x06e8('0x3d')](_[_0x06e8('0x45')](_0x20c7cd[_0x06e8('0x3c')],_0x5c3b65[_0x06e8('0x3d')]),_0x5ee758);if(_0x20c7cd[_0x06e8('0x3c')]['filter']){_0x182327[_0x06e8('0x44')]=_[_0x06e8('0x46')](_0x182327[_0x06e8('0x44')],{'$or':_[_0x06e8('0x47')](_0x5ee758,function(_0x2f6b0d){if(_0x2f6b0d[_0x06e8('0x39')]!=='VIRTUAL'){var _0x28ff6c={};_0x28ff6c[_0x2f6b0d[_0x06e8('0x34')]]={'$like':'%'+_0x20c7cd['query'][_0x06e8('0x48')]+'%'};return _0x28ff6c;}})});}_0x182327=_['merge']({},_0x182327,_0x20c7cd[_0x06e8('0x49')]);var _0x59212f={'where':_0x182327[_0x06e8('0x44')]};return db[_0x06e8('0x4a')]['count'](_0x59212f)[_0x06e8('0x1c')](function(_0x4199fa){_0x13e4c7['count']=_0x4199fa;if(_0x20c7cd['query'][_0x06e8('0x4b')]){_0x182327[_0x06e8('0x4c')]=[{'all':!![]}];}return db['Setting'][_0x06e8('0x4d')](_0x182327);})[_0x06e8('0x1c')](function(_0x5f2b7f){_0x13e4c7[_0x06e8('0x4e')]=_0x5f2b7f;return _0x13e4c7;})[_0x06e8('0x1c')](respondWithFilteredResult(_0x53c720,_0x182327))['catch'](handleError(_0x53c720,null));};exports[_0x06e8('0x4f')]=function(_0x9abf92,_0x270ece){var _0x1d894e={'raw':![],'where':{'id':_0x9abf92[_0x06e8('0x50')]['id']}},_0x481c48={};_0x481c48['model']=_[_0x06e8('0x51')](db[_0x06e8('0x4a')][_0x06e8('0x37')]);_0x481c48[_0x06e8('0x3c')]=_['keys'](_0x9abf92[_0x06e8('0x3c')]);_0x481c48[_0x06e8('0x3d')]=_['intersection'](_0x481c48[_0x06e8('0x3b')],_0x481c48[_0x06e8('0x3c')]);_0x1d894e[_0x06e8('0x40')]=_[_0x06e8('0x3e')](_0x481c48['model'],qs[_0x06e8('0x3f')](_0x9abf92[_0x06e8('0x3c')]['fields']));_0x1d894e[_0x06e8('0x40')]=_0x1d894e[_0x06e8('0x40')][_0x06e8('0x41')]?_0x1d894e[_0x06e8('0x40')]:_0x481c48[_0x06e8('0x3b')];if(_0x9abf92[_0x06e8('0x3c')][_0x06e8('0x4b')]){_0x1d894e['include']=[{'all':!![]}];}_0x1d894e=_['merge']({},_0x1d894e,_0x9abf92[_0x06e8('0x49')]);return db[_0x06e8('0x4a')][_0x06e8('0x52')](_0x1d894e)[_0x06e8('0x1c')](handleEntityNotFound(_0x270ece,null))[_0x06e8('0x1c')](respondWithResult(_0x270ece,null))[_0x06e8('0x27')](handleError(_0x270ece,null));};exports[_0x06e8('0x32')]=function(_0x22fdd3,_0x28f6e6){if(_0x22fdd3[_0x06e8('0x53')]['id']){delete _0x22fdd3[_0x06e8('0x53')]['id'];}return db['Setting']['find']({'where':{'id':_0x22fdd3[_0x06e8('0x50')]['id']}})[_0x06e8('0x1c')](handleEntityNotFound(_0x28f6e6,null))[_0x06e8('0x1c')](saveUpdates(_0x22fdd3['body'],null))[_0x06e8('0x1c')](respondWithResult(_0x28f6e6,null))['catch'](handleError(_0x28f6e6,null));};exports[_0x06e8('0x54')]=function(_0x1aa39b,_0x2a6bbb,_0x4d12e4){if(_0x1aa39b['file']&&_0x1aa39b[_0x06e8('0x55')][_0x06e8('0x56')]){_0x1aa39b[_0x06e8('0x53')][_0x06e8('0x57')]=_0x1aa39b[_0x06e8('0x55')]['filename'];}return db[_0x06e8('0x4a')][_0x06e8('0x52')]({'where':{'id':_0x1aa39b[_0x06e8('0x50')]['id']}})[_0x06e8('0x1c')](handleEntityNotFound(_0x2a6bbb,null))[_0x06e8('0x1c')](saveUpdates(_0x1aa39b[_0x06e8('0x53')],null))[_0x06e8('0x1c')](respondWithResult(_0x2a6bbb,null))[_0x06e8('0x27')](handleError(_0x2a6bbb,null));};exports[_0x06e8('0x58')]=function(_0x108443,_0x492138,_0x2c808b){if(_0x108443[_0x06e8('0x55')]&&_0x108443[_0x06e8('0x55')][_0x06e8('0x56')]){_0x108443[_0x06e8('0x53')][_0x06e8('0x59')]=_0x108443['file'][_0x06e8('0x56')];}return db[_0x06e8('0x4a')][_0x06e8('0x52')]({'where':{'id':_0x108443[_0x06e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x492138,null))['then'](saveUpdates(_0x108443[_0x06e8('0x53')],null))['then'](respondWithResult(_0x492138,null))[_0x06e8('0x27')](handleError(_0x492138,null));};var utilLicense=require(_0x06e8('0x17'));exports[_0x06e8('0x5a')]=function(_0x14ae13,_0x162e1a,_0x5bef1d){var _0x186f50='server/files/images/logos';var _0x5c507a={'custom':![]};return utilLicense['getLicense']()[_0x06e8('0x1c')](function(_0x570b96){if(_0x570b96){_0x5c507a=_0x570b96;}return db['Setting'][_0x06e8('0x52')]({'where':{'id':_0x14ae13['params']['id']},'attributes':[_0x06e8('0x57'),_0x06e8('0x59'),'preferred',_0x06e8('0x5b'),_0x06e8('0x5c'),_0x06e8('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x06e8('0x1c')](handleEntityNotFound(_0x162e1a,null))[_0x06e8('0x1c')](function(_0x5f4e08){if(_0x5f4e08){var _0x57ee9d=_0x5f4e08['logo']&&fs[_0x06e8('0x5e')](path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x186f50,_[_0x06e8('0x61')](_0x5f4e08[_0x06e8('0x57')])))?path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x186f50,_[_0x06e8('0x61')](_0x5f4e08[_0x06e8('0x57')])):path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x186f50,_[_0x06e8('0x61')](_0x06e8('0x62')));var _0x5cb9ce=_0x06e8('0x63')+_[_0x06e8('0x64')]('logo');if(_0x5f4e08[_0x5cb9ce]||!_0x5c507a['custom']){_0x57ee9d=path[_0x06e8('0x5f')](config['root'],_0x186f50,_[_0x06e8('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0x57ee9d)){throw new db['Sequelize']['ValidationError'](_[_0x06e8('0x64')](_0x06e8('0x57'))+'\x20not\x20found');}return _0x162e1a['download'](_0x57ee9d);}})['catch'](handleError(_0x162e1a,null));};var utilLicense=require(_0x06e8('0x17'));exports[_0x06e8('0x65')]=function(_0x597870,_0x37e15f,_0x2ddc4c){var _0xf59e33=_0x06e8('0x66');var _0x2e2297={'custom':![]};return utilLicense['getLicense']()[_0x06e8('0x1c')](function(_0x28e7e2){if(_0x28e7e2){_0x2e2297=_0x28e7e2;}return db['Setting'][_0x06e8('0x52')]({'where':{'id':_0x597870[_0x06e8('0x50')]['id']},'attributes':[_0x06e8('0x57'),_0x06e8('0x59'),'preferred','favicon',_0x06e8('0x5c'),_0x06e8('0x5d'),_0x06e8('0x67'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x37e15f,null))[_0x06e8('0x1c')](function(_0xcb92){if(_0xcb92){var _0x3d7fd3=_0xcb92[_0x06e8('0x59')]&&fs['existsSync'](path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0xf59e33,_[_0x06e8('0x61')](_0xcb92['loginLogo'])))?path['join'](config[_0x06e8('0x60')],_0xf59e33,_[_0x06e8('0x61')](_0xcb92[_0x06e8('0x59')])):path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0xf59e33,_[_0x06e8('0x61')](_0x06e8('0x68')));var _0x138270=_0x06e8('0x63')+_[_0x06e8('0x64')](_0x06e8('0x59'));if(_0xcb92[_0x138270]||!_0x2e2297[_0x06e8('0x69')]){_0x3d7fd3=path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0xf59e33,_[_0x06e8('0x61')]('default_loginLogo.svg'));}if(!fs[_0x06e8('0x5e')](_0x3d7fd3)){throw new db['Sequelize']['ValidationError'](_[_0x06e8('0x64')]('loginLogo')+'\x20not\x20found');}return _0x37e15f[_0x06e8('0x6a')](_0x3d7fd3);}})[_0x06e8('0x27')](handleError(_0x37e15f,null));};exports[_0x06e8('0x6b')]=function(_0x390325,_0x2fc4b5){return db['Setting']['find']({'where':{'id':_0x390325[_0x06e8('0x50')]['id']},'attributes':[_0x06e8('0x6c')]})['then'](respondWithResult(_0x2fc4b5,null))[_0x06e8('0x27')](handleError(_0x2fc4b5,null));};exports['addPreferred']=function(_0x4ba91e,_0xfe627e,_0x1fa00e){if(_0x4ba91e[_0x06e8('0x55')]&&_0x4ba91e[_0x06e8('0x55')]['filename']){_0x4ba91e[_0x06e8('0x53')][_0x06e8('0x6d')]=_0x4ba91e[_0x06e8('0x55')][_0x06e8('0x56')];}return db[_0x06e8('0x4a')][_0x06e8('0x52')]({'where':{'id':_0x4ba91e[_0x06e8('0x50')]['id']}})[_0x06e8('0x1c')](handleEntityNotFound(_0xfe627e,null))['then'](saveUpdates(_0x4ba91e[_0x06e8('0x53')],null))[_0x06e8('0x1c')](respondWithResult(_0xfe627e,null))[_0x06e8('0x27')](handleError(_0xfe627e,null));};var utilLicense=require(_0x06e8('0x17'));exports[_0x06e8('0x6e')]=function(_0x598bbb,_0x39a25a,_0x4cba90){var _0x3dc83c=_0x06e8('0x66');var _0x3c34a0={'custom':![]};return utilLicense[_0x06e8('0x6f')]()[_0x06e8('0x1c')](function(_0x376d75){if(_0x376d75){_0x3c34a0=_0x376d75;}return db[_0x06e8('0x4a')][_0x06e8('0x52')]({'where':{'id':_0x598bbb[_0x06e8('0x50')]['id']},'attributes':[_0x06e8('0x57'),_0x06e8('0x59'),_0x06e8('0x6d'),_0x06e8('0x5b'),'defaultLogo',_0x06e8('0x5d'),_0x06e8('0x67'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x39a25a,null))[_0x06e8('0x1c')](function(_0x1fc0e3){if(_0x1fc0e3){var _0x34f4ab=_0x1fc0e3[_0x06e8('0x6d')]&&fs['existsSync'](path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x3dc83c,_[_0x06e8('0x61')](_0x1fc0e3[_0x06e8('0x6d')])))?path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x3dc83c,_[_0x06e8('0x61')](_0x1fc0e3['preferred'])):path[_0x06e8('0x5f')](config['root'],_0x3dc83c,_[_0x06e8('0x61')](_0x06e8('0x70')));var _0x46fda0='default'+_[_0x06e8('0x64')](_0x06e8('0x6d'));if(_0x1fc0e3[_0x46fda0]||!_0x3c34a0[_0x06e8('0x69')]||!_0x3c34a0[_0x06e8('0x6d')]){_0x34f4ab=path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x3dc83c,_[_0x06e8('0x61')](_0x06e8('0x70')));}if(!fs[_0x06e8('0x5e')](_0x34f4ab)){throw new db[(_0x06e8('0x71'))][(_0x06e8('0x72'))](_['upperFirst'](_0x06e8('0x6d'))+_0x06e8('0x73'));}return _0x39a25a[_0x06e8('0x6a')](_0x34f4ab);}})[_0x06e8('0x27')](handleError(_0x39a25a,null));};exports[_0x06e8('0x74')]=function(_0x4dba34,_0x2477ea,_0x36bd54){if(_0x4dba34['file']&&_0x4dba34[_0x06e8('0x55')]['filename']){_0x4dba34[_0x06e8('0x53')][_0x06e8('0x5b')]=_0x4dba34[_0x06e8('0x55')][_0x06e8('0x56')];}return db['Setting'][_0x06e8('0x52')]({'where':{'id':_0x4dba34[_0x06e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2477ea,null))[_0x06e8('0x1c')](saveUpdates(_0x4dba34[_0x06e8('0x53')],null))['then'](respondWithResult(_0x2477ea,null))[_0x06e8('0x27')](handleError(_0x2477ea,null));};var utilLicense=require(_0x06e8('0x17'));exports[_0x06e8('0x75')]=function(_0x50e36b,_0x535eb8,_0x56445b){var _0x3990df=_0x06e8('0x66');var _0x3ceba3={'custom':![]};return utilLicense[_0x06e8('0x6f')]()['then'](function(_0x4bc2ef){if(_0x4bc2ef){_0x3ceba3=_0x4bc2ef;}return db[_0x06e8('0x4a')][_0x06e8('0x52')]({'where':{'id':_0x50e36b[_0x06e8('0x50')]['id']},'attributes':['logo',_0x06e8('0x59'),'preferred',_0x06e8('0x5b'),_0x06e8('0x5c'),'defaultLoginLogo','defaultPreferred',_0x06e8('0x76')],'raw':!![]});})[_0x06e8('0x1c')](handleEntityNotFound(_0x535eb8,null))[_0x06e8('0x1c')](function(_0x544335){if(_0x544335){var _0x2c1e5f=_0x544335[_0x06e8('0x5b')]&&fs[_0x06e8('0x5e')](path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x3990df,_[_0x06e8('0x61')](_0x544335[_0x06e8('0x5b')])))?path['join'](config[_0x06e8('0x60')],_0x3990df,_['toLower'](_0x544335['favicon'])):path['join'](config[_0x06e8('0x60')],_0x3990df,_[_0x06e8('0x61')](_0x06e8('0x77')));var _0x1333e7=_0x06e8('0x63')+_['upperFirst'](_0x06e8('0x5b'));if(_0x544335[_0x1333e7]||!_0x3ceba3[_0x06e8('0x69')]){_0x2c1e5f=path[_0x06e8('0x5f')](config[_0x06e8('0x60')],_0x3990df,_[_0x06e8('0x61')](_0x06e8('0x77')));}if(!fs[_0x06e8('0x5e')](_0x2c1e5f)){throw new db['Sequelize'][(_0x06e8('0x72'))](_[_0x06e8('0x64')](_0x06e8('0x5b'))+_0x06e8('0x73'));}return _0x535eb8[_0x06e8('0x6a')](_0x2c1e5f);}})[_0x06e8('0x27')](handleError(_0x535eb8,null));};exports['getDate']=function(_0x55a517,_0x17c645){var _0x36f72f={'offset':moment()[_0x06e8('0x78')]()};_0x36f72f[_0x06e8('0x79')]=moment()[_0x06e8('0x78')](_0x36f72f[_0x06e8('0x2f')])[_0x06e8('0x7a')](_0x06e8('0x7b'));return _0x17c645[_0x06e8('0x29')](0xc8)[_0x06e8('0x35')](_0x36f72f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 086d91f..35894fc 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x4e2f07,_0x4a787c){var _0x33d6f2=function(_0x40837a){while(--_0x40837a){_0x4e2f07['push'](_0x4e2f07['shift']());}};_0x33d6f2(++_0x4a787c);}(_0xedd9,0xfc));var _0x9edd=function(_0x3149f4,_0x4e9c3f){_0x3149f4=_0x3149f4-0x0;var _0x3c762c=_0xedd9[_0x3149f4];return _0x3c762c;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x008c,0x188));var _0xc008=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x008c[_0x4914e2];return _0x2dcd07;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4d309f3..eefa7a8 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 _0x0425=['../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','ShowSetting','Setting','find','options','raw','where','attributes','include','model','map','stringify','lodash','moment','randomstring'];(function(_0x22b95b,_0x2c695e){var _0x32728b=function(_0x434be1){while(--_0x434be1){_0x22b95b['push'](_0x22b95b['shift']());}};_0x32728b(++_0x2c695e);}(_0x0425,0x8e));var _0x5042=function(_0x17cc4d,_0x51d267){_0x17cc4d=_0x17cc4d-0x0;var _0x416aad=_0x0425[_0x17cc4d];return _0x416aad;};'use strict';var _=require(_0x5042('0x0'));var util=require('util');var moment=require(_0x5042('0x1'));var BPromise=require('bluebird');var rs=require(_0x5042('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5042('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5042('0x4'));var jayson=require(_0x5042('0x5'));var client=jayson[_0x5042('0x6')][_0x5042('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ada7f,_0xd83c7,_0x5f52ab){return new BPromise(function(_0x2270d4,_0x154e5a){return client['request'](_0x2ada7f,_0x5f52ab)[_0x5042('0x8')](function(_0x1b6e93){logger[_0x5042('0x9')](_0x5042('0xa'),_0xd83c7,'request\x20sent');logger[_0x5042('0xb')](_0x5042('0xc'),_0xd83c7,'request\x20sent',JSON['stringify'](_0x1b6e93));if(_0x1b6e93['error']){if(_0x1b6e93[_0x5042('0xd')][_0x5042('0xe')]===0x1f4){logger[_0x5042('0xd')](_0x5042('0xa'),_0xd83c7,_0x1b6e93[_0x5042('0xd')][_0x5042('0xf')]);return _0x154e5a(_0x1b6e93[_0x5042('0xd')][_0x5042('0xf')]);}logger['error'](_0x5042('0xa'),_0xd83c7,_0x1b6e93[_0x5042('0xd')][_0x5042('0xf')]);return _0x2270d4(_0x1b6e93['error'][_0x5042('0xf')]);}else{logger[_0x5042('0x9')](_0x5042('0xa'),_0xd83c7,_0x5042('0x10'));_0x2270d4(_0x1b6e93[_0x5042('0x11')]['message']);}})['catch'](function(_0x2339c6){logger[_0x5042('0xd')]('Setting,\x20%s,\x20%s',_0xd83c7,_0x2339c6);_0x154e5a(_0x2339c6);});});}exports[_0x5042('0x12')]=function(_0x5ab989){var _0x58204c=this;return new Promise(function(_0x2009b6,_0x4d05f3){return db[_0x5042('0x13')][_0x5042('0x14')]({'raw':_0x5ab989[_0x5042('0x15')]?_0x5ab989[_0x5042('0x15')][_0x5042('0x16')]===undefined?!![]:![]:!![],'where':_0x5ab989[_0x5042('0x15')]?_0x5ab989[_0x5042('0x15')][_0x5042('0x17')]||null:null,'attributes':_0x5ab989[_0x5042('0x15')]?_0x5ab989[_0x5042('0x15')][_0x5042('0x18')]||null:null,'include':_0x5ab989['options']?_0x5ab989[_0x5042('0x15')][_0x5042('0x19')]?_['map'](_0x5ab989['options'][_0x5042('0x19')],function(_0x576ca1){return{'model':db[_0x576ca1[_0x5042('0x1a')]],'as':_0x576ca1['as'],'attributes':_0x576ca1[_0x5042('0x18')],'include':_0x576ca1[_0x5042('0x19')]?_['map'](_0x576ca1[_0x5042('0x19')],function(_0x802323){return{'model':db[_0x802323[_0x5042('0x1a')]],'as':_0x802323['as'],'attributes':_0x802323[_0x5042('0x18')],'include':_0x802323[_0x5042('0x19')]?_[_0x5042('0x1b')](_0x802323[_0x5042('0x19')],function(_0x3181e9){return{'model':db[_0x3181e9[_0x5042('0x1a')]],'as':_0x3181e9['as'],'attributes':_0x3181e9[_0x5042('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5042('0x8')](function(_0x19aa1d){logger[_0x5042('0x9')](_0x5042('0x12'),_0x5ab989);logger[_0x5042('0xb')](_0x5042('0x12'),_0x5ab989,JSON[_0x5042('0x1c')](_0x19aa1d));_0x2009b6(_0x19aa1d);})['catch'](function(_0x4ac3c1){logger[_0x5042('0xd')](_0x5042('0x12'),_0x4ac3c1[_0x5042('0xf')],_0x5ab989);_0x4d05f3(_0x58204c[_0x5042('0xd')](0x1f4,_0x4ac3c1[_0x5042('0xf')]));});});}; \ No newline at end of file +var _0x1ce4=['find','options','where','attributes','include','map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting'];(function(_0x133f49,_0x3cb34f){var _0x4a86dc=function(_0x41f159){while(--_0x41f159){_0x133f49['push'](_0x133f49['shift']());}};_0x4a86dc(++_0x3cb34f);}(_0x1ce4,0x18e));var _0x41ce=function(_0x43fea4,_0xf300a6){_0x43fea4=_0x43fea4-0x0;var _0x5e31d6=_0x1ce4[_0x43fea4];return _0x5e31d6;};'use strict';var _=require(_0x41ce('0x0'));var util=require(_0x41ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x41ce('0x2'));var fs=require('fs');var Redis=require(_0x41ce('0x3'));var db=require(_0x41ce('0x4'))['db'];var utils=require(_0x41ce('0x5'));var logger=require('../../config/logger')(_0x41ce('0x6'));var config=require(_0x41ce('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41ce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bc75e,_0x3459c7,_0xa80a65){return new BPromise(function(_0x313dc8,_0x44a09d){return client[_0x41ce('0x9')](_0x3bc75e,_0xa80a65)['then'](function(_0x24b97b){logger[_0x41ce('0xa')](_0x41ce('0xb'),_0x3459c7,_0x41ce('0xc'));logger[_0x41ce('0xd')](_0x41ce('0xe'),_0x3459c7,_0x41ce('0xc'),JSON[_0x41ce('0xf')](_0x24b97b));if(_0x24b97b[_0x41ce('0x10')]){if(_0x24b97b[_0x41ce('0x10')]['code']===0x1f4){logger[_0x41ce('0x10')](_0x41ce('0xb'),_0x3459c7,_0x24b97b[_0x41ce('0x10')][_0x41ce('0x11')]);return _0x44a09d(_0x24b97b[_0x41ce('0x10')][_0x41ce('0x11')]);}logger[_0x41ce('0x10')](_0x41ce('0xb'),_0x3459c7,_0x24b97b[_0x41ce('0x10')][_0x41ce('0x11')]);return _0x313dc8(_0x24b97b[_0x41ce('0x10')][_0x41ce('0x11')]);}else{logger[_0x41ce('0xa')]('Setting,\x20%s,\x20%s',_0x3459c7,_0x41ce('0xc'));_0x313dc8(_0x24b97b[_0x41ce('0x12')][_0x41ce('0x11')]);}})[_0x41ce('0x13')](function(_0x54ec1a){logger['error'](_0x41ce('0xb'),_0x3459c7,_0x54ec1a);_0x44a09d(_0x54ec1a);});});}exports[_0x41ce('0x14')]=function(_0x186625){var _0x403500=this;return new Promise(function(_0x2b9022,_0x19d3f7){return db[_0x41ce('0x15')][_0x41ce('0x16')]({'raw':_0x186625[_0x41ce('0x17')]?_0x186625[_0x41ce('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x186625[_0x41ce('0x17')]?_0x186625['options'][_0x41ce('0x18')]||null:null,'attributes':_0x186625[_0x41ce('0x17')]?_0x186625['options'][_0x41ce('0x19')]||null:null,'include':_0x186625['options']?_0x186625['options'][_0x41ce('0x1a')]?_[_0x41ce('0x1b')](_0x186625['options'][_0x41ce('0x1a')],function(_0x17a1a6){return{'model':db[_0x17a1a6[_0x41ce('0x1c')]],'as':_0x17a1a6['as'],'attributes':_0x17a1a6['attributes'],'include':_0x17a1a6[_0x41ce('0x1a')]?_[_0x41ce('0x1b')](_0x17a1a6['include'],function(_0x4117d1){return{'model':db[_0x4117d1['model']],'as':_0x4117d1['as'],'attributes':_0x4117d1[_0x41ce('0x19')],'include':_0x4117d1[_0x41ce('0x1a')]?_[_0x41ce('0x1b')](_0x4117d1[_0x41ce('0x1a')],function(_0x8d6ae1){return{'model':db[_0x8d6ae1['model']],'as':_0x8d6ae1['as'],'attributes':_0x8d6ae1[_0x41ce('0x19')]};}):[]};}):[]};}):[]:[]})[_0x41ce('0x1d')](function(_0x3a31d6){logger[_0x41ce('0xa')](_0x41ce('0x14'),_0x186625);logger['debug'](_0x41ce('0x14'),_0x186625,JSON[_0x41ce('0xf')](_0x3a31d6));_0x2b9022(_0x3a31d6);})[_0x41ce('0x13')](function(_0x1f437a){logger[_0x41ce('0x10')]('ShowSetting',_0x1f437a[_0x41ce('0x11')],_0x186625);_0x19d3f7(_0x403500['error'](0x1f4,_0x1f437a[_0x41ce('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e5dc316..0ba450c 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0xe18f1d,_0x37e113){var _0x568ae8=function(_0x30ac84){while(--_0x30ac84){_0xe18f1d['push'](_0xe18f1d['shift']());}};_0x568ae8(++_0x37e113);}(_0x53ec,0x192));var _0xc53e=function(_0x115785,_0x4d16fa){_0x115785=_0x115785-0x0;var _0x35224b=_0x53ec[_0x115785];return _0x35224b;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x507efb,_0x2d159a){var _0x108688=function(_0x189b7b){while(--_0x189b7b){_0x507efb['push'](_0x507efb['shift']());}};_0x108688(++_0x2d159a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1d9379,_0x297eb9){_0x1d9379=_0x1d9379-0x0;var _0x3d892e=_0x8ef6[_0x1d9379];return _0x3d892e;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);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 36f46c0..b24c3b6 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 _0xb6a2=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6a2,0xfd));var _0x2b6a=function(_0x105e18,_0x3a85c2){_0x105e18=_0x105e18-0x0;var _0x30a4b=_0xb6a2[_0x105e18];return _0x30a4b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2b6a('0x0'));module[_0x2b6a('0x1')]={'name':{'type':Sequelize[_0x2b6a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x2b6a('0x2')],'defaultValue':function(){return rs[_0x2b6a('0x3')]();}},'phone':{'type':Sequelize[_0x2b6a('0x2')]},'type':{'type':Sequelize[_0x2b6a('0x4')](_0x2b6a('0x5'),'skebby',_0x2b6a('0x6'),_0x2b6a('0x7'),_0x2b6a('0x8'),_0x2b6a('0x9'),_0x2b6a('0xa'),_0x2b6a('0xb'),_0x2b6a('0xc'),_0x2b6a('0xd'))},'accountSid':{'type':Sequelize[_0x2b6a('0x2')]},'authId':{'type':Sequelize[_0x2b6a('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2b6a('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2b6a('0x2')]},'applicationId':{'type':Sequelize[_0x2b6a('0x2')]},'accountId':{'type':Sequelize[_0x2b6a('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x2b6a('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2b6a('0xf')],'defaultValue':function(){return _0x2b6a('0x10');}},'notificationSound':{'type':Sequelize[_0x2b6a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2b6a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2b6a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2b6a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b6a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2b6a('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b6a('0x11')],'comment':_0x2b6a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a1d84){if(!_0x4a1d84)this['setDataValue'](_0x2b6a('0x13'),null);this[_0x2b6a('0x14')](_0x2b6a('0x15'),_0x4a1d84);}}}; \ No newline at end of file +var _0xa060=['twilio','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM'];(function(_0x1ae60b,_0x19c427){var _0xb82ea1=function(_0x49405c){while(--_0x49405c){_0x1ae60b['push'](_0x1ae60b['shift']());}};_0xb82ea1(++_0x19c427);}(_0xa060,0x14a));var _0x0a06=function(_0x51a727,_0x2cee7a){_0x51a727=_0x51a727-0x0;var _0x5597a2=_0xa060[_0x51a727];return _0x5597a2;};'use strict';var Sequelize=require(_0x0a06('0x0'));var rs=require(_0x0a06('0x1'));module[_0x0a06('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0a06('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0a06('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0a06('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x0a06('0x4')]},'type':{'type':Sequelize[_0x0a06('0x5')](_0x0a06('0x6'),'skebby','connectel',_0x0a06('0x7'),_0x0a06('0x8'),_0x0a06('0x9'),_0x0a06('0xa'),_0x0a06('0xb'),_0x0a06('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x0a06('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x0a06('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0a06('0x4')]},'password':{'type':Sequelize[_0x0a06('0x4')]},'apiKey':{'type':Sequelize[_0x0a06('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x0a06('0x4')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x0a06('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a06('0x4')]},'notificationTemplate':{'type':Sequelize[_0x0a06('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0a06('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0a06('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0a06('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0a06('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0a06('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a06('0xf')],'comment':_0x0a06('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0a06('0x11'),'set':function(_0x2ef9bd){if(!_0x2ef9bd)this[_0x0a06('0x12')](_0x0a06('0x13'),null);this[_0x0a06('0x12')](_0x0a06('0x14'),_0x2ef9bd);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index afc79d1..57018b6 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 _0xfffc=['AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','Messages','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','update','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','request-promise','mustache','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./smsAccount.socket','register','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','intersection','ids','getAnswers','findOne','CannedAnswer','nolimit','order','removeAnswers','sms','Applications','account','orderBy','priority','asc','Sequelize','difference','createdAt','updatedAt','CompanyId','mobile','twilio','Body','messageId','MessageSid','skebby','from','sender','connectel','clicksend','message_id','plivo','From','MessageUUID','results','text','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','ListId','CmContact','Contacts','list','SmsInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','SmsMessage'];(function(_0xdf951c,_0x8dc57d){var _0xc368ec=function(_0x10943a){while(--_0x10943a){_0xdf951c['push'](_0xdf951c['shift']());}};_0xc368ec(++_0x8dc57d);}(_0xfffc,0x124));var _0xcfff=function(_0x5a22f3,_0x43376a){_0x5a22f3=_0x5a22f3-0x0;var _0x1f066d=_0xfffc[_0x5a22f3];return _0x1f066d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcfff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfff('0x2'));var util=require(_0xcfff('0x3'));var path=require(_0xcfff('0x4'));var sox=require(_0xcfff('0x5'));var csv=require(_0xcfff('0x6'));var ejs=require(_0xcfff('0x7'));var fs=require('fs');var fs_extra=require(_0xcfff('0x8'));var _=require(_0xcfff('0x9'));var squel=require(_0xcfff('0xa'));var crypto=require(_0xcfff('0xb'));var jsforce=require(_0xcfff('0xc'));var deskjs=require(_0xcfff('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcfff('0xe'));var Redis=require(_0xcfff('0xf'));var authService=require(_0xcfff('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcfff('0x11'));var hardwareService=require(_0xcfff('0x12'));var logger=require('../../config/logger')(_0xcfff('0x13'));var utils=require(_0xcfff('0x14'));var config=require(_0xcfff('0x15'));var licenseUtil=require(_0xcfff('0x16'));var db=require(_0xcfff('0x17'))['db'];config['redis']=_[_0xcfff('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcfff('0x19'))(new Redis(config[_0xcfff('0x1a')]));require(_0xcfff('0x1b'))[_0xcfff('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcfff('0x1d')][_0xcfff('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x321408,_0x5ebc48,_0x5a69b1,_0x281ebb){return new BPromise(function(_0x3ca95c,_0x5ea9b7){var _0x1b3255=_0x281ebb||client;return _0x1b3255[_0xcfff('0x1f')](_0x321408,_0x5a69b1)[_0xcfff('0x20')](function(_0x5b4bcb){logger['info'](_0xcfff('0x21'),_0x5ebc48,_0xcfff('0x22'));logger[_0xcfff('0x23')](_0xcfff('0x24'),_0x5ebc48,_0xcfff('0x22'),JSON['stringify'](_0x5b4bcb));if(_0x5b4bcb['error']){if(_0x5b4bcb[_0xcfff('0x25')][_0xcfff('0x26')]===0x1f4){logger[_0xcfff('0x25')](_0xcfff('0x21'),_0x5ebc48,_0x5b4bcb[_0xcfff('0x25')][_0xcfff('0x27')]);return _0x5ea9b7(_0x5b4bcb[_0xcfff('0x25')][_0xcfff('0x27')]);}logger[_0xcfff('0x25')](_0xcfff('0x21'),_0x5ebc48,_0x5b4bcb[_0xcfff('0x25')]['message']);return _0x3ca95c(_0x5b4bcb[_0xcfff('0x25')]['message']);}else{logger[_0xcfff('0x28')](_0xcfff('0x21'),_0x5ebc48,_0xcfff('0x22'));_0x3ca95c(_0x5b4bcb['result']['message']);}})['catch'](function(_0x4f1df8){logger[_0xcfff('0x25')](_0xcfff('0x21'),_0x5ebc48,_0x4f1df8);_0x5ea9b7(_0x4f1df8);});});}function respondWithStatusCode(_0x663b7,_0x4a4d80){_0x4a4d80=_0x4a4d80||0xcc;return function(_0x35b154){if(_0x35b154){return _0x663b7[_0xcfff('0x29')](_0x4a4d80);}return _0x663b7[_0xcfff('0x2a')](_0x4a4d80)[_0xcfff('0x2b')]();};}function respondWithResult(_0x6a261e,_0x1150c5){_0x1150c5=_0x1150c5||0xc8;return function(_0x280cfa){if(_0x280cfa){return _0x6a261e[_0xcfff('0x2a')](_0x1150c5)['json'](_0x280cfa);}};}function respondWithFilteredResult(_0x3951b4,_0x1d5b4f){return function(_0x2a1dd1){if(_0x2a1dd1){var _0x25db93=typeof _0x1d5b4f[_0xcfff('0x2c')]==='undefined'&&typeof _0x1d5b4f[_0xcfff('0x2d')]===_0xcfff('0x2e');var _0x4170c8=_0x2a1dd1[_0xcfff('0x2f')];var _0x580b10=_0x25db93?0x0:_0x1d5b4f['offset'];var _0x843000=_0x25db93?_0x2a1dd1[_0xcfff('0x2f')]:_0x1d5b4f[_0xcfff('0x2c')]+_0x1d5b4f[_0xcfff('0x2d')];var _0x4288d3;if(_0x843000>=_0x4170c8){_0x843000=_0x4170c8;_0x4288d3=0xc8;}else{_0x4288d3=0xce;}_0x3951b4[_0xcfff('0x2a')](_0x4288d3);return _0x3951b4[_0xcfff('0x30')](_0xcfff('0x31'),_0x580b10+'-'+_0x843000+'/'+_0x4170c8)[_0xcfff('0x32')](_0x2a1dd1);}return null;};}function patchUpdates(_0x320e51){return function(_0x3a867a){try{jsonpatch[_0xcfff('0x33')](_0x3a867a,_0x320e51,!![]);}catch(_0x120025){return BPromise[_0xcfff('0x34')](_0x120025);}return _0x3a867a['save']();};}function saveUpdates(_0x2d27d2,_0x1eb13f){return function(_0x3063de){if(_0x3063de){return _0x3063de['update'](_0x2d27d2)['then'](function(_0xbc7ed4){return _0xbc7ed4;});}return null;};}function removeEntity(_0x357b59,_0x2a3761){return function(_0x317993){if(_0x317993){return _0x317993[_0xcfff('0x35')]()['then'](function(){var _0x56d385=_0x317993[_0xcfff('0x36')]({'plain':!![]});var _0x48362a='SmsAccounts';return db[_0xcfff('0x37')][_0xcfff('0x35')]({'where':{'type':_0x48362a,'resourceId':_0x56d385['id']}})[_0xcfff('0x20')](function(){return _0x317993;});})[_0xcfff('0x20')](function(){_0x357b59[_0xcfff('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c17,_0x251aa3){return function(_0x379191){if(!_0x379191){_0x3e5c17[_0xcfff('0x29')](0x194);}return _0x379191;};}function handleError(_0x885d4,_0x5cc71d){_0x5cc71d=_0x5cc71d||0x1f4;return function(_0x241527){logger['error'](_0x241527[_0xcfff('0x38')]);if(_0x241527['name']){delete _0x241527[_0xcfff('0x39')];}_0x885d4['status'](_0x5cc71d)[_0xcfff('0x3a')](_0x241527);};}exports['index']=function(_0xf7b73e,_0x25e18f){var _0x81bf9f={'include':[{'model':db[_0xcfff('0x3b')],'as':_0xcfff('0x3c')}]},_0x341071={},_0x30894c={'count':0x0,'rows':[]};var _0x143c05=_[_0xcfff('0x3d')](db[_0xcfff('0x3e')][_0xcfff('0x3f')],function(_0x5d440b){return{'name':_0x5d440b[_0xcfff('0x40')],'type':_0x5d440b[_0xcfff('0x41')][_0xcfff('0x42')]};});_0x341071[_0xcfff('0x43')]=_[_0xcfff('0x3d')](_0x143c05,_0xcfff('0x39'));_0x341071[_0xcfff('0x44')]=_[_0xcfff('0x45')](_0xf7b73e[_0xcfff('0x44')]);_0x341071[_0xcfff('0x46')]=_['intersection'](_0x341071[_0xcfff('0x43')],_0x341071['query']);_0x81bf9f[_0xcfff('0x47')]=_['intersection'](_0x341071['model'],qs[_0xcfff('0x48')](_0xf7b73e['query'][_0xcfff('0x48')]));_0x81bf9f[_0xcfff('0x47')]=_0x81bf9f[_0xcfff('0x47')][_0xcfff('0x49')]?_0x81bf9f[_0xcfff('0x47')]:_0x341071['model'];if(!_0xf7b73e[_0xcfff('0x44')][_0xcfff('0x4a')]('nolimit')){_0x81bf9f[_0xcfff('0x2d')]=qs['limit'](_0xf7b73e[_0xcfff('0x44')][_0xcfff('0x2d')]);_0x81bf9f[_0xcfff('0x2c')]=qs[_0xcfff('0x2c')](_0xf7b73e[_0xcfff('0x44')][_0xcfff('0x2c')]);}_0x81bf9f['order']=qs[_0xcfff('0x4b')](_0xf7b73e['query'][_0xcfff('0x4b')]);_0x81bf9f['where']=qs[_0xcfff('0x46')](_[_0xcfff('0x4c')](_0xf7b73e[_0xcfff('0x44')],_0x341071[_0xcfff('0x46')]),_0x143c05);if(_0xf7b73e['query']['filter']){_0x81bf9f[_0xcfff('0x4d')]=_[_0xcfff('0x4e')](_0x81bf9f[_0xcfff('0x4d')],{'$or':_[_0xcfff('0x3d')](_0x143c05,function(_0x245eba){if(_0x245eba[_0xcfff('0x41')]!==_0xcfff('0x4f')){var _0x514d45={};_0x514d45[_0x245eba[_0xcfff('0x39')]]={'$like':'%'+_0xf7b73e[_0xcfff('0x44')][_0xcfff('0x50')]+'%'};return _0x514d45;}})});}_0x81bf9f=_['merge']({},_0x81bf9f,_0xf7b73e[_0xcfff('0x51')]);var _0x367169={'where':_0x81bf9f[_0xcfff('0x4d')]};return db[_0xcfff('0x3e')]['count'](_0x367169)[_0xcfff('0x20')](function(_0x5aa323){_0x30894c[_0xcfff('0x2f')]=_0x5aa323;if(_0xf7b73e[_0xcfff('0x44')][_0xcfff('0x52')]){_0x81bf9f[_0xcfff('0x53')]=[{'all':!![]}];}return db[_0xcfff('0x3e')][_0xcfff('0x54')](_0x81bf9f);})['then'](function(_0x58c0f1){_0x30894c[_0xcfff('0x55')]=_0x58c0f1;return _0x30894c;})[_0xcfff('0x20')](respondWithFilteredResult(_0x25e18f,_0x81bf9f))[_0xcfff('0x56')](handleError(_0x25e18f,null));};exports[_0xcfff('0x57')]=function(_0x53a342,_0x127c2e){var _0x4b4915={'raw':![],'where':{'id':_0x53a342[_0xcfff('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xcfff('0x3c')}]},_0x1ff6cc={};_0x1ff6cc[_0xcfff('0x43')]=_['keys'](db['SmsAccount'][_0xcfff('0x3f')]);_0x1ff6cc[_0xcfff('0x44')]=_[_0xcfff('0x45')](_0x53a342[_0xcfff('0x44')]);_0x1ff6cc[_0xcfff('0x46')]=_['intersection'](_0x1ff6cc['model'],_0x1ff6cc[_0xcfff('0x44')]);_0x4b4915[_0xcfff('0x47')]=_['intersection'](_0x1ff6cc[_0xcfff('0x43')],qs[_0xcfff('0x48')](_0x53a342[_0xcfff('0x44')]['fields']));_0x4b4915[_0xcfff('0x47')]=_0x4b4915[_0xcfff('0x47')][_0xcfff('0x49')]?_0x4b4915[_0xcfff('0x47')]:_0x1ff6cc[_0xcfff('0x43')];if(_0x53a342[_0xcfff('0x44')][_0xcfff('0x52')]){_0x4b4915['include']=[{'all':!![]}];}_0x4b4915=_[_0xcfff('0x4e')]({},_0x4b4915,_0x53a342[_0xcfff('0x51')]);return db[_0xcfff('0x3e')][_0xcfff('0x59')](_0x4b4915)[_0xcfff('0x20')](handleEntityNotFound(_0x127c2e,null))[_0xcfff('0x20')](respondWithResult(_0x127c2e,null))[_0xcfff('0x56')](handleError(_0x127c2e,null));};exports['create']=function(_0x46110d,_0x4b7ebe){return db['SmsAccount'][_0xcfff('0x5a')](_0x46110d[_0xcfff('0x5b')],{})[_0xcfff('0x20')](function(_0x45473f){var _0x232bdb=_0x46110d['user'][_0xcfff('0x36')]({'plain':!![]});if(!_0x232bdb)throw new Error(_0xcfff('0x5c'));if(_0x232bdb[_0xcfff('0x5d')]===_0xcfff('0x5e')){var _0x522205=_0x45473f[_0xcfff('0x36')]({'plain':!![]});var _0x32f5ef=_0xcfff('0x5f');return db[_0xcfff('0x60')]['find']({'where':{'name':_0x32f5ef,'userProfileId':_0x232bdb['userProfileId']},'raw':!![]})['then'](function(_0x39653a){if(_0x39653a&&_0x39653a[_0xcfff('0x61')]===0x0){return db[_0xcfff('0x37')][_0xcfff('0x5a')]({'name':_0x522205['name'],'resourceId':_0x522205['id'],'type':_0x39653a[_0xcfff('0x39')],'sectionId':_0x39653a['id']},{})[_0xcfff('0x20')](function(){return _0x45473f;});}else{return _0x45473f;}})[_0xcfff('0x56')](function(_0x2b9022){logger['error'](_0xcfff('0x62'),_0x2b9022);throw _0x2b9022;});}return _0x45473f;})[_0xcfff('0x20')](respondWithResult(_0x4b7ebe,0xc9))['catch'](handleError(_0x4b7ebe,null));};exports['update']=function(_0x1c9c32,_0x3e46a3){if(_0x1c9c32[_0xcfff('0x5b')]['id']){delete _0x1c9c32[_0xcfff('0x5b')]['id'];}return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0x1c9c32[_0xcfff('0x58')]['id']},'include':[{'model':db[_0xcfff('0x3b')],'as':_0xcfff('0x3c')}]})[_0xcfff('0x20')](handleEntityNotFound(_0x3e46a3,null))[_0xcfff('0x20')](saveUpdates(_0x1c9c32['body'],null))[_0xcfff('0x20')](respondWithResult(_0x3e46a3,null))[_0xcfff('0x56')](handleError(_0x3e46a3,null));};exports[_0xcfff('0x35')]=function(_0x16d62c,_0x5a77a1){return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0x16d62c['params']['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x5a77a1,null))[_0xcfff('0x20')](removeEntity(_0x5a77a1,null))[_0xcfff('0x56')](handleError(_0x5a77a1,null));};exports[_0xcfff('0x63')]=function(_0x490ccf,_0x393040){return db[_0xcfff('0x3e')][_0xcfff('0x63')]()[_0xcfff('0x20')](respondWithResult(_0x393040,null))[_0xcfff('0x56')](handleError(_0x393040,null));};exports[_0xcfff('0x64')]=function(_0xfdaa6f,_0x3937da,_0x1e42bd){if(_0xfdaa6f[_0xcfff('0x5b')]['id']){delete _0xfdaa6f[_0xcfff('0x5b')]['id'];}return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0xfdaa6f[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x3937da,null))[_0xcfff('0x20')](function(_0x55de45){if(_0x55de45){_0xfdaa6f['body'][_0xcfff('0x65')]=_0x55de45['id'];return db[_0xcfff('0x66')][_0xcfff('0x5a')](_0xfdaa6f[_0xcfff('0x5b')]);}})['then'](respondWithResult(_0x3937da,null))[_0xcfff('0x56')](handleError(_0x3937da,null));};exports[_0xcfff('0x67')]=function(_0x5c8b77,_0x306b98,_0x22b70e){var _0x534b03={'raw':![],'where':{}};var _0x418089={};var _0x212b37={'count':0x0,'rows':[]};return db[_0xcfff('0x3e')]['findOne']({'where':{'id':_0x5c8b77[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x306b98,null))[_0xcfff('0x20')](function(_0x3dbd79){if(_0x3dbd79){_0x418089[_0xcfff('0x43')]=_[_0xcfff('0x45')](db['Disposition'][_0xcfff('0x3f')]);_0x418089[_0xcfff('0x44')]=_[_0xcfff('0x45')](_0x5c8b77[_0xcfff('0x44')]);_0x418089[_0xcfff('0x46')]=_['intersection'](_0x418089[_0xcfff('0x43')],_0x418089[_0xcfff('0x44')]);_0x534b03[_0xcfff('0x47')]=_[_0xcfff('0x68')](_0x418089['model'],qs[_0xcfff('0x48')](_0x5c8b77[_0xcfff('0x44')]['fields']));_0x534b03[_0xcfff('0x47')]=_0x534b03[_0xcfff('0x47')][_0xcfff('0x49')]?_0x534b03[_0xcfff('0x47')]:_0x418089['model'];if(!_0x5c8b77['query']['hasOwnProperty']('nolimit')){_0x534b03[_0xcfff('0x2d')]=qs[_0xcfff('0x2d')](_0x5c8b77[_0xcfff('0x44')][_0xcfff('0x2d')]);_0x534b03[_0xcfff('0x2c')]=qs[_0xcfff('0x2c')](_0x5c8b77['query']['offset']);}_0x534b03['order']=qs[_0xcfff('0x4b')](_0x5c8b77[_0xcfff('0x44')][_0xcfff('0x4b')]);_0x534b03['where']=qs['filters'](_[_0xcfff('0x4c')](_0x5c8b77['query'],_0x418089['filters']));_0x534b03['where'][_0xcfff('0x65')]=_0x3dbd79['id'];if(_0x5c8b77['query'][_0xcfff('0x50')]){_0x534b03[_0xcfff('0x4d')]=_['merge'](_0x534b03[_0xcfff('0x4d')],{'$or':_[_0xcfff('0x3d')](_0x534b03[_0xcfff('0x47')],function(_0xdbc0ba){var _0x370578={};_0x370578[_0xdbc0ba]={'$like':'%'+_0x5c8b77[_0xcfff('0x44')][_0xcfff('0x50')]+'%'};return _0x370578;})});}_0x534b03=_[_0xcfff('0x4e')]({},_0x534b03,_0x5c8b77[_0xcfff('0x51')]);return db[_0xcfff('0x66')][_0xcfff('0x2f')]({'where':_0x534b03['where']})[_0xcfff('0x20')](function(_0x49b173){_0x212b37[_0xcfff('0x2f')]=_0x49b173;if(_0x5c8b77[_0xcfff('0x44')]['includeAll']){_0x534b03[_0xcfff('0x53')]=[{'all':!![]}];}return db[_0xcfff('0x66')]['findAll'](_0x534b03);})[_0xcfff('0x20')](function(_0x3a5656){_0x212b37['rows']=_0x3a5656;return _0x212b37;});}})[_0xcfff('0x20')](respondWithFilteredResult(_0x306b98,_0x534b03))['catch'](handleError(_0x306b98,null));};exports['removeDispositions']=function(_0x254d2e,_0x42aa96,_0x288119){return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0x254d2e['params']['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x42aa96,null))[_0xcfff('0x20')](function(_0x8f50d){if(_0x8f50d){return _0x8f50d['removeDispositions'](_0x254d2e[_0xcfff('0x44')][_0xcfff('0x69')]);}})['then'](respondWithStatusCode(_0x42aa96,null))[_0xcfff('0x56')](handleError(_0x42aa96,null));};exports['addAnswer']=function(_0x26a95e,_0x5d251b,_0x4faace){if(_0x26a95e['body']['id']){delete _0x26a95e[_0xcfff('0x5b')]['id'];}return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0x26a95e[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x5d251b,null))[_0xcfff('0x20')](function(_0x12ca94){if(_0x12ca94){_0x26a95e['body'][_0xcfff('0x65')]=_0x12ca94['id'];return db['CannedAnswer'][_0xcfff('0x5a')](_0x26a95e[_0xcfff('0x5b')]);}})[_0xcfff('0x20')](respondWithResult(_0x5d251b,null))[_0xcfff('0x56')](handleError(_0x5d251b,null));};exports[_0xcfff('0x6a')]=function(_0x20d9ae,_0x2822ce,_0x1401ae){var _0x22cb8b={'raw':![],'where':{}};var _0x5a19ca={};var _0x4cf4fc={'count':0x0,'rows':[]};return db[_0xcfff('0x3e')][_0xcfff('0x6b')]({'where':{'id':_0x20d9ae[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x2822ce,null))[_0xcfff('0x20')](function(_0xe72575){if(_0xe72575){_0x5a19ca[_0xcfff('0x43')]=_[_0xcfff('0x45')](db[_0xcfff('0x6c')]['rawAttributes']);_0x5a19ca['query']=_[_0xcfff('0x45')](_0x20d9ae[_0xcfff('0x44')]);_0x5a19ca[_0xcfff('0x46')]=_[_0xcfff('0x68')](_0x5a19ca['model'],_0x5a19ca[_0xcfff('0x44')]);_0x22cb8b[_0xcfff('0x47')]=_[_0xcfff('0x68')](_0x5a19ca['model'],qs[_0xcfff('0x48')](_0x20d9ae[_0xcfff('0x44')][_0xcfff('0x48')]));_0x22cb8b[_0xcfff('0x47')]=_0x22cb8b[_0xcfff('0x47')][_0xcfff('0x49')]?_0x22cb8b[_0xcfff('0x47')]:_0x5a19ca[_0xcfff('0x43')];if(!_0x20d9ae[_0xcfff('0x44')][_0xcfff('0x4a')](_0xcfff('0x6d'))){_0x22cb8b['limit']=qs[_0xcfff('0x2d')](_0x20d9ae['query'][_0xcfff('0x2d')]);_0x22cb8b[_0xcfff('0x2c')]=qs[_0xcfff('0x2c')](_0x20d9ae[_0xcfff('0x44')][_0xcfff('0x2c')]);}_0x22cb8b[_0xcfff('0x6e')]=qs['sort'](_0x20d9ae[_0xcfff('0x44')][_0xcfff('0x4b')]);_0x22cb8b[_0xcfff('0x4d')]=qs[_0xcfff('0x46')](_['pick'](_0x20d9ae[_0xcfff('0x44')],_0x5a19ca[_0xcfff('0x46')]));_0x22cb8b[_0xcfff('0x4d')]['SmsAccountId']=_0xe72575['id'];if(_0x20d9ae[_0xcfff('0x44')]['filter']){_0x22cb8b[_0xcfff('0x4d')]=_[_0xcfff('0x4e')](_0x22cb8b[_0xcfff('0x4d')],{'$or':_[_0xcfff('0x3d')](_0x22cb8b[_0xcfff('0x47')],function(_0x139034){var _0x2c4d4f={};_0x2c4d4f[_0x139034]={'$like':'%'+_0x20d9ae[_0xcfff('0x44')][_0xcfff('0x50')]+'%'};return _0x2c4d4f;})});}_0x22cb8b=_['merge']({},_0x22cb8b,_0x20d9ae[_0xcfff('0x51')]);return db[_0xcfff('0x6c')][_0xcfff('0x2f')]({'where':_0x22cb8b['where']})['then'](function(_0x5ebe96){_0x4cf4fc['count']=_0x5ebe96;if(_0x20d9ae[_0xcfff('0x44')]['includeAll']){_0x22cb8b[_0xcfff('0x53')]=[{'all':!![]}];}return db[_0xcfff('0x6c')][_0xcfff('0x54')](_0x22cb8b);})[_0xcfff('0x20')](function(_0x20a8ac){_0x4cf4fc[_0xcfff('0x55')]=_0x20a8ac;return _0x4cf4fc;});}})['then'](respondWithFilteredResult(_0x2822ce,_0x22cb8b))[_0xcfff('0x56')](handleError(_0x2822ce,null));};exports[_0xcfff('0x6f')]=function(_0x46b6e0,_0x684f0b,_0x49a833){return db[_0xcfff('0x3e')]['find']({'where':{'id':_0x46b6e0['params']['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x684f0b,null))[_0xcfff('0x20')](function(_0x266737){if(_0x266737){return _0x266737[_0xcfff('0x6f')](_0x46b6e0[_0xcfff('0x44')][_0xcfff('0x69')]);}})[_0xcfff('0x20')](respondWithStatusCode(_0x684f0b,null))[_0xcfff('0x56')](handleError(_0x684f0b,null));};exports['notify']=function(_0x53e698,_0x4798ce,_0x1b5f07){var _0x10b4ad={'channel':_0xcfff('0x70')};var _0x4d9026=[];var _0x3c58e6=[];var _0x419058={};return db['SmsAccount'][_0xcfff('0x59')]({'where':{'id':_0x53e698[_0xcfff('0x58')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xcfff('0x71')}]})['then'](handleEntityNotFound(_0x4798ce,null))[_0xcfff('0x20')](function(_0x5561de){_0x10b4ad[_0xcfff('0x72')]=_0x5561de;_0x10b4ad['applications']=_[_0xcfff('0x73')](_0x5561de[_0xcfff('0x71')],[_0xcfff('0x74')],[_0xcfff('0x75')]);if(_0x10b4ad[_0xcfff('0x72')][_0xcfff('0x71')]){delete _0x10b4ad['account'][_0xcfff('0x71')];}return db['CmContact']['describe']();})[_0xcfff('0x20')](function(_0x1e5002){if(!_0x1e5002){throw new db[(_0xcfff('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0x4d9026=_[_0xcfff('0x77')](_['keys'](_0x1e5002),[_0xcfff('0x78'),'updatedAt']);_0x3c58e6=_[_0xcfff('0x77')](_[_0xcfff('0x45')](_0x1e5002),['createdAt',_0xcfff('0x79'),_0xcfff('0x7a'),'ListId']);_0x10b4ad[_0xcfff('0x5b')]={'mapKey':_0xcfff('0x7b')};if(_0x10b4ad[_0xcfff('0x72')]['type']){switch(_0x10b4ad[_0xcfff('0x72')][_0xcfff('0x41')]){case _0xcfff('0x7c'):_0x10b4ad[_0xcfff('0x5b')]['from']=_0x53e698['body']['From'];_0x10b4ad['body']['body']=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x7d')];_0x10b4ad['body'][_0xcfff('0x7e')]=_0x53e698['body'][_0xcfff('0x7f')];break;case _0xcfff('0x80'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]='+'+_0x53e698[_0xcfff('0x5b')][_0xcfff('0x82')];_0x10b4ad['body'][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')]['text'];break;case _0xcfff('0x83'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]=_0x53e698['body'][_0xcfff('0x81')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x27')];break;case _0xcfff('0x84'):_0x10b4ad[_0xcfff('0x5b')]['from']=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x81')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')]=_0x53e698['body'][_0xcfff('0x5b')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x7e')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x85')];break;case _0xcfff('0x86'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x87')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')]['Text'];_0x10b4ad['body'][_0xcfff('0x7e')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x88')];break;case'infobip':_0x10b4ad['body'][_0xcfff('0x81')]='+'+_0x53e698[_0xcfff('0x5b')][_0xcfff('0x89')][0x0]['from'];_0x10b4ad[_0xcfff('0x5b')]['body']=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x89')][0x0][_0xcfff('0x8a')];_0x10b4ad['body'][_0xcfff('0x7e')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x89')][0x0][_0xcfff('0x7e')];break;case _0xcfff('0x8b'):_0x10b4ad[_0xcfff('0x5b')]['from']=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x8c')];_0x10b4ad['body'][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x8d')][_0xcfff('0x27')];break;case _0xcfff('0x8e'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]=_0x53e698['body']['fromNumber'];_0x10b4ad['body'][_0xcfff('0x5b')]=_0x53e698['body'][_0xcfff('0x8a')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x7e')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x8f')];break;case _0xcfff('0x90'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x7e')]=_0x53e698[_0xcfff('0x5b')][0x0][_0xcfff('0x27')]['id'];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]=_0x53e698[_0xcfff('0x5b')][0x0][_0xcfff('0x27')][_0xcfff('0x81')];_0x10b4ad['body'][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')][0x0][_0xcfff('0x27')][_0xcfff('0x8a')];break;case _0xcfff('0x91'):_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x81')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')]=_0x53e698[_0xcfff('0x5b')][_0xcfff('0x27')];_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x7e')]=_0x53e698['body'][_0xcfff('0x92')];break;}}if(_0x10b4ad[_0xcfff('0x5b')]['id']){delete _0x10b4ad[_0xcfff('0x5b')]['id'];}if(_[_0xcfff('0x93')](_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')])){throw new db[(_0xcfff('0x76'))][(_0xcfff('0x94'))](_0xcfff('0x95'));}if(_['isNil'](_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')])||_0x10b4ad['body'][_0xcfff('0x5b')]===''){throw new db['Sequelize'][(_0xcfff('0x94'))](_0xcfff('0x96'));}if(_['isNil'](_0x10b4ad[_0xcfff('0x5b')]['mapKey'])){throw new db[(_0xcfff('0x76'))][(_0xcfff('0x94'))](_0xcfff('0x97')+_0x3c58e6);}if(!_[_0xcfff('0x98')](_0x3c58e6,_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x99')])){throw new db[(_0xcfff('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c58e6);}_0x419058[_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x99')]]=_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')];return db[_0xcfff('0x9a')][_0xcfff('0x59')]({'where':{'id':_0x10b4ad[_0xcfff('0x72')][_0xcfff('0x9b')]},'include':[{'model':db[_0xcfff('0x9c')],'as':_0xcfff('0x9d'),'where':_0x419058,'limit':0x1,'order':[[_0xcfff('0x79'),'DESC']]}]});})[_0xcfff('0x20')](handleEntityNotFound(_0x4798ce,null))['then'](function(_0x4fbea1){if(_0x4fbea1){_0x10b4ad[_0xcfff('0x9e')]=_['omit'](_0x4fbea1,[_0xcfff('0x9d')]);if(_0x4fbea1[_0xcfff('0x9d')]['length']){return _0x4fbea1['Contacts'][0x0];}var _0x3419e8=_[_0xcfff('0x18')](_0x10b4ad[_0xcfff('0x5b')],{'firstName':_0x10b4ad['body'][_0xcfff('0x81')],'ListId':_0x4fbea1['id']});_0x3419e8[_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x99')]]=_0x10b4ad['body']['from'];return db['CmContact'][_0xcfff('0x5a')](_0x3419e8,{'fields':_0x4d9026,'raw':!![]});}})[_0xcfff('0x20')](handleEntityNotFound(_0x4798ce,null))['then'](function(_0x2584e7){if(_0x2584e7){_0x10b4ad['contact']=_0x2584e7;var _0x5f0efe={'ContactId':_0x2584e7['id'],'phone':_0x10b4ad['body'][_0xcfff('0x81')],'SmsAccountId':_0x53e698[_0xcfff('0x58')]['id']};var _0x107057={'ContactId':_0x2584e7['id'],'SmsAccountId':_0x53e698[_0xcfff('0x58')]['id'],'closed':![]};return db[_0xcfff('0x9f')][_0xcfff('0x59')]({'where':_0x107057})[_0xcfff('0x20')](function(_0x2c7b55){if(_0x2c7b55){return[_0x2c7b55,![]];}return db['SmsInteraction']['create'](_0x5f0efe)[_0xcfff('0x20')](function(_0x397b59){return[_0x397b59,!![]];});});}})[_0xcfff('0xa0')](function(_0xf7d58,_0x173aba){_0x10b4ad[_0xcfff('0xa1')]=_0xf7d58[_0xcfff('0x36')]({'plain':!![]});_0x10b4ad[_0xcfff('0xa1')][_0xcfff('0xa2')]=![];if(_0x173aba){if(_0x10b4ad[_0xcfff('0x72')][_0xcfff('0xa3')]){_0x10b4ad[_0xcfff('0xa4')]['push']({'id':0x0,'priority':_0x10b4ad[_0xcfff('0xa4')][_0xcfff('0x49')]+0x1,'app':_0xcfff('0xa5'),'appdata':'unmanaged','interval':_0xcfff('0xa6')});}_0x10b4ad[_0xcfff('0xa1')][_0xcfff('0xa2')]=!![];}return db[_0xcfff('0xa7')][_0xcfff('0x5a')]({'phone':_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x81')],'messageId':_0x10b4ad[_0xcfff('0x5b')]['messageId'],'body':_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0x5b')],'SmsAccountId':_0x53e698[_0xcfff('0x58')]['id'],'SmsInteractionId':_0xf7d58['id'],'direction':'in','ContactId':_0xf7d58['ContactId'],'AttachmentId':_0x10b4ad[_0xcfff('0x5b')][_0xcfff('0xa8')]});})['then'](function(_0x4c1f8e){_0x10b4ad[_0xcfff('0x27')]=_0x4c1f8e;if(_0x10b4ad['interaction'][_0xcfff('0xa9')]){return db['User']['find']({'attributes':['id',_0xcfff('0x39')],'where':{'id':_0x10b4ad[_0xcfff('0xa1')]['UserId']}})[_0xcfff('0x20')](function(_0x1ea0ee){if(_0x1ea0ee){_0x10b4ad[_0xcfff('0xa4')][_0xcfff('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1ea0ee[_0xcfff('0x39')]+','+(_0x10b4ad[_0xcfff('0x72')][_0xcfff('0xab')]||0xa),'interval':_0xcfff('0xa6')});}return respondWithRpcPromise(_0xcfff('0xac'),_0xcfff('0xad'),_0x10b4ad);});}return respondWithRpcPromise(_0xcfff('0xac'),'startRouting',_0x10b4ad);})['then'](function(_0x2bccc3){if(_0x2bccc3){var _0x8d0be3=0xc8;var _0x3d410e=_0xcfff('0xae');logger[_0xcfff('0x28')](_0xcfff('0x24'),_0x3d410e,_0x8d0be3,_0xcfff('0xaf'));logger[_0xcfff('0x23')](_0xcfff('0xb0'),_0x3d410e,_0x8d0be3,_0xcfff('0xaf'),JSON[_0xcfff('0xb1')](_0x2bccc3));if(_0x10b4ad[_0xcfff('0x72')][_0xcfff('0x41')]===_0xcfff('0x7c')){return _0x4798ce[_0xcfff('0x2a')](_0x8d0be3)[_0xcfff('0x30')](_0xcfff('0xb2'),_0xcfff('0xb3'))['send'](_0xcfff('0xb4'));}else{return _0x4798ce[_0xcfff('0x2a')](_0x8d0be3)[_0xcfff('0x32')](_0x2bccc3);}}})[_0xcfff('0x56')](handleError(_0x4798ce,null));};exports[_0xcfff('0xb5')]=function(_0xc4ddcd,_0x51530a){var _0x1c7e21=_0xc4ddcd[_0xcfff('0x58')]['id'];var _0xa3f77c=_0xc4ddcd[_0xcfff('0x5b')];var _0x31147f=0xc8;var _0x34825c=null;return db[_0xcfff('0xb6')][_0xcfff('0xb7')]({'isolationLevel':db[_0xcfff('0xb6')]['Transaction']['ISOLATION_LEVELS'][_0xcfff('0xb8')]},function(_0x574c5c){return db[_0xcfff('0x3e')][_0xcfff('0x6b')]({'where':{'id':_0x1c7e21},'transaction':_0x574c5c})[_0xcfff('0x20')](function(_0x2caf37){if(_0x2caf37){return db[_0xcfff('0xb9')][_0xcfff('0x35')]({'where':{'SmsAccountId':_0x1c7e21},'transaction':_0x574c5c})[_0xcfff('0x20')](function(){var _0x5f3af2=_[_0xcfff('0x3d')](_0xa3f77c,function(_0x3221e5){_0x3221e5[_0xcfff('0x65')]=_0x1c7e21;return _0x3221e5;});return db['SmsApplication'][_0xcfff('0xba')](_0x5f3af2,{'transaction':_0x574c5c});});}else{_0x31147f=0x194;_0x34825c=[];}});})['then'](function(){if(_0x31147f!==0x194){return db[_0xcfff('0xb9')][_0xcfff('0xbb')]({'where':{'SmsAccountId':_0x1c7e21},'order':'priority'})[_0xcfff('0x20')](function(_0x171c9a){_0x34825c=_0x171c9a;});}})['catch'](function(_0x2990f7){_0x31147f=0x1f4;logger[_0xcfff('0x25')](_0x2990f7[_0xcfff('0x38')]);if(_0x2990f7['name']){delete _0x2990f7[_0xcfff('0x39')];}_0x34825c=_0x2990f7;})[_0xcfff('0xbc')](function(){if(_0x34825c===null){_0x51530a[_0xcfff('0x29')](_0x31147f);}else{if(_0x31147f===0x1f4){_0x51530a[_0xcfff('0x2a')](_0x31147f)[_0xcfff('0x3a')](_0x34825c);}else{_0x51530a[_0xcfff('0x2a')](_0x31147f)[_0xcfff('0x32')](_0x34825c);}}});};exports[_0xcfff('0xbd')]=function(_0x4997bf,_0x1c17f7,_0x41415e){var _0x44fd14={};var _0x1b10ac={};var _0x36c5ca;var _0x175792;return db[_0xcfff('0x3e')][_0xcfff('0x6b')]({'where':{'id':_0x4997bf['params']['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x1c17f7,null))['then'](function(_0x362e28){if(_0x362e28){_0x36c5ca=_0x362e28;_0x1b10ac[_0xcfff('0x43')]=_[_0xcfff('0x45')](db[_0xcfff('0xb9')][_0xcfff('0x3f')]);_0x1b10ac['query']=_['keys'](_0x4997bf['query']);_0x1b10ac[_0xcfff('0x46')]=_[_0xcfff('0x68')](_0x1b10ac[_0xcfff('0x43')],_0x1b10ac[_0xcfff('0x44')]);_0x44fd14['attributes']=_[_0xcfff('0x68')](_0x1b10ac[_0xcfff('0x43')],qs[_0xcfff('0x48')](_0x4997bf[_0xcfff('0x44')]['fields']));_0x44fd14[_0xcfff('0x47')]=_0x44fd14[_0xcfff('0x47')]['length']?_0x44fd14[_0xcfff('0x47')]:_0x1b10ac[_0xcfff('0x43')];_0x44fd14[_0xcfff('0x6e')]=qs[_0xcfff('0x4b')](_0x4997bf[_0xcfff('0x44')]['sort']);_0x44fd14[_0xcfff('0x4d')]=qs['filters'](_[_0xcfff('0x4c')](_0x4997bf[_0xcfff('0x44')],_0x1b10ac[_0xcfff('0x46')]));if(_0x4997bf[_0xcfff('0x44')][_0xcfff('0x50')]){_0x44fd14[_0xcfff('0x4d')]=_['merge'](_0x44fd14['where'],{'$or':_[_0xcfff('0x3d')](_0x44fd14['attributes'],function(_0x41401e){var _0x415fd4={};_0x415fd4[_0x41401e]={'$like':'%'+_0x4997bf['query']['filter']+'%'};return _0x415fd4;})});}_0x44fd14=_[_0xcfff('0x4e')]({},_0x44fd14,_0x4997bf[_0xcfff('0x51')]);return _0x36c5ca[_0xcfff('0xbd')](_0x44fd14);}})[_0xcfff('0x20')](function(_0x4c8737){if(_0x4c8737){_0x175792=_0x4c8737[_0xcfff('0x49')];if(!_0x4997bf[_0xcfff('0x44')][_0xcfff('0x4a')](_0xcfff('0x6d'))){_0x44fd14[_0xcfff('0x2d')]=qs[_0xcfff('0x2d')](_0x4997bf['query']['limit']);_0x44fd14[_0xcfff('0x2c')]=qs[_0xcfff('0x2c')](_0x4997bf['query'][_0xcfff('0x2c')]);}return _0x36c5ca[_0xcfff('0xbd')](_0x44fd14);}})[_0xcfff('0x20')](function(_0x127aeb){if(_0x127aeb){return _0x127aeb?{'count':_0x175792,'rows':_0x127aeb}:null;}})['then'](respondWithResult(_0x1c17f7,null))['catch'](handleError(_0x1c17f7,null));};exports['getInteractions']=function(_0x2c79e0,_0x39e73f,_0x1022a){var _0x5348a1={'raw':![],'where':{}};var _0x7e3553={};var _0x5e402e={'count':0x0,'rows':[]};return db[_0xcfff('0x3e')]['findOne']({'where':{'id':_0x2c79e0['params']['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x39e73f,null))['then'](function(_0x28c7db){if(_0x28c7db){_0x7e3553[_0xcfff('0x43')]=_[_0xcfff('0x45')](db['SmsInteraction']['rawAttributes']);_0x7e3553['query']=_[_0xcfff('0x45')](_0x2c79e0[_0xcfff('0x44')]);_0x7e3553[_0xcfff('0x46')]=_[_0xcfff('0x68')](_0x7e3553[_0xcfff('0x43')],_0x7e3553[_0xcfff('0x44')]);_0x5348a1[_0xcfff('0x47')]=_['intersection'](_0x7e3553[_0xcfff('0x43')],qs[_0xcfff('0x48')](_0x2c79e0[_0xcfff('0x44')]['fields']));_0x5348a1[_0xcfff('0x47')]=_0x5348a1[_0xcfff('0x47')]['length']?_0x5348a1[_0xcfff('0x47')]:_0x7e3553[_0xcfff('0x43')];if(!_0x2c79e0[_0xcfff('0x44')][_0xcfff('0x4a')](_0xcfff('0x6d'))){_0x5348a1['limit']=qs[_0xcfff('0x2d')](_0x2c79e0['query'][_0xcfff('0x2d')]);_0x5348a1[_0xcfff('0x2c')]=qs[_0xcfff('0x2c')](_0x2c79e0[_0xcfff('0x44')][_0xcfff('0x2c')]);}_0x5348a1[_0xcfff('0x6e')]=qs[_0xcfff('0x4b')](_0x2c79e0[_0xcfff('0x44')]['sort']);_0x5348a1[_0xcfff('0x4d')]=qs[_0xcfff('0x46')](_[_0xcfff('0x4c')](_0x2c79e0[_0xcfff('0x44')],_0x7e3553['filters']));_0x5348a1[_0xcfff('0x4d')][_0xcfff('0x65')]=_0x28c7db['id'];if(_0x2c79e0[_0xcfff('0x44')][_0xcfff('0x50')]){_0x5348a1[_0xcfff('0x4d')]=_[_0xcfff('0x4e')](_0x5348a1['where'],{'$or':_['map'](_0x5348a1[_0xcfff('0x47')],function(_0x1df084){var _0x2f1976={};_0x2f1976[_0x1df084]={'$like':'%'+_0x2c79e0[_0xcfff('0x44')]['filter']+'%'};return _0x2f1976;})});}_0x5348a1=_['merge']({},_0x5348a1,_0x2c79e0['options']);return db[_0xcfff('0x9f')]['count']({'where':_0x5348a1[_0xcfff('0x4d')]})[_0xcfff('0x20')](function(_0x5a7acc){_0x5e402e['count']=_0x5a7acc;if(_0x2c79e0[_0xcfff('0x44')][_0xcfff('0x52')]){_0x5348a1[_0xcfff('0x53')]=[{'model':db[_0xcfff('0x9c')],'as':_0xcfff('0xbe'),'required':![]},{'model':db[_0xcfff('0xbf')],'as':_0xcfff('0xc0'),'attributes':[_0xcfff('0x39'),_0xcfff('0xc1'),_0xcfff('0xc2')],'required':![]},{'model':db[_0xcfff('0xc3')],'as':'Tags','attributes':['id',_0xcfff('0x39'),_0xcfff('0xc4')],'where':_0x2c79e0[_0xcfff('0x44')][_0xcfff('0xc5')]?{'id':_0x2c79e0[_0xcfff('0x44')][_0xcfff('0xc5')]}:undefined,'required':_0x2c79e0[_0xcfff('0x44')][_0xcfff('0xc5')]?!![]:![]}];}return db[_0xcfff('0x9f')][_0xcfff('0x54')](_0x5348a1);})[_0xcfff('0x20')](function(_0x467c32){_0x5e402e[_0xcfff('0x55')]=_0x467c32;return _0x5e402e;});}})[_0xcfff('0x20')](respondWithFilteredResult(_0x39e73f,_0x5348a1))[_0xcfff('0x56')](handleError(_0x39e73f,null));};exports[_0xcfff('0x3a')]=function(_0xb5564b,_0x9c66c9,_0x202630){var _0x459c70,_0x55712c,_0x1c2947;if(_[_0xcfff('0x93')](_0xb5564b['body'][_0xcfff('0x5b')])||_0xb5564b['body'][_0xcfff('0x5b')]===''){throw new db['Sequelize'][(_0xcfff('0x94'))](_0xcfff('0x96'));}if(_['isNil'](_0xb5564b['body']['to'])){throw new db[(_0xcfff('0x76'))][(_0xcfff('0x94'))](_0xcfff('0xc6'));}_0x459c70=_0xb5564b['body']['to'];return db[_0xcfff('0x3e')]['find']({'where':{'id':_0xb5564b[_0xcfff('0x58')]['id']},'include':[{'model':db[_0xcfff('0x9a')],'as':_0xcfff('0xc7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x459c70},'limit':0x1,'order':[[_0xcfff('0x79'),_0xcfff('0xc8')]]}]}]})[_0xcfff('0x20')](handleEntityNotFound(_0x9c66c9,null))[_0xcfff('0x20')](function(_0x37ce48){if(_0x37ce48&&_0x37ce48[_0xcfff('0xc7')]){_0x55712c=_0x37ce48['get']({'plain':!![]});if(_0x55712c['List']&&_0x55712c[_0xcfff('0xc7')]['Contacts'][_0xcfff('0x49')]){return _0x55712c['List'][_0xcfff('0x9d')][0x0];}return db[_0xcfff('0x9c')][_0xcfff('0x5a')](_['defaults'](_0xb5564b[_0xcfff('0x5b')],{'firstName':_0x459c70,'mobile':_0x459c70,'phone':_0x459c70,'ListId':_0x55712c[_0xcfff('0x9b')]}));}})[_0xcfff('0x20')](handleEntityNotFound(_0x9c66c9,null))[_0xcfff('0x20')](function(_0x31c915){if(_0x31c915){_0x1c2947=_0x31c915;return db['SmsInteraction'][_0xcfff('0x59')]({'where':{'ContactId':_0x1c2947['id'],'closed':![],'SmsAccountId':_0x55712c['id']}})[_0xcfff('0x20')](function(_0x3ab9f0){if(_0x3ab9f0){return[_0x3ab9f0,![]];}return db['SmsInteraction'][_0xcfff('0x5a')]({'UserId':_0xb5564b['user']['id'],'ContactId':_0x1c2947['id'],'SmsAccountId':_0x55712c['id'],'phone':_0x459c70,'firstMsgDirection':'out','Messages':[_[_0xcfff('0x4e')](_0xb5564b[_0xcfff('0x5b')],{'read':![],'body':_0xb5564b[_0xcfff('0x5b')][_0xcfff('0x5b')],'phone':_0x459c70,'SmsAccountId':_0x55712c['id'],'UserId':_0xb5564b[_0xcfff('0x5e')]['id'],'ContactId':_0x1c2947['id']})]},{'include':[{'model':db[_0xcfff('0xa7')],'as':_0xcfff('0xc9')}]})[_0xcfff('0x20')](function(_0x1d6331){return[_0x1d6331,!![]];});});}})[_0xcfff('0xa0')](function(_0x2d577a,_0x422ff8){if(_0x422ff8){return _0x2d577a;}return db[_0xcfff('0xa7')][_0xcfff('0x5a')](_[_0xcfff('0x4e')](_0xb5564b[_0xcfff('0x5b')],{'read':![],'body':_0xb5564b[_0xcfff('0x5b')][_0xcfff('0x5b')],'phone':_0x459c70,'SmsAccountId':_0x55712c['id'],'SmsInteractionId':_0x2d577a['id'],'UserId':_0xb5564b[_0xcfff('0x5e')]['id'],'ContactId':_0x1c2947['id']}))[_0xcfff('0x20')](function(_0x1aad5d){_0x2d577a['dataValues'][_0xcfff('0xc9')]=[];_0x2d577a[_0xcfff('0xca')]['Messages'][_0xcfff('0xcb')](_0x1aad5d[_0xcfff('0xca')]);return _0x2d577a;});})[_0xcfff('0x20')](respondWithResult(_0x9c66c9,null))[_0xcfff('0x56')](handleError(_0x9c66c9,null));};exports['status']=function(_0x163b6e,_0x2e21ef,_0x407f5d){if(_0x163b6e['body']['id']){delete _0x163b6e[_0xcfff('0x5b')]['id'];}var _0x7d2e20,_0x302add,_0x414aaa;return db[_0xcfff('0x3e')][_0xcfff('0x59')]({'where':{'id':_0x163b6e[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x2e21ef,null))[_0xcfff('0x20')](function(_0x574bd4){if(_0x574bd4){_0x414aaa=_0x574bd4;logger['debug'](_0xcfff('0x24'),_0xcfff('0x2a'),'received\x20delivery\x20report\x20from',_0x574bd4[_0xcfff('0x41')],util[_0xcfff('0xcc')](_0x163b6e['body'],{'showHidden':![],'depth':null}));switch(_0x574bd4[_0xcfff('0x41')]){case _0xcfff('0x80'):if(_0x163b6e[_0xcfff('0x5b')][_0xcfff('0xcd')]&&_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x2a')]){_0x302add=_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x2a')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e[_0xcfff('0x5b')][_0xcfff('0xcd')]}});}break;case'connectel':if(_0x163b6e[_0xcfff('0x5b')][_0xcfff('0xce')]&&_0x163b6e['body']['statusInt']){_0x302add=_0x163b6e['body'][_0xcfff('0xcf')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e['body'][_0xcfff('0xce')]}});}break;case _0xcfff('0x84'):if(_0x163b6e['body']['message_id']&&_0x163b6e['body'][_0xcfff('0xd0')]){_0x302add=_0x163b6e['body'][_0xcfff('0xd0')];return db['SmsMessage'][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e['body'][_0xcfff('0x85')]}});}break;case'infobip':var _0x48a30f=_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x89')][0x0];if(_0x48a30f[_0xcfff('0x7e')]&&_0x48a30f[_0xcfff('0x2a')][_0xcfff('0xd1')]===_0xcfff('0xd2')){_0x302add=_0x48a30f[_0xcfff('0x2a')][_0xcfff('0xd1')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x48a30f[_0xcfff('0x7e')]}});}break;case _0xcfff('0x8e'):if(_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x7e')]&&_0x163b6e[_0xcfff('0x5b')]['status']){_0x302add=_0x163b6e['body'][_0xcfff('0x2a')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x7e')]}});}break;case'bandwidth':if(_0x163b6e[_0xcfff('0x5b')][0x0]['message']['id']){_0x302add=_0x163b6e['body'][0x0][_0xcfff('0x41')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e['body'][0x0]['message']['id']}});}break;case _0xcfff('0x91'):if(_0x163b6e[_0xcfff('0x5b')]['redif']&&_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x2a')]){_0x302add=_0x163b6e[_0xcfff('0x5b')][_0xcfff('0x2a')];return db[_0xcfff('0xa7')][_0xcfff('0x59')]({'where':{'messageId':_0x163b6e['body'][_0xcfff('0xd3')]}});}break;}}})[_0xcfff('0x20')](handleEntityNotFound(_0x2e21ef,null))[_0xcfff('0x20')](function(_0x3735ac){if(_0x3735ac){_0x7d2e20=_0x3735ac;switch(_0x414aaa[_0xcfff('0x41')]){case _0xcfff('0x80'):if(_0x302add===_0xcfff('0xd2')){return _0x7d2e20[_0xcfff('0xd4')]({'read':!![]});}else{logger[_0xcfff('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xcfff('0x80'),util[_0xcfff('0xcc')](_0x163b6e[_0xcfff('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xcfff('0x83'):if(_0x302add==='1'){return _0x7d2e20[_0xcfff('0xd4')]({'read':!![]});}else{logger[_0xcfff('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcfff('0x2a'),_0xcfff('0x80'),util[_0xcfff('0xcc')](_0x163b6e[_0xcfff('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xcfff('0x84'):if(!_0x163b6e[_0xcfff('0x5b')][_0xcfff('0xd5')]&&_0x302add>=0xc8&&_0x302add<=0xce){return _0x7d2e20[_0xcfff('0xd4')]({'read':!![]});}else{logger['error'](_0xcfff('0x24'),_0xcfff('0x2a'),_0xcfff('0x84'),util[_0xcfff('0xcc')](_0x163b6e['body'],{'showHidden':![],'depth':null}));}break;case _0xcfff('0xd6'):var _0x53a94e=_0x163b6e[_0xcfff('0x5b')]['results'][0x0];if(_0x53a94e['status'][_0xcfff('0xd1')]===_0xcfff('0xd2')){return _0x7d2e20[_0xcfff('0xd4')]({'read':!![]});}else{logger[_0xcfff('0x25')](_0xcfff('0x24'),_0xcfff('0x2a'),_0xcfff('0xd6'),util[_0xcfff('0xcc')](_0x163b6e[_0xcfff('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x302add==_0xcfff('0xd7')||_0x302add==_0xcfff('0xd8')){return _0x7d2e20['update']({'read':!![]});}else{logger['error'](_0xcfff('0x24'),'status',_0xcfff('0x8e'),util[_0xcfff('0xcc')](_0x163b6e['body'],{'showHidden':![],'depth':null}));}break;case _0xcfff('0x90'):if(_0x302add==_0xcfff('0xd9')){return _0x7d2e20['update']({'read':!![]});}else{logger[_0xcfff('0x25')](_0xcfff('0x24'),_0xcfff('0x2a'),_0xcfff('0x90'),util['inspect'](_0x163b6e['body'],{'showHidden':![],'depth':null}));}break;case _0xcfff('0x91'):if(_0x302add===_0xcfff('0xda')||_0x302add===_0xcfff('0xdb')){return _0x7d2e20[_0xcfff('0xd4')]({'read':!![]});}else{logger[_0xcfff('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcfff('0x2a'),_0xcfff('0x91'),util[_0xcfff('0xcc')](_0x163b6e[_0xcfff('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x7d2e20;}})['then'](respondWithResult(_0x2e21ef,null))[_0xcfff('0x56')](handleError(_0x2e21ef,null));};exports[_0xcfff('0xdc')]=function(_0x3bd775,_0x4d57c4,_0x2a2cbc){var _0x37b092,_0x374606,_0xe4e74f;return db[_0xcfff('0x3e')]['find']({'where':{'id':_0x3bd775[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x4d57c4,null))['then'](function(_0x1e483a){if(_0x1e483a){_0xe4e74f=_0x1e483a;logger['debug'](_0xcfff('0x24'),_0xcfff('0x2a'),'received\x20delivery\x20report\x20from',_0x1e483a[_0xcfff('0x41')],util[_0xcfff('0xcc')](_0x3bd775[_0xcfff('0x44')],{'showHidden':![],'depth':null}));switch(_0x1e483a[_0xcfff('0x41')]){case _0xcfff('0x8b'):if(_0x3bd775[_0xcfff('0x44')][_0xcfff('0xdd')]&&_0x3bd775[_0xcfff('0x44')][_0xcfff('0xde')]){_0x374606=_0x3bd775[_0xcfff('0x44')][_0xcfff('0xde')];return db[_0xcfff('0xa7')]['find']({'where':{'messageId':_0x3bd775[_0xcfff('0x44')][_0xcfff('0xdd')]}});}break;}}})['then'](handleEntityNotFound(_0x4d57c4,null))[_0xcfff('0x20')](function(_0x59c829){if(_0x59c829){_0x37b092=_0x59c829;switch(_0xe4e74f[_0xcfff('0x41')]){case _0xcfff('0x8b'):if(_0x374606==='2'||_0x374606==='6'){return _0x37b092['update']({'read':!![]});}else{logger[_0xcfff('0x25')](_0xcfff('0x24'),_0xcfff('0x2a'),_0xcfff('0x8b'),util[_0xcfff('0xcc')](_0x3bd775[_0xcfff('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x37b092;}})[_0xcfff('0x20')](respondWithResult(_0x4d57c4,null))[_0xcfff('0x56')](handleError(_0x4d57c4,null));};exports[_0xcfff('0xdf')]=function(_0x47978b,_0x242982,_0x4e2929){return db['SmsAccount'][_0xcfff('0x59')]({'where':{'id':_0x47978b[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x242982,null))[_0xcfff('0x20')](function(_0x3dfcfd){if(_0x3dfcfd){return _0x3dfcfd[_0xcfff('0xdf')](_0x47978b['body']['ids'],_[_0xcfff('0xe0')](_0x47978b['body'],[_0xcfff('0x69'),'id'])||{})['spread'](function(_0x384ef6){for(var _0x5b0766=0x0;_0x5b0766<_0x47978b['body'][_0xcfff('0x69')]['length'];_0x5b0766+=0x1){socket[_0xcfff('0xe1')](_0xcfff('0xe2'),{'UserId':Number(_0x47978b['body'][_0xcfff('0x69')][_0x5b0766]),'SmsAccountId':Number(_0x47978b['params']['id'])});}return _0x384ef6;});}})[_0xcfff('0x20')](respondWithResult(_0x242982,null))[_0xcfff('0x56')](handleError(_0x242982,null));};exports[_0xcfff('0xe3')]=function(_0x335b96,_0x3dafbc,_0x202c83){return db[_0xcfff('0x3e')]['find']({'where':{'id':_0x335b96[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x3dafbc,null))[_0xcfff('0x20')](function(_0x365e32){if(_0x365e32){return _0x365e32['removeAgents'](_0x335b96[_0xcfff('0x44')][_0xcfff('0x69')])['then'](function(){if(_['isArray'](_0x335b96[_0xcfff('0x44')][_0xcfff('0x69')])){for(var _0xae4d24=0x0;_0xae4d24<_0x335b96[_0xcfff('0x44')][_0xcfff('0x69')]['length'];_0xae4d24+=0x1){socket[_0xcfff('0xe1')](_0xcfff('0xe4'),{'UserId':Number(_0x335b96['query'][_0xcfff('0x69')][_0xae4d24]),'SmsAccountId':Number(_0x335b96[_0xcfff('0x58')]['id'])});}}else{socket[_0xcfff('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x335b96[_0xcfff('0x44')][_0xcfff('0x69')]),'SmsAccountId':Number(_0x335b96[_0xcfff('0x58')]['id'])});}});}})[_0xcfff('0x20')](respondWithStatusCode(_0x3dafbc,null))[_0xcfff('0x56')](handleError(_0x3dafbc,null));};exports[_0xcfff('0xe5')]=function(_0x156952,_0x28b978,_0x22cdd1){var _0x47ea42={};var _0x3e0e57={};var _0x1f19b6;var _0x2d1e26;return db[_0xcfff('0x3e')][_0xcfff('0x6b')]({'where':{'id':_0x156952[_0xcfff('0x58')]['id']}})[_0xcfff('0x20')](handleEntityNotFound(_0x28b978,null))[_0xcfff('0x20')](function(_0x539163){if(_0x539163){_0x1f19b6=_0x539163;_0x3e0e57['model']=_[_0xcfff('0x45')](db[_0xcfff('0xbf')]['rawAttributes']);_0x3e0e57[_0xcfff('0x44')]=_[_0xcfff('0x45')](_0x156952[_0xcfff('0x44')]);_0x3e0e57[_0xcfff('0x46')]=_[_0xcfff('0x68')](_0x3e0e57[_0xcfff('0x43')],_0x3e0e57[_0xcfff('0x44')]);_0x47ea42[_0xcfff('0x47')]=_[_0xcfff('0x68')](_0x3e0e57[_0xcfff('0x43')],qs[_0xcfff('0x48')](_0x156952[_0xcfff('0x44')]['fields']));_0x47ea42[_0xcfff('0x47')]=_0x47ea42[_0xcfff('0x47')][_0xcfff('0x49')]?_0x47ea42[_0xcfff('0x47')]:_0x3e0e57[_0xcfff('0x43')];_0x47ea42[_0xcfff('0x6e')]=qs['sort'](_0x156952[_0xcfff('0x44')][_0xcfff('0x4b')]);_0x47ea42[_0xcfff('0x4d')]=qs[_0xcfff('0x46')](_['pick'](_0x156952[_0xcfff('0x44')],_0x3e0e57[_0xcfff('0x46')]));if(_0x156952[_0xcfff('0x44')][_0xcfff('0x50')]){_0x47ea42[_0xcfff('0x4d')]=_[_0xcfff('0x4e')](_0x47ea42[_0xcfff('0x4d')],{'$or':_[_0xcfff('0x3d')](_0x47ea42[_0xcfff('0x47')],function(_0x5a2ce7){var _0x1bcc21={};_0x1bcc21[_0x5a2ce7]={'$like':'%'+_0x156952['query'][_0xcfff('0x50')]+'%'};return _0x1bcc21;})});}_0x47ea42=_[_0xcfff('0x4e')]({},_0x47ea42,_0x156952['options']);return _0x1f19b6[_0xcfff('0xe5')](_0x47ea42);}})[_0xcfff('0x20')](function(_0x1857df){if(_0x1857df){_0x2d1e26=_0x1857df[_0xcfff('0x49')];if(!_0x156952[_0xcfff('0x44')][_0xcfff('0x4a')](_0xcfff('0x6d'))){_0x47ea42[_0xcfff('0x2d')]=qs[_0xcfff('0x2d')](_0x156952[_0xcfff('0x44')]['limit']);_0x47ea42[_0xcfff('0x2c')]=qs['offset'](_0x156952[_0xcfff('0x44')][_0xcfff('0x2c')]);}return _0x1f19b6['getAgents'](_0x47ea42);}})[_0xcfff('0x20')](function(_0x4020cb){if(_0x4020cb){return _0x4020cb?{'count':_0x2d1e26,'rows':_0x4020cb}:null;}})[_0xcfff('0x20')](respondWithResult(_0x28b978,null))['catch'](handleError(_0x28b978,null));}; \ No newline at end of file +var _0x27d4=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','Pause','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','SmsAccounts','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','SmsAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','asc','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','From','Body','skebby','from','sender','text','connectel','clicksend','Text','messageId','MessageUUID','infobip','csc','originatingAddress','clickatell','fromNumber','bandwidth','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','push','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','results','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','intelepeer','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','keys','query'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x27d4,0x187));var _0x427d=function(_0x5d9f80,_0x1695f4){_0x5d9f80=_0x5d9f80-0x0;var _0x3fbe5b=_0x27d4[_0x5d9f80];return _0x3fbe5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x427d('0x0'));var jsonpatch=require(_0x427d('0x1'));var rp=require(_0x427d('0x2'));var moment=require('moment');var BPromise=require(_0x427d('0x3'));var Mustache=require(_0x427d('0x4'));var util=require(_0x427d('0x5'));var path=require(_0x427d('0x6'));var sox=require(_0x427d('0x7'));var csv=require(_0x427d('0x8'));var ejs=require(_0x427d('0x9'));var fs=require('fs');var fs_extra=require(_0x427d('0xa'));var _=require('lodash');var squel=require(_0x427d('0xb'));var crypto=require(_0x427d('0xc'));var jsforce=require(_0x427d('0xd'));var deskjs=require(_0x427d('0xe'));var toCsv=require(_0x427d('0x8'));var querystring=require(_0x427d('0xf'));var Papa=require(_0x427d('0x10'));var Redis=require(_0x427d('0x11'));var authService=require(_0x427d('0x12'));var qs=require(_0x427d('0x13'));var as=require(_0x427d('0x14'));var hardwareService=require(_0x427d('0x15'));var logger=require('../../config/logger')(_0x427d('0x16'));var utils=require(_0x427d('0x17'));var config=require(_0x427d('0x18'));var licenseUtil=require(_0x427d('0x19'));var db=require(_0x427d('0x1a'))['db'];config[_0x427d('0x1b')]=_[_0x427d('0x1c')](config[_0x427d('0x1b')],{'host':_0x427d('0x1d'),'port':0x18eb});var socket=require(_0x427d('0x1e'))(new Redis(config[_0x427d('0x1b')]));require(_0x427d('0x1f'))['register'](socket);var jayson=require(_0x427d('0x20'));var client=jayson[_0x427d('0x21')][_0x427d('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x5cc2c4,_0x541547,_0x50b045,_0x11de23){return new BPromise(function(_0x22c3c0,_0x4e5577){var _0x4003b0=_0x11de23||client;return _0x4003b0['request'](_0x5cc2c4,_0x50b045)[_0x427d('0x23')](function(_0x35a423){logger[_0x427d('0x24')](_0x427d('0x25'),_0x541547,_0x427d('0x26'));logger[_0x427d('0x27')](_0x427d('0x28'),_0x541547,'request\x20sent',JSON[_0x427d('0x29')](_0x35a423));if(_0x35a423[_0x427d('0x2a')]){if(_0x35a423[_0x427d('0x2a')][_0x427d('0x2b')]===0x1f4){logger['error'](_0x427d('0x25'),_0x541547,_0x35a423[_0x427d('0x2a')][_0x427d('0x2c')]);return _0x4e5577(_0x35a423[_0x427d('0x2a')]['message']);}logger[_0x427d('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x541547,_0x35a423['error'][_0x427d('0x2c')]);return _0x22c3c0(_0x35a423[_0x427d('0x2a')]['message']);}else{logger[_0x427d('0x24')]('SmsAccount,\x20%s,\x20%s',_0x541547,'request\x20sent');_0x22c3c0(_0x35a423[_0x427d('0x2d')][_0x427d('0x2c')]);}})['catch'](function(_0x59aaa4){logger[_0x427d('0x2a')](_0x427d('0x25'),_0x541547,_0x59aaa4);_0x4e5577(_0x59aaa4);});});}function respondWithStatusCode(_0x2dab13,_0x471118){_0x471118=_0x471118||0xcc;return function(_0x10efe7){if(_0x10efe7){return _0x2dab13[_0x427d('0x2e')](_0x471118);}return _0x2dab13['status'](_0x471118)['end']();};}function respondWithResult(_0x2321fc,_0x478f7a){_0x478f7a=_0x478f7a||0xc8;return function(_0x2d47b2){if(_0x2d47b2){return _0x2321fc[_0x427d('0x2f')](_0x478f7a)[_0x427d('0x30')](_0x2d47b2);}};}function respondWithFilteredResult(_0x4a67d6,_0x2eba8a){return function(_0x4bdd5c){if(_0x4bdd5c){var _0x43d15e=typeof _0x2eba8a[_0x427d('0x31')]==='undefined'&&typeof _0x2eba8a[_0x427d('0x32')]===_0x427d('0x33');var _0x3d032b=_0x4bdd5c[_0x427d('0x34')];var _0x34eec3=_0x43d15e?0x0:_0x2eba8a[_0x427d('0x31')];var _0x121571=_0x43d15e?_0x4bdd5c[_0x427d('0x34')]:_0x2eba8a[_0x427d('0x31')]+_0x2eba8a[_0x427d('0x32')];var _0x411e8e;if(_0x121571>=_0x3d032b){_0x121571=_0x3d032b;_0x411e8e=0xc8;}else{_0x411e8e=0xce;}_0x4a67d6['status'](_0x411e8e);return _0x4a67d6[_0x427d('0x35')](_0x427d('0x36'),_0x34eec3+'-'+_0x121571+'/'+_0x3d032b)[_0x427d('0x30')](_0x4bdd5c);}return null;};}function patchUpdates(_0xdeb4dd){return function(_0x79a0c0){try{jsonpatch[_0x427d('0x37')](_0x79a0c0,_0xdeb4dd,!![]);}catch(_0x46ca89){return BPromise[_0x427d('0x38')](_0x46ca89);}return _0x79a0c0[_0x427d('0x39')]();};}function saveUpdates(_0x2db67b,_0x2bdb9d){return function(_0x393587){if(_0x393587){return _0x393587[_0x427d('0x3a')](_0x2db67b)['then'](function(_0x3e4190){return _0x3e4190;});}return null;};}function removeEntity(_0x4c1f58,_0x14d67c){return function(_0x1defdd){if(_0x1defdd){return _0x1defdd[_0x427d('0x3b')]()['then'](function(){var _0x28d137=_0x1defdd['get']({'plain':!![]});var _0x18959b='SmsAccounts';return db[_0x427d('0x3c')]['destroy']({'where':{'type':_0x18959b,'resourceId':_0x28d137['id']}})[_0x427d('0x23')](function(){return _0x1defdd;});})['then'](function(){_0x4c1f58[_0x427d('0x2f')](0xcc)[_0x427d('0x3d')]();});}};}function handleEntityNotFound(_0xf674f0,_0xef2b1d){return function(_0x6098a6){if(!_0x6098a6){_0xf674f0[_0x427d('0x2e')](0x194);}return _0x6098a6;};}function handleError(_0x324226,_0x5c80d2){_0x5c80d2=_0x5c80d2||0x1f4;return function(_0x3c84c0){logger[_0x427d('0x2a')](_0x3c84c0[_0x427d('0x3e')]);if(_0x3c84c0[_0x427d('0x3f')]){delete _0x3c84c0[_0x427d('0x3f')];}_0x324226[_0x427d('0x2f')](_0x5c80d2)[_0x427d('0x40')](_0x3c84c0);};}exports[_0x427d('0x41')]=function(_0xb40754,_0x22f9c2){var _0x3bdc60={'include':[{'model':db['Pause'],'as':_0x427d('0x42')}]},_0x4c9028={},_0x37bad5={'count':0x0,'rows':[]};var _0x24d3af=_[_0x427d('0x43')](db[_0x427d('0x44')][_0x427d('0x45')],function(_0x5112f7){return{'name':_0x5112f7['fieldName'],'type':_0x5112f7[_0x427d('0x46')][_0x427d('0x47')]};});_0x4c9028[_0x427d('0x48')]=_[_0x427d('0x43')](_0x24d3af,_0x427d('0x3f'));_0x4c9028['query']=_[_0x427d('0x49')](_0xb40754[_0x427d('0x4a')]);_0x4c9028[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x4c9028[_0x427d('0x48')],_0x4c9028[_0x427d('0x4a')]);_0x3bdc60['attributes']=_[_0x427d('0x4c')](_0x4c9028[_0x427d('0x48')],qs[_0x427d('0x4d')](_0xb40754[_0x427d('0x4a')]['fields']));_0x3bdc60[_0x427d('0x4e')]=_0x3bdc60[_0x427d('0x4e')][_0x427d('0x4f')]?_0x3bdc60['attributes']:_0x4c9028[_0x427d('0x48')];if(!_0xb40754['query'][_0x427d('0x50')](_0x427d('0x51'))){_0x3bdc60[_0x427d('0x32')]=qs['limit'](_0xb40754[_0x427d('0x4a')]['limit']);_0x3bdc60[_0x427d('0x31')]=qs[_0x427d('0x31')](_0xb40754['query'][_0x427d('0x31')]);}_0x3bdc60[_0x427d('0x52')]=qs[_0x427d('0x53')](_0xb40754[_0x427d('0x4a')]['sort']);_0x3bdc60[_0x427d('0x54')]=qs['filters'](_[_0x427d('0x55')](_0xb40754['query'],_0x4c9028[_0x427d('0x4b')]),_0x24d3af);if(_0xb40754[_0x427d('0x4a')][_0x427d('0x56')]){_0x3bdc60[_0x427d('0x54')]=_['merge'](_0x3bdc60[_0x427d('0x54')],{'$or':_[_0x427d('0x43')](_0x24d3af,function(_0x551ed6){if(_0x551ed6[_0x427d('0x46')]!==_0x427d('0x57')){var _0x41eff0={};_0x41eff0[_0x551ed6[_0x427d('0x3f')]]={'$like':'%'+_0xb40754[_0x427d('0x4a')]['filter']+'%'};return _0x41eff0;}})});}_0x3bdc60=_[_0x427d('0x58')]({},_0x3bdc60,_0xb40754[_0x427d('0x59')]);var _0x126590={'where':_0x3bdc60['where']};return db[_0x427d('0x44')]['count'](_0x126590)[_0x427d('0x23')](function(_0x32ea0b){_0x37bad5['count']=_0x32ea0b;if(_0xb40754[_0x427d('0x4a')]['includeAll']){_0x3bdc60[_0x427d('0x5a')]=[{'all':!![]}];}return db['SmsAccount'][_0x427d('0x5b')](_0x3bdc60);})['then'](function(_0x38e2f6){_0x37bad5[_0x427d('0x5c')]=_0x38e2f6;return _0x37bad5;})[_0x427d('0x23')](respondWithFilteredResult(_0x22f9c2,_0x3bdc60))[_0x427d('0x5d')](handleError(_0x22f9c2,null));};exports['show']=function(_0x41bd6c,_0x562d85){var _0x55bc4c={'raw':![],'where':{'id':_0x41bd6c['params']['id']},'include':[{'model':db[_0x427d('0x5e')],'as':_0x427d('0x42')}]},_0x434514={};_0x434514['model']=_[_0x427d('0x49')](db[_0x427d('0x44')]['rawAttributes']);_0x434514[_0x427d('0x4a')]=_[_0x427d('0x49')](_0x41bd6c[_0x427d('0x4a')]);_0x434514[_0x427d('0x4b')]=_['intersection'](_0x434514[_0x427d('0x48')],_0x434514[_0x427d('0x4a')]);_0x55bc4c[_0x427d('0x4e')]=_[_0x427d('0x4c')](_0x434514[_0x427d('0x48')],qs[_0x427d('0x4d')](_0x41bd6c[_0x427d('0x4a')]['fields']));_0x55bc4c[_0x427d('0x4e')]=_0x55bc4c[_0x427d('0x4e')][_0x427d('0x4f')]?_0x55bc4c['attributes']:_0x434514[_0x427d('0x48')];if(_0x41bd6c['query'][_0x427d('0x5f')]){_0x55bc4c[_0x427d('0x5a')]=[{'all':!![]}];}_0x55bc4c=_[_0x427d('0x58')]({},_0x55bc4c,_0x41bd6c['options']);return db['SmsAccount']['find'](_0x55bc4c)['then'](handleEntityNotFound(_0x562d85,null))[_0x427d('0x23')](respondWithResult(_0x562d85,null))['catch'](handleError(_0x562d85,null));};exports[_0x427d('0x60')]=function(_0x1ef553,_0x29fc13){return db[_0x427d('0x44')][_0x427d('0x60')](_0x1ef553[_0x427d('0x61')],{})[_0x427d('0x23')](function(_0x28e9c){var _0x1412bb=_0x1ef553['user']['get']({'plain':!![]});if(!_0x1412bb)throw new Error(_0x427d('0x62'));if(_0x1412bb['role']===_0x427d('0x63')){var _0x37bfe4=_0x28e9c[_0x427d('0x64')]({'plain':!![]});var _0x164ede=_0x427d('0x65');return db['UserProfileSection'][_0x427d('0x66')]({'where':{'name':_0x164ede,'userProfileId':_0x1412bb[_0x427d('0x67')]},'raw':!![]})[_0x427d('0x23')](function(_0x27d166){if(_0x27d166&&_0x27d166[_0x427d('0x68')]===0x0){return db['UserProfileResource']['create']({'name':_0x37bfe4[_0x427d('0x3f')],'resourceId':_0x37bfe4['id'],'type':_0x27d166['name'],'sectionId':_0x27d166['id']},{})[_0x427d('0x23')](function(){return _0x28e9c;});}else{return _0x28e9c;}})[_0x427d('0x5d')](function(_0x3e877b){logger[_0x427d('0x2a')](_0x427d('0x69'),_0x3e877b);throw _0x3e877b;});}return _0x28e9c;})[_0x427d('0x23')](respondWithResult(_0x29fc13,0xc9))[_0x427d('0x5d')](handleError(_0x29fc13,null));};exports[_0x427d('0x3a')]=function(_0x19f4a1,_0x331dc4){if(_0x19f4a1[_0x427d('0x61')]['id']){delete _0x19f4a1[_0x427d('0x61')]['id'];}return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x19f4a1[_0x427d('0x6a')]['id']},'include':[{'model':db[_0x427d('0x5e')],'as':_0x427d('0x42')}]})['then'](handleEntityNotFound(_0x331dc4,null))[_0x427d('0x23')](saveUpdates(_0x19f4a1[_0x427d('0x61')],null))['then'](respondWithResult(_0x331dc4,null))['catch'](handleError(_0x331dc4,null));};exports[_0x427d('0x3b')]=function(_0x255dfe,_0x32f1ba){return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x255dfe[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x32f1ba,null))['then'](removeEntity(_0x32f1ba,null))['catch'](handleError(_0x32f1ba,null));};exports[_0x427d('0x6b')]=function(_0x4a4dc4,_0x37cb47){return db[_0x427d('0x44')][_0x427d('0x6b')]()[_0x427d('0x23')](respondWithResult(_0x37cb47,null))['catch'](handleError(_0x37cb47,null));};exports['addDisposition']=function(_0x432347,_0x5e01d8,_0xd38153){if(_0x432347[_0x427d('0x61')]['id']){delete _0x432347[_0x427d('0x61')]['id'];}return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x432347['params']['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x5e01d8,null))[_0x427d('0x23')](function(_0x1a511a){if(_0x1a511a){_0x432347[_0x427d('0x61')]['SmsAccountId']=_0x1a511a['id'];return db[_0x427d('0x6c')]['create'](_0x432347['body']);}})[_0x427d('0x23')](respondWithResult(_0x5e01d8,null))[_0x427d('0x5d')](handleError(_0x5e01d8,null));};exports[_0x427d('0x6d')]=function(_0x5ef8ce,_0x2da4a9,_0x18563e){var _0x473bac={'raw':![],'where':{}};var _0x8fe54={};var _0x1058e7={'count':0x0,'rows':[]};return db[_0x427d('0x44')][_0x427d('0x6e')]({'where':{'id':_0x5ef8ce[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x2da4a9,null))[_0x427d('0x23')](function(_0x3cf937){if(_0x3cf937){_0x8fe54[_0x427d('0x48')]=_[_0x427d('0x49')](db[_0x427d('0x6c')][_0x427d('0x45')]);_0x8fe54[_0x427d('0x4a')]=_[_0x427d('0x49')](_0x5ef8ce[_0x427d('0x4a')]);_0x8fe54[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x8fe54[_0x427d('0x48')],_0x8fe54[_0x427d('0x4a')]);_0x473bac[_0x427d('0x4e')]=_[_0x427d('0x4c')](_0x8fe54[_0x427d('0x48')],qs[_0x427d('0x4d')](_0x5ef8ce[_0x427d('0x4a')][_0x427d('0x4d')]));_0x473bac[_0x427d('0x4e')]=_0x473bac[_0x427d('0x4e')][_0x427d('0x4f')]?_0x473bac[_0x427d('0x4e')]:_0x8fe54[_0x427d('0x48')];if(!_0x5ef8ce[_0x427d('0x4a')]['hasOwnProperty'](_0x427d('0x51'))){_0x473bac[_0x427d('0x32')]=qs[_0x427d('0x32')](_0x5ef8ce['query'][_0x427d('0x32')]);_0x473bac[_0x427d('0x31')]=qs['offset'](_0x5ef8ce['query'][_0x427d('0x31')]);}_0x473bac[_0x427d('0x52')]=qs[_0x427d('0x53')](_0x5ef8ce[_0x427d('0x4a')][_0x427d('0x53')]);_0x473bac[_0x427d('0x54')]=qs['filters'](_[_0x427d('0x55')](_0x5ef8ce[_0x427d('0x4a')],_0x8fe54[_0x427d('0x4b')]));_0x473bac[_0x427d('0x54')][_0x427d('0x6f')]=_0x3cf937['id'];if(_0x5ef8ce['query'][_0x427d('0x56')]){_0x473bac['where']=_[_0x427d('0x58')](_0x473bac[_0x427d('0x54')],{'$or':_[_0x427d('0x43')](_0x473bac[_0x427d('0x4e')],function(_0x30369b){var _0x40b0f0={};_0x40b0f0[_0x30369b]={'$like':'%'+_0x5ef8ce[_0x427d('0x4a')][_0x427d('0x56')]+'%'};return _0x40b0f0;})});}_0x473bac=_[_0x427d('0x58')]({},_0x473bac,_0x5ef8ce[_0x427d('0x59')]);return db['Disposition']['count']({'where':_0x473bac[_0x427d('0x54')]})[_0x427d('0x23')](function(_0x49ceb9){_0x1058e7[_0x427d('0x34')]=_0x49ceb9;if(_0x5ef8ce['query']['includeAll']){_0x473bac[_0x427d('0x5a')]=[{'all':!![]}];}return db[_0x427d('0x6c')][_0x427d('0x5b')](_0x473bac);})[_0x427d('0x23')](function(_0x53b79f){_0x1058e7[_0x427d('0x5c')]=_0x53b79f;return _0x1058e7;});}})[_0x427d('0x23')](respondWithFilteredResult(_0x2da4a9,_0x473bac))[_0x427d('0x5d')](handleError(_0x2da4a9,null));};exports[_0x427d('0x70')]=function(_0x4c6c79,_0x58bcf7,_0x1636d3){return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x4c6c79[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x58bcf7,null))['then'](function(_0x42dcdd){if(_0x42dcdd){return _0x42dcdd[_0x427d('0x70')](_0x4c6c79[_0x427d('0x4a')][_0x427d('0x71')]);}})['then'](respondWithStatusCode(_0x58bcf7,null))[_0x427d('0x5d')](handleError(_0x58bcf7,null));};exports['addAnswer']=function(_0x5748a3,_0x28fff8,_0x1a26e5){if(_0x5748a3['body']['id']){delete _0x5748a3[_0x427d('0x61')]['id'];}return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x5748a3[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x28fff8,null))[_0x427d('0x23')](function(_0x5051c5){if(_0x5051c5){_0x5748a3[_0x427d('0x61')][_0x427d('0x6f')]=_0x5051c5['id'];return db[_0x427d('0x72')]['create'](_0x5748a3['body']);}})[_0x427d('0x23')](respondWithResult(_0x28fff8,null))[_0x427d('0x5d')](handleError(_0x28fff8,null));};exports[_0x427d('0x73')]=function(_0x45d681,_0x1735a8,_0xd35d40){var _0x2b3858={'raw':![],'where':{}};var _0x17cc42={};var _0x41ae97={'count':0x0,'rows':[]};return db[_0x427d('0x44')][_0x427d('0x6e')]({'where':{'id':_0x45d681['params']['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x1735a8,null))[_0x427d('0x23')](function(_0x5473d2){if(_0x5473d2){_0x17cc42['model']=_[_0x427d('0x49')](db[_0x427d('0x72')]['rawAttributes']);_0x17cc42[_0x427d('0x4a')]=_[_0x427d('0x49')](_0x45d681[_0x427d('0x4a')]);_0x17cc42[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x17cc42[_0x427d('0x48')],_0x17cc42[_0x427d('0x4a')]);_0x2b3858['attributes']=_['intersection'](_0x17cc42[_0x427d('0x48')],qs['fields'](_0x45d681[_0x427d('0x4a')][_0x427d('0x4d')]));_0x2b3858['attributes']=_0x2b3858['attributes'][_0x427d('0x4f')]?_0x2b3858[_0x427d('0x4e')]:_0x17cc42['model'];if(!_0x45d681[_0x427d('0x4a')][_0x427d('0x50')]('nolimit')){_0x2b3858[_0x427d('0x32')]=qs[_0x427d('0x32')](_0x45d681['query'][_0x427d('0x32')]);_0x2b3858[_0x427d('0x31')]=qs['offset'](_0x45d681[_0x427d('0x4a')][_0x427d('0x31')]);}_0x2b3858[_0x427d('0x52')]=qs['sort'](_0x45d681[_0x427d('0x4a')][_0x427d('0x53')]);_0x2b3858[_0x427d('0x54')]=qs['filters'](_[_0x427d('0x55')](_0x45d681[_0x427d('0x4a')],_0x17cc42[_0x427d('0x4b')]));_0x2b3858[_0x427d('0x54')][_0x427d('0x6f')]=_0x5473d2['id'];if(_0x45d681[_0x427d('0x4a')]['filter']){_0x2b3858[_0x427d('0x54')]=_[_0x427d('0x58')](_0x2b3858['where'],{'$or':_[_0x427d('0x43')](_0x2b3858[_0x427d('0x4e')],function(_0x2b8f9e){var _0x12e8cc={};_0x12e8cc[_0x2b8f9e]={'$like':'%'+_0x45d681[_0x427d('0x4a')]['filter']+'%'};return _0x12e8cc;})});}_0x2b3858=_[_0x427d('0x58')]({},_0x2b3858,_0x45d681[_0x427d('0x59')]);return db[_0x427d('0x72')][_0x427d('0x34')]({'where':_0x2b3858[_0x427d('0x54')]})[_0x427d('0x23')](function(_0x4253e2){_0x41ae97[_0x427d('0x34')]=_0x4253e2;if(_0x45d681[_0x427d('0x4a')][_0x427d('0x5f')]){_0x2b3858['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x427d('0x5b')](_0x2b3858);})[_0x427d('0x23')](function(_0x246df1){_0x41ae97[_0x427d('0x5c')]=_0x246df1;return _0x41ae97;});}})[_0x427d('0x23')](respondWithFilteredResult(_0x1735a8,_0x2b3858))[_0x427d('0x5d')](handleError(_0x1735a8,null));};exports[_0x427d('0x74')]=function(_0x15641f,_0x1971f8,_0x1b4bc9){return db[_0x427d('0x44')]['find']({'where':{'id':_0x15641f[_0x427d('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1971f8,null))[_0x427d('0x23')](function(_0x384e65){if(_0x384e65){return _0x384e65['removeAnswers'](_0x15641f['query'][_0x427d('0x71')]);}})['then'](respondWithStatusCode(_0x1971f8,null))[_0x427d('0x5d')](handleError(_0x1971f8,null));};exports[_0x427d('0x75')]=function(_0x3c5af2,_0x371b52,_0x2f2520){var _0xc86e61={'channel':_0x427d('0x76')};var _0x5060c2=[];var _0x326f5d=[];var _0x15a8a3={};return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x3c5af2[_0x427d('0x6a')]['id']},'include':[{'model':db[_0x427d('0x77')],'as':'Applications'}]})[_0x427d('0x23')](handleEntityNotFound(_0x371b52,null))['then'](function(_0x4d69e8){_0xc86e61[_0x427d('0x78')]=_0x4d69e8;_0xc86e61[_0x427d('0x79')]=_[_0x427d('0x7a')](_0x4d69e8[_0x427d('0x7b')],['priority'],[_0x427d('0x7c')]);if(_0xc86e61[_0x427d('0x78')][_0x427d('0x7b')]){delete _0xc86e61[_0x427d('0x78')][_0x427d('0x7b')];}return db['CmContact']['describe']();})[_0x427d('0x23')](function(_0x19452d){if(!_0x19452d){throw new db[(_0x427d('0x7d'))]['ValidationError'](_0x427d('0x7e'));}_0x5060c2=_['difference'](_[_0x427d('0x49')](_0x19452d),[_0x427d('0x7f'),'updatedAt']);_0x326f5d=_[_0x427d('0x80')](_[_0x427d('0x49')](_0x19452d),[_0x427d('0x7f'),_0x427d('0x81'),_0x427d('0x82'),_0x427d('0x83')]);_0xc86e61['body']={'mapKey':_0x427d('0x84')};if(_0xc86e61[_0x427d('0x78')][_0x427d('0x46')]){switch(_0xc86e61['account']['type']){case'twilio':_0xc86e61['body']['from']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x85')];_0xc86e61[_0x427d('0x61')]['body']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x86')];_0xc86e61[_0x427d('0x61')]['messageId']=_0x3c5af2[_0x427d('0x61')]['MessageSid'];break;case _0x427d('0x87'):_0xc86e61['body'][_0x427d('0x88')]='+'+_0x3c5af2[_0x427d('0x61')][_0x427d('0x89')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2['body'][_0x427d('0x8a')];break;case _0x427d('0x8b'):_0xc86e61[_0x427d('0x61')][_0x427d('0x88')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x88')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x2c')];break;case _0x427d('0x8c'):_0xc86e61[_0x427d('0x61')][_0x427d('0x88')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x88')];_0xc86e61['body']['body']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x61')];_0xc86e61[_0x427d('0x61')]['messageId']=_0x3c5af2['body']['message_id'];break;case'plivo':_0xc86e61['body'][_0x427d('0x88')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x85')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2['body'][_0x427d('0x8d')];_0xc86e61[_0x427d('0x61')][_0x427d('0x8e')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x8f')];break;case _0x427d('0x90'):_0xc86e61['body'][_0x427d('0x88')]='+'+_0x3c5af2[_0x427d('0x61')]['results'][0x0][_0x427d('0x88')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')]['results'][0x0][_0x427d('0x8a')];_0xc86e61[_0x427d('0x61')][_0x427d('0x8e')]=_0x3c5af2[_0x427d('0x61')]['results'][0x0][_0x427d('0x8e')];break;case _0x427d('0x91'):_0xc86e61[_0x427d('0x61')][_0x427d('0x88')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x92')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')]['segmentedMessage'][_0x427d('0x2c')];break;case _0x427d('0x93'):_0xc86e61[_0x427d('0x61')]['from']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x94')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x8a')];_0xc86e61['body']['messageId']=_0x3c5af2[_0x427d('0x61')]['replyMessageId'];break;case _0x427d('0x95'):_0xc86e61[_0x427d('0x61')][_0x427d('0x8e')]=_0x3c5af2[_0x427d('0x61')][0x0]['message']['id'];_0xc86e61[_0x427d('0x61')][_0x427d('0x88')]=_0x3c5af2[_0x427d('0x61')][0x0][_0x427d('0x2c')][_0x427d('0x88')];_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')][0x0][_0x427d('0x2c')][_0x427d('0x8a')];break;case'intelepeer':_0xc86e61['body']['from']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x88')];_0xc86e61['body'][_0x427d('0x61')]=_0x3c5af2[_0x427d('0x61')][_0x427d('0x2c')];_0xc86e61['body']['messageId']=_0x3c5af2[_0x427d('0x61')][_0x427d('0x96')];break;}}if(_0xc86e61['body']['id']){delete _0xc86e61[_0x427d('0x61')]['id'];}if(_['isNil'](_0xc86e61[_0x427d('0x61')][_0x427d('0x88')])){throw new db[(_0x427d('0x7d'))][(_0x427d('0x97'))](_0x427d('0x98'));}if(_[_0x427d('0x99')](_0xc86e61['body']['body'])||_0xc86e61[_0x427d('0x61')][_0x427d('0x61')]===''){throw new db[(_0x427d('0x7d'))]['ValidationError'](_0x427d('0x9a'));}if(_[_0x427d('0x99')](_0xc86e61[_0x427d('0x61')][_0x427d('0x9b')])){throw new db[(_0x427d('0x7d'))][(_0x427d('0x97'))](_0x427d('0x9c')+_0x326f5d);}if(!_['includes'](_0x326f5d,_0xc86e61['body'][_0x427d('0x9b')])){throw new db[(_0x427d('0x7d'))][(_0x427d('0x97'))](_0x427d('0x9d')+_0x326f5d);}_0x15a8a3[_0xc86e61[_0x427d('0x61')][_0x427d('0x9b')]]=_0xc86e61['body'][_0x427d('0x88')];return db[_0x427d('0x9e')][_0x427d('0x66')]({'where':{'id':_0xc86e61[_0x427d('0x78')]['ListId']},'include':[{'model':db[_0x427d('0x9f')],'as':_0x427d('0xa0'),'where':_0x15a8a3,'limit':0x1,'order':[[_0x427d('0x81'),'DESC']]}]});})['then'](handleEntityNotFound(_0x371b52,null))[_0x427d('0x23')](function(_0x4de431){if(_0x4de431){_0xc86e61[_0x427d('0xa1')]=_[_0x427d('0xa2')](_0x4de431,[_0x427d('0xa0')]);if(_0x4de431[_0x427d('0xa0')][_0x427d('0x4f')]){return _0x4de431['Contacts'][0x0];}var _0x5ace57=_[_0x427d('0x1c')](_0xc86e61[_0x427d('0x61')],{'firstName':_0xc86e61[_0x427d('0x61')][_0x427d('0x88')],'ListId':_0x4de431['id']});_0x5ace57[_0xc86e61[_0x427d('0x61')]['mapKey']]=_0xc86e61[_0x427d('0x61')][_0x427d('0x88')];return db[_0x427d('0x9f')][_0x427d('0x60')](_0x5ace57,{'fields':_0x5060c2,'raw':!![]});}})['then'](handleEntityNotFound(_0x371b52,null))[_0x427d('0x23')](function(_0x21b0fa){if(_0x21b0fa){_0xc86e61[_0x427d('0xa3')]=_0x21b0fa;var _0x678482={'ContactId':_0x21b0fa['id'],'phone':_0xc86e61['body']['from'],'SmsAccountId':_0x3c5af2[_0x427d('0x6a')]['id']};var _0x1b61c2={'ContactId':_0x21b0fa['id'],'SmsAccountId':_0x3c5af2['params']['id'],'closed':![]};return db[_0x427d('0xa4')][_0x427d('0x66')]({'where':_0x1b61c2})['then'](function(_0x4f2839){if(_0x4f2839){return[_0x4f2839,![]];}return db[_0x427d('0xa4')][_0x427d('0x60')](_0x678482)['then'](function(_0x27d4d9){return[_0x27d4d9,!![]];});});}})[_0x427d('0xa5')](function(_0x4a380f,_0x59169b){_0xc86e61[_0x427d('0xa6')]=_0x4a380f[_0x427d('0x64')]({'plain':!![]});_0xc86e61[_0x427d('0xa6')]['created']=![];if(_0x59169b){if(_0xc86e61[_0x427d('0x78')]['autoclose']){_0xc86e61['applications'][_0x427d('0xa7')]({'id':0x0,'priority':_0xc86e61[_0x427d('0x79')]['length']+0x1,'app':'close','appdata':_0x427d('0xa8'),'interval':_0x427d('0xa9')});}_0xc86e61[_0x427d('0xa6')][_0x427d('0xaa')]=!![];}return db[_0x427d('0xab')]['create']({'phone':_0xc86e61['body'][_0x427d('0x88')],'messageId':_0xc86e61[_0x427d('0x61')]['messageId'],'body':_0xc86e61['body'][_0x427d('0x61')],'SmsAccountId':_0x3c5af2['params']['id'],'SmsInteractionId':_0x4a380f['id'],'direction':'in','ContactId':_0x4a380f[_0x427d('0xac')],'AttachmentId':_0xc86e61[_0x427d('0x61')][_0x427d('0xad')]});})[_0x427d('0x23')](function(_0x3c1c3c){_0xc86e61[_0x427d('0x2c')]=_0x3c1c3c;if(_0xc86e61[_0x427d('0xa6')][_0x427d('0xae')]){return db['User'][_0x427d('0x66')]({'attributes':['id',_0x427d('0x3f')],'where':{'id':_0xc86e61[_0x427d('0xa6')][_0x427d('0xae')]}})[_0x427d('0x23')](function(_0x3bf8c4){if(_0x3bf8c4){_0xc86e61[_0x427d('0x79')][_0x427d('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3bf8c4[_0x427d('0x3f')]+','+(_0xc86e61[_0x427d('0x78')][_0x427d('0xb0')]||0xa),'interval':_0x427d('0xa9')});}return respondWithRpcPromise(_0x427d('0xb1'),_0x427d('0xb2'),_0xc86e61);});}return respondWithRpcPromise(_0x427d('0xb1'),_0x427d('0xb2'),_0xc86e61);})[_0x427d('0x23')](function(_0x30f916){if(_0x30f916){var _0x22f0b7=0xc8;var _0x121a38=_0x427d('0xb3');logger[_0x427d('0x24')](_0x427d('0x28'),_0x121a38,_0x22f0b7,_0x427d('0xb4'));logger['debug'](_0x427d('0xb5'),_0x121a38,_0x22f0b7,_0x427d('0xb4'),JSON[_0x427d('0x29')](_0x30f916));if(_0xc86e61[_0x427d('0x78')][_0x427d('0x46')]==='twilio'){return _0x371b52['status'](_0x22f0b7)[_0x427d('0x35')](_0x427d('0xb6'),_0x427d('0xb7'))['send'](_0x427d('0xb8'));}else{return _0x371b52[_0x427d('0x2f')](_0x22f0b7)[_0x427d('0x30')](_0x30f916);}}})[_0x427d('0x5d')](handleError(_0x371b52,null));};exports['addApplications']=function(_0x5b7a49,_0x573209){var _0x4defb8=_0x5b7a49[_0x427d('0x6a')]['id'];var _0xbcb2fa=_0x5b7a49[_0x427d('0x61')];var _0x2f81c9=0xc8;var _0xdee0ca=null;return db[_0x427d('0xb9')]['transaction']({'isolationLevel':db[_0x427d('0xb9')][_0x427d('0xba')][_0x427d('0xbb')][_0x427d('0xbc')]},function(_0x1dd94){return db[_0x427d('0x44')][_0x427d('0x6e')]({'where':{'id':_0x4defb8},'transaction':_0x1dd94})[_0x427d('0x23')](function(_0x2c8db4){if(_0x2c8db4){return db['SmsApplication'][_0x427d('0x3b')]({'where':{'SmsAccountId':_0x4defb8},'transaction':_0x1dd94})[_0x427d('0x23')](function(){var _0x2d1374=_['map'](_0xbcb2fa,function(_0x495e8a){_0x495e8a[_0x427d('0x6f')]=_0x4defb8;return _0x495e8a;});return db[_0x427d('0x77')][_0x427d('0xbd')](_0x2d1374,{'transaction':_0x1dd94});});}else{_0x2f81c9=0x194;_0xdee0ca=[];}});})[_0x427d('0x23')](function(){if(_0x2f81c9!==0x194){return db['SmsApplication'][_0x427d('0xbe')]({'where':{'SmsAccountId':_0x4defb8},'order':_0x427d('0xbf')})[_0x427d('0x23')](function(_0x258e14){_0xdee0ca=_0x258e14;});}})['catch'](function(_0x443864){_0x2f81c9=0x1f4;logger[_0x427d('0x2a')](_0x443864[_0x427d('0x3e')]);if(_0x443864[_0x427d('0x3f')]){delete _0x443864[_0x427d('0x3f')];}_0xdee0ca=_0x443864;})[_0x427d('0xc0')](function(){if(_0xdee0ca===null){_0x573209[_0x427d('0x2e')](_0x2f81c9);}else{if(_0x2f81c9===0x1f4){_0x573209[_0x427d('0x2f')](_0x2f81c9)[_0x427d('0x40')](_0xdee0ca);}else{_0x573209['status'](_0x2f81c9)['json'](_0xdee0ca);}}});};exports['getApplications']=function(_0x1c7627,_0x32d38a,_0xcf9d7b){var _0x344d2d={};var _0x310a0c={};var _0x2dbbd1;var _0x4d4f7d;return db[_0x427d('0x44')][_0x427d('0x6e')]({'where':{'id':_0x1c7627[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x32d38a,null))[_0x427d('0x23')](function(_0x47c3a2){if(_0x47c3a2){_0x2dbbd1=_0x47c3a2;_0x310a0c[_0x427d('0x48')]=_['keys'](db[_0x427d('0x77')][_0x427d('0x45')]);_0x310a0c[_0x427d('0x4a')]=_[_0x427d('0x49')](_0x1c7627[_0x427d('0x4a')]);_0x310a0c[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x310a0c[_0x427d('0x48')],_0x310a0c[_0x427d('0x4a')]);_0x344d2d[_0x427d('0x4e')]=_['intersection'](_0x310a0c[_0x427d('0x48')],qs['fields'](_0x1c7627[_0x427d('0x4a')]['fields']));_0x344d2d[_0x427d('0x4e')]=_0x344d2d[_0x427d('0x4e')][_0x427d('0x4f')]?_0x344d2d['attributes']:_0x310a0c[_0x427d('0x48')];_0x344d2d[_0x427d('0x52')]=qs[_0x427d('0x53')](_0x1c7627['query'][_0x427d('0x53')]);_0x344d2d[_0x427d('0x54')]=qs[_0x427d('0x4b')](_['pick'](_0x1c7627['query'],_0x310a0c[_0x427d('0x4b')]));if(_0x1c7627['query'][_0x427d('0x56')]){_0x344d2d[_0x427d('0x54')]=_[_0x427d('0x58')](_0x344d2d[_0x427d('0x54')],{'$or':_[_0x427d('0x43')](_0x344d2d[_0x427d('0x4e')],function(_0x170f9d){var _0x1c9e77={};_0x1c9e77[_0x170f9d]={'$like':'%'+_0x1c7627[_0x427d('0x4a')][_0x427d('0x56')]+'%'};return _0x1c9e77;})});}_0x344d2d=_[_0x427d('0x58')]({},_0x344d2d,_0x1c7627[_0x427d('0x59')]);return _0x2dbbd1[_0x427d('0xc1')](_0x344d2d);}})[_0x427d('0x23')](function(_0x5bc2ec){if(_0x5bc2ec){_0x4d4f7d=_0x5bc2ec[_0x427d('0x4f')];if(!_0x1c7627['query'][_0x427d('0x50')](_0x427d('0x51'))){_0x344d2d[_0x427d('0x32')]=qs[_0x427d('0x32')](_0x1c7627[_0x427d('0x4a')]['limit']);_0x344d2d[_0x427d('0x31')]=qs[_0x427d('0x31')](_0x1c7627['query'][_0x427d('0x31')]);}return _0x2dbbd1[_0x427d('0xc1')](_0x344d2d);}})['then'](function(_0x2eac75){if(_0x2eac75){return _0x2eac75?{'count':_0x4d4f7d,'rows':_0x2eac75}:null;}})[_0x427d('0x23')](respondWithResult(_0x32d38a,null))[_0x427d('0x5d')](handleError(_0x32d38a,null));};exports[_0x427d('0xc2')]=function(_0x44b927,_0x11bf9c,_0x1949d4){var _0x386e18={'raw':![],'where':{}};var _0x109edf={};var _0x359ba4={'count':0x0,'rows':[]};return db[_0x427d('0x44')]['findOne']({'where':{'id':_0x44b927['params']['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x11bf9c,null))[_0x427d('0x23')](function(_0x134c14){if(_0x134c14){_0x109edf[_0x427d('0x48')]=_['keys'](db[_0x427d('0xa4')][_0x427d('0x45')]);_0x109edf[_0x427d('0x4a')]=_['keys'](_0x44b927[_0x427d('0x4a')]);_0x109edf[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x109edf[_0x427d('0x48')],_0x109edf[_0x427d('0x4a')]);_0x386e18[_0x427d('0x4e')]=_[_0x427d('0x4c')](_0x109edf[_0x427d('0x48')],qs['fields'](_0x44b927['query'][_0x427d('0x4d')]));_0x386e18[_0x427d('0x4e')]=_0x386e18['attributes'][_0x427d('0x4f')]?_0x386e18[_0x427d('0x4e')]:_0x109edf['model'];if(!_0x44b927[_0x427d('0x4a')]['hasOwnProperty'](_0x427d('0x51'))){_0x386e18[_0x427d('0x32')]=qs[_0x427d('0x32')](_0x44b927[_0x427d('0x4a')][_0x427d('0x32')]);_0x386e18['offset']=qs[_0x427d('0x31')](_0x44b927[_0x427d('0x4a')][_0x427d('0x31')]);}_0x386e18[_0x427d('0x52')]=qs[_0x427d('0x53')](_0x44b927[_0x427d('0x4a')][_0x427d('0x53')]);_0x386e18[_0x427d('0x54')]=qs[_0x427d('0x4b')](_[_0x427d('0x55')](_0x44b927['query'],_0x109edf[_0x427d('0x4b')]));_0x386e18[_0x427d('0x54')][_0x427d('0x6f')]=_0x134c14['id'];if(_0x44b927['query'][_0x427d('0x56')]){_0x386e18[_0x427d('0x54')]=_[_0x427d('0x58')](_0x386e18[_0x427d('0x54')],{'$or':_[_0x427d('0x43')](_0x386e18[_0x427d('0x4e')],function(_0x328d57){var _0x2e5317={};_0x2e5317[_0x328d57]={'$like':'%'+_0x44b927[_0x427d('0x4a')][_0x427d('0x56')]+'%'};return _0x2e5317;})});}_0x386e18=_[_0x427d('0x58')]({},_0x386e18,_0x44b927[_0x427d('0x59')]);return db['SmsInteraction'][_0x427d('0x34')]({'where':_0x386e18['where']})[_0x427d('0x23')](function(_0x383442){_0x359ba4[_0x427d('0x34')]=_0x383442;if(_0x44b927[_0x427d('0x4a')][_0x427d('0x5f')]){_0x386e18[_0x427d('0x5a')]=[{'model':db[_0x427d('0x9f')],'as':_0x427d('0xc3'),'required':![]},{'model':db[_0x427d('0xc4')],'as':'Owner','attributes':[_0x427d('0x3f'),_0x427d('0xc5'),_0x427d('0xc6')],'required':![]},{'model':db[_0x427d('0xc7')],'as':_0x427d('0xc8'),'attributes':['id',_0x427d('0x3f'),_0x427d('0xc9')],'where':_0x44b927[_0x427d('0x4a')][_0x427d('0xca')]?{'id':_0x44b927[_0x427d('0x4a')][_0x427d('0xca')]}:undefined,'required':_0x44b927[_0x427d('0x4a')][_0x427d('0xca')]?!![]:![]}];}return db[_0x427d('0xa4')][_0x427d('0x5b')](_0x386e18);})[_0x427d('0x23')](function(_0x25a237){_0x359ba4[_0x427d('0x5c')]=_0x25a237;return _0x359ba4;});}})[_0x427d('0x23')](respondWithFilteredResult(_0x11bf9c,_0x386e18))[_0x427d('0x5d')](handleError(_0x11bf9c,null));};exports['send']=function(_0x44576b,_0x2f98f3,_0x3830ce){var _0x3cd8d8,_0x5252a5,_0x15d846;if(_[_0x427d('0x99')](_0x44576b[_0x427d('0x61')][_0x427d('0x61')])||_0x44576b[_0x427d('0x61')][_0x427d('0x61')]===''){throw new db[(_0x427d('0x7d'))][(_0x427d('0x97'))](_0x427d('0x9a'));}if(_['isNil'](_0x44576b[_0x427d('0x61')]['to'])){throw new db['Sequelize'][(_0x427d('0x97'))](_0x427d('0xcb'));}_0x3cd8d8=_0x44576b[_0x427d('0x61')]['to'];return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x44576b[_0x427d('0x6a')]['id']},'include':[{'model':db[_0x427d('0x9e')],'as':_0x427d('0xcc'),'include':[{'model':db[_0x427d('0x9f')],'as':_0x427d('0xa0'),'where':{'mobile':_0x3cd8d8},'limit':0x1,'order':[[_0x427d('0x81'),_0x427d('0xcd')]]}]}]})[_0x427d('0x23')](handleEntityNotFound(_0x2f98f3,null))[_0x427d('0x23')](function(_0x9de828){if(_0x9de828&&_0x9de828[_0x427d('0xcc')]){_0x5252a5=_0x9de828[_0x427d('0x64')]({'plain':!![]});if(_0x5252a5[_0x427d('0xcc')]&&_0x5252a5[_0x427d('0xcc')][_0x427d('0xa0')][_0x427d('0x4f')]){return _0x5252a5[_0x427d('0xcc')][_0x427d('0xa0')][0x0];}return db[_0x427d('0x9f')][_0x427d('0x60')](_[_0x427d('0x1c')](_0x44576b['body'],{'firstName':_0x3cd8d8,'mobile':_0x3cd8d8,'phone':_0x3cd8d8,'ListId':_0x5252a5['ListId']}));}})[_0x427d('0x23')](handleEntityNotFound(_0x2f98f3,null))[_0x427d('0x23')](function(_0x2065ce){if(_0x2065ce){_0x15d846=_0x2065ce;return db[_0x427d('0xa4')]['find']({'where':{'ContactId':_0x15d846['id'],'closed':![],'SmsAccountId':_0x5252a5['id']}})[_0x427d('0x23')](function(_0x4e7ac0){if(_0x4e7ac0){return[_0x4e7ac0,![]];}return db[_0x427d('0xa4')][_0x427d('0x60')]({'UserId':_0x44576b[_0x427d('0x63')]['id'],'ContactId':_0x15d846['id'],'SmsAccountId':_0x5252a5['id'],'phone':_0x3cd8d8,'firstMsgDirection':_0x427d('0xce'),'Messages':[_[_0x427d('0x58')](_0x44576b['body'],{'read':![],'body':_0x44576b[_0x427d('0x61')][_0x427d('0x61')],'phone':_0x3cd8d8,'SmsAccountId':_0x5252a5['id'],'UserId':_0x44576b[_0x427d('0x63')]['id'],'ContactId':_0x15d846['id']})]},{'include':[{'model':db[_0x427d('0xab')],'as':_0x427d('0xcf')}]})[_0x427d('0x23')](function(_0x19d294){return[_0x19d294,!![]];});});}})[_0x427d('0xa5')](function(_0x41f418,_0x350b6f){if(_0x350b6f){return _0x41f418;}return db['SmsMessage'][_0x427d('0x60')](_[_0x427d('0x58')](_0x44576b['body'],{'read':![],'body':_0x44576b['body'][_0x427d('0x61')],'phone':_0x3cd8d8,'SmsAccountId':_0x5252a5['id'],'SmsInteractionId':_0x41f418['id'],'UserId':_0x44576b[_0x427d('0x63')]['id'],'ContactId':_0x15d846['id']}))[_0x427d('0x23')](function(_0x41d1ac){_0x41f418[_0x427d('0xd0')][_0x427d('0xcf')]=[];_0x41f418[_0x427d('0xd0')]['Messages'][_0x427d('0xa7')](_0x41d1ac[_0x427d('0xd0')]);return _0x41f418;});})['then'](respondWithResult(_0x2f98f3,null))['catch'](handleError(_0x2f98f3,null));};exports[_0x427d('0x2f')]=function(_0x50b7f3,_0x34a395,_0x357936){if(_0x50b7f3['body']['id']){delete _0x50b7f3['body']['id'];}var _0x2a0a44,_0x9f3fb7,_0x32925d;return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x50b7f3[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x34a395,null))[_0x427d('0x23')](function(_0x24e2b1){if(_0x24e2b1){_0x32925d=_0x24e2b1;logger[_0x427d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x427d('0xd1'),_0x24e2b1['type'],util[_0x427d('0xd2')](_0x50b7f3['body'],{'showHidden':![],'depth':null}));switch(_0x24e2b1[_0x427d('0x46')]){case _0x427d('0x87'):if(_0x50b7f3[_0x427d('0x61')][_0x427d('0xd3')]&&_0x50b7f3[_0x427d('0x61')][_0x427d('0x2f')]){_0x9f3fb7=_0x50b7f3[_0x427d('0x61')]['status'];return db[_0x427d('0xab')][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][_0x427d('0xd3')]}});}break;case _0x427d('0x8b'):if(_0x50b7f3[_0x427d('0x61')][_0x427d('0xd4')]&&_0x50b7f3[_0x427d('0x61')][_0x427d('0xd5')]){_0x9f3fb7=_0x50b7f3[_0x427d('0x61')][_0x427d('0xd5')];return db[_0x427d('0xab')][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][_0x427d('0xd4')]}});}break;case _0x427d('0x8c'):if(_0x50b7f3['body'][_0x427d('0xd6')]&&_0x50b7f3[_0x427d('0x61')][_0x427d('0xd7')]){_0x9f3fb7=_0x50b7f3['body'][_0x427d('0xd7')];return db[_0x427d('0xab')][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][_0x427d('0xd6')]}});}break;case _0x427d('0x90'):var _0x1c2a92=_0x50b7f3[_0x427d('0x61')][_0x427d('0xd8')][0x0];if(_0x1c2a92['messageId']&&_0x1c2a92['status'][_0x427d('0xd9')]===_0x427d('0xda')){_0x9f3fb7=_0x1c2a92[_0x427d('0x2f')][_0x427d('0xd9')];return db[_0x427d('0xab')][_0x427d('0x66')]({'where':{'messageId':_0x1c2a92[_0x427d('0x8e')]}});}break;case'clickatell':if(_0x50b7f3['body'][_0x427d('0x8e')]&&_0x50b7f3[_0x427d('0x61')]['status']){_0x9f3fb7=_0x50b7f3[_0x427d('0x61')][_0x427d('0x2f')];return db['SmsMessage'][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][_0x427d('0x8e')]}});}break;case _0x427d('0x95'):if(_0x50b7f3['body'][0x0][_0x427d('0x2c')]['id']){_0x9f3fb7=_0x50b7f3[_0x427d('0x61')][0x0][_0x427d('0x46')];return db['SmsMessage'][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][0x0][_0x427d('0x2c')]['id']}});}break;case'intelepeer':if(_0x50b7f3['body']['redif']&&_0x50b7f3[_0x427d('0x61')][_0x427d('0x2f')]){_0x9f3fb7=_0x50b7f3[_0x427d('0x61')][_0x427d('0x2f')];return db[_0x427d('0xab')][_0x427d('0x66')]({'where':{'messageId':_0x50b7f3[_0x427d('0x61')][_0x427d('0xdb')]}});}break;}}})[_0x427d('0x23')](handleEntityNotFound(_0x34a395,null))[_0x427d('0x23')](function(_0x114755){if(_0x114755){_0x2a0a44=_0x114755;switch(_0x32925d[_0x427d('0x46')]){case _0x427d('0x87'):if(_0x9f3fb7===_0x427d('0xda')){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger[_0x427d('0x2a')](_0x427d('0x28'),_0x427d('0x2f'),_0x427d('0x87'),util[_0x427d('0xd2')](_0x50b7f3[_0x427d('0x61')],{'showHidden':![],'depth':null}));}break;case _0x427d('0x8b'):if(_0x9f3fb7==='1'){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger[_0x427d('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x427d('0x2f'),'skebby',util[_0x427d('0xd2')](_0x50b7f3[_0x427d('0x61')],{'showHidden':![],'depth':null}));}break;case _0x427d('0x8c'):if(!_0x50b7f3[_0x427d('0x61')][_0x427d('0xdc')]&&_0x9f3fb7>=0xc8&&_0x9f3fb7<=0xce){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger['error'](_0x427d('0x28'),_0x427d('0x2f'),_0x427d('0x8c'),util[_0x427d('0xd2')](_0x50b7f3['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4cff17=_0x50b7f3[_0x427d('0x61')]['results'][0x0];if(_0x4cff17[_0x427d('0x2f')][_0x427d('0xd9')]===_0x427d('0xda')){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger['error'](_0x427d('0x28'),_0x427d('0x2f'),_0x427d('0x90'),util[_0x427d('0xd2')](_0x50b7f3[_0x427d('0x61')],{'showHidden':![],'depth':null}));}break;case _0x427d('0x93'):if(_0x9f3fb7==_0x427d('0xdd')||_0x9f3fb7=='RECEIVED_BY_RECIPIENT'){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger[_0x427d('0x2a')](_0x427d('0x28'),'status','clickatell',util[_0x427d('0xd2')](_0x50b7f3['body'],{'showHidden':![],'depth':null}));}break;case _0x427d('0x95'):if(_0x9f3fb7=='message-delivered'){return _0x2a0a44['update']({'read':!![]});}else{logger[_0x427d('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x427d('0x95'),util['inspect'](_0x50b7f3['body'],{'showHidden':![],'depth':null}));}break;case _0x427d('0xde'):if(_0x9f3fb7===_0x427d('0xdf')||_0x9f3fb7==='ACCEPTD'){return _0x2a0a44[_0x427d('0x3a')]({'read':!![]});}else{logger[_0x427d('0x2a')](_0x427d('0x28'),_0x427d('0x2f'),_0x427d('0xde'),util[_0x427d('0xd2')](_0x50b7f3[_0x427d('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x2a0a44;}})[_0x427d('0x23')](respondWithResult(_0x34a395,null))[_0x427d('0x5d')](handleError(_0x34a395,null));};exports[_0x427d('0xe0')]=function(_0x19140d,_0x136cbd,_0x331aec){var _0x2594b2,_0x3299f9,_0x4f5977;return db['SmsAccount'][_0x427d('0x66')]({'where':{'id':_0x19140d[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x136cbd,null))[_0x427d('0x23')](function(_0x7bfa1e){if(_0x7bfa1e){_0x4f5977=_0x7bfa1e;logger['debug'](_0x427d('0x28'),'status',_0x427d('0xd1'),_0x7bfa1e[_0x427d('0x46')],util['inspect'](_0x19140d[_0x427d('0x4a')],{'showHidden':![],'depth':null}));switch(_0x7bfa1e[_0x427d('0x46')]){case _0x427d('0x91'):if(_0x19140d[_0x427d('0x4a')][_0x427d('0xe1')]&&_0x19140d['query']['state']){_0x3299f9=_0x19140d['query'][_0x427d('0xe2')];return db[_0x427d('0xab')]['find']({'where':{'messageId':_0x19140d[_0x427d('0x4a')][_0x427d('0xe1')]}});}break;}}})[_0x427d('0x23')](handleEntityNotFound(_0x136cbd,null))[_0x427d('0x23')](function(_0x1e4cf9){if(_0x1e4cf9){_0x2594b2=_0x1e4cf9;switch(_0x4f5977[_0x427d('0x46')]){case _0x427d('0x91'):if(_0x3299f9==='2'||_0x3299f9==='6'){return _0x2594b2[_0x427d('0x3a')]({'read':!![]});}else{logger['error'](_0x427d('0x28'),_0x427d('0x2f'),_0x427d('0x91'),util[_0x427d('0xd2')](_0x19140d[_0x427d('0x4a')],{'showHidden':![],'depth':null}));};break;}return _0x2594b2;}})[_0x427d('0x23')](respondWithResult(_0x136cbd,null))[_0x427d('0x5d')](handleError(_0x136cbd,null));};exports[_0x427d('0xe3')]=function(_0x1ad747,_0xa4442f,_0x1da37f){return db[_0x427d('0x44')]['find']({'where':{'id':_0x1ad747[_0x427d('0x6a')]['id']}})[_0x427d('0x23')](handleEntityNotFound(_0xa4442f,null))[_0x427d('0x23')](function(_0x2be337){if(_0x2be337){return _0x2be337[_0x427d('0xe3')](_0x1ad747[_0x427d('0x61')][_0x427d('0x71')],_[_0x427d('0xa2')](_0x1ad747[_0x427d('0x61')],['ids','id'])||{})[_0x427d('0xa5')](function(_0x4b4909){for(var _0x335ab7=0x0;_0x335ab7<_0x1ad747[_0x427d('0x61')][_0x427d('0x71')][_0x427d('0x4f')];_0x335ab7+=0x1){socket['emit'](_0x427d('0xe4'),{'UserId':Number(_0x1ad747[_0x427d('0x61')][_0x427d('0x71')][_0x335ab7]),'SmsAccountId':Number(_0x1ad747[_0x427d('0x6a')]['id'])});}return _0x4b4909;});}})['then'](respondWithResult(_0xa4442f,null))['catch'](handleError(_0xa4442f,null));};exports[_0x427d('0xe5')]=function(_0x535f61,_0x4edf91,_0xa18220){return db[_0x427d('0x44')][_0x427d('0x66')]({'where':{'id':_0x535f61['params']['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x4edf91,null))[_0x427d('0x23')](function(_0x5383a6){if(_0x5383a6){return _0x5383a6['removeAgents'](_0x535f61[_0x427d('0x4a')][_0x427d('0x71')])[_0x427d('0x23')](function(){if(_['isArray'](_0x535f61[_0x427d('0x4a')][_0x427d('0x71')])){for(var _0x2a91cb=0x0;_0x2a91cb<_0x535f61['query'][_0x427d('0x71')][_0x427d('0x4f')];_0x2a91cb+=0x1){socket[_0x427d('0xe6')](_0x427d('0xe7'),{'UserId':Number(_0x535f61['query']['ids'][_0x2a91cb]),'SmsAccountId':Number(_0x535f61[_0x427d('0x6a')]['id'])});}}else{socket[_0x427d('0xe6')](_0x427d('0xe7'),{'UserId':Number(_0x535f61[_0x427d('0x4a')][_0x427d('0x71')]),'SmsAccountId':Number(_0x535f61[_0x427d('0x6a')]['id'])});}});}})[_0x427d('0x23')](respondWithStatusCode(_0x4edf91,null))[_0x427d('0x5d')](handleError(_0x4edf91,null));};exports['getAgents']=function(_0x3f4968,_0x504ae3,_0x44f2a1){var _0x554113={};var _0x5538e9={};var _0x6921b0;var _0x117ea0;return db[_0x427d('0x44')][_0x427d('0x6e')]({'where':{'id':_0x3f4968['params']['id']}})[_0x427d('0x23')](handleEntityNotFound(_0x504ae3,null))[_0x427d('0x23')](function(_0x3e0769){if(_0x3e0769){_0x6921b0=_0x3e0769;_0x5538e9[_0x427d('0x48')]=_['keys'](db['User'][_0x427d('0x45')]);_0x5538e9['query']=_['keys'](_0x3f4968[_0x427d('0x4a')]);_0x5538e9[_0x427d('0x4b')]=_[_0x427d('0x4c')](_0x5538e9['model'],_0x5538e9[_0x427d('0x4a')]);_0x554113[_0x427d('0x4e')]=_[_0x427d('0x4c')](_0x5538e9[_0x427d('0x48')],qs[_0x427d('0x4d')](_0x3f4968[_0x427d('0x4a')][_0x427d('0x4d')]));_0x554113[_0x427d('0x4e')]=_0x554113[_0x427d('0x4e')][_0x427d('0x4f')]?_0x554113[_0x427d('0x4e')]:_0x5538e9[_0x427d('0x48')];_0x554113[_0x427d('0x52')]=qs[_0x427d('0x53')](_0x3f4968[_0x427d('0x4a')]['sort']);_0x554113[_0x427d('0x54')]=qs[_0x427d('0x4b')](_[_0x427d('0x55')](_0x3f4968['query'],_0x5538e9[_0x427d('0x4b')]));if(_0x3f4968[_0x427d('0x4a')][_0x427d('0x56')]){_0x554113[_0x427d('0x54')]=_[_0x427d('0x58')](_0x554113[_0x427d('0x54')],{'$or':_['map'](_0x554113[_0x427d('0x4e')],function(_0x108d39){var _0x1ca3d5={};_0x1ca3d5[_0x108d39]={'$like':'%'+_0x3f4968[_0x427d('0x4a')][_0x427d('0x56')]+'%'};return _0x1ca3d5;})});}_0x554113=_[_0x427d('0x58')]({},_0x554113,_0x3f4968[_0x427d('0x59')]);return _0x6921b0[_0x427d('0xe8')](_0x554113);}})[_0x427d('0x23')](function(_0x583906){if(_0x583906){_0x117ea0=_0x583906[_0x427d('0x4f')];if(!_0x3f4968[_0x427d('0x4a')][_0x427d('0x50')]('nolimit')){_0x554113[_0x427d('0x32')]=qs['limit'](_0x3f4968[_0x427d('0x4a')][_0x427d('0x32')]);_0x554113[_0x427d('0x31')]=qs[_0x427d('0x31')](_0x3f4968[_0x427d('0x4a')][_0x427d('0x31')]);}return _0x6921b0[_0x427d('0xe8')](_0x554113);}})['then'](function(_0x251264){if(_0x251264){return _0x251264?{'count':_0x117ea0,'rows':_0x251264}:null;}})['then'](respondWithResult(_0x504ae3,null))[_0x427d('0x5d')](handleError(_0x504ae3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f7f6304..79e6f42 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 _0x56a7=['emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x56976b,_0x4cc384){var _0x3b873c=function(_0x401268){while(--_0x401268){_0x56976b['push'](_0x56976b['shift']());}};_0x3b873c(++_0x4cc384);}(_0x56a7,0x162));var _0x756a=function(_0x51c726,_0x332b95){_0x51c726=_0x51c726-0x0;var _0x23fe86=_0x56a7[_0x51c726];return _0x23fe86;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x756a('0x0'))['db'][_0x756a('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x756a('0x2')](0x0);var events={'afterCreate':_0x756a('0x3'),'afterUpdate':_0x756a('0x4'),'afterDestroy':_0x756a('0x5')};function emitEvent(_0x21a15f){return function(_0x2cf27b,_0x34bef2,_0x36aa92){SmsAccountEvents[_0x756a('0x6')](_0x21a15f+':'+_0x2cf27b['id'],_0x2cf27b);SmsAccountEvents['emit'](_0x21a15f,_0x2cf27b);_0x36aa92(null);};}for(var e in events){if(events[_0x756a('0x7')](e)){var event=events[e];SmsAccount[_0x756a('0x8')](e,emitEvent(event));}}module[_0x756a('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x6cda=['hasOwnProperty','events','SmsAccount','save','remove','emit'];(function(_0x1228a6,_0x3cec7d){var _0x2cd570=function(_0x4122a7){while(--_0x4122a7){_0x1228a6['push'](_0x1228a6['shift']());}};_0x2cd570(++_0x3cec7d);}(_0x6cda,0x11b));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa6cd('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xa6cd('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6cd('0x2'),'afterUpdate':'update','afterDestroy':_0xa6cd('0x3')};function emitEvent(_0x36366a){return function(_0x3680d8,_0x19c9b6,_0x2a3f54){SmsAccountEvents['emit'](_0x36366a+':'+_0x3680d8['id'],_0x3680d8);SmsAccountEvents[_0xa6cd('0x4')](_0x36366a,_0x3680d8);_0x2a3f54(null);};}for(var e in events){if(events[_0xa6cd('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 8a96210..0b37cc1 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 _0xd44d=['rimraf','../../config/environment','./smsAccount.attributes','exports','sms_accounts','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd44d,0xb5));var _0xdd44=function(_0xecea38,_0x2a1ca4){_0xecea38=_0xecea38-0x0;var _0xdac4b1=_0xd44d[_0xecea38];return _0xdac4b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd44('0x0'))(_0xdd44('0x1'));var moment=require(_0xdd44('0x2'));var BPromise=require(_0xdd44('0x3'));var rp=require(_0xdd44('0x4'));var fs=require('fs');var path=require(_0xdd44('0x5'));var rimraf=require(_0xdd44('0x6'));var config=require(_0xdd44('0x7'));var attributes=require(_0xdd44('0x8'));module[_0xdd44('0x9')]=function(_0x5ccf8b,_0x39dc79){return _0x5ccf8b['define']('SmsAccount',attributes,{'tableName':_0xdd44('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x820f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_accounts','lodash','util'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x820f,0x166));var _0xf820=function(_0xc6a1e2,_0x3e1823){_0xc6a1e2=_0xc6a1e2-0x0;var _0x49a232=_0x820f[_0xc6a1e2];return _0x49a232;};'use strict';var _=require(_0xf820('0x0'));var util=require(_0xf820('0x1'));var logger=require(_0xf820('0x2'))('api');var moment=require(_0xf820('0x3'));var BPromise=require(_0xf820('0x4'));var rp=require(_0xf820('0x5'));var fs=require('fs');var path=require(_0xf820('0x6'));var rimraf=require(_0xf820('0x7'));var config=require(_0xf820('0x8'));var attributes=require('./smsAccount.attributes');module[_0xf820('0x9')]=function(_0x61e9c3,_0x2d0a08){return _0x61e9c3[_0xf820('0xa')]('SmsAccount',attributes,{'tableName':_0xf820('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 0d0a1e4..80f6e72 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 _0xf9ac=['../../config/environment','client','http','defaults','redis','socket.io-emitter','./smsAccount.socket','request','then','info','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','model','include','map','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc'];(function(_0x54bafd,_0x1c6df6){var _0x8206c5=function(_0x5064ce){while(--_0x5064ce){_0x54bafd['push'](_0x54bafd['shift']());}};_0x8206c5(++_0x1c6df6);}(_0xf9ac,0x17a));var _0xcf9a=function(_0x25fcc5,_0x4ba475){_0x25fcc5=_0x25fcc5-0x0;var _0x10fc68=_0xf9ac[_0x25fcc5];return _0x10fc68;};'use strict';var _=require(_0xcf9a('0x0'));var util=require(_0xcf9a('0x1'));var moment=require(_0xcf9a('0x2'));var BPromise=require(_0xcf9a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x5'))(_0xcf9a('0x6'));var config=require(_0xcf9a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcf9a('0x8')][_0xcf9a('0x9')]({'port':0x232a});config['redis']=_[_0xcf9a('0xa')](config[_0xcf9a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf9a('0xc'))(new Redis(config[_0xcf9a('0xb')]));require(_0xcf9a('0xd'))['register'](socket);function respondWithRpcPromise(_0x77c668,_0x424b62,_0x2b7a09){return new BPromise(function(_0x4417ca,_0x550393){return client[_0xcf9a('0xe')](_0x77c668,_0x2b7a09)[_0xcf9a('0xf')](function(_0x787f03){logger[_0xcf9a('0x10')]('SmsAccount,\x20%s,\x20%s',_0x424b62,'request\x20sent');logger[_0xcf9a('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x424b62,'request\x20sent',JSON[_0xcf9a('0x12')](_0x787f03));if(_0x787f03['error']){if(_0x787f03[_0xcf9a('0x13')]['code']===0x1f4){logger[_0xcf9a('0x13')](_0xcf9a('0x14'),_0x424b62,_0x787f03[_0xcf9a('0x13')]['message']);return _0x550393(_0x787f03[_0xcf9a('0x13')]['message']);}logger[_0xcf9a('0x13')](_0xcf9a('0x14'),_0x424b62,_0x787f03[_0xcf9a('0x13')][_0xcf9a('0x15')]);return _0x4417ca(_0x787f03[_0xcf9a('0x13')][_0xcf9a('0x15')]);}else{logger['info'](_0xcf9a('0x14'),_0x424b62,_0xcf9a('0x16'));_0x4417ca(_0x787f03[_0xcf9a('0x17')][_0xcf9a('0x15')]);}})[_0xcf9a('0x18')](function(_0x368ac3){logger[_0xcf9a('0x13')](_0xcf9a('0x14'),_0x424b62,_0x368ac3);_0x550393(_0x368ac3);});});}exports[_0xcf9a('0x19')]=function(_0x27d5ff){var _0x5a0170=this;return new Promise(function(_0x3c6ea6,_0x5b7ebc){return db[_0xcf9a('0x1a')][_0xcf9a('0x1b')]({'raw':_0x27d5ff[_0xcf9a('0x1c')]?_0x27d5ff[_0xcf9a('0x1c')][_0xcf9a('0x1d')]===undefined?!![]:![]:!![],'where':_0x27d5ff['options']?_0x27d5ff[_0xcf9a('0x1c')][_0xcf9a('0x1e')]||null:null,'attributes':_0x27d5ff[_0xcf9a('0x1c')]?_0x27d5ff[_0xcf9a('0x1c')][_0xcf9a('0x1f')]||null:null,'include':_0x27d5ff[_0xcf9a('0x1c')]?_0x27d5ff[_0xcf9a('0x1c')]['include']?_['map'](_0x27d5ff[_0xcf9a('0x1c')]['include'],function(_0x485029){return{'model':db[_0x485029[_0xcf9a('0x20')]],'as':_0x485029['as'],'attributes':_0x485029['attributes'],'include':_0x485029[_0xcf9a('0x21')]?_[_0xcf9a('0x22')](_0x485029['include'],function(_0xf3174c){return{'model':db[_0xf3174c[_0xcf9a('0x20')]],'as':_0xf3174c['as'],'attributes':_0xf3174c[_0xcf9a('0x1f')],'include':_0xf3174c[_0xcf9a('0x21')]?_['map'](_0xf3174c[_0xcf9a('0x21')],function(_0x275b94){return{'model':db[_0x275b94[_0xcf9a('0x20')]],'as':_0x275b94['as'],'attributes':_0x275b94[_0xcf9a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcf9a('0xf')](function(_0x2ee0ea){logger['info'](_0xcf9a('0x19'),_0x27d5ff);logger[_0xcf9a('0x11')]('ShowSmsAccount',_0x27d5ff,JSON['stringify'](_0x2ee0ea));_0x3c6ea6(_0x2ee0ea);})[_0xcf9a('0x18')](function(_0x38b685){logger[_0xcf9a('0x13')](_0xcf9a('0x19'),_0x38b685['message'],_0x27d5ff);_0x5b7ebc(_0x5a0170[_0xcf9a('0x13')](0x1f4,_0x38b685[_0xcf9a('0x15')]));});});}; \ No newline at end of file +var _0x1189=['code','message','result','catch','SmsAccount','options','where','map','include','attributes','model','ShowSmsAccount','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x1189,0x1e1));var _0x9118=function(_0x89833e,_0x28bff9){_0x89833e=_0x89833e-0x0;var _0x3ad041=_0x1189[_0x89833e];return _0x3ad041;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var moment=require(_0x9118('0x2'));var BPromise=require(_0x9118('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9118('0x4'));var db=require(_0x9118('0x5'))['db'];var utils=require(_0x9118('0x6'));var logger=require(_0x9118('0x7'))(_0x9118('0x8'));var config=require(_0x9118('0x9'));var jayson=require(_0x9118('0xa'));var client=jayson[_0x9118('0xb')][_0x9118('0xc')]({'port':0x232a});config[_0x9118('0xd')]=_['defaults'](config[_0x9118('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9118('0xd')]));require(_0x9118('0xe'))[_0x9118('0xf')](socket);function respondWithRpcPromise(_0x443a27,_0x5cd3c9,_0x3f98e2){return new BPromise(function(_0x630053,_0x566061){return client[_0x9118('0x10')](_0x443a27,_0x3f98e2)[_0x9118('0x11')](function(_0xd893b5){logger[_0x9118('0x12')](_0x9118('0x13'),_0x5cd3c9,_0x9118('0x14'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5cd3c9,'request\x20sent',JSON[_0x9118('0x15')](_0xd893b5));if(_0xd893b5['error']){if(_0xd893b5[_0x9118('0x16')][_0x9118('0x17')]===0x1f4){logger[_0x9118('0x16')](_0x9118('0x13'),_0x5cd3c9,_0xd893b5[_0x9118('0x16')][_0x9118('0x18')]);return _0x566061(_0xd893b5[_0x9118('0x16')][_0x9118('0x18')]);}logger[_0x9118('0x16')](_0x9118('0x13'),_0x5cd3c9,_0xd893b5[_0x9118('0x16')][_0x9118('0x18')]);return _0x630053(_0xd893b5[_0x9118('0x16')][_0x9118('0x18')]);}else{logger[_0x9118('0x12')](_0x9118('0x13'),_0x5cd3c9,_0x9118('0x14'));_0x630053(_0xd893b5[_0x9118('0x19')][_0x9118('0x18')]);}})[_0x9118('0x1a')](function(_0x2fd204){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5cd3c9,_0x2fd204);_0x566061(_0x2fd204);});});}exports['ShowSmsAccount']=function(_0x53057f){var _0x411e71=this;return new Promise(function(_0x1d2bf7,_0x4baef9){return db[_0x9118('0x1b')]['find']({'raw':_0x53057f[_0x9118('0x1c')]?_0x53057f[_0x9118('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x53057f[_0x9118('0x1c')]?_0x53057f[_0x9118('0x1c')][_0x9118('0x1d')]||null:null,'attributes':_0x53057f['options']?_0x53057f[_0x9118('0x1c')]['attributes']||null:null,'include':_0x53057f[_0x9118('0x1c')]?_0x53057f[_0x9118('0x1c')]['include']?_[_0x9118('0x1e')](_0x53057f['options'][_0x9118('0x1f')],function(_0x187a8c){return{'model':db[_0x187a8c['model']],'as':_0x187a8c['as'],'attributes':_0x187a8c['attributes'],'include':_0x187a8c[_0x9118('0x1f')]?_[_0x9118('0x1e')](_0x187a8c[_0x9118('0x1f')],function(_0xa157d0){return{'model':db[_0xa157d0['model']],'as':_0xa157d0['as'],'attributes':_0xa157d0[_0x9118('0x20')],'include':_0xa157d0[_0x9118('0x1f')]?_['map'](_0xa157d0[_0x9118('0x1f')],function(_0x1ebb84){return{'model':db[_0x1ebb84[_0x9118('0x21')]],'as':_0x1ebb84['as'],'attributes':_0x1ebb84[_0x9118('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9118('0x11')](function(_0x4a4359){logger[_0x9118('0x12')](_0x9118('0x22'),_0x53057f);logger[_0x9118('0x23')](_0x9118('0x22'),_0x53057f,JSON['stringify'](_0x4a4359));_0x1d2bf7(_0x4a4359);})['catch'](function(_0x386ebe){logger[_0x9118('0x16')]('ShowSmsAccount',_0x386ebe[_0x9118('0x18')],_0x53057f);_0x4baef9(_0x411e71['error'](0x1f4,_0x386ebe[_0x9118('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 45d00f6..f78e237 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 b0157f2..f67e4c6 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5bfdc3,_0x59e843){var _0x457616=function(_0x534503){while(--_0x534503){_0x5bfdc3['push'](_0x5bfdc3['shift']());}};_0x457616(++_0x59e843);}(_0x7217,0x19e));var _0x7721=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x7217[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=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(_0x11fbaa,_0x52dc16){var _0x1831fd=function(_0x2bbced){while(--_0x2bbced){_0x11fbaa['push'](_0x11fbaa['shift']());}};_0x1831fd(++_0x52dc16);}(_0x3e74,0x175));var _0x43e7=function(_0x46278b,_0x221485){_0x46278b=_0x46278b-0x0;var _0x2224fa=_0x3e74[_0x46278b];return _0x2224fa;};'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 20001af..453dda7 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 _0x496e=['sequelize','exports','noop','TEXT','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x496e,0x127));var _0xe496=function(_0x53bd2b,_0x1ac86d){_0x53bd2b=_0x53bd2b-0x0;var _0x40ec28=_0x496e[_0x53bd2b];return _0x40ec28;};'use strict';var Sequelize=require(_0xe496('0x0'));module[_0xe496('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe496('0x2')},'appdata':{'type':Sequelize[_0xe496('0x3')]()},'description':{'type':Sequelize[_0xe496('0x4')]},'interval':{'type':Sequelize[_0xe496('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x858c=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x858c,0x190));var _0xc858=function(_0x1674fd,_0x2a0f56){_0x1674fd=_0x1674fd-0x0;var _0x223b46=_0x858c[_0x1674fd];return _0x223b46;};'use strict';var Sequelize=require(_0xc858('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc858('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':_0xc858('0x3')},'appdata':{'type':Sequelize[_0xc858('0x4')]()},'description':{'type':Sequelize[_0xc858('0x2')]},'interval':{'type':Sequelize[_0xc858('0x2')],'defaultValue':_0xc858('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5eeacbf..8c5e3f6 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 _0x3be8=['type','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','end','error','stack','send','index','map','SmsApplication','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x19dd0f,_0x2902e6){var _0x5db55d=function(_0xdbd02f){while(--_0xdbd02f){_0x19dd0f['push'](_0x19dd0f['shift']());}};_0x5db55d(++_0x2902e6);}(_0x3be8,0x185));var _0x83be=function(_0x3b5031,_0x38057f){_0x3b5031=_0x3b5031-0x0;var _0x57ad35=_0x3be8[_0x3b5031];return _0x57ad35;};'use strict';var emlformat=require(_0x83be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83be('0x1'));var jsonpatch=require(_0x83be('0x2'));var rp=require(_0x83be('0x3'));var moment=require('moment');var BPromise=require(_0x83be('0x4'));var Mustache=require(_0x83be('0x5'));var util=require(_0x83be('0x6'));var path=require(_0x83be('0x7'));var sox=require('sox');var csv=require(_0x83be('0x8'));var ejs=require(_0x83be('0x9'));var fs=require('fs');var fs_extra=require(_0x83be('0xa'));var _=require(_0x83be('0xb'));var squel=require('squel');var crypto=require(_0x83be('0xc'));var jsforce=require(_0x83be('0xd'));var deskjs=require(_0x83be('0xe'));var toCsv=require(_0x83be('0x8'));var querystring=require(_0x83be('0xf'));var Papa=require(_0x83be('0x10'));var Redis=require(_0x83be('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83be('0x12'));var hardwareService=require(_0x83be('0x13'));var logger=require(_0x83be('0x14'))(_0x83be('0x15'));var utils=require(_0x83be('0x16'));var config=require(_0x83be('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x891642,_0x3850c8){_0x3850c8=_0x3850c8||0xcc;return function(_0x327a9e){if(_0x327a9e){return _0x891642[_0x83be('0x18')](_0x3850c8);}return _0x891642[_0x83be('0x19')](_0x3850c8)['end']();};}function respondWithResult(_0x577e10,_0x37c31c){_0x37c31c=_0x37c31c||0xc8;return function(_0x276cf8){if(_0x276cf8){return _0x577e10[_0x83be('0x19')](_0x37c31c)['json'](_0x276cf8);}};}function respondWithFilteredResult(_0x112ee0,_0x53b9dc){return function(_0x3c0908){if(_0x3c0908){var _0x37ee1b=typeof _0x53b9dc[_0x83be('0x1a')]===_0x83be('0x1b')&&typeof _0x53b9dc['limit']===_0x83be('0x1b');var _0x2ee0dc=_0x3c0908[_0x83be('0x1c')];var _0xac771f=_0x37ee1b?0x0:_0x53b9dc[_0x83be('0x1a')];var _0x4de604=_0x37ee1b?_0x3c0908['count']:_0x53b9dc[_0x83be('0x1a')]+_0x53b9dc[_0x83be('0x1d')];var _0x3fbf2e;if(_0x4de604>=_0x2ee0dc){_0x4de604=_0x2ee0dc;_0x3fbf2e=0xc8;}else{_0x3fbf2e=0xce;}_0x112ee0[_0x83be('0x19')](_0x3fbf2e);return _0x112ee0[_0x83be('0x1e')](_0x83be('0x1f'),_0xac771f+'-'+_0x4de604+'/'+_0x2ee0dc)[_0x83be('0x20')](_0x3c0908);}return null;};}function patchUpdates(_0x5c2754){return function(_0x7af870){try{jsonpatch[_0x83be('0x21')](_0x7af870,_0x5c2754,!![]);}catch(_0x1f4a1a){return BPromise['reject'](_0x1f4a1a);}return _0x7af870[_0x83be('0x22')]();};}function saveUpdates(_0x48703b,_0x400d22){return function(_0x549332){if(_0x549332){return _0x549332[_0x83be('0x23')](_0x48703b)['then'](function(_0x150de1){return _0x150de1;});}return null;};}function removeEntity(_0x1692dc,_0x59a86c){return function(_0x1c4b0d){if(_0x1c4b0d){return _0x1c4b0d['destroy']()[_0x83be('0x24')](function(){_0x1692dc[_0x83be('0x19')](0xcc)[_0x83be('0x25')]();});}};}function handleEntityNotFound(_0x4d9554,_0x46f898){return function(_0x1966d3){if(!_0x1966d3){_0x4d9554['sendStatus'](0x194);}return _0x1966d3;};}function handleError(_0x4ad132,_0x2b9b90){_0x2b9b90=_0x2b9b90||0x1f4;return function(_0x9718d3){logger[_0x83be('0x26')](_0x9718d3[_0x83be('0x27')]);if(_0x9718d3['name']){delete _0x9718d3['name'];}_0x4ad132[_0x83be('0x19')](_0x2b9b90)[_0x83be('0x28')](_0x9718d3);};}exports[_0x83be('0x29')]=function(_0x2da360,_0x4a4381){var _0x1f6211={},_0x2c91df={},_0x281f9e={'count':0x0,'rows':[]};var _0x4fac76=_[_0x83be('0x2a')](db[_0x83be('0x2b')][_0x83be('0x2c')],function(_0x2dcef7){return{'name':_0x2dcef7[_0x83be('0x2d')],'type':_0x2dcef7['type']['key']};});_0x2c91df[_0x83be('0x2e')]=_[_0x83be('0x2a')](_0x4fac76,_0x83be('0x2f'));_0x2c91df[_0x83be('0x30')]=_[_0x83be('0x31')](_0x2da360[_0x83be('0x30')]);_0x2c91df[_0x83be('0x32')]=_[_0x83be('0x33')](_0x2c91df[_0x83be('0x2e')],_0x2c91df[_0x83be('0x30')]);_0x1f6211[_0x83be('0x34')]=_[_0x83be('0x33')](_0x2c91df[_0x83be('0x2e')],qs['fields'](_0x2da360[_0x83be('0x30')][_0x83be('0x35')]));_0x1f6211['attributes']=_0x1f6211['attributes']['length']?_0x1f6211['attributes']:_0x2c91df[_0x83be('0x2e')];if(!_0x2da360[_0x83be('0x30')][_0x83be('0x36')](_0x83be('0x37'))){_0x1f6211[_0x83be('0x1d')]=qs['limit'](_0x2da360[_0x83be('0x30')][_0x83be('0x1d')]);_0x1f6211[_0x83be('0x1a')]=qs[_0x83be('0x1a')](_0x2da360[_0x83be('0x30')][_0x83be('0x1a')]);}_0x1f6211[_0x83be('0x38')]=qs['sort'](_0x2da360[_0x83be('0x30')][_0x83be('0x39')]);_0x1f6211[_0x83be('0x3a')]=qs['filters'](_[_0x83be('0x3b')](_0x2da360['query'],_0x2c91df['filters']),_0x4fac76);if(_0x2da360[_0x83be('0x30')]['filter']){_0x1f6211[_0x83be('0x3a')]=_[_0x83be('0x3c')](_0x1f6211['where'],{'$or':_[_0x83be('0x2a')](_0x4fac76,function(_0x1a1061){if(_0x1a1061[_0x83be('0x3d')]!==_0x83be('0x3e')){var _0x22dd82={};_0x22dd82[_0x1a1061['name']]={'$like':'%'+_0x2da360[_0x83be('0x30')][_0x83be('0x3f')]+'%'};return _0x22dd82;}})});}_0x1f6211=_['merge']({},_0x1f6211,_0x2da360[_0x83be('0x40')]);var _0x34a14b={'where':_0x1f6211[_0x83be('0x3a')]};return db[_0x83be('0x2b')][_0x83be('0x1c')](_0x34a14b)[_0x83be('0x24')](function(_0x30a407){_0x281f9e[_0x83be('0x1c')]=_0x30a407;if(_0x2da360['query']['includeAll']){_0x1f6211['include']=[{'all':!![]}];}return db['SmsApplication'][_0x83be('0x41')](_0x1f6211);})[_0x83be('0x24')](function(_0x1bd879){_0x281f9e['rows']=_0x1bd879;return _0x281f9e;})[_0x83be('0x24')](respondWithFilteredResult(_0x4a4381,_0x1f6211))[_0x83be('0x42')](handleError(_0x4a4381,null));};exports[_0x83be('0x43')]=function(_0x206059,_0x3124f6){var _0x580bdd={'raw':!![],'where':{'id':_0x206059[_0x83be('0x44')]['id']}},_0xdb62d2={};_0xdb62d2[_0x83be('0x2e')]=_[_0x83be('0x31')](db[_0x83be('0x2b')]['rawAttributes']);_0xdb62d2[_0x83be('0x30')]=_[_0x83be('0x31')](_0x206059[_0x83be('0x30')]);_0xdb62d2[_0x83be('0x32')]=_[_0x83be('0x33')](_0xdb62d2['model'],_0xdb62d2[_0x83be('0x30')]);_0x580bdd[_0x83be('0x34')]=_[_0x83be('0x33')](_0xdb62d2[_0x83be('0x2e')],qs[_0x83be('0x35')](_0x206059[_0x83be('0x30')][_0x83be('0x35')]));_0x580bdd['attributes']=_0x580bdd[_0x83be('0x34')]['length']?_0x580bdd[_0x83be('0x34')]:_0xdb62d2['model'];if(_0x206059[_0x83be('0x30')][_0x83be('0x45')]){_0x580bdd[_0x83be('0x46')]=[{'all':!![]}];}_0x580bdd=_[_0x83be('0x3c')]({},_0x580bdd,_0x206059[_0x83be('0x40')]);return db[_0x83be('0x2b')][_0x83be('0x47')](_0x580bdd)[_0x83be('0x24')](handleEntityNotFound(_0x3124f6,null))['then'](respondWithResult(_0x3124f6,null))[_0x83be('0x42')](handleError(_0x3124f6,null));};exports[_0x83be('0x48')]=function(_0x28460f,_0x1bd18d){return db['SmsApplication'][_0x83be('0x48')](_0x28460f[_0x83be('0x49')],{})[_0x83be('0x24')](respondWithResult(_0x1bd18d,0xc9))[_0x83be('0x42')](handleError(_0x1bd18d,null));};exports[_0x83be('0x23')]=function(_0x3518be,_0x495659){if(_0x3518be['body']['id']){delete _0x3518be['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x3518be[_0x83be('0x44')]['id']}})[_0x83be('0x24')](handleEntityNotFound(_0x495659,null))['then'](saveUpdates(_0x3518be['body'],null))['then'](respondWithResult(_0x495659,null))[_0x83be('0x42')](handleError(_0x495659,null));};exports[_0x83be('0x4a')]=function(_0xcde85,_0x2cd9b3){return db['SmsApplication']['find']({'where':{'id':_0xcde85[_0x83be('0x44')]['id']}})[_0x83be('0x24')](handleEntityNotFound(_0x2cd9b3,null))[_0x83be('0x24')](removeEntity(_0x2cd9b3,null))[_0x83be('0x42')](handleError(_0x2cd9b3,null));}; \ No newline at end of file +var _0x40f8=['sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','SmsApplication','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','include','findAll','rows','show','params','rawAttributes','includeAll','create','body','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x40f8,0xce));var _0x840f=function(_0x4855dc,_0x425fc5){_0x4855dc=_0x4855dc-0x0;var _0x2587ed=_0x40f8[_0x4855dc];return _0x2587ed;};'use strict';var emlformat=require(_0x840f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x840f('0x1'));var jsonpatch=require(_0x840f('0x2'));var rp=require(_0x840f('0x3'));var moment=require(_0x840f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x840f('0x5'));var util=require('util');var path=require(_0x840f('0x6'));var sox=require(_0x840f('0x7'));var csv=require(_0x840f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x840f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x840f('0xa'));var toCsv=require(_0x840f('0x8'));var querystring=require(_0x840f('0xb'));var Papa=require(_0x840f('0xc'));var Redis=require(_0x840f('0xd'));var authService=require(_0x840f('0xe'));var qs=require(_0x840f('0xf'));var as=require(_0x840f('0x10'));var hardwareService=require(_0x840f('0x11'));var logger=require(_0x840f('0x12'))(_0x840f('0x13'));var utils=require(_0x840f('0x14'));var config=require(_0x840f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x840f('0x16'))['db'];function respondWithStatusCode(_0x3f5943,_0x53010c){_0x53010c=_0x53010c||0xcc;return function(_0x30156e){if(_0x30156e){return _0x3f5943['sendStatus'](_0x53010c);}return _0x3f5943[_0x840f('0x17')](_0x53010c)[_0x840f('0x18')]();};}function respondWithResult(_0x107f9f,_0x3e18a3){_0x3e18a3=_0x3e18a3||0xc8;return function(_0x26cbaf){if(_0x26cbaf){return _0x107f9f[_0x840f('0x17')](_0x3e18a3)[_0x840f('0x19')](_0x26cbaf);}};}function respondWithFilteredResult(_0x170790,_0x397a65){return function(_0x3c7897){if(_0x3c7897){var _0x160317=typeof _0x397a65[_0x840f('0x1a')]===_0x840f('0x1b')&&typeof _0x397a65[_0x840f('0x1c')]===_0x840f('0x1b');var _0x43dd04=_0x3c7897[_0x840f('0x1d')];var _0xd526fd=_0x160317?0x0:_0x397a65[_0x840f('0x1a')];var _0x441807=_0x160317?_0x3c7897['count']:_0x397a65[_0x840f('0x1a')]+_0x397a65[_0x840f('0x1c')];var _0x29f7f1;if(_0x441807>=_0x43dd04){_0x441807=_0x43dd04;_0x29f7f1=0xc8;}else{_0x29f7f1=0xce;}_0x170790[_0x840f('0x17')](_0x29f7f1);return _0x170790['set'](_0x840f('0x1e'),_0xd526fd+'-'+_0x441807+'/'+_0x43dd04)[_0x840f('0x19')](_0x3c7897);}return null;};}function patchUpdates(_0x3dc55c){return function(_0x4abaae){try{jsonpatch['apply'](_0x4abaae,_0x3dc55c,!![]);}catch(_0x306a69){return BPromise[_0x840f('0x1f')](_0x306a69);}return _0x4abaae['save']();};}function saveUpdates(_0xeb1a47,_0x34c136){return function(_0x1aa53a){if(_0x1aa53a){return _0x1aa53a[_0x840f('0x20')](_0xeb1a47)[_0x840f('0x21')](function(_0x450411){return _0x450411;});}return null;};}function removeEntity(_0x13b175,_0xcfdf20){return function(_0x18ffa6){if(_0x18ffa6){return _0x18ffa6[_0x840f('0x22')]()[_0x840f('0x21')](function(){_0x13b175['status'](0xcc)[_0x840f('0x18')]();});}};}function handleEntityNotFound(_0x4e1d44,_0x4027a9){return function(_0x3ce928){if(!_0x3ce928){_0x4e1d44[_0x840f('0x23')](0x194);}return _0x3ce928;};}function handleError(_0x2a1bd7,_0x261c34){_0x261c34=_0x261c34||0x1f4;return function(_0x1faa6e){logger[_0x840f('0x24')](_0x1faa6e[_0x840f('0x25')]);if(_0x1faa6e[_0x840f('0x26')]){delete _0x1faa6e['name'];}_0x2a1bd7['status'](_0x261c34)[_0x840f('0x27')](_0x1faa6e);};}exports[_0x840f('0x28')]=function(_0x454dfb,_0x4cc469){var _0x5f03ff={},_0x3b44b7={},_0x558785={'count':0x0,'rows':[]};var _0x2d4dc4=_['map'](db[_0x840f('0x29')]['rawAttributes'],function(_0x210968){return{'name':_0x210968['fieldName'],'type':_0x210968[_0x840f('0x2a')]['key']};});_0x3b44b7[_0x840f('0x2b')]=_['map'](_0x2d4dc4,'name');_0x3b44b7['query']=_[_0x840f('0x2c')](_0x454dfb['query']);_0x3b44b7['filters']=_[_0x840f('0x2d')](_0x3b44b7[_0x840f('0x2b')],_0x3b44b7[_0x840f('0x2e')]);_0x5f03ff[_0x840f('0x2f')]=_['intersection'](_0x3b44b7[_0x840f('0x2b')],qs[_0x840f('0x30')](_0x454dfb[_0x840f('0x2e')]['fields']));_0x5f03ff['attributes']=_0x5f03ff[_0x840f('0x2f')][_0x840f('0x31')]?_0x5f03ff[_0x840f('0x2f')]:_0x3b44b7[_0x840f('0x2b')];if(!_0x454dfb[_0x840f('0x2e')][_0x840f('0x32')](_0x840f('0x33'))){_0x5f03ff[_0x840f('0x1c')]=qs[_0x840f('0x1c')](_0x454dfb[_0x840f('0x2e')]['limit']);_0x5f03ff[_0x840f('0x1a')]=qs[_0x840f('0x1a')](_0x454dfb['query'][_0x840f('0x1a')]);}_0x5f03ff[_0x840f('0x34')]=qs[_0x840f('0x35')](_0x454dfb[_0x840f('0x2e')]['sort']);_0x5f03ff[_0x840f('0x36')]=qs[_0x840f('0x37')](_['pick'](_0x454dfb[_0x840f('0x2e')],_0x3b44b7['filters']),_0x2d4dc4);if(_0x454dfb[_0x840f('0x2e')][_0x840f('0x38')]){_0x5f03ff[_0x840f('0x36')]=_[_0x840f('0x39')](_0x5f03ff[_0x840f('0x36')],{'$or':_[_0x840f('0x3a')](_0x2d4dc4,function(_0x171387){if(_0x171387[_0x840f('0x2a')]!=='VIRTUAL'){var _0x487b07={};_0x487b07[_0x171387[_0x840f('0x26')]]={'$like':'%'+_0x454dfb['query'][_0x840f('0x38')]+'%'};return _0x487b07;}})});}_0x5f03ff=_[_0x840f('0x39')]({},_0x5f03ff,_0x454dfb[_0x840f('0x3b')]);var _0x56d752={'where':_0x5f03ff[_0x840f('0x36')]};return db[_0x840f('0x29')][_0x840f('0x1d')](_0x56d752)[_0x840f('0x21')](function(_0x24c89a){_0x558785['count']=_0x24c89a;if(_0x454dfb[_0x840f('0x2e')]['includeAll']){_0x5f03ff[_0x840f('0x3c')]=[{'all':!![]}];}return db[_0x840f('0x29')][_0x840f('0x3d')](_0x5f03ff);})['then'](function(_0x26f144){_0x558785[_0x840f('0x3e')]=_0x26f144;return _0x558785;})[_0x840f('0x21')](respondWithFilteredResult(_0x4cc469,_0x5f03ff))['catch'](handleError(_0x4cc469,null));};exports[_0x840f('0x3f')]=function(_0x5c3d9a,_0x77c8d2){var _0x82d2cc={'raw':!![],'where':{'id':_0x5c3d9a[_0x840f('0x40')]['id']}},_0x4854c4={};_0x4854c4[_0x840f('0x2b')]=_[_0x840f('0x2c')](db[_0x840f('0x29')][_0x840f('0x41')]);_0x4854c4[_0x840f('0x2e')]=_[_0x840f('0x2c')](_0x5c3d9a[_0x840f('0x2e')]);_0x4854c4[_0x840f('0x37')]=_[_0x840f('0x2d')](_0x4854c4[_0x840f('0x2b')],_0x4854c4[_0x840f('0x2e')]);_0x82d2cc[_0x840f('0x2f')]=_['intersection'](_0x4854c4[_0x840f('0x2b')],qs[_0x840f('0x30')](_0x5c3d9a['query']['fields']));_0x82d2cc['attributes']=_0x82d2cc[_0x840f('0x2f')]['length']?_0x82d2cc['attributes']:_0x4854c4[_0x840f('0x2b')];if(_0x5c3d9a[_0x840f('0x2e')][_0x840f('0x42')]){_0x82d2cc[_0x840f('0x3c')]=[{'all':!![]}];}_0x82d2cc=_[_0x840f('0x39')]({},_0x82d2cc,_0x5c3d9a[_0x840f('0x3b')]);return db[_0x840f('0x29')]['find'](_0x82d2cc)[_0x840f('0x21')](handleEntityNotFound(_0x77c8d2,null))[_0x840f('0x21')](respondWithResult(_0x77c8d2,null))['catch'](handleError(_0x77c8d2,null));};exports[_0x840f('0x43')]=function(_0x1b4005,_0x412ce6){return db['SmsApplication']['create'](_0x1b4005[_0x840f('0x44')],{})['then'](respondWithResult(_0x412ce6,0xc9))[_0x840f('0x45')](handleError(_0x412ce6,null));};exports[_0x840f('0x20')]=function(_0x326a3b,_0x292c02){if(_0x326a3b[_0x840f('0x44')]['id']){delete _0x326a3b[_0x840f('0x44')]['id'];}return db[_0x840f('0x29')][_0x840f('0x46')]({'where':{'id':_0x326a3b[_0x840f('0x40')]['id']}})[_0x840f('0x21')](handleEntityNotFound(_0x292c02,null))[_0x840f('0x21')](saveUpdates(_0x326a3b[_0x840f('0x44')],null))[_0x840f('0x21')](respondWithResult(_0x292c02,null))[_0x840f('0x45')](handleError(_0x292c02,null));};exports[_0x840f('0x22')]=function(_0x125494,_0x46e015){return db['SmsApplication']['find']({'where':{'id':_0x125494['params']['id']}})[_0x840f('0x21')](handleEntityNotFound(_0x46e015,null))[_0x840f('0x21')](removeEntity(_0x46e015,null))[_0x840f('0x45')](handleError(_0x46e015,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3a80be7..863d92f 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 _0x1af1=['path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rp=require(_0x11af('0x4'));var fs=require('fs');var path=require(_0x11af('0x5'));var rimraf=require(_0x11af('0x6'));var config=require(_0x11af('0x7'));var attributes=require('./smsApplication.attributes');module[_0x11af('0x8')]=function(_0x1534f0,_0x17830a){return _0x1534f0['define'](_0x11af('0x9'),attributes,{'tableName':_0x11af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11af('0xb'),'collate':_0x11af('0xc')});}; \ No newline at end of file +var _0x582e=['exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0xec2efb,_0x2f41c4){var _0x6154f9=function(_0x3ff9b8){while(--_0x3ff9b8){_0xec2efb['push'](_0xec2efb['shift']());}};_0x6154f9(++_0x2f41c4);}(_0x582e,0x1b2));var _0xe582=function(_0x52dd39,_0xdb90a5){_0x52dd39=_0x52dd39-0x0;var _0x1d4076=_0x582e[_0x52dd39];return _0x1d4076;};'use strict';var _=require('lodash');var util=require(_0xe582('0x0'));var logger=require(_0xe582('0x1'))(_0xe582('0x2'));var moment=require('moment');var BPromise=require(_0xe582('0x3'));var rp=require(_0xe582('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe582('0x5'));var config=require(_0xe582('0x6'));var attributes=require(_0xe582('0x7'));module[_0xe582('0x8')]=function(_0x4be8e4,_0x294593){return _0x4be8e4[_0xe582('0x9')](_0xe582('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe582('0xb'),'collate':_0xe582('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2d780e9..76a2a7a 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 _0x2ff5=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3527b5,_0x4246d0){var _0x2d178a=function(_0x438532){while(--_0x438532){_0x3527b5['push'](_0x3527b5['shift']());}};_0x2d178a(++_0x4246d0);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x14f838,_0x48bc08){_0x14f838=_0x14f838-0x0;var _0x5796c6=_0x2ff5[_0x14f838];return _0x5796c6;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var moment=require(_0x52ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x52ff('0x2'));var fs=require('fs');var Redis=require(_0x52ff('0x3'));var db=require(_0x52ff('0x4'))['db'];var utils=require(_0x52ff('0x5'));var logger=require(_0x52ff('0x6'))(_0x52ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x52ff('0x8'));var client=jayson[_0x52ff('0x9')][_0x52ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47e375,_0x33be91,_0xbbba62){return new BPromise(function(_0x3cfd13,_0x17ca0b){return client[_0x52ff('0xb')](_0x47e375,_0xbbba62)[_0x52ff('0xc')](function(_0x27c199){logger[_0x52ff('0xd')](_0x52ff('0xe'),_0x33be91,_0x52ff('0xf'));logger[_0x52ff('0x10')](_0x52ff('0x11'),_0x33be91,_0x52ff('0xf'),JSON[_0x52ff('0x12')](_0x27c199));if(_0x27c199[_0x52ff('0x13')]){if(_0x27c199['error']['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x33be91,_0x27c199[_0x52ff('0x13')]['message']);return _0x17ca0b(_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);}logger['error'](_0x52ff('0xe'),_0x33be91,_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);return _0x3cfd13(_0x27c199[_0x52ff('0x13')][_0x52ff('0x14')]);}else{logger[_0x52ff('0xd')]('SmsApplication,\x20%s,\x20%s',_0x33be91,_0x52ff('0xf'));_0x3cfd13(_0x27c199[_0x52ff('0x15')][_0x52ff('0x14')]);}})[_0x52ff('0x16')](function(_0xa7ce6c){logger[_0x52ff('0x13')]('SmsApplication,\x20%s,\x20%s',_0x33be91,_0xa7ce6c);_0x17ca0b(_0xa7ce6c);});});} \ No newline at end of file +var _0xdac7=['error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ec7b0,_0x2eb52a){var _0x5aff54=function(_0x1af5e6){while(--_0x1af5e6){_0x1ec7b0['push'](_0x1ec7b0['shift']());}};_0x5aff54(++_0x2eb52a);}(_0xdac7,0x180));var _0x7dac=function(_0x36b25f,_0x415bf7){_0x36b25f=_0x36b25f-0x0;var _0x16b98d=_0xdac7[_0x36b25f];return _0x16b98d;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dac('0x2'));var db=require(_0x7dac('0x3'))['db'];var utils=require(_0x7dac('0x4'));var logger=require(_0x7dac('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dac('0x6')][_0x7dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x505705,_0x28cc84,_0x53c460){return new BPromise(function(_0x3b319f,_0x5ccf75){return client[_0x7dac('0x8')](_0x505705,_0x53c460)[_0x7dac('0x9')](function(_0x45fbdc){logger[_0x7dac('0xa')](_0x7dac('0xb'),_0x28cc84,_0x7dac('0xc'));logger[_0x7dac('0xd')](_0x7dac('0xe'),_0x28cc84,_0x7dac('0xc'),JSON[_0x7dac('0xf')](_0x45fbdc));if(_0x45fbdc['error']){if(_0x45fbdc['error']['code']===0x1f4){logger[_0x7dac('0x10')]('SmsApplication,\x20%s,\x20%s',_0x28cc84,_0x45fbdc[_0x7dac('0x10')]['message']);return _0x5ccf75(_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);}logger[_0x7dac('0x10')](_0x7dac('0xb'),_0x28cc84,_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);return _0x3b319f(_0x45fbdc[_0x7dac('0x10')]['message']);}else{logger[_0x7dac('0xa')]('SmsApplication,\x20%s,\x20%s',_0x28cc84,'request\x20sent');_0x3b319f(_0x45fbdc[_0x7dac('0x12')][_0x7dac('0x11')]);}})[_0x7dac('0x13')](function(_0x2de4ea){logger[_0x7dac('0x10')]('SmsApplication,\x20%s,\x20%s',_0x28cc84,_0x2de4ea);_0x5ccf75(_0x2de4ea);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6fbb11a..9c0b817 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 _0x4cf8=['/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','describe'];(function(_0x1ecebd,_0x2da8ab){var _0x59bed2=function(_0x437c15){while(--_0x437c15){_0x1ecebd['push'](_0x1ecebd['shift']());}};_0x59bed2(++_0x2da8ab);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x4cf8[_0x5c6244];return _0x5800ce;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/describe',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['get'](_0x84cf('0xe'),auth[_0x84cf('0xc')](),controller['show']);router[_0x84cf('0xb')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router['get'](_0x84cf('0x11'),auth[_0x84cf('0xc')](),controller['download']);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x14')]);router[_0x84cf('0x13')](_0x84cf('0x15'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x18')),controller[_0x84cf('0x19')]);router[_0x84cf('0x1a')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1b')),controller['update']);router[_0x84cf('0x1c')](_0x84cf('0xe'),auth[_0x84cf('0xc')](),interaction[_0x84cf('0x16')](_0x84cf('0x17'),_0x84cf('0x1d')),controller[_0x84cf('0x1e')]);router['delete']('/:id/tags',auth[_0x84cf('0xc')](),controller[_0x84cf('0x1f')]);module[_0x84cf('0x20')]=router; \ No newline at end of file +var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xda3f,0xec));var _0xfda3=function(_0xa8d466,_0x4a5bdb){_0xa8d466=_0xa8d466-0x0;var _0x15c9a9=_0xda3f[_0xa8d466];return _0x15c9a9;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('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 2d35ca3..6b7213a 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 _0xc73a=['ENUM','out','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xc73a,0x72));var _0xac73=function(_0x1db5ae,_0x5daba6){_0x1db5ae=_0x1db5ae-0x0;var _0x1e2e49=_0xc73a[_0x1db5ae];return _0x1e2e49;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xac73('0x0'));module[_0xac73('0x1')]={'closed':{'type':Sequelize[_0xac73('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xac73('0x3')]},'thirdDisposition':{'type':Sequelize[_0xac73('0x3')]},'note':{'type':Sequelize[_0xac73('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xac73('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xac73('0x5')]('in',_0xac73('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xac73('0x5')]('in',_0xac73('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xac73('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd3e3=['BOOLEAN','STRING','ENUM','out','DATE','sequelize','moment','exports'];(function(_0x50d4f5,_0x3666f8){var _0x425f91=function(_0xa5e8ca){while(--_0xa5e8ca){_0x50d4f5['push'](_0x50d4f5['shift']());}};_0x425f91(++_0x3666f8);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x45c767,_0xd2cdb3){_0x45c767=_0x45c767-0x0;var _0x4806e8=_0xd3e3[_0x45c767];return _0x4806e8;};'use strict';var Sequelize=require(_0x3d3e('0x0'));var moment=require(_0x3d3e('0x1'));module[_0x3d3e('0x2')]={'closed':{'type':Sequelize[_0x3d3e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3d3e('0x4')]},'secondDisposition':{'type':Sequelize[_0x3d3e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3d3e('0x4')]},'phone':{'type':Sequelize[_0x3d3e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3d3e('0x5')]('in',_0x3d3e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3d3e('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x3d3e('0x5')]('in',_0x3d3e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1d41b3c..0debd34 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 _0x6714=['search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','options','catch','create','describe','addMessage','ids','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','Messages','out','System','renderFile','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','offset','undefined','limit','count','set','json','apply','save','then','destroy','end','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr'];(function(_0x14437f,_0xc14167){var _0x4d0175=function(_0xb74854){while(--_0xb74854){_0x14437f['push'](_0x14437f['shift']());}};_0x4d0175(++_0xc14167);}(_0x6714,0x172));var _0x4671=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0x6714[_0x842858];return _0x46c2a2;};'use strict';var emlformat=require(_0x4671('0x0'));var rimraf=require(_0x4671('0x1'));var zipdir=require(_0x4671('0x2'));var jsonpatch=require(_0x4671('0x3'));var rp=require(_0x4671('0x4'));var moment=require(_0x4671('0x5'));var BPromise=require(_0x4671('0x6'));var Mustache=require(_0x4671('0x7'));var util=require(_0x4671('0x8'));var path=require(_0x4671('0x9'));var sox=require(_0x4671('0xa'));var csv=require('to-csv');var ejs=require(_0x4671('0xb'));var fs=require('fs');var fs_extra=require(_0x4671('0xc'));var _=require(_0x4671('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4671('0xe'));var deskjs=require(_0x4671('0xf'));var toCsv=require(_0x4671('0x10'));var querystring=require(_0x4671('0x11'));var Papa=require('papaparse');var Redis=require(_0x4671('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4671('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4671('0x14'));var hardwareService=require(_0x4671('0x15'));var logger=require('../../config/logger')(_0x4671('0x16'));var utils=require(_0x4671('0x17'));var config=require(_0x4671('0x18'));var licenseUtil=require(_0x4671('0x19'));var db=require(_0x4671('0x1a'))['db'];config['redis']=_[_0x4671('0x1b')](config[_0x4671('0x1c')],{'host':_0x4671('0x1d'),'port':0x18eb});var socket=require(_0x4671('0x1e'))(new Redis(config['redis']));require(_0x4671('0x1f'))[_0x4671('0x20')](socket);function respondWithStatusCode(_0x17936f,_0x5ba45e){_0x5ba45e=_0x5ba45e||0xcc;return function(_0x2ee75b){if(_0x2ee75b){return _0x17936f['sendStatus'](_0x5ba45e);}return _0x17936f[_0x4671('0x21')](_0x5ba45e)['end']();};}function respondWithResult(_0x42fdf6,_0x4ad456){_0x4ad456=_0x4ad456||0xc8;return function(_0x55aa71){if(_0x55aa71){return _0x42fdf6['status'](_0x4ad456)['json'](_0x55aa71);}};}function respondWithFilteredResult(_0x319c0d,_0x1b0e98){return function(_0xeaba5c){if(_0xeaba5c){var _0xc4225c=typeof _0x1b0e98[_0x4671('0x22')]===_0x4671('0x23')&&typeof _0x1b0e98[_0x4671('0x24')]==='undefined';var _0x3726f0=_0xeaba5c[_0x4671('0x25')];var _0xf1dc4a=_0xc4225c?0x0:_0x1b0e98[_0x4671('0x22')];var _0x8da50a=_0xc4225c?_0xeaba5c['count']:_0x1b0e98[_0x4671('0x22')]+_0x1b0e98[_0x4671('0x24')];var _0x1e4fbe;if(_0x8da50a>=_0x3726f0){_0x8da50a=_0x3726f0;_0x1e4fbe=0xc8;}else{_0x1e4fbe=0xce;}_0x319c0d['status'](_0x1e4fbe);return _0x319c0d[_0x4671('0x26')]('Content-Range',_0xf1dc4a+'-'+_0x8da50a+'/'+_0x3726f0)[_0x4671('0x27')](_0xeaba5c);}return null;};}function patchUpdates(_0x4464c4){return function(_0x486003){try{jsonpatch[_0x4671('0x28')](_0x486003,_0x4464c4,!![]);}catch(_0x5ad61a){return BPromise['reject'](_0x5ad61a);}return _0x486003[_0x4671('0x29')]();};}function saveUpdates(_0xce516,_0x559bb6){return function(_0x26c24a){if(_0x26c24a){return _0x26c24a['update'](_0xce516)[_0x4671('0x2a')](function(_0x5c28dc){return _0x5c28dc;});}return null;};}function removeEntity(_0x4d2487,_0x10ef92){return function(_0x1bbbbf){if(_0x1bbbbf){return _0x1bbbbf[_0x4671('0x2b')]()[_0x4671('0x2a')](function(){_0x4d2487[_0x4671('0x21')](0xcc)[_0x4671('0x2c')]();});}};}function handleEntityNotFound(_0x25eda3,_0x5603d9){return function(_0x973bf){if(!_0x973bf){_0x25eda3[_0x4671('0x2d')](0x194);}return _0x973bf;};}function handleError(_0x49731a,_0x4bc13b){_0x4bc13b=_0x4bc13b||0x1f4;return function(_0x316953){logger[_0x4671('0x2e')](_0x316953[_0x4671('0x2f')]);if(_0x316953[_0x4671('0x30')]){delete _0x316953[_0x4671('0x30')];}_0x49731a[_0x4671('0x21')](_0x4bc13b)[_0x4671('0x31')](_0x316953);};}function getInteractionUsers(_0x11cb0a,_0x4befba){return new BPromise(function(_0x320d1e,_0x9c74c9){try{if(_0x4befba[_0x11cb0a['id']]){_0x11cb0a[_0x4671('0x32')]=_[_0x4671('0x33')](_0x4befba[_0x11cb0a['id']],function(_0x393ece){return{'id':_0x393ece['id'],'fullname':_0x393ece[_0x4671('0x34')]};});}}catch(_0x5e4148){_0x9c74c9(_0x5e4148);}_0x320d1e(_0x11cb0a);});}function getInteractionTags(_0x4e8c36,_0x3dbd59){return new BPromise(function(_0x115b19,_0x17a64b){try{if(_0x4e8c36['TagIds']){_0x4e8c36[_0x4671('0x35')]=[];_0x4e8c36[_0x4671('0x36')][_0x4671('0x37')](',')[_0x4671('0x38')](function(_0x3ee72f){_0x4e8c36['Tags'][_0x4671('0x39')](_0x3dbd59[_0x3ee72f]);});}delete _0x4e8c36[_0x4671('0x36')];}catch(_0x4a6fea){_0x17a64b(_0x4a6fea);}_0x115b19(_0x4e8c36);});}function updateSmsInteraction(_0x24976b,_0x24db8c,_0x2abb43){return new BPromise(function(_0x37453c,_0x17fd20){return getInteractionUsers(_0x24976b,_0x2abb43)['then'](function(_0x55d111){return getInteractionTags(_0x55d111,_0x24db8c);})[_0x4671('0x2a')](function(_0x4108e3){return getStateInteraction(_0x4108e3);})[_0x4671('0x2a')](function(_0x4a0f48){_0x37453c(_0x4a0f48);})['catch'](function(_0x18da26){_0x17fd20(_0x18da26);});});}function getStateInteraction(_0x3a5528){return new BPromise(function(_0x7de5df){_0x3a5528[_0x4671('0x3a')]=0x0;_0x3a5528[_0x4671('0x3b')]=0x0;_0x3a5528[_0x4671('0x3c')]=0x0;_0x3a5528[_0x4671('0x3d')]=0x0;_0x3a5528[_0x4671('0x3e')]=0x0;if(!_0x3a5528[_0x4671('0x3f')]&&!_0x3a5528[_0x4671('0x40')]){_0x3a5528['waiting']+=0x1;}if(!_0x3a5528['closed']&&_0x3a5528[_0x4671('0x40')]){_0x3a5528[_0x4671('0x3b')]+=0x1;if(_0x3a5528[_0x4671('0x3a')]){_0x3a5528[_0x4671('0x3a')]-=0x1;}}if(_0x3a5528[_0x4671('0x3f')]&&_0x3a5528[_0x4671('0x40')]){_0x3a5528['answered']+=0x1;if(_0x3a5528['talking']){_0x3a5528[_0x4671('0x3b')]-=0x1;}}if(_0x3a5528[_0x4671('0x3f')]&&!_0x3a5528[_0x4671('0x40')]){_0x3a5528[_0x4671('0x3d')]+=0x1;if(_0x3a5528[_0x4671('0x3a')]){_0x3a5528[_0x4671('0x3a')]-=0x1;}}_0x3a5528['total']+=0x1;_0x7de5df(_0x3a5528);});}exports[_0x4671('0x41')]=function(_0xa1e61,_0x3de02a){var _0xad39aa={},_0x38e376={},_0x28edc9={'count':0x0,'rows':[]};var _0x12de28=_[_0x4671('0x33')](db[_0x4671('0x42')][_0x4671('0x43')],function(_0x558d39){return{'name':_0x558d39['fieldName'],'type':_0x558d39['type'][_0x4671('0x44')]};});_0x38e376[_0x4671('0x45')]=_[_0x4671('0x33')](_0x12de28,_0x4671('0x30'));_0x38e376[_0x4671('0x46')]=_['keys'](_0xa1e61['query']);_0x38e376['filters']=_[_0x4671('0x47')](_0x38e376['model'],_0x38e376[_0x4671('0x46')]);_0xad39aa[_0x4671('0x48')]=_['intersection'](_0x38e376[_0x4671('0x45')],qs[_0x4671('0x49')](_0xa1e61[_0x4671('0x46')]['fields']));_0xad39aa[_0x4671('0x48')]=_0xad39aa[_0x4671('0x48')][_0x4671('0x4a')]?_0xad39aa[_0x4671('0x48')]:_0x38e376[_0x4671('0x45')];if(!_0xa1e61[_0x4671('0x46')][_0x4671('0x4b')](_0x4671('0x4c'))){_0xad39aa[_0x4671('0x24')]=qs['limit'](_0xa1e61[_0x4671('0x46')][_0x4671('0x24')]);_0xad39aa[_0x4671('0x22')]=qs[_0x4671('0x22')](_0xa1e61['query'][_0x4671('0x22')]);}_0xad39aa[_0x4671('0x4d')]=qs[_0x4671('0x4e')](_0xa1e61[_0x4671('0x46')]['sort']);_0xad39aa[_0x4671('0x4f')]=qs[_0x4671('0x50')](_[_0x4671('0x51')](_0xa1e61[_0x4671('0x46')],_0x38e376['filters']),_0x12de28);var _0x4b3c50=[];var _0x45f13b=squel[_0x4671('0x52')]()[_0x4671('0x53')]('id')[_0x4671('0x53')](_0x4671('0x30'))['field'](_0x4671('0x54'))['from'](_0x4671('0x55'));var _0x131130=squel['select']()['field']('u.id')[_0x4671('0x53')]('u.fullname')['field'](_0x4671('0x56'))['from'](_0x4671('0x57'),'ui')[_0x4671('0x58')](_0x4671('0x59'),'u',_0x4671('0x5a'));var _0x3860e6=squel['select']()[_0x4671('0x5b')](_0x4671('0x5c'),'i')[_0x4671('0x58')](_0x4671('0x5d'),'c',_0x4671('0x5e'))['left_join'](_0x4671('0x59'),'o','o.id\x20=\x20i.UserId')[_0x4671('0x58')](_0x4671('0x5f'),'a',_0x4671('0x60'))[_0x4671('0x58')]('sms_messages','me',_0x4671('0x61'))[_0x4671('0x58')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x4671('0x62'));var _0x3740eb=squel[_0x4671('0x63')]();var _0x4fbb20=[];var _0x5cca48=squel[_0x4671('0x63')]();var _0x410580;if(_0xa1e61[_0x4671('0x46')][_0x4671('0x64')]){_0x410580=as['parseSearch'](_0xa1e61[_0x4671('0x46')][_0x4671('0x64')]);var _0x2d7653=_0x410580[_0x4671('0x65')];for(var _0x14eb88=0x0;_0x14eb88<_0x410580[_0x4671('0x66')]['length'];_0x14eb88++){var _0xb0f8cf=_0x410580['conditions'][_0x14eb88];var _0x3e9aa3='i';var _0x2e2d9b=_['find'](_0x12de28,['name',_0xb0f8cf['field']]);if(!_0x2e2d9b){switch(_0xb0f8cf[_0x4671('0x53')]){case _0x4671('0x67'):if(_0xb0f8cf[_0x4671('0x68')]==0x1){_0x3860e6[_0x4671('0x69')]('`'+_0xb0f8cf['field']+_0x4671('0x6a'));}else{_0x3860e6[_0x4671('0x69')]('`'+_0xb0f8cf[_0x4671('0x53')]+_0x4671('0x6b'));}break;case _0x4671('0x6c'):if(_0xb0f8cf['operator']==='$substring'){if(_0xb0f8cf[_0x4671('0x68')][_0x4671('0x37')]('\x20')[_0x4671('0x4a')]>0x1){_0x3740eb[_0x2d7653]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xb0f8cf[_0x4671('0x68')]),null);}else{var _0x138778='%'+_0xb0f8cf[_0x4671('0x68')]+'%';_0x3740eb[_0x2d7653](_0x4671('0x6d'),_0x138778,_0x138778,_0x138778);}}else{_0x2e2d9b=_[_0x4671('0x6e')](_0x12de28,[_0x4671('0x30'),'ContactId']);_0xb0f8cf['field']='ContactId';_0x53f636=as[_0x4671('0x6f')](_0x3e9aa3,_0x2e2d9b[_0x4671('0x70')],_0xb0f8cf);_0x3740eb[_0x2d7653](_0x53f636[_0x4671('0x71')],_0x53f636[_0x4671('0x68')][_0x4671('0x72')],_0x53f636[_0x4671('0x68')][_0x4671('0x2c')]);}break;case _0x4671('0x73'):var _0x11627d=_0xb0f8cf[_0x4671('0x68')][_0x4671('0x37')](',')[_0x4671('0x33')](function(_0x58585e){return Number(_0x58585e);});_0x11627d[_0x4671('0x38')](function(_0x5a067d){_0x5cca48['or'](_0x4671('0x74'),'%,'+_0x5a067d+',%');});_0x4fbb20=_['union'](_0x4fbb20,_0x11627d);break;case _0x4671('0x75'):if(_0xb0f8cf['operator']===_0x4671('0x76')){_0x3740eb[_0x2d7653](_0x4671('0x77'),'%'+_0xb0f8cf[_0x4671('0x68')]+'%',null);}else{_0x2e2d9b=_[_0x4671('0x6e')](_0x12de28,[_0x4671('0x30'),_0x4671('0x40')]);_0xb0f8cf[_0x4671('0x53')]='UserId';_0x53f636=as[_0x4671('0x6f')](_0x3e9aa3,_0x2e2d9b[_0x4671('0x70')],_0xb0f8cf);_0x3740eb[_0x2d7653](_0x53f636[_0x4671('0x71')],_0x53f636['value'][_0x4671('0x72')],_0x53f636[_0x4671('0x68')][_0x4671('0x2c')]);}break;case _0x4671('0x78'):_0x53f636=as['buildExpression']('me',null,_0xb0f8cf);_0x3740eb[_0x2d7653](_0x53f636['text'],_0x53f636[_0x4671('0x68')][_0x4671('0x72')],_0x53f636[_0x4671('0x68')][_0x4671('0x2c')]);break;}}else{var _0x53f636=as[_0x4671('0x6f')](_0x3e9aa3,_0x2e2d9b[_0x4671('0x70')],_0xb0f8cf);_0x3740eb[_0x2d7653](_0x53f636['text'],_0x53f636[_0x4671('0x68')][_0x4671('0x72')],_0x53f636[_0x4671('0x68')][_0x4671('0x2c')]);}}}else{var _0x2a1f6a=_(_0xa1e61['query'])[_0x4671('0x79')]()[_0x4671('0x33')](function(_0x304955){return _[_0x4671('0x7a')](_0x12de28,['name',_0x304955])?_0x304955:undefined;})[_0x4671('0x7b')]()[_0x4671('0x68')]();if(!_[_0x4671('0x7c')](_0x2a1f6a)){_0x2a1f6a['forEach'](function(_0x5ead97){if(_0x5ead97===_0x4671('0x7d')){_0x3860e6[_0x4671('0x4f')](_0x4671('0x7e'),[][_0x4671('0x7f')](_0xa1e61[_0x4671('0x46')][_0x5ead97]));}else if(_0x5ead97==='createdAt'){var _0x225430=JSON[_0x4671('0x80')](_0xa1e61[_0x4671('0x46')][_0x5ead97])[_0x4671('0x81')];var _0xd391f2=JSON[_0x4671('0x80')](_0xa1e61[_0x4671('0x46')][_0x5ead97])['$lte'];_0x3860e6[_0x4671('0x4f')](_0x4671('0x82'),_0x225430,_0xd391f2);}else{if(_0xa1e61[_0x4671('0x46')][_0x5ead97]===_0x4671('0x83')){_0x3860e6[_0x4671('0x4f')]('i.'+_0x5ead97+'\x20IS\x20NULL');}else{_0x3860e6[_0x4671('0x4f')]('i.'+_0x5ead97+_0x4671('0x84'),_0xa1e61['query'][_0x5ead97]);}}});}if(_0xa1e61[_0x4671('0x46')]['read']){if(_0xa1e61[_0x4671('0x46')]['read']==0x1){_0x3860e6[_0x4671('0x69')]('`unreadMessages`\x20=\x200');}else{_0x3860e6['having']('`unreadMessages`\x20>\x200');}}if(_0xa1e61[_0x4671('0x46')]['tag']){_0x4fbb20=_[_0x4671('0x85')](_0xa1e61['query'][_0x4671('0x86')])?_0xa1e61[_0x4671('0x46')][_0x4671('0x86')]:new Array(_0xa1e61[_0x4671('0x46')]['tag']);_0x4fbb20[_0x4671('0x38')](function(_0x1161e0){_0x5cca48['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1161e0+',%');});}if(_0xa1e61[_0x4671('0x46')][_0x4671('0x87')]){var _0x428f31=_0xa1e61[_0x4671('0x46')]['filter'][_0x4671('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x428f31)){_0x3740eb['or'](_0x4671('0x89'),_0x428f31+'%')['or'](_0x4671('0x8a'),_0x428f31+'%');}else{_0x3740eb['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4671('0x8b')](_0x428f31))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x428f31+'%');}}}_0x3860e6[_0x4671('0x4f')](_0x3740eb);_0x3860e6[_0x4671('0x8c')](_0x4671('0x8d'));var _0x5f31eb={'type':db[_0x4671('0x8e')][_0x4671('0x8f')][_0x4671('0x90')],'raw':!![]};var _0x595507=_0x3860e6[_0x4671('0x91')]();_0x595507[_0x4671('0x53')](_0x4671('0x8d'));_0x595507[_0x4671('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4671('0x67'));if(_0xad39aa[_0x4671('0x4d')]){_0xad39aa[_0x4671('0x4d')][_0x4671('0x38')](function(_0x8bb6d5){var _0xa84480=_0x8bb6d5[0x0]===_0x4671('0x92')?_0x8bb6d5[0x0]:'i.'+_0x8bb6d5[0x0];_0x3860e6[_0x4671('0x4d')](_0xa84480,_0x8bb6d5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4671('0x7c')](_0x4fbb20)){_0x3860e6[_0x4671('0x69')](_0x5cca48);_0x595507['where'](_0x4671('0x93'),_0x4fbb20);}BPromise[_0x4671('0x94')]()[_0x4671('0x2a')](function(){if(!_0x410580){if(_0xa1e61[_0x4671('0x46')][_0x4671('0x7d')])return;_0x595507['where'](_0x4671('0x95'));_0x3860e6[_0x4671('0x4f')](_0x4671('0x95'));return;}if(_0xa1e61[_0x4671('0x96')][_0x4671('0x97')]!==_0x4671('0x98'))return;return _0xa1e61['user'][_0x4671('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c2190){if(_[_0x4671('0x7c')](_0x2c2190)){_0x595507[_0x4671('0x4f')](_0x4671('0x9a'));_0x3860e6[_0x4671('0x4f')](_0x4671('0x9a'));}else{_0x595507['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x2c2190,'id'));_0x3860e6[_0x4671('0x4f')](_0x4671('0x7e'),_[_0x4671('0x33')](_0x2c2190,'id'));}});})['then'](function(){if(_0xa1e61['user'][_0x4671('0x97')]===_0x4671('0x98')&&!_0x410580&&!_0xa1e61[_0x4671('0x46')][_0x4671('0x7d')])return[];return db[_0x4671('0x9b')][_0x4671('0x46')](_0x595507['toString'](),_0x5f31eb);})[_0x4671('0x2a')](function(_0x2b214d){_0x28edc9[_0x4671('0x25')]=_0x2b214d['length'];if(_0x28edc9['count']===0x0)return[];return db[_0x4671('0x9b')][_0x4671('0x46')](_0x45f13b[_0x4671('0x9c')](),_0x5f31eb)[_0x4671('0x2a')](function(_0x233373){_0x4b3c50=_[_0x4671('0x9d')](_0x233373,'id');_0x5f31eb=_[_0x4671('0x9e')](_0x5f31eb,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa1e61['query'][_0x4671('0x49')]){_0xad39aa['attributes']['forEach'](function(_0x19961f){_0x3860e6[_0x4671('0x53')]('i.'+_0x19961f);});}else{_0x3860e6[_0x4671('0x53')](_0x4671('0x9f'),'unreadMessages');_0x3860e6['field'](_0x4671('0xa0'),_0x4671('0xa1'));_0x3860e6[_0x4671('0x53')](_0x4671('0xa2'),_0x4671('0xa3'));_0x3860e6[_0x4671('0x53')]('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',_0x4671('0x92'));_0x3860e6[_0x4671('0x53')](_0x4671('0xa4'));_0x3860e6[_0x4671('0x53')](_0x4671('0xa5'),_0x4671('0xa6'));_0x3860e6[_0x4671('0x53')]('c.lastName',_0x4671('0xa7'));_0x3860e6['field']('c.email',_0x4671('0xa8'));_0x3860e6[_0x4671('0x53')](_0x4671('0xa9'),'Contact.phone');_0x3860e6[_0x4671('0x53')](_0x4671('0xaa'),_0x4671('0xab'));_0x3860e6[_0x4671('0x53')](_0x4671('0xac'),_0x4671('0xad'));_0x3860e6[_0x4671('0x53')]('o.fullname',_0x4671('0xae'));_0x3860e6[_0x4671('0x53')](_0x4671('0xaf'),_0x4671('0xb0'));_0x3860e6['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4671('0x36'));}if(_0xad39aa[_0x4671('0x24')])_0x3860e6[_0x4671('0x24')](_0xad39aa['limit']);if(_0xad39aa[_0x4671('0x22')])_0x3860e6['offset'](_0xad39aa[_0x4671('0x22')]);return db[_0x4671('0x9b')][_0x4671('0x46')](_0x3860e6[_0x4671('0x9c')](),_0x5f31eb);})[_0x4671('0x2a')](function(_0x3afc43){if(_0x3afc43[_0x4671('0x4a')]>0x0)_0x131130['where'](_0x4671('0xb1'),_[_0x4671('0x33')](_0x3afc43,'id'));return db['sequelize'][_0x4671('0x46')](_0x131130[_0x4671('0x9c')](),_0x5f31eb)[_0x4671('0x2a')](function(_0x2e5d90){var _0x569d6c=_[_0x4671('0xb2')](_0x2e5d90,_0x4671('0xb3'));var _0x93548b=[];_0x3afc43[_0x4671('0x38')](function(_0x2f6290){_0x93548b['push'](updateSmsInteraction(_0x2f6290,_0x4b3c50,_0x569d6c));});return BPromise[_0x4671('0xb4')](_0x93548b);});});})['then'](function(_0x993c91){_0x28edc9[_0x4671('0xb5')]=_0x993c91;return _0x28edc9;})[_0x4671('0x2a')](respondWithFilteredResult(_0x3de02a,_0xad39aa))['catch'](handleError(_0x3de02a,null));};exports[_0x4671('0xb6')]=function(_0x13c499,_0x862203){var _0x312722={'raw':![],'where':{'id':_0x13c499[_0x4671('0xb7')]['id']}},_0x3a908a={};_0x3a908a[_0x4671('0x45')]=_[_0x4671('0x79')](db[_0x4671('0x42')]['rawAttributes']);_0x3a908a[_0x4671('0x46')]=_[_0x4671('0x79')](_0x13c499[_0x4671('0x46')]);_0x3a908a['filters']=_[_0x4671('0x47')](_0x3a908a[_0x4671('0x45')],_0x3a908a[_0x4671('0x46')]);_0x312722[_0x4671('0x48')]=_[_0x4671('0x47')](_0x3a908a[_0x4671('0x45')],qs['fields'](_0x13c499[_0x4671('0x46')]['fields']));_0x312722[_0x4671('0x48')]=_0x312722[_0x4671('0x48')][_0x4671('0x4a')]?_0x312722[_0x4671('0x48')]:_0x3a908a[_0x4671('0x45')];if(_0x13c499['query'][_0x4671('0xb8')]){_0x312722['include']=[{'all':!![]}];}_0x312722=_[_0x4671('0x9e')]({},_0x312722,_0x13c499[_0x4671('0xb9')]);return db[_0x4671('0x42')]['find'](_0x312722)[_0x4671('0x2a')](handleEntityNotFound(_0x862203,null))[_0x4671('0x2a')](respondWithResult(_0x862203,null))[_0x4671('0xba')](handleError(_0x862203,null));};exports[_0x4671('0xbb')]=function(_0x645473,_0x474596){return db[_0x4671('0x42')]['create'](_0x645473[_0x4671('0x78')],{})['then'](respondWithResult(_0x474596,0xc9))[_0x4671('0xba')](handleError(_0x474596,null));};exports['update']=function(_0xeff0c3,_0x355a9d){if(_0xeff0c3['body']['id']){delete _0xeff0c3[_0x4671('0x78')]['id'];}return db[_0x4671('0x42')][_0x4671('0x6e')]({'where':{'id':_0xeff0c3[_0x4671('0xb7')]['id']}})[_0x4671('0x2a')](handleEntityNotFound(_0x355a9d,null))[_0x4671('0x2a')](saveUpdates(_0xeff0c3[_0x4671('0x78')],null))[_0x4671('0x2a')](respondWithResult(_0x355a9d,null))[_0x4671('0xba')](handleError(_0x355a9d,null));};exports[_0x4671('0x2b')]=function(_0x30b931,_0x1dbcc1){return db[_0x4671('0x42')][_0x4671('0x6e')]({'where':{'id':_0x30b931[_0x4671('0xb7')]['id']}})['then'](handleEntityNotFound(_0x1dbcc1,null))[_0x4671('0x2a')](removeEntity(_0x1dbcc1,null))[_0x4671('0xba')](handleError(_0x1dbcc1,null));};exports['describe']=function(_0x3923c3,_0x21b072){return db[_0x4671('0x42')][_0x4671('0xbc')]()[_0x4671('0x2a')](respondWithResult(_0x21b072,null))[_0x4671('0xba')](handleError(_0x21b072,null));};exports[_0x4671('0xbd')]=function(_0x2bc785,_0x2f9eb7,_0x17475a){return db['SmsMessage'][_0x4671('0x6e')]({'where':{'id':_0x2bc785[_0x4671('0xb7')]['id']}})[_0x4671('0x2a')](handleEntityNotFound(_0x2f9eb7,null))[_0x4671('0x2a')](function(_0x34d3e2){if(_0x34d3e2){return _0x34d3e2['addMessage'](_0x2bc785[_0x4671('0x78')][_0x4671('0xbe')],_['omit'](_0x2bc785[_0x4671('0x78')],[_0x4671('0xbe'),'id'])||{});}})[_0x4671('0x2a')](respondWithResult(_0x2f9eb7,null))['catch'](handleError(_0x2f9eb7,null));};exports['getMessages']=function(_0x223860,_0x5b2868,_0x1363ea){var _0x77f321={'raw':![],'where':{}};var _0x3213bb={};var _0x3828c6={'count':0x0,'rows':[]};return db[_0x4671('0x42')][_0x4671('0xbf')]({'where':{'id':_0x223860[_0x4671('0xb7')]['id']}})[_0x4671('0x2a')](handleEntityNotFound(_0x5b2868,null))[_0x4671('0x2a')](function(_0x1dec27){if(_0x1dec27){_0x3213bb['model']=_[_0x4671('0x79')](db[_0x4671('0xc0')][_0x4671('0x43')]);_0x3213bb['query']=_[_0x4671('0x79')](_0x223860[_0x4671('0x46')]);_0x3213bb[_0x4671('0x50')]=_[_0x4671('0x47')](_0x3213bb[_0x4671('0x45')],_0x3213bb[_0x4671('0x46')]);_0x77f321[_0x4671('0x48')]=_['intersection'](_0x3213bb['model'],qs['fields'](_0x223860[_0x4671('0x46')][_0x4671('0x49')]));_0x77f321[_0x4671('0x48')]=_0x77f321[_0x4671('0x48')][_0x4671('0x4a')]?_0x77f321['attributes']:_0x3213bb[_0x4671('0x45')];if(!_0x223860[_0x4671('0x46')][_0x4671('0x4b')](_0x4671('0x4c'))){_0x77f321[_0x4671('0x24')]=qs[_0x4671('0x24')](_0x223860[_0x4671('0x46')][_0x4671('0x24')]);_0x77f321['offset']=qs['offset'](_0x223860[_0x4671('0x46')][_0x4671('0x22')]);}_0x77f321[_0x4671('0x4d')]=qs[_0x4671('0x4e')](_0x223860[_0x4671('0x46')][_0x4671('0x4e')]);_0x77f321[_0x4671('0x4f')]=qs[_0x4671('0x50')](_[_0x4671('0x51')](_0x223860[_0x4671('0x46')],_0x3213bb[_0x4671('0x50')]));_0x77f321[_0x4671('0x4f')][_0x4671('0xb3')]=_0x1dec27['id'];if(_0x223860['query'][_0x4671('0x87')]){_0x77f321[_0x4671('0x4f')]=_['merge'](_0x77f321[_0x4671('0x4f')],{'$or':_[_0x4671('0x33')](_0x77f321[_0x4671('0x48')],function(_0x324744){var _0xdd15d8={};_0xdd15d8[_0x324744]={'$like':'%'+_0x223860[_0x4671('0x46')]['filter']+'%'};return _0xdd15d8;})});}if(_0x223860[_0x4671('0x46')][_0x4671('0x81')]){var _0x2732e0=_0x223860[_0x4671('0x46')][_0x4671('0x81')][_0x4671('0x37')](',');var _0x1f7273={};_0x1f7273[_0x2732e0[0x0]]={'$gte':moment(_0x2732e0[0x1])[_0x4671('0xc1')](_0x4671('0xc2'))};_0x77f321['where']=_['merge'](_0x77f321[_0x4671('0x4f')],_0x1f7273);}_0x77f321=_[_0x4671('0x9e')]({},_0x77f321,_0x223860[_0x4671('0xb9')]);return db[_0x4671('0xc0')][_0x4671('0x25')]({'where':_0x77f321[_0x4671('0x4f')]})[_0x4671('0x2a')](function(_0x4b10d0){_0x3828c6[_0x4671('0x25')]=_0x4b10d0;if(_0x223860[_0x4671('0x46')][_0x4671('0xb8')]){_0x77f321['include']=[{'all':!![]}];}return db['SmsMessage'][_0x4671('0xc3')](_0x77f321);})['then'](function(_0x285bd4){_0x3828c6[_0x4671('0xb5')]=_0x285bd4;return _0x3828c6;});}})[_0x4671('0x2a')](respondWithFilteredResult(_0x5b2868,_0x77f321))[_0x4671('0xba')](handleError(_0x5b2868,null));};exports['addTags']=function(_0x4481fa,_0x3e489b,_0x4b5644){return db[_0x4671('0x42')][_0x4671('0x6e')]({'where':{'id':_0x4481fa[_0x4671('0xb7')]['id']}})[_0x4671('0x2a')](handleEntityNotFound(_0x3e489b,null))[_0x4671('0x2a')](function(_0x45e77a){if(_0x45e77a){return _0x45e77a[_0x4671('0xc4')](_0x4481fa[_0x4671('0x78')][_0x4671('0xbe')],_[_0x4671('0xc5')](_0x4481fa[_0x4671('0x78')],['ids','id'])||{})[_0x4671('0xc6')](function(){return db[_0x4671('0x73')][_0x4671('0xc3')]({'attributes':['id',_0x4671('0x30'),'color'],'where':{'id':_0x4481fa[_0x4671('0x78')]['ids']}});})[_0x4671('0x2a')](function(_0x48fdf2){socket[_0x4671('0xc7')](_0x4671('0xc8'),{'id':Number(_0x4481fa[_0x4671('0xb7')]['id']),'tags':_0x48fdf2||[]});return{'id':Number(_0x4481fa[_0x4671('0xb7')]['id']),'tags':_0x48fdf2||[]};});}})[_0x4671('0x2a')](respondWithResult(_0x3e489b,null))[_0x4671('0xba')](handleError(_0x3e489b,null));};exports[_0x4671('0xc9')]=function(_0x526edc,_0x514391,_0x2026d9){return db['SmsInteraction']['find']({'where':{'id':_0x526edc['params']['id']}})['then'](handleEntityNotFound(_0x514391,null))['then'](function(_0x49e708){if(_0x49e708){return _0x49e708[_0x4671('0xc9')](_0x526edc[_0x4671('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x514391,null))[_0x4671('0xba')](handleError(_0x514391,null));};exports[_0x4671('0xca')]=function(_0x4d92fb,_0x26b78d){var _0x3c1dfe=moment()[_0x4671('0xcb')]()[_0x4671('0x9c')]();var _0x10a063=path[_0x4671('0xcc')](config[_0x4671('0xcd')],'server','files',_0x4671('0xce'));var _0x103038=path[_0x4671('0xcc')](config[_0x4671('0xcd')],_0x4671('0xcf'),_0x4671('0xd0'),_0x4671('0xd1'));var _0x2b1a06=path[_0x4671('0xcc')](_0x10a063,_0x3c1dfe);var _0x501074=util['format'](_0x4671('0xd2'),_0x4d92fb[_0x4671('0xb7')]['id'],_0x3c1dfe);var _0x38f6cb=path[_0x4671('0xcc')](_0x10a063,_0x501074);var _0x15457b=[];_0x15457b[_0x4671('0x39')]({'model':db[_0x4671('0x75')],'as':_0x4671('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x15457b['push']({'model':db[_0x4671('0xd3')],'as':_0x4671('0x6c'),'attributes':['id',_0x4671('0xd4'),_0x4671('0xd5')],'raw':!![]});var _0x1450d5=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x4671('0x78'),_0x4671('0xd6'),_0x4671('0xd7'),_0x4671('0xd8'),_0x4671('0xd9')],'include':_0x15457b}];_0x1450d5[_0x4671('0x39')]({'model':db[_0x4671('0xda')],'as':_0x4671('0xdb'),'attributes':['id',_0x4671('0x30')]});_0x1450d5['push']({'model':db[_0x4671('0x75')],'as':_0x4671('0xdc'),'attributes':['id',_0x4671('0x34')]});return db[_0x4671('0x42')]['find']({'where':{'id':_0x4d92fb[_0x4671('0xb7')]['id']},'include':_0x1450d5})[_0x4671('0x2a')](handleEntityNotFound(_0x26b78d,null))[_0x4671('0x2a')](function(_0x4a1eca){if(_0x4a1eca){var _0x25328a=_0x4a1eca[_0x4671('0xdd')]({'plain':!![]});fs[_0x4671('0xde')](_0x2b1a06);var _0x44289d={'channel':_0x4671('0xdf'),'account':_0x25328a['Account']['name'],'agent':_0x25328a[_0x4671('0xdc')]?_0x25328a[_0x4671('0xdc')][_0x4671('0x34')]:_0x4671('0xe0'),'createdAt':moment(_0x25328a[_0x4671('0xd6')])[_0x4671('0xc1')](_0x4671('0xc2'))[_0x4671('0x9c')](),'closedAt':_0x25328a['closed']?moment(_0x25328a[_0x4671('0xe1')])[_0x4671('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4671('0x9c')]():'','disposition':_0x25328a[_0x4671('0xe2')],'messages':_(_0x25328a[_0x4671('0xe3')])['filter']({'secret':![]})[_0x4671('0x33')](function(_0xf8fea0){return{'date':moment(_0xf8fea0[_0x4671('0xd6')])[_0x4671('0xc1')](_0x4671('0xc2'))[_0x4671('0x9c')](),'sender':_0xf8fea0['direction']===_0x4671('0xe4')?_0xf8fea0[_0x4671('0x75')]?_0xf8fea0['User'][_0x4671('0x34')]:_0x4671('0xe5'):_0xf8fea0[_0x4671('0x6c')]['firstName']+(_0xf8fea0[_0x4671('0x6c')]['lastName']?'\x20'+_0xf8fea0['Contact'][_0x4671('0xd5')]:''),'body':_0xf8fea0['body'],'direction':_0xf8fea0['direction']===_0x4671('0xe4')?'A':'C','secret':_0xf8fea0[_0x4671('0xd8')],'read':_0xf8fea0[_0x4671('0xd9')]};})[_0x4671('0x68')]()};return ejs[_0x4671('0xe6')](path['join'](config[_0x4671('0xcd')],'server','views','downloadInteraction.ejs'),{'interaction':_0x44289d})[_0x4671('0x2a')](function(_0x29998a){var _0x266ca8=path[_0x4671('0xcc')](_0x2b1a06,'transcript-'+_0x25328a['id']+'-'+_0x3c1dfe+'.pdf');var _0x28607b={'path':_0x266ca8,'channel':_0x4671('0xdf'),'interactionId':_0x25328a['id']};return pdf[_0x4671('0xe7')](_0x29998a,_0x28607b);})[_0x4671('0x2a')](function(){return new BPromise(function(_0x384ca0,_0x14892b){zipdir(_0x2b1a06,{'saveTo':_0x38f6cb},function(_0x5afe25,_0x3eee0c){if(_0x5afe25)return _0x14892b(_0x5afe25);return _0x384ca0(_0x3eee0c);});})[_0x4671('0x2a')](function(){return new BPromise(function(_0x331e5b,_0x19c0b0){rimraf(_0x2b1a06,function(_0x513fa5){if(_0x513fa5)_0x19c0b0(_0x513fa5);return _0x331e5b();});});})[_0x4671('0x2a')](function(){return _0x26b78d[_0x4671('0xca')](_0x38f6cb,_0x501074,function(_0x364485){if(_0x364485){console[_0x4671('0xe8')](_0x4671('0xe9'),_0x364485);}else{fs[_0x4671('0xea')](_0x38f6cb);}});});});}else{return _0x26b78d[_0x4671('0x2d')](0xc8);}})[_0x4671('0xba')](handleError(_0x26b78d,null));}; \ No newline at end of file +var _0x7e50=['buildExpression','text','map','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','keys','compact','isEmpty','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','show','params','rawAttributes','include','options','create','addMessage','SmsMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Messages','direction','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','sendStatus','error','name','send','fullname','Tags','TagIds','split','catch','waiting','talking','answered','closed','UserId','unmanaged','total','SmsInteraction','type','model','query','intersection','fields','attributes','length','order','sort','where','filters','select','field','color','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','from','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId'];(function(_0x5ac700,_0x1c4b57){var _0x37b451=function(_0x3086b2){while(--_0x3086b2){_0x5ac700['push'](_0x5ac700['shift']());}};_0x37b451(++_0x1c4b57);}(_0x7e50,0x7f));var _0x07e5=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x7e50[_0x127783];return _0x14f298;};'use strict';var emlformat=require(_0x07e5('0x0'));var rimraf=require(_0x07e5('0x1'));var zipdir=require(_0x07e5('0x2'));var jsonpatch=require(_0x07e5('0x3'));var rp=require(_0x07e5('0x4'));var moment=require(_0x07e5('0x5'));var BPromise=require(_0x07e5('0x6'));var Mustache=require(_0x07e5('0x7'));var util=require(_0x07e5('0x8'));var path=require(_0x07e5('0x9'));var sox=require(_0x07e5('0xa'));var csv=require(_0x07e5('0xb'));var ejs=require(_0x07e5('0xc'));var fs=require('fs');var fs_extra=require(_0x07e5('0xd'));var _=require(_0x07e5('0xe'));var squel=require(_0x07e5('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x07e5('0xb'));var querystring=require(_0x07e5('0x10'));var Papa=require('papaparse');var Redis=require(_0x07e5('0x11'));var authService=require(_0x07e5('0x12'));var qs=require(_0x07e5('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x07e5('0x14'));var hardwareService=require(_0x07e5('0x15'));var logger=require(_0x07e5('0x16'))('api');var utils=require(_0x07e5('0x17'));var config=require(_0x07e5('0x18'));var licenseUtil=require(_0x07e5('0x19'));var db=require(_0x07e5('0x1a'))['db'];config['redis']=_[_0x07e5('0x1b')](config[_0x07e5('0x1c')],{'host':_0x07e5('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07e5('0x1c')]));require(_0x07e5('0x1e'))['register'](socket);function respondWithStatusCode(_0x3db593,_0x232f68){_0x232f68=_0x232f68||0xcc;return function(_0xecd671){if(_0xecd671){return _0x3db593['sendStatus'](_0x232f68);}return _0x3db593['status'](_0x232f68)[_0x07e5('0x1f')]();};}function respondWithResult(_0x469755,_0x4490c2){_0x4490c2=_0x4490c2||0xc8;return function(_0x50c6d4){if(_0x50c6d4){return _0x469755[_0x07e5('0x20')](_0x4490c2)[_0x07e5('0x21')](_0x50c6d4);}};}function respondWithFilteredResult(_0x12bf80,_0x485d9c){return function(_0xb5fdc8){if(_0xb5fdc8){var _0xafe779=typeof _0x485d9c[_0x07e5('0x22')]===_0x07e5('0x23')&&typeof _0x485d9c['limit']==='undefined';var _0xe4001f=_0xb5fdc8[_0x07e5('0x24')];var _0x2804b3=_0xafe779?0x0:_0x485d9c[_0x07e5('0x22')];var _0x5d0e53=_0xafe779?_0xb5fdc8['count']:_0x485d9c[_0x07e5('0x22')]+_0x485d9c[_0x07e5('0x25')];var _0x4bc991;if(_0x5d0e53>=_0xe4001f){_0x5d0e53=_0xe4001f;_0x4bc991=0xc8;}else{_0x4bc991=0xce;}_0x12bf80['status'](_0x4bc991);return _0x12bf80[_0x07e5('0x26')](_0x07e5('0x27'),_0x2804b3+'-'+_0x5d0e53+'/'+_0xe4001f)[_0x07e5('0x21')](_0xb5fdc8);}return null;};}function patchUpdates(_0x1006b3){return function(_0x432d7b){try{jsonpatch[_0x07e5('0x28')](_0x432d7b,_0x1006b3,!![]);}catch(_0x7a5f95){return BPromise['reject'](_0x7a5f95);}return _0x432d7b['save']();};}function saveUpdates(_0x269907,_0x25e4b3){return function(_0x49ef88){if(_0x49ef88){return _0x49ef88['update'](_0x269907)['then'](function(_0x3acfcd){return _0x3acfcd;});}return null;};}function removeEntity(_0x2eb306,_0x325cc3){return function(_0x2ef09a){if(_0x2ef09a){return _0x2ef09a[_0x07e5('0x29')]()[_0x07e5('0x2a')](function(){_0x2eb306[_0x07e5('0x20')](0xcc)[_0x07e5('0x1f')]();});}};}function handleEntityNotFound(_0x2c8570,_0x5377c3){return function(_0x4a3b3d){if(!_0x4a3b3d){_0x2c8570[_0x07e5('0x2b')](0x194);}return _0x4a3b3d;};}function handleError(_0x1b114d,_0xa3b0df){_0xa3b0df=_0xa3b0df||0x1f4;return function(_0x20559f){logger[_0x07e5('0x2c')](_0x20559f['stack']);if(_0x20559f['name']){delete _0x20559f[_0x07e5('0x2d')];}_0x1b114d[_0x07e5('0x20')](_0xa3b0df)[_0x07e5('0x2e')](_0x20559f);};}function getInteractionUsers(_0x1f0e5e,_0x4128c6){return new BPromise(function(_0x4bf5db,_0x5236c4){try{if(_0x4128c6[_0x1f0e5e['id']]){_0x1f0e5e['Users']=_['map'](_0x4128c6[_0x1f0e5e['id']],function(_0x52ef84){return{'id':_0x52ef84['id'],'fullname':_0x52ef84[_0x07e5('0x2f')]};});}}catch(_0x4e5569){_0x5236c4(_0x4e5569);}_0x4bf5db(_0x1f0e5e);});}function getInteractionTags(_0x10a790,_0x23536f){return new BPromise(function(_0x2f6e8e,_0x2fe0b1){try{if(_0x10a790['TagIds']){_0x10a790[_0x07e5('0x30')]=[];_0x10a790[_0x07e5('0x31')][_0x07e5('0x32')](',')['forEach'](function(_0x5f2579){_0x10a790['Tags']['push'](_0x23536f[_0x5f2579]);});}delete _0x10a790['TagIds'];}catch(_0x266935){_0x2fe0b1(_0x266935);}_0x2f6e8e(_0x10a790);});}function updateSmsInteraction(_0x4d5a83,_0x273539,_0x321be4){return new BPromise(function(_0xbb2535,_0x9b34bd){return getInteractionUsers(_0x4d5a83,_0x321be4)[_0x07e5('0x2a')](function(_0x16cc13){return getInteractionTags(_0x16cc13,_0x273539);})[_0x07e5('0x2a')](function(_0x3b1c19){return getStateInteraction(_0x3b1c19);})[_0x07e5('0x2a')](function(_0x182de9){_0xbb2535(_0x182de9);})[_0x07e5('0x33')](function(_0x462f61){_0x9b34bd(_0x462f61);});});}function getStateInteraction(_0x13354f){return new BPromise(function(_0x3d36b0){_0x13354f[_0x07e5('0x34')]=0x0;_0x13354f[_0x07e5('0x35')]=0x0;_0x13354f[_0x07e5('0x36')]=0x0;_0x13354f['unmanaged']=0x0;_0x13354f['total']=0x0;if(!_0x13354f['closed']&&!_0x13354f['UserId']){_0x13354f[_0x07e5('0x34')]+=0x1;}if(!_0x13354f[_0x07e5('0x37')]&&_0x13354f[_0x07e5('0x38')]){_0x13354f['talking']+=0x1;if(_0x13354f[_0x07e5('0x34')]){_0x13354f['waiting']-=0x1;}}if(_0x13354f[_0x07e5('0x37')]&&_0x13354f[_0x07e5('0x38')]){_0x13354f[_0x07e5('0x36')]+=0x1;if(_0x13354f[_0x07e5('0x35')]){_0x13354f[_0x07e5('0x35')]-=0x1;}}if(_0x13354f['closed']&&!_0x13354f[_0x07e5('0x38')]){_0x13354f[_0x07e5('0x39')]+=0x1;if(_0x13354f[_0x07e5('0x34')]){_0x13354f[_0x07e5('0x34')]-=0x1;}}_0x13354f[_0x07e5('0x3a')]+=0x1;_0x3d36b0(_0x13354f);});}exports['index']=function(_0x25deb5,_0x153c60){var _0x25499c={},_0x5476fb={},_0x4905af={'count':0x0,'rows':[]};var _0x381945=_['map'](db[_0x07e5('0x3b')]['rawAttributes'],function(_0x591382){return{'name':_0x591382['fieldName'],'type':_0x591382[_0x07e5('0x3c')]['key']};});_0x5476fb[_0x07e5('0x3d')]=_['map'](_0x381945,_0x07e5('0x2d'));_0x5476fb[_0x07e5('0x3e')]=_['keys'](_0x25deb5[_0x07e5('0x3e')]);_0x5476fb['filters']=_['intersection'](_0x5476fb[_0x07e5('0x3d')],_0x5476fb[_0x07e5('0x3e')]);_0x25499c['attributes']=_[_0x07e5('0x3f')](_0x5476fb['model'],qs[_0x07e5('0x40')](_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x40')]));_0x25499c[_0x07e5('0x41')]=_0x25499c['attributes'][_0x07e5('0x42')]?_0x25499c[_0x07e5('0x41')]:_0x5476fb[_0x07e5('0x3d')];if(!_0x25deb5[_0x07e5('0x3e')]['hasOwnProperty']('nolimit')){_0x25499c[_0x07e5('0x25')]=qs['limit'](_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x25')]);_0x25499c[_0x07e5('0x22')]=qs[_0x07e5('0x22')](_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x22')]);}_0x25499c[_0x07e5('0x43')]=qs[_0x07e5('0x44')](_0x25deb5[_0x07e5('0x3e')]['sort']);_0x25499c[_0x07e5('0x45')]=qs[_0x07e5('0x46')](_['pick'](_0x25deb5[_0x07e5('0x3e')],_0x5476fb[_0x07e5('0x46')]),_0x381945);var _0x29e1e0=[];var _0x508667=squel[_0x07e5('0x47')]()[_0x07e5('0x48')]('id')[_0x07e5('0x48')](_0x07e5('0x2d'))[_0x07e5('0x48')](_0x07e5('0x49'))['from']('tools_tags');var _0x832164=squel[_0x07e5('0x47')]()['field'](_0x07e5('0x4a'))[_0x07e5('0x48')](_0x07e5('0x4b'))[_0x07e5('0x48')](_0x07e5('0x4c'))['from'](_0x07e5('0x4d'),'ui')[_0x07e5('0x4e')](_0x07e5('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0xe4b9bd=squel['select']()[_0x07e5('0x50')](_0x07e5('0x51'),'i')[_0x07e5('0x4e')]('cm_contacts','c',_0x07e5('0x52'))['left_join'](_0x07e5('0x4f'),'o',_0x07e5('0x53'))[_0x07e5('0x4e')]('sms_accounts','a',_0x07e5('0x54'))['left_join'](_0x07e5('0x55'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x07e5('0x4e')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x07e5('0x4e')](_0x07e5('0x56'),'t',_0x07e5('0x57'));var _0x2ce016=squel[_0x07e5('0x58')]();var _0x2efd92=[];var _0x1b4b2c=squel[_0x07e5('0x58')]();var _0x3a1309;if(_0x25deb5[_0x07e5('0x3e')]['search']){_0x3a1309=as[_0x07e5('0x59')](_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x5a')]);var _0x13aece=_0x3a1309[_0x07e5('0x5b')];for(var _0x2f539e=0x0;_0x2f539e<_0x3a1309[_0x07e5('0x5c')][_0x07e5('0x42')];_0x2f539e++){var _0x51dcaa=_0x3a1309['conditions'][_0x2f539e];var _0x42671f='i';var _0xf05944=_[_0x07e5('0x5d')](_0x381945,['name',_0x51dcaa['field']]);if(!_0xf05944){switch(_0x51dcaa[_0x07e5('0x48')]){case'unreadMessages':if(_0x51dcaa['value']==0x1){_0xe4b9bd[_0x07e5('0x5e')]('`'+_0x51dcaa[_0x07e5('0x48')]+_0x07e5('0x5f'));}else{_0xe4b9bd[_0x07e5('0x5e')]('`'+_0x51dcaa['field']+_0x07e5('0x60'));}break;case _0x07e5('0x61'):if(_0x51dcaa[_0x07e5('0x62')]===_0x07e5('0x63')){if(_0x51dcaa[_0x07e5('0x64')][_0x07e5('0x32')]('\x20')['length']>0x1){_0x2ce016[_0x13aece](_0x07e5('0x65'),qs[_0x07e5('0x66')](_0x51dcaa[_0x07e5('0x64')]),null);}else{var _0x309dc0='%'+_0x51dcaa[_0x07e5('0x64')]+'%';_0x2ce016[_0x13aece](_0x07e5('0x67'),_0x309dc0,_0x309dc0,_0x309dc0);}}else{_0xf05944=_['find'](_0x381945,['name','ContactId']);_0x51dcaa[_0x07e5('0x48')]=_0x07e5('0x68');_0x5de127=as[_0x07e5('0x69')](_0x42671f,_0xf05944['type'],_0x51dcaa);_0x2ce016[_0x13aece](_0x5de127[_0x07e5('0x6a')],_0x5de127[_0x07e5('0x64')]['start'],_0x5de127[_0x07e5('0x64')][_0x07e5('0x1f')]);}break;case'Tag':var _0x1cf76f=_0x51dcaa[_0x07e5('0x64')][_0x07e5('0x32')](',')[_0x07e5('0x6b')](function(_0x2826b9){return Number(_0x2826b9);});_0x1cf76f[_0x07e5('0x6c')](function(_0x5f3510){_0x1b4b2c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f3510+',%');});_0x2efd92=_[_0x07e5('0x6d')](_0x2efd92,_0x1cf76f);break;case _0x07e5('0x6e'):if(_0x51dcaa[_0x07e5('0x62')]===_0x07e5('0x63')){_0x2ce016[_0x13aece](_0x07e5('0x6f'),'%'+_0x51dcaa[_0x07e5('0x64')]+'%',null);}else{_0xf05944=_['find'](_0x381945,[_0x07e5('0x2d'),_0x07e5('0x38')]);_0x51dcaa['field']=_0x07e5('0x38');_0x5de127=as[_0x07e5('0x69')](_0x42671f,_0xf05944['type'],_0x51dcaa);_0x2ce016[_0x13aece](_0x5de127['text'],_0x5de127[_0x07e5('0x64')]['start'],_0x5de127[_0x07e5('0x64')][_0x07e5('0x1f')]);}break;case _0x07e5('0x70'):_0x5de127=as[_0x07e5('0x69')]('me',null,_0x51dcaa);_0x2ce016[_0x13aece](_0x5de127[_0x07e5('0x6a')],_0x5de127[_0x07e5('0x64')]['start'],_0x5de127[_0x07e5('0x64')]['end']);break;}}else{var _0x5de127=as[_0x07e5('0x69')](_0x42671f,_0xf05944[_0x07e5('0x3c')],_0x51dcaa);_0x2ce016[_0x13aece](_0x5de127[_0x07e5('0x6a')],_0x5de127[_0x07e5('0x64')][_0x07e5('0x71')],_0x5de127[_0x07e5('0x64')][_0x07e5('0x1f')]);}}}else{var _0x35277a=_(_0x25deb5[_0x07e5('0x3e')])[_0x07e5('0x72')]()[_0x07e5('0x6b')](function(_0x40e366){return _['some'](_0x381945,[_0x07e5('0x2d'),_0x40e366])?_0x40e366:undefined;})[_0x07e5('0x73')]()[_0x07e5('0x64')]();if(!_[_0x07e5('0x74')](_0x35277a)){_0x35277a[_0x07e5('0x6c')](function(_0x15ef2b){if(_0x15ef2b==='SmsAccountId'){_0xe4b9bd[_0x07e5('0x45')]('i.SmsAccountId\x20IN\x20?',[][_0x07e5('0x75')](_0x25deb5[_0x07e5('0x3e')][_0x15ef2b]));}else if(_0x15ef2b===_0x07e5('0x76')){var _0x1c415a=JSON['parse'](_0x25deb5[_0x07e5('0x3e')][_0x15ef2b])['$gte'];var _0x3a4bf3=JSON[_0x07e5('0x77')](_0x25deb5[_0x07e5('0x3e')][_0x15ef2b])['$lte'];_0xe4b9bd[_0x07e5('0x45')](_0x07e5('0x78'),_0x1c415a,_0x3a4bf3);}else{if(_0x25deb5[_0x07e5('0x3e')][_0x15ef2b]===_0x07e5('0x79')){_0xe4b9bd['where']('i.'+_0x15ef2b+_0x07e5('0x7a'));}else{_0xe4b9bd['where']('i.'+_0x15ef2b+_0x07e5('0x7b'),_0x25deb5[_0x07e5('0x3e')][_0x15ef2b]);}}});}if(_0x25deb5['query'][_0x07e5('0x7c')]){if(_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x7c')]==0x1){_0xe4b9bd[_0x07e5('0x5e')](_0x07e5('0x7d'));}else{_0xe4b9bd[_0x07e5('0x5e')](_0x07e5('0x7e'));}}if(_0x25deb5[_0x07e5('0x3e')]['tag']){_0x2efd92=_[_0x07e5('0x7f')](_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x80')])?_0x25deb5[_0x07e5('0x3e')]['tag']:new Array(_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x80')]);_0x2efd92[_0x07e5('0x6c')](function(_0x524428){_0x1b4b2c['or'](_0x07e5('0x81'),'%,'+_0x524428+',%');});}if(_0x25deb5['query'][_0x07e5('0x82')]){var _0x166d6f=_0x25deb5['query']['filter'][_0x07e5('0x83')]('\x5c','\x5c\x5c')[_0x07e5('0x83')](/'/g,'\x27\x27');if(qs[_0x07e5('0x84')](_0x166d6f)){_0x2ce016['or']('i.id\x20LIKE\x20?',_0x166d6f+'%')['or']('i.phone\x20LIKE\x20?',_0x166d6f+'%');}else{_0x2ce016['or'](_0x07e5('0x85'),qs[_0x07e5('0x66')](_0x166d6f))['or'](_0x07e5('0x86'),_0x166d6f+'%');}}}_0xe4b9bd[_0x07e5('0x45')](_0x2ce016);_0xe4b9bd['group'](_0x07e5('0x87'));var _0x45b701={'type':db[_0x07e5('0x88')][_0x07e5('0x89')][_0x07e5('0x8a')],'raw':!![]};var _0x543666=_0xe4b9bd[_0x07e5('0x8b')]();_0x543666[_0x07e5('0x48')](_0x07e5('0x87'));_0x543666[_0x07e5('0x48')](_0x07e5('0x8c'),_0x07e5('0x8d'));if(_0x25499c['order']){_0x25499c[_0x07e5('0x43')][_0x07e5('0x6c')](function(_0x116f5b){var _0x32eadc=_0x116f5b[0x0]===_0x07e5('0x8e')?_0x116f5b[0x0]:'i.'+_0x116f5b[0x0];_0xe4b9bd['order'](_0x32eadc,_0x116f5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x07e5('0x74')](_0x2efd92)){_0xe4b9bd[_0x07e5('0x5e')](_0x1b4b2c);_0x543666[_0x07e5('0x45')](_0x07e5('0x8f'),_0x2efd92);}BPromise['resolve']()[_0x07e5('0x2a')](function(){if(!_0x3a1309){if(_0x25deb5['query'][_0x07e5('0x90')])return;_0x543666[_0x07e5('0x45')](_0x07e5('0x91'));_0xe4b9bd['where'](_0x07e5('0x91'));return;}if(_0x25deb5[_0x07e5('0x92')][_0x07e5('0x93')]!=='agent')return;return _0x25deb5[_0x07e5('0x92')][_0x07e5('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x37d40d){if(_[_0x07e5('0x74')](_0x37d40d)){_0x543666['where'](_0x07e5('0x95'));_0xe4b9bd[_0x07e5('0x45')](_0x07e5('0x95'));}else{_0x543666[_0x07e5('0x45')](_0x07e5('0x96'),_[_0x07e5('0x6b')](_0x37d40d,'id'));_0xe4b9bd[_0x07e5('0x45')](_0x07e5('0x96'),_[_0x07e5('0x6b')](_0x37d40d,'id'));}});})[_0x07e5('0x2a')](function(){if(_0x25deb5[_0x07e5('0x92')][_0x07e5('0x93')]===_0x07e5('0x97')&&!_0x3a1309&&!_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x90')])return[];return db[_0x07e5('0x98')]['query'](_0x543666[_0x07e5('0x99')](),_0x45b701);})[_0x07e5('0x2a')](function(_0x4912a8){_0x4905af[_0x07e5('0x24')]=_0x4912a8[_0x07e5('0x42')];if(_0x4905af[_0x07e5('0x24')]===0x0)return[];return db['sequelize']['query'](_0x508667[_0x07e5('0x99')](),_0x45b701)['then'](function(_0x1752bc){_0x29e1e0=_[_0x07e5('0x9a')](_0x1752bc,'id');_0x45b701=_[_0x07e5('0x9b')](_0x45b701,{'model':db[_0x07e5('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25deb5[_0x07e5('0x3e')][_0x07e5('0x40')]){_0x25499c['attributes']['forEach'](function(_0x835246){_0xe4b9bd['field']('i.'+_0x835246);});}else{_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0x8c'),_0x07e5('0x8d'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0x9c'),_0x07e5('0x9d'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0x9e'),_0x07e5('0x9f'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xa0'),'contactName');_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xa1'));_0xe4b9bd['field'](_0x07e5('0xa2'),_0x07e5('0xa3'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xa4'),_0x07e5('0xa5'));_0xe4b9bd['field'](_0x07e5('0xa6'),_0x07e5('0xa7'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xa8'),'Contact.phone');_0xe4b9bd[_0x07e5('0x48')]('c.mobile',_0x07e5('0xa9'));_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xaa'),'Contact.fax');_0xe4b9bd[_0x07e5('0x48')]('o.fullname','Owner.fullname');_0xe4b9bd[_0x07e5('0x48')](_0x07e5('0xab'),_0x07e5('0xac'));_0xe4b9bd[_0x07e5('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x07e5('0x31'));}if(_0x25499c[_0x07e5('0x25')])_0xe4b9bd[_0x07e5('0x25')](_0x25499c[_0x07e5('0x25')]);if(_0x25499c['offset'])_0xe4b9bd[_0x07e5('0x22')](_0x25499c[_0x07e5('0x22')]);return db[_0x07e5('0x98')][_0x07e5('0x3e')](_0xe4b9bd[_0x07e5('0x99')](),_0x45b701);})[_0x07e5('0x2a')](function(_0x127429){if(_0x127429[_0x07e5('0x42')]>0x0)_0x832164['where'](_0x07e5('0xad'),_[_0x07e5('0x6b')](_0x127429,'id'));return db[_0x07e5('0x98')][_0x07e5('0x3e')](_0x832164[_0x07e5('0x99')](),_0x45b701)[_0x07e5('0x2a')](function(_0x4a7874){var _0x16d502=_['groupBy'](_0x4a7874,_0x07e5('0xae'));var _0x45cfad=[];_0x127429['forEach'](function(_0x35b8dd){_0x45cfad['push'](updateSmsInteraction(_0x35b8dd,_0x29e1e0,_0x16d502));});return BPromise[_0x07e5('0xaf')](_0x45cfad);});});})[_0x07e5('0x2a')](function(_0xfdbf64){_0x4905af[_0x07e5('0xb0')]=_0xfdbf64;return _0x4905af;})[_0x07e5('0x2a')](respondWithFilteredResult(_0x153c60,_0x25499c))[_0x07e5('0x33')](handleError(_0x153c60,null));};exports[_0x07e5('0xb1')]=function(_0x15d5ca,_0x4c21e8){var _0x163634={'raw':![],'where':{'id':_0x15d5ca[_0x07e5('0xb2')]['id']}},_0x2ad2a8={};_0x2ad2a8['model']=_[_0x07e5('0x72')](db['SmsInteraction'][_0x07e5('0xb3')]);_0x2ad2a8[_0x07e5('0x3e')]=_[_0x07e5('0x72')](_0x15d5ca[_0x07e5('0x3e')]);_0x2ad2a8[_0x07e5('0x46')]=_[_0x07e5('0x3f')](_0x2ad2a8['model'],_0x2ad2a8[_0x07e5('0x3e')]);_0x163634[_0x07e5('0x41')]=_[_0x07e5('0x3f')](_0x2ad2a8[_0x07e5('0x3d')],qs['fields'](_0x15d5ca[_0x07e5('0x3e')]['fields']));_0x163634['attributes']=_0x163634[_0x07e5('0x41')][_0x07e5('0x42')]?_0x163634[_0x07e5('0x41')]:_0x2ad2a8[_0x07e5('0x3d')];if(_0x15d5ca['query']['includeAll']){_0x163634[_0x07e5('0xb4')]=[{'all':!![]}];}_0x163634=_[_0x07e5('0x9b')]({},_0x163634,_0x15d5ca[_0x07e5('0xb5')]);return db[_0x07e5('0x3b')][_0x07e5('0x5d')](_0x163634)['then'](handleEntityNotFound(_0x4c21e8,null))[_0x07e5('0x2a')](respondWithResult(_0x4c21e8,null))[_0x07e5('0x33')](handleError(_0x4c21e8,null));};exports[_0x07e5('0xb6')]=function(_0x4b98ab,_0x613b70){return db['SmsInteraction'][_0x07e5('0xb6')](_0x4b98ab['body'],{})[_0x07e5('0x2a')](respondWithResult(_0x613b70,0xc9))[_0x07e5('0x33')](handleError(_0x613b70,null));};exports['update']=function(_0x5ae1fe,_0x19c336){if(_0x5ae1fe[_0x07e5('0x70')]['id']){delete _0x5ae1fe[_0x07e5('0x70')]['id'];}return db[_0x07e5('0x3b')]['find']({'where':{'id':_0x5ae1fe['params']['id']}})[_0x07e5('0x2a')](handleEntityNotFound(_0x19c336,null))[_0x07e5('0x2a')](saveUpdates(_0x5ae1fe[_0x07e5('0x70')],null))[_0x07e5('0x2a')](respondWithResult(_0x19c336,null))[_0x07e5('0x33')](handleError(_0x19c336,null));};exports[_0x07e5('0x29')]=function(_0x573187,_0x2041e0){return db[_0x07e5('0x3b')]['find']({'where':{'id':_0x573187['params']['id']}})[_0x07e5('0x2a')](handleEntityNotFound(_0x2041e0,null))[_0x07e5('0x2a')](removeEntity(_0x2041e0,null))[_0x07e5('0x33')](handleError(_0x2041e0,null));};exports['describe']=function(_0x32d100,_0x350a22){return db[_0x07e5('0x3b')]['describe']()[_0x07e5('0x2a')](respondWithResult(_0x350a22,null))[_0x07e5('0x33')](handleError(_0x350a22,null));};exports[_0x07e5('0xb7')]=function(_0x13c03a,_0x5ee4ac,_0x355aae){return db[_0x07e5('0xb8')]['find']({'where':{'id':_0x13c03a[_0x07e5('0xb2')]['id']}})[_0x07e5('0x2a')](handleEntityNotFound(_0x5ee4ac,null))[_0x07e5('0x2a')](function(_0x598702){if(_0x598702){return _0x598702['addMessage'](_0x13c03a[_0x07e5('0x70')][_0x07e5('0xb9')],_[_0x07e5('0xba')](_0x13c03a['body'],[_0x07e5('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x5ee4ac,null))[_0x07e5('0x33')](handleError(_0x5ee4ac,null));};exports[_0x07e5('0xbb')]=function(_0x49af95,_0x1f2126,_0x502c9e){var _0x5e4c67={'raw':![],'where':{}};var _0x386a9c={};var _0x1d44e3={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x49af95[_0x07e5('0xb2')]['id']}})['then'](handleEntityNotFound(_0x1f2126,null))['then'](function(_0x1233e8){if(_0x1233e8){_0x386a9c[_0x07e5('0x3d')]=_[_0x07e5('0x72')](db[_0x07e5('0xb8')][_0x07e5('0xb3')]);_0x386a9c[_0x07e5('0x3e')]=_[_0x07e5('0x72')](_0x49af95[_0x07e5('0x3e')]);_0x386a9c[_0x07e5('0x46')]=_[_0x07e5('0x3f')](_0x386a9c['model'],_0x386a9c['query']);_0x5e4c67[_0x07e5('0x41')]=_['intersection'](_0x386a9c[_0x07e5('0x3d')],qs['fields'](_0x49af95['query']['fields']));_0x5e4c67[_0x07e5('0x41')]=_0x5e4c67[_0x07e5('0x41')]['length']?_0x5e4c67[_0x07e5('0x41')]:_0x386a9c['model'];if(!_0x49af95['query']['hasOwnProperty']('nolimit')){_0x5e4c67[_0x07e5('0x25')]=qs[_0x07e5('0x25')](_0x49af95[_0x07e5('0x3e')][_0x07e5('0x25')]);_0x5e4c67[_0x07e5('0x22')]=qs[_0x07e5('0x22')](_0x49af95['query'][_0x07e5('0x22')]);}_0x5e4c67[_0x07e5('0x43')]=qs[_0x07e5('0x44')](_0x49af95[_0x07e5('0x3e')][_0x07e5('0x44')]);_0x5e4c67[_0x07e5('0x45')]=qs[_0x07e5('0x46')](_['pick'](_0x49af95['query'],_0x386a9c[_0x07e5('0x46')]));_0x5e4c67['where']['SmsInteractionId']=_0x1233e8['id'];if(_0x49af95['query'][_0x07e5('0x82')]){_0x5e4c67[_0x07e5('0x45')]=_[_0x07e5('0x9b')](_0x5e4c67[_0x07e5('0x45')],{'$or':_[_0x07e5('0x6b')](_0x5e4c67[_0x07e5('0x41')],function(_0xf586ee){var _0x3058b2={};_0x3058b2[_0xf586ee]={'$like':'%'+_0x49af95[_0x07e5('0x3e')][_0x07e5('0x82')]+'%'};return _0x3058b2;})});}if(_0x49af95[_0x07e5('0x3e')]['$gte']){var _0x52db50=_0x49af95[_0x07e5('0x3e')][_0x07e5('0xbc')][_0x07e5('0x32')](',');var _0x43d635={};_0x43d635[_0x52db50[0x0]]={'$gte':moment(_0x52db50[0x1])[_0x07e5('0xbd')](_0x07e5('0xbe'))};_0x5e4c67[_0x07e5('0x45')]=_[_0x07e5('0x9b')](_0x5e4c67[_0x07e5('0x45')],_0x43d635);}_0x5e4c67=_[_0x07e5('0x9b')]({},_0x5e4c67,_0x49af95[_0x07e5('0xb5')]);return db[_0x07e5('0xb8')]['count']({'where':_0x5e4c67['where']})[_0x07e5('0x2a')](function(_0x39c57b){_0x1d44e3[_0x07e5('0x24')]=_0x39c57b;if(_0x49af95[_0x07e5('0x3e')]['includeAll']){_0x5e4c67[_0x07e5('0xb4')]=[{'all':!![]}];}return db[_0x07e5('0xb8')][_0x07e5('0xbf')](_0x5e4c67);})['then'](function(_0x145c8b){_0x1d44e3[_0x07e5('0xb0')]=_0x145c8b;return _0x1d44e3;});}})[_0x07e5('0x2a')](respondWithFilteredResult(_0x1f2126,_0x5e4c67))[_0x07e5('0x33')](handleError(_0x1f2126,null));};exports[_0x07e5('0xc0')]=function(_0x3c83e4,_0xb427b5,_0x58e434){return db[_0x07e5('0x3b')][_0x07e5('0x5d')]({'where':{'id':_0x3c83e4['params']['id']}})[_0x07e5('0x2a')](handleEntityNotFound(_0xb427b5,null))[_0x07e5('0x2a')](function(_0x265106){if(_0x265106){return _0x265106[_0x07e5('0xc1')](_0x3c83e4['body'][_0x07e5('0xb9')],_[_0x07e5('0xba')](_0x3c83e4[_0x07e5('0x70')],['ids','id'])||{})[_0x07e5('0xc2')](function(){return db['Tag'][_0x07e5('0xbf')]({'attributes':['id',_0x07e5('0x2d'),_0x07e5('0x49')],'where':{'id':_0x3c83e4[_0x07e5('0x70')][_0x07e5('0xb9')]}});})[_0x07e5('0x2a')](function(_0x5f0dcc){socket[_0x07e5('0xc3')](_0x07e5('0xc4'),{'id':Number(_0x3c83e4[_0x07e5('0xb2')]['id']),'tags':_0x5f0dcc||[]});return{'id':Number(_0x3c83e4[_0x07e5('0xb2')]['id']),'tags':_0x5f0dcc||[]};});}})[_0x07e5('0x2a')](respondWithResult(_0xb427b5,null))[_0x07e5('0x33')](handleError(_0xb427b5,null));};exports[_0x07e5('0xc5')]=function(_0x4c5b8d,_0x294b1f,_0x5e17af){return db[_0x07e5('0x3b')][_0x07e5('0x5d')]({'where':{'id':_0x4c5b8d[_0x07e5('0xb2')]['id']}})[_0x07e5('0x2a')](handleEntityNotFound(_0x294b1f,null))[_0x07e5('0x2a')](function(_0x26cb29){if(_0x26cb29){return _0x26cb29['removeTags'](_0x4c5b8d[_0x07e5('0x3e')][_0x07e5('0xb9')]);}})['then'](respondWithStatusCode(_0x294b1f,null))[_0x07e5('0x33')](handleError(_0x294b1f,null));};exports[_0x07e5('0xc6')]=function(_0x4b647a,_0x1d2d16){var _0x442134=moment()[_0x07e5('0xc7')]()[_0x07e5('0x99')]();var _0x32ea56=path[_0x07e5('0xc8')](config[_0x07e5('0xc9')],_0x07e5('0xca'),_0x07e5('0xcb'),_0x07e5('0xcc'));var _0x4080ad=path[_0x07e5('0xc8')](config[_0x07e5('0xc9')],'server',_0x07e5('0xcb'),_0x07e5('0xcd'));var _0x32e946=path['join'](_0x32ea56,_0x442134);var _0x3145d0=util['format'](_0x07e5('0xce'),_0x4b647a[_0x07e5('0xb2')]['id'],_0x442134);var _0xedc166=path[_0x07e5('0xc8')](_0x32ea56,_0x3145d0);var _0x34f2f1=[];_0x34f2f1[_0x07e5('0xcf')]({'model':db[_0x07e5('0x6e')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x34f2f1['push']({'model':db[_0x07e5('0xd0')],'as':'Contact','attributes':['id',_0x07e5('0xd1'),_0x07e5('0xd2')],'raw':!![]});var _0x3f29d3=[{'model':db[_0x07e5('0xb8')],'as':_0x07e5('0xd3'),'attributes':['id',_0x07e5('0x70'),_0x07e5('0x76'),_0x07e5('0xd4'),'secret',_0x07e5('0x7c')],'include':_0x34f2f1}];_0x3f29d3[_0x07e5('0xcf')]({'model':db[_0x07e5('0xd5')],'as':_0x07e5('0xd6'),'attributes':['id',_0x07e5('0x2d')]});_0x3f29d3['push']({'model':db[_0x07e5('0x6e')],'as':_0x07e5('0xd7'),'attributes':['id',_0x07e5('0x2f')]});return db[_0x07e5('0x3b')][_0x07e5('0x5d')]({'where':{'id':_0x4b647a['params']['id']},'include':_0x3f29d3})[_0x07e5('0x2a')](handleEntityNotFound(_0x1d2d16,null))[_0x07e5('0x2a')](function(_0x3482e4){if(_0x3482e4){var _0x17db74=_0x3482e4[_0x07e5('0xd8')]({'plain':!![]});fs[_0x07e5('0xd9')](_0x32e946);var _0x57106c={'channel':'Sms','account':_0x17db74['Account']['name'],'agent':_0x17db74[_0x07e5('0xd7')]?_0x17db74['Owner'][_0x07e5('0x2f')]:_0x07e5('0xda'),'createdAt':moment(_0x17db74['createdAt'])[_0x07e5('0xbd')](_0x07e5('0xbe'))[_0x07e5('0x99')](),'closedAt':_0x17db74[_0x07e5('0x37')]?moment(_0x17db74[_0x07e5('0xdb')])[_0x07e5('0xbd')](_0x07e5('0xbe'))[_0x07e5('0x99')]():'','disposition':_0x17db74[_0x07e5('0xdc')],'messages':_(_0x17db74['Messages'])[_0x07e5('0x82')]({'secret':![]})['map'](function(_0x89e4c8){return{'date':moment(_0x89e4c8['createdAt'])[_0x07e5('0xbd')](_0x07e5('0xbe'))['toString'](),'sender':_0x89e4c8['direction']===_0x07e5('0xdd')?_0x89e4c8[_0x07e5('0x6e')]?_0x89e4c8['User'][_0x07e5('0x2f')]:_0x07e5('0xde'):_0x89e4c8[_0x07e5('0x61')][_0x07e5('0xd1')]+(_0x89e4c8[_0x07e5('0x61')][_0x07e5('0xd2')]?'\x20'+_0x89e4c8[_0x07e5('0x61')][_0x07e5('0xd2')]:''),'body':_0x89e4c8[_0x07e5('0x70')],'direction':_0x89e4c8[_0x07e5('0xd4')]===_0x07e5('0xdd')?'A':'C','secret':_0x89e4c8[_0x07e5('0xdf')],'read':_0x89e4c8['read']};})[_0x07e5('0x64')]()};return ejs[_0x07e5('0xe0')](path[_0x07e5('0xc8')](config[_0x07e5('0xc9')],_0x07e5('0xca'),_0x07e5('0xe1'),_0x07e5('0xe2')),{'interaction':_0x57106c})[_0x07e5('0x2a')](function(_0x38d327){var _0x27336b=path[_0x07e5('0xc8')](_0x32e946,_0x07e5('0xe3')+_0x17db74['id']+'-'+_0x442134+_0x07e5('0xe4'));var _0x5afd4c={'path':_0x27336b,'channel':'Sms','interactionId':_0x17db74['id']};return pdf[_0x07e5('0xe5')](_0x38d327,_0x5afd4c);})[_0x07e5('0x2a')](function(){return new BPromise(function(_0x3dfc93,_0x1e5882){zipdir(_0x32e946,{'saveTo':_0xedc166},function(_0x9343ca,_0x26b990){if(_0x9343ca)return _0x1e5882(_0x9343ca);return _0x3dfc93(_0x26b990);});})[_0x07e5('0x2a')](function(){return new BPromise(function(_0x1653ee,_0x2ca5f0){rimraf(_0x32e946,function(_0x2486be){if(_0x2486be)_0x2ca5f0(_0x2486be);return _0x1653ee();});});})['then'](function(){return _0x1d2d16['download'](_0xedc166,_0x3145d0,function(_0x51557c){if(_0x51557c){console[_0x07e5('0xe6')](_0x07e5('0xe7'),_0x51557c);}else{fs['unlinkSync'](_0xedc166);}});});});}else{return _0x1d2d16[_0x07e5('0x2b')](0xc8);}})['catch'](handleError(_0x1d2d16,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e373b80..e6b5a5e 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 _0x1c9a=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll'];(function(_0x206e59,_0x204450){var _0x5f0aef=function(_0x26a54d){while(--_0x26a54d){_0x206e59['push'](_0x206e59['shift']());}};_0x5f0aef(++_0x204450);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2e7f01,_0x59a267){_0x2e7f01=_0x2e7f01-0x0;var _0x18b185=_0x1c9a[_0x2e7f01];return _0x18b185;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa1c9('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xa1c9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa1c9('0x3')](0x0);var events={'afterCreate':_0xa1c9('0x4'),'afterUpdate':'update','afterDestroy':_0xa1c9('0x5')};function emitEvent(_0x45d1f7){return function(_0x20f0bf,_0x3a4387,_0x572229){_0x20f0bf[_0xa1c9('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x222624){_0x20f0bf[_0xa1c9('0x7')](_0xa1c9('0x8'),_0x222624['map'](function(_0x2dfa54){return{'id':_0x2dfa54['id']};}));return SmsMessage[_0xa1c9('0x9')]({'where':{'SmsInteractionId':_0x20f0bf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa1c9('0xa')](function(_0x1efbab){_0x20f0bf['setDataValue'](_0xa1c9('0xb'),_0x1efbab[_0xa1c9('0xc')]);SmsInteractionEvents[_0xa1c9('0xd')](_0x45d1f7+':'+_0x20f0bf['id'],_0x20f0bf);SmsInteractionEvents[_0xa1c9('0xd')](_0x45d1f7,_0x20f0bf);_0x572229(null);})[_0xa1c9('0xe')](_0x572229(null));};}for(var e in events){if(events[_0xa1c9('0xf')](e)){var event=events[e];SmsInteraction[_0xa1c9('0x10')](e,emitEvent(event));}}module[_0xa1c9('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0xb0c539,_0x331322){var _0x573078=function(_0x2d8cf9){while(--_0x2d8cf9){_0xb0c539['push'](_0xb0c539['shift']());}};_0x573078(++_0x331322);}(_0x5c3c,0x132));var _0xc5c3=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5c3c[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index eb0e441..19bcf8e 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 _0x993b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','closed','format','lodash'];(function(_0x1e50fc,_0x3d2684){var _0x497f51=function(_0x2f744b){while(--_0x2f744b){_0x1e50fc['push'](_0x1e50fc['shift']());}};_0x497f51(++_0x3d2684);}(_0x993b,0xdf));var _0xb993=function(_0x5dfbe5,_0x5e0b5e){_0x5dfbe5=_0x5dfbe5-0x0;var _0x2e49b8=_0x993b[_0x5dfbe5];return _0x2e49b8;};'use strict';var _=require(_0xb993('0x0'));var util=require(_0xb993('0x1'));var logger=require(_0xb993('0x2'))(_0xb993('0x3'));var moment=require(_0xb993('0x4'));var BPromise=require(_0xb993('0x5'));var rp=require(_0xb993('0x6'));var fs=require('fs');var path=require(_0xb993('0x7'));var rimraf=require(_0xb993('0x8'));var config=require(_0xb993('0x9'));var attributes=require(_0xb993('0xa'));module['exports']=function(_0xf9f413,_0x522649){return _0xf9f413[_0xb993('0xb')](_0xb993('0xc'),attributes,{'tableName':_0xb993('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x177dac,_0x530234,_0x26020c){if(_0x177dac['changed'](_0xb993('0xe'))){_0x177dac['closedAt']=moment()[_0xb993('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x26020c(null,_0x177dac);}}});}; \ No newline at end of file +var _0x34a5=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x26f88a,_0x28a0cc){var _0x3ee7dd=function(_0x4e6a1c){while(--_0x4e6a1c){_0x26f88a['push'](_0x26f88a['shift']());}};_0x3ee7dd(++_0x28a0cc);}(_0x34a5,0x1a8));var _0x534a=function(_0x41a5ea,_0x95e72c){_0x41a5ea=_0x41a5ea-0x0;var _0x1483c4=_0x34a5[_0x41a5ea];return _0x1483c4;};'use strict';var _=require('lodash');var util=require(_0x534a('0x0'));var logger=require(_0x534a('0x1'))('api');var moment=require(_0x534a('0x2'));var BPromise=require('bluebird');var rp=require(_0x534a('0x3'));var fs=require('fs');var path=require(_0x534a('0x4'));var rimraf=require(_0x534a('0x5'));var config=require(_0x534a('0x6'));var attributes=require(_0x534a('0x7'));module[_0x534a('0x8')]=function(_0x33125b,_0x383381){return _0x33125b['define'](_0x534a('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcbcb16,_0x23f4b7,_0x7d4c02){if(_0xcbcb16[_0x534a('0xa')]('closed')){_0xcbcb16[_0x534a('0xb')]=moment()[_0x534a('0xc')](_0x534a('0xd'));}_0x7d4c02(null,_0xcbcb16);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ab469a6..4122615 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 _0xf288=['AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','AddTagsToSmsInteraction','find','ids','debug'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xf288,0x169));var _0x8f28=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xf288[_0xec034];return _0x2c5a19;};'use strict';var _=require(_0x8f28('0x0'));var util=require(_0x8f28('0x1'));var moment=require('moment');var BPromise=require(_0x8f28('0x2'));var rs=require(_0x8f28('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f28('0x4'))['db'];var utils=require(_0x8f28('0x5'));var logger=require('../../config/logger')(_0x8f28('0x6'));var config=require(_0x8f28('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8f28('0x8')][_0x8f28('0x9')]({'port':0x232a});config[_0x8f28('0xa')]=_['defaults'](config[_0x8f28('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f28('0xb'))(new Redis(config['redis']));require(_0x8f28('0xc'))['register'](socket);function respondWithRpcPromise(_0x290643,_0x46ec06,_0x2dff20){return new BPromise(function(_0x53828b,_0x5e90e4){return client['request'](_0x290643,_0x2dff20)[_0x8f28('0xd')](function(_0x2a5bf5){logger[_0x8f28('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x46ec06,'request\x20sent');logger['debug'](_0x8f28('0xf'),_0x46ec06,_0x8f28('0x10'),JSON[_0x8f28('0x11')](_0x2a5bf5));if(_0x2a5bf5[_0x8f28('0x12')]){if(_0x2a5bf5[_0x8f28('0x12')][_0x8f28('0x13')]===0x1f4){logger[_0x8f28('0x12')](_0x8f28('0x14'),_0x46ec06,_0x2a5bf5['error'][_0x8f28('0x15')]);return _0x5e90e4(_0x2a5bf5['error'][_0x8f28('0x15')]);}logger[_0x8f28('0x12')](_0x8f28('0x14'),_0x46ec06,_0x2a5bf5[_0x8f28('0x12')][_0x8f28('0x15')]);return _0x53828b(_0x2a5bf5[_0x8f28('0x12')][_0x8f28('0x15')]);}else{logger[_0x8f28('0xe')](_0x8f28('0x14'),_0x46ec06,_0x8f28('0x10'));_0x53828b(_0x2a5bf5[_0x8f28('0x16')]['message']);}})[_0x8f28('0x17')](function(_0x43476a){logger[_0x8f28('0x12')](_0x8f28('0x14'),_0x46ec06,_0x43476a);_0x5e90e4(_0x43476a);});});}exports[_0x8f28('0x18')]=function(_0xdc72d6){var _0x3bbe8e=this;return new Promise(function(_0xb23f4e,_0x23819f){return db[_0x8f28('0x19')]['update'](_0xdc72d6[_0x8f28('0x1a')],{'raw':_0xdc72d6[_0x8f28('0x1b')]?_0xdc72d6[_0x8f28('0x1b')][_0x8f28('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdc72d6[_0x8f28('0x1b')]?_0xdc72d6['options'][_0x8f28('0x1d')]||null:null,'attributes':_0xdc72d6[_0x8f28('0x1b')]?_0xdc72d6[_0x8f28('0x1b')]['attributes']||null:null,'limit':_0xdc72d6['options']?_0xdc72d6[_0x8f28('0x1b')][_0x8f28('0x1e')]||null:null})[_0x8f28('0xd')](function(_0x18c027){logger['info'](_0x8f28('0x18'),_0xdc72d6);logger['debug'](_0x8f28('0x18'),_0xdc72d6,JSON['stringify'](_0x18c027));_0xb23f4e(_0x18c027);})[_0x8f28('0x17')](function(_0x5cfe05){logger[_0x8f28('0x12')]('UpdateSmsInteraction',_0x5cfe05[_0x8f28('0x15')],_0xdc72d6);_0x23819f(_0x3bbe8e[_0x8f28('0x12')](0x1f4,_0x5cfe05['message']));});});};exports[_0x8f28('0x1f')]=function(_0x501b1f){return new Promise(function(_0x5cb022,_0x52869f){return db[_0x8f28('0x19')][_0x8f28('0x20')]({'where':_0x501b1f[_0x8f28('0x1b')]?_0x501b1f[_0x8f28('0x1b')][_0x8f28('0x1d')]||null:null})[_0x8f28('0xd')](function(_0x3cb9b5){if(_0x3cb9b5){return _0x3cb9b5['addTags'](_0x501b1f[_0x8f28('0x1a')][_0x8f28('0x21')],_['omit'](_0x501b1f[_0x8f28('0x1a')],[_0x8f28('0x21'),'id'])||{});}})['spread'](function(_0x4a3c4f){logger[_0x8f28('0xe')]('AddTags',_0x501b1f);logger[_0x8f28('0x22')]('AddTags',_0x501b1f,JSON['stringify'](_0x4a3c4f));_0x5cb022(_0x4a3c4f);})[_0x8f28('0x17')](function(_0x553a4a){logger[_0x8f28('0x12')](_0x8f28('0x23'),_0x553a4a[_0x8f28('0x15')],_0x501b1f);_0x52869f(_this[_0x8f28('0x12')](0x1f4,_0x553a4a[_0x8f28('0x15')]));});});}; \ No newline at end of file +var _0xcb8e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SmsInteraction','update','body','raw','options','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','util','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcb8e,0x1aa));var _0xecb8=function(_0x1d98fd,_0x10a737){_0x1d98fd=_0x1d98fd-0x0;var _0x1bdbb6=_0xcb8e[_0x1d98fd];return _0x1bdbb6;};'use strict';var _=require(_0xecb8('0x0'));var util=require(_0xecb8('0x1'));var moment=require(_0xecb8('0x2'));var BPromise=require('bluebird');var rs=require(_0xecb8('0x3'));var fs=require('fs');var Redis=require(_0xecb8('0x4'));var db=require(_0xecb8('0x5'))['db'];var utils=require(_0xecb8('0x6'));var logger=require(_0xecb8('0x7'))(_0xecb8('0x8'));var config=require(_0xecb8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xecb8('0xa')]({'port':0x232a});config[_0xecb8('0xb')]=_[_0xecb8('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xecb8('0xd'))(new Redis(config['redis']));require(_0xecb8('0xe'))[_0xecb8('0xf')](socket);function respondWithRpcPromise(_0x49385b,_0x5957fa,_0x6e0a28){return new BPromise(function(_0x544006,_0x99283b){return client[_0xecb8('0x10')](_0x49385b,_0x6e0a28)[_0xecb8('0x11')](function(_0x264ed9){logger[_0xecb8('0x12')](_0xecb8('0x13'),_0x5957fa,_0xecb8('0x14'));logger[_0xecb8('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5957fa,'request\x20sent',JSON[_0xecb8('0x16')](_0x264ed9));if(_0x264ed9[_0xecb8('0x17')]){if(_0x264ed9[_0xecb8('0x17')][_0xecb8('0x18')]===0x1f4){logger[_0xecb8('0x17')](_0xecb8('0x13'),_0x5957fa,_0x264ed9[_0xecb8('0x17')]['message']);return _0x99283b(_0x264ed9['error']['message']);}logger[_0xecb8('0x17')](_0xecb8('0x13'),_0x5957fa,_0x264ed9[_0xecb8('0x17')]['message']);return _0x544006(_0x264ed9[_0xecb8('0x17')][_0xecb8('0x19')]);}else{logger[_0xecb8('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x5957fa,_0xecb8('0x14'));_0x544006(_0x264ed9['result'][_0xecb8('0x19')]);}})[_0xecb8('0x1a')](function(_0x3ebbd4){logger[_0xecb8('0x17')](_0xecb8('0x13'),_0x5957fa,_0x3ebbd4);_0x99283b(_0x3ebbd4);});});}exports['UpdateSmsInteraction']=function(_0xe9c718){var _0x40ff49=this;return new Promise(function(_0x336bfe,_0x5a2e64){return db[_0xecb8('0x1b')][_0xecb8('0x1c')](_0xe9c718[_0xecb8('0x1d')],{'raw':_0xe9c718['options']?_0xe9c718['options'][_0xecb8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9c718['options']?_0xe9c718[_0xecb8('0x1f')]['where']||null:null,'attributes':_0xe9c718[_0xecb8('0x1f')]?_0xe9c718[_0xecb8('0x1f')][_0xecb8('0x20')]||null:null,'limit':_0xe9c718[_0xecb8('0x1f')]?_0xe9c718[_0xecb8('0x1f')][_0xecb8('0x21')]||null:null})[_0xecb8('0x11')](function(_0x4d0e0f){logger[_0xecb8('0x12')](_0xecb8('0x22'),_0xe9c718);logger[_0xecb8('0x15')]('UpdateSmsInteraction',_0xe9c718,JSON['stringify'](_0x4d0e0f));_0x336bfe(_0x4d0e0f);})[_0xecb8('0x1a')](function(_0x2c0726){logger[_0xecb8('0x17')](_0xecb8('0x22'),_0x2c0726[_0xecb8('0x19')],_0xe9c718);_0x5a2e64(_0x40ff49[_0xecb8('0x17')](0x1f4,_0x2c0726[_0xecb8('0x19')]));});});};exports[_0xecb8('0x23')]=function(_0x3bc67e){return new Promise(function(_0x46f49f,_0x124974){return db['SmsInteraction']['find']({'where':_0x3bc67e[_0xecb8('0x1f')]?_0x3bc67e[_0xecb8('0x1f')]['where']||null:null})[_0xecb8('0x11')](function(_0x169aa5){if(_0x169aa5){return _0x169aa5[_0xecb8('0x24')](_0x3bc67e[_0xecb8('0x1d')][_0xecb8('0x25')],_['omit'](_0x3bc67e['body'],[_0xecb8('0x25'),'id'])||{});}})['spread'](function(_0x1c6b00){logger[_0xecb8('0x12')](_0xecb8('0x26'),_0x3bc67e);logger[_0xecb8('0x15')](_0xecb8('0x26'),_0x3bc67e,JSON['stringify'](_0x1c6b00));_0x46f49f(_0x1c6b00);})[_0xecb8('0x1a')](function(_0x489bc6){logger[_0xecb8('0x17')](_0xecb8('0x26'),_0x489bc6[_0xecb8('0x19')],_0x3bc67e);_0x124974(_this['error'](0x1f4,_0x489bc6[_0xecb8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f312d5a..ffa23a3 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 _0x7e9e=['length','smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener','register'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x7e9e,0x1b2));var _0xe7e9=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x7e9e[_0x208505];return _0x1a985f;};'use strict';var SmsInteractionEvents=require(_0xe7e9('0x0'));var events=['save',_0xe7e9('0x1'),_0xe7e9('0x2')];function createListener(_0x5c947e,_0x1c41a6){return function(_0x52416d){_0x1c41a6[_0xe7e9('0x3')](_0x5c947e,_0x52416d);};}function removeListener(_0x1c1cfc,_0xf6d13f){return function(){SmsInteractionEvents[_0xe7e9('0x4')](_0x1c1cfc,_0xf6d13f);};}exports[_0xe7e9('0x5')]=function(_0x103083){for(var _0x5c202d=0x0,_0x5555db=events[_0xe7e9('0x6')];_0x5c202d<_0x5555db;_0x5c202d++){var _0x5dfe53=events[_0x5c202d];var _0x42647e=createListener(_0xe7e9('0x7')+_0x5dfe53,_0x103083);SmsInteractionEvents['on'](_0x5dfe53,_0x42647e);}}; \ No newline at end of file +var _0x7d7c=['register','length','smsInteraction:','./smsInteraction.events','save','update','emit','removeListener'];(function(_0x3677ad,_0xd3eb75){var _0x1efb79=function(_0x5e53f0){while(--_0x5e53f0){_0x3677ad['push'](_0x3677ad['shift']());}};_0x1efb79(++_0xd3eb75);}(_0x7d7c,0x8b));var _0xc7d7=function(_0x169064,_0x6781f7){_0x169064=_0x169064-0x0;var _0x285bba=_0x7d7c[_0x169064];return _0x285bba;};'use strict';var SmsInteractionEvents=require(_0xc7d7('0x0'));var events=[_0xc7d7('0x1'),'remove',_0xc7d7('0x2')];function createListener(_0x2e675e,_0x917b96){return function(_0x43e453){_0x917b96[_0xc7d7('0x3')](_0x2e675e,_0x43e453);};}function removeListener(_0x22681e,_0xa39b6c){return function(){SmsInteractionEvents[_0xc7d7('0x4')](_0x22681e,_0xa39b6c);};}exports[_0xc7d7('0x5')]=function(_0xcb978d){for(var _0x1c96a5=0x0,_0x58344f=events[_0xc7d7('0x6')];_0x1c96a5<_0x58344f;_0x1c96a5++){var _0xa261b9=events[_0x1c96a5];var _0x55f55c=createListener(_0xc7d7('0x7')+_0xa261b9,_0xcb978d);SmsInteractionEvents['on'](_0xa261b9,_0x55f55c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0718f38..c0a08e8 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 _0x9338=['/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x3d4609,_0x5ab398){var _0x264a66=function(_0x5708e1){while(--_0x5708e1){_0x3d4609['push'](_0x3d4609['shift']());}};_0x264a66(++_0x5ab398);}(_0x9338,0x1b6));var _0x8933=function(_0x822a3f,_0x32fd83){_0x822a3f=_0x822a3f-0x0;var _0x1053e7=_0x9338[_0x822a3f];return _0x1053e7;};'use strict';var multer=require('multer');var util=require(_0x8933('0x0'));var path=require(_0x8933('0x1'));var timeout=require(_0x8933('0x2'));var express=require(_0x8933('0x3'));var router=express[_0x8933('0x4')]();var fs_extra=require(_0x8933('0x5'));var auth=require(_0x8933('0x6'));var interaction=require(_0x8933('0x7'));var config=require(_0x8933('0x8'));var controller=require(_0x8933('0x9'));router[_0x8933('0xa')]('/',auth[_0x8933('0xb')](),controller['index']);router[_0x8933('0xa')](_0x8933('0xc'),auth['isAuthenticated'](),controller[_0x8933('0xd')]);router['get'](_0x8933('0xe'),auth['isAuthenticated'](),controller[_0x8933('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x8933('0x10')](_0x8933('0x11'),_0x8933('0x12')),controller[_0x8933('0x13')]);router[_0x8933('0x14')](_0x8933('0x15'),controller[_0x8933('0x16')]);router[_0x8933('0x17')]('/:id',auth[_0x8933('0xb')](),controller[_0x8933('0x18')]);router['put'](_0x8933('0x19'),auth['isAuthenticated'](),controller[_0x8933('0x1a')]);router[_0x8933('0x17')](_0x8933('0x1b'),auth[_0x8933('0xb')](),controller[_0x8933('0x1c')]);router[_0x8933('0x1d')](_0x8933('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8933('0x1e')]=router; \ No newline at end of file +var _0xe9ab=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','reject','delete','destroy','exports','multer'];(function(_0x425c44,_0x5df4c3){var _0x35cfe6=function(_0x31e0bf){while(--_0x31e0bf){_0x425c44['push'](_0x425c44['shift']());}};_0x35cfe6(++_0x5df4c3);}(_0xe9ab,0xc3));var _0xbe9a=function(_0x5432f3,_0x147376){_0x5432f3=_0x5432f3-0x0;var _0x5ccdcb=_0xe9ab[_0x5432f3];return _0x5ccdcb;};'use strict';var multer=require(_0xbe9a('0x0'));var util=require('util');var path=require(_0xbe9a('0x1'));var timeout=require(_0xbe9a('0x2'));var express=require(_0xbe9a('0x3'));var router=express[_0xbe9a('0x4')]();var fs_extra=require(_0xbe9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe9a('0x6'));var config=require(_0xbe9a('0x7'));var controller=require('./smsMessage.controller');router[_0xbe9a('0x8')]('/',auth[_0xbe9a('0x9')](),controller[_0xbe9a('0xa')]);router[_0xbe9a('0x8')](_0xbe9a('0xb'),auth[_0xbe9a('0x9')](),controller[_0xbe9a('0xc')]);router[_0xbe9a('0x8')](_0xbe9a('0xd'),auth['isAuthenticated'](),controller[_0xbe9a('0xe')]);router[_0xbe9a('0xf')]('/',auth[_0xbe9a('0x9')](),interaction[_0xbe9a('0x10')](_0xbe9a('0x11'),_0xbe9a('0x12')),controller[_0xbe9a('0x13')]);router['post'](_0xbe9a('0x14'),controller['status']);router[_0xbe9a('0x15')](_0xbe9a('0xd'),auth[_0xbe9a('0x9')](),controller[_0xbe9a('0x16')]);router[_0xbe9a('0x15')](_0xbe9a('0x17'),auth[_0xbe9a('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0xbe9a('0x9')](),controller[_0xbe9a('0x18')]);router[_0xbe9a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbe9a('0x1a')]);module[_0xbe9a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9b9f958..2fc25c9 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 _0xc30e=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x522762,_0x3028a7){var _0x5a36f0=function(_0xfbe96b){while(--_0xfbe96b){_0x522762['push'](_0x522762['shift']());}};_0x5a36f0(++_0x3028a7);}(_0xc30e,0x1d8));var _0xec30=function(_0x49d1b6,_0x186ec6){_0x49d1b6=_0x49d1b6-0x0;var _0x1d95ec=_0xc30e[_0x49d1b6];return _0x1d95ec;};'use strict';var Sequelize=require(_0xec30('0x0'));module['exports']={'body':{'type':Sequelize[_0xec30('0x1')](_0xec30('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xec30('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec30('0x4')]('in',_0xec30('0x5')),'defaultValue':_0xec30('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xec30('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xec30('0x7')]},'secret':{'type':Sequelize[_0xec30('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xec30('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdd05=['exports','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xdd05,0xfb));var _0x5dd0=function(_0x129422,_0x4af03c){_0x129422=_0x129422-0x0;var _0x3f7f3a=_0xdd05[_0x129422];return _0x3f7f3a;};'use strict';var Sequelize=require(_0x5dd0('0x0'));module[_0x5dd0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5dd0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5dd0('0x4')),'defaultValue':_0x5dd0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dd0('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5dd0('0x5')]},'readAt':{'type':Sequelize[_0x5dd0('0x6')]},'secret':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5dd0('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b080802..00b2b3f 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 _0x7939=['../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','show','params','length','includeAll','include','find','create','body','describe','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','SmsInteractionId','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','delivered','Status','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3be1c0,_0x23d2a7){var _0x4d77c0=function(_0x509382){while(--_0x509382){_0x3be1c0['push'](_0x3be1c0['shift']());}};_0x4d77c0(++_0x23d2a7);}(_0x7939,0x11c));var _0x9793=function(_0x49e81c,_0x1294dd){_0x49e81c=_0x49e81c-0x0;var _0x1830ab=_0x7939[_0x49e81c];return _0x1830ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9793('0x0'));var zipdir=require(_0x9793('0x1'));var jsonpatch=require(_0x9793('0x2'));var rp=require(_0x9793('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9793('0x4'));var path=require(_0x9793('0x5'));var sox=require(_0x9793('0x6'));var csv=require(_0x9793('0x7'));var ejs=require(_0x9793('0x8'));var fs=require('fs');var fs_extra=require(_0x9793('0x9'));var _=require(_0x9793('0xa'));var squel=require('squel');var crypto=require(_0x9793('0xb'));var jsforce=require(_0x9793('0xc'));var deskjs=require(_0x9793('0xd'));var toCsv=require(_0x9793('0x7'));var querystring=require('querystring');var Papa=require(_0x9793('0xe'));var Redis=require('ioredis');var authService=require(_0x9793('0xf'));var qs=require(_0x9793('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9793('0x11'));var logger=require(_0x9793('0x12'))(_0x9793('0x13'));var utils=require(_0x9793('0x14'));var config=require(_0x9793('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9793('0x16')]=_[_0x9793('0x17')](config[_0x9793('0x16')],{'host':_0x9793('0x18'),'port':0x18eb});var socket=require(_0x9793('0x19'))(new Redis(config[_0x9793('0x16')]));require(_0x9793('0x1a'))[_0x9793('0x1b')](socket);var jayson=require(_0x9793('0x1c'));var client=jayson[_0x9793('0x1d')][_0x9793('0x1e')]({'port':0x232c});var client9002=jayson[_0x9793('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x277e9b,_0x2953f9,_0x54cacc,_0x5cf237){return new BPromise(function(_0x16aa79,_0x4fe0be){var _0x39b676=_0x5cf237||client;return _0x39b676['request'](_0x277e9b,_0x54cacc)[_0x9793('0x1f')](function(_0x41617c){logger[_0x9793('0x20')]('SmsMessage,\x20%s,\x20%s',_0x2953f9,'request\x20sent');logger[_0x9793('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2953f9,'request\x20sent',JSON[_0x9793('0x22')](_0x41617c));if(_0x41617c['error']){if(_0x41617c[_0x9793('0x23')][_0x9793('0x24')]===0x1f4){logger[_0x9793('0x23')](_0x9793('0x25'),_0x2953f9,_0x41617c[_0x9793('0x23')]['message']);return _0x4fe0be(_0x41617c[_0x9793('0x23')][_0x9793('0x26')]);}logger['error'](_0x9793('0x25'),_0x2953f9,_0x41617c['error'][_0x9793('0x26')]);return _0x16aa79(_0x41617c[_0x9793('0x23')]['message']);}else{logger['info'](_0x9793('0x25'),_0x2953f9,_0x9793('0x27'));_0x16aa79(_0x41617c[_0x9793('0x28')]['message']);}})[_0x9793('0x29')](function(_0xd94215){logger[_0x9793('0x23')](_0x9793('0x25'),_0x2953f9,_0xd94215);_0x4fe0be(_0xd94215);});});}function respondWithStatusCode(_0x2de478,_0x97f89){_0x97f89=_0x97f89||0xcc;return function(_0x37c608){if(_0x37c608){return _0x2de478[_0x9793('0x2a')](_0x97f89);}return _0x2de478[_0x9793('0x2b')](_0x97f89)[_0x9793('0x2c')]();};}function respondWithResult(_0x92f198,_0xf8e48d){_0xf8e48d=_0xf8e48d||0xc8;return function(_0x2ff4ea){if(_0x2ff4ea){return _0x92f198['status'](_0xf8e48d)[_0x9793('0x2d')](_0x2ff4ea);}};}function respondWithFilteredResult(_0x1b26ff,_0x11ec8d){return function(_0x11edd4){if(_0x11edd4){var _0x481e8a=typeof _0x11ec8d[_0x9793('0x2e')]===_0x9793('0x2f')&&typeof _0x11ec8d['limit']===_0x9793('0x2f');var _0x233242=_0x11edd4[_0x9793('0x30')];var _0x53ba5f=_0x481e8a?0x0:_0x11ec8d[_0x9793('0x2e')];var _0x3a8897=_0x481e8a?_0x11edd4[_0x9793('0x30')]:_0x11ec8d['offset']+_0x11ec8d[_0x9793('0x31')];var _0xbea55d;if(_0x3a8897>=_0x233242){_0x3a8897=_0x233242;_0xbea55d=0xc8;}else{_0xbea55d=0xce;}_0x1b26ff['status'](_0xbea55d);return _0x1b26ff[_0x9793('0x32')](_0x9793('0x33'),_0x53ba5f+'-'+_0x3a8897+'/'+_0x233242)['json'](_0x11edd4);}return null;};}function patchUpdates(_0x222525){return function(_0x31fef5){try{jsonpatch[_0x9793('0x34')](_0x31fef5,_0x222525,!![]);}catch(_0x34cc53){return BPromise[_0x9793('0x35')](_0x34cc53);}return _0x31fef5[_0x9793('0x36')]();};}function saveUpdates(_0x2ecdd1,_0x373565){return function(_0x38f020){if(_0x38f020){return _0x38f020[_0x9793('0x37')](_0x2ecdd1)[_0x9793('0x1f')](function(_0xa5cca3){return _0xa5cca3;});}return null;};}function removeEntity(_0x504d9c,_0x11487c){return function(_0x454295){if(_0x454295){return _0x454295[_0x9793('0x38')]()['then'](function(){_0x504d9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a6db,_0x4c5c50){return function(_0x36eab2){if(!_0x36eab2){_0x28a6db[_0x9793('0x2a')](0x194);}return _0x36eab2;};}function handleError(_0x431e73,_0x146850){_0x146850=_0x146850||0x1f4;return function(_0x8fdac4){logger[_0x9793('0x23')](_0x8fdac4[_0x9793('0x39')]);if(_0x8fdac4[_0x9793('0x3a')]){delete _0x8fdac4['name'];}_0x431e73[_0x9793('0x2b')](_0x146850)[_0x9793('0x3b')](_0x8fdac4);};}exports[_0x9793('0x3c')]=function(_0x1ff1c8,_0x3466e9){var _0x59e364={},_0x48a739={},_0x2ceca1={'count':0x0,'rows':[]};var _0x3c0f99=_[_0x9793('0x3d')](db[_0x9793('0x3e')][_0x9793('0x3f')],function(_0x131941){return{'name':_0x131941['fieldName'],'type':_0x131941[_0x9793('0x40')][_0x9793('0x41')]};});_0x48a739[_0x9793('0x42')]=_['map'](_0x3c0f99,_0x9793('0x3a'));_0x48a739['query']=_[_0x9793('0x43')](_0x1ff1c8[_0x9793('0x44')]);_0x48a739['filters']=_['intersection'](_0x48a739[_0x9793('0x42')],_0x48a739[_0x9793('0x44')]);_0x59e364[_0x9793('0x45')]=_[_0x9793('0x46')](_0x48a739['model'],qs[_0x9793('0x47')](_0x1ff1c8['query']['fields']));_0x59e364[_0x9793('0x45')]=_0x59e364[_0x9793('0x45')]['length']?_0x59e364['attributes']:_0x48a739[_0x9793('0x42')];if(!_0x1ff1c8[_0x9793('0x44')][_0x9793('0x48')](_0x9793('0x49'))){_0x59e364['limit']=qs[_0x9793('0x31')](_0x1ff1c8['query'][_0x9793('0x31')]);_0x59e364[_0x9793('0x2e')]=qs[_0x9793('0x2e')](_0x1ff1c8[_0x9793('0x44')][_0x9793('0x2e')]);}_0x59e364[_0x9793('0x4a')]=qs[_0x9793('0x4b')](_0x1ff1c8[_0x9793('0x44')][_0x9793('0x4b')]);_0x59e364[_0x9793('0x4c')]=qs[_0x9793('0x4d')](_['pick'](_0x1ff1c8[_0x9793('0x44')],_0x48a739[_0x9793('0x4d')]),_0x3c0f99);if(_0x1ff1c8[_0x9793('0x44')]['filter']){_0x59e364[_0x9793('0x4c')]=_[_0x9793('0x4e')](_0x59e364[_0x9793('0x4c')],{'$or':_[_0x9793('0x3d')](_0x3c0f99,function(_0x4a5ef5){if(_0x4a5ef5[_0x9793('0x40')]!==_0x9793('0x4f')){var _0x53e7b1={};_0x53e7b1[_0x4a5ef5[_0x9793('0x3a')]]={'$like':'%'+_0x1ff1c8['query'][_0x9793('0x50')]+'%'};return _0x53e7b1;}})});}_0x59e364=_['merge']({},_0x59e364,_0x1ff1c8[_0x9793('0x51')]);var _0x45df62={'where':_0x59e364[_0x9793('0x4c')]};return db[_0x9793('0x3e')][_0x9793('0x30')](_0x45df62)[_0x9793('0x1f')](function(_0x2e7dd3){_0x2ceca1[_0x9793('0x30')]=_0x2e7dd3;if(_0x1ff1c8[_0x9793('0x44')]['includeAll']){_0x59e364['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x59e364);})[_0x9793('0x1f')](function(_0x3817b6){_0x2ceca1['rows']=_0x3817b6;return _0x2ceca1;})[_0x9793('0x1f')](respondWithFilteredResult(_0x3466e9,_0x59e364))[_0x9793('0x29')](handleError(_0x3466e9,null));};exports[_0x9793('0x52')]=function(_0x18c6b5,_0x2ed443){var _0x5ca010={'raw':!![],'where':{'id':_0x18c6b5[_0x9793('0x53')]['id']}},_0x51b722={};_0x51b722['model']=_['keys'](db[_0x9793('0x3e')][_0x9793('0x3f')]);_0x51b722['query']=_[_0x9793('0x43')](_0x18c6b5[_0x9793('0x44')]);_0x51b722[_0x9793('0x4d')]=_[_0x9793('0x46')](_0x51b722['model'],_0x51b722[_0x9793('0x44')]);_0x5ca010[_0x9793('0x45')]=_[_0x9793('0x46')](_0x51b722[_0x9793('0x42')],qs[_0x9793('0x47')](_0x18c6b5['query'][_0x9793('0x47')]));_0x5ca010[_0x9793('0x45')]=_0x5ca010[_0x9793('0x45')][_0x9793('0x54')]?_0x5ca010['attributes']:_0x51b722['model'];if(_0x18c6b5[_0x9793('0x44')][_0x9793('0x55')]){_0x5ca010[_0x9793('0x56')]=[{'all':!![]}];}_0x5ca010=_['merge']({},_0x5ca010,_0x18c6b5['options']);return db[_0x9793('0x3e')][_0x9793('0x57')](_0x5ca010)[_0x9793('0x1f')](handleEntityNotFound(_0x2ed443,null))[_0x9793('0x1f')](respondWithResult(_0x2ed443,null))['catch'](handleError(_0x2ed443,null));};exports[_0x9793('0x58')]=function(_0x27e023,_0x216226){return db[_0x9793('0x3e')]['create'](_0x27e023['body'],{})[_0x9793('0x1f')](respondWithResult(_0x216226,0xc9))[_0x9793('0x29')](handleError(_0x216226,null));};exports[_0x9793('0x37')]=function(_0x40c043,_0x4a8f6e){if(_0x40c043['body']['id']){delete _0x40c043[_0x9793('0x59')]['id'];}return db[_0x9793('0x3e')][_0x9793('0x57')]({'where':{'id':_0x40c043[_0x9793('0x53')]['id']}})[_0x9793('0x1f')](handleEntityNotFound(_0x4a8f6e,null))[_0x9793('0x1f')](saveUpdates(_0x40c043[_0x9793('0x59')],null))['then'](respondWithResult(_0x4a8f6e,null))[_0x9793('0x29')](handleError(_0x4a8f6e,null));};exports[_0x9793('0x38')]=function(_0x49b58e,_0x3680cb){return db[_0x9793('0x3e')][_0x9793('0x57')]({'where':{'id':_0x49b58e[_0x9793('0x53')]['id']}})[_0x9793('0x1f')](handleEntityNotFound(_0x3680cb,null))[_0x9793('0x1f')](removeEntity(_0x3680cb,null))['catch'](handleError(_0x3680cb,null));};exports[_0x9793('0x5a')]=function(_0x3572db,_0x7f0a6b){return db[_0x9793('0x3e')][_0x9793('0x5a')]()[_0x9793('0x1f')](respondWithResult(_0x7f0a6b,null))['catch'](handleError(_0x7f0a6b,null));};var interaction_log=require(_0x9793('0x12'))(_0x9793('0x5b'));exports['accept']=function(_0x4a0a69,_0x31fad5,_0x484f0b){var _0x3cccfa={'agent':{},'channel':_0x9793('0x5c')};if(_0x4a0a69[_0x9793('0x59')]['id']){delete _0x4a0a69[_0x9793('0x59')]['id'];}_0x4a0a69[_0x9793('0x59')][_0x9793('0x5d')]=!![];_0x4a0a69[_0x9793('0x59')][_0x9793('0x5e')]=moment()[_0x9793('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a0a69['body'][_0x9793('0x60')]=_0x4a0a69['body'][_0x9793('0x60')]||_0x4a0a69[_0x9793('0x61')]['id'];_0x3cccfa[_0x9793('0x62')]['id']=_0x4a0a69[_0x9793('0x59')][_0x9793('0x60')];return db['SmsMessage'][_0x9793('0x57')]({'where':{'id':_0x4a0a69[_0x9793('0x53')]['id'],'UserId':null}})[_0x9793('0x1f')](handleEntityNotFound(_0x31fad5,null))[_0x9793('0x1f')](saveUpdates(_0x4a0a69[_0x9793('0x59')],null))[_0x9793('0x1f')](function(_0x278a19){if(_0x278a19){_0x3cccfa[_0x9793('0x26')]=_0x278a19[_0x9793('0x63')]({'plain':!![]});return db[_0x9793('0x64')][_0x9793('0x57')]({'where':{'id':_0x278a19['SmsInteractionId']}});}return null;})[_0x9793('0x1f')](handleEntityNotFound(_0x31fad5,null))['then'](function(_0x12bcdb){if(_0x12bcdb){return _0x12bcdb[_0x9793('0x37')]({'UserId':_0x4a0a69['body'][_0x9793('0x60')],'read1stAt':_[_0x9793('0x65')](_0x12bcdb[_0x9793('0x66')])?moment()['format'](_0x9793('0x67')):undefined});}return null;})[_0x9793('0x1f')](function(_0x3269fa){if(_0x3269fa){_0x3cccfa[_0x9793('0x68')]=_0x3269fa[_0x9793('0x63')]({'plain':!![]});interaction_log['info'](_0x9793('0x69'),_0x4a0a69[_0x9793('0x61')]['id'],_0x4a0a69['user']['name'],_0x4a0a69[_0x9793('0x61')][_0x9793('0x6a')],_0x3cccfa[_0x9793('0x68')]['id'],_0x4a0a69['body']?JSON[_0x9793('0x22')](_0x4a0a69[_0x9793('0x59')]):'null');return respondWithRpcPromise(_0x9793('0x6b'),_0x9793('0x6c'),_0x3cccfa);}return null;})[_0x9793('0x1f')](function(_0x163446){var _0x1cbf12='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x163446[_0x9793('0x26')][_0x9793('0x6d')];return db[_0x9793('0x6e')][_0x9793('0x44')](_0x1cbf12,{'type':db['Sequelize'][_0x9793('0x6f')]['SELECT'],'raw':!![]})[_0x9793('0x1f')](function(_0x144d79){return _0x144d79;});})[_0x9793('0x1f')](function(_0x380427){if(_0x380427){_0x3cccfa[_0x9793('0x26')]['contact']=_0x380427[0x0];if(!_0x4a0a69[_0x9793('0x59')][_0x9793('0x60')])return;return db[_0x9793('0x70')][_0x9793('0x57')]({'where':{'id':_0x4a0a69[_0x9793('0x59')]['UserId'],'role':_0x9793('0x62')},'attributes':['id','name',_0x9793('0x71'),_0x9793('0x72'),_0x9793('0x73')],'raw':!![]});}return null;})[_0x9793('0x1f')](function(_0x216f42){if(!_0x216f42)return null;_0x3cccfa['message'][_0x9793('0x62')]=_0x216f42;return _0x3cccfa;})[_0x9793('0x1f')](function(_0x42ba4f){if(_0x42ba4f){if(_0x4a0a69[_0x9793('0x59')][_0x9793('0x74')]){_0x3cccfa[_0x9793('0x26')][_0x9793('0x75')]=util[_0x9793('0x5f')](_0x9793('0x76'),_0x4a0a69[_0x9793('0x61')]['name']);_0x3cccfa['message']['channel']=_0x3cccfa[_0x9793('0x77')];_0x3cccfa[_0x9793('0x26')][_0x9793('0x78')]=_0x3cccfa['channel'];_0x3cccfa[_0x9793('0x26')]['event']=_0x9793('0x79');return respondWithRpcPromise(_0x9793('0x7a'),_0x9793('0x7a'),{'event':_0x9793('0x7b'),'message':_0x3cccfa['message']},client9002)['then'](function(){return _0x3cccfa;});}return _0x3cccfa;}return null;})[_0x9793('0x1f')](respondWithResult(_0x31fad5,null))[_0x9793('0x29')](handleError(_0x31fad5,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x9793('0x35')]=function(_0x1229c6,_0x423eaa,_0x1c8bbb){var _0x463501={'agent':{},'channel':_0x9793('0x5c')};if(_0x1229c6[_0x9793('0x59')]['id']){delete _0x1229c6['body']['id'];}_0x1229c6[_0x9793('0x59')][_0x9793('0x60')]=_0x1229c6['body'][_0x9793('0x60')]||_0x1229c6[_0x9793('0x61')]['id'];_0x463501[_0x9793('0x62')]['id']=_0x1229c6[_0x9793('0x59')][_0x9793('0x60')];return db[_0x9793('0x3e')][_0x9793('0x57')]({'where':{'id':_0x1229c6[_0x9793('0x53')]['id'],'UserId':null}})[_0x9793('0x1f')](handleEntityNotFound(_0x423eaa,null))['then'](function(_0x567815){if(_0x567815){_0x463501[_0x9793('0x26')]=_0x567815[_0x9793('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x9793('0x57')]({'where':{'id':_0x567815[_0x9793('0x7c')]}});}return null;})[_0x9793('0x1f')](handleEntityNotFound(_0x423eaa,null))['then'](function(_0x34021e){if(_0x34021e){_0x463501[_0x9793('0x68')]=_0x34021e[_0x9793('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1229c6[_0x9793('0x61')]['id'],_0x1229c6['user'][_0x9793('0x3a')],_0x1229c6[_0x9793('0x61')]['role'],_0x463501[_0x9793('0x68')]['id'],_0x1229c6[_0x9793('0x59')]?JSON[_0x9793('0x22')](_0x1229c6['body']):_0x9793('0x7d'));return respondWithRpcPromise(_0x9793('0x7e'),_0x9793('0x7f'),_0x463501);}return null;})[_0x9793('0x1f')](function(_0x24ffc2){var _0x2edf4e=_0x9793('0x80')+_0x24ffc2['message']['ContactId'];return db[_0x9793('0x6e')][_0x9793('0x44')](_0x2edf4e,{'type':db[_0x9793('0x81')][_0x9793('0x6f')][_0x9793('0x82')],'raw':!![]})[_0x9793('0x1f')](function(_0x5a4ad5){return _0x5a4ad5;});})[_0x9793('0x1f')](function(_0x290338){if(_0x290338){_0x463501[_0x9793('0x26')][_0x9793('0x83')]=_0x290338[0x0];if(!_0x1229c6[_0x9793('0x59')][_0x9793('0x60')])return;return db['User']['find']({'where':{'id':_0x1229c6['body'][_0x9793('0x60')],'role':_0x9793('0x62')},'attributes':['id',_0x9793('0x3a'),_0x9793('0x71'),'email',_0x9793('0x73')],'raw':!![]});}return null;})[_0x9793('0x1f')](function(_0x3839be){if(!_0x3839be)return null;_0x463501['message']['agent']=_0x3839be;return _0x463501;})[_0x9793('0x1f')](function(_0x2c5e70){if(_0x2c5e70){_0x2c5e70[_0x9793('0x26')][_0x9793('0x75')]=util[_0x9793('0x5f')](_0x9793('0x76'),_0x1229c6[_0x9793('0x61')][_0x9793('0x3a')]);_0x2c5e70[_0x9793('0x26')][_0x9793('0x77')]=_0x463501[_0x9793('0x77')];_0x2c5e70['message']['motionChannel']=_0x463501[_0x9793('0x77')];_0x2c5e70[_0x9793('0x26')][_0x9793('0x84')]='reject';respondWithRpcPromise(_0x9793('0x7a'),'EventManager',{'event':_0x9793('0x85'),'message':_0x2c5e70[_0x9793('0x26')]},client9002);return _0x463501;}return null;})[_0x9793('0x1f')](respondWithResult(_0x423eaa,null))[_0x9793('0x29')](handleError(_0x423eaa,null));};exports[_0x9793('0x2b')]=function(_0xe004e6,_0x5e3dc3,_0x1a0810){if(_0xe004e6[_0x9793('0x59')]['id']){delete _0xe004e6[_0x9793('0x59')]['id'];}var _0x5970b8;return db['SmsMessage'][_0x9793('0x57')]({'where':{'id':_0xe004e6[_0x9793('0x53')]['id']}})[_0x9793('0x1f')](handleEntityNotFound(_0x5e3dc3,null))['then'](function(_0x1b42b8){if(_0x1b42b8){_0x5970b8=_0x1b42b8;return db[_0x9793('0x86')][_0x9793('0x57')]({'where':{'id':_0x1b42b8[_0x9793('0x87')]}});}})[_0x9793('0x1f')](handleEntityNotFound(_0x5e3dc3,null))[_0x9793('0x1f')](function(_0x220307){if(_0x220307){logger[_0x9793('0x21')](_0x9793('0x88'),_0x9793('0x2b'),'received\x20delivery\x20report\x20from',_0x220307[_0x9793('0x40')],util[_0x9793('0x89')](_0xe004e6[_0x9793('0x59')],{'showHidden':![],'depth':null}));switch(_0x220307[_0x9793('0x40')]){case'twilio':if(_0xe004e6['body'][_0x9793('0x8a')]&&_0xe004e6[_0x9793('0x59')][_0x9793('0x8a')]===_0x5970b8[_0x9793('0x8b')]){return _0x5970b8[_0x9793('0x37')]({'read':!![]});}else{logger[_0x9793('0x23')](_0x9793('0x8c'),_0x9793('0x2b'),_0x9793('0x8d'),util[_0x9793('0x89')](_0xe004e6[_0x9793('0x59')],{'showHidden':![],'depth':null}));}break;case _0x9793('0x8e'):if(_0xe004e6['body'][_0x9793('0x8f')]&&_0xe004e6['body'][_0x9793('0x8f')]===_0x5970b8[_0x9793('0x8b')]&&_['indexOf']([_0x9793('0x90'),_0x9793('0x91')],_0xe004e6[_0x9793('0x59')][_0x9793('0x92')])>=0x0){return _0x5970b8[_0x9793('0x37')]({'read':!![]});}else{logger[_0x9793('0x23')](_0x9793('0x8c'),_0x9793('0x2b'),'plivio',util[_0x9793('0x89')](_0xe004e6['body'],{'showHidden':![],'depth':null}));}break;case _0x9793('0x93'):var _0x6dad31=_0xe004e6['body'][_0x9793('0x94')][0x0];if(_0x6dad31[_0x9793('0x2b')][_0x9793('0x95')]===_0x9793('0x96')){return _0x5970b8[_0x9793('0x37')]({'read':!![]});}else{logger[_0x9793('0x23')](_0x9793('0x8c'),_0x9793('0x2b'),_0x9793('0x93'),util['inspect'](_0xe004e6[_0x9793('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5970b8;}})[_0x9793('0x1f')](respondWithResult(_0x5e3dc3,null))[_0x9793('0x29')](handleError(_0x5e3dc3,null));}; \ No newline at end of file +var _0x707b=['fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','rows','catch','create','body','find','params','destroy','describe','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','email','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','infobip','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','limit','undefined','offset','set','apply','reject','save','update','then','end','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x36669e,_0x31853c){var _0x33b5c5=function(_0x420827){while(--_0x420827){_0x36669e['push'](_0x36669e['shift']());}};_0x33b5c5(++_0x31853c);}(_0x707b,0xdf));var _0xb707=function(_0x45682b,_0x22ef44){_0x45682b=_0x45682b-0x0;var _0x28c3cd=_0x707b[_0x45682b];return _0x28c3cd;};'use strict';var emlformat=require(_0xb707('0x0'));var rimraf=require(_0xb707('0x1'));var zipdir=require(_0xb707('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb707('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb707('0x4'));var util=require(_0xb707('0x5'));var path=require(_0xb707('0x6'));var sox=require(_0xb707('0x7'));var csv=require(_0xb707('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb707('0x9'));var crypto=require(_0xb707('0xa'));var jsforce=require(_0xb707('0xb'));var deskjs=require(_0xb707('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb707('0xd'));var Papa=require(_0xb707('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb707('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb707('0x10'))(_0xb707('0x11'));var utils=require(_0xb707('0x12'));var config=require(_0xb707('0x13'));var licenseUtil=require(_0xb707('0x14'));var db=require(_0xb707('0x15'))['db'];config[_0xb707('0x16')]=_[_0xb707('0x17')](config['redis'],{'host':_0xb707('0x18'),'port':0x18eb});var socket=require(_0xb707('0x19'))(new Redis(config[_0xb707('0x16')]));require('./smsMessage.socket')[_0xb707('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb707('0x1b')][_0xb707('0x1c')]({'port':0x232c});var client9002=jayson[_0xb707('0x1b')][_0xb707('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1df94d,_0x4c45b2,_0x34f5f6,_0x34b84f){return new BPromise(function(_0x4ae43e,_0x591bb9){var _0x4923b4=_0x34b84f||client;return _0x4923b4['request'](_0x1df94d,_0x34f5f6)['then'](function(_0xa6944f){logger[_0xb707('0x1d')](_0xb707('0x1e'),_0x4c45b2,'request\x20sent');logger[_0xb707('0x1f')](_0xb707('0x20'),_0x4c45b2,_0xb707('0x21'),JSON[_0xb707('0x22')](_0xa6944f));if(_0xa6944f[_0xb707('0x23')]){if(_0xa6944f[_0xb707('0x23')][_0xb707('0x24')]===0x1f4){logger[_0xb707('0x23')]('SmsMessage,\x20%s,\x20%s',_0x4c45b2,_0xa6944f[_0xb707('0x23')]['message']);return _0x591bb9(_0xa6944f[_0xb707('0x23')][_0xb707('0x25')]);}logger[_0xb707('0x23')](_0xb707('0x1e'),_0x4c45b2,_0xa6944f[_0xb707('0x23')][_0xb707('0x25')]);return _0x4ae43e(_0xa6944f['error'][_0xb707('0x25')]);}else{logger[_0xb707('0x1d')]('SmsMessage,\x20%s,\x20%s',_0x4c45b2,_0xb707('0x21'));_0x4ae43e(_0xa6944f[_0xb707('0x26')][_0xb707('0x25')]);}})['catch'](function(_0x1b2437){logger[_0xb707('0x23')](_0xb707('0x1e'),_0x4c45b2,_0x1b2437);_0x591bb9(_0x1b2437);});});}function respondWithStatusCode(_0x6959a9,_0x2b638c){_0x2b638c=_0x2b638c||0xcc;return function(_0x515541){if(_0x515541){return _0x6959a9[_0xb707('0x27')](_0x2b638c);}return _0x6959a9[_0xb707('0x28')](_0x2b638c)['end']();};}function respondWithResult(_0x38a367,_0x432972){_0x432972=_0x432972||0xc8;return function(_0x187848){if(_0x187848){return _0x38a367[_0xb707('0x28')](_0x432972)[_0xb707('0x29')](_0x187848);}};}function respondWithFilteredResult(_0x5dade7,_0x1ea195){return function(_0x3b38de){if(_0x3b38de){var _0x44eead=typeof _0x1ea195['offset']==='undefined'&&typeof _0x1ea195[_0xb707('0x2a')]===_0xb707('0x2b');var _0x37eb45=_0x3b38de['count'];var _0x4f972c=_0x44eead?0x0:_0x1ea195['offset'];var _0x1503fc=_0x44eead?_0x3b38de['count']:_0x1ea195[_0xb707('0x2c')]+_0x1ea195[_0xb707('0x2a')];var _0x458de2;if(_0x1503fc>=_0x37eb45){_0x1503fc=_0x37eb45;_0x458de2=0xc8;}else{_0x458de2=0xce;}_0x5dade7['status'](_0x458de2);return _0x5dade7[_0xb707('0x2d')]('Content-Range',_0x4f972c+'-'+_0x1503fc+'/'+_0x37eb45)['json'](_0x3b38de);}return null;};}function patchUpdates(_0x35f327){return function(_0x25579d){try{jsonpatch[_0xb707('0x2e')](_0x25579d,_0x35f327,!![]);}catch(_0x16b7da){return BPromise[_0xb707('0x2f')](_0x16b7da);}return _0x25579d[_0xb707('0x30')]();};}function saveUpdates(_0x4b0363,_0x57a1f1){return function(_0x5bfb21){if(_0x5bfb21){return _0x5bfb21[_0xb707('0x31')](_0x4b0363)[_0xb707('0x32')](function(_0x52f1da){return _0x52f1da;});}return null;};}function removeEntity(_0x3cf47f,_0x3f336c){return function(_0x11ea6c){if(_0x11ea6c){return _0x11ea6c['destroy']()['then'](function(){_0x3cf47f[_0xb707('0x28')](0xcc)[_0xb707('0x33')]();});}};}function handleEntityNotFound(_0x2c744a,_0x206105){return function(_0x4749d8){if(!_0x4749d8){_0x2c744a[_0xb707('0x27')](0x194);}return _0x4749d8;};}function handleError(_0x5e13a6,_0x4b12eb){_0x4b12eb=_0x4b12eb||0x1f4;return function(_0x7f7fdf){logger[_0xb707('0x23')](_0x7f7fdf['stack']);if(_0x7f7fdf[_0xb707('0x34')]){delete _0x7f7fdf[_0xb707('0x34')];}_0x5e13a6[_0xb707('0x28')](_0x4b12eb)[_0xb707('0x35')](_0x7f7fdf);};}exports[_0xb707('0x36')]=function(_0x2e651e,_0x34dcf7){var _0x1cbe50={},_0xa4f22={},_0x34d636={'count':0x0,'rows':[]};var _0x4e1b8e=_['map'](db[_0xb707('0x37')][_0xb707('0x38')],function(_0x3ac390){return{'name':_0x3ac390[_0xb707('0x39')],'type':_0x3ac390[_0xb707('0x3a')][_0xb707('0x3b')]};});_0xa4f22[_0xb707('0x3c')]=_['map'](_0x4e1b8e,_0xb707('0x34'));_0xa4f22['query']=_[_0xb707('0x3d')](_0x2e651e[_0xb707('0x3e')]);_0xa4f22[_0xb707('0x3f')]=_[_0xb707('0x40')](_0xa4f22[_0xb707('0x3c')],_0xa4f22[_0xb707('0x3e')]);_0x1cbe50['attributes']=_['intersection'](_0xa4f22['model'],qs[_0xb707('0x41')](_0x2e651e['query'][_0xb707('0x41')]));_0x1cbe50[_0xb707('0x42')]=_0x1cbe50[_0xb707('0x42')][_0xb707('0x43')]?_0x1cbe50[_0xb707('0x42')]:_0xa4f22[_0xb707('0x3c')];if(!_0x2e651e[_0xb707('0x3e')][_0xb707('0x44')](_0xb707('0x45'))){_0x1cbe50[_0xb707('0x2a')]=qs['limit'](_0x2e651e[_0xb707('0x3e')][_0xb707('0x2a')]);_0x1cbe50[_0xb707('0x2c')]=qs['offset'](_0x2e651e['query'][_0xb707('0x2c')]);}_0x1cbe50[_0xb707('0x46')]=qs['sort'](_0x2e651e[_0xb707('0x3e')]['sort']);_0x1cbe50[_0xb707('0x47')]=qs[_0xb707('0x3f')](_[_0xb707('0x48')](_0x2e651e[_0xb707('0x3e')],_0xa4f22['filters']),_0x4e1b8e);if(_0x2e651e[_0xb707('0x3e')]['filter']){_0x1cbe50[_0xb707('0x47')]=_[_0xb707('0x49')](_0x1cbe50[_0xb707('0x47')],{'$or':_[_0xb707('0x4a')](_0x4e1b8e,function(_0x3991c5){if(_0x3991c5[_0xb707('0x3a')]!==_0xb707('0x4b')){var _0x1fb116={};_0x1fb116[_0x3991c5[_0xb707('0x34')]]={'$like':'%'+_0x2e651e[_0xb707('0x3e')][_0xb707('0x4c')]+'%'};return _0x1fb116;}})});}_0x1cbe50=_[_0xb707('0x49')]({},_0x1cbe50,_0x2e651e[_0xb707('0x4d')]);var _0x2bea93={'where':_0x1cbe50[_0xb707('0x47')]};return db[_0xb707('0x37')][_0xb707('0x4e')](_0x2bea93)[_0xb707('0x32')](function(_0x4afaeb){_0x34d636[_0xb707('0x4e')]=_0x4afaeb;if(_0x2e651e[_0xb707('0x3e')][_0xb707('0x4f')]){_0x1cbe50['include']=[{'all':!![]}];}return db[_0xb707('0x37')]['findAll'](_0x1cbe50);})[_0xb707('0x32')](function(_0x50eef3){_0x34d636[_0xb707('0x50')]=_0x50eef3;return _0x34d636;})[_0xb707('0x32')](respondWithFilteredResult(_0x34dcf7,_0x1cbe50))[_0xb707('0x51')](handleError(_0x34dcf7,null));};exports['show']=function(_0x3e7d3e,_0x4a85ab){var _0x1b6764={'raw':!![],'where':{'id':_0x3e7d3e['params']['id']}},_0x306feb={};_0x306feb[_0xb707('0x3c')]=_['keys'](db[_0xb707('0x37')]['rawAttributes']);_0x306feb[_0xb707('0x3e')]=_[_0xb707('0x3d')](_0x3e7d3e['query']);_0x306feb[_0xb707('0x3f')]=_[_0xb707('0x40')](_0x306feb[_0xb707('0x3c')],_0x306feb['query']);_0x1b6764[_0xb707('0x42')]=_[_0xb707('0x40')](_0x306feb[_0xb707('0x3c')],qs['fields'](_0x3e7d3e[_0xb707('0x3e')][_0xb707('0x41')]));_0x1b6764[_0xb707('0x42')]=_0x1b6764[_0xb707('0x42')]['length']?_0x1b6764['attributes']:_0x306feb[_0xb707('0x3c')];if(_0x3e7d3e['query'][_0xb707('0x4f')]){_0x1b6764['include']=[{'all':!![]}];}_0x1b6764=_[_0xb707('0x49')]({},_0x1b6764,_0x3e7d3e[_0xb707('0x4d')]);return db[_0xb707('0x37')]['find'](_0x1b6764)[_0xb707('0x32')](handleEntityNotFound(_0x4a85ab,null))['then'](respondWithResult(_0x4a85ab,null))['catch'](handleError(_0x4a85ab,null));};exports[_0xb707('0x52')]=function(_0x32ee74,_0x42659d){return db[_0xb707('0x37')][_0xb707('0x52')](_0x32ee74[_0xb707('0x53')],{})[_0xb707('0x32')](respondWithResult(_0x42659d,0xc9))[_0xb707('0x51')](handleError(_0x42659d,null));};exports[_0xb707('0x31')]=function(_0x85cbf8,_0x4289ae){if(_0x85cbf8['body']['id']){delete _0x85cbf8[_0xb707('0x53')]['id'];}return db[_0xb707('0x37')][_0xb707('0x54')]({'where':{'id':_0x85cbf8[_0xb707('0x55')]['id']}})[_0xb707('0x32')](handleEntityNotFound(_0x4289ae,null))['then'](saveUpdates(_0x85cbf8[_0xb707('0x53')],null))['then'](respondWithResult(_0x4289ae,null))[_0xb707('0x51')](handleError(_0x4289ae,null));};exports[_0xb707('0x56')]=function(_0x54de15,_0x460350){return db[_0xb707('0x37')][_0xb707('0x54')]({'where':{'id':_0x54de15[_0xb707('0x55')]['id']}})[_0xb707('0x32')](handleEntityNotFound(_0x460350,null))[_0xb707('0x32')](removeEntity(_0x460350,null))[_0xb707('0x51')](handleError(_0x460350,null));};exports[_0xb707('0x57')]=function(_0x54f36b,_0x48cada){return db[_0xb707('0x37')]['describe']()[_0xb707('0x32')](respondWithResult(_0x48cada,null))[_0xb707('0x51')](handleError(_0x48cada,null));};var interaction_log=require(_0xb707('0x10'))('sms-interactions');exports[_0xb707('0x58')]=function(_0x24afa5,_0x364c1f,_0x12f26b){var _0xf09b94={'agent':{},'channel':_0xb707('0x59')};if(_0x24afa5[_0xb707('0x53')]['id']){delete _0x24afa5['body']['id'];}_0x24afa5[_0xb707('0x53')][_0xb707('0x5a')]=!![];_0x24afa5[_0xb707('0x53')][_0xb707('0x5b')]=moment()[_0xb707('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x24afa5[_0xb707('0x53')][_0xb707('0x5d')]=_0x24afa5[_0xb707('0x53')][_0xb707('0x5d')]||_0x24afa5[_0xb707('0x5e')]['id'];_0xf09b94[_0xb707('0x5f')]['id']=_0x24afa5['body']['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x24afa5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x364c1f,null))[_0xb707('0x32')](saveUpdates(_0x24afa5[_0xb707('0x53')],null))['then'](function(_0x241263){if(_0x241263){_0xf09b94[_0xb707('0x25')]=_0x241263[_0xb707('0x60')]({'plain':!![]});return db['SmsInteraction'][_0xb707('0x54')]({'where':{'id':_0x241263[_0xb707('0x61')]}});}return null;})[_0xb707('0x32')](handleEntityNotFound(_0x364c1f,null))[_0xb707('0x32')](function(_0x8edea7){if(_0x8edea7){return _0x8edea7['update']({'UserId':_0x24afa5['body'][_0xb707('0x5d')],'read1stAt':_[_0xb707('0x62')](_0x8edea7[_0xb707('0x63')])?moment()['format'](_0xb707('0x64')):undefined});}return null;})['then'](function(_0x217489){if(_0x217489){_0xf09b94[_0xb707('0x65')]=_0x217489[_0xb707('0x60')]({'plain':!![]});interaction_log[_0xb707('0x1d')](_0xb707('0x66'),_0x24afa5['user']['id'],_0x24afa5[_0xb707('0x5e')][_0xb707('0x34')],_0x24afa5[_0xb707('0x5e')][_0xb707('0x67')],_0xf09b94[_0xb707('0x65')]['id'],_0x24afa5[_0xb707('0x53')]?JSON[_0xb707('0x22')](_0x24afa5[_0xb707('0x53')]):'null');return respondWithRpcPromise(_0xb707('0x68'),_0xb707('0x69'),_0xf09b94);}return null;})[_0xb707('0x32')](function(_0x13f80f){var _0x53ab5e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x13f80f[_0xb707('0x25')][_0xb707('0x6a')];return db[_0xb707('0x6b')]['query'](_0x53ab5e,{'type':db[_0xb707('0x6c')]['QueryTypes'][_0xb707('0x6d')],'raw':!![]})[_0xb707('0x32')](function(_0x28d4ed){return _0x28d4ed;});})['then'](function(_0x3a29e5){if(_0x3a29e5){_0xf09b94[_0xb707('0x25')][_0xb707('0x6e')]=_0x3a29e5[0x0];if(!_0x24afa5[_0xb707('0x53')][_0xb707('0x5d')])return;return db[_0xb707('0x6f')][_0xb707('0x54')]({'where':{'id':_0x24afa5['body'][_0xb707('0x5d')],'role':_0xb707('0x5f')},'attributes':['id',_0xb707('0x34'),_0xb707('0x70'),'email',_0xb707('0x71')],'raw':!![]});}return null;})[_0xb707('0x32')](function(_0x3d0430){if(!_0x3d0430)return null;_0xf09b94[_0xb707('0x25')][_0xb707('0x5f')]=_0x3d0430;return _0xf09b94;})['then'](function(_0x2bd6db){if(_0x2bd6db){if(_0x24afa5[_0xb707('0x53')]['manual']){_0xf09b94['message'][_0xb707('0x72')]=util[_0xb707('0x5c')](_0xb707('0x73'),_0x24afa5[_0xb707('0x5e')][_0xb707('0x34')]);_0xf09b94[_0xb707('0x25')]['channel']=_0xf09b94[_0xb707('0x74')];_0xf09b94[_0xb707('0x25')][_0xb707('0x75')]=_0xf09b94[_0xb707('0x74')];_0xf09b94[_0xb707('0x25')][_0xb707('0x76')]='accept';return respondWithRpcPromise(_0xb707('0x77'),_0xb707('0x77'),{'event':'acceptmessage','message':_0xf09b94[_0xb707('0x25')]},client9002)[_0xb707('0x32')](function(){return _0xf09b94;});}return _0xf09b94;}return null;})['then'](respondWithResult(_0x364c1f,null))[_0xb707('0x51')](handleError(_0x364c1f,null));};var interaction_log=require(_0xb707('0x10'))(_0xb707('0x78'));exports[_0xb707('0x2f')]=function(_0xb7c614,_0x48c41f,_0x3689a0){var _0x5ce8e3={'agent':{},'channel':'sms'};if(_0xb7c614[_0xb707('0x53')]['id']){delete _0xb7c614[_0xb707('0x53')]['id'];}_0xb7c614[_0xb707('0x53')][_0xb707('0x5d')]=_0xb7c614[_0xb707('0x53')][_0xb707('0x5d')]||_0xb7c614[_0xb707('0x5e')]['id'];_0x5ce8e3[_0xb707('0x5f')]['id']=_0xb7c614[_0xb707('0x53')][_0xb707('0x5d')];return db[_0xb707('0x37')][_0xb707('0x54')]({'where':{'id':_0xb7c614[_0xb707('0x55')]['id'],'UserId':null}})[_0xb707('0x32')](handleEntityNotFound(_0x48c41f,null))['then'](function(_0x377a38){if(_0x377a38){_0x5ce8e3[_0xb707('0x25')]=_0x377a38[_0xb707('0x60')]({'plain':!![]});return db['SmsInteraction'][_0xb707('0x54')]({'where':{'id':_0x377a38[_0xb707('0x61')]}});}return null;})[_0xb707('0x32')](handleEntityNotFound(_0x48c41f,null))[_0xb707('0x32')](function(_0x441edf){if(_0x441edf){_0x5ce8e3[_0xb707('0x65')]=_0x441edf['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb7c614[_0xb707('0x5e')]['id'],_0xb7c614[_0xb707('0x5e')][_0xb707('0x34')],_0xb7c614['user'][_0xb707('0x67')],_0x5ce8e3[_0xb707('0x65')]['id'],_0xb7c614['body']?JSON['stringify'](_0xb7c614[_0xb707('0x53')]):_0xb707('0x79'));return respondWithRpcPromise(_0xb707('0x7a'),_0xb707('0x7b'),_0x5ce8e3);}return null;})[_0xb707('0x32')](function(_0x16bf0e){var _0x21e1cf=_0xb707('0x7c')+_0x16bf0e[_0xb707('0x25')][_0xb707('0x6a')];return db[_0xb707('0x6b')][_0xb707('0x3e')](_0x21e1cf,{'type':db['Sequelize'][_0xb707('0x7d')][_0xb707('0x6d')],'raw':!![]})['then'](function(_0x298d39){return _0x298d39;});})[_0xb707('0x32')](function(_0x28f7ae){if(_0x28f7ae){_0x5ce8e3['message']['contact']=_0x28f7ae[0x0];if(!_0xb7c614[_0xb707('0x53')][_0xb707('0x5d')])return;return db[_0xb707('0x6f')][_0xb707('0x54')]({'where':{'id':_0xb7c614[_0xb707('0x53')][_0xb707('0x5d')],'role':_0xb707('0x5f')},'attributes':['id','name',_0xb707('0x70'),_0xb707('0x7e'),_0xb707('0x71')],'raw':!![]});}return null;})['then'](function(_0x47a7c1){if(!_0x47a7c1)return null;_0x5ce8e3['message'][_0xb707('0x5f')]=_0x47a7c1;return _0x5ce8e3;})[_0xb707('0x32')](function(_0x3fe85b){if(_0x3fe85b){_0x3fe85b[_0xb707('0x25')]['interface']=util[_0xb707('0x5c')](_0xb707('0x73'),_0xb7c614[_0xb707('0x5e')][_0xb707('0x34')]);_0x3fe85b[_0xb707('0x25')][_0xb707('0x74')]=_0x5ce8e3['channel'];_0x3fe85b[_0xb707('0x25')][_0xb707('0x75')]=_0x5ce8e3['channel'];_0x3fe85b['message']['event']=_0xb707('0x2f');respondWithRpcPromise(_0xb707('0x77'),_0xb707('0x77'),{'event':_0xb707('0x7f'),'message':_0x3fe85b[_0xb707('0x25')]},client9002);return _0x5ce8e3;}return null;})['then'](respondWithResult(_0x48c41f,null))[_0xb707('0x51')](handleError(_0x48c41f,null));};exports[_0xb707('0x28')]=function(_0x366dce,_0xff6175,_0x288cf0){if(_0x366dce[_0xb707('0x53')]['id']){delete _0x366dce['body']['id'];}var _0x58ee32;return db[_0xb707('0x37')]['find']({'where':{'id':_0x366dce[_0xb707('0x55')]['id']}})['then'](handleEntityNotFound(_0xff6175,null))[_0xb707('0x32')](function(_0x2a9640){if(_0x2a9640){_0x58ee32=_0x2a9640;return db['SmsAccount']['find']({'where':{'id':_0x2a9640[_0xb707('0x80')]}});}})[_0xb707('0x32')](handleEntityNotFound(_0xff6175,null))[_0xb707('0x32')](function(_0x2e18a3){if(_0x2e18a3){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb707('0x28'),_0xb707('0x81'),_0x2e18a3['type'],util['inspect'](_0x366dce[_0xb707('0x53')],{'showHidden':![],'depth':null}));switch(_0x2e18a3[_0xb707('0x3a')]){case _0xb707('0x82'):if(_0x366dce['body']['MessageSid']&&_0x366dce[_0xb707('0x53')][_0xb707('0x83')]===_0x58ee32[_0xb707('0x84')]){return _0x58ee32[_0xb707('0x31')]({'read':!![]});}else{logger['error'](_0xb707('0x85'),_0xb707('0x28'),_0xb707('0x82'),util[_0xb707('0x86')](_0x366dce[_0xb707('0x53')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x366dce[_0xb707('0x53')]['MessageUUID']&&_0x366dce[_0xb707('0x53')][_0xb707('0x87')]===_0x58ee32[_0xb707('0x84')]&&_[_0xb707('0x88')]([_0xb707('0x89'),_0xb707('0x8a')],_0x366dce['body'][_0xb707('0x8b')])>=0x0){return _0x58ee32[_0xb707('0x31')]({'read':!![]});}else{logger[_0xb707('0x23')](_0xb707('0x85'),_0xb707('0x28'),_0xb707('0x8c'),util[_0xb707('0x86')](_0x366dce['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1f6da2=_0x366dce['body'][_0xb707('0x8d')][0x0];if(_0x1f6da2[_0xb707('0x28')][_0xb707('0x8e')]==='DELIVERED'){return _0x58ee32['update']({'read':!![]});}else{logger['error'](_0xb707('0x85'),_0xb707('0x28'),_0xb707('0x8f'),util[_0xb707('0x86')](_0x366dce[_0xb707('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x58ee32;}})[_0xb707('0x32')](respondWithResult(_0xff6175,null))[_0xb707('0x51')](handleError(_0xff6175,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7b2c062..437bb99 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 _0xcce6=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xcce6,0x158));var _0x6cce=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xcce6[_0x443494];return _0x4a6794;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x6cce('0x0'))['db'][_0x6cce('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6cce('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6cce('0x3'),'afterDestroy':_0x6cce('0x4')};function emitEvent(_0x5494e0){return function(_0x5858cd,_0x151635,_0x56c74b){SmsMessageEvents[_0x6cce('0x5')](_0x5494e0+':'+_0x5858cd['id'],_0x5858cd);SmsMessageEvents[_0x6cce('0x5')](_0x5494e0,_0x5858cd);_0x56c74b(null);};}for(var e in events){if(events[_0x6cce('0x6')](e)){var event=events[e];SmsMessage[_0x6cce('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x0334=['hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5eb4a1,_0x394d52){var _0x1007c6=function(_0x44af28){while(--_0x44af28){_0x5eb4a1['push'](_0x5eb4a1['shift']());}};_0x1007c6(++_0x394d52);}(_0x0334,0x1ba));var _0x4033=function(_0xf6cbc7,_0x1271e2){_0xf6cbc7=_0xf6cbc7-0x0;var _0x28ba2d=_0x0334[_0xf6cbc7];return _0x28ba2d;};'use strict';var EventEmitter=require(_0x4033('0x0'));var SmsMessage=require(_0x4033('0x1'))['db'][_0x4033('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4033('0x3')](0x0);var events={'afterCreate':_0x4033('0x4'),'afterUpdate':_0x4033('0x5'),'afterDestroy':_0x4033('0x6')};function emitEvent(_0x24d0c0){return function(_0x2d8cf4,_0x33cd9f,_0x4e2596){SmsMessageEvents['emit'](_0x24d0c0+':'+_0x2d8cf4['id'],_0x2d8cf4);SmsMessageEvents[_0x4033('0x7')](_0x24d0c0,_0x2d8cf4);_0x4e2596(null);};}for(var e in events){if(events[_0x4033('0x8')](e)){var event=events[e];SmsMessage[_0x4033('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 952598e..0699e31 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 _0x825d=['secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','sender','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x4971ca,_0x2ae39a){var _0x10c18e=function(_0x469242){while(--_0x469242){_0x4971ca['push'](_0x4971ca['shift']());}};_0x10c18e(++_0x2ae39a);}(_0x825d,0x1dc));var _0xd825=function(_0x4e2712,_0x3cb979){_0x4e2712=_0x4e2712-0x0;var _0x540399=_0x825d[_0x4e2712];return _0x540399;};'use strict';var _=require(_0xd825('0x0'));var util=require('util');var logger=require(_0xd825('0x1'))('api');var moment=require(_0xd825('0x2'));var BPromise=require('bluebird');var rp=require(_0xd825('0x3'));var fs=require('fs');var path=require(_0xd825('0x4'));var rimraf=require('rimraf');var config=require(_0xd825('0x5'));var attributes=require(_0xd825('0x6'));module[_0xd825('0x7')]=function(_0x24c6dc,_0x128645){return _0x24c6dc[_0xd825('0x8')](_0xd825('0x9'),attributes,{'tableName':_0xd825('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd825('0xb')]},{'name':_0xd825('0xc'),'fields':[_0xd825('0xd')],'type':_0xd825('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x644067,_0x4cc6f5,_0x40ca0b){var _0x444691=_0x24c6dc[_0xd825('0xf')];var _0x10a887=_0x644067[_0xd825('0x10')]({'plain':!![]});if(_0x10a887[_0xd825('0x11')][_0xd825('0x12')]()==='in'||_0x10a887[_0xd825('0x11')][_0xd825('0x12')]()===_0xd825('0x13')&&!_0x10a887[_0xd825('0x14')]&&!_[_0xd825('0x15')](_0x10a887[_0xd825('0x16')])&&!_[_0xd825('0x15')](_0x10a887[_0xd825('0x17')])){_0x444691[_0xd825('0x18')][_0xd825('0x19')]({'where':{'id':_0x10a887[_0xd825('0x17')]}})[_0xd825('0x1a')](function(_0x54d3ee){if(_0x54d3ee){_0x54d3ee[_0xd825('0x1b')]({'lastMsgAt':_0x10a887[_0xd825('0x1c')],'lastMsgDirection':_0x10a887['direction'][_0xd825('0x12')]()});}})[_0xd825('0x1d')](function(_0x51c671){console[_0xd825('0x1e')](_0x51c671);});}if(_0x10a887[_0xd825('0x11')]===_0xd825('0x13')&&!_0x10a887[_0xd825('0x14')]){var _0x5161b6;_0x444691['SmsAccount'][_0xd825('0x1f')]({'where':{'id':_0x10a887[_0xd825('0x20')]},'raw':!![]})[_0xd825('0x1a')](function(_0x6ce55d){_0x5161b6=_0x6ce55d;if(_0x5161b6&&_0x5161b6['type']){switch(_0x5161b6[_0xd825('0x21')]){case'twilio':var _0x1b0cd7=require(_0xd825('0x22'));if(_0x5161b6[_0xd825('0x23')]&&_0x5161b6[_0xd825('0x24')]&&_0x5161b6['phone']){var _0x28cd65=new _0x1b0cd7(_0x5161b6[_0xd825('0x23')],_0x5161b6[_0xd825('0x24')]);_0x28cd65[_0xd825('0x25')]['create']({'body':_0x10a887[_0xd825('0xd')],'to':_0x10a887['phone'],'from':_0x5161b6[_0xd825('0x26')],'statusCallback':_0x5161b6['remote']+_0xd825('0x27')+_0x10a887['id']+_0xd825('0x28')+_0x5161b6['token']})[_0xd825('0x1a')](function(_0x907a8){if(_0x907a8[_0xd825('0x29')]){return _0x644067[_0xd825('0x1b')]({'messageId':_0x907a8[_0xd825('0x29')]});}})['catch'](function(_0x55c2dc){logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x22'),util['inspect'](_0x55c2dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd825('0x2a'),'afterCreate','twilio',_0xd825('0x2c'));}break;case'skebby':var _0x260773='https://api.skebby.it/API/v1.0/REST/';if(_0x5161b6[_0xd825('0x2d')]&&_0x5161b6['password']){var _0x35c473={'recipient':[_0x10a887['phone']],'message':_0x10a887[_0xd825('0xd')],'message_type':_0x5161b6[_0xd825('0x2e')]};if(_0x5161b6[_0xd825('0x2e')]&&_0x5161b6[_0xd825('0x2e')]!=='SI'){_0x35c473['sender']=_0x5161b6[_0xd825('0x26')];}var _0x444fa5={'url':_0x260773+'login?username='+_0x5161b6[_0xd825('0x2d')]+'&password='+_0x5161b6['password'],'method':_0xd825('0x2f')};rp(_0x444fa5)[_0xd825('0x1a')](function(_0x2a8a48){var _0x16ac33=_0x2a8a48[_0xd825('0x30')](';');var _0x2238b4={'user_key':_0x16ac33[0x0],'session_key':_0x16ac33[0x1]};_0x444fa5={'url':_0x260773+'sms','method':_0xd825('0x31'),'headers':{'user_key':_0x2238b4['user_key'],'Session_key':_0x2238b4[_0xd825('0x32')]},'json':!![],'body':_0x35c473};return rp(_0x444fa5);})[_0xd825('0x1a')](function(_0x15528f){if(_0x15528f[_0xd825('0x33')]>=0x1){var _0x34f2b5={'messageId':_0x15528f[_0xd825('0x34')]};if(_0x5161b6[_0xd825('0x2e')]!=='GP'||!_0x5161b6[_0xd825('0x35')]){_0x34f2b5[_0xd825('0x36')]=!![];}return _0x644067[_0xd825('0x1b')](_0x34f2b5);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd825('0x2b'),_0xd825('0x37'),util[_0xd825('0x38')](_0x15528f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x322458){return logger[_0xd825('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd825('0x37'),util[_0xd825('0x38')](_0x322458,{'showHidden':![],'depth':null}));});}else{logger[_0xd825('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd825('0x37'),_0xd825('0x39'));}break;case _0xd825('0x3a'):if(_0x5161b6[_0xd825('0x24')]){var _0x998a1b={'recipient':_0x10a887[_0xd825('0x26')],'message':_0x10a887[_0xd825('0xd')],'sender':_0x5161b6[_0xd825('0x3b')]||_0x5161b6[_0xd825('0x26')],'authorization':_0x5161b6[_0xd825('0x24')]};var _0x4cc6f5={'method':'POST','uri':_0xd825('0x3c'),'body':_0x998a1b,'json':!![]};rp(_0x4cc6f5)['then'](function(_0x33e289){var _0x3653f8={'messageId':_0x33e289[_0xd825('0x3d')]};if(!_0x5161b6['deliveryReport']){_0x3653f8[_0xd825('0x36')]=!![];}return _0x644067['update'](_0x3653f8);})[_0xd825('0x1d')](function(_0x23b670){logger['error'](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x3a'),util[_0xd825('0x38')](_0x23b670,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd825('0x2b'),_0xd825('0x3a'),_0xd825('0x3e'));}break;case'clicksend':if(_0x5161b6[_0xd825('0x2d')]&&_0x5161b6[_0xd825('0x3f')]){var _0x998a1b={'messages':[{'source':_0xd825('0x40'),'to':_0x10a887[_0xd825('0x26')],'body':_0x10a887[_0xd825('0xd')],'from':_0x5161b6[_0xd825('0x3b')]||_0x5161b6[_0xd825('0x26')]}]};var _0x46bd9b=util['format'](_0xd825('0x41'),_0x5161b6[_0xd825('0x2d')],_0x5161b6[_0xd825('0x3f')]);var _0x4cc6f5={'method':_0xd825('0x31'),'uri':_0xd825('0x42'),'body':_0x998a1b,'headers':{'Authorization':util[_0xd825('0x43')](_0xd825('0x44'),new Buffer(_0x46bd9b)[_0xd825('0x45')](_0xd825('0x46')))},'json':!![]};rp(_0x4cc6f5)[_0xd825('0x1a')](function(_0x543952){if(_0x543952[_0xd825('0x47')]>=0xc8&&_0x543952['http_code']<=0xce){if(_0x543952['data']&&_0x543952[_0xd825('0x48')][_0xd825('0x49')]>0x0){var _0x22a295=_['head'](_0x543952['data'][_0xd825('0x25')]);var _0x2a139d={'messageId':_0x22a295[_0xd825('0x4a')]};if(!_0x5161b6[_0xd825('0x35')]){_0x2a139d[_0xd825('0x36')]=!![];}return _0x644067['update'](_0x2a139d);}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x4b'),util['inspect'](_0x543952,{'showHidden':![],'depth':null}));}}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x4b'),util[_0xd825('0x38')](_0x543952,{'showHidden':![],'depth':null}));}})['catch'](function(_0x305247){logger[_0xd825('0x1e')](_0xd825('0x2a'),'afterCreate',_0xd825('0x4b'),util[_0xd825('0x38')](_0x305247,{'showHidden':![],'depth':null}));});}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd825('0x4c'):if(_0x5161b6[_0xd825('0x4d')]&&_0x5161b6['authToken']){var _0x998a1b={'dst':_0x10a887[_0xd825('0x26')],'text':_0x10a887[_0xd825('0xd')],'src':_0x5161b6[_0xd825('0x3b')]||_0x5161b6['phone'],'url':_0x5161b6['remote']+'/api/sms/messages/'+_0x10a887['id']+_0xd825('0x28')+_0x5161b6[_0xd825('0x4e')]};var _0x46bd9b=util[_0xd825('0x43')]('%s:%s',_0x5161b6['authId'],_0x5161b6[_0xd825('0x24')]);var _0x4cc6f5={'method':'POST','uri':util[_0xd825('0x43')](_0xd825('0x4f'),_0x5161b6[_0xd825('0x4d')]),'body':_0x998a1b,'headers':{'Authorization':util[_0xd825('0x43')](_0xd825('0x44'),new Buffer(_0x46bd9b)['toString'](_0xd825('0x46')))},'json':!![]};rp(_0x4cc6f5)[_0xd825('0x1a')](function(_0x3cab57){var _0x573852={'messageId':_0x3cab57[_0xd825('0x50')][0x0]};return _0x644067[_0xd825('0x1b')](_0x573852);})['catch'](function(_0x5df15d){logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x4c'),util[_0xd825('0x38')](_0x5df15d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x4c'),_0xd825('0x51'));}break;case _0xd825('0x52'):if(_0x5161b6[_0xd825('0x2d')]&&_0x5161b6[_0xd825('0x3f')]){if(_0x5161b6[_0xd825('0x53')]){var _0x245630={'method':_0xd825('0x31'),'uri':_0x5161b6[_0xd825('0x53')]+_0xd825('0x54'),'body':{'username':_0x5161b6[_0xd825('0x2d')],'password':_0x5161b6[_0xd825('0x3f')]},'json':!![]};return rp(_0x245630)[_0xd825('0x1a')](function(_0x30bd1a){var _0x3bd99b={'method':_0xd825('0x31'),'uri':_0x5161b6[_0xd825('0x53')]+_0xd825('0x55'),'body':{'messages':[{'from':_0x5161b6[_0xd825('0x26')],'destinations':[{'to':_0x10a887[_0xd825('0x26')]}],'text':_0x10a887[_0xd825('0xd')],'notifyUrl':_0x5161b6[_0xd825('0x56')]+'/api/sms/messages/'+_0x10a887['id']+_0xd825('0x28')+_0x5161b6[_0xd825('0x4e')],'notifyContentType':'application/json','callbackData':_0x5161b6['phone']+';'+_0x10a887[_0xd825('0xd')]}]},'headers':{'Authorization':_0xd825('0x57')+_0x30bd1a[_0xd825('0x4e')]},'json':!![]};return rp(_0x3bd99b)['then'](function(_0x1bee09){if(_0x1bee09[_0xd825('0x25')]){var _0x1d1d65={'messageId':_0x1bee09[_0xd825('0x25')][0x0]['messageId']};if(!_0x5161b6[_0xd825('0x35')]){_0x1d1d65['read']=!![];}return _0x644067[_0xd825('0x1b')](_0x1d1d65);}else{return logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x52'),util['inspect'](_0x1bee09,{'showHidden':![],'depth':null}));}});})[_0xd825('0x1d')](function(_0x147721){return logger['error'](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x52'),util[_0xd825('0x38')](_0x147721,{'showHidden':![],'depth':null}));});}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),'afterCreate','infobip',_0xd825('0x58'));}}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x52'),_0xd825('0x39'));}break;case _0xd825('0x59'):var _0x51857e=require('crypto');if(_0x5161b6[_0xd825('0x5a')]){var _0x4d0ce2={};_0x4d0ce2['login']=_0x5161b6['username'];_0x4d0ce2['phone']=_0x10a887[_0xd825('0x26')];_0x4d0ce2[_0xd825('0x5b')]=_0x5161b6['phone'];_0x4d0ce2['text']=_0x10a887[_0xd825('0xd')];_0x4d0ce2[_0xd825('0x5c')]=+new Date();var _0x4bcdb9='';var _0x35473c='';var _0x9f0092=Object[_0xd825('0x5d')](_0x4d0ce2);_0x9f0092[_0xd825('0x5e')]();for(var _0x9b5f36=0x0;_0x9b5f36<_0x9f0092[_0xd825('0x5f')];_0x9b5f36++){if(_0x4bcdb9!=''){_0x4bcdb9+='&';}_0x4bcdb9+=_0x9f0092[_0x9b5f36]+'='+encodeURIComponent(_0x4d0ce2[_0x9f0092[_0x9b5f36]]);_0x35473c+=_0x4d0ce2[_0x9f0092[_0x9b5f36]];}_0x35473c+=_0x5161b6[_0xd825('0x5a')];_0x35473c=_0x51857e[_0xd825('0x60')](_0xd825('0x61'))[_0xd825('0x1b')](_0x35473c)[_0xd825('0x62')](_0xd825('0x63'));if(_0x4bcdb9!==''){_0x4bcdb9+='&';}_0x4bcdb9+=_0xd825('0x64')+_0x35473c;var _0x444fa5={'method':_0xd825('0x2f'),'uri':_0x5161b6[_0xd825('0x53')]+_0xd825('0x65')+_0x4bcdb9,'json':!![]};return rp(_0x444fa5)['then'](function(_0x57702f){var _0x3e5707=Object['keys'](_0x57702f);if(_0x57702f[_0x3e5707[0x0]][_0xd825('0x1e')]&&parseInt(_0x57702f[_0x3e5707[0x0]]['error'])===0x0){var _0x408936={'messageId':_0x57702f[_0x3e5707[0x0]][_0xd825('0x66')]};if(!_0x5161b6[_0xd825('0x35')]){_0x408936[_0xd825('0x36')]=!![];}return _0x644067[_0xd825('0x1b')](_0x408936);}else{return logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x59'),util[_0xd825('0x38')](_0x57702f[_0xd825('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd825('0x1d')](function(_0x53ffbf){return logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x59'),util[_0xd825('0x38')](_0x53ffbf,{'showHidden':![],'depth':null}));});}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0xd825('0x67'):if(_0x5161b6[_0xd825('0x5a')]){var _0x47bf3b={'method':_0xd825('0x31'),'uri':_0xd825('0x68'),'headers':{'Authorization':_0x5161b6['apiKey']},'body':{'content':_0x10a887[_0xd825('0xd')],'to':[_0x10a887[_0xd825('0x26')]],'from':_0x5161b6['phone'],'binary':![],'clientMessageId':_0xd825('0x69'),'charset':_0xd825('0x6a')},'json':!![]};rp(_0x47bf3b)['then'](function(_0xf5f557){if(!_0xf5f557[_0xd825('0x1e')]){var _0x3b1ae5={'messageId':_0xf5f557['messages'][0x0]['apiMessageId']};if(!_0x5161b6[_0xd825('0x35')]){_0x3b1ae5['read']=!![];}return _0x644067[_0xd825('0x1b')](_0x3b1ae5);}else{return logger[_0xd825('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd825('0x67'),util[_0xd825('0x38')](_0xf5f557[_0xd825('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xf49595){return logger[_0xd825('0x1e')](_0xd825('0x2a'),'afterCreate',_0xd825('0x67'),util['inspect'](_0xf49595,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd825('0x2a'),'afterCreate','clickatell',_0xd825('0x6b'));}break;case _0xd825('0x6c'):if(_0x5161b6[_0xd825('0x2d')]&&_0x5161b6[_0xd825('0x3f')]){var _0x46bd9b=util['format'](_0xd825('0x41'),_0x5161b6[_0xd825('0x2d')],_0x5161b6[_0xd825('0x3f')]);var _0x4cc6f5={'method':_0xd825('0x31'),'uri':_0xd825('0x6d')+_0x5161b6['accountId']+_0xd825('0x6e'),'body':{'to':[_0x10a887[_0xd825('0x26')]],'text':_0x10a887['body'],'from':_0x5161b6[_0xd825('0x26')],'applicationId':_0x5161b6[_0xd825('0x6f')]},'headers':{'Authorization':util[_0xd825('0x43')]('Basic\x20%s',new Buffer(_0x46bd9b)[_0xd825('0x45')]('base64'))},'json':!![]};rp(_0x4cc6f5)[_0xd825('0x1a')](function(_0x55b963){if(_0x55b963['id']){var _0x3f8915={'messageId':_0x55b963['id']};return _0x644067['update'](_0x3f8915);}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x6c'),util['inspect'](_0x55b963,{'showHidden':![],'depth':null}));}})['catch'](function(_0x149d25){logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),'bandwidth',util[_0xd825('0x38')](_0x149d25,{'showHidden':![],'depth':null}));});}else{logger[_0xd825('0x1e')](_0xd825('0x2a'),'afterCreate',_0xd825('0x6c'),_0xd825('0x39'));}break;case _0xd825('0x70'):if(_0x5161b6[_0xd825('0x5a')]){var _0x3bb417={};var _0x444fa5={'method':'POST','uri':_0xd825('0x71'),'headers':{'Authorization':_0xd825('0x72')+_0x5161b6['apiKey'],'Content-Type':_0xd825('0x73')},'body':{'from':_0x5161b6[_0xd825('0x26')],'to':_0x10a887['phone'],'text':_0x10a887[_0xd825('0xd')]},'json':!![]};return rp(_0x444fa5)[_0xd825('0x1a')](function(_0x350f09){if(_0x350f09[_0xd825('0x74')]==0xca){_0x3bb417[_0xd825('0x75')]=_0x350f09;var _0x5214eb={'method':_0xd825('0x31'),'uri':_0xd825('0x76'),'headers':{'Authorization':_0xd825('0x72')+_0x5161b6[_0xd825('0x5a')],'Content-Type':_0xd825('0x73')},'body':{'refid':_0x3bb417[_0xd825('0x75')]['refid']},'json':!![]};return rp(_0x5214eb)[_0xd825('0x1a')](function(_0x2e6525){_0x3bb417[_0xd825('0x77')]=_0x2e6525;var _0x2633e3={'messageId':_0x3bb417['message'][_0xd825('0x78')],'read':!![]};return _0x644067[_0xd825('0x1b')](_0x2633e3);});}else{return logger[_0xd825('0x1e')](_0xd825('0x2a'),_0xd825('0x2b'),'intelepeer',util['inspect'](_0x350f09,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2364da){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd825('0x70'),util[_0xd825('0x38')](_0x2364da,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd825('0x2a'),_0xd825('0x2b'),_0xd825('0x70'),'Token\x20not\x20received');}break;}}})[_0xd825('0x79')](function(){_0x40ca0b();});}else{_0x40ca0b();}}},'charset':_0xd825('0x7a'),'collate':_0xd825('0x7b')});}; \ No newline at end of file +var _0x81f7=['refid','status','Token\x20not\x20received','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','SmsMessage','sms_messages','messageId','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','findOne','then','createdAt','catch','error','SmsAccount','find','type','accountSid','authToken','body','phone','remote','/api/sms/messages/','/status?token=','token','update','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','messages','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','login','sender','text','timestamp','keys','length','createHash','md5','baseUrl','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json'];(function(_0x475e71,_0x3ad869){var _0x4964df=function(_0x2ed79e){while(--_0x2ed79e){_0x475e71['push'](_0x475e71['shift']());}};_0x4964df(++_0x3ad869);}(_0x81f7,0xea));var _0x781f=function(_0x2e1fc3,_0x455c63){_0x2e1fc3=_0x2e1fc3-0x0;var _0x12c3e1=_0x81f7[_0x2e1fc3];return _0x12c3e1;};'use strict';var _=require(_0x781f('0x0'));var util=require('util');var logger=require(_0x781f('0x1'))(_0x781f('0x2'));var moment=require(_0x781f('0x3'));var BPromise=require(_0x781f('0x4'));var rp=require(_0x781f('0x5'));var fs=require('fs');var path=require(_0x781f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x781f('0x7')]=function(_0x3ec03f,_0x2e1ad4){return _0x3ec03f[_0x781f('0x8')](_0x781f('0x9'),attributes,{'tableName':_0x781f('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x781f('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x342675,_0x5b5a90,_0x38f6f4){var _0x4d536d=_0x3ec03f['models'];var _0x5cddcd=_0x342675[_0x781f('0xc')]({'plain':!![]});if(_0x5cddcd['direction'][_0x781f('0xd')]()==='in'||_0x5cddcd[_0x781f('0xe')]['toLowerCase']()===_0x781f('0xf')&&!_0x5cddcd[_0x781f('0x10')]&&!_[_0x781f('0x11')](_0x5cddcd[_0x781f('0x12')])&&!_[_0x781f('0x11')](_0x5cddcd[_0x781f('0x13')])){_0x4d536d['SmsInteraction'][_0x781f('0x14')]({'where':{'id':_0x5cddcd['SmsInteractionId']}})[_0x781f('0x15')](function(_0x15a1b8){if(_0x15a1b8){_0x15a1b8['update']({'lastMsgAt':_0x5cddcd[_0x781f('0x16')],'lastMsgDirection':_0x5cddcd[_0x781f('0xe')][_0x781f('0xd')]()});}})[_0x781f('0x17')](function(_0x4aaa07){console[_0x781f('0x18')](_0x4aaa07);});}if(_0x5cddcd[_0x781f('0xe')]===_0x781f('0xf')&&!_0x5cddcd[_0x781f('0x10')]){var _0x3fbc89;_0x4d536d[_0x781f('0x19')][_0x781f('0x1a')]({'where':{'id':_0x5cddcd['SmsAccountId']},'raw':!![]})[_0x781f('0x15')](function(_0x1ef119){_0x3fbc89=_0x1ef119;if(_0x3fbc89&&_0x3fbc89[_0x781f('0x1b')]){switch(_0x3fbc89[_0x781f('0x1b')]){case'twilio':var _0x3d3128=require('twilio');if(_0x3fbc89[_0x781f('0x1c')]&&_0x3fbc89[_0x781f('0x1d')]&&_0x3fbc89['phone']){var _0x51844a=new _0x3d3128(_0x3fbc89[_0x781f('0x1c')],_0x3fbc89[_0x781f('0x1d')]);_0x51844a['messages']['create']({'body':_0x5cddcd[_0x781f('0x1e')],'to':_0x5cddcd['phone'],'from':_0x3fbc89[_0x781f('0x1f')],'statusCallback':_0x3fbc89[_0x781f('0x20')]+_0x781f('0x21')+_0x5cddcd['id']+_0x781f('0x22')+_0x3fbc89[_0x781f('0x23')]})[_0x781f('0x15')](function(_0x2f49a1){if(_0x2f49a1['sid']){return _0x342675[_0x781f('0x24')]({'messageId':_0x2f49a1[_0x781f('0x25')]});}})['catch'](function(_0x294255){logger[_0x781f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x781f('0x26'),'twilio',util[_0x781f('0x27')](_0x294255,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),'afterCreate',_0x781f('0x29'),_0x781f('0x2a'));}break;case'skebby':var _0x5cf1c0=_0x781f('0x2b');if(_0x3fbc89[_0x781f('0x2c')]&&_0x3fbc89[_0x781f('0x2d')]){var _0x5350c2={'recipient':[_0x5cddcd[_0x781f('0x1f')]],'message':_0x5cddcd[_0x781f('0x1e')],'message_type':_0x3fbc89[_0x781f('0x2e')]};if(_0x3fbc89[_0x781f('0x2e')]&&_0x3fbc89[_0x781f('0x2e')]!=='SI'){_0x5350c2['sender']=_0x3fbc89[_0x781f('0x1f')];}var _0x468c95={'url':_0x5cf1c0+_0x781f('0x2f')+_0x3fbc89['username']+_0x781f('0x30')+_0x3fbc89[_0x781f('0x2d')],'method':_0x781f('0x31')};rp(_0x468c95)['then'](function(_0x171cff){var _0x5628e2=_0x171cff['split'](';');var _0x6b7e28={'user_key':_0x5628e2[0x0],'session_key':_0x5628e2[0x1]};_0x468c95={'url':_0x5cf1c0+_0x781f('0x32'),'method':_0x781f('0x33'),'headers':{'user_key':_0x6b7e28[_0x781f('0x34')],'Session_key':_0x6b7e28[_0x781f('0x35')]},'json':!![],'body':_0x5350c2};return rp(_0x468c95);})[_0x781f('0x15')](function(_0x5820e2){if(_0x5820e2['total_sent']>=0x1){var _0xcf98b3={'messageId':_0x5820e2[_0x781f('0x36')]};if(_0x3fbc89[_0x781f('0x2e')]!=='GP'||!_0x3fbc89[_0x781f('0x37')]){_0xcf98b3[_0x781f('0x38')]=!![];}return _0x342675[_0x781f('0x24')](_0xcf98b3);}else{return logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x39'),util['inspect'](_0x5820e2,{'showHidden':![],'depth':null}));}})[_0x781f('0x17')](function(_0x21c111){return logger['error'](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x39'),util[_0x781f('0x27')](_0x21c111,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x39'),_0x781f('0x3a'));}break;case'connectel':if(_0x3fbc89[_0x781f('0x1d')]){var _0xa820ae={'recipient':_0x5cddcd[_0x781f('0x1f')],'message':_0x5cddcd['body'],'sender':_0x3fbc89[_0x781f('0x3b')]||_0x3fbc89['phone'],'authorization':_0x3fbc89[_0x781f('0x1d')]};var _0x5b5a90={'method':_0x781f('0x33'),'uri':_0x781f('0x3c'),'body':_0xa820ae,'json':!![]};rp(_0x5b5a90)[_0x781f('0x15')](function(_0x58e639){var _0x17d3e0={'messageId':_0x58e639[_0x781f('0x3d')]};if(!_0x3fbc89[_0x781f('0x37')]){_0x17d3e0[_0x781f('0x38')]=!![];}return _0x342675[_0x781f('0x24')](_0x17d3e0);})[_0x781f('0x17')](function(_0x2f8260){logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),'connectel',util[_0x781f('0x27')](_0x2f8260,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0x781f('0x3f'):if(_0x3fbc89['username']&&_0x3fbc89[_0x781f('0x2d')]){var _0xa820ae={'messages':[{'source':_0x781f('0x40'),'to':_0x5cddcd[_0x781f('0x1f')],'body':_0x5cddcd['body'],'from':_0x3fbc89[_0x781f('0x3b')]||_0x3fbc89[_0x781f('0x1f')]}]};var _0x5b4c7d=util[_0x781f('0x41')](_0x781f('0x42'),_0x3fbc89[_0x781f('0x2c')],_0x3fbc89[_0x781f('0x2d')]);var _0x5b5a90={'method':_0x781f('0x33'),'uri':_0x781f('0x43'),'body':_0xa820ae,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5b4c7d)[_0x781f('0x44')](_0x781f('0x45')))},'json':!![]};rp(_0x5b5a90)['then'](function(_0x75c4ba){if(_0x75c4ba[_0x781f('0x46')]>=0xc8&&_0x75c4ba[_0x781f('0x46')]<=0xce){if(_0x75c4ba['data']&&_0x75c4ba[_0x781f('0x47')][_0x781f('0x48')]>0x0){var _0x334b01=_['head'](_0x75c4ba[_0x781f('0x47')][_0x781f('0x49')]);var _0x417025={'messageId':_0x334b01[_0x781f('0x4a')]};if(!_0x3fbc89[_0x781f('0x37')]){_0x417025[_0x781f('0x38')]=!![];}return _0x342675['update'](_0x417025);}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x4b'),util['inspect'](_0x75c4ba,{'showHidden':![],'depth':null}));}}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x4b'),util[_0x781f('0x27')](_0x75c4ba,{'showHidden':![],'depth':null}));}})[_0x781f('0x17')](function(_0x1f36cc){logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x4b'),util[_0x781f('0x27')](_0x1f36cc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x781f('0x26'),_0x781f('0x4b'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3fbc89[_0x781f('0x4c')]&&_0x3fbc89[_0x781f('0x1d')]){var _0xa820ae={'dst':_0x5cddcd[_0x781f('0x1f')],'text':_0x5cddcd[_0x781f('0x1e')],'src':_0x3fbc89[_0x781f('0x3b')]||_0x3fbc89['phone'],'url':_0x3fbc89[_0x781f('0x20')]+_0x781f('0x21')+_0x5cddcd['id']+_0x781f('0x22')+_0x3fbc89[_0x781f('0x23')]};var _0x5b4c7d=util['format'](_0x781f('0x42'),_0x3fbc89['authId'],_0x3fbc89['authToken']);var _0x5b5a90={'method':_0x781f('0x33'),'uri':util[_0x781f('0x41')](_0x781f('0x4d'),_0x3fbc89['authId']),'body':_0xa820ae,'headers':{'Authorization':util['format'](_0x781f('0x4e'),new Buffer(_0x5b4c7d)[_0x781f('0x44')](_0x781f('0x45')))},'json':!![]};rp(_0x5b5a90)['then'](function(_0x2b4eb3){var _0x1f13d7={'messageId':_0x2b4eb3[_0x781f('0x4f')][0x0]};return _0x342675[_0x781f('0x24')](_0x1f13d7);})[_0x781f('0x17')](function(_0x2ba356){logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x50'),util['inspect'](_0x2ba356,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x50'),_0x781f('0x51'));}break;case _0x781f('0x52'):if(_0x3fbc89[_0x781f('0x2c')]&&_0x3fbc89[_0x781f('0x2d')]){if(_0x3fbc89['baseUrl']){var _0x251e5f={'method':'POST','uri':_0x3fbc89['baseUrl']+'/auth/1/session','body':{'username':_0x3fbc89[_0x781f('0x2c')],'password':_0x3fbc89[_0x781f('0x2d')]},'json':!![]};return rp(_0x251e5f)[_0x781f('0x15')](function(_0x228aff){var _0x435989={'method':_0x781f('0x33'),'uri':_0x3fbc89['baseUrl']+_0x781f('0x53'),'body':{'messages':[{'from':_0x3fbc89['phone'],'destinations':[{'to':_0x5cddcd[_0x781f('0x1f')]}],'text':_0x5cddcd[_0x781f('0x1e')],'notifyUrl':_0x3fbc89['remote']+_0x781f('0x21')+_0x5cddcd['id']+_0x781f('0x22')+_0x3fbc89['token'],'notifyContentType':'application/json','callbackData':_0x3fbc89['phone']+';'+_0x5cddcd[_0x781f('0x1e')]}]},'headers':{'Authorization':_0x781f('0x54')+_0x228aff[_0x781f('0x23')]},'json':!![]};return rp(_0x435989)[_0x781f('0x15')](function(_0x1f3a9e){if(_0x1f3a9e[_0x781f('0x49')]){var _0x313bcd={'messageId':_0x1f3a9e['messages'][0x0][_0x781f('0xb')]};if(!_0x3fbc89[_0x781f('0x37')]){_0x313bcd[_0x781f('0x38')]=!![];}return _0x342675[_0x781f('0x24')](_0x313bcd);}else{return logger[_0x781f('0x18')](_0x781f('0x28'),'afterCreate',_0x781f('0x52'),util['inspect'](_0x1f3a9e,{'showHidden':![],'depth':null}));}});})[_0x781f('0x17')](function(_0x454310){return logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),'infobip',util[_0x781f('0x27')](_0x454310,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x52'),_0x781f('0x3a'));}break;case _0x781f('0x55'):var _0x466773=require(_0x781f('0x56'));if(_0x3fbc89[_0x781f('0x57')]){var _0xb9742={};_0xb9742[_0x781f('0x58')]=_0x3fbc89[_0x781f('0x2c')];_0xb9742[_0x781f('0x1f')]=_0x5cddcd[_0x781f('0x1f')];_0xb9742[_0x781f('0x59')]=_0x3fbc89[_0x781f('0x1f')];_0xb9742[_0x781f('0x5a')]=_0x5cddcd[_0x781f('0x1e')];_0xb9742[_0x781f('0x5b')]=+new Date();var _0xe58bd1='';var _0x41cb8b='';var _0x4ccd3d=Object[_0x781f('0x5c')](_0xb9742);_0x4ccd3d['sort']();for(var _0x2d7139=0x0;_0x2d7139<_0x4ccd3d[_0x781f('0x5d')];_0x2d7139++){if(_0xe58bd1!=''){_0xe58bd1+='&';}_0xe58bd1+=_0x4ccd3d[_0x2d7139]+'='+encodeURIComponent(_0xb9742[_0x4ccd3d[_0x2d7139]]);_0x41cb8b+=_0xb9742[_0x4ccd3d[_0x2d7139]];}_0x41cb8b+=_0x3fbc89['apiKey'];_0x41cb8b=_0x466773[_0x781f('0x5e')](_0x781f('0x5f'))[_0x781f('0x24')](_0x41cb8b)['digest']('hex');if(_0xe58bd1!==''){_0xe58bd1+='&';}_0xe58bd1+='signature='+_0x41cb8b;var _0x468c95={'method':_0x781f('0x31'),'uri':_0x3fbc89[_0x781f('0x60')]+'/external/get/send.php?'+_0xe58bd1,'json':!![]};return rp(_0x468c95)[_0x781f('0x15')](function(_0x4e8c38){var _0x5f19fc=Object[_0x781f('0x5c')](_0x4e8c38);if(_0x4e8c38[_0x5f19fc[0x0]][_0x781f('0x18')]&&parseInt(_0x4e8c38[_0x5f19fc[0x0]][_0x781f('0x18')])===0x0){var _0x1c896d={'messageId':_0x4e8c38[_0x5f19fc[0x0]]['id_sms']};if(!_0x3fbc89[_0x781f('0x37')]){_0x1c896d['read']=!![];}return _0x342675['update'](_0x1c896d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x781f('0x26'),'csc',util['inspect'](_0x4e8c38[_0x781f('0x18')],{'showHidden':![],'depth':null}));}})[_0x781f('0x17')](function(_0x35c841){return logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),'csc',util['inspect'](_0x35c841,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),'afterCreate','csc',_0x781f('0x61'));}break;case _0x781f('0x62'):if(_0x3fbc89[_0x781f('0x57')]){var _0x57e600={'method':_0x781f('0x33'),'uri':_0x781f('0x63'),'headers':{'Authorization':_0x3fbc89[_0x781f('0x57')]},'body':{'content':_0x5cddcd[_0x781f('0x1e')],'to':[_0x5cddcd['phone']],'from':_0x3fbc89[_0x781f('0x1f')],'binary':![],'clientMessageId':_0x781f('0x64'),'charset':'UTF-8'},'json':!![]};rp(_0x57e600)['then'](function(_0x1ed7f0){if(!_0x1ed7f0['error']){var _0x30a295={'messageId':_0x1ed7f0[_0x781f('0x49')][0x0]['apiMessageId']};if(!_0x3fbc89[_0x781f('0x37')]){_0x30a295['read']=!![];}return _0x342675[_0x781f('0x24')](_0x30a295);}else{return logger[_0x781f('0x18')](_0x781f('0x28'),'afterCreate',_0x781f('0x62'),util['inspect'](_0x1ed7f0[_0x781f('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x116060){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x781f('0x62'),util[_0x781f('0x27')](_0x116060,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x62'),_0x781f('0x61'));}break;case _0x781f('0x65'):if(_0x3fbc89[_0x781f('0x2c')]&&_0x3fbc89[_0x781f('0x2d')]){var _0x5b4c7d=util[_0x781f('0x41')](_0x781f('0x42'),_0x3fbc89['username'],_0x3fbc89[_0x781f('0x2d')]);var _0x5b5a90={'method':_0x781f('0x33'),'uri':_0x781f('0x66')+_0x3fbc89[_0x781f('0x67')]+'/messages','body':{'to':[_0x5cddcd['phone']],'text':_0x5cddcd[_0x781f('0x1e')],'from':_0x3fbc89['phone'],'applicationId':_0x3fbc89[_0x781f('0x68')]},'headers':{'Authorization':util['format'](_0x781f('0x4e'),new Buffer(_0x5b4c7d)[_0x781f('0x44')](_0x781f('0x45')))},'json':!![]};rp(_0x5b5a90)[_0x781f('0x15')](function(_0x115493){if(_0x115493['id']){var _0x1cbf7f={'messageId':_0x115493['id']};return _0x342675[_0x781f('0x24')](_0x1cbf7f);}else{logger['error'](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x65'),util['inspect'](_0x115493,{'showHidden':![],'depth':null}));}})['catch'](function(_0x27e261){logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),'bandwidth',util['inspect'](_0x27e261,{'showHidden':![],'depth':null}));});}else{logger[_0x781f('0x18')](_0x781f('0x28'),_0x781f('0x26'),_0x781f('0x65'),_0x781f('0x3a'));}break;case _0x781f('0x69'):if(_0x3fbc89[_0x781f('0x57')]){var _0x2f645b={};var _0x468c95={'method':_0x781f('0x33'),'uri':_0x781f('0x6a'),'headers':{'Authorization':_0x781f('0x6b')+_0x3fbc89[_0x781f('0x57')],'Content-Type':'application/json'},'body':{'from':_0x3fbc89[_0x781f('0x1f')],'to':_0x5cddcd[_0x781f('0x1f')],'text':_0x5cddcd[_0x781f('0x1e')]},'json':!![]};return rp(_0x468c95)[_0x781f('0x15')](function(_0x2b62cf){if(_0x2b62cf['code']==0xca){_0x2f645b[_0x781f('0x6c')]=_0x2b62cf;var _0x867ec4={'method':'POST','uri':_0x781f('0x6d'),'headers':{'Authorization':_0x781f('0x6b')+_0x3fbc89[_0x781f('0x57')],'Content-Type':_0x781f('0x6e')},'body':{'refid':_0x2f645b['message'][_0x781f('0x6f')]},'json':!![]};return rp(_0x867ec4)[_0x781f('0x15')](function(_0x22d9f7){_0x2f645b[_0x781f('0x70')]=_0x22d9f7;var _0x1e511e={'messageId':_0x2f645b[_0x781f('0x6c')][_0x781f('0x6f')],'read':!![]};return _0x342675[_0x781f('0x24')](_0x1e511e);});}else{return logger['error'](_0x781f('0x28'),_0x781f('0x26'),'intelepeer',util[_0x781f('0x27')](_0x2b62cf,{'showHidden':![],'depth':null}));}})[_0x781f('0x17')](function(_0x468f56){return logger[_0x781f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x781f('0x26'),_0x781f('0x69'),util[_0x781f('0x27')](_0x468f56,{'showHidden':![],'depth':null}));});}else{return logger[_0x781f('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x781f('0x26'),_0x781f('0x69'),_0x781f('0x71'));}break;}}})['finally'](function(){_0x38f6f4();});}else{_0x38f6f4();}}},'charset':_0x781f('0x72'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 15b79f3..5b0951e 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 _0x4645=['defaults','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateSmsMessage','body','options','raw','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x50c09e,_0x1c4dbb){var _0x355565=function(_0x405cf6){while(--_0x405cf6){_0x50c09e['push'](_0x50c09e['shift']());}};_0x355565(++_0x1c4dbb);}(_0x4645,0x152));var _0x5464=function(_0x33d20e,_0x3d4cb4){_0x33d20e=_0x33d20e-0x0;var _0x2844a5=_0x4645[_0x33d20e];return _0x2844a5;};'use strict';var _=require(_0x5464('0x0'));var util=require('util');var moment=require(_0x5464('0x1'));var BPromise=require('bluebird');var rs=require(_0x5464('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5464('0x3'));var logger=require(_0x5464('0x4'))(_0x5464('0x5'));var config=require(_0x5464('0x6'));var jayson=require(_0x5464('0x7'));var client=jayson['client'][_0x5464('0x8')]({'port':0x232a});config[_0x5464('0x9')]=_[_0x5464('0xa')](config[_0x5464('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5464('0xb'))(new Redis(config[_0x5464('0x9')]));require('./smsMessage.socket')[_0x5464('0xc')](socket);function respondWithRpcPromise(_0x3812bf,_0x125275,_0x3badc6){return new BPromise(function(_0x5bbe00,_0x2b93df){return client[_0x5464('0xd')](_0x3812bf,_0x3badc6)[_0x5464('0xe')](function(_0x15470d){logger[_0x5464('0xf')](_0x5464('0x10'),_0x125275,_0x5464('0x11'));logger[_0x5464('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x125275,_0x5464('0x11'),JSON[_0x5464('0x13')](_0x15470d));if(_0x15470d['error']){if(_0x15470d['error'][_0x5464('0x14')]===0x1f4){logger[_0x5464('0x15')](_0x5464('0x10'),_0x125275,_0x15470d[_0x5464('0x15')]['message']);return _0x2b93df(_0x15470d[_0x5464('0x15')][_0x5464('0x16')]);}logger[_0x5464('0x15')](_0x5464('0x10'),_0x125275,_0x15470d[_0x5464('0x15')]['message']);return _0x5bbe00(_0x15470d[_0x5464('0x15')][_0x5464('0x16')]);}else{logger[_0x5464('0xf')](_0x5464('0x10'),_0x125275,_0x5464('0x11'));_0x5bbe00(_0x15470d[_0x5464('0x17')][_0x5464('0x16')]);}})[_0x5464('0x18')](function(_0x3730d3){logger[_0x5464('0x15')](_0x5464('0x10'),_0x125275,_0x3730d3);_0x2b93df(_0x3730d3);});});}exports[_0x5464('0x19')]=function(_0xb9826a){var _0x442bb5=this;return new Promise(function(_0x3ee07a,_0x36fc9a){return db['SmsMessage']['create'](_0xb9826a[_0x5464('0x1a')],{'raw':_0xb9826a[_0x5464('0x1b')]?_0xb9826a[_0x5464('0x1b')][_0x5464('0x1c')]===undefined?!![]:![]:!![]})[_0x5464('0xe')](function(_0x33104c){logger[_0x5464('0xf')](_0x5464('0x19'),_0xb9826a);logger['debug'](_0x5464('0x19'),_0xb9826a,JSON[_0x5464('0x13')](_0x33104c));_0x3ee07a(_0x33104c);})[_0x5464('0x18')](function(_0x28905f){logger[_0x5464('0x15')](_0x5464('0x19'),_0x28905f[_0x5464('0x16')],_0xb9826a);_0x36fc9a(_0x442bb5[_0x5464('0x15')](0x1f4,_0x28905f[_0x5464('0x16')]));});});}; \ No newline at end of file +var _0xe07f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','options','stringify','CreateSmsMessage','lodash','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe07f,0xa3));var _0xfe07=function(_0x4f463a,_0x12e6b9){_0x4f463a=_0x4f463a-0x0;var _0x17d7e3=_0xe07f[_0x4f463a];return _0x17d7e3;};'use strict';var _=require(_0xfe07('0x0'));var util=require('util');var moment=require(_0xfe07('0x1'));var BPromise=require(_0xfe07('0x2'));var rs=require(_0xfe07('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe07('0x4'))['db'];var utils=require(_0xfe07('0x5'));var logger=require(_0xfe07('0x6'))(_0xfe07('0x7'));var config=require(_0xfe07('0x8'));var jayson=require(_0xfe07('0x9'));var client=jayson[_0xfe07('0xa')][_0xfe07('0xb')]({'port':0x232a});config[_0xfe07('0xc')]=_[_0xfe07('0xd')](config['redis'],{'host':_0xfe07('0xe'),'port':0x18eb});var socket=require(_0xfe07('0xf'))(new Redis(config[_0xfe07('0xc')]));require(_0xfe07('0x10'))[_0xfe07('0x11')](socket);function respondWithRpcPromise(_0x3bc98d,_0xd9d03,_0x21b67b){return new BPromise(function(_0xfff04f,_0x48af80){return client[_0xfe07('0x12')](_0x3bc98d,_0x21b67b)[_0xfe07('0x13')](function(_0x115759){logger[_0xfe07('0x14')](_0xfe07('0x15'),_0xd9d03,_0xfe07('0x16'));logger[_0xfe07('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9d03,_0xfe07('0x16'),JSON['stringify'](_0x115759));if(_0x115759[_0xfe07('0x18')]){if(_0x115759['error'][_0xfe07('0x19')]===0x1f4){logger[_0xfe07('0x18')](_0xfe07('0x15'),_0xd9d03,_0x115759[_0xfe07('0x18')][_0xfe07('0x1a')]);return _0x48af80(_0x115759[_0xfe07('0x18')]['message']);}logger[_0xfe07('0x18')]('SmsMessage,\x20%s,\x20%s',_0xd9d03,_0x115759[_0xfe07('0x18')][_0xfe07('0x1a')]);return _0xfff04f(_0x115759[_0xfe07('0x18')][_0xfe07('0x1a')]);}else{logger['info'](_0xfe07('0x15'),_0xd9d03,_0xfe07('0x16'));_0xfff04f(_0x115759[_0xfe07('0x1b')][_0xfe07('0x1a')]);}})[_0xfe07('0x1c')](function(_0x23d427){logger[_0xfe07('0x18')](_0xfe07('0x15'),_0xd9d03,_0x23d427);_0x48af80(_0x23d427);});});}exports['CreateSmsMessage']=function(_0x530be8){var _0x294182=this;return new Promise(function(_0x476480,_0x128de3){return db['SmsMessage'][_0xfe07('0x1d')](_0x530be8['body'],{'raw':_0x530be8[_0xfe07('0x1e')]?_0x530be8[_0xfe07('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x479cc4){logger[_0xfe07('0x14')]('CreateSmsMessage',_0x530be8);logger[_0xfe07('0x17')]('CreateSmsMessage',_0x530be8,JSON[_0xfe07('0x1f')](_0x479cc4));_0x476480(_0x479cc4);})[_0xfe07('0x1c')](function(_0x480070){logger[_0xfe07('0x18')](_0xfe07('0x20'),_0x480070[_0xfe07('0x1a')],_0x530be8);_0x128de3(_0x294182[_0xfe07('0x18')](0x1f4,_0x480070[_0xfe07('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 864a7d6..cb44ffa 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 _0x0897=['smsMessage:','./smsMessage.events','save','remove','update','removeListener','length'];(function(_0x56fcf6,_0x401b3c){var _0x2078a7=function(_0x4f2790){while(--_0x4f2790){_0x56fcf6['push'](_0x56fcf6['shift']());}};_0x2078a7(++_0x401b3c);}(_0x0897,0x135));var _0x7089=function(_0x463499,_0x41c22d){_0x463499=_0x463499-0x0;var _0x5dccb2=_0x0897[_0x463499];return _0x5dccb2;};'use strict';var SmsMessageEvents=require(_0x7089('0x0'));var events=[_0x7089('0x1'),_0x7089('0x2'),_0x7089('0x3')];function createListener(_0x38d97c,_0x3dfafe){return function(_0x199a38){_0x3dfafe['emit'](_0x38d97c,_0x199a38);};}function removeListener(_0x1f2465,_0x1e8963){return function(){SmsMessageEvents[_0x7089('0x4')](_0x1f2465,_0x1e8963);};}exports['register']=function(_0x2b9cbc){for(var _0x29d818=0x0,_0x40cb58=events[_0x7089('0x5')];_0x29d818<_0x40cb58;_0x29d818++){var _0x158e14=events[_0x29d818];var _0x3c6e22=createListener(_0x7089('0x6')+_0x158e14,_0x2b9cbc);SmsMessageEvents['on'](_0x158e14,_0x3c6e22);}}; \ No newline at end of file +var _0x5c3d=['smsMessage:','./smsMessage.events','save','update','removeListener','register'];(function(_0x5bbba6,_0x4dc05c){var _0x124156=function(_0x4d1b75){while(--_0x4d1b75){_0x5bbba6['push'](_0x5bbba6['shift']());}};_0x124156(++_0x4dc05c);}(_0x5c3d,0xd3));var _0xd5c3=function(_0xc1b6d6,_0x3be568){_0xc1b6d6=_0xc1b6d6-0x0;var _0x535a66=_0x5c3d[_0xc1b6d6];return _0x535a66;};'use strict';var SmsMessageEvents=require(_0xd5c3('0x0'));var events=[_0xd5c3('0x1'),'remove',_0xd5c3('0x2')];function createListener(_0x1ccf8f,_0x204f8e){return function(_0x5145ca){_0x204f8e['emit'](_0x1ccf8f,_0x5145ca);};}function removeListener(_0x230baa,_0x51ca47){return function(){SmsMessageEvents[_0xd5c3('0x3')](_0x230baa,_0x51ca47);};}exports[_0xd5c3('0x4')]=function(_0x56d694){for(var _0x2a22e7=0x0,_0x488ad9=events['length'];_0x2a22e7<_0x488ad9;_0x2a22e7++){var _0x30080b=events[_0x2a22e7];var _0x29c24c=createListener(_0xd5c3('0x5')+_0x30080b,_0x56d694);SmsMessageEvents['on'](_0x30080b,_0x29c24c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2dd5bac..6b6811a 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 _0xaa25=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','delete','destroy','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x190cbc,_0x988b4e){var _0x484f99=function(_0x4dfa59){while(--_0x4dfa59){_0x190cbc['push'](_0x190cbc['shift']());}};_0x484f99(++_0x988b4e);}(_0xaa25,0x1ed));var _0x5aa2=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xaa25[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x5aa2('0x0'));var util=require(_0x5aa2('0x1'));var path=require(_0x5aa2('0x2'));var timeout=require('connect-timeout');var express=require(_0x5aa2('0x3'));var router=express[_0x5aa2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5aa2('0x5'));var interaction=require(_0x5aa2('0x6'));var config=require(_0x5aa2('0x7'));var controller=require('./smsQueue.controller');router[_0x5aa2('0x8')]('/',auth[_0x5aa2('0x9')](),controller['index']);router[_0x5aa2('0x8')](_0x5aa2('0xa'),auth[_0x5aa2('0x9')](),controller[_0x5aa2('0xb')]);router[_0x5aa2('0x8')](_0x5aa2('0xc'),auth['isAuthenticated'](),controller[_0x5aa2('0xd')]);router[_0x5aa2('0x8')](_0x5aa2('0xe'),auth[_0x5aa2('0x9')](),controller['getMembers']);router[_0x5aa2('0x8')](_0x5aa2('0xf'),auth[_0x5aa2('0x9')](),controller[_0x5aa2('0x10')]);router['get'](_0x5aa2('0x11'),auth[_0x5aa2('0x9')](),controller[_0x5aa2('0x12')]);router[_0x5aa2('0x13')]('/',auth[_0x5aa2('0x9')](),controller['create']);router[_0x5aa2('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5aa2('0x14')]);router[_0x5aa2('0x13')]('/:id/users',auth[_0x5aa2('0x9')](),controller['addAgents']);router['put'](_0x5aa2('0xc'),auth[_0x5aa2('0x9')](),controller['update']);router[_0x5aa2('0x15')](_0x5aa2('0xc'),auth['isAuthenticated'](),controller[_0x5aa2('0x16')]);router[_0x5aa2('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5aa2('0x17')]);router['delete'](_0x5aa2('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5aa2('0x18')]=router; \ No newline at end of file +var _0xc783=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/describe','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','/:id/teams','removeTeams'];(function(_0x379900,_0x2f177c){var _0x2ff332=function(_0x25b721){while(--_0x25b721){_0x379900['push'](_0x379900['shift']());}};_0x2ff332(++_0x2f177c);}(_0xc783,0x191));var _0x3c78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc783[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3c78('0x0'));var util=require('util');var path=require(_0x3c78('0x1'));var timeout=require(_0x3c78('0x2'));var express=require('express');var router=express[_0x3c78('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3c78('0x4'));var interaction=require(_0x3c78('0x5'));var config=require('../../config/environment');var controller=require(_0x3c78('0x6'));router['get']('/',auth[_0x3c78('0x7')](),controller[_0x3c78('0x8')]);router[_0x3c78('0x9')](_0x3c78('0xa'),auth[_0x3c78('0x7')](),controller['describe']);router[_0x3c78('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x3c78('0x7')](),controller[_0x3c78('0xb')]);router[_0x3c78('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3c78('0xc')]);router[_0x3c78('0x9')](_0x3c78('0xd'),auth['isAuthenticated'](),controller[_0x3c78('0xe')]);router[_0x3c78('0xf')]('/',auth['isAuthenticated'](),controller[_0x3c78('0x10')]);router['post']('/:id/teams',auth[_0x3c78('0x7')](),controller[_0x3c78('0x11')]);router['post'](_0x3c78('0xd'),auth[_0x3c78('0x7')](),controller[_0x3c78('0x12')]);router['put'](_0x3c78('0x13'),auth[_0x3c78('0x7')](),controller[_0x3c78('0x14')]);router[_0x3c78('0x15')]('/:id',auth[_0x3c78('0x7')](),controller['destroy']);router['delete'](_0x3c78('0x16'),auth[_0x3c78('0x7')](),controller[_0x3c78('0x17')]);router[_0x3c78('0x15')](_0x3c78('0xd'),auth[_0x3c78('0x7')](),controller['removeAgents']);module[_0x3c78('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b358430..8b79a26 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 _0x5e9c=['beepall','roundrobin','sequelize','STRING','INTEGER','rrmemory'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x5e9c,0x1e2));var _0xc5e9=function(_0x506563,_0x2ba439){_0x506563=_0x506563-0x0;var _0x5cbe67=_0x5e9c[_0x506563];return _0x5cbe67;};'use strict';var Sequelize=require(_0xc5e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5e9('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc5e9('0x1')]},'timeout':{'type':Sequelize[_0xc5e9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc5e9('0x3'),_0xc5e9('0x4'),_0xc5e9('0x5'))}}; \ No newline at end of file +var _0x09f8=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x324685,_0x973b4f){var _0x2a36e9=function(_0xfe1c8c){while(--_0xfe1c8c){_0x324685['push'](_0x324685['shift']());}};_0x2a36e9(++_0x973b4f);}(_0x09f8,0x85));var _0x809f=function(_0x2cdd1c,_0x363850){_0x2cdd1c=_0x2cdd1c-0x0;var _0x99af91=_0x09f8[_0x2cdd1c];return _0x99af91;};'use strict';var Sequelize=require(_0x809f('0x0'));module[_0x809f('0x1')]={'name':{'type':Sequelize[_0x809f('0x2')],'unique':_0x809f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x809f('0x2')]},'timeout':{'type':Sequelize[_0x809f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x809f('0x5')]('rrmemory',_0x809f('0x6'),_0x809f('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 87b9729..8050ee8 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 _0xa76e=['register','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueue','includeAll','include','rows','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','userSmsQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','rimraf','zip-dir','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa76e,0xfe));var _0xea76=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa76e[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea76('0x0'));var zipdir=require(_0xea76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea76('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xea76('0x3'));var util=require(_0xea76('0x4'));var path=require(_0xea76('0x5'));var sox=require('sox');var csv=require(_0xea76('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea76('0x7'));var _=require('lodash');var squel=require(_0xea76('0x8'));var crypto=require(_0xea76('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xea76('0x6'));var querystring=require(_0xea76('0xa'));var Papa=require(_0xea76('0xb'));var Redis=require(_0xea76('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xea76('0xd'));var as=require(_0xea76('0xe'));var hardwareService=require(_0xea76('0xf'));var logger=require('../../config/logger')(_0xea76('0x10'));var utils=require(_0xea76('0x11'));var config=require(_0xea76('0x12'));var licenseUtil=require(_0xea76('0x13'));var db=require(_0xea76('0x14'))['db'];config[_0xea76('0x15')]=_[_0xea76('0x16')](config[_0xea76('0x15')],{'host':_0xea76('0x17'),'port':0x18eb});var socket=require(_0xea76('0x18'))(new Redis(config[_0xea76('0x15')]));require(_0xea76('0x19'))[_0xea76('0x1a')](socket);function respondWithStatusCode(_0x4184f3,_0x7fb08e){_0x7fb08e=_0x7fb08e||0xcc;return function(_0x4b250f){if(_0x4b250f){return _0x4184f3[_0xea76('0x1b')](_0x7fb08e);}return _0x4184f3[_0xea76('0x1c')](_0x7fb08e)[_0xea76('0x1d')]();};}function respondWithResult(_0x418f9a,_0x20e1a1){_0x20e1a1=_0x20e1a1||0xc8;return function(_0x855c08){if(_0x855c08){return _0x418f9a[_0xea76('0x1c')](_0x20e1a1)[_0xea76('0x1e')](_0x855c08);}};}function respondWithFilteredResult(_0x9ed6e1,_0xd8985c){return function(_0x210e27){if(_0x210e27){var _0x1efdfa=typeof _0xd8985c['offset']==='undefined'&&typeof _0xd8985c[_0xea76('0x1f')]==='undefined';var _0x1f588c=_0x210e27[_0xea76('0x20')];var _0x3765b0=_0x1efdfa?0x0:_0xd8985c['offset'];var _0x5d7f91=_0x1efdfa?_0x210e27['count']:_0xd8985c[_0xea76('0x21')]+_0xd8985c[_0xea76('0x1f')];var _0x227ef9;if(_0x5d7f91>=_0x1f588c){_0x5d7f91=_0x1f588c;_0x227ef9=0xc8;}else{_0x227ef9=0xce;}_0x9ed6e1[_0xea76('0x1c')](_0x227ef9);return _0x9ed6e1['set'](_0xea76('0x22'),_0x3765b0+'-'+_0x5d7f91+'/'+_0x1f588c)['json'](_0x210e27);}return null;};}function patchUpdates(_0x2c1a26){return function(_0x19202a){try{jsonpatch[_0xea76('0x23')](_0x19202a,_0x2c1a26,!![]);}catch(_0x337459){return BPromise[_0xea76('0x24')](_0x337459);}return _0x19202a[_0xea76('0x25')]();};}function saveUpdates(_0x3d6f4e,_0x4020b7){return function(_0x46b7ec){if(_0x46b7ec){return _0x46b7ec[_0xea76('0x26')](_0x3d6f4e)[_0xea76('0x27')](function(_0x1729a2){return _0x1729a2;});}return null;};}function removeEntity(_0xb511a6,_0x44d877){return function(_0x3fb762){if(_0x3fb762){return _0x3fb762[_0xea76('0x28')]()['then'](function(){var _0x163dc7=_0x3fb762['get']({'plain':!![]});var _0x5911c2=_0xea76('0x29');return db[_0xea76('0x2a')][_0xea76('0x28')]({'where':{'type':_0x5911c2,'resourceId':_0x163dc7['id']}})[_0xea76('0x27')](function(){return _0x3fb762;});})[_0xea76('0x27')](function(){_0xb511a6[_0xea76('0x1c')](0xcc)[_0xea76('0x1d')]();});}};}function handleEntityNotFound(_0x5d2826,_0x5c7960){return function(_0x2335de){if(!_0x2335de){_0x5d2826[_0xea76('0x1b')](0x194);}return _0x2335de;};}function handleError(_0x1b2152,_0x4736f3){_0x4736f3=_0x4736f3||0x1f4;return function(_0x1e7a30){logger[_0xea76('0x2b')](_0x1e7a30[_0xea76('0x2c')]);if(_0x1e7a30[_0xea76('0x2d')]){delete _0x1e7a30[_0xea76('0x2d')];}_0x1b2152[_0xea76('0x1c')](_0x4736f3)[_0xea76('0x2e')](_0x1e7a30);};}exports[_0xea76('0x2f')]=function(_0x40e4ad,_0x3421da){var _0x1c12b2={},_0x4c2dfb={},_0x41fd11={'count':0x0,'rows':[]};var _0x6d046e=_[_0xea76('0x30')](db['SmsQueue'][_0xea76('0x31')],function(_0x2350e8){return{'name':_0x2350e8[_0xea76('0x32')],'type':_0x2350e8[_0xea76('0x33')]['key']};});_0x4c2dfb[_0xea76('0x34')]=_['map'](_0x6d046e,'name');_0x4c2dfb[_0xea76('0x35')]=_['keys'](_0x40e4ad['query']);_0x4c2dfb[_0xea76('0x36')]=_[_0xea76('0x37')](_0x4c2dfb[_0xea76('0x34')],_0x4c2dfb[_0xea76('0x35')]);_0x1c12b2[_0xea76('0x38')]=_['intersection'](_0x4c2dfb[_0xea76('0x34')],qs['fields'](_0x40e4ad[_0xea76('0x35')][_0xea76('0x39')]));_0x1c12b2[_0xea76('0x38')]=_0x1c12b2['attributes'][_0xea76('0x3a')]?_0x1c12b2['attributes']:_0x4c2dfb['model'];if(!_0x40e4ad[_0xea76('0x35')][_0xea76('0x3b')](_0xea76('0x3c'))){_0x1c12b2[_0xea76('0x1f')]=qs[_0xea76('0x1f')](_0x40e4ad[_0xea76('0x35')][_0xea76('0x1f')]);_0x1c12b2[_0xea76('0x21')]=qs[_0xea76('0x21')](_0x40e4ad[_0xea76('0x35')][_0xea76('0x21')]);}_0x1c12b2[_0xea76('0x3d')]=qs[_0xea76('0x3e')](_0x40e4ad[_0xea76('0x35')][_0xea76('0x3e')]);_0x1c12b2[_0xea76('0x3f')]=qs[_0xea76('0x36')](_[_0xea76('0x40')](_0x40e4ad[_0xea76('0x35')],_0x4c2dfb['filters']),_0x6d046e);if(_0x40e4ad[_0xea76('0x35')][_0xea76('0x41')]){_0x1c12b2[_0xea76('0x3f')]=_[_0xea76('0x42')](_0x1c12b2[_0xea76('0x3f')],{'$or':_[_0xea76('0x30')](_0x6d046e,function(_0x384e1a){if(_0x384e1a[_0xea76('0x33')]!==_0xea76('0x43')){var _0x281063={};_0x281063[_0x384e1a[_0xea76('0x2d')]]={'$like':'%'+_0x40e4ad['query']['filter']+'%'};return _0x281063;}})});}_0x1c12b2=_[_0xea76('0x42')]({},_0x1c12b2,_0x40e4ad['options']);var _0x5403ab={'where':_0x1c12b2['where']};return db[_0xea76('0x44')][_0xea76('0x20')](_0x5403ab)[_0xea76('0x27')](function(_0x46ae07){_0x41fd11['count']=_0x46ae07;if(_0x40e4ad[_0xea76('0x35')][_0xea76('0x45')]){_0x1c12b2[_0xea76('0x46')]=[{'all':!![]}];}return db[_0xea76('0x44')]['findAll'](_0x1c12b2);})[_0xea76('0x27')](function(_0x2cc051){_0x41fd11[_0xea76('0x47')]=_0x2cc051;return _0x41fd11;})['then'](respondWithFilteredResult(_0x3421da,_0x1c12b2))['catch'](handleError(_0x3421da,null));};exports['show']=function(_0x3a8034,_0x52732e){var _0x380396={'raw':!![],'where':{'id':_0x3a8034['params']['id']}},_0x241192={};_0x241192['model']=_[_0xea76('0x48')](db[_0xea76('0x44')][_0xea76('0x31')]);_0x241192[_0xea76('0x35')]=_[_0xea76('0x48')](_0x3a8034['query']);_0x241192['filters']=_['intersection'](_0x241192['model'],_0x241192[_0xea76('0x35')]);_0x380396[_0xea76('0x38')]=_[_0xea76('0x37')](_0x241192[_0xea76('0x34')],qs['fields'](_0x3a8034[_0xea76('0x35')]['fields']));_0x380396[_0xea76('0x38')]=_0x380396[_0xea76('0x38')]['length']?_0x380396[_0xea76('0x38')]:_0x241192['model'];if(_0x3a8034['query'][_0xea76('0x45')]){_0x380396[_0xea76('0x46')]=[{'all':!![]}];}_0x380396=_[_0xea76('0x42')]({},_0x380396,_0x3a8034[_0xea76('0x49')]);return db['SmsQueue'][_0xea76('0x4a')](_0x380396)['then'](handleEntityNotFound(_0x52732e,null))[_0xea76('0x27')](respondWithResult(_0x52732e,null))[_0xea76('0x4b')](handleError(_0x52732e,null));};exports[_0xea76('0x4c')]=function(_0x3f1164,_0x29a08c){return db[_0xea76('0x44')][_0xea76('0x4c')](_0x3f1164[_0xea76('0x4d')],{})[_0xea76('0x27')](function(_0x2fc405){var _0x2a0966=_0x3f1164[_0xea76('0x4e')]['get']({'plain':!![]});if(!_0x2a0966)throw new Error(_0xea76('0x4f'));if(_0x2a0966['role']==='user'){var _0x87c06d=_0x2fc405[_0xea76('0x50')]({'plain':!![]});var _0x535f58=_0xea76('0x29');return db['UserProfileSection'][_0xea76('0x4a')]({'where':{'name':_0x535f58,'userProfileId':_0x2a0966['userProfileId']},'raw':!![]})[_0xea76('0x27')](function(_0x108280){if(_0x108280&&_0x108280[_0xea76('0x51')]===0x0){return db[_0xea76('0x2a')]['create']({'name':_0x87c06d[_0xea76('0x2d')],'resourceId':_0x87c06d['id'],'type':_0x108280[_0xea76('0x2d')],'sectionId':_0x108280['id']},{})['then'](function(){return _0x2fc405;});}else{return _0x2fc405;}})['catch'](function(_0x221131){logger[_0xea76('0x2b')](_0xea76('0x52'),_0x221131);throw _0x221131;});}return _0x2fc405;})[_0xea76('0x27')](respondWithResult(_0x29a08c,0xc9))[_0xea76('0x4b')](handleError(_0x29a08c,null));};exports[_0xea76('0x26')]=function(_0x2cf36f,_0x269d1d){if(_0x2cf36f[_0xea76('0x4d')]['id']){delete _0x2cf36f[_0xea76('0x4d')]['id'];}return db[_0xea76('0x44')][_0xea76('0x4a')]({'where':{'id':_0x2cf36f[_0xea76('0x53')]['id']}})[_0xea76('0x27')](handleEntityNotFound(_0x269d1d,null))[_0xea76('0x27')](saveUpdates(_0x2cf36f['body'],null))['then'](respondWithResult(_0x269d1d,null))['catch'](handleError(_0x269d1d,null));};exports['destroy']=function(_0x2169d9,_0x5e3680){return db[_0xea76('0x44')][_0xea76('0x4a')]({'where':{'id':_0x2169d9[_0xea76('0x53')]['id']}})[_0xea76('0x27')](handleEntityNotFound(_0x5e3680,null))['then'](removeEntity(_0x5e3680,null))['catch'](handleError(_0x5e3680,null));};exports[_0xea76('0x54')]=function(_0x1b4677,_0x35d274){return db[_0xea76('0x44')][_0xea76('0x54')]()[_0xea76('0x27')](respondWithResult(_0x35d274,null))[_0xea76('0x4b')](handleError(_0x35d274,null));};exports[_0xea76('0x55')]=function(_0x46e7e1,_0x416d48,_0x1e175b){var _0x56e9f6={'raw':!![],'where':{}},_0x191afb={},_0x457982;return db[_0xea76('0x44')][_0xea76('0x56')]({'where':{'id':_0x46e7e1[_0xea76('0x53')]['id']}})[_0xea76('0x27')](handleEntityNotFound(_0x416d48,null))[_0xea76('0x27')](function(_0x4e4587){if(_0x4e4587){_0x457982=_0x4e4587[_0xea76('0x50')]({'plain':!![]});_0x191afb[_0xea76('0x34')]=_[_0xea76('0x48')](db[_0xea76('0x57')]['rawAttributes']);_0x191afb[_0xea76('0x35')]=_[_0xea76('0x48')](_0x46e7e1['query']);_0x191afb[_0xea76('0x36')]=_[_0xea76('0x37')](_0x191afb[_0xea76('0x34')],_0x191afb[_0xea76('0x35')]);_0x56e9f6['attributes']=_[_0xea76('0x37')](_0x191afb['model'],qs[_0xea76('0x39')](_0x46e7e1['query'][_0xea76('0x39')]));_0x56e9f6[_0xea76('0x38')]=_0x56e9f6[_0xea76('0x38')]['length']?_0x56e9f6[_0xea76('0x38')]:_0x191afb[_0xea76('0x34')];if(!_0x46e7e1[_0xea76('0x35')]['hasOwnProperty'](_0xea76('0x3c'))){_0x56e9f6['limit']=qs[_0xea76('0x1f')](_0x46e7e1[_0xea76('0x35')][_0xea76('0x1f')]);_0x56e9f6[_0xea76('0x21')]=qs[_0xea76('0x21')](_0x46e7e1[_0xea76('0x35')][_0xea76('0x21')]);}_0x56e9f6['order']=qs[_0xea76('0x3e')](_0x46e7e1['query']['sort']);_0x56e9f6[_0xea76('0x3f')]=qs[_0xea76('0x36')](_[_0xea76('0x40')](_0x46e7e1[_0xea76('0x35')],_0x191afb['filters']));_0x56e9f6[_0xea76('0x3f')][_0xea76('0x58')]=_0x4e4587['id'];if(_0x46e7e1['query']['filter']){_0x56e9f6[_0xea76('0x3f')]=_[_0xea76('0x42')](_0x56e9f6['where'],{'$or':_[_0xea76('0x30')](_0x56e9f6['attributes'],function(_0x5cabba){var _0x4b294c={};_0x4b294c[_0x5cabba]={'$like':'%'+_0x46e7e1[_0xea76('0x35')][_0xea76('0x41')]+'%'};return _0x4b294c;})});}_0x56e9f6=_[_0xea76('0x42')]({},_0x56e9f6,_0x46e7e1['options']);return db[_0xea76('0x57')][_0xea76('0x59')](_0x56e9f6);}})[_0xea76('0x27')](function(_0x177b71){if(_0x177b71){return db[_0xea76('0x5a')][_0xea76('0x5b')]({'where':{'id':_['map'](_0x177b71,_0xea76('0x5c')),'role':_0xea76('0x5d')},'attributes':['id',_0xea76('0x2d'),'smsPause',_0xea76('0x5e'),_0xea76('0x5f')]});}})[_0xea76('0x27')](function(_0x52e007){if(_0x52e007){return{'count':_0x52e007[_0xea76('0x20')],'rows':_[_0xea76('0x30')](_0x52e007[_0xea76('0x47')],function(_0x20771d){return{'membername':_0x20771d[_0xea76('0x2d')],'UserId':_0x20771d['id'],'queue_name':_0x457982[_0xea76('0x2d')],'SmsQueueId':_0x457982['id'],'interface':util[_0xea76('0x60')](_0xea76('0x61'),_0xea76('0x62'),_0x20771d[_0xea76('0x2d')]),'penalty':0x0,'paused':_0x20771d[_0xea76('0x63')],'createdAt':_0x20771d[_0xea76('0x5f')],'updatedAt':_0x20771d[_0xea76('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x416d48,_0x56e9f6))[_0xea76('0x4b')](handleError(_0x416d48,null));};exports['getTeams']=function(_0x1c2f13,_0x1ee775,_0x2099c2){var _0x243b06={};var _0x1fd417={};var _0x40cad0;var _0x17bb89;return db[_0xea76('0x44')][_0xea76('0x56')]({'where':{'id':_0x1c2f13[_0xea76('0x53')]['id']}})['then'](handleEntityNotFound(_0x1ee775,null))[_0xea76('0x27')](function(_0x299cfd){if(_0x299cfd){_0x40cad0=_0x299cfd;_0x1fd417['model']=_[_0xea76('0x48')](db[_0xea76('0x64')][_0xea76('0x31')]);_0x1fd417['query']=_['keys'](_0x1c2f13['query']);_0x1fd417[_0xea76('0x36')]=_[_0xea76('0x37')](_0x1fd417['model'],_0x1fd417['query']);_0x243b06[_0xea76('0x38')]=_[_0xea76('0x37')](_0x1fd417[_0xea76('0x34')],qs[_0xea76('0x39')](_0x1c2f13['query'][_0xea76('0x39')]));_0x243b06[_0xea76('0x38')]=_0x243b06[_0xea76('0x38')]['length']?_0x243b06[_0xea76('0x38')]:_0x1fd417[_0xea76('0x34')];_0x243b06[_0xea76('0x3d')]=qs[_0xea76('0x3e')](_0x1c2f13['query']['sort']);_0x243b06['where']=qs[_0xea76('0x36')](_[_0xea76('0x40')](_0x1c2f13[_0xea76('0x35')],_0x1fd417['filters']));if(_0x1c2f13['query']['filter']){_0x243b06[_0xea76('0x3f')]=_[_0xea76('0x42')](_0x243b06[_0xea76('0x3f')],{'$or':_[_0xea76('0x30')](_0x243b06[_0xea76('0x38')],function(_0x4b2865){var _0x171e9b={};_0x171e9b[_0x4b2865]={'$like':'%'+_0x1c2f13[_0xea76('0x35')][_0xea76('0x41')]+'%'};return _0x171e9b;})});}_0x243b06=_[_0xea76('0x42')]({},_0x243b06,_0x1c2f13['options']);return _0x40cad0[_0xea76('0x65')](_0x243b06);}})[_0xea76('0x27')](function(_0x443c68){if(_0x443c68){_0x17bb89=_0x443c68[_0xea76('0x3a')];if(!_0x1c2f13['query'][_0xea76('0x3b')]('nolimit')){_0x243b06[_0xea76('0x1f')]=qs['limit'](_0x1c2f13['query'][_0xea76('0x1f')]);_0x243b06[_0xea76('0x21')]=qs['offset'](_0x1c2f13['query'][_0xea76('0x21')]);}return _0x40cad0[_0xea76('0x65')](_0x243b06);}})[_0xea76('0x27')](function(_0xb555f0){if(_0xb555f0){return _0xb555f0?{'count':_0x17bb89,'rows':_0xb555f0}:null;}})[_0xea76('0x27')](respondWithResult(_0x1ee775,null))[_0xea76('0x4b')](handleError(_0x1ee775,null));};exports['addTeams']=function(_0x1904ee,_0x1babba,_0x14bbef){var _0x454ae6=_0x1904ee['body'][_0xea76('0x66')];return db[_0xea76('0x64')]['findAll']({'where':{'id':_0x454ae6},'attributes':['id'],'include':[{'model':db[_0xea76('0x5a')],'as':_0xea76('0x67'),'attributes':['id',_0xea76('0x2d'),_0xea76('0x68'),_0xea76('0x69'),_0xea76('0x6a')],'raw':!![]}]})[_0xea76('0x27')](function(_0x166028){if(_0x166028){var _0x506e5e=_[_0xea76('0x6b')](_0x166028,function(_0x1ebe65){var _0x5920bd=_0x1ebe65[_0xea76('0x50')]({'plain':!![]});return _0x5920bd[_0xea76('0x67')];});return db[_0xea76('0x44')][_0xea76('0x4a')]({'where':{'id':_0x1904ee[_0xea76('0x53')]['id']}})[_0xea76('0x27')](function(_0x4557bc){return db[_0xea76('0x6c')][_0xea76('0x6d')](function(_0x24a370){return _0x4557bc['addTeams'](_0x454ae6,{'transaction':_0x24a370})['then'](function(){return BPromise[_0xea76('0x6e')](_0x506e5e,function(_0xc0b6a3){return db[_0xea76('0x57')]['findOrCreate']({'where':{'UserId':_0xc0b6a3['id'],'SmsQueueId':_0x1904ee[_0xea76('0x53')]['id']},'transaction':_0x24a370});});})[_0xea76('0x27')](function(){_0x506e5e[_0xea76('0x6f')](function(_0x1c30b2){socket['emit'](_0xea76('0x70'),{'UserId':_0x1c30b2['id'],'SmsQueueId':_0x4557bc['id']});});});});});}})[_0xea76('0x27')](respondWithStatusCode(_0x1babba,null))[_0xea76('0x4b')](handleError(_0x1babba,null));};exports[_0xea76('0x71')]=function(_0x4a7b2f,_0xb1ca6,_0x17cd9f){return db[_0xea76('0x64')][_0xea76('0x59')]({'where':{'id':_0x4a7b2f['query'][_0xea76('0x66')]},'attributes':['id'],'include':[{'model':db[_0xea76('0x5a')],'as':_0xea76('0x67'),'attributes':['id'],'raw':!![]}]})[_0xea76('0x27')](handleEntityNotFound(_0xb1ca6,null))['then'](function(_0x13c653){var _0x53f36b=_[_0xea76('0x30')](_0x13c653,'id');var _0x31fbfd=[];var _0x1ce028=[];var _0x116855=squel['select']();_0x116855[_0xea76('0x72')]('tq.TeamId')[_0xea76('0x73')](_0xea76('0x74'),'tq')[_0xea76('0x75')](_0xea76('0x76'),'ut',_0xea76('0x77'))[_0xea76('0x3f')](_0xea76('0x78'),_0x4a7b2f[_0xea76('0x53')]['id']);for(var _0x3ce12c=0x0;_0x3ce12c<_0x13c653[_0xea76('0x3a')];_0x3ce12c+=0x1){let _0x118095=_0x13c653[_0x3ce12c];for(var _0x5281b2=0x0;_0x5281b2<_0x118095[_0xea76('0x67')][_0xea76('0x3a')];_0x5281b2+=0x1){let _0x16a182=_0x118095[_0xea76('0x67')][_0x5281b2];var _0x4b102c=_0x116855[_0xea76('0x79')]();_0x4b102c['where'](_0xea76('0x7a'),_0x16a182['id']);_0x1ce028[_0xea76('0x7b')](db['sequelize'][_0xea76('0x35')](_0x4b102c[_0xea76('0x7c')](),{'type':db[_0xea76('0x6c')][_0xea76('0x7d')][_0xea76('0x7e')]})['then'](function(_0x5576c7){if(_0x5576c7[_0xea76('0x3a')]===0x1){return _0x16a182['id'];}else{var _0x20f25c=_[_0xea76('0x7f')](_[_0xea76('0x30')](_0x5576c7,_0xea76('0x80')),function(_0x27bb47){return _[_0xea76('0x81')](_0x53f36b,_0x27bb47);});if(_0x20f25c){return _0x16a182['id'];}}}));}}return BPromise[_0xea76('0x82')](_0x1ce028)[_0xea76('0x27')](function(_0x23a363){_0x31fbfd=_(_0x31fbfd)['union'](_0x23a363)['compact']()[_0xea76('0x83')]();return db[_0xea76('0x44')][_0xea76('0x4a')]({'where':{'id':_0x4a7b2f['params']['id']}})[_0xea76('0x27')](function(_0x1e887d){return db[_0xea76('0x6c')]['transaction'](function(_0x2cdeae){return _0x1e887d[_0xea76('0x71')](_0x4a7b2f[_0xea76('0x35')]['ids'],{'transaction':_0x2cdeae})[_0xea76('0x27')](function(){if(!_['isEmpty'](_0x31fbfd)){return _0x1e887d['removeAgents'](_0x31fbfd,{'transaction':_0x2cdeae});}})[_0xea76('0x27')](function(){_0x31fbfd[_0xea76('0x6f')](function(_0x300a6c){socket['emit'](_0xea76('0x84'),{'UserId':_0x300a6c,'SmsQueueId':_0x1e887d['id']});});});});});});})[_0xea76('0x27')](respondWithStatusCode(_0xb1ca6,null))['catch'](handleError(_0xb1ca6,null));};exports[_0xea76('0x85')]=function(_0x3207cb,_0x11c865,_0xa92ba0){return db[_0xea76('0x44')]['find']({'where':{'id':_0x3207cb[_0xea76('0x53')]['id']}})['then'](handleEntityNotFound(_0x11c865,null))[_0xea76('0x27')](function(_0xdb8e24){if(_0xdb8e24){return _0xdb8e24['addAgents'](_0x3207cb[_0xea76('0x4d')]['ids'],_[_0xea76('0x86')](_0x3207cb[_0xea76('0x4d')],[_0xea76('0x66'),'id'])||{})[_0xea76('0x87')](function(_0xee6ce2){for(var _0x1e0393=0x0;_0x1e0393<_0x3207cb[_0xea76('0x4d')][_0xea76('0x66')][_0xea76('0x3a')];_0x1e0393+=0x1){socket[_0xea76('0x88')](_0xea76('0x70'),{'UserId':Number(_0x3207cb['body']['ids'][_0x1e0393]),'SmsQueueId':Number(_0x3207cb[_0xea76('0x53')]['id'])});}return _0xee6ce2;});}})[_0xea76('0x27')](respondWithResult(_0x11c865,null))[_0xea76('0x4b')](handleError(_0x11c865,null));};exports[_0xea76('0x89')]=function(_0x4b96d3,_0x35e415,_0x447f24){return db[_0xea76('0x44')][_0xea76('0x4a')]({'where':{'id':_0x4b96d3[_0xea76('0x53')]['id']}})['then'](handleEntityNotFound(_0x35e415,null))[_0xea76('0x27')](function(_0x87df58){if(_0x87df58){return _0x87df58[_0xea76('0x89')](_0x4b96d3[_0xea76('0x35')][_0xea76('0x66')])[_0xea76('0x27')](function(){if(_[_0xea76('0x8a')](_0x4b96d3[_0xea76('0x35')][_0xea76('0x66')])){for(var _0x5b0d05=0x0;_0x5b0d05<_0x4b96d3[_0xea76('0x35')][_0xea76('0x66')][_0xea76('0x3a')];_0x5b0d05+=0x1){socket[_0xea76('0x88')](_0xea76('0x84'),{'UserId':Number(_0x4b96d3['query']['ids'][_0x5b0d05]),'SmsQueueId':Number(_0x4b96d3['params']['id'])});}}else{socket[_0xea76('0x88')](_0xea76('0x84'),{'UserId':Number(_0x4b96d3[_0xea76('0x35')][_0xea76('0x66')]),'SmsQueueId':Number(_0x4b96d3[_0xea76('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x35e415,null))[_0xea76('0x4b')](handleError(_0x35e415,null));};exports[_0xea76('0x8b')]=function(_0x5da5ed,_0x4d1e71,_0x757b18){var _0x548db5={};var _0x536f50={};var _0x42e6fd;var _0x400bbd;return db['SmsQueue']['findOne']({'where':{'id':_0x5da5ed['params']['id']}})[_0xea76('0x27')](handleEntityNotFound(_0x4d1e71,null))[_0xea76('0x27')](function(_0x3b3635){if(_0x3b3635){_0x42e6fd=_0x3b3635;_0x536f50[_0xea76('0x34')]=_[_0xea76('0x48')](db[_0xea76('0x5a')][_0xea76('0x31')]);_0x536f50[_0xea76('0x35')]=_[_0xea76('0x48')](_0x5da5ed[_0xea76('0x35')]);_0x536f50[_0xea76('0x36')]=_[_0xea76('0x37')](_0x536f50[_0xea76('0x34')],_0x536f50[_0xea76('0x35')]);_0x548db5[_0xea76('0x38')]=_['intersection'](_0x536f50[_0xea76('0x34')],qs[_0xea76('0x39')](_0x5da5ed[_0xea76('0x35')][_0xea76('0x39')]));_0x548db5[_0xea76('0x38')]=_0x548db5['attributes']['length']?_0x548db5[_0xea76('0x38')]:_0x536f50[_0xea76('0x34')];_0x548db5[_0xea76('0x3d')]=qs[_0xea76('0x3e')](_0x5da5ed[_0xea76('0x35')][_0xea76('0x3e')]);_0x548db5[_0xea76('0x3f')]=qs[_0xea76('0x36')](_['pick'](_0x5da5ed[_0xea76('0x35')],_0x536f50['filters']));if(_0x5da5ed[_0xea76('0x35')][_0xea76('0x41')]){_0x548db5['where']=_[_0xea76('0x42')](_0x548db5[_0xea76('0x3f')],{'$or':_['map'](_0x548db5[_0xea76('0x38')],function(_0x20974d){var _0x3ac855={};_0x3ac855[_0x20974d]={'$like':'%'+_0x5da5ed[_0xea76('0x35')]['filter']+'%'};return _0x3ac855;})});}_0x548db5=_[_0xea76('0x42')]({},_0x548db5,_0x5da5ed['options']);return _0x42e6fd[_0xea76('0x8b')](_0x548db5);}})['then'](function(_0x50b810){if(_0x50b810){_0x400bbd=_0x50b810[_0xea76('0x3a')];if(!_0x5da5ed[_0xea76('0x35')]['hasOwnProperty']('nolimit')){_0x548db5[_0xea76('0x1f')]=qs[_0xea76('0x1f')](_0x5da5ed[_0xea76('0x35')]['limit']);_0x548db5[_0xea76('0x21')]=qs[_0xea76('0x21')](_0x5da5ed[_0xea76('0x35')][_0xea76('0x21')]);}return _0x42e6fd[_0xea76('0x8b')](_0x548db5);}})[_0xea76('0x27')](function(_0x27b88f){if(_0x27b88f){return _0x27b88f?{'count':_0x400bbd,'rows':_0x27b88f}:null;}})[_0xea76('0x27')](respondWithResult(_0x4d1e71,null))[_0xea76('0x4b')](handleError(_0x4d1e71,null));}; \ No newline at end of file +var _0x079b=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','User','UserId','agent','updatedAt','rows','format','%s/%s','SIP','smsPause','createdAt','getTeams','addTeams','ids','Team','findAll','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','all','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','sendStatus','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x406392,_0x28c3c5){var _0x2d86dd=function(_0x14a63e){while(--_0x14a63e){_0x406392['push'](_0x406392['shift']());}};_0x2d86dd(++_0x28c3c5);}(_0x079b,0x165));var _0xb079=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0x079b[_0x78db5e];return _0x250b88;};'use strict';var emlformat=require(_0xb079('0x0'));var rimraf=require(_0xb079('0x1'));var zipdir=require(_0xb079('0x2'));var jsonpatch=require(_0xb079('0x3'));var rp=require(_0xb079('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb079('0x5'));var util=require(_0xb079('0x6'));var path=require('path');var sox=require(_0xb079('0x7'));var csv=require(_0xb079('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb079('0x9'));var _=require(_0xb079('0xa'));var squel=require(_0xb079('0xb'));var crypto=require(_0xb079('0xc'));var jsforce=require(_0xb079('0xd'));var deskjs=require(_0xb079('0xe'));var toCsv=require(_0xb079('0x8'));var querystring=require(_0xb079('0xf'));var Papa=require(_0xb079('0x10'));var Redis=require('ioredis');var authService=require(_0xb079('0x11'));var qs=require(_0xb079('0x12'));var as=require(_0xb079('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb079('0x14'))(_0xb079('0x15'));var utils=require(_0xb079('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb079('0x17'));var db=require('../../mysqldb')['db'];config[_0xb079('0x18')]=_[_0xb079('0x19')](config['redis'],{'host':_0xb079('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb079('0x18')]));require('./smsQueue.socket')[_0xb079('0x1b')](socket);function respondWithStatusCode(_0x3428a4,_0x117ec5){_0x117ec5=_0x117ec5||0xcc;return function(_0x2b7d6f){if(_0x2b7d6f){return _0x3428a4['sendStatus'](_0x117ec5);}return _0x3428a4[_0xb079('0x1c')](_0x117ec5)[_0xb079('0x1d')]();};}function respondWithResult(_0x1a14e0,_0x5d9c39){_0x5d9c39=_0x5d9c39||0xc8;return function(_0x54cf7d){if(_0x54cf7d){return _0x1a14e0['status'](_0x5d9c39)[_0xb079('0x1e')](_0x54cf7d);}};}function respondWithFilteredResult(_0x13dd18,_0x30ac86){return function(_0x2406db){if(_0x2406db){var _0x582096=typeof _0x30ac86[_0xb079('0x1f')]===_0xb079('0x20')&&typeof _0x30ac86[_0xb079('0x21')]===_0xb079('0x20');var _0x6acb0=_0x2406db[_0xb079('0x22')];var _0x4e5310=_0x582096?0x0:_0x30ac86[_0xb079('0x1f')];var _0x9a535b=_0x582096?_0x2406db['count']:_0x30ac86[_0xb079('0x1f')]+_0x30ac86['limit'];var _0x6b7eb4;if(_0x9a535b>=_0x6acb0){_0x9a535b=_0x6acb0;_0x6b7eb4=0xc8;}else{_0x6b7eb4=0xce;}_0x13dd18[_0xb079('0x1c')](_0x6b7eb4);return _0x13dd18[_0xb079('0x23')](_0xb079('0x24'),_0x4e5310+'-'+_0x9a535b+'/'+_0x6acb0)[_0xb079('0x1e')](_0x2406db);}return null;};}function patchUpdates(_0x3d93ac){return function(_0xfe9698){try{jsonpatch[_0xb079('0x25')](_0xfe9698,_0x3d93ac,!![]);}catch(_0x3a8ad7){return BPromise[_0xb079('0x26')](_0x3a8ad7);}return _0xfe9698[_0xb079('0x27')]();};}function saveUpdates(_0x465625,_0x1e5b95){return function(_0x136b22){if(_0x136b22){return _0x136b22[_0xb079('0x28')](_0x465625)[_0xb079('0x29')](function(_0x27f1a3){return _0x27f1a3;});}return null;};}function removeEntity(_0x233ac2,_0x55b341){return function(_0x13f0cf){if(_0x13f0cf){return _0x13f0cf[_0xb079('0x2a')]()['then'](function(){var _0x43eae2=_0x13f0cf['get']({'plain':!![]});var _0x4d627c=_0xb079('0x2b');return db[_0xb079('0x2c')][_0xb079('0x2a')]({'where':{'type':_0x4d627c,'resourceId':_0x43eae2['id']}})[_0xb079('0x29')](function(){return _0x13f0cf;});})[_0xb079('0x29')](function(){_0x233ac2['status'](0xcc)[_0xb079('0x1d')]();});}};}function handleEntityNotFound(_0x4d6e83,_0x177fb6){return function(_0x3da700){if(!_0x3da700){_0x4d6e83[_0xb079('0x2d')](0x194);}return _0x3da700;};}function handleError(_0x471ed3,_0x591575){_0x591575=_0x591575||0x1f4;return function(_0x2070f3){logger['error'](_0x2070f3[_0xb079('0x2e')]);if(_0x2070f3[_0xb079('0x2f')]){delete _0x2070f3[_0xb079('0x2f')];}_0x471ed3[_0xb079('0x1c')](_0x591575)[_0xb079('0x30')](_0x2070f3);};}exports[_0xb079('0x31')]=function(_0x12207b,_0x2e9b01){var _0x5038ca={},_0x5e853c={},_0x1a0fb1={'count':0x0,'rows':[]};var _0x311014=_[_0xb079('0x32')](db[_0xb079('0x33')][_0xb079('0x34')],function(_0x4967cd){return{'name':_0x4967cd['fieldName'],'type':_0x4967cd[_0xb079('0x35')][_0xb079('0x36')]};});_0x5e853c['model']=_[_0xb079('0x32')](_0x311014,_0xb079('0x2f'));_0x5e853c['query']=_['keys'](_0x12207b[_0xb079('0x37')]);_0x5e853c[_0xb079('0x38')]=_[_0xb079('0x39')](_0x5e853c[_0xb079('0x3a')],_0x5e853c['query']);_0x5038ca[_0xb079('0x3b')]=_[_0xb079('0x39')](_0x5e853c[_0xb079('0x3a')],qs[_0xb079('0x3c')](_0x12207b[_0xb079('0x37')]['fields']));_0x5038ca['attributes']=_0x5038ca[_0xb079('0x3b')][_0xb079('0x3d')]?_0x5038ca[_0xb079('0x3b')]:_0x5e853c[_0xb079('0x3a')];if(!_0x12207b[_0xb079('0x37')][_0xb079('0x3e')](_0xb079('0x3f'))){_0x5038ca[_0xb079('0x21')]=qs[_0xb079('0x21')](_0x12207b[_0xb079('0x37')]['limit']);_0x5038ca[_0xb079('0x1f')]=qs[_0xb079('0x1f')](_0x12207b[_0xb079('0x37')][_0xb079('0x1f')]);}_0x5038ca[_0xb079('0x40')]=qs[_0xb079('0x41')](_0x12207b[_0xb079('0x37')][_0xb079('0x41')]);_0x5038ca[_0xb079('0x42')]=qs[_0xb079('0x38')](_[_0xb079('0x43')](_0x12207b[_0xb079('0x37')],_0x5e853c[_0xb079('0x38')]),_0x311014);if(_0x12207b[_0xb079('0x37')][_0xb079('0x44')]){_0x5038ca[_0xb079('0x42')]=_[_0xb079('0x45')](_0x5038ca[_0xb079('0x42')],{'$or':_[_0xb079('0x32')](_0x311014,function(_0x447365){if(_0x447365[_0xb079('0x35')]!==_0xb079('0x46')){var _0x314233={};_0x314233[_0x447365[_0xb079('0x2f')]]={'$like':'%'+_0x12207b[_0xb079('0x37')][_0xb079('0x44')]+'%'};return _0x314233;}})});}_0x5038ca=_[_0xb079('0x45')]({},_0x5038ca,_0x12207b[_0xb079('0x47')]);var _0x1a025b={'where':_0x5038ca['where']};return db['SmsQueue'][_0xb079('0x22')](_0x1a025b)[_0xb079('0x29')](function(_0x5d8ad9){_0x1a0fb1[_0xb079('0x22')]=_0x5d8ad9;if(_0x12207b[_0xb079('0x37')]['includeAll']){_0x5038ca[_0xb079('0x48')]=[{'all':!![]}];}return db[_0xb079('0x33')]['findAll'](_0x5038ca);})['then'](function(_0x35cfef){_0x1a0fb1['rows']=_0x35cfef;return _0x1a0fb1;})[_0xb079('0x29')](respondWithFilteredResult(_0x2e9b01,_0x5038ca))[_0xb079('0x49')](handleError(_0x2e9b01,null));};exports[_0xb079('0x4a')]=function(_0x3dad3c,_0x5ba043){var _0x470166={'raw':!![],'where':{'id':_0x3dad3c[_0xb079('0x4b')]['id']}},_0x17ff06={};_0x17ff06[_0xb079('0x3a')]=_[_0xb079('0x4c')](db['SmsQueue'][_0xb079('0x34')]);_0x17ff06[_0xb079('0x37')]=_['keys'](_0x3dad3c[_0xb079('0x37')]);_0x17ff06[_0xb079('0x38')]=_['intersection'](_0x17ff06[_0xb079('0x3a')],_0x17ff06[_0xb079('0x37')]);_0x470166[_0xb079('0x3b')]=_['intersection'](_0x17ff06[_0xb079('0x3a')],qs['fields'](_0x3dad3c[_0xb079('0x37')]['fields']));_0x470166[_0xb079('0x3b')]=_0x470166[_0xb079('0x3b')]['length']?_0x470166[_0xb079('0x3b')]:_0x17ff06[_0xb079('0x3a')];if(_0x3dad3c['query'][_0xb079('0x4d')]){_0x470166['include']=[{'all':!![]}];}_0x470166=_[_0xb079('0x45')]({},_0x470166,_0x3dad3c['options']);return db['SmsQueue']['find'](_0x470166)[_0xb079('0x29')](handleEntityNotFound(_0x5ba043,null))[_0xb079('0x29')](respondWithResult(_0x5ba043,null))[_0xb079('0x49')](handleError(_0x5ba043,null));};exports[_0xb079('0x4e')]=function(_0x2b6d80,_0x1fa3e3){return db['SmsQueue'][_0xb079('0x4e')](_0x2b6d80[_0xb079('0x4f')],{})[_0xb079('0x29')](function(_0x1ad445){var _0x216c17=_0x2b6d80[_0xb079('0x50')][_0xb079('0x51')]({'plain':!![]});if(!_0x216c17)throw new Error(_0xb079('0x52'));if(_0x216c17[_0xb079('0x53')]==='user'){var _0x8d2ba2=_0x1ad445[_0xb079('0x51')]({'plain':!![]});var _0x2fbed6=_0xb079('0x2b');return db['UserProfileSection'][_0xb079('0x54')]({'where':{'name':_0x2fbed6,'userProfileId':_0x216c17[_0xb079('0x55')]},'raw':!![]})[_0xb079('0x29')](function(_0x38ff5c){if(_0x38ff5c&&_0x38ff5c['autoAssociation']===0x0){return db[_0xb079('0x2c')][_0xb079('0x4e')]({'name':_0x8d2ba2[_0xb079('0x2f')],'resourceId':_0x8d2ba2['id'],'type':_0x38ff5c[_0xb079('0x2f')],'sectionId':_0x38ff5c['id']},{})[_0xb079('0x29')](function(){return _0x1ad445;});}else{return _0x1ad445;}})[_0xb079('0x49')](function(_0x37cce4){logger[_0xb079('0x56')](_0xb079('0x57'),_0x37cce4);throw _0x37cce4;});}return _0x1ad445;})['then'](respondWithResult(_0x1fa3e3,0xc9))[_0xb079('0x49')](handleError(_0x1fa3e3,null));};exports[_0xb079('0x28')]=function(_0x3c48d3,_0x55decc){if(_0x3c48d3[_0xb079('0x4f')]['id']){delete _0x3c48d3[_0xb079('0x4f')]['id'];}return db[_0xb079('0x33')]['find']({'where':{'id':_0x3c48d3['params']['id']}})[_0xb079('0x29')](handleEntityNotFound(_0x55decc,null))[_0xb079('0x29')](saveUpdates(_0x3c48d3[_0xb079('0x4f')],null))[_0xb079('0x29')](respondWithResult(_0x55decc,null))[_0xb079('0x49')](handleError(_0x55decc,null));};exports[_0xb079('0x2a')]=function(_0x423e58,_0x412a31){return db['SmsQueue'][_0xb079('0x54')]({'where':{'id':_0x423e58[_0xb079('0x4b')]['id']}})[_0xb079('0x29')](handleEntityNotFound(_0x412a31,null))[_0xb079('0x29')](removeEntity(_0x412a31,null))[_0xb079('0x49')](handleError(_0x412a31,null));};exports[_0xb079('0x58')]=function(_0x2b3bed,_0x396eef){return db['SmsQueue'][_0xb079('0x58')]()[_0xb079('0x29')](respondWithResult(_0x396eef,null))[_0xb079('0x49')](handleError(_0x396eef,null));};exports[_0xb079('0x59')]=function(_0x26fd76,_0x472201,_0x3e4887){var _0x411814={'raw':!![],'where':{}},_0x5eb434={},_0x8487ab;return db[_0xb079('0x33')]['findOne']({'where':{'id':_0x26fd76[_0xb079('0x4b')]['id']}})[_0xb079('0x29')](handleEntityNotFound(_0x472201,null))['then'](function(_0x23f7b0){if(_0x23f7b0){_0x8487ab=_0x23f7b0['get']({'plain':!![]});_0x5eb434[_0xb079('0x3a')]=_['keys'](db[_0xb079('0x5a')][_0xb079('0x34')]);_0x5eb434[_0xb079('0x37')]=_[_0xb079('0x4c')](_0x26fd76[_0xb079('0x37')]);_0x5eb434[_0xb079('0x38')]=_[_0xb079('0x39')](_0x5eb434[_0xb079('0x3a')],_0x5eb434[_0xb079('0x37')]);_0x411814[_0xb079('0x3b')]=_['intersection'](_0x5eb434[_0xb079('0x3a')],qs[_0xb079('0x3c')](_0x26fd76[_0xb079('0x37')][_0xb079('0x3c')]));_0x411814['attributes']=_0x411814[_0xb079('0x3b')][_0xb079('0x3d')]?_0x411814[_0xb079('0x3b')]:_0x5eb434[_0xb079('0x3a')];if(!_0x26fd76['query'][_0xb079('0x3e')](_0xb079('0x3f'))){_0x411814[_0xb079('0x21')]=qs['limit'](_0x26fd76['query'][_0xb079('0x21')]);_0x411814[_0xb079('0x1f')]=qs[_0xb079('0x1f')](_0x26fd76[_0xb079('0x37')][_0xb079('0x1f')]);}_0x411814[_0xb079('0x40')]=qs[_0xb079('0x41')](_0x26fd76[_0xb079('0x37')][_0xb079('0x41')]);_0x411814['where']=qs[_0xb079('0x38')](_[_0xb079('0x43')](_0x26fd76[_0xb079('0x37')],_0x5eb434[_0xb079('0x38')]));_0x411814['where']['SmsQueueId']=_0x23f7b0['id'];if(_0x26fd76[_0xb079('0x37')][_0xb079('0x44')]){_0x411814[_0xb079('0x42')]=_[_0xb079('0x45')](_0x411814[_0xb079('0x42')],{'$or':_[_0xb079('0x32')](_0x411814[_0xb079('0x3b')],function(_0x4a5b44){var _0x4aea1b={};_0x4aea1b[_0x4a5b44]={'$like':'%'+_0x26fd76[_0xb079('0x37')][_0xb079('0x44')]+'%'};return _0x4aea1b;})});}_0x411814=_['merge']({},_0x411814,_0x26fd76[_0xb079('0x47')]);return db[_0xb079('0x5a')]['findAll'](_0x411814);}})[_0xb079('0x29')](function(_0x5245e3){if(_0x5245e3){return db[_0xb079('0x5b')]['findAndCountAll']({'where':{'id':_[_0xb079('0x32')](_0x5245e3,_0xb079('0x5c')),'role':_0xb079('0x5d')},'attributes':['id',_0xb079('0x2f'),'smsPause',_0xb079('0x5e'),'createdAt']});}})[_0xb079('0x29')](function(_0x1a11dd){if(_0x1a11dd){return{'count':_0x1a11dd[_0xb079('0x22')],'rows':_['map'](_0x1a11dd[_0xb079('0x5f')],function(_0x31417b){return{'membername':_0x31417b[_0xb079('0x2f')],'UserId':_0x31417b['id'],'queue_name':_0x8487ab[_0xb079('0x2f')],'SmsQueueId':_0x8487ab['id'],'interface':util[_0xb079('0x60')](_0xb079('0x61'),_0xb079('0x62'),_0x31417b[_0xb079('0x2f')]),'penalty':0x0,'paused':_0x31417b[_0xb079('0x63')],'createdAt':_0x31417b[_0xb079('0x64')],'updatedAt':_0x31417b[_0xb079('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x472201,_0x411814))[_0xb079('0x49')](handleError(_0x472201,null));};exports[_0xb079('0x65')]=function(_0x6f8fc4,_0x56c9f7,_0x4ce48e){var _0x3e441d={};var _0x5a0e0e={};var _0x124e9e;var _0xc29da;return db['SmsQueue']['findOne']({'where':{'id':_0x6f8fc4[_0xb079('0x4b')]['id']}})['then'](handleEntityNotFound(_0x56c9f7,null))[_0xb079('0x29')](function(_0x487e70){if(_0x487e70){_0x124e9e=_0x487e70;_0x5a0e0e[_0xb079('0x3a')]=_[_0xb079('0x4c')](db['Team'][_0xb079('0x34')]);_0x5a0e0e[_0xb079('0x37')]=_[_0xb079('0x4c')](_0x6f8fc4[_0xb079('0x37')]);_0x5a0e0e[_0xb079('0x38')]=_[_0xb079('0x39')](_0x5a0e0e[_0xb079('0x3a')],_0x5a0e0e[_0xb079('0x37')]);_0x3e441d[_0xb079('0x3b')]=_[_0xb079('0x39')](_0x5a0e0e[_0xb079('0x3a')],qs[_0xb079('0x3c')](_0x6f8fc4[_0xb079('0x37')]['fields']));_0x3e441d[_0xb079('0x3b')]=_0x3e441d[_0xb079('0x3b')][_0xb079('0x3d')]?_0x3e441d[_0xb079('0x3b')]:_0x5a0e0e[_0xb079('0x3a')];_0x3e441d['order']=qs['sort'](_0x6f8fc4[_0xb079('0x37')]['sort']);_0x3e441d[_0xb079('0x42')]=qs['filters'](_[_0xb079('0x43')](_0x6f8fc4[_0xb079('0x37')],_0x5a0e0e[_0xb079('0x38')]));if(_0x6f8fc4['query'][_0xb079('0x44')]){_0x3e441d[_0xb079('0x42')]=_[_0xb079('0x45')](_0x3e441d[_0xb079('0x42')],{'$or':_[_0xb079('0x32')](_0x3e441d[_0xb079('0x3b')],function(_0x3b6d87){var _0x3f4d81={};_0x3f4d81[_0x3b6d87]={'$like':'%'+_0x6f8fc4[_0xb079('0x37')]['filter']+'%'};return _0x3f4d81;})});}_0x3e441d=_['merge']({},_0x3e441d,_0x6f8fc4[_0xb079('0x47')]);return _0x124e9e[_0xb079('0x65')](_0x3e441d);}})['then'](function(_0x2f11c8){if(_0x2f11c8){_0xc29da=_0x2f11c8[_0xb079('0x3d')];if(!_0x6f8fc4[_0xb079('0x37')]['hasOwnProperty'](_0xb079('0x3f'))){_0x3e441d['limit']=qs['limit'](_0x6f8fc4[_0xb079('0x37')][_0xb079('0x21')]);_0x3e441d[_0xb079('0x1f')]=qs[_0xb079('0x1f')](_0x6f8fc4['query']['offset']);}return _0x124e9e['getTeams'](_0x3e441d);}})[_0xb079('0x29')](function(_0x38b37c){if(_0x38b37c){return _0x38b37c?{'count':_0xc29da,'rows':_0x38b37c}:null;}})[_0xb079('0x29')](respondWithResult(_0x56c9f7,null))[_0xb079('0x49')](handleError(_0x56c9f7,null));};exports[_0xb079('0x66')]=function(_0x27fca1,_0x20cc47,_0x4a5a59){var _0x2a63c4=_0x27fca1[_0xb079('0x4f')][_0xb079('0x67')];return db[_0xb079('0x68')][_0xb079('0x69')]({'where':{'id':_0x2a63c4},'attributes':['id'],'include':[{'model':db[_0xb079('0x5b')],'as':'Agents','attributes':['id','name',_0xb079('0x6a'),_0xb079('0x6b'),_0xb079('0x6c')],'raw':!![]}]})[_0xb079('0x29')](function(_0x36a8d3){if(_0x36a8d3){var _0x284082=_[_0xb079('0x6d')](_0x36a8d3,function(_0x26a70d){var _0x562cff=_0x26a70d[_0xb079('0x51')]({'plain':!![]});return _0x562cff[_0xb079('0x6e')];});return db[_0xb079('0x33')]['find']({'where':{'id':_0x27fca1[_0xb079('0x4b')]['id']}})[_0xb079('0x29')](function(_0x4eddf0){return db[_0xb079('0x6f')]['transaction'](function(_0x3f5c8a){return _0x4eddf0[_0xb079('0x66')](_0x2a63c4,{'transaction':_0x3f5c8a})[_0xb079('0x29')](function(){return BPromise[_0xb079('0x70')](_0x284082,function(_0x30a715){return db[_0xb079('0x5a')][_0xb079('0x71')]({'where':{'UserId':_0x30a715['id'],'SmsQueueId':_0x27fca1['params']['id']},'transaction':_0x3f5c8a});});})['then'](function(){_0x284082[_0xb079('0x72')](function(_0x2969b2){socket[_0xb079('0x73')](_0xb079('0x74'),{'UserId':_0x2969b2['id'],'SmsQueueId':_0x4eddf0['id']});});});});});}})[_0xb079('0x29')](respondWithStatusCode(_0x20cc47,null))[_0xb079('0x49')](handleError(_0x20cc47,null));};exports[_0xb079('0x75')]=function(_0x5a18f3,_0x699410,_0xd3211e){return db[_0xb079('0x68')][_0xb079('0x69')]({'where':{'id':_0x5a18f3[_0xb079('0x37')][_0xb079('0x67')]},'attributes':['id'],'include':[{'model':db[_0xb079('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb079('0x29')](handleEntityNotFound(_0x699410,null))['then'](function(_0x5555ad){var _0x33bae9=_[_0xb079('0x32')](_0x5555ad,'id');var _0x2d1c15=[];var _0x2ff5b2=[];var _0x5ccc49=squel['select']();_0x5ccc49[_0xb079('0x76')](_0xb079('0x77'))[_0xb079('0x78')]('team_has_sms_queues','tq')[_0xb079('0x79')](_0xb079('0x7a'),'ut',_0xb079('0x7b'))[_0xb079('0x42')](_0xb079('0x7c'),_0x5a18f3['params']['id']);for(var _0x3ad247=0x0;_0x3ad247<_0x5555ad[_0xb079('0x3d')];_0x3ad247+=0x1){let _0x34b24e=_0x5555ad[_0x3ad247];for(var _0x383910=0x0;_0x383910<_0x34b24e[_0xb079('0x6e')][_0xb079('0x3d')];_0x383910+=0x1){let _0x1460b8=_0x34b24e[_0xb079('0x6e')][_0x383910];var _0x434eed=_0x5ccc49[_0xb079('0x7d')]();_0x434eed[_0xb079('0x42')]('ut.UserId\x20=\x20?',_0x1460b8['id']);_0x2ff5b2[_0xb079('0x7e')](db[_0xb079('0x6f')][_0xb079('0x37')](_0x434eed['toString'](),{'type':db[_0xb079('0x6f')][_0xb079('0x7f')]['SELECT']})[_0xb079('0x29')](function(_0x4ac3f5){if(_0x4ac3f5[_0xb079('0x3d')]===0x1){return _0x1460b8['id'];}else{var _0x289647=_[_0xb079('0x80')](_[_0xb079('0x32')](_0x4ac3f5,_0xb079('0x81')),function(_0x300a7a){return _['includes'](_0x33bae9,_0x300a7a);});if(_0x289647){return _0x1460b8['id'];}}}));}}return BPromise[_0xb079('0x82')](_0x2ff5b2)[_0xb079('0x29')](function(_0x23a875){_0x2d1c15=_(_0x2d1c15)['union'](_0x23a875)['compact']()['value']();return db[_0xb079('0x33')][_0xb079('0x54')]({'where':{'id':_0x5a18f3['params']['id']}})[_0xb079('0x29')](function(_0x1a49b0){return db[_0xb079('0x6f')][_0xb079('0x83')](function(_0x3e595b){return _0x1a49b0['removeTeams'](_0x5a18f3[_0xb079('0x37')][_0xb079('0x67')],{'transaction':_0x3e595b})[_0xb079('0x29')](function(){if(!_[_0xb079('0x84')](_0x2d1c15)){return _0x1a49b0[_0xb079('0x85')](_0x2d1c15,{'transaction':_0x3e595b});}})['then'](function(){_0x2d1c15[_0xb079('0x72')](function(_0x3dacbe){socket['emit'](_0xb079('0x86'),{'UserId':_0x3dacbe,'SmsQueueId':_0x1a49b0['id']});});});});});});})[_0xb079('0x29')](respondWithStatusCode(_0x699410,null))[_0xb079('0x49')](handleError(_0x699410,null));};exports[_0xb079('0x87')]=function(_0x42c57f,_0x19b99a,_0x353dcf){return db[_0xb079('0x33')][_0xb079('0x54')]({'where':{'id':_0x42c57f[_0xb079('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19b99a,null))[_0xb079('0x29')](function(_0x43de9a){if(_0x43de9a){return _0x43de9a[_0xb079('0x87')](_0x42c57f[_0xb079('0x4f')]['ids'],_['omit'](_0x42c57f[_0xb079('0x4f')],[_0xb079('0x67'),'id'])||{})[_0xb079('0x88')](function(_0x1e4961){for(var _0x3040eb=0x0;_0x3040eb<_0x42c57f[_0xb079('0x4f')]['ids'][_0xb079('0x3d')];_0x3040eb+=0x1){socket[_0xb079('0x73')]('userSmsQueue:save',{'UserId':Number(_0x42c57f[_0xb079('0x4f')]['ids'][_0x3040eb]),'SmsQueueId':Number(_0x42c57f[_0xb079('0x4b')]['id'])});}return _0x1e4961;});}})[_0xb079('0x29')](respondWithResult(_0x19b99a,null))[_0xb079('0x49')](handleError(_0x19b99a,null));};exports[_0xb079('0x85')]=function(_0x198edf,_0x324023,_0x57d247){return db[_0xb079('0x33')][_0xb079('0x54')]({'where':{'id':_0x198edf['params']['id']}})[_0xb079('0x29')](handleEntityNotFound(_0x324023,null))[_0xb079('0x29')](function(_0x44deed){if(_0x44deed){return _0x44deed[_0xb079('0x85')](_0x198edf[_0xb079('0x37')][_0xb079('0x67')])[_0xb079('0x29')](function(){if(_[_0xb079('0x89')](_0x198edf[_0xb079('0x37')]['ids'])){for(var _0x34e809=0x0;_0x34e809<_0x198edf[_0xb079('0x37')][_0xb079('0x67')][_0xb079('0x3d')];_0x34e809+=0x1){socket[_0xb079('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x198edf['query']['ids'][_0x34e809]),'SmsQueueId':Number(_0x198edf[_0xb079('0x4b')]['id'])});}}else{socket[_0xb079('0x73')](_0xb079('0x86'),{'UserId':Number(_0x198edf[_0xb079('0x37')][_0xb079('0x67')]),'SmsQueueId':Number(_0x198edf[_0xb079('0x4b')]['id'])});}});}})[_0xb079('0x29')](respondWithStatusCode(_0x324023,null))['catch'](handleError(_0x324023,null));};exports[_0xb079('0x8a')]=function(_0x2875cf,_0x18233c,_0x59a0ff){var _0x1e7d4e={};var _0x25f708={};var _0x4ccf62;var _0x8995a6;return db[_0xb079('0x33')][_0xb079('0x8b')]({'where':{'id':_0x2875cf[_0xb079('0x4b')]['id']}})[_0xb079('0x29')](handleEntityNotFound(_0x18233c,null))[_0xb079('0x29')](function(_0x19c66d){if(_0x19c66d){_0x4ccf62=_0x19c66d;_0x25f708[_0xb079('0x3a')]=_[_0xb079('0x4c')](db[_0xb079('0x5b')][_0xb079('0x34')]);_0x25f708[_0xb079('0x37')]=_[_0xb079('0x4c')](_0x2875cf[_0xb079('0x37')]);_0x25f708[_0xb079('0x38')]=_['intersection'](_0x25f708[_0xb079('0x3a')],_0x25f708[_0xb079('0x37')]);_0x1e7d4e['attributes']=_[_0xb079('0x39')](_0x25f708[_0xb079('0x3a')],qs['fields'](_0x2875cf[_0xb079('0x37')]['fields']));_0x1e7d4e[_0xb079('0x3b')]=_0x1e7d4e['attributes'][_0xb079('0x3d')]?_0x1e7d4e[_0xb079('0x3b')]:_0x25f708['model'];_0x1e7d4e['order']=qs[_0xb079('0x41')](_0x2875cf[_0xb079('0x37')]['sort']);_0x1e7d4e['where']=qs[_0xb079('0x38')](_[_0xb079('0x43')](_0x2875cf['query'],_0x25f708[_0xb079('0x38')]));if(_0x2875cf['query'][_0xb079('0x44')]){_0x1e7d4e[_0xb079('0x42')]=_['merge'](_0x1e7d4e['where'],{'$or':_[_0xb079('0x32')](_0x1e7d4e[_0xb079('0x3b')],function(_0x316255){var _0x38cc4f={};_0x38cc4f[_0x316255]={'$like':'%'+_0x2875cf[_0xb079('0x37')][_0xb079('0x44')]+'%'};return _0x38cc4f;})});}_0x1e7d4e=_['merge']({},_0x1e7d4e,_0x2875cf[_0xb079('0x47')]);return _0x4ccf62['getAgents'](_0x1e7d4e);}})[_0xb079('0x29')](function(_0x4376e4){if(_0x4376e4){_0x8995a6=_0x4376e4[_0xb079('0x3d')];if(!_0x2875cf['query'][_0xb079('0x3e')](_0xb079('0x3f'))){_0x1e7d4e['limit']=qs['limit'](_0x2875cf[_0xb079('0x37')][_0xb079('0x21')]);_0x1e7d4e[_0xb079('0x1f')]=qs['offset'](_0x2875cf[_0xb079('0x37')]['offset']);}return _0x4ccf62[_0xb079('0x8a')](_0x1e7d4e);}})[_0xb079('0x29')](function(_0xdb1f15){if(_0xdb1f15){return _0xdb1f15?{'count':_0x8995a6,'rows':_0xdb1f15}:null;}})[_0xb079('0x29')](respondWithResult(_0x18233c,null))['catch'](handleError(_0x18233c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ac2069c..1882764 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 _0x2107=['update','remove','emit','events','../../mysqldb','SmsQueue','save'];(function(_0x1664fe,_0x31bd8c){var _0x36dd20=function(_0x55a98a){while(--_0x55a98a){_0x1664fe['push'](_0x1664fe['shift']());}};_0x36dd20(++_0x31bd8c);}(_0x2107,0xa4));var _0x7210=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x2107[_0x1ccbcc];return _0x1e873f;};'use strict';var EventEmitter=require(_0x7210('0x0'));var SmsQueue=require(_0x7210('0x1'))['db'][_0x7210('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7210('0x3'),'afterUpdate':_0x7210('0x4'),'afterDestroy':_0x7210('0x5')};function emitEvent(_0x3b85f7){return function(_0x51797f,_0x2a2696,_0x39ea3c){SmsQueueEvents[_0x7210('0x6')](_0x3b85f7+':'+_0x51797f['id'],_0x51797f);SmsQueueEvents[_0x7210('0x6')](_0x3b85f7,_0x51797f);_0x39ea3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x718e=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c4ff0,_0x2c93cb){var _0x392915=function(_0x49d14a){while(--_0x49d14a){_0x1c4ff0['push'](_0x1c4ff0['shift']());}};_0x392915(++_0x2c93cb);}(_0x718e,0x121));var _0xe718=function(_0x5bd5fc,_0x57597){_0x5bd5fc=_0x5bd5fc-0x0;var _0x420110=_0x718e[_0x5bd5fc];return _0x420110;};'use strict';var EventEmitter=require(_0xe718('0x0'));var SmsQueue=require(_0xe718('0x1'))['db'][_0xe718('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe718('0x3'),'afterUpdate':_0xe718('0x4'),'afterDestroy':_0xe718('0x5')};function emitEvent(_0x176084){return function(_0x3d8edb,_0x3a5bef,_0x21bb6e){SmsQueueEvents[_0xe718('0x6')](_0x176084+':'+_0x3d8edb['id'],_0x3d8edb);SmsQueueEvents[_0xe718('0x6')](_0x176084,_0x3d8edb);_0x21bb6e(null);};}for(var e in events){if(events[_0xe718('0x7')](e)){var event=events[e];SmsQueue[_0xe718('0x8')](e,emitEvent(event));}}module[_0xe718('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4391175..5a9f5a5 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 _0x2ad4=['lodash','util','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue'];(function(_0x41930e,_0x34c35d){var _0x2fb492=function(_0x511c17){while(--_0x511c17){_0x41930e['push'](_0x41930e['shift']());}};_0x2fb492(++_0x34c35d);}(_0x2ad4,0xbd));var _0x42ad=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x2ad4[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x42ad('0x2'));var fs=require('fs');var path=require(_0x42ad('0x3'));var rimraf=require(_0x42ad('0x4'));var config=require(_0x42ad('0x5'));var attributes=require(_0x42ad('0x6'));module['exports']=function(_0x247410,_0x1c30c8){return _0x247410[_0x42ad('0x7')](_0x42ad('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8fe=['request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x37246c,_0x5bfe11){var _0x5d4d0e=function(_0x4ab9aa){while(--_0x4ab9aa){_0x37246c['push'](_0x37246c['shift']());}};_0x5d4d0e(++_0x5bfe11);}(_0xf8fe,0xff));var _0xef8f=function(_0x164ba3,_0x5a0f9b){_0x164ba3=_0x164ba3-0x0;var _0x46b25a=_0xf8fe[_0x164ba3];return _0x46b25a;};'use strict';var _=require('lodash');var util=require(_0xef8f('0x0'));var logger=require(_0xef8f('0x1'))(_0xef8f('0x2'));var moment=require(_0xef8f('0x3'));var BPromise=require(_0xef8f('0x4'));var rp=require(_0xef8f('0x5'));var fs=require('fs');var path=require(_0xef8f('0x6'));var rimraf=require('rimraf');var config=require(_0xef8f('0x7'));var attributes=require(_0xef8f('0x8'));module[_0xef8f('0x9')]=function(_0x46f4f4,_0x2ad5c3){return _0x46f4f4[_0xef8f('0xa')](_0xef8f('0xb'),attributes,{'tableName':_0xef8f('0xc'),'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 3a3f931..e70dc63 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 _0x66f0=['error','code','message','info','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','then','catch','ShowSmsQueue','find','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4bf991,_0x3601af){var _0x5aa517=function(_0x12c098){while(--_0x12c098){_0x4bf991['push'](_0x4bf991['shift']());}};_0x5aa517(++_0x3601af);}(_0x66f0,0x65));var _0x066f=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x66f0[_0x4a209a];return _0x4b3c20;};'use strict';var _=require(_0x066f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x066f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x066f('0x2'));var db=require(_0x066f('0x3'))['db'];var utils=require(_0x066f('0x4'));var logger=require(_0x066f('0x5'))(_0x066f('0x6'));var config=require(_0x066f('0x7'));var jayson=require(_0x066f('0x8'));var client=jayson[_0x066f('0x9')][_0x066f('0xa')]({'port':0x232a});config[_0x066f('0xb')]=_[_0x066f('0xc')](config['redis'],{'host':_0x066f('0xd'),'port':0x18eb});var socket=require(_0x066f('0xe'))(new Redis(config[_0x066f('0xb')]));require('./smsQueue.socket')[_0x066f('0xf')](socket);function respondWithRpcPromise(_0x220b34,_0x411318,_0x57ee72){return new BPromise(function(_0x32bc66,_0x18fedd){return client[_0x066f('0x10')](_0x220b34,_0x57ee72)['then'](function(_0x192429){logger['info'](_0x066f('0x11'),_0x411318,_0x066f('0x12'));logger[_0x066f('0x13')](_0x066f('0x14'),_0x411318,_0x066f('0x12'),JSON[_0x066f('0x15')](_0x192429));if(_0x192429[_0x066f('0x16')]){if(_0x192429[_0x066f('0x16')][_0x066f('0x17')]===0x1f4){logger[_0x066f('0x16')](_0x066f('0x11'),_0x411318,_0x192429[_0x066f('0x16')][_0x066f('0x18')]);return _0x18fedd(_0x192429['error'][_0x066f('0x18')]);}logger[_0x066f('0x16')](_0x066f('0x11'),_0x411318,_0x192429[_0x066f('0x16')][_0x066f('0x18')]);return _0x32bc66(_0x192429[_0x066f('0x16')][_0x066f('0x18')]);}else{logger[_0x066f('0x19')]('SmsQueue,\x20%s,\x20%s',_0x411318,_0x066f('0x12'));_0x32bc66(_0x192429[_0x066f('0x1a')][_0x066f('0x18')]);}})['catch'](function(_0x15480f){logger[_0x066f('0x16')]('SmsQueue,\x20%s,\x20%s',_0x411318,_0x15480f);_0x18fedd(_0x15480f);});});}exports[_0x066f('0x1b')]=function(_0x4ce0c2){var _0x4a6814=this;return new Promise(function(_0x10cde5,_0xf864d3){return db[_0x066f('0x1c')][_0x066f('0x1d')]({'raw':_0x4ce0c2['options']?_0x4ce0c2[_0x066f('0x1e')][_0x066f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ce0c2[_0x066f('0x1e')]?_0x4ce0c2[_0x066f('0x1e')][_0x066f('0x20')]||null:null,'attributes':_0x4ce0c2[_0x066f('0x1e')]?_0x4ce0c2[_0x066f('0x1e')][_0x066f('0x21')]||null:null,'limit':_0x4ce0c2[_0x066f('0x1e')]?_0x4ce0c2[_0x066f('0x1e')]['limit']||null:null,'include':_0x4ce0c2[_0x066f('0x1e')]?_0x4ce0c2[_0x066f('0x1e')][_0x066f('0x22')]?_[_0x066f('0x23')](_0x4ce0c2[_0x066f('0x1e')]['include'],function(_0x3f8944){return{'model':db[_0x3f8944[_0x066f('0x24')]],'as':_0x3f8944['as'],'attributes':_0x3f8944[_0x066f('0x21')],'include':_0x3f8944['include']?_['map'](_0x3f8944[_0x066f('0x22')],function(_0x49d14a){return{'model':db[_0x49d14a['model']],'as':_0x49d14a['as'],'attributes':_0x49d14a['attributes'],'include':_0x49d14a[_0x066f('0x22')]?_[_0x066f('0x23')](_0x49d14a[_0x066f('0x22')],function(_0x484691){return{'model':db[_0x484691[_0x066f('0x24')]],'as':_0x484691['as'],'attributes':_0x484691[_0x066f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x066f('0x25')](function(_0x53f284){logger[_0x066f('0x19')](_0x066f('0x1b'),_0x4ce0c2);logger[_0x066f('0x13')]('GetSmsQueue',_0x4ce0c2,JSON[_0x066f('0x15')](_0x53f284));_0x10cde5(_0x53f284);})[_0x066f('0x26')](function(_0x534c1d){logger[_0x066f('0x16')](_0x066f('0x1b'),_0x534c1d[_0x066f('0x18')],_0x4ce0c2);_0xf864d3(_0x4a6814[_0x066f('0x16')](0x1f4,_0x534c1d['message']));});});};exports[_0x066f('0x27')]=function(_0x33cee7){var _0x5f208b=this;return new Promise(function(_0x1ff1ff,_0x2c3bb9){return db[_0x066f('0x1c')][_0x066f('0x28')]({'raw':_0x33cee7[_0x066f('0x1e')]?_0x33cee7[_0x066f('0x1e')][_0x066f('0x1f')]===undefined?!![]:![]:!![],'where':_0x33cee7['options']?_0x33cee7[_0x066f('0x1e')]['where']||null:null,'attributes':_0x33cee7[_0x066f('0x1e')]?_0x33cee7[_0x066f('0x1e')][_0x066f('0x21')]||null:null,'include':_0x33cee7[_0x066f('0x1e')]?_0x33cee7[_0x066f('0x1e')][_0x066f('0x22')]?_['map'](_0x33cee7[_0x066f('0x1e')]['include'],function(_0x141fb5){return{'model':db[_0x141fb5[_0x066f('0x24')]],'as':_0x141fb5['as'],'attributes':_0x141fb5[_0x066f('0x21')],'include':_0x141fb5[_0x066f('0x22')]?_[_0x066f('0x23')](_0x141fb5[_0x066f('0x22')],function(_0x3f73da){return{'model':db[_0x3f73da[_0x066f('0x24')]],'as':_0x3f73da['as'],'attributes':_0x3f73da['attributes'],'include':_0x3f73da[_0x066f('0x22')]?_[_0x066f('0x23')](_0x3f73da[_0x066f('0x22')],function(_0x3469d4){return{'model':db[_0x3469d4[_0x066f('0x24')]],'as':_0x3469d4['as'],'attributes':_0x3469d4[_0x066f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x066f('0x25')](function(_0x30b26b){logger[_0x066f('0x19')]('ShowSmsQueue',_0x33cee7);logger[_0x066f('0x13')](_0x066f('0x27'),_0x33cee7,JSON[_0x066f('0x15')](_0x30b26b));_0x1ff1ff(_0x30b26b);})['catch'](function(_0x312483){logger['error']('ShowSmsQueue',_0x312483[_0x066f('0x18')],_0x33cee7);_0x2c3bb9(_0x5f208b['error'](0x1f4,_0x312483[_0x066f('0x18')]));});});}; \ No newline at end of file +var _0x6470=['info','request\x20sent','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','include','model','map','then','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x6470,0x149));var _0x0647=function(_0x5167d7,_0x3d8fc6){_0x5167d7=_0x5167d7-0x0;var _0x2d3bb5=_0x6470[_0x5167d7];return _0x2d3bb5;};'use strict';var _=require(_0x0647('0x0'));var util=require(_0x0647('0x1'));var moment=require(_0x0647('0x2'));var BPromise=require(_0x0647('0x3'));var rs=require(_0x0647('0x4'));var fs=require('fs');var Redis=require(_0x0647('0x5'));var db=require(_0x0647('0x6'))['db'];var utils=require(_0x0647('0x7'));var logger=require('../../config/logger')(_0x0647('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0647('0x9')][_0x0647('0xa')]({'port':0x232a});config[_0x0647('0xb')]=_[_0x0647('0xc')](config[_0x0647('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0647('0xb')]));require(_0x0647('0xd'))[_0x0647('0xe')](socket);function respondWithRpcPromise(_0x5a033a,_0x256c6b,_0x258eee){return new BPromise(function(_0x2126f8,_0x56d229){return client[_0x0647('0xf')](_0x5a033a,_0x258eee)['then'](function(_0x36317d){logger['info'](_0x0647('0x10'),_0x256c6b,'request\x20sent');logger[_0x0647('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x256c6b,'request\x20sent',JSON[_0x0647('0x12')](_0x36317d));if(_0x36317d[_0x0647('0x13')]){if(_0x36317d[_0x0647('0x13')][_0x0647('0x14')]===0x1f4){logger[_0x0647('0x13')](_0x0647('0x10'),_0x256c6b,_0x36317d['error'][_0x0647('0x15')]);return _0x56d229(_0x36317d[_0x0647('0x13')][_0x0647('0x15')]);}logger[_0x0647('0x13')](_0x0647('0x10'),_0x256c6b,_0x36317d[_0x0647('0x13')][_0x0647('0x15')]);return _0x2126f8(_0x36317d[_0x0647('0x13')][_0x0647('0x15')]);}else{logger[_0x0647('0x16')](_0x0647('0x10'),_0x256c6b,_0x0647('0x17'));_0x2126f8(_0x36317d[_0x0647('0x18')][_0x0647('0x15')]);}})[_0x0647('0x19')](function(_0x2595b2){logger[_0x0647('0x13')](_0x0647('0x10'),_0x256c6b,_0x2595b2);_0x56d229(_0x2595b2);});});}exports[_0x0647('0x1a')]=function(_0x5d17ad){var _0xdca951=this;return new Promise(function(_0x23eea8,_0x2b28a2){return db[_0x0647('0x1b')][_0x0647('0x1c')]({'raw':_0x5d17ad['options']?_0x5d17ad['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d17ad[_0x0647('0x1d')]?_0x5d17ad[_0x0647('0x1d')][_0x0647('0x1e')]||null:null,'attributes':_0x5d17ad[_0x0647('0x1d')]?_0x5d17ad[_0x0647('0x1d')][_0x0647('0x1f')]||null:null,'limit':_0x5d17ad['options']?_0x5d17ad['options']['limit']||null:null,'include':_0x5d17ad[_0x0647('0x1d')]?_0x5d17ad[_0x0647('0x1d')][_0x0647('0x20')]?_['map'](_0x5d17ad[_0x0647('0x1d')]['include'],function(_0xcee175){return{'model':db[_0xcee175[_0x0647('0x21')]],'as':_0xcee175['as'],'attributes':_0xcee175[_0x0647('0x1f')],'include':_0xcee175[_0x0647('0x20')]?_[_0x0647('0x22')](_0xcee175['include'],function(_0x217362){return{'model':db[_0x217362[_0x0647('0x21')]],'as':_0x217362['as'],'attributes':_0x217362[_0x0647('0x1f')],'include':_0x217362['include']?_[_0x0647('0x22')](_0x217362[_0x0647('0x20')],function(_0x51070f){return{'model':db[_0x51070f['model']],'as':_0x51070f['as'],'attributes':_0x51070f[_0x0647('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0647('0x23')](function(_0x587bc9){logger['info'](_0x0647('0x1a'),_0x5d17ad);logger[_0x0647('0x11')](_0x0647('0x1a'),_0x5d17ad,JSON['stringify'](_0x587bc9));_0x23eea8(_0x587bc9);})[_0x0647('0x19')](function(_0x321fbb){logger[_0x0647('0x13')](_0x0647('0x1a'),_0x321fbb['message'],_0x5d17ad);_0x2b28a2(_0xdca951[_0x0647('0x13')](0x1f4,_0x321fbb[_0x0647('0x15')]));});});};exports[_0x0647('0x24')]=function(_0x34cab1){var _0x7c0e42=this;return new Promise(function(_0x387c1f,_0x237e0f){return db['SmsQueue'][_0x0647('0x25')]({'raw':_0x34cab1['options']?_0x34cab1['options'][_0x0647('0x26')]===undefined?!![]:![]:!![],'where':_0x34cab1[_0x0647('0x1d')]?_0x34cab1[_0x0647('0x1d')][_0x0647('0x1e')]||null:null,'attributes':_0x34cab1[_0x0647('0x1d')]?_0x34cab1[_0x0647('0x1d')]['attributes']||null:null,'include':_0x34cab1['options']?_0x34cab1[_0x0647('0x1d')][_0x0647('0x20')]?_['map'](_0x34cab1[_0x0647('0x1d')]['include'],function(_0x298505){return{'model':db[_0x298505[_0x0647('0x21')]],'as':_0x298505['as'],'attributes':_0x298505[_0x0647('0x1f')],'include':_0x298505[_0x0647('0x20')]?_[_0x0647('0x22')](_0x298505[_0x0647('0x20')],function(_0x37a38d){return{'model':db[_0x37a38d[_0x0647('0x21')]],'as':_0x37a38d['as'],'attributes':_0x37a38d[_0x0647('0x1f')],'include':_0x37a38d['include']?_[_0x0647('0x22')](_0x37a38d['include'],function(_0x148171){return{'model':db[_0x148171['model']],'as':_0x148171['as'],'attributes':_0x148171[_0x0647('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15c2ac){logger['info'](_0x0647('0x24'),_0x34cab1);logger[_0x0647('0x11')](_0x0647('0x24'),_0x34cab1,JSON[_0x0647('0x12')](_0x15c2ac));_0x387c1f(_0x15c2ac);})[_0x0647('0x19')](function(_0x7009e9){logger[_0x0647('0x13')](_0x0647('0x24'),_0x7009e9[_0x0647('0x15')],_0x34cab1);_0x237e0f(_0x7c0e42[_0x0647('0x13')](0x1f4,_0x7009e9[_0x0647('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ecd3993..b88d75d 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 _0xaeb9=['removeListener','register','save','remove','update','emit'];(function(_0x44a61d,_0x5e3ddd){var _0x308f62=function(_0x405cba){while(--_0x405cba){_0x44a61d['push'](_0x44a61d['shift']());}};_0x308f62(++_0x5e3ddd);}(_0xaeb9,0x10a));var _0x9aeb=function(_0xf6303,_0x1ee1fd){_0xf6303=_0xf6303-0x0;var _0x3f6b45=_0xaeb9[_0xf6303];return _0x3f6b45;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9aeb('0x0'),_0x9aeb('0x1'),_0x9aeb('0x2')];function createListener(_0x1d1bfb,_0x4dba32){return function(_0xa9900e){_0x4dba32[_0x9aeb('0x3')](_0x1d1bfb,_0xa9900e);};}function removeListener(_0x29792f,_0x32f1c6){return function(){SmsQueueEvents[_0x9aeb('0x4')](_0x29792f,_0x32f1c6);};}exports[_0x9aeb('0x5')]=function(_0x4644bd){for(var _0x17ab96=0x0,_0x4de0e3=events['length'];_0x17ab96<_0x4de0e3;_0x17ab96++){var _0x1c8470=events[_0x17ab96];var _0x192652=createListener('smsQueue:'+_0x1c8470,_0x4644bd);SmsQueueEvents['on'](_0x1c8470,_0x192652);}}; \ No newline at end of file +var _0x09ca=['length','smsQueue:','./smsQueue.events','remove','removeListener'];(function(_0x574a41,_0x316f25){var _0x3eacaa=function(_0x510fd9){while(--_0x510fd9){_0x574a41['push'](_0x574a41['shift']());}};_0x3eacaa(++_0x316f25);}(_0x09ca,0xd4));var _0xa09c=function(_0x4e5500,_0x2ac195){_0x4e5500=_0x4e5500-0x0;var _0x9b0bf4=_0x09ca[_0x4e5500];return _0x9b0bf4;};'use strict';var SmsQueueEvents=require(_0xa09c('0x0'));var events=['save',_0xa09c('0x1'),'update'];function createListener(_0x1ec093,_0x422fb2){return function(_0x4593c9){_0x422fb2['emit'](_0x1ec093,_0x4593c9);};}function removeListener(_0x1d8c20,_0x742fee){return function(){SmsQueueEvents[_0xa09c('0x2')](_0x1d8c20,_0x742fee);};}exports['register']=function(_0x58ae29){for(var _0x4d9aaf=0x0,_0xcc9f1c=events[_0xa09c('0x3')];_0x4d9aaf<_0xcc9f1c;_0x4d9aaf++){var _0x271c15=events[_0x4d9aaf];var _0x4a3543=createListener(_0xa09c('0x4')+_0x271c15,_0x58ae29);SmsQueueEvents['on'](_0x271c15,_0x4a3543);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index aa6fe38..14d0929 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 _0x2220=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x362f81,_0x25e6c8){var _0x14a94e=function(_0x3042a2){while(--_0x3042a2){_0x362f81['push'](_0x362f81['shift']());}};_0x14a94e(++_0x25e6c8);}(_0x2220,0x14e));var _0x0222=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x2220[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0x0222('0x0'));var util=require(_0x0222('0x1'));var path=require(_0x0222('0x2'));var timeout=require(_0x0222('0x3'));var express=require(_0x0222('0x4'));var router=express[_0x0222('0x5')]();var fs_extra=require(_0x0222('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0222('0x7'));var config=require(_0x0222('0x8'));var controller=require(_0x0222('0x9'));router[_0x0222('0xa')]('/',auth[_0x0222('0xb')](),controller['index']);router[_0x0222('0xa')](_0x0222('0xc'),auth['isAuthenticated'](),controller[_0x0222('0xd')]);router[_0x0222('0xa')](_0x0222('0xe'),auth['isAuthenticated'](),controller[_0x0222('0xf')]);router[_0x0222('0x10')]('/',auth[_0x0222('0xb')](),controller[_0x0222('0x11')]);router['put'](_0x0222('0xe'),auth[_0x0222('0xb')](),controller[_0x0222('0x12')]);router[_0x0222('0x13')]('/:id',auth[_0x0222('0xb')](),controller['destroy']);module[_0x0222('0x14')]=router; \ No newline at end of file +var _0x2123=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x63684d,_0x596b01){var _0xf4d811=function(_0xd34817){while(--_0xd34817){_0x63684d['push'](_0x63684d['shift']());}};_0xf4d811(++_0x596b01);}(_0x2123,0x190));var _0x3212=function(_0x27a35b,_0x220b24){_0x27a35b=_0x27a35b-0x0;var _0x11c958=_0x2123[_0x27a35b];return _0x11c958;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3212('0x13')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x15')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x16')]);module[_0x3212('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 733db66..4858923 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 _0xc240=['STRING','DATE','moment','sequelize','exports'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xc240,0xa7));var _0x0c24=function(_0x435193,_0x24b26b){_0x435193=_0x435193-0x0;var _0x429c61=_0xc240[_0x435193];return _0x429c61;};'use strict';var moment=require(_0x0c24('0x0'));var Sequelize=require(_0x0c24('0x1'));module[_0x0c24('0x2')]={'uniqueid':{'type':Sequelize[_0x0c24('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0c24('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0c24('0x4')]},'acceptAt':{'type':Sequelize[_0x0c24('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0c24('0x3')]}}; \ No newline at end of file +var _0x95bb=['STRING','DATE','moment','sequelize','exports'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x95bb,0xed));var _0xb95b=function(_0x9b91ea,_0xc98cb7){_0x9b91ea=_0x9b91ea-0x0;var _0x558e76=_0x95bb[_0x9b91ea];return _0x558e76;};'use strict';var moment=require(_0xb95b('0x0'));var Sequelize=require(_0xb95b('0x1'));module[_0xb95b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb95b('0x3')]},'joinAt':{'type':Sequelize[_0xb95b('0x4')]},'leaveAt':{'type':Sequelize[_0xb95b('0x4')]},'acceptAt':{'type':Sequelize[_0xb95b('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb95b('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2bf9c3d..6509064 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 _0x5ea7=['describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','SmsQueueReport','findAll','rows','catch','show','params','find','create','body','update'];(function(_0x7e5a34,_0x17a287){var _0x1d62fc=function(_0x1e2a1a){while(--_0x1e2a1a){_0x7e5a34['push'](_0x7e5a34['shift']());}};_0x1d62fc(++_0x17a287);}(_0x5ea7,0x11d));var _0x75ea=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5ea7[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x75ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75ea('0x1'));var jsonpatch=require(_0x75ea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75ea('0x3'));var Mustache=require(_0x75ea('0x4'));var util=require(_0x75ea('0x5'));var path=require(_0x75ea('0x6'));var sox=require(_0x75ea('0x7'));var csv=require(_0x75ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75ea('0x9'));var _=require(_0x75ea('0xa'));var squel=require(_0x75ea('0xb'));var crypto=require(_0x75ea('0xc'));var jsforce=require(_0x75ea('0xd'));var deskjs=require(_0x75ea('0xe'));var toCsv=require(_0x75ea('0x8'));var querystring=require(_0x75ea('0xf'));var Papa=require(_0x75ea('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75ea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x75ea('0x12'))('api');var utils=require(_0x75ea('0x13'));var config=require(_0x75ea('0x14'));var licenseUtil=require(_0x75ea('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22ee25,_0x67a66){_0x67a66=_0x67a66||0xcc;return function(_0x272039){if(_0x272039){return _0x22ee25[_0x75ea('0x16')](_0x67a66);}return _0x22ee25[_0x75ea('0x17')](_0x67a66)[_0x75ea('0x18')]();};}function respondWithResult(_0x10c189,_0x4c870c){_0x4c870c=_0x4c870c||0xc8;return function(_0x1281fb){if(_0x1281fb){return _0x10c189[_0x75ea('0x17')](_0x4c870c)['json'](_0x1281fb);}};}function respondWithFilteredResult(_0x4d0c57,_0x4abd3d){return function(_0x3bde79){if(_0x3bde79){var _0xbc5afc=typeof _0x4abd3d[_0x75ea('0x19')]===_0x75ea('0x1a')&&typeof _0x4abd3d[_0x75ea('0x1b')]===_0x75ea('0x1a');var _0x474a1d=_0x3bde79[_0x75ea('0x1c')];var _0x122341=_0xbc5afc?0x0:_0x4abd3d[_0x75ea('0x19')];var _0x2f16a1=_0xbc5afc?_0x3bde79[_0x75ea('0x1c')]:_0x4abd3d[_0x75ea('0x19')]+_0x4abd3d['limit'];var _0x47c29e;if(_0x2f16a1>=_0x474a1d){_0x2f16a1=_0x474a1d;_0x47c29e=0xc8;}else{_0x47c29e=0xce;}_0x4d0c57[_0x75ea('0x17')](_0x47c29e);return _0x4d0c57[_0x75ea('0x1d')](_0x75ea('0x1e'),_0x122341+'-'+_0x2f16a1+'/'+_0x474a1d)['json'](_0x3bde79);}return null;};}function patchUpdates(_0x2102b3){return function(_0x40972c){try{jsonpatch[_0x75ea('0x1f')](_0x40972c,_0x2102b3,!![]);}catch(_0x28e6c1){return BPromise[_0x75ea('0x20')](_0x28e6c1);}return _0x40972c[_0x75ea('0x21')]();};}function saveUpdates(_0x35a957,_0x580a4c){return function(_0x5ca5d0){if(_0x5ca5d0){return _0x5ca5d0['update'](_0x35a957)[_0x75ea('0x22')](function(_0x1057fe){return _0x1057fe;});}return null;};}function removeEntity(_0x556ee3,_0x32a3fb){return function(_0x4126ea){if(_0x4126ea){return _0x4126ea[_0x75ea('0x23')]()[_0x75ea('0x22')](function(){_0x556ee3[_0x75ea('0x17')](0xcc)[_0x75ea('0x18')]();});}};}function handleEntityNotFound(_0x117940,_0x182162){return function(_0x232f29){if(!_0x232f29){_0x117940[_0x75ea('0x16')](0x194);}return _0x232f29;};}function handleError(_0x50321a,_0x5f6323){_0x5f6323=_0x5f6323||0x1f4;return function(_0x13f239){logger['error'](_0x13f239['stack']);if(_0x13f239[_0x75ea('0x24')]){delete _0x13f239[_0x75ea('0x24')];}_0x50321a[_0x75ea('0x17')](_0x5f6323)[_0x75ea('0x25')](_0x13f239);};}exports[_0x75ea('0x26')]=function(_0x1c8c9e,_0x23364b){var _0x5186ec={},_0x59505e={},_0x23cf11={'count':0x0,'rows':[]};var _0x401aae=_[_0x75ea('0x27')](db['SmsQueueReport'][_0x75ea('0x28')],function(_0x1a2791){return{'name':_0x1a2791['fieldName'],'type':_0x1a2791[_0x75ea('0x29')][_0x75ea('0x2a')]};});_0x59505e[_0x75ea('0x2b')]=_[_0x75ea('0x27')](_0x401aae,_0x75ea('0x24'));_0x59505e[_0x75ea('0x2c')]=_[_0x75ea('0x2d')](_0x1c8c9e[_0x75ea('0x2c')]);_0x59505e['filters']=_['intersection'](_0x59505e[_0x75ea('0x2b')],_0x59505e[_0x75ea('0x2c')]);_0x5186ec[_0x75ea('0x2e')]=_[_0x75ea('0x2f')](_0x59505e[_0x75ea('0x2b')],qs[_0x75ea('0x30')](_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x30')]));_0x5186ec[_0x75ea('0x2e')]=_0x5186ec[_0x75ea('0x2e')]['length']?_0x5186ec[_0x75ea('0x2e')]:_0x59505e[_0x75ea('0x2b')];if(!_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x31')](_0x75ea('0x32'))){_0x5186ec[_0x75ea('0x1b')]=qs[_0x75ea('0x1b')](_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x1b')]);_0x5186ec[_0x75ea('0x19')]=qs[_0x75ea('0x19')](_0x1c8c9e['query'][_0x75ea('0x19')]);}_0x5186ec['order']=qs[_0x75ea('0x33')](_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x33')]);_0x5186ec[_0x75ea('0x34')]=qs[_0x75ea('0x35')](_[_0x75ea('0x36')](_0x1c8c9e[_0x75ea('0x2c')],_0x59505e[_0x75ea('0x35')]),_0x401aae);if(_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x37')]){_0x5186ec['where']=_[_0x75ea('0x38')](_0x5186ec[_0x75ea('0x34')],{'$or':_['map'](_0x401aae,function(_0x51fed2){if(_0x51fed2[_0x75ea('0x29')]!==_0x75ea('0x39')){var _0x314f40={};_0x314f40[_0x51fed2[_0x75ea('0x24')]]={'$like':'%'+_0x1c8c9e['query'][_0x75ea('0x37')]+'%'};return _0x314f40;}})});}_0x5186ec=_[_0x75ea('0x38')]({},_0x5186ec,_0x1c8c9e['options']);var _0x218e2a={'where':_0x5186ec[_0x75ea('0x34')]};return db['SmsQueueReport']['count'](_0x218e2a)['then'](function(_0x15b7d6){_0x23cf11[_0x75ea('0x1c')]=_0x15b7d6;if(_0x1c8c9e[_0x75ea('0x2c')][_0x75ea('0x3a')]){_0x5186ec[_0x75ea('0x3b')]=[{'all':!![]}];}return db[_0x75ea('0x3c')][_0x75ea('0x3d')](_0x5186ec);})[_0x75ea('0x22')](function(_0x133ae6){_0x23cf11[_0x75ea('0x3e')]=_0x133ae6;return _0x23cf11;})[_0x75ea('0x22')](respondWithFilteredResult(_0x23364b,_0x5186ec))[_0x75ea('0x3f')](handleError(_0x23364b,null));};exports[_0x75ea('0x40')]=function(_0x3ae31c,_0x189937){var _0x210201={'raw':!![],'where':{'id':_0x3ae31c[_0x75ea('0x41')]['id']}},_0x39d70a={};_0x39d70a[_0x75ea('0x2b')]=_[_0x75ea('0x2d')](db[_0x75ea('0x3c')][_0x75ea('0x28')]);_0x39d70a[_0x75ea('0x2c')]=_['keys'](_0x3ae31c[_0x75ea('0x2c')]);_0x39d70a['filters']=_[_0x75ea('0x2f')](_0x39d70a[_0x75ea('0x2b')],_0x39d70a[_0x75ea('0x2c')]);_0x210201[_0x75ea('0x2e')]=_[_0x75ea('0x2f')](_0x39d70a[_0x75ea('0x2b')],qs['fields'](_0x3ae31c['query'][_0x75ea('0x30')]));_0x210201[_0x75ea('0x2e')]=_0x210201['attributes']['length']?_0x210201[_0x75ea('0x2e')]:_0x39d70a[_0x75ea('0x2b')];if(_0x3ae31c[_0x75ea('0x2c')]['includeAll']){_0x210201[_0x75ea('0x3b')]=[{'all':!![]}];}_0x210201=_[_0x75ea('0x38')]({},_0x210201,_0x3ae31c['options']);return db[_0x75ea('0x3c')][_0x75ea('0x42')](_0x210201)['then'](handleEntityNotFound(_0x189937,null))[_0x75ea('0x22')](respondWithResult(_0x189937,null))[_0x75ea('0x3f')](handleError(_0x189937,null));};exports[_0x75ea('0x43')]=function(_0x2114d4,_0x178db7){return db[_0x75ea('0x3c')][_0x75ea('0x43')](_0x2114d4[_0x75ea('0x44')],{})[_0x75ea('0x22')](respondWithResult(_0x178db7,0xc9))[_0x75ea('0x3f')](handleError(_0x178db7,null));};exports[_0x75ea('0x45')]=function(_0x42f876,_0x4066e6){if(_0x42f876[_0x75ea('0x44')]['id']){delete _0x42f876[_0x75ea('0x44')]['id'];}return db[_0x75ea('0x3c')][_0x75ea('0x42')]({'where':{'id':_0x42f876['params']['id']}})[_0x75ea('0x22')](handleEntityNotFound(_0x4066e6,null))[_0x75ea('0x22')](saveUpdates(_0x42f876[_0x75ea('0x44')],null))[_0x75ea('0x22')](respondWithResult(_0x4066e6,null))[_0x75ea('0x3f')](handleError(_0x4066e6,null));};exports[_0x75ea('0x23')]=function(_0xfd7db5,_0x2a9f15){return db[_0x75ea('0x3c')][_0x75ea('0x42')]({'where':{'id':_0xfd7db5['params']['id']}})[_0x75ea('0x22')](handleEntityNotFound(_0x2a9f15,null))[_0x75ea('0x22')](removeEntity(_0x2a9f15,null))[_0x75ea('0x3f')](handleError(_0x2a9f15,null));};exports[_0x75ea('0x46')]=function(_0x5b65b8,_0x450fca){return db[_0x75ea('0x3c')][_0x75ea('0x46')]()[_0x75ea('0x22')](respondWithResult(_0x450fca,null))[_0x75ea('0x3f')](handleError(_0x450fca,null));}; \ No newline at end of file +var _0xff25=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','describe','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x5383ad,_0x510d1d){var _0x2790e1=function(_0x55e9e5){while(--_0x55e9e5){_0x5383ad['push'](_0x5383ad['shift']());}};_0x2790e1(++_0x510d1d);}(_0xff25,0x190));var _0x5ff2=function(_0x9a998b,_0x2fb091){_0x9a998b=_0x9a998b-0x0;var _0x35c369=_0xff25[_0x9a998b];return _0x35c369;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ff2('0x0'));var moment=require(_0x5ff2('0x1'));var BPromise=require(_0x5ff2('0x2'));var Mustache=require(_0x5ff2('0x3'));var util=require('util');var path=require(_0x5ff2('0x4'));var sox=require(_0x5ff2('0x5'));var csv=require(_0x5ff2('0x6'));var ejs=require(_0x5ff2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5ff2('0x8'));var crypto=require(_0x5ff2('0x9'));var jsforce=require(_0x5ff2('0xa'));var deskjs=require(_0x5ff2('0xb'));var toCsv=require(_0x5ff2('0x6'));var querystring=require(_0x5ff2('0xc'));var Papa=require(_0x5ff2('0xd'));var Redis=require(_0x5ff2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5ff2('0xf'));var hardwareService=require(_0x5ff2('0x10'));var logger=require('../../config/logger')(_0x5ff2('0x11'));var utils=require('../../config/utils');var config=require(_0x5ff2('0x12'));var licenseUtil=require(_0x5ff2('0x13'));var db=require(_0x5ff2('0x14'))['db'];function respondWithStatusCode(_0x121235,_0x27270a){_0x27270a=_0x27270a||0xcc;return function(_0x387b6a){if(_0x387b6a){return _0x121235[_0x5ff2('0x15')](_0x27270a);}return _0x121235[_0x5ff2('0x16')](_0x27270a)[_0x5ff2('0x17')]();};}function respondWithResult(_0x543ae1,_0x17eb4f){_0x17eb4f=_0x17eb4f||0xc8;return function(_0x9fab9){if(_0x9fab9){return _0x543ae1[_0x5ff2('0x16')](_0x17eb4f)['json'](_0x9fab9);}};}function respondWithFilteredResult(_0x2915d8,_0x1751c4){return function(_0x5e5ebf){if(_0x5e5ebf){var _0x5a2268=typeof _0x1751c4[_0x5ff2('0x18')]===_0x5ff2('0x19')&&typeof _0x1751c4[_0x5ff2('0x1a')]===_0x5ff2('0x19');var _0x3ee9c8=_0x5e5ebf[_0x5ff2('0x1b')];var _0x5ac461=_0x5a2268?0x0:_0x1751c4[_0x5ff2('0x18')];var _0x5e980d=_0x5a2268?_0x5e5ebf[_0x5ff2('0x1b')]:_0x1751c4[_0x5ff2('0x18')]+_0x1751c4['limit'];var _0x4ddca0;if(_0x5e980d>=_0x3ee9c8){_0x5e980d=_0x3ee9c8;_0x4ddca0=0xc8;}else{_0x4ddca0=0xce;}_0x2915d8[_0x5ff2('0x16')](_0x4ddca0);return _0x2915d8['set'](_0x5ff2('0x1c'),_0x5ac461+'-'+_0x5e980d+'/'+_0x3ee9c8)[_0x5ff2('0x1d')](_0x5e5ebf);}return null;};}function patchUpdates(_0x387c4b){return function(_0x379ccd){try{jsonpatch[_0x5ff2('0x1e')](_0x379ccd,_0x387c4b,!![]);}catch(_0x3f2067){return BPromise[_0x5ff2('0x1f')](_0x3f2067);}return _0x379ccd[_0x5ff2('0x20')]();};}function saveUpdates(_0x2d2a94,_0x4c6933){return function(_0xe5cb94){if(_0xe5cb94){return _0xe5cb94[_0x5ff2('0x21')](_0x2d2a94)[_0x5ff2('0x22')](function(_0x52b431){return _0x52b431;});}return null;};}function removeEntity(_0x1849b8,_0x4aba37){return function(_0x376790){if(_0x376790){return _0x376790[_0x5ff2('0x23')]()['then'](function(){_0x1849b8[_0x5ff2('0x16')](0xcc)[_0x5ff2('0x17')]();});}};}function handleEntityNotFound(_0x22ce58,_0x252191){return function(_0x10fa45){if(!_0x10fa45){_0x22ce58['sendStatus'](0x194);}return _0x10fa45;};}function handleError(_0x128d93,_0x23c084){_0x23c084=_0x23c084||0x1f4;return function(_0x211d4a){logger['error'](_0x211d4a[_0x5ff2('0x24')]);if(_0x211d4a[_0x5ff2('0x25')]){delete _0x211d4a['name'];}_0x128d93['status'](_0x23c084)['send'](_0x211d4a);};}exports[_0x5ff2('0x26')]=function(_0xba17,_0x58ba65){var _0x3fda62={},_0x3489d2={},_0x518fed={'count':0x0,'rows':[]};var _0x559e2a=_['map'](db[_0x5ff2('0x27')][_0x5ff2('0x28')],function(_0x499de0){return{'name':_0x499de0[_0x5ff2('0x29')],'type':_0x499de0[_0x5ff2('0x2a')]['key']};});_0x3489d2[_0x5ff2('0x2b')]=_[_0x5ff2('0x2c')](_0x559e2a,_0x5ff2('0x25'));_0x3489d2['query']=_[_0x5ff2('0x2d')](_0xba17[_0x5ff2('0x2e')]);_0x3489d2[_0x5ff2('0x2f')]=_[_0x5ff2('0x30')](_0x3489d2[_0x5ff2('0x2b')],_0x3489d2['query']);_0x3fda62['attributes']=_['intersection'](_0x3489d2[_0x5ff2('0x2b')],qs[_0x5ff2('0x31')](_0xba17['query'][_0x5ff2('0x31')]));_0x3fda62[_0x5ff2('0x32')]=_0x3fda62[_0x5ff2('0x32')]['length']?_0x3fda62['attributes']:_0x3489d2[_0x5ff2('0x2b')];if(!_0xba17['query']['hasOwnProperty'](_0x5ff2('0x33'))){_0x3fda62['limit']=qs['limit'](_0xba17[_0x5ff2('0x2e')]['limit']);_0x3fda62['offset']=qs[_0x5ff2('0x18')](_0xba17['query']['offset']);}_0x3fda62[_0x5ff2('0x34')]=qs['sort'](_0xba17[_0x5ff2('0x2e')][_0x5ff2('0x35')]);_0x3fda62['where']=qs[_0x5ff2('0x2f')](_[_0x5ff2('0x36')](_0xba17['query'],_0x3489d2['filters']),_0x559e2a);if(_0xba17[_0x5ff2('0x2e')][_0x5ff2('0x37')]){_0x3fda62[_0x5ff2('0x38')]=_[_0x5ff2('0x39')](_0x3fda62[_0x5ff2('0x38')],{'$or':_[_0x5ff2('0x2c')](_0x559e2a,function(_0x11cda5){if(_0x11cda5[_0x5ff2('0x2a')]!==_0x5ff2('0x3a')){var _0x258041={};_0x258041[_0x11cda5[_0x5ff2('0x25')]]={'$like':'%'+_0xba17['query'][_0x5ff2('0x37')]+'%'};return _0x258041;}})});}_0x3fda62=_['merge']({},_0x3fda62,_0xba17[_0x5ff2('0x3b')]);var _0x2cebaa={'where':_0x3fda62[_0x5ff2('0x38')]};return db[_0x5ff2('0x27')][_0x5ff2('0x1b')](_0x2cebaa)[_0x5ff2('0x22')](function(_0x3a9c33){_0x518fed[_0x5ff2('0x1b')]=_0x3a9c33;if(_0xba17[_0x5ff2('0x2e')][_0x5ff2('0x3c')]){_0x3fda62[_0x5ff2('0x3d')]=[{'all':!![]}];}return db[_0x5ff2('0x27')]['findAll'](_0x3fda62);})[_0x5ff2('0x22')](function(_0x520a6a){_0x518fed['rows']=_0x520a6a;return _0x518fed;})[_0x5ff2('0x22')](respondWithFilteredResult(_0x58ba65,_0x3fda62))[_0x5ff2('0x3e')](handleError(_0x58ba65,null));};exports[_0x5ff2('0x3f')]=function(_0x4e4ead,_0x782873){var _0x9c3c5f={'raw':!![],'where':{'id':_0x4e4ead[_0x5ff2('0x40')]['id']}},_0x46994c={};_0x46994c['model']=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x46994c[_0x5ff2('0x2e')]=_['keys'](_0x4e4ead[_0x5ff2('0x2e')]);_0x46994c['filters']=_['intersection'](_0x46994c['model'],_0x46994c['query']);_0x9c3c5f['attributes']=_[_0x5ff2('0x30')](_0x46994c[_0x5ff2('0x2b')],qs[_0x5ff2('0x31')](_0x4e4ead[_0x5ff2('0x2e')][_0x5ff2('0x31')]));_0x9c3c5f[_0x5ff2('0x32')]=_0x9c3c5f[_0x5ff2('0x32')][_0x5ff2('0x41')]?_0x9c3c5f[_0x5ff2('0x32')]:_0x46994c[_0x5ff2('0x2b')];if(_0x4e4ead[_0x5ff2('0x2e')][_0x5ff2('0x3c')]){_0x9c3c5f[_0x5ff2('0x3d')]=[{'all':!![]}];}_0x9c3c5f=_[_0x5ff2('0x39')]({},_0x9c3c5f,_0x4e4ead[_0x5ff2('0x3b')]);return db[_0x5ff2('0x27')][_0x5ff2('0x42')](_0x9c3c5f)['then'](handleEntityNotFound(_0x782873,null))[_0x5ff2('0x22')](respondWithResult(_0x782873,null))[_0x5ff2('0x3e')](handleError(_0x782873,null));};exports[_0x5ff2('0x43')]=function(_0x2474aa,_0x34698e){return db[_0x5ff2('0x27')]['create'](_0x2474aa[_0x5ff2('0x44')],{})[_0x5ff2('0x22')](respondWithResult(_0x34698e,0xc9))[_0x5ff2('0x3e')](handleError(_0x34698e,null));};exports[_0x5ff2('0x21')]=function(_0x3418cc,_0x2c8ad0){if(_0x3418cc['body']['id']){delete _0x3418cc[_0x5ff2('0x44')]['id'];}return db[_0x5ff2('0x27')][_0x5ff2('0x42')]({'where':{'id':_0x3418cc[_0x5ff2('0x40')]['id']}})['then'](handleEntityNotFound(_0x2c8ad0,null))[_0x5ff2('0x22')](saveUpdates(_0x3418cc[_0x5ff2('0x44')],null))[_0x5ff2('0x22')](respondWithResult(_0x2c8ad0,null))[_0x5ff2('0x3e')](handleError(_0x2c8ad0,null));};exports[_0x5ff2('0x23')]=function(_0x4a0397,_0x26cbf3){return db['SmsQueueReport'][_0x5ff2('0x42')]({'where':{'id':_0x4a0397[_0x5ff2('0x40')]['id']}})['then'](handleEntityNotFound(_0x26cbf3,null))['then'](removeEntity(_0x26cbf3,null))[_0x5ff2('0x3e')](handleError(_0x26cbf3,null));};exports[_0x5ff2('0x45')]=function(_0x4d864c,_0xe6d41d){return db[_0x5ff2('0x27')]['describe']()[_0x5ff2('0x22')](respondWithResult(_0xe6d41d,null))['catch'](handleError(_0xe6d41d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 44a2b8c..6fcd141 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x29ee03,_0x14f698){var _0xa81d66=function(_0x11ff9e){while(--_0x11ff9e){_0x29ee03['push'](_0x29ee03['shift']());}};_0xa81d66(++_0x14f698);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcb91[_0x510c60];return _0x49c4aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 56c632a..8ad063a 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 _0x02d3=['catch','UpdateSmsQueueReport','SmsQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','create','body','options'];(function(_0x31038b,_0x3ac1c9){var _0x1c9d3c=function(_0xe00e97){while(--_0xe00e97){_0x31038b['push'](_0x31038b['shift']());}};_0x1c9d3c(++_0x3ac1c9);}(_0x02d3,0x1a0));var _0x302d=function(_0xc170c2,_0x234145){_0xc170c2=_0xc170c2-0x0;var _0x91cd13=_0x02d3[_0xc170c2];return _0x91cd13;};'use strict';var _=require(_0x302d('0x0'));var util=require('util');var moment=require(_0x302d('0x1'));var BPromise=require(_0x302d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x302d('0x3'));var db=require(_0x302d('0x4'))['db'];var utils=require(_0x302d('0x5'));var logger=require('../../config/logger')(_0x302d('0x6'));var config=require(_0x302d('0x7'));var jayson=require(_0x302d('0x8'));var client=jayson[_0x302d('0x9')][_0x302d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1568d6,_0x3f3fba,_0x431d2f){return new BPromise(function(_0x4f9541,_0x332e9e){return client['request'](_0x1568d6,_0x431d2f)[_0x302d('0xb')](function(_0x69e2d4){logger[_0x302d('0xc')](_0x302d('0xd'),_0x3f3fba,_0x302d('0xe'));logger[_0x302d('0xf')](_0x302d('0x10'),_0x3f3fba,_0x302d('0xe'),JSON[_0x302d('0x11')](_0x69e2d4));if(_0x69e2d4[_0x302d('0x12')]){if(_0x69e2d4[_0x302d('0x12')][_0x302d('0x13')]===0x1f4){logger[_0x302d('0x12')](_0x302d('0xd'),_0x3f3fba,_0x69e2d4[_0x302d('0x12')][_0x302d('0x14')]);return _0x332e9e(_0x69e2d4['error'][_0x302d('0x14')]);}logger[_0x302d('0x12')](_0x302d('0xd'),_0x3f3fba,_0x69e2d4[_0x302d('0x12')][_0x302d('0x14')]);return _0x4f9541(_0x69e2d4[_0x302d('0x12')][_0x302d('0x14')]);}else{logger[_0x302d('0xc')](_0x302d('0xd'),_0x3f3fba,_0x302d('0xe'));_0x4f9541(_0x69e2d4[_0x302d('0x15')][_0x302d('0x14')]);}})['catch'](function(_0xac4c3e){logger[_0x302d('0x12')](_0x302d('0xd'),_0x3f3fba,_0xac4c3e);_0x332e9e(_0xac4c3e);});});}exports[_0x302d('0x16')]=function(_0x2d3ed5){var _0x2f782c=this;return new Promise(function(_0x2293db,_0x4ffeea){return db['SmsQueueReport'][_0x302d('0x17')](_0x2d3ed5[_0x302d('0x18')],{'raw':_0x2d3ed5[_0x302d('0x19')]?_0x2d3ed5[_0x302d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x302d('0xb')](function(_0x4d26fb){logger['info']('CreateSmsQueueReport',_0x2d3ed5);logger[_0x302d('0xf')](_0x302d('0x16'),_0x2d3ed5,JSON['stringify'](_0x4d26fb));_0x2293db(_0x4d26fb);})[_0x302d('0x1a')](function(_0x5cf103){logger[_0x302d('0x12')](_0x302d('0x16'),_0x5cf103['message'],_0x2d3ed5);_0x4ffeea(_0x2f782c[_0x302d('0x12')](0x1f4,_0x5cf103[_0x302d('0x14')]));});});};exports[_0x302d('0x1b')]=function(_0x31bbca){var _0x100f41=this;return new Promise(function(_0x32f7bc,_0x1ea777){return db[_0x302d('0x1c')][_0x302d('0x1d')](_0x31bbca[_0x302d('0x18')],{'raw':_0x31bbca[_0x302d('0x19')]?_0x31bbca[_0x302d('0x19')][_0x302d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31bbca[_0x302d('0x19')]?_0x31bbca['options'][_0x302d('0x1f')]||null:null,'attributes':_0x31bbca[_0x302d('0x19')]?_0x31bbca[_0x302d('0x19')][_0x302d('0x20')]||null:null,'limit':_0x31bbca[_0x302d('0x19')]?_0x31bbca[_0x302d('0x19')][_0x302d('0x21')]||null:null})[_0x302d('0xb')](function(_0xa8c8b5){logger[_0x302d('0xc')](_0x302d('0x1b'),_0x31bbca);logger[_0x302d('0xf')](_0x302d('0x1b'),_0x31bbca,JSON['stringify'](_0xa8c8b5));_0x32f7bc(_0xa8c8b5);})[_0x302d('0x1a')](function(_0x807e87){logger[_0x302d('0x12')]('UpdateSmsQueueReport',_0x807e87['message'],_0x31bbca);_0x1ea777(_0x100f41[_0x302d('0x12')](0x1f4,_0x807e87['message']));});});}; \ No newline at end of file +var _0xcd17=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','SmsQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xcd17,0xb8));var _0x7cd1=function(_0x131bba,_0xb414b){_0x131bba=_0x131bba-0x0;var _0x4f2a38=_0xcd17[_0x131bba];return _0x4f2a38;};'use strict';var _=require(_0x7cd1('0x0'));var util=require(_0x7cd1('0x1'));var moment=require(_0x7cd1('0x2'));var BPromise=require(_0x7cd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cd1('0x4'));var db=require(_0x7cd1('0x5'))['db'];var utils=require(_0x7cd1('0x6'));var logger=require(_0x7cd1('0x7'))(_0x7cd1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7cd1('0x9')][_0x7cd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493413,_0x17b96d,_0x4d32c8){return new BPromise(function(_0x7a2c23,_0x47b965){return client['request'](_0x493413,_0x4d32c8)[_0x7cd1('0xb')](function(_0x405484){logger[_0x7cd1('0xc')](_0x7cd1('0xd'),_0x17b96d,_0x7cd1('0xe'));logger[_0x7cd1('0xf')](_0x7cd1('0x10'),_0x17b96d,'request\x20sent',JSON['stringify'](_0x405484));if(_0x405484[_0x7cd1('0x11')]){if(_0x405484[_0x7cd1('0x11')][_0x7cd1('0x12')]===0x1f4){logger['error'](_0x7cd1('0xd'),_0x17b96d,_0x405484[_0x7cd1('0x11')][_0x7cd1('0x13')]);return _0x47b965(_0x405484['error'][_0x7cd1('0x13')]);}logger[_0x7cd1('0x11')](_0x7cd1('0xd'),_0x17b96d,_0x405484[_0x7cd1('0x11')][_0x7cd1('0x13')]);return _0x7a2c23(_0x405484['error'][_0x7cd1('0x13')]);}else{logger[_0x7cd1('0xc')](_0x7cd1('0xd'),_0x17b96d,_0x7cd1('0xe'));_0x7a2c23(_0x405484[_0x7cd1('0x14')][_0x7cd1('0x13')]);}})[_0x7cd1('0x15')](function(_0x1509b0){logger[_0x7cd1('0x11')](_0x7cd1('0xd'),_0x17b96d,_0x1509b0);_0x47b965(_0x1509b0);});});}exports[_0x7cd1('0x16')]=function(_0x91224d){var _0x51f1aa=this;return new Promise(function(_0x41c907,_0x31759c){return db['SmsQueueReport'][_0x7cd1('0x17')](_0x91224d['body'],{'raw':_0x91224d[_0x7cd1('0x18')]?_0x91224d[_0x7cd1('0x18')][_0x7cd1('0x19')]===undefined?!![]:![]:!![]})[_0x7cd1('0xb')](function(_0x2fb5f8){logger['info']('CreateSmsQueueReport',_0x91224d);logger[_0x7cd1('0xf')](_0x7cd1('0x16'),_0x91224d,JSON[_0x7cd1('0x1a')](_0x2fb5f8));_0x41c907(_0x2fb5f8);})['catch'](function(_0x1ed5c0){logger[_0x7cd1('0x11')](_0x7cd1('0x16'),_0x1ed5c0[_0x7cd1('0x13')],_0x91224d);_0x31759c(_0x51f1aa['error'](0x1f4,_0x1ed5c0[_0x7cd1('0x13')]));});});};exports[_0x7cd1('0x1b')]=function(_0x78edce){var _0x33885a=this;return new Promise(function(_0x323a64,_0x418ae3){return db[_0x7cd1('0x1c')][_0x7cd1('0x1d')](_0x78edce[_0x7cd1('0x1e')],{'raw':_0x78edce[_0x7cd1('0x18')]?_0x78edce[_0x7cd1('0x18')][_0x7cd1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x78edce[_0x7cd1('0x18')]?_0x78edce[_0x7cd1('0x18')]['where']||null:null,'attributes':_0x78edce[_0x7cd1('0x18')]?_0x78edce['options'][_0x7cd1('0x1f')]||null:null,'limit':_0x78edce[_0x7cd1('0x18')]?_0x78edce[_0x7cd1('0x18')][_0x7cd1('0x20')]||null:null})[_0x7cd1('0xb')](function(_0x16fe5e){logger[_0x7cd1('0xc')](_0x7cd1('0x1b'),_0x78edce);logger[_0x7cd1('0xf')]('UpdateSmsQueueReport',_0x78edce,JSON[_0x7cd1('0x1a')](_0x16fe5e));_0x323a64(_0x16fe5e);})[_0x7cd1('0x15')](function(_0x17c6b8){logger[_0x7cd1('0x11')](_0x7cd1('0x1b'),_0x17c6b8['message'],_0x78edce);_0x418ae3(_0x33885a[_0x7cd1('0x11')](0x1f4,_0x17c6b8[_0x7cd1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 770e5d8..2d10570 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 _0x4300=['describe','/:id','show','post','put','update','delete','destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4300,0x1a6));var _0x0430=function(_0x282cf2,_0xca844c){_0x282cf2=_0x282cf2-0x0;var _0x5dada8=_0x4300[_0x282cf2];return _0x5dada8;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var fs_extra=require(_0x0430('0x2'));var auth=require(_0x0430('0x3'));var interaction=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var controller=require('./smsTransferReport.controller');router[_0x0430('0x6')]('/',auth['isAuthenticated'](),controller[_0x0430('0x7')]);router['get'](_0x0430('0x8'),auth[_0x0430('0x9')](),controller[_0x0430('0xa')]);router[_0x0430('0x6')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0xc')]);router[_0x0430('0xd')]('/',auth[_0x0430('0x9')](),controller['create']);router[_0x0430('0xe')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0xf')]);router[_0x0430('0x10')](_0x0430('0xb'),auth[_0x0430('0x9')](),controller[_0x0430('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1af3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x10fabb,_0xca68ec){var _0x4ecf53=function(_0x382ba3){while(--_0x382ba3){_0x10fabb['push'](_0x10fabb['shift']());}};_0x4ecf53(++_0xca68ec);}(_0x1af3,0x1ca));var _0x31af=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x1af3[_0x487ab4];return _0x3bef77;};'use strict';var multer=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var path=require(_0x31af('0x2'));var timeout=require(_0x31af('0x3'));var express=require(_0x31af('0x4'));var router=express[_0x31af('0x5')]();var fs_extra=require(_0x31af('0x6'));var auth=require(_0x31af('0x7'));var interaction=require(_0x31af('0x8'));var config=require(_0x31af('0x9'));var controller=require('./smsTransferReport.controller');router[_0x31af('0xa')]('/',auth[_0x31af('0xb')](),controller[_0x31af('0xc')]);router[_0x31af('0xa')]('/describe',auth[_0x31af('0xb')](),controller[_0x31af('0xd')]);router[_0x31af('0xa')]('/:id',auth[_0x31af('0xb')](),controller[_0x31af('0xe')]);router[_0x31af('0xf')]('/',auth[_0x31af('0xb')](),controller[_0x31af('0x10')]);router[_0x31af('0x11')](_0x31af('0x12'),auth[_0x31af('0xb')](),controller['update']);router[_0x31af('0x13')](_0x31af('0x12'),auth[_0x31af('0xb')](),controller[_0x31af('0x14')]);module[_0x31af('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ed7b968..928c13b 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2eb22a,_0x23697f){var _0x53859b=function(_0x32a77b){while(--_0x32a77b){_0x2eb22a['push'](_0x2eb22a['shift']());}};_0x53859b(++_0x23697f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0xcb91[_0x36bff5];return _0x80ade5;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x354cfc,_0x54f2d4){var _0x351f3c=function(_0x993a33){while(--_0x993a33){_0x354cfc['push'](_0x354cfc['shift']());}};_0x351f3c(++_0x54f2d4);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x4b84[_0x5b3950];return _0x41e436;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2a3b272..f5f7d0b 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 _0x17f1=['../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','then','destroy','stack','name','send','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','SmsTransferReport','includeAll','findAll','show','params','include','find','catch','body','update','describe','eml-format','rimraf','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/utils','../../config/license/util'];(function(_0x324b12,_0x86c735){var _0x46addd=function(_0x3285b4){while(--_0x3285b4){_0x324b12['push'](_0x324b12['shift']());}};_0x46addd(++_0x86c735);}(_0x17f1,0x19d));var _0x117f=function(_0x2f7f62,_0x48fa3a){_0x2f7f62=_0x2f7f62-0x0;var _0x477878=_0x17f1[_0x2f7f62];return _0x477878;};'use strict';var emlformat=require(_0x117f('0x0'));var rimraf=require(_0x117f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x117f('0x2'));var moment=require(_0x117f('0x3'));var BPromise=require(_0x117f('0x4'));var Mustache=require(_0x117f('0x5'));var util=require(_0x117f('0x6'));var path=require('path');var sox=require(_0x117f('0x7'));var csv=require(_0x117f('0x8'));var ejs=require(_0x117f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x117f('0xa'));var squel=require(_0x117f('0xb'));var crypto=require(_0x117f('0xc'));var jsforce=require(_0x117f('0xd'));var deskjs=require(_0x117f('0xe'));var toCsv=require(_0x117f('0x8'));var querystring=require(_0x117f('0xf'));var Papa=require(_0x117f('0x10'));var Redis=require(_0x117f('0x11'));var authService=require(_0x117f('0x12'));var qs=require(_0x117f('0x13'));var as=require(_0x117f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117f('0x15'))(_0x117f('0x16'));var utils=require(_0x117f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x117f('0x18'));var db=require(_0x117f('0x19'))['db'];function respondWithStatusCode(_0x2f225a,_0x2b65c4){_0x2b65c4=_0x2b65c4||0xcc;return function(_0x9e149d){if(_0x9e149d){return _0x2f225a[_0x117f('0x1a')](_0x2b65c4);}return _0x2f225a[_0x117f('0x1b')](_0x2b65c4)[_0x117f('0x1c')]();};}function respondWithResult(_0xd9c5d0,_0x25f1c4){_0x25f1c4=_0x25f1c4||0xc8;return function(_0x2faa4e){if(_0x2faa4e){return _0xd9c5d0[_0x117f('0x1b')](_0x25f1c4)['json'](_0x2faa4e);}};}function respondWithFilteredResult(_0x2734bd,_0x593c32){return function(_0x319c83){if(_0x319c83){var _0x58099e=typeof _0x593c32[_0x117f('0x1d')]==='undefined'&&typeof _0x593c32[_0x117f('0x1e')]===_0x117f('0x1f');var _0x403219=_0x319c83[_0x117f('0x20')];var _0x71bee1=_0x58099e?0x0:_0x593c32[_0x117f('0x1d')];var _0x464a21=_0x58099e?_0x319c83[_0x117f('0x20')]:_0x593c32[_0x117f('0x1d')]+_0x593c32[_0x117f('0x1e')];var _0x194bf4;if(_0x464a21>=_0x403219){_0x464a21=_0x403219;_0x194bf4=0xc8;}else{_0x194bf4=0xce;}_0x2734bd[_0x117f('0x1b')](_0x194bf4);return _0x2734bd['set'](_0x117f('0x21'),_0x71bee1+'-'+_0x464a21+'/'+_0x403219)[_0x117f('0x22')](_0x319c83);}return null;};}function patchUpdates(_0x30f44e){return function(_0x1ec830){try{jsonpatch['apply'](_0x1ec830,_0x30f44e,!![]);}catch(_0x3bb5a7){return BPromise[_0x117f('0x23')](_0x3bb5a7);}return _0x1ec830[_0x117f('0x24')]();};}function saveUpdates(_0x2d0720,_0x388073){return function(_0x2d869b){if(_0x2d869b){return _0x2d869b['update'](_0x2d0720)[_0x117f('0x25')](function(_0x454db8){return _0x454db8;});}return null;};}function removeEntity(_0xee61ac,_0x40f6de){return function(_0x6bfad9){if(_0x6bfad9){return _0x6bfad9[_0x117f('0x26')]()['then'](function(){_0xee61ac[_0x117f('0x1b')](0xcc)[_0x117f('0x1c')]();});}};}function handleEntityNotFound(_0x58b33f,_0x4a11cd){return function(_0x4e2fb5){if(!_0x4e2fb5){_0x58b33f['sendStatus'](0x194);}return _0x4e2fb5;};}function handleError(_0x170e6f,_0x477007){_0x477007=_0x477007||0x1f4;return function(_0x23d5fe){logger['error'](_0x23d5fe[_0x117f('0x27')]);if(_0x23d5fe['name']){delete _0x23d5fe[_0x117f('0x28')];}_0x170e6f['status'](_0x477007)[_0x117f('0x29')](_0x23d5fe);};}exports['index']=function(_0x390587,_0xcd3d15){var _0xe8aa68={},_0x35ebc2={},_0x31e262={'count':0x0,'rows':[]};var _0x132176=_['map'](db['SmsTransferReport'][_0x117f('0x2a')],function(_0x283f1e){return{'name':_0x283f1e[_0x117f('0x2b')],'type':_0x283f1e[_0x117f('0x2c')]['key']};});_0x35ebc2[_0x117f('0x2d')]=_['map'](_0x132176,_0x117f('0x28'));_0x35ebc2[_0x117f('0x2e')]=_[_0x117f('0x2f')](_0x390587[_0x117f('0x2e')]);_0x35ebc2[_0x117f('0x30')]=_[_0x117f('0x31')](_0x35ebc2['model'],_0x35ebc2[_0x117f('0x2e')]);_0xe8aa68[_0x117f('0x32')]=_['intersection'](_0x35ebc2[_0x117f('0x2d')],qs[_0x117f('0x33')](_0x390587[_0x117f('0x2e')][_0x117f('0x33')]));_0xe8aa68[_0x117f('0x32')]=_0xe8aa68[_0x117f('0x32')][_0x117f('0x34')]?_0xe8aa68[_0x117f('0x32')]:_0x35ebc2['model'];if(!_0x390587['query'][_0x117f('0x35')](_0x117f('0x36'))){_0xe8aa68['limit']=qs[_0x117f('0x1e')](_0x390587[_0x117f('0x2e')][_0x117f('0x1e')]);_0xe8aa68['offset']=qs['offset'](_0x390587[_0x117f('0x2e')]['offset']);}_0xe8aa68['order']=qs[_0x117f('0x37')](_0x390587['query'][_0x117f('0x37')]);_0xe8aa68[_0x117f('0x38')]=qs[_0x117f('0x30')](_[_0x117f('0x39')](_0x390587[_0x117f('0x2e')],_0x35ebc2[_0x117f('0x30')]),_0x132176);if(_0x390587[_0x117f('0x2e')][_0x117f('0x3a')]){_0xe8aa68[_0x117f('0x38')]=_[_0x117f('0x3b')](_0xe8aa68[_0x117f('0x38')],{'$or':_[_0x117f('0x3c')](_0x132176,function(_0x4ff5af){if(_0x4ff5af['type']!==_0x117f('0x3d')){var _0x406242={};_0x406242[_0x4ff5af[_0x117f('0x28')]]={'$like':'%'+_0x390587['query'][_0x117f('0x3a')]+'%'};return _0x406242;}})});}_0xe8aa68=_[_0x117f('0x3b')]({},_0xe8aa68,_0x390587['options']);var _0x54f5d2={'where':_0xe8aa68['where']};return db[_0x117f('0x3e')][_0x117f('0x20')](_0x54f5d2)[_0x117f('0x25')](function(_0x295873){_0x31e262['count']=_0x295873;if(_0x390587[_0x117f('0x2e')][_0x117f('0x3f')]){_0xe8aa68['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x117f('0x40')](_0xe8aa68);})[_0x117f('0x25')](function(_0xcd18fa){_0x31e262['rows']=_0xcd18fa;return _0x31e262;})[_0x117f('0x25')](respondWithFilteredResult(_0xcd3d15,_0xe8aa68))['catch'](handleError(_0xcd3d15,null));};exports[_0x117f('0x41')]=function(_0x2f6bbc,_0x45eec1){var _0x2c21f7={'raw':!![],'where':{'id':_0x2f6bbc[_0x117f('0x42')]['id']}},_0x2e44d0={};_0x2e44d0['model']=_['keys'](db[_0x117f('0x3e')][_0x117f('0x2a')]);_0x2e44d0[_0x117f('0x2e')]=_[_0x117f('0x2f')](_0x2f6bbc[_0x117f('0x2e')]);_0x2e44d0[_0x117f('0x30')]=_[_0x117f('0x31')](_0x2e44d0['model'],_0x2e44d0[_0x117f('0x2e')]);_0x2c21f7[_0x117f('0x32')]=_['intersection'](_0x2e44d0['model'],qs[_0x117f('0x33')](_0x2f6bbc[_0x117f('0x2e')][_0x117f('0x33')]));_0x2c21f7['attributes']=_0x2c21f7[_0x117f('0x32')][_0x117f('0x34')]?_0x2c21f7[_0x117f('0x32')]:_0x2e44d0[_0x117f('0x2d')];if(_0x2f6bbc[_0x117f('0x2e')]['includeAll']){_0x2c21f7[_0x117f('0x43')]=[{'all':!![]}];}_0x2c21f7=_[_0x117f('0x3b')]({},_0x2c21f7,_0x2f6bbc['options']);return db[_0x117f('0x3e')][_0x117f('0x44')](_0x2c21f7)[_0x117f('0x25')](handleEntityNotFound(_0x45eec1,null))[_0x117f('0x25')](respondWithResult(_0x45eec1,null))[_0x117f('0x45')](handleError(_0x45eec1,null));};exports['create']=function(_0x2b99ef,_0x3ae7e5){return db[_0x117f('0x3e')]['create'](_0x2b99ef[_0x117f('0x46')],{})[_0x117f('0x25')](respondWithResult(_0x3ae7e5,0xc9))[_0x117f('0x45')](handleError(_0x3ae7e5,null));};exports[_0x117f('0x47')]=function(_0x437fe0,_0x3f7493){if(_0x437fe0[_0x117f('0x46')]['id']){delete _0x437fe0[_0x117f('0x46')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x437fe0['params']['id']}})['then'](handleEntityNotFound(_0x3f7493,null))[_0x117f('0x25')](saveUpdates(_0x437fe0[_0x117f('0x46')],null))['then'](respondWithResult(_0x3f7493,null))[_0x117f('0x45')](handleError(_0x3f7493,null));};exports['destroy']=function(_0x447242,_0x13dda9){return db['SmsTransferReport'][_0x117f('0x44')]({'where':{'id':_0x447242[_0x117f('0x42')]['id']}})[_0x117f('0x25')](handleEntityNotFound(_0x13dda9,null))['then'](removeEntity(_0x13dda9,null))[_0x117f('0x45')](handleError(_0x13dda9,null));};exports[_0x117f('0x48')]=function(_0x5c1a5b,_0x21a825){return db[_0x117f('0x3e')]['describe']()['then'](respondWithResult(_0x21a825,null))[_0x117f('0x45')](handleError(_0x21a825,null));}; \ No newline at end of file +var _0xa283=['limit','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','describe','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count'];(function(_0x1715a2,_0x13d1d3){var _0x447fc1=function(_0x4ba3e4){while(--_0x4ba3e4){_0x1715a2['push'](_0x1715a2['shift']());}};_0x447fc1(++_0x13d1d3);}(_0xa283,0x1b0));var _0x3a28=function(_0x2f15ac,_0x4e9f44){_0x2f15ac=_0x2f15ac-0x0;var _0x5d39c4=_0xa283[_0x2f15ac];return _0x5d39c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a28('0x0'));var jsonpatch=require(_0x3a28('0x1'));var rp=require('request-promise');var moment=require(_0x3a28('0x2'));var BPromise=require(_0x3a28('0x3'));var Mustache=require('mustache');var util=require(_0x3a28('0x4'));var path=require(_0x3a28('0x5'));var sox=require(_0x3a28('0x6'));var csv=require(_0x3a28('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a28('0x8'));var _=require(_0x3a28('0x9'));var squel=require(_0x3a28('0xa'));var crypto=require(_0x3a28('0xb'));var jsforce=require(_0x3a28('0xc'));var deskjs=require(_0x3a28('0xd'));var toCsv=require(_0x3a28('0x7'));var querystring=require(_0x3a28('0xe'));var Papa=require(_0x3a28('0xf'));var Redis=require(_0x3a28('0x10'));var authService=require(_0x3a28('0x11'));var qs=require(_0x3a28('0x12'));var as=require(_0x3a28('0x13'));var hardwareService=require(_0x3a28('0x14'));var logger=require('../../config/logger')(_0x3a28('0x15'));var utils=require(_0x3a28('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3a28('0x17'));var db=require(_0x3a28('0x18'))['db'];function respondWithStatusCode(_0x5f460a,_0x10cd91){_0x10cd91=_0x10cd91||0xcc;return function(_0x45753b){if(_0x45753b){return _0x5f460a[_0x3a28('0x19')](_0x10cd91);}return _0x5f460a[_0x3a28('0x1a')](_0x10cd91)['end']();};}function respondWithResult(_0x4b9010,_0x42b17e){_0x42b17e=_0x42b17e||0xc8;return function(_0x36c462){if(_0x36c462){return _0x4b9010['status'](_0x42b17e)[_0x3a28('0x1b')](_0x36c462);}};}function respondWithFilteredResult(_0x2b98cd,_0x4e4dda){return function(_0x553f62){if(_0x553f62){var _0x5c87f6=typeof _0x4e4dda[_0x3a28('0x1c')]==='undefined'&&typeof _0x4e4dda['limit']==='undefined';var _0x48d2bd=_0x553f62[_0x3a28('0x1d')];var _0x183ec2=_0x5c87f6?0x0:_0x4e4dda[_0x3a28('0x1c')];var _0xb9e5a2=_0x5c87f6?_0x553f62['count']:_0x4e4dda[_0x3a28('0x1c')]+_0x4e4dda[_0x3a28('0x1e')];var _0x1ee534;if(_0xb9e5a2>=_0x48d2bd){_0xb9e5a2=_0x48d2bd;_0x1ee534=0xc8;}else{_0x1ee534=0xce;}_0x2b98cd[_0x3a28('0x1a')](_0x1ee534);return _0x2b98cd[_0x3a28('0x1f')](_0x3a28('0x20'),_0x183ec2+'-'+_0xb9e5a2+'/'+_0x48d2bd)[_0x3a28('0x1b')](_0x553f62);}return null;};}function patchUpdates(_0x402ab1){return function(_0x1231f2){try{jsonpatch['apply'](_0x1231f2,_0x402ab1,!![]);}catch(_0x3288df){return BPromise['reject'](_0x3288df);}return _0x1231f2[_0x3a28('0x21')]();};}function saveUpdates(_0x5f3394,_0x3eff32){return function(_0x5078b8){if(_0x5078b8){return _0x5078b8[_0x3a28('0x22')](_0x5f3394)[_0x3a28('0x23')](function(_0x445b0a){return _0x445b0a;});}return null;};}function removeEntity(_0x36913d,_0x204203){return function(_0x28955a){if(_0x28955a){return _0x28955a[_0x3a28('0x24')]()[_0x3a28('0x23')](function(){_0x36913d[_0x3a28('0x1a')](0xcc)[_0x3a28('0x25')]();});}};}function handleEntityNotFound(_0x4ee711,_0x95ca10){return function(_0x2d9748){if(!_0x2d9748){_0x4ee711[_0x3a28('0x19')](0x194);}return _0x2d9748;};}function handleError(_0x71ee9d,_0x2fb0bf){_0x2fb0bf=_0x2fb0bf||0x1f4;return function(_0x483293){logger['error'](_0x483293[_0x3a28('0x26')]);if(_0x483293['name']){delete _0x483293[_0x3a28('0x27')];}_0x71ee9d[_0x3a28('0x1a')](_0x2fb0bf)[_0x3a28('0x28')](_0x483293);};}exports[_0x3a28('0x29')]=function(_0x2095c3,_0x32cc7b){var _0x208b05={},_0x2af01f={},_0x4c2c04={'count':0x0,'rows':[]};var _0x25c643=_[_0x3a28('0x2a')](db[_0x3a28('0x2b')][_0x3a28('0x2c')],function(_0x3ab951){return{'name':_0x3ab951[_0x3a28('0x2d')],'type':_0x3ab951[_0x3a28('0x2e')][_0x3a28('0x2f')]};});_0x2af01f['model']=_[_0x3a28('0x2a')](_0x25c643,'name');_0x2af01f[_0x3a28('0x30')]=_[_0x3a28('0x31')](_0x2095c3[_0x3a28('0x30')]);_0x2af01f[_0x3a28('0x32')]=_[_0x3a28('0x33')](_0x2af01f[_0x3a28('0x34')],_0x2af01f[_0x3a28('0x30')]);_0x208b05[_0x3a28('0x35')]=_[_0x3a28('0x33')](_0x2af01f[_0x3a28('0x34')],qs[_0x3a28('0x36')](_0x2095c3['query']['fields']));_0x208b05[_0x3a28('0x35')]=_0x208b05[_0x3a28('0x35')]['length']?_0x208b05[_0x3a28('0x35')]:_0x2af01f[_0x3a28('0x34')];if(!_0x2095c3[_0x3a28('0x30')][_0x3a28('0x37')](_0x3a28('0x38'))){_0x208b05[_0x3a28('0x1e')]=qs[_0x3a28('0x1e')](_0x2095c3['query'][_0x3a28('0x1e')]);_0x208b05[_0x3a28('0x1c')]=qs['offset'](_0x2095c3[_0x3a28('0x30')]['offset']);}_0x208b05[_0x3a28('0x39')]=qs[_0x3a28('0x3a')](_0x2095c3['query'][_0x3a28('0x3a')]);_0x208b05['where']=qs[_0x3a28('0x32')](_[_0x3a28('0x3b')](_0x2095c3[_0x3a28('0x30')],_0x2af01f[_0x3a28('0x32')]),_0x25c643);if(_0x2095c3['query'][_0x3a28('0x3c')]){_0x208b05[_0x3a28('0x3d')]=_[_0x3a28('0x3e')](_0x208b05[_0x3a28('0x3d')],{'$or':_[_0x3a28('0x2a')](_0x25c643,function(_0x453163){if(_0x453163[_0x3a28('0x2e')]!==_0x3a28('0x3f')){var _0x305100={};_0x305100[_0x453163['name']]={'$like':'%'+_0x2095c3[_0x3a28('0x30')][_0x3a28('0x3c')]+'%'};return _0x305100;}})});}_0x208b05=_[_0x3a28('0x3e')]({},_0x208b05,_0x2095c3[_0x3a28('0x40')]);var _0x2c0d4c={'where':_0x208b05[_0x3a28('0x3d')]};return db['SmsTransferReport'][_0x3a28('0x1d')](_0x2c0d4c)[_0x3a28('0x23')](function(_0x26e83f){_0x4c2c04[_0x3a28('0x1d')]=_0x26e83f;if(_0x2095c3[_0x3a28('0x30')][_0x3a28('0x41')]){_0x208b05[_0x3a28('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x3a28('0x43')](_0x208b05);})[_0x3a28('0x23')](function(_0x20ef66){_0x4c2c04[_0x3a28('0x44')]=_0x20ef66;return _0x4c2c04;})[_0x3a28('0x23')](respondWithFilteredResult(_0x32cc7b,_0x208b05))['catch'](handleError(_0x32cc7b,null));};exports[_0x3a28('0x45')]=function(_0x5ee6a6,_0xa2c53d){var _0x1a4f92={'raw':!![],'where':{'id':_0x5ee6a6[_0x3a28('0x46')]['id']}},_0x1c68aa={};_0x1c68aa[_0x3a28('0x34')]=_['keys'](db[_0x3a28('0x2b')][_0x3a28('0x2c')]);_0x1c68aa[_0x3a28('0x30')]=_[_0x3a28('0x31')](_0x5ee6a6['query']);_0x1c68aa[_0x3a28('0x32')]=_[_0x3a28('0x33')](_0x1c68aa['model'],_0x1c68aa['query']);_0x1a4f92['attributes']=_['intersection'](_0x1c68aa[_0x3a28('0x34')],qs['fields'](_0x5ee6a6[_0x3a28('0x30')][_0x3a28('0x36')]));_0x1a4f92['attributes']=_0x1a4f92['attributes'][_0x3a28('0x47')]?_0x1a4f92[_0x3a28('0x35')]:_0x1c68aa['model'];if(_0x5ee6a6[_0x3a28('0x30')][_0x3a28('0x41')]){_0x1a4f92[_0x3a28('0x42')]=[{'all':!![]}];}_0x1a4f92=_[_0x3a28('0x3e')]({},_0x1a4f92,_0x5ee6a6['options']);return db[_0x3a28('0x2b')]['find'](_0x1a4f92)[_0x3a28('0x23')](handleEntityNotFound(_0xa2c53d,null))[_0x3a28('0x23')](respondWithResult(_0xa2c53d,null))[_0x3a28('0x48')](handleError(_0xa2c53d,null));};exports[_0x3a28('0x49')]=function(_0xb2fe53,_0x2d0b0e){return db['SmsTransferReport'][_0x3a28('0x49')](_0xb2fe53[_0x3a28('0x4a')],{})[_0x3a28('0x23')](respondWithResult(_0x2d0b0e,0xc9))[_0x3a28('0x48')](handleError(_0x2d0b0e,null));};exports['update']=function(_0x545e0a,_0x377063){if(_0x545e0a['body']['id']){delete _0x545e0a[_0x3a28('0x4a')]['id'];}return db[_0x3a28('0x2b')][_0x3a28('0x4b')]({'where':{'id':_0x545e0a[_0x3a28('0x46')]['id']}})['then'](handleEntityNotFound(_0x377063,null))['then'](saveUpdates(_0x545e0a[_0x3a28('0x4a')],null))[_0x3a28('0x23')](respondWithResult(_0x377063,null))[_0x3a28('0x48')](handleError(_0x377063,null));};exports['destroy']=function(_0x2412a7,_0x3f25b5){return db[_0x3a28('0x2b')][_0x3a28('0x4b')]({'where':{'id':_0x2412a7[_0x3a28('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f25b5,null))[_0x3a28('0x23')](removeEntity(_0x3f25b5,null))['catch'](handleError(_0x3f25b5,null));};exports[_0x3a28('0x4c')]=function(_0x470073,_0x1e0b40){return db[_0x3a28('0x2b')][_0x3a28('0x4c')]()[_0x3a28('0x23')](respondWithResult(_0x1e0b40,null))[_0x3a28('0x48')](handleError(_0x1e0b40,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a3195d8..1b9a978 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 _0x22f6=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x22f6,0x10e));var _0x622f=function(_0x4f9d1f,_0x45682b){_0x4f9d1f=_0x4f9d1f-0x0;var _0x3ce0b5=_0x22f6[_0x4f9d1f];return _0x3ce0b5;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[{'name':_0x622f('0xc'),'fields':[_0x622f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf675=['SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./smsTransferReport.attributes','exports'];(function(_0x41ab16,_0x4157d4){var _0x5a58d8=function(_0x4dbd9c){while(--_0x4dbd9c){_0x41ab16['push'](_0x41ab16['shift']());}};_0x5a58d8(++_0x4157d4);}(_0xf675,0x199));var _0x5f67=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0xf675[_0x531e48];return _0x202971;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require(_0x5f67('0x2'))('api');var moment=require(_0x5f67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f67('0x4'));var fs=require('fs');var path=require(_0x5f67('0x5'));var rimraf=require(_0x5f67('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module[_0x5f67('0x8')]=function(_0x2919cc,_0xd4b727){return _0x2919cc['define'](_0x5f67('0x9'),attributes,{'tableName':_0x5f67('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3c49f84..54d37f5 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 _0x4e00=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x20c205,_0x39bc5e){var _0x3d6cf2=function(_0x209286){while(--_0x209286){_0x20c205['push'](_0x20c205['shift']());}};_0x3d6cf2(++_0x39bc5e);}(_0x4e00,0xa0));var _0x04e0=function(_0x3898a9,_0x19c09b){_0x3898a9=_0x3898a9-0x0;var _0x4d1028=_0x4e00[_0x3898a9];return _0x4d1028;};'use strict';var _=require('lodash');var util=require(_0x04e0('0x0'));var moment=require('moment');var BPromise=require(_0x04e0('0x1'));var rs=require(_0x04e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x04e0('0x3'));var logger=require('../../config/logger')(_0x04e0('0x4'));var config=require(_0x04e0('0x5'));var jayson=require(_0x04e0('0x6'));var client=jayson[_0x04e0('0x7')][_0x04e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42521b,_0x45ed1b,_0x4c3fb0){return new BPromise(function(_0x10cada,_0x3a47a6){return client[_0x04e0('0x9')](_0x42521b,_0x4c3fb0)[_0x04e0('0xa')](function(_0x553f83){logger[_0x04e0('0xb')](_0x04e0('0xc'),_0x45ed1b,'request\x20sent');logger['debug'](_0x04e0('0xd'),_0x45ed1b,'request\x20sent',JSON[_0x04e0('0xe')](_0x553f83));if(_0x553f83[_0x04e0('0xf')]){if(_0x553f83[_0x04e0('0xf')][_0x04e0('0x10')]===0x1f4){logger[_0x04e0('0xf')](_0x04e0('0xc'),_0x45ed1b,_0x553f83[_0x04e0('0xf')][_0x04e0('0x11')]);return _0x3a47a6(_0x553f83['error'][_0x04e0('0x11')]);}logger['error'](_0x04e0('0xc'),_0x45ed1b,_0x553f83[_0x04e0('0xf')][_0x04e0('0x11')]);return _0x10cada(_0x553f83['error'][_0x04e0('0x11')]);}else{logger[_0x04e0('0xb')](_0x04e0('0xc'),_0x45ed1b,_0x04e0('0x12'));_0x10cada(_0x553f83[_0x04e0('0x13')][_0x04e0('0x11')]);}})[_0x04e0('0x14')](function(_0x2cacbc){logger[_0x04e0('0xf')](_0x04e0('0xc'),_0x45ed1b,_0x2cacbc);_0x3a47a6(_0x2cacbc);});});} \ No newline at end of file +var _0x3468=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3468,0x8d));var _0x8346=function(_0x1a6649,_0x13ceeb){_0x1a6649=_0x1a6649-0x0;var _0xf093cd=_0x3468[_0x1a6649];return _0xf093cd;};'use strict';var _=require(_0x8346('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8346('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8346('0x2'))['db'];var utils=require(_0x8346('0x3'));var logger=require(_0x8346('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8346('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d86e,_0x35d758,_0xb88b69){return new BPromise(function(_0x2a3029,_0x2d7dc6){return client[_0x8346('0x6')](_0x25d86e,_0xb88b69)[_0x8346('0x7')](function(_0x2b36ae){logger[_0x8346('0x8')](_0x8346('0x9'),_0x35d758,_0x8346('0xa'));logger[_0x8346('0xb')](_0x8346('0xc'),_0x35d758,'request\x20sent',JSON[_0x8346('0xd')](_0x2b36ae));if(_0x2b36ae[_0x8346('0xe')]){if(_0x2b36ae[_0x8346('0xe')][_0x8346('0xf')]===0x1f4){logger[_0x8346('0xe')](_0x8346('0x9'),_0x35d758,_0x2b36ae['error'][_0x8346('0x10')]);return _0x2d7dc6(_0x2b36ae[_0x8346('0xe')][_0x8346('0x10')]);}logger[_0x8346('0xe')](_0x8346('0x9'),_0x35d758,_0x2b36ae[_0x8346('0xe')][_0x8346('0x10')]);return _0x2a3029(_0x2b36ae['error'][_0x8346('0x10')]);}else{logger['info'](_0x8346('0x9'),_0x35d758,'request\x20sent');_0x2a3029(_0x2b36ae[_0x8346('0x11')]['message']);}})[_0x8346('0x12')](function(_0x4c6aee){logger['error'](_0x8346('0x9'),_0x35d758,_0x4c6aee);_0x2d7dc6(_0x4c6aee);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 766d5c5..453897c 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 _0xd2e3=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','file','create','put'];(function(_0x15dc14,_0x45ad25){var _0x1a4954=function(_0x32a722){while(--_0x32a722){_0x15dc14['push'](_0x15dc14['shift']());}};_0x1a4954(++_0x45ad25);}(_0xd2e3,0x183));var _0x3d2e=function(_0x283340,_0x5239bc){_0x283340=_0x283340-0x0;var _0x5c0f29=_0xd2e3[_0x283340];return _0x5c0f29;};'use strict';var multer=require(_0x3d2e('0x0'));var util=require(_0x3d2e('0x1'));var path=require(_0x3d2e('0x2'));var timeout=require(_0x3d2e('0x3'));var express=require(_0x3d2e('0x4'));var router=express[_0x3d2e('0x5')]();var fs_extra=require(_0x3d2e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3d2e('0x7'));var config=require('../../config/environment');var controller=require(_0x3d2e('0x8'));router[_0x3d2e('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d2e('0xa')]);router[_0x3d2e('0x9')](_0x3d2e('0xb'),auth[_0x3d2e('0xc')](),controller[_0x3d2e('0xd')]);router[_0x3d2e('0x9')](_0x3d2e('0xe'),auth[_0x3d2e('0xc')](),controller[_0x3d2e('0xf')]);var upload=multer({'storage':multer[_0x3d2e('0x10')]({'destination':function(_0x57f750,_0x5954ae,_0xf54804){_0xf54804(null,path[_0x3d2e('0x11')](config[_0x3d2e('0x12')],_0x3d2e('0x13')));},'filename':function(_0x2a9f6d,_0x3d7894,_0x26b867){_0x3d7894[_0x3d2e('0x14')]=_0x3d7894[_0x3d2e('0x14')][_0x3d2e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26b867(null,util[_0x3d2e('0x16')](_0x3d2e('0x17'),path[_0x3d2e('0x18')](_0x3d7894[_0x3d2e('0x14')],path['extname'](_0x3d7894[_0x3d2e('0x14')])),Date[_0x3d2e('0x19')](),path['extname'](_0x3d7894[_0x3d2e('0x14')])));}})});router['post']('/',upload['single'](_0x3d2e('0x1a')),controller[_0x3d2e('0x1b')]);router[_0x3d2e('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x3d2e('0x1d')]);router[_0x3d2e('0x1e')](_0x3d2e('0xb'),auth['isAuthenticated'](),controller[_0x3d2e('0x1e')]);module[_0x3d2e('0x1f')]=router; \ No newline at end of file +var _0xccff=['../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','put','/:id','update','delete','multer','path','express','Router','fs-extra'];(function(_0x492fad,_0x3a4b8d){var _0x69573c=function(_0x5bb9f9){while(--_0x5bb9f9){_0x492fad['push'](_0x492fad['shift']());}};_0x69573c(++_0x3a4b8d);}(_0xccff,0x1ad));var _0xfccf=function(_0x1ca993,_0x243c1e){_0x1ca993=_0x1ca993-0x0;var _0x150e5e=_0xccff[_0x1ca993];return _0x150e5e;};'use strict';var multer=require(_0xfccf('0x0'));var util=require('util');var path=require(_0xfccf('0x1'));var timeout=require('connect-timeout');var express=require(_0xfccf('0x2'));var router=express[_0xfccf('0x3')]();var fs_extra=require(_0xfccf('0x4'));var auth=require(_0xfccf('0x5'));var interaction=require(_0xfccf('0x6'));var config=require(_0xfccf('0x7'));var controller=require(_0xfccf('0x8'));router[_0xfccf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfccf('0x9')]('/:id',auth[_0xfccf('0xa')](),controller[_0xfccf('0xb')]);router['get'](_0xfccf('0xc'),auth[_0xfccf('0xa')](),controller[_0xfccf('0xd')]);var upload=multer({'storage':multer[_0xfccf('0xe')]({'destination':function(_0x234992,_0x4366bf,_0x350f92){_0x350f92(null,path[_0xfccf('0xf')](config[_0xfccf('0x10')],_0xfccf('0x11')));},'filename':function(_0x15f5ec,_0x29f5f0,_0x4d27d3){_0x29f5f0[_0xfccf('0x12')]=_0x29f5f0[_0xfccf('0x12')][_0xfccf('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d27d3(null,util[_0xfccf('0x14')](_0xfccf('0x15'),path[_0xfccf('0x16')](_0x29f5f0['originalname'],path[_0xfccf('0x17')](_0x29f5f0[_0xfccf('0x12')])),Date['now'](),path['extname'](_0x29f5f0['originalname'])));}})});router[_0xfccf('0x18')]('/',upload[_0xfccf('0x19')](_0xfccf('0x1a')),controller['create']);router[_0xfccf('0x1b')](_0xfccf('0x1c'),auth[_0xfccf('0xa')](),controller[_0xfccf('0x1d')]);router[_0xfccf('0x1e')](_0xfccf('0x1c'),auth['isAuthenticated'](),controller[_0xfccf('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 774ddcb..477cc7c 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 _0x9c04=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x22cc92,_0x428489){var _0x3ec769=function(_0x3a925d){while(--_0x3a925d){_0x22cc92['push'](_0x22cc92['shift']());}};_0x3ec769(++_0x428489);}(_0x9c04,0xe3));var _0x49c0=function(_0x701566,_0x7de6cb){_0x701566=_0x701566-0x0;var _0x64b6c9=_0x9c04[_0x701566];return _0x64b6c9;};'use strict';var Sequelize=require(_0x49c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x49c0('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x49c0('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x49c0('0x2')]},'original_duration':{'type':Sequelize[_0x49c0('0x3')]},'original_sampleCount':{'type':Sequelize[_0x49c0('0x4')]},'original_channelCount':{'type':Sequelize[_0x49c0('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x49c0('0x5')]},'converted_format':{'type':Sequelize[_0x49c0('0x2')]},'converted_duration':{'type':Sequelize[_0x49c0('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x49c0('0x4')]},'converted_channelCount':{'type':Sequelize[_0x49c0('0x5')]},'converted_bitRate':{'type':Sequelize[_0x49c0('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x00a9=['INTEGER','FLOAT','BIGINT','sequelize','exports','STRING'];(function(_0x4c9ca8,_0x455dce){var _0x4e3513=function(_0x18d20f){while(--_0x18d20f){_0x4c9ca8['push'](_0x4c9ca8['shift']());}};_0x4e3513(++_0x455dce);}(_0x00a9,0x1a7));var _0x900a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x00a9[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x900a('0x0'));module[_0x900a('0x1')]={'name':{'type':Sequelize[_0x900a('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x900a('0x2')]},'display_name':{'type':Sequelize[_0x900a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x900a('0x2')]},'original_format':{'type':Sequelize[_0x900a('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x900a('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x900a('0x3')]},'converted_format':{'type':Sequelize[_0x900a('0x2')]},'converted_duration':{'type':Sequelize[_0x900a('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x900a('0x5')]},'converted_channelCount':{'type':Sequelize[_0x900a('0x3')]},'converted_bitRate':{'type':Sequelize[_0x900a('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x900a('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1df7754..bc782de 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 _0xa396=['converted_sampleCount','converted_channelCount','converted_bitRate','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','apply','reject','update','then','destroy','get','Sounds','error','stack','name','send','Sound','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','map','includeAll','include','rows','catch','show','keys','options','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration'];(function(_0x212d90,_0x3d0bac){var _0x546d43=function(_0x29a5f4){while(--_0x29a5f4){_0x212d90['push'](_0x212d90['shift']());}};_0x546d43(++_0x3d0bac);}(_0xa396,0x182));var _0x6a39=function(_0x12ab01,_0x37d8e2){_0x12ab01=_0x12ab01-0x0;var _0x24e2f9=_0xa396[_0x12ab01];return _0x24e2f9;};'use strict';var emlformat=require(_0x6a39('0x0'));var rimraf=require(_0x6a39('0x1'));var zipdir=require(_0x6a39('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a39('0x3'));var moment=require(_0x6a39('0x4'));var BPromise=require(_0x6a39('0x5'));var Mustache=require(_0x6a39('0x6'));var util=require(_0x6a39('0x7'));var path=require(_0x6a39('0x8'));var sox=require(_0x6a39('0x9'));var csv=require(_0x6a39('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a39('0xb'));var squel=require(_0x6a39('0xc'));var crypto=require(_0x6a39('0xd'));var jsforce=require(_0x6a39('0xe'));var deskjs=require(_0x6a39('0xf'));var toCsv=require(_0x6a39('0xa'));var querystring=require(_0x6a39('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a39('0x11'));var authService=require(_0x6a39('0x12'));var qs=require(_0x6a39('0x13'));var as=require(_0x6a39('0x14'));var hardwareService=require(_0x6a39('0x15'));var logger=require(_0x6a39('0x16'))(_0x6a39('0x17'));var utils=require(_0x6a39('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6a39('0x19'));var db=require(_0x6a39('0x1a'))['db'];function respondWithStatusCode(_0x5d23b1,_0x48b5cd){_0x48b5cd=_0x48b5cd||0xcc;return function(_0x1bb426){if(_0x1bb426){return _0x5d23b1['sendStatus'](_0x48b5cd);}return _0x5d23b1['status'](_0x48b5cd)[_0x6a39('0x1b')]();};}function respondWithResult(_0x36de47,_0x2fe959){_0x2fe959=_0x2fe959||0xc8;return function(_0x1a59fd){if(_0x1a59fd){return _0x36de47[_0x6a39('0x1c')](_0x2fe959)[_0x6a39('0x1d')](_0x1a59fd);}};}function respondWithFilteredResult(_0x53a07b,_0x29df98){return function(_0x5b1e71){if(_0x5b1e71){var _0x78787c=typeof _0x29df98[_0x6a39('0x1e')]===_0x6a39('0x1f')&&typeof _0x29df98['limit']==='undefined';var _0x414ca6=_0x5b1e71['count'];var _0x40bdef=_0x78787c?0x0:_0x29df98[_0x6a39('0x1e')];var _0x1f89fa=_0x78787c?_0x5b1e71[_0x6a39('0x20')]:_0x29df98[_0x6a39('0x1e')]+_0x29df98['limit'];var _0x577b73;if(_0x1f89fa>=_0x414ca6){_0x1f89fa=_0x414ca6;_0x577b73=0xc8;}else{_0x577b73=0xce;}_0x53a07b['status'](_0x577b73);return _0x53a07b['set']('Content-Range',_0x40bdef+'-'+_0x1f89fa+'/'+_0x414ca6)['json'](_0x5b1e71);}return null;};}function patchUpdates(_0x2e8d1d){return function(_0x491c89){try{jsonpatch[_0x6a39('0x21')](_0x491c89,_0x2e8d1d,!![]);}catch(_0xcd4ec){return BPromise[_0x6a39('0x22')](_0xcd4ec);}return _0x491c89['save']();};}function saveUpdates(_0x33e3a7,_0x5867a3){return function(_0x2284d7){if(_0x2284d7){return _0x2284d7[_0x6a39('0x23')](_0x33e3a7)[_0x6a39('0x24')](function(_0x5ac238){return _0x5ac238;});}return null;};}function removeEntity(_0x1aa5af,_0x234abb){return function(_0x3da263){if(_0x3da263){return _0x3da263[_0x6a39('0x25')]()[_0x6a39('0x24')](function(){var _0x1efe28=_0x3da263[_0x6a39('0x26')]({'plain':!![]});var _0x4a4010=_0x6a39('0x27');return db['UserProfileResource'][_0x6a39('0x25')]({'where':{'type':_0x4a4010,'resourceId':_0x1efe28['id']}})[_0x6a39('0x24')](function(){return _0x3da263;});})[_0x6a39('0x24')](function(){_0x1aa5af['status'](0xcc)[_0x6a39('0x1b')]();});}};}function handleEntityNotFound(_0x249d35,_0x44a9c8){return function(_0x3fd04f){if(!_0x3fd04f){_0x249d35['sendStatus'](0x194);}return _0x3fd04f;};}function handleError(_0x2790fc,_0x4c978a){_0x4c978a=_0x4c978a||0x1f4;return function(_0x52cebd){logger[_0x6a39('0x28')](_0x52cebd[_0x6a39('0x29')]);if(_0x52cebd[_0x6a39('0x2a')]){delete _0x52cebd[_0x6a39('0x2a')];}_0x2790fc['status'](_0x4c978a)[_0x6a39('0x2b')](_0x52cebd);};}exports['index']=function(_0x18204e,_0x391e88){var _0x3fe2ff={},_0x422463={},_0x5f3c7e={'count':0x0,'rows':[]};var _0x80540b=_['map'](db[_0x6a39('0x2c')][_0x6a39('0x2d')],function(_0x34813f){return{'name':_0x34813f['fieldName'],'type':_0x34813f[_0x6a39('0x2e')][_0x6a39('0x2f')]};});_0x422463['model']=_['map'](_0x80540b,'name');_0x422463[_0x6a39('0x30')]=_['keys'](_0x18204e[_0x6a39('0x30')]);_0x422463[_0x6a39('0x31')]=_[_0x6a39('0x32')](_0x422463[_0x6a39('0x33')],_0x422463['query']);_0x3fe2ff[_0x6a39('0x34')]=_[_0x6a39('0x32')](_0x422463[_0x6a39('0x33')],qs[_0x6a39('0x35')](_0x18204e[_0x6a39('0x30')][_0x6a39('0x35')]));_0x3fe2ff[_0x6a39('0x34')]=_0x3fe2ff[_0x6a39('0x34')][_0x6a39('0x36')]?_0x3fe2ff['attributes']:_0x422463[_0x6a39('0x33')];if(!_0x18204e[_0x6a39('0x30')][_0x6a39('0x37')](_0x6a39('0x38'))){_0x3fe2ff[_0x6a39('0x39')]=qs[_0x6a39('0x39')](_0x18204e[_0x6a39('0x30')]['limit']);_0x3fe2ff['offset']=qs[_0x6a39('0x1e')](_0x18204e[_0x6a39('0x30')][_0x6a39('0x1e')]);}_0x3fe2ff[_0x6a39('0x3a')]=qs['sort'](_0x18204e[_0x6a39('0x30')][_0x6a39('0x3b')]);_0x3fe2ff['where']=qs['filters'](_[_0x6a39('0x3c')](_0x18204e[_0x6a39('0x30')],_0x422463[_0x6a39('0x31')]),_0x80540b);if(_0x18204e[_0x6a39('0x30')][_0x6a39('0x3d')]){_0x3fe2ff[_0x6a39('0x3e')]=_[_0x6a39('0x3f')](_0x3fe2ff['where'],{'$or':_[_0x6a39('0x40')](_0x80540b,function(_0x1ce9a9){if(_0x1ce9a9['type']!=='VIRTUAL'){var _0x587602={};_0x587602[_0x1ce9a9[_0x6a39('0x2a')]]={'$like':'%'+_0x18204e[_0x6a39('0x30')][_0x6a39('0x3d')]+'%'};return _0x587602;}})});}_0x3fe2ff=_[_0x6a39('0x3f')]({},_0x3fe2ff,_0x18204e['options']);var _0x48d316={'where':_0x3fe2ff[_0x6a39('0x3e')]};return db[_0x6a39('0x2c')][_0x6a39('0x20')](_0x48d316)[_0x6a39('0x24')](function(_0x3c3f8b){_0x5f3c7e[_0x6a39('0x20')]=_0x3c3f8b;if(_0x18204e['query'][_0x6a39('0x41')]){_0x3fe2ff[_0x6a39('0x42')]=[{'all':!![]}];}return db[_0x6a39('0x2c')]['findAll'](_0x3fe2ff);})[_0x6a39('0x24')](function(_0x2734b){_0x5f3c7e[_0x6a39('0x43')]=_0x2734b;return _0x5f3c7e;})['then'](respondWithFilteredResult(_0x391e88,_0x3fe2ff))[_0x6a39('0x44')](handleError(_0x391e88,null));};exports[_0x6a39('0x45')]=function(_0x45ba3b,_0x473ea1){var _0x418a90={'raw':!![],'where':{'id':_0x45ba3b['params']['id']}},_0x28d3ee={};_0x28d3ee['model']=_[_0x6a39('0x46')](db[_0x6a39('0x2c')][_0x6a39('0x2d')]);_0x28d3ee[_0x6a39('0x30')]=_[_0x6a39('0x46')](_0x45ba3b[_0x6a39('0x30')]);_0x28d3ee['filters']=_[_0x6a39('0x32')](_0x28d3ee[_0x6a39('0x33')],_0x28d3ee[_0x6a39('0x30')]);_0x418a90[_0x6a39('0x34')]=_[_0x6a39('0x32')](_0x28d3ee[_0x6a39('0x33')],qs[_0x6a39('0x35')](_0x45ba3b[_0x6a39('0x30')][_0x6a39('0x35')]));_0x418a90[_0x6a39('0x34')]=_0x418a90[_0x6a39('0x34')][_0x6a39('0x36')]?_0x418a90[_0x6a39('0x34')]:_0x28d3ee[_0x6a39('0x33')];if(_0x45ba3b[_0x6a39('0x30')]['includeAll']){_0x418a90[_0x6a39('0x42')]=[{'all':!![]}];}_0x418a90=_[_0x6a39('0x3f')]({},_0x418a90,_0x45ba3b[_0x6a39('0x47')]);return db['Sound'][_0x6a39('0x48')](_0x418a90)[_0x6a39('0x24')](handleEntityNotFound(_0x473ea1,null))[_0x6a39('0x24')](respondWithResult(_0x473ea1,null))['catch'](handleError(_0x473ea1,null));};exports[_0x6a39('0x49')]=function(_0xdca18c,_0x23623e,_0x521721){return db[_0x6a39('0x2c')][_0x6a39('0x48')]({'where':{'id':_0xdca18c[_0x6a39('0x4a')]['id']},'attributes':[_0x6a39('0x2a'),_0x6a39('0x4b'),_0x6a39('0x4c')],'raw':!![]})[_0x6a39('0x24')](handleEntityNotFound(_0x23623e,null))[_0x6a39('0x24')](function(_0x39f27b){if(_0x39f27b){if(!fs[_0x6a39('0x4d')](path[_0x6a39('0x4e')](config[_0x6a39('0x4f')],_0x6a39('0x50'),_0x39f27b['save_name']+'.'+_0x39f27b[_0x6a39('0x4c')]))){throw new db[(_0x6a39('0x51'))][(_0x6a39('0x52'))](_0x6a39('0x53'));}return _0x23623e['download'](path[_0x6a39('0x4e')](config[_0x6a39('0x4f')],_0x6a39('0x50'),util[_0x6a39('0x54')](_0x6a39('0x55'),_0x39f27b[_0x6a39('0x4b')],_0x39f27b[_0x6a39('0x4c')])),util[_0x6a39('0x54')](_0x6a39('0x55'),_0x39f27b['name'],_0x39f27b[_0x6a39('0x4c')]));}return null;})[_0x6a39('0x44')](handleError(_0x23623e,null));};exports['create']=function(_0x54101b,_0x13f3d8,_0x1c6c04){var _0x241373={'name':path[_0x6a39('0x56')](_0x54101b['file'][_0x6a39('0x57')],path[_0x6a39('0x58')](_0x54101b[_0x6a39('0x59')][_0x6a39('0x57')])),'save_name':path[_0x6a39('0x56')](_0x54101b[_0x6a39('0x59')][_0x6a39('0x5a')],path['extname'](_0x54101b[_0x6a39('0x59')][_0x6a39('0x5a')])),'original_format':path[_0x6a39('0x58')](_0x54101b[_0x6a39('0x59')][_0x6a39('0x57')])[_0x6a39('0x5b')](0x1),'converted_format':_0x6a39('0x5c')};var _0x234f7a=path[_0x6a39('0x4e')](config[_0x6a39('0x4f')],_0x6a39('0x5d'),_0x54101b[_0x6a39('0x59')][_0x6a39('0x5a')]);var _0x5c9734=path['join'](config[_0x6a39('0x4f')],_0x6a39('0x50'),util[_0x6a39('0x54')](_0x6a39('0x55'),path[_0x6a39('0x56')](_0x54101b[_0x6a39('0x59')][_0x6a39('0x5a')],path[_0x6a39('0x58')](_0x54101b['file'][_0x6a39('0x5a')])),_0x241373[_0x6a39('0x4c')]));logger['info'](_0x6a39('0x5e'),_0x234f7a);logger[_0x6a39('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x5c9734);try{fs[_0x6a39('0x60')](_0x234f7a,parseInt(_0x6a39('0x61'),0x8));var _0x187e6c=sox[_0x6a39('0x62')](_0x234f7a,_0x5c9734,{'sampleRate':0x1f40,'format':_0x6a39('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x187e6c['on'](_0x6a39('0x28'),function(_0x47c799){fs[_0x6a39('0x63')](_0x234f7a);_0x13f3d8[_0x6a39('0x1c')](0x1f4)[_0x6a39('0x2b')](_0x47c799);});_0x187e6c['on'](_0x6a39('0x64'),function(_0x293aa1){_0x241373['original_duration']=isNaN(_0x293aa1['duration'])?null:_0x293aa1[_0x6a39('0x65')]*0x3e8;_0x241373['original_sampleCount']=isNaN(_0x293aa1[_0x6a39('0x66')])?null:_0x293aa1['sampleCount'];_0x241373[_0x6a39('0x67')]=isNaN(_0x293aa1[_0x6a39('0x68')])?null:_0x293aa1[_0x6a39('0x68')];_0x241373['original_bitRate']=isNaN(_0x293aa1['bitRate'])?null:_0x293aa1[_0x6a39('0x69')];_0x241373[_0x6a39('0x6a')]=isNaN(_0x293aa1[_0x6a39('0x6b')])?null:_0x293aa1[_0x6a39('0x6b')];});_0x187e6c['on'](_0x6a39('0x6c'),function(_0x461dc1){_0x241373[_0x6a39('0x6d')]=isNaN(_0x461dc1[_0x6a39('0x65')])?null:_0x461dc1['duration']*0x3e8;_0x241373[_0x6a39('0x6e')]=isNaN(_0x461dc1[_0x6a39('0x66')])?null:_0x461dc1[_0x6a39('0x66')];_0x241373[_0x6a39('0x6f')]=isNaN(_0x461dc1[_0x6a39('0x68')])?null:_0x461dc1[_0x6a39('0x68')];_0x241373[_0x6a39('0x70')]=isNaN(_0x461dc1[_0x6a39('0x69')])?null:_0x461dc1[_0x6a39('0x69')];_0x241373['converted_sampleRate']=isNaN(_0x461dc1[_0x6a39('0x6b')])?null:_0x461dc1[_0x6a39('0x6b')];});_0x187e6c['on'](_0x6a39('0x1b'),function(){fs[_0x6a39('0x60')](_0x5c9734,parseInt(_0x6a39('0x61'),0x8));return db[_0x6a39('0x2c')][_0x6a39('0x71')](_0x241373)[_0x6a39('0x24')](function(_0x186a90){var _0x548f78={'role':_0x54101b[_0x6a39('0x72')][_0x6a39('0x73')],'userProfileId':_0x54101b[_0x6a39('0x72')]['userProfileId']};if(!_0x548f78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548f78[_0x6a39('0x73')]===_0x6a39('0x74')){var _0x14facc=_0x186a90[_0x6a39('0x26')]({'plain':!![]});return db[_0x6a39('0x75')]['find']({'where':{'name':_0x6a39('0x27'),'userProfileId':_0x548f78['userProfileId']},'raw':!![]})[_0x6a39('0x24')](function(_0x40c670){if(_0x40c670&&_0x40c670[_0x6a39('0x76')]===0x0){return db['UserProfileResource'][_0x6a39('0x71')]({'name':_0x14facc[_0x6a39('0x2a')],'resourceId':_0x14facc['id'],'type':_0x40c670[_0x6a39('0x2a')],'sectionId':_0x40c670['id']},{})[_0x6a39('0x24')](function(){return _0x186a90;});}else{return _0x186a90;}})[_0x6a39('0x44')](function(_0x12a272){logger['error'](_0x6a39('0x77'),_0x12a272);throw _0x12a272;});}return _0x186a90;})[_0x6a39('0x24')](respondWithResult(_0x13f3d8,null))[_0x6a39('0x44')](handleError(_0x13f3d8,null));});_0x187e6c[_0x6a39('0x78')]();}catch(_0x558d37){_0x13f3d8[_0x6a39('0x1c')](0x1f4)['send'](_0x558d37);}};exports[_0x6a39('0x23')]=function(_0x5b1207,_0x40f10e,_0x15aa1e){return db[_0x6a39('0x2c')][_0x6a39('0x48')]({'where':{'id':_0x5b1207[_0x6a39('0x4a')]['id']}})[_0x6a39('0x24')](handleEntityNotFound(_0x40f10e,null))[_0x6a39('0x24')](saveUpdates(_[_0x6a39('0x3c')](_0x5b1207[_0x6a39('0x72')],[_0x6a39('0x2a'),_0x6a39('0x79')]),null))[_0x6a39('0x24')](respondWithResult(_0x40f10e,null))['catch'](handleError(_0x40f10e,null));};exports[_0x6a39('0x7a')]=function(_0x82dc42,_0x16c5cb,_0x33e77d){return db[_0x6a39('0x2c')][_0x6a39('0x48')]({'where':{'id':_0x82dc42[_0x6a39('0x4a')]['id']}})[_0x6a39('0x24')](function(_0x1f2abc){if(_0x1f2abc){return _0x1f2abc['destroy']();}})['then'](function(_0x5b55fe){var _0x33d331=path['join'](config[_0x6a39('0x4f')],_0x6a39('0x5d'),util[_0x6a39('0x54')](_0x6a39('0x55'),_0x5b55fe[_0x6a39('0x4b')],_0x5b55fe[_0x6a39('0x7b')]));var _0x591e31=path[_0x6a39('0x4e')](config[_0x6a39('0x4f')],_0x6a39('0x50'),util[_0x6a39('0x54')](_0x6a39('0x55'),_0x5b55fe[_0x6a39('0x4b')],_0x5b55fe['converted_format']));fs[_0x6a39('0x63')](_0x33d331);fs[_0x6a39('0x63')](_0x591e31);return _0x5b55fe;})[_0x6a39('0x24')](function(_0x261008){if(_0x261008){return _0x16c5cb[_0x6a39('0x1c')](0xcc)['end']();}})[_0x6a39('0x24')](handleEntityNotFound(_0x16c5cb,null))[_0x6a39('0x44')](handleError(_0x16c5cb,null));}; \ No newline at end of file +var _0xb2d4=['sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','Sound','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','params','include','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','bitRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x421054,_0x45c71e){var _0x53d966=function(_0x153eba){while(--_0x153eba){_0x421054['push'](_0x421054['shift']());}};_0x53d966(++_0x45c71e);}(_0xb2d4,0xf6));var _0x4b2d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xb2d4[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x4b2d('0x0'));var rimraf=require(_0x4b2d('0x1'));var zipdir=require(_0x4b2d('0x2'));var jsonpatch=require(_0x4b2d('0x3'));var rp=require('request-promise');var moment=require(_0x4b2d('0x4'));var BPromise=require(_0x4b2d('0x5'));var Mustache=require(_0x4b2d('0x6'));var util=require(_0x4b2d('0x7'));var path=require('path');var sox=require(_0x4b2d('0x8'));var csv=require('to-csv');var ejs=require(_0x4b2d('0x9'));var fs=require('fs');var fs_extra=require(_0x4b2d('0xa'));var _=require(_0x4b2d('0xb'));var squel=require(_0x4b2d('0xc'));var crypto=require(_0x4b2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4b2d('0xe'));var toCsv=require(_0x4b2d('0xf'));var querystring=require(_0x4b2d('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b2d('0x11'));var authService=require(_0x4b2d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b2d('0x13'));var logger=require(_0x4b2d('0x14'))(_0x4b2d('0x15'));var utils=require(_0x4b2d('0x16'));var config=require(_0x4b2d('0x17'));var licenseUtil=require(_0x4b2d('0x18'));var db=require(_0x4b2d('0x19'))['db'];function respondWithStatusCode(_0x47c684,_0xdabcc8){_0xdabcc8=_0xdabcc8||0xcc;return function(_0x30fa4c){if(_0x30fa4c){return _0x47c684[_0x4b2d('0x1a')](_0xdabcc8);}return _0x47c684[_0x4b2d('0x1b')](_0xdabcc8)[_0x4b2d('0x1c')]();};}function respondWithResult(_0x18c721,_0x4a8395){_0x4a8395=_0x4a8395||0xc8;return function(_0x23b296){if(_0x23b296){return _0x18c721[_0x4b2d('0x1b')](_0x4a8395)[_0x4b2d('0x1d')](_0x23b296);}};}function respondWithFilteredResult(_0x12ae6f,_0x4a18c0){return function(_0x5b7c52){if(_0x5b7c52){var _0x21607d=typeof _0x4a18c0['offset']===_0x4b2d('0x1e')&&typeof _0x4a18c0['limit']===_0x4b2d('0x1e');var _0x795258=_0x5b7c52['count'];var _0x3c9369=_0x21607d?0x0:_0x4a18c0[_0x4b2d('0x1f')];var _0x280ece=_0x21607d?_0x5b7c52[_0x4b2d('0x20')]:_0x4a18c0['offset']+_0x4a18c0[_0x4b2d('0x21')];var _0x28df25;if(_0x280ece>=_0x795258){_0x280ece=_0x795258;_0x28df25=0xc8;}else{_0x28df25=0xce;}_0x12ae6f[_0x4b2d('0x1b')](_0x28df25);return _0x12ae6f[_0x4b2d('0x22')]('Content-Range',_0x3c9369+'-'+_0x280ece+'/'+_0x795258)['json'](_0x5b7c52);}return null;};}function patchUpdates(_0x48e135){return function(_0x14f414){try{jsonpatch['apply'](_0x14f414,_0x48e135,!![]);}catch(_0x358753){return BPromise[_0x4b2d('0x23')](_0x358753);}return _0x14f414['save']();};}function saveUpdates(_0x74cc49,_0x1fea00){return function(_0x39dcf1){if(_0x39dcf1){return _0x39dcf1[_0x4b2d('0x24')](_0x74cc49)[_0x4b2d('0x25')](function(_0x43d046){return _0x43d046;});}return null;};}function removeEntity(_0x537521,_0x2b0ff7){return function(_0x1aa290){if(_0x1aa290){return _0x1aa290[_0x4b2d('0x26')]()[_0x4b2d('0x25')](function(){var _0x52397b=_0x1aa290[_0x4b2d('0x27')]({'plain':!![]});var _0x309e7d='Sounds';return db[_0x4b2d('0x28')]['destroy']({'where':{'type':_0x309e7d,'resourceId':_0x52397b['id']}})[_0x4b2d('0x25')](function(){return _0x1aa290;});})[_0x4b2d('0x25')](function(){_0x537521[_0x4b2d('0x1b')](0xcc)[_0x4b2d('0x1c')]();});}};}function handleEntityNotFound(_0x16fcda,_0x3d3e8f){return function(_0x3ef7ec){if(!_0x3ef7ec){_0x16fcda[_0x4b2d('0x1a')](0x194);}return _0x3ef7ec;};}function handleError(_0x475369,_0x5b05eb){_0x5b05eb=_0x5b05eb||0x1f4;return function(_0x5c0e89){logger[_0x4b2d('0x29')](_0x5c0e89[_0x4b2d('0x2a')]);if(_0x5c0e89[_0x4b2d('0x2b')]){delete _0x5c0e89[_0x4b2d('0x2b')];}_0x475369[_0x4b2d('0x1b')](_0x5b05eb)[_0x4b2d('0x2c')](_0x5c0e89);};}exports['index']=function(_0x42bdeb,_0x277e84){var _0x2fd172={},_0x96e2dd={},_0x2a2d72={'count':0x0,'rows':[]};var _0x46a0fe=_['map'](db[_0x4b2d('0x2d')][_0x4b2d('0x2e')],function(_0x537712){return{'name':_0x537712[_0x4b2d('0x2f')],'type':_0x537712[_0x4b2d('0x30')][_0x4b2d('0x31')]};});_0x96e2dd['model']=_[_0x4b2d('0x32')](_0x46a0fe,'name');_0x96e2dd['query']=_[_0x4b2d('0x33')](_0x42bdeb[_0x4b2d('0x34')]);_0x96e2dd[_0x4b2d('0x35')]=_[_0x4b2d('0x36')](_0x96e2dd[_0x4b2d('0x37')],_0x96e2dd['query']);_0x2fd172[_0x4b2d('0x38')]=_[_0x4b2d('0x36')](_0x96e2dd[_0x4b2d('0x37')],qs[_0x4b2d('0x39')](_0x42bdeb['query']['fields']));_0x2fd172[_0x4b2d('0x38')]=_0x2fd172[_0x4b2d('0x38')][_0x4b2d('0x3a')]?_0x2fd172[_0x4b2d('0x38')]:_0x96e2dd[_0x4b2d('0x37')];if(!_0x42bdeb[_0x4b2d('0x34')][_0x4b2d('0x3b')](_0x4b2d('0x3c'))){_0x2fd172[_0x4b2d('0x21')]=qs[_0x4b2d('0x21')](_0x42bdeb[_0x4b2d('0x34')][_0x4b2d('0x21')]);_0x2fd172['offset']=qs[_0x4b2d('0x1f')](_0x42bdeb[_0x4b2d('0x34')]['offset']);}_0x2fd172[_0x4b2d('0x3d')]=qs[_0x4b2d('0x3e')](_0x42bdeb['query'][_0x4b2d('0x3e')]);_0x2fd172[_0x4b2d('0x3f')]=qs['filters'](_[_0x4b2d('0x40')](_0x42bdeb['query'],_0x96e2dd['filters']),_0x46a0fe);if(_0x42bdeb[_0x4b2d('0x34')]['filter']){_0x2fd172['where']=_[_0x4b2d('0x41')](_0x2fd172[_0x4b2d('0x3f')],{'$or':_['map'](_0x46a0fe,function(_0xe8371d){if(_0xe8371d[_0x4b2d('0x30')]!==_0x4b2d('0x42')){var _0x41c598={};_0x41c598[_0xe8371d[_0x4b2d('0x2b')]]={'$like':'%'+_0x42bdeb['query'][_0x4b2d('0x43')]+'%'};return _0x41c598;}})});}_0x2fd172=_[_0x4b2d('0x41')]({},_0x2fd172,_0x42bdeb[_0x4b2d('0x44')]);var _0x7919cb={'where':_0x2fd172[_0x4b2d('0x3f')]};return db[_0x4b2d('0x2d')][_0x4b2d('0x20')](_0x7919cb)[_0x4b2d('0x25')](function(_0x1660ca){_0x2a2d72['count']=_0x1660ca;if(_0x42bdeb[_0x4b2d('0x34')][_0x4b2d('0x45')]){_0x2fd172['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x2fd172);})[_0x4b2d('0x25')](function(_0x78b679){_0x2a2d72['rows']=_0x78b679;return _0x2a2d72;})[_0x4b2d('0x25')](respondWithFilteredResult(_0x277e84,_0x2fd172))[_0x4b2d('0x46')](handleError(_0x277e84,null));};exports[_0x4b2d('0x47')]=function(_0x3d71df,_0x7ddde9){var _0x1844f0={'raw':!![],'where':{'id':_0x3d71df[_0x4b2d('0x48')]['id']}},_0x9a361f={};_0x9a361f[_0x4b2d('0x37')]=_['keys'](db[_0x4b2d('0x2d')][_0x4b2d('0x2e')]);_0x9a361f[_0x4b2d('0x34')]=_['keys'](_0x3d71df[_0x4b2d('0x34')]);_0x9a361f[_0x4b2d('0x35')]=_[_0x4b2d('0x36')](_0x9a361f[_0x4b2d('0x37')],_0x9a361f['query']);_0x1844f0[_0x4b2d('0x38')]=_['intersection'](_0x9a361f[_0x4b2d('0x37')],qs['fields'](_0x3d71df[_0x4b2d('0x34')]['fields']));_0x1844f0[_0x4b2d('0x38')]=_0x1844f0[_0x4b2d('0x38')]['length']?_0x1844f0['attributes']:_0x9a361f[_0x4b2d('0x37')];if(_0x3d71df[_0x4b2d('0x34')][_0x4b2d('0x45')]){_0x1844f0[_0x4b2d('0x49')]=[{'all':!![]}];}_0x1844f0=_[_0x4b2d('0x41')]({},_0x1844f0,_0x3d71df['options']);return db[_0x4b2d('0x2d')][_0x4b2d('0x4a')](_0x1844f0)[_0x4b2d('0x25')](handleEntityNotFound(_0x7ddde9,null))[_0x4b2d('0x25')](respondWithResult(_0x7ddde9,null))[_0x4b2d('0x46')](handleError(_0x7ddde9,null));};exports[_0x4b2d('0x4b')]=function(_0x3a4449,_0x21937c,_0x38eee1){return db['Sound'][_0x4b2d('0x4a')]({'where':{'id':_0x3a4449['params']['id']},'attributes':[_0x4b2d('0x2b'),'save_name',_0x4b2d('0x4c')],'raw':!![]})[_0x4b2d('0x25')](handleEntityNotFound(_0x21937c,null))[_0x4b2d('0x25')](function(_0x2df88a){if(_0x2df88a){if(!fs[_0x4b2d('0x4d')](path[_0x4b2d('0x4e')](config[_0x4b2d('0x4f')],_0x4b2d('0x50'),_0x2df88a[_0x4b2d('0x51')]+'.'+_0x2df88a[_0x4b2d('0x4c')]))){throw new db[(_0x4b2d('0x52'))][(_0x4b2d('0x53'))]('Sound\x20not\x20found');}return _0x21937c[_0x4b2d('0x4b')](path[_0x4b2d('0x4e')](config[_0x4b2d('0x4f')],_0x4b2d('0x50'),util[_0x4b2d('0x54')](_0x4b2d('0x55'),_0x2df88a[_0x4b2d('0x51')],_0x2df88a[_0x4b2d('0x4c')])),util[_0x4b2d('0x54')]('%s.%s',_0x2df88a[_0x4b2d('0x2b')],_0x2df88a[_0x4b2d('0x4c')]));}return null;})[_0x4b2d('0x46')](handleError(_0x21937c,null));};exports['create']=function(_0x556a9d,_0xf94129,_0x19af84){var _0x246404={'name':path[_0x4b2d('0x56')](_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x58')],path[_0x4b2d('0x59')](_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x58')])),'save_name':path[_0x4b2d('0x56')](_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x5a')],path[_0x4b2d('0x59')](_0x556a9d[_0x4b2d('0x57')]['filename'])),'original_format':path[_0x4b2d('0x59')](_0x556a9d['file']['originalname'])[_0x4b2d('0x5b')](0x1),'converted_format':_0x4b2d('0x5c')};var _0x3cc4e4=path[_0x4b2d('0x4e')](config[_0x4b2d('0x4f')],_0x4b2d('0x5d'),_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x5a')]);var _0x52b35b=path[_0x4b2d('0x4e')](config[_0x4b2d('0x4f')],'server/files/sounds/converted',util[_0x4b2d('0x54')]('%s.%s',path['basename'](_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x5a')],path[_0x4b2d('0x59')](_0x556a9d[_0x4b2d('0x57')][_0x4b2d('0x5a')])),_0x246404[_0x4b2d('0x4c')]));logger['info'](_0x4b2d('0x5e'),_0x3cc4e4);logger[_0x4b2d('0x5f')](_0x4b2d('0x60'),_0x52b35b);try{fs[_0x4b2d('0x61')](_0x3cc4e4,parseInt(_0x4b2d('0x62'),0x8));var _0x5ebe=sox[_0x4b2d('0x63')](_0x3cc4e4,_0x52b35b,{'sampleRate':0x1f40,'format':_0x4b2d('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5ebe['on'](_0x4b2d('0x29'),function(_0x128a08){fs[_0x4b2d('0x64')](_0x3cc4e4);_0xf94129[_0x4b2d('0x1b')](0x1f4)[_0x4b2d('0x2c')](_0x128a08);});_0x5ebe['on'](_0x4b2d('0x65'),function(_0x1c1ba5){_0x246404[_0x4b2d('0x66')]=isNaN(_0x1c1ba5[_0x4b2d('0x67')])?null:_0x1c1ba5[_0x4b2d('0x67')]*0x3e8;_0x246404[_0x4b2d('0x68')]=isNaN(_0x1c1ba5[_0x4b2d('0x69')])?null:_0x1c1ba5[_0x4b2d('0x69')];_0x246404[_0x4b2d('0x6a')]=isNaN(_0x1c1ba5['channelCount'])?null:_0x1c1ba5[_0x4b2d('0x6b')];_0x246404[_0x4b2d('0x6c')]=isNaN(_0x1c1ba5['bitRate'])?null:_0x1c1ba5['bitRate'];_0x246404[_0x4b2d('0x6d')]=isNaN(_0x1c1ba5['sampleRate'])?null:_0x1c1ba5[_0x4b2d('0x6e')];});_0x5ebe['on'](_0x4b2d('0x6f'),function(_0x3ecc2b){_0x246404[_0x4b2d('0x70')]=isNaN(_0x3ecc2b[_0x4b2d('0x67')])?null:_0x3ecc2b[_0x4b2d('0x67')]*0x3e8;_0x246404['converted_sampleCount']=isNaN(_0x3ecc2b[_0x4b2d('0x69')])?null:_0x3ecc2b[_0x4b2d('0x69')];_0x246404[_0x4b2d('0x71')]=isNaN(_0x3ecc2b['channelCount'])?null:_0x3ecc2b['channelCount'];_0x246404[_0x4b2d('0x72')]=isNaN(_0x3ecc2b['bitRate'])?null:_0x3ecc2b[_0x4b2d('0x73')];_0x246404['converted_sampleRate']=isNaN(_0x3ecc2b['sampleRate'])?null:_0x3ecc2b[_0x4b2d('0x6e')];});_0x5ebe['on'](_0x4b2d('0x1c'),function(){fs[_0x4b2d('0x61')](_0x52b35b,parseInt(_0x4b2d('0x62'),0x8));return db[_0x4b2d('0x2d')][_0x4b2d('0x74')](_0x246404)['then'](function(_0x5f2f6){var _0x5d0e2a={'role':_0x556a9d[_0x4b2d('0x75')][_0x4b2d('0x76')],'userProfileId':_0x556a9d[_0x4b2d('0x75')][_0x4b2d('0x77')]};if(!_0x5d0e2a)throw new Error(_0x4b2d('0x78'));if(_0x5d0e2a[_0x4b2d('0x76')]==='user'){var _0x879355=_0x5f2f6['get']({'plain':!![]});return db[_0x4b2d('0x79')][_0x4b2d('0x4a')]({'where':{'name':_0x4b2d('0x7a'),'userProfileId':_0x5d0e2a[_0x4b2d('0x77')]},'raw':!![]})[_0x4b2d('0x25')](function(_0x53f7ac){if(_0x53f7ac&&_0x53f7ac['autoAssociation']===0x0){return db[_0x4b2d('0x28')][_0x4b2d('0x74')]({'name':_0x879355[_0x4b2d('0x2b')],'resourceId':_0x879355['id'],'type':_0x53f7ac['name'],'sectionId':_0x53f7ac['id']},{})[_0x4b2d('0x25')](function(){return _0x5f2f6;});}else{return _0x5f2f6;}})['catch'](function(_0x101dfc){logger[_0x4b2d('0x29')](_0x4b2d('0x7b'),_0x101dfc);throw _0x101dfc;});}return _0x5f2f6;})[_0x4b2d('0x25')](respondWithResult(_0xf94129,null))['catch'](handleError(_0xf94129,null));});_0x5ebe['start']();}catch(_0x460eef){_0xf94129[_0x4b2d('0x1b')](0x1f4)[_0x4b2d('0x2c')](_0x460eef);}};exports[_0x4b2d('0x24')]=function(_0x5956ce,_0x1cdb36,_0x421b98){return db[_0x4b2d('0x2d')][_0x4b2d('0x4a')]({'where':{'id':_0x5956ce[_0x4b2d('0x48')]['id']}})[_0x4b2d('0x25')](handleEntityNotFound(_0x1cdb36,null))[_0x4b2d('0x25')](saveUpdates(_[_0x4b2d('0x40')](_0x5956ce[_0x4b2d('0x75')],[_0x4b2d('0x2b'),_0x4b2d('0x7c')]),null))[_0x4b2d('0x25')](respondWithResult(_0x1cdb36,null))[_0x4b2d('0x46')](handleError(_0x1cdb36,null));};exports[_0x4b2d('0x7d')]=function(_0x4fa465,_0x4c88a5,_0x549cde){return db[_0x4b2d('0x2d')]['find']({'where':{'id':_0x4fa465[_0x4b2d('0x48')]['id']}})[_0x4b2d('0x25')](function(_0x4ff04e){if(_0x4ff04e){return _0x4ff04e[_0x4b2d('0x26')]();}})[_0x4b2d('0x25')](function(_0x3a254e){var _0x1c4cc1=path[_0x4b2d('0x4e')](config[_0x4b2d('0x4f')],_0x4b2d('0x5d'),util[_0x4b2d('0x54')](_0x4b2d('0x55'),_0x3a254e[_0x4b2d('0x51')],_0x3a254e[_0x4b2d('0x7e')]));var _0x1938a5=path[_0x4b2d('0x4e')](config['root'],_0x4b2d('0x50'),util[_0x4b2d('0x54')](_0x4b2d('0x55'),_0x3a254e[_0x4b2d('0x51')],_0x3a254e['converted_format']));fs[_0x4b2d('0x64')](_0x1c4cc1);fs[_0x4b2d('0x64')](_0x1938a5);return _0x3a254e;})['then'](function(_0x46cafd){if(_0x46cafd){return _0x4c88a5[_0x4b2d('0x1b')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x4c88a5,null))[_0x4b2d('0x46')](handleError(_0x4c88a5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index fe04960..b508690 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 _0x4c1c=['../../config/environment','exports','define','Sound','tools_sounds','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x2368f5,_0x204aff){var _0x5b3b26=function(_0x1dc5c5){while(--_0x1dc5c5){_0x2368f5['push'](_0x2368f5['shift']());}};_0x5b3b26(++_0x204aff);}(_0x4c1c,0x102));var _0xc4c1=function(_0x4964d8,_0x15b0f3){_0x4964d8=_0x4964d8-0x0;var _0x42a13d=_0x4c1c[_0x4964d8];return _0x42a13d;};'use strict';var _=require(_0xc4c1('0x0'));var util=require(_0xc4c1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc4c1('0x2'));var rp=require(_0xc4c1('0x3'));var fs=require('fs');var path=require(_0xc4c1('0x4'));var rimraf=require(_0xc4c1('0x5'));var config=require(_0xc4c1('0x6'));var attributes=require('./sound.attributes');module[_0xc4c1('0x7')]=function(_0x8b382c,_0x638a3e){return _0x8b382c[_0xc4c1('0x8')](_0xc4c1('0x9'),attributes,{'tableName':_0xc4c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe086=['tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xe086,0x71));var _0x6e08=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe086[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6e08('0x0'));var util=require(_0x6e08('0x1'));var logger=require(_0x6e08('0x2'))(_0x6e08('0x3'));var moment=require(_0x6e08('0x4'));var BPromise=require(_0x6e08('0x5'));var rp=require(_0x6e08('0x6'));var fs=require('fs');var path=require(_0x6e08('0x7'));var rimraf=require(_0x6e08('0x8'));var config=require(_0x6e08('0x9'));var attributes=require(_0x6e08('0xa'));module['exports']=function(_0xd62af1,_0x173653){return _0xd62af1[_0x6e08('0xb')](_0x6e08('0xc'),attributes,{'tableName':_0x6e08('0xd'),'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 5cd4675..2f7f303 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 _0x276c=['model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map'];(function(_0x667ff8,_0x59e7df){var _0x2ddfc7=function(_0x5a4a46){while(--_0x5a4a46){_0x667ff8['push'](_0x667ff8['shift']());}};_0x2ddfc7(++_0x59e7df);}(_0x276c,0xf6));var _0xc276=function(_0x41816c,_0x4bdaee){_0x41816c=_0x41816c-0x0;var _0x1c96b7=_0x276c[_0x41816c];return _0x1c96b7;};'use strict';var _=require(_0xc276('0x0'));var util=require(_0xc276('0x1'));var moment=require(_0xc276('0x2'));var BPromise=require(_0xc276('0x3'));var rs=require(_0xc276('0x4'));var fs=require('fs');var Redis=require(_0xc276('0x5'));var db=require(_0xc276('0x6'))['db'];var utils=require(_0xc276('0x7'));var logger=require(_0xc276('0x8'))(_0xc276('0x9'));var config=require(_0xc276('0xa'));var jayson=require(_0xc276('0xb'));var client=jayson[_0xc276('0xc')][_0xc276('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x53f80f,_0x3501c2,_0x3c6e08){return new BPromise(function(_0x52991b,_0x36934a){return client['request'](_0x53f80f,_0x3c6e08)[_0xc276('0xe')](function(_0x2783ca){logger[_0xc276('0xf')](_0xc276('0x10'),_0x3501c2,'request\x20sent');logger[_0xc276('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x3501c2,_0xc276('0x12'),JSON[_0xc276('0x13')](_0x2783ca));if(_0x2783ca[_0xc276('0x14')]){if(_0x2783ca[_0xc276('0x14')][_0xc276('0x15')]===0x1f4){logger[_0xc276('0x14')]('Sound,\x20%s,\x20%s',_0x3501c2,_0x2783ca[_0xc276('0x14')][_0xc276('0x16')]);return _0x36934a(_0x2783ca[_0xc276('0x14')][_0xc276('0x16')]);}logger[_0xc276('0x14')](_0xc276('0x10'),_0x3501c2,_0x2783ca[_0xc276('0x14')]['message']);return _0x52991b(_0x2783ca[_0xc276('0x14')]['message']);}else{logger[_0xc276('0xf')](_0xc276('0x10'),_0x3501c2,'request\x20sent');_0x52991b(_0x2783ca[_0xc276('0x17')]['message']);}})[_0xc276('0x18')](function(_0x31f719){logger[_0xc276('0x14')]('Sound,\x20%s,\x20%s',_0x3501c2,_0x31f719);_0x36934a(_0x31f719);});});}exports[_0xc276('0x19')]=function(_0x528d6b){var _0x3e6cc3=this;return new Promise(function(_0x103fee,_0x1d324b){return db[_0xc276('0x1a')][_0xc276('0x1b')]({'raw':_0x528d6b[_0xc276('0x1c')]?_0x528d6b[_0xc276('0x1c')][_0xc276('0x1d')]===undefined?!![]:![]:!![],'where':_0x528d6b[_0xc276('0x1c')]?_0x528d6b[_0xc276('0x1c')][_0xc276('0x1e')]||null:null,'attributes':_0x528d6b['options']?_0x528d6b[_0xc276('0x1c')][_0xc276('0x1f')]||null:null,'include':_0x528d6b[_0xc276('0x1c')]?_0x528d6b['options'][_0xc276('0x20')]?_[_0xc276('0x21')](_0x528d6b['options'][_0xc276('0x20')],function(_0x3add5d){return{'model':db[_0x3add5d[_0xc276('0x22')]],'as':_0x3add5d['as'],'attributes':_0x3add5d[_0xc276('0x1f')],'include':_0x3add5d[_0xc276('0x20')]?_['map'](_0x3add5d[_0xc276('0x20')],function(_0x18d13a){return{'model':db[_0x18d13a[_0xc276('0x22')]],'as':_0x18d13a['as'],'attributes':_0x18d13a[_0xc276('0x1f')],'include':_0x18d13a[_0xc276('0x20')]?_[_0xc276('0x21')](_0x18d13a[_0xc276('0x20')],function(_0x354e03){return{'model':db[_0x354e03['model']],'as':_0x354e03['as'],'attributes':_0x354e03[_0xc276('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc276('0xe')](function(_0x18d71d){logger[_0xc276('0xf')](_0xc276('0x19'),_0x528d6b);logger[_0xc276('0x11')](_0xc276('0x19'),_0x528d6b,JSON[_0xc276('0x13')](_0x18d71d));_0x103fee(_0x18d71d);})[_0xc276('0x18')](function(_0x3c5718){logger['error']('ShowSound',_0x3c5718['message'],_0x528d6b);_0x1d324b(_0x3e6cc3[_0xc276('0x14')](0x1f4,_0x3c5718[_0xc276('0x16')]));});});}; \ No newline at end of file +var _0x1b67=['ShowSound','Sound','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x12de1c,_0x49c685){var _0x558d0f=function(_0x10b7be){while(--_0x10b7be){_0x12de1c['push'](_0x12de1c['shift']());}};_0x558d0f(++_0x49c685);}(_0x1b67,0x1e9));var _0x71b6=function(_0x575f72,_0x39ff6d){_0x575f72=_0x575f72-0x0;var _0x264047=_0x1b67[_0x575f72];return _0x264047;};'use strict';var _=require('lodash');var util=require(_0x71b6('0x0'));var moment=require('moment');var BPromise=require(_0x71b6('0x1'));var rs=require(_0x71b6('0x2'));var fs=require('fs');var Redis=require(_0x71b6('0x3'));var db=require(_0x71b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x71b6('0x5'))('rpc');var config=require(_0x71b6('0x6'));var jayson=require(_0x71b6('0x7'));var client=jayson[_0x71b6('0x8')][_0x71b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x288757,_0x40cfc0,_0x7e906a){return new BPromise(function(_0x1663ed,_0x22a72e){return client[_0x71b6('0xa')](_0x288757,_0x7e906a)[_0x71b6('0xb')](function(_0x8772d0){logger[_0x71b6('0xc')](_0x71b6('0xd'),_0x40cfc0,_0x71b6('0xe'));logger[_0x71b6('0xf')](_0x71b6('0x10'),_0x40cfc0,_0x71b6('0xe'),JSON[_0x71b6('0x11')](_0x8772d0));if(_0x8772d0[_0x71b6('0x12')]){if(_0x8772d0[_0x71b6('0x12')][_0x71b6('0x13')]===0x1f4){logger['error'](_0x71b6('0xd'),_0x40cfc0,_0x8772d0[_0x71b6('0x12')]['message']);return _0x22a72e(_0x8772d0[_0x71b6('0x12')][_0x71b6('0x14')]);}logger['error'](_0x71b6('0xd'),_0x40cfc0,_0x8772d0[_0x71b6('0x12')][_0x71b6('0x14')]);return _0x1663ed(_0x8772d0[_0x71b6('0x12')][_0x71b6('0x14')]);}else{logger[_0x71b6('0xc')](_0x71b6('0xd'),_0x40cfc0,_0x71b6('0xe'));_0x1663ed(_0x8772d0[_0x71b6('0x15')]['message']);}})[_0x71b6('0x16')](function(_0x286d60){logger[_0x71b6('0x12')](_0x71b6('0xd'),_0x40cfc0,_0x286d60);_0x22a72e(_0x286d60);});});}exports[_0x71b6('0x17')]=function(_0x46b860){var _0xea3db4=this;return new Promise(function(_0x585d25,_0x2ec522){return db[_0x71b6('0x18')]['find']({'raw':_0x46b860['options']?_0x46b860[_0x71b6('0x19')][_0x71b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x46b860[_0x71b6('0x19')]?_0x46b860['options'][_0x71b6('0x1b')]||null:null,'attributes':_0x46b860['options']?_0x46b860[_0x71b6('0x19')][_0x71b6('0x1c')]||null:null,'include':_0x46b860[_0x71b6('0x19')]?_0x46b860[_0x71b6('0x19')][_0x71b6('0x1d')]?_[_0x71b6('0x1e')](_0x46b860[_0x71b6('0x19')][_0x71b6('0x1d')],function(_0x344a6c){return{'model':db[_0x344a6c[_0x71b6('0x1f')]],'as':_0x344a6c['as'],'attributes':_0x344a6c[_0x71b6('0x1c')],'include':_0x344a6c[_0x71b6('0x1d')]?_[_0x71b6('0x1e')](_0x344a6c['include'],function(_0x3e4652){return{'model':db[_0x3e4652[_0x71b6('0x1f')]],'as':_0x3e4652['as'],'attributes':_0x3e4652[_0x71b6('0x1c')],'include':_0x3e4652[_0x71b6('0x1d')]?_[_0x71b6('0x1e')](_0x3e4652[_0x71b6('0x1d')],function(_0xe4fdfc){return{'model':db[_0xe4fdfc['model']],'as':_0xe4fdfc['as'],'attributes':_0xe4fdfc[_0x71b6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x71b6('0xb')](function(_0x1db70c){logger[_0x71b6('0xc')](_0x71b6('0x17'),_0x46b860);logger[_0x71b6('0xf')](_0x71b6('0x17'),_0x46b860,JSON['stringify'](_0x1db70c));_0x585d25(_0x1db70c);})[_0x71b6('0x16')](function(_0x93ce4d){logger[_0x71b6('0x12')](_0x71b6('0x17'),_0x93ce4d[_0x71b6('0x14')],_0x46b860);_0x2ec522(_0xea3db4[_0x71b6('0x12')](0x1f4,_0x93ce4d[_0x71b6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0e037d5..e665b6e 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x4fc2,0x111));var _0x24fc=function(_0x508a3a,_0x2eff16){_0x508a3a=_0x508a3a-0x0;var _0x4cc5e2=_0x4fc2[_0x508a3a];return _0x4cc5e2;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x3f6c27,_0x47ef96){var _0xfc6c2c=function(_0x2ddcb1){while(--_0x2ddcb1){_0x3f6c27['push'](_0x3f6c27['shift']());}};_0xfc6c2c(++_0x47ef96);}(_0xda3f,0xec));var _0xfda3=function(_0x18abaa,_0x298abb){_0x18abaa=_0x18abaa-0x0;var _0x1abca5=_0xda3f[_0x18abaa];return _0x1abca5;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 673265b..42024c9 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 _0xa356=['STRING','out','TEXT'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xa356,0x1ec));var _0x6a35=function(_0x59e681,_0x56ddb5){_0x59e681=_0x59e681-0x0;var _0x2f8efb=_0xa356[_0x59e681];return _0x2f8efb;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6a35('0x0')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6a35('0x1')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x6a35('0x0')]},'providerResponse':{'type':Sequelize[_0x6a35('0x2')]}}; \ No newline at end of file +var _0x876f=['medium','out','TEXT','exports','STRING'];(function(_0x50f1fe,_0x335af2){var _0x26f1b4=function(_0x3d85a8){while(--_0x3d85a8){_0x50f1fe['push'](_0x50f1fe['shift']());}};_0x26f1b4(++_0x335af2);}(_0x876f,0x1e3));var _0xf876=function(_0x226194,_0x34b3c3){_0x226194=_0x226194-0x0;var _0x28d1d9=_0x876f[_0x226194];return _0x28d1d9;};'use strict';var Sequelize=require('sequelize');module[_0xf876('0x0')]={'uniqueid':{'type':Sequelize[_0xf876('0x1')]},'body':{'type':Sequelize['TEXT'](_0xf876('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf876('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf876('0x1')]},'providerResponse':{'type':Sequelize[_0xf876('0x4')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index abddc83..fa7540b 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 _0x0e08=['error','stack','name','SquareMessage','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x200fde,_0x54ed1c){var _0x5d68f0=function(_0x1c6d5b){while(--_0x1c6d5b){_0x200fde['push'](_0x200fde['shift']());}};_0x5d68f0(++_0x54ed1c);}(_0x0e08,0x18e));var _0x80e0=function(_0x52bcf1,_0x3976dc){_0x52bcf1=_0x52bcf1-0x0;var _0x1ecf86=_0x0e08[_0x52bcf1];return _0x1ecf86;};'use strict';var emlformat=require(_0x80e0('0x0'));var rimraf=require(_0x80e0('0x1'));var zipdir=require(_0x80e0('0x2'));var jsonpatch=require(_0x80e0('0x3'));var rp=require(_0x80e0('0x4'));var moment=require(_0x80e0('0x5'));var BPromise=require(_0x80e0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x80e0('0x7'));var sox=require(_0x80e0('0x8'));var csv=require('to-csv');var ejs=require(_0x80e0('0x9'));var fs=require('fs');var fs_extra=require(_0x80e0('0xa'));var _=require(_0x80e0('0xb'));var squel=require('squel');var crypto=require(_0x80e0('0xc'));var jsforce=require(_0x80e0('0xd'));var deskjs=require(_0x80e0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x80e0('0xf'));var Papa=require(_0x80e0('0x10'));var Redis=require(_0x80e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x80e0('0x12'));var as=require(_0x80e0('0x13'));var hardwareService=require(_0x80e0('0x14'));var logger=require('../../config/logger')(_0x80e0('0x15'));var utils=require(_0x80e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x80e0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38bc2e,_0x1e038c){_0x1e038c=_0x1e038c||0xcc;return function(_0xb69720){if(_0xb69720){return _0x38bc2e['sendStatus'](_0x1e038c);}return _0x38bc2e[_0x80e0('0x18')](_0x1e038c)[_0x80e0('0x19')]();};}function respondWithResult(_0x5a26bd,_0x5e6fdf){_0x5e6fdf=_0x5e6fdf||0xc8;return function(_0x53effd){if(_0x53effd){return _0x5a26bd['status'](_0x5e6fdf)[_0x80e0('0x1a')](_0x53effd);}};}function respondWithFilteredResult(_0x52d3f4,_0xc90791){return function(_0x5a72bd){if(_0x5a72bd){var _0x452e78=typeof _0xc90791[_0x80e0('0x1b')]===_0x80e0('0x1c')&&typeof _0xc90791['limit']===_0x80e0('0x1c');var _0x3fe88e=_0x5a72bd[_0x80e0('0x1d')];var _0x2483d3=_0x452e78?0x0:_0xc90791[_0x80e0('0x1b')];var _0x1b48e0=_0x452e78?_0x5a72bd[_0x80e0('0x1d')]:_0xc90791[_0x80e0('0x1b')]+_0xc90791[_0x80e0('0x1e')];var _0x1e15ae;if(_0x1b48e0>=_0x3fe88e){_0x1b48e0=_0x3fe88e;_0x1e15ae=0xc8;}else{_0x1e15ae=0xce;}_0x52d3f4['status'](_0x1e15ae);return _0x52d3f4[_0x80e0('0x1f')](_0x80e0('0x20'),_0x2483d3+'-'+_0x1b48e0+'/'+_0x3fe88e)[_0x80e0('0x1a')](_0x5a72bd);}return null;};}function patchUpdates(_0x1fdc21){return function(_0x2f1ef6){try{jsonpatch[_0x80e0('0x21')](_0x2f1ef6,_0x1fdc21,!![]);}catch(_0x5e7140){return BPromise[_0x80e0('0x22')](_0x5e7140);}return _0x2f1ef6[_0x80e0('0x23')]();};}function saveUpdates(_0x1cefff,_0x3558d0){return function(_0xad5ea9){if(_0xad5ea9){return _0xad5ea9[_0x80e0('0x24')](_0x1cefff)[_0x80e0('0x25')](function(_0x1dd823){return _0x1dd823;});}return null;};}function removeEntity(_0x718402,_0x1515db){return function(_0x3bd986){if(_0x3bd986){return _0x3bd986[_0x80e0('0x26')]()[_0x80e0('0x25')](function(){_0x718402['status'](0xcc)[_0x80e0('0x19')]();});}};}function handleEntityNotFound(_0x2c344d,_0x33c7aa){return function(_0x4505f7){if(!_0x4505f7){_0x2c344d[_0x80e0('0x27')](0x194);}return _0x4505f7;};}function handleError(_0x147c6f,_0x5dcc1a){_0x5dcc1a=_0x5dcc1a||0x1f4;return function(_0x36a58f){logger[_0x80e0('0x28')](_0x36a58f[_0x80e0('0x29')]);if(_0x36a58f[_0x80e0('0x2a')]){delete _0x36a58f[_0x80e0('0x2a')];}_0x147c6f[_0x80e0('0x18')](_0x5dcc1a)['send'](_0x36a58f);};}exports['index']=function(_0x56c659,_0x50e1ad){var _0x2169fd={},_0xe2d2f0={},_0x2fd02e={'count':0x0,'rows':[]};var _0x504b57=_['map'](db[_0x80e0('0x2b')][_0x80e0('0x2c')],function(_0x551085){return{'name':_0x551085[_0x80e0('0x2d')],'type':_0x551085['type'][_0x80e0('0x2e')]};});_0xe2d2f0[_0x80e0('0x2f')]=_[_0x80e0('0x30')](_0x504b57,_0x80e0('0x2a'));_0xe2d2f0['query']=_['keys'](_0x56c659[_0x80e0('0x31')]);_0xe2d2f0['filters']=_[_0x80e0('0x32')](_0xe2d2f0[_0x80e0('0x2f')],_0xe2d2f0['query']);_0x2169fd[_0x80e0('0x33')]=_[_0x80e0('0x32')](_0xe2d2f0[_0x80e0('0x2f')],qs[_0x80e0('0x34')](_0x56c659[_0x80e0('0x31')][_0x80e0('0x34')]));_0x2169fd[_0x80e0('0x33')]=_0x2169fd[_0x80e0('0x33')][_0x80e0('0x35')]?_0x2169fd[_0x80e0('0x33')]:_0xe2d2f0[_0x80e0('0x2f')];if(!_0x56c659['query'][_0x80e0('0x36')](_0x80e0('0x37'))){_0x2169fd[_0x80e0('0x1e')]=qs[_0x80e0('0x1e')](_0x56c659['query'][_0x80e0('0x1e')]);_0x2169fd[_0x80e0('0x1b')]=qs[_0x80e0('0x1b')](_0x56c659[_0x80e0('0x31')]['offset']);}_0x2169fd[_0x80e0('0x38')]=qs[_0x80e0('0x39')](_0x56c659[_0x80e0('0x31')][_0x80e0('0x39')]);_0x2169fd[_0x80e0('0x3a')]=qs['filters'](_['pick'](_0x56c659[_0x80e0('0x31')],_0xe2d2f0['filters']),_0x504b57);if(_0x56c659[_0x80e0('0x31')][_0x80e0('0x3b')]){_0x2169fd[_0x80e0('0x3a')]=_[_0x80e0('0x3c')](_0x2169fd[_0x80e0('0x3a')],{'$or':_['map'](_0x504b57,function(_0x1075af){if(_0x1075af[_0x80e0('0x3d')]!=='VIRTUAL'){var _0x36fb01={};_0x36fb01[_0x1075af['name']]={'$like':'%'+_0x56c659[_0x80e0('0x31')][_0x80e0('0x3b')]+'%'};return _0x36fb01;}})});}_0x2169fd=_[_0x80e0('0x3c')]({},_0x2169fd,_0x56c659['options']);var _0x1911db={'where':_0x2169fd['where']};return db[_0x80e0('0x2b')]['count'](_0x1911db)[_0x80e0('0x25')](function(_0x5f356b){_0x2fd02e['count']=_0x5f356b;if(_0x56c659['query'][_0x80e0('0x3e')]){_0x2169fd['include']=[{'all':!![]}];}return db['SquareMessage'][_0x80e0('0x3f')](_0x2169fd);})[_0x80e0('0x25')](function(_0x4735aa){_0x2fd02e['rows']=_0x4735aa;return _0x2fd02e;})[_0x80e0('0x25')](respondWithFilteredResult(_0x50e1ad,_0x2169fd))[_0x80e0('0x40')](handleError(_0x50e1ad,null));};exports[_0x80e0('0x41')]=function(_0x37ef41,_0x4ac82b){var _0x4e8983={'raw':!![],'where':{'id':_0x37ef41[_0x80e0('0x42')]['id']}},_0x32975c={};_0x32975c[_0x80e0('0x2f')]=_['keys'](db[_0x80e0('0x2b')][_0x80e0('0x2c')]);_0x32975c[_0x80e0('0x31')]=_[_0x80e0('0x43')](_0x37ef41[_0x80e0('0x31')]);_0x32975c['filters']=_[_0x80e0('0x32')](_0x32975c['model'],_0x32975c[_0x80e0('0x31')]);_0x4e8983[_0x80e0('0x33')]=_[_0x80e0('0x32')](_0x32975c[_0x80e0('0x2f')],qs['fields'](_0x37ef41['query'][_0x80e0('0x34')]));_0x4e8983['attributes']=_0x4e8983['attributes'][_0x80e0('0x35')]?_0x4e8983[_0x80e0('0x33')]:_0x32975c[_0x80e0('0x2f')];if(_0x37ef41[_0x80e0('0x31')][_0x80e0('0x3e')]){_0x4e8983[_0x80e0('0x44')]=[{'all':!![]}];}_0x4e8983=_[_0x80e0('0x3c')]({},_0x4e8983,_0x37ef41[_0x80e0('0x45')]);return db[_0x80e0('0x2b')][_0x80e0('0x46')](_0x4e8983)['then'](handleEntityNotFound(_0x4ac82b,null))[_0x80e0('0x25')](respondWithResult(_0x4ac82b,null))[_0x80e0('0x40')](handleError(_0x4ac82b,null));};exports[_0x80e0('0x47')]=function(_0x485f0b,_0x5e794c){return db['SquareMessage']['create'](_0x485f0b['body'],{})[_0x80e0('0x25')](respondWithResult(_0x5e794c,0xc9))[_0x80e0('0x40')](handleError(_0x5e794c,null));};exports[_0x80e0('0x24')]=function(_0x254116,_0x36e0c1){if(_0x254116['body']['id']){delete _0x254116[_0x80e0('0x48')]['id'];}return db[_0x80e0('0x2b')]['find']({'where':{'id':_0x254116[_0x80e0('0x42')]['id']}})['then'](handleEntityNotFound(_0x36e0c1,null))[_0x80e0('0x25')](saveUpdates(_0x254116[_0x80e0('0x48')],null))[_0x80e0('0x25')](respondWithResult(_0x36e0c1,null))[_0x80e0('0x40')](handleError(_0x36e0c1,null));};exports[_0x80e0('0x26')]=function(_0x1d48a7,_0x3982a0){return db[_0x80e0('0x2b')][_0x80e0('0x46')]({'where':{'id':_0x1d48a7[_0x80e0('0x42')]['id']}})[_0x80e0('0x25')](handleEntityNotFound(_0x3982a0,null))[_0x80e0('0x25')](removeEntity(_0x3982a0,null))[_0x80e0('0x40')](handleError(_0x3982a0,null));}; \ No newline at end of file +var _0x5601=['undefined','limit','count','set','apply','reject','update','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','findAll','rows','catch','show','find','create','body','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x51d99b,_0x40f96f){var _0x359a78=function(_0x4eba9d){while(--_0x4eba9d){_0x51d99b['push'](_0x51d99b['shift']());}};_0x359a78(++_0x40f96f);}(_0x5601,0x1cf));var _0x1560=function(_0x4bb0b9,_0x366125){_0x4bb0b9=_0x4bb0b9-0x0;var _0x24fef2=_0x5601[_0x4bb0b9];return _0x24fef2;};'use strict';var emlformat=require(_0x1560('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1560('0x1'));var rp=require(_0x1560('0x2'));var moment=require('moment');var BPromise=require(_0x1560('0x3'));var Mustache=require(_0x1560('0x4'));var util=require('util');var path=require(_0x1560('0x5'));var sox=require(_0x1560('0x6'));var csv=require(_0x1560('0x7'));var ejs=require(_0x1560('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1560('0x9'));var crypto=require('crypto');var jsforce=require(_0x1560('0xa'));var deskjs=require(_0x1560('0xb'));var toCsv=require(_0x1560('0x7'));var querystring=require(_0x1560('0xc'));var Papa=require('papaparse');var Redis=require(_0x1560('0xd'));var authService=require(_0x1560('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1560('0xf'));var logger=require(_0x1560('0x10'))(_0x1560('0x11'));var utils=require(_0x1560('0x12'));var config=require(_0x1560('0x13'));var licenseUtil=require(_0x1560('0x14'));var db=require(_0x1560('0x15'))['db'];function respondWithStatusCode(_0x40cc15,_0x2efccf){_0x2efccf=_0x2efccf||0xcc;return function(_0x2d68ed){if(_0x2d68ed){return _0x40cc15[_0x1560('0x16')](_0x2efccf);}return _0x40cc15[_0x1560('0x17')](_0x2efccf)[_0x1560('0x18')]();};}function respondWithResult(_0x14fb6d,_0x459b4c){_0x459b4c=_0x459b4c||0xc8;return function(_0xb9e78d){if(_0xb9e78d){return _0x14fb6d['status'](_0x459b4c)[_0x1560('0x19')](_0xb9e78d);}};}function respondWithFilteredResult(_0x4b4b54,_0x211a05){return function(_0x274d3b){if(_0x274d3b){var _0x2e7778=typeof _0x211a05[_0x1560('0x1a')]===_0x1560('0x1b')&&typeof _0x211a05[_0x1560('0x1c')]===_0x1560('0x1b');var _0x4052bd=_0x274d3b['count'];var _0x33186f=_0x2e7778?0x0:_0x211a05[_0x1560('0x1a')];var _0x263c04=_0x2e7778?_0x274d3b[_0x1560('0x1d')]:_0x211a05[_0x1560('0x1a')]+_0x211a05[_0x1560('0x1c')];var _0x3bce25;if(_0x263c04>=_0x4052bd){_0x263c04=_0x4052bd;_0x3bce25=0xc8;}else{_0x3bce25=0xce;}_0x4b4b54[_0x1560('0x17')](_0x3bce25);return _0x4b4b54[_0x1560('0x1e')]('Content-Range',_0x33186f+'-'+_0x263c04+'/'+_0x4052bd)['json'](_0x274d3b);}return null;};}function patchUpdates(_0x3c0e38){return function(_0x531b6f){try{jsonpatch[_0x1560('0x1f')](_0x531b6f,_0x3c0e38,!![]);}catch(_0x3a760b){return BPromise[_0x1560('0x20')](_0x3a760b);}return _0x531b6f['save']();};}function saveUpdates(_0x19fbbb,_0x4a0317){return function(_0x5b4484){if(_0x5b4484){return _0x5b4484[_0x1560('0x21')](_0x19fbbb)[_0x1560('0x22')](function(_0x2dc342){return _0x2dc342;});}return null;};}function removeEntity(_0x388471,_0x1b0d2e){return function(_0x582ade){if(_0x582ade){return _0x582ade[_0x1560('0x23')]()['then'](function(){_0x388471[_0x1560('0x17')](0xcc)[_0x1560('0x18')]();});}};}function handleEntityNotFound(_0x13d179,_0x5bf99a){return function(_0x3f0ad8){if(!_0x3f0ad8){_0x13d179[_0x1560('0x16')](0x194);}return _0x3f0ad8;};}function handleError(_0x3b493a,_0x3d7dd2){_0x3d7dd2=_0x3d7dd2||0x1f4;return function(_0x1f2ac9){logger['error'](_0x1f2ac9['stack']);if(_0x1f2ac9[_0x1560('0x24')]){delete _0x1f2ac9['name'];}_0x3b493a[_0x1560('0x17')](_0x3d7dd2)['send'](_0x1f2ac9);};}exports[_0x1560('0x25')]=function(_0x356205,_0x1106f9){var _0x2313bd={},_0x4ef425={},_0x277ffe={'count':0x0,'rows':[]};var _0x5a18d7=_[_0x1560('0x26')](db['SquareMessage'][_0x1560('0x27')],function(_0x290140){return{'name':_0x290140['fieldName'],'type':_0x290140[_0x1560('0x28')][_0x1560('0x29')]};});_0x4ef425[_0x1560('0x2a')]=_[_0x1560('0x26')](_0x5a18d7,_0x1560('0x24'));_0x4ef425[_0x1560('0x2b')]=_[_0x1560('0x2c')](_0x356205[_0x1560('0x2b')]);_0x4ef425[_0x1560('0x2d')]=_['intersection'](_0x4ef425[_0x1560('0x2a')],_0x4ef425[_0x1560('0x2b')]);_0x2313bd[_0x1560('0x2e')]=_[_0x1560('0x2f')](_0x4ef425[_0x1560('0x2a')],qs['fields'](_0x356205[_0x1560('0x2b')][_0x1560('0x30')]));_0x2313bd[_0x1560('0x2e')]=_0x2313bd['attributes'][_0x1560('0x31')]?_0x2313bd[_0x1560('0x2e')]:_0x4ef425['model'];if(!_0x356205[_0x1560('0x2b')][_0x1560('0x32')](_0x1560('0x33'))){_0x2313bd[_0x1560('0x1c')]=qs[_0x1560('0x1c')](_0x356205[_0x1560('0x2b')][_0x1560('0x1c')]);_0x2313bd[_0x1560('0x1a')]=qs['offset'](_0x356205[_0x1560('0x2b')][_0x1560('0x1a')]);}_0x2313bd[_0x1560('0x34')]=qs[_0x1560('0x35')](_0x356205[_0x1560('0x2b')][_0x1560('0x35')]);_0x2313bd[_0x1560('0x36')]=qs[_0x1560('0x2d')](_[_0x1560('0x37')](_0x356205['query'],_0x4ef425[_0x1560('0x2d')]),_0x5a18d7);if(_0x356205[_0x1560('0x2b')]['filter']){_0x2313bd[_0x1560('0x36')]=_[_0x1560('0x38')](_0x2313bd['where'],{'$or':_['map'](_0x5a18d7,function(_0x344652){if(_0x344652[_0x1560('0x28')]!==_0x1560('0x39')){var _0x179b98={};_0x179b98[_0x344652[_0x1560('0x24')]]={'$like':'%'+_0x356205[_0x1560('0x2b')][_0x1560('0x3a')]+'%'};return _0x179b98;}})});}_0x2313bd=_[_0x1560('0x38')]({},_0x2313bd,_0x356205[_0x1560('0x3b')]);var _0x371ee2={'where':_0x2313bd[_0x1560('0x36')]};return db[_0x1560('0x3c')][_0x1560('0x1d')](_0x371ee2)['then'](function(_0x4cfb59){_0x277ffe[_0x1560('0x1d')]=_0x4cfb59;if(_0x356205['query'][_0x1560('0x3d')]){_0x2313bd['include']=[{'all':!![]}];}return db['SquareMessage'][_0x1560('0x3e')](_0x2313bd);})[_0x1560('0x22')](function(_0x582351){_0x277ffe[_0x1560('0x3f')]=_0x582351;return _0x277ffe;})[_0x1560('0x22')](respondWithFilteredResult(_0x1106f9,_0x2313bd))[_0x1560('0x40')](handleError(_0x1106f9,null));};exports[_0x1560('0x41')]=function(_0x262df9,_0x3610e9){var _0x3a8404={'raw':!![],'where':{'id':_0x262df9['params']['id']}},_0x8098fd={};_0x8098fd[_0x1560('0x2a')]=_['keys'](db[_0x1560('0x3c')][_0x1560('0x27')]);_0x8098fd['query']=_[_0x1560('0x2c')](_0x262df9[_0x1560('0x2b')]);_0x8098fd[_0x1560('0x2d')]=_[_0x1560('0x2f')](_0x8098fd[_0x1560('0x2a')],_0x8098fd[_0x1560('0x2b')]);_0x3a8404[_0x1560('0x2e')]=_[_0x1560('0x2f')](_0x8098fd['model'],qs[_0x1560('0x30')](_0x262df9[_0x1560('0x2b')][_0x1560('0x30')]));_0x3a8404[_0x1560('0x2e')]=_0x3a8404[_0x1560('0x2e')]['length']?_0x3a8404[_0x1560('0x2e')]:_0x8098fd[_0x1560('0x2a')];if(_0x262df9['query']['includeAll']){_0x3a8404['include']=[{'all':!![]}];}_0x3a8404=_[_0x1560('0x38')]({},_0x3a8404,_0x262df9['options']);return db['SquareMessage'][_0x1560('0x42')](_0x3a8404)[_0x1560('0x22')](handleEntityNotFound(_0x3610e9,null))[_0x1560('0x22')](respondWithResult(_0x3610e9,null))[_0x1560('0x40')](handleError(_0x3610e9,null));};exports[_0x1560('0x43')]=function(_0x4399c7,_0x200778){return db['SquareMessage'][_0x1560('0x43')](_0x4399c7['body'],{})['then'](respondWithResult(_0x200778,0xc9))['catch'](handleError(_0x200778,null));};exports[_0x1560('0x21')]=function(_0x134df2,_0x4e8e8b){if(_0x134df2[_0x1560('0x44')]['id']){delete _0x134df2[_0x1560('0x44')]['id'];}return db[_0x1560('0x3c')]['find']({'where':{'id':_0x134df2[_0x1560('0x45')]['id']}})[_0x1560('0x22')](handleEntityNotFound(_0x4e8e8b,null))['then'](saveUpdates(_0x134df2[_0x1560('0x44')],null))['then'](respondWithResult(_0x4e8e8b,null))[_0x1560('0x40')](handleError(_0x4e8e8b,null));};exports[_0x1560('0x23')]=function(_0x5c4611,_0x355727){return db[_0x1560('0x3c')][_0x1560('0x42')]({'where':{'id':_0x5c4611['params']['id']}})[_0x1560('0x22')](handleEntityNotFound(_0x355727,null))[_0x1560('0x22')](removeEntity(_0x355727,null))[_0x1560('0x40')](handleError(_0x355727,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 8aa8189..77608ef 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 _0x8fe8=['SquareMessage','square_messages','lodash','util','api','moment','request-promise','path','rimraf','./squareMessage.attributes'];(function(_0x5a9795,_0x3ec720){var _0x1003e6=function(_0x52334f){while(--_0x52334f){_0x5a9795['push'](_0x5a9795['shift']());}};_0x1003e6(++_0x3ec720);}(_0x8fe8,0x138));var _0x88fe=function(_0x3e5dac,_0x284ce7){_0x3e5dac=_0x3e5dac-0x0;var _0x1ccbab=_0x8fe8[_0x3e5dac];return _0x1ccbab;};'use strict';var _=require(_0x88fe('0x0'));var util=require(_0x88fe('0x1'));var logger=require('../../config/logger')(_0x88fe('0x2'));var moment=require(_0x88fe('0x3'));var BPromise=require('bluebird');var rp=require(_0x88fe('0x4'));var fs=require('fs');var path=require(_0x88fe('0x5'));var rimraf=require(_0x88fe('0x6'));var config=require('../../config/environment');var attributes=require(_0x88fe('0x7'));module['exports']=function(_0x421347,_0x157b80){return _0x421347['define'](_0x88fe('0x8'),attributes,{'tableName':_0x88fe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d5f=['exports','define','SquareMessage','square_messages','../../config/logger','api','request-promise','./squareMessage.attributes'];(function(_0x13b152,_0x49df45){var _0x2ed105=function(_0x5086be){while(--_0x5086be){_0x13b152['push'](_0x13b152['shift']());}};_0x2ed105(++_0x49df45);}(_0x8d5f,0x1dc));var _0xf8d5=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x8d5f[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf8d5('0x0'))(_0xf8d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf8d5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8d5('0x3'));module[_0xf8d5('0x4')]=function(_0xdfa0fc,_0x237fec){return _0xdfa0fc[_0xf8d5('0x5')](_0xf8d5('0x6'),attributes,{'tableName':_0xf8d5('0x7'),'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 fd18e72..1556fc4 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 _0x54ac=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','body','options','then','debug','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x54ac,0x1e1));var _0xc54a=function(_0x5c2d75,_0x4035fc){_0x5c2d75=_0x5c2d75-0x0;var _0x48f399=_0x54ac[_0x5c2d75];return _0x48f399;};'use strict';var _=require(_0xc54a('0x0'));var util=require(_0xc54a('0x1'));var moment=require(_0xc54a('0x2'));var BPromise=require(_0xc54a('0x3'));var rs=require(_0xc54a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc54a('0x5'))['db'];var utils=require(_0xc54a('0x6'));var logger=require(_0xc54a('0x7'))('rpc');var config=require(_0xc54a('0x8'));var jayson=require(_0xc54a('0x9'));var client=jayson['client'][_0xc54a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x119347,_0x473d57,_0x53cf19){return new BPromise(function(_0x204b41,_0x4b2db1){return client['request'](_0x119347,_0x53cf19)['then'](function(_0x29a396){logger[_0xc54a('0xb')]('SquareMessage,\x20%s,\x20%s',_0x473d57,_0xc54a('0xc'));logger['debug'](_0xc54a('0xd'),_0x473d57,_0xc54a('0xc'),JSON['stringify'](_0x29a396));if(_0x29a396[_0xc54a('0xe')]){if(_0x29a396[_0xc54a('0xe')][_0xc54a('0xf')]===0x1f4){logger[_0xc54a('0xe')](_0xc54a('0x10'),_0x473d57,_0x29a396['error']['message']);return _0x4b2db1(_0x29a396[_0xc54a('0xe')]['message']);}logger[_0xc54a('0xe')]('SquareMessage,\x20%s,\x20%s',_0x473d57,_0x29a396[_0xc54a('0xe')][_0xc54a('0x11')]);return _0x204b41(_0x29a396['error']['message']);}else{logger[_0xc54a('0xb')](_0xc54a('0x10'),_0x473d57,'request\x20sent');_0x204b41(_0x29a396[_0xc54a('0x12')][_0xc54a('0x11')]);}})[_0xc54a('0x13')](function(_0x23b427){logger['error'](_0xc54a('0x10'),_0x473d57,_0x23b427);_0x4b2db1(_0x23b427);});});}exports[_0xc54a('0x14')]=function(_0x2a002d){var _0x496d8d=this;return new Promise(function(_0x385c70,_0x3f3cdd){return db[_0xc54a('0x15')]['create'](_0x2a002d[_0xc54a('0x16')],{'raw':_0x2a002d[_0xc54a('0x17')]?_0x2a002d[_0xc54a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc54a('0x18')](function(_0x54765f){logger[_0xc54a('0xb')](_0xc54a('0x14'),_0x2a002d);logger[_0xc54a('0x19')](_0xc54a('0x14'),_0x2a002d,JSON[_0xc54a('0x1a')](_0x54765f));_0x385c70(_0x54765f);})[_0xc54a('0x13')](function(_0x15ed59){logger['error'](_0xc54a('0x14'),_0x15ed59['message'],_0x2a002d);_0x3f3cdd(_0x496d8d[_0xc54a('0xe')](0x1f4,_0x15ed59[_0xc54a('0x11')]));});});}; \ No newline at end of file +var _0x52b6=['catch','CreateSquareMessage','SquareMessage','create','options','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xa76664,_0x5e32db){var _0x3f7743=function(_0x477dee){while(--_0x477dee){_0xa76664['push'](_0xa76664['shift']());}};_0x3f7743(++_0x5e32db);}(_0x52b6,0x88));var _0x652b=function(_0x44fe6a,_0x5cd6df){_0x44fe6a=_0x44fe6a-0x0;var _0x1643f1=_0x52b6[_0x44fe6a];return _0x1643f1;};'use strict';var _=require('lodash');var util=require(_0x652b('0x0'));var moment=require(_0x652b('0x1'));var BPromise=require('bluebird');var rs=require(_0x652b('0x2'));var fs=require('fs');var Redis=require(_0x652b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x652b('0x4'));var logger=require(_0x652b('0x5'))('rpc');var config=require(_0x652b('0x6'));var jayson=require(_0x652b('0x7'));var client=jayson[_0x652b('0x8')][_0x652b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30700d,_0x44e55b,_0x214e84){return new BPromise(function(_0xadcce1,_0x796b5a){return client['request'](_0x30700d,_0x214e84)[_0x652b('0xa')](function(_0x6715bd){logger[_0x652b('0xb')](_0x652b('0xc'),_0x44e55b,_0x652b('0xd'));logger[_0x652b('0xe')](_0x652b('0xf'),_0x44e55b,_0x652b('0xd'),JSON[_0x652b('0x10')](_0x6715bd));if(_0x6715bd['error']){if(_0x6715bd[_0x652b('0x11')]['code']===0x1f4){logger['error'](_0x652b('0xc'),_0x44e55b,_0x6715bd[_0x652b('0x11')][_0x652b('0x12')]);return _0x796b5a(_0x6715bd['error']['message']);}logger[_0x652b('0x11')](_0x652b('0xc'),_0x44e55b,_0x6715bd['error']['message']);return _0xadcce1(_0x6715bd[_0x652b('0x11')][_0x652b('0x12')]);}else{logger[_0x652b('0xb')]('SquareMessage,\x20%s,\x20%s',_0x44e55b,_0x652b('0xd'));_0xadcce1(_0x6715bd[_0x652b('0x13')][_0x652b('0x12')]);}})[_0x652b('0x14')](function(_0x4387e4){logger[_0x652b('0x11')](_0x652b('0xc'),_0x44e55b,_0x4387e4);_0x796b5a(_0x4387e4);});});}exports[_0x652b('0x15')]=function(_0x672882){var _0x5257a6=this;return new Promise(function(_0x3c4be7,_0x45948c){return db[_0x652b('0x16')][_0x652b('0x17')](_0x672882['body'],{'raw':_0x672882[_0x652b('0x18')]?_0x672882[_0x652b('0x18')][_0x652b('0x19')]===undefined?!![]:![]:!![]})[_0x652b('0xa')](function(_0x601ef0){logger[_0x652b('0xb')]('CreateSquareMessage',_0x672882);logger[_0x652b('0xe')]('CreateSquareMessage',_0x672882,JSON[_0x652b('0x10')](_0x601ef0));_0x3c4be7(_0x601ef0);})[_0x652b('0x14')](function(_0x4110e5){logger['error'](_0x652b('0x15'),_0x4110e5[_0x652b('0x12')],_0x672882);_0x45948c(_0x5257a6['error'](0x1f4,_0x4110e5[_0x652b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ff8ebb2..1577165 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 _0x22a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','put','destroy'];(function(_0x3487c4,_0x5457dc){var _0x1622fa=function(_0x4ab6e8){while(--_0x4ab6e8){_0x3487c4['push'](_0x3487c4['shift']());}};_0x1622fa(++_0x5457dc);}(_0x22a8,0xa0));var _0x822a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x22a8[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var path=require(_0x822a('0x2'));var timeout=require(_0x822a('0x3'));var express=require(_0x822a('0x4'));var router=express[_0x822a('0x5')]();var fs_extra=require(_0x822a('0x6'));var auth=require(_0x822a('0x7'));var interaction=require(_0x822a('0x8'));var config=require(_0x822a('0x9'));var controller=require(_0x822a('0xa'));router[_0x822a('0xb')]('/',auth[_0x822a('0xc')](),controller['index']);router[_0x822a('0xb')](_0x822a('0xd'),auth['isAuthenticated'](),controller[_0x822a('0xe')]);router[_0x822a('0xb')](_0x822a('0xf'),auth[_0x822a('0xc')](),timeout(_0x822a('0x10')),controller[_0x822a('0x11')]);router['post']('/',auth[_0x822a('0xc')](),controller['create']);router[_0x822a('0x12')](_0x822a('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x822a('0xd'),auth[_0x822a('0xc')](),controller[_0x822a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x92d3=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post'];(function(_0x184a56,_0x503f50){var _0x89ba34=function(_0x2cce45){while(--_0x2cce45){_0x184a56['push'](_0x184a56['shift']());}};_0x89ba34(++_0x503f50);}(_0x92d3,0x1a3));var _0x392d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x92d3[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require(_0x392d('0x0'));var util=require(_0x392d('0x1'));var path=require(_0x392d('0x2'));var timeout=require(_0x392d('0x3'));var express=require(_0x392d('0x4'));var router=express[_0x392d('0x5')]();var fs_extra=require(_0x392d('0x6'));var auth=require(_0x392d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x392d('0x8'));var controller=require(_0x392d('0x9'));router[_0x392d('0xa')]('/',auth[_0x392d('0xb')](),controller[_0x392d('0xc')]);router['get'](_0x392d('0xd'),auth['isAuthenticated'](),controller[_0x392d('0xe')]);router[_0x392d('0xa')]('/:id/test',auth['isAuthenticated'](),timeout(_0x392d('0xf')),controller[_0x392d('0x10')]);router[_0x392d('0x11')]('/',auth['isAuthenticated'](),controller[_0x392d('0x12')]);router[_0x392d('0x13')](_0x392d('0xd'),auth['isAuthenticated'](),controller[_0x392d('0x14')]);router[_0x392d('0x15')](_0x392d('0xd'),auth[_0x392d('0xb')](),controller['destroy']);module[_0x392d('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 60179de..319d97e 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 _0xa110=['sequelize','exports','STRING','name'];(function(_0x4f0441,_0x429eab){var _0x4c1f4f=function(_0x15b5af){while(--_0x15b5af){_0x4f0441['push'](_0x4f0441['shift']());}};_0x4c1f4f(++_0x429eab);}(_0xa110,0x64));var _0x0a11=function(_0x40f9d0,_0x51a3ec){_0x40f9d0=_0x40f9d0-0x0;var _0x4f09a2=_0xa110[_0x40f9d0];return _0x4f09a2;};'use strict';var Sequelize=require(_0x0a11('0x0'));module[_0x0a11('0x1')]={'name':{'type':Sequelize[_0x0a11('0x2')],'unique':_0x0a11('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0a11('0x2')]},'description':{'type':Sequelize[_0x0a11('0x2')]}}; \ No newline at end of file +var _0xc02c=['sequelize','exports','STRING','name'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xc02c,0x130));var _0xcc02=function(_0x5465c0,_0x3786f7){_0x5465c0=_0x5465c0-0x0;var _0x45ff36=_0xc02c[_0x5465c0];return _0x45ff36;};'use strict';var Sequelize=require(_0xcc02('0x0'));module[_0xcc02('0x1')]={'name':{'type':Sequelize[_0xcc02('0x2')],'unique':_0xcc02('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xcc02('0x2')]},'description':{'type':Sequelize[_0xcc02('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a86a186..eb1a5b8 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 _0x8b4f=['../../mysqldb','status','json','offset','count','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','SquareOdbc','include','rows','show','params','intersection','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b4f,0x197));var _0xf8b4=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x8b4f[_0x3de7e0];return _0x11d0b3;};'use strict';var emlformat=require(_0xf8b4('0x0'));var rimraf=require(_0xf8b4('0x1'));var zipdir=require(_0xf8b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8b4('0x3'));var moment=require(_0xf8b4('0x4'));var BPromise=require(_0xf8b4('0x5'));var Mustache=require('mustache');var util=require(_0xf8b4('0x6'));var path=require('path');var sox=require(_0xf8b4('0x7'));var csv=require(_0xf8b4('0x8'));var ejs=require(_0xf8b4('0x9'));var fs=require('fs');var fs_extra=require(_0xf8b4('0xa'));var _=require(_0xf8b4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf8b4('0xc'));var deskjs=require(_0xf8b4('0xd'));var toCsv=require(_0xf8b4('0x8'));var querystring=require(_0xf8b4('0xe'));var Papa=require(_0xf8b4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8b4('0x10'));var as=require(_0xf8b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8b4('0x12'))(_0xf8b4('0x13'));var utils=require(_0xf8b4('0x14'));var config=require(_0xf8b4('0x15'));var licenseUtil=require(_0xf8b4('0x16'));var db=require(_0xf8b4('0x17'))['db'];function respondWithStatusCode(_0x594749,_0x1aeb42){_0x1aeb42=_0x1aeb42||0xcc;return function(_0x2b9000){if(_0x2b9000){return _0x594749['sendStatus'](_0x1aeb42);}return _0x594749[_0xf8b4('0x18')](_0x1aeb42)['end']();};}function respondWithResult(_0x4d5471,_0x29e2ed){_0x29e2ed=_0x29e2ed||0xc8;return function(_0x242fc6){if(_0x242fc6){return _0x4d5471['status'](_0x29e2ed)[_0xf8b4('0x19')](_0x242fc6);}};}function respondWithFilteredResult(_0x50eb22,_0x45872b){return function(_0x4f8718){if(_0x4f8718){var _0x5bffbf=typeof _0x45872b[_0xf8b4('0x1a')]==='undefined'&&typeof _0x45872b['limit']==='undefined';var _0x115b9f=_0x4f8718[_0xf8b4('0x1b')];var _0x2e2499=_0x5bffbf?0x0:_0x45872b['offset'];var _0x5bb1bf=_0x5bffbf?_0x4f8718[_0xf8b4('0x1b')]:_0x45872b[_0xf8b4('0x1a')]+_0x45872b['limit'];var _0x54be0f;if(_0x5bb1bf>=_0x115b9f){_0x5bb1bf=_0x115b9f;_0x54be0f=0xc8;}else{_0x54be0f=0xce;}_0x50eb22[_0xf8b4('0x18')](_0x54be0f);return _0x50eb22['set'](_0xf8b4('0x1c'),_0x2e2499+'-'+_0x5bb1bf+'/'+_0x115b9f)[_0xf8b4('0x19')](_0x4f8718);}return null;};}function patchUpdates(_0x3a3547){return function(_0x20df64){try{jsonpatch[_0xf8b4('0x1d')](_0x20df64,_0x3a3547,!![]);}catch(_0x54db4c){return BPromise[_0xf8b4('0x1e')](_0x54db4c);}return _0x20df64[_0xf8b4('0x1f')]();};}function saveUpdates(_0x4b0b1b,_0x369107){return function(_0x31b794){if(_0x31b794){return _0x31b794[_0xf8b4('0x20')](_0x4b0b1b)[_0xf8b4('0x21')](function(_0x490fd8){return _0x490fd8;});}return null;};}function removeEntity(_0x50c5fd,_0x1ebfc8){return function(_0x232d68){if(_0x232d68){return _0x232d68['destroy']()[_0xf8b4('0x21')](function(){var _0x190422=_0x232d68[_0xf8b4('0x22')]({'plain':!![]});var _0x36dda9=_0xf8b4('0x23');return db[_0xf8b4('0x24')]['destroy']({'where':{'type':_0x36dda9,'resourceId':_0x190422['id']}})[_0xf8b4('0x21')](function(){return _0x232d68;});})[_0xf8b4('0x21')](function(){_0x50c5fd[_0xf8b4('0x18')](0xcc)[_0xf8b4('0x25')]();});}};}function handleEntityNotFound(_0xc93c3c,_0x50b1b6){return function(_0x55bbf9){if(!_0x55bbf9){_0xc93c3c[_0xf8b4('0x26')](0x194);}return _0x55bbf9;};}function handleError(_0x19ae9e,_0x262af1){_0x262af1=_0x262af1||0x1f4;return function(_0x1e0ee5){logger['error'](_0x1e0ee5[_0xf8b4('0x27')]);if(_0x1e0ee5[_0xf8b4('0x28')]){delete _0x1e0ee5[_0xf8b4('0x28')];}_0x19ae9e['status'](_0x262af1)[_0xf8b4('0x29')](_0x1e0ee5);};}exports[_0xf8b4('0x2a')]=function(_0x49d22e,_0x45c56d){var _0x1f4084={},_0x331291={},_0x4ccda3={'count':0x0,'rows':[]};var _0x40e54a=_[_0xf8b4('0x2b')](db['SquareOdbc'][_0xf8b4('0x2c')],function(_0x27ff93){return{'name':_0x27ff93[_0xf8b4('0x2d')],'type':_0x27ff93[_0xf8b4('0x2e')][_0xf8b4('0x2f')]};});_0x331291[_0xf8b4('0x30')]=_[_0xf8b4('0x2b')](_0x40e54a,'name');_0x331291[_0xf8b4('0x31')]=_[_0xf8b4('0x32')](_0x49d22e[_0xf8b4('0x31')]);_0x331291['filters']=_['intersection'](_0x331291['model'],_0x331291['query']);_0x1f4084[_0xf8b4('0x33')]=_['intersection'](_0x331291[_0xf8b4('0x30')],qs[_0xf8b4('0x34')](_0x49d22e[_0xf8b4('0x31')][_0xf8b4('0x34')]));_0x1f4084[_0xf8b4('0x33')]=_0x1f4084[_0xf8b4('0x33')][_0xf8b4('0x35')]?_0x1f4084[_0xf8b4('0x33')]:_0x331291[_0xf8b4('0x30')];if(!_0x49d22e[_0xf8b4('0x31')][_0xf8b4('0x36')](_0xf8b4('0x37'))){_0x1f4084[_0xf8b4('0x38')]=qs[_0xf8b4('0x38')](_0x49d22e[_0xf8b4('0x31')]['limit']);_0x1f4084['offset']=qs[_0xf8b4('0x1a')](_0x49d22e['query'][_0xf8b4('0x1a')]);}_0x1f4084[_0xf8b4('0x39')]=qs[_0xf8b4('0x3a')](_0x49d22e['query'][_0xf8b4('0x3a')]);_0x1f4084[_0xf8b4('0x3b')]=qs['filters'](_[_0xf8b4('0x3c')](_0x49d22e[_0xf8b4('0x31')],_0x331291[_0xf8b4('0x3d')]),_0x40e54a);if(_0x49d22e[_0xf8b4('0x31')]['filter']){_0x1f4084['where']=_[_0xf8b4('0x3e')](_0x1f4084['where'],{'$or':_[_0xf8b4('0x2b')](_0x40e54a,function(_0x4b99ff){if(_0x4b99ff[_0xf8b4('0x2e')]!==_0xf8b4('0x3f')){var _0x577ed0={};_0x577ed0[_0x4b99ff[_0xf8b4('0x28')]]={'$like':'%'+_0x49d22e[_0xf8b4('0x31')]['filter']+'%'};return _0x577ed0;}})});}_0x1f4084=_['merge']({},_0x1f4084,_0x49d22e['options']);var _0x2cd0f6={'where':_0x1f4084[_0xf8b4('0x3b')]};return db[_0xf8b4('0x40')]['count'](_0x2cd0f6)[_0xf8b4('0x21')](function(_0x3daa69){_0x4ccda3[_0xf8b4('0x1b')]=_0x3daa69;if(_0x49d22e['query']['includeAll']){_0x1f4084[_0xf8b4('0x41')]=[{'all':!![]}];}return db[_0xf8b4('0x40')]['findAll'](_0x1f4084);})['then'](function(_0x2a05f2){_0x4ccda3[_0xf8b4('0x42')]=_0x2a05f2;return _0x4ccda3;})[_0xf8b4('0x21')](respondWithFilteredResult(_0x45c56d,_0x1f4084))['catch'](handleError(_0x45c56d,null));};exports[_0xf8b4('0x43')]=function(_0x6aa041,_0x408021){var _0xf02ab9={'raw':!![],'where':{'id':_0x6aa041[_0xf8b4('0x44')]['id']}},_0x44e605={};_0x44e605[_0xf8b4('0x30')]=_['keys'](db[_0xf8b4('0x40')]['rawAttributes']);_0x44e605['query']=_['keys'](_0x6aa041[_0xf8b4('0x31')]);_0x44e605[_0xf8b4('0x3d')]=_[_0xf8b4('0x45')](_0x44e605[_0xf8b4('0x30')],_0x44e605[_0xf8b4('0x31')]);_0xf02ab9[_0xf8b4('0x33')]=_[_0xf8b4('0x45')](_0x44e605[_0xf8b4('0x30')],qs['fields'](_0x6aa041[_0xf8b4('0x31')]['fields']));_0xf02ab9[_0xf8b4('0x33')]=_0xf02ab9['attributes'][_0xf8b4('0x35')]?_0xf02ab9[_0xf8b4('0x33')]:_0x44e605[_0xf8b4('0x30')];if(_0x6aa041[_0xf8b4('0x31')]['includeAll']){_0xf02ab9['include']=[{'all':!![]}];}_0xf02ab9=_['merge']({},_0xf02ab9,_0x6aa041[_0xf8b4('0x46')]);return db['SquareOdbc'][_0xf8b4('0x47')](_0xf02ab9)['then'](handleEntityNotFound(_0x408021,null))[_0xf8b4('0x21')](respondWithResult(_0x408021,null))[_0xf8b4('0x48')](handleError(_0x408021,null));};exports['create']=function(_0x3d2f96,_0x4d20c9){return db[_0xf8b4('0x40')][_0xf8b4('0x49')](_0x3d2f96['body'],{})[_0xf8b4('0x21')](function(_0x25ea53){var _0x4763ef=_0x3d2f96[_0xf8b4('0x4a')][_0xf8b4('0x22')]({'plain':!![]});if(!_0x4763ef)throw new Error(_0xf8b4('0x4b'));if(_0x4763ef[_0xf8b4('0x4c')]===_0xf8b4('0x4a')){var _0x30bce3=_0x25ea53[_0xf8b4('0x22')]({'plain':!![]});var _0x4bf578=_0xf8b4('0x23');return db[_0xf8b4('0x4d')][_0xf8b4('0x47')]({'where':{'name':_0x4bf578,'userProfileId':_0x4763ef[_0xf8b4('0x4e')]},'raw':!![]})[_0xf8b4('0x21')](function(_0xb6fbca){if(_0xb6fbca&&_0xb6fbca[_0xf8b4('0x4f')]===0x0){return db[_0xf8b4('0x24')]['create']({'name':_0x30bce3[_0xf8b4('0x28')],'resourceId':_0x30bce3['id'],'type':_0xb6fbca['name'],'sectionId':_0xb6fbca['id']},{})[_0xf8b4('0x21')](function(){return _0x25ea53;});}else{return _0x25ea53;}})[_0xf8b4('0x48')](function(_0x5a803a){logger[_0xf8b4('0x50')](_0xf8b4('0x51'),_0x5a803a);throw _0x5a803a;});}return _0x25ea53;})[_0xf8b4('0x21')](respondWithResult(_0x4d20c9,0xc9))[_0xf8b4('0x48')](handleError(_0x4d20c9,null));};exports[_0xf8b4('0x20')]=function(_0x1afc05,_0x4529eb){if(_0x1afc05[_0xf8b4('0x52')]['id']){delete _0x1afc05[_0xf8b4('0x52')]['id'];}return db[_0xf8b4('0x40')]['find']({'where':{'id':_0x1afc05['params']['id']}})[_0xf8b4('0x21')](handleEntityNotFound(_0x4529eb,null))[_0xf8b4('0x21')](saveUpdates(_0x1afc05[_0xf8b4('0x52')],null))[_0xf8b4('0x21')](respondWithResult(_0x4529eb,null))[_0xf8b4('0x48')](handleError(_0x4529eb,null));};exports['destroy']=function(_0x19a3e7,_0x241002){return db[_0xf8b4('0x40')][_0xf8b4('0x47')]({'where':{'id':_0x19a3e7[_0xf8b4('0x44')]['id']}})['then'](handleEntityNotFound(_0x241002,null))['then'](removeEntity(_0x241002,null))[_0xf8b4('0x48')](handleError(_0x241002,null));};exports[_0xf8b4('0x53')]=function(_0x1dcce0,_0x3f1ddf,_0xdc7630){var _0x3b1d1c;return db['SquareOdbc'][_0xf8b4('0x47')]({'where':{'id':_0x1dcce0[_0xf8b4('0x44')]['id']},'attributes':['id','dsn']})[_0xf8b4('0x21')](handleEntityNotFound(_0x3f1ddf,null))[_0xf8b4('0x21')](function(_0x269f31){if(_0x269f31){var _0xdb5509=require(_0xf8b4('0x54'))();_0xdb5509[_0xf8b4('0x55')](_0x269f31['dsn']);_0xdb5509['closeSync']();return _0x269f31;}})[_0xf8b4('0x21')](respondWithResult(_0x3f1ddf,null))['catch'](handleError(_0x3f1ddf,null));}; \ No newline at end of file +var _0x9464=['key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','show','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','ODBC','end','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9464,0x132));var _0x4946=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x9464[_0x57cbfb];return _0x4cb933;};'use strict';var emlformat=require(_0x4946('0x0'));var rimraf=require(_0x4946('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4946('0x2'));var moment=require(_0x4946('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4946('0x4'));var util=require(_0x4946('0x5'));var path=require(_0x4946('0x6'));var sox=require('sox');var csv=require(_0x4946('0x7'));var ejs=require(_0x4946('0x8'));var fs=require('fs');var fs_extra=require(_0x4946('0x9'));var _=require(_0x4946('0xa'));var squel=require(_0x4946('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4946('0x7'));var querystring=require(_0x4946('0xc'));var Papa=require(_0x4946('0xd'));var Redis=require(_0x4946('0xe'));var authService=require(_0x4946('0xf'));var qs=require(_0x4946('0x10'));var as=require(_0x4946('0x11'));var hardwareService=require(_0x4946('0x12'));var logger=require('../../config/logger')(_0x4946('0x13'));var utils=require(_0x4946('0x14'));var config=require(_0x4946('0x15'));var licenseUtil=require(_0x4946('0x16'));var db=require(_0x4946('0x17'))['db'];function respondWithStatusCode(_0x3b743e,_0x4462cf){_0x4462cf=_0x4462cf||0xcc;return function(_0x49d96d){if(_0x49d96d){return _0x3b743e['sendStatus'](_0x4462cf);}return _0x3b743e[_0x4946('0x18')](_0x4462cf)['end']();};}function respondWithResult(_0x2bc383,_0x52dfc6){_0x52dfc6=_0x52dfc6||0xc8;return function(_0x24c06c){if(_0x24c06c){return _0x2bc383[_0x4946('0x18')](_0x52dfc6)[_0x4946('0x19')](_0x24c06c);}};}function respondWithFilteredResult(_0x248aa0,_0x3477d4){return function(_0x424b1c){if(_0x424b1c){var _0x318018=typeof _0x3477d4['offset']==='undefined'&&typeof _0x3477d4['limit']===_0x4946('0x1a');var _0x550337=_0x424b1c[_0x4946('0x1b')];var _0x244ff8=_0x318018?0x0:_0x3477d4[_0x4946('0x1c')];var _0x3888b8=_0x318018?_0x424b1c['count']:_0x3477d4[_0x4946('0x1c')]+_0x3477d4[_0x4946('0x1d')];var _0x2e62d5;if(_0x3888b8>=_0x550337){_0x3888b8=_0x550337;_0x2e62d5=0xc8;}else{_0x2e62d5=0xce;}_0x248aa0[_0x4946('0x18')](_0x2e62d5);return _0x248aa0[_0x4946('0x1e')](_0x4946('0x1f'),_0x244ff8+'-'+_0x3888b8+'/'+_0x550337)[_0x4946('0x19')](_0x424b1c);}return null;};}function patchUpdates(_0x466dd5){return function(_0x574217){try{jsonpatch[_0x4946('0x20')](_0x574217,_0x466dd5,!![]);}catch(_0x454713){return BPromise[_0x4946('0x21')](_0x454713);}return _0x574217['save']();};}function saveUpdates(_0x14928d,_0x55a19b){return function(_0x42d014){if(_0x42d014){return _0x42d014[_0x4946('0x22')](_0x14928d)['then'](function(_0x31b85b){return _0x31b85b;});}return null;};}function removeEntity(_0x8303cf,_0x4f9143){return function(_0x1e1852){if(_0x1e1852){return _0x1e1852[_0x4946('0x23')]()[_0x4946('0x24')](function(){var _0xed2d1b=_0x1e1852[_0x4946('0x25')]({'plain':!![]});var _0x398278=_0x4946('0x26');return db['UserProfileResource'][_0x4946('0x23')]({'where':{'type':_0x398278,'resourceId':_0xed2d1b['id']}})[_0x4946('0x24')](function(){return _0x1e1852;});})[_0x4946('0x24')](function(){_0x8303cf['status'](0xcc)[_0x4946('0x27')]();});}};}function handleEntityNotFound(_0x5d79b7,_0x1cc164){return function(_0x505042){if(!_0x505042){_0x5d79b7[_0x4946('0x28')](0x194);}return _0x505042;};}function handleError(_0x2c128b,_0x32ba7c){_0x32ba7c=_0x32ba7c||0x1f4;return function(_0x51f0a0){logger[_0x4946('0x29')](_0x51f0a0[_0x4946('0x2a')]);if(_0x51f0a0[_0x4946('0x2b')]){delete _0x51f0a0[_0x4946('0x2b')];}_0x2c128b['status'](_0x32ba7c)[_0x4946('0x2c')](_0x51f0a0);};}exports[_0x4946('0x2d')]=function(_0x5bf00f,_0x3a1400){var _0x4c68d0={},_0x26e7d9={},_0x10177c={'count':0x0,'rows':[]};var _0x1c8df1=_[_0x4946('0x2e')](db[_0x4946('0x2f')][_0x4946('0x30')],function(_0x519b83){return{'name':_0x519b83[_0x4946('0x31')],'type':_0x519b83['type'][_0x4946('0x32')]};});_0x26e7d9['model']=_[_0x4946('0x2e')](_0x1c8df1,'name');_0x26e7d9[_0x4946('0x33')]=_[_0x4946('0x34')](_0x5bf00f[_0x4946('0x33')]);_0x26e7d9[_0x4946('0x35')]=_[_0x4946('0x36')](_0x26e7d9[_0x4946('0x37')],_0x26e7d9[_0x4946('0x33')]);_0x4c68d0['attributes']=_[_0x4946('0x36')](_0x26e7d9[_0x4946('0x37')],qs[_0x4946('0x38')](_0x5bf00f[_0x4946('0x33')]['fields']));_0x4c68d0[_0x4946('0x39')]=_0x4c68d0[_0x4946('0x39')][_0x4946('0x3a')]?_0x4c68d0[_0x4946('0x39')]:_0x26e7d9[_0x4946('0x37')];if(!_0x5bf00f[_0x4946('0x33')]['hasOwnProperty'](_0x4946('0x3b'))){_0x4c68d0['limit']=qs[_0x4946('0x1d')](_0x5bf00f[_0x4946('0x33')][_0x4946('0x1d')]);_0x4c68d0[_0x4946('0x1c')]=qs['offset'](_0x5bf00f['query'][_0x4946('0x1c')]);}_0x4c68d0[_0x4946('0x3c')]=qs[_0x4946('0x3d')](_0x5bf00f[_0x4946('0x33')][_0x4946('0x3d')]);_0x4c68d0['where']=qs['filters'](_[_0x4946('0x3e')](_0x5bf00f[_0x4946('0x33')],_0x26e7d9[_0x4946('0x35')]),_0x1c8df1);if(_0x5bf00f[_0x4946('0x33')][_0x4946('0x3f')]){_0x4c68d0['where']=_[_0x4946('0x40')](_0x4c68d0[_0x4946('0x41')],{'$or':_['map'](_0x1c8df1,function(_0x504a2f){if(_0x504a2f[_0x4946('0x42')]!==_0x4946('0x43')){var _0x2708b2={};_0x2708b2[_0x504a2f[_0x4946('0x2b')]]={'$like':'%'+_0x5bf00f[_0x4946('0x33')]['filter']+'%'};return _0x2708b2;}})});}_0x4c68d0=_[_0x4946('0x40')]({},_0x4c68d0,_0x5bf00f[_0x4946('0x44')]);var _0x15c321={'where':_0x4c68d0[_0x4946('0x41')]};return db['SquareOdbc'][_0x4946('0x1b')](_0x15c321)[_0x4946('0x24')](function(_0x375e6a){_0x10177c[_0x4946('0x1b')]=_0x375e6a;if(_0x5bf00f['query']['includeAll']){_0x4c68d0[_0x4946('0x45')]=[{'all':!![]}];}return db[_0x4946('0x2f')][_0x4946('0x46')](_0x4c68d0);})[_0x4946('0x24')](function(_0x4bbc7f){_0x10177c['rows']=_0x4bbc7f;return _0x10177c;})[_0x4946('0x24')](respondWithFilteredResult(_0x3a1400,_0x4c68d0))['catch'](handleError(_0x3a1400,null));};exports[_0x4946('0x47')]=function(_0x58cf45,_0x1c1453){var _0x17934b={'raw':!![],'where':{'id':_0x58cf45['params']['id']}},_0x349b47={};_0x349b47['model']=_['keys'](db[_0x4946('0x2f')][_0x4946('0x30')]);_0x349b47[_0x4946('0x33')]=_['keys'](_0x58cf45[_0x4946('0x33')]);_0x349b47['filters']=_[_0x4946('0x36')](_0x349b47['model'],_0x349b47[_0x4946('0x33')]);_0x17934b['attributes']=_[_0x4946('0x36')](_0x349b47[_0x4946('0x37')],qs[_0x4946('0x38')](_0x58cf45['query']['fields']));_0x17934b[_0x4946('0x39')]=_0x17934b[_0x4946('0x39')][_0x4946('0x3a')]?_0x17934b[_0x4946('0x39')]:_0x349b47[_0x4946('0x37')];if(_0x58cf45[_0x4946('0x33')][_0x4946('0x48')]){_0x17934b[_0x4946('0x45')]=[{'all':!![]}];}_0x17934b=_[_0x4946('0x40')]({},_0x17934b,_0x58cf45['options']);return db[_0x4946('0x2f')][_0x4946('0x49')](_0x17934b)[_0x4946('0x24')](handleEntityNotFound(_0x1c1453,null))['then'](respondWithResult(_0x1c1453,null))[_0x4946('0x4a')](handleError(_0x1c1453,null));};exports[_0x4946('0x4b')]=function(_0xa3c4,_0x533797){return db[_0x4946('0x2f')]['create'](_0xa3c4[_0x4946('0x4c')],{})[_0x4946('0x24')](function(_0x163e82){var _0xa560f0=_0xa3c4[_0x4946('0x4d')][_0x4946('0x25')]({'plain':!![]});if(!_0xa560f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa560f0[_0x4946('0x4e')]===_0x4946('0x4d')){var _0x28011e=_0x163e82[_0x4946('0x25')]({'plain':!![]});var _0x2baf10=_0x4946('0x26');return db[_0x4946('0x4f')][_0x4946('0x49')]({'where':{'name':_0x2baf10,'userProfileId':_0xa560f0[_0x4946('0x50')]},'raw':!![]})[_0x4946('0x24')](function(_0x57d4f7){if(_0x57d4f7&&_0x57d4f7['autoAssociation']===0x0){return db[_0x4946('0x51')]['create']({'name':_0x28011e[_0x4946('0x2b')],'resourceId':_0x28011e['id'],'type':_0x57d4f7['name'],'sectionId':_0x57d4f7['id']},{})[_0x4946('0x24')](function(){return _0x163e82;});}else{return _0x163e82;}})['catch'](function(_0x4f1664){logger[_0x4946('0x29')](_0x4946('0x52'),_0x4f1664);throw _0x4f1664;});}return _0x163e82;})[_0x4946('0x24')](respondWithResult(_0x533797,0xc9))[_0x4946('0x4a')](handleError(_0x533797,null));};exports[_0x4946('0x22')]=function(_0x3a24b9,_0x42b162){if(_0x3a24b9['body']['id']){delete _0x3a24b9['body']['id'];}return db[_0x4946('0x2f')][_0x4946('0x49')]({'where':{'id':_0x3a24b9[_0x4946('0x53')]['id']}})['then'](handleEntityNotFound(_0x42b162,null))['then'](saveUpdates(_0x3a24b9[_0x4946('0x4c')],null))[_0x4946('0x24')](respondWithResult(_0x42b162,null))[_0x4946('0x4a')](handleError(_0x42b162,null));};exports['destroy']=function(_0x3537a1,_0x287bfb){return db['SquareOdbc'][_0x4946('0x49')]({'where':{'id':_0x3537a1[_0x4946('0x53')]['id']}})[_0x4946('0x24')](handleEntityNotFound(_0x287bfb,null))[_0x4946('0x24')](removeEntity(_0x287bfb,null))[_0x4946('0x4a')](handleError(_0x287bfb,null));};exports[_0x4946('0x54')]=function(_0x58639e,_0x139457,_0x32d7ac){var _0x96ca60;return db[_0x4946('0x2f')][_0x4946('0x49')]({'where':{'id':_0x58639e[_0x4946('0x53')]['id']},'attributes':['id',_0x4946('0x55')]})[_0x4946('0x24')](handleEntityNotFound(_0x139457,null))[_0x4946('0x24')](function(_0x4d8d46){if(_0x4d8d46){var _0x4ffd4a=require(_0x4946('0x56'))();_0x4ffd4a[_0x4946('0x57')](_0x4d8d46['dsn']);_0x4ffd4a[_0x4946('0x58')]();return _0x4d8d46;}})['then'](respondWithResult(_0x139457,null))[_0x4946('0x4a')](handleError(_0x139457,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1387e83..344b885 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 _0xa4bc=['rimraf','../../config/environment','./squareOdbc.attributes','lodash','util','path'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xa4bc,0x1ad));var _0xca4b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa4bc[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xca4b('0x0'));var util=require(_0xca4b('0x1'));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(_0xca4b('0x2'));var rimraf=require(_0xca4b('0x3'));var config=require(_0xca4b('0x4'));var attributes=require(_0xca4b('0x5'));module['exports']=function(_0x5cff80,_0x59306f){return _0x5cff80['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17ac=['lodash','../../config/logger','moment','rimraf','./squareOdbc.attributes','exports','define','square_odbc'];(function(_0x3a4617,_0x5bdbcd){var _0x2ebd09=function(_0x3a521d){while(--_0x3a521d){_0x3a4617['push'](_0x3a4617['shift']());}};_0x2ebd09(++_0x5bdbcd);}(_0x17ac,0xc0));var _0xc17a=function(_0x1399a4,_0x35ada6){_0x1399a4=_0x1399a4-0x0;var _0x5d1d9b=_0x17ac[_0x1399a4];return _0x5d1d9b;};'use strict';var _=require(_0xc17a('0x0'));var util=require('util');var logger=require(_0xc17a('0x1'))('api');var moment=require(_0xc17a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc17a('0x3'));var config=require('../../config/environment');var attributes=require(_0xc17a('0x4'));module[_0xc17a('0x5')]=function(_0x3086db,_0x3f3ab3){return _0x3086db[_0xc17a('0x6')]('SquareOdbc',attributes,{'tableName':_0xc17a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 122cb75..a222cbb 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 _0x5db0=['attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where'];(function(_0xea3ca8,_0xbfa6d3){var _0xc9c4a9=function(_0x307473){while(--_0x307473){_0xea3ca8['push'](_0xea3ca8['shift']());}};_0xc9c4a9(++_0xbfa6d3);}(_0x5db0,0x9f));var _0x05db=function(_0x449363,_0x49c688){_0x449363=_0x449363-0x0;var _0x2a8f64=_0x5db0[_0x449363];return _0x2a8f64;};'use strict';var _=require(_0x05db('0x0'));var util=require(_0x05db('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05db('0x2'));var db=require(_0x05db('0x3'))['db'];var utils=require(_0x05db('0x4'));var logger=require(_0x05db('0x5'))(_0x05db('0x6'));var config=require('../../config/environment');var jayson=require(_0x05db('0x7'));var client=jayson[_0x05db('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56994b,_0x2dd125,_0x460b8a){return new BPromise(function(_0x12e004,_0x35d4d8){return client['request'](_0x56994b,_0x460b8a)[_0x05db('0x9')](function(_0x3a6040){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x2dd125,_0x05db('0xa'));logger[_0x05db('0xb')](_0x05db('0xc'),_0x2dd125,_0x05db('0xa'),JSON[_0x05db('0xd')](_0x3a6040));if(_0x3a6040['error']){if(_0x3a6040[_0x05db('0xe')][_0x05db('0xf')]===0x1f4){logger[_0x05db('0xe')](_0x05db('0x10'),_0x2dd125,_0x3a6040[_0x05db('0xe')][_0x05db('0x11')]);return _0x35d4d8(_0x3a6040[_0x05db('0xe')][_0x05db('0x11')]);}logger['error'](_0x05db('0x10'),_0x2dd125,_0x3a6040['error'][_0x05db('0x11')]);return _0x12e004(_0x3a6040[_0x05db('0xe')]['message']);}else{logger[_0x05db('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2dd125,_0x05db('0xa'));_0x12e004(_0x3a6040[_0x05db('0x13')]['message']);}})[_0x05db('0x14')](function(_0x305103){logger['error'](_0x05db('0x10'),_0x2dd125,_0x305103);_0x35d4d8(_0x305103);});});}exports[_0x05db('0x15')]=function(_0x2066e8){var _0xb98d09=this;return new Promise(function(_0x3d4a2a,_0x424db5){return db[_0x05db('0x16')][_0x05db('0x17')]({'raw':_0x2066e8['options']?_0x2066e8[_0x05db('0x18')][_0x05db('0x19')]===undefined?!![]:![]:!![],'where':_0x2066e8['options']?_0x2066e8[_0x05db('0x18')][_0x05db('0x1a')]||null:null,'attributes':_0x2066e8[_0x05db('0x18')]?_0x2066e8[_0x05db('0x18')][_0x05db('0x1b')]||null:null,'include':_0x2066e8[_0x05db('0x18')]?_0x2066e8['options'][_0x05db('0x1c')]?_[_0x05db('0x1d')](_0x2066e8[_0x05db('0x18')][_0x05db('0x1c')],function(_0x357f13){return{'model':db[_0x357f13['model']],'as':_0x357f13['as'],'attributes':_0x357f13['attributes'],'include':_0x357f13[_0x05db('0x1c')]?_['map'](_0x357f13[_0x05db('0x1c')],function(_0x383f11){return{'model':db[_0x383f11[_0x05db('0x1e')]],'as':_0x383f11['as'],'attributes':_0x383f11[_0x05db('0x1b')],'include':_0x383f11[_0x05db('0x1c')]?_['map'](_0x383f11[_0x05db('0x1c')],function(_0x4885e0){return{'model':db[_0x4885e0['model']],'as':_0x4885e0['as'],'attributes':_0x4885e0[_0x05db('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x05db('0x9')](function(_0x3a6343){logger[_0x05db('0x12')](_0x05db('0x15'),_0x2066e8);logger[_0x05db('0xb')](_0x05db('0x15'),_0x2066e8,JSON[_0x05db('0xd')](_0x3a6343));_0x3d4a2a(_0x3a6343);})[_0x05db('0x14')](function(_0x180fa1){logger[_0x05db('0xe')]('ShowSquareOdbc',_0x180fa1[_0x05db('0x11')],_0x2066e8);_0x424db5(_0xb98d09[_0x05db('0xe')](0x1f4,_0x180fa1[_0x05db('0x11')]));});});}; \ No newline at end of file +var _0xa45e=['stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','model','include','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa45e,0x16f));var _0xea45=function(_0x31df0f,_0x526510){_0x31df0f=_0x31df0f-0x0;var _0x1d6b6c=_0xa45e[_0x31df0f];return _0x1d6b6c;};'use strict';var _=require(_0xea45('0x0'));var util=require(_0xea45('0x1'));var moment=require(_0xea45('0x2'));var BPromise=require(_0xea45('0x3'));var rs=require(_0xea45('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea45('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea45('0x6'))(_0xea45('0x7'));var config=require(_0xea45('0x8'));var jayson=require(_0xea45('0x9'));var client=jayson[_0xea45('0xa')][_0xea45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435ec6,_0x485ede,_0x2276c8){return new BPromise(function(_0x68d300,_0x5e2f34){return client[_0xea45('0xc')](_0x435ec6,_0x2276c8)[_0xea45('0xd')](function(_0x4be10b){logger[_0xea45('0xe')](_0xea45('0xf'),_0x485ede,'request\x20sent');logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x485ede,_0xea45('0x10'),JSON[_0xea45('0x11')](_0x4be10b));if(_0x4be10b['error']){if(_0x4be10b[_0xea45('0x12')]['code']===0x1f4){logger[_0xea45('0x12')](_0xea45('0xf'),_0x485ede,_0x4be10b[_0xea45('0x12')][_0xea45('0x13')]);return _0x5e2f34(_0x4be10b[_0xea45('0x12')][_0xea45('0x13')]);}logger[_0xea45('0x12')](_0xea45('0xf'),_0x485ede,_0x4be10b[_0xea45('0x12')][_0xea45('0x13')]);return _0x68d300(_0x4be10b[_0xea45('0x12')]['message']);}else{logger[_0xea45('0xe')](_0xea45('0xf'),_0x485ede,_0xea45('0x10'));_0x68d300(_0x4be10b[_0xea45('0x14')]['message']);}})['catch'](function(_0x3ac586){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x485ede,_0x3ac586);_0x5e2f34(_0x3ac586);});});}exports[_0xea45('0x15')]=function(_0x8853a8){var _0x51d2e2=this;return new Promise(function(_0x242b8a,_0x4176d1){return db[_0xea45('0x16')][_0xea45('0x17')]({'raw':_0x8853a8[_0xea45('0x18')]?_0x8853a8[_0xea45('0x18')][_0xea45('0x19')]===undefined?!![]:![]:!![],'where':_0x8853a8[_0xea45('0x18')]?_0x8853a8[_0xea45('0x18')][_0xea45('0x1a')]||null:null,'attributes':_0x8853a8[_0xea45('0x18')]?_0x8853a8['options'][_0xea45('0x1b')]||null:null,'include':_0x8853a8[_0xea45('0x18')]?_0x8853a8[_0xea45('0x18')]['include']?_[_0xea45('0x1c')](_0x8853a8[_0xea45('0x18')]['include'],function(_0x594c3c){return{'model':db[_0x594c3c[_0xea45('0x1d')]],'as':_0x594c3c['as'],'attributes':_0x594c3c[_0xea45('0x1b')],'include':_0x594c3c[_0xea45('0x1e')]?_[_0xea45('0x1c')](_0x594c3c[_0xea45('0x1e')],function(_0x4c83fc){return{'model':db[_0x4c83fc['model']],'as':_0x4c83fc['as'],'attributes':_0x4c83fc[_0xea45('0x1b')],'include':_0x4c83fc['include']?_['map'](_0x4c83fc[_0xea45('0x1e')],function(_0x5e424e){return{'model':db[_0x5e424e[_0xea45('0x1d')]],'as':_0x5e424e['as'],'attributes':_0x5e424e[_0xea45('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xea45('0xd')](function(_0x228117){logger[_0xea45('0xe')](_0xea45('0x15'),_0x8853a8);logger[_0xea45('0x1f')](_0xea45('0x15'),_0x8853a8,JSON[_0xea45('0x11')](_0x228117));_0x242b8a(_0x228117);})['catch'](function(_0x3e0f73){logger['error'](_0xea45('0x15'),_0x3e0f73[_0xea45('0x13')],_0x8853a8);_0x4176d1(_0x51d2e2[_0xea45('0x12')](0x1f4,_0x3e0f73[_0xea45('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5cdf0cb..8931454 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 _0x0c07=['get','index','isAuthenticated','show','/:id/users','getUsers','post','addUsers','update','delete','/:id','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x5ed15b,_0x370bb8){var _0x3f2826=function(_0x3c7da1){while(--_0x3c7da1){_0x5ed15b['push'](_0x5ed15b['shift']());}};_0x3f2826(++_0x370bb8);}(_0x0c07,0x8b));var _0x70c0=function(_0x310215,_0x541b20){_0x310215=_0x310215-0x0;var _0x1e9d59=_0x0c07[_0x310215];return _0x1e9d59;};'use strict';var multer=require(_0x70c0('0x0'));var util=require(_0x70c0('0x1'));var path=require(_0x70c0('0x2'));var timeout=require(_0x70c0('0x3'));var express=require(_0x70c0('0x4'));var router=express[_0x70c0('0x5')]();var fs_extra=require(_0x70c0('0x6'));var auth=require(_0x70c0('0x7'));var interaction=require(_0x70c0('0x8'));var config=require(_0x70c0('0x9'));var controller=require(_0x70c0('0xa'));router[_0x70c0('0xb')]('/',auth['isAuthenticated'](),controller[_0x70c0('0xc')]);router['get']('/:id',auth[_0x70c0('0xd')](),controller[_0x70c0('0xe')]);router[_0x70c0('0xb')](_0x70c0('0xf'),auth['isAuthenticated'](),controller[_0x70c0('0x10')]);router['post']('/',auth[_0x70c0('0xd')](),controller['create']);router[_0x70c0('0x11')]('/:id/users',auth[_0x70c0('0xd')](),controller[_0x70c0('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x70c0('0x13')]);router[_0x70c0('0x14')](_0x70c0('0x15'),auth['isAuthenticated'](),controller[_0x70c0('0x16')]);router['delete'](_0x70c0('0xf'),auth[_0x70c0('0xd')](),controller[_0x70c0('0x17')]);module[_0x70c0('0x18')]=router; \ No newline at end of file +var _0x6a19=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','/:id/users','getUsers','post','put'];(function(_0x49cf7f,_0x5810f6){var _0x354796=function(_0x423d8f){while(--_0x423d8f){_0x49cf7f['push'](_0x49cf7f['shift']());}};_0x354796(++_0x5810f6);}(_0x6a19,0x144));var _0x96a1=function(_0x3c98c1,_0x524e3c){_0x3c98c1=_0x3c98c1-0x0;var _0x45c21b=_0x6a19[_0x3c98c1];return _0x45c21b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96a1('0x0'));var timeout=require(_0x96a1('0x1'));var express=require(_0x96a1('0x2'));var router=express[_0x96a1('0x3')]();var fs_extra=require(_0x96a1('0x4'));var auth=require(_0x96a1('0x5'));var interaction=require(_0x96a1('0x6'));var config=require(_0x96a1('0x7'));var controller=require(_0x96a1('0x8'));router[_0x96a1('0x9')]('/',auth[_0x96a1('0xa')](),controller['index']);router['get'](_0x96a1('0xb'),auth[_0x96a1('0xa')](),controller['show']);router[_0x96a1('0x9')](_0x96a1('0xc'),auth[_0x96a1('0xa')](),controller[_0x96a1('0xd')]);router['post']('/',auth[_0x96a1('0xa')](),controller['create']);router[_0x96a1('0xe')]('/:id/users',auth[_0x96a1('0xa')](),controller['addUsers']);router[_0x96a1('0xf')](_0x96a1('0xb'),auth['isAuthenticated'](),controller[_0x96a1('0x10')]);router[_0x96a1('0x11')](_0x96a1('0xb'),auth[_0x96a1('0xa')](),controller[_0x96a1('0x12')]);router[_0x96a1('0x11')](_0x96a1('0xc'),auth[_0x96a1('0xa')](),controller['removeUsers']);module[_0x96a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index eec1081..8817aee 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 _0x5edb=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','TEXT','BLOB'];(function(_0x3ad421,_0x320546){var _0x39fb9d=function(_0x40e8a5){while(--_0x40e8a5){_0x3ad421['push'](_0x3ad421['shift']());}};_0x39fb9d(++_0x320546);}(_0x5edb,0x187));var _0xb5ed=function(_0x43870,_0x5aa1e7){_0x43870=_0x43870-0x0;var _0x375191=_0x5edb[_0x43870];return _0x375191;};'use strict';var Sequelize=require(_0xb5ed('0x0'));module[_0xb5ed('0x1')]={'name':{'type':Sequelize[_0xb5ed('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb5ed('0x2')]},'notes':{'type':Sequelize[_0xb5ed('0x3')]},'preproduction':{'type':Sequelize[_0xb5ed('0x4')](_0xb5ed('0x5')),'get':function(){if(this[_0xb5ed('0x6')]('preproduction')){return this[_0xb5ed('0x6')](_0xb5ed('0x7'))[_0xb5ed('0x8')](_0xb5ed('0x9'));}}},'production':{'type':Sequelize[_0xb5ed('0x4')](_0xb5ed('0x5')),'get':function(){if(this[_0xb5ed('0x6')](_0xb5ed('0xa'))){return this[_0xb5ed('0x6')](_0xb5ed('0xa'))[_0xb5ed('0x8')](_0xb5ed('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xb5ed('0xb')]}}; \ No newline at end of file +var _0xb7f0=['BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports','STRING','name'];(function(_0x585450,_0x2ab5f0){var _0x133a89=function(_0x253829){while(--_0x253829){_0x585450['push'](_0x585450['shift']());}};_0x133a89(++_0x2ab5f0);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x1ee477,_0xe2f0a2){_0x1ee477=_0x1ee477-0x0;var _0x33ce18=_0xb7f0[_0x1ee477];return _0x33ce18;};'use strict';var Sequelize=require(_0x0b7f('0x0'));module[_0x0b7f('0x1')]={'name':{'type':Sequelize[_0x0b7f('0x2')],'unique':_0x0b7f('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0b7f('0x4')](_0x0b7f('0x5')),'get':function(){if(this[_0x0b7f('0x6')](_0x0b7f('0x7'))){return this[_0x0b7f('0x6')](_0x0b7f('0x7'))[_0x0b7f('0x8')](_0x0b7f('0x9'));}}},'production':{'type':Sequelize[_0x0b7f('0x4')](_0x0b7f('0x5')),'get':function(){if(this['getDataValue'](_0x0b7f('0xa'))){return this[_0x0b7f('0x6')]('production')[_0x0b7f('0x8')](_0x0b7f('0x9'));}}},'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 3109198..a23be79 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 _0x0365=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','SquareProject','rawAttributes','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','keys','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x29ae90,_0x3e69fa){var _0x1bc532=function(_0x146078){while(--_0x146078){_0x29ae90['push'](_0x29ae90['shift']());}};_0x1bc532(++_0x3e69fa);}(_0x0365,0xb9));var _0x5036=function(_0x566816,_0x73fea5){_0x566816=_0x566816-0x0;var _0x36719c=_0x0365[_0x566816];return _0x36719c;};'use strict';var emlformat=require(_0x5036('0x0'));var rimraf=require(_0x5036('0x1'));var zipdir=require(_0x5036('0x2'));var jsonpatch=require(_0x5036('0x3'));var rp=require(_0x5036('0x4'));var moment=require(_0x5036('0x5'));var BPromise=require(_0x5036('0x6'));var Mustache=require(_0x5036('0x7'));var util=require(_0x5036('0x8'));var path=require('path');var sox=require(_0x5036('0x9'));var csv=require(_0x5036('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5036('0xb'));var _=require(_0x5036('0xc'));var squel=require(_0x5036('0xd'));var crypto=require(_0x5036('0xe'));var jsforce=require(_0x5036('0xf'));var deskjs=require(_0x5036('0x10'));var toCsv=require(_0x5036('0xa'));var querystring=require(_0x5036('0x11'));var Papa=require(_0x5036('0x12'));var Redis=require(_0x5036('0x13'));var authService=require(_0x5036('0x14'));var qs=require(_0x5036('0x15'));var as=require(_0x5036('0x16'));var hardwareService=require(_0x5036('0x17'));var logger=require(_0x5036('0x18'))(_0x5036('0x19'));var utils=require(_0x5036('0x1a'));var config=require(_0x5036('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5036('0x1c'))['db'];config[_0x5036('0x1d')]=_[_0x5036('0x1e')](config[_0x5036('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x5036('0x1f'))(new Redis(config[_0x5036('0x1d')]));require(_0x5036('0x20'))[_0x5036('0x21')](socket);function respondWithStatusCode(_0x22ff75,_0x28e470){_0x28e470=_0x28e470||0xcc;return function(_0x414947){if(_0x414947){return _0x22ff75[_0x5036('0x22')](_0x28e470);}return _0x22ff75['status'](_0x28e470)[_0x5036('0x23')]();};}function respondWithResult(_0x47325e,_0x5698da){_0x5698da=_0x5698da||0xc8;return function(_0x2311d8){if(_0x2311d8){return _0x47325e[_0x5036('0x24')](_0x5698da)['json'](_0x2311d8);}};}function respondWithFilteredResult(_0x23a8c6,_0x431ea){return function(_0x43c229){if(_0x43c229){var _0x14b338=typeof _0x431ea[_0x5036('0x25')]===_0x5036('0x26')&&typeof _0x431ea['limit']===_0x5036('0x26');var _0x2dba85=_0x43c229['count'];var _0x14c8b8=_0x14b338?0x0:_0x431ea[_0x5036('0x25')];var _0x5ad041=_0x14b338?_0x43c229[_0x5036('0x27')]:_0x431ea[_0x5036('0x25')]+_0x431ea[_0x5036('0x28')];var _0x160501;if(_0x5ad041>=_0x2dba85){_0x5ad041=_0x2dba85;_0x160501=0xc8;}else{_0x160501=0xce;}_0x23a8c6[_0x5036('0x24')](_0x160501);return _0x23a8c6[_0x5036('0x29')](_0x5036('0x2a'),_0x14c8b8+'-'+_0x5ad041+'/'+_0x2dba85)[_0x5036('0x2b')](_0x43c229);}return null;};}function patchUpdates(_0x3eec45){return function(_0x40b0db){try{jsonpatch[_0x5036('0x2c')](_0x40b0db,_0x3eec45,!![]);}catch(_0xc458c8){return BPromise[_0x5036('0x2d')](_0xc458c8);}return _0x40b0db[_0x5036('0x2e')]();};}function saveUpdates(_0x526b72,_0x43a5e9){return function(_0x387c47){if(_0x387c47){return _0x387c47['update'](_0x526b72)[_0x5036('0x2f')](function(_0x40ae04){return _0x40ae04;});}return null;};}function removeEntity(_0xd70ddb,_0x4d5e55){return function(_0x466a0f){if(_0x466a0f){return _0x466a0f[_0x5036('0x30')]()[_0x5036('0x2f')](function(){var _0x36416e=_0x466a0f[_0x5036('0x31')]({'plain':!![]});var _0x5a42ea=_0x5036('0x32');return db[_0x5036('0x33')][_0x5036('0x30')]({'where':{'type':_0x5a42ea,'resourceId':_0x36416e['id']}})['then'](function(){return _0x466a0f;});})['then'](function(){_0xd70ddb[_0x5036('0x24')](0xcc)[_0x5036('0x23')]();});}};}function handleEntityNotFound(_0xf083c0,_0xbed48b){return function(_0x47b1a9){if(!_0x47b1a9){_0xf083c0[_0x5036('0x22')](0x194);}return _0x47b1a9;};}function handleError(_0x1b3280,_0x38d9da){_0x38d9da=_0x38d9da||0x1f4;return function(_0x87b6f3){logger[_0x5036('0x34')](_0x87b6f3['stack']);if(_0x87b6f3[_0x5036('0x35')]){delete _0x87b6f3[_0x5036('0x35')];}_0x1b3280[_0x5036('0x24')](_0x38d9da)[_0x5036('0x36')](_0x87b6f3);};}exports['index']=function(_0xd3f407,_0x1579c0){var _0x3382cc={},_0x4a4cd2={},_0x390933={'count':0x0,'rows':[]};var _0x20d0c=_['map'](db[_0x5036('0x37')][_0x5036('0x38')],function(_0x27bcbc){return{'name':_0x27bcbc['fieldName'],'type':_0x27bcbc[_0x5036('0x39')]['key']};});_0x4a4cd2[_0x5036('0x3a')]=_[_0x5036('0x3b')](_0x20d0c,'name');_0x4a4cd2[_0x5036('0x3c')]=_['keys'](_0xd3f407[_0x5036('0x3c')]);_0x4a4cd2[_0x5036('0x3d')]=_['intersection'](_0x4a4cd2[_0x5036('0x3a')],_0x4a4cd2[_0x5036('0x3c')]);_0x3382cc[_0x5036('0x3e')]=_[_0x5036('0x3f')](_0x4a4cd2[_0x5036('0x3a')],qs[_0x5036('0x40')](_0xd3f407[_0x5036('0x3c')][_0x5036('0x40')]));_0x3382cc[_0x5036('0x3e')]=_0x3382cc['attributes'][_0x5036('0x41')]?_0x3382cc[_0x5036('0x3e')]:_0x4a4cd2[_0x5036('0x3a')];if(!_0xd3f407[_0x5036('0x3c')][_0x5036('0x42')](_0x5036('0x43'))){_0x3382cc[_0x5036('0x28')]=qs[_0x5036('0x28')](_0xd3f407['query'][_0x5036('0x28')]);_0x3382cc['offset']=qs[_0x5036('0x25')](_0xd3f407[_0x5036('0x3c')][_0x5036('0x25')]);}_0x3382cc[_0x5036('0x44')]=qs[_0x5036('0x45')](_0xd3f407[_0x5036('0x3c')][_0x5036('0x45')]);_0x3382cc[_0x5036('0x46')]=qs['filters'](_[_0x5036('0x47')](_0xd3f407[_0x5036('0x3c')],_0x4a4cd2['filters']),_0x20d0c);if(_0xd3f407[_0x5036('0x3c')][_0x5036('0x48')]){_0x3382cc[_0x5036('0x46')]=_[_0x5036('0x49')](_0x3382cc['where'],{'$or':_[_0x5036('0x3b')](_0x20d0c,function(_0x38cc6a){if(_0x38cc6a[_0x5036('0x39')]!=='VIRTUAL'){var _0x10a964={};_0x10a964[_0x38cc6a['name']]={'$like':'%'+_0xd3f407['query'][_0x5036('0x48')]+'%'};return _0x10a964;}})});}_0x3382cc=_[_0x5036('0x49')]({},_0x3382cc,_0xd3f407['options']);var _0x23c245={'where':_0x3382cc[_0x5036('0x46')]};return db[_0x5036('0x37')][_0x5036('0x27')](_0x23c245)[_0x5036('0x2f')](function(_0x12a365){_0x390933[_0x5036('0x27')]=_0x12a365;if(_0xd3f407[_0x5036('0x3c')][_0x5036('0x4a')]){_0x3382cc[_0x5036('0x4b')]=[{'all':!![]}];}return db[_0x5036('0x37')][_0x5036('0x4c')](_0x3382cc);})[_0x5036('0x2f')](function(_0x570d37){_0x390933['rows']=_0x570d37;return _0x390933;})[_0x5036('0x2f')](respondWithFilteredResult(_0x1579c0,_0x3382cc))[_0x5036('0x4d')](handleError(_0x1579c0,null));};exports['show']=function(_0x5ddbc4,_0x33910c){var _0x4ca790={'raw':![],'where':{'id':_0x5ddbc4[_0x5036('0x4e')]['id']}},_0x49c221={};_0x49c221['model']=_[_0x5036('0x4f')](db[_0x5036('0x37')][_0x5036('0x38')]);_0x49c221[_0x5036('0x3c')]=_[_0x5036('0x4f')](_0x5ddbc4[_0x5036('0x3c')]);_0x49c221[_0x5036('0x3d')]=_[_0x5036('0x3f')](_0x49c221['model'],_0x49c221[_0x5036('0x3c')]);_0x4ca790['attributes']=_[_0x5036('0x3f')](_0x49c221[_0x5036('0x3a')],qs['fields'](_0x5ddbc4['query']['fields']));_0x4ca790['attributes']=_0x4ca790[_0x5036('0x3e')][_0x5036('0x41')]?_0x4ca790[_0x5036('0x3e')]:_0x49c221[_0x5036('0x3a')];if(_0x5ddbc4[_0x5036('0x3c')]['includeAll']){_0x4ca790['include']=[{'all':!![]}];}_0x4ca790=_['merge']({},_0x4ca790,_0x5ddbc4[_0x5036('0x50')]);return db['SquareProject'][_0x5036('0x51')](_0x4ca790)[_0x5036('0x2f')](handleEntityNotFound(_0x33910c,null))[_0x5036('0x2f')](respondWithResult(_0x33910c,null))['catch'](handleError(_0x33910c,null));};exports[_0x5036('0x52')]=function(_0x5ee064,_0x47b708){return db[_0x5036('0x37')][_0x5036('0x52')](_0x5ee064[_0x5036('0x53')],{})[_0x5036('0x2f')](function(_0x8cdede){var _0x2885c9=_0x5ee064[_0x5036('0x54')][_0x5036('0x31')]({'plain':!![]});if(!_0x2885c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2885c9[_0x5036('0x55')]===_0x5036('0x54')){var _0x1584ae=_0x8cdede['get']({'plain':!![]});var _0xc0e9a6='SquareProjects';return db[_0x5036('0x56')][_0x5036('0x51')]({'where':{'name':_0xc0e9a6,'userProfileId':_0x2885c9[_0x5036('0x57')]},'raw':!![]})[_0x5036('0x2f')](function(_0x35fd67){if(_0x35fd67&&_0x35fd67[_0x5036('0x58')]===0x0){return db[_0x5036('0x33')][_0x5036('0x52')]({'name':_0x1584ae['name'],'resourceId':_0x1584ae['id'],'type':_0x35fd67['name'],'sectionId':_0x35fd67['id']},{})[_0x5036('0x2f')](function(){return _0x8cdede;});}else{return _0x8cdede;}})[_0x5036('0x4d')](function(_0x866d40){logger['error'](_0x5036('0x59'),_0x866d40);throw _0x866d40;});}return _0x8cdede;})[_0x5036('0x2f')](respondWithResult(_0x47b708,0xc9))['catch'](handleError(_0x47b708,null));};exports[_0x5036('0x5a')]=function(_0x39f235,_0x84cb02){if(_0x39f235[_0x5036('0x53')]['id']){delete _0x39f235['body']['id'];}return db[_0x5036('0x37')]['find']({'where':{'id':_0x39f235['params']['id']}})[_0x5036('0x2f')](handleEntityNotFound(_0x84cb02,null))[_0x5036('0x2f')](saveUpdates(_0x39f235['body'],null))['then'](respondWithResult(_0x84cb02,null))[_0x5036('0x4d')](handleError(_0x84cb02,null));};exports[_0x5036('0x30')]=function(_0x49cbbb,_0x3ebdfe){return db[_0x5036('0x37')]['find']({'where':{'id':_0x49cbbb[_0x5036('0x4e')]['id']}})[_0x5036('0x2f')](handleEntityNotFound(_0x3ebdfe,null))['then'](removeEntity(_0x3ebdfe,null))[_0x5036('0x4d')](handleError(_0x3ebdfe,null));};exports[_0x5036('0x5b')]=function(_0x50531e,_0x3cbc3c,_0x50f096){return db[_0x5036('0x37')][_0x5036('0x51')]({'where':{'id':_0x50531e[_0x5036('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3cbc3c,null))[_0x5036('0x2f')](function(_0x4141d8){if(_0x4141d8){return _0x4141d8['addUsers'](_0x50531e['body'][_0x5036('0x5c')],_[_0x5036('0x5d')](_0x50531e[_0x5036('0x53')],[_0x5036('0x5c'),'id'])||{});}})[_0x5036('0x2f')](respondWithResult(_0x3cbc3c,null))[_0x5036('0x4d')](handleError(_0x3cbc3c,null));};exports[_0x5036('0x5e')]=function(_0x1b22cb,_0x5315df,_0x376e53){return db[_0x5036('0x37')][_0x5036('0x51')]({'where':{'id':_0x1b22cb[_0x5036('0x4e')]['id']}})[_0x5036('0x2f')](handleEntityNotFound(_0x5315df,null))['then'](function(_0x10be28){if(_0x10be28){return _0x10be28[_0x5036('0x5e')](_0x1b22cb[_0x5036('0x3c')]['ids'])[_0x5036('0x2f')](function(){if(_[_0x5036('0x5f')](_0x1b22cb[_0x5036('0x3c')]['ids'])){for(var _0x2e42df=0x0;_0x2e42df<_0x1b22cb[_0x5036('0x3c')][_0x5036('0x5c')]['length'];_0x2e42df+=0x1){socket[_0x5036('0x60')](_0x5036('0x61'),{'UserId':Number(_0x1b22cb[_0x5036('0x3c')][_0x5036('0x5c')][_0x2e42df]),'SquareProjectId':Number(_0x1b22cb['params']['id'])});}}else{socket[_0x5036('0x60')](_0x5036('0x61'),{'UserId':Number(_0x1b22cb[_0x5036('0x3c')][_0x5036('0x5c')]),'SquareProjectId':Number(_0x1b22cb['params']['id'])});}});}})[_0x5036('0x2f')](respondWithStatusCode(_0x5315df,null))['catch'](handleError(_0x5315df,null));};exports[_0x5036('0x62')]=function(_0x4c7edd,_0x2e4b6c,_0x3cee8f){var _0xa2b13b={};var _0x252b66={};var _0x1c52af;var _0xb5a1f8;return db[_0x5036('0x37')][_0x5036('0x63')]({'where':{'id':_0x4c7edd[_0x5036('0x4e')]['id']}})[_0x5036('0x2f')](handleEntityNotFound(_0x2e4b6c,null))[_0x5036('0x2f')](function(_0x2bea67){if(_0x2bea67){_0x1c52af=_0x2bea67;_0x252b66[_0x5036('0x3a')]=_[_0x5036('0x4f')](db[_0x5036('0x64')][_0x5036('0x38')]);_0x252b66[_0x5036('0x3c')]=_[_0x5036('0x4f')](_0x4c7edd[_0x5036('0x3c')]);_0x252b66[_0x5036('0x3d')]=_[_0x5036('0x3f')](_0x252b66[_0x5036('0x3a')],_0x252b66['query']);_0xa2b13b[_0x5036('0x3e')]=_[_0x5036('0x3f')](_0x252b66[_0x5036('0x3a')],qs[_0x5036('0x40')](_0x4c7edd[_0x5036('0x3c')][_0x5036('0x40')]));_0xa2b13b[_0x5036('0x3e')]=_0xa2b13b[_0x5036('0x3e')][_0x5036('0x41')]?_0xa2b13b[_0x5036('0x3e')]:_0x252b66['model'];_0xa2b13b[_0x5036('0x44')]=qs[_0x5036('0x45')](_0x4c7edd[_0x5036('0x3c')]['sort']);_0xa2b13b[_0x5036('0x46')]=qs[_0x5036('0x3d')](_['pick'](_0x4c7edd[_0x5036('0x3c')],_0x252b66['filters']));if(_0x4c7edd['query'][_0x5036('0x48')]){_0xa2b13b[_0x5036('0x46')]=_[_0x5036('0x49')](_0xa2b13b[_0x5036('0x46')],{'$or':_['map'](_0xa2b13b['attributes'],function(_0x11156b){var _0x5be7be={};_0x5be7be[_0x11156b]={'$like':'%'+_0x4c7edd['query'][_0x5036('0x48')]+'%'};return _0x5be7be;})});}_0xa2b13b=_[_0x5036('0x49')]({},_0xa2b13b,_0x4c7edd[_0x5036('0x50')]);return _0x1c52af[_0x5036('0x62')](_0xa2b13b);}})[_0x5036('0x2f')](function(_0x16ed64){if(_0x16ed64){_0xb5a1f8=_0x16ed64['length'];if(!_0x4c7edd[_0x5036('0x3c')][_0x5036('0x42')](_0x5036('0x43'))){_0xa2b13b[_0x5036('0x28')]=qs[_0x5036('0x28')](_0x4c7edd['query']['limit']);_0xa2b13b[_0x5036('0x25')]=qs[_0x5036('0x25')](_0x4c7edd[_0x5036('0x3c')][_0x5036('0x25')]);}return _0x1c52af['getUsers'](_0xa2b13b);}})[_0x5036('0x2f')](function(_0xc6613c){if(_0xc6613c){return _0xc6613c?{'count':_0xb5a1f8,'rows':_0xc6613c}:null;}})[_0x5036('0x2f')](respondWithResult(_0x2e4b6c,null))[_0x5036('0x4d')](handleError(_0x2e4b6c,null));}; \ No newline at end of file +var _0x1b12=['json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','where','VIRTUAL','filter','SquareProject','includeAll','include','rows','catch','show','params','merge','options','find','create','body','SquareProjects','userProfileId','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','count','set'];(function(_0x967cd3,_0x43a7c7){var _0x4c25d3=function(_0x2d23dc){while(--_0x2d23dc){_0x967cd3['push'](_0x967cd3['shift']());}};_0x4c25d3(++_0x43a7c7);}(_0x1b12,0x1bf));var _0x21b1=function(_0x1196ca,_0x317c90){_0x1196ca=_0x1196ca-0x0;var _0x1e972f=_0x1b12[_0x1196ca];return _0x1e972f;};'use strict';var emlformat=require(_0x21b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21b1('0x1'));var jsonpatch=require(_0x21b1('0x2'));var rp=require(_0x21b1('0x3'));var moment=require(_0x21b1('0x4'));var BPromise=require(_0x21b1('0x5'));var Mustache=require(_0x21b1('0x6'));var util=require(_0x21b1('0x7'));var path=require(_0x21b1('0x8'));var sox=require(_0x21b1('0x9'));var csv=require('to-csv');var ejs=require(_0x21b1('0xa'));var fs=require('fs');var fs_extra=require(_0x21b1('0xb'));var _=require(_0x21b1('0xc'));var squel=require(_0x21b1('0xd'));var crypto=require(_0x21b1('0xe'));var jsforce=require(_0x21b1('0xf'));var deskjs=require(_0x21b1('0x10'));var toCsv=require(_0x21b1('0x11'));var querystring=require('querystring');var Papa=require(_0x21b1('0x12'));var Redis=require('ioredis');var authService=require(_0x21b1('0x13'));var qs=require(_0x21b1('0x14'));var as=require(_0x21b1('0x15'));var hardwareService=require(_0x21b1('0x16'));var logger=require(_0x21b1('0x17'))(_0x21b1('0x18'));var utils=require(_0x21b1('0x19'));var config=require(_0x21b1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x21b1('0x1b')]=_['defaults'](config[_0x21b1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x21b1('0x1c'))(new Redis(config[_0x21b1('0x1b')]));require(_0x21b1('0x1d'))[_0x21b1('0x1e')](socket);function respondWithStatusCode(_0x276950,_0x405afd){_0x405afd=_0x405afd||0xcc;return function(_0x1cb943){if(_0x1cb943){return _0x276950[_0x21b1('0x1f')](_0x405afd);}return _0x276950[_0x21b1('0x20')](_0x405afd)[_0x21b1('0x21')]();};}function respondWithResult(_0x35d956,_0x5a949e){_0x5a949e=_0x5a949e||0xc8;return function(_0x2213c6){if(_0x2213c6){return _0x35d956[_0x21b1('0x20')](_0x5a949e)['json'](_0x2213c6);}};}function respondWithFilteredResult(_0x520fb1,_0x2a0517){return function(_0x111e51){if(_0x111e51){var _0x21f5be=typeof _0x2a0517[_0x21b1('0x22')]===_0x21b1('0x23')&&typeof _0x2a0517['limit']==='undefined';var _0x23055d=_0x111e51[_0x21b1('0x24')];var _0x10da76=_0x21f5be?0x0:_0x2a0517['offset'];var _0x3f4beb=_0x21f5be?_0x111e51['count']:_0x2a0517[_0x21b1('0x22')]+_0x2a0517['limit'];var _0x14ca99;if(_0x3f4beb>=_0x23055d){_0x3f4beb=_0x23055d;_0x14ca99=0xc8;}else{_0x14ca99=0xce;}_0x520fb1[_0x21b1('0x20')](_0x14ca99);return _0x520fb1[_0x21b1('0x25')]('Content-Range',_0x10da76+'-'+_0x3f4beb+'/'+_0x23055d)[_0x21b1('0x26')](_0x111e51);}return null;};}function patchUpdates(_0x179afe){return function(_0x5938c0){try{jsonpatch[_0x21b1('0x27')](_0x5938c0,_0x179afe,!![]);}catch(_0x18452c){return BPromise[_0x21b1('0x28')](_0x18452c);}return _0x5938c0[_0x21b1('0x29')]();};}function saveUpdates(_0x330213,_0x578a77){return function(_0x12db8f){if(_0x12db8f){return _0x12db8f[_0x21b1('0x2a')](_0x330213)['then'](function(_0x28e4d5){return _0x28e4d5;});}return null;};}function removeEntity(_0x10aa4,_0x33d1fa){return function(_0x427749){if(_0x427749){return _0x427749[_0x21b1('0x2b')]()[_0x21b1('0x2c')](function(){var _0x34b776=_0x427749[_0x21b1('0x2d')]({'plain':!![]});var _0x557cb0='SquareProjects';return db[_0x21b1('0x2e')][_0x21b1('0x2b')]({'where':{'type':_0x557cb0,'resourceId':_0x34b776['id']}})['then'](function(){return _0x427749;});})[_0x21b1('0x2c')](function(){_0x10aa4[_0x21b1('0x20')](0xcc)[_0x21b1('0x21')]();});}};}function handleEntityNotFound(_0xf11bcf,_0x182316){return function(_0x2ef753){if(!_0x2ef753){_0xf11bcf[_0x21b1('0x1f')](0x194);}return _0x2ef753;};}function handleError(_0x14dcea,_0x4f760a){_0x4f760a=_0x4f760a||0x1f4;return function(_0x321e33){logger[_0x21b1('0x2f')](_0x321e33[_0x21b1('0x30')]);if(_0x321e33[_0x21b1('0x31')]){delete _0x321e33[_0x21b1('0x31')];}_0x14dcea[_0x21b1('0x20')](_0x4f760a)['send'](_0x321e33);};}exports[_0x21b1('0x32')]=function(_0x294654,_0x1c4edc){var _0x1bf0c9={},_0x3de0a3={},_0x4d180d={'count':0x0,'rows':[]};var _0x4c240d=_[_0x21b1('0x33')](db['SquareProject'][_0x21b1('0x34')],function(_0x542c9b){return{'name':_0x542c9b[_0x21b1('0x35')],'type':_0x542c9b[_0x21b1('0x36')][_0x21b1('0x37')]};});_0x3de0a3['model']=_[_0x21b1('0x33')](_0x4c240d,_0x21b1('0x31'));_0x3de0a3[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x294654[_0x21b1('0x38')]);_0x3de0a3['filters']=_['intersection'](_0x3de0a3[_0x21b1('0x3a')],_0x3de0a3[_0x21b1('0x38')]);_0x1bf0c9['attributes']=_[_0x21b1('0x3b')](_0x3de0a3['model'],qs[_0x21b1('0x3c')](_0x294654['query'][_0x21b1('0x3c')]));_0x1bf0c9[_0x21b1('0x3d')]=_0x1bf0c9[_0x21b1('0x3d')][_0x21b1('0x3e')]?_0x1bf0c9[_0x21b1('0x3d')]:_0x3de0a3[_0x21b1('0x3a')];if(!_0x294654['query'][_0x21b1('0x3f')](_0x21b1('0x40'))){_0x1bf0c9['limit']=qs[_0x21b1('0x41')](_0x294654[_0x21b1('0x38')][_0x21b1('0x41')]);_0x1bf0c9['offset']=qs[_0x21b1('0x22')](_0x294654[_0x21b1('0x38')][_0x21b1('0x22')]);}_0x1bf0c9['order']=qs['sort'](_0x294654['query'][_0x21b1('0x42')]);_0x1bf0c9['where']=qs[_0x21b1('0x43')](_[_0x21b1('0x44')](_0x294654[_0x21b1('0x38')],_0x3de0a3[_0x21b1('0x43')]),_0x4c240d);if(_0x294654['query']['filter']){_0x1bf0c9[_0x21b1('0x45')]=_['merge'](_0x1bf0c9[_0x21b1('0x45')],{'$or':_[_0x21b1('0x33')](_0x4c240d,function(_0x52ac97){if(_0x52ac97[_0x21b1('0x36')]!==_0x21b1('0x46')){var _0xad2e48={};_0xad2e48[_0x52ac97[_0x21b1('0x31')]]={'$like':'%'+_0x294654[_0x21b1('0x38')][_0x21b1('0x47')]+'%'};return _0xad2e48;}})});}_0x1bf0c9=_['merge']({},_0x1bf0c9,_0x294654['options']);var _0x2bcb15={'where':_0x1bf0c9['where']};return db[_0x21b1('0x48')][_0x21b1('0x24')](_0x2bcb15)[_0x21b1('0x2c')](function(_0x3b280c){_0x4d180d['count']=_0x3b280c;if(_0x294654[_0x21b1('0x38')][_0x21b1('0x49')]){_0x1bf0c9[_0x21b1('0x4a')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x1bf0c9);})[_0x21b1('0x2c')](function(_0x470026){_0x4d180d[_0x21b1('0x4b')]=_0x470026;return _0x4d180d;})[_0x21b1('0x2c')](respondWithFilteredResult(_0x1c4edc,_0x1bf0c9))[_0x21b1('0x4c')](handleError(_0x1c4edc,null));};exports[_0x21b1('0x4d')]=function(_0x3b45ee,_0x5db613){var _0x11b9b2={'raw':![],'where':{'id':_0x3b45ee[_0x21b1('0x4e')]['id']}},_0x4ac40c={};_0x4ac40c['model']=_['keys'](db['SquareProject'][_0x21b1('0x34')]);_0x4ac40c[_0x21b1('0x38')]=_['keys'](_0x3b45ee[_0x21b1('0x38')]);_0x4ac40c[_0x21b1('0x43')]=_[_0x21b1('0x3b')](_0x4ac40c[_0x21b1('0x3a')],_0x4ac40c[_0x21b1('0x38')]);_0x11b9b2[_0x21b1('0x3d')]=_[_0x21b1('0x3b')](_0x4ac40c[_0x21b1('0x3a')],qs[_0x21b1('0x3c')](_0x3b45ee[_0x21b1('0x38')]['fields']));_0x11b9b2[_0x21b1('0x3d')]=_0x11b9b2[_0x21b1('0x3d')][_0x21b1('0x3e')]?_0x11b9b2[_0x21b1('0x3d')]:_0x4ac40c[_0x21b1('0x3a')];if(_0x3b45ee[_0x21b1('0x38')][_0x21b1('0x49')]){_0x11b9b2[_0x21b1('0x4a')]=[{'all':!![]}];}_0x11b9b2=_[_0x21b1('0x4f')]({},_0x11b9b2,_0x3b45ee[_0x21b1('0x50')]);return db[_0x21b1('0x48')][_0x21b1('0x51')](_0x11b9b2)['then'](handleEntityNotFound(_0x5db613,null))[_0x21b1('0x2c')](respondWithResult(_0x5db613,null))[_0x21b1('0x4c')](handleError(_0x5db613,null));};exports['create']=function(_0x371e48,_0x459851){return db[_0x21b1('0x48')][_0x21b1('0x52')](_0x371e48[_0x21b1('0x53')],{})['then'](function(_0x35566c){var _0x51873e=_0x371e48['user'][_0x21b1('0x2d')]({'plain':!![]});if(!_0x51873e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51873e['role']==='user'){var _0x19e3ad=_0x35566c['get']({'plain':!![]});var _0x5340d5=_0x21b1('0x54');return db['UserProfileSection'][_0x21b1('0x51')]({'where':{'name':_0x5340d5,'userProfileId':_0x51873e[_0x21b1('0x55')]},'raw':!![]})['then'](function(_0x3d991f){if(_0x3d991f&&_0x3d991f[_0x21b1('0x56')]===0x0){return db[_0x21b1('0x2e')][_0x21b1('0x52')]({'name':_0x19e3ad[_0x21b1('0x31')],'resourceId':_0x19e3ad['id'],'type':_0x3d991f[_0x21b1('0x31')],'sectionId':_0x3d991f['id']},{})[_0x21b1('0x2c')](function(){return _0x35566c;});}else{return _0x35566c;}})[_0x21b1('0x4c')](function(_0x1306d6){logger[_0x21b1('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1306d6);throw _0x1306d6;});}return _0x35566c;})[_0x21b1('0x2c')](respondWithResult(_0x459851,0xc9))[_0x21b1('0x4c')](handleError(_0x459851,null));};exports[_0x21b1('0x2a')]=function(_0x128fd3,_0x41e15f){if(_0x128fd3[_0x21b1('0x53')]['id']){delete _0x128fd3[_0x21b1('0x53')]['id'];}return db[_0x21b1('0x48')][_0x21b1('0x51')]({'where':{'id':_0x128fd3[_0x21b1('0x4e')]['id']}})[_0x21b1('0x2c')](handleEntityNotFound(_0x41e15f,null))[_0x21b1('0x2c')](saveUpdates(_0x128fd3['body'],null))[_0x21b1('0x2c')](respondWithResult(_0x41e15f,null))[_0x21b1('0x4c')](handleError(_0x41e15f,null));};exports[_0x21b1('0x2b')]=function(_0x32f03c,_0x137e43){return db[_0x21b1('0x48')][_0x21b1('0x51')]({'where':{'id':_0x32f03c['params']['id']}})[_0x21b1('0x2c')](handleEntityNotFound(_0x137e43,null))[_0x21b1('0x2c')](removeEntity(_0x137e43,null))[_0x21b1('0x4c')](handleError(_0x137e43,null));};exports[_0x21b1('0x57')]=function(_0x222a6d,_0x43e315,_0x11be6f){return db[_0x21b1('0x48')][_0x21b1('0x51')]({'where':{'id':_0x222a6d[_0x21b1('0x4e')]['id']}})[_0x21b1('0x2c')](handleEntityNotFound(_0x43e315,null))['then'](function(_0x2e2d5e){if(_0x2e2d5e){return _0x2e2d5e[_0x21b1('0x57')](_0x222a6d[_0x21b1('0x53')][_0x21b1('0x58')],_[_0x21b1('0x59')](_0x222a6d[_0x21b1('0x53')],['ids','id'])||{});}})[_0x21b1('0x2c')](respondWithResult(_0x43e315,null))[_0x21b1('0x4c')](handleError(_0x43e315,null));};exports[_0x21b1('0x5a')]=function(_0x691d6d,_0x2b9c8a,_0x54afb8){return db[_0x21b1('0x48')][_0x21b1('0x51')]({'where':{'id':_0x691d6d[_0x21b1('0x4e')]['id']}})[_0x21b1('0x2c')](handleEntityNotFound(_0x2b9c8a,null))['then'](function(_0x5dc10c){if(_0x5dc10c){return _0x5dc10c[_0x21b1('0x5a')](_0x691d6d['query']['ids'])['then'](function(){if(_[_0x21b1('0x5b')](_0x691d6d[_0x21b1('0x38')][_0x21b1('0x58')])){for(var _0x42f9ba=0x0;_0x42f9ba<_0x691d6d[_0x21b1('0x38')][_0x21b1('0x58')]['length'];_0x42f9ba+=0x1){socket[_0x21b1('0x5c')](_0x21b1('0x5d'),{'UserId':Number(_0x691d6d[_0x21b1('0x38')][_0x21b1('0x58')][_0x42f9ba]),'SquareProjectId':Number(_0x691d6d[_0x21b1('0x4e')]['id'])});}}else{socket[_0x21b1('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x691d6d[_0x21b1('0x38')]['ids']),'SquareProjectId':Number(_0x691d6d[_0x21b1('0x4e')]['id'])});}});}})[_0x21b1('0x2c')](respondWithStatusCode(_0x2b9c8a,null))[_0x21b1('0x4c')](handleError(_0x2b9c8a,null));};exports[_0x21b1('0x5e')]=function(_0x78d606,_0x202710,_0x1bdad7){var _0x500587={};var _0x295b88={};var _0x79af1a;var _0x4b6bc0;return db[_0x21b1('0x48')][_0x21b1('0x5f')]({'where':{'id':_0x78d606['params']['id']}})['then'](handleEntityNotFound(_0x202710,null))['then'](function(_0x369ccf){if(_0x369ccf){_0x79af1a=_0x369ccf;_0x295b88[_0x21b1('0x3a')]=_['keys'](db['User'][_0x21b1('0x34')]);_0x295b88[_0x21b1('0x38')]=_[_0x21b1('0x39')](_0x78d606[_0x21b1('0x38')]);_0x295b88[_0x21b1('0x43')]=_[_0x21b1('0x3b')](_0x295b88[_0x21b1('0x3a')],_0x295b88[_0x21b1('0x38')]);_0x500587['attributes']=_[_0x21b1('0x3b')](_0x295b88[_0x21b1('0x3a')],qs[_0x21b1('0x3c')](_0x78d606['query'][_0x21b1('0x3c')]));_0x500587[_0x21b1('0x3d')]=_0x500587[_0x21b1('0x3d')][_0x21b1('0x3e')]?_0x500587[_0x21b1('0x3d')]:_0x295b88[_0x21b1('0x3a')];_0x500587[_0x21b1('0x60')]=qs[_0x21b1('0x42')](_0x78d606[_0x21b1('0x38')]['sort']);_0x500587[_0x21b1('0x45')]=qs[_0x21b1('0x43')](_['pick'](_0x78d606['query'],_0x295b88['filters']));if(_0x78d606['query'][_0x21b1('0x47')]){_0x500587[_0x21b1('0x45')]=_['merge'](_0x500587[_0x21b1('0x45')],{'$or':_['map'](_0x500587[_0x21b1('0x3d')],function(_0x311972){var _0x44bcb3={};_0x44bcb3[_0x311972]={'$like':'%'+_0x78d606[_0x21b1('0x38')][_0x21b1('0x47')]+'%'};return _0x44bcb3;})});}_0x500587=_['merge']({},_0x500587,_0x78d606[_0x21b1('0x50')]);return _0x79af1a[_0x21b1('0x5e')](_0x500587);}})[_0x21b1('0x2c')](function(_0x50f6aa){if(_0x50f6aa){_0x4b6bc0=_0x50f6aa[_0x21b1('0x3e')];if(!_0x78d606[_0x21b1('0x38')][_0x21b1('0x3f')]('nolimit')){_0x500587[_0x21b1('0x41')]=qs['limit'](_0x78d606[_0x21b1('0x38')][_0x21b1('0x41')]);_0x500587['offset']=qs[_0x21b1('0x22')](_0x78d606[_0x21b1('0x38')][_0x21b1('0x22')]);}return _0x79af1a[_0x21b1('0x5e')](_0x500587);}})[_0x21b1('0x2c')](function(_0x242e2d){if(_0x242e2d){return _0x242e2d?{'count':_0x4b6bc0,'rows':_0x242e2d}:null;}})[_0x21b1('0x2c')](respondWithResult(_0x202710,null))[_0x21b1('0x4c')](handleError(_0x202710,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0d483d7..f43f5dc 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 _0xc9a4=['hook','exports','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0x562701,_0x197590){var _0x3862f9=function(_0x9588c9){while(--_0x9588c9){_0x562701['push'](_0x562701['shift']());}};_0x3862f9(++_0x197590);}(_0xc9a4,0x197));var _0x4c9a=function(_0x3ddada,_0x4086c5){_0x3ddada=_0x3ddada-0x0;var _0x572a0e=_0xc9a4[_0x3ddada];return _0x572a0e;};'use strict';var EventEmitter=require(_0x4c9a('0x0'));var SquareProject=require(_0x4c9a('0x1'))['db'][_0x4c9a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c9a('0x3'),'afterUpdate':_0x4c9a('0x4'),'afterDestroy':_0x4c9a('0x5')};function emitEvent(_0x593588){return function(_0x5db054,_0x18cabf,_0x2a0124){SquareProjectEvents[_0x4c9a('0x6')](_0x593588+':'+_0x5db054['id'],_0x5db054);SquareProjectEvents[_0x4c9a('0x6')](_0x593588,_0x5db054);_0x2a0124(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4c9a('0x7')](e,emitEvent(event));}}module[_0x4c9a('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x6d1a=['events','../../mysqldb','save','emit','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d1a,0x17a));var _0xa6d1=function(_0x79ba55,_0x2631e2){_0x79ba55=_0x79ba55-0x0;var _0x4b5fcb=_0x6d1a[_0x79ba55];return _0x4b5fcb;};'use strict';var EventEmitter=require(_0xa6d1('0x0'));var SquareProject=require(_0xa6d1('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6d1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ac030){return function(_0x4ba828,_0x3087a2,_0x48adf8){SquareProjectEvents[_0xa6d1('0x3')](_0x1ac030+':'+_0x4ba828['id'],_0x4ba828);SquareProjectEvents[_0xa6d1('0x3')](_0x1ac030,_0x4ba828);_0x48adf8(null);};}for(var e in events){if(events[_0xa6d1('0x4')](e)){var event=events[e];SquareProject[_0xa6d1('0x5')](e,emitEvent(event));}}module[_0xa6d1('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 8df695f..602ee39 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 _0x0596=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x4fc435,_0x45eddf){var _0x3c5db1=function(_0x1d18c1){while(--_0x1d18c1){_0x4fc435['push'](_0x4fc435['shift']());}};_0x3c5db1(++_0x45eddf);}(_0x0596,0x100));var _0x6059=function(_0x4e5502,_0x183eb4){_0x4e5502=_0x4e5502-0x0;var _0xd61cf7=_0x0596[_0x4e5502];return _0xd61cf7;};'use strict';var _=require(_0x6059('0x0'));var util=require(_0x6059('0x1'));var logger=require(_0x6059('0x2'))('api');var moment=require(_0x6059('0x3'));var BPromise=require(_0x6059('0x4'));var rp=require(_0x6059('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6059('0x6'));var config=require(_0x6059('0x7'));var attributes=require(_0x6059('0x8'));module[_0x6059('0x9')]=function(_0x5267d2,_0x507a6c){return _0x5267d2['define'](_0x6059('0xa'),attributes,{'tableName':_0x6059('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d9dc0,_0x201726,_0x4f5834){if(_0x4d9dc0[_0x6059('0xc')](_0x6059('0xd'))){_0x4d9dc0['savedAt']=moment()[_0x6059('0xe')](_0x6059('0xf'));}if(_0x4d9dc0[_0x6059('0xc')](_0x6059('0x10'))){_0x4d9dc0[_0x6059('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4f5834(null,_0x4d9dc0);}}});}; \ No newline at end of file +var _0x98ac=['publishedAt','lodash','util','request-promise','path','rimraf','exports','define','square_projects','changed','preproduction','format','production'];(function(_0x775340,_0x4aeef1){var _0x3a2d3b=function(_0x46c9e4){while(--_0x46c9e4){_0x775340['push'](_0x775340['shift']());}};_0x3a2d3b(++_0x4aeef1);}(_0x98ac,0x16d));var _0xc98a=function(_0x5415e1,_0x3245c7){_0x5415e1=_0x5415e1-0x0;var _0x5ece06=_0x98ac[_0x5415e1];return _0x5ece06;};'use strict';var _=require(_0xc98a('0x0'));var util=require(_0xc98a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc98a('0x2'));var fs=require('fs');var path=require(_0xc98a('0x3'));var rimraf=require(_0xc98a('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc98a('0x5')]=function(_0x460b64,_0x373e46){return _0x460b64[_0xc98a('0x6')]('SquareProject',attributes,{'tableName':_0xc98a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b0c88,_0x1aaf3f,_0x4f5202){if(_0x4b0c88[_0xc98a('0x8')](_0xc98a('0x9'))){_0x4b0c88['savedAt']=moment()[_0xc98a('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4b0c88[_0xc98a('0x8')](_0xc98a('0xb'))){_0x4b0c88[_0xc98a('0xc')]=moment()[_0xc98a('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f5202(null,_0x4b0c88);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c624d2b..0bd1d3e 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 _0x8e58=['request\x20sent','stringify','error','code','result','message','ShowSquareProject','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x2ed632,_0x5cc598){var _0x353cab=function(_0x11869c){while(--_0x11869c){_0x2ed632['push'](_0x2ed632['shift']());}};_0x353cab(++_0x5cc598);}(_0x8e58,0xe8));var _0x88e5=function(_0x5c859d,_0x4164cf){_0x5c859d=_0x5c859d-0x0;var _0x4da867=_0x8e58[_0x5c859d];return _0x4da867;};'use strict';var _=require(_0x88e5('0x0'));var util=require(_0x88e5('0x1'));var moment=require(_0x88e5('0x2'));var BPromise=require(_0x88e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x88e5('0x5'))(_0x88e5('0x6'));var config=require(_0x88e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x88e5('0x8')]['http']({'port':0x232a});config[_0x88e5('0x9')]=_[_0x88e5('0xa')](config[_0x88e5('0x9')],{'host':_0x88e5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88e5('0x9')]));require(_0x88e5('0xc'))[_0x88e5('0xd')](socket);function respondWithRpcPromise(_0x49fb32,_0x425dd3,_0x3d49b5){return new BPromise(function(_0x21623b,_0xb56f06){return client[_0x88e5('0xe')](_0x49fb32,_0x3d49b5)[_0x88e5('0xf')](function(_0x47d79f){logger[_0x88e5('0x10')](_0x88e5('0x11'),_0x425dd3,'request\x20sent');logger[_0x88e5('0x12')](_0x88e5('0x13'),_0x425dd3,_0x88e5('0x14'),JSON[_0x88e5('0x15')](_0x47d79f));if(_0x47d79f[_0x88e5('0x16')]){if(_0x47d79f['error'][_0x88e5('0x17')]===0x1f4){logger['error'](_0x88e5('0x11'),_0x425dd3,_0x47d79f[_0x88e5('0x16')]['message']);return _0xb56f06(_0x47d79f[_0x88e5('0x16')]['message']);}logger[_0x88e5('0x16')](_0x88e5('0x11'),_0x425dd3,_0x47d79f[_0x88e5('0x16')]['message']);return _0x21623b(_0x47d79f[_0x88e5('0x16')]['message']);}else{logger[_0x88e5('0x10')](_0x88e5('0x11'),_0x425dd3,_0x88e5('0x14'));_0x21623b(_0x47d79f[_0x88e5('0x18')][_0x88e5('0x19')]);}})['catch'](function(_0x16a1be){logger['error']('SquareProject,\x20%s,\x20%s',_0x425dd3,_0x16a1be);_0xb56f06(_0x16a1be);});});}exports[_0x88e5('0x1a')]=function(_0x2a1e71){var _0x30ea68=this;return new Promise(function(_0x255536,_0x5e2d14){return db['SquareProject'][_0x88e5('0x1b')]({'raw':_0x2a1e71[_0x88e5('0x1c')]?_0x2a1e71['options'][_0x88e5('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a1e71[_0x88e5('0x1c')]?_0x2a1e71[_0x88e5('0x1c')][_0x88e5('0x1e')]||null:null,'attributes':_0x2a1e71[_0x88e5('0x1c')]?_0x2a1e71[_0x88e5('0x1c')]['attributes']||null:null,'include':_0x2a1e71[_0x88e5('0x1c')]?_0x2a1e71['options'][_0x88e5('0x1f')]?_[_0x88e5('0x20')](_0x2a1e71[_0x88e5('0x1c')]['include'],function(_0x17658f){return{'model':db[_0x17658f[_0x88e5('0x21')]],'as':_0x17658f['as'],'attributes':_0x17658f[_0x88e5('0x22')],'include':_0x17658f[_0x88e5('0x1f')]?_['map'](_0x17658f[_0x88e5('0x1f')],function(_0x55e9ee){return{'model':db[_0x55e9ee['model']],'as':_0x55e9ee['as'],'attributes':_0x55e9ee[_0x88e5('0x22')],'include':_0x55e9ee[_0x88e5('0x1f')]?_[_0x88e5('0x20')](_0x55e9ee[_0x88e5('0x1f')],function(_0x55a4d0){return{'model':db[_0x55a4d0[_0x88e5('0x21')]],'as':_0x55a4d0['as'],'attributes':_0x55a4d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x88e5('0xf')](function(_0x80db6b){logger[_0x88e5('0x10')]('ShowSquareProject',_0x2a1e71);logger[_0x88e5('0x12')](_0x88e5('0x1a'),_0x2a1e71,JSON[_0x88e5('0x15')](_0x80db6b));_0x255536(_0x80db6b);})[_0x88e5('0x23')](function(_0x51243d){logger[_0x88e5('0x16')](_0x88e5('0x1a'),_0x51243d[_0x88e5('0x19')],_0x2a1e71);_0x5e2d14(_0x30ea68[_0x88e5('0x16')](0x1f4,_0x51243d[_0x88e5('0x19')]));});});}; \ No newline at end of file +var _0xc7d3=['./squareProject.socket','register','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareProject','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis'];(function(_0x3fa9ee,_0x296238){var _0x511fd1=function(_0x20d5cf){while(--_0x20d5cf){_0x3fa9ee['push'](_0x3fa9ee['shift']());}};_0x511fd1(++_0x296238);}(_0xc7d3,0x17f));var _0x3c7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7d3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c7d('0x0'));var util=require(_0x3c7d('0x1'));var moment=require(_0x3c7d('0x2'));var BPromise=require(_0x3c7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c7d('0x5'));var config=require(_0x3c7d('0x6'));var jayson=require(_0x3c7d('0x7'));var client=jayson[_0x3c7d('0x8')][_0x3c7d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3c7d('0xa'),'port':0x18eb});var socket=require(_0x3c7d('0xb'))(new Redis(config[_0x3c7d('0xc')]));require(_0x3c7d('0xd'))[_0x3c7d('0xe')](socket);function respondWithRpcPromise(_0x2561cd,_0x5999ba,_0x4044c1){return new BPromise(function(_0x221bb4,_0x2a67d7){return client['request'](_0x2561cd,_0x4044c1)[_0x3c7d('0xf')](function(_0x23ee2a){logger['info'](_0x3c7d('0x10'),_0x5999ba,_0x3c7d('0x11'));logger[_0x3c7d('0x12')](_0x3c7d('0x13'),_0x5999ba,_0x3c7d('0x11'),JSON[_0x3c7d('0x14')](_0x23ee2a));if(_0x23ee2a[_0x3c7d('0x15')]){if(_0x23ee2a[_0x3c7d('0x15')][_0x3c7d('0x16')]===0x1f4){logger[_0x3c7d('0x15')](_0x3c7d('0x10'),_0x5999ba,_0x23ee2a[_0x3c7d('0x15')][_0x3c7d('0x17')]);return _0x2a67d7(_0x23ee2a[_0x3c7d('0x15')]['message']);}logger[_0x3c7d('0x15')](_0x3c7d('0x10'),_0x5999ba,_0x23ee2a[_0x3c7d('0x15')][_0x3c7d('0x17')]);return _0x221bb4(_0x23ee2a[_0x3c7d('0x15')]['message']);}else{logger[_0x3c7d('0x18')]('SquareProject,\x20%s,\x20%s',_0x5999ba,_0x3c7d('0x11'));_0x221bb4(_0x23ee2a[_0x3c7d('0x19')][_0x3c7d('0x17')]);}})[_0x3c7d('0x1a')](function(_0x15ac84){logger[_0x3c7d('0x15')](_0x3c7d('0x10'),_0x5999ba,_0x15ac84);_0x2a67d7(_0x15ac84);});});}exports[_0x3c7d('0x1b')]=function(_0x1216c5){var _0x46d01e=this;return new Promise(function(_0x2c96bf,_0x37cbea){return db['SquareProject'][_0x3c7d('0x1c')]({'raw':_0x1216c5[_0x3c7d('0x1d')]?_0x1216c5[_0x3c7d('0x1d')][_0x3c7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1216c5[_0x3c7d('0x1d')]?_0x1216c5[_0x3c7d('0x1d')][_0x3c7d('0x1f')]||null:null,'attributes':_0x1216c5[_0x3c7d('0x1d')]?_0x1216c5[_0x3c7d('0x1d')]['attributes']||null:null,'include':_0x1216c5[_0x3c7d('0x1d')]?_0x1216c5[_0x3c7d('0x1d')][_0x3c7d('0x20')]?_[_0x3c7d('0x21')](_0x1216c5[_0x3c7d('0x1d')][_0x3c7d('0x20')],function(_0xbb7e4f){return{'model':db[_0xbb7e4f[_0x3c7d('0x22')]],'as':_0xbb7e4f['as'],'attributes':_0xbb7e4f['attributes'],'include':_0xbb7e4f[_0x3c7d('0x20')]?_['map'](_0xbb7e4f[_0x3c7d('0x20')],function(_0xd52793){return{'model':db[_0xd52793[_0x3c7d('0x22')]],'as':_0xd52793['as'],'attributes':_0xd52793[_0x3c7d('0x23')],'include':_0xd52793['include']?_[_0x3c7d('0x21')](_0xd52793[_0x3c7d('0x20')],function(_0x2729e7){return{'model':db[_0x2729e7[_0x3c7d('0x22')]],'as':_0x2729e7['as'],'attributes':_0x2729e7[_0x3c7d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3c7d('0xf')](function(_0x3537d9){logger['info'](_0x3c7d('0x1b'),_0x1216c5);logger[_0x3c7d('0x12')](_0x3c7d('0x1b'),_0x1216c5,JSON[_0x3c7d('0x14')](_0x3537d9));_0x2c96bf(_0x3537d9);})['catch'](function(_0x32157c){logger[_0x3c7d('0x15')](_0x3c7d('0x1b'),_0x32157c[_0x3c7d('0x17')],_0x1216c5);_0x37cbea(_0x46d01e['error'](0x1f4,_0x32157c[_0x3c7d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f715808..34298d0 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 _0xce1a=['remove','update','emit','register','length','./squareProject.events','save'];(function(_0x3fc5fb,_0x4d9572){var _0x5cc678=function(_0x31785b){while(--_0x31785b){_0x3fc5fb['push'](_0x3fc5fb['shift']());}};_0x5cc678(++_0x4d9572);}(_0xce1a,0x1cc));var _0xace1=function(_0x3171f1,_0x28c520){_0x3171f1=_0x3171f1-0x0;var _0x244bc2=_0xce1a[_0x3171f1];return _0x244bc2;};'use strict';var SquareProjectEvents=require(_0xace1('0x0'));var events=[_0xace1('0x1'),_0xace1('0x2'),_0xace1('0x3')];function createListener(_0x1d5420,_0x4e4728){return function(_0x59a510){_0x4e4728[_0xace1('0x4')](_0x1d5420,_0x59a510);};}function removeListener(_0x2428df,_0x3a4e6c){return function(){SquareProjectEvents['removeListener'](_0x2428df,_0x3a4e6c);};}exports[_0xace1('0x5')]=function(_0x337025){for(var _0xa24db=0x0,_0x3c12a9=events[_0xace1('0x6')];_0xa24db<_0x3c12a9;_0xa24db++){var _0x3cbf2d=events[_0xa24db];var _0x40cee2=createListener('squareProject:'+_0x3cbf2d,_0x337025);SquareProjectEvents['on'](_0x3cbf2d,_0x40cee2);}}; \ No newline at end of file +var _0xa0a3=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x46eb0e,_0x296d16){var _0x523297=function(_0x1e0dbb){while(--_0x1e0dbb){_0x46eb0e['push'](_0x46eb0e['shift']());}};_0x523297(++_0x296d16);}(_0xa0a3,0x151));var _0x3a0a=function(_0x48f58f,_0x3a9b8c){_0x48f58f=_0x48f58f-0x0;var _0x307523=_0xa0a3[_0x48f58f];return _0x307523;};'use strict';var SquareProjectEvents=require(_0x3a0a('0x0'));var events=[_0x3a0a('0x1'),_0x3a0a('0x2'),_0x3a0a('0x3')];function createListener(_0x26c395,_0x1455a6){return function(_0x313e22){_0x1455a6[_0x3a0a('0x4')](_0x26c395,_0x313e22);};}function removeListener(_0x1d69b1,_0x3a408a){return function(){SquareProjectEvents[_0x3a0a('0x5')](_0x1d69b1,_0x3a408a);};}exports[_0x3a0a('0x6')]=function(_0x29d04c){for(var _0x1e81b4=0x0,_0x2c5c2b=events[_0x3a0a('0x7')];_0x1e81b4<_0x2c5c2b;_0x1e81b4++){var _0x3e254f=events[_0x1e81b4];var _0x84ca83=createListener(_0x3a0a('0x8')+_0x3e254f,_0x29d04c);SquareProjectEvents['on'](_0x3e254f,_0x84ca83);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d880453..64d720d 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x280ead,_0x21b4f4){var _0x1a7b4f=function(_0x46e649){while(--_0x46e649){_0x280ead['push'](_0x280ead['shift']());}};_0x1a7b4f(++_0x21b4f4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x14d4c7,_0x55eb0d){var _0x1ab948=function(_0x2910a8){while(--_0x2910a8){_0x14d4c7['push'](_0x14d4c7['shift']());}};_0x1ab948(++_0x55eb0d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b11c84d..2962bc2 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 _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x3c6c58,_0x5b0fa2){var _0x1ced4f=function(_0x2e09b4){while(--_0x2e09b4){_0x3c6c58['push'](_0x3c6c58['shift']());}};_0x1ced4f(++_0x5b0fa2);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5df097,_0x4d68f8){_0x5df097=_0x5df097-0x0;var _0xc95a59=_0xbd51[_0x5df097];return _0xc95a59;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x5fc3[_0x3e21f4];return _0x40fc49;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x35fc('0x2')]},'calleridname':{'type':Sequelize[_0x35fc('0x2')]},'context':{'type':Sequelize[_0x35fc('0x2')]},'extension':{'type':Sequelize[_0x35fc('0x2')]},'priority':{'type':Sequelize[_0x35fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x35fc('0x2')]},'projectName':{'type':Sequelize[_0x35fc('0x2')]},'saveName':{'type':Sequelize[_0x35fc('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x35fc('0x3')],'get':function(){var _0x508b32='';var _0x16e153=this[_0x35fc('0x4')](_0x35fc('0x5'));if(_0x16e153){_0x508b32=_0x16e153[_0x35fc('0x6')](_0x16e153[_0x35fc('0x7')]('.'));}return _0x508b32;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b43dc4f..47f00f9 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 _0x84d3=['../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','find','create','body','catch','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84d3,0xfd));var _0x384d=function(_0xc3f901,_0x3590c4){_0xc3f901=_0xc3f901-0x0;var _0x112340=_0x84d3[_0xc3f901];return _0x112340;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x384d('0x0'));var rp=require(_0x384d('0x1'));var moment=require(_0x384d('0x2'));var BPromise=require(_0x384d('0x3'));var Mustache=require('mustache');var util=require(_0x384d('0x4'));var path=require('path');var sox=require(_0x384d('0x5'));var csv=require('to-csv');var ejs=require(_0x384d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x384d('0x7'));var squel=require(_0x384d('0x8'));var crypto=require('crypto');var jsforce=require(_0x384d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x384d('0xa'));var querystring=require(_0x384d('0xb'));var Papa=require(_0x384d('0xc'));var Redis=require(_0x384d('0xd'));var authService=require(_0x384d('0xe'));var qs=require(_0x384d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x384d('0x10'));var logger=require(_0x384d('0x11'))(_0x384d('0x12'));var utils=require(_0x384d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x384d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b7d4,_0x373c51){_0x373c51=_0x373c51||0xcc;return function(_0x349036){if(_0x349036){return _0x35b7d4[_0x384d('0x15')](_0x373c51);}return _0x35b7d4['status'](_0x373c51)[_0x384d('0x16')]();};}function respondWithResult(_0xc8cc7f,_0x21df9b){_0x21df9b=_0x21df9b||0xc8;return function(_0x1da8c5){if(_0x1da8c5){return _0xc8cc7f['status'](_0x21df9b)[_0x384d('0x17')](_0x1da8c5);}};}function respondWithFilteredResult(_0x1c2887,_0x25f900){return function(_0x3572ed){if(_0x3572ed){var _0x76f186=typeof _0x25f900[_0x384d('0x18')]===_0x384d('0x19')&&typeof _0x25f900[_0x384d('0x1a')]===_0x384d('0x19');var _0x2b417b=_0x3572ed[_0x384d('0x1b')];var _0x373d00=_0x76f186?0x0:_0x25f900[_0x384d('0x18')];var _0x148bff=_0x76f186?_0x3572ed['count']:_0x25f900[_0x384d('0x18')]+_0x25f900[_0x384d('0x1a')];var _0x5f0447;if(_0x148bff>=_0x2b417b){_0x148bff=_0x2b417b;_0x5f0447=0xc8;}else{_0x5f0447=0xce;}_0x1c2887[_0x384d('0x1c')](_0x5f0447);return _0x1c2887['set'](_0x384d('0x1d'),_0x373d00+'-'+_0x148bff+'/'+_0x2b417b)['json'](_0x3572ed);}return null;};}function patchUpdates(_0x479cd2){return function(_0x4d796a){try{jsonpatch[_0x384d('0x1e')](_0x4d796a,_0x479cd2,!![]);}catch(_0x5650b4){return BPromise['reject'](_0x5650b4);}return _0x4d796a[_0x384d('0x1f')]();};}function saveUpdates(_0x40b0fa,_0x45b929){return function(_0xf3b992){if(_0xf3b992){return _0xf3b992[_0x384d('0x20')](_0x40b0fa)['then'](function(_0x259367){return _0x259367;});}return null;};}function removeEntity(_0x41d87e,_0x5ef64c){return function(_0x40fff4){if(_0x40fff4){return _0x40fff4[_0x384d('0x21')]()[_0x384d('0x22')](function(){_0x41d87e[_0x384d('0x1c')](0xcc)[_0x384d('0x16')]();});}};}function handleEntityNotFound(_0x537931,_0xdad1dd){return function(_0x5eedc2){if(!_0x5eedc2){_0x537931[_0x384d('0x15')](0x194);}return _0x5eedc2;};}function handleError(_0x5cd7df,_0x228235){_0x228235=_0x228235||0x1f4;return function(_0x449b52){logger[_0x384d('0x23')](_0x449b52[_0x384d('0x24')]);if(_0x449b52[_0x384d('0x25')]){delete _0x449b52[_0x384d('0x25')];}_0x5cd7df['status'](_0x228235)[_0x384d('0x26')](_0x449b52);};}exports[_0x384d('0x27')]=function(_0x141b03,_0x411b03){var _0xa7bbb2={},_0x198131={},_0x3ef9b7={'count':0x0,'rows':[]};var _0x1a7d9c=_[_0x384d('0x28')](db[_0x384d('0x29')][_0x384d('0x2a')],function(_0x350b52){return{'name':_0x350b52[_0x384d('0x2b')],'type':_0x350b52[_0x384d('0x2c')]['key']};});_0x198131[_0x384d('0x2d')]=_[_0x384d('0x28')](_0x1a7d9c,'name');_0x198131[_0x384d('0x2e')]=_[_0x384d('0x2f')](_0x141b03[_0x384d('0x2e')]);_0x198131['filters']=_[_0x384d('0x30')](_0x198131[_0x384d('0x2d')],_0x198131['query']);_0xa7bbb2[_0x384d('0x31')]=_['intersection'](_0x198131[_0x384d('0x2d')],qs[_0x384d('0x32')](_0x141b03[_0x384d('0x2e')][_0x384d('0x32')]));_0xa7bbb2[_0x384d('0x31')]=_0xa7bbb2[_0x384d('0x31')][_0x384d('0x33')]?_0xa7bbb2[_0x384d('0x31')]:_0x198131[_0x384d('0x2d')];if(!_0x141b03[_0x384d('0x2e')]['hasOwnProperty']('nolimit')){_0xa7bbb2[_0x384d('0x1a')]=qs[_0x384d('0x1a')](_0x141b03[_0x384d('0x2e')][_0x384d('0x1a')]);_0xa7bbb2['offset']=qs['offset'](_0x141b03[_0x384d('0x2e')]['offset']);}_0xa7bbb2['order']=qs[_0x384d('0x34')](_0x141b03[_0x384d('0x2e')][_0x384d('0x34')]);_0xa7bbb2[_0x384d('0x35')]=qs['filters'](_['pick'](_0x141b03[_0x384d('0x2e')],_0x198131['filters']),_0x1a7d9c);if(_0x141b03[_0x384d('0x2e')][_0x384d('0x36')]){_0xa7bbb2[_0x384d('0x35')]=_[_0x384d('0x37')](_0xa7bbb2[_0x384d('0x35')],{'$or':_['map'](_0x1a7d9c,function(_0x506f75){if(_0x506f75['type']!==_0x384d('0x38')){var _0x32a9b3={};_0x32a9b3[_0x506f75['name']]={'$like':'%'+_0x141b03[_0x384d('0x2e')][_0x384d('0x36')]+'%'};return _0x32a9b3;}})});}_0xa7bbb2=_[_0x384d('0x37')]({},_0xa7bbb2,_0x141b03[_0x384d('0x39')]);var _0x35034e={'where':_0xa7bbb2[_0x384d('0x35')]};return db[_0x384d('0x29')]['count'](_0x35034e)[_0x384d('0x22')](function(_0xeb3013){_0x3ef9b7[_0x384d('0x1b')]=_0xeb3013;if(_0x141b03[_0x384d('0x2e')][_0x384d('0x3a')]){_0xa7bbb2[_0x384d('0x3b')]=[{'all':!![]}];}return db[_0x384d('0x29')][_0x384d('0x3c')](_0xa7bbb2);})[_0x384d('0x22')](function(_0x2d9eec){_0x3ef9b7[_0x384d('0x3d')]=_0x2d9eec;return _0x3ef9b7;})[_0x384d('0x22')](respondWithFilteredResult(_0x411b03,_0xa7bbb2))['catch'](handleError(_0x411b03,null));};exports[_0x384d('0x3e')]=function(_0x13fb51,_0x21ee49){var _0x388b1f={'raw':!![],'where':{'id':_0x13fb51[_0x384d('0x3f')]['id']}},_0x1e9900={};_0x1e9900['model']=_['keys'](db[_0x384d('0x29')][_0x384d('0x2a')]);_0x1e9900[_0x384d('0x2e')]=_[_0x384d('0x2f')](_0x13fb51[_0x384d('0x2e')]);_0x1e9900[_0x384d('0x40')]=_[_0x384d('0x30')](_0x1e9900['model'],_0x1e9900['query']);_0x388b1f[_0x384d('0x31')]=_['intersection'](_0x1e9900[_0x384d('0x2d')],qs[_0x384d('0x32')](_0x13fb51[_0x384d('0x2e')][_0x384d('0x32')]));_0x388b1f['attributes']=_0x388b1f[_0x384d('0x31')][_0x384d('0x33')]?_0x388b1f[_0x384d('0x31')]:_0x1e9900[_0x384d('0x2d')];if(_0x13fb51[_0x384d('0x2e')][_0x384d('0x3a')]){_0x388b1f[_0x384d('0x3b')]=[{'all':!![]}];}_0x388b1f=_[_0x384d('0x37')]({},_0x388b1f,_0x13fb51['options']);return db[_0x384d('0x29')][_0x384d('0x41')](_0x388b1f)[_0x384d('0x22')](handleEntityNotFound(_0x21ee49,null))[_0x384d('0x22')](respondWithResult(_0x21ee49,null))['catch'](handleError(_0x21ee49,null));};exports['create']=function(_0x328865,_0x386621){return db['SquareRecording'][_0x384d('0x42')](_0x328865[_0x384d('0x43')],{})[_0x384d('0x22')](respondWithResult(_0x386621,0xc9))['catch'](handleError(_0x386621,null));};exports['update']=function(_0x241e4f,_0x5edc90){if(_0x241e4f['body']['id']){delete _0x241e4f[_0x384d('0x43')]['id'];}return db[_0x384d('0x29')][_0x384d('0x41')]({'where':{'id':_0x241e4f[_0x384d('0x3f')]['id']}})[_0x384d('0x22')](handleEntityNotFound(_0x5edc90,null))[_0x384d('0x22')](saveUpdates(_0x241e4f['body'],null))[_0x384d('0x22')](respondWithResult(_0x5edc90,null))[_0x384d('0x44')](handleError(_0x5edc90,null));};exports[_0x384d('0x45')]=function(_0x2bc3be,_0x5ec8e6,_0x46c8e8){var _0x2f14f1=require('../../components/encryptor');var _0xb8cd51=![];var _0x409057={};if(_0x2bc3be[_0x384d('0x2e')][_0x384d('0x2c')]&&_0x2bc3be['query']['type']===_0x384d('0x46')){_0x409057[_0x384d('0x46')]=_0x2bc3be[_0x384d('0x3f')]['id'];}else{_0x409057['id']=_0x2bc3be[_0x384d('0x3f')]['id'];}return db['SquareRecording'][_0x384d('0x41')]({'where':_0x409057,'attributes':['id',_0x384d('0x47'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x5ec8e6,null))[_0x384d('0x22')](function(_0x1e32ca){if(_0x1e32ca){var _0x4a3c20=_0x1e32ca['savePath'];var _0x27f3c2=util[_0x384d('0x48')](_0x384d('0x49'),_0x4a3c20);if(fs[_0x384d('0x4a')](_0x27f3c2)){_0xb8cd51=!![];return _0x2f14f1[_0x384d('0x4b')](_0x27f3c2,_0x4a3c20,config[_0x384d('0x4c')][_0x384d('0x4d')])['then'](function(){return _0x1e32ca;});}return _0x1e32ca;}})['then'](function(_0x5e212a){if(_0x5e212a){var _0x17882f=_0x5e212a[_0x384d('0x47')];if(!fs['existsSync'](_0x17882f)){throw new db[(_0x384d('0x4e'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x5e212a[_0x384d('0x4f')]){return _0x5ec8e6['download'](_0x17882f,_0x5e212a[_0x384d('0x4f')]+path[_0x384d('0x50')](_0x17882f),function(){if(_0xb8cd51){fs[_0x384d('0x51')](_0x17882f);}});}else{return _0x5ec8e6[_0x384d('0x45')](_0x17882f,function(_0xc3ff9){if(_0xb8cd51){fs[_0x384d('0x51')](_0x17882f);}});}}})[_0x384d('0x44')](function(_0x2e474e){if(_0x2e474e[_0x384d('0x52')]===_0x384d('0x53')){_0x5ec8e6[_0x384d('0x1c')](0x194)[_0x384d('0x26')](_0x384d('0x54'));}else{return handleError(_0x5ec8e6,null);}});};exports[_0x384d('0x21')]=function(_0x8c22,_0x284bea){return db[_0x384d('0x29')][_0x384d('0x41')]({'where':{'id':_0x8c22['params']['id']}})[_0x384d('0x22')](function(_0x2d6ea6){if(_['isNil'](_0x2d6ea6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2d6ea6;})[_0x384d('0x22')](function(_0x50aa2a){var _0x157960=_0x50aa2a[_0x384d('0x47')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x157960);if(!_[_0x384d('0x55')](_0x50aa2a[_0x384d('0x47')])&&fs[_0x384d('0x4a')](_0x157960)){logger[_0x384d('0x56')]('File:\x20\x22'+_0x157960+_0x384d('0x57'));fs[_0x384d('0x58')](_0x157960);}_0x157960=_0x157960+'.cypher';if(!_[_0x384d('0x55')](_0x50aa2a[_0x384d('0x47')])&&fs['existsSync'](_0x157960)){logger[_0x384d('0x56')](_0x384d('0x59')+_0x157960+_0x384d('0x57'));fs[_0x384d('0x58')](_0x157960);}return _0x50aa2a;})[_0x384d('0x22')](function(_0x5d318f){if(!_0x5d318f)throw new InternalError();return _0x5d318f[_0x384d('0x21')]();})[_0x384d('0x22')](function(){_0x284bea[_0x384d('0x1c')](0xcc)[_0x384d('0x16')]();})['catch'](handleError(_0x284bea,null));}; \ No newline at end of file +var _0x10da=['find','catch','create','body','update','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','.cypher','unlinkSync','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','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareRecording','includeAll','include','findAll','rows','params','keys','options'];(function(_0x454d94,_0x2d5642){var _0x1389b0=function(_0x1202ad){while(--_0x1202ad){_0x454d94['push'](_0x454d94['shift']());}};_0x1389b0(++_0x2d5642);}(_0x10da,0x144));var _0xa10d=function(_0x4d8563,_0x599406){_0x4d8563=_0x4d8563-0x0;var _0x139e13=_0x10da[_0x4d8563];return _0x139e13;};'use strict';var emlformat=require(_0xa10d('0x0'));var rimraf=require(_0xa10d('0x1'));var zipdir=require(_0xa10d('0x2'));var jsonpatch=require(_0xa10d('0x3'));var rp=require(_0xa10d('0x4'));var moment=require(_0xa10d('0x5'));var BPromise=require(_0xa10d('0x6'));var Mustache=require('mustache');var util=require(_0xa10d('0x7'));var path=require(_0xa10d('0x8'));var sox=require(_0xa10d('0x9'));var csv=require('to-csv');var ejs=require(_0xa10d('0xa'));var fs=require('fs');var fs_extra=require(_0xa10d('0xb'));var _=require(_0xa10d('0xc'));var squel=require(_0xa10d('0xd'));var crypto=require(_0xa10d('0xe'));var jsforce=require(_0xa10d('0xf'));var deskjs=require(_0xa10d('0x10'));var toCsv=require(_0xa10d('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa10d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa10d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa10d('0x14'));var config=require(_0xa10d('0x15'));var licenseUtil=require(_0xa10d('0x16'));var db=require(_0xa10d('0x17'))['db'];function respondWithStatusCode(_0x5bae7b,_0x524097){_0x524097=_0x524097||0xcc;return function(_0x361f47){if(_0x361f47){return _0x5bae7b[_0xa10d('0x18')](_0x524097);}return _0x5bae7b[_0xa10d('0x19')](_0x524097)['end']();};}function respondWithResult(_0x1761a2,_0x1884b0){_0x1884b0=_0x1884b0||0xc8;return function(_0x438f6b){if(_0x438f6b){return _0x1761a2[_0xa10d('0x19')](_0x1884b0)['json'](_0x438f6b);}};}function respondWithFilteredResult(_0x273c0a,_0x4c2cfb){return function(_0x3aa54f){if(_0x3aa54f){var _0x1541f0=typeof _0x4c2cfb['offset']===_0xa10d('0x1a')&&typeof _0x4c2cfb[_0xa10d('0x1b')]==='undefined';var _0x531cbe=_0x3aa54f[_0xa10d('0x1c')];var _0x37adf2=_0x1541f0?0x0:_0x4c2cfb['offset'];var _0x52fbcd=_0x1541f0?_0x3aa54f['count']:_0x4c2cfb[_0xa10d('0x1d')]+_0x4c2cfb[_0xa10d('0x1b')];var _0x56518a;if(_0x52fbcd>=_0x531cbe){_0x52fbcd=_0x531cbe;_0x56518a=0xc8;}else{_0x56518a=0xce;}_0x273c0a[_0xa10d('0x19')](_0x56518a);return _0x273c0a[_0xa10d('0x1e')]('Content-Range',_0x37adf2+'-'+_0x52fbcd+'/'+_0x531cbe)[_0xa10d('0x1f')](_0x3aa54f);}return null;};}function patchUpdates(_0x4993c9){return function(_0x13be94){try{jsonpatch['apply'](_0x13be94,_0x4993c9,!![]);}catch(_0x42387b){return BPromise[_0xa10d('0x20')](_0x42387b);}return _0x13be94[_0xa10d('0x21')]();};}function saveUpdates(_0x5113a8,_0x1f03b4){return function(_0xa40ee7){if(_0xa40ee7){return _0xa40ee7['update'](_0x5113a8)[_0xa10d('0x22')](function(_0x58915e){return _0x58915e;});}return null;};}function removeEntity(_0xba8779,_0xd133ee){return function(_0x26f15c){if(_0x26f15c){return _0x26f15c['destroy']()[_0xa10d('0x22')](function(){_0xba8779['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cbfb1,_0x4b3a25){return function(_0x162cb3){if(!_0x162cb3){_0x4cbfb1[_0xa10d('0x18')](0x194);}return _0x162cb3;};}function handleError(_0x3cf890,_0x5a0aeb){_0x5a0aeb=_0x5a0aeb||0x1f4;return function(_0x41ceab){logger[_0xa10d('0x23')](_0x41ceab['stack']);if(_0x41ceab[_0xa10d('0x24')]){delete _0x41ceab[_0xa10d('0x24')];}_0x3cf890['status'](_0x5a0aeb)[_0xa10d('0x25')](_0x41ceab);};}exports[_0xa10d('0x26')]=function(_0x4e9fd4,_0x4a3305){var _0x37c315={},_0x238e1a={},_0x170238={'count':0x0,'rows':[]};var _0x24e8da=_[_0xa10d('0x27')](db['SquareRecording'][_0xa10d('0x28')],function(_0x48f2fe){return{'name':_0x48f2fe[_0xa10d('0x29')],'type':_0x48f2fe[_0xa10d('0x2a')][_0xa10d('0x2b')]};});_0x238e1a['model']=_['map'](_0x24e8da,'name');_0x238e1a['query']=_['keys'](_0x4e9fd4[_0xa10d('0x2c')]);_0x238e1a[_0xa10d('0x2d')]=_[_0xa10d('0x2e')](_0x238e1a[_0xa10d('0x2f')],_0x238e1a[_0xa10d('0x2c')]);_0x37c315['attributes']=_[_0xa10d('0x2e')](_0x238e1a[_0xa10d('0x2f')],qs[_0xa10d('0x30')](_0x4e9fd4[_0xa10d('0x2c')][_0xa10d('0x30')]));_0x37c315[_0xa10d('0x31')]=_0x37c315[_0xa10d('0x31')][_0xa10d('0x32')]?_0x37c315[_0xa10d('0x31')]:_0x238e1a[_0xa10d('0x2f')];if(!_0x4e9fd4[_0xa10d('0x2c')][_0xa10d('0x33')](_0xa10d('0x34'))){_0x37c315['limit']=qs[_0xa10d('0x1b')](_0x4e9fd4[_0xa10d('0x2c')]['limit']);_0x37c315[_0xa10d('0x1d')]=qs[_0xa10d('0x1d')](_0x4e9fd4[_0xa10d('0x2c')]['offset']);}_0x37c315[_0xa10d('0x35')]=qs[_0xa10d('0x36')](_0x4e9fd4[_0xa10d('0x2c')][_0xa10d('0x36')]);_0x37c315[_0xa10d('0x37')]=qs[_0xa10d('0x2d')](_[_0xa10d('0x38')](_0x4e9fd4[_0xa10d('0x2c')],_0x238e1a['filters']),_0x24e8da);if(_0x4e9fd4['query'][_0xa10d('0x39')]){_0x37c315[_0xa10d('0x37')]=_[_0xa10d('0x3a')](_0x37c315[_0xa10d('0x37')],{'$or':_[_0xa10d('0x27')](_0x24e8da,function(_0x1e5d03){if(_0x1e5d03[_0xa10d('0x2a')]!==_0xa10d('0x3b')){var _0xc0faf0={};_0xc0faf0[_0x1e5d03[_0xa10d('0x24')]]={'$like':'%'+_0x4e9fd4[_0xa10d('0x2c')]['filter']+'%'};return _0xc0faf0;}})});}_0x37c315=_['merge']({},_0x37c315,_0x4e9fd4['options']);var _0x8469b7={'where':_0x37c315[_0xa10d('0x37')]};return db[_0xa10d('0x3c')][_0xa10d('0x1c')](_0x8469b7)['then'](function(_0x4317a9){_0x170238[_0xa10d('0x1c')]=_0x4317a9;if(_0x4e9fd4['query'][_0xa10d('0x3d')]){_0x37c315[_0xa10d('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xa10d('0x3f')](_0x37c315);})[_0xa10d('0x22')](function(_0x62f9e1){_0x170238[_0xa10d('0x40')]=_0x62f9e1;return _0x170238;})[_0xa10d('0x22')](respondWithFilteredResult(_0x4a3305,_0x37c315))['catch'](handleError(_0x4a3305,null));};exports['show']=function(_0x1a75e6,_0x1f4c4c){var _0x20eebd={'raw':!![],'where':{'id':_0x1a75e6[_0xa10d('0x41')]['id']}},_0x4fb46f={};_0x4fb46f['model']=_[_0xa10d('0x42')](db[_0xa10d('0x3c')][_0xa10d('0x28')]);_0x4fb46f[_0xa10d('0x2c')]=_['keys'](_0x1a75e6[_0xa10d('0x2c')]);_0x4fb46f[_0xa10d('0x2d')]=_['intersection'](_0x4fb46f[_0xa10d('0x2f')],_0x4fb46f[_0xa10d('0x2c')]);_0x20eebd['attributes']=_[_0xa10d('0x2e')](_0x4fb46f[_0xa10d('0x2f')],qs[_0xa10d('0x30')](_0x1a75e6[_0xa10d('0x2c')]['fields']));_0x20eebd['attributes']=_0x20eebd[_0xa10d('0x31')]['length']?_0x20eebd[_0xa10d('0x31')]:_0x4fb46f['model'];if(_0x1a75e6[_0xa10d('0x2c')]['includeAll']){_0x20eebd[_0xa10d('0x3e')]=[{'all':!![]}];}_0x20eebd=_['merge']({},_0x20eebd,_0x1a75e6[_0xa10d('0x43')]);return db[_0xa10d('0x3c')][_0xa10d('0x44')](_0x20eebd)[_0xa10d('0x22')](handleEntityNotFound(_0x1f4c4c,null))[_0xa10d('0x22')](respondWithResult(_0x1f4c4c,null))[_0xa10d('0x45')](handleError(_0x1f4c4c,null));};exports[_0xa10d('0x46')]=function(_0x4983a3,_0x407461){return db['SquareRecording'][_0xa10d('0x46')](_0x4983a3[_0xa10d('0x47')],{})['then'](respondWithResult(_0x407461,0xc9))[_0xa10d('0x45')](handleError(_0x407461,null));};exports[_0xa10d('0x48')]=function(_0x2c0135,_0x58d7d1){if(_0x2c0135['body']['id']){delete _0x2c0135[_0xa10d('0x47')]['id'];}return db[_0xa10d('0x3c')][_0xa10d('0x44')]({'where':{'id':_0x2c0135[_0xa10d('0x41')]['id']}})[_0xa10d('0x22')](handleEntityNotFound(_0x58d7d1,null))[_0xa10d('0x22')](saveUpdates(_0x2c0135[_0xa10d('0x47')],null))[_0xa10d('0x22')](respondWithResult(_0x58d7d1,null))[_0xa10d('0x45')](handleError(_0x58d7d1,null));};exports['download']=function(_0x2aaa56,_0x50bc8b,_0x172dea){var _0x456b42=require('../../components/encryptor');var _0x2f1a58=![];var _0x1c7041={};if(_0x2aaa56[_0xa10d('0x2c')][_0xa10d('0x2a')]&&_0x2aaa56[_0xa10d('0x2c')][_0xa10d('0x2a')]==='uniqueid'){_0x1c7041[_0xa10d('0x49')]=_0x2aaa56[_0xa10d('0x41')]['id'];}else{_0x1c7041['id']=_0x2aaa56[_0xa10d('0x41')]['id'];}return db['SquareRecording'][_0xa10d('0x44')]({'where':_0x1c7041,'attributes':['id',_0xa10d('0x4a'),_0xa10d('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x50bc8b,null))[_0xa10d('0x22')](function(_0xa2b446){if(_0xa2b446){var _0x25b2ad=_0xa2b446['savePath'];var _0x536c1b=util[_0xa10d('0x4c')](_0xa10d('0x4d'),_0x25b2ad);if(fs['existsSync'](_0x536c1b)){_0x2f1a58=!![];return _0x456b42[_0xa10d('0x4e')](_0x536c1b,_0x25b2ad,config[_0xa10d('0x4f')][_0xa10d('0x50')])[_0xa10d('0x22')](function(){return _0xa2b446;});}return _0xa2b446;}})['then'](function(_0x10fffd){if(_0x10fffd){var _0x572044=_0x10fffd[_0xa10d('0x4a')];if(!fs[_0xa10d('0x51')](_0x572044)){throw new db[(_0xa10d('0x52'))][(_0xa10d('0x53'))](_0xa10d('0x54'));}if(_0x10fffd['filename']){return _0x50bc8b[_0xa10d('0x55')](_0x572044,_0x10fffd[_0xa10d('0x4b')]+path[_0xa10d('0x56')](_0x572044),function(){if(_0x2f1a58){fs[_0xa10d('0x57')](_0x572044);}});}else{return _0x50bc8b[_0xa10d('0x55')](_0x572044,function(_0x4d0c76){if(_0x2f1a58){fs['unlink'](_0x572044);}});}}})[_0xa10d('0x45')](function(_0x297bd1){if(_0x297bd1[_0xa10d('0x58')]===_0xa10d('0x54')){_0x50bc8b[_0xa10d('0x19')](0x194)[_0xa10d('0x25')](_0xa10d('0x59'));}else{return handleError(_0x50bc8b,null);}});};exports[_0xa10d('0x5a')]=function(_0xde034d,_0x5e2c76){return db['SquareRecording'][_0xa10d('0x44')]({'where':{'id':_0xde034d['params']['id']}})[_0xa10d('0x22')](function(_0x5b4414){if(_[_0xa10d('0x5b')](_0x5b4414)){throw new ReferenceError(_0xa10d('0x5c'));}return _0x5b4414;})[_0xa10d('0x22')](function(_0x23ebf8){var _0x2727d2=_0x23ebf8['savePath'];logger['info'](_0xa10d('0x5d'),_0x2727d2);if(!_[_0xa10d('0x5b')](_0x23ebf8[_0xa10d('0x4a')])&&fs[_0xa10d('0x51')](_0x2727d2)){logger[_0xa10d('0x5e')](_0xa10d('0x5f')+_0x2727d2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2727d2);}_0x2727d2=_0x2727d2+_0xa10d('0x60');if(!_[_0xa10d('0x5b')](_0x23ebf8['savePath'])&&fs['existsSync'](_0x2727d2)){logger[_0xa10d('0x5e')](_0xa10d('0x5f')+_0x2727d2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa10d('0x61')](_0x2727d2);}return _0x23ebf8;})[_0xa10d('0x22')](function(_0x211ed4){if(!_0x211ed4)throw new InternalError();return _0x211ed4['destroy']();})['then'](function(){_0x5e2c76[_0xa10d('0x19')](0xcc)['end']();})[_0xa10d('0x45')](handleError(_0x5e2c76,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ebc1182..94c12f9 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 _0xedf1=['SquareRecording','square_recordings','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','define'];(function(_0x59dde9,_0x1032d2){var _0x339832=function(_0x65e108){while(--_0x65e108){_0x59dde9['push'](_0x59dde9['shift']());}};_0x339832(++_0x1032d2);}(_0xedf1,0xb2));var _0x1edf=function(_0x4d96cd,_0x47e7c5){_0x4d96cd=_0x4d96cd-0x0;var _0x26e3ce=_0xedf1[_0x4d96cd];return _0x26e3ce;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1edf('0x2'));var BPromise=require(_0x1edf('0x3'));var rp=require(_0x1edf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1edf('0x5'));var config=require(_0x1edf('0x6'));var attributes=require(_0x1edf('0x7'));module['exports']=function(_0x52238d,_0x1b84af){return _0x52238d[_0x1edf('0x8')](_0x1edf('0x9'),attributes,{'tableName':_0x1edf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['moment','path','rimraf','../../config/environment','exports','SquareRecording','square_recordings','../../config/logger','api'];(function(_0xcb1736,_0xfceec0){var _0x2485b3=function(_0x471d0c){while(--_0x471d0c){_0xcb1736['push'](_0xcb1736['shift']());}};_0x2485b3(++_0xfceec0);}(_0x1a85,0x178));var _0x51a8=function(_0x31bbf7,_0x292c9a){_0x31bbf7=_0x31bbf7-0x0;var _0x1469f3=_0x1a85[_0x31bbf7];return _0x1469f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./squareRecording.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'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 7554449..9bff60f 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 _0xa93d=['body','options','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareRecording','SquareRecording','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa93d,0x109));var _0xda93=function(_0x366d79,_0x4e55e1){_0x366d79=_0x366d79-0x0;var _0x5529ca=_0xa93d[_0x366d79];return _0x5529ca;};'use strict';var _=require(_0xda93('0x0'));var util=require(_0xda93('0x1'));var moment=require(_0xda93('0x2'));var BPromise=require(_0xda93('0x3'));var rs=require(_0xda93('0x4'));var fs=require('fs');var Redis=require(_0xda93('0x5'));var db=require(_0xda93('0x6'))['db'];var utils=require(_0xda93('0x7'));var logger=require(_0xda93('0x8'))('rpc');var config=require(_0xda93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xda93('0xa')][_0xda93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39b6af,_0x45f052,_0x452b29){return new BPromise(function(_0x55ac4c,_0x5a333c){return client[_0xda93('0xc')](_0x39b6af,_0x452b29)['then'](function(_0x307d24){logger[_0xda93('0xd')](_0xda93('0xe'),_0x45f052,_0xda93('0xf'));logger[_0xda93('0x10')](_0xda93('0x11'),_0x45f052,'request\x20sent',JSON['stringify'](_0x307d24));if(_0x307d24[_0xda93('0x12')]){if(_0x307d24[_0xda93('0x12')]['code']===0x1f4){logger[_0xda93('0x12')](_0xda93('0xe'),_0x45f052,_0x307d24[_0xda93('0x12')][_0xda93('0x13')]);return _0x5a333c(_0x307d24[_0xda93('0x12')][_0xda93('0x13')]);}logger['error'](_0xda93('0xe'),_0x45f052,_0x307d24[_0xda93('0x12')]['message']);return _0x55ac4c(_0x307d24[_0xda93('0x12')]['message']);}else{logger[_0xda93('0xd')]('SquareRecording,\x20%s,\x20%s',_0x45f052,_0xda93('0xf'));_0x55ac4c(_0x307d24[_0xda93('0x14')][_0xda93('0x13')]);}})[_0xda93('0x15')](function(_0x2f01ac){logger[_0xda93('0x12')](_0xda93('0xe'),_0x45f052,_0x2f01ac);_0x5a333c(_0x2f01ac);});});}exports[_0xda93('0x16')]=function(_0x454670){var _0x2deb23=this;return new Promise(function(_0x3e465f,_0x99dfc3){return db[_0xda93('0x17')][_0xda93('0x18')](_0x454670[_0xda93('0x19')],{'raw':_0x454670[_0xda93('0x1a')]?_0x454670[_0xda93('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xda93('0x1b')](function(_0x303ec8){logger[_0xda93('0xd')](_0xda93('0x16'),_0x454670);logger[_0xda93('0x10')](_0xda93('0x16'),_0x454670,JSON[_0xda93('0x1c')](_0x303ec8));_0x3e465f(_0x303ec8);})[_0xda93('0x15')](function(_0x582601){logger[_0xda93('0x12')](_0xda93('0x16'),_0x582601[_0xda93('0x13')],_0x454670);_0x99dfc3(_0x2deb23['error'](0x1f4,_0x582601[_0xda93('0x13')]));});});}; \ No newline at end of file +var _0x9be3=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSquareRecording','create','options','debug','stringify','util','moment'];(function(_0x4c12c1,_0x41926c){var _0x40bc9d=function(_0x54f283){while(--_0x54f283){_0x4c12c1['push'](_0x4c12c1['shift']());}};_0x40bc9d(++_0x41926c);}(_0x9be3,0x1a7));var _0x39be=function(_0x42304a,_0x14be94){_0x42304a=_0x42304a-0x0;var _0x159335=_0x9be3[_0x42304a];return _0x159335;};'use strict';var _=require('lodash');var util=require(_0x39be('0x0'));var moment=require(_0x39be('0x1'));var BPromise=require('bluebird');var rs=require(_0x39be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39be('0x3'));var logger=require(_0x39be('0x4'))(_0x39be('0x5'));var config=require(_0x39be('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x39be('0x7')][_0x39be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ea98e,_0x15f272,_0x5bbae9){return new BPromise(function(_0x5390f7,_0x154d6d){return client[_0x39be('0x9')](_0x4ea98e,_0x5bbae9)[_0x39be('0xa')](function(_0x324dd6){logger['info'](_0x39be('0xb'),_0x15f272,_0x39be('0xc'));logger['debug'](_0x39be('0xd'),_0x15f272,_0x39be('0xc'),JSON['stringify'](_0x324dd6));if(_0x324dd6[_0x39be('0xe')]){if(_0x324dd6[_0x39be('0xe')][_0x39be('0xf')]===0x1f4){logger[_0x39be('0xe')](_0x39be('0xb'),_0x15f272,_0x324dd6[_0x39be('0xe')][_0x39be('0x10')]);return _0x154d6d(_0x324dd6[_0x39be('0xe')][_0x39be('0x10')]);}logger['error'](_0x39be('0xb'),_0x15f272,_0x324dd6[_0x39be('0xe')][_0x39be('0x10')]);return _0x5390f7(_0x324dd6['error'][_0x39be('0x10')]);}else{logger[_0x39be('0x11')](_0x39be('0xb'),_0x15f272,'request\x20sent');_0x5390f7(_0x324dd6[_0x39be('0x12')][_0x39be('0x10')]);}})[_0x39be('0x13')](function(_0x34e68d){logger['error']('SquareRecording,\x20%s,\x20%s',_0x15f272,_0x34e68d);_0x154d6d(_0x34e68d);});});}exports[_0x39be('0x14')]=function(_0x2ef99e){var _0x58af61=this;return new Promise(function(_0x47594f,_0x297e73){return db['SquareRecording'][_0x39be('0x15')](_0x2ef99e['body'],{'raw':_0x2ef99e[_0x39be('0x16')]?_0x2ef99e[_0x39be('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x39be('0xa')](function(_0x5e2c83){logger[_0x39be('0x11')]('CreateSquareRecording',_0x2ef99e);logger[_0x39be('0x17')]('CreateSquareRecording',_0x2ef99e,JSON[_0x39be('0x18')](_0x5e2c83));_0x47594f(_0x5e2c83);})['catch'](function(_0x52fa35){logger['error'](_0x39be('0x14'),_0x52fa35[_0x39be('0x10')],_0x2ef99e);_0x297e73(_0x58af61['error'](0x1f4,_0x52fa35[_0x39be('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 287b4ee..ba9762c 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x303008,_0x1e07c2){var _0x2a93f8=function(_0x41bcca){while(--_0x41bcca){_0x303008['push'](_0x303008['shift']());}};_0x2a93f8(++_0x1e07c2);}(_0xe706,0xa3));var _0x6e70=function(_0x38954c,_0x357891){_0x38954c=_0x38954c-0x0;var _0x19fd62=_0xe706[_0x38954c];return _0x19fd62;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0xa1eeaa,_0x3188f9){var _0xf3dbd5=function(_0xfe5875){while(--_0xfe5875){_0xa1eeaa['push'](_0xa1eeaa['shift']());}};_0xf3dbd5(++_0x3188f9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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 540b59d..fc7c3e3 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 _0x667f=['STRING','DATE'];(function(_0x3bc4dd,_0xeb3de7){var _0x3168eb=function(_0x56b4a6){while(--_0x56b4a6){_0x3bc4dd['push'](_0x3bc4dd['shift']());}};_0x3168eb(++_0xeb3de7);}(_0x667f,0x1b0));var _0xf667=function(_0x59f9dc,_0x4862f6){_0x59f9dc=_0x59f9dc-0x0;var _0x24c754=_0x667f[_0x59f9dc];return _0x24c754;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xf667('0x0')]},'network_script':{'type':Sequelize[_0xf667('0x0')]},'request':{'type':Sequelize[_0xf667('0x0')]},'channel':{'type':Sequelize[_0xf667('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf667('0x0')]},'uniqueid':{'type':Sequelize[_0xf667('0x0')]},'version':{'type':Sequelize[_0xf667('0x0')]},'callerid':{'type':Sequelize[_0xf667('0x0')]},'calleridname':{'type':Sequelize[_0xf667('0x0')]},'callingpres':{'type':Sequelize[_0xf667('0x0')]},'callingani2':{'type':Sequelize[_0xf667('0x0')]},'callington':{'type':Sequelize[_0xf667('0x0')]},'callingtns':{'type':Sequelize[_0xf667('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf667('0x0')]},'context':{'type':Sequelize[_0xf667('0x0')]},'extension':{'type':Sequelize[_0xf667('0x0')]},'priority':{'type':Sequelize[_0xf667('0x0')]},'enhanced':{'type':Sequelize[_0xf667('0x0')]},'accountcode':{'type':Sequelize[_0xf667('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf667('0x0')]},'joinAt':{'type':Sequelize[_0xf667('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb10a=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x5a6e7b,_0x3dabdc){var _0x5bef75=function(_0x2fa93b){while(--_0x2fa93b){_0x5a6e7b['push'](_0x5a6e7b['shift']());}};_0x5bef75(++_0x3dabdc);}(_0xb10a,0x1df));var _0xab10=function(_0x1e6775,_0x38e7fb){_0x1e6775=_0x1e6775-0x0;var _0x21f539=_0xb10a[_0x1e6775];return _0x21f539;};'use strict';var Sequelize=require(_0xab10('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xab10('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xab10('0x1')]},'language':{'type':Sequelize[_0xab10('0x1')]},'type':{'type':Sequelize[_0xab10('0x1')]},'uniqueid':{'type':Sequelize[_0xab10('0x1')]},'version':{'type':Sequelize[_0xab10('0x1')]},'callerid':{'type':Sequelize[_0xab10('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xab10('0x1')]},'callington':{'type':Sequelize[_0xab10('0x1')]},'callingtns':{'type':Sequelize[_0xab10('0x1')]},'dnid':{'type':Sequelize[_0xab10('0x1')]},'rdnis':{'type':Sequelize[_0xab10('0x1')]},'context':{'type':Sequelize[_0xab10('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xab10('0x1')]},'threadid':{'type':Sequelize[_0xab10('0x1')]},'project_name':{'type':Sequelize[_0xab10('0x1')]},'joinAt':{'type':Sequelize[_0xab10('0x2')]},'leaveAt':{'type':Sequelize[_0xab10('0x2')]},'bot':{'type':Sequelize[_0xab10('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2ba132a..88843b4 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 _0x8755=['bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SquareReport','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','moment'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x8755,0xda));var _0x5875=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8755[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5875('0x0'));var rimraf=require(_0x5875('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5875('0x2'));var rp=require('request-promise');var moment=require(_0x5875('0x3'));var BPromise=require(_0x5875('0x4'));var Mustache=require(_0x5875('0x5'));var util=require(_0x5875('0x6'));var path=require('path');var sox=require(_0x5875('0x7'));var csv=require('to-csv');var ejs=require(_0x5875('0x8'));var fs=require('fs');var fs_extra=require(_0x5875('0x9'));var _=require('lodash');var squel=require(_0x5875('0xa'));var crypto=require(_0x5875('0xb'));var jsforce=require(_0x5875('0xc'));var deskjs=require(_0x5875('0xd'));var toCsv=require(_0x5875('0xe'));var querystring=require('querystring');var Papa=require(_0x5875('0xf'));var Redis=require(_0x5875('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5875('0x11'));var as=require(_0x5875('0x12'));var hardwareService=require(_0x5875('0x13'));var logger=require('../../config/logger')(_0x5875('0x14'));var utils=require(_0x5875('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5875('0x16'));var db=require(_0x5875('0x17'))['db'];function respondWithStatusCode(_0x292f22,_0x51ef64){_0x51ef64=_0x51ef64||0xcc;return function(_0x224f37){if(_0x224f37){return _0x292f22['sendStatus'](_0x51ef64);}return _0x292f22['status'](_0x51ef64)[_0x5875('0x18')]();};}function respondWithResult(_0x56f6fb,_0x477e72){_0x477e72=_0x477e72||0xc8;return function(_0x465dcb){if(_0x465dcb){return _0x56f6fb[_0x5875('0x19')](_0x477e72)[_0x5875('0x1a')](_0x465dcb);}};}function respondWithFilteredResult(_0x10e8fd,_0x56f01d){return function(_0x5c4df6){if(_0x5c4df6){var _0x39dc65=typeof _0x56f01d[_0x5875('0x1b')]===_0x5875('0x1c')&&typeof _0x56f01d[_0x5875('0x1d')]==='undefined';var _0x1d05b2=_0x5c4df6[_0x5875('0x1e')];var _0x2712e7=_0x39dc65?0x0:_0x56f01d[_0x5875('0x1b')];var _0x94d684=_0x39dc65?_0x5c4df6['count']:_0x56f01d[_0x5875('0x1b')]+_0x56f01d[_0x5875('0x1d')];var _0x54562d;if(_0x94d684>=_0x1d05b2){_0x94d684=_0x1d05b2;_0x54562d=0xc8;}else{_0x54562d=0xce;}_0x10e8fd[_0x5875('0x19')](_0x54562d);return _0x10e8fd[_0x5875('0x1f')](_0x5875('0x20'),_0x2712e7+'-'+_0x94d684+'/'+_0x1d05b2)[_0x5875('0x1a')](_0x5c4df6);}return null;};}function patchUpdates(_0xd5442){return function(_0x3e06d2){try{jsonpatch[_0x5875('0x21')](_0x3e06d2,_0xd5442,!![]);}catch(_0x17f93f){return BPromise['reject'](_0x17f93f);}return _0x3e06d2[_0x5875('0x22')]();};}function saveUpdates(_0x1cdb0d,_0x1d863c){return function(_0x4f725a){if(_0x4f725a){return _0x4f725a[_0x5875('0x23')](_0x1cdb0d)[_0x5875('0x24')](function(_0x22c9aa){return _0x22c9aa;});}return null;};}function removeEntity(_0x4bf097,_0x47ac09){return function(_0x35fd1c){if(_0x35fd1c){return _0x35fd1c[_0x5875('0x25')]()[_0x5875('0x24')](function(){_0x4bf097[_0x5875('0x19')](0xcc)[_0x5875('0x18')]();});}};}function handleEntityNotFound(_0x4f7232,_0x3c5f28){return function(_0x419dfa){if(!_0x419dfa){_0x4f7232[_0x5875('0x26')](0x194);}return _0x419dfa;};}function handleError(_0x5b9538,_0x3e9b10){_0x3e9b10=_0x3e9b10||0x1f4;return function(_0x4a4c60){logger[_0x5875('0x27')](_0x4a4c60[_0x5875('0x28')]);if(_0x4a4c60[_0x5875('0x29')]){delete _0x4a4c60[_0x5875('0x29')];}_0x5b9538[_0x5875('0x19')](_0x3e9b10)[_0x5875('0x2a')](_0x4a4c60);};}exports['index']=function(_0x2ad86f,_0x572429){var _0x1b0f6a={},_0x304a64={},_0x573753={'count':0x0,'rows':[]};var _0xc0f2fa=_[_0x5875('0x2b')](db[_0x5875('0x2c')]['rawAttributes'],function(_0x24c264){return{'name':_0x24c264[_0x5875('0x2d')],'type':_0x24c264['type'][_0x5875('0x2e')]};});_0x304a64[_0x5875('0x2f')]=_['map'](_0xc0f2fa,_0x5875('0x29'));_0x304a64['query']=_[_0x5875('0x30')](_0x2ad86f['query']);_0x304a64[_0x5875('0x31')]=_[_0x5875('0x32')](_0x304a64[_0x5875('0x2f')],_0x304a64[_0x5875('0x33')]);_0x1b0f6a['attributes']=_[_0x5875('0x32')](_0x304a64[_0x5875('0x2f')],qs[_0x5875('0x34')](_0x2ad86f[_0x5875('0x33')][_0x5875('0x34')]));_0x1b0f6a[_0x5875('0x35')]=_0x1b0f6a[_0x5875('0x35')][_0x5875('0x36')]?_0x1b0f6a[_0x5875('0x35')]:_0x304a64[_0x5875('0x2f')];if(!_0x2ad86f[_0x5875('0x33')][_0x5875('0x37')](_0x5875('0x38'))){_0x1b0f6a['limit']=qs[_0x5875('0x1d')](_0x2ad86f[_0x5875('0x33')]['limit']);_0x1b0f6a[_0x5875('0x1b')]=qs[_0x5875('0x1b')](_0x2ad86f['query']['offset']);}_0x1b0f6a[_0x5875('0x39')]=qs[_0x5875('0x3a')](_0x2ad86f['query'][_0x5875('0x3a')]);_0x1b0f6a[_0x5875('0x3b')]=qs[_0x5875('0x31')](_[_0x5875('0x3c')](_0x2ad86f[_0x5875('0x33')],_0x304a64['filters']),_0xc0f2fa);if(_0x2ad86f['query']['filter']){_0x1b0f6a[_0x5875('0x3b')]=_[_0x5875('0x3d')](_0x1b0f6a[_0x5875('0x3b')],{'$or':_[_0x5875('0x2b')](_0xc0f2fa,function(_0x10eec4){if(_0x10eec4[_0x5875('0x3e')]!=='VIRTUAL'){var _0x13895d={};_0x13895d[_0x10eec4[_0x5875('0x29')]]={'$like':'%'+_0x2ad86f[_0x5875('0x33')][_0x5875('0x3f')]+'%'};return _0x13895d;}})});}_0x1b0f6a=_['merge']({},_0x1b0f6a,_0x2ad86f[_0x5875('0x40')]);var _0x1ec536={'where':_0x1b0f6a['where']};return db[_0x5875('0x2c')][_0x5875('0x1e')](_0x1ec536)[_0x5875('0x24')](function(_0x3b91ef){_0x573753[_0x5875('0x1e')]=_0x3b91ef;if(_0x2ad86f['query'][_0x5875('0x41')]){_0x1b0f6a[_0x5875('0x42')]=[{'all':!![]}];}return db[_0x5875('0x2c')][_0x5875('0x43')](_0x1b0f6a);})[_0x5875('0x24')](function(_0xe0d88c){_0x573753['rows']=_0xe0d88c;return _0x573753;})[_0x5875('0x24')](respondWithFilteredResult(_0x572429,_0x1b0f6a))[_0x5875('0x44')](handleError(_0x572429,null));};exports[_0x5875('0x45')]=function(_0x3faa1e,_0x2ef159){var _0x16174f={'raw':!![],'where':{'id':_0x3faa1e[_0x5875('0x46')]['id']}},_0x1695af={};_0x1695af['model']=_['keys'](db[_0x5875('0x2c')]['rawAttributes']);_0x1695af[_0x5875('0x33')]=_[_0x5875('0x30')](_0x3faa1e[_0x5875('0x33')]);_0x1695af['filters']=_[_0x5875('0x32')](_0x1695af[_0x5875('0x2f')],_0x1695af[_0x5875('0x33')]);_0x16174f[_0x5875('0x35')]=_[_0x5875('0x32')](_0x1695af[_0x5875('0x2f')],qs['fields'](_0x3faa1e[_0x5875('0x33')]['fields']));_0x16174f[_0x5875('0x35')]=_0x16174f[_0x5875('0x35')][_0x5875('0x36')]?_0x16174f[_0x5875('0x35')]:_0x1695af[_0x5875('0x2f')];if(_0x3faa1e['query'][_0x5875('0x41')]){_0x16174f['include']=[{'all':!![]}];}_0x16174f=_[_0x5875('0x3d')]({},_0x16174f,_0x3faa1e[_0x5875('0x40')]);return db[_0x5875('0x2c')][_0x5875('0x47')](_0x16174f)[_0x5875('0x24')](handleEntityNotFound(_0x2ef159,null))[_0x5875('0x24')](respondWithResult(_0x2ef159,null))[_0x5875('0x44')](handleError(_0x2ef159,null));};exports[_0x5875('0x48')]=function(_0x313b26,_0x3c9c06){return db[_0x5875('0x2c')][_0x5875('0x48')](_0x313b26[_0x5875('0x49')],{})[_0x5875('0x24')](respondWithResult(_0x3c9c06,0xc9))[_0x5875('0x44')](handleError(_0x3c9c06,null));};exports[_0x5875('0x23')]=function(_0x5cb9aa,_0x2d9f48){if(_0x5cb9aa[_0x5875('0x49')]['id']){delete _0x5cb9aa[_0x5875('0x49')]['id'];}return db[_0x5875('0x2c')][_0x5875('0x47')]({'where':{'id':_0x5cb9aa[_0x5875('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d9f48,null))[_0x5875('0x24')](saveUpdates(_0x5cb9aa[_0x5875('0x49')],null))[_0x5875('0x24')](respondWithResult(_0x2d9f48,null))[_0x5875('0x44')](handleError(_0x2d9f48,null));};exports[_0x5875('0x25')]=function(_0x4f11df,_0x28b5b9){return db[_0x5875('0x2c')][_0x5875('0x47')]({'where':{'id':_0x4f11df[_0x5875('0x46')]['id']}})['then'](handleEntityNotFound(_0x28b5b9,null))[_0x5875('0x24')](removeEntity(_0x28b5b9,null))[_0x5875('0x44')](handleError(_0x28b5b9,null));};exports['describe']=function(_0x3fd230,_0xad5fb2){return db['SquareReport']['describe']()[_0x5875('0x24')](respondWithResult(_0xad5fb2,null))['catch'](handleError(_0xad5fb2,null));}; \ No newline at end of file +var _0xa6dd=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareReport','findAll','rows','catch','params','find','body','destroy'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xa6dd,0x1b6));var _0xda6d=function(_0x3dcf21,_0x572c92){_0x3dcf21=_0x3dcf21-0x0;var _0x24a091=_0xa6dd[_0x3dcf21];return _0x24a091;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda6d('0x0'));var zipdir=require(_0xda6d('0x1'));var jsonpatch=require(_0xda6d('0x2'));var rp=require(_0xda6d('0x3'));var moment=require(_0xda6d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xda6d('0x5'));var util=require('util');var path=require(_0xda6d('0x6'));var sox=require('sox');var csv=require(_0xda6d('0x7'));var ejs=require(_0xda6d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda6d('0x9'));var crypto=require('crypto');var jsforce=require(_0xda6d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xda6d('0x7'));var querystring=require(_0xda6d('0xb'));var Papa=require(_0xda6d('0xc'));var Redis=require(_0xda6d('0xd'));var authService=require(_0xda6d('0xe'));var qs=require(_0xda6d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda6d('0x10'));var logger=require(_0xda6d('0x11'))(_0xda6d('0x12'));var utils=require(_0xda6d('0x13'));var config=require(_0xda6d('0x14'));var licenseUtil=require(_0xda6d('0x15'));var db=require(_0xda6d('0x16'))['db'];function respondWithStatusCode(_0x3b6e6b,_0x4538ed){_0x4538ed=_0x4538ed||0xcc;return function(_0x46f3ef){if(_0x46f3ef){return _0x3b6e6b[_0xda6d('0x17')](_0x4538ed);}return _0x3b6e6b[_0xda6d('0x18')](_0x4538ed)[_0xda6d('0x19')]();};}function respondWithResult(_0x41c01e,_0x35d379){_0x35d379=_0x35d379||0xc8;return function(_0x47479b){if(_0x47479b){return _0x41c01e[_0xda6d('0x18')](_0x35d379)[_0xda6d('0x1a')](_0x47479b);}};}function respondWithFilteredResult(_0x240ad3,_0x4fafa0){return function(_0x3b39b7){if(_0x3b39b7){var _0xbc3bb=typeof _0x4fafa0['offset']==='undefined'&&typeof _0x4fafa0['limit']===_0xda6d('0x1b');var _0x338e0e=_0x3b39b7[_0xda6d('0x1c')];var _0x5e884a=_0xbc3bb?0x0:_0x4fafa0['offset'];var _0x1c7145=_0xbc3bb?_0x3b39b7[_0xda6d('0x1c')]:_0x4fafa0[_0xda6d('0x1d')]+_0x4fafa0[_0xda6d('0x1e')];var _0x4c7f9a;if(_0x1c7145>=_0x338e0e){_0x1c7145=_0x338e0e;_0x4c7f9a=0xc8;}else{_0x4c7f9a=0xce;}_0x240ad3[_0xda6d('0x18')](_0x4c7f9a);return _0x240ad3[_0xda6d('0x1f')](_0xda6d('0x20'),_0x5e884a+'-'+_0x1c7145+'/'+_0x338e0e)[_0xda6d('0x1a')](_0x3b39b7);}return null;};}function patchUpdates(_0x45b50c){return function(_0x3d76c5){try{jsonpatch['apply'](_0x3d76c5,_0x45b50c,!![]);}catch(_0x152a2b){return BPromise[_0xda6d('0x21')](_0x152a2b);}return _0x3d76c5[_0xda6d('0x22')]();};}function saveUpdates(_0x47984d,_0x223418){return function(_0x2a941f){if(_0x2a941f){return _0x2a941f[_0xda6d('0x23')](_0x47984d)[_0xda6d('0x24')](function(_0x35072e){return _0x35072e;});}return null;};}function removeEntity(_0x552682,_0x381f8e){return function(_0x1c83a7){if(_0x1c83a7){return _0x1c83a7['destroy']()[_0xda6d('0x24')](function(){_0x552682[_0xda6d('0x18')](0xcc)[_0xda6d('0x19')]();});}};}function handleEntityNotFound(_0xcf138f,_0x2083f0){return function(_0x41b7d8){if(!_0x41b7d8){_0xcf138f[_0xda6d('0x17')](0x194);}return _0x41b7d8;};}function handleError(_0x37b433,_0x5690a5){_0x5690a5=_0x5690a5||0x1f4;return function(_0x523624){logger[_0xda6d('0x25')](_0x523624[_0xda6d('0x26')]);if(_0x523624['name']){delete _0x523624[_0xda6d('0x27')];}_0x37b433[_0xda6d('0x18')](_0x5690a5)[_0xda6d('0x28')](_0x523624);};}exports['index']=function(_0x15075d,_0x106218){var _0x539150={},_0x2dbdff={},_0x85356b={'count':0x0,'rows':[]};var _0x4a9fef=_['map'](db['SquareReport'][_0xda6d('0x29')],function(_0x4fe1e9){return{'name':_0x4fe1e9[_0xda6d('0x2a')],'type':_0x4fe1e9[_0xda6d('0x2b')][_0xda6d('0x2c')]};});_0x2dbdff['model']=_[_0xda6d('0x2d')](_0x4a9fef,'name');_0x2dbdff[_0xda6d('0x2e')]=_[_0xda6d('0x2f')](_0x15075d[_0xda6d('0x2e')]);_0x2dbdff[_0xda6d('0x30')]=_[_0xda6d('0x31')](_0x2dbdff[_0xda6d('0x32')],_0x2dbdff[_0xda6d('0x2e')]);_0x539150['attributes']=_[_0xda6d('0x31')](_0x2dbdff['model'],qs[_0xda6d('0x33')](_0x15075d[_0xda6d('0x2e')][_0xda6d('0x33')]));_0x539150[_0xda6d('0x34')]=_0x539150[_0xda6d('0x34')][_0xda6d('0x35')]?_0x539150[_0xda6d('0x34')]:_0x2dbdff['model'];if(!_0x15075d[_0xda6d('0x2e')][_0xda6d('0x36')](_0xda6d('0x37'))){_0x539150[_0xda6d('0x1e')]=qs[_0xda6d('0x1e')](_0x15075d[_0xda6d('0x2e')][_0xda6d('0x1e')]);_0x539150[_0xda6d('0x1d')]=qs['offset'](_0x15075d[_0xda6d('0x2e')][_0xda6d('0x1d')]);}_0x539150['order']=qs[_0xda6d('0x38')](_0x15075d[_0xda6d('0x2e')][_0xda6d('0x38')]);_0x539150[_0xda6d('0x39')]=qs['filters'](_[_0xda6d('0x3a')](_0x15075d['query'],_0x2dbdff['filters']),_0x4a9fef);if(_0x15075d[_0xda6d('0x2e')][_0xda6d('0x3b')]){_0x539150['where']=_[_0xda6d('0x3c')](_0x539150[_0xda6d('0x39')],{'$or':_[_0xda6d('0x2d')](_0x4a9fef,function(_0x132e81){if(_0x132e81['type']!==_0xda6d('0x3d')){var _0x3223b9={};_0x3223b9[_0x132e81[_0xda6d('0x27')]]={'$like':'%'+_0x15075d[_0xda6d('0x2e')][_0xda6d('0x3b')]+'%'};return _0x3223b9;}})});}_0x539150=_[_0xda6d('0x3c')]({},_0x539150,_0x15075d[_0xda6d('0x3e')]);var _0x38a05b={'where':_0x539150[_0xda6d('0x39')]};return db['SquareReport'][_0xda6d('0x1c')](_0x38a05b)['then'](function(_0xbc34cd){_0x85356b[_0xda6d('0x1c')]=_0xbc34cd;if(_0x15075d[_0xda6d('0x2e')][_0xda6d('0x3f')]){_0x539150[_0xda6d('0x40')]=[{'all':!![]}];}return db[_0xda6d('0x41')][_0xda6d('0x42')](_0x539150);})['then'](function(_0x1628b4){_0x85356b[_0xda6d('0x43')]=_0x1628b4;return _0x85356b;})[_0xda6d('0x24')](respondWithFilteredResult(_0x106218,_0x539150))[_0xda6d('0x44')](handleError(_0x106218,null));};exports['show']=function(_0x187227,_0x265fca){var _0x2eb1f7={'raw':!![],'where':{'id':_0x187227[_0xda6d('0x45')]['id']}},_0x56994d={};_0x56994d[_0xda6d('0x32')]=_[_0xda6d('0x2f')](db[_0xda6d('0x41')][_0xda6d('0x29')]);_0x56994d[_0xda6d('0x2e')]=_['keys'](_0x187227['query']);_0x56994d['filters']=_['intersection'](_0x56994d[_0xda6d('0x32')],_0x56994d['query']);_0x2eb1f7[_0xda6d('0x34')]=_[_0xda6d('0x31')](_0x56994d['model'],qs[_0xda6d('0x33')](_0x187227['query'][_0xda6d('0x33')]));_0x2eb1f7[_0xda6d('0x34')]=_0x2eb1f7[_0xda6d('0x34')]['length']?_0x2eb1f7['attributes']:_0x56994d[_0xda6d('0x32')];if(_0x187227[_0xda6d('0x2e')]['includeAll']){_0x2eb1f7[_0xda6d('0x40')]=[{'all':!![]}];}_0x2eb1f7=_[_0xda6d('0x3c')]({},_0x2eb1f7,_0x187227[_0xda6d('0x3e')]);return db[_0xda6d('0x41')][_0xda6d('0x46')](_0x2eb1f7)[_0xda6d('0x24')](handleEntityNotFound(_0x265fca,null))[_0xda6d('0x24')](respondWithResult(_0x265fca,null))['catch'](handleError(_0x265fca,null));};exports['create']=function(_0x1c3f3c,_0x401850){return db[_0xda6d('0x41')]['create'](_0x1c3f3c[_0xda6d('0x47')],{})[_0xda6d('0x24')](respondWithResult(_0x401850,0xc9))[_0xda6d('0x44')](handleError(_0x401850,null));};exports['update']=function(_0x2c7479,_0x1e63db){if(_0x2c7479[_0xda6d('0x47')]['id']){delete _0x2c7479[_0xda6d('0x47')]['id'];}return db[_0xda6d('0x41')][_0xda6d('0x46')]({'where':{'id':_0x2c7479[_0xda6d('0x45')]['id']}})[_0xda6d('0x24')](handleEntityNotFound(_0x1e63db,null))[_0xda6d('0x24')](saveUpdates(_0x2c7479['body'],null))[_0xda6d('0x24')](respondWithResult(_0x1e63db,null))[_0xda6d('0x44')](handleError(_0x1e63db,null));};exports[_0xda6d('0x48')]=function(_0x40acd2,_0x1a16e6){return db['SquareReport'][_0xda6d('0x46')]({'where':{'id':_0x40acd2[_0xda6d('0x45')]['id']}})[_0xda6d('0x24')](handleEntityNotFound(_0x1a16e6,null))[_0xda6d('0x24')](removeEntity(_0x1a16e6,null))[_0xda6d('0x44')](handleError(_0x1a16e6,null));};exports['describe']=function(_0x1dc09,_0x294272){return db['SquareReport']['describe']()['then'](respondWithResult(_0x294272,null))[_0xda6d('0x44')](handleError(_0x294272,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a486255..8c79455 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 _0x6c9a=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','leaveAt','lodash','util','../../config/logger','api'];(function(_0x563403,_0x49dd9a){var _0x5a86a4=function(_0x52e790){while(--_0x52e790){_0x563403['push'](_0x563403['shift']());}};_0x5a86a4(++_0x49dd9a);}(_0x6c9a,0xa1));var _0xa6c9=function(_0x3ec079,_0x518c91){_0x3ec079=_0x3ec079-0x0;var _0x3e509b=_0x6c9a[_0x3ec079];return _0x3e509b;};'use strict';var _=require(_0xa6c9('0x0'));var util=require(_0xa6c9('0x1'));var logger=require(_0xa6c9('0x2'))(_0xa6c9('0x3'));var moment=require('moment');var BPromise=require(_0xa6c9('0x4'));var rp=require(_0xa6c9('0x5'));var fs=require('fs');var path=require(_0xa6c9('0x6'));var rimraf=require(_0xa6c9('0x7'));var config=require(_0xa6c9('0x8'));var attributes=require(_0xa6c9('0x9'));module[_0xa6c9('0xa')]=function(_0x39bdb8,_0x4c2437){return _0x39bdb8['define'](_0xa6c9('0xb'),attributes,{'tableName':_0xa6c9('0xc'),'paranoid':![],'indexes':[{'name':_0xa6c9('0xd'),'fields':['uniqueid','project_name']},{'name':_0xa6c9('0xe'),'fields':[_0xa6c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07b8=['leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','uid_pname','uniqueid','project_name'];(function(_0x52f0db,_0x379d31){var _0x24f665=function(_0x13ecef){while(--_0x13ecef){_0x52f0db['push'](_0x52f0db['shift']());}};_0x24f665(++_0x379d31);}(_0x07b8,0x1e1));var _0x807b=function(_0x2b5c18,_0x428809){_0x2b5c18=_0x2b5c18-0x0;var _0x417168=_0x07b8[_0x2b5c18];return _0x417168;};'use strict';var _=require(_0x807b('0x0'));var util=require(_0x807b('0x1'));var logger=require(_0x807b('0x2'))(_0x807b('0x3'));var moment=require(_0x807b('0x4'));var BPromise=require('bluebird');var rp=require(_0x807b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807b('0x6'));var config=require(_0x807b('0x7'));var attributes=require(_0x807b('0x8'));module['exports']=function(_0x1f16c7,_0x43284d){return _0x1f16c7[_0x807b('0x9')](_0x807b('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x807b('0xb'),'fields':[_0x807b('0xc'),_0x807b('0xd')]},{'name':'leaveAt','fields':[_0x807b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 48327de..8d171a4 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 _0x593b=['create','body','options','raw','debug','stringify','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport'];(function(_0x502e26,_0x24b4b6){var _0x43b768=function(_0xb6079d){while(--_0xb6079d){_0x502e26['push'](_0x502e26['shift']());}};_0x43b768(++_0x24b4b6);}(_0x593b,0xba));var _0xb593=function(_0x4632d3,_0x35f57a){_0x4632d3=_0x4632d3-0x0;var _0x1bd627=_0x593b[_0x4632d3];return _0x1bd627;};'use strict';var _=require(_0xb593('0x0'));var util=require(_0xb593('0x1'));var moment=require(_0xb593('0x2'));var BPromise=require(_0xb593('0x3'));var rs=require(_0xb593('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb593('0x5'))['db'];var utils=require(_0xb593('0x6'));var logger=require(_0xb593('0x7'))('rpc');var config=require(_0xb593('0x8'));var jayson=require(_0xb593('0x9'));var client=jayson['client'][_0xb593('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x831ba8,_0x4881d2,_0x1e17af){return new BPromise(function(_0x415eef,_0x1d31ef){return client[_0xb593('0xb')](_0x831ba8,_0x1e17af)[_0xb593('0xc')](function(_0x249a05){logger[_0xb593('0xd')]('SquareReport,\x20%s,\x20%s',_0x4881d2,_0xb593('0xe'));logger['debug'](_0xb593('0xf'),_0x4881d2,_0xb593('0xe'),JSON['stringify'](_0x249a05));if(_0x249a05[_0xb593('0x10')]){if(_0x249a05['error'][_0xb593('0x11')]===0x1f4){logger[_0xb593('0x10')](_0xb593('0x12'),_0x4881d2,_0x249a05[_0xb593('0x10')][_0xb593('0x13')]);return _0x1d31ef(_0x249a05[_0xb593('0x10')]['message']);}logger[_0xb593('0x10')](_0xb593('0x12'),_0x4881d2,_0x249a05[_0xb593('0x10')]['message']);return _0x415eef(_0x249a05[_0xb593('0x10')]['message']);}else{logger[_0xb593('0xd')]('SquareReport,\x20%s,\x20%s',_0x4881d2,_0xb593('0xe'));_0x415eef(_0x249a05[_0xb593('0x14')][_0xb593('0x13')]);}})[_0xb593('0x15')](function(_0x4b31dd){logger[_0xb593('0x10')](_0xb593('0x12'),_0x4881d2,_0x4b31dd);_0x1d31ef(_0x4b31dd);});});}exports[_0xb593('0x16')]=function(_0x1c0389){var _0xd65840=this;return new Promise(function(_0x5abbf3,_0x3914b6){return db[_0xb593('0x17')][_0xb593('0x18')](_0x1c0389[_0xb593('0x19')],{'raw':_0x1c0389[_0xb593('0x1a')]?_0x1c0389[_0xb593('0x1a')][_0xb593('0x1b')]===undefined?!![]:![]:!![]})[_0xb593('0xc')](function(_0x3aede5){logger[_0xb593('0xd')]('CreateSquareReport',_0x1c0389);logger[_0xb593('0x1c')](_0xb593('0x16'),_0x1c0389,JSON[_0xb593('0x1d')](_0x3aede5));_0x5abbf3(_0x3aede5);})[_0xb593('0x15')](function(_0x273390){logger['error']('CreateSquareReport',_0x273390[_0xb593('0x13')],_0x1c0389);_0x3914b6(_0xd65840[_0xb593('0x10')](0x1f4,_0x273390[_0xb593('0x13')]));});});};exports[_0xb593('0x1e')]=function(_0x13cb1f){var _0x23499c=this;return new Promise(function(_0x264b45,_0x4de22b){return db[_0xb593('0x17')][_0xb593('0x1f')](_0x13cb1f[_0xb593('0x19')],{'raw':_0x13cb1f['options']?_0x13cb1f[_0xb593('0x1a')][_0xb593('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13cb1f[_0xb593('0x1a')]?_0x13cb1f[_0xb593('0x1a')][_0xb593('0x20')]||null:null,'attributes':_0x13cb1f[_0xb593('0x1a')]?_0x13cb1f[_0xb593('0x1a')][_0xb593('0x21')]||null:null,'limit':_0x13cb1f['options']?_0x13cb1f[_0xb593('0x1a')][_0xb593('0x22')]||null:null})[_0xb593('0xc')](function(_0x1157e2){logger[_0xb593('0xd')](_0xb593('0x1e'),_0x13cb1f);logger[_0xb593('0x1c')](_0xb593('0x1e'),_0x13cb1f,JSON[_0xb593('0x1d')](_0x1157e2));_0x264b45(_0x1157e2);})[_0xb593('0x15')](function(_0x105818){logger['error']('UpdateSquareReport',_0x105818[_0xb593('0x13')],_0x13cb1f);_0x4de22b(_0x23499c[_0xb593('0x10')](0x1f4,_0x105818[_0xb593('0x13')]));});});}; \ No newline at end of file +var _0xddf4=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','raw','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','limit'];(function(_0x3f73ec,_0x522a4a){var _0xc4a02a=function(_0x38ffd6){while(--_0x38ffd6){_0x3f73ec['push'](_0x3f73ec['shift']());}};_0xc4a02a(++_0x522a4a);}(_0xddf4,0xc0));var _0x4ddf=function(_0x138a4a,_0x21e3b6){_0x138a4a=_0x138a4a-0x0;var _0x18d2ec=_0xddf4[_0x138a4a];return _0x18d2ec;};'use strict';var _=require(_0x4ddf('0x0'));var util=require('util');var moment=require(_0x4ddf('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ddf('0x2'));var fs=require('fs');var Redis=require(_0x4ddf('0x3'));var db=require(_0x4ddf('0x4'))['db'];var utils=require(_0x4ddf('0x5'));var logger=require(_0x4ddf('0x6'))(_0x4ddf('0x7'));var config=require(_0x4ddf('0x8'));var jayson=require(_0x4ddf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4ade,_0x141685,_0x14f514){return new BPromise(function(_0x4dfc52,_0xbab1fa){return client[_0x4ddf('0xa')](_0x3c4ade,_0x14f514)[_0x4ddf('0xb')](function(_0x458bf9){logger[_0x4ddf('0xc')](_0x4ddf('0xd'),_0x141685,_0x4ddf('0xe'));logger[_0x4ddf('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x141685,_0x4ddf('0xe'),JSON['stringify'](_0x458bf9));if(_0x458bf9['error']){if(_0x458bf9[_0x4ddf('0x10')][_0x4ddf('0x11')]===0x1f4){logger[_0x4ddf('0x10')](_0x4ddf('0xd'),_0x141685,_0x458bf9[_0x4ddf('0x10')][_0x4ddf('0x12')]);return _0xbab1fa(_0x458bf9[_0x4ddf('0x10')]['message']);}logger[_0x4ddf('0x10')](_0x4ddf('0xd'),_0x141685,_0x458bf9[_0x4ddf('0x10')]['message']);return _0x4dfc52(_0x458bf9[_0x4ddf('0x10')][_0x4ddf('0x12')]);}else{logger[_0x4ddf('0xc')]('SquareReport,\x20%s,\x20%s',_0x141685,'request\x20sent');_0x4dfc52(_0x458bf9[_0x4ddf('0x13')][_0x4ddf('0x12')]);}})[_0x4ddf('0x14')](function(_0x192754){logger['error'](_0x4ddf('0xd'),_0x141685,_0x192754);_0xbab1fa(_0x192754);});});}exports['CreateSquareReport']=function(_0x1af413){var _0x2e543a=this;return new Promise(function(_0x52b735,_0x14e977){return db['SquareReport'][_0x4ddf('0x15')](_0x1af413[_0x4ddf('0x16')],{'raw':_0x1af413[_0x4ddf('0x17')]?_0x1af413[_0x4ddf('0x17')][_0x4ddf('0x18')]===undefined?!![]:![]:!![]})[_0x4ddf('0xb')](function(_0x5c0b5f){logger[_0x4ddf('0xc')](_0x4ddf('0x19'),_0x1af413);logger['debug']('CreateSquareReport',_0x1af413,JSON[_0x4ddf('0x1a')](_0x5c0b5f));_0x52b735(_0x5c0b5f);})['catch'](function(_0x3f824f){logger['error'](_0x4ddf('0x19'),_0x3f824f[_0x4ddf('0x12')],_0x1af413);_0x14e977(_0x2e543a[_0x4ddf('0x10')](0x1f4,_0x3f824f[_0x4ddf('0x12')]));});});};exports[_0x4ddf('0x1b')]=function(_0x5b580a){var _0x9d50f9=this;return new Promise(function(_0x364401,_0x2f1221){return db['SquareReport'][_0x4ddf('0x1c')](_0x5b580a[_0x4ddf('0x16')],{'raw':_0x5b580a[_0x4ddf('0x17')]?_0x5b580a[_0x4ddf('0x17')][_0x4ddf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b580a[_0x4ddf('0x17')]?_0x5b580a[_0x4ddf('0x17')][_0x4ddf('0x1d')]||null:null,'attributes':_0x5b580a[_0x4ddf('0x17')]?_0x5b580a['options'][_0x4ddf('0x1e')]||null:null,'limit':_0x5b580a[_0x4ddf('0x17')]?_0x5b580a[_0x4ddf('0x17')][_0x4ddf('0x1f')]||null:null})[_0x4ddf('0xb')](function(_0xc7d9cf){logger[_0x4ddf('0xc')](_0x4ddf('0x1b'),_0x5b580a);logger['debug'](_0x4ddf('0x1b'),_0x5b580a,JSON[_0x4ddf('0x1a')](_0xc7d9cf));_0x364401(_0xc7d9cf);})[_0x4ddf('0x14')](function(_0x463b61){logger[_0x4ddf('0x10')]('UpdateSquareReport',_0x463b61[_0x4ddf('0x12')],_0x5b580a);_0x2f1221(_0x9d50f9[_0x4ddf('0x10')](0x1f4,_0x463b61[_0x4ddf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d6ddfb1..d5c83c8 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 _0x2d7a=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','describe','get','/:id','create','put','update','delete','destroy','exports'];(function(_0x131602,_0x36c825){var _0x3521b2=function(_0x375f47){while(--_0x375f47){_0x131602['push'](_0x131602['shift']());}};_0x3521b2(++_0x36c825);}(_0x2d7a,0xd2));var _0xa2d7=function(_0x25b6a6,_0x2dd1ce){_0x25b6a6=_0x25b6a6-0x0;var _0x3e0d14=_0x2d7a[_0x25b6a6];return _0x3e0d14;};'use strict';var multer=require(_0xa2d7('0x0'));var util=require(_0xa2d7('0x1'));var path=require(_0xa2d7('0x2'));var timeout=require(_0xa2d7('0x3'));var express=require(_0xa2d7('0x4'));var router=express[_0xa2d7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa2d7('0x6'));var config=require(_0xa2d7('0x7'));var controller=require(_0xa2d7('0x8'));router['get']('/',auth[_0xa2d7('0x9')](),controller[_0xa2d7('0xa')]);router['get'](_0xa2d7('0xb'),auth[_0xa2d7('0x9')](),controller[_0xa2d7('0xc')]);router[_0xa2d7('0xd')](_0xa2d7('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa2d7('0x9')](),controller[_0xa2d7('0xf')]);router[_0xa2d7('0x10')](_0xa2d7('0xe'),auth[_0xa2d7('0x9')](),controller[_0xa2d7('0x11')]);router[_0xa2d7('0x12')]('/:id',auth[_0xa2d7('0x9')](),controller[_0xa2d7('0x13')]);module[_0xa2d7('0x14')]=router; \ No newline at end of file +var _0xf19b=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x4bf162,_0x4d104c){var _0xb413de=function(_0x407e93){while(--_0x407e93){_0x4bf162['push'](_0x4bf162['shift']());}};_0xb413de(++_0x4d104c);}(_0xf19b,0xe5));var _0xbf19=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf19b[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xbf19('0x0'));var util=require(_0xbf19('0x1'));var path=require('path');var timeout=require(_0xbf19('0x2'));var express=require(_0xbf19('0x3'));var router=express[_0xbf19('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf19('0x5'));var interaction=require(_0xbf19('0x6'));var config=require(_0xbf19('0x7'));var controller=require(_0xbf19('0x8'));router[_0xbf19('0x9')]('/',auth[_0xbf19('0xa')](),controller[_0xbf19('0xb')]);router[_0xbf19('0x9')](_0xbf19('0xc'),auth[_0xbf19('0xa')](),controller[_0xbf19('0xd')]);router[_0xbf19('0x9')](_0xbf19('0xe'),auth[_0xbf19('0xa')](),controller[_0xbf19('0xf')]);router['post']('/',auth[_0xbf19('0xa')](),controller[_0xbf19('0x10')]);router[_0xbf19('0x11')](_0xbf19('0xe'),auth['isAuthenticated'](),controller[_0xbf19('0x12')]);router[_0xbf19('0x13')]('/:id',auth[_0xbf19('0xa')](),controller[_0xbf19('0x14')]);module[_0xbf19('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 30caa91..6568439 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 _0xea1c=['TEXT','sequelize','exports','STRING'];(function(_0x19d514,_0x17e234){var _0x2c1bc9=function(_0x38b4f3){while(--_0x38b4f3){_0x19d514['push'](_0x19d514['shift']());}};_0x2c1bc9(++_0x17e234);}(_0xea1c,0xb1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcea1('0x0'));module[_0xcea1('0x1')]={'uniqueid':{'type':Sequelize[_0xcea1('0x2')]},'node':{'type':Sequelize[_0xcea1('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xcea1('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcea1('0x2')]}}; \ No newline at end of file +var _0x151a=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x151a,0x12f));var _0xa151=function(_0xf35672,_0x3833af){_0xf35672=_0xf35672-0x0;var _0x26afcf=_0x151a[_0xf35672];return _0x26afcf;};'use strict';var Sequelize=require(_0xa151('0x0'));module[_0xa151('0x1')]={'uniqueid':{'type':Sequelize[_0xa151('0x2')]},'node':{'type':Sequelize[_0xa151('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xa151('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa151('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d5c630a..aea32f6 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 _0xa11f=['filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','name','index','map','SquareDetailsReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x330788,_0x57a6d2){var _0x549769=function(_0x40991b){while(--_0x40991b){_0x330788['push'](_0x330788['shift']());}};_0x549769(++_0x57a6d2);}(_0xa11f,0xe7));var _0xfa11=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xa11f[_0x1bc013];return _0x55df36;};'use strict';var emlformat=require(_0xfa11('0x0'));var rimraf=require(_0xfa11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa11('0x2'));var Mustache=require('mustache');var util=require(_0xfa11('0x3'));var path=require(_0xfa11('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa11('0x5'));var fs=require('fs');var fs_extra=require(_0xfa11('0x6'));var _=require(_0xfa11('0x7'));var squel=require(_0xfa11('0x8'));var crypto=require(_0xfa11('0x9'));var jsforce=require(_0xfa11('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfa11('0xb'));var Papa=require(_0xfa11('0xc'));var Redis=require(_0xfa11('0xd'));var authService=require(_0xfa11('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfa11('0xf'));var hardwareService=require(_0xfa11('0x10'));var logger=require('../../config/logger')(_0xfa11('0x11'));var utils=require('../../config/utils');var config=require(_0xfa11('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa11('0x13'))['db'];function respondWithStatusCode(_0xd08484,_0x4b9a3c){_0x4b9a3c=_0x4b9a3c||0xcc;return function(_0x3afa2f){if(_0x3afa2f){return _0xd08484['sendStatus'](_0x4b9a3c);}return _0xd08484[_0xfa11('0x14')](_0x4b9a3c)[_0xfa11('0x15')]();};}function respondWithResult(_0x24b840,_0x5759aa){_0x5759aa=_0x5759aa||0xc8;return function(_0x402123){if(_0x402123){return _0x24b840[_0xfa11('0x14')](_0x5759aa)[_0xfa11('0x16')](_0x402123);}};}function respondWithFilteredResult(_0x40aaa2,_0x13baf7){return function(_0x2c9393){if(_0x2c9393){var _0x351d74=typeof _0x13baf7[_0xfa11('0x17')]===_0xfa11('0x18')&&typeof _0x13baf7[_0xfa11('0x19')]===_0xfa11('0x18');var _0x2ce1a0=_0x2c9393[_0xfa11('0x1a')];var _0xcfc916=_0x351d74?0x0:_0x13baf7[_0xfa11('0x17')];var _0x48d279=_0x351d74?_0x2c9393[_0xfa11('0x1a')]:_0x13baf7[_0xfa11('0x17')]+_0x13baf7[_0xfa11('0x19')];var _0x100ae1;if(_0x48d279>=_0x2ce1a0){_0x48d279=_0x2ce1a0;_0x100ae1=0xc8;}else{_0x100ae1=0xce;}_0x40aaa2[_0xfa11('0x14')](_0x100ae1);return _0x40aaa2[_0xfa11('0x1b')](_0xfa11('0x1c'),_0xcfc916+'-'+_0x48d279+'/'+_0x2ce1a0)[_0xfa11('0x16')](_0x2c9393);}return null;};}function patchUpdates(_0x24cce1){return function(_0x1d6d83){try{jsonpatch[_0xfa11('0x1d')](_0x1d6d83,_0x24cce1,!![]);}catch(_0xa80158){return BPromise[_0xfa11('0x1e')](_0xa80158);}return _0x1d6d83[_0xfa11('0x1f')]();};}function saveUpdates(_0x3c133f,_0x5043a9){return function(_0x1bc6c6){if(_0x1bc6c6){return _0x1bc6c6[_0xfa11('0x20')](_0x3c133f)['then'](function(_0x49fd2a){return _0x49fd2a;});}return null;};}function removeEntity(_0x31c7b4,_0x3eac26){return function(_0x4f99b8){if(_0x4f99b8){return _0x4f99b8['destroy']()['then'](function(){_0x31c7b4[_0xfa11('0x14')](0xcc)[_0xfa11('0x15')]();});}};}function handleEntityNotFound(_0x51df96,_0x2e845b){return function(_0x54f07a){if(!_0x54f07a){_0x51df96['sendStatus'](0x194);}return _0x54f07a;};}function handleError(_0x910b4e,_0x41f219){_0x41f219=_0x41f219||0x1f4;return function(_0x5c8bdd){logger[_0xfa11('0x21')](_0x5c8bdd['stack']);if(_0x5c8bdd[_0xfa11('0x22')]){delete _0x5c8bdd['name'];}_0x910b4e[_0xfa11('0x14')](_0x41f219)['send'](_0x5c8bdd);};}exports[_0xfa11('0x23')]=function(_0xf35143,_0x276c89){var _0x375449={},_0x59ce8d={},_0xf940b4={'count':0x0,'rows':[]};var _0x41deea=_[_0xfa11('0x24')](db[_0xfa11('0x25')]['rawAttributes'],function(_0x4d4807){return{'name':_0x4d4807[_0xfa11('0x26')],'type':_0x4d4807['type'][_0xfa11('0x27')]};});_0x59ce8d[_0xfa11('0x28')]=_['map'](_0x41deea,_0xfa11('0x22'));_0x59ce8d['query']=_[_0xfa11('0x29')](_0xf35143[_0xfa11('0x2a')]);_0x59ce8d[_0xfa11('0x2b')]=_[_0xfa11('0x2c')](_0x59ce8d[_0xfa11('0x28')],_0x59ce8d[_0xfa11('0x2a')]);_0x375449[_0xfa11('0x2d')]=_[_0xfa11('0x2c')](_0x59ce8d[_0xfa11('0x28')],qs['fields'](_0xf35143[_0xfa11('0x2a')][_0xfa11('0x2e')]));_0x375449[_0xfa11('0x2d')]=_0x375449['attributes'][_0xfa11('0x2f')]?_0x375449[_0xfa11('0x2d')]:_0x59ce8d[_0xfa11('0x28')];if(!_0xf35143[_0xfa11('0x2a')][_0xfa11('0x30')]('nolimit')){_0x375449[_0xfa11('0x19')]=qs[_0xfa11('0x19')](_0xf35143[_0xfa11('0x2a')]['limit']);_0x375449[_0xfa11('0x17')]=qs['offset'](_0xf35143[_0xfa11('0x2a')]['offset']);}_0x375449[_0xfa11('0x31')]=qs[_0xfa11('0x32')](_0xf35143[_0xfa11('0x2a')][_0xfa11('0x32')]);_0x375449[_0xfa11('0x33')]=qs[_0xfa11('0x2b')](_[_0xfa11('0x34')](_0xf35143[_0xfa11('0x2a')],_0x59ce8d[_0xfa11('0x2b')]),_0x41deea);if(_0xf35143[_0xfa11('0x2a')][_0xfa11('0x35')]){_0x375449[_0xfa11('0x33')]=_[_0xfa11('0x36')](_0x375449['where'],{'$or':_['map'](_0x41deea,function(_0x2e9cc2){if(_0x2e9cc2[_0xfa11('0x37')]!==_0xfa11('0x38')){var _0x55ac8f={};_0x55ac8f[_0x2e9cc2['name']]={'$like':'%'+_0xf35143[_0xfa11('0x2a')][_0xfa11('0x35')]+'%'};return _0x55ac8f;}})});}_0x375449=_[_0xfa11('0x36')]({},_0x375449,_0xf35143[_0xfa11('0x39')]);var _0x3d42ae={'where':_0x375449['where']};return db[_0xfa11('0x25')][_0xfa11('0x1a')](_0x3d42ae)[_0xfa11('0x3a')](function(_0x186877){_0xf940b4['count']=_0x186877;if(_0xf35143[_0xfa11('0x2a')][_0xfa11('0x3b')]){_0x375449[_0xfa11('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xfa11('0x3d')](_0x375449);})['then'](function(_0x390026){_0xf940b4['rows']=_0x390026;return _0xf940b4;})[_0xfa11('0x3a')](respondWithFilteredResult(_0x276c89,_0x375449))[_0xfa11('0x3e')](handleError(_0x276c89,null));};exports[_0xfa11('0x3f')]=function(_0x4756bd,_0x4b4650){var _0x5f36a2={'raw':!![],'where':{'id':_0x4756bd[_0xfa11('0x40')]['id']}},_0x295869={};_0x295869['model']=_[_0xfa11('0x29')](db[_0xfa11('0x25')][_0xfa11('0x41')]);_0x295869[_0xfa11('0x2a')]=_['keys'](_0x4756bd[_0xfa11('0x2a')]);_0x295869['filters']=_[_0xfa11('0x2c')](_0x295869['model'],_0x295869['query']);_0x5f36a2['attributes']=_['intersection'](_0x295869[_0xfa11('0x28')],qs[_0xfa11('0x2e')](_0x4756bd[_0xfa11('0x2a')][_0xfa11('0x2e')]));_0x5f36a2[_0xfa11('0x2d')]=_0x5f36a2['attributes'][_0xfa11('0x2f')]?_0x5f36a2['attributes']:_0x295869[_0xfa11('0x28')];if(_0x4756bd['query']['includeAll']){_0x5f36a2[_0xfa11('0x3c')]=[{'all':!![]}];}_0x5f36a2=_[_0xfa11('0x36')]({},_0x5f36a2,_0x4756bd[_0xfa11('0x39')]);return db['SquareDetailsReport'][_0xfa11('0x42')](_0x5f36a2)[_0xfa11('0x3a')](handleEntityNotFound(_0x4b4650,null))['then'](respondWithResult(_0x4b4650,null))['catch'](handleError(_0x4b4650,null));};exports[_0xfa11('0x43')]=function(_0x2e9fd5,_0x507507){return db[_0xfa11('0x25')][_0xfa11('0x43')](_0x2e9fd5[_0xfa11('0x44')],{})[_0xfa11('0x3a')](respondWithResult(_0x507507,0xc9))[_0xfa11('0x3e')](handleError(_0x507507,null));};exports['update']=function(_0x27911e,_0x193336){if(_0x27911e[_0xfa11('0x44')]['id']){delete _0x27911e[_0xfa11('0x44')]['id'];}return db[_0xfa11('0x25')]['find']({'where':{'id':_0x27911e['params']['id']}})[_0xfa11('0x3a')](handleEntityNotFound(_0x193336,null))['then'](saveUpdates(_0x27911e[_0xfa11('0x44')],null))['then'](respondWithResult(_0x193336,null))[_0xfa11('0x3e')](handleError(_0x193336,null));};exports[_0xfa11('0x45')]=function(_0x33978a,_0x2d75e1){return db[_0xfa11('0x25')][_0xfa11('0x42')]({'where':{'id':_0x33978a[_0xfa11('0x40')]['id']}})[_0xfa11('0x3a')](handleEntityNotFound(_0x2d75e1,null))[_0xfa11('0x3a')](removeEntity(_0x2d75e1,null))['catch'](handleError(_0x2d75e1,null));};exports[_0xfa11('0x46')]=function(_0x9f6bdc,_0x4a8ad4){return db[_0xfa11('0x25')]['describe']()[_0xfa11('0x3a')](respondWithResult(_0x4a8ad4,null))['catch'](handleError(_0x4a8ad4,null));}; \ No newline at end of file +var _0x8651=['params','intersection','include','merge','options','find','create','body','update','describe','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','findAll','rows','catch','show'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x8651,0xa6));var _0x1865=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x8651[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1865('0x0'));var zipdir=require(_0x1865('0x1'));var jsonpatch=require(_0x1865('0x2'));var rp=require(_0x1865('0x3'));var moment=require(_0x1865('0x4'));var BPromise=require(_0x1865('0x5'));var Mustache=require('mustache');var util=require(_0x1865('0x6'));var path=require(_0x1865('0x7'));var sox=require(_0x1865('0x8'));var csv=require(_0x1865('0x9'));var ejs=require(_0x1865('0xa'));var fs=require('fs');var fs_extra=require(_0x1865('0xb'));var _=require(_0x1865('0xc'));var squel=require(_0x1865('0xd'));var crypto=require(_0x1865('0xe'));var jsforce=require(_0x1865('0xf'));var deskjs=require(_0x1865('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1865('0x11'));var Papa=require(_0x1865('0x12'));var Redis=require(_0x1865('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1865('0x14'));var as=require(_0x1865('0x15'));var hardwareService=require(_0x1865('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1865('0x17'));var config=require(_0x1865('0x18'));var licenseUtil=require(_0x1865('0x19'));var db=require(_0x1865('0x1a'))['db'];function respondWithStatusCode(_0x490b28,_0xad00ee){_0xad00ee=_0xad00ee||0xcc;return function(_0x4a4872){if(_0x4a4872){return _0x490b28['sendStatus'](_0xad00ee);}return _0x490b28[_0x1865('0x1b')](_0xad00ee)[_0x1865('0x1c')]();};}function respondWithResult(_0x4b566b,_0x4363d6){_0x4363d6=_0x4363d6||0xc8;return function(_0x2fa005){if(_0x2fa005){return _0x4b566b['status'](_0x4363d6)[_0x1865('0x1d')](_0x2fa005);}};}function respondWithFilteredResult(_0x668e8a,_0x554093){return function(_0x383a7d){if(_0x383a7d){var _0x22415c=typeof _0x554093[_0x1865('0x1e')]===_0x1865('0x1f')&&typeof _0x554093['limit']==='undefined';var _0x3223fe=_0x383a7d[_0x1865('0x20')];var _0x2be30c=_0x22415c?0x0:_0x554093[_0x1865('0x1e')];var _0x24ae75=_0x22415c?_0x383a7d['count']:_0x554093['offset']+_0x554093[_0x1865('0x21')];var _0xd2404a;if(_0x24ae75>=_0x3223fe){_0x24ae75=_0x3223fe;_0xd2404a=0xc8;}else{_0xd2404a=0xce;}_0x668e8a['status'](_0xd2404a);return _0x668e8a[_0x1865('0x22')]('Content-Range',_0x2be30c+'-'+_0x24ae75+'/'+_0x3223fe)[_0x1865('0x1d')](_0x383a7d);}return null;};}function patchUpdates(_0x444c8e){return function(_0x232ca3){try{jsonpatch[_0x1865('0x23')](_0x232ca3,_0x444c8e,!![]);}catch(_0x5b042d){return BPromise[_0x1865('0x24')](_0x5b042d);}return _0x232ca3[_0x1865('0x25')]();};}function saveUpdates(_0x1df8c8,_0x15f634){return function(_0x528c16){if(_0x528c16){return _0x528c16['update'](_0x1df8c8)['then'](function(_0x44bb37){return _0x44bb37;});}return null;};}function removeEntity(_0x5a6110,_0xafe43d){return function(_0x51a051){if(_0x51a051){return _0x51a051[_0x1865('0x26')]()[_0x1865('0x27')](function(){_0x5a6110['status'](0xcc)[_0x1865('0x1c')]();});}};}function handleEntityNotFound(_0x227587,_0x10b938){return function(_0x46a64c){if(!_0x46a64c){_0x227587[_0x1865('0x28')](0x194);}return _0x46a64c;};}function handleError(_0x5ce047,_0x183a96){_0x183a96=_0x183a96||0x1f4;return function(_0x4be31d){logger[_0x1865('0x29')](_0x4be31d['stack']);if(_0x4be31d[_0x1865('0x2a')]){delete _0x4be31d[_0x1865('0x2a')];}_0x5ce047[_0x1865('0x1b')](_0x183a96)[_0x1865('0x2b')](_0x4be31d);};}exports['index']=function(_0x4e1531,_0x1b6165){var _0xc29e09={},_0x11aa9f={},_0xce4897={'count':0x0,'rows':[]};var _0x46628a=_[_0x1865('0x2c')](db[_0x1865('0x2d')][_0x1865('0x2e')],function(_0x553dd2){return{'name':_0x553dd2['fieldName'],'type':_0x553dd2[_0x1865('0x2f')][_0x1865('0x30')]};});_0x11aa9f[_0x1865('0x31')]=_[_0x1865('0x2c')](_0x46628a,_0x1865('0x2a'));_0x11aa9f[_0x1865('0x32')]=_[_0x1865('0x33')](_0x4e1531[_0x1865('0x32')]);_0x11aa9f[_0x1865('0x34')]=_['intersection'](_0x11aa9f['model'],_0x11aa9f[_0x1865('0x32')]);_0xc29e09[_0x1865('0x35')]=_['intersection'](_0x11aa9f[_0x1865('0x31')],qs[_0x1865('0x36')](_0x4e1531['query'][_0x1865('0x36')]));_0xc29e09[_0x1865('0x35')]=_0xc29e09[_0x1865('0x35')][_0x1865('0x37')]?_0xc29e09[_0x1865('0x35')]:_0x11aa9f[_0x1865('0x31')];if(!_0x4e1531['query'][_0x1865('0x38')](_0x1865('0x39'))){_0xc29e09[_0x1865('0x21')]=qs[_0x1865('0x21')](_0x4e1531[_0x1865('0x32')][_0x1865('0x21')]);_0xc29e09[_0x1865('0x1e')]=qs[_0x1865('0x1e')](_0x4e1531[_0x1865('0x32')][_0x1865('0x1e')]);}_0xc29e09[_0x1865('0x3a')]=qs['sort'](_0x4e1531[_0x1865('0x32')][_0x1865('0x3b')]);_0xc29e09[_0x1865('0x3c')]=qs[_0x1865('0x34')](_[_0x1865('0x3d')](_0x4e1531[_0x1865('0x32')],_0x11aa9f[_0x1865('0x34')]),_0x46628a);if(_0x4e1531[_0x1865('0x32')]['filter']){_0xc29e09['where']=_['merge'](_0xc29e09['where'],{'$or':_[_0x1865('0x2c')](_0x46628a,function(_0x432c2a){if(_0x432c2a['type']!=='VIRTUAL'){var _0x43ba04={};_0x43ba04[_0x432c2a[_0x1865('0x2a')]]={'$like':'%'+_0x4e1531['query'][_0x1865('0x3e')]+'%'};return _0x43ba04;}})});}_0xc29e09=_['merge']({},_0xc29e09,_0x4e1531['options']);var _0x2926cd={'where':_0xc29e09[_0x1865('0x3c')]};return db[_0x1865('0x2d')][_0x1865('0x20')](_0x2926cd)[_0x1865('0x27')](function(_0x44cfa5){_0xce4897[_0x1865('0x20')]=_0x44cfa5;if(_0x4e1531[_0x1865('0x32')][_0x1865('0x3f')]){_0xc29e09['include']=[{'all':!![]}];}return db[_0x1865('0x2d')][_0x1865('0x40')](_0xc29e09);})[_0x1865('0x27')](function(_0x571277){_0xce4897[_0x1865('0x41')]=_0x571277;return _0xce4897;})[_0x1865('0x27')](respondWithFilteredResult(_0x1b6165,_0xc29e09))[_0x1865('0x42')](handleError(_0x1b6165,null));};exports[_0x1865('0x43')]=function(_0x13022f,_0x25db2b){var _0x5c54fe={'raw':!![],'where':{'id':_0x13022f[_0x1865('0x44')]['id']}},_0x325c0a={};_0x325c0a[_0x1865('0x31')]=_[_0x1865('0x33')](db[_0x1865('0x2d')][_0x1865('0x2e')]);_0x325c0a[_0x1865('0x32')]=_[_0x1865('0x33')](_0x13022f['query']);_0x325c0a[_0x1865('0x34')]=_['intersection'](_0x325c0a[_0x1865('0x31')],_0x325c0a[_0x1865('0x32')]);_0x5c54fe['attributes']=_[_0x1865('0x45')](_0x325c0a[_0x1865('0x31')],qs['fields'](_0x13022f[_0x1865('0x32')][_0x1865('0x36')]));_0x5c54fe[_0x1865('0x35')]=_0x5c54fe[_0x1865('0x35')][_0x1865('0x37')]?_0x5c54fe[_0x1865('0x35')]:_0x325c0a[_0x1865('0x31')];if(_0x13022f[_0x1865('0x32')][_0x1865('0x3f')]){_0x5c54fe[_0x1865('0x46')]=[{'all':!![]}];}_0x5c54fe=_[_0x1865('0x47')]({},_0x5c54fe,_0x13022f[_0x1865('0x48')]);return db[_0x1865('0x2d')][_0x1865('0x49')](_0x5c54fe)[_0x1865('0x27')](handleEntityNotFound(_0x25db2b,null))['then'](respondWithResult(_0x25db2b,null))[_0x1865('0x42')](handleError(_0x25db2b,null));};exports[_0x1865('0x4a')]=function(_0x198160,_0x2885d2){return db['SquareDetailsReport'][_0x1865('0x4a')](_0x198160[_0x1865('0x4b')],{})['then'](respondWithResult(_0x2885d2,0xc9))[_0x1865('0x42')](handleError(_0x2885d2,null));};exports[_0x1865('0x4c')]=function(_0x324d20,_0xb1cd17){if(_0x324d20['body']['id']){delete _0x324d20[_0x1865('0x4b')]['id'];}return db[_0x1865('0x2d')][_0x1865('0x49')]({'where':{'id':_0x324d20[_0x1865('0x44')]['id']}})[_0x1865('0x27')](handleEntityNotFound(_0xb1cd17,null))['then'](saveUpdates(_0x324d20['body'],null))[_0x1865('0x27')](respondWithResult(_0xb1cd17,null))[_0x1865('0x42')](handleError(_0xb1cd17,null));};exports[_0x1865('0x26')]=function(_0x130b6f,_0x3c2b39){return db[_0x1865('0x2d')][_0x1865('0x49')]({'where':{'id':_0x130b6f[_0x1865('0x44')]['id']}})[_0x1865('0x27')](handleEntityNotFound(_0x3c2b39,null))[_0x1865('0x27')](removeEntity(_0x3c2b39,null))['catch'](handleError(_0x3c2b39,null));};exports[_0x1865('0x4d')]=function(_0x247ca0,_0x4569ca){return db[_0x1865('0x2d')]['describe']()[_0x1865('0x27')](respondWithResult(_0x4569ca,null))['catch'](handleError(_0x4569ca,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 618588e..da1aa9d 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 _0xa7b8=['path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','../../config/logger','bluebird','request-promise'];(function(_0x5c5d43,_0x55dc02){var _0x4edcc7=function(_0x258d64){while(--_0x258d64){_0x5c5d43['push'](_0x5c5d43['shift']());}};_0x4edcc7(++_0x55dc02);}(_0xa7b8,0xce));var _0x8a7b=function(_0x403fbe,_0x3bade8){_0x403fbe=_0x403fbe-0x0;var _0x1721c1=_0xa7b8[_0x403fbe];return _0x1721c1;};'use strict';var _=require('lodash');var util=require(_0x8a7b('0x0'));var logger=require(_0x8a7b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a7b('0x2'));var rp=require(_0x8a7b('0x3'));var fs=require('fs');var path=require(_0x8a7b('0x4'));var rimraf=require('rimraf');var config=require(_0x8a7b('0x5'));var attributes=require(_0x8a7b('0x6'));module[_0x8a7b('0x7')]=function(_0x22d768,_0x25d690){return _0x22d768[_0x8a7b('0x8')](_0x8a7b('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ed=['../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','api','moment','bluebird','rimraf'];(function(_0x3613c8,_0x42cf9b){var _0x12ce85=function(_0x226c57){while(--_0x226c57){_0x3613c8['push'](_0x3613c8['shift']());}};_0x12ce85(++_0x42cf9b);}(_0x45ed,0x186));var _0xd45e=function(_0xd9caad,_0x5856b7){_0xd9caad=_0xd9caad-0x0;var _0x3127e6=_0x45ed[_0xd9caad];return _0x3127e6;};'use strict';var _=require(_0xd45e('0x0'));var util=require(_0xd45e('0x1'));var logger=require('../../config/logger')(_0xd45e('0x2'));var moment=require(_0xd45e('0x3'));var BPromise=require(_0xd45e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd45e('0x5'));var config=require(_0xd45e('0x6'));var attributes=require(_0xd45e('0x7'));module[_0xd45e('0x8')]=function(_0x41cdb4,_0x2b2b8c){return _0x41cdb4[_0xd45e('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xd45e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index fe7e8de..5f4e387 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 _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2cbe74,_0x31195c){var _0x3b7e5c=function(_0x51ac2c){while(--_0x51ac2c){_0x2cbe74['push'](_0x2cbe74['shift']());}};_0x3b7e5c(++_0x31195c);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0xe605=['stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw'];(function(_0x33ddff,_0x43f9e9){var _0x2a21a2=function(_0xddb3ad){while(--_0xddb3ad){_0x33ddff['push'](_0x33ddff['shift']());}};_0x2a21a2(++_0x43f9e9);}(_0xe605,0x92));var _0x5e60=function(_0x4fc353,_0x30d4c7){_0x4fc353=_0x4fc353-0x0;var _0x2191ac=_0xe605[_0x4fc353];return _0x2191ac;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')](_0x5c485d[_0x5e60('0x19')],{'raw':_0x5c485d[_0x5e60('0x1a')]?_0x5c485d[_0x5e60('0x1a')][_0x5e60('0x1b')]===undefined?!![]:![]:!![]})[_0x5e60('0xd')](function(_0x524c93){logger[_0x5e60('0xe')](_0x5e60('0x16'),_0x5c485d);logger[_0x5e60('0x11')]('CreateSquareDetailsReport',_0x5c485d,JSON[_0x5e60('0x1c')](_0x524c93));_0x22d718(_0x524c93);})['catch'](function(_0x376069){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x376069[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x376069[_0x5e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3b047b1..827a5b2 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 _0x2e8a=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x24333e,_0x1e11c5){var _0x161a97=function(_0x3c115b){while(--_0x3c115b){_0x24333e['push'](_0x24333e['shift']());}};_0x161a97(++_0x1e11c5);}(_0x2e8a,0x1c3));var _0xa2e8=function(_0x5bafd3,_0x474626){_0x5bafd3=_0x5bafd3-0x0;var _0x4aeb83=_0x2e8a[_0x5bafd3];return _0x4aeb83;};'use strict';var express=require(_0xa2e8('0x0'));var router=express[_0xa2e8('0x1')]();var auth=require(_0xa2e8('0x2'));var controller=require(_0xa2e8('0x3'));router[_0xa2e8('0x4')]('/',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x6')]);router[_0xa2e8('0x4')](_0xa2e8('0x7'),auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x8')]);module['exports']=router; \ No newline at end of file +var _0xa7cf=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x547fcb,_0x8fda67){var _0x275d17=function(_0x301cd1){while(--_0x301cd1){_0x547fcb['push'](_0x547fcb['shift']());}};_0x275d17(++_0x8fda67);}(_0xa7cf,0x1e9));var _0xfa7c=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xa7cf[_0x5e8eae];return _0xdd09cd;};'use strict';var express=require(_0xfa7c('0x0'));var router=express[_0xfa7c('0x1')]();var auth=require(_0xfa7c('0x2'));var controller=require(_0xfa7c('0x3'));router[_0xfa7c('0x4')]('/',auth[_0xfa7c('0x5')](),controller[_0xfa7c('0x6')]);router[_0xfa7c('0x4')]('/process/:pid/kill',auth[_0xfa7c('0x5')](),controller[_0xfa7c('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5342acf..6057c87 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 _0x656e=['split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','status','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','getAllData','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then'];(function(_0x2e524b,_0x77d26d){var _0x2c037a=function(_0x4ae91b){while(--_0x4ae91b){_0x2e524b['push'](_0x2e524b['shift']());}};_0x2c037a(++_0x77d26d);}(_0x656e,0x86));var _0xe656=function(_0x243dce,_0x548bcf){_0x243dce=_0x243dce-0x0;var _0x482b9d=_0x656e[_0x243dce];return _0x482b9d;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xe656('0x0')];var logger=require(_0xe656('0x1'))(_0xe656('0x2'));var util=require(_0xe656('0x3'));var BPromise=require(_0xe656('0x4'));var _=require('lodash');function handleError(_0x46766f,_0x4fc4b3,_0x2f281e){_0x4fc4b3=_0x4fc4b3||0x1f4;return function(_0x28d1d8){logger['error'](_0xe656('0x5'),_0x2f281e,_0x4fc4b3,util['inspect'](_0x28d1d8,{'showHidden':![],'depth':null}));delete _0x28d1d8[_0xe656('0x6')];_0x46766f['status'](_0x4fc4b3)[_0xe656('0x7')](_0x28d1d8);};}exports['index']=function(_0xa20d1e,_0x524caf){return info[_0xe656('0x8')]()['then'](function(_0x4443e5){return _0x524caf['status'](0xc8)[_0xe656('0x9')](_0x4443e5);})[_0xe656('0xa')](function(_0x26ac07){return _0x524caf['status'](0x1f4)['json'](_0x26ac07);});};exports[_0xe656('0xb')]=function(_0x3a2dc2,_0x29291e){var _0x3ffdbf=[_0xe656('0xc')];return new BPromise(function(_0xdc17b1,_0x599adb){return exec(util['format'](_0xe656('0xd'),_0x3a2dc2['params'][_0xe656('0xe')]),function(_0x4853f5,_0x16bb00,_0x387b80){if(_0x4853f5){return _0x599adb(_0x4853f5);}return _0xdc17b1(_0x16bb00);});})[_0xe656('0xf')](function(_0x32c0cf){var _0x324916=![];var _0x3e33c2=_0x32c0cf[_0xe656('0x10')](/\n/);for(var _0x2d89d3=0x0,_0x4c58c1=_0x3ffdbf[_0xe656('0x11')];_0x2d89d3<_0x4c58c1,_0x324916===![];_0x2d89d3+=0x1){if(_0x32c0cf[_0xe656('0x12')](_0x3ffdbf[_0x2d89d3])>=0x0){_0x324916=!![];}}if(!_0x324916){throw new Error(util[_0xe656('0x13')](_0xe656('0x14'),_0x3a2dc2[_0xe656('0x15')][_0xe656('0xe')]));}process[_0xe656('0x16')](_0x3a2dc2[_0xe656('0x15')][_0xe656('0xe')],'SIGINT');return _0x29291e[_0xe656('0x17')](0xc8)[_0xe656('0x9')]({'message':util[_0xe656('0x13')](_0xe656('0x18'),_0x3a2dc2[_0xe656('0x15')]['pid'])});})['catch'](handleError(_0x29291e,null,'killProcess'));}; \ No newline at end of file +var _0xd4ce=['split','length','kill','SIGINT','catch','systeminformation','child_process','../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xd4ce,0x157));var _0xed4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4ce[_0x14add3];return _0x4a174f;};'use strict';var info=require(_0xed4c('0x0'));var exec=require(_0xed4c('0x1'))['exec'];var logger=require(_0xed4c('0x2'))('api');var util=require(_0xed4c('0x3'));var BPromise=require(_0xed4c('0x4'));var _=require(_0xed4c('0x5'));function handleError(_0x1cabb0,_0x349e30,_0x2e7536){_0x349e30=_0x349e30||0x1f4;return function(_0x44c78a){logger['error'](_0xed4c('0x6'),_0x2e7536,_0x349e30,util[_0xed4c('0x7')](_0x44c78a,{'showHidden':![],'depth':null}));delete _0x44c78a[_0xed4c('0x8')];_0x1cabb0[_0xed4c('0x9')](_0x349e30)[_0xed4c('0xa')](_0x44c78a);};}exports[_0xed4c('0xb')]=function(_0xd31f9d,_0x3e9d3a){return info[_0xed4c('0xc')]()[_0xed4c('0xd')](function(_0x265d9f){return _0x3e9d3a[_0xed4c('0x9')](0xc8)[_0xed4c('0xe')](_0x265d9f);})['catch'](function(_0x23a39e){return _0x3e9d3a['status'](0x1f4)[_0xed4c('0xe')](_0x23a39e);});};exports[_0xed4c('0xf')]=function(_0x42e28f,_0x3490ba){var _0x3fe00c=[_0xed4c('0x10')];return new BPromise(function(_0x2242aa,_0x229702){return exec(util[_0xed4c('0x11')](_0xed4c('0x12'),_0x42e28f[_0xed4c('0x13')][_0xed4c('0x14')]),function(_0x272ad5,_0x5cc9ba,_0x52dfb6){if(_0x272ad5){return _0x229702(_0x272ad5);}return _0x2242aa(_0x5cc9ba);});})[_0xed4c('0xd')](function(_0x1f769f){var _0xcb5dc6=![];var _0x3c623e=_0x1f769f[_0xed4c('0x15')](/\n/);for(var _0x36327e=0x0,_0x2314a2=_0x3fe00c[_0xed4c('0x16')];_0x36327e<_0x2314a2,_0xcb5dc6===![];_0x36327e+=0x1){if(_0x1f769f['indexOf'](_0x3fe00c[_0x36327e])>=0x0){_0xcb5dc6=!![];}}if(!_0xcb5dc6){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x42e28f[_0xed4c('0x13')][_0xed4c('0x14')]));}process[_0xed4c('0x17')](_0x42e28f[_0xed4c('0x13')][_0xed4c('0x14')],_0xed4c('0x18'));return _0x3490ba['status'](0xc8)[_0xed4c('0xe')]({'message':util[_0xed4c('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x42e28f['params']['pid'])});})[_0xed4c('0x19')](handleError(_0x3490ba,null,_0xed4c('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f0dfd59..b7e95e3 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 _0xbb27=['index','/:id','show','post','create','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated'];(function(_0x629264,_0x1e8ef9){var _0x52baa6=function(_0x48f16a){while(--_0x48f16a){_0x629264['push'](_0x629264['shift']());}};_0x52baa6(++_0x1e8ef9);}(_0xbb27,0x146));var _0x7bb2=function(_0x6e115e,_0x4af09d){_0x6e115e=_0x6e115e-0x0;var _0x2f9a2e=_0xbb27[_0x6e115e];return _0x2f9a2e;};'use strict';var multer=require(_0x7bb2('0x0'));var util=require(_0x7bb2('0x1'));var path=require(_0x7bb2('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bb2('0x3'));var router=express[_0x7bb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7bb2('0x5'));var interaction=require(_0x7bb2('0x6'));var config=require('../../config/environment');var controller=require(_0x7bb2('0x7'));router[_0x7bb2('0x8')]('/',auth[_0x7bb2('0x9')](),controller[_0x7bb2('0xa')]);router[_0x7bb2('0x8')](_0x7bb2('0xb'),auth[_0x7bb2('0x9')](),controller[_0x7bb2('0xc')]);router[_0x7bb2('0xd')]('/',auth[_0x7bb2('0x9')](),controller[_0x7bb2('0xe')]);router['put'](_0x7bb2('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7bb2('0xb'),auth[_0x7bb2('0x9')](),controller['destroy']);module[_0x7bb2('0xf')]=router; \ No newline at end of file +var _0x51f9=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x1f0f2a,_0x14f11a){var _0x145cd9=function(_0x5768b5){while(--_0x5768b5){_0x1f0f2a['push'](_0x1f0f2a['shift']());}};_0x145cd9(++_0x14f11a);}(_0x51f9,0x132));var _0x951f=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x51f9[_0x10b48a];return _0x2c4533;};'use strict';var multer=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var path=require('path');var timeout=require(_0x951f('0x2'));var express=require(_0x951f('0x3'));var router=express[_0x951f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x951f('0x5'));var interaction=require(_0x951f('0x6'));var config=require(_0x951f('0x7'));var controller=require(_0x951f('0x8'));router[_0x951f('0x9')]('/',auth[_0x951f('0xa')](),controller[_0x951f('0xb')]);router['get'](_0x951f('0xc'),auth[_0x951f('0xa')](),controller[_0x951f('0xd')]);router[_0x951f('0xe')]('/',auth[_0x951f('0xa')](),controller[_0x951f('0xf')]);router[_0x951f('0x10')](_0x951f('0xc'),auth[_0x951f('0xa')](),controller[_0x951f('0x11')]);router[_0x951f('0x12')](_0x951f('0xc'),auth[_0x951f('0xa')](),controller[_0x951f('0x13')]);module[_0x951f('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index bee757d..d81edf7 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 _0x0ca5=['name','#0091EA','sequelize','exports','STRING'];(function(_0x4dccf4,_0x546161){var _0x41d2ef=function(_0x3ab006){while(--_0x3ab006){_0x4dccf4['push'](_0x4dccf4['shift']());}};_0x41d2ef(++_0x546161);}(_0x0ca5,0xfc));var _0x50ca=function(_0x428ccc,_0x2d3040){_0x428ccc=_0x428ccc-0x0;var _0x23eb1d=_0x0ca5[_0x428ccc];return _0x23eb1d;};'use strict';var Sequelize=require(_0x50ca('0x0'));module[_0x50ca('0x1')]={'name':{'type':Sequelize[_0x50ca('0x2')],'unique':_0x50ca('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x50ca('0x2')],'defaultValue':_0x50ca('0x4')},'description':{'type':Sequelize[_0x50ca('0x2')]}}; \ No newline at end of file +var _0x758a=['sequelize','exports','STRING','name','#0091EA'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x758a,0x1d1));var _0xa758=function(_0x46277e,_0xfb8f2e){_0x46277e=_0x46277e-0x0;var _0x4ab0be=_0x758a[_0x46277e];return _0x4ab0be;};'use strict';var Sequelize=require(_0xa758('0x0'));module[_0xa758('0x1')]={'name':{'type':Sequelize[_0xa758('0x2')],'unique':_0xa758('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa758('0x2')],'defaultValue':_0xa758('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a359203..733f69d 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 _0x3140=['filter','options','count','include','findAll','catch','show','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','update','then','get','Tags','UserProfileResource','error','stack','send','map','Tag','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','name'];(function(_0x5d8778,_0x3c2f0e){var _0x133e42=function(_0x2c23aa){while(--_0x2c23aa){_0x5d8778['push'](_0x5d8778['shift']());}};_0x133e42(++_0x3c2f0e);}(_0x3140,0xaf));var _0x0314=function(_0x37b0da,_0x42982f){_0x37b0da=_0x37b0da-0x0;var _0x18c5b6=_0x3140[_0x37b0da];return _0x18c5b6;};'use strict';var emlformat=require(_0x0314('0x0'));var rimraf=require(_0x0314('0x1'));var zipdir=require(_0x0314('0x2'));var jsonpatch=require(_0x0314('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0314('0x4'));var Mustache=require(_0x0314('0x5'));var util=require(_0x0314('0x6'));var path=require(_0x0314('0x7'));var sox=require(_0x0314('0x8'));var csv=require(_0x0314('0x9'));var ejs=require(_0x0314('0xa'));var fs=require('fs');var fs_extra=require(_0x0314('0xb'));var _=require(_0x0314('0xc'));var squel=require(_0x0314('0xd'));var crypto=require(_0x0314('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0314('0xf'));var toCsv=require(_0x0314('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0314('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0314('0x11'));var as=require(_0x0314('0x12'));var hardwareService=require(_0x0314('0x13'));var logger=require(_0x0314('0x14'))(_0x0314('0x15'));var utils=require(_0x0314('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0314('0x17'));var db=require(_0x0314('0x18'))['db'];function respondWithStatusCode(_0xd85ddf,_0x4602ec){_0x4602ec=_0x4602ec||0xcc;return function(_0x153077){if(_0x153077){return _0xd85ddf[_0x0314('0x19')](_0x4602ec);}return _0xd85ddf[_0x0314('0x1a')](_0x4602ec)['end']();};}function respondWithResult(_0x1c26ff,_0xbe0b07){_0xbe0b07=_0xbe0b07||0xc8;return function(_0x1316a0){if(_0x1316a0){return _0x1c26ff[_0x0314('0x1a')](_0xbe0b07)[_0x0314('0x1b')](_0x1316a0);}};}function respondWithFilteredResult(_0x398c91,_0x413bfa){return function(_0x3ea356){if(_0x3ea356){var _0x5e460f=typeof _0x413bfa[_0x0314('0x1c')]===_0x0314('0x1d')&&typeof _0x413bfa[_0x0314('0x1e')]==='undefined';var _0x6c48cb=_0x3ea356['count'];var _0x575b68=_0x5e460f?0x0:_0x413bfa[_0x0314('0x1c')];var _0x329679=_0x5e460f?_0x3ea356['count']:_0x413bfa[_0x0314('0x1c')]+_0x413bfa[_0x0314('0x1e')];var _0x583ffa;if(_0x329679>=_0x6c48cb){_0x329679=_0x6c48cb;_0x583ffa=0xc8;}else{_0x583ffa=0xce;}_0x398c91[_0x0314('0x1a')](_0x583ffa);return _0x398c91['set'](_0x0314('0x1f'),_0x575b68+'-'+_0x329679+'/'+_0x6c48cb)[_0x0314('0x1b')](_0x3ea356);}return null;};}function patchUpdates(_0x16d273){return function(_0x77ddfd){try{jsonpatch[_0x0314('0x20')](_0x77ddfd,_0x16d273,!![]);}catch(_0xdfad84){return BPromise['reject'](_0xdfad84);}return _0x77ddfd['save']();};}function saveUpdates(_0x20305b,_0xbd3ad0){return function(_0x1945f8){if(_0x1945f8){return _0x1945f8[_0x0314('0x21')](_0x20305b)[_0x0314('0x22')](function(_0xd7638b){return _0xd7638b;});}return null;};}function removeEntity(_0x58a1c9,_0x3c743e){return function(_0x43fb0e){if(_0x43fb0e){return _0x43fb0e['destroy']()[_0x0314('0x22')](function(){var _0xfc4893=_0x43fb0e[_0x0314('0x23')]({'plain':!![]});var _0x26c6a4=_0x0314('0x24');return db[_0x0314('0x25')]['destroy']({'where':{'type':_0x26c6a4,'resourceId':_0xfc4893['id']}})[_0x0314('0x22')](function(){return _0x43fb0e;});})[_0x0314('0x22')](function(){_0x58a1c9[_0x0314('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b4b5,_0x5e3eba){return function(_0x47c102){if(!_0x47c102){_0x29b4b5['sendStatus'](0x194);}return _0x47c102;};}function handleError(_0x2fc520,_0x21d6a5){_0x21d6a5=_0x21d6a5||0x1f4;return function(_0x550dc4){logger[_0x0314('0x26')](_0x550dc4[_0x0314('0x27')]);if(_0x550dc4['name']){delete _0x550dc4['name'];}_0x2fc520[_0x0314('0x1a')](_0x21d6a5)[_0x0314('0x28')](_0x550dc4);};}exports['index']=function(_0x44adb3,_0x16e74a){var _0x3d6652={},_0x4da71c={},_0x5b82b2={'count':0x0,'rows':[]};var _0x37ab90=_[_0x0314('0x29')](db[_0x0314('0x2a')]['rawAttributes'],function(_0x1d01b5){return{'name':_0x1d01b5['fieldName'],'type':_0x1d01b5['type'][_0x0314('0x2b')]};});_0x4da71c[_0x0314('0x2c')]=_[_0x0314('0x29')](_0x37ab90,'name');_0x4da71c[_0x0314('0x2d')]=_['keys'](_0x44adb3[_0x0314('0x2d')]);_0x4da71c['filters']=_['intersection'](_0x4da71c[_0x0314('0x2c')],_0x4da71c['query']);_0x3d6652[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x4da71c[_0x0314('0x2c')],qs[_0x0314('0x30')](_0x44adb3[_0x0314('0x2d')][_0x0314('0x30')]));_0x3d6652[_0x0314('0x2e')]=_0x3d6652['attributes'][_0x0314('0x31')]?_0x3d6652[_0x0314('0x2e')]:_0x4da71c[_0x0314('0x2c')];if(!_0x44adb3[_0x0314('0x2d')][_0x0314('0x32')](_0x0314('0x33'))){_0x3d6652['limit']=qs[_0x0314('0x1e')](_0x44adb3['query'][_0x0314('0x1e')]);_0x3d6652['offset']=qs[_0x0314('0x1c')](_0x44adb3['query']['offset']);}_0x3d6652['order']=qs[_0x0314('0x34')](_0x44adb3[_0x0314('0x2d')][_0x0314('0x34')]);_0x3d6652[_0x0314('0x35')]=qs[_0x0314('0x36')](_['pick'](_0x44adb3[_0x0314('0x2d')],_0x4da71c[_0x0314('0x36')]),_0x37ab90);if(_0x44adb3[_0x0314('0x2d')]['filter']){_0x3d6652[_0x0314('0x35')]=_['merge'](_0x3d6652[_0x0314('0x35')],{'$or':_['map'](_0x37ab90,function(_0x24fe65){if(_0x24fe65['type']!=='VIRTUAL'){var _0x370539={};_0x370539[_0x24fe65[_0x0314('0x37')]]={'$like':'%'+_0x44adb3['query'][_0x0314('0x38')]+'%'};return _0x370539;}})});}_0x3d6652=_['merge']({},_0x3d6652,_0x44adb3[_0x0314('0x39')]);var _0x438ddd={'where':_0x3d6652[_0x0314('0x35')]};return db[_0x0314('0x2a')][_0x0314('0x3a')](_0x438ddd)['then'](function(_0x52a71c){_0x5b82b2[_0x0314('0x3a')]=_0x52a71c;if(_0x44adb3[_0x0314('0x2d')]['includeAll']){_0x3d6652[_0x0314('0x3b')]=[{'all':!![]}];}return db[_0x0314('0x2a')][_0x0314('0x3c')](_0x3d6652);})['then'](function(_0x2b328c){_0x5b82b2['rows']=_0x2b328c;return _0x5b82b2;})[_0x0314('0x22')](respondWithFilteredResult(_0x16e74a,_0x3d6652))[_0x0314('0x3d')](handleError(_0x16e74a,null));};exports[_0x0314('0x3e')]=function(_0x583aba,_0xcafd05){var _0xf4c4a1={'raw':!![],'where':{'id':_0x583aba['params']['id']}},_0x588e65={};_0x588e65['model']=_[_0x0314('0x3f')](db[_0x0314('0x2a')][_0x0314('0x40')]);_0x588e65['query']=_[_0x0314('0x3f')](_0x583aba[_0x0314('0x2d')]);_0x588e65[_0x0314('0x36')]=_[_0x0314('0x2f')](_0x588e65[_0x0314('0x2c')],_0x588e65['query']);_0xf4c4a1[_0x0314('0x2e')]=_[_0x0314('0x2f')](_0x588e65[_0x0314('0x2c')],qs[_0x0314('0x30')](_0x583aba[_0x0314('0x2d')][_0x0314('0x30')]));_0xf4c4a1[_0x0314('0x2e')]=_0xf4c4a1['attributes'][_0x0314('0x31')]?_0xf4c4a1[_0x0314('0x2e')]:_0x588e65['model'];if(_0x583aba[_0x0314('0x2d')][_0x0314('0x41')]){_0xf4c4a1[_0x0314('0x3b')]=[{'all':!![]}];}_0xf4c4a1=_['merge']({},_0xf4c4a1,_0x583aba['options']);return db[_0x0314('0x2a')][_0x0314('0x42')](_0xf4c4a1)[_0x0314('0x22')](handleEntityNotFound(_0xcafd05,null))[_0x0314('0x22')](respondWithResult(_0xcafd05,null))[_0x0314('0x3d')](handleError(_0xcafd05,null));};exports[_0x0314('0x43')]=function(_0x36a72a,_0x478b8b){return db[_0x0314('0x2a')]['create'](_0x36a72a[_0x0314('0x44')],{})[_0x0314('0x22')](function(_0x3003dd){var _0x362b60=_0x36a72a[_0x0314('0x45')]['get']({'plain':!![]});if(!_0x362b60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x362b60[_0x0314('0x46')]===_0x0314('0x45')){var _0x20070c=_0x3003dd[_0x0314('0x23')]({'plain':!![]});var _0x5b3c49=_0x0314('0x24');return db[_0x0314('0x47')][_0x0314('0x42')]({'where':{'name':_0x5b3c49,'userProfileId':_0x362b60[_0x0314('0x48')]},'raw':!![]})[_0x0314('0x22')](function(_0x458bd8){if(_0x458bd8&&_0x458bd8[_0x0314('0x49')]===0x0){return db['UserProfileResource'][_0x0314('0x43')]({'name':_0x20070c[_0x0314('0x37')],'resourceId':_0x20070c['id'],'type':_0x458bd8[_0x0314('0x37')],'sectionId':_0x458bd8['id']},{})['then'](function(){return _0x3003dd;});}else{return _0x3003dd;}})[_0x0314('0x3d')](function(_0x11695d){logger['error'](_0x0314('0x4a'),_0x11695d);throw _0x11695d;});}return _0x3003dd;})[_0x0314('0x22')](respondWithResult(_0x478b8b,0xc9))[_0x0314('0x3d')](handleError(_0x478b8b,null));};exports[_0x0314('0x21')]=function(_0x544a03,_0x39b4c1){if(_0x544a03[_0x0314('0x44')]['id']){delete _0x544a03[_0x0314('0x44')]['id'];}return db[_0x0314('0x2a')][_0x0314('0x42')]({'where':{'id':_0x544a03[_0x0314('0x4b')]['id']}})[_0x0314('0x22')](handleEntityNotFound(_0x39b4c1,null))[_0x0314('0x22')](saveUpdates(_0x544a03[_0x0314('0x44')],null))[_0x0314('0x22')](respondWithResult(_0x39b4c1,null))['catch'](handleError(_0x39b4c1,null));};exports[_0x0314('0x4c')]=function(_0x305568,_0xf29a33){return db[_0x0314('0x2a')][_0x0314('0x42')]({'where':{'id':_0x305568[_0x0314('0x4b')]['id']}})[_0x0314('0x22')](handleEntityNotFound(_0xf29a33,null))['then'](removeEntity(_0xf29a33,null))['catch'](handleError(_0xf29a33,null));}; \ No newline at end of file +var _0xca66=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','sendStatus','error','name','index','map','Tag','fieldName','type','key','query','filters','intersection','attributes','model','fields','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined'];(function(_0x3098f2,_0x859a3d){var _0x4f9e1a=function(_0x5e517f){while(--_0x5e517f){_0x3098f2['push'](_0x3098f2['shift']());}};_0x4f9e1a(++_0x859a3d);}(_0xca66,0x8b));var _0x6ca6=function(_0x38c5df,_0x4d7a18){_0x38c5df=_0x38c5df-0x0;var _0x50ac36=_0xca66[_0x38c5df];return _0x50ac36;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){var _0x541122=_0xfe0760[_0x6ca6('0x28')]({'plain':!![]});var _0x1d6caa=_0x6ca6('0x29');return db[_0x6ca6('0x2a')][_0x6ca6('0x26')]({'where':{'type':_0x1d6caa,'resourceId':_0x541122['id']}})[_0x6ca6('0x27')](function(){return _0xfe0760;});})[_0x6ca6('0x27')](function(){_0xfbf496[_0x6ca6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b07f,_0x144ec5){return function(_0x9467bd){if(!_0x9467bd){_0x55b07f[_0x6ca6('0x2b')](0x194);}return _0x9467bd;};}function handleError(_0x141c0f,_0x552f3e){_0x552f3e=_0x552f3e||0x1f4;return function(_0x5ea6f7){logger[_0x6ca6('0x2c')](_0x5ea6f7['stack']);if(_0x5ea6f7['name']){delete _0x5ea6f7[_0x6ca6('0x2d')];}_0x141c0f[_0x6ca6('0x19')](_0x552f3e)['send'](_0x5ea6f7);};}exports[_0x6ca6('0x2e')]=function(_0xf829ee,_0xac50e8){var _0x566543={},_0x484411={},_0x28af50={'count':0x0,'rows':[]};var _0x23112a=_[_0x6ca6('0x2f')](db[_0x6ca6('0x30')]['rawAttributes'],function(_0x467a89){return{'name':_0x467a89[_0x6ca6('0x31')],'type':_0x467a89[_0x6ca6('0x32')][_0x6ca6('0x33')]};});_0x484411['model']=_['map'](_0x23112a,'name');_0x484411['query']=_['keys'](_0xf829ee[_0x6ca6('0x34')]);_0x484411[_0x6ca6('0x35')]=_[_0x6ca6('0x36')](_0x484411['model'],_0x484411[_0x6ca6('0x34')]);_0x566543[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x484411[_0x6ca6('0x38')],qs['fields'](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0x566543[_0x6ca6('0x37')]=_0x566543[_0x6ca6('0x37')]['length']?_0x566543[_0x6ca6('0x37')]:_0x484411['model'];if(!_0xf829ee[_0x6ca6('0x34')]['hasOwnProperty']('nolimit')){_0x566543[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x1d')]);_0x566543['offset']=qs['offset'](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x1b')]);}_0x566543['order']=qs[_0x6ca6('0x3a')](_0xf829ee['query'][_0x6ca6('0x3a')]);_0x566543['where']=qs[_0x6ca6('0x35')](_[_0x6ca6('0x3b')](_0xf829ee[_0x6ca6('0x34')],_0x484411[_0x6ca6('0x35')]),_0x23112a);if(_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x3c')]){_0x566543[_0x6ca6('0x3d')]=_[_0x6ca6('0x3e')](_0x566543['where'],{'$or':_[_0x6ca6('0x2f')](_0x23112a,function(_0x4ac816){if(_0x4ac816['type']!==_0x6ca6('0x3f')){var _0x306eda={};_0x306eda[_0x4ac816['name']]={'$like':'%'+_0xf829ee[_0x6ca6('0x34')]['filter']+'%'};return _0x306eda;}})});}_0x566543=_[_0x6ca6('0x3e')]({},_0x566543,_0xf829ee[_0x6ca6('0x40')]);var _0x3f9e8f={'where':_0x566543[_0x6ca6('0x3d')]};return db['Tag']['count'](_0x3f9e8f)[_0x6ca6('0x27')](function(_0x3813d6){_0x28af50[_0x6ca6('0x1e')]=_0x3813d6;if(_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x41')]){_0x566543['include']=[{'all':!![]}];}return db[_0x6ca6('0x30')][_0x6ca6('0x42')](_0x566543);})['then'](function(_0x317b5e){_0x28af50[_0x6ca6('0x43')]=_0x317b5e;return _0x28af50;})[_0x6ca6('0x27')](respondWithFilteredResult(_0xac50e8,_0x566543))[_0x6ca6('0x44')](handleError(_0xac50e8,null));};exports[_0x6ca6('0x45')]=function(_0x3e658e,_0x258c76){var _0xe9bce9={'raw':!![],'where':{'id':_0x3e658e['params']['id']}},_0x1a8b7e={};_0x1a8b7e[_0x6ca6('0x38')]=_[_0x6ca6('0x46')](db[_0x6ca6('0x30')][_0x6ca6('0x47')]);_0x1a8b7e[_0x6ca6('0x34')]=_[_0x6ca6('0x46')](_0x3e658e[_0x6ca6('0x34')]);_0x1a8b7e[_0x6ca6('0x35')]=_['intersection'](_0x1a8b7e['model'],_0x1a8b7e[_0x6ca6('0x34')]);_0xe9bce9[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x1a8b7e[_0x6ca6('0x38')],qs[_0x6ca6('0x39')](_0x3e658e[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0xe9bce9['attributes']=_0xe9bce9['attributes'][_0x6ca6('0x48')]?_0xe9bce9[_0x6ca6('0x37')]:_0x1a8b7e['model'];if(_0x3e658e[_0x6ca6('0x34')][_0x6ca6('0x41')]){_0xe9bce9[_0x6ca6('0x49')]=[{'all':!![]}];}_0xe9bce9=_[_0x6ca6('0x3e')]({},_0xe9bce9,_0x3e658e[_0x6ca6('0x40')]);return db[_0x6ca6('0x30')][_0x6ca6('0x4a')](_0xe9bce9)['then'](handleEntityNotFound(_0x258c76,null))[_0x6ca6('0x27')](respondWithResult(_0x258c76,null))[_0x6ca6('0x44')](handleError(_0x258c76,null));};exports[_0x6ca6('0x4b')]=function(_0x4fde51,_0x408df3){return db['Tag'][_0x6ca6('0x4b')](_0x4fde51['body'],{})['then'](function(_0x5da714){var _0x199489=_0x4fde51[_0x6ca6('0x4c')][_0x6ca6('0x28')]({'plain':!![]});if(!_0x199489)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199489[_0x6ca6('0x4d')]==='user'){var _0x1f552d=_0x5da714[_0x6ca6('0x28')]({'plain':!![]});var _0xe0b775=_0x6ca6('0x29');return db[_0x6ca6('0x4e')][_0x6ca6('0x4a')]({'where':{'name':_0xe0b775,'userProfileId':_0x199489[_0x6ca6('0x4f')]},'raw':!![]})[_0x6ca6('0x27')](function(_0x2bd33e){if(_0x2bd33e&&_0x2bd33e[_0x6ca6('0x50')]===0x0){return db[_0x6ca6('0x2a')]['create']({'name':_0x1f552d[_0x6ca6('0x2d')],'resourceId':_0x1f552d['id'],'type':_0x2bd33e[_0x6ca6('0x2d')],'sectionId':_0x2bd33e['id']},{})[_0x6ca6('0x27')](function(){return _0x5da714;});}else{return _0x5da714;}})[_0x6ca6('0x44')](function(_0x11fda2){logger['error'](_0x6ca6('0x51'),_0x11fda2);throw _0x11fda2;});}return _0x5da714;})[_0x6ca6('0x27')](respondWithResult(_0x408df3,0xc9))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['update']=function(_0x5490ce,_0x4fe7a9){if(_0x5490ce['body']['id']){delete _0x5490ce[_0x6ca6('0x52')]['id'];}return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x5490ce['params']['id']}})['then'](handleEntityNotFound(_0x4fe7a9,null))[_0x6ca6('0x27')](saveUpdates(_0x5490ce[_0x6ca6('0x52')],null))[_0x6ca6('0x27')](respondWithResult(_0x4fe7a9,null))['catch'](handleError(_0x4fe7a9,null));};exports[_0x6ca6('0x26')]=function(_0x57880d,_0x281759){return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x57880d[_0x6ca6('0x53')]['id']}})['then'](handleEntityNotFound(_0x281759,null))[_0x6ca6('0x27')](removeEntity(_0x281759,null))['catch'](handleError(_0x281759,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b4d7eb9..439b8eb 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 _0xa12b=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./tag.attributes','define','tools_tags'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0xa12b,0xf0));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var util=require('util');var logger=require(_0xba12('0x1'))(_0xba12('0x2'));var moment=require(_0xba12('0x3'));var BPromise=require('bluebird');var rp=require(_0xba12('0x4'));var fs=require('fs');var path=require(_0xba12('0x5'));var rimraf=require('rimraf');var config=require(_0xba12('0x6'));var attributes=require(_0xba12('0x7'));module['exports']=function(_0x13c13c,_0x1970dd){return _0x13c13c[_0xba12('0x8')]('Tag',attributes,{'tableName':_0xba12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0de5=['../../config/logger','request-promise','path','rimraf','../../config/environment','exports','define','Tag','lodash','util'];(function(_0x7ae92b,_0x153311){var _0x4599e1=function(_0x4b5108){while(--_0x4b5108){_0x7ae92b['push'](_0x7ae92b['shift']());}};_0x4599e1(++_0x153311);}(_0x0de5,0xd0));var _0x50de=function(_0x6cbff6,_0x3b59f8){_0x6cbff6=_0x6cbff6-0x0;var _0x390e52=_0x0de5[_0x6cbff6];return _0x390e52;};'use strict';var _=require(_0x50de('0x0'));var util=require(_0x50de('0x1'));var logger=require(_0x50de('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x50de('0x3'));var fs=require('fs');var path=require(_0x50de('0x4'));var rimraf=require(_0x50de('0x5'));var config=require(_0x50de('0x6'));var attributes=require('./tag.attributes');module[_0x50de('0x7')]=function(_0x3fe732,_0xe047a4){return _0x3fe732[_0x50de('0x8')](_0x50de('0x9'),attributes,{'tableName':'tools_tags','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 e10aa19..bc608a3 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 _0xadb8=['Tag,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2a9b46,_0x5a7f1c){var _0x16bd08=function(_0x268cd8){while(--_0x268cd8){_0x2a9b46['push'](_0x2a9b46['shift']());}};_0x16bd08(++_0x5a7f1c);}(_0xadb8,0x1d0));var _0x8adb=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xadb8[_0x34b87f];return _0x449805;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x8adb('0x1'));var fs=require('fs');var Redis=require(_0x8adb('0x2'));var db=require(_0x8adb('0x3'))['db'];var utils=require(_0x8adb('0x4'));var logger=require(_0x8adb('0x5'))(_0x8adb('0x6'));var config=require(_0x8adb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8adb('0x8')][_0x8adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f435,_0x2bebfe,_0x271bed){return new BPromise(function(_0x16b932,_0x27d994){return client['request'](_0x9f435,_0x271bed)['then'](function(_0x58ad1a){logger[_0x8adb('0xa')]('Tag,\x20%s,\x20%s',_0x2bebfe,'request\x20sent');logger['debug'](_0x8adb('0xb'),_0x2bebfe,_0x8adb('0xc'),JSON[_0x8adb('0xd')](_0x58ad1a));if(_0x58ad1a[_0x8adb('0xe')]){if(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0xf')]===0x1f4){logger[_0x8adb('0xe')](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);return _0x27d994(_0x58ad1a['error']['message']);}logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a['error'][_0x8adb('0x11')]);return _0x16b932(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);}else{logger['info'](_0x8adb('0x10'),_0x2bebfe,_0x8adb('0xc'));_0x16b932(_0x58ad1a[_0x8adb('0x12')][_0x8adb('0x11')]);}})[_0x8adb('0x13')](function(_0x13659c){logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x13659c);_0x27d994(_0x13659c);});});} \ No newline at end of file +var _0x3685=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x208c54,_0x120a70){var _0x4b0116=function(_0x32be34){while(--_0x32be34){_0x208c54['push'](_0x208c54['shift']());}};_0x4b0116(++_0x120a70);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var moment=require(_0x5368('0x1'));var BPromise=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var fs=require('fs');var Redis=require(_0x5368('0x4'));var db=require(_0x5368('0x5'))['db'];var utils=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var jayson=require(_0x5368('0xa'));var client=jayson['client'][_0x5368('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2529a2,_0x39223d,_0xaf4549){return new BPromise(function(_0x55fb7d,_0x14e621){return client[_0x5368('0xc')](_0x2529a2,_0xaf4549)[_0x5368('0xd')](function(_0x2a6ce8){logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,_0x5368('0x10'));logger[_0x5368('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x39223d,_0x5368('0x10'),JSON[_0x5368('0x12')](_0x2a6ce8));if(_0x2a6ce8[_0x5368('0x13')]){if(_0x2a6ce8['error'][_0x5368('0x14')]===0x1f4){logger[_0x5368('0x13')]('Tag,\x20%s,\x20%s',_0x39223d,_0x2a6ce8['error']['message']);return _0x14e621(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);return _0x55fb7d(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}else{logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,'request\x20sent');_0x55fb7d(_0x2a6ce8[_0x5368('0x16')][_0x5368('0x15')]);}})['catch'](function(_0x19790d){logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x19790d);_0x14e621(_0x19790d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4f0c088..b685ea4 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 2003c8c..982f38f 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 _0xd8b0=['exports','sequelize'];(function(_0x34a279,_0x4cc105){var _0x2cee7f=function(_0x4daad3){while(--_0x4daad3){_0x34a279['push'](_0x34a279['shift']());}};_0x2cee7f(++_0x4cc105);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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/team/team.controller.js b/server/api/team/team.controller.js index 4358c5e..8dbbc39 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 _0x1561=['offset','undefined','limit','count','Content-Range','apply','save','update','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','end','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','Queue','ValidationError','add','capitalize','Queues','ids','remove','addAgents','isArray','Voice','Sms','Fax','through','penalty','TeamVoiceQueue','User','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Chat','Whatsapp','Queue:remove','VoicePrefixId','getAgents','length','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json'];(function(_0x4b7f28,_0x27d23a){var _0xf5b553=function(_0x1cb9c1){while(--_0x1cb9c1){_0x4b7f28['push'](_0x4b7f28['shift']());}};_0xf5b553(++_0x27d23a);}(_0x1561,0x110));var _0x1156=function(_0x1307b5,_0x551a84){_0x1307b5=_0x1307b5-0x0;var _0x256d68=_0x1561[_0x1307b5];return _0x256d68;};'use strict';var emlformat=require(_0x1156('0x0'));var rimraf=require(_0x1156('0x1'));var zipdir=require(_0x1156('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1156('0x3'));var moment=require(_0x1156('0x4'));var BPromise=require(_0x1156('0x5'));var Mustache=require(_0x1156('0x6'));var util=require('util');var path=require(_0x1156('0x7'));var sox=require('sox');var csv=require(_0x1156('0x8'));var ejs=require(_0x1156('0x9'));var fs=require('fs');var fs_extra=require(_0x1156('0xa'));var _=require(_0x1156('0xb'));var squel=require(_0x1156('0xc'));var crypto=require(_0x1156('0xd'));var jsforce=require(_0x1156('0xe'));var deskjs=require(_0x1156('0xf'));var toCsv=require(_0x1156('0x8'));var querystring=require(_0x1156('0x10'));var Papa=require('papaparse');var Redis=require(_0x1156('0x11'));var authService=require(_0x1156('0x12'));var qs=require(_0x1156('0x13'));var as=require(_0x1156('0x14'));var hardwareService=require(_0x1156('0x15'));var logger=require(_0x1156('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1156('0x17'));var licenseUtil=require(_0x1156('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1156('0x19')](config[_0x1156('0x1a')],{'host':_0x1156('0x1b'),'port':0x18eb});var socket=require(_0x1156('0x1c'))(new Redis(config[_0x1156('0x1a')]));require(_0x1156('0x1d'))[_0x1156('0x1e')](socket);function respondWithStatusCode(_0xbca596,_0x344771){_0x344771=_0x344771||0xcc;return function(_0x402e13){if(_0x402e13){return _0xbca596[_0x1156('0x1f')](_0x344771);}return _0xbca596[_0x1156('0x20')](_0x344771)['end']();};}function respondWithResult(_0x33bab9,_0x4cd465){_0x4cd465=_0x4cd465||0xc8;return function(_0x133200){if(_0x133200){return _0x33bab9['status'](_0x4cd465)[_0x1156('0x21')](_0x133200);}};}function respondWithFilteredResult(_0x3cdb16,_0x3bcf5e){return function(_0x3d00b1){if(_0x3d00b1){var _0x4750c6=typeof _0x3bcf5e[_0x1156('0x22')]===_0x1156('0x23')&&typeof _0x3bcf5e[_0x1156('0x24')]===_0x1156('0x23');var _0x287415=_0x3d00b1[_0x1156('0x25')];var _0x5d8680=_0x4750c6?0x0:_0x3bcf5e['offset'];var _0x10f388=_0x4750c6?_0x3d00b1['count']:_0x3bcf5e[_0x1156('0x22')]+_0x3bcf5e['limit'];var _0x38e836;if(_0x10f388>=_0x287415){_0x10f388=_0x287415;_0x38e836=0xc8;}else{_0x38e836=0xce;}_0x3cdb16['status'](_0x38e836);return _0x3cdb16['set'](_0x1156('0x26'),_0x5d8680+'-'+_0x10f388+'/'+_0x287415)['json'](_0x3d00b1);}return null;};}function patchUpdates(_0x5135ce){return function(_0x7d4eed){try{jsonpatch[_0x1156('0x27')](_0x7d4eed,_0x5135ce,!![]);}catch(_0x193409){return BPromise['reject'](_0x193409);}return _0x7d4eed[_0x1156('0x28')]();};}function saveUpdates(_0x2393a8,_0x53344b){return function(_0x4cac29){if(_0x4cac29){return _0x4cac29[_0x1156('0x29')](_0x2393a8)['then'](function(_0x460e54){return _0x460e54;});}return null;};}function handleEntityNotFound(_0x176285,_0x3d5337){return function(_0x2c9639){if(!_0x2c9639){_0x176285[_0x1156('0x1f')](0x194);}return _0x2c9639;};}function handleError(_0x233654,_0x40146d){_0x40146d=_0x40146d||0x1f4;return function(_0x4ff435){logger[_0x1156('0x2a')](_0x4ff435[_0x1156('0x2b')]);if(_0x4ff435[_0x1156('0x2c')]){delete _0x4ff435[_0x1156('0x2c')];}_0x233654[_0x1156('0x20')](_0x40146d)[_0x1156('0x2d')](_0x4ff435);};}exports[_0x1156('0x2e')]=function(_0x3ecfcd,_0x42d656){var _0x42dfea={},_0x46607d={},_0x1913f9={'count':0x0,'rows':[]};var _0x52120a=_[_0x1156('0x2f')](db[_0x1156('0x30')][_0x1156('0x31')],function(_0x4221e2){return{'name':_0x4221e2['fieldName'],'type':_0x4221e2[_0x1156('0x32')][_0x1156('0x33')]};});_0x46607d[_0x1156('0x34')]=_[_0x1156('0x2f')](_0x52120a,'name');_0x46607d[_0x1156('0x35')]=_[_0x1156('0x36')](_0x3ecfcd[_0x1156('0x35')]);_0x46607d['filters']=_[_0x1156('0x37')](_0x46607d[_0x1156('0x34')],_0x46607d['query']);_0x42dfea[_0x1156('0x38')]=_[_0x1156('0x37')](_0x46607d['model'],qs['fields'](_0x3ecfcd['query'][_0x1156('0x39')]));_0x42dfea[_0x1156('0x38')]=_0x42dfea[_0x1156('0x38')]['length']?_0x42dfea['attributes']:_0x46607d[_0x1156('0x34')];if(!_0x3ecfcd[_0x1156('0x35')][_0x1156('0x3a')](_0x1156('0x3b'))){_0x42dfea[_0x1156('0x24')]=qs[_0x1156('0x24')](_0x3ecfcd['query'][_0x1156('0x24')]);_0x42dfea[_0x1156('0x22')]=qs['offset'](_0x3ecfcd[_0x1156('0x35')][_0x1156('0x22')]);}_0x42dfea[_0x1156('0x3c')]=qs[_0x1156('0x3d')](_0x3ecfcd['query'][_0x1156('0x3d')]);_0x42dfea[_0x1156('0x3e')]=qs['filters'](_[_0x1156('0x3f')](_0x3ecfcd[_0x1156('0x35')],_0x46607d[_0x1156('0x40')]),_0x52120a);if(_0x3ecfcd['query'][_0x1156('0x41')]){_0x42dfea[_0x1156('0x3e')]=_[_0x1156('0x42')](_0x42dfea[_0x1156('0x3e')],{'$or':_[_0x1156('0x2f')](_0x52120a,function(_0x14218d){if(_0x14218d[_0x1156('0x32')]!==_0x1156('0x43')){var _0x3e41e2={};_0x3e41e2[_0x14218d[_0x1156('0x2c')]]={'$like':'%'+_0x3ecfcd['query'][_0x1156('0x41')]+'%'};return _0x3e41e2;}})});}_0x42dfea=_[_0x1156('0x42')]({},_0x42dfea,_0x3ecfcd[_0x1156('0x44')]);var _0x1d3d8e={'where':_0x42dfea['where']};return db[_0x1156('0x30')]['count'](_0x1d3d8e)['then'](function(_0x9fc2ca){_0x1913f9[_0x1156('0x25')]=_0x9fc2ca;if(_0x3ecfcd[_0x1156('0x35')][_0x1156('0x45')]){_0x42dfea[_0x1156('0x46')]=[{'all':!![]}];}return db[_0x1156('0x30')][_0x1156('0x47')](_0x42dfea);})[_0x1156('0x48')](function(_0x385e32){_0x1913f9[_0x1156('0x49')]=_0x385e32;return _0x1913f9;})[_0x1156('0x48')](respondWithFilteredResult(_0x42d656,_0x42dfea))['catch'](handleError(_0x42d656,null));};exports['show']=function(_0x5b2f47,_0x1d37c9){var _0xe71aa5={'raw':![],'where':{'id':_0x5b2f47['params']['id']}},_0x348d01={};_0x348d01[_0x1156('0x34')]=_[_0x1156('0x36')](db[_0x1156('0x30')][_0x1156('0x31')]);_0x348d01[_0x1156('0x35')]=_[_0x1156('0x36')](_0x5b2f47[_0x1156('0x35')]);_0x348d01[_0x1156('0x40')]=_[_0x1156('0x37')](_0x348d01[_0x1156('0x34')],_0x348d01['query']);_0xe71aa5['attributes']=_[_0x1156('0x37')](_0x348d01[_0x1156('0x34')],qs[_0x1156('0x39')](_0x5b2f47[_0x1156('0x35')][_0x1156('0x39')]));_0xe71aa5[_0x1156('0x38')]=_0xe71aa5[_0x1156('0x38')]['length']?_0xe71aa5['attributes']:_0x348d01['model'];if(_0x5b2f47[_0x1156('0x35')]['includeAll']){_0xe71aa5[_0x1156('0x46')]=[{'all':!![]}];}_0xe71aa5=_[_0x1156('0x42')]({},_0xe71aa5,_0x5b2f47[_0x1156('0x44')]);return db[_0x1156('0x30')][_0x1156('0x4a')](_0xe71aa5)['then'](handleEntityNotFound(_0x1d37c9,null))[_0x1156('0x48')](respondWithResult(_0x1d37c9,null))['catch'](handleError(_0x1d37c9,null));};exports['create']=function(_0x56e70d,_0x4f2ed4){return db['Team'][_0x1156('0x4b')](_0x56e70d[_0x1156('0x4c')],{})['then'](function(_0x38b42e){var _0x540c21=_0x56e70d[_0x1156('0x4d')][_0x1156('0x4e')]({'plain':!![]});if(!_0x540c21)throw new Error(_0x1156('0x4f'));if(_0x540c21[_0x1156('0x50')]===_0x1156('0x4d')){var _0x316954=_0x38b42e['get']({'plain':!![]});var _0x3fa2da=_0x1156('0x51');return db['UserProfileSection'][_0x1156('0x4a')]({'where':{'name':_0x3fa2da,'userProfileId':_0x540c21[_0x1156('0x52')]},'raw':!![]})[_0x1156('0x48')](function(_0x5c2cf7){if(_0x5c2cf7&&_0x5c2cf7['autoAssociation']===0x0){return db[_0x1156('0x53')][_0x1156('0x4b')]({'name':_0x316954['name'],'resourceId':_0x316954['id'],'type':_0x5c2cf7['name'],'sectionId':_0x5c2cf7['id']},{})[_0x1156('0x48')](function(){return _0x38b42e;});}else{return _0x38b42e;}})[_0x1156('0x54')](function(_0x28ea7b){logger[_0x1156('0x2a')](_0x1156('0x55'),_0x28ea7b);throw _0x28ea7b;});}return _0x38b42e;})[_0x1156('0x48')](respondWithResult(_0x4f2ed4,0xc9))[_0x1156('0x54')](handleError(_0x4f2ed4,null));};exports['update']=function(_0x319497,_0x3153fb){if(_0x319497['body']['id']){delete _0x319497[_0x1156('0x4c')]['id'];}return db[_0x1156('0x30')]['find']({'where':{'id':_0x319497[_0x1156('0x56')]['id']}})[_0x1156('0x48')](handleEntityNotFound(_0x3153fb,null))['then'](saveUpdates(_0x319497[_0x1156('0x4c')],null))['then'](respondWithResult(_0x3153fb,null))[_0x1156('0x54')](handleError(_0x3153fb,null));};exports[_0x1156('0x57')]=function(_0xf4f21a,_0x3d86bf){var _0x250617=_0xf4f21a[_0x1156('0x56')]['id'];var _0x44937c=[];return db[_0x1156('0x58')][_0x1156('0x59')](function(_0x183a28){var _0x59d13f=_0x1156('0x5a')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x59d13f,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')]['SELECT'],'raw':!![],'transaction':_0x183a28})[_0x1156('0x48')](function(_0x303cd9){_0x44937c=_[_0x1156('0x2f')](_0x303cd9,function(_0x2c1463){return Number(_0x2c1463['UserId']);});})[_0x1156('0x48')](function(){var _0x531923=_0x1156('0x5d')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x531923,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')][_0x1156('0x5e')],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x11d1d5){var _0x1e373c=_[_0x1156('0x2f')](_0x11d1d5,function(_0x3d37fe){return Number(_0x3d37fe[_0x1156('0x5f')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x44937c},'VoiceQueueId':{'$in':_0x1e373c}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){var _0x2f1bee='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x250617;return db['sequelize'][_0x1156('0x35')](_0x2f1bee,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')][_0x1156('0x5e')],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x366dd1){var _0x2b4d29=_[_0x1156('0x2f')](_0x366dd1,function(_0x2d04f1){return Number(_0x2d04f1[_0x1156('0x60')]);});return db[_0x1156('0x61')][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'MailQueueId':{'$in':_0x2b4d29}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){var _0x3a619d=_0x1156('0x62')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x3a619d,{'type':db['Sequelize'][_0x1156('0x5c')]['SELECT'],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x778486){var _0x2c8919=_[_0x1156('0x2f')](_0x778486,function(_0x3219e4){return Number(_0x3219e4[_0x1156('0x63')]);});return db[_0x1156('0x64')][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'SmsQueueId':{'$in':_0x2c8919}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){var _0x15adc8=_0x1156('0x65')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x15adc8,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')][_0x1156('0x5e')],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x171517){var _0x18209c=_['map'](_0x171517,function(_0x3eb291){return Number(_0x3eb291['ChatQueueId']);});return db[_0x1156('0x66')][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'ChatQueueId':{'$in':_0x18209c}},'transaction':_0x183a28});})['then'](function(){var _0x453e29=_0x1156('0x67')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x453e29,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')][_0x1156('0x5e')],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x317db2){var _0x55548c=_[_0x1156('0x2f')](_0x317db2,function(_0x184aae){return Number(_0x184aae[_0x1156('0x68')]);});return db['UserFaxQueue'][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'FaxQueueId':{'$in':_0x55548c}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){var _0x137b7c=_0x1156('0x69')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x137b7c,{'type':db[_0x1156('0x5b')][_0x1156('0x5c')]['SELECT'],'raw':!![],'transaction':_0x183a28});})['then'](function(_0x1677de){var _0x4d00a7=_['map'](_0x1677de,function(_0x5c0986){return Number(_0x5c0986['OpenchannelQueueId']);});return db[_0x1156('0x6a')][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'OpenchannelQueueId':{'$in':_0x4d00a7}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){var _0x5b5362=_0x1156('0x6b')+_0x250617;return db[_0x1156('0x58')][_0x1156('0x35')](_0x5b5362,{'type':db['Sequelize']['QueryTypes'][_0x1156('0x5e')],'raw':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x53d4d2){var _0x3db30f=_[_0x1156('0x2f')](_0x53d4d2,function(_0x2942af){return Number(_0x2942af['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'WhatsappQueueId':{'$in':_0x3db30f}},'transaction':_0x183a28});})[_0x1156('0x48')](function(){return db[_0x1156('0x6c')]['find']({'where':{'TeamId':_0x250617}});})['then'](function(_0x2c5993){if(_0x2c5993===null){return;}return db[_0x1156('0x6d')][_0x1156('0x57')]({'where':{'UserId':{'$in':_0x44937c},'VoicePrefixId':_0x2c5993['VoicePrefixId']},'transaction':_0x183a28});})[_0x1156('0x48')](function(){return db[_0x1156('0x30')][_0x1156('0x57')]({'where':{'id':_0x250617},'cascade':!![],'transaction':_0x183a28});})[_0x1156('0x48')](function(_0x5b3e37){if(_0x5b3e37===0x0){_0x3d86bf['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x1156('0x57')]({'where':{'type':_0x1156('0x51'),'resourceId':_0x250617},'cascade':!![],'transaction':_0x183a28})[_0x1156('0x48')](function(){_0x3d86bf[_0x1156('0x20')](0xcc)[_0x1156('0x6e')]();});}})['catch'](function(_0xfaadd5){_0x3d86bf[_0x1156('0x20')](0x1f4)[_0x1156('0x2d')](_0xfaadd5);});});};exports[_0x1156('0x6f')]=function(_0x5da064,_0x596f7c,_0x52c199){return db['Team'][_0x1156('0x70')]({'where':{'id':_0x5da064[_0x1156('0x56')]['id']}})['then'](handleEntityNotFound(_0x596f7c,null))[_0x1156('0x48')](function(_0x2b7825){if(!_0x5da064[_0x1156('0x35')][_0x1156('0x71')]||!utils[_0x1156('0x72')](_0x5da064[_0x1156('0x35')][_0x1156('0x71')])){throw new db[(_0x1156('0x5b'))]['ValidationError'](_0x1156('0x73'));}var _0x1ca9f4={};var _0x48a37f={};_0x48a37f[_0x1156('0x34')]=_[_0x1156('0x36')](db[_['capitalize'](_0x5da064[_0x1156('0x35')]['channel'][_0x1156('0x74')]())+_0x1156('0x75')][_0x1156('0x31')]);_0x48a37f[_0x1156('0x35')]=_['keys'](_0x5da064[_0x1156('0x35')]);_0x48a37f['filters']=_[_0x1156('0x37')](_0x48a37f[_0x1156('0x34')],_0x48a37f[_0x1156('0x35')]);_0x1ca9f4[_0x1156('0x38')]=_[_0x1156('0x37')](_0x48a37f['model'],qs[_0x1156('0x39')](_0x5da064['query'][_0x1156('0x39')]));_0x1ca9f4[_0x1156('0x38')]=_0x1ca9f4[_0x1156('0x38')]['length']?_0x1ca9f4[_0x1156('0x38')]:_0x48a37f[_0x1156('0x34')];_0x1ca9f4['limit']=qs[_0x1156('0x24')](_0x5da064[_0x1156('0x35')][_0x1156('0x24')]);_0x1ca9f4['offset']=qs[_0x1156('0x22')](_0x5da064['query'][_0x1156('0x22')]);_0x1ca9f4[_0x1156('0x3c')]=qs['sort'](_0x5da064['query'][_0x1156('0x3d')]);_0x1ca9f4['where']=qs['filters'](_[_0x1156('0x3f')](_0x5da064[_0x1156('0x35')],_0x48a37f[_0x1156('0x40')]));_0x1ca9f4=_[_0x1156('0x42')]({},_0x1ca9f4,_0x5da064[_0x1156('0x44')]);return _0x2b7825[_0x1156('0x4e')+_['capitalize'](_0x5da064[_0x1156('0x35')][_0x1156('0x71')][_0x1156('0x74')]())+'Queues'](_0x1ca9f4);})['then'](respondWithResult(_0x596f7c,null))[_0x1156('0x54')](handleError(_0x596f7c,null));};exports['addQueues']=function(_0x59b828,_0x35f915,_0x55988f){return db[_0x1156('0x30')][_0x1156('0x70')]({'where':{'id':_0x59b828['params']['id']}})[_0x1156('0x48')](function(_0x5cb488){if(_0x5cb488){if(!_0x59b828[_0x1156('0x4c')][_0x1156('0x71')]||!utils[_0x1156('0x72')](_0x59b828[_0x1156('0x4c')][_0x1156('0x71')])){throw new db[(_0x1156('0x5b'))][(_0x1156('0x76'))](_0x1156('0x73'));}return _0x5cb488[_0x1156('0x77')+_[_0x1156('0x78')](_0x59b828[_0x1156('0x4c')][_0x1156('0x71')][_0x1156('0x74')]())+_0x1156('0x79')](_0x59b828[_0x1156('0x4c')][_0x1156('0x7a')]);}return null;})[_0x1156('0x48')](handleEntityNotFound(_0x35f915,null))['then'](respondWithStatusCode(_0x35f915,null))[_0x1156('0x54')](handleError(_0x35f915,null));};exports['removeQueues']=function(_0x5976f1,_0x344013,_0xc88fc3){return db['Team'][_0x1156('0x70')]({'where':{'id':_0x5976f1[_0x1156('0x56')]['id']}})['then'](function(_0x28220f){if(_0x28220f){if(!_0x5976f1[_0x1156('0x35')][_0x1156('0x71')]||!utils['isValidChannel'](_0x5976f1[_0x1156('0x35')][_0x1156('0x71')])){throw new db['Sequelize'][(_0x1156('0x76'))](_0x1156('0x73'));}return _0x28220f[_0x1156('0x7b')+_[_0x1156('0x78')](_0x5976f1[_0x1156('0x35')]['channel']['toLowerCase']())+_0x1156('0x79')](_0x5976f1[_0x1156('0x35')][_0x1156('0x7a')]);}return null;})[_0x1156('0x48')](handleEntityNotFound(_0x344013,null))['then'](respondWithStatusCode(_0x344013,null))['catch'](handleError(_0x344013,null));};exports[_0x1156('0x7c')]=function(_0x202ca9,_0x41be2d){var _0x4f98d8=_[_0x1156('0x7d')](_0x202ca9[_0x1156('0x4c')][_0x1156('0x7a')])?_0x202ca9['body']['ids']:[_0x202ca9[_0x1156('0x4c')][_0x1156('0x7a')]];var _0x1397a4=_0x202ca9[_0x1156('0x56')]['id'];return db[_0x1156('0x30')][_0x1156('0x4a')]({'where':{'id':_0x1397a4}})[_0x1156('0x48')](handleEntityNotFound(_0x41be2d,null))[_0x1156('0x48')](function(_0x57cdc5){if(_0x57cdc5){var _0x4cbb73=[_0x1156('0x7e'),'Chat','Mail',_0x1156('0x7f'),_0x1156('0x80'),'Openchannel','Whatsapp'];return db[_0x1156('0x58')][_0x1156('0x59')](function(_0x3a2a97){var _0x565f54=_[_0x1156('0x2f')](_0x4cbb73,function(_0x336dac){var _0xa2f4d={'attributes':['id','name']};if(_0x336dac===_0x1156('0x7e')){_0xa2f4d[_0x1156('0x81')]={'attributes':[_0x1156('0x82')]};}return _0x57cdc5[_0x1156('0x4e')+_0x336dac+_0x1156('0x79')](_0xa2f4d)[_0x1156('0x48')](function(_0x384274){var _0x4f6609=_[_0x1156('0x2f')](_0x384274,function(_0x3f3a90){var _0x276afc=_[_0x1156('0x2f')](_0x4f98d8,function(_0x3b8a8d){var _0xbad81d={'where':{'UserId':_0x3b8a8d,[_0x336dac+'QueueId']:_0x3f3a90['id']},'transaction':_0x3a2a97};if(_0x336dac===_0x1156('0x7e')){_0xbad81d[_0x1156('0x19')]={'penalty':_0x3f3a90[_0x1156('0x83')][_0x1156('0x82')]};}return db[_0x1156('0x84')+_0x336dac+'Queue']['findOrCreate'](_0xbad81d)['then'](function(){socket[_0x1156('0x85')](_0x1156('0x4d')+_0x336dac+_0x1156('0x86'),{'UserId':_0x3b8a8d,[_0x336dac+_0x1156('0x87')]:_0x3f3a90['id']});if(_0x336dac!==_0x1156('0x7e')){return;}return db['User'][_0x1156('0x47')]({'where':{'id':_0x4f98d8,'online':0x1},'attributes':['id',_0x1156('0x2c'),_0x1156('0x88'),_0x1156('0x89'),_0x1156('0x8a')],'raw':!![]})[_0x1156('0x48')](function(_0x344d45){var _0x52c96e=_[_0x1156('0x2f')](_0x344d45,function(_0x5e7db8){return db[_0x1156('0x8b')][_0x1156('0x8c')]({'membername':_0x5e7db8[_0x1156('0x2c')],'UserId':_0x5e7db8['id'],'queue_name':_0x3f3a90['name'],'VoiceQueueId':_0x3f3a90['id'],'interface':_[_0x1156('0x8d')](_0x5e7db8[_0x1156('0x8a')])?util[_0x1156('0x8e')](_0x1156('0x8f'),_0x5e7db8[_0x1156('0x2c')]):_0x5e7db8['interface'],'paused':_0x5e7db8[_0x1156('0x89')]||![],'penalty':_0x3f3a90[_0x1156('0x83')]['penalty']},{'transaction':_0x3a2a97});});return Promise[_0x1156('0x90')](_0x52c96e);});});});return Promise['all'](_0x276afc);});return Promise[_0x1156('0x90')](_0x4f6609);})[_0x1156('0x48')](function(){return db[_0x1156('0x6c')][_0x1156('0x70')]({'where':{'teamId':_0x1397a4}})[_0x1156('0x48')](function(_0x2503d4){if(_0x2503d4){var _0x24bb54=_[_0x1156('0x2f')](_0x4f98d8,function(_0x46f994){db[_0x1156('0x6d')]['upsert']({'UserId':_0x46f994,'VoicePrefixId':_0x2503d4['VoicePrefixId']});});return Promise[_0x1156('0x90')](_0x24bb54);}});});});return Promise[_0x1156('0x90')](_0x565f54)[_0x1156('0x48')](function(){return _0x57cdc5[_0x1156('0x7c')](_0x4f98d8,{'transaction':_0x3a2a97})[_0x1156('0x91')](function(_0x5dcb1f){return _0x5dcb1f;});});});}})[_0x1156('0x48')](respondWithResult(_0x41be2d,null))[_0x1156('0x54')](handleError(_0x41be2d,null));};exports[_0x1156('0x92')]=function(_0x39fd6c,_0x5c6433){var _0x419334=_['isArray'](_0x39fd6c[_0x1156('0x35')]['ids'])?_0x39fd6c[_0x1156('0x35')][_0x1156('0x7a')]:[_0x39fd6c[_0x1156('0x35')]['ids']];var _0x4fe19c=_0x39fd6c[_0x1156('0x56')]['id'];return db['Team']['find']({'where':{'id':_0x4fe19c}})[_0x1156('0x48')](handleEntityNotFound(_0x5c6433,null))[_0x1156('0x48')](function(_0x1bb95d){if(_0x1bb95d){var _0x3c681e=[_0x1156('0x7e'),_0x1156('0x93'),'Mail',_0x1156('0x7f'),_0x1156('0x80'),'Openchannel',_0x1156('0x94')];return db[_0x1156('0x58')][_0x1156('0x59')](function(_0x5e9e52){var _0x3d0765=_[_0x1156('0x2f')](_0x3c681e,function(_0x39cbb1){var _0x299b6e={'attributes':['id','name']};return _0x1bb95d['get'+_0x39cbb1+_0x1156('0x79')](_0x299b6e)[_0x1156('0x48')](function(_0x214fb1){var _0x4494ae=_[_0x1156('0x2f')](_0x214fb1,function(_0x284cb2){return _0x284cb2['removeAgents'](_0x419334,{'transaction':_0x5e9e52})['then'](function(){var _0x29b9b6=_[_0x1156('0x2f')](_0x419334,function(_0x2eae39){socket[_0x1156('0x85')]('user'+_0x39cbb1+_0x1156('0x95'),{'UserId':Number(_0x2eae39),[_0x39cbb1+_0x1156('0x87')]:_0x284cb2['id']});if(_0x39cbb1!==_0x1156('0x7e')){return;}return db[_0x1156('0x8b')]['destroy']({'where':{'VoiceQueueId':_0x284cb2['id'],'UserId':_0x2eae39},'transaction':_0x5e9e52});});return Promise[_0x1156('0x90')](_0x29b9b6);});});return Promise[_0x1156('0x90')](_0x4494ae);});});return Promise[_0x1156('0x90')](_0x3d0765)[_0x1156('0x48')](function(){return _0x1bb95d[_0x1156('0x92')](_0x419334,{'transaction':_0x5e9e52});})[_0x1156('0x48')](function(){return db[_0x1156('0x6c')]['findOne']({'where':{'teamId':_0x4fe19c}})[_0x1156('0x48')](function(_0x169bd3){if(_0x169bd3){var _0x21fd5d=_['map'](_0x419334,function(_0x433851){db[_0x1156('0x6d')][_0x1156('0x57')]({'where':{'UserId':_0x433851,'VoicePrefixId':_0x169bd3[_0x1156('0x96')]}});});return Promise[_0x1156('0x90')](_0x21fd5d);}});});});}})['then'](respondWithStatusCode(_0x5c6433,null))['catch'](handleError(_0x5c6433,null));};exports[_0x1156('0x97')]=function(_0x20e2a1,_0x4dd098,_0x3103b6){var _0x240b98={};var _0x5d4c54={};var _0xed0d73;var _0x1c298d;return db[_0x1156('0x30')][_0x1156('0x70')]({'where':{'id':_0x20e2a1[_0x1156('0x56')]['id']}})[_0x1156('0x48')](handleEntityNotFound(_0x4dd098,null))['then'](function(_0x2aae4a){if(_0x2aae4a){_0xed0d73=_0x2aae4a;_0x5d4c54[_0x1156('0x34')]=_['keys'](db['User'][_0x1156('0x31')]);_0x5d4c54[_0x1156('0x35')]=_['keys'](_0x20e2a1[_0x1156('0x35')]);_0x5d4c54[_0x1156('0x40')]=_[_0x1156('0x37')](_0x5d4c54['model'],_0x5d4c54[_0x1156('0x35')]);_0x240b98[_0x1156('0x38')]=_['intersection'](_0x5d4c54[_0x1156('0x34')],qs[_0x1156('0x39')](_0x20e2a1[_0x1156('0x35')][_0x1156('0x39')]));_0x240b98[_0x1156('0x38')]=_0x240b98[_0x1156('0x38')]['length']?_0x240b98[_0x1156('0x38')]:_0x5d4c54[_0x1156('0x34')];_0x240b98[_0x1156('0x3c')]=qs[_0x1156('0x3d')](_0x20e2a1[_0x1156('0x35')]['sort']);_0x240b98[_0x1156('0x3e')]=qs[_0x1156('0x40')](_[_0x1156('0x3f')](_0x20e2a1[_0x1156('0x35')],_0x5d4c54['filters']));if(_0x20e2a1[_0x1156('0x35')][_0x1156('0x41')]){_0x240b98['where']=_[_0x1156('0x42')](_0x240b98[_0x1156('0x3e')],{'$or':_['map'](_0x240b98[_0x1156('0x38')],function(_0x28fec1){var _0x209fda={};_0x209fda[_0x28fec1]={'$like':'%'+_0x20e2a1[_0x1156('0x35')]['filter']+'%'};return _0x209fda;})});}_0x240b98=_['merge']({},_0x240b98,_0x20e2a1['options']);return _0xed0d73[_0x1156('0x97')](_0x240b98);}})['then'](function(_0x2ee2d2){if(_0x2ee2d2){_0x1c298d=_0x2ee2d2[_0x1156('0x98')];if(!_0x20e2a1[_0x1156('0x35')][_0x1156('0x3a')](_0x1156('0x3b'))){_0x240b98['limit']=qs[_0x1156('0x24')](_0x20e2a1[_0x1156('0x35')][_0x1156('0x24')]);_0x240b98[_0x1156('0x22')]=qs[_0x1156('0x22')](_0x20e2a1[_0x1156('0x35')][_0x1156('0x22')]);}return _0xed0d73[_0x1156('0x97')](_0x240b98);}})[_0x1156('0x48')](function(_0x5c3951){if(_0x5c3951){return _0x5c3951?{'count':_0x1c298d,'rows':_0x5c3951}:null;}})[_0x1156('0x48')](respondWithResult(_0x4dd098,null))[_0x1156('0x54')](handleError(_0x4dd098,null));}; \ No newline at end of file +var _0x4569=['model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserVoicePrefix','UserProfileResource','Teams','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','isValidChannel','ValidationError','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','User','findOrCreate','emit','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','VoicePrefixId','spread','Whatsapp','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','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','./team.socket','status','end','json','offset','undefined','count','limit','Content-Range','save','update','then','sendStatus','error','stack','name','send','map','Team','rawAttributes','type','key'];(function(_0x196d81,_0x3ee6c0){var _0x4e76c9=function(_0x14b0a3){while(--_0x14b0a3){_0x196d81['push'](_0x196d81['shift']());}};_0x4e76c9(++_0x3ee6c0);}(_0x4569,0xf8));var _0x9456=function(_0x1eac66,_0x555910){_0x1eac66=_0x1eac66-0x0;var _0xb2ad5e=_0x4569[_0x1eac66];return _0xb2ad5e;};'use strict';var emlformat=require(_0x9456('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9456('0x1'));var jsonpatch=require(_0x9456('0x2'));var rp=require(_0x9456('0x3'));var moment=require(_0x9456('0x4'));var BPromise=require(_0x9456('0x5'));var Mustache=require(_0x9456('0x6'));var util=require(_0x9456('0x7'));var path=require(_0x9456('0x8'));var sox=require('sox');var csv=require(_0x9456('0x9'));var ejs=require(_0x9456('0xa'));var fs=require('fs');var fs_extra=require(_0x9456('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9456('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9456('0xd'));var Papa=require('papaparse');var Redis=require(_0x9456('0xe'));var authService=require(_0x9456('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9456('0x10'));var hardwareService=require(_0x9456('0x11'));var logger=require(_0x9456('0x12'))(_0x9456('0x13'));var utils=require(_0x9456('0x14'));var config=require(_0x9456('0x15'));var licenseUtil=require(_0x9456('0x16'));var db=require(_0x9456('0x17'))['db'];config[_0x9456('0x18')]=_[_0x9456('0x19')](config[_0x9456('0x18')],{'host':_0x9456('0x1a'),'port':0x18eb});var socket=require(_0x9456('0x1b'))(new Redis(config[_0x9456('0x18')]));require(_0x9456('0x1c'))['register'](socket);function respondWithStatusCode(_0xb8e28f,_0x200838){_0x200838=_0x200838||0xcc;return function(_0x2d4689){if(_0x2d4689){return _0xb8e28f['sendStatus'](_0x200838);}return _0xb8e28f[_0x9456('0x1d')](_0x200838)[_0x9456('0x1e')]();};}function respondWithResult(_0x307876,_0x3bbd33){_0x3bbd33=_0x3bbd33||0xc8;return function(_0x405c6c){if(_0x405c6c){return _0x307876['status'](_0x3bbd33)[_0x9456('0x1f')](_0x405c6c);}};}function respondWithFilteredResult(_0xccfff,_0x5c02d2){return function(_0x372269){if(_0x372269){var _0x3d55be=typeof _0x5c02d2[_0x9456('0x20')]===_0x9456('0x21')&&typeof _0x5c02d2['limit']===_0x9456('0x21');var _0xb24c29=_0x372269['count'];var _0x2016a9=_0x3d55be?0x0:_0x5c02d2[_0x9456('0x20')];var _0x111ea3=_0x3d55be?_0x372269[_0x9456('0x22')]:_0x5c02d2[_0x9456('0x20')]+_0x5c02d2[_0x9456('0x23')];var _0x39cecc;if(_0x111ea3>=_0xb24c29){_0x111ea3=_0xb24c29;_0x39cecc=0xc8;}else{_0x39cecc=0xce;}_0xccfff[_0x9456('0x1d')](_0x39cecc);return _0xccfff['set'](_0x9456('0x24'),_0x2016a9+'-'+_0x111ea3+'/'+_0xb24c29)[_0x9456('0x1f')](_0x372269);}return null;};}function patchUpdates(_0x57d511){return function(_0x2ee362){try{jsonpatch['apply'](_0x2ee362,_0x57d511,!![]);}catch(_0x23727f){return BPromise['reject'](_0x23727f);}return _0x2ee362[_0x9456('0x25')]();};}function saveUpdates(_0x5455e5,_0x21a53f){return function(_0x41ffe7){if(_0x41ffe7){return _0x41ffe7[_0x9456('0x26')](_0x5455e5)[_0x9456('0x27')](function(_0x37102b){return _0x37102b;});}return null;};}function handleEntityNotFound(_0x305123,_0x257c62){return function(_0x289c7c){if(!_0x289c7c){_0x305123[_0x9456('0x28')](0x194);}return _0x289c7c;};}function handleError(_0x621cff,_0x327af3){_0x327af3=_0x327af3||0x1f4;return function(_0x240d9e){logger[_0x9456('0x29')](_0x240d9e[_0x9456('0x2a')]);if(_0x240d9e['name']){delete _0x240d9e[_0x9456('0x2b')];}_0x621cff['status'](_0x327af3)[_0x9456('0x2c')](_0x240d9e);};}exports['index']=function(_0x296d6f,_0x448bab){var _0x34f663={},_0x2f1b74={},_0x187423={'count':0x0,'rows':[]};var _0x499ea8=_[_0x9456('0x2d')](db[_0x9456('0x2e')][_0x9456('0x2f')],function(_0x48e980){return{'name':_0x48e980['fieldName'],'type':_0x48e980[_0x9456('0x30')][_0x9456('0x31')]};});_0x2f1b74[_0x9456('0x32')]=_[_0x9456('0x2d')](_0x499ea8,_0x9456('0x2b'));_0x2f1b74[_0x9456('0x33')]=_[_0x9456('0x34')](_0x296d6f[_0x9456('0x33')]);_0x2f1b74[_0x9456('0x35')]=_['intersection'](_0x2f1b74['model'],_0x2f1b74[_0x9456('0x33')]);_0x34f663[_0x9456('0x36')]=_[_0x9456('0x37')](_0x2f1b74['model'],qs[_0x9456('0x38')](_0x296d6f['query'][_0x9456('0x38')]));_0x34f663[_0x9456('0x36')]=_0x34f663[_0x9456('0x36')][_0x9456('0x39')]?_0x34f663['attributes']:_0x2f1b74[_0x9456('0x32')];if(!_0x296d6f[_0x9456('0x33')]['hasOwnProperty'](_0x9456('0x3a'))){_0x34f663[_0x9456('0x23')]=qs[_0x9456('0x23')](_0x296d6f[_0x9456('0x33')][_0x9456('0x23')]);_0x34f663[_0x9456('0x20')]=qs['offset'](_0x296d6f[_0x9456('0x33')][_0x9456('0x20')]);}_0x34f663['order']=qs[_0x9456('0x3b')](_0x296d6f[_0x9456('0x33')]['sort']);_0x34f663[_0x9456('0x3c')]=qs[_0x9456('0x35')](_[_0x9456('0x3d')](_0x296d6f[_0x9456('0x33')],_0x2f1b74[_0x9456('0x35')]),_0x499ea8);if(_0x296d6f[_0x9456('0x33')][_0x9456('0x3e')]){_0x34f663[_0x9456('0x3c')]=_[_0x9456('0x3f')](_0x34f663[_0x9456('0x3c')],{'$or':_[_0x9456('0x2d')](_0x499ea8,function(_0x3577ed){if(_0x3577ed[_0x9456('0x30')]!==_0x9456('0x40')){var _0x1a45ea={};_0x1a45ea[_0x3577ed[_0x9456('0x2b')]]={'$like':'%'+_0x296d6f[_0x9456('0x33')][_0x9456('0x3e')]+'%'};return _0x1a45ea;}})});}_0x34f663=_[_0x9456('0x3f')]({},_0x34f663,_0x296d6f['options']);var _0x342b1c={'where':_0x34f663['where']};return db[_0x9456('0x2e')][_0x9456('0x22')](_0x342b1c)[_0x9456('0x27')](function(_0x7bf36c){_0x187423[_0x9456('0x22')]=_0x7bf36c;if(_0x296d6f[_0x9456('0x33')][_0x9456('0x41')]){_0x34f663[_0x9456('0x42')]=[{'all':!![]}];}return db[_0x9456('0x2e')][_0x9456('0x43')](_0x34f663);})[_0x9456('0x27')](function(_0x3b2603){_0x187423['rows']=_0x3b2603;return _0x187423;})['then'](respondWithFilteredResult(_0x448bab,_0x34f663))['catch'](handleError(_0x448bab,null));};exports[_0x9456('0x44')]=function(_0x1e4f8d,_0x9f0308){var _0x234ab2={'raw':![],'where':{'id':_0x1e4f8d[_0x9456('0x45')]['id']}},_0x2e40a9={};_0x2e40a9[_0x9456('0x32')]=_['keys'](db[_0x9456('0x2e')][_0x9456('0x2f')]);_0x2e40a9[_0x9456('0x33')]=_[_0x9456('0x34')](_0x1e4f8d[_0x9456('0x33')]);_0x2e40a9[_0x9456('0x35')]=_[_0x9456('0x37')](_0x2e40a9[_0x9456('0x32')],_0x2e40a9['query']);_0x234ab2['attributes']=_[_0x9456('0x37')](_0x2e40a9[_0x9456('0x32')],qs[_0x9456('0x38')](_0x1e4f8d[_0x9456('0x33')]['fields']));_0x234ab2[_0x9456('0x36')]=_0x234ab2['attributes'][_0x9456('0x39')]?_0x234ab2['attributes']:_0x2e40a9[_0x9456('0x32')];if(_0x1e4f8d[_0x9456('0x33')][_0x9456('0x41')]){_0x234ab2[_0x9456('0x42')]=[{'all':!![]}];}_0x234ab2=_[_0x9456('0x3f')]({},_0x234ab2,_0x1e4f8d[_0x9456('0x46')]);return db[_0x9456('0x2e')][_0x9456('0x47')](_0x234ab2)['then'](handleEntityNotFound(_0x9f0308,null))[_0x9456('0x27')](respondWithResult(_0x9f0308,null))[_0x9456('0x48')](handleError(_0x9f0308,null));};exports[_0x9456('0x49')]=function(_0x29f4ed,_0x13d2cc){return db[_0x9456('0x2e')]['create'](_0x29f4ed['body'],{})[_0x9456('0x27')](function(_0x585483){var _0x195fed=_0x29f4ed['user']['get']({'plain':!![]});if(!_0x195fed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x195fed['role']===_0x9456('0x4a')){var _0x2edaec=_0x585483[_0x9456('0x4b')]({'plain':!![]});var _0x22c215='Teams';return db[_0x9456('0x4c')][_0x9456('0x47')]({'where':{'name':_0x22c215,'userProfileId':_0x195fed['userProfileId']},'raw':!![]})[_0x9456('0x27')](function(_0x4a23f3){if(_0x4a23f3&&_0x4a23f3[_0x9456('0x4d')]===0x0){return db['UserProfileResource'][_0x9456('0x49')]({'name':_0x2edaec[_0x9456('0x2b')],'resourceId':_0x2edaec['id'],'type':_0x4a23f3[_0x9456('0x2b')],'sectionId':_0x4a23f3['id']},{})[_0x9456('0x27')](function(){return _0x585483;});}else{return _0x585483;}})[_0x9456('0x48')](function(_0x525cea){logger[_0x9456('0x29')](_0x9456('0x4e'),_0x525cea);throw _0x525cea;});}return _0x585483;})[_0x9456('0x27')](respondWithResult(_0x13d2cc,0xc9))[_0x9456('0x48')](handleError(_0x13d2cc,null));};exports[_0x9456('0x26')]=function(_0x18c2e8,_0x21f64a){if(_0x18c2e8[_0x9456('0x4f')]['id']){delete _0x18c2e8[_0x9456('0x4f')]['id'];}return db[_0x9456('0x2e')]['find']({'where':{'id':_0x18c2e8[_0x9456('0x45')]['id']}})['then'](handleEntityNotFound(_0x21f64a,null))[_0x9456('0x27')](saveUpdates(_0x18c2e8['body'],null))[_0x9456('0x27')](respondWithResult(_0x21f64a,null))['catch'](handleError(_0x21f64a,null));};exports[_0x9456('0x50')]=function(_0x3ec54e,_0x1e0dd7){var _0x14ad46=_0x3ec54e[_0x9456('0x45')]['id'];var _0x276a7a=[];return db['sequelize'][_0x9456('0x51')](function(_0xad1791){var _0x1c9683=_0x9456('0x52')+_0x14ad46;return db[_0x9456('0x53')][_0x9456('0x33')](_0x1c9683,{'type':db['Sequelize'][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791})[_0x9456('0x27')](function(_0x91250a){_0x276a7a=_[_0x9456('0x2d')](_0x91250a,function(_0x1bc51c){return Number(_0x1bc51c['UserId']);});})[_0x9456('0x27')](function(){var _0x2bfa7f=_0x9456('0x56')+_0x14ad46;return db['sequelize']['query'](_0x2bfa7f,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0x43ee25){var _0x7c2c8f=_[_0x9456('0x2d')](_0x43ee25,function(_0x38038e){return Number(_0x38038e[_0x9456('0x58')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x276a7a},'VoiceQueueId':{'$in':_0x7c2c8f}},'transaction':_0xad1791});})[_0x9456('0x27')](function(){var _0x276daf=_0x9456('0x59')+_0x14ad46;return db[_0x9456('0x53')]['query'](_0x276daf,{'type':db[_0x9456('0x57')][_0x9456('0x54')]['SELECT'],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0x700283){var _0x14eb15=_[_0x9456('0x2d')](_0x700283,function(_0x3ff92f){return Number(_0x3ff92f[_0x9456('0x5a')]);});return db[_0x9456('0x5b')][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'MailQueueId':{'$in':_0x14eb15}},'transaction':_0xad1791});})[_0x9456('0x27')](function(){var _0x573c1b='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x14ad46;return db['sequelize']['query'](_0x573c1b,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0x43c761){var _0x173de3=_[_0x9456('0x2d')](_0x43c761,function(_0x1d387b){return Number(_0x1d387b[_0x9456('0x5c')]);});return db[_0x9456('0x5d')][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'SmsQueueId':{'$in':_0x173de3}},'transaction':_0xad1791});})['then'](function(){var _0x28f953='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x14ad46;return db['sequelize'][_0x9456('0x33')](_0x28f953,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})['then'](function(_0x5e60f4){var _0x1ff2c4=_['map'](_0x5e60f4,function(_0x118375){return Number(_0x118375[_0x9456('0x5e')]);});return db[_0x9456('0x5f')][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'ChatQueueId':{'$in':_0x1ff2c4}},'transaction':_0xad1791});})['then'](function(){var _0x414fea=_0x9456('0x60')+_0x14ad46;return db[_0x9456('0x53')][_0x9456('0x33')](_0x414fea,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0xf1b448){var _0x4af829=_[_0x9456('0x2d')](_0xf1b448,function(_0x11e409){return Number(_0x11e409['FaxQueueId']);});return db['UserFaxQueue'][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'FaxQueueId':{'$in':_0x4af829}},'transaction':_0xad1791});})[_0x9456('0x27')](function(){var _0x5254cd=_0x9456('0x61')+_0x14ad46;return db[_0x9456('0x53')][_0x9456('0x33')](_0x5254cd,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0xcac110){var _0x57bd68=_[_0x9456('0x2d')](_0xcac110,function(_0x47605d){return Number(_0x47605d[_0x9456('0x62')]);});return db[_0x9456('0x63')][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'OpenchannelQueueId':{'$in':_0x57bd68}},'transaction':_0xad1791});})['then'](function(){var _0x417850='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x14ad46;return db['sequelize']['query'](_0x417850,{'type':db[_0x9456('0x57')][_0x9456('0x54')][_0x9456('0x55')],'raw':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0x461899){var _0x4522ad=_['map'](_0x461899,function(_0x31ef4a){return Number(_0x31ef4a[_0x9456('0x64')]);});return db['UserWhatsappQueue'][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'WhatsappQueueId':{'$in':_0x4522ad}},'transaction':_0xad1791});})['then'](function(){return db['TeamVoicePrefix'][_0x9456('0x47')]({'where':{'TeamId':_0x14ad46}});})[_0x9456('0x27')](function(_0x58b994){if(_0x58b994===null){return;}return db[_0x9456('0x65')][_0x9456('0x50')]({'where':{'UserId':{'$in':_0x276a7a},'VoicePrefixId':_0x58b994['VoicePrefixId']},'transaction':_0xad1791});})[_0x9456('0x27')](function(){return db[_0x9456('0x2e')][_0x9456('0x50')]({'where':{'id':_0x14ad46},'cascade':!![],'transaction':_0xad1791});})[_0x9456('0x27')](function(_0x5c2bc3){if(_0x5c2bc3===0x0){_0x1e0dd7[_0x9456('0x28')](0x194);}else{return db[_0x9456('0x66')][_0x9456('0x50')]({'where':{'type':_0x9456('0x67'),'resourceId':_0x14ad46},'cascade':!![],'transaction':_0xad1791})[_0x9456('0x27')](function(){_0x1e0dd7['status'](0xcc)['end']();});}})[_0x9456('0x48')](function(_0x2455d0){_0x1e0dd7['status'](0x1f4)[_0x9456('0x2c')](_0x2455d0);});});};exports[_0x9456('0x68')]=function(_0x562795,_0x43a16d,_0x4e15ec){return db[_0x9456('0x2e')][_0x9456('0x69')]({'where':{'id':_0x562795[_0x9456('0x45')]['id']}})[_0x9456('0x27')](handleEntityNotFound(_0x43a16d,null))[_0x9456('0x27')](function(_0x1938f3){if(!_0x562795[_0x9456('0x33')][_0x9456('0x6a')]||!utils['isValidChannel'](_0x562795[_0x9456('0x33')][_0x9456('0x6a')])){throw new db['Sequelize']['ValidationError'](_0x9456('0x6b'));}var _0x64b40e={};var _0x4b410a={};_0x4b410a[_0x9456('0x32')]=_[_0x9456('0x34')](db[_[_0x9456('0x6c')](_0x562795[_0x9456('0x33')]['channel'][_0x9456('0x6d')]())+_0x9456('0x6e')][_0x9456('0x2f')]);_0x4b410a[_0x9456('0x33')]=_[_0x9456('0x34')](_0x562795[_0x9456('0x33')]);_0x4b410a['filters']=_[_0x9456('0x37')](_0x4b410a['model'],_0x4b410a[_0x9456('0x33')]);_0x64b40e[_0x9456('0x36')]=_[_0x9456('0x37')](_0x4b410a[_0x9456('0x32')],qs['fields'](_0x562795[_0x9456('0x33')][_0x9456('0x38')]));_0x64b40e[_0x9456('0x36')]=_0x64b40e[_0x9456('0x36')][_0x9456('0x39')]?_0x64b40e[_0x9456('0x36')]:_0x4b410a['model'];_0x64b40e['limit']=qs[_0x9456('0x23')](_0x562795[_0x9456('0x33')][_0x9456('0x23')]);_0x64b40e['offset']=qs[_0x9456('0x20')](_0x562795['query'][_0x9456('0x20')]);_0x64b40e['order']=qs[_0x9456('0x3b')](_0x562795[_0x9456('0x33')][_0x9456('0x3b')]);_0x64b40e[_0x9456('0x3c')]=qs[_0x9456('0x35')](_[_0x9456('0x3d')](_0x562795['query'],_0x4b410a[_0x9456('0x35')]));_0x64b40e=_[_0x9456('0x3f')]({},_0x64b40e,_0x562795[_0x9456('0x46')]);return _0x1938f3['get'+_[_0x9456('0x6c')](_0x562795[_0x9456('0x33')][_0x9456('0x6a')][_0x9456('0x6d')]())+'Queues'](_0x64b40e);})[_0x9456('0x27')](respondWithResult(_0x43a16d,null))[_0x9456('0x48')](handleError(_0x43a16d,null));};exports[_0x9456('0x6f')]=function(_0x7f831a,_0x584a3f,_0x2d835b){return db[_0x9456('0x2e')][_0x9456('0x69')]({'where':{'id':_0x7f831a[_0x9456('0x45')]['id']}})[_0x9456('0x27')](function(_0x4e9287){if(_0x4e9287){if(!_0x7f831a[_0x9456('0x4f')][_0x9456('0x6a')]||!utils[_0x9456('0x70')](_0x7f831a[_0x9456('0x4f')]['channel'])){throw new db[(_0x9456('0x57'))][(_0x9456('0x71'))](_0x9456('0x6b'));}return _0x4e9287[_0x9456('0x72')+_[_0x9456('0x6c')](_0x7f831a[_0x9456('0x4f')][_0x9456('0x6a')][_0x9456('0x6d')]())+_0x9456('0x73')](_0x7f831a[_0x9456('0x4f')][_0x9456('0x74')]);}return null;})[_0x9456('0x27')](handleEntityNotFound(_0x584a3f,null))[_0x9456('0x27')](respondWithStatusCode(_0x584a3f,null))[_0x9456('0x48')](handleError(_0x584a3f,null));};exports[_0x9456('0x75')]=function(_0x139fb5,_0x13cd88,_0x442514){return db[_0x9456('0x2e')][_0x9456('0x69')]({'where':{'id':_0x139fb5[_0x9456('0x45')]['id']}})['then'](function(_0x59204d){if(_0x59204d){if(!_0x139fb5[_0x9456('0x33')][_0x9456('0x6a')]||!utils[_0x9456('0x70')](_0x139fb5[_0x9456('0x33')][_0x9456('0x6a')])){throw new db['Sequelize'][(_0x9456('0x71'))](_0x9456('0x6b'));}return _0x59204d[_0x9456('0x76')+_[_0x9456('0x6c')](_0x139fb5[_0x9456('0x33')][_0x9456('0x6a')][_0x9456('0x6d')]())+'Queues'](_0x139fb5[_0x9456('0x33')]['ids']);}return null;})[_0x9456('0x27')](handleEntityNotFound(_0x13cd88,null))[_0x9456('0x27')](respondWithStatusCode(_0x13cd88,null))[_0x9456('0x48')](handleError(_0x13cd88,null));};exports[_0x9456('0x77')]=function(_0x93d05d,_0xd66aa0){var _0x34e336=_[_0x9456('0x78')](_0x93d05d['body'][_0x9456('0x74')])?_0x93d05d[_0x9456('0x4f')][_0x9456('0x74')]:[_0x93d05d['body'][_0x9456('0x74')]];var _0x259a35=_0x93d05d[_0x9456('0x45')]['id'];return db['Team'][_0x9456('0x47')]({'where':{'id':_0x259a35}})[_0x9456('0x27')](handleEntityNotFound(_0xd66aa0,null))['then'](function(_0x4f2898){if(_0x4f2898){var _0x296b5b=[_0x9456('0x79'),_0x9456('0x7a'),_0x9456('0x7b'),_0x9456('0x7c'),_0x9456('0x7d'),_0x9456('0x7e'),'Whatsapp'];return db[_0x9456('0x53')]['transaction'](function(_0x4020a4){var _0x4af714=_[_0x9456('0x2d')](_0x296b5b,function(_0x5e0875){var _0x379ee7={'attributes':['id',_0x9456('0x2b')]};if(_0x5e0875===_0x9456('0x79')){_0x379ee7[_0x9456('0x7f')]={'attributes':['penalty']};}return _0x4f2898['get'+_0x5e0875+_0x9456('0x73')](_0x379ee7)['then'](function(_0x3d6300){var _0x3a09c1=_[_0x9456('0x2d')](_0x3d6300,function(_0x4c3018){var _0x3a9af6=_[_0x9456('0x2d')](_0x34e336,function(_0x189f20){var _0xbff2f4={'where':{'UserId':_0x189f20,[_0x5e0875+'QueueId']:_0x4c3018['id']},'transaction':_0x4020a4};if(_0x5e0875===_0x9456('0x79')){_0xbff2f4['defaults']={'penalty':_0x4c3018['TeamVoiceQueue'][_0x9456('0x80')]};}return db[_0x9456('0x81')+_0x5e0875+_0x9456('0x6e')][_0x9456('0x82')](_0xbff2f4)[_0x9456('0x27')](function(){socket[_0x9456('0x83')](_0x9456('0x4a')+_0x5e0875+'Queue:save',{'UserId':_0x189f20,[_0x5e0875+_0x9456('0x84')]:_0x4c3018['id']});if(_0x5e0875!==_0x9456('0x79')){return;}return db[_0x9456('0x81')][_0x9456('0x43')]({'where':{'id':_0x34e336,'online':0x1},'attributes':['id',_0x9456('0x2b'),_0x9456('0x85'),_0x9456('0x86'),_0x9456('0x87')],'raw':!![]})[_0x9456('0x27')](function(_0x273fe5){var _0x4356eb=_[_0x9456('0x2d')](_0x273fe5,function(_0x1f5a72){return db[_0x9456('0x88')]['upsert']({'membername':_0x1f5a72[_0x9456('0x2b')],'UserId':_0x1f5a72['id'],'queue_name':_0x4c3018[_0x9456('0x2b')],'VoiceQueueId':_0x4c3018['id'],'interface':_[_0x9456('0x89')](_0x1f5a72[_0x9456('0x87')])?util['format'](_0x9456('0x8a'),_0x1f5a72[_0x9456('0x2b')]):_0x1f5a72[_0x9456('0x87')],'paused':_0x1f5a72[_0x9456('0x86')]||![],'penalty':_0x4c3018[_0x9456('0x8b')]['penalty']},{'transaction':_0x4020a4});});return Promise[_0x9456('0x8c')](_0x4356eb);});});});return Promise[_0x9456('0x8c')](_0x3a9af6);});return Promise[_0x9456('0x8c')](_0x3a09c1);})[_0x9456('0x27')](function(){return db[_0x9456('0x8d')]['findOne']({'where':{'teamId':_0x259a35}})[_0x9456('0x27')](function(_0x5e491){if(_0x5e491){var _0x39861c=_[_0x9456('0x2d')](_0x34e336,function(_0x3b6169){db['UserVoicePrefix']['upsert']({'UserId':_0x3b6169,'VoicePrefixId':_0x5e491[_0x9456('0x8e')]});});return Promise['all'](_0x39861c);}});});});return Promise[_0x9456('0x8c')](_0x4af714)[_0x9456('0x27')](function(){return _0x4f2898[_0x9456('0x77')](_0x34e336,{'transaction':_0x4020a4})[_0x9456('0x8f')](function(_0x5849cb){return _0x5849cb;});});});}})[_0x9456('0x27')](respondWithResult(_0xd66aa0,null))[_0x9456('0x48')](handleError(_0xd66aa0,null));};exports['removeAgents']=function(_0x208558,_0xbe90b8){var _0x50269e=_[_0x9456('0x78')](_0x208558[_0x9456('0x33')][_0x9456('0x74')])?_0x208558[_0x9456('0x33')]['ids']:[_0x208558[_0x9456('0x33')][_0x9456('0x74')]];var _0x107891=_0x208558[_0x9456('0x45')]['id'];return db[_0x9456('0x2e')][_0x9456('0x47')]({'where':{'id':_0x107891}})['then'](handleEntityNotFound(_0xbe90b8,null))[_0x9456('0x27')](function(_0x10788a){if(_0x10788a){var _0x331251=[_0x9456('0x79'),_0x9456('0x7a'),'Mail',_0x9456('0x7c'),'Fax',_0x9456('0x7e'),_0x9456('0x90')];return db[_0x9456('0x53')][_0x9456('0x51')](function(_0x3f2d70){var _0x77e1cc=_[_0x9456('0x2d')](_0x331251,function(_0x5c7728){var _0xbfb642={'attributes':['id',_0x9456('0x2b')]};return _0x10788a[_0x9456('0x4b')+_0x5c7728+_0x9456('0x73')](_0xbfb642)['then'](function(_0x2e7b64){var _0x4bd324=_[_0x9456('0x2d')](_0x2e7b64,function(_0x4f6807){return _0x4f6807[_0x9456('0x91')](_0x50269e,{'transaction':_0x3f2d70})[_0x9456('0x27')](function(){var _0x523b9e=_[_0x9456('0x2d')](_0x50269e,function(_0x190db7){socket['emit'](_0x9456('0x4a')+_0x5c7728+_0x9456('0x92'),{'UserId':Number(_0x190db7),[_0x5c7728+'QueueId']:_0x4f6807['id']});if(_0x5c7728!==_0x9456('0x79')){return;}return db[_0x9456('0x88')][_0x9456('0x50')]({'where':{'VoiceQueueId':_0x4f6807['id'],'UserId':_0x190db7},'transaction':_0x3f2d70});});return Promise[_0x9456('0x8c')](_0x523b9e);});});return Promise['all'](_0x4bd324);});});return Promise[_0x9456('0x8c')](_0x77e1cc)[_0x9456('0x27')](function(){return _0x10788a[_0x9456('0x91')](_0x50269e,{'transaction':_0x3f2d70});})[_0x9456('0x27')](function(){return db[_0x9456('0x8d')][_0x9456('0x69')]({'where':{'teamId':_0x107891}})['then'](function(_0x366b7d){if(_0x366b7d){var _0x5a6530=_[_0x9456('0x2d')](_0x50269e,function(_0x4deb3b){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4deb3b,'VoicePrefixId':_0x366b7d['VoicePrefixId']}});});return Promise[_0x9456('0x8c')](_0x5a6530);}});});});}})[_0x9456('0x27')](respondWithStatusCode(_0xbe90b8,null))[_0x9456('0x48')](handleError(_0xbe90b8,null));};exports[_0x9456('0x93')]=function(_0x2a65a9,_0x445d4a,_0xcedad){var _0x39ff48={};var _0x57aaea={};var _0x3f6fe8;var _0x1edc96;return db['Team'][_0x9456('0x69')]({'where':{'id':_0x2a65a9[_0x9456('0x45')]['id']}})[_0x9456('0x27')](handleEntityNotFound(_0x445d4a,null))[_0x9456('0x27')](function(_0x19d475){if(_0x19d475){_0x3f6fe8=_0x19d475;_0x57aaea['model']=_[_0x9456('0x34')](db['User'][_0x9456('0x2f')]);_0x57aaea[_0x9456('0x33')]=_[_0x9456('0x34')](_0x2a65a9[_0x9456('0x33')]);_0x57aaea['filters']=_[_0x9456('0x37')](_0x57aaea[_0x9456('0x32')],_0x57aaea[_0x9456('0x33')]);_0x39ff48['attributes']=_[_0x9456('0x37')](_0x57aaea[_0x9456('0x32')],qs['fields'](_0x2a65a9[_0x9456('0x33')][_0x9456('0x38')]));_0x39ff48['attributes']=_0x39ff48['attributes']['length']?_0x39ff48[_0x9456('0x36')]:_0x57aaea[_0x9456('0x32')];_0x39ff48['order']=qs[_0x9456('0x3b')](_0x2a65a9['query']['sort']);_0x39ff48['where']=qs[_0x9456('0x35')](_[_0x9456('0x3d')](_0x2a65a9[_0x9456('0x33')],_0x57aaea['filters']));if(_0x2a65a9[_0x9456('0x33')][_0x9456('0x3e')]){_0x39ff48[_0x9456('0x3c')]=_[_0x9456('0x3f')](_0x39ff48['where'],{'$or':_[_0x9456('0x2d')](_0x39ff48['attributes'],function(_0x4b2cd6){var _0x5be99f={};_0x5be99f[_0x4b2cd6]={'$like':'%'+_0x2a65a9[_0x9456('0x33')][_0x9456('0x3e')]+'%'};return _0x5be99f;})});}_0x39ff48=_[_0x9456('0x3f')]({},_0x39ff48,_0x2a65a9[_0x9456('0x46')]);return _0x3f6fe8[_0x9456('0x93')](_0x39ff48);}})[_0x9456('0x27')](function(_0x3ed29c){if(_0x3ed29c){_0x1edc96=_0x3ed29c[_0x9456('0x39')];if(!_0x2a65a9[_0x9456('0x33')][_0x9456('0x94')](_0x9456('0x3a'))){_0x39ff48[_0x9456('0x23')]=qs[_0x9456('0x23')](_0x2a65a9[_0x9456('0x33')]['limit']);_0x39ff48['offset']=qs['offset'](_0x2a65a9['query']['offset']);}return _0x3f6fe8['getAgents'](_0x39ff48);}})['then'](function(_0x164683){if(_0x164683){return _0x164683?{'count':_0x1edc96,'rows':_0x164683}:null;}})['then'](respondWithResult(_0x445d4a,null))[_0x9456('0x48')](handleError(_0x445d4a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e3e257e..2b00bfa 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 _0x3cbc=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5c7d62,_0x1e3900){var _0x7c08e=function(_0x5ea388){while(--_0x5ea388){_0x5c7d62['push'](_0x5c7d62['shift']());}};_0x7c08e(++_0x1e3900);}(_0x3cbc,0x10c));var _0xc3cb=function(_0x54bc99,_0x3bd175){_0x54bc99=_0x54bc99-0x0;var _0x118d05=_0x3cbc[_0x54bc99];return _0x118d05;};'use strict';var EventEmitter=require(_0xc3cb('0x0'));var Team=require(_0xc3cb('0x1'))['db'][_0xc3cb('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xc3cb('0x3')](0x0);var events={'afterCreate':_0xc3cb('0x4'),'afterUpdate':_0xc3cb('0x5'),'afterDestroy':_0xc3cb('0x6')};function emitEvent(_0x3589fa){return function(_0xe18904,_0x150075,_0x455f49){TeamEvents[_0xc3cb('0x7')](_0x3589fa+':'+_0xe18904['id'],_0xe18904);TeamEvents[_0xc3cb('0x7')](_0x3589fa,_0xe18904);_0x455f49(null);};}for(var e in events){if(events[_0xc3cb('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc3cb('0x9')]=TeamEvents; \ No newline at end of file +var _0x67a8=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5600b6,_0x3eb81c){var _0x335d04=function(_0x5c9d98){while(--_0x5c9d98){_0x5600b6['push'](_0x5600b6['shift']());}};_0x335d04(++_0x3eb81c);}(_0x67a8,0x133));var _0x867a=function(_0x5cc170,_0x25651b){_0x5cc170=_0x5cc170-0x0;var _0x372d15=_0x67a8[_0x5cc170];return _0x372d15;};'use strict';var EventEmitter=require(_0x867a('0x0'));var Team=require(_0x867a('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x867a('0x2')](0x0);var events={'afterCreate':_0x867a('0x3'),'afterUpdate':_0x867a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20c743){return function(_0xde4aee,_0x51ce1f,_0x5903d0){TeamEvents['emit'](_0x20c743+':'+_0xde4aee['id'],_0xde4aee);TeamEvents[_0x867a('0x5')](_0x20c743,_0xde4aee);_0x5903d0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x867a('0x6')](e,emitEvent(event));}}module[_0x867a('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6eb547e..0c52c60 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 _0xe4e3=['api','moment','request-promise','path','rimraf','../../config/environment','./team.attributes','Team','lodash','../../config/logger'];(function(_0x500fc8,_0x3bf0cd){var _0x58cbf9=function(_0x17f34f){while(--_0x17f34f){_0x500fc8['push'](_0x500fc8['shift']());}};_0x58cbf9(++_0x3bf0cd);}(_0xe4e3,0x170));var _0x3e4e=function(_0x4577bc,_0x4bd697){_0x4577bc=_0x4577bc-0x0;var _0x585978=_0xe4e3[_0x4577bc];return _0x585978;};'use strict';var _=require(_0x3e4e('0x0'));var util=require('util');var logger=require(_0x3e4e('0x1'))(_0x3e4e('0x2'));var moment=require(_0x3e4e('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e4e('0x4'));var fs=require('fs');var path=require(_0x3e4e('0x5'));var rimraf=require(_0x3e4e('0x6'));var config=require(_0x3e4e('0x7'));var attributes=require(_0x3e4e('0x8'));module['exports']=function(_0x17ec11,_0x2a4119){return _0x17ec11['define'](_0x3e4e('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9925=['define','teams','../../config/logger','api','moment','path','../../config/environment','exports'];(function(_0x294eba,_0x5188af){var _0x13f256=function(_0x3fd28c){while(--_0x3fd28c){_0x294eba['push'](_0x294eba['shift']());}};_0x13f256(++_0x5188af);}(_0x9925,0xb2));var _0x5992=function(_0x4450d6,_0x1a8191){_0x4450d6=_0x4450d6-0x0;var _0x344b32=_0x9925[_0x4450d6];return _0x344b32;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5992('0x0'))(_0x5992('0x1'));var moment=require(_0x5992('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5992('0x3'));var rimraf=require('rimraf');var config=require(_0x5992('0x4'));var attributes=require('./team.attributes');module[_0x5992('0x5')]=function(_0x1ee78e,_0x548236){return _0x1ee78e[_0x5992('0x6')]('Team',attributes,{'tableName':_0x5992('0x7'),'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 3403675..7325d2c 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 _0xca4a=['code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca4a,0xa6));var _0xaca4=function(_0x5a0b3a,_0x1137eb){_0x5a0b3a=_0x5a0b3a-0x0;var _0x718d5d=_0xca4a[_0x5a0b3a];return _0x718d5d;};'use strict';var _=require(_0xaca4('0x0'));var util=require('util');var moment=require(_0xaca4('0x1'));var BPromise=require(_0xaca4('0x2'));var rs=require(_0xaca4('0x3'));var fs=require('fs');var Redis=require(_0xaca4('0x4'));var db=require(_0xaca4('0x5'))['db'];var utils=require(_0xaca4('0x6'));var logger=require(_0xaca4('0x7'))(_0xaca4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaca4('0x9')][_0xaca4('0xa')]({'port':0x232a});config[_0xaca4('0xb')]=_[_0xaca4('0xc')](config[_0xaca4('0xb')],{'host':_0xaca4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaca4('0xe'))[_0xaca4('0xf')](socket);function respondWithRpcPromise(_0x4b3ba1,_0x3d8c49,_0x4aea77){return new BPromise(function(_0x2185af,_0x2d584c){return client[_0xaca4('0x10')](_0x4b3ba1,_0x4aea77)[_0xaca4('0x11')](function(_0x594984){logger['info'](_0xaca4('0x12'),_0x3d8c49,_0xaca4('0x13'));logger[_0xaca4('0x14')](_0xaca4('0x15'),_0x3d8c49,'request\x20sent',JSON['stringify'](_0x594984));if(_0x594984[_0xaca4('0x16')]){if(_0x594984['error'][_0xaca4('0x17')]===0x1f4){logger[_0xaca4('0x16')](_0xaca4('0x12'),_0x3d8c49,_0x594984['error']['message']);return _0x2d584c(_0x594984[_0xaca4('0x16')][_0xaca4('0x18')]);}logger[_0xaca4('0x16')](_0xaca4('0x12'),_0x3d8c49,_0x594984[_0xaca4('0x16')][_0xaca4('0x18')]);return _0x2185af(_0x594984[_0xaca4('0x16')][_0xaca4('0x18')]);}else{logger[_0xaca4('0x19')](_0xaca4('0x12'),_0x3d8c49,_0xaca4('0x13'));_0x2185af(_0x594984[_0xaca4('0x1a')][_0xaca4('0x18')]);}})['catch'](function(_0x493600){logger[_0xaca4('0x16')](_0xaca4('0x12'),_0x3d8c49,_0x493600);_0x2d584c(_0x493600);});});} \ No newline at end of file +var _0x8ef2=['localhost','./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x23d99e,_0x221ff6){var _0x1af32b=function(_0xb09a2d){while(--_0xb09a2d){_0x23d99e['push'](_0x23d99e['shift']());}};_0x1af32b(++_0x221ff6);}(_0x8ef2,0x12d));var _0x28ef=function(_0x34ea1e,_0x152007){_0x34ea1e=_0x34ea1e-0x0;var _0xcb6be2=_0x8ef2[_0x34ea1e];return _0xcb6be2;};'use strict';var _=require('lodash');var util=require(_0x28ef('0x0'));var moment=require(_0x28ef('0x1'));var BPromise=require(_0x28ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28ef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x28ef('0x4'))(_0x28ef('0x5'));var config=require(_0x28ef('0x6'));var jayson=require(_0x28ef('0x7'));var client=jayson[_0x28ef('0x8')]['http']({'port':0x232a});config[_0x28ef('0x9')]=_[_0x28ef('0xa')](config['redis'],{'host':_0x28ef('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x28ef('0xc'))[_0x28ef('0xd')](socket);function respondWithRpcPromise(_0x1b9fef,_0x5e4b08,_0x27ed33){return new BPromise(function(_0x270c0b,_0x50acbc){return client['request'](_0x1b9fef,_0x27ed33)[_0x28ef('0xe')](function(_0x5205da){logger['info'](_0x28ef('0xf'),_0x5e4b08,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x5e4b08,_0x28ef('0x10'),JSON[_0x28ef('0x11')](_0x5205da));if(_0x5205da[_0x28ef('0x12')]){if(_0x5205da['error'][_0x28ef('0x13')]===0x1f4){logger[_0x28ef('0x12')]('Team,\x20%s,\x20%s',_0x5e4b08,_0x5205da[_0x28ef('0x12')][_0x28ef('0x14')]);return _0x50acbc(_0x5205da[_0x28ef('0x12')][_0x28ef('0x14')]);}logger['error']('Team,\x20%s,\x20%s',_0x5e4b08,_0x5205da[_0x28ef('0x12')][_0x28ef('0x14')]);return _0x270c0b(_0x5205da[_0x28ef('0x12')][_0x28ef('0x14')]);}else{logger[_0x28ef('0x15')](_0x28ef('0xf'),_0x5e4b08,_0x28ef('0x10'));_0x270c0b(_0x5205da[_0x28ef('0x16')][_0x28ef('0x14')]);}})[_0x28ef('0x17')](function(_0x2bd35f){logger['error'](_0x28ef('0xf'),_0x5e4b08,_0x2bd35f);_0x50acbc(_0x2bd35f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f50bad8..ef839d9 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 _0xb720=['length','team:','./team.events','remove','update','emit','removeListener'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xb720,0x191));var _0x0b72=function(_0xdbfe3,_0x4ebddd){_0xdbfe3=_0xdbfe3-0x0;var _0x3454b0=_0xb720[_0xdbfe3];return _0x3454b0;};'use strict';var TeamEvents=require(_0x0b72('0x0'));var events=['save',_0x0b72('0x1'),_0x0b72('0x2')];function createListener(_0x75789f,_0x402832){return function(_0x2dbf83){_0x402832[_0x0b72('0x3')](_0x75789f,_0x2dbf83);};}function removeListener(_0x2f69a5,_0xb8af0c){return function(){TeamEvents[_0x0b72('0x4')](_0x2f69a5,_0xb8af0c);};}exports['register']=function(_0x1fbb71){for(var _0x51679c=0x0,_0x2a365d=events[_0x0b72('0x5')];_0x51679c<_0x2a365d;_0x51679c++){var _0x473736=events[_0x51679c];var _0x303d11=createListener(_0x0b72('0x6')+_0x473736,_0x1fbb71);TeamEvents['on'](_0x473736,_0x303d11);}}; \ No newline at end of file +var _0x97cf=['save','remove','update','emit','register'];(function(_0x4a3e45,_0x1e8ef3){var _0x48db76=function(_0x33d341){while(--_0x33d341){_0x4a3e45['push'](_0x4a3e45['shift']());}};_0x48db76(++_0x1e8ef3);}(_0x97cf,0xa0));var _0xf97c=function(_0x5e194b,_0x5cce36){_0x5e194b=_0x5e194b-0x0;var _0x124974=_0x97cf[_0x5e194b];return _0x124974;};'use strict';var TeamEvents=require('./team.events');var events=[_0xf97c('0x0'),_0xf97c('0x1'),_0xf97c('0x2')];function createListener(_0x5a9e3a,_0x21d214){return function(_0x45a790){_0x21d214[_0xf97c('0x3')](_0x5a9e3a,_0x45a790);};}function removeListener(_0x2e72ba,_0x4b0b59){return function(){TeamEvents['removeListener'](_0x2e72ba,_0x4b0b59);};}exports[_0xf97c('0x4')]=function(_0x43dbac){for(var _0x27fd1e=0x0,_0x33e845=events['length'];_0x27fd1e<_0x33e845;_0x27fd1e++){var _0x2d4dd9=events[_0x27fd1e];var _0x3d8a9f=createListener('team:'+_0x2d4dd9,_0x43dbac);TeamEvents['on'](_0x2d4dd9,_0x3d8a9f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3e82ceb..d3690af 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd85c=['INTEGER','sequelize','exports'];(function(_0xb016d0,_0x3d3d14){var _0x41bf1a=function(_0x4f58ca){while(--_0x4f58ca){_0xb016d0['push'](_0xb016d0['shift']());}};_0x41bf1a(++_0x3d3d14);}(_0xd85c,0xb5));var _0xcd85=function(_0x40514c,_0x387dc3){_0x40514c=_0x40514c-0x0;var _0x48f285=_0xd85c[_0x40514c];return _0x48f285;};'use strict';var Sequelize=require(_0xcd85('0x0'));module[_0xcd85('0x1')]={'TeamId':{'type':Sequelize[_0xcd85('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xcd85('0x2')]}}; \ No newline at end of file +var _0x1094=['exports','INTEGER','sequelize'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x1094,0x143));var _0x4109=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x1094[_0x36cff7];return _0x21c697;};'use strict';var Sequelize=require(_0x4109('0x0'));module[_0x4109('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4109('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f7b3c53..ebd9497 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceb0=['moment','request-promise','path','rimraf','exports','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xceb0,0x173));var _0x0ceb=function(_0x47dc4f,_0x36c829){_0x47dc4f=_0x47dc4f-0x0;var _0x357d19=_0xceb0[_0x47dc4f];return _0x357d19;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ceb('0x0'));var BPromise=require('bluebird');var rp=require(_0x0ceb('0x1'));var fs=require('fs');var path=require(_0x0ceb('0x2'));var rimraf=require(_0x0ceb('0x3'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x0ceb('0x4')]=function(_0x218237,_0x3f650d){return _0x218237['define'](_0x0ceb('0x5'),attributes,{'tableName':_0x0ceb('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc584=['path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','util','../../config/logger','bluebird'];(function(_0x58412c,_0x29c8e5){var _0x1ed925=function(_0x42da56){while(--_0x42da56){_0x58412c['push'](_0x58412c['shift']());}};_0x1ed925(++_0x29c8e5);}(_0xc584,0xa8));var _0x4c58=function(_0x4dc4bd,_0x490bf0){_0x4dc4bd=_0x4dc4bd-0x0;var _0x22a362=_0xc584[_0x4dc4bd];return _0x22a362;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var logger=require(_0x4c58('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4c58('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c58('0x3'));var rimraf=require(_0x4c58('0x4'));var config=require(_0x4c58('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x4c58('0x6')]=function(_0x1a6d4c,_0x3e94f0){return _0x1a6d4c[_0x4c58('0x7')](_0x4c58('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1cca197..3a2fd54 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x253b46,_0x26265a){var _0x49282e=function(_0x3dbe38){while(--_0x3dbe38){_0x253b46['push'](_0x253b46['shift']());}};_0x49282e(++_0x26265a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5e2aaf,_0x5ee3e3){var _0x508383=function(_0x5ea4a7){while(--_0x5ea4a7){_0x5e2aaf['push'](_0x5e2aaf['shift']());}};_0x508383(++_0x5ee3e3);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index dc061af..21df629 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 _0x5b17=['exports','INTEGER','sequelize'];(function(_0x11f6e6,_0x32cf34){var _0x15f6f1=function(_0x87b4c6){while(--_0x87b4c6){_0x11f6e6['push'](_0x11f6e6['shift']());}};_0x15f6f1(++_0x32cf34);}(_0x5b17,0xc5));var _0x75b1=function(_0x1e0e2f,_0x4c4a29){_0x1e0e2f=_0x1e0e2f-0x0;var _0x46ee08=_0x5b17[_0x1e0e2f];return _0x46ee08;};'use strict';var Sequelize=require(_0x75b1('0x0'));module[_0x75b1('0x1')]={'penalty':{'type':Sequelize[_0x75b1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2ca=['exports','INTEGER','sequelize'];(function(_0x35052,_0x5d420e){var _0x41c48f=function(_0xa67eae){while(--_0xa67eae){_0x35052['push'](_0x35052['shift']());}};_0x41c48f(++_0x5d420e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0xf2ca[_0x527824];return _0xc8b8ed;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'penalty':{'type':Sequelize[_0xaf2c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index c2acc7a..aa7eec2 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 _0xbb53=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37c981,_0x22a780){var _0x4deca9=function(_0x38cf21){while(--_0x38cf21){_0x37c981['push'](_0x37c981['shift']());}};_0x4deca9(++_0x22a780);}(_0xbb53,0x121));var _0x3bb5=function(_0x309c25,_0x343e51){_0x309c25=_0x309c25-0x0;var _0x3fa29e=_0xbb53[_0x309c25];return _0x3fa29e;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var moment=require(_0x3bb5('0x4'));var BPromise=require(_0x3bb5('0x5'));var rp=require(_0x3bb5('0x6'));var fs=require('fs');var path=require(_0x3bb5('0x7'));var rimraf=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x23f11e,_0x2460b0){return _0x23f11e[_0x3bb5('0xa')](_0x3bb5('0xb'),attributes,{'tableName':_0x3bb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabe8=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./teamVoiceQueue.attributes','exports','team_has_voice_queues'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0xabe8,0x8c));var _0x8abe=function(_0x1567e9,_0x2286e3){_0x1567e9=_0x1567e9-0x0;var _0x51f08e=_0xabe8[_0x1567e9];return _0x51f08e;};'use strict';var _=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var logger=require(_0x8abe('0x2'))('api');var moment=require(_0x8abe('0x3'));var BPromise=require(_0x8abe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8abe('0x5'));var rimraf=require('rimraf');var config=require(_0x8abe('0x6'));var attributes=require(_0x8abe('0x7'));module[_0x8abe('0x8')]=function(_0x3a24e6,_0x7619bb){return _0x3a24e6['define']('TeamVoiceQueue',attributes,{'tableName':_0x8abe('0x9'),'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 eff06a0..f0050af 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 _0x3482=['code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x3482,0x1bc));var _0x2348=function(_0x2ab8f4,_0x192abd){_0x2ab8f4=_0x2ab8f4-0x0;var _0xf1bee6=_0x3482[_0x2ab8f4];return _0xf1bee6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2348('0x0'));var BPromise=require(_0x2348('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2348('0x2'));var db=require(_0x2348('0x3'))['db'];var utils=require(_0x2348('0x4'));var logger=require(_0x2348('0x5'))(_0x2348('0x6'));var config=require(_0x2348('0x7'));var jayson=require(_0x2348('0x8'));var client=jayson[_0x2348('0x9')][_0x2348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c7b2a,_0x316bd6,_0x131a9a){return new BPromise(function(_0x308afb,_0x3cdc9a){return client[_0x2348('0xb')](_0x2c7b2a,_0x131a9a)[_0x2348('0xc')](function(_0x24191c){logger[_0x2348('0xd')](_0x2348('0xe'),_0x316bd6,_0x2348('0xf'));logger[_0x2348('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x316bd6,_0x2348('0xf'),JSON['stringify'](_0x24191c));if(_0x24191c[_0x2348('0x11')]){if(_0x24191c[_0x2348('0x11')][_0x2348('0x12')]===0x1f4){logger[_0x2348('0x11')](_0x2348('0xe'),_0x316bd6,_0x24191c[_0x2348('0x11')]['message']);return _0x3cdc9a(_0x24191c['error']['message']);}logger[_0x2348('0x11')](_0x2348('0xe'),_0x316bd6,_0x24191c[_0x2348('0x11')][_0x2348('0x13')]);return _0x308afb(_0x24191c[_0x2348('0x11')][_0x2348('0x13')]);}else{logger[_0x2348('0xd')](_0x2348('0xe'),_0x316bd6,_0x2348('0xf'));_0x308afb(_0x24191c[_0x2348('0x14')][_0x2348('0x13')]);}})['catch'](function(_0x446a7d){logger[_0x2348('0x11')](_0x2348('0xe'),_0x316bd6,_0x446a7d);_0x3cdc9a(_0x446a7d);});});} \ No newline at end of file +var _0x871e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a273c,_0xb7c9d3){var _0x25ee35=function(_0xdaf3c2){while(--_0xdaf3c2){_0x3a273c['push'](_0x3a273c['shift']());}};_0x25ee35(++_0xb7c9d3);}(_0x871e,0x1b0));var _0xe871=function(_0x13ac54,_0x2c23b1){_0x13ac54=_0x13ac54-0x0;var _0x216f40=_0x871e[_0x13ac54];return _0x216f40;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var moment=require(_0xe871('0x1'));var BPromise=require(_0xe871('0x2'));var rs=require(_0xe871('0x3'));var fs=require('fs');var Redis=require(_0xe871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe871('0x5'));var logger=require(_0xe871('0x6'))(_0xe871('0x7'));var config=require(_0xe871('0x8'));var jayson=require(_0xe871('0x9'));var client=jayson[_0xe871('0xa')][_0xe871('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ed0e,_0x289308,_0x1d773f){return new BPromise(function(_0x4cf6af,_0x3bcc75){return client['request'](_0x13ed0e,_0x1d773f)['then'](function(_0x225f5b){logger[_0xe871('0xc')](_0xe871('0xd'),_0x289308,'request\x20sent');logger[_0xe871('0xe')](_0xe871('0xf'),_0x289308,_0xe871('0x10'),JSON[_0xe871('0x11')](_0x225f5b));if(_0x225f5b[_0xe871('0x12')]){if(_0x225f5b[_0xe871('0x12')][_0xe871('0x13')]===0x1f4){logger['error'](_0xe871('0xd'),_0x289308,_0x225f5b[_0xe871('0x12')][_0xe871('0x14')]);return _0x3bcc75(_0x225f5b[_0xe871('0x12')][_0xe871('0x14')]);}logger[_0xe871('0x12')](_0xe871('0xd'),_0x289308,_0x225f5b[_0xe871('0x12')][_0xe871('0x14')]);return _0x4cf6af(_0x225f5b['error'][_0xe871('0x14')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x289308,_0xe871('0x10'));_0x4cf6af(_0x225f5b[_0xe871('0x15')][_0xe871('0x14')]);}})[_0xe871('0x16')](function(_0x2288c8){logger[_0xe871('0x12')](_0xe871('0xd'),_0x289308,_0x2288c8);_0x3bcc75(_0x2288c8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 980c269..33a3835 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 _0x1280=['./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1280,0xac));var _0x0128=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x1280[_0x3a0c4f];return _0x247049;};'use strict';var multer=require(_0x0128('0x0'));var util=require('util');var path=require(_0x0128('0x1'));var timeout=require(_0x0128('0x2'));var express=require(_0x0128('0x3'));var router=express[_0x0128('0x4')]();var fs_extra=require(_0x0128('0x5'));var auth=require(_0x0128('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0128('0x7'));var controller=require(_0x0128('0x8'));router[_0x0128('0x9')]('/',auth[_0x0128('0xa')](),controller['index']);router['get'](_0x0128('0xb'),auth[_0x0128('0xa')](),controller[_0x0128('0xc')]);router[_0x0128('0xd')]('/',auth['isAuthenticated'](),controller[_0x0128('0xe')]);router[_0x0128('0xf')]('/:id',auth[_0x0128('0xa')](),controller[_0x0128('0x10')]);router[_0x0128('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0128('0x12')]);module[_0x0128('0x13')]=router; \ No newline at end of file +var _0x3c8b=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','post','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x5e18b5,_0x207fa4){_0x5e18b5=_0x5e18b5-0x0;var _0x477fbf=_0x3c8b[_0x5e18b5];return _0x477fbf;};'use strict';var multer=require('multer');var util=require(_0xb3c8('0x0'));var path=require('path');var timeout=require(_0xb3c8('0x1'));var express=require(_0xb3c8('0x2'));var router=express[_0xb3c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3c8('0x4'));var interaction=require(_0xb3c8('0x5'));var config=require(_0xb3c8('0x6'));var controller=require(_0xb3c8('0x7'));router[_0xb3c8('0x8')]('/',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xa')]);router[_0xb3c8('0x8')]('/:id',auth[_0xb3c8('0x9')](),controller['show']);router[_0xb3c8('0xb')]('/',auth[_0xb3c8('0x9')](),controller['create']);router['put']('/:id',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xc')]);router[_0xb3c8('0xd')]('/:id',auth[_0xb3c8('0x9')](),controller[_0xb3c8('0xe')]);module[_0xb3c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 706eac2..2bf4ba4 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 _0x4744=['TEXT','sequelize','exports','STRING'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x4744,0xf9));var _0x4474=function(_0x235fd1,_0x5a55c6){_0x235fd1=_0x235fd1-0x0;var _0x1fb2fd=_0x4744[_0x235fd1];return _0x1fb2fd;};'use strict';var Sequelize=require(_0x4474('0x0'));module[_0x4474('0x1')]={'name':{'type':Sequelize[_0x4474('0x2')]},'description':{'type':Sequelize[_0x4474('0x2')]},'html':{'type':Sequelize[_0x4474('0x3')]}}; \ No newline at end of file +var _0x1ff5=['sequelize','STRING','TEXT'];(function(_0x32ffae,_0xe676af){var _0x18b7f2=function(_0x1629a5){while(--_0x1629a5){_0x32ffae['push'](_0x32ffae['shift']());}};_0x18b7f2(++_0xe676af);}(_0x1ff5,0xf9));var _0x51ff=function(_0x3b4cbe,_0x5d1a62){_0x3b4cbe=_0x3b4cbe-0x0;var _0x12748d=_0x1ff5[_0x3b4cbe];return _0x12748d;};'use strict';var Sequelize=require(_0x51ff('0x0'));module['exports']={'name':{'type':Sequelize[_0x51ff('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x51ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d96c3c0..acfba3d 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 _0x9d8c=['eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','count','set','json','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','end','name','send','index','map','Template','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','findAll','show','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x2bd641,_0x2a0677){var _0x441732=function(_0x46eff4){while(--_0x46eff4){_0x2bd641['push'](_0x2bd641['shift']());}};_0x441732(++_0x2a0677);}(_0x9d8c,0x172));var _0xc9d8=function(_0x5ca0b9,_0x410bd6){_0x5ca0b9=_0x5ca0b9-0x0;var _0x42fe7f=_0x9d8c[_0x5ca0b9];return _0x42fe7f;};'use strict';var emlformat=require(_0xc9d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9d8('0x2'));var moment=require(_0xc9d8('0x3'));var BPromise=require(_0xc9d8('0x4'));var Mustache=require(_0xc9d8('0x5'));var util=require(_0xc9d8('0x6'));var path=require('path');var sox=require(_0xc9d8('0x7'));var csv=require(_0xc9d8('0x8'));var ejs=require(_0xc9d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9d8('0xa'));var squel=require(_0xc9d8('0xb'));var crypto=require(_0xc9d8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc9d8('0x8'));var querystring=require('querystring');var Papa=require(_0xc9d8('0xd'));var Redis=require(_0xc9d8('0xe'));var authService=require(_0xc9d8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc9d8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc9d8('0x11'));var config=require(_0xc9d8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9d8('0x13'))['db'];function respondWithStatusCode(_0x3e2889,_0x39ad62){_0x39ad62=_0x39ad62||0xcc;return function(_0x1bf619){if(_0x1bf619){return _0x3e2889[_0xc9d8('0x14')](_0x39ad62);}return _0x3e2889['status'](_0x39ad62)['end']();};}function respondWithResult(_0xa9579b,_0x375b1a){_0x375b1a=_0x375b1a||0xc8;return function(_0x37ee35){if(_0x37ee35){return _0xa9579b[_0xc9d8('0x15')](_0x375b1a)['json'](_0x37ee35);}};}function respondWithFilteredResult(_0x36e081,_0xa67122){return function(_0x582284){if(_0x582284){var _0x868426=typeof _0xa67122[_0xc9d8('0x16')]==='undefined'&&typeof _0xa67122[_0xc9d8('0x17')]==='undefined';var _0x3f5d0a=_0x582284['count'];var _0x1705d7=_0x868426?0x0:_0xa67122['offset'];var _0x10d5c7=_0x868426?_0x582284[_0xc9d8('0x18')]:_0xa67122[_0xc9d8('0x16')]+_0xa67122[_0xc9d8('0x17')];var _0x3c9f22;if(_0x10d5c7>=_0x3f5d0a){_0x10d5c7=_0x3f5d0a;_0x3c9f22=0xc8;}else{_0x3c9f22=0xce;}_0x36e081[_0xc9d8('0x15')](_0x3c9f22);return _0x36e081[_0xc9d8('0x19')]('Content-Range',_0x1705d7+'-'+_0x10d5c7+'/'+_0x3f5d0a)[_0xc9d8('0x1a')](_0x582284);}return null;};}function patchUpdates(_0x508868){return function(_0x14da24){try{jsonpatch[_0xc9d8('0x1b')](_0x14da24,_0x508868,!![]);}catch(_0x2feb7b){return BPromise[_0xc9d8('0x1c')](_0x2feb7b);}return _0x14da24[_0xc9d8('0x1d')]();};}function saveUpdates(_0x38d935,_0x238ed4){return function(_0x4f7d13){if(_0x4f7d13){return _0x4f7d13[_0xc9d8('0x1e')](_0x38d935)['then'](function(_0xd67e95){return _0xd67e95;});}return null;};}function removeEntity(_0x14c210,_0x2982f4){return function(_0x58da33){if(_0x58da33){return _0x58da33[_0xc9d8('0x1f')]()[_0xc9d8('0x20')](function(){var _0x34a02d=_0x58da33[_0xc9d8('0x21')]({'plain':!![]});var _0xaa8e00=_0xc9d8('0x22');return db[_0xc9d8('0x23')][_0xc9d8('0x1f')]({'where':{'type':_0xaa8e00,'resourceId':_0x34a02d['id']}})[_0xc9d8('0x20')](function(){return _0x58da33;});})[_0xc9d8('0x20')](function(){_0x14c210[_0xc9d8('0x15')](0xcc)[_0xc9d8('0x24')]();});}};}function handleEntityNotFound(_0x16f8ff,_0xb77ed4){return function(_0x221794){if(!_0x221794){_0x16f8ff[_0xc9d8('0x14')](0x194);}return _0x221794;};}function handleError(_0x1f6482,_0x5b0f1b){_0x5b0f1b=_0x5b0f1b||0x1f4;return function(_0x74ccb8){logger['error'](_0x74ccb8['stack']);if(_0x74ccb8[_0xc9d8('0x25')]){delete _0x74ccb8[_0xc9d8('0x25')];}_0x1f6482['status'](_0x5b0f1b)[_0xc9d8('0x26')](_0x74ccb8);};}exports[_0xc9d8('0x27')]=function(_0x3af615,_0x27ec9b){var _0x2c4637={},_0x27189c={},_0xf20141={'count':0x0,'rows':[]};var _0x3fcf4e=_[_0xc9d8('0x28')](db[_0xc9d8('0x29')]['rawAttributes'],function(_0xb9330f){return{'name':_0xb9330f['fieldName'],'type':_0xb9330f['type'][_0xc9d8('0x2a')]};});_0x27189c[_0xc9d8('0x2b')]=_['map'](_0x3fcf4e,'name');_0x27189c[_0xc9d8('0x2c')]=_[_0xc9d8('0x2d')](_0x3af615['query']);_0x27189c[_0xc9d8('0x2e')]=_[_0xc9d8('0x2f')](_0x27189c[_0xc9d8('0x2b')],_0x27189c[_0xc9d8('0x2c')]);_0x2c4637['attributes']=_[_0xc9d8('0x2f')](_0x27189c['model'],qs[_0xc9d8('0x30')](_0x3af615[_0xc9d8('0x2c')][_0xc9d8('0x30')]));_0x2c4637['attributes']=_0x2c4637[_0xc9d8('0x31')][_0xc9d8('0x32')]?_0x2c4637[_0xc9d8('0x31')]:_0x27189c[_0xc9d8('0x2b')];if(!_0x3af615[_0xc9d8('0x2c')][_0xc9d8('0x33')]('nolimit')){_0x2c4637[_0xc9d8('0x17')]=qs[_0xc9d8('0x17')](_0x3af615['query']['limit']);_0x2c4637['offset']=qs[_0xc9d8('0x16')](_0x3af615[_0xc9d8('0x2c')][_0xc9d8('0x16')]);}_0x2c4637[_0xc9d8('0x34')]=qs[_0xc9d8('0x35')](_0x3af615[_0xc9d8('0x2c')]['sort']);_0x2c4637[_0xc9d8('0x36')]=qs[_0xc9d8('0x2e')](_[_0xc9d8('0x37')](_0x3af615[_0xc9d8('0x2c')],_0x27189c[_0xc9d8('0x2e')]),_0x3fcf4e);if(_0x3af615[_0xc9d8('0x2c')]['filter']){_0x2c4637[_0xc9d8('0x36')]=_[_0xc9d8('0x38')](_0x2c4637[_0xc9d8('0x36')],{'$or':_['map'](_0x3fcf4e,function(_0x4d7b68){if(_0x4d7b68[_0xc9d8('0x39')]!=='VIRTUAL'){var _0x370a89={};_0x370a89[_0x4d7b68[_0xc9d8('0x25')]]={'$like':'%'+_0x3af615[_0xc9d8('0x2c')][_0xc9d8('0x3a')]+'%'};return _0x370a89;}})});}_0x2c4637=_['merge']({},_0x2c4637,_0x3af615[_0xc9d8('0x3b')]);var _0x43bb08={'where':_0x2c4637[_0xc9d8('0x36')]};return db[_0xc9d8('0x29')][_0xc9d8('0x18')](_0x43bb08)[_0xc9d8('0x20')](function(_0x42f4e6){_0xf20141[_0xc9d8('0x18')]=_0x42f4e6;if(_0x3af615[_0xc9d8('0x2c')][_0xc9d8('0x3c')]){_0x2c4637['include']=[{'all':!![]}];}return db[_0xc9d8('0x29')][_0xc9d8('0x3d')](_0x2c4637);})[_0xc9d8('0x20')](function(_0x4471ad){_0xf20141['rows']=_0x4471ad;return _0xf20141;})[_0xc9d8('0x20')](respondWithFilteredResult(_0x27ec9b,_0x2c4637))['catch'](handleError(_0x27ec9b,null));};exports[_0xc9d8('0x3e')]=function(_0x516ea8,_0x8f0b9){var _0xcbd19b={'raw':!![],'where':{'id':_0x516ea8[_0xc9d8('0x3f')]['id']}},_0x59cd4b={};_0x59cd4b[_0xc9d8('0x2b')]=_[_0xc9d8('0x2d')](db[_0xc9d8('0x29')][_0xc9d8('0x40')]);_0x59cd4b[_0xc9d8('0x2c')]=_[_0xc9d8('0x2d')](_0x516ea8[_0xc9d8('0x2c')]);_0x59cd4b[_0xc9d8('0x2e')]=_[_0xc9d8('0x2f')](_0x59cd4b[_0xc9d8('0x2b')],_0x59cd4b['query']);_0xcbd19b[_0xc9d8('0x31')]=_[_0xc9d8('0x2f')](_0x59cd4b[_0xc9d8('0x2b')],qs[_0xc9d8('0x30')](_0x516ea8[_0xc9d8('0x2c')][_0xc9d8('0x30')]));_0xcbd19b[_0xc9d8('0x31')]=_0xcbd19b[_0xc9d8('0x31')][_0xc9d8('0x32')]?_0xcbd19b[_0xc9d8('0x31')]:_0x59cd4b[_0xc9d8('0x2b')];if(_0x516ea8['query']['includeAll']){_0xcbd19b['include']=[{'all':!![]}];}_0xcbd19b=_['merge']({},_0xcbd19b,_0x516ea8[_0xc9d8('0x3b')]);return db['Template']['find'](_0xcbd19b)['then'](handleEntityNotFound(_0x8f0b9,null))[_0xc9d8('0x20')](respondWithResult(_0x8f0b9,null))[_0xc9d8('0x41')](handleError(_0x8f0b9,null));};exports[_0xc9d8('0x42')]=function(_0x2e8aae,_0x1f2412){return db[_0xc9d8('0x29')][_0xc9d8('0x42')](_0x2e8aae['body'],{})[_0xc9d8('0x20')](function(_0x34e4f2){var _0x3fa2e7=_0x2e8aae[_0xc9d8('0x43')][_0xc9d8('0x21')]({'plain':!![]});if(!_0x3fa2e7)throw new Error(_0xc9d8('0x44'));if(_0x3fa2e7['role']===_0xc9d8('0x43')){var _0x14e3de=_0x34e4f2[_0xc9d8('0x21')]({'plain':!![]});var _0x4ba31d=_0xc9d8('0x22');return db[_0xc9d8('0x45')][_0xc9d8('0x46')]({'where':{'name':_0x4ba31d,'userProfileId':_0x3fa2e7['userProfileId']},'raw':!![]})[_0xc9d8('0x20')](function(_0x2b25b4){if(_0x2b25b4&&_0x2b25b4['autoAssociation']===0x0){return db[_0xc9d8('0x23')]['create']({'name':_0x14e3de[_0xc9d8('0x25')],'resourceId':_0x14e3de['id'],'type':_0x2b25b4[_0xc9d8('0x25')],'sectionId':_0x2b25b4['id']},{})[_0xc9d8('0x20')](function(){return _0x34e4f2;});}else{return _0x34e4f2;}})[_0xc9d8('0x41')](function(_0x21ab62){logger[_0xc9d8('0x47')](_0xc9d8('0x48'),_0x21ab62);throw _0x21ab62;});}return _0x34e4f2;})[_0xc9d8('0x20')](respondWithResult(_0x1f2412,0xc9))[_0xc9d8('0x41')](handleError(_0x1f2412,null));};exports[_0xc9d8('0x1e')]=function(_0x138c05,_0x279329){if(_0x138c05[_0xc9d8('0x49')]['id']){delete _0x138c05['body']['id'];}return db['Template'][_0xc9d8('0x46')]({'where':{'id':_0x138c05[_0xc9d8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x279329,null))[_0xc9d8('0x20')](saveUpdates(_0x138c05[_0xc9d8('0x49')],null))[_0xc9d8('0x20')](respondWithResult(_0x279329,null))['catch'](handleError(_0x279329,null));};exports[_0xc9d8('0x1f')]=function(_0x1c3a29,_0x14dfa6){return db[_0xc9d8('0x29')][_0xc9d8('0x46')]({'where':{'id':_0x1c3a29[_0xc9d8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14dfa6,null))[_0xc9d8('0x20')](removeEntity(_0x14dfa6,null))[_0xc9d8('0x41')](handleError(_0x14dfa6,null));}; \ No newline at end of file +var _0x3b92=['fields','length','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','error','name','send','map','Template','rawAttributes','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x346720,_0x12ecd8){var _0x3d6198=function(_0x2ae51d){while(--_0x2ae51d){_0x346720['push'](_0x346720['shift']());}};_0x3d6198(++_0x12ecd8);}(_0x3b92,0xb9));var _0x23b9=function(_0x2fe6d9,_0x178c0a){_0x2fe6d9=_0x2fe6d9-0x0;var _0x40c45e=_0x3b92[_0x2fe6d9];return _0x40c45e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x23b9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23b9('0x1'));var moment=require(_0x23b9('0x2'));var BPromise=require(_0x23b9('0x3'));var Mustache=require(_0x23b9('0x4'));var util=require('util');var path=require(_0x23b9('0x5'));var sox=require(_0x23b9('0x6'));var csv=require(_0x23b9('0x7'));var ejs=require(_0x23b9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23b9('0x9'));var squel=require(_0x23b9('0xa'));var crypto=require(_0x23b9('0xb'));var jsforce=require(_0x23b9('0xc'));var deskjs=require(_0x23b9('0xd'));var toCsv=require(_0x23b9('0x7'));var querystring=require(_0x23b9('0xe'));var Papa=require(_0x23b9('0xf'));var Redis=require(_0x23b9('0x10'));var authService=require(_0x23b9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23b9('0x12'));var hardwareService=require(_0x23b9('0x13'));var logger=require(_0x23b9('0x14'))(_0x23b9('0x15'));var utils=require(_0x23b9('0x16'));var config=require(_0x23b9('0x17'));var licenseUtil=require(_0x23b9('0x18'));var db=require(_0x23b9('0x19'))['db'];function respondWithStatusCode(_0x2e3e39,_0x2b3d7f){_0x2b3d7f=_0x2b3d7f||0xcc;return function(_0x7f8534){if(_0x7f8534){return _0x2e3e39[_0x23b9('0x1a')](_0x2b3d7f);}return _0x2e3e39[_0x23b9('0x1b')](_0x2b3d7f)[_0x23b9('0x1c')]();};}function respondWithResult(_0x2bc1e8,_0x3a39b5){_0x3a39b5=_0x3a39b5||0xc8;return function(_0x45b3e8){if(_0x45b3e8){return _0x2bc1e8[_0x23b9('0x1b')](_0x3a39b5)[_0x23b9('0x1d')](_0x45b3e8);}};}function respondWithFilteredResult(_0x4d2e67,_0x123c64){return function(_0x52b017){if(_0x52b017){var _0x38f683=typeof _0x123c64[_0x23b9('0x1e')]===_0x23b9('0x1f')&&typeof _0x123c64[_0x23b9('0x20')]===_0x23b9('0x1f');var _0x3a5da0=_0x52b017[_0x23b9('0x21')];var _0x19402b=_0x38f683?0x0:_0x123c64[_0x23b9('0x1e')];var _0x13676e=_0x38f683?_0x52b017['count']:_0x123c64[_0x23b9('0x1e')]+_0x123c64[_0x23b9('0x20')];var _0x46d9be;if(_0x13676e>=_0x3a5da0){_0x13676e=_0x3a5da0;_0x46d9be=0xc8;}else{_0x46d9be=0xce;}_0x4d2e67[_0x23b9('0x1b')](_0x46d9be);return _0x4d2e67[_0x23b9('0x22')](_0x23b9('0x23'),_0x19402b+'-'+_0x13676e+'/'+_0x3a5da0)[_0x23b9('0x1d')](_0x52b017);}return null;};}function patchUpdates(_0x4c71a1){return function(_0x165079){try{jsonpatch[_0x23b9('0x24')](_0x165079,_0x4c71a1,!![]);}catch(_0x52fddf){return BPromise[_0x23b9('0x25')](_0x52fddf);}return _0x165079[_0x23b9('0x26')]();};}function saveUpdates(_0x5540ac,_0x18ba4c){return function(_0x384707){if(_0x384707){return _0x384707[_0x23b9('0x27')](_0x5540ac)['then'](function(_0x2f620a){return _0x2f620a;});}return null;};}function removeEntity(_0x538cac,_0x3fe7a0){return function(_0x39f264){if(_0x39f264){return _0x39f264['destroy']()[_0x23b9('0x28')](function(){var _0x43582a=_0x39f264[_0x23b9('0x29')]({'plain':!![]});var _0x22885a=_0x23b9('0x2a');return db[_0x23b9('0x2b')]['destroy']({'where':{'type':_0x22885a,'resourceId':_0x43582a['id']}})['then'](function(){return _0x39f264;});})[_0x23b9('0x28')](function(){_0x538cac[_0x23b9('0x1b')](0xcc)[_0x23b9('0x1c')]();});}};}function handleEntityNotFound(_0x5785f9,_0x5e2182){return function(_0x4e404c){if(!_0x4e404c){_0x5785f9[_0x23b9('0x1a')](0x194);}return _0x4e404c;};}function handleError(_0xeb790c,_0x3f6157){_0x3f6157=_0x3f6157||0x1f4;return function(_0x85e489){logger[_0x23b9('0x2c')](_0x85e489['stack']);if(_0x85e489[_0x23b9('0x2d')]){delete _0x85e489['name'];}_0xeb790c[_0x23b9('0x1b')](_0x3f6157)[_0x23b9('0x2e')](_0x85e489);};}exports['index']=function(_0x3a1717,_0x437c00){var _0x169225={},_0x455bee={},_0x42e6f5={'count':0x0,'rows':[]};var _0x2c19d6=_[_0x23b9('0x2f')](db[_0x23b9('0x30')][_0x23b9('0x31')],function(_0x2750e3){return{'name':_0x2750e3['fieldName'],'type':_0x2750e3[_0x23b9('0x32')][_0x23b9('0x33')]};});_0x455bee[_0x23b9('0x34')]=_['map'](_0x2c19d6,'name');_0x455bee[_0x23b9('0x35')]=_[_0x23b9('0x36')](_0x3a1717['query']);_0x455bee[_0x23b9('0x37')]=_['intersection'](_0x455bee[_0x23b9('0x34')],_0x455bee[_0x23b9('0x35')]);_0x169225[_0x23b9('0x38')]=_[_0x23b9('0x39')](_0x455bee[_0x23b9('0x34')],qs[_0x23b9('0x3a')](_0x3a1717['query'][_0x23b9('0x3a')]));_0x169225[_0x23b9('0x38')]=_0x169225[_0x23b9('0x38')][_0x23b9('0x3b')]?_0x169225['attributes']:_0x455bee[_0x23b9('0x34')];if(!_0x3a1717[_0x23b9('0x35')]['hasOwnProperty']('nolimit')){_0x169225[_0x23b9('0x20')]=qs[_0x23b9('0x20')](_0x3a1717[_0x23b9('0x35')][_0x23b9('0x20')]);_0x169225['offset']=qs['offset'](_0x3a1717[_0x23b9('0x35')][_0x23b9('0x1e')]);}_0x169225['order']=qs[_0x23b9('0x3c')](_0x3a1717[_0x23b9('0x35')][_0x23b9('0x3c')]);_0x169225[_0x23b9('0x3d')]=qs[_0x23b9('0x37')](_['pick'](_0x3a1717['query'],_0x455bee['filters']),_0x2c19d6);if(_0x3a1717[_0x23b9('0x35')][_0x23b9('0x3e')]){_0x169225[_0x23b9('0x3d')]=_[_0x23b9('0x3f')](_0x169225[_0x23b9('0x3d')],{'$or':_[_0x23b9('0x2f')](_0x2c19d6,function(_0x5f24d7){if(_0x5f24d7[_0x23b9('0x32')]!==_0x23b9('0x40')){var _0x2d1587={};_0x2d1587[_0x5f24d7[_0x23b9('0x2d')]]={'$like':'%'+_0x3a1717[_0x23b9('0x35')][_0x23b9('0x3e')]+'%'};return _0x2d1587;}})});}_0x169225=_['merge']({},_0x169225,_0x3a1717['options']);var _0x35e0d6={'where':_0x169225[_0x23b9('0x3d')]};return db[_0x23b9('0x30')][_0x23b9('0x21')](_0x35e0d6)['then'](function(_0x3340d5){_0x42e6f5[_0x23b9('0x21')]=_0x3340d5;if(_0x3a1717['query']['includeAll']){_0x169225[_0x23b9('0x41')]=[{'all':!![]}];}return db['Template'][_0x23b9('0x42')](_0x169225);})[_0x23b9('0x28')](function(_0x3444b4){_0x42e6f5[_0x23b9('0x43')]=_0x3444b4;return _0x42e6f5;})[_0x23b9('0x28')](respondWithFilteredResult(_0x437c00,_0x169225))[_0x23b9('0x44')](handleError(_0x437c00,null));};exports[_0x23b9('0x45')]=function(_0x108835,_0x302e1b){var _0xd6137d={'raw':!![],'where':{'id':_0x108835[_0x23b9('0x46')]['id']}},_0x235892={};_0x235892['model']=_[_0x23b9('0x36')](db[_0x23b9('0x30')][_0x23b9('0x31')]);_0x235892[_0x23b9('0x35')]=_[_0x23b9('0x36')](_0x108835['query']);_0x235892[_0x23b9('0x37')]=_['intersection'](_0x235892[_0x23b9('0x34')],_0x235892[_0x23b9('0x35')]);_0xd6137d[_0x23b9('0x38')]=_[_0x23b9('0x39')](_0x235892[_0x23b9('0x34')],qs[_0x23b9('0x3a')](_0x108835[_0x23b9('0x35')][_0x23b9('0x3a')]));_0xd6137d['attributes']=_0xd6137d[_0x23b9('0x38')][_0x23b9('0x3b')]?_0xd6137d[_0x23b9('0x38')]:_0x235892['model'];if(_0x108835['query'][_0x23b9('0x47')]){_0xd6137d[_0x23b9('0x41')]=[{'all':!![]}];}_0xd6137d=_[_0x23b9('0x3f')]({},_0xd6137d,_0x108835[_0x23b9('0x48')]);return db[_0x23b9('0x30')]['find'](_0xd6137d)[_0x23b9('0x28')](handleEntityNotFound(_0x302e1b,null))[_0x23b9('0x28')](respondWithResult(_0x302e1b,null))[_0x23b9('0x44')](handleError(_0x302e1b,null));};exports[_0x23b9('0x49')]=function(_0x3c7dcc,_0x442cf5){return db[_0x23b9('0x30')]['create'](_0x3c7dcc['body'],{})['then'](function(_0xd3ae17){var _0x37fb8d=_0x3c7dcc['user'][_0x23b9('0x29')]({'plain':!![]});if(!_0x37fb8d)throw new Error(_0x23b9('0x4a'));if(_0x37fb8d[_0x23b9('0x4b')]===_0x23b9('0x4c')){var _0x58a9d9=_0xd3ae17[_0x23b9('0x29')]({'plain':!![]});var _0x209a26=_0x23b9('0x2a');return db['UserProfileSection'][_0x23b9('0x4d')]({'where':{'name':_0x209a26,'userProfileId':_0x37fb8d[_0x23b9('0x4e')]},'raw':!![]})[_0x23b9('0x28')](function(_0x3e3867){if(_0x3e3867&&_0x3e3867['autoAssociation']===0x0){return db['UserProfileResource'][_0x23b9('0x49')]({'name':_0x58a9d9['name'],'resourceId':_0x58a9d9['id'],'type':_0x3e3867[_0x23b9('0x2d')],'sectionId':_0x3e3867['id']},{})[_0x23b9('0x28')](function(){return _0xd3ae17;});}else{return _0xd3ae17;}})['catch'](function(_0x39c2ea){logger[_0x23b9('0x2c')](_0x23b9('0x4f'),_0x39c2ea);throw _0x39c2ea;});}return _0xd3ae17;})[_0x23b9('0x28')](respondWithResult(_0x442cf5,0xc9))[_0x23b9('0x44')](handleError(_0x442cf5,null));};exports[_0x23b9('0x27')]=function(_0x3b1707,_0x59e5fc){if(_0x3b1707[_0x23b9('0x50')]['id']){delete _0x3b1707[_0x23b9('0x50')]['id'];}return db[_0x23b9('0x30')][_0x23b9('0x4d')]({'where':{'id':_0x3b1707[_0x23b9('0x46')]['id']}})[_0x23b9('0x28')](handleEntityNotFound(_0x59e5fc,null))[_0x23b9('0x28')](saveUpdates(_0x3b1707[_0x23b9('0x50')],null))[_0x23b9('0x28')](respondWithResult(_0x59e5fc,null))[_0x23b9('0x44')](handleError(_0x59e5fc,null));};exports['destroy']=function(_0x1de958,_0x3c6447){return db[_0x23b9('0x30')]['find']({'where':{'id':_0x1de958[_0x23b9('0x46')]['id']}})[_0x23b9('0x28')](handleEntityNotFound(_0x3c6447,null))[_0x23b9('0x28')](removeEntity(_0x3c6447,null))[_0x23b9('0x44')](handleError(_0x3c6447,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a1e3787..febde7b 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 _0x891e=['exports','define','Template','tools_templates','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1da13d,_0x22ed77){var _0x834533=function(_0x426164){while(--_0x426164){_0x1da13d['push'](_0x1da13d['shift']());}};_0x834533(++_0x22ed77);}(_0x891e,0x130));var _0xe891=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0x891e[_0x4bedce];return _0x4fd2fb;};'use strict';var _=require('lodash');var util=require(_0xe891('0x0'));var logger=require(_0xe891('0x1'))(_0xe891('0x2'));var moment=require('moment');var BPromise=require(_0xe891('0x3'));var rp=require(_0xe891('0x4'));var fs=require('fs');var path=require(_0xe891('0x5'));var rimraf=require(_0xe891('0x6'));var config=require(_0xe891('0x7'));var attributes=require('./template.attributes');module[_0xe891('0x8')]=function(_0x119e3d,_0x206fb0){return _0x119e3d[_0xe891('0x9')](_0xe891('0xa'),attributes,{'tableName':_0xe891('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2300=['exports','define','tools_templates','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./template.attributes'];(function(_0xfd67d6,_0x300328){var _0x4259a4=function(_0x137dfa){while(--_0x137dfa){_0xfd67d6['push'](_0xfd67d6['shift']());}};_0x4259a4(++_0x300328);}(_0x2300,0x99));var _0x0230=function(_0x1a510f,_0x3d8dc2){_0x1a510f=_0x1a510f-0x0;var _0x1e93ff=_0x2300[_0x1a510f];return _0x1e93ff;};'use strict';var _=require(_0x0230('0x0'));var util=require('util');var logger=require(_0x0230('0x1'))('api');var moment=require(_0x0230('0x2'));var BPromise=require(_0x0230('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0230('0x4'));var rimraf=require('rimraf');var config=require(_0x0230('0x5'));var attributes=require(_0x0230('0x6'));module[_0x0230('0x7')]=function(_0x18f88b,_0x39ecff){return _0x18f88b[_0x0230('0x8')]('Template',attributes,{'tableName':_0x0230('0x9'),'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 67da817..4813c40 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 _0x2567=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment'];(function(_0x3b876c,_0x340f60){var _0x2d5333=function(_0x2d5bf1){while(--_0x2d5bf1){_0x3b876c['push'](_0x3b876c['shift']());}};_0x2d5333(++_0x340f60);}(_0x2567,0x14a));var _0x7256=function(_0x11499b,_0x56cdad){_0x11499b=_0x11499b-0x0;var _0x5e207b=_0x2567[_0x11499b];return _0x5e207b;};'use strict';var _=require(_0x7256('0x0'));var util=require(_0x7256('0x1'));var moment=require(_0x7256('0x2'));var BPromise=require(_0x7256('0x3'));var rs=require(_0x7256('0x4'));var fs=require('fs');var Redis=require(_0x7256('0x5'));var db=require(_0x7256('0x6'))['db'];var utils=require(_0x7256('0x7'));var logger=require(_0x7256('0x8'))(_0x7256('0x9'));var config=require(_0x7256('0xa'));var jayson=require(_0x7256('0xb'));var client=jayson[_0x7256('0xc')][_0x7256('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x94de30,_0x55aba0,_0x18d39f){return new BPromise(function(_0x41ea59,_0x55723d){return client[_0x7256('0xe')](_0x94de30,_0x18d39f)[_0x7256('0xf')](function(_0x14eee4){logger[_0x7256('0x10')](_0x7256('0x11'),_0x55aba0,_0x7256('0x12'));logger[_0x7256('0x13')](_0x7256('0x14'),_0x55aba0,_0x7256('0x12'),JSON[_0x7256('0x15')](_0x14eee4));if(_0x14eee4[_0x7256('0x16')]){if(_0x14eee4[_0x7256('0x16')][_0x7256('0x17')]===0x1f4){logger[_0x7256('0x16')]('Template,\x20%s,\x20%s',_0x55aba0,_0x14eee4['error'][_0x7256('0x18')]);return _0x55723d(_0x14eee4[_0x7256('0x16')][_0x7256('0x18')]);}logger[_0x7256('0x16')]('Template,\x20%s,\x20%s',_0x55aba0,_0x14eee4[_0x7256('0x16')][_0x7256('0x18')]);return _0x41ea59(_0x14eee4['error'][_0x7256('0x18')]);}else{logger[_0x7256('0x10')](_0x7256('0x11'),_0x55aba0,_0x7256('0x12'));_0x41ea59(_0x14eee4[_0x7256('0x19')]['message']);}})[_0x7256('0x1a')](function(_0x21eb01){logger[_0x7256('0x16')](_0x7256('0x11'),_0x55aba0,_0x21eb01);_0x55723d(_0x21eb01);});});}exports[_0x7256('0x1b')]=function(_0xa08eaa){var _0x13277a=this;return new Promise(function(_0x16d98a,_0xaf2b84){return db[_0x7256('0x1c')][_0x7256('0x1d')]({'raw':_0xa08eaa[_0x7256('0x1e')]?_0xa08eaa[_0x7256('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xa08eaa[_0x7256('0x1e')]?_0xa08eaa[_0x7256('0x1e')][_0x7256('0x1f')]||null:null,'attributes':_0xa08eaa[_0x7256('0x1e')]?_0xa08eaa[_0x7256('0x1e')][_0x7256('0x20')]||null:null,'limit':_0xa08eaa[_0x7256('0x1e')]?_0xa08eaa[_0x7256('0x1e')][_0x7256('0x21')]||null:null,'include':_0xa08eaa[_0x7256('0x1e')]?_0xa08eaa[_0x7256('0x1e')][_0x7256('0x22')]?_[_0x7256('0x23')](_0xa08eaa[_0x7256('0x1e')][_0x7256('0x22')],function(_0x3f2554){return{'model':db[_0x3f2554[_0x7256('0x24')]],'as':_0x3f2554['as'],'attributes':_0x3f2554['attributes'],'include':_0x3f2554[_0x7256('0x22')]?_[_0x7256('0x23')](_0x3f2554[_0x7256('0x22')],function(_0xf68163){return{'model':db[_0xf68163[_0x7256('0x24')]],'as':_0xf68163['as'],'attributes':_0xf68163[_0x7256('0x20')],'include':_0xf68163[_0x7256('0x22')]?_['map'](_0xf68163['include'],function(_0x924b10){return{'model':db[_0x924b10[_0x7256('0x24')]],'as':_0x924b10['as'],'attributes':_0x924b10[_0x7256('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7256('0xf')](function(_0x506935){logger[_0x7256('0x10')]('GetTemplate',_0xa08eaa);logger[_0x7256('0x13')](_0x7256('0x1b'),_0xa08eaa,JSON['stringify'](_0x506935));_0x16d98a(_0x506935);})[_0x7256('0x1a')](function(_0x16e75a){logger[_0x7256('0x16')](_0x7256('0x1b'),_0x16e75a[_0x7256('0x18')],_0xa08eaa);_0xaf2b84(_0x13277a[_0x7256('0x16')](0x1f4,_0x16e75a[_0x7256('0x18')]));});});}; \ No newline at end of file +var _0x62cb=['attributes','info','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','map','include','model'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x62cb,0x196));var _0xb62c=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x62cb[_0xc8a931];return _0x28bd27;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb62c('0x0'));var BPromise=require(_0xb62c('0x1'));var rs=require(_0xb62c('0x2'));var fs=require('fs');var Redis=require(_0xb62c('0x3'));var db=require(_0xb62c('0x4'))['db'];var utils=require(_0xb62c('0x5'));var logger=require(_0xb62c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb62c('0x7'));var client=jayson[_0xb62c('0x8')][_0xb62c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1efcfb,_0x58509b,_0xfda3da){return new BPromise(function(_0x5d1f67,_0x397ad3){return client[_0xb62c('0xa')](_0x1efcfb,_0xfda3da)[_0xb62c('0xb')](function(_0x4a28c5){logger['info'](_0xb62c('0xc'),_0x58509b,_0xb62c('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x58509b,_0xb62c('0xd'),JSON[_0xb62c('0xe')](_0x4a28c5));if(_0x4a28c5['error']){if(_0x4a28c5[_0xb62c('0xf')][_0xb62c('0x10')]===0x1f4){logger[_0xb62c('0xf')](_0xb62c('0xc'),_0x58509b,_0x4a28c5[_0xb62c('0xf')][_0xb62c('0x11')]);return _0x397ad3(_0x4a28c5['error']['message']);}logger[_0xb62c('0xf')](_0xb62c('0xc'),_0x58509b,_0x4a28c5[_0xb62c('0xf')][_0xb62c('0x11')]);return _0x5d1f67(_0x4a28c5[_0xb62c('0xf')][_0xb62c('0x11')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x58509b,_0xb62c('0xd'));_0x5d1f67(_0x4a28c5[_0xb62c('0x12')][_0xb62c('0x11')]);}})[_0xb62c('0x13')](function(_0x3febfc){logger[_0xb62c('0xf')](_0xb62c('0xc'),_0x58509b,_0x3febfc);_0x397ad3(_0x3febfc);});});}exports[_0xb62c('0x14')]=function(_0x48deb1){var _0x19ed1f=this;return new Promise(function(_0x416adf,_0xe49d4c){return db[_0xb62c('0x15')][_0xb62c('0x16')]({'raw':_0x48deb1[_0xb62c('0x17')]?_0x48deb1[_0xb62c('0x17')][_0xb62c('0x18')]===undefined?!![]:![]:!![],'where':_0x48deb1[_0xb62c('0x17')]?_0x48deb1[_0xb62c('0x17')]['where']||null:null,'attributes':_0x48deb1[_0xb62c('0x17')]?_0x48deb1['options']['attributes']||null:null,'limit':_0x48deb1['options']?_0x48deb1[_0xb62c('0x17')]['limit']||null:null,'include':_0x48deb1[_0xb62c('0x17')]?_0x48deb1[_0xb62c('0x17')]['include']?_[_0xb62c('0x19')](_0x48deb1['options'][_0xb62c('0x1a')],function(_0xe68a98){return{'model':db[_0xe68a98[_0xb62c('0x1b')]],'as':_0xe68a98['as'],'attributes':_0xe68a98[_0xb62c('0x1c')],'include':_0xe68a98[_0xb62c('0x1a')]?_[_0xb62c('0x19')](_0xe68a98[_0xb62c('0x1a')],function(_0x14fbb5){return{'model':db[_0x14fbb5[_0xb62c('0x1b')]],'as':_0x14fbb5['as'],'attributes':_0x14fbb5[_0xb62c('0x1c')],'include':_0x14fbb5[_0xb62c('0x1a')]?_['map'](_0x14fbb5['include'],function(_0x10afbe){return{'model':db[_0x10afbe[_0xb62c('0x1b')]],'as':_0x10afbe['as'],'attributes':_0x10afbe[_0xb62c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x560b9d){logger[_0xb62c('0x1d')](_0xb62c('0x14'),_0x48deb1);logger[_0xb62c('0x1e')](_0xb62c('0x14'),_0x48deb1,JSON[_0xb62c('0xe')](_0x560b9d));_0x416adf(_0x560b9d);})[_0xb62c('0x13')](function(_0x380eb8){logger['error']('GetTemplate',_0x380eb8['message'],_0x48deb1);_0xe49d4c(_0x19ed1f[_0xb62c('0xf')](0x1f4,_0x380eb8[_0xb62c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7a07d9a..919acf6 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 _0x234b=['addAnyCondition','addAction','put','delete','/:id','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/any_conditions','getAnyConditions','/:id/actions','post','/:id/all_conditions','addAllCondition'];(function(_0x689b17,_0x3aafdb){var _0x28461a=function(_0xd69922){while(--_0xd69922){_0x689b17['push'](_0x689b17['shift']());}};_0x28461a(++_0x3aafdb);}(_0x234b,0x8a));var _0xb234=function(_0x42204c,_0x39d3f1){_0x42204c=_0x42204c-0x0;var _0x530e87=_0x234b[_0x42204c];return _0x530e87;};'use strict';var multer=require(_0xb234('0x0'));var util=require(_0xb234('0x1'));var path=require(_0xb234('0x2'));var timeout=require(_0xb234('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb234('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb234('0x5'));var controller=require(_0xb234('0x6'));router[_0xb234('0x7')]('/',auth[_0xb234('0x8')](),controller['index']);router['get']('/:id',auth[_0xb234('0x8')](),controller[_0xb234('0x9')]);router[_0xb234('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0xb234('0xa'),auth[_0xb234('0x8')](),controller[_0xb234('0xb')]);router['get'](_0xb234('0xc'),auth[_0xb234('0x8')](),controller['getActions']);router['post']('/',auth[_0xb234('0x8')](),controller['create']);router[_0xb234('0xd')](_0xb234('0xe'),auth[_0xb234('0x8')](),controller[_0xb234('0xf')]);router[_0xb234('0xd')](_0xb234('0xa'),auth['isAuthenticated'](),controller[_0xb234('0x10')]);router[_0xb234('0xd')](_0xb234('0xc'),auth[_0xb234('0x8')](),controller[_0xb234('0x11')]);router[_0xb234('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb234('0x13')](_0xb234('0x14'),auth[_0xb234('0x8')](),controller['destroy']);module[_0xb234('0x15')]=router; \ No newline at end of file +var _0x8ce2=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put'];(function(_0x26f36f,_0xf90e9b){var _0x23104d=function(_0x10905){while(--_0x10905){_0x26f36f['push'](_0x26f36f['shift']());}};_0x23104d(++_0xf90e9b);}(_0x8ce2,0x18b));var _0x28ce=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x8ce2[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0x28ce('0x0'));var util=require(_0x28ce('0x1'));var path=require('path');var timeout=require(_0x28ce('0x2'));var express=require(_0x28ce('0x3'));var router=express[_0x28ce('0x4')]();var fs_extra=require(_0x28ce('0x5'));var auth=require(_0x28ce('0x6'));var interaction=require(_0x28ce('0x7'));var config=require('../../config/environment');var controller=require(_0x28ce('0x8'));router[_0x28ce('0x9')]('/',auth[_0x28ce('0xa')](),controller[_0x28ce('0xb')]);router[_0x28ce('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x28ce('0xc')]);router[_0x28ce('0x9')](_0x28ce('0xd'),auth[_0x28ce('0xa')](),controller[_0x28ce('0xe')]);router[_0x28ce('0x9')]('/:id/any_conditions',auth[_0x28ce('0xa')](),controller[_0x28ce('0xf')]);router[_0x28ce('0x9')](_0x28ce('0x10'),auth['isAuthenticated'](),controller[_0x28ce('0x11')]);router[_0x28ce('0x12')]('/',auth['isAuthenticated'](),controller[_0x28ce('0x13')]);router['post'](_0x28ce('0xd'),auth[_0x28ce('0xa')](),controller[_0x28ce('0x14')]);router['post'](_0x28ce('0x15'),auth[_0x28ce('0xa')](),controller[_0x28ce('0x16')]);router[_0x28ce('0x12')](_0x28ce('0x10'),auth[_0x28ce('0xa')](),controller[_0x28ce('0x17')]);router[_0x28ce('0x18')](_0x28ce('0x19'),auth['isAuthenticated'](),controller[_0x28ce('0x1a')]);router[_0x28ce('0x1b')](_0x28ce('0x19'),auth[_0x28ce('0xa')](),controller[_0x28ce('0x1c')]);module[_0x28ce('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b727c9b..79ae077 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 _0x3fa8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1b96fb,_0x22cffe){var _0x4e011d=function(_0x126d48){while(--_0x126d48){_0x1b96fb['push'](_0x1b96fb['shift']());}};_0x4e011d(++_0x22cffe);}(_0x3fa8,0x191));var _0x83fa=function(_0x149768,_0x1efa83){_0x149768=_0x149768-0x0;var _0x41644f=_0x3fa8[_0x149768];return _0x41644f;};'use strict';var Sequelize=require(_0x83fa('0x0'));module[_0x83fa('0x1')]={'name':{'type':Sequelize[_0x83fa('0x2')]},'channel':{'type':Sequelize[_0x83fa('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x83fa('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2aef=['STRING','BOOLEAN','exports'];(function(_0x4a97ea,_0x1ab286){var _0x47f781=function(_0x587aaa){while(--_0x587aaa){_0x4a97ea['push'](_0x4a97ea['shift']());}};_0x47f781(++_0x1ab286);}(_0x2aef,0x1f4));var _0xf2ae=function(_0x447f42,_0x1d7077){_0x447f42=_0x447f42-0x0;var _0x30248f=_0x2aef[_0x447f42];return _0x30248f;};'use strict';var Sequelize=require('sequelize');module[_0xf2ae('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf2ae('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf2ae('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 689110f..5755258 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 _0x81cd=['Content-Range','apply','reject','save','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','fieldName','key','keys','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','Trigger','includeAll','include','findAll','catch','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','params','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','addAction','Action','pick','getActions','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x2d1908,_0x45352d){var _0x14e672=function(_0x184888){while(--_0x184888){_0x2d1908['push'](_0x2d1908['shift']());}};_0x14e672(++_0x45352d);}(_0x81cd,0xa3));var _0xd81c=function(_0x2fdd4a,_0x521804){_0x2fdd4a=_0x2fdd4a-0x0;var _0xed9eb5=_0x81cd[_0x2fdd4a];return _0xed9eb5;};'use strict';var emlformat=require(_0xd81c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd81c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd81c('0x2'));var Mustache=require(_0xd81c('0x3'));var util=require(_0xd81c('0x4'));var path=require(_0xd81c('0x5'));var sox=require(_0xd81c('0x6'));var csv=require(_0xd81c('0x7'));var ejs=require(_0xd81c('0x8'));var fs=require('fs');var fs_extra=require(_0xd81c('0x9'));var _=require(_0xd81c('0xa'));var squel=require(_0xd81c('0xb'));var crypto=require(_0xd81c('0xc'));var jsforce=require(_0xd81c('0xd'));var deskjs=require(_0xd81c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd81c('0xf'));var Papa=require(_0xd81c('0x10'));var Redis=require(_0xd81c('0x11'));var authService=require(_0xd81c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd81c('0x13'));var hardwareService=require(_0xd81c('0x14'));var logger=require('../../config/logger')(_0xd81c('0x15'));var utils=require(_0xd81c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd81c('0x17'));var db=require(_0xd81c('0x18'))['db'];function respondWithStatusCode(_0xe05631,_0x507ef4){_0x507ef4=_0x507ef4||0xcc;return function(_0x733815){if(_0x733815){return _0xe05631[_0xd81c('0x19')](_0x507ef4);}return _0xe05631['status'](_0x507ef4)[_0xd81c('0x1a')]();};}function respondWithResult(_0x134d5e,_0x3a9e47){_0x3a9e47=_0x3a9e47||0xc8;return function(_0x5dc440){if(_0x5dc440){return _0x134d5e[_0xd81c('0x1b')](_0x3a9e47)[_0xd81c('0x1c')](_0x5dc440);}};}function respondWithFilteredResult(_0x251443,_0x4af6a8){return function(_0x4a8aac){if(_0x4a8aac){var _0x40c2e8=typeof _0x4af6a8[_0xd81c('0x1d')]===_0xd81c('0x1e')&&typeof _0x4af6a8['limit']===_0xd81c('0x1e');var _0x1feaeb=_0x4a8aac[_0xd81c('0x1f')];var _0x2e6ca8=_0x40c2e8?0x0:_0x4af6a8[_0xd81c('0x1d')];var _0x176b4b=_0x40c2e8?_0x4a8aac[_0xd81c('0x1f')]:_0x4af6a8['offset']+_0x4af6a8['limit'];var _0x3faae1;if(_0x176b4b>=_0x1feaeb){_0x176b4b=_0x1feaeb;_0x3faae1=0xc8;}else{_0x3faae1=0xce;}_0x251443[_0xd81c('0x1b')](_0x3faae1);return _0x251443[_0xd81c('0x20')](_0xd81c('0x21'),_0x2e6ca8+'-'+_0x176b4b+'/'+_0x1feaeb)[_0xd81c('0x1c')](_0x4a8aac);}return null;};}function patchUpdates(_0x53d015){return function(_0x500bd3){try{jsonpatch[_0xd81c('0x22')](_0x500bd3,_0x53d015,!![]);}catch(_0x3292dd){return BPromise[_0xd81c('0x23')](_0x3292dd);}return _0x500bd3[_0xd81c('0x24')]();};}function saveUpdates(_0x2a7d0f,_0x2cd321){return function(_0x49224b){if(_0x49224b){return _0x49224b['update'](_0x2a7d0f)['then'](function(_0x40450d){return _0x40450d;});}return null;};}function removeEntity(_0x5bcd85,_0x27c7ee){return function(_0x60a3e6){if(_0x60a3e6){return _0x60a3e6[_0xd81c('0x25')]()[_0xd81c('0x26')](function(){var _0x20b0c2=_0x60a3e6[_0xd81c('0x27')]({'plain':!![]});var _0x2c1604=_0xd81c('0x28');return db[_0xd81c('0x29')][_0xd81c('0x25')]({'where':{'type':_0x2c1604,'resourceId':_0x20b0c2['id']}})[_0xd81c('0x26')](function(){return _0x60a3e6;});})[_0xd81c('0x26')](function(){_0x5bcd85[_0xd81c('0x1b')](0xcc)[_0xd81c('0x1a')]();});}};}function handleEntityNotFound(_0x3deaac,_0x2c9533){return function(_0x17b459){if(!_0x17b459){_0x3deaac['sendStatus'](0x194);}return _0x17b459;};}function handleError(_0x2ef826,_0x3d71c2){_0x3d71c2=_0x3d71c2||0x1f4;return function(_0x272128){logger[_0xd81c('0x2a')](_0x272128[_0xd81c('0x2b')]);if(_0x272128['name']){delete _0x272128[_0xd81c('0x2c')];}_0x2ef826[_0xd81c('0x1b')](_0x3d71c2)[_0xd81c('0x2d')](_0x272128);};}exports[_0xd81c('0x2e')]=function(_0x359d44,_0x54a609){var _0x3a7587={},_0x3084f1={},_0x69e115={'count':0x0,'rows':[]};var _0x58828e=_[_0xd81c('0x2f')](db['Trigger']['rawAttributes'],function(_0x3e64bd){return{'name':_0x3e64bd[_0xd81c('0x30')],'type':_0x3e64bd['type'][_0xd81c('0x31')]};});_0x3084f1['model']=_['map'](_0x58828e,_0xd81c('0x2c'));_0x3084f1['query']=_[_0xd81c('0x32')](_0x359d44['query']);_0x3084f1['filters']=_['intersection'](_0x3084f1[_0xd81c('0x33')],_0x3084f1['query']);_0x3a7587['attributes']=_[_0xd81c('0x34')](_0x3084f1[_0xd81c('0x33')],qs[_0xd81c('0x35')](_0x359d44[_0xd81c('0x36')]['fields']));_0x3a7587[_0xd81c('0x37')]=_0x3a7587[_0xd81c('0x37')][_0xd81c('0x38')]?_0x3a7587[_0xd81c('0x37')]:_0x3084f1[_0xd81c('0x33')];if(!_0x359d44['query'][_0xd81c('0x39')](_0xd81c('0x3a'))){_0x3a7587[_0xd81c('0x3b')]=qs[_0xd81c('0x3b')](_0x359d44[_0xd81c('0x36')][_0xd81c('0x3b')]);_0x3a7587[_0xd81c('0x1d')]=qs[_0xd81c('0x1d')](_0x359d44[_0xd81c('0x36')][_0xd81c('0x1d')]);}_0x3a7587[_0xd81c('0x3c')]=qs[_0xd81c('0x3d')](_0x359d44[_0xd81c('0x36')][_0xd81c('0x3d')]);_0x3a7587[_0xd81c('0x3e')]=qs['filters'](_['pick'](_0x359d44[_0xd81c('0x36')],_0x3084f1[_0xd81c('0x3f')]),_0x58828e);if(_0x359d44['query'][_0xd81c('0x40')]){_0x3a7587[_0xd81c('0x3e')]=_[_0xd81c('0x41')](_0x3a7587[_0xd81c('0x3e')],{'$or':_[_0xd81c('0x2f')](_0x58828e,function(_0x2f52ee){if(_0x2f52ee[_0xd81c('0x42')]!==_0xd81c('0x43')){var _0x3c857f={};_0x3c857f[_0x2f52ee[_0xd81c('0x2c')]]={'$like':'%'+_0x359d44[_0xd81c('0x36')][_0xd81c('0x40')]+'%'};return _0x3c857f;}})});}_0x3a7587=_[_0xd81c('0x41')]({},_0x3a7587,_0x359d44[_0xd81c('0x44')]);var _0x50b92c={'where':_0x3a7587[_0xd81c('0x3e')]};return db[_0xd81c('0x45')][_0xd81c('0x1f')](_0x50b92c)[_0xd81c('0x26')](function(_0x5be91c){_0x69e115[_0xd81c('0x1f')]=_0x5be91c;if(_0x359d44[_0xd81c('0x36')][_0xd81c('0x46')]){_0x3a7587[_0xd81c('0x47')]=[{'all':!![]}];}return db[_0xd81c('0x45')][_0xd81c('0x48')](_0x3a7587);})[_0xd81c('0x26')](function(_0x484617){_0x69e115['rows']=_0x484617;return _0x69e115;})[_0xd81c('0x26')](respondWithFilteredResult(_0x54a609,_0x3a7587))[_0xd81c('0x49')](handleError(_0x54a609,null));};exports['show']=function(_0x4a15f7,_0x156f74){var _0x545f03={'raw':![],'where':{'id':_0x4a15f7['params']['id']}},_0x4df11c={};_0x4df11c[_0xd81c('0x33')]=_[_0xd81c('0x32')](db[_0xd81c('0x45')][_0xd81c('0x4a')]);_0x4df11c['query']=_[_0xd81c('0x32')](_0x4a15f7[_0xd81c('0x36')]);_0x4df11c[_0xd81c('0x3f')]=_[_0xd81c('0x34')](_0x4df11c[_0xd81c('0x33')],_0x4df11c[_0xd81c('0x36')]);_0x545f03[_0xd81c('0x37')]=_[_0xd81c('0x34')](_0x4df11c[_0xd81c('0x33')],qs['fields'](_0x4a15f7[_0xd81c('0x36')][_0xd81c('0x35')]));_0x545f03[_0xd81c('0x37')]=_0x545f03[_0xd81c('0x37')][_0xd81c('0x38')]?_0x545f03['attributes']:_0x4df11c[_0xd81c('0x33')];if(_0x4a15f7[_0xd81c('0x36')][_0xd81c('0x46')]){_0x545f03[_0xd81c('0x47')]=[{'all':!![]}];}_0x545f03=_[_0xd81c('0x41')]({},_0x545f03,_0x4a15f7['options']);return db[_0xd81c('0x45')]['find'](_0x545f03)[_0xd81c('0x26')](handleEntityNotFound(_0x156f74,null))[_0xd81c('0x26')](respondWithResult(_0x156f74,null))['catch'](handleError(_0x156f74,null));};exports[_0xd81c('0x4b')]=function(_0x221a27,_0x11d31d){return db[_0xd81c('0x45')][_0xd81c('0x4b')](_0x221a27[_0xd81c('0x4c')],{})[_0xd81c('0x26')](function(_0x3610e0){var _0x33b2c5=_0x221a27[_0xd81c('0x4d')][_0xd81c('0x27')]({'plain':!![]});if(!_0x33b2c5)throw new Error(_0xd81c('0x4e'));if(_0x33b2c5[_0xd81c('0x4f')]==='user'){var _0x783291=_0x3610e0[_0xd81c('0x27')]({'plain':!![]});var _0x282bc5=_0xd81c('0x28');return db[_0xd81c('0x50')][_0xd81c('0x51')]({'where':{'name':_0x282bc5,'userProfileId':_0x33b2c5[_0xd81c('0x52')]},'raw':!![]})[_0xd81c('0x26')](function(_0x3738f3){if(_0x3738f3&&_0x3738f3[_0xd81c('0x53')]===0x0){return db['UserProfileResource'][_0xd81c('0x4b')]({'name':_0x783291[_0xd81c('0x2c')],'resourceId':_0x783291['id'],'type':_0x3738f3[_0xd81c('0x2c')],'sectionId':_0x3738f3['id']},{})['then'](function(){return _0x3610e0;});}else{return _0x3610e0;}})[_0xd81c('0x49')](function(_0x44ace7){logger[_0xd81c('0x2a')](_0xd81c('0x54'),_0x44ace7);throw _0x44ace7;});}return _0x3610e0;})[_0xd81c('0x26')](respondWithResult(_0x11d31d,0xc9))['catch'](handleError(_0x11d31d,null));};exports[_0xd81c('0x55')]=function(_0x4c54c5,_0x397abf){if(_0x4c54c5[_0xd81c('0x4c')]['id']){delete _0x4c54c5[_0xd81c('0x4c')]['id'];}return db[_0xd81c('0x45')][_0xd81c('0x51')]({'where':{'id':_0x4c54c5['params']['id']}})['then'](handleEntityNotFound(_0x397abf,null))[_0xd81c('0x26')](saveUpdates(_0x4c54c5[_0xd81c('0x4c')],null))['then'](respondWithResult(_0x397abf,null))[_0xd81c('0x49')](handleError(_0x397abf,null));};exports[_0xd81c('0x25')]=function(_0x309be1,_0x30a7f3){return db[_0xd81c('0x45')][_0xd81c('0x51')]({'where':{'id':_0x309be1['params']['id']}})[_0xd81c('0x26')](handleEntityNotFound(_0x30a7f3,null))[_0xd81c('0x26')](removeEntity(_0x30a7f3,null))[_0xd81c('0x49')](handleError(_0x30a7f3,null));};exports[_0xd81c('0x56')]=function(_0x46eb7d,_0x2c2065,_0x48c0f3){if(_0x46eb7d[_0xd81c('0x4c')]['id']){delete _0x46eb7d[_0xd81c('0x4c')]['id'];}return db[_0xd81c('0x45')][_0xd81c('0x51')]({'where':{'id':_0x46eb7d[_0xd81c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c2065,null))[_0xd81c('0x26')](function(_0x103364){if(_0x103364){_0x46eb7d[_0xd81c('0x4c')][_0xd81c('0x58')]=_0x103364['id'];return db[_0xd81c('0x59')][_0xd81c('0x4b')](_0x46eb7d['body']);}})['then'](respondWithResult(_0x2c2065,null))[_0xd81c('0x49')](handleError(_0x2c2065,null));};exports[_0xd81c('0x5a')]=function(_0x30dbf4,_0x29e016,_0x1e0f9e){if(_0x30dbf4[_0xd81c('0x4c')]['id']){delete _0x30dbf4[_0xd81c('0x4c')]['id'];}return db[_0xd81c('0x45')][_0xd81c('0x51')]({'where':{'id':_0x30dbf4['params']['id']}})[_0xd81c('0x26')](handleEntityNotFound(_0x29e016,null))[_0xd81c('0x26')](function(_0x7bea8){if(_0x7bea8){_0x30dbf4[_0xd81c('0x4c')]['TriggerAnyId']=_0x7bea8['id'];return db[_0xd81c('0x59')]['create'](_0x30dbf4[_0xd81c('0x4c')]);}})['then'](respondWithResult(_0x29e016,null))[_0xd81c('0x49')](handleError(_0x29e016,null));};exports[_0xd81c('0x5b')]=function(_0x1c87a8,_0x1dc167,_0xe4aee7){var _0x3a2fb4={};var _0x321119={};var _0x27b41a;var _0x1d8735;return db[_0xd81c('0x45')]['findOne']({'where':{'id':_0x1c87a8[_0xd81c('0x57')]['id']}})['then'](handleEntityNotFound(_0x1dc167,null))['then'](function(_0x5cafa6){if(_0x5cafa6){_0x27b41a=_0x5cafa6;_0x321119[_0xd81c('0x33')]=_[_0xd81c('0x32')](db['Condition'][_0xd81c('0x4a')]);_0x321119[_0xd81c('0x36')]=_[_0xd81c('0x32')](_0x1c87a8['query']);_0x321119[_0xd81c('0x3f')]=_['intersection'](_0x321119['model'],_0x321119['query']);_0x3a2fb4[_0xd81c('0x37')]=_[_0xd81c('0x34')](_0x321119['model'],qs['fields'](_0x1c87a8[_0xd81c('0x36')][_0xd81c('0x35')]));_0x3a2fb4['attributes']=_0x3a2fb4[_0xd81c('0x37')][_0xd81c('0x38')]?_0x3a2fb4[_0xd81c('0x37')]:_0x321119[_0xd81c('0x33')];_0x3a2fb4['order']=qs[_0xd81c('0x3d')](_0x1c87a8[_0xd81c('0x36')][_0xd81c('0x3d')]);_0x3a2fb4[_0xd81c('0x3e')]=qs[_0xd81c('0x3f')](_['pick'](_0x1c87a8[_0xd81c('0x36')],_0x321119[_0xd81c('0x3f')]));if(_0x1c87a8[_0xd81c('0x36')][_0xd81c('0x40')]){_0x3a2fb4[_0xd81c('0x3e')]=_[_0xd81c('0x41')](_0x3a2fb4[_0xd81c('0x3e')],{'$or':_[_0xd81c('0x2f')](_0x3a2fb4[_0xd81c('0x37')],function(_0x4d3e0d){var _0x58fe69={};_0x58fe69[_0x4d3e0d]={'$like':'%'+_0x1c87a8[_0xd81c('0x36')][_0xd81c('0x40')]+'%'};return _0x58fe69;})});}_0x3a2fb4=_['merge']({},_0x3a2fb4,_0x1c87a8[_0xd81c('0x44')]);return _0x27b41a[_0xd81c('0x5b')](_0x3a2fb4);}})[_0xd81c('0x26')](function(_0x56f264){if(_0x56f264){_0x1d8735=_0x56f264[_0xd81c('0x38')];if(!_0x1c87a8[_0xd81c('0x36')]['hasOwnProperty'](_0xd81c('0x3a'))){_0x3a2fb4[_0xd81c('0x3b')]=qs[_0xd81c('0x3b')](_0x1c87a8[_0xd81c('0x36')][_0xd81c('0x3b')]);_0x3a2fb4[_0xd81c('0x1d')]=qs[_0xd81c('0x1d')](_0x1c87a8['query'][_0xd81c('0x1d')]);}return _0x27b41a[_0xd81c('0x5b')](_0x3a2fb4);}})[_0xd81c('0x26')](function(_0x232b09){if(_0x232b09){return _0x232b09?{'count':_0x1d8735,'rows':_0x232b09}:null;}})[_0xd81c('0x26')](respondWithResult(_0x1dc167,null))[_0xd81c('0x49')](handleError(_0x1dc167,null));};exports[_0xd81c('0x5c')]=function(_0x2ad269,_0x2b2fb8,_0x3cd749){var _0x2ad585={};var _0x332f4a={};var _0x1ca647;var _0x1a7d79;return db[_0xd81c('0x45')][_0xd81c('0x5d')]({'where':{'id':_0x2ad269[_0xd81c('0x57')]['id']}})[_0xd81c('0x26')](handleEntityNotFound(_0x2b2fb8,null))[_0xd81c('0x26')](function(_0x132f24){if(_0x132f24){_0x1ca647=_0x132f24;_0x332f4a['model']=_[_0xd81c('0x32')](db['Condition'][_0xd81c('0x4a')]);_0x332f4a['query']=_['keys'](_0x2ad269['query']);_0x332f4a[_0xd81c('0x3f')]=_[_0xd81c('0x34')](_0x332f4a[_0xd81c('0x33')],_0x332f4a[_0xd81c('0x36')]);_0x2ad585[_0xd81c('0x37')]=_['intersection'](_0x332f4a[_0xd81c('0x33')],qs['fields'](_0x2ad269[_0xd81c('0x36')][_0xd81c('0x35')]));_0x2ad585[_0xd81c('0x37')]=_0x2ad585['attributes'][_0xd81c('0x38')]?_0x2ad585[_0xd81c('0x37')]:_0x332f4a[_0xd81c('0x33')];_0x2ad585[_0xd81c('0x3c')]=qs[_0xd81c('0x3d')](_0x2ad269[_0xd81c('0x36')]['sort']);_0x2ad585['where']=qs[_0xd81c('0x3f')](_['pick'](_0x2ad269[_0xd81c('0x36')],_0x332f4a[_0xd81c('0x3f')]));if(_0x2ad269[_0xd81c('0x36')][_0xd81c('0x40')]){_0x2ad585[_0xd81c('0x3e')]=_[_0xd81c('0x41')](_0x2ad585[_0xd81c('0x3e')],{'$or':_[_0xd81c('0x2f')](_0x2ad585['attributes'],function(_0x5ad8a0){var _0x9212f1={};_0x9212f1[_0x5ad8a0]={'$like':'%'+_0x2ad269['query'][_0xd81c('0x40')]+'%'};return _0x9212f1;})});}_0x2ad585=_[_0xd81c('0x41')]({},_0x2ad585,_0x2ad269[_0xd81c('0x44')]);return _0x1ca647[_0xd81c('0x5c')](_0x2ad585);}})[_0xd81c('0x26')](function(_0x6e10fb){if(_0x6e10fb){_0x1a7d79=_0x6e10fb[_0xd81c('0x38')];if(!_0x2ad269[_0xd81c('0x36')][_0xd81c('0x39')]('nolimit')){_0x2ad585[_0xd81c('0x3b')]=qs[_0xd81c('0x3b')](_0x2ad269['query'][_0xd81c('0x3b')]);_0x2ad585['offset']=qs[_0xd81c('0x1d')](_0x2ad269[_0xd81c('0x36')][_0xd81c('0x1d')]);}return _0x1ca647[_0xd81c('0x5c')](_0x2ad585);}})[_0xd81c('0x26')](function(_0x34830f){if(_0x34830f){return _0x34830f?{'count':_0x1a7d79,'rows':_0x34830f}:null;}})[_0xd81c('0x26')](respondWithResult(_0x2b2fb8,null))['catch'](handleError(_0x2b2fb8,null));};exports[_0xd81c('0x5e')]=function(_0x4d7c65,_0x21cd4b,_0x3dce96){if(_0x4d7c65[_0xd81c('0x4c')]['id']){delete _0x4d7c65[_0xd81c('0x4c')]['id'];}return db[_0xd81c('0x45')][_0xd81c('0x51')]({'where':{'id':_0x4d7c65[_0xd81c('0x57')]['id']}})[_0xd81c('0x26')](handleEntityNotFound(_0x21cd4b,null))[_0xd81c('0x26')](function(_0x40fc3e){if(_0x40fc3e){_0x4d7c65[_0xd81c('0x4c')]['TriggerId']=_0x40fc3e['id'];return db[_0xd81c('0x5f')][_0xd81c('0x4b')](_0x4d7c65[_0xd81c('0x4c')]);}})[_0xd81c('0x26')](respondWithResult(_0x21cd4b,null))[_0xd81c('0x49')](handleError(_0x21cd4b,null));};exports['getActions']=function(_0x291915,_0x2c3a4a,_0x48235f){var _0x597c8d={};var _0x46e1d0={};var _0x20dc0e;var _0x27eb4f;return db[_0xd81c('0x45')][_0xd81c('0x5d')]({'where':{'id':_0x291915['params']['id']}})['then'](handleEntityNotFound(_0x2c3a4a,null))['then'](function(_0x1f6f5b){if(_0x1f6f5b){_0x20dc0e=_0x1f6f5b;_0x46e1d0['model']=_[_0xd81c('0x32')](db[_0xd81c('0x5f')][_0xd81c('0x4a')]);_0x46e1d0[_0xd81c('0x36')]=_['keys'](_0x291915[_0xd81c('0x36')]);_0x46e1d0[_0xd81c('0x3f')]=_[_0xd81c('0x34')](_0x46e1d0[_0xd81c('0x33')],_0x46e1d0[_0xd81c('0x36')]);_0x597c8d[_0xd81c('0x37')]=_['intersection'](_0x46e1d0[_0xd81c('0x33')],qs[_0xd81c('0x35')](_0x291915[_0xd81c('0x36')][_0xd81c('0x35')]));_0x597c8d[_0xd81c('0x37')]=_0x597c8d[_0xd81c('0x37')][_0xd81c('0x38')]?_0x597c8d[_0xd81c('0x37')]:_0x46e1d0[_0xd81c('0x33')];_0x597c8d[_0xd81c('0x3c')]=qs['sort'](_0x291915[_0xd81c('0x36')][_0xd81c('0x3d')]);_0x597c8d[_0xd81c('0x3e')]=qs[_0xd81c('0x3f')](_[_0xd81c('0x60')](_0x291915[_0xd81c('0x36')],_0x46e1d0['filters']));if(_0x291915[_0xd81c('0x36')][_0xd81c('0x40')]){_0x597c8d[_0xd81c('0x3e')]=_[_0xd81c('0x41')](_0x597c8d[_0xd81c('0x3e')],{'$or':_[_0xd81c('0x2f')](_0x597c8d[_0xd81c('0x37')],function(_0x47781b){var _0x1b6ba4={};_0x1b6ba4[_0x47781b]={'$like':'%'+_0x291915[_0xd81c('0x36')][_0xd81c('0x40')]+'%'};return _0x1b6ba4;})});}_0x597c8d=_[_0xd81c('0x41')]({},_0x597c8d,_0x291915[_0xd81c('0x44')]);return _0x20dc0e['getActions'](_0x597c8d);}})['then'](function(_0x45ecd1){if(_0x45ecd1){_0x27eb4f=_0x45ecd1[_0xd81c('0x38')];if(!_0x291915[_0xd81c('0x36')]['hasOwnProperty'](_0xd81c('0x3a'))){_0x597c8d[_0xd81c('0x3b')]=qs[_0xd81c('0x3b')](_0x291915['query'][_0xd81c('0x3b')]);_0x597c8d['offset']=qs[_0xd81c('0x1d')](_0x291915[_0xd81c('0x36')][_0xd81c('0x1d')]);}return _0x20dc0e[_0xd81c('0x61')](_0x597c8d);}})[_0xd81c('0x26')](function(_0x40f382){if(_0x40f382){return _0x40f382?{'count':_0x27eb4f,'rows':_0x40f382}:null;}})[_0xd81c('0x26')](respondWithResult(_0x2c3a4a,null))['catch'](handleError(_0x2c3a4a,null));}; \ No newline at end of file +var _0x5118=['order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','create','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x42f47f,_0x50ae67){var _0x475a0f=function(_0x25e229){while(--_0x25e229){_0x42f47f['push'](_0x42f47f['shift']());}};_0x475a0f(++_0x50ae67);}(_0x5118,0x1f4));var _0x8511=function(_0x1f0533,_0x12f344){_0x1f0533=_0x1f0533-0x0;var _0x498dd3=_0x5118[_0x1f0533];return _0x498dd3;};'use strict';var emlformat=require(_0x8511('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8511('0x1'));var jsonpatch=require(_0x8511('0x2'));var rp=require(_0x8511('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8511('0x4'));var util=require(_0x8511('0x5'));var path=require('path');var sox=require(_0x8511('0x6'));var csv=require(_0x8511('0x7'));var ejs=require(_0x8511('0x8'));var fs=require('fs');var fs_extra=require(_0x8511('0x9'));var _=require('lodash');var squel=require(_0x8511('0xa'));var crypto=require(_0x8511('0xb'));var jsforce=require(_0x8511('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8511('0x7'));var querystring=require(_0x8511('0xd'));var Papa=require(_0x8511('0xe'));var Redis=require(_0x8511('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8511('0x10'));var as=require(_0x8511('0x11'));var hardwareService=require(_0x8511('0x12'));var logger=require(_0x8511('0x13'))(_0x8511('0x14'));var utils=require(_0x8511('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8511('0x16'))['db'];function respondWithStatusCode(_0x12777a,_0x393957){_0x393957=_0x393957||0xcc;return function(_0x5edbcc){if(_0x5edbcc){return _0x12777a[_0x8511('0x17')](_0x393957);}return _0x12777a[_0x8511('0x18')](_0x393957)[_0x8511('0x19')]();};}function respondWithResult(_0x221c7f,_0x4ae14d){_0x4ae14d=_0x4ae14d||0xc8;return function(_0xe2d678){if(_0xe2d678){return _0x221c7f[_0x8511('0x18')](_0x4ae14d)[_0x8511('0x1a')](_0xe2d678);}};}function respondWithFilteredResult(_0x7202cb,_0x1bfd00){return function(_0x37469b){if(_0x37469b){var _0x207eea=typeof _0x1bfd00[_0x8511('0x1b')]===_0x8511('0x1c')&&typeof _0x1bfd00[_0x8511('0x1d')]===_0x8511('0x1c');var _0x1f1bca=_0x37469b[_0x8511('0x1e')];var _0x4e2c2a=_0x207eea?0x0:_0x1bfd00[_0x8511('0x1b')];var _0x4ea503=_0x207eea?_0x37469b[_0x8511('0x1e')]:_0x1bfd00['offset']+_0x1bfd00[_0x8511('0x1d')];var _0x5e8f92;if(_0x4ea503>=_0x1f1bca){_0x4ea503=_0x1f1bca;_0x5e8f92=0xc8;}else{_0x5e8f92=0xce;}_0x7202cb[_0x8511('0x18')](_0x5e8f92);return _0x7202cb['set'](_0x8511('0x1f'),_0x4e2c2a+'-'+_0x4ea503+'/'+_0x1f1bca)[_0x8511('0x1a')](_0x37469b);}return null;};}function patchUpdates(_0x53e386){return function(_0x3c6c37){try{jsonpatch[_0x8511('0x20')](_0x3c6c37,_0x53e386,!![]);}catch(_0x103e70){return BPromise['reject'](_0x103e70);}return _0x3c6c37[_0x8511('0x21')]();};}function saveUpdates(_0xaac7d7,_0x44406a){return function(_0x1fd484){if(_0x1fd484){return _0x1fd484[_0x8511('0x22')](_0xaac7d7)['then'](function(_0xcf3295){return _0xcf3295;});}return null;};}function removeEntity(_0x377885,_0x3e71e3){return function(_0x16dae3){if(_0x16dae3){return _0x16dae3[_0x8511('0x23')]()[_0x8511('0x24')](function(){var _0x387c98=_0x16dae3[_0x8511('0x25')]({'plain':!![]});var _0x241dd0='Triggers';return db[_0x8511('0x26')][_0x8511('0x23')]({'where':{'type':_0x241dd0,'resourceId':_0x387c98['id']}})['then'](function(){return _0x16dae3;});})[_0x8511('0x24')](function(){_0x377885[_0x8511('0x18')](0xcc)[_0x8511('0x19')]();});}};}function handleEntityNotFound(_0x4fdbd3,_0x17158c){return function(_0x390de7){if(!_0x390de7){_0x4fdbd3[_0x8511('0x17')](0x194);}return _0x390de7;};}function handleError(_0x324e4c,_0x14e3d0){_0x14e3d0=_0x14e3d0||0x1f4;return function(_0x51edc9){logger[_0x8511('0x27')](_0x51edc9['stack']);if(_0x51edc9[_0x8511('0x28')]){delete _0x51edc9[_0x8511('0x28')];}_0x324e4c[_0x8511('0x18')](_0x14e3d0)[_0x8511('0x29')](_0x51edc9);};}exports[_0x8511('0x2a')]=function(_0x598f1a,_0x4a2442){var _0x40d9ea={},_0x14cd9c={},_0x10f3e7={'count':0x0,'rows':[]};var _0x130ac6=_[_0x8511('0x2b')](db[_0x8511('0x2c')][_0x8511('0x2d')],function(_0x59c4cd){return{'name':_0x59c4cd[_0x8511('0x2e')],'type':_0x59c4cd[_0x8511('0x2f')][_0x8511('0x30')]};});_0x14cd9c[_0x8511('0x31')]=_[_0x8511('0x2b')](_0x130ac6,_0x8511('0x28'));_0x14cd9c[_0x8511('0x32')]=_[_0x8511('0x33')](_0x598f1a[_0x8511('0x32')]);_0x14cd9c[_0x8511('0x34')]=_[_0x8511('0x35')](_0x14cd9c['model'],_0x14cd9c['query']);_0x40d9ea[_0x8511('0x36')]=_[_0x8511('0x35')](_0x14cd9c[_0x8511('0x31')],qs[_0x8511('0x37')](_0x598f1a['query']['fields']));_0x40d9ea[_0x8511('0x36')]=_0x40d9ea[_0x8511('0x36')][_0x8511('0x38')]?_0x40d9ea[_0x8511('0x36')]:_0x14cd9c[_0x8511('0x31')];if(!_0x598f1a[_0x8511('0x32')]['hasOwnProperty'](_0x8511('0x39'))){_0x40d9ea[_0x8511('0x1d')]=qs['limit'](_0x598f1a['query']['limit']);_0x40d9ea[_0x8511('0x1b')]=qs['offset'](_0x598f1a[_0x8511('0x32')][_0x8511('0x1b')]);}_0x40d9ea[_0x8511('0x3a')]=qs[_0x8511('0x3b')](_0x598f1a['query'][_0x8511('0x3b')]);_0x40d9ea[_0x8511('0x3c')]=qs[_0x8511('0x34')](_[_0x8511('0x3d')](_0x598f1a[_0x8511('0x32')],_0x14cd9c[_0x8511('0x34')]),_0x130ac6);if(_0x598f1a[_0x8511('0x32')][_0x8511('0x3e')]){_0x40d9ea[_0x8511('0x3c')]=_[_0x8511('0x3f')](_0x40d9ea[_0x8511('0x3c')],{'$or':_[_0x8511('0x2b')](_0x130ac6,function(_0x597ebd){if(_0x597ebd[_0x8511('0x2f')]!==_0x8511('0x40')){var _0x43aea1={};_0x43aea1[_0x597ebd[_0x8511('0x28')]]={'$like':'%'+_0x598f1a[_0x8511('0x32')][_0x8511('0x3e')]+'%'};return _0x43aea1;}})});}_0x40d9ea=_['merge']({},_0x40d9ea,_0x598f1a['options']);var _0x1ce5e8={'where':_0x40d9ea[_0x8511('0x3c')]};return db['Trigger'][_0x8511('0x1e')](_0x1ce5e8)[_0x8511('0x24')](function(_0x5cabb0){_0x10f3e7[_0x8511('0x1e')]=_0x5cabb0;if(_0x598f1a['query']['includeAll']){_0x40d9ea[_0x8511('0x41')]=[{'all':!![]}];}return db[_0x8511('0x2c')]['findAll'](_0x40d9ea);})[_0x8511('0x24')](function(_0x2dce0b){_0x10f3e7[_0x8511('0x42')]=_0x2dce0b;return _0x10f3e7;})[_0x8511('0x24')](respondWithFilteredResult(_0x4a2442,_0x40d9ea))[_0x8511('0x43')](handleError(_0x4a2442,null));};exports[_0x8511('0x44')]=function(_0x85667,_0x5dc310){var _0x96933={'raw':![],'where':{'id':_0x85667[_0x8511('0x45')]['id']}},_0x172f18={};_0x172f18[_0x8511('0x31')]=_['keys'](db[_0x8511('0x2c')][_0x8511('0x2d')]);_0x172f18[_0x8511('0x32')]=_['keys'](_0x85667[_0x8511('0x32')]);_0x172f18[_0x8511('0x34')]=_['intersection'](_0x172f18[_0x8511('0x31')],_0x172f18[_0x8511('0x32')]);_0x96933[_0x8511('0x36')]=_['intersection'](_0x172f18[_0x8511('0x31')],qs[_0x8511('0x37')](_0x85667[_0x8511('0x32')]['fields']));_0x96933['attributes']=_0x96933['attributes'][_0x8511('0x38')]?_0x96933[_0x8511('0x36')]:_0x172f18['model'];if(_0x85667['query']['includeAll']){_0x96933[_0x8511('0x41')]=[{'all':!![]}];}_0x96933=_['merge']({},_0x96933,_0x85667[_0x8511('0x46')]);return db[_0x8511('0x2c')]['find'](_0x96933)[_0x8511('0x24')](handleEntityNotFound(_0x5dc310,null))[_0x8511('0x24')](respondWithResult(_0x5dc310,null))[_0x8511('0x43')](handleError(_0x5dc310,null));};exports['create']=function(_0x3a3677,_0x3f5401){return db[_0x8511('0x2c')]['create'](_0x3a3677['body'],{})[_0x8511('0x24')](function(_0x310f40){var _0x2f1608=_0x3a3677[_0x8511('0x47')][_0x8511('0x25')]({'plain':!![]});if(!_0x2f1608)throw new Error(_0x8511('0x48'));if(_0x2f1608[_0x8511('0x49')]===_0x8511('0x47')){var _0x476313=_0x310f40[_0x8511('0x25')]({'plain':!![]});var _0x24060b=_0x8511('0x4a');return db[_0x8511('0x4b')][_0x8511('0x4c')]({'where':{'name':_0x24060b,'userProfileId':_0x2f1608[_0x8511('0x4d')]},'raw':!![]})[_0x8511('0x24')](function(_0x3aa090){if(_0x3aa090&&_0x3aa090[_0x8511('0x4e')]===0x0){return db['UserProfileResource'][_0x8511('0x4f')]({'name':_0x476313['name'],'resourceId':_0x476313['id'],'type':_0x3aa090[_0x8511('0x28')],'sectionId':_0x3aa090['id']},{})[_0x8511('0x24')](function(){return _0x310f40;});}else{return _0x310f40;}})[_0x8511('0x43')](function(_0x3f449d){logger[_0x8511('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f449d);throw _0x3f449d;});}return _0x310f40;})['then'](respondWithResult(_0x3f5401,0xc9))['catch'](handleError(_0x3f5401,null));};exports[_0x8511('0x22')]=function(_0x3459f2,_0x2633a4){if(_0x3459f2[_0x8511('0x50')]['id']){delete _0x3459f2[_0x8511('0x50')]['id'];}return db['Trigger'][_0x8511('0x4c')]({'where':{'id':_0x3459f2[_0x8511('0x45')]['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x2633a4,null))[_0x8511('0x24')](saveUpdates(_0x3459f2['body'],null))['then'](respondWithResult(_0x2633a4,null))[_0x8511('0x43')](handleError(_0x2633a4,null));};exports[_0x8511('0x23')]=function(_0x2f9b08,_0x579ab0){return db[_0x8511('0x2c')][_0x8511('0x4c')]({'where':{'id':_0x2f9b08[_0x8511('0x45')]['id']}})['then'](handleEntityNotFound(_0x579ab0,null))[_0x8511('0x24')](removeEntity(_0x579ab0,null))['catch'](handleError(_0x579ab0,null));};exports['addAllCondition']=function(_0x2db9fd,_0x1bb9da,_0x2cf2f0){if(_0x2db9fd[_0x8511('0x50')]['id']){delete _0x2db9fd[_0x8511('0x50')]['id'];}return db[_0x8511('0x2c')][_0x8511('0x4c')]({'where':{'id':_0x2db9fd[_0x8511('0x45')]['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x1bb9da,null))[_0x8511('0x24')](function(_0x15c394){if(_0x15c394){_0x2db9fd[_0x8511('0x50')][_0x8511('0x51')]=_0x15c394['id'];return db[_0x8511('0x52')][_0x8511('0x4f')](_0x2db9fd[_0x8511('0x50')]);}})[_0x8511('0x24')](respondWithResult(_0x1bb9da,null))[_0x8511('0x43')](handleError(_0x1bb9da,null));};exports[_0x8511('0x53')]=function(_0x28a147,_0x491a88,_0x2c62e6){if(_0x28a147[_0x8511('0x50')]['id']){delete _0x28a147['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x28a147[_0x8511('0x45')]['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x491a88,null))['then'](function(_0x2089dd){if(_0x2089dd){_0x28a147[_0x8511('0x50')][_0x8511('0x54')]=_0x2089dd['id'];return db[_0x8511('0x52')][_0x8511('0x4f')](_0x28a147[_0x8511('0x50')]);}})[_0x8511('0x24')](respondWithResult(_0x491a88,null))[_0x8511('0x43')](handleError(_0x491a88,null));};exports[_0x8511('0x55')]=function(_0x9b449c,_0x1d7314,_0x314a24){var _0x453210={};var _0x2796e9={};var _0x32f39d;var _0x1c4a54;return db[_0x8511('0x2c')][_0x8511('0x56')]({'where':{'id':_0x9b449c[_0x8511('0x45')]['id']}})['then'](handleEntityNotFound(_0x1d7314,null))[_0x8511('0x24')](function(_0x54115a){if(_0x54115a){_0x32f39d=_0x54115a;_0x2796e9[_0x8511('0x31')]=_[_0x8511('0x33')](db[_0x8511('0x52')][_0x8511('0x2d')]);_0x2796e9[_0x8511('0x32')]=_['keys'](_0x9b449c[_0x8511('0x32')]);_0x2796e9[_0x8511('0x34')]=_[_0x8511('0x35')](_0x2796e9[_0x8511('0x31')],_0x2796e9[_0x8511('0x32')]);_0x453210[_0x8511('0x36')]=_[_0x8511('0x35')](_0x2796e9[_0x8511('0x31')],qs[_0x8511('0x37')](_0x9b449c['query'][_0x8511('0x37')]));_0x453210['attributes']=_0x453210['attributes']['length']?_0x453210['attributes']:_0x2796e9[_0x8511('0x31')];_0x453210[_0x8511('0x3a')]=qs[_0x8511('0x3b')](_0x9b449c[_0x8511('0x32')][_0x8511('0x3b')]);_0x453210[_0x8511('0x3c')]=qs['filters'](_[_0x8511('0x3d')](_0x9b449c[_0x8511('0x32')],_0x2796e9[_0x8511('0x34')]));if(_0x9b449c['query'][_0x8511('0x3e')]){_0x453210['where']=_['merge'](_0x453210[_0x8511('0x3c')],{'$or':_['map'](_0x453210[_0x8511('0x36')],function(_0x165a1b){var _0x284937={};_0x284937[_0x165a1b]={'$like':'%'+_0x9b449c[_0x8511('0x32')][_0x8511('0x3e')]+'%'};return _0x284937;})});}_0x453210=_[_0x8511('0x3f')]({},_0x453210,_0x9b449c[_0x8511('0x46')]);return _0x32f39d['getAllConditions'](_0x453210);}})['then'](function(_0x24307d){if(_0x24307d){_0x1c4a54=_0x24307d[_0x8511('0x38')];if(!_0x9b449c['query'][_0x8511('0x57')]('nolimit')){_0x453210['limit']=qs[_0x8511('0x1d')](_0x9b449c[_0x8511('0x32')]['limit']);_0x453210[_0x8511('0x1b')]=qs[_0x8511('0x1b')](_0x9b449c[_0x8511('0x32')][_0x8511('0x1b')]);}return _0x32f39d[_0x8511('0x55')](_0x453210);}})[_0x8511('0x24')](function(_0x318273){if(_0x318273){return _0x318273?{'count':_0x1c4a54,'rows':_0x318273}:null;}})[_0x8511('0x24')](respondWithResult(_0x1d7314,null))[_0x8511('0x43')](handleError(_0x1d7314,null));};exports[_0x8511('0x58')]=function(_0x2430db,_0x53918f,_0x2ea700){var _0x2739c3={};var _0x2ab078={};var _0x31bdaf;var _0x46224b;return db[_0x8511('0x2c')]['findOne']({'where':{'id':_0x2430db[_0x8511('0x45')]['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x53918f,null))[_0x8511('0x24')](function(_0x47dacc){if(_0x47dacc){_0x31bdaf=_0x47dacc;_0x2ab078[_0x8511('0x31')]=_[_0x8511('0x33')](db['Condition'][_0x8511('0x2d')]);_0x2ab078[_0x8511('0x32')]=_[_0x8511('0x33')](_0x2430db[_0x8511('0x32')]);_0x2ab078[_0x8511('0x34')]=_[_0x8511('0x35')](_0x2ab078[_0x8511('0x31')],_0x2ab078[_0x8511('0x32')]);_0x2739c3[_0x8511('0x36')]=_[_0x8511('0x35')](_0x2ab078[_0x8511('0x31')],qs[_0x8511('0x37')](_0x2430db[_0x8511('0x32')][_0x8511('0x37')]));_0x2739c3[_0x8511('0x36')]=_0x2739c3[_0x8511('0x36')][_0x8511('0x38')]?_0x2739c3[_0x8511('0x36')]:_0x2ab078['model'];_0x2739c3['order']=qs[_0x8511('0x3b')](_0x2430db[_0x8511('0x32')][_0x8511('0x3b')]);_0x2739c3['where']=qs[_0x8511('0x34')](_[_0x8511('0x3d')](_0x2430db[_0x8511('0x32')],_0x2ab078['filters']));if(_0x2430db[_0x8511('0x32')]['filter']){_0x2739c3['where']=_[_0x8511('0x3f')](_0x2739c3[_0x8511('0x3c')],{'$or':_[_0x8511('0x2b')](_0x2739c3[_0x8511('0x36')],function(_0x543fdb){var _0xf5e9d1={};_0xf5e9d1[_0x543fdb]={'$like':'%'+_0x2430db['query'][_0x8511('0x3e')]+'%'};return _0xf5e9d1;})});}_0x2739c3=_['merge']({},_0x2739c3,_0x2430db['options']);return _0x31bdaf[_0x8511('0x58')](_0x2739c3);}})[_0x8511('0x24')](function(_0x5d977b){if(_0x5d977b){_0x46224b=_0x5d977b['length'];if(!_0x2430db[_0x8511('0x32')][_0x8511('0x57')](_0x8511('0x39'))){_0x2739c3[_0x8511('0x1d')]=qs[_0x8511('0x1d')](_0x2430db[_0x8511('0x32')][_0x8511('0x1d')]);_0x2739c3['offset']=qs[_0x8511('0x1b')](_0x2430db[_0x8511('0x32')][_0x8511('0x1b')]);}return _0x31bdaf[_0x8511('0x58')](_0x2739c3);}})['then'](function(_0x139fc7){if(_0x139fc7){return _0x139fc7?{'count':_0x46224b,'rows':_0x139fc7}:null;}})[_0x8511('0x24')](respondWithResult(_0x53918f,null))[_0x8511('0x43')](handleError(_0x53918f,null));};exports[_0x8511('0x59')]=function(_0x1be6fa,_0x1e9be2,_0x30c55b){if(_0x1be6fa['body']['id']){delete _0x1be6fa[_0x8511('0x50')]['id'];}return db[_0x8511('0x2c')]['find']({'where':{'id':_0x1be6fa[_0x8511('0x45')]['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x1e9be2,null))[_0x8511('0x24')](function(_0xc8f168){if(_0xc8f168){_0x1be6fa[_0x8511('0x50')][_0x8511('0x5a')]=_0xc8f168['id'];return db[_0x8511('0x5b')][_0x8511('0x4f')](_0x1be6fa['body']);}})['then'](respondWithResult(_0x1e9be2,null))['catch'](handleError(_0x1e9be2,null));};exports[_0x8511('0x5c')]=function(_0x5996e5,_0x4f99a0,_0xfcef9){var _0x3afcbc={};var _0x1022aa={};var _0x55810e;var _0x1c3fbf;return db[_0x8511('0x2c')][_0x8511('0x56')]({'where':{'id':_0x5996e5['params']['id']}})[_0x8511('0x24')](handleEntityNotFound(_0x4f99a0,null))[_0x8511('0x24')](function(_0x467be6){if(_0x467be6){_0x55810e=_0x467be6;_0x1022aa['model']=_['keys'](db['Action'][_0x8511('0x2d')]);_0x1022aa[_0x8511('0x32')]=_[_0x8511('0x33')](_0x5996e5[_0x8511('0x32')]);_0x1022aa[_0x8511('0x34')]=_[_0x8511('0x35')](_0x1022aa['model'],_0x1022aa['query']);_0x3afcbc['attributes']=_[_0x8511('0x35')](_0x1022aa[_0x8511('0x31')],qs['fields'](_0x5996e5[_0x8511('0x32')][_0x8511('0x37')]));_0x3afcbc[_0x8511('0x36')]=_0x3afcbc[_0x8511('0x36')]['length']?_0x3afcbc[_0x8511('0x36')]:_0x1022aa['model'];_0x3afcbc[_0x8511('0x3a')]=qs['sort'](_0x5996e5[_0x8511('0x32')][_0x8511('0x3b')]);_0x3afcbc[_0x8511('0x3c')]=qs[_0x8511('0x34')](_[_0x8511('0x3d')](_0x5996e5[_0x8511('0x32')],_0x1022aa[_0x8511('0x34')]));if(_0x5996e5[_0x8511('0x32')]['filter']){_0x3afcbc[_0x8511('0x3c')]=_[_0x8511('0x3f')](_0x3afcbc['where'],{'$or':_[_0x8511('0x2b')](_0x3afcbc[_0x8511('0x36')],function(_0x27d992){var _0x3419bb={};_0x3419bb[_0x27d992]={'$like':'%'+_0x5996e5[_0x8511('0x32')][_0x8511('0x3e')]+'%'};return _0x3419bb;})});}_0x3afcbc=_[_0x8511('0x3f')]({},_0x3afcbc,_0x5996e5[_0x8511('0x46')]);return _0x55810e[_0x8511('0x5c')](_0x3afcbc);}})[_0x8511('0x24')](function(_0x22827a){if(_0x22827a){_0x1c3fbf=_0x22827a[_0x8511('0x38')];if(!_0x5996e5[_0x8511('0x32')][_0x8511('0x57')](_0x8511('0x39'))){_0x3afcbc[_0x8511('0x1d')]=qs[_0x8511('0x1d')](_0x5996e5['query'][_0x8511('0x1d')]);_0x3afcbc[_0x8511('0x1b')]=qs[_0x8511('0x1b')](_0x5996e5[_0x8511('0x32')][_0x8511('0x1b')]);}return _0x55810e[_0x8511('0x5c')](_0x3afcbc);}})[_0x8511('0x24')](function(_0x656796){if(_0x656796){return _0x656796?{'count':_0x1c3fbf,'rows':_0x656796}:null;}})['then'](respondWithResult(_0x4f99a0,null))[_0x8511('0x43')](handleError(_0x4f99a0,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ba23a3b..5fee5a9 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 _0x4c6d=['moment','request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api'];(function(_0x5993de,_0x1e902f){var _0x481faf=function(_0x11dea1){while(--_0x11dea1){_0x5993de['push'](_0x5993de['shift']());}};_0x481faf(++_0x1e902f);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2221c7,_0x526d17){_0x2221c7=_0x2221c7-0x0;var _0x1d6e2c=_0x4c6d[_0x2221c7];return _0x1d6e2c;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var logger=require(_0xd4c6('0x2'))(_0xd4c6('0x3'));var moment=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4c6('0x5'));var fs=require('fs');var path=require(_0xd4c6('0x6'));var rimraf=require(_0xd4c6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4c6('0x8'));module[_0xd4c6('0x9')]=function(_0x56279c,_0x182671){return _0x56279c[_0xd4c6('0xa')](_0xd4c6('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2d=['api','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger'];(function(_0x412cf9,_0x2f632c){var _0x1a579=function(_0x351276){while(--_0x351276){_0x412cf9['push'](_0x412cf9['shift']());}};_0x1a579(++_0x2f632c);}(_0x7a2d,0x142));var _0xd7a2=function(_0x34a32e,_0x26f089){_0x34a32e=_0x34a32e-0x0;var _0x24ca9b=_0x7a2d[_0x34a32e];return _0x24ca9b;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var logger=require(_0xd7a2('0x2'))(_0xd7a2('0x3'));var moment=require(_0xd7a2('0x4'));var BPromise=require(_0xd7a2('0x5'));var rp=require(_0xd7a2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7a2('0x7'));var attributes=require(_0xd7a2('0x8'));module[_0xd7a2('0x9')]=function(_0x13b19d,_0x4f0c6b){return _0x13b19d[_0xd7a2('0xa')](_0xd7a2('0xb'),attributes,{'tableName':_0xd7a2('0xc'),'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 85104a9..a7fde15 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 _0xdef6=['GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','find','then','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xdea482,_0x5158f4){var _0x83a9c=function(_0x576866){while(--_0x576866){_0xdea482['push'](_0xdea482['shift']());}};_0x83a9c(++_0x5158f4);}(_0xdef6,0xe0));var _0x6def=function(_0x5f0432,_0x2b29c8){_0x5f0432=_0x5f0432-0x0;var _0x48eb08=_0xdef6[_0x5f0432];return _0x48eb08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6def('0x0'));var BPromise=require(_0x6def('0x1'));var rs=require(_0x6def('0x2'));var fs=require('fs');var Redis=require(_0x6def('0x3'));var db=require(_0x6def('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6def('0x5'))(_0x6def('0x6'));var config=require('../../config/environment');var jayson=require(_0x6def('0x7'));var client=jayson[_0x6def('0x8')][_0x6def('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2278,_0xa665d5,_0x189d7d){return new BPromise(function(_0x31b11d,_0x301e88){return client[_0x6def('0xa')](_0x2b2278,_0x189d7d)['then'](function(_0x33c739){logger[_0x6def('0xb')](_0x6def('0xc'),_0xa665d5,_0x6def('0xd'));logger[_0x6def('0xe')](_0x6def('0xf'),_0xa665d5,'request\x20sent',JSON[_0x6def('0x10')](_0x33c739));if(_0x33c739[_0x6def('0x11')]){if(_0x33c739['error']['code']===0x1f4){logger[_0x6def('0x11')]('Trigger,\x20%s,\x20%s',_0xa665d5,_0x33c739[_0x6def('0x11')][_0x6def('0x12')]);return _0x301e88(_0x33c739['error'][_0x6def('0x12')]);}logger[_0x6def('0x11')](_0x6def('0xc'),_0xa665d5,_0x33c739[_0x6def('0x11')][_0x6def('0x12')]);return _0x31b11d(_0x33c739[_0x6def('0x11')]['message']);}else{logger[_0x6def('0xb')]('Trigger,\x20%s,\x20%s',_0xa665d5,'request\x20sent');_0x31b11d(_0x33c739[_0x6def('0x13')][_0x6def('0x12')]);}})[_0x6def('0x14')](function(_0x5b21e1){logger['error']('Trigger,\x20%s,\x20%s',_0xa665d5,_0x5b21e1);_0x301e88(_0x5b21e1);});});}exports[_0x6def('0x15')]=function(_0x1b9cf5){var _0x590ce1=this;return new Promise(function(_0x5bd208,_0x5765a5){return db[_0x6def('0x16')][_0x6def('0x17')]({'raw':_0x1b9cf5[_0x6def('0x18')]?_0x1b9cf5['options'][_0x6def('0x19')]===undefined?!![]:![]:!![],'where':_0x1b9cf5[_0x6def('0x18')]?_0x1b9cf5[_0x6def('0x18')][_0x6def('0x1a')]||null:null,'attributes':_0x1b9cf5['options']?_0x1b9cf5[_0x6def('0x18')][_0x6def('0x1b')]||null:null,'limit':_0x1b9cf5['options']?_0x1b9cf5[_0x6def('0x18')][_0x6def('0x1c')]||null:null,'include':_0x1b9cf5['options']?_0x1b9cf5[_0x6def('0x18')]['include']?_[_0x6def('0x1d')](_0x1b9cf5[_0x6def('0x18')][_0x6def('0x1e')],function(_0x449929){return{'model':db[_0x449929[_0x6def('0x1f')]],'as':_0x449929['as'],'attributes':_0x449929[_0x6def('0x1b')],'include':_0x449929['include']?_[_0x6def('0x1d')](_0x449929[_0x6def('0x1e')],function(_0x1bb0fe){return{'model':db[_0x1bb0fe[_0x6def('0x1f')]],'as':_0x1bb0fe['as'],'attributes':_0x1bb0fe[_0x6def('0x1b')],'include':_0x1bb0fe[_0x6def('0x1e')]?_[_0x6def('0x1d')](_0x1bb0fe[_0x6def('0x1e')],function(_0x42650c){return{'model':db[_0x42650c[_0x6def('0x1f')]],'as':_0x42650c['as'],'attributes':_0x42650c[_0x6def('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53fd05){logger[_0x6def('0xb')](_0x6def('0x15'),_0x1b9cf5);logger[_0x6def('0xe')](_0x6def('0x15'),_0x1b9cf5,JSON[_0x6def('0x10')](_0x53fd05));_0x5bd208(_0x53fd05);})[_0x6def('0x14')](function(_0x2f0f5d){logger[_0x6def('0x11')]('GetTrigger',_0x2f0f5d[_0x6def('0x12')],_0x1b9cf5);_0x5765a5(_0x590ce1[_0x6def('0x11')](0x1f4,_0x2f0f5d[_0x6def('0x12')]));});});};exports['ShowTrigger']=function(_0x218cb0){var _0x2cc520=this;return new Promise(function(_0x252c84,_0x12b54a){return db['Trigger'][_0x6def('0x20')]({'raw':_0x218cb0[_0x6def('0x18')]?_0x218cb0['options'][_0x6def('0x19')]===undefined?!![]:![]:!![],'where':_0x218cb0[_0x6def('0x18')]?_0x218cb0[_0x6def('0x18')]['where']||null:null,'attributes':_0x218cb0['options']?_0x218cb0[_0x6def('0x18')][_0x6def('0x1b')]||null:null,'include':_0x218cb0[_0x6def('0x18')]?_0x218cb0[_0x6def('0x18')][_0x6def('0x1e')]?_[_0x6def('0x1d')](_0x218cb0['options'][_0x6def('0x1e')],function(_0xf5d507){return{'model':db[_0xf5d507[_0x6def('0x1f')]],'as':_0xf5d507['as'],'attributes':_0xf5d507[_0x6def('0x1b')],'include':_0xf5d507[_0x6def('0x1e')]?_['map'](_0xf5d507[_0x6def('0x1e')],function(_0x150d2){return{'model':db[_0x150d2[_0x6def('0x1f')]],'as':_0x150d2['as'],'attributes':_0x150d2[_0x6def('0x1b')],'include':_0x150d2[_0x6def('0x1e')]?_['map'](_0x150d2[_0x6def('0x1e')],function(_0x47086c){return{'model':db[_0x47086c[_0x6def('0x1f')]],'as':_0x47086c['as'],'attributes':_0x47086c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6def('0x21')](function(_0x106359){logger['info'](_0x6def('0x22'),_0x218cb0);logger['debug'](_0x6def('0x22'),_0x218cb0,JSON['stringify'](_0x106359));_0x252c84(_0x106359);})[_0x6def('0x14')](function(_0x237e95){logger[_0x6def('0x11')]('ShowTrigger',_0x237e95[_0x6def('0x12')],_0x218cb0);_0x12b54a(_0x2cc520[_0x6def('0x11')](0x1f4,_0x237e95[_0x6def('0x12')]));});});}; \ No newline at end of file +var _0xfd6c=['then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowTrigger','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x248c51,_0xdf9962){var _0x28c4ce=function(_0xfd6d44){while(--_0xfd6d44){_0x248c51['push'](_0x248c51['shift']());}};_0x28c4ce(++_0xdf9962);}(_0xfd6c,0x1df));var _0xcfd6=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0xfd6c[_0x4b03c9];return _0x161ba2;};'use strict';var _=require(_0xcfd6('0x0'));var util=require(_0xcfd6('0x1'));var moment=require('moment');var BPromise=require(_0xcfd6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfd6('0x3'));var db=require(_0xcfd6('0x4'))['db'];var utils=require(_0xcfd6('0x5'));var logger=require(_0xcfd6('0x6'))('rpc');var config=require(_0xcfd6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcfd6('0x8')][_0xcfd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441c06,_0x41020c,_0x4c5cf3){return new BPromise(function(_0x5c5e27,_0x139e35){return client[_0xcfd6('0xa')](_0x441c06,_0x4c5cf3)[_0xcfd6('0xb')](function(_0x2b273a){logger['info'](_0xcfd6('0xc'),_0x41020c,'request\x20sent');logger[_0xcfd6('0xd')](_0xcfd6('0xe'),_0x41020c,_0xcfd6('0xf'),JSON[_0xcfd6('0x10')](_0x2b273a));if(_0x2b273a[_0xcfd6('0x11')]){if(_0x2b273a[_0xcfd6('0x11')]['code']===0x1f4){logger['error'](_0xcfd6('0xc'),_0x41020c,_0x2b273a['error'][_0xcfd6('0x12')]);return _0x139e35(_0x2b273a['error']['message']);}logger[_0xcfd6('0x11')](_0xcfd6('0xc'),_0x41020c,_0x2b273a[_0xcfd6('0x11')]['message']);return _0x5c5e27(_0x2b273a[_0xcfd6('0x11')][_0xcfd6('0x12')]);}else{logger[_0xcfd6('0x13')]('Trigger,\x20%s,\x20%s',_0x41020c,_0xcfd6('0xf'));_0x5c5e27(_0x2b273a[_0xcfd6('0x14')][_0xcfd6('0x12')]);}})['catch'](function(_0x2ea4b6){logger[_0xcfd6('0x11')](_0xcfd6('0xc'),_0x41020c,_0x2ea4b6);_0x139e35(_0x2ea4b6);});});}exports[_0xcfd6('0x15')]=function(_0x4d881a){var _0x378297=this;return new Promise(function(_0x3654ba,_0x343b5e){return db[_0xcfd6('0x16')][_0xcfd6('0x17')]({'raw':_0x4d881a[_0xcfd6('0x18')]?_0x4d881a[_0xcfd6('0x18')][_0xcfd6('0x19')]===undefined?!![]:![]:!![],'where':_0x4d881a[_0xcfd6('0x18')]?_0x4d881a['options'][_0xcfd6('0x1a')]||null:null,'attributes':_0x4d881a[_0xcfd6('0x18')]?_0x4d881a['options'][_0xcfd6('0x1b')]||null:null,'limit':_0x4d881a[_0xcfd6('0x18')]?_0x4d881a[_0xcfd6('0x18')][_0xcfd6('0x1c')]||null:null,'include':_0x4d881a[_0xcfd6('0x18')]?_0x4d881a['options'][_0xcfd6('0x1d')]?_[_0xcfd6('0x1e')](_0x4d881a[_0xcfd6('0x18')][_0xcfd6('0x1d')],function(_0x3a42a9){return{'model':db[_0x3a42a9[_0xcfd6('0x1f')]],'as':_0x3a42a9['as'],'attributes':_0x3a42a9['attributes'],'include':_0x3a42a9[_0xcfd6('0x1d')]?_['map'](_0x3a42a9[_0xcfd6('0x1d')],function(_0x54adbf){return{'model':db[_0x54adbf[_0xcfd6('0x1f')]],'as':_0x54adbf['as'],'attributes':_0x54adbf[_0xcfd6('0x1b')],'include':_0x54adbf[_0xcfd6('0x1d')]?_[_0xcfd6('0x1e')](_0x54adbf[_0xcfd6('0x1d')],function(_0x112193){return{'model':db[_0x112193[_0xcfd6('0x1f')]],'as':_0x112193['as'],'attributes':_0x112193['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c3cff){logger[_0xcfd6('0x13')](_0xcfd6('0x15'),_0x4d881a);logger[_0xcfd6('0xd')](_0xcfd6('0x15'),_0x4d881a,JSON[_0xcfd6('0x10')](_0x5c3cff));_0x3654ba(_0x5c3cff);})[_0xcfd6('0x20')](function(_0x9edb5b){logger[_0xcfd6('0x11')](_0xcfd6('0x15'),_0x9edb5b[_0xcfd6('0x12')],_0x4d881a);_0x343b5e(_0x378297[_0xcfd6('0x11')](0x1f4,_0x9edb5b['message']));});});};exports['ShowTrigger']=function(_0xe97b7d){var _0x4e9a73=this;return new Promise(function(_0x585b48,_0x1927b4){return db['Trigger'][_0xcfd6('0x21')]({'raw':_0xe97b7d[_0xcfd6('0x18')]?_0xe97b7d[_0xcfd6('0x18')][_0xcfd6('0x19')]===undefined?!![]:![]:!![],'where':_0xe97b7d[_0xcfd6('0x18')]?_0xe97b7d['options'][_0xcfd6('0x1a')]||null:null,'attributes':_0xe97b7d[_0xcfd6('0x18')]?_0xe97b7d[_0xcfd6('0x18')][_0xcfd6('0x1b')]||null:null,'include':_0xe97b7d[_0xcfd6('0x18')]?_0xe97b7d[_0xcfd6('0x18')]['include']?_[_0xcfd6('0x1e')](_0xe97b7d['options'][_0xcfd6('0x1d')],function(_0x1c0f7d){return{'model':db[_0x1c0f7d['model']],'as':_0x1c0f7d['as'],'attributes':_0x1c0f7d[_0xcfd6('0x1b')],'include':_0x1c0f7d[_0xcfd6('0x1d')]?_[_0xcfd6('0x1e')](_0x1c0f7d['include'],function(_0x24215a){return{'model':db[_0x24215a[_0xcfd6('0x1f')]],'as':_0x24215a['as'],'attributes':_0x24215a[_0xcfd6('0x1b')],'include':_0x24215a[_0xcfd6('0x1d')]?_[_0xcfd6('0x1e')](_0x24215a[_0xcfd6('0x1d')],function(_0x111caf){return{'model':db[_0x111caf[_0xcfd6('0x1f')]],'as':_0x111caf['as'],'attributes':_0x111caf[_0xcfd6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcfd6('0xb')](function(_0x28c836){logger[_0xcfd6('0x13')](_0xcfd6('0x22'),_0xe97b7d);logger[_0xcfd6('0xd')](_0xcfd6('0x22'),_0xe97b7d,JSON[_0xcfd6('0x10')](_0x28c836));_0x585b48(_0x28c836);})[_0xcfd6('0x20')](function(_0x76ca56){logger[_0xcfd6('0x11')]('ShowTrigger',_0x76ca56[_0xcfd6('0x12')],_0xe97b7d);_0x1927b4(_0x4e9a73[_0xcfd6('0x11')](0x1f4,_0x76ca56[_0xcfd6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b2bffaf..e7e51a1 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 _0x0655=['get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./trunk.controller','index'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x0655,0xf0));var _0x5065=function(_0x1840b1,_0x2d021e){_0x1840b1=_0x1840b1-0x0;var _0x54ee73=_0x0655[_0x1840b1];return _0x54ee73;};'use strict';var multer=require('multer');var util=require(_0x5065('0x0'));var path=require('path');var timeout=require(_0x5065('0x1'));var express=require('express');var router=express[_0x5065('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5065('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5065('0x4'));var controller=require(_0x5065('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5065('0x6')]);router[_0x5065('0x7')](_0x5065('0x8'),auth[_0x5065('0x9')](),controller[_0x5065('0xa')]);router[_0x5065('0xb')](_0x5065('0xc'),auth[_0x5065('0x9')](),controller[_0x5065('0xd')]);router[_0x5065('0xb')]('/',auth[_0x5065('0x9')](),controller[_0x5065('0xe')]);router[_0x5065('0xf')](_0x5065('0x8'),auth[_0x5065('0x9')](),controller['update']);router[_0x5065('0x10')](_0x5065('0x8'),auth[_0x5065('0x9')](),controller[_0x5065('0x11')]);module[_0x5065('0x12')]=router; \ No newline at end of file +var _0xcee7=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show','post','/:id/clone','clone','create','put','/:id','update'];(function(_0x15718e,_0x2f5096){var _0xf3b1d2=function(_0x718af1){while(--_0x718af1){_0x15718e['push'](_0x15718e['shift']());}};_0xf3b1d2(++_0x2f5096);}(_0xcee7,0x189));var _0x7cee=function(_0x3ca07f,_0x18b97d){_0x3ca07f=_0x3ca07f-0x0;var _0x18b515=_0xcee7[_0x3ca07f];return _0x18b515;};'use strict';var multer=require(_0x7cee('0x0'));var util=require('util');var path=require(_0x7cee('0x1'));var timeout=require(_0x7cee('0x2'));var express=require(_0x7cee('0x3'));var router=express[_0x7cee('0x4')]();var fs_extra=require(_0x7cee('0x5'));var auth=require(_0x7cee('0x6'));var interaction=require(_0x7cee('0x7'));var config=require(_0x7cee('0x8'));var controller=require(_0x7cee('0x9'));router[_0x7cee('0xa')]('/',auth['isAuthenticated'](),controller[_0x7cee('0xb')]);router[_0x7cee('0xa')]('/:id',auth[_0x7cee('0xc')](),controller[_0x7cee('0xd')]);router[_0x7cee('0xe')](_0x7cee('0xf'),auth['isAuthenticated'](),controller[_0x7cee('0x10')]);router['post']('/',auth[_0x7cee('0xc')](),controller[_0x7cee('0x11')]);router[_0x7cee('0x12')](_0x7cee('0x13'),auth['isAuthenticated'](),controller[_0x7cee('0x14')]);router[_0x7cee('0x15')](_0x7cee('0x13'),auth[_0x7cee('0xc')](),controller[_0x7cee('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 27a3c66..b2201be 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 _0xcc39=['ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','pai','fingerprint','active','passive','actpass','nonat','update','update,nonat','BOOLEAN','sequelize','exports','name'];(function(_0x1ed9df,_0x1b8265){var _0x5dc9c3=function(_0x59f854){while(--_0x59f854){_0x1ed9df['push'](_0x1ed9df['shift']());}};_0x5dc9c3(++_0x1b8265);}(_0xcc39,0x154));var _0x9cc3=function(_0x11b1b3,_0xf3cc69){_0x11b1b3=_0x11b1b3-0x0;var _0x437029=_0xcc39[_0x11b1b3];return _0x437029;};'use strict';var Sequelize=require(_0x9cc3('0x0'));module[_0x9cc3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9cc3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x4'),'user',_0x9cc3('0x5')),'allowNull':![],'defaultValue':_0x9cc3('0x4')},'context':{'type':Sequelize[_0x9cc3('0x6')],'allowNull':![],'defaultValue':_0x9cc3('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x9cc3('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x9cc3('0x9'),_0x9cc3('0xa'),_0x9cc3('0xb'),_0x9cc3('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x9cc3('0x6')]},'permit':{'type':Sequelize[_0x9cc3('0x6')]},'secret':{'type':Sequelize[_0x9cc3('0x6')]},'md5secret':{'type':Sequelize[_0x9cc3('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x9cc3('0xd'),'set':function(_0x460394){this[_0x9cc3('0xe')](_0x9cc3('0xf'),_0x460394?_0x460394['join'](','):null);},'get':function(){return this[_0x9cc3('0x10')](_0x9cc3('0xf'))?this[_0x9cc3('0x10')](_0x9cc3('0xf'))['split'](','):null;},'comment':_0x9cc3('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x9cc3('0x12'),_0x9cc3('0x13'),_0x9cc3('0x14'),_0x9cc3('0x15'),'auto'),'defaultValue':_0x9cc3('0x12')},'directmedia':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9cc3('0x6')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x1ffeb9){this[_0x9cc3('0xe')](_0x9cc3('0x17'),_0x1ffeb9?_0x1ffeb9[_0x9cc3('0x18')](','):null);},'get':function(){return this[_0x9cc3('0x10')](_0x9cc3('0x17'))?this[_0x9cc3('0x10')](_0x9cc3('0x17'))['split'](','):null;},'comment':_0x9cc3('0x19')},'callgroup':{'type':Sequelize[_0x9cc3('0x6')]},'namedcallgroup':{'type':Sequelize[_0x9cc3('0x6')]},'pickupgroup':{'type':Sequelize[_0x9cc3('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x9cc3('0x6')]},'language':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':_0x9cc3('0x1a')},'allow':{'type':Sequelize[_0x9cc3('0x6')],'allowNull':![],'defaultValue':_0x9cc3('0x1b'),'set':function(_0x43e6ac){this[_0x9cc3('0xe')](_0x9cc3('0x1c'),_0x43e6ac?_0x43e6ac[_0x9cc3('0x18')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9cc3('0x10')](_0x9cc3('0x1c'))?this[_0x9cc3('0x10')](_0x9cc3('0x1c'))[_0x9cc3('0x1d')](';'):null;},'comment':_0x9cc3('0x1e')},'autoframing':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'insecure':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':_0x9cc3('0x1f'),'set':function(_0x12934c){this[_0x9cc3('0xe')](_0x9cc3('0x20'),_0x12934c?_0x12934c[_0x9cc3('0x18')](','):null);},'get':function(){return this[_0x9cc3('0x10')](_0x9cc3('0x20'))?this[_0x9cc3('0x10')]('insecure')[_0x9cc3('0x1d')](','):null;},'comment':_0x9cc3('0x21')},'trustrpid':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x9cc3('0x16'),'no')},'accountcode':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'setvar':{'type':Sequelize[_0x9cc3('0x6')]},'callerid':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':_0x9cc3('0x23')},'amaflags':{'type':Sequelize[_0x9cc3('0x6')]},'callcounter':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x9cc3('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9cc3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x9cc3('0x6')]},'template':{'type':Sequelize[_0x9cc3('0x6')]},'videosupport':{'type':Sequelize[_0x9cc3('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'mailbox':{'type':Sequelize[_0x9cc3('0x6')]},'session_timers':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x24'),'refuse',_0x9cc3('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x26'),'uas'),'defaultValue':_0x9cc3('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x9cc3('0x6')]},'regexten':{'type':Sequelize[_0x9cc3('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x9cc3('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no'),'defaultValue':_0x9cc3('0x16')},'keepalive':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x9cc3('0x6')]},'defaultuser':{'type':Sequelize[_0x9cc3('0x6')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no',_0x9cc3('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x9cc3('0x6')]},'timert1':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'timerb':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x9cc3('0x6')]},'contactdeny':{'type':Sequelize[_0x9cc3('0x6')]},'contactacl':{'type':Sequelize[_0x9cc3('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0x9cc3('0x6')]},'use_q850_reason':{'type':Sequelize[_0x9cc3('0x6')]},'maxforwards':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'encryption':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'force_avp':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x9cc3('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x9cc3('0x3')]('yes','no',_0x9cc3('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x9cc3('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x9cc3('0x6')]},'dtlscipher':{'type':Sequelize[_0x9cc3('0x6')]},'dtlscafile':{'type':Sequelize[_0x9cc3('0x6')]},'dtlscapath':{'type':Sequelize[_0x9cc3('0x6')]},'dtlssetup':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x2a'),_0x9cc3('0x2b'),_0x9cc3('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9cc3('0x6')]},'usereqphone':{'type':Sequelize[_0x9cc3('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9cc3('0x6')]},'recordofffeature':{'type':Sequelize[_0x9cc3('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9cc3('0x16'),'no')},'vmexten':{'type':Sequelize[_0x9cc3('0x6')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x9cc3('0x6')]},'parkinglot':{'type':Sequelize[_0x9cc3('0x6')]},'description':{'type':Sequelize[_0x9cc3('0x6')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x9cc3('0x3')](_0x9cc3('0x16'),'no',_0x9cc3('0x2d'),_0x9cc3('0x2e'),_0x9cc3('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9cc3('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x9cc3('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9cc3('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc613=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','refuse','originate','uac','uas','pai','fingerprint','active','passive','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm'];(function(_0x32ee74,_0x2f1bc0){var _0x39e099=function(_0x10fcd6){while(--_0x10fcd6){_0x32ee74['push'](_0x32ee74['shift']());}};_0x39e099(++_0x2f1bc0);}(_0xc613,0xd5));var _0x3c61=function(_0x346ce7,_0x9702f3){_0x346ce7=_0x346ce7-0x0;var _0x14363b=_0xc613[_0x346ce7];return _0x14363b;};'use strict';var Sequelize=require(_0x3c61('0x0'));module[_0x3c61('0x1')]={'name':{'type':Sequelize[_0x3c61('0x2')],'allowNull':![],'unique':_0x3c61('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x5'),_0x3c61('0x6'),'peer'),'allowNull':![],'defaultValue':_0x3c61('0x5')},'context':{'type':Sequelize[_0x3c61('0x2')],'allowNull':![],'defaultValue':_0x3c61('0x7')},'callingpres':{'type':Sequelize[_0x3c61('0x4')]('ALLOWED_NOT_SCREENED',_0x3c61('0x8'),_0x3c61('0x9'),_0x3c61('0xa'),_0x3c61('0xb'),_0x3c61('0xc'),'PROHIB_FAILED_SCREEN',_0x3c61('0xd'))},'deny':{'type':Sequelize[_0x3c61('0x2')]},'permit':{'type':Sequelize[_0x3c61('0x2')]},'secret':{'type':Sequelize[_0x3c61('0x2')]},'md5secret':{'type':Sequelize[_0x3c61('0x2')]},'remotesecret':{'type':Sequelize[_0x3c61('0x2')]},'transport':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':_0x3c61('0xe'),'set':function(_0x20b30d){this[_0x3c61('0xf')]('transport',_0x20b30d?_0x20b30d[_0x3c61('0x10')](','):null);},'get':function(){return this[_0x3c61('0x11')](_0x3c61('0x12'))?this[_0x3c61('0x11')]('transport')[_0x3c61('0x13')](','):null;},'comment':_0x3c61('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3c61('0x15'),_0x3c61('0x16'),_0x3c61('0x17'),_0x3c61('0x18'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no','nonat',_0x3c61('0x1a'),_0x3c61('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3c61('0x2')]},'directmediadeny':{'type':Sequelize[_0x3c61('0x2')]},'nat':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':_0x3c61('0x1c'),'set':function(_0x62099b){this[_0x3c61('0xf')]('nat',_0x62099b?_0x62099b[_0x3c61('0x10')](','):null);},'get':function(){return this[_0x3c61('0x11')](_0x3c61('0x1d'))?this[_0x3c61('0x11')](_0x3c61('0x1d'))[_0x3c61('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3c61('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3c61('0x2')]},'pickupgroup':{'type':Sequelize[_0x3c61('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3c61('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3c61('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':_0x3c61('0x1e')},'allow':{'type':Sequelize[_0x3c61('0x2')],'allowNull':![],'defaultValue':_0x3c61('0x1f'),'set':function(_0x459620){this['setDataValue'](_0x3c61('0x20'),_0x459620?_0x459620[_0x3c61('0x10')](';'):_0x3c61('0x1f'));},'get':function(){return this[_0x3c61('0x11')](_0x3c61('0x20'))?this[_0x3c61('0x11')](_0x3c61('0x20'))[_0x3c61('0x13')](';'):null;},'comment':_0x3c61('0x21')},'autoframing':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'insecure':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':'port,invite','set':function(_0x5ce4f7){this['setDataValue']('insecure',_0x5ce4f7?_0x5ce4f7[_0x3c61('0x10')](','):null);},'get':function(){return this[_0x3c61('0x11')](_0x3c61('0x22'))?this[_0x3c61('0x11')](_0x3c61('0x22'))[_0x3c61('0x13')](','):null;},'comment':_0x3c61('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x3c61('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x3c61('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'accountcode':{'type':Sequelize[_0x3c61('0x24')](0xb)},'setvar':{'type':Sequelize[_0x3c61('0x2')]},'callerid':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':_0x3c61('0x25')},'amaflags':{'type':Sequelize[_0x3c61('0x2')]},'callcounter':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no'),'defaultValue':_0x3c61('0x19')},'busylevel':{'type':Sequelize[_0x3c61('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x3c61('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3c61('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x3c61('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3c61('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x3c61('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3c61('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3c61('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x3c61('0x4')]('accept',_0x3c61('0x26'),_0x3c61('0x27'))},'session_expires':{'type':Sequelize[_0x3c61('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x28'),_0x3c61('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3c61('0x2')]},'regexten':{'type':Sequelize[_0x3c61('0x2')]},'fromdomain':{'type':Sequelize[_0x3c61('0x2')]},'fromuser':{'type':Sequelize[_0x3c61('0x2')]},'port':{'type':Sequelize[_0x3c61('0x24')](0x5)},'qualify':{'type':Sequelize[_0x3c61('0x4')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3c61('0x2')]},'defaultuser':{'type':Sequelize[_0x3c61('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3c61('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3c61('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no',_0x3c61('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3c61('0x2')]},'callbackextension':{'type':Sequelize[_0x3c61('0x2')]},'timert1':{'type':Sequelize[_0x3c61('0x24')](0xb)},'timerb':{'type':Sequelize[_0x3c61('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3c61('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x3c61('0x2')]},'contactdeny':{'type':Sequelize[_0x3c61('0x2')]},'contactacl':{'type':Sequelize[_0x3c61('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3c61('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3c61('0x2')]},'maxforwards':{'type':Sequelize[_0x3c61('0x24')](0xb)},'encryption':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3c61('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x3c61('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x3c61('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3c61('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3c61('0x2')]},'dtlscipher':{'type':Sequelize[_0x3c61('0x2')]},'dtlscafile':{'type':Sequelize[_0x3c61('0x2')]},'dtlscapath':{'type':Sequelize[_0x3c61('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3c61('0x2c'),_0x3c61('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3c61('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x3c61('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3c61('0x2')]},'recordofffeature':{'type':Sequelize[_0x3c61('0x2')]},'call_limit':{'type':Sequelize[_0x3c61('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no')},'vmexten':{'type':Sequelize[_0x3c61('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x3c61('0x2')]},'parkinglot':{'type':Sequelize[_0x3c61('0x2')]},'description':{'type':Sequelize[_0x3c61('0x2')]},'host':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3c61('0x4')](_0x3c61('0x19'),'no',_0x3c61('0x2e'),_0x3c61('0x1a'),_0x3c61('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3c61('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3c61('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3c61('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 861e57c..ecc9bd4 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 _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x1c409f,_0x3c5ef6){var _0x1f6448=function(_0x12109f){while(--_0x12109f){_0x1c409f['push'](_0x1c409f['shift']());}};_0x1f6448(++_0x3c5ef6);}(_0xe14d,0x1ee));var _0xde14=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe14d[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file +var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x197df3,_0x57d366){var _0xafdaf7=function(_0x5489b5){while(--_0x5489b5){_0x197df3['push'](_0x197df3['shift']());}};_0xafdaf7(++_0x57d366);}(_0x9bde,0xe1));var _0xe9bd=function(_0xbe282,_0x5ceabb){_0xbe282=_0xbe282-0x0;var _0x5485d3=_0x9bde[_0xbe282];return _0x5485d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4339d17..f3b6efb 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 _0x24b3=['moment','bluebird','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x2bf40f,_0x36c9da){var _0x57c391=function(_0x1be4da){while(--_0x1be4da){_0x2bf40f['push'](_0x2bf40f['shift']());}};_0x57c391(++_0x36c9da);}(_0x24b3,0x13c));var _0x324b=function(_0x18f4cf,_0x58a059){_0x18f4cf=_0x18f4cf-0x0;var _0x3a9d12=_0x24b3[_0x18f4cf];return _0x3a9d12;};'use strict';var _=require(_0x324b('0x0'));var util=require('util');var logger=require(_0x324b('0x1'))(_0x324b('0x2'));var moment=require(_0x324b('0x3'));var BPromise=require(_0x324b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x324b('0x5'));var config=require('../../config/environment');var attributes=require(_0x324b('0x6'));module[_0x324b('0x7')]=function(_0x2ea281,_0x44d5da){return _0x2ea281[_0x324b('0x8')](_0x324b('0x9'),attributes,{'tableName':_0x324b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd465=['../../config/logger','api','moment','rimraf','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util'];(function(_0x52a7b5,_0x26c95c){var _0x32d6d2=function(_0xff339a){while(--_0xff339a){_0x52a7b5['push'](_0x52a7b5['shift']());}};_0x32d6d2(++_0x26c95c);}(_0xd465,0x134));var _0x5d46=function(_0xde487b,_0x3061e5){_0xde487b=_0xde487b-0x0;var _0x40bc3b=_0xd465[_0xde487b];return _0x40bc3b;};'use strict';var _=require(_0x5d46('0x0'));var util=require(_0x5d46('0x1'));var logger=require(_0x5d46('0x2'))(_0x5d46('0x3'));var moment=require(_0x5d46('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d46('0x5'));var config=require('../../config/environment');var attributes=require(_0x5d46('0x6'));module[_0x5d46('0x7')]=function(_0x123f42,_0x177bba){return _0x123f42['define'](_0x5d46('0x8'),attributes,{'tableName':_0x5d46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d0f9731..68f3ad3 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 _0x5d6c=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','options','raw','where','attributes','limit','map','include','model','info','GetTrunk','catch','ShowTrunk','Trunk','lodash','util','randomstring','ioredis'];(function(_0x3b590d,_0x9ebc64){var _0x2c4c26=function(_0x2dcdad){while(--_0x2dcdad){_0x3b590d['push'](_0x3b590d['shift']());}};_0x2c4c26(++_0x9ebc64);}(_0x5d6c,0xfc));var _0xc5d6=function(_0xf8c39b,_0xd19d6f){_0xf8c39b=_0xf8c39b-0x0;var _0x25d860=_0x5d6c[_0xf8c39b];return _0x25d860;};'use strict';var _=require(_0xc5d6('0x0'));var util=require(_0xc5d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc5d6('0x2'));var fs=require('fs');var Redis=require(_0xc5d6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5d6('0x4'));var logger=require(_0xc5d6('0x5'))('rpc');var config=require(_0xc5d6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc5d6('0x7')][_0xc5d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16704f,_0x140307,_0x3f14a3){return new BPromise(function(_0xd9b8b,_0x1666cf){return client[_0xc5d6('0x9')](_0x16704f,_0x3f14a3)[_0xc5d6('0xa')](function(_0x2fb46e){logger['info'](_0xc5d6('0xb'),_0x140307,'request\x20sent');logger[_0xc5d6('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x140307,_0xc5d6('0xd'),JSON[_0xc5d6('0xe')](_0x2fb46e));if(_0x2fb46e['error']){if(_0x2fb46e[_0xc5d6('0xf')][_0xc5d6('0x10')]===0x1f4){logger[_0xc5d6('0xf')](_0xc5d6('0xb'),_0x140307,_0x2fb46e[_0xc5d6('0xf')][_0xc5d6('0x11')]);return _0x1666cf(_0x2fb46e[_0xc5d6('0xf')][_0xc5d6('0x11')]);}logger[_0xc5d6('0xf')]('Trunk,\x20%s,\x20%s',_0x140307,_0x2fb46e['error'][_0xc5d6('0x11')]);return _0xd9b8b(_0x2fb46e[_0xc5d6('0xf')][_0xc5d6('0x11')]);}else{logger['info'](_0xc5d6('0xb'),_0x140307,_0xc5d6('0xd'));_0xd9b8b(_0x2fb46e[_0xc5d6('0x12')][_0xc5d6('0x11')]);}})['catch'](function(_0x315d58){logger[_0xc5d6('0xf')](_0xc5d6('0xb'),_0x140307,_0x315d58);_0x1666cf(_0x315d58);});});}exports['GetTrunk']=function(_0x40ca02){var _0x3d3339=this;return new Promise(function(_0x374788,_0x27598e){return db['Trunk']['findAll']({'raw':_0x40ca02['options']?_0x40ca02[_0xc5d6('0x13')][_0xc5d6('0x14')]===undefined?!![]:![]:!![],'where':_0x40ca02[_0xc5d6('0x13')]?_0x40ca02['options'][_0xc5d6('0x15')]||null:null,'attributes':_0x40ca02['options']?_0x40ca02[_0xc5d6('0x13')][_0xc5d6('0x16')]||null:null,'limit':_0x40ca02[_0xc5d6('0x13')]?_0x40ca02[_0xc5d6('0x13')][_0xc5d6('0x17')]||null:null,'include':_0x40ca02[_0xc5d6('0x13')]?_0x40ca02[_0xc5d6('0x13')]['include']?_[_0xc5d6('0x18')](_0x40ca02[_0xc5d6('0x13')][_0xc5d6('0x19')],function(_0x5c3d55){return{'model':db[_0x5c3d55[_0xc5d6('0x1a')]],'as':_0x5c3d55['as'],'attributes':_0x5c3d55['attributes'],'include':_0x5c3d55[_0xc5d6('0x19')]?_[_0xc5d6('0x18')](_0x5c3d55[_0xc5d6('0x19')],function(_0x413e6f){return{'model':db[_0x413e6f[_0xc5d6('0x1a')]],'as':_0x413e6f['as'],'attributes':_0x413e6f[_0xc5d6('0x16')],'include':_0x413e6f[_0xc5d6('0x19')]?_[_0xc5d6('0x18')](_0x413e6f[_0xc5d6('0x19')],function(_0x64014a){return{'model':db[_0x64014a['model']],'as':_0x64014a['as'],'attributes':_0x64014a[_0xc5d6('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc5d6('0xa')](function(_0x5e8da0){logger[_0xc5d6('0x1b')](_0xc5d6('0x1c'),_0x40ca02);logger[_0xc5d6('0xc')](_0xc5d6('0x1c'),_0x40ca02,JSON['stringify'](_0x5e8da0));_0x374788(_0x5e8da0);})[_0xc5d6('0x1d')](function(_0x23795f){logger[_0xc5d6('0xf')](_0xc5d6('0x1c'),_0x23795f['message'],_0x40ca02);_0x27598e(_0x3d3339[_0xc5d6('0xf')](0x1f4,_0x23795f[_0xc5d6('0x11')]));});});};exports[_0xc5d6('0x1e')]=function(_0x1f1563){var _0x4f15be=this;return new Promise(function(_0x44d6e5,_0x53af83){return db[_0xc5d6('0x1f')]['find']({'raw':_0x1f1563[_0xc5d6('0x13')]?_0x1f1563[_0xc5d6('0x13')][_0xc5d6('0x14')]===undefined?!![]:![]:!![],'where':_0x1f1563[_0xc5d6('0x13')]?_0x1f1563[_0xc5d6('0x13')][_0xc5d6('0x15')]||null:null,'attributes':_0x1f1563['options']?_0x1f1563[_0xc5d6('0x13')][_0xc5d6('0x16')]||null:null,'include':_0x1f1563['options']?_0x1f1563['options'][_0xc5d6('0x19')]?_[_0xc5d6('0x18')](_0x1f1563[_0xc5d6('0x13')][_0xc5d6('0x19')],function(_0x17b642){return{'model':db[_0x17b642[_0xc5d6('0x1a')]],'as':_0x17b642['as'],'attributes':_0x17b642['attributes'],'include':_0x17b642['include']?_[_0xc5d6('0x18')](_0x17b642[_0xc5d6('0x19')],function(_0x494035){return{'model':db[_0x494035[_0xc5d6('0x1a')]],'as':_0x494035['as'],'attributes':_0x494035[_0xc5d6('0x16')],'include':_0x494035['include']?_['map'](_0x494035['include'],function(_0x499cd9){return{'model':db[_0x499cd9[_0xc5d6('0x1a')]],'as':_0x499cd9['as'],'attributes':_0x499cd9[_0xc5d6('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc5d6('0xa')](function(_0x34e373){logger['info']('ShowTrunk',_0x1f1563);logger[_0xc5d6('0xc')](_0xc5d6('0x1e'),_0x1f1563,JSON['stringify'](_0x34e373));_0x44d6e5(_0x34e373);})[_0xc5d6('0x1d')](function(_0x277fab){logger[_0xc5d6('0xf')]('ShowTrunk',_0x277fab[_0xc5d6('0x11')],_0x1f1563);_0x53af83(_0x4f15be['error'](0x1f4,_0x277fab[_0xc5d6('0x11')]));});});}; \ No newline at end of file +var _0x180d=['attributes','limit','include','model','map','GetTrunk','ShowTrunk','find','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','Trunk','findAll','options','raw'];(function(_0x1fbd19,_0x265280){var _0x2998b9=function(_0x1ae6a9){while(--_0x1ae6a9){_0x1fbd19['push'](_0x1fbd19['shift']());}};_0x2998b9(++_0x265280);}(_0x180d,0x167));var _0xd180=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x180d[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var moment=require(_0xd180('0x1'));var BPromise=require(_0xd180('0x2'));var rs=require(_0xd180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd180('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd180('0x5'))(_0xd180('0x6'));var config=require(_0xd180('0x7'));var jayson=require(_0xd180('0x8'));var client=jayson[_0xd180('0x9')][_0xd180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6c27d,_0x3e52c2,_0x571e16){return new BPromise(function(_0x24cb7d,_0x5043d0){return client['request'](_0x6c27d,_0x571e16)[_0xd180('0xb')](function(_0x1bb787){logger[_0xd180('0xc')]('Trunk,\x20%s,\x20%s',_0x3e52c2,_0xd180('0xd'));logger[_0xd180('0xe')](_0xd180('0xf'),_0x3e52c2,_0xd180('0xd'),JSON[_0xd180('0x10')](_0x1bb787));if(_0x1bb787[_0xd180('0x11')]){if(_0x1bb787[_0xd180('0x11')][_0xd180('0x12')]===0x1f4){logger[_0xd180('0x11')](_0xd180('0x13'),_0x3e52c2,_0x1bb787[_0xd180('0x11')][_0xd180('0x14')]);return _0x5043d0(_0x1bb787[_0xd180('0x11')]['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x3e52c2,_0x1bb787[_0xd180('0x11')][_0xd180('0x14')]);return _0x24cb7d(_0x1bb787[_0xd180('0x11')][_0xd180('0x14')]);}else{logger[_0xd180('0xc')]('Trunk,\x20%s,\x20%s',_0x3e52c2,_0xd180('0xd'));_0x24cb7d(_0x1bb787[_0xd180('0x15')][_0xd180('0x14')]);}})['catch'](function(_0x442134){logger[_0xd180('0x11')]('Trunk,\x20%s,\x20%s',_0x3e52c2,_0x442134);_0x5043d0(_0x442134);});});}exports['GetTrunk']=function(_0x4eb760){var _0x457a26=this;return new Promise(function(_0x19e862,_0x349c66){return db[_0xd180('0x16')][_0xd180('0x17')]({'raw':_0x4eb760['options']?_0x4eb760[_0xd180('0x18')][_0xd180('0x19')]===undefined?!![]:![]:!![],'where':_0x4eb760[_0xd180('0x18')]?_0x4eb760['options']['where']||null:null,'attributes':_0x4eb760['options']?_0x4eb760[_0xd180('0x18')][_0xd180('0x1a')]||null:null,'limit':_0x4eb760['options']?_0x4eb760['options'][_0xd180('0x1b')]||null:null,'include':_0x4eb760[_0xd180('0x18')]?_0x4eb760[_0xd180('0x18')]['include']?_['map'](_0x4eb760[_0xd180('0x18')][_0xd180('0x1c')],function(_0x36dd13){return{'model':db[_0x36dd13[_0xd180('0x1d')]],'as':_0x36dd13['as'],'attributes':_0x36dd13['attributes'],'include':_0x36dd13[_0xd180('0x1c')]?_[_0xd180('0x1e')](_0x36dd13[_0xd180('0x1c')],function(_0x55d240){return{'model':db[_0x55d240['model']],'as':_0x55d240['as'],'attributes':_0x55d240[_0xd180('0x1a')],'include':_0x55d240[_0xd180('0x1c')]?_[_0xd180('0x1e')](_0x55d240[_0xd180('0x1c')],function(_0x3a2f52){return{'model':db[_0x3a2f52[_0xd180('0x1d')]],'as':_0x3a2f52['as'],'attributes':_0x3a2f52[_0xd180('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x406126){logger[_0xd180('0xc')]('GetTrunk',_0x4eb760);logger[_0xd180('0xe')]('GetTrunk',_0x4eb760,JSON[_0xd180('0x10')](_0x406126));_0x19e862(_0x406126);})['catch'](function(_0x1c5432){logger[_0xd180('0x11')](_0xd180('0x1f'),_0x1c5432[_0xd180('0x14')],_0x4eb760);_0x349c66(_0x457a26['error'](0x1f4,_0x1c5432[_0xd180('0x14')]));});});};exports[_0xd180('0x20')]=function(_0x431721){var _0x24dc0a=this;return new Promise(function(_0x2bad4f,_0x17d476){return db[_0xd180('0x16')][_0xd180('0x21')]({'raw':_0x431721[_0xd180('0x18')]?_0x431721[_0xd180('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x431721[_0xd180('0x18')]?_0x431721[_0xd180('0x18')][_0xd180('0x22')]||null:null,'attributes':_0x431721[_0xd180('0x18')]?_0x431721['options'][_0xd180('0x1a')]||null:null,'include':_0x431721['options']?_0x431721[_0xd180('0x18')]['include']?_[_0xd180('0x1e')](_0x431721[_0xd180('0x18')][_0xd180('0x1c')],function(_0x13bfe2){return{'model':db[_0x13bfe2[_0xd180('0x1d')]],'as':_0x13bfe2['as'],'attributes':_0x13bfe2[_0xd180('0x1a')],'include':_0x13bfe2[_0xd180('0x1c')]?_[_0xd180('0x1e')](_0x13bfe2[_0xd180('0x1c')],function(_0x33b80b){return{'model':db[_0x33b80b[_0xd180('0x1d')]],'as':_0x33b80b['as'],'attributes':_0x33b80b[_0xd180('0x1a')],'include':_0x33b80b[_0xd180('0x1c')]?_[_0xd180('0x1e')](_0x33b80b[_0xd180('0x1c')],function(_0x32c049){return{'model':db[_0x32c049[_0xd180('0x1d')]],'as':_0x32c049['as'],'attributes':_0x32c049[_0xd180('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd180('0xb')](function(_0x5639b4){logger[_0xd180('0xc')](_0xd180('0x20'),_0x431721);logger[_0xd180('0xe')](_0xd180('0x20'),_0x431721,JSON[_0xd180('0x10')](_0x5639b4));_0x2bad4f(_0x5639b4);})['catch'](function(_0x2cbfbd){logger['error']('ShowTrunk',_0x2cbfbd[_0xd180('0x14')],_0x431721);_0x17d476(_0x24dc0a[_0xd180('0x11')](0x1f4,_0x2cbfbd[_0xd180('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index c3e5edb..642c57a 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dab=['../../components/auth/service','./user-setting.controller','/:id','exports'];(function(_0x2eb41e,_0x2bdf4c){var _0x493e89=function(_0x180d7f){while(--_0x180d7f){_0x2eb41e['push'](_0x2eb41e['shift']());}};_0x493e89(++_0x2bdf4c);}(_0x4dab,0xf0));var _0xb4da=function(_0x3cef37,_0xb207b8){_0x3cef37=_0x3cef37-0x0;var _0x1f712a=_0x4dab[_0x3cef37];return _0x1f712a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb4da('0x0'));var controller=require(_0xb4da('0x1'));router['put'](_0xb4da('0x2'),auth['isAuthenticated'](),controller['update']);module[_0xb4da('0x3')]=router; \ No newline at end of file +var _0x7943=['./user-setting.controller','/:id','isAuthenticated','update','exports','express','../../components/auth/service'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7943,0x1ef));var _0x3794=function(_0x49c5df,_0x37db6d){_0x49c5df=_0x49c5df-0x0;var _0x38cb46=_0x7943[_0x49c5df];return _0x38cb46;};'use strict';var express=require(_0x3794('0x0'));var router=express['Router']();var auth=require(_0x3794('0x1'));var controller=require(_0x3794('0x2'));router['put'](_0x3794('0x3'),auth[_0x3794('0x4')](),controller[_0x3794('0x5')]);module[_0x3794('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 6c17268..29bce60 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8998=['debug','ENUM','error','BOOLEAN','DATE','INTEGER','UserId','sequelize','warning','info'];(function(_0x547302,_0x5c1853){var _0x120aa6=function(_0x54de1c){while(--_0x54de1c){_0x547302['push'](_0x547302['shift']());}};_0x120aa6(++_0x5c1853);}(_0x8998,0xcf));var _0x8899=function(_0x4a1a43,_0x4017eb){_0x4a1a43=_0x4a1a43-0x0;var _0x57b5b6=_0x8998[_0x4a1a43];return _0x57b5b6;};'use strict';var Sequelize=require(_0x8899('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x8899('0x1'),_0x8899('0x2'),_0x8899('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x8899('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8899('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8899('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8899('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8899('0x8')],'unique':_0x8899('0x9')}}; \ No newline at end of file +var _0xd6ff=['DATE','UserId','sequelize','error','warning','info','debug','exports','TEXT'];(function(_0x5e3dbe,_0x352d2b){var _0x5a890b=function(_0x194eee){while(--_0x194eee){_0x5e3dbe['push'](_0x5e3dbe['shift']());}};_0x5a890b(++_0x352d2b);}(_0xd6ff,0xfe));var _0xfd6f=function(_0x2d6354,_0x4c5cab){_0x2d6354=_0x2d6354-0x0;var _0x2218b9=_0xd6ff[_0x2d6354];return _0x2218b9;};'use strict';var Sequelize=require(_0xfd6f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfd6f('0x1'),_0xfd6f('0x2'),_0xfd6f('0x3'),_0xfd6f('0x4')];module[_0xfd6f('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfd6f('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfd6f('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfd6f('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xfd6f('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 5431c0e..6a7debf 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeb7=['json','then','stack','name','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status'];(function(_0x316af7,_0x72e80c){var _0x286d96=function(_0x1c1d7b){while(--_0x1c1d7b){_0x316af7['push'](_0x316af7['shift']());}};_0x286d96(++_0x72e80c);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7deb('0x0'));var Redis=require(_0x7deb('0x1'));var logger=require(_0x7deb('0x2'))('api');var config=require(_0x7deb('0x3'));var db=require(_0x7deb('0x4'))['db'];var socket=require(_0x7deb('0x5'))(new Redis(config[_0x7deb('0x6')]));require(_0x7deb('0x7'))['register'](socket);config[_0x7deb('0x6')]=_[_0x7deb('0x8')](config[_0x7deb('0x6')],{'host':_0x7deb('0x9'),'port':0x18eb});function respondWithResult(_0x1d4de9,_0x1a5058){_0x1a5058=_0x1a5058||0xc8;return function(_0x4e3d14){if(_0x4e3d14){return _0x1d4de9[_0x7deb('0xa')](_0x1a5058)[_0x7deb('0xb')](_0x4e3d14);}};}function saveUpdates(_0x3cb5d4){return function(_0x4468bb){if(_0x4468bb){return _0x4468bb['update'](_0x3cb5d4)[_0x7deb('0xc')](function(_0x5e37c9){return _0x5e37c9;});}return null;};}function handleEntityNotFound(_0x49b193){return function(_0x453eaf){if(!_0x453eaf){_0x49b193['sendStatus'](0x194);}return _0x453eaf;};}function handleError(_0x3940ec,_0xee4a85){_0xee4a85=_0xee4a85||0x1f4;return function(_0x2b749e){logger['error'](_0x2b749e[_0x7deb('0xd')]);if(_0x2b749e[_0x7deb('0xe')]){delete _0x2b749e[_0x7deb('0xe')];}_0x3940ec[_0x7deb('0xa')](_0xee4a85)['send'](_0x2b749e);};}exports[_0x7deb('0xf')]=function(_0x10ea17,_0xe8e818){if(_0x10ea17[_0x7deb('0x10')][_0x7deb('0x11')]!==_0x7deb('0x12'))throw new Error(_0x7deb('0x13'));if(isNaN(Number(_0x10ea17[_0x7deb('0x14')]['id'])))throw new Error(_0x7deb('0x15'));return db[_0x7deb('0x16')][_0x7deb('0x17')]({'where':{'id':_0x10ea17[_0x7deb('0x14')]['id']}})[_0x7deb('0xc')](handleEntityNotFound(_0xe8e818,null))[_0x7deb('0xc')](saveUpdates(_0x10ea17[_0x7deb('0x18')],null))['then'](respondWithResult(_0xe8e818,null))[_0x7deb('0x19')](handleError(_0xe8e818,null));}; \ No newline at end of file +var _0x50a6=['redis','./user-setting.socket','localhost','json','update','sendStatus','error','name','status','send','user','role','admin','Unauthorized','params','UserSetting','then','lodash','ioredis','../../config/environment','socket.io-emitter'];(function(_0x39fcf4,_0x518064){var _0x19ed90=function(_0x5c2561){while(--_0x5c2561){_0x39fcf4['push'](_0x39fcf4['shift']());}};_0x19ed90(++_0x518064);}(_0x50a6,0xa4));var _0x650a=function(_0x45154c,_0x1eca31){_0x45154c=_0x45154c-0x0;var _0x2513bc=_0x50a6[_0x45154c];return _0x2513bc;};'use strict';var _=require(_0x650a('0x0'));var Redis=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x650a('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x650a('0x3'))(new Redis(config[_0x650a('0x4')]));require(_0x650a('0x5'))['register'](socket);config[_0x650a('0x4')]=_['defaults'](config['redis'],{'host':_0x650a('0x6'),'port':0x18eb});function respondWithResult(_0x2d1bb4,_0x2c22b9){_0x2c22b9=_0x2c22b9||0xc8;return function(_0x61618a){if(_0x61618a){return _0x2d1bb4['status'](_0x2c22b9)[_0x650a('0x7')](_0x61618a);}};}function saveUpdates(_0x5c1d7c){return function(_0x3b50e7){if(_0x3b50e7){return _0x3b50e7[_0x650a('0x8')](_0x5c1d7c)['then'](function(_0x58ece6){return _0x58ece6;});}return null;};}function handleEntityNotFound(_0x3bbdca){return function(_0x5295f4){if(!_0x5295f4){_0x3bbdca[_0x650a('0x9')](0x194);}return _0x5295f4;};}function handleError(_0x526881,_0x142cdb){_0x142cdb=_0x142cdb||0x1f4;return function(_0x4fa19a){logger[_0x650a('0xa')](_0x4fa19a['stack']);if(_0x4fa19a[_0x650a('0xb')]){delete _0x4fa19a['name'];}_0x526881[_0x650a('0xc')](_0x142cdb)[_0x650a('0xd')](_0x4fa19a);};}exports[_0x650a('0x8')]=function(_0x516e71,_0x10fb8f){if(_0x516e71[_0x650a('0xe')][_0x650a('0xf')]!==_0x650a('0x10'))throw new Error(_0x650a('0x11'));if(isNaN(Number(_0x516e71[_0x650a('0x12')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x650a('0x13')]['find']({'where':{'id':_0x516e71[_0x650a('0x12')]['id']}})[_0x650a('0x14')](handleEntityNotFound(_0x10fb8f,null))[_0x650a('0x14')](saveUpdates(_0x516e71['body'],null))['then'](respondWithResult(_0x10fb8f,null))['catch'](handleError(_0x10fb8f,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 409f6a9..5d1e172 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x011b=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x011b,0x1c4));var _0xb011=function(_0x1c336b,_0x14c2cd){_0x1c336b=_0x1c336b-0x0;var _0x125e29=_0x011b[_0x1c336b];return _0x125e29;};'use strict';var EventEmitter=require(_0xb011('0x0'));var UserSetting=require(_0xb011('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb011('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb011('0x3'),'afterDestroy':_0xb011('0x4')};function emitEvent(_0x8435ec){return function(_0x2afd0e,_0x45e9dc,_0x5b6a44){UserSettingEvents[_0xb011('0x5')](_0x8435ec+':'+_0x2afd0e['id'],_0x2afd0e);UserSettingEvents['emit'](_0x8435ec,_0x2afd0e);_0x5b6a44(null);};}for(var e in events){if(events[_0xb011('0x6')](e)){var event=events[e];UserSetting[_0xb011('0x7')](e,emitEvent(event));}}module[_0xb011('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x44f8=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x44f8,0x19d));var _0x844f=function(_0x532ef8,_0x7e5cd3){_0x532ef8=_0x532ef8-0x0;var _0x325c85=_0x44f8[_0x532ef8];return _0x325c85;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x844f('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x844f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x844f('0x2')};function emitEvent(_0x737a43){return function(_0x40868e,_0xd0abd9,_0x1f8c67){UserSettingEvents[_0x844f('0x3')](_0x737a43+':'+_0x40868e['id'],_0x40868e);UserSettingEvents[_0x844f('0x3')](_0x737a43,_0x40868e);_0x1f8c67(null);};}for(var e in events){if(events[_0x844f('0x4')](e)){var event=events[e];UserSetting[_0x844f('0x5')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 3ef6683..684f444 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x373d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0x1eb585,_0x202476){var _0x497ee2=function(_0x36dffa){while(--_0x36dffa){_0x1eb585['push'](_0x1eb585['shift']());}};_0x497ee2(++_0x202476);}(_0x373d,0x1e2));var _0xd373=function(_0x40b43c,_0x269319){_0x40b43c=_0x40b43c-0x0;var _0x1d31b7=_0x373d[_0x40b43c];return _0x1d31b7;};'use strict';var attributes=require(_0xd373('0x0'));module['exports']=function(_0x3d3d31){return _0x3d3d31[_0xd373('0x1')](_0xd373('0x2'),attributes,{'tableName':_0xd373('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50ed19){if(!_0x50ed19[_0xd373('0x4')])_0x50ed19[_0xd373('0x5')]=null;else if(_0x50ed19[_0xd373('0x5')]===null)_0x50ed19['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x87d9=['UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','define'];(function(_0x2f2a84,_0x59895a){var _0x877a6a=function(_0x4a1c9a){while(--_0x4a1c9a){_0x2f2a84['push'](_0x2f2a84['shift']());}};_0x877a6a(++_0x59895a);}(_0x87d9,0x143));var _0x987d=function(_0x334578,_0x4f68f1){_0x334578=_0x334578-0x0;var _0x11d272=_0x87d9[_0x334578];return _0x11d272;};'use strict';var attributes=require(_0x987d('0x0'));module['exports']=function(_0x1531a3){return _0x1531a3[_0x987d('0x1')](_0x987d('0x2'),attributes,{'tableName':_0x987d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c9a1d){if(!_0x3c9a1d['clientSideLoggingEnabled'])_0x3c9a1d[_0x987d('0x4')]=null;else if(_0x3c9a1d['clientSideLoggingEnabledSince']===null)_0x3c9a1d[_0x987d('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 0b65429..78e7960 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcab6=['user-setting:','./user-setting.events','update','emit','user-setting:update','UserId','length'];(function(_0x83cdee,_0x3c19ac){var _0x117300=function(_0xbace86){while(--_0xbace86){_0x83cdee['push'](_0x83cdee['shift']());}};_0x117300(++_0x3c19ac);}(_0xcab6,0xfd));var _0x6cab=function(_0x3d4779,_0x41e221){_0x3d4779=_0x3d4779-0x0;var _0x4fc60f=_0xcab6[_0x3d4779];return _0x4fc60f;};'use strict';var UserSettingEvents=require(_0x6cab('0x0'));var events=['save','remove',_0x6cab('0x1')];function createListener(_0xfeb697,_0x3b0e13){return function(_0x19a2a1){_0x3b0e13[_0x6cab('0x2')](_0xfeb697,_0x19a2a1);if(_0xfeb697===_0x6cab('0x3')){_0x3b0e13[_0x6cab('0x2')]('user-setting:update:user-'+_0x19a2a1[_0x6cab('0x4')],_0x19a2a1);}};}exports['register']=function(_0x2d8842){for(var _0x195c4b=0x0,_0x35ffd3=events[_0x6cab('0x5')];_0x195c4b<_0x35ffd3;_0x195c4b++){var _0x49e6f3=events[_0x195c4b];var _0xffb1e9=createListener(_0x6cab('0x6')+_0x49e6f3,_0x2d8842);UserSettingEvents['on'](_0x49e6f3,_0xffb1e9);}}; \ No newline at end of file +var _0x8e2b=['remove','update','emit','user-setting:update','UserId','length','user-setting:','./user-setting.events'];(function(_0x11f211,_0x5e2dfb){var _0x29f90b=function(_0x32e42c){while(--_0x32e42c){_0x11f211['push'](_0x11f211['shift']());}};_0x29f90b(++_0x5e2dfb);}(_0x8e2b,0x1d7));var _0xb8e2=function(_0x409eb3,_0x721b42){_0x409eb3=_0x409eb3-0x0;var _0x31d0d9=_0x8e2b[_0x409eb3];return _0x31d0d9;};'use strict';var UserSettingEvents=require(_0xb8e2('0x0'));var events=['save',_0xb8e2('0x1'),_0xb8e2('0x2')];function createListener(_0x46e1a1,_0x15ffde){return function(_0x53a261){_0x15ffde[_0xb8e2('0x3')](_0x46e1a1,_0x53a261);if(_0x46e1a1===_0xb8e2('0x4')){_0x15ffde[_0xb8e2('0x3')]('user-setting:update:user-'+_0x53a261[_0xb8e2('0x5')],_0x53a261);}};}exports['register']=function(_0x5d40f6){for(var _0x109da1=0x0,_0xbcf2f3=events[_0xb8e2('0x6')];_0x109da1<_0xbcf2f3;_0x109da1++){var _0x285535=events[_0x109da1];var _0x293791=createListener(_0xb8e2('0x7')+_0x285535,_0x5d40f6);UserSettingEvents['on'](_0x285535,_0x293791);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 22104f1..ea48286 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 _0xe11f=['/:id/api_key','removeApiKey','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/chat_websites','removeChatWebsites','removeSquareProjects'];(function(_0x140535,_0x375f02){var _0x297a72=function(_0x50f6b5){while(--_0x50f6b5){_0x140535['push'](_0x140535['shift']());}};_0x297a72(++_0x375f02);}(_0xe11f,0x152));var _0xfe11=function(_0x308982,_0x1ee045){_0x308982=_0x308982-0x0;var _0x3fb834=_0xe11f[_0x308982];return _0x3fb834;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe11('0x0'));var timeout=require('connect-timeout');var express=require(_0xfe11('0x1'));var router=express[_0xfe11('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfe11('0x3'));var interaction=require(_0xfe11('0x4'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xfe11('0x5')]('/',auth[_0xfe11('0x6')](),controller[_0xfe11('0x7')]);router[_0xfe11('0x5')](_0xfe11('0x8'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x9')]);router[_0xfe11('0x5')](_0xfe11('0xa'),auth[_0xfe11('0x6')](),controller['whoami']);router[_0xfe11('0x5')](_0xfe11('0xb'),auth[_0xfe11('0x6')](),controller[_0xfe11('0xc')]);router[_0xfe11('0x5')](_0xfe11('0xd'),auth[_0xfe11('0x6')](),controller[_0xfe11('0xe')]);router['get'](_0xfe11('0xf'),controller['getAvatar']);router['get'](_0xfe11('0x10'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x11')]);router['get']('/:id/contacts',auth[_0xfe11('0x6')](),controller[_0xfe11('0x12')]);router['get']('/:id/queues',auth[_0xfe11('0x6')](),controller['getQueues']);router[_0xfe11('0x5')](_0xfe11('0x13'),auth['isAuthenticated'](),controller[_0xfe11('0x14')]);router[_0xfe11('0x5')]('/:id/groups',auth['isAuthenticated'](),controller[_0xfe11('0x15')]);router[_0xfe11('0x5')](_0xfe11('0x16'),auth[_0xfe11('0x6')](),controller['getRecordings']);router[_0xfe11('0x5')](_0xfe11('0x17'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x18')]);router[_0xfe11('0x5')](_0xfe11('0x19'),auth[_0xfe11('0x6')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth[_0xfe11('0x6')](),controller['getOpenchannelInteractions']);router[_0xfe11('0x5')]('/:id/mail/interactions',auth[_0xfe11('0x6')](),controller[_0xfe11('0x1a')]);router['get'](_0xfe11('0x1b'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x1c')]);router['get'](_0xfe11('0x1d'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xfe11('0x5')](_0xfe11('0x1e'),auth[_0xfe11('0x6')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0xfe11('0x6')](),controller[_0xfe11('0x1f')]);router['get'](_0xfe11('0x20'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x21')]);router[_0xfe11('0x5')](_0xfe11('0x22'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x23')]);router['get'](_0xfe11('0x24'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x25')]);router[_0xfe11('0x5')]('/:id/fax_accounts',auth[_0xfe11('0x6')](),controller[_0xfe11('0x26')]);router[_0xfe11('0x5')](_0xfe11('0x27'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x28')]);router['get'](_0xfe11('0x29'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x2a')]);router[_0xfe11('0x5')](_0xfe11('0x2b'),auth['isAuthenticated'](),controller[_0xfe11('0x2c')]);router[_0xfe11('0x5')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xfe11('0x5')](_0xfe11('0x2d'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x2e')]);router[_0xfe11('0x5')]('/:id/square_projects',auth[_0xfe11('0x6')](),controller[_0xfe11('0x2f')]);router[_0xfe11('0x5')](_0xfe11('0x30'),auth['isAuthenticated'](),controller[_0xfe11('0x31')]);router[_0xfe11('0x5')]('/:id/api_key',auth[_0xfe11('0x6')](),controller[_0xfe11('0x32')]);router[_0xfe11('0x33')](_0xfe11('0x34'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x35')]);router[_0xfe11('0x33')]('/',auth[_0xfe11('0x6')](),controller[_0xfe11('0x36')]);router[_0xfe11('0x33')](_0xfe11('0x37'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x38')]);router[_0xfe11('0x33')](_0xfe11('0x39'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x3a')]);var upload=multer({'storage':multer[_0xfe11('0x3b')]({'destination':function(_0x5149c6,_0x19f5d3,_0x39902c){_0x39902c(null,path['join'](config[_0xfe11('0x3c')],'server/files/images/'));},'filename':function(_0x53776f,_0x3c5597,_0x7aff89){_0x7aff89(null,util[_0xfe11('0x3d')](_0xfe11('0x3e'),Date[_0xfe11('0x3f')](),_0x3c5597[_0xfe11('0x40')]));}})});router[_0xfe11('0x33')]('/:id/avatar',upload['single'](_0xfe11('0x41')),controller[_0xfe11('0x42')]);router[_0xfe11('0x33')](_0xfe11('0x43'),auth['isAuthenticated'](),controller[_0xfe11('0x44')]);router['post'](_0xfe11('0x45'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x46')]);router['post'](_0xfe11('0x47'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x48')]);router[_0xfe11('0x33')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xfe11('0x49')]);router[_0xfe11('0x33')](_0xfe11('0x4a'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x4b')]);router[_0xfe11('0x33')]('/:id/chat_interactions',auth[_0xfe11('0x6')](),controller[_0xfe11('0x4c')]);router['post']('/:id/mail_interactions',auth[_0xfe11('0x6')](),controller[_0xfe11('0x4d')]);router[_0xfe11('0x33')](_0xfe11('0x4e'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x4f')]);router[_0xfe11('0x33')](_0xfe11('0x50'),auth['isAuthenticated'](),controller[_0xfe11('0x51')]);router['post']('/:id/openchannel_interactions',auth[_0xfe11('0x6')](),controller['addOpenchannelInteractions']);router[_0xfe11('0x33')](_0xfe11('0x52'),auth['isAuthenticated'](),controller[_0xfe11('0x53')]);router[_0xfe11('0x33')](_0xfe11('0x54'),auth[_0xfe11('0x6')](),controller['addFaxAccounts']);router[_0xfe11('0x33')](_0xfe11('0x27'),auth[_0xfe11('0x6')](),controller['addMailAccounts']);router[_0xfe11('0x33')](_0xfe11('0x29'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x55')]);router[_0xfe11('0x33')](_0xfe11('0x2b'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x56')]);router[_0xfe11('0x33')]('/:id/chat_websites',auth[_0xfe11('0x6')](),controller['addChatWebsites']);router[_0xfe11('0x33')](_0xfe11('0x2d'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x57')]);router['post'](_0xfe11('0x58'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x59')]);router[_0xfe11('0x33')]('/:id/api_key',auth[_0xfe11('0x6')](),controller[_0xfe11('0x5a')]);router[_0xfe11('0x5b')](_0xfe11('0xd'),auth['isAuthenticated'](),controller[_0xfe11('0x5c')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0xfe11('0x5d')]);router[_0xfe11('0x5e')]('/:id/queues',auth[_0xfe11('0x6')](),controller[_0xfe11('0x5f')]);router[_0xfe11('0x5e')](_0xfe11('0x4a'),auth[_0xfe11('0x6')](),controller['removeTeams']);router[_0xfe11('0x5e')](_0xfe11('0xd'),auth['isAuthenticated'](),controller[_0xfe11('0x60')]);router[_0xfe11('0x5e')](_0xfe11('0x61'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x62')]);router[_0xfe11('0x5e')](_0xfe11('0x63'),auth['isAuthenticated'](),controller[_0xfe11('0x64')]);router[_0xfe11('0x5e')](_0xfe11('0x4e'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x65')]);router[_0xfe11('0x5e')](_0xfe11('0x50'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x66')]);router[_0xfe11('0x5e')](_0xfe11('0x67'),auth[_0xfe11('0x6')](),controller['removeOpenchannelInteractions']);router[_0xfe11('0x5e')]('/:id/whatsapp_interactions',auth[_0xfe11('0x6')](),controller['removeWhatsappInteractions']);router[_0xfe11('0x5e')](_0xfe11('0x54'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x68')]);router[_0xfe11('0x5e')](_0xfe11('0x27'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x69')]);router['delete'](_0xfe11('0x29'),auth['isAuthenticated'](),controller[_0xfe11('0x6a')]);router['delete'](_0xfe11('0x2b'),auth[_0xfe11('0x6')](),controller['removeSmsAccounts']);router[_0xfe11('0x5e')](_0xfe11('0x6b'),auth['isAuthenticated'](),controller[_0xfe11('0x6c')]);router[_0xfe11('0x5e')]('/:id/whatsapp_accounts',auth[_0xfe11('0x6')](),controller['removeWhatsappAccounts']);router[_0xfe11('0x5e')](_0xfe11('0x58'),auth[_0xfe11('0x6')](),controller[_0xfe11('0x6d')]);router[_0xfe11('0x5e')](_0xfe11('0x6e'),auth['isAuthenticated'](),controller[_0xfe11('0x6f')]);module['exports']=router; \ No newline at end of file +var _0x52e4=['getContacts','/:id/queues','getQueues','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','join','root','format','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs'];(function(_0x46eebd,_0x92cdd0){var _0x376342=function(_0x398130){while(--_0x398130){_0x46eebd['push'](_0x46eebd['shift']());}};_0x376342(++_0x92cdd0);}(_0x52e4,0x19c));var _0x452e=function(_0x193602,_0x57b52b){_0x193602=_0x193602-0x0;var _0x975e3f=_0x52e4[_0x193602];return _0x975e3f;};'use strict';var multer=require(_0x452e('0x0'));var util=require(_0x452e('0x1'));var path=require(_0x452e('0x2'));var timeout=require(_0x452e('0x3'));var express=require(_0x452e('0x4'));var router=express[_0x452e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x452e('0x6'));var interaction=require(_0x452e('0x7'));var config=require(_0x452e('0x8'));var controller=require(_0x452e('0x9'));router[_0x452e('0xa')]('/',auth[_0x452e('0xb')](),controller['index']);router[_0x452e('0xa')](_0x452e('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/whoami',auth[_0x452e('0xb')](),controller[_0x452e('0xd')]);router[_0x452e('0xa')](_0x452e('0xe'),auth['isAuthenticated'](),controller[_0x452e('0xf')]);router[_0x452e('0xa')](_0x452e('0x10'),auth['isAuthenticated'](),controller[_0x452e('0x11')]);router[_0x452e('0xa')]('/:id/avatar',controller[_0x452e('0x12')]);router[_0x452e('0xa')]('/:id/open_tabs',auth[_0x452e('0xb')](),controller[_0x452e('0x13')]);router['get']('/:id/contacts',auth[_0x452e('0xb')](),controller[_0x452e('0x14')]);router['get'](_0x452e('0x15'),auth[_0x452e('0xb')](),controller[_0x452e('0x16')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x452e('0x17'),auth[_0x452e('0xb')](),controller[_0x452e('0x18')]);router[_0x452e('0xa')]('/:id/screen_recordings',auth[_0x452e('0xb')](),controller[_0x452e('0x19')]);router['get'](_0x452e('0x1a'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x452e('0xa')](_0x452e('0x1b'),auth[_0x452e('0xb')](),controller['getOpenchannelInteractions']);router[_0x452e('0xa')]('/:id/mail/interactions',auth[_0x452e('0xb')](),controller[_0x452e('0x1c')]);router['get']('/:id/sms/interactions',auth[_0x452e('0xb')](),controller[_0x452e('0x1d')]);router[_0x452e('0xa')](_0x452e('0x1e'),auth['isAuthenticated'](),controller[_0x452e('0x1f')]);router[_0x452e('0xa')](_0x452e('0x20'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0x452e('0xb')](),controller[_0x452e('0x21')]);router['get'](_0x452e('0x22'),auth['isAuthenticated'](),controller[_0x452e('0x23')]);router[_0x452e('0xa')](_0x452e('0x24'),auth[_0x452e('0xb')](),controller['getAgents']);router[_0x452e('0xa')](_0x452e('0x25'),auth[_0x452e('0xb')](),controller[_0x452e('0x26')]);router[_0x452e('0xa')]('/:id/fax_accounts',auth[_0x452e('0xb')](),controller[_0x452e('0x27')]);router[_0x452e('0xa')]('/:id/mail_accounts',auth[_0x452e('0xb')](),controller[_0x452e('0x28')]);router[_0x452e('0xa')]('/:id/openchannel_accounts',auth[_0x452e('0xb')](),controller[_0x452e('0x29')]);router[_0x452e('0xa')](_0x452e('0x2a'),auth[_0x452e('0xb')](),controller[_0x452e('0x2b')]);router[_0x452e('0xa')](_0x452e('0x2c'),auth[_0x452e('0xb')](),controller['getChatWebsites']);router[_0x452e('0xa')](_0x452e('0x2d'),auth[_0x452e('0xb')](),controller[_0x452e('0x2e')]);router[_0x452e('0xa')]('/:id/square_projects',auth[_0x452e('0xb')](),controller[_0x452e('0x2f')]);router['get']('/:id/scheduled_calls',auth[_0x452e('0xb')](),controller[_0x452e('0x30')]);router[_0x452e('0xa')](_0x452e('0x31'),auth[_0x452e('0xb')](),controller[_0x452e('0x32')]);router[_0x452e('0x33')]('/:id/contacts',auth[_0x452e('0xb')](),controller[_0x452e('0x34')]);router[_0x452e('0x33')]('/',auth['isAuthenticated'](),controller['create']);router[_0x452e('0x33')](_0x452e('0x35'),auth['isAuthenticated'](),controller[_0x452e('0x36')]);router[_0x452e('0x33')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x452e('0x37')]({'destination':function(_0x59d29e,_0x4335b5,_0x47bf62){_0x47bf62(null,path[_0x452e('0x38')](config[_0x452e('0x39')],'server/files/images/'));},'filename':function(_0x5a6e17,_0x1cefd6,_0x1ce44f){_0x1ce44f(null,util[_0x452e('0x3a')]('%s-%s',Date[_0x452e('0x3b')](),_0x1cefd6[_0x452e('0x3c')]));}})});router[_0x452e('0x33')](_0x452e('0x3d'),upload[_0x452e('0x3e')](_0x452e('0x3f')),controller[_0x452e('0x40')]);router[_0x452e('0x33')](_0x452e('0x41'),auth[_0x452e('0xb')](),controller[_0x452e('0x42')]);router[_0x452e('0x33')]('/:id/logout',auth[_0x452e('0xb')](),controller['logout']);router['post'](_0x452e('0x43'),auth['isAuthenticated'](),controller['pause']);router[_0x452e('0x33')](_0x452e('0x44'),auth[_0x452e('0xb')](),controller[_0x452e('0x45')]);router[_0x452e('0x33')](_0x452e('0x46'),auth[_0x452e('0xb')](),controller[_0x452e('0x47')]);router[_0x452e('0x33')](_0x452e('0x48'),auth['isAuthenticated'](),controller[_0x452e('0x49')]);router[_0x452e('0x33')](_0x452e('0x4a'),auth[_0x452e('0xb')](),controller[_0x452e('0x4b')]);router[_0x452e('0x33')](_0x452e('0x4c'),auth[_0x452e('0xb')](),controller['addFaxInteractions']);router[_0x452e('0x33')](_0x452e('0x4d'),auth[_0x452e('0xb')](),controller['addSmsInteractions']);router['post'](_0x452e('0x4e'),auth[_0x452e('0xb')](),controller['addOpenchannelInteractions']);router['post'](_0x452e('0x4f'),auth[_0x452e('0xb')](),controller['addWhatsappInteractions']);router['post'](_0x452e('0x50'),auth[_0x452e('0xb')](),controller[_0x452e('0x51')]);router[_0x452e('0x33')](_0x452e('0x52'),auth[_0x452e('0xb')](),controller[_0x452e('0x53')]);router[_0x452e('0x33')](_0x452e('0x54'),auth[_0x452e('0xb')](),controller[_0x452e('0x55')]);router['post']('/:id/sms_accounts',auth[_0x452e('0xb')](),controller[_0x452e('0x56')]);router['post'](_0x452e('0x2c'),auth['isAuthenticated'](),controller[_0x452e('0x57')]);router[_0x452e('0x33')](_0x452e('0x2d'),auth[_0x452e('0xb')](),controller[_0x452e('0x58')]);router[_0x452e('0x33')](_0x452e('0x59'),auth['isAuthenticated'](),controller[_0x452e('0x5a')]);router[_0x452e('0x33')](_0x452e('0x31'),auth[_0x452e('0xb')](),controller[_0x452e('0x5b')]);router['put'](_0x452e('0x10'),auth[_0x452e('0xb')](),controller['update']);router[_0x452e('0x5c')](_0x452e('0x5d'),auth[_0x452e('0xb')](),controller[_0x452e('0x5e')]);router['delete']('/:id/queues',auth[_0x452e('0xb')](),controller[_0x452e('0x5f')]);router[_0x452e('0x60')](_0x452e('0x46'),auth[_0x452e('0xb')](),controller[_0x452e('0x61')]);router['delete']('/:id',auth[_0x452e('0xb')](),controller['destroy']);router['delete'](_0x452e('0x48'),auth[_0x452e('0xb')](),controller[_0x452e('0x62')]);router[_0x452e('0x60')]('/:id/mail_interactions',auth[_0x452e('0xb')](),controller['removeMailInteractions']);router[_0x452e('0x60')]('/:id/fax_interactions',auth[_0x452e('0xb')](),controller[_0x452e('0x63')]);router['delete'](_0x452e('0x4d'),auth[_0x452e('0xb')](),controller[_0x452e('0x64')]);router[_0x452e('0x60')](_0x452e('0x4e'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x452e('0x60')](_0x452e('0x4f'),auth['isAuthenticated'](),controller[_0x452e('0x65')]);router[_0x452e('0x60')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0x452e('0xb')](),controller[_0x452e('0x66')]);router[_0x452e('0x60')](_0x452e('0x54'),auth[_0x452e('0xb')](),controller[_0x452e('0x67')]);router[_0x452e('0x60')](_0x452e('0x2a'),auth[_0x452e('0xb')](),controller[_0x452e('0x68')]);router[_0x452e('0x60')](_0x452e('0x2c'),auth[_0x452e('0xb')](),controller[_0x452e('0x69')]);router[_0x452e('0x60')]('/:id/whatsapp_accounts',auth[_0x452e('0xb')](),controller['removeWhatsappAccounts']);router[_0x452e('0x60')](_0x452e('0x59'),auth[_0x452e('0xb')](),controller[_0x452e('0x6a')]);router['delete'](_0x452e('0x31'),auth[_0x452e('0xb')](),controller['removeApiKey']);module[_0x452e('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f76c65f..84affaf 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 _0xbc22=['accept','refuse','uas','fingerprint','certificate','active','nonat','update,nonat','TEXT','showWebBar','get','isArray','udp','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','wss','dtlsenable','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','defaultuser','STRING','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','INTEGER','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xbc22,0x182));var _0x2bc2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc22[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2bc2('0x0'));var moment=require(_0x2bc2('0x1'));var util=require(_0x2bc2('0x2'));var _=require(_0x2bc2('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2bc2('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5be216){this['setDataValue'](_0x2bc2('0x4'),_0x5be216);this[_0x2bc2('0x5')](_0x2bc2('0x6'),_0x5be216);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':![],'set':function(_0x3e5a8e){this[_0x2bc2('0x5')](_0x2bc2('0x8'),_0x3e5a8e);this['setDataValue']('callerid',util[_0x2bc2('0x9')](_0x2bc2('0xa'),_0x3e5a8e,this[_0x2bc2('0xb')](_0x2bc2('0xc'))));}},'alias':{'type':Sequelize[_0x2bc2('0x7')]},'email':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':![],'unique':_0x2bc2('0xd'),'validate':{'isEmail':!![]},'set':function(_0x544c9d){if(_0x544c9d){this[_0x2bc2('0x5')](_0x2bc2('0xd'),_0x544c9d['toLowerCase']());}}},'role':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0xf'),_0x2bc2('0x10'),_0x2bc2('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':![],'unique':_0x2bc2('0xc'),'set':function(_0xadf5a9){this[_0x2bc2('0x5')]('internal',_0xadf5a9);this['setDataValue'](_0x2bc2('0x13'),_0xadf5a9);this[_0x2bc2('0x5')](_0x2bc2('0x14'),util[_0x2bc2('0x9')](_0x2bc2('0xa'),this[_0x2bc2('0xb')](_0x2bc2('0x8')),_0xadf5a9));}},'salt':{'type':Sequelize[_0x2bc2('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x2bc2('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x2bc2('0x7')]},'userpic':{'type':Sequelize[_0x2bc2('0x7')]},'city':{'type':Sequelize[_0x2bc2('0x7')]},'country':{'type':Sequelize[_0x2bc2('0x7')]},'online':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2bc2('0x16')]},'voicePause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x2bc2('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2bc2('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x18'),_0x2bc2('0x10'),_0x2bc2('0x19')),'allowNull':!![],'defaultValue':_0x2bc2('0x18')},'context':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![],'defaultValue':_0x2bc2('0x1a')},'callingpres':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x1b'),_0x2bc2('0x1c'),'ALLOWED_FAILED_SCREEN',_0x2bc2('0x1d'),'PROHIB_NOT_SCREENED',_0x2bc2('0x1e'),_0x2bc2('0x1f'),_0x2bc2('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1dbbaa){this[_0x2bc2('0x5')](_0x2bc2('0x21'),_0x1dbbaa?_0x1dbbaa[_0x2bc2('0x22')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x2bc2('0xb')](_0x2bc2('0x21'))[_0x2bc2('0x23')](','):null;},'comment':_0x2bc2('0x24')},'dtmfmode':{'type':Sequelize[_0x2bc2('0xe')]('rfc2833',_0x2bc2('0x25'),_0x2bc2('0x26'),_0x2bc2('0x27'),_0x2bc2('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no','nonat',_0x2bc2('0x2a'),_0x2bc2('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![],'defaultValue':_0x2bc2('0x2c'),'set':function(_0xb96bc){this['setDataValue'](_0x2bc2('0x2d'),_0xb96bc?_0xb96bc[_0x2bc2('0x22')](','):null);},'get':function(){return this[_0x2bc2('0xb')](_0x2bc2('0x2d'))?this['getDataValue'](_0x2bc2('0x2d'))[_0x2bc2('0x23')](','):null;},'comment':_0x2bc2('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2bc2('0x7')]},'pickupgroup':{'type':Sequelize[_0x2bc2('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x2bc2('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2bc2('0x7')]},'disallow':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':![],'defaultValue':_0x2bc2('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3a2506){this['setDataValue'](_0x2bc2('0x30'),_0x3a2506?_0x3a2506[_0x2bc2('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this[_0x2bc2('0xb')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x2bc2('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![],'set':function(_0x46dd9f){this[_0x2bc2('0x5')](_0x2bc2('0x31'),_0x46dd9f?_0x46dd9f[_0x2bc2('0x22')](','):null);},'get':function(){return this[_0x2bc2('0xb')](_0x2bc2('0x31'))?this[_0x2bc2('0xb')](_0x2bc2('0x31'))[_0x2bc2('0x23')](','):null;},'comment':_0x2bc2('0x32')},'trustrpid':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2bc2('0x29'),'no',_0x2bc2('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![],'defaultValue':_0x2bc2('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':_0x2bc2('0x29')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2bc2('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2bc2('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2bc2('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2bc2('0xe')]('yes','no',_0x2bc2('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x36'),_0x2bc2('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2bc2('0xe')]('uac','uas'),'allowNull':!![],'defaultValue':_0x2bc2('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x2bc2('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2bc2('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2bc2('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no',_0x2bc2('0x39'),_0x2bc2('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x3b'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2bc2('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2bc2('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2bc2('0x29'),'no',_0x2bc2('0x3c'),'update',_0x2bc2('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2bc2('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x2bc2('0x16')]},'passwordResetAt':{'type':Sequelize[_0x2bc2('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2bc2('0x3e')]},'showWebBar':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0,'set':function(_0x577828){this['setDataValue'](_0x2bc2('0x3f'),_0x577828);var _0x9645f6=this[_0x2bc2('0x40')]({'plain':!![]});switch(_0x577828){case 0x0:case 0x1:var _0x399983=_0x9645f6[_0x2bc2('0x21')]?_[_0x2bc2('0x41')](_0x9645f6[_0x2bc2('0x21')])?_0x9645f6[_0x2bc2('0x21')][_0x2bc2('0x22')]():_0x9645f6[_0x2bc2('0x21')]:_0x2bc2('0x42');if(_0x399983==='wss'){_0x399983=_0x2bc2('0x42');}this[_0x2bc2('0x5')](_0x2bc2('0x21'),_0x399983);this['setDataValue'](_0x2bc2('0x43'),'no');this[_0x2bc2('0x5')](_0x2bc2('0x44'),null);this[_0x2bc2('0x5')](_0x2bc2('0x45'),null);this[_0x2bc2('0x5')](_0x2bc2('0x46'),null);this[_0x2bc2('0x5')]('dtlsenable',null);this[_0x2bc2('0x5')](_0x2bc2('0x47'),null);this[_0x2bc2('0x5')](_0x2bc2('0x48'),null);this['setDataValue']('dtlscertfile',null);this['setDataValue'](_0x2bc2('0x49'),null);this[_0x2bc2('0x5')]('rtcp_mux','no');break;case 0x2:this[_0x2bc2('0x5')]('transport',_0x2bc2('0x4a'));this[_0x2bc2('0x5')](_0x2bc2('0x43'),'yes');this['setDataValue'](_0x2bc2('0x44'),_0x2bc2('0x29'));this['setDataValue'](_0x2bc2('0x45'),_0x2bc2('0x29'));this[_0x2bc2('0x5')](_0x2bc2('0x46'),'yes');this['setDataValue'](_0x2bc2('0x4b'),_0x2bc2('0x29'));this[_0x2bc2('0x5')]('dtlsverify','no');this[_0x2bc2('0x5')](_0x2bc2('0x48'),_0x2bc2('0x4c'));this[_0x2bc2('0x5')](_0x2bc2('0x4d'),_0x9645f6['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x2bc2('0x5')](_0x2bc2('0x49'),_0x9645f6[_0x2bc2('0x49')]||_0x2bc2('0x4e'));this[_0x2bc2('0x5')]('rtcp_mux',_0x2bc2('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x2bc2('0x3e')],'set':function(_0x180c2c){this[_0x2bc2('0x5')](_0x2bc2('0x4f'),_0x180c2c?_0x180c2c[_0x2bc2('0x22')](','):[]);},'get':function(){return this[_0x2bc2('0xb')](_0x2bc2('0x4f'))?_[_0x2bc2('0x50')](this[_0x2bc2('0xb')](_0x2bc2('0x4f'))[_0x2bc2('0x23')](','),function(_0x4bbac1){return parseInt(_0x4bbac1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2bc2('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2bc2('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2bc2('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2bc2('0xe')](_0x2bc2('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2bc2('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2bc2('0x51')],'get':function(){return this[_0x2bc2('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x2bc2('0xb')](_0x2bc2('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2bc2('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2bc2('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xbc77af){if(typeof _0xbc77af===_0x2bc2('0x53')){var _0xfa976b=_0xbc77af==='1'?!![]:_0xbc77af==='0'?![]:_0xbc77af==='true'?!![]:_0xbc77af===_0x2bc2('0x54')?![]:![];this['setDataValue']('screenrecording',_0xfa976b);}else{this[_0x2bc2('0x5')]('screenrecording',_0xbc77af);}}},'blocked':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![],'set':function(_0x287ce3){this['setDataValue']('blocked',_0x287ce3);if(_0x287ce3===!![]){this[_0x2bc2('0x5')](_0x2bc2('0x55'),moment());this[_0x2bc2('0x5')](_0x2bc2('0x56'),0x0);}else{this[_0x2bc2('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x2bc2('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2bc2('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2bc2('0x12')](0x5)[_0x2bc2('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2bc2('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xb7da=['setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','admin','user','telephone','local','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','rfc2833','info','shortinfo','inband','auto','yes','nat','split','all','ulaw;alaw;gsm','allow','join','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','refuse','uac','fingerprint','certificate','active','passive','actpass','nonat','update','update,nonat','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','exports','STRING','name'];(function(_0x517cae,_0x592f76){var _0x2d59b0=function(_0x49cd67){while(--_0x49cd67){_0x517cae['push'](_0x517cae['shift']());}};_0x2d59b0(++_0x592f76);}(_0xb7da,0x1f4));var _0xab7d=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0xb7da[_0x1597e2];return _0x4c8c0a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xab7d('0x0'));var util=require('util');var _=require('lodash');module[_0xab7d('0x1')]={'name':{'type':Sequelize[_0xab7d('0x2')],'allowNull':![],'unique':_0xab7d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e2ce6){this[_0xab7d('0x4')](_0xab7d('0x3'),_0x3e2ce6);this[_0xab7d('0x4')]('defaultuser',_0x3e2ce6);},'comment':_0xab7d('0x5')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x18e825){this[_0xab7d('0x4')](_0xab7d('0x6'),_0x18e825);this['setDataValue'](_0xab7d('0x7'),util[_0xab7d('0x8')]('\x22%s\x22\x20<%s>',_0x18e825,this['getDataValue'](_0xab7d('0x9'))));}},'alias':{'type':Sequelize[_0xab7d('0x2')]},'email':{'type':Sequelize[_0xab7d('0x2')],'allowNull':![],'unique':_0xab7d('0xa'),'validate':{'isEmail':!![]},'set':function(_0x188a59){if(_0x188a59){this[_0xab7d('0x4')](_0xab7d('0xa'),_0x188a59[_0xab7d('0xb')]());}}},'role':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0xd'),_0xab7d('0xe'),'agent',_0xab7d('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xab7d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xab7d('0x2')],'defaultValue':_0xab7d('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x42995f){this['setDataValue'](_0xab7d('0x9'),_0x42995f);this[_0xab7d('0x4')](_0xab7d('0x11'),_0x42995f);this[_0xab7d('0x4')](_0xab7d('0x7'),util['format'](_0xab7d('0x12'),this[_0xab7d('0x13')](_0xab7d('0x6')),_0x42995f));}},'salt':{'type':Sequelize[_0xab7d('0x2')]},'phone':{'type':Sequelize[_0xab7d('0x2')]},'mobile':{'type':Sequelize[_0xab7d('0x2')]},'address':{'type':Sequelize[_0xab7d('0x2')]},'zipcode':{'type':Sequelize[_0xab7d('0x2')]},'userpic':{'type':Sequelize[_0xab7d('0x2')]},'city':{'type':Sequelize[_0xab7d('0x2')]},'country':{'type':Sequelize[_0xab7d('0x2')]},'online':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xab7d('0x2')],'defaultValue':_0xab7d('0x15')},'lastPauseAt':{'type':Sequelize[_0xab7d('0x16')]},'chatCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xab7d('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xab7d('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![],'defaultValue':_0xab7d('0x18')},'ipaddr':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xab7d('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x19'),_0xab7d('0xe'),_0xab7d('0x1a')),'allowNull':!![],'defaultValue':_0xab7d('0x19')},'context':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xab7d('0xc')]('ALLOWED_NOT_SCREENED',_0xab7d('0x1b'),_0xab7d('0x1c'),'ALLOWED',_0xab7d('0x1d'),'PROHIB_PASSED_SCREEN',_0xab7d('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xab7d('0x1f'),'set':function(_0x510f68){this[_0xab7d('0x4')](_0xab7d('0x20'),_0x510f68?_0x510f68['join'](','):null);},'get':function(){return this['getDataValue'](_0xab7d('0x20'))?this[_0xab7d('0x13')]('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x21'),_0xab7d('0x22'),_0xab7d('0x23'),_0xab7d('0x24'),_0xab7d('0x25')),'allowNull':!![],'defaultValue':_0xab7d('0x21')},'directmedia':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no','nonat','update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x13fa1e){this[_0xab7d('0x4')](_0xab7d('0x27'),_0x13fa1e?_0x13fa1e['join'](','):null);},'get':function(){return this[_0xab7d('0x13')](_0xab7d('0x27'))?this[_0xab7d('0x13')]('nat')[_0xab7d('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xab7d('0x2')]},'namedcallgroup':{'type':Sequelize[_0xab7d('0x2')]},'pickupgroup':{'type':Sequelize[_0xab7d('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xab7d('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xab7d('0x2')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xab7d('0x29')},'allow':{'type':Sequelize[_0xab7d('0x2')],'allowNull':![],'defaultValue':_0xab7d('0x2a'),'set':function(_0x4405ec){this[_0xab7d('0x4')](_0xab7d('0x2b'),_0x4405ec?_0x4405ec[_0xab7d('0x2c')](';'):_0xab7d('0x2a'));},'get':function(){return this['getDataValue']('allow')?this[_0xab7d('0x13')](_0xab7d('0x2b'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![],'set':function(_0x1415ab){this[_0xab7d('0x4')]('insecure',_0x1415ab?_0x1415ab[_0xab7d('0x2c')](','):null);},'get':function(){return this[_0xab7d('0x13')]('insecure')?this[_0xab7d('0x13')](_0xab7d('0x2d'))[_0xab7d('0x28')](','):null;},'comment':_0xab7d('0x2e')},'trustrpid':{'type':Sequelize['ENUM'](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xab7d('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![],'defaultValue':_0xab7d('0x2f')},'amaflags':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':_0xab7d('0x26')},'busylevel':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xab7d('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xab7d('0xc')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no',_0xab7d('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xab7d('0x31'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x32'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':_0xab7d('0x26')},'keepalive':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xab7d('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xab7d('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xab7d('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xab7d('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xab7d('0xc')]('yes','no',_0xab7d('0x33'),_0xab7d('0x34')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x35'),_0xab7d('0x36'),_0xab7d('0x37')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no',_0xab7d('0x38'),_0xab7d('0x39'),_0xab7d('0x3a')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xab7d('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xab7d('0x16')]},'passwordResetAt':{'type':Sequelize[_0xab7d('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0,'set':function(_0x1b9e7a){this['setDataValue'](_0xab7d('0x3b'),_0x1b9e7a);var _0x439fa6=this[_0xab7d('0x3c')]({'plain':!![]});switch(_0x1b9e7a){case 0x0:case 0x1:var _0x3b0ec3=_0x439fa6[_0xab7d('0x20')]?_[_0xab7d('0x3d')](_0x439fa6['transport'])?_0x439fa6[_0xab7d('0x20')][_0xab7d('0x2c')]():_0x439fa6[_0xab7d('0x20')]:_0xab7d('0x1f');if(_0x3b0ec3==='wss'){_0x3b0ec3=_0xab7d('0x1f');}this['setDataValue'](_0xab7d('0x20'),_0x3b0ec3);this[_0xab7d('0x4')](_0xab7d('0x3e'),'no');this[_0xab7d('0x4')](_0xab7d('0x3f'),null);this['setDataValue'](_0xab7d('0x40'),null);this[_0xab7d('0x4')](_0xab7d('0x41'),null);this[_0xab7d('0x4')]('dtlsenable',null);this[_0xab7d('0x4')](_0xab7d('0x42'),null);this[_0xab7d('0x4')](_0xab7d('0x43'),null);this['setDataValue'](_0xab7d('0x44'),null);this[_0xab7d('0x4')](_0xab7d('0x45'),null);this['setDataValue'](_0xab7d('0x46'),'no');break;case 0x2:this[_0xab7d('0x4')](_0xab7d('0x20'),'wss');this[_0xab7d('0x4')](_0xab7d('0x3e'),_0xab7d('0x26'));this['setDataValue']('avpf',_0xab7d('0x26'));this[_0xab7d('0x4')](_0xab7d('0x40'),'yes');this[_0xab7d('0x4')](_0xab7d('0x41'),_0xab7d('0x26'));this[_0xab7d('0x4')](_0xab7d('0x47'),_0xab7d('0x26'));this[_0xab7d('0x4')](_0xab7d('0x42'),'no');this[_0xab7d('0x4')]('dtlssetup',_0xab7d('0x37'));this[_0xab7d('0x4')]('dtlscertfile',_0x439fa6[_0xab7d('0x44')]||_0xab7d('0x48'));this[_0xab7d('0x4')](_0xab7d('0x45'),_0x439fa6[_0xab7d('0x45')]||_0xab7d('0x49'));this[_0xab7d('0x4')](_0xab7d('0x46'),_0xab7d('0x26'));break;default:}}},'permissions':{'type':Sequelize[_0xab7d('0x4a')],'set':function(_0x1cfcd8){this['setDataValue'](_0xab7d('0x4b'),_0x1cfcd8?_0x1cfcd8[_0xab7d('0x2c')](','):[]);},'get':function(){return this['getDataValue'](_0xab7d('0x4b'))?_[_0xab7d('0x4c')](this[_0xab7d('0x13')](_0xab7d('0x4b'))['split'](','),function(_0x30c3b6){return parseInt(_0x30c3b6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xab7d('0x2')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xab7d('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xab7d('0xc')](_0xab7d('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xab7d('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xab7d('0x13')](_0xab7d('0x4d'))?this[_0xab7d('0x13')](_0xab7d('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xab7d('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![],'set':function(_0x2dbb37){if(typeof _0x2dbb37===_0xab7d('0x4e')){var _0x857e20=_0x2dbb37==='1'?!![]:_0x2dbb37==='0'?![]:_0x2dbb37==='true'?!![]:_0x2dbb37==='false'?![]:![];this[_0xab7d('0x4')]('screenrecording',_0x857e20);}else{this[_0xab7d('0x4')](_0xab7d('0x4f'),_0x2dbb37);}}},'blocked':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![],'set':function(_0x3045e0){this[_0xab7d('0x4')](_0xab7d('0x50'),_0x3045e0);if(_0x3045e0===!![]){this[_0xab7d('0x4')]('blockedAt',moment());this[_0xab7d('0x4')](_0xab7d('0x51'),0x0);}else{this['setDataValue'](_0xab7d('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xab7d('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xab7d('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xab7d('0x17')](0x5)[_0xab7d('0x53')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xab7d('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e4cbb68..ca73599 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 _0x7428=['106','107','108','109','100','111','114','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','each','UserProfileSection','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','online','interface','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','isArray','emit','Queue:remove','addAvatar','userpic','join','root','server/files/images/logos/default_profile.png','existsSync','download','getOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','findOne','order','sort','pick','options','CmList','List','Tag','Tags','tag','nolimit','Queue','Unknown\x20role','getVoiceQueuesRt','hasOwnProperty','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','bulkCreate','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','Pause','getTeams','Team','addTeams','omit','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$not','$notIn','$like','$notLike','$iLike','$notILike','$contained','$any','CmHopper','lastName','CmContact','Contact','dialActive','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','token','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','isEmpty','inbound','lower','col','toString','asc','desc','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unavailable','ringing','busy','toUpperCase','slice','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','../../components/parsers/qs','../../config/utils','../../mysqldb','socket.io-emitter','redis','./user.socket','register','client','http','then','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','info','result','catch','status','end','offset','limit','undefined','count','set','Content-Range','update','destroy','get','admin','Users','Agents','Telephones','telephone','filter','ignore','value','includes','find','role','name','UserProfileResource','sendStatus','stack','send','index','User','rawAttributes','map','type','key','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','fax','mail','whatsapp','all','show','params','model','differenceBy','keys','password','filters','intersection','fields','merge','sms','openchannel','body','describe','addContacts','ids','internal','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','102','103','113','110','104','105'];(function(_0x380697,_0xfc072e){var _0x280ec5=function(_0x14d4d3){while(--_0x14d4d3){_0x380697['push'](_0x380697['shift']());}};_0x280ec5(++_0xfc072e);}(_0x7428,0x126));var _0x8742=function(_0xee2e68,_0x280550){_0xee2e68=_0xee2e68-0x0;var _0x241e81=_0x7428[_0xee2e68];return _0x241e81;};'use strict';var moment=require(_0x8742('0x0'));var BPromise=require('bluebird');var util=require(_0x8742('0x1'));var path=require(_0x8742('0x2'));var fs=require('fs');var _=require(_0x8742('0x3'));var squel=require(_0x8742('0x4'));var jayson=require(_0x8742('0x5'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8742('0x6'));var logger=require('../../config/logger')('api');var utils=require(_0x8742('0x7'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8742('0x8'))['db'];var socket=require(_0x8742('0x9'))(new Redis(config[_0x8742('0xa')]));require(_0x8742('0xb'))[_0x8742('0xc')](socket);config[_0x8742('0xa')]=_['defaults'](config[_0x8742('0xa')],{'host':'localhost','port':0x18eb});var client=jayson[_0x8742('0xd')][_0x8742('0xe')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3b74c8,_0x3c6b9c,_0xfd3170,_0x13912b){return new BPromise(function(_0x1d3f04,_0x52ed80){var _0x2c016e=_0x13912b||client;return _0x2c016e['request'](_0x3b74c8,_0xfd3170)[_0x8742('0xf')](function(_0x2be790){logger['info']('User,\x20%s,\x20%s',_0x3c6b9c,_0x8742('0x10'));logger[_0x8742('0x11')](_0x8742('0x12'),_0x3c6b9c,_0x8742('0x10'),JSON['stringify'](_0x2be790));if(_0x2be790[_0x8742('0x13')]){if(_0x2be790[_0x8742('0x13')][_0x8742('0x14')]===0x1f4){logger[_0x8742('0x13')](_0x8742('0x15'),_0x3c6b9c,_0x2be790[_0x8742('0x13')][_0x8742('0x16')]);return _0x52ed80(_0x2be790[_0x8742('0x13')][_0x8742('0x16')]);}logger['error'](_0x8742('0x15'),_0x3c6b9c,_0x2be790[_0x8742('0x13')][_0x8742('0x16')]);return _0x1d3f04(_0x2be790['error'][_0x8742('0x16')]);}else{logger[_0x8742('0x17')](_0x8742('0x15'),_0x3c6b9c,'request\x20sent');_0x1d3f04(_0x2be790[_0x8742('0x18')]['message']);}})[_0x8742('0x19')](function(_0x3daf56){logger[_0x8742('0x13')]('User,\x20%s,\x20%s',_0x3c6b9c,_0x3daf56);_0x52ed80(_0x3daf56);});});}function respondWithStatusCode(_0x135b44,_0x122eca){_0x122eca=_0x122eca||0xcc;return function(_0x1ed518){if(_0x1ed518){return _0x135b44['sendStatus'](_0x122eca);}return _0x135b44[_0x8742('0x1a')](_0x122eca)[_0x8742('0x1b')]();};}function respondWithResult(_0x2dc874,_0x3e31ce){_0x3e31ce=_0x3e31ce||0xc8;return function(_0x1c7fbc){if(_0x1c7fbc){return _0x2dc874[_0x8742('0x1a')](_0x3e31ce)['json'](_0x1c7fbc);}};}function respondWithFilteredResult(_0x1b548f,_0x596e45){return function(_0x31b288){if(_0x31b288){var _0x1fdc90=typeof _0x596e45[_0x8742('0x1c')]==='undefined'&&typeof _0x596e45[_0x8742('0x1d')]===_0x8742('0x1e');var _0x1b9b3b=_0x31b288[_0x8742('0x1f')];var _0x25e361=_0x1fdc90?0x0:_0x596e45[_0x8742('0x1c')];var _0x112513=_0x1fdc90?_0x31b288[_0x8742('0x1f')]:_0x596e45[_0x8742('0x1c')]+_0x596e45[_0x8742('0x1d')];var _0x3809e5;if(_0x112513>=_0x1b9b3b){_0x112513=_0x1b9b3b;_0x3809e5=0xc8;}else{_0x3809e5=0xce;}_0x1b548f[_0x8742('0x1a')](_0x3809e5);return _0x1b548f[_0x8742('0x20')](_0x8742('0x21'),_0x25e361+'-'+_0x112513+'/'+_0x1b9b3b)['json'](_0x31b288);}return null;};}function saveUpdates(_0x625215){return function(_0x53b523){if(_0x53b523){return _0x53b523[_0x8742('0x22')](_0x625215)[_0x8742('0xf')](function(_0x1a5745){return _0x1a5745;});}return null;};}function removeEntity(_0x42b1cb){return function(_0x4418ba){if(_0x4418ba){return _0x4418ba[_0x8742('0x23')]()[_0x8742('0xf')](function(){var _0x14fded=_0x4418ba[_0x8742('0x24')]({'plain':!![]});if(_0x14fded['role']===_0x8742('0x25'))return;var _0x2474a5=[{'name':_0x8742('0x26'),'value':'user','ignore':!![]},{'name':_0x8742('0x27'),'value':'agent','ignore':![]},{'name':_0x8742('0x28'),'value':_0x8742('0x29'),'ignore':![]}];var _0xbe0f1e=_(_0x2474a5)[_0x8742('0x2a')](_0x8742('0x2b'))['map']('value')[_0x8742('0x2c')]();if(_[_0x8742('0x2d')](_0xbe0f1e,_0x14fded['role'])){return;}var _0x30f9fd=_[_0x8742('0x2e')](_0x2474a5,[_0x8742('0x2c'),_0x14fded[_0x8742('0x2f')]])[_0x8742('0x30')];return db[_0x8742('0x31')]['destroy']({'where':{'type':_0x30f9fd,'resourceId':_0x14fded['id']}})['then'](function(){return _0x4418ba;});})[_0x8742('0xf')](function(){_0x42b1cb[_0x8742('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdb18){return function(_0x30ec36){if(!_0x30ec36){_0x2fdb18[_0x8742('0x32')](0x194);}return _0x30ec36;};}function handleError(_0x398f93,_0x16a10c){_0x16a10c=_0x16a10c||0x1f4;return function(_0x1d5827){logger[_0x8742('0x13')](_0x1d5827[_0x8742('0x33')]);if(_0x1d5827[_0x8742('0x30')]){delete _0x1d5827['name'];}_0x398f93[_0x8742('0x1a')](_0x16a10c)[_0x8742('0x34')](_0x1d5827);};}exports[_0x8742('0x35')]=function(_0x71f59a,_0x519215){var _0x526c13={},_0x7e49d1={'count':0x0,'rows':[]};var _0x58c357=_(db[_0x8742('0x36')][_0x8742('0x37')])[_0x8742('0x38')](function(_0x2e9821){return{'name':_0x2e9821['fieldName'],'type':_0x2e9821[_0x8742('0x39')][_0x8742('0x3a')]};})['filter'](function(_0x26c30f){return!_[_0x8742('0x2d')](['password','salt'],_0x26c30f[_0x8742('0x30')]);})['value']();_0x526c13=qs['getOptions'](_0x58c357,_0x71f59a);var _0x36c8e0={'where':_0x526c13[_0x8742('0x3b')]};return db[_0x8742('0x36')][_0x8742('0x1f')](_0x36c8e0)['then'](function(_0x5015b5){_0x7e49d1['count']=_0x5015b5;if(_0x71f59a[_0x8742('0x3c')][_0x8742('0x3d')]){_0x526c13[_0x8742('0x3e')]=[{'all':!![]}];}if(_0x71f59a[_0x8742('0x3c')]['userSetting']===_0x8742('0x3f')){_0x526c13[_0x8742('0x3e')]=[{'model':db[_0x8742('0x40')],'as':_0x8742('0x41')}];}if(!_[_0x8742('0x2d')](_0x526c13['attributes'],'id')){_0x526c13[_0x8742('0x42')][_0x8742('0x43')]('id');}return db['User'][_0x8742('0x44')](_0x526c13);})['then'](function(_0x335974){_0x7e49d1[_0x8742('0x45')]=_0x335974;if(_0x71f59a['query'][_0x8742('0x46')]===_0x8742('0x3f')){var _0x494406=[];for(var _0x15e2d7=0x0;_0x15e2d7<_0x7e49d1[_0x8742('0x45')]['length'];_0x15e2d7++){_0x494406[_0x8742('0x43')](get_open_tabs(_0x8742('0x47'),_0x7e49d1[_0x8742('0x45')][_0x15e2d7][_0x8742('0x48')]));_0x494406[_0x8742('0x43')](get_open_tabs('sms',_0x7e49d1[_0x8742('0x45')][_0x15e2d7]['dataValues']));_0x494406[_0x8742('0x43')](get_open_tabs(_0x8742('0x49'),_0x7e49d1[_0x8742('0x45')][_0x15e2d7][_0x8742('0x48')]));_0x494406['push'](get_open_tabs(_0x8742('0x4a'),_0x7e49d1['rows'][_0x15e2d7][_0x8742('0x48')]));_0x494406[_0x8742('0x43')](get_open_tabs('openchannel',_0x7e49d1[_0x8742('0x45')][_0x15e2d7][_0x8742('0x48')]));_0x494406['push'](get_open_tabs(_0x8742('0x4b'),_0x7e49d1[_0x8742('0x45')][_0x15e2d7][_0x8742('0x48')]));}return BPromise[_0x8742('0x4c')](_0x494406)[_0x8742('0xf')](function(){return _0x7e49d1;});}else{return _0x7e49d1;}})[_0x8742('0xf')](respondWithFilteredResult(_0x519215,_0x526c13))['catch'](handleError(_0x519215,null));};exports[_0x8742('0x4d')]=function(_0x202020,_0x5c172b){var _0x653e37={'raw':![],'where':{'id':_0x202020[_0x8742('0x4e')]['id']}},_0x455928={};_0x455928[_0x8742('0x4f')]=_[_0x8742('0x50')](_[_0x8742('0x51')](db[_0x8742('0x36')]['rawAttributes']),[_0x8742('0x52'),'salt']);_0x455928[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x202020[_0x8742('0x3c')]);_0x455928[_0x8742('0x53')]=_['intersection'](_0x455928['model'],_0x455928[_0x8742('0x3c')]);_0x653e37['attributes']=_[_0x8742('0x54')](_0x455928[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x202020['query'][_0x8742('0x55')]));_0x653e37['attributes']=_0x653e37['attributes']['length']?_0x653e37[_0x8742('0x42')]:_0x455928[_0x8742('0x4f')];if(_0x202020['query'][_0x8742('0x3d')]){_0x653e37[_0x8742('0x3e')]=[{'all':!![]}];}if(_0x202020[_0x8742('0x3c')]['userSetting']===_0x8742('0x3f')){_0x653e37[_0x8742('0x3e')]=[{'model':db[_0x8742('0x40')],'as':'userSetting'}];}_0x653e37=_[_0x8742('0x56')]({},_0x653e37,_0x202020['options']);if(!_[_0x8742('0x2d')](_0x653e37['attributes'],'id')){_0x653e37[_0x8742('0x42')]['push']('id');}return db[_0x8742('0x36')]['find'](_0x653e37)[_0x8742('0xf')](handleEntityNotFound(_0x5c172b,null))[_0x8742('0xf')](function(_0x2a4663){var _0x54a117=[];values=_0x2a4663;if(_0x202020[_0x8742('0x3c')][_0x8742('0x46')]===_0x8742('0x3f')){_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x47'),_0x2a4663[_0x8742('0x48')]));_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x57'),_0x2a4663[_0x8742('0x48')]));_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x58'),_0x2a4663[_0x8742('0x48')]));_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x4b'),_0x2a4663[_0x8742('0x48')]));_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x49'),_0x2a4663[_0x8742('0x48')]));_0x54a117[_0x8742('0x43')](get_open_tabs(_0x8742('0x4a'),_0x2a4663[_0x8742('0x48')]));return BPromise[_0x8742('0x4c')](_0x54a117);}else{return values;}})[_0x8742('0xf')](function(){return values;})[_0x8742('0xf')](respondWithResult(_0x5c172b,null))[_0x8742('0x19')](handleError(_0x5c172b,null));};exports[_0x8742('0x22')]=function(_0x2eab74,_0x4fac61){if(_0x2eab74[_0x8742('0x59')]['id']){delete _0x2eab74[_0x8742('0x59')]['id'];}delete _0x2eab74[_0x8742('0x59')][_0x8742('0x2f')];return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x2eab74[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x4fac61,null))[_0x8742('0xf')](saveUpdates(_0x2eab74[_0x8742('0x59')],null))[_0x8742('0xf')](respondWithResult(_0x4fac61,null))[_0x8742('0x19')](handleError(_0x4fac61,null));};exports[_0x8742('0x5a')]=function(_0x3595a8,_0x4b2e32){return db[_0x8742('0x36')]['describe']()[_0x8742('0xf')](respondWithResult(_0x4b2e32,null))[_0x8742('0x19')](handleError(_0x4b2e32,null));};exports['addContacts']=function(_0x198550,_0x491d6a){return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x198550[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x491d6a,null))[_0x8742('0xf')](function(_0x3f13da){if(_0x3f13da){return _0x3f13da[_0x8742('0x5b')](_0x198550[_0x8742('0x59')][_0x8742('0x5c')],_['omit'](_0x198550[_0x8742('0x59')],[_0x8742('0x5c'),'id'])||{});}})[_0x8742('0xf')](respondWithResult(_0x491d6a,null))[_0x8742('0x19')](handleError(_0x491d6a,null));};function validateUser(_0xf34b7a){return new BPromise(function(_0x59dd73,_0xb1bdbd){if(_0xf34b7a[_0x8742('0x5d')])return _0x59dd73(_0xf34b7a);return db['Setting']['findById'](0x1)[_0x8742('0xf')](function(_0x5657fe){if(_0x5657fe[_0x8742('0x5e')])authService[_0x8742('0x5f')](_0xf34b7a[_0x8742('0x52')]);db['User'][_0x8742('0x60')](_0x8742('0x5d'))['then'](function(_0x5662a3){if(_[_0x8742('0x61')](_0x5662a3)){_0xf34b7a['internal']=_0x5657fe['min_internal']||0x1;return;}if(_[_0x8742('0x61')](_0x5657fe['min_internal'])||_0x5657fe[_0x8742('0x62')]===_0x5662a3){_0xf34b7a[_0x8742('0x5d')]=_0x5662a3+0x1;return;}if(_0x5657fe[_0x8742('0x62')]>_0x5662a3){_0xf34b7a[_0x8742('0x5d')]=_0x5657fe[_0x8742('0x62')];return;}return db[_0x8742('0x63')][_0x8742('0x3c')](_0x8742('0x64'),{'type':db[_0x8742('0x63')][_0x8742('0x65')][_0x8742('0x66')]})[_0x8742('0xf')](function(_0x21f8e8){if(_0x21f8e8&&_0x21f8e8[_0x8742('0x67')]){for(var _0x376f25=0x0,_0x3db2d4=_0x21f8e8[_0x8742('0x67')];_0x376f25<_0x3db2d4&&_['isNil'](_0xf34b7a[_0x8742('0x5d')]);_0x376f25++){if(_0x5657fe[_0x8742('0x62')]<=_0x21f8e8[_0x376f25][_0x8742('0x68')]){_0xf34b7a[_0x8742('0x5d')]=_0x21f8e8[_0x376f25]['from'];}else if(_0x5657fe[_0x8742('0x62')]>_0x21f8e8[_0x376f25][_0x8742('0x68')]&&_0x5657fe[_0x8742('0x62')]<=_0x21f8e8[_0x376f25]['to']){_0xf34b7a[_0x8742('0x5d')]=_0x5657fe['min_internal'];}}}if(_[_0x8742('0x61')](_0xf34b7a[_0x8742('0x5d')])){_0xf34b7a[_0x8742('0x5d')]=_0x5662a3+0x1;}return _0x59dd73(_0xf34b7a);});});})[_0x8742('0x19')](function(_0x4122bf){_0xb1bdbd(_0x4122bf);});});}function updateUser(_0x1a21ef){return new BPromise(function(_0x2104f2,_0x179dd5){try{if(_0x1a21ef[_0x8742('0x69')]){_0x1a21ef[_0x8742('0x6a')]=_0x1a21ef[_0x8742('0x5d')];_0x1a21ef[_0x8742('0x6b')]={'mailbox':_0x1a21ef[_0x8742('0x5d')],'password':_0x1a21ef[_0x8742('0x52')],'fullname':_0x1a21ef[_0x8742('0x6c')],'email':_0x1a21ef['email']};}if(_0x1a21ef['role']===_0x8742('0x6d')){if(!_0x1a21ef['permissions'])_0x1a21ef[_0x8742('0x6e')]=[_0x8742('0x6f'),_0x8742('0x70'),_0x8742('0x71'),_0x8742('0x72'),_0x8742('0x73'),_0x8742('0x74'),_0x8742('0x75'),_0x8742('0x76'),_0x8742('0x77'),_0x8742('0x78'),_0x8742('0x79'),_0x8742('0x7a'),_0x8742('0x7b'),_0x8742('0x7c'),'115'];}_0x2104f2(_0x1a21ef);}catch(_0x22d413){_0x179dd5(_0x22d413);}});}exports[_0x8742('0x7d')]=function(_0x523c64,_0x4794dc){if(_0x523c64[_0x8742('0x7e')][_0x8742('0x2f')]===_0x8742('0x6d'))throw new Error(_0x8742('0x7f'));if(_0x523c64[_0x8742('0x59')]['role']==='user'&&_0x523c64[_0x8742('0x7e')]['role']!==_0x8742('0x25')){throw new Error(_0x8742('0x80'));}if(_0x523c64[_0x8742('0x59')]['role']===_0x8742('0x25')&&_0x523c64[_0x8742('0x7e')][_0x8742('0x2f')]!=='admin'){throw new Error(_0x8742('0x81'));}return licenseUtil['checkUserLimits']([_0x523c64[_0x8742('0x59')]])[_0x8742('0xf')](function(){return validateUser(_0x523c64['body']);})['then'](function(_0x44e30d){return updateUser(_0x44e30d)['then'](function(_0x342ddc){if(_0x342ddc[_0x8742('0x2f')]===_0x8742('0x25')){_0x342ddc[_0x8742('0x82')]=_0x523c64[_0x8742('0x7e')][_0x8742('0x82')];delete _0x342ddc[_0x8742('0x83')];}return _0x342ddc;});})['then'](function(_0x274197){return db[_0x8742('0x36')][_0x8742('0x7d')](_0x274197,{'include':[{'model':db[_0x8742('0x6b')],'as':_0x8742('0x6b')}]});})[_0x8742('0xf')](function(_0x3290e5){if(_0x523c64['body'][_0x8742('0x2f')]==='user')return _0x3290e5;if(_0x523c64['user'][_0x8742('0x2f')]!==_0x8742('0x7e'))return _0x3290e5;return db['UserProfileSection'][_0x8742('0x2e')]({'where':{'name':_0x3290e5[_0x8742('0x2f')]===_0x8742('0x6d')?'Agents':_0x8742('0x28'),'userProfileId':_0x523c64[_0x8742('0x7e')]['userProfileId']},'raw':!![]})[_0x8742('0xf')](function(_0x2b793d){if(!_0x2b793d||_0x2b793d['autoAssociation']!=0x0)return _0x3290e5;return db['UserProfileResource'][_0x8742('0x7d')]({'name':_0x3290e5['name'],'resourceId':_0x3290e5['id'],'type':_0x2b793d['name'],'sectionId':_0x2b793d['id']},{})[_0x8742('0xf')](function(){return _0x3290e5;});})[_0x8742('0x19')](function(_0x4fbe06){logger['error'](_0x8742('0x84'),_0x4fbe06);throw _0x4fbe06;});})['then'](respondWithResult(_0x4794dc,0xc9))[_0x8742('0x19')](handleError(_0x4794dc,null));};exports['bulkCreate']=function(_0x94c25f,_0x1aa94a){var _0x377372=_0x94c25f[_0x8742('0x59')];var _0x337bf1=[];if(_0x94c25f['user'][_0x8742('0x2f')]===_0x8742('0x6d'))throw new Error(_0x8742('0x7f'));if(_[_0x8742('0x85')](_0x377372,[_0x8742('0x2f'),'user'])&&_0x94c25f[_0x8742('0x7e')][_0x8742('0x2f')]!==_0x8742('0x25')){throw new Error(_0x8742('0x80'));}if(_[_0x8742('0x85')](_0x377372,[_0x8742('0x2f'),_0x8742('0x25')])&&_0x94c25f[_0x8742('0x7e')][_0x8742('0x2f')]!==_0x8742('0x25')){throw new Error(_0x8742('0x86'));}return licenseUtil[_0x8742('0x87')](_0x377372)[_0x8742('0xf')](function(){return validateUser(_0x377372[0x0]);})[_0x8742('0xf')](function(){for(var _0x51f772=0x1;_0x51f772<_0x377372[_0x8742('0x67')];_0x51f772++){var _0xf06134=_0x377372[_0x51f772-0x1][_0x8742('0x5d')];if(!_0x377372[_0x51f772][_0x8742('0x5d')])_0x377372[_0x51f772]['internal']=_0xf06134+0x1;_0x337bf1[_0x8742('0x43')](validateUser(_0x377372[_0x51f772]));}return BPromise[_0x8742('0x4c')](_0x337bf1);})[_0x8742('0xf')](function(){_0x337bf1=[];for(var _0x3ff03c=0x0;_0x3ff03c<_0x377372['length'];_0x3ff03c++){_0x337bf1[_0x8742('0x43')](updateUser(_0x377372[_0x3ff03c]));}return BPromise['all'](_0x337bf1);})[_0x8742('0xf')](function(){return BPromise[_0x8742('0x88')](_0x377372,function(_0x2888a7){return db[_0x8742('0x36')][_0x8742('0x7d')](_0x2888a7,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x8742('0xf')](function(_0x16920d){_0x2888a7['id']=_0x16920d['id'];return _0x2888a7;});});})[_0x8742('0xf')](function(_0xe3b978){if(_0x94c25f[_0x8742('0x59')][_0x8742('0x2f')]===_0x8742('0x7e'))return _0xe3b978;if(_0x94c25f[_0x8742('0x7e')][_0x8742('0x2f')]!=='user')return _0xe3b978;var _0x58ab2a=_[_0x8742('0x85')](_0xe3b978,function(_0x41c833){return _0x41c833[_0x8742('0x2f')]===_0x8742('0x6d')||_0x41c833[_0x8742('0x2f')]===_0x8742('0x29');});if(!_0x58ab2a)return _0xe3b978;return db[_0x8742('0x89')][_0x8742('0x44')]({'where':{'name':{'$or':[_0x8742('0x27'),_0x8742('0x28')]},'userProfileId':_0x94c25f[_0x8742('0x7e')][_0x8742('0x83')]},'raw':!![]})[_0x8742('0xf')](function(_0x558634){if(_['isEmpty'](_0x558634)||!_[_0x8742('0x85')](_0x558634,[_0x8742('0x8a'),0x0]))return _0xe3b978;_0x337bf1=[];var _0x39dcd5=_(_0x558634)[_0x8742('0x38')](function(_0xa8270e){if(_0xa8270e[_0x8742('0x8a')]===0x1)return;return _0xa8270e['name']===_0x8742('0x27')?'agent':_0x8742('0x29');})[_0x8742('0x8b')]()[_0x8742('0x2c')]();for(var _0x3bc4ad=0x0;_0x3bc4ad<_0xe3b978[_0x8742('0x67')];_0x3bc4ad++){if(!_[_0x8742('0x2d')](_0x39dcd5,_0xe3b978[_0x3bc4ad][_0x8742('0x2f')]))return;var _0x487239=_0xe3b978[_0x3bc4ad]['role']===_0x8742('0x6d')?_0x8742('0x27'):_0x8742('0x28');_0x337bf1['push'](db[_0x8742('0x31')][_0x8742('0x7d')]({'name':_0xe3b978[_0x3bc4ad][_0x8742('0x30')],'resourceId':_0xe3b978[_0x3bc4ad]['id'],'type':_0x487239,'sectionId':_['find'](_0x558634,[_0x8742('0x30'),_0x487239])['id']},{}));}return BPromise['all'](_0x337bf1);});})['then'](respondWithResult(_0x1aa94a,0xc9))['catch'](handleError(_0x1aa94a,null));};exports[_0x8742('0x8c')]=function(_0xbcbc17,_0x13685d){if(_0xbcbc17['body']['id']){delete _0xbcbc17['body']['id'];}return db[_0x8742('0x36')]['find']({'where':{'id':_0xbcbc17[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](function(_0x3ec4cb){if(!_0x3ec4cb)return null;if(_0x3ec4cb['id']===_0xbcbc17['user']['id']){if(!_0xbcbc17[_0x8742('0x59')][_0x8742('0x8d')]||!_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')]){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x91'));}if(!_0x3ec4cb[_0x8742('0x92')](_0xbcbc17['body'][_0x8742('0x8d')])){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x93'));}if(_0xbcbc17[_0x8742('0x59')][_0x8742('0x8d')]===_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')]){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x94'));}}else if(_0xbcbc17[_0x8742('0x7e')]['role']==='admin'){if(!_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')]){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x95'));}}else if(_0xbcbc17['user'][_0x8742('0x2f')]===_0x8742('0x7e')){if(!_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')]){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x95'));}if(_0x3ec4cb[_0x8742('0x2f')]!==_0x8742('0x6d')){throw new db[(_0x8742('0x8f'))]['ValidationError'](_0x8742('0x7f'));}}else{throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))]('Unauthorized');}return _0x3ec4cb;})['then'](handleEntityNotFound(_0x13685d,null))[_0x8742('0xf')](function(_0x1e3c09){return db[_0x8742('0x96')]['findOne']({'attributes':['id',_0x8742('0x5e'),_0x8742('0x97'),_0x8742('0x98')]})[_0x8742('0xf')](function(_0x2df2d1){if(_0x2df2d1['securePassword'])authService[_0x8742('0x5f')](_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')]);if(!_0x2df2d1[_0x8742('0x97')]||!_0x1e3c09[_0x8742('0x99')])return _0x1e3c09;authService[_0x8742('0x9a')](_0xbcbc17[_0x8742('0x59')]['newPassword'],_0x1e3c09[_0x8742('0x99')],_0x2df2d1[_0x8742('0x98')]);return _0x1e3c09;})[_0x8742('0xf')](saveUpdates({'password':_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')],'passwordResetAt':_0xbcbc17[_0x8742('0x7e')]['id']==_0xbcbc17[_0x8742('0x4e')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xbcbc17[_0x8742('0x59')][_0x8742('0x8e')],_0x1e3c09[_0x8742('0x99')])},null));})['then'](respondWithResult(_0x13685d,null))[_0x8742('0x19')](handleError(_0x13685d,null));};exports[_0x8742('0x9b')]=function(_0x44a03a,_0x5beab1){var _0x1558ef=_0x44a03a['body'][_0x8742('0x9c')];return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x44a03a[_0x8742('0x4e')]['id']},'attributes':['id','name',_0x8742('0x2f'),_0x8742('0x9d'),'loginInPause','voicePause',_0x8742('0x9e')]})['then'](handleEntityNotFound(_0x5beab1,null))[_0x8742('0xf')](function(_0x1d9736){if(_0x1d9736){if(!utils['isValidChannel'](_0x1558ef)){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x9f'));}return _0x1d9736[_0x8742('0xa0')+_[_0x8742('0xa1')](_0x1558ef['toLowerCase']())+_0x8742('0xa2')](_0x44a03a['body'][_0x8742('0x5c')],{'penalty':_0x44a03a[_0x8742('0x59')][_0x8742('0xa3')]||0x0})[_0x8742('0xa4')](function(_0x2015cd){for(var _0x1e512b=0x0;_0x1e512b<_0x44a03a[_0x8742('0x59')]['ids'][_0x8742('0x67')];_0x1e512b+=0x1){var _0x2e75a9={'UserId':Number(_0x44a03a[_0x8742('0x4e')]['id'])};_0x2e75a9[_[_0x8742('0xa1')](_0x1558ef[_0x8742('0xa5')]())+_0x8742('0xa6')]=Number(_0x44a03a[_0x8742('0x59')][_0x8742('0x5c')][_0x1e512b]);socket['emit'](_0x8742('0x7e')+_['capitalize'](_0x1558ef[_0x8742('0xa5')]())+_0x8742('0xa7'),_0x2e75a9);}return _0x2015cd;})[_0x8742('0xf')](function(){if(_0x1558ef===_0x8742('0xa8')){return db[_0x8742('0xa9')][_0x8742('0x44')]({'where':{'id':_0x44a03a['body'][_0x8742('0x5c')]||[]},'raw':!![],'attributes':['id',_0x8742('0x30')]});}})['then'](function(_0x1d5aae){var _0x3c0495=_0x1d9736[_0x8742('0x24')]({'plain':!![]});var _0x2a2930=[];if(_0x1558ef===_0x8742('0xa8')&&_0x3c0495['role']===_0x8742('0x6d')&&_0x3c0495[_0x8742('0x9d')]){for(var _0x30619d=0x0;_0x30619d<_0x1d5aae['length'];_0x30619d+=0x1){_0x2a2930[_0x8742('0x43')]({'membername':_0x3c0495[_0x8742('0x30')],'UserId':_0x3c0495['id'],'queue_name':_0x1d5aae[_0x30619d][_0x8742('0x30')],'VoiceQueueId':_0x1d5aae[_0x30619d]['id'],'interface':_[_0x8742('0x61')](_0x3c0495[_0x8742('0x9e')])?util[_0x8742('0xaa')](_0x8742('0xab'),_0x3c0495[_0x8742('0x30')]):_0x3c0495[_0x8742('0x9e')],'paused':_0x3c0495[_0x8742('0xac')]||![],'penalty':_0x44a03a['body'][_0x8742('0xa3')]||0x0});}return BPromise[_0x8742('0x88')](_0x2a2930,function(_0x4e4754){return db[_0x8742('0xad')][_0x8742('0xae')](_0x4e4754);});}return _0x1d9736;});}})['then'](respondWithStatusCode(_0x5beab1,null))[_0x8742('0x19')](handleError(_0x5beab1,null));};exports[_0x8742('0xaf')]=function(_0x579a7e,_0x28fce8){var _0xb6de0c,_0x4f4037;return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x579a7e[_0x8742('0x4e')]['id']},'attributes':['id','name',_0x8742('0x2f')]})[_0x8742('0xf')](handleEntityNotFound(_0x28fce8,null))[_0x8742('0xf')](function(_0x53919c){if(_0x53919c){_0xb6de0c=_0x53919c;if(!_0x579a7e[_0x8742('0x3c')][_0x8742('0x9c')]||!utils[_0x8742('0xb0')](_0x579a7e[_0x8742('0x3c')][_0x8742('0x9c')])){throw new db[(_0x8742('0x8f'))]['ValidationError'](_0x8742('0x9f'));}return _0x53919c[_0x8742('0xb1')+_[_0x8742('0xa1')](_0x579a7e[_0x8742('0x3c')][_0x8742('0x9c')][_0x8742('0xa5')]())+_0x8742('0xa2')](_0x579a7e[_0x8742('0x3c')]['ids']);}})[_0x8742('0xf')](function(_0x5ced2e){if(_[_0x8742('0xb2')](_0x579a7e['query'][_0x8742('0x5c')])){for(var _0x36b2ad=0x0;_0x36b2ad<_0x579a7e['query'][_0x8742('0x5c')][_0x8742('0x67')];_0x36b2ad+=0x1){_0x4f4037={'UserId':Number(_0x579a7e['params']['id'])};_0x4f4037[_[_0x8742('0xa1')](_0x579a7e[_0x8742('0x3c')]['channel'][_0x8742('0xa5')]())+_0x8742('0xa6')]=Number(_0x579a7e[_0x8742('0x3c')][_0x8742('0x5c')][_0x36b2ad]);socket[_0x8742('0xb3')](_0x8742('0x7e')+_[_0x8742('0xa1')](_0x579a7e[_0x8742('0x3c')]['channel'][_0x8742('0xa5')]())+_0x8742('0xb4'),_0x4f4037);}}else{_0x4f4037={'UserId':Number(_0x579a7e[_0x8742('0x4e')]['id'])};_0x4f4037[_['capitalize'](_0x579a7e[_0x8742('0x3c')][_0x8742('0x9c')][_0x8742('0xa5')]())+_0x8742('0xa6')]=Number(_0x579a7e['query'][_0x8742('0x5c')]);socket[_0x8742('0xb3')](_0x8742('0x7e')+_[_0x8742('0xa1')](_0x579a7e[_0x8742('0x3c')]['channel'][_0x8742('0xa5')]())+_0x8742('0xb4'),_0x4f4037);}return _0x5ced2e;})[_0x8742('0xf')](function(){if(_0x579a7e[_0x8742('0x3c')][_0x8742('0x9c')]==='voice'){return db['UserVoiceQueueRt'][_0x8742('0x23')]({'where':{'UserId':_0x579a7e[_0x8742('0x4e')]['id'],'VoiceQueueId':_0x579a7e[_0x8742('0x3c')]['ids']},'individualHooks':!![]})['then'](function(){return _0xb6de0c;});}return _0xb6de0c;})[_0x8742('0xf')](respondWithStatusCode(_0x28fce8,null))[_0x8742('0x19')](handleError(_0x28fce8,null));};exports[_0x8742('0xb5')]=function(_0x1035ef,_0x220149){_0x1035ef[_0x8742('0x59')][_0x8742('0xb6')]=_0x1035ef['file']['filename'];return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x1035ef[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x220149,null))['then'](saveUpdates(_0x1035ef['body'],null))[_0x8742('0xf')](respondWithResult(_0x220149,null))['catch'](handleError(_0x220149,null));};exports['getAvatar']=function(_0x831528,_0x57248d){var _0x42ce13=path[_0x8742('0xb7')](config[_0x8742('0xb8')],_0x8742('0xb9'));return db[_0x8742('0x36')]['find']({'where':{'id':_0x831528[_0x8742('0x4e')]['id']},'attributes':['id',_0x8742('0xb6')],'raw':!![]})[_0x8742('0xf')](handleEntityNotFound(_0x57248d,null))[_0x8742('0xf')](function(_0x517b55){if(_0x517b55){if(_['isNil'](_0x517b55[_0x8742('0xb6')])){return _0x57248d['download'](_0x42ce13);}else{if(!fs[_0x8742('0xba')](path['join'](config['root'],'server/files/images/',_0x517b55[_0x8742('0xb6')]))){return _0x57248d[_0x8742('0xbb')](_0x42ce13);}return _0x57248d[_0x8742('0xbb')](path[_0x8742('0xb7')](config[_0x8742('0xb8')],'server/files/images/',_0x517b55[_0x8742('0xb6')]));}}})['catch'](handleError(_0x57248d,null));};exports[_0x8742('0xbc')]=function(_0x5839a0,_0xf112c){return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x5839a0['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xf112c,null))[_0x8742('0xf')](function(_0x8fd7e0){var _0x5f253a=[];values=_0x8fd7e0[_0x8742('0x48')];_0x5f253a['push'](get_open_tabs('chat',_0x8fd7e0[_0x8742('0x48')]));_0x5f253a[_0x8742('0x43')](get_open_tabs('sms',_0x8fd7e0['dataValues']));_0x5f253a[_0x8742('0x43')](get_open_tabs(_0x8742('0x58'),_0x8fd7e0[_0x8742('0x48')]));_0x5f253a[_0x8742('0x43')](get_open_tabs(_0x8742('0x4b'),_0x8fd7e0[_0x8742('0x48')]));_0x5f253a[_0x8742('0x43')](get_open_tabs(_0x8742('0x49'),_0x8fd7e0[_0x8742('0x48')]));_0x5f253a[_0x8742('0x43')](get_open_tabs(_0x8742('0x4a'),_0x8fd7e0[_0x8742('0x48')]));return BPromise[_0x8742('0x4c')](_0x5f253a);})[_0x8742('0xf')](function(_0x479e6a){if(_0x479e6a){var _0x76e4cb=_[_0x8742('0x38')](values['ChatOpenTabs'],function(_0x23b540){return{'channel':_0x8742('0xbd'),'id':_0x23b540['id'],'createdAt':_0x23b540['createdAt']};});var _0x1df0db=_[_0x8742('0x38')](values[_0x8742('0xbe')],function(_0x21e51a){return{'channel':_0x8742('0xbf'),'id':_0x21e51a['id'],'createdAt':_0x21e51a[_0x8742('0xc0')]};});var _0x3adb09=_[_0x8742('0x38')](values[_0x8742('0xc1')],function(_0x596c42){return{'channel':_0x8742('0xc2'),'id':_0x596c42['id'],'createdAt':_0x596c42[_0x8742('0xc0')]};});var _0x38eed9=_[_0x8742('0x38')](values[_0x8742('0xc3')],function(_0x2d84b7){return{'channel':_0x8742('0xc4'),'id':_0x2d84b7['id'],'createdAt':_0x2d84b7[_0x8742('0xc0')]};});var _0x59a2c1=_[_0x8742('0x38')](values[_0x8742('0xc5')],function(_0x477110){return{'channel':_0x8742('0xc6'),'id':_0x477110['id'],'createdAt':_0x477110['createdAt']};});var _0x4e6517=_[_0x8742('0x38')](values['WhatsappOpenTabs'],function(_0x4591b6){return{'channel':_0x8742('0xc7'),'id':_0x4591b6['id'],'createdAt':_0x4591b6['createdAt']};});var _0x137272=_[_0x8742('0xc8')](_0x76e4cb,_0x1df0db,_0x3adb09,_0x38eed9,_0x59a2c1,_0x4e6517);var _0x5466fc={'count':_0x137272[_0x8742('0x67')],'rows':_0x137272};return _0x5466fc;}else return null;})[_0x8742('0xf')](respondWithResult(_0xf112c,null))[_0x8742('0x19')](handleError(_0xf112c,null));};exports[_0x8742('0xc9')]=function(_0x19425e,_0x59f89c){var _0x1884c9={};var _0x41c453={};var _0x1ec258;var _0x16ad60;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x19425e[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x59f89c,null))[_0x8742('0xf')](function(_0x3b1007){if(_0x3b1007){_0x1ec258=_0x3b1007;_0x41c453['model']=_[_0x8742('0x51')](db['CmContact'][_0x8742('0x37')]);_0x41c453[_0x8742('0x3c')]=_['keys'](_0x19425e[_0x8742('0x3c')]);_0x41c453[_0x8742('0x53')]=_['intersection'](_0x41c453[_0x8742('0x4f')],_0x41c453['query']);_0x1884c9['attributes']=_[_0x8742('0x54')](_0x41c453['model'],qs[_0x8742('0x55')](_0x19425e[_0x8742('0x3c')][_0x8742('0x55')]));_0x1884c9[_0x8742('0x42')]=_0x1884c9[_0x8742('0x42')][_0x8742('0x67')]?_0x1884c9['attributes']:_0x41c453[_0x8742('0x4f')];_0x1884c9[_0x8742('0xcb')]=qs['sort'](_0x19425e[_0x8742('0x3c')][_0x8742('0xcc')]);_0x1884c9[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x19425e[_0x8742('0x3c')],_0x41c453['filters']));if(_0x19425e[_0x8742('0x3c')][_0x8742('0x2a')]){_0x1884c9[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x1884c9['where'],{'$or':_[_0x8742('0x38')](_0x1884c9['attributes'],function(_0x4d382c){var _0x47eed1={};_0x47eed1[_0x4d382c]={'$like':'%'+_0x19425e[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x47eed1;})});}_0x1884c9=_[_0x8742('0x56')]({},_0x1884c9,_0x19425e[_0x8742('0xce')]);return _0x1ec258['getContacts'](_0x1884c9);}})[_0x8742('0xf')](function(_0x5dfc85){if(_0x5dfc85){_0x16ad60=_0x5dfc85[_0x8742('0x67')];if(_0x19425e[_0x8742('0x3c')]['hasOwnProperty'](_0x8742('0x3d'))){_0x1884c9['include']=[{'model':db[_0x8742('0xcf')],'as':_0x8742('0xd0'),'required':![]},{'model':db[_0x8742('0xd1')],'as':_0x8742('0xd2'),'attributes':['id','name','color'],'where':_0x19425e[_0x8742('0x3c')][_0x8742('0xd3')]?{'id':_0x19425e[_0x8742('0x3c')][_0x8742('0xd3')]}:undefined,'required':_0x19425e[_0x8742('0x3c')][_0x8742('0xd3')]?!![]:![]}];}if(!_0x19425e[_0x8742('0x3c')]['hasOwnProperty'](_0x8742('0xd4'))){_0x1884c9[_0x8742('0x1d')]=qs['limit'](_0x19425e[_0x8742('0x3c')]['limit']);_0x1884c9[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x19425e['query'][_0x8742('0x1c')]);}return _0x1ec258['getContacts'](_0x1884c9);}})['then'](function(_0x42fb41){if(_0x42fb41){return _0x42fb41?{'count':_0x16ad60,'rows':_0x42fb41}:null;}})['then'](respondWithResult(_0x59f89c,null))[_0x8742('0x19')](handleError(_0x59f89c,null));};exports['getQueues']=function(_0x246e61,_0x3f31b3){var _0x3b7205;var _0x158b44={};var _0x390e5a;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x246e61['params']['id']},'attributes':['id','name',_0x8742('0x2f')]})[_0x8742('0xf')](handleEntityNotFound(_0x3f31b3,null))['then'](function(_0x2a4c13){if(!utils[_0x8742('0xb0')](_0x246e61['query'][_0x8742('0x9c')])){throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0x9f'));}_0x3b7205=_0x2a4c13;var _0x329aa3={};_0x329aa3['model']=_[_0x8742('0x51')](db[_[_0x8742('0xa1')](_0x246e61[_0x8742('0x3c')]['channel'])+_0x8742('0xd5')][_0x8742('0x37')]);_0x329aa3[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x246e61['query']);_0x329aa3[_0x8742('0x53')]=_['intersection'](_0x329aa3[_0x8742('0x4f')],_0x329aa3['query']);_0x158b44[_0x8742('0x42')]=_[_0x8742('0x54')](_0x329aa3[_0x8742('0x4f')],qs['fields'](_0x246e61['query'][_0x8742('0x55')]));_0x158b44[_0x8742('0x42')]=_0x158b44[_0x8742('0x42')][_0x8742('0x67')]?_0x158b44[_0x8742('0x42')]:_0x329aa3[_0x8742('0x4f')];_0x158b44[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x246e61['query'][_0x8742('0xcc')]);_0x158b44[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x246e61[_0x8742('0x3c')],_0x329aa3[_0x8742('0x53')]));if(_0x246e61[_0x8742('0x3c')][_0x8742('0x2a')]){_0x158b44[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x158b44[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x158b44[_0x8742('0x42')],function(_0x5c1000){var _0x516fbc={};_0x516fbc[_0x5c1000]={'$like':'%'+_0x246e61['query'][_0x8742('0x2a')]+'%'};return _0x516fbc;})});}_0x158b44=_['merge']({},_0x158b44,_0x246e61['options']);switch(_0x3b7205[_0x8742('0x2f')]){case _0x8742('0x25'):return db[_[_0x8742('0xa1')](_0x246e61[_0x8742('0x3c')][_0x8742('0x9c')])+_0x8742('0xd5')][_0x8742('0x44')](_0x158b44);case'user':case _0x8742('0x6d'):return _0x3b7205[_0x8742('0x24')+_['capitalize'](_0x246e61[_0x8742('0x3c')]['channel'])+'Queues'](_0x158b44);default:throw new db[(_0x8742('0x8f'))]['ValidationError'](_0x8742('0xd6'));}})[_0x8742('0xf')](function(_0x1acc5d){_0x390e5a=_0x1acc5d[_0x8742('0x67')];if(!_0x246e61['query']['hasOwnProperty'](_0x8742('0xd4'))){_0x158b44[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x246e61[_0x8742('0x3c')]['limit']);_0x158b44[_0x8742('0x1c')]=qs['offset'](_0x246e61[_0x8742('0x3c')][_0x8742('0x1c')]);}switch(_0x3b7205['role']){case _0x8742('0x25'):return db[_[_0x8742('0xa1')](_0x246e61[_0x8742('0x3c')][_0x8742('0x9c')])+_0x8742('0xd5')][_0x8742('0x44')](_0x158b44);case _0x8742('0x7e'):case _0x8742('0x6d'):return _0x3b7205[_0x8742('0x24')+_['capitalize'](_0x246e61[_0x8742('0x3c')][_0x8742('0x9c')])+_0x8742('0xa2')](_0x158b44);}})['then'](function(_0x249ecd){return{'count':_0x390e5a,'rows':_0x249ecd};})[_0x8742('0xf')](respondWithResult(_0x3f31b3,null))[_0x8742('0x19')](handleError(_0x3f31b3,null));};exports[_0x8742('0xd7')]=function(_0x193fd6,_0x4a2353){var _0x930948={};var _0x58df1c={};var _0x4c1f04;var _0x135348;return db[_0x8742('0x36')]['findOne']({'where':{'id':_0x193fd6[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x4a2353,null))[_0x8742('0xf')](function(_0x52d4b7){if(_0x52d4b7){_0x4c1f04=_0x52d4b7;_0x58df1c[_0x8742('0x4f')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x58df1c['query']=_[_0x8742('0x51')](_0x193fd6['query']);_0x58df1c[_0x8742('0x53')]=_[_0x8742('0x54')](_0x58df1c['model'],_0x58df1c[_0x8742('0x3c')]);_0x930948[_0x8742('0x42')]=_[_0x8742('0x54')](_0x58df1c['model'],qs[_0x8742('0x55')](_0x193fd6[_0x8742('0x3c')][_0x8742('0x55')]));_0x930948[_0x8742('0x42')]=_0x930948[_0x8742('0x42')]['length']?_0x930948[_0x8742('0x42')]:_0x58df1c[_0x8742('0x4f')];_0x930948[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x193fd6[_0x8742('0x3c')][_0x8742('0xcc')]);_0x930948['where']=qs['filters'](_[_0x8742('0xcd')](_0x193fd6[_0x8742('0x3c')],_0x58df1c['filters']));if(_0x193fd6[_0x8742('0x3c')][_0x8742('0x2a')]){_0x930948[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x930948[_0x8742('0x3b')],{'$or':_['map'](_0x930948[_0x8742('0x42')],function(_0x38b35a){var _0x3f4132={};_0x3f4132[_0x38b35a]={'$like':'%'+_0x193fd6['query'][_0x8742('0x2a')]+'%'};return _0x3f4132;})});}_0x930948=_['merge']({},_0x930948,_0x193fd6[_0x8742('0xce')]);return _0x4c1f04['getVoiceQueuesRt'](_0x930948);}})['then'](function(_0x28d85c){if(_0x28d85c){_0x135348=_0x28d85c[_0x8742('0x67')];if(!_0x193fd6['query'][_0x8742('0xd8')](_0x8742('0xd4'))){_0x930948[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x193fd6[_0x8742('0x3c')]['limit']);_0x930948[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x193fd6[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x4c1f04[_0x8742('0xd7')](_0x930948);}})[_0x8742('0xf')](function(_0x5a6f3d){if(_0x5a6f3d){return _0x5a6f3d?{'count':_0x135348,'rows':_0x5a6f3d}:null;}})[_0x8742('0xf')](respondWithResult(_0x4a2353,null))[_0x8742('0x19')](handleError(_0x4a2353,null));};exports[_0x8742('0xd9')]=function(_0x4722e1,_0x5acacf){var _0xb8e92={};var _0x2da938={};var _0x453050;var _0x4dda1a;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x4722e1[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x5acacf,null))['then'](function(_0x11ae1b){if(_0x11ae1b){_0x453050=_0x11ae1b;_0x2da938['model']=_['keys'](db[_0x8742('0xda')][_0x8742('0x37')]);_0x2da938[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x4722e1[_0x8742('0x3c')]);_0x2da938[_0x8742('0x53')]=_[_0x8742('0x54')](_0x2da938[_0x8742('0x4f')],_0x2da938[_0x8742('0x3c')]);_0xb8e92[_0x8742('0x42')]=_['intersection'](_0x2da938[_0x8742('0x4f')],qs['fields'](_0x4722e1[_0x8742('0x3c')][_0x8742('0x55')]));_0xb8e92['attributes']=_0xb8e92[_0x8742('0x42')][_0x8742('0x67')]?_0xb8e92['attributes']:_0x2da938[_0x8742('0x4f')];_0xb8e92['order']=qs[_0x8742('0xcc')](_0x4722e1[_0x8742('0x3c')][_0x8742('0xcc')]);_0xb8e92[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x4722e1[_0x8742('0x3c')],_0x2da938['filters']));if(_0x4722e1['query'][_0x8742('0x2a')]){_0xb8e92[_0x8742('0x3b')]=_[_0x8742('0x56')](_0xb8e92[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0xb8e92[_0x8742('0x42')],function(_0xb126b1){var _0x5b6e86={};_0x5b6e86[_0xb126b1]={'$like':'%'+_0x4722e1[_0x8742('0x3c')]['filter']+'%'};return _0x5b6e86;})});}_0xb8e92=_['merge']({},_0xb8e92,_0x4722e1[_0x8742('0xce')]);return _0x453050[_0x8742('0xd9')](_0xb8e92);}})[_0x8742('0xf')](function(_0x50a5b0){if(_0x50a5b0){_0x4dda1a=_0x50a5b0['length'];if(!_0x4722e1[_0x8742('0x3c')]['hasOwnProperty']('nolimit')){_0xb8e92['limit']=qs[_0x8742('0x1d')](_0x4722e1[_0x8742('0x3c')][_0x8742('0x1d')]);_0xb8e92[_0x8742('0x1c')]=qs['offset'](_0x4722e1[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x453050['getGroups'](_0xb8e92);}})[_0x8742('0xf')](function(_0x5326f9){if(_0x5326f9){return _0x5326f9?{'count':_0x4dda1a,'rows':_0x5326f9}:null;}})[_0x8742('0xf')](respondWithResult(_0x5acacf,null))[_0x8742('0x19')](handleError(_0x5acacf,null));};exports[_0x8742('0xdb')]=function(_0x3f22f7,_0x498ffa){var _0x3c5c3f={'raw':!![],'where':{}};var _0x30821d={};var _0x2c8155={'count':0x0,'rows':[]};return db[_0x8742('0x36')]['findOne']({'where':{'id':_0x3f22f7[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x498ffa,null))[_0x8742('0xf')](function(_0x163abb){if(_0x163abb){_0x30821d['model']=_[_0x8742('0x51')](db[_0x8742('0xdc')][_0x8742('0x37')]);_0x30821d[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x3f22f7[_0x8742('0x3c')]);_0x30821d[_0x8742('0x53')]=_[_0x8742('0x54')](_0x30821d[_0x8742('0x4f')],_0x30821d[_0x8742('0x3c')]);_0x3c5c3f[_0x8742('0x42')]=_[_0x8742('0x54')](_0x30821d[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x3f22f7[_0x8742('0x3c')][_0x8742('0x55')]));_0x3c5c3f[_0x8742('0x42')]=_0x3c5c3f['attributes'][_0x8742('0x67')]?_0x3c5c3f[_0x8742('0x42')]:_0x30821d['model'];if(!_0x3f22f7['query'][_0x8742('0xd8')](_0x8742('0xd4'))){_0x3c5c3f['limit']=qs[_0x8742('0x1d')](_0x3f22f7['query'][_0x8742('0x1d')]);_0x3c5c3f[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x3f22f7[_0x8742('0x3c')][_0x8742('0x1c')]);}_0x3c5c3f['order']=qs[_0x8742('0xcc')](_0x3f22f7[_0x8742('0x3c')][_0x8742('0xcc')]);_0x3c5c3f[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x3f22f7[_0x8742('0x3c')],_0x30821d[_0x8742('0x53')]));_0x3c5c3f['where'][_0x8742('0xdd')]=_0x163abb['id'];if(_0x3f22f7[_0x8742('0x3c')][_0x8742('0x2a')]){_0x3c5c3f[_0x8742('0x3b')]=_['merge'](_0x3c5c3f[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x3c5c3f[_0x8742('0x42')],function(_0x376598){var _0x183740={};_0x183740[_0x376598]={'$like':'%'+_0x3f22f7[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x183740;})});}_0x3c5c3f=_['merge']({},_0x3c5c3f,_0x3f22f7[_0x8742('0xce')]);return db[_0x8742('0xdc')][_0x8742('0x1f')]({'where':_0x3c5c3f[_0x8742('0x3b')]})[_0x8742('0xf')](function(_0xcebb77){_0x2c8155['count']=_0xcebb77;if(_0x3f22f7['query'][_0x8742('0x3d')]){_0x3c5c3f[_0x8742('0x3e')]=[{'all':!![]}];}return db[_0x8742('0xdc')][_0x8742('0x44')](_0x3c5c3f);})['then'](function(_0x517b9d){_0x2c8155[_0x8742('0x45')]=_0x517b9d;return _0x2c8155;});}})['then'](respondWithFilteredResult(_0x498ffa,_0x3c5c3f))[_0x8742('0x19')](handleError(_0x498ffa,null));};exports[_0x8742('0xde')]=function(_0x2dce03,_0x5ba7a4){var _0x5f0156={'raw':!![],'where':{}};var _0x50c80d={};var _0x189537={'count':0x0,'rows':[]};return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x2dce03[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x5ba7a4,null))[_0x8742('0xf')](function(_0x214dbc){if(_0x214dbc){_0x50c80d[_0x8742('0x4f')]=_[_0x8742('0x51')](db['ScreenRecording']['rawAttributes']);_0x50c80d[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x2dce03[_0x8742('0x3c')]);_0x50c80d[_0x8742('0x53')]=_[_0x8742('0x54')](_0x50c80d[_0x8742('0x4f')],_0x50c80d[_0x8742('0x3c')]);_0x5f0156[_0x8742('0x42')]=_[_0x8742('0x54')](_0x50c80d[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x2dce03[_0x8742('0x3c')]['fields']));_0x5f0156['attributes']=_0x5f0156[_0x8742('0x42')][_0x8742('0x67')]?_0x5f0156[_0x8742('0x42')]:_0x50c80d[_0x8742('0x4f')];if(!_0x2dce03['query']['hasOwnProperty'](_0x8742('0xd4'))){_0x5f0156[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x2dce03['query'][_0x8742('0x1d')]);_0x5f0156[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x2dce03[_0x8742('0x3c')][_0x8742('0x1c')]);}_0x5f0156[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x2dce03['query'][_0x8742('0xcc')]);_0x5f0156['where']=qs['filters'](_['pick'](_0x2dce03[_0x8742('0x3c')],_0x50c80d[_0x8742('0x53')]));_0x5f0156['where'][_0x8742('0xdd')]=_0x214dbc['id'];if(_0x2dce03[_0x8742('0x3c')]['filter']){_0x5f0156[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x5f0156['where'],{'$or':_['map'](_0x5f0156[_0x8742('0x42')],function(_0xd5bbd6){var _0xb3cfd5={};_0xb3cfd5[_0xd5bbd6]={'$like':'%'+_0x2dce03['query']['filter']+'%'};return _0xb3cfd5;})});}_0x5f0156=_['merge']({},_0x5f0156,_0x2dce03['options']);return db[_0x8742('0xdf')][_0x8742('0x1f')]({'where':_0x5f0156[_0x8742('0x3b')]})[_0x8742('0xf')](function(_0x450529){_0x189537['count']=_0x450529;if(_0x2dce03[_0x8742('0x3c')][_0x8742('0x3d')]){_0x5f0156[_0x8742('0x3e')]=[{'all':!![]}];}return db[_0x8742('0xdf')][_0x8742('0x44')](_0x5f0156);})[_0x8742('0xf')](function(_0x46e79f){_0x189537[_0x8742('0x45')]=_0x46e79f;return _0x189537;});}})[_0x8742('0xf')](respondWithFilteredResult(_0x5ba7a4,_0x5f0156))[_0x8742('0x19')](handleError(_0x5ba7a4,null));};exports[_0x8742('0xe0')]=function(_0x84860e,_0x44685a){var _0xf4a7c6={};var _0xbfe259={};var _0x13ade9;var _0x39fa74;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x84860e['params']['id']}})['then'](handleEntityNotFound(_0x44685a,null))[_0x8742('0xf')](function(_0x1bfe6e){if(_0x1bfe6e){_0x13ade9=_0x1bfe6e;_0xbfe259['model']=_[_0x8742('0x51')](db[_0x8742('0xe1')]['rawAttributes']);_0xbfe259[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x84860e[_0x8742('0x3c')]);_0xbfe259[_0x8742('0x53')]=_[_0x8742('0x54')](_0xbfe259['model'],_0xbfe259[_0x8742('0x3c')]);_0xf4a7c6['attributes']=_['intersection'](_0xbfe259['model'],qs[_0x8742('0x55')](_0x84860e['query']['fields']));_0xf4a7c6[_0x8742('0x42')]=_0xf4a7c6[_0x8742('0x42')][_0x8742('0x67')]?_0xf4a7c6[_0x8742('0x42')]:_0xbfe259[_0x8742('0x4f')];_0xf4a7c6['order']=qs['sort'](_0x84860e[_0x8742('0x3c')][_0x8742('0xcc')]);_0xf4a7c6[_0x8742('0x3b')]=qs[_0x8742('0x53')](_['pick'](_0x84860e[_0x8742('0x3c')],_0xbfe259[_0x8742('0x53')]));if(_0x84860e[_0x8742('0x3c')][_0x8742('0x2a')]){_0xf4a7c6['where']=_[_0x8742('0x56')](_0xf4a7c6[_0x8742('0x3b')],{'$or':_['map'](_0xf4a7c6['attributes'],function(_0x45b180){var _0x4bde8b={};_0x4bde8b[_0x45b180]={'$like':'%'+_0x84860e[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x4bde8b;})});}_0xf4a7c6=_[_0x8742('0x56')]({},_0xf4a7c6,_0x84860e[_0x8742('0xce')]);return _0x13ade9[_0x8742('0xe0')](_0xf4a7c6);}})['then'](function(_0x5baa23){if(_0x5baa23){_0x39fa74=_0x5baa23[_0x8742('0x67')];if(!_0x84860e[_0x8742('0x3c')][_0x8742('0xd8')](_0x8742('0xd4'))){_0xf4a7c6['limit']=qs[_0x8742('0x1d')](_0x84860e['query'][_0x8742('0x1d')]);_0xf4a7c6[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x84860e['query'][_0x8742('0x1c')]);}return _0x13ade9[_0x8742('0xe0')](_0xf4a7c6);}})[_0x8742('0xf')](function(_0x2e07ed){if(_0x2e07ed){return _0x2e07ed?{'count':_0x39fa74,'rows':_0x2e07ed}:null;}})[_0x8742('0xf')](respondWithResult(_0x44685a,null))['catch'](handleError(_0x44685a,null));};exports[_0x8742('0xe2')]=function(_0x99af21,_0x34d995){var _0x1d6fb7={};var _0x4e1de7={};var _0x2d8e77;var _0x2c4669;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x99af21[_0x8742('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34d995,null))[_0x8742('0xf')](function(_0x457e18){if(_0x457e18){_0x2d8e77=_0x457e18;_0x4e1de7[_0x8742('0x4f')]=_[_0x8742('0x51')](db['OpenchannelInteraction'][_0x8742('0x37')]);_0x4e1de7['query']=_[_0x8742('0x51')](_0x99af21[_0x8742('0x3c')]);_0x4e1de7[_0x8742('0x53')]=_[_0x8742('0x54')](_0x4e1de7['model'],_0x4e1de7[_0x8742('0x3c')]);_0x1d6fb7['attributes']=_[_0x8742('0x54')](_0x4e1de7[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x99af21['query'][_0x8742('0x55')]));_0x1d6fb7[_0x8742('0x42')]=_0x1d6fb7[_0x8742('0x42')][_0x8742('0x67')]?_0x1d6fb7[_0x8742('0x42')]:_0x4e1de7[_0x8742('0x4f')];_0x1d6fb7[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x99af21[_0x8742('0x3c')][_0x8742('0xcc')]);_0x1d6fb7[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x99af21[_0x8742('0x3c')],_0x4e1de7[_0x8742('0x53')]));if(_0x99af21[_0x8742('0x3c')][_0x8742('0x2a')]){_0x1d6fb7['where']=_[_0x8742('0x56')](_0x1d6fb7[_0x8742('0x3b')],{'$or':_['map'](_0x1d6fb7['attributes'],function(_0x4f09b2){var _0x1ff030={};_0x1ff030[_0x4f09b2]={'$like':'%'+_0x99af21[_0x8742('0x3c')]['filter']+'%'};return _0x1ff030;})});}_0x1d6fb7=_[_0x8742('0x56')]({},_0x1d6fb7,_0x99af21[_0x8742('0xce')]);return _0x2d8e77[_0x8742('0xe2')](_0x1d6fb7);}})[_0x8742('0xf')](function(_0x2177da){if(_0x2177da){_0x2c4669=_0x2177da[_0x8742('0x67')];if(!_0x99af21['query'][_0x8742('0xd8')]('nolimit')){_0x1d6fb7['limit']=qs['limit'](_0x99af21[_0x8742('0x3c')]['limit']);_0x1d6fb7[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x99af21[_0x8742('0x3c')]['offset']);}return _0x2d8e77[_0x8742('0xe2')](_0x1d6fb7);}})[_0x8742('0xf')](function(_0x2a3207){if(_0x2a3207){return _0x2a3207?{'count':_0x2c4669,'rows':_0x2a3207}:null;}})['then'](respondWithResult(_0x34d995,null))[_0x8742('0x19')](handleError(_0x34d995,null));};exports[_0x8742('0xe3')]=function(_0x125c06,_0x404c87){var _0x5f19f5={'raw':!![],'where':{}};var _0x1e8b93={};var _0x58a33f={'count':0x0,'rows':[]};return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x125c06['params']['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x404c87,null))[_0x8742('0xf')](function(_0x5bfd4a){if(_0x5bfd4a){_0x1e8b93[_0x8742('0x4f')]=_['keys'](db[_0x8742('0xe4')]['rawAttributes']);_0x1e8b93[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x125c06[_0x8742('0x3c')]);_0x1e8b93['filters']=_[_0x8742('0x54')](_0x1e8b93[_0x8742('0x4f')],_0x1e8b93[_0x8742('0x3c')]);_0x5f19f5['attributes']=_[_0x8742('0x54')](_0x1e8b93['model'],qs[_0x8742('0x55')](_0x125c06[_0x8742('0x3c')][_0x8742('0x55')]));_0x5f19f5['attributes']=_0x5f19f5['attributes'][_0x8742('0x67')]?_0x5f19f5[_0x8742('0x42')]:_0x1e8b93['model'];if(!_0x125c06['query'][_0x8742('0xd8')](_0x8742('0xd4'))){_0x5f19f5[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x125c06['query'][_0x8742('0x1d')]);_0x5f19f5['offset']=qs[_0x8742('0x1c')](_0x125c06[_0x8742('0x3c')]['offset']);}_0x5f19f5[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x125c06['query'][_0x8742('0xcc')]);_0x5f19f5[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x125c06[_0x8742('0x3c')],_0x1e8b93[_0x8742('0x53')]));_0x5f19f5['where']['UserId']=_0x5bfd4a['id'];if(_0x125c06[_0x8742('0x3c')][_0x8742('0x2a')]){_0x5f19f5[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x5f19f5[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x5f19f5[_0x8742('0x42')],function(_0x54b0a4){var _0x409c49={};_0x409c49[_0x54b0a4]={'$like':'%'+_0x125c06['query'][_0x8742('0x2a')]+'%'};return _0x409c49;})});}_0x5f19f5=_[_0x8742('0x56')]({},_0x5f19f5,_0x125c06[_0x8742('0xce')]);return db[_0x8742('0xe4')]['count']({'where':_0x5f19f5['where']})['then'](function(_0x498da2){_0x58a33f['count']=_0x498da2;if(_0x125c06[_0x8742('0x3c')]['includeAll']){_0x5f19f5[_0x8742('0x3e')]=[{'all':!![]}];}return db[_0x8742('0xe4')][_0x8742('0x44')](_0x5f19f5);})[_0x8742('0xf')](function(_0x2238f6){_0x58a33f['rows']=_0x2238f6;return _0x58a33f;});}})['then'](respondWithFilteredResult(_0x404c87,_0x5f19f5))['catch'](handleError(_0x404c87,null));};exports[_0x8742('0xe5')]=function(_0x1109c5,_0x3d5e7c){var _0x3af2da={};var _0x346787={};var _0x3db0aa;var _0x557e5e;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0x1109c5[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x3d5e7c,null))[_0x8742('0xf')](function(_0x2b0b61){if(_0x2b0b61){_0x3db0aa=_0x2b0b61;_0x346787[_0x8742('0x4f')]=_[_0x8742('0x51')](db[_0x8742('0xe6')][_0x8742('0x37')]);_0x346787[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x1109c5[_0x8742('0x3c')]);_0x346787[_0x8742('0x53')]=_[_0x8742('0x54')](_0x346787['model'],_0x346787[_0x8742('0x3c')]);_0x3af2da['attributes']=_[_0x8742('0x54')](_0x346787[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x1109c5[_0x8742('0x3c')]['fields']));_0x3af2da['attributes']=_0x3af2da[_0x8742('0x42')][_0x8742('0x67')]?_0x3af2da[_0x8742('0x42')]:_0x346787['model'];_0x3af2da['order']=qs[_0x8742('0xcc')](_0x1109c5[_0x8742('0x3c')]['sort']);_0x3af2da[_0x8742('0x3b')]=qs[_0x8742('0x53')](_[_0x8742('0xcd')](_0x1109c5[_0x8742('0x3c')],_0x346787['filters']));if(_0x1109c5['query'][_0x8742('0x2a')]){_0x3af2da[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x3af2da[_0x8742('0x3b')],{'$or':_['map'](_0x3af2da['attributes'],function(_0x1a6b63){var _0x5e9be4={};_0x5e9be4[_0x1a6b63]={'$like':'%'+_0x1109c5[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x5e9be4;})});}_0x3af2da=_['merge']({},_0x3af2da,_0x1109c5[_0x8742('0xce')]);return _0x3db0aa['getSmsInteractions'](_0x3af2da);}})[_0x8742('0xf')](function(_0x21c08b){if(_0x21c08b){_0x557e5e=_0x21c08b[_0x8742('0x67')];if(!_0x1109c5[_0x8742('0x3c')][_0x8742('0xd8')](_0x8742('0xd4'))){_0x3af2da[_0x8742('0x1d')]=qs['limit'](_0x1109c5[_0x8742('0x3c')][_0x8742('0x1d')]);_0x3af2da[_0x8742('0x1c')]=qs[_0x8742('0x1c')](_0x1109c5[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x3db0aa[_0x8742('0xe5')](_0x3af2da);}})[_0x8742('0xf')](function(_0x13f651){if(_0x13f651){return _0x13f651?{'count':_0x557e5e,'rows':_0x13f651}:null;}})[_0x8742('0xf')](respondWithResult(_0x3d5e7c,null))[_0x8742('0x19')](handleError(_0x3d5e7c,null));};exports[_0x8742('0xe7')]=function(_0x4f7aea,_0x1a167f){var _0xd59a2={};var _0xa03a7f={};var _0x856281;var _0x4d40db;return db['User'][_0x8742('0xca')]({'where':{'id':_0x4f7aea[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x1a167f,null))[_0x8742('0xf')](function(_0x25fc4f){if(_0x25fc4f){_0x856281=_0x25fc4f;_0xa03a7f[_0x8742('0x4f')]=_[_0x8742('0x51')](db[_0x8742('0xe8')]['rawAttributes']);_0xa03a7f[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x4f7aea[_0x8742('0x3c')]);_0xa03a7f[_0x8742('0x53')]=_['intersection'](_0xa03a7f[_0x8742('0x4f')],_0xa03a7f[_0x8742('0x3c')]);_0xd59a2[_0x8742('0x42')]=_[_0x8742('0x54')](_0xa03a7f[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x4f7aea['query']['fields']));_0xd59a2[_0x8742('0x42')]=_0xd59a2[_0x8742('0x42')][_0x8742('0x67')]?_0xd59a2['attributes']:_0xa03a7f[_0x8742('0x4f')];_0xd59a2[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x4f7aea[_0x8742('0x3c')]['sort']);_0xd59a2['where']=qs[_0x8742('0x53')](_['pick'](_0x4f7aea[_0x8742('0x3c')],_0xa03a7f[_0x8742('0x53')]));if(_0x4f7aea[_0x8742('0x3c')][_0x8742('0x2a')]){_0xd59a2['where']=_[_0x8742('0x56')](_0xd59a2[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0xd59a2[_0x8742('0x42')],function(_0x521a1f){var _0x5c8278={};_0x5c8278[_0x521a1f]={'$like':'%'+_0x4f7aea['query'][_0x8742('0x2a')]+'%'};return _0x5c8278;})});}_0xd59a2=_[_0x8742('0x56')]({},_0xd59a2,_0x4f7aea[_0x8742('0xce')]);return _0x856281[_0x8742('0xe7')](_0xd59a2);}})[_0x8742('0xf')](function(_0x2627ff){if(_0x2627ff){_0x4d40db=_0x2627ff[_0x8742('0x67')];if(!_0x4f7aea['query'][_0x8742('0xd8')](_0x8742('0xd4'))){_0xd59a2[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x4f7aea[_0x8742('0x3c')]['limit']);_0xd59a2['offset']=qs['offset'](_0x4f7aea[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x856281[_0x8742('0xe7')](_0xd59a2);}})[_0x8742('0xf')](function(_0x2c3979){if(_0x2c3979){return _0x2c3979?{'count':_0x4d40db,'rows':_0x2c3979}:null;}})[_0x8742('0xf')](respondWithResult(_0x1a167f,null))[_0x8742('0x19')](handleError(_0x1a167f,null));};exports[_0x8742('0xe9')]=function(_0x28c90f,_0x2e73bc){var _0x389895={};var _0xd2cb9b={};var _0x50deba;var _0x508d1d;return db['User']['findOne']({'where':{'id':_0x28c90f[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x2e73bc,null))[_0x8742('0xf')](function(_0x15bce5){if(_0x15bce5){_0x50deba=_0x15bce5;_0xd2cb9b['model']=_[_0x8742('0x51')](db[_0x8742('0xea')][_0x8742('0x37')]);_0xd2cb9b[_0x8742('0x3c')]=_[_0x8742('0x51')](_0x28c90f[_0x8742('0x3c')]);_0xd2cb9b[_0x8742('0x53')]=_[_0x8742('0x54')](_0xd2cb9b['model'],_0xd2cb9b[_0x8742('0x3c')]);_0x389895[_0x8742('0x42')]=_[_0x8742('0x54')](_0xd2cb9b[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x28c90f['query']['fields']));_0x389895[_0x8742('0x42')]=_0x389895['attributes'][_0x8742('0x67')]?_0x389895[_0x8742('0x42')]:_0xd2cb9b[_0x8742('0x4f')];_0x389895[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x28c90f[_0x8742('0x3c')][_0x8742('0xcc')]);_0x389895['where']=qs['filters'](_[_0x8742('0xcd')](_0x28c90f[_0x8742('0x3c')],_0xd2cb9b['filters']));if(_0x28c90f['query']['filter']){_0x389895[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x389895[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x389895['attributes'],function(_0x33750c){var _0x44ebee={};_0x44ebee[_0x33750c]={'$like':'%'+_0x28c90f[_0x8742('0x3c')]['filter']+'%'};return _0x44ebee;})});}_0x389895=_[_0x8742('0x56')]({},_0x389895,_0x28c90f[_0x8742('0xce')]);return _0x50deba[_0x8742('0xe9')](_0x389895);}})[_0x8742('0xf')](function(_0x371914){if(_0x371914){_0x508d1d=_0x371914[_0x8742('0x67')];if(!_0x28c90f['query'][_0x8742('0xd8')](_0x8742('0xd4'))){_0x389895[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x28c90f[_0x8742('0x3c')][_0x8742('0x1d')]);_0x389895[_0x8742('0x1c')]=qs['offset'](_0x28c90f[_0x8742('0x3c')]['offset']);}return _0x50deba['getWhatsappInteractions'](_0x389895);}})[_0x8742('0xf')](function(_0x14689e){if(_0x14689e){return _0x14689e?{'count':_0x508d1d,'rows':_0x14689e}:null;}})[_0x8742('0xf')](respondWithResult(_0x2e73bc,null))[_0x8742('0x19')](handleError(_0x2e73bc,null));};exports['login']=function(_0x5bd406,_0x3fcc78,_0x4320d9){var _0x1dab96;var _0x270d34;var _0x4cc0ae;var _0x1ad502=!_[_0x8742('0x61')](_0x5bd406[_0x8742('0x4e')]['id'])?_0x5bd406[_0x8742('0x4e')]['id']:!_[_0x8742('0x61')](_0x5bd406[_0x8742('0x7e')]['id'])?_0x5bd406['user']['id']:null;return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x1ad502,'role':{'$or':[_0x8742('0x25'),_0x8742('0x7e'),_0x8742('0x6d')]}},'attributes':['id',_0x8742('0x30'),_0x8742('0xeb'),_0x8742('0xec'),'role',_0x8742('0x5d'),_0x8742('0xed')]})[_0x8742('0xf')](function(_0x1e709b){if(_0x1e709b){if(_0x1e709b[_0x8742('0x2f')]===_0x8742('0x6d')){_0x1dab96=_0x1e709b;if(_0x5bd406[_0x8742('0x59')][_0x8742('0x9e')]){_0x4cc0ae=util[_0x8742('0xaa')](_0x8742('0xee'),_0x1dab96[_0x5bd406['body']['interface']]);}else if(_0x5bd406[_0x8742('0x59')][_0x8742('0xef')]){_0x4cc0ae=util['format'](_0x8742('0xab'),_0x5bd406[_0x8742('0x59')]['intrf']);}else{_0x4cc0ae=util[_0x8742('0xaa')](_0x8742('0xab'),_0x1dab96[_0x8742('0x30')]);}socket['to'](util[_0x8742('0xaa')](_0x8742('0xf0'),_0x1dab96[_0x8742('0x30')]))['emit'](_0x8742('0xf1'),{'user':{'id':_0x1dab96['id'],'name':_0x1dab96[_0x8742('0x30')]},'ip':_0x5bd406[_0x8742('0xf2')][_0x8742('0xf3')]||_0x5bd406['connection']['remoteAddress']||_0x5bd406['socket'][_0x8742('0xf4')]||_0x5bd406['connection'][_0x8742('0xf5')][_0x8742('0xf4')]});return db[_0x8742('0xad')][_0x8742('0x23')]({'where':{'membername':_0x1dab96['name']},'individualHooks':!![]});}}else{throw new db[(_0x8742('0x8f'))][(_0x8742('0x90'))](_0x8742('0xf6'));}})['then'](function(){if(_0x1dab96){return _0x1dab96['getVoiceQueues']({'raw':!![]});}})[_0x8742('0xf')](function(_0x46d3da){if(_0x1dab96){var _0x2e751e=[];if(_0x46d3da){_0x270d34=_0x46d3da;if(_0x270d34['length']){for(var _0x4dc469=0x0;_0x4dc469<_0x270d34[_0x8742('0x67')];_0x4dc469++){_0x2e751e[_0x8742('0x43')]({'membername':_0x1dab96[_0x8742('0x30')],'UserId':_0x1dab96['id'],'queue_name':_0x270d34[_0x4dc469][_0x8742('0x30')],'VoiceQueueId':_0x270d34[_0x4dc469]['id'],'interface':_0x4cc0ae,'paused':_0x1dab96[_0x8742('0xed')]||![],'penalty':_0x270d34[_0x4dc469][_0x8742('0xf7')]||0x0});}return BPromise[_0x8742('0x88')](_0x2e751e,function(_0x278c59){return db['UserVoiceQueueRt'][_0x8742('0xae')](_0x278c59);});}}}})[_0x8742('0xf')](function(){if(_0x1dab96){return db[_0x8742('0xf8')][_0x8742('0x44')]({'where':{'membername':_0x1dab96[_0x8742('0x30')],'exitAt':null}});}})[_0x8742('0xf')](function(_0x2c305f){if(_0x1dab96){var _0x3ac7c2=[];_0x2c305f[_0x8742('0xf9')](function(_0x28af24){_0x3ac7c2[_0x8742('0x43')](_0x28af24[_0x8742('0x22')]({'exitAt':moment()[_0x8742('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8742('0x4c')](_0x3ac7c2);}})[_0x8742('0xf')](function(){if(_0x1dab96){var _0x5e9210=[];var _0x2208ce=[];var _0x176872=utils[_0x8742('0xfa')]();var _0x55350f={'membername':_0x1dab96[_0x8742('0x30')],'interface':_0x4cc0ae,'enterAt':moment()[_0x8742('0xaa')](_0x8742('0xfb')),'role':_0x1dab96['role'],'internal':_0x1dab96[_0x8742('0x5d')]};_0x176872['forEach'](function(_0x139a5e){_0x5e9210[_0x8742('0x43')](_[_0x8742('0x56')]({'channel':_0x139a5e,'type':_0x8742('0xfc'),'data1':_0x5bd406[_0x8742('0x59')][_0x8742('0xfd')],'data2':_0x4cc0ae},_0x55350f));if(_0x1dab96[_0x8742('0xed')]){_0x2208ce[_0x8742('0x43')](_[_0x8742('0x56')]({'channel':_0x139a5e,'type':'PAUSE','data1':_0x8742('0xfe')},_0x55350f));}});return db['MemberReport'][_0x8742('0xff')](_0x5e9210['concat'](_0x2208ce),{'individualHooks':!![]});}})[_0x8742('0xf')](function(){if(_0x1dab96){return _0x1dab96[_0x8742('0x22')]({'online':!![],'lastLoginAt':moment()[_0x8742('0xaa')](_0x8742('0xfb')),'voicePause':_0x1dab96['loginInPause']||![],'mailPause':_0x1dab96[_0x8742('0xed')]||![],'chatPause':_0x1dab96[_0x8742('0xed')]||![],'faxPause':_0x1dab96[_0x8742('0xed')]||![],'smsPause':_0x1dab96['loginInPause']||![],'openchannelPause':_0x1dab96[_0x8742('0xed')]||![],'whatsappPause':_0x1dab96[_0x8742('0xed')]||![],'pauseType':_0x1dab96[_0x8742('0xed')]?'LOGININPAUSE':null,'interface':_0x4cc0ae,'lastPauseAt':moment()[_0x8742('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8742('0xf')](function(_0x46d895){if(_0x5bd406[_0x8742('0x100')]){return _0x4320d9();}else{return BPromise[_0x8742('0x101')](_0x46d895)[_0x8742('0xf')](respondWithResult(_0x3fcc78,null));}})[_0x8742('0x19')](handleError(_0x3fcc78,null));};exports[_0x8742('0x102')]=function(_0x10d164,_0x2d618c){var _0x5df56a;return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x10d164[_0x8742('0x4e')]['id'],'role':_0x8742('0x6d')},'attributes':['id','name',_0x8742('0x2f')]})[_0x8742('0xf')](handleEntityNotFound(_0x2d618c,null))[_0x8742('0xf')](function(_0x6151b0){if(_0x6151b0){_0x5df56a=_0x6151b0;return db[_0x8742('0xad')][_0x8742('0x23')]({'where':{'membername':_0x5df56a[_0x8742('0x30')]},'individualHooks':!![]});}})['then'](function(){return db[_0x8742('0xf8')][_0x8742('0x44')]({'where':{'membername':_0x5df56a['name'],'exitAt':null}});})['then'](function(_0x244ac1){var _0x49d7a3=[];_0x244ac1['forEach'](function(_0xe3fbaa){_0x49d7a3[_0x8742('0x43')](_0xe3fbaa['update']({'exitAt':moment()[_0x8742('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8742('0x4c')](_0x49d7a3);})[_0x8742('0xf')](function(){return _0x5df56a[_0x8742('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8742('0xf')](respondWithResult(_0x2d618c,null))[_0x8742('0x19')](handleError(_0x2d618c,null));};exports[_0x8742('0x103')]=function(_0x381cb7,_0x16ef22){var _0x5d7e55;return db[_0x8742('0xad')]['update']({'paused':0x1},{'where':{'UserId':_0x381cb7[_0x8742('0x4e')]['id']},'individualHooks':!![]})[_0x8742('0xf')](function(){return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x381cb7[_0x8742('0x4e')]['id'],'role':_0x8742('0x6d')},'attributes':['id',_0x8742('0x30'),_0x8742('0x2f'),_0x8742('0x5d'),_0x8742('0x9e')]});})[_0x8742('0xf')](handleEntityNotFound(_0x16ef22,null))['then'](function(_0x5f44e1){if(_0x5f44e1){_0x5d7e55=_0x5f44e1;return respondWithRpcPromise(_0x8742('0x104'),_0x8742('0x103'),{'id':_0x5d7e55['id'],'name':_0x5d7e55[_0x8742('0x30')],'pause':!![]});}})['then'](function(){if(_0x5d7e55){return db[_0x8742('0xf8')]['findAll']({'where':{'membername':_0x5d7e55[_0x8742('0x30')],'type':_0x8742('0x105'),'exitAt':null}});}})[_0x8742('0xf')](function(_0x22b43b){if(_0x22b43b[_0x8742('0x67')]){var _0x30b34d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x510dc1=0x0,_0x1aab8d=_0x22b43b[_0x8742('0x67')];_0x510dc1<_0x1aab8d;_0x510dc1++){_0x22b43b[_0x510dc1][_0x8742('0x106')]({'exitAt':_0x30b34d});}}})[_0x8742('0xf')](function(){var _0x2371a9=[];var _0x5d300f=utils[_0x8742('0xfa')]();_0x5d300f[_0x8742('0xf9')](function(_0x584e01){_0x2371a9[_0x8742('0x43')]({'channel':_0x584e01,'membername':_0x5d7e55[_0x8742('0x30')],'interface':_[_0x8742('0x61')](_0x5d7e55[_0x8742('0x9e')])?util[_0x8742('0xaa')](_0x8742('0xab'),_0x5d7e55[_0x8742('0x30')]):_0x5d7e55[_0x8742('0x9e')],'type':_0x8742('0x105'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x381cb7[_0x8742('0x59')]['type']||_0x8742('0x107'),'role':_0x5d7e55['role'],'internal':_0x5d7e55[_0x8742('0x5d')]});});return db[_0x8742('0xf8')][_0x8742('0xff')](_0x2371a9,{'individualHooks':!![]});})[_0x8742('0xf')](function(){return _0x5d7e55['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x381cb7[_0x8742('0x59')][_0x8742('0x39')]||_0x8742('0x107'),'lastPauseAt':moment()[_0x8742('0xaa')](_0x8742('0xfb'))});})['then'](respondWithResult(_0x16ef22,null))['catch'](handleError(_0x16ef22,null));};exports['unpause']=function(_0x350141,_0x5475d1){var _0x180928;return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x350141['params']['id']},'attributes':['id',_0x8742('0x30'),'role',_0x8742('0xac'),'mailPause',_0x8742('0x108'),_0x8742('0x109'),_0x8742('0x10a'),_0x8742('0x10b'),_0x8742('0x10c'),_0x8742('0x10d'),_0x8742('0x10e')]})[_0x8742('0xf')](handleEntityNotFound(_0x5475d1,null))['then'](function(_0x2535f3){if(_0x2535f3){_0x180928=_0x2535f3;if(_0x350141[_0x8742('0x59')][_0x8742('0x9c')]&&!utils[_0x8742('0xb0')](_0x350141[_0x8742('0x59')]['channel'])){throw new db[(_0x8742('0x8f'))]['ValidationError'](_0x8742('0x9f'));}switch(_0x350141['body'][_0x8742('0x9c')]){case _0x8742('0xa8'):return respondWithRpcPromise(_0x8742('0x104'),_0x8742('0x10f'),{'id':_0x180928['id'],'name':_0x180928[_0x8742('0x30')],'pause':![]})[_0x8742('0xf')](function(){return db[_0x8742('0xad')][_0x8742('0x22')]({'paused':0x0},{'where':{'UserId':_0x180928['id']},'individualHooks':!![]});})['then'](function(){return db[_0x8742('0xf8')][_0x8742('0x2e')]({'where':{'channel':_0x350141[_0x8742('0x59')]['channel'],'membername':_0x180928[_0x8742('0x30')],'type':_0x8742('0x105'),'exitAt':null}});})['then'](function(_0x236a32){if(_0x236a32){return _0x236a32[_0x8742('0x22')]({'exitAt':moment()[_0x8742('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8742('0x110')},{'individualHooks':!![]});}return null;})[_0x8742('0xf')](function(){return _0x180928[_0x8742('0x22')]({'voicePause':![]});});case'mail':case _0x8742('0x47'):case _0x8742('0x49'):case _0x8742('0x57'):case _0x8742('0x4b'):case _0x8742('0x58'):return db['MemberReport'][_0x8742('0x2e')]({'where':{'channel':_0x350141[_0x8742('0x59')][_0x8742('0x9c')],'membername':_0x180928[_0x8742('0x30')],'type':_0x8742('0x105'),'exitAt':null}})['then'](function(_0xc99ce1){if(_0xc99ce1){return _0xc99ce1[_0x8742('0x22')]({'exitAt':moment()[_0x8742('0xaa')](_0x8742('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8742('0xf')](function(){var _0xda9b0c={};_[_0x8742('0x20')](_0xda9b0c,util[_0x8742('0xaa')]('%s%s',_0x350141[_0x8742('0x59')][_0x8742('0x9c')],_0x8742('0x111')),![]);return _0x180928[_0x8742('0x22')](_0xda9b0c);});default:return respondWithRpcPromise(_0x8742('0x104'),_0x8742('0x10f'),{'id':_0x180928['id'],'name':_0x180928[_0x8742('0x30')],'pause':![]})[_0x8742('0xf')](function(){return db[_0x8742('0xad')][_0x8742('0x22')]({'paused':0x0},{'where':{'UserId':_0x180928['id']}});})[_0x8742('0xf')](function(){return db[_0x8742('0xf8')]['findAll']({'where':{'membername':_0x180928['name'],'type':_0x8742('0x105'),'exitAt':null}});})[_0x8742('0xf')](function(_0x5315ae){var _0x413bf4=[];_0x5315ae[_0x8742('0xf9')](function(_0x5891d1){_0x413bf4['push'](_0x5891d1[_0x8742('0x22')]({'exitAt':moment()['format'](_0x8742('0xfb')),'data2':_0x8742('0x110')}));});return BPromise[_0x8742('0x4c')](_0x413bf4);})[_0x8742('0xf')](function(){return _0x180928[_0x8742('0x22')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8742('0xf')](respondWithResult(_0x5475d1,null))[_0x8742('0x19')](handleError(_0x5475d1,null));};exports[_0x8742('0x112')]=function(_0xd54c8,_0x42930f){var _0x32a3ec={};var _0x1808ee={};var _0x25229b;var _0x2c12f3;return db[_0x8742('0x36')][_0x8742('0xca')]({'where':{'id':_0xd54c8[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x42930f,null))[_0x8742('0xf')](function(_0x22ca11){if(_0x22ca11){_0x25229b=_0x22ca11;_0x1808ee[_0x8742('0x4f')]=_[_0x8742('0x51')](db[_0x8742('0x113')][_0x8742('0x37')]);_0x1808ee[_0x8742('0x3c')]=_[_0x8742('0x51')](_0xd54c8[_0x8742('0x3c')]);_0x1808ee[_0x8742('0x53')]=_[_0x8742('0x54')](_0x1808ee[_0x8742('0x4f')],_0x1808ee[_0x8742('0x3c')]);_0x32a3ec[_0x8742('0x42')]=_[_0x8742('0x54')](_0x1808ee[_0x8742('0x4f')],qs[_0x8742('0x55')](_0xd54c8[_0x8742('0x3c')]['fields']));_0x32a3ec[_0x8742('0x42')]=_0x32a3ec[_0x8742('0x42')][_0x8742('0x67')]?_0x32a3ec['attributes']:_0x1808ee[_0x8742('0x4f')];_0x32a3ec[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0xd54c8[_0x8742('0x3c')][_0x8742('0xcc')]);_0x32a3ec[_0x8742('0x3b')]=qs[_0x8742('0x53')](_['pick'](_0xd54c8[_0x8742('0x3c')],_0x1808ee[_0x8742('0x53')]));if(_0xd54c8[_0x8742('0x3c')][_0x8742('0x2a')]){_0x32a3ec[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x32a3ec[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x32a3ec[_0x8742('0x42')],function(_0x24828b){var _0x331a02={};_0x331a02[_0x24828b]={'$like':'%'+_0xd54c8[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x331a02;})});}_0x32a3ec=_[_0x8742('0x56')]({},_0x32a3ec,_0xd54c8[_0x8742('0xce')]);return _0x25229b[_0x8742('0x112')](_0x32a3ec);}})[_0x8742('0xf')](function(_0x51b6fc){if(_0x51b6fc){_0x2c12f3=_0x51b6fc[_0x8742('0x67')];if(!_0xd54c8[_0x8742('0x3c')][_0x8742('0xd8')](_0x8742('0xd4'))){_0x32a3ec[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0xd54c8[_0x8742('0x3c')][_0x8742('0x1d')]);_0x32a3ec['offset']=qs['offset'](_0xd54c8[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x25229b[_0x8742('0x112')](_0x32a3ec);}})[_0x8742('0xf')](function(_0x49156e){if(_0x49156e){return _0x49156e?{'count':_0x2c12f3,'rows':_0x49156e}:null;}})[_0x8742('0xf')](respondWithResult(_0x42930f,null))[_0x8742('0x19')](handleError(_0x42930f,null));};exports[_0x8742('0x114')]=function(_0x18b4c3,_0x5919f4){return db[_0x8742('0x36')][_0x8742('0x2e')]({'where':{'id':_0x18b4c3[_0x8742('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5919f4,null))[_0x8742('0xf')](function(_0x8dd9f2){if(_0x8dd9f2){var _0x3bde0f=_0x8dd9f2['get']({'plain':!![]});return _0x8dd9f2[_0x8742('0x114')](_0x18b4c3[_0x8742('0x59')][_0x8742('0x5c')],_[_0x8742('0x115')](_0x18b4c3[_0x8742('0x59')],['ids','id'])||{})[_0x8742('0xf')](function(){for(var _0x147ba9=0x0;_0x147ba9<_0x18b4c3[_0x8742('0x59')][_0x8742('0x5c')][_0x8742('0x67')];_0x147ba9++){var _0x4f1e74=[];var _0x27b195={};db[_0x8742('0x113')][_0x8742('0xca')]({'where':{'id':_0x18b4c3[_0x8742('0x59')][_0x8742('0x5c')][_0x147ba9]}})[_0x8742('0xf')](function(_0xcc6a11){_0x27b195=_0xcc6a11[_0x8742('0x48')];_0x4f1e74[_0x8742('0x43')](_0xcc6a11['getVoiceQueues']()[_0x8742('0xf')](function(_0x3d0980){for(var _0xaf4284=0x0;_0xaf4284<_0x3d0980[_0x8742('0x67')];_0xaf4284++){_0x3d0980[_0xaf4284][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x117'));}return _0x3d0980;}));_0x4f1e74[_0x8742('0x43')](_0xcc6a11[_0x8742('0x118')]()['then'](function(_0x59ebb1){for(var _0x130c2e=0x0;_0x130c2e<_0x59ebb1[_0x8742('0x67')];_0x130c2e++){_0x59ebb1[_0x130c2e]['setDataValue']('channel',_0x8742('0x119'));}return _0x59ebb1;}));_0x4f1e74[_0x8742('0x43')](_0xcc6a11[_0x8742('0x11a')]()[_0x8742('0xf')](function(_0x33f408){for(var _0x1a4e32=0x0;_0x1a4e32<_0x33f408[_0x8742('0x67')];_0x1a4e32++){_0x33f408[_0x1a4e32][_0x8742('0x116')]('channel',_0x8742('0x11b'));}return _0x33f408;}));_0x4f1e74[_0x8742('0x43')](_0xcc6a11[_0x8742('0x11c')]()['then'](function(_0x5cb5c2){for(var _0x56feca=0x0;_0x56feca<_0x5cb5c2[_0x8742('0x67')];_0x56feca++){_0x5cb5c2[_0x56feca]['setDataValue'](_0x8742('0x9c'),_0x8742('0x11d'));}return _0x5cb5c2;}));_0x4f1e74[_0x8742('0x43')](_0xcc6a11[_0x8742('0x11e')]()[_0x8742('0xf')](function(_0x16d228){for(var _0x2799f4=0x0;_0x2799f4<_0x16d228['length'];_0x2799f4++){_0x16d228[_0x2799f4][_0x8742('0x116')]('channel',_0x8742('0x11f'));}return _0x16d228;}));_0x4f1e74[_0x8742('0x43')](_0xcc6a11[_0x8742('0x120')]()[_0x8742('0xf')](function(_0x4714ef){for(var _0x27605d=0x0;_0x27605d<_0x4714ef[_0x8742('0x67')];_0x27605d++){_0x4714ef[_0x27605d][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x121'));}return _0x4714ef;}));_0x4f1e74['push'](_0xcc6a11[_0x8742('0x122')]()[_0x8742('0xf')](function(_0x122363){for(var _0x168af1=0x0;_0x168af1<_0x122363[_0x8742('0x67')];_0x168af1++){_0x122363[_0x168af1][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x123'));}return _0x122363;}));return BPromise['all'](_0x4f1e74);})[_0x8742('0xf')](function(_0x43b42a){var _0x3c0c62=_[_0x8742('0x124')](_0x43b42a);_0x4f1e74=[];return db[_0x8742('0x63')][_0x8742('0x125')](function(_0x52a80e){for(var _0x53bb5c=0x0;_0x53bb5c<_0x3c0c62[_0x8742('0x67')];_0x53bb5c++){_0x4f1e74['push'](_0x3c0c62[_0x53bb5c][_0x8742('0x126')](_0x3bde0f['id']),{'transaction':_0x52a80e});}return BPromise[_0x8742('0x4c')](_0x4f1e74)[_0x8742('0xf')](function(){if(_0x3bde0f['online']){return BPromise['each'](_[_0x8742('0x2a')](_0x3c0c62,function(_0x3e72d0){return _0x3e72d0[_0x8742('0x127')](_0x8742('0x9c'))==='Voice';}),function(_0xf1c2b0){return db[_0x8742('0xad')][_0x8742('0xae')]({'membername':_0x3bde0f[_0x8742('0x30')],'UserId':_0x3bde0f['id'],'queue_name':_0xf1c2b0[_0x8742('0x30')],'VoiceQueueId':_0xf1c2b0['id'],'interface':_[_0x8742('0x61')](_0x3bde0f[_0x8742('0x9e')])?util[_0x8742('0xaa')](_0x8742('0xab'),_0x3bde0f[_0x8742('0x30')]):_0x3bde0f[_0x8742('0x9e')],'paused':_0x3bde0f[_0x8742('0xac')]||![],'penalty':_0x3bde0f[_0x8742('0xa3')]},{'transaction':_0x52a80e});});}else{return;}})[_0x8742('0xf')](function(){for(var _0x4513c7=0x0;_0x4513c7<_0x3c0c62['length'];_0x4513c7++){var _0x51bc42=_0x3c0c62[_0x4513c7]['getDataValue']('channel');var _0x392220=_0x51bc42+'QueueId';socket[_0x8742('0xb3')]('user'+_0x51bc42+_0x8742('0xa7'),{'UserId':_0x3bde0f['id'],['queueField']:_0x3c0c62[_0x4513c7]['id']});}});});})[_0x8742('0xf')](function(){db[_0x8742('0x128')][_0x8742('0xca')]({'where':{'teamId':_0x27b195['id']}})['then'](function(_0x78a940){if(_0x78a940){db[_0x8742('0x129')][_0x8742('0x7d')]({'UserId':_0x18b4c3[_0x8742('0x4e')]['id'],'VoicePrefixId':_0x78a940[_0x8742('0x12a')]});}});});}});}})[_0x8742('0xf')](respondWithStatusCode(_0x5919f4,null))[_0x8742('0x19')](handleError(_0x5919f4,null));};exports[_0x8742('0x12b')]=function(_0x4fb62f,_0x4084f7){return db['User']['findOne']({'where':{'id':_0x4fb62f[_0x8742('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4084f7,null))[_0x8742('0xf')](function(_0x322b81){if(_0x322b81){var _0x167e64=_0x322b81['get']({'plain':!![]});var _0xd13ed9=_0x4fb62f['query']['ids'];return _0x322b81[_0x8742('0x12b')](_0xd13ed9)[_0x8742('0xf')](function(){for(var _0x1d0340=0x0;_0x1d0340<_0xd13ed9['length'];_0x1d0340++){var _0x1e290f=[];var _0x130149={};db[_0x8742('0x113')][_0x8742('0xca')]({'where':{'id':_0xd13ed9[_0x1d0340]}})[_0x8742('0xf')](function(_0x3030a1){_0x130149=_0x3030a1['dataValues'];_0x1e290f[_0x8742('0x43')](_0x3030a1[_0x8742('0x12c')]()['then'](function(_0x345953){for(var _0x1e74da=0x0;_0x1e74da<_0x345953[_0x8742('0x67')];_0x1e74da++){_0x345953[_0x1e74da][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x117'));}return _0x345953;}));_0x1e290f[_0x8742('0x43')](_0x3030a1[_0x8742('0x118')]()[_0x8742('0xf')](function(_0x17d3f9){for(var _0x5dfe0e=0x0;_0x5dfe0e<_0x17d3f9['length'];_0x5dfe0e++){_0x17d3f9[_0x5dfe0e][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x119'));}return _0x17d3f9;}));_0x1e290f['push'](_0x3030a1[_0x8742('0x11a')]()['then'](function(_0x587309){for(var _0x39ec26=0x0;_0x39ec26<_0x587309[_0x8742('0x67')];_0x39ec26++){_0x587309[_0x39ec26][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x11b'));}return _0x587309;}));_0x1e290f['push'](_0x3030a1[_0x8742('0x11c')]()[_0x8742('0xf')](function(_0x231640){for(var _0x4449f7=0x0;_0x4449f7<_0x231640[_0x8742('0x67')];_0x4449f7++){_0x231640[_0x4449f7][_0x8742('0x116')](_0x8742('0x9c'),_0x8742('0x11d'));}return _0x231640;}));_0x1e290f[_0x8742('0x43')](_0x3030a1[_0x8742('0x11e')]()[_0x8742('0xf')](function(_0x1c059d){for(var _0xe9795f=0x0;_0xe9795f<_0x1c059d[_0x8742('0x67')];_0xe9795f++){_0x1c059d[_0xe9795f]['setDataValue'](_0x8742('0x9c'),_0x8742('0x11f'));}return _0x1c059d;}));_0x1e290f[_0x8742('0x43')](_0x3030a1['getFaxQueues']()['then'](function(_0x464fdd){for(var _0x3ad48b=0x0;_0x3ad48b<_0x464fdd[_0x8742('0x67')];_0x3ad48b++){_0x464fdd[_0x3ad48b][_0x8742('0x116')]('channel','Fax');}return _0x464fdd;}));_0x1e290f[_0x8742('0x43')](_0x3030a1[_0x8742('0x122')]()[_0x8742('0xf')](function(_0x122d6c){for(var _0x4d7a67=0x0;_0x4d7a67<_0x122d6c[_0x8742('0x67')];_0x4d7a67++){_0x122d6c[_0x4d7a67][_0x8742('0x116')](_0x8742('0x9c'),'Openchannel');}return _0x122d6c;}));return BPromise[_0x8742('0x4c')](_0x1e290f);})[_0x8742('0xf')](function(_0x232e3a){var _0x3193bc=_['flatten'](_0x232e3a);_0x1e290f=[];return db[_0x8742('0x63')]['transaction'](function(_0x2dc78f){for(var _0x55fc10=0x0;_0x55fc10<_0x3193bc[_0x8742('0x67')];_0x55fc10++){_0x1e290f[_0x8742('0x43')](_0x3193bc[_0x55fc10][_0x8742('0x12d')](_0x167e64['id']),{'transaction':_0x2dc78f});}return BPromise[_0x8742('0x4c')](_0x1e290f)['then'](function(){if(_0x167e64[_0x8742('0x9d')]){return BPromise[_0x8742('0x88')](_[_0x8742('0x2a')](_0x3193bc,function(_0x4e0d0c){return _0x4e0d0c['getDataValue']('channel')===_0x8742('0x117');}),function(_0x1d7589){return db[_0x8742('0xad')][_0x8742('0x23')]({'where':{'VoiceQueueId':_0x1d7589['id'],'UserId':_0x167e64['id']},'transaction':_0x2dc78f});});}else{return;}})[_0x8742('0xf')](function(){db[_0x8742('0x128')][_0x8742('0xca')]({'where':{'teamId':_0x130149['id']}})['then'](function(_0xd11878){if(_0xd11878){return db['UserVoicePrefix'][_0x8742('0x23')]({'where':{'UserId':_0x167e64['id'],'VoicePrefixId':_0xd11878[_0x8742('0x48')][_0x8742('0x12a')]}});}});})['then'](function(){for(var _0x24df5b=0x0;_0x24df5b<_0x3193bc['length'];_0x24df5b++){var _0x119728=_0x3193bc[_0x24df5b][_0x8742('0x127')](_0x8742('0x9c'));var _0x64dac3=_0x119728+_0x8742('0xa6');socket[_0x8742('0xb3')](_0x8742('0x7e')+_0x119728+'Queue:remove',{'UserId':_0x167e64['id'],['queueField']:_0x3193bc[_0x24df5b]['id']});}});});});}});}})[_0x8742('0xf')](respondWithStatusCode(_0x4084f7,null))[_0x8742('0x19')](handleError(_0x4084f7,null));};exports[_0x8742('0x12e')]=function(_0x5e100a,_0x5e088e){var _0x2fbccf={};var _0x98caa6={};var _0x5a981f;var _0x430d06;return db[_0x8742('0x36')]['findOne']({'where':{'id':_0x5e100a['params']['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x5e088e,null))[_0x8742('0xf')](function(_0x184fc3){if(_0x184fc3){_0x5a981f=_0x184fc3;_0x98caa6['model']=_[_0x8742('0x51')](db[_0x8742('0xcf')][_0x8742('0x37')]);_0x98caa6['query']=_[_0x8742('0x51')](_0x5e100a['query']);_0x98caa6[_0x8742('0x53')]=_['intersection'](_0x98caa6['model'],_0x98caa6['query']);_0x2fbccf[_0x8742('0x42')]=_[_0x8742('0x54')](_0x98caa6[_0x8742('0x4f')],qs[_0x8742('0x55')](_0x5e100a['query'][_0x8742('0x55')]));_0x2fbccf[_0x8742('0x42')]=_0x2fbccf[_0x8742('0x42')]['length']?_0x2fbccf['attributes']:_0x98caa6[_0x8742('0x4f')];_0x2fbccf[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0x5e100a[_0x8742('0x3c')][_0x8742('0xcc')]);_0x2fbccf[_0x8742('0x3b')]=qs['filters'](_[_0x8742('0xcd')](_0x5e100a[_0x8742('0x3c')],_0x98caa6[_0x8742('0x53')]));if(_0x5e100a[_0x8742('0x3c')]['filter']){_0x2fbccf[_0x8742('0x3b')]=_[_0x8742('0x56')](_0x2fbccf[_0x8742('0x3b')],{'$or':_[_0x8742('0x38')](_0x2fbccf[_0x8742('0x42')],function(_0x3edfc5){var _0x5eab4e={};_0x5eab4e[_0x3edfc5]={'$like':'%'+_0x5e100a[_0x8742('0x3c')][_0x8742('0x2a')]+'%'};return _0x5eab4e;})});}_0x2fbccf=_[_0x8742('0x56')]({},_0x2fbccf,_0x5e100a[_0x8742('0xce')]);return _0x5a981f[_0x8742('0x12e')](_0x2fbccf);}})[_0x8742('0xf')](function(_0x380f8e){if(_0x380f8e){_0x430d06=_0x380f8e[_0x8742('0x67')];if(!_0x5e100a[_0x8742('0x3c')]['hasOwnProperty'](_0x8742('0xd4'))){_0x2fbccf[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x5e100a[_0x8742('0x3c')][_0x8742('0x1d')]);_0x2fbccf['offset']=qs[_0x8742('0x1c')](_0x5e100a[_0x8742('0x3c')][_0x8742('0x1c')]);}return _0x5a981f['getLists'](_0x2fbccf);}})['then'](function(_0x3f52d2){if(_0x3f52d2){return _0x3f52d2?{'count':_0x430d06,'rows':_0x3f52d2}:null;}})['then'](respondWithResult(_0x5e088e,null))[_0x8742('0x19')](handleError(_0x5e088e,null));};exports[_0x8742('0x12f')]=function(_0xfbf9e0,_0x3f314e){var _0x245c7b={};var _0x2ec73b={};var _0x1dd630;return db['User'][_0x8742('0xca')]({'where':{'id':_0xfbf9e0[_0x8742('0x4e')]['id']}})[_0x8742('0xf')](handleEntityNotFound(_0x3f314e,null))['then'](function(_0xbc4a15){if(_0xbc4a15){_0x1dd630=_0xbc4a15;_0x2ec73b[_0x8742('0x4f')]=_[_0x8742('0x51')](db[_0x8742('0x36')][_0x8742('0x37')]);_0x2ec73b['query']=_['keys'](_0xfbf9e0[_0x8742('0x3c')]);_0x2ec73b[_0x8742('0x53')]=_['intersection'](_0x2ec73b[_0x8742('0x4f')],_0x2ec73b[_0x8742('0x3c')]);_0x245c7b[_0x8742('0x42')]=_['intersection'](_0x2ec73b[_0x8742('0x4f')],qs[_0x8742('0x55')](_0xfbf9e0[_0x8742('0x3c')][_0x8742('0x55')]));_0x245c7b[_0x8742('0x42')]=_0x245c7b['attributes'][_0x8742('0x67')]?_0x245c7b[_0x8742('0x42')]:_0x2ec73b[_0x8742('0x4f')];_0x245c7b[_0x8742('0xcb')]=qs[_0x8742('0xcc')](_0xfbf9e0[_0x8742('0x3c')][_0x8742('0xcc')]);_0x245c7b[_0x8742('0x3b')]=qs['filters'](_[_0x8742('0xcd')](_0xfbf9e0['query'],_0x2ec73b[_0x8742('0x53')]));if(_0xfbf9e0[_0x8742('0x3c')][_0x8742('0x2a')]){_0x245c7b['where']=_[_0x8742('0x56')](_0x245c7b['where'],{'$or':_[_0x8742('0x38')](_0x245c7b['attributes'],function(_0x431137){var _0x176cfc={};_0x176cfc[_0x431137]={'$like':'%'+_0xfbf9e0[_0x8742('0x3c')]['filter']+'%'};return _0x176cfc;})});}_0x245c7b['model']=db[_0x8742('0x36')];_0x245c7b['as']=_0x8742('0x27');_0x245c7b=_['merge']({},_0x245c7b,_0xfbf9e0[_0x8742('0xce')]);return _0x1dd630[_0x8742('0x12c')]({'include':[_0x245c7b]});}})[_0x8742('0xf')](function(_0x2643dd){if(_0x2643dd){var _0x1e6bbb={},_0x4f4221=[];for(var _0x35d24f=0x0;_0x35d24f<_0x2643dd[_0x8742('0x67')];_0x35d24f+=0x1){for(var _0x46c9c9=0x0,_0x40b4fa;_0x46c9c9<_0x2643dd[_0x35d24f][_0x8742('0x27')]['length'];_0x46c9c9+=0x1){_0x40b4fa=_0x2643dd[_0x35d24f][_0x8742('0x27')][_0x46c9c9]['get']({'plain':!![]});_0x1e6bbb[_0x40b4fa['id']]=_0x40b4fa;}}_0x1e6bbb=_[_0x8742('0x130')](_0x1e6bbb);for(var _0x59f1bf=qs[_0x8742('0x1c')](_0xfbf9e0[_0x8742('0x3c')][_0x8742('0x1c')]);_0x59f1bf<_0x1e6bbb[_0x8742('0x67')]&&_0x4f4221[_0x8742('0x67')]=_0x271ac7){_0x1206ca=_0x271ac7;_0xcfa42c=0xc8;}else{_0xcfa42c=0xce;}_0x542a8c['status'](_0xcfa42c);return _0x542a8c[_0x60ac('0x26')]('Content-Range',_0x164a58+'-'+_0x1206ca+'/'+_0x271ac7)[_0x60ac('0x21')](_0x3807d3);}return null;};}function saveUpdates(_0x21e41b){return function(_0x58d9c0){if(_0x58d9c0){return _0x58d9c0[_0x60ac('0x27')](_0x21e41b)[_0x60ac('0x15')](function(_0x2b64ad){return _0x2b64ad;});}return null;};}function removeEntity(_0x3188c0){return function(_0x4cb9d7){if(_0x4cb9d7){return _0x4cb9d7[_0x60ac('0x28')]()[_0x60ac('0x15')](function(){var _0x16d2c1=_0x4cb9d7['get']({'plain':!![]});if(_0x16d2c1[_0x60ac('0x29')]===_0x60ac('0x2a'))return;var _0x35f2e9=[{'name':'Users','value':_0x60ac('0x2b'),'ignore':!![]},{'name':'Agents','value':_0x60ac('0x2c'),'ignore':![]},{'name':'Telephones','value':_0x60ac('0x2d'),'ignore':![]}];var _0x1f5859=_(_0x35f2e9)[_0x60ac('0x2e')](_0x60ac('0x2f'))[_0x60ac('0x30')](_0x60ac('0x31'))['value']();if(_['includes'](_0x1f5859,_0x16d2c1['role'])){return;}var _0x186221=_[_0x60ac('0x32')](_0x35f2e9,[_0x60ac('0x31'),_0x16d2c1[_0x60ac('0x29')]])[_0x60ac('0x33')];return db['UserProfileResource'][_0x60ac('0x28')]({'where':{'type':_0x186221,'resourceId':_0x16d2c1['id']}})[_0x60ac('0x15')](function(){return _0x4cb9d7;});})[_0x60ac('0x15')](function(){_0x3188c0[_0x60ac('0x1f')](0xcc)[_0x60ac('0x20')]();});}};}function handleEntityNotFound(_0x5d901c){return function(_0x1312fc){if(!_0x1312fc){_0x5d901c[_0x60ac('0x1e')](0x194);}return _0x1312fc;};}function handleError(_0x30e8ac,_0x1aadd1){_0x1aadd1=_0x1aadd1||0x1f4;return function(_0x2a3b63){logger[_0x60ac('0x19')](_0x2a3b63[_0x60ac('0x34')]);if(_0x2a3b63['name']){delete _0x2a3b63['name'];}_0x30e8ac[_0x60ac('0x1f')](_0x1aadd1)['send'](_0x2a3b63);};}exports[_0x60ac('0x35')]=function(_0x10224d,_0xa38c89){var _0x190302={},_0x3dedc4={'count':0x0,'rows':[]};var _0x45e07f=_(db['User']['rawAttributes'])['map'](function(_0x41f063){return{'name':_0x41f063[_0x60ac('0x36')],'type':_0x41f063[_0x60ac('0x37')][_0x60ac('0x38')]};})['filter'](function(_0x536f0d){return!_['includes'](['password',_0x60ac('0x39')],_0x536f0d[_0x60ac('0x33')]);})['value']();_0x190302=qs[_0x60ac('0x3a')](_0x45e07f,_0x10224d);var _0x2ba07b={'where':_0x190302['where']};return db[_0x60ac('0x3b')]['count'](_0x2ba07b)['then'](function(_0x42c54d){_0x3dedc4[_0x60ac('0x25')]=_0x42c54d;if(_0x10224d['query'][_0x60ac('0x3c')]){_0x190302[_0x60ac('0x3d')]=[{'all':!![]}];}if(_0x10224d['query']['userSetting']===_0x60ac('0x3e')){_0x190302[_0x60ac('0x3d')]=[{'model':db[_0x60ac('0x3f')],'as':_0x60ac('0x40')}];}if(!_['includes'](_0x190302[_0x60ac('0x41')],'id')){_0x190302['attributes'][_0x60ac('0x42')]('id');}return db[_0x60ac('0x3b')][_0x60ac('0x43')](_0x190302);})[_0x60ac('0x15')](function(_0x30d3da){_0x3dedc4[_0x60ac('0x44')]=_0x30d3da;if(_0x10224d[_0x60ac('0x45')][_0x60ac('0x46')]==='true'){var _0x27172c=[];for(var _0x116154=0x0;_0x116154<_0x3dedc4['rows']['length'];_0x116154++){_0x27172c[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x47'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));_0x27172c['push'](get_open_tabs(_0x60ac('0x49'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));_0x27172c['push'](get_open_tabs(_0x60ac('0x4a'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));_0x27172c['push'](get_open_tabs(_0x60ac('0x4b'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));_0x27172c[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4c'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));_0x27172c[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4d'),_0x3dedc4[_0x60ac('0x44')][_0x116154][_0x60ac('0x48')]));}return BPromise[_0x60ac('0x4e')](_0x27172c)[_0x60ac('0x15')](function(){return _0x3dedc4;});}else{return _0x3dedc4;}})[_0x60ac('0x15')](respondWithFilteredResult(_0xa38c89,_0x190302))['catch'](handleError(_0xa38c89,null));};exports[_0x60ac('0x4f')]=function(_0x474977,_0x2fb98a){var _0x1b0acf={'raw':![],'where':{'id':_0x474977[_0x60ac('0x50')]['id']}},_0x55c72b={};_0x55c72b[_0x60ac('0x51')]=_[_0x60ac('0x52')](_[_0x60ac('0x53')](db[_0x60ac('0x3b')][_0x60ac('0x54')]),[_0x60ac('0x55'),_0x60ac('0x39')]);_0x55c72b[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x474977['query']);_0x55c72b[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x55c72b[_0x60ac('0x51')],_0x55c72b[_0x60ac('0x45')]);_0x1b0acf[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x55c72b['model'],qs['fields'](_0x474977[_0x60ac('0x45')]['fields']));_0x1b0acf[_0x60ac('0x41')]=_0x1b0acf[_0x60ac('0x41')][_0x60ac('0x58')]?_0x1b0acf[_0x60ac('0x41')]:_0x55c72b[_0x60ac('0x51')];if(_0x474977[_0x60ac('0x45')][_0x60ac('0x3c')]){_0x1b0acf['include']=[{'all':!![]}];}if(_0x474977['query'][_0x60ac('0x40')]===_0x60ac('0x3e')){_0x1b0acf[_0x60ac('0x3d')]=[{'model':db['UserSetting'],'as':_0x60ac('0x40')}];}_0x1b0acf=_[_0x60ac('0x59')]({},_0x1b0acf,_0x474977[_0x60ac('0x5a')]);if(!_[_0x60ac('0x5b')](_0x1b0acf[_0x60ac('0x41')],'id')){_0x1b0acf[_0x60ac('0x41')]['push']('id');}return db[_0x60ac('0x3b')][_0x60ac('0x32')](_0x1b0acf)[_0x60ac('0x15')](handleEntityNotFound(_0x2fb98a,null))[_0x60ac('0x15')](function(_0x358b5e){var _0x2205f1=[];values=_0x358b5e;if(_0x474977['query']['openTabs']===_0x60ac('0x3e')){_0x2205f1['push'](get_open_tabs('chat',_0x358b5e[_0x60ac('0x48')]));_0x2205f1[_0x60ac('0x42')](get_open_tabs('sms',_0x358b5e[_0x60ac('0x48')]));_0x2205f1[_0x60ac('0x42')](get_open_tabs('openchannel',_0x358b5e['dataValues']));_0x2205f1[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4d'),_0x358b5e[_0x60ac('0x48')]));_0x2205f1[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4a'),_0x358b5e[_0x60ac('0x48')]));_0x2205f1[_0x60ac('0x42')](get_open_tabs('mail',_0x358b5e['dataValues']));return BPromise[_0x60ac('0x4e')](_0x2205f1);}else{return values;}})[_0x60ac('0x15')](function(){return values;})[_0x60ac('0x15')](respondWithResult(_0x2fb98a,null))[_0x60ac('0x5c')](handleError(_0x2fb98a,null));};exports[_0x60ac('0x27')]=function(_0x22465b,_0x14813c){if(_0x22465b[_0x60ac('0x5d')]['id']){delete _0x22465b[_0x60ac('0x5d')]['id'];}delete _0x22465b[_0x60ac('0x5d')][_0x60ac('0x29')];return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x22465b[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x14813c,null))[_0x60ac('0x15')](saveUpdates(_0x22465b[_0x60ac('0x5d')],null))['then'](respondWithResult(_0x14813c,null))[_0x60ac('0x5c')](handleError(_0x14813c,null));};exports[_0x60ac('0x5e')]=function(_0x5266cc,_0x37a35e){return db[_0x60ac('0x3b')][_0x60ac('0x5e')]()[_0x60ac('0x15')](respondWithResult(_0x37a35e,null))[_0x60ac('0x5c')](handleError(_0x37a35e,null));};exports[_0x60ac('0x5f')]=function(_0xe8f0f7,_0x1a4742){return db[_0x60ac('0x3b')]['find']({'where':{'id':_0xe8f0f7[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x1a4742,null))[_0x60ac('0x15')](function(_0xdc38fe){if(_0xdc38fe){return _0xdc38fe[_0x60ac('0x5f')](_0xe8f0f7[_0x60ac('0x5d')][_0x60ac('0x60')],_[_0x60ac('0x61')](_0xe8f0f7['body'],['ids','id'])||{});}})[_0x60ac('0x15')](respondWithResult(_0x1a4742,null))[_0x60ac('0x5c')](handleError(_0x1a4742,null));};function validateUser(_0x4fc063){return new BPromise(function(_0x39fa39,_0x57c8ee){if(_0x4fc063[_0x60ac('0x62')])return _0x39fa39(_0x4fc063);return db[_0x60ac('0x63')][_0x60ac('0x64')](0x1)[_0x60ac('0x15')](function(_0x594772){if(_0x594772[_0x60ac('0x65')])authService[_0x60ac('0x66')](_0x4fc063['password']);db['User'][_0x60ac('0x67')](_0x60ac('0x62'))['then'](function(_0x3fdc1d){if(_['isNil'](_0x3fdc1d)){_0x4fc063[_0x60ac('0x62')]=_0x594772['min_internal']||0x1;return;}if(_[_0x60ac('0x68')](_0x594772[_0x60ac('0x69')])||_0x594772[_0x60ac('0x69')]===_0x3fdc1d){_0x4fc063[_0x60ac('0x62')]=_0x3fdc1d+0x1;return;}if(_0x594772[_0x60ac('0x69')]>_0x3fdc1d){_0x4fc063['internal']=_0x594772['min_internal'];return;}return db['sequelize'][_0x60ac('0x45')](_0x60ac('0x6a'),{'type':db['sequelize'][_0x60ac('0x6b')][_0x60ac('0x6c')]})['then'](function(_0x2cb281){if(_0x2cb281&&_0x2cb281['length']){for(var _0x5bb3ef=0x0,_0x2dd43a=_0x2cb281[_0x60ac('0x58')];_0x5bb3ef<_0x2dd43a&&_[_0x60ac('0x68')](_0x4fc063['internal']);_0x5bb3ef++){if(_0x594772[_0x60ac('0x69')]<=_0x2cb281[_0x5bb3ef][_0x60ac('0x6d')]){_0x4fc063[_0x60ac('0x62')]=_0x2cb281[_0x5bb3ef][_0x60ac('0x6d')];}else if(_0x594772['min_internal']>_0x2cb281[_0x5bb3ef][_0x60ac('0x6d')]&&_0x594772[_0x60ac('0x69')]<=_0x2cb281[_0x5bb3ef]['to']){_0x4fc063[_0x60ac('0x62')]=_0x594772[_0x60ac('0x69')];}}}if(_[_0x60ac('0x68')](_0x4fc063[_0x60ac('0x62')])){_0x4fc063['internal']=_0x3fdc1d+0x1;}return _0x39fa39(_0x4fc063);});});})['catch'](function(_0x3a669b){_0x57c8ee(_0x3a669b);});});}function updateUser(_0x2cb04a){return new BPromise(function(_0x17bae1,_0x3bc465){try{if(_0x2cb04a[_0x60ac('0x6e')]){_0x2cb04a[_0x60ac('0x6f')]=_0x2cb04a[_0x60ac('0x62')];_0x2cb04a[_0x60ac('0x70')]={'mailbox':_0x2cb04a[_0x60ac('0x62')],'password':_0x2cb04a['password'],'fullname':_0x2cb04a[_0x60ac('0x71')],'email':_0x2cb04a[_0x60ac('0x72')]};}if(_0x2cb04a[_0x60ac('0x29')]===_0x60ac('0x2c')){if(!_0x2cb04a[_0x60ac('0x73')])_0x2cb04a[_0x60ac('0x73')]=[_0x60ac('0x74'),'102',_0x60ac('0x75'),_0x60ac('0x76'),'110',_0x60ac('0x77'),_0x60ac('0x78'),_0x60ac('0x79'),'107','108',_0x60ac('0x7a'),_0x60ac('0x7b'),'111',_0x60ac('0x7c'),_0x60ac('0x7d')];}_0x17bae1(_0x2cb04a);}catch(_0x308e3d){_0x3bc465(_0x308e3d);}});}exports[_0x60ac('0x7e')]=function(_0x40e263,_0x5ea8d5){if(_0x40e263[_0x60ac('0x2b')][_0x60ac('0x29')]===_0x60ac('0x2c'))throw new Error(_0x60ac('0x7f'));if(_0x40e263[_0x60ac('0x5d')][_0x60ac('0x29')]===_0x60ac('0x2b')&&_0x40e263[_0x60ac('0x2b')][_0x60ac('0x29')]!==_0x60ac('0x2a')){throw new Error(_0x60ac('0x80'));}if(_0x40e263[_0x60ac('0x5d')][_0x60ac('0x29')]===_0x60ac('0x2a')&&_0x40e263[_0x60ac('0x2b')][_0x60ac('0x29')]!==_0x60ac('0x2a')){throw new Error(_0x60ac('0x81'));}return licenseUtil[_0x60ac('0x82')]([_0x40e263[_0x60ac('0x5d')]])['then'](function(){return validateUser(_0x40e263['body']);})[_0x60ac('0x15')](function(_0x37eaf6){return updateUser(_0x37eaf6)['then'](function(_0x11cf22){if(_0x11cf22[_0x60ac('0x29')]==='admin'){_0x11cf22[_0x60ac('0x83')]=_0x40e263['user'][_0x60ac('0x83')];delete _0x11cf22['userProfileId'];}return _0x11cf22;});})['then'](function(_0x52ddc5){return db[_0x60ac('0x3b')]['create'](_0x52ddc5,{'include':[{'model':db[_0x60ac('0x70')],'as':_0x60ac('0x70')}]});})[_0x60ac('0x15')](function(_0x17ca13){if(_0x40e263['body'][_0x60ac('0x29')]===_0x60ac('0x2b'))return _0x17ca13;if(_0x40e263['user'][_0x60ac('0x29')]!==_0x60ac('0x2b'))return _0x17ca13;return db[_0x60ac('0x84')]['find']({'where':{'name':_0x17ca13['role']===_0x60ac('0x2c')?_0x60ac('0x85'):'Telephones','userProfileId':_0x40e263['user'][_0x60ac('0x86')]},'raw':!![]})[_0x60ac('0x15')](function(_0x5e796e){if(!_0x5e796e||_0x5e796e['autoAssociation']!=0x0)return _0x17ca13;return db['UserProfileResource']['create']({'name':_0x17ca13[_0x60ac('0x33')],'resourceId':_0x17ca13['id'],'type':_0x5e796e[_0x60ac('0x33')],'sectionId':_0x5e796e['id']},{})[_0x60ac('0x15')](function(){return _0x17ca13;});})[_0x60ac('0x5c')](function(_0x5e4ad1){logger[_0x60ac('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e4ad1);throw _0x5e4ad1;});})['then'](respondWithResult(_0x5ea8d5,0xc9))[_0x60ac('0x5c')](handleError(_0x5ea8d5,null));};exports[_0x60ac('0x87')]=function(_0x5ab345,_0x2cdba8){var _0x58472b=_0x5ab345[_0x60ac('0x5d')];var _0x1dce12=[];if(_0x5ab345[_0x60ac('0x2b')][_0x60ac('0x29')]===_0x60ac('0x2c'))throw new Error(_0x60ac('0x7f'));if(_['some'](_0x58472b,[_0x60ac('0x29'),'user'])&&_0x5ab345[_0x60ac('0x2b')][_0x60ac('0x29')]!==_0x60ac('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x60ac('0x88')](_0x58472b,[_0x60ac('0x29'),'admin'])&&_0x5ab345[_0x60ac('0x2b')][_0x60ac('0x29')]!==_0x60ac('0x2a')){throw new Error(_0x60ac('0x89'));}return licenseUtil[_0x60ac('0x82')](_0x58472b)[_0x60ac('0x15')](function(){return validateUser(_0x58472b[0x0]);})[_0x60ac('0x15')](function(){for(var _0x1750dc=0x1;_0x1750dc<_0x58472b[_0x60ac('0x58')];_0x1750dc++){var _0xb998af=_0x58472b[_0x1750dc-0x1][_0x60ac('0x62')];if(!_0x58472b[_0x1750dc]['internal'])_0x58472b[_0x1750dc][_0x60ac('0x62')]=_0xb998af+0x1;_0x1dce12[_0x60ac('0x42')](validateUser(_0x58472b[_0x1750dc]));}return BPromise[_0x60ac('0x4e')](_0x1dce12);})[_0x60ac('0x15')](function(){_0x1dce12=[];for(var _0x49bd67=0x0;_0x49bd67<_0x58472b[_0x60ac('0x58')];_0x49bd67++){_0x1dce12[_0x60ac('0x42')](updateUser(_0x58472b[_0x49bd67]));}return BPromise[_0x60ac('0x4e')](_0x1dce12);})[_0x60ac('0x15')](function(){return BPromise['each'](_0x58472b,function(_0x3f44bd){return db[_0x60ac('0x3b')][_0x60ac('0x7e')](_0x3f44bd,{'include':[{'model':db[_0x60ac('0x70')],'as':_0x60ac('0x70')}]})[_0x60ac('0x15')](function(_0x394186){_0x3f44bd['id']=_0x394186['id'];return _0x3f44bd;});});})[_0x60ac('0x15')](function(_0x53defb){if(_0x5ab345['body']['role']===_0x60ac('0x2b'))return _0x53defb;if(_0x5ab345['user'][_0x60ac('0x29')]!==_0x60ac('0x2b'))return _0x53defb;var _0x49dbc0=_[_0x60ac('0x88')](_0x53defb,function(_0x27f57a){return _0x27f57a['role']===_0x60ac('0x2c')||_0x27f57a[_0x60ac('0x29')]==='telephone';});if(!_0x49dbc0)return _0x53defb;return db[_0x60ac('0x84')][_0x60ac('0x43')]({'where':{'name':{'$or':[_0x60ac('0x85'),_0x60ac('0x8a')]},'userProfileId':_0x5ab345[_0x60ac('0x2b')][_0x60ac('0x86')]},'raw':!![]})[_0x60ac('0x15')](function(_0x59a5cc){if(_[_0x60ac('0x8b')](_0x59a5cc)||!_['some'](_0x59a5cc,[_0x60ac('0x8c'),0x0]))return _0x53defb;_0x1dce12=[];var _0x4a3f63=_(_0x59a5cc)['map'](function(_0x334940){if(_0x334940[_0x60ac('0x8c')]===0x1)return;return _0x334940[_0x60ac('0x33')]==='Agents'?_0x60ac('0x2c'):'telephone';})['compact']()[_0x60ac('0x31')]();for(var _0x1c4da3=0x0;_0x1c4da3<_0x53defb[_0x60ac('0x58')];_0x1c4da3++){if(!_[_0x60ac('0x5b')](_0x4a3f63,_0x53defb[_0x1c4da3]['role']))return;var _0x37820=_0x53defb[_0x1c4da3][_0x60ac('0x29')]===_0x60ac('0x2c')?_0x60ac('0x85'):_0x60ac('0x8a');_0x1dce12['push'](db['UserProfileResource'][_0x60ac('0x7e')]({'name':_0x53defb[_0x1c4da3][_0x60ac('0x33')],'resourceId':_0x53defb[_0x1c4da3]['id'],'type':_0x37820,'sectionId':_[_0x60ac('0x32')](_0x59a5cc,[_0x60ac('0x33'),_0x37820])['id']},{}));}return BPromise[_0x60ac('0x4e')](_0x1dce12);});})[_0x60ac('0x15')](respondWithResult(_0x2cdba8,0xc9))[_0x60ac('0x5c')](handleError(_0x2cdba8,null));};exports[_0x60ac('0x8d')]=function(_0x4cef1f,_0x53c2cc){if(_0x4cef1f[_0x60ac('0x5d')]['id']){delete _0x4cef1f[_0x60ac('0x5d')]['id'];}return db['User'][_0x60ac('0x32')]({'where':{'id':_0x4cef1f[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](function(_0x501ffd){if(!_0x501ffd)return null;if(_0x501ffd['id']===_0x4cef1f[_0x60ac('0x2b')]['id']){if(!_0x4cef1f['body'][_0x60ac('0x8e')]||!_0x4cef1f[_0x60ac('0x5d')]['newPassword']){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x91'));}if(!_0x501ffd[_0x60ac('0x92')](_0x4cef1f['body'][_0x60ac('0x8e')])){throw new db['Sequelize'][(_0x60ac('0x90'))](_0x60ac('0x93'));}if(_0x4cef1f[_0x60ac('0x5d')][_0x60ac('0x8e')]===_0x4cef1f[_0x60ac('0x5d')][_0x60ac('0x94')]){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x95'));}}else if(_0x4cef1f[_0x60ac('0x2b')][_0x60ac('0x29')]===_0x60ac('0x2a')){if(!_0x4cef1f[_0x60ac('0x5d')][_0x60ac('0x94')]){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x96'));}}else if(_0x4cef1f[_0x60ac('0x2b')][_0x60ac('0x29')]==='user'){if(!_0x4cef1f[_0x60ac('0x5d')][_0x60ac('0x94')]){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x96'));}if(_0x501ffd[_0x60ac('0x29')]!==_0x60ac('0x2c')){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x7f'));}}else{throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0x7f'));}return _0x501ffd;})['then'](handleEntityNotFound(_0x53c2cc,null))[_0x60ac('0x15')](function(_0x210d12){return db[_0x60ac('0x63')][_0x60ac('0x97')]({'attributes':['id',_0x60ac('0x65'),_0x60ac('0x98'),_0x60ac('0x99')]})[_0x60ac('0x15')](function(_0x463c92){if(_0x463c92[_0x60ac('0x65')])authService[_0x60ac('0x66')](_0x4cef1f['body'][_0x60ac('0x94')]);if(!_0x463c92[_0x60ac('0x98')]||!_0x210d12[_0x60ac('0x9a')])return _0x210d12;authService[_0x60ac('0x9b')](_0x4cef1f['body']['newPassword'],_0x210d12['previousPasswords'],_0x463c92[_0x60ac('0x99')]);return _0x210d12;})[_0x60ac('0x15')](saveUpdates({'password':_0x4cef1f[_0x60ac('0x5d')]['newPassword'],'passwordResetAt':_0x4cef1f[_0x60ac('0x2b')]['id']==_0x4cef1f[_0x60ac('0x50')]['id']?moment():null,'previousPasswords':authService[_0x60ac('0x9c')](_0x4cef1f['body'][_0x60ac('0x94')],_0x210d12[_0x60ac('0x9a')])},null));})['then'](respondWithResult(_0x53c2cc,null))[_0x60ac('0x5c')](handleError(_0x53c2cc,null));};exports[_0x60ac('0x9d')]=function(_0x3e8a08,_0x51c8bc){var _0x37e351=_0x3e8a08[_0x60ac('0x5d')]['channel'];return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x3e8a08[_0x60ac('0x50')]['id']},'attributes':['id',_0x60ac('0x33'),'role',_0x60ac('0x9e'),_0x60ac('0x9f'),_0x60ac('0xa0'),_0x60ac('0xa1')]})[_0x60ac('0x15')](handleEntityNotFound(_0x51c8bc,null))[_0x60ac('0x15')](function(_0xe1e064){if(_0xe1e064){if(!utils[_0x60ac('0xa2')](_0x37e351)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0xe1e064['add'+_[_0x60ac('0xa3')](_0x37e351[_0x60ac('0xa4')]())+_0x60ac('0xa5')](_0x3e8a08['body']['ids'],{'penalty':_0x3e8a08[_0x60ac('0x5d')]['penalty']||0x0})[_0x60ac('0xa6')](function(_0x2db4a6){for(var _0x19604d=0x0;_0x19604d<_0x3e8a08[_0x60ac('0x5d')]['ids']['length'];_0x19604d+=0x1){var _0x56a742={'UserId':Number(_0x3e8a08[_0x60ac('0x50')]['id'])};_0x56a742[_['capitalize'](_0x37e351[_0x60ac('0xa4')]())+_0x60ac('0xa7')]=Number(_0x3e8a08[_0x60ac('0x5d')][_0x60ac('0x60')][_0x19604d]);socket[_0x60ac('0xa8')](_0x60ac('0x2b')+_[_0x60ac('0xa3')](_0x37e351[_0x60ac('0xa4')]())+_0x60ac('0xa9'),_0x56a742);}return _0x2db4a6;})[_0x60ac('0x15')](function(){if(_0x37e351===_0x60ac('0xaa')){return db[_0x60ac('0xab')][_0x60ac('0x43')]({'where':{'id':_0x3e8a08[_0x60ac('0x5d')]['ids']||[]},'raw':!![],'attributes':['id',_0x60ac('0x33')]});}})['then'](function(_0x3fc955){var _0x5c0087=_0xe1e064['get']({'plain':!![]});var _0x1cc1dd=[];if(_0x37e351===_0x60ac('0xaa')&&_0x5c0087[_0x60ac('0x29')]===_0x60ac('0x2c')&&_0x5c0087[_0x60ac('0x9e')]){for(var _0x293010=0x0;_0x293010<_0x3fc955[_0x60ac('0x58')];_0x293010+=0x1){_0x1cc1dd['push']({'membername':_0x5c0087['name'],'UserId':_0x5c0087['id'],'queue_name':_0x3fc955[_0x293010][_0x60ac('0x33')],'VoiceQueueId':_0x3fc955[_0x293010]['id'],'interface':_[_0x60ac('0x68')](_0x5c0087[_0x60ac('0xa1')])?util['format']('SIP/%s',_0x5c0087['name']):_0x5c0087['interface'],'paused':_0x5c0087[_0x60ac('0xa0')]||![],'penalty':_0x3e8a08['body'][_0x60ac('0xac')]||0x0});}return BPromise[_0x60ac('0xad')](_0x1cc1dd,function(_0x2b1506){return db['UserVoiceQueueRt'][_0x60ac('0xae')](_0x2b1506);});}return _0xe1e064;});}})[_0x60ac('0x15')](respondWithStatusCode(_0x51c8bc,null))['catch'](handleError(_0x51c8bc,null));};exports[_0x60ac('0xaf')]=function(_0xa462eb,_0x299761){var _0x11a1fc,_0x3e638a;return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0xa462eb[_0x60ac('0x50')]['id']},'attributes':['id','name',_0x60ac('0x29')]})[_0x60ac('0x15')](handleEntityNotFound(_0x299761,null))[_0x60ac('0x15')](function(_0x1eaa48){if(_0x1eaa48){_0x11a1fc=_0x1eaa48;if(!_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')]||!utils[_0x60ac('0xa2')](_0xa462eb['query'][_0x60ac('0xb0')])){throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))](_0x60ac('0xb1'));}return _0x1eaa48['remove'+_[_0x60ac('0xa3')](_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')][_0x60ac('0xa4')]())+_0x60ac('0xa5')](_0xa462eb['query'][_0x60ac('0x60')]);}})[_0x60ac('0x15')](function(_0x427e4b){if(_[_0x60ac('0xb2')](_0xa462eb['query'][_0x60ac('0x60')])){for(var _0x323492=0x0;_0x323492<_0xa462eb[_0x60ac('0x45')][_0x60ac('0x60')]['length'];_0x323492+=0x1){_0x3e638a={'UserId':Number(_0xa462eb['params']['id'])};_0x3e638a[_[_0x60ac('0xa3')](_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')][_0x60ac('0xa4')]())+_0x60ac('0xa7')]=Number(_0xa462eb[_0x60ac('0x45')][_0x60ac('0x60')][_0x323492]);socket[_0x60ac('0xa8')]('user'+_[_0x60ac('0xa3')](_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')][_0x60ac('0xa4')]())+_0x60ac('0xb3'),_0x3e638a);}}else{_0x3e638a={'UserId':Number(_0xa462eb['params']['id'])};_0x3e638a[_[_0x60ac('0xa3')](_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')][_0x60ac('0xa4')]())+_0x60ac('0xa7')]=Number(_0xa462eb[_0x60ac('0x45')][_0x60ac('0x60')]);socket[_0x60ac('0xa8')]('user'+_[_0x60ac('0xa3')](_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')][_0x60ac('0xa4')]())+_0x60ac('0xb3'),_0x3e638a);}return _0x427e4b;})['then'](function(){if(_0xa462eb[_0x60ac('0x45')][_0x60ac('0xb0')]==='voice'){return db[_0x60ac('0xb4')][_0x60ac('0x28')]({'where':{'UserId':_0xa462eb[_0x60ac('0x50')]['id'],'VoiceQueueId':_0xa462eb[_0x60ac('0x45')][_0x60ac('0x60')]},'individualHooks':!![]})[_0x60ac('0x15')](function(){return _0x11a1fc;});}return _0x11a1fc;})[_0x60ac('0x15')](respondWithStatusCode(_0x299761,null))[_0x60ac('0x5c')](handleError(_0x299761,null));};exports[_0x60ac('0xb5')]=function(_0x1b0cb5,_0x44cae5){_0x1b0cb5[_0x60ac('0x5d')][_0x60ac('0xb6')]=_0x1b0cb5[_0x60ac('0xb7')][_0x60ac('0xb8')];return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x1b0cb5['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x44cae5,null))['then'](saveUpdates(_0x1b0cb5['body'],null))[_0x60ac('0x15')](respondWithResult(_0x44cae5,null))[_0x60ac('0x5c')](handleError(_0x44cae5,null));};exports[_0x60ac('0xb9')]=function(_0x8d31b,_0x1c05ce){var _0x457653=path[_0x60ac('0xba')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x8d31b[_0x60ac('0x50')]['id']},'attributes':['id',_0x60ac('0xb6')],'raw':!![]})[_0x60ac('0x15')](handleEntityNotFound(_0x1c05ce,null))['then'](function(_0x1819be){if(_0x1819be){if(_[_0x60ac('0x68')](_0x1819be[_0x60ac('0xb6')])){return _0x1c05ce['download'](_0x457653);}else{if(!fs['existsSync'](path[_0x60ac('0xba')](config['root'],_0x60ac('0xbb'),_0x1819be[_0x60ac('0xb6')]))){return _0x1c05ce['download'](_0x457653);}return _0x1c05ce['download'](path['join'](config['root'],_0x60ac('0xbb'),_0x1819be[_0x60ac('0xb6')]));}}})[_0x60ac('0x5c')](handleError(_0x1c05ce,null));};exports[_0x60ac('0xbc')]=function(_0x5afcad,_0x1a9c45){return db[_0x60ac('0x3b')]['find']({'where':{'id':_0x5afcad[_0x60ac('0x50')]['id']},'attributes':['id']})[_0x60ac('0x15')](handleEntityNotFound(_0x1a9c45,null))[_0x60ac('0x15')](function(_0x56fe5a){var _0x82367b=[];values=_0x56fe5a[_0x60ac('0x48')];_0x82367b[_0x60ac('0x42')](get_open_tabs('chat',_0x56fe5a[_0x60ac('0x48')]));_0x82367b[_0x60ac('0x42')](get_open_tabs('sms',_0x56fe5a['dataValues']));_0x82367b['push'](get_open_tabs(_0x60ac('0x4c'),_0x56fe5a[_0x60ac('0x48')]));_0x82367b[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4d'),_0x56fe5a[_0x60ac('0x48')]));_0x82367b[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4a'),_0x56fe5a[_0x60ac('0x48')]));_0x82367b[_0x60ac('0x42')](get_open_tabs(_0x60ac('0x4b'),_0x56fe5a[_0x60ac('0x48')]));return BPromise[_0x60ac('0x4e')](_0x82367b);})[_0x60ac('0x15')](function(_0x13b305){if(_0x13b305){var _0x527dea=_[_0x60ac('0x30')](values[_0x60ac('0xbd')],function(_0x4041d1){return{'channel':_0x60ac('0xbe'),'id':_0x4041d1['id'],'createdAt':_0x4041d1[_0x60ac('0xbf')]};});var _0x2adb27=_[_0x60ac('0x30')](values[_0x60ac('0xc0')],function(_0x115ec7){return{'channel':_0x60ac('0xc1'),'id':_0x115ec7['id'],'createdAt':_0x115ec7[_0x60ac('0xbf')]};});var _0x2ab1ec=_[_0x60ac('0x30')](values['OpenchannelOpenTabs'],function(_0x1a9fee){return{'channel':_0x60ac('0xc2'),'id':_0x1a9fee['id'],'createdAt':_0x1a9fee[_0x60ac('0xbf')]};});var _0x5de561=_['map'](values[_0x60ac('0xc3')],function(_0x52a79f){return{'channel':_0x60ac('0xc4'),'id':_0x52a79f['id'],'createdAt':_0x52a79f['createdAt']};});var _0x3efb5e=_[_0x60ac('0x30')](values[_0x60ac('0xc5')],function(_0x551e62){return{'channel':'SMS','id':_0x551e62['id'],'createdAt':_0x551e62[_0x60ac('0xbf')]};});var _0x3015ee=_[_0x60ac('0x30')](values[_0x60ac('0xc6')],function(_0x501964){return{'channel':_0x60ac('0xc7'),'id':_0x501964['id'],'createdAt':_0x501964[_0x60ac('0xbf')]};});var _0x5006e5=_['concat'](_0x527dea,_0x2adb27,_0x2ab1ec,_0x5de561,_0x3efb5e,_0x3015ee);var _0x478786={'count':_0x5006e5[_0x60ac('0x58')],'rows':_0x5006e5};return _0x478786;}else return null;})[_0x60ac('0x15')](respondWithResult(_0x1a9c45,null))[_0x60ac('0x5c')](handleError(_0x1a9c45,null));};exports['getContacts']=function(_0x13ab64,_0x4d5c93){var _0x35d409={};var _0x5bff4b={};var _0x5ef0a0;var _0xb1cf91;return db[_0x60ac('0x3b')]['findOne']({'where':{'id':_0x13ab64[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x4d5c93,null))[_0x60ac('0x15')](function(_0x5bf7c2){if(_0x5bf7c2){_0x5ef0a0=_0x5bf7c2;_0x5bff4b[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xc8')][_0x60ac('0x54')]);_0x5bff4b[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x13ab64[_0x60ac('0x45')]);_0x5bff4b[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x5bff4b[_0x60ac('0x51')],_0x5bff4b[_0x60ac('0x45')]);_0x35d409[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x5bff4b[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x13ab64[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x35d409['attributes']=_0x35d409[_0x60ac('0x41')][_0x60ac('0x58')]?_0x35d409[_0x60ac('0x41')]:_0x5bff4b[_0x60ac('0x51')];_0x35d409[_0x60ac('0xca')]=qs['sort'](_0x13ab64[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x35d409['where']=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x13ab64[_0x60ac('0x45')],_0x5bff4b[_0x60ac('0x56')]));if(_0x13ab64['query'][_0x60ac('0x2e')]){_0x35d409['where']=_[_0x60ac('0x59')](_0x35d409[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x35d409[_0x60ac('0x41')],function(_0x4caa64){var _0x19ec2a={};_0x19ec2a[_0x4caa64]={'$like':'%'+_0x13ab64[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x19ec2a;})});}_0x35d409=_[_0x60ac('0x59')]({},_0x35d409,_0x13ab64[_0x60ac('0x5a')]);return _0x5ef0a0['getContacts'](_0x35d409);}})[_0x60ac('0x15')](function(_0x257bab){if(_0x257bab){_0xb1cf91=_0x257bab[_0x60ac('0x58')];if(_0x13ab64['query'][_0x60ac('0xce')](_0x60ac('0x3c'))){_0x35d409['include']=[{'model':db[_0x60ac('0xcf')],'as':_0x60ac('0xd0'),'required':![]},{'model':db[_0x60ac('0xd1')],'as':'Tags','attributes':['id',_0x60ac('0x33'),_0x60ac('0xd2')],'where':_0x13ab64[_0x60ac('0x45')][_0x60ac('0xd3')]?{'id':_0x13ab64[_0x60ac('0x45')]['tag']}:undefined,'required':_0x13ab64[_0x60ac('0x45')][_0x60ac('0xd3')]?!![]:![]}];}if(!_0x13ab64[_0x60ac('0x45')]['hasOwnProperty'](_0x60ac('0xd4'))){_0x35d409[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x13ab64[_0x60ac('0x45')][_0x60ac('0x24')]);_0x35d409[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x13ab64[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x5ef0a0[_0x60ac('0xd5')](_0x35d409);}})[_0x60ac('0x15')](function(_0x5e44d5){if(_0x5e44d5){return _0x5e44d5?{'count':_0xb1cf91,'rows':_0x5e44d5}:null;}})[_0x60ac('0x15')](respondWithResult(_0x4d5c93,null))[_0x60ac('0x5c')](handleError(_0x4d5c93,null));};exports['getQueues']=function(_0xa8ee34,_0x1e470b){var _0x2e2c14;var _0x1f5804={};var _0x3f8421;return db[_0x60ac('0x3b')]['findOne']({'where':{'id':_0xa8ee34[_0x60ac('0x50')]['id']},'attributes':['id','name','role']})[_0x60ac('0x15')](handleEntityNotFound(_0x1e470b,null))['then'](function(_0x3c1dcd){if(!utils['isValidChannel'](_0xa8ee34['query']['channel'])){throw new db['Sequelize'][(_0x60ac('0x90'))]('Unknown\x20channel');}_0x2e2c14=_0x3c1dcd;var _0x1d1955={};_0x1d1955[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_['capitalize'](_0xa8ee34['query']['channel'])+'Queue'][_0x60ac('0x54')]);_0x1d1955[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0xa8ee34[_0x60ac('0x45')]);_0x1d1955[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x1d1955[_0x60ac('0x51')],_0x1d1955[_0x60ac('0x45')]);_0x1f5804['attributes']=_[_0x60ac('0x57')](_0x1d1955[_0x60ac('0x51')],qs['fields'](_0xa8ee34[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x1f5804[_0x60ac('0x41')]=_0x1f5804[_0x60ac('0x41')][_0x60ac('0x58')]?_0x1f5804[_0x60ac('0x41')]:_0x1d1955[_0x60ac('0x51')];_0x1f5804['order']=qs[_0x60ac('0xcb')](_0xa8ee34[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x1f5804[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0xa8ee34[_0x60ac('0x45')],_0x1d1955[_0x60ac('0x56')]));if(_0xa8ee34[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x1f5804['where']=_[_0x60ac('0x59')](_0x1f5804[_0x60ac('0xcd')],{'$or':_['map'](_0x1f5804[_0x60ac('0x41')],function(_0x5d35d5){var _0x4a0513={};_0x4a0513[_0x5d35d5]={'$like':'%'+_0xa8ee34[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x4a0513;})});}_0x1f5804=_[_0x60ac('0x59')]({},_0x1f5804,_0xa8ee34['options']);switch(_0x2e2c14[_0x60ac('0x29')]){case'admin':return db[_[_0x60ac('0xa3')](_0xa8ee34[_0x60ac('0x45')]['channel'])+'Queue']['findAll'](_0x1f5804);case _0x60ac('0x2b'):case _0x60ac('0x2c'):return _0x2e2c14['get'+_[_0x60ac('0xa3')](_0xa8ee34['query']['channel'])+'Queues'](_0x1f5804);default:throw new db[(_0x60ac('0x8f'))][(_0x60ac('0x90'))]('Unknown\x20role');}})[_0x60ac('0x15')](function(_0x4fb2f2){_0x3f8421=_0x4fb2f2['length'];if(!_0xa8ee34[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x1f5804[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0xa8ee34['query']['limit']);_0x1f5804['offset']=qs['offset'](_0xa8ee34[_0x60ac('0x45')][_0x60ac('0x22')]);}switch(_0x2e2c14['role']){case _0x60ac('0x2a'):return db[_[_0x60ac('0xa3')](_0xa8ee34[_0x60ac('0x45')]['channel'])+_0x60ac('0xd6')][_0x60ac('0x43')](_0x1f5804);case _0x60ac('0x2b'):case _0x60ac('0x2c'):return _0x2e2c14[_0x60ac('0xd7')+_[_0x60ac('0xa3')](_0xa8ee34['query'][_0x60ac('0xb0')])+_0x60ac('0xa5')](_0x1f5804);}})[_0x60ac('0x15')](function(_0xc59565){return{'count':_0x3f8421,'rows':_0xc59565};})[_0x60ac('0x15')](respondWithResult(_0x1e470b,null))[_0x60ac('0x5c')](handleError(_0x1e470b,null));};exports[_0x60ac('0xd8')]=function(_0x14f408,_0x28a89e){var _0x5b2923={};var _0x23c9fc={};var _0x17cb78;var _0x23f90f;return db['User']['findOne']({'where':{'id':_0x14f408[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x28a89e,null))[_0x60ac('0x15')](function(_0x4f30ae){if(_0x4f30ae){_0x17cb78=_0x4f30ae;_0x23c9fc[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xb4')][_0x60ac('0x54')]);_0x23c9fc[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x14f408[_0x60ac('0x45')]);_0x23c9fc[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x23c9fc[_0x60ac('0x51')],_0x23c9fc[_0x60ac('0x45')]);_0x5b2923[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x23c9fc[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x14f408[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x5b2923[_0x60ac('0x41')]=_0x5b2923['attributes'][_0x60ac('0x58')]?_0x5b2923['attributes']:_0x23c9fc[_0x60ac('0x51')];_0x5b2923['order']=qs[_0x60ac('0xcb')](_0x14f408[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x5b2923[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x14f408[_0x60ac('0x45')],_0x23c9fc['filters']));if(_0x14f408[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x5b2923['where']=_['merge'](_0x5b2923['where'],{'$or':_['map'](_0x5b2923[_0x60ac('0x41')],function(_0x1a0266){var _0x4558a5={};_0x4558a5[_0x1a0266]={'$like':'%'+_0x14f408[_0x60ac('0x45')]['filter']+'%'};return _0x4558a5;})});}_0x5b2923=_[_0x60ac('0x59')]({},_0x5b2923,_0x14f408[_0x60ac('0x5a')]);return _0x17cb78[_0x60ac('0xd8')](_0x5b2923);}})[_0x60ac('0x15')](function(_0x509153){if(_0x509153){_0x23f90f=_0x509153['length'];if(!_0x14f408[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x5b2923['limit']=qs[_0x60ac('0x24')](_0x14f408[_0x60ac('0x45')][_0x60ac('0x24')]);_0x5b2923['offset']=qs['offset'](_0x14f408['query']['offset']);}return _0x17cb78[_0x60ac('0xd8')](_0x5b2923);}})[_0x60ac('0x15')](function(_0x572b71){if(_0x572b71){return _0x572b71?{'count':_0x23f90f,'rows':_0x572b71}:null;}})[_0x60ac('0x15')](respondWithResult(_0x28a89e,null))[_0x60ac('0x5c')](handleError(_0x28a89e,null));};exports[_0x60ac('0xd9')]=function(_0x16d4f1,_0x1922b3){var _0x4f8e6c={};var _0x530f6a={};var _0x260c43;var _0x52ffe6;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x16d4f1[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x1922b3,null))[_0x60ac('0x15')](function(_0x2efeeb){if(_0x2efeeb){_0x260c43=_0x2efeeb;_0x530f6a['model']=_[_0x60ac('0x53')](db['ChatGroup']['rawAttributes']);_0x530f6a[_0x60ac('0x45')]=_['keys'](_0x16d4f1[_0x60ac('0x45')]);_0x530f6a[_0x60ac('0x56')]=_['intersection'](_0x530f6a['model'],_0x530f6a['query']);_0x4f8e6c[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x530f6a['model'],qs['fields'](_0x16d4f1[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x4f8e6c['attributes']=_0x4f8e6c['attributes'][_0x60ac('0x58')]?_0x4f8e6c['attributes']:_0x530f6a[_0x60ac('0x51')];_0x4f8e6c[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x16d4f1[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x4f8e6c['where']=qs[_0x60ac('0x56')](_['pick'](_0x16d4f1[_0x60ac('0x45')],_0x530f6a[_0x60ac('0x56')]));if(_0x16d4f1[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x4f8e6c[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x4f8e6c['where'],{'$or':_[_0x60ac('0x30')](_0x4f8e6c[_0x60ac('0x41')],function(_0x3d6d91){var _0x39c733={};_0x39c733[_0x3d6d91]={'$like':'%'+_0x16d4f1[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x39c733;})});}_0x4f8e6c=_[_0x60ac('0x59')]({},_0x4f8e6c,_0x16d4f1[_0x60ac('0x5a')]);return _0x260c43[_0x60ac('0xd9')](_0x4f8e6c);}})[_0x60ac('0x15')](function(_0x2785bc){if(_0x2785bc){_0x52ffe6=_0x2785bc['length'];if(!_0x16d4f1[_0x60ac('0x45')]['hasOwnProperty'](_0x60ac('0xd4'))){_0x4f8e6c[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x16d4f1['query'][_0x60ac('0x24')]);_0x4f8e6c[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x16d4f1[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x260c43[_0x60ac('0xd9')](_0x4f8e6c);}})['then'](function(_0x452880){if(_0x452880){return _0x452880?{'count':_0x52ffe6,'rows':_0x452880}:null;}})[_0x60ac('0x15')](respondWithResult(_0x1922b3,null))['catch'](handleError(_0x1922b3,null));};exports[_0x60ac('0xda')]=function(_0x17c244,_0x2938d4){var _0x5c7853={'raw':!![],'where':{}};var _0x18e9e7={};var _0x98e2cc={'count':0x0,'rows':[]};return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x17c244['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x2938d4,null))[_0x60ac('0x15')](function(_0x485543){if(_0x485543){_0x18e9e7[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xdb')][_0x60ac('0x54')]);_0x18e9e7[_0x60ac('0x45')]=_['keys'](_0x17c244['query']);_0x18e9e7[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x18e9e7[_0x60ac('0x51')],_0x18e9e7['query']);_0x5c7853['attributes']=_[_0x60ac('0x57')](_0x18e9e7[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x17c244['query'][_0x60ac('0xc9')]));_0x5c7853['attributes']=_0x5c7853[_0x60ac('0x41')][_0x60ac('0x58')]?_0x5c7853['attributes']:_0x18e9e7[_0x60ac('0x51')];if(!_0x17c244[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x5c7853[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x17c244[_0x60ac('0x45')]['limit']);_0x5c7853[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x17c244[_0x60ac('0x45')][_0x60ac('0x22')]);}_0x5c7853[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x17c244[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x5c7853['where']=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x17c244['query'],_0x18e9e7[_0x60ac('0x56')]));_0x5c7853[_0x60ac('0xcd')][_0x60ac('0xdc')]=_0x485543['id'];if(_0x17c244[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x5c7853[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x5c7853[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x5c7853[_0x60ac('0x41')],function(_0xac2476){var _0x2e6884={};_0x2e6884[_0xac2476]={'$like':'%'+_0x17c244['query'][_0x60ac('0x2e')]+'%'};return _0x2e6884;})});}_0x5c7853=_[_0x60ac('0x59')]({},_0x5c7853,_0x17c244['options']);return db[_0x60ac('0xdb')][_0x60ac('0x25')]({'where':_0x5c7853['where']})['then'](function(_0x5f2c89){_0x98e2cc['count']=_0x5f2c89;if(_0x17c244[_0x60ac('0x45')][_0x60ac('0x3c')]){_0x5c7853[_0x60ac('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x60ac('0x43')](_0x5c7853);})[_0x60ac('0x15')](function(_0x1239ef){_0x98e2cc[_0x60ac('0x44')]=_0x1239ef;return _0x98e2cc;});}})[_0x60ac('0x15')](respondWithFilteredResult(_0x2938d4,_0x5c7853))['catch'](handleError(_0x2938d4,null));};exports[_0x60ac('0xdd')]=function(_0x3f04ff,_0x548710){var _0x256c96={'raw':!![],'where':{}};var _0x4e3b84={};var _0x164a1e={'count':0x0,'rows':[]};return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x3f04ff[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x548710,null))['then'](function(_0x586c22){if(_0x586c22){_0x4e3b84['model']=_[_0x60ac('0x53')](db['ScreenRecording'][_0x60ac('0x54')]);_0x4e3b84[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x3f04ff[_0x60ac('0x45')]);_0x4e3b84[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x4e3b84[_0x60ac('0x51')],_0x4e3b84[_0x60ac('0x45')]);_0x256c96[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x4e3b84['model'],qs['fields'](_0x3f04ff[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x256c96[_0x60ac('0x41')]=_0x256c96[_0x60ac('0x41')]['length']?_0x256c96['attributes']:_0x4e3b84[_0x60ac('0x51')];if(!_0x3f04ff[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x256c96[_0x60ac('0x24')]=qs['limit'](_0x3f04ff[_0x60ac('0x45')]['limit']);_0x256c96['offset']=qs[_0x60ac('0x22')](_0x3f04ff[_0x60ac('0x45')][_0x60ac('0x22')]);}_0x256c96['order']=qs['sort'](_0x3f04ff['query'][_0x60ac('0xcb')]);_0x256c96[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x3f04ff[_0x60ac('0x45')],_0x4e3b84['filters']));_0x256c96[_0x60ac('0xcd')][_0x60ac('0xdc')]=_0x586c22['id'];if(_0x3f04ff['query']['filter']){_0x256c96['where']=_[_0x60ac('0x59')](_0x256c96['where'],{'$or':_['map'](_0x256c96[_0x60ac('0x41')],function(_0x9b5dc1){var _0x432920={};_0x432920[_0x9b5dc1]={'$like':'%'+_0x3f04ff[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x432920;})});}_0x256c96=_[_0x60ac('0x59')]({},_0x256c96,_0x3f04ff[_0x60ac('0x5a')]);return db[_0x60ac('0xde')]['count']({'where':_0x256c96[_0x60ac('0xcd')]})[_0x60ac('0x15')](function(_0x178d64){_0x164a1e['count']=_0x178d64;if(_0x3f04ff['query'][_0x60ac('0x3c')]){_0x256c96['include']=[{'all':!![]}];}return db[_0x60ac('0xde')][_0x60ac('0x43')](_0x256c96);})[_0x60ac('0x15')](function(_0x29df22){_0x164a1e[_0x60ac('0x44')]=_0x29df22;return _0x164a1e;});}})[_0x60ac('0x15')](respondWithFilteredResult(_0x548710,_0x256c96))[_0x60ac('0x5c')](handleError(_0x548710,null));};exports[_0x60ac('0xdf')]=function(_0xd9ecb2,_0x24f80c){var _0x20ad99={};var _0x2c0040={};var _0x27f0d8;var _0x423873;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0xd9ecb2[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x24f80c,null))[_0x60ac('0x15')](function(_0x2289e8){if(_0x2289e8){_0x27f0d8=_0x2289e8;_0x2c0040[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xe0')][_0x60ac('0x54')]);_0x2c0040['query']=_[_0x60ac('0x53')](_0xd9ecb2['query']);_0x2c0040[_0x60ac('0x56')]=_['intersection'](_0x2c0040[_0x60ac('0x51')],_0x2c0040[_0x60ac('0x45')]);_0x20ad99['attributes']=_[_0x60ac('0x57')](_0x2c0040['model'],qs[_0x60ac('0xc9')](_0xd9ecb2[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x20ad99[_0x60ac('0x41')]=_0x20ad99[_0x60ac('0x41')][_0x60ac('0x58')]?_0x20ad99[_0x60ac('0x41')]:_0x2c0040[_0x60ac('0x51')];_0x20ad99['order']=qs[_0x60ac('0xcb')](_0xd9ecb2[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x20ad99['where']=qs[_0x60ac('0x56')](_['pick'](_0xd9ecb2[_0x60ac('0x45')],_0x2c0040[_0x60ac('0x56')]));if(_0xd9ecb2[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x20ad99['where']=_[_0x60ac('0x59')](_0x20ad99[_0x60ac('0xcd')],{'$or':_['map'](_0x20ad99['attributes'],function(_0x4d1e36){var _0x37b529={};_0x37b529[_0x4d1e36]={'$like':'%'+_0xd9ecb2[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x37b529;})});}_0x20ad99=_[_0x60ac('0x59')]({},_0x20ad99,_0xd9ecb2['options']);return _0x27f0d8[_0x60ac('0xdf')](_0x20ad99);}})['then'](function(_0x3c2eb7){if(_0x3c2eb7){_0x423873=_0x3c2eb7[_0x60ac('0x58')];if(!_0xd9ecb2[_0x60ac('0x45')]['hasOwnProperty'](_0x60ac('0xd4'))){_0x20ad99[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0xd9ecb2[_0x60ac('0x45')][_0x60ac('0x24')]);_0x20ad99[_0x60ac('0x22')]=qs['offset'](_0xd9ecb2['query']['offset']);}return _0x27f0d8[_0x60ac('0xdf')](_0x20ad99);}})[_0x60ac('0x15')](function(_0x81ea0f){if(_0x81ea0f){return _0x81ea0f?{'count':_0x423873,'rows':_0x81ea0f}:null;}})['then'](respondWithResult(_0x24f80c,null))[_0x60ac('0x5c')](handleError(_0x24f80c,null));};exports[_0x60ac('0xe1')]=function(_0x146001,_0x2cbc77){var _0x4a8cdc={};var _0x476f81={};var _0x167138;var _0x567636;return db['User'][_0x60ac('0x97')]({'where':{'id':_0x146001[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x2cbc77,null))[_0x60ac('0x15')](function(_0x342e8f){if(_0x342e8f){_0x167138=_0x342e8f;_0x476f81[_0x60ac('0x51')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x476f81['query']=_['keys'](_0x146001[_0x60ac('0x45')]);_0x476f81[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x476f81[_0x60ac('0x51')],_0x476f81[_0x60ac('0x45')]);_0x4a8cdc[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x476f81[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x146001[_0x60ac('0x45')]['fields']));_0x4a8cdc['attributes']=_0x4a8cdc[_0x60ac('0x41')]['length']?_0x4a8cdc[_0x60ac('0x41')]:_0x476f81[_0x60ac('0x51')];_0x4a8cdc[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x146001[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x4a8cdc[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_['pick'](_0x146001[_0x60ac('0x45')],_0x476f81[_0x60ac('0x56')]));if(_0x146001[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x4a8cdc['where']=_['merge'](_0x4a8cdc['where'],{'$or':_[_0x60ac('0x30')](_0x4a8cdc[_0x60ac('0x41')],function(_0x18fcf3){var _0x2a25b9={};_0x2a25b9[_0x18fcf3]={'$like':'%'+_0x146001[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x2a25b9;})});}_0x4a8cdc=_['merge']({},_0x4a8cdc,_0x146001[_0x60ac('0x5a')]);return _0x167138[_0x60ac('0xe1')](_0x4a8cdc);}})[_0x60ac('0x15')](function(_0x2cb840){if(_0x2cb840){_0x567636=_0x2cb840[_0x60ac('0x58')];if(!_0x146001[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x4a8cdc[_0x60ac('0x24')]=qs['limit'](_0x146001[_0x60ac('0x45')]['limit']);_0x4a8cdc[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x146001[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x167138[_0x60ac('0xe1')](_0x4a8cdc);}})[_0x60ac('0x15')](function(_0x1e4768){if(_0x1e4768){return _0x1e4768?{'count':_0x567636,'rows':_0x1e4768}:null;}})[_0x60ac('0x15')](respondWithResult(_0x2cbc77,null))[_0x60ac('0x5c')](handleError(_0x2cbc77,null));};exports['getMailInteractions']=function(_0x50b13e,_0x356391){var _0x1552fa={'raw':!![],'where':{}};var _0x132ba0={};var _0x135b9f={'count':0x0,'rows':[]};return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x50b13e['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x356391,null))[_0x60ac('0x15')](function(_0x4241fd){if(_0x4241fd){_0x132ba0[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xe2')][_0x60ac('0x54')]);_0x132ba0[_0x60ac('0x45')]=_['keys'](_0x50b13e[_0x60ac('0x45')]);_0x132ba0[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x132ba0[_0x60ac('0x51')],_0x132ba0[_0x60ac('0x45')]);_0x1552fa[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x132ba0[_0x60ac('0x51')],qs['fields'](_0x50b13e[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x1552fa[_0x60ac('0x41')]=_0x1552fa[_0x60ac('0x41')][_0x60ac('0x58')]?_0x1552fa['attributes']:_0x132ba0[_0x60ac('0x51')];if(!_0x50b13e[_0x60ac('0x45')][_0x60ac('0xce')]('nolimit')){_0x1552fa[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x50b13e[_0x60ac('0x45')][_0x60ac('0x24')]);_0x1552fa[_0x60ac('0x22')]=qs['offset'](_0x50b13e[_0x60ac('0x45')][_0x60ac('0x22')]);}_0x1552fa[_0x60ac('0xca')]=qs['sort'](_0x50b13e[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x1552fa[_0x60ac('0xcd')]=qs['filters'](_[_0x60ac('0xcc')](_0x50b13e['query'],_0x132ba0[_0x60ac('0x56')]));_0x1552fa[_0x60ac('0xcd')][_0x60ac('0xdc')]=_0x4241fd['id'];if(_0x50b13e[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x1552fa[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x1552fa[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x1552fa[_0x60ac('0x41')],function(_0xd014e9){var _0x284bed={};_0x284bed[_0xd014e9]={'$like':'%'+_0x50b13e[_0x60ac('0x45')]['filter']+'%'};return _0x284bed;})});}_0x1552fa=_[_0x60ac('0x59')]({},_0x1552fa,_0x50b13e[_0x60ac('0x5a')]);return db['MailInteraction'][_0x60ac('0x25')]({'where':_0x1552fa[_0x60ac('0xcd')]})[_0x60ac('0x15')](function(_0x37adb1){_0x135b9f[_0x60ac('0x25')]=_0x37adb1;if(_0x50b13e['query'][_0x60ac('0x3c')]){_0x1552fa[_0x60ac('0x3d')]=[{'all':!![]}];}return db[_0x60ac('0xe2')][_0x60ac('0x43')](_0x1552fa);})['then'](function(_0x1ff7d5){_0x135b9f[_0x60ac('0x44')]=_0x1ff7d5;return _0x135b9f;});}})[_0x60ac('0x15')](respondWithFilteredResult(_0x356391,_0x1552fa))[_0x60ac('0x5c')](handleError(_0x356391,null));};exports['getSmsInteractions']=function(_0x348e14,_0x28aa3){var _0x266cd1={};var _0x4ae514={};var _0x223e99;var _0x41d3ad;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x348e14[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x28aa3,null))['then'](function(_0x478a4a){if(_0x478a4a){_0x223e99=_0x478a4a;_0x4ae514[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xe3')]['rawAttributes']);_0x4ae514[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x348e14[_0x60ac('0x45')]);_0x4ae514[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x4ae514[_0x60ac('0x51')],_0x4ae514[_0x60ac('0x45')]);_0x266cd1['attributes']=_[_0x60ac('0x57')](_0x4ae514[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x348e14[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x266cd1[_0x60ac('0x41')]=_0x266cd1[_0x60ac('0x41')][_0x60ac('0x58')]?_0x266cd1[_0x60ac('0x41')]:_0x4ae514['model'];_0x266cd1['order']=qs['sort'](_0x348e14[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x266cd1[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x348e14[_0x60ac('0x45')],_0x4ae514[_0x60ac('0x56')]));if(_0x348e14[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x266cd1[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x266cd1['where'],{'$or':_['map'](_0x266cd1['attributes'],function(_0x437fbc){var _0x5e572e={};_0x5e572e[_0x437fbc]={'$like':'%'+_0x348e14[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x5e572e;})});}_0x266cd1=_[_0x60ac('0x59')]({},_0x266cd1,_0x348e14['options']);return _0x223e99[_0x60ac('0xe4')](_0x266cd1);}})[_0x60ac('0x15')](function(_0x49fc7c){if(_0x49fc7c){_0x41d3ad=_0x49fc7c[_0x60ac('0x58')];if(!_0x348e14[_0x60ac('0x45')][_0x60ac('0xce')]('nolimit')){_0x266cd1[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x348e14[_0x60ac('0x45')]['limit']);_0x266cd1[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x348e14[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x223e99['getSmsInteractions'](_0x266cd1);}})[_0x60ac('0x15')](function(_0x449699){if(_0x449699){return _0x449699?{'count':_0x41d3ad,'rows':_0x449699}:null;}})[_0x60ac('0x15')](respondWithResult(_0x28aa3,null))[_0x60ac('0x5c')](handleError(_0x28aa3,null));};exports[_0x60ac('0xe5')]=function(_0x4c0437,_0xc68249){var _0x55329d={};var _0x12b19c={};var _0x35543f;var _0x2ae6e7;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x4c0437[_0x60ac('0x50')]['id']}})['then'](handleEntityNotFound(_0xc68249,null))['then'](function(_0x130cc2){if(_0x130cc2){_0x35543f=_0x130cc2;_0x12b19c[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0xe6')][_0x60ac('0x54')]);_0x12b19c[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x4c0437[_0x60ac('0x45')]);_0x12b19c[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x12b19c['model'],_0x12b19c['query']);_0x55329d[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x12b19c[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x4c0437[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x55329d[_0x60ac('0x41')]=_0x55329d[_0x60ac('0x41')][_0x60ac('0x58')]?_0x55329d[_0x60ac('0x41')]:_0x12b19c[_0x60ac('0x51')];_0x55329d[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x4c0437['query'][_0x60ac('0xcb')]);_0x55329d['where']=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x4c0437[_0x60ac('0x45')],_0x12b19c['filters']));if(_0x4c0437['query'][_0x60ac('0x2e')]){_0x55329d[_0x60ac('0xcd')]=_['merge'](_0x55329d[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x55329d[_0x60ac('0x41')],function(_0x220ec7){var _0x5de89f={};_0x5de89f[_0x220ec7]={'$like':'%'+_0x4c0437[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x5de89f;})});}_0x55329d=_[_0x60ac('0x59')]({},_0x55329d,_0x4c0437[_0x60ac('0x5a')]);return _0x35543f[_0x60ac('0xe5')](_0x55329d);}})[_0x60ac('0x15')](function(_0x320d7b){if(_0x320d7b){_0x2ae6e7=_0x320d7b[_0x60ac('0x58')];if(!_0x4c0437['query'][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x55329d[_0x60ac('0x24')]=qs[_0x60ac('0x24')](_0x4c0437['query']['limit']);_0x55329d['offset']=qs[_0x60ac('0x22')](_0x4c0437[_0x60ac('0x45')]['offset']);}return _0x35543f[_0x60ac('0xe5')](_0x55329d);}})[_0x60ac('0x15')](function(_0x3111aa){if(_0x3111aa){return _0x3111aa?{'count':_0x2ae6e7,'rows':_0x3111aa}:null;}})[_0x60ac('0x15')](respondWithResult(_0xc68249,null))[_0x60ac('0x5c')](handleError(_0xc68249,null));};exports['getWhatsappInteractions']=function(_0x58e2eb,_0x4ebe2d){var _0x6a041={};var _0x39b054={};var _0x2ca2e1;var _0x1c7f14;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x58e2eb['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x4ebe2d,null))[_0x60ac('0x15')](function(_0x195619){if(_0x195619){_0x2ca2e1=_0x195619;_0x39b054[_0x60ac('0x51')]=_[_0x60ac('0x53')](db['WhatsappInteraction'][_0x60ac('0x54')]);_0x39b054[_0x60ac('0x45')]=_[_0x60ac('0x53')](_0x58e2eb['query']);_0x39b054['filters']=_[_0x60ac('0x57')](_0x39b054[_0x60ac('0x51')],_0x39b054[_0x60ac('0x45')]);_0x6a041[_0x60ac('0x41')]=_['intersection'](_0x39b054[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x58e2eb[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x6a041[_0x60ac('0x41')]=_0x6a041[_0x60ac('0x41')]['length']?_0x6a041[_0x60ac('0x41')]:_0x39b054[_0x60ac('0x51')];_0x6a041[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x58e2eb[_0x60ac('0x45')][_0x60ac('0xcb')]);_0x6a041[_0x60ac('0xcd')]=qs['filters'](_[_0x60ac('0xcc')](_0x58e2eb[_0x60ac('0x45')],_0x39b054[_0x60ac('0x56')]));if(_0x58e2eb['query'][_0x60ac('0x2e')]){_0x6a041[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x6a041[_0x60ac('0xcd')],{'$or':_['map'](_0x6a041[_0x60ac('0x41')],function(_0x1fe7b1){var _0x1d996b={};_0x1d996b[_0x1fe7b1]={'$like':'%'+_0x58e2eb[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x1d996b;})});}_0x6a041=_[_0x60ac('0x59')]({},_0x6a041,_0x58e2eb[_0x60ac('0x5a')]);return _0x2ca2e1[_0x60ac('0xe7')](_0x6a041);}})[_0x60ac('0x15')](function(_0x4ab849){if(_0x4ab849){_0x1c7f14=_0x4ab849[_0x60ac('0x58')];if(!_0x58e2eb[_0x60ac('0x45')][_0x60ac('0xce')]('nolimit')){_0x6a041['limit']=qs[_0x60ac('0x24')](_0x58e2eb[_0x60ac('0x45')][_0x60ac('0x24')]);_0x6a041[_0x60ac('0x22')]=qs['offset'](_0x58e2eb[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x2ca2e1[_0x60ac('0xe7')](_0x6a041);}})[_0x60ac('0x15')](function(_0x11f5e0){if(_0x11f5e0){return _0x11f5e0?{'count':_0x1c7f14,'rows':_0x11f5e0}:null;}})[_0x60ac('0x15')](respondWithResult(_0x4ebe2d,null))[_0x60ac('0x5c')](handleError(_0x4ebe2d,null));};exports[_0x60ac('0xe8')]=function(_0x177c4b,_0x1c1b9c,_0x3532ab){var _0x93786d;var _0x26e511;var _0x202f4b;var _0x330158=!_[_0x60ac('0x68')](_0x177c4b['params']['id'])?_0x177c4b[_0x60ac('0x50')]['id']:!_['isNil'](_0x177c4b[_0x60ac('0x2b')]['id'])?_0x177c4b[_0x60ac('0x2b')]['id']:null;return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x330158,'role':{'$or':[_0x60ac('0x2a'),'user',_0x60ac('0x2c')]}},'attributes':['id',_0x60ac('0x33'),'phone','mobile',_0x60ac('0x29'),_0x60ac('0x62'),_0x60ac('0x9f')]})[_0x60ac('0x15')](function(_0x12eb26){if(_0x12eb26){if(_0x12eb26[_0x60ac('0x29')]==='agent'){_0x93786d=_0x12eb26;if(_0x177c4b[_0x60ac('0x5d')][_0x60ac('0xa1')]){_0x202f4b=util['format'](_0x60ac('0xe9'),_0x93786d[_0x177c4b[_0x60ac('0x5d')][_0x60ac('0xa1')]]);}else if(_0x177c4b[_0x60ac('0x5d')][_0x60ac('0xea')]){_0x202f4b=util[_0x60ac('0xeb')](_0x60ac('0xec'),_0x177c4b[_0x60ac('0x5d')][_0x60ac('0xea')]);}else{_0x202f4b=util[_0x60ac('0xeb')](_0x60ac('0xec'),_0x93786d[_0x60ac('0x33')]);}socket['to'](util['format']('user:%s',_0x93786d[_0x60ac('0x33')]))[_0x60ac('0xa8')]('user:forcelogout',{'user':{'id':_0x93786d['id'],'name':_0x93786d[_0x60ac('0x33')]},'ip':_0x177c4b['headers'][_0x60ac('0xed')]||_0x177c4b[_0x60ac('0xee')][_0x60ac('0xef')]||_0x177c4b['socket'][_0x60ac('0xef')]||_0x177c4b[_0x60ac('0xee')]['socket'][_0x60ac('0xef')]});return db[_0x60ac('0xb4')][_0x60ac('0x28')]({'where':{'membername':_0x93786d[_0x60ac('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x60ac('0x8f'))]['ValidationError'](_0x60ac('0xf0'));}})[_0x60ac('0x15')](function(){if(_0x93786d){return _0x93786d[_0x60ac('0xf1')]({'raw':!![]});}})[_0x60ac('0x15')](function(_0x5e2548){if(_0x93786d){var _0x3b46ad=[];if(_0x5e2548){_0x26e511=_0x5e2548;if(_0x26e511['length']){for(var _0x37ab71=0x0;_0x37ab71<_0x26e511[_0x60ac('0x58')];_0x37ab71++){_0x3b46ad[_0x60ac('0x42')]({'membername':_0x93786d['name'],'UserId':_0x93786d['id'],'queue_name':_0x26e511[_0x37ab71]['name'],'VoiceQueueId':_0x26e511[_0x37ab71]['id'],'interface':_0x202f4b,'paused':_0x93786d[_0x60ac('0x9f')]||![],'penalty':_0x26e511[_0x37ab71][_0x60ac('0xf2')]||0x0});}return BPromise['each'](_0x3b46ad,function(_0x2b14db){return db[_0x60ac('0xb4')][_0x60ac('0xae')](_0x2b14db);});}}}})['then'](function(){if(_0x93786d){return db[_0x60ac('0xf3')][_0x60ac('0x43')]({'where':{'membername':_0x93786d[_0x60ac('0x33')],'exitAt':null}});}})[_0x60ac('0x15')](function(_0xacde05){if(_0x93786d){var _0x1854db=[];_0xacde05[_0x60ac('0xf4')](function(_0x55554b){_0x1854db[_0x60ac('0x42')](_0x55554b['update']({'exitAt':moment()['format'](_0x60ac('0xf5'))}));});return BPromise['all'](_0x1854db);}})[_0x60ac('0x15')](function(){if(_0x93786d){var _0x24be6c=[];var _0x5b6452=[];var _0xd4bd5a=utils[_0x60ac('0xf6')]();var _0x4f1af4={'membername':_0x93786d[_0x60ac('0x33')],'interface':_0x202f4b,'enterAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'role':_0x93786d[_0x60ac('0x29')],'internal':_0x93786d['internal']};_0xd4bd5a['forEach'](function(_0x706079){_0x24be6c[_0x60ac('0x42')](_[_0x60ac('0x59')]({'channel':_0x706079,'type':_0x60ac('0xf7'),'data1':_0x177c4b[_0x60ac('0x5d')]['device'],'data2':_0x202f4b},_0x4f1af4));if(_0x93786d[_0x60ac('0x9f')]){_0x5b6452['push'](_[_0x60ac('0x59')]({'channel':_0x706079,'type':'PAUSE','data1':_0x60ac('0xf8')},_0x4f1af4));}});return db[_0x60ac('0xf3')][_0x60ac('0x87')](_0x24be6c[_0x60ac('0xf9')](_0x5b6452),{'individualHooks':!![]});}})['then'](function(){if(_0x93786d){return _0x93786d[_0x60ac('0x27')]({'online':!![],'lastLoginAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'voicePause':_0x93786d[_0x60ac('0x9f')]||![],'mailPause':_0x93786d['loginInPause']||![],'chatPause':_0x93786d[_0x60ac('0x9f')]||![],'faxPause':_0x93786d[_0x60ac('0x9f')]||![],'smsPause':_0x93786d['loginInPause']||![],'openchannelPause':_0x93786d[_0x60ac('0x9f')]||![],'whatsappPause':_0x93786d[_0x60ac('0x9f')]||![],'pauseType':_0x93786d[_0x60ac('0x9f')]?_0x60ac('0xf8'):null,'interface':_0x202f4b,'lastPauseAt':moment()[_0x60ac('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x60ac('0x15')](function(_0x3b33be){if(_0x177c4b[_0x60ac('0xfa')]){return _0x3532ab();}else{return BPromise[_0x60ac('0xfb')](_0x3b33be)[_0x60ac('0x15')](respondWithResult(_0x1c1b9c,null));}})[_0x60ac('0x5c')](handleError(_0x1c1b9c,null));};exports['logout']=function(_0x4f0850,_0x56d964){var _0x512037;return db['User'][_0x60ac('0x32')]({'where':{'id':_0x4f0850[_0x60ac('0x50')]['id'],'role':_0x60ac('0x2c')},'attributes':['id',_0x60ac('0x33'),'role']})[_0x60ac('0x15')](handleEntityNotFound(_0x56d964,null))['then'](function(_0x1f7e3f){if(_0x1f7e3f){_0x512037=_0x1f7e3f;return db[_0x60ac('0xb4')][_0x60ac('0x28')]({'where':{'membername':_0x512037[_0x60ac('0x33')]},'individualHooks':!![]});}})['then'](function(){return db[_0x60ac('0xf3')][_0x60ac('0x43')]({'where':{'membername':_0x512037['name'],'exitAt':null}});})[_0x60ac('0x15')](function(_0x38d3b0){var _0x1b97ed=[];_0x38d3b0[_0x60ac('0xf4')](function(_0x1e65dc){_0x1b97ed[_0x60ac('0x42')](_0x1e65dc[_0x60ac('0x27')]({'exitAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5'))}));});return BPromise[_0x60ac('0x4e')](_0x1b97ed);})['then'](function(){return _0x512037[_0x60ac('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x60ac('0x15')](respondWithResult(_0x56d964,null))['catch'](handleError(_0x56d964,null));};exports[_0x60ac('0xfc')]=function(_0x281498,_0x5c8cd8){var _0x437f83;return db[_0x60ac('0xb4')][_0x60ac('0x27')]({'paused':0x1},{'where':{'UserId':_0x281498[_0x60ac('0x50')]['id']},'individualHooks':!![]})[_0x60ac('0x15')](function(){return db['User']['find']({'where':{'id':_0x281498[_0x60ac('0x50')]['id'],'role':_0x60ac('0x2c')},'attributes':['id',_0x60ac('0x33'),_0x60ac('0x29'),_0x60ac('0x62'),_0x60ac('0xa1')]});})[_0x60ac('0x15')](handleEntityNotFound(_0x5c8cd8,null))[_0x60ac('0x15')](function(_0x742166){if(_0x742166){_0x437f83=_0x742166;return respondWithRpcPromise(_0x60ac('0xfd'),'pause',{'id':_0x437f83['id'],'name':_0x437f83[_0x60ac('0x33')],'pause':!![]});}})[_0x60ac('0x15')](function(){if(_0x437f83){return db['MemberReport']['findAll']({'where':{'membername':_0x437f83['name'],'type':_0x60ac('0xfe'),'exitAt':null}});}})[_0x60ac('0x15')](function(_0x2a1831){if(_0x2a1831['length']){var _0x2b22a2=moment()[_0x60ac('0xeb')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x350798=0x0,_0x2480e4=_0x2a1831[_0x60ac('0x58')];_0x350798<_0x2480e4;_0x350798++){_0x2a1831[_0x350798]['updateAttributes']({'exitAt':_0x2b22a2});}}})[_0x60ac('0x15')](function(){var _0x41eb00=[];var _0x30de18=utils[_0x60ac('0xf6')]();_0x30de18[_0x60ac('0xf4')](function(_0x5e555a){_0x41eb00[_0x60ac('0x42')]({'channel':_0x5e555a,'membername':_0x437f83[_0x60ac('0x33')],'interface':_['isNil'](_0x437f83['interface'])?util[_0x60ac('0xeb')]('SIP/%s',_0x437f83[_0x60ac('0x33')]):_0x437f83[_0x60ac('0xa1')],'type':'PAUSE','enterAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'data1':_0x281498['body']['type']||_0x60ac('0xff'),'role':_0x437f83['role'],'internal':_0x437f83[_0x60ac('0x62')]});});return db['MemberReport'][_0x60ac('0x87')](_0x41eb00,{'individualHooks':!![]});})[_0x60ac('0x15')](function(){return _0x437f83[_0x60ac('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x281498[_0x60ac('0x5d')]['type']||_0x60ac('0xff'),'lastPauseAt':moment()[_0x60ac('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x60ac('0x15')](respondWithResult(_0x5c8cd8,null))[_0x60ac('0x5c')](handleError(_0x5c8cd8,null));};exports[_0x60ac('0x100')]=function(_0xf71667,_0x571038){var _0x28881c;return db['User'][_0x60ac('0x32')]({'where':{'id':_0xf71667[_0x60ac('0x50')]['id']},'attributes':['id',_0x60ac('0x33'),'role',_0x60ac('0xa0'),'mailPause','chatPause',_0x60ac('0x101'),'openchannelPause','smsPause',_0x60ac('0x102'),_0x60ac('0x103'),_0x60ac('0x104')]})[_0x60ac('0x15')](handleEntityNotFound(_0x571038,null))[_0x60ac('0x15')](function(_0x3dd166){if(_0x3dd166){_0x28881c=_0x3dd166;if(_0xf71667[_0x60ac('0x5d')]['channel']&&!utils[_0x60ac('0xa2')](_0xf71667[_0x60ac('0x5d')][_0x60ac('0xb0')])){throw new db['Sequelize'][(_0x60ac('0x90'))]('Unknown\x20channel');}switch(_0xf71667[_0x60ac('0x5d')][_0x60ac('0xb0')]){case _0x60ac('0xaa'):return respondWithRpcPromise(_0x60ac('0xfd'),_0x60ac('0x100'),{'id':_0x28881c['id'],'name':_0x28881c['name'],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x60ac('0x27')]({'paused':0x0},{'where':{'UserId':_0x28881c['id']},'individualHooks':!![]});})[_0x60ac('0x15')](function(){return db[_0x60ac('0xf3')][_0x60ac('0x32')]({'where':{'channel':_0xf71667[_0x60ac('0x5d')][_0x60ac('0xb0')],'membername':_0x28881c[_0x60ac('0x33')],'type':_0x60ac('0xfe'),'exitAt':null}});})[_0x60ac('0x15')](function(_0x41ca05){if(_0x41ca05){return _0x41ca05[_0x60ac('0x27')]({'exitAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x28881c[_0x60ac('0x27')]({'voicePause':![]});});case _0x60ac('0x4b'):case'chat':case _0x60ac('0x4a'):case'sms':case _0x60ac('0x4d'):case'openchannel':return db[_0x60ac('0xf3')][_0x60ac('0x32')]({'where':{'channel':_0xf71667[_0x60ac('0x5d')]['channel'],'membername':_0x28881c['name'],'type':_0x60ac('0xfe'),'exitAt':null}})['then'](function(_0x4f66ca){if(_0x4f66ca){return _0x4f66ca[_0x60ac('0x27')]({'exitAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x60ac('0x15')](function(){var _0xbbfb0={};_['set'](_0xbbfb0,util[_0x60ac('0xeb')](_0x60ac('0x105'),_0xf71667[_0x60ac('0x5d')][_0x60ac('0xb0')],_0x60ac('0x106')),![]);return _0x28881c[_0x60ac('0x27')](_0xbbfb0);});default:return respondWithRpcPromise(_0x60ac('0xfd'),'unpause',{'id':_0x28881c['id'],'name':_0x28881c[_0x60ac('0x33')],'pause':![]})[_0x60ac('0x15')](function(){return db[_0x60ac('0xb4')][_0x60ac('0x27')]({'paused':0x0},{'where':{'UserId':_0x28881c['id']}});})[_0x60ac('0x15')](function(){return db['MemberReport'][_0x60ac('0x43')]({'where':{'membername':_0x28881c[_0x60ac('0x33')],'type':_0x60ac('0xfe'),'exitAt':null}});})['then'](function(_0x330006){var _0x448293=[];_0x330006[_0x60ac('0xf4')](function(_0x1e2a45){_0x448293[_0x60ac('0x42')](_0x1e2a45['update']({'exitAt':moment()[_0x60ac('0xeb')](_0x60ac('0xf5')),'data2':_0x60ac('0x107')}));});return BPromise[_0x60ac('0x4e')](_0x448293);})['then'](function(){return _0x28881c[_0x60ac('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x60ac('0x15')](respondWithResult(_0x571038,null))[_0x60ac('0x5c')](handleError(_0x571038,null));};exports[_0x60ac('0x108')]=function(_0x57fb57,_0x3d68c0){var _0x477005={};var _0x5a07cd={};var _0x42f49a;var _0x2f5e0c;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x57fb57[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x3d68c0,null))[_0x60ac('0x15')](function(_0x1cf72b){if(_0x1cf72b){_0x42f49a=_0x1cf72b;_0x5a07cd[_0x60ac('0x51')]=_[_0x60ac('0x53')](db[_0x60ac('0x109')][_0x60ac('0x54')]);_0x5a07cd[_0x60ac('0x45')]=_['keys'](_0x57fb57['query']);_0x5a07cd[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x5a07cd['model'],_0x5a07cd[_0x60ac('0x45')]);_0x477005[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x5a07cd[_0x60ac('0x51')],qs[_0x60ac('0xc9')](_0x57fb57[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x477005[_0x60ac('0x41')]=_0x477005['attributes'][_0x60ac('0x58')]?_0x477005[_0x60ac('0x41')]:_0x5a07cd[_0x60ac('0x51')];_0x477005[_0x60ac('0xca')]=qs['sort'](_0x57fb57['query']['sort']);_0x477005['where']=qs['filters'](_[_0x60ac('0xcc')](_0x57fb57[_0x60ac('0x45')],_0x5a07cd[_0x60ac('0x56')]));if(_0x57fb57[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x477005['where']=_['merge'](_0x477005[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x477005[_0x60ac('0x41')],function(_0x5a1fa0){var _0x4231fe={};_0x4231fe[_0x5a1fa0]={'$like':'%'+_0x57fb57[_0x60ac('0x45')][_0x60ac('0x2e')]+'%'};return _0x4231fe;})});}_0x477005=_[_0x60ac('0x59')]({},_0x477005,_0x57fb57[_0x60ac('0x5a')]);return _0x42f49a[_0x60ac('0x108')](_0x477005);}})[_0x60ac('0x15')](function(_0x4e4ea4){if(_0x4e4ea4){_0x2f5e0c=_0x4e4ea4[_0x60ac('0x58')];if(!_0x57fb57[_0x60ac('0x45')][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x477005[_0x60ac('0x24')]=qs['limit'](_0x57fb57['query'][_0x60ac('0x24')]);_0x477005[_0x60ac('0x22')]=qs[_0x60ac('0x22')](_0x57fb57[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x42f49a[_0x60ac('0x108')](_0x477005);}})[_0x60ac('0x15')](function(_0x37b7ec){if(_0x37b7ec){return _0x37b7ec?{'count':_0x2f5e0c,'rows':_0x37b7ec}:null;}})[_0x60ac('0x15')](respondWithResult(_0x3d68c0,null))[_0x60ac('0x5c')](handleError(_0x3d68c0,null));};exports[_0x60ac('0x10a')]=function(_0x5c5de3,_0x18e5ba){return db[_0x60ac('0x3b')][_0x60ac('0x32')]({'where':{'id':_0x5c5de3['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x18e5ba,null))[_0x60ac('0x15')](function(_0x27dc7f){if(_0x27dc7f){var _0x283045=_0x27dc7f['get']({'plain':!![]});return _0x27dc7f['addTeams'](_0x5c5de3[_0x60ac('0x5d')]['ids'],_[_0x60ac('0x61')](_0x5c5de3[_0x60ac('0x5d')],[_0x60ac('0x60'),'id'])||{})[_0x60ac('0x15')](function(){for(var _0x293f88=0x0;_0x293f88<_0x5c5de3[_0x60ac('0x5d')][_0x60ac('0x60')][_0x60ac('0x58')];_0x293f88++){var _0x4ae8a6=[];var _0x48c12f={};db[_0x60ac('0x109')][_0x60ac('0x97')]({'where':{'id':_0x5c5de3[_0x60ac('0x5d')]['ids'][_0x293f88]}})[_0x60ac('0x15')](function(_0x50e22f){_0x48c12f=_0x50e22f[_0x60ac('0x48')];_0x4ae8a6[_0x60ac('0x42')](_0x50e22f['getVoiceQueues']()[_0x60ac('0x15')](function(_0x438815){for(var _0x5c2b25=0x0;_0x5c2b25<_0x438815[_0x60ac('0x58')];_0x5c2b25++){_0x438815[_0x5c2b25]['setDataValue'](_0x60ac('0xb0'),'Voice');}return _0x438815;}));_0x4ae8a6['push'](_0x50e22f[_0x60ac('0x10b')]()[_0x60ac('0x15')](function(_0x85cbb6){for(var _0x226be0=0x0;_0x226be0<_0x85cbb6[_0x60ac('0x58')];_0x226be0++){_0x85cbb6[_0x226be0][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x10d'));}return _0x85cbb6;}));_0x4ae8a6[_0x60ac('0x42')](_0x50e22f['getMailQueues']()[_0x60ac('0x15')](function(_0x45137f){for(var _0x67cfcd=0x0;_0x67cfcd<_0x45137f[_0x60ac('0x58')];_0x67cfcd++){_0x45137f[_0x67cfcd]['setDataValue'](_0x60ac('0xb0'),_0x60ac('0x10e'));}return _0x45137f;}));_0x4ae8a6[_0x60ac('0x42')](_0x50e22f[_0x60ac('0x10f')]()['then'](function(_0x134f84){for(var _0x35988d=0x0;_0x35988d<_0x134f84['length'];_0x35988d++){_0x134f84[_0x35988d][_0x60ac('0x10c')]('channel',_0x60ac('0x110'));}return _0x134f84;}));_0x4ae8a6[_0x60ac('0x42')](_0x50e22f[_0x60ac('0x111')]()[_0x60ac('0x15')](function(_0x2b6043){for(var _0xaeda44=0x0;_0xaeda44<_0x2b6043[_0x60ac('0x58')];_0xaeda44++){_0x2b6043[_0xaeda44][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x112'));}return _0x2b6043;}));_0x4ae8a6['push'](_0x50e22f[_0x60ac('0x113')]()[_0x60ac('0x15')](function(_0x287c99){for(var _0x545f27=0x0;_0x545f27<_0x287c99['length'];_0x545f27++){_0x287c99[_0x545f27][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x114'));}return _0x287c99;}));_0x4ae8a6[_0x60ac('0x42')](_0x50e22f[_0x60ac('0x115')]()['then'](function(_0x3fcc0f){for(var _0x26e83a=0x0;_0x26e83a<_0x3fcc0f[_0x60ac('0x58')];_0x26e83a++){_0x3fcc0f[_0x26e83a][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x116'));}return _0x3fcc0f;}));return BPromise['all'](_0x4ae8a6);})[_0x60ac('0x15')](function(_0x2f7d1a){var _0xe9de0=_[_0x60ac('0x117')](_0x2f7d1a);_0x4ae8a6=[];return db['sequelize'][_0x60ac('0x118')](function(_0x29737a){for(var _0x302292=0x0;_0x302292<_0xe9de0['length'];_0x302292++){_0x4ae8a6[_0x60ac('0x42')](_0xe9de0[_0x302292][_0x60ac('0x119')](_0x283045['id']),{'transaction':_0x29737a});}return BPromise[_0x60ac('0x4e')](_0x4ae8a6)[_0x60ac('0x15')](function(){if(_0x283045[_0x60ac('0x9e')]){return BPromise[_0x60ac('0xad')](_['filter'](_0xe9de0,function(_0x2c8ced){return _0x2c8ced[_0x60ac('0x11a')](_0x60ac('0xb0'))===_0x60ac('0x11b');}),function(_0xfb5b5){return db[_0x60ac('0xb4')][_0x60ac('0xae')]({'membername':_0x283045[_0x60ac('0x33')],'UserId':_0x283045['id'],'queue_name':_0xfb5b5[_0x60ac('0x33')],'VoiceQueueId':_0xfb5b5['id'],'interface':_[_0x60ac('0x68')](_0x283045['interface'])?util[_0x60ac('0xeb')](_0x60ac('0xec'),_0x283045[_0x60ac('0x33')]):_0x283045[_0x60ac('0xa1')],'paused':_0x283045[_0x60ac('0xa0')]||![],'penalty':_0x283045[_0x60ac('0xac')]},{'transaction':_0x29737a});});}else{return;}})[_0x60ac('0x15')](function(){for(var _0xbba08=0x0;_0xbba08<_0xe9de0[_0x60ac('0x58')];_0xbba08++){var _0x3f0894=_0xe9de0[_0xbba08][_0x60ac('0x11a')](_0x60ac('0xb0'));var _0x1ea1a0=_0x3f0894+'QueueId';socket[_0x60ac('0xa8')](_0x60ac('0x2b')+_0x3f0894+_0x60ac('0xa9'),{'UserId':_0x283045['id'],['queueField']:_0xe9de0[_0xbba08]['id']});}});});})[_0x60ac('0x15')](function(){db['TeamVoicePrefix'][_0x60ac('0x97')]({'where':{'teamId':_0x48c12f['id']}})[_0x60ac('0x15')](function(_0x188333){if(_0x188333){db[_0x60ac('0x11c')][_0x60ac('0x7e')]({'UserId':_0x5c5de3[_0x60ac('0x50')]['id'],'VoicePrefixId':_0x188333[_0x60ac('0x11d')]});}});});}});}})[_0x60ac('0x15')](respondWithStatusCode(_0x18e5ba,null))[_0x60ac('0x5c')](handleError(_0x18e5ba,null));};exports[_0x60ac('0x11e')]=function(_0x2a3cb8,_0x240a0a){return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x2a3cb8[_0x60ac('0x50')]['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x240a0a,null))[_0x60ac('0x15')](function(_0x3aba68){if(_0x3aba68){var _0x56d7f1=_0x3aba68[_0x60ac('0xd7')]({'plain':!![]});var _0x42cb0d=_0x2a3cb8[_0x60ac('0x45')][_0x60ac('0x60')];return _0x3aba68[_0x60ac('0x11e')](_0x42cb0d)[_0x60ac('0x15')](function(){for(var _0x2e000d=0x0;_0x2e000d<_0x42cb0d[_0x60ac('0x58')];_0x2e000d++){var _0x112980=[];var _0x4380cf={};db['Team'][_0x60ac('0x97')]({'where':{'id':_0x42cb0d[_0x2e000d]}})['then'](function(_0x4f152d){_0x4380cf=_0x4f152d[_0x60ac('0x48')];_0x112980[_0x60ac('0x42')](_0x4f152d[_0x60ac('0xf1')]()[_0x60ac('0x15')](function(_0x148079){for(var _0x2aebc4=0x0;_0x2aebc4<_0x148079[_0x60ac('0x58')];_0x2aebc4++){_0x148079[_0x2aebc4][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x11b'));}return _0x148079;}));_0x112980['push'](_0x4f152d[_0x60ac('0x10b')]()['then'](function(_0x37af40){for(var _0x5697e9=0x0;_0x5697e9<_0x37af40[_0x60ac('0x58')];_0x5697e9++){_0x37af40[_0x5697e9][_0x60ac('0x10c')]('channel',_0x60ac('0x10d'));}return _0x37af40;}));_0x112980[_0x60ac('0x42')](_0x4f152d[_0x60ac('0x11f')]()[_0x60ac('0x15')](function(_0x29bdf1){for(var _0x204282=0x0;_0x204282<_0x29bdf1[_0x60ac('0x58')];_0x204282++){_0x29bdf1[_0x204282]['setDataValue']('channel','Mail');}return _0x29bdf1;}));_0x112980[_0x60ac('0x42')](_0x4f152d[_0x60ac('0x10f')]()['then'](function(_0x40c071){for(var _0x2fbad9=0x0;_0x2fbad9<_0x40c071[_0x60ac('0x58')];_0x2fbad9++){_0x40c071[_0x2fbad9]['setDataValue'](_0x60ac('0xb0'),'Sms');}return _0x40c071;}));_0x112980[_0x60ac('0x42')](_0x4f152d['getWhatsappQueues']()[_0x60ac('0x15')](function(_0xeeacd3){for(var _0x5425ba=0x0;_0x5425ba<_0xeeacd3[_0x60ac('0x58')];_0x5425ba++){_0xeeacd3[_0x5425ba][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x112'));}return _0xeeacd3;}));_0x112980[_0x60ac('0x42')](_0x4f152d['getFaxQueues']()['then'](function(_0x29b682){for(var _0x761c9e=0x0;_0x761c9e<_0x29b682[_0x60ac('0x58')];_0x761c9e++){_0x29b682[_0x761c9e][_0x60ac('0x10c')](_0x60ac('0xb0'),'Fax');}return _0x29b682;}));_0x112980[_0x60ac('0x42')](_0x4f152d[_0x60ac('0x115')]()[_0x60ac('0x15')](function(_0x3248d0){for(var _0xc3eb5c=0x0;_0xc3eb5c<_0x3248d0[_0x60ac('0x58')];_0xc3eb5c++){_0x3248d0[_0xc3eb5c][_0x60ac('0x10c')](_0x60ac('0xb0'),_0x60ac('0x116'));}return _0x3248d0;}));return BPromise[_0x60ac('0x4e')](_0x112980);})[_0x60ac('0x15')](function(_0x403130){var _0x24d531=_[_0x60ac('0x117')](_0x403130);_0x112980=[];return db[_0x60ac('0x120')][_0x60ac('0x118')](function(_0x3cc751){for(var _0x5c132c=0x0;_0x5c132c<_0x24d531[_0x60ac('0x58')];_0x5c132c++){_0x112980[_0x60ac('0x42')](_0x24d531[_0x5c132c][_0x60ac('0x121')](_0x56d7f1['id']),{'transaction':_0x3cc751});}return BPromise[_0x60ac('0x4e')](_0x112980)[_0x60ac('0x15')](function(){if(_0x56d7f1['online']){return BPromise['each'](_[_0x60ac('0x2e')](_0x24d531,function(_0x18b523){return _0x18b523[_0x60ac('0x11a')]('channel')===_0x60ac('0x11b');}),function(_0x390fc2){return db[_0x60ac('0xb4')][_0x60ac('0x28')]({'where':{'VoiceQueueId':_0x390fc2['id'],'UserId':_0x56d7f1['id']},'transaction':_0x3cc751});});}else{return;}})[_0x60ac('0x15')](function(){db[_0x60ac('0x122')][_0x60ac('0x97')]({'where':{'teamId':_0x4380cf['id']}})[_0x60ac('0x15')](function(_0x4da7ee){if(_0x4da7ee){return db['UserVoicePrefix'][_0x60ac('0x28')]({'where':{'UserId':_0x56d7f1['id'],'VoicePrefixId':_0x4da7ee['dataValues'][_0x60ac('0x11d')]}});}});})['then'](function(){for(var _0x1ea837=0x0;_0x1ea837<_0x24d531['length'];_0x1ea837++){var _0x1a1658=_0x24d531[_0x1ea837][_0x60ac('0x11a')](_0x60ac('0xb0'));var _0x3b9bb0=_0x1a1658+_0x60ac('0xa7');socket['emit'](_0x60ac('0x2b')+_0x1a1658+_0x60ac('0xb3'),{'UserId':_0x56d7f1['id'],['queueField']:_0x24d531[_0x1ea837]['id']});}});});});}});}})[_0x60ac('0x15')](respondWithStatusCode(_0x240a0a,null))['catch'](handleError(_0x240a0a,null));};exports[_0x60ac('0x123')]=function(_0x140eea,_0x1bcce1){var _0x32a7ef={};var _0x54464f={};var _0x4f6b16;var _0x288d78;return db[_0x60ac('0x3b')][_0x60ac('0x97')]({'where':{'id':_0x140eea['params']['id']}})['then'](handleEntityNotFound(_0x1bcce1,null))[_0x60ac('0x15')](function(_0x2fd5d3){if(_0x2fd5d3){_0x4f6b16=_0x2fd5d3;_0x54464f['model']=_[_0x60ac('0x53')](db['CmList']['rawAttributes']);_0x54464f[_0x60ac('0x45')]=_['keys'](_0x140eea[_0x60ac('0x45')]);_0x54464f[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x54464f['model'],_0x54464f[_0x60ac('0x45')]);_0x32a7ef[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x54464f[_0x60ac('0x51')],qs['fields'](_0x140eea[_0x60ac('0x45')][_0x60ac('0xc9')]));_0x32a7ef[_0x60ac('0x41')]=_0x32a7ef[_0x60ac('0x41')][_0x60ac('0x58')]?_0x32a7ef[_0x60ac('0x41')]:_0x54464f[_0x60ac('0x51')];_0x32a7ef[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x140eea[_0x60ac('0x45')]['sort']);_0x32a7ef[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_[_0x60ac('0xcc')](_0x140eea[_0x60ac('0x45')],_0x54464f[_0x60ac('0x56')]));if(_0x140eea[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x32a7ef[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x32a7ef['where'],{'$or':_[_0x60ac('0x30')](_0x32a7ef[_0x60ac('0x41')],function(_0x520836){var _0x46337a={};_0x46337a[_0x520836]={'$like':'%'+_0x140eea[_0x60ac('0x45')]['filter']+'%'};return _0x46337a;})});}_0x32a7ef=_[_0x60ac('0x59')]({},_0x32a7ef,_0x140eea['options']);return _0x4f6b16[_0x60ac('0x123')](_0x32a7ef);}})[_0x60ac('0x15')](function(_0xffb67a){if(_0xffb67a){_0x288d78=_0xffb67a[_0x60ac('0x58')];if(!_0x140eea['query'][_0x60ac('0xce')](_0x60ac('0xd4'))){_0x32a7ef[_0x60ac('0x24')]=qs['limit'](_0x140eea[_0x60ac('0x45')]['limit']);_0x32a7ef['offset']=qs['offset'](_0x140eea[_0x60ac('0x45')][_0x60ac('0x22')]);}return _0x4f6b16[_0x60ac('0x123')](_0x32a7ef);}})[_0x60ac('0x15')](function(_0x18bbb9){if(_0x18bbb9){return _0x18bbb9?{'count':_0x288d78,'rows':_0x18bbb9}:null;}})['then'](respondWithResult(_0x1bcce1,null))[_0x60ac('0x5c')](handleError(_0x1bcce1,null));};exports[_0x60ac('0x124')]=function(_0x4efec2,_0x4b3b26){var _0x1c4025={};var _0x1668bf={};var _0x4f4914;return db['User']['findOne']({'where':{'id':_0x4efec2['params']['id']}})[_0x60ac('0x15')](handleEntityNotFound(_0x4b3b26,null))[_0x60ac('0x15')](function(_0x2d33e4){if(_0x2d33e4){_0x4f4914=_0x2d33e4;_0x1668bf['model']=_[_0x60ac('0x53')](db[_0x60ac('0x3b')][_0x60ac('0x54')]);_0x1668bf['query']=_[_0x60ac('0x53')](_0x4efec2['query']);_0x1668bf[_0x60ac('0x56')]=_[_0x60ac('0x57')](_0x1668bf[_0x60ac('0x51')],_0x1668bf['query']);_0x1c4025[_0x60ac('0x41')]=_[_0x60ac('0x57')](_0x1668bf['model'],qs['fields'](_0x4efec2[_0x60ac('0x45')]['fields']));_0x1c4025[_0x60ac('0x41')]=_0x1c4025[_0x60ac('0x41')]['length']?_0x1c4025[_0x60ac('0x41')]:_0x1668bf[_0x60ac('0x51')];_0x1c4025[_0x60ac('0xca')]=qs[_0x60ac('0xcb')](_0x4efec2[_0x60ac('0x45')]['sort']);_0x1c4025[_0x60ac('0xcd')]=qs[_0x60ac('0x56')](_['pick'](_0x4efec2[_0x60ac('0x45')],_0x1668bf['filters']));if(_0x4efec2[_0x60ac('0x45')][_0x60ac('0x2e')]){_0x1c4025[_0x60ac('0xcd')]=_[_0x60ac('0x59')](_0x1c4025[_0x60ac('0xcd')],{'$or':_[_0x60ac('0x30')](_0x1c4025[_0x60ac('0x41')],function(_0x5ae7d5){var _0x1958fa={};_0x1958fa[_0x5ae7d5]={'$like':'%'+_0x4efec2['query']['filter']+'%'};return _0x1958fa;})});}_0x1c4025['model']=db['User'];_0x1c4025['as']='Agents';_0x1c4025=_[_0x60ac('0x59')]({},_0x1c4025,_0x4efec2[_0x60ac('0x5a')]);return _0x4f4914[_0x60ac('0xf1')]({'include':[_0x1c4025]});}})[_0x60ac('0x15')](function(_0x5e43a8){if(_0x5e43a8){var _0x30f2af={},_0x3a8196=[];for(var _0x235821=0x0;_0x235821<_0x5e43a8[_0x60ac('0x58')];_0x235821+=0x1){for(var _0x3b3c15=0x0,_0x1f3e56;_0x3b3c15<_0x5e43a8[_0x235821][_0x60ac('0x85')][_0x60ac('0x58')];_0x3b3c15+=0x1){_0x1f3e56=_0x5e43a8[_0x235821][_0x60ac('0x85')][_0x3b3c15][_0x60ac('0xd7')]({'plain':!![]});_0x30f2af[_0x1f3e56['id']]=_0x1f3e56;}}_0x30f2af=_[_0x60ac('0x125')](_0x30f2af);for(var _0x1cbcdb=qs[_0x60ac('0x22')](_0x4efec2[_0x60ac('0x45')]['offset']);_0x1cbcdb<_0x30f2af[_0x60ac('0x58')]&&_0x3a8196[_0x60ac('0x58')]=_0x2cca3a['agents']){throw new Error(_0x6ae8('0x52'));}})[_0x6ae8('0xf')](function(){if(_0x2f6e16){return db[_0x6ae8('0x2a')][_0x6ae8('0x49')]({'where':{'membername':_0x2f6e16['name']},'individualHooks':!![]});}})['then'](function(){if(_0x2f6e16){return _0x2f6e16[_0x6ae8('0x53')]({'raw':!![]});}})[_0x6ae8('0xf')](function(_0x91beee){if(_0x2f6e16){if(_0x91beee){var _0x1e2361=[];_0x252f25=_0x91beee;if(_0x252f25[_0x6ae8('0x2e')]){for(var _0x242b09=0x0;_0x242b09<_0x252f25['length'];_0x242b09++){_0x1e2361[_0x6ae8('0x32')](db[_0x6ae8('0x2a')][_0x6ae8('0x54')]({'membername':_0x2f6e16['name'],'UserId':_0x2f6e16['id'],'queue_name':_0x252f25[_0x242b09]['name'],'VoiceQueueId':_0x252f25[_0x242b09]['id'],'interface':_0x6fe932,'paused':_0x2f6e16[_0x6ae8('0x55')]||![],'penalty':_0x252f25[_0x242b09]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6ae8('0x4b')](_0x1e2361);}}}})['then'](function(){if(_0x2f6e16){return db[_0x6ae8('0x2c')][_0x6ae8('0x1b')]({'where':{'membername':_0x2f6e16['name'],'exitAt':null}});}})['then'](function(_0x3aba11){if(_0x2f6e16){if(_0x3aba11&&_0x3aba11[_0x6ae8('0x2e')]){var _0x99ed08=[];_0x3aba11[_0x6ae8('0x4a')](function(_0x5224dc){_0x99ed08[_0x6ae8('0x32')](_0x5224dc[_0x6ae8('0x2b')]({'exitAt':moment()[_0x6ae8('0x2f')](_0x6ae8('0x30'))}));});return BPromise['all'](_0x99ed08);}}})['then'](function(_0x2243b2){if(_0x2f6e16){var _0x52426c=[];var _0x285960=[];var _0x7e0535=utils['getChannels']();var _0x226831={'membername':_0x2f6e16[_0x6ae8('0x27')],'interface':_0x6fe932,'enterAt':moment()[_0x6ae8('0x2f')](_0x6ae8('0x30')),'role':_0x2f6e16[_0x6ae8('0x4d')],'internal':_0x2f6e16[_0x6ae8('0x28')]};_0x7e0535['forEach'](function(_0x3ca2e1){_0x52426c['push'](_[_0x6ae8('0x56')]({'channel':_0x3ca2e1,'type':_0x6ae8('0x57'),'data1':_0x6ae8('0x58'),'data2':_0x6fe932},_0x226831));if(_0x2f6e16[_0x6ae8('0x55')]){_0x285960[_0x6ae8('0x32')](_['merge']({'channel':_0x3ca2e1,'type':'PAUSE','data1':_0x6ae8('0x59')},_0x226831));}});return db[_0x6ae8('0x2c')][_0x6ae8('0x38')](_0x52426c[_0x6ae8('0x5a')](_0x285960),{'individualHooks':!![]});}})[_0x6ae8('0xf')](function(){if(_0x2f6e16){return _0x2f6e16[_0x6ae8('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x6ae8('0x2f')](_0x6ae8('0x30')),'voicePause':_0x2f6e16['loginInPause']||![],'mailPause':_0x2f6e16[_0x6ae8('0x55')]||![],'chatPause':_0x2f6e16[_0x6ae8('0x55')]||![],'faxPause':_0x2f6e16['loginInPause']||![],'smsPause':_0x2f6e16[_0x6ae8('0x55')]||![],'openchannelPause':_0x2f6e16['loginInPause']||![],'pauseType':_0x2f6e16['loginInPause']?_0x6ae8('0x59'):null,'lastPauseAt':moment()[_0x6ae8('0x2f')](_0x6ae8('0x30')),'interface':_0x6fe932});}})[_0x6ae8('0xf')](function(_0x1bcaf4){_0x5e3823(_0x1bcaf4);})[_0x6ae8('0x18')](function(_0x4d6a88){_0x3168f1(_0x2e6791['error'](0x1f4,_0x4d6a88[_0x6ae8('0x16')]));});});}; \ No newline at end of file +var _0xbfc6=['name','role','internal','interface','findAll','PAUSE','updateAttributes','getChannels','forEach','isNil','format','SIP/%s','body','uniqueid','bulkCreate','update','type','YYYY-MM-DD\x20HH:mm:ss','channel','voice','UserVoiceQueueRt','mail','chat','fax','openchannel','system','set','%s%s','Pause','MemberReport','push','all','LogoutUser','findOne','destroy','length','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','./user.socket','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','options','raw','where','attributes','limit','include','map','model','find','ShowUser'];(function(_0x4fefc0,_0x4f67f4){var _0x3cb428=function(_0x53a609){while(--_0x53a609){_0x4fefc0['push'](_0x4fefc0['shift']());}};_0x3cb428(++_0x4f67f4);}(_0xbfc6,0x13a));var _0x6bfc=function(_0x44fac1,_0x3c2aa7){_0x44fac1=_0x44fac1-0x0;var _0x3bd7ed=_0xbfc6[_0x44fac1];return _0x3bd7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6bfc('0x0'));var fs=require('fs');var Redis=require(_0x6bfc('0x1'));var db=require(_0x6bfc('0x2'))['db'];var utils=require(_0x6bfc('0x3'));var logger=require(_0x6bfc('0x4'))(_0x6bfc('0x5'));var config=require(_0x6bfc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6bfc('0x7')][_0x6bfc('0x8')]({'port':0x232a});config['redis']=_[_0x6bfc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6bfc('0xa'))(new Redis(config[_0x6bfc('0xb')]));require(_0x6bfc('0xc'))['register'](socket);function respondWithRpcPromise(_0x470b0e,_0x17de23,_0x209d93){return new BPromise(function(_0x49cfa5,_0xbed81a){return client[_0x6bfc('0xd')](_0x470b0e,_0x209d93)[_0x6bfc('0xe')](function(_0xe420fd){logger[_0x6bfc('0xf')](_0x6bfc('0x10'),_0x17de23,_0x6bfc('0x11'));logger[_0x6bfc('0x12')](_0x6bfc('0x13'),_0x17de23,_0x6bfc('0x11'),JSON[_0x6bfc('0x14')](_0xe420fd));if(_0xe420fd[_0x6bfc('0x15')]){if(_0xe420fd['error'][_0x6bfc('0x16')]===0x1f4){logger[_0x6bfc('0x15')]('User,\x20%s,\x20%s',_0x17de23,_0xe420fd[_0x6bfc('0x15')][_0x6bfc('0x17')]);return _0xbed81a(_0xe420fd[_0x6bfc('0x15')]['message']);}logger[_0x6bfc('0x15')](_0x6bfc('0x10'),_0x17de23,_0xe420fd[_0x6bfc('0x15')]['message']);return _0x49cfa5(_0xe420fd[_0x6bfc('0x15')]['message']);}else{logger['info'](_0x6bfc('0x10'),_0x17de23,'request\x20sent');_0x49cfa5(_0xe420fd[_0x6bfc('0x18')]['message']);}})[_0x6bfc('0x19')](function(_0x338269){logger[_0x6bfc('0x15')](_0x6bfc('0x10'),_0x17de23,_0x338269);_0xbed81a(_0x338269);});});}exports[_0x6bfc('0x1a')]=function(_0x345879){var _0x21b68c=this;return new Promise(function(_0x13c4a0,_0x4d13c5){return db[_0x6bfc('0x1b')]['findAll']({'raw':_0x345879[_0x6bfc('0x1c')]?_0x345879[_0x6bfc('0x1c')][_0x6bfc('0x1d')]===undefined?!![]:![]:!![],'where':_0x345879[_0x6bfc('0x1c')]?_0x345879[_0x6bfc('0x1c')][_0x6bfc('0x1e')]||null:null,'attributes':_0x345879[_0x6bfc('0x1c')]?_0x345879['options'][_0x6bfc('0x1f')]||null:null,'limit':_0x345879['options']?_0x345879[_0x6bfc('0x1c')][_0x6bfc('0x20')]||null:null,'include':_0x345879[_0x6bfc('0x1c')]?_0x345879[_0x6bfc('0x1c')][_0x6bfc('0x21')]?_[_0x6bfc('0x22')](_0x345879[_0x6bfc('0x1c')][_0x6bfc('0x21')],function(_0x40dc17){return{'model':db[_0x40dc17[_0x6bfc('0x23')]],'as':_0x40dc17['as'],'attributes':_0x40dc17['attributes'],'include':_0x40dc17['include']?_[_0x6bfc('0x22')](_0x40dc17[_0x6bfc('0x21')],function(_0x121042){return{'model':db[_0x121042[_0x6bfc('0x23')]],'as':_0x121042['as'],'attributes':_0x121042['attributes'],'include':_0x121042['include']?_[_0x6bfc('0x22')](_0x121042[_0x6bfc('0x21')],function(_0x55744c){return{'model':db[_0x55744c[_0x6bfc('0x23')]],'as':_0x55744c['as'],'attributes':_0x55744c[_0x6bfc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6bfc('0xe')](function(_0x860301){logger[_0x6bfc('0xf')](_0x6bfc('0x1a'),_0x345879);logger[_0x6bfc('0x12')](_0x6bfc('0x1a'),_0x345879,JSON['stringify'](_0x860301));_0x13c4a0(_0x860301);})[_0x6bfc('0x19')](function(_0x116caa){logger['error']('GetUser',_0x116caa[_0x6bfc('0x17')],_0x345879);_0x4d13c5(_0x21b68c[_0x6bfc('0x15')](0x1f4,_0x116caa[_0x6bfc('0x17')]));});});};exports['ShowUser']=function(_0x1b4546){var _0x452875=this;return new Promise(function(_0x420563,_0x119c6d){return db[_0x6bfc('0x1b')][_0x6bfc('0x24')]({'raw':_0x1b4546['options']?_0x1b4546['options'][_0x6bfc('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4546[_0x6bfc('0x1c')]?_0x1b4546[_0x6bfc('0x1c')]['where']||null:null,'attributes':_0x1b4546[_0x6bfc('0x1c')]?_0x1b4546[_0x6bfc('0x1c')]['attributes']||null:null,'include':_0x1b4546[_0x6bfc('0x1c')]?_0x1b4546[_0x6bfc('0x1c')][_0x6bfc('0x21')]?_[_0x6bfc('0x22')](_0x1b4546['options'][_0x6bfc('0x21')],function(_0x4f1fa3){return{'model':db[_0x4f1fa3['model']],'as':_0x4f1fa3['as'],'attributes':_0x4f1fa3[_0x6bfc('0x1f')],'include':_0x4f1fa3[_0x6bfc('0x21')]?_[_0x6bfc('0x22')](_0x4f1fa3[_0x6bfc('0x21')],function(_0x3fc319){return{'model':db[_0x3fc319['model']],'as':_0x3fc319['as'],'attributes':_0x3fc319['attributes'],'include':_0x3fc319['include']?_[_0x6bfc('0x22')](_0x3fc319[_0x6bfc('0x21')],function(_0x1820ef){return{'model':db[_0x1820ef['model']],'as':_0x1820ef['as'],'attributes':_0x1820ef[_0x6bfc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6bfc('0xe')](function(_0x41ccb7){logger[_0x6bfc('0xf')]('ShowUser',_0x1b4546);logger[_0x6bfc('0x12')](_0x6bfc('0x25'),_0x1b4546,JSON[_0x6bfc('0x14')](_0x41ccb7));_0x420563(_0x41ccb7);})[_0x6bfc('0x19')](function(_0x2b53de){logger[_0x6bfc('0x15')](_0x6bfc('0x25'),_0x2b53de['message'],_0x1b4546);_0x119c6d(_0x452875[_0x6bfc('0x15')](0x1f4,_0x2b53de['message']));});});};exports['PauseUser']=function(_0x535c6a){var _0x755fd2=this;return new Promise(function(_0x5205b2,_0x52ae91){var _0x1b071e;return db['User'][_0x6bfc('0x24')]({'where':_0x535c6a[_0x6bfc('0x1c')]['where']||{},'attributes':['id',_0x6bfc('0x26'),_0x6bfc('0x27'),_0x6bfc('0x28'),_0x6bfc('0x29')]})[_0x6bfc('0xe')](function(_0x3214ac){if(_0x3214ac){_0x1b071e=_0x3214ac;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x1b071e['id']},'individualHooks':!![]});}})[_0x6bfc('0xe')](function(){if(_0x1b071e){return db['MemberReport'][_0x6bfc('0x2a')]({'where':{'membername':_0x1b071e[_0x6bfc('0x26')],'type':_0x6bfc('0x2b'),'exitAt':null}});}})[_0x6bfc('0xe')](function(_0x146a3c){if(_0x1b071e){if(_0x146a3c&&_0x146a3c['length']){var _0x182396=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5450f1=0x0,_0x1f1485=_0x146a3c['length'];_0x5450f1<_0x1f1485;_0x5450f1++){_0x146a3c[_0x5450f1][_0x6bfc('0x2c')]({'exitAt':_0x182396});}}}})[_0x6bfc('0xe')](function(){if(_0x1b071e){var _0x180140=[];var _0x1d699d=utils[_0x6bfc('0x2d')]();_0x1d699d[_0x6bfc('0x2e')](function(_0x120103){_0x180140['push']({'channel':_0x120103,'membername':_0x1b071e['name'],'interface':_[_0x6bfc('0x2f')](_0x1b071e[_0x6bfc('0x29')])?util[_0x6bfc('0x30')](_0x6bfc('0x31'),_0x1b071e[_0x6bfc('0x26')]):_0x1b071e['interface'],'type':_0x6bfc('0x2b'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x535c6a[_0x6bfc('0x32')]['type']||'DEFAULT\x20PAUSE','role':_0x1b071e[_0x6bfc('0x27')],'internal':_0x1b071e[_0x6bfc('0x28')],'uniqueid':_0x535c6a['body'][_0x6bfc('0x33')]||null});});return db['MemberReport'][_0x6bfc('0x34')](_0x180140,{'individualHooks':!![]});}})['then'](function(){if(_0x1b071e){return _0x1b071e[_0x6bfc('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x535c6a[_0x6bfc('0x32')][_0x6bfc('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6bfc('0x30')](_0x6bfc('0x37'))});}})[_0x6bfc('0xe')](function(_0x59eed2){_0x5205b2(_0x59eed2);})[_0x6bfc('0x19')](function(_0x4e0530){_0x52ae91(_0x755fd2[_0x6bfc('0x15')](0x1f4,_0x4e0530['message']));});});};exports['UnpauseUser']=function(_0x206984){var _0x3ef627=this;return new Promise(function(_0x566ebd,_0x3640a0){var _0xb19984;return db[_0x6bfc('0x1b')]['findOne']({'where':_0x206984[_0x6bfc('0x1c')][_0x6bfc('0x1e')]||{},'attributes':['id',_0x6bfc('0x26')]})[_0x6bfc('0xe')](function(_0x4db5e9){if(_0x4db5e9){_0xb19984=_0x4db5e9;if(_0x206984['body'][_0x6bfc('0x38')]&&!utils['isValidChannel'](_0x206984[_0x6bfc('0x32')][_0x6bfc('0x38')])){throw new Error('Unknown\x20channel');}switch(_0x206984[_0x6bfc('0x32')][_0x6bfc('0x38')]){case _0x6bfc('0x39'):return db[_0x6bfc('0x3a')][_0x6bfc('0x35')]({'paused':0x0},{'where':{'UserId':_0xb19984['id']}})[_0x6bfc('0xe')](function(){return db['MemberReport']['find']({'where':{'channel':_0x206984['body'][_0x6bfc('0x38')],'membername':_0xb19984[_0x6bfc('0x26')],'type':_0x6bfc('0x2b'),'exitAt':null}});})[_0x6bfc('0xe')](function(_0x47bc29){if(_0x47bc29){return _0x47bc29[_0x6bfc('0x35')]({'exitAt':moment()[_0x6bfc('0x30')](_0x6bfc('0x37')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x6bfc('0xe')](function(){return _0xb19984['update']({'voicePause':![]});});case _0x6bfc('0x3b'):case _0x6bfc('0x3c'):case _0x6bfc('0x3d'):case'sms':case _0x6bfc('0x3e'):case'whatsapp':return db['MemberReport'][_0x6bfc('0x24')]({'where':{'channel':_0x206984[_0x6bfc('0x32')][_0x6bfc('0x38')],'membername':_0xb19984[_0x6bfc('0x26')],'type':_0x6bfc('0x2b'),'exitAt':null}})[_0x6bfc('0xe')](function(_0x1d6a28){return _0x1d6a28['update']({'exitAt':moment()[_0x6bfc('0x30')](_0x6bfc('0x37')),'data2':_0x6bfc('0x3f')},{'individualHooks':!![]});})['then'](function(){var _0x26d2d5={};_[_0x6bfc('0x40')](_0x26d2d5,util[_0x6bfc('0x30')](_0x6bfc('0x41'),_0x206984[_0x6bfc('0x32')]['channel'],_0x6bfc('0x42')),![]);return _0xb19984[_0x6bfc('0x35')](_0x26d2d5);});default:return db[_0x6bfc('0x3a')]['update']({'paused':0x0},{'where':{'UserId':_0xb19984['id']}})[_0x6bfc('0xe')](function(){return db[_0x6bfc('0x43')][_0x6bfc('0x2a')]({'where':{'membername':_0xb19984[_0x6bfc('0x26')],'type':'PAUSE','exitAt':null}});})[_0x6bfc('0xe')](function(_0x3fc790){var _0x168aeb=[];_0x3fc790[_0x6bfc('0x2e')](function(_0x53fbe3){_0x168aeb[_0x6bfc('0x44')](_0x53fbe3[_0x6bfc('0x35')]({'exitAt':moment()[_0x6bfc('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x6bfc('0x3f')}));});return BPromise[_0x6bfc('0x45')](_0x168aeb);})[_0x6bfc('0xe')](function(){return _0xb19984[_0x6bfc('0x35')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x6bfc('0xe')](function(_0x18036e){_0x566ebd(_0x18036e);})['catch'](function(_0x6995d1){_0x3640a0(_0x3ef627[_0x6bfc('0x15')](0x1f4,_0x6995d1[_0x6bfc('0x17')]));});});};exports[_0x6bfc('0x46')]=function(_0x3b238c){var _0x4bedcf=this;return new Promise(function(_0x35c0a9,_0xd8a92a){var _0x2e6794;return db['User'][_0x6bfc('0x47')]({'where':_0x3b238c[_0x6bfc('0x1c')][_0x6bfc('0x1e')]||{},'attributes':['id',_0x6bfc('0x26')]})['then'](function(_0x277a26){if(_0x277a26){_0x2e6794=_0x277a26;return db['UserVoiceQueueRt'][_0x6bfc('0x48')]({'where':{'membername':_0x2e6794['name']},'individualHooks':!![]});}})[_0x6bfc('0xe')](function(){if(_0x2e6794){return db[_0x6bfc('0x43')][_0x6bfc('0x2a')]({'where':{'membername':_0x2e6794['name'],'exitAt':null}});}})[_0x6bfc('0xe')](function(_0x4a03fe){if(_0x2e6794){if(_0x4a03fe&&_0x4a03fe[_0x6bfc('0x49')]){var _0xd9d1aa=[];_0x4a03fe['forEach'](function(_0x179258){_0xd9d1aa[_0x6bfc('0x44')](_0x179258['update']({'exitAt':moment()['format'](_0x6bfc('0x37'))}));});return BPromise[_0x6bfc('0x45')](_0xd9d1aa);}}})[_0x6bfc('0xe')](function(){if(_0x2e6794){return _0x2e6794[_0x6bfc('0x35')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6bfc('0xe')](function(_0x53a1bb){_0x35c0a9(_0x53a1bb);})[_0x6bfc('0x19')](function(_0x252134){_0xd8a92a(_0x4bedcf[_0x6bfc('0x15')](0x1f4,_0x252134[_0x6bfc('0x17')]));});});};exports[_0x6bfc('0x4a')]=function(_0x1dd669){var _0x1983af=this;return new Promise(function(_0x40c944,_0xc423d3){var _0x1d0e0b;var _0x19fbde;var _0x56ce8b;var _0x3d97d6;return db['User'][_0x6bfc('0x47')]({'where':_0x1dd669[_0x6bfc('0x1c')]['where']||{},'attributes':['id',_0x6bfc('0x26'),_0x6bfc('0x27'),_0x6bfc('0x4b'),'phone',_0x6bfc('0x28'),_0x6bfc('0x4c'),_0x6bfc('0x29')]})[_0x6bfc('0xe')](function(_0x6e4be3){if(_0x6e4be3){_0x1d0e0b=_0x6e4be3;_0x3d97d6=_0x1dd669[_0x6bfc('0x32')]['interface']?_0x1dd669['body']['interface']:util[_0x6bfc('0x30')]('SIP/%s',_0x1d0e0b[_0x6bfc('0x26')]);return db[_0x6bfc('0x1b')][_0x6bfc('0x4d')]({'where':{'role':_0x6bfc('0x4e'),'online':!![],'id':{'$ne':_0x1d0e0b['id']}}});}})['then'](function(_0x14ae31){if(_0x14ae31){_0x56ce8b=_0x14ae31;return require(_0x6bfc('0x4f'))[_0x6bfc('0x50')]();}})['then'](function(_0x247ea0){if(_0x247ea0&&_0x247ea0['agents']&&_0x56ce8b>=_0x247ea0[_0x6bfc('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x1d0e0b){return db[_0x6bfc('0x3a')][_0x6bfc('0x48')]({'where':{'membername':_0x1d0e0b['name']},'individualHooks':!![]});}})['then'](function(){if(_0x1d0e0b){return _0x1d0e0b[_0x6bfc('0x52')]({'raw':!![]});}})['then'](function(_0x4445e7){if(_0x1d0e0b){if(_0x4445e7){var _0x42c13b=[];_0x19fbde=_0x4445e7;if(_0x19fbde['length']){for(var _0x1c8a71=0x0;_0x1c8a71<_0x19fbde[_0x6bfc('0x49')];_0x1c8a71++){_0x42c13b[_0x6bfc('0x44')](db[_0x6bfc('0x3a')]['upsert']({'membername':_0x1d0e0b[_0x6bfc('0x26')],'UserId':_0x1d0e0b['id'],'queue_name':_0x19fbde[_0x1c8a71][_0x6bfc('0x26')],'VoiceQueueId':_0x19fbde[_0x1c8a71]['id'],'interface':_0x3d97d6,'paused':_0x1d0e0b[_0x6bfc('0x4c')]||![],'penalty':_0x19fbde[_0x1c8a71][_0x6bfc('0x53')]||0x0}));}return BPromise[_0x6bfc('0x45')](_0x42c13b);}}}})[_0x6bfc('0xe')](function(){if(_0x1d0e0b){return db[_0x6bfc('0x43')][_0x6bfc('0x2a')]({'where':{'membername':_0x1d0e0b[_0x6bfc('0x26')],'exitAt':null}});}})[_0x6bfc('0xe')](function(_0x4ff9f7){if(_0x1d0e0b){if(_0x4ff9f7&&_0x4ff9f7[_0x6bfc('0x49')]){var _0x2fda67=[];_0x4ff9f7[_0x6bfc('0x2e')](function(_0x490926){_0x2fda67[_0x6bfc('0x44')](_0x490926[_0x6bfc('0x35')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2fda67);}}})[_0x6bfc('0xe')](function(_0x5b7083){if(_0x1d0e0b){var _0x4b3647=[];var _0x2898a5=[];var _0xffea7e=utils[_0x6bfc('0x2d')]();var _0x4f21df={'membername':_0x1d0e0b[_0x6bfc('0x26')],'interface':_0x3d97d6,'enterAt':moment()['format'](_0x6bfc('0x37')),'role':_0x1d0e0b[_0x6bfc('0x27')],'internal':_0x1d0e0b['internal']};_0xffea7e[_0x6bfc('0x2e')](function(_0x416165){_0x4b3647[_0x6bfc('0x44')](_[_0x6bfc('0x54')]({'channel':_0x416165,'type':_0x6bfc('0x55'),'data1':'callysquare','data2':_0x3d97d6},_0x4f21df));if(_0x1d0e0b[_0x6bfc('0x4c')]){_0x2898a5[_0x6bfc('0x44')](_[_0x6bfc('0x54')]({'channel':_0x416165,'type':_0x6bfc('0x2b'),'data1':_0x6bfc('0x56')},_0x4f21df));}});return db[_0x6bfc('0x43')][_0x6bfc('0x34')](_0x4b3647[_0x6bfc('0x57')](_0x2898a5),{'individualHooks':!![]});}})[_0x6bfc('0xe')](function(){if(_0x1d0e0b){return _0x1d0e0b['update']({'online':!![],'lastLoginAt':moment()[_0x6bfc('0x30')](_0x6bfc('0x37')),'voicePause':_0x1d0e0b[_0x6bfc('0x4c')]||![],'mailPause':_0x1d0e0b['loginInPause']||![],'chatPause':_0x1d0e0b[_0x6bfc('0x4c')]||![],'faxPause':_0x1d0e0b[_0x6bfc('0x4c')]||![],'smsPause':_0x1d0e0b[_0x6bfc('0x4c')]||![],'openchannelPause':_0x1d0e0b[_0x6bfc('0x4c')]||![],'pauseType':_0x1d0e0b['loginInPause']?_0x6bfc('0x56'):null,'lastPauseAt':moment()['format'](_0x6bfc('0x37')),'interface':_0x3d97d6});}})[_0x6bfc('0xe')](function(_0x4685fc){_0x40c944(_0x4685fc);})[_0x6bfc('0x19')](function(_0x2d122f){_0xc423d3(_0x1983af[_0x6bfc('0x15')](0x1f4,_0x2d122f[_0x6bfc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8612484..58bda5d 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 _0x42eb=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x219384,_0xb1699a){var _0x4425d1=function(_0x5c18e5){while(--_0x5c18e5){_0x219384['push'](_0x219384['shift']());}};_0x4425d1(++_0xb1699a);}(_0x42eb,0x6a));var _0xb42e=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x42eb[_0x1dac7a];return _0x4cb363;};'use strict';var UserEvents=require(_0xb42e('0x0'));var events=[_0xb42e('0x1'),_0xb42e('0x2'),_0xb42e('0x3')];function createListener(_0x3ff3e9,_0x57be1d){return function(_0x107009){_0x57be1d[_0xb42e('0x4')](_0x3ff3e9,_0x107009);};}function removeListener(_0x3680ba,_0x3e109e){return function(){UserEvents[_0xb42e('0x5')](_0x3680ba,_0x3e109e);};}exports[_0xb42e('0x6')]=function(_0x20f101){for(var _0xfc192b=0x0,_0x38be1d=events[_0xb42e('0x7')];_0xfc192b<_0x38be1d;_0xfc192b++){var _0x25f226=events[_0xfc192b];var _0x26d482=createListener(_0xb42e('0x8')+_0x25f226,_0x20f101);UserEvents['on'](_0x25f226,_0x26d482);}}; \ No newline at end of file +var _0xe142=['emit','removeListener','length','user:','save','remove','update'];(function(_0x305c8f,_0x5700e2){var _0xbc99e2=function(_0x181067){while(--_0x181067){_0x305c8f['push'](_0x305c8f['shift']());}};_0xbc99e2(++_0x5700e2);}(_0xe142,0xdd));var _0x2e14=function(_0x2bf186,_0x50c945){_0x2bf186=_0x2bf186-0x0;var _0x2c0ae8=_0xe142[_0x2bf186];return _0x2c0ae8;};'use strict';var UserEvents=require('./user.events');var events=[_0x2e14('0x0'),_0x2e14('0x1'),_0x2e14('0x2')];function createListener(_0x326344,_0x30329e){return function(_0x24bbac){_0x30329e[_0x2e14('0x3')](_0x326344,_0x24bbac);};}function removeListener(_0x40bf27,_0x5815af){return function(){UserEvents[_0x2e14('0x4')](_0x40bf27,_0x5815af);};}exports['register']=function(_0x3458fa){for(var _0x49b293=0x0,_0x5da1e0=events[_0x2e14('0x5')];_0x49b293<_0x5da1e0;_0x49b293++){var _0x16284d=events[_0x49b293];var _0x408195=createListener(_0x2e14('0x6')+_0x16284d,_0x3458fa);UserEvents['on'](_0x16284d,_0x408195);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6b1e379..b469945 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(_0x48161d,_0x2f543c){var _0x399160=function(_0x7479ed){while(--_0x7479ed){_0x48161d['push'](_0x48161d['shift']());}};_0x399160(++_0x2f543c);}(_0x70e0,0x17b));var _0x070e=function(_0x32bddb,_0x82eac){_0x32bddb=_0x32bddb-0x0;var _0x5b1344=_0x70e0[_0x32bddb];return _0x5b1344;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 469025c..a2eb8b6 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 _0x3ea3=['exports','INTEGER','sequelize'];(function(_0x93172e,_0x397713){var _0x3d1675=function(_0x17e999){while(--_0x17e999){_0x93172e['push'](_0x93172e['shift']());}};_0x3d1675(++_0x397713);}(_0x3ea3,0xc5));var _0x33ea=function(_0x9474e9,_0x4cec31){_0x9474e9=_0x9474e9-0x0;var _0x39f843=_0x3ea3[_0x9474e9];return _0x39f843;};'use strict';var Sequelize=require(_0x33ea('0x0'));module[_0x33ea('0x1')]={'penalty':{'type':Sequelize[_0x33ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f51=['sequelize','exports','INTEGER'];(function(_0x401a4d,_0x4bb835){var _0x1faaff=function(_0x57539e){while(--_0x57539e){_0x401a4d['push'](_0x401a4d['shift']());}};_0x1faaff(++_0x4bb835);}(_0x8f51,0x9c));var _0x18f5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8f51[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x18f5('0x0'));module[_0x18f5('0x1')]={'penalty':{'type':Sequelize[_0x18f5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0eba387..1184c85 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 _0x486b=['define','user_has_chat_queues','lodash','util','api','moment','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x48a8cc,_0x431fc9){var _0x1451d5=function(_0x2dd66b){while(--_0x2dd66b){_0x48a8cc['push'](_0x48a8cc['shift']());}};_0x1451d5(++_0x431fc9);}(_0x486b,0x174));var _0xb486=function(_0x1c2692,_0x1a4ec4){_0x1c2692=_0x1c2692-0x0;var _0xe370f0=_0x486b[_0x1c2692];return _0xe370f0;};'use strict';var _=require(_0xb486('0x0'));var util=require(_0xb486('0x1'));var logger=require('../../config/logger')(_0xb486('0x2'));var moment=require(_0xb486('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb486('0x4'));var config=require(_0xb486('0x5'));var attributes=require(_0xb486('0x6'));module[_0xb486('0x7')]=function(_0x3265ce,_0x2307c3){return _0x3265ce[_0xb486('0x8')]('UserChatQueue',attributes,{'tableName':_0xb486('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc83b=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x28f500,_0x4ba95c){var _0x1937b5=function(_0x29961b){while(--_0x29961b){_0x28f500['push'](_0x28f500['shift']());}};_0x1937b5(++_0x4ba95c);}(_0xc83b,0x18f));var _0xbc83=function(_0x4ba4b0,_0x9f2d28){_0x4ba4b0=_0x4ba4b0-0x0;var _0x10bad3=_0xc83b[_0x4ba4b0];return _0x10bad3;};'use strict';var _=require(_0xbc83('0x0'));var util=require(_0xbc83('0x1'));var logger=require(_0xbc83('0x2'))(_0xbc83('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc83('0x4'));var fs=require('fs');var path=require(_0xbc83('0x5'));var rimraf=require(_0xbc83('0x6'));var config=require(_0xbc83('0x7'));var attributes=require(_0xbc83('0x8'));module[_0xbc83('0x9')]=function(_0x421404,_0x57d666){return _0x421404[_0xbc83('0xa')](_0xbc83('0xb'),attributes,{'tableName':_0xbc83('0xc'),'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 7a4d0c5..3eb174e 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 _0x07a7=['request','then','info','request\x20sent','debug','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3d62e0,_0x183b08){var _0x29d7de=function(_0x27936f){while(--_0x27936f){_0x3d62e0['push'](_0x3d62e0['shift']());}};_0x29d7de(++_0x183b08);}(_0x07a7,0x1af));var _0x707a=function(_0x2c46f1,_0x2e9eb1){_0x2c46f1=_0x2c46f1-0x0;var _0x192097=_0x07a7[_0x2c46f1];return _0x192097;};'use strict';var _=require(_0x707a('0x0'));var util=require(_0x707a('0x1'));var moment=require('moment');var BPromise=require(_0x707a('0x2'));var rs=require(_0x707a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x707a('0x4'))['db'];var utils=require(_0x707a('0x5'));var logger=require('../../config/logger')(_0x707a('0x6'));var config=require(_0x707a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x707a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44498d,_0x1ca72f,_0x127480){return new BPromise(function(_0x2dd863,_0xf3c5b8){return client[_0x707a('0x9')](_0x44498d,_0x127480)[_0x707a('0xa')](function(_0x212000){logger[_0x707a('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x1ca72f,_0x707a('0xc'));logger[_0x707a('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1ca72f,_0x707a('0xc'),JSON['stringify'](_0x212000));if(_0x212000[_0x707a('0xe')]){if(_0x212000[_0x707a('0xe')][_0x707a('0xf')]===0x1f4){logger[_0x707a('0xe')](_0x707a('0x10'),_0x1ca72f,_0x212000[_0x707a('0xe')][_0x707a('0x11')]);return _0xf3c5b8(_0x212000['error']['message']);}logger[_0x707a('0xe')](_0x707a('0x10'),_0x1ca72f,_0x212000[_0x707a('0xe')][_0x707a('0x11')]);return _0x2dd863(_0x212000[_0x707a('0xe')]['message']);}else{logger[_0x707a('0xb')](_0x707a('0x10'),_0x1ca72f,'request\x20sent');_0x2dd863(_0x212000[_0x707a('0x12')][_0x707a('0x11')]);}})[_0x707a('0x13')](function(_0x445396){logger[_0x707a('0xe')](_0x707a('0x10'),_0x1ca72f,_0x445396);_0xf3c5b8(_0x445396);});});} \ No newline at end of file +var _0xfd65=['request','then','info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x5446e2,_0x2b620e){var _0xf67318=function(_0x4868f1){while(--_0x4868f1){_0x5446e2['push'](_0x5446e2['shift']());}};_0xf67318(++_0x2b620e);}(_0xfd65,0x182));var _0x5fd6=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xfd65[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require(_0x5fd6('0x0'));var moment=require(_0x5fd6('0x1'));var BPromise=require(_0x5fd6('0x2'));var rs=require(_0x5fd6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fd6('0x4'))['db'];var utils=require(_0x5fd6('0x5'));var logger=require(_0x5fd6('0x6'))('rpc');var config=require(_0x5fd6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fd6('0x8')][_0x5fd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26382a,_0x581fc6,_0x163b31){return new BPromise(function(_0x51ee57,_0x5083a3){return client[_0x5fd6('0xa')](_0x26382a,_0x163b31)[_0x5fd6('0xb')](function(_0x311fd8){logger[_0x5fd6('0xc')](_0x5fd6('0xd'),_0x581fc6,'request\x20sent');logger[_0x5fd6('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x581fc6,_0x5fd6('0xf'),JSON[_0x5fd6('0x10')](_0x311fd8));if(_0x311fd8[_0x5fd6('0x11')]){if(_0x311fd8[_0x5fd6('0x11')][_0x5fd6('0x12')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x581fc6,_0x311fd8[_0x5fd6('0x11')][_0x5fd6('0x13')]);return _0x5083a3(_0x311fd8[_0x5fd6('0x11')][_0x5fd6('0x13')]);}logger[_0x5fd6('0x11')](_0x5fd6('0xd'),_0x581fc6,_0x311fd8[_0x5fd6('0x11')]['message']);return _0x51ee57(_0x311fd8[_0x5fd6('0x11')]['message']);}else{logger[_0x5fd6('0xc')](_0x5fd6('0xd'),_0x581fc6,'request\x20sent');_0x51ee57(_0x311fd8[_0x5fd6('0x14')][_0x5fd6('0x13')]);}})[_0x5fd6('0x15')](function(_0x5e591a){logger[_0x5fd6('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x581fc6,_0x5e591a);_0x5083a3(_0x5e591a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 046e712..ae8fe1e 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x29941f,_0x187d20){var _0x453246=function(_0x762c5e){while(--_0x762c5e){_0x29941f['push'](_0x29941f['shift']());}};_0x453246(++_0x187d20);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10a96a,_0x2e8bda){var _0xf50a21=function(_0x1c7edf){while(--_0x1c7edf){_0x10a96a['push'](_0x10a96a['shift']());}};_0xf50a21(++_0x2e8bda);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7e927ca..01b9419 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 _0xd553=['INTEGER','STRING','sequelize','exports'];(function(_0x1d762a,_0x41cc91){var _0x4bf5ce=function(_0x417043){while(--_0x417043){_0x1d762a['push'](_0x1d762a['shift']());}};_0x4bf5ce(++_0x41cc91);}(_0xd553,0x17a));var _0x3d55=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xd553[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x3d55('0x0'));module[_0x3d55('0x1')]={'penalty':{'type':Sequelize[_0x3d55('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3d55('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3d55('0x3')]}}; \ No newline at end of file +var _0xc68f=['STRING','INTEGER'];(function(_0x23a6ef,_0x50761d){var _0x57228e=function(_0x31aa97){while(--_0x31aa97){_0x23a6ef['push'](_0x23a6ef['shift']());}};_0x57228e(++_0x50761d);}(_0xc68f,0x185));var _0xfc68=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc68f[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfc68('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfc68('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b06ca5c..434a90c 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 _0xd6f1=['api','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','UserFaxQueue','../../config/logger'];(function(_0x3f8811,_0x1f30e9){var _0x4ef8ce=function(_0x11524d){while(--_0x11524d){_0x3f8811['push'](_0x3f8811['shift']());}};_0x4ef8ce(++_0x1f30e9);}(_0xd6f1,0x8f));var _0x1d6f=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd6f1[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d6f('0x0'))(_0x1d6f('0x1'));var moment=require('moment');var BPromise=require(_0x1d6f('0x2'));var rp=require(_0x1d6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d6f('0x4'));var config=require('../../config/environment');var attributes=require(_0x1d6f('0x5'));module[_0x1d6f('0x6')]=function(_0x370908,_0xc87f00){return _0x370908['define'](_0x1d6f('0x7'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9c7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xb9c7,0x1d8));var _0x7b9c=function(_0x2f6350,_0x53f48a){_0x2f6350=_0x2f6350-0x0;var _0x1ba50d=_0xb9c7[_0x2f6350];return _0x1ba50d;};'use strict';var _=require(_0x7b9c('0x0'));var util=require(_0x7b9c('0x1'));var logger=require(_0x7b9c('0x2'))(_0x7b9c('0x3'));var moment=require(_0x7b9c('0x4'));var BPromise=require(_0x7b9c('0x5'));var rp=require(_0x7b9c('0x6'));var fs=require('fs');var path=require(_0x7b9c('0x7'));var rimraf=require(_0x7b9c('0x8'));var config=require(_0x7b9c('0x9'));var attributes=require(_0x7b9c('0xa'));module[_0x7b9c('0xb')]=function(_0x3f8acb,_0x2c7214){return _0x3f8acb[_0x7b9c('0xc')](_0x7b9c('0xd'),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 bf9ddf6..6242549 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 _0x350b=['request','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','client'];(function(_0x4a6b92,_0x53929c){var _0x303f17=function(_0x30a218){while(--_0x30a218){_0x4a6b92['push'](_0x4a6b92['shift']());}};_0x303f17(++_0x53929c);}(_0x350b,0x13e));var _0xb350=function(_0x1c545d,_0xa3b3c8){_0x1c545d=_0x1c545d-0x0;var _0x3e0712=_0x350b[_0x1c545d];return _0x3e0712;};'use strict';var _=require(_0xb350('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb350('0x1'));var rs=require(_0xb350('0x2'));var fs=require('fs');var Redis=require(_0xb350('0x3'));var db=require(_0xb350('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[_0xb350('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2efbf3,_0x36b032,_0x1125ef){return new BPromise(function(_0x544ca8,_0x1edd0d){return client[_0xb350('0x6')](_0x2efbf3,_0x1125ef)[_0xb350('0x7')](function(_0x2cdb5d){logger[_0xb350('0x8')]('UserFaxQueue,\x20%s,\x20%s',_0x36b032,'request\x20sent');logger[_0xb350('0x9')](_0xb350('0xa'),_0x36b032,_0xb350('0xb'),JSON[_0xb350('0xc')](_0x2cdb5d));if(_0x2cdb5d[_0xb350('0xd')]){if(_0x2cdb5d[_0xb350('0xd')][_0xb350('0xe')]===0x1f4){logger[_0xb350('0xd')](_0xb350('0xf'),_0x36b032,_0x2cdb5d[_0xb350('0xd')][_0xb350('0x10')]);return _0x1edd0d(_0x2cdb5d[_0xb350('0xd')][_0xb350('0x10')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x36b032,_0x2cdb5d[_0xb350('0xd')]['message']);return _0x544ca8(_0x2cdb5d[_0xb350('0xd')][_0xb350('0x10')]);}else{logger[_0xb350('0x8')](_0xb350('0xf'),_0x36b032,_0xb350('0xb'));_0x544ca8(_0x2cdb5d['result']['message']);}})[_0xb350('0x11')](function(_0x11a4c7){logger[_0xb350('0xd')](_0xb350('0xf'),_0x36b032,_0x11a4c7);_0x1edd0d(_0x11a4c7);});});} \ No newline at end of file +var _0xcbe4=['http','request','then','info','request\x20sent','debug','stringify','error','message','UserFaxQueue,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x29e9c9,_0x40268b){var _0x3fd762=function(_0x1a7440){while(--_0x1a7440){_0x29e9c9['push'](_0x29e9c9['shift']());}};_0x3fd762(++_0x40268b);}(_0xcbe4,0x15c));var _0x4cbe=function(_0x1e794f,_0x26c582){_0x1e794f=_0x1e794f-0x0;var _0x4539a5=_0xcbe4[_0x1e794f];return _0x4539a5;};'use strict';var _=require('lodash');var util=require(_0x4cbe('0x0'));var moment=require('moment');var BPromise=require(_0x4cbe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cbe('0x2'));var db=require(_0x4cbe('0x3'))['db'];var utils=require(_0x4cbe('0x4'));var logger=require(_0x4cbe('0x5'))(_0x4cbe('0x6'));var config=require(_0x4cbe('0x7'));var jayson=require(_0x4cbe('0x8'));var client=jayson['client'][_0x4cbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17b23e,_0x2d6b00,_0x388e29){return new BPromise(function(_0x388146,_0x5a50f7){return client[_0x4cbe('0xa')](_0x17b23e,_0x388e29)[_0x4cbe('0xb')](function(_0x14f90a){logger[_0x4cbe('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x2d6b00,_0x4cbe('0xd'));logger[_0x4cbe('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2d6b00,_0x4cbe('0xd'),JSON[_0x4cbe('0xf')](_0x14f90a));if(_0x14f90a[_0x4cbe('0x10')]){if(_0x14f90a[_0x4cbe('0x10')]['code']===0x1f4){logger[_0x4cbe('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2d6b00,_0x14f90a[_0x4cbe('0x10')][_0x4cbe('0x11')]);return _0x5a50f7(_0x14f90a[_0x4cbe('0x10')][_0x4cbe('0x11')]);}logger[_0x4cbe('0x10')](_0x4cbe('0x12'),_0x2d6b00,_0x14f90a[_0x4cbe('0x10')][_0x4cbe('0x11')]);return _0x388146(_0x14f90a[_0x4cbe('0x10')][_0x4cbe('0x11')]);}else{logger['info'](_0x4cbe('0x12'),_0x2d6b00,_0x4cbe('0xd'));_0x388146(_0x14f90a[_0x4cbe('0x13')][_0x4cbe('0x11')]);}})[_0x4cbe('0x14')](function(_0xa719a0){logger[_0x4cbe('0x10')](_0x4cbe('0x12'),_0x2d6b00,_0xa719a0);_0x5a50f7(_0xa719a0);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d2e9e3d..881531e 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x568e59,_0x1a411c){var _0x223993=function(_0xfaf2e6){while(--_0xfaf2e6){_0x568e59['push'](_0x568e59['shift']());}};_0x223993(++_0x1a411c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xcb91[_0x1f36bb];return _0xaf97fa;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x11b2c7,_0x5a19e5){var _0x31a7b6=function(_0x412d10){while(--_0x412d10){_0x11b2c7['push'](_0x11b2c7['shift']());}};_0x31a7b6(++_0x5a19e5);}(_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 f5ca1da..dc88fc2 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 _0x8e81=['exports','INTEGER','sequelize'];(function(_0x24fdba,_0x21bd61){var _0x4a93f=function(_0x60b32d){while(--_0x60b32d){_0x24fdba['push'](_0x24fdba['shift']());}};_0x4a93f(++_0x21bd61);}(_0x8e81,0x1d0));var _0x18e8=function(_0x2ba495,_0x25503e){_0x2ba495=_0x2ba495-0x0;var _0x5d7c00=_0x8e81[_0x2ba495];return _0x5d7c00;};'use strict';var Sequelize=require(_0x18e8('0x0'));module[_0x18e8('0x1')]={'penalty':{'type':Sequelize[_0x18e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8757=['exports'];(function(_0xa0e34d,_0x4c2932){var _0x5bdcc1=function(_0x36ce29){while(--_0x36ce29){_0xa0e34d['push'](_0xa0e34d['shift']());}};_0x5bdcc1(++_0x4c2932);}(_0x8757,0xfe));var _0x7875=function(_0x13e9d8,_0x5afef8){_0x13e9d8=_0x13e9d8-0x0;var _0x1acd01=_0x8757[_0x13e9d8];return _0x1acd01;};'use strict';var Sequelize=require('sequelize');module[_0x7875('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 ae6c45f..198ab7d 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 _0x71ee=['UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x588f96,_0x2df201){var _0x30395e=function(_0x4d4656){while(--_0x4d4656){_0x588f96['push'](_0x588f96['shift']());}};_0x30395e(++_0x2df201);}(_0x71ee,0xb2));var _0xe71e=function(_0x4fc9c1,_0x570e05){_0x4fc9c1=_0x4fc9c1-0x0;var _0x15d7a1=_0x71ee[_0x4fc9c1];return _0x15d7a1;};'use strict';var _=require(_0xe71e('0x0'));var util=require(_0xe71e('0x1'));var logger=require('../../config/logger')(_0xe71e('0x2'));var moment=require(_0xe71e('0x3'));var BPromise=require(_0xe71e('0x4'));var rp=require(_0xe71e('0x5'));var fs=require('fs');var path=require(_0xe71e('0x6'));var rimraf=require('rimraf');var config=require(_0xe71e('0x7'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x399aaf,_0x1b39d6){return _0x399aaf[_0xe71e('0x8')](_0xe71e('0x9'),attributes,{'tableName':_0xe71e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x061f=['util','../../config/logger','api','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x061f,0x1c2));var _0xf061=function(_0x1a151f,_0x1446c8){_0x1a151f=_0x1a151f-0x0;var _0x36b7f6=_0x061f[_0x1a151f];return _0x36b7f6;};'use strict';var _=require(_0xf061('0x0'));var util=require(_0xf061('0x1'));var logger=require(_0xf061('0x2'))(_0xf061('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf061('0x4'));var rimraf=require(_0xf061('0x5'));var config=require(_0xf061('0x6'));var attributes=require(_0xf061('0x7'));module[_0xf061('0x8')]=function(_0x54e112,_0x4e0b91){return _0x54e112[_0xf061('0x9')](_0xf061('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d4972ee..eb5e804 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2819a9,_0xc7c5d){var _0x6a7fa2=function(_0x12195f){while(--_0x12195f){_0x2819a9['push'](_0x2819a9['shift']());}};_0x6a7fa2(++_0xc7c5d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1029fb,_0xcfb4b0){var _0x4720a4=function(_0x1a10ac){while(--_0x1a10ac){_0x1029fb['push'](_0x1029fb['shift']());}};_0x4720a4(++_0xcfb4b0);}(_0x34e8,0x12c));var _0x834e=function(_0x509e2d,_0x36b639){_0x509e2d=_0x509e2d-0x0;var _0x4ce1b9=_0x34e8[_0x509e2d];return _0x4ce1b9;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a50c75f..bf9ef9e 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 _0xdac5=['sendUserNotification','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x342b4c,_0x381e5d){var _0x4aa2dc=function(_0x22c3d1){while(--_0x22c3d1){_0x342b4c['push'](_0x342b4c['shift']());}};_0x4aa2dc(++_0x381e5d);}(_0xdac5,0x176));var _0x5dac=function(_0x4f35f6,_0x45ece2){_0x4f35f6=_0x4f35f6-0x0;var _0x18fb88=_0xdac5[_0x4f35f6];return _0x18fb88;};'use strict';var multer=require(_0x5dac('0x0'));var util=require(_0x5dac('0x1'));var path=require('path');var timeout=require(_0x5dac('0x2'));var express=require('express');var router=express[_0x5dac('0x3')]();var fs_extra=require(_0x5dac('0x4'));var auth=require(_0x5dac('0x5'));var interaction=require(_0x5dac('0x6'));var config=require(_0x5dac('0x7'));var controller=require(_0x5dac('0x8'));router[_0x5dac('0x9')]('/',auth['isAuthenticated'](),controller[_0x5dac('0xa')]);module[_0x5dac('0xb')]=router; \ No newline at end of file +var _0x4078=['post','isAuthenticated','sendUserNotification','exports','path','express','Router','../../components/auth/service','../../config/environment','./userNotification.controller'];(function(_0x42fbe9,_0x48dbd2){var _0xf2d941=function(_0x6e4c61){while(--_0x6e4c61){_0x42fbe9['push'](_0x42fbe9['shift']());}};_0xf2d941(++_0x48dbd2);}(_0x4078,0xf4));var _0x8407=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x4078[_0x5678b5];return _0x4c09a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8407('0x0'));var timeout=require('connect-timeout');var express=require(_0x8407('0x1'));var router=express[_0x8407('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8407('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8407('0x4'));var controller=require(_0x8407('0x5'));router[_0x8407('0x6')]('/',auth[_0x8407('0x7')](),controller[_0x8407('0x8')]);module[_0x8407('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 bac5c38..21bc910 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 _0xe235=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x38121a,_0xca4044){var _0x268c8c=function(_0x594961){while(--_0x594961){_0x38121a['push'](_0x38121a['shift']());}};_0x268c8c(++_0xca4044);}(_0xe235,0x1a7));var _0x5e23=function(_0x18c679,_0x5f0393){_0x18c679=_0x18c679-0x0;var _0x2476fd=_0xe235[_0x18c679];return _0x2476fd;};'use strict';var Sequelize=require(_0x5e23('0x0'));module[_0x5e23('0x1')]={'body':{'type':Sequelize[_0x5e23('0x2')]},'senderName':{'type':Sequelize[_0x5e23('0x3')]},'recipientsId':{'type':Sequelize[_0x5e23('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5e23('0x3')]},'beep':{'type':Sequelize[_0x5e23('0x4')]}}; \ No newline at end of file +var _0x8b3c=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x30779f,_0x589472){var _0x977d37=function(_0x515a74){while(--_0x515a74){_0x30779f['push'](_0x30779f['shift']());}};_0x977d37(++_0x589472);}(_0x8b3c,0x14a));var _0xc8b3=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x8b3c[_0x3048ea];return _0x1a13c4;};'use strict';var Sequelize=require(_0xc8b3('0x0'));module[_0xc8b3('0x1')]={'body':{'type':Sequelize[_0xc8b3('0x2')]},'senderName':{'type':Sequelize[_0xc8b3('0x3')]},'recipientsId':{'type':Sequelize[_0xc8b3('0x2')]},'recipientsDescription':{'type':Sequelize[_0xc8b3('0x3')]},'beep':{'type':Sequelize[_0xc8b3('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 254208b..da3bb92 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 _0x6f1a=['offset','undefined','count','limit','set','Content-Range','reject','then','destroy','end','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','transaction','UserNotification','create','recipient','userNotification:send','catch','text','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','toLowerCase','User','union','ids','queue','replace','Queue','all','flatten','findOne','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0x6f1a,0xfb));var _0xa6f1=function(_0x1cbf5c,_0x43b975){_0x1cbf5c=_0x1cbf5c-0x0;var _0x207a03=_0x6f1a[_0x1cbf5c];return _0x207a03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6f1('0x0'));var zipdir=require(_0xa6f1('0x1'));var jsonpatch=require(_0xa6f1('0x2'));var rp=require(_0xa6f1('0x3'));var moment=require(_0xa6f1('0x4'));var BPromise=require(_0xa6f1('0x5'));var Mustache=require('mustache');var util=require(_0xa6f1('0x6'));var path=require('path');var sox=require(_0xa6f1('0x7'));var csv=require(_0xa6f1('0x8'));var ejs=require(_0xa6f1('0x9'));var fs=require('fs');var fs_extra=require(_0xa6f1('0xa'));var _=require('lodash');var squel=require(_0xa6f1('0xb'));var crypto=require(_0xa6f1('0xc'));var jsforce=require(_0xa6f1('0xd'));var deskjs=require(_0xa6f1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa6f1('0xf'));var Redis=require(_0xa6f1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa6f1('0x11'));var as=require(_0xa6f1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6f1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa6f1('0x14'));var licenseUtil=require(_0xa6f1('0x15'));var db=require(_0xa6f1('0x16'))['db'];config[_0xa6f1('0x17')]=_[_0xa6f1('0x18')](config[_0xa6f1('0x17')],{'host':_0xa6f1('0x19'),'port':0x18eb});var socket=require(_0xa6f1('0x1a'))(new Redis(config[_0xa6f1('0x17')]));require(_0xa6f1('0x1b'))[_0xa6f1('0x1c')](socket);function respondWithStatusCode(_0x556cb5,_0x10da61){_0x10da61=_0x10da61||0xcc;return function(_0x2eda61){if(_0x2eda61){return _0x556cb5[_0xa6f1('0x1d')](_0x10da61);}return _0x556cb5[_0xa6f1('0x1e')](_0x10da61)['end']();};}function respondWithResult(_0x2760f2,_0x13f984){_0x13f984=_0x13f984||0xc8;return function(_0xa84dc5){if(_0xa84dc5){return _0x2760f2[_0xa6f1('0x1e')](_0x13f984)['json'](_0xa84dc5);}};}function respondWithFilteredResult(_0x48ddad,_0x847c55){return function(_0x354d10){if(_0x354d10){var _0x4fa2a5=typeof _0x847c55[_0xa6f1('0x1f')]===_0xa6f1('0x20')&&typeof _0x847c55['limit']===_0xa6f1('0x20');var _0x18fe1b=_0x354d10[_0xa6f1('0x21')];var _0x336b37=_0x4fa2a5?0x0:_0x847c55[_0xa6f1('0x1f')];var _0xa5cd0a=_0x4fa2a5?_0x354d10[_0xa6f1('0x21')]:_0x847c55[_0xa6f1('0x1f')]+_0x847c55[_0xa6f1('0x22')];var _0x228492;if(_0xa5cd0a>=_0x18fe1b){_0xa5cd0a=_0x18fe1b;_0x228492=0xc8;}else{_0x228492=0xce;}_0x48ddad[_0xa6f1('0x1e')](_0x228492);return _0x48ddad[_0xa6f1('0x23')](_0xa6f1('0x24'),_0x336b37+'-'+_0xa5cd0a+'/'+_0x18fe1b)['json'](_0x354d10);}return null;};}function patchUpdates(_0x17df99){return function(_0x1b84ae){try{jsonpatch['apply'](_0x1b84ae,_0x17df99,!![]);}catch(_0xa58df){return BPromise[_0xa6f1('0x25')](_0xa58df);}return _0x1b84ae['save']();};}function saveUpdates(_0xd327a0,_0x4cca02){return function(_0x1f0699){if(_0x1f0699){return _0x1f0699['update'](_0xd327a0)[_0xa6f1('0x26')](function(_0x444dd5){return _0x444dd5;});}return null;};}function removeEntity(_0xb6dd7b,_0x11a417){return function(_0x4a8661){if(_0x4a8661){return _0x4a8661[_0xa6f1('0x27')]()[_0xa6f1('0x26')](function(){_0xb6dd7b[_0xa6f1('0x1e')](0xcc)[_0xa6f1('0x28')]();});}};}function handleEntityNotFound(_0x4725e6,_0x2a714c){return function(_0x5f11de){if(!_0x5f11de){_0x4725e6[_0xa6f1('0x1d')](0x194);}return _0x5f11de;};}function handleError(_0x5b4144,_0x1b2816){_0x1b2816=_0x1b2816||0x1f4;return function(_0x2ac98b){logger[_0xa6f1('0x29')](_0x2ac98b[_0xa6f1('0x2a')]);if(_0x2ac98b[_0xa6f1('0x2b')]){delete _0x2ac98b['name'];}_0x5b4144[_0xa6f1('0x1e')](_0x1b2816)[_0xa6f1('0x2c')](_0x2ac98b);};}exports['sendUserNotification']=function(_0x545515,_0x59bac1,_0x5d6e96){if(!_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x2e')]('text')&&!_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x2e')](_0xa6f1('0x2f'))){throw new db[(_0xa6f1('0x30'))][(_0xa6f1('0x31'))](_0xa6f1('0x32'));}else{if(_0x545515[_0xa6f1('0x2d')]['hasOwnProperty'](_0xa6f1('0x2f'))&&!_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x2e')](_0xa6f1('0x33'))){throw new db[(_0xa6f1('0x30'))][(_0xa6f1('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x545515['body'][_0xa6f1('0x2e')](_0xa6f1('0x34'))){throw new db['Sequelize'][(_0xa6f1('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x495e0e=JSON[_0xa6f1('0x35')](_0x545515[_0xa6f1('0x2d')]['recipients']);}catch(_0x2a97dc){logger[_0xa6f1('0x29')](_0x2a97dc);throw new db['Sequelize'][(_0xa6f1('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x4ba5e3=[_0xa6f1('0x36'),_0xa6f1('0x37'),_0xa6f1('0x38'),_0xa6f1('0x39'),'smsqueue',_0xa6f1('0x3a'),_0xa6f1('0x3b'),_0xa6f1('0x3c'),'user'];if(_[_0xa6f1('0x3d')](_0x495e0e,function(_0x52da42){return!_['includes'](_0x4ba5e3,_0x52da42[_0xa6f1('0x3e')]['toLowerCase']());})){throw new db[(_0xa6f1('0x30'))][(_0xa6f1('0x31'))](_0xa6f1('0x3f'));}}}var _0x417299={};_0x417299[_0xa6f1('0x40')]=_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x2e')]('senderName')?_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x40')]:_0x545515['user']['fullname'];_0x417299[_0xa6f1('0x41')]=_[_0xa6f1('0x42')](_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x41')])?null:_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x41')];_0x417299[_0xa6f1('0x43')]=_0x545515[_0xa6f1('0x2d')][_0xa6f1('0x43')]||![];_0x417299[_0xa6f1('0x44')]=_0x545515['user']['id'];return getContent(_0x545515[_0xa6f1('0x2d')])['then'](function(_0x5d2da7){_0x417299[_0xa6f1('0x2d')]=_0x5d2da7;return getRecipients(_0x495e0e);})[_0xa6f1('0x26')](function(_0x5bb90d){_0x417299['recipientsId']=_['sortBy'](_0x5bb90d)[_0xa6f1('0x45')](',');return db[_0xa6f1('0x46')][_0xa6f1('0x47')](function(_0x1eeb29){return db[_0xa6f1('0x48')][_0xa6f1('0x49')](_0x417299,{'raw':!![],'transaction':_0x1eeb29})[_0xa6f1('0x26')](function(_0x5513ed){var _0x1f4fcd={'sender':_0x417299[_0xa6f1('0x40')],'description':_0x417299[_0xa6f1('0x41')],'content':_0x417299['body'],'beep':_0x417299['beep']};_0x5bb90d['forEach'](function(_0x22c309){_0x1f4fcd[_0xa6f1('0x4a')]=_0x22c309;socket['emit'](_0xa6f1('0x4b'),_0x1f4fcd);});return _0x5513ed;});});})[_0xa6f1('0x26')](respondWithResult(_0x59bac1,0xc9))[_0xa6f1('0x4c')](handleError(_0x59bac1,null));};function getContent(_0x4bcf29){return new BPromise(function(_0x4aeb88,_0x2d09a8){if(_0x4bcf29['text']){_0x4aeb88(_0x4bcf29[_0xa6f1('0x4d')]);return;}return db['Template']['findOne']({'attributes':[_0xa6f1('0x4e')],'where':{'id':_0x4bcf29[_0xa6f1('0x2f')]},'raw':!![]})[_0xa6f1('0x26')](function(_0x141bc4){if(!_0x141bc4)throw new db['Sequelize']['ValidationError'](_0xa6f1('0x4f'));var _0x4436fe=Mustache['render'](_0x141bc4[_0xa6f1('0x4e')],_0x4bcf29[_0xa6f1('0x33')]);_0x4aeb88(_0x4436fe);})[_0xa6f1('0x4c')](function(_0x1031ab){_0x2d09a8(_0x1031ab);});});}function getRecipients(_0x1e8141){return new BPromise(function(_0x326232,_0x59e2ca){var _0x228f94=[];var _0x1454b2=[];_0x1e8141[_0xa6f1('0x50')](function(_0x5ca960){var _0x28a4c4=_[_0xa6f1('0x51')](_0x5ca960[_0xa6f1('0x3e')][_0xa6f1('0x52')]());if(_0x28a4c4===_0xa6f1('0x53')){_0x228f94=_[_0xa6f1('0x54')](_0x228f94,_0x5ca960[_0xa6f1('0x55')]);}else{if(_['includes'](_0x28a4c4,_0xa6f1('0x56')))_0x28a4c4=_0x28a4c4[_0xa6f1('0x57')]('queue',_0xa6f1('0x58'));_0x5ca960[_0xa6f1('0x55')][_0xa6f1('0x50')](function(_0x47ced9){_0x1454b2['push'](getAgents(_0x28a4c4,_0x47ced9));});}});return BPromise[_0xa6f1('0x59')](_0x1454b2)[_0xa6f1('0x26')](function(_0x1425b6){_0x228f94=_[_0xa6f1('0x54')](_0x228f94,_[_0xa6f1('0x5a')](_0x1425b6));_0x326232(_0x228f94);})['catch'](function(_0xf6a15){_0x59e2ca(_0xf6a15);});});}function getAgents(_0x1164d1,_0x577f9a){return new BPromise(function(_0x3ca064,_0x55e192){return db[_0x1164d1][_0xa6f1('0x5b')]({'where':{'id':_0x577f9a}})[_0xa6f1('0x26')](function(_0x582150){return _0x582150[_0xa6f1('0x5c')]({'attributes':['id'],'raw':!![]})[_0xa6f1('0x26')](function(_0x114e1a){var _0x18736c=_[_0xa6f1('0x5d')](_0x114e1a,'id');_0x3ca064(_0x18736c);});})[_0xa6f1('0x4c')](function(_0x58f72f){_0x55e192(_0x58f72f);});});} \ No newline at end of file +var _0xdf0f=['startCase','User','union','queue','replace','Queue','ids','push','all','flatten','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','reject','update','then','destroy','error','stack','name','body','text','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x5a3b5d,_0x5d2356){var _0xaf710d=function(_0x3dc7c4){while(--_0x3dc7c4){_0x5a3b5d['push'](_0x5a3b5d['shift']());}};_0xaf710d(++_0x5d2356);}(_0xdf0f,0xd9));var _0xfdf0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdf0f[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xfdf0('0x0'));var rimraf=require(_0xfdf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdf0('0x2'));var rp=require(_0xfdf0('0x3'));var moment=require(_0xfdf0('0x4'));var BPromise=require(_0xfdf0('0x5'));var Mustache=require(_0xfdf0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfdf0('0x7'));var ejs=require(_0xfdf0('0x8'));var fs=require('fs');var fs_extra=require(_0xfdf0('0x9'));var _=require(_0xfdf0('0xa'));var squel=require(_0xfdf0('0xb'));var crypto=require(_0xfdf0('0xc'));var jsforce=require(_0xfdf0('0xd'));var deskjs=require(_0xfdf0('0xe'));var toCsv=require(_0xfdf0('0x7'));var querystring=require(_0xfdf0('0xf'));var Papa=require(_0xfdf0('0x10'));var Redis=require('ioredis');var authService=require(_0xfdf0('0x11'));var qs=require(_0xfdf0('0x12'));var as=require(_0xfdf0('0x13'));var hardwareService=require(_0xfdf0('0x14'));var logger=require('../../config/logger')(_0xfdf0('0x15'));var utils=require('../../config/utils');var config=require(_0xfdf0('0x16'));var licenseUtil=require(_0xfdf0('0x17'));var db=require(_0xfdf0('0x18'))['db'];config[_0xfdf0('0x19')]=_[_0xfdf0('0x1a')](config['redis'],{'host':_0xfdf0('0x1b'),'port':0x18eb});var socket=require(_0xfdf0('0x1c'))(new Redis(config[_0xfdf0('0x19')]));require('./userNotification.socket')[_0xfdf0('0x1d')](socket);function respondWithStatusCode(_0x468fb3,_0x52871f){_0x52871f=_0x52871f||0xcc;return function(_0x40af4d){if(_0x40af4d){return _0x468fb3[_0xfdf0('0x1e')](_0x52871f);}return _0x468fb3['status'](_0x52871f)[_0xfdf0('0x1f')]();};}function respondWithResult(_0x4a10a0,_0x3dca38){_0x3dca38=_0x3dca38||0xc8;return function(_0x4ac347){if(_0x4ac347){return _0x4a10a0['status'](_0x3dca38)['json'](_0x4ac347);}};}function respondWithFilteredResult(_0x4397d9,_0x1313e1){return function(_0xdc3c78){if(_0xdc3c78){var _0x4c6172=typeof _0x1313e1['offset']===_0xfdf0('0x20')&&typeof _0x1313e1[_0xfdf0('0x21')]===_0xfdf0('0x20');var _0x2a56e3=_0xdc3c78[_0xfdf0('0x22')];var _0x453842=_0x4c6172?0x0:_0x1313e1[_0xfdf0('0x23')];var _0x404a95=_0x4c6172?_0xdc3c78[_0xfdf0('0x22')]:_0x1313e1['offset']+_0x1313e1['limit'];var _0x26cc0c;if(_0x404a95>=_0x2a56e3){_0x404a95=_0x2a56e3;_0x26cc0c=0xc8;}else{_0x26cc0c=0xce;}_0x4397d9[_0xfdf0('0x24')](_0x26cc0c);return _0x4397d9[_0xfdf0('0x25')](_0xfdf0('0x26'),_0x453842+'-'+_0x404a95+'/'+_0x2a56e3)[_0xfdf0('0x27')](_0xdc3c78);}return null;};}function patchUpdates(_0x19e731){return function(_0x32d28d){try{jsonpatch['apply'](_0x32d28d,_0x19e731,!![]);}catch(_0x4e7b04){return BPromise[_0xfdf0('0x28')](_0x4e7b04);}return _0x32d28d['save']();};}function saveUpdates(_0x2af7bb,_0x5f0823){return function(_0x495975){if(_0x495975){return _0x495975[_0xfdf0('0x29')](_0x2af7bb)[_0xfdf0('0x2a')](function(_0x2c05e8){return _0x2c05e8;});}return null;};}function removeEntity(_0x5a77cc,_0x18bd77){return function(_0x3a8ac9){if(_0x3a8ac9){return _0x3a8ac9[_0xfdf0('0x2b')]()['then'](function(){_0x5a77cc[_0xfdf0('0x24')](0xcc)[_0xfdf0('0x1f')]();});}};}function handleEntityNotFound(_0x274f0d,_0x1bff0e){return function(_0x2249e7){if(!_0x2249e7){_0x274f0d[_0xfdf0('0x1e')](0x194);}return _0x2249e7;};}function handleError(_0x5140b1,_0x2b1d15){_0x2b1d15=_0x2b1d15||0x1f4;return function(_0x48b3ff){logger[_0xfdf0('0x2c')](_0x48b3ff[_0xfdf0('0x2d')]);if(_0x48b3ff[_0xfdf0('0x2e')]){delete _0x48b3ff[_0xfdf0('0x2e')];}_0x5140b1[_0xfdf0('0x24')](_0x2b1d15)['send'](_0x48b3ff);};}exports['sendUserNotification']=function(_0x2ebdb3,_0x1e86ba,_0x28cf3f){if(!_0x2ebdb3[_0xfdf0('0x2f')]['hasOwnProperty'](_0xfdf0('0x30'))&&!_0x2ebdb3[_0xfdf0('0x2f')][_0xfdf0('0x31')]('TemplateId')){throw new db['Sequelize'][(_0xfdf0('0x32'))](_0xfdf0('0x33'));}else{if(_0x2ebdb3[_0xfdf0('0x2f')][_0xfdf0('0x31')](_0xfdf0('0x34'))&&!_0x2ebdb3['body'][_0xfdf0('0x31')](_0xfdf0('0x35'))){throw new db[(_0xfdf0('0x36'))][(_0xfdf0('0x32'))](_0xfdf0('0x37'));}if(!_0x2ebdb3[_0xfdf0('0x2f')]['hasOwnProperty'](_0xfdf0('0x38'))){throw new db[(_0xfdf0('0x36'))][(_0xfdf0('0x32'))](_0xfdf0('0x39'));}else{try{var _0xaa58df=JSON[_0xfdf0('0x3a')](_0x2ebdb3[_0xfdf0('0x2f')][_0xfdf0('0x38')]);}catch(_0x3700a6){logger['error'](_0x3700a6);throw new db[(_0xfdf0('0x36'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x4df49a=[_0xfdf0('0x3b'),_0xfdf0('0x3c'),_0xfdf0('0x3d'),'openchannelqueue','smsqueue',_0xfdf0('0x3e'),_0xfdf0('0x3f'),_0xfdf0('0x40'),'user'];if(_[_0xfdf0('0x41')](_0xaa58df,function(_0x5b81a5){return!_[_0xfdf0('0x42')](_0x4df49a,_0x5b81a5[_0xfdf0('0x43')][_0xfdf0('0x44')]());})){throw new db[(_0xfdf0('0x36'))][(_0xfdf0('0x32'))](_0xfdf0('0x45'));}}}var _0x298799={};_0x298799[_0xfdf0('0x46')]=_0x2ebdb3['body']['hasOwnProperty']('senderName')?_0x2ebdb3['body'][_0xfdf0('0x46')]:_0x2ebdb3[_0xfdf0('0x47')]['fullname'];_0x298799['recipientsDescription']=_['isEmpty'](_0x2ebdb3[_0xfdf0('0x2f')]['recipientsDescription'])?null:_0x2ebdb3[_0xfdf0('0x2f')][_0xfdf0('0x48')];_0x298799[_0xfdf0('0x49')]=_0x2ebdb3['body']['beep']||![];_0x298799[_0xfdf0('0x4a')]=_0x2ebdb3[_0xfdf0('0x47')]['id'];return getContent(_0x2ebdb3[_0xfdf0('0x2f')])[_0xfdf0('0x2a')](function(_0x294f43){_0x298799[_0xfdf0('0x2f')]=_0x294f43;return getRecipients(_0xaa58df);})[_0xfdf0('0x2a')](function(_0x13b8e2){_0x298799[_0xfdf0('0x4b')]=_[_0xfdf0('0x4c')](_0x13b8e2)[_0xfdf0('0x4d')](',');return db[_0xfdf0('0x4e')][_0xfdf0('0x4f')](function(_0x2e238a){return db[_0xfdf0('0x50')][_0xfdf0('0x51')](_0x298799,{'raw':!![],'transaction':_0x2e238a})[_0xfdf0('0x2a')](function(_0x14e161){var _0x13d294={'sender':_0x298799[_0xfdf0('0x46')],'description':_0x298799[_0xfdf0('0x48')],'content':_0x298799[_0xfdf0('0x2f')],'beep':_0x298799[_0xfdf0('0x49')]};_0x13b8e2[_0xfdf0('0x52')](function(_0x2bebb0){_0x13d294[_0xfdf0('0x53')]=_0x2bebb0;socket[_0xfdf0('0x54')](_0xfdf0('0x55'),_0x13d294);});return _0x14e161;});});})['then'](respondWithResult(_0x1e86ba,0xc9))[_0xfdf0('0x56')](handleError(_0x1e86ba,null));};function getContent(_0x392b6d){return new BPromise(function(_0x5878cc,_0x503f76){if(_0x392b6d[_0xfdf0('0x30')]){_0x5878cc(_0x392b6d[_0xfdf0('0x30')]);return;}return db[_0xfdf0('0x57')][_0xfdf0('0x58')]({'attributes':[_0xfdf0('0x59')],'where':{'id':_0x392b6d[_0xfdf0('0x34')]},'raw':!![]})[_0xfdf0('0x2a')](function(_0x59bc66){if(!_0x59bc66)throw new db[(_0xfdf0('0x36'))]['ValidationError'](_0xfdf0('0x5a'));var _0x1dc04a=Mustache[_0xfdf0('0x5b')](_0x59bc66[_0xfdf0('0x59')],_0x392b6d[_0xfdf0('0x35')]);_0x5878cc(_0x1dc04a);})['catch'](function(_0x580899){_0x503f76(_0x580899);});});}function getRecipients(_0xf923f4){return new BPromise(function(_0x14ab91,_0x1af1b1){var _0x1a696e=[];var _0x58a96b=[];_0xf923f4['forEach'](function(_0x15fab9){var _0x595f22=_[_0xfdf0('0x5c')](_0x15fab9[_0xfdf0('0x43')][_0xfdf0('0x44')]());if(_0x595f22===_0xfdf0('0x5d')){_0x1a696e=_[_0xfdf0('0x5e')](_0x1a696e,_0x15fab9['ids']);}else{if(_[_0xfdf0('0x42')](_0x595f22,_0xfdf0('0x5f')))_0x595f22=_0x595f22[_0xfdf0('0x60')](_0xfdf0('0x5f'),_0xfdf0('0x61'));_0x15fab9[_0xfdf0('0x62')][_0xfdf0('0x52')](function(_0x14510b){_0x58a96b[_0xfdf0('0x63')](getAgents(_0x595f22,_0x14510b));});}});return BPromise[_0xfdf0('0x64')](_0x58a96b)[_0xfdf0('0x2a')](function(_0x5addf4){_0x1a696e=_[_0xfdf0('0x5e')](_0x1a696e,_[_0xfdf0('0x65')](_0x5addf4));_0x14ab91(_0x1a696e);})[_0xfdf0('0x56')](function(_0x174c7a){_0x1af1b1(_0x174c7a);});});}function getAgents(_0x2137b1,_0x33646d){return new BPromise(function(_0x5e321c,_0xa94adc){return db[_0x2137b1][_0xfdf0('0x58')]({'where':{'id':_0x33646d}})[_0xfdf0('0x2a')](function(_0x314db5){return _0x314db5[_0xfdf0('0x66')]({'attributes':['id'],'raw':!![]})[_0xfdf0('0x2a')](function(_0x342921){var _0x3c518d=_['map'](_0x342921,'id');_0x5e321c(_0x3c518d);});})['catch'](function(_0x3cc8ae){_0xa94adc(_0x3cc8ae);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 130add5..7a9da1a 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 _0x4da8=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','events'];(function(_0x363386,_0x133d90){var _0x231f49=function(_0x2ecb44){while(--_0x2ecb44){_0x363386['push'](_0x363386['shift']());}};_0x231f49(++_0x133d90);}(_0x4da8,0x13f));var _0x84da=function(_0x18b6b3,_0x4fb3cf){_0x18b6b3=_0x18b6b3-0x0;var _0x51579d=_0x4da8[_0x18b6b3];return _0x51579d;};'use strict';var EventEmitter=require(_0x84da('0x0'));var UserNotification=require(_0x84da('0x1'))['db'][_0x84da('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x84da('0x3')](0x0);var events={'afterCreate':_0x84da('0x4'),'afterUpdate':_0x84da('0x5'),'afterDestroy':_0x84da('0x6')};function emitEvent(_0x357f0d){return function(_0x4080ef,_0x12c491,_0x2f113a){UserNotificationEvents[_0x84da('0x7')](_0x357f0d+':'+_0x4080ef['id'],_0x4080ef);UserNotificationEvents['emit'](_0x357f0d,_0x4080ef);_0x2f113a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x8f81=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2a74f3,_0x284aa1){var _0x50195d=function(_0x1518ee){while(--_0x1518ee){_0x2a74f3['push'](_0x2a74f3['shift']());}};_0x50195d(++_0x284aa1);}(_0x8f81,0xe6));var _0x18f8=function(_0x306959,_0x534a4f){_0x306959=_0x306959-0x0;var _0x5db947=_0x8f81[_0x306959];return _0x5db947;};'use strict';var EventEmitter=require(_0x18f8('0x0'));var UserNotification=require(_0x18f8('0x1'))['db'][_0x18f8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x18f8('0x3')](0x0);var events={'afterCreate':_0x18f8('0x4'),'afterUpdate':_0x18f8('0x5'),'afterDestroy':_0x18f8('0x6')};function emitEvent(_0x39fded){return function(_0x324126,_0x599b0a,_0x58c35c){UserNotificationEvents[_0x18f8('0x7')](_0x39fded+':'+_0x324126['id'],_0x324126);UserNotificationEvents[_0x18f8('0x7')](_0x39fded,_0x324126);_0x58c35c(null);};}for(var e in events){if(events[_0x18f8('0x8')](e)){var event=events[e];UserNotification[_0x18f8('0x9')](e,emitEvent(event));}}module[_0x18f8('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1feaa6b..641c93b 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 _0x86ba=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports','userNotifications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86ba,0x1bd));var _0xa86b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x86ba[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa86b('0x0'));var util=require('util');var logger=require(_0xa86b('0x1'))(_0xa86b('0x2'));var moment=require(_0xa86b('0x3'));var BPromise=require(_0xa86b('0x4'));var rp=require(_0xa86b('0x5'));var fs=require('fs');var path=require(_0xa86b('0x6'));var rimraf=require('rimraf');var config=require(_0xa86b('0x7'));var attributes=require(_0xa86b('0x8'));module[_0xa86b('0x9')]=function(_0x8092d0,_0x8e5171){return _0x8092d0['define']('UserNotification',attributes,{'tableName':_0xa86b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa86b('0xb')});}; \ No newline at end of file +var _0x174e=['rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','lodash','api','bluebird','request-promise','path'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x174e,0x11b));var _0xe174=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x174e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe174('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe174('0x1'));var moment=require('moment');var BPromise=require(_0xe174('0x2'));var rp=require(_0xe174('0x3'));var fs=require('fs');var path=require(_0xe174('0x4'));var rimraf=require(_0xe174('0x5'));var config=require(_0xe174('0x6'));var attributes=require(_0xe174('0x7'));module['exports']=function(_0x11b268,_0x382315){return _0x11b268[_0xe174('0x8')](_0xe174('0x9'),attributes,{'tableName':_0xe174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe174('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 77bc46a..4dec37c 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 _0x90c7=['http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2af46d,_0x2e7acb){var _0x2251c7=function(_0x5056da){while(--_0x5056da){_0x2af46d['push'](_0x2af46d['shift']());}};_0x2251c7(++_0x2e7acb);}(_0x90c7,0x168));var _0x790c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x90c7[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require(_0x790c('0x0'));var moment=require(_0x790c('0x1'));var BPromise=require(_0x790c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x790c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x790c('0x4'))(_0x790c('0x5'));var config=require(_0x790c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x790c('0x7')][_0x790c('0x8')]({'port':0x232a});config[_0x790c('0x9')]=_[_0x790c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x790c('0xb'))(new Redis(config[_0x790c('0x9')]));require(_0x790c('0xc'))[_0x790c('0xd')](socket);function respondWithRpcPromise(_0x10100f,_0x5f2807,_0x663d2){return new BPromise(function(_0x448f97,_0x57d694){return client[_0x790c('0xe')](_0x10100f,_0x663d2)['then'](function(_0x5f0221){logger[_0x790c('0xf')]('UserNotification,\x20%s,\x20%s',_0x5f2807,_0x790c('0x10'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x5f2807,_0x790c('0x10'),JSON[_0x790c('0x11')](_0x5f0221));if(_0x5f0221[_0x790c('0x12')]){if(_0x5f0221[_0x790c('0x12')][_0x790c('0x13')]===0x1f4){logger[_0x790c('0x12')](_0x790c('0x14'),_0x5f2807,_0x5f0221[_0x790c('0x12')]['message']);return _0x57d694(_0x5f0221[_0x790c('0x12')]['message']);}logger[_0x790c('0x12')](_0x790c('0x14'),_0x5f2807,_0x5f0221[_0x790c('0x12')][_0x790c('0x15')]);return _0x448f97(_0x5f0221['error']['message']);}else{logger[_0x790c('0xf')](_0x790c('0x14'),_0x5f2807,_0x790c('0x10'));_0x448f97(_0x5f0221[_0x790c('0x16')][_0x790c('0x15')]);}})['catch'](function(_0x408857){logger['error']('UserNotification,\x20%s,\x20%s',_0x5f2807,_0x408857);_0x57d694(_0x408857);});});} \ No newline at end of file +var _0x91c6=['localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x534e19,_0x360b93){var _0x2ee953=function(_0x12c7a7){while(--_0x12c7a7){_0x534e19['push'](_0x534e19['shift']());}};_0x2ee953(++_0x360b93);}(_0x91c6,0x1eb));var _0x691c=function(_0xcf0f,_0xf9fe51){_0xcf0f=_0xcf0f-0x0;var _0xb0aafa=_0x91c6[_0xcf0f];return _0xb0aafa;};'use strict';var _=require(_0x691c('0x0'));var util=require('util');var moment=require(_0x691c('0x1'));var BPromise=require(_0x691c('0x2'));var rs=require(_0x691c('0x3'));var fs=require('fs');var Redis=require(_0x691c('0x4'));var db=require(_0x691c('0x5'))['db'];var utils=require(_0x691c('0x6'));var logger=require('../../config/logger')(_0x691c('0x7'));var config=require(_0x691c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x691c('0x9')][_0x691c('0xa')]({'port':0x232a});config[_0x691c('0xb')]=_[_0x691c('0xc')](config[_0x691c('0xb')],{'host':_0x691c('0xd'),'port':0x18eb});var socket=require(_0x691c('0xe'))(new Redis(config['redis']));require(_0x691c('0xf'))[_0x691c('0x10')](socket);function respondWithRpcPromise(_0x188dc7,_0x669543,_0x469fe5){return new BPromise(function(_0x42f731,_0x392f45){return client[_0x691c('0x11')](_0x188dc7,_0x469fe5)['then'](function(_0xcc8553){logger[_0x691c('0x12')](_0x691c('0x13'),_0x669543,_0x691c('0x14'));logger['debug'](_0x691c('0x15'),_0x669543,_0x691c('0x14'),JSON[_0x691c('0x16')](_0xcc8553));if(_0xcc8553[_0x691c('0x17')]){if(_0xcc8553['error'][_0x691c('0x18')]===0x1f4){logger['error'](_0x691c('0x13'),_0x669543,_0xcc8553[_0x691c('0x17')][_0x691c('0x19')]);return _0x392f45(_0xcc8553['error'][_0x691c('0x19')]);}logger[_0x691c('0x17')](_0x691c('0x13'),_0x669543,_0xcc8553[_0x691c('0x17')]['message']);return _0x42f731(_0xcc8553['error']['message']);}else{logger[_0x691c('0x12')](_0x691c('0x13'),_0x669543,_0x691c('0x14'));_0x42f731(_0xcc8553[_0x691c('0x1a')]['message']);}})[_0x691c('0x1b')](function(_0x1d81b7){logger[_0x691c('0x17')](_0x691c('0x13'),_0x669543,_0x1d81b7);_0x392f45(_0x1d81b7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5f5ba27..47e9200 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 _0x5aad=['removeListener','register','length','userNotification:','./userNotification.events','save','update'];(function(_0x2c183f,_0x1be236){var _0x54a114=function(_0x19e8d8){while(--_0x19e8d8){_0x2c183f['push'](_0x2c183f['shift']());}};_0x54a114(++_0x1be236);}(_0x5aad,0x1a8));var _0xd5aa=function(_0x14668d,_0x39ccff){_0x14668d=_0x14668d-0x0;var _0x1efea6=_0x5aad[_0x14668d];return _0x1efea6;};'use strict';var UserNotificationEvents=require(_0xd5aa('0x0'));var events=[_0xd5aa('0x1'),'remove',_0xd5aa('0x2')];function createListener(_0x2f8398,_0x4b6ac0){return function(_0x34eaee){_0x4b6ac0['emit'](_0x2f8398,_0x34eaee);};}function removeListener(_0xad2cc4,_0x19cd1c){return function(){UserNotificationEvents[_0xd5aa('0x3')](_0xad2cc4,_0x19cd1c);};}exports[_0xd5aa('0x4')]=function(_0x3b7897){for(var _0x1953e8=0x0,_0x2d2c57=events[_0xd5aa('0x5')];_0x1953e8<_0x2d2c57;_0x1953e8++){var _0x1adc03=events[_0x1953e8];var _0x5db07e=createListener(_0xd5aa('0x6')+_0x1adc03,_0x3b7897);UserNotificationEvents['on'](_0x1adc03,_0x5db07e);}}; \ No newline at end of file +var _0x5900=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x5900,0x13c));var _0x0590=function(_0x1106f4,_0x36cfdb){_0x1106f4=_0x1106f4-0x0;var _0x383deb=_0x5900[_0x1106f4];return _0x383deb;};'use strict';var UserNotificationEvents=require(_0x0590('0x0'));var events=[_0x0590('0x1'),_0x0590('0x2'),_0x0590('0x3')];function createListener(_0xe3255d,_0x1a0456){return function(_0x8262b5){_0x1a0456[_0x0590('0x4')](_0xe3255d,_0x8262b5);};}function removeListener(_0x57e9e7,_0x50c1a5){return function(){UserNotificationEvents[_0x0590('0x5')](_0x57e9e7,_0x50c1a5);};}exports[_0x0590('0x6')]=function(_0x1bdf96){for(var _0x9fad36=0x0,_0x286321=events[_0x0590('0x7')];_0x9fad36<_0x286321;_0x9fad36++){var _0x15d9ad=events[_0x9fad36];var _0x43a7a5=createListener(_0x0590('0x8')+_0x15d9ad,_0x1bdf96);UserNotificationEvents['on'](_0x15d9ad,_0x43a7a5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3e8cb8d..1e98d94 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4acb60,_0x4413b4){var _0x5c75e6=function(_0x4912a2){while(--_0x4912a2){_0x4acb60['push'](_0x4acb60['shift']());}};_0x5c75e6(++_0x4413b4);}(_0xe706,0xa3));var _0x6e70=function(_0x389213,_0x14a50d){_0x389213=_0x389213-0x0;var _0x4ad6ca=_0xe706[_0x389213];return _0x4ad6ca;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3c4506,_0x328b81){var _0x31f0ff=function(_0x37b1a4){while(--_0x37b1a4){_0x3c4506['push'](_0x3c4506['shift']());}};_0x31f0ff(++_0x328b81);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0xcb91[_0x119b3e];return _0x1169ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a4e78c2..d8472fe 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 _0x4226=['exports'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x4226,0x1dc));var _0x6422=function(_0x2332a9,_0x25c511){_0x2332a9=_0x2332a9-0x0;var _0x459e7e=_0x4226[_0x2332a9];return _0x459e7e;};'use strict';var Sequelize=require('sequelize');module[_0x6422('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x20c4=['sequelize','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x20c4,0x88));var _0x420c=function(_0x704be3,_0x229070){_0x704be3=_0x704be3-0x0;var _0x24940b=_0x20c4[_0x704be3];return _0x24940b;};'use strict';var Sequelize=require(_0x420c('0x0'));module[_0x420c('0x1')]={'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 d6fc7d1..02d53db 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 _0xb521=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ccad7,_0x2daf62){var _0x3a1bc0=function(_0x179659){while(--_0x179659){_0x4ccad7['push'](_0x4ccad7['shift']());}};_0x3a1bc0(++_0x2daf62);}(_0xb521,0xe6));var _0x1b52=function(_0x494729,_0x5e7943){_0x494729=_0x494729-0x0;var _0x5223bf=_0xb521[_0x494729];return _0x5223bf;};'use strict';var _=require(_0x1b52('0x0'));var util=require(_0x1b52('0x1'));var logger=require(_0x1b52('0x2'))(_0x1b52('0x3'));var moment=require(_0x1b52('0x4'));var BPromise=require(_0x1b52('0x5'));var rp=require(_0x1b52('0x6'));var fs=require('fs');var path=require(_0x1b52('0x7'));var rimraf=require(_0x1b52('0x8'));var config=require(_0x1b52('0x9'));var attributes=require(_0x1b52('0xa'));module[_0x1b52('0xb')]=function(_0x431807,_0x5cc693){return _0x431807[_0x1b52('0xc')](_0x1b52('0xd'),attributes,{'tableName':_0x1b52('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0a7=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x374c4a,_0x5afa32){var _0x103f4a=function(_0x5a70e1){while(--_0x5a70e1){_0x374c4a['push'](_0x374c4a['shift']());}};_0x103f4a(++_0x5afa32);}(_0xb0a7,0x19c));var _0x7b0a=function(_0x15450a,_0x476ef6){_0x15450a=_0x15450a-0x0;var _0x570a9d=_0xb0a7[_0x15450a];return _0x570a9d;};'use strict';var _=require(_0x7b0a('0x0'));var util=require(_0x7b0a('0x1'));var logger=require(_0x7b0a('0x2'))(_0x7b0a('0x3'));var moment=require(_0x7b0a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b0a('0x5'));var rimraf=require(_0x7b0a('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b0a('0x7'));module['exports']=function(_0x106fdf,_0x564093){return _0x106fdf['define'](_0x7b0a('0x8'),attributes,{'tableName':_0x7b0a('0x9'),'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 d3efd6d..ce5bcf1 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 _0x94d1=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x5a4bcb,_0x546a3e){var _0x5e8c97=function(_0x210f8e){while(--_0x210f8e){_0x5a4bcb['push'](_0x5a4bcb['shift']());}};_0x5e8c97(++_0x546a3e);}(_0x94d1,0x1a0));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var util=require(_0x194d('0x1'));var moment=require('moment');var BPromise=require(_0x194d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x194d('0x3'));var db=require(_0x194d('0x4'))['db'];var utils=require(_0x194d('0x5'));var logger=require(_0x194d('0x6'))(_0x194d('0x7'));var config=require(_0x194d('0x8'));var jayson=require(_0x194d('0x9'));var client=jayson[_0x194d('0xa')][_0x194d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f25d2,_0x26c2fc,_0x2c4b4f){return new BPromise(function(_0x4bcfb7,_0xc2cff2){return client[_0x194d('0xc')](_0x3f25d2,_0x2c4b4f)[_0x194d('0xd')](function(_0x1930ce){logger[_0x194d('0xe')](_0x194d('0xf'),_0x26c2fc,_0x194d('0x10'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x26c2fc,_0x194d('0x10'),JSON[_0x194d('0x11')](_0x1930ce));if(_0x1930ce['error']){if(_0x1930ce[_0x194d('0x12')][_0x194d('0x13')]===0x1f4){logger[_0x194d('0x12')](_0x194d('0xf'),_0x26c2fc,_0x1930ce[_0x194d('0x12')][_0x194d('0x14')]);return _0xc2cff2(_0x1930ce[_0x194d('0x12')][_0x194d('0x14')]);}logger[_0x194d('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x26c2fc,_0x1930ce[_0x194d('0x12')][_0x194d('0x14')]);return _0x4bcfb7(_0x1930ce[_0x194d('0x12')][_0x194d('0x14')]);}else{logger[_0x194d('0xe')](_0x194d('0xf'),_0x26c2fc,_0x194d('0x10'));_0x4bcfb7(_0x1930ce[_0x194d('0x15')]['message']);}})['catch'](function(_0xdc4ae6){logger[_0x194d('0x12')](_0x194d('0xf'),_0x26c2fc,_0xdc4ae6);_0xc2cff2(_0xdc4ae6);});});} \ No newline at end of file +var _0x2c8e=['stringify','error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2ca047,_0x9f2225){var _0xa544a9=function(_0x32bb91){while(--_0x32bb91){_0x2ca047['push'](_0x2ca047['shift']());}};_0xa544a9(++_0x9f2225);}(_0x2c8e,0xd8));var _0xe2c8=function(_0x52617c,_0x27230f){_0x52617c=_0x52617c-0x0;var _0x1c0fe3=_0x2c8e[_0x52617c];return _0x1c0fe3;};'use strict';var _=require(_0xe2c8('0x0'));var util=require('util');var moment=require(_0xe2c8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe2c8('0x2'));var fs=require('fs');var Redis=require(_0xe2c8('0x3'));var db=require(_0xe2c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2c8('0x5'))(_0xe2c8('0x6'));var config=require(_0xe2c8('0x7'));var jayson=require(_0xe2c8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc50c22,_0x55baf9,_0x2c11e9){return new BPromise(function(_0x4704e6,_0x40060b){return client[_0xe2c8('0x9')](_0xc50c22,_0x2c11e9)[_0xe2c8('0xa')](function(_0x482eb0){logger[_0xe2c8('0xb')](_0xe2c8('0xc'),_0x55baf9,'request\x20sent');logger[_0xe2c8('0xd')](_0xe2c8('0xe'),_0x55baf9,'request\x20sent',JSON[_0xe2c8('0xf')](_0x482eb0));if(_0x482eb0[_0xe2c8('0x10')]){if(_0x482eb0[_0xe2c8('0x10')][_0xe2c8('0x11')]===0x1f4){logger[_0xe2c8('0x10')](_0xe2c8('0xc'),_0x55baf9,_0x482eb0[_0xe2c8('0x10')]['message']);return _0x40060b(_0x482eb0[_0xe2c8('0x10')][_0xe2c8('0x12')]);}logger['error'](_0xe2c8('0xc'),_0x55baf9,_0x482eb0[_0xe2c8('0x10')][_0xe2c8('0x12')]);return _0x4704e6(_0x482eb0[_0xe2c8('0x10')][_0xe2c8('0x12')]);}else{logger[_0xe2c8('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x55baf9,_0xe2c8('0x13'));_0x4704e6(_0x482eb0['result'][_0xe2c8('0x12')]);}})[_0xe2c8('0x14')](function(_0x57c406){logger[_0xe2c8('0x10')](_0xe2c8('0xc'),_0x55baf9,_0x57c406);_0x40060b(_0x57c406);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f689d3c..8412c32 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 _0xafb9=['removeResources','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xafb9,0x7d));var _0x9afb=function(_0xe17b06,_0x51cb33){_0xe17b06=_0xe17b06-0x0;var _0x38374f=_0xafb9[_0xe17b06];return _0x38374f;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require('express');var router=express[_0x9afb('0x4')]();var fs_extra=require(_0x9afb('0x5'));var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));var controller=require(_0x9afb('0x9'));router[_0x9afb('0xa')]('/',auth[_0x9afb('0xb')](),controller[_0x9afb('0xc')]);router[_0x9afb('0xa')](_0x9afb('0xd'),auth[_0x9afb('0xb')](),controller['describe']);router['get'](_0x9afb('0xe'),auth['isAuthenticated'](),controller[_0x9afb('0xf')]);router['get'](_0x9afb('0x10'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x11')]);router[_0x9afb('0xa')](_0x9afb('0x12'),auth['isAuthenticated'](),controller[_0x9afb('0x13')]);router[_0x9afb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9afb('0x14')](_0x9afb('0x15'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x16')]);router[_0x9afb('0x14')](_0x9afb('0x10'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x17')]);router['post'](_0x9afb('0x12'),auth['isAuthenticated'](),controller[_0x9afb('0x18')]);router[_0x9afb('0x19')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x1a')]);router[_0x9afb('0x1b')](_0x9afb('0xe'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x1c')]);router[_0x9afb('0x1b')](_0x9afb('0x10'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x1d')]);router[_0x9afb('0x1b')](_0x9afb('0x12'),auth[_0x9afb('0xb')](),controller[_0x9afb('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xc227=['get','isAuthenticated','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','clone','addSections','addResources','put','/:id','update','delete','removeSections','removeResources','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3b1591,_0x4d24bb){var _0x283100=function(_0x58c22d){while(--_0x58c22d){_0x3b1591['push'](_0x3b1591['shift']());}};_0x283100(++_0x4d24bb);}(_0xc227,0xbb));var _0x7c22=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc227[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7c22('0x0'));var util=require(_0x7c22('0x1'));var path=require(_0x7c22('0x2'));var timeout=require(_0x7c22('0x3'));var express=require('express');var router=express[_0x7c22('0x4')]();var fs_extra=require(_0x7c22('0x5'));var auth=require(_0x7c22('0x6'));var interaction=require(_0x7c22('0x7'));var config=require(_0x7c22('0x8'));var controller=require('./userProfile.controller');router[_0x7c22('0x9')]('/',auth[_0x7c22('0xa')](),controller['index']);router[_0x7c22('0x9')](_0x7c22('0xb'),auth[_0x7c22('0xa')](),controller[_0x7c22('0xc')]);router[_0x7c22('0x9')]('/:id',auth[_0x7c22('0xa')](),controller[_0x7c22('0xd')]);router[_0x7c22('0x9')](_0x7c22('0xe'),auth[_0x7c22('0xa')](),controller[_0x7c22('0xf')]);router[_0x7c22('0x9')](_0x7c22('0x10'),auth[_0x7c22('0xa')](),controller[_0x7c22('0x11')]);router[_0x7c22('0x12')]('/',auth[_0x7c22('0xa')](),controller['create']);router[_0x7c22('0x12')]('/:id/clone',auth[_0x7c22('0xa')](),controller[_0x7c22('0x13')]);router[_0x7c22('0x12')](_0x7c22('0xe'),auth['isAuthenticated'](),controller[_0x7c22('0x14')]);router[_0x7c22('0x12')](_0x7c22('0x10'),auth[_0x7c22('0xa')](),controller[_0x7c22('0x15')]);router[_0x7c22('0x16')](_0x7c22('0x17'),auth[_0x7c22('0xa')](),controller[_0x7c22('0x18')]);router['delete'](_0x7c22('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0x7c22('0x19')](_0x7c22('0xe'),auth['isAuthenticated'](),controller[_0x7c22('0x1a')]);router[_0x7c22('0x19')](_0x7c22('0x10'),auth[_0x7c22('0xa')](),controller[_0x7c22('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5f6606e..caa11c9 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 _0x8a2c=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x122ee6,_0x28f035){var _0x130259=function(_0x5c88bd){while(--_0x5c88bd){_0x122ee6['push'](_0x122ee6['shift']());}};_0x130259(++_0x28f035);}(_0x8a2c,0x107));var _0xc8a2=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x8a2c[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0xc8a2('0x0'));module[_0xc8a2('0x1')]={'name':{'type':Sequelize[_0xc8a2('0x2')],'allowNull':![],'unique':_0xc8a2('0x3')},'crudPermissions':{'type':Sequelize[_0xc8a2('0x2')],'set':function(_0x1be94a){this[_0xc8a2('0x4')](_0xc8a2('0x5'),_0x1be94a?_0x1be94a[_0xc8a2('0x6')](''):[]);},'get':function(){return this[_0xc8a2('0x7')]('crudPermissions')?this[_0xc8a2('0x7')](_0xc8a2('0x5'))[_0xc8a2('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc8a2('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc8a2('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc8a2('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc8a2('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc8a2('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1f18=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x5b7837,_0x184675){var _0x1eb21a=function(_0x4b5423){while(--_0x4b5423){_0x5b7837['push'](_0x5b7837['shift']());}};_0x1eb21a(++_0x184675);}(_0x1f18,0x1a5));var _0x81f1=function(_0x46798b,_0x172c63){_0x46798b=_0x46798b-0x0;var _0x69f326=_0x1f18[_0x46798b];return _0x69f326;};'use strict';var Sequelize=require(_0x81f1('0x0'));module[_0x81f1('0x1')]={'name':{'type':Sequelize[_0x81f1('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x8f58a6){this['setDataValue'](_0x81f1('0x3'),_0x8f58a6?_0x8f58a6[_0x81f1('0x4')](''):[]);},'get':function(){return this[_0x81f1('0x5')]('crudPermissions')?this[_0x81f1('0x5')](_0x81f1('0x3'))[_0x81f1('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x81f1('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x81f1('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x81f1('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x81f1('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x81f1('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x81f1('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3878ad1..abf6ba8 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 _0x731b=['UserProfileSection','sectionId','each','push','ids','getSections','includes','isEmpty','subsections','enabled','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','offset','undefined','limit','count','save','update','then','destroy','error','name','send','index','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','clone','get','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','create','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections'];(function(_0x5ad4f0,_0x10ef60){var _0x149f1d=function(_0x5ea995){while(--_0x5ea995){_0x5ad4f0['push'](_0x5ad4f0['shift']());}};_0x149f1d(++_0x10ef60);}(_0x731b,0xf7));var _0xb731=function(_0x3d62c7,_0xe62610){_0x3d62c7=_0x3d62c7-0x0;var _0x5464ff=_0x731b[_0x3d62c7];return _0x5464ff;};'use strict';var emlformat=require(_0xb731('0x0'));var rimraf=require(_0xb731('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb731('0x2'));var rp=require(_0xb731('0x3'));var moment=require(_0xb731('0x4'));var BPromise=require(_0xb731('0x5'));var Mustache=require(_0xb731('0x6'));var util=require(_0xb731('0x7'));var path=require('path');var sox=require(_0xb731('0x8'));var csv=require(_0xb731('0x9'));var ejs=require(_0xb731('0xa'));var fs=require('fs');var fs_extra=require(_0xb731('0xb'));var _=require(_0xb731('0xc'));var squel=require(_0xb731('0xd'));var crypto=require(_0xb731('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb731('0xf'));var toCsv=require(_0xb731('0x9'));var querystring=require(_0xb731('0x10'));var Papa=require(_0xb731('0x11'));var Redis=require(_0xb731('0x12'));var authService=require(_0xb731('0x13'));var qs=require(_0xb731('0x14'));var as=require(_0xb731('0x15'));var hardwareService=require(_0xb731('0x16'));var logger=require(_0xb731('0x17'))(_0xb731('0x18'));var utils=require(_0xb731('0x19'));var config=require(_0xb731('0x1a'));var licenseUtil=require(_0xb731('0x1b'));var db=require(_0xb731('0x1c'))['db'];config['redis']=_[_0xb731('0x1d')](config['redis'],{'host':_0xb731('0x1e'),'port':0x18eb});var socket=require(_0xb731('0x1f'))(new Redis(config[_0xb731('0x20')]));require('./userProfile.socket')[_0xb731('0x21')](socket);function respondWithStatusCode(_0x4b433a,_0x524c0d){_0x524c0d=_0x524c0d||0xcc;return function(_0x579641){if(_0x579641){return _0x4b433a[_0xb731('0x22')](_0x524c0d);}return _0x4b433a[_0xb731('0x23')](_0x524c0d)['end']();};}function respondWithResult(_0x47829e,_0x15c596){_0x15c596=_0x15c596||0xc8;return function(_0x5e4ca6){if(_0x5e4ca6){return _0x47829e[_0xb731('0x23')](_0x15c596)[_0xb731('0x24')](_0x5e4ca6);}};}function respondWithFilteredResult(_0x35baac,_0x299073){return function(_0x4e0c6d){if(_0x4e0c6d){var _0x162a9b=typeof _0x299073[_0xb731('0x25')]===_0xb731('0x26')&&typeof _0x299073[_0xb731('0x27')]==='undefined';var _0x1f9de6=_0x4e0c6d['count'];var _0x4b4cb4=_0x162a9b?0x0:_0x299073[_0xb731('0x25')];var _0x537556=_0x162a9b?_0x4e0c6d[_0xb731('0x28')]:_0x299073[_0xb731('0x25')]+_0x299073[_0xb731('0x27')];var _0x36374e;if(_0x537556>=_0x1f9de6){_0x537556=_0x1f9de6;_0x36374e=0xc8;}else{_0x36374e=0xce;}_0x35baac[_0xb731('0x23')](_0x36374e);return _0x35baac['set']('Content-Range',_0x4b4cb4+'-'+_0x537556+'/'+_0x1f9de6)[_0xb731('0x24')](_0x4e0c6d);}return null;};}function patchUpdates(_0x3e4623){return function(_0x4f7424){try{jsonpatch['apply'](_0x4f7424,_0x3e4623,!![]);}catch(_0x12a0df){return BPromise['reject'](_0x12a0df);}return _0x4f7424[_0xb731('0x29')]();};}function saveUpdates(_0x15be09,_0x573432){return function(_0x396790){if(_0x396790){return _0x396790[_0xb731('0x2a')](_0x15be09)[_0xb731('0x2b')](function(_0x29944a){return _0x29944a;});}return null;};}function removeEntity(_0x5d30e1,_0x9fabd8){return function(_0x14904e){if(_0x14904e){return _0x14904e[_0xb731('0x2c')]()[_0xb731('0x2b')](function(){_0x5d30e1[_0xb731('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x582989,_0x21ccd0){return function(_0x3519c8){if(!_0x3519c8){_0x582989['sendStatus'](0x194);}return _0x3519c8;};}function handleError(_0x5b6df7,_0x26abc9){_0x26abc9=_0x26abc9||0x1f4;return function(_0x5e4a21){logger[_0xb731('0x2d')](_0x5e4a21['stack']);if(_0x5e4a21[_0xb731('0x2e')]){delete _0x5e4a21[_0xb731('0x2e')];}_0x5b6df7[_0xb731('0x23')](_0x26abc9)[_0xb731('0x2f')](_0x5e4a21);};}exports[_0xb731('0x30')]=function(_0x485e86,_0x53ba29){var _0x5edd1f={},_0x4c0a33={},_0x257dd2={'count':0x0,'rows':[]};var _0x325a04=_['map'](db[_0xb731('0x31')]['rawAttributes'],function(_0x1423ff){return{'name':_0x1423ff[_0xb731('0x32')],'type':_0x1423ff['type'][_0xb731('0x33')]};});_0x4c0a33[_0xb731('0x34')]=_['map'](_0x325a04,_0xb731('0x2e'));_0x4c0a33[_0xb731('0x35')]=_[_0xb731('0x36')](_0x485e86[_0xb731('0x35')]);_0x4c0a33[_0xb731('0x37')]=_[_0xb731('0x38')](_0x4c0a33[_0xb731('0x34')],_0x4c0a33['query']);_0x5edd1f[_0xb731('0x39')]=_[_0xb731('0x38')](_0x4c0a33[_0xb731('0x34')],qs[_0xb731('0x3a')](_0x485e86[_0xb731('0x35')][_0xb731('0x3a')]));_0x5edd1f[_0xb731('0x39')]=_0x5edd1f[_0xb731('0x39')][_0xb731('0x3b')]?_0x5edd1f[_0xb731('0x39')]:_0x4c0a33[_0xb731('0x34')];if(!_0x485e86[_0xb731('0x35')][_0xb731('0x3c')](_0xb731('0x3d'))){_0x5edd1f[_0xb731('0x27')]=qs[_0xb731('0x27')](_0x485e86[_0xb731('0x35')][_0xb731('0x27')]);_0x5edd1f['offset']=qs[_0xb731('0x25')](_0x485e86['query'][_0xb731('0x25')]);}_0x5edd1f[_0xb731('0x3e')]=qs[_0xb731('0x3f')](_0x485e86['query']['sort']);_0x5edd1f[_0xb731('0x40')]=qs[_0xb731('0x37')](_[_0xb731('0x41')](_0x485e86['query'],_0x4c0a33['filters']),_0x325a04);if(_0x485e86['query'][_0xb731('0x42')]){_0x5edd1f[_0xb731('0x40')]=_[_0xb731('0x43')](_0x5edd1f[_0xb731('0x40')],{'$or':_[_0xb731('0x44')](_0x325a04,function(_0x186c72){if(_0x186c72[_0xb731('0x45')]!==_0xb731('0x46')){var _0x350a4d={};_0x350a4d[_0x186c72[_0xb731('0x2e')]]={'$like':'%'+_0x485e86[_0xb731('0x35')][_0xb731('0x42')]+'%'};return _0x350a4d;}})});}_0x5edd1f=_[_0xb731('0x43')]({},_0x5edd1f,_0x485e86[_0xb731('0x47')]);var _0x381496={'where':_0x5edd1f[_0xb731('0x40')]};return db[_0xb731('0x31')][_0xb731('0x28')](_0x381496)[_0xb731('0x2b')](function(_0x373f07){_0x257dd2[_0xb731('0x28')]=_0x373f07;if(_0x485e86[_0xb731('0x35')][_0xb731('0x48')]){_0x5edd1f['include']=[{'all':!![]}];}return db[_0xb731('0x31')][_0xb731('0x49')](_0x5edd1f);})[_0xb731('0x2b')](function(_0x2078d1){_0x257dd2['rows']=_0x2078d1;return _0x257dd2;})['then'](respondWithFilteredResult(_0x53ba29,_0x5edd1f))[_0xb731('0x4a')](handleError(_0x53ba29,null));};exports[_0xb731('0x4b')]=function(_0x2d03de,_0x829f78){var _0x132a97={'raw':![],'where':{'id':_0x2d03de[_0xb731('0x4c')]['id']}},_0x46a1e1={};_0x46a1e1['model']=_[_0xb731('0x36')](db[_0xb731('0x31')][_0xb731('0x4d')]);_0x46a1e1['query']=_[_0xb731('0x36')](_0x2d03de[_0xb731('0x35')]);_0x46a1e1[_0xb731('0x37')]=_[_0xb731('0x38')](_0x46a1e1[_0xb731('0x34')],_0x46a1e1[_0xb731('0x35')]);_0x132a97[_0xb731('0x39')]=_[_0xb731('0x38')](_0x46a1e1[_0xb731('0x34')],qs['fields'](_0x2d03de['query'][_0xb731('0x3a')]));_0x132a97[_0xb731('0x39')]=_0x132a97[_0xb731('0x39')][_0xb731('0x3b')]?_0x132a97[_0xb731('0x39')]:_0x46a1e1[_0xb731('0x34')];if(_0x2d03de[_0xb731('0x35')][_0xb731('0x48')]){_0x132a97['include']=[{'all':!![]}];}_0x132a97=_['merge']({},_0x132a97,_0x2d03de[_0xb731('0x47')]);return db[_0xb731('0x31')][_0xb731('0x4e')](_0x132a97)[_0xb731('0x2b')](handleEntityNotFound(_0x829f78,null))['then'](respondWithResult(_0x829f78,null))[_0xb731('0x4a')](handleError(_0x829f78,null));};exports['create']=function(_0x301d34,_0x37ab96){return db['UserProfile']['create'](_0x301d34[_0xb731('0x4f')],{})['then'](respondWithResult(_0x37ab96,0xc9))[_0xb731('0x4a')](handleError(_0x37ab96,null));};exports[_0xb731('0x50')]=function(_0xb699d,_0x4db993){var _0x261e2d={'where':{'id':_0xb699d[_0xb731('0x4c')]['id']}},_0x166419={};_0x166419[_0xb731('0x34')]=_[_0xb731('0x36')](db['UserProfile'][_0xb731('0x4d')]);_0x261e2d['attributes']=_['intersection'](_0x166419[_0xb731('0x34')],qs[_0xb731('0x3a')](_0xb699d[_0xb731('0x35')][_0xb731('0x3a')]));_0x261e2d[_0xb731('0x39')]=_0x261e2d[_0xb731('0x39')][_0xb731('0x3b')]?_0x261e2d['attributes']:_0x166419[_0xb731('0x34')];if(_0xb699d[_0xb731('0x35')][_0xb731('0x48')]){_0x261e2d['include']=[{'all':!![]}];}_0x261e2d=_['merge']({},_0x261e2d,_0xb699d[_0xb731('0x47')]);return db['UserProfile'][_0xb731('0x4e')](_0x261e2d)[_0xb731('0x2b')](handleEntityNotFound(_0x4db993,null))[_0xb731('0x2b')](function(_0x1b82c1){if(_0x1b82c1){var _0x58a4cc=_0x1b82c1[_0xb731('0x51')]({'plain':!![]});_0x58a4cc=qs['omit'](_0x58a4cc,['id','createdAt',_0xb731('0x52'),_0xb731('0x53')]);_0xb699d[_0xb731('0x4f')]=_[_0xb731('0x54')](_0xb699d[_0xb731('0x4f')],['id',_0xb731('0x55'),'updatedAt']);return db[_0xb731('0x56')][_0xb731('0x57')](function(_0x3c9ad2){return db[_0xb731('0x31')][_0xb731('0x58')](_['merge'](_0x58a4cc,_0xb699d['body']),{'include':_0xb699d[_0xb731('0x35')][_0xb731('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x3c9ad2})[_0xb731('0x2b')](function(_0x84a0c3){var _0x14daea=_0x84a0c3[_0xb731('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xb731('0x49')]({'where':{'userProfileId':_0xb699d[_0xb731('0x4c')]['id']},'raw':!![]})[_0xb731('0x2b')](function(_0x5a4eab){if(_0x5a4eab){return BPromise['each'](_0x5a4eab,function(_0x14085e){return new BPromise(function(_0xbf2334,_0xfec28d){if(_0x14085e[_0xb731('0x59')]===null||_0x14085e[_0xb731('0x59')]===0x1)_0xbf2334(null);return db[_0xb731('0x5a')]['findAll']({'where':{'sectionId':_0x14085e['id']},'raw':!![]})[_0xb731('0x2b')](function(_0x34e80d){var _0x39f272=_[_0xb731('0x44')](_0x34e80d,function(_0x260983){return qs[_0xb731('0x54')](_0x260983,['id',_0xb731('0x55'),'updatedAt','sectionId']);});_0xbf2334(_0x39f272);})['catch'](function(_0x26ce8e){_0xfec28d(_0x26ce8e);});})[_0xb731('0x2b')](function(_0x50f9ea){var _0x386fda=qs[_0xb731('0x54')](_0x14085e,['id','createdAt',_0xb731('0x52')]);_0x386fda[_0xb731('0x5b')]=_0x14daea['id'];if(_0x50f9ea)_0x386fda['Resources']=_0x50f9ea;return _0x386fda;})[_0xb731('0x2b')](function(_0x142ccb){return db['UserProfileSection'][_0xb731('0x58')](_0x142ccb,{'include':[{'model':db[_0xb731('0x5a')],'as':_0xb731('0x5c')}],'raw':!![],'transaction':_0x3c9ad2});});})['then'](function(){return _0x14daea;});}});});});}})[_0xb731('0x2b')](respondWithResult(_0x4db993,0xc9))[_0xb731('0x4a')](handleError(_0x4db993,null));};exports[_0xb731('0x2a')]=function(_0x2a05e9,_0x1536ed){if(_0x2a05e9['body']['id']){delete _0x2a05e9[_0xb731('0x4f')]['id'];}return db[_0xb731('0x31')][_0xb731('0x4e')]({'where':{'id':_0x2a05e9[_0xb731('0x4c')]['id']}})[_0xb731('0x2b')](handleEntityNotFound(_0x1536ed,null))[_0xb731('0x2b')](saveUpdates(_0x2a05e9[_0xb731('0x4f')],null))[_0xb731('0x2b')](respondWithResult(_0x1536ed,null))[_0xb731('0x4a')](handleError(_0x1536ed,null));};exports['destroy']=function(_0xd091f9,_0x417fc2){return db[_0xb731('0x31')]['find']({'where':{'id':_0xd091f9['params']['id']}})[_0xb731('0x2b')](handleEntityNotFound(_0x417fc2,null))['then'](removeEntity(_0x417fc2,null))[_0xb731('0x4a')](handleError(_0x417fc2,null));};exports[_0xb731('0x5d')]=function(_0x197ab3,_0x4354e3){return db[_0xb731('0x31')]['describe']()[_0xb731('0x2b')](respondWithResult(_0x4354e3,null))[_0xb731('0x4a')](handleError(_0x4354e3,null));};exports[_0xb731('0x5e')]=function(_0x29f095,_0x56af26){var _0x556a1e=_0x29f095[_0xb731('0x4f')];return db[_0xb731('0x31')][_0xb731('0x4e')]({'where':{'id':_0x29f095['params']['id']}})[_0xb731('0x2b')](handleEntityNotFound(_0x56af26,null))[_0xb731('0x2b')](function(_0x44ffa6){if(_0x44ffa6){return db[_0xb731('0x56')][_0xb731('0x57')](function(_0x583cc6){return db[_0xb731('0x5f')][_0xb731('0x2c')]({'where':{'userProfileId':_0x29f095[_0xb731('0x4c')]['id'],'sectionId':_[_0xb731('0x44')](_0x556a1e,function(_0x171ffd){return _0x171ffd[_0xb731('0x60')];})},'transaction':_0x583cc6})[_0xb731('0x2b')](function(){var _0x465b60=_[_0xb731('0x44')](_0x556a1e,function(_0x77e202){_0x77e202[_0xb731('0x5b')]=_0x29f095[_0xb731('0x4c')]['id'];return _0x77e202;});var _0x57a47a=[];return BPromise[_0xb731('0x61')](_0x465b60,function(_0xa8c787){return db['UserProfileSection'][_0xb731('0x58')](_0xa8c787,{'include':[{'model':db[_0xb731('0x5a')],'as':_0xb731('0x5c')}],'raw':!![],'transaction':_0x583cc6})['then'](function(_0x92f2a0){_0x57a47a[_0xb731('0x62')](_0x92f2a0[_0xb731('0x51')]({'plain':!![]}));});})['then'](function(){return _0x57a47a;});});});}})['then'](function(_0x13d9f3){return _0x13d9f3;})['then'](respondWithResult(_0x56af26,null))[_0xb731('0x4a')](handleError(_0x56af26,null));};exports['removeSections']=function(_0x5ad44c,_0x5bdf28){var _0x185cf0;return db[_0xb731('0x31')][_0xb731('0x4e')]({'where':{'id':_0x5ad44c[_0xb731('0x4c')]['id']},'attributes':['id',_0xb731('0x2e')]})['then'](handleEntityNotFound(_0x5bdf28,null))[_0xb731('0x2b')](function(_0xec8e02){if(_0xec8e02){_0x185cf0=_0xec8e02;return db['UserProfileSection'][_0xb731('0x2c')]({'where':{'userProfileId':_0x5ad44c[_0xb731('0x4c')]['id'],'sectionId':_0x5ad44c['query'][_0xb731('0x63')]}});}})[_0xb731('0x2b')](function(){return _0x185cf0;})[_0xb731('0x2b')](respondWithStatusCode(_0x5bdf28,null))[_0xb731('0x4a')](handleError(_0x5bdf28,null));};exports[_0xb731('0x64')]=function(_0x42ec02,_0x29545c){var _0x4263de=[];var _0xeebf6=[];return db[_0xb731('0x5f')][_0xb731('0x49')]({'where':{'userProfileId':_0x42ec02['params']['id']},'raw':!![]})[_0xb731('0x2b')](function(_0x3c47e1){_0x4263de=_[_0xb731('0x42')](_0x3c47e1,function(_0x14b07b){return _0x14b07b['enabled']===0x1||_[_0xb731('0x65')]([0x3eb,0x709],_0x14b07b[_0xb731('0x60')]);});if(!_[_0xb731('0x66')](_0x4263de)){return _[_0xb731('0x44')](_0x4263de,function(_0x4aed22){return _0x4aed22[_0xb731('0x60')];});}else{return;}})['then'](function(_0x59d39c){if(_0x59d39c)_0xeebf6=_0x59d39c;if(_[_0xb731('0x65')](_0xeebf6,0x64)){var _0x928b61=_['find'](_0x4263de,{'sectionId':0x64});return hasDefaultDashboard(_0x928b61)[_0xb731('0x2b')](function(_0x199cd7){return _[_0xb731('0x44')](_0x4263de,function(_0x52ed0a){if(_0x52ed0a[_0xb731('0x60')]===0x64){_0x52ed0a[_0xb731('0x67')]=_0x199cd7;}return _0x52ed0a;});});}else{return;}})[_0xb731('0x2b')](function(_0x27101d){if(_0x27101d)_0x4263de=_0x27101d;if(_['includes'](_0xeebf6,0x3eb)){var _0x3fb3ec=_['find'](_0x4263de,{'sectionId':0x3eb});return getCustomDashboards(_0x3fb3ec)[_0xb731('0x2b')](function(_0x1aafc9){return _[_0xb731('0x44')](_0x4263de,function(_0x45c126){if(_0x3fb3ec[_0xb731('0x68')]){if(_0x45c126[_0xb731('0x60')]===0x3eb){_0x45c126['subsections']=_0x1aafc9;}}else{if(_0x45c126[_0xb731('0x60')]===0x64){_0x45c126[_0xb731('0x67')]=_0x1aafc9;}}return _0x45c126;});});}else{return;}})['then'](function(_0x188e5e){if(_0x188e5e)_0x4263de=_0x188e5e;if(_[_0xb731('0x65')](_0xeebf6,0x709)){var _0x30c379=_[_0xb731('0x4e')](_0x4263de,{'sectionId':0x709});return getPlugins(_0x30c379)['then'](function(_0x2f219f){if(_0x30c379[_0xb731('0x68')]){return _[_0xb731('0x44')](_0x4263de,function(_0x5f360d){if(_0x5f360d[_0xb731('0x60')]===0x709){_0x5f360d['subsections']=_0x2f219f;}return _0x5f360d;});}else{var _0x30a29d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2f219f};var _0x3e4dee=_[_0xb731('0x44')](_0x4263de);_0x3e4dee[_0xb731('0x62')](_0x30a29d);return _0x3e4dee;}});}else{return;}})['then'](function(_0x50a6ea){if(_0x50a6ea)_0x4263de=_0x50a6ea;return _[_0xb731('0x42')](_0x4263de,['enabled',0x1]);})[_0xb731('0x2b')](respondWithResult(_0x29545c,null))[_0xb731('0x4a')](handleError(_0x29545c,null));};function hasDefaultDashboard(_0x49303a){var _0x20f3af=[0x65];return new BPromise(function(_0x4b12d1,_0x38f4fd){try{if(_0x49303a[_0xb731('0x59')]){_0x4b12d1(_0x20f3af);}else{return db[_0xb731('0x5a')]['findOne']({'where':{'sectionId':_0x49303a['id']},'raw':!![]})['then'](function(_0x1b45ed){_0x1b45ed?_0x4b12d1(_0x20f3af):_0x4b12d1();});}}catch(_0x38dfdf){_0x38f4fd(_0x38dfdf);}});}function getCustomDashboards(_0x423ab0){var _0x3501cf=[];return new BPromise(function(_0x3af421,_0x190c75){try{if(_0x423ab0['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0xb731('0x2b')](function(_0x3d83a0){_0x3d83a0[_0xb731('0x69')](function(_0x32ea63){_0x3501cf[_0xb731('0x62')](_0x32ea63['id']+0x1869f);});_0x3af421(_0x3501cf);});}else{return db['UserProfileResource'][_0xb731('0x49')]({'where':{'sectionId':_0x423ab0['id']},'raw':!![]})[_0xb731('0x2b')](function(_0x50e196){_0x50e196[_0xb731('0x69')](function(_0x33c1dc){_0x3501cf['push'](_0x33c1dc[_0xb731('0x6a')]+0x1869f);});_0x3af421(_0x3501cf);});}}catch(_0x1cbcc4){_0x190c75(_0x1cbcc4);}});}function getPlugins(_0x5b9065){var _0x5d9830=[];return new BPromise(function(_0xf64460,_0xf2be71){try{if(_0x5b9065['autoAssociation']){return db[_0xb731('0x6b')]['findAll']({'raw':!![]})['then'](function(_0xd8ff93){_0xd8ff93[_0xb731('0x69')](function(_0x4a5312){_0x5d9830[_0xb731('0x62')](_0x4a5312['id']+0x15b38);});_0xf64460(_0x5d9830);});}else{return db[_0xb731('0x5a')][_0xb731('0x49')]({'where':{'sectionId':_0x5b9065['id']},'raw':!![]})[_0xb731('0x2b')](function(_0x2f1656){_0x2f1656['forEach'](function(_0xe46489){_0x5d9830['push'](_0xe46489[_0xb731('0x6a')]+0x15b38);});_0xf64460(_0x5d9830);});}}catch(_0x3ffe9c){_0xf2be71(_0x3ffe9c);}});}exports[_0xb731('0x6c')]=function(_0x3b3116,_0x3931f3){return db['UserProfile'][_0xb731('0x4e')]({'where':{'id':_0x3b3116[_0xb731('0x4c')]['id']}})[_0xb731('0x2b')](handleEntityNotFound(_0x3931f3,null))[_0xb731('0x2b')](function(_0x316076){if(_0x316076){return db[_0xb731('0x56')][_0xb731('0x57')](function(_0x4b38fc){return db[_0xb731('0x5f')][_0xb731('0x49')]({'where':{'userProfileId':_0x3b3116['params']['id']},'attributes':['id'],'raw':!![]})[_0xb731('0x2b')](function(_0x5755fb){if(_0x5755fb){return db[_0xb731('0x5f')][_0xb731('0x2c')]({'where':{'userProfileId':_0x3b3116[_0xb731('0x4c')]['id'],'id':_[_0xb731('0x44')](_0x5755fb,function(_0x3c5db9){return _0x3c5db9['id'];})},'transaction':_0x4b38fc});}})['then'](function(_0x46b95c){var _0x51b275=_[_0xb731('0x44')](_0x3b3116['body'],function(_0x5715ad){_0x5715ad['userProfileId']=_0x3b3116['params']['id'];return _0x5715ad;});return db['UserProfileSection']['bulkCreate'](_0x51b275,{'raw':!![],'transaction':_0x4b38fc});})[_0xb731('0x2b')](function(_0x1b50c9){var _0x395781=_[_0xb731('0x42')](_[_0xb731('0x44')](_0x1b50c9,function(_0x2b5c21){return _0x2b5c21[_0xb731('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x395781){return db[_0xb731('0x5f')][_0xb731('0x49')]({'where':{'userProfileId':_0x3b3116[_0xb731('0x4c')]['id'],'sectionId':_['map'](_0x395781,function(_0x1887da){return _0x1887da['sectionId'];})},'attributes':['id',_0xb731('0x60')],'raw':!![]})['then'](function(_0x2fa625){var _0x314e4d=_[_0xb731('0x44')](_0x3b3116['body'],function(_0x9eaff5){_0x9eaff5[_0xb731('0x5b')]=_0x3b3116['params']['id'];return _0x9eaff5;});return db[_0xb731('0x5a')][_0xb731('0x6d')](_0x314e4d,{'raw':!![],'transaction':_0x4b38fc});});}})[_0xb731('0x4a')](handleError(_0x3931f3,null));});}})[_0xb731('0x2b')](function(_0x56d68b){var _0x57fd99=_[_0xb731('0x44')](_0x56d68b,function(_0x3d806a){return _0x3d806a['get']({'plain':!![]});});})[_0xb731('0x2b')](respondWithResult(_0x3931f3,null))[_0xb731('0x4a')](handleError(_0x3931f3,null));};exports[_0xb731('0x6e')]=function(_0x1c0efe,_0x21735a,_0x43dcb4){return db[_0xb731('0x31')][_0xb731('0x4e')]({'where':{'id':_0x1c0efe[_0xb731('0x4c')]['id']}})['then'](handleEntityNotFound(_0x21735a,null))[_0xb731('0x2b')](function(_0x379fd8){if(_0x379fd8){return _0x379fd8[_0xb731('0x6e')](_0x1c0efe['query']['ids']);}})[_0xb731('0x2b')](respondWithStatusCode(_0x21735a,null))[_0xb731('0x4a')](handleError(_0x21735a,null));};exports[_0xb731('0x6f')]=function(_0xb6ca10,_0x20245c){var _0x32da25={};if(!_0xb6ca10['query']['section'])throw new Error(_0xb731('0x70'));if(!_0xb6ca10[_0xb731('0x35')]['hasOwnProperty'](_0xb731('0x3d'))){_0x32da25[_0xb731('0x27')]=qs[_0xb731('0x27')](_0xb6ca10['query']['limit']);_0x32da25[_0xb731('0x25')]=qs[_0xb731('0x25')](_0xb6ca10['query'][_0xb731('0x25')]);}return db[_0xb731('0x31')][_0xb731('0x4e')]({'where':{'id':_0xb6ca10[_0xb731('0x4c')]['id']}})['then'](function(_0x456f59){if(!_0x456f59)throw new Error(_0xb731('0x71')+_0xb6ca10[_0xb731('0x4c')]['id']);return db[_0xb731('0x31')][_0xb731('0x6f')](_0xb6ca10);})['then'](respondWithFilteredResult(_0x20245c,_0x32da25))['catch'](handleError(_0x20245c,null));}; \ No newline at end of file +var _0x57ca=['createdAt','updatedAt','crudPermissions','body','sequelize','transaction','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','UserProfile','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','rows','params','rawAttributes','fields','length','includeAll','include','options','find','create','catch','clone','get','omit'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0x57ca,0x108));var _0xa57c=function(_0x4671d1,_0x4459c3){_0x4671d1=_0x4671d1-0x0;var _0x5a099f=_0x57ca[_0x4671d1];return _0x5a099f;};'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'];config[_0xa57c('0x17')]=_[_0xa57c('0x18')](config[_0xa57c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa57c('0x19'))(new Redis(config['redis']));require(_0xa57c('0x1a'))[_0xa57c('0x1b')](socket);function respondWithStatusCode(_0x30940d,_0x3821d2){_0x3821d2=_0x3821d2||0xcc;return function(_0x3238ff){if(_0x3238ff){return _0x30940d[_0xa57c('0x1c')](_0x3821d2);}return _0x30940d[_0xa57c('0x1d')](_0x3821d2)['end']();};}function respondWithResult(_0x26607a,_0xdf7ff6){_0xdf7ff6=_0xdf7ff6||0xc8;return function(_0x261725){if(_0x261725){return _0x26607a['status'](_0xdf7ff6)[_0xa57c('0x1e')](_0x261725);}};}function respondWithFilteredResult(_0x5f33f1,_0x3e7afa){return function(_0x3d781d){if(_0x3d781d){var _0x93462c=typeof _0x3e7afa[_0xa57c('0x1f')]===_0xa57c('0x20')&&typeof _0x3e7afa[_0xa57c('0x21')]===_0xa57c('0x20');var _0x595c7a=_0x3d781d['count'];var _0x8a8856=_0x93462c?0x0:_0x3e7afa['offset'];var _0x4a35bb=_0x93462c?_0x3d781d[_0xa57c('0x22')]:_0x3e7afa[_0xa57c('0x1f')]+_0x3e7afa[_0xa57c('0x21')];var _0x23bec0;if(_0x4a35bb>=_0x595c7a){_0x4a35bb=_0x595c7a;_0x23bec0=0xc8;}else{_0x23bec0=0xce;}_0x5f33f1['status'](_0x23bec0);return _0x5f33f1[_0xa57c('0x23')](_0xa57c('0x24'),_0x8a8856+'-'+_0x4a35bb+'/'+_0x595c7a)[_0xa57c('0x1e')](_0x3d781d);}return null;};}function patchUpdates(_0x2213b2){return function(_0x3bb969){try{jsonpatch[_0xa57c('0x25')](_0x3bb969,_0x2213b2,!![]);}catch(_0x1e0192){return BPromise[_0xa57c('0x26')](_0x1e0192);}return _0x3bb969[_0xa57c('0x27')]();};}function saveUpdates(_0xdf65dd,_0x382a26){return function(_0x1e7f7a){if(_0x1e7f7a){return _0x1e7f7a[_0xa57c('0x28')](_0xdf65dd)[_0xa57c('0x29')](function(_0x431bec){return _0x431bec;});}return null;};}function removeEntity(_0x511a26,_0x2db443){return function(_0x5226d0){if(_0x5226d0){return _0x5226d0[_0xa57c('0x2a')]()[_0xa57c('0x29')](function(){_0x511a26[_0xa57c('0x1d')](0xcc)[_0xa57c('0x2b')]();});}};}function handleEntityNotFound(_0x8ee1c0,_0xe50fb8){return function(_0x337f97){if(!_0x337f97){_0x8ee1c0[_0xa57c('0x1c')](0x194);}return _0x337f97;};}function handleError(_0x57ebe0,_0x3b7364){_0x3b7364=_0x3b7364||0x1f4;return function(_0x4c1478){logger['error'](_0x4c1478[_0xa57c('0x2c')]);if(_0x4c1478[_0xa57c('0x2d')]){delete _0x4c1478['name'];}_0x57ebe0[_0xa57c('0x1d')](_0x3b7364)[_0xa57c('0x2e')](_0x4c1478);};}exports[_0xa57c('0x2f')]=function(_0x57565b,_0xd779f1){var _0x58d46f={},_0xf5f70c={},_0x5464f2={'count':0x0,'rows':[]};var _0x2a3bbe=_['map'](db[_0xa57c('0x30')]['rawAttributes'],function(_0x9e02bb){return{'name':_0x9e02bb[_0xa57c('0x31')],'type':_0x9e02bb[_0xa57c('0x32')][_0xa57c('0x33')]};});_0xf5f70c[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x2a3bbe,_0xa57c('0x2d'));_0xf5f70c['query']=_[_0xa57c('0x36')](_0x57565b['query']);_0xf5f70c[_0xa57c('0x37')]=_[_0xa57c('0x38')](_0xf5f70c[_0xa57c('0x34')],_0xf5f70c['query']);_0x58d46f[_0xa57c('0x39')]=_['intersection'](_0xf5f70c[_0xa57c('0x34')],qs['fields'](_0x57565b[_0xa57c('0x3a')]['fields']));_0x58d46f[_0xa57c('0x39')]=_0x58d46f[_0xa57c('0x39')]['length']?_0x58d46f[_0xa57c('0x39')]:_0xf5f70c['model'];if(!_0x57565b[_0xa57c('0x3a')]['hasOwnProperty'](_0xa57c('0x3b'))){_0x58d46f[_0xa57c('0x21')]=qs[_0xa57c('0x21')](_0x57565b[_0xa57c('0x3a')][_0xa57c('0x21')]);_0x58d46f[_0xa57c('0x1f')]=qs['offset'](_0x57565b['query'][_0xa57c('0x1f')]);}_0x58d46f[_0xa57c('0x3c')]=qs[_0xa57c('0x3d')](_0x57565b['query'][_0xa57c('0x3d')]);_0x58d46f['where']=qs[_0xa57c('0x37')](_[_0xa57c('0x3e')](_0x57565b['query'],_0xf5f70c['filters']),_0x2a3bbe);if(_0x57565b['query'][_0xa57c('0x3f')]){_0x58d46f[_0xa57c('0x40')]=_[_0xa57c('0x41')](_0x58d46f[_0xa57c('0x40')],{'$or':_[_0xa57c('0x35')](_0x2a3bbe,function(_0x1b98a0){if(_0x1b98a0['type']!==_0xa57c('0x42')){var _0x1d4d2e={};_0x1d4d2e[_0x1b98a0['name']]={'$like':'%'+_0x57565b['query'][_0xa57c('0x3f')]+'%'};return _0x1d4d2e;}})});}_0x58d46f=_[_0xa57c('0x41')]({},_0x58d46f,_0x57565b['options']);var _0x24459a={'where':_0x58d46f[_0xa57c('0x40')]};return db[_0xa57c('0x30')][_0xa57c('0x22')](_0x24459a)[_0xa57c('0x29')](function(_0x43c1d7){_0x5464f2['count']=_0x43c1d7;if(_0x57565b[_0xa57c('0x3a')]['includeAll']){_0x58d46f['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x58d46f);})['then'](function(_0x39b20f){_0x5464f2[_0xa57c('0x43')]=_0x39b20f;return _0x5464f2;})[_0xa57c('0x29')](respondWithFilteredResult(_0xd779f1,_0x58d46f))['catch'](handleError(_0xd779f1,null));};exports['show']=function(_0x49e072,_0x44f1e8){var _0x2755bc={'raw':![],'where':{'id':_0x49e072[_0xa57c('0x44')]['id']}},_0x44e38f={};_0x44e38f[_0xa57c('0x34')]=_[_0xa57c('0x36')](db['UserProfile'][_0xa57c('0x45')]);_0x44e38f[_0xa57c('0x3a')]=_[_0xa57c('0x36')](_0x49e072[_0xa57c('0x3a')]);_0x44e38f[_0xa57c('0x37')]=_[_0xa57c('0x38')](_0x44e38f['model'],_0x44e38f[_0xa57c('0x3a')]);_0x2755bc[_0xa57c('0x39')]=_[_0xa57c('0x38')](_0x44e38f[_0xa57c('0x34')],qs[_0xa57c('0x46')](_0x49e072['query'][_0xa57c('0x46')]));_0x2755bc[_0xa57c('0x39')]=_0x2755bc[_0xa57c('0x39')][_0xa57c('0x47')]?_0x2755bc[_0xa57c('0x39')]:_0x44e38f[_0xa57c('0x34')];if(_0x49e072['query'][_0xa57c('0x48')]){_0x2755bc[_0xa57c('0x49')]=[{'all':!![]}];}_0x2755bc=_[_0xa57c('0x41')]({},_0x2755bc,_0x49e072[_0xa57c('0x4a')]);return db[_0xa57c('0x30')][_0xa57c('0x4b')](_0x2755bc)['then'](handleEntityNotFound(_0x44f1e8,null))['then'](respondWithResult(_0x44f1e8,null))['catch'](handleError(_0x44f1e8,null));};exports['create']=function(_0x232675,_0x49492f){return db[_0xa57c('0x30')][_0xa57c('0x4c')](_0x232675['body'],{})[_0xa57c('0x29')](respondWithResult(_0x49492f,0xc9))[_0xa57c('0x4d')](handleError(_0x49492f,null));};exports[_0xa57c('0x4e')]=function(_0x128ea2,_0x3ef77c){var _0x5088f0={'where':{'id':_0x128ea2[_0xa57c('0x44')]['id']}},_0x1414e6={};_0x1414e6[_0xa57c('0x34')]=_[_0xa57c('0x36')](db[_0xa57c('0x30')]['rawAttributes']);_0x5088f0[_0xa57c('0x39')]=_['intersection'](_0x1414e6['model'],qs[_0xa57c('0x46')](_0x128ea2[_0xa57c('0x3a')][_0xa57c('0x46')]));_0x5088f0['attributes']=_0x5088f0['attributes'][_0xa57c('0x47')]?_0x5088f0[_0xa57c('0x39')]:_0x1414e6[_0xa57c('0x34')];if(_0x128ea2[_0xa57c('0x3a')]['includeAll']){_0x5088f0[_0xa57c('0x49')]=[{'all':!![]}];}_0x5088f0=_[_0xa57c('0x41')]({},_0x5088f0,_0x128ea2[_0xa57c('0x4a')]);return db['UserProfile']['find'](_0x5088f0)[_0xa57c('0x29')](handleEntityNotFound(_0x3ef77c,null))[_0xa57c('0x29')](function(_0x4d5d46){if(_0x4d5d46){var _0x368a07=_0x4d5d46[_0xa57c('0x4f')]({'plain':!![]});_0x368a07=qs[_0xa57c('0x50')](_0x368a07,['id',_0xa57c('0x51'),_0xa57c('0x52'),_0xa57c('0x53')]);_0x128ea2[_0xa57c('0x54')]=_['omit'](_0x128ea2['body'],['id',_0xa57c('0x51'),_0xa57c('0x52')]);return db[_0xa57c('0x55')][_0xa57c('0x56')](function(_0x15aeb7){return db[_0xa57c('0x30')][_0xa57c('0x4c')](_[_0xa57c('0x41')](_0x368a07,_0x128ea2['body']),{'include':_0x128ea2['query'][_0xa57c('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x15aeb7})['then'](function(_0x1880e6){var _0x1da3ef=_0x1880e6[_0xa57c('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0xa57c('0x57')]({'where':{'userProfileId':_0x128ea2['params']['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x4b3416){if(_0x4b3416){return BPromise[_0xa57c('0x58')](_0x4b3416,function(_0x170187){return new BPromise(function(_0x398743,_0x26a8e1){if(_0x170187['autoAssociation']===null||_0x170187[_0xa57c('0x59')]===0x1)_0x398743(null);return db[_0xa57c('0x5a')][_0xa57c('0x57')]({'where':{'sectionId':_0x170187['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x3345d5){var _0x5cad7e=_[_0xa57c('0x35')](_0x3345d5,function(_0x60b805){return qs[_0xa57c('0x50')](_0x60b805,['id',_0xa57c('0x51'),_0xa57c('0x52'),_0xa57c('0x5b')]);});_0x398743(_0x5cad7e);})[_0xa57c('0x4d')](function(_0x419527){_0x26a8e1(_0x419527);});})[_0xa57c('0x29')](function(_0x41041f){var _0x5a046e=qs[_0xa57c('0x50')](_0x170187,['id',_0xa57c('0x51'),_0xa57c('0x52')]);_0x5a046e[_0xa57c('0x5c')]=_0x1da3ef['id'];if(_0x41041f)_0x5a046e[_0xa57c('0x5d')]=_0x41041f;return _0x5a046e;})[_0xa57c('0x29')](function(_0x5440c2){return db[_0xa57c('0x5e')][_0xa57c('0x4c')](_0x5440c2,{'include':[{'model':db['UserProfileResource'],'as':_0xa57c('0x5d')}],'raw':!![],'transaction':_0x15aeb7});});})[_0xa57c('0x29')](function(){return _0x1da3ef;});}});});});}})[_0xa57c('0x29')](respondWithResult(_0x3ef77c,0xc9))[_0xa57c('0x4d')](handleError(_0x3ef77c,null));};exports[_0xa57c('0x28')]=function(_0x255cef,_0x24efa0){if(_0x255cef['body']['id']){delete _0x255cef[_0xa57c('0x54')]['id'];}return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x255cef['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x24efa0,null))['then'](saveUpdates(_0x255cef[_0xa57c('0x54')],null))[_0xa57c('0x29')](respondWithResult(_0x24efa0,null))['catch'](handleError(_0x24efa0,null));};exports[_0xa57c('0x2a')]=function(_0x23302d,_0x2dbd17){return db[_0xa57c('0x30')]['find']({'where':{'id':_0x23302d[_0xa57c('0x44')]['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x2dbd17,null))[_0xa57c('0x29')](removeEntity(_0x2dbd17,null))[_0xa57c('0x4d')](handleError(_0x2dbd17,null));};exports[_0xa57c('0x5f')]=function(_0x3d766a,_0x308ce5){return db[_0xa57c('0x30')][_0xa57c('0x5f')]()[_0xa57c('0x29')](respondWithResult(_0x308ce5,null))[_0xa57c('0x4d')](handleError(_0x308ce5,null));};exports[_0xa57c('0x60')]=function(_0x27ab1b,_0x83e9c7){var _0x23552a=_0x27ab1b[_0xa57c('0x54')];return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x27ab1b['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x83e9c7,null))[_0xa57c('0x29')](function(_0x245238){if(_0x245238){return db['sequelize'][_0xa57c('0x56')](function(_0x2ccc4d){return db[_0xa57c('0x5e')]['destroy']({'where':{'userProfileId':_0x27ab1b['params']['id'],'sectionId':_[_0xa57c('0x35')](_0x23552a,function(_0x39aa65){return _0x39aa65[_0xa57c('0x5b')];})},'transaction':_0x2ccc4d})[_0xa57c('0x29')](function(){var _0x3fd9aa=_[_0xa57c('0x35')](_0x23552a,function(_0x2a7aab){_0x2a7aab[_0xa57c('0x5c')]=_0x27ab1b[_0xa57c('0x44')]['id'];return _0x2a7aab;});var _0x57b6a3=[];return BPromise[_0xa57c('0x58')](_0x3fd9aa,function(_0x29951e){return db['UserProfileSection'][_0xa57c('0x4c')](_0x29951e,{'include':[{'model':db[_0xa57c('0x5a')],'as':_0xa57c('0x5d')}],'raw':!![],'transaction':_0x2ccc4d})[_0xa57c('0x29')](function(_0x1bb561){_0x57b6a3[_0xa57c('0x61')](_0x1bb561[_0xa57c('0x4f')]({'plain':!![]}));});})[_0xa57c('0x29')](function(){return _0x57b6a3;});});});}})['then'](function(_0x2960fd){return _0x2960fd;})[_0xa57c('0x29')](respondWithResult(_0x83e9c7,null))['catch'](handleError(_0x83e9c7,null));};exports[_0xa57c('0x62')]=function(_0x4a74d7,_0x5454cb){var _0x538f77;return db[_0xa57c('0x30')][_0xa57c('0x4b')]({'where':{'id':_0x4a74d7[_0xa57c('0x44')]['id']},'attributes':['id',_0xa57c('0x2d')]})[_0xa57c('0x29')](handleEntityNotFound(_0x5454cb,null))['then'](function(_0x2796ab){if(_0x2796ab){_0x538f77=_0x2796ab;return db[_0xa57c('0x5e')][_0xa57c('0x2a')]({'where':{'userProfileId':_0x4a74d7['params']['id'],'sectionId':_0x4a74d7[_0xa57c('0x3a')]['ids']}});}})[_0xa57c('0x29')](function(){return _0x538f77;})[_0xa57c('0x29')](respondWithStatusCode(_0x5454cb,null))[_0xa57c('0x4d')](handleError(_0x5454cb,null));};exports[_0xa57c('0x63')]=function(_0x4cf28c,_0x3740e9){var _0xc0a581=[];var _0x1c5e86=[];return db[_0xa57c('0x5e')]['findAll']({'where':{'userProfileId':_0x4cf28c[_0xa57c('0x44')]['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x44e547){_0xc0a581=_['filter'](_0x44e547,function(_0x3da413){return _0x3da413[_0xa57c('0x64')]===0x1||_[_0xa57c('0x65')]([0x3eb,0x709],_0x3da413['sectionId']);});if(!_[_0xa57c('0x66')](_0xc0a581)){return _[_0xa57c('0x35')](_0xc0a581,function(_0x32870a){return _0x32870a[_0xa57c('0x5b')];});}else{return;}})['then'](function(_0x2a58b5){if(_0x2a58b5)_0x1c5e86=_0x2a58b5;if(_[_0xa57c('0x65')](_0x1c5e86,0x64)){var _0x5c92ec=_[_0xa57c('0x4b')](_0xc0a581,{'sectionId':0x64});return hasDefaultDashboard(_0x5c92ec)[_0xa57c('0x29')](function(_0x59d2a2){return _[_0xa57c('0x35')](_0xc0a581,function(_0x4d4524){if(_0x4d4524[_0xa57c('0x5b')]===0x64){_0x4d4524[_0xa57c('0x67')]=_0x59d2a2;}return _0x4d4524;});});}else{return;}})[_0xa57c('0x29')](function(_0x37c00d){if(_0x37c00d)_0xc0a581=_0x37c00d;if(_['includes'](_0x1c5e86,0x3eb)){var _0x40a8db=_[_0xa57c('0x4b')](_0xc0a581,{'sectionId':0x3eb});return getCustomDashboards(_0x40a8db)[_0xa57c('0x29')](function(_0x2dfd3c){return _[_0xa57c('0x35')](_0xc0a581,function(_0x18e6ac){if(_0x40a8db[_0xa57c('0x64')]){if(_0x18e6ac[_0xa57c('0x5b')]===0x3eb){_0x18e6ac[_0xa57c('0x67')]=_0x2dfd3c;}}else{if(_0x18e6ac[_0xa57c('0x5b')]===0x64){_0x18e6ac[_0xa57c('0x67')]=_0x2dfd3c;}}return _0x18e6ac;});});}else{return;}})['then'](function(_0x488c35){if(_0x488c35)_0xc0a581=_0x488c35;if(_['includes'](_0x1c5e86,0x709)){var _0x29b491=_['find'](_0xc0a581,{'sectionId':0x709});return getPlugins(_0x29b491)[_0xa57c('0x29')](function(_0x442dc7){if(_0x29b491[_0xa57c('0x64')]){return _['map'](_0xc0a581,function(_0x21c428){if(_0x21c428[_0xa57c('0x5b')]===0x709){_0x21c428[_0xa57c('0x67')]=_0x442dc7;}return _0x21c428;});}else{var _0x39ae13={'sectionId':0x76c,'enabled':0x1,'subsections':_0x442dc7};var _0x42a273=_[_0xa57c('0x35')](_0xc0a581);_0x42a273[_0xa57c('0x61')](_0x39ae13);return _0x42a273;}});}else{return;}})['then'](function(_0xcebd5e){if(_0xcebd5e)_0xc0a581=_0xcebd5e;return _[_0xa57c('0x3f')](_0xc0a581,['enabled',0x1]);})['then'](respondWithResult(_0x3740e9,null))[_0xa57c('0x4d')](handleError(_0x3740e9,null));};function hasDefaultDashboard(_0x201983){var _0x4fc97e=[0x65];return new BPromise(function(_0x4edd10,_0xc5f17e){try{if(_0x201983['autoAssociation']){_0x4edd10(_0x4fc97e);}else{return db[_0xa57c('0x5a')][_0xa57c('0x68')]({'where':{'sectionId':_0x201983['id']},'raw':!![]})['then'](function(_0x1cda66){_0x1cda66?_0x4edd10(_0x4fc97e):_0x4edd10();});}}catch(_0x1706f1){_0xc5f17e(_0x1706f1);}});}function getCustomDashboards(_0x44558f){var _0x3df8f5=[];return new BPromise(function(_0x562e79,_0x4dd551){try{if(_0x44558f[_0xa57c('0x59')]){return db['Dashboard'][_0xa57c('0x57')]({'raw':!![]})[_0xa57c('0x29')](function(_0x4a2b64){_0x4a2b64['forEach'](function(_0x4925da){_0x3df8f5[_0xa57c('0x61')](_0x4925da['id']+0x1869f);});_0x562e79(_0x3df8f5);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x44558f['id']},'raw':!![]})[_0xa57c('0x29')](function(_0x2c3d8d){_0x2c3d8d[_0xa57c('0x69')](function(_0x49d03b){_0x3df8f5[_0xa57c('0x61')](_0x49d03b[_0xa57c('0x6a')]+0x1869f);});_0x562e79(_0x3df8f5);});}}catch(_0x11e592){_0x4dd551(_0x11e592);}});}function getPlugins(_0x5bbb59){var _0x4b8228=[];return new BPromise(function(_0x19f190,_0x5079ce){try{if(_0x5bbb59[_0xa57c('0x59')]){return db[_0xa57c('0x6b')]['findAll']({'raw':!![]})[_0xa57c('0x29')](function(_0x55261e){_0x55261e['forEach'](function(_0x5db013){_0x4b8228[_0xa57c('0x61')](_0x5db013['id']+0x15b38);});_0x19f190(_0x4b8228);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5bbb59['id']},'raw':!![]})['then'](function(_0x3e12e5){_0x3e12e5[_0xa57c('0x69')](function(_0x54feaa){_0x4b8228[_0xa57c('0x61')](_0x54feaa[_0xa57c('0x6a')]+0x15b38);});_0x19f190(_0x4b8228);});}}catch(_0x25298c){_0x5079ce(_0x25298c);}});}exports['addResources']=function(_0x31be8e,_0xed49ba){return db[_0xa57c('0x30')][_0xa57c('0x4b')]({'where':{'id':_0x31be8e['params']['id']}})['then'](handleEntityNotFound(_0xed49ba,null))[_0xa57c('0x29')](function(_0x512e3d){if(_0x512e3d){return db[_0xa57c('0x55')][_0xa57c('0x56')](function(_0x2cc12b){return db['UserProfileSection'][_0xa57c('0x57')]({'where':{'userProfileId':_0x31be8e['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x193e63){if(_0x193e63){return db['UserProfileSection'][_0xa57c('0x2a')]({'where':{'userProfileId':_0x31be8e[_0xa57c('0x44')]['id'],'id':_['map'](_0x193e63,function(_0x525bc3){return _0x525bc3['id'];})},'transaction':_0x2cc12b});}})[_0xa57c('0x29')](function(_0x3142d1){var _0x50a940=_['map'](_0x31be8e[_0xa57c('0x54')],function(_0xbdc5d6){_0xbdc5d6[_0xa57c('0x5c')]=_0x31be8e['params']['id'];return _0xbdc5d6;});return db[_0xa57c('0x5e')][_0xa57c('0x6c')](_0x50a940,{'raw':!![],'transaction':_0x2cc12b});})[_0xa57c('0x29')](function(_0x307de3){var _0x3aada4=_[_0xa57c('0x3f')](_[_0xa57c('0x35')](_0x307de3,function(_0x4133f7){return _0x4133f7[_0xa57c('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x3aada4){return db[_0xa57c('0x5e')][_0xa57c('0x57')]({'where':{'userProfileId':_0x31be8e[_0xa57c('0x44')]['id'],'sectionId':_[_0xa57c('0x35')](_0x3aada4,function(_0x5ad3b9){return _0x5ad3b9[_0xa57c('0x5b')];})},'attributes':['id',_0xa57c('0x5b')],'raw':!![]})[_0xa57c('0x29')](function(_0x107ebd){var _0x159b00=_[_0xa57c('0x35')](_0x31be8e['body'],function(_0x4fcb4f){_0x4fcb4f[_0xa57c('0x5c')]=_0x31be8e['params']['id'];return _0x4fcb4f;});return db['UserProfileResource'][_0xa57c('0x6c')](_0x159b00,{'raw':!![],'transaction':_0x2cc12b});});}})[_0xa57c('0x4d')](handleError(_0xed49ba,null));});}})[_0xa57c('0x29')](function(_0x4baf82){var _0x305ed0=_[_0xa57c('0x35')](_0x4baf82,function(_0x2623cf){return _0x2623cf[_0xa57c('0x4f')]({'plain':!![]});});})[_0xa57c('0x29')](respondWithResult(_0xed49ba,null))['catch'](handleError(_0xed49ba,null));};exports['removeResources']=function(_0x33ab13,_0x113ced,_0x3df959){return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x33ab13['params']['id']}})[_0xa57c('0x29')](handleEntityNotFound(_0x113ced,null))[_0xa57c('0x29')](function(_0x244e4b){if(_0x244e4b){return _0x244e4b[_0xa57c('0x6d')](_0x33ab13[_0xa57c('0x3a')][_0xa57c('0x6e')]);}})[_0xa57c('0x29')](respondWithStatusCode(_0x113ced,null))['catch'](handleError(_0x113ced,null));};exports['getResources']=function(_0x1c8b44,_0xc6d392){var _0xe5e57f={};if(!_0x1c8b44['query']['section'])throw new Error(_0xa57c('0x6f'));if(!_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x70')](_0xa57c('0x3b'))){_0xe5e57f[_0xa57c('0x21')]=qs['limit'](_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x21')]);_0xe5e57f[_0xa57c('0x1f')]=qs['offset'](_0x1c8b44[_0xa57c('0x3a')][_0xa57c('0x1f')]);}return db['UserProfile'][_0xa57c('0x4b')]({'where':{'id':_0x1c8b44[_0xa57c('0x44')]['id']}})[_0xa57c('0x29')](function(_0x104bd1){if(!_0x104bd1)throw new Error(_0xa57c('0x71')+_0x1c8b44[_0xa57c('0x44')]['id']);return db[_0xa57c('0x30')][_0xa57c('0x72')](_0x1c8b44);})[_0xa57c('0x29')](respondWithFilteredResult(_0xc6d392,_0xe5e57f))['catch'](handleError(_0xc6d392,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 96e91d0..aaa177c 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 _0xe2fe=['exports','events','setMaxListeners','update','remove','emit','hook'];(function(_0x3f7200,_0x18cf3c){var _0x3ff267=function(_0x1b2fa2){while(--_0x1b2fa2){_0x3f7200['push'](_0x3f7200['shift']());}};_0x3ff267(++_0x18cf3c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xee2f('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xee2f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee2f('0x2'),'afterDestroy':_0xee2f('0x3')};function emitEvent(_0xe5ad8a){return function(_0x2d2b03,_0xcb45e6,_0x4ba89f){UserProfileEvents[_0xee2f('0x4')](_0xe5ad8a+':'+_0x2d2b03['id'],_0x2d2b03);UserProfileEvents[_0xee2f('0x4')](_0xe5ad8a,_0x2d2b03);_0x4ba89f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xee2f('0x5')](e,emitEvent(event));}}module[_0xee2f('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x0d91=['UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2a1148,_0x16ff53){var _0x4e8d6e=function(_0x3dbc67){while(--_0x3dbc67){_0x2a1148['push'](_0x2a1148['shift']());}};_0x4e8d6e(++_0x16ff53);}(_0x0d91,0x76));var _0x10d9=function(_0x569ebc,_0x415cde){_0x569ebc=_0x569ebc-0x0;var _0xacee87=_0x0d91[_0x569ebc];return _0xacee87;};'use strict';var EventEmitter=require(_0x10d9('0x0'));var UserProfile=require(_0x10d9('0x1'))['db'][_0x10d9('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x10d9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x10d9('0x4'),'afterDestroy':_0x10d9('0x5')};function emitEvent(_0x132a71){return function(_0x56ab5d,_0x2f6e57,_0x305c20){UserProfileEvents[_0x10d9('0x6')](_0x132a71+':'+_0x56ab5d['id'],_0x56ab5d);UserProfileEvents['emit'](_0x132a71,_0x56ab5d);_0x305c20(null);};}for(var e in events){if(events[_0x10d9('0x7')](e)){var event=events[e];UserProfile[_0x10d9('0x8')](e,emitEvent(event));}}module[_0x10d9('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 6c1c4cc..ccd1182 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 _0xfce9=['musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','queuecampaigns','QueueCampaigns','users','telephones','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','charAt','toUpperCase','slice','select','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','Invalid\x20section\x20\x27','UserProfileSection','params','all','ignore','isEmpty','union','push','autoAssociation','model','length','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','merge','foreignKey','forEach','options','includeAll','reportType','default','reportId','custom','CustomReports','count','rows','CmContact','include','color','tag','ThroughTags','Agents','openTabs','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','exports','models','filter','field','value','findAll','associatedResources','then','catch','resolve','UserProfileResource','map','AnalyticExtractedReport','resourceId','childModel','SquareProject','odbc','SquareOdbc','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','outbound'];(function(_0x41d592,_0x3f8c09){var _0x536cf2=function(_0x4fe7c9){while(--_0x4fe7c9){_0x41d592['push'](_0x41d592['shift']());}};_0x536cf2(++_0x3f8c09);}(_0xfce9,0x85));var _0x9fce=function(_0x59dec3,_0x4864ec){_0x59dec3=_0x59dec3-0x0;var _0x23d28d=_0xfce9[_0x59dec3];return _0x23d28d;};'use strict';var _=require(_0x9fce('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x9fce('0x1')]=function(_0x43321f){var _0x5d34a7=_0x43321f[_0x9fce('0x2')];function _0x2b375d(_0x56bac6,_0x3e3f40){return new Promise(function(_0x12038d,_0xadeaaf){if(!_0x3e3f40)return _0x12038d(null);var _0x3dc8c7=_0x3e3f40['filter']?{[_0x3e3f40[_0x9fce('0x3')][_0x9fce('0x4')]]:_0x3e3f40['filter'][_0x9fce('0x5')]}:undefined;return _0x5d34a7[_0x56bac6][_0x9fce('0x6')]({'where':_0x3dc8c7,'raw':!![]})['then'](function(_0x45d1da){_0x3e3f40[_0x9fce('0x7')]=_['map'](_0x45d1da,'id');_0x12038d(_0x3e3f40);})['catch'](function(_0x5d0f69){_0xadeaaf(_0x5d0f69);});});}function _0x3750fc(_0x2d9df4,_0x5bfdaf){return new Promise(function(_0x47ddb8,_0x1ea7f7){var _0x35eadf=_0x2d9df4[_0x9fce('0x3')]?{[_0x2d9df4[_0x9fce('0x3')][_0x9fce('0x4')]]:_0x2d9df4[_0x9fce('0x3')][_0x9fce('0x5')]}:undefined;return _0x5d34a7[_0x2d9df4['model']][_0x9fce('0x6')]({'where':_0x35eadf,'raw':!![]})[_0x9fce('0x8')](function(_0x5bf99e){_0x5bfdaf['associatedResources']=_['map'](_0x5bf99e,function(_0xb40566){return _0xb40566['name'];});_0x47ddb8(_0x5bfdaf);})[_0x9fce('0x9')](function(_0x5f2b2c){_0x1ea7f7(_0x5f2b2c);});});}function _0x4d68d6(_0x52c72b,_0x36e884,_0x4d71e8){if(!_0x36e884)return Promise[_0x9fce('0xa')](null);return new Promise(function(_0x1a7482,_0xe1b999){return _0x5d34a7[_0x9fce('0xb')][_0x9fce('0x6')]({'where':{'sectionId':_0x36e884['id']},'raw':!![]})[_0x9fce('0x8')](function(_0x1e8dde){if(_0x52c72b[_0x9fce('0x4')]&&_0x52c72b[_0x9fce('0x4')]!=='id'){_0x36e884['associatedResources']=_[_0x9fce('0xc')](_0x1e8dde,function(_0x3461ff){return _0x3461ff[_0x52c72b[_0x9fce('0x4')]];});}else{if(_0x4d71e8===_0x9fce('0xd')){_0x36e884[_0x9fce('0x7')]=_[_0x9fce('0xc')](_0x1e8dde,function(_0x3b857b){return{'id':_0x3b857b[_0x9fce('0xe')],'type':_0x3b857b['type']};});}else{_0x36e884[_0x9fce('0x7')]=_['map'](_0x1e8dde,function(_0x5a112f){return _0x5a112f[_0x9fce('0xe')];});}}_0x1a7482(_0x36e884);})[_0x9fce('0x9')](function(_0x2f6f4f){_0xe1b999(_0x2f6f4f);});});}function _0x583a28(_0x22080b,_0x1acbb2){var _0x3cdd74={'parentSections':[]};switch(_0x22080b['toLowerCase']()){case'squareprojects':_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x10');break;case _0x9fce('0x11'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x12');break;case'squarerecordings':_0x3cdd74[_0x9fce('0xf')]='SquareRecording';_0x3cdd74[_0x9fce('0x13')]=[{'name':_0x9fce('0x14'),'field':_0x9fce('0x15'),'foreignKey':_0x9fce('0x16')}];break;case _0x9fce('0x17'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x18');break;case _0x9fce('0x19'):_0x3cdd74['childModel']='CmContact';_0x3cdd74[_0x9fce('0x13')]=[{'name':_0x9fce('0x1a'),'field':'id','foreignKey':_0x9fce('0x1b')}];break;case _0x9fce('0x1c'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x1d');break;case'companies':_0x3cdd74['childModel']='CmCompany';break;case _0x9fce('0x1e'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x1f');break;case _0x9fce('0x20'):_0x3cdd74['childModel']=_0x9fce('0x21');break;case _0x9fce('0x22'):_0x3cdd74['childModel']=_0x9fce('0x23');break;case _0x9fce('0x24'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x25');break;case _0x9fce('0x26'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x27');break;case _0x9fce('0x28'):case'internalroutes':case _0x9fce('0x29'):_0x3cdd74[_0x9fce('0xf')]='VoiceExtension';break;case _0x9fce('0x2a'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x2b');break;case _0x9fce('0x2c'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x2d');break;case _0x9fce('0x2e'):_0x3cdd74[_0x9fce('0xf')]='VoiceRecording';_0x3cdd74['parentSections']=[{'name':'Agents','field':_0x9fce('0x15'),'foreignKey':_0x9fce('0x2f'),'model':_0x9fce('0x30'),'filter':{'field':_0x9fce('0x31'),'value':[_0x9fce('0x32')]}},{'name':'Telephones','field':'name','foreignKey':_0x9fce('0x2f'),'model':_0x9fce('0x30'),'filter':{'field':'role','value':[_0x9fce('0x33')]}},{'name':_0x9fce('0x34'),'field':_0x9fce('0x15'),'foreignKey':_0x9fce('0x35'),'model':_0x9fce('0x36'),'filter':{'field':_0x9fce('0x37'),'value':[_0x9fce('0x38')]}},{'name':'QueueCampaigns','field':_0x9fce('0x15'),'foreignKey':_0x9fce('0x35'),'model':_0x9fce('0x36'),'filter':{'field':_0x9fce('0x37'),'value':[_0x9fce('0x39')]}}];break;case _0x9fce('0x3a'):_0x3cdd74['childModel']=_0x9fce('0x3b');break;case _0x9fce('0x3c'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x3d');break;case'voiceprefixes':_0x3cdd74[_0x9fce('0xf')]='VoicePrefix';break;case _0x9fce('0x3e'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x3f');break;case _0x9fce('0x40'):_0x3cdd74['childModel']=_0x9fce('0x41');break;case _0x9fce('0x42'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x43');break;case _0x9fce('0x44'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x45');break;case'openchannelqueues':_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x46');break;case _0x9fce('0x47'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x48');break;case _0x9fce('0x49'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x4a');break;case _0x9fce('0x4b'):_0x3cdd74[_0x9fce('0xf')]='SmsAccount';break;case _0x9fce('0x4c'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x4d');break;case'whatsappaccounts':_0x3cdd74['childModel']=_0x9fce('0x4e');break;case _0x9fce('0x4f'):_0x3cdd74[_0x9fce('0xf')]='Team';break;case _0x9fce('0x50'):case _0x9fce('0x51'):_0x3cdd74['childModel']=_0x9fce('0x36');if(_0x1acbb2){_0x3cdd74['parentSections']=[{'name':_0x9fce('0x34')},{'name':_0x9fce('0x52')}];}break;case _0x9fce('0x53'):case'agents':case _0x9fce('0x54'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x30');if(_0x1acbb2){_0x3cdd74[_0x9fce('0x13')]=[{'name':'Users','filter':{'field':_0x9fce('0x31'),'value':[_0x9fce('0x55'),_0x9fce('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9fce('0x57')}];}break;case _0x9fce('0x58'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x59');break;case _0x9fce('0x5a'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x5b');break;case _0x9fce('0x5c'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x5d');break;case _0x9fce('0x5e'):_0x3cdd74['childModel']=_0x9fce('0x5f');break;case _0x9fce('0x60'):_0x3cdd74[_0x9fce('0xf')]='DeskAccount';break;case'zohoaccounts':_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x61');break;case _0x9fce('0x62'):_0x3cdd74['childModel']=_0x9fce('0x30');break;case _0x9fce('0x63'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x64');break;case _0x9fce('0x65'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x66');break;case _0x9fce('0x67'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x68');break;case _0x9fce('0x69'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x6a');break;case _0x9fce('0x6b'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x6c');break;case _0x9fce('0x6d'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x6e');break;case _0x9fce('0x6f'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x70');break;case'tags':_0x3cdd74['childModel']=_0x9fce('0x71');break;case _0x9fce('0x72'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x73');break;case'triggers':_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x74');break;case _0x9fce('0x75'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x76');break;case _0x9fce('0x77'):_0x3cdd74[_0x9fce('0xf')]=_0x9fce('0x78');break;case _0x9fce('0x79'):_0x3cdd74['childModel']=_0x9fce('0x7a');break;case _0x9fce('0x7b'):_0x3cdd74[_0x9fce('0xf')]='AnalyticExtractedReport';_0x3cdd74[_0x9fce('0x13')]=[{'name':_0x9fce('0x7c'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x3cdd74[_0x9fce('0xf')]='AnalyticMetric';break;}return _0x3cdd74;}function _0x1a3363(_0x11491f,_0x237f82){var _0x222588=_0x11491f[_0x9fce('0x7d')](0x0)[_0x9fce('0x7e')]()+_0x11491f[_0x9fce('0x7f')](0x1);var _0x44dee7={'type':_0x5d34a7['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x1b2959,_0xef5fc){var _0x4c1ca7=squel[_0x9fce('0x80')]()[_0x9fce('0x4')](_0x9fce('0x81')+_0x222588+'InteractionId','id')[_0x9fce('0x4')](_0x9fce('0x82'))[_0x9fce('0x83')](_0x9fce('0x84')+_0x11491f+_0x9fce('0x85'),'ui')[_0x9fce('0x86')](_0x9fce('0x87'),_0x237f82['id']);return _0x5d34a7[_0x9fce('0x88')][_0x9fce('0x89')](_0x4c1ca7[_0x9fce('0x8a')](),_0x44dee7)[_0x9fce('0x8')](function(_0x4cd193){_0x237f82[_0x222588+_0x9fce('0x8b')]=_0x4cd193;_0x1b2959(_0x4cd193);})[_0x9fce('0x9')](function(_0x50daa4){_0xef5fc(_0x50daa4);});});}return _0x43321f[_0x9fce('0x8c')]('UserProfile',attributes,{'tableName':_0x9fce('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x56cdc2){var _0x2036e5={'raw':_0x56cdc2[_0x9fce('0x89')][_0x9fce('0x8e')],'where':{}};var _0x45aff4={};var _0x3367d7={'count':0x0,'rows':[]};var _0x3e46e1=_0x56cdc2[_0x9fce('0x89')][_0x9fce('0x8f')];var _0x30b1b6=_0x56cdc2[_0x9fce('0x89')]['mergeResources']||![];var _0x4d9ce9=_0x583a28(_0x3e46e1,_0x30b1b6);if(!_0x4d9ce9[_0x9fce('0xf')])throw new Error(_0x9fce('0x90')+_0x3e46e1+'\x27');var _0x412624=[{'name':_0x3e46e1}];if(!_['isEmpty'](_0x4d9ce9[_0x9fce('0x13')]))_0x412624=_0x4d9ce9[_0x9fce('0x13')];var _0x3949de=[];for(var _0x4541b8=0x0;_0x4541b8<_0x412624['length'];_0x4541b8++){_0x3949de['push'](_0x5d34a7[_0x9fce('0x91')]['find']({'where':{'userProfileId':_0x56cdc2[_0x9fce('0x92')]['id'],'name':_0x412624[_0x4541b8][_0x9fce('0x15')]},'raw':!![]}));}return Promise[_0x9fce('0x93')](_0x3949de)[_0x9fce('0x8')](function(_0x2deb4d){var _0xda45c4=_['filter'](_0x2deb4d,function(_0x365669){return _0x365669?_0x365669:undefined;});var _0x5fb4f6=_[_0x9fce('0x3')](_0x412624,[_0x9fce('0x94'),!![]]);var _0x250468=_[_0x9fce('0x95')](_0xda45c4)&&_[_0x9fce('0x95')](_0x5fb4f6)?null:_[_0x9fce('0x96')](_0x5fb4f6,_0xda45c4);if(!_0x250468)return null;var _0x379fdd=[];for(var _0x2c842a=0x0;_0x2c842a<_0x250468['length'];_0x2c842a++){var _0x35959e=_['find'](_0x412624,function(_0x5f2c04){return _0x250468[_0x2c842a]?_0x5f2c04['name']===_0x250468[_0x2c842a]['name']:null;});if(_0x35959e){if(_0x250468[_0x2c842a]['ignore']){_0x379fdd[_0x9fce('0x97')](_0x2b375d(_0x4d9ce9[_0x9fce('0xf')],_0x250468[_0x2c842a]));}else{if(!_0x250468[_0x2c842a][_0x9fce('0x98')]){_0x379fdd[_0x9fce('0x97')](_0x4d68d6(_0x35959e,_0x250468[_0x2c842a],_0x4d9ce9[_0x9fce('0xf')]));}else{if(_0x35959e[_0x9fce('0x99')]){_0x379fdd[_0x9fce('0x97')](_0x3750fc(_0x35959e,_0x250468[_0x2c842a]));}}}}}return Promise['all'](_0x379fdd);})[_0x9fce('0x8')](function(_0x51ddd1){var _0x335304=_0x51ddd1;var _0x23d6c2=null;if(_0x335304){_0x23d6c2=_0x335304[_0x9fce('0x9a')]===0x1?_0x335304[0x0]:null;}if(!_0x23d6c2&&!_0x335304)return _0x3367d7;var _0x379a15=_0x5d34a7[_0x4d9ce9[_0x9fce('0xf')]][_0x9fce('0x9b')];_0x45aff4[_0x9fce('0x99')]=_[_0x9fce('0x9c')](_0x379a15);_0x45aff4['query']=_[_0x9fce('0x9c')](_0x56cdc2[_0x9fce('0x89')]);_0x45aff4[_0x9fce('0x9d')]=_[_0x9fce('0x9e')](_0x45aff4[_0x9fce('0x99')],_0x45aff4[_0x9fce('0x89')]);_0x2036e5[_0x9fce('0x9f')]=_[_0x9fce('0x9e')](_0x45aff4[_0x9fce('0x99')],qs[_0x9fce('0xa0')](_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xa0')]));_0x2036e5[_0x9fce('0x9f')]=_0x2036e5[_0x9fce('0x9f')][_0x9fce('0x9a')]?_0x2036e5[_0x9fce('0x9f')]:_0x45aff4['model'];if(!_0x56cdc2['query']['hasOwnProperty'](_0x9fce('0xa1'))){_0x2036e5[_0x9fce('0xa2')]=qs[_0x9fce('0xa2')](_0x56cdc2[_0x9fce('0x89')]['limit']);_0x2036e5[_0x9fce('0xa3')]=qs['offset'](_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xa3')]);}_0x2036e5[_0x9fce('0xa4')]=qs[_0x9fce('0xa5')](_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xa5')]);_0x2036e5[_0x9fce('0x86')]=qs[_0x9fce('0x9d')](_['pick'](_0x56cdc2[_0x9fce('0x89')],_0x45aff4[_0x9fce('0x9d')]));if(_0x56cdc2[_0x9fce('0x89')][_0x9fce('0x3')]){_0x2036e5[_0x9fce('0x86')]=_[_0x9fce('0xa6')](_0x2036e5[_0x9fce('0x86')],{'$or':_[_0x9fce('0xc')](_0x379a15,function(_0x2f4614){if(_0x2f4614['type']['key']!=='VIRTUAL'){var _0xc03531={};_0xc03531[_0x2f4614[_0x9fce('0x4')]]={'$like':'%'+_0x56cdc2[_0x9fce('0x89')][_0x9fce('0x3')]+'%'};return _0xc03531;}})});}var _0xca5292=[];var _0x54744a=null;var _0x17031f={};if(_0x23d6c2){_0x54744a=_['find'](_0x412624,[_0x9fce('0x15'),_0x23d6c2[_0x9fce('0x15')]]);if(_0x54744a[_0x9fce('0x4')]){_0x17031f={};if(_0x4d9ce9[_0x9fce('0xf')]===_0x9fce('0xd')){_0x17031f[_0x54744a['foreignKey']]=_[_0x9fce('0xc')](_0x23d6c2['associatedResources'],'id');}else{_0x17031f[_0x54744a[_0x9fce('0xa7')]]=_0x23d6c2[_0x9fce('0x7')];}_0xca5292[_0x9fce('0x97')](_0x17031f);}else{_0x2036e5[_0x9fce('0x86')]['id']=_0x23d6c2['associatedResources'];}}else{for(var _0x32e128=0x0;_0x32e128<_0x335304[_0x9fce('0x9a')];_0x32e128++){_0x54744a=_['find'](_0x412624,['name',_0x335304[_0x32e128][_0x9fce('0x15')]]);if(_0x54744a['field']){_0x17031f={};_0x17031f[_0x54744a[_0x9fce('0xa7')]]=_0x335304[_0x32e128][_0x9fce('0x7')];_0xca5292[_0x9fce('0x97')](_0x17031f);}else{if(!_0x2036e5[_0x9fce('0x86')]['id'])_0x2036e5['where']['id']=[];_0x335304[_0x32e128][_0x9fce('0x7')][_0x9fce('0xa8')](function(_0x498820){_0x2036e5['where']['id']['push'](_0x498820);});}}}if(!_[_0x9fce('0x95')](_0xca5292)){_0x2036e5[_0x9fce('0x86')]=_[_0x9fce('0xa6')](_0x2036e5[_0x9fce('0x86')],{'$and':{'$or':_0xca5292}});}_0x2036e5=_[_0x9fce('0xa6')]({},_0x2036e5,_0x56cdc2[_0x9fce('0xa9')]);if(_0x23d6c2&&!_0x23d6c2['autoAssociation']&&_0x4d9ce9[_0x9fce('0xf')]===_0x9fce('0xd')){if(_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xaa')]){_0x2036e5['include']=[{'all':!![]}];}return _0x5d34a7[_0x4d9ce9[_0x9fce('0xf')]]['findAll'](_0x2036e5)[_0x9fce('0x8')](function(_0x4c1ef9){var _0xe27e65=[];_0x4c1ef9[_0x9fce('0xa8')](function(_0xdba659){var _0x499179;switch(_0xdba659[_0x9fce('0xab')]){case _0x9fce('0xac'):_0x499179=_['find'](_0x23d6c2['associatedResources'],function(_0x5b6b3b){return _0x5b6b3b['id']===_0xdba659[_0x9fce('0xad')]&&_0x5b6b3b[_0x9fce('0x37')]==='DefaultReports';});break;case _0x9fce('0xae'):_0x499179=_['find'](_0x23d6c2[_0x9fce('0x7')],function(_0x3e61d0){return _0x3e61d0['id']===_0xdba659[_0x9fce('0xad')]&&_0x3e61d0[_0x9fce('0x37')]===_0x9fce('0xaf');});break;}if(_0x499179)_0xe27e65[_0x9fce('0x97')](_0xdba659);});_0x3367d7[_0x9fce('0xb0')]=_0xe27e65[_0x9fce('0x9a')];_0x3367d7[_0x9fce('0xb1')]=_0xe27e65;return _0x3367d7;});}else{return _0x5d34a7[_0x4d9ce9[_0x9fce('0xf')]][_0x9fce('0xb0')]({'where':_0x2036e5[_0x9fce('0x86')]})[_0x9fce('0x8')](function(_0x316586){_0x3367d7[_0x9fce('0xb0')]=_0x316586;if(_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xaa')]){if(_0x4d9ce9[_0x9fce('0xf')]===_0x9fce('0xb2')){_0x2036e5[_0x9fce('0xb3')]=[{'model':_0x5d34a7[_0x9fce('0x71')],'as':'Tags','attributes':['id',_0x9fce('0x15'),_0x9fce('0xb4')],'required':_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xb5')]?!![]:![]},{'model':_0x5d34a7['Tag'],'as':_0x9fce('0xb6'),'attributes':['id',_0x9fce('0x15'),_0x9fce('0xb4')],'through':_0x56cdc2[_0x9fce('0x89')]['tag']?{'attributes':[],'where':{'TagId':_0x56cdc2[_0x9fce('0x89')][_0x9fce('0xb5')]||undefined}}:{},'required':_0x56cdc2['query'][_0x9fce('0xb5')]?!![]:![]}];}else{_0x2036e5[_0x9fce('0xb3')]=[{'all':!![]}];}}return _0x5d34a7[_0x4d9ce9[_0x9fce('0xf')]][_0x9fce('0x6')](_0x2036e5);})[_0x9fce('0x8')](function(_0x2722f9){_0x3367d7[_0x9fce('0xb1')]=_0x2722f9;if(_0x3e46e1===_0x9fce('0xb7')&&_0x56cdc2['query'][_0x9fce('0xb8')]==='true'){var _0x48e289=[];for(var _0xa12506=0x0;_0xa12506<_0x3367d7['rows'][_0x9fce('0x9a')];_0xa12506++){_0x48e289[_0x9fce('0x97')](_0x1a3363('chat',_0x3367d7[_0x9fce('0xb1')][_0xa12506][_0x9fce('0xb9')]));_0x48e289[_0x9fce('0x97')](_0x1a3363(_0x9fce('0xba'),_0x3367d7[_0x9fce('0xb1')][_0xa12506][_0x9fce('0xb9')]));_0x48e289[_0x9fce('0x97')](_0x1a3363(_0x9fce('0xbb'),_0x3367d7[_0x9fce('0xb1')][_0xa12506]['dataValues']));_0x48e289[_0x9fce('0x97')](_0x1a3363(_0x9fce('0xbc'),_0x3367d7[_0x9fce('0xb1')][_0xa12506]['dataValues']));_0x48e289[_0x9fce('0x97')](_0x1a3363(_0x9fce('0xbd'),_0x3367d7[_0x9fce('0xb1')][_0xa12506]['dataValues']));_0x48e289[_0x9fce('0x97')](_0x1a3363(_0x9fce('0xbe'),_0x3367d7[_0x9fce('0xb1')][_0xa12506][_0x9fce('0xb9')]));}return Promise[_0x9fce('0x93')](_0x48e289)[_0x9fce('0x8')](function(){return _0x3367d7;});}return _0x3367d7;});}});}}});}; \ No newline at end of file +var _0x8643=['SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','UserProfileSection','all','union','find','ignore','push','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','sort','where','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','options','autoAssociation','include','forEach','reportType','default','DefaultReports','CustomReports','count','rows','includeAll','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','whatsapp','./userProfile.attributes','squel','models','filter','value','then','associatedResources','map','catch','field','model','findAll','name','resolve','resourceId','type','toLowerCase','squareprojects','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','CmContact','parentSections','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','agent','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','telephones','User','Users','role','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts'];(function(_0x3eb715,_0x40207a){var _0x54d2fa=function(_0x275fa2){while(--_0x275fa2){_0x3eb715['push'](_0x3eb715['shift']());}};_0x54d2fa(++_0x40207a);}(_0x8643,0x69));var _0x3864=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8643[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var attributes=require(_0x3864('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x3864('0x1'));module['exports']=function(_0x2ccd83){var _0x9f6073=_0x2ccd83[_0x3864('0x2')];function _0x545b47(_0x5d518f,_0x100abb){return new Promise(function(_0x5da98f,_0xdddac0){if(!_0x100abb)return _0x5da98f(null);var _0x25b20d=_0x100abb[_0x3864('0x3')]?{[_0x100abb['filter']['field']]:_0x100abb['filter'][_0x3864('0x4')]}:undefined;return _0x9f6073[_0x5d518f]['findAll']({'where':_0x25b20d,'raw':!![]})[_0x3864('0x5')](function(_0xc3a192){_0x100abb[_0x3864('0x6')]=_[_0x3864('0x7')](_0xc3a192,'id');_0x5da98f(_0x100abb);})[_0x3864('0x8')](function(_0x484e00){_0xdddac0(_0x484e00);});});}function _0x36fcf3(_0x32d63a,_0x14a5fe){return new Promise(function(_0x3ea130,_0x157fb6){var _0x43a71b=_0x32d63a['filter']?{[_0x32d63a[_0x3864('0x3')][_0x3864('0x9')]]:_0x32d63a[_0x3864('0x3')][_0x3864('0x4')]}:undefined;return _0x9f6073[_0x32d63a[_0x3864('0xa')]][_0x3864('0xb')]({'where':_0x43a71b,'raw':!![]})[_0x3864('0x5')](function(_0x350b7b){_0x14a5fe[_0x3864('0x6')]=_[_0x3864('0x7')](_0x350b7b,function(_0x1bd6e5){return _0x1bd6e5[_0x3864('0xc')];});_0x3ea130(_0x14a5fe);})['catch'](function(_0x405730){_0x157fb6(_0x405730);});});}function _0x7d7b02(_0x56b4bb,_0x21e010,_0x550252){if(!_0x21e010)return Promise[_0x3864('0xd')](null);return new Promise(function(_0x12a135,_0xfc4308){return _0x9f6073['UserProfileResource']['findAll']({'where':{'sectionId':_0x21e010['id']},'raw':!![]})['then'](function(_0x5e95b1){if(_0x56b4bb[_0x3864('0x9')]&&_0x56b4bb['field']!=='id'){_0x21e010[_0x3864('0x6')]=_['map'](_0x5e95b1,function(_0x9e0f36){return _0x9e0f36[_0x56b4bb[_0x3864('0x9')]];});}else{if(_0x550252==='AnalyticExtractedReport'){_0x21e010['associatedResources']=_['map'](_0x5e95b1,function(_0x4a8913){return{'id':_0x4a8913[_0x3864('0xe')],'type':_0x4a8913[_0x3864('0xf')]};});}else{_0x21e010['associatedResources']=_[_0x3864('0x7')](_0x5e95b1,function(_0x2a4ae9){return _0x2a4ae9[_0x3864('0xe')];});}}_0x12a135(_0x21e010);})[_0x3864('0x8')](function(_0x5ef76f){_0xfc4308(_0x5ef76f);});});}function _0x15d80b(_0x49c249,_0x508a6e){var _0x29ec74={'parentSections':[]};switch(_0x49c249[_0x3864('0x10')]()){case _0x3864('0x11'):_0x29ec74['childModel']=_0x3864('0x12');break;case'odbc':_0x29ec74[_0x3864('0x13')]=_0x3864('0x14');break;case _0x3864('0x15'):_0x29ec74['childModel']=_0x3864('0x16');_0x29ec74['parentSections']=[{'name':_0x3864('0x17'),'field':_0x3864('0xc'),'foreignKey':_0x3864('0x18')}];break;case'projects':_0x29ec74['childModel']=_0x3864('0x19');break;case _0x3864('0x1a'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x1b');_0x29ec74[_0x3864('0x1c')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x3864('0x1d'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x1e');break;case _0x3864('0x1f'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x20');break;case _0x3864('0x21'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x22');break;case _0x3864('0x23'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x24');break;case _0x3864('0x25'):_0x29ec74['childModel']=_0x3864('0x26');break;case _0x3864('0x27'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x28');break;case _0x3864('0x29'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x2a');break;case _0x3864('0x2b'):case'internalroutes':case _0x3864('0x2c'):_0x29ec74['childModel']=_0x3864('0x2d');break;case'contexts':_0x29ec74[_0x3864('0x13')]=_0x3864('0x2e');break;case _0x3864('0x2f'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x30');break;case _0x3864('0x31'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x32');_0x29ec74['parentSections']=[{'name':'Agents','field':_0x3864('0xc'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x3864('0x33')]}},{'name':'Telephones','field':_0x3864('0xc'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x3864('0x34')]}},{'name':_0x3864('0x35'),'field':'name','foreignKey':_0x3864('0x36'),'model':_0x3864('0x37'),'filter':{'field':_0x3864('0xf'),'value':['inbound']}},{'name':_0x3864('0x38'),'field':_0x3864('0xc'),'foreignKey':_0x3864('0x36'),'model':_0x3864('0x37'),'filter':{'field':_0x3864('0xf'),'value':[_0x3864('0x39')]}}];break;case _0x3864('0x3a'):_0x29ec74['childModel']=_0x3864('0x3b');break;case _0x3864('0x3c'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x3d');break;case _0x3864('0x3e'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x3f');break;case'ivrcampaigns':_0x29ec74[_0x3864('0x13')]=_0x3864('0x40');break;case'mailqueues':_0x29ec74['childModel']=_0x3864('0x41');break;case'mailaccounts':_0x29ec74[_0x3864('0x13')]=_0x3864('0x42');break;case _0x3864('0x43'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x44');break;case _0x3864('0x45'):_0x29ec74['childModel']='OpenchannelQueue';break;case _0x3864('0x46'):_0x29ec74[_0x3864('0x13')]='OpenchannelAccount';break;case _0x3864('0x47'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x48');break;case _0x3864('0x49'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x4a');break;case _0x3864('0x4b'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x4c');break;case _0x3864('0x4d'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x4e');break;case _0x3864('0x4f'):_0x29ec74['childModel']='Team';break;case _0x3864('0x50'):case _0x3864('0x51'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x37');if(_0x508a6e){_0x29ec74['parentSections']=[{'name':_0x3864('0x35')},{'name':_0x3864('0x38')}];}break;case _0x3864('0x52'):case'agents':case _0x3864('0x53'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x54');if(_0x508a6e){_0x29ec74[_0x3864('0x1c')]=[{'name':_0x3864('0x55'),'filter':{'field':_0x3864('0x56'),'value':[_0x3864('0x57'),_0x3864('0x58')]},'ignore':!![]},{'name':_0x3864('0x59')},{'name':_0x3864('0x5a')}];}break;case _0x3864('0x5b'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x5c');break;case _0x3864('0x5d'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x5e');break;case _0x3864('0x5f'):_0x29ec74[_0x3864('0x13')]='FreshdeskAccount';break;case _0x3864('0x60'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x61');break;case _0x3864('0x62'):_0x29ec74['childModel']=_0x3864('0x63');break;case _0x3864('0x64'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x65');break;case _0x3864('0x66'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x54');break;case _0x3864('0x67'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x68');break;case _0x3864('0x69'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x6a');break;case'customdashboards':_0x29ec74[_0x3864('0x13')]=_0x3864('0x6b');break;case _0x3864('0x6c'):_0x29ec74[_0x3864('0x13')]='Interval';break;case _0x3864('0x6d'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x6e');break;case _0x3864('0x6f'):_0x29ec74['childModel']='Schedule';break;case _0x3864('0x70'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x71');break;case _0x3864('0x72'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x73');break;case _0x3864('0x74'):_0x29ec74['childModel']=_0x3864('0x75');break;case _0x3864('0x76'):_0x29ec74['childModel']=_0x3864('0x77');break;case _0x3864('0x78'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x79');break;case _0x3864('0x7a'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x7b');break;case'plugins':_0x29ec74[_0x3864('0x13')]=_0x3864('0x7c');break;case _0x3864('0x7d'):_0x29ec74[_0x3864('0x13')]='AnalyticExtractedReport';_0x29ec74[_0x3864('0x1c')]=[{'name':_0x3864('0x7e'),'field':'id','foreignKey':_0x3864('0x7f')}];break;case _0x3864('0x80'):_0x29ec74[_0x3864('0x13')]=_0x3864('0x81');break;}return _0x29ec74;}function _0x86c383(_0x58ac22,_0x343817){var _0x996152=_0x58ac22[_0x3864('0x82')](0x0)[_0x3864('0x83')]()+_0x58ac22[_0x3864('0x84')](0x1);var _0x377059={'type':_0x9f6073[_0x3864('0x85')][_0x3864('0x86')][_0x3864('0x87')],'raw':!![]};return new Promise(function(_0x1a6aff,_0x59b3d0){var _0x3610c8=squel[_0x3864('0x88')]()[_0x3864('0x9')](_0x3864('0x89')+_0x996152+'InteractionId','id')[_0x3864('0x9')](_0x3864('0x8a'))[_0x3864('0x8b')](_0x3864('0x8c')+_0x58ac22+_0x3864('0x8d'),'ui')['where'](_0x3864('0x8e'),_0x343817['id']);return _0x9f6073[_0x3864('0x8f')][_0x3864('0x90')](_0x3610c8[_0x3864('0x91')](),_0x377059)[_0x3864('0x5')](function(_0x370d75){_0x343817[_0x996152+_0x3864('0x92')]=_0x370d75;_0x1a6aff(_0x370d75);})['catch'](function(_0x298310){_0x59b3d0(_0x298310);});});}return _0x2ccd83[_0x3864('0x93')](_0x3864('0x94'),attributes,{'tableName':_0x3864('0x95'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5d5366){var _0x3f83aa={'raw':_0x5d5366[_0x3864('0x90')][_0x3864('0x96')],'where':{}};var _0x18cfd7={};var _0x25367a={'count':0x0,'rows':[]};var _0x280975=_0x5d5366['query'][_0x3864('0x97')];var _0x2708c3=_0x5d5366[_0x3864('0x90')][_0x3864('0x98')]||![];var _0x49ff91=_0x15d80b(_0x280975,_0x2708c3);if(!_0x49ff91[_0x3864('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x280975+'\x27');var _0x2f4f2e=[{'name':_0x280975}];if(!_[_0x3864('0x99')](_0x49ff91[_0x3864('0x1c')]))_0x2f4f2e=_0x49ff91[_0x3864('0x1c')];var _0x1f5a78=[];for(var _0x494347=0x0;_0x494347<_0x2f4f2e[_0x3864('0x9a')];_0x494347++){_0x1f5a78['push'](_0x9f6073[_0x3864('0x9b')]['find']({'where':{'userProfileId':_0x5d5366['params']['id'],'name':_0x2f4f2e[_0x494347][_0x3864('0xc')]},'raw':!![]}));}return Promise[_0x3864('0x9c')](_0x1f5a78)[_0x3864('0x5')](function(_0x33b199){var _0x4beeeb=_[_0x3864('0x3')](_0x33b199,function(_0x5df73d){return _0x5df73d?_0x5df73d:undefined;});var _0xff1bf8=_['filter'](_0x2f4f2e,['ignore',!![]]);var _0x494c61=_[_0x3864('0x99')](_0x4beeeb)&&_[_0x3864('0x99')](_0xff1bf8)?null:_[_0x3864('0x9d')](_0xff1bf8,_0x4beeeb);if(!_0x494c61)return null;var _0x3a7f8b=[];for(var _0xe1a298=0x0;_0xe1a298<_0x494c61['length'];_0xe1a298++){var _0x39a41b=_[_0x3864('0x9e')](_0x2f4f2e,function(_0x513518){return _0x494c61[_0xe1a298]?_0x513518[_0x3864('0xc')]===_0x494c61[_0xe1a298][_0x3864('0xc')]:null;});if(_0x39a41b){if(_0x494c61[_0xe1a298][_0x3864('0x9f')]){_0x3a7f8b[_0x3864('0xa0')](_0x545b47(_0x49ff91['childModel'],_0x494c61[_0xe1a298]));}else{if(!_0x494c61[_0xe1a298]['autoAssociation']){_0x3a7f8b[_0x3864('0xa0')](_0x7d7b02(_0x39a41b,_0x494c61[_0xe1a298],_0x49ff91[_0x3864('0x13')]));}else{if(_0x39a41b['model']){_0x3a7f8b[_0x3864('0xa0')](_0x36fcf3(_0x39a41b,_0x494c61[_0xe1a298]));}}}}}return Promise[_0x3864('0x9c')](_0x3a7f8b);})['then'](function(_0x7e4072){var _0x4baac9=_0x7e4072;var _0x353133=null;if(_0x4baac9){_0x353133=_0x4baac9[_0x3864('0x9a')]===0x1?_0x4baac9[0x0]:null;}if(!_0x353133&&!_0x4baac9)return _0x25367a;var _0xfa67d6=_0x9f6073[_0x49ff91[_0x3864('0x13')]][_0x3864('0xa1')];_0x18cfd7[_0x3864('0xa')]=_['keys'](_0xfa67d6);_0x18cfd7[_0x3864('0x90')]=_[_0x3864('0xa2')](_0x5d5366[_0x3864('0x90')]);_0x18cfd7[_0x3864('0xa3')]=_['intersection'](_0x18cfd7[_0x3864('0xa')],_0x18cfd7[_0x3864('0x90')]);_0x3f83aa[_0x3864('0xa4')]=_[_0x3864('0xa5')](_0x18cfd7[_0x3864('0xa')],qs[_0x3864('0xa6')](_0x5d5366['query'][_0x3864('0xa6')]));_0x3f83aa['attributes']=_0x3f83aa[_0x3864('0xa4')]['length']?_0x3f83aa['attributes']:_0x18cfd7['model'];if(!_0x5d5366['query'][_0x3864('0xa7')]('nolimit')){_0x3f83aa[_0x3864('0xa8')]=qs[_0x3864('0xa8')](_0x5d5366[_0x3864('0x90')]['limit']);_0x3f83aa[_0x3864('0xa9')]=qs[_0x3864('0xa9')](_0x5d5366[_0x3864('0x90')][_0x3864('0xa9')]);}_0x3f83aa['order']=qs[_0x3864('0xaa')](_0x5d5366[_0x3864('0x90')]['sort']);_0x3f83aa[_0x3864('0xab')]=qs[_0x3864('0xa3')](_[_0x3864('0xac')](_0x5d5366[_0x3864('0x90')],_0x18cfd7[_0x3864('0xa3')]));if(_0x5d5366['query'][_0x3864('0x3')]){_0x3f83aa[_0x3864('0xab')]=_[_0x3864('0xad')](_0x3f83aa[_0x3864('0xab')],{'$or':_[_0x3864('0x7')](_0xfa67d6,function(_0x18e861){if(_0x18e861[_0x3864('0xf')][_0x3864('0xae')]!==_0x3864('0xaf')){var _0x21c81a={};_0x21c81a[_0x18e861['field']]={'$like':'%'+_0x5d5366[_0x3864('0x90')][_0x3864('0x3')]+'%'};return _0x21c81a;}})});}var _0x51d66a=[];var _0x1b6f30=null;var _0x4dd396={};if(_0x353133){_0x1b6f30=_[_0x3864('0x9e')](_0x2f4f2e,[_0x3864('0xc'),_0x353133[_0x3864('0xc')]]);if(_0x1b6f30['field']){_0x4dd396={};if(_0x49ff91['childModel']===_0x3864('0xb0')){_0x4dd396[_0x1b6f30['foreignKey']]=_[_0x3864('0x7')](_0x353133[_0x3864('0x6')],'id');}else{_0x4dd396[_0x1b6f30['foreignKey']]=_0x353133[_0x3864('0x6')];}_0x51d66a[_0x3864('0xa0')](_0x4dd396);}else{_0x3f83aa[_0x3864('0xab')]['id']=_0x353133[_0x3864('0x6')];}}else{for(var _0x1c3dd5=0x0;_0x1c3dd5<_0x4baac9['length'];_0x1c3dd5++){_0x1b6f30=_[_0x3864('0x9e')](_0x2f4f2e,['name',_0x4baac9[_0x1c3dd5][_0x3864('0xc')]]);if(_0x1b6f30[_0x3864('0x9')]){_0x4dd396={};_0x4dd396[_0x1b6f30[_0x3864('0xb1')]]=_0x4baac9[_0x1c3dd5][_0x3864('0x6')];_0x51d66a['push'](_0x4dd396);}else{if(!_0x3f83aa[_0x3864('0xab')]['id'])_0x3f83aa['where']['id']=[];_0x4baac9[_0x1c3dd5][_0x3864('0x6')]['forEach'](function(_0x371183){_0x3f83aa[_0x3864('0xab')]['id'][_0x3864('0xa0')](_0x371183);});}}}if(!_[_0x3864('0x99')](_0x51d66a)){_0x3f83aa['where']=_[_0x3864('0xad')](_0x3f83aa[_0x3864('0xab')],{'$and':{'$or':_0x51d66a}});}_0x3f83aa=_[_0x3864('0xad')]({},_0x3f83aa,_0x5d5366[_0x3864('0xb2')]);if(_0x353133&&!_0x353133[_0x3864('0xb3')]&&_0x49ff91[_0x3864('0x13')]===_0x3864('0xb0')){if(_0x5d5366[_0x3864('0x90')]['includeAll']){_0x3f83aa[_0x3864('0xb4')]=[{'all':!![]}];}return _0x9f6073[_0x49ff91['childModel']][_0x3864('0xb')](_0x3f83aa)[_0x3864('0x5')](function(_0x4f0e3f){var _0x47fb89=[];_0x4f0e3f[_0x3864('0xb5')](function(_0x56950a){var _0x1671ff;switch(_0x56950a[_0x3864('0xb6')]){case _0x3864('0xb7'):_0x1671ff=_['find'](_0x353133['associatedResources'],function(_0x12573f){return _0x12573f['id']===_0x56950a[_0x3864('0x7f')]&&_0x12573f[_0x3864('0xf')]===_0x3864('0xb8');});break;case'custom':_0x1671ff=_[_0x3864('0x9e')](_0x353133[_0x3864('0x6')],function(_0x4581fe){return _0x4581fe['id']===_0x56950a['reportId']&&_0x4581fe[_0x3864('0xf')]===_0x3864('0xb9');});break;}if(_0x1671ff)_0x47fb89[_0x3864('0xa0')](_0x56950a);});_0x25367a[_0x3864('0xba')]=_0x47fb89[_0x3864('0x9a')];_0x25367a[_0x3864('0xbb')]=_0x47fb89;return _0x25367a;});}else{return _0x9f6073[_0x49ff91[_0x3864('0x13')]][_0x3864('0xba')]({'where':_0x3f83aa[_0x3864('0xab')]})[_0x3864('0x5')](function(_0x4d3d2e){_0x25367a[_0x3864('0xba')]=_0x4d3d2e;if(_0x5d5366['query'][_0x3864('0xbc')]){if(_0x49ff91[_0x3864('0x13')]===_0x3864('0x1b')){_0x3f83aa['include']=[{'model':_0x9f6073[_0x3864('0x73')],'as':_0x3864('0xbd'),'attributes':['id',_0x3864('0xc'),_0x3864('0xbe')],'required':_0x5d5366['query'][_0x3864('0xbf')]?!![]:![]},{'model':_0x9f6073['Tag'],'as':'ThroughTags','attributes':['id','name',_0x3864('0xbe')],'through':_0x5d5366[_0x3864('0x90')][_0x3864('0xbf')]?{'attributes':[],'where':{'TagId':_0x5d5366[_0x3864('0x90')][_0x3864('0xbf')]||undefined}}:{},'required':_0x5d5366[_0x3864('0x90')]['tag']?!![]:![]}];}else{_0x3f83aa['include']=[{'all':!![]}];}}return _0x9f6073[_0x49ff91[_0x3864('0x13')]][_0x3864('0xb')](_0x3f83aa);})[_0x3864('0x5')](function(_0x6f9306){_0x25367a[_0x3864('0xbb')]=_0x6f9306;if(_0x280975===_0x3864('0x59')&&_0x5d5366['query'][_0x3864('0xc0')]==='true'){var _0x39b4a0=[];for(var _0x33bdf9=0x0;_0x33bdf9<_0x25367a[_0x3864('0xbb')][_0x3864('0x9a')];_0x33bdf9++){_0x39b4a0[_0x3864('0xa0')](_0x86c383(_0x3864('0xc1'),_0x25367a[_0x3864('0xbb')][_0x33bdf9]['dataValues']));_0x39b4a0[_0x3864('0xa0')](_0x86c383(_0x3864('0xc2'),_0x25367a[_0x3864('0xbb')][_0x33bdf9][_0x3864('0xc3')]));_0x39b4a0[_0x3864('0xa0')](_0x86c383(_0x3864('0xc4'),_0x25367a['rows'][_0x33bdf9][_0x3864('0xc3')]));_0x39b4a0[_0x3864('0xa0')](_0x86c383(_0x3864('0xc5'),_0x25367a[_0x3864('0xbb')][_0x33bdf9]['dataValues']));_0x39b4a0['push'](_0x86c383('openchannel',_0x25367a[_0x3864('0xbb')][_0x33bdf9][_0x3864('0xc3')]));_0x39b4a0['push'](_0x86c383(_0x3864('0xc6'),_0x25367a[_0x3864('0xbb')][_0x33bdf9][_0x3864('0xc3')]));}return Promise[_0x3864('0x9c')](_0x39b4a0)[_0x3864('0x5')](function(){return _0x25367a;});}return _0x25367a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2d04514..2c5fa9f 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 _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x77d4,0x108));var _0x477d=function(_0x24d560,_0x2e0e7b){_0x24d560=_0x24d560-0x0;var _0x18f7b3=_0x77d4[_0x24d560];return _0x18f7b3;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});config[_0x477d('0x9')]=_['defaults'](config['redis'],{'host':_0x477d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x477d('0xb'))[_0x477d('0xc')](socket);function respondWithRpcPromise(_0x204cb9,_0x2c326c,_0x1cef1c){return new BPromise(function(_0x58ff29,_0x932cc9){return client['request'](_0x204cb9,_0x1cef1c)[_0x477d('0xd')](function(_0x462ac1){logger['info'](_0x477d('0xe'),_0x2c326c,_0x477d('0xf'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x2c326c,_0x477d('0xf'),JSON[_0x477d('0x10')](_0x462ac1));if(_0x462ac1['error']){if(_0x462ac1[_0x477d('0x11')][_0x477d('0x12')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x2c326c,_0x462ac1[_0x477d('0x11')]['message']);return _0x932cc9(_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);}logger[_0x477d('0x11')]('UserProfile,\x20%s,\x20%s',_0x2c326c,_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);return _0x58ff29(_0x462ac1[_0x477d('0x11')][_0x477d('0x13')]);}else{logger['info'](_0x477d('0xe'),_0x2c326c,'request\x20sent');_0x58ff29(_0x462ac1[_0x477d('0x14')][_0x477d('0x13')]);}})[_0x477d('0x15')](function(_0x458489){logger[_0x477d('0x11')](_0x477d('0xe'),_0x2c326c,_0x458489);_0x932cc9(_0x458489);});});} \ No newline at end of file +var _0x63d4=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63d4,0x117));var _0x463d=function(_0x1389a4,_0x2203a8){_0x1389a4=_0x1389a4-0x0;var _0x17dd9c=_0x63d4[_0x1389a4];return _0x17dd9c;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var moment=require(_0x463d('0x2'));var BPromise=require('bluebird');var rs=require(_0x463d('0x3'));var fs=require('fs');var Redis=require(_0x463d('0x4'));var db=require(_0x463d('0x5'))['db'];var utils=require(_0x463d('0x6'));var logger=require(_0x463d('0x7'))('rpc');var config=require(_0x463d('0x8'));var jayson=require(_0x463d('0x9'));var client=jayson['client'][_0x463d('0xa')]({'port':0x232a});config[_0x463d('0xb')]=_[_0x463d('0xc')](config[_0x463d('0xb')],{'host':_0x463d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463d('0xb')]));require('./userProfile.socket')[_0x463d('0xe')](socket);function respondWithRpcPromise(_0x2d714b,_0x1f5d4a,_0xecad46){return new BPromise(function(_0x4c7bcc,_0x4c7afd){return client[_0x463d('0xf')](_0x2d714b,_0xecad46)['then'](function(_0x39d97c){logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));logger[_0x463d('0x13')](_0x463d('0x14'),_0x1f5d4a,_0x463d('0x12'),JSON['stringify'](_0x39d97c));if(_0x39d97c[_0x463d('0x15')]){if(_0x39d97c[_0x463d('0x15')][_0x463d('0x16')]===0x1f4){logger['error'](_0x463d('0x11'),_0x1f5d4a,_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);return _0x4c7afd(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}logger[_0x463d('0x15')]('UserProfile,\x20%s,\x20%s',_0x1f5d4a,_0x39d97c[_0x463d('0x15')]['message']);return _0x4c7bcc(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}else{logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));_0x4c7bcc(_0x39d97c[_0x463d('0x18')]['message']);}})[_0x463d('0x19')](function(_0x1091ac){logger[_0x463d('0x15')](_0x463d('0x11'),_0x1f5d4a,_0x1091ac);_0x4c7afd(_0x1091ac);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d7d3fca..ef9c507 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 _0x7d5a=['length','userProfile:','./userProfile.events','remove','update','emit','removeListener','register'];(function(_0x5d9cb6,_0x2b03a1){var _0x579e4e=function(_0x4f5771){while(--_0x4f5771){_0x5d9cb6['push'](_0x5d9cb6['shift']());}};_0x579e4e(++_0x2b03a1);}(_0x7d5a,0x14a));var _0xa7d5=function(_0x100b7,_0x595657){_0x100b7=_0x100b7-0x0;var _0x3e5d5c=_0x7d5a[_0x100b7];return _0x3e5d5c;};'use strict';var UserProfileEvents=require(_0xa7d5('0x0'));var events=['save',_0xa7d5('0x1'),_0xa7d5('0x2')];function createListener(_0x2c8174,_0x36f9c5){return function(_0x1379e3){_0x36f9c5[_0xa7d5('0x3')](_0x2c8174,_0x1379e3);};}function removeListener(_0x5c44b3,_0x4483b7){return function(){UserProfileEvents[_0xa7d5('0x4')](_0x5c44b3,_0x4483b7);};}exports[_0xa7d5('0x5')]=function(_0x411577){for(var _0x4ae8b3=0x0,_0x17a7fc=events[_0xa7d5('0x6')];_0x4ae8b3<_0x17a7fc;_0x4ae8b3++){var _0x59fdf8=events[_0x4ae8b3];var _0x4fcfba=createListener(_0xa7d5('0x7')+_0x59fdf8,_0x411577);UserProfileEvents['on'](_0x59fdf8,_0x4fcfba);}}; \ No newline at end of file +var _0x7fdd=['length','save','remove','update','emit','removeListener','register'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0x7fdd,0xcc));var _0xd7fd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7fdd[_0x20a584];return _0x4b41a8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xd7fd('0x0'),_0xd7fd('0x1'),_0xd7fd('0x2')];function createListener(_0x5f250b,_0x48a013){return function(_0x3defed){_0x48a013[_0xd7fd('0x3')](_0x5f250b,_0x3defed);};}function removeListener(_0x303560,_0xdb51f2){return function(){UserProfileEvents[_0xd7fd('0x4')](_0x303560,_0xdb51f2);};}exports[_0xd7fd('0x5')]=function(_0x52772d){for(var _0x56a1d0=0x0,_0x558774=events[_0xd7fd('0x6')];_0x56a1d0<_0x558774;_0x56a1d0++){var _0x1d70b2=events[_0x56a1d0];var _0x2f3356=createListener('userProfile:'+_0x1d70b2,_0x52772d);UserProfileEvents['on'](_0x1d70b2,_0x2f3356);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 00e96f2..2c227eb 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 _0x6d96=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x8c510d,_0x42f46f){var _0x120eb8=function(_0x108b59){while(--_0x108b59){_0x8c510d['push'](_0x8c510d['shift']());}};_0x120eb8(++_0x42f46f);}(_0x6d96,0x13c));var _0x66d9=function(_0x4c2bdc,_0x5915d7){_0x4c2bdc=_0x4c2bdc-0x0;var _0x5a3222=_0x6d96[_0x4c2bdc];return _0x5a3222;};'use strict';var multer=require(_0x66d9('0x0'));var util=require(_0x66d9('0x1'));var path=require(_0x66d9('0x2'));var timeout=require(_0x66d9('0x3'));var express=require(_0x66d9('0x4'));var router=express[_0x66d9('0x5')]();var fs_extra=require(_0x66d9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x66d9('0x7'));var config=require(_0x66d9('0x8'));var controller=require(_0x66d9('0x9'));router[_0x66d9('0xa')]('/',auth[_0x66d9('0xb')](),controller[_0x66d9('0xc')]);router[_0x66d9('0xa')](_0x66d9('0xd'),auth['isAuthenticated'](),controller[_0x66d9('0xe')]);router[_0x66d9('0xa')](_0x66d9('0xf'),auth[_0x66d9('0xb')](),controller[_0x66d9('0x10')]);router['post']('/',auth[_0x66d9('0xb')](),controller['create']);router[_0x66d9('0x11')](_0x66d9('0xf'),auth['isAuthenticated'](),controller[_0x66d9('0x12')]);router[_0x66d9('0x13')](_0x66d9('0xf'),auth[_0x66d9('0xb')](),controller[_0x66d9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa0d6=['post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe'];(function(_0x8e7403,_0x53cd1f){var _0x3c35b4=function(_0x410efd){while(--_0x410efd){_0x8e7403['push'](_0x8e7403['shift']());}};_0x3c35b4(++_0x53cd1f);}(_0xa0d6,0xba));var _0x6a0d=function(_0x291aa8,_0x4a812f){_0x291aa8=_0x291aa8-0x0;var _0x4e9b2e=_0xa0d6[_0x291aa8];return _0x4e9b2e;};'use strict';var multer=require(_0x6a0d('0x0'));var util=require('util');var path=require(_0x6a0d('0x1'));var timeout=require(_0x6a0d('0x2'));var express=require(_0x6a0d('0x3'));var router=express[_0x6a0d('0x4')]();var fs_extra=require(_0x6a0d('0x5'));var auth=require(_0x6a0d('0x6'));var interaction=require(_0x6a0d('0x7'));var config=require(_0x6a0d('0x8'));var controller=require(_0x6a0d('0x9'));router[_0x6a0d('0xa')]('/',auth[_0x6a0d('0xb')](),controller['index']);router['get'](_0x6a0d('0xc'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0xd')]);router['get']('/:id',auth[_0x6a0d('0xb')](),controller['show']);router[_0x6a0d('0xe')]('/',auth[_0x6a0d('0xb')](),controller['create']);router[_0x6a0d('0xf')](_0x6a0d('0x10'),auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x11')]);router['delete']('/:id',auth[_0x6a0d('0xb')](),controller[_0x6a0d('0x12')]);module[_0x6a0d('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 42419ff..517fee2 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 _0x560e=['STRING','sequelize','INTEGER'];(function(_0x2653a7,_0x4a61bf){var _0x1fd413=function(_0x5d95db){while(--_0x5d95db){_0x2653a7['push'](_0x2653a7['shift']());}};_0x1fd413(++_0x4a61bf);}(_0x560e,0xf4));var _0xe560=function(_0xc8da78,_0x3e3967){_0xc8da78=_0xc8da78-0x0;var _0x406374=_0x560e[_0xc8da78];return _0x406374;};'use strict';var Sequelize=require(_0xe560('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe560('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe560('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x02ae=['INTEGER','sequelize','exports','STRING'];(function(_0x25e625,_0x2a97e2){var _0x3312cb=function(_0x3294e8){while(--_0x3294e8){_0x25e625['push'](_0x25e625['shift']());}};_0x3312cb(++_0x2a97e2);}(_0x02ae,0x125));var _0xe02a=function(_0x5ed43d,_0x1571df){_0x5ed43d=_0x5ed43d-0x0;var _0x16d98e=_0x02ae[_0x5ed43d];return _0x16d98e;};'use strict';var Sequelize=require(_0xe02a('0x0'));module[_0xe02a('0x1')]={'name':{'type':Sequelize[_0xe02a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe02a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe02a('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 8e024f9..64f3ed6 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x540172,_0x130547){var _0x77d499=function(_0x573e54){while(--_0x573e54){_0x540172['push'](_0x540172['shift']());}};_0x77d499(++_0x130547);}(_0xafc4,0x69));var _0x4afc=function(_0x671313,_0x7f3337){_0x671313=_0x671313-0x0;var _0x466abe=_0xafc4[_0x671313];return _0x466abe;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 140e368..25248f2 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 _0x5906=['rimraf','../../config/environment','define','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x48c10c,_0x2cd4a2){var _0x2a3540=function(_0x3dcfb6){while(--_0x3dcfb6){_0x48c10c['push'](_0x48c10c['shift']());}};_0x2a3540(++_0x2cd4a2);}(_0x5906,0x131));var _0x6590=function(_0x334f64,_0x1e0b74){_0x334f64=_0x334f64-0x0;var _0x2de374=_0x5906[_0x334f64];return _0x2de374;};'use strict';var _=require(_0x6590('0x0'));var util=require(_0x6590('0x1'));var logger=require(_0x6590('0x2'))(_0x6590('0x3'));var moment=require('moment');var BPromise=require(_0x6590('0x4'));var rp=require(_0x6590('0x5'));var fs=require('fs');var path=require(_0x6590('0x6'));var rimraf=require(_0x6590('0x7'));var config=require(_0x6590('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x54c01a,_0x433bf6){return _0x54c01a[_0x6590('0x9')]('UserProfileResource',attributes,{'tableName':_0x6590('0xa'),'paranoid':![],'indexes':[{'name':_0x6590('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c51=['api','request-promise','path','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId','util','../../config/logger'];(function(_0x3086e1,_0x5886a0){var _0x4a23c6=function(_0x31f8d8){while(--_0x31f8d8){_0x3086e1['push'](_0x3086e1['shift']());}};_0x4a23c6(++_0x5886a0);}(_0x4c51,0x174));var _0x14c5=function(_0x14d4cc,_0x483cbf){_0x14d4cc=_0x14d4cc-0x0;var _0x412510=_0x4c51[_0x14d4cc];return _0x412510;};'use strict';var _=require('lodash');var util=require(_0x14c5('0x0'));var logger=require(_0x14c5('0x1'))(_0x14c5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14c5('0x3'));var fs=require('fs');var path=require(_0x14c5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14c5('0x5'));module[_0x14c5('0x6')]=function(_0x11c85f,_0x1e968a){return _0x11c85f[_0x14c5('0x7')]('UserProfileResource',attributes,{'tableName':_0x14c5('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x14c5('0x9'),_0x14c5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 4641097..e41105e 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 _0x63db=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1442a8,_0x58496c){var _0x4cad6b=function(_0x34a34a){while(--_0x34a34a){_0x1442a8['push'](_0x1442a8['shift']());}};_0x4cad6b(++_0x58496c);}(_0x63db,0x117));var _0xb63d=function(_0x788c70,_0x5120fd){_0x788c70=_0x788c70-0x0;var _0x361503=_0x63db[_0x788c70];return _0x361503;};'use strict';var _=require('lodash');var util=require(_0xb63d('0x0'));var moment=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var rs=require(_0xb63d('0x3'));var fs=require('fs');var Redis=require(_0xb63d('0x4'));var db=require(_0xb63d('0x5'))['db'];var utils=require(_0xb63d('0x6'));var logger=require(_0xb63d('0x7'))(_0xb63d('0x8'));var config=require(_0xb63d('0x9'));var jayson=require(_0xb63d('0xa'));var client=jayson[_0xb63d('0xb')][_0xb63d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x198bd7,_0x3290a5,_0x195ee0){return new BPromise(function(_0x5cf650,_0x4062ff){return client[_0xb63d('0xd')](_0x198bd7,_0x195ee0)[_0xb63d('0xe')](function(_0x88f21){logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,_0xb63d('0x11'));logger[_0xb63d('0x12')](_0xb63d('0x13'),_0x3290a5,_0xb63d('0x11'),JSON[_0xb63d('0x14')](_0x88f21));if(_0x88f21[_0xb63d('0x15')]){if(_0x88f21[_0xb63d('0x15')][_0xb63d('0x16')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x3290a5,_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);return _0x4062ff(_0x88f21['error'][_0xb63d('0x17')]);}logger[_0xb63d('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x3290a5,_0x88f21['error'][_0xb63d('0x17')]);return _0x5cf650(_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);}else{logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,'request\x20sent');_0x5cf650(_0x88f21[_0xb63d('0x18')][_0xb63d('0x17')]);}})[_0xb63d('0x19')](function(_0x5904c8){logger[_0xb63d('0x15')](_0xb63d('0x10'),_0x3290a5,_0x5904c8);_0x4062ff(_0x5904c8);});});} \ No newline at end of file +var _0x0243=['info','request\x20sent','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x0243,0xa2));var _0x3024=function(_0x47836,_0x3d7cd4){_0x47836=_0x47836-0x0;var _0xda7c63=_0x0243[_0x47836];return _0xda7c63;};'use strict';var _=require(_0x3024('0x0'));var util=require(_0x3024('0x1'));var moment=require(_0x3024('0x2'));var BPromise=require(_0x3024('0x3'));var rs=require(_0x3024('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3024('0x5'));var logger=require('../../config/logger')(_0x3024('0x6'));var config=require(_0x3024('0x7'));var jayson=require(_0x3024('0x8'));var client=jayson[_0x3024('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe84561,_0x3f36a5,_0x2919c7){return new BPromise(function(_0x5eee30,_0x78f476){return client[_0x3024('0xa')](_0xe84561,_0x2919c7)[_0x3024('0xb')](function(_0x209d5b){logger['info'](_0x3024('0xc'),_0x3f36a5,'request\x20sent');logger[_0x3024('0xd')](_0x3024('0xe'),_0x3f36a5,'request\x20sent',JSON[_0x3024('0xf')](_0x209d5b));if(_0x209d5b['error']){if(_0x209d5b[_0x3024('0x10')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x3f36a5,_0x209d5b['error'][_0x3024('0x11')]);return _0x78f476(_0x209d5b[_0x3024('0x10')][_0x3024('0x11')]);}logger[_0x3024('0x10')](_0x3024('0xc'),_0x3f36a5,_0x209d5b[_0x3024('0x10')]['message']);return _0x5eee30(_0x209d5b[_0x3024('0x10')][_0x3024('0x11')]);}else{logger[_0x3024('0x12')](_0x3024('0xc'),_0x3f36a5,_0x3024('0x13'));_0x5eee30(_0x209d5b['result'][_0x3024('0x11')]);}})['catch'](function(_0xf97b45){logger[_0x3024('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x3f36a5,_0xf97b45);_0x78f476(_0xf97b45);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bfe1b84..23ed38a 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 _0x767e=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x5f4895,_0x27fb35){var _0x19c216=function(_0x122b7d){while(--_0x122b7d){_0x5f4895['push'](_0x5f4895['shift']());}};_0x19c216(++_0x27fb35);}(_0x767e,0xdf));var _0xe767=function(_0x291352,_0x2dc03f){_0x291352=_0x291352-0x0;var _0x503856=_0x767e[_0x291352];return _0x503856;};'use strict';var multer=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var path=require(_0xe767('0x2'));var timeout=require(_0xe767('0x3'));var express=require(_0xe767('0x4'));var router=express[_0xe767('0x5')]();var fs_extra=require(_0xe767('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe767('0x7'));router[_0xe767('0x8')]('/',auth[_0xe767('0x9')](),controller[_0xe767('0xa')]);router[_0xe767('0x8')](_0xe767('0xb'),auth['isAuthenticated'](),controller[_0xe767('0xc')]);router[_0xe767('0x8')](_0xe767('0xd'),auth[_0xe767('0x9')](),controller[_0xe767('0xe')]);router[_0xe767('0xf')]('/',auth[_0xe767('0x9')](),controller[_0xe767('0x10')]);router[_0xe767('0x11')]('/:id',auth[_0xe767('0x9')](),controller['update']);router['delete'](_0xe767('0xd'),auth[_0xe767('0x9')](),controller[_0xe767('0x12')]);module[_0xe767('0x13')]=router; \ No newline at end of file +var _0x5c65=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1ed9f5,_0x2e7891){var _0x367397=function(_0x2190fb){while(--_0x2190fb){_0x1ed9f5['push'](_0x1ed9f5['shift']());}};_0x367397(++_0x2e7891);}(_0x5c65,0xa1));var _0x55c6=function(_0x402df6,_0x4d783c){_0x402df6=_0x402df6-0x0;var _0xccadb6=_0x5c65[_0x402df6];return _0xccadb6;};'use strict';var multer=require(_0x55c6('0x0'));var util=require(_0x55c6('0x1'));var path=require(_0x55c6('0x2'));var timeout=require(_0x55c6('0x3'));var express=require(_0x55c6('0x4'));var router=express['Router']();var fs_extra=require(_0x55c6('0x5'));var auth=require(_0x55c6('0x6'));var interaction=require(_0x55c6('0x7'));var config=require(_0x55c6('0x8'));var controller=require(_0x55c6('0x9'));router['get']('/',auth[_0x55c6('0xa')](),controller[_0x55c6('0xb')]);router[_0x55c6('0xc')]('/describe',auth[_0x55c6('0xa')](),controller[_0x55c6('0xd')]);router[_0x55c6('0xc')](_0x55c6('0xe'),auth[_0x55c6('0xa')](),controller['show']);router['post']('/',auth[_0x55c6('0xa')](),controller[_0x55c6('0xf')]);router[_0x55c6('0x10')](_0x55c6('0xe'),auth[_0x55c6('0xa')](),controller[_0x55c6('0x11')]);router[_0x55c6('0x12')](_0x55c6('0xe'),auth['isAuthenticated'](),controller[_0x55c6('0x13')]);module[_0x55c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 65e6550..db8dc9f 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 _0x3c81=['join','getDataValue','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x332389,_0x1e56d7){var _0x4aac40=function(_0x4df42c){while(--_0x4df42c){_0x332389['push'](_0x332389['shift']());}};_0x4aac40(++_0x1e56d7);}(_0x3c81,0x102));var _0x13c8=function(_0x5bef50,_0x548be2){_0x5bef50=_0x5bef50-0x0;var _0x37005d=_0x3c81[_0x5bef50];return _0x37005d;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x13c8('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x548599){this[_0x13c8('0x4')](_0x13c8('0x5'),_0x548599?_0x548599[_0x13c8('0x6')](''):[]);},'get':function(){return this[_0x13c8('0x7')](_0x13c8('0x5'))?this[_0x13c8('0x7')](_0x13c8('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0xd7d1=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5c14ef,_0x4e4e3e){_0x5c14ef=_0x5c14ef-0x0;var _0x4854a2=_0xd7d1[_0x5c14ef];return _0x4854a2;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x1d7d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x1d7d('0x2')],'set':function(_0x1ac097){this[_0x1d7d('0x5')](_0x1d7d('0x6'),_0x1ac097?_0x1ac097[_0x1d7d('0x7')](''):[]);},'get':function(){return this[_0x1d7d('0x8')]('crudPermissions')?this[_0x1d7d('0x8')](_0x1d7d('0x6'))[_0x1d7d('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9beef7d..2388a18 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 _0xe10c=['count','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','UserProfileSection','includeAll','include','show','catch','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x55a692,_0xf0703d){var _0x18a653=function(_0x25bfd7){while(--_0x25bfd7){_0x55a692['push'](_0x55a692['shift']());}};_0x18a653(++_0xf0703d);}(_0xe10c,0x72));var _0xce10=function(_0x119d2d,_0x41a734){_0x119d2d=_0x119d2d-0x0;var _0x494ced=_0xe10c[_0x119d2d];return _0x494ced;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xce10('0x0'));var jsonpatch=require(_0xce10('0x1'));var rp=require(_0xce10('0x2'));var moment=require(_0xce10('0x3'));var BPromise=require(_0xce10('0x4'));var Mustache=require(_0xce10('0x5'));var util=require(_0xce10('0x6'));var path=require(_0xce10('0x7'));var sox=require(_0xce10('0x8'));var csv=require('to-csv');var ejs=require(_0xce10('0x9'));var fs=require('fs');var fs_extra=require(_0xce10('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xce10('0xb'));var jsforce=require(_0xce10('0xc'));var deskjs=require(_0xce10('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce10('0xe'));var authService=require(_0xce10('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xce10('0x10'));var hardwareService=require(_0xce10('0x11'));var logger=require(_0xce10('0x12'))(_0xce10('0x13'));var utils=require(_0xce10('0x14'));var config=require(_0xce10('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xce10('0x16'))['db'];function respondWithStatusCode(_0x1aafd0,_0x303fea){_0x303fea=_0x303fea||0xcc;return function(_0x16da24){if(_0x16da24){return _0x1aafd0[_0xce10('0x17')](_0x303fea);}return _0x1aafd0[_0xce10('0x18')](_0x303fea)[_0xce10('0x19')]();};}function respondWithResult(_0x4176ea,_0x51b1fc){_0x51b1fc=_0x51b1fc||0xc8;return function(_0x3531ff){if(_0x3531ff){return _0x4176ea[_0xce10('0x18')](_0x51b1fc)[_0xce10('0x1a')](_0x3531ff);}};}function respondWithFilteredResult(_0xfc36aa,_0x47a4b1){return function(_0x36c155){if(_0x36c155){var _0x1cd8c5=typeof _0x47a4b1[_0xce10('0x1b')]==='undefined'&&typeof _0x47a4b1[_0xce10('0x1c')]===_0xce10('0x1d');var _0x39a2ab=_0x36c155['count'];var _0x50cff8=_0x1cd8c5?0x0:_0x47a4b1[_0xce10('0x1b')];var _0x2815a9=_0x1cd8c5?_0x36c155[_0xce10('0x1e')]:_0x47a4b1['offset']+_0x47a4b1['limit'];var _0x3635b3;if(_0x2815a9>=_0x39a2ab){_0x2815a9=_0x39a2ab;_0x3635b3=0xc8;}else{_0x3635b3=0xce;}_0xfc36aa[_0xce10('0x18')](_0x3635b3);return _0xfc36aa['set'](_0xce10('0x1f'),_0x50cff8+'-'+_0x2815a9+'/'+_0x39a2ab)['json'](_0x36c155);}return null;};}function patchUpdates(_0x52301c){return function(_0x4f68f7){try{jsonpatch[_0xce10('0x20')](_0x4f68f7,_0x52301c,!![]);}catch(_0x410c99){return BPromise['reject'](_0x410c99);}return _0x4f68f7[_0xce10('0x21')]();};}function saveUpdates(_0x26e394,_0x42ff2d){return function(_0x22db01){if(_0x22db01){return _0x22db01[_0xce10('0x22')](_0x26e394)[_0xce10('0x23')](function(_0x2376b2){return _0x2376b2;});}return null;};}function removeEntity(_0x131150,_0x260211){return function(_0x5d8918){if(_0x5d8918){return _0x5d8918[_0xce10('0x24')]()[_0xce10('0x23')](function(){_0x131150['status'](0xcc)[_0xce10('0x19')]();});}};}function handleEntityNotFound(_0x147839,_0x381794){return function(_0x374606){if(!_0x374606){_0x147839[_0xce10('0x17')](0x194);}return _0x374606;};}function handleError(_0x137a99,_0x4a89e8){_0x4a89e8=_0x4a89e8||0x1f4;return function(_0x1daa0b){logger['error'](_0x1daa0b['stack']);if(_0x1daa0b[_0xce10('0x25')]){delete _0x1daa0b[_0xce10('0x25')];}_0x137a99['status'](_0x4a89e8)[_0xce10('0x26')](_0x1daa0b);};}exports[_0xce10('0x27')]=function(_0x40eee6,_0x222f49){var _0x728c59={},_0x4a0098={},_0x4a9ffa={'count':0x0,'rows':[]};var _0x2ae93c=_[_0xce10('0x28')](db['UserProfileSection'][_0xce10('0x29')],function(_0x3d7446){return{'name':_0x3d7446[_0xce10('0x2a')],'type':_0x3d7446[_0xce10('0x2b')]['key']};});_0x4a0098[_0xce10('0x2c')]=_[_0xce10('0x28')](_0x2ae93c,_0xce10('0x25'));_0x4a0098['query']=_[_0xce10('0x2d')](_0x40eee6[_0xce10('0x2e')]);_0x4a0098[_0xce10('0x2f')]=_['intersection'](_0x4a0098[_0xce10('0x2c')],_0x4a0098[_0xce10('0x2e')]);_0x728c59['attributes']=_[_0xce10('0x30')](_0x4a0098['model'],qs[_0xce10('0x31')](_0x40eee6[_0xce10('0x2e')]['fields']));_0x728c59[_0xce10('0x32')]=_0x728c59[_0xce10('0x32')][_0xce10('0x33')]?_0x728c59[_0xce10('0x32')]:_0x4a0098[_0xce10('0x2c')];if(!_0x40eee6[_0xce10('0x2e')][_0xce10('0x34')](_0xce10('0x35'))){_0x728c59['limit']=qs[_0xce10('0x1c')](_0x40eee6[_0xce10('0x2e')][_0xce10('0x1c')]);_0x728c59[_0xce10('0x1b')]=qs[_0xce10('0x1b')](_0x40eee6['query'][_0xce10('0x1b')]);}_0x728c59[_0xce10('0x36')]=qs[_0xce10('0x37')](_0x40eee6[_0xce10('0x2e')][_0xce10('0x37')]);_0x728c59['where']=qs[_0xce10('0x2f')](_[_0xce10('0x38')](_0x40eee6[_0xce10('0x2e')],_0x4a0098['filters']),_0x2ae93c);if(_0x40eee6[_0xce10('0x2e')][_0xce10('0x39')]){_0x728c59[_0xce10('0x3a')]=_[_0xce10('0x3b')](_0x728c59[_0xce10('0x3a')],{'$or':_[_0xce10('0x28')](_0x2ae93c,function(_0x533a30){if(_0x533a30['type']!==_0xce10('0x3c')){var _0x497662={};_0x497662[_0x533a30[_0xce10('0x25')]]={'$like':'%'+_0x40eee6['query'][_0xce10('0x39')]+'%'};return _0x497662;}})});}_0x728c59=_[_0xce10('0x3b')]({},_0x728c59,_0x40eee6[_0xce10('0x3d')]);var _0x576cc0={'where':_0x728c59[_0xce10('0x3a')]};return db[_0xce10('0x3e')][_0xce10('0x1e')](_0x576cc0)[_0xce10('0x23')](function(_0x4daf8c){_0x4a9ffa[_0xce10('0x1e')]=_0x4daf8c;if(_0x40eee6[_0xce10('0x2e')][_0xce10('0x3f')]){_0x728c59[_0xce10('0x40')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x728c59);})[_0xce10('0x23')](function(_0x446443){_0x4a9ffa['rows']=_0x446443;return _0x4a9ffa;})[_0xce10('0x23')](respondWithFilteredResult(_0x222f49,_0x728c59))['catch'](handleError(_0x222f49,null));};exports[_0xce10('0x41')]=function(_0x2fe1fa,_0x521c8b){var _0x57d140={'raw':![],'where':{'id':_0x2fe1fa['params']['id']}},_0x3a7fe5={};_0x3a7fe5[_0xce10('0x2c')]=_[_0xce10('0x2d')](db[_0xce10('0x3e')][_0xce10('0x29')]);_0x3a7fe5['query']=_[_0xce10('0x2d')](_0x2fe1fa[_0xce10('0x2e')]);_0x3a7fe5['filters']=_[_0xce10('0x30')](_0x3a7fe5[_0xce10('0x2c')],_0x3a7fe5[_0xce10('0x2e')]);_0x57d140[_0xce10('0x32')]=_[_0xce10('0x30')](_0x3a7fe5['model'],qs[_0xce10('0x31')](_0x2fe1fa['query'][_0xce10('0x31')]));_0x57d140['attributes']=_0x57d140[_0xce10('0x32')][_0xce10('0x33')]?_0x57d140['attributes']:_0x3a7fe5[_0xce10('0x2c')];if(_0x2fe1fa[_0xce10('0x2e')][_0xce10('0x3f')]){_0x57d140[_0xce10('0x40')]=[{'all':!![]}];}_0x57d140=_[_0xce10('0x3b')]({},_0x57d140,_0x2fe1fa[_0xce10('0x3d')]);return db[_0xce10('0x3e')]['find'](_0x57d140)['then'](handleEntityNotFound(_0x521c8b,null))[_0xce10('0x23')](respondWithResult(_0x521c8b,null))[_0xce10('0x42')](handleError(_0x521c8b,null));};exports[_0xce10('0x43')]=function(_0x2a81a0,_0x434bd8){return db[_0xce10('0x3e')][_0xce10('0x43')](_0x2a81a0[_0xce10('0x44')],{})['then'](respondWithResult(_0x434bd8,0xc9))[_0xce10('0x42')](handleError(_0x434bd8,null));};exports[_0xce10('0x22')]=function(_0x2aff36,_0x2e04c8){if(_0x2aff36[_0xce10('0x44')]['id']){delete _0x2aff36['body']['id'];}return db['UserProfileSection'][_0xce10('0x45')]({'where':{'id':_0x2aff36[_0xce10('0x46')]['id']}})[_0xce10('0x23')](handleEntityNotFound(_0x2e04c8,null))[_0xce10('0x23')](saveUpdates(_0x2aff36['body'],null))[_0xce10('0x23')](respondWithResult(_0x2e04c8,null))[_0xce10('0x42')](handleError(_0x2e04c8,null));};exports[_0xce10('0x24')]=function(_0xf21d13,_0x412c66){return db[_0xce10('0x3e')][_0xce10('0x45')]({'where':{'id':_0xf21d13[_0xce10('0x46')]['id']}})[_0xce10('0x23')](handleEntityNotFound(_0x412c66,null))['then'](removeEntity(_0x412c66,null))[_0xce10('0x42')](handleError(_0x412c66,null));};exports[_0xce10('0x47')]=function(_0x2895c4,_0x35091a){return db[_0xce10('0x3e')][_0xce10('0x47')]()[_0xce10('0x23')](respondWithResult(_0x35091a,null))[_0xce10('0x42')](handleError(_0x35091a,null));}; \ No newline at end of file +var _0xab19=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','name','send','index','map','UserProfileSection'];(function(_0xe83734,_0x405e60){var _0x336c96=function(_0x37d09b){while(--_0x37d09b){_0xe83734['push'](_0xe83734['shift']());}};_0x336c96(++_0x405e60);}(_0xab19,0x1da));var _0x9ab1=function(_0x4d3afa,_0x19130f){_0x4d3afa=_0x4d3afa-0x0;var _0x3f1535=_0xab19[_0x4d3afa];return _0x3f1535;};'use strict';var emlformat=require(_0x9ab1('0x0'));var rimraf=require(_0x9ab1('0x1'));var zipdir=require(_0x9ab1('0x2'));var jsonpatch=require(_0x9ab1('0x3'));var rp=require('request-promise');var moment=require(_0x9ab1('0x4'));var BPromise=require(_0x9ab1('0x5'));var Mustache=require(_0x9ab1('0x6'));var util=require(_0x9ab1('0x7'));var path=require(_0x9ab1('0x8'));var sox=require('sox');var csv=require(_0x9ab1('0x9'));var ejs=require(_0x9ab1('0xa'));var fs=require('fs');var fs_extra=require(_0x9ab1('0xb'));var _=require(_0x9ab1('0xc'));var squel=require(_0x9ab1('0xd'));var crypto=require(_0x9ab1('0xe'));var jsforce=require(_0x9ab1('0xf'));var deskjs=require(_0x9ab1('0x10'));var toCsv=require(_0x9ab1('0x9'));var querystring=require(_0x9ab1('0x11'));var Papa=require(_0x9ab1('0x12'));var Redis=require(_0x9ab1('0x13'));var authService=require(_0x9ab1('0x14'));var qs=require(_0x9ab1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ab1('0x16'))(_0x9ab1('0x17'));var utils=require(_0x9ab1('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a373,_0x3a09f9){_0x3a09f9=_0x3a09f9||0xcc;return function(_0x546d72){if(_0x546d72){return _0x48a373['sendStatus'](_0x3a09f9);}return _0x48a373[_0x9ab1('0x19')](_0x3a09f9)[_0x9ab1('0x1a')]();};}function respondWithResult(_0x10363b,_0x20bf78){_0x20bf78=_0x20bf78||0xc8;return function(_0x490d97){if(_0x490d97){return _0x10363b[_0x9ab1('0x19')](_0x20bf78)[_0x9ab1('0x1b')](_0x490d97);}};}function respondWithFilteredResult(_0x1179f2,_0x209bba){return function(_0x5f5da5){if(_0x5f5da5){var _0x2e2742=typeof _0x209bba[_0x9ab1('0x1c')]===_0x9ab1('0x1d')&&typeof _0x209bba[_0x9ab1('0x1e')]==='undefined';var _0x40e27c=_0x5f5da5[_0x9ab1('0x1f')];var _0x2a4bb3=_0x2e2742?0x0:_0x209bba['offset'];var _0x13ea26=_0x2e2742?_0x5f5da5[_0x9ab1('0x1f')]:_0x209bba[_0x9ab1('0x1c')]+_0x209bba['limit'];var _0x23d404;if(_0x13ea26>=_0x40e27c){_0x13ea26=_0x40e27c;_0x23d404=0xc8;}else{_0x23d404=0xce;}_0x1179f2['status'](_0x23d404);return _0x1179f2[_0x9ab1('0x20')]('Content-Range',_0x2a4bb3+'-'+_0x13ea26+'/'+_0x40e27c)[_0x9ab1('0x1b')](_0x5f5da5);}return null;};}function patchUpdates(_0x516b08){return function(_0x25a80f){try{jsonpatch[_0x9ab1('0x21')](_0x25a80f,_0x516b08,!![]);}catch(_0x5110ce){return BPromise['reject'](_0x5110ce);}return _0x25a80f[_0x9ab1('0x22')]();};}function saveUpdates(_0x24e895,_0x56aace){return function(_0x42e76d){if(_0x42e76d){return _0x42e76d[_0x9ab1('0x23')](_0x24e895)[_0x9ab1('0x24')](function(_0x41eb08){return _0x41eb08;});}return null;};}function removeEntity(_0x37ec4d,_0x31b35c){return function(_0x48beec){if(_0x48beec){return _0x48beec[_0x9ab1('0x25')]()[_0x9ab1('0x24')](function(){_0x37ec4d[_0x9ab1('0x19')](0xcc)[_0x9ab1('0x1a')]();});}};}function handleEntityNotFound(_0x5ddd10,_0x58e3b3){return function(_0x408e5b){if(!_0x408e5b){_0x5ddd10[_0x9ab1('0x26')](0x194);}return _0x408e5b;};}function handleError(_0x161249,_0x461b4c){_0x461b4c=_0x461b4c||0x1f4;return function(_0x4fc552){logger['error'](_0x4fc552['stack']);if(_0x4fc552[_0x9ab1('0x27')]){delete _0x4fc552[_0x9ab1('0x27')];}_0x161249[_0x9ab1('0x19')](_0x461b4c)[_0x9ab1('0x28')](_0x4fc552);};}exports[_0x9ab1('0x29')]=function(_0x154e6e,_0x47cd89){var _0xda7303={},_0x4cc1ee={},_0x23c6a6={'count':0x0,'rows':[]};var _0x5f55b0=_[_0x9ab1('0x2a')](db[_0x9ab1('0x2b')][_0x9ab1('0x2c')],function(_0x4d2bbc){return{'name':_0x4d2bbc[_0x9ab1('0x2d')],'type':_0x4d2bbc[_0x9ab1('0x2e')][_0x9ab1('0x2f')]};});_0x4cc1ee[_0x9ab1('0x30')]=_[_0x9ab1('0x2a')](_0x5f55b0,_0x9ab1('0x27'));_0x4cc1ee[_0x9ab1('0x31')]=_[_0x9ab1('0x32')](_0x154e6e['query']);_0x4cc1ee[_0x9ab1('0x33')]=_[_0x9ab1('0x34')](_0x4cc1ee['model'],_0x4cc1ee[_0x9ab1('0x31')]);_0xda7303['attributes']=_[_0x9ab1('0x34')](_0x4cc1ee[_0x9ab1('0x30')],qs[_0x9ab1('0x35')](_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x35')]));_0xda7303['attributes']=_0xda7303[_0x9ab1('0x36')][_0x9ab1('0x37')]?_0xda7303['attributes']:_0x4cc1ee[_0x9ab1('0x30')];if(!_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x38')](_0x9ab1('0x39'))){_0xda7303[_0x9ab1('0x1e')]=qs[_0x9ab1('0x1e')](_0x154e6e[_0x9ab1('0x31')]['limit']);_0xda7303['offset']=qs[_0x9ab1('0x1c')](_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x1c')]);}_0xda7303[_0x9ab1('0x3a')]=qs[_0x9ab1('0x3b')](_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x3b')]);_0xda7303[_0x9ab1('0x3c')]=qs[_0x9ab1('0x33')](_[_0x9ab1('0x3d')](_0x154e6e['query'],_0x4cc1ee['filters']),_0x5f55b0);if(_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x3e')]){_0xda7303['where']=_[_0x9ab1('0x3f')](_0xda7303[_0x9ab1('0x3c')],{'$or':_[_0x9ab1('0x2a')](_0x5f55b0,function(_0x14727f){if(_0x14727f['type']!==_0x9ab1('0x40')){var _0x595922={};_0x595922[_0x14727f[_0x9ab1('0x27')]]={'$like':'%'+_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x3e')]+'%'};return _0x595922;}})});}_0xda7303=_['merge']({},_0xda7303,_0x154e6e[_0x9ab1('0x41')]);var _0x4bd396={'where':_0xda7303['where']};return db[_0x9ab1('0x2b')][_0x9ab1('0x1f')](_0x4bd396)[_0x9ab1('0x24')](function(_0x13aa47){_0x23c6a6[_0x9ab1('0x1f')]=_0x13aa47;if(_0x154e6e[_0x9ab1('0x31')][_0x9ab1('0x42')]){_0xda7303['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x9ab1('0x43')](_0xda7303);})[_0x9ab1('0x24')](function(_0x2bd0db){_0x23c6a6[_0x9ab1('0x44')]=_0x2bd0db;return _0x23c6a6;})[_0x9ab1('0x24')](respondWithFilteredResult(_0x47cd89,_0xda7303))[_0x9ab1('0x45')](handleError(_0x47cd89,null));};exports['show']=function(_0x5aea1f,_0x3969be){var _0x425cb0={'raw':![],'where':{'id':_0x5aea1f[_0x9ab1('0x46')]['id']}},_0x2a3317={};_0x2a3317[_0x9ab1('0x30')]=_[_0x9ab1('0x32')](db[_0x9ab1('0x2b')]['rawAttributes']);_0x2a3317[_0x9ab1('0x31')]=_['keys'](_0x5aea1f[_0x9ab1('0x31')]);_0x2a3317['filters']=_['intersection'](_0x2a3317[_0x9ab1('0x30')],_0x2a3317[_0x9ab1('0x31')]);_0x425cb0[_0x9ab1('0x36')]=_[_0x9ab1('0x34')](_0x2a3317[_0x9ab1('0x30')],qs[_0x9ab1('0x35')](_0x5aea1f[_0x9ab1('0x31')][_0x9ab1('0x35')]));_0x425cb0[_0x9ab1('0x36')]=_0x425cb0[_0x9ab1('0x36')][_0x9ab1('0x37')]?_0x425cb0[_0x9ab1('0x36')]:_0x2a3317['model'];if(_0x5aea1f[_0x9ab1('0x31')][_0x9ab1('0x42')]){_0x425cb0['include']=[{'all':!![]}];}_0x425cb0=_['merge']({},_0x425cb0,_0x5aea1f[_0x9ab1('0x41')]);return db['UserProfileSection']['find'](_0x425cb0)[_0x9ab1('0x24')](handleEntityNotFound(_0x3969be,null))[_0x9ab1('0x24')](respondWithResult(_0x3969be,null))[_0x9ab1('0x45')](handleError(_0x3969be,null));};exports[_0x9ab1('0x47')]=function(_0x2c974a,_0x57d5c1){return db['UserProfileSection'][_0x9ab1('0x47')](_0x2c974a[_0x9ab1('0x48')],{})['then'](respondWithResult(_0x57d5c1,0xc9))[_0x9ab1('0x45')](handleError(_0x57d5c1,null));};exports[_0x9ab1('0x23')]=function(_0x81f7be,_0x288bbf){if(_0x81f7be[_0x9ab1('0x48')]['id']){delete _0x81f7be['body']['id'];}return db[_0x9ab1('0x2b')]['find']({'where':{'id':_0x81f7be['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x288bbf,null))['then'](saveUpdates(_0x81f7be[_0x9ab1('0x48')],null))['then'](respondWithResult(_0x288bbf,null))[_0x9ab1('0x45')](handleError(_0x288bbf,null));};exports[_0x9ab1('0x25')]=function(_0x173bf2,_0x22d765){return db[_0x9ab1('0x2b')]['find']({'where':{'id':_0x173bf2[_0x9ab1('0x46')]['id']}})['then'](handleEntityNotFound(_0x22d765,null))[_0x9ab1('0x24')](removeEntity(_0x22d765,null))[_0x9ab1('0x45')](handleError(_0x22d765,null));};exports['describe']=function(_0x5451a4,_0x5c5e5d){return db[_0x9ab1('0x2b')][_0x9ab1('0x49')]()[_0x9ab1('0x24')](respondWithResult(_0x5c5e5d,null))[_0x9ab1('0x45')](handleError(_0x5c5e5d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 562ba14..dab3b69 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 _0xe12c=['path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','lodash','util','api','moment','bluebird'];(function(_0x1bdcc3,_0x357cfa){var _0x9287b1=function(_0x5a6418){while(--_0x5a6418){_0x1bdcc3['push'](_0x1bdcc3['shift']());}};_0x9287b1(++_0x357cfa);}(_0xe12c,0xd8));var _0xce12=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe12c[_0xa8883];return _0x479426;};'use strict';var _=require(_0xce12('0x0'));var util=require(_0xce12('0x1'));var logger=require('../../config/logger')(_0xce12('0x2'));var moment=require(_0xce12('0x3'));var BPromise=require(_0xce12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce12('0x5'));var rimraf=require(_0xce12('0x6'));var config=require('../../config/environment');var attributes=require(_0xce12('0x7'));module[_0xce12('0x8')]=function(_0x5427a4,_0x4833a0){return _0x5427a4[_0xce12('0x9')]('UserProfileSection',attributes,{'tableName':_0xce12('0xa'),'paranoid':![],'indexes':[{'name':_0xce12('0xb'),'fields':[_0xce12('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6be5=['define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x25e23a,_0x5e46f5){var _0x2a96e0=function(_0x4b09ce){while(--_0x4b09ce){_0x25e23a['push'](_0x25e23a['shift']());}};_0x2a96e0(++_0x5e46f5);}(_0x6be5,0x1c8));var _0x56be=function(_0x2a0690,_0x5d9058){_0x2a0690=_0x2a0690-0x0;var _0x3cbd44=_0x6be5[_0x2a0690];return _0x3cbd44;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x56be('0x0'));var moment=require(_0x56be('0x1'));var BPromise=require(_0x56be('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56be('0x3'));var rimraf=require(_0x56be('0x4'));var config=require(_0x56be('0x5'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x428aed,_0x369ae0){return _0x428aed[_0x56be('0x6')](_0x56be('0x7'),attributes,{'tableName':_0x56be('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x56be('0x9'),_0x56be('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a37645d..109ca00 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 _0x444e=['client','http','request','then','request\x20sent','debug','error','UserProfileSection,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x50bca7,_0x35485d){var _0x3fa9b0=function(_0x431053){while(--_0x431053){_0x50bca7['push'](_0x50bca7['shift']());}};_0x3fa9b0(++_0x35485d);}(_0x444e,0xe8));var _0xe444=function(_0x4fc84f,_0x25dd59){_0x4fc84f=_0x4fc84f-0x0;var _0xec4518=_0x444e[_0x4fc84f];return _0xec4518;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var moment=require(_0xe444('0x1'));var BPromise=require('bluebird');var rs=require(_0xe444('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe444('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe444('0x4'))(_0xe444('0x5'));var config=require(_0xe444('0x6'));var jayson=require(_0xe444('0x7'));var client=jayson[_0xe444('0x8')][_0xe444('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4834c7,_0xfbd88b,_0x4b5b7d){return new BPromise(function(_0x29a2b7,_0x482b98){return client[_0xe444('0xa')](_0x4834c7,_0x4b5b7d)[_0xe444('0xb')](function(_0x40a368){logger['info']('UserProfileSection,\x20%s,\x20%s',_0xfbd88b,_0xe444('0xc'));logger[_0xe444('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xfbd88b,_0xe444('0xc'),JSON['stringify'](_0x40a368));if(_0x40a368['error']){if(_0x40a368[_0xe444('0xe')]['code']===0x1f4){logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x40a368['error'][_0xe444('0x10')]);return _0x482b98(_0x40a368['error']['message']);}logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x40a368['error'][_0xe444('0x10')]);return _0x29a2b7(_0x40a368['error'][_0xe444('0x10')]);}else{logger[_0xe444('0x11')](_0xe444('0xf'),_0xfbd88b,_0xe444('0xc'));_0x29a2b7(_0x40a368[_0xe444('0x12')][_0xe444('0x10')]);}})[_0xe444('0x13')](function(_0x3e1b57){logger[_0xe444('0xe')](_0xe444('0xf'),_0xfbd88b,_0x3e1b57);_0x482b98(_0x3e1b57);});});} \ No newline at end of file +var _0xbbe2=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x21fdfb,_0x419f7d){var _0x20b104=function(_0x165680){while(--_0x165680){_0x21fdfb['push'](_0x21fdfb['shift']());}};_0x20b104(++_0x419f7d);}(_0xbbe2,0x116));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2bbe('0x0'));var util=require(_0x2bbe('0x1'));var moment=require(_0x2bbe('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bbe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bbe('0x4'))['db'];var utils=require(_0x2bbe('0x5'));var logger=require('../../config/logger')(_0x2bbe('0x6'));var config=require(_0x2bbe('0x7'));var jayson=require(_0x2bbe('0x8'));var client=jayson[_0x2bbe('0x9')][_0x2bbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548fa8,_0x5dae10,_0x4e0ede){return new BPromise(function(_0x2222c5,_0xa678d3){return client[_0x2bbe('0xb')](_0x548fa8,_0x4e0ede)[_0x2bbe('0xc')](function(_0x3cc4d0){logger[_0x2bbe('0xd')](_0x2bbe('0xe'),_0x5dae10,_0x2bbe('0xf'));logger[_0x2bbe('0x10')](_0x2bbe('0x11'),_0x5dae10,_0x2bbe('0xf'),JSON[_0x2bbe('0x12')](_0x3cc4d0));if(_0x3cc4d0['error']){if(_0x3cc4d0[_0x2bbe('0x13')][_0x2bbe('0x14')]===0x1f4){logger[_0x2bbe('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x5dae10,_0x3cc4d0[_0x2bbe('0x13')][_0x2bbe('0x15')]);return _0xa678d3(_0x3cc4d0[_0x2bbe('0x13')]['message']);}logger[_0x2bbe('0x13')](_0x2bbe('0xe'),_0x5dae10,_0x3cc4d0[_0x2bbe('0x13')][_0x2bbe('0x15')]);return _0x2222c5(_0x3cc4d0['error']['message']);}else{logger[_0x2bbe('0xd')](_0x2bbe('0xe'),_0x5dae10,'request\x20sent');_0x2222c5(_0x3cc4d0[_0x2bbe('0x16')][_0x2bbe('0x15')]);}})['catch'](function(_0x6b29dc){logger[_0x2bbe('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x5dae10,_0x6b29dc);_0xa678d3(_0x6b29dc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index cd98699..0f3c984 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1cbee1,_0x1b1590){var _0x5424af=function(_0x531e22){while(--_0x531e22){_0x1cbee1['push'](_0x1cbee1['shift']());}};_0x5424af(++_0x1b1590);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xcb91[_0x13594e];return _0x1a4f42;};'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(_0x52469e,_0x3579c2){var _0x2e6692=function(_0x3e5576){while(--_0x3e5576){_0x52469e['push'](_0x52469e['shift']());}};_0x2e6692(++_0x3579c2);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 9962deb..2a1f57c 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 _0x61c8=['INTEGER','sequelize','exports'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0x61c8,0x199));var _0x861c=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x61c8[_0x3eff21];return _0x1945bb;};'use strict';var Sequelize=require(_0x861c('0x0'));module[_0x861c('0x1')]={'penalty':{'type':Sequelize[_0x861c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x83b4=['INTEGER'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x83b4,0xc4));var _0x483b=function(_0x204296,_0xec4630){_0x204296=_0x204296-0x0;var _0x567f32=_0x83b4[_0x204296];return _0x567f32;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x483b('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1f7145d..70c3000 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 _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x3a24b8,_0x1b7651){_0x3a24b8=_0x3a24b8-0x0;var _0x502dd8=_0x9bd9[_0x3a24b8];return _0x502dd8;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b8=['../../config/logger','api','bluebird','rimraf','../../config/environment','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'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 3deb114..a1430f3 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 _0xb768=['info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5a4839,_0x3a36f3){var _0x2fed0f=function(_0x160d5d){while(--_0x160d5d){_0x5a4839['push'](_0x5a4839['shift']());}};_0x2fed0f(++_0x3a36f3);}(_0xb768,0x6c));var _0x8b76=function(_0x429780,_0x15c4e5){_0x429780=_0x429780-0x0;var _0x4d19fb=_0xb768[_0x429780];return _0x4d19fb;};'use strict';var _=require(_0x8b76('0x0'));var util=require(_0x8b76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b76('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b76('0x3'))['db'];var utils=require(_0x8b76('0x4'));var logger=require(_0x8b76('0x5'))(_0x8b76('0x6'));var config=require(_0x8b76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b76('0x8')][_0x8b76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353ed9,_0x58de02,_0x4ee0a6){return new BPromise(function(_0x39fc65,_0x5d22d1){return client[_0x8b76('0xa')](_0x353ed9,_0x4ee0a6)[_0x8b76('0xb')](function(_0x439130){logger[_0x8b76('0xc')](_0x8b76('0xd'),_0x58de02,'request\x20sent');logger['debug'](_0x8b76('0xe'),_0x58de02,_0x8b76('0xf'),JSON['stringify'](_0x439130));if(_0x439130[_0x8b76('0x10')]){if(_0x439130[_0x8b76('0x10')][_0x8b76('0x11')]===0x1f4){logger[_0x8b76('0x10')](_0x8b76('0xd'),_0x58de02,_0x439130[_0x8b76('0x10')][_0x8b76('0x12')]);return _0x5d22d1(_0x439130[_0x8b76('0x10')]['message']);}logger['error'](_0x8b76('0xd'),_0x58de02,_0x439130[_0x8b76('0x10')]['message']);return _0x39fc65(_0x439130['error'][_0x8b76('0x12')]);}else{logger[_0x8b76('0xc')](_0x8b76('0xd'),_0x58de02,_0x8b76('0xf'));_0x39fc65(_0x439130['result'][_0x8b76('0x12')]);}})[_0x8b76('0x13')](function(_0x255e1b){logger[_0x8b76('0x10')](_0x8b76('0xd'),_0x58de02,_0x255e1b);_0x5d22d1(_0x255e1b);});});} \ No newline at end of file +var _0xdaea=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment'];(function(_0x1e0bfe,_0x19a453){var _0xb3a289=function(_0x541221){while(--_0x541221){_0x1e0bfe['push'](_0x1e0bfe['shift']());}};_0xb3a289(++_0x19a453);}(_0xdaea,0x1e2));var _0xadae=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0xdaea[_0x48c615];return _0x3d9e22;};'use strict';var _=require('lodash');var util=require(_0xadae('0x0'));var moment=require(_0xadae('0x1'));var BPromise=require(_0xadae('0x2'));var rs=require(_0xadae('0x3'));var fs=require('fs');var Redis=require(_0xadae('0x4'));var db=require(_0xadae('0x5'))['db'];var utils=require(_0xadae('0x6'));var logger=require(_0xadae('0x7'))('rpc');var config=require(_0xadae('0x8'));var jayson=require(_0xadae('0x9'));var client=jayson[_0xadae('0xa')][_0xadae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f0460,_0x1708df,_0x68d65a){return new BPromise(function(_0x2e7dce,_0x185d4d){return client[_0xadae('0xc')](_0x4f0460,_0x68d65a)[_0xadae('0xd')](function(_0x10dfd3){logger['info'](_0xadae('0xe'),_0x1708df,_0xadae('0xf'));logger['debug'](_0xadae('0x10'),_0x1708df,_0xadae('0xf'),JSON['stringify'](_0x10dfd3));if(_0x10dfd3[_0xadae('0x11')]){if(_0x10dfd3['error']['code']===0x1f4){logger[_0xadae('0x11')](_0xadae('0xe'),_0x1708df,_0x10dfd3['error'][_0xadae('0x12')]);return _0x185d4d(_0x10dfd3[_0xadae('0x11')][_0xadae('0x12')]);}logger['error'](_0xadae('0xe'),_0x1708df,_0x10dfd3[_0xadae('0x11')]['message']);return _0x2e7dce(_0x10dfd3['error'][_0xadae('0x12')]);}else{logger[_0xadae('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x1708df,'request\x20sent');_0x2e7dce(_0x10dfd3[_0xadae('0x14')][_0xadae('0x12')]);}})[_0xadae('0x15')](function(_0x4a376c){logger[_0xadae('0x11')](_0xadae('0xe'),_0x1708df,_0x4a376c);_0x185d4d(_0x4a376c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cdeeb01..226eeec 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6094=['INTEGER'];(function(_0x2d95d0,_0x58f7f2){var _0x12c666=function(_0x155f48){while(--_0x155f48){_0x2d95d0['push'](_0x2d95d0['shift']());}};_0x12c666(++_0x58f7f2);}(_0x6094,0x144));var _0x4609=function(_0x933022,_0x4d8339){_0x933022=_0x933022-0x0;var _0x32e4d4=_0x6094[_0x933022];return _0x32e4d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4609('0x0')]}}; \ No newline at end of file +var _0x1984=['exports','INTEGER','sequelize'];(function(_0x1a6ca1,_0x1c16f2){var _0x8dd57=function(_0x5e03af){while(--_0x5e03af){_0x1a6ca1['push'](_0x1a6ca1['shift']());}};_0x8dd57(++_0x1c16f2);}(_0x1984,0x1a0));var _0x4198=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1984[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x4198('0x0'));module[_0x4198('0x1')]={'UserId':{'type':Sequelize[_0x4198('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4198('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 81d6510..29f594e 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x49a287,_0x392135){var _0x43f481=function(_0x4af450){while(--_0x4af450){_0x49a287['push'](_0x49a287['shift']());}};_0x43f481(++_0x392135);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x496396,_0x4672d2){var _0x123c19=function(_0x4d27da){while(--_0x4d27da){_0x496396['push'](_0x496396['shift']());}};_0x123c19(++_0x4672d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 89f624c..4994077 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4fd701,_0x4dd637){var _0xb61e42=function(_0x56eff4){while(--_0x56eff4){_0x4fd701['push'](_0x4fd701['shift']());}};_0xb61e42(++_0x4dd637);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8442877..6229d31 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 _0xbf4b=['exports','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf4b,0x99));var _0xbbf4=function(_0x1ca907,_0x318ca2){_0x1ca907=_0x1ca907-0x0;var _0x4eb2c1=_0xbf4b[_0x1ca907];return _0x4eb2c1;};'use strict';var Sequelize=require(_0xbbf4('0x0'));module[_0xbbf4('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e0e=['sequelize','exports','INTEGER'];(function(_0x2d1376,_0x3de77e){var _0x313029=function(_0x383d29){while(--_0x383d29){_0x2d1376['push'](_0x2d1376['shift']());}};_0x313029(++_0x3de77e);}(_0x6e0e,0x90));var _0xe6e0=function(_0x58b603,_0x450f6d){_0x58b603=_0x58b603-0x0;var _0xf76126=_0x6e0e[_0x58b603];return _0xf76126;};'use strict';var Sequelize=require(_0xe6e0('0x0'));module[_0xe6e0('0x1')]={'penalty':{'type':Sequelize[_0xe6e0('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 93417b4..ce5a1e8 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 _0x22f7=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','../../config/logger','api','moment'];(function(_0x561f66,_0x55e196){var _0x65271e=function(_0x4f335a){while(--_0x4f335a){_0x561f66['push'](_0x561f66['shift']());}};_0x65271e(++_0x55e196);}(_0x22f7,0x8c));var _0x722f=function(_0x2b69a2,_0x4d7126){_0x2b69a2=_0x2b69a2-0x0;var _0x1209bd=_0x22f7[_0x2b69a2];return _0x1209bd;};'use strict';var _=require(_0x722f('0x0'));var util=require('util');var logger=require(_0x722f('0x1'))(_0x722f('0x2'));var moment=require(_0x722f('0x3'));var BPromise=require(_0x722f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722f('0x5'));var rimraf=require(_0x722f('0x6'));var config=require(_0x722f('0x7'));var attributes=require(_0x722f('0x8'));module[_0x722f('0x9')]=function(_0x438f17,_0x402f75){return _0x438f17[_0x722f('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x722f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37fb=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x37fb,0x151));var _0xb37f=function(_0x47c329,_0x31dcda){_0x47c329=_0x47c329-0x0;var _0x3a4356=_0x37fb[_0x47c329];return _0x3a4356;};'use strict';var _=require(_0xb37f('0x0'));var util=require(_0xb37f('0x1'));var logger=require(_0xb37f('0x2'))(_0xb37f('0x3'));var moment=require(_0xb37f('0x4'));var BPromise=require(_0xb37f('0x5'));var rp=require(_0xb37f('0x6'));var fs=require('fs');var path=require(_0xb37f('0x7'));var rimraf=require(_0xb37f('0x8'));var config=require('../../config/environment');var attributes=require(_0xb37f('0x9'));module[_0xb37f('0xa')]=function(_0x2619cc,_0x438a1f){return _0x2619cc[_0xb37f('0xb')](_0xb37f('0xc'),attributes,{'tableName':_0xb37f('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 e5348fa..b404658 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 _0xab90=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5efa48,_0x4a9279){var _0x5a4442=function(_0x4ed9aa){while(--_0x4ed9aa){_0x5efa48['push'](_0x5efa48['shift']());}};_0x5a4442(++_0x4a9279);}(_0xab90,0x1f1));var _0x0ab9=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xab90[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x0ab9('0x0'));var moment=require(_0x0ab9('0x1'));var BPromise=require(_0x0ab9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ab9('0x3'))(_0x0ab9('0x4'));var config=require(_0x0ab9('0x5'));var jayson=require(_0x0ab9('0x6'));var client=jayson[_0x0ab9('0x7')][_0x0ab9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1248,_0x438358,_0x26e2ad){return new BPromise(function(_0x4054dd,_0x566a80){return client[_0x0ab9('0x9')](_0x5d1248,_0x26e2ad)[_0x0ab9('0xa')](function(_0x57be28){logger[_0x0ab9('0xb')](_0x0ab9('0xc'),_0x438358,'request\x20sent');logger['debug'](_0x0ab9('0xd'),_0x438358,_0x0ab9('0xe'),JSON['stringify'](_0x57be28));if(_0x57be28[_0x0ab9('0xf')]){if(_0x57be28['error'][_0x0ab9('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x438358,_0x57be28['error'][_0x0ab9('0x11')]);return _0x566a80(_0x57be28['error'][_0x0ab9('0x11')]);}logger['error'](_0x0ab9('0xc'),_0x438358,_0x57be28[_0x0ab9('0xf')][_0x0ab9('0x11')]);return _0x4054dd(_0x57be28[_0x0ab9('0xf')][_0x0ab9('0x11')]);}else{logger[_0x0ab9('0xb')](_0x0ab9('0xc'),_0x438358,_0x0ab9('0xe'));_0x4054dd(_0x57be28['result'][_0x0ab9('0x11')]);}})['catch'](function(_0x2989b2){logger[_0x0ab9('0xf')](_0x0ab9('0xc'),_0x438358,_0x2989b2);_0x566a80(_0x2989b2);});});} \ No newline at end of file +var _0xcdfd=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcdfd,0x192));var _0xdcdf=function(_0x20adea,_0x192401){_0x20adea=_0x20adea-0x0;var _0x4c995d=_0xcdfd[_0x20adea];return _0x4c995d;};'use strict';var _=require('lodash');var util=require(_0xdcdf('0x0'));var moment=require(_0xdcdf('0x1'));var BPromise=require(_0xdcdf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcdf('0x3'));var db=require(_0xdcdf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcdf('0x5'))(_0xdcdf('0x6'));var config=require(_0xdcdf('0x7'));var jayson=require(_0xdcdf('0x8'));var client=jayson[_0xdcdf('0x9')][_0xdcdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b095,_0xbf166a,_0x49051c){return new BPromise(function(_0x24993c,_0x356b1a){return client[_0xdcdf('0xb')](_0x25b095,_0x49051c)[_0xdcdf('0xc')](function(_0x12310c){logger[_0xdcdf('0xd')](_0xdcdf('0xe'),_0xbf166a,'request\x20sent');logger[_0xdcdf('0xf')](_0xdcdf('0x10'),_0xbf166a,_0xdcdf('0x11'),JSON['stringify'](_0x12310c));if(_0x12310c[_0xdcdf('0x12')]){if(_0x12310c[_0xdcdf('0x12')][_0xdcdf('0x13')]===0x1f4){logger[_0xdcdf('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0xbf166a,_0x12310c[_0xdcdf('0x12')][_0xdcdf('0x14')]);return _0x356b1a(_0x12310c[_0xdcdf('0x12')][_0xdcdf('0x14')]);}logger[_0xdcdf('0x12')](_0xdcdf('0xe'),_0xbf166a,_0x12310c[_0xdcdf('0x12')]['message']);return _0x24993c(_0x12310c[_0xdcdf('0x12')]['message']);}else{logger[_0xdcdf('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0xbf166a,'request\x20sent');_0x24993c(_0x12310c['result'][_0xdcdf('0x14')]);}})[_0xdcdf('0x15')](function(_0x1ba161){logger[_0xdcdf('0x12')](_0xdcdf('0xe'),_0xbf166a,_0x1ba161);_0x356b1a(_0x1ba161);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6b40c7e..a0e8bcf 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1649ee,_0x12e255){var _0x303c03=function(_0xababbf){while(--_0xababbf){_0x1649ee['push'](_0x1649ee['shift']());}};_0x303c03(++_0x12e255);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xcb91[_0x470f63];return _0x4f09e2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bbbc8,_0x31b6d9){var _0x1b8f35=function(_0x30c08){while(--_0x30c08){_0x3bbbc8['push'](_0x3bbbc8['shift']());}};_0x1b8f35(++_0x31b6d9);}(_0xe706,0xa3));var _0x6e70=function(_0x54e9e7,_0x337069){_0x54e9e7=_0x54e9e7-0x0;var _0x3d4d8c=_0xe706[_0x54e9e7];return _0x3d4d8c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5db901f..3ba7a7a 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 _0xeedb=['sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeedb,0xc6));var _0xbeed=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xeedb[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xbeed('0x0'));module[_0xbeed('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbeed('0x2')},'membername':{'type':Sequelize[_0xbeed('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xbeed('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xbeed('0x2')},'VoiceQueueId':{'type':Sequelize[_0xbeed('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xbeed('0x3')],'allowNull':![],'unique':_0xbeed('0x5'),'comment':_0xbeed('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xbeed('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xbeed('0x2')}}; \ No newline at end of file +var _0x0efc=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0efc,0x1b2));var _0xc0ef=function(_0x5d7696,_0x185685){_0x5d7696=_0x5d7696-0x0;var _0x39297c=_0x0efc[_0x5d7696];return _0x39297c;};'use strict';var Sequelize=require(_0xc0ef('0x0'));module[_0xc0ef('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc0ef('0x2')},'membername':{'type':Sequelize[_0xc0ef('0x3')],'allowNull':![],'comment':_0xc0ef('0x2')},'UserId':{'type':Sequelize[_0xc0ef('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc0ef('0x3')],'allowNull':![],'unique':_0xc0ef('0x5'),'comment':_0xc0ef('0x2')},'VoiceQueueId':{'type':Sequelize[_0xc0ef('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc0ef('0x5'),'comment':_0xc0ef('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xc0ef('0x2')},'paused':{'type':Sequelize[_0xc0ef('0x4')](0xb),'defaultValue':0x0,'comment':_0xc0ef('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2c906bc..a8d11f3 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 _0xd5c4=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x506ff5,_0x16d10f){var _0x2bd51b=function(_0x1a7f2b){while(--_0x1a7f2b){_0x506ff5['push'](_0x506ff5['shift']());}};_0x2bd51b(++_0x16d10f);}(_0xd5c4,0x15b));var _0x4d5c=function(_0x201948,_0xe034e0){_0x201948=_0x201948-0x0;var _0x10ad14=_0xd5c4[_0x201948];return _0x10ad14;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4d5c('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4d5c('0x1')](0x0);var events={'afterCreate':_0x4d5c('0x2'),'afterUpdate':_0x4d5c('0x3'),'afterDestroy':_0x4d5c('0x4')};function emitEvent(_0x34341f){return function(_0x2dd8f9,_0x4eca48,_0xe90faf){UserVoiceQueueRtEvents['emit'](_0x34341f+':'+_0x2dd8f9['id'],_0x2dd8f9);UserVoiceQueueRtEvents[_0x4d5c('0x5')](_0x34341f,_0x2dd8f9);_0xe90faf(null);};}for(var e in events){if(events[_0x4d5c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x4d5c('0x7')](e,emitEvent(event));}}module[_0x4d5c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x6ae3=['hasOwnProperty','hook','exports','events','save','update','remove','emit'];(function(_0x1b35a3,_0x4f8bc9){var _0xa8579=function(_0x5e15bc){while(--_0x5e15bc){_0x1b35a3['push'](_0x1b35a3['shift']());}};_0xa8579(++_0x4f8bc9);}(_0x6ae3,0x11b));var _0x36ae=function(_0x24ab5c,_0x22a4e1){_0x24ab5c=_0x24ab5c-0x0;var _0x13aff2=_0x6ae3[_0x24ab5c];return _0x13aff2;};'use strict';var EventEmitter=require(_0x36ae('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36ae('0x1'),'afterUpdate':_0x36ae('0x2'),'afterDestroy':_0x36ae('0x3')};function emitEvent(_0x5caa13){return function(_0x1de814,_0x18e450,_0x35940f){UserVoiceQueueRtEvents[_0x36ae('0x4')](_0x5caa13+':'+_0x1de814['id'],_0x1de814);UserVoiceQueueRtEvents['emit'](_0x5caa13,_0x1de814);_0x35940f(null);};}for(var e in events){if(events[_0x36ae('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x36ae('0x6')](e,emitEvent(event));}}module[_0x36ae('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 465a32f..7672b72 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 _0xc6c1=['path','rimraf','../../config/environment','exports','define','UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ffa1b,_0x205ae8){var _0x471fee=function(_0x256a09){while(--_0x256a09){_0x1ffa1b['push'](_0x1ffa1b['shift']());}};_0x471fee(++_0x205ae8);}(_0xc6c1,0xde));var _0x1c6c=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xc6c1[_0x4e8286];return _0x44a440;};'use strict';var _=require(_0x1c6c('0x0'));var util=require('util');var logger=require(_0x1c6c('0x1'))(_0x1c6c('0x2'));var moment=require(_0x1c6c('0x3'));var BPromise=require(_0x1c6c('0x4'));var rp=require(_0x1c6c('0x5'));var fs=require('fs');var path=require(_0x1c6c('0x6'));var rimraf=require(_0x1c6c('0x7'));var config=require(_0x1c6c('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x1c6c('0x9')]=function(_0xba99bf,_0x2e4275){return _0xba99bf[_0x1c6c('0xa')](_0x1c6c('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d7a=['./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x51eab5,_0x22c032){var _0x2ceeee=function(_0x51cfde){while(--_0x51cfde){_0x51eab5['push'](_0x51eab5['shift']());}};_0x2ceeee(++_0x22c032);}(_0x5d7a,0x12c));var _0xa5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa5d7('0x0'));var util=require(_0xa5d7('0x1'));var logger=require(_0xa5d7('0x2'))(_0xa5d7('0x3'));var moment=require(_0xa5d7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5d7('0x5'));var rimraf=require(_0xa5d7('0x6'));var config=require(_0xa5d7('0x7'));var attributes=require(_0xa5d7('0x8'));module['exports']=function(_0xc30afb,_0x2aed5c){return _0xc30afb[_0xa5d7('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xa5d7('0xa'),'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 716d32e..1b5806f 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 _0x76de=['then','GetVoiceQueueRtPauses','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x23f510,_0x5bc3c8){var _0x47039e=function(_0x8f903f){while(--_0x8f903f){_0x23f510['push'](_0x23f510['shift']());}};_0x47039e(++_0x5bc3c8);}(_0x76de,0x14c));var _0xe76d=function(_0x491cb8,_0x2e36dc){_0x491cb8=_0x491cb8-0x0;var _0x35b8c9=_0x76de[_0x491cb8];return _0x35b8c9;};'use strict';var _=require(_0xe76d('0x0'));var util=require('util');var moment=require(_0xe76d('0x1'));var BPromise=require(_0xe76d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe76d('0x3'));var db=require(_0xe76d('0x4'))['db'];var utils=require(_0xe76d('0x5'));var logger=require(_0xe76d('0x6'))(_0xe76d('0x7'));var config=require('../../config/environment');var jayson=require(_0xe76d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xe76d('0x9')]=_['defaults'](config[_0xe76d('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe76d('0x9')]));require(_0xe76d('0xa'))[_0xe76d('0xb')](socket);function respondWithRpcPromise(_0x44ab3f,_0x142007,_0x3190f8){return new BPromise(function(_0x5613a5,_0x4937d9){return client['request'](_0x44ab3f,_0x3190f8)['then'](function(_0x4c7213){logger[_0xe76d('0xc')](_0xe76d('0xd'),_0x142007,_0xe76d('0xe'));logger[_0xe76d('0xf')](_0xe76d('0x10'),_0x142007,'request\x20sent',JSON[_0xe76d('0x11')](_0x4c7213));if(_0x4c7213[_0xe76d('0x12')]){if(_0x4c7213['error'][_0xe76d('0x13')]===0x1f4){logger[_0xe76d('0x12')](_0xe76d('0xd'),_0x142007,_0x4c7213[_0xe76d('0x12')]['message']);return _0x4937d9(_0x4c7213[_0xe76d('0x12')][_0xe76d('0x14')]);}logger['error'](_0xe76d('0xd'),_0x142007,_0x4c7213[_0xe76d('0x12')][_0xe76d('0x14')]);return _0x5613a5(_0x4c7213[_0xe76d('0x12')][_0xe76d('0x14')]);}else{logger[_0xe76d('0xc')](_0xe76d('0xd'),_0x142007,_0xe76d('0xe'));_0x5613a5(_0x4c7213[_0xe76d('0x15')][_0xe76d('0x14')]);}})[_0xe76d('0x16')](function(_0x226241){logger[_0xe76d('0x12')](_0xe76d('0xd'),_0x142007,_0x226241);_0x4937d9(_0x226241);});});}exports['GetVoiceQueueRtPauses']=function(_0x1a90ab){var _0x23eacf=this;return new Promise(function(_0x12e7f9,_0x372ca2){return db['UserVoiceQueueRt'][_0xe76d('0x17')]({'raw':_0x1a90ab[_0xe76d('0x18')]?_0x1a90ab[_0xe76d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a90ab[_0xe76d('0x18')]?_0x1a90ab[_0xe76d('0x18')][_0xe76d('0x19')]||null:null,'attributes':[[db[_0xe76d('0x1a')]['fn'](_0xe76d('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0xe76d('0x1c')](_0xe76d('0x1d')))),_0xe76d('0x1e')]]})[_0xe76d('0x1f')](function(_0x2f7135){logger[_0xe76d('0xc')](_0xe76d('0x20'),_0x1a90ab);logger[_0xe76d('0xf')](_0xe76d('0x20'),_0x1a90ab,JSON[_0xe76d('0x11')](_0x2f7135));_0x12e7f9(_0x2f7135);})[_0xe76d('0x16')](function(_0x21d609){logger[_0xe76d('0x12')](_0xe76d('0x20'),_0x21d609[_0xe76d('0x14')],_0x1a90ab);_0x372ca2(_0x23eacf[_0xe76d('0x12')](0x1f4,_0x21d609['message']));});});}; \ No newline at end of file +var _0xaf1e=['redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','defaults'];(function(_0x151ceb,_0x5e0daf){var _0x55cf39=function(_0x5b086e){while(--_0x5b086e){_0x151ceb['push'](_0x151ceb['shift']());}};_0x55cf39(++_0x5e0daf);}(_0xaf1e,0x16c));var _0xeaf1=function(_0x132fd5,_0x4958f8){_0x132fd5=_0x132fd5-0x0;var _0x26ba9c=_0xaf1e[_0x132fd5];return _0x26ba9c;};'use strict';var _=require(_0xeaf1('0x0'));var util=require('util');var moment=require(_0xeaf1('0x1'));var BPromise=require('bluebird');var rs=require(_0xeaf1('0x2'));var fs=require('fs');var Redis=require(_0xeaf1('0x3'));var db=require(_0xeaf1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeaf1('0x5'))(_0xeaf1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeaf1('0x7')][_0xeaf1('0x8')]({'port':0x232a});config['redis']=_[_0xeaf1('0x9')](config[_0xeaf1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xeaf1('0xb'))(new Redis(config['redis']));require(_0xeaf1('0xc'))[_0xeaf1('0xd')](socket);function respondWithRpcPromise(_0x2f4b8f,_0x480bf6,_0x5d1f3f){return new BPromise(function(_0x43238a,_0x4977ca){return client['request'](_0x2f4b8f,_0x5d1f3f)[_0xeaf1('0xe')](function(_0x3f888d){logger[_0xeaf1('0xf')](_0xeaf1('0x10'),_0x480bf6,_0xeaf1('0x11'));logger[_0xeaf1('0x12')](_0xeaf1('0x13'),_0x480bf6,'request\x20sent',JSON['stringify'](_0x3f888d));if(_0x3f888d[_0xeaf1('0x14')]){if(_0x3f888d[_0xeaf1('0x14')][_0xeaf1('0x15')]===0x1f4){logger[_0xeaf1('0x14')](_0xeaf1('0x10'),_0x480bf6,_0x3f888d[_0xeaf1('0x14')][_0xeaf1('0x16')]);return _0x4977ca(_0x3f888d['error'][_0xeaf1('0x16')]);}logger[_0xeaf1('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x480bf6,_0x3f888d['error'][_0xeaf1('0x16')]);return _0x43238a(_0x3f888d['error'][_0xeaf1('0x16')]);}else{logger[_0xeaf1('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x480bf6,_0xeaf1('0x11'));_0x43238a(_0x3f888d[_0xeaf1('0x17')][_0xeaf1('0x16')]);}})['catch'](function(_0x27dd47){logger[_0xeaf1('0x14')](_0xeaf1('0x10'),_0x480bf6,_0x27dd47);_0x4977ca(_0x27dd47);});});}exports[_0xeaf1('0x18')]=function(_0x3726fa){var _0xcbe16a=this;return new Promise(function(_0x2721fd,_0x31e9af){return db[_0xeaf1('0x19')][_0xeaf1('0x1a')]({'raw':_0x3726fa['options']?_0x3726fa[_0xeaf1('0x1b')][_0xeaf1('0x1c')]===undefined?!![]:![]:!![],'where':_0x3726fa[_0xeaf1('0x1b')]?_0x3726fa[_0xeaf1('0x1b')]['where']||null:null,'attributes':[[db[_0xeaf1('0x1d')]['fn'](_0xeaf1('0x1e'),db[_0xeaf1('0x1d')]['fn']('IF',db[_0xeaf1('0x1d')][_0xeaf1('0x1f')](_0xeaf1('0x20')))),_0xeaf1('0x21')]]})['then'](function(_0x5dc792){logger[_0xeaf1('0xf')](_0xeaf1('0x18'),_0x3726fa);logger[_0xeaf1('0x12')]('GetVoiceQueueRtPauses',_0x3726fa,JSON['stringify'](_0x5dc792));_0x2721fd(_0x5dc792);})['catch'](function(_0x1815f5){logger['error'](_0xeaf1('0x18'),_0x1815f5[_0xeaf1('0x16')],_0x3726fa);_0x31e9af(_0xcbe16a[_0xeaf1('0x14')](0x1f4,_0x1815f5[_0xeaf1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a643a26..7baa445 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 _0x4d61=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x3166f6,_0x4f0867){var _0xaf5375=function(_0x13bc8d){while(--_0x13bc8d){_0x3166f6['push'](_0x3166f6['shift']());}};_0xaf5375(++_0x4f0867);}(_0x4d61,0x147));var _0x14d6=function(_0x5d247d,_0xb91986){_0x5d247d=_0x5d247d-0x0;var _0x49dfa9=_0x4d61[_0x5d247d];return _0x49dfa9;};'use strict';var UserVoiceQueueRtEvents=require(_0x14d6('0x0'));var events=[_0x14d6('0x1'),_0x14d6('0x2'),_0x14d6('0x3')];function createListener(_0x128a58,_0x1f3eb8){return function(_0x1f4d14){_0x1f3eb8[_0x14d6('0x4')](_0x128a58,_0x1f4d14);};}function removeListener(_0x2950b7,_0x5da268){return function(){UserVoiceQueueRtEvents[_0x14d6('0x5')](_0x2950b7,_0x5da268);};}exports[_0x14d6('0x6')]=function(_0x2920fe){for(var _0x11b2c0=0x0,_0x349eac=events[_0x14d6('0x7')];_0x11b2c0<_0x349eac;_0x11b2c0++){var _0x344fb8=events[_0x11b2c0];var _0x52eb2d=createListener(_0x14d6('0x8')+_0x344fb8,_0x2920fe);UserVoiceQueueRtEvents['on'](_0x344fb8,_0x52eb2d);}}; \ No newline at end of file +var _0x9865=['remove','update','emit','register','./userVoiceQueueRt.events','save'];(function(_0x46229a,_0x5b7fbc){var _0xd68564=function(_0x2bc901){while(--_0x2bc901){_0x46229a['push'](_0x46229a['shift']());}};_0xd68564(++_0x5b7fbc);}(_0x9865,0x1ba));var _0x5986=function(_0x304ac0,_0x5730ef){_0x304ac0=_0x304ac0-0x0;var _0x1b9124=_0x9865[_0x304ac0];return _0x1b9124;};'use strict';var UserVoiceQueueRtEvents=require(_0x5986('0x0'));var events=[_0x5986('0x1'),_0x5986('0x2'),_0x5986('0x3')];function createListener(_0x61e2c2,_0x39087c){return function(_0xa3e29d){_0x39087c[_0x5986('0x4')](_0x61e2c2,_0xa3e29d);};}function removeListener(_0x236420,_0xef2d15){return function(){UserVoiceQueueRtEvents['removeListener'](_0x236420,_0xef2d15);};}exports[_0x5986('0x5')]=function(_0x35e6f8){for(var _0x3ac862=0x0,_0x120c57=events['length'];_0x3ac862<_0x120c57;_0x3ac862++){var _0x4ba72c=events[_0x3ac862];var _0x68938c=createListener('userVoiceQueueRt:'+_0x4ba72c,_0x35e6f8);UserVoiceQueueRtEvents['on'](_0x4ba72c,_0x68938c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f29f900..e08d1f9 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xc814e9,_0x2d1d0f){var _0x5f4d06=function(_0x41f1ef){while(--_0x41f1ef){_0xc814e9['push'](_0xc814e9['shift']());}};_0x5f4d06(++_0x2d1d0f);}(_0x70e0,0x17b));var _0x070e=function(_0x3e3d60,_0x25004d){_0x3e3d60=_0x3e3d60-0x0;var _0x2f1982=_0x70e0[_0x3e3d60];return _0x2f1982;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x65e216,_0x568bd5){var _0x4e3e06=function(_0x351fc0){while(--_0x351fc0){_0x65e216['push'](_0x65e216['shift']());}};_0x4e3e06(++_0x568bd5);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1068056..a572dbc 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 _0xe0ff=['exports','INTEGER','sequelize'];(function(_0x55a144,_0x4242ca){var _0x5722f9=function(_0x5cd81c){while(--_0x5cd81c){_0x55a144['push'](_0x55a144['shift']());}};_0x5722f9(++_0x4242ca);}(_0xe0ff,0x116));var _0xfe0f=function(_0xbbf96e,_0x5250b3){_0xbbf96e=_0xbbf96e-0x0;var _0x3f7af1=_0xe0ff[_0xbbf96e];return _0x3f7af1;};'use strict';var Sequelize=require(_0xfe0f('0x0'));module[_0xfe0f('0x1')]={'penalty':{'type':Sequelize[_0xfe0f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd94d=['exports','sequelize'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xd94d,0x1eb));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdd94('0x0'));module[_0xdd94('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 68ac6f0..cad0d41 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 _0x6fed=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0xf6dc14,_0x113164){var _0x2643c0=function(_0x48afdc){while(--_0x48afdc){_0xf6dc14['push'](_0xf6dc14['shift']());}};_0x2643c0(++_0x113164);}(_0x6fed,0x1e3));var _0xd6fe=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6fed[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd6fe('0x0'));var util=require(_0xd6fe('0x1'));var logger=require(_0xd6fe('0x2'))(_0xd6fe('0x3'));var moment=require(_0xd6fe('0x4'));var BPromise=require(_0xd6fe('0x5'));var rp=require(_0xd6fe('0x6'));var fs=require('fs');var path=require(_0xd6fe('0x7'));var rimraf=require(_0xd6fe('0x8'));var config=require(_0xd6fe('0x9'));var attributes=require(_0xd6fe('0xa'));module[_0xd6fe('0xb')]=function(_0x2a66c0,_0x34dea2){return _0x2a66c0[_0xd6fe('0xc')](_0xd6fe('0xd'),attributes,{'tableName':_0xd6fe('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd918=['user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x3ac055,_0x5257bb){var _0x10e457=function(_0x20e141){while(--_0x20e141){_0x3ac055['push'](_0x3ac055['shift']());}};_0x10e457(++_0x5257bb);}(_0xd918,0x105));var _0x8d91=function(_0x4c0592,_0x54540a){_0x4c0592=_0x4c0592-0x0;var _0x543529=_0xd918[_0x4c0592];return _0x543529;};'use strict';var _=require('lodash');var util=require(_0x8d91('0x0'));var logger=require(_0x8d91('0x1'))(_0x8d91('0x2'));var moment=require(_0x8d91('0x3'));var BPromise=require(_0x8d91('0x4'));var rp=require(_0x8d91('0x5'));var fs=require('fs');var path=require(_0x8d91('0x6'));var rimraf=require(_0x8d91('0x7'));var config=require(_0x8d91('0x8'));var attributes=require(_0x8d91('0x9'));module[_0x8d91('0xa')]=function(_0x5ea7da,_0x2d1b03){return _0x5ea7da[_0x8d91('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0x8d91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 4fe71e4..4daed27 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 _0x6f52=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f52,0x199));var _0x26f5=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x6f52[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x26f5('0x0'));var util=require(_0x26f5('0x1'));var moment=require(_0x26f5('0x2'));var BPromise=require(_0x26f5('0x3'));var rs=require(_0x26f5('0x4'));var fs=require('fs');var Redis=require(_0x26f5('0x5'));var db=require(_0x26f5('0x6'))['db'];var utils=require(_0x26f5('0x7'));var logger=require(_0x26f5('0x8'))('rpc');var config=require(_0x26f5('0x9'));var jayson=require(_0x26f5('0xa'));var client=jayson[_0x26f5('0xb')][_0x26f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20f636,_0x47a581,_0x2e6e00){return new BPromise(function(_0x50254d,_0x506c5d){return client[_0x26f5('0xd')](_0x20f636,_0x2e6e00)['then'](function(_0x43b651){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x47a581,_0x26f5('0xe'));logger[_0x26f5('0xf')](_0x26f5('0x10'),_0x47a581,_0x26f5('0xe'),JSON[_0x26f5('0x11')](_0x43b651));if(_0x43b651[_0x26f5('0x12')]){if(_0x43b651[_0x26f5('0x12')]['code']===0x1f4){logger[_0x26f5('0x12')](_0x26f5('0x13'),_0x47a581,_0x43b651[_0x26f5('0x12')][_0x26f5('0x14')]);return _0x506c5d(_0x43b651[_0x26f5('0x12')]['message']);}logger[_0x26f5('0x12')](_0x26f5('0x13'),_0x47a581,_0x43b651[_0x26f5('0x12')][_0x26f5('0x14')]);return _0x50254d(_0x43b651['error'][_0x26f5('0x14')]);}else{logger[_0x26f5('0x15')](_0x26f5('0x13'),_0x47a581,_0x26f5('0xe'));_0x50254d(_0x43b651['result'][_0x26f5('0x14')]);}})[_0x26f5('0x16')](function(_0x225462){logger[_0x26f5('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x47a581,_0x225462);_0x506c5d(_0x225462);});});} \ No newline at end of file +var _0x61a6=['debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','rpc','jayson/promise','request','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0xd8be32,_0x4d45de){var _0x2fb360=function(_0x14a3d3){while(--_0x14a3d3){_0xd8be32['push'](_0xd8be32['shift']());}};_0x2fb360(++_0x4d45de);}(_0x61a6,0x118));var _0x661a=function(_0x1cd0d2,_0x11fcfa){_0x1cd0d2=_0x1cd0d2-0x0;var _0x32bb0a=_0x61a6[_0x1cd0d2];return _0x32bb0a;};'use strict';var _=require(_0x661a('0x0'));var util=require(_0x661a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x661a('0x2'));var fs=require('fs');var Redis=require(_0x661a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x661a('0x4'));var config=require('../../config/environment');var jayson=require(_0x661a('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42be30,_0x3d4942,_0x2d008c){return new BPromise(function(_0xea6ab6,_0x317ad7){return client[_0x661a('0x6')](_0x42be30,_0x2d008c)['then'](function(_0x2dd6af){logger[_0x661a('0x7')](_0x661a('0x8'),_0x3d4942,'request\x20sent');logger[_0x661a('0x9')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d4942,'request\x20sent',JSON[_0x661a('0xa')](_0x2dd6af));if(_0x2dd6af[_0x661a('0xb')]){if(_0x2dd6af[_0x661a('0xb')][_0x661a('0xc')]===0x1f4){logger[_0x661a('0xb')](_0x661a('0x8'),_0x3d4942,_0x2dd6af[_0x661a('0xb')]['message']);return _0x317ad7(_0x2dd6af[_0x661a('0xb')][_0x661a('0xd')]);}logger[_0x661a('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d4942,_0x2dd6af[_0x661a('0xb')][_0x661a('0xd')]);return _0xea6ab6(_0x2dd6af['error'][_0x661a('0xd')]);}else{logger[_0x661a('0x7')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d4942,_0x661a('0xe'));_0xea6ab6(_0x2dd6af[_0x661a('0xf')][_0x661a('0xd')]);}})[_0x661a('0x10')](function(_0x2ca52b){logger['error'](_0x661a('0x8'),_0x3d4942,_0x2ca52b);_0x317ad7(_0x2ca52b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 80a94ff..f99861f 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 _0x2209=['post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2209,0x95));var _0x9220=function(_0x5dc595,_0x468797){_0x5dc595=_0x5dc595-0x0;var _0x4d83a0=_0x2209[_0x5dc595];return _0x4d83a0;};'use strict';var multer=require(_0x9220('0x0'));var util=require(_0x9220('0x1'));var path=require(_0x9220('0x2'));var timeout=require(_0x9220('0x3'));var express=require(_0x9220('0x4'));var router=express['Router']();var fs_extra=require(_0x9220('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9220('0x6'));var config=require(_0x9220('0x7'));var controller=require(_0x9220('0x8'));router[_0x9220('0x9')]('/',auth[_0x9220('0xa')](),controller[_0x9220('0xb')]);router[_0x9220('0x9')](_0x9220('0xc'),auth[_0x9220('0xa')](),controller['show']);router[_0x9220('0xd')]('/',auth[_0x9220('0xa')](),controller['create']);router[_0x9220('0xe')](_0x9220('0xc'),auth[_0x9220('0xa')](),controller[_0x9220('0xf')]);router['delete'](_0x9220('0xc'),auth[_0x9220('0xa')](),controller[_0x9220('0x10')]);module[_0x9220('0x11')]=router; \ No newline at end of file +var _0x524a=['create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated','show'];(function(_0x4469a3,_0x12e82e){var _0x348f88=function(_0x1a1b81){while(--_0x1a1b81){_0x4469a3['push'](_0x4469a3['shift']());}};_0x348f88(++_0x12e82e);}(_0x524a,0xf5));var _0xa524=function(_0x542c47,_0x1df50f){_0x542c47=_0x542c47-0x0;var _0x11464f=_0x524a[_0x542c47];return _0x11464f;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xa')]);router['post']('/',auth[_0xa524('0x9')](),controller[_0xa524('0xb')]);router[_0xa524('0xc')](_0xa524('0xd'),auth[_0xa524('0x9')](),controller['update']);router[_0xa524('0xe')](_0xa524('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa524('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 73e36bc..cf5a23e 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 _0xc285=['sequelize','exports','STRING','name'];(function(_0x55c97f,_0x19c312){var _0x91a967=function(_0x28caee){while(--_0x28caee){_0x55c97f['push'](_0x55c97f['shift']());}};_0x91a967(++_0x19c312);}(_0xc285,0xcc));var _0x5c28=function(_0x3cb0c1,_0x3abf86){_0x3cb0c1=_0x3cb0c1-0x0;var _0x568306=_0xc285[_0x3cb0c1];return _0x568306;};'use strict';var Sequelize=require(_0x5c28('0x0'));module[_0x5c28('0x1')]={'name':{'type':Sequelize[_0x5c28('0x2')],'unique':_0x5c28('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xceb1=['STRING','name','sequelize','exports'];(function(_0x26367c,_0x34080a){var _0x109bfb=function(_0x334e11){while(--_0x334e11){_0x26367c['push'](_0x26367c['shift']());}};_0x109bfb(++_0x34080a);}(_0xceb1,0x10a));var _0x1ceb=function(_0x178aa4,_0xfad0e7){_0x178aa4=_0x178aa4-0x0;var _0x39ba6b=_0xceb1[_0x178aa4];return _0x39ba6b;};'use strict';var Sequelize=require(_0x1ceb('0x0'));module[_0x1ceb('0x1')]={'name':{'type':Sequelize[_0x1ceb('0x2')],'unique':_0x1ceb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ceb('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c7e144d..2f5a989 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 _0xba6f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','Variable','includeAll','findAll','rows','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2cdfe7,_0x34edf9){var _0x5900e0=function(_0x127b8c){while(--_0x127b8c){_0x2cdfe7['push'](_0x2cdfe7['shift']());}};_0x5900e0(++_0x34edf9);}(_0xba6f,0xa4));var _0xfba6=function(_0x2f10e3,_0x5018fe){_0x2f10e3=_0x2f10e3-0x0;var _0x37264=_0xba6f[_0x2f10e3];return _0x37264;};'use strict';var emlformat=require(_0xfba6('0x0'));var rimraf=require(_0xfba6('0x1'));var zipdir=require(_0xfba6('0x2'));var jsonpatch=require(_0xfba6('0x3'));var rp=require('request-promise');var moment=require(_0xfba6('0x4'));var BPromise=require(_0xfba6('0x5'));var Mustache=require(_0xfba6('0x6'));var util=require('util');var path=require(_0xfba6('0x7'));var sox=require(_0xfba6('0x8'));var csv=require(_0xfba6('0x9'));var ejs=require(_0xfba6('0xa'));var fs=require('fs');var fs_extra=require(_0xfba6('0xb'));var _=require(_0xfba6('0xc'));var squel=require(_0xfba6('0xd'));var crypto=require(_0xfba6('0xe'));var jsforce=require(_0xfba6('0xf'));var deskjs=require(_0xfba6('0x10'));var toCsv=require(_0xfba6('0x9'));var querystring=require(_0xfba6('0x11'));var Papa=require(_0xfba6('0x12'));var Redis=require(_0xfba6('0x13'));var authService=require(_0xfba6('0x14'));var qs=require(_0xfba6('0x15'));var as=require(_0xfba6('0x16'));var hardwareService=require(_0xfba6('0x17'));var logger=require(_0xfba6('0x18'))(_0xfba6('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfba6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfa0c5b,_0x3a671e){_0x3a671e=_0x3a671e||0xcc;return function(_0x14546f){if(_0x14546f){return _0xfa0c5b['sendStatus'](_0x3a671e);}return _0xfa0c5b[_0xfba6('0x1b')](_0x3a671e)[_0xfba6('0x1c')]();};}function respondWithResult(_0x472b0a,_0x2f24ab){_0x2f24ab=_0x2f24ab||0xc8;return function(_0x110b16){if(_0x110b16){return _0x472b0a['status'](_0x2f24ab)[_0xfba6('0x1d')](_0x110b16);}};}function respondWithFilteredResult(_0x4df819,_0x282b31){return function(_0x4d15d5){if(_0x4d15d5){var _0x19613c=typeof _0x282b31[_0xfba6('0x1e')]===_0xfba6('0x1f')&&typeof _0x282b31[_0xfba6('0x20')]===_0xfba6('0x1f');var _0x3b02f9=_0x4d15d5[_0xfba6('0x21')];var _0x27b8a6=_0x19613c?0x0:_0x282b31[_0xfba6('0x1e')];var _0x104e13=_0x19613c?_0x4d15d5[_0xfba6('0x21')]:_0x282b31['offset']+_0x282b31[_0xfba6('0x20')];var _0x5c5b30;if(_0x104e13>=_0x3b02f9){_0x104e13=_0x3b02f9;_0x5c5b30=0xc8;}else{_0x5c5b30=0xce;}_0x4df819[_0xfba6('0x1b')](_0x5c5b30);return _0x4df819[_0xfba6('0x22')](_0xfba6('0x23'),_0x27b8a6+'-'+_0x104e13+'/'+_0x3b02f9)['json'](_0x4d15d5);}return null;};}function patchUpdates(_0x2ce597){return function(_0x50c14c){try{jsonpatch[_0xfba6('0x24')](_0x50c14c,_0x2ce597,!![]);}catch(_0x2bb6c8){return BPromise[_0xfba6('0x25')](_0x2bb6c8);}return _0x50c14c[_0xfba6('0x26')]();};}function saveUpdates(_0x56eab8,_0x4dbcc5){return function(_0x3616a0){if(_0x3616a0){return _0x3616a0[_0xfba6('0x27')](_0x56eab8)[_0xfba6('0x28')](function(_0x4297e7){return _0x4297e7;});}return null;};}function removeEntity(_0x208c4e,_0x36f96f){return function(_0x51c991){if(_0x51c991){return _0x51c991[_0xfba6('0x29')]()['then'](function(){var _0x27e3a5=_0x51c991['get']({'plain':!![]});var _0x4ba8a0=_0xfba6('0x2a');return db[_0xfba6('0x2b')]['destroy']({'where':{'type':_0x4ba8a0,'resourceId':_0x27e3a5['id']}})[_0xfba6('0x28')](function(){return _0x51c991;});})['then'](function(){_0x208c4e['status'](0xcc)[_0xfba6('0x1c')]();});}};}function handleEntityNotFound(_0x5d7012,_0x5ddae1){return function(_0x5b1d64){if(!_0x5b1d64){_0x5d7012[_0xfba6('0x2c')](0x194);}return _0x5b1d64;};}function handleError(_0x4e229e,_0x43de34){_0x43de34=_0x43de34||0x1f4;return function(_0x48e77f){logger[_0xfba6('0x2d')](_0x48e77f[_0xfba6('0x2e')]);if(_0x48e77f[_0xfba6('0x2f')]){delete _0x48e77f[_0xfba6('0x2f')];}_0x4e229e[_0xfba6('0x1b')](_0x43de34)[_0xfba6('0x30')](_0x48e77f);};}exports['index']=function(_0x24d0df,_0x46b2ed){var _0xe2c83f={},_0x20d098={},_0x401b61={'count':0x0,'rows':[]};var _0x1c177b=_['map'](db['Variable'][_0xfba6('0x31')],function(_0x5c1fd2){return{'name':_0x5c1fd2[_0xfba6('0x32')],'type':_0x5c1fd2[_0xfba6('0x33')][_0xfba6('0x34')]};});_0x20d098[_0xfba6('0x35')]=_['map'](_0x1c177b,_0xfba6('0x2f'));_0x20d098[_0xfba6('0x36')]=_[_0xfba6('0x37')](_0x24d0df[_0xfba6('0x36')]);_0x20d098[_0xfba6('0x38')]=_[_0xfba6('0x39')](_0x20d098['model'],_0x20d098[_0xfba6('0x36')]);_0xe2c83f[_0xfba6('0x3a')]=_[_0xfba6('0x39')](_0x20d098[_0xfba6('0x35')],qs[_0xfba6('0x3b')](_0x24d0df[_0xfba6('0x36')][_0xfba6('0x3b')]));_0xe2c83f['attributes']=_0xe2c83f['attributes'][_0xfba6('0x3c')]?_0xe2c83f[_0xfba6('0x3a')]:_0x20d098['model'];if(!_0x24d0df['query'][_0xfba6('0x3d')](_0xfba6('0x3e'))){_0xe2c83f[_0xfba6('0x20')]=qs[_0xfba6('0x20')](_0x24d0df[_0xfba6('0x36')][_0xfba6('0x20')]);_0xe2c83f[_0xfba6('0x1e')]=qs['offset'](_0x24d0df[_0xfba6('0x36')][_0xfba6('0x1e')]);}_0xe2c83f[_0xfba6('0x3f')]=qs[_0xfba6('0x40')](_0x24d0df[_0xfba6('0x36')][_0xfba6('0x40')]);_0xe2c83f[_0xfba6('0x41')]=qs[_0xfba6('0x38')](_[_0xfba6('0x42')](_0x24d0df[_0xfba6('0x36')],_0x20d098[_0xfba6('0x38')]),_0x1c177b);if(_0x24d0df[_0xfba6('0x36')][_0xfba6('0x43')]){_0xe2c83f[_0xfba6('0x41')]=_['merge'](_0xe2c83f[_0xfba6('0x41')],{'$or':_[_0xfba6('0x44')](_0x1c177b,function(_0x502bf7){if(_0x502bf7['type']!==_0xfba6('0x45')){var _0x3d27e9={};_0x3d27e9[_0x502bf7[_0xfba6('0x2f')]]={'$like':'%'+_0x24d0df['query'][_0xfba6('0x43')]+'%'};return _0x3d27e9;}})});}_0xe2c83f=_[_0xfba6('0x46')]({},_0xe2c83f,_0x24d0df[_0xfba6('0x47')]);var _0x2b5f6b={'where':_0xe2c83f[_0xfba6('0x41')]};return db[_0xfba6('0x48')][_0xfba6('0x21')](_0x2b5f6b)[_0xfba6('0x28')](function(_0x10da57){_0x401b61[_0xfba6('0x21')]=_0x10da57;if(_0x24d0df[_0xfba6('0x36')][_0xfba6('0x49')]){_0xe2c83f['include']=[{'all':!![]}];}return db[_0xfba6('0x48')][_0xfba6('0x4a')](_0xe2c83f);})[_0xfba6('0x28')](function(_0xc9705f){_0x401b61[_0xfba6('0x4b')]=_0xc9705f;return _0x401b61;})[_0xfba6('0x28')](respondWithFilteredResult(_0x46b2ed,_0xe2c83f))['catch'](handleError(_0x46b2ed,null));};exports[_0xfba6('0x4c')]=function(_0x118648,_0x188fe8){var _0x1e1983={'raw':!![],'where':{'id':_0x118648[_0xfba6('0x4d')]['id']}},_0x104453={};_0x104453[_0xfba6('0x35')]=_[_0xfba6('0x37')](db['Variable'][_0xfba6('0x31')]);_0x104453['query']=_[_0xfba6('0x37')](_0x118648['query']);_0x104453[_0xfba6('0x38')]=_[_0xfba6('0x39')](_0x104453[_0xfba6('0x35')],_0x104453[_0xfba6('0x36')]);_0x1e1983[_0xfba6('0x3a')]=_[_0xfba6('0x39')](_0x104453[_0xfba6('0x35')],qs[_0xfba6('0x3b')](_0x118648[_0xfba6('0x36')][_0xfba6('0x3b')]));_0x1e1983['attributes']=_0x1e1983[_0xfba6('0x3a')][_0xfba6('0x3c')]?_0x1e1983['attributes']:_0x104453['model'];if(_0x118648[_0xfba6('0x36')]['includeAll']){_0x1e1983[_0xfba6('0x4e')]=[{'all':!![]}];}_0x1e1983=_[_0xfba6('0x46')]({},_0x1e1983,_0x118648['options']);return db[_0xfba6('0x48')][_0xfba6('0x4f')](_0x1e1983)[_0xfba6('0x28')](handleEntityNotFound(_0x188fe8,null))['then'](respondWithResult(_0x188fe8,null))['catch'](handleError(_0x188fe8,null));};exports[_0xfba6('0x50')]=function(_0xe76628,_0x4c7696){return db[_0xfba6('0x48')][_0xfba6('0x50')](_0xe76628[_0xfba6('0x51')],{})[_0xfba6('0x28')](function(_0x5165cc){var _0x24907a=_0xe76628[_0xfba6('0x52')][_0xfba6('0x53')]({'plain':!![]});if(!_0x24907a)throw new Error(_0xfba6('0x54'));if(_0x24907a[_0xfba6('0x55')]===_0xfba6('0x52')){var _0x5d0668=_0x5165cc[_0xfba6('0x53')]({'plain':!![]});var _0x58fefd='Variables';return db[_0xfba6('0x56')][_0xfba6('0x4f')]({'where':{'name':_0x58fefd,'userProfileId':_0x24907a[_0xfba6('0x57')]},'raw':!![]})[_0xfba6('0x28')](function(_0x1c6ec7){if(_0x1c6ec7&&_0x1c6ec7[_0xfba6('0x58')]===0x0){return db[_0xfba6('0x2b')][_0xfba6('0x50')]({'name':_0x5d0668[_0xfba6('0x2f')],'resourceId':_0x5d0668['id'],'type':_0x1c6ec7[_0xfba6('0x2f')],'sectionId':_0x1c6ec7['id']},{})[_0xfba6('0x28')](function(){return _0x5165cc;});}else{return _0x5165cc;}})[_0xfba6('0x59')](function(_0x1c6557){logger[_0xfba6('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c6557);throw _0x1c6557;});}return _0x5165cc;})[_0xfba6('0x28')](respondWithResult(_0x4c7696,0xc9))[_0xfba6('0x59')](handleError(_0x4c7696,null));};exports[_0xfba6('0x27')]=function(_0x7a495d,_0x7651ab){if(_0x7a495d[_0xfba6('0x51')]['id']){delete _0x7a495d[_0xfba6('0x51')]['id'];}return db[_0xfba6('0x48')][_0xfba6('0x4f')]({'where':{'id':_0x7a495d[_0xfba6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7651ab,null))[_0xfba6('0x28')](saveUpdates(_0x7a495d['body'],null))[_0xfba6('0x28')](respondWithResult(_0x7651ab,null))[_0xfba6('0x59')](handleError(_0x7651ab,null));};exports[_0xfba6('0x29')]=function(_0xaca955,_0xf1ed1a){return db['Variable'][_0xfba6('0x4f')]({'where':{'id':_0xaca955['params']['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0xf1ed1a,null))[_0xfba6('0x28')](removeEntity(_0xf1ed1a,null))[_0xfba6('0x59')](handleError(_0xf1ed1a,null));}; \ No newline at end of file +var _0x0abc=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','Variable','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','user','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x347372,_0x5f45d9){var _0x21df6e=function(_0x1bbe20){while(--_0x1bbe20){_0x347372['push'](_0x347372['shift']());}};_0x21df6e(++_0x5f45d9);}(_0x0abc,0x188));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0ab('0x1'));var jsonpatch=require(_0xc0ab('0x2'));var rp=require('request-promise');var moment=require(_0xc0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0ab('0x4'));var util=require(_0xc0ab('0x5'));var path=require(_0xc0ab('0x6'));var sox=require(_0xc0ab('0x7'));var csv=require(_0xc0ab('0x8'));var ejs=require(_0xc0ab('0x9'));var fs=require('fs');var fs_extra=require(_0xc0ab('0xa'));var _=require(_0xc0ab('0xb'));var squel=require(_0xc0ab('0xc'));var crypto=require(_0xc0ab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc0ab('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc0ab('0xf'));var Papa=require(_0xc0ab('0x10'));var Redis=require('ioredis');var authService=require(_0xc0ab('0x11'));var qs=require(_0xc0ab('0x12'));var as=require(_0xc0ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0ab('0x14'))(_0xc0ab('0x15'));var utils=require(_0xc0ab('0x16'));var config=require(_0xc0ab('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a48c,_0x30482b){_0x30482b=_0x30482b||0xcc;return function(_0x460517){if(_0x460517){return _0x45a48c[_0xc0ab('0x18')](_0x30482b);}return _0x45a48c[_0xc0ab('0x19')](_0x30482b)['end']();};}function respondWithResult(_0x3db114,_0x4a1710){_0x4a1710=_0x4a1710||0xc8;return function(_0x5a6927){if(_0x5a6927){return _0x3db114[_0xc0ab('0x19')](_0x4a1710)['json'](_0x5a6927);}};}function respondWithFilteredResult(_0x3fd146,_0x277688){return function(_0x583220){if(_0x583220){var _0x23bbd9=typeof _0x277688[_0xc0ab('0x1a')]===_0xc0ab('0x1b')&&typeof _0x277688[_0xc0ab('0x1c')]===_0xc0ab('0x1b');var _0x2a632b=_0x583220[_0xc0ab('0x1d')];var _0x21196f=_0x23bbd9?0x0:_0x277688['offset'];var _0x545f54=_0x23bbd9?_0x583220[_0xc0ab('0x1d')]:_0x277688[_0xc0ab('0x1a')]+_0x277688[_0xc0ab('0x1c')];var _0x58a346;if(_0x545f54>=_0x2a632b){_0x545f54=_0x2a632b;_0x58a346=0xc8;}else{_0x58a346=0xce;}_0x3fd146['status'](_0x58a346);return _0x3fd146['set'](_0xc0ab('0x1e'),_0x21196f+'-'+_0x545f54+'/'+_0x2a632b)[_0xc0ab('0x1f')](_0x583220);}return null;};}function patchUpdates(_0x537bf2){return function(_0x546062){try{jsonpatch[_0xc0ab('0x20')](_0x546062,_0x537bf2,!![]);}catch(_0x56a689){return BPromise[_0xc0ab('0x21')](_0x56a689);}return _0x546062[_0xc0ab('0x22')]();};}function saveUpdates(_0x3e9747,_0x1b1f4a){return function(_0x55a2e3){if(_0x55a2e3){return _0x55a2e3[_0xc0ab('0x23')](_0x3e9747)[_0xc0ab('0x24')](function(_0x3d0258){return _0x3d0258;});}return null;};}function removeEntity(_0x34b756,_0x102029){return function(_0x1ff146){if(_0x1ff146){return _0x1ff146[_0xc0ab('0x25')]()[_0xc0ab('0x24')](function(){var _0x5e39e3=_0x1ff146[_0xc0ab('0x26')]({'plain':!![]});var _0x287471='Variables';return db[_0xc0ab('0x27')]['destroy']({'where':{'type':_0x287471,'resourceId':_0x5e39e3['id']}})[_0xc0ab('0x24')](function(){return _0x1ff146;});})[_0xc0ab('0x24')](function(){_0x34b756[_0xc0ab('0x19')](0xcc)[_0xc0ab('0x28')]();});}};}function handleEntityNotFound(_0x386aa9,_0x5934f6){return function(_0x4ab604){if(!_0x4ab604){_0x386aa9[_0xc0ab('0x18')](0x194);}return _0x4ab604;};}function handleError(_0x4c4253,_0x80d72c){_0x80d72c=_0x80d72c||0x1f4;return function(_0x5cc33c){logger[_0xc0ab('0x29')](_0x5cc33c[_0xc0ab('0x2a')]);if(_0x5cc33c[_0xc0ab('0x2b')]){delete _0x5cc33c['name'];}_0x4c4253[_0xc0ab('0x19')](_0x80d72c)[_0xc0ab('0x2c')](_0x5cc33c);};}exports['index']=function(_0x3fdcd8,_0x27e9e9){var _0x39e144={},_0x2984e1={},_0x49a489={'count':0x0,'rows':[]};var _0x4bc224=_['map'](db[_0xc0ab('0x2d')][_0xc0ab('0x2e')],function(_0x230f5e){return{'name':_0x230f5e[_0xc0ab('0x2f')],'type':_0x230f5e[_0xc0ab('0x30')]['key']};});_0x2984e1['model']=_[_0xc0ab('0x31')](_0x4bc224,_0xc0ab('0x2b'));_0x2984e1[_0xc0ab('0x32')]=_[_0xc0ab('0x33')](_0x3fdcd8['query']);_0x2984e1[_0xc0ab('0x34')]=_['intersection'](_0x2984e1[_0xc0ab('0x35')],_0x2984e1[_0xc0ab('0x32')]);_0x39e144[_0xc0ab('0x36')]=_[_0xc0ab('0x37')](_0x2984e1['model'],qs[_0xc0ab('0x38')](_0x3fdcd8[_0xc0ab('0x32')][_0xc0ab('0x38')]));_0x39e144['attributes']=_0x39e144[_0xc0ab('0x36')]['length']?_0x39e144[_0xc0ab('0x36')]:_0x2984e1[_0xc0ab('0x35')];if(!_0x3fdcd8[_0xc0ab('0x32')]['hasOwnProperty']('nolimit')){_0x39e144[_0xc0ab('0x1c')]=qs[_0xc0ab('0x1c')](_0x3fdcd8['query'][_0xc0ab('0x1c')]);_0x39e144['offset']=qs['offset'](_0x3fdcd8[_0xc0ab('0x32')][_0xc0ab('0x1a')]);}_0x39e144[_0xc0ab('0x39')]=qs[_0xc0ab('0x3a')](_0x3fdcd8['query'][_0xc0ab('0x3a')]);_0x39e144['where']=qs[_0xc0ab('0x34')](_[_0xc0ab('0x3b')](_0x3fdcd8[_0xc0ab('0x32')],_0x2984e1[_0xc0ab('0x34')]),_0x4bc224);if(_0x3fdcd8['query'][_0xc0ab('0x3c')]){_0x39e144[_0xc0ab('0x3d')]=_[_0xc0ab('0x3e')](_0x39e144[_0xc0ab('0x3d')],{'$or':_[_0xc0ab('0x31')](_0x4bc224,function(_0x5aa0ad){if(_0x5aa0ad[_0xc0ab('0x30')]!==_0xc0ab('0x3f')){var _0xcf762f={};_0xcf762f[_0x5aa0ad['name']]={'$like':'%'+_0x3fdcd8[_0xc0ab('0x32')][_0xc0ab('0x3c')]+'%'};return _0xcf762f;}})});}_0x39e144=_[_0xc0ab('0x3e')]({},_0x39e144,_0x3fdcd8[_0xc0ab('0x40')]);var _0x488bc3={'where':_0x39e144['where']};return db[_0xc0ab('0x2d')][_0xc0ab('0x1d')](_0x488bc3)[_0xc0ab('0x24')](function(_0x45f97a){_0x49a489['count']=_0x45f97a;if(_0x3fdcd8[_0xc0ab('0x32')]['includeAll']){_0x39e144[_0xc0ab('0x41')]=[{'all':!![]}];}return db[_0xc0ab('0x2d')][_0xc0ab('0x42')](_0x39e144);})[_0xc0ab('0x24')](function(_0x390d1d){_0x49a489['rows']=_0x390d1d;return _0x49a489;})[_0xc0ab('0x24')](respondWithFilteredResult(_0x27e9e9,_0x39e144))[_0xc0ab('0x43')](handleError(_0x27e9e9,null));};exports[_0xc0ab('0x44')]=function(_0x5b693d,_0x100d77){var _0x469404={'raw':!![],'where':{'id':_0x5b693d[_0xc0ab('0x45')]['id']}},_0x28b252={};_0x28b252[_0xc0ab('0x35')]=_[_0xc0ab('0x33')](db['Variable']['rawAttributes']);_0x28b252['query']=_['keys'](_0x5b693d['query']);_0x28b252[_0xc0ab('0x34')]=_['intersection'](_0x28b252[_0xc0ab('0x35')],_0x28b252[_0xc0ab('0x32')]);_0x469404[_0xc0ab('0x36')]=_[_0xc0ab('0x37')](_0x28b252[_0xc0ab('0x35')],qs[_0xc0ab('0x38')](_0x5b693d[_0xc0ab('0x32')][_0xc0ab('0x38')]));_0x469404[_0xc0ab('0x36')]=_0x469404[_0xc0ab('0x36')][_0xc0ab('0x46')]?_0x469404[_0xc0ab('0x36')]:_0x28b252[_0xc0ab('0x35')];if(_0x5b693d[_0xc0ab('0x32')][_0xc0ab('0x47')]){_0x469404['include']=[{'all':!![]}];}_0x469404=_[_0xc0ab('0x3e')]({},_0x469404,_0x5b693d[_0xc0ab('0x40')]);return db[_0xc0ab('0x2d')][_0xc0ab('0x48')](_0x469404)[_0xc0ab('0x24')](handleEntityNotFound(_0x100d77,null))['then'](respondWithResult(_0x100d77,null))[_0xc0ab('0x43')](handleError(_0x100d77,null));};exports['create']=function(_0x454beb,_0x123c1f){return db[_0xc0ab('0x2d')][_0xc0ab('0x49')](_0x454beb[_0xc0ab('0x4a')],{})['then'](function(_0x27fd8f){var _0x1aacca=_0x454beb[_0xc0ab('0x4b')]['get']({'plain':!![]});if(!_0x1aacca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aacca[_0xc0ab('0x4c')]===_0xc0ab('0x4b')){var _0x5c5c7f=_0x27fd8f[_0xc0ab('0x26')]({'plain':!![]});var _0x39fe25=_0xc0ab('0x4d');return db[_0xc0ab('0x4e')]['find']({'where':{'name':_0x39fe25,'userProfileId':_0x1aacca['userProfileId']},'raw':!![]})[_0xc0ab('0x24')](function(_0x58b732){if(_0x58b732&&_0x58b732[_0xc0ab('0x4f')]===0x0){return db[_0xc0ab('0x27')][_0xc0ab('0x49')]({'name':_0x5c5c7f[_0xc0ab('0x2b')],'resourceId':_0x5c5c7f['id'],'type':_0x58b732[_0xc0ab('0x2b')],'sectionId':_0x58b732['id']},{})[_0xc0ab('0x24')](function(){return _0x27fd8f;});}else{return _0x27fd8f;}})[_0xc0ab('0x43')](function(_0x389354){logger['error'](_0xc0ab('0x50'),_0x389354);throw _0x389354;});}return _0x27fd8f;})[_0xc0ab('0x24')](respondWithResult(_0x123c1f,0xc9))[_0xc0ab('0x43')](handleError(_0x123c1f,null));};exports[_0xc0ab('0x23')]=function(_0xb6792e,_0x633a38){if(_0xb6792e[_0xc0ab('0x4a')]['id']){delete _0xb6792e[_0xc0ab('0x4a')]['id'];}return db['Variable'][_0xc0ab('0x48')]({'where':{'id':_0xb6792e['params']['id']}})[_0xc0ab('0x24')](handleEntityNotFound(_0x633a38,null))[_0xc0ab('0x24')](saveUpdates(_0xb6792e[_0xc0ab('0x4a')],null))[_0xc0ab('0x24')](respondWithResult(_0x633a38,null))[_0xc0ab('0x43')](handleError(_0x633a38,null));};exports[_0xc0ab('0x25')]=function(_0x236c92,_0x1e8820){return db[_0xc0ab('0x2d')]['find']({'where':{'id':_0x236c92[_0xc0ab('0x45')]['id']}})[_0xc0ab('0x24')](handleEntityNotFound(_0x1e8820,null))['then'](removeEntity(_0x1e8820,null))['catch'](handleError(_0x1e8820,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4ebb9de..9ae07ff 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 _0x56c8=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16e8a7,_0x5ce524){var _0x47e8ed=function(_0x26bb84){while(--_0x26bb84){_0x16e8a7['push'](_0x16e8a7['shift']());}};_0x47e8ed(++_0x5ce524);}(_0x56c8,0x12f));var _0x856c=function(_0x36090b,_0x6c3b56){_0x36090b=_0x36090b-0x0;var _0x1575fe=_0x56c8[_0x36090b];return _0x1575fe;};'use strict';var _=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var logger=require(_0x856c('0x2'))(_0x856c('0x3'));var moment=require('moment');var BPromise=require(_0x856c('0x4'));var rp=require(_0x856c('0x5'));var fs=require('fs');var path=require(_0x856c('0x6'));var rimraf=require(_0x856c('0x7'));var config=require(_0x856c('0x8'));var attributes=require('./variable.attributes');module[_0x856c('0x9')]=function(_0x1922f4,_0x413964){return _0x1922f4[_0x856c('0xa')](_0x856c('0xb'),attributes,{'tableName':_0x856c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e9=['request-promise','path','../../config/environment','./variable.attributes','define','tools_variables','lodash','../../config/logger','api'];(function(_0x19475b,_0x2c33c0){var _0x4f9032=function(_0x25d4b3){while(--_0x25d4b3){_0x19475b['push'](_0x19475b['shift']());}};_0x4f9032(++_0x2c33c0);}(_0xe1e9,0x10b));var _0x9e1e=function(_0xdf9c1,_0x1cdd9c){_0xdf9c1=_0xdf9c1-0x0;var _0xc2c524=_0xe1e9[_0xdf9c1];return _0xc2c524;};'use strict';var _=require(_0x9e1e('0x0'));var util=require('util');var logger=require(_0x9e1e('0x1'))(_0x9e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9e1e('0x3'));var fs=require('fs');var path=require(_0x9e1e('0x4'));var rimraf=require('rimraf');var config=require(_0x9e1e('0x5'));var attributes=require(_0x9e1e('0x6'));module['exports']=function(_0x3d469d,_0x1b9a2f){return _0x3d469d[_0x9e1e('0x7')]('Variable',attributes,{'tableName':_0x9e1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c2d7fd2..aa7cb3f 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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa41a,0x6b));var _0xaa41=function(_0x3a1124,_0x1a6d16){_0x3a1124=_0x3a1124-0x0;var _0x500dfe=_0xa41a[_0x3a1124];return _0x500dfe;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x508c9d,_0x1d3d8e){var _0xcf1594=function(_0x199a41){while(--_0x199a41){_0x508c9d['push'](_0x508c9d['shift']());}};_0xcf1594(++_0x1d3d8e);}(_0x814b,0x1a2));var _0xb814=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x814b[_0x2a6fd5];return _0x43c6a4;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b3efbe0..11241bf 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 _0x5b4e=['express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5b4e,0x1ed));var _0xe5b4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5b4e[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0xe5b4('0x0'));var router=express[_0xe5b4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe5b4('0x2'));router[_0xe5b4('0x3')]('/',controller[_0xe5b4('0x4')]);router[_0xe5b4('0x3')](_0xe5b4('0x5'),auth[_0xe5b4('0x6')](),auth[_0xe5b4('0x7')](),controller[_0xe5b4('0x8')]);router[_0xe5b4('0x3')](_0xe5b4('0x9'),auth[_0xe5b4('0x6')](),auth['canUpdate'](),controller[_0xe5b4('0xa')]);router[_0xe5b4('0x3')](_0xe5b4('0xb'),auth[_0xe5b4('0x6')](),auth['canUpdate'](),controller[_0xe5b4('0xc')]);router['get'](_0xe5b4('0xd'),auth['isAuthenticated'](),controller[_0xe5b4('0xe')]);router[_0xe5b4('0x3')](_0xe5b4('0xf'),controller['migrations']);module[_0xe5b4('0x10')]=router; \ No newline at end of file +var _0x8f1e=['isAuthenticated','fetch','/reset','reset','/pull','canUpdate','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x305d8c,_0x153576){var _0x1e6143=function(_0x30913b){while(--_0x30913b){_0x305d8c['push'](_0x305d8c['shift']());}};_0x1e6143(++_0x153576);}(_0x8f1e,0xb5));var _0xe8f1=function(_0x23ab1e,_0x52a364){_0x23ab1e=_0x23ab1e-0x0;var _0x486ee7=_0x8f1e[_0x23ab1e];return _0x486ee7;};'use strict';var express=require(_0xe8f1('0x0'));var router=express[_0xe8f1('0x1')]();var auth=require(_0xe8f1('0x2'));var controller=require(_0xe8f1('0x3'));router[_0xe8f1('0x4')]('/',controller[_0xe8f1('0x5')]);router[_0xe8f1('0x4')]('/fetch',auth[_0xe8f1('0x6')](),auth['canUpdate'](),controller[_0xe8f1('0x7')]);router[_0xe8f1('0x4')](_0xe8f1('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe8f1('0x9')]);router[_0xe8f1('0x4')](_0xe8f1('0xa'),auth[_0xe8f1('0x6')](),auth[_0xe8f1('0xb')](),controller[_0xe8f1('0xc')]);router[_0xe8f1('0x4')]('/restart',auth['isAuthenticated'](),controller[_0xe8f1('0xd')]);router[_0xe8f1('0x4')](_0xe8f1('0xe'),controller[_0xe8f1('0xf')]);module[_0xe8f1('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8061384..7774339 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 _0x7a2c=['push','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','index','latest','fetch','tags','2.0.0','status','json','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','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','server','exports'];(function(_0x448255,_0x2e681d){var _0x55d7ec=function(_0x52434e){while(--_0x52434e){_0x448255['push'](_0x448255['shift']());}};_0x55d7ec(++_0x2e681d);}(_0x7a2c,0x14d));var _0xc7a2=function(_0x1632ac,_0x541d68){_0x1632ac=_0x1632ac-0x0;var _0x3a4d4b=_0x7a2c[_0x1632ac];return _0x3a4d4b;};'use strict';var Umzug=require('umzug');var path=require(_0xc7a2('0x0'));var fs=require('fs');var _=require(_0xc7a2('0x1'));var pkginfo=require(_0xc7a2('0x2'))(module,_0xc7a2('0x3'));var compareVersions=require(_0xc7a2('0x4'));var exec=require(_0xc7a2('0x5'))[_0xc7a2('0x6')];var db=require(_0xc7a2('0x7'))['db'];var config=require(_0xc7a2('0x8'));var pm2=require(_0xc7a2('0x9'));var logger=require('../../config/logger')('update');var git=require(_0xc7a2('0xa'))(config[_0xc7a2('0xb')]);exports[_0xc7a2('0xc')]=function(_0x580ea8,_0x5c93a0){var _0x418277={'current':module['exports']['version'],'phonebar':0x2};if(_0x580ea8['query']&&_0x580ea8['query'][_0xc7a2('0xd')]){return git[_0xc7a2('0xe')]()[_0xc7a2('0xf')](function(_0x10aa07,_0x1b2a92){_0x418277[_0xc7a2('0xd')]=(_0x10aa07?module['exports']['version']:_0x1b2a92[_0xc7a2('0xd')])||_0xc7a2('0x10');return _0x5c93a0[_0xc7a2('0x11')](0xc8)[_0xc7a2('0x12')](_0x418277);});}else{return _0x5c93a0['status'](0xc8)[_0xc7a2('0x12')](_0x418277);}};exports['fetch']=function(_0x3ef2e1,_0x5d99d1){return git[_0xc7a2('0xe')](['origin',_0xc7a2('0x13')],function(_0x2db6a3){if(_0x2db6a3){logger[_0xc7a2('0x14')](_0x2db6a3);return _0x5d99d1['status'](0x1f4)['json'](_0x2db6a3);}logger['info']('git\x20fetch');return _0x5d99d1[_0xc7a2('0x11')](0xc8)['json']({'output':_0xc7a2('0x15')});});};exports[_0xc7a2('0x16')]=function(_0x548e39,_0x54049b){return git[_0xc7a2('0x16')]([_0xc7a2('0x17'),_0xc7a2('0x18')],function(_0x5af396){if(_0x5af396){logger[_0xc7a2('0x14')](_0x5af396);return _0x54049b[_0xc7a2('0x11')](0x1f4)['json'](_0x5af396);}logger[_0xc7a2('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x54049b[_0xc7a2('0x11')](0xc8)[_0xc7a2('0x12')]({'output':_0xc7a2('0x1a')});});};exports[_0xc7a2('0x1b')]=function(_0x5c4b6d,_0x2a8824){exec(_0xc7a2('0x1c'),function(_0x50066b,_0x3cd2f0,_0x30fbeb){logger[_0xc7a2('0x19')](_0x3cd2f0);logger[_0xc7a2('0x19')](_0x30fbeb);if(_0x50066b){logger[_0xc7a2('0x14')](_0x50066b);return _0x2a8824[_0xc7a2('0x11')](0x1f4)[_0xc7a2('0x12')](_0x50066b);}return _0x2a8824['status'](0xc8)[_0xc7a2('0x12')]({'output':_0x3cd2f0});});};exports[_0xc7a2('0x1d')]=function(_0x3edacd,_0x505eae){return pm2[_0xc7a2('0x1d')](_0xc7a2('0x1e'))['then'](function(_0x2d9747){logger['info'](_0xc7a2('0x1f'),_0x2d9747);return _0x505eae[_0xc7a2('0x11')](0xc8)[_0xc7a2('0x12')]({'output':_0xc7a2('0x20')});})[_0xc7a2('0x21')](function(_0x46b674){logger['error'](_0x46b674);return _0x505eae[_0xc7a2('0x11')](0x1f4)[_0xc7a2('0x12')](_0x46b674);});};exports[_0xc7a2('0x22')]=function(_0x1b7145,_0x1ba8b2){var _0x1b57db=fs[_0xc7a2('0x23')](path['join'](config['root'],_0xc7a2('0x24'),_0xc7a2('0x22')));var _0x231abc=[];for(var _0x46ded7=0x0;_0x46ded7<_0x1b57db['length'];_0x46ded7++){var _0x1706a6=_0x1b57db[_0x46ded7]['replace']('.js','');if(compareVersions(module[_0xc7a2('0x25')][_0xc7a2('0x3')],_0x1706a6)===-0x1){_0x231abc[_0xc7a2('0x26')](_0x1706a6);}}if(_0x231abc['length']){var _0x13ff07=_0x231abc[_0xc7a2('0x27')](compareVersions);var _0xcdbd41=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xc7a2('0x28')],'modelName':_0xc7a2('0x28'),'columnName':_0xc7a2('0x3')},'migrations':{'params':[db['sequelize'][_0xc7a2('0x29')](),db[_0xc7a2('0x2a')][_0xc7a2('0x2b')],function(){throw new Error(_0xc7a2('0x2c'));}],'path':path[_0xc7a2('0x2d')](config[_0xc7a2('0xb')],'server',_0xc7a2('0x22')),'pattern':/\.js$/}});_0xcdbd41['up']({'migrations':_[_0xc7a2('0x2e')](_0x13ff07,function(_0x4f319a){return _0x4f319a+_0xc7a2('0x2f');})})[_0xc7a2('0x30')](function(){return _0x1ba8b2['status'](0xc8)[_0xc7a2('0x12')]({'output':_0xc7a2('0x31')+module['exports'][_0xc7a2('0x3')]+_0xc7a2('0x32')+_['last'](_0x13ff07),'migrations':_[_0xc7a2('0x2d')](_0x13ff07)});})['catch'](function(_0x3528d6){if(_0x3528d6 instanceof db[_0xc7a2('0x2a')][_0xc7a2('0x33')]){return _0x1ba8b2['status'](0xc8)[_0xc7a2('0x12')]({'output':_0xc7a2('0x34')});}else{return _0x1ba8b2[_0xc7a2('0x11')](0x1f4)['json'](_0x3528d6);}});}else{return _0x1ba8b2[_0xc7a2('0x11')](0xc8)[_0xc7a2('0x12')]({'output':_0xc7a2('0x34')});}}; \ No newline at end of file +var _0x41bd=['join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','../../mysqldb','simple-git','root','index','exports','version','query','latest','tags','2.0.0','status','json','fetch','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync'];(function(_0x294579,_0x542f77){var _0x453145=function(_0x7bc4b6){while(--_0x7bc4b6){_0x294579['push'](_0x294579['shift']());}};_0x453145(++_0x542f77);}(_0x41bd,0x1c7));var _0xd41b=function(_0x2e01f,_0x4a4f8d){_0x2e01f=_0x2e01f-0x0;var _0x509f67=_0x41bd[_0x2e01f];return _0x509f67;};'use strict';var Umzug=require(_0xd41b('0x0'));var path=require(_0xd41b('0x1'));var fs=require('fs');var _=require(_0xd41b('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xd41b('0x3'));var exec=require(_0xd41b('0x4'))['exec'];var db=require(_0xd41b('0x5'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0xd41b('0x6'))(config[_0xd41b('0x7')]);exports[_0xd41b('0x8')]=function(_0x521a60,_0x5a71db){var _0x53cdfe={'current':module[_0xd41b('0x9')][_0xd41b('0xa')],'phonebar':0x2};if(_0x521a60[_0xd41b('0xb')]&&_0x521a60[_0xd41b('0xb')][_0xd41b('0xc')]){return git['fetch']()[_0xd41b('0xd')](function(_0x387cfb,_0x115dbc){_0x53cdfe[_0xd41b('0xc')]=(_0x387cfb?module[_0xd41b('0x9')][_0xd41b('0xa')]:_0x115dbc['latest'])||_0xd41b('0xe');return _0x5a71db[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')](_0x53cdfe);});}else{return _0x5a71db[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')](_0x53cdfe);}};exports['fetch']=function(_0x3d5ac7,_0x155dde){return git[_0xd41b('0x11')]([_0xd41b('0x12'),_0xd41b('0x13')],function(_0x17cfe8){if(_0x17cfe8){logger['error'](_0x17cfe8);return _0x155dde[_0xd41b('0xf')](0x1f4)['json'](_0x17cfe8);}logger[_0xd41b('0x14')](_0xd41b('0x15'));return _0x155dde[_0xd41b('0xf')](0xc8)['json']({'output':_0xd41b('0x16')});});};exports[_0xd41b('0x17')]=function(_0x1ac27e,_0x3ed4e5){return git[_0xd41b('0x17')]([_0xd41b('0x18'),'FETCH_HEAD'],function(_0x51e4a1){if(_0x51e4a1){logger[_0xd41b('0x19')](_0x51e4a1);return _0x3ed4e5[_0xd41b('0xf')](0x1f4)[_0xd41b('0x10')](_0x51e4a1);}logger[_0xd41b('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3ed4e5['status'](0xc8)[_0xd41b('0x10')]({'output':_0xd41b('0x1a')});});};exports['pull']=function(_0x26a648,_0x2c2658){exec(_0xd41b('0x1b'),function(_0x455d0c,_0x1b37b0,_0x2b2b95){logger['info'](_0x1b37b0);logger[_0xd41b('0x14')](_0x2b2b95);if(_0x455d0c){logger[_0xd41b('0x19')](_0x455d0c);return _0x2c2658['status'](0x1f4)['json'](_0x455d0c);}return _0x2c2658[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')]({'output':_0x1b37b0});});};exports[_0xd41b('0x1c')]=function(_0x1b8550,_0x4645ec){return pm2['restart'](_0xd41b('0x1d'))[_0xd41b('0x1e')](function(_0x20520f){logger[_0xd41b('0x14')](_0xd41b('0x1f'),_0x20520f);return _0x4645ec['status'](0xc8)[_0xd41b('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd41b('0x20')](function(_0x1c4934){logger['error'](_0x1c4934);return _0x4645ec['status'](0x1f4)['json'](_0x1c4934);});};exports[_0xd41b('0x21')]=function(_0x3af244,_0x55e8b1){var _0x42d7aa=fs[_0xd41b('0x22')](path[_0xd41b('0x23')](config[_0xd41b('0x7')],_0xd41b('0x24'),_0xd41b('0x21')));var _0x2e3178=[];for(var _0x13e8f4=0x0;_0x13e8f4<_0x42d7aa[_0xd41b('0x25')];_0x13e8f4++){var _0xa80e69=_0x42d7aa[_0x13e8f4][_0xd41b('0x26')](_0xd41b('0x27'),'');if(compareVersions(module['exports'][_0xd41b('0xa')],_0xa80e69)===-0x1){_0x2e3178[_0xd41b('0x28')](_0xa80e69);}}if(_0x2e3178[_0xd41b('0x25')]){var _0x4cdd87=_0x2e3178['sort'](compareVersions);var _0x4d3082=new Umzug({'storage':_0xd41b('0x29'),'storageOptions':{'model':db[_0xd41b('0x2a')],'modelName':'Migration','columnName':_0xd41b('0xa')},'migrations':{'params':[db[_0xd41b('0x29')][_0xd41b('0x2b')](),db['sequelize']['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xd41b('0x23')](config[_0xd41b('0x7')],_0xd41b('0x24'),'migrations'),'pattern':/\.js$/}});_0x4d3082['up']({'migrations':_[_0xd41b('0x2c')](_0x4cdd87,function(_0x28fbdf){return _0x28fbdf+_0xd41b('0x27');})})['then'](function(){return _0x55e8b1[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')]({'output':_0xd41b('0x2d')+module[_0xd41b('0x9')][_0xd41b('0xa')]+_0xd41b('0x2e')+_[_0xd41b('0x2f')](_0x4cdd87),'migrations':_[_0xd41b('0x23')](_0x4cdd87)});})['catch'](function(_0x5dead9){if(_0x5dead9 instanceof db[_0xd41b('0x29')]['UniqueConstraintError']){return _0x55e8b1[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')]({'output':_0xd41b('0x30')});}else{return _0x55e8b1[_0xd41b('0xf')](0x1f4)[_0xd41b('0x10')](_0x5dead9);}});}else{return _0x55e8b1[_0xd41b('0xf')](0xc8)[_0xd41b('0x10')]({'output':_0xd41b('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7c8e300..319cb92 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 _0xa700=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get'];(function(_0x421a74,_0x592a57){var _0x4dde2e=function(_0x393651){while(--_0x393651){_0x421a74['push'](_0x421a74['shift']());}};_0x4dde2e(++_0x592a57);}(_0xa700,0x1ba));var _0x0a70=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0xa700[_0x276221];return _0x4fa716;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a70('0x0'));var timeout=require('connect-timeout');var express=require(_0x0a70('0x1'));var router=express[_0x0a70('0x2')]();var fs_extra=require(_0x0a70('0x3'));var auth=require(_0x0a70('0x4'));var interaction=require(_0x0a70('0x5'));var config=require('../../config/environment');var controller=require(_0x0a70('0x6'));router[_0x0a70('0x7')]('/',auth[_0x0a70('0x8')](),controller[_0x0a70('0x9')]);router[_0x0a70('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0a70('0x7')](_0x0a70('0xa'),auth[_0x0a70('0x8')](),controller[_0x0a70('0xb')]);router[_0x0a70('0xc')]('/',auth[_0x0a70('0x8')](),controller[_0x0a70('0xd')]);router[_0x0a70('0xe')](_0x0a70('0xa'),auth[_0x0a70('0x8')](),controller['update']);router[_0x0a70('0xf')](_0x0a70('0xa'),auth[_0x0a70('0x8')](),controller[_0x0a70('0x10')]);module[_0x0a70('0x11')]=router; \ No newline at end of file +var _0xdd90=['create','put','update','delete','/:id','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xdd90,0xdf));var _0x0dd9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdd90[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x0dd9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0dd9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0dd9('0x2'));var auth=require(_0x0dd9('0x3'));var interaction=require(_0x0dd9('0x4'));var config=require('../../config/environment');var controller=require(_0x0dd9('0x5'));router[_0x0dd9('0x6')]('/',auth[_0x0dd9('0x7')](),controller[_0x0dd9('0x8')]);router['get'](_0x0dd9('0x9'),auth[_0x0dd9('0x7')](),controller['describe']);router[_0x0dd9('0x6')]('/:id',auth[_0x0dd9('0x7')](),controller[_0x0dd9('0xa')]);router['post']('/',auth[_0x0dd9('0x7')](),controller[_0x0dd9('0xb')]);router[_0x0dd9('0xc')]('/:id',auth[_0x0dd9('0x7')](),controller[_0x0dd9('0xd')]);router[_0x0dd9('0xe')](_0x0dd9('0xf'),auth['isAuthenticated'](),controller[_0x0dd9('0x10')]);module[_0x0dd9('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 e9154cf..3a6a811 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 _0x536f=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x4bebb3,_0x4c1796){var _0x3421de=function(_0x4a17f6){while(--_0x4a17f6){_0x4bebb3['push'](_0x4bebb3['shift']());}};_0x3421de(++_0x4c1796);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf536('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf536('0x1')]},'queue':{'type':Sequelize[_0xf536('0x1')]},'interface':{'type':Sequelize[_0xf536('0x1')]},'membername':{'type':Sequelize[_0xf536('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf536('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xf536('0x2')]},'agentdumpAt':{'type':Sequelize[_0xf536('0x2')]},'holdtime':{'type':Sequelize[_0xf536('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf536('0x3')]},'agentacw':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf536('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf536('0x1')]},'channelstate':{'type':Sequelize[_0xf536('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf536('0x1')]},'language':{'type':Sequelize[_0xf536('0x1')]},'accountcode':{'type':Sequelize[_0xf536('0x1')]},'context':{'type':Sequelize[_0xf536('0x1')]},'exten':{'type':Sequelize[_0xf536('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf536('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf536('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf536('0x1')]},'destcalleridname':{'type':Sequelize[_0xf536('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf536('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf536('0x1')]},'destlanguage':{'type':Sequelize[_0xf536('0x1')]},'destaccountcode':{'type':Sequelize[_0xf536('0x1')]},'destcontext':{'type':Sequelize[_0xf536('0x1')]},'destexten':{'type':Sequelize[_0xf536('0x1')]},'destpriority':{'type':Sequelize[_0xf536('0x1')]},'destuniqueid':{'type':Sequelize[_0xf536('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf536('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf536('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf536('0x1')]},'agententerreason':{'type':Sequelize[_0xf536('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa30a=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'type':{'type':Sequelize[_0xaa30('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaa30('0x2')]},'calleridname':{'type':Sequelize[_0xaa30('0x2')]},'queue':{'type':Sequelize[_0xaa30('0x2')]},'interface':{'type':Sequelize[_0xaa30('0x2')]},'membername':{'type':Sequelize[_0xaa30('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaa30('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaa30('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xaa30('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xaa30('0x4')]},'agentcomplete':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaa30('0x4')]},'agentacw':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaa30('0x4')]},'reason':{'type':Sequelize[_0xaa30('0x2')]},'lastevent':{'type':Sequelize[_0xaa30('0x2')]},'channel':{'type':Sequelize[_0xaa30('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaa30('0x2')]},'accountcode':{'type':Sequelize[_0xaa30('0x2')]},'context':{'type':Sequelize[_0xaa30('0x2')]},'exten':{'type':Sequelize[_0xaa30('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xaa30('0x2')]},'destchannelstate':{'type':Sequelize[_0xaa30('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xaa30('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa30('0x2')]},'destlanguage':{'type':Sequelize[_0xaa30('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa30('0x2')]},'destcontext':{'type':Sequelize[_0xaa30('0x2')]},'destexten':{'type':Sequelize[_0xaa30('0x2')]},'destpriority':{'type':Sequelize[_0xaa30('0x2')]},'destuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaa30('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'agententerreason':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 7177bec..90f1a7f 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(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 5eb8b2b..1fa28ee 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 _0x60c2=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x395489,_0x193cfb){var _0xa97b0f=function(_0x2a3980){while(--_0x2a3980){_0x395489['push'](_0x395489['shift']());}};_0xa97b0f(++_0x193cfb);}(_0x60c2,0x8f));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x260c('0x0'));var logger=require(_0x260c('0x1'))(_0x260c('0x2'));var moment=require(_0x260c('0x3'));var BPromise=require(_0x260c('0x4'));var rp=require(_0x260c('0x5'));var fs=require('fs');var path=require(_0x260c('0x6'));var rimraf=require(_0x260c('0x7'));var config=require(_0x260c('0x8'));var attributes=require(_0x260c('0x9'));module[_0x260c('0xa')]=function(_0x13c7d0,_0x558b0c){return _0x13c7d0[_0x260c('0xb')](_0x260c('0xc'),attributes,{'tableName':_0x260c('0xd'),'paranoid':![],'indexes':[{'fields':[_0x260c('0xe'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xee14=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d2ac7,_0x370d0d){var _0x5e1d92=function(_0x110aac){while(--_0x110aac){_0x3d2ac7['push'](_0x3d2ac7['shift']());}};_0x5e1d92(++_0x370d0d);}(_0xee14,0x13a));var _0x4ee1=function(_0x3dde16,_0x2d41c0){_0x3dde16=_0x3dde16-0x0;var _0x3693bc=_0xee14[_0x3dde16];return _0x3693bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4ee1('0xc'),_0x4ee1('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 b2ba2c1..cda4079 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 _0xf201=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceAgentReport','create','options','then','CreateVoiceAgentReport','debug','catch','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x207b8c,_0x255b28){var _0xe485f1=function(_0x777447){while(--_0x777447){_0x207b8c['push'](_0x207b8c['shift']());}};_0xe485f1(++_0x255b28);}(_0xf201,0x192));var _0x1f20=function(_0x5e1cd1,_0x21ff05){_0x5e1cd1=_0x5e1cd1-0x0;var _0x3a65be=_0xf201[_0x5e1cd1];return _0x3a65be;};'use strict';var _=require(_0x1f20('0x0'));var util=require(_0x1f20('0x1'));var moment=require(_0x1f20('0x2'));var BPromise=require(_0x1f20('0x3'));var rs=require(_0x1f20('0x4'));var fs=require('fs');var Redis=require(_0x1f20('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f20('0x6'));var logger=require('../../config/logger')(_0x1f20('0x7'));var config=require(_0x1f20('0x8'));var jayson=require(_0x1f20('0x9'));var client=jayson[_0x1f20('0xa')][_0x1f20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x485549,_0x543f16,_0x49af2a){return new BPromise(function(_0x4ea786,_0x209ade){return client[_0x1f20('0xc')](_0x485549,_0x49af2a)['then'](function(_0x29e491){logger[_0x1f20('0xd')](_0x1f20('0xe'),_0x543f16,_0x1f20('0xf'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x543f16,'request\x20sent',JSON[_0x1f20('0x10')](_0x29e491));if(_0x29e491['error']){if(_0x29e491[_0x1f20('0x11')][_0x1f20('0x12')]===0x1f4){logger[_0x1f20('0x11')](_0x1f20('0xe'),_0x543f16,_0x29e491[_0x1f20('0x11')][_0x1f20('0x13')]);return _0x209ade(_0x29e491[_0x1f20('0x11')]['message']);}logger[_0x1f20('0x11')](_0x1f20('0xe'),_0x543f16,_0x29e491[_0x1f20('0x11')][_0x1f20('0x13')]);return _0x4ea786(_0x29e491[_0x1f20('0x11')][_0x1f20('0x13')]);}else{logger['info'](_0x1f20('0xe'),_0x543f16,'request\x20sent');_0x4ea786(_0x29e491[_0x1f20('0x14')]['message']);}})['catch'](function(_0x4c2546){logger[_0x1f20('0x11')](_0x1f20('0xe'),_0x543f16,_0x4c2546);_0x209ade(_0x4c2546);});});}exports['CreateVoiceAgentReport']=function(_0x14cfb1){var _0x3d782d=this;return new Promise(function(_0x1b50f0,_0x1a13df){return db[_0x1f20('0x15')][_0x1f20('0x16')](_0x14cfb1['body'],{'raw':_0x14cfb1[_0x1f20('0x17')]?_0x14cfb1[_0x1f20('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1f20('0x18')](function(_0x13bd98){logger[_0x1f20('0xd')](_0x1f20('0x19'),_0x14cfb1);logger[_0x1f20('0x1a')](_0x1f20('0x19'),_0x14cfb1,JSON[_0x1f20('0x10')](_0x13bd98));_0x1b50f0(_0x13bd98);})[_0x1f20('0x1b')](function(_0x23966f){logger[_0x1f20('0x11')](_0x1f20('0x19'),_0x23966f['message'],_0x14cfb1);_0x1a13df(_0x3d782d[_0x1f20('0x11')](0x1f4,_0x23966f[_0x1f20('0x13')]));});});};exports[_0x1f20('0x1c')]=function(_0x41f358){var _0xfebdbf=this;return new Promise(function(_0x2b2ea2,_0x145468){return db[_0x1f20('0x15')][_0x1f20('0x1d')](_0x41f358['body'],{'raw':_0x41f358['options']?_0x41f358[_0x1f20('0x17')][_0x1f20('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f358[_0x1f20('0x17')]?_0x41f358[_0x1f20('0x17')][_0x1f20('0x1f')]||null:null,'attributes':_0x41f358[_0x1f20('0x17')]?_0x41f358['options'][_0x1f20('0x20')]||null:null,'limit':_0x41f358[_0x1f20('0x17')]?_0x41f358[_0x1f20('0x17')][_0x1f20('0x21')]||null:null})[_0x1f20('0x18')](function(_0x344d57){logger['info']('UpdateVoiceAgentReport',_0x41f358);logger[_0x1f20('0x1a')](_0x1f20('0x1c'),_0x41f358,JSON[_0x1f20('0x10')](_0x344d57));_0x2b2ea2(_0x344d57);})[_0x1f20('0x1b')](function(_0x328e55){logger[_0x1f20('0x11')](_0x1f20('0x1c'),_0x328e55[_0x1f20('0x13')],_0x41f358);_0x145468(_0xfebdbf[_0x1f20('0x11')](0x1f4,_0x328e55['message']));});});}; \ No newline at end of file +var _0x99b8=['request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3df04b,_0x14a8e4){var _0x305a0c=function(_0x4f0362){while(--_0x4f0362){_0x3df04b['push'](_0x3df04b['shift']());}};_0x305a0c(++_0x14a8e4);}(_0x99b8,0x78));var _0x899b=function(_0x2796b4,_0x300724){_0x2796b4=_0x2796b4-0x0;var _0x3f6aa3=_0x99b8[_0x2796b4];return _0x3f6aa3;};'use strict';var _=require(_0x899b('0x0'));var util=require(_0x899b('0x1'));var moment=require(_0x899b('0x2'));var BPromise=require(_0x899b('0x3'));var rs=require(_0x899b('0x4'));var fs=require('fs');var Redis=require(_0x899b('0x5'));var db=require(_0x899b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x899b('0x7'))(_0x899b('0x8'));var config=require('../../config/environment');var jayson=require(_0x899b('0x9'));var client=jayson[_0x899b('0xa')][_0x899b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2252f9,_0x316e88,_0x1839fd){return new BPromise(function(_0x186410,_0x5cfd25){return client[_0x899b('0xc')](_0x2252f9,_0x1839fd)[_0x899b('0xd')](function(_0x2f4a77){logger[_0x899b('0xe')](_0x899b('0xf'),_0x316e88,_0x899b('0x10'));logger[_0x899b('0x11')](_0x899b('0x12'),_0x316e88,'request\x20sent',JSON[_0x899b('0x13')](_0x2f4a77));if(_0x2f4a77[_0x899b('0x14')]){if(_0x2f4a77[_0x899b('0x14')][_0x899b('0x15')]===0x1f4){logger[_0x899b('0x14')](_0x899b('0xf'),_0x316e88,_0x2f4a77['error'][_0x899b('0x16')]);return _0x5cfd25(_0x2f4a77['error']['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x316e88,_0x2f4a77[_0x899b('0x14')][_0x899b('0x16')]);return _0x186410(_0x2f4a77[_0x899b('0x14')][_0x899b('0x16')]);}else{logger['info'](_0x899b('0xf'),_0x316e88,'request\x20sent');_0x186410(_0x2f4a77[_0x899b('0x17')]['message']);}})[_0x899b('0x18')](function(_0x19614c){logger[_0x899b('0x14')](_0x899b('0xf'),_0x316e88,_0x19614c);_0x5cfd25(_0x19614c);});});}exports['CreateVoiceAgentReport']=function(_0x5be2e8){var _0x2bed4c=this;return new Promise(function(_0x214c1e,_0x2502f9){return db[_0x899b('0x19')][_0x899b('0x1a')](_0x5be2e8[_0x899b('0x1b')],{'raw':_0x5be2e8[_0x899b('0x1c')]?_0x5be2e8[_0x899b('0x1c')][_0x899b('0x1d')]===undefined?!![]:![]:!![]})[_0x899b('0xd')](function(_0x588bd2){logger[_0x899b('0xe')](_0x899b('0x1e'),_0x5be2e8);logger[_0x899b('0x11')](_0x899b('0x1e'),_0x5be2e8,JSON[_0x899b('0x13')](_0x588bd2));_0x214c1e(_0x588bd2);})[_0x899b('0x18')](function(_0x1470cd){logger[_0x899b('0x14')]('CreateVoiceAgentReport',_0x1470cd['message'],_0x5be2e8);_0x2502f9(_0x2bed4c['error'](0x1f4,_0x1470cd[_0x899b('0x16')]));});});};exports[_0x899b('0x1f')]=function(_0x24ff6c){var _0x3739f4=this;return new Promise(function(_0x24f6f5,_0x334077){return db[_0x899b('0x19')]['update'](_0x24ff6c[_0x899b('0x1b')],{'raw':_0x24ff6c[_0x899b('0x1c')]?_0x24ff6c[_0x899b('0x1c')][_0x899b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ff6c[_0x899b('0x1c')]?_0x24ff6c[_0x899b('0x1c')]['where']||null:null,'attributes':_0x24ff6c[_0x899b('0x1c')]?_0x24ff6c[_0x899b('0x1c')][_0x899b('0x20')]||null:null,'limit':_0x24ff6c[_0x899b('0x1c')]?_0x24ff6c[_0x899b('0x1c')]['limit']||null:null})[_0x899b('0xd')](function(_0x3c7c50){logger[_0x899b('0xe')]('UpdateVoiceAgentReport',_0x24ff6c);logger['debug'](_0x899b('0x1f'),_0x24ff6c,JSON[_0x899b('0x13')](_0x3c7c50));_0x24f6f5(_0x3c7c50);})[_0x899b('0x18')](function(_0x736a88){logger[_0x899b('0x14')](_0x899b('0x1f'),_0x736a88[_0x899b('0x16')],_0x24ff6c);_0x334077(_0x3739f4['error'](0x1f4,_0x736a88[_0x899b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c918f96..d7096dc 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 _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x885a,0x180));var _0xa885=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x885a[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x67b1c8,_0x5bf640){var _0x324f20=function(_0x44035b){while(--_0x44035b){_0x67b1c8['push'](_0x67b1c8['shift']());}};_0x324f20(++_0x5bf640);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x26c10f,_0x5411be){_0x26c10f=_0x26c10f-0x0;var _0x17e0b8=_0xd0bb[_0x26c10f];return _0x17e0b8;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 2934225..35c20f6 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 _0x38bd=['INTEGER','exports','STRING','ENUM','inbound','inbound-fax','dialer','TEXT','DATE'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x38bd,0x6d));var _0xd38b=function(_0x355904,_0x523f98){_0x355904=_0x355904-0x0;var _0x2e43f6=_0x38bd[_0x355904];return _0x2e43f6;};'use strict';var Sequelize=require('sequelize');module[_0xd38b('0x0')]={'uniqueid':{'type':Sequelize[_0xd38b('0x1')]},'type':{'type':Sequelize[_0xd38b('0x2')](_0xd38b('0x3'),'internal','outbound',_0xd38b('0x4'),'outbound-fax',_0xd38b('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xd38b('0x1')]},'destination':{'type':Sequelize[_0xd38b('0x1')]},'destinationcontext':{'type':Sequelize[_0xd38b('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd38b('0x1')]},'destinationchannel':{'type':Sequelize[_0xd38b('0x1')]},'lastapplication':{'type':Sequelize[_0xd38b('0x1')]},'lastdata':{'type':Sequelize[_0xd38b('0x6')]},'starttime':{'type':Sequelize[_0xd38b('0x7')]},'systemanswertime':{'type':Sequelize[_0xd38b('0x7')]},'answertime':{'type':Sequelize[_0xd38b('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xd38b('0x8')]},'billableseconds':{'type':Sequelize[_0xd38b('0x8')]},'mohtime':{'type':Sequelize[_0xd38b('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd38b('0x1')]},'amaflags':{'type':Sequelize[_0xd38b('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xd38b('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xd38b('0x1')]},'note':{'type':Sequelize[_0xd38b('0x1')]},'prefix':{'type':Sequelize[_0xd38b('0x1')]},'routeid':{'type':Sequelize[_0xd38b('0x8')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c66=['inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','ENUM','inbound','internal','outbound'];(function(_0x30d184,_0x538134){var _0x39fe96=function(_0x346987){while(--_0x346987){_0x30d184['push'](_0x30d184['shift']());}};_0x39fe96(++_0x538134);}(_0x3c66,0x8b));var _0x63c6=function(_0x4cbebb,_0x565d7e){_0x4cbebb=_0x4cbebb-0x0;var _0xa0b3bd=_0x3c66[_0x4cbebb];return _0xa0b3bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x63c6('0x0')](_0x63c6('0x1'),_0x63c6('0x2'),_0x63c6('0x3'),_0x63c6('0x4'),_0x63c6('0x5'),_0x63c6('0x6'))},'tag':{'type':Sequelize[_0x63c6('0x7')]},'accountcode':{'type':Sequelize[_0x63c6('0x7')]},'source':{'type':Sequelize[_0x63c6('0x7')]},'destination':{'type':Sequelize[_0x63c6('0x7')]},'destinationcontext':{'type':Sequelize[_0x63c6('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63c6('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x63c6('0x7')]},'lastdata':{'type':Sequelize[_0x63c6('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x63c6('0x9')]},'answertime':{'type':Sequelize[_0x63c6('0x9')]},'endtime':{'type':Sequelize[_0x63c6('0x9')]},'duration':{'type':Sequelize[_0x63c6('0xa')]},'billableseconds':{'type':Sequelize[_0x63c6('0xa')]},'mohtime':{'type':Sequelize[_0x63c6('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x63c6('0x7')]},'userfield':{'type':Sequelize[_0x63c6('0x7')]},'userDisposition':{'type':Sequelize[_0x63c6('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ff80bb3..044cdc2 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(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x2ef3,0xba));var _0x32ef=function(_0x21373a,_0x346a46){_0x21373a=_0x21373a-0x0;var _0x223390=_0x2ef3[_0x21373a];return _0x223390;};'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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x104064,_0x26ee24){var _0x23e0c3=function(_0x2ab5ba){while(--_0x2ab5ba){_0x104064['push'](_0x104064['shift']());}};_0x23e0c3(++_0x26ee24);}(_0xb10b,0x12a));var _0xbb10=function(_0xed6261,_0x1f0ee2){_0xed6261=_0xed6261-0x0;var _0x4de7a5=_0xb10b[_0xed6261];return _0x4de7a5;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ae12abe..4a3f7c9 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 _0xff4b=['../../config/logger','moment','request-promise','path','rimraf','define','uniqueid','lodash'];(function(_0x314079,_0x5473ff){var _0x1f1ece=function(_0x4d8161){while(--_0x4d8161){_0x314079['push'](_0x314079['shift']());}};_0x1f1ece(++_0x5473ff);}(_0xff4b,0x6f));var _0xbff4=function(_0x4983bd,_0x2bf81f){_0x4983bd=_0x4983bd-0x0;var _0x5c1067=_0xff4b[_0x4983bd];return _0x5c1067;};'use strict';var _=require(_0xbff4('0x0'));var util=require('util');var logger=require(_0xbff4('0x1'))('api');var moment=require(_0xbff4('0x2'));var BPromise=require('bluebird');var rp=require(_0xbff4('0x3'));var fs=require('fs');var path=require(_0xbff4('0x4'));var rimraf=require(_0xbff4('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x179935,_0x58e50c){return _0x179935[_0xbff4('0x6')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xbff4('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2354=['api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2354,0x159));var _0x4235=function(_0x84f215,_0x432764){_0x84f215=_0x84f215-0x0;var _0x1f9ef3=_0x2354[_0x84f215];return _0x1f9ef3;};'use strict';var _=require(_0x4235('0x0'));var util=require(_0x4235('0x1'));var logger=require(_0x4235('0x2'))(_0x4235('0x3'));var moment=require(_0x4235('0x4'));var BPromise=require(_0x4235('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4235('0x6'));var config=require(_0x4235('0x7'));var attributes=require(_0x4235('0x8'));module[_0x4235('0x9')]=function(_0x1359d8,_0x524a22){return _0x1359d8[_0x4235('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4235('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 587765c..52ec3e8 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 _0x9173=['options','raw','attributes','include','map','model','then','stringify','CreateVoiceCallReport','create','body','update','where','limit','UpdateVoiceCallReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9173,0x81));var _0x3917=function(_0x539c5f,_0x4b9bb4){_0x539c5f=_0x539c5f-0x0;var _0x3975f5=_0x9173[_0x539c5f];return _0x3975f5;};'use strict';var _=require(_0x3917('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3917('0x1'));var rs=require(_0x3917('0x2'));var fs=require('fs');var Redis=require(_0x3917('0x3'));var db=require(_0x3917('0x4'))['db'];var utils=require(_0x3917('0x5'));var logger=require(_0x3917('0x6'))(_0x3917('0x7'));var config=require('../../config/environment');var jayson=require(_0x3917('0x8'));var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c261,_0x3e0dbe,_0x3cfcd7){return new BPromise(function(_0x14e6af,_0x4718bf){return client[_0x3917('0xb')](_0x16c261,_0x3cfcd7)['then'](function(_0xefa820){logger[_0x3917('0xc')](_0x3917('0xd'),_0x3e0dbe,_0x3917('0xe'));logger[_0x3917('0xf')](_0x3917('0x10'),_0x3e0dbe,_0x3917('0xe'),JSON['stringify'](_0xefa820));if(_0xefa820[_0x3917('0x11')]){if(_0xefa820[_0x3917('0x11')][_0x3917('0x12')]===0x1f4){logger[_0x3917('0x11')](_0x3917('0xd'),_0x3e0dbe,_0xefa820[_0x3917('0x11')][_0x3917('0x13')]);return _0x4718bf(_0xefa820['error'][_0x3917('0x13')]);}logger[_0x3917('0x11')](_0x3917('0xd'),_0x3e0dbe,_0xefa820[_0x3917('0x11')][_0x3917('0x13')]);return _0x14e6af(_0xefa820[_0x3917('0x11')][_0x3917('0x13')]);}else{logger[_0x3917('0xc')](_0x3917('0xd'),_0x3e0dbe,_0x3917('0xe'));_0x14e6af(_0xefa820[_0x3917('0x14')][_0x3917('0x13')]);}})[_0x3917('0x15')](function(_0x12597e){logger[_0x3917('0x11')](_0x3917('0xd'),_0x3e0dbe,_0x12597e);_0x4718bf(_0x12597e);});});}exports[_0x3917('0x16')]=function(_0x1669c2){var _0x100cc4=this;return new Promise(function(_0x1e5fbf,_0x513129){return db['VoiceCallReport']['findAll']({'raw':_0x1669c2[_0x3917('0x17')]?_0x1669c2[_0x3917('0x17')][_0x3917('0x18')]===undefined?!![]:![]:!![],'where':_0x1669c2[_0x3917('0x17')]?_0x1669c2[_0x3917('0x17')]['where']||null:null,'attributes':_0x1669c2[_0x3917('0x17')]?_0x1669c2[_0x3917('0x17')][_0x3917('0x19')]||null:null,'limit':_0x1669c2[_0x3917('0x17')]?_0x1669c2['options']['limit']||null:null,'include':_0x1669c2[_0x3917('0x17')]?_0x1669c2['options'][_0x3917('0x1a')]?_[_0x3917('0x1b')](_0x1669c2['options'][_0x3917('0x1a')],function(_0x54cdf9){return{'model':db[_0x54cdf9[_0x3917('0x1c')]],'as':_0x54cdf9['as'],'attributes':_0x54cdf9['attributes'],'include':_0x54cdf9[_0x3917('0x1a')]?_['map'](_0x54cdf9[_0x3917('0x1a')],function(_0x1bce53){return{'model':db[_0x1bce53[_0x3917('0x1c')]],'as':_0x1bce53['as'],'attributes':_0x1bce53[_0x3917('0x19')],'include':_0x1bce53['include']?_[_0x3917('0x1b')](_0x1bce53[_0x3917('0x1a')],function(_0x1dba55){return{'model':db[_0x1dba55[_0x3917('0x1c')]],'as':_0x1dba55['as'],'attributes':_0x1dba55['attributes']};}):[]};}):[]};}):[]:[]})[_0x3917('0x1d')](function(_0x1294e5){logger['info']('GetVoiceCallReport',_0x1669c2);logger[_0x3917('0xf')](_0x3917('0x16'),_0x1669c2,JSON[_0x3917('0x1e')](_0x1294e5));_0x1e5fbf(_0x1294e5);})[_0x3917('0x15')](function(_0x2723e1){logger[_0x3917('0x11')]('GetVoiceCallReport',_0x2723e1[_0x3917('0x13')],_0x1669c2);_0x513129(_0x100cc4[_0x3917('0x11')](0x1f4,_0x2723e1['message']));});});};exports[_0x3917('0x1f')]=function(_0x700bf4){var _0x4d1f38=this;return new Promise(function(_0x247bf5,_0x443d20){return db['VoiceCallReport'][_0x3917('0x20')](_0x700bf4[_0x3917('0x21')],{'raw':_0x700bf4[_0x3917('0x17')]?_0x700bf4[_0x3917('0x17')][_0x3917('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x510fda){logger[_0x3917('0xc')](_0x3917('0x1f'),_0x700bf4);logger[_0x3917('0xf')](_0x3917('0x1f'),_0x700bf4,JSON[_0x3917('0x1e')](_0x510fda));_0x247bf5(_0x510fda);})[_0x3917('0x15')](function(_0x4c3bb1){logger[_0x3917('0x11')](_0x3917('0x1f'),_0x4c3bb1[_0x3917('0x13')],_0x700bf4);_0x443d20(_0x4d1f38[_0x3917('0x11')](0x1f4,_0x4c3bb1[_0x3917('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x3cf416){var _0x2f5a2f=this;return new Promise(function(_0x263054,_0x111dda){return db['VoiceCallReport'][_0x3917('0x22')](_0x3cf416[_0x3917('0x21')],{'raw':_0x3cf416[_0x3917('0x17')]?_0x3cf416[_0x3917('0x17')][_0x3917('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cf416[_0x3917('0x17')]?_0x3cf416[_0x3917('0x17')][_0x3917('0x23')]||null:null,'attributes':_0x3cf416['options']?_0x3cf416['options'][_0x3917('0x19')]||null:null,'limit':_0x3cf416['options']?_0x3cf416['options'][_0x3917('0x24')]||null:null})[_0x3917('0x1d')](function(_0x43970a){logger['info'](_0x3917('0x25'),_0x3cf416);logger['debug']('UpdateVoiceCallReport',_0x3cf416,JSON[_0x3917('0x1e')](_0x43970a));_0x263054(_0x43970a);})[_0x3917('0x15')](function(_0x22e506){logger[_0x3917('0x11')]('UpdateVoiceCallReport',_0x22e506['message'],_0x3cf416);_0x111dda(_0x2f5a2f['error'](0x1f4,_0x22e506[_0x3917('0x13')]));});});}; \ No newline at end of file +var _0xb6a3=['model','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6a3,0xa6));var _0x3b6a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb6a3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3b6a('0x0'));var util=require(_0x3b6a('0x1'));var moment=require(_0x3b6a('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b6a('0x3'));var fs=require('fs');var Redis=require(_0x3b6a('0x4'));var db=require(_0x3b6a('0x5'))['db'];var utils=require(_0x3b6a('0x6'));var logger=require(_0x3b6a('0x7'))(_0x3b6a('0x8'));var config=require(_0x3b6a('0x9'));var jayson=require(_0x3b6a('0xa'));var client=jayson['client'][_0x3b6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4024df,_0x1bcc9f,_0x228bbd){return new BPromise(function(_0x12313f,_0xd0f99c){return client[_0x3b6a('0xc')](_0x4024df,_0x228bbd)[_0x3b6a('0xd')](function(_0x462307){logger[_0x3b6a('0xe')](_0x3b6a('0xf'),_0x1bcc9f,_0x3b6a('0x10'));logger[_0x3b6a('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1bcc9f,_0x3b6a('0x10'),JSON[_0x3b6a('0x12')](_0x462307));if(_0x462307[_0x3b6a('0x13')]){if(_0x462307[_0x3b6a('0x13')][_0x3b6a('0x14')]===0x1f4){logger[_0x3b6a('0x13')](_0x3b6a('0xf'),_0x1bcc9f,_0x462307[_0x3b6a('0x13')][_0x3b6a('0x15')]);return _0xd0f99c(_0x462307[_0x3b6a('0x13')][_0x3b6a('0x15')]);}logger[_0x3b6a('0x13')](_0x3b6a('0xf'),_0x1bcc9f,_0x462307[_0x3b6a('0x13')][_0x3b6a('0x15')]);return _0x12313f(_0x462307[_0x3b6a('0x13')][_0x3b6a('0x15')]);}else{logger[_0x3b6a('0xe')](_0x3b6a('0xf'),_0x1bcc9f,'request\x20sent');_0x12313f(_0x462307[_0x3b6a('0x16')][_0x3b6a('0x15')]);}})[_0x3b6a('0x17')](function(_0x3b8399){logger[_0x3b6a('0x13')](_0x3b6a('0xf'),_0x1bcc9f,_0x3b8399);_0xd0f99c(_0x3b8399);});});}exports[_0x3b6a('0x18')]=function(_0x19e714){var _0x4d65a3=this;return new Promise(function(_0x10d8eb,_0x46894e){return db[_0x3b6a('0x19')][_0x3b6a('0x1a')]({'raw':_0x19e714['options']?_0x19e714[_0x3b6a('0x1b')][_0x3b6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x19e714[_0x3b6a('0x1b')]?_0x19e714[_0x3b6a('0x1b')][_0x3b6a('0x1d')]||null:null,'attributes':_0x19e714[_0x3b6a('0x1b')]?_0x19e714[_0x3b6a('0x1b')][_0x3b6a('0x1e')]||null:null,'limit':_0x19e714[_0x3b6a('0x1b')]?_0x19e714['options'][_0x3b6a('0x1f')]||null:null,'include':_0x19e714[_0x3b6a('0x1b')]?_0x19e714['options'][_0x3b6a('0x20')]?_['map'](_0x19e714['options'][_0x3b6a('0x20')],function(_0x390ad7){return{'model':db[_0x390ad7['model']],'as':_0x390ad7['as'],'attributes':_0x390ad7[_0x3b6a('0x1e')],'include':_0x390ad7[_0x3b6a('0x20')]?_[_0x3b6a('0x21')](_0x390ad7[_0x3b6a('0x20')],function(_0x20b4f5){return{'model':db[_0x20b4f5[_0x3b6a('0x22')]],'as':_0x20b4f5['as'],'attributes':_0x20b4f5['attributes'],'include':_0x20b4f5[_0x3b6a('0x20')]?_[_0x3b6a('0x21')](_0x20b4f5[_0x3b6a('0x20')],function(_0x53a611){return{'model':db[_0x53a611[_0x3b6a('0x22')]],'as':_0x53a611['as'],'attributes':_0x53a611[_0x3b6a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3b6a('0xd')](function(_0x5c8ddd){logger[_0x3b6a('0xe')](_0x3b6a('0x18'),_0x19e714);logger['debug'](_0x3b6a('0x18'),_0x19e714,JSON[_0x3b6a('0x12')](_0x5c8ddd));_0x10d8eb(_0x5c8ddd);})[_0x3b6a('0x17')](function(_0x48c739){logger[_0x3b6a('0x13')]('GetVoiceCallReport',_0x48c739[_0x3b6a('0x15')],_0x19e714);_0x46894e(_0x4d65a3['error'](0x1f4,_0x48c739[_0x3b6a('0x15')]));});});};exports[_0x3b6a('0x23')]=function(_0x28a01a){var _0x38cd4b=this;return new Promise(function(_0x237864,_0x2a9e40){return db[_0x3b6a('0x19')][_0x3b6a('0x24')](_0x28a01a[_0x3b6a('0x25')],{'raw':_0x28a01a['options']?_0x28a01a[_0x3b6a('0x1b')][_0x3b6a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5923dc){logger[_0x3b6a('0xe')](_0x3b6a('0x23'),_0x28a01a);logger[_0x3b6a('0x11')](_0x3b6a('0x23'),_0x28a01a,JSON[_0x3b6a('0x12')](_0x5923dc));_0x237864(_0x5923dc);})[_0x3b6a('0x17')](function(_0x59c20a){logger[_0x3b6a('0x13')](_0x3b6a('0x23'),_0x59c20a[_0x3b6a('0x15')],_0x28a01a);_0x2a9e40(_0x38cd4b[_0x3b6a('0x13')](0x1f4,_0x59c20a[_0x3b6a('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0xba482f){var _0x1db3dc=this;return new Promise(function(_0xe77b02,_0xba54b7){return db[_0x3b6a('0x19')][_0x3b6a('0x26')](_0xba482f['body'],{'raw':_0xba482f['options']?_0xba482f[_0x3b6a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba482f[_0x3b6a('0x1b')]?_0xba482f['options'][_0x3b6a('0x1d')]||null:null,'attributes':_0xba482f[_0x3b6a('0x1b')]?_0xba482f['options'][_0x3b6a('0x1e')]||null:null,'limit':_0xba482f[_0x3b6a('0x1b')]?_0xba482f[_0x3b6a('0x1b')]['limit']||null:null})[_0x3b6a('0xd')](function(_0x321f13){logger[_0x3b6a('0xe')](_0x3b6a('0x27'),_0xba482f);logger[_0x3b6a('0x11')](_0x3b6a('0x27'),_0xba482f,JSON['stringify'](_0x321f13));_0xe77b02(_0x321f13);})[_0x3b6a('0x17')](function(_0x4f5b5a){logger[_0x3b6a('0x13')](_0x3b6a('0x27'),_0x4f5b5a[_0x3b6a('0x15')],_0xba482f);_0xba54b7(_0x1db3dc[_0x3b6a('0x13')](0x1f4,_0x4f5b5a[_0x3b6a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b676c25..48ad796 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 _0x3e09=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x45c5bc,_0xf506f3){var _0x448bc7=function(_0x11a514){while(--_0x11a514){_0x45c5bc['push'](_0x45c5bc['shift']());}};_0x448bc7(++_0xf506f3);}(_0x3e09,0x70));var _0x93e0=function(_0x204191,_0x55d566){_0x204191=_0x204191-0x0;var _0x526ccf=_0x3e09[_0x204191];return _0x526ccf;};'use strict';var multer=require(_0x93e0('0x0'));var util=require(_0x93e0('0x1'));var path=require(_0x93e0('0x2'));var timeout=require(_0x93e0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x93e0('0x4'));var auth=require(_0x93e0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x93e0('0x6')]('/',auth[_0x93e0('0x7')](),controller[_0x93e0('0x8')]);router['get'](_0x93e0('0x9'),auth[_0x93e0('0x7')](),controller[_0x93e0('0xa')]);router[_0x93e0('0xb')]('/',auth[_0x93e0('0x7')](),controller[_0x93e0('0xc')]);router[_0x93e0('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x93e0('0x9'),auth[_0x93e0('0x7')](),controller[_0x93e0('0xe')]);module[_0x93e0('0xf')]=router; \ No newline at end of file +var _0xb884=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x42fab6,_0x1b4127){var _0x415b8d=function(_0x4e156c){while(--_0x4e156c){_0x42fab6['push'](_0x42fab6['shift']());}};_0x415b8d(++_0x1b4127);}(_0xb884,0x12f));var _0x4b88=function(_0x123092,_0x4655bc){_0x123092=_0x123092-0x0;var _0x2816cc=_0xb884[_0x123092];return _0x2816cc;};'use strict';var multer=require(_0x4b88('0x0'));var util=require(_0x4b88('0x1'));var path=require(_0x4b88('0x2'));var timeout=require(_0x4b88('0x3'));var express=require(_0x4b88('0x4'));var router=express[_0x4b88('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4b88('0x6'));var interaction=require(_0x4b88('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x4b88('0x8')](),controller[_0x4b88('0x9')]);router[_0x4b88('0xa')](_0x4b88('0xb'),auth['isAuthenticated'](),controller[_0x4b88('0xc')]);router[_0x4b88('0xd')]('/',auth[_0x4b88('0x8')](),controller[_0x4b88('0xe')]);router[_0x4b88('0xf')](_0x4b88('0xb'),auth['isAuthenticated'](),controller[_0x4b88('0x10')]);router['delete'](_0x4b88('0xb'),auth[_0x4b88('0x8')](),controller[_0x4b88('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index eb1a6d2..4a66251 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 _0x3349=['exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x20f0e3,_0x56d69b){var _0x22e149=function(_0x46c0e8){while(--_0x46c0e8){_0x20f0e3['push'](_0x20f0e3['shift']());}};_0x22e149(++_0x56d69b);}(_0x3349,0xd7));var _0x9334=function(_0x9ded14,_0x34dbc9){_0x9ded14=_0x9ded14-0x0;var _0x20c47c=_0x3349[_0x9ded14];return _0x20c47c;};'use strict';var Sequelize=require(_0x9334('0x0'));module[_0x9334('0x1')]={'name':{'type':Sequelize[_0x9334('0x2')]},'prefix':{'type':Sequelize[_0x9334('0x2')],'unique':_0x9334('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9334('0x2')],'set':function(_0x5d71fc){this[_0x9334('0x4')](_0x9334('0x5'),_0x5d71fc?_0x5d71fc[_0x9334('0x6')](''):[]);},'get':function(){return this[_0x9334('0x7')](_0x9334('0x5'))?this[_0x9334('0x7')](_0x9334('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x9334('0x2')]},'record':{'type':Sequelize[_0x9334('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9334('0x2')]}}; \ No newline at end of file +var _0xf94d=['join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue','options'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf94d,0x11b));var _0xdf94=function(_0x1175c2,_0x31ab7a){_0x1175c2=_0x1175c2-0x0;var _0x4c2b9d=_0xf94d[_0x1175c2];return _0x4c2b9d;};'use strict';var Sequelize=require('sequelize');module[_0xdf94('0x0')]={'name':{'type':Sequelize[_0xdf94('0x1')]},'prefix':{'type':Sequelize[_0xdf94('0x1')],'unique':_0xdf94('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xdf94('0x1')],'set':function(_0x216049){this[_0xdf94('0x3')](_0xdf94('0x4'),_0x216049?_0x216049[_0xdf94('0x5')](''):[]);},'get':function(){return this[_0xdf94('0x6')]('options')?this[_0xdf94('0x6')](_0xdf94('0x4'))[_0xdf94('0x7')](''):[];}},'auth':{'type':Sequelize[_0xdf94('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xdf94('0x1')]},'record':{'type':Sequelize[_0xdf94('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf94('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fcbc97b..1e38f22 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 _0xa047=['fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','nolimit','where','pick','filters','filter','merge','options','include','VoiceChanSpy','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','eml-format','rimraf','zip-dir'];(function(_0x35d7ec,_0x2ca937){var _0xf59b04=function(_0x14b041){while(--_0x14b041){_0x35d7ec['push'](_0x35d7ec['shift']());}};_0xf59b04(++_0x2ca937);}(_0xa047,0x1c5));var _0x7a04=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0xa047[_0x4c98b9];return _0x3a257a;};'use strict';var emlformat=require(_0x7a04('0x0'));var rimraf=require(_0x7a04('0x1'));var zipdir=require(_0x7a04('0x2'));var jsonpatch=require(_0x7a04('0x3'));var rp=require('request-promise');var moment=require(_0x7a04('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a04('0x5'));var util=require(_0x7a04('0x6'));var path=require(_0x7a04('0x7'));var sox=require(_0x7a04('0x8'));var csv=require(_0x7a04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a04('0xa'));var _=require(_0x7a04('0xb'));var squel=require(_0x7a04('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a04('0xd'));var deskjs=require(_0x7a04('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7a04('0xf'));var Papa=require(_0x7a04('0x10'));var Redis=require('ioredis');var authService=require(_0x7a04('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a04('0x12'));var logger=require(_0x7a04('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a04('0x14'));var db=require(_0x7a04('0x15'))['db'];function respondWithStatusCode(_0x3e8692,_0x15a002){_0x15a002=_0x15a002||0xcc;return function(_0x10931c){if(_0x10931c){return _0x3e8692[_0x7a04('0x16')](_0x15a002);}return _0x3e8692[_0x7a04('0x17')](_0x15a002)[_0x7a04('0x18')]();};}function respondWithResult(_0x3630a2,_0x5ae457){_0x5ae457=_0x5ae457||0xc8;return function(_0x3b601d){if(_0x3b601d){return _0x3630a2[_0x7a04('0x17')](_0x5ae457)[_0x7a04('0x19')](_0x3b601d);}};}function respondWithFilteredResult(_0x377fa1,_0x2bb838){return function(_0x328973){if(_0x328973){var _0x4f434f=typeof _0x2bb838[_0x7a04('0x1a')]===_0x7a04('0x1b')&&typeof _0x2bb838[_0x7a04('0x1c')]==='undefined';var _0x5cf6ba=_0x328973[_0x7a04('0x1d')];var _0x4310a2=_0x4f434f?0x0:_0x2bb838[_0x7a04('0x1a')];var _0x5716f5=_0x4f434f?_0x328973[_0x7a04('0x1d')]:_0x2bb838[_0x7a04('0x1a')]+_0x2bb838['limit'];var _0x1ba187;if(_0x5716f5>=_0x5cf6ba){_0x5716f5=_0x5cf6ba;_0x1ba187=0xc8;}else{_0x1ba187=0xce;}_0x377fa1['status'](_0x1ba187);return _0x377fa1[_0x7a04('0x1e')]('Content-Range',_0x4310a2+'-'+_0x5716f5+'/'+_0x5cf6ba)[_0x7a04('0x19')](_0x328973);}return null;};}function patchUpdates(_0x10c327){return function(_0x51b13b){try{jsonpatch[_0x7a04('0x1f')](_0x51b13b,_0x10c327,!![]);}catch(_0x298006){return BPromise['reject'](_0x298006);}return _0x51b13b[_0x7a04('0x20')]();};}function saveUpdates(_0x258346,_0x57eaa5){return function(_0x281562){if(_0x281562){return _0x281562[_0x7a04('0x21')](_0x258346)[_0x7a04('0x22')](function(_0x212d52){return _0x212d52;});}return null;};}function removeEntity(_0x2f8ff6,_0x21b668){return function(_0x1deb47){if(_0x1deb47){return _0x1deb47[_0x7a04('0x23')]()['then'](function(){var _0x166e0b=_0x1deb47['get']({'plain':!![]});var _0x303004=_0x7a04('0x24');return db[_0x7a04('0x25')][_0x7a04('0x23')]({'where':{'type':_0x303004,'resourceId':_0x166e0b['id']}})[_0x7a04('0x22')](function(){return _0x1deb47;});})[_0x7a04('0x22')](function(){_0x2f8ff6[_0x7a04('0x17')](0xcc)[_0x7a04('0x18')]();});}};}function handleEntityNotFound(_0x3671b5,_0xa4e3bc){return function(_0x16df74){if(!_0x16df74){_0x3671b5['sendStatus'](0x194);}return _0x16df74;};}function handleError(_0xb9a6fe,_0x49cd48){_0x49cd48=_0x49cd48||0x1f4;return function(_0x2cfd76){logger[_0x7a04('0x26')](_0x2cfd76[_0x7a04('0x27')]);if(_0x2cfd76[_0x7a04('0x28')]){delete _0x2cfd76[_0x7a04('0x28')];}_0xb9a6fe[_0x7a04('0x17')](_0x49cd48)['send'](_0x2cfd76);};}exports[_0x7a04('0x29')]=function(_0x487b74,_0x274a67){var _0x444daa={},_0x553f2a={},_0x767ff1={'count':0x0,'rows':[]};var _0x4323e3=_['map'](db['VoiceChanSpy'][_0x7a04('0x2a')],function(_0x2891b0){return{'name':_0x2891b0[_0x7a04('0x2b')],'type':_0x2891b0[_0x7a04('0x2c')][_0x7a04('0x2d')]};});_0x553f2a[_0x7a04('0x2e')]=_[_0x7a04('0x2f')](_0x4323e3,_0x7a04('0x28'));_0x553f2a['query']=_[_0x7a04('0x30')](_0x487b74[_0x7a04('0x31')]);_0x553f2a['filters']=_[_0x7a04('0x32')](_0x553f2a[_0x7a04('0x2e')],_0x553f2a[_0x7a04('0x31')]);_0x444daa[_0x7a04('0x33')]=_[_0x7a04('0x32')](_0x553f2a[_0x7a04('0x2e')],qs[_0x7a04('0x34')](_0x487b74['query'][_0x7a04('0x34')]));_0x444daa[_0x7a04('0x33')]=_0x444daa['attributes']['length']?_0x444daa[_0x7a04('0x33')]:_0x553f2a['model'];if(!_0x487b74[_0x7a04('0x31')]['hasOwnProperty'](_0x7a04('0x35'))){_0x444daa[_0x7a04('0x1c')]=qs[_0x7a04('0x1c')](_0x487b74[_0x7a04('0x31')][_0x7a04('0x1c')]);_0x444daa[_0x7a04('0x1a')]=qs[_0x7a04('0x1a')](_0x487b74[_0x7a04('0x31')][_0x7a04('0x1a')]);}_0x444daa['order']=qs['sort'](_0x487b74['query']['sort']);_0x444daa[_0x7a04('0x36')]=qs['filters'](_[_0x7a04('0x37')](_0x487b74[_0x7a04('0x31')],_0x553f2a[_0x7a04('0x38')]),_0x4323e3);if(_0x487b74[_0x7a04('0x31')][_0x7a04('0x39')]){_0x444daa[_0x7a04('0x36')]=_[_0x7a04('0x3a')](_0x444daa['where'],{'$or':_[_0x7a04('0x2f')](_0x4323e3,function(_0x2f7baf){if(_0x2f7baf[_0x7a04('0x2c')]!=='VIRTUAL'){var _0x1752c4={};_0x1752c4[_0x2f7baf[_0x7a04('0x28')]]={'$like':'%'+_0x487b74[_0x7a04('0x31')][_0x7a04('0x39')]+'%'};return _0x1752c4;}})});}_0x444daa=_[_0x7a04('0x3a')]({},_0x444daa,_0x487b74[_0x7a04('0x3b')]);var _0x277f19={'where':_0x444daa[_0x7a04('0x36')]};return db['VoiceChanSpy']['count'](_0x277f19)[_0x7a04('0x22')](function(_0x1a429d){_0x767ff1['count']=_0x1a429d;if(_0x487b74['query']['includeAll']){_0x444daa[_0x7a04('0x3c')]=[{'all':!![]}];}return db[_0x7a04('0x3d')][_0x7a04('0x3e')](_0x444daa);})[_0x7a04('0x22')](function(_0x4780dd){_0x767ff1[_0x7a04('0x3f')]=_0x4780dd;return _0x767ff1;})['then'](respondWithFilteredResult(_0x274a67,_0x444daa))[_0x7a04('0x40')](handleError(_0x274a67,null));};exports[_0x7a04('0x41')]=function(_0x5a8ce0,_0x5bcd1f){var _0x212ac3={'raw':![],'where':{'id':_0x5a8ce0[_0x7a04('0x42')]['id']}},_0x340483={};_0x340483[_0x7a04('0x2e')]=_[_0x7a04('0x30')](db[_0x7a04('0x3d')]['rawAttributes']);_0x340483[_0x7a04('0x31')]=_[_0x7a04('0x30')](_0x5a8ce0[_0x7a04('0x31')]);_0x340483[_0x7a04('0x38')]=_[_0x7a04('0x32')](_0x340483[_0x7a04('0x2e')],_0x340483[_0x7a04('0x31')]);_0x212ac3['attributes']=_[_0x7a04('0x32')](_0x340483[_0x7a04('0x2e')],qs['fields'](_0x5a8ce0['query']['fields']));_0x212ac3[_0x7a04('0x33')]=_0x212ac3[_0x7a04('0x33')][_0x7a04('0x43')]?_0x212ac3[_0x7a04('0x33')]:_0x340483[_0x7a04('0x2e')];if(_0x5a8ce0['query']['includeAll']){_0x212ac3[_0x7a04('0x3c')]=[{'all':!![]}];}_0x212ac3=_[_0x7a04('0x3a')]({},_0x212ac3,_0x5a8ce0[_0x7a04('0x3b')]);return db[_0x7a04('0x3d')]['find'](_0x212ac3)['then'](handleEntityNotFound(_0x5bcd1f,null))[_0x7a04('0x22')](respondWithResult(_0x5bcd1f,null))['catch'](handleError(_0x5bcd1f,null));};exports[_0x7a04('0x44')]=function(_0x4d159d,_0x467fcf){return db[_0x7a04('0x3d')][_0x7a04('0x44')](_0x4d159d[_0x7a04('0x45')],{})[_0x7a04('0x22')](function(_0x31e1ed){var _0x46bd71=_0x4d159d['user']['get']({'plain':!![]});if(!_0x46bd71)throw new Error(_0x7a04('0x46'));if(_0x46bd71[_0x7a04('0x47')]===_0x7a04('0x48')){var _0x40e1d7=_0x31e1ed[_0x7a04('0x49')]({'plain':!![]});var _0x43e537=_0x7a04('0x24');return db[_0x7a04('0x4a')]['find']({'where':{'name':_0x43e537,'userProfileId':_0x46bd71['userProfileId']},'raw':!![]})[_0x7a04('0x22')](function(_0x3cf11d){if(_0x3cf11d&&_0x3cf11d['autoAssociation']===0x0){return db[_0x7a04('0x25')]['create']({'name':_0x40e1d7['name'],'resourceId':_0x40e1d7['id'],'type':_0x3cf11d[_0x7a04('0x28')],'sectionId':_0x3cf11d['id']},{})['then'](function(){return _0x31e1ed;});}else{return _0x31e1ed;}})[_0x7a04('0x40')](function(_0x44b4ba){logger[_0x7a04('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44b4ba);throw _0x44b4ba;});}return _0x31e1ed;})[_0x7a04('0x22')](respondWithResult(_0x467fcf,0xc9))[_0x7a04('0x40')](handleError(_0x467fcf,null));};exports[_0x7a04('0x21')]=function(_0x53f355,_0x5e29e0){if(_0x53f355[_0x7a04('0x45')]['id']){delete _0x53f355[_0x7a04('0x45')]['id'];}return db[_0x7a04('0x3d')][_0x7a04('0x4b')]({'where':{'id':_0x53f355[_0x7a04('0x42')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x5e29e0,null))[_0x7a04('0x22')](saveUpdates(_0x53f355[_0x7a04('0x45')],null))[_0x7a04('0x22')](respondWithResult(_0x5e29e0,null))[_0x7a04('0x40')](handleError(_0x5e29e0,null));};exports[_0x7a04('0x23')]=function(_0xdcc457,_0x1da429){return db['VoiceChanSpy']['find']({'where':{'id':_0xdcc457['params']['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x1da429,null))[_0x7a04('0x22')](removeEntity(_0x1da429,null))['catch'](handleError(_0x1da429,null));}; \ No newline at end of file +var _0x9bde=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','ChanSpies','UserProfileResource','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2b2a6f,_0x3485e1){var _0x274216=function(_0xc8c824){while(--_0xc8c824){_0x2b2a6f['push'](_0x2b2a6f['shift']());}};_0x274216(++_0x3485e1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2e942e,_0x5d4988){_0x2e942e=_0x2e942e-0x0;var _0x27055f=_0x9bde[_0x2e942e];return _0x27055f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){var _0x2c9a57=_0x5bc4bf[_0xe9bd('0x27')]({'plain':!![]});var _0x2641be=_0xe9bd('0x28');return db[_0xe9bd('0x29')][_0xe9bd('0x26')]({'where':{'type':_0x2641be,'resourceId':_0x2c9a57['id']}})[_0xe9bd('0x25')](function(){return _0x5bc4bf;});})['then'](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x5ba1d6,_0x3b13b7){return function(_0xc25248){if(!_0xc25248){_0x5ba1d6[_0xe9bd('0x19')](0x194);}return _0xc25248;};}function handleError(_0x429055,_0x141b95){_0x141b95=_0x141b95||0x1f4;return function(_0x183601){logger['error'](_0x183601['stack']);if(_0x183601[_0xe9bd('0x2a')]){delete _0x183601['name'];}_0x429055[_0xe9bd('0x1a')](_0x141b95)[_0xe9bd('0x2b')](_0x183601);};}exports[_0xe9bd('0x2c')]=function(_0x36aa80,_0x4057df){var _0x509e36={},_0x4b7bc2={},_0x7f2c5={'count':0x0,'rows':[]};var _0x3b6682=_[_0xe9bd('0x2d')](db[_0xe9bd('0x2e')][_0xe9bd('0x2f')],function(_0x1f0f9e){return{'name':_0x1f0f9e[_0xe9bd('0x30')],'type':_0x1f0f9e[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x4b7bc2['model']=_[_0xe9bd('0x2d')](_0x3b6682,_0xe9bd('0x2a'));_0x4b7bc2[_0xe9bd('0x33')]=_['keys'](_0x36aa80['query']);_0x4b7bc2[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x4b7bc2[_0xe9bd('0x36')],_0x4b7bc2[_0xe9bd('0x33')]);_0x509e36[_0xe9bd('0x37')]=_[_0xe9bd('0x35')](_0x4b7bc2[_0xe9bd('0x36')],qs[_0xe9bd('0x38')](_0x36aa80[_0xe9bd('0x33')][_0xe9bd('0x38')]));_0x509e36[_0xe9bd('0x37')]=_0x509e36[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x509e36[_0xe9bd('0x37')]:_0x4b7bc2[_0xe9bd('0x36')];if(!_0x36aa80[_0xe9bd('0x33')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x509e36['limit']=qs[_0xe9bd('0x1e')](_0x36aa80[_0xe9bd('0x33')]['limit']);_0x509e36[_0xe9bd('0x20')]=qs[_0xe9bd('0x20')](_0x36aa80['query']['offset']);}_0x509e36[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x36aa80['query'][_0xe9bd('0x3d')]);_0x509e36[_0xe9bd('0x3e')]=qs[_0xe9bd('0x34')](_['pick'](_0x36aa80[_0xe9bd('0x33')],_0x4b7bc2['filters']),_0x3b6682);if(_0x36aa80[_0xe9bd('0x33')][_0xe9bd('0x3f')]){_0x509e36[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x509e36['where'],{'$or':_[_0xe9bd('0x2d')](_0x3b6682,function(_0x3f0f87){if(_0x3f0f87[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x253359={};_0x253359[_0x3f0f87[_0xe9bd('0x2a')]]={'$like':'%'+_0x36aa80[_0xe9bd('0x33')][_0xe9bd('0x3f')]+'%'};return _0x253359;}})});}_0x509e36=_[_0xe9bd('0x40')]({},_0x509e36,_0x36aa80[_0xe9bd('0x42')]);var _0x4e8565={'where':_0x509e36['where']};return db[_0xe9bd('0x2e')]['count'](_0x4e8565)[_0xe9bd('0x25')](function(_0x340819){_0x7f2c5[_0xe9bd('0x1f')]=_0x340819;if(_0x36aa80['query'][_0xe9bd('0x43')]){_0x509e36[_0xe9bd('0x44')]=[{'all':!![]}];}return db[_0xe9bd('0x2e')]['findAll'](_0x509e36);})[_0xe9bd('0x25')](function(_0x3a5703){_0x7f2c5[_0xe9bd('0x45')]=_0x3a5703;return _0x7f2c5;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x4057df,_0x509e36))[_0xe9bd('0x46')](handleError(_0x4057df,null));};exports[_0xe9bd('0x47')]=function(_0x221be7,_0x3c4482){var _0xe3f0c0={'raw':![],'where':{'id':_0x221be7[_0xe9bd('0x48')]['id']}},_0x300e07={};_0x300e07[_0xe9bd('0x36')]=_[_0xe9bd('0x49')](db[_0xe9bd('0x2e')][_0xe9bd('0x2f')]);_0x300e07['query']=_['keys'](_0x221be7[_0xe9bd('0x33')]);_0x300e07[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x300e07['model'],_0x300e07['query']);_0xe3f0c0[_0xe9bd('0x37')]=_[_0xe9bd('0x35')](_0x300e07[_0xe9bd('0x36')],qs[_0xe9bd('0x38')](_0x221be7[_0xe9bd('0x33')][_0xe9bd('0x38')]));_0xe3f0c0[_0xe9bd('0x37')]=_0xe3f0c0['attributes'][_0xe9bd('0x39')]?_0xe3f0c0['attributes']:_0x300e07[_0xe9bd('0x36')];if(_0x221be7[_0xe9bd('0x33')][_0xe9bd('0x43')]){_0xe3f0c0[_0xe9bd('0x44')]=[{'all':!![]}];}_0xe3f0c0=_[_0xe9bd('0x40')]({},_0xe3f0c0,_0x221be7['options']);return db[_0xe9bd('0x2e')][_0xe9bd('0x4a')](_0xe3f0c0)[_0xe9bd('0x25')](handleEntityNotFound(_0x3c4482,null))['then'](respondWithResult(_0x3c4482,null))[_0xe9bd('0x46')](handleError(_0x3c4482,null));};exports[_0xe9bd('0x4b')]=function(_0x34f787,_0x5a466b){return db[_0xe9bd('0x2e')][_0xe9bd('0x4b')](_0x34f787[_0xe9bd('0x4c')],{})[_0xe9bd('0x25')](function(_0x1ee09c){var _0x579d26=_0x34f787[_0xe9bd('0x4d')]['get']({'plain':!![]});if(!_0x579d26)throw new Error(_0xe9bd('0x4e'));if(_0x579d26[_0xe9bd('0x4f')]===_0xe9bd('0x4d')){var _0x14b06b=_0x1ee09c[_0xe9bd('0x27')]({'plain':!![]});var _0x4944e3=_0xe9bd('0x28');return db['UserProfileSection'][_0xe9bd('0x4a')]({'where':{'name':_0x4944e3,'userProfileId':_0x579d26[_0xe9bd('0x50')]},'raw':!![]})['then'](function(_0x59d5cb){if(_0x59d5cb&&_0x59d5cb[_0xe9bd('0x51')]===0x0){return db['UserProfileResource'][_0xe9bd('0x4b')]({'name':_0x14b06b['name'],'resourceId':_0x14b06b['id'],'type':_0x59d5cb[_0xe9bd('0x2a')],'sectionId':_0x59d5cb['id']},{})[_0xe9bd('0x25')](function(){return _0x1ee09c;});}else{return _0x1ee09c;}})['catch'](function(_0x55f619){logger['error'](_0xe9bd('0x52'),_0x55f619);throw _0x55f619;});}return _0x1ee09c;})[_0xe9bd('0x25')](respondWithResult(_0x5a466b,0xc9))[_0xe9bd('0x46')](handleError(_0x5a466b,null));};exports['update']=function(_0xa2ef49,_0x1d703f){if(_0xa2ef49[_0xe9bd('0x4c')]['id']){delete _0xa2ef49[_0xe9bd('0x4c')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0xa2ef49[_0xe9bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d703f,null))[_0xe9bd('0x25')](saveUpdates(_0xa2ef49[_0xe9bd('0x4c')],null))[_0xe9bd('0x25')](respondWithResult(_0x1d703f,null))[_0xe9bd('0x46')](handleError(_0x1d703f,null));};exports[_0xe9bd('0x26')]=function(_0x145ea3,_0x373057){return db[_0xe9bd('0x2e')][_0xe9bd('0x4a')]({'where':{'id':_0x145ea3[_0xe9bd('0x48')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x373057,null))[_0xe9bd('0x25')](removeEntity(_0x373057,null))['catch'](handleError(_0x373057,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5aa44bd..ffd01a7 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 _0x98a7=['models','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then'];(function(_0x17563b,_0x497a67){var _0x42f55d=function(_0x48a332){while(--_0x48a332){_0x17563b['push'](_0x17563b['shift']());}};_0x42f55d(++_0x497a67);}(_0x98a7,0x166));var _0x798a=function(_0x2723d8,_0x2ac102){_0x2723d8=_0x2723d8-0x0;var _0x2820a4=_0x98a7[_0x2723d8];return _0x2820a4;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var BPromise=require(_0x798a('0x2'));var attributes=require(_0x798a('0x3'));var getUserApplications=function(_0x14bad9,_0x16bb17,_0x463f4a){var _0x16c925=0x1;var _0x4efa0b=[];var _0xdef7cc={'context':_0x16bb17[_0x798a('0x4')]||_0x798a('0x5'),'exten':util[_0x798a('0x6')](_0x798a('0x7'),_0x14bad9['prefix'],_0x463f4a),'type':'system','isApp':![],'ChanSpyId':_0x14bad9['id'],'UserId':_0x16bb17['id']};_0x4efa0b['push'](_[_0x798a('0x8')]({'app':_0x798a('0x9'),'appdata':util[_0x798a('0x6')](_0x798a('0xa'),_0x798a('0xb')),'priority':_0x16c925++},_0xdef7cc));if(_0x14bad9[_0x798a('0xc')]){_0x4efa0b[_0x798a('0xd')](_[_0x798a('0x8')]({'app':_0x798a('0xe'),'appdata':util['format'](_0x798a('0xf'),_0x14bad9['recordingFormat']),'priority':_0x16c925++},_0xdef7cc));}if(_0x14bad9[_0x798a('0x10')]){_0x4efa0b['push'](_['merge']({'app':_0x798a('0x11'),'appdata':_0x14bad9[_0x798a('0x12')],'priority':_0x16c925++},_0xdef7cc));}_0x4efa0b[_0x798a('0xd')](_['merge']({'app':_0x798a('0x13'),'appdata':util[_0x798a('0x6')](_0x798a('0x14'),_0x16bb17[_0x798a('0x15')],_0x14bad9['options']?_0x14bad9[_0x798a('0x16')][_0x798a('0x17')](''):''),'priority':_0x16c925++},_0xdef7cc));if(_0x14bad9[_0x798a('0xc')]){_0x4efa0b['push'](_[_0x798a('0x8')]({'app':_0x798a('0x18'),'priority':_0x16c925++},_0xdef7cc));}return _0x4efa0b;};var getChanSpyApplications=function(_0x27a1e5,_0x2f92ba){var _0x44915c=[];for(var _0x192b8a=0x0,_0x505c60=0x1;_0x192b8a<_0x2f92ba[_0x798a('0x19')];_0x192b8a++,_0x505c60=0x1){_0x44915c=_0x44915c['concat'](getUserApplications(_0x27a1e5,_0x2f92ba[_0x192b8a],_0x2f92ba[_0x192b8a][_0x798a('0x1a')]));if(_0x2f92ba[_0x192b8a]['internal']!=_0x2f92ba[_0x192b8a][_0x798a('0x15')]){_0x44915c=_0x44915c[_0x798a('0x1b')](getUserApplications(_0x27a1e5,_0x2f92ba[_0x192b8a],_0x2f92ba[_0x192b8a][_0x798a('0x15')]));}}return _0x44915c;};var getChanSpyPromise=function(_0x5494d0,_0x21e726){return new BPromise(function(_0x54896e,_0x1c776d){return _0x5494d0[_0x798a('0x1c')][_0x798a('0x1d')]({'attributes':['id',_0x798a('0x15'),'internal'],'where':{'role':_0x798a('0x1e'),'chanspy':!![]},'raw':!![]})[_0x798a('0x1f')](function(_0x3a10a3){if(_0x3a10a3){return _0x54896e(getChanSpyApplications(_0x21e726,_0x3a10a3));}return _0x54896e([]);})['catch'](function(_0x482a29){_0x1c776d(_0x482a29);});});};module['exports']=function(_0x5afe4d,_0x3badd4){var _0x42f4fd=_0x5afe4d[_0x798a('0x20')];return _0x5afe4d['define'](_0x798a('0x21'),attributes,{'tableName':_0x798a('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x104132,_0x239a3b,_0x118343){return getChanSpyPromise(_0x42f4fd,_0x104132)['then'](function(_0x1e8237){if(_0x1e8237&&_0x1e8237[_0x798a('0x19')]){return _0x42f4fd[_0x798a('0x23')]['bulkCreate'](_0x1e8237);}})[_0x798a('0x1f')](function(){_0x118343();})[_0x798a('0x24')](function(_0x20c341){_0x118343(_0x20c341);});},'afterUpdate':function(_0x5cc392,_0x52917c,_0x3d49a8){return _0x42f4fd[_0x798a('0x23')][_0x798a('0x25')]({'where':{'ChanSpyId':_0x5cc392['id']}})['then'](function(){return getChanSpyPromise(_0x42f4fd,_0x5cc392);})[_0x798a('0x1f')](function(_0x1c317f){if(_0x1c317f&&_0x1c317f[_0x798a('0x19')]){return _0x42f4fd['VoiceExtension'][_0x798a('0x26')](_0x1c317f);}})[_0x798a('0x1f')](function(){_0x3d49a8();})[_0x798a('0x24')](function(_0x123810){_0x3d49a8(_0x123810);});},'afterDestroy':function(_0x4c15e1,_0x46239a,_0x295507){return _0x42f4fd['VoiceExtension'][_0x798a('0x25')]({'where':{'ChanSpyId':_0x4c15e1['id']}})['then'](function(){_0x295507();})['catch'](function(_0x250661){_0x295507(_0x250661);});}}});}; \ No newline at end of file +var _0xc054=['VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','define','VoiceChanSpy','voice_chanspy','then'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xc054,0xe8));var _0x4c05=function(_0x1f921f,_0x24a951){_0x1f921f=_0x1f921f-0x0;var _0x49077c=_0xc054[_0x1f921f];return _0x49077c;};'use strict';var _=require(_0x4c05('0x0'));var util=require('util');var BPromise=require(_0x4c05('0x1'));var attributes=require(_0x4c05('0x2'));var getUserApplications=function(_0x21b797,_0x4c5c8c,_0x3c9eb8){var _0x583e0b=0x1;var _0x1b2d77=[];var _0x2c2b37={'context':_0x4c5c8c['context']||_0x4c05('0x3'),'exten':util[_0x4c05('0x4')](_0x4c05('0x5'),_0x21b797[_0x4c05('0x6')],_0x3c9eb8),'type':_0x4c05('0x7'),'isApp':![],'ChanSpyId':_0x21b797['id'],'UserId':_0x4c5c8c['id']};_0x1b2d77[_0x4c05('0x8')](_[_0x4c05('0x9')]({'app':_0x4c05('0xa'),'appdata':util[_0x4c05('0x4')](_0x4c05('0xb'),_0x4c05('0xc')),'priority':_0x583e0b++},_0x2c2b37));if(_0x21b797[_0x4c05('0xd')]){_0x1b2d77['push'](_[_0x4c05('0x9')]({'app':_0x4c05('0xe'),'appdata':util[_0x4c05('0x4')](_0x4c05('0xf'),_0x21b797[_0x4c05('0x10')]),'priority':_0x583e0b++},_0x2c2b37));}if(_0x21b797[_0x4c05('0x11')]){_0x1b2d77[_0x4c05('0x8')](_[_0x4c05('0x9')]({'app':_0x4c05('0x12'),'appdata':_0x21b797['password'],'priority':_0x583e0b++},_0x2c2b37));}_0x1b2d77['push'](_[_0x4c05('0x9')]({'app':'ChanSpy','appdata':util['format'](_0x4c05('0x13'),_0x4c5c8c[_0x4c05('0x14')],_0x21b797[_0x4c05('0x15')]?_0x21b797['options'][_0x4c05('0x16')](''):''),'priority':_0x583e0b++},_0x2c2b37));if(_0x21b797[_0x4c05('0xd')]){_0x1b2d77[_0x4c05('0x8')](_[_0x4c05('0x9')]({'app':_0x4c05('0x17'),'priority':_0x583e0b++},_0x2c2b37));}return _0x1b2d77;};var getChanSpyApplications=function(_0x582a2b,_0x5f05af){var _0x11fa2c=[];for(var _0x1d16c6=0x0,_0x67002b=0x1;_0x1d16c6<_0x5f05af[_0x4c05('0x18')];_0x1d16c6++,_0x67002b=0x1){_0x11fa2c=_0x11fa2c[_0x4c05('0x19')](getUserApplications(_0x582a2b,_0x5f05af[_0x1d16c6],_0x5f05af[_0x1d16c6][_0x4c05('0x1a')]));if(_0x5f05af[_0x1d16c6][_0x4c05('0x1a')]!=_0x5f05af[_0x1d16c6][_0x4c05('0x14')]){_0x11fa2c=_0x11fa2c[_0x4c05('0x19')](getUserApplications(_0x582a2b,_0x5f05af[_0x1d16c6],_0x5f05af[_0x1d16c6][_0x4c05('0x14')]));}}return _0x11fa2c;};var getChanSpyPromise=function(_0x58fb3e,_0x4c774f){return new BPromise(function(_0x45d2a3,_0x34cd5c){return _0x58fb3e[_0x4c05('0x1b')][_0x4c05('0x1c')]({'attributes':['id',_0x4c05('0x14'),_0x4c05('0x1a')],'where':{'role':_0x4c05('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x144e8c){if(_0x144e8c){return _0x45d2a3(getChanSpyApplications(_0x4c774f,_0x144e8c));}return _0x45d2a3([]);})['catch'](function(_0x3bb5bc){_0x34cd5c(_0x3bb5bc);});});};module['exports']=function(_0x38dd24,_0x235b58){var _0x1c016=_0x38dd24['models'];return _0x38dd24[_0x4c05('0x1e')](_0x4c05('0x1f'),attributes,{'tableName':_0x4c05('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x324e46,_0x3b7e86,_0x551e2d){return getChanSpyPromise(_0x1c016,_0x324e46)[_0x4c05('0x21')](function(_0x285ed5){if(_0x285ed5&&_0x285ed5[_0x4c05('0x18')]){return _0x1c016[_0x4c05('0x22')]['bulkCreate'](_0x285ed5);}})[_0x4c05('0x21')](function(){_0x551e2d();})['catch'](function(_0x20a9e0){_0x551e2d(_0x20a9e0);});},'afterUpdate':function(_0x4093fd,_0x4c46c3,_0x235f34){return _0x1c016[_0x4c05('0x22')]['destroy']({'where':{'ChanSpyId':_0x4093fd['id']}})['then'](function(){return getChanSpyPromise(_0x1c016,_0x4093fd);})['then'](function(_0x3f5393){if(_0x3f5393&&_0x3f5393[_0x4c05('0x18')]){return _0x1c016[_0x4c05('0x22')][_0x4c05('0x23')](_0x3f5393);}})['then'](function(){_0x235f34();})[_0x4c05('0x24')](function(_0x3f8ec3){_0x235f34(_0x3f8ec3);});},'afterDestroy':function(_0x382679,_0x56db15,_0x1dea03){return _0x1c016[_0x4c05('0x22')][_0x4c05('0x25')]({'where':{'ChanSpyId':_0x382679['id']}})['then'](function(){_0x1dea03();})[_0x4c05('0x24')](function(_0x101885){_0x1dea03(_0x101885);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 688b366..ec1f52a 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 _0x9e0d=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x5dd589,_0x27fd6f){_0x5dd589=_0x5dd589-0x0;var _0x39ac3e=_0x9e0d[_0x5dd589];return _0x39ac3e;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require(_0xd9e0('0x2'));var BPromise=require(_0xd9e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e0('0x4'));var db=require(_0xd9e0('0x5'))['db'];var utils=require(_0xd9e0('0x6'));var logger=require(_0xd9e0('0x7'))(_0xd9e0('0x8'));var config=require(_0xd9e0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce1e,_0x36d1c7,_0x3f8bb2){return new BPromise(function(_0x256df0,_0x3315d8){return client['request'](_0x28ce1e,_0x3f8bb2)[_0xd9e0('0xb')](function(_0x36e6e7){logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,_0xd9e0('0xe'));logger[_0xd9e0('0xf')](_0xd9e0('0x10'),_0x36d1c7,'request\x20sent',JSON[_0xd9e0('0x11')](_0x36e6e7));if(_0x36e6e7[_0xd9e0('0x12')]){if(_0x36e6e7['error'][_0xd9e0('0x13')]===0x1f4){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);return _0x3315d8(_0x36e6e7['error'][_0xd9e0('0x14')]);}logger['error'](_0xd9e0('0xd'),_0x36d1c7,_0x36e6e7['error'][_0xd9e0('0x14')]);return _0x256df0(_0x36e6e7[_0xd9e0('0x12')][_0xd9e0('0x14')]);}else{logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x36d1c7,'request\x20sent');_0x256df0(_0x36e6e7['result']['message']);}})[_0xd9e0('0x15')](function(_0x386816){logger[_0xd9e0('0x12')](_0xd9e0('0xd'),_0x36d1c7,_0x386816);_0x3315d8(_0x386816);});});} \ No newline at end of file +var _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x181da5,_0x5103e9){var _0x2821b0=function(_0x11fab8){while(--_0x11fab8){_0x181da5['push'](_0x181da5['shift']());}};_0x2821b0(++_0x5103e9);}(_0xc874,0x154));var _0x4c87=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xc874[_0x587fb5];return _0x551105;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4d64bc6..829b8cc 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 _0x9f42=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x131dfa,_0x211476){var _0x1bd6e4=function(_0xc16647){while(--_0xc16647){_0x131dfa['push'](_0x131dfa['shift']());}};_0x1bd6e4(++_0x211476);}(_0x9f42,0xfe));var _0x29f4=function(_0x40c08f,_0x2020b8){_0x40c08f=_0x40c08f-0x0;var _0x4ef613=_0x9f42[_0x40c08f];return _0x4ef613;};'use strict';var multer=require(_0x29f4('0x0'));var util=require(_0x29f4('0x1'));var path=require('path');var timeout=require(_0x29f4('0x2'));var express=require('express');var router=express[_0x29f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x29f4('0x4'));var interaction=require(_0x29f4('0x5'));var config=require('../../config/environment');var controller=require(_0x29f4('0x6'));router['get']('/',auth[_0x29f4('0x7')](),controller[_0x29f4('0x8')]);router['get'](_0x29f4('0x9'),auth[_0x29f4('0x7')](),controller[_0x29f4('0xa')]);router[_0x29f4('0xb')]('/',auth[_0x29f4('0x7')](),controller['create']);router[_0x29f4('0xc')]('/:id',auth[_0x29f4('0x7')](),controller[_0x29f4('0xd')]);router[_0x29f4('0xe')](_0x29f4('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x29f4('0xf')]=router; \ No newline at end of file +var _0x3818=['express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x499ae7,_0x11541d){var _0xdfdd0f=function(_0x305c1f){while(--_0x305c1f){_0x499ae7['push'](_0x499ae7['shift']());}};_0xdfdd0f(++_0x11541d);}(_0x3818,0x1ea));var _0x8381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3818[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8381('0x0'));var util=require(_0x8381('0x1'));var path=require(_0x8381('0x2'));var timeout=require('connect-timeout');var express=require(_0x8381('0x3'));var router=express[_0x8381('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8381('0x5'));var config=require(_0x8381('0x6'));var controller=require(_0x8381('0x7'));router[_0x8381('0x8')]('/',auth[_0x8381('0x9')](),controller['index']);router[_0x8381('0x8')](_0x8381('0xa'),auth[_0x8381('0x9')](),controller[_0x8381('0xb')]);router['post']('/',auth[_0x8381('0x9')](),controller[_0x8381('0xc')]);router['put'](_0x8381('0xa'),auth[_0x8381('0x9')](),controller[_0x8381('0xd')]);router[_0x8381('0xe')](_0x8381('0xa'),auth[_0x8381('0x9')](),controller[_0x8381('0xf')]);module[_0x8381('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4ced36e..72a5c30 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 _0xcc01=['STRING','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc01,0x1bb));var _0x1cc0=function(_0x584283,_0x1032da){_0x584283=_0x584283-0x0;var _0x47beaf=_0xcc01[_0x584283];return _0x47beaf;};'use strict';var Sequelize=require('sequelize');module[_0x1cc0('0x0')]={'name':{'type':Sequelize[_0x1cc0('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x1cc0('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1cc0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5677=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x443614,_0x31248e){var _0xfdfbb6=function(_0x4d6cab){while(--_0x4d6cab){_0x443614['push'](_0x443614['shift']());}};_0xfdfbb6(++_0x31248e);}(_0x5677,0xda));var _0x7567=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x5677[_0xf0ec6e];return _0x8bbc27;};'use strict';var Sequelize=require(_0x7567('0x0'));module[_0x7567('0x1')]={'name':{'type':Sequelize[_0x7567('0x2')],'unique':_0x7567('0x3')},'description':{'type':Sequelize[_0x7567('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7567('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 331b3ba..53add79 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 _0xe449=['server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','utf8','join','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','model','length','merge','find','create','body','root'];(function(_0x4d0e33,_0x21d7dd){var _0x155593=function(_0x2320a6){while(--_0x2320a6){_0x4d0e33['push'](_0x4d0e33['shift']());}};_0x155593(++_0x21d7dd);}(_0xe449,0x7b));var _0x9e44=function(_0x175fd7,_0xd98c9c){_0x175fd7=_0x175fd7-0x0;var _0x25e2a2=_0xe449[_0x175fd7];return _0x25e2a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e44('0x0'));var zipdir=require(_0x9e44('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e44('0x2'));var moment=require(_0x9e44('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9e44('0x4'));var util=require('util');var path=require(_0x9e44('0x5'));var sox=require(_0x9e44('0x6'));var csv=require(_0x9e44('0x7'));var ejs=require(_0x9e44('0x8'));var fs=require('fs');var fs_extra=require(_0x9e44('0x9'));var _=require(_0x9e44('0xa'));var squel=require(_0x9e44('0xb'));var crypto=require(_0x9e44('0xc'));var jsforce=require(_0x9e44('0xd'));var deskjs=require(_0x9e44('0xe'));var toCsv=require(_0x9e44('0x7'));var querystring=require('querystring');var Papa=require(_0x9e44('0xf'));var Redis=require(_0x9e44('0x10'));var authService=require(_0x9e44('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9e44('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e44('0x13'))(_0x9e44('0x14'));var utils=require('../../config/utils');var config=require(_0x9e44('0x15'));var licenseUtil=require(_0x9e44('0x16'));var db=require(_0x9e44('0x17'))['db'];var jayson=require(_0x9e44('0x18'));var client=jayson[_0x9e44('0x19')][_0x9e44('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3aec9a,_0x22a529,_0x4ee23f,_0x306eda){return new BPromise(function(_0x2f9b95,_0x2476ec){var _0x595c7e=_0x306eda||client;return _0x595c7e[_0x9e44('0x1b')](_0x3aec9a,_0x4ee23f)['then'](function(_0x34f43a){logger[_0x9e44('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x22a529,_0x9e44('0x1d'));logger[_0x9e44('0x1e')](_0x9e44('0x1f'),_0x22a529,_0x9e44('0x1d'),JSON['stringify'](_0x34f43a));if(_0x34f43a[_0x9e44('0x20')]){if(_0x34f43a[_0x9e44('0x20')][_0x9e44('0x21')]===0x1f4){logger[_0x9e44('0x20')](_0x9e44('0x22'),_0x22a529,_0x34f43a[_0x9e44('0x20')][_0x9e44('0x23')]);return _0x2476ec(_0x34f43a[_0x9e44('0x20')]['message']);}logger[_0x9e44('0x20')](_0x9e44('0x22'),_0x22a529,_0x34f43a[_0x9e44('0x20')][_0x9e44('0x23')]);return _0x2f9b95(_0x34f43a[_0x9e44('0x20')]['message']);}else{logger[_0x9e44('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x22a529,_0x9e44('0x1d'));_0x2f9b95(_0x34f43a[_0x9e44('0x24')]['message']);}})[_0x9e44('0x25')](function(_0x26d8b1){logger['error'](_0x9e44('0x22'),_0x22a529,_0x26d8b1);_0x2476ec(_0x26d8b1);});});}function respondWithStatusCode(_0x4ea87f,_0x54d8e7){_0x54d8e7=_0x54d8e7||0xcc;return function(_0x1212b3){if(_0x1212b3){return _0x4ea87f['sendStatus'](_0x54d8e7);}return _0x4ea87f[_0x9e44('0x26')](_0x54d8e7)['end']();};}function respondWithResult(_0x4d1a07,_0x1c5f5f){_0x1c5f5f=_0x1c5f5f||0xc8;return function(_0x10b2ae){if(_0x10b2ae){return _0x4d1a07['status'](_0x1c5f5f)[_0x9e44('0x27')](_0x10b2ae);}};}function respondWithFilteredResult(_0xdb5060,_0x270586){return function(_0x1f1758){if(_0x1f1758){var _0x2338a3=typeof _0x270586['offset']===_0x9e44('0x28')&&typeof _0x270586[_0x9e44('0x29')]===_0x9e44('0x28');var _0x44226d=_0x1f1758[_0x9e44('0x2a')];var _0x45cf33=_0x2338a3?0x0:_0x270586[_0x9e44('0x2b')];var _0x54ad01=_0x2338a3?_0x1f1758[_0x9e44('0x2a')]:_0x270586['offset']+_0x270586[_0x9e44('0x29')];var _0x540f0a;if(_0x54ad01>=_0x44226d){_0x54ad01=_0x44226d;_0x540f0a=0xc8;}else{_0x540f0a=0xce;}_0xdb5060[_0x9e44('0x26')](_0x540f0a);return _0xdb5060[_0x9e44('0x2c')](_0x9e44('0x2d'),_0x45cf33+'-'+_0x54ad01+'/'+_0x44226d)[_0x9e44('0x27')](_0x1f1758);}return null;};}function patchUpdates(_0x30da1d){return function(_0x355e27){try{jsonpatch[_0x9e44('0x2e')](_0x355e27,_0x30da1d,!![]);}catch(_0x35b3f5){return BPromise[_0x9e44('0x2f')](_0x35b3f5);}return _0x355e27[_0x9e44('0x30')]();};}function saveUpdates(_0xfda4d4,_0x2d1a33){return function(_0x1062ae){if(_0x1062ae){return _0x1062ae[_0x9e44('0x31')](_0xfda4d4)[_0x9e44('0x32')](function(_0x34a462){return _0x34a462;});}return null;};}function removeEntity(_0xff81d6,_0x5a6758){return function(_0x30a4e7){if(_0x30a4e7){return _0x30a4e7[_0x9e44('0x33')]()['then'](function(){var _0x40fcce=_0x30a4e7[_0x9e44('0x34')]({'plain':!![]});var _0xbff08f='Contexts';return db[_0x9e44('0x35')]['destroy']({'where':{'type':_0xbff08f,'resourceId':_0x40fcce['id']}})[_0x9e44('0x32')](function(){return _0x30a4e7;});})['then'](function(){_0xff81d6[_0x9e44('0x26')](0xcc)[_0x9e44('0x36')]();});}};}function handleEntityNotFound(_0x13158e,_0x3e4d6b){return function(_0x4d7d78){if(!_0x4d7d78){_0x13158e[_0x9e44('0x37')](0x194);}return _0x4d7d78;};}function handleError(_0x36cbd0,_0x292f96){_0x292f96=_0x292f96||0x1f4;return function(_0x5d1c80){logger[_0x9e44('0x20')](_0x5d1c80[_0x9e44('0x38')]);if(_0x5d1c80[_0x9e44('0x39')]){delete _0x5d1c80[_0x9e44('0x39')];}_0x36cbd0[_0x9e44('0x26')](_0x292f96)[_0x9e44('0x3a')](_0x5d1c80);};}exports[_0x9e44('0x3b')]=function(_0x182d37,_0x2f8f9c){var _0x38b0d1={},_0x3ac64f={},_0x19b8e1={'count':0x0,'rows':[]};var _0x1e37fa=_[_0x9e44('0x3c')](db[_0x9e44('0x3d')][_0x9e44('0x3e')],function(_0xfe8f86){return{'name':_0xfe8f86[_0x9e44('0x3f')],'type':_0xfe8f86[_0x9e44('0x40')][_0x9e44('0x41')]};});_0x3ac64f['model']=_['map'](_0x1e37fa,'name');_0x3ac64f[_0x9e44('0x42')]=_[_0x9e44('0x43')](_0x182d37[_0x9e44('0x42')]);_0x3ac64f[_0x9e44('0x44')]=_['intersection'](_0x3ac64f['model'],_0x3ac64f['query']);_0x38b0d1[_0x9e44('0x45')]=_[_0x9e44('0x46')](_0x3ac64f['model'],qs[_0x9e44('0x47')](_0x182d37[_0x9e44('0x42')][_0x9e44('0x47')]));_0x38b0d1[_0x9e44('0x45')]=_0x38b0d1['attributes']['length']?_0x38b0d1[_0x9e44('0x45')]:_0x3ac64f['model'];if(!_0x182d37['query']['hasOwnProperty'](_0x9e44('0x48'))){_0x38b0d1[_0x9e44('0x29')]=qs[_0x9e44('0x29')](_0x182d37[_0x9e44('0x42')]['limit']);_0x38b0d1[_0x9e44('0x2b')]=qs[_0x9e44('0x2b')](_0x182d37[_0x9e44('0x42')][_0x9e44('0x2b')]);}_0x38b0d1[_0x9e44('0x49')]=qs['sort'](_0x182d37[_0x9e44('0x42')][_0x9e44('0x4a')]);_0x38b0d1['where']=qs[_0x9e44('0x44')](_[_0x9e44('0x4b')](_0x182d37[_0x9e44('0x42')],_0x3ac64f[_0x9e44('0x44')]),_0x1e37fa);if(_0x182d37[_0x9e44('0x42')][_0x9e44('0x4c')]){_0x38b0d1[_0x9e44('0x4d')]=_['merge'](_0x38b0d1['where'],{'$or':_[_0x9e44('0x3c')](_0x1e37fa,function(_0x1a0ccd){if(_0x1a0ccd[_0x9e44('0x40')]!==_0x9e44('0x4e')){var _0x31058a={};_0x31058a[_0x1a0ccd[_0x9e44('0x39')]]={'$like':'%'+_0x182d37['query'][_0x9e44('0x4c')]+'%'};return _0x31058a;}})});}_0x38b0d1=_['merge']({},_0x38b0d1,_0x182d37[_0x9e44('0x4f')]);var _0x1a8785={'where':_0x38b0d1[_0x9e44('0x4d')]};return db[_0x9e44('0x3d')][_0x9e44('0x2a')](_0x1a8785)['then'](function(_0x39c63f){_0x19b8e1[_0x9e44('0x2a')]=_0x39c63f;if(_0x182d37[_0x9e44('0x42')][_0x9e44('0x50')]){_0x38b0d1[_0x9e44('0x51')]=[{'all':!![]}];}return db[_0x9e44('0x3d')][_0x9e44('0x52')](_0x38b0d1);})[_0x9e44('0x32')](function(_0x137abf){_0x19b8e1[_0x9e44('0x53')]=_0x137abf;return _0x19b8e1;})[_0x9e44('0x32')](respondWithFilteredResult(_0x2f8f9c,_0x38b0d1))[_0x9e44('0x25')](handleError(_0x2f8f9c,null));};exports[_0x9e44('0x54')]=function(_0x3e5ae3,_0x548bed){var _0x3610c4={'raw':![],'where':{'id':_0x3e5ae3[_0x9e44('0x55')]['id']}},_0x298590={};_0x298590[_0x9e44('0x56')]=_[_0x9e44('0x43')](db['VoiceContext'][_0x9e44('0x3e')]);_0x298590[_0x9e44('0x42')]=_[_0x9e44('0x43')](_0x3e5ae3[_0x9e44('0x42')]);_0x298590['filters']=_[_0x9e44('0x46')](_0x298590[_0x9e44('0x56')],_0x298590[_0x9e44('0x42')]);_0x3610c4[_0x9e44('0x45')]=_[_0x9e44('0x46')](_0x298590[_0x9e44('0x56')],qs['fields'](_0x3e5ae3[_0x9e44('0x42')]['fields']));_0x3610c4[_0x9e44('0x45')]=_0x3610c4['attributes'][_0x9e44('0x57')]?_0x3610c4['attributes']:_0x298590[_0x9e44('0x56')];if(_0x3e5ae3[_0x9e44('0x42')][_0x9e44('0x50')]){_0x3610c4[_0x9e44('0x51')]=[{'all':!![]}];}_0x3610c4=_[_0x9e44('0x58')]({},_0x3610c4,_0x3e5ae3[_0x9e44('0x4f')]);return db[_0x9e44('0x3d')][_0x9e44('0x59')](_0x3610c4)[_0x9e44('0x32')](handleEntityNotFound(_0x548bed,null))[_0x9e44('0x32')](respondWithResult(_0x548bed,null))[_0x9e44('0x25')](handleError(_0x548bed,null));};exports[_0x9e44('0x5a')]=function(_0x13cb19,_0x197feb,_0xd37b44){var _0x47001;return db[_0x9e44('0x3d')][_0x9e44('0x5a')](_0x13cb19[_0x9e44('0x5b')],{'raw':!![]})[_0x9e44('0x32')](function(_0x5db4b4){_0x47001=_0x5db4b4;return db[_0x9e44('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xbd5ed7){var _0x29513d=fs['readFileSync'](path['join'](config[_0x9e44('0x5c')],_0x9e44('0x5d')),'utf8');var _0x5aa72f=ejs[_0x9e44('0x5e')](_0x29513d,{'contexts':_0xbd5ed7||[]});fs[_0x9e44('0x5f')](_0x9e44('0x60'),_0x5aa72f);})[_0x9e44('0x32')](function(){return respondWithRpcPromise(_0x9e44('0x61'),_0x9e44('0x5a'),{'module':_0x9e44('0x62')});})[_0x9e44('0x32')](function(){var _0x4e0cdc=_0x13cb19['user'][_0x9e44('0x34')]({'plain':!![]});if(!_0x4e0cdc)throw new Error(_0x9e44('0x63'));if(_0x4e0cdc[_0x9e44('0x64')]==='user'){var _0x1ca54f=_0x47001['get']({'plain':!![]});return db[_0x9e44('0x65')][_0x9e44('0x59')]({'where':{'name':'Contexts','userProfileId':_0x4e0cdc[_0x9e44('0x66')]},'raw':!![]})[_0x9e44('0x32')](function(_0x12820c){if(_0x12820c&&_0x12820c[_0x9e44('0x67')]===0x0){return db[_0x9e44('0x35')][_0x9e44('0x5a')]({'name':_0x1ca54f[_0x9e44('0x39')],'resourceId':_0x1ca54f['id'],'type':_0x12820c[_0x9e44('0x39')],'sectionId':_0x12820c['id']},{})['then'](function(){return _0x47001;});}else{return _0x47001;}})['catch'](function(_0x15aa31){logger[_0x9e44('0x20')](_0x9e44('0x68'),_0x15aa31);throw _0x15aa31;});}return _0x47001;})['then'](respondWithResult(_0x197feb,0xc9))['catch'](handleError(_0x197feb,null));};exports[_0x9e44('0x31')]=function(_0x4097d7,_0x2583a2,_0x252c03){var _0x4af899;return db['VoiceContext'][_0x9e44('0x59')]({'where':{'id':_0x4097d7[_0x9e44('0x55')]['id']}})[_0x9e44('0x32')](handleEntityNotFound(_0x2583a2,null))['then'](saveUpdates(_0x4097d7[_0x9e44('0x5b')],null))[_0x9e44('0x32')](function(_0x12f143){if(_0x12f143){_0x4af899=_0x12f143;return db[_0x9e44('0x3d')][_0x9e44('0x52')]({'raw':!![]});}})[_0x9e44('0x32')](function(_0x12fd09){var _0x383d1d=fs[_0x9e44('0x69')](path['join'](config[_0x9e44('0x5c')],_0x9e44('0x5d')),_0x9e44('0x6a'));var _0x31816f=ejs[_0x9e44('0x5e')](_0x383d1d,{'contexts':_0x12fd09||[]});fs[_0x9e44('0x5f')](_0x9e44('0x60'),_0x31816f);})[_0x9e44('0x32')](function(){return respondWithRpcPromise(_0x9e44('0x61'),_0x9e44('0x31'),{'module':_0x9e44('0x62')});})[_0x9e44('0x32')](function(){return _0x4af899;})['then'](respondWithResult(_0x2583a2,null))['catch'](handleError(_0x2583a2,null));};exports['destroy']=function(_0xf0bb7e,_0x263e33,_0x4939a7){var _0x89236e;return db[_0x9e44('0x3d')][_0x9e44('0x59')]({'where':{'id':_0xf0bb7e[_0x9e44('0x55')]['id']}})[_0x9e44('0x32')](handleEntityNotFound(_0x263e33,null))[_0x9e44('0x32')](removeEntity(_0x263e33,null))[_0x9e44('0x32')](function(){return db['VoiceContext'][_0x9e44('0x52')]({'raw':!![]});})[_0x9e44('0x32')](function(_0x45906f){var _0x4f6bc6=fs[_0x9e44('0x69')](path[_0x9e44('0x6b')](config[_0x9e44('0x5c')],_0x9e44('0x5d')),'utf8');var _0x518c3e=ejs[_0x9e44('0x5e')](_0x4f6bc6,{'contexts':_0x45906f});fs[_0x9e44('0x5f')](_0x9e44('0x60'),_0x518c3e);return respondWithRpcPromise(_0x9e44('0x61'),'destroy',{'module':'chan_sip.so'});})[_0x9e44('0x25')](handleError(_0x263e33,null));}; \ No newline at end of file +var _0xafe4=['UserProfileSection','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Reload','server/files/templates/context.ejs','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','json','count','offset','limit','status','Content-Range','reject','save','then','destroy','UserProfileResource','sendStatus','send','index','map','VoiceContext','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','show','params','include','find','create','body','findAll','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1a44c1,_0x33ca2d){var _0xd78773=function(_0x5f3211){while(--_0x5f3211){_0x1a44c1['push'](_0x1a44c1['shift']());}};_0xd78773(++_0x33ca2d);}(_0xafe4,0x6c));var _0x4afe=function(_0x38ae5a,_0xc50f10){_0x38ae5a=_0x38ae5a-0x0;var _0x18379c=_0xafe4[_0x38ae5a];return _0x18379c;};'use strict';var emlformat=require(_0x4afe('0x0'));var rimraf=require(_0x4afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4afe('0x2'));var moment=require(_0x4afe('0x3'));var BPromise=require(_0x4afe('0x4'));var Mustache=require(_0x4afe('0x5'));var util=require('util');var path=require(_0x4afe('0x6'));var sox=require(_0x4afe('0x7'));var csv=require(_0x4afe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4afe('0x9'));var _=require('lodash');var squel=require(_0x4afe('0xa'));var crypto=require(_0x4afe('0xb'));var jsforce=require(_0x4afe('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4afe('0xd'));var Papa=require(_0x4afe('0xe'));var Redis=require(_0x4afe('0xf'));var authService=require(_0x4afe('0x10'));var qs=require(_0x4afe('0x11'));var as=require(_0x4afe('0x12'));var hardwareService=require(_0x4afe('0x13'));var logger=require(_0x4afe('0x14'))(_0x4afe('0x15'));var utils=require('../../config/utils');var config=require(_0x4afe('0x16'));var licenseUtil=require(_0x4afe('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4afe('0x18'));var client=jayson[_0x4afe('0x19')][_0x4afe('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1e44e8,_0x2a9fc8,_0x25f667,_0xb3d4d){return new BPromise(function(_0x1a0e83,_0x132b10){var _0x3df430=_0xb3d4d||client;return _0x3df430['request'](_0x1e44e8,_0x25f667)['then'](function(_0x3904ae){logger['info'](_0x4afe('0x1b'),_0x2a9fc8,_0x4afe('0x1c'));logger[_0x4afe('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2a9fc8,_0x4afe('0x1c'),JSON[_0x4afe('0x1e')](_0x3904ae));if(_0x3904ae[_0x4afe('0x1f')]){if(_0x3904ae[_0x4afe('0x1f')][_0x4afe('0x20')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2a9fc8,_0x3904ae['error'][_0x4afe('0x21')]);return _0x132b10(_0x3904ae['error']['message']);}logger[_0x4afe('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x2a9fc8,_0x3904ae[_0x4afe('0x1f')][_0x4afe('0x21')]);return _0x1a0e83(_0x3904ae[_0x4afe('0x1f')][_0x4afe('0x21')]);}else{logger[_0x4afe('0x22')]('VoiceContext,\x20%s,\x20%s',_0x2a9fc8,_0x4afe('0x1c'));_0x1a0e83(_0x3904ae['result']['message']);}})[_0x4afe('0x23')](function(_0x3d4856){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2a9fc8,_0x3d4856);_0x132b10(_0x3d4856);});});}function respondWithStatusCode(_0x468c8a,_0x36ee92){_0x36ee92=_0x36ee92||0xcc;return function(_0x403497){if(_0x403497){return _0x468c8a['sendStatus'](_0x36ee92);}return _0x468c8a['status'](_0x36ee92)['end']();};}function respondWithResult(_0x5c9b7f,_0x2cbc9b){_0x2cbc9b=_0x2cbc9b||0xc8;return function(_0x59ca06){if(_0x59ca06){return _0x5c9b7f['status'](_0x2cbc9b)[_0x4afe('0x24')](_0x59ca06);}};}function respondWithFilteredResult(_0x36b31c,_0x9e5682){return function(_0x285f6a){if(_0x285f6a){var _0x35c0b4=typeof _0x9e5682['offset']==='undefined'&&typeof _0x9e5682['limit']==='undefined';var _0x1149ee=_0x285f6a[_0x4afe('0x25')];var _0x4e7648=_0x35c0b4?0x0:_0x9e5682[_0x4afe('0x26')];var _0x216ead=_0x35c0b4?_0x285f6a[_0x4afe('0x25')]:_0x9e5682[_0x4afe('0x26')]+_0x9e5682[_0x4afe('0x27')];var _0x166872;if(_0x216ead>=_0x1149ee){_0x216ead=_0x1149ee;_0x166872=0xc8;}else{_0x166872=0xce;}_0x36b31c[_0x4afe('0x28')](_0x166872);return _0x36b31c['set'](_0x4afe('0x29'),_0x4e7648+'-'+_0x216ead+'/'+_0x1149ee)[_0x4afe('0x24')](_0x285f6a);}return null;};}function patchUpdates(_0x45b0dd){return function(_0x52de80){try{jsonpatch['apply'](_0x52de80,_0x45b0dd,!![]);}catch(_0x172fcb){return BPromise[_0x4afe('0x2a')](_0x172fcb);}return _0x52de80[_0x4afe('0x2b')]();};}function saveUpdates(_0x4c90dd,_0x1d9736){return function(_0xbacfed){if(_0xbacfed){return _0xbacfed['update'](_0x4c90dd)[_0x4afe('0x2c')](function(_0x473d99){return _0x473d99;});}return null;};}function removeEntity(_0x3e5c54,_0xaf6cc){return function(_0x4c7752){if(_0x4c7752){return _0x4c7752[_0x4afe('0x2d')]()[_0x4afe('0x2c')](function(){var _0x4cd3c7=_0x4c7752['get']({'plain':!![]});var _0x1ca446='Contexts';return db[_0x4afe('0x2e')][_0x4afe('0x2d')]({'where':{'type':_0x1ca446,'resourceId':_0x4cd3c7['id']}})[_0x4afe('0x2c')](function(){return _0x4c7752;});})[_0x4afe('0x2c')](function(){_0x3e5c54[_0x4afe('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x298c26,_0xaf908c){return function(_0x2d7666){if(!_0x2d7666){_0x298c26[_0x4afe('0x2f')](0x194);}return _0x2d7666;};}function handleError(_0xbe4085,_0x3de6c7){_0x3de6c7=_0x3de6c7||0x1f4;return function(_0x2e1e74){logger['error'](_0x2e1e74['stack']);if(_0x2e1e74['name']){delete _0x2e1e74['name'];}_0xbe4085[_0x4afe('0x28')](_0x3de6c7)[_0x4afe('0x30')](_0x2e1e74);};}exports[_0x4afe('0x31')]=function(_0x179a89,_0x5b01e7){var _0x5573bf={},_0x5b32d8={},_0x5e6662={'count':0x0,'rows':[]};var _0x1b90b5=_[_0x4afe('0x32')](db[_0x4afe('0x33')][_0x4afe('0x34')],function(_0x10da3b){return{'name':_0x10da3b[_0x4afe('0x35')],'type':_0x10da3b[_0x4afe('0x36')]['key']};});_0x5b32d8['model']=_['map'](_0x1b90b5,_0x4afe('0x37'));_0x5b32d8[_0x4afe('0x38')]=_[_0x4afe('0x39')](_0x179a89[_0x4afe('0x38')]);_0x5b32d8[_0x4afe('0x3a')]=_[_0x4afe('0x3b')](_0x5b32d8[_0x4afe('0x3c')],_0x5b32d8[_0x4afe('0x38')]);_0x5573bf['attributes']=_[_0x4afe('0x3b')](_0x5b32d8[_0x4afe('0x3c')],qs[_0x4afe('0x3d')](_0x179a89[_0x4afe('0x38')][_0x4afe('0x3d')]));_0x5573bf[_0x4afe('0x3e')]=_0x5573bf['attributes'][_0x4afe('0x3f')]?_0x5573bf['attributes']:_0x5b32d8[_0x4afe('0x3c')];if(!_0x179a89[_0x4afe('0x38')][_0x4afe('0x40')](_0x4afe('0x41'))){_0x5573bf[_0x4afe('0x27')]=qs[_0x4afe('0x27')](_0x179a89[_0x4afe('0x38')]['limit']);_0x5573bf[_0x4afe('0x26')]=qs[_0x4afe('0x26')](_0x179a89[_0x4afe('0x38')][_0x4afe('0x26')]);}_0x5573bf[_0x4afe('0x42')]=qs['sort'](_0x179a89[_0x4afe('0x38')][_0x4afe('0x43')]);_0x5573bf[_0x4afe('0x44')]=qs['filters'](_[_0x4afe('0x45')](_0x179a89[_0x4afe('0x38')],_0x5b32d8[_0x4afe('0x3a')]),_0x1b90b5);if(_0x179a89[_0x4afe('0x38')][_0x4afe('0x46')]){_0x5573bf[_0x4afe('0x44')]=_['merge'](_0x5573bf['where'],{'$or':_[_0x4afe('0x32')](_0x1b90b5,function(_0x103980){if(_0x103980[_0x4afe('0x36')]!==_0x4afe('0x47')){var _0x1dfa98={};_0x1dfa98[_0x103980[_0x4afe('0x37')]]={'$like':'%'+_0x179a89[_0x4afe('0x38')][_0x4afe('0x46')]+'%'};return _0x1dfa98;}})});}_0x5573bf=_[_0x4afe('0x48')]({},_0x5573bf,_0x179a89[_0x4afe('0x49')]);var _0x4bc195={'where':_0x5573bf['where']};return db[_0x4afe('0x33')][_0x4afe('0x25')](_0x4bc195)[_0x4afe('0x2c')](function(_0x266aac){_0x5e6662[_0x4afe('0x25')]=_0x266aac;if(_0x179a89[_0x4afe('0x38')][_0x4afe('0x4a')]){_0x5573bf['include']=[{'all':!![]}];}return db[_0x4afe('0x33')]['findAll'](_0x5573bf);})[_0x4afe('0x2c')](function(_0x25d20e){_0x5e6662['rows']=_0x25d20e;return _0x5e6662;})[_0x4afe('0x2c')](respondWithFilteredResult(_0x5b01e7,_0x5573bf))['catch'](handleError(_0x5b01e7,null));};exports[_0x4afe('0x4b')]=function(_0x17c316,_0x189680){var _0x7e8e20={'raw':![],'where':{'id':_0x17c316[_0x4afe('0x4c')]['id']}},_0x47c8d0={};_0x47c8d0[_0x4afe('0x3c')]=_[_0x4afe('0x39')](db['VoiceContext']['rawAttributes']);_0x47c8d0['query']=_[_0x4afe('0x39')](_0x17c316[_0x4afe('0x38')]);_0x47c8d0[_0x4afe('0x3a')]=_[_0x4afe('0x3b')](_0x47c8d0[_0x4afe('0x3c')],_0x47c8d0[_0x4afe('0x38')]);_0x7e8e20[_0x4afe('0x3e')]=_[_0x4afe('0x3b')](_0x47c8d0[_0x4afe('0x3c')],qs['fields'](_0x17c316[_0x4afe('0x38')]['fields']));_0x7e8e20[_0x4afe('0x3e')]=_0x7e8e20[_0x4afe('0x3e')]['length']?_0x7e8e20[_0x4afe('0x3e')]:_0x47c8d0[_0x4afe('0x3c')];if(_0x17c316['query']['includeAll']){_0x7e8e20[_0x4afe('0x4d')]=[{'all':!![]}];}_0x7e8e20=_[_0x4afe('0x48')]({},_0x7e8e20,_0x17c316[_0x4afe('0x49')]);return db[_0x4afe('0x33')][_0x4afe('0x4e')](_0x7e8e20)[_0x4afe('0x2c')](handleEntityNotFound(_0x189680,null))[_0x4afe('0x2c')](respondWithResult(_0x189680,null))['catch'](handleError(_0x189680,null));};exports[_0x4afe('0x4f')]=function(_0x46bec8,_0x3f1e70,_0x40c182){var _0x1e6ea8;return db[_0x4afe('0x33')]['create'](_0x46bec8[_0x4afe('0x50')],{'raw':!![]})['then'](function(_0x4cbd34){_0x1e6ea8=_0x4cbd34;return db[_0x4afe('0x33')][_0x4afe('0x51')]({'raw':!![]});})[_0x4afe('0x2c')](function(_0x55c333){var _0x4ea678=fs[_0x4afe('0x52')](path[_0x4afe('0x53')](config[_0x4afe('0x54')],'server/files/templates/context.ejs'),_0x4afe('0x55'));var _0x198603=ejs[_0x4afe('0x56')](_0x4ea678,{'contexts':_0x55c333||[]});fs[_0x4afe('0x57')](_0x4afe('0x58'),_0x198603);})[_0x4afe('0x2c')](function(){return respondWithRpcPromise('Reload',_0x4afe('0x4f'),{'module':_0x4afe('0x59')});})[_0x4afe('0x2c')](function(){var _0x34528f=_0x46bec8[_0x4afe('0x5a')][_0x4afe('0x5b')]({'plain':!![]});if(!_0x34528f)throw new Error(_0x4afe('0x5c'));if(_0x34528f[_0x4afe('0x5d')]===_0x4afe('0x5a')){var _0x495fb5=_0x1e6ea8[_0x4afe('0x5b')]({'plain':!![]});return db[_0x4afe('0x5e')][_0x4afe('0x4e')]({'where':{'name':_0x4afe('0x5f'),'userProfileId':_0x34528f[_0x4afe('0x60')]},'raw':!![]})[_0x4afe('0x2c')](function(_0x20c045){if(_0x20c045&&_0x20c045['autoAssociation']===0x0){return db[_0x4afe('0x2e')][_0x4afe('0x4f')]({'name':_0x495fb5[_0x4afe('0x37')],'resourceId':_0x495fb5['id'],'type':_0x20c045['name'],'sectionId':_0x20c045['id']},{})[_0x4afe('0x2c')](function(){return _0x1e6ea8;});}else{return _0x1e6ea8;}})[_0x4afe('0x23')](function(_0x56ebcb){logger[_0x4afe('0x1f')](_0x4afe('0x61'),_0x56ebcb);throw _0x56ebcb;});}return _0x1e6ea8;})['then'](respondWithResult(_0x3f1e70,0xc9))[_0x4afe('0x23')](handleError(_0x3f1e70,null));};exports[_0x4afe('0x62')]=function(_0x37ec17,_0x22f655,_0x4f292e){var _0x422253;return db[_0x4afe('0x33')][_0x4afe('0x4e')]({'where':{'id':_0x37ec17[_0x4afe('0x4c')]['id']}})[_0x4afe('0x2c')](handleEntityNotFound(_0x22f655,null))[_0x4afe('0x2c')](saveUpdates(_0x37ec17[_0x4afe('0x50')],null))[_0x4afe('0x2c')](function(_0x141179){if(_0x141179){_0x422253=_0x141179;return db[_0x4afe('0x33')][_0x4afe('0x51')]({'raw':!![]});}})['then'](function(_0x4c54d3){var _0x5f1a2b=fs[_0x4afe('0x52')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x4afe('0x55'));var _0x2efa62=ejs[_0x4afe('0x56')](_0x5f1a2b,{'contexts':_0x4c54d3||[]});fs[_0x4afe('0x57')](_0x4afe('0x58'),_0x2efa62);})[_0x4afe('0x2c')](function(){return respondWithRpcPromise(_0x4afe('0x63'),_0x4afe('0x62'),{'module':_0x4afe('0x59')});})[_0x4afe('0x2c')](function(){return _0x422253;})[_0x4afe('0x2c')](respondWithResult(_0x22f655,null))['catch'](handleError(_0x22f655,null));};exports[_0x4afe('0x2d')]=function(_0x568b3d,_0x6e308,_0x1cefba){var _0x56abb6;return db[_0x4afe('0x33')]['find']({'where':{'id':_0x568b3d['params']['id']}})[_0x4afe('0x2c')](handleEntityNotFound(_0x6e308,null))[_0x4afe('0x2c')](removeEntity(_0x6e308,null))[_0x4afe('0x2c')](function(){return db[_0x4afe('0x33')][_0x4afe('0x51')]({'raw':!![]});})['then'](function(_0x22800d){var _0x23c794=fs[_0x4afe('0x52')](path[_0x4afe('0x53')](config[_0x4afe('0x54')],_0x4afe('0x64')),_0x4afe('0x55'));var _0x1169e6=ejs[_0x4afe('0x56')](_0x23c794,{'contexts':_0x22800d});fs[_0x4afe('0x57')](_0x4afe('0x58'),_0x1169e6);return respondWithRpcPromise('Reload',_0x4afe('0x2d'),{'module':_0x4afe('0x59')});})[_0x4afe('0x23')](handleError(_0x6e308,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c6cfcdf..1674435 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 _0x42dc=['moment','path','rimraf','../../config/environment','./voiceContext.attributes','exports','voice_contexts','../../config/logger'];(function(_0x304dfb,_0x2a0af8){var _0x4f8cfd=function(_0x2a6c33){while(--_0x2a6c33){_0x304dfb['push'](_0x304dfb['shift']());}};_0x4f8cfd(++_0x2a0af8);}(_0x42dc,0x1ef));var _0xc42d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x42dc[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc42d('0x0'))('api');var moment=require(_0xc42d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc42d('0x2'));var rimraf=require(_0xc42d('0x3'));var config=require(_0xc42d('0x4'));var attributes=require(_0xc42d('0x5'));module[_0xc42d('0x6')]=function(_0x3d2f19,_0x2bbccd){return _0x3d2f19['define']('VoiceContext',attributes,{'tableName':_0xc42d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd05a=['define','VoiceContext','voice_contexts','util','../../config/logger','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x5af107,_0x47260b){var _0x14e789=function(_0x324c7e){while(--_0x324c7e){_0x5af107['push'](_0x5af107['shift']());}};_0x14e789(++_0x47260b);}(_0xd05a,0x143));var _0xad05=function(_0xcb4dd2,_0x208523){_0xcb4dd2=_0xcb4dd2-0x0;var _0x649ad7=_0xd05a[_0xcb4dd2];return _0x649ad7;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var logger=require(_0xad05('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad05('0x2'));var rimraf=require(_0xad05('0x3'));var config=require(_0xad05('0x4'));var attributes=require(_0xad05('0x5'));module[_0xad05('0x6')]=function(_0x520f44,_0x50254e){return _0x520f44[_0xad05('0x7')](_0xad05('0x8'),attributes,{'tableName':_0xad05('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index ecbc034..d580b03 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 _0xd61e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xd61e,0x13d));var _0xed61=function(_0x104a57,_0x2ef974){_0x104a57=_0x104a57-0x0;var _0x19822e=_0xd61e[_0x104a57];return _0x19822e;};'use strict';var _=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var moment=require(_0xed61('0x2'));var BPromise=require(_0xed61('0x3'));var rs=require(_0xed61('0x4'));var fs=require('fs');var Redis=require(_0xed61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed61('0x6'));var logger=require(_0xed61('0x7'))(_0xed61('0x8'));var config=require(_0xed61('0x9'));var jayson=require(_0xed61('0xa'));var client=jayson[_0xed61('0xb')][_0xed61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b7469,_0x5e6173,_0x59ef0e){return new BPromise(function(_0x5cbbd7,_0x4a2d4c){return client[_0xed61('0xd')](_0x5b7469,_0x59ef0e)[_0xed61('0xe')](function(_0x2964de){logger[_0xed61('0xf')](_0xed61('0x10'),_0x5e6173,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5e6173,_0xed61('0x11'),JSON[_0xed61('0x12')](_0x2964de));if(_0x2964de['error']){if(_0x2964de['error']['code']===0x1f4){logger['error'](_0xed61('0x10'),_0x5e6173,_0x2964de[_0xed61('0x13')][_0xed61('0x14')]);return _0x4a2d4c(_0x2964de[_0xed61('0x13')]['message']);}logger[_0xed61('0x13')](_0xed61('0x10'),_0x5e6173,_0x2964de[_0xed61('0x13')]['message']);return _0x5cbbd7(_0x2964de[_0xed61('0x13')][_0xed61('0x14')]);}else{logger[_0xed61('0xf')](_0xed61('0x10'),_0x5e6173,'request\x20sent');_0x5cbbd7(_0x2964de[_0xed61('0x15')][_0xed61('0x14')]);}})[_0xed61('0x16')](function(_0x6d05cd){logger['error'](_0xed61('0x10'),_0x5e6173,_0x6d05cd);_0x4a2d4c(_0x6d05cd);});});} \ No newline at end of file +var _0xbe5e=['message','VoiceContext,\x20%s,\x20%s','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x5811f0,_0x13ba47){var _0x3f7013=function(_0x5b9d11){while(--_0x5b9d11){_0x5811f0['push'](_0x5811f0['shift']());}};_0x3f7013(++_0x13ba47);}(_0xbe5e,0x81));var _0xebe5=function(_0x5abcf8,_0x181ea5){_0x5abcf8=_0x5abcf8-0x0;var _0x44a521=_0xbe5e[_0x5abcf8];return _0x44a521;};'use strict';var _=require(_0xebe5('0x0'));var util=require(_0xebe5('0x1'));var moment=require('moment');var BPromise=require(_0xebe5('0x2'));var rs=require(_0xebe5('0x3'));var fs=require('fs');var Redis=require(_0xebe5('0x4'));var db=require(_0xebe5('0x5'))['db'];var utils=require(_0xebe5('0x6'));var logger=require(_0xebe5('0x7'))(_0xebe5('0x8'));var config=require('../../config/environment');var jayson=require(_0xebe5('0x9'));var client=jayson['client'][_0xebe5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c6df,_0x152456,_0x73d4df){return new BPromise(function(_0xd28853,_0x34b82f){return client[_0xebe5('0xb')](_0x43c6df,_0x73d4df)[_0xebe5('0xc')](function(_0x60f242){logger['info']('VoiceContext,\x20%s,\x20%s',_0x152456,_0xebe5('0xd'));logger[_0xebe5('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x152456,_0xebe5('0xd'),JSON[_0xebe5('0xf')](_0x60f242));if(_0x60f242['error']){if(_0x60f242[_0xebe5('0x10')][_0xebe5('0x11')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x152456,_0x60f242['error'][_0xebe5('0x12')]);return _0x34b82f(_0x60f242[_0xebe5('0x10')]['message']);}logger[_0xebe5('0x10')](_0xebe5('0x13'),_0x152456,_0x60f242[_0xebe5('0x10')]['message']);return _0xd28853(_0x60f242[_0xebe5('0x10')][_0xebe5('0x12')]);}else{logger[_0xebe5('0x14')]('VoiceContext,\x20%s,\x20%s',_0x152456,'request\x20sent');_0xd28853(_0x60f242['result'][_0xebe5('0x12')]);}})['catch'](function(_0x4baafa){logger[_0xebe5('0x10')](_0xebe5('0x13'),_0x152456,_0x4baafa);_0x34b82f(_0x4baafa);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index eab7ec6..b4d76f1 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 _0xce92=['../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5884ee,_0x16f817){var _0x149634=function(_0x58bd22){while(--_0x58bd22){_0x5884ee['push'](_0x5884ee['shift']());}};_0x149634(++_0x16f817);}(_0xce92,0x186));var _0x2ce9=function(_0x2cd9e8,_0x3520ed){_0x2cd9e8=_0x2cd9e8-0x0;var _0x2f712f=_0xce92[_0x2cd9e8];return _0x2f712f;};'use strict';var multer=require(_0x2ce9('0x0'));var util=require('util');var path=require(_0x2ce9('0x1'));var timeout=require(_0x2ce9('0x2'));var express=require(_0x2ce9('0x3'));var router=express[_0x2ce9('0x4')]();var fs_extra=require(_0x2ce9('0x5'));var auth=require(_0x2ce9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x2ce9('0x7')]('/',auth['isAuthenticated'](),controller[_0x2ce9('0x8')]);router[_0x2ce9('0x7')](_0x2ce9('0x9'),auth[_0x2ce9('0xa')](),controller[_0x2ce9('0xb')]);router[_0x2ce9('0x7')](_0x2ce9('0xc'),auth[_0x2ce9('0xa')](),controller['show']);router[_0x2ce9('0xd')]('/',auth[_0x2ce9('0xa')](),controller['create']);router['put'](_0x2ce9('0xc'),auth[_0x2ce9('0xa')](),controller[_0x2ce9('0xe')]);router[_0x2ce9('0xf')]('/:id',auth[_0x2ce9('0xa')](),controller[_0x2ce9('0x10')]);module[_0x2ce9('0x11')]=router; \ No newline at end of file +var _0xff4f=['get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xff4f,0x19a));var _0xfff4=function(_0x375dd2,_0x1d9f83){_0x375dd2=_0x375dd2-0x0;var _0x211bcb=_0xff4f[_0x375dd2];return _0x211bcb;};'use strict';var multer=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var path=require('path');var timeout=require(_0xfff4('0x2'));var express=require(_0xfff4('0x3'));var router=express[_0xfff4('0x4')]();var fs_extra=require(_0xfff4('0x5'));var auth=require(_0xfff4('0x6'));var interaction=require(_0xfff4('0x7'));var config=require(_0xfff4('0x8'));var controller=require(_0xfff4('0x9'));router[_0xfff4('0xa')]('/',auth[_0xfff4('0xb')](),controller[_0xfff4('0xc')]);router[_0xfff4('0xa')](_0xfff4('0xd'),auth[_0xfff4('0xb')](),controller['describe']);router[_0xfff4('0xa')](_0xfff4('0xe'),auth[_0xfff4('0xb')](),controller['show']);router[_0xfff4('0xf')]('/',auth[_0xfff4('0xb')](),controller[_0xfff4('0x10')]);router[_0xfff4('0x11')]('/:id',auth[_0xfff4('0xb')](),controller[_0xfff4('0x12')]);router[_0xfff4('0x13')](_0xfff4('0xe'),auth[_0xfff4('0xb')](),controller[_0xfff4('0x14')]);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 b42671b..5fc10cd 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0xf64e53,_0x4db24b){var _0x1e185e=function(_0x451dc3){while(--_0x451dc3){_0xf64e53['push'](_0xf64e53['shift']());}};_0x1e185e(++_0x4db24b);}(_0x84ab,0x12f));var _0xb84a=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x84ab[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0xe9890f,_0x39f1d5){var _0xf2186f=function(_0x52a62a){while(--_0x52a62a){_0xe9890f['push'](_0xe9890f['shift']());}};_0xf2186f(++_0x39f1d5);}(_0xe5b3,0x133));var _0x3e5b=function(_0x49c524,_0x2f91e8){_0x49c524=_0x49c524-0x0;var _0xf98507=_0xe5b3[_0x49c524];return _0xf98507;};'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 70f4aa6..8f0a584 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 _0x2bb7=['query','keys','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','filters','length','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','model'];(function(_0x2d8db5,_0x3c9c8d){var _0xdc5579=function(_0x36f14f){while(--_0x36f14f){_0x2d8db5['push'](_0x2d8db5['shift']());}};_0xdc5579(++_0x3c9c8d);}(_0x2bb7,0x194));var _0x72bb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2bb7[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x72bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72bb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72bb('0x2'));var moment=require(_0x72bb('0x3'));var BPromise=require(_0x72bb('0x4'));var Mustache=require(_0x72bb('0x5'));var util=require('util');var path=require(_0x72bb('0x6'));var sox=require(_0x72bb('0x7'));var csv=require(_0x72bb('0x8'));var ejs=require(_0x72bb('0x9'));var fs=require('fs');var fs_extra=require(_0x72bb('0xa'));var _=require(_0x72bb('0xb'));var squel=require(_0x72bb('0xc'));var crypto=require(_0x72bb('0xd'));var jsforce=require(_0x72bb('0xe'));var deskjs=require(_0x72bb('0xf'));var toCsv=require(_0x72bb('0x8'));var querystring=require(_0x72bb('0x10'));var Papa=require('papaparse');var Redis=require(_0x72bb('0x11'));var authService=require(_0x72bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72bb('0x13'));var hardwareService=require(_0x72bb('0x14'));var logger=require(_0x72bb('0x15'))(_0x72bb('0x16'));var utils=require(_0x72bb('0x17'));var config=require(_0x72bb('0x18'));var licenseUtil=require(_0x72bb('0x19'));var db=require(_0x72bb('0x1a'))['db'];function respondWithStatusCode(_0x2abfbd,_0x2cd1a4){_0x2cd1a4=_0x2cd1a4||0xcc;return function(_0x2a1a20){if(_0x2a1a20){return _0x2abfbd[_0x72bb('0x1b')](_0x2cd1a4);}return _0x2abfbd[_0x72bb('0x1c')](_0x2cd1a4)[_0x72bb('0x1d')]();};}function respondWithResult(_0x18028b,_0x37a0d9){_0x37a0d9=_0x37a0d9||0xc8;return function(_0x5c0756){if(_0x5c0756){return _0x18028b[_0x72bb('0x1c')](_0x37a0d9)[_0x72bb('0x1e')](_0x5c0756);}};}function respondWithFilteredResult(_0x508680,_0x3f1958){return function(_0x4d0e9b){if(_0x4d0e9b){var _0xc8591e=typeof _0x3f1958['offset']===_0x72bb('0x1f')&&typeof _0x3f1958[_0x72bb('0x20')]===_0x72bb('0x1f');var _0xb9e128=_0x4d0e9b[_0x72bb('0x21')];var _0x26a107=_0xc8591e?0x0:_0x3f1958[_0x72bb('0x22')];var _0x380f23=_0xc8591e?_0x4d0e9b[_0x72bb('0x21')]:_0x3f1958[_0x72bb('0x22')]+_0x3f1958[_0x72bb('0x20')];var _0xc1434d;if(_0x380f23>=_0xb9e128){_0x380f23=_0xb9e128;_0xc1434d=0xc8;}else{_0xc1434d=0xce;}_0x508680['status'](_0xc1434d);return _0x508680['set'](_0x72bb('0x23'),_0x26a107+'-'+_0x380f23+'/'+_0xb9e128)['json'](_0x4d0e9b);}return null;};}function patchUpdates(_0x1a6221){return function(_0x4fd53f){try{jsonpatch[_0x72bb('0x24')](_0x4fd53f,_0x1a6221,!![]);}catch(_0x3e1b7e){return BPromise[_0x72bb('0x25')](_0x3e1b7e);}return _0x4fd53f[_0x72bb('0x26')]();};}function saveUpdates(_0x48d4ec,_0x203a75){return function(_0x56f009){if(_0x56f009){return _0x56f009['update'](_0x48d4ec)[_0x72bb('0x27')](function(_0x2f01e6){return _0x2f01e6;});}return null;};}function removeEntity(_0x41c73c,_0x425276){return function(_0x2775b3){if(_0x2775b3){return _0x2775b3[_0x72bb('0x28')]()['then'](function(){_0x41c73c['status'](0xcc)[_0x72bb('0x1d')]();});}};}function handleEntityNotFound(_0xa1ce09,_0x3bbe50){return function(_0x1540e0){if(!_0x1540e0){_0xa1ce09[_0x72bb('0x1b')](0x194);}return _0x1540e0;};}function handleError(_0x39ff3f,_0x166ed6){_0x166ed6=_0x166ed6||0x1f4;return function(_0x15cc7e){logger[_0x72bb('0x29')](_0x15cc7e[_0x72bb('0x2a')]);if(_0x15cc7e['name']){delete _0x15cc7e[_0x72bb('0x2b')];}_0x39ff3f['status'](_0x166ed6)[_0x72bb('0x2c')](_0x15cc7e);};}exports[_0x72bb('0x2d')]=function(_0x54af7e,_0x694f38){var _0x304d53={},_0x55f333={},_0x739178={'count':0x0,'rows':[]};var _0x139850=_[_0x72bb('0x2e')](db[_0x72bb('0x2f')][_0x72bb('0x30')],function(_0xf0d054){return{'name':_0xf0d054[_0x72bb('0x31')],'type':_0xf0d054['type'][_0x72bb('0x32')]};});_0x55f333[_0x72bb('0x33')]=_['map'](_0x139850,'name');_0x55f333[_0x72bb('0x34')]=_[_0x72bb('0x35')](_0x54af7e[_0x72bb('0x34')]);_0x55f333['filters']=_['intersection'](_0x55f333[_0x72bb('0x33')],_0x55f333['query']);_0x304d53['attributes']=_[_0x72bb('0x36')](_0x55f333[_0x72bb('0x33')],qs['fields'](_0x54af7e['query'][_0x72bb('0x37')]));_0x304d53[_0x72bb('0x38')]=_0x304d53[_0x72bb('0x38')]['length']?_0x304d53[_0x72bb('0x38')]:_0x55f333[_0x72bb('0x33')];if(!_0x54af7e[_0x72bb('0x34')]['hasOwnProperty'](_0x72bb('0x39'))){_0x304d53[_0x72bb('0x20')]=qs[_0x72bb('0x20')](_0x54af7e[_0x72bb('0x34')]['limit']);_0x304d53[_0x72bb('0x22')]=qs[_0x72bb('0x22')](_0x54af7e[_0x72bb('0x34')]['offset']);}_0x304d53['order']=qs['sort'](_0x54af7e[_0x72bb('0x34')]['sort']);_0x304d53[_0x72bb('0x3a')]=qs['filters'](_[_0x72bb('0x3b')](_0x54af7e[_0x72bb('0x34')],_0x55f333['filters']),_0x139850);if(_0x54af7e['query'][_0x72bb('0x3c')]){_0x304d53[_0x72bb('0x3a')]=_[_0x72bb('0x3d')](_0x304d53['where'],{'$or':_[_0x72bb('0x2e')](_0x139850,function(_0x589324){if(_0x589324['type']!==_0x72bb('0x3e')){var _0x43fcc4={};_0x43fcc4[_0x589324[_0x72bb('0x2b')]]={'$like':'%'+_0x54af7e[_0x72bb('0x34')][_0x72bb('0x3c')]+'%'};return _0x43fcc4;}})});}_0x304d53=_[_0x72bb('0x3d')]({},_0x304d53,_0x54af7e[_0x72bb('0x3f')]);var _0x143925={'where':_0x304d53['where']};return db[_0x72bb('0x2f')][_0x72bb('0x21')](_0x143925)[_0x72bb('0x27')](function(_0xb8a472){_0x739178[_0x72bb('0x21')]=_0xb8a472;if(_0x54af7e['query'][_0x72bb('0x40')]){_0x304d53[_0x72bb('0x41')]=[{'all':!![]}];}return db[_0x72bb('0x2f')][_0x72bb('0x42')](_0x304d53);})[_0x72bb('0x27')](function(_0x4a071f){_0x739178['rows']=_0x4a071f;return _0x739178;})['then'](respondWithFilteredResult(_0x694f38,_0x304d53))[_0x72bb('0x43')](handleError(_0x694f38,null));};exports[_0x72bb('0x44')]=function(_0x589d29,_0x138e3f){var _0x3b9f00={'raw':!![],'where':{'id':_0x589d29[_0x72bb('0x45')]['id']}},_0x42dbf5={};_0x42dbf5['model']=_['keys'](db[_0x72bb('0x2f')][_0x72bb('0x30')]);_0x42dbf5[_0x72bb('0x34')]=_[_0x72bb('0x35')](_0x589d29[_0x72bb('0x34')]);_0x42dbf5[_0x72bb('0x46')]=_['intersection'](_0x42dbf5['model'],_0x42dbf5[_0x72bb('0x34')]);_0x3b9f00['attributes']=_[_0x72bb('0x36')](_0x42dbf5[_0x72bb('0x33')],qs[_0x72bb('0x37')](_0x589d29['query'][_0x72bb('0x37')]));_0x3b9f00[_0x72bb('0x38')]=_0x3b9f00[_0x72bb('0x38')][_0x72bb('0x47')]?_0x3b9f00[_0x72bb('0x38')]:_0x42dbf5['model'];if(_0x589d29[_0x72bb('0x34')][_0x72bb('0x40')]){_0x3b9f00[_0x72bb('0x41')]=[{'all':!![]}];}_0x3b9f00=_['merge']({},_0x3b9f00,_0x589d29[_0x72bb('0x3f')]);return db[_0x72bb('0x2f')]['find'](_0x3b9f00)[_0x72bb('0x27')](handleEntityNotFound(_0x138e3f,null))[_0x72bb('0x27')](respondWithResult(_0x138e3f,null))[_0x72bb('0x43')](handleError(_0x138e3f,null));};exports[_0x72bb('0x48')]=function(_0x37f963,_0xc36907){return db['VoiceDialReport'][_0x72bb('0x48')](_0x37f963[_0x72bb('0x49')],{})[_0x72bb('0x27')](respondWithResult(_0xc36907,0xc9))[_0x72bb('0x43')](handleError(_0xc36907,null));};exports['update']=function(_0x4db35c,_0x4f1c0a){if(_0x4db35c[_0x72bb('0x49')]['id']){delete _0x4db35c[_0x72bb('0x49')]['id'];}return db[_0x72bb('0x2f')][_0x72bb('0x4a')]({'where':{'id':_0x4db35c[_0x72bb('0x45')]['id']}})[_0x72bb('0x27')](handleEntityNotFound(_0x4f1c0a,null))[_0x72bb('0x27')](saveUpdates(_0x4db35c['body'],null))[_0x72bb('0x27')](respondWithResult(_0x4f1c0a,null))[_0x72bb('0x43')](handleError(_0x4f1c0a,null));};exports['destroy']=function(_0x784682,_0x5e6019){return db[_0x72bb('0x2f')][_0x72bb('0x4a')]({'where':{'id':_0x784682[_0x72bb('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e6019,null))[_0x72bb('0x27')](removeEntity(_0x5e6019,null))[_0x72bb('0x43')](handleError(_0x5e6019,null));};exports[_0x72bb('0x4b')]=function(_0x11cede,_0x399c0f){return db[_0x72bb('0x2f')]['describe']()[_0x72bb('0x27')](respondWithResult(_0x399c0f,null))[_0x72bb('0x43')](handleError(_0x399c0f,null));}; \ No newline at end of file +var _0x2277=['attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','include','create','body','params','find','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../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','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x1da02b,_0xcb0b73){var _0xeda9dd=function(_0x39b7a7){while(--_0x39b7a7){_0x1da02b['push'](_0x1da02b['shift']());}};_0xeda9dd(++_0xcb0b73);}(_0x2277,0xf8));var _0x7227=function(_0x2e6f9b,_0x56e468){_0x2e6f9b=_0x2e6f9b-0x0;var _0x21ffa7=_0x2277[_0x2e6f9b];return _0x21ffa7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7227('0x0'));var rp=require(_0x7227('0x1'));var moment=require(_0x7227('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7227('0x3'));var util=require(_0x7227('0x4'));var path=require(_0x7227('0x5'));var sox=require(_0x7227('0x6'));var csv=require('to-csv');var ejs=require(_0x7227('0x7'));var fs=require('fs');var fs_extra=require(_0x7227('0x8'));var _=require(_0x7227('0x9'));var squel=require(_0x7227('0xa'));var crypto=require(_0x7227('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7227('0xc'));var Redis=require(_0x7227('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7227('0xe'));var as=require(_0x7227('0xf'));var hardwareService=require(_0x7227('0x10'));var logger=require(_0x7227('0x11'))(_0x7227('0x12'));var utils=require(_0x7227('0x13'));var config=require(_0x7227('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7227('0x15'))['db'];function respondWithStatusCode(_0x2b4bed,_0x53ff44){_0x53ff44=_0x53ff44||0xcc;return function(_0x355884){if(_0x355884){return _0x2b4bed[_0x7227('0x16')](_0x53ff44);}return _0x2b4bed[_0x7227('0x17')](_0x53ff44)[_0x7227('0x18')]();};}function respondWithResult(_0x267867,_0x1a998b){_0x1a998b=_0x1a998b||0xc8;return function(_0x17b571){if(_0x17b571){return _0x267867[_0x7227('0x17')](_0x1a998b)[_0x7227('0x19')](_0x17b571);}};}function respondWithFilteredResult(_0x127273,_0x2a3cfa){return function(_0x1b4555){if(_0x1b4555){var _0x426768=typeof _0x2a3cfa[_0x7227('0x1a')]===_0x7227('0x1b')&&typeof _0x2a3cfa[_0x7227('0x1c')]==='undefined';var _0x15ec4b=_0x1b4555[_0x7227('0x1d')];var _0x32f1ad=_0x426768?0x0:_0x2a3cfa['offset'];var _0x45d7f2=_0x426768?_0x1b4555['count']:_0x2a3cfa[_0x7227('0x1a')]+_0x2a3cfa[_0x7227('0x1c')];var _0x58b699;if(_0x45d7f2>=_0x15ec4b){_0x45d7f2=_0x15ec4b;_0x58b699=0xc8;}else{_0x58b699=0xce;}_0x127273[_0x7227('0x17')](_0x58b699);return _0x127273[_0x7227('0x1e')](_0x7227('0x1f'),_0x32f1ad+'-'+_0x45d7f2+'/'+_0x15ec4b)['json'](_0x1b4555);}return null;};}function patchUpdates(_0xc13502){return function(_0x5ab00a){try{jsonpatch['apply'](_0x5ab00a,_0xc13502,!![]);}catch(_0x68eed2){return BPromise[_0x7227('0x20')](_0x68eed2);}return _0x5ab00a[_0x7227('0x21')]();};}function saveUpdates(_0x396fbd,_0x33c56d){return function(_0x55d321){if(_0x55d321){return _0x55d321[_0x7227('0x22')](_0x396fbd)['then'](function(_0x403542){return _0x403542;});}return null;};}function removeEntity(_0x55df3,_0x204b00){return function(_0x3585cb){if(_0x3585cb){return _0x3585cb[_0x7227('0x23')]()['then'](function(){_0x55df3['status'](0xcc)[_0x7227('0x18')]();});}};}function handleEntityNotFound(_0x60c862,_0x3f2256){return function(_0x3a52be){if(!_0x3a52be){_0x60c862[_0x7227('0x16')](0x194);}return _0x3a52be;};}function handleError(_0x359d18,_0x5ad88c){_0x5ad88c=_0x5ad88c||0x1f4;return function(_0x1dd6b7){logger[_0x7227('0x24')](_0x1dd6b7[_0x7227('0x25')]);if(_0x1dd6b7[_0x7227('0x26')]){delete _0x1dd6b7[_0x7227('0x26')];}_0x359d18['status'](_0x5ad88c)[_0x7227('0x27')](_0x1dd6b7);};}exports[_0x7227('0x28')]=function(_0x4160e1,_0x3991c3){var _0x3e15f4={},_0x1f289d={},_0x5ec7f5={'count':0x0,'rows':[]};var _0x3ceabc=_[_0x7227('0x29')](db[_0x7227('0x2a')][_0x7227('0x2b')],function(_0x2e98ad){return{'name':_0x2e98ad[_0x7227('0x2c')],'type':_0x2e98ad[_0x7227('0x2d')][_0x7227('0x2e')]};});_0x1f289d[_0x7227('0x2f')]=_[_0x7227('0x29')](_0x3ceabc,_0x7227('0x26'));_0x1f289d[_0x7227('0x30')]=_[_0x7227('0x31')](_0x4160e1[_0x7227('0x30')]);_0x1f289d[_0x7227('0x32')]=_[_0x7227('0x33')](_0x1f289d[_0x7227('0x2f')],_0x1f289d[_0x7227('0x30')]);_0x3e15f4[_0x7227('0x34')]=_[_0x7227('0x33')](_0x1f289d['model'],qs[_0x7227('0x35')](_0x4160e1['query'][_0x7227('0x35')]));_0x3e15f4[_0x7227('0x34')]=_0x3e15f4[_0x7227('0x34')][_0x7227('0x36')]?_0x3e15f4[_0x7227('0x34')]:_0x1f289d[_0x7227('0x2f')];if(!_0x4160e1[_0x7227('0x30')]['hasOwnProperty']('nolimit')){_0x3e15f4['limit']=qs[_0x7227('0x1c')](_0x4160e1['query'][_0x7227('0x1c')]);_0x3e15f4[_0x7227('0x1a')]=qs[_0x7227('0x1a')](_0x4160e1[_0x7227('0x30')][_0x7227('0x1a')]);}_0x3e15f4[_0x7227('0x37')]=qs[_0x7227('0x38')](_0x4160e1[_0x7227('0x30')][_0x7227('0x38')]);_0x3e15f4[_0x7227('0x39')]=qs[_0x7227('0x32')](_[_0x7227('0x3a')](_0x4160e1[_0x7227('0x30')],_0x1f289d[_0x7227('0x32')]),_0x3ceabc);if(_0x4160e1['query'][_0x7227('0x3b')]){_0x3e15f4[_0x7227('0x39')]=_[_0x7227('0x3c')](_0x3e15f4[_0x7227('0x39')],{'$or':_[_0x7227('0x29')](_0x3ceabc,function(_0x57d2d3){if(_0x57d2d3['type']!==_0x7227('0x3d')){var _0x3828d4={};_0x3828d4[_0x57d2d3[_0x7227('0x26')]]={'$like':'%'+_0x4160e1[_0x7227('0x30')][_0x7227('0x3b')]+'%'};return _0x3828d4;}})});}_0x3e15f4=_[_0x7227('0x3c')]({},_0x3e15f4,_0x4160e1[_0x7227('0x3e')]);var _0x4d0a95={'where':_0x3e15f4[_0x7227('0x39')]};return db[_0x7227('0x2a')]['count'](_0x4d0a95)['then'](function(_0x3dcb14){_0x5ec7f5['count']=_0x3dcb14;if(_0x4160e1[_0x7227('0x30')][_0x7227('0x3f')]){_0x3e15f4['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x7227('0x40')](_0x3e15f4);})[_0x7227('0x41')](function(_0x174ce0){_0x5ec7f5[_0x7227('0x42')]=_0x174ce0;return _0x5ec7f5;})[_0x7227('0x41')](respondWithFilteredResult(_0x3991c3,_0x3e15f4))[_0x7227('0x43')](handleError(_0x3991c3,null));};exports[_0x7227('0x44')]=function(_0x293c3d,_0x5e8576){var _0x2d915e={'raw':!![],'where':{'id':_0x293c3d['params']['id']}},_0x37ed63={};_0x37ed63[_0x7227('0x2f')]=_[_0x7227('0x31')](db[_0x7227('0x2a')]['rawAttributes']);_0x37ed63[_0x7227('0x30')]=_[_0x7227('0x31')](_0x293c3d[_0x7227('0x30')]);_0x37ed63['filters']=_['intersection'](_0x37ed63[_0x7227('0x2f')],_0x37ed63['query']);_0x2d915e[_0x7227('0x34')]=_['intersection'](_0x37ed63[_0x7227('0x2f')],qs[_0x7227('0x35')](_0x293c3d[_0x7227('0x30')]['fields']));_0x2d915e['attributes']=_0x2d915e['attributes'][_0x7227('0x36')]?_0x2d915e['attributes']:_0x37ed63[_0x7227('0x2f')];if(_0x293c3d[_0x7227('0x30')][_0x7227('0x3f')]){_0x2d915e[_0x7227('0x45')]=[{'all':!![]}];}_0x2d915e=_['merge']({},_0x2d915e,_0x293c3d[_0x7227('0x3e')]);return db[_0x7227('0x2a')]['find'](_0x2d915e)[_0x7227('0x41')](handleEntityNotFound(_0x5e8576,null))[_0x7227('0x41')](respondWithResult(_0x5e8576,null))[_0x7227('0x43')](handleError(_0x5e8576,null));};exports['create']=function(_0x3feec1,_0xac6f60){return db['VoiceDialReport'][_0x7227('0x46')](_0x3feec1['body'],{})[_0x7227('0x41')](respondWithResult(_0xac6f60,0xc9))['catch'](handleError(_0xac6f60,null));};exports[_0x7227('0x22')]=function(_0xeae0bb,_0x3de239){if(_0xeae0bb['body']['id']){delete _0xeae0bb[_0x7227('0x47')]['id'];}return db[_0x7227('0x2a')]['find']({'where':{'id':_0xeae0bb[_0x7227('0x48')]['id']}})[_0x7227('0x41')](handleEntityNotFound(_0x3de239,null))[_0x7227('0x41')](saveUpdates(_0xeae0bb[_0x7227('0x47')],null))[_0x7227('0x41')](respondWithResult(_0x3de239,null))[_0x7227('0x43')](handleError(_0x3de239,null));};exports[_0x7227('0x23')]=function(_0x5c1a8d,_0xcba845){return db[_0x7227('0x2a')][_0x7227('0x49')]({'where':{'id':_0x5c1a8d['params']['id']}})[_0x7227('0x41')](handleEntityNotFound(_0xcba845,null))['then'](removeEntity(_0xcba845,null))[_0x7227('0x43')](handleError(_0xcba845,null));};exports[_0x7227('0x4a')]=function(_0xc5b69a,_0x37ae08){return db[_0x7227('0x2a')][_0x7227('0x4a')]()[_0x7227('0x41')](respondWithResult(_0x37ae08,null))[_0x7227('0x43')](handleError(_0x37ae08,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 570b193..9560c3c 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 _0x5a05=['report_dial','util','../../config/logger','api','bluebird','request-promise','path','exports','VoiceDialReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5a05,0x17b));var _0x55a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a05[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x55a0('0x0'));var logger=require(_0x55a0('0x1'))(_0x55a0('0x2'));var moment=require('moment');var BPromise=require(_0x55a0('0x3'));var rp=require(_0x55a0('0x4'));var fs=require('fs');var path=require(_0x55a0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x55a0('0x6')]=function(_0x2c9910,_0x31e6e2){return _0x2c9910['define'](_0x55a0('0x7'),attributes,{'tableName':_0x55a0('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4ac=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0xf4ac,0xd0));var _0xcf4a=function(_0x1d366a,_0x140404){_0x1d366a=_0x1d366a-0x0;var _0x3b876a=_0xf4ac[_0x1d366a];return _0x3b876a;};'use strict';var _=require(_0xcf4a('0x0'));var util=require(_0xcf4a('0x1'));var logger=require(_0xcf4a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf4a('0x4'));var config=require(_0xcf4a('0x5'));var attributes=require(_0xcf4a('0x6'));module[_0xcf4a('0x7')]=function(_0x104d9a,_0x2d28ed){return _0x104d9a[_0xcf4a('0x8')](_0xcf4a('0x9'),attributes,{'tableName':_0xcf4a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xcf4a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 660a2e6..003a528 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 _0xb94e=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateVoiceDialReport','body','options','UpdateVoiceDialReport','update','where','attributes','limit','stringify','lodash'];(function(_0x3dec83,_0x31e3e9){var _0x1979a8=function(_0x2d46b1){while(--_0x2d46b1){_0x3dec83['push'](_0x3dec83['shift']());}};_0x1979a8(++_0x31e3e9);}(_0xb94e,0x95));var _0xeb94=function(_0x4da3b6,_0x170416){_0x4da3b6=_0x4da3b6-0x0;var _0xc22def=_0xb94e[_0x4da3b6];return _0xc22def;};'use strict';var _=require(_0xeb94('0x0'));var util=require(_0xeb94('0x1'));var moment=require(_0xeb94('0x2'));var BPromise=require(_0xeb94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb94('0x5'))(_0xeb94('0x6'));var config=require(_0xeb94('0x7'));var jayson=require(_0xeb94('0x8'));var client=jayson[_0xeb94('0x9')][_0xeb94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5372a8,_0x1e5bc4,_0x2043e4){return new BPromise(function(_0x3da195,_0x3ea890){return client['request'](_0x5372a8,_0x2043e4)[_0xeb94('0xb')](function(_0x360095){logger['info'](_0xeb94('0xc'),_0x1e5bc4,_0xeb94('0xd'));logger[_0xeb94('0xe')](_0xeb94('0xf'),_0x1e5bc4,_0xeb94('0xd'),JSON['stringify'](_0x360095));if(_0x360095[_0xeb94('0x10')]){if(_0x360095['error'][_0xeb94('0x11')]===0x1f4){logger[_0xeb94('0x10')](_0xeb94('0xc'),_0x1e5bc4,_0x360095[_0xeb94('0x10')][_0xeb94('0x12')]);return _0x3ea890(_0x360095[_0xeb94('0x10')][_0xeb94('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1e5bc4,_0x360095[_0xeb94('0x10')]['message']);return _0x3da195(_0x360095[_0xeb94('0x10')]['message']);}else{logger[_0xeb94('0x13')](_0xeb94('0xc'),_0x1e5bc4,_0xeb94('0xd'));_0x3da195(_0x360095['result'][_0xeb94('0x12')]);}})[_0xeb94('0x14')](function(_0x9727a2){logger[_0xeb94('0x10')](_0xeb94('0xc'),_0x1e5bc4,_0x9727a2);_0x3ea890(_0x9727a2);});});}exports[_0xeb94('0x15')]=function(_0x514394){var _0x4c42e1=this;return new Promise(function(_0x30111b,_0x1b89db){return db['VoiceDialReport']['create'](_0x514394[_0xeb94('0x16')],{'raw':_0x514394[_0xeb94('0x17')]?_0x514394[_0xeb94('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x120f88){logger[_0xeb94('0x13')]('CreateVoiceDialReport',_0x514394);logger['debug']('CreateVoiceDialReport',_0x514394,JSON['stringify'](_0x120f88));_0x30111b(_0x120f88);})[_0xeb94('0x14')](function(_0x33c4b5){logger['error'](_0xeb94('0x15'),_0x33c4b5[_0xeb94('0x12')],_0x514394);_0x1b89db(_0x4c42e1[_0xeb94('0x10')](0x1f4,_0x33c4b5[_0xeb94('0x12')]));});});};exports[_0xeb94('0x18')]=function(_0x2e1228){var _0x4a3379=this;return new Promise(function(_0x226f52,_0x25969c){return db['VoiceDialReport'][_0xeb94('0x19')](_0x2e1228[_0xeb94('0x16')],{'raw':_0x2e1228[_0xeb94('0x17')]?_0x2e1228[_0xeb94('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1228[_0xeb94('0x17')]?_0x2e1228[_0xeb94('0x17')][_0xeb94('0x1a')]||null:null,'attributes':_0x2e1228[_0xeb94('0x17')]?_0x2e1228[_0xeb94('0x17')][_0xeb94('0x1b')]||null:null,'limit':_0x2e1228[_0xeb94('0x17')]?_0x2e1228[_0xeb94('0x17')][_0xeb94('0x1c')]||null:null})[_0xeb94('0xb')](function(_0x4f10cf){logger[_0xeb94('0x13')](_0xeb94('0x18'),_0x2e1228);logger['debug'](_0xeb94('0x18'),_0x2e1228,JSON[_0xeb94('0x1d')](_0x4f10cf));_0x226f52(_0x4f10cf);})[_0xeb94('0x14')](function(_0x482d22){logger['error']('UpdateVoiceDialReport',_0x482d22[_0xeb94('0x12')],_0x2e1228);_0x25969c(_0x4a3379[_0xeb94('0x10')](0x1f4,_0x482d22[_0xeb94('0x12')]));});});}; \ No newline at end of file +var _0x990c=['body','raw','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','options','CreateVoiceDialReport','debug','stringify','catch','VoiceDialReport','update'];(function(_0x520544,_0x99bb12){var _0x259b65=function(_0x5086f9){while(--_0x5086f9){_0x520544['push'](_0x520544['shift']());}};_0x259b65(++_0x99bb12);}(_0x990c,0x140));var _0xc990=function(_0x581be9,_0x38fcb4){_0x581be9=_0x581be9-0x0;var _0x495eb2=_0x990c[_0x581be9];return _0x495eb2;};'use strict';var _=require(_0xc990('0x0'));var util=require(_0xc990('0x1'));var moment=require(_0xc990('0x2'));var BPromise=require(_0xc990('0x3'));var rs=require(_0xc990('0x4'));var fs=require('fs');var Redis=require(_0xc990('0x5'));var db=require(_0xc990('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc990('0x7'))(_0xc990('0x8'));var config=require(_0xc990('0x9'));var jayson=require(_0xc990('0xa'));var client=jayson[_0xc990('0xb')][_0xc990('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45d94e,_0x40b90b,_0x5d299e){return new BPromise(function(_0x552102,_0x119ace){return client[_0xc990('0xd')](_0x45d94e,_0x5d299e)[_0xc990('0xe')](function(_0x384f01){logger[_0xc990('0xf')](_0xc990('0x10'),_0x40b90b,'request\x20sent');logger['debug'](_0xc990('0x11'),_0x40b90b,_0xc990('0x12'),JSON['stringify'](_0x384f01));if(_0x384f01['error']){if(_0x384f01[_0xc990('0x13')][_0xc990('0x14')]===0x1f4){logger[_0xc990('0x13')](_0xc990('0x10'),_0x40b90b,_0x384f01[_0xc990('0x13')][_0xc990('0x15')]);return _0x119ace(_0x384f01[_0xc990('0x13')]['message']);}logger['error'](_0xc990('0x10'),_0x40b90b,_0x384f01[_0xc990('0x13')]['message']);return _0x552102(_0x384f01[_0xc990('0x13')][_0xc990('0x15')]);}else{logger[_0xc990('0xf')](_0xc990('0x10'),_0x40b90b,'request\x20sent');_0x552102(_0x384f01[_0xc990('0x16')][_0xc990('0x15')]);}})['catch'](function(_0x152655){logger[_0xc990('0x13')](_0xc990('0x10'),_0x40b90b,_0x152655);_0x119ace(_0x152655);});});}exports['CreateVoiceDialReport']=function(_0x5f581b){var _0x597e7a=this;return new Promise(function(_0x4d8fbc,_0x271199){return db['VoiceDialReport']['create'](_0x5f581b['body'],{'raw':_0x5f581b['options']?_0x5f581b[_0xc990('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc990('0xe')](function(_0xa6de53){logger[_0xc990('0xf')](_0xc990('0x18'),_0x5f581b);logger[_0xc990('0x19')](_0xc990('0x18'),_0x5f581b,JSON[_0xc990('0x1a')](_0xa6de53));_0x4d8fbc(_0xa6de53);})[_0xc990('0x1b')](function(_0x56edb7){logger[_0xc990('0x13')](_0xc990('0x18'),_0x56edb7[_0xc990('0x15')],_0x5f581b);_0x271199(_0x597e7a[_0xc990('0x13')](0x1f4,_0x56edb7[_0xc990('0x15')]));});});};exports['UpdateVoiceDialReport']=function(_0x5d5e73){var _0x14586a=this;return new Promise(function(_0x288b8d,_0x339f49){return db[_0xc990('0x1c')][_0xc990('0x1d')](_0x5d5e73[_0xc990('0x1e')],{'raw':_0x5d5e73[_0xc990('0x17')]?_0x5d5e73['options'][_0xc990('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5e73[_0xc990('0x17')]?_0x5d5e73['options']['where']||null:null,'attributes':_0x5d5e73[_0xc990('0x17')]?_0x5d5e73[_0xc990('0x17')][_0xc990('0x20')]||null:null,'limit':_0x5d5e73[_0xc990('0x17')]?_0x5d5e73['options'][_0xc990('0x21')]||null:null})[_0xc990('0xe')](function(_0x283b51){logger[_0xc990('0xf')](_0xc990('0x22'),_0x5d5e73);logger['debug'](_0xc990('0x22'),_0x5d5e73,JSON[_0xc990('0x1a')](_0x283b51));_0x288b8d(_0x283b51);})[_0xc990('0x1b')](function(_0xfab32e){logger[_0xc990('0x13')](_0xc990('0x22'),_0xfab32e['message'],_0x5d5e73);_0x339f49(_0x14586a['error'](0x1f4,_0xfab32e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index db4c60a..0058d40 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 _0x88c1=['update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put'];(function(_0x1f8ce9,_0x3d538a){var _0x3530f4=function(_0x2952e7){while(--_0x2952e7){_0x1f8ce9['push'](_0x1f8ce9['shift']());}};_0x3530f4(++_0x3d538a);}(_0x88c1,0x9a));var _0x188c=function(_0x5d408c,_0x3b3c2d){_0x5d408c=_0x5d408c-0x0;var _0x534a9b=_0x88c1[_0x5d408c];return _0x534a9b;};'use strict';var multer=require(_0x188c('0x0'));var util=require('util');var path=require(_0x188c('0x1'));var timeout=require(_0x188c('0x2'));var express=require(_0x188c('0x3'));var router=express['Router']();var fs_extra=require(_0x188c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x188c('0x5'));var config=require('../../config/environment');var controller=require(_0x188c('0x6'));router[_0x188c('0x7')]('/',auth['isAuthenticated'](),controller[_0x188c('0x8')]);router[_0x188c('0x7')](_0x188c('0x9'),auth[_0x188c('0xa')](),controller[_0x188c('0xb')]);router[_0x188c('0xc')]('/',auth[_0x188c('0xa')](),controller[_0x188c('0xd')]);router[_0x188c('0xc')](_0x188c('0xe'),auth[_0x188c('0xa')](),controller[_0x188c('0xf')]);router[_0x188c('0x10')](_0x188c('0x9'),auth['isAuthenticated'](),controller[_0x188c('0x11')]);router['delete'](_0x188c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x188c('0x12')]=router; \ No newline at end of file +var _0x71b5=['get','isAuthenticated','index','show','post','/:id/applications','addApplications','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b0d21,_0x4be83e){var _0x5a9eb8=function(_0x4cb3da){while(--_0x4cb3da){_0x4b0d21['push'](_0x4b0d21['shift']());}};_0x5a9eb8(++_0x4be83e);}(_0x71b5,0x1b0));var _0x571b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x571b('0x0'));var util=require(_0x571b('0x1'));var path=require(_0x571b('0x2'));var timeout=require(_0x571b('0x3'));var express=require('express');var router=express[_0x571b('0x4')]();var fs_extra=require(_0x571b('0x5'));var auth=require(_0x571b('0x6'));var interaction=require(_0x571b('0x7'));var config=require(_0x571b('0x8'));var controller=require('./voiceExtension.controller');router[_0x571b('0x9')]('/',auth[_0x571b('0xa')](),controller[_0x571b('0xb')]);router[_0x571b('0x9')]('/:id',auth[_0x571b('0xa')](),controller[_0x571b('0xc')]);router[_0x571b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x571b('0xd')](_0x571b('0xe'),auth[_0x571b('0xa')](),controller[_0x571b('0xf')]);router['put'](_0x571b('0x10'),auth[_0x571b('0xa')](),controller[_0x571b('0x11')]);router[_0x571b('0x12')]('/:id',auth[_0x571b('0xa')](),controller[_0x571b('0x13')]);module[_0x571b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7693b32..72e2a4a 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 _0xa824=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0x3740f7,_0x1194aa){var _0x191401=function(_0x2fb0f8){while(--_0x2fb0f8){_0x3740f7['push'](_0x3740f7['shift']());}};_0x191401(++_0x1194aa);}(_0xa824,0x1a7));var _0x4a82=function(_0xa03c26,_0x2edd5b){_0xa03c26=_0xa03c26-0x0;var _0x37f407=_0xa824[_0xa03c26];return _0x37f407;};'use strict';var Sequelize=require(_0x4a82('0x0'));module[_0x4a82('0x1')]={'context':{'type':Sequelize[_0x4a82('0x2')],'allowNull':![],'unique':_0x4a82('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4a82('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x4a82('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4a82('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4a82('0x2')],'allowNull':![],'defaultValue':_0x4a82('0x4')},'appdata':{'type':Sequelize[_0x4a82('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4a82('0x5')](_0x4a82('0x6'),_0x4a82('0x7'),_0x4a82('0x8'),_0x4a82('0x9'),_0x4a82('0xa'),_0x4a82('0xb'),_0x4a82('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x4a82('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a82('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4a82('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x4a82('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4a82('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4a82('0xf')]},'recordingFormat':{'type':Sequelize[_0x4a82('0x2')],'defaultValue':_0x4a82('0x10')},'answer':{'type':Sequelize[_0x4a82('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4a82('0x11')],'get':function(_0x1d2081){return this[_0x4a82('0x12')](_0x4a82('0x13'));}},'alias':{'type':Sequelize[_0x4a82('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6d5c=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','outbound-fax','any','BOOLEAN','VIRTUAL','sequelize','exports'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0x6d5c,0x172));var _0xc6d5=function(_0x327c17,_0x1908e6){_0x327c17=_0x327c17-0x0;var _0x41c563=_0x6d5c[_0x327c17];return _0x41c563;};'use strict';var Sequelize=require(_0xc6d5('0x0'));module[_0xc6d5('0x1')]={'context':{'type':Sequelize[_0xc6d5('0x2')],'allowNull':![],'unique':_0xc6d5('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6d5('0x3')},'priority':{'type':Sequelize[_0xc6d5('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xc6d5('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc6d5('0x2')],'allowNull':![],'defaultValue':_0xc6d5('0x4')},'appdata':{'type':Sequelize[_0xc6d5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc6d5('0x5')](_0xc6d5('0x6'),_0xc6d5('0x7'),'internal','inbound-fax',_0xc6d5('0x8'),'system',_0xc6d5('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xc6d5('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc6d5('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc6d5('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc6d5('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xc6d5('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xc6d5('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xc6d5('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc6d5('0xb')],'get':function(_0x341893){return this['getDataValue']('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 2011e57..63df557 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 _0x51a6=['undefined','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','show','params','catch','startsWith','body','exten','concat','create','user','role','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','json','offset','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x51a6,0x166));var _0x651a=function(_0x356b9e,_0x306f73){_0x356b9e=_0x356b9e-0x0;var _0x15e910=_0x51a6[_0x356b9e];return _0x15e910;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x651a('0x0'));var logger=require(_0x651a('0x1'))(_0x651a('0x2'));var config=require(_0x651a('0x3'));var db=require(_0x651a('0x4'))['db'];config[_0x651a('0x5')]=_[_0x651a('0x6')](config[_0x651a('0x5')],{'host':_0x651a('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x651a('0x5')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x5e6573,_0x5cd237){_0x5cd237=_0x5cd237||0xcc;return function(_0x9d360){if(_0x9d360){return _0x5e6573[_0x651a('0x8')](_0x5cd237);}return _0x5e6573['status'](_0x5cd237)[_0x651a('0x9')]();};}function respondWithResult(_0x4172b8,_0x43226f){_0x43226f=_0x43226f||0xc8;return function(_0x575a16){if(_0x575a16){return _0x4172b8[_0x651a('0xa')](_0x43226f)[_0x651a('0xb')](_0x575a16);}};}function respondWithFilteredResult(_0x437e17,_0x18d5d6){return function(_0x4e2f42){if(_0x4e2f42){var _0x53b026=typeof _0x18d5d6[_0x651a('0xc')]==='undefined'&&typeof _0x18d5d6[_0x651a('0xd')]===_0x651a('0xe');var _0x2c07e0=_0x4e2f42[_0x651a('0xf')];var _0x452917=_0x53b026?0x0:_0x18d5d6[_0x651a('0xc')];var _0x1613b4=_0x53b026?_0x4e2f42[_0x651a('0xf')]:_0x18d5d6[_0x651a('0xc')]+_0x18d5d6[_0x651a('0xd')];var _0x498ace;if(_0x1613b4>=_0x2c07e0){_0x1613b4=_0x2c07e0;_0x498ace=0xc8;}else{_0x498ace=0xce;}_0x437e17[_0x651a('0xa')](_0x498ace);return _0x437e17[_0x651a('0x10')](_0x651a('0x11'),_0x452917+'-'+_0x1613b4+'/'+_0x2c07e0)[_0x651a('0xb')](_0x4e2f42);}return null;};}function removeEntity(_0x153d68){return function(_0x40f76b){if(_0x40f76b){return _0x40f76b[_0x651a('0x12')]()[_0x651a('0x13')](function(){var _0x3197cd=_0x40f76b[_0x651a('0x14')]({'plain':!![]});var _0x153412=[{'name':'InboundRoutes','value':_0x651a('0x15'),'ignore':![]},{'name':_0x651a('0x16'),'value':_0x651a('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x651a('0x18'),'ignore':![]}];var _0x1d11de=_(_0x153412)[_0x651a('0x19')](_0x651a('0x1a'))[_0x651a('0x1b')](_0x651a('0x1c'))['value']();if(_[_0x651a('0x1d')](_0x1d11de,_0x3197cd['type'])){return;}var _0x56d30a=_[_0x651a('0x1e')](_0x153412,['value',_0x3197cd[_0x651a('0x1f')]])[_0x651a('0x20')];return db[_0x651a('0x21')][_0x651a('0x12')]({'where':{'type':_0x56d30a,'resourceId':_0x3197cd['id']}})[_0x651a('0x13')](function(){return _0x40f76b;});})[_0x651a('0x13')](function(){_0x153d68[_0x651a('0xa')](0xcc)[_0x651a('0x9')]();});}};}function handleEntityNotFound(_0x2d3960){return function(_0x572eb7){if(!_0x572eb7){_0x2d3960[_0x651a('0x8')](0x194);}return _0x572eb7;};}function handleError(_0x10d5f8,_0x5de277){_0x5de277=_0x5de277||0x1f4;return function(_0x5630d7){logger[_0x651a('0x22')](_0x5630d7[_0x651a('0x23')]);if(_0x5630d7['name']){delete _0x5630d7[_0x651a('0x20')];}_0x10d5f8[_0x651a('0xa')](_0x5de277)[_0x651a('0x24')](_0x5630d7);};}exports[_0x651a('0x25')]=function(_0x527c03,_0x1d5ef9){var _0x363a89={},_0xc643f1={},_0x5d81df={'count':0x0,'rows':[]};var _0x51d930=_['map'](db[_0x651a('0x26')][_0x651a('0x27')],function(_0x9a6580){return{'name':_0x9a6580[_0x651a('0x28')],'type':_0x9a6580[_0x651a('0x1f')][_0x651a('0x29')]};});_0xc643f1['model']=_[_0x651a('0x1b')](_0x51d930,_0x651a('0x20'));_0xc643f1['query']=_[_0x651a('0x2a')](_0x527c03['query']);_0xc643f1[_0x651a('0x2b')]=_[_0x651a('0x2c')](_0xc643f1['model'],_0xc643f1[_0x651a('0x2d')]);_0x363a89[_0x651a('0x2e')]=_['intersection'](_0xc643f1[_0x651a('0x2f')],qs['fields'](_0x527c03['query'][_0x651a('0x30')]));_0x363a89[_0x651a('0x2e')]=_0x363a89['attributes']['length']?_0x363a89[_0x651a('0x2e')]:_0xc643f1[_0x651a('0x2f')];if(!_0x527c03['query'][_0x651a('0x31')](_0x651a('0x32'))){_0x363a89[_0x651a('0xd')]=qs[_0x651a('0xd')](_0x527c03[_0x651a('0x2d')][_0x651a('0xd')]);_0x363a89[_0x651a('0xc')]=qs[_0x651a('0xc')](_0x527c03[_0x651a('0x2d')][_0x651a('0xc')]);}_0x363a89[_0x651a('0x33')]=qs[_0x651a('0x34')](_0x527c03[_0x651a('0x2d')]['sort']);_0x363a89[_0x651a('0x35')]=qs[_0x651a('0x2b')](_[_0x651a('0x36')](_0x527c03['query'],_0xc643f1[_0x651a('0x2b')]),_0x51d930);if(_0x527c03[_0x651a('0x2d')][_0x651a('0x19')]){_0x363a89[_0x651a('0x35')]=_[_0x651a('0x37')](_0x363a89[_0x651a('0x35')],{'$or':_[_0x651a('0x1b')](_0x51d930,function(_0x1322ae){if(_0x1322ae[_0x651a('0x1f')]!=='VIRTUAL'){var _0x17c9b6={};_0x17c9b6[_0x1322ae[_0x651a('0x20')]]={'$like':'%'+_0x527c03[_0x651a('0x2d')][_0x651a('0x19')]+'%'};return _0x17c9b6;}})});}_0x363a89=_[_0x651a('0x37')]({},_0x363a89,_0x527c03[_0x651a('0x38')]);var _0x3c9c10={'where':_0x363a89[_0x651a('0x35')]};return db[_0x651a('0x26')]['count'](_0x3c9c10)['then'](function(_0x777866){_0x5d81df[_0x651a('0xf')]=_0x777866;if(_0x527c03[_0x651a('0x2d')][_0x651a('0x39')]){_0x363a89[_0x651a('0x3a')]=[{'all':!![]}];}return db[_0x651a('0x26')]['findAll'](_0x363a89);})['then'](function(_0x2f50e7){_0x5d81df[_0x651a('0x3b')]=_0x2f50e7;return _0x5d81df;})[_0x651a('0x13')](respondWithFilteredResult(_0x1d5ef9,_0x363a89))['catch'](handleError(_0x1d5ef9,null));};exports[_0x651a('0x3c')]=function(_0x511a8b,_0x57797f){var _0x420e6e={'raw':![],'where':{'id':_0x511a8b[_0x651a('0x3d')]['id']}},_0x1d4a48={};_0x1d4a48[_0x651a('0x2f')]=_[_0x651a('0x2a')](db[_0x651a('0x26')][_0x651a('0x27')]);_0x1d4a48[_0x651a('0x2d')]=_['keys'](_0x511a8b['query']);_0x1d4a48[_0x651a('0x2b')]=_['intersection'](_0x1d4a48[_0x651a('0x2f')],_0x1d4a48[_0x651a('0x2d')]);_0x420e6e[_0x651a('0x2e')]=_[_0x651a('0x2c')](_0x1d4a48[_0x651a('0x2f')],qs[_0x651a('0x30')](_0x511a8b['query'][_0x651a('0x30')]));_0x420e6e[_0x651a('0x2e')]=_0x420e6e[_0x651a('0x2e')]['length']?_0x420e6e['attributes']:_0x1d4a48[_0x651a('0x2f')];if(_0x511a8b[_0x651a('0x2d')][_0x651a('0x39')]){_0x420e6e[_0x651a('0x3a')]=[{'all':!![]}];}_0x420e6e=_['merge']({},_0x420e6e,_0x511a8b[_0x651a('0x38')]);return db[_0x651a('0x26')]['find'](_0x420e6e)[_0x651a('0x13')](handleEntityNotFound(_0x57797f,null))['then'](respondWithResult(_0x57797f,null))[_0x651a('0x3e')](handleError(_0x57797f,null));};exports[_0x651a('0x12')]=function(_0x8a26b4,_0xb49fbc){return db[_0x651a('0x26')][_0x651a('0x1e')]({'where':{'id':_0x8a26b4['params']['id']}})[_0x651a('0x13')](handleEntityNotFound(_0xb49fbc,null))[_0x651a('0x13')](removeEntity(_0xb49fbc,null))[_0x651a('0x3e')](handleError(_0xb49fbc,null));};exports['create']=function(_0x5b2555,_0x1d827c){if(_0x5b2555['body'][_0x651a('0x1f')]===_0x651a('0x17')&&!_[_0x651a('0x3f')](_0x5b2555[_0x651a('0x40')][_0x651a('0x41')],'_')){_0x5b2555[_0x651a('0x40')][_0x651a('0x41')]='_'[_0x651a('0x42')](_0x5b2555['body'][_0x651a('0x41')]);}return db[_0x651a('0x26')][_0x651a('0x43')](_0x5b2555[_0x651a('0x40')],{'raw':![]})[_0x651a('0x13')](function(_0x594449){var _0x3508a2=_0x5b2555[_0x651a('0x44')][_0x651a('0x14')]({'plain':!![]});if(!_0x3508a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3508a2[_0x651a('0x45')]===_0x651a('0x44')){var _0x25f948=_0x594449[_0x651a('0x14')]({'plain':!![]});var _0x280d8a=[{'name':'InboundRoutes','value':_0x651a('0x15')},{'name':_0x651a('0x16'),'value':_0x651a('0x17')},{'name':_0x651a('0x46'),'value':_0x651a('0x18')}];var _0x3f3922=_[_0x651a('0x1e')](_0x280d8a,[_0x651a('0x1c'),_0x25f948['type']])[_0x651a('0x20')];return db[_0x651a('0x47')]['find']({'where':{'name':_0x3f3922,'userProfileId':_0x3508a2[_0x651a('0x48')]},'raw':!![]})['then'](function(_0x186ece){if(_0x186ece&&_0x186ece[_0x651a('0x49')]===0x0){return db[_0x651a('0x21')]['create']({'name':_0x25f948[_0x651a('0x20')],'resourceId':_0x25f948['id'],'type':_0x186ece[_0x651a('0x20')],'sectionId':_0x186ece['id']},{})[_0x651a('0x13')](function(){return _0x594449;});}else{return _0x594449;}})[_0x651a('0x3e')](function(_0x3c12c3){logger['error'](_0x651a('0x4a'),_0x3c12c3);throw _0x3c12c3;});}return _0x594449;})[_0x651a('0x13')](respondWithResult(_0x1d827c,0xc9))[_0x651a('0x3e')](handleError(_0x1d827c,null));};exports['update']=function(_0x3e8220,_0x269155){if(_0x3e8220[_0x651a('0x40')]['id']){delete _0x3e8220[_0x651a('0x40')]['id'];}return db[_0x651a('0x26')][_0x651a('0x1e')]({'where':{'id':_0x3e8220['params']['id']}})['then'](handleEntityNotFound(_0x269155,null))[_0x651a('0x13')](function(_0x41231f){if(_0x41231f){return db[_0x651a('0x26')][_0x651a('0x4b')](_[_0x651a('0x36')](_0x3e8220[_0x651a('0x40')],[_0x651a('0x41'),'context','description','recordingFormat',_0x651a('0x4c'),_0x651a('0x4d'),_0x651a('0x4e')]),{'where':{'context':_0x41231f[_0x651a('0x4f')],'exten':_0x41231f[_0x651a('0x41')]},'individualHooks':!![]})[_0x651a('0x13')](function(_0x372534){return _0x372534;});}return null;})[_0x651a('0x13')](respondWithStatusCode(_0x269155,null))['catch'](handleError(_0x269155,null));};exports[_0x651a('0x50')]=function(_0x2e13e8,_0x41b447){var _0x379b76=_0x2e13e8[_0x651a('0x3d')]['id'];var _0x55a50b=_0x2e13e8[_0x651a('0x40')];var _0x58bbe5=0xc8;var _0x2f77fc=null;return db[_0x651a('0x51')][_0x651a('0x52')]({'isolationLevel':db[_0x651a('0x51')][_0x651a('0x53')][_0x651a('0x54')][_0x651a('0x55')]},function(_0x59b26c){return db['VoiceExtension']['findOne']({'where':{'id':_0x379b76},'transaction':_0x59b26c})['then'](function(_0x3fce1c){if(_0x3fce1c){return db[_0x651a('0x26')][_0x651a('0x12')]({'where':{'VoiceExtensionId':_0x379b76},'transaction':_0x59b26c})[_0x651a('0x13')](function(){var _0x33ff4f=_['map'](_0x55a50b,function(_0x42d57b){_0x42d57b[_0x651a('0x56')]=_0x379b76;_0x42d57b[_0x651a('0x57')]=!![];return _0x42d57b;});return _0x3fce1c[_0x651a('0x58')](_0x33ff4f);})[_0x651a('0x13')](function(_0x4bc8a1){return db[_0x651a('0x26')][_0x651a('0x59')](_0x4bc8a1,{'transaction':_0x59b26c});});}else{_0x58bbe5=0x194;_0x2f77fc=[];}});})[_0x651a('0x13')](function(){if(_0x58bbe5!==0x194){return db[_0x651a('0x26')][_0x651a('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x379b76},'order':_0x651a('0x5b')})['then'](function(_0x2f3f11){_0x2f77fc=_0x2f3f11;});}})[_0x651a('0x3e')](function(_0x25b64d){_0x58bbe5=0x1f4;logger[_0x651a('0x22')](_0x25b64d[_0x651a('0x23')]);if(_0x25b64d[_0x651a('0x20')]){delete _0x25b64d[_0x651a('0x20')];}_0x2f77fc=_0x25b64d;})[_0x651a('0x5c')](function(){if(_0x2f77fc===null){_0x41b447['sendStatus'](_0x58bbe5);}else{if(_0x58bbe5===0x1f4){_0x41b447[_0x651a('0xa')](_0x58bbe5)[_0x651a('0x24')](_0x2f77fc);}else{_0x41b447['status'](_0x58bbe5)['json'](_0x2f77fc);}}});}; \ No newline at end of file +var _0x978c=['ignore','value','includes','find','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','destroy','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','error','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./voiceExtension.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal'];(function(_0x43ea59,_0x1c5490){var _0x26bde5=function(_0x4da36c){while(--_0x4da36c){_0x43ea59['push'](_0x43ea59['shift']());}};_0x26bde5(++_0x1c5490);}(_0x978c,0x1a3));var _0xc978=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x978c[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var Redis=require(_0xc978('0x0'));var qs=require(_0xc978('0x1'));var logger=require(_0xc978('0x2'))(_0xc978('0x3'));var config=require(_0xc978('0x4'));var db=require(_0xc978('0x5'))['db'];config[_0xc978('0x6')]=_['defaults'](config[_0xc978('0x6')],{'host':_0xc978('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc978('0x6')]));require(_0xc978('0x8'))['register'](socket);function respondWithStatusCode(_0x3fca2c,_0x3bfeee){_0x3bfeee=_0x3bfeee||0xcc;return function(_0x595d88){if(_0x595d88){return _0x3fca2c[_0xc978('0x9')](_0x3bfeee);}return _0x3fca2c['status'](_0x3bfeee)[_0xc978('0xa')]();};}function respondWithResult(_0x3cc86e,_0x2375a4){_0x2375a4=_0x2375a4||0xc8;return function(_0x54dcc6){if(_0x54dcc6){return _0x3cc86e['status'](_0x2375a4)[_0xc978('0xb')](_0x54dcc6);}};}function respondWithFilteredResult(_0x3f7814,_0x3a3c3c){return function(_0x42b260){if(_0x42b260){var _0x359f0c=typeof _0x3a3c3c[_0xc978('0xc')]===_0xc978('0xd')&&typeof _0x3a3c3c[_0xc978('0xe')]===_0xc978('0xd');var _0x46068d=_0x42b260[_0xc978('0xf')];var _0x56c66a=_0x359f0c?0x0:_0x3a3c3c['offset'];var _0xa1747c=_0x359f0c?_0x42b260['count']:_0x3a3c3c['offset']+_0x3a3c3c[_0xc978('0xe')];var _0x156793;if(_0xa1747c>=_0x46068d){_0xa1747c=_0x46068d;_0x156793=0xc8;}else{_0x156793=0xce;}_0x3f7814[_0xc978('0x10')](_0x156793);return _0x3f7814[_0xc978('0x11')](_0xc978('0x12'),_0x56c66a+'-'+_0xa1747c+'/'+_0x46068d)[_0xc978('0xb')](_0x42b260);}return null;};}function removeEntity(_0x2d77b1){return function(_0x4d3702){if(_0x4d3702){return _0x4d3702['destroy']()[_0xc978('0x13')](function(){var _0x2baf3a=_0x4d3702['get']({'plain':!![]});var _0xec949=[{'name':_0xc978('0x14'),'value':_0xc978('0x15'),'ignore':![]},{'name':_0xc978('0x16'),'value':_0xc978('0x17'),'ignore':![]},{'name':_0xc978('0x18'),'value':_0xc978('0x19'),'ignore':![]}];var _0x44e0e3=_(_0xec949)['filter'](_0xc978('0x1a'))['map'](_0xc978('0x1b'))[_0xc978('0x1b')]();if(_[_0xc978('0x1c')](_0x44e0e3,_0x2baf3a['type'])){return;}var _0x46d493=_[_0xc978('0x1d')](_0xec949,[_0xc978('0x1b'),_0x2baf3a['type']])[_0xc978('0x1e')];return db[_0xc978('0x1f')]['destroy']({'where':{'type':_0x46d493,'resourceId':_0x2baf3a['id']}})[_0xc978('0x13')](function(){return _0x4d3702;});})[_0xc978('0x13')](function(){_0x2d77b1[_0xc978('0x10')](0xcc)[_0xc978('0xa')]();});}};}function handleEntityNotFound(_0x3788e4){return function(_0x3cf953){if(!_0x3cf953){_0x3788e4[_0xc978('0x9')](0x194);}return _0x3cf953;};}function handleError(_0xdae3fe,_0x454bd1){_0x454bd1=_0x454bd1||0x1f4;return function(_0x3de2d6){logger['error'](_0x3de2d6[_0xc978('0x20')]);if(_0x3de2d6[_0xc978('0x1e')]){delete _0x3de2d6[_0xc978('0x1e')];}_0xdae3fe[_0xc978('0x10')](_0x454bd1)[_0xc978('0x21')](_0x3de2d6);};}exports[_0xc978('0x22')]=function(_0xf0e200,_0x2052fe){var _0x478c4f={},_0x201029={},_0x26726f={'count':0x0,'rows':[]};var _0x2f760b=_['map'](db[_0xc978('0x23')][_0xc978('0x24')],function(_0x498e8f){return{'name':_0x498e8f[_0xc978('0x25')],'type':_0x498e8f[_0xc978('0x26')]['key']};});_0x201029['model']=_[_0xc978('0x27')](_0x2f760b,_0xc978('0x1e'));_0x201029[_0xc978('0x28')]=_['keys'](_0xf0e200['query']);_0x201029[_0xc978('0x29')]=_[_0xc978('0x2a')](_0x201029[_0xc978('0x2b')],_0x201029[_0xc978('0x28')]);_0x478c4f[_0xc978('0x2c')]=_[_0xc978('0x2a')](_0x201029['model'],qs[_0xc978('0x2d')](_0xf0e200[_0xc978('0x28')]['fields']));_0x478c4f['attributes']=_0x478c4f[_0xc978('0x2c')][_0xc978('0x2e')]?_0x478c4f[_0xc978('0x2c')]:_0x201029[_0xc978('0x2b')];if(!_0xf0e200[_0xc978('0x28')][_0xc978('0x2f')]('nolimit')){_0x478c4f['limit']=qs[_0xc978('0xe')](_0xf0e200[_0xc978('0x28')]['limit']);_0x478c4f[_0xc978('0xc')]=qs[_0xc978('0xc')](_0xf0e200[_0xc978('0x28')]['offset']);}_0x478c4f[_0xc978('0x30')]=qs[_0xc978('0x31')](_0xf0e200[_0xc978('0x28')][_0xc978('0x31')]);_0x478c4f[_0xc978('0x32')]=qs[_0xc978('0x29')](_['pick'](_0xf0e200[_0xc978('0x28')],_0x201029[_0xc978('0x29')]),_0x2f760b);if(_0xf0e200[_0xc978('0x28')][_0xc978('0x33')]){_0x478c4f[_0xc978('0x32')]=_['merge'](_0x478c4f[_0xc978('0x32')],{'$or':_[_0xc978('0x27')](_0x2f760b,function(_0xd5504a){if(_0xd5504a['type']!==_0xc978('0x34')){var _0x3c4481={};_0x3c4481[_0xd5504a['name']]={'$like':'%'+_0xf0e200[_0xc978('0x28')][_0xc978('0x33')]+'%'};return _0x3c4481;}})});}_0x478c4f=_[_0xc978('0x35')]({},_0x478c4f,_0xf0e200[_0xc978('0x36')]);var _0x15f566={'where':_0x478c4f[_0xc978('0x32')]};return db[_0xc978('0x23')][_0xc978('0xf')](_0x15f566)[_0xc978('0x13')](function(_0x2bc6f1){_0x26726f[_0xc978('0xf')]=_0x2bc6f1;if(_0xf0e200[_0xc978('0x28')][_0xc978('0x37')]){_0x478c4f[_0xc978('0x38')]=[{'all':!![]}];}return db[_0xc978('0x23')][_0xc978('0x39')](_0x478c4f);})['then'](function(_0x2397d4){_0x26726f['rows']=_0x2397d4;return _0x26726f;})[_0xc978('0x13')](respondWithFilteredResult(_0x2052fe,_0x478c4f))[_0xc978('0x3a')](handleError(_0x2052fe,null));};exports[_0xc978('0x3b')]=function(_0x38b2be,_0x5155e0){var _0x530ede={'raw':![],'where':{'id':_0x38b2be[_0xc978('0x3c')]['id']}},_0x259ef3={};_0x259ef3[_0xc978('0x2b')]=_[_0xc978('0x3d')](db[_0xc978('0x23')]['rawAttributes']);_0x259ef3[_0xc978('0x28')]=_['keys'](_0x38b2be[_0xc978('0x28')]);_0x259ef3[_0xc978('0x29')]=_[_0xc978('0x2a')](_0x259ef3['model'],_0x259ef3['query']);_0x530ede[_0xc978('0x2c')]=_['intersection'](_0x259ef3['model'],qs['fields'](_0x38b2be[_0xc978('0x28')][_0xc978('0x2d')]));_0x530ede[_0xc978('0x2c')]=_0x530ede[_0xc978('0x2c')]['length']?_0x530ede[_0xc978('0x2c')]:_0x259ef3[_0xc978('0x2b')];if(_0x38b2be['query'][_0xc978('0x37')]){_0x530ede['include']=[{'all':!![]}];}_0x530ede=_['merge']({},_0x530ede,_0x38b2be['options']);return db['VoiceExtension']['find'](_0x530ede)[_0xc978('0x13')](handleEntityNotFound(_0x5155e0,null))[_0xc978('0x13')](respondWithResult(_0x5155e0,null))['catch'](handleError(_0x5155e0,null));};exports[_0xc978('0x3e')]=function(_0xe3978b,_0xf9dee0){return db[_0xc978('0x23')][_0xc978('0x1d')]({'where':{'id':_0xe3978b['params']['id']}})['then'](handleEntityNotFound(_0xf9dee0,null))[_0xc978('0x13')](removeEntity(_0xf9dee0,null))[_0xc978('0x3a')](handleError(_0xf9dee0,null));};exports['create']=function(_0x30edcb,_0x11a56f){if(_0x30edcb['body'][_0xc978('0x26')]==='outbound'&&!_['startsWith'](_0x30edcb[_0xc978('0x3f')][_0xc978('0x40')],'_')){_0x30edcb[_0xc978('0x3f')][_0xc978('0x40')]='_'[_0xc978('0x41')](_0x30edcb[_0xc978('0x3f')][_0xc978('0x40')]);}return db[_0xc978('0x23')][_0xc978('0x42')](_0x30edcb[_0xc978('0x3f')],{'raw':![]})['then'](function(_0xe9cfb5){var _0x1cd1b0=_0x30edcb[_0xc978('0x43')]['get']({'plain':!![]});if(!_0x1cd1b0)throw new Error(_0xc978('0x44'));if(_0x1cd1b0['role']===_0xc978('0x43')){var _0x155041=_0xe9cfb5[_0xc978('0x45')]({'plain':!![]});var _0x18577c=[{'name':_0xc978('0x14'),'value':_0xc978('0x15')},{'name':_0xc978('0x16'),'value':_0xc978('0x17')},{'name':_0xc978('0x18'),'value':_0xc978('0x19')}];var _0x2e8763=_[_0xc978('0x1d')](_0x18577c,[_0xc978('0x1b'),_0x155041['type']])[_0xc978('0x1e')];return db[_0xc978('0x46')][_0xc978('0x1d')]({'where':{'name':_0x2e8763,'userProfileId':_0x1cd1b0[_0xc978('0x47')]},'raw':!![]})['then'](function(_0x3c8c88){if(_0x3c8c88&&_0x3c8c88[_0xc978('0x48')]===0x0){return db[_0xc978('0x1f')][_0xc978('0x42')]({'name':_0x155041[_0xc978('0x1e')],'resourceId':_0x155041['id'],'type':_0x3c8c88[_0xc978('0x1e')],'sectionId':_0x3c8c88['id']},{})['then'](function(){return _0xe9cfb5;});}else{return _0xe9cfb5;}})[_0xc978('0x3a')](function(_0x5f4199){logger['error'](_0xc978('0x49'),_0x5f4199);throw _0x5f4199;});}return _0xe9cfb5;})['then'](respondWithResult(_0x11a56f,0xc9))[_0xc978('0x3a')](handleError(_0x11a56f,null));};exports[_0xc978('0x4a')]=function(_0x2b4397,_0x177c13){if(_0x2b4397[_0xc978('0x3f')]['id']){delete _0x2b4397[_0xc978('0x3f')]['id'];}return db[_0xc978('0x23')]['find']({'where':{'id':_0x2b4397[_0xc978('0x3c')]['id']}})[_0xc978('0x13')](handleEntityNotFound(_0x177c13,null))['then'](function(_0x40c72d){if(_0x40c72d){return db[_0xc978('0x23')][_0xc978('0x4a')](_['pick'](_0x2b4397[_0xc978('0x3f')],[_0xc978('0x40'),'context','description',_0xc978('0x4b'),_0xc978('0x4c'),_0xc978('0x4d'),_0xc978('0x4e')]),{'where':{'context':_0x40c72d[_0xc978('0x4f')],'exten':_0x40c72d[_0xc978('0x40')]},'individualHooks':!![]})[_0xc978('0x13')](function(_0xdc493){return _0xdc493;});}return null;})[_0xc978('0x13')](respondWithStatusCode(_0x177c13,null))[_0xc978('0x3a')](handleError(_0x177c13,null));};exports[_0xc978('0x50')]=function(_0x2ba6cd,_0x5def0e){var _0x28e9a2=_0x2ba6cd[_0xc978('0x3c')]['id'];var _0x5722ce=_0x2ba6cd[_0xc978('0x3f')];var _0x96385a=0xc8;var _0x57223f=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xc978('0x51')][_0xc978('0x52')]},function(_0x3e179c){return db[_0xc978('0x23')][_0xc978('0x53')]({'where':{'id':_0x28e9a2},'transaction':_0x3e179c})[_0xc978('0x13')](function(_0x4cf5d3){if(_0x4cf5d3){return db[_0xc978('0x23')][_0xc978('0x3e')]({'where':{'VoiceExtensionId':_0x28e9a2},'transaction':_0x3e179c})['then'](function(){var _0x1c35ec=_['map'](_0x5722ce,function(_0x3b3a3e){_0x3b3a3e['VoiceExtensionId']=_0x28e9a2;_0x3b3a3e[_0xc978('0x54')]=!![];return _0x3b3a3e;});return _0x4cf5d3['createRouting'](_0x1c35ec);})['then'](function(_0x1ec2fa){return db[_0xc978('0x23')][_0xc978('0x55')](_0x1ec2fa,{'transaction':_0x3e179c});});}else{_0x96385a=0x194;_0x57223f=[];}});})[_0xc978('0x13')](function(){if(_0x96385a!==0x194){return db[_0xc978('0x23')][_0xc978('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x28e9a2},'order':_0xc978('0x57')})[_0xc978('0x13')](function(_0x53e83e){_0x57223f=_0x53e83e;});}})[_0xc978('0x3a')](function(_0x31e5f2){_0x96385a=0x1f4;logger[_0xc978('0x58')](_0x31e5f2[_0xc978('0x20')]);if(_0x31e5f2['name']){delete _0x31e5f2[_0xc978('0x1e')];}_0x57223f=_0x31e5f2;})['finally'](function(){if(_0x57223f===null){_0x5def0e[_0xc978('0x9')](_0x96385a);}else{if(_0x96385a===0x1f4){_0x5def0e[_0xc978('0x10')](_0x96385a)[_0xc978('0x21')](_0x57223f);}else{_0x5def0e[_0xc978('0x10')](_0x96385a)[_0xc978('0xb')](_0x57223f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bac774d..ff5a45b 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 _0xe994=['hook','exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x168230,_0x696a35){var _0x3daa18=function(_0x40e88b){while(--_0x40e88b){_0x168230['push'](_0x168230['shift']());}};_0x3daa18(++_0x696a35);}(_0xe994,0x80));var _0x4e99=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xe994[_0x2c0be1];return _0x3d4bd2;};'use strict';var EventEmitter=require(_0x4e99('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x4e99('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4e99('0x2')](0x0);var events={'afterCreate':_0x4e99('0x3'),'afterUpdate':_0x4e99('0x4'),'afterDestroy':_0x4e99('0x5')};function emitEvent(_0x3d8e29){return function(_0x4e5f9f,_0x405942,_0x5b5e2d){VoiceExtensionEvents[_0x4e99('0x6')](_0x3d8e29+':'+_0x4e5f9f['id'],_0x4e5f9f);VoiceExtensionEvents[_0x4e99('0x6')](_0x3d8e29,_0x4e5f9f);_0x5b5e2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x4e99('0x7')](e,emitEvent(event));}}module[_0x4e99('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x04b9=['emit','hasOwnProperty','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','remove'];(function(_0x1ab97c,_0x20dfc8){var _0x2ea95c=function(_0x566eff){while(--_0x566eff){_0x1ab97c['push'](_0x1ab97c['shift']());}};_0x2ea95c(++_0x20dfc8);}(_0x04b9,0x8b));var _0x904b=function(_0x59750c,_0x2a95cd){_0x59750c=_0x59750c-0x0;var _0x42d68d=_0x04b9[_0x59750c];return _0x42d68d;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x904b('0x0'))['db'][_0x904b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x904b('0x2')](0x0);var events={'afterCreate':_0x904b('0x3'),'afterUpdate':'update','afterDestroy':_0x904b('0x4')};function emitEvent(_0x34a72e){return function(_0x1e59f0,_0x4d671e,_0xd80227){VoiceExtensionEvents['emit'](_0x34a72e+':'+_0x1e59f0['id'],_0x1e59f0);VoiceExtensionEvents[_0x904b('0x5')](_0x34a72e,_0x1e59f0);_0xd80227(null);};}for(var e in events){if(events[_0x904b('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x904b('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 05b7984..512d85f 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 _0x4fe0=['CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','concat','./voiceExtension.attributes','exports','models','type','Set'];(function(_0x30494b,_0x47c496){var _0x4ee2fa=function(_0x1b5c20){while(--_0x1b5c20){_0x30494b['push'](_0x30494b['shift']());}};_0x4ee2fa(++_0x47c496);}(_0x4fe0,0x195));var _0x04fe=function(_0x1ec2e4,_0x499c13){_0x1ec2e4=_0x1ec2e4-0x0;var _0x139e02=_0x4fe0[_0x1ec2e4];return _0x139e02;};'use strict';var _=require('lodash');var attributes=require(_0x04fe('0x0'));module[_0x04fe('0x1')]=function(_0x17f3c8){var _0x3065e4=_0x17f3c8[_0x04fe('0x2')];function _0x22f3a6(_0x4de1fd){var _0x158919=0x2;var _0x55000a=[{'type':_0x4de1fd[_0x04fe('0x3')],'app':_0x04fe('0x4'),'appdata':_0x04fe('0x5')+_0x4de1fd[_0x04fe('0x3')],'context':_0x4de1fd['context'],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']},{'type':_0x4de1fd['type'],'app':_0x4de1fd[_0x04fe('0x7')]?_0x04fe('0x4'):_0x04fe('0x8'),'appdata':_0x4de1fd[_0x04fe('0x7')]?_0x04fe('0x9')+_0x4de1fd['alias']:'No\x20alias\x20set','context':_0x4de1fd[_0x04fe('0xa')],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']}];if(_0x4de1fd[_0x04fe('0x3')]===_0x04fe('0xb')){_0x55000a[_0x04fe('0xc')]({'type':_0x04fe('0xb'),'app':_0x04fe('0x4'),'appdata':_0x04fe('0xd')+_0x4de1fd['id'],'context':_0x4de1fd[_0x04fe('0xa')],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']});}_0x55000a[_0x04fe('0xc')]({'type':_0x4de1fd[_0x04fe('0x3')],'app':_0x04fe('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4de1fd['context'],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']},{'type':_0x4de1fd[_0x04fe('0x3')],'app':_0x04fe('0x4'),'appdata':_0x04fe('0xe'),'context':_0x4de1fd[_0x04fe('0xa')],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']},{'type':_0x4de1fd[_0x04fe('0x3')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4de1fd[_0x04fe('0xa')],'exten':_0x4de1fd[_0x04fe('0x6')],'priority':_0x158919++,'VoiceExtensionId':_0x4de1fd['id']});return _0x55000a;}function _0x128485(_0x477938){var _0x1e0cfd=0x2;var _0x443fe5=[{'type':_0x04fe('0xf'),'app':_0x04fe('0x4'),'appdata':_0x04fe('0x10'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':_0x477938['alias']?_0x04fe('0x4'):_0x04fe('0x8'),'appdata':_0x477938['alias']?_0x04fe('0x9')+_0x477938['alias']:_0x04fe('0x11'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':'outbound','app':_0x04fe('0x4'),'appdata':'CDR(destination)='+(_0x477938[_0x04fe('0x12')]?_0x04fe('0x13')+_0x477938[_0x04fe('0x12')]+'}':_0x04fe('0x14')),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':'Set','appdata':_0x04fe('0xd')+_0x477938['id'],'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938['exten'],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':_0x04fe('0x15'),'appdata':_0x04fe('0x16')+(_0x1e0cfd+0x2)+'):Goto('+(_0x1e0cfd+0x1)+')','context':_0x477938[_0x04fe('0xa')],'exten':_0x477938['exten'],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':'outbound','app':_0x04fe('0x4'),'appdata':_0x477938['cutdigits']?_0x04fe('0x17')+_0x477938[_0x04fe('0x12')]+'}':_0x04fe('0x18'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':'Set','appdata':_0x04fe('0x19'),'context':_0x477938['context'],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':_0x04fe('0x4'),'appdata':_0x04fe('0xe'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':_0x04fe('0x4'),'appdata':_0x04fe('0x1a'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':'Set','appdata':_0x04fe('0x1b')+_0x477938['id'],'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']}];if(_0x477938[_0x04fe('0x1c')](_0x04fe('0x1d'))&&_0x477938[_0x04fe('0x1d')]!==_0x04fe('0x1e')){_0x443fe5[_0x04fe('0xc')]({'type':'outbound','app':_0x04fe('0x4'),'appdata':_0x04fe('0x1f'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938[_0x04fe('0x6')],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']},{'type':_0x04fe('0xf'),'app':_0x04fe('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x477938[_0x04fe('0x1d')]||_0x04fe('0x20'),'context':_0x477938[_0x04fe('0xa')],'exten':_0x477938['exten'],'priority':_0x1e0cfd++,'VoiceExtensionId':_0x477938['id']});}return _0x443fe5;}function _0xaf7079(_0x4e5e6e,_0x8023e6){var _0x4fb3b1=[{'name':_0x04fe('0x21'),'param':0x0},{'name':_0x04fe('0x22'),'param':0x1},{'name':_0x04fe('0x23'),'param':0x2},{'name':_0x04fe('0x24'),'param':0x3}];var _0x810917={};var _0x377e0a=_0x8023e6[_0x04fe('0x25')](',');var _0x10f879=[];for(var _0x2cbe39=0x0;_0x2cbe39<_0x4fb3b1[_0x04fe('0x26')];_0x2cbe39++){switch(_0x4fb3b1[_0x2cbe39][_0x04fe('0x27')]){case'trunk':_0x810917['trunk']=_0x377e0a[_0x4fb3b1[_0x2cbe39][_0x04fe('0x28')]][_0x04fe('0x25')]('/')[0x1];_0x810917[_0x04fe('0x29')]=_0x377e0a[_0x4fb3b1[_0x2cbe39]['param']][_0x04fe('0x25')]('/')[0x2];_0x810917[_0x04fe('0x2a')]=_0x810917[_0x04fe('0x29')]?_0x810917['phone'][_0x04fe('0x25')]('$')[0x0]:undefined;_0x810917[_0x04fe('0x29')]=_0x4e5e6e['cutdigits']?(_0x810917[_0x04fe('0x2a')]||'')+_0x04fe('0x13')+_0x4e5e6e[_0x04fe('0x12')]+'}':(_0x810917[_0x04fe('0x2a')]||'')+_0x04fe('0x14');_0x10f879[_0x4fb3b1[_0x2cbe39][_0x04fe('0x28')]]=[_0x04fe('0x2b'),_0x810917[_0x04fe('0x21')],_0x810917[_0x04fe('0x29')]][_0x04fe('0x2c')]('/');break;case _0x04fe('0x23'):_0x810917['options']=_0x377e0a[_0x4fb3b1[_0x2cbe39][_0x04fe('0x28')]];if(_0x4e5e6e[_0x04fe('0x1d')]!==_0x04fe('0x1e')){if(_0x810917[_0x04fe('0x23')][_0x04fe('0x2d')]('U(xcally-mixmonitor-context)')<0x0){_0x810917[_0x04fe('0x23')]+=_0x04fe('0x2e');}}else{_0x810917[_0x04fe('0x23')]=_0x810917[_0x04fe('0x23')]['replace'](_0x04fe('0x2e'),'');}_0x10f879[_0x4fb3b1[_0x2cbe39]['param']]=_0x810917[_0x04fe('0x23')];break;default:_0x10f879[_0x4fb3b1[_0x2cbe39][_0x04fe('0x28')]]=_0x377e0a[_0x4fb3b1[_0x2cbe39][_0x04fe('0x28')]];}}return _0x10f879[_0x04fe('0x2c')](',');}function _0x518892(_0x5a2571,_0x5aa84c,_0x4cfeaa){return new Promise(function(_0x13dd0b,_0xc07dd3){var _0x5994b3=[];if(_['isEmpty'](_0x5aa84c))return _0x13dd0b(_0x5994b3);_0x3065e4[_0x04fe('0x2f')][_0x04fe('0x30')]({'attributes':['id',_0x04fe('0x31'),_0x04fe('0x32')],'raw':!![]})[_0x04fe('0x33')](function(_0x46ba06){for(var _0x24a41e=0x0,_0x34b9fa=0x0;_0x24a41e<_0x5aa84c[_0x04fe('0x26')];_0x24a41e++,_0x34b9fa=0x0){var _0x3d97cb=_0x5aa84c[_0x24a41e];var _0x34983d=[];var _0x4daedb=[];delete _0x3d97cb['id'];if(_0x3d97cb['interval']!==_0x04fe('0x34')){_0x3d97cb['intervals']=[_0x3d97cb[_0x04fe('0x31')]];}else{_0x3d97cb[_0x04fe('0x35')]=_0x3d97cb[_0x04fe('0x32')]?_[_0x04fe('0x36')](_[_0x04fe('0x37')](_0x46ba06,{'IntervalId':_0x3d97cb[_0x04fe('0x32')]}),_0x04fe('0x31')):[];}_0x3d97cb[_0x04fe('0xa')]=_0x5a2571[_0x04fe('0xa')];_0x3d97cb[_0x04fe('0x6')]=_0x5a2571['exten'];if(_0x3d97cb[_0x04fe('0x3')])_0x3d97cb[_0x04fe('0x3')]=_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')]();if(_0x5a2571['type']==='outbound'){if(_0x3d97cb[_0x04fe('0x1c')](_0x04fe('0x39'))&&_0x3d97cb[_0x04fe('0x39')]&&_0x3d97cb[_0x04fe('0x39')]!=='--'){_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')](),'app':_0x04fe('0x4'),'appdata':_0x04fe('0x3a')+_0x3d97cb['tag'],'context':_0x5a2571['context'],'exten':_0x5a2571['exten'],'priority':_0x3d97cb[_0x04fe('0x35')]['length']+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});}_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb['type']['toLowerCase'](),'app':_0x04fe('0x15'),'appdata':_0x04fe('0x3b')+(_0x3d97cb[_0x04fe('0x3c')]?'Set(CALLERID(all)='+_0x3d97cb['callerID']+')':_0x04fe('0x3d')),'context':_0x5a2571[_0x04fe('0xa')],'exten':_0x5a2571['exten'],'priority':_0x3d97cb['intervals'][_0x04fe('0x26')]+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});}else{if(_0x3d97cb[_0x04fe('0x1c')](_0x04fe('0x3e'))){if([_0x04fe('0x3f'),'playback'][_0x04fe('0x40')](_0x3d97cb['app']['toLowerCase']())&&_0x3d97cb[_0x04fe('0x41')]!==_0x04fe('0x42')){if(_0x3d97cb[_0x04fe('0x3e')]){_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')](),'app':'ExecIf','appdata':_0x04fe('0x43'),'context':_0x5a2571[_0x04fe('0xa')],'exten':_0x5a2571[_0x04fe('0x6')],'priority':_0x3d97cb['intervals'][_0x04fe('0x26')]+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')](),'app':'Set','appdata':_0x04fe('0x44'),'context':_0x5a2571[_0x04fe('0xa')],'exten':_0x5a2571[_0x04fe('0x6')],'priority':_0x3d97cb[_0x04fe('0x35')]['length']+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});}else{_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')](),'app':_0x04fe('0x15'),'appdata':_0x04fe('0x45'),'context':_0x5a2571[_0x04fe('0xa')],'exten':_0x5a2571[_0x04fe('0x6')],'priority':_0x3d97cb[_0x04fe('0x35')][_0x04fe('0x26')]+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});_0x34983d[_0x04fe('0xc')]({'type':_0x3d97cb[_0x04fe('0x3')][_0x04fe('0x38')](),'app':_0x04fe('0x4'),'appdata':_0x04fe('0x46'),'context':_0x5a2571['context'],'exten':_0x5a2571[_0x04fe('0x6')],'priority':_0x3d97cb[_0x04fe('0x35')][_0x04fe('0x26')]+_0x4cfeaa+_0x34b9fa++,'VoiceExtensionId':_0x5a2571['id']});}}}}for(var _0x5e34be=0x0;_0x5e34be<_0x3d97cb[_0x04fe('0x35')][_0x04fe('0x26')];_0x5e34be++){var _0x41b96e=_0x4cfeaa+_0x3d97cb['intervals'][_0x04fe('0x26')];var _0x1c5ea6=_0x5e34be===_0x3d97cb[_0x04fe('0x35')][_0x04fe('0x26')]-0x1?_0x4cfeaa+_0x34983d[_0x04fe('0x26')]+_0x4daedb['length']+0x2:_0x4cfeaa+_0x5e34be+0x1;_0x34983d['splice'](_0x5e34be,0x0,{'type':_0x5a2571[_0x04fe('0x3')],'app':_0x04fe('0x47'),'appdata':_0x3d97cb[_0x04fe('0x35')][_0x5e34be]+'?'+_0x5a2571['context']+_0x04fe('0x48')+_0x41b96e+':'+_0x5a2571[_0x04fe('0xa')]+',${EXTEN},'+_0x1c5ea6,'exten':_0x5a2571[_0x04fe('0x6')],'context':_0x5a2571[_0x04fe('0xa')],'priority':_0x4cfeaa+_0x5e34be,'VoiceExtensionId':_0x5a2571['id']});}if(_0x3d97cb[_0x04fe('0x41')]===_0x04fe('0x49'))_0x3d97cb['appdata']=_0xaf7079(_0x5a2571,_0x3d97cb[_0x04fe('0x4a')]);_0x3d97cb['priority']=_0x34983d[_0x04fe('0x26')]?_['last'](_0x34983d)[_0x04fe('0x4b')]+0x1:_0x4cfeaa;_0x5994b3=_['concat'](_0x5994b3,_0x34983d,[_0x3d97cb],_0x4daedb);_0x4cfeaa=_[_0x04fe('0x4c')](_0x5994b3)[_0x04fe('0x4b')]+0x1;}return _0x13dd0b(_0x5994b3);})[_0x04fe('0x4d')](function(_0x3223e3){_0xc07dd3(_0x3223e3);});});}return _0x17f3c8[_0x04fe('0x4e')](_0x04fe('0x4f'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x49ccf1){var _0x42472d=this[_0x04fe('0x50')]({'plain':!![]});var _0x2363f9=_0x42472d[_0x04fe('0x3')]===_0x04fe('0xf')?_0x128485(_0x42472d):_0x22f3a6(_0x42472d);return _0x518892(_0x42472d,_0x49ccf1,_[_0x04fe('0x4c')](_0x2363f9)['priority']+0x1)['then'](function(_0xf3a6cd){var _0x4f7d4f=_[_0x04fe('0x51')](_0x2363f9,_0xf3a6cd);_0x4f7d4f[_0x04fe('0xc')]({'type':_0x42472d['type'],'app':'Hangup','exten':_0x42472d[_0x04fe('0x6')],'context':_0x42472d['context'],'priority':_[_0x04fe('0x4c')](_0x4f7d4f)['priority']+0x1,'VoiceExtensionId':_0x42472d['id']});return _0x4f7d4f;});}}});}; \ No newline at end of file +var _0x44fd=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','name','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','length','*,*,*,*','intervals','IntervalId','interval','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','voice_extensions','last','Hangup','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','No\x20alias\x20set','inbound','push','CDR(routeid)='];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x44fd,0x123));var _0xd44f=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0x44fd[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0xd44f('0x0')]=function(_0x30c753){var _0x458bea=_0x30c753[_0xd44f('0x1')];function _0x4bc9a1(_0x204971){var _0x5ca990=0x2;var _0xbcb976=[{'type':_0x204971[_0xd44f('0x2')],'app':_0xd44f('0x3'),'appdata':_0xd44f('0x4')+_0x204971[_0xd44f('0x2')],'context':_0x204971[_0xd44f('0x5')],'exten':_0x204971[_0xd44f('0x6')],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']},{'type':_0x204971[_0xd44f('0x2')],'app':_0x204971['alias']?_0xd44f('0x3'):_0xd44f('0x7'),'appdata':_0x204971[_0xd44f('0x8')]?'CDR(routeAlias)='+_0x204971[_0xd44f('0x8')]:_0xd44f('0x9'),'context':_0x204971['context'],'exten':_0x204971[_0xd44f('0x6')],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']}];if(_0x204971[_0xd44f('0x2')]===_0xd44f('0xa')){_0xbcb976[_0xd44f('0xb')]({'type':_0xd44f('0xa'),'app':'Set','appdata':_0xd44f('0xc')+_0x204971['id'],'context':_0x204971[_0xd44f('0x5')],'exten':_0x204971[_0xd44f('0x6')],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']});}_0xbcb976['push']({'type':_0x204971[_0xd44f('0x2')],'app':_0xd44f('0x3'),'appdata':_0xd44f('0xd'),'context':_0x204971[_0xd44f('0x5')],'exten':_0x204971['exten'],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']},{'type':_0x204971[_0xd44f('0x2')],'app':_0xd44f('0x3'),'appdata':_0xd44f('0xe'),'context':_0x204971['context'],'exten':_0x204971['exten'],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']},{'type':_0x204971[_0xd44f('0x2')],'app':_0xd44f('0x3'),'appdata':_0xd44f('0xf'),'context':_0x204971[_0xd44f('0x5')],'exten':_0x204971['exten'],'priority':_0x5ca990++,'VoiceExtensionId':_0x204971['id']});return _0xbcb976;}function _0x40a12d(_0x1b63ab){var _0x5b392b=0x2;var _0x4f31f1=[{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0x11'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0x1b63ab[_0xd44f('0x8')]?'Set':'NoOp','appdata':_0x1b63ab[_0xd44f('0x8')]?'CDR(routeAlias)='+_0x1b63ab['alias']:_0xd44f('0x9'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0x12')+(_0x1b63ab['cutdigits']?_0xd44f('0x13')+_0x1b63ab[_0xd44f('0x14')]+'}':_0xd44f('0x15')),'context':_0x1b63ab['context'],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':'Set','appdata':_0xd44f('0xc')+_0x1b63ab['id'],'context':_0x1b63ab['context'],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x16'),'appdata':_0xd44f('0x17')+(_0x5b392b+0x2)+'):Goto('+(_0x5b392b+0x1)+')','context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab['exten'],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0x1b63ab[_0xd44f('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x1b63ab[_0xd44f('0x14')]+'}':_0xd44f('0x18'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab['exten'],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0xd'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0xe'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab['exten'],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':'outbound','app':_0xd44f('0x3'),'appdata':_0xd44f('0xf'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab['exten'],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':'Set','appdata':_0xd44f('0x19')+_0x1b63ab['id'],'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']}];if(_0x1b63ab[_0xd44f('0x1a')](_0xd44f('0x1b'))&&_0x1b63ab[_0xd44f('0x1b')]!==_0xd44f('0x1c')){_0x4f31f1[_0xd44f('0xb')]({'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0x1d'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab[_0xd44f('0x6')],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']},{'type':_0xd44f('0x10'),'app':_0xd44f('0x3'),'appdata':_0xd44f('0x1e')+_0x1b63ab[_0xd44f('0x1b')]||_0xd44f('0x1f'),'context':_0x1b63ab[_0xd44f('0x5')],'exten':_0x1b63ab['exten'],'priority':_0x5b392b++,'VoiceExtensionId':_0x1b63ab['id']});}return _0x4f31f1;}function _0x427493(_0x23bda7,_0x2a5d48){var _0x12a98b=[{'name':_0xd44f('0x20'),'param':0x0},{'name':_0xd44f('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x7a04ae={};var _0x3111f3=_0x2a5d48[_0xd44f('0x22')](',');var _0xeba581=[];for(var _0x2edf37=0x0;_0x2edf37<_0x12a98b['length'];_0x2edf37++){switch(_0x12a98b[_0x2edf37][_0xd44f('0x23')]){case _0xd44f('0x20'):_0x7a04ae[_0xd44f('0x20')]=_0x3111f3[_0x12a98b[_0x2edf37][_0xd44f('0x24')]][_0xd44f('0x22')]('/')[0x1];_0x7a04ae[_0xd44f('0x25')]=_0x3111f3[_0x12a98b[_0x2edf37][_0xd44f('0x24')]][_0xd44f('0x22')]('/')[0x2];_0x7a04ae['prefix']=_0x7a04ae['phone']?_0x7a04ae[_0xd44f('0x25')][_0xd44f('0x22')]('$')[0x0]:undefined;_0x7a04ae[_0xd44f('0x25')]=_0x23bda7[_0xd44f('0x14')]?(_0x7a04ae['prefix']||'')+'${EXTEN:'+_0x23bda7[_0xd44f('0x14')]+'}':(_0x7a04ae[_0xd44f('0x26')]||'')+_0xd44f('0x15');_0xeba581[_0x12a98b[_0x2edf37][_0xd44f('0x24')]]=[_0xd44f('0x27'),_0x7a04ae[_0xd44f('0x20')],_0x7a04ae[_0xd44f('0x25')]][_0xd44f('0x28')]('/');break;case _0xd44f('0x29'):_0x7a04ae[_0xd44f('0x29')]=_0x3111f3[_0x12a98b[_0x2edf37][_0xd44f('0x24')]];if(_0x23bda7[_0xd44f('0x1b')]!==_0xd44f('0x1c')){if(_0x7a04ae['options'][_0xd44f('0x2a')](_0xd44f('0x2b'))<0x0){_0x7a04ae[_0xd44f('0x29')]+='U(xcally-mixmonitor-context)';}}else{_0x7a04ae[_0xd44f('0x29')]=_0x7a04ae[_0xd44f('0x29')]['replace'](_0xd44f('0x2b'),'');}_0xeba581[_0x12a98b[_0x2edf37]['param']]=_0x7a04ae[_0xd44f('0x29')];break;default:_0xeba581[_0x12a98b[_0x2edf37][_0xd44f('0x24')]]=_0x3111f3[_0x12a98b[_0x2edf37]['param']];}}return _0xeba581[_0xd44f('0x28')](',');}function _0x295372(_0x29c033,_0x5a4f6a,_0x32346c){return new Promise(function(_0xe77e8c,_0x548f2d){var _0x4403e8=[];if(_[_0xd44f('0x2c')](_0x5a4f6a))return _0xe77e8c(_0x4403e8);_0x458bea['Interval'][_0xd44f('0x2d')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xd44f('0x2e')](function(_0x4e3451){for(var _0x44b526=0x0,_0xb71d53=0x0;_0x44b526<_0x5a4f6a[_0xd44f('0x2f')];_0x44b526++,_0xb71d53=0x0){var _0xff4761=_0x5a4f6a[_0x44b526];var _0x3a9062=[];var _0x9290ee=[];delete _0xff4761['id'];if(_0xff4761['interval']!==_0xd44f('0x30')){_0xff4761[_0xd44f('0x31')]=[_0xff4761['interval']];}else{_0xff4761['intervals']=_0xff4761[_0xd44f('0x32')]?_['map'](_['filter'](_0x4e3451,{'IntervalId':_0xff4761[_0xd44f('0x32')]}),_0xd44f('0x33')):[];}_0xff4761[_0xd44f('0x5')]=_0x29c033['context'];_0xff4761[_0xd44f('0x6')]=_0x29c033[_0xd44f('0x6')];if(_0xff4761[_0xd44f('0x2')])_0xff4761[_0xd44f('0x2')]=_0xff4761[_0xd44f('0x2')][_0xd44f('0x34')]();if(_0x29c033['type']===_0xd44f('0x10')){if(_0xff4761['hasOwnProperty']('tag')&&_0xff4761[_0xd44f('0x35')]&&_0xff4761[_0xd44f('0x35')]!=='--'){_0x3a9062[_0xd44f('0xb')]({'type':_0xff4761[_0xd44f('0x2')][_0xd44f('0x34')](),'app':_0xd44f('0x3'),'appdata':'CDR(tag)='+_0xff4761['tag'],'context':_0x29c033[_0xd44f('0x5')],'exten':_0x29c033['exten'],'priority':_0xff4761[_0xd44f('0x31')][_0xd44f('0x2f')]+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});}_0x3a9062[_0xd44f('0xb')]({'type':_0xff4761[_0xd44f('0x2')][_0xd44f('0x34')](),'app':_0xd44f('0x16'),'appdata':_0xd44f('0x36')+(_0xff4761[_0xd44f('0x37')]?'Set(CALLERID(all)='+_0xff4761[_0xd44f('0x37')]+')':_0xd44f('0x38')),'context':_0x29c033[_0xd44f('0x5')],'exten':_0x29c033['exten'],'priority':_0xff4761[_0xd44f('0x31')][_0xd44f('0x2f')]+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});}else{if(_0xff4761[_0xd44f('0x1a')](_0xd44f('0x39'))){if([_0xd44f('0x3a'),_0xd44f('0x3b')]['includes'](_0xff4761[_0xd44f('0x3c')]['toLowerCase']())&&_0xff4761[_0xd44f('0x3d')]!==_0xd44f('0x3e')){if(_0xff4761['answer']){_0x3a9062[_0xd44f('0xb')]({'type':_0xff4761[_0xd44f('0x2')][_0xd44f('0x34')](),'app':_0xd44f('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x29c033[_0xd44f('0x5')],'exten':_0x29c033['exten'],'priority':_0xff4761['intervals'][_0xd44f('0x2f')]+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});_0x3a9062[_0xd44f('0xb')]({'type':_0xff4761['type']['toLowerCase'](),'app':'Set','appdata':_0xd44f('0x3f'),'context':_0x29c033['context'],'exten':_0x29c033[_0xd44f('0x6')],'priority':_0xff4761[_0xd44f('0x31')][_0xd44f('0x2f')]+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});}else{_0x3a9062['push']({'type':_0xff4761[_0xd44f('0x2')][_0xd44f('0x34')](),'app':_0xd44f('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x29c033[_0xd44f('0x5')],'exten':_0x29c033['exten'],'priority':_0xff4761[_0xd44f('0x31')][_0xd44f('0x2f')]+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});_0x3a9062['push']({'type':_0xff4761['type'][_0xd44f('0x34')](),'app':_0xd44f('0x3'),'appdata':_0xd44f('0x40'),'context':_0x29c033[_0xd44f('0x5')],'exten':_0x29c033[_0xd44f('0x6')],'priority':_0xff4761[_0xd44f('0x31')]['length']+_0x32346c+_0xb71d53++,'VoiceExtensionId':_0x29c033['id']});}}}}for(var _0x305811=0x0;_0x305811<_0xff4761['intervals'][_0xd44f('0x2f')];_0x305811++){var _0x581af5=_0x32346c+_0xff4761[_0xd44f('0x31')]['length'];var _0x2ef971=_0x305811===_0xff4761[_0xd44f('0x31')][_0xd44f('0x2f')]-0x1?_0x32346c+_0x3a9062[_0xd44f('0x2f')]+_0x9290ee[_0xd44f('0x2f')]+0x2:_0x32346c+_0x305811+0x1;_0x3a9062['splice'](_0x305811,0x0,{'type':_0x29c033['type'],'app':_0xd44f('0x41'),'appdata':_0xff4761[_0xd44f('0x31')][_0x305811]+'?'+_0x29c033[_0xd44f('0x5')]+_0xd44f('0x42')+_0x581af5+':'+_0x29c033[_0xd44f('0x5')]+_0xd44f('0x42')+_0x2ef971,'exten':_0x29c033['exten'],'context':_0x29c033[_0xd44f('0x5')],'priority':_0x32346c+_0x305811,'VoiceExtensionId':_0x29c033['id']});}if(_0xff4761[_0xd44f('0x3d')]===_0xd44f('0x43'))_0xff4761[_0xd44f('0x44')]=_0x427493(_0x29c033,_0xff4761['appdata']);_0xff4761[_0xd44f('0x45')]=_0x3a9062[_0xd44f('0x2f')]?_['last'](_0x3a9062)[_0xd44f('0x45')]+0x1:_0x32346c;_0x4403e8=_[_0xd44f('0x46')](_0x4403e8,_0x3a9062,[_0xff4761],_0x9290ee);_0x32346c=_['last'](_0x4403e8)['priority']+0x1;}return _0xe77e8c(_0x4403e8);})[_0xd44f('0x47')](function(_0x25c4e0){_0x548f2d(_0x25c4e0);});});}return _0x30c753[_0xd44f('0x48')]('VoiceExtension',attributes,{'tableName':_0xd44f('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2c9381){var _0x563aed=this['get']({'plain':!![]});var _0x574869=_0x563aed[_0xd44f('0x2')]===_0xd44f('0x10')?_0x40a12d(_0x563aed):_0x4bc9a1(_0x563aed);return _0x295372(_0x563aed,_0x2c9381,_[_0xd44f('0x4a')](_0x574869)[_0xd44f('0x45')]+0x1)[_0xd44f('0x2e')](function(_0x10250f){var _0xf447fc=_[_0xd44f('0x46')](_0x574869,_0x10250f);_0xf447fc[_0xd44f('0xb')]({'type':_0x563aed['type'],'app':_0xd44f('0x4b'),'exten':_0x563aed[_0xd44f('0x6')],'context':_0x563aed['context'],'priority':_[_0xd44f('0x4a')](_0xf447fc)['priority']+0x1,'VoiceExtensionId':_0x563aed['id']});return _0xf447fc;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7f17f14..1f80bc9 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 _0x3eea=['jayson/promise','client','defaults','localhost','redis','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43ca62,_0x19d4ba){var _0x3ae462=function(_0x715f87){while(--_0x715f87){_0x43ca62['push'](_0x43ca62['shift']());}};_0x3ae462(++_0x19d4ba);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x47359b,_0x41b6e2){_0x47359b=_0x47359b-0x0;var _0x3c4072=_0x3eea[_0x47359b];return _0x3c4072;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});config['redis']=_[_0xa3ee('0xc')](config['redis'],{'host':_0xa3ee('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0xe')]));require('./voiceExtension.socket')[_0xa3ee('0xf')](socket);function respondWithRpcPromise(_0x5ef236,_0x28aeb1,_0x1a3ab0){return new BPromise(function(_0x188966,_0x50f5e6){return client[_0xa3ee('0x10')](_0x5ef236,_0x1a3ab0)[_0xa3ee('0x11')](function(_0x4dc361){logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));logger[_0xa3ee('0x14')](_0xa3ee('0x15'),_0x28aeb1,'request\x20sent',JSON[_0xa3ee('0x16')](_0x4dc361));if(_0x4dc361['error']){if(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x18')]===0x1f4){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4dc361['error'][_0xa3ee('0x19')]);return _0x50f5e6(_0x4dc361[_0xa3ee('0x17')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x28aeb1,_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);return _0x188966(_0x4dc361[_0xa3ee('0x17')][_0xa3ee('0x19')]);}else{logger['info'](_0xa3ee('0x12'),_0x28aeb1,_0xa3ee('0x13'));_0x188966(_0x4dc361[_0xa3ee('0x1a')][_0xa3ee('0x19')]);}})[_0xa3ee('0x1b')](function(_0x4aac0e){logger[_0xa3ee('0x17')](_0xa3ee('0x12'),_0x28aeb1,_0x4aac0e);_0x50f5e6(_0x4aac0e);});});}exports[_0xa3ee('0x1c')]=function(_0xad8187){var _0x216b7d=this;return new Promise(function(_0x3195a7,_0x4f8c56){return db[_0xa3ee('0x1d')][_0xa3ee('0x1e')]({'raw':_0xad8187['options']?_0xad8187[_0xa3ee('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xad8187[_0xa3ee('0x1f')]?_0xad8187[_0xa3ee('0x1f')][_0xa3ee('0x20')]||null:null,'attributes':_0xad8187[_0xa3ee('0x1f')]?_0xad8187[_0xa3ee('0x1f')][_0xa3ee('0x21')]||null:null,'limit':_0xad8187[_0xa3ee('0x1f')]?_0xad8187[_0xa3ee('0x1f')][_0xa3ee('0x22')]||null:null,'include':_0xad8187[_0xa3ee('0x1f')]?_0xad8187['options'][_0xa3ee('0x23')]?_[_0xa3ee('0x24')](_0xad8187[_0xa3ee('0x1f')][_0xa3ee('0x23')],function(_0x2c48db){return{'model':db[_0x2c48db['model']],'as':_0x2c48db['as'],'attributes':_0x2c48db[_0xa3ee('0x21')],'include':_0x2c48db[_0xa3ee('0x23')]?_[_0xa3ee('0x24')](_0x2c48db[_0xa3ee('0x23')],function(_0x42e97c){return{'model':db[_0x42e97c[_0xa3ee('0x25')]],'as':_0x42e97c['as'],'attributes':_0x42e97c[_0xa3ee('0x21')],'include':_0x42e97c[_0xa3ee('0x23')]?_[_0xa3ee('0x24')](_0x42e97c[_0xa3ee('0x23')],function(_0x59c6f9){return{'model':db[_0x59c6f9['model']],'as':_0x59c6f9['as'],'attributes':_0x59c6f9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa3ee('0x11')](function(_0x481358){logger[_0xa3ee('0x26')](_0xa3ee('0x1c'),_0xad8187);logger[_0xa3ee('0x14')](_0xa3ee('0x1c'),_0xad8187,JSON[_0xa3ee('0x16')](_0x481358));_0x3195a7(_0x481358);})[_0xa3ee('0x1b')](function(_0x30ba4e){logger[_0xa3ee('0x17')](_0xa3ee('0x1c'),_0x30ba4e[_0xa3ee('0x19')],_0xad8187);_0x4f8c56(_0x216b7d['error'](0x1f4,_0x30ba4e[_0xa3ee('0x19')]));});});}; \ No newline at end of file +var _0xe2bc=['../../config/environment','jayson/promise','client','http','redis','localhost','./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','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe2bc[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var moment=require(_0xce2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce2b('0x2'));var fs=require('fs');var Redis=require(_0xce2b('0x3'));var db=require(_0xce2b('0x4'))['db'];var utils=require(_0xce2b('0x5'));var logger=require(_0xce2b('0x6'))('rpc');var config=require(_0xce2b('0x7'));var jayson=require(_0xce2b('0x8'));var client=jayson[_0xce2b('0x9')][_0xce2b('0xa')]({'port':0x232a});config[_0xce2b('0xb')]=_['defaults'](config[_0xce2b('0xb')],{'host':_0xce2b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce2b('0xb')]));require(_0xce2b('0xd'))[_0xce2b('0xe')](socket);function respondWithRpcPromise(_0x3786aa,_0x1e5036,_0xc6cdb){return new BPromise(function(_0x3eae6d,_0xa7941){return client[_0xce2b('0xf')](_0x3786aa,_0xc6cdb)[_0xce2b('0x10')](function(_0x47a597){logger[_0xce2b('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1e5036,_0xce2b('0x12'));logger[_0xce2b('0x13')](_0xce2b('0x14'),_0x1e5036,_0xce2b('0x12'),JSON[_0xce2b('0x15')](_0x47a597));if(_0x47a597[_0xce2b('0x16')]){if(_0x47a597[_0xce2b('0x16')][_0xce2b('0x17')]===0x1f4){logger['error'](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0xa7941(_0x47a597['error']['message']);}logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0x3eae6d(_0x47a597['error'][_0xce2b('0x19')]);}else{logger[_0xce2b('0x11')](_0xce2b('0x18'),_0x1e5036,_0xce2b('0x12'));_0x3eae6d(_0x47a597[_0xce2b('0x1a')][_0xce2b('0x19')]);}})[_0xce2b('0x1b')](function(_0x31316d){logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x31316d);_0xa7941(_0x31316d);});});}exports['GetVoiceExtension']=function(_0x192002){var _0x1d888c=this;return new Promise(function(_0x167e55,_0x44c2af){return db[_0xce2b('0x1c')][_0xce2b('0x1d')]({'raw':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x1f')]===undefined?!![]:![]:!![],'where':_0x192002[_0xce2b('0x1e')]?_0x192002['options'][_0xce2b('0x20')]||null:null,'attributes':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x21')]||null:null,'limit':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x22')]||null:null,'include':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x192002['options']['include'],function(_0x527b03){return{'model':db[_0x527b03[_0xce2b('0x25')]],'as':_0x527b03['as'],'attributes':_0x527b03['attributes'],'include':_0x527b03[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x527b03['include'],function(_0x60eca0){return{'model':db[_0x60eca0[_0xce2b('0x25')]],'as':_0x60eca0['as'],'attributes':_0x60eca0['attributes'],'include':_0x60eca0[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x60eca0[_0xce2b('0x23')],function(_0x50a62f){return{'model':db[_0x50a62f['model']],'as':_0x50a62f['as'],'attributes':_0x50a62f[_0xce2b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce2b('0x10')](function(_0x211b88){logger['info']('GetVoiceExtension',_0x192002);logger[_0xce2b('0x13')](_0xce2b('0x26'),_0x192002,JSON[_0xce2b('0x15')](_0x211b88));_0x167e55(_0x211b88);})['catch'](function(_0x3a8c00){logger[_0xce2b('0x16')](_0xce2b('0x26'),_0x3a8c00[_0xce2b('0x19')],_0x192002);_0x44c2af(_0x1d888c[_0xce2b('0x16')](0x1f4,_0x3a8c00[_0xce2b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0b083fc..688d8b5 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x131950,_0x2c837c){var _0xce6737=function(_0xb3ed48){while(--_0xb3ed48){_0x131950['push'](_0x131950['shift']());}};_0xce6737(++_0x2c837c);}(_0xe14b,0x93));var _0xbe14=function(_0xbf3b83,_0x2d1b3e){_0xbf3b83=_0xbf3b83-0x0;var _0x15848f=_0xe14b[_0xbf3b83];return _0x15848f;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1cb9,0x14e));var _0x91cb=function(_0x489af4,_0x2dfb71){_0x489af4=_0x489af4-0x0;var _0x464276=_0x1cb9[_0x489af4];return _0x464276;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7e3a9b4..5a75c09 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 _0x6050=['/:id/messages','isAuthenticated','getMessages','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','get'];(function(_0x2ceae3,_0x2caeea){var _0xabb5a4=function(_0x7428f1){while(--_0x7428f1){_0x2ceae3['push'](_0x2ceae3['shift']());}};_0xabb5a4(++_0x2caeea);}(_0x6050,0x196));var _0x0605=function(_0x214914,_0x599809){_0x214914=_0x214914-0x0;var _0xfea824=_0x6050[_0x214914];return _0xfea824;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['post']('/',auth[_0x0605('0xd')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0x13')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);module[_0x0605('0x15')]=router; \ No newline at end of file +var _0xf61e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','show','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x434ee3,_0x1d15d3){var _0x30d50b=function(_0x4bfe41){while(--_0x4bfe41){_0x434ee3['push'](_0x434ee3['shift']());}};_0x30d50b(++_0x1d15d3);}(_0xf61e,0x191));var _0xef61=function(_0x591a9b,_0x4a9509){_0x591a9b=_0x591a9b-0x0;var _0x4e264c=_0xf61e[_0x591a9b];return _0x4e264c;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/:id',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0x12')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);router[_0xef61('0x15')](_0xef61('0x13'),auth[_0xef61('0xd')](),controller[_0xef61('0x16')]);module[_0xef61('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 41a7306..a146655 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 _0xc240=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','central','yes','ENUM','TINYINT(4)','INTEGER','fullname','getDataValue'];(function(_0x29eb79,_0x54e411){var _0x44e7d5=function(_0x1dcea9){while(--_0x1dcea9){_0x29eb79['push'](_0x29eb79['shift']());}};_0x44e7d5(++_0x54e411);}(_0xc240,0x181));var _0x0c24=function(_0x4bb265,_0x5a3252){_0x4bb265=_0x4bb265-0x0;var _0x33430a=_0xc240[_0x4bb265];return _0x33430a;};'use strict';var Sequelize=require(_0x0c24('0x0'));module[_0x0c24('0x1')]={'customer_id':{'type':Sequelize[_0x0c24('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x0c24('0x3'),'unique':_0x0c24('0x4')},'mailbox':{'type':Sequelize[_0x0c24('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0c24('0x2')]},'fullname':{'type':Sequelize[_0x0c24('0x2')]},'email':{'type':Sequelize[_0x0c24('0x2')],'validate':{'isEmail':!![]},'set':function(_0xfbd30e){this[_0x0c24('0x5')](_0x0c24('0x6'),typeof _0xfbd30e===_0x0c24('0x7')&&_0xfbd30e['trim']()?_0xfbd30e['trim']():null);}},'pager':{'type':Sequelize[_0x0c24('0x2')]},'tz':{'type':Sequelize[_0x0c24('0x2')],'defaultValue':_0x0c24('0x8')},'attach':{'type':Sequelize['ENUM'](_0x0c24('0x9'),'no'),'defaultValue':_0x0c24('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0c24('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0c24('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0c24('0xa')](_0x0c24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0c24('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x0c24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0c24('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0c24('0xa')](_0x0c24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0c24('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0c24('0xa')](_0x0c24('0x9'),'no'),'defaultValue':_0x0c24('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0c24('0xa')](_0x0c24('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0c24('0xa')](_0x0c24('0x9'),'no'),'defaultValue':_0x0c24('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x0c24('0x2')]},'maxsecs':{'type':Sequelize[_0x0c24('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0c24('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x0c24('0xd'))+'\x20-\x20'+this[_0x0c24('0xe')](_0x0c24('0xf'));}}}; \ No newline at end of file +var _0xea3b=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL'];(function(_0x59e98e,_0x5dbdcf){var _0x355db2=function(_0x502e07){while(--_0x502e07){_0x59e98e['push'](_0x59e98e['shift']());}};_0x355db2(++_0x5dbdcf);}(_0xea3b,0x89));var _0xbea3=function(_0x24106c,_0x367a6f){_0x24106c=_0x24106c-0x0;var _0xbaeb73=_0xea3b[_0x24106c];return _0xbaeb73;};'use strict';var Sequelize=require(_0xbea3('0x0'));module[_0xbea3('0x1')]={'customer_id':{'type':Sequelize[_0xbea3('0x2')]},'context':{'type':Sequelize[_0xbea3('0x2')],'defaultValue':_0xbea3('0x3'),'unique':_0xbea3('0x4')},'mailbox':{'type':Sequelize[_0xbea3('0x2')],'defaultValue':'','allowNull':![],'unique':_0xbea3('0x4')},'password':{'type':Sequelize[_0xbea3('0x2')]},'fullname':{'type':Sequelize[_0xbea3('0x2')]},'email':{'type':Sequelize[_0xbea3('0x2')],'validate':{'isEmail':!![]},'set':function(_0xb499ce){this[_0xbea3('0x5')](_0xbea3('0x6'),typeof _0xb499ce===_0xbea3('0x7')&&_0xb499ce[_0xbea3('0x8')]()?_0xb499ce[_0xbea3('0x8')]():null);}},'pager':{'type':Sequelize[_0xbea3('0x2')]},'tz':{'type':Sequelize[_0xbea3('0x2')],'defaultValue':_0xbea3('0x9')},'attach':{'type':Sequelize['ENUM'](_0xbea3('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xbea3('0x2')]},'review':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xbea3('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbea3('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':_0xbea3('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xbea3('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbea3('0xb')](_0xbea3('0xa'),'no'),'defaultValue':_0xbea3('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xbea3('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xbea3('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xbea3('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xbea3('0xe')],'get':function(){return this[_0xbea3('0xf')](_0xbea3('0x10'))+_0xbea3('0x11')+this['getDataValue'](_0xbea3('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1a941a3..535e695 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 _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x92a083,_0x35783f){var _0xf9718a=function(_0x486738){while(--_0x486738){_0x92a083['push'](_0x92a083['shift']());}};_0xf9718a(++_0x35783f);}(_0x34b7,0x196));var _0x734b=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0x34b7[_0x1f3c56];return _0x569524;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0xb688=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','filter','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','get','Voicemails','end','error','name','send','index','map','VoiceMail'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb688,0xcf));var _0x8b68=function(_0x41e34b,_0x3f05bc){_0x41e34b=_0x41e34b-0x0;var _0x5dca27=_0xb688[_0x41e34b];return _0x5dca27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){var _0x4ca77d=_0x59bb8a[_0x8b68('0x27')]({'plain':!![]});var _0x3cf8d2=_0x8b68('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3cf8d2,'resourceId':_0x4ca77d['id']}})['then'](function(){return _0x59bb8a;});})[_0x8b68('0x25')](function(){_0x32ddc5[_0x8b68('0x1c')](0xcc)[_0x8b68('0x29')]();});}};}function handleEntityNotFound(_0x583476,_0x3311c7){return function(_0x53aaa2){if(!_0x53aaa2){_0x583476['sendStatus'](0x194);}return _0x53aaa2;};}function handleError(_0x3865ea,_0x59b3ce){_0x59b3ce=_0x59b3ce||0x1f4;return function(_0x26cad7){logger[_0x8b68('0x2a')](_0x26cad7['stack']);if(_0x26cad7['name']){delete _0x26cad7[_0x8b68('0x2b')];}_0x3865ea[_0x8b68('0x1c')](_0x59b3ce)[_0x8b68('0x2c')](_0x26cad7);};}exports[_0x8b68('0x2d')]=function(_0x210926,_0x2ad2df){var _0x460c37={},_0x5b7ed1={},_0x3b6d1b={'count':0x0,'rows':[]};var _0x50a1e9=_[_0x8b68('0x2e')](db[_0x8b68('0x2f')]['rawAttributes'],function(_0x216aa6){return{'name':_0x216aa6[_0x8b68('0x30')],'type':_0x216aa6[_0x8b68('0x31')]['key']};});_0x5b7ed1['model']=_[_0x8b68('0x2e')](_0x50a1e9,_0x8b68('0x2b'));_0x5b7ed1[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x210926[_0x8b68('0x32')]);_0x5b7ed1[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],_0x5b7ed1[_0x8b68('0x32')]);_0x460c37[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x5b7ed1[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x210926[_0x8b68('0x32')][_0x8b68('0x38')]));_0x460c37[_0x8b68('0x37')]=_0x460c37[_0x8b68('0x37')][_0x8b68('0x39')]?_0x460c37[_0x8b68('0x37')]:_0x5b7ed1[_0x8b68('0x36')];if(!_0x210926[_0x8b68('0x32')][_0x8b68('0x3a')]('nolimit')){_0x460c37['limit']=qs[_0x8b68('0x1f')](_0x210926[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x460c37[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x210926[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x460c37[_0x8b68('0x3b')]=qs['sort'](_0x210926[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x460c37[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x210926[_0x8b68('0x32')],_0x5b7ed1[_0x8b68('0x34')]),_0x50a1e9);if(_0x210926[_0x8b68('0x32')]['filter']){_0x460c37[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x460c37[_0x8b68('0x3d')],{'$or':_[_0x8b68('0x2e')](_0x50a1e9,function(_0x3ecc60){if(_0x3ecc60[_0x8b68('0x31')]!==_0x8b68('0x40')){var _0x50a9c6={};_0x50a9c6[_0x3ecc60[_0x8b68('0x2b')]]={'$like':'%'+_0x210926[_0x8b68('0x32')]['filter']+'%'};return _0x50a9c6;}})});}_0x460c37=_[_0x8b68('0x3f')]({},_0x460c37,_0x210926[_0x8b68('0x41')]);var _0x50b2f1={'where':_0x460c37['where']};return db['VoiceMail']['count'](_0x50b2f1)[_0x8b68('0x25')](function(_0x23d24a){_0x3b6d1b['count']=_0x23d24a;if(_0x210926[_0x8b68('0x32')]['includeAll']){_0x460c37[_0x8b68('0x42')]=[{'all':!![]}];}return db[_0x8b68('0x2f')]['findAll'](_0x460c37);})[_0x8b68('0x25')](function(_0x5ae345){_0x3b6d1b['rows']=_0x5ae345;return _0x3b6d1b;})['then'](respondWithFilteredResult(_0x2ad2df,_0x460c37))[_0x8b68('0x43')](handleError(_0x2ad2df,null));};exports[_0x8b68('0x44')]=function(_0x3ba80e,_0xa70f60){var _0x50e425={'raw':!![],'where':{'id':_0x3ba80e['params']['id']}},_0x20162a={};_0x20162a[_0x8b68('0x36')]=_[_0x8b68('0x33')](db['VoiceMail'][_0x8b68('0x45')]);_0x20162a[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3ba80e[_0x8b68('0x32')]);_0x20162a['filters']=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],_0x20162a[_0x8b68('0x32')]);_0x50e425[_0x8b68('0x37')]=_[_0x8b68('0x35')](_0x20162a[_0x8b68('0x36')],qs[_0x8b68('0x38')](_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x50e425[_0x8b68('0x37')]=_0x50e425[_0x8b68('0x37')][_0x8b68('0x39')]?_0x50e425[_0x8b68('0x37')]:_0x20162a[_0x8b68('0x36')];if(_0x3ba80e[_0x8b68('0x32')][_0x8b68('0x46')]){_0x50e425['include']=[{'all':!![]}];}_0x50e425=_[_0x8b68('0x3f')]({},_0x50e425,_0x3ba80e[_0x8b68('0x41')]);return db['VoiceMail'][_0x8b68('0x47')](_0x50e425)['then'](handleEntityNotFound(_0xa70f60,null))['then'](respondWithResult(_0xa70f60,null))['catch'](handleError(_0xa70f60,null));};exports[_0x8b68('0x48')]=function(_0x35874b,_0x34047c){return db[_0x8b68('0x2f')]['create'](_0x35874b['body'],{})[_0x8b68('0x25')](function(_0x163fd5){var _0x1e900f=_0x35874b['user'][_0x8b68('0x27')]({'plain':!![]});if(!_0x1e900f)throw new Error(_0x8b68('0x49'));if(_0x1e900f['role']===_0x8b68('0x4a')){var _0xacac82=_0x163fd5['get']({'plain':!![]});var _0x18a9ae=_0x8b68('0x28');return db['UserProfileSection'][_0x8b68('0x47')]({'where':{'name':_0x18a9ae,'userProfileId':_0x1e900f[_0x8b68('0x4b')]},'raw':!![]})['then'](function(_0x543d74){if(_0x543d74&&_0x543d74['autoAssociation']===0x0){return db[_0x8b68('0x4c')][_0x8b68('0x48')]({'name':_0xacac82[_0x8b68('0x2b')],'resourceId':_0xacac82['id'],'type':_0x543d74[_0x8b68('0x2b')],'sectionId':_0x543d74['id']},{})['then'](function(){return _0x163fd5;});}else{return _0x163fd5;}})['catch'](function(_0x4492fd){logger[_0x8b68('0x2a')](_0x8b68('0x4d'),_0x4492fd);throw _0x4492fd;});}return _0x163fd5;})['then'](respondWithResult(_0x34047c,0xc9))[_0x8b68('0x43')](handleError(_0x34047c,null));};exports[_0x8b68('0x24')]=function(_0x3f9d34,_0x4dda69){if(_0x3f9d34[_0x8b68('0x4e')]['id']){delete _0x3f9d34['body']['id'];}return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x3f9d34['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x4dda69,null))[_0x8b68('0x25')](saveUpdates(_0x3f9d34[_0x8b68('0x4e')],null))[_0x8b68('0x25')](respondWithResult(_0x4dda69,null))[_0x8b68('0x43')](handleError(_0x4dda69,null));};exports['destroy']=function(_0x241166,_0x3f3e43){return db[_0x8b68('0x2f')][_0x8b68('0x47')]({'where':{'id':_0x241166[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x3f3e43,null))[_0x8b68('0x25')](removeEntity(_0x3f3e43,null))[_0x8b68('0x43')](handleError(_0x3f3e43,null));};exports['getMessages']=function(_0x3f423e,_0x1a85da,_0x1e8694){return db[_0x8b68('0x2f')][_0x8b68('0x50')]({'where':{'id':_0x3f423e[_0x8b68('0x4f')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x25')](function(_0x6d63cb){var _0x271dbe;var _0x368c86={},_0x42871e={};_0x42871e[_0x8b68('0x36')]=_[_0x8b68('0x33')](db[_0x8b68('0x51')][_0x8b68('0x45')]);_0x42871e[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x3f423e[_0x8b68('0x32')]);_0x42871e[_0x8b68('0x34')]=_['intersection'](_0x42871e[_0x8b68('0x36')],_0x42871e['query']);_0x368c86['attributes']=_[_0x8b68('0x35')](_0x42871e['model'],qs[_0x8b68('0x38')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x38')]));_0x368c86['attributes']=_0x368c86[_0x8b68('0x37')][_0x8b68('0x39')]?_0x368c86[_0x8b68('0x37')]:_0x42871e[_0x8b68('0x36')];if(!_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3a')](_0x8b68('0x52'))){_0x368c86['limit']=qs['limit'](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x1f')]);_0x368c86[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x20')]);}_0x368c86[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x3f423e[_0x8b68('0x32')][_0x8b68('0x3c')]);_0x368c86[_0x8b68('0x3d')]=qs[_0x8b68('0x34')](_[_0x8b68('0x3e')](_0x3f423e[_0x8b68('0x32')],_0x42871e[_0x8b68('0x34')]));if(_0x3f423e[_0x8b68('0x32')][_0x8b68('0x53')]){_0x368c86[_0x8b68('0x3d')]=_['merge'](_0x368c86['where'],{'$or':_[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x37')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x3f423e['query'][_0x8b68('0x53')]+'%'};return _0x48d57a;})});}_0x368c86[_0x8b68('0x3d')]=_[_0x8b68('0x3f')](_0x368c86[_0x8b68('0x3d')],{'mailboxuser':_0x6d63cb[_0x8b68('0x54')]});_0x368c86=_['merge']({},_0x368c86,_0x3f423e[_0x8b68('0x41')]);return db[_0x8b68('0x51')]['findAndCountAll'](_0x368c86)[_0x8b68('0x25')](respondWithFilteredResult(_0x1a85da,_0x368c86));})['catch'](handleError(_0x1a85da,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9f0d03c..a1658a3 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 _0x3a06=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x99900a,_0x5ab0b6){var _0x1666eb=function(_0x2fe650){while(--_0x2fe650){_0x99900a['push'](_0x99900a['shift']());}};_0x1666eb(++_0x5ab0b6);}(_0x3a06,0x180));var _0x63a0=function(_0x31e76a,_0x51bc97){_0x31e76a=_0x31e76a-0x0;var _0x5488ec=_0x3a06[_0x31e76a];return _0x5488ec;};'use strict';var _=require(_0x63a0('0x0'));var util=require(_0x63a0('0x1'));var logger=require(_0x63a0('0x2'))(_0x63a0('0x3'));var moment=require(_0x63a0('0x4'));var BPromise=require(_0x63a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x63a0('0x6'));var config=require(_0x63a0('0x7'));var attributes=require(_0x63a0('0x8'));module[_0x63a0('0x9')]=function(_0x53e290,_0x5815a1){return _0x53e290[_0x63a0('0xa')](_0x63a0('0xb'),attributes,{'tableName':_0x63a0('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x63a0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac4b=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xac4b,0x1f4));var _0xbac4=function(_0x3c056a,_0x34c1ce){_0x3c056a=_0x3c056a-0x0;var _0x1bff8f=_0xac4b[_0x3c056a];return _0x1bff8f;};'use strict';var _=require(_0xbac4('0x0'));var util=require(_0xbac4('0x1'));var logger=require(_0xbac4('0x2'))(_0xbac4('0x3'));var moment=require(_0xbac4('0x4'));var BPromise=require('bluebird');var rp=require(_0xbac4('0x5'));var fs=require('fs');var path=require(_0xbac4('0x6'));var rimraf=require(_0xbac4('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xbac4('0x8')]=function(_0x5b1dc7,_0x1325c4){return _0x5b1dc7[_0xbac4('0x9')](_0xbac4('0xa'),attributes,{'tableName':_0xbac4('0xb'),'paranoid':![],'indexes':[{'name':_0xbac4('0xc'),'fields':[_0xbac4('0xd'),_0xbac4('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 9282c69..60d10f2 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 _0xe5b8=['error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x185305,_0x183729){var _0x36bf36=function(_0x596a2c){while(--_0x596a2c){_0x185305['push'](_0x185305['shift']());}};_0x36bf36(++_0x183729);}(_0xe5b8,0x103));var _0x8e5b=function(_0x4883ec,_0x15cbcd){_0x4883ec=_0x4883ec-0x0;var _0x4bb8ac=_0xe5b8[_0x4883ec];return _0x4bb8ac;};'use strict';var _=require(_0x8e5b('0x0'));var util=require(_0x8e5b('0x1'));var moment=require('moment');var BPromise=require(_0x8e5b('0x2'));var rs=require(_0x8e5b('0x3'));var fs=require('fs');var Redis=require(_0x8e5b('0x4'));var db=require(_0x8e5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e5b('0x6'))(_0x8e5b('0x7'));var config=require(_0x8e5b('0x8'));var jayson=require(_0x8e5b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55e48f,_0x5a0383,_0x3ebd1f){return new BPromise(function(_0x43183d,_0x7c8c0b){return client[_0x8e5b('0xa')](_0x55e48f,_0x3ebd1f)[_0x8e5b('0xb')](function(_0x499405){logger[_0x8e5b('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5a0383,_0x8e5b('0xd'));logger[_0x8e5b('0xe')](_0x8e5b('0xf'),_0x5a0383,_0x8e5b('0xd'),JSON[_0x8e5b('0x10')](_0x499405));if(_0x499405[_0x8e5b('0x11')]){if(_0x499405[_0x8e5b('0x11')][_0x8e5b('0x12')]===0x1f4){logger[_0x8e5b('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5a0383,_0x499405[_0x8e5b('0x11')][_0x8e5b('0x13')]);return _0x7c8c0b(_0x499405[_0x8e5b('0x11')]['message']);}logger[_0x8e5b('0x11')]('VoiceMail,\x20%s,\x20%s',_0x5a0383,_0x499405[_0x8e5b('0x11')][_0x8e5b('0x13')]);return _0x43183d(_0x499405[_0x8e5b('0x11')][_0x8e5b('0x13')]);}else{logger[_0x8e5b('0xc')](_0x8e5b('0x14'),_0x5a0383,_0x8e5b('0xd'));_0x43183d(_0x499405[_0x8e5b('0x15')]['message']);}})[_0x8e5b('0x16')](function(_0xbbb0f7){logger[_0x8e5b('0x11')](_0x8e5b('0x14'),_0x5a0383,_0xbbb0f7);_0x7c8c0b(_0xbbb0f7);});});} \ No newline at end of file +var _0x15fe=['jayson/promise','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x50c10b,_0x5317ee){var _0x4f7285=function(_0x29e88f){while(--_0x29e88f){_0x50c10b['push'](_0x50c10b['shift']());}};_0x4f7285(++_0x5317ee);}(_0x15fe,0x10b));var _0xe15f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x15fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe15f('0x0'));var util=require(_0xe15f('0x1'));var moment=require(_0xe15f('0x2'));var BPromise=require(_0xe15f('0x3'));var rs=require(_0xe15f('0x4'));var fs=require('fs');var Redis=require(_0xe15f('0x5'));var db=require(_0xe15f('0x6'))['db'];var utils=require(_0xe15f('0x7'));var logger=require('../../config/logger')(_0xe15f('0x8'));var config=require('../../config/environment');var jayson=require(_0xe15f('0x9'));var client=jayson[_0xe15f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46dade,_0x1f97f6,_0x49548d){return new BPromise(function(_0x19c975,_0x5b2466){return client['request'](_0x46dade,_0x49548d)[_0xe15f('0xb')](function(_0x226ab0){logger[_0xe15f('0xc')](_0xe15f('0xd'),_0x1f97f6,_0xe15f('0xe'));logger[_0xe15f('0xf')](_0xe15f('0x10'),_0x1f97f6,_0xe15f('0xe'),JSON[_0xe15f('0x11')](_0x226ab0));if(_0x226ab0['error']){if(_0x226ab0[_0xe15f('0x12')][_0xe15f('0x13')]===0x1f4){logger[_0xe15f('0x12')](_0xe15f('0xd'),_0x1f97f6,_0x226ab0['error'][_0xe15f('0x14')]);return _0x5b2466(_0x226ab0[_0xe15f('0x12')][_0xe15f('0x14')]);}logger[_0xe15f('0x12')](_0xe15f('0xd'),_0x1f97f6,_0x226ab0[_0xe15f('0x12')][_0xe15f('0x14')]);return _0x19c975(_0x226ab0['error'][_0xe15f('0x14')]);}else{logger['info'](_0xe15f('0xd'),_0x1f97f6,_0xe15f('0xe'));_0x19c975(_0x226ab0[_0xe15f('0x15')]['message']);}})[_0xe15f('0x16')](function(_0x58cdc2){logger[_0xe15f('0x12')](_0xe15f('0xd'),_0x1f97f6,_0x58cdc2);_0x5b2466(_0x58cdc2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1583a96..6d814e9 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 _0x064b=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','post','create','delete','destroy','multer','path','connect-timeout'];(function(_0xf6c3e9,_0x608df7){var _0x4de0a0=function(_0x47654e){while(--_0x47654e){_0xf6c3e9['push'](_0xf6c3e9['shift']());}};_0x4de0a0(++_0x608df7);}(_0x064b,0x6d));var _0xb064=function(_0x1340c7,_0x5ba427){_0x1340c7=_0x1340c7-0x0;var _0x153758=_0x064b[_0x1340c7];return _0x153758;};'use strict';var multer=require(_0xb064('0x0'));var util=require('util');var path=require(_0xb064('0x1'));var timeout=require(_0xb064('0x2'));var express=require(_0xb064('0x3'));var router=express[_0xb064('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb064('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb064('0x6'));var controller=require('./voiceMailMessage.controller');router[_0xb064('0x7')]('/',auth[_0xb064('0x8')](),controller[_0xb064('0x9')]);router[_0xb064('0x7')](_0xb064('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb064('0x7')](_0xb064('0xb'),auth[_0xb064('0x8')](),controller['download']);router[_0xb064('0xc')]('/',auth[_0xb064('0x8')](),controller[_0xb064('0xd')]);router['put'](_0xb064('0xa'),auth[_0xb064('0x8')](),controller['update']);router[_0xb064('0xe')](_0xb064('0xa'),auth['isAuthenticated'](),controller[_0xb064('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7196=['/:id/download','download','post','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x7196,0x1c8));var _0x6719=function(_0x417129,_0x53aee2){_0x417129=_0x417129-0x0;var _0x338f08=_0x7196[_0x417129];return _0x338f08;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6719('0x0'));var timeout=require(_0x6719('0x1'));var express=require(_0x6719('0x2'));var router=express[_0x6719('0x3')]();var fs_extra=require(_0x6719('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6719('0x5'));var config=require(_0x6719('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x6719('0x7')]('/',auth[_0x6719('0x8')](),controller[_0x6719('0x9')]);router['get'](_0x6719('0xa'),auth[_0x6719('0x8')](),controller[_0x6719('0xb')]);router[_0x6719('0x7')](_0x6719('0xc'),auth['isAuthenticated'](),controller[_0x6719('0xd')]);router[_0x6719('0xe')]('/',auth[_0x6719('0x8')](),controller['create']);router['put']('/:id',auth[_0x6719('0x8')](),controller[_0x6719('0xf')]);router[_0x6719('0x10')](_0x6719('0xa'),auth[_0x6719('0x8')](),controller['destroy']);module[_0x6719('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 25cab96..26418e7 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 _0xa34c=['sequelize','VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3b88f5,_0x5d2c77){var _0x35c1e4=function(_0x5f2d4e){while(--_0x5f2d4e){_0x3b88f5['push'](_0x3b88f5['shift']());}};_0x35c1e4(++_0x5d2c77);}(_0xa34c,0x1b8));var _0xca34=function(_0x171769,_0x2457fa){_0x171769=_0x171769-0x0;var _0x23fae8=_0xa34c[_0x171769];return _0x23fae8;};'use strict';var Sequelize=require(_0xca34('0x0'));module['exports']={'name':{'type':Sequelize[_0xca34('0x1')],'get':function(_0x29dbb7){return this[_0xca34('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xca34('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xca34('0x4')],'defaultValue':''},'stamp':{'type':_0xca34('0x5'),'defaultValue':Sequelize[_0xca34('0x6')](_0xca34('0x7'))}}; \ No newline at end of file +var _0x5a51=['TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0x5a51,0x91));var _0x15a5=function(_0x33aa79,_0x25428d){_0x33aa79=_0x33aa79-0x0;var _0x164ad2=_0x5a51[_0x33aa79];return _0x164ad2;};'use strict';var Sequelize=require(_0x15a5('0x0'));module[_0x15a5('0x1')]={'name':{'type':Sequelize[_0x15a5('0x2')],'get':function(_0x41d71f){return this[_0x15a5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x15a5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x15a5('0x6')](_0x15a5('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x15a5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x15a5('0x8'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0e23179..96da73b 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 _0x5bac=['set','apply','reject','save','destroy','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','then','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','update','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x5607bf,_0x7e20f6){var _0x5a3b04=function(_0x1c4938){while(--_0x1c4938){_0x5607bf['push'](_0x5607bf['shift']());}};_0x5a3b04(++_0x7e20f6);}(_0x5bac,0x134));var _0xc5ba=function(_0x475126,_0x18c947){_0x475126=_0x475126-0x0;var _0x23d536=_0x5bac[_0x475126];return _0x23d536;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5ba('0x0'));var zipdir=require(_0xc5ba('0x1'));var jsonpatch=require(_0xc5ba('0x2'));var rp=require(_0xc5ba('0x3'));var moment=require(_0xc5ba('0x4'));var BPromise=require(_0xc5ba('0x5'));var Mustache=require('mustache');var util=require(_0xc5ba('0x6'));var path=require(_0xc5ba('0x7'));var sox=require(_0xc5ba('0x8'));var csv=require(_0xc5ba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5ba('0xa'));var _=require(_0xc5ba('0xb'));var squel=require(_0xc5ba('0xc'));var crypto=require(_0xc5ba('0xd'));var jsforce=require(_0xc5ba('0xe'));var deskjs=require(_0xc5ba('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5ba('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5ba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5ba('0x12'))(_0xc5ba('0x13'));var utils=require(_0xc5ba('0x14'));var config=require(_0xc5ba('0x15'));var licenseUtil=require(_0xc5ba('0x16'));var db=require(_0xc5ba('0x17'))['db'];function respondWithStatusCode(_0x3148a1,_0x3215dd){_0x3215dd=_0x3215dd||0xcc;return function(_0x5e993d){if(_0x5e993d){return _0x3148a1[_0xc5ba('0x18')](_0x3215dd);}return _0x3148a1['status'](_0x3215dd)[_0xc5ba('0x19')]();};}function respondWithResult(_0x16d16d,_0x567a46){_0x567a46=_0x567a46||0xc8;return function(_0xb7ff3f){if(_0xb7ff3f){return _0x16d16d[_0xc5ba('0x1a')](_0x567a46)[_0xc5ba('0x1b')](_0xb7ff3f);}};}function respondWithFilteredResult(_0x1e6128,_0x1f6d09){return function(_0x5db9a4){if(_0x5db9a4){var _0x2959a6=typeof _0x1f6d09[_0xc5ba('0x1c')]===_0xc5ba('0x1d')&&typeof _0x1f6d09[_0xc5ba('0x1e')]===_0xc5ba('0x1d');var _0x3c5a3a=_0x5db9a4[_0xc5ba('0x1f')];var _0x49a507=_0x2959a6?0x0:_0x1f6d09[_0xc5ba('0x1c')];var _0x385cac=_0x2959a6?_0x5db9a4[_0xc5ba('0x1f')]:_0x1f6d09[_0xc5ba('0x1c')]+_0x1f6d09[_0xc5ba('0x1e')];var _0x38e7f9;if(_0x385cac>=_0x3c5a3a){_0x385cac=_0x3c5a3a;_0x38e7f9=0xc8;}else{_0x38e7f9=0xce;}_0x1e6128[_0xc5ba('0x1a')](_0x38e7f9);return _0x1e6128[_0xc5ba('0x20')]('Content-Range',_0x49a507+'-'+_0x385cac+'/'+_0x3c5a3a)['json'](_0x5db9a4);}return null;};}function patchUpdates(_0x20efcc){return function(_0x1cfdd2){try{jsonpatch[_0xc5ba('0x21')](_0x1cfdd2,_0x20efcc,!![]);}catch(_0x5ce288){return BPromise[_0xc5ba('0x22')](_0x5ce288);}return _0x1cfdd2[_0xc5ba('0x23')]();};}function saveUpdates(_0x555e70,_0x1af987){return function(_0x428fe0){if(_0x428fe0){return _0x428fe0['update'](_0x555e70)['then'](function(_0xbd449){return _0xbd449;});}return null;};}function removeEntity(_0x583d82,_0x41c2b5){return function(_0x221a4b){if(_0x221a4b){return _0x221a4b[_0xc5ba('0x24')]()['then'](function(){_0x583d82[_0xc5ba('0x1a')](0xcc)[_0xc5ba('0x19')]();});}};}function handleEntityNotFound(_0x591235,_0x46bff9){return function(_0x4dd53d){if(!_0x4dd53d){_0x591235[_0xc5ba('0x18')](0x194);}return _0x4dd53d;};}function handleError(_0x29885c,_0x2a8b88){_0x2a8b88=_0x2a8b88||0x1f4;return function(_0x41fdd8){logger[_0xc5ba('0x25')](_0x41fdd8[_0xc5ba('0x26')]);if(_0x41fdd8[_0xc5ba('0x27')]){delete _0x41fdd8[_0xc5ba('0x27')];}_0x29885c['status'](_0x2a8b88)[_0xc5ba('0x28')](_0x41fdd8);};}exports[_0xc5ba('0x29')]=function(_0x5504cf,_0x267c2b){var _0x544686={},_0x50ef18={},_0x13eea3={'count':0x0,'rows':[]};var _0x29c9cb=_[_0xc5ba('0x2a')](db[_0xc5ba('0x2b')]['rawAttributes'],function(_0xcf5047){return{'name':_0xcf5047[_0xc5ba('0x2c')],'type':_0xcf5047[_0xc5ba('0x2d')]['key']};});_0x50ef18[_0xc5ba('0x2e')]=_[_0xc5ba('0x2f')](_[_0xc5ba('0x2a')](_0x29c9cb,_0xc5ba('0x27')),[_0xc5ba('0x27')]);_0x50ef18[_0xc5ba('0x30')]=_['keys'](_0x5504cf[_0xc5ba('0x30')]);_0x50ef18[_0xc5ba('0x31')]=_[_0xc5ba('0x32')](_0x50ef18[_0xc5ba('0x2e')],_0x50ef18[_0xc5ba('0x30')]);_0x544686[_0xc5ba('0x33')]=_[_0xc5ba('0x32')](_0x50ef18[_0xc5ba('0x2e')],qs['fields'](_0x5504cf['query'][_0xc5ba('0x34')]));_0x544686[_0xc5ba('0x33')]=_0x544686['attributes'][_0xc5ba('0x35')]?_0x544686[_0xc5ba('0x33')]:_0x50ef18['model'];if(!_0x5504cf[_0xc5ba('0x30')][_0xc5ba('0x36')](_0xc5ba('0x37'))){_0x544686[_0xc5ba('0x1e')]=qs[_0xc5ba('0x1e')](_0x5504cf['query'][_0xc5ba('0x1e')]);_0x544686[_0xc5ba('0x1c')]=qs[_0xc5ba('0x1c')](_0x5504cf['query']['offset']);}_0x544686[_0xc5ba('0x38')]=qs[_0xc5ba('0x39')](_0x5504cf[_0xc5ba('0x30')][_0xc5ba('0x39')]);_0x544686['where']=qs[_0xc5ba('0x31')](_[_0xc5ba('0x3a')](_0x5504cf['query'],_0x50ef18[_0xc5ba('0x31')]),_0x29c9cb);if(_0x5504cf['query']['filter']){_0x544686[_0xc5ba('0x3b')]=_[_0xc5ba('0x3c')](_0x544686[_0xc5ba('0x3b')],{'$or':_[_0xc5ba('0x2a')](_0x29c9cb,function(_0x3a175a){if(_0x3a175a[_0xc5ba('0x2d')]!=='VIRTUAL'){var _0x108a18={};_0x108a18[_0x3a175a[_0xc5ba('0x27')]]={'$like':'%'+_0x5504cf[_0xc5ba('0x30')][_0xc5ba('0x3d')]+'%'};return _0x108a18;}})});}_0x544686=_['merge']({},_0x544686,_0x5504cf[_0xc5ba('0x3e')]);var _0x2f24ac={'where':_0x544686[_0xc5ba('0x3b')]};return db[_0xc5ba('0x2b')][_0xc5ba('0x1f')](_0x2f24ac)[_0xc5ba('0x3f')](function(_0x2a7f30){_0x13eea3[_0xc5ba('0x1f')]=_0x2a7f30;if(_0x5504cf['query']['includeAll']){_0x544686[_0xc5ba('0x40')]=[{'all':!![]}];}return db[_0xc5ba('0x2b')][_0xc5ba('0x41')](_0x544686);})['then'](function(_0x3baa39){_0x13eea3[_0xc5ba('0x42')]=_0x3baa39;return _0x13eea3;})[_0xc5ba('0x3f')](respondWithFilteredResult(_0x267c2b,_0x544686))['catch'](handleError(_0x267c2b,null));};exports[_0xc5ba('0x43')]=function(_0x1328dd,_0x5d49dd){var _0x22b211={'raw':!![],'where':{'id':_0x1328dd[_0xc5ba('0x44')]['id']}},_0x1692a6={};_0x1692a6['model']=_[_0xc5ba('0x45')](db[_0xc5ba('0x2b')][_0xc5ba('0x46')]);_0x1692a6[_0xc5ba('0x30')]=_[_0xc5ba('0x45')](_0x1328dd['query']);_0x1692a6['filters']=_[_0xc5ba('0x32')](_0x1692a6[_0xc5ba('0x2e')],_0x1692a6[_0xc5ba('0x30')]);_0x22b211[_0xc5ba('0x33')]=_[_0xc5ba('0x32')](_0x1692a6[_0xc5ba('0x2e')],qs[_0xc5ba('0x34')](_0x1328dd[_0xc5ba('0x30')][_0xc5ba('0x34')]));_0x22b211[_0xc5ba('0x33')]=_0x22b211[_0xc5ba('0x33')][_0xc5ba('0x35')]?_0x22b211['attributes']:_0x1692a6[_0xc5ba('0x2e')];if(_0x1328dd[_0xc5ba('0x30')][_0xc5ba('0x47')]){_0x22b211[_0xc5ba('0x40')]=[{'all':!![]}];}_0x22b211=_[_0xc5ba('0x3c')]({},_0x22b211,_0x1328dd[_0xc5ba('0x3e')]);return db[_0xc5ba('0x2b')][_0xc5ba('0x48')](_0x22b211)[_0xc5ba('0x3f')](handleEntityNotFound(_0x5d49dd,null))[_0xc5ba('0x3f')](respondWithResult(_0x5d49dd,null))[_0xc5ba('0x49')](handleError(_0x5d49dd,null));};exports[_0xc5ba('0x4a')]=function(_0x8c7c9c,_0x43976a){return db[_0xc5ba('0x2b')]['create'](_0x8c7c9c[_0xc5ba('0x4b')],{})[_0xc5ba('0x3f')](respondWithResult(_0x43976a,0xc9))[_0xc5ba('0x49')](handleError(_0x43976a,null));};exports[_0xc5ba('0x4c')]=function(_0x468e63,_0x122aed){if(_0x468e63[_0xc5ba('0x4b')]['id']){delete _0x468e63['body']['id'];}return db[_0xc5ba('0x2b')][_0xc5ba('0x48')]({'where':{'id':_0x468e63['params']['id']}})['then'](handleEntityNotFound(_0x122aed,null))[_0xc5ba('0x3f')](saveUpdates(_0x468e63[_0xc5ba('0x4b')],null))[_0xc5ba('0x3f')](respondWithResult(_0x122aed,null))['catch'](handleError(_0x122aed,null));};exports['destroy']=function(_0x517583,_0x19cbbe){return db[_0xc5ba('0x2b')][_0xc5ba('0x48')]({'where':{'id':_0x517583[_0xc5ba('0x44')]['id']}})['then'](handleEntityNotFound(_0x19cbbe,null))[_0xc5ba('0x3f')](removeEntity(_0x19cbbe,null))[_0xc5ba('0x49')](handleError(_0x19cbbe,null));};exports[_0xc5ba('0x4d')]=function(_0x1c9635,_0x3725cc,_0x563843){return db[_0xc5ba('0x2b')]['find']({'where':{'id':_0x1c9635[_0xc5ba('0x44')]['id']},'attributes':['id',_0xc5ba('0x4e'),'msg_id']})[_0xc5ba('0x3f')](handleEntityNotFound(_0x3725cc,null))[_0xc5ba('0x3f')](function(_0x247059){if(_0x247059){if(!_0x247059[_0xc5ba('0x4e')]){throw new db[(_0xc5ba('0x4f'))]['ValidationError'](_0xc5ba('0x50'));}var _0x591a33={'Content-Type':'audio/wav','Content-Disposition':_0xc5ba('0x51')};if(_0x247059[_0xc5ba('0x52')]){_0x591a33[_0xc5ba('0x53')]='attachment;\x20filename=\x22'+_0x247059[_0xc5ba('0x52')]+_0xc5ba('0x54');}_0x3725cc[_0xc5ba('0x20')](_0x591a33);return _0x3725cc[_0xc5ba('0x28')](new Buffer(_0x247059[_0xc5ba('0x4e')]));}})['catch'](handleError(_0x3725cc,null));}; \ No newline at end of file +var _0x1fac=['Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','count','includeAll','include','VoiceMailMessage','findAll','rows','fields','merge','find','catch','create','body','params','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x1fac,0x1ef));var _0xc1fa=function(_0x3aed26,_0x5f23af){_0x3aed26=_0x3aed26-0x0;var _0x5f381a=_0x1fac[_0x3aed26];return _0x5f381a;};'use strict';var emlformat=require(_0xc1fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1fa('0x1'));var jsonpatch=require(_0xc1fa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1fa('0x3'));var Mustache=require(_0xc1fa('0x4'));var util=require('util');var path=require(_0xc1fa('0x5'));var sox=require(_0xc1fa('0x6'));var csv=require('to-csv');var ejs=require(_0xc1fa('0x7'));var fs=require('fs');var fs_extra=require(_0xc1fa('0x8'));var _=require(_0xc1fa('0x9'));var squel=require(_0xc1fa('0xa'));var crypto=require(_0xc1fa('0xb'));var jsforce=require(_0xc1fa('0xc'));var deskjs=require(_0xc1fa('0xd'));var toCsv=require(_0xc1fa('0xe'));var querystring=require(_0xc1fa('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1fa('0x10'));var qs=require(_0xc1fa('0x11'));var as=require(_0xc1fa('0x12'));var hardwareService=require(_0xc1fa('0x13'));var logger=require('../../config/logger')(_0xc1fa('0x14'));var utils=require(_0xc1fa('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc1fa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41c008,_0x303f72){_0x303f72=_0x303f72||0xcc;return function(_0x3ae558){if(_0x3ae558){return _0x41c008[_0xc1fa('0x17')](_0x303f72);}return _0x41c008['status'](_0x303f72)[_0xc1fa('0x18')]();};}function respondWithResult(_0x4524a4,_0x514aa9){_0x514aa9=_0x514aa9||0xc8;return function(_0x1231d2){if(_0x1231d2){return _0x4524a4[_0xc1fa('0x19')](_0x514aa9)[_0xc1fa('0x1a')](_0x1231d2);}};}function respondWithFilteredResult(_0x3228f5,_0x5af854){return function(_0x1dd17b){if(_0x1dd17b){var _0x1e3ff3=typeof _0x5af854['offset']===_0xc1fa('0x1b')&&typeof _0x5af854[_0xc1fa('0x1c')]===_0xc1fa('0x1b');var _0x5498cf=_0x1dd17b['count'];var _0x38f392=_0x1e3ff3?0x0:_0x5af854[_0xc1fa('0x1d')];var _0x4c772b=_0x1e3ff3?_0x1dd17b['count']:_0x5af854[_0xc1fa('0x1d')]+_0x5af854['limit'];var _0x4bfcdd;if(_0x4c772b>=_0x5498cf){_0x4c772b=_0x5498cf;_0x4bfcdd=0xc8;}else{_0x4bfcdd=0xce;}_0x3228f5[_0xc1fa('0x19')](_0x4bfcdd);return _0x3228f5[_0xc1fa('0x1e')](_0xc1fa('0x1f'),_0x38f392+'-'+_0x4c772b+'/'+_0x5498cf)['json'](_0x1dd17b);}return null;};}function patchUpdates(_0x58d73d){return function(_0x357472){try{jsonpatch[_0xc1fa('0x20')](_0x357472,_0x58d73d,!![]);}catch(_0x3dc368){return BPromise['reject'](_0x3dc368);}return _0x357472['save']();};}function saveUpdates(_0x2d44bd,_0x579d9c){return function(_0x41a9f8){if(_0x41a9f8){return _0x41a9f8[_0xc1fa('0x21')](_0x2d44bd)['then'](function(_0x479942){return _0x479942;});}return null;};}function removeEntity(_0x16fa4e,_0x54a103){return function(_0x669261){if(_0x669261){return _0x669261[_0xc1fa('0x22')]()[_0xc1fa('0x23')](function(){_0x16fa4e[_0xc1fa('0x19')](0xcc)[_0xc1fa('0x18')]();});}};}function handleEntityNotFound(_0x21fa63,_0x276c10){return function(_0x1d719d){if(!_0x1d719d){_0x21fa63[_0xc1fa('0x17')](0x194);}return _0x1d719d;};}function handleError(_0x3b9780,_0x213cfb){_0x213cfb=_0x213cfb||0x1f4;return function(_0x4d659e){logger[_0xc1fa('0x24')](_0x4d659e[_0xc1fa('0x25')]);if(_0x4d659e['name']){delete _0x4d659e[_0xc1fa('0x26')];}_0x3b9780['status'](_0x213cfb)[_0xc1fa('0x27')](_0x4d659e);};}exports[_0xc1fa('0x28')]=function(_0x41435f,_0x5b8a57){var _0x4b6686={},_0x43d0a2={},_0xa0e488={'count':0x0,'rows':[]};var _0x5d4806=_[_0xc1fa('0x29')](db['VoiceMailMessage'][_0xc1fa('0x2a')],function(_0x176f66){return{'name':_0x176f66['fieldName'],'type':_0x176f66['type'][_0xc1fa('0x2b')]};});_0x43d0a2[_0xc1fa('0x2c')]=_[_0xc1fa('0x2d')](_[_0xc1fa('0x29')](_0x5d4806,_0xc1fa('0x26')),[_0xc1fa('0x26')]);_0x43d0a2[_0xc1fa('0x2e')]=_[_0xc1fa('0x2f')](_0x41435f[_0xc1fa('0x2e')]);_0x43d0a2[_0xc1fa('0x30')]=_[_0xc1fa('0x31')](_0x43d0a2[_0xc1fa('0x2c')],_0x43d0a2[_0xc1fa('0x2e')]);_0x4b6686[_0xc1fa('0x32')]=_[_0xc1fa('0x31')](_0x43d0a2[_0xc1fa('0x2c')],qs['fields'](_0x41435f[_0xc1fa('0x2e')]['fields']));_0x4b6686[_0xc1fa('0x32')]=_0x4b6686[_0xc1fa('0x32')][_0xc1fa('0x33')]?_0x4b6686['attributes']:_0x43d0a2['model'];if(!_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x34')](_0xc1fa('0x35'))){_0x4b6686[_0xc1fa('0x1c')]=qs[_0xc1fa('0x1c')](_0x41435f['query']['limit']);_0x4b6686['offset']=qs['offset'](_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x1d')]);}_0x4b6686['order']=qs['sort'](_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x36')]);_0x4b6686[_0xc1fa('0x37')]=qs[_0xc1fa('0x30')](_[_0xc1fa('0x38')](_0x41435f['query'],_0x43d0a2[_0xc1fa('0x30')]),_0x5d4806);if(_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x39')]){_0x4b6686['where']=_['merge'](_0x4b6686[_0xc1fa('0x37')],{'$or':_['map'](_0x5d4806,function(_0x21d112){if(_0x21d112[_0xc1fa('0x3a')]!==_0xc1fa('0x3b')){var _0x4cca4a={};_0x4cca4a[_0x21d112[_0xc1fa('0x26')]]={'$like':'%'+_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x39')]+'%'};return _0x4cca4a;}})});}_0x4b6686=_['merge']({},_0x4b6686,_0x41435f[_0xc1fa('0x3c')]);var _0x3c08d={'where':_0x4b6686['where']};return db['VoiceMailMessage'][_0xc1fa('0x3d')](_0x3c08d)[_0xc1fa('0x23')](function(_0x4a54b8){_0xa0e488[_0xc1fa('0x3d')]=_0x4a54b8;if(_0x41435f[_0xc1fa('0x2e')][_0xc1fa('0x3e')]){_0x4b6686[_0xc1fa('0x3f')]=[{'all':!![]}];}return db[_0xc1fa('0x40')][_0xc1fa('0x41')](_0x4b6686);})[_0xc1fa('0x23')](function(_0x102772){_0xa0e488[_0xc1fa('0x42')]=_0x102772;return _0xa0e488;})['then'](respondWithFilteredResult(_0x5b8a57,_0x4b6686))['catch'](handleError(_0x5b8a57,null));};exports['show']=function(_0x3b591c,_0x1f4341){var _0x3af065={'raw':!![],'where':{'id':_0x3b591c['params']['id']}},_0x560bf6={};_0x560bf6[_0xc1fa('0x2c')]=_['keys'](db[_0xc1fa('0x40')]['rawAttributes']);_0x560bf6[_0xc1fa('0x2e')]=_[_0xc1fa('0x2f')](_0x3b591c['query']);_0x560bf6[_0xc1fa('0x30')]=_[_0xc1fa('0x31')](_0x560bf6['model'],_0x560bf6[_0xc1fa('0x2e')]);_0x3af065[_0xc1fa('0x32')]=_['intersection'](_0x560bf6['model'],qs[_0xc1fa('0x43')](_0x3b591c[_0xc1fa('0x2e')]['fields']));_0x3af065[_0xc1fa('0x32')]=_0x3af065['attributes']['length']?_0x3af065[_0xc1fa('0x32')]:_0x560bf6['model'];if(_0x3b591c[_0xc1fa('0x2e')][_0xc1fa('0x3e')]){_0x3af065[_0xc1fa('0x3f')]=[{'all':!![]}];}_0x3af065=_[_0xc1fa('0x44')]({},_0x3af065,_0x3b591c['options']);return db[_0xc1fa('0x40')][_0xc1fa('0x45')](_0x3af065)[_0xc1fa('0x23')](handleEntityNotFound(_0x1f4341,null))['then'](respondWithResult(_0x1f4341,null))[_0xc1fa('0x46')](handleError(_0x1f4341,null));};exports[_0xc1fa('0x47')]=function(_0xa3ae2c,_0x38fea2){return db[_0xc1fa('0x40')][_0xc1fa('0x47')](_0xa3ae2c['body'],{})[_0xc1fa('0x23')](respondWithResult(_0x38fea2,0xc9))['catch'](handleError(_0x38fea2,null));};exports[_0xc1fa('0x21')]=function(_0x17628b,_0x47413e){if(_0x17628b[_0xc1fa('0x48')]['id']){delete _0x17628b['body']['id'];}return db[_0xc1fa('0x40')][_0xc1fa('0x45')]({'where':{'id':_0x17628b[_0xc1fa('0x49')]['id']}})['then'](handleEntityNotFound(_0x47413e,null))[_0xc1fa('0x23')](saveUpdates(_0x17628b['body'],null))[_0xc1fa('0x23')](respondWithResult(_0x47413e,null))[_0xc1fa('0x46')](handleError(_0x47413e,null));};exports[_0xc1fa('0x22')]=function(_0x2d4a68,_0x5049df){return db[_0xc1fa('0x40')][_0xc1fa('0x45')]({'where':{'id':_0x2d4a68['params']['id']}})[_0xc1fa('0x23')](handleEntityNotFound(_0x5049df,null))[_0xc1fa('0x23')](removeEntity(_0x5049df,null))['catch'](handleError(_0x5049df,null));};exports['download']=function(_0x1e671b,_0x227cc5,_0x8d14eb){return db[_0xc1fa('0x40')][_0xc1fa('0x45')]({'where':{'id':_0x1e671b['params']['id']},'attributes':['id',_0xc1fa('0x4a'),_0xc1fa('0x4b')]})['then'](handleEntityNotFound(_0x227cc5,null))[_0xc1fa('0x23')](function(_0x92f471){if(_0x92f471){if(!_0x92f471[_0xc1fa('0x4a')]){throw new db[(_0xc1fa('0x4c'))]['ValidationError'](_0xc1fa('0x4d'));}var _0x4ed8f2={'Content-Type':_0xc1fa('0x4e'),'Content-Disposition':'attachment'};if(_0x92f471[_0xc1fa('0x4b')]){_0x4ed8f2[_0xc1fa('0x4f')]=_0xc1fa('0x50')+_0x92f471[_0xc1fa('0x4b')]+_0xc1fa('0x51');}_0x227cc5['set'](_0x4ed8f2);return _0x227cc5['send'](new Buffer(_0x92f471[_0xc1fa('0x4a')]));}})['catch'](handleError(_0x227cc5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e69f455..e8aa9d8 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 _0xc1a4=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','dir','lodash'];(function(_0x51ef0e,_0x111fb6){var _0x32f1d2=function(_0x53b06e){while(--_0x53b06e){_0x51ef0e['push'](_0x51ef0e['shift']());}};_0x32f1d2(++_0x111fb6);}(_0xc1a4,0x1eb));var _0x4c1a=function(_0x5bb49b,_0x3a97c1){_0x5bb49b=_0x5bb49b-0x0;var _0x5d81a2=_0xc1a4[_0x5bb49b];return _0x5d81a2;};'use strict';var _=require(_0x4c1a('0x0'));var util=require(_0x4c1a('0x1'));var logger=require(_0x4c1a('0x2'))(_0x4c1a('0x3'));var moment=require('moment');var BPromise=require(_0x4c1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c1a('0x5'));var rimraf=require(_0x4c1a('0x6'));var config=require(_0x4c1a('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x4c1a('0x8')]=function(_0x1b09de,_0x59b050){return _0x1b09de[_0x4c1a('0x9')](_0x4c1a('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x4c1a('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x981a=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir'];(function(_0x4a2373,_0x178dc0){var _0x18137b=function(_0x52fb46){while(--_0x52fb46){_0x4a2373['push'](_0x4a2373['shift']());}};_0x18137b(++_0x178dc0);}(_0x981a,0xb6));var _0xa981=function(_0x4b3548,_0xc8477d){_0x4b3548=_0x4b3548-0x0;var _0x39fe9c=_0x981a[_0x4b3548];return _0x39fe9c;};'use strict';var _=require(_0xa981('0x0'));var util=require(_0xa981('0x1'));var logger=require(_0xa981('0x2'))(_0xa981('0x3'));var moment=require(_0xa981('0x4'));var BPromise=require(_0xa981('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa981('0x6'));var rimraf=require(_0xa981('0x7'));var config=require(_0xa981('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xa981('0x9')]=function(_0x48ecc8,_0x5c85d9){return _0x48ecc8[_0xa981('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xa981('0xb'),'paranoid':![],'indexes':[{'name':_0xa981('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d144289..9c96c29 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 _0x4e12=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4e12,0xe8));var _0x24e1=function(_0x3cad0f,_0x1f2ad8){_0x3cad0f=_0x3cad0f-0x0;var _0x40c62c=_0x4e12[_0x3cad0f];return _0x40c62c;};'use strict';var _=require('lodash');var util=require(_0x24e1('0x0'));var moment=require(_0x24e1('0x1'));var BPromise=require('bluebird');var rs=require(_0x24e1('0x2'));var fs=require('fs');var Redis=require(_0x24e1('0x3'));var db=require(_0x24e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24e1('0x5'))(_0x24e1('0x6'));var config=require(_0x24e1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x24e1('0x8')][_0x24e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x456dea,_0x18057a,_0x11083b){return new BPromise(function(_0x5ee291,_0x239f57){return client[_0x24e1('0xa')](_0x456dea,_0x11083b)[_0x24e1('0xb')](function(_0xa3617f){logger[_0x24e1('0xc')](_0x24e1('0xd'),_0x18057a,_0x24e1('0xe'));logger[_0x24e1('0xf')](_0x24e1('0x10'),_0x18057a,_0x24e1('0xe'),JSON['stringify'](_0xa3617f));if(_0xa3617f[_0x24e1('0x11')]){if(_0xa3617f['error'][_0x24e1('0x12')]===0x1f4){logger[_0x24e1('0x11')](_0x24e1('0xd'),_0x18057a,_0xa3617f[_0x24e1('0x11')][_0x24e1('0x13')]);return _0x239f57(_0xa3617f[_0x24e1('0x11')][_0x24e1('0x13')]);}logger[_0x24e1('0x11')](_0x24e1('0xd'),_0x18057a,_0xa3617f[_0x24e1('0x11')][_0x24e1('0x13')]);return _0x5ee291(_0xa3617f[_0x24e1('0x11')][_0x24e1('0x13')]);}else{logger[_0x24e1('0xc')](_0x24e1('0xd'),_0x18057a,_0x24e1('0xe'));_0x5ee291(_0xa3617f[_0x24e1('0x14')][_0x24e1('0x13')]);}})[_0x24e1('0x15')](function(_0x41a53b){logger[_0x24e1('0x11')](_0x24e1('0xd'),_0x18057a,_0x41a53b);_0x239f57(_0x41a53b);});});} \ No newline at end of file +var _0xbd89=['rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a3f2b,_0xacbd0f){var _0x4d8394=function(_0x216600){while(--_0x216600){_0x3a3f2b['push'](_0x3a3f2b['shift']());}};_0x4d8394(++_0xacbd0f);}(_0xbd89,0xa6));var _0x9bd8=function(_0x372eba,_0x2c7e69){_0x372eba=_0x372eba-0x0;var _0x511651=_0xbd89[_0x372eba];return _0x511651;};'use strict';var _=require(_0x9bd8('0x0'));var util=require(_0x9bd8('0x1'));var moment=require(_0x9bd8('0x2'));var BPromise=require(_0x9bd8('0x3'));var rs=require(_0x9bd8('0x4'));var fs=require('fs');var Redis=require(_0x9bd8('0x5'));var db=require(_0x9bd8('0x6'))['db'];var utils=require(_0x9bd8('0x7'));var logger=require(_0x9bd8('0x8'))(_0x9bd8('0x9'));var config=require(_0x9bd8('0xa'));var jayson=require(_0x9bd8('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3db826,_0x4d2550,_0x240584){return new BPromise(function(_0x57832e,_0x4db149){return client[_0x9bd8('0xc')](_0x3db826,_0x240584)[_0x9bd8('0xd')](function(_0x3444e5){logger[_0x9bd8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4d2550,_0x9bd8('0xf'));logger[_0x9bd8('0x10')](_0x9bd8('0x11'),_0x4d2550,_0x9bd8('0xf'),JSON[_0x9bd8('0x12')](_0x3444e5));if(_0x3444e5[_0x9bd8('0x13')]){if(_0x3444e5['error'][_0x9bd8('0x14')]===0x1f4){logger[_0x9bd8('0x13')](_0x9bd8('0x15'),_0x4d2550,_0x3444e5[_0x9bd8('0x13')][_0x9bd8('0x16')]);return _0x4db149(_0x3444e5[_0x9bd8('0x13')][_0x9bd8('0x16')]);}logger[_0x9bd8('0x13')](_0x9bd8('0x15'),_0x4d2550,_0x3444e5[_0x9bd8('0x13')]['message']);return _0x57832e(_0x3444e5[_0x9bd8('0x13')][_0x9bd8('0x16')]);}else{logger[_0x9bd8('0xe')](_0x9bd8('0x15'),_0x4d2550,_0x9bd8('0xf'));_0x57832e(_0x3444e5[_0x9bd8('0x17')][_0x9bd8('0x16')]);}})[_0x9bd8('0x18')](function(_0x44a5d4){logger['error'](_0x9bd8('0x15'),_0x4d2550,_0x44a5d4);_0x4db149(_0x44a5d4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7af7e7b..5bc3d34 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 _0x372c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','delete','destroy','/:id/sounds/:id2','multer'];(function(_0x47287c,_0x349944){var _0x3926b3=function(_0x314e83){while(--_0x314e83){_0x47287c['push'](_0x47287c['shift']());}};_0x3926b3(++_0x349944);}(_0x372c,0x197));var _0xc372=function(_0x132a1f,_0x2fa3a1){_0x132a1f=_0x132a1f-0x0;var _0x1e10bd=_0x372c[_0x132a1f];return _0x1e10bd;};'use strict';var multer=require(_0xc372('0x0'));var util=require(_0xc372('0x1'));var path=require(_0xc372('0x2'));var timeout=require(_0xc372('0x3'));var express=require(_0xc372('0x4'));var router=express[_0xc372('0x5')]();var fs_extra=require(_0xc372('0x6'));var auth=require(_0xc372('0x7'));var interaction=require(_0xc372('0x8'));var config=require(_0xc372('0x9'));var controller=require(_0xc372('0xa'));router[_0xc372('0xb')]('/',auth[_0xc372('0xc')](),controller[_0xc372('0xd')]);router[_0xc372('0xb')](_0xc372('0xe'),auth[_0xc372('0xc')](),controller[_0xc372('0xf')]);router[_0xc372('0xb')](_0xc372('0x10'),auth[_0xc372('0xc')](),controller[_0xc372('0x11')]);router[_0xc372('0x12')]('/',auth[_0xc372('0xc')](),controller[_0xc372('0x13')]);router[_0xc372('0x12')](_0xc372('0x10'),auth[_0xc372('0xc')](),controller[_0xc372('0x14')]);router['put'](_0xc372('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc372('0x15')](_0xc372('0xe'),auth['isAuthenticated'](),controller[_0xc372('0x16')]);router['delete'](_0xc372('0x17'),auth['isAuthenticated'](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x65fc=['destroy','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','getSounds','post','create','/:id/sounds','addSound','put'];(function(_0x5f4ee5,_0x19182f){var _0x1c1fe5=function(_0x5ce2fb){while(--_0x5ce2fb){_0x5f4ee5['push'](_0x5f4ee5['shift']());}};_0x1c1fe5(++_0x19182f);}(_0x65fc,0x14d));var _0xc65f=function(_0x499f33,_0xc8c3d1){_0x499f33=_0x499f33-0x0;var _0x3c283a=_0x65fc[_0x499f33];return _0x3c283a;};'use strict';var multer=require(_0xc65f('0x0'));var util=require(_0xc65f('0x1'));var path=require(_0xc65f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc65f('0x3'));var router=express['Router']();var fs_extra=require(_0xc65f('0x4'));var auth=require(_0xc65f('0x5'));var interaction=require(_0xc65f('0x6'));var config=require(_0xc65f('0x7'));var controller=require(_0xc65f('0x8'));router[_0xc65f('0x9')]('/',auth[_0xc65f('0xa')](),controller[_0xc65f('0xb')]);router[_0xc65f('0x9')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller['show']);router[_0xc65f('0x9')]('/:id/sounds',auth[_0xc65f('0xa')](),controller[_0xc65f('0xd')]);router[_0xc65f('0xe')]('/',auth[_0xc65f('0xa')](),controller[_0xc65f('0xf')]);router[_0xc65f('0xe')](_0xc65f('0x10'),auth[_0xc65f('0xa')](),controller[_0xc65f('0x11')]);router[_0xc65f('0x12')]('/:id',auth[_0xc65f('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc65f('0x13')]);router[_0xc65f('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller['removeSound']);module[_0xc65f('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 319e546..08228d7 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 _0x42a6=['quietmp3','STRING','alpha','TIMESTAMP','BOOLEAN','exports','quietmp3nb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x42a6,0xd7));var _0x642a=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x42a6[_0x53e3de];return _0x7b905b;};'use strict';var Sequelize=require('sequelize');module[_0x642a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom','files','mp3nb',_0x642a('0x1'),_0x642a('0x2'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x642a('0x3')],'allowNull':!![]},'application':{'type':Sequelize[_0x642a('0x3')],'allowNull':!![]},'digit':{'type':Sequelize[_0x642a('0x3')],'allowNull':!![]},'sort':{'type':Sequelize[_0x642a('0x3')],'allowNull':!![],'defaultValue':_0x642a('0x4')},'format':{'type':Sequelize[_0x642a('0x3')],'allowNull':!![]},'stamp':{'type':_0x642a('0x5')},'defaultEntry':{'type':Sequelize[_0x642a('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x979b=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM'];(function(_0x21a8d6,_0x431ba4){var _0x46c3ab=function(_0x2b1b2c){while(--_0x2b1b2c){_0x21a8d6['push'](_0x21a8d6['shift']());}};_0x46c3ab(++_0x431ba4);}(_0x979b,0x19c));var _0xb979=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x979b[_0xdbe2de];return _0x2facd7;};'use strict';var Sequelize=require('sequelize');module[_0xb979('0x0')]={'name':{'type':Sequelize[_0xb979('0x1')],'allowNull':![],'unique':_0xb979('0x2')},'mode':{'type':Sequelize[_0xb979('0x3')](_0xb979('0x4'),_0xb979('0x5'),_0xb979('0x6'),_0xb979('0x7'),_0xb979('0x8'),_0xb979('0x9')),'allowNull':!![],'defaultValue':_0xb979('0x5')},'directory':{'type':Sequelize[_0xb979('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xb979('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb979('0x1')],'allowNull':!![],'defaultValue':_0xb979('0xa')},'format':{'type':Sequelize[_0xb979('0x1')],'allowNull':!![]},'stamp':{'type':_0xb979('0xb')},'defaultEntry':{'type':Sequelize[_0xb979('0xc')],'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 7b839bb..bb277ae 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 _0x31d3=['util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','index','map','VoiceMusicOnHold','fieldName','type','key','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','body','find','sequelize','transaction','files','root','server/files/moh','create','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','basename','format','%s.%s','symlinkSync','Sequelize','message','removeSound','id2','unlinkSync','getSounds','rawAttributes','pick','eml-format','rimraf','mustache'];(function(_0x5e4c60,_0x27fb14){var _0x50e15e=function(_0x51ad67){while(--_0x51ad67){_0x5e4c60['push'](_0x5e4c60['shift']());}};_0x50e15e(++_0x27fb14);}(_0x31d3,0x6c));var _0x331d=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x31d3[_0x1d8119];return _0x3e30f6;};'use strict';var emlformat=require(_0x331d('0x0'));var rimraf=require(_0x331d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x331d('0x2'));var util=require(_0x331d('0x3'));var path=require(_0x331d('0x4'));var sox=require(_0x331d('0x5'));var csv=require(_0x331d('0x6'));var ejs=require(_0x331d('0x7'));var fs=require('fs');var fs_extra=require(_0x331d('0x8'));var _=require('lodash');var squel=require(_0x331d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x331d('0xa'));var toCsv=require(_0x331d('0x6'));var querystring=require(_0x331d('0xb'));var Papa=require(_0x331d('0xc'));var Redis=require(_0x331d('0xd'));var authService=require(_0x331d('0xe'));var qs=require(_0x331d('0xf'));var as=require(_0x331d('0x10'));var hardwareService=require(_0x331d('0x11'));var logger=require(_0x331d('0x12'))('api');var utils=require(_0x331d('0x13'));var config=require(_0x331d('0x14'));var licenseUtil=require(_0x331d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e7081,_0x181379){_0x181379=_0x181379||0xcc;return function(_0x455b28){if(_0x455b28){return _0x4e7081[_0x331d('0x16')](_0x181379);}return _0x4e7081[_0x331d('0x17')](_0x181379)[_0x331d('0x18')]();};}function respondWithResult(_0x520853,_0x57121c){_0x57121c=_0x57121c||0xc8;return function(_0x1dde84){if(_0x1dde84){return _0x520853[_0x331d('0x17')](_0x57121c)[_0x331d('0x19')](_0x1dde84);}};}function respondWithFilteredResult(_0xd8e326,_0x36d9f0){return function(_0x603597){if(_0x603597){var _0x4fd0f6=typeof _0x36d9f0['offset']==='undefined'&&typeof _0x36d9f0[_0x331d('0x1a')]===_0x331d('0x1b');var _0x2788be=_0x603597['count'];var _0x1ebc07=_0x4fd0f6?0x0:_0x36d9f0[_0x331d('0x1c')];var _0x535cdb=_0x4fd0f6?_0x603597[_0x331d('0x1d')]:_0x36d9f0[_0x331d('0x1c')]+_0x36d9f0['limit'];var _0x1ba6fb;if(_0x535cdb>=_0x2788be){_0x535cdb=_0x2788be;_0x1ba6fb=0xc8;}else{_0x1ba6fb=0xce;}_0xd8e326[_0x331d('0x17')](_0x1ba6fb);return _0xd8e326[_0x331d('0x1e')](_0x331d('0x1f'),_0x1ebc07+'-'+_0x535cdb+'/'+_0x2788be)[_0x331d('0x19')](_0x603597);}return null;};}function patchUpdates(_0x3c396f){return function(_0x390d5b){try{jsonpatch['apply'](_0x390d5b,_0x3c396f,!![]);}catch(_0x12eb8e){return BPromise[_0x331d('0x20')](_0x12eb8e);}return _0x390d5b[_0x331d('0x21')]();};}function saveUpdates(_0xc88a84,_0x12a706){return function(_0x121e77){if(_0x121e77){return _0x121e77[_0x331d('0x22')](_0xc88a84)[_0x331d('0x23')](function(_0x46f117){return _0x46f117;});}return null;};}function removeEntity(_0x50643e,_0x265fe7){return function(_0x43d423){if(_0x43d423){return _0x43d423[_0x331d('0x24')]()[_0x331d('0x23')](function(){var _0x5e18cf=_0x43d423[_0x331d('0x25')]({'plain':!![]});var _0x309236=_0x331d('0x26');return db['UserProfileResource'][_0x331d('0x24')]({'where':{'type':_0x309236,'resourceId':_0x5e18cf['id']}})[_0x331d('0x23')](function(){return _0x43d423;});})[_0x331d('0x23')](function(){_0x50643e[_0x331d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7707d,_0xb6f3de){return function(_0xf030ec){if(!_0xf030ec){_0xb7707d[_0x331d('0x16')](0x194);}return _0xf030ec;};}function handleError(_0x2a9d44,_0x309cfa){_0x309cfa=_0x309cfa||0x1f4;return function(_0x525ea8){logger[_0x331d('0x27')](_0x525ea8[_0x331d('0x28')]);if(_0x525ea8['name']){delete _0x525ea8[_0x331d('0x29')];}_0x2a9d44['status'](_0x309cfa)['send'](_0x525ea8);};}exports[_0x331d('0x2a')]=function(_0x740f02,_0x2ea115){var _0x19a2cc={},_0x42fdbf={},_0x6ed1c1={'count':0x0,'rows':[]};var _0xe75d59=_[_0x331d('0x2b')](db[_0x331d('0x2c')]['rawAttributes'],function(_0x29321b){return{'name':_0x29321b[_0x331d('0x2d')],'type':_0x29321b[_0x331d('0x2e')][_0x331d('0x2f')]};});_0x42fdbf['model']=_[_0x331d('0x2b')](_0xe75d59,_0x331d('0x29'));_0x42fdbf['query']=_[_0x331d('0x30')](_0x740f02[_0x331d('0x31')]);_0x42fdbf['filters']=_['intersection'](_0x42fdbf['model'],_0x42fdbf['query']);_0x19a2cc['attributes']=_[_0x331d('0x32')](_0x42fdbf[_0x331d('0x33')],qs['fields'](_0x740f02[_0x331d('0x31')]['fields']));_0x19a2cc[_0x331d('0x34')]=_0x19a2cc[_0x331d('0x34')][_0x331d('0x35')]?_0x19a2cc[_0x331d('0x34')]:_0x42fdbf['model'];if(!_0x740f02[_0x331d('0x31')][_0x331d('0x36')](_0x331d('0x37'))){_0x19a2cc[_0x331d('0x1a')]=qs[_0x331d('0x1a')](_0x740f02['query'][_0x331d('0x1a')]);_0x19a2cc[_0x331d('0x1c')]=qs[_0x331d('0x1c')](_0x740f02[_0x331d('0x31')][_0x331d('0x1c')]);}_0x19a2cc[_0x331d('0x38')]=qs[_0x331d('0x39')](_0x740f02[_0x331d('0x31')][_0x331d('0x39')]);delete _0x740f02[_0x331d('0x31')][_0x331d('0x39')];_0x19a2cc[_0x331d('0x3a')]=qs[_0x331d('0x3b')](_['pick'](_0x740f02[_0x331d('0x31')],_0x42fdbf['filters']),_0xe75d59);if(_0x740f02['query'][_0x331d('0x3c')]){_0x19a2cc['where']=_[_0x331d('0x3d')](_0x19a2cc['where'],{'$or':_[_0x331d('0x2b')](_0xe75d59,function(_0x45128f){if(_0x45128f[_0x331d('0x2e')]!==_0x331d('0x3e')){var _0x1b1902={};_0x1b1902[_0x45128f[_0x331d('0x29')]]={'$like':'%'+_0x740f02[_0x331d('0x31')][_0x331d('0x3c')]+'%'};return _0x1b1902;}})});}_0x19a2cc=_[_0x331d('0x3d')]({},_0x19a2cc,_0x740f02[_0x331d('0x3f')]);var _0x4614c2={'where':_0x19a2cc['where']};return db['VoiceMusicOnHold'][_0x331d('0x1d')](_0x4614c2)[_0x331d('0x23')](function(_0x35aede){_0x6ed1c1[_0x331d('0x1d')]=_0x35aede;if(_0x740f02[_0x331d('0x31')][_0x331d('0x40')]){_0x19a2cc[_0x331d('0x41')]=[{'all':!![]}];}return db[_0x331d('0x2c')][_0x331d('0x42')](_0x19a2cc);})[_0x331d('0x23')](function(_0x5b52ab){_0x6ed1c1[_0x331d('0x43')]=_0x5b52ab;return _0x6ed1c1;})[_0x331d('0x23')](respondWithFilteredResult(_0x2ea115,_0x19a2cc))[_0x331d('0x44')](handleError(_0x2ea115,null));};exports[_0x331d('0x45')]=function(_0x5910b0,_0x5d5bc7){var _0x31bdb6={'raw':![],'where':{'id':_0x5910b0[_0x331d('0x46')]['id']}},_0x60b11e={};_0x60b11e[_0x331d('0x33')]=_[_0x331d('0x30')](db[_0x331d('0x2c')]['rawAttributes']);_0x60b11e['query']=_[_0x331d('0x30')](_0x5910b0[_0x331d('0x31')]);_0x60b11e[_0x331d('0x3b')]=_['intersection'](_0x60b11e[_0x331d('0x33')],_0x60b11e['query']);_0x31bdb6['attributes']=_[_0x331d('0x32')](_0x60b11e[_0x331d('0x33')],qs['fields'](_0x5910b0[_0x331d('0x31')][_0x331d('0x47')]));_0x31bdb6[_0x331d('0x34')]=_0x31bdb6['attributes']['length']?_0x31bdb6[_0x331d('0x34')]:_0x60b11e[_0x331d('0x33')];if(_0x5910b0['query']['includeAll']){_0x31bdb6[_0x331d('0x41')]=[{'all':!![]}];}_0x31bdb6=_[_0x331d('0x3d')]({},_0x31bdb6,_0x5910b0['options']);return db['VoiceMusicOnHold']['find'](_0x31bdb6)[_0x331d('0x23')](handleEntityNotFound(_0x5d5bc7,null))[_0x331d('0x23')](respondWithResult(_0x5d5bc7,null))[_0x331d('0x44')](handleError(_0x5d5bc7,null));};exports['update']=function(_0x1b055c,_0x469bdd){if(_0x1b055c['body']['id']){delete _0x1b055c[_0x331d('0x48')]['id'];}return db[_0x331d('0x2c')][_0x331d('0x49')]({'where':{'id':_0x1b055c['params']['id']}})['then'](handleEntityNotFound(_0x469bdd,null))[_0x331d('0x23')](saveUpdates(_0x1b055c[_0x331d('0x48')],null))[_0x331d('0x23')](respondWithResult(_0x469bdd,null))[_0x331d('0x44')](handleError(_0x469bdd,null));};exports['create']=function(_0x53631e,_0x5c3d98,_0xd89f07){return db[_0x331d('0x4a')][_0x331d('0x4b')](function(_0x41d3da){if(_0x53631e[_0x331d('0x48')]['mode']===_0x331d('0x4c')){_0x53631e[_0x331d('0x48')]['directory']=path['join'](config[_0x331d('0x4d')],_0x331d('0x4e'),_0x53631e[_0x331d('0x48')][_0x331d('0x29')]);}return db['VoiceMusicOnHold'][_0x331d('0x4f')](_0x53631e[_0x331d('0x48')],{'transaction':_0x41d3da})[_0x331d('0x23')](function(_0xb763c1){if(_0x53631e[_0x331d('0x48')][_0x331d('0x50')]===_0x331d('0x4c')){fs[_0x331d('0x51')](_0xb763c1[_0x331d('0x52')],parseInt(_0x331d('0x53'),0x8));}var _0x528703=_0x53631e[_0x331d('0x54')][_0x331d('0x25')]({'plain':!![]});if(!_0x528703)throw new Error(_0x331d('0x55'));if(_0x528703[_0x331d('0x56')]===_0x331d('0x54')){var _0x4dd2c8=_0xb763c1[_0x331d('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x331d('0x26'),'userProfileId':_0x528703['userProfileId']},'raw':!![]})[_0x331d('0x23')](function(_0x54da96){if(_0x54da96&&_0x54da96['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4dd2c8[_0x331d('0x29')],'resourceId':_0x4dd2c8['id'],'type':_0x54da96[_0x331d('0x29')],'sectionId':_0x54da96['id']},{})[_0x331d('0x23')](function(){return _0xb763c1;});}else{return _0xb763c1;}})['catch'](function(_0x2d5026){logger[_0x331d('0x27')](_0x331d('0x57'),_0x2d5026);});}return _0xb763c1;});})[_0x331d('0x23')](respondWithResult(_0x5c3d98,0xc9))[_0x331d('0x44')](handleError(_0x5c3d98,null));};exports[_0x331d('0x24')]=function(_0x594949,_0xca51de,_0x45be12){var _0x1da3d7;return db[_0x331d('0x2c')]['find']({'where':{'id':_0x594949[_0x331d('0x46')]['id']}})[_0x331d('0x23')](function(_0x18608e){if(_0x18608e){return db[_0x331d('0x4a')]['transaction'](function(_0x35ed03){return _0x18608e[_0x331d('0x24')]({'transaction':_0x35ed03,'raw':!![]})['then'](function(_0x111b32){if(_0x111b32[_0x331d('0x52')]){fs[_0x331d('0x58')](_0x111b32['directory'])[_0x331d('0x59')](function(_0x3d78a7){fs['unlinkSync'](path[_0x331d('0x5a')](_0x111b32[_0x331d('0x52')],_0x3d78a7));});fs['rmdirSync'](_0x111b32[_0x331d('0x52')]);}return _0x111b32;});})[_0x331d('0x44')](function(_0xe768b){throw new db['Sequelize'][(_0x331d('0x5b'))](_0xe768b['message']);});}})[_0x331d('0x23')](handleEntityNotFound(_0xca51de,null))[_0x331d('0x23')](removeEntity(_0xca51de,null))[_0x331d('0x44')](handleError(_0xca51de,null));};exports['addSound']=function(_0x9ab8d,_0xf9d68,_0x4821da){return db['sequelize'][_0x331d('0x4b')](function(_0x5d01df){var _0x207b5d;return db[_0x331d('0x2c')][_0x331d('0x49')]({'where':{'id':_0x9ab8d[_0x331d('0x46')]['id']}})[_0x331d('0x23')](function(_0x3c5f8e){if(_0x3c5f8e){_0x207b5d=_0x3c5f8e;return _0x3c5f8e[_0x331d('0x5c')](_0x9ab8d[_0x331d('0x48')]['id'],{'transaction':_0x5d01df});}})[_0x331d('0x23')](function(_0x59526f){if(_0x59526f){return db[_0x331d('0x5d')][_0x331d('0x5e')]({'where':{'id':_0x9ab8d['body']['id']},'attributes':['id',_0x331d('0x29'),_0x331d('0x5f'),_0x331d('0x60'),_0x331d('0x61')],'raw':!![]});}})[_0x331d('0x23')](function(_0x4a9325){if(_0x4a9325){var _0x4a3414=path[_0x331d('0x5a')](config[_0x331d('0x4d')],_0x331d('0x62'),util['format']('%s.%s',path[_0x331d('0x63')](_0x4a9325[_0x331d('0x5f')],path['extname'](_0x4a9325[_0x331d('0x5f')])),_0x4a9325[_0x331d('0x60')]));var _0x42f60c=path['join'](config[_0x331d('0x4d')],_0x331d('0x4e'),_0x207b5d['name'],util[_0x331d('0x64')](_0x331d('0x65'),_0x4a9325[_0x331d('0x29')],_0x4a9325['converted_format']));fs[_0x331d('0x66')](_0x4a3414,_0x42f60c);return _0x4a9325;}})['catch'](function(_0x419f3){throw new db[(_0x331d('0x67'))][(_0x331d('0x5b'))](_0x419f3[_0x331d('0x68')]);});})[_0x331d('0x23')](handleEntityNotFound(_0xf9d68,null))[_0x331d('0x23')](respondWithResult(_0xf9d68,0xc9))['catch'](handleError(_0xf9d68,null));};exports[_0x331d('0x69')]=function(_0x35a8ee,_0x1a463c,_0x169ae2){return db[_0x331d('0x4a')]['transaction'](function(_0x500585){var _0x2209d5;return db['VoiceMusicOnHold'][_0x331d('0x5e')]({'where':{'id':_0x35a8ee[_0x331d('0x46')]['id']}})[_0x331d('0x23')](handleEntityNotFound(_0x1a463c,null))[_0x331d('0x23')](function(_0x395cc3){if(_0x395cc3){_0x2209d5=_0x395cc3;return _0x395cc3[_0x331d('0x69')](_0x35a8ee[_0x331d('0x46')][_0x331d('0x6a')]);}})[_0x331d('0x23')](function(_0x2c8567){if(_0x2c8567){return db[_0x331d('0x5d')][_0x331d('0x5e')]({'where':{'id':_0x35a8ee['params'][_0x331d('0x6a')]},'attributes':['id','name',_0x331d('0x5f'),_0x331d('0x60'),_0x331d('0x61')],'raw':!![]});}})[_0x331d('0x23')](function(_0xe60447){if(_0xe60447){fs[_0x331d('0x6b')](path[_0x331d('0x5a')](_0x2209d5[_0x331d('0x52')],util[_0x331d('0x64')]('%s.%s',_0xe60447['name'],_0xe60447[_0x331d('0x60')])));return _0xe60447;}})['catch'](function(_0x91dc40){throw new db[(_0x331d('0x67'))][(_0x331d('0x5b'))](_0x91dc40['message']);});})[_0x331d('0x23')](handleEntityNotFound(_0x1a463c,null))[_0x331d('0x23')](respondWithStatusCode(_0x1a463c,0xcc))[_0x331d('0x44')](handleError(_0x1a463c,null));};exports[_0x331d('0x6c')]=function(_0x4392f2,_0x5ae565,_0x11a7e5){var _0x24b7a2={};var _0x160b34={};var _0x61f982;var _0x557d15;return db[_0x331d('0x2c')][_0x331d('0x5e')]({'where':{'id':_0x4392f2[_0x331d('0x46')]['id']}})[_0x331d('0x23')](handleEntityNotFound(_0x5ae565,null))[_0x331d('0x23')](function(_0x3bd274){if(_0x3bd274){_0x61f982=_0x3bd274;_0x160b34[_0x331d('0x33')]=_[_0x331d('0x30')](db[_0x331d('0x5d')][_0x331d('0x6d')]);_0x160b34[_0x331d('0x31')]=_[_0x331d('0x30')](_0x4392f2[_0x331d('0x31')]);_0x160b34[_0x331d('0x3b')]=_[_0x331d('0x32')](_0x160b34[_0x331d('0x33')],_0x160b34[_0x331d('0x31')]);_0x24b7a2[_0x331d('0x34')]=_[_0x331d('0x32')](_0x160b34[_0x331d('0x33')],qs[_0x331d('0x47')](_0x4392f2['query']['fields']));_0x24b7a2[_0x331d('0x34')]=_0x24b7a2[_0x331d('0x34')][_0x331d('0x35')]?_0x24b7a2[_0x331d('0x34')]:_0x160b34[_0x331d('0x33')];_0x24b7a2[_0x331d('0x38')]=qs[_0x331d('0x39')](_0x4392f2['query'][_0x331d('0x39')]);_0x24b7a2[_0x331d('0x3a')]=qs[_0x331d('0x3b')](_[_0x331d('0x6e')](_0x4392f2[_0x331d('0x31')],_0x160b34[_0x331d('0x3b')]));if(_0x4392f2['query'][_0x331d('0x3c')]){_0x24b7a2[_0x331d('0x3a')]=_[_0x331d('0x3d')](_0x24b7a2['where'],{'$or':_[_0x331d('0x2b')](_0x24b7a2[_0x331d('0x34')],function(_0x1184de){var _0x2f03a9={};_0x2f03a9[_0x1184de]={'$like':'%'+_0x4392f2['query'][_0x331d('0x3c')]+'%'};return _0x2f03a9;})});}_0x24b7a2=_['merge']({},_0x24b7a2,_0x4392f2[_0x331d('0x3f')]);return _0x61f982['getSounds'](_0x24b7a2);}})[_0x331d('0x23')](function(_0x3c8542){if(_0x3c8542){_0x557d15=_0x3c8542[_0x331d('0x35')];if(!_0x4392f2['query']['hasOwnProperty'](_0x331d('0x37'))){_0x24b7a2[_0x331d('0x1a')]=qs[_0x331d('0x1a')](_0x4392f2['query'][_0x331d('0x1a')]);_0x24b7a2[_0x331d('0x1c')]=qs['offset'](_0x4392f2['query']['offset']);}return _0x61f982[_0x331d('0x6c')](_0x24b7a2);}})['then'](function(_0x8accfd){if(_0x8accfd){return _0x8accfd?{'count':_0x557d15,'rows':_0x8accfd}:null;}})['then'](respondWithResult(_0x5ae565,null))[_0x331d('0x44')](handleError(_0x5ae565,null));}; \ No newline at end of file +var _0xad56=['rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','body','find','mode','files','root','create','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','symlinkSync','removeSound','id2','join','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','papaparse','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','Content-Range','reject','save','update','destroy','then','get','MusicOnHolds','error','stack','send','index','map','VoiceMusicOnHold'];(function(_0x452297,_0x491c35){var _0x39072b=function(_0x1f25e7){while(--_0x1f25e7){_0x452297['push'](_0x452297['shift']());}};_0x39072b(++_0x491c35);}(_0xad56,0xb6));var _0x6ad5=function(_0x17c7c2,_0x46b9ed){_0x17c7c2=_0x17c7c2-0x0;var _0x39b6f6=_0xad56[_0x17c7c2];return _0x39b6f6;};'use strict';var emlformat=require(_0x6ad5('0x0'));var rimraf=require(_0x6ad5('0x1'));var zipdir=require(_0x6ad5('0x2'));var jsonpatch=require(_0x6ad5('0x3'));var rp=require(_0x6ad5('0x4'));var moment=require(_0x6ad5('0x5'));var BPromise=require(_0x6ad5('0x6'));var Mustache=require(_0x6ad5('0x7'));var util=require(_0x6ad5('0x8'));var path=require(_0x6ad5('0x9'));var sox=require(_0x6ad5('0xa'));var csv=require('to-csv');var ejs=require(_0x6ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x6ad5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ad5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ad5('0xe'));var querystring=require('querystring');var Papa=require(_0x6ad5('0xf'));var Redis=require(_0x6ad5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6ad5('0x11'));var as=require(_0x6ad5('0x12'));var hardwareService=require(_0x6ad5('0x13'));var logger=require(_0x6ad5('0x14'))(_0x6ad5('0x15'));var utils=require(_0x6ad5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6ad5('0x17'));var db=require(_0x6ad5('0x18'))['db'];function respondWithStatusCode(_0x34c3f4,_0x415e64){_0x415e64=_0x415e64||0xcc;return function(_0x14dc66){if(_0x14dc66){return _0x34c3f4[_0x6ad5('0x19')](_0x415e64);}return _0x34c3f4[_0x6ad5('0x1a')](_0x415e64)[_0x6ad5('0x1b')]();};}function respondWithResult(_0x4a3005,_0x76290a){_0x76290a=_0x76290a||0xc8;return function(_0x423f63){if(_0x423f63){return _0x4a3005[_0x6ad5('0x1a')](_0x76290a)[_0x6ad5('0x1c')](_0x423f63);}};}function respondWithFilteredResult(_0x48044e,_0x7aefd8){return function(_0x1dc7ad){if(_0x1dc7ad){var _0x58b4fe=typeof _0x7aefd8['offset']===_0x6ad5('0x1d')&&typeof _0x7aefd8[_0x6ad5('0x1e')]==='undefined';var _0x15d725=_0x1dc7ad[_0x6ad5('0x1f')];var _0x1019c9=_0x58b4fe?0x0:_0x7aefd8[_0x6ad5('0x20')];var _0x103b29=_0x58b4fe?_0x1dc7ad[_0x6ad5('0x1f')]:_0x7aefd8[_0x6ad5('0x20')]+_0x7aefd8[_0x6ad5('0x1e')];var _0x5bfe88;if(_0x103b29>=_0x15d725){_0x103b29=_0x15d725;_0x5bfe88=0xc8;}else{_0x5bfe88=0xce;}_0x48044e[_0x6ad5('0x1a')](_0x5bfe88);return _0x48044e[_0x6ad5('0x21')](_0x6ad5('0x22'),_0x1019c9+'-'+_0x103b29+'/'+_0x15d725)['json'](_0x1dc7ad);}return null;};}function patchUpdates(_0x1e74a7){return function(_0xc3e05b){try{jsonpatch['apply'](_0xc3e05b,_0x1e74a7,!![]);}catch(_0x2d701c){return BPromise[_0x6ad5('0x23')](_0x2d701c);}return _0xc3e05b[_0x6ad5('0x24')]();};}function saveUpdates(_0x7beadf,_0x2b6106){return function(_0x4af840){if(_0x4af840){return _0x4af840[_0x6ad5('0x25')](_0x7beadf)['then'](function(_0x2dfe58){return _0x2dfe58;});}return null;};}function removeEntity(_0x3a0be7,_0xe73f33){return function(_0x53dd63){if(_0x53dd63){return _0x53dd63[_0x6ad5('0x26')]()[_0x6ad5('0x27')](function(){var _0xb19cae=_0x53dd63[_0x6ad5('0x28')]({'plain':!![]});var _0x11c7b4=_0x6ad5('0x29');return db['UserProfileResource'][_0x6ad5('0x26')]({'where':{'type':_0x11c7b4,'resourceId':_0xb19cae['id']}})['then'](function(){return _0x53dd63;});})[_0x6ad5('0x27')](function(){_0x3a0be7[_0x6ad5('0x1a')](0xcc)[_0x6ad5('0x1b')]();});}};}function handleEntityNotFound(_0x3b700d,_0x2db7e1){return function(_0x47fa96){if(!_0x47fa96){_0x3b700d[_0x6ad5('0x19')](0x194);}return _0x47fa96;};}function handleError(_0x31e46c,_0x132f2a){_0x132f2a=_0x132f2a||0x1f4;return function(_0x3b861b){logger[_0x6ad5('0x2a')](_0x3b861b[_0x6ad5('0x2b')]);if(_0x3b861b['name']){delete _0x3b861b['name'];}_0x31e46c[_0x6ad5('0x1a')](_0x132f2a)[_0x6ad5('0x2c')](_0x3b861b);};}exports[_0x6ad5('0x2d')]=function(_0x5f0bed,_0x29b131){var _0xd9a47f={},_0x21e19d={},_0x2a241f={'count':0x0,'rows':[]};var _0x240449=_[_0x6ad5('0x2e')](db[_0x6ad5('0x2f')][_0x6ad5('0x30')],function(_0x2bec9f){return{'name':_0x2bec9f[_0x6ad5('0x31')],'type':_0x2bec9f[_0x6ad5('0x32')][_0x6ad5('0x33')]};});_0x21e19d[_0x6ad5('0x34')]=_[_0x6ad5('0x2e')](_0x240449,_0x6ad5('0x35'));_0x21e19d['query']=_[_0x6ad5('0x36')](_0x5f0bed['query']);_0x21e19d[_0x6ad5('0x37')]=_[_0x6ad5('0x38')](_0x21e19d[_0x6ad5('0x34')],_0x21e19d[_0x6ad5('0x39')]);_0xd9a47f[_0x6ad5('0x3a')]=_[_0x6ad5('0x38')](_0x21e19d[_0x6ad5('0x34')],qs[_0x6ad5('0x3b')](_0x5f0bed['query'][_0x6ad5('0x3b')]));_0xd9a47f[_0x6ad5('0x3a')]=_0xd9a47f[_0x6ad5('0x3a')][_0x6ad5('0x3c')]?_0xd9a47f[_0x6ad5('0x3a')]:_0x21e19d[_0x6ad5('0x34')];if(!_0x5f0bed['query']['hasOwnProperty'](_0x6ad5('0x3d'))){_0xd9a47f[_0x6ad5('0x1e')]=qs[_0x6ad5('0x1e')](_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x1e')]);_0xd9a47f[_0x6ad5('0x20')]=qs[_0x6ad5('0x20')](_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x20')]);}_0xd9a47f['order']=qs[_0x6ad5('0x3e')](_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x3e')]);delete _0x5f0bed['query'][_0x6ad5('0x3e')];_0xd9a47f[_0x6ad5('0x3f')]=qs[_0x6ad5('0x37')](_[_0x6ad5('0x40')](_0x5f0bed['query'],_0x21e19d[_0x6ad5('0x37')]),_0x240449);if(_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x41')]){_0xd9a47f[_0x6ad5('0x3f')]=_[_0x6ad5('0x42')](_0xd9a47f['where'],{'$or':_[_0x6ad5('0x2e')](_0x240449,function(_0x338034){if(_0x338034[_0x6ad5('0x32')]!=='VIRTUAL'){var _0x1fa778={};_0x1fa778[_0x338034[_0x6ad5('0x35')]]={'$like':'%'+_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x41')]+'%'};return _0x1fa778;}})});}_0xd9a47f=_[_0x6ad5('0x42')]({},_0xd9a47f,_0x5f0bed[_0x6ad5('0x43')]);var _0xdfbf25={'where':_0xd9a47f['where']};return db[_0x6ad5('0x2f')][_0x6ad5('0x1f')](_0xdfbf25)['then'](function(_0x46308f){_0x2a241f[_0x6ad5('0x1f')]=_0x46308f;if(_0x5f0bed[_0x6ad5('0x39')][_0x6ad5('0x44')]){_0xd9a47f[_0x6ad5('0x45')]=[{'all':!![]}];}return db[_0x6ad5('0x2f')][_0x6ad5('0x46')](_0xd9a47f);})[_0x6ad5('0x27')](function(_0x2333e6){_0x2a241f[_0x6ad5('0x47')]=_0x2333e6;return _0x2a241f;})[_0x6ad5('0x27')](respondWithFilteredResult(_0x29b131,_0xd9a47f))[_0x6ad5('0x48')](handleError(_0x29b131,null));};exports['show']=function(_0x1bb09a,_0x1a28d3){var _0x569f32={'raw':![],'where':{'id':_0x1bb09a[_0x6ad5('0x49')]['id']}},_0x32cc32={};_0x32cc32[_0x6ad5('0x34')]=_['keys'](db[_0x6ad5('0x2f')][_0x6ad5('0x30')]);_0x32cc32[_0x6ad5('0x39')]=_[_0x6ad5('0x36')](_0x1bb09a[_0x6ad5('0x39')]);_0x32cc32[_0x6ad5('0x37')]=_[_0x6ad5('0x38')](_0x32cc32[_0x6ad5('0x34')],_0x32cc32[_0x6ad5('0x39')]);_0x569f32['attributes']=_[_0x6ad5('0x38')](_0x32cc32[_0x6ad5('0x34')],qs[_0x6ad5('0x3b')](_0x1bb09a[_0x6ad5('0x39')]['fields']));_0x569f32[_0x6ad5('0x3a')]=_0x569f32['attributes']['length']?_0x569f32['attributes']:_0x32cc32[_0x6ad5('0x34')];if(_0x1bb09a[_0x6ad5('0x39')][_0x6ad5('0x44')]){_0x569f32['include']=[{'all':!![]}];}_0x569f32=_[_0x6ad5('0x42')]({},_0x569f32,_0x1bb09a[_0x6ad5('0x43')]);return db[_0x6ad5('0x2f')]['find'](_0x569f32)[_0x6ad5('0x27')](handleEntityNotFound(_0x1a28d3,null))[_0x6ad5('0x27')](respondWithResult(_0x1a28d3,null))[_0x6ad5('0x48')](handleError(_0x1a28d3,null));};exports[_0x6ad5('0x25')]=function(_0x354476,_0x1623a4){if(_0x354476[_0x6ad5('0x4a')]['id']){delete _0x354476['body']['id'];}return db[_0x6ad5('0x2f')][_0x6ad5('0x4b')]({'where':{'id':_0x354476['params']['id']}})[_0x6ad5('0x27')](handleEntityNotFound(_0x1623a4,null))[_0x6ad5('0x27')](saveUpdates(_0x354476[_0x6ad5('0x4a')],null))[_0x6ad5('0x27')](respondWithResult(_0x1623a4,null))[_0x6ad5('0x48')](handleError(_0x1623a4,null));};exports['create']=function(_0x22cd62,_0x3e5b91,_0x42133e){return db['sequelize']['transaction'](function(_0x311c4e){if(_0x22cd62['body'][_0x6ad5('0x4c')]===_0x6ad5('0x4d')){_0x22cd62['body']['directory']=path['join'](config[_0x6ad5('0x4e')],'server/files/moh',_0x22cd62[_0x6ad5('0x4a')][_0x6ad5('0x35')]);}return db[_0x6ad5('0x2f')][_0x6ad5('0x4f')](_0x22cd62['body'],{'transaction':_0x311c4e})[_0x6ad5('0x27')](function(_0x390bc7){if(_0x22cd62['body'][_0x6ad5('0x4c')]===_0x6ad5('0x4d')){fs[_0x6ad5('0x50')](_0x390bc7[_0x6ad5('0x51')],parseInt(_0x6ad5('0x52'),0x8));}var _0x11e98d=_0x22cd62[_0x6ad5('0x53')]['get']({'plain':!![]});if(!_0x11e98d)throw new Error(_0x6ad5('0x54'));if(_0x11e98d['role']===_0x6ad5('0x53')){var _0x581542=_0x390bc7[_0x6ad5('0x28')]({'plain':!![]});return db[_0x6ad5('0x55')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x11e98d[_0x6ad5('0x56')]},'raw':!![]})[_0x6ad5('0x27')](function(_0x5a372b){if(_0x5a372b&&_0x5a372b[_0x6ad5('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x581542[_0x6ad5('0x35')],'resourceId':_0x581542['id'],'type':_0x5a372b[_0x6ad5('0x35')],'sectionId':_0x5a372b['id']},{})[_0x6ad5('0x27')](function(){return _0x390bc7;});}else{return _0x390bc7;}})[_0x6ad5('0x48')](function(_0x5524a7){logger['error'](_0x6ad5('0x58'),_0x5524a7);});}return _0x390bc7;});})[_0x6ad5('0x27')](respondWithResult(_0x3e5b91,0xc9))[_0x6ad5('0x48')](handleError(_0x3e5b91,null));};exports[_0x6ad5('0x26')]=function(_0x209e73,_0x4ba959,_0x38b069){var _0x5489c2;return db[_0x6ad5('0x2f')][_0x6ad5('0x4b')]({'where':{'id':_0x209e73['params']['id']}})[_0x6ad5('0x27')](function(_0x8bebf3){if(_0x8bebf3){return db[_0x6ad5('0x59')][_0x6ad5('0x5a')](function(_0x242fe7){return _0x8bebf3[_0x6ad5('0x26')]({'transaction':_0x242fe7,'raw':!![]})['then'](function(_0xe04ee4){if(_0xe04ee4[_0x6ad5('0x51')]){fs[_0x6ad5('0x5b')](_0xe04ee4['directory'])[_0x6ad5('0x5c')](function(_0x7611ae){fs[_0x6ad5('0x5d')](path['join'](_0xe04ee4['directory'],_0x7611ae));});fs[_0x6ad5('0x5e')](_0xe04ee4[_0x6ad5('0x51')]);}return _0xe04ee4;});})[_0x6ad5('0x48')](function(_0xb1d6e5){throw new db[(_0x6ad5('0x5f'))][(_0x6ad5('0x60'))](_0xb1d6e5[_0x6ad5('0x61')]);});}})[_0x6ad5('0x27')](handleEntityNotFound(_0x4ba959,null))[_0x6ad5('0x27')](removeEntity(_0x4ba959,null))[_0x6ad5('0x48')](handleError(_0x4ba959,null));};exports[_0x6ad5('0x62')]=function(_0x4f2665,_0x57d739,_0x430a42){return db[_0x6ad5('0x59')][_0x6ad5('0x5a')](function(_0x1c6b81){var _0x3341c1;return db[_0x6ad5('0x2f')][_0x6ad5('0x4b')]({'where':{'id':_0x4f2665[_0x6ad5('0x49')]['id']}})[_0x6ad5('0x27')](function(_0x471a03){if(_0x471a03){_0x3341c1=_0x471a03;return _0x471a03[_0x6ad5('0x62')](_0x4f2665[_0x6ad5('0x4a')]['id'],{'transaction':_0x1c6b81});}})[_0x6ad5('0x27')](function(_0x16894b){if(_0x16894b){return db[_0x6ad5('0x63')][_0x6ad5('0x64')]({'where':{'id':_0x4f2665['body']['id']},'attributes':['id',_0x6ad5('0x35'),_0x6ad5('0x65'),_0x6ad5('0x66'),_0x6ad5('0x67')],'raw':!![]});}})['then'](function(_0x290a36){if(_0x290a36){var _0x11b066=path['join'](config[_0x6ad5('0x4e')],_0x6ad5('0x68'),util[_0x6ad5('0x69')](_0x6ad5('0x6a'),path['basename'](_0x290a36['save_name'],path[_0x6ad5('0x6b')](_0x290a36[_0x6ad5('0x65')])),_0x290a36[_0x6ad5('0x66')]));var _0x4d8df9=path['join'](config[_0x6ad5('0x4e')],_0x6ad5('0x6c'),_0x3341c1[_0x6ad5('0x35')],util[_0x6ad5('0x69')](_0x6ad5('0x6a'),_0x290a36[_0x6ad5('0x35')],_0x290a36[_0x6ad5('0x66')]));fs[_0x6ad5('0x6d')](_0x11b066,_0x4d8df9);return _0x290a36;}})[_0x6ad5('0x48')](function(_0x215cc1){throw new db[(_0x6ad5('0x5f'))][(_0x6ad5('0x60'))](_0x215cc1[_0x6ad5('0x61')]);});})['then'](handleEntityNotFound(_0x57d739,null))[_0x6ad5('0x27')](respondWithResult(_0x57d739,0xc9))[_0x6ad5('0x48')](handleError(_0x57d739,null));};exports[_0x6ad5('0x6e')]=function(_0x554b55,_0x2955ab,_0x15477f){return db[_0x6ad5('0x59')]['transaction'](function(_0x3a63f4){var _0x14594e;return db[_0x6ad5('0x2f')]['findOne']({'where':{'id':_0x554b55[_0x6ad5('0x49')]['id']}})[_0x6ad5('0x27')](handleEntityNotFound(_0x2955ab,null))[_0x6ad5('0x27')](function(_0x382a96){if(_0x382a96){_0x14594e=_0x382a96;return _0x382a96['removeSound'](_0x554b55[_0x6ad5('0x49')]['id2']);}})[_0x6ad5('0x27')](function(_0x41b308){if(_0x41b308){return db[_0x6ad5('0x63')][_0x6ad5('0x64')]({'where':{'id':_0x554b55[_0x6ad5('0x49')][_0x6ad5('0x6f')]},'attributes':['id',_0x6ad5('0x35'),_0x6ad5('0x65'),_0x6ad5('0x66'),_0x6ad5('0x67')],'raw':!![]});}})[_0x6ad5('0x27')](function(_0x2ba12c){if(_0x2ba12c){fs['unlinkSync'](path[_0x6ad5('0x70')](_0x14594e[_0x6ad5('0x51')],util['format'](_0x6ad5('0x6a'),_0x2ba12c[_0x6ad5('0x35')],_0x2ba12c['converted_format'])));return _0x2ba12c;}})[_0x6ad5('0x48')](function(_0x17f8bc){throw new db['Sequelize']['ValidationError'](_0x17f8bc[_0x6ad5('0x61')]);});})[_0x6ad5('0x27')](handleEntityNotFound(_0x2955ab,null))[_0x6ad5('0x27')](respondWithStatusCode(_0x2955ab,0xcc))[_0x6ad5('0x48')](handleError(_0x2955ab,null));};exports['getSounds']=function(_0x5a3020,_0xb660cf,_0x46b672){var _0x7678a4={};var _0x33bb0a={};var _0x38e6a3;var _0x1445bf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5a3020[_0x6ad5('0x49')]['id']}})[_0x6ad5('0x27')](handleEntityNotFound(_0xb660cf,null))[_0x6ad5('0x27')](function(_0xd65981){if(_0xd65981){_0x38e6a3=_0xd65981;_0x33bb0a[_0x6ad5('0x34')]=_['keys'](db[_0x6ad5('0x63')]['rawAttributes']);_0x33bb0a['query']=_[_0x6ad5('0x36')](_0x5a3020[_0x6ad5('0x39')]);_0x33bb0a[_0x6ad5('0x37')]=_[_0x6ad5('0x38')](_0x33bb0a['model'],_0x33bb0a[_0x6ad5('0x39')]);_0x7678a4['attributes']=_[_0x6ad5('0x38')](_0x33bb0a[_0x6ad5('0x34')],qs[_0x6ad5('0x3b')](_0x5a3020[_0x6ad5('0x39')]['fields']));_0x7678a4[_0x6ad5('0x3a')]=_0x7678a4[_0x6ad5('0x3a')][_0x6ad5('0x3c')]?_0x7678a4[_0x6ad5('0x3a')]:_0x33bb0a['model'];_0x7678a4[_0x6ad5('0x71')]=qs[_0x6ad5('0x3e')](_0x5a3020[_0x6ad5('0x39')]['sort']);_0x7678a4[_0x6ad5('0x3f')]=qs[_0x6ad5('0x37')](_[_0x6ad5('0x40')](_0x5a3020[_0x6ad5('0x39')],_0x33bb0a['filters']));if(_0x5a3020['query']['filter']){_0x7678a4['where']=_[_0x6ad5('0x42')](_0x7678a4[_0x6ad5('0x3f')],{'$or':_[_0x6ad5('0x2e')](_0x7678a4[_0x6ad5('0x3a')],function(_0x360792){var _0xba5f15={};_0xba5f15[_0x360792]={'$like':'%'+_0x5a3020['query'][_0x6ad5('0x41')]+'%'};return _0xba5f15;})});}_0x7678a4=_[_0x6ad5('0x42')]({},_0x7678a4,_0x5a3020[_0x6ad5('0x43')]);return _0x38e6a3['getSounds'](_0x7678a4);}})['then'](function(_0x4b2fbd){if(_0x4b2fbd){_0x1445bf=_0x4b2fbd['length'];if(!_0x5a3020[_0x6ad5('0x39')][_0x6ad5('0x72')](_0x6ad5('0x3d'))){_0x7678a4[_0x6ad5('0x1e')]=qs[_0x6ad5('0x1e')](_0x5a3020[_0x6ad5('0x39')][_0x6ad5('0x1e')]);_0x7678a4['offset']=qs[_0x6ad5('0x20')](_0x5a3020[_0x6ad5('0x39')][_0x6ad5('0x20')]);}return _0x38e6a3['getSounds'](_0x7678a4);}})[_0x6ad5('0x27')](function(_0xd6501a){if(_0xd6501a){return _0xd6501a?{'count':_0x1445bf,'rows':_0xd6501a}:null;}})[_0x6ad5('0x27')](respondWithResult(_0xb660cf,null))['catch'](handleError(_0xb660cf,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9eb0909..37c5296 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 _0xaa1d=['VoiceMusicOnHold','util','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x30c32a,_0x3cd413){var _0x12f330=function(_0x2f38f3){while(--_0x2f38f3){_0x30c32a['push'](_0x30c32a['shift']());}};_0x12f330(++_0x3cd413);}(_0xaa1d,0xf4));var _0xdaa1=function(_0x36fe59,_0x244914){_0x36fe59=_0x36fe59-0x0;var _0x5a1158=_0xaa1d[_0x36fe59];return _0x5a1158;};'use strict';var _=require('lodash');var util=require(_0xdaa1('0x0'));var logger=require('../../config/logger')(_0xdaa1('0x1'));var moment=require(_0xdaa1('0x2'));var BPromise=require(_0xdaa1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaa1('0x4'));var config=require(_0xdaa1('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xdaa1('0x6')]=function(_0x48464b,_0x38389a){return _0x48464b[_0xdaa1('0x7')](_0xdaa1('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6734=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger','api','moment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6734,0x18f));var _0x4673=function(_0x501695,_0xda9d02){_0x501695=_0x501695-0x0;var _0xca4b6c=_0x6734[_0x501695];return _0xca4b6c;};'use strict';var _=require('lodash');var util=require(_0x4673('0x0'));var logger=require(_0x4673('0x1'))(_0x4673('0x2'));var moment=require(_0x4673('0x3'));var BPromise=require(_0x4673('0x4'));var rp=require(_0x4673('0x5'));var fs=require('fs');var path=require(_0x4673('0x6'));var rimraf=require(_0x4673('0x7'));var config=require(_0x4673('0x8'));var attributes=require(_0x4673('0x9'));module[_0x4673('0xa')]=function(_0x5637b2,_0x525e2c){return _0x5637b2[_0x4673('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x4673('0xc'),'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 bccbae9..e08b7c8 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 _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(_0x1327f3,_0x47c691){var _0x259aa3=function(_0x5c3293){while(--_0x5c3293){_0x1327f3['push'](_0x1327f3['shift']());}};_0x259aa3(++_0x47c691);}(_0x70e0,0x17b));var _0x070e=function(_0x41a3f2,_0x709166){_0x41a3f2=_0x41a3f2-0x0;var _0x59251f=_0x70e0[_0x41a3f2];return _0x59251f;};'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 +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4407c8,_0x39bb90){var _0x41b22f=function(_0x547865){while(--_0x547865){_0x4407c8['push'](_0x4407c8['shift']());}};_0x41b22f(++_0x39bb90);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3ef321d..d7841ad 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 _0xd295=['/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','put','/:id','update','delete','destroy','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4348bd,_0x383a93){var _0x18bc66=function(_0x28d2e7){while(--_0x28d2e7){_0x4348bd['push'](_0x4348bd['shift']());}};_0x18bc66(++_0x383a93);}(_0xd295,0x145));var _0x5d29=function(_0x5cd832,_0x329c09){_0x5cd832=_0x5cd832-0x0;var _0x480c0e=_0xd295[_0x5cd832];return _0x480c0e;};'use strict';var multer=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var path=require(_0x5d29('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d29('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5d29('0x4'));var config=require(_0x5d29('0x5'));var controller=require(_0x5d29('0x6'));router[_0x5d29('0x7')]('/',auth[_0x5d29('0x8')](),controller[_0x5d29('0x9')]);router[_0x5d29('0x7')](_0x5d29('0xa'),auth[_0x5d29('0x8')](),controller[_0x5d29('0xb')]);router[_0x5d29('0x7')]('/:id',auth[_0x5d29('0x8')](),controller[_0x5d29('0xc')]);router[_0x5d29('0x7')](_0x5d29('0xd'),auth[_0x5d29('0x8')](),controller[_0x5d29('0xe')]);router[_0x5d29('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5d29('0xf')]);router[_0x5d29('0x10')]('/',auth[_0x5d29('0x8')](),controller[_0x5d29('0x11')]);router[_0x5d29('0x10')](_0x5d29('0xd'),auth[_0x5d29('0x8')](),controller[_0x5d29('0x12')]);router[_0x5d29('0x10')](_0x5d29('0x13'),auth['isAuthenticated'](),controller[_0x5d29('0x14')]);router[_0x5d29('0x15')](_0x5d29('0x16'),auth[_0x5d29('0x8')](),controller[_0x5d29('0x17')]);router[_0x5d29('0x18')](_0x5d29('0x16'),auth[_0x5d29('0x8')](),controller[_0x5d29('0x19')]);router[_0x5d29('0x18')](_0x5d29('0xd'),auth[_0x5d29('0x8')](),controller['removeAgents']);router[_0x5d29('0x18')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0xd24d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeAgents','multer','util','express','Router'];(function(_0x2cae2e,_0x4f24ce){var _0x1f86df=function(_0x5e4d48){while(--_0x5e4d48){_0x2cae2e['push'](_0x2cae2e['shift']());}};_0x1f86df(++_0x4f24ce);}(_0xd24d,0x168));var _0xdd24=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd24d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xdd24('0x0'));var util=require(_0xdd24('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd24('0x2'));var router=express[_0xdd24('0x3')]();var fs_extra=require(_0xdd24('0x4'));var auth=require(_0xdd24('0x5'));var interaction=require(_0xdd24('0x6'));var config=require(_0xdd24('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdd24('0x8')]);router[_0xdd24('0x9')](_0xdd24('0xa'),auth[_0xdd24('0xb')](),controller[_0xdd24('0xc')]);router[_0xdd24('0x9')](_0xdd24('0xd'),auth['isAuthenticated'](),controller[_0xdd24('0xe')]);router[_0xdd24('0x9')](_0xdd24('0xf'),auth[_0xdd24('0xb')](),controller['getAgents']);router['get'](_0xdd24('0x10'),auth[_0xdd24('0xb')](),controller[_0xdd24('0x11')]);router[_0xdd24('0x12')]('/',auth['isAuthenticated'](),controller[_0xdd24('0x13')]);router[_0xdd24('0x12')]('/:id/users',auth[_0xdd24('0xb')](),controller[_0xdd24('0x14')]);router[_0xdd24('0x12')](_0xdd24('0x10'),auth['isAuthenticated'](),controller[_0xdd24('0x15')]);router[_0xdd24('0x16')](_0xdd24('0xd'),auth[_0xdd24('0xb')](),controller[_0xdd24('0x17')]);router[_0xdd24('0x18')](_0xdd24('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xdd24('0xf'),auth['isAuthenticated'](),controller[_0xdd24('0x19')]);router['delete']('/:id/teams',auth[_0xdd24('0xb')](),controller['removeTeams']);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 c5d65e0..3717803 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 _0xcbfc=['VIRTUAL','getDataValue','INTEGER','STRING','name'];(function(_0x367648,_0x1ec395){var _0x4741a1=function(_0x1e7f4d){while(--_0x1e7f4d){_0x367648['push'](_0x367648['shift']());}};_0x4741a1(++_0x1ec395);}(_0xcbfc,0x80));var _0xccbf=function(_0x45810d,_0xaed5ea){_0x45810d=_0x45810d-0x0;var _0x1ea558=_0xcbfc[_0x45810d];return _0x1ea558;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xccbf('0x0')],'allowNull':![],'unique':_0xccbf('0x1')},'prefix':{'type':Sequelize[_0xccbf('0x2')],'get':function(_0xebbf32){return'system-'+this[_0xccbf('0x3')](_0xccbf('0x1'))+'-';}},'description':{'type':Sequelize[_0xccbf('0x0')]},'callerIdAll':{'type':Sequelize[_0xccbf('0x0')]},'VoiceExtensionId':{'type':Sequelize[_0xccbf('0x4')]}}; \ No newline at end of file +var _0xcb23=['name','getDataValue','STRING','INTEGER','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcb23,0x86));var _0x3cb2=function(_0x5de208,_0x717fcb){_0x5de208=_0x5de208-0x0;var _0x51e0d6=_0xcb23[_0x5de208];return _0x51e0d6;};'use strict';var Sequelize=require('sequelize');module[_0x3cb2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3cb2('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x53474d){return'system-'+this[_0x3cb2('0x2')](_0x3cb2('0x1'))+'-';}},'description':{'type':Sequelize[_0x3cb2('0x3')]},'callerIdAll':{'type':Sequelize[_0x3cb2('0x3')]},'VoiceExtensionId':{'type':Sequelize[_0x3cb2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 29acc8c..a429b70 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x5075db,_0x102927){var _0x5aeae1=function(_0x22d94e){while(--_0x22d94e){_0x5075db['push'](_0x5075db['shift']());}};_0x5aeae1(++_0x102927);}(_0x2032,0xd9));var _0x2203=function(_0x73d52a,_0x407758){_0x73d52a=_0x73d52a-0x0;var _0x3c1f53=_0x2032[_0x73d52a];return _0x3c1f53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xfff0,0x139));var _0x0fff=function(_0x206da5,_0x56a4a9){_0x206da5=_0x206da5-0x0;var _0x48c510=_0xfff0[_0x206da5];return _0x48c510;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 65cb41d..1c1959b 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 _0x5249=['emit','hook','exports','events','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x54fd29,_0x4b6f05){var _0x3b4928=function(_0x5a039e){while(--_0x5a039e){_0x54fd29['push'](_0x54fd29['shift']());}};_0x3b4928(++_0x4b6f05);}(_0x5249,0x12c));var _0x9524=function(_0x354346,_0x13776d){_0x354346=_0x354346-0x0;var _0x538283=_0x5249[_0x354346];return _0x538283;};'use strict';var EventEmitter=require(_0x9524('0x0'));var VoicePrefix=require(_0x9524('0x1'))['db'][_0x9524('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9524('0x3'),'afterUpdate':_0x9524('0x4'),'afterDestroy':_0x9524('0x5')};function emitEvent(_0x3e6bf0){return function(_0xe768c5,_0x8181b2,_0x19f553){VoicePrefixEvents['emit'](_0x3e6bf0+':'+_0xe768c5['id'],_0xe768c5);VoicePrefixEvents[_0x9524('0x6')](_0x3e6bf0,_0xe768c5);_0x19f553(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x9524('0x7')](e,emitEvent(event));}}module[_0x9524('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x8876=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8876,0xb3));var _0x6887=function(_0x3deb78,_0x5b8496){_0x3deb78=_0x3deb78-0x0;var _0x4d9808=_0x8876[_0x3deb78];return _0x4d9808;};'use strict';var EventEmitter=require(_0x6887('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x6887('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6887('0x2')](0x0);var events={'afterCreate':_0x6887('0x3'),'afterUpdate':_0x6887('0x4'),'afterDestroy':_0x6887('0x5')};function emitEvent(_0x1e3db8){return function(_0x490ba2,_0x26a64f,_0x33c6ce){VoicePrefixEvents['emit'](_0x1e3db8+':'+_0x490ba2['id'],_0x490ba2);VoicePrefixEvents[_0x6887('0x6')](_0x1e3db8,_0x490ba2);_0x33c6ce(null);};}for(var e in events){if(events[_0x6887('0x7')](e)){var event=events[e];VoicePrefix[_0x6887('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9ee57db..26e80e6 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 _0x0d45=['request-promise','path','rimraf','../../config/environment','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x2058ee,_0x43c288){var _0x4bf31f=function(_0x38d2dd){while(--_0x38d2dd){_0x2058ee['push'](_0x2058ee['shift']());}};_0x4bf31f(++_0x43c288);}(_0x0d45,0x166));var _0x50d4=function(_0x10c6ef,_0x5534fe){_0x10c6ef=_0x10c6ef-0x0;var _0x160322=_0x0d45[_0x10c6ef];return _0x160322;};'use strict';var _=require(_0x50d4('0x0'));var util=require(_0x50d4('0x1'));var logger=require(_0x50d4('0x2'))(_0x50d4('0x3'));var moment=require(_0x50d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x50d4('0x5'));var fs=require('fs');var path=require(_0x50d4('0x6'));var rimraf=require(_0x50d4('0x7'));var config=require(_0x50d4('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0xcddda0,_0xd8d07b){return _0xcddda0['define'](_0x50d4('0x9'),attributes,{'tableName':_0x50d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b6=['VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x90b6,0xb8));var _0x690b=function(_0x4286b0,_0x36d618){_0x4286b0=_0x4286b0-0x0;var _0x5dafe0=_0x90b6[_0x4286b0];return _0x5dafe0;};'use strict';var _=require('lodash');var util=require(_0x690b('0x0'));var logger=require(_0x690b('0x1'))(_0x690b('0x2'));var moment=require(_0x690b('0x3'));var BPromise=require('bluebird');var rp=require(_0x690b('0x4'));var fs=require('fs');var path=require(_0x690b('0x5'));var rimraf=require(_0x690b('0x6'));var config=require(_0x690b('0x7'));var attributes=require(_0x690b('0x8'));module[_0x690b('0x9')]=function(_0x34e7fa,_0x338e11){return _0x34e7fa[_0x690b('0xa')](_0x690b('0xb'),attributes,{'tableName':_0x690b('0xc'),'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 1ee26fd..11aad2d 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 _0x3646=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3646,0x15f));var _0x6364=function(_0x419197,_0x2052f3){_0x419197=_0x419197-0x0;var _0x23863c=_0x3646[_0x419197];return _0x23863c;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var moment=require(_0x6364('0x2'));var BPromise=require(_0x6364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6364('0x4'));var db=require(_0x6364('0x5'))['db'];var utils=require(_0x6364('0x6'));var logger=require(_0x6364('0x7'))(_0x6364('0x8'));var config=require(_0x6364('0x9'));var jayson=require(_0x6364('0xa'));var client=jayson[_0x6364('0xb')][_0x6364('0xc')]({'port':0x232a});config[_0x6364('0xd')]=_[_0x6364('0xe')](config['redis'],{'host':_0x6364('0xf'),'port':0x18eb});var socket=require(_0x6364('0x10'))(new Redis(config[_0x6364('0xd')]));require(_0x6364('0x11'))['register'](socket);function respondWithRpcPromise(_0x4bf364,_0x51998c,_0x2d4bbc){return new BPromise(function(_0xfc1996,_0x4646a5){return client[_0x6364('0x12')](_0x4bf364,_0x2d4bbc)[_0x6364('0x13')](function(_0x34de37){logger[_0x6364('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x51998c,_0x6364('0x15'));logger[_0x6364('0x16')](_0x6364('0x17'),_0x51998c,'request\x20sent',JSON[_0x6364('0x18')](_0x34de37));if(_0x34de37[_0x6364('0x19')]){if(_0x34de37[_0x6364('0x19')][_0x6364('0x1a')]===0x1f4){logger['error'](_0x6364('0x1b'),_0x51998c,_0x34de37['error'][_0x6364('0x1c')]);return _0x4646a5(_0x34de37[_0x6364('0x19')][_0x6364('0x1c')]);}logger['error'](_0x6364('0x1b'),_0x51998c,_0x34de37[_0x6364('0x19')][_0x6364('0x1c')]);return _0xfc1996(_0x34de37[_0x6364('0x19')][_0x6364('0x1c')]);}else{logger[_0x6364('0x14')](_0x6364('0x1b'),_0x51998c,'request\x20sent');_0xfc1996(_0x34de37[_0x6364('0x1d')]['message']);}})[_0x6364('0x1e')](function(_0x120401){logger[_0x6364('0x19')](_0x6364('0x1b'),_0x51998c,_0x120401);_0x4646a5(_0x120401);});});} \ No newline at end of file +var _0xb934=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xeb2de,_0xae7120){var _0x527953=function(_0x17a0bf){while(--_0x17a0bf){_0xeb2de['push'](_0xeb2de['shift']());}};_0x527953(++_0xae7120);}(_0xb934,0x92));var _0x4b93=function(_0x6abc9e,_0x597db5){_0x6abc9e=_0x6abc9e-0x0;var _0xe047ab=_0xb934[_0x6abc9e];return _0xe047ab;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var moment=require(_0x4b93('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b93('0x3'));var fs=require('fs');var Redis=require(_0x4b93('0x4'));var db=require(_0x4b93('0x5'))['db'];var utils=require(_0x4b93('0x6'));var logger=require(_0x4b93('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b93('0x8'));var client=jayson[_0x4b93('0x9')][_0x4b93('0xa')]({'port':0x232a});config[_0x4b93('0xb')]=_['defaults'](config[_0x4b93('0xb')],{'host':_0x4b93('0xc'),'port':0x18eb});var socket=require(_0x4b93('0xd'))(new Redis(config[_0x4b93('0xb')]));require(_0x4b93('0xe'))[_0x4b93('0xf')](socket);function respondWithRpcPromise(_0x10a47b,_0x15ad72,_0x254572){return new BPromise(function(_0x50a74d,_0x2c33cc){return client[_0x4b93('0x10')](_0x10a47b,_0x254572)[_0x4b93('0x11')](function(_0xfb8b42){logger[_0x4b93('0x12')](_0x4b93('0x13'),_0x15ad72,_0x4b93('0x14'));logger[_0x4b93('0x15')](_0x4b93('0x16'),_0x15ad72,_0x4b93('0x14'),JSON[_0x4b93('0x17')](_0xfb8b42));if(_0xfb8b42[_0x4b93('0x18')]){if(_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x19')]===0x1f4){logger[_0x4b93('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x15ad72,_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x1a')]);return _0x2c33cc(_0xfb8b42[_0x4b93('0x18')]['message']);}logger[_0x4b93('0x18')](_0x4b93('0x13'),_0x15ad72,_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x1a')]);return _0x50a74d(_0xfb8b42[_0x4b93('0x18')]['message']);}else{logger[_0x4b93('0x12')](_0x4b93('0x13'),_0x15ad72,'request\x20sent');_0x50a74d(_0xfb8b42['result'][_0x4b93('0x1a')]);}})[_0x4b93('0x1b')](function(_0x12f944){logger[_0x4b93('0x18')](_0x4b93('0x13'),_0x15ad72,_0x12f944);_0x2c33cc(_0x12f944);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a7e9387..f7c293d 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 _0xb903=['update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0xb903,0x185));var _0x3b90=function(_0x43ff9c,_0x5a769a){_0x43ff9c=_0x43ff9c-0x0;var _0x13aa44=_0xb903[_0x43ff9c];return _0x13aa44;};'use strict';var VoicePrefixEvents=require(_0x3b90('0x0'));var events=[_0x3b90('0x1'),_0x3b90('0x2'),_0x3b90('0x3')];function createListener(_0x5191d8,_0x3312ca){return function(_0xf414f4){_0x3312ca[_0x3b90('0x4')](_0x5191d8,_0xf414f4);};}function removeListener(_0x1cd5d8,_0x30d8db){return function(){VoicePrefixEvents[_0x3b90('0x5')](_0x1cd5d8,_0x30d8db);};}exports[_0x3b90('0x6')]=function(_0x5acd76){for(var _0x15b68f=0x0,_0x5e845a=events['length'];_0x15b68f<_0x5e845a;_0x15b68f++){var _0x153283=events[_0x15b68f];var _0x2e4c06=createListener(_0x3b90('0x7')+_0x153283,_0x5acd76);VoicePrefixEvents['on'](_0x153283,_0x2e4c06);}}; \ No newline at end of file +var _0xe739=['length','voicePrefix:','./voicePrefix.events','remove','update','removeListener','register'];(function(_0x54cd16,_0x326222){var _0x10875b=function(_0x141ee2){while(--_0x141ee2){_0x54cd16['push'](_0x54cd16['shift']());}};_0x10875b(++_0x326222);}(_0xe739,0x105));var _0x9e73=function(_0x2176b1,_0x33267e){_0x2176b1=_0x2176b1-0x0;var _0x2b514a=_0xe739[_0x2176b1];return _0x2b514a;};'use strict';var VoicePrefixEvents=require(_0x9e73('0x0'));var events=['save',_0x9e73('0x1'),_0x9e73('0x2')];function createListener(_0x2dc1a9,_0x508042){return function(_0x54a986){_0x508042['emit'](_0x2dc1a9,_0x54a986);};}function removeListener(_0x3bbc00,_0x43c2e8){return function(){VoicePrefixEvents[_0x9e73('0x3')](_0x3bbc00,_0x43c2e8);};}exports[_0x9e73('0x4')]=function(_0x4cb2ed){for(var _0x3db8fa=0x0,_0x26cb5b=events[_0x9e73('0x5')];_0x3db8fa<_0x26cb5b;_0x3db8fa++){var _0x5e46e7=events[_0x3db8fa];var _0xa49f86=createListener(_0x9e73('0x6')+_0x5e46e7,_0x4cb2ed);VoicePrefixEvents['on'](_0x5e46e7,_0xa49f86);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bb07f32..fb6b531 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2fc8db,_0x2f7b47){var _0x527ad9=function(_0x30d1d6){while(--_0x30d1d6){_0x2fc8db['push'](_0x2fc8db['shift']());}};_0x527ad9(++_0x2f7b47);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c60ef,_0x51da79){_0x1c60ef=_0x1c60ef-0x0;var _0x5b6b80=_0xb10b[_0x1c60ef];return _0x5b6b80;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b26ec40..ae64ad9 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 _0x7278=['yes','all','once','TEXT','periodic_announce','joinempty','split','leavewhenempty','join','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7278,0x82));var _0x8727=function(_0x5159eb,_0x574797){_0x5159eb=_0x5159eb-0x0;var _0x2bca28=_0x7278[_0x5159eb];return _0x2bca28;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'name':{'type':Sequelize[_0x8727('0x2')],'allowNull':![],'unique':_0x8727('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x5'),_0x8727('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x8727('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x8727('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8727('0x4')]('rr','ringall',_0x8727('0x7'),'fewestcalls',_0x8727('0x8'),_0x8727('0x9'),_0x8727('0xa'),_0x8727('0xb'),_0x8727('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1c8db2){this[_0x8727('0xd')](_0x8727('0xe'),_0x1c8db2?_0x1c8db2:_0x8727('0x9'));},'get':function(){var _0x374a74=this[_0x8727('0xf')](_0x8727('0x10'));var _0x532a04=this[_0x8727('0xf')](_0x8727('0x11'));var _0x2ae796=this['getDataValue'](_0x8727('0xe'));if(_0x374a74===_0x8727('0x5')){return _0x2ae796;}if(_0x532a04===_0x8727('0x12')&&_0x2ae796===_0x8727('0x9')||_0x532a04===_0x8727('0x12')&&_0x2ae796===_0x8727('0x13')){return _0x2ae796;}if(_0x532a04===_0x8727('0x14')||_0x532a04===_0x8727('0x15')||_0x532a04===_0x8727('0x16')){return _0x2ae796;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8727('0x17')](0xb)},'timeout':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8727('0x2')]},'weight':{'type':Sequelize[_0x8727('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x8727('0x18'),'no',_0x8727('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8727('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x8727('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8727('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8727('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8727('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8727('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':_0x8727('0x18')},'announce_holdtime':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no',_0x8727('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8727('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x8727('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8727('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8727('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8727('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8727('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8727('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8727('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x8727('0x1b')],'set':function(_0x769d02){this[_0x8727('0xd')](_0x8727('0x1c'),_0x769d02?_0x769d02['join'](','):[]);},'get':function(){return this['getDataValue'](_0x8727('0x1c'))?this[_0x8727('0xf')](_0x8727('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x8727('0x2')],'defaultValue':_0x8727('0x18'),'set':function(_0x5d0d2c){this['setDataValue'](_0x8727('0x1d'),_0x5d0d2c?_0x5d0d2c['join'](','):undefined);},'get':function(){return this[_0x8727('0xf')]('joinempty')?this[_0x8727('0xf')]('joinempty')[_0x8727('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x685f85){this[_0x8727('0xd')](_0x8727('0x1f'),_0x685f85?_0x685f85[_0x8727('0x20')](','):undefined);},'get':function(){return this[_0x8727('0xf')](_0x8727('0x1f'))?this[_0x8727('0xf')](_0x8727('0x1f'))[_0x8727('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8727('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8727('0x2')]},'acw':{'type':Sequelize[_0x8727('0x21')],'defaultValue':0x0,'set':function(_0x2b25be){this['setDataValue'](_0x8727('0x22'),_0x2b25be);if(_0x2b25be){if(this[_0x8727('0xf')](_0x8727('0x23'))<0x2){this[_0x8727('0xd')](_0x8727('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8727('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8727('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x8727('0x24'),'progressive','power',_0x8727('0x15'),_0x8727('0x12')),'defaultValue':_0x8727('0x14'),'comment':_0x8727('0x25')},'dialLimitChannel':{'type':Sequelize[_0x8727('0x17')](0x4)[_0x8727('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x8727('0x17')](0x4)[_0x8727('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8727('0x27')},'dialPowerLevel':{'type':Sequelize[_0x8727('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x8727('0x4')]('agentBusyFactor','dropRate'),'defaultValue':'dropRate','comment':_0x8727('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8727('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8727('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x8727('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8727('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8727('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x8727('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x2d')},'dialQueueProject':{'type':Sequelize[_0x8727('0x2')],'comment':_0x8727('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8727('0x26')],'defaultValue':0x3,'comment':_0x8727('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8727('0x34')},'dialTimezone':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8727('0x2')],'defaultValue':_0x8727('0x35')},'dialPrefix':{'type':Sequelize[_0x8727('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8727('0x4')](_0x8727('0x36'),'never','onlyIfOpen'),'defaultValue':_0x8727('0x36')},'dialAMDActive':{'type':Sequelize[_0x8727('0x21')],'defaultValue':0x0,'comment':_0x8727('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x8727('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8727('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8727('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8727('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8727('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8727('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8727('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8727('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8727('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8727('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8727('0x17')](0x9)[_0x8727('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8727('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x8727('0x21')],'defaultValue':0x0,'comment':_0x8727('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x8727('0x41')),'defaultValue':_0x8727('0x42')},'dialQueueProject2':{'type':Sequelize[_0x8727('0x2')],'comment':_0x8727('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8727('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8727('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8727('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8727('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8727('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8727('0x17')](0x5)[_0x8727('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8727('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8727('0x17')],'allowNull':!![],'comment':_0x8727('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x8727('0x21')],'defaultValue':![],'comment':_0x8727('0x4b'),'set':function(_0x54dcd3){if(!_0x54dcd3)this[_0x8727('0xd')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x8727('0x4c'),_0x54dcd3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8727('0x17')](0x3)[_0x8727('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8727('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8727('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x1e7d=['ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','random','linear','rrordered','setDataValue','rrmemory','getDataValue','strategy','booked','roundrobin','progressive','predictive','INTEGER','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','wrapuptime','BOOLEAN','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1e7d,0xa9));var _0xd1e7=function(_0x1eae95,_0x17662e){_0x1eae95=_0x1eae95-0x0;var _0xe80708=_0x1e7d[_0x1eae95];return _0xe80708;};'use strict';var Sequelize=require(_0xd1e7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1e7('0x1')],'allowNull':![],'unique':_0xd1e7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd1e7('0x3')]('inbound',_0xd1e7('0x4')),'allowNull':![],'defaultValue':_0xd1e7('0x5')},'musiconhold':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':_0xd1e7('0x6')},'announce':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd1e7('0x3')]('rr',_0xd1e7('0x7'),_0xd1e7('0x8'),'fewestcalls',_0xd1e7('0x9'),'rrmemory',_0xd1e7('0xa'),'wrandom',_0xd1e7('0xb')),'allowNull':![],'defaultValue':_0xd1e7('0x7'),'set':function(_0x369e6a){this[_0xd1e7('0xc')]('strategy',_0x369e6a?_0x369e6a:_0xd1e7('0xd'));},'get':function(){var _0x1cebc6=this[_0xd1e7('0xe')]('type');var _0x234729=this[_0xd1e7('0xe')]('dialMethod');var _0x5ca0a2=this[_0xd1e7('0xe')](_0xd1e7('0xf'));if(_0x1cebc6===_0xd1e7('0x5')){return _0x5ca0a2;}if(_0x234729===_0xd1e7('0x10')&&_0x5ca0a2===_0xd1e7('0xd')||_0x234729===_0xd1e7('0x10')&&_0x5ca0a2===_0xd1e7('0x11')){return _0x5ca0a2;}if(_0x234729===_0xd1e7('0x12')||_0x234729===_0xd1e7('0x13')||_0x234729==='power'){return _0x5ca0a2;}return null;}},'servicelevel':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd1e7('0x14')](0xb)},'timeout':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd1e7('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd1e7('0x3')]('yes','no'),'defaultValue':_0xd1e7('0x15')},'autopause':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd1e7('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd1e7('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd1e7('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd1e7('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xd1e7('0x15'),'no'),'defaultValue':_0xd1e7('0x15')},'announce_holdtime':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no',_0xd1e7('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xd1e7('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd1e7('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd1e7('0x1')]},'queue_youarenext':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd1e7('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd1e7('0x1')]},'queue_quantity1':{'type':Sequelize[_0xd1e7('0x1')]},'queue_quantity2':{'type':Sequelize[_0xd1e7('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xd1e7('0x1')]},'queue_less_than':{'type':Sequelize[_0xd1e7('0x1')]},'periodic_announce':{'type':Sequelize[_0xd1e7('0x17')],'set':function(_0x5a288d){this[_0xd1e7('0xc')](_0xd1e7('0x18'),_0x5a288d?_0x5a288d['join'](','):[]);},'get':function(){return this[_0xd1e7('0xe')]('periodic_announce')?this[_0xd1e7('0xe')]('periodic_announce')[_0xd1e7('0x19')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xd1e7('0x15'),'set':function(_0x35a8ce){this[_0xd1e7('0xc')](_0xd1e7('0x1a'),_0x35a8ce?_0x35a8ce[_0xd1e7('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xd1e7('0xe')](_0xd1e7('0x1a'))[_0xd1e7('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':'no','set':function(_0x5dd912){this[_0xd1e7('0xc')](_0xd1e7('0x1c'),_0x5dd912?_0x5dd912['join'](','):undefined);},'get':function(){return this[_0xd1e7('0xe')](_0xd1e7('0x1c'))?this[_0xd1e7('0xe')](_0xd1e7('0x1c'))[_0xd1e7('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd1e7('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd1e7('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2dba4e){this[_0xd1e7('0xc')]('acw',_0x2dba4e);if(_0x2dba4e){if(this[_0xd1e7('0xe')]('wrapuptime')<0x2){this[_0xd1e7('0xc')](_0xd1e7('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd1e7('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x1f'),'progressive',_0xd1e7('0x20'),_0xd1e7('0x13'),_0xd1e7('0x10')),'defaultValue':_0xd1e7('0x12'),'comment':_0xd1e7('0x21')},'dialLimitChannel':{'type':Sequelize[_0xd1e7('0x14')](0x4)[_0xd1e7('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd1e7('0x23')},'dialLimitQueue':{'type':Sequelize[_0xd1e7('0x14')](0x4)[_0xd1e7('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd1e7('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd1e7('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xd1e7('0x26'),_0xd1e7('0x27')),'defaultValue':_0xd1e7('0x27'),'comment':_0xd1e7('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd1e7('0x29')](0x2)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd1e7('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd1e7('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd1e7('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xd1e7('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'comment':_0xd1e7('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd1e7('0x32')},'dialTimezone':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':_0xd1e7('0x33')},'dialPrefix':{'type':Sequelize[_0xd1e7('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd1e7('0x3')](_0xd1e7('0x34'),'never','onlyIfOpen'),'defaultValue':_0xd1e7('0x34')},'dialAMDActive':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd1e7('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd1e7('0x35')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xd1e7('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd1e7('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd1e7('0x14')](0x9)[_0xd1e7('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd1e7('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0xd1e7('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd1e7('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd1e7('0x14')](0x9)[_0xd1e7('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd1e7('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd1e7('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd1e7('0x14')](0x9)[_0xd1e7('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd1e7('0x3a')},'dialRecallMeTimeout':{'type':Sequelize[_0xd1e7('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd1e7('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':0x0,'comment':_0xd1e7('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xd1e7('0x3d'),_0xd1e7('0x3e')),'defaultValue':_0xd1e7('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd1e7('0x3f')},'dialCutDigit':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd1e7('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd1e7('0x14')](0x5)[_0xd1e7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd1e7('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd1e7('0x14')],'allowNull':!![],'comment':_0xd1e7('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':![],'comment':_0xd1e7('0x4b'),'set':function(_0x7c2095){if(!_0x7c2095)this[_0xd1e7('0xc')]('mandatoryDispositionPauseId',null);this[_0xd1e7('0xc')](_0xd1e7('0x4c'),_0x7c2095);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd1e7('0x14')](0x3)[_0xd1e7('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xd1e7('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9b96957..9d03c9e 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 _0x23f4=['UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','VoiceQueues','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','push','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','phone','ContactId','ListId','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','QueueCampaigns','outbound','map','value','includes','type','find','name','UserProfileResource','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound'];(function(_0x360ad8,_0x5aec7a){var _0x5d4681=function(_0x14b81f){while(--_0x14b81f){_0x360ad8['push'](_0x360ad8['shift']());}};_0x5d4681(++_0x5aec7a);}(_0x23f4,0x1ee));var _0x423f=function(_0x159a10,_0x41b318){_0x159a10=_0x159a10-0x0;var _0x108526=_0x23f4[_0x159a10];return _0x108526;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x423f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x423f('0x1'));var moment=require(_0x423f('0x2'));var BPromise=require(_0x423f('0x3'));var Mustache=require(_0x423f('0x4'));var util=require(_0x423f('0x5'));var path=require(_0x423f('0x6'));var sox=require(_0x423f('0x7'));var csv=require(_0x423f('0x8'));var ejs=require(_0x423f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x423f('0xa'));var squel=require(_0x423f('0xb'));var crypto=require('crypto');var jsforce=require(_0x423f('0xc'));var deskjs=require(_0x423f('0xd'));var toCsv=require(_0x423f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x423f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x423f('0xf'));var hardwareService=require(_0x423f('0x10'));var logger=require(_0x423f('0x11'))(_0x423f('0x12'));var utils=require('../../config/utils');var config=require(_0x423f('0x13'));var licenseUtil=require(_0x423f('0x14'));var db=require(_0x423f('0x15'))['db'];config[_0x423f('0x16')]=_[_0x423f('0x17')](config['redis'],{'host':_0x423f('0x18'),'port':0x18eb});var socket=require(_0x423f('0x19'))(new Redis(config[_0x423f('0x16')]));require(_0x423f('0x1a'))[_0x423f('0x1b')](socket);function respondWithStatusCode(_0x3b531d,_0x1f6423){_0x1f6423=_0x1f6423||0xcc;return function(_0x21d804){if(_0x21d804){return _0x3b531d[_0x423f('0x1c')](_0x1f6423);}return _0x3b531d[_0x423f('0x1d')](_0x1f6423)[_0x423f('0x1e')]();};}function respondWithResult(_0x276be1,_0x14cba9){_0x14cba9=_0x14cba9||0xc8;return function(_0x1fef4d){if(_0x1fef4d){return _0x276be1[_0x423f('0x1d')](_0x14cba9)[_0x423f('0x1f')](_0x1fef4d);}};}function respondWithFilteredResult(_0x3fd56d,_0x34e968){return function(_0x26b6d1){if(_0x26b6d1){var _0x5424e6=typeof _0x34e968[_0x423f('0x20')]==='undefined'&&typeof _0x34e968['limit']===_0x423f('0x21');var _0x4956e0=_0x26b6d1[_0x423f('0x22')];var _0xd7b80e=_0x5424e6?0x0:_0x34e968['offset'];var _0x45b46d=_0x5424e6?_0x26b6d1[_0x423f('0x22')]:_0x34e968['offset']+_0x34e968[_0x423f('0x23')];var _0x2ebe74;if(_0x45b46d>=_0x4956e0){_0x45b46d=_0x4956e0;_0x2ebe74=0xc8;}else{_0x2ebe74=0xce;}_0x3fd56d['status'](_0x2ebe74);return _0x3fd56d[_0x423f('0x24')](_0x423f('0x25'),_0xd7b80e+'-'+_0x45b46d+'/'+_0x4956e0)['json'](_0x26b6d1);}return null;};}function patchUpdates(_0x54f47){return function(_0x5ec3a8){try{jsonpatch[_0x423f('0x26')](_0x5ec3a8,_0x54f47,!![]);}catch(_0x3c942e){return BPromise[_0x423f('0x27')](_0x3c942e);}return _0x5ec3a8[_0x423f('0x28')]();};}function saveUpdates(_0xb82e8d,_0x39e72d){return function(_0x14ef6c){if(_0x14ef6c){return _0x14ef6c[_0x423f('0x29')](_0xb82e8d)[_0x423f('0x2a')](function(_0x36f57f){return _0x36f57f;});}return null;};}function removeEntity(_0x45889f,_0x199196){return function(_0xb91ed8){if(_0xb91ed8){return _0xb91ed8[_0x423f('0x2b')]()['then'](function(){var _0x3308dd=_0xb91ed8[_0x423f('0x2c')]({'plain':!![]});var _0x1b347a=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e'),'ignore':![]}];var _0x323c61=_(_0x1b347a)['filter']('ignore')[_0x423f('0x2f')](_0x423f('0x30'))['value']();if(_[_0x423f('0x31')](_0x323c61,_0x3308dd[_0x423f('0x32')])){return;}var _0x3022a5=_[_0x423f('0x33')](_0x1b347a,['value',_0x3308dd[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x35')][_0x423f('0x2b')]({'where':{'type':_0x3022a5,'resourceId':_0x3308dd['id']}})['then'](function(){return _0xb91ed8;});})[_0x423f('0x2a')](function(){_0x45889f[_0x423f('0x1d')](0xcc)[_0x423f('0x1e')]();});}};}function handleEntityNotFound(_0x8e7bcb,_0x341728){return function(_0x29fe71){if(!_0x29fe71){_0x8e7bcb[_0x423f('0x1c')](0x194);}return _0x29fe71;};}function handleError(_0x40949b,_0x3d204a){_0x3d204a=_0x3d204a||0x1f4;return function(_0x9e562f){logger['error'](_0x9e562f[_0x423f('0x36')]);if(_0x9e562f[_0x423f('0x34')]){delete _0x9e562f[_0x423f('0x34')];}_0x40949b['status'](_0x3d204a)[_0x423f('0x37')](_0x9e562f);};}exports['index']=function(_0x228df0,_0x16fcad){var _0x2784c6={},_0x40ee34={},_0x145981={'count':0x0,'rows':[]};var _0x4a5134=_['map'](db[_0x423f('0x38')][_0x423f('0x39')],function(_0x239a49){return{'name':_0x239a49[_0x423f('0x3a')],'type':_0x239a49[_0x423f('0x32')][_0x423f('0x3b')]};});_0x40ee34[_0x423f('0x3c')]=_[_0x423f('0x2f')](_0x4a5134,_0x423f('0x34'));_0x40ee34[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x228df0[_0x423f('0x3d')]);_0x40ee34[_0x423f('0x3f')]=_['intersection'](_0x40ee34['model'],_0x40ee34[_0x423f('0x3d')]);_0x2784c6[_0x423f('0x40')]=_[_0x423f('0x41')](_0x40ee34[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x228df0['query'][_0x423f('0x42')]));_0x2784c6[_0x423f('0x40')]=_0x2784c6[_0x423f('0x40')][_0x423f('0x43')]?_0x2784c6[_0x423f('0x40')]:_0x40ee34[_0x423f('0x3c')];if(!_0x228df0[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x2784c6[_0x423f('0x23')]=qs['limit'](_0x228df0['query'][_0x423f('0x23')]);_0x2784c6[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x228df0[_0x423f('0x3d')][_0x423f('0x20')]);}_0x2784c6[_0x423f('0x46')]=qs['sort'](_0x228df0[_0x423f('0x3d')][_0x423f('0x47')]);_0x2784c6[_0x423f('0x48')]=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x228df0[_0x423f('0x3d')],_0x40ee34[_0x423f('0x3f')]),_0x4a5134);if(_0x228df0[_0x423f('0x3d')]['filter']){_0x2784c6[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x2784c6[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x4a5134,function(_0x33d324){if(_0x33d324[_0x423f('0x32')]!==_0x423f('0x4b')){var _0xbd33af={};_0xbd33af[_0x33d324[_0x423f('0x34')]]={'$like':'%'+_0x228df0['query'][_0x423f('0x4c')]+'%'};return _0xbd33af;}})});}_0x2784c6=_['merge']({},_0x2784c6,_0x228df0[_0x423f('0x4d')]);var _0x2e0fc8={'where':_0x2784c6[_0x423f('0x48')]};return db[_0x423f('0x38')][_0x423f('0x22')](_0x2e0fc8)[_0x423f('0x2a')](function(_0x3087e4){_0x145981[_0x423f('0x22')]=_0x3087e4;if(_0x228df0[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2784c6[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x38')][_0x423f('0x50')](_0x2784c6);})[_0x423f('0x2a')](function(_0xa7708c){_0x145981[_0x423f('0x51')]=_0xa7708c;return _0x145981;})[_0x423f('0x2a')](respondWithFilteredResult(_0x16fcad,_0x2784c6))[_0x423f('0x52')](handleError(_0x16fcad,null));};exports[_0x423f('0x53')]=function(_0x2145a5,_0x580db1){var _0x2e824d={'raw':![],'where':{'id':_0x2145a5[_0x423f('0x54')]['id']}},_0x47fcda={};_0x47fcda[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x38')][_0x423f('0x39')]);_0x47fcda[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x2145a5[_0x423f('0x3d')]);_0x47fcda[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x47fcda[_0x423f('0x3c')],_0x47fcda[_0x423f('0x3d')]);_0x2e824d['attributes']=_[_0x423f('0x41')](_0x47fcda[_0x423f('0x3c')],qs['fields'](_0x2145a5[_0x423f('0x3d')]['fields']));_0x2e824d[_0x423f('0x40')]=_0x2e824d['attributes']['length']?_0x2e824d[_0x423f('0x40')]:_0x47fcda[_0x423f('0x3c')];if(_0x2145a5[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2e824d['include']=[{'all':!![]}];}_0x2e824d=_[_0x423f('0x4a')]({},_0x2e824d,_0x2145a5['options']);return db[_0x423f('0x38')][_0x423f('0x33')](_0x2e824d)[_0x423f('0x2a')](handleEntityNotFound(_0x580db1,null))[_0x423f('0x2a')](respondWithResult(_0x580db1,null))[_0x423f('0x52')](handleError(_0x580db1,null));};exports[_0x423f('0x55')]=function(_0x106142,_0x248f22){return db[_0x423f('0x38')]['create'](_0x106142[_0x423f('0x56')],{})[_0x423f('0x2a')](function(_0x59a117){var _0x23a96a=_0x106142['user'][_0x423f('0x2c')]({'plain':!![]});if(!_0x23a96a)throw new Error(_0x423f('0x57'));if(_0x23a96a[_0x423f('0x58')]===_0x423f('0x59')){var _0x3b92bd=_0x59a117[_0x423f('0x2c')]({'plain':!![]});var _0x54f56a=[{'name':'VoiceQueues','value':_0x423f('0x5a')},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e')}];var _0x3959ce=_[_0x423f('0x33')](_0x54f56a,[_0x423f('0x30'),_0x3b92bd[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x5b')]['find']({'where':{'name':_0x3959ce,'userProfileId':_0x23a96a[_0x423f('0x5c')]},'raw':!![]})[_0x423f('0x2a')](function(_0x50686e){if(_0x50686e&&_0x50686e[_0x423f('0x5d')]===0x0){return db['UserProfileResource'][_0x423f('0x55')]({'name':_0x3b92bd[_0x423f('0x34')],'resourceId':_0x3b92bd['id'],'type':_0x50686e[_0x423f('0x34')],'sectionId':_0x50686e['id']},{})['then'](function(){return _0x59a117;});}else{return _0x59a117;}})['catch'](function(_0x208839){logger[_0x423f('0x5e')](_0x423f('0x5f'),_0x208839);throw _0x208839;});}return _0x59a117;})['then'](respondWithResult(_0x248f22,0xc9))[_0x423f('0x52')](handleError(_0x248f22,null));};exports[_0x423f('0x60')]=function(_0x270d28,_0x46ba2b){var _0xc5f895={'where':{'id':_0x270d28[_0x423f('0x54')]['id']}},_0x3ffe6f={};_0x3ffe6f['model']=_[_0x423f('0x3e')](db['VoiceQueue'][_0x423f('0x39')]);_0xc5f895[_0x423f('0x40')]=_[_0x423f('0x41')](_0x3ffe6f[_0x423f('0x3c')],qs['fields'](_0x270d28[_0x423f('0x3d')][_0x423f('0x42')]));_0xc5f895[_0x423f('0x40')]=_0xc5f895['attributes'][_0x423f('0x43')]?_0xc5f895[_0x423f('0x40')]:_0x3ffe6f['model'];if(_0x270d28[_0x423f('0x3d')][_0x423f('0x4e')]){_0xc5f895['include']=[{'all':!![]}];}_0xc5f895=_['merge']({},_0xc5f895,_0x270d28['options']);return db[_0x423f('0x38')][_0x423f('0x33')](_0xc5f895)[_0x423f('0x2a')](handleEntityNotFound(_0x46ba2b,null))[_0x423f('0x2a')](function(_0x587682){if(_0x587682){var _0x4fa0ef=_0x587682[_0x423f('0x2c')]({'plain':!![]});_0x4fa0ef=qs[_0x423f('0x61')](_0x4fa0ef,['id','createdAt',_0x423f('0x62')]);_0x270d28[_0x423f('0x56')]=_[_0x423f('0x61')](_0x270d28[_0x423f('0x56')],['id',_0x423f('0x63'),_0x423f('0x62')]);return db[_0x423f('0x38')]['create'](_[_0x423f('0x4a')](_0x4fa0ef,_0x270d28[_0x423f('0x56')]),{'include':_0x270d28['query'][_0x423f('0x4e')]?[{'all':!![]}]:undefined})[_0x423f('0x2a')](function(_0x3e5d47){var _0x5ce420=_0x270d28[_0x423f('0x59')][_0x423f('0x2c')]({'plain':!![]});if(!_0x5ce420)throw new Error(_0x423f('0x57'));if(_0x5ce420[_0x423f('0x58')]===_0x423f('0x59')){var _0x4a161d=_0x3e5d47[_0x423f('0x2c')]({'plain':!![]});var _0x106709=[{'name':_0x423f('0x64'),'value':'inbound'},{'name':_0x423f('0x2d'),'value':_0x423f('0x2e')}];var _0x25e123=_[_0x423f('0x33')](_0x106709,['value',_0x4a161d[_0x423f('0x32')]])[_0x423f('0x34')];return db[_0x423f('0x5b')][_0x423f('0x33')]({'where':{'name':_0x25e123,'userProfileId':_0x5ce420[_0x423f('0x5c')]},'raw':!![]})[_0x423f('0x2a')](function(_0x2a77fc){if(_0x2a77fc&&_0x2a77fc['autoAssociation']===0x0){return db[_0x423f('0x35')][_0x423f('0x55')]({'name':_0x4a161d[_0x423f('0x34')],'resourceId':_0x4a161d['id'],'type':_0x2a77fc[_0x423f('0x34')],'sectionId':_0x2a77fc['id']},{})['then'](function(){return _0x3e5d47;});}else{return _0x3e5d47;}})[_0x423f('0x52')](function(_0x405811){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x405811);throw _0x405811;});}return _0x3e5d47;});}})[_0x423f('0x2a')](respondWithResult(_0x46ba2b,0xc9))[_0x423f('0x52')](handleError(_0x46ba2b,null));};exports[_0x423f('0x29')]=function(_0x599a45,_0x2dadb6){if(_0x599a45[_0x423f('0x56')]['id']){delete _0x599a45[_0x423f('0x56')]['id'];}return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x599a45[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2dadb6,null))['then'](saveUpdates(_0x599a45[_0x423f('0x56')],null))['then'](respondWithResult(_0x2dadb6,null))['catch'](handleError(_0x2dadb6,null));};exports[_0x423f('0x2b')]=function(_0x1f6750,_0x4fd2e1){return db[_0x423f('0x38')][_0x423f('0x33')]({'where':{'id':_0x1f6750['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4fd2e1,null))[_0x423f('0x2a')](removeEntity(_0x4fd2e1,null))[_0x423f('0x52')](handleError(_0x4fd2e1,null));};exports[_0x423f('0x65')]=function(_0x233afe,_0x2519b5,_0x31fc04){var _0x5b9577={'raw':![],'where':{}};var _0x4e1e04={};var _0xd9409e={'count':0x0,'rows':[]};return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x233afe[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2519b5,null))['then'](function(_0x3583f8){if(_0x3583f8){_0x4e1e04[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x67')][_0x423f('0x39')]);_0x4e1e04[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x233afe[_0x423f('0x3d')]);_0x4e1e04[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x4e1e04[_0x423f('0x3c')],_0x4e1e04[_0x423f('0x3d')]);_0x5b9577[_0x423f('0x40')]=_['intersection'](_0x4e1e04[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x233afe[_0x423f('0x3d')][_0x423f('0x42')]));_0x5b9577[_0x423f('0x40')]=_0x5b9577['attributes'][_0x423f('0x43')]?_0x5b9577[_0x423f('0x40')]:_0x4e1e04[_0x423f('0x3c')];if(!_0x233afe[_0x423f('0x3d')]['hasOwnProperty'](_0x423f('0x45'))){_0x5b9577[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x233afe[_0x423f('0x3d')][_0x423f('0x23')]);_0x5b9577[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x233afe[_0x423f('0x3d')][_0x423f('0x20')]);}_0x5b9577[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x233afe[_0x423f('0x3d')][_0x423f('0x47')]);_0x5b9577[_0x423f('0x48')]=qs['filters'](_[_0x423f('0x49')](_0x233afe['query'],_0x4e1e04['filters']));_0x5b9577[_0x423f('0x48')][_0x423f('0x68')]=_0x3583f8['id'];if(_0x233afe[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5b9577['where']=_[_0x423f('0x4a')](_0x5b9577['where'],{'$or':_[_0x423f('0x2f')](_0x5b9577[_0x423f('0x40')],function(_0x3dee3b){var _0x2da8ff={};_0x2da8ff[_0x3dee3b]={'$like':'%'+_0x233afe[_0x423f('0x3d')]['filter']+'%'};return _0x2da8ff;})});}_0x5b9577=_[_0x423f('0x4a')]({},_0x5b9577,_0x233afe['options']);return db[_0x423f('0x67')]['count']({'where':_0x5b9577[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x1990ec){_0xd9409e['count']=_0x1990ec;if(_0x233afe[_0x423f('0x3d')][_0x423f('0x4e')]){_0x5b9577[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x67')]['findAll'](_0x5b9577);})[_0x423f('0x2a')](function(_0x376326){_0xd9409e['rows']=_0x376326;return _0xd9409e;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x2519b5,_0x5b9577))[_0x423f('0x52')](handleError(_0x2519b5,null));};exports[_0x423f('0x69')]=function(_0x3737b6,_0x36241e,_0x2bb2ba){var _0x140db1={'raw':!![],'where':{}};var _0x33d4e4={};var _0x2ede33={'count':0x0,'rows':[]};return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x3737b6['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x36241e,null))['then'](function(_0x25a4e1){if(_0x25a4e1){_0x33d4e4['model']=_['keys'](db[_0x423f('0x6a')][_0x423f('0x39')]);_0x33d4e4[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x3737b6[_0x423f('0x3d')]);_0x33d4e4[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x33d4e4['model'],_0x33d4e4[_0x423f('0x3d')]);_0x140db1[_0x423f('0x40')]=_['intersection'](_0x33d4e4[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x3737b6[_0x423f('0x3d')][_0x423f('0x42')]));_0x140db1['attributes']=_0x140db1['attributes'][_0x423f('0x43')]?_0x140db1[_0x423f('0x40')]:_0x33d4e4[_0x423f('0x3c')];if(!_0x3737b6[_0x423f('0x3d')]['hasOwnProperty'](_0x423f('0x45'))){_0x140db1[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x3737b6['query'][_0x423f('0x23')]);_0x140db1['offset']=qs[_0x423f('0x20')](_0x3737b6[_0x423f('0x3d')][_0x423f('0x20')]);}_0x140db1[_0x423f('0x46')]=qs['sort'](_0x3737b6[_0x423f('0x3d')][_0x423f('0x47')]);_0x140db1['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x3737b6[_0x423f('0x3d')],_0x33d4e4[_0x423f('0x3f')]));_0x140db1[_0x423f('0x48')]['VoiceQueueId']=_0x25a4e1['id'];if(_0x3737b6[_0x423f('0x3d')][_0x423f('0x4c')]){_0x140db1[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x140db1['where'],{'$or':_['map'](_0x140db1[_0x423f('0x40')],function(_0x3d3722){var _0x2ed8ed={};_0x2ed8ed[_0x3d3722]={'$like':'%'+_0x3737b6[_0x423f('0x3d')]['filter']+'%'};return _0x2ed8ed;})});}_0x140db1=_[_0x423f('0x4a')]({},_0x140db1,_0x3737b6['options']);return db[_0x423f('0x6a')][_0x423f('0x22')]({'where':_0x140db1[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x23e5a6){_0x2ede33[_0x423f('0x22')]=_0x23e5a6;if(_0x3737b6[_0x423f('0x3d')]['includeAll']){_0x140db1[_0x423f('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x140db1);})[_0x423f('0x2a')](function(_0x34d1cd){_0x2ede33[_0x423f('0x51')]=_0x34d1cd;return _0x2ede33;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x36241e,_0x140db1))[_0x423f('0x52')](handleError(_0x36241e,null));};exports[_0x423f('0x6b')]=function(_0x1c30fb,_0x42e7ec,_0x20430d){var _0x2648e6={'raw':!![],'where':{}};var _0x28c8ba={};var _0x1671d6={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1c30fb[_0x423f('0x54')]['id']}})['then'](handleEntityNotFound(_0x42e7ec,null))['then'](function(_0x63d36f){if(_0x63d36f){_0x28c8ba[_0x423f('0x3c')]=_[_0x423f('0x3e')](db['CmHopperFinal']['rawAttributes']);_0x28c8ba[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x1c30fb[_0x423f('0x3d')]);_0x28c8ba['filters']=_['intersection'](_0x28c8ba[_0x423f('0x3c')],_0x28c8ba[_0x423f('0x3d')]);_0x2648e6[_0x423f('0x40')]=_[_0x423f('0x41')](_0x28c8ba[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x1c30fb[_0x423f('0x3d')]['fields']));_0x2648e6[_0x423f('0x40')]=_0x2648e6[_0x423f('0x40')][_0x423f('0x43')]?_0x2648e6['attributes']:_0x28c8ba[_0x423f('0x3c')];if(!_0x1c30fb['query']['hasOwnProperty'](_0x423f('0x45'))){_0x2648e6[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x1c30fb[_0x423f('0x3d')][_0x423f('0x23')]);_0x2648e6[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x1c30fb[_0x423f('0x3d')][_0x423f('0x20')]);}_0x2648e6['order']=qs[_0x423f('0x47')](_0x1c30fb['query'][_0x423f('0x47')]);_0x2648e6['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x1c30fb[_0x423f('0x3d')],_0x28c8ba['filters']));_0x2648e6[_0x423f('0x48')][_0x423f('0x68')]=_0x63d36f['id'];if(_0x1c30fb['query'][_0x423f('0x4c')]){_0x2648e6['where']=_[_0x423f('0x4a')](_0x2648e6[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x2648e6[_0x423f('0x40')],function(_0x177730){var _0x2ff3fd={};_0x2ff3fd[_0x177730]={'$like':'%'+_0x1c30fb[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2ff3fd;})});}_0x2648e6=_['merge']({},_0x2648e6,_0x1c30fb['options']);return db[_0x423f('0x6c')][_0x423f('0x22')]({'where':_0x2648e6['where']})[_0x423f('0x2a')](function(_0xcbeb5f){_0x1671d6[_0x423f('0x22')]=_0xcbeb5f;if(_0x1c30fb[_0x423f('0x3d')][_0x423f('0x4e')]){_0x2648e6[_0x423f('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x423f('0x50')](_0x2648e6);})[_0x423f('0x2a')](function(_0x2165cd){_0x1671d6[_0x423f('0x51')]=_0x2165cd;return _0x1671d6;});}})['then'](respondWithFilteredResult(_0x42e7ec,_0x2648e6))['catch'](handleError(_0x42e7ec,null));};exports[_0x423f('0x6d')]=function(_0x585e5e,_0x5aebea,_0x59a8e7){var _0x3ae7f2={'raw':!![],'where':{}};var _0x151cae={};var _0x9baaf2={'count':0x0,'rows':[]};return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x585e5e[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x5aebea,null))[_0x423f('0x2a')](function(_0x2e8fce){if(_0x2e8fce){_0x151cae[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x6e')][_0x423f('0x39')]);_0x151cae[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x585e5e['query']);_0x151cae[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x151cae[_0x423f('0x3c')],_0x151cae['query']);_0x3ae7f2[_0x423f('0x40')]=_[_0x423f('0x41')](_0x151cae[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x585e5e[_0x423f('0x3d')][_0x423f('0x42')]));_0x3ae7f2[_0x423f('0x40')]=_0x3ae7f2['attributes']['length']?_0x3ae7f2[_0x423f('0x40')]:_0x151cae[_0x423f('0x3c')];if(!_0x585e5e[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x3ae7f2[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x585e5e[_0x423f('0x3d')][_0x423f('0x23')]);_0x3ae7f2[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x585e5e[_0x423f('0x3d')]['offset']);}_0x3ae7f2[_0x423f('0x46')]=qs['sort'](_0x585e5e[_0x423f('0x3d')][_0x423f('0x47')]);_0x3ae7f2['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x585e5e['query'],_0x151cae[_0x423f('0x3f')]));_0x3ae7f2[_0x423f('0x48')][_0x423f('0x68')]=_0x2e8fce['id'];if(_0x585e5e[_0x423f('0x3d')][_0x423f('0x4c')]){_0x3ae7f2[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x3ae7f2[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x3ae7f2[_0x423f('0x40')],function(_0x4019e8){var _0x6ef421={};_0x6ef421[_0x4019e8]={'$like':'%'+_0x585e5e[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x6ef421;})});}_0x3ae7f2=_[_0x423f('0x4a')]({},_0x3ae7f2,_0x585e5e[_0x423f('0x4d')]);return db[_0x423f('0x6e')]['count']({'where':_0x3ae7f2[_0x423f('0x48')]})[_0x423f('0x2a')](function(_0x4c9f0d){_0x9baaf2[_0x423f('0x22')]=_0x4c9f0d;if(_0x585e5e[_0x423f('0x3d')][_0x423f('0x4e')]){_0x3ae7f2[_0x423f('0x4f')]=[{'all':!![]}];}return db[_0x423f('0x6e')][_0x423f('0x50')](_0x3ae7f2);})['then'](function(_0x2ecd02){_0x9baaf2[_0x423f('0x51')]=_0x2ecd02;return _0x9baaf2;});}})[_0x423f('0x2a')](respondWithFilteredResult(_0x5aebea,_0x3ae7f2))[_0x423f('0x52')](handleError(_0x5aebea,null));};exports[_0x423f('0x6f')]=function(_0x322e3b,_0x14e49a,_0x56103b){var _0x5add9d={};var _0x3eda5d={};var _0xca8f07;var _0x599f92;return db[_0x423f('0x38')]['findOne']({'where':{'id':_0x322e3b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x14e49a,null))['then'](function(_0x1874c6){if(_0x1874c6){_0xca8f07=_0x1874c6;_0x3eda5d[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x70')][_0x423f('0x39')]);_0x3eda5d[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x322e3b['query']);_0x3eda5d['filters']=_[_0x423f('0x41')](_0x3eda5d[_0x423f('0x3c')],_0x3eda5d[_0x423f('0x3d')]);_0x5add9d['attributes']=_[_0x423f('0x41')](_0x3eda5d[_0x423f('0x3c')],qs['fields'](_0x322e3b[_0x423f('0x3d')][_0x423f('0x42')]));_0x5add9d[_0x423f('0x40')]=_0x5add9d[_0x423f('0x40')][_0x423f('0x43')]?_0x5add9d[_0x423f('0x40')]:_0x3eda5d[_0x423f('0x3c')];_0x5add9d[_0x423f('0x46')]=qs['sort'](_0x322e3b[_0x423f('0x3d')]['sort']);_0x5add9d['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x322e3b['query'],_0x3eda5d['filters']));if(_0x322e3b[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5add9d[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x5add9d[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x5add9d[_0x423f('0x40')],function(_0x54e3d6){var _0x6f9fb6={};_0x6f9fb6[_0x54e3d6]={'$like':'%'+_0x322e3b['query'][_0x423f('0x4c')]+'%'};return _0x6f9fb6;})});}_0x5add9d=_['merge']({},_0x5add9d,_0x322e3b[_0x423f('0x4d')]);return _0xca8f07[_0x423f('0x6f')](_0x5add9d);}})[_0x423f('0x2a')](function(_0x2e9259){if(_0x2e9259){_0x599f92=_0x2e9259[_0x423f('0x43')];if(!_0x322e3b['query']['hasOwnProperty']('nolimit')){_0x5add9d[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x322e3b[_0x423f('0x3d')][_0x423f('0x23')]);_0x5add9d[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x322e3b[_0x423f('0x3d')]['offset']);}return _0xca8f07[_0x423f('0x6f')](_0x5add9d);}})[_0x423f('0x2a')](function(_0x7a3b73){if(_0x7a3b73){return _0x7a3b73?{'count':_0x599f92,'rows':_0x7a3b73}:null;}})[_0x423f('0x2a')](respondWithResult(_0x14e49a,null))[_0x423f('0x52')](handleError(_0x14e49a,null));};exports[_0x423f('0x71')]=function(_0x7f345,_0x417943,_0x9ac571){var _0x475d10=_0x7f345['body'][_0x423f('0x72')];var _0x299fd7=_['map'](_0x475d10,'id');return db[_0x423f('0x70')]['findAll']({'where':{'id':_0x299fd7},'attributes':['id'],'include':[{'model':db[_0x423f('0x73')],'as':_0x423f('0x74'),'attributes':['id',_0x423f('0x34'),_0x423f('0x75'),_0x423f('0x76'),_0x423f('0x77')],'raw':!![]}]})['then'](function(_0x394f1b){if(_0x394f1b){var _0x15284e=_[_0x423f('0x78')](_0x394f1b,function(_0x339fd5){var _0x28996a=_0x339fd5[_0x423f('0x2c')]({'plain':!![]});_0x28996a[_0x423f('0x74')][_0x423f('0x79')](function(_0x1d95c9){_0x1d95c9[_0x423f('0x7a')]=_[_0x423f('0x33')](_0x475d10,{'id':_0x28996a['id']})['penalty'];});return _0x28996a['Agents'];});return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x7f345[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(_0x4af753){return db[_0x423f('0x7b')][_0x423f('0x7c')](function(_0x3f8e4f){return _0x4af753[_0x423f('0x71')](_0x299fd7,{'transaction':_0x3f8e4f})[_0x423f('0x2a')](function(){return BPromise['each'](_0x475d10,function(_0x2709e5){return db[_0x423f('0x7d')]['upsert']({'TeamId':_0x2709e5['id'],'VoiceQueueId':_0x7f345['params']['id'],'penalty':_0x2709e5[_0x423f('0x7a')]},{'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){return BPromise['each'](_0x15284e,function(_0x2add3e){return db[_0x423f('0x7e')][_0x423f('0x7f')]({'where':{'UserId':_0x2add3e['id'],'VoiceQueueId':_0x7f345['params']['id']},'defaults':{'penalty':_0x2add3e[_0x423f('0x7a')]},'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){return BPromise[_0x423f('0x80')](_[_0x423f('0x4c')](_0x15284e,{'online':!![]}),function(_0x3ae984){return db[_0x423f('0x81')][_0x423f('0x82')]({'membername':_0x3ae984[_0x423f('0x34')],'UserId':_0x3ae984['id'],'queue_name':_0x4af753[_0x423f('0x34')],'VoiceQueueId':_0x4af753['id'],'interface':_[_0x423f('0x83')](_0x3ae984['interface'])?util[_0x423f('0x84')](_0x423f('0x85'),_0x3ae984[_0x423f('0x34')]):_0x3ae984[_0x423f('0x77')],'paused':_0x3ae984[_0x423f('0x76')]||![],'penalty':_0x3ae984[_0x423f('0x7a')]},{'transaction':_0x3f8e4f});});})[_0x423f('0x2a')](function(){_0x15284e[_0x423f('0x79')](function(_0xaf7c7){socket[_0x423f('0x86')](_0x423f('0x87'),{'UserId':_0xaf7c7['id'],'VoiceQueueId':_0x4af753['id']});});});});});}})[_0x423f('0x2a')](respondWithStatusCode(_0x417943,null))[_0x423f('0x52')](handleError(_0x417943,null));};exports[_0x423f('0x88')]=function(_0x1408ca,_0x523725,_0x860d89){return db[_0x423f('0x70')][_0x423f('0x50')]({'where':{'id':_0x1408ca[_0x423f('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x423f('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x523725,null))[_0x423f('0x2a')](function(_0x17e727){var _0x1ba6cc=_[_0x423f('0x2f')](_0x17e727,'id');var _0x500a93=[];var _0x84b50b=[];var _0x3f8e22=squel[_0x423f('0x89')]();_0x3f8e22[_0x423f('0x8a')](_0x423f('0x8b'))[_0x423f('0x8c')](_0x423f('0x8d'),'tq')[_0x423f('0x8e')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x423f('0x48')](_0x423f('0x8f'),_0x1408ca['params']['id']);for(var _0x522d00=0x0;_0x522d00<_0x17e727[_0x423f('0x43')];_0x522d00+=0x1){let _0x22b244=_0x17e727[_0x522d00];for(var _0x1f33e8=0x0;_0x1f33e8<_0x22b244[_0x423f('0x74')]['length'];_0x1f33e8+=0x1){let _0x251ebd=_0x22b244[_0x423f('0x74')][_0x1f33e8];var _0x5a7904=_0x3f8e22[_0x423f('0x60')]();_0x5a7904[_0x423f('0x48')](_0x423f('0x90'),_0x251ebd['id']);_0x84b50b['push'](db[_0x423f('0x7b')]['query'](_0x5a7904[_0x423f('0x91')](),{'type':db[_0x423f('0x7b')][_0x423f('0x92')][_0x423f('0x93')]})[_0x423f('0x2a')](function(_0x28bb80){if(_0x28bb80[_0x423f('0x43')]===0x1){return _0x251ebd['id'];}else{var _0x28e792=_['every'](_['map'](_0x28bb80,_0x423f('0x94')),function(_0x6c541d){return _[_0x423f('0x31')](_0x1ba6cc,_0x6c541d);});if(_0x28e792){return _0x251ebd['id'];}}}));}}return BPromise[_0x423f('0x95')](_0x84b50b)[_0x423f('0x2a')](function(_0x476f50){_0x500a93=_(_0x500a93)['union'](_0x476f50)['compact']()[_0x423f('0x30')]();return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x1408ca[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(_0x4d1981){return db['sequelize'][_0x423f('0x7c')](function(_0x97c2cb){return _0x4d1981['removeTeams'](_0x1408ca[_0x423f('0x3d')]['ids'],{'transaction':_0x97c2cb})[_0x423f('0x2a')](function(){if(!_[_0x423f('0x96')](_0x500a93)){return _0x4d1981[_0x423f('0x97')](_0x500a93,{'transaction':_0x97c2cb})[_0x423f('0x2a')](function(){return db[_0x423f('0x81')][_0x423f('0x2b')]({'where':{'VoiceQueueId':_0x1408ca[_0x423f('0x54')]['id'],'UserId':_0x500a93},'transaction':_0x97c2cb});});}})[_0x423f('0x2a')](function(){_0x500a93[_0x423f('0x79')](function(_0xa78dfe){socket['emit'](_0x423f('0x98'),{'UserId':_0xa78dfe,'VoiceQueueId':_0x4d1981['id']});});});});});});})[_0x423f('0x2a')](respondWithStatusCode(_0x523725,null))[_0x423f('0x52')](handleError(_0x523725,null));};exports[_0x423f('0x99')]=function(_0x2af8cb,_0x4c3821,_0x3e3a79){var _0x5daf55,_0x451581;return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x2af8cb[_0x423f('0x54')]['id']}})['then'](handleEntityNotFound(_0x4c3821,null))[_0x423f('0x2a')](function(_0x452602){if(_0x452602){_0x451581=_0x452602;return _0x452602[_0x423f('0x99')](_0x2af8cb[_0x423f('0x56')][_0x423f('0x9a')],_[_0x423f('0x61')](_0x2af8cb['body'],[_0x423f('0x9a'),'id'])||{})[_0x423f('0x9b')](function(_0xdbb7e1){for(var _0x2c5e39=0x0;_0x2c5e39<_0x2af8cb[_0x423f('0x56')][_0x423f('0x9a')][_0x423f('0x43')];_0x2c5e39+=0x1){socket[_0x423f('0x86')](_0x423f('0x87'),{'UserId':Number(_0x2af8cb['body']['ids'][_0x2c5e39]),'VoiceQueueId':Number(_0x2af8cb['params']['id'])});}return _0xdbb7e1;});}})[_0x423f('0x2a')](function(_0x13fe13){_0x5daf55=_0x13fe13||[];if(_0x451581){return db['User']['findAll']({'where':{'id':_0x2af8cb[_0x423f('0x56')]['ids']},'attributes':['id',_0x423f('0x34'),_0x423f('0x75'),_0x423f('0x76'),_0x423f('0x77')],'raw':!![]});}})[_0x423f('0x2a')](function(_0x4f4c53){if(!_['isEmpty'](_0x4f4c53)){var _0x5b57b0=[];for(var _0x492884=0x0;_0x492884<_0x4f4c53['length'];_0x492884++){if(_0x4f4c53[_0x492884][_0x423f('0x75')]){_0x5b57b0[_0x423f('0x9c')](db[_0x423f('0x81')][_0x423f('0x82')]({'membername':_0x4f4c53[_0x492884][_0x423f('0x34')],'UserId':_0x4f4c53[_0x492884]['id'],'queue_name':_0x451581['name'],'VoiceQueueId':_0x451581['id'],'interface':_['isNil'](_0x4f4c53[_0x492884][_0x423f('0x77')])?util[_0x423f('0x84')](_0x423f('0x85'),_0x4f4c53[_0x492884][_0x423f('0x34')]):_0x4f4c53[_0x492884][_0x423f('0x77')],'paused':_0x4f4c53[_0x492884][_0x423f('0x76')]||![],'penalty':_0x2af8cb[_0x423f('0x56')][_0x423f('0x7a')]||0x0}));}}return BPromise[_0x423f('0x95')](_0x5b57b0);}})[_0x423f('0x2a')](function(){return _0x5daf55;})[_0x423f('0x2a')](respondWithResult(_0x4c3821,null))[_0x423f('0x52')](handleError(_0x4c3821,null));};exports[_0x423f('0x97')]=function(_0x411c83,_0x2724e5,_0x519c75){return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x411c83[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2724e5,null))[_0x423f('0x2a')](function(_0x1e504e){if(_0x1e504e){return _0x1e504e[_0x423f('0x97')](_0x411c83[_0x423f('0x3d')]['ids'])[_0x423f('0x2a')](function(){if(_[_0x423f('0x9d')](_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')])){for(var _0x427011=0x0;_0x427011<_0x411c83['query'][_0x423f('0x9a')][_0x423f('0x43')];_0x427011+=0x1){socket[_0x423f('0x86')]('userVoiceQueue:remove',{'UserId':Number(_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')][_0x427011]),'VoiceQueueId':Number(_0x411c83[_0x423f('0x54')]['id'])});}}else{socket[_0x423f('0x86')](_0x423f('0x98'),{'UserId':Number(_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')]),'VoiceQueueId':Number(_0x411c83[_0x423f('0x54')]['id'])});}});}})[_0x423f('0x2a')](function(_0x1a7c2d){return db[_0x423f('0x81')]['destroy']({'where':{'VoiceQueueId':_0x411c83[_0x423f('0x54')]['id'],'UserId':_0x411c83[_0x423f('0x3d')][_0x423f('0x9a')]}})['then'](function(){return _0x1a7c2d;});})[_0x423f('0x2a')](respondWithStatusCode(_0x2724e5,null))['catch'](handleError(_0x2724e5,null));};exports['getAgents']=function(_0x459f8a,_0x112217,_0xa175cd){var _0x191c9d={};var _0x1603b7={};var _0x5e8e5b;var _0x388313;return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x459f8a['params']['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x112217,null))[_0x423f('0x2a')](function(_0x2cb659){if(_0x2cb659){_0x5e8e5b=_0x2cb659;_0x1603b7[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x73')][_0x423f('0x39')]);_0x1603b7['query']=_['keys'](_0x459f8a['query']);_0x1603b7['filters']=_['intersection'](_0x1603b7[_0x423f('0x3c')],_0x1603b7[_0x423f('0x3d')]);_0x191c9d[_0x423f('0x40')]=_[_0x423f('0x41')](_0x1603b7['model'],qs[_0x423f('0x42')](_0x459f8a[_0x423f('0x3d')]['fields']));_0x191c9d[_0x423f('0x40')]=_0x191c9d[_0x423f('0x40')][_0x423f('0x43')]?_0x191c9d['attributes']:_0x1603b7['model'];_0x191c9d[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x459f8a[_0x423f('0x3d')][_0x423f('0x47')]);_0x191c9d['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x459f8a['query'],_0x1603b7[_0x423f('0x3f')]));if(_0x459f8a[_0x423f('0x3d')]['filter']){_0x191c9d[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x191c9d[_0x423f('0x48')],{'$or':_[_0x423f('0x2f')](_0x191c9d['attributes'],function(_0x218a51){var _0x38cb89={};_0x38cb89[_0x218a51]={'$like':'%'+_0x459f8a[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x38cb89;})});}_0x191c9d=_[_0x423f('0x4a')]({},_0x191c9d,_0x459f8a[_0x423f('0x4d')]);return _0x5e8e5b[_0x423f('0x9e')](_0x191c9d);}})[_0x423f('0x2a')](function(_0x3e021b){if(_0x3e021b){_0x388313=_0x3e021b[_0x423f('0x43')];if(!_0x459f8a[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x191c9d[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x459f8a['query']['limit']);_0x191c9d[_0x423f('0x20')]=qs['offset'](_0x459f8a['query']['offset']);}return _0x5e8e5b['getAgents'](_0x191c9d);}})[_0x423f('0x2a')](function(_0x5229ac){if(_0x5229ac){return _0x5229ac?{'count':_0x388313,'rows':_0x5229ac}:null;}})['then'](respondWithResult(_0x112217,null))[_0x423f('0x52')](handleError(_0x112217,null));};exports['getMembers']=function(_0x2102c2,_0x4c98ea,_0x12d224){var _0x5af64f={};var _0x23494f={};var _0x3f8501;var _0x144cd0;return db['VoiceQueue']['findOne']({'where':{'id':_0x2102c2[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4c98ea,null))[_0x423f('0x2a')](function(_0x2b23f6){if(_0x2b23f6){_0x3f8501=_0x2b23f6;_0x23494f[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0x81')][_0x423f('0x39')]);_0x23494f['query']=_[_0x423f('0x3e')](_0x2102c2['query']);_0x23494f[_0x423f('0x3f')]=_['intersection'](_0x23494f[_0x423f('0x3c')],_0x23494f['query']);_0x5af64f['attributes']=_[_0x423f('0x41')](_0x23494f[_0x423f('0x3c')],qs[_0x423f('0x42')](_0x2102c2[_0x423f('0x3d')][_0x423f('0x42')]));_0x5af64f['attributes']=_0x5af64f[_0x423f('0x40')][_0x423f('0x43')]?_0x5af64f['attributes']:_0x23494f[_0x423f('0x3c')];_0x5af64f[_0x423f('0x46')]=qs['sort'](_0x2102c2['query']['sort']);_0x5af64f[_0x423f('0x48')]=qs[_0x423f('0x3f')](_['pick'](_0x2102c2[_0x423f('0x3d')],_0x23494f[_0x423f('0x3f')]));if(_0x2102c2[_0x423f('0x3d')][_0x423f('0x4c')]){_0x5af64f[_0x423f('0x48')]=_['merge'](_0x5af64f[_0x423f('0x48')],{'$or':_['map'](_0x5af64f[_0x423f('0x40')],function(_0x23a9d3){var _0x2cb250={};_0x2cb250[_0x23a9d3]={'$like':'%'+_0x2102c2[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2cb250;})});}_0x5af64f=_[_0x423f('0x4a')]({},_0x5af64f,_0x2102c2['options']);return _0x3f8501[_0x423f('0x9f')](_0x5af64f);}})['then'](function(_0x3782f5){if(_0x3782f5){_0x144cd0=_0x3782f5[_0x423f('0x43')];if(!_0x2102c2[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x5af64f['limit']=qs[_0x423f('0x23')](_0x2102c2['query']['limit']);_0x5af64f[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x2102c2['query'][_0x423f('0x20')]);}return _0x3f8501[_0x423f('0x9f')](_0x5af64f);}})['then'](function(_0x492dc4){return _0x492dc4?{'count':_0x144cd0,'rows':_0x492dc4}:null;})['then'](respondWithResult(_0x4c98ea,null))[_0x423f('0x52')](handleError(_0x4c98ea,null));};exports[_0x423f('0xa0')]=function(_0x5ecdbe,_0x261690,_0xdd41d7){var _0x3b4beb={};var _0x41b6ac={};var _0x236ead;var _0x336f7c;return db[_0x423f('0x38')][_0x423f('0x66')]({'where':{'id':_0x5ecdbe[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x261690,null))[_0x423f('0x2a')](function(_0xa065b3){if(_0xa065b3){_0x236ead=_0xa065b3;_0x41b6ac[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0xa1')][_0x423f('0x39')]);_0x41b6ac[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x5ecdbe[_0x423f('0x3d')]);_0x41b6ac[_0x423f('0x3f')]=_[_0x423f('0x41')](_0x41b6ac[_0x423f('0x3c')],_0x41b6ac[_0x423f('0x3d')]);_0x3b4beb['attributes']=_[_0x423f('0x41')](_0x41b6ac['model'],qs[_0x423f('0x42')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x42')]));_0x3b4beb['attributes']=_0x3b4beb['attributes'][_0x423f('0x43')]?_0x3b4beb[_0x423f('0x40')]:_0x41b6ac[_0x423f('0x3c')];_0x3b4beb[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x47')]);_0x3b4beb['where']=qs[_0x423f('0x3f')](_[_0x423f('0x49')](_0x5ecdbe['query'],_0x41b6ac[_0x423f('0x3f')]));if(_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x4c')]){_0x3b4beb['where']=_[_0x423f('0x4a')](_0x3b4beb[_0x423f('0x48')],{'$or':_['map'](_0x3b4beb[_0x423f('0x40')],function(_0x29c8e6){var _0x2f49c6={};_0x2f49c6[_0x29c8e6]={'$like':'%'+_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x2f49c6;})});}_0x3b4beb=_[_0x423f('0x4a')]({},_0x3b4beb,_0x5ecdbe[_0x423f('0x4d')]);return _0x236ead[_0x423f('0xa0')](_0x3b4beb);}})[_0x423f('0x2a')](function(_0x21c99f){if(_0x21c99f){_0x336f7c=_0x21c99f['length'];if(!_0x5ecdbe[_0x423f('0x3d')]['hasOwnProperty']('nolimit')){_0x3b4beb[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x5ecdbe[_0x423f('0x3d')][_0x423f('0x23')]);_0x3b4beb['offset']=qs[_0x423f('0x20')](_0x5ecdbe['query'][_0x423f('0x20')]);}return _0x236ead[_0x423f('0xa0')](_0x3b4beb);}})[_0x423f('0x2a')](function(_0x3edb25){if(_0x3edb25){return _0x3edb25?{'count':_0x336f7c,'rows':_0x3edb25}:null;}})[_0x423f('0x2a')](respondWithResult(_0x261690,null))['catch'](handleError(_0x261690,null));};exports[_0x423f('0xa2')]=function(_0x447809,_0x50acce,_0x385305){var _0x131de2=moment()[_0x423f('0x84')](_0x423f('0xa3'));var _0x4080e6,_0x1ffdae;return db[_0x423f('0x38')][_0x423f('0x33')]({'where':{'id':_0x447809[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x50acce,null))[_0x423f('0x2a')](function(_0x3bef9a){if(_0x3bef9a){_0x1ffdae=_0x3bef9a;return _0x3bef9a[_0x423f('0xa2')](_0x447809['body']['ids'],_[_0x423f('0x61')](_0x447809[_0x423f('0x56')],['ids','id'])||{});}return null;})[_0x423f('0x9b')](function(_0x41e33e){var _0x3d7903;_0x4080e6=_0x41e33e||[];var _0x36a02a=[];if(_0x41e33e){for(var _0x585f5a=0x0;_0x585f5a<_0x41e33e[_0x423f('0x43')];_0x585f5a+=0x1){var _0x319a0a=_0x41e33e[_0x585f5a][_0x423f('0x2c')]({'plain':!![]});_0x1ffdae[_0x423f('0xa4')]=_0x447809[_0x423f('0x56')][_0x423f('0xa4')]?_0x447809['body'][_0x423f('0xa4')]:_0x1ffdae['dialCheckDuplicateType'];switch(_0x1ffdae['dialCheckDuplicateType']){case'always':_0x3d7903=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xa7'))['fromQuery']([_0x423f('0xa8'),'scheduledAt',_0x423f('0xa9'),_0x423f('0xaa'),_0x423f('0x68'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xa8'),_0x423f('0xa8'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27','scheduledAt')['field']('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')]['toString'](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')](),_0x423f('0x68'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')]('deletedAt\x20IS\x20NULL')[_0x423f('0x48')]('ListId\x20=\x20?',_0x319a0a[_0x423f('0xab')][_0x423f('0x91')]())[_0x423f('0x48')](_0x423f('0xad'))[_0x423f('0x48')](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xaf'))[_0x423f('0x8c')](_0x423f('0xb0'))[_0x423f('0x48')]('VoiceQueueId\x20=\x20?',_0x447809['params']['id']['toString']()))['where'](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xb1'))[_0x423f('0x8c')]('cm_hopper')[_0x423f('0x48')](_0x423f('0x8f'),_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')]())))[_0x423f('0x91')]();break;case _0x423f('0xb2'):_0x3d7903=squel['insert']()[_0x423f('0xa6')]('cm_hopper')[_0x423f('0xb3')]([_0x423f('0xa8'),_0x423f('0xb4'),_0x423f('0xa9'),'ListId',_0x423f('0x68'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()['field'](_0x423f('0xa8'),_0x423f('0xa8'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0xb4'))[_0x423f('0x8a')]('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))['field'](_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')](),_0x423f('0x68'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0x63'))['field']('\x27'+_0x131de2+'\x27',_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))[_0x423f('0x48')]('ListId\x20=\x20?',_0x319a0a[_0x423f('0xab')]['toString']())[_0x423f('0x48')](_0x423f('0xad'))[_0x423f('0x48')](_0x423f('0xae'),squel[_0x423f('0x89')]()[_0x423f('0x8a')](_0x423f('0xb1'))[_0x423f('0x8c')](_0x423f('0xa7'))['where'](_0x423f('0x8f'),_0x447809[_0x423f('0x54')]['id'][_0x423f('0x91')]())))[_0x423f('0x91')]();break;default:_0x3d7903=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xa7'))[_0x423f('0xb3')](['phone',_0x423f('0xb4'),_0x423f('0xa9'),_0x423f('0xaa'),'VoiceQueueId',_0x423f('0x63'),_0x423f('0x62')],squel['select']()[_0x423f('0x8a')]('phone',_0x423f('0xa8'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0xb4'))['field']('id',_0x423f('0xa9'))[_0x423f('0x8a')](_0x319a0a[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x447809[_0x423f('0x54')]['id']['toString'](),_0x423f('0x68'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))['field']('\x27'+_0x131de2+'\x27','updatedAt')[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))['where'](_0x423f('0xb6'),_0x319a0a[_0x423f('0xab')]['toString']())['where'](_0x423f('0xad')))[_0x423f('0x91')]();}_0x36a02a['push'](db[_0x423f('0x7b')][_0x423f('0x3d')](_0x3d7903));}return BPromise[_0x423f('0x95')](_0x36a02a);}})[_0x423f('0x2a')](function(){var _0x25f119=[];var _0x24496a=squel['insert']()[_0x423f('0xa6')]('cm_hopper_additional_phones')[_0x423f('0xb3')](['CmHopperId','phone',_0x423f('0xb7'),_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')]('h.id')['field'](_0x423f('0xb8'))[_0x423f('0x8a')](_0x423f('0xb9'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27',_0x423f('0x63'))[_0x423f('0x8a')]('\x27'+_0x131de2+'\x27','updatedAt')[_0x423f('0x8c')](_0x423f('0xba'),'ci')[_0x423f('0x8e')](_0x423f('0xa7'),'h',_0x423f('0xbb'))[_0x423f('0x48')]('h.scheduledat=?',_0x131de2)['where']('ci.ItemClass=?',_0x423f('0xbc')))[_0x423f('0x91')]();_0x25f119[_0x423f('0x9c')](db['sequelize'][_0x423f('0x3d')](_0x24496a));return BPromise[_0x423f('0x95')](_0x25f119);})[_0x423f('0x2a')](function(){return _0x4080e6;})[_0x423f('0x2a')](respondWithResult(_0x50acce,null))[_0x423f('0x52')](handleError(_0x50acce,null));};exports[_0x423f('0xbd')]=function(_0x576c94,_0xaea05b,_0x1d112a){return db['VoiceQueue'][_0x423f('0x33')]({'where':{'id':_0x576c94[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0xaea05b,null))[_0x423f('0x2a')](function(_0x45df44){if(_0x45df44){return _0x45df44['removeLists'](_0x576c94['query'][_0x423f('0x9a')]);}})['then'](function(_0x552d2b){if(_0x552d2b){return db[_0x423f('0x67')][_0x423f('0x2b')]({'where':{'ListId':_0x576c94[_0x423f('0x3d')][_0x423f('0x9a')],'VoiceQueueId':_0x576c94[_0x423f('0x54')]['id']}})['then'](function(){return _0x552d2b;});}})[_0x423f('0x2a')](respondWithStatusCode(_0xaea05b,null))[_0x423f('0x52')](handleError(_0xaea05b,null));};exports['getBlackLists']=function(_0x4ab25c,_0x4eb1e8,_0x1348f4){var _0x4b70dc={};var _0xb2b23={};var _0x17465a;var _0x8ceccd;return db['VoiceQueue'][_0x423f('0x66')]({'where':{'id':_0x4ab25c[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x4eb1e8,null))[_0x423f('0x2a')](function(_0x4e2a3b){if(_0x4e2a3b){_0x17465a=_0x4e2a3b;_0xb2b23[_0x423f('0x3c')]=_[_0x423f('0x3e')](db[_0x423f('0xa1')][_0x423f('0x39')]);_0xb2b23[_0x423f('0x3d')]=_[_0x423f('0x3e')](_0x4ab25c['query']);_0xb2b23[_0x423f('0x3f')]=_[_0x423f('0x41')](_0xb2b23[_0x423f('0x3c')],_0xb2b23[_0x423f('0x3d')]);_0x4b70dc[_0x423f('0x40')]=_[_0x423f('0x41')](_0xb2b23['model'],qs[_0x423f('0x42')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x42')]));_0x4b70dc['attributes']=_0x4b70dc[_0x423f('0x40')][_0x423f('0x43')]?_0x4b70dc[_0x423f('0x40')]:_0xb2b23[_0x423f('0x3c')];_0x4b70dc[_0x423f('0x46')]=qs[_0x423f('0x47')](_0x4ab25c['query'][_0x423f('0x47')]);_0x4b70dc['where']=qs[_0x423f('0x3f')](_['pick'](_0x4ab25c[_0x423f('0x3d')],_0xb2b23[_0x423f('0x3f')]));if(_0x4ab25c['query']['filter']){_0x4b70dc[_0x423f('0x48')]=_[_0x423f('0x4a')](_0x4b70dc['where'],{'$or':_[_0x423f('0x2f')](_0x4b70dc[_0x423f('0x40')],function(_0x4a3220){var _0x44d7d8={};_0x44d7d8[_0x4a3220]={'$like':'%'+_0x4ab25c[_0x423f('0x3d')][_0x423f('0x4c')]+'%'};return _0x44d7d8;})});}_0x4b70dc=_[_0x423f('0x4a')]({},_0x4b70dc,_0x4ab25c[_0x423f('0x4d')]);return _0x17465a[_0x423f('0xbe')](_0x4b70dc);}})[_0x423f('0x2a')](function(_0x41496a){if(_0x41496a){_0x8ceccd=_0x41496a['length'];if(!_0x4ab25c[_0x423f('0x3d')][_0x423f('0x44')](_0x423f('0x45'))){_0x4b70dc[_0x423f('0x23')]=qs[_0x423f('0x23')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x23')]);_0x4b70dc[_0x423f('0x20')]=qs[_0x423f('0x20')](_0x4ab25c[_0x423f('0x3d')][_0x423f('0x20')]);}return _0x17465a[_0x423f('0xbe')](_0x4b70dc);}})[_0x423f('0x2a')](function(_0x48779d){if(_0x48779d){return _0x48779d?{'count':_0x8ceccd,'rows':_0x48779d}:null;}})[_0x423f('0x2a')](respondWithResult(_0x4eb1e8,null))[_0x423f('0x52')](handleError(_0x4eb1e8,null));};exports[_0x423f('0xbf')]=function(_0x269708,_0x429631,_0x4e0a65){var _0x3faed5,_0x13932e;return db[_0x423f('0x38')]['find']({'where':{'id':_0x269708[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x429631,null))[_0x423f('0x2a')](function(_0x2d5639){if(_0x2d5639){_0x13932e=_0x2d5639;return _0x2d5639[_0x423f('0xbf')](_0x269708[_0x423f('0x56')][_0x423f('0x9a')],_[_0x423f('0x61')](_0x269708[_0x423f('0x56')],[_0x423f('0x9a'),'id'])||{});}return null;})[_0x423f('0x9b')](function(_0x55ab6c){var _0x3119b2;_0x3faed5=_0x55ab6c||[];var _0x182be3=[];if(_0x55ab6c){for(var _0x421731=0x0;_0x421731<_0x55ab6c[_0x423f('0x43')];_0x421731+=0x1){var _0x307c3b=_0x55ab6c[_0x421731][_0x423f('0x2c')]({'plain':!![]});_0x3119b2=squel[_0x423f('0xa5')]()[_0x423f('0xa6')](_0x423f('0xc0'))[_0x423f('0xb3')]([_0x423f('0xa8'),'ContactId',_0x423f('0xaa'),'VoiceQueueId',_0x423f('0x63'),_0x423f('0x62')],squel[_0x423f('0x89')]()[_0x423f('0x8a')]('phone',_0x423f('0xa8'))['field']('id',_0x423f('0xa9'))['field'](_0x307c3b[_0x423f('0xab')][_0x423f('0x91')](),_0x423f('0xaa'))[_0x423f('0x8a')](_0x269708[_0x423f('0x54')]['id']['toString'](),_0x423f('0x68'))[_0x423f('0x8a')](_0x423f('0xc1'),'createdAt')['field'](_0x423f('0xc1'),_0x423f('0x62'))[_0x423f('0x8c')](_0x423f('0xac'))[_0x423f('0x48')](_0x423f('0xb5'))[_0x423f('0x48')](_0x423f('0xb6'),_0x307c3b[_0x423f('0xab')][_0x423f('0x91')]())[_0x423f('0x48')](_0x423f('0xad')))['toString']();_0x182be3[_0x423f('0x9c')](db[_0x423f('0x7b')][_0x423f('0x3d')](_0x3119b2));}return BPromise[_0x423f('0x95')](_0x182be3);}})[_0x423f('0x2a')](function(){return _0x3faed5;})[_0x423f('0x2a')](respondWithResult(_0x429631,null))[_0x423f('0x52')](handleError(_0x429631,null));};exports['removeBlackLists']=function(_0x59452b,_0x2d29f9,_0x1b3602){return db[_0x423f('0x38')]['find']({'where':{'id':_0x59452b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](handleEntityNotFound(_0x2d29f9,null))[_0x423f('0x2a')](function(_0x4b0bfb){if(_0x4b0bfb){return _0x4b0bfb[_0x423f('0xc2')](_0x59452b[_0x423f('0x3d')][_0x423f('0x9a')]);}})[_0x423f('0x2a')](function(_0xd27f24){if(_0xd27f24){return db[_0x423f('0x6e')]['destroy']({'where':{'ListId':_0x59452b[_0x423f('0x3d')][_0x423f('0x9a')],'VoiceQueueId':_0x59452b[_0x423f('0x54')]['id']}})[_0x423f('0x2a')](function(){return _0xd27f24;});}})[_0x423f('0x2a')](respondWithStatusCode(_0x2d29f9,null))['catch'](handleError(_0x2d29f9,null));}; \ No newline at end of file +var _0xe260=['VoiceQueues','inbound','filter','ignore','map','value','includes','find','type','UserProfileResource','error','name','send','index','VoiceQueue','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','updatedAt','body','createdAt','QueueCampaigns','UserProfileSection','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','voicePause','interface','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','online','isEmpty','all','isArray','getAgents','getMembers','getLists','CmList','format','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xe260,0x94));var _0x0e26=function(_0x65190,_0x3608){_0x65190=_0x65190-0x0;var _0x3e9e82=_0xe260[_0x65190];return _0x3e9e82;};'use strict';var emlformat=require(_0x0e26('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e26('0x1'));var jsonpatch=require(_0x0e26('0x2'));var rp=require(_0x0e26('0x3'));var moment=require(_0x0e26('0x4'));var BPromise=require(_0x0e26('0x5'));var Mustache=require(_0x0e26('0x6'));var util=require(_0x0e26('0x7'));var path=require(_0x0e26('0x8'));var sox=require(_0x0e26('0x9'));var csv=require(_0x0e26('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e26('0xb'));var squel=require(_0x0e26('0xc'));var crypto=require(_0x0e26('0xd'));var jsforce=require(_0x0e26('0xe'));var deskjs=require(_0x0e26('0xf'));var toCsv=require(_0x0e26('0xa'));var querystring=require(_0x0e26('0x10'));var Papa=require('papaparse');var Redis=require(_0x0e26('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e26('0x12'));var as=require(_0x0e26('0x13'));var hardwareService=require(_0x0e26('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0e26('0x15'));var config=require(_0x0e26('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e26('0x17'))['db'];config[_0x0e26('0x18')]=_[_0x0e26('0x19')](config['redis'],{'host':_0x0e26('0x1a'),'port':0x18eb});var socket=require(_0x0e26('0x1b'))(new Redis(config[_0x0e26('0x18')]));require(_0x0e26('0x1c'))[_0x0e26('0x1d')](socket);function respondWithStatusCode(_0x32b16c,_0x41a968){_0x41a968=_0x41a968||0xcc;return function(_0x5f50c3){if(_0x5f50c3){return _0x32b16c[_0x0e26('0x1e')](_0x41a968);}return _0x32b16c[_0x0e26('0x1f')](_0x41a968)[_0x0e26('0x20')]();};}function respondWithResult(_0x34a12c,_0x517a7d){_0x517a7d=_0x517a7d||0xc8;return function(_0x12a0a9){if(_0x12a0a9){return _0x34a12c[_0x0e26('0x1f')](_0x517a7d)[_0x0e26('0x21')](_0x12a0a9);}};}function respondWithFilteredResult(_0x240ed1,_0x16782d){return function(_0x5d0c24){if(_0x5d0c24){var _0x177568=typeof _0x16782d[_0x0e26('0x22')]===_0x0e26('0x23')&&typeof _0x16782d[_0x0e26('0x24')]===_0x0e26('0x23');var _0x2a997b=_0x5d0c24[_0x0e26('0x25')];var _0x1cb0b5=_0x177568?0x0:_0x16782d[_0x0e26('0x22')];var _0x23ad05=_0x177568?_0x5d0c24[_0x0e26('0x25')]:_0x16782d[_0x0e26('0x22')]+_0x16782d[_0x0e26('0x24')];var _0x30497c;if(_0x23ad05>=_0x2a997b){_0x23ad05=_0x2a997b;_0x30497c=0xc8;}else{_0x30497c=0xce;}_0x240ed1['status'](_0x30497c);return _0x240ed1[_0x0e26('0x26')]('Content-Range',_0x1cb0b5+'-'+_0x23ad05+'/'+_0x2a997b)[_0x0e26('0x21')](_0x5d0c24);}return null;};}function patchUpdates(_0x57fd1c){return function(_0x5bef55){try{jsonpatch[_0x0e26('0x27')](_0x5bef55,_0x57fd1c,!![]);}catch(_0x324932){return BPromise[_0x0e26('0x28')](_0x324932);}return _0x5bef55[_0x0e26('0x29')]();};}function saveUpdates(_0xa5a108,_0x320d6b){return function(_0x1b3cd8){if(_0x1b3cd8){return _0x1b3cd8[_0x0e26('0x2a')](_0xa5a108)[_0x0e26('0x2b')](function(_0x9eff86){return _0x9eff86;});}return null;};}function removeEntity(_0x2dad4c,_0x544ddb){return function(_0x5403f7){if(_0x5403f7){return _0x5403f7[_0x0e26('0x2c')]()['then'](function(){var _0x5f2fb8=_0x5403f7[_0x0e26('0x2d')]({'plain':!![]});var _0x15be4a=[{'name':_0x0e26('0x2e'),'value':_0x0e26('0x2f'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5863dc=_(_0x15be4a)[_0x0e26('0x30')](_0x0e26('0x31'))[_0x0e26('0x32')](_0x0e26('0x33'))[_0x0e26('0x33')]();if(_[_0x0e26('0x34')](_0x5863dc,_0x5f2fb8['type'])){return;}var _0xd4b9fc=_[_0x0e26('0x35')](_0x15be4a,[_0x0e26('0x33'),_0x5f2fb8[_0x0e26('0x36')]])['name'];return db[_0x0e26('0x37')][_0x0e26('0x2c')]({'where':{'type':_0xd4b9fc,'resourceId':_0x5f2fb8['id']}})[_0x0e26('0x2b')](function(){return _0x5403f7;});})[_0x0e26('0x2b')](function(){_0x2dad4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbfff4,_0xc66a5a){return function(_0x502a34){if(!_0x502a34){_0xdbfff4['sendStatus'](0x194);}return _0x502a34;};}function handleError(_0x52afea,_0x18853e){_0x18853e=_0x18853e||0x1f4;return function(_0x555961){logger[_0x0e26('0x38')](_0x555961['stack']);if(_0x555961['name']){delete _0x555961[_0x0e26('0x39')];}_0x52afea[_0x0e26('0x1f')](_0x18853e)[_0x0e26('0x3a')](_0x555961);};}exports[_0x0e26('0x3b')]=function(_0xb0de07,_0xb44883){var _0x19a5e4={},_0x520b3e={},_0x6b9e3d={'count':0x0,'rows':[]};var _0x4553cb=_[_0x0e26('0x32')](db[_0x0e26('0x3c')][_0x0e26('0x3d')],function(_0x354216){return{'name':_0x354216[_0x0e26('0x3e')],'type':_0x354216[_0x0e26('0x36')]['key']};});_0x520b3e['model']=_[_0x0e26('0x32')](_0x4553cb,_0x0e26('0x39'));_0x520b3e[_0x0e26('0x3f')]=_['keys'](_0xb0de07['query']);_0x520b3e[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x520b3e[_0x0e26('0x42')],_0x520b3e[_0x0e26('0x3f')]);_0x19a5e4['attributes']=_[_0x0e26('0x41')](_0x520b3e[_0x0e26('0x42')],qs['fields'](_0xb0de07[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x19a5e4[_0x0e26('0x44')]=_0x19a5e4[_0x0e26('0x44')]['length']?_0x19a5e4[_0x0e26('0x44')]:_0x520b3e['model'];if(!_0xb0de07[_0x0e26('0x3f')][_0x0e26('0x45')]('nolimit')){_0x19a5e4[_0x0e26('0x24')]=qs['limit'](_0xb0de07['query'][_0x0e26('0x24')]);_0x19a5e4[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0xb0de07[_0x0e26('0x3f')][_0x0e26('0x22')]);}_0x19a5e4[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0xb0de07['query'][_0x0e26('0x47')]);_0x19a5e4[_0x0e26('0x48')]=qs[_0x0e26('0x40')](_[_0x0e26('0x49')](_0xb0de07[_0x0e26('0x3f')],_0x520b3e['filters']),_0x4553cb);if(_0xb0de07['query']['filter']){_0x19a5e4[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x19a5e4[_0x0e26('0x48')],{'$or':_[_0x0e26('0x32')](_0x4553cb,function(_0x2702fe){if(_0x2702fe[_0x0e26('0x36')]!=='VIRTUAL'){var _0x429e50={};_0x429e50[_0x2702fe[_0x0e26('0x39')]]={'$like':'%'+_0xb0de07[_0x0e26('0x3f')][_0x0e26('0x30')]+'%'};return _0x429e50;}})});}_0x19a5e4=_[_0x0e26('0x4a')]({},_0x19a5e4,_0xb0de07[_0x0e26('0x4b')]);var _0x36cb0e={'where':_0x19a5e4[_0x0e26('0x48')]};return db[_0x0e26('0x3c')][_0x0e26('0x25')](_0x36cb0e)['then'](function(_0x56e54b){_0x6b9e3d[_0x0e26('0x25')]=_0x56e54b;if(_0xb0de07['query'][_0x0e26('0x4c')]){_0x19a5e4[_0x0e26('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0e26('0x4e')](_0x19a5e4);})['then'](function(_0x4773a1){_0x6b9e3d[_0x0e26('0x4f')]=_0x4773a1;return _0x6b9e3d;})['then'](respondWithFilteredResult(_0xb44883,_0x19a5e4))[_0x0e26('0x50')](handleError(_0xb44883,null));};exports['show']=function(_0x2b072a,_0x36921d){var _0x5ddcf6={'raw':![],'where':{'id':_0x2b072a[_0x0e26('0x51')]['id']}},_0x4fdb74={};_0x4fdb74[_0x0e26('0x42')]=_['keys'](db[_0x0e26('0x3c')]['rawAttributes']);_0x4fdb74[_0x0e26('0x3f')]=_['keys'](_0x2b072a[_0x0e26('0x3f')]);_0x4fdb74[_0x0e26('0x40')]=_['intersection'](_0x4fdb74[_0x0e26('0x42')],_0x4fdb74['query']);_0x5ddcf6['attributes']=_[_0x0e26('0x41')](_0x4fdb74[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x2b072a[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x5ddcf6['attributes']=_0x5ddcf6['attributes'][_0x0e26('0x52')]?_0x5ddcf6[_0x0e26('0x44')]:_0x4fdb74['model'];if(_0x2b072a['query'][_0x0e26('0x4c')]){_0x5ddcf6[_0x0e26('0x4d')]=[{'all':!![]}];}_0x5ddcf6=_[_0x0e26('0x4a')]({},_0x5ddcf6,_0x2b072a[_0x0e26('0x4b')]);return db[_0x0e26('0x3c')][_0x0e26('0x35')](_0x5ddcf6)['then'](handleEntityNotFound(_0x36921d,null))[_0x0e26('0x2b')](respondWithResult(_0x36921d,null))['catch'](handleError(_0x36921d,null));};exports[_0x0e26('0x53')]=function(_0x2cee42,_0x4025a0){return db['VoiceQueue'][_0x0e26('0x53')](_0x2cee42['body'],{})[_0x0e26('0x2b')](function(_0x3eb245){var _0x399505=_0x2cee42[_0x0e26('0x54')][_0x0e26('0x2d')]({'plain':!![]});if(!_0x399505)throw new Error(_0x0e26('0x55'));if(_0x399505[_0x0e26('0x56')]===_0x0e26('0x54')){var _0x1aed29=_0x3eb245[_0x0e26('0x2d')]({'plain':!![]});var _0x3e3b9c=[{'name':_0x0e26('0x2e'),'value':_0x0e26('0x2f')},{'name':'QueueCampaigns','value':_0x0e26('0x57')}];var _0x9b88c2=_[_0x0e26('0x35')](_0x3e3b9c,[_0x0e26('0x33'),_0x1aed29[_0x0e26('0x36')]])[_0x0e26('0x39')];return db['UserProfileSection']['find']({'where':{'name':_0x9b88c2,'userProfileId':_0x399505[_0x0e26('0x58')]},'raw':!![]})[_0x0e26('0x2b')](function(_0x487320){if(_0x487320&&_0x487320[_0x0e26('0x59')]===0x0){return db[_0x0e26('0x37')][_0x0e26('0x53')]({'name':_0x1aed29[_0x0e26('0x39')],'resourceId':_0x1aed29['id'],'type':_0x487320[_0x0e26('0x39')],'sectionId':_0x487320['id']},{})[_0x0e26('0x2b')](function(){return _0x3eb245;});}else{return _0x3eb245;}})[_0x0e26('0x50')](function(_0x1bce9a){logger[_0x0e26('0x38')](_0x0e26('0x5a'),_0x1bce9a);throw _0x1bce9a;});}return _0x3eb245;})[_0x0e26('0x2b')](respondWithResult(_0x4025a0,0xc9))[_0x0e26('0x50')](handleError(_0x4025a0,null));};exports[_0x0e26('0x5b')]=function(_0x21200c,_0xea717d){var _0x2549e9={'where':{'id':_0x21200c[_0x0e26('0x51')]['id']}},_0x1f2bc9={};_0x1f2bc9[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db['VoiceQueue']['rawAttributes']);_0x2549e9[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x1f2bc9[_0x0e26('0x42')],qs['fields'](_0x21200c['query'][_0x0e26('0x43')]));_0x2549e9[_0x0e26('0x44')]=_0x2549e9['attributes'][_0x0e26('0x52')]?_0x2549e9['attributes']:_0x1f2bc9[_0x0e26('0x42')];if(_0x21200c[_0x0e26('0x3f')][_0x0e26('0x4c')]){_0x2549e9['include']=[{'all':!![]}];}_0x2549e9=_[_0x0e26('0x4a')]({},_0x2549e9,_0x21200c[_0x0e26('0x4b')]);return db['VoiceQueue'][_0x0e26('0x35')](_0x2549e9)[_0x0e26('0x2b')](handleEntityNotFound(_0xea717d,null))['then'](function(_0x3f0a9f){if(_0x3f0a9f){var _0x25af03=_0x3f0a9f[_0x0e26('0x2d')]({'plain':!![]});_0x25af03=qs[_0x0e26('0x5d')](_0x25af03,['id','createdAt',_0x0e26('0x5e')]);_0x21200c['body']=_['omit'](_0x21200c[_0x0e26('0x5f')],['id',_0x0e26('0x60'),_0x0e26('0x5e')]);return db['VoiceQueue']['create'](_[_0x0e26('0x4a')](_0x25af03,_0x21200c['body']),{'include':_0x21200c[_0x0e26('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x0e26('0x2b')](function(_0x130fd6){var _0x36ea89=_0x21200c[_0x0e26('0x54')][_0x0e26('0x2d')]({'plain':!![]});if(!_0x36ea89)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36ea89[_0x0e26('0x56')]===_0x0e26('0x54')){var _0x9d95e4=_0x130fd6[_0x0e26('0x2d')]({'plain':!![]});var _0x33cd54=[{'name':_0x0e26('0x2e'),'value':_0x0e26('0x2f')},{'name':_0x0e26('0x61'),'value':'outbound'}];var _0x3c67f4=_[_0x0e26('0x35')](_0x33cd54,[_0x0e26('0x33'),_0x9d95e4['type']])[_0x0e26('0x39')];return db[_0x0e26('0x62')][_0x0e26('0x35')]({'where':{'name':_0x3c67f4,'userProfileId':_0x36ea89['userProfileId']},'raw':!![]})['then'](function(_0x5c13b5){if(_0x5c13b5&&_0x5c13b5[_0x0e26('0x59')]===0x0){return db[_0x0e26('0x37')][_0x0e26('0x53')]({'name':_0x9d95e4[_0x0e26('0x39')],'resourceId':_0x9d95e4['id'],'type':_0x5c13b5[_0x0e26('0x39')],'sectionId':_0x5c13b5['id']},{})[_0x0e26('0x2b')](function(){return _0x130fd6;});}else{return _0x130fd6;}})['catch'](function(_0x2cacb1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cacb1);throw _0x2cacb1;});}return _0x130fd6;});}})[_0x0e26('0x2b')](respondWithResult(_0xea717d,0xc9))[_0x0e26('0x50')](handleError(_0xea717d,null));};exports[_0x0e26('0x2a')]=function(_0x2af159,_0x65b1b6){if(_0x2af159[_0x0e26('0x5f')]['id']){delete _0x2af159[_0x0e26('0x5f')]['id'];}return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x2af159[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x65b1b6,null))[_0x0e26('0x2b')](saveUpdates(_0x2af159[_0x0e26('0x5f')],null))[_0x0e26('0x2b')](respondWithResult(_0x65b1b6,null))['catch'](handleError(_0x65b1b6,null));};exports[_0x0e26('0x2c')]=function(_0x3254c1,_0x1e0af0){return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x3254c1[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x1e0af0,null))[_0x0e26('0x2b')](removeEntity(_0x1e0af0,null))[_0x0e26('0x50')](handleError(_0x1e0af0,null));};exports['getHoppers']=function(_0x1c3a46,_0x501e93,_0xa37524){var _0x3d0bc8={'raw':![],'where':{}};var _0x47e92c={};var _0x5dd116={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0e26('0x63')]({'where':{'id':_0x1c3a46['params']['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x501e93,null))['then'](function(_0x1ac3e0){if(_0x1ac3e0){_0x47e92c['model']=_[_0x0e26('0x5c')](db[_0x0e26('0x64')]['rawAttributes']);_0x47e92c[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x1c3a46['query']);_0x47e92c[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x47e92c[_0x0e26('0x42')],_0x47e92c[_0x0e26('0x3f')]);_0x3d0bc8[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x47e92c[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x1c3a46['query'][_0x0e26('0x43')]));_0x3d0bc8[_0x0e26('0x44')]=_0x3d0bc8[_0x0e26('0x44')][_0x0e26('0x52')]?_0x3d0bc8[_0x0e26('0x44')]:_0x47e92c[_0x0e26('0x42')];if(!_0x1c3a46[_0x0e26('0x3f')][_0x0e26('0x45')](_0x0e26('0x65'))){_0x3d0bc8[_0x0e26('0x24')]=qs['limit'](_0x1c3a46[_0x0e26('0x3f')][_0x0e26('0x24')]);_0x3d0bc8[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x1c3a46['query'][_0x0e26('0x22')]);}_0x3d0bc8[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x1c3a46[_0x0e26('0x3f')]['sort']);_0x3d0bc8[_0x0e26('0x48')]=qs['filters'](_['pick'](_0x1c3a46['query'],_0x47e92c[_0x0e26('0x40')]));_0x3d0bc8['where']['VoiceQueueId']=_0x1ac3e0['id'];if(_0x1c3a46[_0x0e26('0x3f')][_0x0e26('0x30')]){_0x3d0bc8[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x3d0bc8['where'],{'$or':_[_0x0e26('0x32')](_0x3d0bc8[_0x0e26('0x44')],function(_0x10ccb6){var _0x5cb84f={};_0x5cb84f[_0x10ccb6]={'$like':'%'+_0x1c3a46[_0x0e26('0x3f')][_0x0e26('0x30')]+'%'};return _0x5cb84f;})});}_0x3d0bc8=_[_0x0e26('0x4a')]({},_0x3d0bc8,_0x1c3a46['options']);return db[_0x0e26('0x64')][_0x0e26('0x25')]({'where':_0x3d0bc8[_0x0e26('0x48')]})['then'](function(_0x19276e){_0x5dd116[_0x0e26('0x25')]=_0x19276e;if(_0x1c3a46[_0x0e26('0x3f')][_0x0e26('0x4c')]){_0x3d0bc8['include']=[{'all':!![]}];}return db['CmHopper'][_0x0e26('0x4e')](_0x3d0bc8);})[_0x0e26('0x2b')](function(_0x5a21d9){_0x5dd116[_0x0e26('0x4f')]=_0x5a21d9;return _0x5dd116;});}})['then'](respondWithFilteredResult(_0x501e93,_0x3d0bc8))[_0x0e26('0x50')](handleError(_0x501e93,null));};exports[_0x0e26('0x66')]=function(_0x7d4fb5,_0x14de03,_0x2d7aef){var _0x21c2cc={'raw':!![],'where':{}};var _0x3101da={};var _0x50a2d1={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0e26('0x63')]({'where':{'id':_0x7d4fb5[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x14de03,null))[_0x0e26('0x2b')](function(_0x96379c){if(_0x96379c){_0x3101da[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db[_0x0e26('0x67')][_0x0e26('0x3d')]);_0x3101da[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x7d4fb5[_0x0e26('0x3f')]);_0x3101da[_0x0e26('0x40')]=_['intersection'](_0x3101da[_0x0e26('0x42')],_0x3101da[_0x0e26('0x3f')]);_0x21c2cc['attributes']=_[_0x0e26('0x41')](_0x3101da[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x7d4fb5[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x21c2cc[_0x0e26('0x44')]=_0x21c2cc['attributes'][_0x0e26('0x52')]?_0x21c2cc[_0x0e26('0x44')]:_0x3101da[_0x0e26('0x42')];if(!_0x7d4fb5[_0x0e26('0x3f')]['hasOwnProperty'](_0x0e26('0x65'))){_0x21c2cc[_0x0e26('0x24')]=qs['limit'](_0x7d4fb5[_0x0e26('0x3f')]['limit']);_0x21c2cc['offset']=qs[_0x0e26('0x22')](_0x7d4fb5['query'][_0x0e26('0x22')]);}_0x21c2cc[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x7d4fb5[_0x0e26('0x3f')][_0x0e26('0x47')]);_0x21c2cc[_0x0e26('0x48')]=qs[_0x0e26('0x40')](_['pick'](_0x7d4fb5[_0x0e26('0x3f')],_0x3101da['filters']));_0x21c2cc[_0x0e26('0x48')][_0x0e26('0x68')]=_0x96379c['id'];if(_0x7d4fb5['query'][_0x0e26('0x30')]){_0x21c2cc['where']=_[_0x0e26('0x4a')](_0x21c2cc['where'],{'$or':_['map'](_0x21c2cc[_0x0e26('0x44')],function(_0x46a6ad){var _0x12b748={};_0x12b748[_0x46a6ad]={'$like':'%'+_0x7d4fb5[_0x0e26('0x3f')][_0x0e26('0x30')]+'%'};return _0x12b748;})});}_0x21c2cc=_[_0x0e26('0x4a')]({},_0x21c2cc,_0x7d4fb5['options']);return db[_0x0e26('0x67')][_0x0e26('0x25')]({'where':_0x21c2cc[_0x0e26('0x48')]})['then'](function(_0x2e090a){_0x50a2d1['count']=_0x2e090a;if(_0x7d4fb5[_0x0e26('0x3f')][_0x0e26('0x4c')]){_0x21c2cc[_0x0e26('0x4d')]=[{'all':!![]}];}return db[_0x0e26('0x67')][_0x0e26('0x4e')](_0x21c2cc);})[_0x0e26('0x2b')](function(_0x2a7ff8){_0x50a2d1[_0x0e26('0x4f')]=_0x2a7ff8;return _0x50a2d1;});}})[_0x0e26('0x2b')](respondWithFilteredResult(_0x14de03,_0x21c2cc))[_0x0e26('0x50')](handleError(_0x14de03,null));};exports['getHopperFinals']=function(_0x63c2c3,_0x2361c5,_0x8b066b){var _0x34748a={'raw':!![],'where':{}};var _0xe785dd={};var _0x11726a={'count':0x0,'rows':[]};return db[_0x0e26('0x3c')][_0x0e26('0x63')]({'where':{'id':_0x63c2c3[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x2361c5,null))[_0x0e26('0x2b')](function(_0x87c20b){if(_0x87c20b){_0xe785dd[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db['CmHopperFinal'][_0x0e26('0x3d')]);_0xe785dd[_0x0e26('0x3f')]=_['keys'](_0x63c2c3[_0x0e26('0x3f')]);_0xe785dd[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0xe785dd[_0x0e26('0x42')],_0xe785dd[_0x0e26('0x3f')]);_0x34748a[_0x0e26('0x44')]=_['intersection'](_0xe785dd[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x63c2c3[_0x0e26('0x3f')]['fields']));_0x34748a[_0x0e26('0x44')]=_0x34748a[_0x0e26('0x44')]['length']?_0x34748a[_0x0e26('0x44')]:_0xe785dd[_0x0e26('0x42')];if(!_0x63c2c3['query'][_0x0e26('0x45')](_0x0e26('0x65'))){_0x34748a[_0x0e26('0x24')]=qs['limit'](_0x63c2c3[_0x0e26('0x3f')]['limit']);_0x34748a[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x63c2c3[_0x0e26('0x3f')]['offset']);}_0x34748a[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x63c2c3['query']['sort']);_0x34748a[_0x0e26('0x48')]=qs['filters'](_[_0x0e26('0x49')](_0x63c2c3[_0x0e26('0x3f')],_0xe785dd[_0x0e26('0x40')]));_0x34748a['where']['VoiceQueueId']=_0x87c20b['id'];if(_0x63c2c3['query'][_0x0e26('0x30')]){_0x34748a[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x34748a[_0x0e26('0x48')],{'$or':_['map'](_0x34748a[_0x0e26('0x44')],function(_0x5db211){var _0x233aa7={};_0x233aa7[_0x5db211]={'$like':'%'+_0x63c2c3['query']['filter']+'%'};return _0x233aa7;})});}_0x34748a=_['merge']({},_0x34748a,_0x63c2c3[_0x0e26('0x4b')]);return db[_0x0e26('0x69')]['count']({'where':_0x34748a[_0x0e26('0x48')]})[_0x0e26('0x2b')](function(_0x2bd1ea){_0x11726a[_0x0e26('0x25')]=_0x2bd1ea;if(_0x63c2c3[_0x0e26('0x3f')][_0x0e26('0x4c')]){_0x34748a[_0x0e26('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0e26('0x4e')](_0x34748a);})[_0x0e26('0x2b')](function(_0x3be73e){_0x11726a['rows']=_0x3be73e;return _0x11726a;});}})[_0x0e26('0x2b')](respondWithFilteredResult(_0x2361c5,_0x34748a))[_0x0e26('0x50')](handleError(_0x2361c5,null));};exports['getHopperBlacks']=function(_0x4afabe,_0xf3d79b,_0x32761e){var _0x349db6={'raw':!![],'where':{}};var _0x3f352c={};var _0x485ebd={'count':0x0,'rows':[]};return db[_0x0e26('0x3c')][_0x0e26('0x63')]({'where':{'id':_0x4afabe[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0xf3d79b,null))[_0x0e26('0x2b')](function(_0x9d626b){if(_0x9d626b){_0x3f352c['model']=_[_0x0e26('0x5c')](db[_0x0e26('0x6a')][_0x0e26('0x3d')]);_0x3f352c[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x4afabe['query']);_0x3f352c['filters']=_[_0x0e26('0x41')](_0x3f352c[_0x0e26('0x42')],_0x3f352c[_0x0e26('0x3f')]);_0x349db6[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x3f352c[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x4afabe[_0x0e26('0x3f')]['fields']));_0x349db6[_0x0e26('0x44')]=_0x349db6[_0x0e26('0x44')][_0x0e26('0x52')]?_0x349db6['attributes']:_0x3f352c[_0x0e26('0x42')];if(!_0x4afabe[_0x0e26('0x3f')][_0x0e26('0x45')](_0x0e26('0x65'))){_0x349db6[_0x0e26('0x24')]=qs[_0x0e26('0x24')](_0x4afabe['query']['limit']);_0x349db6['offset']=qs[_0x0e26('0x22')](_0x4afabe[_0x0e26('0x3f')]['offset']);}_0x349db6[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x4afabe[_0x0e26('0x3f')][_0x0e26('0x47')]);_0x349db6[_0x0e26('0x48')]=qs['filters'](_[_0x0e26('0x49')](_0x4afabe[_0x0e26('0x3f')],_0x3f352c[_0x0e26('0x40')]));_0x349db6[_0x0e26('0x48')][_0x0e26('0x68')]=_0x9d626b['id'];if(_0x4afabe[_0x0e26('0x3f')][_0x0e26('0x30')]){_0x349db6['where']=_[_0x0e26('0x4a')](_0x349db6['where'],{'$or':_[_0x0e26('0x32')](_0x349db6[_0x0e26('0x44')],function(_0x4ef9b2){var _0x3945fc={};_0x3945fc[_0x4ef9b2]={'$like':'%'+_0x4afabe[_0x0e26('0x3f')][_0x0e26('0x30')]+'%'};return _0x3945fc;})});}_0x349db6=_[_0x0e26('0x4a')]({},_0x349db6,_0x4afabe[_0x0e26('0x4b')]);return db[_0x0e26('0x6a')]['count']({'where':_0x349db6[_0x0e26('0x48')]})[_0x0e26('0x2b')](function(_0x700f83){_0x485ebd[_0x0e26('0x25')]=_0x700f83;if(_0x4afabe[_0x0e26('0x3f')][_0x0e26('0x4c')]){_0x349db6['include']=[{'all':!![]}];}return db[_0x0e26('0x6a')]['findAll'](_0x349db6);})['then'](function(_0x24c2e4){_0x485ebd[_0x0e26('0x4f')]=_0x24c2e4;return _0x485ebd;});}})[_0x0e26('0x2b')](respondWithFilteredResult(_0xf3d79b,_0x349db6))[_0x0e26('0x50')](handleError(_0xf3d79b,null));};exports[_0x0e26('0x6b')]=function(_0x35f0a9,_0x570833,_0x42dcb6){var _0x3d1826={};var _0x266a2a={};var _0x525a26;var _0x2c2c63;return db['VoiceQueue'][_0x0e26('0x63')]({'where':{'id':_0x35f0a9['params']['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x570833,null))['then'](function(_0x55a250){if(_0x55a250){_0x525a26=_0x55a250;_0x266a2a[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db[_0x0e26('0x6c')][_0x0e26('0x3d')]);_0x266a2a[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x35f0a9[_0x0e26('0x3f')]);_0x266a2a[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x266a2a[_0x0e26('0x42')],_0x266a2a['query']);_0x3d1826[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x266a2a[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x35f0a9[_0x0e26('0x3f')]['fields']));_0x3d1826[_0x0e26('0x44')]=_0x3d1826[_0x0e26('0x44')][_0x0e26('0x52')]?_0x3d1826[_0x0e26('0x44')]:_0x266a2a['model'];_0x3d1826[_0x0e26('0x46')]=qs['sort'](_0x35f0a9['query'][_0x0e26('0x47')]);_0x3d1826[_0x0e26('0x48')]=qs[_0x0e26('0x40')](_[_0x0e26('0x49')](_0x35f0a9[_0x0e26('0x3f')],_0x266a2a[_0x0e26('0x40')]));if(_0x35f0a9[_0x0e26('0x3f')][_0x0e26('0x30')]){_0x3d1826[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x3d1826[_0x0e26('0x48')],{'$or':_[_0x0e26('0x32')](_0x3d1826[_0x0e26('0x44')],function(_0x1be0b3){var _0x32b38a={};_0x32b38a[_0x1be0b3]={'$like':'%'+_0x35f0a9[_0x0e26('0x3f')]['filter']+'%'};return _0x32b38a;})});}_0x3d1826=_[_0x0e26('0x4a')]({},_0x3d1826,_0x35f0a9['options']);return _0x525a26[_0x0e26('0x6b')](_0x3d1826);}})[_0x0e26('0x2b')](function(_0x1371d7){if(_0x1371d7){_0x2c2c63=_0x1371d7['length'];if(!_0x35f0a9[_0x0e26('0x3f')]['hasOwnProperty'](_0x0e26('0x65'))){_0x3d1826[_0x0e26('0x24')]=qs[_0x0e26('0x24')](_0x35f0a9[_0x0e26('0x3f')]['limit']);_0x3d1826[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x35f0a9[_0x0e26('0x3f')]['offset']);}return _0x525a26[_0x0e26('0x6b')](_0x3d1826);}})[_0x0e26('0x2b')](function(_0x3d4c11){if(_0x3d4c11){return _0x3d4c11?{'count':_0x2c2c63,'rows':_0x3d4c11}:null;}})[_0x0e26('0x2b')](respondWithResult(_0x570833,null))[_0x0e26('0x50')](handleError(_0x570833,null));};exports[_0x0e26('0x6d')]=function(_0x55a690,_0x470471,_0x2775a4){var _0x3ce749=_0x55a690[_0x0e26('0x5f')][_0x0e26('0x6e')];var _0x5a8776=_[_0x0e26('0x32')](_0x3ce749,'id');return db[_0x0e26('0x6c')]['findAll']({'where':{'id':_0x5a8776},'attributes':['id'],'include':[{'model':db[_0x0e26('0x6f')],'as':'Agents','attributes':['id',_0x0e26('0x39'),'online',_0x0e26('0x70'),_0x0e26('0x71')],'raw':!![]}]})[_0x0e26('0x2b')](function(_0x254ace){if(_0x254ace){var _0x23b89f=_['flatMap'](_0x254ace,function(_0x4460bd){var _0x6acf7a=_0x4460bd[_0x0e26('0x2d')]({'plain':!![]});_0x6acf7a['Agents']['forEach'](function(_0x99ff6){_0x99ff6[_0x0e26('0x72')]=_[_0x0e26('0x35')](_0x3ce749,{'id':_0x6acf7a['id']})['penalty'];});return _0x6acf7a[_0x0e26('0x73')];});return db['VoiceQueue'][_0x0e26('0x35')]({'where':{'id':_0x55a690[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](function(_0x218889){return db[_0x0e26('0x74')][_0x0e26('0x75')](function(_0x53f05e){return _0x218889['addTeams'](_0x5a8776,{'transaction':_0x53f05e})[_0x0e26('0x2b')](function(){return BPromise[_0x0e26('0x76')](_0x3ce749,function(_0x299e27){return db[_0x0e26('0x77')]['upsert']({'TeamId':_0x299e27['id'],'VoiceQueueId':_0x55a690[_0x0e26('0x51')]['id'],'penalty':_0x299e27[_0x0e26('0x72')]},{'transaction':_0x53f05e});});})['then'](function(){return BPromise[_0x0e26('0x76')](_0x23b89f,function(_0x2362f8){return db[_0x0e26('0x78')][_0x0e26('0x79')]({'where':{'UserId':_0x2362f8['id'],'VoiceQueueId':_0x55a690[_0x0e26('0x51')]['id']},'defaults':{'penalty':_0x2362f8[_0x0e26('0x72')]},'transaction':_0x53f05e});});})[_0x0e26('0x2b')](function(){return BPromise[_0x0e26('0x76')](_[_0x0e26('0x30')](_0x23b89f,{'online':!![]}),function(_0x5ca968){return db['UserVoiceQueueRt'][_0x0e26('0x7a')]({'membername':_0x5ca968[_0x0e26('0x39')],'UserId':_0x5ca968['id'],'queue_name':_0x218889[_0x0e26('0x39')],'VoiceQueueId':_0x218889['id'],'interface':_[_0x0e26('0x7b')](_0x5ca968[_0x0e26('0x71')])?util['format'](_0x0e26('0x7c'),_0x5ca968[_0x0e26('0x39')]):_0x5ca968[_0x0e26('0x71')],'paused':_0x5ca968[_0x0e26('0x70')]||![],'penalty':_0x5ca968[_0x0e26('0x72')]},{'transaction':_0x53f05e});});})[_0x0e26('0x2b')](function(){_0x23b89f[_0x0e26('0x7d')](function(_0x49e968){socket[_0x0e26('0x7e')](_0x0e26('0x7f'),{'UserId':_0x49e968['id'],'VoiceQueueId':_0x218889['id']});});});});});}})[_0x0e26('0x2b')](respondWithStatusCode(_0x470471,null))[_0x0e26('0x50')](handleError(_0x470471,null));};exports[_0x0e26('0x80')]=function(_0x3c047b,_0x5c0dcb,_0x303b7f){return db[_0x0e26('0x6c')][_0x0e26('0x4e')]({'where':{'id':_0x3c047b[_0x0e26('0x3f')][_0x0e26('0x81')]},'attributes':['id'],'include':[{'model':db[_0x0e26('0x6f')],'as':_0x0e26('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c0dcb,null))['then'](function(_0x182506){var _0x2904ca=_[_0x0e26('0x32')](_0x182506,'id');var _0x26b031=[];var _0x45fa92=[];var _0x3b2c8b=squel[_0x0e26('0x82')]();_0x3b2c8b[_0x0e26('0x83')]('tq.TeamId')[_0x0e26('0x84')](_0x0e26('0x85'),'tq')[_0x0e26('0x86')]('user_has_teams','ut',_0x0e26('0x87'))[_0x0e26('0x48')](_0x0e26('0x88'),_0x3c047b['params']['id']);for(var _0x125e1a=0x0;_0x125e1a<_0x182506[_0x0e26('0x52')];_0x125e1a+=0x1){let _0x21c85e=_0x182506[_0x125e1a];for(var _0x4b2c56=0x0;_0x4b2c56<_0x21c85e[_0x0e26('0x73')][_0x0e26('0x52')];_0x4b2c56+=0x1){let _0x42b65e=_0x21c85e['Agents'][_0x4b2c56];var _0x188859=_0x3b2c8b[_0x0e26('0x5b')]();_0x188859[_0x0e26('0x48')]('ut.UserId\x20=\x20?',_0x42b65e['id']);_0x45fa92[_0x0e26('0x89')](db[_0x0e26('0x74')][_0x0e26('0x3f')](_0x188859[_0x0e26('0x8a')](),{'type':db['sequelize'][_0x0e26('0x8b')][_0x0e26('0x8c')]})[_0x0e26('0x2b')](function(_0x55ecdf){if(_0x55ecdf['length']===0x1){return _0x42b65e['id'];}else{var _0x10bb14=_['every'](_[_0x0e26('0x32')](_0x55ecdf,_0x0e26('0x8d')),function(_0x4742c1){return _[_0x0e26('0x34')](_0x2904ca,_0x4742c1);});if(_0x10bb14){return _0x42b65e['id'];}}}));}}return BPromise['all'](_0x45fa92)[_0x0e26('0x2b')](function(_0x186594){_0x26b031=_(_0x26b031)[_0x0e26('0x8e')](_0x186594)[_0x0e26('0x8f')]()['value']();return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x3c047b[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](function(_0x197ec9){return db['sequelize'][_0x0e26('0x75')](function(_0x3518d7){return _0x197ec9['removeTeams'](_0x3c047b[_0x0e26('0x3f')][_0x0e26('0x81')],{'transaction':_0x3518d7})[_0x0e26('0x2b')](function(){if(!_['isEmpty'](_0x26b031)){return _0x197ec9[_0x0e26('0x90')](_0x26b031,{'transaction':_0x3518d7})[_0x0e26('0x2b')](function(){return db[_0x0e26('0x91')][_0x0e26('0x2c')]({'where':{'VoiceQueueId':_0x3c047b[_0x0e26('0x51')]['id'],'UserId':_0x26b031},'transaction':_0x3518d7});});}})[_0x0e26('0x2b')](function(){_0x26b031[_0x0e26('0x7d')](function(_0xa9c586){socket['emit'](_0x0e26('0x92'),{'UserId':_0xa9c586,'VoiceQueueId':_0x197ec9['id']});});});});});});})[_0x0e26('0x2b')](respondWithStatusCode(_0x5c0dcb,null))[_0x0e26('0x50')](handleError(_0x5c0dcb,null));};exports[_0x0e26('0x93')]=function(_0x2436da,_0x33c0f4,_0x4cee5e){var _0x5a6b14,_0x4ccbf6;return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x2436da[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x33c0f4,null))['then'](function(_0x244e64){if(_0x244e64){_0x4ccbf6=_0x244e64;return _0x244e64[_0x0e26('0x93')](_0x2436da[_0x0e26('0x5f')][_0x0e26('0x81')],_[_0x0e26('0x5d')](_0x2436da[_0x0e26('0x5f')],[_0x0e26('0x81'),'id'])||{})[_0x0e26('0x94')](function(_0x408370){for(var _0x21a702=0x0;_0x21a702<_0x2436da[_0x0e26('0x5f')]['ids']['length'];_0x21a702+=0x1){socket[_0x0e26('0x7e')]('userVoiceQueue:save',{'UserId':Number(_0x2436da[_0x0e26('0x5f')][_0x0e26('0x81')][_0x21a702]),'VoiceQueueId':Number(_0x2436da[_0x0e26('0x51')]['id'])});}return _0x408370;});}})[_0x0e26('0x2b')](function(_0x533685){_0x5a6b14=_0x533685||[];if(_0x4ccbf6){return db[_0x0e26('0x6f')][_0x0e26('0x4e')]({'where':{'id':_0x2436da[_0x0e26('0x5f')][_0x0e26('0x81')]},'attributes':['id',_0x0e26('0x39'),_0x0e26('0x95'),_0x0e26('0x70'),_0x0e26('0x71')],'raw':!![]});}})[_0x0e26('0x2b')](function(_0x2ebd89){if(!_[_0x0e26('0x96')](_0x2ebd89)){var _0xecf91d=[];for(var _0x27cb28=0x0;_0x27cb28<_0x2ebd89[_0x0e26('0x52')];_0x27cb28++){if(_0x2ebd89[_0x27cb28]['online']){_0xecf91d[_0x0e26('0x89')](db['UserVoiceQueueRt'][_0x0e26('0x7a')]({'membername':_0x2ebd89[_0x27cb28][_0x0e26('0x39')],'UserId':_0x2ebd89[_0x27cb28]['id'],'queue_name':_0x4ccbf6['name'],'VoiceQueueId':_0x4ccbf6['id'],'interface':_[_0x0e26('0x7b')](_0x2ebd89[_0x27cb28][_0x0e26('0x71')])?util['format']('SIP/%s',_0x2ebd89[_0x27cb28][_0x0e26('0x39')]):_0x2ebd89[_0x27cb28][_0x0e26('0x71')],'paused':_0x2ebd89[_0x27cb28][_0x0e26('0x70')]||![],'penalty':_0x2436da[_0x0e26('0x5f')][_0x0e26('0x72')]||0x0}));}}return BPromise[_0x0e26('0x97')](_0xecf91d);}})['then'](function(){return _0x5a6b14;})[_0x0e26('0x2b')](respondWithResult(_0x33c0f4,null))[_0x0e26('0x50')](handleError(_0x33c0f4,null));};exports[_0x0e26('0x90')]=function(_0x6f68c2,_0x43ac3d,_0x8c4365){return db[_0x0e26('0x3c')]['find']({'where':{'id':_0x6f68c2[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x43ac3d,null))[_0x0e26('0x2b')](function(_0x26bf44){if(_0x26bf44){return _0x26bf44['removeAgents'](_0x6f68c2[_0x0e26('0x3f')][_0x0e26('0x81')])['then'](function(){if(_[_0x0e26('0x98')](_0x6f68c2['query'][_0x0e26('0x81')])){for(var _0x5ce0ff=0x0;_0x5ce0ff<_0x6f68c2[_0x0e26('0x3f')][_0x0e26('0x81')][_0x0e26('0x52')];_0x5ce0ff+=0x1){socket[_0x0e26('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x6f68c2['query'][_0x0e26('0x81')][_0x5ce0ff]),'VoiceQueueId':Number(_0x6f68c2[_0x0e26('0x51')]['id'])});}}else{socket[_0x0e26('0x7e')](_0x0e26('0x92'),{'UserId':Number(_0x6f68c2[_0x0e26('0x3f')][_0x0e26('0x81')]),'VoiceQueueId':Number(_0x6f68c2['params']['id'])});}});}})[_0x0e26('0x2b')](function(_0x292880){return db[_0x0e26('0x91')]['destroy']({'where':{'VoiceQueueId':_0x6f68c2[_0x0e26('0x51')]['id'],'UserId':_0x6f68c2['query'][_0x0e26('0x81')]}})[_0x0e26('0x2b')](function(){return _0x292880;});})[_0x0e26('0x2b')](respondWithStatusCode(_0x43ac3d,null))['catch'](handleError(_0x43ac3d,null));};exports[_0x0e26('0x99')]=function(_0x1bfeb1,_0x40b048,_0x580f05){var _0x3647aa={};var _0x5dc599={};var _0x372195;var _0x3b3864;return db['VoiceQueue'][_0x0e26('0x63')]({'where':{'id':_0x1bfeb1['params']['id']}})['then'](handleEntityNotFound(_0x40b048,null))[_0x0e26('0x2b')](function(_0x410c72){if(_0x410c72){_0x372195=_0x410c72;_0x5dc599[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db['User']['rawAttributes']);_0x5dc599[_0x0e26('0x3f')]=_['keys'](_0x1bfeb1[_0x0e26('0x3f')]);_0x5dc599['filters']=_[_0x0e26('0x41')](_0x5dc599['model'],_0x5dc599[_0x0e26('0x3f')]);_0x3647aa[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x5dc599['model'],qs[_0x0e26('0x43')](_0x1bfeb1[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x3647aa[_0x0e26('0x44')]=_0x3647aa[_0x0e26('0x44')][_0x0e26('0x52')]?_0x3647aa[_0x0e26('0x44')]:_0x5dc599[_0x0e26('0x42')];_0x3647aa['order']=qs[_0x0e26('0x47')](_0x1bfeb1[_0x0e26('0x3f')]['sort']);_0x3647aa['where']=qs['filters'](_[_0x0e26('0x49')](_0x1bfeb1['query'],_0x5dc599['filters']));if(_0x1bfeb1[_0x0e26('0x3f')][_0x0e26('0x30')]){_0x3647aa['where']=_['merge'](_0x3647aa[_0x0e26('0x48')],{'$or':_[_0x0e26('0x32')](_0x3647aa['attributes'],function(_0x2da3a7){var _0x2a6e30={};_0x2a6e30[_0x2da3a7]={'$like':'%'+_0x1bfeb1['query']['filter']+'%'};return _0x2a6e30;})});}_0x3647aa=_[_0x0e26('0x4a')]({},_0x3647aa,_0x1bfeb1[_0x0e26('0x4b')]);return _0x372195[_0x0e26('0x99')](_0x3647aa);}})[_0x0e26('0x2b')](function(_0x20e8dd){if(_0x20e8dd){_0x3b3864=_0x20e8dd[_0x0e26('0x52')];if(!_0x1bfeb1['query'][_0x0e26('0x45')]('nolimit')){_0x3647aa[_0x0e26('0x24')]=qs['limit'](_0x1bfeb1[_0x0e26('0x3f')][_0x0e26('0x24')]);_0x3647aa[_0x0e26('0x22')]=qs['offset'](_0x1bfeb1[_0x0e26('0x3f')]['offset']);}return _0x372195[_0x0e26('0x99')](_0x3647aa);}})['then'](function(_0x346530){if(_0x346530){return _0x346530?{'count':_0x3b3864,'rows':_0x346530}:null;}})[_0x0e26('0x2b')](respondWithResult(_0x40b048,null))[_0x0e26('0x50')](handleError(_0x40b048,null));};exports[_0x0e26('0x9a')]=function(_0x402591,_0x247072,_0x17a06e){var _0x124805={};var _0x5d3494={};var _0x5b6b3b;var _0x1c73aa;return db[_0x0e26('0x3c')][_0x0e26('0x63')]({'where':{'id':_0x402591[_0x0e26('0x51')]['id']}})['then'](handleEntityNotFound(_0x247072,null))[_0x0e26('0x2b')](function(_0x5b0641){if(_0x5b0641){_0x5b6b3b=_0x5b0641;_0x5d3494[_0x0e26('0x42')]=_[_0x0e26('0x5c')](db[_0x0e26('0x91')][_0x0e26('0x3d')]);_0x5d3494[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x402591[_0x0e26('0x3f')]);_0x5d3494[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x5d3494[_0x0e26('0x42')],_0x5d3494[_0x0e26('0x3f')]);_0x124805[_0x0e26('0x44')]=_['intersection'](_0x5d3494['model'],qs[_0x0e26('0x43')](_0x402591[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x124805['attributes']=_0x124805['attributes']['length']?_0x124805['attributes']:_0x5d3494[_0x0e26('0x42')];_0x124805[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x402591[_0x0e26('0x3f')][_0x0e26('0x47')]);_0x124805[_0x0e26('0x48')]=qs['filters'](_[_0x0e26('0x49')](_0x402591['query'],_0x5d3494['filters']));if(_0x402591[_0x0e26('0x3f')]['filter']){_0x124805[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x124805[_0x0e26('0x48')],{'$or':_['map'](_0x124805[_0x0e26('0x44')],function(_0x191435){var _0x2a94ac={};_0x2a94ac[_0x191435]={'$like':'%'+_0x402591['query'][_0x0e26('0x30')]+'%'};return _0x2a94ac;})});}_0x124805=_['merge']({},_0x124805,_0x402591['options']);return _0x5b6b3b[_0x0e26('0x9a')](_0x124805);}})[_0x0e26('0x2b')](function(_0x5b497b){if(_0x5b497b){_0x1c73aa=_0x5b497b[_0x0e26('0x52')];if(!_0x402591[_0x0e26('0x3f')][_0x0e26('0x45')]('nolimit')){_0x124805[_0x0e26('0x24')]=qs['limit'](_0x402591['query'][_0x0e26('0x24')]);_0x124805[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x402591[_0x0e26('0x3f')]['offset']);}return _0x5b6b3b[_0x0e26('0x9a')](_0x124805);}})[_0x0e26('0x2b')](function(_0x32602d){return _0x32602d?{'count':_0x1c73aa,'rows':_0x32602d}:null;})[_0x0e26('0x2b')](respondWithResult(_0x247072,null))[_0x0e26('0x50')](handleError(_0x247072,null));};exports[_0x0e26('0x9b')]=function(_0x1c300d,_0x570cae,_0x4b0034){var _0x4b95c8={};var _0x23c32b={};var _0x15be16;var _0x89a4a9;return db[_0x0e26('0x3c')][_0x0e26('0x63')]({'where':{'id':_0x1c300d[_0x0e26('0x51')]['id']}})['then'](handleEntityNotFound(_0x570cae,null))[_0x0e26('0x2b')](function(_0x239580){if(_0x239580){_0x15be16=_0x239580;_0x23c32b[_0x0e26('0x42')]=_['keys'](db[_0x0e26('0x9c')][_0x0e26('0x3d')]);_0x23c32b[_0x0e26('0x3f')]=_[_0x0e26('0x5c')](_0x1c300d[_0x0e26('0x3f')]);_0x23c32b[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x23c32b[_0x0e26('0x42')],_0x23c32b[_0x0e26('0x3f')]);_0x4b95c8[_0x0e26('0x44')]=_['intersection'](_0x23c32b[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x1c300d[_0x0e26('0x3f')][_0x0e26('0x43')]));_0x4b95c8[_0x0e26('0x44')]=_0x4b95c8[_0x0e26('0x44')][_0x0e26('0x52')]?_0x4b95c8[_0x0e26('0x44')]:_0x23c32b[_0x0e26('0x42')];_0x4b95c8[_0x0e26('0x46')]=qs[_0x0e26('0x47')](_0x1c300d[_0x0e26('0x3f')]['sort']);_0x4b95c8[_0x0e26('0x48')]=qs[_0x0e26('0x40')](_['pick'](_0x1c300d[_0x0e26('0x3f')],_0x23c32b[_0x0e26('0x40')]));if(_0x1c300d[_0x0e26('0x3f')]['filter']){_0x4b95c8['where']=_['merge'](_0x4b95c8[_0x0e26('0x48')],{'$or':_[_0x0e26('0x32')](_0x4b95c8[_0x0e26('0x44')],function(_0x27c4d8){var _0x2a545c={};_0x2a545c[_0x27c4d8]={'$like':'%'+_0x1c300d['query']['filter']+'%'};return _0x2a545c;})});}_0x4b95c8=_[_0x0e26('0x4a')]({},_0x4b95c8,_0x1c300d[_0x0e26('0x4b')]);return _0x15be16[_0x0e26('0x9b')](_0x4b95c8);}})[_0x0e26('0x2b')](function(_0x5e8d6d){if(_0x5e8d6d){_0x89a4a9=_0x5e8d6d[_0x0e26('0x52')];if(!_0x1c300d[_0x0e26('0x3f')]['hasOwnProperty']('nolimit')){_0x4b95c8[_0x0e26('0x24')]=qs[_0x0e26('0x24')](_0x1c300d[_0x0e26('0x3f')][_0x0e26('0x24')]);_0x4b95c8[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x1c300d[_0x0e26('0x3f')][_0x0e26('0x22')]);}return _0x15be16[_0x0e26('0x9b')](_0x4b95c8);}})[_0x0e26('0x2b')](function(_0x267b2c){if(_0x267b2c){return _0x267b2c?{'count':_0x89a4a9,'rows':_0x267b2c}:null;}})['then'](respondWithResult(_0x570cae,null))[_0x0e26('0x50')](handleError(_0x570cae,null));};exports['addLists']=function(_0x53c6bf,_0x10d5fe,_0xbc8730){var _0x4226d7=moment()[_0x0e26('0x9d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2772d1,_0x3e53a9;return db[_0x0e26('0x3c')]['find']({'where':{'id':_0x53c6bf[_0x0e26('0x51')]['id']}})['then'](handleEntityNotFound(_0x10d5fe,null))['then'](function(_0x1469c6){if(_0x1469c6){_0x3e53a9=_0x1469c6;return _0x1469c6['addLists'](_0x53c6bf[_0x0e26('0x5f')][_0x0e26('0x81')],_['omit'](_0x53c6bf[_0x0e26('0x5f')],[_0x0e26('0x81'),'id'])||{});}return null;})[_0x0e26('0x94')](function(_0x11904f){var _0x3f0f2f;_0x2772d1=_0x11904f||[];var _0x5702e4=[];if(_0x11904f){for(var _0x513c7f=0x0;_0x513c7f<_0x11904f[_0x0e26('0x52')];_0x513c7f+=0x1){var _0x5eaeca=_0x11904f[_0x513c7f][_0x0e26('0x2d')]({'plain':!![]});_0x3e53a9[_0x0e26('0x9e')]=_0x53c6bf[_0x0e26('0x5f')][_0x0e26('0x9e')]?_0x53c6bf[_0x0e26('0x5f')][_0x0e26('0x9e')]:_0x3e53a9[_0x0e26('0x9e')];switch(_0x3e53a9[_0x0e26('0x9e')]){case _0x0e26('0x9f'):_0x3f0f2f=squel[_0x0e26('0xa0')]()['into'](_0x0e26('0xa1'))[_0x0e26('0xa2')](['phone',_0x0e26('0xa3'),_0x0e26('0xa4'),_0x0e26('0xa5'),'VoiceQueueId',_0x0e26('0x60'),_0x0e26('0x5e')],squel['select']()[_0x0e26('0x83')]('phone',_0x0e26('0xa6'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0xa3'))[_0x0e26('0x83')]('id',_0x0e26('0xa4'))[_0x0e26('0x83')](_0x5eaeca['CmListId'][_0x0e26('0x8a')](),'ListId')['field'](_0x53c6bf[_0x0e26('0x51')]['id'][_0x0e26('0x8a')](),'VoiceQueueId')[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0x60'))['field']('\x27'+_0x4226d7+'\x27','updatedAt')[_0x0e26('0x84')]('cm_contacts')['where'](_0x0e26('0xa7'))[_0x0e26('0x48')]('ListId\x20=\x20?',_0x5eaeca[_0x0e26('0xa8')][_0x0e26('0x8a')]())[_0x0e26('0x48')](_0x0e26('0xa9'))[_0x0e26('0x48')](_0x0e26('0xaa'),squel['select']()['field'](_0x0e26('0xab'))[_0x0e26('0x84')](_0x0e26('0xac'))[_0x0e26('0x48')](_0x0e26('0x88'),_0x53c6bf['params']['id'][_0x0e26('0x8a')]()))[_0x0e26('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0e26('0x82')]()[_0x0e26('0x83')](_0x0e26('0xad'))[_0x0e26('0x84')](_0x0e26('0xa1'))[_0x0e26('0x48')](_0x0e26('0x88'),_0x53c6bf[_0x0e26('0x51')]['id'][_0x0e26('0x8a')]())))['toString']();break;case _0x0e26('0xae'):_0x3f0f2f=squel[_0x0e26('0xa0')]()[_0x0e26('0xaf')](_0x0e26('0xa1'))['fromQuery']([_0x0e26('0xa6'),'scheduledAt','ContactId',_0x0e26('0xa5'),'VoiceQueueId',_0x0e26('0x60'),_0x0e26('0x5e')],squel[_0x0e26('0x82')]()['field']('phone',_0x0e26('0xa6'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0xa3'))[_0x0e26('0x83')]('id',_0x0e26('0xa4'))['field'](_0x5eaeca['CmListId']['toString'](),_0x0e26('0xa5'))[_0x0e26('0x83')](_0x53c6bf[_0x0e26('0x51')]['id'][_0x0e26('0x8a')](),_0x0e26('0x68'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0x60'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0x5e'))[_0x0e26('0x84')](_0x0e26('0xb0'))['where']('deletedAt\x20IS\x20NULL')[_0x0e26('0x48')](_0x0e26('0xb1'),_0x5eaeca[_0x0e26('0xa8')][_0x0e26('0x8a')]())[_0x0e26('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x0e26('0x48')](_0x0e26('0xaa'),squel[_0x0e26('0x82')]()['field'](_0x0e26('0xad'))[_0x0e26('0x84')]('cm_hopper')[_0x0e26('0x48')](_0x0e26('0x88'),_0x53c6bf[_0x0e26('0x51')]['id']['toString']())))[_0x0e26('0x8a')]();break;default:_0x3f0f2f=squel[_0x0e26('0xa0')]()[_0x0e26('0xaf')](_0x0e26('0xa1'))['fromQuery']([_0x0e26('0xa6'),_0x0e26('0xa3'),_0x0e26('0xa4'),_0x0e26('0xa5'),_0x0e26('0x68'),_0x0e26('0x60'),_0x0e26('0x5e')],squel['select']()[_0x0e26('0x83')](_0x0e26('0xa6'),_0x0e26('0xa6'))['field']('\x27'+_0x4226d7+'\x27',_0x0e26('0xa3'))[_0x0e26('0x83')]('id','ContactId')['field'](_0x5eaeca[_0x0e26('0xa8')]['toString'](),_0x0e26('0xa5'))[_0x0e26('0x83')](_0x53c6bf[_0x0e26('0x51')]['id']['toString'](),_0x0e26('0x68'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0x60'))['field']('\x27'+_0x4226d7+'\x27',_0x0e26('0x5e'))[_0x0e26('0x84')](_0x0e26('0xb0'))[_0x0e26('0x48')]('deletedAt\x20IS\x20NULL')[_0x0e26('0x48')](_0x0e26('0xb1'),_0x5eaeca[_0x0e26('0xa8')][_0x0e26('0x8a')]())[_0x0e26('0x48')](_0x0e26('0xa9')))['toString']();}_0x5702e4['push'](db[_0x0e26('0x74')]['query'](_0x3f0f2f));}return BPromise['all'](_0x5702e4);}})['then'](function(){var _0x1b9af9=[];var _0xef279e=squel[_0x0e26('0xa0')]()[_0x0e26('0xaf')]('cm_hopper_additional_phones')[_0x0e26('0xa2')]([_0x0e26('0xb2'),'phone',_0x0e26('0xb3'),_0x0e26('0x60'),_0x0e26('0x5e')],squel[_0x0e26('0x82')]()['field'](_0x0e26('0xb4'))[_0x0e26('0x83')](_0x0e26('0xb5'))[_0x0e26('0x83')](_0x0e26('0xb6'))[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27','createdAt')[_0x0e26('0x83')]('\x27'+_0x4226d7+'\x27',_0x0e26('0x5e'))[_0x0e26('0x84')](_0x0e26('0xb7'),'ci')[_0x0e26('0x86')](_0x0e26('0xa1'),'h',_0x0e26('0xb8'))['where'](_0x0e26('0xb9'),_0x4226d7)[_0x0e26('0x48')](_0x0e26('0xba'),_0x0e26('0xbb')))[_0x0e26('0x8a')]();_0x1b9af9['push'](db[_0x0e26('0x74')][_0x0e26('0x3f')](_0xef279e));return BPromise[_0x0e26('0x97')](_0x1b9af9);})[_0x0e26('0x2b')](function(){return _0x2772d1;})['then'](respondWithResult(_0x10d5fe,null))[_0x0e26('0x50')](handleError(_0x10d5fe,null));};exports[_0x0e26('0xbc')]=function(_0x51e4b6,_0x42bb44,_0x1c5e46){return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x51e4b6[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x42bb44,null))[_0x0e26('0x2b')](function(_0x741f34){if(_0x741f34){return _0x741f34['removeLists'](_0x51e4b6['query'][_0x0e26('0x81')]);}})[_0x0e26('0x2b')](function(_0x4d581e){if(_0x4d581e){return db[_0x0e26('0x64')][_0x0e26('0x2c')]({'where':{'ListId':_0x51e4b6[_0x0e26('0x3f')][_0x0e26('0x81')],'VoiceQueueId':_0x51e4b6[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](function(){return _0x4d581e;});}})['then'](respondWithStatusCode(_0x42bb44,null))['catch'](handleError(_0x42bb44,null));};exports['getBlackLists']=function(_0x345d98,_0x2ff7a9,_0x1d2dd3){var _0x5077b3={};var _0x4827f8={};var _0x53916e;var _0xaf9018;return db[_0x0e26('0x3c')]['findOne']({'where':{'id':_0x345d98[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x2ff7a9,null))[_0x0e26('0x2b')](function(_0xfd511b){if(_0xfd511b){_0x53916e=_0xfd511b;_0x4827f8['model']=_['keys'](db['CmList'][_0x0e26('0x3d')]);_0x4827f8['query']=_[_0x0e26('0x5c')](_0x345d98[_0x0e26('0x3f')]);_0x4827f8[_0x0e26('0x40')]=_[_0x0e26('0x41')](_0x4827f8[_0x0e26('0x42')],_0x4827f8[_0x0e26('0x3f')]);_0x5077b3[_0x0e26('0x44')]=_[_0x0e26('0x41')](_0x4827f8[_0x0e26('0x42')],qs[_0x0e26('0x43')](_0x345d98['query'][_0x0e26('0x43')]));_0x5077b3['attributes']=_0x5077b3[_0x0e26('0x44')][_0x0e26('0x52')]?_0x5077b3[_0x0e26('0x44')]:_0x4827f8[_0x0e26('0x42')];_0x5077b3[_0x0e26('0x46')]=qs['sort'](_0x345d98[_0x0e26('0x3f')][_0x0e26('0x47')]);_0x5077b3[_0x0e26('0x48')]=qs[_0x0e26('0x40')](_[_0x0e26('0x49')](_0x345d98[_0x0e26('0x3f')],_0x4827f8['filters']));if(_0x345d98[_0x0e26('0x3f')][_0x0e26('0x30')]){_0x5077b3[_0x0e26('0x48')]=_[_0x0e26('0x4a')](_0x5077b3[_0x0e26('0x48')],{'$or':_[_0x0e26('0x32')](_0x5077b3[_0x0e26('0x44')],function(_0x5b111d){var _0x8a1681={};_0x8a1681[_0x5b111d]={'$like':'%'+_0x345d98[_0x0e26('0x3f')][_0x0e26('0x30')]+'%'};return _0x8a1681;})});}_0x5077b3=_[_0x0e26('0x4a')]({},_0x5077b3,_0x345d98[_0x0e26('0x4b')]);return _0x53916e[_0x0e26('0xbd')](_0x5077b3);}})[_0x0e26('0x2b')](function(_0x5a26e8){if(_0x5a26e8){_0xaf9018=_0x5a26e8['length'];if(!_0x345d98[_0x0e26('0x3f')][_0x0e26('0x45')](_0x0e26('0x65'))){_0x5077b3['limit']=qs[_0x0e26('0x24')](_0x345d98[_0x0e26('0x3f')][_0x0e26('0x24')]);_0x5077b3[_0x0e26('0x22')]=qs[_0x0e26('0x22')](_0x345d98[_0x0e26('0x3f')][_0x0e26('0x22')]);}return _0x53916e[_0x0e26('0xbd')](_0x5077b3);}})[_0x0e26('0x2b')](function(_0x2303f6){if(_0x2303f6){return _0x2303f6?{'count':_0xaf9018,'rows':_0x2303f6}:null;}})['then'](respondWithResult(_0x2ff7a9,null))['catch'](handleError(_0x2ff7a9,null));};exports[_0x0e26('0xbe')]=function(_0x36b9b2,_0x3e9a06,_0x438ab1){var _0x2236d8,_0x540002;return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x36b9b2[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x3e9a06,null))[_0x0e26('0x2b')](function(_0x3f05a1){if(_0x3f05a1){_0x540002=_0x3f05a1;return _0x3f05a1['addBlackLists'](_0x36b9b2[_0x0e26('0x5f')]['ids'],_[_0x0e26('0x5d')](_0x36b9b2[_0x0e26('0x5f')],[_0x0e26('0x81'),'id'])||{});}return null;})['spread'](function(_0x883117){var _0x41d5ea;_0x2236d8=_0x883117||[];var _0x2cdc8d=[];if(_0x883117){for(var _0x1478a0=0x0;_0x1478a0<_0x883117[_0x0e26('0x52')];_0x1478a0+=0x1){var _0x1e8426=_0x883117[_0x1478a0][_0x0e26('0x2d')]({'plain':!![]});_0x41d5ea=squel['insert']()[_0x0e26('0xaf')](_0x0e26('0xbf'))[_0x0e26('0xa2')]([_0x0e26('0xa6'),'ContactId',_0x0e26('0xa5'),'VoiceQueueId',_0x0e26('0x60'),_0x0e26('0x5e')],squel[_0x0e26('0x82')]()[_0x0e26('0x83')](_0x0e26('0xa6'),_0x0e26('0xa6'))[_0x0e26('0x83')]('id',_0x0e26('0xa4'))[_0x0e26('0x83')](_0x1e8426['CmListId']['toString'](),_0x0e26('0xa5'))[_0x0e26('0x83')](_0x36b9b2[_0x0e26('0x51')]['id']['toString'](),_0x0e26('0x68'))[_0x0e26('0x83')](_0x0e26('0xc0'),'createdAt')[_0x0e26('0x83')](_0x0e26('0xc0'),_0x0e26('0x5e'))[_0x0e26('0x84')](_0x0e26('0xb0'))[_0x0e26('0x48')](_0x0e26('0xa7'))['where']('ListId\x20=\x20?',_0x1e8426['CmListId']['toString']())[_0x0e26('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x0e26('0x8a')]();_0x2cdc8d[_0x0e26('0x89')](db['sequelize'][_0x0e26('0x3f')](_0x41d5ea));}return BPromise['all'](_0x2cdc8d);}})['then'](function(){return _0x2236d8;})[_0x0e26('0x2b')](respondWithResult(_0x3e9a06,null))[_0x0e26('0x50')](handleError(_0x3e9a06,null));};exports['removeBlackLists']=function(_0x1296f0,_0x469b2c,_0x5e32e6){return db[_0x0e26('0x3c')][_0x0e26('0x35')]({'where':{'id':_0x1296f0[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](handleEntityNotFound(_0x469b2c,null))[_0x0e26('0x2b')](function(_0x5f373e){if(_0x5f373e){return _0x5f373e[_0x0e26('0xc1')](_0x1296f0[_0x0e26('0x3f')][_0x0e26('0x81')]);}})[_0x0e26('0x2b')](function(_0x3ce16f){if(_0x3ce16f){return db[_0x0e26('0x6a')][_0x0e26('0x2c')]({'where':{'ListId':_0x1296f0[_0x0e26('0x3f')]['ids'],'VoiceQueueId':_0x1296f0[_0x0e26('0x51')]['id']}})[_0x0e26('0x2b')](function(){return _0x3ce16f;});}})['then'](respondWithStatusCode(_0x469b2c,null))[_0x0e26('0x50')](handleError(_0x469b2c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2bc79f9..28450b5 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 _0xc134=['VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x558ba9,_0x43afbb){var _0x251305=function(_0x587264){while(--_0x587264){_0x558ba9['push'](_0x558ba9['shift']());}};_0x251305(++_0x43afbb);}(_0xc134,0x166));var _0x4c13=function(_0x52712a,_0x12f47b){_0x52712a=_0x52712a-0x0;var _0x3f4afc=_0xc134[_0x52712a];return _0x3f4afc;};'use strict';var EventEmitter=require(_0x4c13('0x0'));var VoiceQueue=require(_0x4c13('0x1'))['db'][_0x4c13('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4c13('0x3')](0x0);var events={'afterCreate':_0x4c13('0x4'),'afterUpdate':_0x4c13('0x5'),'afterDestroy':'remove'};function emitEvent(_0xae37cc){return function(_0x447653,_0x4e096e,_0x491981){VoiceQueueEvents[_0x4c13('0x6')](_0xae37cc+':'+_0x447653['id'],_0x447653);VoiceQueueEvents[_0x4c13('0x6')](_0xae37cc,_0x447653);_0x491981(null);};}for(var e in events){if(events[_0x4c13('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x4c13('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xbb2d=['hook','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x44e855,_0x4d8b2c){var _0x1bc647=function(_0x4c8ecf){while(--_0x4c8ecf){_0x44e855['push'](_0x44e855['shift']());}};_0x1bc647(++_0x4d8b2c);}(_0xbb2d,0x151));var _0xdbb2=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0xbb2d[_0x115d5b];return _0x6cfc50;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xdbb2('0x0'))['db'][_0xdbb2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdbb2('0x2')](0x0);var events={'afterCreate':_0xdbb2('0x3'),'afterUpdate':_0xdbb2('0x4'),'afterDestroy':'remove'};function emitEvent(_0xe9e387){return function(_0x4e96bb,_0x3544ae,_0x3b3837){VoiceQueueEvents['emit'](_0xe9e387+':'+_0x4e96bb['id'],_0x4e96bb);VoiceQueueEvents[_0xdbb2('0x5')](_0xe9e387,_0x4e96bb);_0x3b3837(null);};}for(var e in events){if(events[_0xdbb2('0x6')](e)){var event=events[e];VoiceQueue[_0xdbb2('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index df85928..5555962 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x41cd8f,_0x33ce30){var _0x43457d=function(_0x2b4d54){while(--_0x2b4d54){_0x41cd8f['push'](_0x41cd8f['shift']());}};_0x43457d(++_0x33ce30);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x5d1d9f,_0x1ef696){var _0x2faa8e=function(_0x13f5ae){while(--_0x13f5ae){_0x5d1d9f['push'](_0x5d1d9f['shift']());}};_0x2faa8e(++_0x1ef696);}(_0x008c,0x188));var _0xc008=function(_0x1aa7b1,_0xe9e31d){_0x1aa7b1=_0x1aa7b1-0x0;var _0x5d4ff4=_0x008c[_0x1aa7b1];return _0x5d4ff4;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index bd15f3f..c4af44e 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 _0x1a70=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueue','findAll','options','where','attributes','limit','include','model','map','info','GetVoiceQueue','ShowVoiceQueue','find','raw','then'];(function(_0x1ecba1,_0x57d775){var _0x3ce62e=function(_0x317107){while(--_0x317107){_0x1ecba1['push'](_0x1ecba1['shift']());}};_0x3ce62e(++_0x57d775);}(_0x1a70,0x1a2));var _0x01a7=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x1a70[_0x1416fc];return _0x3a4b34;};'use strict';var _=require('lodash');var util=require(_0x01a7('0x0'));var moment=require('moment');var BPromise=require(_0x01a7('0x1'));var rs=require(_0x01a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01a7('0x3'))['db'];var utils=require(_0x01a7('0x4'));var logger=require(_0x01a7('0x5'))(_0x01a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x01a7('0x7'));var client=jayson['client'][_0x01a7('0x8')]({'port':0x232a});config[_0x01a7('0x9')]=_[_0x01a7('0xa')](config[_0x01a7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x01a7('0xb'))(new Redis(config['redis']));require(_0x01a7('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a21ef,_0x24d287,_0x82fb85){return new BPromise(function(_0x319d96,_0x46302b){return client[_0x01a7('0xd')](_0x4a21ef,_0x82fb85)['then'](function(_0x372fb5){logger['info'](_0x01a7('0xe'),_0x24d287,_0x01a7('0xf'));logger[_0x01a7('0x10')](_0x01a7('0x11'),_0x24d287,_0x01a7('0xf'),JSON[_0x01a7('0x12')](_0x372fb5));if(_0x372fb5[_0x01a7('0x13')]){if(_0x372fb5[_0x01a7('0x13')]['code']===0x1f4){logger['error'](_0x01a7('0xe'),_0x24d287,_0x372fb5[_0x01a7('0x13')][_0x01a7('0x14')]);return _0x46302b(_0x372fb5[_0x01a7('0x13')][_0x01a7('0x14')]);}logger[_0x01a7('0x13')](_0x01a7('0xe'),_0x24d287,_0x372fb5[_0x01a7('0x13')][_0x01a7('0x14')]);return _0x319d96(_0x372fb5[_0x01a7('0x13')][_0x01a7('0x14')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x24d287,_0x01a7('0xf'));_0x319d96(_0x372fb5[_0x01a7('0x15')][_0x01a7('0x14')]);}})[_0x01a7('0x16')](function(_0x40a138){logger[_0x01a7('0x13')](_0x01a7('0xe'),_0x24d287,_0x40a138);_0x46302b(_0x40a138);});});}exports['GetVoiceQueue']=function(_0x3d0dd6){var _0x22e561=this;return new Promise(function(_0x3f7565,_0x2b0c42){return db[_0x01a7('0x17')][_0x01a7('0x18')]({'raw':_0x3d0dd6[_0x01a7('0x19')]?_0x3d0dd6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d0dd6[_0x01a7('0x19')]?_0x3d0dd6[_0x01a7('0x19')][_0x01a7('0x1a')]||null:null,'attributes':_0x3d0dd6['options']?_0x3d0dd6[_0x01a7('0x19')][_0x01a7('0x1b')]||null:null,'limit':_0x3d0dd6[_0x01a7('0x19')]?_0x3d0dd6[_0x01a7('0x19')][_0x01a7('0x1c')]||null:null,'include':_0x3d0dd6[_0x01a7('0x19')]?_0x3d0dd6[_0x01a7('0x19')]['include']?_['map'](_0x3d0dd6[_0x01a7('0x19')][_0x01a7('0x1d')],function(_0x1d1cf7){return{'model':db[_0x1d1cf7[_0x01a7('0x1e')]],'as':_0x1d1cf7['as'],'attributes':_0x1d1cf7[_0x01a7('0x1b')],'include':_0x1d1cf7[_0x01a7('0x1d')]?_[_0x01a7('0x1f')](_0x1d1cf7[_0x01a7('0x1d')],function(_0xcbe263){return{'model':db[_0xcbe263[_0x01a7('0x1e')]],'as':_0xcbe263['as'],'attributes':_0xcbe263[_0x01a7('0x1b')],'include':_0xcbe263[_0x01a7('0x1d')]?_['map'](_0xcbe263[_0x01a7('0x1d')],function(_0x490629){return{'model':db[_0x490629['model']],'as':_0x490629['as'],'attributes':_0x490629[_0x01a7('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f22fa){logger[_0x01a7('0x20')](_0x01a7('0x21'),_0x3d0dd6);logger['debug']('GetVoiceQueue',_0x3d0dd6,JSON['stringify'](_0x2f22fa));_0x3f7565(_0x2f22fa);})[_0x01a7('0x16')](function(_0x33b57d){logger[_0x01a7('0x13')](_0x01a7('0x21'),_0x33b57d[_0x01a7('0x14')],_0x3d0dd6);_0x2b0c42(_0x22e561[_0x01a7('0x13')](0x1f4,_0x33b57d[_0x01a7('0x14')]));});});};exports[_0x01a7('0x22')]=function(_0x5dee75){var _0x1ca4ff=this;return new Promise(function(_0x23cd34,_0x1c072e){return db[_0x01a7('0x17')][_0x01a7('0x23')]({'raw':_0x5dee75[_0x01a7('0x19')]?_0x5dee75[_0x01a7('0x19')][_0x01a7('0x24')]===undefined?!![]:![]:!![],'where':_0x5dee75['options']?_0x5dee75[_0x01a7('0x19')][_0x01a7('0x1a')]||null:null,'attributes':_0x5dee75[_0x01a7('0x19')]?_0x5dee75[_0x01a7('0x19')][_0x01a7('0x1b')]||null:null,'include':_0x5dee75['options']?_0x5dee75[_0x01a7('0x19')][_0x01a7('0x1d')]?_['map'](_0x5dee75[_0x01a7('0x19')][_0x01a7('0x1d')],function(_0xd6aeb5){return{'model':db[_0xd6aeb5[_0x01a7('0x1e')]],'as':_0xd6aeb5['as'],'attributes':_0xd6aeb5[_0x01a7('0x1b')],'include':_0xd6aeb5[_0x01a7('0x1d')]?_[_0x01a7('0x1f')](_0xd6aeb5[_0x01a7('0x1d')],function(_0x5d5d35){return{'model':db[_0x5d5d35['model']],'as':_0x5d5d35['as'],'attributes':_0x5d5d35[_0x01a7('0x1b')],'include':_0x5d5d35[_0x01a7('0x1d')]?_[_0x01a7('0x1f')](_0x5d5d35[_0x01a7('0x1d')],function(_0x2447b1){return{'model':db[_0x2447b1['model']],'as':_0x2447b1['as'],'attributes':_0x2447b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x01a7('0x25')](function(_0x3e9b4f){logger[_0x01a7('0x20')](_0x01a7('0x22'),_0x5dee75);logger[_0x01a7('0x10')](_0x01a7('0x22'),_0x5dee75,JSON[_0x01a7('0x12')](_0x3e9b4f));_0x23cd34(_0x3e9b4f);})[_0x01a7('0x16')](function(_0x20bed4){logger['error'](_0x01a7('0x22'),_0x20bed4['message'],_0x5dee75);_0x1c072e(_0x1ca4ff['error'](0x1f4,_0x20bed4[_0x01a7('0x14')]));});});}; \ No newline at end of file +var _0x191e=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','limit','include','map','model','attributes','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','where','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x133c7d,_0x43a76a){var _0x2598b8=function(_0x243f4e){while(--_0x243f4e){_0x133c7d['push'](_0x133c7d['shift']());}};_0x2598b8(++_0x43a76a);}(_0x191e,0x14c));var _0xe191=function(_0x34944f,_0x41dd98){_0x34944f=_0x34944f-0x0;var _0x24cbd8=_0x191e[_0x34944f];return _0x24cbd8;};'use strict';var _=require(_0xe191('0x0'));var util=require(_0xe191('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe191('0x2'));var db=require(_0xe191('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe191('0x4'))(_0xe191('0x5'));var config=require(_0xe191('0x6'));var jayson=require(_0xe191('0x7'));var client=jayson[_0xe191('0x8')][_0xe191('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe191('0xa')],{'host':_0xe191('0xb'),'port':0x18eb});var socket=require(_0xe191('0xc'))(new Redis(config[_0xe191('0xa')]));require(_0xe191('0xd'))[_0xe191('0xe')](socket);function respondWithRpcPromise(_0x50de79,_0x3150b5,_0x5cfadf){return new BPromise(function(_0x474410,_0x54f107){return client[_0xe191('0xf')](_0x50de79,_0x5cfadf)['then'](function(_0x13edb0){logger[_0xe191('0x10')](_0xe191('0x11'),_0x3150b5,_0xe191('0x12'));logger[_0xe191('0x13')](_0xe191('0x14'),_0x3150b5,'request\x20sent',JSON[_0xe191('0x15')](_0x13edb0));if(_0x13edb0[_0xe191('0x16')]){if(_0x13edb0['error']['code']===0x1f4){logger[_0xe191('0x16')](_0xe191('0x11'),_0x3150b5,_0x13edb0['error'][_0xe191('0x17')]);return _0x54f107(_0x13edb0['error'][_0xe191('0x17')]);}logger['error'](_0xe191('0x11'),_0x3150b5,_0x13edb0['error'][_0xe191('0x17')]);return _0x474410(_0x13edb0[_0xe191('0x16')][_0xe191('0x17')]);}else{logger[_0xe191('0x10')](_0xe191('0x11'),_0x3150b5,_0xe191('0x12'));_0x474410(_0x13edb0[_0xe191('0x18')][_0xe191('0x17')]);}})[_0xe191('0x19')](function(_0x58d19d){logger[_0xe191('0x16')](_0xe191('0x11'),_0x3150b5,_0x58d19d);_0x54f107(_0x58d19d);});});}exports['GetVoiceQueue']=function(_0x3a6f7a){var _0x5e3f32=this;return new Promise(function(_0x2a85aa,_0x2560b5){return db['VoiceQueue'][_0xe191('0x1a')]({'raw':_0x3a6f7a[_0xe191('0x1b')]?_0x3a6f7a[_0xe191('0x1b')][_0xe191('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a6f7a[_0xe191('0x1b')]?_0x3a6f7a[_0xe191('0x1b')]['where']||null:null,'attributes':_0x3a6f7a[_0xe191('0x1b')]?_0x3a6f7a['options']['attributes']||null:null,'limit':_0x3a6f7a['options']?_0x3a6f7a[_0xe191('0x1b')][_0xe191('0x1d')]||null:null,'include':_0x3a6f7a[_0xe191('0x1b')]?_0x3a6f7a[_0xe191('0x1b')][_0xe191('0x1e')]?_[_0xe191('0x1f')](_0x3a6f7a[_0xe191('0x1b')][_0xe191('0x1e')],function(_0x415c3b){return{'model':db[_0x415c3b[_0xe191('0x20')]],'as':_0x415c3b['as'],'attributes':_0x415c3b['attributes'],'include':_0x415c3b['include']?_[_0xe191('0x1f')](_0x415c3b[_0xe191('0x1e')],function(_0x34e5b1){return{'model':db[_0x34e5b1[_0xe191('0x20')]],'as':_0x34e5b1['as'],'attributes':_0x34e5b1['attributes'],'include':_0x34e5b1[_0xe191('0x1e')]?_['map'](_0x34e5b1[_0xe191('0x1e')],function(_0x11877d){return{'model':db[_0x11877d[_0xe191('0x20')]],'as':_0x11877d['as'],'attributes':_0x11877d[_0xe191('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50a03c){logger['info']('GetVoiceQueue',_0x3a6f7a);logger[_0xe191('0x13')]('GetVoiceQueue',_0x3a6f7a,JSON[_0xe191('0x15')](_0x50a03c));_0x2a85aa(_0x50a03c);})[_0xe191('0x19')](function(_0x290bf0){logger[_0xe191('0x16')](_0xe191('0x22'),_0x290bf0[_0xe191('0x17')],_0x3a6f7a);_0x2560b5(_0x5e3f32[_0xe191('0x16')](0x1f4,_0x290bf0[_0xe191('0x17')]));});});};exports[_0xe191('0x23')]=function(_0x3cad83){var _0x5aed0b=this;return new Promise(function(_0x3e896f,_0x4430ca){return db[_0xe191('0x24')][_0xe191('0x25')]({'raw':_0x3cad83['options']?_0x3cad83[_0xe191('0x1b')][_0xe191('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cad83[_0xe191('0x1b')]?_0x3cad83[_0xe191('0x1b')][_0xe191('0x26')]||null:null,'attributes':_0x3cad83[_0xe191('0x1b')]?_0x3cad83[_0xe191('0x1b')]['attributes']||null:null,'include':_0x3cad83[_0xe191('0x1b')]?_0x3cad83[_0xe191('0x1b')][_0xe191('0x1e')]?_[_0xe191('0x1f')](_0x3cad83[_0xe191('0x1b')][_0xe191('0x1e')],function(_0x5f1d19){return{'model':db[_0x5f1d19[_0xe191('0x20')]],'as':_0x5f1d19['as'],'attributes':_0x5f1d19[_0xe191('0x21')],'include':_0x5f1d19[_0xe191('0x1e')]?_[_0xe191('0x1f')](_0x5f1d19[_0xe191('0x1e')],function(_0x50b803){return{'model':db[_0x50b803[_0xe191('0x20')]],'as':_0x50b803['as'],'attributes':_0x50b803[_0xe191('0x21')],'include':_0x50b803[_0xe191('0x1e')]?_[_0xe191('0x1f')](_0x50b803[_0xe191('0x1e')],function(_0x320db1){return{'model':db[_0x320db1[_0xe191('0x20')]],'as':_0x320db1['as'],'attributes':_0x320db1[_0xe191('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb08f41){logger[_0xe191('0x10')](_0xe191('0x23'),_0x3cad83);logger[_0xe191('0x13')]('ShowVoiceQueue',_0x3cad83,JSON[_0xe191('0x15')](_0xb08f41));_0x3e896f(_0xb08f41);})[_0xe191('0x19')](function(_0x34b3e7){logger['error'](_0xe191('0x23'),_0x34b3e7[_0xe191('0x17')],_0x3cad83);_0x4430ca(_0x5aed0b[_0xe191('0x16')](0x1f4,_0x34b3e7[_0xe191('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 5472789..26cd02d 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 _0xe1c7=['remove','update','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x4db7c1,_0x40baeb){var _0x41fa35=function(_0x363797){while(--_0x363797){_0x4db7c1['push'](_0x4db7c1['shift']());}};_0x41fa35(++_0x40baeb);}(_0xe1c7,0xb3));var _0x7e1c=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xe1c7[_0xb0fe92];return _0x41787f;};'use strict';var VoiceQueueEvents=require(_0x7e1c('0x0'));var events=['save',_0x7e1c('0x1'),_0x7e1c('0x2')];function createListener(_0x2093f6,_0x4401fb){return function(_0x21b953){_0x4401fb['emit'](_0x2093f6,_0x21b953);};}function removeListener(_0x50b960,_0x314970){return function(){VoiceQueueEvents[_0x7e1c('0x3')](_0x50b960,_0x314970);};}exports[_0x7e1c('0x4')]=function(_0x59cb67){for(var _0x4fefaa=0x0,_0x157a21=events['length'];_0x4fefaa<_0x157a21;_0x4fefaa++){var _0x341031=events[_0x4fefaa];var _0x670615=createListener(_0x7e1c('0x5')+_0x341031,_0x59cb67);VoiceQueueEvents['on'](_0x341031,_0x670615);}}; \ No newline at end of file +var _0x70e1=['length','voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x70e1,0x182));var _0x170e=function(_0x149ad5,_0x12b417){_0x149ad5=_0x149ad5-0x0;var _0x2566b7=_0x70e1[_0x149ad5];return _0x2566b7;};'use strict';var VoiceQueueEvents=require(_0x170e('0x0'));var events=[_0x170e('0x1'),_0x170e('0x2'),_0x170e('0x3')];function createListener(_0x494f72,_0x585bfb){return function(_0x3a2511){_0x585bfb['emit'](_0x494f72,_0x3a2511);};}function removeListener(_0x3db5cb,_0x235a88){return function(){VoiceQueueEvents[_0x170e('0x4')](_0x3db5cb,_0x235a88);};}exports[_0x170e('0x5')]=function(_0x1d0c0a){for(var _0x50d393=0x0,_0x4a3001=events[_0x170e('0x6')];_0x50d393<_0x4a3001;_0x50d393++){var _0x7a501e=events[_0x50d393];var _0x478c16=createListener(_0x170e('0x7')+_0x7a501e,_0x1d0c0a);VoiceQueueEvents['on'](_0x7a501e,_0x478c16);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7f45a46..14e8b39 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 _0x5f4d=['path','connect-timeout','Router','../../config/environment','isAuthenticated','index','get','describe','/index','post','create','put','delete','/:id','exports','multer','util'];(function(_0x4c8e2d,_0x51a01d){var _0x54e299=function(_0x298acc){while(--_0x298acc){_0x4c8e2d['push'](_0x4c8e2d['shift']());}};_0x54e299(++_0x51a01d);}(_0x5f4d,0x86));var _0xd5f4=function(_0x3fe210,_0x3cdd84){_0x3fe210=_0x3fe210-0x0;var _0x293b52=_0x5f4d[_0x3fe210];return _0x293b52;};'use strict';var multer=require(_0xd5f4('0x0'));var util=require(_0xd5f4('0x1'));var path=require(_0xd5f4('0x2'));var timeout=require(_0xd5f4('0x3'));var express=require('express');var router=express[_0xd5f4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd5f4('0x5'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xd5f4('0x6')](),controller[_0xd5f4('0x7')]);router[_0xd5f4('0x8')]('/describe',auth[_0xd5f4('0x6')](),controller[_0xd5f4('0x9')]);router[_0xd5f4('0x8')](_0xd5f4('0xa'),auth[_0xd5f4('0x6')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth[_0xd5f4('0x6')](),controller['show']);router[_0xd5f4('0xb')]('/',auth[_0xd5f4('0x6')](),controller[_0xd5f4('0xc')]);router[_0xd5f4('0xd')]('/:id',auth[_0xd5f4('0x6')](),controller['update']);router[_0xd5f4('0xe')](_0xd5f4('0xf'),auth[_0xd5f4('0x6')](),controller['destroy']);module[_0xd5f4('0x10')]=router; \ No newline at end of file +var _0x3265=['get','/describe','isAuthenticated','/index','getVoiceQueuesReport','/:id','show','post','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x5e4836,_0x481b94){var _0x3e5cb3=function(_0x207d88){while(--_0x207d88){_0x5e4836['push'](_0x5e4836['shift']());}};_0x3e5cb3(++_0x481b94);}(_0x3265,0x172));var _0x5326=function(_0x5dfd80,_0x1f30ac){_0x5dfd80=_0x5dfd80-0x0;var _0x45247d=_0x3265[_0x5dfd80];return _0x45247d;};'use strict';var multer=require(_0x5326('0x0'));var util=require(_0x5326('0x1'));var path=require('path');var timeout=require(_0x5326('0x2'));var express=require('express');var router=express[_0x5326('0x3')]();var fs_extra=require(_0x5326('0x4'));var auth=require(_0x5326('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5326('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5326('0x7')]);router[_0x5326('0x8')](_0x5326('0x9'),auth[_0x5326('0xa')](),controller['describe']);router[_0x5326('0x8')](_0x5326('0xb'),auth[_0x5326('0xa')](),controller[_0x5326('0xc')]);router['get'](_0x5326('0xd'),auth[_0x5326('0xa')](),controller[_0x5326('0xe')]);router[_0x5326('0xf')]('/',auth[_0x5326('0xa')](),controller['create']);router['put'](_0x5326('0xd'),auth[_0x5326('0xa')](),controller['update']);router[_0x5326('0x10')](_0x5326('0xd'),auth['isAuthenticated'](),controller[_0x5326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 06d29d8..7156153 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 _0xe57e=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x1cce59,_0x1cef8f){var _0x16cb54=function(_0x4770b1){while(--_0x4770b1){_0x1cce59['push'](_0x1cce59['shift']());}};_0x16cb54(++_0x1cef8f);}(_0xe57e,0x156));var _0xee57=function(_0x5cd11d,_0xff32c2){_0x5cd11d=_0x5cd11d-0x0;var _0x586a29=_0xe57e[_0x5cd11d];return _0x586a29;};'use strict';var Sequelize=require(_0xee57('0x0'));var moment=require(_0xee57('0x1'));module['exports']={'type':{'type':Sequelize[_0xee57('0x2')]},'uniqueid':{'type':Sequelize[_0xee57('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xee57('0x2')]},'queue':{'type':Sequelize[_0xee57('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xee57('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xee57('0x3')],'set':function(_0x1ff232){var _0x506753=moment(_0x1ff232);var _0xbe835d=moment(this[_0xee57('0x4')](_0xee57('0x5')))['format'](_0xee57('0x6'));var _0x26602a=_0x506753['diff'](_0xbe835d,_0xee57('0x7'));this[_0xee57('0x8')](_0xee57('0x9'),_0x1ff232);this[_0xee57('0x8')]('holdtime',_0x26602a||null);}},'position':{'type':Sequelize[_0xee57('0xa')]},'count':{'type':Sequelize[_0xee57('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xee57('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xee57('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xee57('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xee57('0x3')]},'queuecallerexit':{'type':Sequelize[_0xee57('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xee57('0x2')],'comment':_0xee57('0xc')},'originalposition':{'type':Sequelize[_0xee57('0xa')]},'channel':{'type':Sequelize[_0xee57('0x2')]},'connectedlinenum':{'type':Sequelize[_0xee57('0x2')]},'connectedlinename':{'type':Sequelize[_0xee57('0x2')]},'accountcode':{'type':Sequelize[_0xee57('0x2')]},'context':{'type':Sequelize[_0xee57('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xee57('0xa')]},'mohtime':{'type':Sequelize[_0xee57('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xee57('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xee57('0x2')]},'transfer':{'type':Sequelize[_0xee57('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xee57('0x2')],'comment':_0xee57('0xd')},'transferexten':{'type':Sequelize[_0xee57('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xee57('0x2')]},'secondDisposition':{'type':Sequelize[_0xee57('0x2')]},'thirdDisposition':{'type':Sequelize[_0xee57('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xee57('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x07df=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','seconds'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x07df,0x106));var _0xf07d=function(_0x145fb,_0x18c5e4){_0x145fb=_0x145fb-0x0;var _0x48e3fb=_0x07df[_0x145fb];return _0x48e3fb;};'use strict';var Sequelize=require(_0xf07d('0x0'));var moment=require(_0xf07d('0x1'));module[_0xf07d('0x2')]={'type':{'type':Sequelize[_0xf07d('0x3')]},'uniqueid':{'type':Sequelize[_0xf07d('0x3')]},'calleridnum':{'type':Sequelize[_0xf07d('0x3')]},'calleridname':{'type':Sequelize[_0xf07d('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xf07d('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xf07d('0x4')],'set':function(_0x311de0){var _0x401b0d=moment(_0x311de0);var _0x5bc9ef=moment(this['getDataValue'](_0xf07d('0x5')))[_0xf07d('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5139c6=_0x401b0d['diff'](_0x5bc9ef,_0xf07d('0x7'));this[_0xf07d('0x8')](_0xf07d('0x9'),_0x311de0);this[_0xf07d('0x8')](_0xf07d('0xa'),_0x5139c6||null);}},'position':{'type':Sequelize[_0xf07d('0xb')]},'count':{'type':Sequelize[_0xf07d('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xf07d('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xf07d('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xf07d('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf07d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xf07d('0x3')],'comment':_0xf07d('0xd')},'originalposition':{'type':Sequelize[_0xf07d('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf07d('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf07d('0x3')]},'context':{'type':Sequelize[_0xf07d('0x3')]},'exten':{'type':Sequelize[_0xf07d('0x3')]},'priority':{'type':Sequelize[_0xf07d('0x3')]},'holdtime':{'type':Sequelize[_0xf07d('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf07d('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf07d('0x3')]},'transfer':{'type':Sequelize[_0xf07d('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf07d('0x3')],'comment':_0xf07d('0xe')},'transferexten':{'type':Sequelize[_0xf07d('0x3')]},'transferuniqueid':{'type':Sequelize[_0xf07d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf07d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf07d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xf07d('0xb')],'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 cd7ae00..bcb813c 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 _0x7871=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','catch','create','body','destroy','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x532b64,_0x19811f){var _0x27a875=function(_0x45998d){while(--_0x45998d){_0x532b64['push'](_0x532b64['shift']());}};_0x27a875(++_0x19811f);}(_0x7871,0x11e));var _0x1787=function(_0x1598b2,_0x1cebf3){_0x1598b2=_0x1598b2-0x0;var _0x2ad439=_0x7871[_0x1598b2];return _0x2ad439;};'use strict';var emlformat=require(_0x1787('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1787('0x1'));var jsonpatch=require(_0x1787('0x2'));var rp=require(_0x1787('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1787('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1787('0x5'));var csv=require('to-csv');var ejs=require(_0x1787('0x6'));var fs=require('fs');var fs_extra=require(_0x1787('0x7'));var _=require(_0x1787('0x8'));var squel=require(_0x1787('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1787('0xa'));var toCsv=require(_0x1787('0xb'));var querystring=require('querystring');var Papa=require(_0x1787('0xc'));var Redis=require(_0x1787('0xd'));var authService=require(_0x1787('0xe'));var qs=require(_0x1787('0xf'));var as=require(_0x1787('0x10'));var hardwareService=require(_0x1787('0x11'));var logger=require('../../config/logger')(_0x1787('0x12'));var utils=require(_0x1787('0x13'));var config=require(_0x1787('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1787('0x15'))['db'];config[_0x1787('0x16')]=_[_0x1787('0x17')](config[_0x1787('0x16')],{'host':_0x1787('0x18'),'port':0x18eb});var socket=require(_0x1787('0x19'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x53379d,_0x410eb0){_0x410eb0=_0x410eb0||0xcc;return function(_0x3ec032){if(_0x3ec032){return _0x53379d['sendStatus'](_0x410eb0);}return _0x53379d[_0x1787('0x1a')](_0x410eb0)[_0x1787('0x1b')]();};}function respondWithResult(_0x35c91e,_0x262861){_0x262861=_0x262861||0xc8;return function(_0x2b47ec){if(_0x2b47ec){return _0x35c91e[_0x1787('0x1a')](_0x262861)[_0x1787('0x1c')](_0x2b47ec);}};}function respondWithFilteredResult(_0x886074,_0x2d77ef){return function(_0x2ed3f){if(_0x2ed3f){var _0x32b706=typeof _0x2d77ef[_0x1787('0x1d')]===_0x1787('0x1e')&&typeof _0x2d77ef['limit']===_0x1787('0x1e');var _0x554840=_0x2ed3f['count'];var _0x53d8f4=_0x32b706?0x0:_0x2d77ef[_0x1787('0x1d')];var _0x577f59=_0x32b706?_0x2ed3f['count']:_0x2d77ef[_0x1787('0x1d')]+_0x2d77ef[_0x1787('0x1f')];var _0x2c7053;if(_0x577f59>=_0x554840){_0x577f59=_0x554840;_0x2c7053=0xc8;}else{_0x2c7053=0xce;}_0x886074[_0x1787('0x1a')](_0x2c7053);return _0x886074[_0x1787('0x20')](_0x1787('0x21'),_0x53d8f4+'-'+_0x577f59+'/'+_0x554840)[_0x1787('0x1c')](_0x2ed3f);}return null;};}function patchUpdates(_0x2cbe29){return function(_0x315e2a){try{jsonpatch[_0x1787('0x22')](_0x315e2a,_0x2cbe29,!![]);}catch(_0x535227){return BPromise[_0x1787('0x23')](_0x535227);}return _0x315e2a[_0x1787('0x24')]();};}function saveUpdates(_0x90eadb,_0x1dffc6){return function(_0x2da4b7){if(_0x2da4b7){return _0x2da4b7[_0x1787('0x25')](_0x90eadb)[_0x1787('0x26')](function(_0x8d01b4){return _0x8d01b4;});}return null;};}function removeEntity(_0x592288,_0x33689f){return function(_0x1863de){if(_0x1863de){return _0x1863de['destroy']()[_0x1787('0x26')](function(){_0x592288['status'](0xcc)[_0x1787('0x1b')]();});}};}function handleEntityNotFound(_0x47f1cc,_0x126807){return function(_0x493651){if(!_0x493651){_0x47f1cc[_0x1787('0x27')](0x194);}return _0x493651;};}function handleError(_0x1d4cf3,_0x438b43){_0x438b43=_0x438b43||0x1f4;return function(_0x20601f){logger[_0x1787('0x28')](_0x20601f['stack']);if(_0x20601f['name']){delete _0x20601f['name'];}_0x1d4cf3[_0x1787('0x1a')](_0x438b43)['send'](_0x20601f);};}exports[_0x1787('0x29')]=function(_0x34ad19,_0x1ad16e){var _0x11d293={},_0x5ae1cd={},_0x519e1a={'count':0x0,'rows':[]};var _0x632624=_[_0x1787('0x2a')](db[_0x1787('0x2b')][_0x1787('0x2c')],function(_0x1fc72a){return{'name':_0x1fc72a[_0x1787('0x2d')],'type':_0x1fc72a[_0x1787('0x2e')]['key']};});_0x5ae1cd[_0x1787('0x2f')]=_['map'](_0x632624,'name');_0x5ae1cd[_0x1787('0x30')]=_[_0x1787('0x31')](_0x34ad19[_0x1787('0x30')]);_0x5ae1cd[_0x1787('0x32')]=_['intersection'](_0x5ae1cd[_0x1787('0x2f')],_0x5ae1cd[_0x1787('0x30')]);_0x11d293[_0x1787('0x33')]=_[_0x1787('0x34')](_0x5ae1cd[_0x1787('0x2f')],qs[_0x1787('0x35')](_0x34ad19['query'][_0x1787('0x35')]));_0x11d293['attributes']=_0x11d293[_0x1787('0x33')][_0x1787('0x36')]?_0x11d293[_0x1787('0x33')]:_0x5ae1cd[_0x1787('0x2f')];if(!_0x34ad19[_0x1787('0x30')][_0x1787('0x37')](_0x1787('0x38'))){_0x11d293[_0x1787('0x1f')]=qs['limit'](_0x34ad19[_0x1787('0x30')][_0x1787('0x1f')]);_0x11d293[_0x1787('0x1d')]=qs['offset'](_0x34ad19[_0x1787('0x30')]['offset']);}_0x11d293[_0x1787('0x39')]=qs[_0x1787('0x3a')](_0x34ad19[_0x1787('0x30')]['sort']);_0x11d293[_0x1787('0x3b')]=qs[_0x1787('0x32')](_['pick'](_0x34ad19[_0x1787('0x30')],_0x5ae1cd[_0x1787('0x32')]),_0x632624);if(_0x34ad19[_0x1787('0x30')][_0x1787('0x3c')]){_0x11d293[_0x1787('0x3b')]=_[_0x1787('0x3d')](_0x11d293['where'],{'$or':_['map'](_0x632624,function(_0x5c744e){if(_0x5c744e[_0x1787('0x2e')]!==_0x1787('0x3e')){var _0x5b1f75={};_0x5b1f75[_0x5c744e['name']]={'$like':'%'+_0x34ad19[_0x1787('0x30')][_0x1787('0x3c')]+'%'};return _0x5b1f75;}})});}_0x11d293=_[_0x1787('0x3d')]({},_0x11d293,_0x34ad19[_0x1787('0x3f')]);var _0x24c069={'where':_0x11d293['where']};return db[_0x1787('0x2b')]['count'](_0x24c069)[_0x1787('0x26')](function(_0x16d1e4){_0x519e1a[_0x1787('0x40')]=_0x16d1e4;if(_0x34ad19['query'][_0x1787('0x41')]){_0x11d293['include']=[{'all':!![]}];}return db[_0x1787('0x2b')][_0x1787('0x42')](_0x11d293);})[_0x1787('0x26')](function(_0x5852b1){_0x519e1a[_0x1787('0x43')]=_0x5852b1;return _0x519e1a;})[_0x1787('0x26')](respondWithFilteredResult(_0x1ad16e,_0x11d293))['catch'](handleError(_0x1ad16e,null));};exports['show']=function(_0x565284,_0x73f031){var _0x2b9aa1={'raw':![],'where':{'id':_0x565284[_0x1787('0x44')]['id']}},_0x3c9cb8={};_0x3c9cb8[_0x1787('0x2f')]=_[_0x1787('0x31')](db[_0x1787('0x2b')][_0x1787('0x2c')]);_0x3c9cb8[_0x1787('0x30')]=_['keys'](_0x565284[_0x1787('0x30')]);_0x3c9cb8['filters']=_[_0x1787('0x34')](_0x3c9cb8[_0x1787('0x2f')],_0x3c9cb8['query']);_0x2b9aa1[_0x1787('0x33')]=_[_0x1787('0x34')](_0x3c9cb8['model'],qs[_0x1787('0x35')](_0x565284['query'][_0x1787('0x35')]));_0x2b9aa1[_0x1787('0x33')]=_0x2b9aa1[_0x1787('0x33')][_0x1787('0x36')]?_0x2b9aa1[_0x1787('0x33')]:_0x3c9cb8[_0x1787('0x2f')];if(_0x565284['query'][_0x1787('0x41')]){_0x2b9aa1[_0x1787('0x45')]=[{'all':!![]}];}_0x2b9aa1=_[_0x1787('0x3d')]({},_0x2b9aa1,_0x565284[_0x1787('0x3f')]);return db[_0x1787('0x2b')]['find'](_0x2b9aa1)['then'](handleEntityNotFound(_0x73f031,null))[_0x1787('0x26')](respondWithResult(_0x73f031,null))[_0x1787('0x46')](handleError(_0x73f031,null));};exports[_0x1787('0x47')]=function(_0xef2762,_0x27cc3c){return db['VoiceQueueReport'][_0x1787('0x47')](_0xef2762[_0x1787('0x48')],{})['then'](respondWithResult(_0x27cc3c,0xc9))[_0x1787('0x46')](handleError(_0x27cc3c,null));};exports[_0x1787('0x25')]=function(_0x4a013f,_0x4b102f){if(_0x4a013f[_0x1787('0x48')]['id']){delete _0x4a013f[_0x1787('0x48')]['id'];}return db[_0x1787('0x2b')]['find']({'where':{'id':_0x4a013f['params']['id']}})['then'](handleEntityNotFound(_0x4b102f,null))[_0x1787('0x26')](saveUpdates(_0x4a013f['body'],null))[_0x1787('0x26')](respondWithResult(_0x4b102f,null))[_0x1787('0x46')](handleError(_0x4b102f,null));};exports[_0x1787('0x49')]=function(_0x398398,_0x4bb683){return db[_0x1787('0x2b')]['find']({'where':{'id':_0x398398[_0x1787('0x44')]['id']}})[_0x1787('0x26')](handleEntityNotFound(_0x4bb683,null))[_0x1787('0x26')](removeEntity(_0x4bb683,null))[_0x1787('0x46')](handleError(_0x4bb683,null));};exports[_0x1787('0x4a')]=function(_0x40323b,_0x137604){return db['VoiceQueueReport'][_0x1787('0x4a')]()[_0x1787('0x26')](respondWithResult(_0x137604,null))[_0x1787('0x46')](handleError(_0x137604,null));};exports[_0x1787('0x4b')]=function(_0x266cc0,_0x5eb1c6){var _0x3e0569={},_0x2a936d={},_0x20b4eb={'count':0x0,'rows':[]};_0x2a936d[_0x1787('0x2f')]=_[_0x1787('0x31')](db[_0x1787('0x2b')]['rawAttributes']);_0x2a936d[_0x1787('0x30')]=_[_0x1787('0x31')](_0x266cc0['query']);_0x2a936d['filters']=_[_0x1787('0x34')](_0x2a936d[_0x1787('0x2f')],_0x2a936d['query']);_0x3e0569[_0x1787('0x33')]=_[_0x1787('0x34')](_0x2a936d['model'],qs[_0x1787('0x35')](_0x266cc0[_0x1787('0x30')]['fields']));_0x3e0569[_0x1787('0x33')]=_0x3e0569[_0x1787('0x33')][_0x1787('0x36')]?_0x3e0569[_0x1787('0x33')]:_0x2a936d['model'];if(!_0x266cc0[_0x1787('0x30')][_0x1787('0x37')](_0x1787('0x38'))){_0x3e0569['limit']=qs[_0x1787('0x1f')](_0x266cc0[_0x1787('0x30')]['limit']);_0x3e0569[_0x1787('0x1d')]=qs[_0x1787('0x1d')](_0x266cc0[_0x1787('0x30')][_0x1787('0x1d')]);}_0x3e0569[_0x1787('0x39')]=qs[_0x1787('0x3a')](_0x266cc0[_0x1787('0x30')][_0x1787('0x3a')]);_0x3e0569[_0x1787('0x3b')]=qs[_0x1787('0x32')](_['pick'](_0x266cc0[_0x1787('0x30')],_0x2a936d[_0x1787('0x32')]));if(_0x266cc0[_0x1787('0x30')]['filter']){_0x3e0569[_0x1787('0x3b')]=_[_0x1787('0x3d')](_0x3e0569[_0x1787('0x3b')],{'$or':_['map'](_0x3e0569['attributes'],function(_0x3b2b70){var _0x2f6066={};_0x2f6066[_0x3b2b70]={'$like':'%'+_0x266cc0[_0x1787('0x30')][_0x1787('0x3c')]+'%'};return _0x2f6066;})});}_0x3e0569=_[_0x1787('0x3d')]({},_0x3e0569,_0x266cc0[_0x1787('0x3f')]);var _0x3ff924={'where':_0x3e0569['where']};return db[_0x1787('0x2b')]['count'](_0x3ff924)[_0x1787('0x26')](function(_0x365cdb){_0x20b4eb[_0x1787('0x40')]=_0x365cdb;if(_0x266cc0[_0x1787('0x30')][_0x1787('0x41')]){_0x3e0569[_0x1787('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x3e0569);})[_0x1787('0x26')](function(_0x2c92b7){_0x20b4eb['rows']=_0x2c92b7;return _0x20b4eb;})['then'](respondWithFilteredResult(_0x5eb1c6,_0x3e0569,'getVoiceQueuesReport'))[_0x1787('0x46')](handleError(_0x5eb1c6,null,_0x1787('0x4b')));}; \ No newline at end of file +var _0xbf0b=['order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','keys','includeAll','options','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length'];(function(_0x491c37,_0x1b6952){var _0x4277e6=function(_0xa1fb08){while(--_0xa1fb08){_0x491c37['push'](_0x491c37['shift']());}};_0x4277e6(++_0x1b6952);}(_0xbf0b,0x1a7));var _0xbbf0=function(_0x3dd88c,_0x3041fe){_0x3dd88c=_0x3dd88c-0x0;var _0x271718=_0xbf0b[_0x3dd88c];return _0x271718;};'use strict';var emlformat=require(_0xbbf0('0x0'));var rimraf=require(_0xbbf0('0x1'));var zipdir=require(_0xbbf0('0x2'));var jsonpatch=require(_0xbbf0('0x3'));var rp=require(_0xbbf0('0x4'));var moment=require('moment');var BPromise=require(_0xbbf0('0x5'));var Mustache=require(_0xbbf0('0x6'));var util=require(_0xbbf0('0x7'));var path=require(_0xbbf0('0x8'));var sox=require(_0xbbf0('0x9'));var csv=require(_0xbbf0('0xa'));var ejs=require(_0xbbf0('0xb'));var fs=require('fs');var fs_extra=require(_0xbbf0('0xc'));var _=require(_0xbbf0('0xd'));var squel=require(_0xbbf0('0xe'));var crypto=require('crypto');var jsforce=require(_0xbbf0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbbf0('0xa'));var querystring=require(_0xbbf0('0x10'));var Papa=require(_0xbbf0('0x11'));var Redis=require('ioredis');var authService=require(_0xbbf0('0x12'));var qs=require(_0xbbf0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbf0('0x14'));var logger=require(_0xbbf0('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbf0('0x16'))['db'];config[_0xbbf0('0x17')]=_['defaults'](config[_0xbbf0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbf0('0x18'))(new Redis(config[_0xbbf0('0x17')]));require(_0xbbf0('0x19'))[_0xbbf0('0x1a')](socket);function respondWithStatusCode(_0x52757b,_0x18ec0f){_0x18ec0f=_0x18ec0f||0xcc;return function(_0x2dc7e9){if(_0x2dc7e9){return _0x52757b['sendStatus'](_0x18ec0f);}return _0x52757b[_0xbbf0('0x1b')](_0x18ec0f)['end']();};}function respondWithResult(_0x40ae44,_0x452faf){_0x452faf=_0x452faf||0xc8;return function(_0xd428c0){if(_0xd428c0){return _0x40ae44['status'](_0x452faf)['json'](_0xd428c0);}};}function respondWithFilteredResult(_0x4cec20,_0x1113d6){return function(_0x2bca33){if(_0x2bca33){var _0x355f24=typeof _0x1113d6[_0xbbf0('0x1c')]===_0xbbf0('0x1d')&&typeof _0x1113d6[_0xbbf0('0x1e')]===_0xbbf0('0x1d');var _0x1b81f6=_0x2bca33[_0xbbf0('0x1f')];var _0x64dad0=_0x355f24?0x0:_0x1113d6['offset'];var _0x44fc62=_0x355f24?_0x2bca33[_0xbbf0('0x1f')]:_0x1113d6[_0xbbf0('0x1c')]+_0x1113d6['limit'];var _0x1b5864;if(_0x44fc62>=_0x1b81f6){_0x44fc62=_0x1b81f6;_0x1b5864=0xc8;}else{_0x1b5864=0xce;}_0x4cec20[_0xbbf0('0x1b')](_0x1b5864);return _0x4cec20[_0xbbf0('0x20')](_0xbbf0('0x21'),_0x64dad0+'-'+_0x44fc62+'/'+_0x1b81f6)[_0xbbf0('0x22')](_0x2bca33);}return null;};}function patchUpdates(_0xb6b004){return function(_0x2c6ea1){try{jsonpatch['apply'](_0x2c6ea1,_0xb6b004,!![]);}catch(_0x12cfce){return BPromise[_0xbbf0('0x23')](_0x12cfce);}return _0x2c6ea1['save']();};}function saveUpdates(_0x12dc21,_0x4b03fe){return function(_0x4b9a50){if(_0x4b9a50){return _0x4b9a50[_0xbbf0('0x24')](_0x12dc21)[_0xbbf0('0x25')](function(_0x6b3798){return _0x6b3798;});}return null;};}function removeEntity(_0x814733,_0x1278a7){return function(_0x33ff89){if(_0x33ff89){return _0x33ff89['destroy']()[_0xbbf0('0x25')](function(){_0x814733[_0xbbf0('0x1b')](0xcc)[_0xbbf0('0x26')]();});}};}function handleEntityNotFound(_0x552ad7,_0x16c508){return function(_0x8db175){if(!_0x8db175){_0x552ad7[_0xbbf0('0x27')](0x194);}return _0x8db175;};}function handleError(_0x32ed96,_0x10a7fe){_0x10a7fe=_0x10a7fe||0x1f4;return function(_0x4ab81b){logger[_0xbbf0('0x28')](_0x4ab81b[_0xbbf0('0x29')]);if(_0x4ab81b[_0xbbf0('0x2a')]){delete _0x4ab81b[_0xbbf0('0x2a')];}_0x32ed96[_0xbbf0('0x1b')](_0x10a7fe)[_0xbbf0('0x2b')](_0x4ab81b);};}exports[_0xbbf0('0x2c')]=function(_0x1e918c,_0x2788a7){var _0x21481a={},_0x21d522={},_0x567fb0={'count':0x0,'rows':[]};var _0x43c208=_[_0xbbf0('0x2d')](db[_0xbbf0('0x2e')]['rawAttributes'],function(_0x41216a){return{'name':_0x41216a[_0xbbf0('0x2f')],'type':_0x41216a[_0xbbf0('0x30')][_0xbbf0('0x31')]};});_0x21d522['model']=_['map'](_0x43c208,_0xbbf0('0x2a'));_0x21d522[_0xbbf0('0x32')]=_['keys'](_0x1e918c[_0xbbf0('0x32')]);_0x21d522[_0xbbf0('0x33')]=_[_0xbbf0('0x34')](_0x21d522['model'],_0x21d522[_0xbbf0('0x32')]);_0x21481a[_0xbbf0('0x35')]=_[_0xbbf0('0x34')](_0x21d522[_0xbbf0('0x36')],qs[_0xbbf0('0x37')](_0x1e918c[_0xbbf0('0x32')][_0xbbf0('0x37')]));_0x21481a[_0xbbf0('0x35')]=_0x21481a[_0xbbf0('0x35')][_0xbbf0('0x38')]?_0x21481a['attributes']:_0x21d522[_0xbbf0('0x36')];if(!_0x1e918c[_0xbbf0('0x32')]['hasOwnProperty']('nolimit')){_0x21481a['limit']=qs[_0xbbf0('0x1e')](_0x1e918c[_0xbbf0('0x32')]['limit']);_0x21481a['offset']=qs[_0xbbf0('0x1c')](_0x1e918c[_0xbbf0('0x32')][_0xbbf0('0x1c')]);}_0x21481a[_0xbbf0('0x39')]=qs[_0xbbf0('0x3a')](_0x1e918c[_0xbbf0('0x32')][_0xbbf0('0x3a')]);_0x21481a[_0xbbf0('0x3b')]=qs[_0xbbf0('0x33')](_[_0xbbf0('0x3c')](_0x1e918c[_0xbbf0('0x32')],_0x21d522['filters']),_0x43c208);if(_0x1e918c[_0xbbf0('0x32')][_0xbbf0('0x3d')]){_0x21481a[_0xbbf0('0x3b')]=_['merge'](_0x21481a[_0xbbf0('0x3b')],{'$or':_['map'](_0x43c208,function(_0x4932d4){if(_0x4932d4[_0xbbf0('0x30')]!==_0xbbf0('0x3e')){var _0x453ec9={};_0x453ec9[_0x4932d4[_0xbbf0('0x2a')]]={'$like':'%'+_0x1e918c[_0xbbf0('0x32')][_0xbbf0('0x3d')]+'%'};return _0x453ec9;}})});}_0x21481a=_[_0xbbf0('0x3f')]({},_0x21481a,_0x1e918c['options']);var _0x3c0efe={'where':_0x21481a[_0xbbf0('0x3b')]};return db[_0xbbf0('0x2e')]['count'](_0x3c0efe)[_0xbbf0('0x25')](function(_0x525922){_0x567fb0[_0xbbf0('0x1f')]=_0x525922;if(_0x1e918c[_0xbbf0('0x32')]['includeAll']){_0x21481a[_0xbbf0('0x40')]=[{'all':!![]}];}return db[_0xbbf0('0x2e')][_0xbbf0('0x41')](_0x21481a);})[_0xbbf0('0x25')](function(_0x83f81f){_0x567fb0[_0xbbf0('0x42')]=_0x83f81f;return _0x567fb0;})[_0xbbf0('0x25')](respondWithFilteredResult(_0x2788a7,_0x21481a))[_0xbbf0('0x43')](handleError(_0x2788a7,null));};exports['show']=function(_0x2f27f0,_0x35a69f){var _0xf6ace3={'raw':![],'where':{'id':_0x2f27f0[_0xbbf0('0x44')]['id']}},_0x4706fe={};_0x4706fe[_0xbbf0('0x36')]=_['keys'](db[_0xbbf0('0x2e')][_0xbbf0('0x45')]);_0x4706fe[_0xbbf0('0x32')]=_[_0xbbf0('0x46')](_0x2f27f0['query']);_0x4706fe[_0xbbf0('0x33')]=_[_0xbbf0('0x34')](_0x4706fe[_0xbbf0('0x36')],_0x4706fe[_0xbbf0('0x32')]);_0xf6ace3[_0xbbf0('0x35')]=_[_0xbbf0('0x34')](_0x4706fe['model'],qs[_0xbbf0('0x37')](_0x2f27f0[_0xbbf0('0x32')]['fields']));_0xf6ace3[_0xbbf0('0x35')]=_0xf6ace3[_0xbbf0('0x35')][_0xbbf0('0x38')]?_0xf6ace3[_0xbbf0('0x35')]:_0x4706fe[_0xbbf0('0x36')];if(_0x2f27f0[_0xbbf0('0x32')][_0xbbf0('0x47')]){_0xf6ace3[_0xbbf0('0x40')]=[{'all':!![]}];}_0xf6ace3=_[_0xbbf0('0x3f')]({},_0xf6ace3,_0x2f27f0[_0xbbf0('0x48')]);return db[_0xbbf0('0x2e')][_0xbbf0('0x49')](_0xf6ace3)[_0xbbf0('0x25')](handleEntityNotFound(_0x35a69f,null))[_0xbbf0('0x25')](respondWithResult(_0x35a69f,null))[_0xbbf0('0x43')](handleError(_0x35a69f,null));};exports[_0xbbf0('0x4a')]=function(_0x3af8c,_0x11e25a){return db[_0xbbf0('0x2e')]['create'](_0x3af8c[_0xbbf0('0x4b')],{})['then'](respondWithResult(_0x11e25a,0xc9))[_0xbbf0('0x43')](handleError(_0x11e25a,null));};exports[_0xbbf0('0x24')]=function(_0x48c066,_0x402346){if(_0x48c066['body']['id']){delete _0x48c066['body']['id'];}return db[_0xbbf0('0x2e')][_0xbbf0('0x49')]({'where':{'id':_0x48c066[_0xbbf0('0x44')]['id']}})[_0xbbf0('0x25')](handleEntityNotFound(_0x402346,null))[_0xbbf0('0x25')](saveUpdates(_0x48c066['body'],null))[_0xbbf0('0x25')](respondWithResult(_0x402346,null))[_0xbbf0('0x43')](handleError(_0x402346,null));};exports[_0xbbf0('0x4c')]=function(_0x29f441,_0x127bc7){return db[_0xbbf0('0x2e')][_0xbbf0('0x49')]({'where':{'id':_0x29f441[_0xbbf0('0x44')]['id']}})[_0xbbf0('0x25')](handleEntityNotFound(_0x127bc7,null))[_0xbbf0('0x25')](removeEntity(_0x127bc7,null))['catch'](handleError(_0x127bc7,null));};exports[_0xbbf0('0x4d')]=function(_0x4f5a77,_0x630db3){return db[_0xbbf0('0x2e')]['describe']()[_0xbbf0('0x25')](respondWithResult(_0x630db3,null))['catch'](handleError(_0x630db3,null));};exports[_0xbbf0('0x4e')]=function(_0x3e7f07,_0x343c97){var _0x2e206c={},_0x1fc192={},_0x2e143c={'count':0x0,'rows':[]};_0x1fc192[_0xbbf0('0x36')]=_['keys'](db[_0xbbf0('0x2e')][_0xbbf0('0x45')]);_0x1fc192[_0xbbf0('0x32')]=_[_0xbbf0('0x46')](_0x3e7f07[_0xbbf0('0x32')]);_0x1fc192[_0xbbf0('0x33')]=_[_0xbbf0('0x34')](_0x1fc192[_0xbbf0('0x36')],_0x1fc192['query']);_0x2e206c['attributes']=_[_0xbbf0('0x34')](_0x1fc192[_0xbbf0('0x36')],qs[_0xbbf0('0x37')](_0x3e7f07['query'][_0xbbf0('0x37')]));_0x2e206c[_0xbbf0('0x35')]=_0x2e206c['attributes'][_0xbbf0('0x38')]?_0x2e206c[_0xbbf0('0x35')]:_0x1fc192[_0xbbf0('0x36')];if(!_0x3e7f07[_0xbbf0('0x32')]['hasOwnProperty'](_0xbbf0('0x4f'))){_0x2e206c[_0xbbf0('0x1e')]=qs[_0xbbf0('0x1e')](_0x3e7f07[_0xbbf0('0x32')][_0xbbf0('0x1e')]);_0x2e206c[_0xbbf0('0x1c')]=qs['offset'](_0x3e7f07[_0xbbf0('0x32')][_0xbbf0('0x1c')]);}_0x2e206c[_0xbbf0('0x39')]=qs[_0xbbf0('0x3a')](_0x3e7f07[_0xbbf0('0x32')]['sort']);_0x2e206c[_0xbbf0('0x3b')]=qs[_0xbbf0('0x33')](_['pick'](_0x3e7f07['query'],_0x1fc192[_0xbbf0('0x33')]));if(_0x3e7f07[_0xbbf0('0x32')][_0xbbf0('0x3d')]){_0x2e206c[_0xbbf0('0x3b')]=_[_0xbbf0('0x3f')](_0x2e206c[_0xbbf0('0x3b')],{'$or':_[_0xbbf0('0x2d')](_0x2e206c['attributes'],function(_0x28199a){var _0xbeebda={};_0xbeebda[_0x28199a]={'$like':'%'+_0x3e7f07[_0xbbf0('0x32')]['filter']+'%'};return _0xbeebda;})});}_0x2e206c=_[_0xbbf0('0x3f')]({},_0x2e206c,_0x3e7f07['options']);var _0x53f8f2={'where':_0x2e206c[_0xbbf0('0x3b')]};return db[_0xbbf0('0x2e')][_0xbbf0('0x1f')](_0x53f8f2)[_0xbbf0('0x25')](function(_0xc79355){_0x2e143c[_0xbbf0('0x1f')]=_0xc79355;if(_0x3e7f07['query']['includeAll']){_0x2e206c[_0xbbf0('0x40')]=[{'all':!![]}];}return db[_0xbbf0('0x2e')][_0xbbf0('0x41')](_0x2e206c);})[_0xbbf0('0x25')](function(_0x507ee8){_0x2e143c[_0xbbf0('0x42')]=_0x507ee8;return _0x2e143c;})['then'](respondWithFilteredResult(_0x343c97,_0x2e206c,_0xbbf0('0x4e')))[_0xbbf0('0x43')](handleError(_0x343c97,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 1e30915..b08f195 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 _0x09c4=['exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x265013,_0x346069){var _0x4b87ec=function(_0x55f0f7){while(--_0x55f0f7){_0x265013['push'](_0x265013['shift']());}};_0x4b87ec(++_0x346069);}(_0x09c4,0xbf));var _0x409c=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x09c4[_0x1c3370];return _0xa9b358;};'use strict';var EventEmitter=require(_0x409c('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x409c('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x409c('0x2')](0x0);var events={'afterCreate':_0x409c('0x3'),'afterUpdate':_0x409c('0x4'),'afterDestroy':_0x409c('0x5')};function emitEvent(_0x2bcc48){return function(_0x2f1bed,_0x809777,_0x4c23ff){VoiceQueueReportEvents[_0x409c('0x6')](_0x2bcc48+':'+_0x2f1bed['id'],_0x2f1bed);VoiceQueueReportEvents[_0x409c('0x6')](_0x2bcc48,_0x2f1bed);_0x4c23ff(null);};}for(var e in events){if(events[_0x409c('0x7')](e)){var event=events[e];VoiceQueueReport[_0x409c('0x8')](e,emitEvent(event));}}module[_0x409c('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9e04=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x3b24f7,_0x19f0af){var _0x6d1e2c=function(_0x675051){while(--_0x675051){_0x3b24f7['push'](_0x3b24f7['shift']());}};_0x6d1e2c(++_0x19f0af);}(_0x9e04,0x19d));var _0x49e0=function(_0x19865b,_0x2437c0){_0x19865b=_0x19865b-0x0;var _0x4d90f=_0x9e04[_0x19865b];return _0x4d90f;};'use strict';var EventEmitter=require(_0x49e0('0x0'));var VoiceQueueReport=require(_0x49e0('0x1'))['db'][_0x49e0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x49e0('0x3')](0x0);var events={'afterCreate':_0x49e0('0x4'),'afterUpdate':'update','afterDestroy':_0x49e0('0x5')};function emitEvent(_0x3b858a){return function(_0x384b2e,_0x20abbf,_0x25d7b9){VoiceQueueReportEvents['emit'](_0x3b858a+':'+_0x384b2e['id'],_0x384b2e);VoiceQueueReportEvents[_0x49e0('0x6')](_0x3b858a,_0x384b2e);_0x25d7b9(null);};}for(var e in events){if(events[_0x49e0('0x7')](e)){var event=events[e];VoiceQueueReport[_0x49e0('0x8')](e,emitEvent(event));}}module[_0x49e0('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 2c9e87d..8533747 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 _0x1ac3=['VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueueReport.attributes','define'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x1ac3,0x17c));var _0x31ac=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1ac3[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x31ac('0x0'));var util=require(_0x31ac('0x1'));var logger=require(_0x31ac('0x2'))(_0x31ac('0x3'));var moment=require(_0x31ac('0x4'));var BPromise=require('bluebird');var rp=require(_0x31ac('0x5'));var fs=require('fs');var path=require(_0x31ac('0x6'));var rimraf=require(_0x31ac('0x7'));var config=require('../../config/environment');var attributes=require(_0x31ac('0x8'));module['exports']=function(_0x2bf4d6,_0x372a8b){return _0x2bf4d6[_0x31ac('0x9')](_0x31ac('0xa'),attributes,{'tableName':_0x31ac('0xb'),'paranoid':![],'indexes':[{'fields':[_0x31ac('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c3=['exports','define','uniqueid','lodash','util','../../config/logger','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x36eade,_0x5d4e4c){var _0x187948=function(_0x281372){while(--_0x281372){_0x36eade['push'](_0x36eade['shift']());}};_0x187948(++_0x5d4e4c);}(_0x81c3,0x1a7));var _0x381c=function(_0x5cd3c6,_0x3f45bc){_0x5cd3c6=_0x5cd3c6-0x0;var _0x40ee78=_0x81c3[_0x5cd3c6];return _0x40ee78;};'use strict';var _=require(_0x381c('0x0'));var util=require(_0x381c('0x1'));var logger=require(_0x381c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x381c('0x3'));var rimraf=require(_0x381c('0x4'));var config=require(_0x381c('0x5'));var attributes=require(_0x381c('0x6'));module[_0x381c('0x7')]=function(_0x52c72c,_0x507e0c){return _0x52c72c[_0x381c('0x8')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x381c('0x9')]},{'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 4a5a0f0..2a5ca9b 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 _0x9f4f=['defaults','socket.io-emitter','register','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','debug','update','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9f4f,0x188));var _0xf9f4=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x9f4f[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xf9f4('0x0'));var util=require(_0xf9f4('0x1'));var moment=require(_0xf9f4('0x2'));var BPromise=require(_0xf9f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9f4('0x4'));var db=require(_0xf9f4('0x5'))['db'];var utils=require(_0xf9f4('0x6'));var logger=require(_0xf9f4('0x7'))(_0xf9f4('0x8'));var config=require(_0xf9f4('0x9'));var jayson=require(_0xf9f4('0xa'));var client=jayson['client'][_0xf9f4('0xb')]({'port':0x232a});config[_0xf9f4('0xc')]=_[_0xf9f4('0xd')](config[_0xf9f4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9f4('0xe'))(new Redis(config[_0xf9f4('0xc')]));require('./voiceQueueReport.socket')[_0xf9f4('0xf')](socket);function respondWithRpcPromise(_0x48e627,_0x5f49e9,_0x572581){return new BPromise(function(_0x30a1ff,_0x399f96){return client[_0xf9f4('0x10')](_0x48e627,_0x572581)[_0xf9f4('0x11')](function(_0x1b255d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x5f49e9,_0xf9f4('0x12'));logger['debug'](_0xf9f4('0x13'),_0x5f49e9,_0xf9f4('0x12'),JSON[_0xf9f4('0x14')](_0x1b255d));if(_0x1b255d[_0xf9f4('0x15')]){if(_0x1b255d[_0xf9f4('0x15')][_0xf9f4('0x16')]===0x1f4){logger[_0xf9f4('0x15')](_0xf9f4('0x17'),_0x5f49e9,_0x1b255d[_0xf9f4('0x15')][_0xf9f4('0x18')]);return _0x399f96(_0x1b255d['error'][_0xf9f4('0x18')]);}logger[_0xf9f4('0x15')](_0xf9f4('0x17'),_0x5f49e9,_0x1b255d[_0xf9f4('0x15')][_0xf9f4('0x18')]);return _0x30a1ff(_0x1b255d[_0xf9f4('0x15')]['message']);}else{logger[_0xf9f4('0x19')](_0xf9f4('0x17'),_0x5f49e9,'request\x20sent');_0x30a1ff(_0x1b255d[_0xf9f4('0x1a')][_0xf9f4('0x18')]);}})[_0xf9f4('0x1b')](function(_0x343542){logger['error'](_0xf9f4('0x17'),_0x5f49e9,_0x343542);_0x399f96(_0x343542);});});}exports[_0xf9f4('0x1c')]=function(_0xa54e03){var _0x505c09=this;return new Promise(function(_0xfd99f,_0x2e6545){return db[_0xf9f4('0x1d')][_0xf9f4('0x1e')]({'raw':_0xa54e03[_0xf9f4('0x1f')]?_0xa54e03[_0xf9f4('0x1f')][_0xf9f4('0x20')]===undefined?!![]:![]:!![],'where':_0xa54e03[_0xf9f4('0x1f')]?_0xa54e03[_0xf9f4('0x1f')][_0xf9f4('0x21')]||null:null,'attributes':_0xa54e03[_0xf9f4('0x1f')]?_0xa54e03[_0xf9f4('0x1f')][_0xf9f4('0x22')]||null:null,'limit':_0xa54e03[_0xf9f4('0x1f')]?_0xa54e03['options'][_0xf9f4('0x23')]||null:null,'include':_0xa54e03[_0xf9f4('0x1f')]?_0xa54e03[_0xf9f4('0x1f')][_0xf9f4('0x24')]?_[_0xf9f4('0x25')](_0xa54e03[_0xf9f4('0x1f')]['include'],function(_0x5e49c8){return{'model':db[_0x5e49c8[_0xf9f4('0x26')]],'as':_0x5e49c8['as'],'attributes':_0x5e49c8[_0xf9f4('0x22')],'include':_0x5e49c8['include']?_['map'](_0x5e49c8['include'],function(_0x32a150){return{'model':db[_0x32a150[_0xf9f4('0x26')]],'as':_0x32a150['as'],'attributes':_0x32a150[_0xf9f4('0x22')],'include':_0x32a150[_0xf9f4('0x24')]?_['map'](_0x32a150[_0xf9f4('0x24')],function(_0x38ed06){return{'model':db[_0x38ed06['model']],'as':_0x38ed06['as'],'attributes':_0x38ed06[_0xf9f4('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf9f4('0x11')](function(_0x330bdc){logger[_0xf9f4('0x19')](_0xf9f4('0x1c'),_0xa54e03);logger['debug'](_0xf9f4('0x1c'),_0xa54e03,JSON[_0xf9f4('0x14')](_0x330bdc));_0xfd99f(_0x330bdc);})[_0xf9f4('0x1b')](function(_0x2ded82){logger[_0xf9f4('0x15')](_0xf9f4('0x1c'),_0x2ded82['message'],_0xa54e03);_0x2e6545(_0x505c09[_0xf9f4('0x15')](0x1f4,_0x2ded82[_0xf9f4('0x18')]));});});};exports[_0xf9f4('0x27')]=function(_0x182f01){var _0xa54b90=this;return new Promise(function(_0x355332,_0x50abfc){return db[_0xf9f4('0x1d')][_0xf9f4('0x28')](_0x182f01['body'],{'raw':_0x182f01[_0xf9f4('0x1f')]?_0x182f01[_0xf9f4('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xf9f4('0x11')](function(_0x42ce8d){logger[_0xf9f4('0x19')](_0xf9f4('0x27'),_0x182f01);logger[_0xf9f4('0x29')](_0xf9f4('0x27'),_0x182f01,JSON[_0xf9f4('0x14')](_0x42ce8d));_0x355332(_0x42ce8d);})['catch'](function(_0x2050e7){logger[_0xf9f4('0x15')](_0xf9f4('0x27'),_0x2050e7[_0xf9f4('0x18')],_0x182f01);_0x50abfc(_0xa54b90[_0xf9f4('0x15')](0x1f4,_0x2050e7[_0xf9f4('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0xd33153){var _0xcee2c9=this;return new Promise(function(_0x407457,_0x1e756e){return db[_0xf9f4('0x1d')][_0xf9f4('0x2a')](_0xd33153[_0xf9f4('0x2b')],{'raw':_0xd33153[_0xf9f4('0x1f')]?_0xd33153[_0xf9f4('0x1f')][_0xf9f4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd33153[_0xf9f4('0x1f')]?_0xd33153['options'][_0xf9f4('0x21')]||null:null,'attributes':_0xd33153[_0xf9f4('0x1f')]?_0xd33153[_0xf9f4('0x1f')][_0xf9f4('0x22')]||null:null,'limit':_0xd33153['options']?_0xd33153['options'][_0xf9f4('0x23')]||null:null})['then'](function(_0x5b3324){logger[_0xf9f4('0x19')](_0xf9f4('0x2c'),_0xd33153);logger[_0xf9f4('0x29')]('UpdateVoiceQueueReport',_0xd33153,JSON[_0xf9f4('0x14')](_0x5b3324));_0x407457(_0x5b3324);})[_0xf9f4('0x1b')](function(_0x1fea4c){logger[_0xf9f4('0x15')]('UpdateVoiceQueueReport',_0x1fea4c[_0xf9f4('0x18')],_0xd33153);_0x1e756e(_0xcee2c9['error'](0x1f4,_0x1fea4c[_0xf9f4('0x18')]));});});}; \ No newline at end of file +var _0x7ab7=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7ab7,0xa2));var _0x77ab=function(_0x192b9e,_0x3437ba){_0x192b9e=_0x192b9e-0x0;var _0x3b526c=_0x7ab7[_0x192b9e];return _0x3b526c;};'use strict';var _=require(_0x77ab('0x0'));var util=require(_0x77ab('0x1'));var moment=require(_0x77ab('0x2'));var BPromise=require(_0x77ab('0x3'));var rs=require(_0x77ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x77ab('0x5'));var logger=require('../../config/logger')(_0x77ab('0x6'));var config=require(_0x77ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77ab('0x8')][_0x77ab('0x9')]({'port':0x232a});config[_0x77ab('0xa')]=_[_0x77ab('0xb')](config['redis'],{'host':_0x77ab('0xc'),'port':0x18eb});var socket=require(_0x77ab('0xd'))(new Redis(config[_0x77ab('0xa')]));require('./voiceQueueReport.socket')[_0x77ab('0xe')](socket);function respondWithRpcPromise(_0x1f51f3,_0x4ad449,_0x10399f){return new BPromise(function(_0x38e4d2,_0x1507f9){return client[_0x77ab('0xf')](_0x1f51f3,_0x10399f)[_0x77ab('0x10')](function(_0x216379){logger[_0x77ab('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ad449,_0x77ab('0x12'));logger[_0x77ab('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4ad449,_0x77ab('0x12'),JSON[_0x77ab('0x14')](_0x216379));if(_0x216379[_0x77ab('0x15')]){if(_0x216379[_0x77ab('0x15')][_0x77ab('0x16')]===0x1f4){logger[_0x77ab('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ad449,_0x216379[_0x77ab('0x15')]['message']);return _0x1507f9(_0x216379['error'][_0x77ab('0x17')]);}logger[_0x77ab('0x15')](_0x77ab('0x18'),_0x4ad449,_0x216379[_0x77ab('0x15')]['message']);return _0x38e4d2(_0x216379[_0x77ab('0x15')]['message']);}else{logger[_0x77ab('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ad449,_0x77ab('0x12'));_0x38e4d2(_0x216379[_0x77ab('0x19')][_0x77ab('0x17')]);}})[_0x77ab('0x1a')](function(_0x261112){logger['error'](_0x77ab('0x18'),_0x4ad449,_0x261112);_0x1507f9(_0x261112);});});}exports[_0x77ab('0x1b')]=function(_0x3666b){var _0x427c2e=this;return new Promise(function(_0x24348f,_0x1dcdee){return db[_0x77ab('0x1c')][_0x77ab('0x1d')]({'raw':_0x3666b[_0x77ab('0x1e')]?_0x3666b[_0x77ab('0x1e')][_0x77ab('0x1f')]===undefined?!![]:![]:!![],'where':_0x3666b[_0x77ab('0x1e')]?_0x3666b[_0x77ab('0x1e')][_0x77ab('0x20')]||null:null,'attributes':_0x3666b['options']?_0x3666b[_0x77ab('0x1e')][_0x77ab('0x21')]||null:null,'limit':_0x3666b[_0x77ab('0x1e')]?_0x3666b[_0x77ab('0x1e')][_0x77ab('0x22')]||null:null,'include':_0x3666b[_0x77ab('0x1e')]?_0x3666b[_0x77ab('0x1e')][_0x77ab('0x23')]?_['map'](_0x3666b[_0x77ab('0x1e')][_0x77ab('0x23')],function(_0x219521){return{'model':db[_0x219521[_0x77ab('0x24')]],'as':_0x219521['as'],'attributes':_0x219521['attributes'],'include':_0x219521['include']?_['map'](_0x219521['include'],function(_0x113bff){return{'model':db[_0x113bff[_0x77ab('0x24')]],'as':_0x113bff['as'],'attributes':_0x113bff[_0x77ab('0x21')],'include':_0x113bff['include']?_['map'](_0x113bff[_0x77ab('0x23')],function(_0x4a33fc){return{'model':db[_0x4a33fc[_0x77ab('0x24')]],'as':_0x4a33fc['as'],'attributes':_0x4a33fc[_0x77ab('0x21')]};}):[]};}):[]};}):[]:[]})[_0x77ab('0x10')](function(_0x2e58f1){logger[_0x77ab('0x11')]('GetVoiceQueueReport',_0x3666b);logger[_0x77ab('0x13')]('GetVoiceQueueReport',_0x3666b,JSON[_0x77ab('0x14')](_0x2e58f1));_0x24348f(_0x2e58f1);})['catch'](function(_0x18881c){logger[_0x77ab('0x15')]('GetVoiceQueueReport',_0x18881c['message'],_0x3666b);_0x1dcdee(_0x427c2e[_0x77ab('0x15')](0x1f4,_0x18881c[_0x77ab('0x17')]));});});};exports[_0x77ab('0x25')]=function(_0x588904){var _0x12dd2f=this;return new Promise(function(_0x418ecd,_0x587b09){return db[_0x77ab('0x1c')][_0x77ab('0x26')](_0x588904[_0x77ab('0x27')],{'raw':_0x588904[_0x77ab('0x1e')]?_0x588904[_0x77ab('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x77ab('0x10')](function(_0x49c271){logger[_0x77ab('0x11')](_0x77ab('0x25'),_0x588904);logger[_0x77ab('0x13')](_0x77ab('0x25'),_0x588904,JSON[_0x77ab('0x14')](_0x49c271));_0x418ecd(_0x49c271);})[_0x77ab('0x1a')](function(_0x1f3912){logger['error'](_0x77ab('0x25'),_0x1f3912[_0x77ab('0x17')],_0x588904);_0x587b09(_0x12dd2f[_0x77ab('0x15')](0x1f4,_0x1f3912[_0x77ab('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x298e33){var _0x30f649=this;return new Promise(function(_0x8b6c5b,_0x167d86){return db[_0x77ab('0x1c')][_0x77ab('0x28')](_0x298e33['body'],{'raw':_0x298e33['options']?_0x298e33[_0x77ab('0x1e')][_0x77ab('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x298e33[_0x77ab('0x1e')]?_0x298e33[_0x77ab('0x1e')][_0x77ab('0x20')]||null:null,'attributes':_0x298e33[_0x77ab('0x1e')]?_0x298e33[_0x77ab('0x1e')][_0x77ab('0x21')]||null:null,'limit':_0x298e33[_0x77ab('0x1e')]?_0x298e33[_0x77ab('0x1e')]['limit']||null:null})[_0x77ab('0x10')](function(_0x513c6d){logger['info']('UpdateVoiceQueueReport',_0x298e33);logger[_0x77ab('0x13')](_0x77ab('0x29'),_0x298e33,JSON[_0x77ab('0x14')](_0x513c6d));_0x8b6c5b(_0x513c6d);})[_0x77ab('0x1a')](function(_0x4c4fd8){logger[_0x77ab('0x15')](_0x77ab('0x29'),_0x4c4fd8[_0x77ab('0x17')],_0x298e33);_0x167d86(_0x30f649[_0x77ab('0x15')](0x1f4,_0x4c4fd8[_0x77ab('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fef59cd..c197583 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 _0x7c8e=['update','emit','removeListener','register','length','voiceQueueReport:','save','remove'];(function(_0x1e5aad,_0x106c1d){var _0x1165b0=function(_0x1f9076){while(--_0x1f9076){_0x1e5aad['push'](_0x1e5aad['shift']());}};_0x1165b0(++_0x106c1d);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x26546a,_0x809188){_0x26546a=_0x26546a-0x0;var _0x5689d8=_0x7c8e[_0x26546a];return _0x5689d8;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xe7c8('0x0'),_0xe7c8('0x1'),_0xe7c8('0x2')];function createListener(_0xf1177c,_0x162bac){return function(_0x2770a6){_0x162bac[_0xe7c8('0x3')](_0xf1177c,_0x2770a6);};}function removeListener(_0x2d314f,_0x192024){return function(){VoiceQueueReportEvents[_0xe7c8('0x4')](_0x2d314f,_0x192024);};}exports[_0xe7c8('0x5')]=function(_0x1f0a65){for(var _0x293383=0x0,_0x2d2940=events[_0xe7c8('0x6')];_0x293383<_0x2d2940;_0x293383++){var _0x3d3f66=events[_0x293383];var _0x5261da=createListener(_0xe7c8('0x7')+_0x3d3f66,_0x1f0a65);VoiceQueueReportEvents['on'](_0x3d3f66,_0x5261da);}}; \ No newline at end of file +var _0x8ece=['update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x3b1bc6,_0x43460a){var _0x58956a=function(_0x40099b){while(--_0x40099b){_0x3b1bc6['push'](_0x3b1bc6['shift']());}};_0x58956a(++_0x43460a);}(_0x8ece,0x195));var _0xe8ec=function(_0x3e798a,_0x1c3f1f){_0x3e798a=_0x3e798a-0x0;var _0x34538f=_0x8ece[_0x3e798a];return _0x34538f;};'use strict';var VoiceQueueReportEvents=require(_0xe8ec('0x0'));var events=[_0xe8ec('0x1'),_0xe8ec('0x2'),_0xe8ec('0x3')];function createListener(_0x4dd5dd,_0x47b1c1){return function(_0xe18b82){_0x47b1c1[_0xe8ec('0x4')](_0x4dd5dd,_0xe18b82);};}function removeListener(_0x5047e7,_0x433734){return function(){VoiceQueueReportEvents[_0xe8ec('0x5')](_0x5047e7,_0x433734);};}exports['register']=function(_0x346577){for(var _0x23fa35=0x0,_0x64ed4c=events[_0xe8ec('0x6')];_0x23fa35<_0x64ed4c;_0x23fa35++){var _0x3682cb=events[_0x23fa35];var _0x122f36=createListener(_0xe8ec('0x7')+_0x3682cb,_0x346577);VoiceQueueReportEvents['on'](_0x3682cb,_0x122f36);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3c59032..834c680 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 _0xc999=['util','path','connect-timeout','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','get','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0xc999,0x176));var _0x9c99=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0xc999[_0x22663b];return _0x310d0a;};'use strict';var multer=require('multer');var util=require(_0x9c99('0x0'));var path=require(_0x9c99('0x1'));var timeout=require(_0x9c99('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9c99('0x3'));var config=require('../../config/environment');var controller=require(_0x9c99('0x4'));router['get']('/',auth[_0x9c99('0x5')](),controller[_0x9c99('0x6')]);router[_0x9c99('0x7')]('/:id',auth[_0x9c99('0x5')](),controller[_0x9c99('0x8')]);router[_0x9c99('0x9')]('/',auth[_0x9c99('0x5')](),controller[_0x9c99('0xa')]);router[_0x9c99('0xb')]('/:id',auth[_0x9c99('0x5')](),controller[_0x9c99('0xc')]);router[_0x9c99('0xd')](_0x9c99('0xe'),auth['isAuthenticated'](),controller[_0x9c99('0xf')]);module[_0x9c99('0x10')]=router; \ No newline at end of file +var _0xed04=['./voiceQueuesLog.controller','isAuthenticated','get','/:id','post','create','put','destroy','multer','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x374bf2,_0x5aa7bb){var _0x23c2de=function(_0x151d91){while(--_0x151d91){_0x374bf2['push'](_0x374bf2['shift']());}};_0x23c2de(++_0x5aa7bb);}(_0xed04,0xa4));var _0x4ed0=function(_0x45e12c,_0x27e287){_0x45e12c=_0x45e12c-0x0;var _0x554708=_0xed04[_0x45e12c];return _0x554708;};'use strict';var multer=require(_0x4ed0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4ed0('0x1'));var auth=require(_0x4ed0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x4ed0('0x3'));var controller=require(_0x4ed0('0x4'));router['get']('/',auth[_0x4ed0('0x5')](),controller['index']);router[_0x4ed0('0x6')](_0x4ed0('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x4ed0('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ed0('0x9')]);router[_0x4ed0('0xa')](_0x4ed0('0x7'),auth[_0x4ed0('0x5')](),controller['update']);router['delete'](_0x4ed0('0x7'),auth[_0x4ed0('0x5')](),controller[_0x4ed0('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3822f6b..51e0415 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 _0xfdb3=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x1b3cfc,_0x22a4ec){var _0x627e30=function(_0x17c539){while(--_0x17c539){_0x1b3cfc['push'](_0x1b3cfc['shift']());}};_0x627e30(++_0x22a4ec);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x3e9597,_0x269c7e){_0x3e9597=_0x3e9597-0x0;var _0x508b1e=_0xfdb3[_0x3e9597];return _0x508b1e;};'use strict';var Sequelize=require(_0x3fdb('0x0'));var moment=require(_0x3fdb('0x1'));module['exports']={'time':{'type':Sequelize[_0x3fdb('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3fdb('0x3')],'allowNull':![],'defaultValue':moment()[_0x3fdb('0x4')](_0x3fdb('0x5'))}}; \ No newline at end of file +var _0xf333=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xf333,0x1cd));var _0x3f33=function(_0xb4debc,_0x4fe458){_0xb4debc=_0xb4debc-0x0;var _0x2cde18=_0xf333[_0xb4debc];return _0x2cde18;};'use strict';var Sequelize=require(_0x3f33('0x0'));var moment=require('moment');module[_0x3f33('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3f33('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3f33('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0x3f33('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a9ed1f8..e4b49c4 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 _0x1d75=['undefined','count','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x5e1d21,_0x59bb31){var _0x71afd7=function(_0x2d3aa2){while(--_0x2d3aa2){_0x5e1d21['push'](_0x5e1d21['shift']());}};_0x71afd7(++_0x59bb31);}(_0x1d75,0xbb));var _0x51d7=function(_0x2e7af0,_0x26eda0){_0x2e7af0=_0x2e7af0-0x0;var _0x3d59df=_0x1d75[_0x2e7af0];return _0x3d59df;};'use strict';var emlformat=require(_0x51d7('0x0'));var rimraf=require(_0x51d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51d7('0x2'));var rp=require(_0x51d7('0x3'));var moment=require(_0x51d7('0x4'));var BPromise=require(_0x51d7('0x5'));var Mustache=require(_0x51d7('0x6'));var util=require('util');var path=require(_0x51d7('0x7'));var sox=require(_0x51d7('0x8'));var csv=require(_0x51d7('0x9'));var ejs=require(_0x51d7('0xa'));var fs=require('fs');var fs_extra=require(_0x51d7('0xb'));var _=require(_0x51d7('0xc'));var squel=require(_0x51d7('0xd'));var crypto=require(_0x51d7('0xe'));var jsforce=require(_0x51d7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x51d7('0x9'));var querystring=require('querystring');var Papa=require(_0x51d7('0x10'));var Redis=require('ioredis');var authService=require(_0x51d7('0x11'));var qs=require(_0x51d7('0x12'));var as=require(_0x51d7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51d7('0x14'))(_0x51d7('0x15'));var utils=require(_0x51d7('0x16'));var config=require(_0x51d7('0x17'));var licenseUtil=require(_0x51d7('0x18'));var db=require(_0x51d7('0x19'))['db'];function respondWithStatusCode(_0x13fbb9,_0x991ce6){_0x991ce6=_0x991ce6||0xcc;return function(_0x5508ba){if(_0x5508ba){return _0x13fbb9['sendStatus'](_0x991ce6);}return _0x13fbb9[_0x51d7('0x1a')](_0x991ce6)['end']();};}function respondWithResult(_0xc1f292,_0x44ccdd){_0x44ccdd=_0x44ccdd||0xc8;return function(_0x56c13a){if(_0x56c13a){return _0xc1f292['status'](_0x44ccdd)[_0x51d7('0x1b')](_0x56c13a);}};}function respondWithFilteredResult(_0x298d42,_0x7f77f1){return function(_0x5bbee9){if(_0x5bbee9){var _0x219007=typeof _0x7f77f1[_0x51d7('0x1c')]==='undefined'&&typeof _0x7f77f1['limit']===_0x51d7('0x1d');var _0x44df9a=_0x5bbee9['count'];var _0x15cf52=_0x219007?0x0:_0x7f77f1['offset'];var _0x3d22f0=_0x219007?_0x5bbee9[_0x51d7('0x1e')]:_0x7f77f1[_0x51d7('0x1c')]+_0x7f77f1['limit'];var _0x109ced;if(_0x3d22f0>=_0x44df9a){_0x3d22f0=_0x44df9a;_0x109ced=0xc8;}else{_0x109ced=0xce;}_0x298d42[_0x51d7('0x1a')](_0x109ced);return _0x298d42['set']('Content-Range',_0x15cf52+'-'+_0x3d22f0+'/'+_0x44df9a)['json'](_0x5bbee9);}return null;};}function patchUpdates(_0x3da160){return function(_0x47ea9b){try{jsonpatch[_0x51d7('0x1f')](_0x47ea9b,_0x3da160,!![]);}catch(_0x40dee0){return BPromise[_0x51d7('0x20')](_0x40dee0);}return _0x47ea9b[_0x51d7('0x21')]();};}function saveUpdates(_0x373520,_0x38e3b4){return function(_0x59d3ec){if(_0x59d3ec){return _0x59d3ec[_0x51d7('0x22')](_0x373520)[_0x51d7('0x23')](function(_0x2e6bdb){return _0x2e6bdb;});}return null;};}function removeEntity(_0x10f18e,_0x409497){return function(_0x596592){if(_0x596592){return _0x596592[_0x51d7('0x24')]()[_0x51d7('0x23')](function(){_0x10f18e[_0x51d7('0x1a')](0xcc)[_0x51d7('0x25')]();});}};}function handleEntityNotFound(_0x2885a1,_0x50d543){return function(_0x35dc07){if(!_0x35dc07){_0x2885a1[_0x51d7('0x26')](0x194);}return _0x35dc07;};}function handleError(_0x34d533,_0x1d0e0e){_0x1d0e0e=_0x1d0e0e||0x1f4;return function(_0xb71ed5){logger['error'](_0xb71ed5[_0x51d7('0x27')]);if(_0xb71ed5[_0x51d7('0x28')]){delete _0xb71ed5['name'];}_0x34d533[_0x51d7('0x1a')](_0x1d0e0e)['send'](_0xb71ed5);};}exports['index']=function(_0x1e717b,_0x26d294){var _0x19ba6c={},_0x497f1c={},_0xacfc6f={'count':0x0,'rows':[]};var _0x25b851=_[_0x51d7('0x29')](db[_0x51d7('0x2a')][_0x51d7('0x2b')],function(_0x5e7535){return{'name':_0x5e7535[_0x51d7('0x2c')],'type':_0x5e7535[_0x51d7('0x2d')]['key']};});_0x497f1c[_0x51d7('0x2e')]=_[_0x51d7('0x29')](_0x25b851,_0x51d7('0x28'));_0x497f1c[_0x51d7('0x2f')]=_[_0x51d7('0x30')](_0x1e717b['query']);_0x497f1c[_0x51d7('0x31')]=_[_0x51d7('0x32')](_0x497f1c[_0x51d7('0x2e')],_0x497f1c[_0x51d7('0x2f')]);_0x19ba6c[_0x51d7('0x33')]=_[_0x51d7('0x32')](_0x497f1c[_0x51d7('0x2e')],qs[_0x51d7('0x34')](_0x1e717b[_0x51d7('0x2f')]['fields']));_0x19ba6c[_0x51d7('0x33')]=_0x19ba6c[_0x51d7('0x33')][_0x51d7('0x35')]?_0x19ba6c[_0x51d7('0x33')]:_0x497f1c[_0x51d7('0x2e')];if(!_0x1e717b[_0x51d7('0x2f')]['hasOwnProperty'](_0x51d7('0x36'))){_0x19ba6c[_0x51d7('0x37')]=qs['limit'](_0x1e717b[_0x51d7('0x2f')][_0x51d7('0x37')]);_0x19ba6c[_0x51d7('0x1c')]=qs[_0x51d7('0x1c')](_0x1e717b[_0x51d7('0x2f')]['offset']);}_0x19ba6c[_0x51d7('0x38')]=qs[_0x51d7('0x39')](_0x1e717b[_0x51d7('0x2f')]['sort']);_0x19ba6c[_0x51d7('0x3a')]=qs[_0x51d7('0x31')](_[_0x51d7('0x3b')](_0x1e717b[_0x51d7('0x2f')],_0x497f1c[_0x51d7('0x31')]),_0x25b851);if(_0x1e717b[_0x51d7('0x2f')]['filter']){_0x19ba6c['where']=_['merge'](_0x19ba6c[_0x51d7('0x3a')],{'$or':_[_0x51d7('0x29')](_0x25b851,function(_0x396d8f){if(_0x396d8f[_0x51d7('0x2d')]!=='VIRTUAL'){var _0x43f81b={};_0x43f81b[_0x396d8f['name']]={'$like':'%'+_0x1e717b[_0x51d7('0x2f')][_0x51d7('0x3c')]+'%'};return _0x43f81b;}})});}_0x19ba6c=_[_0x51d7('0x3d')]({},_0x19ba6c,_0x1e717b[_0x51d7('0x3e')]);var _0x4d22da={'where':_0x19ba6c[_0x51d7('0x3a')]};return db[_0x51d7('0x2a')]['count'](_0x4d22da)['then'](function(_0x15dcb2){_0xacfc6f[_0x51d7('0x1e')]=_0x15dcb2;if(_0x1e717b[_0x51d7('0x2f')][_0x51d7('0x3f')]){_0x19ba6c[_0x51d7('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x51d7('0x41')](_0x19ba6c);})['then'](function(_0x83bd9){_0xacfc6f['rows']=_0x83bd9;return _0xacfc6f;})[_0x51d7('0x23')](respondWithFilteredResult(_0x26d294,_0x19ba6c))[_0x51d7('0x42')](handleError(_0x26d294,null));};exports[_0x51d7('0x43')]=function(_0x582018,_0x168263){var _0x1f166b={'raw':!![],'where':{'id':_0x582018['params']['id']}},_0x40a0ff={};_0x40a0ff['model']=_[_0x51d7('0x30')](db[_0x51d7('0x2a')][_0x51d7('0x2b')]);_0x40a0ff[_0x51d7('0x2f')]=_[_0x51d7('0x30')](_0x582018['query']);_0x40a0ff['filters']=_[_0x51d7('0x32')](_0x40a0ff[_0x51d7('0x2e')],_0x40a0ff['query']);_0x1f166b['attributes']=_[_0x51d7('0x32')](_0x40a0ff[_0x51d7('0x2e')],qs['fields'](_0x582018[_0x51d7('0x2f')][_0x51d7('0x34')]));_0x1f166b[_0x51d7('0x33')]=_0x1f166b['attributes'][_0x51d7('0x35')]?_0x1f166b[_0x51d7('0x33')]:_0x40a0ff[_0x51d7('0x2e')];if(_0x582018[_0x51d7('0x2f')][_0x51d7('0x3f')]){_0x1f166b[_0x51d7('0x40')]=[{'all':!![]}];}_0x1f166b=_[_0x51d7('0x3d')]({},_0x1f166b,_0x582018[_0x51d7('0x3e')]);return db[_0x51d7('0x2a')][_0x51d7('0x44')](_0x1f166b)['then'](handleEntityNotFound(_0x168263,null))[_0x51d7('0x23')](respondWithResult(_0x168263,null))[_0x51d7('0x42')](handleError(_0x168263,null));};exports[_0x51d7('0x45')]=function(_0x450228,_0x8d0420){return db[_0x51d7('0x2a')][_0x51d7('0x45')](_0x450228[_0x51d7('0x46')],{})[_0x51d7('0x23')](respondWithResult(_0x8d0420,0xc9))[_0x51d7('0x42')](handleError(_0x8d0420,null));};exports[_0x51d7('0x22')]=function(_0x269de9,_0x2d7d2c){if(_0x269de9[_0x51d7('0x46')]['id']){delete _0x269de9[_0x51d7('0x46')]['id'];}return db['VoiceQueuesLog'][_0x51d7('0x44')]({'where':{'id':_0x269de9[_0x51d7('0x47')]['id']}})[_0x51d7('0x23')](handleEntityNotFound(_0x2d7d2c,null))[_0x51d7('0x23')](saveUpdates(_0x269de9['body'],null))[_0x51d7('0x23')](respondWithResult(_0x2d7d2c,null))[_0x51d7('0x42')](handleError(_0x2d7d2c,null));};exports[_0x51d7('0x24')]=function(_0xf0cc33,_0x464be7){return db[_0x51d7('0x2a')][_0x51d7('0x44')]({'where':{'id':_0xf0cc33[_0x51d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x464be7,null))[_0x51d7('0x23')](removeEntity(_0x464be7,null))['catch'](handleError(_0x464be7,null));}; \ No newline at end of file +var _0xd15a=['includeAll','include','findAll','catch','show','keys','length','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options'];(function(_0xe26545,_0x39cd03){var _0x4e4f17=function(_0x3c35db){while(--_0x3c35db){_0xe26545['push'](_0xe26545['shift']());}};_0x4e4f17(++_0x39cd03);}(_0xd15a,0x18c));var _0xad15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xad15('0x0'));var rimraf=require(_0xad15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad15('0x2'));var rp=require(_0xad15('0x3'));var moment=require(_0xad15('0x4'));var BPromise=require(_0xad15('0x5'));var Mustache=require(_0xad15('0x6'));var util=require(_0xad15('0x7'));var path=require(_0xad15('0x8'));var sox=require(_0xad15('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad15('0xa'));var _=require(_0xad15('0xb'));var squel=require(_0xad15('0xc'));var crypto=require(_0xad15('0xd'));var jsforce=require(_0xad15('0xe'));var deskjs=require(_0xad15('0xf'));var toCsv=require(_0xad15('0x10'));var querystring=require(_0xad15('0x11'));var Papa=require(_0xad15('0x12'));var Redis=require(_0xad15('0x13'));var authService=require(_0xad15('0x14'));var qs=require(_0xad15('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xad15('0x16'))(_0xad15('0x17'));var utils=require('../../config/utils');var config=require(_0xad15('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xad15('0x19'))['db'];function respondWithStatusCode(_0x1c6645,_0x322809){_0x322809=_0x322809||0xcc;return function(_0x3d750d){if(_0x3d750d){return _0x1c6645[_0xad15('0x1a')](_0x322809);}return _0x1c6645[_0xad15('0x1b')](_0x322809)[_0xad15('0x1c')]();};}function respondWithResult(_0x29346f,_0x21b505){_0x21b505=_0x21b505||0xc8;return function(_0x4552e2){if(_0x4552e2){return _0x29346f['status'](_0x21b505)[_0xad15('0x1d')](_0x4552e2);}};}function respondWithFilteredResult(_0x55d851,_0x1d35b1){return function(_0x56e0a3){if(_0x56e0a3){var _0x44e539=typeof _0x1d35b1[_0xad15('0x1e')]==='undefined'&&typeof _0x1d35b1['limit']===_0xad15('0x1f');var _0x168640=_0x56e0a3[_0xad15('0x20')];var _0x347436=_0x44e539?0x0:_0x1d35b1[_0xad15('0x1e')];var _0x648d9c=_0x44e539?_0x56e0a3[_0xad15('0x20')]:_0x1d35b1[_0xad15('0x1e')]+_0x1d35b1[_0xad15('0x21')];var _0x3fc1b8;if(_0x648d9c>=_0x168640){_0x648d9c=_0x168640;_0x3fc1b8=0xc8;}else{_0x3fc1b8=0xce;}_0x55d851[_0xad15('0x1b')](_0x3fc1b8);return _0x55d851[_0xad15('0x22')](_0xad15('0x23'),_0x347436+'-'+_0x648d9c+'/'+_0x168640)[_0xad15('0x1d')](_0x56e0a3);}return null;};}function patchUpdates(_0x36ff8c){return function(_0x435bf4){try{jsonpatch[_0xad15('0x24')](_0x435bf4,_0x36ff8c,!![]);}catch(_0x3d658e){return BPromise[_0xad15('0x25')](_0x3d658e);}return _0x435bf4[_0xad15('0x26')]();};}function saveUpdates(_0x48fa8e,_0x52c160){return function(_0x5cd07c){if(_0x5cd07c){return _0x5cd07c[_0xad15('0x27')](_0x48fa8e)['then'](function(_0x2a8b05){return _0x2a8b05;});}return null;};}function removeEntity(_0x23430d,_0x4ef32a){return function(_0x4f6769){if(_0x4f6769){return _0x4f6769[_0xad15('0x28')]()[_0xad15('0x29')](function(){_0x23430d[_0xad15('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10aec6,_0x506be1){return function(_0x34399b){if(!_0x34399b){_0x10aec6['sendStatus'](0x194);}return _0x34399b;};}function handleError(_0x45706a,_0x1731a9){_0x1731a9=_0x1731a9||0x1f4;return function(_0x45216f){logger[_0xad15('0x2a')](_0x45216f[_0xad15('0x2b')]);if(_0x45216f[_0xad15('0x2c')]){delete _0x45216f[_0xad15('0x2c')];}_0x45706a[_0xad15('0x1b')](_0x1731a9)['send'](_0x45216f);};}exports[_0xad15('0x2d')]=function(_0x362797,_0x423eed){var _0x5792be={},_0x146c22={},_0x5127ee={'count':0x0,'rows':[]};var _0xdf4bd5=_['map'](db[_0xad15('0x2e')][_0xad15('0x2f')],function(_0x206662){return{'name':_0x206662[_0xad15('0x30')],'type':_0x206662[_0xad15('0x31')]['key']};});_0x146c22[_0xad15('0x32')]=_[_0xad15('0x33')](_0xdf4bd5,'name');_0x146c22['query']=_['keys'](_0x362797[_0xad15('0x34')]);_0x146c22['filters']=_['intersection'](_0x146c22[_0xad15('0x32')],_0x146c22[_0xad15('0x34')]);_0x5792be['attributes']=_[_0xad15('0x35')](_0x146c22[_0xad15('0x32')],qs[_0xad15('0x36')](_0x362797['query']['fields']));_0x5792be[_0xad15('0x37')]=_0x5792be[_0xad15('0x37')]['length']?_0x5792be[_0xad15('0x37')]:_0x146c22[_0xad15('0x32')];if(!_0x362797[_0xad15('0x34')][_0xad15('0x38')](_0xad15('0x39'))){_0x5792be['limit']=qs[_0xad15('0x21')](_0x362797[_0xad15('0x34')]['limit']);_0x5792be[_0xad15('0x1e')]=qs[_0xad15('0x1e')](_0x362797[_0xad15('0x34')][_0xad15('0x1e')]);}_0x5792be[_0xad15('0x3a')]=qs[_0xad15('0x3b')](_0x362797[_0xad15('0x34')]['sort']);_0x5792be['where']=qs['filters'](_['pick'](_0x362797['query'],_0x146c22[_0xad15('0x3c')]),_0xdf4bd5);if(_0x362797[_0xad15('0x34')][_0xad15('0x3d')]){_0x5792be[_0xad15('0x3e')]=_[_0xad15('0x3f')](_0x5792be[_0xad15('0x3e')],{'$or':_[_0xad15('0x33')](_0xdf4bd5,function(_0x48b2af){if(_0x48b2af[_0xad15('0x31')]!==_0xad15('0x40')){var _0x1256fd={};_0x1256fd[_0x48b2af['name']]={'$like':'%'+_0x362797[_0xad15('0x34')]['filter']+'%'};return _0x1256fd;}})});}_0x5792be=_[_0xad15('0x3f')]({},_0x5792be,_0x362797[_0xad15('0x41')]);var _0x499637={'where':_0x5792be[_0xad15('0x3e')]};return db[_0xad15('0x2e')][_0xad15('0x20')](_0x499637)[_0xad15('0x29')](function(_0x37737f){_0x5127ee['count']=_0x37737f;if(_0x362797[_0xad15('0x34')][_0xad15('0x42')]){_0x5792be[_0xad15('0x43')]=[{'all':!![]}];}return db[_0xad15('0x2e')][_0xad15('0x44')](_0x5792be);})[_0xad15('0x29')](function(_0x1f651a){_0x5127ee['rows']=_0x1f651a;return _0x5127ee;})[_0xad15('0x29')](respondWithFilteredResult(_0x423eed,_0x5792be))[_0xad15('0x45')](handleError(_0x423eed,null));};exports[_0xad15('0x46')]=function(_0x1eb8ba,_0x2556d1){var _0x59a7c0={'raw':!![],'where':{'id':_0x1eb8ba['params']['id']}},_0x43dcfc={};_0x43dcfc[_0xad15('0x32')]=_[_0xad15('0x47')](db[_0xad15('0x2e')]['rawAttributes']);_0x43dcfc[_0xad15('0x34')]=_['keys'](_0x1eb8ba[_0xad15('0x34')]);_0x43dcfc[_0xad15('0x3c')]=_[_0xad15('0x35')](_0x43dcfc[_0xad15('0x32')],_0x43dcfc[_0xad15('0x34')]);_0x59a7c0['attributes']=_['intersection'](_0x43dcfc[_0xad15('0x32')],qs[_0xad15('0x36')](_0x1eb8ba['query']['fields']));_0x59a7c0['attributes']=_0x59a7c0[_0xad15('0x37')][_0xad15('0x48')]?_0x59a7c0[_0xad15('0x37')]:_0x43dcfc[_0xad15('0x32')];if(_0x1eb8ba[_0xad15('0x34')][_0xad15('0x42')]){_0x59a7c0[_0xad15('0x43')]=[{'all':!![]}];}_0x59a7c0=_[_0xad15('0x3f')]({},_0x59a7c0,_0x1eb8ba[_0xad15('0x41')]);return db[_0xad15('0x2e')]['find'](_0x59a7c0)['then'](handleEntityNotFound(_0x2556d1,null))[_0xad15('0x29')](respondWithResult(_0x2556d1,null))[_0xad15('0x45')](handleError(_0x2556d1,null));};exports[_0xad15('0x49')]=function(_0x228f1c,_0x1b823e){return db[_0xad15('0x2e')][_0xad15('0x49')](_0x228f1c[_0xad15('0x4a')],{})['then'](respondWithResult(_0x1b823e,0xc9))['catch'](handleError(_0x1b823e,null));};exports[_0xad15('0x27')]=function(_0x189caa,_0x4cf62b){if(_0x189caa['body']['id']){delete _0x189caa[_0xad15('0x4a')]['id'];}return db[_0xad15('0x2e')][_0xad15('0x4b')]({'where':{'id':_0x189caa[_0xad15('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cf62b,null))[_0xad15('0x29')](saveUpdates(_0x189caa[_0xad15('0x4a')],null))['then'](respondWithResult(_0x4cf62b,null))[_0xad15('0x45')](handleError(_0x4cf62b,null));};exports[_0xad15('0x28')]=function(_0x431683,_0x51d466){return db[_0xad15('0x2e')][_0xad15('0x4b')]({'where':{'id':_0x431683[_0xad15('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51d466,null))['then'](removeEntity(_0x51d466,null))[_0xad15('0x45')](handleError(_0x51d466,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b50112c..1e85d26 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 _0x0ef0=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','util'];(function(_0x37f02e,_0x24e12d){var _0x546b92=function(_0x410325){while(--_0x410325){_0x37f02e['push'](_0x37f02e['shift']());}};_0x546b92(++_0x24e12d);}(_0x0ef0,0x12b));var _0x00ef=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x0ef0[_0xc5a279];return _0xc755d3;};'use strict';var _=require('lodash');var util=require(_0x00ef('0x0'));var logger=require('../../config/logger')(_0x00ef('0x1'));var moment=require('moment');var BPromise=require(_0x00ef('0x2'));var rp=require(_0x00ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00ef('0x4'));var config=require(_0x00ef('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x00ef('0x6')]=function(_0x24936a,_0x4ad0ac){return _0x24936a[_0x00ef('0x7')](_0x00ef('0x8'),attributes,{'tableName':_0x00ef('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x00ef('0xa'),_0x00ef('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6f76=['voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueuesLog'];(function(_0x2e43a0,_0x40ee0d){var _0x4cfefe=function(_0x6a3fb1){while(--_0x6a3fb1){_0x2e43a0['push'](_0x2e43a0['shift']());}};_0x4cfefe(++_0x40ee0d);}(_0x6f76,0x170));var _0x66f7=function(_0x1f4e97,_0x1c38ce){_0x1f4e97=_0x1f4e97-0x0;var _0x54654c=_0x6f76[_0x1f4e97];return _0x54654c;};'use strict';var _=require(_0x66f7('0x0'));var util=require('util');var logger=require(_0x66f7('0x1'))('api');var moment=require(_0x66f7('0x2'));var BPromise=require(_0x66f7('0x3'));var rp=require(_0x66f7('0x4'));var fs=require('fs');var path=require(_0x66f7('0x5'));var rimraf=require('rimraf');var config=require(_0x66f7('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x66f7('0x7')]=function(_0x26cb27,_0x4ca39c){return _0x26cb27[_0x66f7('0x8')](_0x66f7('0x9'),attributes,{'tableName':_0x66f7('0xa'),'paranoid':![],'indexes':[{'name':_0x66f7('0xb'),'fields':[_0x66f7('0xc'),_0x66f7('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 66abf1a..9ff0cdb 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 _0x3ea0=['message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0x3ea0,0x1bb));var _0x03ea=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x3ea0[_0x4c7d8b];return _0x187158;};'use strict';var _=require(_0x03ea('0x0'));var util=require(_0x03ea('0x1'));var moment=require('moment');var BPromise=require(_0x03ea('0x2'));var rs=require(_0x03ea('0x3'));var fs=require('fs');var Redis=require(_0x03ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03ea('0x5'));var logger=require(_0x03ea('0x6'))(_0x03ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x03ea('0x8'));var client=jayson[_0x03ea('0x9')][_0x03ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba302,_0x10f541,_0x4aa57c){return new BPromise(function(_0x3b38d3,_0x5d4d72){return client[_0x03ea('0xb')](_0x2ba302,_0x4aa57c)[_0x03ea('0xc')](function(_0x213a43){logger[_0x03ea('0xd')](_0x03ea('0xe'),_0x10f541,_0x03ea('0xf'));logger[_0x03ea('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x10f541,_0x03ea('0xf'),JSON['stringify'](_0x213a43));if(_0x213a43['error']){if(_0x213a43[_0x03ea('0x11')][_0x03ea('0x12')]===0x1f4){logger[_0x03ea('0x11')](_0x03ea('0xe'),_0x10f541,_0x213a43[_0x03ea('0x11')][_0x03ea('0x13')]);return _0x5d4d72(_0x213a43[_0x03ea('0x11')][_0x03ea('0x13')]);}logger[_0x03ea('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x10f541,_0x213a43[_0x03ea('0x11')][_0x03ea('0x13')]);return _0x3b38d3(_0x213a43['error']['message']);}else{logger[_0x03ea('0xd')](_0x03ea('0xe'),_0x10f541,_0x03ea('0xf'));_0x3b38d3(_0x213a43[_0x03ea('0x14')][_0x03ea('0x13')]);}})['catch'](function(_0x1aebed){logger[_0x03ea('0x11')](_0x03ea('0xe'),_0x10f541,_0x1aebed);_0x5d4d72(_0x1aebed);});});} \ No newline at end of file +var _0x6b40=['stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x6b40,0xcb));var _0x06b4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6b40[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x06b4('0x0'));var util=require(_0x06b4('0x1'));var moment=require(_0x06b4('0x2'));var BPromise=require(_0x06b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b4('0x4'));var db=require(_0x06b4('0x5'))['db'];var utils=require(_0x06b4('0x6'));var logger=require(_0x06b4('0x7'))('rpc');var config=require(_0x06b4('0x8'));var jayson=require(_0x06b4('0x9'));var client=jayson[_0x06b4('0xa')][_0x06b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267d17,_0x26cd84,_0x11b5c9){return new BPromise(function(_0x5083e4,_0xe3a08a){return client[_0x06b4('0xc')](_0x267d17,_0x11b5c9)['then'](function(_0x1e974e){logger['info'](_0x06b4('0xd'),_0x26cd84,'request\x20sent');logger[_0x06b4('0xe')](_0x06b4('0xf'),_0x26cd84,_0x06b4('0x10'),JSON[_0x06b4('0x11')](_0x1e974e));if(_0x1e974e['error']){if(_0x1e974e[_0x06b4('0x12')]['code']===0x1f4){logger[_0x06b4('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26cd84,_0x1e974e[_0x06b4('0x12')][_0x06b4('0x13')]);return _0xe3a08a(_0x1e974e['error'][_0x06b4('0x13')]);}logger[_0x06b4('0x12')](_0x06b4('0xd'),_0x26cd84,_0x1e974e['error']['message']);return _0x5083e4(_0x1e974e[_0x06b4('0x12')]['message']);}else{logger[_0x06b4('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26cd84,_0x06b4('0x10'));_0x5083e4(_0x1e974e['result']['message']);}})[_0x06b4('0x15')](function(_0x3290ee){logger[_0x06b4('0x12')](_0x06b4('0xd'),_0x26cd84,_0x3290ee);_0xe3a08a(_0x3290ee);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 35a284b..ef8810e 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 _0xba18=['/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','/:id','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','show','/:id/downloads','downloads'];(function(_0x1a4381,_0x51e7da){var _0x426efc=function(_0x563ffc){while(--_0x563ffc){_0x1a4381['push'](_0x1a4381['shift']());}};_0x426efc(++_0x51e7da);}(_0xba18,0x129));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x8ba1('0x0'));var path=require(_0x8ba1('0x1'));var timeout=require('connect-timeout');var express=require(_0x8ba1('0x2'));var router=express['Router']();var fs_extra=require(_0x8ba1('0x3'));var auth=require(_0x8ba1('0x4'));var interaction=require(_0x8ba1('0x5'));var config=require(_0x8ba1('0x6'));var controller=require(_0x8ba1('0x7'));router[_0x8ba1('0x8')]('/',auth[_0x8ba1('0x9')](),controller['index']);router['get'](_0x8ba1('0xa'),auth['isAuthenticated'](),controller[_0x8ba1('0xb')]);router[_0x8ba1('0x8')]('/:id',auth[_0x8ba1('0x9')](),controller[_0x8ba1('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['get'](_0x8ba1('0xd'),controller[_0x8ba1('0xe')]);router[_0x8ba1('0x8')](_0x8ba1('0xf'),auth[_0x8ba1('0x9')](),controller[_0x8ba1('0x10')]);router['post']('/',auth[_0x8ba1('0x9')](),controller[_0x8ba1('0x11')]);router[_0x8ba1('0x12')](_0x8ba1('0xf'),auth['isAuthenticated'](),controller[_0x8ba1('0x13')]);router[_0x8ba1('0x14')](_0x8ba1('0x15'),auth[_0x8ba1('0x9')](),controller['update']);router[_0x8ba1('0x16')](_0x8ba1('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0x8ba1('0x17')]=router; \ No newline at end of file +var _0x740d=['/describe','isAuthenticated','describe','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4b2d7e,_0x1e24a9){var _0x55a0cc=function(_0x54c4b6){while(--_0x54c4b6){_0x4b2d7e['push'](_0x4b2d7e['shift']());}};_0x55a0cc(++_0x1e24a9);}(_0x740d,0x1f1));var _0xd740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x740d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd740('0x0'));var path=require(_0xd740('0x1'));var timeout=require(_0xd740('0x2'));var express=require('express');var router=express[_0xd740('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd740('0x4'));var interaction=require(_0xd740('0x5'));var config=require(_0xd740('0x6'));var controller=require('./voiceRecording.controller');router[_0xd740('0x7')]('/',auth['isAuthenticated'](),controller[_0xd740('0x8')]);router[_0xd740('0x7')](_0xd740('0x9'),auth[_0xd740('0xa')](),controller[_0xd740('0xb')]);router[_0xd740('0x7')]('/:id',auth[_0xd740('0xa')](),controller['show']);router[_0xd740('0x7')]('/:id/download',auth[_0xd740('0xa')](),controller['download']);router[_0xd740('0x7')](_0xd740('0xc'),controller['downloads']);router[_0xd740('0x7')](_0xd740('0xd'),auth[_0xd740('0xa')](),controller[_0xd740('0xe')]);router['post']('/',auth[_0xd740('0xa')](),controller[_0xd740('0xf')]);router[_0xd740('0x10')](_0xd740('0xd'),auth[_0xd740('0xa')](),controller['runTranscribe']);router[_0xd740('0x11')](_0xd740('0x12'),auth[_0xd740('0xa')](),controller[_0xd740('0x13')]);router['delete'](_0xd740('0x12'),auth['isAuthenticated'](),controller[_0xd740('0x14')]);module[_0xd740('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index deb5b0f..e7a8ca1 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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 47a0ebc..5c17b1d 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 _0xb2ea=['startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','decryptFile','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','update','then','error','stack','name','send','index','VoiceRecording','fieldName','type','key','model','differenceBy','map','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','keys','find','create','body','describe','download','uniqueid','value','recording','existsSync','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','extname','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService'];(function(_0x3711e2,_0x1468e1){var _0x18a556=function(_0x5e0923){while(--_0x5e0923){_0x3711e2['push'](_0x3711e2['shift']());}};_0x18a556(++_0x1468e1);}(_0xb2ea,0x1f1));var _0xab2e=function(_0x3c9bdf,_0x3b30cd){_0x3c9bdf=_0x3c9bdf-0x0;var _0x5664a6=_0xb2ea[_0x3c9bdf];return _0x5664a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab2e('0x0'));var zipdir=require(_0xab2e('0x1'));var jsonpatch=require(_0xab2e('0x2'));var rp=require('request-promise');var moment=require(_0xab2e('0x3'));var BPromise=require(_0xab2e('0x4'));var Mustache=require(_0xab2e('0x5'));var util=require('util');var path=require(_0xab2e('0x6'));var sox=require(_0xab2e('0x7'));var csv=require(_0xab2e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xab2e('0x9'));var jsforce=require(_0xab2e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab2e('0xb'));var Papa=require('papaparse');var AWS=require(_0xab2e('0xc'));var uuidv4=require(_0xab2e('0xd'));var Redis=require('ioredis');var authService=require(_0xab2e('0xe'));var qs=require(_0xab2e('0xf'));var as=require(_0xab2e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab2e('0x11'))(_0xab2e('0x12'));var utils=require(_0xab2e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab2e('0x14'))['db'];function respondWithStatusCode(_0x16609f,_0x112088){_0x112088=_0x112088||0xcc;return function(_0x4377a9){if(_0x4377a9){return _0x16609f[_0xab2e('0x15')](_0x112088);}return _0x16609f[_0xab2e('0x16')](_0x112088)[_0xab2e('0x17')]();};}function respondWithResult(_0x49cf70,_0x5c94c2){_0x5c94c2=_0x5c94c2||0xc8;return function(_0x1e79ae){if(_0x1e79ae){return _0x49cf70['status'](_0x5c94c2)['json'](_0x1e79ae);}};}function respondWithFilteredResult(_0x11b1d8,_0x175d71){return function(_0x3e7e85){if(_0x3e7e85){var _0x52676d=typeof _0x175d71['offset']===_0xab2e('0x18')&&typeof _0x175d71[_0xab2e('0x19')]==='undefined';var _0x341e18=_0x3e7e85[_0xab2e('0x1a')];var _0x206c46=_0x52676d?0x0:_0x175d71['offset'];var _0x541416=_0x52676d?_0x3e7e85[_0xab2e('0x1a')]:_0x175d71[_0xab2e('0x1b')]+_0x175d71['limit'];var _0xe3ea68;if(_0x541416>=_0x341e18){_0x541416=_0x341e18;_0xe3ea68=0xc8;}else{_0xe3ea68=0xce;}_0x11b1d8['status'](_0xe3ea68);return _0x11b1d8[_0xab2e('0x1c')]('Content-Range',_0x206c46+'-'+_0x541416+'/'+_0x341e18)[_0xab2e('0x1d')](_0x3e7e85);}return null;};}function patchUpdates(_0x562e47){return function(_0x112c0e){try{jsonpatch[_0xab2e('0x1e')](_0x112c0e,_0x562e47,!![]);}catch(_0x5af5fc){return BPromise[_0xab2e('0x1f')](_0x5af5fc);}return _0x112c0e['save']();};}function saveUpdates(_0x3401a,_0x49658a){return function(_0xc5b67f){if(_0xc5b67f){return _0xc5b67f[_0xab2e('0x20')](_0x3401a)[_0xab2e('0x21')](function(_0xb3dba6){return _0xb3dba6;});}return null;};}function removeEntity(_0x5b0b37,_0x4ad7f6){return function(_0x4b05ed){if(_0x4b05ed){return _0x4b05ed['destroy']()[_0xab2e('0x21')](function(){_0x5b0b37['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36028f,_0x5a5492){return function(_0x28b657){if(!_0x28b657){_0x36028f[_0xab2e('0x15')](0x194);}return _0x28b657;};}function handleError(_0x1899a4,_0x32f59f){_0x32f59f=_0x32f59f||0x1f4;return function(_0x51ff55){logger[_0xab2e('0x22')](_0x51ff55[_0xab2e('0x23')]);if(_0x51ff55[_0xab2e('0x24')]){delete _0x51ff55['name'];}_0x1899a4['status'](_0x32f59f)[_0xab2e('0x25')](_0x51ff55);};}exports[_0xab2e('0x26')]=function(_0x357824,_0xfdfe5d){var _0x3f7078={},_0x38c49e={},_0x693e1f={'count':0x0,'rows':[]};var _0x270133=_['map'](db[_0xab2e('0x27')]['rawAttributes'],function(_0x335496){return{'name':_0x335496[_0xab2e('0x28')],'type':_0x335496[_0xab2e('0x29')][_0xab2e('0x2a')]};});_0x38c49e[_0xab2e('0x2b')]=_[_0xab2e('0x2c')](_[_0xab2e('0x2d')](_0x270133,_0xab2e('0x24')),[_0xab2e('0x2e')]);_0x38c49e['query']=_['keys'](_0x357824[_0xab2e('0x2f')]);_0x38c49e['filters']=_[_0xab2e('0x30')](_0x38c49e[_0xab2e('0x2b')],_0x38c49e[_0xab2e('0x2f')]);_0x3f7078[_0xab2e('0x31')]=_[_0xab2e('0x30')](_0x38c49e['model'],qs[_0xab2e('0x32')](_0x357824[_0xab2e('0x2f')][_0xab2e('0x32')]));_0x3f7078[_0xab2e('0x31')]=_0x3f7078[_0xab2e('0x31')][_0xab2e('0x33')]?_0x3f7078[_0xab2e('0x31')]:_0x38c49e[_0xab2e('0x2b')];if(!_0x357824[_0xab2e('0x2f')][_0xab2e('0x34')](_0xab2e('0x35'))){_0x3f7078[_0xab2e('0x19')]=qs[_0xab2e('0x19')](_0x357824['query'][_0xab2e('0x19')]);_0x3f7078['offset']=qs[_0xab2e('0x1b')](_0x357824[_0xab2e('0x2f')][_0xab2e('0x1b')]);}_0x3f7078[_0xab2e('0x36')]=qs[_0xab2e('0x37')](_0x357824['query'][_0xab2e('0x37')]);_0x3f7078[_0xab2e('0x38')]=qs[_0xab2e('0x39')](_[_0xab2e('0x3a')](_0x357824['query'],_0x38c49e[_0xab2e('0x39')]),_0x270133);if(_0x357824[_0xab2e('0x2f')][_0xab2e('0x3b')]){_0x3f7078[_0xab2e('0x38')]=_[_0xab2e('0x3c')](_0x3f7078['where'],{'$or':_[_0xab2e('0x2d')](_0x270133,function(_0x4cc9d3){if(_0x4cc9d3[_0xab2e('0x29')]!=='VIRTUAL'){var _0xab5233={};_0xab5233[_0x4cc9d3[_0xab2e('0x24')]]={'$like':'%'+_0x357824[_0xab2e('0x2f')]['filter']+'%'};return _0xab5233;}})});}_0x3f7078=_[_0xab2e('0x3c')]({},_0x3f7078,_0x357824[_0xab2e('0x3d')]);var _0xdf077a={'where':_0x3f7078[_0xab2e('0x38')]};return db['VoiceRecording']['count'](_0xdf077a)['then'](function(_0x55eaeb){_0x693e1f[_0xab2e('0x1a')]=_0x55eaeb;if(_0x357824['query'][_0xab2e('0x3e')]){_0x3f7078[_0xab2e('0x3f')]=[{'all':!![]}];}return db[_0xab2e('0x27')]['findAll'](_0x3f7078);})[_0xab2e('0x21')](function(_0xca6d18){_0x693e1f[_0xab2e('0x40')]=_0xca6d18;return _0x693e1f;})[_0xab2e('0x21')](respondWithFilteredResult(_0xfdfe5d,_0x3f7078))[_0xab2e('0x41')](handleError(_0xfdfe5d,null));};exports['show']=function(_0xd71213,_0x5cbd59){var _0x4d25e8={'raw':![],'where':{'id':_0xd71213[_0xab2e('0x42')]['id']}},_0x32f56b={};_0x32f56b[_0xab2e('0x2b')]=_['keys'](db[_0xab2e('0x27')][_0xab2e('0x43')]);_0x32f56b[_0xab2e('0x2f')]=_[_0xab2e('0x44')](_0xd71213['query']);_0x32f56b[_0xab2e('0x39')]=_[_0xab2e('0x30')](_0x32f56b[_0xab2e('0x2b')],_0x32f56b[_0xab2e('0x2f')]);_0x4d25e8['attributes']=_['intersection'](_0x32f56b['model'],qs['fields'](_0xd71213[_0xab2e('0x2f')][_0xab2e('0x32')]));_0x4d25e8['attributes']=_0x4d25e8[_0xab2e('0x31')]['length']?_0x4d25e8[_0xab2e('0x31')]:_0x32f56b[_0xab2e('0x2b')];if(_0xd71213['query']['includeAll']){_0x4d25e8[_0xab2e('0x3f')]=[{'all':!![]}];}_0x4d25e8=_[_0xab2e('0x3c')]({},_0x4d25e8,_0xd71213[_0xab2e('0x3d')]);return db[_0xab2e('0x27')][_0xab2e('0x45')](_0x4d25e8)[_0xab2e('0x21')](handleEntityNotFound(_0x5cbd59,null))['then'](respondWithResult(_0x5cbd59,null))['catch'](handleError(_0x5cbd59,null));};exports[_0xab2e('0x46')]=function(_0x257d33,_0x2d4fee){return db[_0xab2e('0x27')][_0xab2e('0x46')](_0x257d33[_0xab2e('0x47')],{})[_0xab2e('0x21')](respondWithResult(_0x2d4fee,0xc9))[_0xab2e('0x41')](handleError(_0x2d4fee,null));};exports[_0xab2e('0x20')]=function(_0x4fba25,_0x317a9d){if(_0x4fba25[_0xab2e('0x47')]['id']){delete _0x4fba25['body']['id'];}return db[_0xab2e('0x27')]['find']({'where':{'id':_0x4fba25[_0xab2e('0x42')]['id']}})[_0xab2e('0x21')](handleEntityNotFound(_0x317a9d,null))[_0xab2e('0x21')](saveUpdates(_0x4fba25['body'],null))[_0xab2e('0x21')](respondWithResult(_0x317a9d,null))[_0xab2e('0x41')](handleError(_0x317a9d,null));};exports[_0xab2e('0x48')]=function(_0x174892,_0x2c2b2c){return db['VoiceRecording'][_0xab2e('0x48')]()['then'](respondWithResult(_0x2c2b2c,null))['catch'](handleError(_0x2c2b2c,null));};exports[_0xab2e('0x49')]=function(_0x25c3cf,_0x5c504b,_0x58c885){var _0xe2c731=require('../../components/encryptor');var _0x3619d0=![];var _0x3f53b2={};if(_0x25c3cf[_0xab2e('0x2f')]['type']&&_0x25c3cf[_0xab2e('0x2f')][_0xab2e('0x29')]==='uniqueid'){_0x3f53b2[_0xab2e('0x4a')]=_0x25c3cf[_0xab2e('0x42')]['id'];}else{_0x3f53b2['id']=_0x25c3cf['params']['id'];}return db[_0xab2e('0x27')][_0xab2e('0x45')]({'where':_0x3f53b2,'attributes':['id',_0xab2e('0x4b')],'raw':!![]})[_0xab2e('0x21')](handleEntityNotFound(_0x5c504b,null))['then'](function(_0x3969a8){if(_0x3969a8){var _0x120ad8=_0x3969a8[_0xab2e('0x4b')];var _0x5f29a6=util['format']('%s.cypher',_0x120ad8);if(fs['existsSync'](_0x5f29a6)){_0x3619d0=!![];return _0xe2c731['decryptFile'](_0x5f29a6,_0x120ad8,config['secrets'][_0xab2e('0x4c')])[_0xab2e('0x21')](function(){return _0x3969a8;});}return _0x3969a8;}})[_0xab2e('0x21')](function(_0x2639d2){if(_0x2639d2){var _0x47cead=_0x2639d2['value'];if(!fs[_0xab2e('0x4d')](_0x47cead)){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x2639d2[_0xab2e('0x50')]){return _0x5c504b['download'](_0x47cead,_0x2639d2[_0xab2e('0x50')]+path['extname'](_0x47cead),function(){if(_0x3619d0){fs[_0xab2e('0x51')](_0x47cead);}});}else{return _0x5c504b[_0xab2e('0x49')](_0x47cead,function(_0x54fbc6){if(_0x3619d0){fs[_0xab2e('0x51')](_0x47cead);}});}}})[_0xab2e('0x41')](function(_0x59828f){if(_0x59828f[_0xab2e('0x52')]===_0xab2e('0x53')){_0x5c504b[_0xab2e('0x16')](0x194)[_0xab2e('0x25')]('Not\x20found');}else{return handleError(_0x5c504b,null);}});};exports[_0xab2e('0x54')]=function(_0x309127,_0x246ce0,_0x259482){var _0x4485c5=require(_0xab2e('0x55'));var _0x467543=![];var _0x2e7abd={'$and':[db[_0xab2e('0x56')]['where'](db[_0xab2e('0x56')]['fn'](_0xab2e('0x57'),db[_0xab2e('0x56')][_0xab2e('0x58')](_0xab2e('0x4a'))),_0x309127[_0xab2e('0x2f')][_0xab2e('0x59')])]};if(_0x309127['query'][_0xab2e('0x29')]&&_0x309127[_0xab2e('0x2f')][_0xab2e('0x29')]===_0xab2e('0x4a')){_0x2e7abd[_0xab2e('0x5a')]['push']({'uniqueid':_0x309127[_0xab2e('0x42')]['id']});}else{_0x2e7abd[_0xab2e('0x5a')][_0xab2e('0x5b')]({'id':_0x309127[_0xab2e('0x42')]['id']});}return db[_0xab2e('0x27')][_0xab2e('0x45')]({'where':_0x2e7abd,'attributes':['id',_0xab2e('0x4b')],'raw':!![]})[_0xab2e('0x21')](handleEntityNotFound(_0x246ce0,null))[_0xab2e('0x21')](function(_0x2c72bb){if(_0x2c72bb){var _0x15df2e=util['format'](_0xab2e('0x5c'),_0x2c72bb[_0xab2e('0x4b')]);if(fs[_0xab2e('0x4d')](_0x15df2e)){_0x467543=!![];return _0x4485c5['decryptFile'](_0x15df2e,_0x2c72bb[_0xab2e('0x4b')],config[_0xab2e('0x5d')][_0xab2e('0x4c')])[_0xab2e('0x21')](function(){return _0x2c72bb;});}return _0x2c72bb;}})['then'](function(_0x359855){if(_0x359855){if(!fs[_0xab2e('0x4d')](_0x359855[_0xab2e('0x4b')])){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x359855[_0xab2e('0x50')]){return _0x246ce0[_0xab2e('0x49')](_0x359855[_0xab2e('0x4b')],_0x359855[_0xab2e('0x50')]+path[_0xab2e('0x5e')](_0x359855[_0xab2e('0x4b')]),function(){if(_0x467543){fs[_0xab2e('0x51')](_0x359855[_0xab2e('0x4b')]);}});}else{return _0x246ce0[_0xab2e('0x49')](_0x359855[_0xab2e('0x4b')],function(_0xb8435c){if(_0x467543){fs['unlink'](_0x359855[_0xab2e('0x4b')]);}});}}})['catch'](handleError(_0x246ce0,null));};exports[_0xab2e('0x5f')]=function(_0x11a220,_0x2153af){return db[_0xab2e('0x27')][_0xab2e('0x45')]({'where':{'id':_0x11a220[_0xab2e('0x42')]['id']}})['then'](function(_0x4a192a){if(_[_0xab2e('0x60')](_0x4a192a)){throw new ReferenceError(_0xab2e('0x61'));}return _0x4a192a;})[_0xab2e('0x21')](function(_0xa648c3){var _0x1051a0=_0xa648c3['value'];logger[_0xab2e('0x62')](_0xab2e('0x63'),_0x1051a0);if(!_[_0xab2e('0x60')](_0xa648c3[_0xab2e('0x4b')])&&fs[_0xab2e('0x4d')](_0x1051a0)){logger[_0xab2e('0x62')](_0xab2e('0x64')+_0x1051a0+_0xab2e('0x65'));fs[_0xab2e('0x66')](_0x1051a0);}_0x1051a0=_0x1051a0+'.cypher';if(!_[_0xab2e('0x60')](_0xa648c3['value'])&&fs[_0xab2e('0x4d')](_0x1051a0)){logger[_0xab2e('0x62')](_0xab2e('0x64')+_0x1051a0+_0xab2e('0x65'));fs[_0xab2e('0x66')](_0x1051a0);}return _0xa648c3;})[_0xab2e('0x21')](function(_0x22c2f9){if(!_0x22c2f9)throw new InternalError();return _0x22c2f9[_0xab2e('0x5f')]();})['then'](function(){_0x2153af[_0xab2e('0x16')](0xcc)['end']();})[_0xab2e('0x41')](handleError(_0x2153af,null));};function getBucketslist(_0x6106ff,_0x4366f7,_0x5ed856){return new Promise(function(_0x5f3a1d,_0x631e3e){var _0x543bbd=new AWS['S3']({'accessKeyId':_0x4366f7,'secretAccessKey':_0x6106ff,'region':_0x5ed856});_0x543bbd[_0xab2e('0x67')]({},function(_0x4eddb7,_0xf32bd6){if(_0x4eddb7){return _0x631e3e(_0x4eddb7);}else{return _0x5f3a1d(_0xf32bd6);}});});}function createBucket(_0x4c79cc,_0x5ed2c1,_0x414d1b,_0x1fafd5){return new Promise(function(_0xc48a00,_0x3ad356){var _0x57ab35=new AWS['S3']({'accessKeyId':_0x5ed2c1,'secretAccessKey':_0x4c79cc,'region':_0x414d1b});_0x57ab35[_0xab2e('0x68')]({'Bucket':_0x1fafd5},function(_0x54d38a,_0x1d3ccd){if(_0x54d38a){return _0x3ad356(_0x54d38a);}else{return _0xc48a00(_0x1d3ccd);}});});}function uploadFile(_0xb50590,_0x50ce9e,_0x370ee5,_0x55970e,_0xd5fa13,_0x57ed71){return new Promise(function(_0x332ce5,_0x5271cc){var _0x3ec1d1=new AWS['S3']({'accessKeyId':_0x50ce9e,'secretAccessKey':_0xb50590,'region':_0x370ee5});_0x3ec1d1[_0xab2e('0x69')]({'Bucket':_0x55970e,'Key':_0xd5fa13,'Body':_0x57ed71},function(_0x442258,_0x5aa27e){if(_0x442258){return _0x5271cc(_0x442258);}else{return _0x332ce5(_0x5aa27e);}});});}function startTranscribe(_0x2ee18f,_0x207a8b,_0x9fc502,_0x44feba,_0x6840f4,_0x2c4293){return new Promise(function(_0x58367b,_0x596b72){var _0x1aac9e=new AWS[(_0xab2e('0x6a'))]({'accessKeyId':_0x207a8b,'secretAccessKey':_0x2ee18f,'region':_0x9fc502});_0x1aac9e[_0xab2e('0x6b')]({'TranscriptionJobName':_0x44feba,'LanguageCode':_0x6840f4,'Media':{'MediaFileUri':_0x2c4293}},function(_0x5e405a,_0x5413c5){if(_0x5e405a){return _0x596b72(_0x5e405a);}else{return _0x58367b(_0x5413c5);}});});}function transcribe(_0x4f77ed,_0x21a646,_0x322bb7,_0x21fe14,_0xc9b2a8,_0x494f3c,_0x18bf69){return new Promise(function(_0x5af2bc,_0x249a96){var _0x1c7f6a={};logger[_0xab2e('0x62')](util[_0xab2e('0x2e')](_0xab2e('0x6c'),_0x4f77ed,_0xc9b2a8));return uploadFile(_0x21a646,_0x322bb7,_0x21fe14,_0xc9b2a8,path[_0xab2e('0x6d')](_0x494f3c),fs['readFileSync'](_0x494f3c))[_0xab2e('0x21')](function(_0x10bacb){logger[_0xab2e('0x62')](util[_0xab2e('0x2e')](_0xab2e('0x6e'),_0x4f77ed,_0xc9b2a8,_0x10bacb[_0xab2e('0x6f')]));_0x1c7f6a['bucket']=_0x10bacb[_0xab2e('0x70')];_0x1c7f6a[_0xab2e('0x71')]=_0x10bacb[_0xab2e('0x6f')];logger[_0xab2e('0x62')](util[_0xab2e('0x2e')](_0xab2e('0x72'),_0x4f77ed));return startTranscribe(_0x21a646,_0x322bb7,_0x21fe14,uuidv4(),_0x18bf69,_0x10bacb['Location']);})[_0xab2e('0x21')](function(_0x1587ff){logger[_0xab2e('0x62')](util[_0xab2e('0x2e')](_0xab2e('0x73'),_0x4f77ed,_0x1587ff[_0xab2e('0x74')]['TranscriptionJobName']));_0x1c7f6a[_0xab2e('0x75')]=_0x1587ff[_0xab2e('0x74')][_0xab2e('0x76')];_0x1c7f6a[_0xab2e('0x77')]=_0x1587ff[_0xab2e('0x74')][_0xab2e('0x78')];return _0x5af2bc(_0x1c7f6a);})[_0xab2e('0x41')](function(_0x27b11d){return _0x249a96(_0x27b11d);});});}exports['runTranscribe']=function(_0x51347a,_0x6511cf,_0x40847b){var _0x6b9e3e;var _0x28787f;var _0x46b486;var _0x3d5419=require(_0xab2e('0x55'));return db['VoiceRecording'][_0xab2e('0x79')]({'where':{'id':_0x51347a[_0xab2e('0x42')]['id']}})[_0xab2e('0x21')](function(_0x38f1e9){if(_0x38f1e9){var _0x4ca277=util['format'](_0xab2e('0x5c'),_0x38f1e9[_0xab2e('0x4b')]);if(fs[_0xab2e('0x4d')](_0x4ca277)){cypher=!![];return _0x3d5419[_0xab2e('0x7a')](_0x4ca277,_0x38f1e9[_0xab2e('0x4b')],config[_0xab2e('0x5d')][_0xab2e('0x4c')])[_0xab2e('0x21')](function(){return _0x38f1e9;});}return _0x38f1e9;}})['then'](function(_0x1a9950){if(!_0x1a9950){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))](_0xab2e('0x7b'));}_0x28787f=_0x1a9950;return db['Setting'][_0xab2e('0x79')]({'where':{'id':0x1}});})[_0xab2e('0x21')](handleEntityNotFound(_0x6511cf,null))[_0xab2e('0x21')](function(_0x352074){if(_0x352074){_0x6b9e3e=_0x352074;if(!_0x6b9e3e[_0xab2e('0x7c')]||!_0x6b9e3e['transcribeAccountId']||!_0x6b9e3e[_0xab2e('0x7d')]||!_0x6b9e3e['language']||!_0x6b9e3e[_0xab2e('0x7e')]){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))]('Transcribe\x20not\x20configured');}if(_0x51347a[_0xab2e('0x47')][_0xab2e('0x7f')]&&(!_0x6b9e3e[_0xab2e('0x80')]||!_0x6b9e3e[_0xab2e('0x81')]||!_0x6b9e3e[_0xab2e('0x82')]||!_0x6b9e3e[_0xab2e('0x83')]||!_0x6b9e3e['bucket'])){throw new db['Sequelize'][(_0xab2e('0x4f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xab2e('0x84')][_0xab2e('0x79')]({'where':{'id':_0x6b9e3e[_0xab2e('0x85')]}});}})['then'](function(_0xdc5dde){if(!_0xdc5dde){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))](_0xab2e('0x86'));}if(!_0xdc5dde[_0xab2e('0x87')]||!_0xdc5dde[_0xab2e('0x88')]){throw new db[(_0xab2e('0x4e'))][(_0xab2e('0x4f'))](_0xab2e('0x89'));}_0x46b486=_0xdc5dde;return getBucketslist(_0x46b486[_0xab2e('0x87')],_0x46b486[_0xab2e('0x88')],_0x6b9e3e[_0xab2e('0x7d')]);})[_0xab2e('0x21')](function(_0x51b4f0){if(_0x51b4f0&&_0x51b4f0[_0xab2e('0x8a')]){var _0x179cad=_['find'](_0x51b4f0['Buckets'],function(_0x512a21){return _0x512a21['Name']===_0x6b9e3e['bucket'];});if(!_0x179cad){logger['info'](util[_0xab2e('0x2e')](_0xab2e('0x8b'),_0x51347a[_0xab2e('0x42')]['id'],_0x6b9e3e[_0xab2e('0x7e')]));return createBucket(_0x46b486[_0xab2e('0x87')],_0x46b486[_0xab2e('0x88')],_0x6b9e3e[_0xab2e('0x7d')],_0x6b9e3e[_0xab2e('0x7e')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x51347a[_0xab2e('0x42')]['id'],_0x6b9e3e[_0xab2e('0x7e')]));return;}})[_0xab2e('0x21')](function(_0x513f53){if(_0x28787f[_0xab2e('0x77')]===_0xab2e('0x8c')){return transcribe(_0x51347a['params']['id'],_0x46b486[_0xab2e('0x87')],_0x46b486['data2'],_0x6b9e3e[_0xab2e('0x7d')],_0x6b9e3e['bucket'],_0x28787f[_0xab2e('0x4b')],_0x6b9e3e['language']);}else{logger[_0xab2e('0x62')](util[_0xab2e('0x2e')](_0xab2e('0x8d'),_0x51347a[_0xab2e('0x42')]['id']));return{'transcribeStatus':_0xab2e('0x8e')};}})[_0xab2e('0x21')](function(_0x1c6fed){if(_0x1c6fed){_0x1c6fed[_0xab2e('0x8f')]=_0x51347a[_0xab2e('0x47')][_0xab2e('0x7f')];return _0x28787f[_0xab2e('0x90')](_0x1c6fed);}})[_0xab2e('0x21')](respondWithResult(_0x6511cf,null))[_0xab2e('0x41')](handleError(_0x6511cf,null));};function writeFile(_0x467267,_0x51f3cd){return new Promise(function(_0x419448,_0x485669){fs[_0xab2e('0x91')](_0x51f3cd,_0x467267,function(_0x276eb5,_0x278d8b){if(_0x276eb5){return _0x485669(_0x276eb5);}else{return _0x419448(_0x278d8b);}});});}exports[_0xab2e('0x92')]=function(_0x4d55be,_0xfdab81,_0xe76f8){return db[_0xab2e('0x27')]['findOne']({'where':{'id':_0x4d55be[_0xab2e('0x42')]['id']}})[_0xab2e('0x21')](handleEntityNotFound(_0xfdab81))[_0xab2e('0x21')](function(_0x3b6384){if(_0x3b6384&&_0x3b6384[_0xab2e('0x93')]){var _0x4e035c=_0x3b6384[_0xab2e('0x93')];var _0x4e77bc=config['root']+_0xab2e('0x94')+_0x3b6384['id']+_0xab2e('0x95');if(fs[_0xab2e('0x4d')](_0x4e77bc)){return _0x4e77bc;}return writeFile(_0x4e035c,_0x4e77bc)[_0xab2e('0x21')](function(){return _0x4e77bc;});}else{throw new db[(_0xab2e('0x4e'))]['ValidationError'](_0xab2e('0x96'));}})[_0xab2e('0x21')](function(_0x30075c){return _0xfdab81['download'](_0x30075c);})[_0xab2e('0x41')](handleError(_0xfdab81));}; \ No newline at end of file +var _0xe8ce=['filter','VIRTUAL','merge','options','includeAll','include','show','params','keys','find','catch','create','body','describe','download','type','uniqueid','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','push','$and','secrets','recording','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','update','then','end','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x26eb79,_0x458481){var _0x383c7b=function(_0x1ceba0){while(--_0x1ceba0){_0x26eb79['push'](_0x26eb79['shift']());}};_0x383c7b(++_0x458481);}(_0xe8ce,0x16b));var _0xee8c=function(_0x4a2442,_0x4650d4){_0x4a2442=_0x4a2442-0x0;var _0x1a6449=_0xe8ce[_0x4a2442];return _0x1a6449;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee8c('0x0'));var zipdir=require(_0xee8c('0x1'));var jsonpatch=require(_0xee8c('0x2'));var rp=require(_0xee8c('0x3'));var moment=require(_0xee8c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee8c('0x5'));var util=require(_0xee8c('0x6'));var path=require(_0xee8c('0x7'));var sox=require(_0xee8c('0x8'));var csv=require(_0xee8c('0x9'));var ejs=require(_0xee8c('0xa'));var fs=require('fs');var fs_extra=require(_0xee8c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee8c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee8c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xee8c('0xe'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0xee8c('0xf'));var authService=require(_0xee8c('0x10'));var qs=require(_0xee8c('0x11'));var as=require(_0xee8c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee8c('0x13'))(_0xee8c('0x14'));var utils=require('../../config/utils');var config=require(_0xee8c('0x15'));var licenseUtil=require(_0xee8c('0x16'));var db=require(_0xee8c('0x17'))['db'];function respondWithStatusCode(_0x236c62,_0x5374e6){_0x5374e6=_0x5374e6||0xcc;return function(_0x4ea62e){if(_0x4ea62e){return _0x236c62[_0xee8c('0x18')](_0x5374e6);}return _0x236c62[_0xee8c('0x19')](_0x5374e6)['end']();};}function respondWithResult(_0x55906a,_0x5c90d5){_0x5c90d5=_0x5c90d5||0xc8;return function(_0x14e594){if(_0x14e594){return _0x55906a[_0xee8c('0x19')](_0x5c90d5)['json'](_0x14e594);}};}function respondWithFilteredResult(_0x1fac16,_0x1911ab){return function(_0x2766f2){if(_0x2766f2){var _0x1da2b7=typeof _0x1911ab[_0xee8c('0x1a')]==='undefined'&&typeof _0x1911ab[_0xee8c('0x1b')]===_0xee8c('0x1c');var _0x7dad69=_0x2766f2[_0xee8c('0x1d')];var _0x55c299=_0x1da2b7?0x0:_0x1911ab[_0xee8c('0x1a')];var _0x2e69c4=_0x1da2b7?_0x2766f2[_0xee8c('0x1d')]:_0x1911ab['offset']+_0x1911ab['limit'];var _0x17ffcd;if(_0x2e69c4>=_0x7dad69){_0x2e69c4=_0x7dad69;_0x17ffcd=0xc8;}else{_0x17ffcd=0xce;}_0x1fac16[_0xee8c('0x19')](_0x17ffcd);return _0x1fac16['set'](_0xee8c('0x1e'),_0x55c299+'-'+_0x2e69c4+'/'+_0x7dad69)[_0xee8c('0x1f')](_0x2766f2);}return null;};}function patchUpdates(_0x3d7990){return function(_0x37365b){try{jsonpatch['apply'](_0x37365b,_0x3d7990,!![]);}catch(_0x4412fc){return BPromise['reject'](_0x4412fc);}return _0x37365b['save']();};}function saveUpdates(_0x44b455,_0x2391af){return function(_0x17e6e9){if(_0x17e6e9){return _0x17e6e9[_0xee8c('0x20')](_0x44b455)[_0xee8c('0x21')](function(_0x11297d){return _0x11297d;});}return null;};}function removeEntity(_0x56217d,_0x2059ed){return function(_0x438701){if(_0x438701){return _0x438701['destroy']()[_0xee8c('0x21')](function(){_0x56217d['status'](0xcc)[_0xee8c('0x22')]();});}};}function handleEntityNotFound(_0x4bb40b,_0x2b63ac){return function(_0x55df62){if(!_0x55df62){_0x4bb40b['sendStatus'](0x194);}return _0x55df62;};}function handleError(_0x5dcb65,_0x1262d8){_0x1262d8=_0x1262d8||0x1f4;return function(_0x376cc5){logger[_0xee8c('0x23')](_0x376cc5[_0xee8c('0x24')]);if(_0x376cc5[_0xee8c('0x25')]){delete _0x376cc5[_0xee8c('0x25')];}_0x5dcb65[_0xee8c('0x19')](_0x1262d8)[_0xee8c('0x26')](_0x376cc5);};}exports[_0xee8c('0x27')]=function(_0x21c55e,_0x28f110){var _0x276b61={},_0x234faa={},_0x22632c={'count':0x0,'rows':[]};var _0x530ad1=_['map'](db[_0xee8c('0x28')][_0xee8c('0x29')],function(_0x431518){return{'name':_0x431518[_0xee8c('0x2a')],'type':_0x431518['type'][_0xee8c('0x2b')]};});_0x234faa[_0xee8c('0x2c')]=_[_0xee8c('0x2d')](_[_0xee8c('0x2e')](_0x530ad1,_0xee8c('0x25')),[_0xee8c('0x2f')]);_0x234faa[_0xee8c('0x30')]=_['keys'](_0x21c55e['query']);_0x234faa[_0xee8c('0x31')]=_[_0xee8c('0x32')](_0x234faa[_0xee8c('0x2c')],_0x234faa[_0xee8c('0x30')]);_0x276b61['attributes']=_['intersection'](_0x234faa[_0xee8c('0x2c')],qs['fields'](_0x21c55e[_0xee8c('0x30')][_0xee8c('0x33')]));_0x276b61[_0xee8c('0x34')]=_0x276b61[_0xee8c('0x34')][_0xee8c('0x35')]?_0x276b61[_0xee8c('0x34')]:_0x234faa[_0xee8c('0x2c')];if(!_0x21c55e[_0xee8c('0x30')][_0xee8c('0x36')](_0xee8c('0x37'))){_0x276b61[_0xee8c('0x1b')]=qs['limit'](_0x21c55e[_0xee8c('0x30')][_0xee8c('0x1b')]);_0x276b61[_0xee8c('0x1a')]=qs[_0xee8c('0x1a')](_0x21c55e['query']['offset']);}_0x276b61[_0xee8c('0x38')]=qs[_0xee8c('0x39')](_0x21c55e[_0xee8c('0x30')][_0xee8c('0x39')]);_0x276b61[_0xee8c('0x3a')]=qs[_0xee8c('0x31')](_[_0xee8c('0x3b')](_0x21c55e[_0xee8c('0x30')],_0x234faa[_0xee8c('0x31')]),_0x530ad1);if(_0x21c55e[_0xee8c('0x30')][_0xee8c('0x3c')]){_0x276b61[_0xee8c('0x3a')]=_['merge'](_0x276b61['where'],{'$or':_[_0xee8c('0x2e')](_0x530ad1,function(_0x3e18d5){if(_0x3e18d5['type']!==_0xee8c('0x3d')){var _0xd2657a={};_0xd2657a[_0x3e18d5['name']]={'$like':'%'+_0x21c55e[_0xee8c('0x30')][_0xee8c('0x3c')]+'%'};return _0xd2657a;}})});}_0x276b61=_[_0xee8c('0x3e')]({},_0x276b61,_0x21c55e[_0xee8c('0x3f')]);var _0x12f780={'where':_0x276b61[_0xee8c('0x3a')]};return db[_0xee8c('0x28')][_0xee8c('0x1d')](_0x12f780)[_0xee8c('0x21')](function(_0x359e15){_0x22632c[_0xee8c('0x1d')]=_0x359e15;if(_0x21c55e[_0xee8c('0x30')][_0xee8c('0x40')]){_0x276b61[_0xee8c('0x41')]=[{'all':!![]}];}return db[_0xee8c('0x28')]['findAll'](_0x276b61);})['then'](function(_0x328e9e){_0x22632c['rows']=_0x328e9e;return _0x22632c;})[_0xee8c('0x21')](respondWithFilteredResult(_0x28f110,_0x276b61))['catch'](handleError(_0x28f110,null));};exports[_0xee8c('0x42')]=function(_0x10bb54,_0x322d70){var _0x434bc0={'raw':![],'where':{'id':_0x10bb54[_0xee8c('0x43')]['id']}},_0x49c51c={};_0x49c51c[_0xee8c('0x2c')]=_[_0xee8c('0x44')](db[_0xee8c('0x28')][_0xee8c('0x29')]);_0x49c51c['query']=_[_0xee8c('0x44')](_0x10bb54['query']);_0x49c51c['filters']=_[_0xee8c('0x32')](_0x49c51c[_0xee8c('0x2c')],_0x49c51c[_0xee8c('0x30')]);_0x434bc0[_0xee8c('0x34')]=_[_0xee8c('0x32')](_0x49c51c[_0xee8c('0x2c')],qs[_0xee8c('0x33')](_0x10bb54[_0xee8c('0x30')][_0xee8c('0x33')]));_0x434bc0[_0xee8c('0x34')]=_0x434bc0[_0xee8c('0x34')][_0xee8c('0x35')]?_0x434bc0[_0xee8c('0x34')]:_0x49c51c['model'];if(_0x10bb54[_0xee8c('0x30')][_0xee8c('0x40')]){_0x434bc0[_0xee8c('0x41')]=[{'all':!![]}];}_0x434bc0=_[_0xee8c('0x3e')]({},_0x434bc0,_0x10bb54[_0xee8c('0x3f')]);return db[_0xee8c('0x28')][_0xee8c('0x45')](_0x434bc0)[_0xee8c('0x21')](handleEntityNotFound(_0x322d70,null))[_0xee8c('0x21')](respondWithResult(_0x322d70,null))[_0xee8c('0x46')](handleError(_0x322d70,null));};exports['create']=function(_0x3f9b99,_0x34d0a0){return db[_0xee8c('0x28')][_0xee8c('0x47')](_0x3f9b99[_0xee8c('0x48')],{})[_0xee8c('0x21')](respondWithResult(_0x34d0a0,0xc9))[_0xee8c('0x46')](handleError(_0x34d0a0,null));};exports[_0xee8c('0x20')]=function(_0x269b1d,_0x59ecc3){if(_0x269b1d[_0xee8c('0x48')]['id']){delete _0x269b1d[_0xee8c('0x48')]['id'];}return db[_0xee8c('0x28')][_0xee8c('0x45')]({'where':{'id':_0x269b1d[_0xee8c('0x43')]['id']}})['then'](handleEntityNotFound(_0x59ecc3,null))[_0xee8c('0x21')](saveUpdates(_0x269b1d['body'],null))[_0xee8c('0x21')](respondWithResult(_0x59ecc3,null))[_0xee8c('0x46')](handleError(_0x59ecc3,null));};exports[_0xee8c('0x49')]=function(_0xb6f3a6,_0x2cc4f0){return db['VoiceRecording'][_0xee8c('0x49')]()[_0xee8c('0x21')](respondWithResult(_0x2cc4f0,null))['catch'](handleError(_0x2cc4f0,null));};exports[_0xee8c('0x4a')]=function(_0x47b33f,_0x150f39,_0x3ce7b6){var _0x34682a=require('../../components/encryptor');var _0x3416b2=![];var _0x2a03de={};if(_0x47b33f[_0xee8c('0x30')]['type']&&_0x47b33f[_0xee8c('0x30')][_0xee8c('0x4b')]===_0xee8c('0x4c')){_0x2a03de['uniqueid']=_0x47b33f['params']['id'];}else{_0x2a03de['id']=_0x47b33f['params']['id'];}return db[_0xee8c('0x28')]['find']({'where':_0x2a03de,'attributes':['id',_0xee8c('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x150f39,null))['then'](function(_0x351946){if(_0x351946){var _0x2d7143=_0x351946[_0xee8c('0x4d')];var _0x1484cc=util[_0xee8c('0x2f')](_0xee8c('0x4e'),_0x2d7143);if(fs[_0xee8c('0x4f')](_0x1484cc)){_0x3416b2=!![];return _0x34682a[_0xee8c('0x50')](_0x1484cc,_0x2d7143,config['secrets']['recording'])[_0xee8c('0x21')](function(){return _0x351946;});}return _0x351946;}})[_0xee8c('0x21')](function(_0x13732d){if(_0x13732d){var _0x2b31c8=_0x13732d[_0xee8c('0x4d')];if(!fs[_0xee8c('0x4f')](_0x2b31c8)){throw new db[(_0xee8c('0x51'))][(_0xee8c('0x52'))](_0xee8c('0x53'));}if(_0x13732d[_0xee8c('0x54')]){return _0x150f39[_0xee8c('0x4a')](_0x2b31c8,_0x13732d['filename']+path[_0xee8c('0x55')](_0x2b31c8),function(){if(_0x3416b2){fs[_0xee8c('0x56')](_0x2b31c8);}});}else{return _0x150f39[_0xee8c('0x4a')](_0x2b31c8,function(_0x59bd3a){if(_0x3416b2){fs[_0xee8c('0x56')](_0x2b31c8);}});}}})['catch'](function(_0x2ca68e){if(_0x2ca68e['message']===_0xee8c('0x53')){_0x150f39[_0xee8c('0x19')](0x194)[_0xee8c('0x26')](_0xee8c('0x57'));}else{return handleError(_0x150f39,null);}});};exports[_0xee8c('0x58')]=function(_0x3e3282,_0x107c72,_0x1ad73f){var _0x1e38cc=require('../../components/encryptor');var _0x16e9e5=![];var _0x304da4={'$and':[db['sequelize'][_0xee8c('0x3a')](db[_0xee8c('0x59')]['fn'](_0xee8c('0x5a'),db['sequelize'][_0xee8c('0x5b')](_0xee8c('0x4c'))),_0x3e3282[_0xee8c('0x30')]['token'])]};if(_0x3e3282[_0xee8c('0x30')][_0xee8c('0x4b')]&&_0x3e3282[_0xee8c('0x30')][_0xee8c('0x4b')]==='uniqueid'){_0x304da4['$and'][_0xee8c('0x5c')]({'uniqueid':_0x3e3282[_0xee8c('0x43')]['id']});}else{_0x304da4[_0xee8c('0x5d')][_0xee8c('0x5c')]({'id':_0x3e3282[_0xee8c('0x43')]['id']});}return db[_0xee8c('0x28')]['find']({'where':_0x304da4,'attributes':['id',_0xee8c('0x4d')],'raw':!![]})[_0xee8c('0x21')](handleEntityNotFound(_0x107c72,null))[_0xee8c('0x21')](function(_0x4053eb){if(_0x4053eb){var _0x4eeb07=util['format'](_0xee8c('0x4e'),_0x4053eb[_0xee8c('0x4d')]);if(fs[_0xee8c('0x4f')](_0x4eeb07)){_0x16e9e5=!![];return _0x1e38cc[_0xee8c('0x50')](_0x4eeb07,_0x4053eb[_0xee8c('0x4d')],config[_0xee8c('0x5e')][_0xee8c('0x5f')])[_0xee8c('0x21')](function(){return _0x4053eb;});}return _0x4053eb;}})['then'](function(_0x4fc68a){if(_0x4fc68a){if(!fs[_0xee8c('0x4f')](_0x4fc68a[_0xee8c('0x4d')])){throw new db[(_0xee8c('0x51'))][(_0xee8c('0x52'))](_0xee8c('0x53'));}if(_0x4fc68a[_0xee8c('0x54')]){return _0x107c72[_0xee8c('0x4a')](_0x4fc68a['value'],_0x4fc68a[_0xee8c('0x54')]+path['extname'](_0x4fc68a[_0xee8c('0x4d')]),function(){if(_0x16e9e5){fs[_0xee8c('0x56')](_0x4fc68a[_0xee8c('0x4d')]);}});}else{return _0x107c72[_0xee8c('0x4a')](_0x4fc68a['value'],function(_0x7cb8c7){if(_0x16e9e5){fs['unlink'](_0x4fc68a[_0xee8c('0x4d')]);}});}}})[_0xee8c('0x46')](handleError(_0x107c72,null));};exports[_0xee8c('0x60')]=function(_0x42c392,_0x284780){return db[_0xee8c('0x28')][_0xee8c('0x45')]({'where':{'id':_0x42c392[_0xee8c('0x43')]['id']}})[_0xee8c('0x21')](function(_0x55db82){if(_[_0xee8c('0x61')](_0x55db82)){throw new ReferenceError('Entity\x20not\x20found');}return _0x55db82;})[_0xee8c('0x21')](function(_0x11b422){var _0x490f2a=_0x11b422['value'];logger[_0xee8c('0x62')](_0xee8c('0x63'),_0x490f2a);if(!_[_0xee8c('0x61')](_0x11b422[_0xee8c('0x4d')])&&fs[_0xee8c('0x4f')](_0x490f2a)){logger[_0xee8c('0x62')]('File:\x20\x22'+_0x490f2a+_0xee8c('0x64'));fs['unlinkSync'](_0x490f2a);}_0x490f2a=_0x490f2a+_0xee8c('0x65');if(!_[_0xee8c('0x61')](_0x11b422['value'])&&fs['existsSync'](_0x490f2a)){logger[_0xee8c('0x62')]('File:\x20\x22'+_0x490f2a+_0xee8c('0x64'));fs['unlinkSync'](_0x490f2a);}return _0x11b422;})['then'](function(_0x41daee){if(!_0x41daee)throw new InternalError();return _0x41daee[_0xee8c('0x60')]();})[_0xee8c('0x21')](function(){_0x284780['status'](0xcc)[_0xee8c('0x22')]();})['catch'](handleError(_0x284780,null));};function getBucketslist(_0x467b54,_0x3478cb,_0x5bb202){return new Promise(function(_0x2e8a15,_0x262f63){var _0x27c230=new AWS['S3']({'accessKeyId':_0x3478cb,'secretAccessKey':_0x467b54,'region':_0x5bb202});_0x27c230[_0xee8c('0x66')]({},function(_0xa246bb,_0x15246b){if(_0xa246bb){return _0x262f63(_0xa246bb);}else{return _0x2e8a15(_0x15246b);}});});}function createBucket(_0x58df2d,_0x59c2cc,_0x310890,_0x4f2493){return new Promise(function(_0x38de7f,_0x334a09){var _0x1653ce=new AWS['S3']({'accessKeyId':_0x59c2cc,'secretAccessKey':_0x58df2d,'region':_0x310890});_0x1653ce['createBucket']({'Bucket':_0x4f2493},function(_0x250ad8,_0x29230f){if(_0x250ad8){return _0x334a09(_0x250ad8);}else{return _0x38de7f(_0x29230f);}});});}function uploadFile(_0xd2fc2c,_0x46e5df,_0x168a9f,_0x5123a7,_0x56ce48,_0x218b92){return new Promise(function(_0x2b9454,_0x2f37dd){var _0x1f2f11=new AWS['S3']({'accessKeyId':_0x46e5df,'secretAccessKey':_0xd2fc2c,'region':_0x168a9f});_0x1f2f11[_0xee8c('0x67')]({'Bucket':_0x5123a7,'Key':_0x56ce48,'Body':_0x218b92},function(_0x4d19e7,_0x4d3f21){if(_0x4d19e7){return _0x2f37dd(_0x4d19e7);}else{return _0x2b9454(_0x4d3f21);}});});}function startTranscribe(_0x3f4874,_0x1e1268,_0x85ac1d,_0x322d09,_0x31a46e,_0x37ceb4){return new Promise(function(_0x325fae,_0x3a1ead){var _0x2a65d7=new AWS['TranscribeService']({'accessKeyId':_0x1e1268,'secretAccessKey':_0x3f4874,'region':_0x85ac1d});_0x2a65d7[_0xee8c('0x68')]({'TranscriptionJobName':_0x322d09,'LanguageCode':_0x31a46e,'Media':{'MediaFileUri':_0x37ceb4}},function(_0x142785,_0x31117c){if(_0x142785){return _0x3a1ead(_0x142785);}else{return _0x325fae(_0x31117c);}});});}function transcribe(_0x14135d,_0x45cd67,_0x23ff49,_0x42cb41,_0x35f5ba,_0x122768,_0x2db519){return new Promise(function(_0x2612c8,_0xc2fcf5){var _0x470258={};logger[_0xee8c('0x62')](util['format'](_0xee8c('0x69'),_0x14135d,_0x35f5ba));return uploadFile(_0x45cd67,_0x23ff49,_0x42cb41,_0x35f5ba,path['basename'](_0x122768),fs[_0xee8c('0x6a')](_0x122768))[_0xee8c('0x21')](function(_0x51ad61){logger[_0xee8c('0x62')](util[_0xee8c('0x2f')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x14135d,_0x35f5ba,_0x51ad61[_0xee8c('0x6b')]));_0x470258['bucket']=_0x51ad61[_0xee8c('0x6c')];_0x470258['location']=_0x51ad61[_0xee8c('0x6b')];logger['info'](util[_0xee8c('0x2f')](_0xee8c('0x6d'),_0x14135d));return startTranscribe(_0x45cd67,_0x23ff49,_0x42cb41,uuidv4(),_0x2db519,_0x51ad61[_0xee8c('0x6b')]);})[_0xee8c('0x21')](function(_0x3fe9f8){logger[_0xee8c('0x62')](util[_0xee8c('0x2f')](_0xee8c('0x6e'),_0x14135d,_0x3fe9f8['TranscriptionJob'][_0xee8c('0x6f')]));_0x470258['transcribeName']=_0x3fe9f8[_0xee8c('0x70')]['TranscriptionJobName'];_0x470258['transcribeStatus']=_0x3fe9f8[_0xee8c('0x70')][_0xee8c('0x71')];return _0x2612c8(_0x470258);})[_0xee8c('0x46')](function(_0x4d4d26){return _0xc2fcf5(_0x4d4d26);});});}exports['runTranscribe']=function(_0x3bc43d,_0x2c3f0c,_0x12cbf2){var _0x4c5f01;var _0x333332;var _0x424e08;var _0x2c2049=require('../../components/encryptor');return db[_0xee8c('0x28')][_0xee8c('0x72')]({'where':{'id':_0x3bc43d[_0xee8c('0x43')]['id']}})['then'](function(_0xb36775){if(_0xb36775){var _0x2d7d1b=util[_0xee8c('0x2f')](_0xee8c('0x4e'),_0xb36775[_0xee8c('0x4d')]);if(fs[_0xee8c('0x4f')](_0x2d7d1b)){cypher=!![];return _0x2c2049[_0xee8c('0x50')](_0x2d7d1b,_0xb36775[_0xee8c('0x4d')],config[_0xee8c('0x5e')][_0xee8c('0x5f')])['then'](function(){return _0xb36775;});}return _0xb36775;}})[_0xee8c('0x21')](function(_0x4d8947){if(!_0x4d8947){throw new db[(_0xee8c('0x51'))][(_0xee8c('0x52'))](_0xee8c('0x73'));}_0x333332=_0x4d8947;return db[_0xee8c('0x74')][_0xee8c('0x72')]({'where':{'id':0x1}});})[_0xee8c('0x21')](handleEntityNotFound(_0x2c3f0c,null))[_0xee8c('0x21')](function(_0x31e060){if(_0x31e060){_0x4c5f01=_0x31e060;if(!_0x4c5f01[_0xee8c('0x75')]||!_0x4c5f01[_0xee8c('0x76')]||!_0x4c5f01[_0xee8c('0x77')]||!_0x4c5f01[_0xee8c('0x78')]||!_0x4c5f01[_0xee8c('0x79')]){throw new db['Sequelize'][(_0xee8c('0x52'))](_0xee8c('0x7a'));}if(_0x3bc43d[_0xee8c('0x48')][_0xee8c('0x7b')]&&(!_0x4c5f01['sentiment']||!_0x4c5f01[_0xee8c('0x7c')]||!_0x4c5f01[_0xee8c('0x7d')]||!_0x4c5f01[_0xee8c('0x78')]||!_0x4c5f01[_0xee8c('0x79')])){throw new db[(_0xee8c('0x51'))][(_0xee8c('0x52'))](_0xee8c('0x7e'));}return db['CloudProvider'][_0xee8c('0x72')]({'where':{'id':_0x4c5f01[_0xee8c('0x76')]}});}})[_0xee8c('0x21')](function(_0x5d1256){if(!_0x5d1256){throw new db['Sequelize']['ValidationError'](_0xee8c('0x7f'));}if(!_0x5d1256[_0xee8c('0x80')]||!_0x5d1256[_0xee8c('0x81')]){throw new db[(_0xee8c('0x51'))]['ValidationError'](_0xee8c('0x82'));}_0x424e08=_0x5d1256;return getBucketslist(_0x424e08[_0xee8c('0x80')],_0x424e08[_0xee8c('0x81')],_0x4c5f01['transcribeRegion']);})[_0xee8c('0x21')](function(_0x2396f4){if(_0x2396f4&&_0x2396f4[_0xee8c('0x83')]){var _0x2e5637=_[_0xee8c('0x45')](_0x2396f4['Buckets'],function(_0x1fde7c){return _0x1fde7c[_0xee8c('0x84')]===_0x4c5f01[_0xee8c('0x79')];});if(!_0x2e5637){logger[_0xee8c('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3bc43d[_0xee8c('0x43')]['id'],_0x4c5f01[_0xee8c('0x79')]));return createBucket(_0x424e08[_0xee8c('0x80')],_0x424e08['data2'],_0x4c5f01[_0xee8c('0x77')],_0x4c5f01['bucket']);}logger[_0xee8c('0x62')](util['format'](_0xee8c('0x85'),_0x3bc43d[_0xee8c('0x43')]['id'],_0x4c5f01['bucket']));return;}})[_0xee8c('0x21')](function(_0x4e57c0){if(_0x333332[_0xee8c('0x86')]===_0xee8c('0x87')){return transcribe(_0x3bc43d[_0xee8c('0x43')]['id'],_0x424e08[_0xee8c('0x80')],_0x424e08[_0xee8c('0x81')],_0x4c5f01[_0xee8c('0x77')],_0x4c5f01['bucket'],_0x333332['value'],_0x4c5f01[_0xee8c('0x78')]);}else{logger['info'](util[_0xee8c('0x2f')](_0xee8c('0x88'),_0x3bc43d[_0xee8c('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xee8c('0x21')](function(_0xb1610e){if(_0xb1610e){_0xb1610e[_0xee8c('0x89')]=_0x3bc43d[_0xee8c('0x48')][_0xee8c('0x7b')];return _0x333332['updateAttributes'](_0xb1610e);}})[_0xee8c('0x21')](respondWithResult(_0x2c3f0c,null))[_0xee8c('0x46')](handleError(_0x2c3f0c,null));};function writeFile(_0x4a4cbe,_0x17b5a2){return new Promise(function(_0x55323a,_0x3bfa5c){fs['writeFile'](_0x17b5a2,_0x4a4cbe,function(_0x12c481,_0x4c1038){if(_0x12c481){return _0x3bfa5c(_0x12c481);}else{return _0x55323a(_0x4c1038);}});});}exports['downloadTranscribe']=function(_0x529fc0,_0x2cab1f,_0x2311a3){return db[_0xee8c('0x28')][_0xee8c('0x72')]({'where':{'id':_0x529fc0[_0xee8c('0x43')]['id']}})[_0xee8c('0x21')](handleEntityNotFound(_0x2cab1f))[_0xee8c('0x21')](function(_0x5b12ae){if(_0x5b12ae&&_0x5b12ae[_0xee8c('0x8a')]){var _0x4b1bb3=_0x5b12ae[_0xee8c('0x8a')];var _0x5ee708=config['root']+_0xee8c('0x8b')+_0x5b12ae['id']+'.txt';if(fs[_0xee8c('0x4f')](_0x5ee708)){return _0x5ee708;}return writeFile(_0x4b1bb3,_0x5ee708)[_0xee8c('0x21')](function(){return _0x5ee708;});}else{throw new db[(_0xee8c('0x51'))]['ValidationError'](_0xee8c('0x8c'));}})[_0xee8c('0x21')](function(_0x251285){return _0x2cab1f[_0xee8c('0x4a')](_0x251285);})[_0xee8c('0x46')](handleError(_0x2cab1f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5be87bb..33efc1c 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 _0xd770=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3a8d33,_0x1e6952){var _0x18f251=function(_0x45ae60){while(--_0x45ae60){_0x3a8d33['push'](_0x3a8d33['shift']());}};_0x18f251(++_0x1e6952);}(_0xd770,0x145));var _0x0d77=function(_0x31ddd7,_0x312f4b){_0x31ddd7=_0x31ddd7-0x0;var _0x5d56b4=_0xd770[_0x31ddd7];return _0x5d56b4;};'use strict';var _=require(_0x0d77('0x0'));var util=require(_0x0d77('0x1'));var logger=require(_0x0d77('0x2'))('api');var moment=require(_0x0d77('0x3'));var BPromise=require(_0x0d77('0x4'));var rp=require(_0x0d77('0x5'));var fs=require('fs');var path=require(_0x0d77('0x6'));var rimraf=require('rimraf');var config=require(_0x0d77('0x7'));var attributes=require(_0x0d77('0x8'));module['exports']=function(_0x1eef14,_0x28fb34){return _0x1eef14[_0x0d77('0x9')](_0x0d77('0xa'),attributes,{'tableName':_0x0d77('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0d77('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a5b=['exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x1e94ee,_0x28326a){var _0x386b8e=function(_0x561f69){while(--_0x561f69){_0x1e94ee['push'](_0x1e94ee['shift']());}};_0x386b8e(++_0x28326a);}(_0x7a5b,0x1d3));var _0xb7a5=function(_0x45adb4,_0x2abb06){_0x45adb4=_0x45adb4-0x0;var _0x137296=_0x7a5b[_0x45adb4];return _0x137296;};'use strict';var _=require(_0xb7a5('0x0'));var util=require(_0xb7a5('0x1'));var logger=require('../../config/logger')(_0xb7a5('0x2'));var moment=require(_0xb7a5('0x3'));var BPromise=require(_0xb7a5('0x4'));var rp=require(_0xb7a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7a5('0x6'));var config=require(_0xb7a5('0x7'));var attributes=require(_0xb7a5('0x8'));module[_0xb7a5('0x9')]=function(_0x4eadcc,_0x166f5f){return _0x4eadcc[_0xb7a5('0xa')](_0xb7a5('0xb'),attributes,{'tableName':_0xb7a5('0xc'),'paranoid':![],'indexes':[{'name':_0xb7a5('0xd'),'fields':[_0xb7a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d270ecd..f66a52b 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 _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x507ec1,_0x11028c){var _0xceb8e=function(_0x1390d7){while(--_0x1390d7){_0x507ec1['push'](_0x507ec1['shift']());}};_0xceb8e(++_0x11028c);}(_0x955f,0x1eb));var _0xf955=function(_0x5b35b1,_0x3d77f0){_0x5b35b1=_0x5b35b1-0x0;var _0xfa9735=_0x955f[_0x5b35b1];return _0xfa9735;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file +var _0x7bd0=['callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceRecording','update','body','options','raw','attributes','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0x7bd0,0x111));var _0x07bd=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x7bd0[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('VoiceRecording,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['UpdateVoiceRecording']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')](_0x3f9f0b[_0x07bd('0x1b')],{'raw':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['where']||null:null,'attributes':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1c')]?_0x3f9f0b[_0x07bd('0x1c')]['limit']||null:null})['then'](function(_0xbb7117){logger['info'](_0x07bd('0x1f'),_0x3f9f0b);logger['debug']('UpdateVoiceRecording',_0x3f9f0b,JSON[_0x07bd('0x13')](_0xbb7117));_0x4948f4(_0xbb7117);})[_0x07bd('0x18')](function(_0xf3b23c){logger[_0x07bd('0x14')](_0x07bd('0x1f'),_0xf3b23c[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0xf3b23c[_0x07bd('0x16')]));});});};exports[_0x07bd('0x20')]=function(_0x3db9d0){var _0x2a7202=this;return new Promise(function(_0x12ce26,_0x1c1fda){var _0x571dab=require('../../components/encryptor');var _0x5184dc;return db[_0x07bd('0x21')][_0x07bd('0x22')]({'attributes':['id',_0x07bd('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1a3aa9){_0x5184dc=_0x1a3aa9;return db[_0x07bd('0x19')][_0x07bd('0x24')](_0x3db9d0[_0x07bd('0x1b')]);})[_0x07bd('0xe')](function(_0x13bf6b){if(_0x5184dc['callRecordingEncryption']&&fs[_0x07bd('0x25')](_0x13bf6b[_0x07bd('0x26')])){var _0x4182b9=util[_0x07bd('0x27')](_0x07bd('0x28'),_0x13bf6b[_0x07bd('0x26')]);return _0x571dab[_0x07bd('0x29')](_0x13bf6b[_0x07bd('0x26')],_0x4182b9,config['secrets']['recording'])[_0x07bd('0xe')](function(){fs[_0x07bd('0x2a')](_0x13bf6b[_0x07bd('0x26')]);logger['info'](_0x07bd('0x2b'));return _0x13bf6b;});}return _0x13bf6b;})[_0x07bd('0xe')](function(_0x208aca){logger['info']('CreateVoiceRecording',_0x3db9d0);logger[_0x07bd('0x11')](_0x07bd('0x20'),_0x3db9d0,JSON[_0x07bd('0x13')](_0x208aca));_0x12ce26(_0x208aca);})[_0x07bd('0x18')](function(_0x5f29c5){logger[_0x07bd('0x14')](_0x07bd('0x20'),_0x5f29c5[_0x07bd('0x16')],_0x3db9d0);_0x1c1fda(_0x2a7202['error'](0x1f4,_0x5f29c5[_0x07bd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ab24b3b..5ac282c 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 _0x6037=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x32e688,_0x67ff0b){var _0x17fbe9=function(_0x4a4fb2){while(--_0x4a4fb2){_0x32e688['push'](_0x32e688['shift']());}};_0x17fbe9(++_0x67ff0b);}(_0x6037,0xa9));var _0x7603=function(_0x2e3eee,_0x16f103){_0x2e3eee=_0x2e3eee-0x0;var _0x2cc876=_0x6037[_0x2e3eee];return _0x2cc876;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var timeout=require(_0x7603('0x3'));var express=require(_0x7603('0x4'));var router=express[_0x7603('0x5')]();var fs_extra=require(_0x7603('0x6'));var auth=require(_0x7603('0x7'));var interaction=require(_0x7603('0x8'));var config=require(_0x7603('0x9'));var controller=require(_0x7603('0xa'));router[_0x7603('0xb')]('/',auth[_0x7603('0xc')](),controller[_0x7603('0xd')]);router[_0x7603('0xb')](_0x7603('0xe'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7603('0xf'),auth[_0x7603('0xc')](),controller['show']);router[_0x7603('0x10')]('/',auth['isAuthenticated'](),controller[_0x7603('0x11')]);router[_0x7603('0x12')](_0x7603('0xf'),auth[_0x7603('0xc')](),controller[_0x7603('0x13')]);router[_0x7603('0x14')](_0x7603('0xf'),auth[_0x7603('0xc')](),controller[_0x7603('0x15')]);module[_0x7603('0x16')]=router; \ No newline at end of file +var _0x749c=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/:id'];(function(_0x7821a8,_0x42bc83){var _0x3de84a=function(_0x1c42b1){while(--_0x1c42b1){_0x7821a8['push'](_0x7821a8['shift']());}};_0x3de84a(++_0x42bc83);}(_0x749c,0x11e));var _0xc749=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x749c[_0x3ec1da];return _0x472358;};'use strict';var multer=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var path=require(_0xc749('0x2'));var timeout=require(_0xc749('0x3'));var express=require(_0xc749('0x4'));var router=express[_0xc749('0x5')]();var fs_extra=require(_0xc749('0x6'));var auth=require(_0xc749('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc749('0x8'));var controller=require(_0xc749('0x9'));router['get']('/',auth[_0xc749('0xa')](),controller[_0xc749('0xb')]);router[_0xc749('0xc')]('/describe',auth[_0xc749('0xa')](),controller['describe']);router[_0xc749('0xc')](_0xc749('0xd'),auth[_0xc749('0xa')](),controller['show']);router[_0xc749('0xe')]('/',auth[_0xc749('0xa')](),controller['create']);router[_0xc749('0xf')](_0xc749('0xd'),auth[_0xc749('0xa')](),controller[_0xc749('0x10')]);router[_0xc749('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc749('0x12')]);module[_0xc749('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5a65cd8..34fe467 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 _0x5ee7=['STRING','ENUM','Yes','sequelize','moment','exports','blind'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x5ee7,0xdc));var _0x75ee=function(_0xb35ddf,_0x5af237){_0xb35ddf=_0xb35ddf-0x0;var _0x24db0f=_0x5ee7[_0xb35ddf];return _0x24db0f;};'use strict';var Sequelize=require(_0x75ee('0x0'));var moment=require(_0x75ee('0x1'));module[_0x75ee('0x2')]={'type':{'type':Sequelize['ENUM'](_0x75ee('0x3'),'attended')},'result':{'type':Sequelize[_0x75ee('0x4')]},'transfererchannel':{'type':Sequelize[_0x75ee('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x75ee('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x75ee('0x4')]},'transferercontext':{'type':Sequelize[_0x75ee('0x4')]},'transfererexten':{'type':Sequelize[_0x75ee('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x75ee('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x75ee('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x75ee('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x75ee('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x75ee('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x75ee('0x4')]},'transfereecontext':{'type':Sequelize[_0x75ee('0x4')]},'transfereeexten':{'type':Sequelize[_0x75ee('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x75ee('0x4')]},'isexternal':{'type':Sequelize[_0x75ee('0x5')](_0x75ee('0x6'),'No')},'context':{'type':Sequelize[_0x75ee('0x4')]},'extension':{'type':Sequelize[_0x75ee('0x4')]}}; \ No newline at end of file +var _0xb5ab=['blind','attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5ab,0x107));var _0xbb5a=function(_0x1f7e8a,_0x21f5a0){_0x1f7e8a=_0x1f7e8a-0x0;var _0x2d7ac0=_0xb5ab[_0x1f7e8a];return _0x2d7ac0;};'use strict';var Sequelize=require(_0xbb5a('0x0'));var moment=require('moment');module[_0xbb5a('0x1')]={'type':{'type':Sequelize[_0xbb5a('0x2')](_0xbb5a('0x3'),_0xbb5a('0x4'))},'result':{'type':Sequelize[_0xbb5a('0x5')]},'transfererchannel':{'type':Sequelize[_0xbb5a('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xbb5a('0x5')]},'transferercalleridname':{'type':Sequelize[_0xbb5a('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xbb5a('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xbb5a('0x5')]},'transferercontext':{'type':Sequelize[_0xbb5a('0x5')]},'transfererexten':{'type':Sequelize[_0xbb5a('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xbb5a('0x5')]},'transfereechannel':{'type':Sequelize[_0xbb5a('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xbb5a('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xbb5a('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xbb5a('0x5')]},'transfereecontext':{'type':Sequelize[_0xbb5a('0x5')]},'transfereeexten':{'type':Sequelize[_0xbb5a('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xbb5a('0x5')]},'isexternal':{'type':Sequelize[_0xbb5a('0x2')](_0xbb5a('0x6'),'No')},'context':{'type':Sequelize[_0xbb5a('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4597810..0eafcb0 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 _0x6b97=['json','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','destroy','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x442974,_0x3fff39){var _0x292c9c=function(_0x33eda1){while(--_0x33eda1){_0x442974['push'](_0x442974['shift']());}};_0x292c9c(++_0x3fff39);}(_0x6b97,0x159));var _0x76b9=function(_0x281c3d,_0x39e39e){_0x281c3d=_0x281c3d-0x0;var _0x1e008d=_0x6b97[_0x281c3d];return _0x1e008d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76b9('0x0'));var zipdir=require(_0x76b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76b9('0x2'));var BPromise=require(_0x76b9('0x3'));var Mustache=require(_0x76b9('0x4'));var util=require(_0x76b9('0x5'));var path=require(_0x76b9('0x6'));var sox=require(_0x76b9('0x7'));var csv=require(_0x76b9('0x8'));var ejs=require(_0x76b9('0x9'));var fs=require('fs');var fs_extra=require(_0x76b9('0xa'));var _=require(_0x76b9('0xb'));var squel=require('squel');var crypto=require(_0x76b9('0xc'));var jsforce=require(_0x76b9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x76b9('0xe'));var Papa=require('papaparse');var Redis=require(_0x76b9('0xf'));var authService=require(_0x76b9('0x10'));var qs=require(_0x76b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76b9('0x12'));var logger=require(_0x76b9('0x13'))('api');var utils=require(_0x76b9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x76b9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526731,_0x31f5cc){_0x31f5cc=_0x31f5cc||0xcc;return function(_0x1f61ed){if(_0x1f61ed){return _0x526731[_0x76b9('0x16')](_0x31f5cc);}return _0x526731[_0x76b9('0x17')](_0x31f5cc)[_0x76b9('0x18')]();};}function respondWithResult(_0x20d3e2,_0x32e1ac){_0x32e1ac=_0x32e1ac||0xc8;return function(_0x3587a7){if(_0x3587a7){return _0x20d3e2[_0x76b9('0x17')](_0x32e1ac)['json'](_0x3587a7);}};}function respondWithFilteredResult(_0x307db5,_0x3fa966){return function(_0xb05db3){if(_0xb05db3){var _0x4655d6=typeof _0x3fa966[_0x76b9('0x19')]===_0x76b9('0x1a')&&typeof _0x3fa966[_0x76b9('0x1b')]===_0x76b9('0x1a');var _0x191127=_0xb05db3[_0x76b9('0x1c')];var _0x39cd65=_0x4655d6?0x0:_0x3fa966[_0x76b9('0x19')];var _0x5c2774=_0x4655d6?_0xb05db3[_0x76b9('0x1c')]:_0x3fa966[_0x76b9('0x19')]+_0x3fa966[_0x76b9('0x1b')];var _0x4c57ee;if(_0x5c2774>=_0x191127){_0x5c2774=_0x191127;_0x4c57ee=0xc8;}else{_0x4c57ee=0xce;}_0x307db5[_0x76b9('0x17')](_0x4c57ee);return _0x307db5['set'](_0x76b9('0x1d'),_0x39cd65+'-'+_0x5c2774+'/'+_0x191127)[_0x76b9('0x1e')](_0xb05db3);}return null;};}function patchUpdates(_0xe4dd11){return function(_0x385889){try{jsonpatch[_0x76b9('0x1f')](_0x385889,_0xe4dd11,!![]);}catch(_0x422a36){return BPromise[_0x76b9('0x20')](_0x422a36);}return _0x385889[_0x76b9('0x21')]();};}function saveUpdates(_0x48b672,_0x367f63){return function(_0x579485){if(_0x579485){return _0x579485[_0x76b9('0x22')](_0x48b672)[_0x76b9('0x23')](function(_0x217784){return _0x217784;});}return null;};}function removeEntity(_0x28f8eb,_0x36b93c){return function(_0xa95017){if(_0xa95017){return _0xa95017['destroy']()['then'](function(){_0x28f8eb[_0x76b9('0x17')](0xcc)[_0x76b9('0x18')]();});}};}function handleEntityNotFound(_0x1f3660,_0x5e2d0e){return function(_0x595428){if(!_0x595428){_0x1f3660[_0x76b9('0x16')](0x194);}return _0x595428;};}function handleError(_0x215577,_0x13460b){_0x13460b=_0x13460b||0x1f4;return function(_0x1f0577){logger[_0x76b9('0x24')](_0x1f0577[_0x76b9('0x25')]);if(_0x1f0577[_0x76b9('0x26')]){delete _0x1f0577['name'];}_0x215577[_0x76b9('0x17')](_0x13460b)[_0x76b9('0x27')](_0x1f0577);};}exports[_0x76b9('0x28')]=function(_0x3ec23b,_0x2fbb54){var _0xc50619={},_0xfda5ec={},_0x1aee54={'count':0x0,'rows':[]};var _0x8f3282=_[_0x76b9('0x29')](db[_0x76b9('0x2a')]['rawAttributes'],function(_0x2b8899){return{'name':_0x2b8899[_0x76b9('0x2b')],'type':_0x2b8899[_0x76b9('0x2c')][_0x76b9('0x2d')]};});_0xfda5ec[_0x76b9('0x2e')]=_[_0x76b9('0x29')](_0x8f3282,_0x76b9('0x26'));_0xfda5ec[_0x76b9('0x2f')]=_[_0x76b9('0x30')](_0x3ec23b[_0x76b9('0x2f')]);_0xfda5ec[_0x76b9('0x31')]=_[_0x76b9('0x32')](_0xfda5ec[_0x76b9('0x2e')],_0xfda5ec['query']);_0xc50619[_0x76b9('0x33')]=_[_0x76b9('0x32')](_0xfda5ec[_0x76b9('0x2e')],qs[_0x76b9('0x34')](_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x34')]));_0xc50619['attributes']=_0xc50619[_0x76b9('0x33')]['length']?_0xc50619[_0x76b9('0x33')]:_0xfda5ec[_0x76b9('0x2e')];if(!_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x35')](_0x76b9('0x36'))){_0xc50619[_0x76b9('0x1b')]=qs['limit'](_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x1b')]);_0xc50619[_0x76b9('0x19')]=qs['offset'](_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x19')]);}_0xc50619['order']=qs[_0x76b9('0x37')](_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x37')]);_0xc50619[_0x76b9('0x38')]=qs[_0x76b9('0x31')](_['pick'](_0x3ec23b['query'],_0xfda5ec[_0x76b9('0x31')]),_0x8f3282);if(_0x3ec23b[_0x76b9('0x2f')]['filter']){_0xc50619['where']=_['merge'](_0xc50619[_0x76b9('0x38')],{'$or':_['map'](_0x8f3282,function(_0x39c9f8){if(_0x39c9f8['type']!==_0x76b9('0x39')){var _0x2f83ff={};_0x2f83ff[_0x39c9f8['name']]={'$like':'%'+_0x3ec23b[_0x76b9('0x2f')][_0x76b9('0x3a')]+'%'};return _0x2f83ff;}})});}_0xc50619=_[_0x76b9('0x3b')]({},_0xc50619,_0x3ec23b[_0x76b9('0x3c')]);var _0x1663aa={'where':_0xc50619['where']};return db['VoiceTransferReport'][_0x76b9('0x1c')](_0x1663aa)[_0x76b9('0x23')](function(_0xcc76dc){_0x1aee54[_0x76b9('0x1c')]=_0xcc76dc;if(_0x3ec23b['query'][_0x76b9('0x3d')]){_0xc50619['include']=[{'all':!![]}];}return db[_0x76b9('0x2a')][_0x76b9('0x3e')](_0xc50619);})['then'](function(_0x72df7a){_0x1aee54[_0x76b9('0x3f')]=_0x72df7a;return _0x1aee54;})[_0x76b9('0x23')](respondWithFilteredResult(_0x2fbb54,_0xc50619))[_0x76b9('0x40')](handleError(_0x2fbb54,null));};exports[_0x76b9('0x41')]=function(_0x124a1e,_0x2fef60){var _0x140e7a={'raw':!![],'where':{'id':_0x124a1e[_0x76b9('0x42')]['id']}},_0x1b835d={};_0x1b835d[_0x76b9('0x2e')]=_[_0x76b9('0x30')](db[_0x76b9('0x2a')][_0x76b9('0x43')]);_0x1b835d[_0x76b9('0x2f')]=_['keys'](_0x124a1e[_0x76b9('0x2f')]);_0x1b835d[_0x76b9('0x31')]=_[_0x76b9('0x32')](_0x1b835d['model'],_0x1b835d[_0x76b9('0x2f')]);_0x140e7a[_0x76b9('0x33')]=_[_0x76b9('0x32')](_0x1b835d['model'],qs[_0x76b9('0x34')](_0x124a1e[_0x76b9('0x2f')][_0x76b9('0x34')]));_0x140e7a[_0x76b9('0x33')]=_0x140e7a[_0x76b9('0x33')][_0x76b9('0x44')]?_0x140e7a[_0x76b9('0x33')]:_0x1b835d[_0x76b9('0x2e')];if(_0x124a1e[_0x76b9('0x2f')][_0x76b9('0x3d')]){_0x140e7a[_0x76b9('0x45')]=[{'all':!![]}];}_0x140e7a=_[_0x76b9('0x3b')]({},_0x140e7a,_0x124a1e[_0x76b9('0x3c')]);return db[_0x76b9('0x2a')][_0x76b9('0x46')](_0x140e7a)[_0x76b9('0x23')](handleEntityNotFound(_0x2fef60,null))[_0x76b9('0x23')](respondWithResult(_0x2fef60,null))['catch'](handleError(_0x2fef60,null));};exports[_0x76b9('0x47')]=function(_0x2f6183,_0x2aac25){return db['VoiceTransferReport']['create'](_0x2f6183['body'],{})[_0x76b9('0x23')](respondWithResult(_0x2aac25,0xc9))[_0x76b9('0x40')](handleError(_0x2aac25,null));};exports[_0x76b9('0x22')]=function(_0x1be93b,_0x41de40){if(_0x1be93b[_0x76b9('0x48')]['id']){delete _0x1be93b[_0x76b9('0x48')]['id'];}return db[_0x76b9('0x2a')][_0x76b9('0x46')]({'where':{'id':_0x1be93b[_0x76b9('0x42')]['id']}})[_0x76b9('0x23')](handleEntityNotFound(_0x41de40,null))['then'](saveUpdates(_0x1be93b[_0x76b9('0x48')],null))[_0x76b9('0x23')](respondWithResult(_0x41de40,null))[_0x76b9('0x40')](handleError(_0x41de40,null));};exports[_0x76b9('0x49')]=function(_0x4a44c9,_0x123115){return db[_0x76b9('0x2a')][_0x76b9('0x46')]({'where':{'id':_0x4a44c9[_0x76b9('0x42')]['id']}})[_0x76b9('0x23')](handleEntityNotFound(_0x123115,null))[_0x76b9('0x23')](removeEntity(_0x123115,null))[_0x76b9('0x40')](handleError(_0x123115,null));};exports[_0x76b9('0x4a')]=function(_0x564455,_0x6d23fc){return db[_0x76b9('0x2a')]['describe']()['then'](respondWithResult(_0x6d23fc,null))['catch'](handleError(_0x6d23fc,null));}; \ No newline at end of file +var _0x499c=['find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x499c,0x138));var _0xc499=function(_0x1d3efd,_0x44605b){_0x1d3efd=_0x1d3efd-0x0;var _0x2a758f=_0x499c[_0x1d3efd];return _0x2a758f;};'use strict';var emlformat=require(_0xc499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc499('0x2'));var moment=require(_0xc499('0x3'));var BPromise=require(_0xc499('0x4'));var Mustache=require(_0xc499('0x5'));var util=require(_0xc499('0x6'));var path=require(_0xc499('0x7'));var sox=require(_0xc499('0x8'));var csv=require('to-csv');var ejs=require(_0xc499('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc499('0xa'));var squel=require(_0xc499('0xb'));var crypto=require(_0xc499('0xc'));var jsforce=require(_0xc499('0xd'));var deskjs=require(_0xc499('0xe'));var toCsv=require(_0xc499('0xf'));var querystring=require(_0xc499('0x10'));var Papa=require(_0xc499('0x11'));var Redis=require(_0xc499('0x12'));var authService=require(_0xc499('0x13'));var qs=require(_0xc499('0x14'));var as=require(_0xc499('0x15'));var hardwareService=require(_0xc499('0x16'));var logger=require(_0xc499('0x17'))('api');var utils=require(_0xc499('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc499('0x19'));var db=require(_0xc499('0x1a'))['db'];function respondWithStatusCode(_0x324abe,_0x56bdb7){_0x56bdb7=_0x56bdb7||0xcc;return function(_0x20873){if(_0x20873){return _0x324abe[_0xc499('0x1b')](_0x56bdb7);}return _0x324abe[_0xc499('0x1c')](_0x56bdb7)[_0xc499('0x1d')]();};}function respondWithResult(_0x69089c,_0x1504f9){_0x1504f9=_0x1504f9||0xc8;return function(_0x4b8fd4){if(_0x4b8fd4){return _0x69089c[_0xc499('0x1c')](_0x1504f9)[_0xc499('0x1e')](_0x4b8fd4);}};}function respondWithFilteredResult(_0x41d55e,_0x5f4612){return function(_0x1141f3){if(_0x1141f3){var _0x15d01f=typeof _0x5f4612[_0xc499('0x1f')]===_0xc499('0x20')&&typeof _0x5f4612[_0xc499('0x21')]===_0xc499('0x20');var _0x15dc43=_0x1141f3[_0xc499('0x22')];var _0x314f04=_0x15d01f?0x0:_0x5f4612['offset'];var _0x46de2e=_0x15d01f?_0x1141f3[_0xc499('0x22')]:_0x5f4612[_0xc499('0x1f')]+_0x5f4612[_0xc499('0x21')];var _0x38a2fe;if(_0x46de2e>=_0x15dc43){_0x46de2e=_0x15dc43;_0x38a2fe=0xc8;}else{_0x38a2fe=0xce;}_0x41d55e[_0xc499('0x1c')](_0x38a2fe);return _0x41d55e[_0xc499('0x23')]('Content-Range',_0x314f04+'-'+_0x46de2e+'/'+_0x15dc43)[_0xc499('0x1e')](_0x1141f3);}return null;};}function patchUpdates(_0xbbcb97){return function(_0x5d1189){try{jsonpatch[_0xc499('0x24')](_0x5d1189,_0xbbcb97,!![]);}catch(_0x5ccd42){return BPromise[_0xc499('0x25')](_0x5ccd42);}return _0x5d1189[_0xc499('0x26')]();};}function saveUpdates(_0x535b7f,_0xdf9f7e){return function(_0x5ecb75){if(_0x5ecb75){return _0x5ecb75['update'](_0x535b7f)[_0xc499('0x27')](function(_0x11c418){return _0x11c418;});}return null;};}function removeEntity(_0x1c2d0f,_0x4e2d05){return function(_0x4f45c8){if(_0x4f45c8){return _0x4f45c8[_0xc499('0x28')]()[_0xc499('0x27')](function(){_0x1c2d0f[_0xc499('0x1c')](0xcc)[_0xc499('0x1d')]();});}};}function handleEntityNotFound(_0x596b76,_0x245546){return function(_0x29ae2e){if(!_0x29ae2e){_0x596b76[_0xc499('0x1b')](0x194);}return _0x29ae2e;};}function handleError(_0x420a30,_0xca1f4f){_0xca1f4f=_0xca1f4f||0x1f4;return function(_0x2a1109){logger[_0xc499('0x29')](_0x2a1109[_0xc499('0x2a')]);if(_0x2a1109[_0xc499('0x2b')]){delete _0x2a1109[_0xc499('0x2b')];}_0x420a30['status'](_0xca1f4f)[_0xc499('0x2c')](_0x2a1109);};}exports[_0xc499('0x2d')]=function(_0x52afcb,_0x3a0f1a){var _0x2cd25e={},_0x531178={},_0x284c2c={'count':0x0,'rows':[]};var _0x4c8c53=_[_0xc499('0x2e')](db[_0xc499('0x2f')][_0xc499('0x30')],function(_0x4901c2){return{'name':_0x4901c2['fieldName'],'type':_0x4901c2[_0xc499('0x31')][_0xc499('0x32')]};});_0x531178['model']=_['map'](_0x4c8c53,_0xc499('0x2b'));_0x531178['query']=_[_0xc499('0x33')](_0x52afcb['query']);_0x531178[_0xc499('0x34')]=_[_0xc499('0x35')](_0x531178[_0xc499('0x36')],_0x531178['query']);_0x2cd25e[_0xc499('0x37')]=_[_0xc499('0x35')](_0x531178[_0xc499('0x36')],qs[_0xc499('0x38')](_0x52afcb[_0xc499('0x39')][_0xc499('0x38')]));_0x2cd25e[_0xc499('0x37')]=_0x2cd25e[_0xc499('0x37')][_0xc499('0x3a')]?_0x2cd25e[_0xc499('0x37')]:_0x531178['model'];if(!_0x52afcb[_0xc499('0x39')][_0xc499('0x3b')](_0xc499('0x3c'))){_0x2cd25e[_0xc499('0x21')]=qs[_0xc499('0x21')](_0x52afcb['query'][_0xc499('0x21')]);_0x2cd25e[_0xc499('0x1f')]=qs[_0xc499('0x1f')](_0x52afcb[_0xc499('0x39')][_0xc499('0x1f')]);}_0x2cd25e['order']=qs[_0xc499('0x3d')](_0x52afcb[_0xc499('0x39')][_0xc499('0x3d')]);_0x2cd25e[_0xc499('0x3e')]=qs[_0xc499('0x34')](_[_0xc499('0x3f')](_0x52afcb[_0xc499('0x39')],_0x531178[_0xc499('0x34')]),_0x4c8c53);if(_0x52afcb['query'][_0xc499('0x40')]){_0x2cd25e[_0xc499('0x3e')]=_[_0xc499('0x41')](_0x2cd25e[_0xc499('0x3e')],{'$or':_[_0xc499('0x2e')](_0x4c8c53,function(_0x2f43e0){if(_0x2f43e0[_0xc499('0x31')]!==_0xc499('0x42')){var _0x5f5387={};_0x5f5387[_0x2f43e0[_0xc499('0x2b')]]={'$like':'%'+_0x52afcb[_0xc499('0x39')]['filter']+'%'};return _0x5f5387;}})});}_0x2cd25e=_[_0xc499('0x41')]({},_0x2cd25e,_0x52afcb[_0xc499('0x43')]);var _0x23d6ee={'where':_0x2cd25e[_0xc499('0x3e')]};return db[_0xc499('0x2f')][_0xc499('0x22')](_0x23d6ee)[_0xc499('0x27')](function(_0x10e593){_0x284c2c['count']=_0x10e593;if(_0x52afcb['query']['includeAll']){_0x2cd25e[_0xc499('0x44')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xc499('0x45')](_0x2cd25e);})[_0xc499('0x27')](function(_0x424643){_0x284c2c['rows']=_0x424643;return _0x284c2c;})[_0xc499('0x27')](respondWithFilteredResult(_0x3a0f1a,_0x2cd25e))[_0xc499('0x46')](handleError(_0x3a0f1a,null));};exports[_0xc499('0x47')]=function(_0x23d900,_0xe95fdf){var _0x54bb2e={'raw':!![],'where':{'id':_0x23d900[_0xc499('0x48')]['id']}},_0x18d9d5={};_0x18d9d5['model']=_[_0xc499('0x33')](db[_0xc499('0x2f')][_0xc499('0x30')]);_0x18d9d5[_0xc499('0x39')]=_[_0xc499('0x33')](_0x23d900[_0xc499('0x39')]);_0x18d9d5[_0xc499('0x34')]=_[_0xc499('0x35')](_0x18d9d5[_0xc499('0x36')],_0x18d9d5[_0xc499('0x39')]);_0x54bb2e['attributes']=_[_0xc499('0x35')](_0x18d9d5[_0xc499('0x36')],qs[_0xc499('0x38')](_0x23d900['query'][_0xc499('0x38')]));_0x54bb2e['attributes']=_0x54bb2e[_0xc499('0x37')][_0xc499('0x3a')]?_0x54bb2e[_0xc499('0x37')]:_0x18d9d5[_0xc499('0x36')];if(_0x23d900['query']['includeAll']){_0x54bb2e['include']=[{'all':!![]}];}_0x54bb2e=_['merge']({},_0x54bb2e,_0x23d900[_0xc499('0x43')]);return db[_0xc499('0x2f')][_0xc499('0x49')](_0x54bb2e)[_0xc499('0x27')](handleEntityNotFound(_0xe95fdf,null))[_0xc499('0x27')](respondWithResult(_0xe95fdf,null))[_0xc499('0x46')](handleError(_0xe95fdf,null));};exports[_0xc499('0x4a')]=function(_0xe91525,_0x4a0f2b){return db[_0xc499('0x2f')][_0xc499('0x4a')](_0xe91525[_0xc499('0x4b')],{})[_0xc499('0x27')](respondWithResult(_0x4a0f2b,0xc9))[_0xc499('0x46')](handleError(_0x4a0f2b,null));};exports['update']=function(_0x290b31,_0x95b681){if(_0x290b31[_0xc499('0x4b')]['id']){delete _0x290b31[_0xc499('0x4b')]['id'];}return db[_0xc499('0x2f')][_0xc499('0x49')]({'where':{'id':_0x290b31['params']['id']}})[_0xc499('0x27')](handleEntityNotFound(_0x95b681,null))[_0xc499('0x27')](saveUpdates(_0x290b31[_0xc499('0x4b')],null))[_0xc499('0x27')](respondWithResult(_0x95b681,null))[_0xc499('0x46')](handleError(_0x95b681,null));};exports[_0xc499('0x28')]=function(_0x4032e7,_0x739748){return db['VoiceTransferReport']['find']({'where':{'id':_0x4032e7['params']['id']}})[_0xc499('0x27')](handleEntityNotFound(_0x739748,null))[_0xc499('0x27')](removeEntity(_0x739748,null))['catch'](handleError(_0x739748,null));};exports[_0xc499('0x4c')]=function(_0x391eda,_0x3de5fe){return db[_0xc499('0x2f')]['describe']()['then'](respondWithResult(_0x3de5fe,null))['catch'](handleError(_0x3de5fe,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a220d0a..81def5b 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 _0xbf56=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','report_call_transfer'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xbf56,0x13b));var _0x6bf5=function(_0x3bcabf,_0x92b1ac){_0x3bcabf=_0x3bcabf-0x0;var _0x24b95a=_0xbf56[_0x3bcabf];return _0x24b95a;};'use strict';var _=require(_0x6bf5('0x0'));var util=require('util');var logger=require(_0x6bf5('0x1'))('api');var moment=require(_0x6bf5('0x2'));var BPromise=require(_0x6bf5('0x3'));var rp=require(_0x6bf5('0x4'));var fs=require('fs');var path=require(_0x6bf5('0x5'));var rimraf=require(_0x6bf5('0x6'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x6bf5('0x7')]=function(_0xc32416,_0x3f9e04){return _0xc32416['define']('VoiceTransferReport',attributes,{'tableName':_0x6bf5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb24c=['exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xc8adc0,_0x288b25){var _0x2b4338=function(_0x4845df){while(--_0x4845df){_0xc8adc0['push'](_0xc8adc0['shift']());}};_0x2b4338(++_0x288b25);}(_0xb24c,0x12f));var _0xcb24=function(_0x24a017,_0x450efe){_0x24a017=_0x24a017-0x0;var _0x473bda=_0xb24c[_0x24a017];return _0x473bda;};'use strict';var _=require(_0xcb24('0x0'));var util=require(_0xcb24('0x1'));var logger=require(_0xcb24('0x2'))(_0xcb24('0x3'));var moment=require(_0xcb24('0x4'));var BPromise=require('bluebird');var rp=require(_0xcb24('0x5'));var fs=require('fs');var path=require(_0xcb24('0x6'));var rimraf=require(_0xcb24('0x7'));var config=require(_0xcb24('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xcb24('0x9')]=function(_0x344941,_0x5a77ba){return _0x344941[_0xcb24('0xa')](_0xcb24('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index fe04bb6..28b47e6 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 _0x4fd3=['jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a9796,_0x529d4e){var _0x1e0f0c=function(_0x1a1585){while(--_0x1a1585){_0x5a9796['push'](_0x5a9796['shift']());}};_0x1e0f0c(++_0x529d4e);}(_0x4fd3,0xfc));var _0x34fd=function(_0x7c69ad,_0x2a1083){_0x7c69ad=_0x7c69ad-0x0;var _0x111d8e=_0x4fd3[_0x7c69ad];return _0x111d8e;};'use strict';var _=require(_0x34fd('0x0'));var util=require('util');var moment=require(_0x34fd('0x1'));var BPromise=require(_0x34fd('0x2'));var rs=require(_0x34fd('0x3'));var fs=require('fs');var Redis=require(_0x34fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34fd('0x5'));var logger=require(_0x34fd('0x6'))(_0x34fd('0x7'));var config=require(_0x34fd('0x8'));var jayson=require(_0x34fd('0x9'));var client=jayson['client'][_0x34fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c1786,_0x28a65f,_0x29c0cb){return new BPromise(function(_0x1dcd75,_0x485203){return client[_0x34fd('0xb')](_0x5c1786,_0x29c0cb)['then'](function(_0x3df66b){logger[_0x34fd('0xc')](_0x34fd('0xd'),_0x28a65f,_0x34fd('0xe'));logger[_0x34fd('0xf')](_0x34fd('0x10'),_0x28a65f,_0x34fd('0xe'),JSON[_0x34fd('0x11')](_0x3df66b));if(_0x3df66b[_0x34fd('0x12')]){if(_0x3df66b['error'][_0x34fd('0x13')]===0x1f4){logger[_0x34fd('0x12')](_0x34fd('0xd'),_0x28a65f,_0x3df66b[_0x34fd('0x12')]['message']);return _0x485203(_0x3df66b[_0x34fd('0x12')][_0x34fd('0x14')]);}logger['error'](_0x34fd('0xd'),_0x28a65f,_0x3df66b[_0x34fd('0x12')][_0x34fd('0x14')]);return _0x1dcd75(_0x3df66b['error'][_0x34fd('0x14')]);}else{logger[_0x34fd('0xc')](_0x34fd('0xd'),_0x28a65f,'request\x20sent');_0x1dcd75(_0x3df66b[_0x34fd('0x15')][_0x34fd('0x14')]);}})[_0x34fd('0x16')](function(_0x2da2d1){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x28a65f,_0x2da2d1);_0x485203(_0x2da2d1);});});}exports['CreateVoiceTransferReport']=function(_0x276818){var _0x27677c=this;return new Promise(function(_0x5e8b45,_0xe196fa){return db[_0x34fd('0x17')][_0x34fd('0x18')](_0x276818[_0x34fd('0x19')],{'raw':_0x276818[_0x34fd('0x1a')]?_0x276818[_0x34fd('0x1a')][_0x34fd('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d361d){logger[_0x34fd('0xc')](_0x34fd('0x1c'),_0x276818);logger[_0x34fd('0xf')]('CreateVoiceTransferReport',_0x276818,JSON[_0x34fd('0x11')](_0x3d361d));_0x5e8b45(_0x3d361d);})['catch'](function(_0x54cf9a){logger[_0x34fd('0x12')](_0x34fd('0x1c'),_0x54cf9a[_0x34fd('0x14')],_0x276818);_0xe196fa(_0x27677c[_0x34fd('0x12')](0x1f4,_0x54cf9a[_0x34fd('0x14')]));});});}; \ No newline at end of file +var _0xd7e1=['code','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3e1bf8,_0x2c4fe7){var _0x346c3b=function(_0xff426a){while(--_0xff426a){_0x3e1bf8['push'](_0x3e1bf8['shift']());}};_0x346c3b(++_0x2c4fe7);}(_0xd7e1,0x6e));var _0x1d7e=function(_0x4947f0,_0x138314){_0x4947f0=_0x4947f0-0x0;var _0x11ad58=_0xd7e1[_0x4947f0];return _0x11ad58;};'use strict';var _=require(_0x1d7e('0x0'));var util=require(_0x1d7e('0x1'));var moment=require(_0x1d7e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d7e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d7e('0x4'))['db'];var utils=require(_0x1d7e('0x5'));var logger=require('../../config/logger')(_0x1d7e('0x6'));var config=require(_0x1d7e('0x7'));var jayson=require(_0x1d7e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20afc4,_0x3f1c18,_0x1ffd45){return new BPromise(function(_0x5dbd04,_0x4fb3a5){return client['request'](_0x20afc4,_0x1ffd45)['then'](function(_0x44395e){logger[_0x1d7e('0x9')](_0x1d7e('0xa'),_0x3f1c18,_0x1d7e('0xb'));logger[_0x1d7e('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3f1c18,_0x1d7e('0xb'),JSON[_0x1d7e('0xd')](_0x44395e));if(_0x44395e[_0x1d7e('0xe')]){if(_0x44395e['error'][_0x1d7e('0xf')]===0x1f4){logger[_0x1d7e('0xe')](_0x1d7e('0xa'),_0x3f1c18,_0x44395e[_0x1d7e('0xe')][_0x1d7e('0x10')]);return _0x4fb3a5(_0x44395e[_0x1d7e('0xe')][_0x1d7e('0x10')]);}logger[_0x1d7e('0xe')](_0x1d7e('0xa'),_0x3f1c18,_0x44395e[_0x1d7e('0xe')][_0x1d7e('0x10')]);return _0x5dbd04(_0x44395e[_0x1d7e('0xe')][_0x1d7e('0x10')]);}else{logger[_0x1d7e('0x9')](_0x1d7e('0xa'),_0x3f1c18,_0x1d7e('0xb'));_0x5dbd04(_0x44395e[_0x1d7e('0x11')][_0x1d7e('0x10')]);}})[_0x1d7e('0x12')](function(_0x1cc9a6){logger[_0x1d7e('0xe')](_0x1d7e('0xa'),_0x3f1c18,_0x1cc9a6);_0x4fb3a5(_0x1cc9a6);});});}exports[_0x1d7e('0x13')]=function(_0x50dd10){var _0x124e5c=this;return new Promise(function(_0x5793ac,_0x534934){return db['VoiceTransferReport'][_0x1d7e('0x14')](_0x50dd10[_0x1d7e('0x15')],{'raw':_0x50dd10[_0x1d7e('0x16')]?_0x50dd10['options'][_0x1d7e('0x17')]===undefined?!![]:![]:!![]})[_0x1d7e('0x18')](function(_0x9ef13e){logger[_0x1d7e('0x9')](_0x1d7e('0x13'),_0x50dd10);logger[_0x1d7e('0xc')](_0x1d7e('0x13'),_0x50dd10,JSON[_0x1d7e('0xd')](_0x9ef13e));_0x5793ac(_0x9ef13e);})['catch'](function(_0x1e2a18){logger['error'](_0x1d7e('0x13'),_0x1e2a18[_0x1d7e('0x10')],_0x50dd10);_0x534934(_0x124e5c[_0x1d7e('0xe')](0x1f4,_0x1e2a18['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d0a6551..39bc21f 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0xd22e8c,_0x2b20b7){var _0x46f513=function(_0x5540ff){while(--_0x5540ff){_0xd22e8c['push'](_0xd22e8c['shift']());}};_0x46f513(++_0x2b20b7);}(_0x5b02,0xe9));var _0x25b0=function(_0x1d3988,_0x5d2b64){_0x1d3988=_0x1d3988-0x0;var _0x1133f4=_0x5b02[_0x1d3988];return _0x1133f4;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0xc34e78,_0x19638f){var _0x205de5=function(_0x41dcfd){while(--_0x41dcfd){_0xc34e78['push'](_0xc34e78['shift']());}};_0x205de5(++_0x19638f);}(_0x91a7,0xe7));var _0x791a=function(_0x1553c1,_0x55cd9b){_0x1553c1=_0x1553c1-0x0;var _0x3246cf=_0x91a7[_0x1553c1];return _0x3246cf;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 3cdbf33..597270d 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 _0x3685=['UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','send','name','NotFound','request','then','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','originate','body','status','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3685,0xf8));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x5368('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x5368('0x1'))['db'];var config=require(_0x5368('0x2'));var util=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var jayson=require(_0x5368('0x5'));var amiClient=jayson[_0x5368('0x6')][_0x5368('0x7')]({'port':0x232a});var logger=require(_0x5368('0x8'))(_0x5368('0x9'));var Redis=require(_0x5368('0xa'));config['redis']=_[_0x5368('0xb')](config[_0x5368('0xc')],{'host':_0x5368('0xd'),'port':0x18eb});var io=require(_0x5368('0xe'))(new Redis(config['redis']));var Schema=require(_0x5368('0xf'));var originateValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'callNumber':{'type':_0x5368('0x12'),'required':[!![],_0x5368('0x13')]},'callerId':{'type':_0x5368('0x12')},'callbackUrl':{'type':_0x5368('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x5368('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x41ce0e,_0x183041,_0x59c422){logger[_0x5368('0x15')](_0x41ce0e,_0x183041,JSON[_0x5368('0x16')](_0x59c422));io['to'](_0x41ce0e)[_0x5368('0x17')](_0x183041,_0x59c422);}function handleError(_0x24a4b3){return function(_0x5b10e9){console[_0x5368('0x18')]('handleError:',_0x5b10e9,_0x5b10e9 instanceof RangeError);logger['error'](_0x5b10e9[_0x5368('0x19')]);if(_0x5b10e9 instanceof RangeError){if(_0x5b10e9['name']){delete _0x5b10e9['name'];}_0x24a4b3['status'](0x194)[_0x5368('0x1a')](_0x5b10e9);}else{if(_0x5b10e9[_0x5368('0x1b')]){delete _0x5b10e9[_0x5368('0x1b')];}_0x24a4b3['status'](0x1f4)['send'](_0x5b10e9);}};}function checkError(){return function(_0x2f21fc){if(!_0x2f21fc){throw new RangeError(_0x5368('0x1c'));}return _0x2f21fc;};}function respondWithRpcPromise(_0x14b6bd,_0x38f367){return new BPromise(function(_0x1c2fcd,_0x1093e2){var _0x4885d0=amiClient;return _0x4885d0[_0x5368('0x1d')](_0x14b6bd,_0x38f367)[_0x5368('0x1e')](function(_0x4705f2){if(_0x4705f2['error']){if(_0x4705f2[_0x5368('0x1f')][_0x5368('0x20')]===0x1f4){return _0x1093e2(_0x4705f2[_0x5368('0x1f')][_0x5368('0x21')]);}return _0x1c2fcd(_0x4705f2[_0x5368('0x1f')][_0x5368('0x21')]);}else{_0x1c2fcd(_0x4705f2[_0x5368('0x22')]);}})[_0x5368('0x23')](function(_0x47c30f){_0x1093e2(_0x47c30f);});});}function getAgent(_0x569d81){return db['User'][_0x5368('0x24')]({'where':{'id':_0x569d81,'role':_0x5368('0x25')}})[_0x5368('0x1e')](checkError());}function getAgentCheckSession(_0x452c81,_0x131722){return new BPromise(function(_0x4b94cd,_0x725f8e){var _0x200ad0=respondWithRpcPromise(_0x5368('0x26'));var _0x2bcf41=getAgent(_0x452c81);Promise[_0x5368('0x27')]([_0x200ad0,_0x2bcf41])[_0x5368('0x1e')](function(_0x3d40de){var _0x2963a6=_0x3d40de[0x0];var _0x3681e6=_0x3d40de[0x1];var _0x3c8ae1=_[_0x5368('0x28')](_0x2963a6[_0x5368('0x29')],function(_0x7449cd){return _0x7449cd['UserId']==_0x3681e6['id']&&_0x7449cd[_0x5368('0x2a')]==_0x131722;});if(_0x3c8ae1[_0x5368('0x2b')]==0x1){_0x4b94cd(_0x3681e6);}else{_0x725f8e(new RangeError(_0x5368('0x2c')+_0x131722+'\x20not\x20found!'));}});});}exports[_0x5368('0x2d')]=function(_0x50131a,_0x26fc48){logger[_0x5368('0x15')]('originate\x20fired:',_0x50131a[_0x5368('0x2e')]);var _0x1ce386=originateValidation['validate'](_0x50131a['body']);if(_0x1ce386[_0x5368('0x2b')]>0x0){return _0x26fc48[_0x5368('0x2f')](0x190)['json'](_0x1ce386);}var _0x46169e=_0x50131a[_0x5368('0x2e')][_0x5368('0x30')];var _0x4dc0ee=_0x50131a[_0x5368('0x2e')]['callNumber'];var _0x22b489=_0x50131a[_0x5368('0x2e')][_0x5368('0x31')];var _0x5f44d2=_0x50131a[_0x5368('0x2e')][_0x5368('0x32')];return getAgent(_0x46169e)[_0x5368('0x1e')](function(_0x2a3bed){logger['info'](_0x5368('0x33'),_0x2a3bed['name']);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x2a3bed['name']),_0x5368('0x36'),{'callNumber':_0x4dc0ee,'callerId':_0x22b489,'callbackUrl':_0x5f44d2});return _0x26fc48[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x38')});})['catch'](handleError(_0x26fc48));};exports[_0x5368('0x39')]=function(_0x19de44,_0x7b30ae){logger[_0x5368('0x15')](_0x5368('0x3a'),_0x19de44['body']);var _0x1183a1=hangupValidation[_0x5368('0xf')](_0x19de44['body']);if(_0x1183a1[_0x5368('0x2b')]>0x0){return _0x7b30ae[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x1183a1);}var _0x5e796f=_0x19de44[_0x5368('0x2e')][_0x5368('0x30')];var _0x1f23cc=_0x19de44[_0x5368('0x2e')]['sessionId'];return getAgent(_0x5e796f)['then'](function(_0x1be46a){logger[_0x5368('0x15')](_0x5368('0x33'),_0x1be46a['name']);emit(util['format'](_0x5368('0x35'),_0x1be46a['name']),_0x5368('0x3b'),{'sessionId':_0x1f23cc});return _0x7b30ae[_0x5368('0x2f')](0xc8)['json']({'error':![],'message':_0x5368('0x3c')});})[_0x5368('0x23')](handleError(_0x7b30ae));};exports[_0x5368('0x3d')]=function(_0xed1792,_0x2e1acc){logger[_0x5368('0x15')](_0x5368('0x3e'),_0xed1792[_0x5368('0x2e')]);var _0x48c86=answerValidation[_0x5368('0xf')](_0xed1792[_0x5368('0x2e')]);if(_0x48c86[_0x5368('0x2b')]>0x0){return _0x2e1acc['status'](0x190)[_0x5368('0x37')](_0x48c86);}var _0x61b1a1=_0xed1792[_0x5368('0x2e')]['userId'];var _0x1b66a1=_0xed1792[_0x5368('0x2e')]['sessionId'];return getAgent(_0x61b1a1)[_0x5368('0x1e')](function(_0x6f6dc4){logger[_0x5368('0x15')](_0x5368('0x33'),_0x6f6dc4[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x6f6dc4[_0x5368('0x1b')]),_0x5368('0x3f'),{'sessionId':_0x1b66a1});return _0x2e1acc[_0x5368('0x2f')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x5368('0x23')](handleError(_0x2e1acc));};exports[_0x5368('0x40')]=function(_0x3eb1d0,_0x20f041){logger['info']('hold\x20fired:',_0x3eb1d0[_0x5368('0x2e')]);var _0x5577b3=holdValidation[_0x5368('0xf')](_0x3eb1d0['body']);if(_0x5577b3[_0x5368('0x2b')]>0x0){return _0x20f041['status'](0x190)[_0x5368('0x37')](_0x5577b3);}var _0x244724=_0x3eb1d0['body']['userId'];var _0x3e9ac0=_0x3eb1d0['body'][_0x5368('0x2a')];return getAgent(_0x244724)[_0x5368('0x1e')](function(_0x2ee00b){logger[_0x5368('0x15')]('entityFound:',_0x2ee00b[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x2ee00b[_0x5368('0x1b')]),_0x5368('0x41'),{'sessionId':_0x3e9ac0});return _0x20f041[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x20f041));};exports[_0x5368('0x42')]=function(_0x7d7a5,_0x367a7d){logger['info'](_0x5368('0x43'),_0x7d7a5[_0x5368('0x2e')]);var _0x1791d4=unholdValidation[_0x5368('0xf')](_0x7d7a5[_0x5368('0x2e')]);if(_0x1791d4[_0x5368('0x2b')]>0x0){return _0x367a7d[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x1791d4);}var _0x539911=_0x7d7a5[_0x5368('0x2e')][_0x5368('0x30')];var _0x32aa43=_0x7d7a5[_0x5368('0x2e')]['sessionId'];return getAgent(_0x539911)[_0x5368('0x1e')](function(_0x9775f8){logger[_0x5368('0x15')](_0x5368('0x33'),_0x9775f8[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x9775f8[_0x5368('0x1b')]),_0x5368('0x44'),{'sessionId':_0x32aa43});return _0x367a7d[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x45')});})[_0x5368('0x23')](handleError(_0x367a7d));};exports[_0x5368('0x46')]=function(_0x5adefd,_0x1ea85e){logger[_0x5368('0x15')](_0x5368('0x47'),_0x1ea85e[_0x5368('0x2e')]);var _0x2688a9=callsValidation[_0x5368('0xf')](_0x5adefd['body']);if(_0x2688a9[_0x5368('0x2b')]>0x0){return _0x1ea85e['status'](0x190)[_0x5368('0x37')](_0x2688a9);}var _0x139b0d=_0x5adefd[_0x5368('0x2e')][_0x5368('0x30')];var _0xe348e1=respondWithRpcPromise(_0x5368('0x26'));var _0x170ecd=getAgent(_0x139b0d);return Promise['all']([_0xe348e1,_0x170ecd])[_0x5368('0x1e')](function(_0xcec819){var _0x45bba1=_0xcec819[0x0];var _0x3822ff=_0xcec819[0x1];var _0xf127d0=_[_0x5368('0x28')](_0x45bba1[_0x5368('0x29')],function(_0x128812){return _0x128812[_0x5368('0x48')]==_0x3822ff['id'];});return _0x1ea85e[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'count':_0xf127d0[_0x5368('0x2b')],'rows':_0xf127d0});})[_0x5368('0x23')](handleError(_0x1ea85e));};exports['conference']=function(_0x4fa56e,_0x5b741a){logger[_0x5368('0x15')](_0x5368('0x49'),_0x4fa56e[_0x5368('0x2e')]);var _0x2b7fa9=conferenceValidation['validate'](_0x4fa56e['body']);if(_0x2b7fa9[_0x5368('0x2b')]>0x0){return _0x5b741a[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x2b7fa9);}var _0x4d1793=_0x4fa56e[_0x5368('0x2e')]['userId'];return getAgent(_0x4d1793)[_0x5368('0x1e')](function(_0x449972){logger[_0x5368('0x15')](_0x5368('0x33'),_0x449972[_0x5368('0x1b')]);emit(util['format'](_0x5368('0x35'),_0x449972[_0x5368('0x1b')]),_0x5368('0x4a'));return _0x5b741a['status'](0xc8)['json']({'error':![],'message':_0x5368('0x4b')});})[_0x5368('0x23')](handleError(_0x5b741a));};exports['transfer']=function(_0x591c07,_0x26d09c){logger[_0x5368('0x15')](_0x5368('0x4c'),_0x591c07[_0x5368('0x2e')]);var _0x2b5cb3=transferValidation[_0x5368('0xf')](_0x591c07[_0x5368('0x2e')]);if(_0x2b5cb3[_0x5368('0x2b')]>0x0){return _0x26d09c['status'](0x190)[_0x5368('0x37')](_0x2b5cb3);}var _0x5a70f4=_0x591c07[_0x5368('0x2e')][_0x5368('0x30')];var _0x1c2da8=_0x591c07['body'][_0x5368('0x2a')];var _0x242a9a=_0x591c07[_0x5368('0x2e')][_0x5368('0x4d')];return getAgent(_0x5a70f4)[_0x5368('0x1e')](function(_0x3f10b2){logger[_0x5368('0x15')](_0x5368('0x33'),_0x3f10b2[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x3f10b2[_0x5368('0x1b')]),_0x5368('0x4e'),{'sessionId':_0x1c2da8,'transferNumber':_0x242a9a});return _0x26d09c[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x4f')});})[_0x5368('0x23')](handleError(_0x26d09c));}; \ No newline at end of file +var _0x5636=['then','error','message','result','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','json','originate\x20executed!','catch','hangup','info','format','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20executed!','calls','calls\x20fired:','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','stack','name','status','send','NotFound','request'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x5636,0x102));var _0x6563=function(_0x21dbe7,_0x3b1ff1){_0x21dbe7=_0x21dbe7-0x0;var _0x295ebf=_0x5636[_0x21dbe7];return _0x295ebf;};'use strict';var path=require(_0x6563('0x0'));var fs=require('fs');var _=require(_0x6563('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x6563('0x2'));var jayson=require(_0x6563('0x3'));var amiClient=jayson[_0x6563('0x4')]['http']({'port':0x232a});var logger=require(_0x6563('0x5'))(_0x6563('0x6'));var Redis=require(_0x6563('0x7'));config[_0x6563('0x8')]=_[_0x6563('0x9')](config[_0x6563('0x8')],{'host':_0x6563('0xa'),'port':0x18eb});var io=require(_0x6563('0xb'))(new Redis(config[_0x6563('0x8')]));var Schema=require(_0x6563('0xc'));var originateValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'callNumber':{'type':_0x6563('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6563('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x10')]},'transferNumber':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]}});function emit(_0x11baa2,_0x477d9b,_0xd398ce){logger['info'](_0x11baa2,_0x477d9b,JSON[_0x6563('0x12')](_0xd398ce));io['to'](_0x11baa2)['emit'](_0x477d9b,_0xd398ce);}function handleError(_0x502694){return function(_0x47972a){console[_0x6563('0x13')]('handleError:',_0x47972a,_0x47972a instanceof RangeError);logger['error'](_0x47972a[_0x6563('0x14')]);if(_0x47972a instanceof RangeError){if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x194)[_0x6563('0x17')](_0x47972a);}else{if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x1f4)[_0x6563('0x17')](_0x47972a);}};}function checkError(){return function(_0x5bf608){if(!_0x5bf608){throw new RangeError(_0x6563('0x18'));}return _0x5bf608;};}function respondWithRpcPromise(_0x9c3da7,_0x20b478){return new BPromise(function(_0x5a335c,_0x293db2){var _0x5c37bb=amiClient;return _0x5c37bb[_0x6563('0x19')](_0x9c3da7,_0x20b478)[_0x6563('0x1a')](function(_0x5610b0){if(_0x5610b0['error']){if(_0x5610b0[_0x6563('0x1b')]['code']===0x1f4){return _0x293db2(_0x5610b0[_0x6563('0x1b')][_0x6563('0x1c')]);}return _0x5a335c(_0x5610b0[_0x6563('0x1b')]['message']);}else{_0x5a335c(_0x5610b0[_0x6563('0x1d')]);}})['catch'](function(_0x7ea857){_0x293db2(_0x7ea857);});});}function getAgent(_0x1590e6){return db['User'][_0x6563('0x1e')]({'where':{'id':_0x1590e6,'role':_0x6563('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x2ddb2b,_0x5b03a7){return new BPromise(function(_0x1fe1cb,_0x4fbb20){var _0x480408=respondWithRpcPromise(_0x6563('0x20'));var _0x118d31=getAgent(_0x2ddb2b);Promise[_0x6563('0x21')]([_0x480408,_0x118d31])[_0x6563('0x1a')](function(_0x3eb23b){var _0x4b4d3b=_0x3eb23b[0x0];var _0x3c8bd1=_0x3eb23b[0x1];var _0x4f275c=_['filter'](_0x4b4d3b[_0x6563('0x22')],function(_0x35af37){return _0x35af37[_0x6563('0x23')]==_0x3c8bd1['id']&&_0x35af37[_0x6563('0x24')]==_0x5b03a7;});if(_0x4f275c[_0x6563('0x25')]==0x1){_0x1fe1cb(_0x3c8bd1);}else{_0x4fbb20(new RangeError(_0x6563('0x26')+_0x5b03a7+_0x6563('0x27')));}});});}exports[_0x6563('0x28')]=function(_0x101b24,_0x246d53){logger['info'](_0x6563('0x29'),_0x101b24[_0x6563('0x2a')]);var _0x29fb9d=originateValidation[_0x6563('0xc')](_0x101b24[_0x6563('0x2a')]);if(_0x29fb9d[_0x6563('0x25')]>0x0){return _0x246d53[_0x6563('0x16')](0x190)['json'](_0x29fb9d);}var _0x8cf1=_0x101b24[_0x6563('0x2a')][_0x6563('0x2b')];var _0x46fb1b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2c')];var _0x574a35=_0x101b24[_0x6563('0x2a')][_0x6563('0x2d')];var _0x26c24b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2e')];return getAgent(_0x8cf1)[_0x6563('0x1a')](function(_0x3f578a){logger['info'](_0x6563('0x2f'),_0x3f578a[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x3f578a[_0x6563('0x15')]),'webbar:originate',{'callNumber':_0x46fb1b,'callerId':_0x574a35,'callbackUrl':_0x26c24b});return _0x246d53['status'](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x32')});})[_0x6563('0x33')](handleError(_0x246d53));};exports[_0x6563('0x34')]=function(_0x4962c2,_0x2d36d4){logger[_0x6563('0x35')]('hangup\x20fired:',_0x4962c2[_0x6563('0x2a')]);var _0xe5e80f=hangupValidation[_0x6563('0xc')](_0x4962c2[_0x6563('0x2a')]);if(_0xe5e80f[_0x6563('0x25')]>0x0){return _0x2d36d4[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0xe5e80f);}var _0x15c23e=_0x4962c2[_0x6563('0x2a')]['userId'];var _0x130a88=_0x4962c2[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x15c23e)[_0x6563('0x1a')](function(_0x5ebe88){logger['info'](_0x6563('0x2f'),_0x5ebe88[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x5ebe88[_0x6563('0x15')]),'webbar:hangup',{'sessionId':_0x130a88});return _0x2d36d4[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x6563('0x33')](handleError(_0x2d36d4));};exports[_0x6563('0x37')]=function(_0xea186,_0xcf92cd){logger[_0x6563('0x35')](_0x6563('0x38'),_0xea186[_0x6563('0x2a')]);var _0x32932f=answerValidation[_0x6563('0xc')](_0xea186[_0x6563('0x2a')]);if(_0x32932f[_0x6563('0x25')]>0x0){return _0xcf92cd['status'](0x190)['json'](_0x32932f);}var _0x38eab4=_0xea186[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2f2aa6=_0xea186[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x38eab4)[_0x6563('0x1a')](function(_0x4b7838){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x4b7838[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x4b7838[_0x6563('0x15')]),_0x6563('0x39'),{'sessionId':_0x2f2aa6});return _0xcf92cd[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3a')});})['catch'](handleError(_0xcf92cd));};exports['hold']=function(_0x1504ca,_0x42d54c){logger[_0x6563('0x35')]('hold\x20fired:',_0x1504ca[_0x6563('0x2a')]);var _0x120723=holdValidation[_0x6563('0xc')](_0x1504ca[_0x6563('0x2a')]);if(_0x120723['length']>0x0){return _0x42d54c[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x120723);}var _0xd54477=_0x1504ca['body'][_0x6563('0x2b')];var _0x4bcfff=_0x1504ca[_0x6563('0x2a')]['sessionId'];return getAgent(_0xd54477)['then'](function(_0x1ef2da){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x1ef2da[_0x6563('0x15')]);emit(util[_0x6563('0x36')](_0x6563('0x30'),_0x1ef2da[_0x6563('0x15')]),_0x6563('0x3b'),{'sessionId':_0x4bcfff});return _0x42d54c[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x6563('0x33')](handleError(_0x42d54c));};exports['unhold']=function(_0x22306a,_0xb339e9){logger[_0x6563('0x35')]('unhold\x20fired:',_0x22306a[_0x6563('0x2a')]);var _0x141f0c=unholdValidation['validate'](_0x22306a[_0x6563('0x2a')]);if(_0x141f0c[_0x6563('0x25')]>0x0){return _0xb339e9[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x141f0c);}var _0xbd920a=_0x22306a['body'][_0x6563('0x2b')];var _0x5c4cfa=_0x22306a[_0x6563('0x2a')]['sessionId'];return getAgent(_0xbd920a)[_0x6563('0x1a')](function(_0x5992c8){logger['info']('entityFound:',_0x5992c8['name']);emit(util[_0x6563('0x36')]('user:%s',_0x5992c8[_0x6563('0x15')]),'webbar:unhold',{'sessionId':_0x5c4cfa});return _0xb339e9[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3c')});})[_0x6563('0x33')](handleError(_0xb339e9));};exports[_0x6563('0x3d')]=function(_0x199a0e,_0x23c94a){logger[_0x6563('0x35')](_0x6563('0x3e'),_0x23c94a['body']);var _0x386ae9=callsValidation[_0x6563('0xc')](_0x199a0e[_0x6563('0x2a')]);if(_0x386ae9[_0x6563('0x25')]>0x0){return _0x23c94a[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x386ae9);}var _0x40c99b=_0x199a0e[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2c7e9d=respondWithRpcPromise(_0x6563('0x20'));var _0x5c456b=getAgent(_0x40c99b);return Promise[_0x6563('0x21')]([_0x2c7e9d,_0x5c456b])[_0x6563('0x1a')](function(_0x23f38d){var _0x2e9c69=_0x23f38d[0x0];var _0x46c26c=_0x23f38d[0x1];var _0x3c06ac=_[_0x6563('0x3f')](_0x2e9c69[_0x6563('0x22')],function(_0x53292e){return _0x53292e[_0x6563('0x23')]==_0x46c26c['id'];});return _0x23c94a['status'](0xc8)[_0x6563('0x31')]({'count':_0x3c06ac[_0x6563('0x25')],'rows':_0x3c06ac});})['catch'](handleError(_0x23c94a));};exports['conference']=function(_0x3374b0,_0x8f5e46){logger[_0x6563('0x35')](_0x6563('0x40'),_0x3374b0['body']);var _0x2a3df0=conferenceValidation['validate'](_0x3374b0[_0x6563('0x2a')]);if(_0x2a3df0[_0x6563('0x25')]>0x0){return _0x8f5e46['status'](0x190)['json'](_0x2a3df0);}var _0x3a3a35=_0x3374b0['body']['userId'];return getAgent(_0x3a3a35)[_0x6563('0x1a')](function(_0x49d6a5){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x49d6a5[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x49d6a5[_0x6563('0x15')]),_0x6563('0x41'));return _0x8f5e46[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x42')});})[_0x6563('0x33')](handleError(_0x8f5e46));};exports[_0x6563('0x43')]=function(_0x7d8546,_0x58728d){logger['info'](_0x6563('0x44'),_0x7d8546[_0x6563('0x2a')]);var _0x5b5783=transferValidation['validate'](_0x7d8546['body']);if(_0x5b5783[_0x6563('0x25')]>0x0){return _0x58728d[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x5b5783);}var _0x149b74=_0x7d8546['body'][_0x6563('0x2b')];var _0x1a5c54=_0x7d8546[_0x6563('0x2a')][_0x6563('0x24')];var _0xb55389=_0x7d8546['body']['transferNumber'];return getAgent(_0x149b74)[_0x6563('0x1a')](function(_0x1d7b5d){logger[_0x6563('0x35')]('entityFound:',_0x1d7b5d[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x1d7b5d[_0x6563('0x15')]),_0x6563('0x45'),{'sessionId':_0x1a5c54,'transferNumber':_0xb55389});return _0x58728d[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x46')});})[_0x6563('0x33')](handleError(_0x58728d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 3496432..fa131f6 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 _0xadb5=['notify','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addAgents'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0xadb5,0xad));var _0x5adb=function(_0x2a285,_0x4cabbf){_0x2a285=_0x2a285-0x0;var _0x2fb68a=_0xadb5[_0x2a285];return _0x2fb68a;};'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('./whatsappAccount.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getDispositions']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x16')]('/:id/dispositions',auth[_0x5adb('0x8')](),controller['addDisposition']);router[_0x5adb('0x16')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x16')](_0x5adb('0x11'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x18')]);router[_0x5adb('0x16')]('/:id/applications',auth[_0x5adb('0x8')](),controller['addApplications']);router[_0x5adb('0x16')]('/:id/notify',controller[_0x5adb('0x19')]);router['post']('/:id/send',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x1b')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller['update']);router[_0x5adb('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x1d')]);router[_0x5adb('0x1c')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x1e')]);router[_0x5adb('0x1c')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x1f')]);router[_0x5adb('0x1c')](_0x5adb('0x11'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x20')]);module['exports']=router; \ No newline at end of file +var _0xacf4=['./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x414ac8,_0x47d56c){var _0x182e3c=function(_0x23d81f){while(--_0x23d81f){_0x414ac8['push'](_0x414ac8['shift']());}};_0x182e3c(++_0x47d56c);}(_0xacf4,0xe7));var _0x4acf=function(_0x19982f,_0x518412){_0x19982f=_0x19982f-0x0;var _0x13f7d1=_0xacf4[_0x19982f];return _0x13f7d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getDispositions']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x8')](_0x4acf('0x10'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x12')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x13')]);router[_0x4acf('0x12')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['addDisposition']);router[_0x4acf('0x12')]('/:id/canned_answers',auth[_0x4acf('0xb')](),controller[_0x4acf('0x14')]);router[_0x4acf('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0x15')]);router[_0x4acf('0x12')](_0x4acf('0x10'),auth['isAuthenticated'](),controller[_0x4acf('0x16')]);router[_0x4acf('0x12')](_0x4acf('0x17'),controller[_0x4acf('0x18')]);router[_0x4acf('0x12')](_0x4acf('0x19'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x1a')]);router[_0x4acf('0x1b')](_0x4acf('0x1c'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0x1d')](_0x4acf('0x1c'),auth['isAuthenticated'](),controller[_0x4acf('0x1e')]);router[_0x4acf('0x1d')]('/:id/dispositions',auth[_0x4acf('0xb')](),controller[_0x4acf('0x1f')]);router[_0x4acf('0x1d')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x20')]);router[_0x4acf('0x1d')]('/:id/users',auth[_0x4acf('0xb')](),controller[_0x4acf('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c9c3e6f..2086024 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 _0x6338=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6338,0x189));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8633('0x0'));module[_0x8633('0x1')]={'name':{'type':Sequelize[_0x8633('0x2')],'unique':_0x8633('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8633('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8633('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8633('0x2')],'defaultValue':function(){return rs[_0x8633('0x4')]();}},'phone':{'type':Sequelize[_0x8633('0x2')]},'type':{'type':Sequelize[_0x8633('0x5')]('twilio',_0x8633('0x6'))},'accountSid':{'type':Sequelize[_0x8633('0x2')]},'baseUrl':{'type':Sequelize[_0x8633('0x2')]},'authToken':{'type':Sequelize[_0x8633('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8633('0x7')],'defaultValue':function(){return _0x8633('0x8');}},'notificationSound':{'type':Sequelize[_0x8633('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8633('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8633('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8633('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8633('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8633('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8633('0xb'),'set':function(_0x5bc059){if(!_0x5bc059){this[_0x8633('0xc')](_0x8633('0xd'),null);}this['setDataValue'](_0x8633('0xe'),_0x5bc059);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a8f=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','twilio','sinch'];(function(_0x27d844,_0x28e264){var _0x40b299=function(_0x195aff){while(--_0x195aff){_0x27d844['push'](_0x27d844['shift']());}};_0x40b299(++_0x28e264);}(_0x5a8f,0xe6));var _0xf5a8=function(_0x5727d1,_0x366c31){_0x5727d1=_0x5727d1-0x0;var _0x895542=_0x5a8f[_0x5727d1];return _0x895542;};'use strict';var Sequelize=require(_0xf5a8('0x0'));var rs=require(_0xf5a8('0x1'));module[_0xf5a8('0x2')]={'name':{'type':Sequelize[_0xf5a8('0x3')],'unique':_0xf5a8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xf5a8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xf5a8('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf5a8('0x5')]();}},'phone':{'type':Sequelize[_0xf5a8('0x3')]},'type':{'type':Sequelize['ENUM'](_0xf5a8('0x6'),_0xf5a8('0x7'))},'accountSid':{'type':Sequelize[_0xf5a8('0x3')]},'baseUrl':{'type':Sequelize[_0xf5a8('0x3')]},'authToken':{'type':Sequelize[_0xf5a8('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf5a8('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf5a8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5a8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5a8('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf5a8('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xf5a8('0xb')],'defaultValue':![],'comment':_0xf5a8('0xc'),'set':function(_0x1e92f0){if(!_0x1e92f0){this[_0xf5a8('0xd')]('mandatoryDispositionPauseId',null);}this[_0xf5a8('0xd')]('mandatoryDisposition',_0x1e92f0);}},'description':{'type':Sequelize[_0xf5a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3bd01f2..78488d0 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 _0x1205=['agent','Start','startRouting','info','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','findAll','catch','show','params','keys','length','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','WhatsappAccountId','Disposition','getDispositions','findOne','pick','include','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','transaction','sequelize','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','twilio','from','replace','whatsapp:','messageId','MessageSid','notifications','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','push','close','unmanaged','*,*,*,*','interaction','created','AttachmentId','UserId','User','unshift'];(function(_0x17ba0c,_0x28ea77){var _0x5d148b=function(_0x19cf7b){while(--_0x19cf7b){_0x17ba0c['push'](_0x17ba0c['shift']());}};_0x5d148b(++_0x28ea77);}(_0x1205,0x193));var _0x5120=function(_0x2be0fc,_0x52c662){_0x2be0fc=_0x2be0fc-0x0;var _0x104b6c=_0x1205[_0x2be0fc];return _0x104b6c;};'use strict';var emlformat=require(_0x5120('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5120('0x1'));var jsonpatch=require(_0x5120('0x2'));var rp=require(_0x5120('0x3'));var moment=require(_0x5120('0x4'));var BPromise=require(_0x5120('0x5'));var Mustache=require(_0x5120('0x6'));var util=require(_0x5120('0x7'));var path=require(_0x5120('0x8'));var sox=require(_0x5120('0x9'));var csv=require(_0x5120('0xa'));var ejs=require(_0x5120('0xb'));var fs=require('fs');var fs_extra=require(_0x5120('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5120('0xd'));var jsforce=require(_0x5120('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5120('0xa'));var querystring=require('querystring');var Papa=require(_0x5120('0xf'));var Redis=require(_0x5120('0x10'));var authService=require(_0x5120('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5120('0x12'));var hardwareService=require(_0x5120('0x13'));var logger=require(_0x5120('0x14'))(_0x5120('0x15'));var utils=require(_0x5120('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5120('0x17'));var db=require('../../mysqldb')['db'];config[_0x5120('0x18')]=_[_0x5120('0x19')](config[_0x5120('0x18')],{'host':_0x5120('0x1a'),'port':0x18eb});var socket=require(_0x5120('0x1b'))(new Redis(config[_0x5120('0x18')]));require(_0x5120('0x1c'))[_0x5120('0x1d')](socket);var jayson=require(_0x5120('0x1e'));var client=jayson[_0x5120('0x1f')][_0x5120('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2e2afd,_0x5122c3,_0x423ae7,_0x5789c5){return new BPromise(function(_0x59ad96,_0x10273e){var _0xe99d33=_0x5789c5||client;return _0xe99d33['request'](_0x2e2afd,_0x423ae7)[_0x5120('0x21')](function(_0x58113d){logger['info'](_0x5120('0x22'),_0x5122c3,_0x5120('0x23'));logger[_0x5120('0x24')](_0x5120('0x25'),_0x5122c3,_0x5120('0x23'),JSON[_0x5120('0x26')](_0x58113d));if(_0x58113d[_0x5120('0x27')]){if(_0x58113d[_0x5120('0x27')][_0x5120('0x28')]===0x1f4){logger['error'](_0x5120('0x22'),_0x5122c3,_0x58113d[_0x5120('0x27')]['message']);return _0x10273e(_0x58113d[_0x5120('0x27')]['message']);}logger[_0x5120('0x27')](_0x5120('0x22'),_0x5122c3,_0x58113d[_0x5120('0x27')]['message']);return _0x59ad96(_0x58113d['error'][_0x5120('0x29')]);}else{logger['info'](_0x5120('0x22'),_0x5122c3,_0x5120('0x23'));_0x59ad96(_0x58113d[_0x5120('0x2a')][_0x5120('0x29')]);}})['catch'](function(_0x15a1a7){logger[_0x5120('0x27')](_0x5120('0x22'),_0x5122c3,_0x15a1a7);_0x10273e(_0x15a1a7);});});}function respondWithStatusCode(_0x3d3707,_0x243609){_0x243609=_0x243609||0xcc;return function(_0xe36045){if(_0xe36045){return _0x3d3707[_0x5120('0x2b')](_0x243609);}return _0x3d3707[_0x5120('0x2c')](_0x243609)['end']();};}function respondWithResult(_0x2589fa,_0x297950){_0x297950=_0x297950||0xc8;return function(_0x403148){if(_0x403148){return _0x2589fa[_0x5120('0x2c')](_0x297950)[_0x5120('0x2d')](_0x403148);}};}function respondWithFilteredResult(_0x1ccc57,_0x15f73e){return function(_0x1de05c){if(_0x1de05c){var _0x1225b0=typeof _0x15f73e[_0x5120('0x2e')]===_0x5120('0x2f')&&typeof _0x15f73e[_0x5120('0x30')]===_0x5120('0x2f');var _0x193bdc=_0x1de05c[_0x5120('0x31')];var _0x2401c1=_0x1225b0?0x0:_0x15f73e[_0x5120('0x2e')];var _0x34a9e7=_0x1225b0?_0x1de05c[_0x5120('0x31')]:_0x15f73e[_0x5120('0x2e')]+_0x15f73e[_0x5120('0x30')];var _0x1fbeb2;if(_0x34a9e7>=_0x193bdc){_0x34a9e7=_0x193bdc;_0x1fbeb2=0xc8;}else{_0x1fbeb2=0xce;}_0x1ccc57['status'](_0x1fbeb2);return _0x1ccc57[_0x5120('0x32')](_0x5120('0x33'),_0x2401c1+'-'+_0x34a9e7+'/'+_0x193bdc)[_0x5120('0x2d')](_0x1de05c);}return null;};}function patchUpdates(_0x2a463d){return function(_0x23ea6b){try{jsonpatch[_0x5120('0x34')](_0x23ea6b,_0x2a463d,!![]);}catch(_0x8aef00){return BPromise[_0x5120('0x35')](_0x8aef00);}return _0x23ea6b[_0x5120('0x36')]();};}function saveUpdates(_0x19c26c,_0x558386){return function(_0x412d08){if(_0x412d08){return _0x412d08[_0x5120('0x37')](_0x19c26c)[_0x5120('0x21')](function(_0x3aa599){return _0x3aa599;});}return null;};}function removeEntity(_0x2a360b,_0x3c2cbf){return function(_0x265eea){if(_0x265eea){return _0x265eea['destroy']()['then'](function(){var _0x5f392d=_0x265eea[_0x5120('0x38')]({'plain':!![]});var _0x31a418=_0x5120('0x39');return db[_0x5120('0x3a')][_0x5120('0x3b')]({'where':{'type':_0x31a418,'resourceId':_0x5f392d['id']}})['then'](function(){return _0x265eea;});})['then'](function(){_0x2a360b[_0x5120('0x2c')](0xcc)[_0x5120('0x3c')]();});}};}function handleEntityNotFound(_0x279ccd,_0x442aeb){return function(_0x1bebaf){if(!_0x1bebaf){_0x279ccd[_0x5120('0x2b')](0x194);}return _0x1bebaf;};}function handleError(_0x1c3c03,_0x4cd079){_0x4cd079=_0x4cd079||0x1f4;return function(_0x491305){logger[_0x5120('0x27')](_0x491305[_0x5120('0x3d')]);if(_0x491305[_0x5120('0x3e')]){delete _0x491305[_0x5120('0x3e')];}_0x1c3c03[_0x5120('0x2c')](_0x4cd079)[_0x5120('0x3f')](_0x491305);};}exports['index']=function(_0x4763d0,_0x2fba7f){var _0x1ead95={'include':[{'model':db[_0x5120('0x40')],'as':_0x5120('0x41')}]},_0x5c6078={},_0x466f36={'count':0x0,'rows':[]};var _0x1b3c35=_[_0x5120('0x42')](db['WhatsappAccount'][_0x5120('0x43')],function(_0x234c8e){return{'name':_0x234c8e['fieldName'],'type':_0x234c8e[_0x5120('0x44')][_0x5120('0x45')]};});_0x5c6078[_0x5120('0x46')]=_['map'](_0x1b3c35,_0x5120('0x3e'));_0x5c6078[_0x5120('0x47')]=_['keys'](_0x4763d0['query']);_0x5c6078[_0x5120('0x48')]=_[_0x5120('0x49')](_0x5c6078[_0x5120('0x46')],_0x5c6078['query']);_0x1ead95[_0x5120('0x4a')]=_[_0x5120('0x49')](_0x5c6078['model'],qs[_0x5120('0x4b')](_0x4763d0[_0x5120('0x47')][_0x5120('0x4b')]));_0x1ead95[_0x5120('0x4a')]=_0x1ead95['attributes']['length']?_0x1ead95[_0x5120('0x4a')]:_0x5c6078[_0x5120('0x46')];if(!_0x4763d0[_0x5120('0x47')][_0x5120('0x4c')](_0x5120('0x4d'))){_0x1ead95['limit']=qs[_0x5120('0x30')](_0x4763d0['query'][_0x5120('0x30')]);_0x1ead95[_0x5120('0x2e')]=qs[_0x5120('0x2e')](_0x4763d0[_0x5120('0x47')][_0x5120('0x2e')]);}_0x1ead95[_0x5120('0x4e')]=qs[_0x5120('0x4f')](_0x4763d0[_0x5120('0x47')][_0x5120('0x4f')]);_0x1ead95[_0x5120('0x50')]=qs[_0x5120('0x48')](_['pick'](_0x4763d0[_0x5120('0x47')],_0x5c6078[_0x5120('0x48')]),_0x1b3c35);if(_0x4763d0[_0x5120('0x47')][_0x5120('0x51')]){_0x1ead95['where']=_[_0x5120('0x52')](_0x1ead95[_0x5120('0x50')],{'$or':_['map'](_0x1b3c35,function(_0x2c0e84){if(_0x2c0e84['type']!==_0x5120('0x53')){var _0x159954={};_0x159954[_0x2c0e84[_0x5120('0x3e')]]={'$like':'%'+_0x4763d0[_0x5120('0x47')][_0x5120('0x51')]+'%'};return _0x159954;}})});}_0x1ead95=_[_0x5120('0x52')]({},_0x1ead95,_0x4763d0[_0x5120('0x54')]);var _0x28b4da={'where':_0x1ead95[_0x5120('0x50')]};return db[_0x5120('0x55')]['count'](_0x28b4da)[_0x5120('0x21')](function(_0x53da3b){_0x466f36[_0x5120('0x31')]=_0x53da3b;if(_0x4763d0['query'][_0x5120('0x56')]){_0x1ead95['include']=[{'all':!![]}];}return db[_0x5120('0x55')][_0x5120('0x57')](_0x1ead95);})[_0x5120('0x21')](function(_0x3c04f2){_0x466f36['rows']=_0x3c04f2;return _0x466f36;})['then'](respondWithFilteredResult(_0x2fba7f,_0x1ead95))[_0x5120('0x58')](handleError(_0x2fba7f,null));};exports[_0x5120('0x59')]=function(_0x17d14b,_0x1c968f){var _0x1e81f3={'raw':![],'where':{'id':_0x17d14b[_0x5120('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x5120('0x41')}]},_0x1f55ed={};_0x1f55ed[_0x5120('0x46')]=_[_0x5120('0x5b')](db[_0x5120('0x55')]['rawAttributes']);_0x1f55ed[_0x5120('0x47')]=_['keys'](_0x17d14b['query']);_0x1f55ed[_0x5120('0x48')]=_[_0x5120('0x49')](_0x1f55ed[_0x5120('0x46')],_0x1f55ed['query']);_0x1e81f3[_0x5120('0x4a')]=_[_0x5120('0x49')](_0x1f55ed[_0x5120('0x46')],qs[_0x5120('0x4b')](_0x17d14b[_0x5120('0x47')][_0x5120('0x4b')]));_0x1e81f3[_0x5120('0x4a')]=_0x1e81f3[_0x5120('0x4a')][_0x5120('0x5c')]?_0x1e81f3['attributes']:_0x1f55ed[_0x5120('0x46')];if(_0x17d14b['query'][_0x5120('0x56')]){_0x1e81f3['include']=[{'all':!![]}];}_0x1e81f3=_[_0x5120('0x52')]({},_0x1e81f3,_0x17d14b[_0x5120('0x54')]);return db[_0x5120('0x55')][_0x5120('0x5d')](_0x1e81f3)[_0x5120('0x21')](handleEntityNotFound(_0x1c968f,null))[_0x5120('0x21')](respondWithResult(_0x1c968f,null))[_0x5120('0x58')](handleError(_0x1c968f,null));};exports[_0x5120('0x5e')]=function(_0x4b6056,_0x75acd){return db[_0x5120('0x55')]['create'](_0x4b6056[_0x5120('0x5f')],{})[_0x5120('0x21')](function(_0x42af93){var _0x2e674d=_0x4b6056[_0x5120('0x60')]['get']({'plain':!![]});if(!_0x2e674d)throw new Error(_0x5120('0x61'));if(_0x2e674d[_0x5120('0x62')]===_0x5120('0x60')){var _0x513878=_0x42af93[_0x5120('0x38')]({'plain':!![]});var _0x2a15a6='WhatsappAccounts';return db[_0x5120('0x63')][_0x5120('0x5d')]({'where':{'name':_0x2a15a6,'userProfileId':_0x2e674d[_0x5120('0x64')]},'raw':!![]})[_0x5120('0x21')](function(_0x27f380){if(_0x27f380&&_0x27f380[_0x5120('0x65')]===0x0){return db[_0x5120('0x3a')][_0x5120('0x5e')]({'name':_0x513878['name'],'resourceId':_0x513878['id'],'type':_0x27f380[_0x5120('0x3e')],'sectionId':_0x27f380['id']},{})[_0x5120('0x21')](function(){return _0x42af93;});}else{return _0x42af93;}})[_0x5120('0x58')](function(_0x67a37){logger[_0x5120('0x27')](_0x5120('0x66'),_0x67a37);throw _0x67a37;});}return _0x42af93;})[_0x5120('0x21')](respondWithResult(_0x75acd,0xc9))[_0x5120('0x58')](handleError(_0x75acd,null));};exports[_0x5120('0x37')]=function(_0x5d8a41,_0x5137f7){if(_0x5d8a41['body']['id']){delete _0x5d8a41[_0x5120('0x5f')]['id'];}return db[_0x5120('0x55')][_0x5120('0x5d')]({'where':{'id':_0x5d8a41['params']['id']},'include':[{'model':db['Pause'],'as':_0x5120('0x41')}]})[_0x5120('0x21')](handleEntityNotFound(_0x5137f7,null))['then'](saveUpdates(_0x5d8a41[_0x5120('0x5f')],null))[_0x5120('0x21')](respondWithResult(_0x5137f7,null))[_0x5120('0x58')](handleError(_0x5137f7,null));};exports[_0x5120('0x3b')]=function(_0x103adb,_0x4c1093){return db['WhatsappAccount'][_0x5120('0x5d')]({'where':{'id':_0x103adb[_0x5120('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c1093,null))[_0x5120('0x21')](removeEntity(_0x4c1093,null))[_0x5120('0x58')](handleError(_0x4c1093,null));};exports[_0x5120('0x67')]=function(_0x2dc0a8,_0x49b1e7){return db[_0x5120('0x55')]['describe']()['then'](respondWithResult(_0x49b1e7,null))[_0x5120('0x58')](handleError(_0x49b1e7,null));};exports[_0x5120('0x68')]=function(_0x4ed3d6,_0x11ee1b,_0x8192e3){if(_0x4ed3d6[_0x5120('0x5f')]['id']){delete _0x4ed3d6[_0x5120('0x5f')]['id'];}return db['WhatsappAccount'][_0x5120('0x5d')]({'where':{'id':_0x4ed3d6[_0x5120('0x5a')]['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x11ee1b,null))[_0x5120('0x21')](function(_0x486d5c){if(_0x486d5c){_0x4ed3d6[_0x5120('0x5f')][_0x5120('0x69')]=_0x486d5c['id'];return db[_0x5120('0x6a')][_0x5120('0x5e')](_0x4ed3d6[_0x5120('0x5f')]);}})[_0x5120('0x21')](respondWithResult(_0x11ee1b,null))[_0x5120('0x58')](handleError(_0x11ee1b,null));};exports[_0x5120('0x6b')]=function(_0x18d01d,_0x38daf5,_0x1c7176){var _0x23127b={'raw':![],'where':{}};var _0x8b5ecd={};var _0xdb308e={'count':0x0,'rows':[]};return db[_0x5120('0x55')][_0x5120('0x6c')]({'where':{'id':_0x18d01d[_0x5120('0x5a')]['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x38daf5,null))[_0x5120('0x21')](function(_0x43f173){if(_0x43f173){_0x8b5ecd[_0x5120('0x46')]=_[_0x5120('0x5b')](db[_0x5120('0x6a')][_0x5120('0x43')]);_0x8b5ecd[_0x5120('0x47')]=_[_0x5120('0x5b')](_0x18d01d['query']);_0x8b5ecd[_0x5120('0x48')]=_['intersection'](_0x8b5ecd[_0x5120('0x46')],_0x8b5ecd['query']);_0x23127b[_0x5120('0x4a')]=_[_0x5120('0x49')](_0x8b5ecd[_0x5120('0x46')],qs[_0x5120('0x4b')](_0x18d01d[_0x5120('0x47')][_0x5120('0x4b')]));_0x23127b[_0x5120('0x4a')]=_0x23127b[_0x5120('0x4a')][_0x5120('0x5c')]?_0x23127b[_0x5120('0x4a')]:_0x8b5ecd[_0x5120('0x46')];if(!_0x18d01d[_0x5120('0x47')][_0x5120('0x4c')](_0x5120('0x4d'))){_0x23127b['limit']=qs['limit'](_0x18d01d['query'][_0x5120('0x30')]);_0x23127b['offset']=qs['offset'](_0x18d01d[_0x5120('0x47')][_0x5120('0x2e')]);}_0x23127b[_0x5120('0x4e')]=qs[_0x5120('0x4f')](_0x18d01d[_0x5120('0x47')][_0x5120('0x4f')]);_0x23127b[_0x5120('0x50')]=qs[_0x5120('0x48')](_[_0x5120('0x6d')](_0x18d01d[_0x5120('0x47')],_0x8b5ecd[_0x5120('0x48')]));_0x23127b[_0x5120('0x50')][_0x5120('0x69')]=_0x43f173['id'];if(_0x18d01d[_0x5120('0x47')][_0x5120('0x51')]){_0x23127b[_0x5120('0x50')]=_['merge'](_0x23127b[_0x5120('0x50')],{'$or':_['map'](_0x23127b[_0x5120('0x4a')],function(_0x44ed08){var _0x288ba7={};_0x288ba7[_0x44ed08]={'$like':'%'+_0x18d01d[_0x5120('0x47')][_0x5120('0x51')]+'%'};return _0x288ba7;})});}_0x23127b=_['merge']({},_0x23127b,_0x18d01d[_0x5120('0x54')]);return db[_0x5120('0x6a')]['count']({'where':_0x23127b[_0x5120('0x50')]})[_0x5120('0x21')](function(_0x130bbd){_0xdb308e['count']=_0x130bbd;if(_0x18d01d[_0x5120('0x47')][_0x5120('0x56')]){_0x23127b[_0x5120('0x6e')]=[{'all':!![]}];}return db[_0x5120('0x6a')]['findAll'](_0x23127b);})[_0x5120('0x21')](function(_0x2bdc87){_0xdb308e[_0x5120('0x6f')]=_0x2bdc87;return _0xdb308e;});}})[_0x5120('0x21')](respondWithFilteredResult(_0x38daf5,_0x23127b))[_0x5120('0x58')](handleError(_0x38daf5,null));};exports[_0x5120('0x70')]=function(_0x80d401,_0x529390,_0x54bdbb){return db[_0x5120('0x55')]['find']({'where':{'id':_0x80d401[_0x5120('0x5a')]['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x529390,null))[_0x5120('0x21')](function(_0x3a9a78){if(_0x3a9a78){return _0x3a9a78[_0x5120('0x70')](_0x80d401[_0x5120('0x47')]['ids']);}})[_0x5120('0x21')](respondWithStatusCode(_0x529390,null))[_0x5120('0x58')](handleError(_0x529390,null));};exports[_0x5120('0x71')]=function(_0x3dede1,_0x1dc5ae,_0x4a685c){if(_0x3dede1['body']['id']){delete _0x3dede1[_0x5120('0x5f')]['id'];}return db[_0x5120('0x55')][_0x5120('0x5d')]({'where':{'id':_0x3dede1['params']['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x1dc5ae,null))['then'](function(_0xba759d){if(_0xba759d){_0x3dede1[_0x5120('0x5f')][_0x5120('0x69')]=_0xba759d['id'];return db[_0x5120('0x72')][_0x5120('0x5e')](_0x3dede1[_0x5120('0x5f')]);}})[_0x5120('0x21')](respondWithResult(_0x1dc5ae,null))[_0x5120('0x58')](handleError(_0x1dc5ae,null));};exports[_0x5120('0x73')]=function(_0x342733,_0x2000cc,_0x5441e8){var _0x2fce39={'raw':![],'where':{}};var _0x4ef7f8={};var _0x13373c={'count':0x0,'rows':[]};return db[_0x5120('0x55')][_0x5120('0x6c')]({'where':{'id':_0x342733['params']['id']}})['then'](handleEntityNotFound(_0x2000cc,null))[_0x5120('0x21')](function(_0x43c8f7){if(_0x43c8f7){_0x4ef7f8[_0x5120('0x46')]=_[_0x5120('0x5b')](db['CannedAnswer']['rawAttributes']);_0x4ef7f8[_0x5120('0x47')]=_['keys'](_0x342733[_0x5120('0x47')]);_0x4ef7f8[_0x5120('0x48')]=_[_0x5120('0x49')](_0x4ef7f8['model'],_0x4ef7f8[_0x5120('0x47')]);_0x2fce39[_0x5120('0x4a')]=_['intersection'](_0x4ef7f8[_0x5120('0x46')],qs[_0x5120('0x4b')](_0x342733[_0x5120('0x47')]['fields']));_0x2fce39[_0x5120('0x4a')]=_0x2fce39[_0x5120('0x4a')]['length']?_0x2fce39[_0x5120('0x4a')]:_0x4ef7f8[_0x5120('0x46')];if(!_0x342733[_0x5120('0x47')][_0x5120('0x4c')](_0x5120('0x4d'))){_0x2fce39[_0x5120('0x30')]=qs[_0x5120('0x30')](_0x342733[_0x5120('0x47')][_0x5120('0x30')]);_0x2fce39[_0x5120('0x2e')]=qs['offset'](_0x342733['query'][_0x5120('0x2e')]);}_0x2fce39['order']=qs['sort'](_0x342733['query']['sort']);_0x2fce39[_0x5120('0x50')]=qs[_0x5120('0x48')](_[_0x5120('0x6d')](_0x342733[_0x5120('0x47')],_0x4ef7f8[_0x5120('0x48')]));_0x2fce39[_0x5120('0x50')]['WhatsappAccountId']=_0x43c8f7['id'];if(_0x342733[_0x5120('0x47')][_0x5120('0x51')]){_0x2fce39[_0x5120('0x50')]=_[_0x5120('0x52')](_0x2fce39[_0x5120('0x50')],{'$or':_[_0x5120('0x42')](_0x2fce39[_0x5120('0x4a')],function(_0x2336c2){var _0x54f150={};_0x54f150[_0x2336c2]={'$like':'%'+_0x342733['query'][_0x5120('0x51')]+'%'};return _0x54f150;})});}_0x2fce39=_[_0x5120('0x52')]({},_0x2fce39,_0x342733[_0x5120('0x54')]);return db['CannedAnswer'][_0x5120('0x31')]({'where':_0x2fce39[_0x5120('0x50')]})[_0x5120('0x21')](function(_0x181ecf){_0x13373c[_0x5120('0x31')]=_0x181ecf;if(_0x342733[_0x5120('0x47')]['includeAll']){_0x2fce39[_0x5120('0x6e')]=[{'all':!![]}];}return db[_0x5120('0x72')][_0x5120('0x57')](_0x2fce39);})[_0x5120('0x21')](function(_0x2ae7db){_0x13373c[_0x5120('0x6f')]=_0x2ae7db;return _0x13373c;});}})[_0x5120('0x21')](respondWithFilteredResult(_0x2000cc,_0x2fce39))['catch'](handleError(_0x2000cc,null));};exports[_0x5120('0x74')]=function(_0x3b6232,_0x21c448,_0x4a8729){return db[_0x5120('0x55')][_0x5120('0x5d')]({'where':{'id':_0x3b6232[_0x5120('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21c448,null))['then'](function(_0x217f10){if(_0x217f10){return _0x217f10[_0x5120('0x74')](_0x3b6232['query'][_0x5120('0x75')]);}})['then'](respondWithStatusCode(_0x21c448,null))[_0x5120('0x58')](handleError(_0x21c448,null));};exports[_0x5120('0x76')]=function(_0x45a8e6,_0x44f5bd,_0x2a953c){return db['WhatsappAccount']['find']({'where':{'id':_0x45a8e6[_0x5120('0x5a')]['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x44f5bd,null))[_0x5120('0x21')](function(_0x5961b3){if(_0x5961b3){return _0x5961b3[_0x5120('0x76')](_0x45a8e6['body'][_0x5120('0x75')],_[_0x5120('0x77')](_0x45a8e6[_0x5120('0x5f')],[_0x5120('0x75'),'id'])||{})[_0x5120('0x78')](function(_0x543427){for(var _0x46ec58=0x0;_0x46ec58<_0x45a8e6[_0x5120('0x5f')]['ids']['length'];_0x46ec58+=0x1){socket[_0x5120('0x79')](_0x5120('0x7a'),{'UserId':Number(_0x45a8e6['body'][_0x5120('0x75')][_0x46ec58]),'WhatsappAccountId':Number(_0x45a8e6[_0x5120('0x5a')]['id'])});}return _0x543427;});}})[_0x5120('0x21')](respondWithResult(_0x44f5bd,null))[_0x5120('0x58')](handleError(_0x44f5bd,null));};exports[_0x5120('0x7b')]=function(_0x40ac6a,_0x59555d,_0x260be3){return db['WhatsappAccount'][_0x5120('0x5d')]({'where':{'id':_0x40ac6a[_0x5120('0x5a')]['id']}})['then'](handleEntityNotFound(_0x59555d,null))[_0x5120('0x21')](function(_0x140d8d){if(_0x140d8d){return _0x140d8d['removeAgents'](_0x40ac6a[_0x5120('0x47')][_0x5120('0x75')])[_0x5120('0x21')](function(){if(_[_0x5120('0x7c')](_0x40ac6a[_0x5120('0x47')][_0x5120('0x75')])){for(var _0x2da00e=0x0;_0x2da00e<_0x40ac6a[_0x5120('0x47')][_0x5120('0x75')][_0x5120('0x5c')];_0x2da00e+=0x1){socket[_0x5120('0x79')](_0x5120('0x7d'),{'UserId':Number(_0x40ac6a[_0x5120('0x47')]['ids'][_0x2da00e]),'WhatsappAccountId':Number(_0x40ac6a['params']['id'])});}}else{socket[_0x5120('0x79')](_0x5120('0x7d'),{'UserId':Number(_0x40ac6a[_0x5120('0x47')]['ids']),'WhatsappAccountId':Number(_0x40ac6a[_0x5120('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x59555d,null))[_0x5120('0x58')](handleError(_0x59555d,null));};exports[_0x5120('0x7e')]=function(_0x32de7e,_0x28f174,_0x1c0e45){var _0x21e90e={};var _0x346581={};var _0x1d15e4;var _0x172cc8;return db[_0x5120('0x55')][_0x5120('0x6c')]({'where':{'id':_0x32de7e[_0x5120('0x5a')]['id']}})[_0x5120('0x21')](handleEntityNotFound(_0x28f174,null))['then'](function(_0x2b63bf){if(_0x2b63bf){_0x1d15e4=_0x2b63bf;_0x346581[_0x5120('0x46')]=_[_0x5120('0x5b')](db['User'][_0x5120('0x43')]);_0x346581[_0x5120('0x47')]=_['keys'](_0x32de7e[_0x5120('0x47')]);_0x346581[_0x5120('0x48')]=_[_0x5120('0x49')](_0x346581[_0x5120('0x46')],_0x346581['query']);_0x21e90e[_0x5120('0x4a')]=_[_0x5120('0x49')](_0x346581[_0x5120('0x46')],qs[_0x5120('0x4b')](_0x32de7e[_0x5120('0x47')][_0x5120('0x4b')]));_0x21e90e[_0x5120('0x4a')]=_0x21e90e[_0x5120('0x4a')][_0x5120('0x5c')]?_0x21e90e['attributes']:_0x346581['model'];_0x21e90e[_0x5120('0x4e')]=qs['sort'](_0x32de7e[_0x5120('0x47')][_0x5120('0x4f')]);_0x21e90e['where']=qs['filters'](_[_0x5120('0x6d')](_0x32de7e[_0x5120('0x47')],_0x346581[_0x5120('0x48')]));if(_0x32de7e['query']['filter']){_0x21e90e['where']=_['merge'](_0x21e90e[_0x5120('0x50')],{'$or':_['map'](_0x21e90e[_0x5120('0x4a')],function(_0x3f50ea){var _0x3f62bf={};_0x3f62bf[_0x3f50ea]={'$like':'%'+_0x32de7e['query'][_0x5120('0x51')]+'%'};return _0x3f62bf;})});}_0x21e90e=_[_0x5120('0x52')]({},_0x21e90e,_0x32de7e['options']);return _0x1d15e4[_0x5120('0x7e')](_0x21e90e);}})['then'](function(_0x4ef262){if(_0x4ef262){_0x172cc8=_0x4ef262[_0x5120('0x5c')];if(!_0x32de7e['query'][_0x5120('0x4c')]('nolimit')){_0x21e90e[_0x5120('0x30')]=qs[_0x5120('0x30')](_0x32de7e[_0x5120('0x47')][_0x5120('0x30')]);_0x21e90e[_0x5120('0x2e')]=qs[_0x5120('0x2e')](_0x32de7e[_0x5120('0x47')]['offset']);}return _0x1d15e4[_0x5120('0x7e')](_0x21e90e);}})[_0x5120('0x21')](function(_0x13cc95){if(_0x13cc95){return _0x13cc95?{'count':_0x172cc8,'rows':_0x13cc95}:null;}})['then'](respondWithResult(_0x28f174,null))[_0x5120('0x58')](handleError(_0x28f174,null));};exports['addApplications']=function(_0x23a25,_0x25d36e){var _0x118812=_0x23a25[_0x5120('0x5a')]['id'];var _0x3228c0=_0x23a25['body'];var _0x19a2f6=0xc8;var _0x4a0d23=null;return db['sequelize'][_0x5120('0x7f')]({'isolationLevel':db[_0x5120('0x80')]['Transaction'][_0x5120('0x81')]['READ_COMMITTED']},function(_0x11b4d9){return db[_0x5120('0x55')][_0x5120('0x6c')]({'where':{'id':_0x118812},'transaction':_0x11b4d9})['then'](function(_0x3b82aa){if(_0x3b82aa){return db[_0x5120('0x82')][_0x5120('0x3b')]({'where':{'WhatsappAccountId':_0x118812},'transaction':_0x11b4d9})[_0x5120('0x21')](function(){var _0x5f40b5=_[_0x5120('0x42')](_0x3228c0,function(_0x296265){_0x296265['WhatsappAccountId']=_0x118812;return _0x296265;});return db['WhatsappApplication'][_0x5120('0x83')](_0x5f40b5,{'transaction':_0x11b4d9});});}else{_0x19a2f6=0x194;_0x4a0d23=[];}});})['then'](function(){if(_0x19a2f6!==0x194){return db[_0x5120('0x82')][_0x5120('0x84')]({'where':{'WhatsappAccountId':_0x118812},'order':_0x5120('0x85')})[_0x5120('0x21')](function(_0x39f060){_0x4a0d23=_0x39f060;});}})[_0x5120('0x58')](function(_0xc3c8e0){_0x19a2f6=0x1f4;logger['error'](_0xc3c8e0[_0x5120('0x3d')]);if(_0xc3c8e0[_0x5120('0x3e')]){delete _0xc3c8e0['name'];}_0x4a0d23=_0xc3c8e0;})[_0x5120('0x86')](function(){if(_0x4a0d23===null){_0x25d36e[_0x5120('0x2b')](_0x19a2f6);}else{if(_0x19a2f6===0x1f4){_0x25d36e[_0x5120('0x2c')](_0x19a2f6)['send'](_0x4a0d23);}else{_0x25d36e[_0x5120('0x2c')](_0x19a2f6)[_0x5120('0x2d')](_0x4a0d23);}}});};exports['getApplications']=function(_0x185f6c,_0x2a5772,_0x28f019){var _0x5ec889={};var _0x2f9c13={};var _0xf0f411;var _0x3f7db7;return db[_0x5120('0x55')]['findOne']({'where':{'id':_0x185f6c[_0x5120('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a5772,null))[_0x5120('0x21')](function(_0x520545){if(_0x520545){_0xf0f411=_0x520545;_0x2f9c13[_0x5120('0x46')]=_[_0x5120('0x5b')](db['WhatsappApplication']['rawAttributes']);_0x2f9c13['query']=_[_0x5120('0x5b')](_0x185f6c['query']);_0x2f9c13[_0x5120('0x48')]=_[_0x5120('0x49')](_0x2f9c13[_0x5120('0x46')],_0x2f9c13['query']);_0x5ec889[_0x5120('0x4a')]=_[_0x5120('0x49')](_0x2f9c13['model'],qs[_0x5120('0x4b')](_0x185f6c[_0x5120('0x47')][_0x5120('0x4b')]));_0x5ec889[_0x5120('0x4a')]=_0x5ec889['attributes']['length']?_0x5ec889[_0x5120('0x4a')]:_0x2f9c13['model'];_0x5ec889[_0x5120('0x4e')]=qs['sort'](_0x185f6c['query'][_0x5120('0x4f')]);_0x5ec889[_0x5120('0x50')]=qs[_0x5120('0x48')](_[_0x5120('0x6d')](_0x185f6c[_0x5120('0x47')],_0x2f9c13[_0x5120('0x48')]));if(_0x185f6c[_0x5120('0x47')][_0x5120('0x51')]){_0x5ec889[_0x5120('0x50')]=_[_0x5120('0x52')](_0x5ec889['where'],{'$or':_[_0x5120('0x42')](_0x5ec889[_0x5120('0x4a')],function(_0x531ce0){var _0x1c0f33={};_0x1c0f33[_0x531ce0]={'$like':'%'+_0x185f6c['query'][_0x5120('0x51')]+'%'};return _0x1c0f33;})});}_0x5ec889=_[_0x5120('0x52')]({},_0x5ec889,_0x185f6c['options']);return _0xf0f411[_0x5120('0x87')](_0x5ec889);}})[_0x5120('0x21')](function(_0x44f592){if(_0x44f592){_0x3f7db7=_0x44f592[_0x5120('0x5c')];if(!_0x185f6c[_0x5120('0x47')][_0x5120('0x4c')](_0x5120('0x4d'))){_0x5ec889[_0x5120('0x30')]=qs['limit'](_0x185f6c[_0x5120('0x47')][_0x5120('0x30')]);_0x5ec889['offset']=qs[_0x5120('0x2e')](_0x185f6c[_0x5120('0x47')][_0x5120('0x2e')]);}return _0xf0f411['getApplications'](_0x5ec889);}})[_0x5120('0x21')](function(_0x5a1fbc){if(_0x5a1fbc){return _0x5a1fbc?{'count':_0x3f7db7,'rows':_0x5a1fbc}:null;}})['then'](respondWithResult(_0x2a5772,null))[_0x5120('0x58')](handleError(_0x2a5772,null));};exports[_0x5120('0x88')]=function(_0x26bdda,_0x36ea77,_0x3a32a9){var _0x1c880f={'channel':_0x5120('0x89')};var _0x1dce8d=[];var _0x40bc55=[];var _0x3a711e={};return db[_0x5120('0x55')][_0x5120('0x5d')]({'where':{'id':_0x26bdda[_0x5120('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5120('0x21')](handleEntityNotFound(_0x36ea77,null))['then'](function(_0x49a6e0){_0x1c880f[_0x5120('0x8a')]=_0x49a6e0;if(_0x1c880f[_0x5120('0x8a')]&&_0x1c880f[_0x5120('0x8a')]['type']===_0x5120('0x8b')&&_0x26bdda[_0x5120('0x5f')]['statuses']){if(_0x26bdda[_0x5120('0x5f')]['statuses'][_0x5120('0x5c')]===0x0)return;if(_0x26bdda['body'][_0x5120('0x8c')][0x0][_0x5120('0x8d')]!==_0x5120('0x8e'))return;return db[_0x5120('0x8f')][_0x5120('0x37')]({'read':!![],'readAt':_0x26bdda[_0x5120('0x5f')][_0x5120('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x26bdda[_0x5120('0x5f')][_0x5120('0x8c')][0x0][_0x5120('0x90')]},'individualHooks':!![]})['then'](function(_0x45844e){return _0x36ea77['status'](0xc8)[_0x5120('0x2d')](_0x45844e);});}_0x1c880f[_0x5120('0x91')]=_[_0x5120('0x92')](_0x49a6e0[_0x5120('0x93')],['priority'],[_0x5120('0x94')]);if(_0x1c880f['account'][_0x5120('0x93')]){delete _0x1c880f[_0x5120('0x8a')][_0x5120('0x93')];}return db[_0x5120('0x95')]['describe']()[_0x5120('0x21')](function(_0x399522){if(!_0x399522){throw new db[(_0x5120('0x96'))][(_0x5120('0x97'))](_0x5120('0x98'));}_0x1dce8d=_['difference'](_[_0x5120('0x5b')](_0x399522),[_0x5120('0x99'),_0x5120('0x9a')]);_0x40bc55=_[_0x5120('0x9b')](_['keys'](_0x399522),[_0x5120('0x99'),_0x5120('0x9a'),_0x5120('0x9c'),_0x5120('0x9d')]);_0x1c880f['body']={'mapKey':'mobile'};if(_0x1c880f[_0x5120('0x8a')]&&_0x1c880f[_0x5120('0x8a')]['type']===_0x5120('0x9e')){_0x1c880f['body'][_0x5120('0x9f')]=_0x26bdda['body']['From'][_0x5120('0xa0')](_0x5120('0xa1'),'');_0x1c880f[_0x5120('0x5f')]['body']=_0x26bdda['body']['Body'];_0x1c880f['body'][_0x5120('0xa2')]=_0x26bdda[_0x5120('0x5f')][_0x5120('0xa3')];}if(_0x1c880f['account']&&_0x1c880f[_0x5120('0x8a')]['type']===_0x5120('0x8b')){_0x1c880f[_0x5120('0x5f')][_0x5120('0x9f')]=_0x26bdda['body'][_0x5120('0xa4')][0x0][_0x5120('0x9f')];_0x1c880f[_0x5120('0x5f')][_0x5120('0x5f')]=_0x26bdda['body'][_0x5120('0xa4')][0x0]['message']['body'];_0x1c880f['body'][_0x5120('0xa2')]=_0x26bdda[_0x5120('0x5f')]['notifications'][0x0][_0x5120('0x90')];}if(_0x1c880f[_0x5120('0x5f')]['id']){delete _0x1c880f[_0x5120('0x5f')]['id'];}if(_['isNil'](_0x1c880f[_0x5120('0x5f')][_0x5120('0x9f')])){throw new db[(_0x5120('0x96'))][(_0x5120('0x97'))](_0x5120('0xa5'));}if(_[_0x5120('0xa6')](_0x1c880f[_0x5120('0x5f')][_0x5120('0x5f')])||_0x1c880f['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5120('0xa6')](_0x1c880f[_0x5120('0x5f')][_0x5120('0xa7')])){throw new db[(_0x5120('0x96'))][(_0x5120('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40bc55);}if(!_[_0x5120('0xa8')](_0x40bc55,_0x1c880f[_0x5120('0x5f')][_0x5120('0xa7')])){throw new db[(_0x5120('0x96'))][(_0x5120('0x97'))](_0x5120('0xa9')+_0x40bc55);}_0x3a711e[_0x1c880f[_0x5120('0x5f')][_0x5120('0xa7')]]=_0x1c880f['body']['from'];return db[_0x5120('0xaa')]['find']({'where':{'id':_0x1c880f[_0x5120('0x8a')][_0x5120('0x9d')]},'include':[{'model':db[_0x5120('0x95')],'as':_0x5120('0xab'),'where':_0x3a711e,'limit':0x1,'order':[[_0x5120('0x9a'),_0x5120('0xac')]]}]});})[_0x5120('0x21')](handleEntityNotFound(_0x36ea77,null))[_0x5120('0x21')](function(_0x3790ed){if(_0x3790ed){_0x1c880f[_0x5120('0xad')]=_['omit'](_0x3790ed,['Contacts']);if(_0x3790ed[_0x5120('0xab')][_0x5120('0x5c')]){return _0x3790ed[_0x5120('0xab')][0x0];}var _0x106b2c=_[_0x5120('0x19')](_0x1c880f[_0x5120('0x5f')],{'firstName':_0x1c880f[_0x5120('0x5f')][_0x5120('0x9f')],'ListId':_0x3790ed['id']});_0x106b2c[_0x1c880f['body'][_0x5120('0xa7')]]=_0x1c880f['body'][_0x5120('0x9f')];return db[_0x5120('0x95')][_0x5120('0x5e')](_0x106b2c,{'fields':_0x1dce8d,'raw':!![]});}})['then'](handleEntityNotFound(_0x36ea77,null))[_0x5120('0x21')](function(_0x4b1760){if(_0x4b1760){_0x1c880f['contact']=_0x4b1760;var _0x37d4d9={'ContactId':_0x4b1760['id'],'phone':_0x1c880f[_0x5120('0x5f')][_0x5120('0x9f')],'WhatsappAccountId':_0x26bdda[_0x5120('0x5a')]['id']};var _0x23588d={'ContactId':_0x4b1760['id'],'WhatsappAccountId':_0x26bdda[_0x5120('0x5a')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x5120('0x5d')]({'where':_0x23588d})[_0x5120('0x21')](function(_0x3d0688){if(_0x3d0688){return[_0x3d0688,![]];}return db[_0x5120('0xae')]['create'](_0x37d4d9)[_0x5120('0x21')](function(_0x537cab){return[_0x537cab,!![]];});});}})[_0x5120('0x78')](function(_0x142378,_0x5298ca){_0x1c880f['interaction']=_0x142378['get']({'plain':!![]});_0x1c880f['interaction']['created']=![];if(_0x5298ca){if(_0x1c880f['account']['autoclose']){_0x1c880f[_0x5120('0x91')][_0x5120('0xaf')]({'id':0x0,'priority':_0x1c880f[_0x5120('0x91')]['length']+0x1,'app':_0x5120('0xb0'),'appdata':_0x5120('0xb1'),'interval':_0x5120('0xb2')});}_0x1c880f[_0x5120('0xb3')][_0x5120('0xb4')]=!![];}return db[_0x5120('0x8f')][_0x5120('0x5e')]({'phone':_0x1c880f['body'][_0x5120('0x9f')],'messageId':_0x1c880f[_0x5120('0x5f')][_0x5120('0xa2')],'body':_0x1c880f['body']['body'],'WhatsappAccountId':_0x26bdda['params']['id'],'WhatsappInteractionId':_0x142378['id'],'direction':'in','ContactId':_0x142378['ContactId'],'AttachmentId':_0x1c880f[_0x5120('0x5f')][_0x5120('0xb5')]});})[_0x5120('0x21')](function(_0x461060){_0x1c880f[_0x5120('0x29')]=_0x461060;if(_0x1c880f[_0x5120('0xb3')][_0x5120('0xb6')]){return db[_0x5120('0xb7')][_0x5120('0x5d')]({'attributes':['id',_0x5120('0x3e')],'where':{'id':_0x1c880f['interaction'][_0x5120('0xb6')]}})[_0x5120('0x21')](function(_0x59e53f){if(_0x59e53f){_0x1c880f['applications'][_0x5120('0xb8')]({'id':0x0,'priority':0x0,'app':_0x5120('0xb9'),'appdata':_0x59e53f[_0x5120('0x3e')]+','+(_0x1c880f['account']['waitForTheAssignedAgent']||0xa),'interval':_0x5120('0xb2')});}return respondWithRpcPromise(_0x5120('0xba'),_0x5120('0xbb'),_0x1c880f);});}return respondWithRpcPromise('Start',_0x5120('0xbb'),_0x1c880f);})['then'](function(_0x4c640d){if(_0x4c640d){var _0x152130=0xc8;var _0x5e635f='receiveMessage';logger[_0x5120('0xbc')](_0x5120('0x25'),_0x5e635f,_0x152130,'entity\x20found');logger[_0x5120('0x24')](_0x5120('0xbd'),_0x5e635f,_0x152130,_0x5120('0xbe'),JSON[_0x5120('0x26')](_0x4c640d));if(_0x1c880f['account'][_0x5120('0x44')]===_0x5120('0x9e')){return _0x36ea77['status'](_0x152130)[_0x5120('0x32')]('Content-Type',_0x5120('0xbf'))[_0x5120('0x3f')]('\x0a');}else{return _0x36ea77[_0x5120('0x2c')](_0x152130)['json'](_0x4c640d);}}});})[_0x5120('0x58')](handleError(_0x36ea77,null));};exports[_0x5120('0x3f')]=function(_0x36bd33,_0x1cdb4f,_0xe0ea6b){var _0x365e2a,_0x2641f3,_0x35a7dc;if(_['isNil'](_0x36bd33[_0x5120('0x5f')][_0x5120('0x5f')])||_0x36bd33[_0x5120('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5120('0xa6')](_0x36bd33[_0x5120('0x5f')]['to'])){throw new db[(_0x5120('0x96'))]['ValidationError'](_0x5120('0xc0'));}_0x365e2a=_0x36bd33['body']['to'];return db[_0x5120('0x55')][_0x5120('0x5d')]({'where':{'id':_0x36bd33[_0x5120('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x5120('0xc1'),'include':[{'model':db[_0x5120('0x95')],'as':'Contacts','where':{'mobile':_0x365e2a},'limit':0x1,'order':[[_0x5120('0x9a'),_0x5120('0xac')]]}]}]})[_0x5120('0x21')](handleEntityNotFound(_0x1cdb4f,null))[_0x5120('0x21')](function(_0x109e0a){if(_0x109e0a&&_0x109e0a[_0x5120('0xc1')]){_0x2641f3=_0x109e0a[_0x5120('0x38')]({'plain':!![]});if(_0x2641f3[_0x5120('0xc1')]&&_0x2641f3[_0x5120('0xc1')][_0x5120('0xab')][_0x5120('0x5c')]){return _0x2641f3[_0x5120('0xc1')][_0x5120('0xab')][0x0];}return db[_0x5120('0x95')]['create'](_[_0x5120('0x19')](_0x36bd33[_0x5120('0x5f')],{'firstName':_0x365e2a,'mobile':_0x365e2a,'phone':_0x365e2a,'ListId':_0x2641f3[_0x5120('0x9d')]}));}})[_0x5120('0x21')](handleEntityNotFound(_0x1cdb4f,null))[_0x5120('0x21')](function(_0x1649f3){if(_0x1649f3){_0x35a7dc=_0x1649f3;return db[_0x5120('0xae')][_0x5120('0x5d')]({'where':{'ContactId':_0x35a7dc['id'],'closed':![],'WhatsappAccountId':_0x2641f3['id']}})[_0x5120('0x21')](function(_0x4ddff7){if(_0x4ddff7){return[_0x4ddff7,![]];}return db[_0x5120('0xae')][_0x5120('0x5e')]({'UserId':_0x36bd33[_0x5120('0x60')]['id'],'ContactId':_0x35a7dc['id'],'WhatsappAccountId':_0x2641f3['id'],'phone':_0x365e2a,'firstMsgDirection':'out','Messages':[_[_0x5120('0x52')](_0x36bd33[_0x5120('0x5f')],{'read':![],'body':_0x36bd33[_0x5120('0x5f')][_0x5120('0x5f')],'phone':_0x365e2a,'WhatsappAccountId':_0x2641f3['id'],'UserId':_0x36bd33[_0x5120('0x60')]['id'],'ContactId':_0x35a7dc['id']})]},{'include':[{'model':db[_0x5120('0x8f')],'as':_0x5120('0xc2')}]})[_0x5120('0x21')](function(_0x4e6a90){return[_0x4e6a90,!![]];});});}})[_0x5120('0x78')](function(_0x3837ba,_0x2f4b7d){if(_0x2f4b7d){return _0x3837ba;}return db[_0x5120('0x8f')][_0x5120('0x5e')](_[_0x5120('0x52')](_0x36bd33[_0x5120('0x5f')],{'read':![],'body':_0x36bd33[_0x5120('0x5f')][_0x5120('0x5f')],'phone':_0x365e2a,'WhatsappAccountId':_0x2641f3['id'],'WhatsappInteractionId':_0x3837ba['id'],'UserId':_0x36bd33[_0x5120('0x60')]['id'],'ContactId':_0x35a7dc['id']}))[_0x5120('0x21')](function(_0x315b03){_0x3837ba['dataValues'][_0x5120('0xc2')]=[];_0x3837ba[_0x5120('0xc3')]['Messages'][_0x5120('0xaf')](_0x315b03['dataValues']);return _0x3837ba;});})[_0x5120('0x21')](respondWithResult(_0x1cdb4f,null))['catch'](handleError(_0x1cdb4f,null));}; \ No newline at end of file +var _0x945d=['ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','autoclose','applications','push','unmanaged','*,*,*,*','created','ContactId','User','unshift','agent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','user','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','WhatsappAccountId','findOne','hasOwnProperty','order','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x52df90,_0x2dfd20){var _0x34ace2=function(_0x6fdcf1){while(--_0x6fdcf1){_0x52df90['push'](_0x52df90['shift']());}};_0x34ace2(++_0x2dfd20);}(_0x945d,0xf9));var _0xd945=function(_0x50e256,_0x198d56){_0x50e256=_0x50e256-0x0;var _0x2028ce=_0x945d[_0x50e256];return _0x2028ce;};'use strict';var emlformat=require(_0xd945('0x0'));var rimraf=require(_0xd945('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd945('0x2'));var rp=require(_0xd945('0x3'));var moment=require('moment');var BPromise=require(_0xd945('0x4'));var Mustache=require(_0xd945('0x5'));var util=require(_0xd945('0x6'));var path=require(_0xd945('0x7'));var sox=require('sox');var csv=require(_0xd945('0x8'));var ejs=require(_0xd945('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd945('0xa'));var squel=require(_0xd945('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd945('0x8'));var querystring=require(_0xd945('0xc'));var Papa=require(_0xd945('0xd'));var Redis=require('ioredis');var authService=require(_0xd945('0xe'));var qs=require(_0xd945('0xf'));var as=require(_0xd945('0x10'));var hardwareService=require(_0xd945('0x11'));var logger=require(_0xd945('0x12'))(_0xd945('0x13'));var utils=require(_0xd945('0x14'));var config=require(_0xd945('0x15'));var licenseUtil=require(_0xd945('0x16'));var db=require(_0xd945('0x17'))['db'];config[_0xd945('0x18')]=_[_0xd945('0x19')](config['redis'],{'host':_0xd945('0x1a'),'port':0x18eb});var socket=require(_0xd945('0x1b'))(new Redis(config[_0xd945('0x18')]));require(_0xd945('0x1c'))[_0xd945('0x1d')](socket);var jayson=require(_0xd945('0x1e'));var client=jayson['client'][_0xd945('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xcf2379,_0x81b9a0,_0x5e4282,_0x1bf658){return new BPromise(function(_0x1bcaa3,_0x14cabc){var _0x3277e5=_0x1bf658||client;return _0x3277e5[_0xd945('0x20')](_0xcf2379,_0x5e4282)[_0xd945('0x21')](function(_0x4aa14d){logger[_0xd945('0x22')](_0xd945('0x23'),_0x81b9a0,'request\x20sent');logger[_0xd945('0x24')](_0xd945('0x25'),_0x81b9a0,_0xd945('0x26'),JSON[_0xd945('0x27')](_0x4aa14d));if(_0x4aa14d[_0xd945('0x28')]){if(_0x4aa14d[_0xd945('0x28')][_0xd945('0x29')]===0x1f4){logger[_0xd945('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x81b9a0,_0x4aa14d[_0xd945('0x28')][_0xd945('0x2a')]);return _0x14cabc(_0x4aa14d[_0xd945('0x28')]['message']);}logger['error'](_0xd945('0x23'),_0x81b9a0,_0x4aa14d[_0xd945('0x28')][_0xd945('0x2a')]);return _0x1bcaa3(_0x4aa14d[_0xd945('0x28')][_0xd945('0x2a')]);}else{logger[_0xd945('0x22')](_0xd945('0x23'),_0x81b9a0,_0xd945('0x26'));_0x1bcaa3(_0x4aa14d[_0xd945('0x2b')][_0xd945('0x2a')]);}})['catch'](function(_0x23e8d1){logger[_0xd945('0x28')](_0xd945('0x23'),_0x81b9a0,_0x23e8d1);_0x14cabc(_0x23e8d1);});});}function respondWithStatusCode(_0x93b01,_0x203eb2){_0x203eb2=_0x203eb2||0xcc;return function(_0x290cc2){if(_0x290cc2){return _0x93b01[_0xd945('0x2c')](_0x203eb2);}return _0x93b01['status'](_0x203eb2)[_0xd945('0x2d')]();};}function respondWithResult(_0x173313,_0xb54044){_0xb54044=_0xb54044||0xc8;return function(_0x389a0c){if(_0x389a0c){return _0x173313['status'](_0xb54044)[_0xd945('0x2e')](_0x389a0c);}};}function respondWithFilteredResult(_0x18a5e9,_0x4d2be0){return function(_0xd95bdc){if(_0xd95bdc){var _0x5b7b98=typeof _0x4d2be0[_0xd945('0x2f')]==='undefined'&&typeof _0x4d2be0[_0xd945('0x30')]===_0xd945('0x31');var _0x2f31c3=_0xd95bdc[_0xd945('0x32')];var _0x59d164=_0x5b7b98?0x0:_0x4d2be0[_0xd945('0x2f')];var _0x666bb5=_0x5b7b98?_0xd95bdc[_0xd945('0x32')]:_0x4d2be0[_0xd945('0x2f')]+_0x4d2be0[_0xd945('0x30')];var _0x3a94cf;if(_0x666bb5>=_0x2f31c3){_0x666bb5=_0x2f31c3;_0x3a94cf=0xc8;}else{_0x3a94cf=0xce;}_0x18a5e9[_0xd945('0x33')](_0x3a94cf);return _0x18a5e9[_0xd945('0x34')](_0xd945('0x35'),_0x59d164+'-'+_0x666bb5+'/'+_0x2f31c3)[_0xd945('0x2e')](_0xd95bdc);}return null;};}function patchUpdates(_0x45244f){return function(_0x5d3af6){try{jsonpatch[_0xd945('0x36')](_0x5d3af6,_0x45244f,!![]);}catch(_0x58d9db){return BPromise['reject'](_0x58d9db);}return _0x5d3af6[_0xd945('0x37')]();};}function saveUpdates(_0x2eec92,_0x583b70){return function(_0x30dac0){if(_0x30dac0){return _0x30dac0[_0xd945('0x38')](_0x2eec92)[_0xd945('0x21')](function(_0x3d7dec){return _0x3d7dec;});}return null;};}function removeEntity(_0x1475ec,_0x54d6d9){return function(_0x427856){if(_0x427856){return _0x427856[_0xd945('0x39')]()[_0xd945('0x21')](function(){var _0x19918e=_0x427856[_0xd945('0x3a')]({'plain':!![]});var _0x230d10=_0xd945('0x3b');return db[_0xd945('0x3c')]['destroy']({'where':{'type':_0x230d10,'resourceId':_0x19918e['id']}})['then'](function(){return _0x427856;});})[_0xd945('0x21')](function(){_0x1475ec['status'](0xcc)[_0xd945('0x2d')]();});}};}function handleEntityNotFound(_0x12632c,_0x3451b5){return function(_0x4dc070){if(!_0x4dc070){_0x12632c[_0xd945('0x2c')](0x194);}return _0x4dc070;};}function handleError(_0x2e7631,_0x328cf7){_0x328cf7=_0x328cf7||0x1f4;return function(_0x3128df){logger['error'](_0x3128df[_0xd945('0x3d')]);if(_0x3128df[_0xd945('0x3e')]){delete _0x3128df[_0xd945('0x3e')];}_0x2e7631[_0xd945('0x33')](_0x328cf7)[_0xd945('0x3f')](_0x3128df);};}exports[_0xd945('0x40')]=function(_0x88b9bd,_0x2746d0){var _0x44b556={'include':[{'model':db[_0xd945('0x41')],'as':_0xd945('0x42')}]},_0x3c29d6={},_0x51045e={'count':0x0,'rows':[]};var _0x4a99ac=_[_0xd945('0x43')](db[_0xd945('0x44')][_0xd945('0x45')],function(_0x37cf7c){return{'name':_0x37cf7c[_0xd945('0x46')],'type':_0x37cf7c[_0xd945('0x47')]['key']};});_0x3c29d6[_0xd945('0x48')]=_[_0xd945('0x43')](_0x4a99ac,_0xd945('0x3e'));_0x3c29d6[_0xd945('0x49')]=_[_0xd945('0x4a')](_0x88b9bd[_0xd945('0x49')]);_0x3c29d6[_0xd945('0x4b')]=_[_0xd945('0x4c')](_0x3c29d6['model'],_0x3c29d6[_0xd945('0x49')]);_0x44b556[_0xd945('0x4d')]=_[_0xd945('0x4c')](_0x3c29d6['model'],qs['fields'](_0x88b9bd[_0xd945('0x49')][_0xd945('0x4e')]));_0x44b556[_0xd945('0x4d')]=_0x44b556[_0xd945('0x4d')][_0xd945('0x4f')]?_0x44b556[_0xd945('0x4d')]:_0x3c29d6['model'];if(!_0x88b9bd[_0xd945('0x49')]['hasOwnProperty'](_0xd945('0x50'))){_0x44b556['limit']=qs[_0xd945('0x30')](_0x88b9bd[_0xd945('0x49')]['limit']);_0x44b556[_0xd945('0x2f')]=qs[_0xd945('0x2f')](_0x88b9bd[_0xd945('0x49')][_0xd945('0x2f')]);}_0x44b556['order']=qs[_0xd945('0x51')](_0x88b9bd[_0xd945('0x49')][_0xd945('0x51')]);_0x44b556[_0xd945('0x52')]=qs['filters'](_[_0xd945('0x53')](_0x88b9bd['query'],_0x3c29d6[_0xd945('0x4b')]),_0x4a99ac);if(_0x88b9bd[_0xd945('0x49')][_0xd945('0x54')]){_0x44b556[_0xd945('0x52')]=_['merge'](_0x44b556[_0xd945('0x52')],{'$or':_[_0xd945('0x43')](_0x4a99ac,function(_0x2f7906){if(_0x2f7906['type']!==_0xd945('0x55')){var _0x4a740b={};_0x4a740b[_0x2f7906['name']]={'$like':'%'+_0x88b9bd[_0xd945('0x49')][_0xd945('0x54')]+'%'};return _0x4a740b;}})});}_0x44b556=_['merge']({},_0x44b556,_0x88b9bd['options']);var _0x5d7ff9={'where':_0x44b556[_0xd945('0x52')]};return db[_0xd945('0x44')]['count'](_0x5d7ff9)[_0xd945('0x21')](function(_0x271f9e){_0x51045e[_0xd945('0x32')]=_0x271f9e;if(_0x88b9bd['query'][_0xd945('0x56')]){_0x44b556[_0xd945('0x57')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xd945('0x58')](_0x44b556);})[_0xd945('0x21')](function(_0x2af614){_0x51045e[_0xd945('0x59')]=_0x2af614;return _0x51045e;})['then'](respondWithFilteredResult(_0x2746d0,_0x44b556))[_0xd945('0x5a')](handleError(_0x2746d0,null));};exports[_0xd945('0x5b')]=function(_0x43a085,_0x1cd475){var _0x462850={'raw':![],'where':{'id':_0x43a085['params']['id']},'include':[{'model':db['Pause'],'as':_0xd945('0x42')}]},_0x1ca1bd={};_0x1ca1bd[_0xd945('0x48')]=_['keys'](db[_0xd945('0x44')]['rawAttributes']);_0x1ca1bd[_0xd945('0x49')]=_[_0xd945('0x4a')](_0x43a085[_0xd945('0x49')]);_0x1ca1bd[_0xd945('0x4b')]=_[_0xd945('0x4c')](_0x1ca1bd['model'],_0x1ca1bd['query']);_0x462850[_0xd945('0x4d')]=_[_0xd945('0x4c')](_0x1ca1bd['model'],qs[_0xd945('0x4e')](_0x43a085['query']['fields']));_0x462850[_0xd945('0x4d')]=_0x462850[_0xd945('0x4d')][_0xd945('0x4f')]?_0x462850[_0xd945('0x4d')]:_0x1ca1bd[_0xd945('0x48')];if(_0x43a085[_0xd945('0x49')][_0xd945('0x56')]){_0x462850['include']=[{'all':!![]}];}_0x462850=_[_0xd945('0x5c')]({},_0x462850,_0x43a085[_0xd945('0x5d')]);return db[_0xd945('0x44')][_0xd945('0x5e')](_0x462850)[_0xd945('0x21')](handleEntityNotFound(_0x1cd475,null))[_0xd945('0x21')](respondWithResult(_0x1cd475,null))['catch'](handleError(_0x1cd475,null));};exports[_0xd945('0x5f')]=function(_0x25602a,_0x3df839){return db[_0xd945('0x44')][_0xd945('0x5f')](_0x25602a[_0xd945('0x60')],{})[_0xd945('0x21')](function(_0x3072eb){var _0x2038ae=_0x25602a['user'][_0xd945('0x3a')]({'plain':!![]});if(!_0x2038ae)throw new Error(_0xd945('0x61'));if(_0x2038ae[_0xd945('0x62')]==='user'){var _0x5687f0=_0x3072eb[_0xd945('0x3a')]({'plain':!![]});var _0x1c902c='WhatsappAccounts';return db[_0xd945('0x63')][_0xd945('0x5e')]({'where':{'name':_0x1c902c,'userProfileId':_0x2038ae[_0xd945('0x64')]},'raw':!![]})[_0xd945('0x21')](function(_0x52c7ac){if(_0x52c7ac&&_0x52c7ac[_0xd945('0x65')]===0x0){return db[_0xd945('0x3c')]['create']({'name':_0x5687f0[_0xd945('0x3e')],'resourceId':_0x5687f0['id'],'type':_0x52c7ac['name'],'sectionId':_0x52c7ac['id']},{})[_0xd945('0x21')](function(){return _0x3072eb;});}else{return _0x3072eb;}})[_0xd945('0x5a')](function(_0x432ef3){logger[_0xd945('0x28')](_0xd945('0x66'),_0x432ef3);throw _0x432ef3;});}return _0x3072eb;})[_0xd945('0x21')](respondWithResult(_0x3df839,0xc9))[_0xd945('0x5a')](handleError(_0x3df839,null));};exports[_0xd945('0x38')]=function(_0x1c0749,_0x314037){if(_0x1c0749[_0xd945('0x60')]['id']){delete _0x1c0749[_0xd945('0x60')]['id'];}return db[_0xd945('0x44')][_0xd945('0x5e')]({'where':{'id':_0x1c0749[_0xd945('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xd945('0x42')}]})[_0xd945('0x21')](handleEntityNotFound(_0x314037,null))[_0xd945('0x21')](saveUpdates(_0x1c0749[_0xd945('0x60')],null))['then'](respondWithResult(_0x314037,null))[_0xd945('0x5a')](handleError(_0x314037,null));};exports[_0xd945('0x39')]=function(_0x35b89c,_0x266d1c){return db['WhatsappAccount']['find']({'where':{'id':_0x35b89c[_0xd945('0x67')]['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x266d1c,null))[_0xd945('0x21')](removeEntity(_0x266d1c,null))[_0xd945('0x5a')](handleError(_0x266d1c,null));};exports['describe']=function(_0x2eb254,_0x5ced5e){return db['WhatsappAccount']['describe']()[_0xd945('0x21')](respondWithResult(_0x5ced5e,null))[_0xd945('0x5a')](handleError(_0x5ced5e,null));};exports[_0xd945('0x68')]=function(_0x17565e,_0x57e93a,_0x1944e1){if(_0x17565e[_0xd945('0x60')]['id']){delete _0x17565e[_0xd945('0x60')]['id'];}return db[_0xd945('0x44')][_0xd945('0x5e')]({'where':{'id':_0x17565e[_0xd945('0x67')]['id']}})['then'](handleEntityNotFound(_0x57e93a,null))[_0xd945('0x21')](function(_0x5a33af){if(_0x5a33af){_0x17565e[_0xd945('0x60')][_0xd945('0x69')]=_0x5a33af['id'];return db['Disposition'][_0xd945('0x5f')](_0x17565e[_0xd945('0x60')]);}})[_0xd945('0x21')](respondWithResult(_0x57e93a,null))[_0xd945('0x5a')](handleError(_0x57e93a,null));};exports['getDispositions']=function(_0x1e7038,_0x5324b9,_0x465ebf){var _0x3f41f7={'raw':![],'where':{}};var _0x2d2602={};var _0x208b39={'count':0x0,'rows':[]};return db[_0xd945('0x44')][_0xd945('0x6a')]({'where':{'id':_0x1e7038['params']['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x5324b9,null))[_0xd945('0x21')](function(_0x306d49){if(_0x306d49){_0x2d2602[_0xd945('0x48')]=_[_0xd945('0x4a')](db['Disposition'][_0xd945('0x45')]);_0x2d2602['query']=_['keys'](_0x1e7038[_0xd945('0x49')]);_0x2d2602['filters']=_['intersection'](_0x2d2602[_0xd945('0x48')],_0x2d2602[_0xd945('0x49')]);_0x3f41f7[_0xd945('0x4d')]=_['intersection'](_0x2d2602[_0xd945('0x48')],qs[_0xd945('0x4e')](_0x1e7038[_0xd945('0x49')][_0xd945('0x4e')]));_0x3f41f7[_0xd945('0x4d')]=_0x3f41f7[_0xd945('0x4d')][_0xd945('0x4f')]?_0x3f41f7[_0xd945('0x4d')]:_0x2d2602[_0xd945('0x48')];if(!_0x1e7038['query'][_0xd945('0x6b')](_0xd945('0x50'))){_0x3f41f7[_0xd945('0x30')]=qs['limit'](_0x1e7038[_0xd945('0x49')][_0xd945('0x30')]);_0x3f41f7[_0xd945('0x2f')]=qs[_0xd945('0x2f')](_0x1e7038[_0xd945('0x49')][_0xd945('0x2f')]);}_0x3f41f7[_0xd945('0x6c')]=qs[_0xd945('0x51')](_0x1e7038[_0xd945('0x49')]['sort']);_0x3f41f7[_0xd945('0x52')]=qs[_0xd945('0x4b')](_[_0xd945('0x53')](_0x1e7038[_0xd945('0x49')],_0x2d2602[_0xd945('0x4b')]));_0x3f41f7['where'][_0xd945('0x69')]=_0x306d49['id'];if(_0x1e7038[_0xd945('0x49')]['filter']){_0x3f41f7['where']=_['merge'](_0x3f41f7[_0xd945('0x52')],{'$or':_[_0xd945('0x43')](_0x3f41f7[_0xd945('0x4d')],function(_0xa2eb36){var _0x81d547={};_0x81d547[_0xa2eb36]={'$like':'%'+_0x1e7038[_0xd945('0x49')][_0xd945('0x54')]+'%'};return _0x81d547;})});}_0x3f41f7=_[_0xd945('0x5c')]({},_0x3f41f7,_0x1e7038[_0xd945('0x5d')]);return db[_0xd945('0x6d')]['count']({'where':_0x3f41f7[_0xd945('0x52')]})[_0xd945('0x21')](function(_0x12dade){_0x208b39[_0xd945('0x32')]=_0x12dade;if(_0x1e7038[_0xd945('0x49')][_0xd945('0x56')]){_0x3f41f7['include']=[{'all':!![]}];}return db[_0xd945('0x6d')][_0xd945('0x58')](_0x3f41f7);})[_0xd945('0x21')](function(_0x471fb5){_0x208b39[_0xd945('0x59')]=_0x471fb5;return _0x208b39;});}})[_0xd945('0x21')](respondWithFilteredResult(_0x5324b9,_0x3f41f7))['catch'](handleError(_0x5324b9,null));};exports[_0xd945('0x6e')]=function(_0x4c9b02,_0x5818f0,_0x5bd7cc){return db[_0xd945('0x44')][_0xd945('0x5e')]({'where':{'id':_0x4c9b02[_0xd945('0x67')]['id']}})['then'](handleEntityNotFound(_0x5818f0,null))['then'](function(_0x1d81de){if(_0x1d81de){return _0x1d81de[_0xd945('0x6e')](_0x4c9b02[_0xd945('0x49')]['ids']);}})[_0xd945('0x21')](respondWithStatusCode(_0x5818f0,null))['catch'](handleError(_0x5818f0,null));};exports[_0xd945('0x6f')]=function(_0x34e873,_0x299157,_0xef418d){if(_0x34e873['body']['id']){delete _0x34e873[_0xd945('0x60')]['id'];}return db['WhatsappAccount'][_0xd945('0x5e')]({'where':{'id':_0x34e873['params']['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x299157,null))[_0xd945('0x21')](function(_0x48d89b){if(_0x48d89b){_0x34e873[_0xd945('0x60')][_0xd945('0x69')]=_0x48d89b['id'];return db[_0xd945('0x70')][_0xd945('0x5f')](_0x34e873['body']);}})[_0xd945('0x21')](respondWithResult(_0x299157,null))[_0xd945('0x5a')](handleError(_0x299157,null));};exports[_0xd945('0x71')]=function(_0x1d4100,_0x5176ca,_0x87d66d){var _0x348498={'raw':![],'where':{}};var _0x1c2127={};var _0x3ed987={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x1d4100[_0xd945('0x67')]['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x5176ca,null))['then'](function(_0x2b1120){if(_0x2b1120){_0x1c2127[_0xd945('0x48')]=_[_0xd945('0x4a')](db['CannedAnswer'][_0xd945('0x45')]);_0x1c2127[_0xd945('0x49')]=_[_0xd945('0x4a')](_0x1d4100[_0xd945('0x49')]);_0x1c2127['filters']=_[_0xd945('0x4c')](_0x1c2127[_0xd945('0x48')],_0x1c2127[_0xd945('0x49')]);_0x348498[_0xd945('0x4d')]=_['intersection'](_0x1c2127[_0xd945('0x48')],qs[_0xd945('0x4e')](_0x1d4100[_0xd945('0x49')][_0xd945('0x4e')]));_0x348498[_0xd945('0x4d')]=_0x348498[_0xd945('0x4d')][_0xd945('0x4f')]?_0x348498['attributes']:_0x1c2127[_0xd945('0x48')];if(!_0x1d4100[_0xd945('0x49')]['hasOwnProperty'](_0xd945('0x50'))){_0x348498['limit']=qs['limit'](_0x1d4100[_0xd945('0x49')][_0xd945('0x30')]);_0x348498[_0xd945('0x2f')]=qs[_0xd945('0x2f')](_0x1d4100['query'][_0xd945('0x2f')]);}_0x348498[_0xd945('0x6c')]=qs[_0xd945('0x51')](_0x1d4100[_0xd945('0x49')]['sort']);_0x348498['where']=qs['filters'](_[_0xd945('0x53')](_0x1d4100['query'],_0x1c2127[_0xd945('0x4b')]));_0x348498[_0xd945('0x52')]['WhatsappAccountId']=_0x2b1120['id'];if(_0x1d4100[_0xd945('0x49')][_0xd945('0x54')]){_0x348498[_0xd945('0x52')]=_['merge'](_0x348498[_0xd945('0x52')],{'$or':_[_0xd945('0x43')](_0x348498['attributes'],function(_0x44436d){var _0x32e0a4={};_0x32e0a4[_0x44436d]={'$like':'%'+_0x1d4100['query'][_0xd945('0x54')]+'%'};return _0x32e0a4;})});}_0x348498=_[_0xd945('0x5c')]({},_0x348498,_0x1d4100[_0xd945('0x5d')]);return db['CannedAnswer']['count']({'where':_0x348498[_0xd945('0x52')]})[_0xd945('0x21')](function(_0xa3c75){_0x3ed987['count']=_0xa3c75;if(_0x1d4100[_0xd945('0x49')][_0xd945('0x56')]){_0x348498[_0xd945('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd945('0x58')](_0x348498);})[_0xd945('0x21')](function(_0x562c89){_0x3ed987['rows']=_0x562c89;return _0x3ed987;});}})[_0xd945('0x21')](respondWithFilteredResult(_0x5176ca,_0x348498))[_0xd945('0x5a')](handleError(_0x5176ca,null));};exports[_0xd945('0x72')]=function(_0x51eae7,_0x540a5c,_0x223371){return db[_0xd945('0x44')]['find']({'where':{'id':_0x51eae7['params']['id']}})['then'](handleEntityNotFound(_0x540a5c,null))[_0xd945('0x21')](function(_0x2fa7c2){if(_0x2fa7c2){return _0x2fa7c2['removeAnswers'](_0x51eae7[_0xd945('0x49')][_0xd945('0x73')]);}})[_0xd945('0x21')](respondWithStatusCode(_0x540a5c,null))[_0xd945('0x5a')](handleError(_0x540a5c,null));};exports['addAgents']=function(_0x27539a,_0x155070,_0x427b21){return db[_0xd945('0x44')]['find']({'where':{'id':_0x27539a['params']['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x155070,null))['then'](function(_0xdeaca0){if(_0xdeaca0){return _0xdeaca0[_0xd945('0x74')](_0x27539a[_0xd945('0x60')][_0xd945('0x73')],_[_0xd945('0x75')](_0x27539a[_0xd945('0x60')],[_0xd945('0x73'),'id'])||{})['spread'](function(_0x47faab){for(var _0x3c2fba=0x0;_0x3c2fba<_0x27539a['body'][_0xd945('0x73')][_0xd945('0x4f')];_0x3c2fba+=0x1){socket[_0xd945('0x76')]('userWhatsappAccount:save',{'UserId':Number(_0x27539a[_0xd945('0x60')]['ids'][_0x3c2fba]),'WhatsappAccountId':Number(_0x27539a['params']['id'])});}return _0x47faab;});}})[_0xd945('0x21')](respondWithResult(_0x155070,null))[_0xd945('0x5a')](handleError(_0x155070,null));};exports[_0xd945('0x77')]=function(_0xf68f6e,_0x2ccf9e,_0x348e0a){return db[_0xd945('0x44')][_0xd945('0x5e')]({'where':{'id':_0xf68f6e['params']['id']}})[_0xd945('0x21')](handleEntityNotFound(_0x2ccf9e,null))[_0xd945('0x21')](function(_0x3ea991){if(_0x3ea991){return _0x3ea991['removeAgents'](_0xf68f6e[_0xd945('0x49')]['ids'])[_0xd945('0x21')](function(){if(_[_0xd945('0x78')](_0xf68f6e['query'][_0xd945('0x73')])){for(var _0x5b80cb=0x0;_0x5b80cb<_0xf68f6e['query'][_0xd945('0x73')][_0xd945('0x4f')];_0x5b80cb+=0x1){socket[_0xd945('0x76')](_0xd945('0x79'),{'UserId':Number(_0xf68f6e[_0xd945('0x49')][_0xd945('0x73')][_0x5b80cb]),'WhatsappAccountId':Number(_0xf68f6e['params']['id'])});}}else{socket[_0xd945('0x76')](_0xd945('0x79'),{'UserId':Number(_0xf68f6e['query'][_0xd945('0x73')]),'WhatsappAccountId':Number(_0xf68f6e[_0xd945('0x67')]['id'])});}});}})[_0xd945('0x21')](respondWithStatusCode(_0x2ccf9e,null))[_0xd945('0x5a')](handleError(_0x2ccf9e,null));};exports[_0xd945('0x7a')]=function(_0x30b631,_0x1f4d7e,_0x5b5fa8){var _0x1e60b1={};var _0x63287a={};var _0x3b7de8;var _0x35187c;return db[_0xd945('0x44')][_0xd945('0x6a')]({'where':{'id':_0x30b631[_0xd945('0x67')]['id']}})['then'](handleEntityNotFound(_0x1f4d7e,null))[_0xd945('0x21')](function(_0x44367a){if(_0x44367a){_0x3b7de8=_0x44367a;_0x63287a[_0xd945('0x48')]=_[_0xd945('0x4a')](db['User'][_0xd945('0x45')]);_0x63287a['query']=_[_0xd945('0x4a')](_0x30b631[_0xd945('0x49')]);_0x63287a[_0xd945('0x4b')]=_['intersection'](_0x63287a[_0xd945('0x48')],_0x63287a[_0xd945('0x49')]);_0x1e60b1[_0xd945('0x4d')]=_[_0xd945('0x4c')](_0x63287a['model'],qs[_0xd945('0x4e')](_0x30b631[_0xd945('0x49')][_0xd945('0x4e')]));_0x1e60b1[_0xd945('0x4d')]=_0x1e60b1[_0xd945('0x4d')][_0xd945('0x4f')]?_0x1e60b1[_0xd945('0x4d')]:_0x63287a[_0xd945('0x48')];_0x1e60b1['order']=qs[_0xd945('0x51')](_0x30b631['query'][_0xd945('0x51')]);_0x1e60b1['where']=qs[_0xd945('0x4b')](_[_0xd945('0x53')](_0x30b631[_0xd945('0x49')],_0x63287a[_0xd945('0x4b')]));if(_0x30b631[_0xd945('0x49')][_0xd945('0x54')]){_0x1e60b1['where']=_['merge'](_0x1e60b1[_0xd945('0x52')],{'$or':_[_0xd945('0x43')](_0x1e60b1[_0xd945('0x4d')],function(_0x2ad0e7){var _0x58ac39={};_0x58ac39[_0x2ad0e7]={'$like':'%'+_0x30b631[_0xd945('0x49')][_0xd945('0x54')]+'%'};return _0x58ac39;})});}_0x1e60b1=_['merge']({},_0x1e60b1,_0x30b631['options']);return _0x3b7de8[_0xd945('0x7a')](_0x1e60b1);}})[_0xd945('0x21')](function(_0x128914){if(_0x128914){_0x35187c=_0x128914['length'];if(!_0x30b631[_0xd945('0x49')][_0xd945('0x6b')](_0xd945('0x50'))){_0x1e60b1[_0xd945('0x30')]=qs[_0xd945('0x30')](_0x30b631['query'][_0xd945('0x30')]);_0x1e60b1[_0xd945('0x2f')]=qs['offset'](_0x30b631[_0xd945('0x49')]['offset']);}return _0x3b7de8[_0xd945('0x7a')](_0x1e60b1);}})[_0xd945('0x21')](function(_0x4fc941){if(_0x4fc941){return _0x4fc941?{'count':_0x35187c,'rows':_0x4fc941}:null;}})['then'](respondWithResult(_0x1f4d7e,null))['catch'](handleError(_0x1f4d7e,null));};exports['addApplications']=function(_0x555ce3,_0x5d3e62){var _0x145454=_0x555ce3[_0xd945('0x67')]['id'];var _0x332b78=_0x555ce3[_0xd945('0x60')];var _0x27e149=0xc8;var _0x5ec591=null;return db['sequelize'][_0xd945('0x7b')]({'isolationLevel':db[_0xd945('0x7c')][_0xd945('0x7d')][_0xd945('0x7e')][_0xd945('0x7f')]},function(_0x1ffea8){return db[_0xd945('0x44')][_0xd945('0x6a')]({'where':{'id':_0x145454},'transaction':_0x1ffea8})['then'](function(_0x1fa3d2){if(_0x1fa3d2){return db[_0xd945('0x80')][_0xd945('0x39')]({'where':{'WhatsappAccountId':_0x145454},'transaction':_0x1ffea8})[_0xd945('0x21')](function(){var _0x1be31f=_['map'](_0x332b78,function(_0x2d1ccc){_0x2d1ccc['WhatsappAccountId']=_0x145454;return _0x2d1ccc;});return db[_0xd945('0x80')][_0xd945('0x81')](_0x1be31f,{'transaction':_0x1ffea8});});}else{_0x27e149=0x194;_0x5ec591=[];}});})[_0xd945('0x21')](function(){if(_0x27e149!==0x194){return db[_0xd945('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x145454},'order':_0xd945('0x82')})[_0xd945('0x21')](function(_0x2de1c6){_0x5ec591=_0x2de1c6;});}})[_0xd945('0x5a')](function(_0x479232){_0x27e149=0x1f4;logger[_0xd945('0x28')](_0x479232[_0xd945('0x3d')]);if(_0x479232[_0xd945('0x3e')]){delete _0x479232['name'];}_0x5ec591=_0x479232;})[_0xd945('0x83')](function(){if(_0x5ec591===null){_0x5d3e62[_0xd945('0x2c')](_0x27e149);}else{if(_0x27e149===0x1f4){_0x5d3e62[_0xd945('0x33')](_0x27e149)['send'](_0x5ec591);}else{_0x5d3e62[_0xd945('0x33')](_0x27e149)['json'](_0x5ec591);}}});};exports[_0xd945('0x84')]=function(_0x222546,_0x3ee2f5,_0x2b3f34){var _0xdf8ce2={};var _0x439814={};var _0x59bd10;var _0x59a53d;return db['WhatsappAccount']['findOne']({'where':{'id':_0x222546[_0xd945('0x67')]['id']}})['then'](handleEntityNotFound(_0x3ee2f5,null))[_0xd945('0x21')](function(_0x1da8d5){if(_0x1da8d5){_0x59bd10=_0x1da8d5;_0x439814[_0xd945('0x48')]=_[_0xd945('0x4a')](db['WhatsappApplication'][_0xd945('0x45')]);_0x439814[_0xd945('0x49')]=_[_0xd945('0x4a')](_0x222546[_0xd945('0x49')]);_0x439814['filters']=_[_0xd945('0x4c')](_0x439814[_0xd945('0x48')],_0x439814[_0xd945('0x49')]);_0xdf8ce2[_0xd945('0x4d')]=_['intersection'](_0x439814['model'],qs[_0xd945('0x4e')](_0x222546['query'][_0xd945('0x4e')]));_0xdf8ce2['attributes']=_0xdf8ce2['attributes']['length']?_0xdf8ce2[_0xd945('0x4d')]:_0x439814[_0xd945('0x48')];_0xdf8ce2[_0xd945('0x6c')]=qs[_0xd945('0x51')](_0x222546[_0xd945('0x49')][_0xd945('0x51')]);_0xdf8ce2[_0xd945('0x52')]=qs[_0xd945('0x4b')](_[_0xd945('0x53')](_0x222546[_0xd945('0x49')],_0x439814[_0xd945('0x4b')]));if(_0x222546[_0xd945('0x49')][_0xd945('0x54')]){_0xdf8ce2[_0xd945('0x52')]=_[_0xd945('0x5c')](_0xdf8ce2[_0xd945('0x52')],{'$or':_[_0xd945('0x43')](_0xdf8ce2[_0xd945('0x4d')],function(_0x482a79){var _0x3846ab={};_0x3846ab[_0x482a79]={'$like':'%'+_0x222546[_0xd945('0x49')][_0xd945('0x54')]+'%'};return _0x3846ab;})});}_0xdf8ce2=_['merge']({},_0xdf8ce2,_0x222546[_0xd945('0x5d')]);return _0x59bd10[_0xd945('0x84')](_0xdf8ce2);}})[_0xd945('0x21')](function(_0x49ca37){if(_0x49ca37){_0x59a53d=_0x49ca37[_0xd945('0x4f')];if(!_0x222546['query'][_0xd945('0x6b')](_0xd945('0x50'))){_0xdf8ce2[_0xd945('0x30')]=qs[_0xd945('0x30')](_0x222546[_0xd945('0x49')]['limit']);_0xdf8ce2[_0xd945('0x2f')]=qs['offset'](_0x222546[_0xd945('0x49')][_0xd945('0x2f')]);}return _0x59bd10[_0xd945('0x84')](_0xdf8ce2);}})[_0xd945('0x21')](function(_0x19279b){if(_0x19279b){return _0x19279b?{'count':_0x59a53d,'rows':_0x19279b}:null;}})[_0xd945('0x21')](respondWithResult(_0x3ee2f5,null))[_0xd945('0x5a')](handleError(_0x3ee2f5,null));};exports[_0xd945('0x85')]=function(_0x3d9d4b,_0x5b9010,_0x128dd5){var _0x3f90a1={'channel':_0xd945('0x86')};var _0x418bda=[];var _0x44b5e0=[];var _0x330b9c={};return db[_0xd945('0x44')][_0xd945('0x5e')]({'where':{'id':_0x3d9d4b[_0xd945('0x67')]['id']},'include':[{'model':db[_0xd945('0x80')],'as':_0xd945('0x87')}]})[_0xd945('0x21')](handleEntityNotFound(_0x5b9010,null))[_0xd945('0x21')](function(_0x1e016d){_0x3f90a1[_0xd945('0x88')]=_0x1e016d;if(_0x3f90a1[_0xd945('0x88')]&&_0x3f90a1[_0xd945('0x88')][_0xd945('0x47')]===_0xd945('0x89')&&_0x3d9d4b['body'][_0xd945('0x8a')]){if(_0x3d9d4b[_0xd945('0x60')][_0xd945('0x8a')][_0xd945('0x4f')]===0x0)return;if(_0x3d9d4b['body'][_0xd945('0x8a')][0x0][_0xd945('0x8b')]!==_0xd945('0x8c'))return;return db[_0xd945('0x8d')][_0xd945('0x38')]({'read':!![],'readAt':_0x3d9d4b[_0xd945('0x60')]['statuses'][0x0][_0xd945('0x8e')]},{'where':{'messageId':_0x3d9d4b[_0xd945('0x60')][_0xd945('0x8a')][0x0][_0xd945('0x8f')]},'individualHooks':!![]})[_0xd945('0x21')](function(_0x4ecdb0){return _0x5b9010[_0xd945('0x33')](0xc8)[_0xd945('0x2e')](_0x4ecdb0);});}_0x3f90a1['applications']=_[_0xd945('0x90')](_0x1e016d['Applications'],[_0xd945('0x82')],[_0xd945('0x91')]);if(_0x3f90a1[_0xd945('0x88')][_0xd945('0x87')]){delete _0x3f90a1[_0xd945('0x88')]['Applications'];}return db[_0xd945('0x92')][_0xd945('0x93')]()['then'](function(_0x335cdf){if(!_0x335cdf){throw new db[(_0xd945('0x94'))][(_0xd945('0x95'))](_0xd945('0x96'));}_0x418bda=_[_0xd945('0x97')](_[_0xd945('0x4a')](_0x335cdf),[_0xd945('0x98'),'updatedAt']);_0x44b5e0=_[_0xd945('0x97')](_[_0xd945('0x4a')](_0x335cdf),['createdAt',_0xd945('0x99'),_0xd945('0x9a'),_0xd945('0x9b')]);_0x3f90a1[_0xd945('0x60')]={'mapKey':_0xd945('0x9c')};if(_0x3f90a1[_0xd945('0x88')]&&_0x3f90a1[_0xd945('0x88')]['type']===_0xd945('0x9d')){_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')]=_0x3d9d4b[_0xd945('0x60')][_0xd945('0x9f')][_0xd945('0xa0')](_0xd945('0xa1'),'');_0x3f90a1[_0xd945('0x60')][_0xd945('0x60')]=_0x3d9d4b['body'][_0xd945('0xa2')];_0x3f90a1['body'][_0xd945('0xa3')]=_0x3d9d4b[_0xd945('0x60')]['MessageSid'];}if(_0x3f90a1[_0xd945('0x88')]&&_0x3f90a1[_0xd945('0x88')][_0xd945('0x47')]==='sinch'){_0x3f90a1['body']['from']=_0x3d9d4b[_0xd945('0x60')][_0xd945('0xa4')][0x0][_0xd945('0x9e')];_0x3f90a1['body']['body']=_0x3d9d4b[_0xd945('0x60')][_0xd945('0xa4')][0x0][_0xd945('0x2a')][_0xd945('0x60')];_0x3f90a1[_0xd945('0x60')][_0xd945('0xa3')]=_0x3d9d4b[_0xd945('0x60')]['notifications'][0x0]['message_id'];}if(_0x3f90a1[_0xd945('0x60')]['id']){delete _0x3f90a1[_0xd945('0x60')]['id'];}if(_[_0xd945('0xa5')](_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')])){throw new db[(_0xd945('0x94'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xd945('0xa5')](_0x3f90a1[_0xd945('0x60')][_0xd945('0x60')])||_0x3f90a1['body'][_0xd945('0x60')]===''){throw new db[(_0xd945('0x94'))]['ValidationError'](_0xd945('0xa6'));}if(_['isNil'](_0x3f90a1[_0xd945('0x60')][_0xd945('0xa7')])){throw new db['Sequelize'][(_0xd945('0x95'))](_0xd945('0xa8')+_0x44b5e0);}if(!_[_0xd945('0xa9')](_0x44b5e0,_0x3f90a1['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xd945('0xaa')+_0x44b5e0);}_0x330b9c[_0x3f90a1[_0xd945('0x60')][_0xd945('0xa7')]]=_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')];return db[_0xd945('0xab')][_0xd945('0x5e')]({'where':{'id':_0x3f90a1[_0xd945('0x88')][_0xd945('0x9b')]},'include':[{'model':db[_0xd945('0x92')],'as':_0xd945('0xac'),'where':_0x330b9c,'limit':0x1,'order':[[_0xd945('0x99'),_0xd945('0xad')]]}]});})[_0xd945('0x21')](handleEntityNotFound(_0x5b9010,null))[_0xd945('0x21')](function(_0x50948c){if(_0x50948c){_0x3f90a1[_0xd945('0xae')]=_[_0xd945('0x75')](_0x50948c,[_0xd945('0xac')]);if(_0x50948c[_0xd945('0xac')][_0xd945('0x4f')]){return _0x50948c['Contacts'][0x0];}var _0x4b4e4e=_['defaults'](_0x3f90a1[_0xd945('0x60')],{'firstName':_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')],'ListId':_0x50948c['id']});_0x4b4e4e[_0x3f90a1[_0xd945('0x60')][_0xd945('0xa7')]]=_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')];return db[_0xd945('0x92')]['create'](_0x4b4e4e,{'fields':_0x418bda,'raw':!![]});}})[_0xd945('0x21')](handleEntityNotFound(_0x5b9010,null))[_0xd945('0x21')](function(_0x32b2d8){if(_0x32b2d8){_0x3f90a1[_0xd945('0xaf')]=_0x32b2d8;var _0x2e13fc={'ContactId':_0x32b2d8['id'],'phone':_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')],'WhatsappAccountId':_0x3d9d4b[_0xd945('0x67')]['id']};var _0x3180fe={'ContactId':_0x32b2d8['id'],'WhatsappAccountId':_0x3d9d4b['params']['id'],'closed':![]};return db[_0xd945('0xb0')]['find']({'where':_0x3180fe})['then'](function(_0x5b46d9){if(_0x5b46d9){return[_0x5b46d9,![]];}return db[_0xd945('0xb0')][_0xd945('0x5f')](_0x2e13fc)[_0xd945('0x21')](function(_0x3cda46){return[_0x3cda46,!![]];});});}})[_0xd945('0xb1')](function(_0x2a187f,_0x473b52){_0x3f90a1[_0xd945('0xb2')]=_0x2a187f[_0xd945('0x3a')]({'plain':!![]});_0x3f90a1[_0xd945('0xb2')]['created']=![];if(_0x473b52){if(_0x3f90a1[_0xd945('0x88')][_0xd945('0xb3')]){_0x3f90a1[_0xd945('0xb4')][_0xd945('0xb5')]({'id':0x0,'priority':_0x3f90a1['applications'][_0xd945('0x4f')]+0x1,'app':'close','appdata':_0xd945('0xb6'),'interval':_0xd945('0xb7')});}_0x3f90a1[_0xd945('0xb2')][_0xd945('0xb8')]=!![];}return db[_0xd945('0x8d')][_0xd945('0x5f')]({'phone':_0x3f90a1[_0xd945('0x60')][_0xd945('0x9e')],'messageId':_0x3f90a1[_0xd945('0x60')][_0xd945('0xa3')],'body':_0x3f90a1['body'][_0xd945('0x60')],'WhatsappAccountId':_0x3d9d4b[_0xd945('0x67')]['id'],'WhatsappInteractionId':_0x2a187f['id'],'direction':'in','ContactId':_0x2a187f[_0xd945('0xb9')],'AttachmentId':_0x3f90a1[_0xd945('0x60')]['AttachmentId']});})['then'](function(_0x1cfe22){_0x3f90a1[_0xd945('0x2a')]=_0x1cfe22;if(_0x3f90a1['interaction']['UserId']){return db[_0xd945('0xba')]['find']({'attributes':['id',_0xd945('0x3e')],'where':{'id':_0x3f90a1[_0xd945('0xb2')]['UserId']}})[_0xd945('0x21')](function(_0x2ddc49){if(_0x2ddc49){_0x3f90a1[_0xd945('0xb4')][_0xd945('0xbb')]({'id':0x0,'priority':0x0,'app':_0xd945('0xbc'),'appdata':_0x2ddc49[_0xd945('0x3e')]+','+(_0x3f90a1['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd945('0xb7')});}return respondWithRpcPromise(_0xd945('0xbd'),_0xd945('0xbe'),_0x3f90a1);});}return respondWithRpcPromise(_0xd945('0xbd'),_0xd945('0xbe'),_0x3f90a1);})[_0xd945('0x21')](function(_0x1320a4){if(_0x1320a4){var _0x4f015d=0xc8;var _0x3e0e8f='receiveMessage';logger[_0xd945('0x22')](_0xd945('0x25'),_0x3e0e8f,_0x4f015d,_0xd945('0xbf'));logger['debug'](_0xd945('0xc0'),_0x3e0e8f,_0x4f015d,_0xd945('0xbf'),JSON[_0xd945('0x27')](_0x1320a4));if(_0x3f90a1[_0xd945('0x88')][_0xd945('0x47')]===_0xd945('0x9d')){return _0x5b9010[_0xd945('0x33')](_0x4f015d)[_0xd945('0x34')](_0xd945('0xc1'),_0xd945('0xc2'))['send'](_0xd945('0xc3'));}else{return _0x5b9010['status'](_0x4f015d)[_0xd945('0x2e')](_0x1320a4);}}});})[_0xd945('0x5a')](handleError(_0x5b9010,null));};exports['send']=function(_0x399a4c,_0x9c6ad8,_0x27f44e){var _0x415640,_0x124ac2,_0x35bc75;if(_['isNil'](_0x399a4c[_0xd945('0x60')][_0xd945('0x60')])||_0x399a4c[_0xd945('0x60')][_0xd945('0x60')]===''){throw new db[(_0xd945('0x94'))][(_0xd945('0x95'))](_0xd945('0xa6'));}if(_['isNil'](_0x399a4c[_0xd945('0x60')]['to'])){throw new db[(_0xd945('0x94'))][(_0xd945('0x95'))](_0xd945('0xc4'));}_0x415640=_0x399a4c[_0xd945('0x60')]['to'];return db[_0xd945('0x44')]['find']({'where':{'id':_0x399a4c[_0xd945('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0xd945('0xc5'),'include':[{'model':db[_0xd945('0x92')],'as':'Contacts','where':{'mobile':_0x415640},'limit':0x1,'order':[[_0xd945('0x99'),_0xd945('0xad')]]}]}]})[_0xd945('0x21')](handleEntityNotFound(_0x9c6ad8,null))[_0xd945('0x21')](function(_0x1318a2){if(_0x1318a2&&_0x1318a2[_0xd945('0xc5')]){_0x124ac2=_0x1318a2['get']({'plain':!![]});if(_0x124ac2['List']&&_0x124ac2[_0xd945('0xc5')][_0xd945('0xac')][_0xd945('0x4f')]){return _0x124ac2[_0xd945('0xc5')][_0xd945('0xac')][0x0];}return db[_0xd945('0x92')][_0xd945('0x5f')](_[_0xd945('0x19')](_0x399a4c[_0xd945('0x60')],{'firstName':_0x415640,'mobile':_0x415640,'phone':_0x415640,'ListId':_0x124ac2[_0xd945('0x9b')]}));}})[_0xd945('0x21')](handleEntityNotFound(_0x9c6ad8,null))[_0xd945('0x21')](function(_0xb68257){if(_0xb68257){_0x35bc75=_0xb68257;return db[_0xd945('0xb0')][_0xd945('0x5e')]({'where':{'ContactId':_0x35bc75['id'],'closed':![],'WhatsappAccountId':_0x124ac2['id']}})[_0xd945('0x21')](function(_0x1eed20){if(_0x1eed20){return[_0x1eed20,![]];}return db[_0xd945('0xb0')]['create']({'UserId':_0x399a4c[_0xd945('0xc6')]['id'],'ContactId':_0x35bc75['id'],'WhatsappAccountId':_0x124ac2['id'],'phone':_0x415640,'firstMsgDirection':_0xd945('0xc7'),'Messages':[_[_0xd945('0x5c')](_0x399a4c[_0xd945('0x60')],{'read':![],'body':_0x399a4c[_0xd945('0x60')]['body'],'phone':_0x415640,'WhatsappAccountId':_0x124ac2['id'],'UserId':_0x399a4c[_0xd945('0xc6')]['id'],'ContactId':_0x35bc75['id']})]},{'include':[{'model':db[_0xd945('0x8d')],'as':_0xd945('0xc8')}]})[_0xd945('0x21')](function(_0xb7731f){return[_0xb7731f,!![]];});});}})['spread'](function(_0x18755e,_0x55d413){if(_0x55d413){return _0x18755e;}return db['WhatsappMessage'][_0xd945('0x5f')](_['merge'](_0x399a4c[_0xd945('0x60')],{'read':![],'body':_0x399a4c[_0xd945('0x60')]['body'],'phone':_0x415640,'WhatsappAccountId':_0x124ac2['id'],'WhatsappInteractionId':_0x18755e['id'],'UserId':_0x399a4c['user']['id'],'ContactId':_0x35bc75['id']}))['then'](function(_0x544c9e){_0x18755e['dataValues']['Messages']=[];_0x18755e[_0xd945('0xc9')]['Messages'][_0xd945('0xb5')](_0x544c9e[_0xd945('0xc9')]);return _0x18755e;});})[_0xd945('0x21')](respondWithResult(_0x9c6ad8,null))[_0xd945('0x5a')](handleError(_0x9c6ad8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8411238..e5b830f 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 _0x11df=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x5c398d,_0x46307f){var _0x3229a7=function(_0x5e21b8){while(--_0x5e21b8){_0x5c398d['push'](_0x5c398d['shift']());}};_0x3229a7(++_0x46307f);}(_0x11df,0xce));var _0xf11d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x11df[_0x13e741];return _0x3f8bb3;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf11d('0x0'))['db'][_0xf11d('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf11d('0x2')](0x0);var events={'afterCreate':_0xf11d('0x3'),'afterUpdate':_0xf11d('0x4'),'afterDestroy':_0xf11d('0x5')};function emitEvent(_0x1844a5){return function(_0x384c59,_0x2be997,_0x1c1d62){WhatsappAccountEvents[_0xf11d('0x6')](_0x1844a5+':'+_0x384c59['id'],_0x384c59);WhatsappAccountEvents[_0xf11d('0x6')](_0x1844a5,_0x384c59);_0x1c1d62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf11d('0x7')](e,emitEvent(event));}}module[_0xf11d('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc74e=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1f2b61,_0x5e8ca3){var _0x81fd20=function(_0x87dc73){while(--_0x87dc73){_0x1f2b61['push'](_0x1f2b61['shift']());}};_0x81fd20(++_0x5e8ca3);}(_0xc74e,0xc0));var _0xec74=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc74e[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xec74('0x0'));var WhatsappAccount=require(_0xec74('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xec74('0x2')](0x0);var events={'afterCreate':_0xec74('0x3'),'afterUpdate':_0xec74('0x4'),'afterDestroy':_0xec74('0x5')};function emitEvent(_0xfb606b){return function(_0x5e2865,_0x370229,_0x52fd69){WhatsappAccountEvents[_0xec74('0x6')](_0xfb606b+':'+_0x5e2865['id'],_0x5e2865);WhatsappAccountEvents[_0xec74('0x6')](_0xfb606b,_0x5e2865);_0x52fd69(null);};}for(var e in events){if(events[_0xec74('0x7')](e)){var event=events[e];WhatsappAccount[_0xec74('0x8')](e,emitEvent(event));}}module[_0xec74('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0c2485a..07564e6 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 _0xb48b=['moment','bluebird','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util','../../config/logger'];(function(_0x4c8e52,_0x3ec27d){var _0x360c05=function(_0x2b5c63){while(--_0x2b5c63){_0x4c8e52['push'](_0x4c8e52['shift']());}};_0x360c05(++_0x3ec27d);}(_0xb48b,0x1cb));var _0xbb48=function(_0x452a15,_0x4e228a){_0x452a15=_0x452a15-0x0;var _0x5709c7=_0xb48b[_0x452a15];return _0x5709c7;};'use strict';var _=require(_0xbb48('0x0'));var util=require(_0xbb48('0x1'));var logger=require(_0xbb48('0x2'))('api');var moment=require(_0xbb48('0x3'));var BPromise=require(_0xbb48('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb48('0x5'));var rimraf=require('rimraf');var config=require(_0xbb48('0x6'));var attributes=require(_0xbb48('0x7'));module[_0xbb48('0x8')]=function(_0x1c9251,_0x506b97){return _0x1c9251[_0xbb48('0x9')](_0xbb48('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08cf=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4732af,_0xcd2c0e){var _0x3eda6d=function(_0x48b8c2){while(--_0x48b8c2){_0x4732af['push'](_0x4732af['shift']());}};_0x3eda6d(++_0xcd2c0e);}(_0x08cf,0xdb));var _0xf08c=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0x08cf[_0x485abd];return _0x3379f1;};'use strict';var _=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var logger=require(_0xf08c('0x2'))(_0xf08c('0x3'));var moment=require(_0xf08c('0x4'));var BPromise=require(_0xf08c('0x5'));var rp=require(_0xf08c('0x6'));var fs=require('fs');var path=require(_0xf08c('0x7'));var rimraf=require(_0xf08c('0x8'));var config=require(_0xf08c('0x9'));var attributes=require(_0xf08c('0xa'));module[_0xf08c('0xb')]=function(_0x4dd0d0,_0x26a02f){return _0x4dd0d0[_0xf08c('0xc')]('WhatsappAccount',attributes,{'tableName':_0xf08c('0xd'),'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 f9499c9..d8345ae 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 _0x44b3=['stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x56b7e2,_0x50e402){var _0x40da8a=function(_0x155787){while(--_0x155787){_0x56b7e2['push'](_0x56b7e2['shift']());}};_0x40da8a(++_0x50e402);}(_0x44b3,0x9f));var _0x344b=function(_0x5d3f6e,_0x10f394){_0x5d3f6e=_0x5d3f6e-0x0;var _0x1a95ff=_0x44b3[_0x5d3f6e];return _0x1a95ff;};'use strict';var _=require('lodash');var util=require(_0x344b('0x0'));var moment=require('moment');var BPromise=require(_0x344b('0x1'));var rs=require(_0x344b('0x2'));var fs=require('fs');var Redis=require(_0x344b('0x3'));var db=require(_0x344b('0x4'))['db'];var utils=require(_0x344b('0x5'));var logger=require(_0x344b('0x6'))('rpc');var config=require(_0x344b('0x7'));var jayson=require(_0x344b('0x8'));var client=jayson['client'][_0x344b('0x9')]({'port':0x232a});config[_0x344b('0xa')]=_['defaults'](config[_0x344b('0xa')],{'host':_0x344b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x344b('0xa')]));require(_0x344b('0xc'))[_0x344b('0xd')](socket);function respondWithRpcPromise(_0x1f79b6,_0x57c371,_0x7b377d){return new BPromise(function(_0x3d5662,_0x523a56){return client[_0x344b('0xe')](_0x1f79b6,_0x7b377d)[_0x344b('0xf')](function(_0x12ce86){logger[_0x344b('0x10')](_0x344b('0x11'),_0x57c371,_0x344b('0x12'));logger[_0x344b('0x13')](_0x344b('0x14'),_0x57c371,_0x344b('0x12'),JSON[_0x344b('0x15')](_0x12ce86));if(_0x12ce86[_0x344b('0x16')]){if(_0x12ce86['error'][_0x344b('0x17')]===0x1f4){logger['error'](_0x344b('0x11'),_0x57c371,_0x12ce86[_0x344b('0x16')][_0x344b('0x18')]);return _0x523a56(_0x12ce86['error']['message']);}logger[_0x344b('0x16')](_0x344b('0x11'),_0x57c371,_0x12ce86[_0x344b('0x16')][_0x344b('0x18')]);return _0x3d5662(_0x12ce86[_0x344b('0x16')][_0x344b('0x18')]);}else{logger[_0x344b('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x57c371,_0x344b('0x12'));_0x3d5662(_0x12ce86[_0x344b('0x19')][_0x344b('0x18')]);}})[_0x344b('0x1a')](function(_0x471169){logger[_0x344b('0x16')](_0x344b('0x11'),_0x57c371,_0x471169);_0x523a56(_0x471169);});});}exports[_0x344b('0x1b')]=function(_0x322868){var _0x3768ab=this;return new Promise(function(_0x17e0a0,_0x23109f){return db[_0x344b('0x1c')]['find']({'raw':_0x322868[_0x344b('0x1d')]?_0x322868[_0x344b('0x1d')][_0x344b('0x1e')]===undefined?!![]:![]:!![],'where':_0x322868['options']?_0x322868[_0x344b('0x1d')][_0x344b('0x1f')]||null:null,'attributes':_0x322868['options']?_0x322868[_0x344b('0x1d')][_0x344b('0x20')]||null:null,'include':_0x322868[_0x344b('0x1d')]?_0x322868[_0x344b('0x1d')][_0x344b('0x21')]?_[_0x344b('0x22')](_0x322868[_0x344b('0x1d')]['include'],function(_0x2874dc){return{'model':db[_0x2874dc[_0x344b('0x23')]],'as':_0x2874dc['as'],'attributes':_0x2874dc[_0x344b('0x20')],'include':_0x2874dc[_0x344b('0x21')]?_[_0x344b('0x22')](_0x2874dc[_0x344b('0x21')],function(_0x120ddb){return{'model':db[_0x120ddb[_0x344b('0x23')]],'as':_0x120ddb['as'],'attributes':_0x120ddb[_0x344b('0x20')],'include':_0x120ddb['include']?_[_0x344b('0x22')](_0x120ddb[_0x344b('0x21')],function(_0x1d857f){return{'model':db[_0x1d857f[_0x344b('0x23')]],'as':_0x1d857f['as'],'attributes':_0x1d857f[_0x344b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x344b('0xf')](function(_0x45e5e3){logger['info'](_0x344b('0x1b'),_0x322868);logger[_0x344b('0x13')](_0x344b('0x1b'),_0x322868,JSON['stringify'](_0x45e5e3));_0x17e0a0(_0x45e5e3);})[_0x344b('0x1a')](function(_0x498881){logger['error'](_0x344b('0x1b'),_0x498881['message'],_0x322868);_0x23109f(_0x3768ab['error'](0x1f4,_0x498881['message']));});});}; \ No newline at end of file +var _0x702a=['register','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x702a,0x13d));var _0xa702=function(_0x49dad9,_0x98a6ba){_0x49dad9=_0x49dad9-0x0;var _0x35cf7e=_0x702a[_0x49dad9];return _0x35cf7e;};'use strict';var _=require('lodash');var util=require(_0xa702('0x0'));var moment=require(_0xa702('0x1'));var BPromise=require(_0xa702('0x2'));var rs=require(_0xa702('0x3'));var fs=require('fs');var Redis=require(_0xa702('0x4'));var db=require(_0xa702('0x5'))['db'];var utils=require(_0xa702('0x6'));var logger=require(_0xa702('0x7'))(_0xa702('0x8'));var config=require(_0xa702('0x9'));var jayson=require(_0xa702('0xa'));var client=jayson[_0xa702('0xb')][_0xa702('0xc')]({'port':0x232a});config[_0xa702('0xd')]=_[_0xa702('0xe')](config[_0xa702('0xd')],{'host':_0xa702('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa702('0xd')]));require('./whatsappAccount.socket')[_0xa702('0x10')](socket);function respondWithRpcPromise(_0x552eee,_0x4a0b28,_0x5a9398){return new BPromise(function(_0x5cf341,_0x280f3a){return client['request'](_0x552eee,_0x5a9398)['then'](function(_0x575208){logger[_0xa702('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x4a0b28,_0xa702('0x12'));logger[_0xa702('0x13')](_0xa702('0x14'),_0x4a0b28,'request\x20sent',JSON[_0xa702('0x15')](_0x575208));if(_0x575208[_0xa702('0x16')]){if(_0x575208[_0xa702('0x16')][_0xa702('0x17')]===0x1f4){logger[_0xa702('0x16')](_0xa702('0x18'),_0x4a0b28,_0x575208[_0xa702('0x16')]['message']);return _0x280f3a(_0x575208['error']['message']);}logger[_0xa702('0x16')](_0xa702('0x18'),_0x4a0b28,_0x575208[_0xa702('0x16')]['message']);return _0x5cf341(_0x575208[_0xa702('0x16')]['message']);}else{logger[_0xa702('0x11')](_0xa702('0x18'),_0x4a0b28,_0xa702('0x12'));_0x5cf341(_0x575208['result'][_0xa702('0x19')]);}})[_0xa702('0x1a')](function(_0x3296ab){logger[_0xa702('0x16')](_0xa702('0x18'),_0x4a0b28,_0x3296ab);_0x280f3a(_0x3296ab);});});}exports[_0xa702('0x1b')]=function(_0x3cc798){var _0x56c727=this;return new Promise(function(_0x5dc2c9,_0x2bccd0){return db[_0xa702('0x1c')][_0xa702('0x1d')]({'raw':_0x3cc798[_0xa702('0x1e')]?_0x3cc798[_0xa702('0x1e')][_0xa702('0x1f')]===undefined?!![]:![]:!![],'where':_0x3cc798[_0xa702('0x1e')]?_0x3cc798['options']['where']||null:null,'attributes':_0x3cc798[_0xa702('0x1e')]?_0x3cc798['options'][_0xa702('0x20')]||null:null,'include':_0x3cc798[_0xa702('0x1e')]?_0x3cc798['options']['include']?_[_0xa702('0x21')](_0x3cc798['options'][_0xa702('0x22')],function(_0x1fe811){return{'model':db[_0x1fe811[_0xa702('0x23')]],'as':_0x1fe811['as'],'attributes':_0x1fe811[_0xa702('0x20')],'include':_0x1fe811[_0xa702('0x22')]?_[_0xa702('0x21')](_0x1fe811[_0xa702('0x22')],function(_0x38dfa1){return{'model':db[_0x38dfa1[_0xa702('0x23')]],'as':_0x38dfa1['as'],'attributes':_0x38dfa1['attributes'],'include':_0x38dfa1['include']?_[_0xa702('0x21')](_0x38dfa1[_0xa702('0x22')],function(_0x79c571){return{'model':db[_0x79c571[_0xa702('0x23')]],'as':_0x79c571['as'],'attributes':_0x79c571[_0xa702('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa702('0x24')](function(_0x4d319d){logger[_0xa702('0x11')](_0xa702('0x1b'),_0x3cc798);logger[_0xa702('0x13')](_0xa702('0x1b'),_0x3cc798,JSON[_0xa702('0x15')](_0x4d319d));_0x5dc2c9(_0x4d319d);})[_0xa702('0x1a')](function(_0x250161){logger['error'](_0xa702('0x1b'),_0x250161[_0xa702('0x19')],_0x3cc798);_0x2bccd0(_0x56c727[_0xa702('0x16')](0x1f4,_0x250161[_0xa702('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index cda26ab..43789be 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 _0x0182=['emit','register','whatsappAccount:','save','remove','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0182,0x111));var _0x2018=function(_0x33e566,_0x3e90f4){_0x33e566=_0x33e566-0x0;var _0x828b80=_0x0182[_0x33e566];return _0x828b80;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x2018('0x0'),_0x2018('0x1'),_0x2018('0x2')];function createListener(_0x1c0b5e,_0x26cb1b){return function(_0x31a08d){_0x26cb1b[_0x2018('0x3')](_0x1c0b5e,_0x31a08d);};}function removeListener(_0x326b9c,_0x1873ec){return function(){WhatsappAccountEvents['removeListener'](_0x326b9c,_0x1873ec);};}exports[_0x2018('0x4')]=function(_0x59669d){for(var _0x17e6ed=0x0,_0x3f13a5=events['length'];_0x17e6ed<_0x3f13a5;_0x17e6ed++){var _0x1ede82=events[_0x17e6ed];var _0x25f4a5=createListener(_0x2018('0x5')+_0x1ede82,_0x59669d);WhatsappAccountEvents['on'](_0x1ede82,_0x25f4a5);}}; \ No newline at end of file +var _0xf3f3=['emit','./whatsappAccount.events','save','remove'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xf3f3,0x129));var _0x3f3f=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xf3f3[_0x3e69ae];return _0x3d7f42;};'use strict';var WhatsappAccountEvents=require(_0x3f3f('0x0'));var events=[_0x3f3f('0x1'),_0x3f3f('0x2'),'update'];function createListener(_0x4458b1,_0x36e878){return function(_0x3e2c1d){_0x36e878[_0x3f3f('0x3')](_0x4458b1,_0x3e2c1d);};}function removeListener(_0x49b4a4,_0x24690a){return function(){WhatsappAccountEvents['removeListener'](_0x49b4a4,_0x24690a);};}exports['register']=function(_0x2d317b){for(var _0x3af4fb=0x0,_0x98ac8e=events['length'];_0x3af4fb<_0x98ac8e;_0x3af4fb++){var _0x39f199=events[_0x3af4fb];var _0x16ed84=createListener('whatsappAccount:'+_0x39f199,_0x2d317b);WhatsappAccountEvents['on'](_0x39f199,_0x16ed84);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8dc5e8e..973d814 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 _0x3ada=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show','isAuthenticated','update','delete'];(function(_0x4a0a2e,_0x3897b1){var _0x20d54c=function(_0x383ac9){while(--_0x383ac9){_0x4a0a2e['push'](_0x4a0a2e['shift']());}};_0x20d54c(++_0x3897b1);}(_0x3ada,0x145));var _0xa3ad=function(_0xc6f29c,_0x469980){_0xc6f29c=_0xc6f29c-0x0;var _0x47191d=_0x3ada[_0xc6f29c];return _0x47191d;};'use strict';var multer=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa3ad('0x2')]();var fs_extra=require(_0xa3ad('0x3'));var auth=require(_0xa3ad('0x4'));var interaction=require(_0xa3ad('0x5'));var config=require(_0xa3ad('0x6'));var controller=require(_0xa3ad('0x7'));router[_0xa3ad('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3ad('0x9')]);router[_0xa3ad('0x8')](_0xa3ad('0xa'),auth['isAuthenticated'](),controller[_0xa3ad('0xb')]);router['post']('/',auth[_0xa3ad('0xc')](),controller['create']);router['put']('/:id',auth[_0xa3ad('0xc')](),controller[_0xa3ad('0xd')]);router[_0xa3ad('0xe')](_0xa3ad('0xa'),auth[_0xa3ad('0xc')](),controller[_0xa3ad('0xf')]);module[_0xa3ad('0x10')]=router; \ No newline at end of file +var _0xf2fb=['index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0xf2fb,0x98));var _0xbf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbf2f('0x0'));var util=require(_0xbf2f('0x1'));var path=require(_0xbf2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf2f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbf2f('0x4'));var interaction=require(_0xbf2f('0x5'));var config=require(_0xbf2f('0x6'));var controller=require(_0xbf2f('0x7'));router[_0xbf2f('0x8')]('/',auth[_0xbf2f('0x9')](),controller[_0xbf2f('0xa')]);router['get'](_0xbf2f('0xb'),auth[_0xbf2f('0x9')](),controller['show']);router[_0xbf2f('0xc')]('/',auth['isAuthenticated'](),controller[_0xbf2f('0xd')]);router[_0xbf2f('0xe')](_0xbf2f('0xb'),auth[_0xbf2f('0x9')](),controller[_0xbf2f('0xf')]);router[_0xbf2f('0x10')](_0xbf2f('0xb'),auth[_0xbf2f('0x9')](),controller[_0xbf2f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index af8aa4a..966d033 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 _0x1911=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x1911,0x1cd));var _0x1191=function(_0x4a9804,_0x9c5a94){_0x4a9804=_0x4a9804-0x0;var _0x395b9c=_0x1911[_0x4a9804];return _0x395b9c;};'use strict';var Sequelize=require(_0x1191('0x0'));module[_0x1191('0x1')]={'priority':{'type':Sequelize[_0x1191('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1191('0x3')],'allowNull':![],'defaultValue':_0x1191('0x4')},'appdata':{'type':Sequelize[_0x1191('0x5')]()},'description':{'type':Sequelize[_0x1191('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb4cd=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xb4cd,0xbf));var _0xdb4c=function(_0x50a9ea,_0x3dfc19){_0x50a9ea=_0x50a9ea-0x0;var _0x19a18d=_0xb4cd[_0x50a9ea];return _0x19a18d;};'use strict';var Sequelize=require(_0xdb4c('0x0'));module[_0xdb4c('0x1')]={'priority':{'type':Sequelize[_0xdb4c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdb4c('0x3')],'allowNull':![],'defaultValue':_0xdb4c('0x4')},'appdata':{'type':Sequelize[_0xdb4c('0x5')]()},'description':{'type':Sequelize[_0xdb4c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdb4c('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7d97fb0..b64cf5a 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 _0x2dd8=['findAll','rows','catch','show','keys','intersection','find','create','body','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','map','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2dd8,0x143));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require(_0x82dd('0x4'));var Mustache=require(_0x82dd('0x5'));var util=require(_0x82dd('0x6'));var path=require(_0x82dd('0x7'));var sox=require(_0x82dd('0x8'));var csv=require('to-csv');var ejs=require(_0x82dd('0x9'));var fs=require('fs');var fs_extra=require(_0x82dd('0xa'));var _=require(_0x82dd('0xb'));var squel=require(_0x82dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x82dd('0xd'));var deskjs=require(_0x82dd('0xe'));var toCsv=require(_0x82dd('0xf'));var querystring=require(_0x82dd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82dd('0x12'));var hardwareService=require(_0x82dd('0x13'));var logger=require(_0x82dd('0x14'))(_0x82dd('0x15'));var utils=require(_0x82dd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x82dd('0x17'));var db=require(_0x82dd('0x18'))['db'];function respondWithStatusCode(_0x348f79,_0x18b9f6){_0x18b9f6=_0x18b9f6||0xcc;return function(_0x24d045){if(_0x24d045){return _0x348f79['sendStatus'](_0x18b9f6);}return _0x348f79['status'](_0x18b9f6)[_0x82dd('0x19')]();};}function respondWithResult(_0x255abd,_0x6fcc1b){_0x6fcc1b=_0x6fcc1b||0xc8;return function(_0x46beb0){if(_0x46beb0){return _0x255abd[_0x82dd('0x1a')](_0x6fcc1b)[_0x82dd('0x1b')](_0x46beb0);}};}function respondWithFilteredResult(_0x31b9c1,_0x275802){return function(_0x101eb7){if(_0x101eb7){var _0x1b90e0=typeof _0x275802[_0x82dd('0x1c')]===_0x82dd('0x1d')&&typeof _0x275802[_0x82dd('0x1e')]==='undefined';var _0x352400=_0x101eb7[_0x82dd('0x1f')];var _0x34d991=_0x1b90e0?0x0:_0x275802[_0x82dd('0x1c')];var _0x445fa0=_0x1b90e0?_0x101eb7[_0x82dd('0x1f')]:_0x275802[_0x82dd('0x1c')]+_0x275802[_0x82dd('0x1e')];var _0x26373a;if(_0x445fa0>=_0x352400){_0x445fa0=_0x352400;_0x26373a=0xc8;}else{_0x26373a=0xce;}_0x31b9c1[_0x82dd('0x1a')](_0x26373a);return _0x31b9c1[_0x82dd('0x20')](_0x82dd('0x21'),_0x34d991+'-'+_0x445fa0+'/'+_0x352400)[_0x82dd('0x1b')](_0x101eb7);}return null;};}function patchUpdates(_0x5ebea8){return function(_0x45205d){try{jsonpatch[_0x82dd('0x22')](_0x45205d,_0x5ebea8,!![]);}catch(_0x28352e){return BPromise[_0x82dd('0x23')](_0x28352e);}return _0x45205d[_0x82dd('0x24')]();};}function saveUpdates(_0x251b5b,_0x15f5b8){return function(_0x45e92c){if(_0x45e92c){return _0x45e92c['update'](_0x251b5b)['then'](function(_0x1c095e){return _0x1c095e;});}return null;};}function removeEntity(_0x96dbc0,_0x4e1463){return function(_0x59a173){if(_0x59a173){return _0x59a173[_0x82dd('0x25')]()[_0x82dd('0x26')](function(){_0x96dbc0[_0x82dd('0x1a')](0xcc)[_0x82dd('0x19')]();});}};}function handleEntityNotFound(_0x4609c1,_0x1233e4){return function(_0x17eb32){if(!_0x17eb32){_0x4609c1[_0x82dd('0x27')](0x194);}return _0x17eb32;};}function handleError(_0x1ae382,_0x1d27f1){_0x1d27f1=_0x1d27f1||0x1f4;return function(_0xe6aacd){logger[_0x82dd('0x28')](_0xe6aacd[_0x82dd('0x29')]);if(_0xe6aacd[_0x82dd('0x2a')]){delete _0xe6aacd['name'];}_0x1ae382[_0x82dd('0x1a')](_0x1d27f1)[_0x82dd('0x2b')](_0xe6aacd);};}exports[_0x82dd('0x2c')]=function(_0x53965f,_0x15da13){var _0x5238a2={},_0x15f31f={},_0x93fd00={'count':0x0,'rows':[]};var _0x2b4a63=_['map'](db[_0x82dd('0x2d')][_0x82dd('0x2e')],function(_0x47c0ff){return{'name':_0x47c0ff['fieldName'],'type':_0x47c0ff[_0x82dd('0x2f')][_0x82dd('0x30')]};});_0x15f31f['model']=_[_0x82dd('0x31')](_0x2b4a63,_0x82dd('0x2a'));_0x15f31f[_0x82dd('0x32')]=_['keys'](_0x53965f[_0x82dd('0x32')]);_0x15f31f[_0x82dd('0x33')]=_['intersection'](_0x15f31f['model'],_0x15f31f[_0x82dd('0x32')]);_0x5238a2[_0x82dd('0x34')]=_['intersection'](_0x15f31f[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x36')]));_0x5238a2[_0x82dd('0x34')]=_0x5238a2['attributes'][_0x82dd('0x37')]?_0x5238a2[_0x82dd('0x34')]:_0x15f31f['model'];if(!_0x53965f[_0x82dd('0x32')][_0x82dd('0x38')](_0x82dd('0x39'))){_0x5238a2[_0x82dd('0x1e')]=qs['limit'](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1e')]);_0x5238a2[_0x82dd('0x1c')]=qs[_0x82dd('0x1c')](_0x53965f[_0x82dd('0x32')][_0x82dd('0x1c')]);}_0x5238a2[_0x82dd('0x3a')]=qs[_0x82dd('0x3b')](_0x53965f['query'][_0x82dd('0x3b')]);_0x5238a2['where']=qs[_0x82dd('0x33')](_[_0x82dd('0x3c')](_0x53965f[_0x82dd('0x32')],_0x15f31f['filters']),_0x2b4a63);if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x3d')]){_0x5238a2[_0x82dd('0x3e')]=_[_0x82dd('0x3f')](_0x5238a2['where'],{'$or':_['map'](_0x2b4a63,function(_0xc3d6d9){if(_0xc3d6d9[_0x82dd('0x2f')]!==_0x82dd('0x40')){var _0x19c736={};_0x19c736[_0xc3d6d9['name']]={'$like':'%'+_0x53965f['query'][_0x82dd('0x3d')]+'%'};return _0x19c736;}})});}_0x5238a2=_[_0x82dd('0x3f')]({},_0x5238a2,_0x53965f['options']);var _0x3a905d={'where':_0x5238a2[_0x82dd('0x3e')]};return db[_0x82dd('0x2d')][_0x82dd('0x1f')](_0x3a905d)[_0x82dd('0x26')](function(_0x104568){_0x93fd00[_0x82dd('0x1f')]=_0x104568;if(_0x53965f[_0x82dd('0x32')][_0x82dd('0x41')]){_0x5238a2[_0x82dd('0x42')]=[{'all':!![]}];}return db[_0x82dd('0x2d')][_0x82dd('0x43')](_0x5238a2);})[_0x82dd('0x26')](function(_0x27cfd6){_0x93fd00[_0x82dd('0x44')]=_0x27cfd6;return _0x93fd00;})[_0x82dd('0x26')](respondWithFilteredResult(_0x15da13,_0x5238a2))[_0x82dd('0x45')](handleError(_0x15da13,null));};exports[_0x82dd('0x46')]=function(_0x41d36,_0x5bcc32){var _0x644d3a={'raw':!![],'where':{'id':_0x41d36['params']['id']}},_0x4cd127={};_0x4cd127[_0x82dd('0x35')]=_[_0x82dd('0x47')](db[_0x82dd('0x2d')]['rawAttributes']);_0x4cd127[_0x82dd('0x32')]=_[_0x82dd('0x47')](_0x41d36[_0x82dd('0x32')]);_0x4cd127[_0x82dd('0x33')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],_0x4cd127['query']);_0x644d3a[_0x82dd('0x34')]=_[_0x82dd('0x48')](_0x4cd127[_0x82dd('0x35')],qs[_0x82dd('0x36')](_0x41d36[_0x82dd('0x32')]['fields']));_0x644d3a[_0x82dd('0x34')]=_0x644d3a[_0x82dd('0x34')]['length']?_0x644d3a[_0x82dd('0x34')]:_0x4cd127[_0x82dd('0x35')];if(_0x41d36[_0x82dd('0x32')][_0x82dd('0x41')]){_0x644d3a[_0x82dd('0x42')]=[{'all':!![]}];}_0x644d3a=_[_0x82dd('0x3f')]({},_0x644d3a,_0x41d36['options']);return db[_0x82dd('0x2d')][_0x82dd('0x49')](_0x644d3a)[_0x82dd('0x26')](handleEntityNotFound(_0x5bcc32,null))[_0x82dd('0x26')](respondWithResult(_0x5bcc32,null))['catch'](handleError(_0x5bcc32,null));};exports[_0x82dd('0x4a')]=function(_0x418fd3,_0x3035b8){return db['WhatsappApplication']['create'](_0x418fd3[_0x82dd('0x4b')],{})[_0x82dd('0x26')](respondWithResult(_0x3035b8,0xc9))[_0x82dd('0x45')](handleError(_0x3035b8,null));};exports[_0x82dd('0x4c')]=function(_0x208e4f,_0x4ff539){if(_0x208e4f['body']['id']){delete _0x208e4f[_0x82dd('0x4b')]['id'];}return db[_0x82dd('0x2d')]['find']({'where':{'id':_0x208e4f['params']['id']}})['then'](handleEntityNotFound(_0x4ff539,null))[_0x82dd('0x26')](saveUpdates(_0x208e4f['body'],null))[_0x82dd('0x26')](respondWithResult(_0x4ff539,null))[_0x82dd('0x45')](handleError(_0x4ff539,null));};exports[_0x82dd('0x25')]=function(_0x96e9f1,_0x24fa02){return db[_0x82dd('0x2d')][_0x82dd('0x49')]({'where':{'id':_0x96e9f1[_0x82dd('0x4d')]['id']}})[_0x82dd('0x26')](handleEntityNotFound(_0x24fa02,null))['then'](removeEntity(_0x24fa02,null))[_0x82dd('0x45')](handleError(_0x24fa02,null));}; \ No newline at end of file +var _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x565b05,_0x5d6a94){var _0x2a2251=function(_0x2e2159){while(--_0x2e2159){_0x565b05['push'](_0x565b05['shift']());}};_0x2a2251(++_0x5d6a94);}(_0x33af,0xec));var _0xf33a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x33af[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['WhatsappApplication'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index cb13456..756f042 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 _0x6f7f=['api','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x435ed8,_0x4866be){var _0x34afaa=function(_0x257921){while(--_0x257921){_0x435ed8['push'](_0x435ed8['shift']());}};_0x34afaa(++_0x4866be);}(_0x6f7f,0x177));var _0xf6f7=function(_0x284382,_0x18fb38){_0x284382=_0x284382-0x0;var _0x2b3747=_0x6f7f[_0x284382];return _0x2b3747;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var logger=require(_0xf6f7('0x1'))(_0xf6f7('0x2'));var moment=require(_0xf6f7('0x3'));var BPromise=require(_0xf6f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6f7('0x5'));var rimraf=require('rimraf');var config=require(_0xf6f7('0x6'));var attributes=require(_0xf6f7('0x7'));module[_0xf6f7('0x8')]=function(_0x5495b9,_0x2f6df9){return _0x5495b9['define'](_0xf6f7('0x9'),attributes,{'tableName':_0xf6f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6f7('0xb'),'collate':_0xf6f7('0xc')});}; \ No newline at end of file +var _0x6658=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x2191d8,_0xa15c2a){var _0x23b4f0=function(_0x55598d){while(--_0x55598d){_0x2191d8['push'](_0x2191d8['shift']());}};_0x23b4f0(++_0xa15c2a);}(_0x6658,0x198));var _0x8665=function(_0x2d0e62,_0x6d1e59){_0x2d0e62=_0x2d0e62-0x0;var _0x583e7e=_0x6658[_0x2d0e62];return _0x583e7e;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8665('0xd'),'collate':_0x8665('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b92464a..3d5492b 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 _0x5c12=['../../config/environment','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x5c12,0x188));var _0x25c1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x5c12[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x55e0,0xdc));var _0x055e=function(_0x54717d,_0x45310a){_0x54717d=_0x54717d-0x0;var _0x5c97e6=_0x55e0[_0x54717d];return _0x5c97e6;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index bbb2400..1a6e101 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 _0x1224=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x5c7828,_0x1533b2){var _0x46d97d=function(_0xa4a7fd){while(--_0xa4a7fd){_0x5c7828['push'](_0x5c7828['shift']());}};_0x46d97d(++_0x1533b2);}(_0x1224,0x10d));var _0x4122=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0x1224[_0x4df17c];return _0x4e79b5;};'use strict';var multer=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var timeout=require(_0x4122('0x3'));var express=require(_0x4122('0x4'));var router=express[_0x4122('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4122('0x6'));var interaction=require(_0x4122('0x7'));var config=require(_0x4122('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x4122('0x9')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0xb')]);router[_0x4122('0x9')](_0x4122('0xc'),auth[_0x4122('0xa')](),controller[_0x4122('0xd')]);router[_0x4122('0x9')](_0x4122('0xe'),auth[_0x4122('0xa')](),controller[_0x4122('0xf')]);router[_0x4122('0x9')](_0x4122('0x10'),auth[_0x4122('0xa')](),controller[_0x4122('0x11')]);router[_0x4122('0x9')](_0x4122('0x12'),auth[_0x4122('0xa')](),controller[_0x4122('0x13')]);router[_0x4122('0x14')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0x15')]);router[_0x4122('0x14')](_0x4122('0x10'),auth[_0x4122('0xa')](),controller[_0x4122('0x16')]);router[_0x4122('0x14')](_0x4122('0x17'),auth[_0x4122('0xa')](),interaction[_0x4122('0x18')](_0x4122('0x19'),'whatsappinteraction:addtags'),controller[_0x4122('0x1a')]);router[_0x4122('0x1b')](_0x4122('0xe'),auth[_0x4122('0xa')](),interaction['tracked'](_0x4122('0x19'),_0x4122('0x1c')),controller['update']);router[_0x4122('0x1d')](_0x4122('0xe'),auth[_0x4122('0xa')](),interaction[_0x4122('0x18')](_0x4122('0x19'),_0x4122('0x1e')),controller[_0x4122('0x1f')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x4122('0x20')]);module[_0x4122('0x21')]=router; \ No newline at end of file +var _0x85d0=['../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','express','Router','fs-extra','../../components/auth/service'];(function(_0x2cbe19,_0x244c16){var _0x31e5b3=function(_0x1212c7){while(--_0x1212c7){_0x2cbe19['push'](_0x2cbe19['shift']());}};_0x31e5b3(++_0x244c16);}(_0x85d0,0x164));var _0x085d=function(_0x5c2be9,_0x235558){_0x5c2be9=_0x5c2be9-0x0;var _0xb134d9=_0x85d0[_0x5c2be9];return _0xb134d9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x085d('0x0'));var router=express[_0x085d('0x1')]();var fs_extra=require(_0x085d('0x2'));var auth=require(_0x085d('0x3'));var interaction=require(_0x085d('0x4'));var config=require(_0x085d('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x085d('0x6')]('/',auth['isAuthenticated'](),controller[_0x085d('0x7')]);router[_0x085d('0x6')](_0x085d('0x8'),auth['isAuthenticated'](),controller[_0x085d('0x9')]);router[_0x085d('0x6')](_0x085d('0xa'),auth[_0x085d('0xb')](),controller[_0x085d('0xc')]);router[_0x085d('0x6')](_0x085d('0xd'),auth[_0x085d('0xb')](),controller[_0x085d('0xe')]);router['get'](_0x085d('0xf'),auth[_0x085d('0xb')](),controller[_0x085d('0x10')]);router[_0x085d('0x11')]('/',auth['isAuthenticated'](),controller[_0x085d('0x12')]);router[_0x085d('0x11')]('/:id/messages',auth[_0x085d('0xb')](),controller[_0x085d('0x13')]);router[_0x085d('0x11')](_0x085d('0x14'),auth['isAuthenticated'](),interaction[_0x085d('0x15')](_0x085d('0x16'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x085d('0x17')](_0x085d('0xa'),auth[_0x085d('0xb')](),interaction[_0x085d('0x15')](_0x085d('0x16'),'whatsappinteraction:update'),controller[_0x085d('0x18')]);router[_0x085d('0x19')](_0x085d('0xa'),auth[_0x085d('0xb')](),interaction[_0x085d('0x15')](_0x085d('0x16'),_0x085d('0x1a')),controller[_0x085d('0x1b')]);router[_0x085d('0x19')]('/:id/tags',auth[_0x085d('0xb')](),controller[_0x085d('0x1c')]);module[_0x085d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 88587c2..0e6451e 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 _0x5fc3=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2e93d2,_0x5df33a){var _0x59a589=function(_0x898c2e){while(--_0x898c2e){_0x2e93d2['push'](_0x2e93d2['shift']());}};_0x59a589(++_0x5df33a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x5fc3[_0x18b344];return _0x5ef6bb;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));module['exports']={'closed':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35fc('0x3')]},'disposition':{'type':Sequelize[_0x35fc('0x4')]},'secondDisposition':{'type':Sequelize[_0x35fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x35fc('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x35fc('0x4')]},'read1stAt':{'type':Sequelize[_0x35fc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x35fc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x35fc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4af9=['sequelize','moment','DATE','STRING','out','ENUM'];(function(_0x3776b9,_0x3cd10c){var _0x352fc5=function(_0xdc437d){while(--_0xdc437d){_0x3776b9['push'](_0x3776b9['shift']());}};_0x352fc5(++_0x3cd10c);}(_0x4af9,0x12c));var _0x94af=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4af9[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x94af('0x0'));var moment=require(_0x94af('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94af('0x2')]},'disposition':{'type':Sequelize[_0x94af('0x3')]},'secondDisposition':{'type':Sequelize[_0x94af('0x3')]},'thirdDisposition':{'type':Sequelize[_0x94af('0x3')]},'note':{'type':Sequelize[_0x94af('0x3')]},'phone':{'type':Sequelize[_0x94af('0x3')]},'read1stAt':{'type':Sequelize[_0x94af('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x94af('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94af('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x94af('0x5')]('in',_0x94af('0x4')),'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 40da195..6ba8faa 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 _0x3a6d=['i.WhatsappAccountId\x20IS\x20NULL','agent','toString','sequelize','merge','WhatsappInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','rows','catch','includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closedAt','disposition','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','out','secret','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','name','send','Users','fullname','TagIds','split','forEach','Tags','push','waiting','talking','answered','closed','UserId','unmanaged','total','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','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','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','$substring','getFullTextValue','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','buildExpression','body','keys','some','compact','isEmpty','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','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts'];(function(_0x4d9c3b,_0x3c4663){var _0x35c391=function(_0x22ac2e){while(--_0x22ac2e){_0x4d9c3b['push'](_0x4d9c3b['shift']());}};_0x35c391(++_0x3c4663);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3a6d[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd3a6('0x15'));var hardwareService=require(_0xd3a6('0x16'));var logger=require(_0xd3a6('0x17'))(_0xd3a6('0x18'));var utils=require(_0xd3a6('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd3a6('0x1a')]=_[_0xd3a6('0x1b')](config[_0xd3a6('0x1a')],{'host':_0xd3a6('0x1c'),'port':0x18eb});var socket=require(_0xd3a6('0x1d'))(new Redis(config[_0xd3a6('0x1a')]));require(_0xd3a6('0x1e'))['register'](socket);function respondWithStatusCode(_0x473a97,_0xf5ace5){_0xf5ace5=_0xf5ace5||0xcc;return function(_0x171a8f){if(_0x171a8f){return _0x473a97['sendStatus'](_0xf5ace5);}return _0x473a97[_0xd3a6('0x1f')](_0xf5ace5)[_0xd3a6('0x20')]();};}function respondWithResult(_0x1781f6,_0x57d826){_0x57d826=_0x57d826||0xc8;return function(_0x3498d5){if(_0x3498d5){return _0x1781f6['status'](_0x57d826)['json'](_0x3498d5);}};}function respondWithFilteredResult(_0x28b63c,_0x8d1286){return function(_0x32683f){if(_0x32683f){var _0xbe58b4=typeof _0x8d1286[_0xd3a6('0x21')]===_0xd3a6('0x22')&&typeof _0x8d1286[_0xd3a6('0x23')]==='undefined';var _0x348ae9=_0x32683f['count'];var _0x6c6d21=_0xbe58b4?0x0:_0x8d1286[_0xd3a6('0x21')];var _0x12f2c1=_0xbe58b4?_0x32683f[_0xd3a6('0x24')]:_0x8d1286[_0xd3a6('0x21')]+_0x8d1286[_0xd3a6('0x23')];var _0x54c193;if(_0x12f2c1>=_0x348ae9){_0x12f2c1=_0x348ae9;_0x54c193=0xc8;}else{_0x54c193=0xce;}_0x28b63c[_0xd3a6('0x1f')](_0x54c193);return _0x28b63c[_0xd3a6('0x25')]('Content-Range',_0x6c6d21+'-'+_0x12f2c1+'/'+_0x348ae9)['json'](_0x32683f);}return null;};}function patchUpdates(_0x5846bc){return function(_0x573870){try{jsonpatch['apply'](_0x573870,_0x5846bc,!![]);}catch(_0x98a12a){return BPromise[_0xd3a6('0x26')](_0x98a12a);}return _0x573870[_0xd3a6('0x27')]();};}function saveUpdates(_0x5abd33,_0x456541){return function(_0x58e53a){if(_0x58e53a){return _0x58e53a[_0xd3a6('0x28')](_0x5abd33)[_0xd3a6('0x29')](function(_0x429079){return _0x429079;});}return null;};}function removeEntity(_0x4f6130,_0x14316b){return function(_0x3bc8d1){if(_0x3bc8d1){return _0x3bc8d1[_0xd3a6('0x2a')]()[_0xd3a6('0x29')](function(){_0x4f6130[_0xd3a6('0x1f')](0xcc)[_0xd3a6('0x20')]();});}};}function handleEntityNotFound(_0x5650d1,_0x30df90){return function(_0x2b5448){if(!_0x2b5448){_0x5650d1[_0xd3a6('0x2b')](0x194);}return _0x2b5448;};}function handleError(_0x3f6d35,_0x30abc2){_0x30abc2=_0x30abc2||0x1f4;return function(_0x45c628){logger['error'](_0x45c628['stack']);if(_0x45c628[_0xd3a6('0x2c')]){delete _0x45c628[_0xd3a6('0x2c')];}_0x3f6d35[_0xd3a6('0x1f')](_0x30abc2)[_0xd3a6('0x2d')](_0x45c628);};}function getInteractionUsers(_0x4c05a2,_0x3de3bb){return new BPromise(function(_0xa4efd,_0x4d322a){try{if(_0x3de3bb[_0x4c05a2['id']]){_0x4c05a2[_0xd3a6('0x2e')]=_['map'](_0x3de3bb[_0x4c05a2['id']],function(_0x134337){return{'id':_0x134337['id'],'fullname':_0x134337[_0xd3a6('0x2f')]};});}}catch(_0x1eb499){_0x4d322a(_0x1eb499);}_0xa4efd(_0x4c05a2);});}function getInteractionTags(_0x87b75a,_0x12cb03){return new BPromise(function(_0xe27818,_0x2dbc2b){try{if(_0x87b75a['TagIds']){_0x87b75a['Tags']=[];_0x87b75a[_0xd3a6('0x30')][_0xd3a6('0x31')](',')[_0xd3a6('0x32')](function(_0x59337c){_0x87b75a[_0xd3a6('0x33')][_0xd3a6('0x34')](_0x12cb03[_0x59337c]);});}delete _0x87b75a[_0xd3a6('0x30')];}catch(_0x1603d9){_0x2dbc2b(_0x1603d9);}_0xe27818(_0x87b75a);});}function updateWhatsappInteraction(_0x3ebd0d,_0x36b28a,_0x21c23f){return new BPromise(function(_0x10352a,_0x59428a){return getInteractionUsers(_0x3ebd0d,_0x21c23f)[_0xd3a6('0x29')](function(_0x41981c){return getInteractionTags(_0x41981c,_0x36b28a);})[_0xd3a6('0x29')](function(_0x1f3c48){return getStateInteraction(_0x1f3c48);})[_0xd3a6('0x29')](function(_0x1c161f){_0x10352a(_0x1c161f);})['catch'](function(_0x16a30a){_0x59428a(_0x16a30a);});});}function getStateInteraction(_0x5cc122){return new BPromise(function(_0x263615){_0x5cc122[_0xd3a6('0x35')]=0x0;_0x5cc122[_0xd3a6('0x36')]=0x0;_0x5cc122[_0xd3a6('0x37')]=0x0;_0x5cc122['unmanaged']=0x0;_0x5cc122['total']=0x0;if(!_0x5cc122[_0xd3a6('0x38')]&&!_0x5cc122[_0xd3a6('0x39')]){_0x5cc122[_0xd3a6('0x35')]+=0x1;}if(!_0x5cc122['closed']&&_0x5cc122[_0xd3a6('0x39')]){_0x5cc122[_0xd3a6('0x36')]+=0x1;if(_0x5cc122['waiting']){_0x5cc122[_0xd3a6('0x35')]-=0x1;}}if(_0x5cc122['closed']&&_0x5cc122[_0xd3a6('0x39')]){_0x5cc122[_0xd3a6('0x37')]+=0x1;if(_0x5cc122['talking']){_0x5cc122[_0xd3a6('0x36')]-=0x1;}}if(_0x5cc122['closed']&&!_0x5cc122[_0xd3a6('0x39')]){_0x5cc122[_0xd3a6('0x3a')]+=0x1;if(_0x5cc122['waiting']){_0x5cc122[_0xd3a6('0x35')]-=0x1;}}_0x5cc122[_0xd3a6('0x3b')]+=0x1;_0x263615(_0x5cc122);});}exports[_0xd3a6('0x3c')]=function(_0x1fc06e,_0x5e412f){var _0x17037c={},_0x324dbd={},_0x23537a={'count':0x0,'rows':[]};var _0xc8fe07=_[_0xd3a6('0x3d')](db['WhatsappInteraction'][_0xd3a6('0x3e')],function(_0x5bd74a){return{'name':_0x5bd74a[_0xd3a6('0x3f')],'type':_0x5bd74a[_0xd3a6('0x40')][_0xd3a6('0x41')]};});_0x324dbd['model']=_[_0xd3a6('0x3d')](_0xc8fe07,'name');_0x324dbd[_0xd3a6('0x42')]=_['keys'](_0x1fc06e[_0xd3a6('0x42')]);_0x324dbd[_0xd3a6('0x43')]=_[_0xd3a6('0x44')](_0x324dbd[_0xd3a6('0x45')],_0x324dbd[_0xd3a6('0x42')]);_0x17037c[_0xd3a6('0x46')]=_[_0xd3a6('0x44')](_0x324dbd['model'],qs[_0xd3a6('0x47')](_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x47')]));_0x17037c[_0xd3a6('0x46')]=_0x17037c['attributes'][_0xd3a6('0x48')]?_0x17037c[_0xd3a6('0x46')]:_0x324dbd[_0xd3a6('0x45')];if(!_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x49')](_0xd3a6('0x4a'))){_0x17037c[_0xd3a6('0x23')]=qs[_0xd3a6('0x23')](_0x1fc06e['query'][_0xd3a6('0x23')]);_0x17037c[_0xd3a6('0x21')]=qs[_0xd3a6('0x21')](_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x21')]);}_0x17037c['order']=qs[_0xd3a6('0x4b')](_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x4b')]);_0x17037c[_0xd3a6('0x4c')]=qs[_0xd3a6('0x43')](_[_0xd3a6('0x4d')](_0x1fc06e[_0xd3a6('0x42')],_0x324dbd[_0xd3a6('0x43')]),_0xc8fe07);var _0x4ac576=[];var _0x7828c2=squel['select']()[_0xd3a6('0x4e')]('id')[_0xd3a6('0x4e')]('name')[_0xd3a6('0x4e')](_0xd3a6('0x4f'))[_0xd3a6('0x50')](_0xd3a6('0x51'));var _0x1c48c3=squel[_0xd3a6('0x52')]()[_0xd3a6('0x4e')](_0xd3a6('0x53'))[_0xd3a6('0x4e')](_0xd3a6('0x54'))['field'](_0xd3a6('0x55'))[_0xd3a6('0x50')](_0xd3a6('0x56'),'ui')[_0xd3a6('0x57')](_0xd3a6('0x58'),'u',_0xd3a6('0x59'));var _0x44e26d=squel[_0xd3a6('0x52')]()[_0xd3a6('0x50')](_0xd3a6('0x5a'),'i')['left_join'](_0xd3a6('0x5b'),'c',_0xd3a6('0x5c'))[_0xd3a6('0x57')]('users','o',_0xd3a6('0x5d'))['left_join']('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xd3a6('0x5e'),'me',_0xd3a6('0x5f'))[_0xd3a6('0x57')](_0xd3a6('0x60'),'it',_0xd3a6('0x61'))[_0xd3a6('0x57')](_0xd3a6('0x51'),'t',_0xd3a6('0x62'));var _0x347e71=squel[_0xd3a6('0x63')]();var _0x4c1c41=[];var _0x5e9f1d=squel[_0xd3a6('0x63')]();var _0x14f7b6;if(_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x64')]){_0x14f7b6=as[_0xd3a6('0x65')](_0x1fc06e['query'][_0xd3a6('0x64')]);var _0x13e1e1=_0x14f7b6[_0xd3a6('0x66')];for(var _0x2950e8=0x0;_0x2950e8<_0x14f7b6['conditions']['length'];_0x2950e8++){var _0x3badf8=_0x14f7b6[_0xd3a6('0x67')][_0x2950e8];var _0x558689='i';var _0x381ebb=_[_0xd3a6('0x68')](_0xc8fe07,[_0xd3a6('0x2c'),_0x3badf8['field']]);if(!_0x381ebb){switch(_0x3badf8[_0xd3a6('0x4e')]){case _0xd3a6('0x69'):if(_0x3badf8['value']==0x1){_0x44e26d[_0xd3a6('0x6a')]('`'+_0x3badf8[_0xd3a6('0x4e')]+'`\x20=\x200');}else{_0x44e26d['having']('`'+_0x3badf8[_0xd3a6('0x4e')]+_0xd3a6('0x6b'));}break;case'Contact':if(_0x3badf8['operator']===_0xd3a6('0x6c')){if(_0x3badf8['value'][_0xd3a6('0x31')]('\x20')[_0xd3a6('0x48')]>0x1){_0x347e71[_0x13e1e1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd3a6('0x6d')](_0x3badf8['value']),null);}else{var _0x59426d='%'+_0x3badf8[_0xd3a6('0x6e')]+'%';_0x347e71[_0x13e1e1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x59426d,_0x59426d,_0x59426d);}}else{_0x381ebb=_[_0xd3a6('0x68')](_0xc8fe07,[_0xd3a6('0x2c'),_0xd3a6('0x6f')]);_0x3badf8[_0xd3a6('0x4e')]=_0xd3a6('0x6f');_0x37415f=as['buildExpression'](_0x558689,_0x381ebb[_0xd3a6('0x40')],_0x3badf8);_0x347e71[_0x13e1e1](_0x37415f[_0xd3a6('0x70')],_0x37415f[_0xd3a6('0x6e')][_0xd3a6('0x71')],_0x37415f['value'][_0xd3a6('0x20')]);}break;case _0xd3a6('0x72'):var _0x911ff0=_0x3badf8[_0xd3a6('0x6e')][_0xd3a6('0x31')](',')['map'](function(_0x49cc6e){return Number(_0x49cc6e);});_0x911ff0[_0xd3a6('0x32')](function(_0x49bec2){_0x5e9f1d['or'](_0xd3a6('0x73'),'%,'+_0x49bec2+',%');});_0x4c1c41=_[_0xd3a6('0x74')](_0x4c1c41,_0x911ff0);break;case _0xd3a6('0x75'):if(_0x3badf8[_0xd3a6('0x76')]===_0xd3a6('0x6c')){_0x347e71[_0x13e1e1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3badf8['value']+'%',null);}else{_0x381ebb=_[_0xd3a6('0x68')](_0xc8fe07,['name','UserId']);_0x3badf8[_0xd3a6('0x4e')]=_0xd3a6('0x39');_0x37415f=as[_0xd3a6('0x77')](_0x558689,_0x381ebb[_0xd3a6('0x40')],_0x3badf8);_0x347e71[_0x13e1e1](_0x37415f[_0xd3a6('0x70')],_0x37415f[_0xd3a6('0x6e')]['start'],_0x37415f[_0xd3a6('0x6e')][_0xd3a6('0x20')]);}break;case _0xd3a6('0x78'):_0x37415f=as['buildExpression']('me',null,_0x3badf8);_0x347e71[_0x13e1e1](_0x37415f[_0xd3a6('0x70')],_0x37415f[_0xd3a6('0x6e')]['start'],_0x37415f[_0xd3a6('0x6e')]['end']);break;}}else{var _0x37415f=as[_0xd3a6('0x77')](_0x558689,_0x381ebb[_0xd3a6('0x40')],_0x3badf8);_0x347e71[_0x13e1e1](_0x37415f['text'],_0x37415f[_0xd3a6('0x6e')]['start'],_0x37415f[_0xd3a6('0x6e')][_0xd3a6('0x20')]);}}}else{var _0x3794cc=_(_0x1fc06e['query'])[_0xd3a6('0x79')]()[_0xd3a6('0x3d')](function(_0x532b07){return _[_0xd3a6('0x7a')](_0xc8fe07,[_0xd3a6('0x2c'),_0x532b07])?_0x532b07:undefined;})[_0xd3a6('0x7b')]()[_0xd3a6('0x6e')]();if(!_[_0xd3a6('0x7c')](_0x3794cc)){_0x3794cc[_0xd3a6('0x32')](function(_0x4a6449){if(_0x4a6449==='WhatsappAccountId'){_0x44e26d[_0xd3a6('0x4c')](_0xd3a6('0x7d'),[][_0xd3a6('0x7e')](_0x1fc06e[_0xd3a6('0x42')][_0x4a6449]));}else if(_0x4a6449==='createdAt'){var _0x20e775=JSON[_0xd3a6('0x7f')](_0x1fc06e[_0xd3a6('0x42')][_0x4a6449])[_0xd3a6('0x80')];var _0x5a04bf=JSON[_0xd3a6('0x7f')](_0x1fc06e['query'][_0x4a6449])[_0xd3a6('0x81')];_0x44e26d[_0xd3a6('0x4c')](_0xd3a6('0x82'),_0x20e775,_0x5a04bf);}else{if(_0x1fc06e[_0xd3a6('0x42')][_0x4a6449]===_0xd3a6('0x83')){_0x44e26d[_0xd3a6('0x4c')]('i.'+_0x4a6449+_0xd3a6('0x84'));}else{_0x44e26d[_0xd3a6('0x4c')]('i.'+_0x4a6449+_0xd3a6('0x85'),_0x1fc06e[_0xd3a6('0x42')][_0x4a6449]);}}});}if(_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x86')]){if(_0x1fc06e['query'][_0xd3a6('0x86')]==0x1){_0x44e26d['having'](_0xd3a6('0x87'));}else{_0x44e26d[_0xd3a6('0x6a')](_0xd3a6('0x88'));}}if(_0x1fc06e['query'][_0xd3a6('0x89')]){_0x4c1c41=_[_0xd3a6('0x8a')](_0x1fc06e['query'][_0xd3a6('0x89')])?_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x89')]:new Array(_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x89')]);_0x4c1c41[_0xd3a6('0x32')](function(_0xb64ce4){_0x5e9f1d['or'](_0xd3a6('0x73'),'%,'+_0xb64ce4+',%');});}if(_0x1fc06e['query'][_0xd3a6('0x8b')]){var _0x38d297=_0x1fc06e[_0xd3a6('0x42')][_0xd3a6('0x8b')][_0xd3a6('0x8c')]('\x5c','\x5c\x5c')[_0xd3a6('0x8c')](/'/g,'\x27\x27');if(qs[_0xd3a6('0x8d')](_0x38d297)){_0x347e71['or'](_0xd3a6('0x8e'),_0x38d297+'%')['or'](_0xd3a6('0x8f'),_0x38d297+'%');}else{_0x347e71['or'](_0xd3a6('0x90'),qs[_0xd3a6('0x6d')](_0x38d297))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x38d297+'%');}}}_0x44e26d[_0xd3a6('0x4c')](_0x347e71);_0x44e26d['group'](_0xd3a6('0x91'));var _0x3d48e8={'type':db['Sequelize'][_0xd3a6('0x92')][_0xd3a6('0x93')],'raw':!![]};var _0x1d3d5e=_0x44e26d[_0xd3a6('0x94')]();_0x1d3d5e[_0xd3a6('0x4e')](_0xd3a6('0x91'));_0x1d3d5e[_0xd3a6('0x4e')](_0xd3a6('0x95'),_0xd3a6('0x69'));if(_0x17037c[_0xd3a6('0x96')]){_0x17037c[_0xd3a6('0x96')]['forEach'](function(_0x2b0706){var _0x263639=_0x2b0706[0x0]===_0xd3a6('0x97')?_0x2b0706[0x0]:'i.'+_0x2b0706[0x0];_0x44e26d[_0xd3a6('0x96')](_0x263639,_0x2b0706[0x1]===_0xd3a6('0x98')?![]:!![]);});}if(!_[_0xd3a6('0x7c')](_0x4c1c41)){_0x44e26d['having'](_0x5e9f1d);_0x1d3d5e[_0xd3a6('0x4c')](_0xd3a6('0x99'),_0x4c1c41);}BPromise['resolve']()[_0xd3a6('0x29')](function(){if(!_0x14f7b6){if(_0x1fc06e['query'][_0xd3a6('0x9a')])return;_0x1d3d5e[_0xd3a6('0x4c')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x44e26d[_0xd3a6('0x4c')](_0xd3a6('0x9b'));return;}if(_0x1fc06e[_0xd3a6('0x9c')][_0xd3a6('0x9d')]!=='agent')return;return _0x1fc06e['user'][_0xd3a6('0x9e')]({'attributes':['id'],'raw':!![]})[_0xd3a6('0x29')](function(_0x326894){if(_[_0xd3a6('0x7c')](_0x326894)){_0x1d3d5e[_0xd3a6('0x4c')]('i.WhatsappAccountId\x20IS\x20NULL');_0x44e26d[_0xd3a6('0x4c')](_0xd3a6('0x9f'));}else{_0x1d3d5e[_0xd3a6('0x4c')](_0xd3a6('0x7d'),_[_0xd3a6('0x3d')](_0x326894,'id'));_0x44e26d[_0xd3a6('0x4c')](_0xd3a6('0x7d'),_[_0xd3a6('0x3d')](_0x326894,'id'));}});})[_0xd3a6('0x29')](function(){if(_0x1fc06e[_0xd3a6('0x9c')][_0xd3a6('0x9d')]===_0xd3a6('0xa0')&&!_0x14f7b6&&!_0x1fc06e['query']['WhatsappAccountId'])return[];return db['sequelize'][_0xd3a6('0x42')](_0x1d3d5e[_0xd3a6('0xa1')](),_0x3d48e8);})['then'](function(_0x1f69f4){_0x23537a[_0xd3a6('0x24')]=_0x1f69f4[_0xd3a6('0x48')];if(_0x23537a['count']===0x0)return[];return db[_0xd3a6('0xa2')][_0xd3a6('0x42')](_0x7828c2[_0xd3a6('0xa1')](),_0x3d48e8)[_0xd3a6('0x29')](function(_0x580214){_0x4ac576=_['keyBy'](_0x580214,'id');_0x3d48e8=_[_0xd3a6('0xa3')](_0x3d48e8,{'model':db[_0xd3a6('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fc06e[_0xd3a6('0x42')]['fields']){_0x17037c['attributes'][_0xd3a6('0x32')](function(_0x3174f8){_0x44e26d[_0xd3a6('0x4e')]('i.'+_0x3174f8);});}else{_0x44e26d['field'](_0xd3a6('0x95'),_0xd3a6('0x69'));_0x44e26d['field'](_0xd3a6('0xa5'),'Account.key');_0x44e26d[_0xd3a6('0x4e')](_0xd3a6('0xa6'),_0xd3a6('0xa7'));_0x44e26d[_0xd3a6('0x4e')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x44e26d[_0xd3a6('0x4e')](_0xd3a6('0xa8'));_0x44e26d[_0xd3a6('0x4e')]('c.firstName','Contact.firstName');_0x44e26d[_0xd3a6('0x4e')]('c.lastName',_0xd3a6('0xa9'));_0x44e26d['field'](_0xd3a6('0xaa'),_0xd3a6('0xab'));_0x44e26d[_0xd3a6('0x4e')](_0xd3a6('0xac'),_0xd3a6('0xad'));_0x44e26d[_0xd3a6('0x4e')](_0xd3a6('0xae'),_0xd3a6('0xaf'));_0x44e26d[_0xd3a6('0x4e')]('c.fax','Contact.fax');_0x44e26d['field'](_0xd3a6('0xb0'),_0xd3a6('0xb1'));_0x44e26d[_0xd3a6('0x4e')](_0xd3a6('0xb2'),_0xd3a6('0xb3'));_0x44e26d[_0xd3a6('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd3a6('0x30'));}if(_0x17037c[_0xd3a6('0x23')])_0x44e26d['limit'](_0x17037c[_0xd3a6('0x23')]);if(_0x17037c[_0xd3a6('0x21')])_0x44e26d[_0xd3a6('0x21')](_0x17037c[_0xd3a6('0x21')]);return db[_0xd3a6('0xa2')][_0xd3a6('0x42')](_0x44e26d[_0xd3a6('0xa1')](),_0x3d48e8);})[_0xd3a6('0x29')](function(_0x1a820f){if(_0x1a820f[_0xd3a6('0x48')]>0x0)_0x1c48c3['where'](_0xd3a6('0xb4'),_['map'](_0x1a820f,'id'));return db[_0xd3a6('0xa2')]['query'](_0x1c48c3['toString'](),_0x3d48e8)[_0xd3a6('0x29')](function(_0x3bf97f){var _0x502076=_[_0xd3a6('0xb5')](_0x3bf97f,'WhatsappInteractionId');var _0x43ba24=[];_0x1a820f[_0xd3a6('0x32')](function(_0x379ff0){_0x43ba24[_0xd3a6('0x34')](updateWhatsappInteraction(_0x379ff0,_0x4ac576,_0x502076));});return BPromise['all'](_0x43ba24);});});})[_0xd3a6('0x29')](function(_0x459607){_0x23537a[_0xd3a6('0xb6')]=_0x459607;return _0x23537a;})[_0xd3a6('0x29')](respondWithFilteredResult(_0x5e412f,_0x17037c))[_0xd3a6('0xb7')](handleError(_0x5e412f,null));};exports['show']=function(_0x2981fd,_0x35fd6a){var _0x6478db={'raw':![],'where':{'id':_0x2981fd['params']['id']}},_0xaea243={};_0xaea243[_0xd3a6('0x45')]=_[_0xd3a6('0x79')](db[_0xd3a6('0xa4')][_0xd3a6('0x3e')]);_0xaea243[_0xd3a6('0x42')]=_[_0xd3a6('0x79')](_0x2981fd['query']);_0xaea243[_0xd3a6('0x43')]=_[_0xd3a6('0x44')](_0xaea243['model'],_0xaea243[_0xd3a6('0x42')]);_0x6478db['attributes']=_[_0xd3a6('0x44')](_0xaea243[_0xd3a6('0x45')],qs['fields'](_0x2981fd[_0xd3a6('0x42')][_0xd3a6('0x47')]));_0x6478db[_0xd3a6('0x46')]=_0x6478db[_0xd3a6('0x46')][_0xd3a6('0x48')]?_0x6478db[_0xd3a6('0x46')]:_0xaea243[_0xd3a6('0x45')];if(_0x2981fd['query'][_0xd3a6('0xb8')]){_0x6478db[_0xd3a6('0xb9')]=[{'all':!![]}];}_0x6478db=_[_0xd3a6('0xa3')]({},_0x6478db,_0x2981fd[_0xd3a6('0xba')]);return db[_0xd3a6('0xa4')][_0xd3a6('0x68')](_0x6478db)[_0xd3a6('0x29')](handleEntityNotFound(_0x35fd6a,null))['then'](respondWithResult(_0x35fd6a,null))[_0xd3a6('0xb7')](handleError(_0x35fd6a,null));};exports[_0xd3a6('0xbb')]=function(_0xb7dda3,_0x2433fc){return db[_0xd3a6('0xa4')]['create'](_0xb7dda3[_0xd3a6('0x78')],{})[_0xd3a6('0x29')](respondWithResult(_0x2433fc,0xc9))['catch'](handleError(_0x2433fc,null));};exports[_0xd3a6('0x28')]=function(_0x5cdea7,_0x630722){if(_0x5cdea7[_0xd3a6('0x78')]['id']){delete _0x5cdea7[_0xd3a6('0x78')]['id'];}return db[_0xd3a6('0xa4')][_0xd3a6('0x68')]({'where':{'id':_0x5cdea7[_0xd3a6('0xbc')]['id']}})['then'](handleEntityNotFound(_0x630722,null))[_0xd3a6('0x29')](saveUpdates(_0x5cdea7[_0xd3a6('0x78')],null))[_0xd3a6('0x29')](respondWithResult(_0x630722,null))[_0xd3a6('0xb7')](handleError(_0x630722,null));};exports[_0xd3a6('0x2a')]=function(_0x2f5718,_0x3e5678){return db[_0xd3a6('0xa4')][_0xd3a6('0x68')]({'where':{'id':_0x2f5718[_0xd3a6('0xbc')]['id']}})['then'](handleEntityNotFound(_0x3e5678,null))[_0xd3a6('0x29')](removeEntity(_0x3e5678,null))[_0xd3a6('0xb7')](handleError(_0x3e5678,null));};exports['describe']=function(_0x27f070,_0x24dfb8){return db['WhatsappInteraction'][_0xd3a6('0xbd')]()[_0xd3a6('0x29')](respondWithResult(_0x24dfb8,null))[_0xd3a6('0xb7')](handleError(_0x24dfb8,null));};exports[_0xd3a6('0xbe')]=function(_0x428820,_0x310199,_0x3cf371){return db['WhatsappMessage'][_0xd3a6('0x68')]({'where':{'id':_0x428820[_0xd3a6('0xbc')]['id']}})[_0xd3a6('0x29')](handleEntityNotFound(_0x310199,null))[_0xd3a6('0x29')](function(_0x3bd143){if(_0x3bd143){return _0x3bd143[_0xd3a6('0xbe')](_0x428820['body'][_0xd3a6('0xbf')],_[_0xd3a6('0xc0')](_0x428820[_0xd3a6('0x78')],['ids','id'])||{});}})[_0xd3a6('0x29')](respondWithResult(_0x310199,null))['catch'](handleError(_0x310199,null));};exports[_0xd3a6('0xc1')]=function(_0x17bbec,_0x4806b0,_0x26213b){var _0x3a12b8={'raw':![],'where':{}};var _0x19bdf3={};var _0x1ecb64={'count':0x0,'rows':[]};return db[_0xd3a6('0xa4')][_0xd3a6('0xc2')]({'where':{'id':_0x17bbec[_0xd3a6('0xbc')]['id']}})[_0xd3a6('0x29')](handleEntityNotFound(_0x4806b0,null))[_0xd3a6('0x29')](function(_0x1b2533){if(_0x1b2533){_0x19bdf3[_0xd3a6('0x45')]=_['keys'](db[_0xd3a6('0xc3')][_0xd3a6('0x3e')]);_0x19bdf3[_0xd3a6('0x42')]=_[_0xd3a6('0x79')](_0x17bbec['query']);_0x19bdf3[_0xd3a6('0x43')]=_[_0xd3a6('0x44')](_0x19bdf3[_0xd3a6('0x45')],_0x19bdf3[_0xd3a6('0x42')]);_0x3a12b8[_0xd3a6('0x46')]=_['intersection'](_0x19bdf3[_0xd3a6('0x45')],qs[_0xd3a6('0x47')](_0x17bbec[_0xd3a6('0x42')]['fields']));_0x3a12b8[_0xd3a6('0x46')]=_0x3a12b8[_0xd3a6('0x46')][_0xd3a6('0x48')]?_0x3a12b8[_0xd3a6('0x46')]:_0x19bdf3[_0xd3a6('0x45')];if(!_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x49')](_0xd3a6('0x4a'))){_0x3a12b8[_0xd3a6('0x23')]=qs[_0xd3a6('0x23')](_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x23')]);_0x3a12b8['offset']=qs['offset'](_0x17bbec[_0xd3a6('0x42')]['offset']);}_0x3a12b8[_0xd3a6('0x96')]=qs['sort'](_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x4b')]);_0x3a12b8[_0xd3a6('0x4c')]=qs[_0xd3a6('0x43')](_[_0xd3a6('0x4d')](_0x17bbec[_0xd3a6('0x42')],_0x19bdf3['filters']));_0x3a12b8['where']['WhatsappInteractionId']=_0x1b2533['id'];if(_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x8b')]){_0x3a12b8[_0xd3a6('0x4c')]=_[_0xd3a6('0xa3')](_0x3a12b8[_0xd3a6('0x4c')],{'$or':_[_0xd3a6('0x3d')](_0x3a12b8[_0xd3a6('0x46')],function(_0x1ce32c){var _0x2dc507={};_0x2dc507[_0x1ce32c]={'$like':'%'+_0x17bbec['query'][_0xd3a6('0x8b')]+'%'};return _0x2dc507;})});}if(_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x80')]){var _0x40d57a=_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0x80')][_0xd3a6('0x31')](',');var _0x5693c5={};_0x5693c5[_0x40d57a[0x0]]={'$gte':moment(_0x40d57a[0x1])[_0xd3a6('0xc4')](_0xd3a6('0xc5'))};_0x3a12b8[_0xd3a6('0x4c')]=_[_0xd3a6('0xa3')](_0x3a12b8['where'],_0x5693c5);}_0x3a12b8=_['merge']({},_0x3a12b8,_0x17bbec[_0xd3a6('0xba')]);return db[_0xd3a6('0xc3')][_0xd3a6('0x24')]({'where':_0x3a12b8[_0xd3a6('0x4c')]})[_0xd3a6('0x29')](function(_0xf07683){_0x1ecb64[_0xd3a6('0x24')]=_0xf07683;if(_0x17bbec[_0xd3a6('0x42')][_0xd3a6('0xb8')]){_0x3a12b8['include']=[{'all':!![]}];}return db[_0xd3a6('0xc3')][_0xd3a6('0xc6')](_0x3a12b8);})['then'](function(_0x19473d){_0x1ecb64['rows']=_0x19473d;return _0x1ecb64;});}})['then'](respondWithFilteredResult(_0x4806b0,_0x3a12b8))['catch'](handleError(_0x4806b0,null));};exports[_0xd3a6('0xc7')]=function(_0xcf7765,_0x1051ef,_0x164ee1){return db[_0xd3a6('0xa4')]['find']({'where':{'id':_0xcf7765['params']['id']}})[_0xd3a6('0x29')](handleEntityNotFound(_0x1051ef,null))['then'](function(_0x7e4504){if(_0x7e4504){return _0x7e4504['setTags'](_0xcf7765[_0xd3a6('0x78')]['ids'],_[_0xd3a6('0xc0')](_0xcf7765[_0xd3a6('0x78')],[_0xd3a6('0xbf'),'id'])||{})[_0xd3a6('0xc8')](function(){return db['Tag'][_0xd3a6('0xc6')]({'attributes':['id',_0xd3a6('0x2c'),_0xd3a6('0x4f')],'where':{'id':_0xcf7765[_0xd3a6('0x78')][_0xd3a6('0xbf')]}});})[_0xd3a6('0x29')](function(_0x38468f){socket[_0xd3a6('0xc9')](_0xd3a6('0xca'),{'id':Number(_0xcf7765[_0xd3a6('0xbc')]['id']),'tags':_0x38468f||[]});return{'id':Number(_0xcf7765[_0xd3a6('0xbc')]['id']),'tags':_0x38468f||[]};});}})[_0xd3a6('0x29')](respondWithResult(_0x1051ef,null))['catch'](handleError(_0x1051ef,null));};exports['removeTags']=function(_0x504550,_0x4fbfb3,_0x57f437){return db[_0xd3a6('0xa4')][_0xd3a6('0x68')]({'where':{'id':_0x504550[_0xd3a6('0xbc')]['id']}})[_0xd3a6('0x29')](handleEntityNotFound(_0x4fbfb3,null))[_0xd3a6('0x29')](function(_0x44f1dd){if(_0x44f1dd){return _0x44f1dd[_0xd3a6('0xcb')](_0x504550[_0xd3a6('0x42')][_0xd3a6('0xbf')]);}})[_0xd3a6('0x29')](respondWithStatusCode(_0x4fbfb3,null))['catch'](handleError(_0x4fbfb3,null));};exports[_0xd3a6('0xcc')]=function(_0x1d4285,_0x56aef4){var _0xd1c5f4=moment()['unix']()['toString']();var _0xde2e9d=path[_0xd3a6('0xcd')](config[_0xd3a6('0xce')],'server',_0xd3a6('0xcf'),_0xd3a6('0xd0'));var _0x1d34da=path[_0xd3a6('0xcd')](config[_0xd3a6('0xce')],_0xd3a6('0xd1'),'files',_0xd3a6('0xd2'));var _0x489356=path['join'](_0xde2e9d,_0xd1c5f4);var _0x580573=util[_0xd3a6('0xc4')](_0xd3a6('0xd3'),_0x1d4285[_0xd3a6('0xbc')]['id'],_0xd1c5f4);var _0x58f867=path['join'](_0xde2e9d,_0x580573);var _0x2048bb=[];_0x2048bb[_0xd3a6('0x34')]({'model':db[_0xd3a6('0x75')],'as':'User','attributes':['id',_0xd3a6('0x2f')],'raw':!![]});_0x2048bb['push']({'model':db[_0xd3a6('0xd4')],'as':_0xd3a6('0xd5'),'attributes':['id',_0xd3a6('0xd6'),_0xd3a6('0xd7')],'raw':!![]});if(_0x1d4285[_0xd3a6('0x42')][_0xd3a6('0xd2')]){_0x2048bb['push']({'model':db['Attachment'],'as':_0xd3a6('0xd8'),'raw':!![]});}var _0x2d7f8b=[{'model':db[_0xd3a6('0xc3')],'as':'Messages','attributes':['id',_0xd3a6('0x78'),_0xd3a6('0xd9'),_0xd3a6('0xda'),'secret',_0xd3a6('0x86')],'include':_0x2048bb}];_0x2d7f8b['push']({'model':db[_0xd3a6('0xdb')],'as':'Account','attributes':['id',_0xd3a6('0x2c')]});_0x2d7f8b[_0xd3a6('0x34')]({'model':db[_0xd3a6('0x75')],'as':_0xd3a6('0xdc'),'attributes':['id','fullname']});return db[_0xd3a6('0xa4')][_0xd3a6('0x68')]({'where':{'id':_0x1d4285[_0xd3a6('0xbc')]['id']},'include':_0x2d7f8b})[_0xd3a6('0x29')](handleEntityNotFound(_0x56aef4,null))['then'](function(_0x51b7af){if(_0x51b7af){var _0x212d3c=_0x51b7af[_0xd3a6('0xdd')]({'plain':!![]});fs[_0xd3a6('0xde')](_0x489356);var _0x2b800e={'channel':_0xd3a6('0xdf'),'account':_0x212d3c[_0xd3a6('0xe0')][_0xd3a6('0x2c')],'agent':_0x212d3c[_0xd3a6('0xdc')]?_0x212d3c[_0xd3a6('0xdc')][_0xd3a6('0x2f')]:_0xd3a6('0xe1'),'createdAt':moment(_0x212d3c[_0xd3a6('0xd9')])[_0xd3a6('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x212d3c[_0xd3a6('0x38')]?moment(_0x212d3c[_0xd3a6('0xe2')])['format'](_0xd3a6('0xc5'))[_0xd3a6('0xa1')]():'','disposition':_0x212d3c[_0xd3a6('0xe3')],'messages':_(_0x212d3c[_0xd3a6('0xe4')])[_0xd3a6('0x8b')]({'secret':![]})['map'](function(_0x34529b){if(_0x34529b[_0xd3a6('0xd8')]){var _0x3ee82a=path['join'](_0x1d34da,_0x34529b[_0xd3a6('0xd8')]['basename']);if(fs[_0xd3a6('0xe5')](_0x3ee82a)){fs[_0xd3a6('0xe6')](_0x3ee82a)[_0xd3a6('0xe7')](fs[_0xd3a6('0xe8')](path['join'](_0x489356,_0x34529b[_0xd3a6('0xd8')][_0xd3a6('0xe9')])));}}return{'date':moment(_0x34529b['createdAt'])[_0xd3a6('0xc4')](_0xd3a6('0xc5'))[_0xd3a6('0xa1')](),'sender':_0x34529b[_0xd3a6('0xda')]==='out'?_0x34529b[_0xd3a6('0x75')]?_0x34529b[_0xd3a6('0x75')]['fullname']:'System':_0x34529b[_0xd3a6('0xd5')][_0xd3a6('0xd6')]+(_0x34529b[_0xd3a6('0xd5')]['lastName']?'\x20'+_0x34529b[_0xd3a6('0xd5')][_0xd3a6('0xd7')]:''),'body':_0x34529b[_0xd3a6('0xd8')]?_0x34529b[_0xd3a6('0xd8')]['basename']:_0x34529b[_0xd3a6('0x78')],'direction':_0x34529b[_0xd3a6('0xda')]===_0xd3a6('0xea')?'A':'C','secret':_0x34529b[_0xd3a6('0xeb')],'read':_0x34529b[_0xd3a6('0x86')],'attachment':_0x34529b['Attachment']};})[_0xd3a6('0x6e')]()};return ejs['renderFile'](path[_0xd3a6('0xcd')](config[_0xd3a6('0xce')],_0xd3a6('0xd1'),'views','downloadInteraction.ejs'),{'interaction':_0x2b800e})[_0xd3a6('0x29')](function(_0x4a0980){var _0x54cff9=path[_0xd3a6('0xcd')](_0x489356,'transcript-'+_0x212d3c['id']+'-'+_0xd1c5f4+_0xd3a6('0xec'));var _0x5051d={'path':_0x54cff9,'channel':_0xd3a6('0xdf'),'interactionId':_0x212d3c['id']};return pdf[_0xd3a6('0xed')](_0x4a0980,_0x5051d);})[_0xd3a6('0x29')](function(){return new BPromise(function(_0x5814fe,_0x33ffe0){zipdir(_0x489356,{'saveTo':_0x58f867},function(_0x16ba3f,_0x29bdae){if(_0x16ba3f)return _0x33ffe0(_0x16ba3f);return _0x5814fe(_0x29bdae);});})[_0xd3a6('0x29')](function(){return new BPromise(function(_0x73e834,_0x4ed4dc){rimraf(_0x489356,function(_0x4f4971){if(_0x4f4971)_0x4ed4dc(_0x4f4971);return _0x73e834();});});})[_0xd3a6('0x29')](function(){return _0x56aef4[_0xd3a6('0xcc')](_0x58f867,_0x580573,function(_0x9aa8cc){if(_0x9aa8cc){console[_0xd3a6('0xee')](_0xd3a6('0xef'),_0x9aa8cc);}else{fs[_0xd3a6('0xf0')](_0x58f867);}});});});}else{return _0x56aef4[_0xd3a6('0x2b')](0xc8);}})[_0xd3a6('0xb7')](handleError(_0x56aef4,null));}; \ No newline at end of file +var _0xab54=['addMessage','omit','ids','findOne','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','whatsappInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Account','get','mkdirSync','Whatsapp','N.A.','disposition','basename','createReadStream','pipe','createWriteStream','System','out','views','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','json','limit','count','offset','set','Content-Range','save','update','then','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','closed','UserId','waiting','total','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','select','field','color','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','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?','ContactId','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','text','body','some','WhatsappAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','include','options','create','params','destroy','describe','WhatsappMessage'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ab5('0x0'));var zipdir=require(_0x4ab5('0x1'));var jsonpatch=require(_0x4ab5('0x2'));var rp=require(_0x4ab5('0x3'));var moment=require(_0x4ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ab5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4ab5('0x6'));var ejs=require(_0x4ab5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ab5('0x8'));var squel=require('squel');var crypto=require(_0x4ab5('0x9'));var jsforce=require(_0x4ab5('0xa'));var deskjs=require(_0x4ab5('0xb'));var toCsv=require(_0x4ab5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ab5('0xc'));var qs=require(_0x4ab5('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4ab5('0xe'));var hardwareService=require(_0x4ab5('0xf'));var logger=require('../../config/logger')(_0x4ab5('0x10'));var utils=require(_0x4ab5('0x11'));var config=require(_0x4ab5('0x12'));var licenseUtil=require(_0x4ab5('0x13'));var db=require(_0x4ab5('0x14'))['db'];config[_0x4ab5('0x15')]=_[_0x4ab5('0x16')](config[_0x4ab5('0x15')],{'host':_0x4ab5('0x17'),'port':0x18eb});var socket=require(_0x4ab5('0x18'))(new Redis(config[_0x4ab5('0x15')]));require(_0x4ab5('0x19'))[_0x4ab5('0x1a')](socket);function respondWithStatusCode(_0x2617f0,_0x553247){_0x553247=_0x553247||0xcc;return function(_0x3b9e16){if(_0x3b9e16){return _0x2617f0['sendStatus'](_0x553247);}return _0x2617f0[_0x4ab5('0x1b')](_0x553247)['end']();};}function respondWithResult(_0x5ce262,_0x474dbe){_0x474dbe=_0x474dbe||0xc8;return function(_0x1b1ca5){if(_0x1b1ca5){return _0x5ce262[_0x4ab5('0x1b')](_0x474dbe)[_0x4ab5('0x1c')](_0x1b1ca5);}};}function respondWithFilteredResult(_0x5948f4,_0x151ec6){return function(_0x3f46c1){if(_0x3f46c1){var _0x4b60c1=typeof _0x151ec6['offset']==='undefined'&&typeof _0x151ec6[_0x4ab5('0x1d')]==='undefined';var _0x546e3b=_0x3f46c1[_0x4ab5('0x1e')];var _0x45abfc=_0x4b60c1?0x0:_0x151ec6[_0x4ab5('0x1f')];var _0x267466=_0x4b60c1?_0x3f46c1[_0x4ab5('0x1e')]:_0x151ec6[_0x4ab5('0x1f')]+_0x151ec6[_0x4ab5('0x1d')];var _0x4a6742;if(_0x267466>=_0x546e3b){_0x267466=_0x546e3b;_0x4a6742=0xc8;}else{_0x4a6742=0xce;}_0x5948f4[_0x4ab5('0x1b')](_0x4a6742);return _0x5948f4[_0x4ab5('0x20')](_0x4ab5('0x21'),_0x45abfc+'-'+_0x267466+'/'+_0x546e3b)[_0x4ab5('0x1c')](_0x3f46c1);}return null;};}function patchUpdates(_0x2bd268){return function(_0x45c0b4){try{jsonpatch['apply'](_0x45c0b4,_0x2bd268,!![]);}catch(_0xe5e093){return BPromise['reject'](_0xe5e093);}return _0x45c0b4[_0x4ab5('0x22')]();};}function saveUpdates(_0x3f3149,_0x38bdb3){return function(_0x24a585){if(_0x24a585){return _0x24a585[_0x4ab5('0x23')](_0x3f3149)[_0x4ab5('0x24')](function(_0x411829){return _0x411829;});}return null;};}function removeEntity(_0x2e1e05,_0x8c5203){return function(_0xe2d41f){if(_0xe2d41f){return _0xe2d41f['destroy']()[_0x4ab5('0x24')](function(){_0x2e1e05[_0x4ab5('0x1b')](0xcc)[_0x4ab5('0x25')]();});}};}function handleEntityNotFound(_0x278938,_0x1c3a2e){return function(_0x384474){if(!_0x384474){_0x278938[_0x4ab5('0x26')](0x194);}return _0x384474;};}function handleError(_0xa4b01f,_0x201aa5){_0x201aa5=_0x201aa5||0x1f4;return function(_0xe3869){logger[_0x4ab5('0x27')](_0xe3869[_0x4ab5('0x28')]);if(_0xe3869[_0x4ab5('0x29')]){delete _0xe3869[_0x4ab5('0x29')];}_0xa4b01f['status'](_0x201aa5)[_0x4ab5('0x2a')](_0xe3869);};}function getInteractionUsers(_0xc73eda,_0x3e5b88){return new BPromise(function(_0x513a4f,_0x5568e9){try{if(_0x3e5b88[_0xc73eda['id']]){_0xc73eda[_0x4ab5('0x2b')]=_[_0x4ab5('0x2c')](_0x3e5b88[_0xc73eda['id']],function(_0x33f7da){return{'id':_0x33f7da['id'],'fullname':_0x33f7da[_0x4ab5('0x2d')]};});}}catch(_0x4d428a){_0x5568e9(_0x4d428a);}_0x513a4f(_0xc73eda);});}function getInteractionTags(_0x18f3f0,_0x3fbf8a){return new BPromise(function(_0x598b4b,_0x3af166){try{if(_0x18f3f0[_0x4ab5('0x2e')]){_0x18f3f0[_0x4ab5('0x2f')]=[];_0x18f3f0['TagIds'][_0x4ab5('0x30')](',')[_0x4ab5('0x31')](function(_0x99e985){_0x18f3f0['Tags'][_0x4ab5('0x32')](_0x3fbf8a[_0x99e985]);});}delete _0x18f3f0['TagIds'];}catch(_0x24336f){_0x3af166(_0x24336f);}_0x598b4b(_0x18f3f0);});}function updateWhatsappInteraction(_0x4da284,_0x3fb1a6,_0x34938d){return new BPromise(function(_0x108c0a,_0x2eb260){return getInteractionUsers(_0x4da284,_0x34938d)['then'](function(_0x2ddd58){return getInteractionTags(_0x2ddd58,_0x3fb1a6);})[_0x4ab5('0x24')](function(_0x4a9a46){return getStateInteraction(_0x4a9a46);})[_0x4ab5('0x24')](function(_0x387f42){_0x108c0a(_0x387f42);})[_0x4ab5('0x33')](function(_0x1172e5){_0x2eb260(_0x1172e5);});});}function getStateInteraction(_0xf159e1){return new BPromise(function(_0x12f06a){_0xf159e1['waiting']=0x0;_0xf159e1[_0x4ab5('0x34')]=0x0;_0xf159e1[_0x4ab5('0x35')]=0x0;_0xf159e1[_0x4ab5('0x36')]=0x0;_0xf159e1['total']=0x0;if(!_0xf159e1[_0x4ab5('0x37')]&&!_0xf159e1[_0x4ab5('0x38')]){_0xf159e1[_0x4ab5('0x39')]+=0x1;}if(!_0xf159e1[_0x4ab5('0x37')]&&_0xf159e1[_0x4ab5('0x38')]){_0xf159e1[_0x4ab5('0x34')]+=0x1;if(_0xf159e1[_0x4ab5('0x39')]){_0xf159e1[_0x4ab5('0x39')]-=0x1;}}if(_0xf159e1['closed']&&_0xf159e1[_0x4ab5('0x38')]){_0xf159e1['answered']+=0x1;if(_0xf159e1[_0x4ab5('0x34')]){_0xf159e1[_0x4ab5('0x34')]-=0x1;}}if(_0xf159e1[_0x4ab5('0x37')]&&!_0xf159e1[_0x4ab5('0x38')]){_0xf159e1[_0x4ab5('0x36')]+=0x1;if(_0xf159e1[_0x4ab5('0x39')]){_0xf159e1[_0x4ab5('0x39')]-=0x1;}}_0xf159e1[_0x4ab5('0x3a')]+=0x1;_0x12f06a(_0xf159e1);});}exports[_0x4ab5('0x3b')]=function(_0x4aa2bf,_0x3407b6){var _0x33cd72={},_0x50cf77={},_0x19823b={'count':0x0,'rows':[]};var _0x411399=_[_0x4ab5('0x2c')](db[_0x4ab5('0x3c')][_0x4ab5('0x3d')],function(_0x368ee0){return{'name':_0x368ee0[_0x4ab5('0x3e')],'type':_0x368ee0['type'][_0x4ab5('0x3f')]};});_0x50cf77[_0x4ab5('0x40')]=_[_0x4ab5('0x2c')](_0x411399,_0x4ab5('0x29'));_0x50cf77[_0x4ab5('0x41')]=_[_0x4ab5('0x42')](_0x4aa2bf[_0x4ab5('0x41')]);_0x50cf77[_0x4ab5('0x43')]=_['intersection'](_0x50cf77[_0x4ab5('0x40')],_0x50cf77[_0x4ab5('0x41')]);_0x33cd72[_0x4ab5('0x44')]=_[_0x4ab5('0x45')](_0x50cf77[_0x4ab5('0x40')],qs[_0x4ab5('0x46')](_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x46')]));_0x33cd72['attributes']=_0x33cd72[_0x4ab5('0x44')]['length']?_0x33cd72[_0x4ab5('0x44')]:_0x50cf77[_0x4ab5('0x40')];if(!_0x4aa2bf[_0x4ab5('0x41')]['hasOwnProperty'](_0x4ab5('0x47'))){_0x33cd72[_0x4ab5('0x1d')]=qs[_0x4ab5('0x1d')](_0x4aa2bf['query']['limit']);_0x33cd72[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x4aa2bf['query']['offset']);}_0x33cd72[_0x4ab5('0x48')]=qs[_0x4ab5('0x49')](_0x4aa2bf['query']['sort']);_0x33cd72['where']=qs[_0x4ab5('0x43')](_[_0x4ab5('0x4a')](_0x4aa2bf['query'],_0x50cf77[_0x4ab5('0x43')]),_0x411399);var _0x48a35a=[];var _0x3daff0=squel[_0x4ab5('0x4b')]()[_0x4ab5('0x4c')]('id')[_0x4ab5('0x4c')](_0x4ab5('0x29'))[_0x4ab5('0x4c')](_0x4ab5('0x4d'))[_0x4ab5('0x4e')]('tools_tags');var _0x2b5d3f=squel[_0x4ab5('0x4b')]()['field']('u.id')[_0x4ab5('0x4c')](_0x4ab5('0x4f'))['field'](_0x4ab5('0x50'))['from'](_0x4ab5('0x51'),'ui')['left_join'](_0x4ab5('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x57a0a5=squel[_0x4ab5('0x4b')]()['from'](_0x4ab5('0x53'),'i')[_0x4ab5('0x54')]('cm_contacts','c',_0x4ab5('0x55'))[_0x4ab5('0x54')](_0x4ab5('0x52'),'o',_0x4ab5('0x56'))[_0x4ab5('0x54')](_0x4ab5('0x57'),'a',_0x4ab5('0x58'))[_0x4ab5('0x54')](_0x4ab5('0x59'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x4ab5('0x54')](_0x4ab5('0x5a'),'it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x4ab5('0x5b'),'t',_0x4ab5('0x5c'));var _0x34080f=squel[_0x4ab5('0x5d')]();var _0x16a1be=[];var _0x13ccca=squel[_0x4ab5('0x5d')]();var _0xcd3744;if(_0x4aa2bf['query'][_0x4ab5('0x5e')]){_0xcd3744=as[_0x4ab5('0x5f')](_0x4aa2bf[_0x4ab5('0x41')]['search']);var _0xbe20fb=_0xcd3744[_0x4ab5('0x60')];for(var _0x4c2e5a=0x0;_0x4c2e5a<_0xcd3744[_0x4ab5('0x61')][_0x4ab5('0x62')];_0x4c2e5a++){var _0x255743=_0xcd3744[_0x4ab5('0x61')][_0x4c2e5a];var _0xb404ea='i';var _0x220447=_[_0x4ab5('0x63')](_0x411399,[_0x4ab5('0x29'),_0x255743[_0x4ab5('0x4c')]]);if(!_0x220447){switch(_0x255743[_0x4ab5('0x4c')]){case _0x4ab5('0x64'):if(_0x255743[_0x4ab5('0x65')]==0x1){_0x57a0a5[_0x4ab5('0x66')]('`'+_0x255743['field']+'`\x20=\x200');}else{_0x57a0a5[_0x4ab5('0x66')]('`'+_0x255743[_0x4ab5('0x4c')]+_0x4ab5('0x67'));}break;case'Contact':if(_0x255743[_0x4ab5('0x68')]===_0x4ab5('0x69')){if(_0x255743[_0x4ab5('0x65')][_0x4ab5('0x30')]('\x20')[_0x4ab5('0x62')]>0x1){_0x34080f[_0xbe20fb](_0x4ab5('0x6a'),qs[_0x4ab5('0x6b')](_0x255743[_0x4ab5('0x65')]),null);}else{var _0x315238='%'+_0x255743[_0x4ab5('0x65')]+'%';_0x34080f[_0xbe20fb](_0x4ab5('0x6c'),_0x315238,_0x315238,_0x315238);}}else{_0x220447=_[_0x4ab5('0x63')](_0x411399,[_0x4ab5('0x29'),_0x4ab5('0x6d')]);_0x255743[_0x4ab5('0x4c')]=_0x4ab5('0x6d');_0x35b89c=as['buildExpression'](_0xb404ea,_0x220447[_0x4ab5('0x6e')],_0x255743);_0x34080f[_0xbe20fb](_0x35b89c['text'],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x6f')],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x25')]);}break;case _0x4ab5('0x70'):var _0x56f9eb=_0x255743['value'][_0x4ab5('0x30')](',')[_0x4ab5('0x2c')](function(_0x295811){return Number(_0x295811);});_0x56f9eb['forEach'](function(_0x3f13b5){_0x13ccca['or'](_0x4ab5('0x71'),'%,'+_0x3f13b5+',%');});_0x16a1be=_['union'](_0x16a1be,_0x56f9eb);break;case _0x4ab5('0x72'):if(_0x255743[_0x4ab5('0x68')]===_0x4ab5('0x69')){_0x34080f[_0xbe20fb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x255743[_0x4ab5('0x65')]+'%',null);}else{_0x220447=_[_0x4ab5('0x63')](_0x411399,[_0x4ab5('0x29'),_0x4ab5('0x38')]);_0x255743[_0x4ab5('0x4c')]='UserId';_0x35b89c=as[_0x4ab5('0x73')](_0xb404ea,_0x220447[_0x4ab5('0x6e')],_0x255743);_0x34080f[_0xbe20fb](_0x35b89c[_0x4ab5('0x74')],_0x35b89c['value'][_0x4ab5('0x6f')],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x25')]);}break;case _0x4ab5('0x75'):_0x35b89c=as[_0x4ab5('0x73')]('me',null,_0x255743);_0x34080f[_0xbe20fb](_0x35b89c[_0x4ab5('0x74')],_0x35b89c[_0x4ab5('0x65')]['start'],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x25')]);break;}}else{var _0x35b89c=as['buildExpression'](_0xb404ea,_0x220447['type'],_0x255743);_0x34080f[_0xbe20fb](_0x35b89c[_0x4ab5('0x74')],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x6f')],_0x35b89c[_0x4ab5('0x65')][_0x4ab5('0x25')]);}}}else{var _0x43bf11=_(_0x4aa2bf[_0x4ab5('0x41')])[_0x4ab5('0x42')]()[_0x4ab5('0x2c')](function(_0x4826a8){return _[_0x4ab5('0x76')](_0x411399,[_0x4ab5('0x29'),_0x4826a8])?_0x4826a8:undefined;})['compact']()[_0x4ab5('0x65')]();if(!_['isEmpty'](_0x43bf11)){_0x43bf11[_0x4ab5('0x31')](function(_0x3bfd3c){if(_0x3bfd3c===_0x4ab5('0x77')){_0x57a0a5[_0x4ab5('0x78')]('i.WhatsappAccountId\x20IN\x20?',[][_0x4ab5('0x79')](_0x4aa2bf[_0x4ab5('0x41')][_0x3bfd3c]));}else if(_0x3bfd3c===_0x4ab5('0x7a')){var _0x46bc22=JSON[_0x4ab5('0x7b')](_0x4aa2bf['query'][_0x3bfd3c])['$gte'];var _0x5ea7fb=JSON[_0x4ab5('0x7b')](_0x4aa2bf[_0x4ab5('0x41')][_0x3bfd3c])[_0x4ab5('0x7c')];_0x57a0a5[_0x4ab5('0x78')](_0x4ab5('0x7d'),_0x46bc22,_0x5ea7fb);}else{if(_0x4aa2bf[_0x4ab5('0x41')][_0x3bfd3c]===_0x4ab5('0x7e')){_0x57a0a5[_0x4ab5('0x78')]('i.'+_0x3bfd3c+'\x20IS\x20NULL');}else{_0x57a0a5[_0x4ab5('0x78')]('i.'+_0x3bfd3c+_0x4ab5('0x7f'),_0x4aa2bf[_0x4ab5('0x41')][_0x3bfd3c]);}}});}if(_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x80')]){if(_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x80')]==0x1){_0x57a0a5[_0x4ab5('0x66')](_0x4ab5('0x81'));}else{_0x57a0a5[_0x4ab5('0x66')](_0x4ab5('0x82'));}}if(_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x83')]){_0x16a1be=_[_0x4ab5('0x84')](_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x83')])?_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x83')]:new Array(_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x83')]);_0x16a1be['forEach'](function(_0x3029c2){_0x13ccca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3029c2+',%');});}if(_0x4aa2bf['query'][_0x4ab5('0x85')]){var _0xf7182=_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x85')][_0x4ab5('0x86')]('\x5c','\x5c\x5c')[_0x4ab5('0x86')](/'/g,'\x27\x27');if(qs[_0x4ab5('0x87')](_0xf7182)){_0x34080f['or'](_0x4ab5('0x88'),_0xf7182+'%')['or']('i.phone\x20LIKE\x20?',_0xf7182+'%');}else{_0x34080f['or'](_0x4ab5('0x89'),qs['getFullTextValue'](_0xf7182))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xf7182+'%');}}}_0x57a0a5[_0x4ab5('0x78')](_0x34080f);_0x57a0a5[_0x4ab5('0x8a')](_0x4ab5('0x8b'));var _0x5d95c9={'type':db[_0x4ab5('0x8c')][_0x4ab5('0x8d')][_0x4ab5('0x8e')],'raw':!![]};var _0x446e3a=_0x57a0a5[_0x4ab5('0x8f')]();_0x446e3a[_0x4ab5('0x4c')](_0x4ab5('0x8b'));_0x446e3a[_0x4ab5('0x4c')](_0x4ab5('0x90'),_0x4ab5('0x64'));if(_0x33cd72['order']){_0x33cd72[_0x4ab5('0x48')]['forEach'](function(_0x43b72a){var _0x27e279=_0x43b72a[0x0]===_0x4ab5('0x91')?_0x43b72a[0x0]:'i.'+_0x43b72a[0x0];_0x57a0a5[_0x4ab5('0x48')](_0x27e279,_0x43b72a[0x1]===_0x4ab5('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x16a1be)){_0x57a0a5[_0x4ab5('0x66')](_0x13ccca);_0x446e3a[_0x4ab5('0x78')](_0x4ab5('0x93'),_0x16a1be);}BPromise['resolve']()[_0x4ab5('0x24')](function(){if(!_0xcd3744){if(_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x77')])return;_0x446e3a[_0x4ab5('0x78')](_0x4ab5('0x94'));_0x57a0a5[_0x4ab5('0x78')](_0x4ab5('0x94'));return;}if(_0x4aa2bf[_0x4ab5('0x95')][_0x4ab5('0x96')]!==_0x4ab5('0x97'))return;return _0x4aa2bf[_0x4ab5('0x95')][_0x4ab5('0x98')]({'attributes':['id'],'raw':!![]})[_0x4ab5('0x24')](function(_0x14a5ca){if(_['isEmpty'](_0x14a5ca)){_0x446e3a[_0x4ab5('0x78')](_0x4ab5('0x99'));_0x57a0a5[_0x4ab5('0x78')](_0x4ab5('0x99'));}else{_0x446e3a[_0x4ab5('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4ab5('0x2c')](_0x14a5ca,'id'));_0x57a0a5[_0x4ab5('0x78')](_0x4ab5('0x9a'),_['map'](_0x14a5ca,'id'));}});})['then'](function(){if(_0x4aa2bf[_0x4ab5('0x95')]['role']==='agent'&&!_0xcd3744&&!_0x4aa2bf[_0x4ab5('0x41')][_0x4ab5('0x77')])return[];return db[_0x4ab5('0x9b')][_0x4ab5('0x41')](_0x446e3a[_0x4ab5('0x9c')](),_0x5d95c9);})[_0x4ab5('0x24')](function(_0x332844){_0x19823b['count']=_0x332844[_0x4ab5('0x62')];if(_0x19823b['count']===0x0)return[];return db[_0x4ab5('0x9b')]['query'](_0x3daff0[_0x4ab5('0x9c')](),_0x5d95c9)[_0x4ab5('0x24')](function(_0x1e1d19){_0x48a35a=_[_0x4ab5('0x9d')](_0x1e1d19,'id');_0x5d95c9=_[_0x4ab5('0x9e')](_0x5d95c9,{'model':db[_0x4ab5('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4aa2bf[_0x4ab5('0x41')]['fields']){_0x33cd72[_0x4ab5('0x44')][_0x4ab5('0x31')](function(_0x3a1160){_0x57a0a5[_0x4ab5('0x4c')]('i.'+_0x3a1160);});}else{_0x57a0a5['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0x9f'),'Account.key');_0x57a0a5['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x57a0a5[_0x4ab5('0x4c')]('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',_0x4ab5('0x91'));_0x57a0a5['field']('i.*');_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0xa0'),_0x4ab5('0xa1'));_0x57a0a5['field'](_0x4ab5('0xa2'),_0x4ab5('0xa3'));_0x57a0a5[_0x4ab5('0x4c')]('c.email',_0x4ab5('0xa4'));_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0xa5'),_0x4ab5('0xa6'));_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0xa7'),'Contact.mobile');_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0xa8'),_0x4ab5('0xa9'));_0x57a0a5[_0x4ab5('0x4c')](_0x4ab5('0xaa'),_0x4ab5('0xab'));_0x57a0a5[_0x4ab5('0x4c')]('o.internal',_0x4ab5('0xac'));_0x57a0a5['field'](_0x4ab5('0xad'),_0x4ab5('0x2e'));}if(_0x33cd72['limit'])_0x57a0a5[_0x4ab5('0x1d')](_0x33cd72[_0x4ab5('0x1d')]);if(_0x33cd72[_0x4ab5('0x1f')])_0x57a0a5['offset'](_0x33cd72[_0x4ab5('0x1f')]);return db[_0x4ab5('0x9b')][_0x4ab5('0x41')](_0x57a0a5['toString'](),_0x5d95c9);})[_0x4ab5('0x24')](function(_0x496fba){if(_0x496fba[_0x4ab5('0x62')]>0x0)_0x2b5d3f[_0x4ab5('0x78')](_0x4ab5('0xae'),_[_0x4ab5('0x2c')](_0x496fba,'id'));return db['sequelize'][_0x4ab5('0x41')](_0x2b5d3f[_0x4ab5('0x9c')](),_0x5d95c9)[_0x4ab5('0x24')](function(_0x33834a){var _0x2a2a02=_[_0x4ab5('0xaf')](_0x33834a,_0x4ab5('0xb0'));var _0x3a64fd=[];_0x496fba[_0x4ab5('0x31')](function(_0x1b0f8e){_0x3a64fd[_0x4ab5('0x32')](updateWhatsappInteraction(_0x1b0f8e,_0x48a35a,_0x2a2a02));});return BPromise[_0x4ab5('0xb1')](_0x3a64fd);});});})[_0x4ab5('0x24')](function(_0xf674a2){_0x19823b['rows']=_0xf674a2;return _0x19823b;})['then'](respondWithFilteredResult(_0x3407b6,_0x33cd72))['catch'](handleError(_0x3407b6,null));};exports['show']=function(_0x199d81,_0x24af9d){var _0x37d856={'raw':![],'where':{'id':_0x199d81['params']['id']}},_0x351135={};_0x351135[_0x4ab5('0x40')]=_[_0x4ab5('0x42')](db['WhatsappInteraction'][_0x4ab5('0x3d')]);_0x351135[_0x4ab5('0x41')]=_[_0x4ab5('0x42')](_0x199d81[_0x4ab5('0x41')]);_0x351135[_0x4ab5('0x43')]=_['intersection'](_0x351135['model'],_0x351135[_0x4ab5('0x41')]);_0x37d856['attributes']=_[_0x4ab5('0x45')](_0x351135[_0x4ab5('0x40')],qs['fields'](_0x199d81[_0x4ab5('0x41')][_0x4ab5('0x46')]));_0x37d856[_0x4ab5('0x44')]=_0x37d856[_0x4ab5('0x44')][_0x4ab5('0x62')]?_0x37d856[_0x4ab5('0x44')]:_0x351135[_0x4ab5('0x40')];if(_0x199d81[_0x4ab5('0x41')]['includeAll']){_0x37d856[_0x4ab5('0xb2')]=[{'all':!![]}];}_0x37d856=_['merge']({},_0x37d856,_0x199d81[_0x4ab5('0xb3')]);return db[_0x4ab5('0x3c')]['find'](_0x37d856)[_0x4ab5('0x24')](handleEntityNotFound(_0x24af9d,null))[_0x4ab5('0x24')](respondWithResult(_0x24af9d,null))[_0x4ab5('0x33')](handleError(_0x24af9d,null));};exports['create']=function(_0x1eb2c4,_0x59f6c3){return db[_0x4ab5('0x3c')][_0x4ab5('0xb4')](_0x1eb2c4[_0x4ab5('0x75')],{})[_0x4ab5('0x24')](respondWithResult(_0x59f6c3,0xc9))[_0x4ab5('0x33')](handleError(_0x59f6c3,null));};exports[_0x4ab5('0x23')]=function(_0x45e727,_0xabbdfd){if(_0x45e727[_0x4ab5('0x75')]['id']){delete _0x45e727[_0x4ab5('0x75')]['id'];}return db[_0x4ab5('0x3c')]['find']({'where':{'id':_0x45e727[_0x4ab5('0xb5')]['id']}})[_0x4ab5('0x24')](handleEntityNotFound(_0xabbdfd,null))[_0x4ab5('0x24')](saveUpdates(_0x45e727[_0x4ab5('0x75')],null))[_0x4ab5('0x24')](respondWithResult(_0xabbdfd,null))[_0x4ab5('0x33')](handleError(_0xabbdfd,null));};exports[_0x4ab5('0xb6')]=function(_0x14fa62,_0x355e67){return db['WhatsappInteraction'][_0x4ab5('0x63')]({'where':{'id':_0x14fa62[_0x4ab5('0xb5')]['id']}})['then'](handleEntityNotFound(_0x355e67,null))['then'](removeEntity(_0x355e67,null))[_0x4ab5('0x33')](handleError(_0x355e67,null));};exports[_0x4ab5('0xb7')]=function(_0x17ae00,_0x52d8cb){return db['WhatsappInteraction'][_0x4ab5('0xb7')]()[_0x4ab5('0x24')](respondWithResult(_0x52d8cb,null))[_0x4ab5('0x33')](handleError(_0x52d8cb,null));};exports['addMessage']=function(_0x2567c4,_0xef29a6,_0x1d7906){return db[_0x4ab5('0xb8')][_0x4ab5('0x63')]({'where':{'id':_0x2567c4[_0x4ab5('0xb5')]['id']}})['then'](handleEntityNotFound(_0xef29a6,null))[_0x4ab5('0x24')](function(_0x2dbbd2){if(_0x2dbbd2){return _0x2dbbd2[_0x4ab5('0xb9')](_0x2567c4[_0x4ab5('0x75')]['ids'],_[_0x4ab5('0xba')](_0x2567c4[_0x4ab5('0x75')],[_0x4ab5('0xbb'),'id'])||{});}})[_0x4ab5('0x24')](respondWithResult(_0xef29a6,null))[_0x4ab5('0x33')](handleError(_0xef29a6,null));};exports['getMessages']=function(_0x4f419b,_0x10e45f,_0x16b3c6){var _0x9a7d1c={'raw':![],'where':{}};var _0x37b40a={};var _0x59e10d={'count':0x0,'rows':[]};return db[_0x4ab5('0x3c')][_0x4ab5('0xbc')]({'where':{'id':_0x4f419b[_0x4ab5('0xb5')]['id']}})['then'](handleEntityNotFound(_0x10e45f,null))['then'](function(_0x154fba){if(_0x154fba){_0x37b40a[_0x4ab5('0x40')]=_[_0x4ab5('0x42')](db['WhatsappMessage'][_0x4ab5('0x3d')]);_0x37b40a[_0x4ab5('0x41')]=_[_0x4ab5('0x42')](_0x4f419b['query']);_0x37b40a[_0x4ab5('0x43')]=_['intersection'](_0x37b40a[_0x4ab5('0x40')],_0x37b40a[_0x4ab5('0x41')]);_0x9a7d1c[_0x4ab5('0x44')]=_[_0x4ab5('0x45')](_0x37b40a[_0x4ab5('0x40')],qs[_0x4ab5('0x46')](_0x4f419b[_0x4ab5('0x41')][_0x4ab5('0x46')]));_0x9a7d1c['attributes']=_0x9a7d1c[_0x4ab5('0x44')][_0x4ab5('0x62')]?_0x9a7d1c[_0x4ab5('0x44')]:_0x37b40a[_0x4ab5('0x40')];if(!_0x4f419b[_0x4ab5('0x41')][_0x4ab5('0xbd')]('nolimit')){_0x9a7d1c[_0x4ab5('0x1d')]=qs[_0x4ab5('0x1d')](_0x4f419b[_0x4ab5('0x41')][_0x4ab5('0x1d')]);_0x9a7d1c[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x4f419b['query'][_0x4ab5('0x1f')]);}_0x9a7d1c[_0x4ab5('0x48')]=qs['sort'](_0x4f419b[_0x4ab5('0x41')][_0x4ab5('0x49')]);_0x9a7d1c['where']=qs[_0x4ab5('0x43')](_[_0x4ab5('0x4a')](_0x4f419b[_0x4ab5('0x41')],_0x37b40a[_0x4ab5('0x43')]));_0x9a7d1c[_0x4ab5('0x78')][_0x4ab5('0xb0')]=_0x154fba['id'];if(_0x4f419b['query'][_0x4ab5('0x85')]){_0x9a7d1c[_0x4ab5('0x78')]=_['merge'](_0x9a7d1c[_0x4ab5('0x78')],{'$or':_[_0x4ab5('0x2c')](_0x9a7d1c['attributes'],function(_0x2dd069){var _0x41c321={};_0x41c321[_0x2dd069]={'$like':'%'+_0x4f419b[_0x4ab5('0x41')][_0x4ab5('0x85')]+'%'};return _0x41c321;})});}if(_0x4f419b['query']['$gte']){var _0x1e9692=_0x4f419b['query'][_0x4ab5('0xbe')]['split'](',');var _0x303bcc={};_0x303bcc[_0x1e9692[0x0]]={'$gte':moment(_0x1e9692[0x1])['format'](_0x4ab5('0xbf'))};_0x9a7d1c[_0x4ab5('0x78')]=_[_0x4ab5('0x9e')](_0x9a7d1c[_0x4ab5('0x78')],_0x303bcc);}_0x9a7d1c=_[_0x4ab5('0x9e')]({},_0x9a7d1c,_0x4f419b[_0x4ab5('0xb3')]);return db[_0x4ab5('0xb8')][_0x4ab5('0x1e')]({'where':_0x9a7d1c['where']})[_0x4ab5('0x24')](function(_0x111a98){_0x59e10d[_0x4ab5('0x1e')]=_0x111a98;if(_0x4f419b['query'][_0x4ab5('0xc0')]){_0x9a7d1c[_0x4ab5('0xb2')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4ab5('0xc1')](_0x9a7d1c);})['then'](function(_0x683f14){_0x59e10d[_0x4ab5('0xc2')]=_0x683f14;return _0x59e10d;});}})[_0x4ab5('0x24')](respondWithFilteredResult(_0x10e45f,_0x9a7d1c))[_0x4ab5('0x33')](handleError(_0x10e45f,null));};exports['addTags']=function(_0x4be395,_0x2568a7,_0x24d14a){return db[_0x4ab5('0x3c')][_0x4ab5('0x63')]({'where':{'id':_0x4be395[_0x4ab5('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2568a7,null))[_0x4ab5('0x24')](function(_0x5becce){if(_0x5becce){return _0x5becce['setTags'](_0x4be395[_0x4ab5('0x75')][_0x4ab5('0xbb')],_[_0x4ab5('0xba')](_0x4be395['body'],[_0x4ab5('0xbb'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4be395[_0x4ab5('0x75')]['ids']}});})[_0x4ab5('0x24')](function(_0x49a664){socket['emit'](_0x4ab5('0xc3'),{'id':Number(_0x4be395[_0x4ab5('0xb5')]['id']),'tags':_0x49a664||[]});return{'id':Number(_0x4be395[_0x4ab5('0xb5')]['id']),'tags':_0x49a664||[]};});}})['then'](respondWithResult(_0x2568a7,null))[_0x4ab5('0x33')](handleError(_0x2568a7,null));};exports['removeTags']=function(_0x429912,_0x580280,_0x45bd0d){return db[_0x4ab5('0x3c')]['find']({'where':{'id':_0x429912['params']['id']}})['then'](handleEntityNotFound(_0x580280,null))[_0x4ab5('0x24')](function(_0x20fccd){if(_0x20fccd){return _0x20fccd[_0x4ab5('0xc4')](_0x429912['query'][_0x4ab5('0xbb')]);}})[_0x4ab5('0x24')](respondWithStatusCode(_0x580280,null))[_0x4ab5('0x33')](handleError(_0x580280,null));};exports[_0x4ab5('0xc5')]=function(_0x55e845,_0x187718){var _0x18c800=moment()[_0x4ab5('0xc6')]()['toString']();var _0x371318=path['join'](config['root'],_0x4ab5('0xc7'),_0x4ab5('0xc8'),_0x4ab5('0xc9'));var _0x1ba443=path[_0x4ab5('0xca')](config[_0x4ab5('0xcb')],_0x4ab5('0xc7'),_0x4ab5('0xc8'),_0x4ab5('0xcc'));var _0x408f31=path['join'](_0x371318,_0x18c800);var _0x9eddfb=util['format'](_0x4ab5('0xcd'),_0x55e845[_0x4ab5('0xb5')]['id'],_0x18c800);var _0x1c01fb=path[_0x4ab5('0xca')](_0x371318,_0x9eddfb);var _0x3bb8c7=[];_0x3bb8c7[_0x4ab5('0x32')]({'model':db[_0x4ab5('0x72')],'as':_0x4ab5('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x3bb8c7[_0x4ab5('0x32')]({'model':db[_0x4ab5('0xce')],'as':_0x4ab5('0xcf'),'attributes':['id',_0x4ab5('0xd0'),_0x4ab5('0xd1')],'raw':!![]});if(_0x55e845[_0x4ab5('0x41')]['attachments']){_0x3bb8c7[_0x4ab5('0x32')]({'model':db[_0x4ab5('0xd2')],'as':_0x4ab5('0xd2'),'raw':!![]});}var _0x1eff7d=[{'model':db[_0x4ab5('0xb8')],'as':_0x4ab5('0xd3'),'attributes':['id',_0x4ab5('0x75'),'createdAt',_0x4ab5('0xd4'),'secret',_0x4ab5('0x80')],'include':_0x3bb8c7}];_0x1eff7d[_0x4ab5('0x32')]({'model':db[_0x4ab5('0xd5')],'as':_0x4ab5('0xd6'),'attributes':['id',_0x4ab5('0x29')]});_0x1eff7d['push']({'model':db[_0x4ab5('0x72')],'as':'Owner','attributes':['id',_0x4ab5('0x2d')]});return db[_0x4ab5('0x3c')][_0x4ab5('0x63')]({'where':{'id':_0x55e845[_0x4ab5('0xb5')]['id']},'include':_0x1eff7d})['then'](handleEntityNotFound(_0x187718,null))[_0x4ab5('0x24')](function(_0x4d57f8){if(_0x4d57f8){var _0x1ab135=_0x4d57f8[_0x4ab5('0xd7')]({'plain':!![]});fs[_0x4ab5('0xd8')](_0x408f31);var _0x3aabed={'channel':_0x4ab5('0xd9'),'account':_0x1ab135[_0x4ab5('0xd6')][_0x4ab5('0x29')],'agent':_0x1ab135['Owner']?_0x1ab135['Owner'][_0x4ab5('0x2d')]:_0x4ab5('0xda'),'createdAt':moment(_0x1ab135[_0x4ab5('0x7a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4ab5('0x9c')](),'closedAt':_0x1ab135[_0x4ab5('0x37')]?moment(_0x1ab135['closedAt'])['format'](_0x4ab5('0xbf'))[_0x4ab5('0x9c')]():'','disposition':_0x1ab135[_0x4ab5('0xdb')],'messages':_(_0x1ab135['Messages'])[_0x4ab5('0x85')]({'secret':![]})['map'](function(_0x1a3fa0){if(_0x1a3fa0[_0x4ab5('0xd2')]){var _0x534dea=path[_0x4ab5('0xca')](_0x1ba443,_0x1a3fa0[_0x4ab5('0xd2')][_0x4ab5('0xdc')]);if(fs['existsSync'](_0x534dea)){fs[_0x4ab5('0xdd')](_0x534dea)[_0x4ab5('0xde')](fs[_0x4ab5('0xdf')](path['join'](_0x408f31,_0x1a3fa0[_0x4ab5('0xd2')][_0x4ab5('0xdc')])));}}return{'date':moment(_0x1a3fa0[_0x4ab5('0x7a')])['format'](_0x4ab5('0xbf'))[_0x4ab5('0x9c')](),'sender':_0x1a3fa0['direction']==='out'?_0x1a3fa0[_0x4ab5('0x72')]?_0x1a3fa0[_0x4ab5('0x72')][_0x4ab5('0x2d')]:_0x4ab5('0xe0'):_0x1a3fa0[_0x4ab5('0xcf')][_0x4ab5('0xd0')]+(_0x1a3fa0[_0x4ab5('0xcf')][_0x4ab5('0xd1')]?'\x20'+_0x1a3fa0['Contact']['lastName']:''),'body':_0x1a3fa0[_0x4ab5('0xd2')]?_0x1a3fa0[_0x4ab5('0xd2')][_0x4ab5('0xdc')]:_0x1a3fa0[_0x4ab5('0x75')],'direction':_0x1a3fa0[_0x4ab5('0xd4')]===_0x4ab5('0xe1')?'A':'C','secret':_0x1a3fa0['secret'],'read':_0x1a3fa0[_0x4ab5('0x80')],'attachment':_0x1a3fa0[_0x4ab5('0xd2')]};})['value']()};return ejs['renderFile'](path[_0x4ab5('0xca')](config['root'],_0x4ab5('0xc7'),_0x4ab5('0xe2'),'downloadInteraction.ejs'),{'interaction':_0x3aabed})[_0x4ab5('0x24')](function(_0x129c89){var _0x1cf7ce=path['join'](_0x408f31,_0x4ab5('0xe3')+_0x1ab135['id']+'-'+_0x18c800+'.pdf');var _0x527ec0={'path':_0x1cf7ce,'channel':_0x4ab5('0xd9'),'interactionId':_0x1ab135['id']};return pdf[_0x4ab5('0xe4')](_0x129c89,_0x527ec0);})['then'](function(){return new BPromise(function(_0x1d1948,_0x46dd07){zipdir(_0x408f31,{'saveTo':_0x1c01fb},function(_0x29bfeb,_0x105aba){if(_0x29bfeb)return _0x46dd07(_0x29bfeb);return _0x1d1948(_0x105aba);});})[_0x4ab5('0x24')](function(){return new BPromise(function(_0x1ce5f6,_0x41180a){rimraf(_0x408f31,function(_0x5b7cb7){if(_0x5b7cb7)_0x41180a(_0x5b7cb7);return _0x1ce5f6();});});})['then'](function(){return _0x187718[_0x4ab5('0xc5')](_0x1c01fb,_0x9eddfb,function(_0x109676){if(_0x109676){console['log'](_0x4ab5('0xe5'),_0x109676);}else{fs[_0x4ab5('0xe6')](_0x1c01fb);}});});});}else{return _0x187718[_0x4ab5('0x26')](0xc8);}})[_0x4ab5('0x33')](handleError(_0x187718,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ece30ee..d5bf094 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 _0x5088=['WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5088,0xa9));var _0x8508=function(_0x10dbab,_0x2e8174){_0x10dbab=_0x10dbab-0x0;var _0x408bfe=_0x5088[_0x10dbab];return _0x408bfe;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x8508('0x0'))['db'][_0x8508('0x1')];var WhatsappMessage=require(_0x8508('0x0'))['db'][_0x8508('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8508('0x3'),'afterUpdate':_0x8508('0x4'),'afterDestroy':_0x8508('0x5')};function emitEvent(_0x347c4c){return function(_0x4c54bb,_0x3e9abf,_0x52d892){_0x4c54bb[_0x8508('0x6')]({'attributes':['id'],'raw':!![]})[_0x8508('0x7')](function(_0x49dcdd){_0x4c54bb[_0x8508('0x8')](_0x8508('0x9'),_0x49dcdd['map'](function(_0x4f4e41){return{'id':_0x4f4e41['id']};}));return WhatsappMessage[_0x8508('0xa')]({'where':{'WhatsappInteractionId':_0x4c54bb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8508('0x7')](function(_0x1a48ae){_0x4c54bb[_0x8508('0x8')](_0x8508('0xb'),_0x1a48ae[_0x8508('0xc')]);WhatsappInteractionEvents[_0x8508('0xd')](_0x347c4c+':'+_0x4c54bb['id'],_0x4c54bb);WhatsappInteractionEvents[_0x8508('0xd')](_0x347c4c,_0x4c54bb);_0x52d892(null);})['catch'](_0x52d892(null));};}for(var e in events){if(events[_0x8508('0xe')](e)){var event=events[e];WhatsappInteraction[_0x8508('0xf')](e,emitEvent(event));}}module[_0x8508('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa249=['emit','catch','hook','events','../../mysqldb','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x594bd7,_0x59189a){var _0x32ae34=function(_0x38c069){while(--_0x38c069){_0x594bd7['push'](_0x594bd7['shift']());}};_0x32ae34(++_0x59189a);}(_0xa249,0x183));var _0x9a24=function(_0x76fe2b,_0x3e2866){_0x76fe2b=_0x76fe2b-0x0;var _0xf5387d=_0xa249[_0x76fe2b];return _0xf5387d;};'use strict';var EventEmitter=require(_0x9a24('0x0'));var WhatsappInteraction=require(_0x9a24('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x9a24('0x1'))['db'][_0x9a24('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a24('0x3'),'afterUpdate':'update','afterDestroy':_0x9a24('0x4')};function emitEvent(_0x48c56d){return function(_0x558c9a,_0x5c2f56,_0x1b0728){_0x558c9a[_0x9a24('0x5')]({'attributes':['id'],'raw':!![]})[_0x9a24('0x6')](function(_0x3e35b5){_0x558c9a[_0x9a24('0x7')](_0x9a24('0x8'),_0x3e35b5[_0x9a24('0x9')](function(_0x625ec3){return{'id':_0x625ec3['id']};}));return WhatsappMessage[_0x9a24('0xa')]({'where':{'WhatsappInteractionId':_0x558c9a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a24('0x6')](function(_0x543676){_0x558c9a['setDataValue'](_0x9a24('0xb'),_0x543676[_0x9a24('0xc')]);WhatsappInteractionEvents[_0x9a24('0xd')](_0x48c56d+':'+_0x558c9a['id'],_0x558c9a);WhatsappInteractionEvents['emit'](_0x48c56d,_0x558c9a);_0x1b0728(null);})[_0x9a24('0xe')](_0x1b0728(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x9a24('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d1bc7e5..8f2aedc 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 _0x5483=['moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','closed','format','lodash','util','../../config/logger','api'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0x5483,0x1d8));var _0x3548=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x5483[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x3548('0x0'));var util=require(_0x3548('0x1'));var logger=require(_0x3548('0x2'))(_0x3548('0x3'));var moment=require(_0x3548('0x4'));var BPromise=require(_0x3548('0x5'));var rp=require(_0x3548('0x6'));var fs=require('fs');var path=require(_0x3548('0x7'));var rimraf=require('rimraf');var config=require(_0x3548('0x8'));var attributes=require(_0x3548('0x9'));module[_0x3548('0xa')]=function(_0x1e63b6,_0x491d6c){return _0x1e63b6[_0x3548('0xb')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4879b3,_0x514590,_0x4bdf42){if(_0x4879b3['changed'](_0x3548('0xc'))){_0x4879b3['closedAt']=moment()[_0x3548('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4bdf42(null,_0x4879b3);}}});}; \ No newline at end of file +var _0xcc4f=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','./whatsappInteraction.attributes','define','WhatsappInteraction'];(function(_0x3a5ed4,_0xc4b0a8){var _0x5d49b2=function(_0x3c1253){while(--_0x3c1253){_0x3a5ed4['push'](_0x3a5ed4['shift']());}};_0x5d49b2(++_0xc4b0a8);}(_0xcc4f,0x82));var _0xfcc4=function(_0x9cb4fb,_0x2d5227){_0x9cb4fb=_0x9cb4fb-0x0;var _0x166e8e=_0xcc4f[_0x9cb4fb];return _0x166e8e;};'use strict';var _=require(_0xfcc4('0x0'));var util=require(_0xfcc4('0x1'));var logger=require(_0xfcc4('0x2'))(_0xfcc4('0x3'));var moment=require(_0xfcc4('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcc4('0x5'));var fs=require('fs');var path=require(_0xfcc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcc4('0x7'));module['exports']=function(_0x45e2a8,_0x51c01d){return _0x45e2a8[_0xfcc4('0x8')](_0xfcc4('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19d5f0,_0x5a4722,_0x13f71c){if(_0x19d5f0[_0xfcc4('0xa')](_0xfcc4('0xb'))){_0x19d5f0['closedAt']=moment()[_0xfcc4('0xc')](_0xfcc4('0xd'));}_0x13f71c(null,_0x19d5f0);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1deaf4c..c212ffb 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 _0xd980=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','update','options','raw','where','debug','stringify','WhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2e0eeb,_0x390445){var _0x51861f=function(_0x2cefef){while(--_0x2cefef){_0x2e0eeb['push'](_0x2e0eeb['shift']());}};_0x51861f(++_0x390445);}(_0xd980,0x13a));var _0x0d98=function(_0x5e01ee,_0x1622e5){_0x5e01ee=_0x5e01ee-0x0;var _0x5ba4c3=_0xd980[_0x5e01ee];return _0x5ba4c3;};'use strict';var _=require(_0x0d98('0x0'));var util=require(_0x0d98('0x1'));var moment=require(_0x0d98('0x2'));var BPromise=require(_0x0d98('0x3'));var rs=require(_0x0d98('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d98('0x5'));var logger=require(_0x0d98('0x6'))(_0x0d98('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d98('0x8'));var client=jayson[_0x0d98('0x9')][_0x0d98('0xa')]({'port':0x232a});config[_0x0d98('0xb')]=_['defaults'](config['redis'],{'host':_0x0d98('0xc'),'port':0x18eb});var socket=require(_0x0d98('0xd'))(new Redis(config[_0x0d98('0xb')]));require(_0x0d98('0xe'))[_0x0d98('0xf')](socket);function respondWithRpcPromise(_0x55d6fe,_0x4c8b50,_0x27f99b){return new BPromise(function(_0x1dd8d2,_0xd184b3){return client[_0x0d98('0x10')](_0x55d6fe,_0x27f99b)[_0x0d98('0x11')](function(_0x44cacb){logger[_0x0d98('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x4c8b50,_0x0d98('0x13'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4c8b50,'request\x20sent',JSON['stringify'](_0x44cacb));if(_0x44cacb[_0x0d98('0x14')]){if(_0x44cacb[_0x0d98('0x14')]['code']===0x1f4){logger['error'](_0x0d98('0x15'),_0x4c8b50,_0x44cacb['error'][_0x0d98('0x16')]);return _0xd184b3(_0x44cacb[_0x0d98('0x14')]['message']);}logger[_0x0d98('0x14')](_0x0d98('0x15'),_0x4c8b50,_0x44cacb['error'][_0x0d98('0x16')]);return _0x1dd8d2(_0x44cacb[_0x0d98('0x14')][_0x0d98('0x16')]);}else{logger['info'](_0x0d98('0x15'),_0x4c8b50,_0x0d98('0x13'));_0x1dd8d2(_0x44cacb[_0x0d98('0x17')]['message']);}})[_0x0d98('0x18')](function(_0x2ff1b3){logger[_0x0d98('0x14')](_0x0d98('0x15'),_0x4c8b50,_0x2ff1b3);_0xd184b3(_0x2ff1b3);});});}exports[_0x0d98('0x19')]=function(_0x2bc9f8){var _0x2bf4d0=this;return new Promise(function(_0x819eee,_0x4a7062){return db['WhatsappInteraction'][_0x0d98('0x1a')](_0x2bc9f8['body'],{'raw':_0x2bc9f8[_0x0d98('0x1b')]?_0x2bc9f8['options'][_0x0d98('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bc9f8[_0x0d98('0x1b')]?_0x2bc9f8[_0x0d98('0x1b')][_0x0d98('0x1d')]||null:null,'attributes':_0x2bc9f8[_0x0d98('0x1b')]?_0x2bc9f8[_0x0d98('0x1b')]['attributes']||null:null,'limit':_0x2bc9f8[_0x0d98('0x1b')]?_0x2bc9f8[_0x0d98('0x1b')]['limit']||null:null})[_0x0d98('0x11')](function(_0x1899a6){logger[_0x0d98('0x12')](_0x0d98('0x19'),_0x2bc9f8);logger[_0x0d98('0x1e')](_0x0d98('0x19'),_0x2bc9f8,JSON[_0x0d98('0x1f')](_0x1899a6));_0x819eee(_0x1899a6);})['catch'](function(_0x269d54){logger[_0x0d98('0x14')]('UpdateWhatsappInteraction',_0x269d54[_0x0d98('0x16')],_0x2bc9f8);_0x4a7062(_0x2bf4d0['error'](0x1f4,_0x269d54[_0x0d98('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4db4ea){return new Promise(function(_0x13c12a,_0x399e69){return db[_0x0d98('0x20')][_0x0d98('0x21')]({'where':_0x4db4ea[_0x0d98('0x1b')]?_0x4db4ea['options'][_0x0d98('0x1d')]||null:null})[_0x0d98('0x11')](function(_0x5506a5){if(_0x5506a5){return _0x5506a5[_0x0d98('0x22')](_0x4db4ea[_0x0d98('0x23')]['ids'],_[_0x0d98('0x24')](_0x4db4ea[_0x0d98('0x23')],[_0x0d98('0x25'),'id'])||{});}})[_0x0d98('0x26')](function(_0x4ce30a){logger['info'](_0x0d98('0x27'),_0x4db4ea);logger['debug'](_0x0d98('0x27'),_0x4db4ea,JSON[_0x0d98('0x1f')](_0x4ce30a));_0x13c12a(_0x4ce30a);})[_0x0d98('0x18')](function(_0x40711d){logger[_0x0d98('0x14')](_0x0d98('0x27'),_0x40711d['message'],_0x4db4ea);_0x399e69(_this[_0x0d98('0x14')](0x1f4,_0x40711d[_0x0d98('0x16')]));});});}; \ No newline at end of file +var _0x4d96=['raw','where','attributes','limit','debug','catch','AddTagsToWhatsappInteraction','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options'];(function(_0x240adf,_0x38b844){var _0x146260=function(_0x53c5f8){while(--_0x53c5f8){_0x240adf['push'](_0x240adf['shift']());}};_0x146260(++_0x38b844);}(_0x4d96,0xd2));var _0x64d9=function(_0x4d773c,_0x5c15b5){_0x4d773c=_0x4d773c-0x0;var _0x2c72b9=_0x4d96[_0x4d773c];return _0x2c72b9;};'use strict';var _=require(_0x64d9('0x0'));var util=require(_0x64d9('0x1'));var moment=require(_0x64d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64d9('0x3'));var fs=require('fs');var Redis=require(_0x64d9('0x4'));var db=require(_0x64d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x64d9('0x6'))(_0x64d9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64d9('0x8')]['http']({'port':0x232a});config[_0x64d9('0x9')]=_[_0x64d9('0xa')](config['redis'],{'host':_0x64d9('0xb'),'port':0x18eb});var socket=require(_0x64d9('0xc'))(new Redis(config[_0x64d9('0x9')]));require(_0x64d9('0xd'))[_0x64d9('0xe')](socket);function respondWithRpcPromise(_0x3840e3,_0x300051,_0x1fe8b6){return new BPromise(function(_0x1407ae,_0x273244){return client[_0x64d9('0xf')](_0x3840e3,_0x1fe8b6)[_0x64d9('0x10')](function(_0x1b715b){logger[_0x64d9('0x11')](_0x64d9('0x12'),_0x300051,_0x64d9('0x13'));logger['debug'](_0x64d9('0x14'),_0x300051,_0x64d9('0x13'),JSON[_0x64d9('0x15')](_0x1b715b));if(_0x1b715b[_0x64d9('0x16')]){if(_0x1b715b[_0x64d9('0x16')][_0x64d9('0x17')]===0x1f4){logger[_0x64d9('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x300051,_0x1b715b['error'][_0x64d9('0x18')]);return _0x273244(_0x1b715b[_0x64d9('0x16')][_0x64d9('0x18')]);}logger[_0x64d9('0x16')](_0x64d9('0x12'),_0x300051,_0x1b715b[_0x64d9('0x16')]['message']);return _0x1407ae(_0x1b715b[_0x64d9('0x16')]['message']);}else{logger['info'](_0x64d9('0x12'),_0x300051,_0x64d9('0x13'));_0x1407ae(_0x1b715b[_0x64d9('0x19')]['message']);}})['catch'](function(_0x4302cd){logger[_0x64d9('0x16')](_0x64d9('0x12'),_0x300051,_0x4302cd);_0x273244(_0x4302cd);});});}exports[_0x64d9('0x1a')]=function(_0x2051a4){var _0x315bb5=this;return new Promise(function(_0x1e5113,_0x1f4603){return db['WhatsappInteraction'][_0x64d9('0x1b')](_0x2051a4[_0x64d9('0x1c')],{'raw':_0x2051a4[_0x64d9('0x1d')]?_0x2051a4[_0x64d9('0x1d')][_0x64d9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2051a4[_0x64d9('0x1d')]?_0x2051a4[_0x64d9('0x1d')][_0x64d9('0x1f')]||null:null,'attributes':_0x2051a4[_0x64d9('0x1d')]?_0x2051a4[_0x64d9('0x1d')][_0x64d9('0x20')]||null:null,'limit':_0x2051a4['options']?_0x2051a4['options'][_0x64d9('0x21')]||null:null})['then'](function(_0x29d7d0){logger['info']('UpdateWhatsappInteraction',_0x2051a4);logger[_0x64d9('0x22')](_0x64d9('0x1a'),_0x2051a4,JSON[_0x64d9('0x15')](_0x29d7d0));_0x1e5113(_0x29d7d0);})[_0x64d9('0x23')](function(_0x3deb8b){logger[_0x64d9('0x16')](_0x64d9('0x1a'),_0x3deb8b[_0x64d9('0x18')],_0x2051a4);_0x1f4603(_0x315bb5[_0x64d9('0x16')](0x1f4,_0x3deb8b[_0x64d9('0x18')]));});});};exports[_0x64d9('0x24')]=function(_0x1bea65){return new Promise(function(_0x1708d8,_0x527727){return db['WhatsappInteraction']['find']({'where':_0x1bea65[_0x64d9('0x1d')]?_0x1bea65[_0x64d9('0x1d')][_0x64d9('0x1f')]||null:null})['then'](function(_0x5e6ce9){if(_0x5e6ce9){return _0x5e6ce9['addTags'](_0x1bea65[_0x64d9('0x1c')][_0x64d9('0x25')],_['omit'](_0x1bea65['body'],[_0x64d9('0x25'),'id'])||{});}})[_0x64d9('0x26')](function(_0x5dbedf){logger[_0x64d9('0x11')](_0x64d9('0x27'),_0x1bea65);logger[_0x64d9('0x22')](_0x64d9('0x27'),_0x1bea65,JSON['stringify'](_0x5dbedf));_0x1708d8(_0x5dbedf);})[_0x64d9('0x23')](function(_0x4129fd){logger[_0x64d9('0x16')]('AddTags',_0x4129fd['message'],_0x1bea65);_0x527727(_this['error'](0x1f4,_0x4129fd[_0x64d9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ae00fee..7bdffa4 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 _0x1c31=['length','whatsappInteraction:','./whatsappInteraction.events','save','update','emit','register'];(function(_0x442659,_0x15c724){var _0x1e5ef8=function(_0x31f93e){while(--_0x31f93e){_0x442659['push'](_0x442659['shift']());}};_0x1e5ef8(++_0x15c724);}(_0x1c31,0xf0));var _0x11c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1c31[_0x17d9e3];return _0x14192d;};'use strict';var WhatsappInteractionEvents=require(_0x11c3('0x0'));var events=[_0x11c3('0x1'),'remove',_0x11c3('0x2')];function createListener(_0x5b9f8d,_0x334b91){return function(_0x1c5c1d){_0x334b91[_0x11c3('0x3')](_0x5b9f8d,_0x1c5c1d);};}function removeListener(_0x2bf2a5,_0x2f8f0c){return function(){WhatsappInteractionEvents['removeListener'](_0x2bf2a5,_0x2f8f0c);};}exports[_0x11c3('0x4')]=function(_0x4d4b57){for(var _0x3d6a60=0x0,_0x121a27=events[_0x11c3('0x5')];_0x3d6a60<_0x121a27;_0x3d6a60++){var _0x355107=events[_0x3d6a60];var _0x492bf8=createListener(_0x11c3('0x6')+_0x355107,_0x4d4b57);WhatsappInteractionEvents['on'](_0x355107,_0x492bf8);}}; \ No newline at end of file +var _0xabc1=['length','./whatsappInteraction.events','save','remove','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabc1,0xc5));var _0x1abc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabc1[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x1abc('0x0'));var events=[_0x1abc('0x1'),_0x1abc('0x2'),'update'];function createListener(_0x1ab6c1,_0x234729){return function(_0x287a55){_0x234729[_0x1abc('0x3')](_0x1ab6c1,_0x287a55);};}function removeListener(_0x2402b4,_0x2878f6){return function(){WhatsappInteractionEvents[_0x1abc('0x4')](_0x2402b4,_0x2878f6);};}exports[_0x1abc('0x5')]=function(_0x19cc4e){for(var _0x2923c1=0x0,_0x571cc6=events[_0x1abc('0x6')];_0x2923c1<_0x571cc6;_0x2923c1++){var _0x121dc0=events[_0x2923c1];var _0x60b226=createListener('whatsappInteraction:'+_0x121dc0,_0x19cc4e);WhatsappInteractionEvents['on'](_0x121dc0,_0x60b226);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8f4088e..14e5461 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 _0x1791=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34faf8,_0x2102f8){var _0x39d88b=function(_0x2ec51d){while(--_0x2ec51d){_0x34faf8['push'](_0x34faf8['shift']());}};_0x39d88b(++_0x2102f8);}(_0x1791,0x111));var _0x1179=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x1791[_0x2c0be1];return _0x3d4bd2;};'use strict';var multer=require(_0x1179('0x0'));var util=require(_0x1179('0x1'));var path=require(_0x1179('0x2'));var timeout=require(_0x1179('0x3'));var express=require(_0x1179('0x4'));var router=express[_0x1179('0x5')]();var fs_extra=require(_0x1179('0x6'));var auth=require(_0x1179('0x7'));var interaction=require(_0x1179('0x8'));var config=require(_0x1179('0x9'));var controller=require(_0x1179('0xa'));router['get']('/',auth[_0x1179('0xb')](),controller[_0x1179('0xc')]);router[_0x1179('0xd')](_0x1179('0xe'),auth[_0x1179('0xb')](),controller[_0x1179('0xf')]);router[_0x1179('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1179('0x10')]);router[_0x1179('0x11')]('/',auth[_0x1179('0xb')](),interaction['tracked']('whatsapp',_0x1179('0x12')),controller[_0x1179('0x13')]);router[_0x1179('0x11')](_0x1179('0x14'),controller[_0x1179('0x15')]);router[_0x1179('0x16')](_0x1179('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x1179('0x16')](_0x1179('0x18'),auth[_0x1179('0xb')](),controller[_0x1179('0x19')]);router[_0x1179('0x16')](_0x1179('0x1a'),auth[_0x1179('0xb')](),controller[_0x1179('0x1b')]);router[_0x1179('0x1c')](_0x1179('0x17'),auth[_0x1179('0xb')](),controller[_0x1179('0x1d')]);module[_0x1179('0x1e')]=router; \ No newline at end of file +var _0x9995=['whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x22eaee,_0x1cdda9){var _0x468366=function(_0x3288a7){while(--_0x3288a7){_0x22eaee['push'](_0x22eaee['shift']());}};_0x468366(++_0x1cdda9);}(_0x9995,0x8e));var _0x5999=function(_0x23d4a5,_0x348e65){_0x23d4a5=_0x23d4a5-0x0;var _0xd90fa3=_0x9995[_0x23d4a5];return _0xd90fa3;};'use strict';var multer=require(_0x5999('0x0'));var util=require(_0x5999('0x1'));var path=require(_0x5999('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5999('0x3')]();var fs_extra=require(_0x5999('0x4'));var auth=require(_0x5999('0x5'));var interaction=require(_0x5999('0x6'));var config=require(_0x5999('0x7'));var controller=require(_0x5999('0x8'));router[_0x5999('0x9')]('/',auth[_0x5999('0xa')](),controller[_0x5999('0xb')]);router[_0x5999('0x9')](_0x5999('0xc'),auth[_0x5999('0xa')](),controller[_0x5999('0xd')]);router[_0x5999('0x9')](_0x5999('0xe'),auth[_0x5999('0xa')](),controller[_0x5999('0xf')]);router[_0x5999('0x10')]('/',auth[_0x5999('0xa')](),interaction[_0x5999('0x11')](_0x5999('0x12'),_0x5999('0x13')),controller[_0x5999('0x14')]);router[_0x5999('0x10')](_0x5999('0x15'),controller[_0x5999('0x16')]);router[_0x5999('0x17')](_0x5999('0xe'),auth[_0x5999('0xa')](),controller[_0x5999('0x18')]);router['put'](_0x5999('0x19'),auth[_0x5999('0xa')](),controller[_0x5999('0x1a')]);router['put'](_0x5999('0x1b'),auth[_0x5999('0xa')](),controller[_0x5999('0x1c')]);router[_0x5999('0x1d')](_0x5999('0xe'),auth[_0x5999('0xa')](),controller[_0x5999('0x1e')]);module[_0x5999('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c6aa6d0..0ca68b5 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 _0xcf70=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x14ae15,_0x41f6d7){var _0x475828=function(_0x34ec76){while(--_0x34ec76){_0x14ae15['push'](_0x14ae15['shift']());}};_0x475828(++_0x41f6d7);}(_0xcf70,0x94));var _0x0cf7=function(_0x480400,_0xe7c026){_0x480400=_0x480400-0x0;var _0x5b986e=_0xcf70[_0x480400];return _0x5b986e;};'use strict';var Sequelize=require(_0x0cf7('0x0'));module[_0x0cf7('0x1')]={'body':{'type':Sequelize[_0x0cf7('0x2')](_0x0cf7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0cf7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0cf7('0x5')]('in',_0x0cf7('0x6')),'defaultValue':_0x0cf7('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0cf7('0x7')](0xbe)},'phone':{'type':Sequelize[_0x0cf7('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0cf7('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0cf7('0x2')]}}; \ No newline at end of file +var _0x2922=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x7848f6,_0x5d1794){var _0x307ad0=function(_0x4bb14c){while(--_0x4bb14c){_0x7848f6['push'](_0x7848f6['shift']());}};_0x307ad0(++_0x5d1794);}(_0x2922,0x6c));var _0x2292=function(_0x1bffc9,_0x562f71){_0x1bffc9=_0x1bffc9-0x0;var _0x11247b=_0x2922[_0x1bffc9];return _0x11247b;};'use strict';var Sequelize=require(_0x2292('0x0'));module[_0x2292('0x1')]={'body':{'type':Sequelize[_0x2292('0x2')](_0x2292('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2292('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2292('0x5')]('in','out'),'defaultValue':_0x2292('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2292('0x7')](0xbe)},'phone':{'type':Sequelize[_0x2292('0x7')]},'readAt':{'type':Sequelize[_0x2292('0x8')]},'secret':{'type':Sequelize[_0x2292('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2292('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 188c842..0f7f692 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 _0x1e54=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','keys','rawAttributes','find','create','body','params','describe','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','whatsapp-interactions','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','internal','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','filters','intersection'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1e54,0x1e5));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x41e5('0x0'));var rimraf=require(_0x41e5('0x1'));var zipdir=require(_0x41e5('0x2'));var jsonpatch=require(_0x41e5('0x3'));var rp=require(_0x41e5('0x4'));var moment=require(_0x41e5('0x5'));var BPromise=require(_0x41e5('0x6'));var Mustache=require(_0x41e5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x41e5('0x8'));var ejs=require(_0x41e5('0x9'));var fs=require('fs');var fs_extra=require(_0x41e5('0xa'));var _=require('lodash');var squel=require(_0x41e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x41e5('0xc'));var deskjs=require(_0x41e5('0xd'));var toCsv=require(_0x41e5('0x8'));var querystring=require(_0x41e5('0xe'));var Papa=require(_0x41e5('0xf'));var Redis=require(_0x41e5('0x10'));var authService=require(_0x41e5('0x11'));var qs=require(_0x41e5('0x12'));var as=require(_0x41e5('0x13'));var hardwareService=require(_0x41e5('0x14'));var logger=require(_0x41e5('0x15'))(_0x41e5('0x16'));var utils=require(_0x41e5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41e5('0x18'))['db'];config[_0x41e5('0x19')]=_[_0x41e5('0x1a')](config[_0x41e5('0x19')],{'host':_0x41e5('0x1b'),'port':0x18eb});var socket=require(_0x41e5('0x1c'))(new Redis(config['redis']));require(_0x41e5('0x1d'))[_0x41e5('0x1e')](socket);var jayson=require(_0x41e5('0x1f'));var client=jayson[_0x41e5('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x41e5('0x20')][_0x41e5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb9ffb4,_0x385709,_0x2ad3fd,_0x2a98e9){return new BPromise(function(_0x45a5d2,_0x58afad){var _0xd7055e=_0x2a98e9||client;return _0xd7055e[_0x41e5('0x22')](_0xb9ffb4,_0x2ad3fd)['then'](function(_0x4b4500){logger[_0x41e5('0x23')](_0x41e5('0x24'),_0x385709,'request\x20sent');logger[_0x41e5('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x385709,_0x41e5('0x26'),JSON[_0x41e5('0x27')](_0x4b4500));if(_0x4b4500[_0x41e5('0x28')]){if(_0x4b4500[_0x41e5('0x28')][_0x41e5('0x29')]===0x1f4){logger[_0x41e5('0x28')](_0x41e5('0x24'),_0x385709,_0x4b4500[_0x41e5('0x28')][_0x41e5('0x2a')]);return _0x58afad(_0x4b4500[_0x41e5('0x28')]['message']);}logger[_0x41e5('0x28')](_0x41e5('0x24'),_0x385709,_0x4b4500[_0x41e5('0x28')][_0x41e5('0x2a')]);return _0x45a5d2(_0x4b4500[_0x41e5('0x28')][_0x41e5('0x2a')]);}else{logger[_0x41e5('0x23')](_0x41e5('0x24'),_0x385709,_0x41e5('0x26'));_0x45a5d2(_0x4b4500[_0x41e5('0x2b')][_0x41e5('0x2a')]);}})[_0x41e5('0x2c')](function(_0x4518e2){logger['error'](_0x41e5('0x24'),_0x385709,_0x4518e2);_0x58afad(_0x4518e2);});});}function respondWithStatusCode(_0x5b9236,_0x3279f5){_0x3279f5=_0x3279f5||0xcc;return function(_0x46ec87){if(_0x46ec87){return _0x5b9236[_0x41e5('0x2d')](_0x3279f5);}return _0x5b9236['status'](_0x3279f5)[_0x41e5('0x2e')]();};}function respondWithResult(_0x3a928e,_0x1bc082){_0x1bc082=_0x1bc082||0xc8;return function(_0x306da5){if(_0x306da5){return _0x3a928e[_0x41e5('0x2f')](_0x1bc082)['json'](_0x306da5);}};}function respondWithFilteredResult(_0x544336,_0x549d7d){return function(_0x592ba8){if(_0x592ba8){var _0xcfab3b=typeof _0x549d7d['offset']===_0x41e5('0x30')&&typeof _0x549d7d['limit']===_0x41e5('0x30');var _0x23ff8d=_0x592ba8[_0x41e5('0x31')];var _0xb42056=_0xcfab3b?0x0:_0x549d7d[_0x41e5('0x32')];var _0x2b3347=_0xcfab3b?_0x592ba8['count']:_0x549d7d[_0x41e5('0x32')]+_0x549d7d[_0x41e5('0x33')];var _0x3e4488;if(_0x2b3347>=_0x23ff8d){_0x2b3347=_0x23ff8d;_0x3e4488=0xc8;}else{_0x3e4488=0xce;}_0x544336[_0x41e5('0x2f')](_0x3e4488);return _0x544336['set'](_0x41e5('0x34'),_0xb42056+'-'+_0x2b3347+'/'+_0x23ff8d)[_0x41e5('0x35')](_0x592ba8);}return null;};}function patchUpdates(_0x4147bf){return function(_0x3b7cb3){try{jsonpatch[_0x41e5('0x36')](_0x3b7cb3,_0x4147bf,!![]);}catch(_0x37cbcd){return BPromise['reject'](_0x37cbcd);}return _0x3b7cb3[_0x41e5('0x37')]();};}function saveUpdates(_0x7b4727,_0x3f320b){return function(_0x56e8a8){if(_0x56e8a8){return _0x56e8a8[_0x41e5('0x38')](_0x7b4727)[_0x41e5('0x39')](function(_0xc90092){return _0xc90092;});}return null;};}function removeEntity(_0x44b30f,_0x26b2b4){return function(_0x3a9766){if(_0x3a9766){return _0x3a9766[_0x41e5('0x3a')]()[_0x41e5('0x39')](function(){_0x44b30f[_0x41e5('0x2f')](0xcc)[_0x41e5('0x2e')]();});}};}function handleEntityNotFound(_0x81e1c8,_0x3d8137){return function(_0x12cd12){if(!_0x12cd12){_0x81e1c8[_0x41e5('0x2d')](0x194);}return _0x12cd12;};}function handleError(_0x3a9ac5,_0x2ff5d3){_0x2ff5d3=_0x2ff5d3||0x1f4;return function(_0x27bfe1){logger[_0x41e5('0x28')](_0x27bfe1['stack']);if(_0x27bfe1[_0x41e5('0x3b')]){delete _0x27bfe1['name'];}_0x3a9ac5[_0x41e5('0x2f')](_0x2ff5d3)[_0x41e5('0x3c')](_0x27bfe1);};}exports[_0x41e5('0x3d')]=function(_0x4115c4,_0xe9817d){var _0x285cf9={},_0x58c3ff={},_0x3145c6={'count':0x0,'rows':[]};var _0x48ac66=_[_0x41e5('0x3e')](db[_0x41e5('0x3f')]['rawAttributes'],function(_0x16b22e){return{'name':_0x16b22e[_0x41e5('0x40')],'type':_0x16b22e[_0x41e5('0x41')][_0x41e5('0x42')]};});_0x58c3ff[_0x41e5('0x43')]=_['map'](_0x48ac66,_0x41e5('0x3b'));_0x58c3ff[_0x41e5('0x44')]=_['keys'](_0x4115c4[_0x41e5('0x44')]);_0x58c3ff[_0x41e5('0x45')]=_[_0x41e5('0x46')](_0x58c3ff[_0x41e5('0x43')],_0x58c3ff[_0x41e5('0x44')]);_0x285cf9['attributes']=_[_0x41e5('0x46')](_0x58c3ff[_0x41e5('0x43')],qs[_0x41e5('0x47')](_0x4115c4[_0x41e5('0x44')]['fields']));_0x285cf9[_0x41e5('0x48')]=_0x285cf9[_0x41e5('0x48')][_0x41e5('0x49')]?_0x285cf9[_0x41e5('0x48')]:_0x58c3ff[_0x41e5('0x43')];if(!_0x4115c4[_0x41e5('0x44')][_0x41e5('0x4a')](_0x41e5('0x4b'))){_0x285cf9['limit']=qs[_0x41e5('0x33')](_0x4115c4[_0x41e5('0x44')][_0x41e5('0x33')]);_0x285cf9[_0x41e5('0x32')]=qs[_0x41e5('0x32')](_0x4115c4['query']['offset']);}_0x285cf9[_0x41e5('0x4c')]=qs[_0x41e5('0x4d')](_0x4115c4[_0x41e5('0x44')][_0x41e5('0x4d')]);_0x285cf9[_0x41e5('0x4e')]=qs['filters'](_['pick'](_0x4115c4['query'],_0x58c3ff[_0x41e5('0x45')]),_0x48ac66);if(_0x4115c4[_0x41e5('0x44')][_0x41e5('0x4f')]){_0x285cf9[_0x41e5('0x4e')]=_[_0x41e5('0x50')](_0x285cf9[_0x41e5('0x4e')],{'$or':_[_0x41e5('0x3e')](_0x48ac66,function(_0x3ad8e6){if(_0x3ad8e6['type']!==_0x41e5('0x51')){var _0x4731c0={};_0x4731c0[_0x3ad8e6[_0x41e5('0x3b')]]={'$like':'%'+_0x4115c4[_0x41e5('0x44')][_0x41e5('0x4f')]+'%'};return _0x4731c0;}})});}_0x285cf9=_[_0x41e5('0x50')]({},_0x285cf9,_0x4115c4[_0x41e5('0x52')]);var _0x407090={'where':_0x285cf9[_0x41e5('0x4e')]};return db[_0x41e5('0x3f')][_0x41e5('0x31')](_0x407090)[_0x41e5('0x39')](function(_0x5695be){_0x3145c6[_0x41e5('0x31')]=_0x5695be;if(_0x4115c4[_0x41e5('0x44')][_0x41e5('0x53')]){_0x285cf9[_0x41e5('0x54')]=[{'all':!![]}];}return db[_0x41e5('0x3f')]['findAll'](_0x285cf9);})[_0x41e5('0x39')](function(_0x2acdb0){_0x3145c6['rows']=_0x2acdb0;return _0x3145c6;})[_0x41e5('0x39')](respondWithFilteredResult(_0xe9817d,_0x285cf9))['catch'](handleError(_0xe9817d,null));};exports[_0x41e5('0x55')]=function(_0x405475,_0x3c1890){var _0x1514d1={'raw':!![],'where':{'id':_0x405475['params']['id']}},_0x21be84={};_0x21be84['model']=_[_0x41e5('0x56')](db[_0x41e5('0x3f')][_0x41e5('0x57')]);_0x21be84[_0x41e5('0x44')]=_['keys'](_0x405475[_0x41e5('0x44')]);_0x21be84[_0x41e5('0x45')]=_[_0x41e5('0x46')](_0x21be84[_0x41e5('0x43')],_0x21be84['query']);_0x1514d1[_0x41e5('0x48')]=_['intersection'](_0x21be84[_0x41e5('0x43')],qs['fields'](_0x405475[_0x41e5('0x44')][_0x41e5('0x47')]));_0x1514d1[_0x41e5('0x48')]=_0x1514d1['attributes'][_0x41e5('0x49')]?_0x1514d1['attributes']:_0x21be84[_0x41e5('0x43')];if(_0x405475[_0x41e5('0x44')]['includeAll']){_0x1514d1[_0x41e5('0x54')]=[{'all':!![]}];}_0x1514d1=_[_0x41e5('0x50')]({},_0x1514d1,_0x405475[_0x41e5('0x52')]);return db['WhatsappMessage'][_0x41e5('0x58')](_0x1514d1)[_0x41e5('0x39')](handleEntityNotFound(_0x3c1890,null))[_0x41e5('0x39')](respondWithResult(_0x3c1890,null))[_0x41e5('0x2c')](handleError(_0x3c1890,null));};exports[_0x41e5('0x59')]=function(_0x358252,_0x470a64){return db[_0x41e5('0x3f')][_0x41e5('0x59')](_0x358252[_0x41e5('0x5a')],{})[_0x41e5('0x39')](respondWithResult(_0x470a64,0xc9))[_0x41e5('0x2c')](handleError(_0x470a64,null));};exports[_0x41e5('0x38')]=function(_0x21408f,_0x281358){if(_0x21408f[_0x41e5('0x5a')]['id']){delete _0x21408f[_0x41e5('0x5a')]['id'];}return db[_0x41e5('0x3f')]['find']({'where':{'id':_0x21408f[_0x41e5('0x5b')]['id']}})[_0x41e5('0x39')](handleEntityNotFound(_0x281358,null))[_0x41e5('0x39')](saveUpdates(_0x21408f[_0x41e5('0x5a')],null))[_0x41e5('0x39')](respondWithResult(_0x281358,null))[_0x41e5('0x2c')](handleError(_0x281358,null));};exports[_0x41e5('0x3a')]=function(_0x50afc1,_0x39151f){return db[_0x41e5('0x3f')][_0x41e5('0x58')]({'where':{'id':_0x50afc1[_0x41e5('0x5b')]['id']}})[_0x41e5('0x39')](handleEntityNotFound(_0x39151f,null))[_0x41e5('0x39')](removeEntity(_0x39151f,null))[_0x41e5('0x2c')](handleError(_0x39151f,null));};exports[_0x41e5('0x5c')]=function(_0x22e202,_0x52e815){return db[_0x41e5('0x3f')][_0x41e5('0x5c')]()[_0x41e5('0x39')](respondWithResult(_0x52e815,null))[_0x41e5('0x2c')](handleError(_0x52e815,null));};var interaction_log=require(_0x41e5('0x15'))('whatsapp-interactions');exports['accept']=function(_0x247441,_0x3a072b,_0xeb28b6){var _0x305069={'agent':{},'channel':'whatsapp'};if(_0x247441[_0x41e5('0x5a')]['id']){delete _0x247441[_0x41e5('0x5a')]['id'];}_0x247441[_0x41e5('0x5a')][_0x41e5('0x5d')]=!![];_0x247441[_0x41e5('0x5a')]['readAt']=moment()[_0x41e5('0x5e')](_0x41e5('0x5f'));_0x247441['body']['UserId']=_0x247441[_0x41e5('0x5a')][_0x41e5('0x60')]||_0x247441[_0x41e5('0x61')]['id'];_0x305069[_0x41e5('0x62')]['id']=_0x247441[_0x41e5('0x5a')][_0x41e5('0x60')];return db[_0x41e5('0x3f')][_0x41e5('0x58')]({'where':{'id':_0x247441[_0x41e5('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a072b,null))[_0x41e5('0x39')](saveUpdates(_0x247441['body'],null))[_0x41e5('0x39')](function(_0x44bca3){if(_0x44bca3){_0x305069[_0x41e5('0x2a')]=_0x44bca3[_0x41e5('0x63')]({'plain':!![]});return db[_0x41e5('0x64')][_0x41e5('0x58')]({'where':{'id':_0x44bca3['WhatsappInteractionId']}});}return null;})[_0x41e5('0x39')](handleEntityNotFound(_0x3a072b,null))['then'](function(_0x24c38f){if(_0x24c38f){return _0x24c38f[_0x41e5('0x38')]({'UserId':_0x247441[_0x41e5('0x5a')][_0x41e5('0x60')],'read1stAt':_[_0x41e5('0x65')](_0x24c38f[_0x41e5('0x66')])?moment()[_0x41e5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x41e5('0x39')](function(_0x4bdca7){if(_0x4bdca7){_0x305069[_0x41e5('0x67')]=_0x4bdca7['get']({'plain':!![]});interaction_log[_0x41e5('0x23')](_0x41e5('0x68'),_0x247441[_0x41e5('0x61')]['id'],_0x247441['user']['name'],_0x247441[_0x41e5('0x61')]['role'],_0x305069['interaction']['id'],_0x247441[_0x41e5('0x5a')]?JSON[_0x41e5('0x27')](_0x247441[_0x41e5('0x5a')]):'null');return respondWithRpcPromise(_0x41e5('0x69'),'acceptMessage',_0x305069);}return null;})[_0x41e5('0x39')](function(_0x4e031a){var _0x110132=_0x41e5('0x6a')+_0x4e031a['message']['ContactId'];return db[_0x41e5('0x6b')][_0x41e5('0x44')](_0x110132,{'type':db[_0x41e5('0x6c')][_0x41e5('0x6d')][_0x41e5('0x6e')],'raw':!![]})[_0x41e5('0x39')](function(_0x56d884){return _0x56d884;});})[_0x41e5('0x39')](function(_0x4d2550){if(_0x4d2550){_0x305069['message'][_0x41e5('0x6f')]=_0x4d2550[0x0];if(!_0x247441[_0x41e5('0x5a')][_0x41e5('0x60')])return;return db[_0x41e5('0x70')]['find']({'where':{'id':_0x247441['body'][_0x41e5('0x60')],'role':_0x41e5('0x62')},'attributes':['id',_0x41e5('0x3b'),_0x41e5('0x71'),_0x41e5('0x72'),'internal'],'raw':!![]});}return null;})[_0x41e5('0x39')](function(_0x4e73d5){if(!_0x4e73d5)return null;_0x305069[_0x41e5('0x2a')][_0x41e5('0x62')]=_0x4e73d5;return _0x305069;})['then'](function(_0x3553bd){if(_0x3553bd){if(_0x247441[_0x41e5('0x5a')][_0x41e5('0x73')]){_0x305069[_0x41e5('0x2a')][_0x41e5('0x74')]=util['format'](_0x41e5('0x75'),_0x247441[_0x41e5('0x61')][_0x41e5('0x3b')]);_0x305069[_0x41e5('0x2a')]['channel']=_0x305069[_0x41e5('0x76')];_0x305069[_0x41e5('0x2a')][_0x41e5('0x77')]=_0x305069[_0x41e5('0x76')];_0x305069['message'][_0x41e5('0x78')]=_0x41e5('0x79');return respondWithRpcPromise(_0x41e5('0x7a'),'EventManager',{'event':_0x41e5('0x7b'),'message':_0x305069[_0x41e5('0x2a')]},client9002)[_0x41e5('0x39')](function(){return _0x305069;});}return _0x305069;}return null;})[_0x41e5('0x39')](respondWithResult(_0x3a072b,null))[_0x41e5('0x2c')](handleError(_0x3a072b,null));};var interaction_log=require('../../config/logger')(_0x41e5('0x7c'));exports[_0x41e5('0x7d')]=function(_0x550d0d,_0x11ffdc,_0x25a595){var _0x11a1e5={'agent':{},'channel':'whatsapp'};if(_0x550d0d[_0x41e5('0x5a')]['id']){delete _0x550d0d[_0x41e5('0x5a')]['id'];}_0x550d0d[_0x41e5('0x5a')][_0x41e5('0x60')]=_0x550d0d[_0x41e5('0x5a')][_0x41e5('0x60')]||_0x550d0d['user']['id'];_0x11a1e5[_0x41e5('0x62')]['id']=_0x550d0d[_0x41e5('0x5a')][_0x41e5('0x60')];return db['WhatsappMessage'][_0x41e5('0x58')]({'where':{'id':_0x550d0d[_0x41e5('0x5b')]['id'],'UserId':null}})[_0x41e5('0x39')](handleEntityNotFound(_0x11ffdc,null))[_0x41e5('0x39')](function(_0x12c0d6){if(_0x12c0d6){_0x11a1e5[_0x41e5('0x2a')]=_0x12c0d6[_0x41e5('0x63')]({'plain':!![]});return db[_0x41e5('0x64')][_0x41e5('0x58')]({'where':{'id':_0x12c0d6[_0x41e5('0x7e')]}});}return null;})[_0x41e5('0x39')](handleEntityNotFound(_0x11ffdc,null))[_0x41e5('0x39')](function(_0x1c3b78){if(_0x1c3b78){_0x11a1e5[_0x41e5('0x67')]=_0x1c3b78[_0x41e5('0x63')]({'plain':!![]});interaction_log['info'](_0x41e5('0x7f'),_0x550d0d['user']['id'],_0x550d0d[_0x41e5('0x61')][_0x41e5('0x3b')],_0x550d0d[_0x41e5('0x61')]['role'],_0x11a1e5[_0x41e5('0x67')]['id'],_0x550d0d['body']?JSON[_0x41e5('0x27')](_0x550d0d[_0x41e5('0x5a')]):_0x41e5('0x80'));return respondWithRpcPromise(_0x41e5('0x81'),_0x41e5('0x82'),_0x11a1e5);}return null;})[_0x41e5('0x39')](function(_0x25a877){var _0x3068ea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25a877[_0x41e5('0x2a')]['ContactId'];return db[_0x41e5('0x6b')][_0x41e5('0x44')](_0x3068ea,{'type':db[_0x41e5('0x6c')]['QueryTypes'][_0x41e5('0x6e')],'raw':!![]})[_0x41e5('0x39')](function(_0xc1a95c){return _0xc1a95c;});})['then'](function(_0x1188a1){if(_0x1188a1){_0x11a1e5[_0x41e5('0x2a')][_0x41e5('0x6f')]=_0x1188a1[0x0];if(!_0x550d0d[_0x41e5('0x5a')]['UserId'])return;return db[_0x41e5('0x70')]['find']({'where':{'id':_0x550d0d['body'][_0x41e5('0x60')],'role':'agent'},'attributes':['id',_0x41e5('0x3b'),'fullname',_0x41e5('0x72'),_0x41e5('0x83')],'raw':!![]});}return null;})[_0x41e5('0x39')](function(_0x141e3e){if(!_0x141e3e)return null;_0x11a1e5[_0x41e5('0x2a')][_0x41e5('0x62')]=_0x141e3e;return _0x11a1e5;})['then'](function(_0x24522a){if(_0x24522a){_0x24522a[_0x41e5('0x2a')][_0x41e5('0x74')]=util[_0x41e5('0x5e')]('SIP/%s',_0x550d0d[_0x41e5('0x61')]['name']);_0x24522a[_0x41e5('0x2a')][_0x41e5('0x76')]=_0x11a1e5[_0x41e5('0x76')];_0x24522a[_0x41e5('0x2a')][_0x41e5('0x77')]=_0x11a1e5[_0x41e5('0x76')];_0x24522a[_0x41e5('0x2a')][_0x41e5('0x78')]=_0x41e5('0x7d');respondWithRpcPromise('EventManager','EventManager',{'event':_0x41e5('0x84'),'message':_0x24522a[_0x41e5('0x2a')]},client9002);return _0x11a1e5;}return null;})[_0x41e5('0x39')](respondWithResult(_0x11ffdc,null))[_0x41e5('0x2c')](handleError(_0x11ffdc,null));};exports['status']=function(_0x504c97,_0x3d763b,_0x335a99){if(_0x504c97['body']['id']){delete _0x504c97['body']['id'];}var _0x56500d;return db[_0x41e5('0x3f')]['find']({'where':{'id':_0x504c97[_0x41e5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d763b,null))['then'](function(_0x23631e){if(_0x23631e){_0x56500d=_0x23631e;return db['WhatsappAccount'][_0x41e5('0x58')]({'where':{'id':_0x23631e[_0x41e5('0x85')]}});}})[_0x41e5('0x39')](handleEntityNotFound(_0x3d763b,null))[_0x41e5('0x39')](function(_0x460e2a){if(_0x460e2a){logger[_0x41e5('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x41e5('0x86'),_0x460e2a['type'],util[_0x41e5('0x87')](_0x504c97[_0x41e5('0x5a')],{'showHidden':![],'depth':null}));switch(_0x460e2a[_0x41e5('0x41')]){case _0x41e5('0x88'):if(_0x504c97[_0x41e5('0x5a')][_0x41e5('0x89')]&&_0x504c97[_0x41e5('0x5a')][_0x41e5('0x89')]===_0x56500d['messageId']&&_0x504c97[_0x41e5('0x5a')]['MessageStatus']&&_0x504c97[_0x41e5('0x5a')]['MessageStatus']==='read'){return _0x56500d[_0x41e5('0x38')]({'read':!![]});}else{logger[_0x41e5('0x28')](_0x41e5('0x8a'),_0x41e5('0x2f'),_0x41e5('0x88'),util[_0x41e5('0x87')](_0x504c97['body'],{'showHidden':![],'depth':null}));}break;}return _0x56500d;}})[_0x41e5('0x39')](respondWithResult(_0x3d763b,null))[_0x41e5('0x2c')](handleError(_0x3d763b,null));}; \ No newline at end of file +var _0xa220=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','read','format','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','EventManager','acceptmessage','reject','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','interface','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4bfd35,_0x238f6e){var _0x1a3753=function(_0xeed81b){while(--_0xeed81b){_0x4bfd35['push'](_0x4bfd35['shift']());}};_0x1a3753(++_0x238f6e);}(_0xa220,0x8c));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x0a22('0x0'));var rimraf=require(_0x0a22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a22('0x2'));var rp=require(_0x0a22('0x3'));var moment=require(_0x0a22('0x4'));var BPromise=require(_0x0a22('0x5'));var Mustache=require(_0x0a22('0x6'));var util=require(_0x0a22('0x7'));var path=require(_0x0a22('0x8'));var sox=require(_0x0a22('0x9'));var csv=require(_0x0a22('0xa'));var ejs=require(_0x0a22('0xb'));var fs=require('fs');var fs_extra=require(_0x0a22('0xc'));var _=require(_0x0a22('0xd'));var squel=require(_0x0a22('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a22('0xf'));var toCsv=require(_0x0a22('0xa'));var querystring=require(_0x0a22('0x10'));var Papa=require(_0x0a22('0x11'));var Redis=require(_0x0a22('0x12'));var authService=require(_0x0a22('0x13'));var qs=require(_0x0a22('0x14'));var as=require(_0x0a22('0x15'));var hardwareService=require(_0x0a22('0x16'));var logger=require(_0x0a22('0x17'))(_0x0a22('0x18'));var utils=require(_0x0a22('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0a22('0x1a'));var db=require(_0x0a22('0x1b'))['db'];config[_0x0a22('0x1c')]=_[_0x0a22('0x1d')](config['redis'],{'host':_0x0a22('0x1e'),'port':0x18eb});var socket=require(_0x0a22('0x1f'))(new Redis(config[_0x0a22('0x1c')]));require(_0x0a22('0x20'))[_0x0a22('0x21')](socket);var jayson=require(_0x0a22('0x22'));var client=jayson[_0x0a22('0x23')][_0x0a22('0x24')]({'port':0x232c});var client9002=jayson[_0x0a22('0x23')][_0x0a22('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x2d5696,_0x2caffc,_0x508bbe,_0x2297ea){return new BPromise(function(_0x5b4c02,_0x5186d8){var _0x4a1342=_0x2297ea||client;return _0x4a1342[_0x0a22('0x25')](_0x2d5696,_0x508bbe)[_0x0a22('0x26')](function(_0x4ba748){logger['info'](_0x0a22('0x27'),_0x2caffc,_0x0a22('0x28'));logger[_0x0a22('0x29')](_0x0a22('0x2a'),_0x2caffc,_0x0a22('0x28'),JSON[_0x0a22('0x2b')](_0x4ba748));if(_0x4ba748[_0x0a22('0x2c')]){if(_0x4ba748[_0x0a22('0x2c')][_0x0a22('0x2d')]===0x1f4){logger['error'](_0x0a22('0x27'),_0x2caffc,_0x4ba748[_0x0a22('0x2c')][_0x0a22('0x2e')]);return _0x5186d8(_0x4ba748['error']['message']);}logger['error'](_0x0a22('0x27'),_0x2caffc,_0x4ba748[_0x0a22('0x2c')][_0x0a22('0x2e')]);return _0x5b4c02(_0x4ba748[_0x0a22('0x2c')][_0x0a22('0x2e')]);}else{logger[_0x0a22('0x2f')](_0x0a22('0x27'),_0x2caffc,_0x0a22('0x28'));_0x5b4c02(_0x4ba748['result'][_0x0a22('0x2e')]);}})['catch'](function(_0x257698){logger[_0x0a22('0x2c')](_0x0a22('0x27'),_0x2caffc,_0x257698);_0x5186d8(_0x257698);});});}function respondWithStatusCode(_0x26af00,_0x261efa){_0x261efa=_0x261efa||0xcc;return function(_0x37217b){if(_0x37217b){return _0x26af00[_0x0a22('0x30')](_0x261efa);}return _0x26af00[_0x0a22('0x31')](_0x261efa)[_0x0a22('0x32')]();};}function respondWithResult(_0x4b19d4,_0x3f1924){_0x3f1924=_0x3f1924||0xc8;return function(_0x506e09){if(_0x506e09){return _0x4b19d4[_0x0a22('0x31')](_0x3f1924)[_0x0a22('0x33')](_0x506e09);}};}function respondWithFilteredResult(_0x3aced8,_0x4b72f8){return function(_0x4af55e){if(_0x4af55e){var _0x16b84c=typeof _0x4b72f8[_0x0a22('0x34')]==='undefined'&&typeof _0x4b72f8[_0x0a22('0x35')]===_0x0a22('0x36');var _0x10e9cd=_0x4af55e[_0x0a22('0x37')];var _0x17bcbc=_0x16b84c?0x0:_0x4b72f8['offset'];var _0x25206b=_0x16b84c?_0x4af55e['count']:_0x4b72f8[_0x0a22('0x34')]+_0x4b72f8[_0x0a22('0x35')];var _0x405877;if(_0x25206b>=_0x10e9cd){_0x25206b=_0x10e9cd;_0x405877=0xc8;}else{_0x405877=0xce;}_0x3aced8[_0x0a22('0x31')](_0x405877);return _0x3aced8[_0x0a22('0x38')](_0x0a22('0x39'),_0x17bcbc+'-'+_0x25206b+'/'+_0x10e9cd)['json'](_0x4af55e);}return null;};}function patchUpdates(_0x5ec425){return function(_0xaeb42){try{jsonpatch[_0x0a22('0x3a')](_0xaeb42,_0x5ec425,!![]);}catch(_0x3635ff){return BPromise['reject'](_0x3635ff);}return _0xaeb42[_0x0a22('0x3b')]();};}function saveUpdates(_0x314983,_0x1ded4b){return function(_0x4a3038){if(_0x4a3038){return _0x4a3038[_0x0a22('0x3c')](_0x314983)[_0x0a22('0x26')](function(_0x5aa706){return _0x5aa706;});}return null;};}function removeEntity(_0x303bc6,_0x245884){return function(_0x12575f){if(_0x12575f){return _0x12575f[_0x0a22('0x3d')]()[_0x0a22('0x26')](function(){_0x303bc6[_0x0a22('0x31')](0xcc)[_0x0a22('0x32')]();});}};}function handleEntityNotFound(_0x394e63,_0x5f0c94){return function(_0x1be9b8){if(!_0x1be9b8){_0x394e63[_0x0a22('0x30')](0x194);}return _0x1be9b8;};}function handleError(_0x416276,_0x57f004){_0x57f004=_0x57f004||0x1f4;return function(_0x21c510){logger[_0x0a22('0x2c')](_0x21c510[_0x0a22('0x3e')]);if(_0x21c510[_0x0a22('0x3f')]){delete _0x21c510[_0x0a22('0x3f')];}_0x416276[_0x0a22('0x31')](_0x57f004)[_0x0a22('0x40')](_0x21c510);};}exports[_0x0a22('0x41')]=function(_0x5345b6,_0x3be95f){var _0x156dd3={},_0x4b4ac5={},_0x1416cc={'count':0x0,'rows':[]};var _0x37de34=_[_0x0a22('0x42')](db[_0x0a22('0x43')][_0x0a22('0x44')],function(_0x196799){return{'name':_0x196799[_0x0a22('0x45')],'type':_0x196799[_0x0a22('0x46')][_0x0a22('0x47')]};});_0x4b4ac5[_0x0a22('0x48')]=_[_0x0a22('0x42')](_0x37de34,_0x0a22('0x3f'));_0x4b4ac5['query']=_[_0x0a22('0x49')](_0x5345b6['query']);_0x4b4ac5[_0x0a22('0x4a')]=_['intersection'](_0x4b4ac5[_0x0a22('0x48')],_0x4b4ac5[_0x0a22('0x4b')]);_0x156dd3[_0x0a22('0x4c')]=_[_0x0a22('0x4d')](_0x4b4ac5[_0x0a22('0x48')],qs['fields'](_0x5345b6[_0x0a22('0x4b')][_0x0a22('0x4e')]));_0x156dd3[_0x0a22('0x4c')]=_0x156dd3['attributes'][_0x0a22('0x4f')]?_0x156dd3[_0x0a22('0x4c')]:_0x4b4ac5[_0x0a22('0x48')];if(!_0x5345b6[_0x0a22('0x4b')]['hasOwnProperty'](_0x0a22('0x50'))){_0x156dd3['limit']=qs[_0x0a22('0x35')](_0x5345b6[_0x0a22('0x4b')][_0x0a22('0x35')]);_0x156dd3['offset']=qs[_0x0a22('0x34')](_0x5345b6[_0x0a22('0x4b')][_0x0a22('0x34')]);}_0x156dd3[_0x0a22('0x51')]=qs[_0x0a22('0x52')](_0x5345b6[_0x0a22('0x4b')][_0x0a22('0x52')]);_0x156dd3[_0x0a22('0x53')]=qs['filters'](_[_0x0a22('0x54')](_0x5345b6[_0x0a22('0x4b')],_0x4b4ac5[_0x0a22('0x4a')]),_0x37de34);if(_0x5345b6[_0x0a22('0x4b')]['filter']){_0x156dd3[_0x0a22('0x53')]=_['merge'](_0x156dd3[_0x0a22('0x53')],{'$or':_[_0x0a22('0x42')](_0x37de34,function(_0x34aa68){if(_0x34aa68[_0x0a22('0x46')]!==_0x0a22('0x55')){var _0x30dd6d={};_0x30dd6d[_0x34aa68[_0x0a22('0x3f')]]={'$like':'%'+_0x5345b6[_0x0a22('0x4b')]['filter']+'%'};return _0x30dd6d;}})});}_0x156dd3=_[_0x0a22('0x56')]({},_0x156dd3,_0x5345b6[_0x0a22('0x57')]);var _0x534817={'where':_0x156dd3['where']};return db[_0x0a22('0x43')][_0x0a22('0x37')](_0x534817)[_0x0a22('0x26')](function(_0x3630e6){_0x1416cc[_0x0a22('0x37')]=_0x3630e6;if(_0x5345b6['query'][_0x0a22('0x58')]){_0x156dd3[_0x0a22('0x59')]=[{'all':!![]}];}return db[_0x0a22('0x43')]['findAll'](_0x156dd3);})[_0x0a22('0x26')](function(_0x286bcd){_0x1416cc[_0x0a22('0x5a')]=_0x286bcd;return _0x1416cc;})[_0x0a22('0x26')](respondWithFilteredResult(_0x3be95f,_0x156dd3))[_0x0a22('0x5b')](handleError(_0x3be95f,null));};exports[_0x0a22('0x5c')]=function(_0x3e87ec,_0x38567d){var _0x4a8fcf={'raw':!![],'where':{'id':_0x3e87ec[_0x0a22('0x5d')]['id']}},_0x3144cc={};_0x3144cc[_0x0a22('0x48')]=_[_0x0a22('0x49')](db['WhatsappMessage'][_0x0a22('0x44')]);_0x3144cc[_0x0a22('0x4b')]=_['keys'](_0x3e87ec[_0x0a22('0x4b')]);_0x3144cc[_0x0a22('0x4a')]=_['intersection'](_0x3144cc[_0x0a22('0x48')],_0x3144cc[_0x0a22('0x4b')]);_0x4a8fcf[_0x0a22('0x4c')]=_[_0x0a22('0x4d')](_0x3144cc[_0x0a22('0x48')],qs['fields'](_0x3e87ec[_0x0a22('0x4b')][_0x0a22('0x4e')]));_0x4a8fcf[_0x0a22('0x4c')]=_0x4a8fcf[_0x0a22('0x4c')][_0x0a22('0x4f')]?_0x4a8fcf[_0x0a22('0x4c')]:_0x3144cc[_0x0a22('0x48')];if(_0x3e87ec['query']['includeAll']){_0x4a8fcf[_0x0a22('0x59')]=[{'all':!![]}];}_0x4a8fcf=_[_0x0a22('0x56')]({},_0x4a8fcf,_0x3e87ec[_0x0a22('0x57')]);return db[_0x0a22('0x43')][_0x0a22('0x5e')](_0x4a8fcf)[_0x0a22('0x26')](handleEntityNotFound(_0x38567d,null))[_0x0a22('0x26')](respondWithResult(_0x38567d,null))[_0x0a22('0x5b')](handleError(_0x38567d,null));};exports['create']=function(_0x449703,_0x48ad3d){return db[_0x0a22('0x43')][_0x0a22('0x5f')](_0x449703['body'],{})[_0x0a22('0x26')](respondWithResult(_0x48ad3d,0xc9))['catch'](handleError(_0x48ad3d,null));};exports[_0x0a22('0x3c')]=function(_0x498918,_0x46fd94){if(_0x498918[_0x0a22('0x60')]['id']){delete _0x498918[_0x0a22('0x60')]['id'];}return db[_0x0a22('0x43')][_0x0a22('0x5e')]({'where':{'id':_0x498918[_0x0a22('0x5d')]['id']}})[_0x0a22('0x26')](handleEntityNotFound(_0x46fd94,null))[_0x0a22('0x26')](saveUpdates(_0x498918['body'],null))[_0x0a22('0x26')](respondWithResult(_0x46fd94,null))[_0x0a22('0x5b')](handleError(_0x46fd94,null));};exports['destroy']=function(_0x56825e,_0x2260ce){return db[_0x0a22('0x43')][_0x0a22('0x5e')]({'where':{'id':_0x56825e['params']['id']}})[_0x0a22('0x26')](handleEntityNotFound(_0x2260ce,null))[_0x0a22('0x26')](removeEntity(_0x2260ce,null))[_0x0a22('0x5b')](handleError(_0x2260ce,null));};exports[_0x0a22('0x61')]=function(_0x3d1d83,_0x443df0){return db['WhatsappMessage']['describe']()[_0x0a22('0x26')](respondWithResult(_0x443df0,null))[_0x0a22('0x5b')](handleError(_0x443df0,null));};var interaction_log=require(_0x0a22('0x17'))(_0x0a22('0x62'));exports[_0x0a22('0x63')]=function(_0x12142c,_0x136226,_0x4e6e81){var _0x15f1b8={'agent':{},'channel':'whatsapp'};if(_0x12142c[_0x0a22('0x60')]['id']){delete _0x12142c[_0x0a22('0x60')]['id'];}_0x12142c[_0x0a22('0x60')][_0x0a22('0x64')]=!![];_0x12142c['body']['readAt']=moment()[_0x0a22('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x12142c[_0x0a22('0x60')][_0x0a22('0x66')]=_0x12142c[_0x0a22('0x60')]['UserId']||_0x12142c[_0x0a22('0x67')]['id'];_0x15f1b8[_0x0a22('0x68')]['id']=_0x12142c[_0x0a22('0x60')][_0x0a22('0x66')];return db['WhatsappMessage'][_0x0a22('0x5e')]({'where':{'id':_0x12142c[_0x0a22('0x5d')]['id'],'UserId':null}})[_0x0a22('0x26')](handleEntityNotFound(_0x136226,null))['then'](saveUpdates(_0x12142c[_0x0a22('0x60')],null))['then'](function(_0x534846){if(_0x534846){_0x15f1b8[_0x0a22('0x2e')]=_0x534846['get']({'plain':!![]});return db['WhatsappInteraction'][_0x0a22('0x5e')]({'where':{'id':_0x534846[_0x0a22('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x136226,null))['then'](function(_0x1ba4c0){if(_0x1ba4c0){return _0x1ba4c0[_0x0a22('0x3c')]({'UserId':_0x12142c[_0x0a22('0x60')][_0x0a22('0x66')],'read1stAt':_[_0x0a22('0x6a')](_0x1ba4c0[_0x0a22('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a22('0x26')](function(_0x1257b4){if(_0x1257b4){_0x15f1b8[_0x0a22('0x6c')]=_0x1257b4[_0x0a22('0x6d')]({'plain':!![]});interaction_log[_0x0a22('0x2f')](_0x0a22('0x6e'),_0x12142c['user']['id'],_0x12142c[_0x0a22('0x67')]['name'],_0x12142c[_0x0a22('0x67')][_0x0a22('0x6f')],_0x15f1b8[_0x0a22('0x6c')]['id'],_0x12142c[_0x0a22('0x60')]?JSON[_0x0a22('0x2b')](_0x12142c[_0x0a22('0x60')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0a22('0x70'),_0x15f1b8);}return null;})['then'](function(_0x56bf35){var _0x2278ef='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56bf35[_0x0a22('0x2e')]['ContactId'];return db[_0x0a22('0x71')][_0x0a22('0x4b')](_0x2278ef,{'type':db[_0x0a22('0x72')][_0x0a22('0x73')][_0x0a22('0x74')],'raw':!![]})[_0x0a22('0x26')](function(_0x1dbb60){return _0x1dbb60;});})[_0x0a22('0x26')](function(_0xa554bf){if(_0xa554bf){_0x15f1b8[_0x0a22('0x2e')]['contact']=_0xa554bf[0x0];if(!_0x12142c[_0x0a22('0x60')]['UserId'])return;return db[_0x0a22('0x75')][_0x0a22('0x5e')]({'where':{'id':_0x12142c[_0x0a22('0x60')][_0x0a22('0x66')],'role':_0x0a22('0x68')},'attributes':['id',_0x0a22('0x3f'),_0x0a22('0x76'),_0x0a22('0x77'),_0x0a22('0x78')],'raw':!![]});}return null;})['then'](function(_0x2a9dc6){if(!_0x2a9dc6)return null;_0x15f1b8[_0x0a22('0x2e')]['agent']=_0x2a9dc6;return _0x15f1b8;})[_0x0a22('0x26')](function(_0xc2764d){if(_0xc2764d){if(_0x12142c['body'][_0x0a22('0x79')]){_0x15f1b8[_0x0a22('0x2e')]['interface']=util['format']('SIP/%s',_0x12142c[_0x0a22('0x67')][_0x0a22('0x3f')]);_0x15f1b8[_0x0a22('0x2e')]['channel']=_0x15f1b8['channel'];_0x15f1b8['message']['motionChannel']=_0x15f1b8[_0x0a22('0x7a')];_0x15f1b8[_0x0a22('0x2e')]['event']=_0x0a22('0x63');return respondWithRpcPromise(_0x0a22('0x7b'),_0x0a22('0x7b'),{'event':_0x0a22('0x7c'),'message':_0x15f1b8[_0x0a22('0x2e')]},client9002)[_0x0a22('0x26')](function(){return _0x15f1b8;});}return _0x15f1b8;}return null;})[_0x0a22('0x26')](respondWithResult(_0x136226,null))[_0x0a22('0x5b')](handleError(_0x136226,null));};var interaction_log=require(_0x0a22('0x17'))(_0x0a22('0x62'));exports[_0x0a22('0x7d')]=function(_0x10ec2a,_0x1766a8,_0x495829){var _0x391e1e={'agent':{},'channel':'whatsapp'};if(_0x10ec2a['body']['id']){delete _0x10ec2a['body']['id'];}_0x10ec2a[_0x0a22('0x60')][_0x0a22('0x66')]=_0x10ec2a['body']['UserId']||_0x10ec2a[_0x0a22('0x67')]['id'];_0x391e1e['agent']['id']=_0x10ec2a[_0x0a22('0x60')][_0x0a22('0x66')];return db[_0x0a22('0x43')][_0x0a22('0x5e')]({'where':{'id':_0x10ec2a[_0x0a22('0x5d')]['id'],'UserId':null}})[_0x0a22('0x26')](handleEntityNotFound(_0x1766a8,null))[_0x0a22('0x26')](function(_0x54252c){if(_0x54252c){_0x391e1e[_0x0a22('0x2e')]=_0x54252c['get']({'plain':!![]});return db[_0x0a22('0x7e')][_0x0a22('0x5e')]({'where':{'id':_0x54252c['WhatsappInteractionId']}});}return null;})[_0x0a22('0x26')](handleEntityNotFound(_0x1766a8,null))[_0x0a22('0x26')](function(_0x181825){if(_0x181825){_0x391e1e[_0x0a22('0x6c')]=_0x181825[_0x0a22('0x6d')]({'plain':!![]});interaction_log[_0x0a22('0x2f')](_0x0a22('0x7f'),_0x10ec2a[_0x0a22('0x67')]['id'],_0x10ec2a[_0x0a22('0x67')][_0x0a22('0x3f')],_0x10ec2a[_0x0a22('0x67')]['role'],_0x391e1e['interaction']['id'],_0x10ec2a[_0x0a22('0x60')]?JSON['stringify'](_0x10ec2a['body']):'null');return respondWithRpcPromise(_0x0a22('0x80'),_0x0a22('0x81'),_0x391e1e);}return null;})[_0x0a22('0x26')](function(_0x809796){var _0x5b90c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x809796[_0x0a22('0x2e')][_0x0a22('0x82')];return db[_0x0a22('0x71')]['query'](_0x5b90c2,{'type':db['Sequelize'][_0x0a22('0x73')][_0x0a22('0x74')],'raw':!![]})[_0x0a22('0x26')](function(_0x58a96f){return _0x58a96f;});})[_0x0a22('0x26')](function(_0x11010f){if(_0x11010f){_0x391e1e['message'][_0x0a22('0x83')]=_0x11010f[0x0];if(!_0x10ec2a[_0x0a22('0x60')][_0x0a22('0x66')])return;return db[_0x0a22('0x75')][_0x0a22('0x5e')]({'where':{'id':_0x10ec2a['body'][_0x0a22('0x66')],'role':'agent'},'attributes':['id','name',_0x0a22('0x76'),_0x0a22('0x77'),_0x0a22('0x78')],'raw':!![]});}return null;})[_0x0a22('0x26')](function(_0x504f9b){if(!_0x504f9b)return null;_0x391e1e[_0x0a22('0x2e')]['agent']=_0x504f9b;return _0x391e1e;})['then'](function(_0x234ac1){if(_0x234ac1){_0x234ac1[_0x0a22('0x2e')][_0x0a22('0x84')]=util[_0x0a22('0x65')](_0x0a22('0x85'),_0x10ec2a[_0x0a22('0x67')][_0x0a22('0x3f')]);_0x234ac1[_0x0a22('0x2e')][_0x0a22('0x7a')]=_0x391e1e[_0x0a22('0x7a')];_0x234ac1[_0x0a22('0x2e')]['motionChannel']=_0x391e1e[_0x0a22('0x7a')];_0x234ac1[_0x0a22('0x2e')][_0x0a22('0x86')]=_0x0a22('0x7d');respondWithRpcPromise(_0x0a22('0x7b'),_0x0a22('0x7b'),{'event':_0x0a22('0x87'),'message':_0x234ac1[_0x0a22('0x2e')]},client9002);return _0x391e1e;}return null;})[_0x0a22('0x26')](respondWithResult(_0x1766a8,null))['catch'](handleError(_0x1766a8,null));};exports[_0x0a22('0x31')]=function(_0x4461cc,_0x386c9e,_0x2f8060){if(_0x4461cc[_0x0a22('0x60')]['id']){delete _0x4461cc['body']['id'];}var _0xadd30f;return db[_0x0a22('0x43')][_0x0a22('0x5e')]({'where':{'id':_0x4461cc['params']['id']}})['then'](handleEntityNotFound(_0x386c9e,null))[_0x0a22('0x26')](function(_0x1a1add){if(_0x1a1add){_0xadd30f=_0x1a1add;return db[_0x0a22('0x88')][_0x0a22('0x5e')]({'where':{'id':_0x1a1add[_0x0a22('0x89')]}});}})[_0x0a22('0x26')](handleEntityNotFound(_0x386c9e,null))[_0x0a22('0x26')](function(_0x2a5cc0){if(_0x2a5cc0){logger[_0x0a22('0x29')](_0x0a22('0x8a'),'status',_0x0a22('0x8b'),_0x2a5cc0[_0x0a22('0x46')],util['inspect'](_0x4461cc[_0x0a22('0x60')],{'showHidden':![],'depth':null}));switch(_0x2a5cc0['type']){case'twilio':if(_0x4461cc[_0x0a22('0x60')][_0x0a22('0x8c')]&&_0x4461cc['body']['MessageSid']===_0xadd30f[_0x0a22('0x8d')]&&_0x4461cc[_0x0a22('0x60')][_0x0a22('0x8e')]&&_0x4461cc['body'][_0x0a22('0x8e')]===_0x0a22('0x64')){return _0xadd30f[_0x0a22('0x3c')]({'read':!![]});}else{logger[_0x0a22('0x2c')](_0x0a22('0x8f'),_0x0a22('0x31'),_0x0a22('0x90'),util[_0x0a22('0x91')](_0x4461cc[_0x0a22('0x60')],{'showHidden':![],'depth':null}));}break;}return _0xadd30f;}})[_0x0a22('0x26')](respondWithResult(_0x386c9e,null))[_0x0a22('0x5b')](handleError(_0x386c9e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index bdfdff5..77d6ca2 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 _0x9434=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xfd9239,_0x2fea4f){var _0x48f447=function(_0x49af16){while(--_0x49af16){_0xfd9239['push'](_0xfd9239['shift']());}};_0x48f447(++_0x2fea4f);}(_0x9434,0x168));var _0x4943=function(_0x175942,_0x2d8b03){_0x175942=_0x175942-0x0;var _0x296c73=_0x9434[_0x175942];return _0x296c73;};'use strict';var EventEmitter=require(_0x4943('0x0'));var WhatsappMessage=require(_0x4943('0x1'))['db'][_0x4943('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4943('0x3')](0x0);var events={'afterCreate':_0x4943('0x4'),'afterUpdate':_0x4943('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1159f9){return function(_0xda4cba,_0x5117c7,_0x2ce3d9){WhatsappMessageEvents[_0x4943('0x6')](_0x1159f9+':'+_0xda4cba['id'],_0xda4cba);WhatsappMessageEvents['emit'](_0x1159f9,_0xda4cba);_0x2ce3d9(null);};}for(var e in events){if(events[_0x4943('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x6b24=['../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','exports'];(function(_0x4b8ecc,_0x4cd01c){var _0x48c1b9=function(_0x308aa3){while(--_0x308aa3){_0x4b8ecc['push'](_0x4b8ecc['shift']());}};_0x48c1b9(++_0x4cd01c);}(_0x6b24,0x1ce));var _0x46b2=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x6b24[_0x237f8b];return _0x423f94;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x46b2('0x0'))['db'][_0x46b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46b2('0x2')](0x0);var events={'afterCreate':_0x46b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cfef4){return function(_0x304ab5,_0x53ee5c,_0x186cda){WhatsappMessageEvents['emit'](_0x4cfef4+':'+_0x304ab5['id'],_0x304ab5);WhatsappMessageEvents[_0x46b2('0x4')](_0x4cfef4,_0x304ab5);_0x186cda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x46b2('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 780bf55..903b332 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 _0x33f5=['finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/status?token=','token','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s'];(function(_0x12ae37,_0x226c49){var _0x1e227f=function(_0x289549){while(--_0x289549){_0x12ae37['push'](_0x12ae37['shift']());}};_0x1e227f(++_0x226c49);}(_0x33f5,0xff));var _0x533f=function(_0x690de5,_0xfa9a3c){_0x690de5=_0x690de5-0x0;var _0x51f683=_0x33f5[_0x690de5];return _0x51f683;};'use strict';var _=require(_0x533f('0x0'));var util=require(_0x533f('0x1'));var logger=require(_0x533f('0x2'))(_0x533f('0x3'));var moment=require(_0x533f('0x4'));var BPromise=require(_0x533f('0x5'));var rp=require(_0x533f('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x533f('0x7'));var rimraf=require(_0x533f('0x8'));var config=require(_0x533f('0x9'));var attributes=require(_0x533f('0xa'));module['exports']=function(_0x22eed8,_0xfe8574){return _0x22eed8['define'](_0x533f('0xb'),attributes,{'tableName':_0x533f('0xc'),'paranoid':![],'indexes':[{'name':_0x533f('0xd'),'fields':[_0x533f('0xd')]},{'name':_0x533f('0xe'),'fields':[_0x533f('0xf')],'type':_0x533f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a20c5,_0x50f166,_0x255bca){var _0x350246=_0x22eed8['models'];var _0x592607=_0x5a20c5[_0x533f('0x11')]({'plain':!![]});if(_0x592607[_0x533f('0x12')]['toLowerCase']()==='in'||_0x592607['direction'][_0x533f('0x13')]()===_0x533f('0x14')&&!_0x592607['secret']&&!_[_0x533f('0x15')](_0x592607[_0x533f('0x16')])){_0x350246[_0x533f('0x17')][_0x533f('0x18')]({'where':{'id':_0x592607[_0x533f('0x19')]}})[_0x533f('0x1a')](function(_0x2cd48a){if(_0x2cd48a){_0x2cd48a['update']({'lastMsgAt':_0x592607[_0x533f('0x1b')],'lastMsgDirection':_0x592607['direction'][_0x533f('0x13')]()});}})[_0x533f('0x1c')](function(_0x5cd9e5){console['error'](_0x5cd9e5);});}if(_0x592607[_0x533f('0x12')]===_0x533f('0x14')&&!_0x592607[_0x533f('0x1d')]){var _0x4a5adf;_0x350246[_0x533f('0x1e')][_0x533f('0x1f')]({'where':{'id':_0x592607[_0x533f('0x20')]},'raw':!![]})['then'](function(_0x196b70){_0x4a5adf=_0x196b70;if(_0x4a5adf&&_0x4a5adf[_0x533f('0x21')]){switch(_0x4a5adf['type']){case'twilio':var _0x2817ac=require(_0x533f('0x22'));if(_0x4a5adf[_0x533f('0x23')]&&_0x4a5adf[_0x533f('0x24')]&&_0x4a5adf[_0x533f('0x25')]){var _0x18bfad=new _0x2817ac(_0x4a5adf[_0x533f('0x23')],_0x4a5adf['authToken']);_0x18bfad['messages'][_0x533f('0x26')]({'body':_0x592607[_0x533f('0xf')],'to':_0x533f('0x27')+_0x592607[_0x533f('0x25')],'from':_0x533f('0x27')+_0x4a5adf[_0x533f('0x25')],'statusCallback':_0x4a5adf[_0x533f('0x28')]+'/api/whatsapp/messages/'+_0x592607['id']+_0x533f('0x29')+_0x4a5adf[_0x533f('0x2a')]})['then'](function(_0x49784b){if(_0x49784b[_0x533f('0x2b')]){return _0x5a20c5[_0x533f('0x2c')]({'messageId':_0x49784b[_0x533f('0x2b')]});}})['catch'](function(_0xa9cd85){logger[_0x533f('0x2d')](_0x533f('0x2e'),_0x533f('0x2f'),_0x533f('0x22'),util[_0x533f('0x30')](_0xa9cd85,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x533f('0x2f'),_0x533f('0x22'),_0x533f('0x31'));}break;case _0x533f('0x32'):var _0x58419e=_0x4a5adf[_0x533f('0x23')];var _0x3a18a7=_0x4a5adf[_0x533f('0x24')];var _0x4e4163=_0x4a5adf[_0x533f('0x33')]+'/whatsapp/v1/'+_0x58419e+_0x533f('0x34');var _0x771ffe={'to':[_0x592607['phone']],'message':{'type':_0x533f('0x35'),'text':_0x592607[_0x533f('0xf')]}};var _0x3db340={'method':_0x533f('0x36'),'uri':_0x4e4163,'headers':{'Authorization':_0x533f('0x37')+_0x3a18a7,'Content-Type':_0x533f('0x38')},'body':_0x771ffe,'json':!![]};rp(_0x3db340)[_0x533f('0x1a')](function(_0x5704b0){if(_0x5704b0[_0x533f('0x39')][0x0][_0x533f('0x3a')]){return _0x5a20c5[_0x533f('0x2c')]({'messageId':_0x5704b0[_0x533f('0x39')][0x0][_0x533f('0x3a')]});}})['catch'](function(_0x2e14fe){logger['err'](_0x533f('0x3b'),_0x2e14fe);});break;}}})[_0x533f('0x3c')](function(){_0x255bca();});}else{_0x255bca();}}},'charset':_0x533f('0x3d'),'collate':_0x533f('0x3e')});}; \ No newline at end of file +var _0x67d6=['token','sid','update','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token='];(function(_0x4eabaa,_0x585db1){var _0x50c8b5=function(_0x347d6b){while(--_0x347d6b){_0x4eabaa['push'](_0x4eabaa['shift']());}};_0x50c8b5(++_0x585db1);}(_0x67d6,0x16c));var _0x667d=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x67d6[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require('lodash');var util=require(_0x667d('0x0'));var logger=require(_0x667d('0x1'))(_0x667d('0x2'));var moment=require(_0x667d('0x3'));var BPromise=require(_0x667d('0x4'));var rp=require(_0x667d('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x667d('0x6'));var rimraf=require(_0x667d('0x7'));var config=require(_0x667d('0x8'));var attributes=require(_0x667d('0x9'));module[_0x667d('0xa')]=function(_0x573b32,_0xe7b594){return _0x573b32[_0x667d('0xb')]('WhatsappMessage',attributes,{'tableName':_0x667d('0xc'),'paranoid':![],'indexes':[{'name':_0x667d('0xd'),'fields':['messageId']},{'name':_0x667d('0xe'),'fields':['body'],'type':_0x667d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52d88f,_0x1e65a9,_0x3f854d){var _0x1131aa=_0x573b32[_0x667d('0x10')];var _0x4f8a74=_0x52d88f['get']({'plain':!![]});if(_0x4f8a74[_0x667d('0x11')]['toLowerCase']()==='in'||_0x4f8a74[_0x667d('0x11')][_0x667d('0x12')]()===_0x667d('0x13')&&!_0x4f8a74[_0x667d('0x14')]&&!_[_0x667d('0x15')](_0x4f8a74[_0x667d('0x16')])){_0x1131aa['WhatsappInteraction'][_0x667d('0x17')]({'where':{'id':_0x4f8a74[_0x667d('0x18')]}})[_0x667d('0x19')](function(_0x31b7d6){if(_0x31b7d6){_0x31b7d6['update']({'lastMsgAt':_0x4f8a74[_0x667d('0x1a')],'lastMsgDirection':_0x4f8a74[_0x667d('0x11')][_0x667d('0x12')]()});}})[_0x667d('0x1b')](function(_0x1319f3){console[_0x667d('0x1c')](_0x1319f3);});}if(_0x4f8a74[_0x667d('0x11')]===_0x667d('0x13')&&!_0x4f8a74['secret']){var _0x3462b3;_0x1131aa[_0x667d('0x1d')][_0x667d('0x1e')]({'where':{'id':_0x4f8a74[_0x667d('0x1f')]},'raw':!![]})[_0x667d('0x19')](function(_0x1ec2bf){_0x3462b3=_0x1ec2bf;if(_0x3462b3&&_0x3462b3[_0x667d('0x20')]){switch(_0x3462b3[_0x667d('0x20')]){case _0x667d('0x21'):var _0x270694=require(_0x667d('0x21'));if(_0x3462b3['accountSid']&&_0x3462b3[_0x667d('0x22')]&&_0x3462b3[_0x667d('0x23')]){var _0x347458=new _0x270694(_0x3462b3[_0x667d('0x24')],_0x3462b3['authToken']);_0x347458[_0x667d('0x25')][_0x667d('0x26')]({'body':_0x4f8a74['body'],'to':_0x667d('0x27')+_0x4f8a74[_0x667d('0x23')],'from':'whatsapp:'+_0x3462b3[_0x667d('0x23')],'statusCallback':_0x3462b3[_0x667d('0x28')]+'/api/whatsapp/messages/'+_0x4f8a74['id']+_0x667d('0x29')+_0x3462b3[_0x667d('0x2a')]})[_0x667d('0x19')](function(_0x156e0e){if(_0x156e0e[_0x667d('0x2b')]){return _0x52d88f[_0x667d('0x2c')]({'messageId':_0x156e0e[_0x667d('0x2b')]});}})[_0x667d('0x1b')](function(_0x520540){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x667d('0x2d'),_0x667d('0x21'),util['inspect'](_0x520540,{'showHidden':![],'depth':null}));});}else{logger[_0x667d('0x1c')](_0x667d('0x2e'),_0x667d('0x2d'),_0x667d('0x21'),_0x667d('0x2f'));}break;case _0x667d('0x30'):var _0x449721=_0x3462b3[_0x667d('0x24')];var _0x28250a=_0x3462b3['authToken'];var _0x184c99=_0x3462b3[_0x667d('0x31')]+'/whatsapp/v1/'+_0x449721+'/messages/';var _0x58868d={'to':[_0x4f8a74['phone']],'message':{'type':'text','text':_0x4f8a74['body']}};var _0x242f3b={'method':_0x667d('0x32'),'uri':_0x184c99,'headers':{'Authorization':_0x667d('0x33')+_0x28250a,'Content-Type':_0x667d('0x34')},'body':_0x58868d,'json':!![]};rp(_0x242f3b)[_0x667d('0x19')](function(_0x48a414){if(_0x48a414[_0x667d('0x35')][0x0][_0x667d('0x36')]){return _0x52d88f[_0x667d('0x2c')]({'messageId':_0x48a414[_0x667d('0x35')][0x0][_0x667d('0x36')]});}})[_0x667d('0x1b')](function(_0x2b755a){logger['err'](_0x667d('0x37'),_0x2b755a);});break;}}})['finally'](function(){_0x3f854d();});}else{_0x3f854d();}}},'charset':_0x667d('0x38'),'collate':_0x667d('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index fc778cd..7eda8f5 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 _0x6778=['raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','create','body','options'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6778,0x1d0));var _0x8677=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x6778[_0x307086];return _0x699043;};'use strict';var _=require(_0x8677('0x0'));var util=require(_0x8677('0x1'));var moment=require(_0x8677('0x2'));var BPromise=require(_0x8677('0x3'));var rs=require(_0x8677('0x4'));var fs=require('fs');var Redis=require(_0x8677('0x5'));var db=require(_0x8677('0x6'))['db'];var utils=require(_0x8677('0x7'));var logger=require(_0x8677('0x8'))(_0x8677('0x9'));var config=require(_0x8677('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8677('0xb')][_0x8677('0xc')]({'port':0x232a});config['redis']=_[_0x8677('0xd')](config[_0x8677('0xe')],{'host':_0x8677('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8677('0xe')]));require(_0x8677('0x10'))[_0x8677('0x11')](socket);function respondWithRpcPromise(_0x18309b,_0x25b1db,_0x51174a){return new BPromise(function(_0x1286cc,_0x76e5ce){return client['request'](_0x18309b,_0x51174a)[_0x8677('0x12')](function(_0x175001){logger[_0x8677('0x13')](_0x8677('0x14'),_0x25b1db,'request\x20sent');logger[_0x8677('0x15')](_0x8677('0x16'),_0x25b1db,_0x8677('0x17'),JSON[_0x8677('0x18')](_0x175001));if(_0x175001[_0x8677('0x19')]){if(_0x175001[_0x8677('0x19')][_0x8677('0x1a')]===0x1f4){logger['error'](_0x8677('0x14'),_0x25b1db,_0x175001['error']['message']);return _0x76e5ce(_0x175001['error'][_0x8677('0x1b')]);}logger[_0x8677('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x25b1db,_0x175001[_0x8677('0x19')]['message']);return _0x1286cc(_0x175001[_0x8677('0x19')]['message']);}else{logger['info'](_0x8677('0x14'),_0x25b1db,_0x8677('0x17'));_0x1286cc(_0x175001['result']['message']);}})['catch'](function(_0x5b2f7c){logger[_0x8677('0x19')](_0x8677('0x14'),_0x25b1db,_0x5b2f7c);_0x76e5ce(_0x5b2f7c);});});}exports['CreateWhatsappMessage']=function(_0x5e95a1){var _0x2dea77=this;return new Promise(function(_0x12a7b9,_0x55e62c){return db['WhatsappMessage'][_0x8677('0x1c')](_0x5e95a1[_0x8677('0x1d')],{'raw':_0x5e95a1[_0x8677('0x1e')]?_0x5e95a1['options'][_0x8677('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x28a4eb){logger[_0x8677('0x13')](_0x8677('0x20'),_0x5e95a1);logger[_0x8677('0x15')](_0x8677('0x20'),_0x5e95a1,JSON['stringify'](_0x28a4eb));_0x12a7b9(_0x28a4eb);})['catch'](function(_0x595831){logger[_0x8677('0x19')]('CreateWhatsappMessage',_0x595831['message'],_0x5e95a1);_0x55e62c(_0x2dea77[_0x8677('0x19')](0x1f4,_0x595831['message']));});});}; \ No newline at end of file +var _0x07ae=['rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','WhatsappMessage','create','options','raw','CreateWhatsappMessage','debug','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5611b1,_0x11278b){var _0x46df81=function(_0x46d003){while(--_0x46d003){_0x5611b1['push'](_0x5611b1['shift']());}};_0x46df81(++_0x11278b);}(_0x07ae,0x1da));var _0xe07a=function(_0x5e08da,_0xca7cd6){_0x5e08da=_0x5e08da-0x0;var _0x365928=_0x07ae[_0x5e08da];return _0x365928;};'use strict';var _=require('lodash');var util=require(_0xe07a('0x0'));var moment=require('moment');var BPromise=require(_0xe07a('0x1'));var rs=require(_0xe07a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe07a('0x3'))['db'];var utils=require(_0xe07a('0x4'));var logger=require(_0xe07a('0x5'))(_0xe07a('0x6'));var config=require(_0xe07a('0x7'));var jayson=require(_0xe07a('0x8'));var client=jayson['client'][_0xe07a('0x9')]({'port':0x232a});config[_0xe07a('0xa')]=_[_0xe07a('0xb')](config[_0xe07a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe07a('0xc'))(new Redis(config['redis']));require(_0xe07a('0xd'))[_0xe07a('0xe')](socket);function respondWithRpcPromise(_0x1ef31f,_0x214617,_0x17f981){return new BPromise(function(_0x4ac61a,_0x50fb6c){return client['request'](_0x1ef31f,_0x17f981)[_0xe07a('0xf')](function(_0x4dcbff){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x214617,_0xe07a('0x10'));logger['debug'](_0xe07a('0x11'),_0x214617,_0xe07a('0x10'),JSON[_0xe07a('0x12')](_0x4dcbff));if(_0x4dcbff[_0xe07a('0x13')]){if(_0x4dcbff[_0xe07a('0x13')][_0xe07a('0x14')]===0x1f4){logger[_0xe07a('0x13')](_0xe07a('0x15'),_0x214617,_0x4dcbff[_0xe07a('0x13')][_0xe07a('0x16')]);return _0x50fb6c(_0x4dcbff['error'][_0xe07a('0x16')]);}logger[_0xe07a('0x13')](_0xe07a('0x15'),_0x214617,_0x4dcbff[_0xe07a('0x13')][_0xe07a('0x16')]);return _0x4ac61a(_0x4dcbff[_0xe07a('0x13')][_0xe07a('0x16')]);}else{logger[_0xe07a('0x17')](_0xe07a('0x15'),_0x214617,_0xe07a('0x10'));_0x4ac61a(_0x4dcbff[_0xe07a('0x18')][_0xe07a('0x16')]);}})[_0xe07a('0x19')](function(_0x4a0ca4){logger[_0xe07a('0x13')](_0xe07a('0x15'),_0x214617,_0x4a0ca4);_0x50fb6c(_0x4a0ca4);});});}exports['CreateWhatsappMessage']=function(_0x2a3a6f){var _0x36b328=this;return new Promise(function(_0x435fd7,_0x886d17){return db[_0xe07a('0x1a')][_0xe07a('0x1b')](_0x2a3a6f['body'],{'raw':_0x2a3a6f[_0xe07a('0x1c')]?_0x2a3a6f[_0xe07a('0x1c')][_0xe07a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3c2d75){logger[_0xe07a('0x17')](_0xe07a('0x1e'),_0x2a3a6f);logger[_0xe07a('0x1f')](_0xe07a('0x1e'),_0x2a3a6f,JSON[_0xe07a('0x12')](_0x3c2d75));_0x435fd7(_0x3c2d75);})[_0xe07a('0x19')](function(_0x50a7bd){logger[_0xe07a('0x13')](_0xe07a('0x1e'),_0x50a7bd[_0xe07a('0x16')],_0x2a3a6f);_0x886d17(_0x36b328[_0xe07a('0x13')](0x1f4,_0x50a7bd['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3a3f53e..39a1611 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 _0x0c8b=['save','remove','emit','register','length'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x0c8b,0x91));var _0xb0c8=function(_0x13e9d4,_0x25483d){_0x13e9d4=_0x13e9d4-0x0;var _0x2c62b8=_0x0c8b[_0x13e9d4];return _0x2c62b8;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xb0c8('0x0'),_0xb0c8('0x1'),'update'];function createListener(_0x2f929e,_0xe24563){return function(_0x58319f){_0xe24563[_0xb0c8('0x2')](_0x2f929e,_0x58319f);};}function removeListener(_0x2b1286,_0x1cb789){return function(){WhatsappMessageEvents['removeListener'](_0x2b1286,_0x1cb789);};}exports[_0xb0c8('0x3')]=function(_0x2c41f1){for(var _0x54c2ff=0x0,_0x15b261=events[_0xb0c8('0x4')];_0x54c2ff<_0x15b261;_0x54c2ff++){var _0x4b1b28=events[_0x54c2ff];var _0x2df031=createListener('whatsappMessage:'+_0x4b1b28,_0x2c41f1);WhatsappMessageEvents['on'](_0x4b1b28,_0x2df031);}}; \ No newline at end of file +var _0x4bbc=['removeListener','register','whatsappMessage:','save','remove','update','emit'];(function(_0x51fdb0,_0x20a078){var _0x58a465=function(_0x423a28){while(--_0x423a28){_0x51fdb0['push'](_0x51fdb0['shift']());}};_0x58a465(++_0x20a078);}(_0x4bbc,0x1b5));var _0xc4bb=function(_0x278d4b,_0x4e4c43){_0x278d4b=_0x278d4b-0x0;var _0x549875=_0x4bbc[_0x278d4b];return _0x549875;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xc4bb('0x0'),_0xc4bb('0x1'),_0xc4bb('0x2')];function createListener(_0x5f546a,_0x67e109){return function(_0x22f533){_0x67e109[_0xc4bb('0x3')](_0x5f546a,_0x22f533);};}function removeListener(_0x5f4ecb,_0x550546){return function(){WhatsappMessageEvents[_0xc4bb('0x4')](_0x5f4ecb,_0x550546);};}exports[_0xc4bb('0x5')]=function(_0x42306c){for(var _0xa4046c=0x0,_0x454814=events['length'];_0xa4046c<_0x454814;_0xa4046c++){var _0x29318e=events[_0xa4046c];var _0x26d998=createListener(_0xc4bb('0x6')+_0x29318e,_0x42306c);WhatsappMessageEvents['on'](_0x29318e,_0x26d998);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 58a2b31..048637a 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 _0x43ef=['update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','/:id'];(function(_0x4cf1e5,_0x4f6889){var _0x4c652b=function(_0x565517){while(--_0x565517){_0x4cf1e5['push'](_0x4cf1e5['shift']());}};_0x4c652b(++_0x4f6889);}(_0x43ef,0x19a));var _0xf43e=function(_0x3335b0,_0x1cf411){_0x3335b0=_0x3335b0-0x0;var _0x3c4ef0=_0x43ef[_0x3335b0];return _0x3c4ef0;};'use strict';var multer=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var path=require('path');var timeout=require(_0xf43e('0x2'));var express=require(_0xf43e('0x3'));var router=express[_0xf43e('0x4')]();var fs_extra=require(_0xf43e('0x5'));var auth=require(_0xf43e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf43e('0x7'));var controller=require('./whatsappQueue.controller');router[_0xf43e('0x8')]('/',auth[_0xf43e('0x9')](),controller[_0xf43e('0xa')]);router[_0xf43e('0x8')]('/describe',auth[_0xf43e('0x9')](),controller[_0xf43e('0xb')]);router[_0xf43e('0x8')]('/:id',auth[_0xf43e('0x9')](),controller[_0xf43e('0xc')]);router['get'](_0xf43e('0xd'),auth['isAuthenticated'](),controller[_0xf43e('0xe')]);router['get'](_0xf43e('0xf'),auth[_0xf43e('0x9')](),controller['getTeams']);router['get'](_0xf43e('0x10'),auth[_0xf43e('0x9')](),controller[_0xf43e('0x11')]);router[_0xf43e('0x12')]('/',auth[_0xf43e('0x9')](),controller[_0xf43e('0x13')]);router[_0xf43e('0x12')](_0xf43e('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf43e('0x12')](_0xf43e('0x10'),auth[_0xf43e('0x9')](),controller[_0xf43e('0x14')]);router['put'](_0xf43e('0x15'),auth['isAuthenticated'](),controller[_0xf43e('0x16')]);router[_0xf43e('0x17')](_0xf43e('0x15'),auth['isAuthenticated'](),controller[_0xf43e('0x18')]);router[_0xf43e('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf43e('0x19')]);router[_0xf43e('0x17')](_0xf43e('0x10'),auth[_0xf43e('0x9')](),controller['removeAgents']);module[_0xf43e('0x1a')]=router; \ No newline at end of file +var _0x79be=['post','create','addAgents','put','update','delete','removeTeams','removeAgents','exports','path','express','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x33b9b3,_0x3981dd){var _0x47659e=function(_0x2ab3e8){while(--_0x2ab3e8){_0x33b9b3['push'](_0x33b9b3['shift']());}};_0x47659e(++_0x3981dd);}(_0x79be,0x103));var _0xe79b=function(_0x468c4c,_0x53e6ee){_0x468c4c=_0x468c4c-0x0;var _0x404eb2=_0x79be[_0x468c4c];return _0x404eb2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe79b('0x0'));var timeout=require('connect-timeout');var express=require(_0xe79b('0x1'));var router=express['Router']();var fs_extra=require(_0xe79b('0x2'));var auth=require(_0xe79b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe79b('0x4'));router[_0xe79b('0x5')]('/',auth['isAuthenticated'](),controller[_0xe79b('0x6')]);router[_0xe79b('0x5')](_0xe79b('0x7'),auth[_0xe79b('0x8')](),controller[_0xe79b('0x9')]);router[_0xe79b('0x5')](_0xe79b('0xa'),auth[_0xe79b('0x8')](),controller['show']);router['get'](_0xe79b('0xb'),auth['isAuthenticated'](),controller[_0xe79b('0xc')]);router[_0xe79b('0x5')](_0xe79b('0xd'),auth[_0xe79b('0x8')](),controller[_0xe79b('0xe')]);router[_0xe79b('0x5')](_0xe79b('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe79b('0x10')]('/',auth['isAuthenticated'](),controller[_0xe79b('0x11')]);router[_0xe79b('0x10')](_0xe79b('0xd'),auth[_0xe79b('0x8')](),controller['addTeams']);router[_0xe79b('0x10')](_0xe79b('0xf'),auth[_0xe79b('0x8')](),controller[_0xe79b('0x12')]);router[_0xe79b('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe79b('0x14')]);router[_0xe79b('0x15')](_0xe79b('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xe79b('0x15')](_0xe79b('0xd'),auth[_0xe79b('0x8')](),controller[_0xe79b('0x16')]);router[_0xe79b('0x15')](_0xe79b('0xf'),auth[_0xe79b('0x8')](),controller[_0xe79b('0x17')]);module[_0xe79b('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0a1d26a..03c84a2 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 _0xd957=['beepall','roundrobin','STRING','sequelize','exports','name','INTEGER','rrmemory'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xd957,0x153));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7d95('0x0'));module[_0x7d95('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7d95('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7d95('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7d95('0x4'),_0x7d95('0x5'),_0x7d95('0x6'))},'description':{'type':Sequelize[_0x7d95('0x7')]}}; \ No newline at end of file +var _0xa9e0=['ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x31244d,_0x4614a5){var _0x1256de=function(_0x3bf350){while(--_0x3bf350){_0x31244d['push'](_0x31244d['shift']());}};_0x1256de(++_0x4614a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a9e('0x3')]('rrmemory',_0x0a9e('0x4'),_0x0a9e('0x5'))},'description':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index cf5fc87..05f4823 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 _0x70c7=['UserWhatsappQueue','rawAttributes','pick','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','ids','Agents','voicePause','flatMap','addTeams','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','end','error','name','index','map','WhatsappQueue','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','describe','getMembers','findOne'];(function(_0x217331,_0x35c4b1){var _0x21d657=function(_0x4eda2a){while(--_0x4eda2a){_0x217331['push'](_0x217331['shift']());}};_0x21d657(++_0x35c4b1);}(_0x70c7,0x14a));var _0x770c=function(_0x24f6f1,_0x2968f5){_0x24f6f1=_0x24f6f1-0x0;var _0x119467=_0x70c7[_0x24f6f1];return _0x119467;};'use strict';var emlformat=require(_0x770c('0x0'));var rimraf=require(_0x770c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x770c('0x2'));var rp=require(_0x770c('0x3'));var moment=require('moment');var BPromise=require(_0x770c('0x4'));var Mustache=require('mustache');var util=require(_0x770c('0x5'));var path=require(_0x770c('0x6'));var sox=require(_0x770c('0x7'));var csv=require(_0x770c('0x8'));var ejs=require(_0x770c('0x9'));var fs=require('fs');var fs_extra=require(_0x770c('0xa'));var _=require('lodash');var squel=require(_0x770c('0xb'));var crypto=require(_0x770c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x770c('0xd'));var toCsv=require(_0x770c('0x8'));var querystring=require(_0x770c('0xe'));var Papa=require('papaparse');var Redis=require(_0x770c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x770c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x770c('0x11'));var logger=require(_0x770c('0x12'))('api');var utils=require(_0x770c('0x13'));var config=require(_0x770c('0x14'));var licenseUtil=require(_0x770c('0x15'));var db=require('../../mysqldb')['db'];config[_0x770c('0x16')]=_[_0x770c('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x770c('0x18'))(new Redis(config[_0x770c('0x16')]));require(_0x770c('0x19'))[_0x770c('0x1a')](socket);function respondWithStatusCode(_0x47a3a3,_0x2f57f8){_0x2f57f8=_0x2f57f8||0xcc;return function(_0x4c2be5){if(_0x4c2be5){return _0x47a3a3[_0x770c('0x1b')](_0x2f57f8);}return _0x47a3a3['status'](_0x2f57f8)['end']();};}function respondWithResult(_0x2fa7c2,_0x2c217a){_0x2c217a=_0x2c217a||0xc8;return function(_0x37e0ec){if(_0x37e0ec){return _0x2fa7c2[_0x770c('0x1c')](_0x2c217a)[_0x770c('0x1d')](_0x37e0ec);}};}function respondWithFilteredResult(_0xd14c43,_0x10a22e){return function(_0x4373bd){if(_0x4373bd){var _0x26b7b9=typeof _0x10a22e[_0x770c('0x1e')]==='undefined'&&typeof _0x10a22e['limit']===_0x770c('0x1f');var _0x4a1285=_0x4373bd['count'];var _0x3586b2=_0x26b7b9?0x0:_0x10a22e['offset'];var _0x4bd0bd=_0x26b7b9?_0x4373bd[_0x770c('0x20')]:_0x10a22e[_0x770c('0x1e')]+_0x10a22e['limit'];var _0xb806db;if(_0x4bd0bd>=_0x4a1285){_0x4bd0bd=_0x4a1285;_0xb806db=0xc8;}else{_0xb806db=0xce;}_0xd14c43[_0x770c('0x1c')](_0xb806db);return _0xd14c43['set']('Content-Range',_0x3586b2+'-'+_0x4bd0bd+'/'+_0x4a1285)['json'](_0x4373bd);}return null;};}function patchUpdates(_0x433b98){return function(_0x166edd){try{jsonpatch[_0x770c('0x21')](_0x166edd,_0x433b98,!![]);}catch(_0x542fbb){return BPromise[_0x770c('0x22')](_0x542fbb);}return _0x166edd[_0x770c('0x23')]();};}function saveUpdates(_0x25d079,_0x347513){return function(_0x59a973){if(_0x59a973){return _0x59a973[_0x770c('0x24')](_0x25d079)[_0x770c('0x25')](function(_0x4b517b){return _0x4b517b;});}return null;};}function removeEntity(_0x1fd5a0,_0x384d62){return function(_0x57a86b){if(_0x57a86b){return _0x57a86b['destroy']()[_0x770c('0x25')](function(){var _0x5a4d39=_0x57a86b[_0x770c('0x26')]({'plain':!![]});var _0x27838d=_0x770c('0x27');return db[_0x770c('0x28')]['destroy']({'where':{'type':_0x27838d,'resourceId':_0x5a4d39['id']}})[_0x770c('0x25')](function(){return _0x57a86b;});})['then'](function(){_0x1fd5a0[_0x770c('0x1c')](0xcc)[_0x770c('0x29')]();});}};}function handleEntityNotFound(_0x13aa35,_0x5ef0c3){return function(_0x4fce58){if(!_0x4fce58){_0x13aa35[_0x770c('0x1b')](0x194);}return _0x4fce58;};}function handleError(_0x3d0cab,_0x4f21d4){_0x4f21d4=_0x4f21d4||0x1f4;return function(_0x37f057){logger[_0x770c('0x2a')](_0x37f057['stack']);if(_0x37f057[_0x770c('0x2b')]){delete _0x37f057['name'];}_0x3d0cab['status'](_0x4f21d4)['send'](_0x37f057);};}exports[_0x770c('0x2c')]=function(_0x299066,_0x3a1aa7){var _0x410832={},_0x39e445={},_0x23d7df={'count':0x0,'rows':[]};var _0x1e491d=_[_0x770c('0x2d')](db[_0x770c('0x2e')]['rawAttributes'],function(_0xd7533c){return{'name':_0xd7533c[_0x770c('0x2f')],'type':_0xd7533c[_0x770c('0x30')][_0x770c('0x31')]};});_0x39e445['model']=_['map'](_0x1e491d,_0x770c('0x2b'));_0x39e445[_0x770c('0x32')]=_['keys'](_0x299066[_0x770c('0x32')]);_0x39e445[_0x770c('0x33')]=_[_0x770c('0x34')](_0x39e445['model'],_0x39e445[_0x770c('0x32')]);_0x410832[_0x770c('0x35')]=_[_0x770c('0x34')](_0x39e445['model'],qs[_0x770c('0x36')](_0x299066[_0x770c('0x32')][_0x770c('0x36')]));_0x410832[_0x770c('0x35')]=_0x410832['attributes'][_0x770c('0x37')]?_0x410832[_0x770c('0x35')]:_0x39e445[_0x770c('0x38')];if(!_0x299066[_0x770c('0x32')][_0x770c('0x39')](_0x770c('0x3a'))){_0x410832[_0x770c('0x3b')]=qs[_0x770c('0x3b')](_0x299066[_0x770c('0x32')][_0x770c('0x3b')]);_0x410832[_0x770c('0x1e')]=qs[_0x770c('0x1e')](_0x299066[_0x770c('0x32')][_0x770c('0x1e')]);}_0x410832['order']=qs[_0x770c('0x3c')](_0x299066[_0x770c('0x32')][_0x770c('0x3c')]);_0x410832[_0x770c('0x3d')]=qs[_0x770c('0x33')](_['pick'](_0x299066[_0x770c('0x32')],_0x39e445[_0x770c('0x33')]),_0x1e491d);if(_0x299066[_0x770c('0x32')][_0x770c('0x3e')]){_0x410832[_0x770c('0x3d')]=_[_0x770c('0x3f')](_0x410832[_0x770c('0x3d')],{'$or':_[_0x770c('0x2d')](_0x1e491d,function(_0x4ca558){if(_0x4ca558[_0x770c('0x30')]!==_0x770c('0x40')){var _0x5217b9={};_0x5217b9[_0x4ca558[_0x770c('0x2b')]]={'$like':'%'+_0x299066[_0x770c('0x32')][_0x770c('0x3e')]+'%'};return _0x5217b9;}})});}_0x410832=_['merge']({},_0x410832,_0x299066[_0x770c('0x41')]);var _0x4821a9={'where':_0x410832[_0x770c('0x3d')]};return db[_0x770c('0x2e')][_0x770c('0x20')](_0x4821a9)[_0x770c('0x25')](function(_0x418d8b){_0x23d7df[_0x770c('0x20')]=_0x418d8b;if(_0x299066[_0x770c('0x32')][_0x770c('0x42')]){_0x410832[_0x770c('0x43')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x770c('0x44')](_0x410832);})['then'](function(_0x34e53f){_0x23d7df[_0x770c('0x45')]=_0x34e53f;return _0x23d7df;})[_0x770c('0x25')](respondWithFilteredResult(_0x3a1aa7,_0x410832))['catch'](handleError(_0x3a1aa7,null));};exports[_0x770c('0x46')]=function(_0x3b6518,_0x7cfc10){var _0x3d90bd={'raw':!![],'where':{'id':_0x3b6518[_0x770c('0x47')]['id']}},_0x19a36d={};_0x19a36d['model']=_['keys'](db[_0x770c('0x2e')]['rawAttributes']);_0x19a36d['query']=_[_0x770c('0x48')](_0x3b6518['query']);_0x19a36d[_0x770c('0x33')]=_[_0x770c('0x34')](_0x19a36d['model'],_0x19a36d[_0x770c('0x32')]);_0x3d90bd[_0x770c('0x35')]=_[_0x770c('0x34')](_0x19a36d[_0x770c('0x38')],qs[_0x770c('0x36')](_0x3b6518[_0x770c('0x32')][_0x770c('0x36')]));_0x3d90bd[_0x770c('0x35')]=_0x3d90bd[_0x770c('0x35')]['length']?_0x3d90bd['attributes']:_0x19a36d[_0x770c('0x38')];if(_0x3b6518[_0x770c('0x32')][_0x770c('0x42')]){_0x3d90bd[_0x770c('0x43')]=[{'all':!![]}];}_0x3d90bd=_['merge']({},_0x3d90bd,_0x3b6518[_0x770c('0x41')]);return db[_0x770c('0x2e')][_0x770c('0x49')](_0x3d90bd)[_0x770c('0x25')](handleEntityNotFound(_0x7cfc10,null))['then'](respondWithResult(_0x7cfc10,null))[_0x770c('0x4a')](handleError(_0x7cfc10,null));};exports[_0x770c('0x4b')]=function(_0xaaefb5,_0x5ceef5){return db[_0x770c('0x2e')][_0x770c('0x4b')](_0xaaefb5['body'],{})[_0x770c('0x25')](function(_0x2be642){var _0x332c24=_0xaaefb5[_0x770c('0x4c')]['get']({'plain':!![]});if(!_0x332c24)throw new Error(_0x770c('0x4d'));if(_0x332c24[_0x770c('0x4e')]===_0x770c('0x4c')){var _0x3a6155=_0x2be642[_0x770c('0x26')]({'plain':!![]});var _0x39bdda=_0x770c('0x27');return db[_0x770c('0x4f')][_0x770c('0x49')]({'where':{'name':_0x39bdda,'userProfileId':_0x332c24[_0x770c('0x50')]},'raw':!![]})[_0x770c('0x25')](function(_0x11e80d){if(_0x11e80d&&_0x11e80d[_0x770c('0x51')]===0x0){return db['UserProfileResource'][_0x770c('0x4b')]({'name':_0x3a6155[_0x770c('0x2b')],'resourceId':_0x3a6155['id'],'type':_0x11e80d[_0x770c('0x2b')],'sectionId':_0x11e80d['id']},{})[_0x770c('0x25')](function(){return _0x2be642;});}else{return _0x2be642;}})['catch'](function(_0x2be01f){logger[_0x770c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be01f);throw _0x2be01f;});}return _0x2be642;})[_0x770c('0x25')](respondWithResult(_0x5ceef5,0xc9))['catch'](handleError(_0x5ceef5,null));};exports['update']=function(_0x5080df,_0x2257b6){if(_0x5080df[_0x770c('0x52')]['id']){delete _0x5080df[_0x770c('0x52')]['id'];}return db['WhatsappQueue'][_0x770c('0x49')]({'where':{'id':_0x5080df[_0x770c('0x47')]['id']}})[_0x770c('0x25')](handleEntityNotFound(_0x2257b6,null))['then'](saveUpdates(_0x5080df[_0x770c('0x52')],null))[_0x770c('0x25')](respondWithResult(_0x2257b6,null))[_0x770c('0x4a')](handleError(_0x2257b6,null));};exports[_0x770c('0x53')]=function(_0x388663,_0x3a415b){return db[_0x770c('0x2e')]['find']({'where':{'id':_0x388663[_0x770c('0x47')]['id']}})[_0x770c('0x25')](handleEntityNotFound(_0x3a415b,null))[_0x770c('0x25')](removeEntity(_0x3a415b,null))[_0x770c('0x4a')](handleError(_0x3a415b,null));};exports[_0x770c('0x54')]=function(_0x40d956,_0x1933d4){return db[_0x770c('0x2e')][_0x770c('0x54')]()['then'](respondWithResult(_0x1933d4,null))['catch'](handleError(_0x1933d4,null));};exports[_0x770c('0x55')]=function(_0x51f259,_0x423f3e,_0x2a7577){var _0x43a72a={'raw':!![],'where':{}},_0x498288={},_0x286cf4;return db['WhatsappQueue'][_0x770c('0x56')]({'where':{'id':_0x51f259[_0x770c('0x47')]['id']}})['then'](handleEntityNotFound(_0x423f3e,null))[_0x770c('0x25')](function(_0x9e1fc6){if(_0x9e1fc6){_0x286cf4=_0x9e1fc6[_0x770c('0x26')]({'plain':!![]});_0x498288[_0x770c('0x38')]=_[_0x770c('0x48')](db[_0x770c('0x57')][_0x770c('0x58')]);_0x498288['query']=_[_0x770c('0x48')](_0x51f259[_0x770c('0x32')]);_0x498288['filters']=_['intersection'](_0x498288[_0x770c('0x38')],_0x498288['query']);_0x43a72a['attributes']=_[_0x770c('0x34')](_0x498288['model'],qs[_0x770c('0x36')](_0x51f259[_0x770c('0x32')][_0x770c('0x36')]));_0x43a72a['attributes']=_0x43a72a['attributes']['length']?_0x43a72a[_0x770c('0x35')]:_0x498288[_0x770c('0x38')];if(!_0x51f259[_0x770c('0x32')][_0x770c('0x39')]('nolimit')){_0x43a72a[_0x770c('0x3b')]=qs[_0x770c('0x3b')](_0x51f259[_0x770c('0x32')][_0x770c('0x3b')]);_0x43a72a['offset']=qs[_0x770c('0x1e')](_0x51f259[_0x770c('0x32')]['offset']);}_0x43a72a['order']=qs['sort'](_0x51f259[_0x770c('0x32')][_0x770c('0x3c')]);_0x43a72a[_0x770c('0x3d')]=qs[_0x770c('0x33')](_[_0x770c('0x59')](_0x51f259[_0x770c('0x32')],_0x498288[_0x770c('0x33')]));_0x43a72a[_0x770c('0x3d')][_0x770c('0x5a')]=_0x9e1fc6['id'];if(_0x51f259[_0x770c('0x32')][_0x770c('0x3e')]){_0x43a72a['where']=_[_0x770c('0x3f')](_0x43a72a[_0x770c('0x3d')],{'$or':_[_0x770c('0x2d')](_0x43a72a[_0x770c('0x35')],function(_0x36fdd7){var _0x29ef7b={};_0x29ef7b[_0x36fdd7]={'$like':'%'+_0x51f259[_0x770c('0x32')][_0x770c('0x3e')]+'%'};return _0x29ef7b;})});}_0x43a72a=_['merge']({},_0x43a72a,_0x51f259[_0x770c('0x41')]);return db[_0x770c('0x57')]['findAll'](_0x43a72a);}})[_0x770c('0x25')](function(_0x5079f6){if(_0x5079f6){return db[_0x770c('0x5b')][_0x770c('0x5c')]({'where':{'id':_['map'](_0x5079f6,_0x770c('0x5d')),'role':'agent'},'attributes':['id',_0x770c('0x2b'),_0x770c('0x5e'),_0x770c('0x5f'),_0x770c('0x60')]});}})[_0x770c('0x25')](function(_0x234965){if(_0x234965){return{'count':_0x234965[_0x770c('0x20')],'rows':_[_0x770c('0x2d')](_0x234965[_0x770c('0x45')],function(_0x4e7fd7){return{'membername':_0x4e7fd7[_0x770c('0x2b')],'UserId':_0x4e7fd7['id'],'queue_name':_0x286cf4[_0x770c('0x2b')],'WhatsappQueueId':_0x286cf4['id'],'interface':util[_0x770c('0x61')]('%s/%s',_0x770c('0x62'),_0x4e7fd7['name']),'penalty':0x0,'paused':_0x4e7fd7[_0x770c('0x5e')],'createdAt':_0x4e7fd7[_0x770c('0x60')],'updatedAt':_0x4e7fd7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x423f3e,_0x43a72a))[_0x770c('0x4a')](handleError(_0x423f3e,null));};exports[_0x770c('0x63')]=function(_0x3ccc24,_0x4a2e98,_0x21b9dc){var _0x5b9557={};var _0x1fa375={};var _0x1863d1;var _0x4767b6;return db[_0x770c('0x2e')][_0x770c('0x56')]({'where':{'id':_0x3ccc24[_0x770c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a2e98,null))['then'](function(_0x5ab344){if(_0x5ab344){_0x1863d1=_0x5ab344;_0x1fa375[_0x770c('0x38')]=_[_0x770c('0x48')](db[_0x770c('0x64')][_0x770c('0x58')]);_0x1fa375[_0x770c('0x32')]=_['keys'](_0x3ccc24[_0x770c('0x32')]);_0x1fa375['filters']=_[_0x770c('0x34')](_0x1fa375['model'],_0x1fa375[_0x770c('0x32')]);_0x5b9557[_0x770c('0x35')]=_[_0x770c('0x34')](_0x1fa375[_0x770c('0x38')],qs[_0x770c('0x36')](_0x3ccc24['query']['fields']));_0x5b9557[_0x770c('0x35')]=_0x5b9557[_0x770c('0x35')]['length']?_0x5b9557[_0x770c('0x35')]:_0x1fa375[_0x770c('0x38')];_0x5b9557[_0x770c('0x65')]=qs[_0x770c('0x3c')](_0x3ccc24[_0x770c('0x32')][_0x770c('0x3c')]);_0x5b9557[_0x770c('0x3d')]=qs['filters'](_[_0x770c('0x59')](_0x3ccc24[_0x770c('0x32')],_0x1fa375[_0x770c('0x33')]));if(_0x3ccc24[_0x770c('0x32')][_0x770c('0x3e')]){_0x5b9557[_0x770c('0x3d')]=_[_0x770c('0x3f')](_0x5b9557[_0x770c('0x3d')],{'$or':_['map'](_0x5b9557[_0x770c('0x35')],function(_0x52719c){var _0x11ceba={};_0x11ceba[_0x52719c]={'$like':'%'+_0x3ccc24[_0x770c('0x32')][_0x770c('0x3e')]+'%'};return _0x11ceba;})});}_0x5b9557=_[_0x770c('0x3f')]({},_0x5b9557,_0x3ccc24[_0x770c('0x41')]);return _0x1863d1[_0x770c('0x63')](_0x5b9557);}})[_0x770c('0x25')](function(_0x13c7a3){if(_0x13c7a3){_0x4767b6=_0x13c7a3['length'];if(!_0x3ccc24[_0x770c('0x32')][_0x770c('0x39')](_0x770c('0x3a'))){_0x5b9557['limit']=qs[_0x770c('0x3b')](_0x3ccc24['query'][_0x770c('0x3b')]);_0x5b9557['offset']=qs[_0x770c('0x1e')](_0x3ccc24[_0x770c('0x32')]['offset']);}return _0x1863d1[_0x770c('0x63')](_0x5b9557);}})[_0x770c('0x25')](function(_0x1acace){if(_0x1acace){return _0x1acace?{'count':_0x4767b6,'rows':_0x1acace}:null;}})[_0x770c('0x25')](respondWithResult(_0x4a2e98,null))[_0x770c('0x4a')](handleError(_0x4a2e98,null));};exports['addTeams']=function(_0x39bb80,_0x1843a0,_0x3bbfb6){var _0x224258=_0x39bb80[_0x770c('0x52')][_0x770c('0x66')];return db[_0x770c('0x64')]['findAll']({'where':{'id':_0x224258},'attributes':['id'],'include':[{'model':db[_0x770c('0x5b')],'as':_0x770c('0x67'),'attributes':['id',_0x770c('0x2b'),'online',_0x770c('0x68'),'interface'],'raw':!![]}]})[_0x770c('0x25')](function(_0x279522){if(_0x279522){var _0x408cff=_[_0x770c('0x69')](_0x279522,function(_0x5f5730){var _0x42d8da=_0x5f5730[_0x770c('0x26')]({'plain':!![]});return _0x42d8da[_0x770c('0x67')];});return db[_0x770c('0x2e')]['find']({'where':{'id':_0x39bb80[_0x770c('0x47')]['id']}})[_0x770c('0x25')](function(_0x580185){return db['sequelize']['transaction'](function(_0x1ecb0f){return _0x580185[_0x770c('0x6a')](_0x224258,{'transaction':_0x1ecb0f})['then'](function(){return BPromise['each'](_0x408cff,function(_0x33bb44){return db[_0x770c('0x57')][_0x770c('0x6b')]({'where':{'UserId':_0x33bb44['id'],'WhatsappQueueId':_0x39bb80['params']['id']},'transaction':_0x1ecb0f});});})[_0x770c('0x25')](function(){_0x408cff['forEach'](function(_0x436672){socket[_0x770c('0x6c')](_0x770c('0x6d'),{'UserId':_0x436672['id'],'WhatsappQueueId':_0x580185['id']});});});});});}})[_0x770c('0x25')](respondWithStatusCode(_0x1843a0,null))['catch'](handleError(_0x1843a0,null));};exports[_0x770c('0x6e')]=function(_0x3ab115,_0x15bb60,_0x14e16f){return db['Team'][_0x770c('0x44')]({'where':{'id':_0x3ab115['query'][_0x770c('0x66')]},'attributes':['id'],'include':[{'model':db[_0x770c('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x770c('0x25')](handleEntityNotFound(_0x15bb60,null))[_0x770c('0x25')](function(_0x2fa600){var _0x3c7ef9=_[_0x770c('0x2d')](_0x2fa600,'id');var _0x465f46=[];var _0x49bb52=[];var _0x5cb129=squel[_0x770c('0x6f')]();_0x5cb129[_0x770c('0x70')](_0x770c('0x71'))[_0x770c('0x72')](_0x770c('0x73'),'tq')['join'](_0x770c('0x74'),'ut',_0x770c('0x75'))['where'](_0x770c('0x76'),_0x3ab115[_0x770c('0x47')]['id']);for(var _0x270a6d=0x0;_0x270a6d<_0x2fa600['length'];_0x270a6d+=0x1){let _0x416bf2=_0x2fa600[_0x270a6d];for(var _0x3a64fb=0x0;_0x3a64fb<_0x416bf2[_0x770c('0x67')][_0x770c('0x37')];_0x3a64fb+=0x1){let _0x4c0acb=_0x416bf2[_0x770c('0x67')][_0x3a64fb];var _0x20c34d=_0x5cb129['clone']();_0x20c34d[_0x770c('0x3d')](_0x770c('0x77'),_0x4c0acb['id']);_0x49bb52[_0x770c('0x78')](db[_0x770c('0x79')][_0x770c('0x32')](_0x20c34d[_0x770c('0x7a')](),{'type':db['sequelize'][_0x770c('0x7b')][_0x770c('0x7c')]})[_0x770c('0x25')](function(_0x4c3376){if(_0x4c3376[_0x770c('0x37')]===0x1){return _0x4c0acb['id'];}else{var _0x331f21=_['every'](_[_0x770c('0x2d')](_0x4c3376,_0x770c('0x7d')),function(_0x1dc52f){return _[_0x770c('0x7e')](_0x3c7ef9,_0x1dc52f);});if(_0x331f21){return _0x4c0acb['id'];}}}));}}return BPromise[_0x770c('0x7f')](_0x49bb52)[_0x770c('0x25')](function(_0x9e96bd){_0x465f46=_(_0x465f46)[_0x770c('0x80')](_0x9e96bd)[_0x770c('0x81')]()[_0x770c('0x82')]();return db[_0x770c('0x2e')][_0x770c('0x49')]({'where':{'id':_0x3ab115[_0x770c('0x47')]['id']}})[_0x770c('0x25')](function(_0x100ec5){return db[_0x770c('0x79')]['transaction'](function(_0x531466){return _0x100ec5[_0x770c('0x6e')](_0x3ab115[_0x770c('0x32')]['ids'],{'transaction':_0x531466})[_0x770c('0x25')](function(){if(!_[_0x770c('0x83')](_0x465f46)){return _0x100ec5[_0x770c('0x84')](_0x465f46,{'transaction':_0x531466});}})[_0x770c('0x25')](function(){_0x465f46['forEach'](function(_0x131333){socket[_0x770c('0x6c')](_0x770c('0x85'),{'UserId':_0x131333,'WhatsappQueueId':_0x100ec5['id']});});});});});});})[_0x770c('0x25')](respondWithStatusCode(_0x15bb60,null))[_0x770c('0x4a')](handleError(_0x15bb60,null));};exports['addAgents']=function(_0x52c1ab,_0x4057b8,_0x2a1dc1){return db[_0x770c('0x2e')]['find']({'where':{'id':_0x52c1ab[_0x770c('0x47')]['id']}})[_0x770c('0x25')](handleEntityNotFound(_0x4057b8,null))[_0x770c('0x25')](function(_0x2a0829){if(_0x2a0829){return _0x2a0829[_0x770c('0x86')](_0x52c1ab[_0x770c('0x52')][_0x770c('0x66')],_[_0x770c('0x87')](_0x52c1ab[_0x770c('0x52')],[_0x770c('0x66'),'id'])||{})[_0x770c('0x88')](function(_0x1c6b92){for(var _0x92ccef=0x0;_0x92ccef<_0x52c1ab[_0x770c('0x52')][_0x770c('0x66')][_0x770c('0x37')];_0x92ccef+=0x1){socket['emit'](_0x770c('0x6d'),{'UserId':Number(_0x52c1ab[_0x770c('0x52')]['ids'][_0x92ccef]),'WhatsappQueueId':Number(_0x52c1ab[_0x770c('0x47')]['id'])});}return _0x1c6b92;});}})[_0x770c('0x25')](respondWithResult(_0x4057b8,null))[_0x770c('0x4a')](handleError(_0x4057b8,null));};exports[_0x770c('0x84')]=function(_0x441a47,_0x520279,_0x52ac21){return db[_0x770c('0x2e')][_0x770c('0x49')]({'where':{'id':_0x441a47[_0x770c('0x47')]['id']}})[_0x770c('0x25')](handleEntityNotFound(_0x520279,null))[_0x770c('0x25')](function(_0x5119c0){if(_0x5119c0){return _0x5119c0[_0x770c('0x84')](_0x441a47['query'][_0x770c('0x66')])[_0x770c('0x25')](function(){if(_[_0x770c('0x89')](_0x441a47[_0x770c('0x32')][_0x770c('0x66')])){for(var _0x2dc874=0x0;_0x2dc874<_0x441a47[_0x770c('0x32')][_0x770c('0x66')][_0x770c('0x37')];_0x2dc874+=0x1){socket[_0x770c('0x6c')](_0x770c('0x85'),{'UserId':Number(_0x441a47[_0x770c('0x32')]['ids'][_0x2dc874]),'WhatsappQueueId':Number(_0x441a47[_0x770c('0x47')]['id'])});}}else{socket[_0x770c('0x6c')](_0x770c('0x85'),{'UserId':Number(_0x441a47['query'][_0x770c('0x66')]),'WhatsappQueueId':Number(_0x441a47[_0x770c('0x47')]['id'])});}});}})[_0x770c('0x25')](respondWithStatusCode(_0x520279,null))['catch'](handleError(_0x520279,null));};exports[_0x770c('0x8a')]=function(_0x200b83,_0x4d2b36,_0x2dfca8){var _0x59ecb6={};var _0x5a9af5={};var _0x10ab8a;var _0x14ce30;return db['WhatsappQueue'][_0x770c('0x56')]({'where':{'id':_0x200b83[_0x770c('0x47')]['id']}})[_0x770c('0x25')](handleEntityNotFound(_0x4d2b36,null))[_0x770c('0x25')](function(_0x4179bd){if(_0x4179bd){_0x10ab8a=_0x4179bd;_0x5a9af5[_0x770c('0x38')]=_[_0x770c('0x48')](db[_0x770c('0x5b')][_0x770c('0x58')]);_0x5a9af5[_0x770c('0x32')]=_[_0x770c('0x48')](_0x200b83[_0x770c('0x32')]);_0x5a9af5[_0x770c('0x33')]=_[_0x770c('0x34')](_0x5a9af5[_0x770c('0x38')],_0x5a9af5[_0x770c('0x32')]);_0x59ecb6[_0x770c('0x35')]=_[_0x770c('0x34')](_0x5a9af5[_0x770c('0x38')],qs[_0x770c('0x36')](_0x200b83[_0x770c('0x32')][_0x770c('0x36')]));_0x59ecb6['attributes']=_0x59ecb6[_0x770c('0x35')][_0x770c('0x37')]?_0x59ecb6[_0x770c('0x35')]:_0x5a9af5[_0x770c('0x38')];_0x59ecb6[_0x770c('0x65')]=qs[_0x770c('0x3c')](_0x200b83[_0x770c('0x32')][_0x770c('0x3c')]);_0x59ecb6[_0x770c('0x3d')]=qs[_0x770c('0x33')](_[_0x770c('0x59')](_0x200b83[_0x770c('0x32')],_0x5a9af5[_0x770c('0x33')]));if(_0x200b83[_0x770c('0x32')][_0x770c('0x3e')]){_0x59ecb6[_0x770c('0x3d')]=_[_0x770c('0x3f')](_0x59ecb6['where'],{'$or':_[_0x770c('0x2d')](_0x59ecb6[_0x770c('0x35')],function(_0x137684){var _0x47920e={};_0x47920e[_0x137684]={'$like':'%'+_0x200b83['query'][_0x770c('0x3e')]+'%'};return _0x47920e;})});}_0x59ecb6=_[_0x770c('0x3f')]({},_0x59ecb6,_0x200b83['options']);return _0x10ab8a[_0x770c('0x8a')](_0x59ecb6);}})[_0x770c('0x25')](function(_0x426e49){if(_0x426e49){_0x14ce30=_0x426e49[_0x770c('0x37')];if(!_0x200b83['query'][_0x770c('0x39')]('nolimit')){_0x59ecb6[_0x770c('0x3b')]=qs[_0x770c('0x3b')](_0x200b83[_0x770c('0x32')][_0x770c('0x3b')]);_0x59ecb6[_0x770c('0x1e')]=qs[_0x770c('0x1e')](_0x200b83[_0x770c('0x32')]['offset']);}return _0x10ab8a['getAgents'](_0x59ecb6);}})[_0x770c('0x25')](function(_0xd050a3){if(_0xd050a3){return _0xd050a3?{'count':_0x14ce30,'rows':_0xd050a3}:null;}})[_0x770c('0x25')](respondWithResult(_0x4d2b36,null))[_0x770c('0x4a')](handleError(_0x4d2b36,null));}; \ No newline at end of file +var _0xbe3f=['removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','emit','getAgents','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','where','VIRTUAL','includeAll','catch','show','params','keys','rawAttributes','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','findOne','UserWhatsappQueue','nolimit','order','WhatsappQueueId','filter','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','value','removeTeams'];(function(_0x27a73f,_0x34afb4){var _0x3c7877=function(_0x4413ff){while(--_0x4413ff){_0x27a73f['push'](_0x27a73f['shift']());}};_0x3c7877(++_0x34afb4);}(_0xbe3f,0x93));var _0xfbe3=function(_0x202f11,_0x169f83){_0x202f11=_0x202f11-0x0;var _0x58bd06=_0xbe3f[_0x202f11];return _0x58bd06;};'use strict';var emlformat=require(_0xfbe3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbe3('0x1'));var rp=require(_0xfbe3('0x2'));var moment=require(_0xfbe3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfbe3('0x4'));var util=require(_0xfbe3('0x5'));var path=require(_0xfbe3('0x6'));var sox=require(_0xfbe3('0x7'));var csv=require('to-csv');var ejs=require(_0xfbe3('0x8'));var fs=require('fs');var fs_extra=require(_0xfbe3('0x9'));var _=require('lodash');var squel=require(_0xfbe3('0xa'));var crypto=require(_0xfbe3('0xb'));var jsforce=require(_0xfbe3('0xc'));var deskjs=require(_0xfbe3('0xd'));var toCsv=require(_0xfbe3('0xe'));var querystring=require(_0xfbe3('0xf'));var Papa=require(_0xfbe3('0x10'));var Redis=require(_0xfbe3('0x11'));var authService=require(_0xfbe3('0x12'));var qs=require(_0xfbe3('0x13'));var as=require(_0xfbe3('0x14'));var hardwareService=require(_0xfbe3('0x15'));var logger=require(_0xfbe3('0x16'))('api');var utils=require(_0xfbe3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfbe3('0x18'));var db=require(_0xfbe3('0x19'))['db'];config[_0xfbe3('0x1a')]=_['defaults'](config[_0xfbe3('0x1a')],{'host':_0xfbe3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbe3('0x1a')]));require(_0xfbe3('0x1c'))['register'](socket);function respondWithStatusCode(_0x28dfd,_0x4919c8){_0x4919c8=_0x4919c8||0xcc;return function(_0x1f4cff){if(_0x1f4cff){return _0x28dfd[_0xfbe3('0x1d')](_0x4919c8);}return _0x28dfd[_0xfbe3('0x1e')](_0x4919c8)[_0xfbe3('0x1f')]();};}function respondWithResult(_0x4528de,_0x4d7295){_0x4d7295=_0x4d7295||0xc8;return function(_0x1056ef){if(_0x1056ef){return _0x4528de[_0xfbe3('0x1e')](_0x4d7295)[_0xfbe3('0x20')](_0x1056ef);}};}function respondWithFilteredResult(_0x1b3253,_0x263ea0){return function(_0x51a0e2){if(_0x51a0e2){var _0x4a8b9f=typeof _0x263ea0['offset']===_0xfbe3('0x21')&&typeof _0x263ea0[_0xfbe3('0x22')]==='undefined';var _0x296bed=_0x51a0e2[_0xfbe3('0x23')];var _0x639176=_0x4a8b9f?0x0:_0x263ea0[_0xfbe3('0x24')];var _0x192bc0=_0x4a8b9f?_0x51a0e2['count']:_0x263ea0[_0xfbe3('0x24')]+_0x263ea0[_0xfbe3('0x22')];var _0x315de7;if(_0x192bc0>=_0x296bed){_0x192bc0=_0x296bed;_0x315de7=0xc8;}else{_0x315de7=0xce;}_0x1b3253[_0xfbe3('0x1e')](_0x315de7);return _0x1b3253[_0xfbe3('0x25')](_0xfbe3('0x26'),_0x639176+'-'+_0x192bc0+'/'+_0x296bed)[_0xfbe3('0x20')](_0x51a0e2);}return null;};}function patchUpdates(_0x3935af){return function(_0x5227f3){try{jsonpatch[_0xfbe3('0x27')](_0x5227f3,_0x3935af,!![]);}catch(_0x221e82){return BPromise[_0xfbe3('0x28')](_0x221e82);}return _0x5227f3[_0xfbe3('0x29')]();};}function saveUpdates(_0x425108,_0x5d6882){return function(_0x42d963){if(_0x42d963){return _0x42d963[_0xfbe3('0x2a')](_0x425108)[_0xfbe3('0x2b')](function(_0x438251){return _0x438251;});}return null;};}function removeEntity(_0x28785b,_0x42e34a){return function(_0x278a1b){if(_0x278a1b){return _0x278a1b[_0xfbe3('0x2c')]()[_0xfbe3('0x2b')](function(){var _0x395e41=_0x278a1b[_0xfbe3('0x2d')]({'plain':!![]});var _0x4c0b91=_0xfbe3('0x2e');return db[_0xfbe3('0x2f')]['destroy']({'where':{'type':_0x4c0b91,'resourceId':_0x395e41['id']}})[_0xfbe3('0x2b')](function(){return _0x278a1b;});})[_0xfbe3('0x2b')](function(){_0x28785b[_0xfbe3('0x1e')](0xcc)[_0xfbe3('0x1f')]();});}};}function handleEntityNotFound(_0x5c164a,_0x4b31c9){return function(_0xed92e9){if(!_0xed92e9){_0x5c164a[_0xfbe3('0x1d')](0x194);}return _0xed92e9;};}function handleError(_0x3b67ee,_0x4ea80c){_0x4ea80c=_0x4ea80c||0x1f4;return function(_0x2c1032){logger[_0xfbe3('0x30')](_0x2c1032[_0xfbe3('0x31')]);if(_0x2c1032[_0xfbe3('0x32')]){delete _0x2c1032['name'];}_0x3b67ee['status'](_0x4ea80c)[_0xfbe3('0x33')](_0x2c1032);};}exports['index']=function(_0x90fa65,_0x46f3b2){var _0x2f8fd2={},_0x25f9ae={},_0x5d4ab4={'count':0x0,'rows':[]};var _0x4b39a3=_[_0xfbe3('0x34')](db[_0xfbe3('0x35')]['rawAttributes'],function(_0x2b5768){return{'name':_0x2b5768[_0xfbe3('0x36')],'type':_0x2b5768[_0xfbe3('0x37')]['key']};});_0x25f9ae[_0xfbe3('0x38')]=_[_0xfbe3('0x34')](_0x4b39a3,_0xfbe3('0x32'));_0x25f9ae[_0xfbe3('0x39')]=_['keys'](_0x90fa65[_0xfbe3('0x39')]);_0x25f9ae[_0xfbe3('0x3a')]=_['intersection'](_0x25f9ae[_0xfbe3('0x38')],_0x25f9ae[_0xfbe3('0x39')]);_0x2f8fd2[_0xfbe3('0x3b')]=_[_0xfbe3('0x3c')](_0x25f9ae[_0xfbe3('0x38')],qs['fields'](_0x90fa65['query'][_0xfbe3('0x3d')]));_0x2f8fd2['attributes']=_0x2f8fd2[_0xfbe3('0x3b')][_0xfbe3('0x3e')]?_0x2f8fd2[_0xfbe3('0x3b')]:_0x25f9ae[_0xfbe3('0x38')];if(!_0x90fa65[_0xfbe3('0x39')][_0xfbe3('0x3f')]('nolimit')){_0x2f8fd2[_0xfbe3('0x22')]=qs['limit'](_0x90fa65[_0xfbe3('0x39')][_0xfbe3('0x22')]);_0x2f8fd2[_0xfbe3('0x24')]=qs['offset'](_0x90fa65[_0xfbe3('0x39')][_0xfbe3('0x24')]);}_0x2f8fd2['order']=qs[_0xfbe3('0x40')](_0x90fa65[_0xfbe3('0x39')][_0xfbe3('0x40')]);_0x2f8fd2['where']=qs[_0xfbe3('0x3a')](_[_0xfbe3('0x41')](_0x90fa65['query'],_0x25f9ae[_0xfbe3('0x3a')]),_0x4b39a3);if(_0x90fa65[_0xfbe3('0x39')]['filter']){_0x2f8fd2[_0xfbe3('0x42')]=_['merge'](_0x2f8fd2[_0xfbe3('0x42')],{'$or':_['map'](_0x4b39a3,function(_0x1a1946){if(_0x1a1946['type']!==_0xfbe3('0x43')){var _0x1ab7a7={};_0x1ab7a7[_0x1a1946[_0xfbe3('0x32')]]={'$like':'%'+_0x90fa65[_0xfbe3('0x39')]['filter']+'%'};return _0x1ab7a7;}})});}_0x2f8fd2=_['merge']({},_0x2f8fd2,_0x90fa65['options']);var _0x1ef027={'where':_0x2f8fd2[_0xfbe3('0x42')]};return db[_0xfbe3('0x35')][_0xfbe3('0x23')](_0x1ef027)[_0xfbe3('0x2b')](function(_0x111e86){_0x5d4ab4['count']=_0x111e86;if(_0x90fa65[_0xfbe3('0x39')][_0xfbe3('0x44')]){_0x2f8fd2['include']=[{'all':!![]}];}return db[_0xfbe3('0x35')]['findAll'](_0x2f8fd2);})['then'](function(_0x456da4){_0x5d4ab4['rows']=_0x456da4;return _0x5d4ab4;})[_0xfbe3('0x2b')](respondWithFilteredResult(_0x46f3b2,_0x2f8fd2))[_0xfbe3('0x45')](handleError(_0x46f3b2,null));};exports[_0xfbe3('0x46')]=function(_0x468fef,_0x39f30b){var _0x386d21={'raw':!![],'where':{'id':_0x468fef[_0xfbe3('0x47')]['id']}},_0x3aa568={};_0x3aa568[_0xfbe3('0x38')]=_[_0xfbe3('0x48')](db[_0xfbe3('0x35')][_0xfbe3('0x49')]);_0x3aa568[_0xfbe3('0x39')]=_[_0xfbe3('0x48')](_0x468fef[_0xfbe3('0x39')]);_0x3aa568[_0xfbe3('0x3a')]=_[_0xfbe3('0x3c')](_0x3aa568[_0xfbe3('0x38')],_0x3aa568[_0xfbe3('0x39')]);_0x386d21['attributes']=_['intersection'](_0x3aa568[_0xfbe3('0x38')],qs[_0xfbe3('0x3d')](_0x468fef[_0xfbe3('0x39')][_0xfbe3('0x3d')]));_0x386d21['attributes']=_0x386d21['attributes'][_0xfbe3('0x3e')]?_0x386d21[_0xfbe3('0x3b')]:_0x3aa568[_0xfbe3('0x38')];if(_0x468fef[_0xfbe3('0x39')][_0xfbe3('0x44')]){_0x386d21[_0xfbe3('0x4a')]=[{'all':!![]}];}_0x386d21=_[_0xfbe3('0x4b')]({},_0x386d21,_0x468fef[_0xfbe3('0x4c')]);return db[_0xfbe3('0x35')][_0xfbe3('0x4d')](_0x386d21)['then'](handleEntityNotFound(_0x39f30b,null))['then'](respondWithResult(_0x39f30b,null))[_0xfbe3('0x45')](handleError(_0x39f30b,null));};exports[_0xfbe3('0x4e')]=function(_0x476065,_0x524253){return db['WhatsappQueue'][_0xfbe3('0x4e')](_0x476065[_0xfbe3('0x4f')],{})[_0xfbe3('0x2b')](function(_0x49e2bc){var _0x2c3b20=_0x476065[_0xfbe3('0x50')][_0xfbe3('0x2d')]({'plain':!![]});if(!_0x2c3b20)throw new Error(_0xfbe3('0x51'));if(_0x2c3b20[_0xfbe3('0x52')]===_0xfbe3('0x50')){var _0xd2e8a3=_0x49e2bc[_0xfbe3('0x2d')]({'plain':!![]});var _0x1a2bed=_0xfbe3('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x1a2bed,'userProfileId':_0x2c3b20['userProfileId']},'raw':!![]})['then'](function(_0x2b0bf0){if(_0x2b0bf0&&_0x2b0bf0[_0xfbe3('0x53')]===0x0){return db[_0xfbe3('0x2f')]['create']({'name':_0xd2e8a3[_0xfbe3('0x32')],'resourceId':_0xd2e8a3['id'],'type':_0x2b0bf0[_0xfbe3('0x32')],'sectionId':_0x2b0bf0['id']},{})['then'](function(){return _0x49e2bc;});}else{return _0x49e2bc;}})['catch'](function(_0x946be4){logger[_0xfbe3('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x946be4);throw _0x946be4;});}return _0x49e2bc;})[_0xfbe3('0x2b')](respondWithResult(_0x524253,0xc9))[_0xfbe3('0x45')](handleError(_0x524253,null));};exports['update']=function(_0x59cd79,_0x3bf445){if(_0x59cd79[_0xfbe3('0x4f')]['id']){delete _0x59cd79[_0xfbe3('0x4f')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x59cd79['params']['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x3bf445,null))[_0xfbe3('0x2b')](saveUpdates(_0x59cd79['body'],null))[_0xfbe3('0x2b')](respondWithResult(_0x3bf445,null))[_0xfbe3('0x45')](handleError(_0x3bf445,null));};exports['destroy']=function(_0x310a83,_0x39d0aa){return db[_0xfbe3('0x35')][_0xfbe3('0x4d')]({'where':{'id':_0x310a83['params']['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x39d0aa,null))[_0xfbe3('0x2b')](removeEntity(_0x39d0aa,null))[_0xfbe3('0x45')](handleError(_0x39d0aa,null));};exports[_0xfbe3('0x54')]=function(_0x486287,_0x4416b3){return db[_0xfbe3('0x35')][_0xfbe3('0x54')]()[_0xfbe3('0x2b')](respondWithResult(_0x4416b3,null))[_0xfbe3('0x45')](handleError(_0x4416b3,null));};exports['getMembers']=function(_0x298874,_0x585e77,_0x3917d3){var _0x325d04={'raw':!![],'where':{}},_0x179013={},_0x156dce;return db['WhatsappQueue'][_0xfbe3('0x55')]({'where':{'id':_0x298874[_0xfbe3('0x47')]['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x585e77,null))[_0xfbe3('0x2b')](function(_0xad9976){if(_0xad9976){_0x156dce=_0xad9976[_0xfbe3('0x2d')]({'plain':!![]});_0x179013['model']=_[_0xfbe3('0x48')](db[_0xfbe3('0x56')]['rawAttributes']);_0x179013['query']=_[_0xfbe3('0x48')](_0x298874[_0xfbe3('0x39')]);_0x179013['filters']=_[_0xfbe3('0x3c')](_0x179013['model'],_0x179013['query']);_0x325d04[_0xfbe3('0x3b')]=_[_0xfbe3('0x3c')](_0x179013['model'],qs[_0xfbe3('0x3d')](_0x298874['query'][_0xfbe3('0x3d')]));_0x325d04['attributes']=_0x325d04['attributes'][_0xfbe3('0x3e')]?_0x325d04[_0xfbe3('0x3b')]:_0x179013[_0xfbe3('0x38')];if(!_0x298874['query']['hasOwnProperty'](_0xfbe3('0x57'))){_0x325d04[_0xfbe3('0x22')]=qs[_0xfbe3('0x22')](_0x298874['query'][_0xfbe3('0x22')]);_0x325d04[_0xfbe3('0x24')]=qs[_0xfbe3('0x24')](_0x298874[_0xfbe3('0x39')]['offset']);}_0x325d04[_0xfbe3('0x58')]=qs[_0xfbe3('0x40')](_0x298874['query']['sort']);_0x325d04[_0xfbe3('0x42')]=qs[_0xfbe3('0x3a')](_['pick'](_0x298874['query'],_0x179013['filters']));_0x325d04[_0xfbe3('0x42')][_0xfbe3('0x59')]=_0xad9976['id'];if(_0x298874['query'][_0xfbe3('0x5a')]){_0x325d04[_0xfbe3('0x42')]=_[_0xfbe3('0x4b')](_0x325d04[_0xfbe3('0x42')],{'$or':_['map'](_0x325d04[_0xfbe3('0x3b')],function(_0x267fe6){var _0x3d0ce0={};_0x3d0ce0[_0x267fe6]={'$like':'%'+_0x298874[_0xfbe3('0x39')][_0xfbe3('0x5a')]+'%'};return _0x3d0ce0;})});}_0x325d04=_[_0xfbe3('0x4b')]({},_0x325d04,_0x298874[_0xfbe3('0x4c')]);return db[_0xfbe3('0x56')][_0xfbe3('0x5b')](_0x325d04);}})[_0xfbe3('0x2b')](function(_0xc64eaf){if(_0xc64eaf){return db[_0xfbe3('0x5c')][_0xfbe3('0x5d')]({'where':{'id':_[_0xfbe3('0x34')](_0xc64eaf,_0xfbe3('0x5e')),'role':_0xfbe3('0x5f')},'attributes':['id',_0xfbe3('0x32'),_0xfbe3('0x60'),_0xfbe3('0x61'),_0xfbe3('0x62')]});}})[_0xfbe3('0x2b')](function(_0x19bceb){if(_0x19bceb){return{'count':_0x19bceb[_0xfbe3('0x23')],'rows':_[_0xfbe3('0x34')](_0x19bceb[_0xfbe3('0x63')],function(_0x33bf57){return{'membername':_0x33bf57[_0xfbe3('0x32')],'UserId':_0x33bf57['id'],'queue_name':_0x156dce[_0xfbe3('0x32')],'WhatsappQueueId':_0x156dce['id'],'interface':util['format'](_0xfbe3('0x64'),_0xfbe3('0x65'),_0x33bf57[_0xfbe3('0x32')]),'penalty':0x0,'paused':_0x33bf57[_0xfbe3('0x60')],'createdAt':_0x33bf57[_0xfbe3('0x62')],'updatedAt':_0x33bf57[_0xfbe3('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfbe3('0x2b')](respondWithFilteredResult(_0x585e77,_0x325d04))[_0xfbe3('0x45')](handleError(_0x585e77,null));};exports['getTeams']=function(_0x39bec5,_0x4d40ee,_0x107ea4){var _0x12c377={};var _0x31ab6={};var _0x434c97;var _0x570a18;return db[_0xfbe3('0x35')][_0xfbe3('0x55')]({'where':{'id':_0x39bec5[_0xfbe3('0x47')]['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x4d40ee,null))[_0xfbe3('0x2b')](function(_0xd3b858){if(_0xd3b858){_0x434c97=_0xd3b858;_0x31ab6['model']=_[_0xfbe3('0x48')](db[_0xfbe3('0x66')]['rawAttributes']);_0x31ab6[_0xfbe3('0x39')]=_[_0xfbe3('0x48')](_0x39bec5[_0xfbe3('0x39')]);_0x31ab6['filters']=_[_0xfbe3('0x3c')](_0x31ab6[_0xfbe3('0x38')],_0x31ab6[_0xfbe3('0x39')]);_0x12c377[_0xfbe3('0x3b')]=_[_0xfbe3('0x3c')](_0x31ab6[_0xfbe3('0x38')],qs[_0xfbe3('0x3d')](_0x39bec5['query'][_0xfbe3('0x3d')]));_0x12c377['attributes']=_0x12c377['attributes'][_0xfbe3('0x3e')]?_0x12c377[_0xfbe3('0x3b')]:_0x31ab6[_0xfbe3('0x38')];_0x12c377[_0xfbe3('0x58')]=qs['sort'](_0x39bec5['query'][_0xfbe3('0x40')]);_0x12c377['where']=qs[_0xfbe3('0x3a')](_['pick'](_0x39bec5[_0xfbe3('0x39')],_0x31ab6[_0xfbe3('0x3a')]));if(_0x39bec5[_0xfbe3('0x39')][_0xfbe3('0x5a')]){_0x12c377['where']=_[_0xfbe3('0x4b')](_0x12c377['where'],{'$or':_[_0xfbe3('0x34')](_0x12c377[_0xfbe3('0x3b')],function(_0x58023f){var _0x2aa483={};_0x2aa483[_0x58023f]={'$like':'%'+_0x39bec5[_0xfbe3('0x39')][_0xfbe3('0x5a')]+'%'};return _0x2aa483;})});}_0x12c377=_[_0xfbe3('0x4b')]({},_0x12c377,_0x39bec5[_0xfbe3('0x4c')]);return _0x434c97[_0xfbe3('0x67')](_0x12c377);}})['then'](function(_0xd91e3){if(_0xd91e3){_0x570a18=_0xd91e3[_0xfbe3('0x3e')];if(!_0x39bec5[_0xfbe3('0x39')][_0xfbe3('0x3f')](_0xfbe3('0x57'))){_0x12c377[_0xfbe3('0x22')]=qs[_0xfbe3('0x22')](_0x39bec5[_0xfbe3('0x39')][_0xfbe3('0x22')]);_0x12c377[_0xfbe3('0x24')]=qs['offset'](_0x39bec5['query'][_0xfbe3('0x24')]);}return _0x434c97[_0xfbe3('0x67')](_0x12c377);}})[_0xfbe3('0x2b')](function(_0x1e2ef4){if(_0x1e2ef4){return _0x1e2ef4?{'count':_0x570a18,'rows':_0x1e2ef4}:null;}})[_0xfbe3('0x2b')](respondWithResult(_0x4d40ee,null))[_0xfbe3('0x45')](handleError(_0x4d40ee,null));};exports['addTeams']=function(_0x161236,_0x48ab85,_0x1242eb){var _0x53d68f=_0x161236[_0xfbe3('0x4f')][_0xfbe3('0x68')];return db[_0xfbe3('0x66')]['findAll']({'where':{'id':_0x53d68f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfbe3('0x69'),'attributes':['id',_0xfbe3('0x32'),_0xfbe3('0x6a'),_0xfbe3('0x6b'),_0xfbe3('0x6c')],'raw':!![]}]})[_0xfbe3('0x2b')](function(_0x2aff47){if(_0x2aff47){var _0x42c002=_['flatMap'](_0x2aff47,function(_0x4168bb){var _0x1b9d1e=_0x4168bb[_0xfbe3('0x2d')]({'plain':!![]});return _0x1b9d1e[_0xfbe3('0x69')];});return db[_0xfbe3('0x35')][_0xfbe3('0x4d')]({'where':{'id':_0x161236['params']['id']}})[_0xfbe3('0x2b')](function(_0xfc2c9b){return db[_0xfbe3('0x6d')][_0xfbe3('0x6e')](function(_0x3bd10e){return _0xfc2c9b['addTeams'](_0x53d68f,{'transaction':_0x3bd10e})[_0xfbe3('0x2b')](function(){return BPromise[_0xfbe3('0x6f')](_0x42c002,function(_0x21577a){return db[_0xfbe3('0x56')][_0xfbe3('0x70')]({'where':{'UserId':_0x21577a['id'],'WhatsappQueueId':_0x161236[_0xfbe3('0x47')]['id']},'transaction':_0x3bd10e});});})[_0xfbe3('0x2b')](function(){_0x42c002[_0xfbe3('0x71')](function(_0x3c29f3){socket['emit'](_0xfbe3('0x72'),{'UserId':_0x3c29f3['id'],'WhatsappQueueId':_0xfc2c9b['id']});});});});});}})[_0xfbe3('0x2b')](respondWithStatusCode(_0x48ab85,null))['catch'](handleError(_0x48ab85,null));};exports['removeTeams']=function(_0x4ba6f7,_0x8cc49b,_0x15c374){return db[_0xfbe3('0x66')][_0xfbe3('0x5b')]({'where':{'id':_0x4ba6f7[_0xfbe3('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfbe3('0x69'),'attributes':['id'],'raw':!![]}]})[_0xfbe3('0x2b')](handleEntityNotFound(_0x8cc49b,null))[_0xfbe3('0x2b')](function(_0x8b1dbb){var _0xf96a19=_[_0xfbe3('0x34')](_0x8b1dbb,'id');var _0x5c094b=[];var _0x4d6e93=[];var _0x224d54=squel[_0xfbe3('0x73')]();_0x224d54[_0xfbe3('0x74')](_0xfbe3('0x75'))['from']('team_has_whatsapp_queues','tq')[_0xfbe3('0x76')](_0xfbe3('0x77'),'ut',_0xfbe3('0x78'))[_0xfbe3('0x42')](_0xfbe3('0x79'),_0x4ba6f7[_0xfbe3('0x47')]['id']);for(var _0x25e10c=0x0;_0x25e10c<_0x8b1dbb[_0xfbe3('0x3e')];_0x25e10c+=0x1){let _0x2e78a6=_0x8b1dbb[_0x25e10c];for(var _0x4afc83=0x0;_0x4afc83<_0x2e78a6[_0xfbe3('0x69')][_0xfbe3('0x3e')];_0x4afc83+=0x1){let _0x2f2e04=_0x2e78a6[_0xfbe3('0x69')][_0x4afc83];var _0x28d806=_0x224d54[_0xfbe3('0x7a')]();_0x28d806['where'](_0xfbe3('0x7b'),_0x2f2e04['id']);_0x4d6e93['push'](db[_0xfbe3('0x6d')][_0xfbe3('0x39')](_0x28d806[_0xfbe3('0x7c')](),{'type':db['sequelize'][_0xfbe3('0x7d')]['SELECT']})[_0xfbe3('0x2b')](function(_0x117226){if(_0x117226[_0xfbe3('0x3e')]===0x1){return _0x2f2e04['id'];}else{var _0x48896f=_[_0xfbe3('0x7e')](_[_0xfbe3('0x34')](_0x117226,_0xfbe3('0x7f')),function(_0x5b9138){return _[_0xfbe3('0x80')](_0xf96a19,_0x5b9138);});if(_0x48896f){return _0x2f2e04['id'];}}}));}}return BPromise['all'](_0x4d6e93)['then'](function(_0xa8e9a7){_0x5c094b=_(_0x5c094b)['union'](_0xa8e9a7)['compact']()[_0xfbe3('0x81')]();return db[_0xfbe3('0x35')][_0xfbe3('0x4d')]({'where':{'id':_0x4ba6f7[_0xfbe3('0x47')]['id']}})[_0xfbe3('0x2b')](function(_0xb855f){return db['sequelize'][_0xfbe3('0x6e')](function(_0x8805b1){return _0xb855f[_0xfbe3('0x82')](_0x4ba6f7[_0xfbe3('0x39')][_0xfbe3('0x68')],{'transaction':_0x8805b1})[_0xfbe3('0x2b')](function(){if(!_['isEmpty'](_0x5c094b)){return _0xb855f[_0xfbe3('0x83')](_0x5c094b,{'transaction':_0x8805b1});}})[_0xfbe3('0x2b')](function(){_0x5c094b[_0xfbe3('0x71')](function(_0x335ebb){socket['emit'](_0xfbe3('0x84'),{'UserId':_0x335ebb,'WhatsappQueueId':_0xb855f['id']});});});});});});})[_0xfbe3('0x2b')](respondWithStatusCode(_0x8cc49b,null))[_0xfbe3('0x45')](handleError(_0x8cc49b,null));};exports[_0xfbe3('0x85')]=function(_0x14ae84,_0x33f007,_0x40c966){return db[_0xfbe3('0x35')]['find']({'where':{'id':_0x14ae84['params']['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x33f007,null))[_0xfbe3('0x2b')](function(_0x1dd030){if(_0x1dd030){return _0x1dd030[_0xfbe3('0x85')](_0x14ae84[_0xfbe3('0x4f')]['ids'],_[_0xfbe3('0x86')](_0x14ae84[_0xfbe3('0x4f')],['ids','id'])||{})[_0xfbe3('0x87')](function(_0x2c5c15){for(var _0x5aaa15=0x0;_0x5aaa15<_0x14ae84[_0xfbe3('0x4f')]['ids']['length'];_0x5aaa15+=0x1){socket['emit'](_0xfbe3('0x72'),{'UserId':Number(_0x14ae84[_0xfbe3('0x4f')]['ids'][_0x5aaa15]),'WhatsappQueueId':Number(_0x14ae84['params']['id'])});}return _0x2c5c15;});}})[_0xfbe3('0x2b')](respondWithResult(_0x33f007,null))[_0xfbe3('0x45')](handleError(_0x33f007,null));};exports[_0xfbe3('0x83')]=function(_0x570731,_0x2ff485,_0x4be76f){return db[_0xfbe3('0x35')]['find']({'where':{'id':_0x570731['params']['id']}})[_0xfbe3('0x2b')](handleEntityNotFound(_0x2ff485,null))[_0xfbe3('0x2b')](function(_0x32b098){if(_0x32b098){return _0x32b098[_0xfbe3('0x83')](_0x570731[_0xfbe3('0x39')]['ids'])[_0xfbe3('0x2b')](function(){if(_[_0xfbe3('0x88')](_0x570731[_0xfbe3('0x39')][_0xfbe3('0x68')])){for(var _0x376d90=0x0;_0x376d90<_0x570731[_0xfbe3('0x39')]['ids'][_0xfbe3('0x3e')];_0x376d90+=0x1){socket['emit'](_0xfbe3('0x84'),{'UserId':Number(_0x570731['query'][_0xfbe3('0x68')][_0x376d90]),'WhatsappQueueId':Number(_0x570731[_0xfbe3('0x47')]['id'])});}}else{socket[_0xfbe3('0x89')]('userWhatsappQueue:remove',{'UserId':Number(_0x570731[_0xfbe3('0x39')]['ids']),'WhatsappQueueId':Number(_0x570731[_0xfbe3('0x47')]['id'])});}});}})[_0xfbe3('0x2b')](respondWithStatusCode(_0x2ff485,null))[_0xfbe3('0x45')](handleError(_0x2ff485,null));};exports[_0xfbe3('0x8a')]=function(_0x32ff60,_0x48e574,_0x2a1c23){var _0x7a46b6={};var _0x521b99={};var _0x639d1e;var _0x47062c;return db[_0xfbe3('0x35')][_0xfbe3('0x55')]({'where':{'id':_0x32ff60[_0xfbe3('0x47')]['id']}})['then'](handleEntityNotFound(_0x48e574,null))[_0xfbe3('0x2b')](function(_0x5a380d){if(_0x5a380d){_0x639d1e=_0x5a380d;_0x521b99['model']=_[_0xfbe3('0x48')](db['User']['rawAttributes']);_0x521b99[_0xfbe3('0x39')]=_[_0xfbe3('0x48')](_0x32ff60['query']);_0x521b99[_0xfbe3('0x3a')]=_['intersection'](_0x521b99['model'],_0x521b99['query']);_0x7a46b6['attributes']=_[_0xfbe3('0x3c')](_0x521b99[_0xfbe3('0x38')],qs['fields'](_0x32ff60[_0xfbe3('0x39')][_0xfbe3('0x3d')]));_0x7a46b6['attributes']=_0x7a46b6[_0xfbe3('0x3b')][_0xfbe3('0x3e')]?_0x7a46b6[_0xfbe3('0x3b')]:_0x521b99[_0xfbe3('0x38')];_0x7a46b6['order']=qs[_0xfbe3('0x40')](_0x32ff60[_0xfbe3('0x39')][_0xfbe3('0x40')]);_0x7a46b6[_0xfbe3('0x42')]=qs[_0xfbe3('0x3a')](_[_0xfbe3('0x41')](_0x32ff60[_0xfbe3('0x39')],_0x521b99['filters']));if(_0x32ff60[_0xfbe3('0x39')][_0xfbe3('0x5a')]){_0x7a46b6['where']=_[_0xfbe3('0x4b')](_0x7a46b6['where'],{'$or':_['map'](_0x7a46b6['attributes'],function(_0xc5713b){var _0x5aee1b={};_0x5aee1b[_0xc5713b]={'$like':'%'+_0x32ff60['query']['filter']+'%'};return _0x5aee1b;})});}_0x7a46b6=_['merge']({},_0x7a46b6,_0x32ff60[_0xfbe3('0x4c')]);return _0x639d1e[_0xfbe3('0x8a')](_0x7a46b6);}})[_0xfbe3('0x2b')](function(_0x36a745){if(_0x36a745){_0x47062c=_0x36a745['length'];if(!_0x32ff60[_0xfbe3('0x39')][_0xfbe3('0x3f')](_0xfbe3('0x57'))){_0x7a46b6[_0xfbe3('0x22')]=qs[_0xfbe3('0x22')](_0x32ff60[_0xfbe3('0x39')]['limit']);_0x7a46b6[_0xfbe3('0x24')]=qs[_0xfbe3('0x24')](_0x32ff60[_0xfbe3('0x39')][_0xfbe3('0x24')]);}return _0x639d1e[_0xfbe3('0x8a')](_0x7a46b6);}})[_0xfbe3('0x2b')](function(_0x520953){if(_0x520953){return _0x520953?{'count':_0x47062c,'rows':_0x520953}:null;}})[_0xfbe3('0x2b')](respondWithResult(_0x48e574,null))['catch'](handleError(_0x48e574,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ddfabec..5b41c43 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 _0x6821=['emit','hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x560867,_0x5b249c){var _0x480f67=function(_0xa7eb11){while(--_0xa7eb11){_0x560867['push'](_0x560867['shift']());}};_0x480f67(++_0x5b249c);}(_0x6821,0x113));var _0x1682=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x6821[_0x4fb1b8];return _0x146c71;};'use strict';var EventEmitter=require(_0x1682('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1682('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1682('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1682('0x3'),'afterDestroy':_0x1682('0x4')};function emitEvent(_0x5adea1){return function(_0x5568a6,_0x45d5f9,_0x498467){WhatsappQueueEvents['emit'](_0x5adea1+':'+_0x5568a6['id'],_0x5568a6);WhatsappQueueEvents[_0x1682('0x5')](_0x5adea1,_0x5568a6);_0x498467(null);};}for(var e in events){if(events[_0x1682('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x1682('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x1757=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x35e57a,_0x4367bf){var _0x2af243=function(_0x449e59){while(--_0x449e59){_0x35e57a['push'](_0x35e57a['shift']());}};_0x2af243(++_0x4367bf);}(_0x1757,0x1e8));var _0x7175=function(_0xaa4aee,_0x5440b3){_0xaa4aee=_0xaa4aee-0x0;var _0x5de58b=_0x1757[_0xaa4aee];return _0x5de58b;};'use strict';var EventEmitter=require(_0x7175('0x0'));var WhatsappQueue=require(_0x7175('0x1'))['db'][_0x7175('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7175('0x3')](0x0);var events={'afterCreate':_0x7175('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f05cf){return function(_0xc2f80a,_0x2337a8,_0x5d8363){WhatsappQueueEvents[_0x7175('0x5')](_0x2f05cf+':'+_0xc2f80a['id'],_0xc2f80a);WhatsappQueueEvents['emit'](_0x2f05cf,_0xc2f80a);_0x5d8363(null);};}for(var e in events){if(events[_0x7175('0x6')](e)){var event=events[e];WhatsappQueue[_0x7175('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a4421e8..a7a92dd 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 _0xd43c=['../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xd43c,0x195));var _0xcd43=function(_0x356cf9,_0x22e533){_0x356cf9=_0x356cf9-0x0;var _0x58ba1d=_0xd43c[_0x356cf9];return _0x58ba1d;};'use strict';var _=require(_0xcd43('0x0'));var util=require(_0xcd43('0x1'));var logger=require(_0xcd43('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcd43('0x3'));var rp=require(_0xcd43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd43('0x5'));var attributes=require(_0xcd43('0x6'));module['exports']=function(_0x14648b,_0x5139cb){return _0x14648b[_0xcd43('0x7')](_0xcd43('0x8'),attributes,{'tableName':_0xcd43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e81=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x212721,_0x1c0edc){var _0x369f08=function(_0x1c6077){while(--_0x1c6077){_0x212721['push'](_0x212721['shift']());}};_0x369f08(++_0x1c0edc);}(_0x6e81,0x74));var _0x16e8=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6e81[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x16e8('0x0'));var util=require(_0x16e8('0x1'));var logger=require(_0x16e8('0x2'))(_0x16e8('0x3'));var moment=require(_0x16e8('0x4'));var BPromise=require('bluebird');var rp=require(_0x16e8('0x5'));var fs=require('fs');var path=require(_0x16e8('0x6'));var rimraf=require(_0x16e8('0x7'));var config=require(_0x16e8('0x8'));var attributes=require(_0x16e8('0x9'));module[_0x16e8('0xa')]=function(_0x5c7af6,_0x17cce2){return _0x5c7af6['define'](_0x16e8('0xb'),attributes,{'tableName':_0x16e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index f36e4e5..e0d6d7b 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 _0x4d01=['where','limit','map','include','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x638f08,_0x275649){var _0x2a015c=function(_0x2fc50c){while(--_0x2fc50c){_0x638f08['push'](_0x638f08['shift']());}};_0x2a015c(++_0x275649);}(_0x4d01,0xf8));var _0x14d0=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x4d01[_0x349367];return _0x14179b;};'use strict';var _=require(_0x14d0('0x0'));var util=require(_0x14d0('0x1'));var moment=require(_0x14d0('0x2'));var BPromise=require(_0x14d0('0x3'));var rs=require(_0x14d0('0x4'));var fs=require('fs');var Redis=require(_0x14d0('0x5'));var db=require(_0x14d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x14d0('0x7'))(_0x14d0('0x8'));var config=require(_0x14d0('0x9'));var jayson=require(_0x14d0('0xa'));var client=jayson[_0x14d0('0xb')][_0x14d0('0xc')]({'port':0x232a});config[_0x14d0('0xd')]=_[_0x14d0('0xe')](config[_0x14d0('0xd')],{'host':_0x14d0('0xf'),'port':0x18eb});var socket=require(_0x14d0('0x10'))(new Redis(config[_0x14d0('0xd')]));require('./whatsappQueue.socket')[_0x14d0('0x11')](socket);function respondWithRpcPromise(_0xddb54,_0x41c92d,_0x165327){return new BPromise(function(_0x44790a,_0x451b67){return client['request'](_0xddb54,_0x165327)[_0x14d0('0x12')](function(_0x196e0f){logger[_0x14d0('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x41c92d,_0x14d0('0x14'));logger[_0x14d0('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x41c92d,_0x14d0('0x14'),JSON[_0x14d0('0x16')](_0x196e0f));if(_0x196e0f[_0x14d0('0x17')]){if(_0x196e0f[_0x14d0('0x17')]['code']===0x1f4){logger[_0x14d0('0x17')](_0x14d0('0x18'),_0x41c92d,_0x196e0f['error']['message']);return _0x451b67(_0x196e0f[_0x14d0('0x17')]['message']);}logger['error'](_0x14d0('0x18'),_0x41c92d,_0x196e0f['error'][_0x14d0('0x19')]);return _0x44790a(_0x196e0f[_0x14d0('0x17')][_0x14d0('0x19')]);}else{logger[_0x14d0('0x13')](_0x14d0('0x18'),_0x41c92d,_0x14d0('0x14'));_0x44790a(_0x196e0f[_0x14d0('0x1a')][_0x14d0('0x19')]);}})[_0x14d0('0x1b')](function(_0x52219a){logger[_0x14d0('0x17')](_0x14d0('0x18'),_0x41c92d,_0x52219a);_0x451b67(_0x52219a);});});}exports[_0x14d0('0x1c')]=function(_0x2f99d2){var _0x1b3801=this;return new Promise(function(_0x183c49,_0x5bb852){return db[_0x14d0('0x1d')][_0x14d0('0x1e')]({'raw':_0x2f99d2[_0x14d0('0x1f')]?_0x2f99d2[_0x14d0('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2f99d2[_0x14d0('0x1f')]?_0x2f99d2[_0x14d0('0x1f')][_0x14d0('0x20')]||null:null,'attributes':_0x2f99d2[_0x14d0('0x1f')]?_0x2f99d2[_0x14d0('0x1f')]['attributes']||null:null,'limit':_0x2f99d2[_0x14d0('0x1f')]?_0x2f99d2['options'][_0x14d0('0x21')]||null:null,'include':_0x2f99d2[_0x14d0('0x1f')]?_0x2f99d2[_0x14d0('0x1f')]['include']?_[_0x14d0('0x22')](_0x2f99d2['options'][_0x14d0('0x23')],function(_0x3066c5){return{'model':db[_0x3066c5[_0x14d0('0x24')]],'as':_0x3066c5['as'],'attributes':_0x3066c5['attributes'],'include':_0x3066c5[_0x14d0('0x23')]?_['map'](_0x3066c5[_0x14d0('0x23')],function(_0xdeeea7){return{'model':db[_0xdeeea7[_0x14d0('0x24')]],'as':_0xdeeea7['as'],'attributes':_0xdeeea7[_0x14d0('0x25')],'include':_0xdeeea7['include']?_[_0x14d0('0x22')](_0xdeeea7['include'],function(_0x22af88){return{'model':db[_0x22af88[_0x14d0('0x24')]],'as':_0x22af88['as'],'attributes':_0x22af88['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16d630){logger['info'](_0x14d0('0x1c'),_0x2f99d2);logger[_0x14d0('0x15')]('GetWhatsappQueue',_0x2f99d2,JSON[_0x14d0('0x16')](_0x16d630));_0x183c49(_0x16d630);})[_0x14d0('0x1b')](function(_0x462ad9){logger[_0x14d0('0x17')](_0x14d0('0x1c'),_0x462ad9[_0x14d0('0x19')],_0x2f99d2);_0x5bb852(_0x1b3801['error'](0x1f4,_0x462ad9[_0x14d0('0x19')]));});});};exports[_0x14d0('0x26')]=function(_0x4de36a){var _0x345e01=this;return new Promise(function(_0x314dfb,_0x21c180){return db['WhatsappQueue'][_0x14d0('0x27')]({'raw':_0x4de36a[_0x14d0('0x1f')]?_0x4de36a[_0x14d0('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4de36a[_0x14d0('0x1f')]?_0x4de36a[_0x14d0('0x1f')][_0x14d0('0x20')]||null:null,'attributes':_0x4de36a[_0x14d0('0x1f')]?_0x4de36a[_0x14d0('0x1f')][_0x14d0('0x25')]||null:null,'include':_0x4de36a[_0x14d0('0x1f')]?_0x4de36a[_0x14d0('0x1f')][_0x14d0('0x23')]?_[_0x14d0('0x22')](_0x4de36a[_0x14d0('0x1f')][_0x14d0('0x23')],function(_0x5ef3e6){return{'model':db[_0x5ef3e6[_0x14d0('0x24')]],'as':_0x5ef3e6['as'],'attributes':_0x5ef3e6['attributes'],'include':_0x5ef3e6['include']?_['map'](_0x5ef3e6[_0x14d0('0x23')],function(_0x3bde05){return{'model':db[_0x3bde05[_0x14d0('0x24')]],'as':_0x3bde05['as'],'attributes':_0x3bde05['attributes'],'include':_0x3bde05['include']?_[_0x14d0('0x22')](_0x3bde05[_0x14d0('0x23')],function(_0x44cf5f){return{'model':db[_0x44cf5f[_0x14d0('0x24')]],'as':_0x44cf5f['as'],'attributes':_0x44cf5f[_0x14d0('0x25')]};}):[]};}):[]};}):[]:[]})[_0x14d0('0x12')](function(_0x4dfdd2){logger[_0x14d0('0x13')]('ShowWhatsappQueue',_0x4de36a);logger[_0x14d0('0x15')]('ShowWhatsappQueue',_0x4de36a,JSON[_0x14d0('0x16')](_0x4dfdd2));_0x314dfb(_0x4dfdd2);})[_0x14d0('0x1b')](function(_0x4e6e9e){logger[_0x14d0('0x17')](_0x14d0('0x26'),_0x4e6e9e['message'],_0x4de36a);_0x21c180(_0x345e01['error'](0x1f4,_0x4e6e9e['message']));});});}; \ No newline at end of file +var _0xcbae=['defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','then','ShowWhatsappQueue','WhatsappQueue','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c4444,_0x119726){var _0x20d93d=function(_0x326a33){while(--_0x326a33){_0x5c4444['push'](_0x5c4444['shift']());}};_0x20d93d(++_0x119726);}(_0xcbae,0x1e3));var _0xecba=function(_0x43a5fd,_0x3f3d70){_0x43a5fd=_0x43a5fd-0x0;var _0x1017e8=_0xcbae[_0x43a5fd];return _0x1017e8;};'use strict';var _=require('lodash');var util=require(_0xecba('0x0'));var moment=require(_0xecba('0x1'));var BPromise=require('bluebird');var rs=require(_0xecba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecba('0x3'))(_0xecba('0x4'));var config=require(_0xecba('0x5'));var jayson=require(_0xecba('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xecba('0x7')](config[_0xecba('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xecba('0x9'))(new Redis(config[_0xecba('0x8')]));require(_0xecba('0xa'))[_0xecba('0xb')](socket);function respondWithRpcPromise(_0x4832f6,_0x250913,_0x2b4116){return new BPromise(function(_0x45d6c4,_0x4a6715){return client[_0xecba('0xc')](_0x4832f6,_0x2b4116)['then'](function(_0x55f019){logger['info'](_0xecba('0xd'),_0x250913,_0xecba('0xe'));logger[_0xecba('0xf')](_0xecba('0x10'),_0x250913,'request\x20sent',JSON[_0xecba('0x11')](_0x55f019));if(_0x55f019['error']){if(_0x55f019[_0xecba('0x12')][_0xecba('0x13')]===0x1f4){logger[_0xecba('0x12')](_0xecba('0xd'),_0x250913,_0x55f019['error'][_0xecba('0x14')]);return _0x4a6715(_0x55f019[_0xecba('0x12')][_0xecba('0x14')]);}logger[_0xecba('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x250913,_0x55f019[_0xecba('0x12')][_0xecba('0x14')]);return _0x45d6c4(_0x55f019['error'][_0xecba('0x14')]);}else{logger[_0xecba('0x15')](_0xecba('0xd'),_0x250913,_0xecba('0xe'));_0x45d6c4(_0x55f019['result']['message']);}})[_0xecba('0x16')](function(_0x58ee3f){logger[_0xecba('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x250913,_0x58ee3f);_0x4a6715(_0x58ee3f);});});}exports[_0xecba('0x17')]=function(_0x5142fa){var _0x586958=this;return new Promise(function(_0x5ca19e,_0x13dd44){return db['WhatsappQueue'][_0xecba('0x18')]({'raw':_0x5142fa['options']?_0x5142fa[_0xecba('0x19')][_0xecba('0x1a')]===undefined?!![]:![]:!![],'where':_0x5142fa['options']?_0x5142fa['options']['where']||null:null,'attributes':_0x5142fa[_0xecba('0x19')]?_0x5142fa['options'][_0xecba('0x1b')]||null:null,'limit':_0x5142fa[_0xecba('0x19')]?_0x5142fa[_0xecba('0x19')][_0xecba('0x1c')]||null:null,'include':_0x5142fa[_0xecba('0x19')]?_0x5142fa[_0xecba('0x19')][_0xecba('0x1d')]?_['map'](_0x5142fa[_0xecba('0x19')][_0xecba('0x1d')],function(_0x4d9c27){return{'model':db[_0x4d9c27[_0xecba('0x1e')]],'as':_0x4d9c27['as'],'attributes':_0x4d9c27[_0xecba('0x1b')],'include':_0x4d9c27[_0xecba('0x1d')]?_['map'](_0x4d9c27[_0xecba('0x1d')],function(_0x3d1052){return{'model':db[_0x3d1052[_0xecba('0x1e')]],'as':_0x3d1052['as'],'attributes':_0x3d1052['attributes'],'include':_0x3d1052[_0xecba('0x1d')]?_[_0xecba('0x1f')](_0x3d1052[_0xecba('0x1d')],function(_0x4a0667){return{'model':db[_0x4a0667['model']],'as':_0x4a0667['as'],'attributes':_0x4a0667[_0xecba('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xecba('0x20')](function(_0x341d2f){logger[_0xecba('0x15')](_0xecba('0x17'),_0x5142fa);logger[_0xecba('0xf')](_0xecba('0x17'),_0x5142fa,JSON[_0xecba('0x11')](_0x341d2f));_0x5ca19e(_0x341d2f);})[_0xecba('0x16')](function(_0x5cca29){logger[_0xecba('0x12')](_0xecba('0x17'),_0x5cca29['message'],_0x5142fa);_0x13dd44(_0x586958['error'](0x1f4,_0x5cca29[_0xecba('0x14')]));});});};exports[_0xecba('0x21')]=function(_0x3d9d37){var _0x286b46=this;return new Promise(function(_0x36b6c9,_0x4b1ea4){return db[_0xecba('0x22')]['find']({'raw':_0x3d9d37[_0xecba('0x19')]?_0x3d9d37[_0xecba('0x19')][_0xecba('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d9d37[_0xecba('0x19')]?_0x3d9d37[_0xecba('0x19')]['where']||null:null,'attributes':_0x3d9d37[_0xecba('0x19')]?_0x3d9d37['options']['attributes']||null:null,'include':_0x3d9d37['options']?_0x3d9d37[_0xecba('0x19')][_0xecba('0x1d')]?_[_0xecba('0x1f')](_0x3d9d37['options'][_0xecba('0x1d')],function(_0x3d5310){return{'model':db[_0x3d5310[_0xecba('0x1e')]],'as':_0x3d5310['as'],'attributes':_0x3d5310[_0xecba('0x1b')],'include':_0x3d5310[_0xecba('0x1d')]?_[_0xecba('0x1f')](_0x3d5310[_0xecba('0x1d')],function(_0x31c1ba){return{'model':db[_0x31c1ba['model']],'as':_0x31c1ba['as'],'attributes':_0x31c1ba[_0xecba('0x1b')],'include':_0x31c1ba[_0xecba('0x1d')]?_[_0xecba('0x1f')](_0x31c1ba['include'],function(_0x370efc){return{'model':db[_0x370efc['model']],'as':_0x370efc['as'],'attributes':_0x370efc[_0xecba('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a5cf9){logger[_0xecba('0x15')]('ShowWhatsappQueue',_0x3d9d37);logger[_0xecba('0xf')](_0xecba('0x21'),_0x3d9d37,JSON[_0xecba('0x11')](_0x2a5cf9));_0x36b6c9(_0x2a5cf9);})['catch'](function(_0xc5ec16){logger['error'](_0xecba('0x21'),_0xc5ec16[_0xecba('0x14')],_0x3d9d37);_0x4b1ea4(_0x286b46['error'](0x1f4,_0xc5ec16[_0xecba('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ae7952a..02f6404 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 _0xdd04=['./whatsappQueue.events','save','update','emit','register','length','whatsappQueue:'];(function(_0x210ed6,_0x3dffa7){var _0x353e65=function(_0x4e5159){while(--_0x4e5159){_0x210ed6['push'](_0x210ed6['shift']());}};_0x353e65(++_0x3dffa7);}(_0xdd04,0x85));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0x4dd0('0x0'));var events=[_0x4dd0('0x1'),'remove',_0x4dd0('0x2')];function createListener(_0x242b5c,_0x42581e){return function(_0x4e7d02){_0x42581e[_0x4dd0('0x3')](_0x242b5c,_0x4e7d02);};}function removeListener(_0x211ef1,_0x58c0ac){return function(){WhatsappQueueEvents['removeListener'](_0x211ef1,_0x58c0ac);};}exports[_0x4dd0('0x4')]=function(_0x396009){for(var _0xa699a4=0x0,_0xc3dcab=events[_0x4dd0('0x5')];_0xa699a4<_0xc3dcab;_0xa699a4++){var _0x1ac759=events[_0xa699a4];var _0x28e652=createListener(_0x4dd0('0x6')+_0x1ac759,_0x396009);WhatsappQueueEvents['on'](_0x1ac759,_0x28e652);}}; \ No newline at end of file +var _0xcd2d=['remove','emit','register','./whatsappQueue.events','save'];(function(_0x1c9fc4,_0x1654cb){var _0x5b9763=function(_0x48e36d){while(--_0x48e36d){_0x1c9fc4['push'](_0x1c9fc4['shift']());}};_0x5b9763(++_0x1654cb);}(_0xcd2d,0x71));var _0xdcd2=function(_0x349d9e,_0x19652c){_0x349d9e=_0x349d9e-0x0;var _0x271ef4=_0xcd2d[_0x349d9e];return _0x271ef4;};'use strict';var WhatsappQueueEvents=require(_0xdcd2('0x0'));var events=[_0xdcd2('0x1'),_0xdcd2('0x2'),'update'];function createListener(_0x5c60f5,_0x2eeb48){return function(_0x5be015){_0x2eeb48[_0xdcd2('0x3')](_0x5c60f5,_0x5be015);};}function removeListener(_0x1eff17,_0x11bea6){return function(){WhatsappQueueEvents['removeListener'](_0x1eff17,_0x11bea6);};}exports[_0xdcd2('0x4')]=function(_0x24dfce){for(var _0xd526a3=0x0,_0x34be62=events['length'];_0xd526a3<_0x34be62;_0xd526a3++){var _0x15db2f=events[_0xd526a3];var _0x135516=createListener('whatsappQueue:'+_0x15db2f,_0x24dfce);WhatsappQueueEvents['on'](_0x15db2f,_0x135516);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f53d05c..6bb2006 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 _0x84fa=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x102af6,_0x14b85b){var _0x1930ac=function(_0x4ad262){while(--_0x4ad262){_0x102af6['push'](_0x102af6['shift']());}};_0x1930ac(++_0x14b85b);}(_0x84fa,0xdf));var _0xa84f=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x84fa[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require(_0xa84f('0x0'));var util=require(_0xa84f('0x1'));var path=require(_0xa84f('0x2'));var timeout=require(_0xa84f('0x3'));var express=require(_0xa84f('0x4'));var router=express[_0xa84f('0x5')]();var fs_extra=require(_0xa84f('0x6'));var auth=require(_0xa84f('0x7'));var interaction=require(_0xa84f('0x8'));var config=require(_0xa84f('0x9'));var controller=require(_0xa84f('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xa84f('0xb')]);router[_0xa84f('0xc')](_0xa84f('0xd'),auth[_0xa84f('0xe')](),controller[_0xa84f('0xf')]);router['get'](_0xa84f('0x10'),auth[_0xa84f('0xe')](),controller[_0xa84f('0x11')]);router[_0xa84f('0x12')]('/',auth['isAuthenticated'](),controller[_0xa84f('0x13')]);router[_0xa84f('0x14')]('/:id',auth[_0xa84f('0xe')](),controller['update']);router['delete'](_0xa84f('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c02=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1b9803,_0x186bed){var _0x4b1f28=function(_0x32e790){while(--_0x32e790){_0x1b9803['push'](_0x1b9803['shift']());}};_0x4b1f28(++_0x186bed);}(_0x4c02,0x96));var _0x24c0=function(_0x430d00,_0x46485c){_0x430d00=_0x430d00-0x0;var _0x37774b=_0x4c02[_0x430d00];return _0x37774b;};'use strict';var multer=require(_0x24c0('0x0'));var util=require(_0x24c0('0x1'));var path=require(_0x24c0('0x2'));var timeout=require(_0x24c0('0x3'));var express=require(_0x24c0('0x4'));var router=express[_0x24c0('0x5')]();var fs_extra=require(_0x24c0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x24c0('0x7'));var config=require(_0x24c0('0x8'));var controller=require(_0x24c0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x24c0('0xa')]);router['get'](_0x24c0('0xb'),auth[_0x24c0('0xc')](),controller[_0x24c0('0xd')]);router[_0x24c0('0xe')](_0x24c0('0xf'),auth['isAuthenticated'](),controller[_0x24c0('0x10')]);router[_0x24c0('0x11')]('/',auth[_0x24c0('0xc')](),controller[_0x24c0('0x12')]);router['put'](_0x24c0('0xf'),auth[_0x24c0('0xc')](),controller['update']);router[_0x24c0('0x13')](_0x24c0('0xf'),auth['isAuthenticated'](),controller[_0x24c0('0x14')]);module[_0x24c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3e3c912..2510c8f 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x23e17c,_0x3dfeb0){var _0x5f3ef9=function(_0xd4818d){while(--_0xd4818d){_0x23e17c['push'](_0x23e17c['shift']());}};_0x5f3ef9(++_0x3dfeb0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x35406a,_0x7cb5d3){var _0x2ca96c=function(_0x11ba14){while(--_0x11ba14){_0x35406a['push'](_0x35406a['shift']());}};_0x2ca96c(++_0x7cb5d3);}(_0x7a54,0x106));var _0x47a5=function(_0x56d283,_0x407ca2){_0x56d283=_0x56d283-0x0;var _0x32cdff=_0x7a54[_0x56d283];return _0x32cdff;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 76eba8c..7b1f54d 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 _0xdb94=['length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0x246cd0,_0x36e3e8){var _0x1fd2de=function(_0x3472af){while(--_0x3472af){_0x246cd0['push'](_0x246cd0['shift']());}};_0x1fd2de(++_0x36e3e8);}(_0xdb94,0xab));var _0x4db9=function(_0x5d3d6d,_0x357af1){_0x5d3d6d=_0x5d3d6d-0x0;var _0x335229=_0xdb94[_0x5d3d6d];return _0x335229;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31222b,_0x5e644c){_0x5e644c=_0x5e644c||0xcc;return function(_0x571685){if(_0x571685){return _0x31222b[_0x4db9('0x17')](_0x5e644c);}return _0x31222b[_0x4db9('0x18')](_0x5e644c)['end']();};}function respondWithResult(_0xd37d63,_0x1f9638){_0x1f9638=_0x1f9638||0xc8;return function(_0x452896){if(_0x452896){return _0xd37d63[_0x4db9('0x18')](_0x1f9638)['json'](_0x452896);}};}function respondWithFilteredResult(_0x5e04ab,_0x102274){return function(_0x34de1a){if(_0x34de1a){var _0x4a037f=typeof _0x102274[_0x4db9('0x19')]===_0x4db9('0x1a')&&typeof _0x102274['limit']==='undefined';var _0x250a80=_0x34de1a[_0x4db9('0x1b')];var _0x462af3=_0x4a037f?0x0:_0x102274[_0x4db9('0x19')];var _0x1d3c33=_0x4a037f?_0x34de1a['count']:_0x102274[_0x4db9('0x19')]+_0x102274[_0x4db9('0x1c')];var _0x11012e;if(_0x1d3c33>=_0x250a80){_0x1d3c33=_0x250a80;_0x11012e=0xc8;}else{_0x11012e=0xce;}_0x5e04ab['status'](_0x11012e);return _0x5e04ab[_0x4db9('0x1d')](_0x4db9('0x1e'),_0x462af3+'-'+_0x1d3c33+'/'+_0x250a80)[_0x4db9('0x1f')](_0x34de1a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x46b522){try{jsonpatch[_0x4db9('0x20')](_0x46b522,_0x4c92e8,!![]);}catch(_0x4553c2){return BPromise[_0x4db9('0x21')](_0x4553c2);}return _0x46b522[_0x4db9('0x22')]();};}function saveUpdates(_0x159d9b,_0x3585d5){return function(_0x5aef3b){if(_0x5aef3b){return _0x5aef3b[_0x4db9('0x23')](_0x159d9b)[_0x4db9('0x24')](function(_0xcde40c){return _0xcde40c;});}return null;};}function removeEntity(_0x319475,_0x4aaa84){return function(_0x213daa){if(_0x213daa){return _0x213daa[_0x4db9('0x25')]()['then'](function(){_0x319475[_0x4db9('0x18')](0xcc)[_0x4db9('0x26')]();});}};}function handleEntityNotFound(_0x2987c6,_0x4dbb1b){return function(_0x3c8237){if(!_0x3c8237){_0x2987c6[_0x4db9('0x17')](0x194);}return _0x3c8237;};}function handleError(_0x43b95e,_0x2d330e){_0x2d330e=_0x2d330e||0x1f4;return function(_0x3f9f7e){logger[_0x4db9('0x27')](_0x3f9f7e[_0x4db9('0x28')]);if(_0x3f9f7e[_0x4db9('0x29')]){delete _0x3f9f7e[_0x4db9('0x29')];}_0x43b95e[_0x4db9('0x18')](_0x2d330e)[_0x4db9('0x2a')](_0x3f9f7e);};}exports[_0x4db9('0x2b')]=function(_0x2d646d,_0x20f133){var _0x583861={},_0x5031fe={},_0x3951b2={'count':0x0,'rows':[]};var _0x331279=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x459131){return{'name':_0x459131['fieldName'],'type':_0x459131[_0x4db9('0x2f')]['key']};});_0x5031fe[_0x4db9('0x30')]=_[_0x4db9('0x2c')](_0x331279,_0x4db9('0x29'));_0x5031fe[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x2d646d['query']);_0x5031fe['filters']=_[_0x4db9('0x33')](_0x5031fe['model'],_0x5031fe[_0x4db9('0x31')]);_0x583861[_0x4db9('0x34')]=_['intersection'](_0x5031fe[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x2d646d[_0x4db9('0x31')]['fields']));_0x583861[_0x4db9('0x34')]=_0x583861['attributes'][_0x4db9('0x36')]?_0x583861[_0x4db9('0x34')]:_0x5031fe[_0x4db9('0x30')];if(!_0x2d646d['query']['hasOwnProperty'](_0x4db9('0x37'))){_0x583861[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x1c')]);_0x583861[_0x4db9('0x19')]=qs[_0x4db9('0x19')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x19')]);}_0x583861['order']=qs[_0x4db9('0x38')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x38')]);_0x583861[_0x4db9('0x39')]=qs['filters'](_[_0x4db9('0x3a')](_0x2d646d[_0x4db9('0x31')],_0x5031fe[_0x4db9('0x3b')]),_0x331279);if(_0x2d646d['query'][_0x4db9('0x3c')]){_0x583861[_0x4db9('0x39')]=_[_0x4db9('0x3d')](_0x583861[_0x4db9('0x39')],{'$or':_['map'](_0x331279,function(_0x5a78b4){if(_0x5a78b4[_0x4db9('0x2f')]!==_0x4db9('0x3e')){var _0x32e62b={};_0x32e62b[_0x5a78b4[_0x4db9('0x29')]]={'$like':'%'+_0x2d646d[_0x4db9('0x31')]['filter']+'%'};return _0x32e62b;}})});}_0x583861=_[_0x4db9('0x3d')]({},_0x583861,_0x2d646d[_0x4db9('0x3f')]);var _0x23affc={'where':_0x583861[_0x4db9('0x39')]};return db[_0x4db9('0x2d')]['count'](_0x23affc)[_0x4db9('0x24')](function(_0x324765){_0x3951b2[_0x4db9('0x1b')]=_0x324765;if(_0x2d646d['query'][_0x4db9('0x40')]){_0x583861[_0x4db9('0x41')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x42')](_0x583861);})[_0x4db9('0x24')](function(_0x24aa2a){_0x3951b2[_0x4db9('0x43')]=_0x24aa2a;return _0x3951b2;})[_0x4db9('0x24')](respondWithFilteredResult(_0x20f133,_0x583861))[_0x4db9('0x44')](handleError(_0x20f133,null));};exports[_0x4db9('0x45')]=function(_0x4bb740,_0x56bd68){var _0x48aaf5={'raw':!![],'where':{'id':_0x4bb740[_0x4db9('0x46')]['id']}},_0x22a021={};_0x22a021['model']=_[_0x4db9('0x32')](db[_0x4db9('0x2d')]['rawAttributes']);_0x22a021['query']=_[_0x4db9('0x32')](_0x4bb740['query']);_0x22a021[_0x4db9('0x3b')]=_[_0x4db9('0x33')](_0x22a021['model'],_0x22a021[_0x4db9('0x31')]);_0x48aaf5[_0x4db9('0x34')]=_['intersection'](_0x22a021[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x4bb740[_0x4db9('0x31')]['fields']));_0x48aaf5['attributes']=_0x48aaf5[_0x4db9('0x34')][_0x4db9('0x36')]?_0x48aaf5[_0x4db9('0x34')]:_0x22a021[_0x4db9('0x30')];if(_0x4bb740[_0x4db9('0x31')][_0x4db9('0x40')]){_0x48aaf5[_0x4db9('0x41')]=[{'all':!![]}];}_0x48aaf5=_[_0x4db9('0x3d')]({},_0x48aaf5,_0x4bb740[_0x4db9('0x3f')]);return db[_0x4db9('0x2d')][_0x4db9('0x47')](_0x48aaf5)[_0x4db9('0x24')](handleEntityNotFound(_0x56bd68,null))[_0x4db9('0x24')](respondWithResult(_0x56bd68,null))['catch'](handleError(_0x56bd68,null));};exports[_0x4db9('0x48')]=function(_0x2faacf,_0x3852f0){return db[_0x4db9('0x2d')][_0x4db9('0x48')](_0x2faacf[_0x4db9('0x49')],{})[_0x4db9('0x24')](respondWithResult(_0x3852f0,0xc9))[_0x4db9('0x44')](handleError(_0x3852f0,null));};exports[_0x4db9('0x23')]=function(_0x2d6094,_0x10dccb){if(_0x2d6094['body']['id']){delete _0x2d6094['body']['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0x2d6094[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x10dccb,null))[_0x4db9('0x24')](saveUpdates(_0x2d6094[_0x4db9('0x49')],null))[_0x4db9('0x24')](respondWithResult(_0x10dccb,null))[_0x4db9('0x44')](handleError(_0x10dccb,null));};exports['destroy']=function(_0xd8eae3,_0xcb832e){return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0xd8eae3[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0xcb832e,null))[_0x4db9('0x24')](removeEntity(_0xcb832e,null))[_0x4db9('0x44')](handleError(_0xcb832e,null));};exports['describe']=function(_0x45bc79,_0xd6701a){return db[_0x4db9('0x2d')][_0x4db9('0x4a')]()[_0x4db9('0x24')](respondWithResult(_0xd6701a,null))[_0x4db9('0x44')](handleError(_0xd6701a,null));}; \ No newline at end of file +var _0x0972=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','catch','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4e823f,_0x4c0752){var _0x32c6ef=function(_0x5b9eac){while(--_0x5b9eac){_0x4e823f['push'](_0x4e823f['shift']());}};_0x32c6ef(++_0x4c0752);}(_0x0972,0x64));var _0x2097=function(_0x2b1ba6,_0x53fbf1){_0x2b1ba6=_0x2b1ba6-0x0;var _0xfb3f7d=_0x0972[_0x2b1ba6];return _0xfb3f7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)[_0x2097('0x1c')]();});}};}function handleEntityNotFound(_0x345875,_0x9f59bc){return function(_0x499988){if(!_0x499988){_0x345875[_0x2097('0x1a')](0x194);}return _0x499988;};}function handleError(_0x80c5ee,_0x56af3b){_0x56af3b=_0x56af3b||0x1f4;return function(_0x1229fc){logger['error'](_0x1229fc[_0x2097('0x28')]);if(_0x1229fc['name']){delete _0x1229fc[_0x2097('0x29')];}_0x80c5ee[_0x2097('0x1b')](_0x56af3b)[_0x2097('0x2a')](_0x1229fc);};}exports[_0x2097('0x2b')]=function(_0x410afa,_0x36228c){var _0x450e0b={},_0x4b443d={},_0x11242f={'count':0x0,'rows':[]};var _0x14d964=_['map'](db[_0x2097('0x2c')][_0x2097('0x2d')],function(_0x59fb84){return{'name':_0x59fb84['fieldName'],'type':_0x59fb84[_0x2097('0x2e')][_0x2097('0x2f')]};});_0x4b443d[_0x2097('0x30')]=_[_0x2097('0x31')](_0x14d964,_0x2097('0x29'));_0x4b443d[_0x2097('0x32')]=_['keys'](_0x410afa[_0x2097('0x32')]);_0x4b443d['filters']=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x30')],_0x4b443d[_0x2097('0x32')]);_0x450e0b[_0x2097('0x34')]=_[_0x2097('0x33')](_0x4b443d[_0x2097('0x30')],qs[_0x2097('0x35')](_0x410afa[_0x2097('0x32')][_0x2097('0x35')]));_0x450e0b['attributes']=_0x450e0b[_0x2097('0x34')][_0x2097('0x36')]?_0x450e0b[_0x2097('0x34')]:_0x4b443d['model'];if(!_0x410afa[_0x2097('0x32')][_0x2097('0x37')](_0x2097('0x38'))){_0x450e0b[_0x2097('0x1f')]=qs['limit'](_0x410afa['query']['limit']);_0x450e0b[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x410afa[_0x2097('0x32')][_0x2097('0x1e')]);}_0x450e0b[_0x2097('0x39')]=qs[_0x2097('0x3a')](_0x410afa['query'][_0x2097('0x3a')]);_0x450e0b[_0x2097('0x3b')]=qs[_0x2097('0x3c')](_[_0x2097('0x3d')](_0x410afa[_0x2097('0x32')],_0x4b443d[_0x2097('0x3c')]),_0x14d964);if(_0x410afa['query'][_0x2097('0x3e')]){_0x450e0b[_0x2097('0x3b')]=_[_0x2097('0x3f')](_0x450e0b['where'],{'$or':_['map'](_0x14d964,function(_0x57649e){if(_0x57649e[_0x2097('0x2e')]!==_0x2097('0x40')){var _0x85b01e={};_0x85b01e[_0x57649e[_0x2097('0x29')]]={'$like':'%'+_0x410afa[_0x2097('0x32')][_0x2097('0x3e')]+'%'};return _0x85b01e;}})});}_0x450e0b=_[_0x2097('0x3f')]({},_0x450e0b,_0x410afa[_0x2097('0x41')]);var _0x3bfb5c={'where':_0x450e0b[_0x2097('0x3b')]};return db[_0x2097('0x2c')]['count'](_0x3bfb5c)[_0x2097('0x26')](function(_0x2f5378){_0x11242f[_0x2097('0x21')]=_0x2f5378;if(_0x410afa['query'][_0x2097('0x42')]){_0x450e0b[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2c')][_0x2097('0x44')](_0x450e0b);})[_0x2097('0x26')](function(_0xd4d89e){_0x11242f[_0x2097('0x45')]=_0xd4d89e;return _0x11242f;})[_0x2097('0x26')](respondWithFilteredResult(_0x36228c,_0x450e0b))['catch'](handleError(_0x36228c,null));};exports[_0x2097('0x46')]=function(_0x283adc,_0x186ca5){var _0x3288ae={'raw':!![],'where':{'id':_0x283adc[_0x2097('0x47')]['id']}},_0x12e0e2={};_0x12e0e2[_0x2097('0x30')]=_[_0x2097('0x48')](db['WhatsappQueueReport'][_0x2097('0x2d')]);_0x12e0e2['query']=_[_0x2097('0x48')](_0x283adc[_0x2097('0x32')]);_0x12e0e2[_0x2097('0x3c')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x30')],_0x12e0e2['query']);_0x3288ae[_0x2097('0x34')]=_[_0x2097('0x33')](_0x12e0e2[_0x2097('0x30')],qs[_0x2097('0x35')](_0x283adc[_0x2097('0x32')]['fields']));_0x3288ae[_0x2097('0x34')]=_0x3288ae[_0x2097('0x34')][_0x2097('0x36')]?_0x3288ae[_0x2097('0x34')]:_0x12e0e2[_0x2097('0x30')];if(_0x283adc[_0x2097('0x32')][_0x2097('0x42')]){_0x3288ae[_0x2097('0x43')]=[{'all':!![]}];}_0x3288ae=_['merge']({},_0x3288ae,_0x283adc[_0x2097('0x41')]);return db[_0x2097('0x2c')][_0x2097('0x49')](_0x3288ae)[_0x2097('0x26')](handleEntityNotFound(_0x186ca5,null))['then'](respondWithResult(_0x186ca5,null))['catch'](handleError(_0x186ca5,null));};exports['create']=function(_0xdf0b6e,_0x396979){return db['WhatsappQueueReport'][_0x2097('0x4a')](_0xdf0b6e[_0x2097('0x4b')],{})['then'](respondWithResult(_0x396979,0xc9))['catch'](handleError(_0x396979,null));};exports[_0x2097('0x25')]=function(_0x21829d,_0x1b4de6){if(_0x21829d['body']['id']){delete _0x21829d[_0x2097('0x4b')]['id'];}return db[_0x2097('0x2c')]['find']({'where':{'id':_0x21829d[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x1b4de6,null))[_0x2097('0x26')](saveUpdates(_0x21829d[_0x2097('0x4b')],null))[_0x2097('0x26')](respondWithResult(_0x1b4de6,null))['catch'](handleError(_0x1b4de6,null));};exports['destroy']=function(_0x140b41,_0x39f9cb){return db[_0x2097('0x2c')]['find']({'where':{'id':_0x140b41['params']['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x39f9cb,null))[_0x2097('0x26')](removeEntity(_0x39f9cb,null))['catch'](handleError(_0x39f9cb,null));};exports[_0x2097('0x4c')]=function(_0x33583e,_0x12bdbd){return db[_0x2097('0x2c')][_0x2097('0x4c')]()['then'](respondWithResult(_0x12bdbd,null))[_0x2097('0x4d')](handleError(_0x12bdbd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3e6b249..c5f378f 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 _0xa857=['bluebird','request-promise','path','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','api'];(function(_0x4ecefd,_0x270199){var _0x5c5978=function(_0x1f0d0b){while(--_0x1f0d0b){_0x4ecefd['push'](_0x4ecefd['shift']());}};_0x5c5978(++_0x270199);}(_0xa857,0x18b));var _0x7a85=function(_0x428b0e,_0x359e12){_0x428b0e=_0x428b0e-0x0;var _0x245a6c=_0xa857[_0x428b0e];return _0x245a6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7a85('0x0'));var moment=require('moment');var BPromise=require(_0x7a85('0x1'));var rp=require(_0x7a85('0x2'));var fs=require('fs');var path=require(_0x7a85('0x3'));var rimraf=require('rimraf');var config=require(_0x7a85('0x4'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x1d97ef,_0x20e889){return _0x1d97ef[_0x7a85('0x5')](_0x7a85('0x6'),attributes,{'tableName':_0x7a85('0x7'),'paranoid':![],'indexes':[{'name':_0x7a85('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9454=['./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x977add,_0x1a2af){var _0x1c7959=function(_0x5ddef7){while(--_0x5ddef7){_0x977add['push'](_0x977add['shift']());}};_0x1c7959(++_0x1a2af);}(_0x9454,0x17b));var _0x4945=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x9454[_0xbc2974];return _0x3a5b4f;};'use strict';var _=require(_0x4945('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4945('0x1'));var moment=require(_0x4945('0x2'));var BPromise=require(_0x4945('0x3'));var rp=require(_0x4945('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4945('0x5'));var config=require('../../config/environment');var attributes=require(_0x4945('0x6'));module[_0x4945('0x7')]=function(_0x5d3502,_0x22dce0){return _0x5d3502[_0x4945('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x4945('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4945('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 480cb07..4126852 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 _0x7397=['WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','create','body','options','raw','debug','catch','UpdateWhatsappQueueReport','WhatsappQueueReport','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x384498,_0x266402){var _0x343599=function(_0x39a24d){while(--_0x39a24d){_0x384498['push'](_0x384498['shift']());}};_0x343599(++_0x266402);}(_0x7397,0x12e));var _0x7739=function(_0x4f1738,_0x28f452){_0x4f1738=_0x4f1738-0x0;var _0x1b36c2=_0x7397[_0x4f1738];return _0x1b36c2;};'use strict';var _=require(_0x7739('0x0'));var util=require(_0x7739('0x1'));var moment=require(_0x7739('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7739('0x3'));var db=require(_0x7739('0x4'))['db'];var utils=require(_0x7739('0x5'));var logger=require(_0x7739('0x6'))(_0x7739('0x7'));var config=require(_0x7739('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7739('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49b396,_0x10a731,_0x50c71f){return new BPromise(function(_0x3b99c6,_0x3adf36){return client[_0x7739('0xa')](_0x49b396,_0x50c71f)[_0x7739('0xb')](function(_0x2e3ca6){logger[_0x7739('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x10a731,_0x7739('0xd'));logger['debug'](_0x7739('0xe'),_0x10a731,_0x7739('0xd'),JSON[_0x7739('0xf')](_0x2e3ca6));if(_0x2e3ca6[_0x7739('0x10')]){if(_0x2e3ca6[_0x7739('0x10')][_0x7739('0x11')]===0x1f4){logger[_0x7739('0x10')](_0x7739('0x12'),_0x10a731,_0x2e3ca6[_0x7739('0x10')][_0x7739('0x13')]);return _0x3adf36(_0x2e3ca6[_0x7739('0x10')][_0x7739('0x13')]);}logger[_0x7739('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x10a731,_0x2e3ca6[_0x7739('0x10')]['message']);return _0x3b99c6(_0x2e3ca6[_0x7739('0x10')]['message']);}else{logger[_0x7739('0xc')](_0x7739('0x12'),_0x10a731,_0x7739('0xd'));_0x3b99c6(_0x2e3ca6[_0x7739('0x14')][_0x7739('0x13')]);}})['catch'](function(_0x355e2a){logger[_0x7739('0x10')](_0x7739('0x12'),_0x10a731,_0x355e2a);_0x3adf36(_0x355e2a);});});}exports[_0x7739('0x15')]=function(_0x3df7f9){var _0x415135=this;return new Promise(function(_0x5015df,_0x35d8ac){return db['WhatsappQueueReport'][_0x7739('0x16')](_0x3df7f9[_0x7739('0x17')],{'raw':_0x3df7f9[_0x7739('0x18')]?_0x3df7f9[_0x7739('0x18')][_0x7739('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5b77b9){logger[_0x7739('0xc')](_0x7739('0x15'),_0x3df7f9);logger[_0x7739('0x1a')](_0x7739('0x15'),_0x3df7f9,JSON['stringify'](_0x5b77b9));_0x5015df(_0x5b77b9);})[_0x7739('0x1b')](function(_0x2272c0){logger[_0x7739('0x10')](_0x7739('0x15'),_0x2272c0[_0x7739('0x13')],_0x3df7f9);_0x35d8ac(_0x415135[_0x7739('0x10')](0x1f4,_0x2272c0[_0x7739('0x13')]));});});};exports[_0x7739('0x1c')]=function(_0x2ad569){var _0x2f0150=this;return new Promise(function(_0xdd12b1,_0x43090b){return db[_0x7739('0x1d')]['update'](_0x2ad569['body'],{'raw':_0x2ad569[_0x7739('0x18')]?_0x2ad569[_0x7739('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad569['options']?_0x2ad569['options'][_0x7739('0x1e')]||null:null,'attributes':_0x2ad569[_0x7739('0x18')]?_0x2ad569[_0x7739('0x18')]['attributes']||null:null,'limit':_0x2ad569[_0x7739('0x18')]?_0x2ad569[_0x7739('0x18')][_0x7739('0x1f')]||null:null})[_0x7739('0xb')](function(_0x22e811){logger[_0x7739('0xc')](_0x7739('0x1c'),_0x2ad569);logger[_0x7739('0x1a')](_0x7739('0x1c'),_0x2ad569,JSON[_0x7739('0xf')](_0x22e811));_0xdd12b1(_0x22e811);})[_0x7739('0x1b')](function(_0x1ff486){logger[_0x7739('0x10')](_0x7739('0x1c'),_0x1ff486[_0x7739('0x13')],_0x2ad569);_0x43090b(_0x2f0150['error'](0x1f4,_0x1ff486[_0x7739('0x13')]));});});}; \ No newline at end of file +var _0x3452=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateWhatsappQueueReport','debug','update','where','attributes','limit','UpdateWhatsappQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f2fff,_0x5c1014){var _0x1e923b=function(_0x2f0fea){while(--_0x2f0fea){_0x5f2fff['push'](_0x5f2fff['shift']());}};_0x1e923b(++_0x5c1014);}(_0x3452,0xa0));var _0x2345=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3452[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x2345('0x0'));var moment=require('moment');var BPromise=require(_0x2345('0x1'));var rs=require(_0x2345('0x2'));var fs=require('fs');var Redis=require(_0x2345('0x3'));var db=require(_0x2345('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2345('0x5'))(_0x2345('0x6'));var config=require('../../config/environment');var jayson=require(_0x2345('0x7'));var client=jayson[_0x2345('0x8')][_0x2345('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3621d5,_0x3326f2,_0x562bbc){return new BPromise(function(_0x2a9c2a,_0x5a7cc3){return client[_0x2345('0xa')](_0x3621d5,_0x562bbc)[_0x2345('0xb')](function(_0x585f89){logger[_0x2345('0xc')](_0x2345('0xd'),_0x3326f2,_0x2345('0xe'));logger['debug'](_0x2345('0xf'),_0x3326f2,_0x2345('0xe'),JSON[_0x2345('0x10')](_0x585f89));if(_0x585f89[_0x2345('0x11')]){if(_0x585f89[_0x2345('0x11')][_0x2345('0x12')]===0x1f4){logger[_0x2345('0x11')](_0x2345('0xd'),_0x3326f2,_0x585f89[_0x2345('0x11')][_0x2345('0x13')]);return _0x5a7cc3(_0x585f89[_0x2345('0x11')][_0x2345('0x13')]);}logger[_0x2345('0x11')](_0x2345('0xd'),_0x3326f2,_0x585f89['error'][_0x2345('0x13')]);return _0x2a9c2a(_0x585f89['error'][_0x2345('0x13')]);}else{logger[_0x2345('0xc')](_0x2345('0xd'),_0x3326f2,_0x2345('0xe'));_0x2a9c2a(_0x585f89[_0x2345('0x14')][_0x2345('0x13')]);}})[_0x2345('0x15')](function(_0x260f1c){logger[_0x2345('0x11')](_0x2345('0xd'),_0x3326f2,_0x260f1c);_0x5a7cc3(_0x260f1c);});});}exports['CreateWhatsappQueueReport']=function(_0x2fa4d1){var _0x46be40=this;return new Promise(function(_0x55875e,_0x5301c3){return db['WhatsappQueueReport'][_0x2345('0x16')](_0x2fa4d1[_0x2345('0x17')],{'raw':_0x2fa4d1['options']?_0x2fa4d1[_0x2345('0x18')][_0x2345('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4ced64){logger[_0x2345('0xc')](_0x2345('0x1a'),_0x2fa4d1);logger[_0x2345('0x1b')](_0x2345('0x1a'),_0x2fa4d1,JSON['stringify'](_0x4ced64));_0x55875e(_0x4ced64);})[_0x2345('0x15')](function(_0xf6a8d0){logger[_0x2345('0x11')]('CreateWhatsappQueueReport',_0xf6a8d0['message'],_0x2fa4d1);_0x5301c3(_0x46be40[_0x2345('0x11')](0x1f4,_0xf6a8d0['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x1389da){var _0x53ff24=this;return new Promise(function(_0x1f17ef,_0x34fcb2){return db['WhatsappQueueReport'][_0x2345('0x1c')](_0x1389da[_0x2345('0x17')],{'raw':_0x1389da['options']?_0x1389da[_0x2345('0x18')][_0x2345('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1389da[_0x2345('0x18')]?_0x1389da[_0x2345('0x18')][_0x2345('0x1d')]||null:null,'attributes':_0x1389da[_0x2345('0x18')]?_0x1389da[_0x2345('0x18')][_0x2345('0x1e')]||null:null,'limit':_0x1389da[_0x2345('0x18')]?_0x1389da[_0x2345('0x18')][_0x2345('0x1f')]||null:null})[_0x2345('0xb')](function(_0x4986de){logger[_0x2345('0xc')](_0x2345('0x20'),_0x1389da);logger[_0x2345('0x1b')](_0x2345('0x20'),_0x1389da,JSON[_0x2345('0x10')](_0x4986de));_0x1f17ef(_0x4986de);})[_0x2345('0x15')](function(_0x468510){logger[_0x2345('0x11')](_0x2345('0x20'),_0x468510[_0x2345('0x13')],_0x1389da);_0x34fcb2(_0x53ff24[_0x2345('0x11')](0x1f4,_0x468510[_0x2345('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 89b3f51..43268b9 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 _0xc845=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x76f220,_0x3e6f86){var _0x296467=function(_0x4cf17e){while(--_0x4cf17e){_0x76f220['push'](_0x76f220['shift']());}};_0x296467(++_0x3e6f86);}(_0xc845,0xae));var _0x5c84=function(_0x3011ba,_0xb182e3){_0x3011ba=_0x3011ba-0x0;var _0x3c6e2d=_0xc845[_0x3011ba];return _0x3c6e2d;};'use strict';var multer=require(_0x5c84('0x0'));var util=require(_0x5c84('0x1'));var path=require(_0x5c84('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c84('0x3'));var router=express[_0x5c84('0x4')]();var fs_extra=require(_0x5c84('0x5'));var auth=require(_0x5c84('0x6'));var interaction=require(_0x5c84('0x7'));var config=require('../../config/environment');var controller=require(_0x5c84('0x8'));router[_0x5c84('0x9')]('/',auth[_0x5c84('0xa')](),controller[_0x5c84('0xb')]);router['get'](_0x5c84('0xc'),auth[_0x5c84('0xa')](),controller[_0x5c84('0xd')]);router[_0x5c84('0x9')](_0x5c84('0xe'),auth['isAuthenticated'](),controller[_0x5c84('0xf')]);router[_0x5c84('0x10')]('/',auth[_0x5c84('0xa')](),controller[_0x5c84('0x11')]);router[_0x5c84('0x12')](_0x5c84('0xe'),auth[_0x5c84('0xa')](),controller[_0x5c84('0x13')]);router['delete'](_0x5c84('0xe'),auth['isAuthenticated'](),controller[_0x5c84('0x14')]);module[_0x5c84('0x15')]=router; \ No newline at end of file +var _0xf66f=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x25a46b,_0x514330){var _0x192825=function(_0x219f06){while(--_0x219f06){_0x25a46b['push'](_0x25a46b['shift']());}};_0x192825(++_0x514330);}(_0xf66f,0x92));var _0xff66=function(_0x284c0c,_0x181aee){_0x284c0c=_0x284c0c-0x0;var _0x418b18=_0xf66f[_0x284c0c];return _0x418b18;};'use strict';var multer=require(_0xff66('0x0'));var util=require(_0xff66('0x1'));var path=require(_0xff66('0x2'));var timeout=require(_0xff66('0x3'));var express=require('express');var router=express[_0xff66('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff66('0x5'));var interaction=require(_0xff66('0x6'));var config=require(_0xff66('0x7'));var controller=require(_0xff66('0x8'));router['get']('/',auth[_0xff66('0x9')](),controller['index']);router['get'](_0xff66('0xa'),auth[_0xff66('0x9')](),controller[_0xff66('0xb')]);router['get'](_0xff66('0xc'),auth['isAuthenticated'](),controller[_0xff66('0xd')]);router[_0xff66('0xe')]('/',auth['isAuthenticated'](),controller[_0xff66('0xf')]);router['put'](_0xff66('0xc'),auth[_0xff66('0x9')](),controller[_0xff66('0x10')]);router[_0xff66('0x11')]('/:id',auth[_0xff66('0x9')](),controller['destroy']);module[_0xff66('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5ec665d..fcd4cf5 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 _0x0c8d=['agent','exports','STRING','ENUM','account'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x0c8d,0x79));var _0xd0c8=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x0c8d[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require('sequelize');module[_0xd0c8('0x0')]={'uniqueid':{'type':Sequelize[_0xd0c8('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd0c8('0x2')](_0xd0c8('0x3'),_0xd0c8('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4201=['DATE','sequelize','exports','ENUM','account','agent','queue'];(function(_0x292d9b,_0x407f84){var _0x14266f=function(_0x465c50){while(--_0x465c50){_0x292d9b['push'](_0x292d9b['shift']());}};_0x14266f(++_0x407f84);}(_0x4201,0x71));var _0x1420=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x4201[_0x1385dc];return _0x2f6469;};'use strict';var Sequelize=require(_0x1420('0x0'));module[_0x1420('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1420('0x2')](_0x1420('0x3'),_0x1420('0x4'),_0x1420('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1420('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6ca246f..51b1519 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 _0x5829=['catch','show','params','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows'];(function(_0x1507da,_0x7a9fae){var _0x520074=function(_0x3a7f89){while(--_0x3a7f89){_0x1507da['push'](_0x1507da['shift']());}};_0x520074(++_0x7a9fae);}(_0x5829,0xf4));var _0x9582=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5829[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x9582('0x0'));var rimraf=require(_0x9582('0x1'));var zipdir=require(_0x9582('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9582('0x3'));var moment=require('moment');var BPromise=require(_0x9582('0x4'));var Mustache=require('mustache');var util=require(_0x9582('0x5'));var path=require(_0x9582('0x6'));var sox=require(_0x9582('0x7'));var csv=require(_0x9582('0x8'));var ejs=require(_0x9582('0x9'));var fs=require('fs');var fs_extra=require(_0x9582('0xa'));var _=require(_0x9582('0xb'));var squel=require(_0x9582('0xc'));var crypto=require(_0x9582('0xd'));var jsforce=require(_0x9582('0xe'));var deskjs=require(_0x9582('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9582('0x10'));var Papa=require('papaparse');var Redis=require(_0x9582('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9582('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9582('0x13'))(_0x9582('0x14'));var utils=require(_0x9582('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9582('0x16'))['db'];function respondWithStatusCode(_0x373352,_0x1d3890){_0x1d3890=_0x1d3890||0xcc;return function(_0x4141f0){if(_0x4141f0){return _0x373352[_0x9582('0x17')](_0x1d3890);}return _0x373352[_0x9582('0x18')](_0x1d3890)[_0x9582('0x19')]();};}function respondWithResult(_0xec997c,_0x3b696a){_0x3b696a=_0x3b696a||0xc8;return function(_0x82e6b8){if(_0x82e6b8){return _0xec997c[_0x9582('0x18')](_0x3b696a)[_0x9582('0x1a')](_0x82e6b8);}};}function respondWithFilteredResult(_0x54b881,_0x1b568b){return function(_0x5ade93){if(_0x5ade93){var _0x2029eb=typeof _0x1b568b[_0x9582('0x1b')]===_0x9582('0x1c')&&typeof _0x1b568b[_0x9582('0x1d')]==='undefined';var _0x42f583=_0x5ade93[_0x9582('0x1e')];var _0x5bff08=_0x2029eb?0x0:_0x1b568b['offset'];var _0x3bb84d=_0x2029eb?_0x5ade93[_0x9582('0x1e')]:_0x1b568b[_0x9582('0x1b')]+_0x1b568b[_0x9582('0x1d')];var _0x53178b;if(_0x3bb84d>=_0x42f583){_0x3bb84d=_0x42f583;_0x53178b=0xc8;}else{_0x53178b=0xce;}_0x54b881[_0x9582('0x18')](_0x53178b);return _0x54b881[_0x9582('0x1f')](_0x9582('0x20'),_0x5bff08+'-'+_0x3bb84d+'/'+_0x42f583)[_0x9582('0x1a')](_0x5ade93);}return null;};}function patchUpdates(_0x7d50bc){return function(_0x521f7f){try{jsonpatch[_0x9582('0x21')](_0x521f7f,_0x7d50bc,!![]);}catch(_0x3587cc){return BPromise[_0x9582('0x22')](_0x3587cc);}return _0x521f7f[_0x9582('0x23')]();};}function saveUpdates(_0x3afe26,_0x4e249a){return function(_0x382908){if(_0x382908){return _0x382908[_0x9582('0x24')](_0x3afe26)[_0x9582('0x25')](function(_0x41af22){return _0x41af22;});}return null;};}function removeEntity(_0x33b3e5,_0x42f217){return function(_0x181d95){if(_0x181d95){return _0x181d95['destroy']()[_0x9582('0x25')](function(){_0x33b3e5[_0x9582('0x18')](0xcc)[_0x9582('0x19')]();});}};}function handleEntityNotFound(_0x3a3ada,_0x1ad277){return function(_0xe6484b){if(!_0xe6484b){_0x3a3ada[_0x9582('0x17')](0x194);}return _0xe6484b;};}function handleError(_0x2f2b8d,_0x271334){_0x271334=_0x271334||0x1f4;return function(_0x538e80){logger[_0x9582('0x26')](_0x538e80[_0x9582('0x27')]);if(_0x538e80[_0x9582('0x28')]){delete _0x538e80['name'];}_0x2f2b8d['status'](_0x271334)[_0x9582('0x29')](_0x538e80);};}exports[_0x9582('0x2a')]=function(_0x4d1710,_0x307325){var _0x588841={},_0x354eec={},_0x3d1c5a={'count':0x0,'rows':[]};var _0x8c5c40=_['map'](db[_0x9582('0x2b')][_0x9582('0x2c')],function(_0x4d2bc4){return{'name':_0x4d2bc4[_0x9582('0x2d')],'type':_0x4d2bc4[_0x9582('0x2e')][_0x9582('0x2f')]};});_0x354eec['model']=_[_0x9582('0x30')](_0x8c5c40,_0x9582('0x28'));_0x354eec['query']=_[_0x9582('0x31')](_0x4d1710['query']);_0x354eec[_0x9582('0x32')]=_[_0x9582('0x33')](_0x354eec[_0x9582('0x34')],_0x354eec['query']);_0x588841[_0x9582('0x35')]=_[_0x9582('0x33')](_0x354eec[_0x9582('0x34')],qs[_0x9582('0x36')](_0x4d1710['query'][_0x9582('0x36')]));_0x588841['attributes']=_0x588841[_0x9582('0x35')][_0x9582('0x37')]?_0x588841[_0x9582('0x35')]:_0x354eec[_0x9582('0x34')];if(!_0x4d1710[_0x9582('0x38')][_0x9582('0x39')](_0x9582('0x3a'))){_0x588841[_0x9582('0x1d')]=qs[_0x9582('0x1d')](_0x4d1710[_0x9582('0x38')][_0x9582('0x1d')]);_0x588841['offset']=qs[_0x9582('0x1b')](_0x4d1710[_0x9582('0x38')][_0x9582('0x1b')]);}_0x588841['order']=qs[_0x9582('0x3b')](_0x4d1710['query'][_0x9582('0x3b')]);_0x588841[_0x9582('0x3c')]=qs[_0x9582('0x32')](_[_0x9582('0x3d')](_0x4d1710[_0x9582('0x38')],_0x354eec[_0x9582('0x32')]),_0x8c5c40);if(_0x4d1710['query'][_0x9582('0x3e')]){_0x588841[_0x9582('0x3c')]=_[_0x9582('0x3f')](_0x588841[_0x9582('0x3c')],{'$or':_[_0x9582('0x30')](_0x8c5c40,function(_0x25aaaf){if(_0x25aaaf[_0x9582('0x2e')]!==_0x9582('0x40')){var _0x4d4260={};_0x4d4260[_0x25aaaf[_0x9582('0x28')]]={'$like':'%'+_0x4d1710[_0x9582('0x38')][_0x9582('0x3e')]+'%'};return _0x4d4260;}})});}_0x588841=_[_0x9582('0x3f')]({},_0x588841,_0x4d1710['options']);var _0x4deb62={'where':_0x588841[_0x9582('0x3c')]};return db[_0x9582('0x2b')][_0x9582('0x1e')](_0x4deb62)['then'](function(_0x6044ed){_0x3d1c5a[_0x9582('0x1e')]=_0x6044ed;if(_0x4d1710[_0x9582('0x38')]['includeAll']){_0x588841[_0x9582('0x41')]=[{'all':!![]}];}return db[_0x9582('0x2b')][_0x9582('0x42')](_0x588841);})[_0x9582('0x25')](function(_0x1bfc4b){_0x3d1c5a[_0x9582('0x43')]=_0x1bfc4b;return _0x3d1c5a;})['then'](respondWithFilteredResult(_0x307325,_0x588841))[_0x9582('0x44')](handleError(_0x307325,null));};exports[_0x9582('0x45')]=function(_0x2c3899,_0x46a6f4){var _0x4d8937={'raw':!![],'where':{'id':_0x2c3899[_0x9582('0x46')]['id']}},_0x33c8df={};_0x33c8df[_0x9582('0x34')]=_[_0x9582('0x31')](db[_0x9582('0x2b')][_0x9582('0x2c')]);_0x33c8df[_0x9582('0x38')]=_[_0x9582('0x31')](_0x2c3899['query']);_0x33c8df['filters']=_[_0x9582('0x33')](_0x33c8df[_0x9582('0x34')],_0x33c8df[_0x9582('0x38')]);_0x4d8937[_0x9582('0x35')]=_[_0x9582('0x33')](_0x33c8df[_0x9582('0x34')],qs[_0x9582('0x36')](_0x2c3899[_0x9582('0x38')]['fields']));_0x4d8937[_0x9582('0x35')]=_0x4d8937[_0x9582('0x35')][_0x9582('0x37')]?_0x4d8937['attributes']:_0x33c8df[_0x9582('0x34')];if(_0x2c3899[_0x9582('0x38')][_0x9582('0x47')]){_0x4d8937['include']=[{'all':!![]}];}_0x4d8937=_[_0x9582('0x3f')]({},_0x4d8937,_0x2c3899[_0x9582('0x48')]);return db[_0x9582('0x2b')][_0x9582('0x49')](_0x4d8937)[_0x9582('0x25')](handleEntityNotFound(_0x46a6f4,null))[_0x9582('0x25')](respondWithResult(_0x46a6f4,null))[_0x9582('0x44')](handleError(_0x46a6f4,null));};exports[_0x9582('0x4a')]=function(_0x4f5a10,_0xf78b34){return db[_0x9582('0x2b')]['create'](_0x4f5a10[_0x9582('0x4b')],{})[_0x9582('0x25')](respondWithResult(_0xf78b34,0xc9))[_0x9582('0x44')](handleError(_0xf78b34,null));};exports[_0x9582('0x24')]=function(_0x27de32,_0x363b6e){if(_0x27de32[_0x9582('0x4b')]['id']){delete _0x27de32[_0x9582('0x4b')]['id'];}return db[_0x9582('0x2b')][_0x9582('0x49')]({'where':{'id':_0x27de32[_0x9582('0x46')]['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x363b6e,null))[_0x9582('0x25')](saveUpdates(_0x27de32['body'],null))[_0x9582('0x25')](respondWithResult(_0x363b6e,null))[_0x9582('0x44')](handleError(_0x363b6e,null));};exports[_0x9582('0x4c')]=function(_0x8a7a0f,_0x3d2653){return db[_0x9582('0x2b')][_0x9582('0x49')]({'where':{'id':_0x8a7a0f[_0x9582('0x46')]['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x3d2653,null))[_0x9582('0x25')](removeEntity(_0x3d2653,null))['catch'](handleError(_0x3d2653,null));};exports['describe']=function(_0x1ed5c1,_0x31db11){return db[_0x9582('0x2b')][_0x9582('0x4d')]()[_0x9582('0x25')](respondWithResult(_0x31db11,null))[_0x9582('0x44')](handleError(_0x31db11,null));}; \ No newline at end of file +var _0xaf2a=['filter','VIRTUAL','merge','options','includeAll','include','rows','params','find','catch','create','body','describe','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3913cd,_0xb52e21){var _0x161b61=function(_0x4c8fc0){while(--_0x4c8fc0){_0x3913cd['push'](_0x3913cd['shift']());}};_0x161b61(++_0xb52e21);}(_0xaf2a,0xe2));var _0xaaf2=function(_0x2b8cb8,_0x33fe47){_0x2b8cb8=_0x2b8cb8-0x0;var _0x2b398d=_0xaf2a[_0x2b8cb8];return _0x2b398d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaf2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaaf2('0x1'));var moment=require(_0xaaf2('0x2'));var BPromise=require(_0xaaf2('0x3'));var Mustache=require('mustache');var util=require(_0xaaf2('0x4'));var path=require('path');var sox=require(_0xaaf2('0x5'));var csv=require(_0xaaf2('0x6'));var ejs=require(_0xaaf2('0x7'));var fs=require('fs');var fs_extra=require(_0xaaf2('0x8'));var _=require(_0xaaf2('0x9'));var squel=require(_0xaaf2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaaf2('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaaf2('0xc'));var Papa=require(_0xaaf2('0xd'));var Redis=require('ioredis');var authService=require(_0xaaf2('0xe'));var qs=require(_0xaaf2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaf2('0x10'));var logger=require(_0xaaf2('0x11'))(_0xaaf2('0x12'));var utils=require('../../config/utils');var config=require(_0xaaf2('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fbebf,_0x4c01c3){_0x4c01c3=_0x4c01c3||0xcc;return function(_0x2b4622){if(_0x2b4622){return _0x1fbebf['sendStatus'](_0x4c01c3);}return _0x1fbebf[_0xaaf2('0x14')](_0x4c01c3)[_0xaaf2('0x15')]();};}function respondWithResult(_0x5cbd03,_0x3aa757){_0x3aa757=_0x3aa757||0xc8;return function(_0x52a2f3){if(_0x52a2f3){return _0x5cbd03[_0xaaf2('0x14')](_0x3aa757)['json'](_0x52a2f3);}};}function respondWithFilteredResult(_0x177b0a,_0x353bc1){return function(_0x34c528){if(_0x34c528){var _0x5c6655=typeof _0x353bc1[_0xaaf2('0x16')]==='undefined'&&typeof _0x353bc1[_0xaaf2('0x17')]==='undefined';var _0x559c6f=_0x34c528[_0xaaf2('0x18')];var _0x783834=_0x5c6655?0x0:_0x353bc1[_0xaaf2('0x16')];var _0x5dc637=_0x5c6655?_0x34c528[_0xaaf2('0x18')]:_0x353bc1['offset']+_0x353bc1[_0xaaf2('0x17')];var _0x14489c;if(_0x5dc637>=_0x559c6f){_0x5dc637=_0x559c6f;_0x14489c=0xc8;}else{_0x14489c=0xce;}_0x177b0a[_0xaaf2('0x14')](_0x14489c);return _0x177b0a[_0xaaf2('0x19')](_0xaaf2('0x1a'),_0x783834+'-'+_0x5dc637+'/'+_0x559c6f)[_0xaaf2('0x1b')](_0x34c528);}return null;};}function patchUpdates(_0x17fdfb){return function(_0xe7974c){try{jsonpatch['apply'](_0xe7974c,_0x17fdfb,!![]);}catch(_0x2e6c08){return BPromise[_0xaaf2('0x1c')](_0x2e6c08);}return _0xe7974c[_0xaaf2('0x1d')]();};}function saveUpdates(_0xf696cf,_0x10bc8d){return function(_0x62707b){if(_0x62707b){return _0x62707b[_0xaaf2('0x1e')](_0xf696cf)[_0xaaf2('0x1f')](function(_0x394dae){return _0x394dae;});}return null;};}function removeEntity(_0x421877,_0x58ff2a){return function(_0x39acbc){if(_0x39acbc){return _0x39acbc['destroy']()['then'](function(){_0x421877['status'](0xcc)[_0xaaf2('0x15')]();});}};}function handleEntityNotFound(_0x2971e9,_0x3aa913){return function(_0x53dc59){if(!_0x53dc59){_0x2971e9[_0xaaf2('0x20')](0x194);}return _0x53dc59;};}function handleError(_0x4cb981,_0x1fbd4a){_0x1fbd4a=_0x1fbd4a||0x1f4;return function(_0xca53df){logger[_0xaaf2('0x21')](_0xca53df[_0xaaf2('0x22')]);if(_0xca53df[_0xaaf2('0x23')]){delete _0xca53df[_0xaaf2('0x23')];}_0x4cb981[_0xaaf2('0x14')](_0x1fbd4a)[_0xaaf2('0x24')](_0xca53df);};}exports[_0xaaf2('0x25')]=function(_0x2660de,_0x5b35d8){var _0x44fa72={},_0x2b01ba={},_0x34f6f1={'count':0x0,'rows':[]};var _0x1644c8=_[_0xaaf2('0x26')](db[_0xaaf2('0x27')][_0xaaf2('0x28')],function(_0x488bf2){return{'name':_0x488bf2[_0xaaf2('0x29')],'type':_0x488bf2[_0xaaf2('0x2a')][_0xaaf2('0x2b')]};});_0x2b01ba[_0xaaf2('0x2c')]=_[_0xaaf2('0x26')](_0x1644c8,_0xaaf2('0x23'));_0x2b01ba[_0xaaf2('0x2d')]=_[_0xaaf2('0x2e')](_0x2660de[_0xaaf2('0x2d')]);_0x2b01ba[_0xaaf2('0x2f')]=_[_0xaaf2('0x30')](_0x2b01ba['model'],_0x2b01ba[_0xaaf2('0x2d')]);_0x44fa72[_0xaaf2('0x31')]=_[_0xaaf2('0x30')](_0x2b01ba['model'],qs[_0xaaf2('0x32')](_0x2660de['query'][_0xaaf2('0x32')]));_0x44fa72[_0xaaf2('0x31')]=_0x44fa72[_0xaaf2('0x31')][_0xaaf2('0x33')]?_0x44fa72[_0xaaf2('0x31')]:_0x2b01ba[_0xaaf2('0x2c')];if(!_0x2660de[_0xaaf2('0x2d')][_0xaaf2('0x34')](_0xaaf2('0x35'))){_0x44fa72[_0xaaf2('0x17')]=qs[_0xaaf2('0x17')](_0x2660de['query']['limit']);_0x44fa72['offset']=qs[_0xaaf2('0x16')](_0x2660de[_0xaaf2('0x2d')][_0xaaf2('0x16')]);}_0x44fa72[_0xaaf2('0x36')]=qs[_0xaaf2('0x37')](_0x2660de[_0xaaf2('0x2d')][_0xaaf2('0x37')]);_0x44fa72[_0xaaf2('0x38')]=qs[_0xaaf2('0x2f')](_[_0xaaf2('0x39')](_0x2660de['query'],_0x2b01ba[_0xaaf2('0x2f')]),_0x1644c8);if(_0x2660de[_0xaaf2('0x2d')][_0xaaf2('0x3a')]){_0x44fa72['where']=_['merge'](_0x44fa72[_0xaaf2('0x38')],{'$or':_[_0xaaf2('0x26')](_0x1644c8,function(_0x1dd8a3){if(_0x1dd8a3[_0xaaf2('0x2a')]!==_0xaaf2('0x3b')){var _0x515d2d={};_0x515d2d[_0x1dd8a3[_0xaaf2('0x23')]]={'$like':'%'+_0x2660de['query']['filter']+'%'};return _0x515d2d;}})});}_0x44fa72=_[_0xaaf2('0x3c')]({},_0x44fa72,_0x2660de[_0xaaf2('0x3d')]);var _0x112378={'where':_0x44fa72[_0xaaf2('0x38')]};return db[_0xaaf2('0x27')][_0xaaf2('0x18')](_0x112378)[_0xaaf2('0x1f')](function(_0x16c068){_0x34f6f1['count']=_0x16c068;if(_0x2660de['query'][_0xaaf2('0x3e')]){_0x44fa72[_0xaaf2('0x3f')]=[{'all':!![]}];}return db[_0xaaf2('0x27')]['findAll'](_0x44fa72);})['then'](function(_0x2d06bf){_0x34f6f1[_0xaaf2('0x40')]=_0x2d06bf;return _0x34f6f1;})['then'](respondWithFilteredResult(_0x5b35d8,_0x44fa72))['catch'](handleError(_0x5b35d8,null));};exports['show']=function(_0x725322,_0x16f23d){var _0x5662c2={'raw':!![],'where':{'id':_0x725322[_0xaaf2('0x41')]['id']}},_0x2db07f={};_0x2db07f[_0xaaf2('0x2c')]=_[_0xaaf2('0x2e')](db[_0xaaf2('0x27')][_0xaaf2('0x28')]);_0x2db07f[_0xaaf2('0x2d')]=_[_0xaaf2('0x2e')](_0x725322['query']);_0x2db07f[_0xaaf2('0x2f')]=_[_0xaaf2('0x30')](_0x2db07f['model'],_0x2db07f[_0xaaf2('0x2d')]);_0x5662c2['attributes']=_['intersection'](_0x2db07f[_0xaaf2('0x2c')],qs['fields'](_0x725322[_0xaaf2('0x2d')][_0xaaf2('0x32')]));_0x5662c2[_0xaaf2('0x31')]=_0x5662c2['attributes'][_0xaaf2('0x33')]?_0x5662c2[_0xaaf2('0x31')]:_0x2db07f[_0xaaf2('0x2c')];if(_0x725322[_0xaaf2('0x2d')][_0xaaf2('0x3e')]){_0x5662c2[_0xaaf2('0x3f')]=[{'all':!![]}];}_0x5662c2=_['merge']({},_0x5662c2,_0x725322['options']);return db[_0xaaf2('0x27')][_0xaaf2('0x42')](_0x5662c2)[_0xaaf2('0x1f')](handleEntityNotFound(_0x16f23d,null))['then'](respondWithResult(_0x16f23d,null))[_0xaaf2('0x43')](handleError(_0x16f23d,null));};exports[_0xaaf2('0x44')]=function(_0x2666c0,_0x156f78){return db[_0xaaf2('0x27')][_0xaaf2('0x44')](_0x2666c0[_0xaaf2('0x45')],{})[_0xaaf2('0x1f')](respondWithResult(_0x156f78,0xc9))['catch'](handleError(_0x156f78,null));};exports['update']=function(_0x2da008,_0x11834b){if(_0x2da008[_0xaaf2('0x45')]['id']){delete _0x2da008[_0xaaf2('0x45')]['id'];}return db[_0xaaf2('0x27')][_0xaaf2('0x42')]({'where':{'id':_0x2da008[_0xaaf2('0x41')]['id']}})[_0xaaf2('0x1f')](handleEntityNotFound(_0x11834b,null))[_0xaaf2('0x1f')](saveUpdates(_0x2da008['body'],null))[_0xaaf2('0x1f')](respondWithResult(_0x11834b,null))[_0xaaf2('0x43')](handleError(_0x11834b,null));};exports['destroy']=function(_0x22f70e,_0x3f87e2){return db[_0xaaf2('0x27')][_0xaaf2('0x42')]({'where':{'id':_0x22f70e[_0xaaf2('0x41')]['id']}})[_0xaaf2('0x1f')](handleEntityNotFound(_0x3f87e2,null))[_0xaaf2('0x1f')](removeEntity(_0x3f87e2,null))['catch'](handleError(_0x3f87e2,null));};exports[_0xaaf2('0x46')]=function(_0x44309f,_0x1f2a7d){return db[_0xaaf2('0x27')][_0xaaf2('0x46')]()[_0xaaf2('0x1f')](respondWithResult(_0x1f2a7d,null))['catch'](handleError(_0x1f2a7d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5d4ab2f..26cdb85 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 _0x8139=['./whatsappTransferReport.attributes','WhatsappTransferReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x134299,_0x42bd37){var _0xfc4c8c=function(_0xf76372){while(--_0xf76372){_0x134299['push'](_0x134299['shift']());}};_0xfc4c8c(++_0x42bd37);}(_0x8139,0x1bb));var _0x9813=function(_0x4312cc,_0xc893b6){_0x4312cc=_0x4312cc-0x0;var _0x222282=_0x8139[_0x4312cc];return _0x222282;};'use strict';var _=require('lodash');var util=require(_0x9813('0x0'));var logger=require(_0x9813('0x1'))('api');var moment=require(_0x9813('0x2'));var BPromise=require(_0x9813('0x3'));var rp=require(_0x9813('0x4'));var fs=require('fs');var path=require(_0x9813('0x5'));var rimraf=require('rimraf');var config=require(_0x9813('0x6'));var attributes=require(_0x9813('0x7'));module['exports']=function(_0x491067,_0x12cd7f){return _0x491067['define'](_0x9813('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9813('0x9'),'fields':[_0x9813('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d9=['WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x3b6a20,_0x201a51){var _0x4f5b05=function(_0x2c65a6){while(--_0x2c65a6){_0x3b6a20['push'](_0x3b6a20['shift']());}};_0x4f5b05(++_0x201a51);}(_0xa6d9,0xd3));var _0x9a6d=function(_0x2b37b5,_0x4f677b){_0x2b37b5=_0x2b37b5-0x0;var _0x36df6d=_0xa6d9[_0x2b37b5];return _0x36df6d;};'use strict';var _=require(_0x9a6d('0x0'));var util=require(_0x9a6d('0x1'));var logger=require(_0x9a6d('0x2'))(_0x9a6d('0x3'));var moment=require(_0x9a6d('0x4'));var BPromise=require(_0x9a6d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a6d('0x6'));var rimraf=require(_0x9a6d('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a6d('0x8'));module['exports']=function(_0x58220e,_0x3b7b31){return _0x58220e['define'](_0x9a6d('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9a6d('0xa'),'fields':[_0x9a6d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 796db13..5b43015 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 _0x4ab6=['jayson/promise','client','http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1ae661,_0x3a7e42){var _0x11edfb=function(_0xe8870f){while(--_0xe8870f){_0x1ae661['push'](_0x1ae661['shift']());}};_0x11edfb(++_0x3a7e42);}(_0x4ab6,0x19f));var _0x64ab=function(_0x584b3f,_0x3b21a5){_0x584b3f=_0x584b3f-0x0;var _0x359088=_0x4ab6[_0x584b3f];return _0x359088;};'use strict';var _=require('lodash');var util=require(_0x64ab('0x0'));var moment=require(_0x64ab('0x1'));var BPromise=require(_0x64ab('0x2'));var rs=require(_0x64ab('0x3'));var fs=require('fs');var Redis=require(_0x64ab('0x4'));var db=require(_0x64ab('0x5'))['db'];var utils=require(_0x64ab('0x6'));var logger=require(_0x64ab('0x7'))(_0x64ab('0x8'));var config=require(_0x64ab('0x9'));var jayson=require(_0x64ab('0xa'));var client=jayson[_0x64ab('0xb')][_0x64ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18eb22,_0x27a53b,_0x41738c){return new BPromise(function(_0x5cb2e5,_0x44e8a8){return client[_0x64ab('0xd')](_0x18eb22,_0x41738c)[_0x64ab('0xe')](function(_0x2aabeb){logger[_0x64ab('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x27a53b,'request\x20sent');logger[_0x64ab('0x10')](_0x64ab('0x11'),_0x27a53b,_0x64ab('0x12'),JSON[_0x64ab('0x13')](_0x2aabeb));if(_0x2aabeb[_0x64ab('0x14')]){if(_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x15')]===0x1f4){logger[_0x64ab('0x14')](_0x64ab('0x16'),_0x27a53b,_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x17')]);return _0x44e8a8(_0x2aabeb['error'][_0x64ab('0x17')]);}logger['error'](_0x64ab('0x16'),_0x27a53b,_0x2aabeb['error']['message']);return _0x5cb2e5(_0x2aabeb['error'][_0x64ab('0x17')]);}else{logger['info'](_0x64ab('0x16'),_0x27a53b,_0x64ab('0x12'));_0x5cb2e5(_0x2aabeb[_0x64ab('0x18')][_0x64ab('0x17')]);}})['catch'](function(_0x12cb1e){logger[_0x64ab('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x27a53b,_0x12cb1e);_0x44e8a8(_0x12cb1e);});});} \ No newline at end of file +var _0xec91=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x26c718,_0x6897cf){var _0x2c0cb9=function(_0x310618){while(--_0x310618){_0x26c718['push'](_0x26c718['shift']());}};_0x2c0cb9(++_0x6897cf);}(_0xec91,0x140));var _0x1ec9=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0xec91[_0x39fd11];return _0x302799;};'use strict';var _=require(_0x1ec9('0x0'));var util=require(_0x1ec9('0x1'));var moment=require(_0x1ec9('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ec9('0x3'));var fs=require('fs');var Redis=require(_0x1ec9('0x4'));var db=require(_0x1ec9('0x5'))['db'];var utils=require(_0x1ec9('0x6'));var logger=require('../../config/logger')(_0x1ec9('0x7'));var config=require(_0x1ec9('0x8'));var jayson=require(_0x1ec9('0x9'));var client=jayson[_0x1ec9('0xa')][_0x1ec9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d900c,_0x500b20,_0x5cd150){return new BPromise(function(_0x284e86,_0xf6254c){return client[_0x1ec9('0xc')](_0x5d900c,_0x5cd150)['then'](function(_0x246df3){logger[_0x1ec9('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x500b20,_0x1ec9('0xe'));logger[_0x1ec9('0xf')](_0x1ec9('0x10'),_0x500b20,'request\x20sent',JSON[_0x1ec9('0x11')](_0x246df3));if(_0x246df3['error']){if(_0x246df3[_0x1ec9('0x12')][_0x1ec9('0x13')]===0x1f4){logger[_0x1ec9('0x12')](_0x1ec9('0x14'),_0x500b20,_0x246df3['error'][_0x1ec9('0x15')]);return _0xf6254c(_0x246df3['error']['message']);}logger[_0x1ec9('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x500b20,_0x246df3['error'][_0x1ec9('0x15')]);return _0x284e86(_0x246df3[_0x1ec9('0x12')][_0x1ec9('0x15')]);}else{logger['info'](_0x1ec9('0x14'),_0x500b20,_0x1ec9('0xe'));_0x284e86(_0x246df3[_0x1ec9('0x16')][_0x1ec9('0x15')]);}})[_0x1ec9('0x17')](function(_0x50a4c6){logger[_0x1ec9('0x12')](_0x1ec9('0x14'),_0x500b20,_0x50a4c6);_0xf6254c(_0x50a4c6);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3bd8676..0ee2274 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1af3=['log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None'];(function(_0x4cc9c8,_0x26276f){var _0x3d3439=function(_0x100d5b){while(--_0x100d5b){_0x4cc9c8['push'](_0x4cc9c8['shift']());}};_0x3d3439(++_0x26276f);}(_0x1af3,0x1ca));var _0x31af=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x1af3[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x31af('0x0'));var db=require(_0x31af('0x1'))['db'];var seedDb=require(_0x31af('0x2'));var checkLicense=require(_0x31af('0x3'));var rpc=require(_0x31af('0x4'));var config=require(_0x31af('0x5'));var logger=require(_0x31af('0x6'))(_0x31af('0x7'));var pm2=require(_0x31af('0x8'));var pm2Config=require(_0x31af('0x9'));var schedule=require('./config/schedule');var chat=require(_0x31af('0xa'));var whatsapp=require(_0x31af('0xb'));var transcribe=require(_0x31af('0xc'));var provider=require(_0x31af('0xd'));function main(){return db['sequelize'][_0x31af('0xe')]()[_0x31af('0xf')](function(){if(config[_0x31af('0x10')]){return seedDb['default']();}})[_0x31af('0xf')](function(){return checkLicense[_0x31af('0x11')]();})[_0x31af('0xf')](function(){return rpc[_0x31af('0x12')]();})[_0x31af('0xf')](function(_0x26c99f){logger[_0x31af('0x13')](_0x26c99f);return chat[_0x31af('0x14')]();})['then'](function(){return whatsapp[_0x31af('0x14')]();})[_0x31af('0xf')](function(){return schedule[_0x31af('0x14')]();})[_0x31af('0xf')](function(){return transcribe[_0x31af('0x14')]();})['then'](function(){return provider[_0x31af('0x14')]();})[_0x31af('0xf')](function(_0x5c18b4){logger['info'](_0x5c18b4);return pm2[_0x31af('0x14')](pm2Config);})[_0x31af('0xf')](function(_0x14c57e){var _0x10b9c6=_0x14c57e[_0x31af('0x15')](function(_0x1d35fa){return typeof _0x1d35fa[_0x31af('0x16')]===_0x31af('0x17')&&_0x1d35fa[_0x31af('0x16')]>=0x0;});if(_0x10b9c6[_0x31af('0x18')]>0x0){throw new Error(_0x10b9c6[_0x31af('0x18')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x31af('0x19')](_0x10b9c6,function(_0xd33b3f){return'\x22'+_0xd33b3f[_0x31af('0x1a')][_0x31af('0x1b')]+'\x22';}));}logger[_0x31af('0x13')](_0x31af('0x1c'),_[_0x31af('0x19')](_[_0x31af('0x15')](_0x14c57e,{'status':_0x31af('0x1d')}),'name')[_0x31af('0x1e')]());logger[_0x31af('0x13')](_0x31af('0x1f'),_[_0x31af('0x19')](_[_0x31af('0x15')](_0x14c57e,function(_0x5d96ca){return _0x5d96ca[_0x31af('0x20')]!==_0x31af('0x1d');}),_0x31af('0x1b'))[_0x31af('0x1e')]()||_0x31af('0x21'));console[_0x31af('0x22')](_0x31af('0x23'));})[_0x31af('0x24')](function(_0x3f673f){console[_0x31af('0x22')](_0x31af('0x25'),_0x3f673f);logger[_0x31af('0x26')](_0x31af('0x27'),_0x3f673f);process[_0x31af('0x28')](0x1);});}main(); \ No newline at end of file +var _0xa992=['lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','exitCode','number','map','name','Online\x20apps:','online','join','Offline\x20apps:','filter','status','None','log','App\x20Ready!','catch','exit'];(function(_0x2ab3fb,_0x187e50){var _0x177fe6=function(_0x15bece){while(--_0x15bece){_0x2ab3fb['push'](_0x2ab3fb['shift']());}};_0x177fe6(++_0x187e50);}(_0xa992,0x18c));var _0x2a99=function(_0x3c138e,_0x29e1b4){_0x3c138e=_0x3c138e-0x0;var _0x1b0e43=_0xa992[_0x3c138e];return _0x1b0e43;};'use strict';var _=require(_0x2a99('0x0'));var db=require(_0x2a99('0x1'))['db'];var seedDb=require(_0x2a99('0x2'));var checkLicense=require(_0x2a99('0x3'));var rpc=require('./rpc');var config=require(_0x2a99('0x4'));var logger=require(_0x2a99('0x5'))(_0x2a99('0x6'));var pm2=require(_0x2a99('0x7'));var pm2Config=require(_0x2a99('0x8'));var schedule=require(_0x2a99('0x9'));var chat=require(_0x2a99('0xa'));var whatsapp=require(_0x2a99('0xb'));var transcribe=require(_0x2a99('0xc'));var provider=require(_0x2a99('0xd'));function main(){return db['sequelize'][_0x2a99('0xe')]()[_0x2a99('0xf')](function(){if(config[_0x2a99('0x10')]){return seedDb[_0x2a99('0x11')]();}})[_0x2a99('0xf')](function(){return checkLicense[_0x2a99('0x11')]();})[_0x2a99('0xf')](function(){return rpc[_0x2a99('0x12')]();})[_0x2a99('0xf')](function(_0x1e30f4){logger[_0x2a99('0x13')](_0x1e30f4);return chat['start']();})['then'](function(){return whatsapp[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return schedule[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return transcribe[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return provider['start']();})[_0x2a99('0xf')](function(_0x1f0e4c){logger[_0x2a99('0x13')](_0x1f0e4c);return pm2[_0x2a99('0x14')](pm2Config);})[_0x2a99('0xf')](function(_0x5f2cfa){var _0x2ad1c9=_0x5f2cfa['filter'](function(_0x5cbe7b){return typeof _0x5cbe7b[_0x2a99('0x15')]===_0x2a99('0x16')&&_0x5cbe7b[_0x2a99('0x15')]>=0x0;});if(_0x2ad1c9['length']>0x0){throw new Error(_0x2ad1c9['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x2a99('0x17')](_0x2ad1c9,function(_0x4346c4){return'\x22'+_0x4346c4['pm2_env'][_0x2a99('0x18')]+'\x22';}));}logger[_0x2a99('0x13')](_0x2a99('0x19'),_[_0x2a99('0x17')](_['filter'](_0x5f2cfa,{'status':_0x2a99('0x1a')}),_0x2a99('0x18'))[_0x2a99('0x1b')]());logger[_0x2a99('0x13')](_0x2a99('0x1c'),_['map'](_[_0x2a99('0x1d')](_0x5f2cfa,function(_0x281efc){return _0x281efc[_0x2a99('0x1e')]!==_0x2a99('0x1a');}),_0x2a99('0x18'))[_0x2a99('0x1b')]()||_0x2a99('0x1f'));console[_0x2a99('0x20')](_0x2a99('0x21'));})[_0x2a99('0x22')](function(_0x4a99fe){console[_0x2a99('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4a99fe);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4a99fe);process[_0x2a99('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8ea274c..11b78c0 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 _0xe9ad=['disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','blockDuration','minutes','user','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','basic-auth','crypto','bluebird','util','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','use','findOne','params','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','pass','status','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xe9ad,0x1be));var _0xde9a=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0xe9ad[_0x1df5cd];return _0xf6df9b;};'use strict';var db=require(_0xde9a('0x0'))['db'];var config=require(_0xde9a('0x1'));var hardwareConf=require(_0xde9a('0x2'));var licenseUtil=require(_0xde9a('0x3'));var encryptor=require('../encryptor');var _=require(_0xde9a('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xde9a('0x5'));var crypto=require(_0xde9a('0x6'));var BPromise=require(_0xde9a('0x7'));var util=require(_0xde9a('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xde9a('0x9')][_0xde9a('0xa')]});var userAttributes=['id',_0xde9a('0xb'),_0xde9a('0xc'),_0xde9a('0xd'),_0xde9a('0xe'),_0xde9a('0xf'),_0xde9a('0x10'),_0xde9a('0x11'),_0xde9a('0x12'),_0xde9a('0x13'),_0xde9a('0x14'),_0xde9a('0x15'),_0xde9a('0x16'),_0xde9a('0x17'),'openchannelPause',_0xde9a('0x18'),_0xde9a('0x19'),_0xde9a('0x1a'),'lastPauseAt',_0xde9a('0x1b'),_0xde9a('0x1c'),_0xde9a('0x1d'),_0xde9a('0x1e'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xde9a('0x1f'),_0xde9a('0x20'),_0xde9a('0x21'),_0xde9a('0x22'),_0xde9a('0x23'),_0xde9a('0x24'),_0xde9a('0x25'),'phoneBarRemoteControlPort',_0xde9a('0x26'),'interface',_0xde9a('0x27'),_0xde9a('0x28'),_0xde9a('0x29'),_0xde9a('0x2a'),'downloadVoiceRecordings',_0xde9a('0x2b'),_0xde9a('0x2c'),_0xde9a('0x2d'),'selectRecallMeCampaign'];exports[_0xde9a('0x2e')]=function(){return this[_0xde9a('0x2f')](!![])[_0xde9a('0x30')](function(_0x29bad0,_0x5d1ee8,_0x17cde6){if(_0x29bad0['user']){_0x17cde6();}else{return db['ChatInteraction'][_0xde9a('0x31')]({'where':{'id':_0x29bad0[_0xde9a('0x32')]['id']},'attributes':['id',_0xde9a('0x33'),_0xde9a('0x34')],'raw':!![]})[_0xde9a('0x35')](function(_0x4b52c1){if(_0x4b52c1&&_0x4b52c1[_0xde9a('0x33')]){return _0x5d1ee8['status'](_0x4b52c1['disposition']==='unmanaged'?0x195:0x193)['json']({'message':_0x4b52c1[_0xde9a('0x34')]===_0xde9a('0x36')?_0xde9a('0x37'):_0xde9a('0x38')});}else{_0x17cde6();}})[_0xde9a('0x39')](function(_0x1f7395){_0x17cde6(_0x1f7395);});}});};exports['isAuthenticated']=function isAuthenticated(_0xa3d106){return compose()[_0xde9a('0x30')](function(_0x320caf,_0x97bdbe,_0x1360a6){var _0x2c795a;if(_0x320caf[_0xde9a('0x3a')][_0xde9a('0x3b')]){if(_[_0xde9a('0x3c')](_0x320caf['headers'][_0xde9a('0x3b')],_0xde9a('0x3d'))){var _0x405c8b=basicAuth(_0x320caf);db[_0xde9a('0x3e')]['find']({'where':{'name':_0x405c8b[_0xde9a('0xd')]}})[_0xde9a('0x35')](function(_0x57d540){if(!_0x57d540||!_0x57d540['authenticate'](_0x405c8b[_0xde9a('0x3f')])){return _0x97bdbe[_0xde9a('0x40')](0x191)[_0xde9a('0x41')]({'message':_0xde9a('0x42')});}_0x320caf['user']={'id':_0x57d540['id']};_0x1360a6();})['catch'](function(_0x1da701){_0x1360a6(_0x1da701);});}else if(_[_0xde9a('0x3c')](_0x320caf['headers'][_0xde9a('0x3b')],_0xde9a('0x43'))){validateJwt(_0x320caf,_0x97bdbe,_0x1360a6);}else{if(_0xa3d106){_0x1360a6();}else{return _0x97bdbe[_0xde9a('0x40')](0x193)[_0xde9a('0x41')]({'message':_0xde9a('0x44')});}}}else if(_0x320caf[_0xde9a('0x45')][_0xde9a('0x46')]){try{var _0x3ea769={'audience':hardwareConf[_0xde9a('0x47')](),'issuer':hardwareConf[_0xde9a('0x47')]()};verifyJwt(_0x320caf[_0xde9a('0x45')][_0xde9a('0x46')],_0x3ea769)['then'](function(_0x5ed0d0){return db['User'][_0xde9a('0x48')]({'where':{'id':_0x5ed0d0[_0xde9a('0x49')]}})[_0xde9a('0x35')](function(_0x524f79){_0x2c795a=_0x524f79;return db['Setting'][_0xde9a('0x31')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0xde9a('0x35')](function(_0x1975fe){if(!_0x2c795a||!_[_0xde9a('0x4a')](_0x2c795a[_0xde9a('0x4b')],_0x5ed0d0[_0xde9a('0x4c')])){return _0x97bdbe[_0xde9a('0x40')](0x191)[_0xde9a('0x41')]({'message':_0xde9a('0x4d')});}if(_0x2c795a[_0xde9a('0x4e')]){return _0x97bdbe['status'](0x191)[_0xde9a('0x41')]({'message':_0xde9a('0x4f')});}if(_0x2c795a[_0xde9a('0x50')]){if(_0x1975fe['blockDuration']>0x0){if(moment(_0x2c795a[_0xde9a('0x51')])[_0xde9a('0x52')](_0x1975fe[_0xde9a('0x53')],_0xde9a('0x54'))>moment()){return _0x97bdbe['status'](0x191)['json']({'message':_0xde9a('0x4f')});}}else{return _0x97bdbe[_0xde9a('0x40')](0x191)[_0xde9a('0x41')]({'message':_0xde9a('0x4f')});}}_0x320caf['user']={'id':_0x2c795a['id']};_0x1360a6();});})[_0xde9a('0x39')](function(){return _0x97bdbe[_0xde9a('0x40')](0x191)[_0xde9a('0x41')]({'message':_0xde9a('0x4f')});});}catch(_0x81b114){_0x1360a6(_0x81b114);}}else if(_0xa3d106){_0x1360a6();}else{return _0x97bdbe['status'](0x193)[_0xde9a('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xde9a('0x30')](function(_0x3bf0b3,_0x3e9c35,_0x1dfc51){if(_0x3bf0b3[_0xde9a('0x55')]){db[_0xde9a('0x3e')][_0xde9a('0x48')]({'where':{'id':_0x3bf0b3[_0xde9a('0x55')]['id']},'attributes':userAttributes})[_0xde9a('0x35')](function(_0x2e210b){if(!_0x2e210b){return _0x3e9c35['status'](0x194)[_0xde9a('0x41')]({'message':_0xde9a('0x56')});}_0x3bf0b3[_0xde9a('0x55')]=_0x2e210b;_0x1dfc51();})[_0xde9a('0x39')](function(_0xa4ee58){_0x1dfc51(_0xa4ee58);});}else if(_0xa3d106){_0x1dfc51();}else{return _0x3e9c35[_0xde9a('0x40')](0x194)[_0xde9a('0x41')]({'message':_0xde9a('0x57')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xde9a('0x30')](function(_0x129580,_0x21db00,_0x217595){return licenseUtil[_0xde9a('0x58')]()['then'](function(_0x32131c){if(_0x32131c[_0xde9a('0x59')]){_0x217595();}else{return _0x21db00[_0xde9a('0x40')](0x193)[_0xde9a('0x41')]({'message':_0xde9a('0x5a')});}})[_0xde9a('0x39')](function(_0x45b748){_0x217595(_0x45b748);});});};exports[_0xde9a('0x5b')]=function isWebrtcLicence(){return compose()[_0xde9a('0x30')](function(_0x334bd3,_0x262094,_0x5e3464){return licenseUtil[_0xde9a('0x58')]()[_0xde9a('0x35')](function(_0x3accf6){if(_0x3accf6[_0xde9a('0x5c')]){_0x5e3464();}else{return _0x262094[_0xde9a('0x40')](0x193)[_0xde9a('0x41')]({'message':'Forbidden'});}})[_0xde9a('0x39')](function(_0x5a1381){_0x5e3464(_0x5a1381);});});};exports[_0xde9a('0x5d')]=function(_0x507474,_0x3f6c47,_0x43b192){_0x507474[_0xde9a('0x5d')]=!![];return _0x43b192();};exports['signToken']=function signToken(_0x2d9fd0){return signJwt(_0x2d9fd0);};exports[_0xde9a('0x5e')]=function(_0x536389,_0x10cb25){if(!_0x536389[_0xde9a('0x55')]){return _0x10cb25[_0xde9a('0x40')](0x194)[_0xde9a('0x41')]({'message':_0xde9a('0x5f')});}var _0x4a05ab={'payload':{'id':_0x536389[_0xde9a('0x55')]['id'],'role':_0x536389['user'][_0xde9a('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a05ab)[_0xde9a('0x35')](function(_0x5c86e1){_0x10cb25[_0xde9a('0x60')]('motion.token',_0x5c86e1);_0x10cb25[_0xde9a('0x61')](_0xde9a('0x62'));})['catch'](function(_0x65e7fb){return _0x10cb25[_0xde9a('0x40')](0x1f4)[_0xde9a('0x63')](_0x65e7fb);});};exports[_0xde9a('0x64')]=function(_0x382ac7){if(_[_0xde9a('0x65')](_0x382ac7[_0xde9a('0x4b')])||_[_0xde9a('0x65')](_0x382ac7[_0xde9a('0x66')])){return null;}else{return createJwt(_0x382ac7);}};exports[_0xde9a('0x67')]=function(_0x3fd14f){_0x3fd14f[_0xde9a('0x4b')]=generateNonce();_0x3fd14f['apiKeyIat']=generateIssuedAt();return createJwt(_0x3fd14f);};exports[_0xde9a('0x68')]=function(_0x5b6ff1,_0x5e7961){var _0x108d23=_0x5b6ff1[_0xde9a('0x45')][_0xde9a('0x46')];if(_0x108d23){var _0x1800e6={'nonce':_0x5e7961[_0xde9a('0x4b')],'iat':_0x5e7961[_0xde9a('0x66')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xde9a('0x47')]()};return verifyJwt(_0x108d23,_0x1800e6)[_0xde9a('0x35')](function(){return generateApiKey(_0x5e7961);});}else{throw{'message':_0xde9a('0x69')};}};exports['validatePasswordPattern']=function(_0x1217fb){var _0x5b8de0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5b8de0['test'](_0x1217fb))throw new db[(_0xde9a('0x6a'))][(_0xde9a('0x6b'))]('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[_0xde9a('0x6c')]=function(_0x75572b,_0x38132a,_0x2966d2){var _0x56ea83=encryptor[_0xde9a('0x6d')](_0x38132a)[_0xde9a('0x6e')](',');for(var _0x261774=0x0;_0x261774<_0x2966d2;_0x261774++){if(!_0x56ea83[_0x261774])break;if(_0x75572b[_0xde9a('0x6f')]()===_0x56ea83[_0x261774][_0xde9a('0x6f')]()){var _0x58a07e=util[_0xde9a('0x70')](_0xde9a('0x71'),_0x2966d2);if(_0x2966d2===0x1){_0x58a07e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x58a07e);}}return;};exports[_0xde9a('0x72')]=function(_0x2d9b05,_0x2e38b9){var _0xb5038=_0x2e38b9?encryptor[_0xde9a('0x6d')](_0x2e38b9)[_0xde9a('0x6e')](','):[];if(_0xb5038[_0xde9a('0x73')]===0x5){_0xb5038[_0xde9a('0x74')](-0x1,0x1);}_0xb5038[_0xde9a('0x75')](_0x2d9b05);return encryptor[_0xde9a('0x76')](_0xb5038[_0xde9a('0x77')](','));};function signJwt(_0x17e22e){var _0x2a01e7=BPromise[_0xde9a('0x78')](jwt[_0xde9a('0x79')],{'context':jwt});var _0x56b233=_0x17e22e[_0xde9a('0x7a')]||config[_0xde9a('0x9')][_0xde9a('0xa')];return new BPromise(function(_0x271f78,_0x2b3226){_0x2a01e7(_0x17e22e[_0xde9a('0x7b')],_0x56b233,_0x17e22e[_0xde9a('0x7c')])[_0xde9a('0x35')](function(_0xc37c89){_0x271f78(_0xc37c89);})[_0xde9a('0x39')](function(_0x4d7f0e){_0x2b3226(_0x4d7f0e);});});}function verifyJwt(_0x30eacb,_0x2c9c81,_0x50607e){var _0x271e36=BPromise[_0xde9a('0x78')](jwt[_0xde9a('0x7d')],{'context':jwt});var _0x58f00=_0x50607e||config[_0xde9a('0x9')][_0xde9a('0xa')];return new BPromise(function(_0x3917d8,_0x3fb297){_0x271e36(_0x30eacb,_0x58f00,_0x2c9c81)['then'](function(_0x1de252){_0x3917d8(_0x1de252);})[_0xde9a('0x39')](function(_0x4b6e21){_0x3fb297(_0x4b6e21);});});}function generateNonce(){return crypto[_0xde9a('0x7e')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xde9a('0x7f')](Date[_0xde9a('0x80')]()/0x3e8)[_0xde9a('0x81')]();}function createJwt(_0x2252e6){var _0x1e07c6={'payload':{'iat':_0x2252e6[_0xde9a('0x66')],'nonce':_0x2252e6[_0xde9a('0x4b')]},'options':{'algorithm':_0xde9a('0x82'),'subject':_0x2252e6['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xde9a('0x47')]()}};return signJwt(_0x1e07c6)[_0xde9a('0x35')](function(_0xafca3){return{'iat':_0x2252e6['apiKeyIat'],'nonce':_0x2252e6[_0xde9a('0x4b')],'token':_0xafca3};});} \ No newline at end of file +var _0x99a4=['phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','isChatInteractionAuthorized','user','findOne','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','Basic','find','authenticate','json','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','User','sub','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','length','unshift','join','sign','secret','secrets','options','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording'];(function(_0x1bba3d,_0x49a267){var _0x55c019=function(_0x1603d7){while(--_0x1603d7){_0x1bba3d['push'](_0x1bba3d['shift']());}};_0x55c019(++_0x49a267);}(_0x99a4,0x1cb));var _0x499a=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x99a4[_0x20c9b2];return _0x2c6030;};'use strict';var db=require(_0x499a('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x499a('0x1'));var licenseUtil=require(_0x499a('0x2'));var encryptor=require(_0x499a('0x3'));var _=require('lodash');var jwt=require(_0x499a('0x4'));var expressJwt=require(_0x499a('0x5'));var compose=require(_0x499a('0x6'));var basicAuth=require(_0x499a('0x7'));var crypto=require(_0x499a('0x8'));var BPromise=require(_0x499a('0x9'));var util=require(_0x499a('0xa'));var moment=require(_0x499a('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x499a('0xc')]});var userAttributes=['id',_0x499a('0xd'),_0x499a('0xe'),_0x499a('0xf'),_0x499a('0x10'),'email',_0x499a('0x11'),_0x499a('0x12'),_0x499a('0x13'),_0x499a('0x14'),'chatPause',_0x499a('0x15'),_0x499a('0x16'),_0x499a('0x17'),_0x499a('0x18'),_0x499a('0x19'),'showWebBar',_0x499a('0x1a'),_0x499a('0x1b'),'crudPermissions','allowmessenger',_0x499a('0x1c'),_0x499a('0x1d'),_0x499a('0x1e'),_0x499a('0x1f'),'phoneBarDnd',_0x499a('0x20'),_0x499a('0x21'),_0x499a('0x22'),_0x499a('0x23'),'phoneBarPrefixRequired',_0x499a('0x24'),_0x499a('0x25'),'hotdesk','interface',_0x499a('0x26'),_0x499a('0x27'),_0x499a('0x28'),'wssPort',_0x499a('0x29'),_0x499a('0x2a'),'downloadAttachments',_0x499a('0x2b'),'selectRecallMeCampaign'];exports[_0x499a('0x2c')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x33334e,_0xabc3ad,_0x55b0da){if(_0x33334e[_0x499a('0x2d')]){_0x55b0da();}else{return db['ChatInteraction'][_0x499a('0x2e')]({'where':{'id':_0x33334e['params']['id']},'attributes':['id',_0x499a('0x2f'),_0x499a('0x30')],'raw':!![]})[_0x499a('0x31')](function(_0x514d63){if(_0x514d63&&_0x514d63[_0x499a('0x2f')]){return _0xabc3ad[_0x499a('0x32')](_0x514d63[_0x499a('0x30')]===_0x499a('0x33')?0x195:0x193)['json']({'message':_0x514d63[_0x499a('0x30')]===_0x499a('0x33')?_0x499a('0x34'):_0x499a('0x35')});}else{_0x55b0da();}})[_0x499a('0x36')](function(_0x9d4fe0){_0x55b0da(_0x9d4fe0);});}});};exports[_0x499a('0x37')]=function isAuthenticated(_0x4937a8){return compose()[_0x499a('0x38')](function(_0x5f388a,_0x4aa304,_0x141a4f){var _0x41855c;if(_0x5f388a[_0x499a('0x39')][_0x499a('0x3a')]){if(_[_0x499a('0x3b')](_0x5f388a['headers'][_0x499a('0x3a')],_0x499a('0x3c'))){var _0x1e8625=basicAuth(_0x5f388a);db['User'][_0x499a('0x3d')]({'where':{'name':_0x1e8625[_0x499a('0xf')]}})[_0x499a('0x31')](function(_0x22ab6f){if(!_0x22ab6f||!_0x22ab6f[_0x499a('0x3e')](_0x1e8625['pass'])){return _0x4aa304[_0x499a('0x32')](0x191)[_0x499a('0x3f')]({'message':'Wrong\x20credentials.'});}_0x5f388a[_0x499a('0x2d')]={'id':_0x22ab6f['id']};_0x141a4f();})['catch'](function(_0x921ef1){_0x141a4f(_0x921ef1);});}else if(_[_0x499a('0x3b')](_0x5f388a['headers'][_0x499a('0x3a')],_0x499a('0x40'))){validateJwt(_0x5f388a,_0x4aa304,_0x141a4f);}else{if(_0x4937a8){_0x141a4f();}else{return _0x4aa304[_0x499a('0x32')](0x193)['json']({'message':_0x499a('0x41')});}}}else if(_0x5f388a['query'][_0x499a('0x42')]){try{var _0x17cd55={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x499a('0x43')]()};verifyJwt(_0x5f388a[_0x499a('0x44')][_0x499a('0x42')],_0x17cd55)[_0x499a('0x31')](function(_0x144b7b){return db[_0x499a('0x45')]['find']({'where':{'id':_0x144b7b[_0x499a('0x46')]}})[_0x499a('0x31')](function(_0x82dca2){_0x41855c=_0x82dca2;return db['Setting'][_0x499a('0x2e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x499a('0x47')],'raw':!![]});})[_0x499a('0x31')](function(_0x100f2e){if(!_0x41855c||!_[_0x499a('0x48')](_0x41855c[_0x499a('0x49')],_0x144b7b[_0x499a('0x4a')])){return _0x4aa304[_0x499a('0x32')](0x191)[_0x499a('0x3f')]({'message':_0x499a('0x4b')});}if(_0x41855c['disabled']){return _0x4aa304[_0x499a('0x32')](0x191)['json']({'message':_0x499a('0x4c')});}if(_0x41855c[_0x499a('0x4d')]){if(_0x100f2e[_0x499a('0x47')]>0x0){if(moment(_0x41855c[_0x499a('0x4e')])['add'](_0x100f2e[_0x499a('0x47')],_0x499a('0x4f'))>moment()){return _0x4aa304[_0x499a('0x32')](0x191)[_0x499a('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4aa304[_0x499a('0x32')](0x191)['json']({'message':_0x499a('0x4c')});}}_0x5f388a[_0x499a('0x2d')]={'id':_0x41855c['id']};_0x141a4f();});})['catch'](function(){return _0x4aa304[_0x499a('0x32')](0x191)[_0x499a('0x3f')]({'message':_0x499a('0x4c')});});}catch(_0x54f8c9){_0x141a4f(_0x54f8c9);}}else if(_0x4937a8){_0x141a4f();}else{return _0x4aa304[_0x499a('0x32')](0x193)['json']({'message':_0x499a('0x41')});}})[_0x499a('0x38')](function(_0x2a96d9,_0x784bc1,_0x2f0e13){if(_0x2a96d9[_0x499a('0x2d')]){db[_0x499a('0x45')][_0x499a('0x3d')]({'where':{'id':_0x2a96d9[_0x499a('0x2d')]['id']},'attributes':userAttributes})[_0x499a('0x31')](function(_0x3bdd0e){if(!_0x3bdd0e){return _0x784bc1[_0x499a('0x32')](0x194)['json']({'message':_0x499a('0x50')});}_0x2a96d9['user']=_0x3bdd0e;_0x2f0e13();})[_0x499a('0x36')](function(_0x4f0d70){_0x2f0e13(_0x4f0d70);});}else if(_0x4937a8){_0x2f0e13();}else{return _0x784bc1[_0x499a('0x32')](0x194)[_0x499a('0x3f')]({'message':_0x499a('0x51')});}});};exports[_0x499a('0x52')]=function canUpdate(){return compose()['use'](function(_0x1d40af,_0x38a995,_0x398ea3){return licenseUtil[_0x499a('0x53')]()[_0x499a('0x31')](function(_0x52d84d){if(_0x52d84d[_0x499a('0x54')]){_0x398ea3();}else{return _0x38a995[_0x499a('0x32')](0x193)[_0x499a('0x3f')]({'message':_0x499a('0x55')});}})[_0x499a('0x36')](function(_0x4ee2d9){_0x398ea3(_0x4ee2d9);});});};exports[_0x499a('0x56')]=function isWebrtcLicence(){return compose()['use'](function(_0x61394d,_0x228cd0,_0xafac49){return licenseUtil['getLicense']()[_0x499a('0x31')](function(_0x4f50eb){if(_0x4f50eb[_0x499a('0x57')]){_0xafac49();}else{return _0x228cd0['status'](0x193)['json']({'message':_0x499a('0x55')});}})[_0x499a('0x36')](function(_0x4ffea6){_0xafac49(_0x4ffea6);});});};exports[_0x499a('0x58')]=function(_0x4e076c,_0x564e68,_0x270faf){_0x4e076c['isMiddleware']=!![];return _0x270faf();};exports[_0x499a('0x59')]=function signToken(_0x5f2102){return signJwt(_0x5f2102);};exports['setTokenCookie']=function(_0x137694,_0x40f889){if(!_0x137694[_0x499a('0x2d')]){return _0x40f889[_0x499a('0x32')](0x194)['json']({'message':_0x499a('0x5a')});}var _0x5f26c8={'payload':{'id':_0x137694[_0x499a('0x2d')]['id'],'role':_0x137694[_0x499a('0x2d')][_0x499a('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5f26c8)[_0x499a('0x31')](function(_0xe0ca49){_0x40f889[_0x499a('0x5b')](_0x499a('0x5c'),_0xe0ca49);_0x40f889[_0x499a('0x5d')]('/dashboards/general');})[_0x499a('0x36')](function(_0x21183d){return _0x40f889[_0x499a('0x32')](0x1f4)[_0x499a('0x5e')](_0x21183d);});};exports[_0x499a('0x5f')]=function(_0x2de644){if(_[_0x499a('0x60')](_0x2de644[_0x499a('0x49')])||_[_0x499a('0x60')](_0x2de644[_0x499a('0x61')])){return null;}else{return createJwt(_0x2de644);}};exports['generateApiKey']=function(_0x4ecc1c){_0x4ecc1c['apiKeyNonce']=generateNonce();_0x4ecc1c[_0x499a('0x61')]=generateIssuedAt();return createJwt(_0x4ecc1c);};exports[_0x499a('0x62')]=function(_0x110981,_0x4a5429){var _0x2d504f=_0x110981['query']['apikey'];if(_0x2d504f){var _0x5e3367={'nonce':_0x4a5429['apiKeyNonce'],'iat':_0x4a5429[_0x499a('0x61')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x499a('0x43')]()};return verifyJwt(_0x2d504f,_0x5e3367)[_0x499a('0x31')](function(){return generateApiKey(_0x4a5429);});}else{throw{'message':_0x499a('0x63')};}};exports['validatePasswordPattern']=function(_0x4ae4f6){var _0x1ed280=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1ed280['test'](_0x4ae4f6))throw new db['Sequelize'][(_0x499a('0x64'))](_0x499a('0x65'));return;};exports[_0x499a('0x66')]=function(_0x245372,_0x3f21ce,_0xa604ef){var _0x3f5305=encryptor[_0x499a('0x67')](_0x3f21ce)[_0x499a('0x68')](',');for(var _0x525ac8=0x0;_0x525ac8<_0xa604ef;_0x525ac8++){if(!_0x3f5305[_0x525ac8])break;if(_0x245372[_0x499a('0x69')]()===_0x3f5305[_0x525ac8][_0x499a('0x69')]()){var _0x5e6b97=util[_0x499a('0x6a')](_0x499a('0x6b'),_0xa604ef);if(_0xa604ef===0x1){_0x5e6b97='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x499a('0x6c'))][(_0x499a('0x64'))](_0x5e6b97);}}return;};exports['updatePasswordsHistory']=function(_0x663359,_0x47aa51){var _0x23a963=_0x47aa51?encryptor[_0x499a('0x67')](_0x47aa51)[_0x499a('0x68')](','):[];if(_0x23a963[_0x499a('0x6d')]===0x5){_0x23a963['splice'](-0x1,0x1);}_0x23a963[_0x499a('0x6e')](_0x663359);return encryptor['encryptString'](_0x23a963[_0x499a('0x6f')](','));};function signJwt(_0xf9c5ab){var _0x38107d=BPromise['promisify'](jwt[_0x499a('0x70')],{'context':jwt});var _0x4b21a5=_0xf9c5ab[_0x499a('0x71')]||config[_0x499a('0x72')][_0x499a('0xc')];return new BPromise(function(_0x2b58ca,_0x4fe299){_0x38107d(_0xf9c5ab['payload'],_0x4b21a5,_0xf9c5ab[_0x499a('0x73')])[_0x499a('0x31')](function(_0x2631fb){_0x2b58ca(_0x2631fb);})[_0x499a('0x36')](function(_0x36632b){_0x4fe299(_0x36632b);});});}function verifyJwt(_0x3415f8,_0x463a31,_0xc52ef7){var _0x4f31e8=BPromise[_0x499a('0x74')](jwt[_0x499a('0x75')],{'context':jwt});var _0x1872e7=_0xc52ef7||config[_0x499a('0x72')][_0x499a('0xc')];return new BPromise(function(_0x2fdf16,_0x57b6f4){_0x4f31e8(_0x3415f8,_0x1872e7,_0x463a31)[_0x499a('0x31')](function(_0x51351b){_0x2fdf16(_0x51351b);})['catch'](function(_0x19b0d2){_0x57b6f4(_0x19b0d2);});});}function generateNonce(){return crypto[_0x499a('0x76')](0x10)[_0x499a('0x77')](_0x499a('0x78'));}function generateIssuedAt(){return Math[_0x499a('0x79')](Date[_0x499a('0x7a')]()/0x3e8)[_0x499a('0x77')]();}function createJwt(_0x42ac3d){var _0x19c65b={'payload':{'iat':_0x42ac3d[_0x499a('0x61')],'nonce':_0x42ac3d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x42ac3d['id'][_0x499a('0x77')](),'issuer':hardwareConf[_0x499a('0x43')](),'audience':hardwareConf[_0x499a('0x43')]()}};return signJwt(_0x19c65b)['then'](function(_0x3d80f5){return{'iat':_0x42ac3d[_0x499a('0x61')],'nonce':_0x42ac3d[_0x499a('0x49')],'token':_0x3d80f5};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8f84784..46b6343 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 _0x086e=['end','final','close','unlink','decryptFile','createReadStream','data','secret','createCipher','base64','decryptString','createDecipher','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createWriteStream','update','binary','write'];(function(_0x573833,_0x3be10f){var _0x351fd7=function(_0x568be3){while(--_0x568be3){_0x573833['push'](_0x573833['shift']());}};_0x351fd7(++_0x3be10f);}(_0x086e,0x1cd));var _0xe086=function(_0x4aa33b,_0x18235f){_0x4aa33b=_0x4aa33b-0x0;var _0x5efce2=_0x086e[_0x4aa33b];return _0x5efce2;};'use strict';var crypto=require(_0xe086('0x0'));var fs=require('fs');var BPromise=require(_0xe086('0x1'));var _=require(_0xe086('0x2'));var config=require(_0xe086('0x3'));var logger=require(_0xe086('0x4'))(_0xe086('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0xe086('0x6')};const fileOptions={'algorithm':_0xe086('0x7')};if(config[_0xe086('0x8')]&&config['encrypt'][_0xe086('0x9')]){var isSupported=isAlgorithmSupported(config[_0xe086('0x8')][_0xe086('0x9')]);if(isSupported){fileOptions[_0xe086('0x9')]=config[_0xe086('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt'][_0xe086('0x9')],_0xe086('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x33b4c0){return AES_SUPPORTED_RX['test'](_0x33b4c0);}function getSupportedCiphers(){return crypto[_0xe086('0xb')]()[_0xe086('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x48b8cd){return getSupportedCiphers()['indexOf'](_0x48b8cd)>-0x1;}function combineOptions(_0x2ab746){var _0x49e18f={};for(var _0x7d3b1a in fileOptions){if(fileOptions[_0xe086('0xd')](_0x7d3b1a)){_0x49e18f[_0x7d3b1a]=fileOptions[_0x7d3b1a];}}if(_0x2ab746){for(var _0x5b6890 in _0x2ab746){if(_0x2ab746['hasOwnProperty'](_0x5b6890)){_0x49e18f[_0x5b6890]=_0x2ab746[_0x5b6890];}}}return _0x49e18f;}exports[_0xe086('0xe')]=function(_0x16f22f,_0x47a7f3,_0x67abd2,_0xfa13c1){return new BPromise(function(_0x1bbb20,_0x42f757){_0xfa13c1=combineOptions(_0xfa13c1);var _0x324692=new Buffer(_0x67abd2);var _0xf50788=fs['createReadStream'](_0x16f22f);var _0x163868=fs[_0xe086('0xf')](_0x47a7f3);var _0x1e28ef=crypto['createCipher'](_0xfa13c1[_0xe086('0x9')],_0x324692);_0xf50788['on']('data',function(_0x22a913){var _0x544a75=new Buffer(_0x1e28ef[_0xe086('0x10')](_0x22a913),_0xe086('0x11'));_0x163868[_0xe086('0x12')](_0x544a75);});_0xf50788['on'](_0xe086('0x13'),function(){try{var _0x17ea26=new Buffer(_0x1e28ef[_0xe086('0x14')](_0xe086('0x11')),'binary');_0x163868['write'](_0x17ea26);_0x163868['end']();_0x163868['on'](_0xe086('0x15'),function(){return _0x1bbb20(_0x47a7f3);});}catch(_0x2dfc49){fs[_0xe086('0x16')](_0x47a7f3);return _0x42f757(_0x2dfc49);}});});};exports[_0xe086('0x17')]=function(_0x74e2db,_0x5d385d,_0xbba2f6,_0x3fc220){return new BPromise(function(_0x14e0e9,_0x1e20cf){_0x3fc220=combineOptions(_0x3fc220);var _0x564633=new Buffer(_0xbba2f6);var _0x28fc1e=fs[_0xe086('0x18')](_0x74e2db);var _0x3afc6e=fs['createWriteStream'](_0x5d385d);var _0x4a340b=crypto['createDecipher'](_0x3fc220[_0xe086('0x9')],_0x564633);_0x28fc1e['on'](_0xe086('0x19'),function(_0x33a317){var _0x22c5f8=new Buffer(_0x4a340b[_0xe086('0x10')](_0x33a317),_0xe086('0x11'));_0x3afc6e[_0xe086('0x12')](_0x22c5f8);});_0x28fc1e['on'](_0xe086('0x13'),function(){try{var _0x329da4=new Buffer(_0x4a340b['final'](_0xe086('0x11')),'binary');_0x3afc6e[_0xe086('0x12')](_0x329da4);_0x3afc6e[_0xe086('0x13')]();_0x3afc6e['on'](_0xe086('0x15'),function(){return _0x14e0e9(_0x5d385d);});}catch(_0x35ebd7){fs[_0xe086('0x16')](_0x5d385d);return _0x1e20cf(_0x35ebd7);}});});};exports['encryptString']=function(_0xf3965b,_0x530354,_0x1e5ab7){var _0x47215b=_0x1e5ab7||stringOptions[_0xe086('0x9')];var _0x4420b9=_0x530354||stringOptions[_0xe086('0x1a')];var _0xe47fbf=crypto[_0xe086('0x1b')](_0x47215b,_0x4420b9);var _0x44c701=_0xe47fbf[_0xe086('0x10')](_0xf3965b,'utf8','base64');_0x44c701+=_0xe47fbf[_0xe086('0x14')](_0xe086('0x1c'));return _0x44c701;};exports[_0xe086('0x1d')]=function(_0x2f21db,_0x5e7a38,_0xc68232){var _0x3a7f7a=_0xc68232||stringOptions[_0xe086('0x9')];var _0x1c2c71=_0x5e7a38||stringOptions['secret'];var _0x25deea=crypto[_0xe086('0x1e')](_0x3a7f7a,_0x1c2c71);var _0x3702f9=_0x25deea[_0xe086('0x10')](_0x2f21db,'base64',_0xe086('0x1f'));_0x3702f9+=_0x25deea[_0xe086('0x14')](_0xe086('0x1f'));return _0x3702f9;}; \ No newline at end of file +var _0xb172=['lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','final','end','unlink','createReadStream','close','encryptString','utf8','base64','decryptString','secret','crypto','bluebird'];(function(_0x46f2c8,_0x418387){var _0x4c047c=function(_0x5e9c88){while(--_0x5e9c88){_0x46f2c8['push'](_0x46f2c8['shift']());}};_0x4c047c(++_0x418387);}(_0xb172,0x139));var _0x2b17=function(_0x6bad90,_0xda9acc){_0x6bad90=_0x6bad90-0x0;var _0x4d54ea=_0xb172[_0x6bad90];return _0x4d54ea;};'use strict';var crypto=require(_0x2b17('0x0'));var fs=require('fs');var BPromise=require(_0x2b17('0x1'));var _=require(_0x2b17('0x2'));var config=require(_0x2b17('0x3'));var logger=require(_0x2b17('0x4'))(_0x2b17('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2b17('0x6')]['session'],'algorithm':_0x2b17('0x7')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x2b17('0x8')][_0x2b17('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2b17('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x2b17('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2b17('0xa')](',\x20');logger[_0x2b17('0xb')](config['encrypt'][_0x2b17('0x9')],_0x2b17('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x52d5ce){return AES_SUPPORTED_RX[_0x2b17('0xd')](_0x52d5ce);}function getSupportedCiphers(){return crypto[_0x2b17('0xe')]()[_0x2b17('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3a3f0e){return getSupportedCiphers()[_0x2b17('0x10')](_0x3a3f0e)>-0x1;}function combineOptions(_0x3d18e7){var _0x8ddb14={};for(var _0xdaea18 in fileOptions){if(fileOptions[_0x2b17('0x11')](_0xdaea18)){_0x8ddb14[_0xdaea18]=fileOptions[_0xdaea18];}}if(_0x3d18e7){for(var _0x5d8749 in _0x3d18e7){if(_0x3d18e7[_0x2b17('0x11')](_0x5d8749)){_0x8ddb14[_0x5d8749]=_0x3d18e7[_0x5d8749];}}}return _0x8ddb14;}exports[_0x2b17('0x12')]=function(_0x42b107,_0x631e4c,_0x1e3471,_0x5d3f01){return new BPromise(function(_0x280f6c,_0xe6a42){_0x5d3f01=combineOptions(_0x5d3f01);var _0x4a2cfe=new Buffer(_0x1e3471);var _0x429c45=fs['createReadStream'](_0x42b107);var _0x577f50=fs[_0x2b17('0x13')](_0x631e4c);var _0x448c79=crypto[_0x2b17('0x14')](_0x5d3f01[_0x2b17('0x9')],_0x4a2cfe);_0x429c45['on'](_0x2b17('0x15'),function(_0xdf9ff4){var _0x4e0fbe=new Buffer(_0x448c79[_0x2b17('0x16')](_0xdf9ff4),_0x2b17('0x17'));_0x577f50[_0x2b17('0x18')](_0x4e0fbe);});_0x429c45['on']('end',function(){try{var _0x4db99e=new Buffer(_0x448c79[_0x2b17('0x19')](_0x2b17('0x17')),_0x2b17('0x17'));_0x577f50['write'](_0x4db99e);_0x577f50[_0x2b17('0x1a')]();_0x577f50['on']('close',function(){return _0x280f6c(_0x631e4c);});}catch(_0x155f8d){fs[_0x2b17('0x1b')](_0x631e4c);return _0xe6a42(_0x155f8d);}});});};exports['decryptFile']=function(_0x115afc,_0x15dc37,_0x317a5b,_0x438100){return new BPromise(function(_0x2f8a6d,_0x20e6a1){_0x438100=combineOptions(_0x438100);var _0x16ecda=new Buffer(_0x317a5b);var _0x114439=fs[_0x2b17('0x1c')](_0x115afc);var _0x5f0db8=fs[_0x2b17('0x13')](_0x15dc37);var _0xf1a6c0=crypto['createDecipher'](_0x438100[_0x2b17('0x9')],_0x16ecda);_0x114439['on']('data',function(_0x2e73b8){var _0x43db50=new Buffer(_0xf1a6c0[_0x2b17('0x16')](_0x2e73b8),_0x2b17('0x17'));_0x5f0db8[_0x2b17('0x18')](_0x43db50);});_0x114439['on']('end',function(){try{var _0x4868ef=new Buffer(_0xf1a6c0['final']('binary'),_0x2b17('0x17'));_0x5f0db8[_0x2b17('0x18')](_0x4868ef);_0x5f0db8['end']();_0x5f0db8['on'](_0x2b17('0x1d'),function(){return _0x2f8a6d(_0x15dc37);});}catch(_0x21e91e){fs[_0x2b17('0x1b')](_0x15dc37);return _0x20e6a1(_0x21e91e);}});});};exports[_0x2b17('0x1e')]=function(_0xe96347,_0x5335b9,_0x387240){var _0x58fd8a=_0x387240||stringOptions[_0x2b17('0x9')];var _0x47d002=_0x5335b9||stringOptions['secret'];var _0x4166f2=crypto[_0x2b17('0x14')](_0x58fd8a,_0x47d002);var _0x9ef7c3=_0x4166f2[_0x2b17('0x16')](_0xe96347,_0x2b17('0x1f'),_0x2b17('0x20'));_0x9ef7c3+=_0x4166f2[_0x2b17('0x19')]('base64');return _0x9ef7c3;};exports[_0x2b17('0x21')]=function(_0x39bf77,_0x550a1d,_0x549696){var _0x4e9879=_0x549696||stringOptions[_0x2b17('0x9')];var _0x13bb73=_0x550a1d||stringOptions[_0x2b17('0x22')];var _0x248c68=crypto['createDecipher'](_0x4e9879,_0x13bb73);var _0x3772f1=_0x248c68[_0x2b17('0x16')](_0x39bf77,'base64',_0x2b17('0x1f'));_0x3772f1+=_0x248c68[_0x2b17('0x19')](_0x2b17('0x1f'));return _0x3772f1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7ad9d6f..8c8b2c4 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 _0x3848=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3848,0x17d));var _0x8384=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x3848[_0x4c7fb5];return _0x2e10ac;};'use strict';var util=require(_0x8384('0x0'));var path=require('path');var _=require(_0x8384('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x8384('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x8384('0x3'));var db=require(_0x8384('0x4'))['db'];var dbH=require('../../mysqldb')[_0x8384('0x5')];var logger=require(_0x8384('0x6'))(_0x8384('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8384('0x8')][0x3];var PATH=process[_0x8384('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x63546f,_0x14b077){var _0x450e66={'status':_0x63546f};var _0x42990d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x14b077){_0x450e66[_0x8384('0x9')]=_0x14b077;}return db['AnalyticExtractedReport'][_0x8384('0xa')](_0x450e66,_0x42990d);}function main(){var _0x593686=0x1388;var _0x2aa8b5;logger[_0x8384('0xb')](util[_0x8384('0xc')](_0x8384('0xd'),EXTRACTED_REPORT_ID,_0x8384('0xe')));return db[_0x8384('0xf')][_0x8384('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8384('0x11'),'splitSizeCsv']})[_0x8384('0x12')](function(_0x3600e8){if(_0x3600e8){_0x2aa8b5=_0x3600e8;_0x593686=_0x2aa8b5['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x8384('0x13')][_0x8384('0x14')](util[_0x8384('0xc')](_0x8384('0x15'),QUERY),{'type':dbH[_0x8384('0x13')]['QueryTypes'][_0x8384('0x16')]});})['then'](function(_0x255d99){if(!_0x255d99[0x0][_0x8384('0x17')]){return analyticExtractedReport('Empty');}var _0x1302a6=[];var _0x5682ae=0x0;if(_0x2aa8b5[_0x8384('0x11')]){if(_0x255d99&&_0x255d99[_0x8384('0x18')]){var _0x5ab196=_[_0x8384('0x19')](_0x255d99[0x0][_0x8384('0x17')]/_0x593686);var _0x3d3870=Number[_0x8384('0x1a')](_0x255d99[0x0][_0x8384('0x17')]/_0x593686)?_0x255d99[0x0][_0x8384('0x17')]%_0x593686:0x0;_0x5ab196[_0x8384('0x1b')](function(_0x5c9e0c){if(_0x5c9e0c>0x0){_0x5682ae+=_0x593686;}_0x1302a6[_0x8384('0x1c')](dbH[_0x8384('0x13')][_0x8384('0x14')](util['format'](_0x8384('0x1d'),QUERY,_0x593686,_0x5682ae),{'type':dbH[_0x8384('0x13')][_0x8384('0x1e')][_0x8384('0x16')]}));});if(_0x3d3870>0x0){_0x5682ae+=_0x593686;_0x1302a6['push'](dbH[_0x8384('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d3870,_0x5682ae),{'type':dbH[_0x8384('0x13')]['QueryTypes'][_0x8384('0x16')]}));}}}else{_0x1302a6[_0x8384('0x1c')](dbH[_0x8384('0x13')][_0x8384('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x8384('0x16')]}));}var _0x1e6ceb=path[_0x8384('0x1f')](PATH);var _0x675a8a=path[_0x8384('0x20')](PATH,_0x8384('0x21'));var _0x3d8714=_0x2aa8b5[_0x8384('0x11')]&&_0x1302a6[_0x8384('0x18')]>0x1;var _0x38026e=[];if(!fs[_0x8384('0x22')](path['join'](_0x1e6ceb,_0x675a8a))&&_0x3d8714){fs['mkdirSync'](path[_0x8384('0x23')](_0x1e6ceb,_0x675a8a));}return BPromise['each'](_0x1302a6,function(_0x3de713){_0x38026e[_0x8384('0x1c')](_0x3de713);})[_0x8384('0x12')](function(){for(var _0x25059b=0x0;_0x25059b<_0x38026e[_0x8384('0x18')];_0x25059b+=0x1){var _0x362e51;var _0x3b5a2c=_0x38026e[_0x25059b];if(_0x3d8714){_0x362e51=path[_0x8384('0x23')](_0x1e6ceb,_0x675a8a,util[_0x8384('0xc')](_0x8384('0x24'),_0x675a8a,_0x25059b,_0x8384('0x25')));}else{_0x362e51=path[_0x8384('0x23')](_0x1e6ceb,util[_0x8384('0xc')](_0x8384('0x26'),_0x675a8a,_0x8384('0x25')));}fs[_0x8384('0x27')](_0x362e51,csv(_0x3b5a2c));}})[_0x8384('0x12')](function(){if(_0x3d8714){return new Promise(function(_0x14419a){zipdir(path[_0x8384('0x23')](_0x1e6ceb,_0x675a8a),{'saveTo':path['join'](_0x1e6ceb,util[_0x8384('0xc')](_0x8384('0x26'),_0x675a8a,_0x8384('0x28')))},function(_0x28bc67,_0x3a272c){rimraf(path[_0x8384('0x23')](_0x1e6ceb,_0x675a8a),function(){});_0x14419a(_0x8384('0x29'));});});}})[_0x8384('0x12')](function(){logger[_0x8384('0xb')](util[_0x8384('0xc')](_0x8384('0x2a'),EXTRACTED_REPORT_ID,_0x8384('0xe')));return analyticExtractedReport('Completed',_0x3d8714?util[_0x8384('0xc')](_0x8384('0x26'),_0x675a8a,_0x3d8714?'zip':_0x8384('0x25')):null);});})[_0x8384('0x2b')](function(_0xadcd4){logger[_0x8384('0xb')](util['format'](_0x8384('0x2c'),EXTRACTED_REPORT_ID,_0x8384('0xe')),util[_0x8384('0x2d')](_0xadcd4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8384('0x2e'));})[_0x8384('0x2f')](function(){process[_0x8384('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0730=['AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','Empty','split','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv'];(function(_0x250c4a,_0x1f43ab){var _0x57bb6d=function(_0x2ebed2){while(--_0x2ebed2){_0x250c4a['push'](_0x250c4a['shift']());}};_0x57bb6d(++_0x1f43ab);}(_0x0730,0x13f));var _0x0073=function(_0x1590f8,_0x495f35){_0x1590f8=_0x1590f8-0x0;var _0x941f93=_0x0730[_0x1590f8];return _0x941f93;};'use strict';var util=require(_0x0073('0x0'));var path=require(_0x0073('0x1'));var _=require(_0x0073('0x2'));var csv=require(_0x0073('0x3'));var fs=require('fs');var BPromise=require(_0x0073('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x0073('0x5'));var db=require(_0x0073('0x6'))['db'];var dbH=require(_0x0073('0x6'))[_0x0073('0x7')];var logger=require('../../config/logger')(_0x0073('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0073('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x469c4f,_0x3a8854){var _0x43bf61={'status':_0x469c4f};var _0x3e7f06={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a8854){_0x43bf61['savename']=_0x3a8854;}return db[_0x0073('0xa')][_0x0073('0xb')](_0x43bf61,_0x3e7f06);}function main(){var _0x5c69e8=0x1388;var _0x3b2b78;logger[_0x0073('0xc')](util[_0x0073('0xd')](_0x0073('0xe'),EXTRACTED_REPORT_ID,_0x0073('0xf')));return db['Setting'][_0x0073('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0073('0x11')]})[_0x0073('0x12')](function(_0x21ba1d){if(_0x21ba1d){_0x3b2b78=_0x21ba1d;_0x5c69e8=_0x3b2b78[_0x0073('0x11')]||0x1388;}})[_0x0073('0x12')](function(){return dbH[_0x0073('0x13')]['query'](util[_0x0073('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0073('0x13')][_0x0073('0x14')][_0x0073('0x15')]});})['then'](function(_0x229444){if(!_0x229444[0x0][_0x0073('0x16')]){return analyticExtractedReport(_0x0073('0x17'));}var _0x151913=[];var _0xfcd18a=0x0;if(_0x3b2b78[_0x0073('0x18')]){if(_0x229444&&_0x229444[_0x0073('0x19')]){var _0x3cfda2=_['range'](_0x229444[0x0][_0x0073('0x16')]/_0x5c69e8);var _0x16b4e3=Number[_0x0073('0x1a')](_0x229444[0x0][_0x0073('0x16')]/_0x5c69e8)?_0x229444[0x0][_0x0073('0x16')]%_0x5c69e8:0x0;_0x3cfda2[_0x0073('0x1b')](function(_0x5232af){if(_0x5232af>0x0){_0xfcd18a+=_0x5c69e8;}_0x151913[_0x0073('0x1c')](dbH[_0x0073('0x13')]['query'](util[_0x0073('0xd')](_0x0073('0x1d'),QUERY,_0x5c69e8,_0xfcd18a),{'type':dbH[_0x0073('0x13')][_0x0073('0x14')][_0x0073('0x15')]}));});if(_0x16b4e3>0x0){_0xfcd18a+=_0x5c69e8;_0x151913[_0x0073('0x1c')](dbH['sequelize'][_0x0073('0x1e')](util[_0x0073('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16b4e3,_0xfcd18a),{'type':dbH[_0x0073('0x13')][_0x0073('0x14')][_0x0073('0x15')]}));}}}else{_0x151913[_0x0073('0x1c')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x0073('0x13')][_0x0073('0x14')]['SELECT']}));}var _0x2451ee=path[_0x0073('0x1f')](PATH);var _0x45dfee=path[_0x0073('0x20')](PATH,_0x0073('0x21'));var _0x1f8df0=_0x3b2b78[_0x0073('0x18')]&&_0x151913[_0x0073('0x19')]>0x1;var _0x531319=[];if(!fs[_0x0073('0x22')](path[_0x0073('0x23')](_0x2451ee,_0x45dfee))&&_0x1f8df0){fs[_0x0073('0x24')](path[_0x0073('0x23')](_0x2451ee,_0x45dfee));}return BPromise['each'](_0x151913,function(_0xddd07d){_0x531319['push'](_0xddd07d);})[_0x0073('0x12')](function(){for(var _0x7b1cf4=0x0;_0x7b1cf4<_0x531319['length'];_0x7b1cf4+=0x1){var _0x20d785;var _0x345a97=_0x531319[_0x7b1cf4];if(_0x1f8df0){_0x20d785=path[_0x0073('0x23')](_0x2451ee,_0x45dfee,util['format'](_0x0073('0x25'),_0x45dfee,_0x7b1cf4,_0x0073('0x26')));}else{_0x20d785=path[_0x0073('0x23')](_0x2451ee,util['format'](_0x0073('0x27'),_0x45dfee,_0x0073('0x26')));}fs[_0x0073('0x28')](_0x20d785,csv(_0x345a97));}})['then'](function(){if(_0x1f8df0){return new Promise(function(_0x154661){zipdir(path[_0x0073('0x23')](_0x2451ee,_0x45dfee),{'saveTo':path[_0x0073('0x23')](_0x2451ee,util['format'](_0x0073('0x27'),_0x45dfee,'zip'))},function(_0x3a4673,_0x5757e0){rimraf(path[_0x0073('0x23')](_0x2451ee,_0x45dfee),function(){});_0x154661('zip\x20finished');});});}})[_0x0073('0x12')](function(){logger[_0x0073('0xc')](util[_0x0073('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0073('0xf')));return analyticExtractedReport(_0x0073('0x29'),_0x1f8df0?util[_0x0073('0xd')](_0x0073('0x27'),_0x45dfee,_0x1f8df0?'zip':_0x0073('0x26')):null);});})[_0x0073('0x2a')](function(_0xed3e5){logger[_0x0073('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0073('0xf')),util[_0x0073('0x2b')](_0xed3e5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0073('0x2c'));})[_0x0073('0x2d')](function(){process[_0x0073('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 03223fd..324f04c 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 _0x99d5=['flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','catch','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','path','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','pick','toString','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0x99d5,0xda));var _0x599d=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0x99d5[_0x425b19];return _0x15ecab;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x599d('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x599d('0x1'));var PdfPrinter=require(_0x599d('0x2'));var zipdir=require(_0x599d('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0x599d('0x4'))[_0x599d('0x5')];var window=new JSDOM('')[_0x599d('0x6')];var BPromise=require(_0x599d('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x599d('0x8'))['dbH'];var logger=require(_0x599d('0x9'))(_0x599d('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x599d('0xb')][0x2]);var QUERY=process[_0x599d('0xb')][0x3];var PATH=process[_0x599d('0xb')][0x4];var NAME=process[_0x599d('0xb')][0x5];var FORMAT=_0x599d('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x41917e,_0x40e40d){var _0x176eae={'status':_0x41917e};var _0x28cba8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40e40d){_0x176eae['savename']=_0x40e40d;}return db[_0x599d('0xd')][_0x599d('0xe')](_0x176eae,_0x28cba8);}function getHeaders(_0x35683a){return _['map'](_0x35683a,function(_0x35f7a0){return{'text':_0x35f7a0,'style':_0x599d('0xf')};});}function getRows(_0x363bfd,_0x98cd74){return _[_0x599d('0x10')](_0x98cd74,function(_0x541b35){return _(_0x541b35)[_0x599d('0x11')](_0x363bfd)[_0x599d('0x10')](function(_0x55a18e){return _0x55a18e?_[_0x599d('0x12')](_0x55a18e):'';})['value']();});}function createTable(_0x444be9,_0x5082f7){var _0x191340={'widths':_[_0x599d('0x13')](Array(_0x444be9[_0x599d('0x14')]),0x91),'heights':function(_0x1048fb){return _0x1048fb===0x0?_0x599d('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4271a7=getHeaders(_0x444be9);_0x191340[_0x599d('0x16')][_0x599d('0x17')](_0x4271a7);var _0x128aeb=getRows(_0x444be9,_0x5082f7);_0x191340[_0x599d('0x16')]=_0x191340['body']['concat'](_0x128aeb);return _0x191340;}function createTables(_0x50d313){var _0x1579fb=[];var _0x304d39=_[_0x599d('0x18')](Object[_0x599d('0x19')](_0x50d313[0x0]),0x5);_0x304d39[_0x599d('0x1a')](function(_0x11bfd1){_0x1579fb[_0x599d('0x17')](createTable(_0x11bfd1,_0x50d313));});return _0x1579fb;}function getPDFDocDefinition(_0x1aeda2){var _0x3d14dc=util[_0x599d('0x1b')](_0x599d('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x599d('0x1d')])[_0x599d('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x599d('0x1e')])['format'](FORMAT));var _0x276a86=[];for(var _0x4f9d84=0x0;_0x4f9d84<_0x1aeda2[_0x599d('0x14')];_0x4f9d84++){var _0x1e98ab=[];if(_0x4f9d84===0x0){_0x1e98ab['push']({'text':_0x3d14dc,'style':_0x599d('0x1f')});}var _0x49994b={'table':_0x1aeda2[_0x4f9d84]};if(_0x4f9d84>0x0){_0x49994b[_0x599d('0x20')]=_0x599d('0x21');_0x49994b[_0x599d('0x22')]=[0x0,0x46,0x0,0x0];}_0x1e98ab['push'](_0x49994b);_0x276a86[_0x599d('0x17')](_0x1e98ab);}return{'pageSize':'A4','pageOrientation':_0x599d('0x23'),'content':_0x276a86,'footer':function(_0x255842,_0x24d21e){return{'text':_0x255842[_0x599d('0x12')]()+_0x599d('0x24')+_0x24d21e,'style':_0x599d('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x599d('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x40c3ea){var _0x3afae3=0x1388;var _0x1bb433;if(!_0x40c3ea[0x0][_0x599d('0x27')]){return analyticExtractedReport(_0x599d('0x28'));}return db[_0x599d('0x29')][_0x599d('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x599d('0x2b'),_0x599d('0x2c')]})[_0x599d('0x2d')](function(_0x311015){if(_0x311015){_0x1bb433=_0x311015;_0x3afae3=_0x1bb433['splitSizePdf']||0x3e8;}})[_0x599d('0x2d')](function(){var _0x37447a=[];var _0x383392=0x0;if(_0x1bb433[_0x599d('0x2b')]){if(_0x40c3ea&&_0x40c3ea['length']){var _0xd63a64=_[_0x599d('0x2e')](_0x40c3ea[0x0]['num']/_0x3afae3);var _0x5706d0=Number[_0x599d('0x2f')](_0x40c3ea[0x0][_0x599d('0x27')]/_0x3afae3)?_0x40c3ea[0x0][_0x599d('0x27')]%_0x3afae3:0x0;_0xd63a64[_0x599d('0x1a')](function(_0x40e10c){if(_0x40e10c>0x0){_0x383392+=_0x3afae3;}_0x37447a[_0x599d('0x17')](dbH[_0x599d('0x30')][_0x599d('0x31')](util[_0x599d('0x1b')](_0x599d('0x32'),QUERY,_0x3afae3,_0x383392),{'type':dbH[_0x599d('0x30')]['QueryTypes'][_0x599d('0x33')]}));});if(_0x5706d0>0x0){_0x383392+=_0x3afae3;_0x37447a[_0x599d('0x17')](dbH[_0x599d('0x30')]['query'](util[_0x599d('0x1b')](_0x599d('0x32'),QUERY,_0x5706d0,_0x383392),{'type':dbH['sequelize']['QueryTypes'][_0x599d('0x33')]}));}}}else{_0x37447a[_0x599d('0x17')](dbH['sequelize'][_0x599d('0x31')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x14db3c=path[_0x599d('0x34')](PATH);var _0x2261bb=path[_0x599d('0x35')](PATH,_0x599d('0x36'));var _0x316543=_0x1bb433['split']&&_0x37447a['length']>0x1;var _0x197ed1=[];if(!fs[_0x599d('0x37')](path[_0x599d('0x38')](_0x14db3c,_0x2261bb))&&_0x316543){fs[_0x599d('0x39')](path[_0x599d('0x38')](_0x14db3c,_0x2261bb));}return BPromise['each'](_0x37447a,function(_0x22ba34){_0x197ed1[_0x599d('0x17')](_0x22ba34);})['then'](function(){var _0x370eb5=[];for(var _0x3752b4=0x0;_0x3752b4<_0x197ed1[_0x599d('0x14')];_0x3752b4+=0x1){var _0x35550d=_0x197ed1[_0x3752b4];var _0x13e1f7=createTables(_[_0x599d('0x3a')](_0x35550d));var _0x1fcf12;var _0x5aa3b1=getPDFDocDefinition(_0x13e1f7);var _0x373b33=getPDFPrinter();var _0x10316a=_0x373b33[_0x599d('0x3b')](_0x5aa3b1);if(_0x316543){_0x1fcf12=path[_0x599d('0x38')](_0x14db3c,_0x2261bb,util[_0x599d('0x1b')](_0x599d('0x3c'),_0x2261bb,_0x3752b4,_0x599d('0x3d')));}else{_0x1fcf12=path['join'](_0x14db3c,util['format'](_0x599d('0x3e'),_0x2261bb,_0x599d('0x3d')));}_0x370eb5[_0x599d('0x17')](writePDFDocument(_0x10316a,_0x1fcf12));}return Promise[_0x599d('0x3f')](_0x370eb5);})['then'](function(){if(_0x316543){return new Promise(function(_0x11ff2e){zipdir(path[_0x599d('0x38')](_0x14db3c,_0x2261bb),{'saveTo':path[_0x599d('0x38')](_0x14db3c,util[_0x599d('0x1b')](_0x599d('0x3e'),_0x2261bb,_0x599d('0x40')))},function(){rimraf(path[_0x599d('0x38')](_0x14db3c,_0x2261bb),function(){});_0x11ff2e(_0x599d('0x41'));});});}})[_0x599d('0x2d')](function(){if(!_0x316543)return;rimraf(path[_0x599d('0x38')](_0x14db3c,_0x2261bb),function(){});})[_0x599d('0x2d')](function(){logger['info'](util[_0x599d('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x599d('0x42')));return analyticExtractedReport('Completed',_0x316543?util['format'](_0x599d('0x3e'),_0x2261bb,_0x316543?_0x599d('0x40'):_0x599d('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x599d('0x43')](util[_0x599d('0x1b')](_0x599d('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x599d('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x599d('0x2d')](function(_0x36c0d7){EXTRACTED_REPORT=_0x36c0d7;return dbH[_0x599d('0x30')][_0x599d('0x31')](util[_0x599d('0x1b')](_0x599d('0x45'),QUERY),{'type':dbH[_0x599d('0x30')][_0x599d('0x46')][_0x599d('0x33')]});})[_0x599d('0x2d')](extractReport)[_0x599d('0x47')](function(_0x48fc96){logger['info'](util[_0x599d('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x599d('0x42')),util[_0x599d('0x48')](_0x48fc96,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x599d('0x49'));})[_0x599d('0x4a')](function(){process[_0x599d('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x141f3d=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x599d('0x4c'),'italics':__dirname+_0x599d('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x141f3d;}function getPDFDocDefinitionFromHTML(_0x2c2d8b,_0xea357f){var _0x71b262=util['format'](_0x599d('0x4e'),_0xea357f[_0x599d('0x4f')],_0xea357f[_0x599d('0x50')]);var _0x216063=moment()[_0x599d('0x1b')](_0x599d('0x51'))[_0x599d('0x12')]();var _0x300f1b=htmlToPdfmake(_0x2c2d8b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x300f1b],'defaultStyle':{'font':_0x599d('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x599d('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x599d('0x54'),'style':_0x599d('0x1f')}];},'footer':function(_0x4719ab,_0x486897){return[{'text':util[_0x599d('0x1b')](_0x599d('0x55'),_0x71b262,_0x4719ab,_0x486897,_0x216063),'style':'footer'}];}};}function writePDFDocument(_0x50c482,_0x4a23e8){return new Promise(function(_0x3fffc1,_0xd82827){var _0x213b9c=_0x50c482[_0x599d('0x56')](fs[_0x599d('0x57')](_0x4a23e8));_0x213b9c['on']('finish',function(){_0x3fffc1(_0x599d('0x58'));});_0x213b9c['on'](_0x599d('0x59'),function(_0x3fe3a5){_0xd82827(_0x3fe3a5);});_0x50c482[_0x599d('0x5a')]();});}exports['createPdfFromHTML']=function(_0x2b1c5d,_0x2fc934){var _0x4cfdf0=getPDFPrinter();var _0x439d1e=getPDFDocDefinitionFromHTML(_0x2b1c5d,_0x2fc934);var _0x1db542=_0x4cfdf0[_0x599d('0x3b')](_0x439d1e);return writePDFDocument(_0x1db542,_0x2fc934[_0x599d('0x5b')])[_0x599d('0x47')](function(_0x362d22){throw _0x362d22;});}; \ No newline at end of file +var _0xc1e1=['pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Setting','find','split','then','range','isInteger','sequelize','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','flatten','createPdfKitDocument','pdf','%s.%s','all','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','length','header'];(function(_0x341850,_0x227d13){var _0x550b31=function(_0x2c78f9){while(--_0x2c78f9){_0x341850['push'](_0x341850['shift']());}};_0x550b31(++_0x227d13);}(_0xc1e1,0x95));var _0x1c1e=function(_0x26e0f5,_0x4d001b){_0x26e0f5=_0x26e0f5-0x0;var _0x35f262=_0xc1e1[_0x26e0f5];return _0x35f262;};'use strict';var _=require(_0x1c1e('0x0'));var fs=require('fs');var util=require(_0x1c1e('0x1'));var path=require(_0x1c1e('0x2'));var moment=require(_0x1c1e('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x1c1e('0x4'));var zipdir=require(_0x1c1e('0x5'));var rimraf=require(_0x1c1e('0x6'));var JSDOM=require(_0x1c1e('0x7'))[_0x1c1e('0x8')];var window=new JSDOM('')[_0x1c1e('0x9')];var BPromise=require(_0x1c1e('0xa'));var db=require(_0x1c1e('0xb'))['db'];var dbH=require(_0x1c1e('0xb'))[_0x1c1e('0xc')];var logger=require(_0x1c1e('0xd'))(_0x1c1e('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x1c1e('0xf')][0x2]);var QUERY=process[_0x1c1e('0xf')][0x3];var PATH=process[_0x1c1e('0xf')][0x4];var NAME=process[_0x1c1e('0xf')][0x5];var FORMAT=_0x1c1e('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14683b,_0x2b878e){var _0x2ef334={'status':_0x14683b};var _0x2345a4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b878e){_0x2ef334['savename']=_0x2b878e;}return db[_0x1c1e('0x11')][_0x1c1e('0x12')](_0x2ef334,_0x2345a4);}function getHeaders(_0x3ce839){return _[_0x1c1e('0x13')](_0x3ce839,function(_0x334dee){return{'text':_0x334dee,'style':_0x1c1e('0x14')};});}function getRows(_0x15a8c5,_0x4011ae){return _['map'](_0x4011ae,function(_0x2b860e){return _(_0x2b860e)[_0x1c1e('0x15')](_0x15a8c5)['map'](function(_0xfeb103){return _0xfeb103?_[_0x1c1e('0x16')](_0xfeb103):'';})[_0x1c1e('0x17')]();});}function createTable(_0x294786,_0xe5fdc7){var _0x55d931={'widths':_[_0x1c1e('0x18')](Array(_0x294786['length']),0x91),'heights':function(_0x21f878){return _0x21f878===0x0?_0x1c1e('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3777aa=getHeaders(_0x294786);_0x55d931[_0x1c1e('0x1a')][_0x1c1e('0x1b')](_0x3777aa);var _0x39aa61=getRows(_0x294786,_0xe5fdc7);_0x55d931[_0x1c1e('0x1a')]=_0x55d931[_0x1c1e('0x1a')][_0x1c1e('0x1c')](_0x39aa61);return _0x55d931;}function createTables(_0x3f56d2){var _0x96216c=[];var _0x557b3c=_[_0x1c1e('0x1d')](Object['keys'](_0x3f56d2[0x0]),0x5);_0x557b3c[_0x1c1e('0x1e')](function(_0x2981fa){_0x96216c[_0x1c1e('0x1b')](createTable(_0x2981fa,_0x3f56d2));});return _0x96216c;}function getPDFDocDefinition(_0x580c7e){var _0x37196d=util[_0x1c1e('0x1f')](_0x1c1e('0x20'),NAME,EXTRACTED_REPORT[_0x1c1e('0x21')],moment(EXTRACTED_REPORT['startDate'])[_0x1c1e('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x1c1e('0x22')])[_0x1c1e('0x1f')](FORMAT));var _0x1bad7d=[];for(var _0x2f7613=0x0;_0x2f7613<_0x580c7e[_0x1c1e('0x23')];_0x2f7613++){var _0x46feed=[];if(_0x2f7613===0x0){_0x46feed[_0x1c1e('0x1b')]({'text':_0x37196d,'style':_0x1c1e('0x24')});}var _0x331f7f={'table':_0x580c7e[_0x2f7613]};if(_0x2f7613>0x0){_0x331f7f[_0x1c1e('0x25')]=_0x1c1e('0x26');_0x331f7f[_0x1c1e('0x27')]=[0x0,0x46,0x0,0x0];}_0x46feed[_0x1c1e('0x1b')](_0x331f7f);_0x1bad7d[_0x1c1e('0x1b')](_0x46feed);}return{'pageSize':'A4','pageOrientation':_0x1c1e('0x28'),'content':_0x1bad7d,'footer':function(_0x493b66,_0x3450dd){return{'text':_0x493b66[_0x1c1e('0x16')]()+_0x1c1e('0x29')+_0x3450dd,'style':_0x1c1e('0x2a')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1c1e('0x2b')},'footer':{'alignment':_0x1c1e('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x27c16f){var _0xd896f2=0x1388;var _0x1a8f8f;if(!_0x27c16f[0x0][_0x1c1e('0x2d')]){return analyticExtractedReport('Empty');}return db[_0x1c1e('0x2e')][_0x1c1e('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1c1e('0x30'),'splitSizePdf']})['then'](function(_0x1b9277){if(_0x1b9277){_0x1a8f8f=_0x1b9277;_0xd896f2=_0x1a8f8f['splitSizePdf']||0x3e8;}})[_0x1c1e('0x31')](function(){var _0x41a009=[];var _0x332939=0x0;if(_0x1a8f8f[_0x1c1e('0x30')]){if(_0x27c16f&&_0x27c16f[_0x1c1e('0x23')]){var _0x48a595=_[_0x1c1e('0x32')](_0x27c16f[0x0][_0x1c1e('0x2d')]/_0xd896f2);var _0x4bd46f=Number[_0x1c1e('0x33')](_0x27c16f[0x0][_0x1c1e('0x2d')]/_0xd896f2)?_0x27c16f[0x0]['num']%_0xd896f2:0x0;_0x48a595[_0x1c1e('0x1e')](function(_0x4e5de7){if(_0x4e5de7>0x0){_0x332939+=_0xd896f2;}_0x41a009[_0x1c1e('0x1b')](dbH[_0x1c1e('0x34')][_0x1c1e('0x35')](util[_0x1c1e('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xd896f2,_0x332939),{'type':dbH['sequelize'][_0x1c1e('0x36')]['SELECT']}));});if(_0x4bd46f>0x0){_0x332939+=_0xd896f2;_0x41a009[_0x1c1e('0x1b')](dbH['sequelize'][_0x1c1e('0x35')](util[_0x1c1e('0x1f')](_0x1c1e('0x37'),QUERY,_0x4bd46f,_0x332939),{'type':dbH['sequelize'][_0x1c1e('0x36')][_0x1c1e('0x38')]}));}}}else{_0x41a009[_0x1c1e('0x1b')](dbH[_0x1c1e('0x34')][_0x1c1e('0x35')](QUERY,{'type':dbH[_0x1c1e('0x34')]['QueryTypes'][_0x1c1e('0x38')]}));}var _0x336cf4=path[_0x1c1e('0x39')](PATH);var _0x45b702=path[_0x1c1e('0x3a')](PATH,_0x1c1e('0x3b'));var _0x3c507e=_0x1a8f8f[_0x1c1e('0x30')]&&_0x41a009[_0x1c1e('0x23')]>0x1;var _0x36d082=[];if(!fs[_0x1c1e('0x3c')](path['join'](_0x336cf4,_0x45b702))&&_0x3c507e){fs[_0x1c1e('0x3d')](path[_0x1c1e('0x3e')](_0x336cf4,_0x45b702));}return BPromise['each'](_0x41a009,function(_0x54bd0e){_0x36d082[_0x1c1e('0x1b')](_0x54bd0e);})['then'](function(){var _0x2eef2f=[];for(var _0x3189d3=0x0;_0x3189d3<_0x36d082[_0x1c1e('0x23')];_0x3189d3+=0x1){var _0x28cc3d=_0x36d082[_0x3189d3];var _0x3ac4d=createTables(_[_0x1c1e('0x3f')](_0x28cc3d));var _0x473ece;var _0x2d6f24=getPDFDocDefinition(_0x3ac4d);var _0x15a98b=getPDFPrinter();var _0x415638=_0x15a98b[_0x1c1e('0x40')](_0x2d6f24);if(_0x3c507e){_0x473ece=path[_0x1c1e('0x3e')](_0x336cf4,_0x45b702,util[_0x1c1e('0x1f')]('%s%d.%s',_0x45b702,_0x3189d3,_0x1c1e('0x41')));}else{_0x473ece=path[_0x1c1e('0x3e')](_0x336cf4,util[_0x1c1e('0x1f')](_0x1c1e('0x42'),_0x45b702,_0x1c1e('0x41')));}_0x2eef2f[_0x1c1e('0x1b')](writePDFDocument(_0x415638,_0x473ece));}return Promise[_0x1c1e('0x43')](_0x2eef2f);})[_0x1c1e('0x31')](function(){if(_0x3c507e){return new Promise(function(_0x65655b){zipdir(path[_0x1c1e('0x3e')](_0x336cf4,_0x45b702),{'saveTo':path[_0x1c1e('0x3e')](_0x336cf4,util[_0x1c1e('0x1f')]('%s.%s',_0x45b702,'zip'))},function(){rimraf(path[_0x1c1e('0x3e')](_0x336cf4,_0x45b702),function(){});_0x65655b('zip\x20finished');});});}})[_0x1c1e('0x31')](function(){if(!_0x3c507e)return;rimraf(path[_0x1c1e('0x3e')](_0x336cf4,_0x45b702),function(){});})[_0x1c1e('0x31')](function(){logger['info'](util[_0x1c1e('0x1f')](_0x1c1e('0x44'),EXTRACTED_REPORT_ID,_0x1c1e('0x45')));return analyticExtractedReport(_0x1c1e('0x46'),_0x3c507e?util['format'](_0x1c1e('0x42'),_0x45b702,_0x3c507e?'zip':_0x1c1e('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x1c1e('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1c1e('0x45')));return db['AnalyticExtractedReport'][_0x1c1e('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1c1e('0x31')](function(_0x23a274){EXTRACTED_REPORT=_0x23a274;return dbH[_0x1c1e('0x34')][_0x1c1e('0x35')](util['format'](_0x1c1e('0x48'),QUERY),{'type':dbH[_0x1c1e('0x34')][_0x1c1e('0x36')][_0x1c1e('0x38')]});})[_0x1c1e('0x31')](extractReport)['catch'](function(_0x25f479){logger[_0x1c1e('0x49')](util[_0x1c1e('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1c1e('0x45')),util[_0x1c1e('0x4a')](_0x25f479,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1c1e('0x4b')](function(){process[_0x1c1e('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x16002e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x1c1e('0x4d'),'italics':__dirname+_0x1c1e('0x4e'),'bolditalics':__dirname+_0x1c1e('0x4f')}});return _0x16002e;}function getPDFDocDefinitionFromHTML(_0x26927a,_0x4ca297){var _0x587a24=util[_0x1c1e('0x1f')](_0x1c1e('0x50'),_0x4ca297[_0x1c1e('0x51')],_0x4ca297[_0x1c1e('0x52')]);var _0x4f6374=moment()[_0x1c1e('0x1f')](_0x1c1e('0x53'))[_0x1c1e('0x16')]();var _0x1bb60f=htmlToPdfmake(_0x26927a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1bb60f],'defaultStyle':{'font':_0x1c1e('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1c1e('0x55')}},'header':function(){return[{'text':_0x1c1e('0x56'),'style':'header'}];},'footer':function(_0x23d17a,_0x2811fc){return[{'text':util[_0x1c1e('0x1f')](_0x1c1e('0x57'),_0x587a24,_0x23d17a,_0x2811fc,_0x4f6374),'style':_0x1c1e('0x2a')}];}};}function writePDFDocument(_0x27f23b,_0x210470){return new Promise(function(_0x2b3418,_0x3f6a38){var _0x5bd437=_0x27f23b['pipe'](fs['createWriteStream'](_0x210470));_0x5bd437['on'](_0x1c1e('0x58'),function(){_0x2b3418('finish');});_0x5bd437['on'](_0x1c1e('0x59'),function(_0x391d2a){_0x3f6a38(_0x391d2a);});_0x27f23b[_0x1c1e('0x5a')]();});}exports[_0x1c1e('0x5b')]=function(_0xcdbd31,_0x588e40){var _0x3db334=getPDFPrinter();var _0x5d45e5=getPDFDocDefinitionFromHTML(_0xcdbd31,_0x588e40);var _0x3b1301=_0x3db334[_0x1c1e('0x40')](_0x5d45e5);return writePDFDocument(_0x3b1301,_0x588e40[_0x1c1e('0x2')])[_0x1c1e('0x5c')](function(_0x3d0ed0){throw _0x3d0ed0;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e943c58..9bfecd4 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 _0x112f=['dirname','.xlsx','length','join','each','%s%d.%s','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT'];(function(_0x493720,_0x2e7724){var _0x3cfc8e=function(_0x1ceb74){while(--_0x1ceb74){_0x493720['push'](_0x493720['shift']());}};_0x3cfc8e(++_0x2e7724);}(_0x112f,0x11e));var _0xf112=function(_0x5476fa,_0x29074c){_0x5476fa=_0x5476fa-0x0;var _0x1f19ca=_0x112f[_0x5476fa];return _0x1f19ca;};'use strict';var util=require(_0xf112('0x0'));var path=require('path');var _=require(_0xf112('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf112('0x2'));var zipdir=require(_0xf112('0x3'));var rimraf=require(_0xf112('0x4'));var db=require(_0xf112('0x5'))['db'];var dbH=require('../../mysqldb')[_0xf112('0x6')];var logger=require('../../config/logger')(_0xf112('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf112('0x8')][0x2]);var QUERY=process[_0xf112('0x8')][0x3];var PATH=process[_0xf112('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fcbcb,_0x3f0411){var _0x48aaf0={'status':_0x2fcbcb};var _0x420e3c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f0411){_0x48aaf0['savename']=_0x3f0411;}return db[_0xf112('0x9')][_0xf112('0xa')](_0x48aaf0,_0x420e3c);}function main(){var _0x1301b5=0x1388;var _0x4310a7;logger[_0xf112('0xb')](util[_0xf112('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xf112('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf112('0xe'),_0xf112('0xf')]})[_0xf112('0x10')](function(_0x350f60){if(_0x350f60){_0x4310a7=_0x350f60;_0x1301b5=_0x4310a7[_0xf112('0xf')]||0x1388;}})[_0xf112('0x10')](function(){return dbH[_0xf112('0x11')][_0xf112('0x12')](util['format'](_0xf112('0x13'),QUERY),{'type':dbH['sequelize'][_0xf112('0x14')]['SELECT']});})[_0xf112('0x10')](function(_0x5111e9){if(!_0x5111e9[0x0][_0xf112('0x15')]){return analyticExtractedReport(_0xf112('0x16'));}var _0x3e5780=[];var _0x3df24b=0x0;if(_0x4310a7[_0xf112('0xe')]){if(_0x5111e9&&_0x5111e9['length']){var _0x443f47=_[_0xf112('0x17')](_0x5111e9[0x0]['num']/_0x1301b5);var _0x16d575=Number[_0xf112('0x18')](_0x5111e9[0x0][_0xf112('0x15')]/_0x1301b5)?_0x5111e9[0x0]['num']%_0x1301b5:0x0;_0x443f47[_0xf112('0x19')](function(_0x456c8b){if(_0x456c8b>0x0){_0x3df24b+=_0x1301b5;}_0x3e5780[_0xf112('0x1a')](dbH[_0xf112('0x11')][_0xf112('0x12')](util[_0xf112('0xc')](_0xf112('0x1b'),QUERY,_0x1301b5,_0x3df24b),{'type':dbH[_0xf112('0x11')][_0xf112('0x14')][_0xf112('0x1c')]}));});if(_0x16d575>0x0){_0x3df24b+=_0x1301b5;_0x3e5780[_0xf112('0x1a')](dbH['sequelize'][_0xf112('0x12')](util['format'](_0xf112('0x1b'),QUERY,_0x16d575,_0x3df24b),{'type':dbH[_0xf112('0x11')][_0xf112('0x14')][_0xf112('0x1c')]}));}}}else{_0x3e5780[_0xf112('0x1a')](dbH[_0xf112('0x11')][_0xf112('0x12')](QUERY,{'type':dbH[_0xf112('0x11')][_0xf112('0x14')][_0xf112('0x1c')]}));}var _0x27a894=path[_0xf112('0x1d')](PATH);var _0x48a5c9=path['basename'](PATH,_0xf112('0x1e'));var _0x938bb0=_0x4310a7['split']&&_0x3e5780[_0xf112('0x1f')]>0x1;var _0x16a491=[];if(!fs['existsSync'](path[_0xf112('0x20')](_0x27a894,_0x48a5c9))&&_0x938bb0){fs['mkdirSync'](path['join'](_0x27a894,_0x48a5c9));}return BPromise[_0xf112('0x21')](_0x3e5780,function(_0x1967df){_0x16a491['push'](_0x1967df);})['then'](function(){for(var _0x167c07=0x0;_0x167c07<_0x16a491[_0xf112('0x1f')];_0x167c07+=0x1){var _0x85dc43;var _0x17f157=_0x16a491[_0x167c07];if(_0x938bb0){_0x85dc43=path[_0xf112('0x20')](_0x27a894,_0x48a5c9,util[_0xf112('0xc')](_0xf112('0x22'),_0x48a5c9,_0x167c07,'xlsx'));}else{_0x85dc43=path['join'](_0x27a894,util[_0xf112('0xc')](_0xf112('0x23'),_0x48a5c9,'xlsx'));}fs[_0xf112('0x24')](_0x85dc43,json2xls(_0x17f157),'binary');}})[_0xf112('0x10')](function(){if(_0x938bb0){return new Promise(function(_0x427e5e){zipdir(path['join'](_0x27a894,_0x48a5c9),{'saveTo':path[_0xf112('0x20')](_0x27a894,util[_0xf112('0xc')](_0xf112('0x23'),_0x48a5c9,'zip'))},function(_0x290c6a,_0x2e5d15){rimraf(path[_0xf112('0x20')](_0x27a894,_0x48a5c9),function(){});_0x427e5e('zip\x20finished');});});}})[_0xf112('0x10')](function(){logger['info'](util[_0xf112('0xc')](_0xf112('0x25'),EXTRACTED_REPORT_ID,_0xf112('0x26')));return analyticExtractedReport('Completed',_0x938bb0?util[_0xf112('0xc')](_0xf112('0x23'),_0x48a5c9,_0x938bb0?'zip':'xlsx'):null);});})[_0xf112('0x27')](function(_0x3c11e2){logger[_0xf112('0xb')](util[_0xf112('0xc')](_0xf112('0x28'),EXTRACTED_REPORT_ID,_0xf112('0x26')),util[_0xf112('0x29')](_0x3c11e2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf112('0x2a'));})[_0xf112('0x2b')](function(){process[_0xf112('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9ee6=['AnalyticExtractedReport','update','format','find','split','splitSizeXlsx','then','query','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x9ee6,0x84));var _0x69ee=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9ee6[_0x13b02f];return _0x12e9a6;};'use strict';var util=require(_0x69ee('0x0'));var path=require(_0x69ee('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x69ee('0x2'));var BPromise=require(_0x69ee('0x3'));var zipdir=require(_0x69ee('0x4'));var rimraf=require(_0x69ee('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x69ee('0x6'))[_0x69ee('0x7')];var logger=require(_0x69ee('0x8'))(_0x69ee('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x69ee('0xa')][0x2]);var QUERY=process[_0x69ee('0xa')][0x3];var PATH=process[_0x69ee('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44c215,_0x2b633f){var _0x21c556={'status':_0x44c215};var _0xa68135={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b633f){_0x21c556[_0x69ee('0xb')]=_0x2b633f;}return db[_0x69ee('0xc')][_0x69ee('0xd')](_0x21c556,_0xa68135);}function main(){var _0x303358=0x1388;var _0x203d5e;logger['info'](util[_0x69ee('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x69ee('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x69ee('0x10'),_0x69ee('0x11')]})[_0x69ee('0x12')](function(_0x581308){if(_0x581308){_0x203d5e=_0x581308;_0x303358=_0x203d5e[_0x69ee('0x11')]||0x1388;}})[_0x69ee('0x12')](function(){return dbH['sequelize'][_0x69ee('0x13')](util[_0x69ee('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x69ee('0x14')][_0x69ee('0x15')]});})[_0x69ee('0x12')](function(_0x371c59){if(!_0x371c59[0x0][_0x69ee('0x16')]){return analyticExtractedReport(_0x69ee('0x17'));}var _0x3a3423=[];var _0x1c758b=0x0;if(_0x203d5e[_0x69ee('0x10')]){if(_0x371c59&&_0x371c59[_0x69ee('0x18')]){var _0x133bca=_[_0x69ee('0x19')](_0x371c59[0x0]['num']/_0x303358);var _0x194170=Number['isInteger'](_0x371c59[0x0][_0x69ee('0x16')]/_0x303358)?_0x371c59[0x0]['num']%_0x303358:0x0;_0x133bca[_0x69ee('0x1a')](function(_0x8274a4){if(_0x8274a4>0x0){_0x1c758b+=_0x303358;}_0x3a3423[_0x69ee('0x1b')](dbH['sequelize'][_0x69ee('0x13')](util[_0x69ee('0xe')](_0x69ee('0x1c'),QUERY,_0x303358,_0x1c758b),{'type':dbH[_0x69ee('0x1d')][_0x69ee('0x14')][_0x69ee('0x15')]}));});if(_0x194170>0x0){_0x1c758b+=_0x303358;_0x3a3423[_0x69ee('0x1b')](dbH[_0x69ee('0x1d')][_0x69ee('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x194170,_0x1c758b),{'type':dbH[_0x69ee('0x1d')][_0x69ee('0x14')][_0x69ee('0x15')]}));}}}else{_0x3a3423[_0x69ee('0x1b')](dbH['sequelize'][_0x69ee('0x13')](QUERY,{'type':dbH[_0x69ee('0x1d')][_0x69ee('0x14')][_0x69ee('0x15')]}));}var _0x584b8c=path[_0x69ee('0x1e')](PATH);var _0x50a1f2=path['basename'](PATH,'.xlsx');var _0x3ff96b=_0x203d5e[_0x69ee('0x10')]&&_0x3a3423['length']>0x1;var _0x2fa996=[];if(!fs[_0x69ee('0x1f')](path[_0x69ee('0x20')](_0x584b8c,_0x50a1f2))&&_0x3ff96b){fs[_0x69ee('0x21')](path[_0x69ee('0x20')](_0x584b8c,_0x50a1f2));}return BPromise['each'](_0x3a3423,function(_0x51e964){_0x2fa996[_0x69ee('0x1b')](_0x51e964);})[_0x69ee('0x12')](function(){for(var _0x3e9573=0x0;_0x3e9573<_0x2fa996[_0x69ee('0x18')];_0x3e9573+=0x1){var _0x2db35b;var _0x51eb5f=_0x2fa996[_0x3e9573];if(_0x3ff96b){_0x2db35b=path[_0x69ee('0x20')](_0x584b8c,_0x50a1f2,util['format']('%s%d.%s',_0x50a1f2,_0x3e9573,_0x69ee('0x22')));}else{_0x2db35b=path[_0x69ee('0x20')](_0x584b8c,util[_0x69ee('0xe')](_0x69ee('0x23'),_0x50a1f2,_0x69ee('0x22')));}fs[_0x69ee('0x24')](_0x2db35b,json2xls(_0x51eb5f),_0x69ee('0x25'));}})[_0x69ee('0x12')](function(){if(_0x3ff96b){return new Promise(function(_0x44b39b){zipdir(path['join'](_0x584b8c,_0x50a1f2),{'saveTo':path[_0x69ee('0x20')](_0x584b8c,util[_0x69ee('0xe')](_0x69ee('0x23'),_0x50a1f2,_0x69ee('0x26')))},function(_0x52e4b0,_0x2495e2){rimraf(path['join'](_0x584b8c,_0x50a1f2),function(){});_0x44b39b(_0x69ee('0x27'));});});}})[_0x69ee('0x12')](function(){logger[_0x69ee('0x28')](util[_0x69ee('0xe')](_0x69ee('0x29'),EXTRACTED_REPORT_ID,_0x69ee('0x2a')));return analyticExtractedReport(_0x69ee('0x2b'),_0x3ff96b?util['format'](_0x69ee('0x23'),_0x50a1f2,_0x3ff96b?_0x69ee('0x26'):_0x69ee('0x22')):null);});})[_0x69ee('0x2c')](function(_0x2145cd){logger[_0x69ee('0x28')](util[_0x69ee('0xe')](_0x69ee('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x69ee('0x2e')](_0x2145cd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x69ee('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3b133ef..9feaabb 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 _0xb598=['type','CDR(type)=%s','context','VoiceExtensionId','Set','extension','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','toLowerCase','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','sortBy','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','find','push'];(function(_0x16c49a,_0x1f0aa1){var _0x1be004=function(_0x26a1ca){while(--_0x26a1ca){_0x16c49a['push'](_0x16c49a['shift']());}};_0x1be004(++_0x1f0aa1);}(_0xb598,0x178));var _0x8b59=function(_0x25b41a,_0x34ea6a){_0x25b41a=_0x25b41a-0x0;var _0x58a856=_0xb598[_0x25b41a];return _0x58a856;};'use strict';var _=require(_0x8b59('0x0'));var util=require(_0x8b59('0x1'));function rewrite(_0x583cd2,_0x3e388e){var _0x4cea61=this;return _0x583cd2[_0x8b59('0x2')][_0x8b59('0x3')][_0x8b59('0x4')]({'raw':!![]})[_0x8b59('0x5')](function(_0x218718){_0x4cea61[_0x8b59('0x6')]=_0x218718;return _0x583cd2[_0x8b59('0x2')][_0x8b59('0x7')]['findAll']({'where':{'IntervalId':_0x3e388e[_0x8b59('0x8')]},'raw':!![]});})[_0x8b59('0x5')](function(_0x3c640b){return _0x583cd2[_0x8b59('0x2')][_0x8b59('0x7')][_0x8b59('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x8b59('0x9')](_0x3c640b,_0x8b59('0xa')))}},'order':[{'raw':_0x8b59('0xb')}],'raw':!![]});})[_0x8b59('0x5')](function(_0x42616a){var _0x10d676=_[_0x8b59('0xc')](_0x42616a,{'priority':'1'});var _0x430e1f=_[_0x8b59('0xc')](_0x42616a,{'isApp':0x1});var _0x3211ff=_[_0x8b59('0xd')](_0x430e1f,'exten');var _0xaec4fa=[_0x8b59('0xe'),'playback'];var _0x5590a4=[];var _0x2db259=[];for(var _0x2547a2 in _0x3211ff){if(_0x3211ff[_0x8b59('0xf')](_0x2547a2)){_0x4cea61[_0x8b59('0x10')]=0x2;_0x4cea61[_0x8b59('0x11')]=[];_0x4cea61['extension']=_[_0x8b59('0x12')](_0x10d676,{'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')]});_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':'Set','appdata':util['format'](_0x8b59('0x15'),_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')]),'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});if(_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')]==='inbound'){_0x4cea61['extensions'][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':'CDR(routeid)='+_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')],'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0]['exten'],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});}else if(_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')]==='outbound'){if(_0x4cea61[_0x8b59('0x19')]){_0x4cea61['extensions'][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0]['type'],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x1a')+(_0x4cea61[_0x8b59('0x19')]['cutdigits']?_0x8b59('0x1b')+_0x4cea61[_0x8b59('0x19')][_0x8b59('0x1c')]+'}':_0x8b59('0x1d')),'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});}_0x4cea61['extensions'][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':'CDR(routeid)='+_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')],'context':_0x3211ff[_0x2547a2][0x0]['context'],'exten':_0x3211ff[_0x2547a2][0x0]['exten'],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0]['VoiceExtensionId']});var _0x54eefe=_0x4cea61['priority']++;_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x1e'),'appdata':_0x8b59('0x1f')+(_0x54eefe+0x2)+_0x8b59('0x20')+(_0x54eefe+0x1)+')','context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x54eefe,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});if(_0x4cea61[_0x8b59('0x19')]){_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':_0x4cea61[_0x8b59('0x19')][_0x8b59('0x1c')]?_0x8b59('0x21')+_0x4cea61['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x3211ff[_0x2547a2][0x0]['context'],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});}_0x4cea61['extensions'][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':'outboundrouteid='+_0x3211ff[_0x2547a2][0x0]['VoiceExtensionId'],'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0]['VoiceExtensionId']});if(_0x4cea61[_0x8b59('0x19')]&&_0x4cea61[_0x8b59('0x19')][_0x8b59('0xf')]('recordingFormat')&&_0x4cea61[_0x8b59('0x19')][_0x8b59('0x22')]!==_0x8b59('0x23')){_0x4cea61['extensions'][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61['priority']++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x24')+_0x4cea61[_0x8b59('0x19')][_0x8b59('0x22')]||_0x8b59('0x25'),'context':_0x3211ff[_0x2547a2][0x0]['context'],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});}}_0x4cea61[_0x8b59('0x11')]['push']({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':'Set','appdata':_0x8b59('0x26'),'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61['priority']++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0]['type'],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x27'),'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0]['exten'],'priority':_0x4cea61[_0x8b59('0x10')]++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x28'),'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'priority':_0x4cea61['priority']++,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});for(var _0x67a9b6=0x0,_0x80ddf9=0x0;_0x67a9b6<_0x3211ff[_0x2547a2][_0x8b59('0x29')];_0x67a9b6+=0x1,_0x80ddf9=0x0){var _0x32043e=_0x3211ff[_0x2547a2][_0x67a9b6];if(_0x32043e[_0x8b59('0x14')]){_0x32043e[_0x8b59('0x14')]=_0x32043e[_0x8b59('0x14')]['toLowerCase']();}var _0x39bf97=[];var _0x4e6fec=[];delete _0x32043e['id'];delete _0x32043e[_0x8b59('0x2a')];delete _0x32043e[_0x8b59('0x2b')];var _0x435441=_0x32043e[_0x8b59('0x2c')]!==_0x8b59('0x2d')?[_0x32043e[_0x8b59('0x2c')]]:_0x32043e[_0x8b59('0x8')]?_['map'](_[_0x8b59('0xc')](_0x4cea61[_0x8b59('0x6')],{'IntervalId':_0x32043e[_0x8b59('0x8')]}),_0x8b59('0x2c')):[];if(_0x32043e[_0x8b59('0xf')](_0x8b59('0x2e'))){if(_0x32043e[_0x8b59('0x2e')]&&_0x32043e[_0x8b59('0x2e')]!=='--'){_0x39bf97['push']({'type':_0x32043e[_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x2f')+_0x32043e[_0x8b59('0x2e')],'context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61[_0x8b59('0x10')]+_0x80ddf9++,'VoiceExtensionId':_0x32043e['VoiceExtensionId']});}}if(_0x32043e['type']===_0x8b59('0x30')&&_0x32043e['hasOwnProperty']('callerID')){if(_0x32043e[_0x8b59('0x31')]){_0x39bf97[_0x8b59('0x13')]({'type':_0x32043e[_0x8b59('0x14')],'app':_0x8b59('0x1e'),'appdata':_0x8b59('0x32')+_0x32043e[_0x8b59('0x31')]+')','context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441['length']+_0x4cea61['priority']+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});}else{_0x39bf97[_0x8b59('0x13')]({'type':_0x32043e['type'],'app':_0x8b59('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61[_0x8b59('0x10')]+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});}}if(_0x32043e[_0x8b59('0xf')]('answer')){if(_0xaec4fa['indexOf'](_0x32043e['app'][_0x8b59('0x33')]())>=0x0&&_0x32043e[_0x8b59('0x34')]!=='custom'){if(_0x32043e[_0x8b59('0x35')]){_0x39bf97[_0x8b59('0x13')]({'type':_0x32043e[_0x8b59('0x14')],'app':_0x8b59('0x1e'),'appdata':_0x8b59('0x36'),'context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61[_0x8b59('0x10')]+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});_0x39bf97[_0x8b59('0x13')]({'type':_0x32043e['type'],'app':'Set','appdata':_0x8b59('0x37'),'context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61[_0x8b59('0x10')]+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});}else{_0x39bf97['push']({'type':_0x32043e[_0x8b59('0x14')],'app':'ExecIf','appdata':_0x8b59('0x38'),'context':_0x32043e['context'],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61[_0x8b59('0x10')]+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});_0x39bf97[_0x8b59('0x13')]({'type':_0x32043e[_0x8b59('0x14')],'app':_0x8b59('0x18'),'appdata':_0x8b59('0x39'),'context':_0x32043e[_0x8b59('0x16')],'exten':_0x32043e[_0x8b59('0xa')],'priority':_0x435441[_0x8b59('0x29')]+_0x4cea61['priority']+_0x80ddf9++,'VoiceExtensionId':_0x32043e[_0x8b59('0x17')]});}}}for(var _0x4af834=0x0;_0x4af834<_0x435441['length'];_0x4af834+=0x1){var _0x551f57=_0x4cea61[_0x8b59('0x10')]+_0x435441[_0x8b59('0x29')];var _0x9120c5=_0x4af834===_0x435441[_0x8b59('0x29')]-0x1?_0x4cea61['priority']+_0x39bf97[_0x8b59('0x29')]+_0x4e6fec[_0x8b59('0x29')]+0x2:_0x4cea61[_0x8b59('0x10')]+_0x4af834+0x1;_0x39bf97[_0x8b59('0x3a')](_0x4af834,0x0,{'type':_0x32043e[_0x8b59('0x14')],'app':'GotoIfTime','appdata':_0x435441[_0x4af834]+'?'+_0x32043e[_0x8b59('0x16')]+_0x8b59('0x3b')+_0x551f57+':'+_0x32043e[_0x8b59('0x16')]+_0x8b59('0x3b')+_0x9120c5,'exten':_0x32043e['exten'],'context':_0x32043e[_0x8b59('0x16')],'priority':_0x4cea61['priority']+_0x4af834,'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0]['VoiceExtensionId']});}_0x32043e['priority']=_0x39bf97[_0x8b59('0x29')]?_['last'](_0x39bf97)['priority']+0x1:_0x4cea61[_0x8b59('0x10')];_0x4cea61[_0x8b59('0x10')]=(_0x4e6fec[_0x8b59('0x29')]?_[_0x8b59('0x3c')](_0x4e6fec)[_0x8b59('0x10')]:_0x32043e[_0x8b59('0x10')])+0x1;_0x4cea61[_0x8b59('0x11')]=_[_0x8b59('0x3d')](_0x4cea61['extensions'],_0x39bf97,[_0x32043e],_0x4e6fec);}_0x4cea61[_0x8b59('0x11')][_0x8b59('0x13')]({'type':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x14')],'app':_0x8b59('0x3e'),'exten':_0x3211ff[_0x2547a2][0x0][_0x8b59('0xa')],'context':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x16')],'priority':_0x4cea61['priority'],'VoiceExtensionId':_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]});_0x5590a4[_0x8b59('0x13')](_0x3211ff[_0x2547a2][0x0][_0x8b59('0x17')]);_0x2db259=_['concat'](_0x2db259,_0x4cea61[_0x8b59('0x11')]);}}return _0x583cd2[_0x8b59('0x3f')](function(_0xa8e2b8){return _0x583cd2[_0x8b59('0x2')][_0x8b59('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5590a4}},'transaction':_0xa8e2b8})['then'](function(_0x5ebb98){return _0x583cd2[_0x8b59('0x2')][_0x8b59('0x7')]['bulkCreate'](_[_0x8b59('0x40')](_0x2db259,_0x8b59('0x10')),{'transaction':_0xa8e2b8});});});})['catch'](function(_0x6aaece){console[_0x8b59('0x41')](_0x6aaece);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x4844=['XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','error','lodash','util','findAll','models','VoiceExtension','IntervalId','then','uniq','map','exten','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4844,0x1f1));var _0x4484=function(_0x49f279,_0x1f7003){_0x49f279=_0x49f279-0x0;var _0x2115c8=_0x4844[_0x49f279];return _0x2115c8;};'use strict';var _=require(_0x4484('0x0'));var util=require(_0x4484('0x1'));function rewrite(_0x22c9d2,_0xf38d7b){var _0x297232=this;return _0x22c9d2['models']['Interval'][_0x4484('0x2')]({'raw':!![]})['then'](function(_0x4f857a){_0x297232['intervals']=_0x4f857a;return _0x22c9d2[_0x4484('0x3')][_0x4484('0x4')][_0x4484('0x2')]({'where':{'IntervalId':_0xf38d7b[_0x4484('0x5')]},'raw':!![]});})[_0x4484('0x6')](function(_0x17e85c){return _0x22c9d2['models'][_0x4484('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x4484('0x7')](_[_0x4484('0x8')](_0x17e85c,_0x4484('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x14a2f2){var _0x55e717=_[_0x4484('0xa')](_0x14a2f2,{'priority':'1'});var _0x20d51f=_[_0x4484('0xa')](_0x14a2f2,{'isApp':0x1});var _0x19c091=_[_0x4484('0xb')](_0x20d51f,_0x4484('0x9'));var _0x2eca7b=['queue',_0x4484('0xc')];var _0x37ec26=[];var _0x4899ea=[];for(var _0x2d2cfb in _0x19c091){if(_0x19c091[_0x4484('0xd')](_0x2d2cfb)){_0x297232[_0x4484('0xe')]=0x2;_0x297232[_0x4484('0xf')]=[];_0x297232[_0x4484('0x10')]=_[_0x4484('0x11')](_0x55e717,{'exten':_0x19c091[_0x2d2cfb][0x0]['exten']});_0x297232[_0x4484('0xf')][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':'Set','appdata':util[_0x4484('0x14')](_0x4484('0x15'),_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')]),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});if(_0x19c091[_0x2d2cfb][0x0]['type']===_0x4484('0x18')){_0x297232['extensions'][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x1a')+_0x19c091[_0x2d2cfb][0x0]['VoiceExtensionId'],'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0]['exten'],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});}else if(_0x19c091[_0x2d2cfb][0x0]['type']==='outbound'){if(_0x297232[_0x4484('0x10')]){_0x297232['extensions']['push']({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x1b')+(_0x297232[_0x4484('0x10')][_0x4484('0x1c')]?_0x4484('0x1d')+_0x297232[_0x4484('0x10')]['cutdigits']+'}':_0x4484('0x1e')),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});}_0x297232[_0x4484('0xf')][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0]['type'],'app':_0x4484('0x19'),'appdata':_0x4484('0x1a')+_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')],'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232['priority']++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0]['VoiceExtensionId']});var _0x5e8d0c=_0x297232[_0x4484('0xe')]++;_0x297232[_0x4484('0xf')][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x1f'),'appdata':_0x4484('0x20')+(_0x5e8d0c+0x2)+'):Goto('+(_0x5e8d0c+0x1)+')','context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x5e8d0c,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});if(_0x297232[_0x4484('0x10')]){_0x297232[_0x4484('0xf')]['push']({'type':_0x19c091[_0x2d2cfb][0x0]['type'],'app':_0x4484('0x19'),'appdata':_0x297232[_0x4484('0x10')][_0x4484('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x297232[_0x4484('0x10')][_0x4484('0x1c')]+'}':_0x4484('0x21'),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0]['VoiceExtensionId']});}_0x297232[_0x4484('0xf')]['push']({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x22')+_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')],'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});if(_0x297232[_0x4484('0x10')]&&_0x297232[_0x4484('0x10')]['hasOwnProperty'](_0x4484('0x23'))&&_0x297232['extension']['recordingFormat']!=='none'){_0x297232[_0x4484('0xf')]['push']({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x24'),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232['priority']++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});_0x297232['extensions'][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x297232['extension'][_0x4484('0x23')]||_0x4484('0x25'),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});}}_0x297232['extensions'][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x26'),'context':_0x19c091[_0x2d2cfb][0x0]['context'],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});_0x297232[_0x4484('0xf')][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x27'),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232[_0x4484('0xe')]++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});_0x297232['extensions']['push']({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':'Set','appdata':_0x4484('0x28'),'context':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x16')],'exten':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x9')],'priority':_0x297232['priority']++,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});for(var _0x2548a3=0x0,_0x405b79=0x0;_0x2548a3<_0x19c091[_0x2d2cfb]['length'];_0x2548a3+=0x1,_0x405b79=0x0){var _0x5c19d5=_0x19c091[_0x2d2cfb][_0x2548a3];if(_0x5c19d5['type']){_0x5c19d5[_0x4484('0x13')]=_0x5c19d5[_0x4484('0x13')]['toLowerCase']();}var _0x21e4b5=[];var _0x6a8398=[];delete _0x5c19d5['id'];delete _0x5c19d5[_0x4484('0x29')];delete _0x5c19d5[_0x4484('0x2a')];var _0x2a1d6e=_0x5c19d5[_0x4484('0x2b')]!==_0x4484('0x2c')?[_0x5c19d5[_0x4484('0x2b')]]:_0x5c19d5['IntervalId']?_[_0x4484('0x8')](_[_0x4484('0xa')](_0x297232['intervals'],{'IntervalId':_0x5c19d5[_0x4484('0x5')]}),_0x4484('0x2b')):[];if(_0x5c19d5['hasOwnProperty'](_0x4484('0x2d'))){if(_0x5c19d5[_0x4484('0x2d')]&&_0x5c19d5[_0x4484('0x2d')]!=='--'){_0x21e4b5['push']({'type':_0x5c19d5['type'],'app':_0x4484('0x19'),'appdata':_0x4484('0x2e')+_0x5c19d5[_0x4484('0x2d')],'context':_0x5c19d5['context'],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232['priority']+_0x405b79++,'VoiceExtensionId':_0x5c19d5['VoiceExtensionId']});}}if(_0x5c19d5[_0x4484('0x13')]===_0x4484('0x30')&&_0x5c19d5[_0x4484('0xd')](_0x4484('0x31'))){if(_0x5c19d5[_0x4484('0x31')]){_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5[_0x4484('0x13')],'app':_0x4484('0x1f'),'appdata':_0x4484('0x32')+_0x5c19d5[_0x4484('0x31')]+')','context':_0x5c19d5[_0x4484('0x16')],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232['priority']+_0x405b79++,'VoiceExtensionId':_0x5c19d5[_0x4484('0x17')]});}else{_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5[_0x4484('0x13')],'app':_0x4484('0x1f'),'appdata':_0x4484('0x33'),'context':_0x5c19d5[_0x4484('0x16')],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232[_0x4484('0xe')]+_0x405b79++,'VoiceExtensionId':_0x5c19d5['VoiceExtensionId']});}}if(_0x5c19d5[_0x4484('0xd')](_0x4484('0x34'))){if(_0x2eca7b['indexOf'](_0x5c19d5[_0x4484('0x35')][_0x4484('0x36')]())>=0x0&&_0x5c19d5['appType']!=='custom'){if(_0x5c19d5[_0x4484('0x34')]){_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5['type'],'app':_0x4484('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5c19d5[_0x4484('0x16')],'exten':_0x5c19d5['exten'],'priority':_0x2a1d6e['length']+_0x297232[_0x4484('0xe')]+_0x405b79++,'VoiceExtensionId':_0x5c19d5[_0x4484('0x17')]});_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5[_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x37'),'context':_0x5c19d5[_0x4484('0x16')],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232[_0x4484('0xe')]+_0x405b79++,'VoiceExtensionId':_0x5c19d5[_0x4484('0x17')]});}else{_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5[_0x4484('0x13')],'app':_0x4484('0x1f'),'appdata':_0x4484('0x38'),'context':_0x5c19d5['context'],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232[_0x4484('0xe')]+_0x405b79++,'VoiceExtensionId':_0x5c19d5[_0x4484('0x17')]});_0x21e4b5[_0x4484('0x12')]({'type':_0x5c19d5[_0x4484('0x13')],'app':_0x4484('0x19'),'appdata':_0x4484('0x39'),'context':_0x5c19d5['context'],'exten':_0x5c19d5[_0x4484('0x9')],'priority':_0x2a1d6e[_0x4484('0x2f')]+_0x297232[_0x4484('0xe')]+_0x405b79++,'VoiceExtensionId':_0x5c19d5[_0x4484('0x17')]});}}}for(var _0x5e7931=0x0;_0x5e7931<_0x2a1d6e[_0x4484('0x2f')];_0x5e7931+=0x1){var _0x479813=_0x297232['priority']+_0x2a1d6e[_0x4484('0x2f')];var _0x28a89c=_0x5e7931===_0x2a1d6e['length']-0x1?_0x297232[_0x4484('0xe')]+_0x21e4b5[_0x4484('0x2f')]+_0x6a8398[_0x4484('0x2f')]+0x2:_0x297232[_0x4484('0xe')]+_0x5e7931+0x1;_0x21e4b5[_0x4484('0x3a')](_0x5e7931,0x0,{'type':_0x5c19d5['type'],'app':_0x4484('0x3b'),'appdata':_0x2a1d6e[_0x5e7931]+'?'+_0x5c19d5[_0x4484('0x16')]+_0x4484('0x3c')+_0x479813+':'+_0x5c19d5[_0x4484('0x16')]+',${EXTEN},'+_0x28a89c,'exten':_0x5c19d5[_0x4484('0x9')],'context':_0x5c19d5['context'],'priority':_0x297232[_0x4484('0xe')]+_0x5e7931,'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x17')]});}_0x5c19d5[_0x4484('0xe')]=_0x21e4b5[_0x4484('0x2f')]?_[_0x4484('0x3d')](_0x21e4b5)[_0x4484('0xe')]+0x1:_0x297232['priority'];_0x297232[_0x4484('0xe')]=(_0x6a8398[_0x4484('0x2f')]?_[_0x4484('0x3d')](_0x6a8398)['priority']:_0x5c19d5[_0x4484('0xe')])+0x1;_0x297232[_0x4484('0xf')]=_[_0x4484('0x3e')](_0x297232['extensions'],_0x21e4b5,[_0x5c19d5],_0x6a8398);}_0x297232[_0x4484('0xf')][_0x4484('0x12')]({'type':_0x19c091[_0x2d2cfb][0x0][_0x4484('0x13')],'app':_0x4484('0x3f'),'exten':_0x19c091[_0x2d2cfb][0x0]['exten'],'context':_0x19c091[_0x2d2cfb][0x0]['context'],'priority':_0x297232[_0x4484('0xe')],'VoiceExtensionId':_0x19c091[_0x2d2cfb][0x0]['VoiceExtensionId']});_0x37ec26['push'](_0x19c091[_0x2d2cfb][0x0]['VoiceExtensionId']);_0x4899ea=_[_0x4484('0x3e')](_0x4899ea,_0x297232[_0x4484('0xf')]);}}return _0x22c9d2['transaction'](function(_0x325ab2){return _0x22c9d2[_0x4484('0x3')][_0x4484('0x4')][_0x4484('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x37ec26}},'transaction':_0x325ab2})['then'](function(_0x4902c5){return _0x22c9d2[_0x4484('0x3')][_0x4484('0x4')]['bulkCreate'](_[_0x4484('0x41')](_0x4899ea,_0x4484('0xe')),{'transaction':_0x325ab2});});});})['catch'](function(_0x2472df){console[_0x4484('0x42')](_0x2472df);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 64d29f4..b917000 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 _0x9d0b=['duplicate','pause','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','Duplicate\x20Contact','CmContact','create','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','cm_hopper','scheduledAt','ListId','createdAt','select','field','ContactId','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','emit','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x9d0b,0x14a));var _0xb9d0=function(_0x54b5b6,_0x5a27bc){_0x54b5b6=_0x54b5b6-0x0;var _0x58ecd9=_0x9d0b[_0x54b5b6];return _0x58ecd9;};'use strict';var BPromise=require(_0xb9d0('0x0'));var util=require(_0xb9d0('0x1'));var _=require(_0xb9d0('0x2'));var fs=require('fs');var squel=require(_0xb9d0('0x3'));var Papa=require('papaparse');var Redis=require(_0xb9d0('0x4'));var db=require(_0xb9d0('0x5'))['db'];var config=require(_0xb9d0('0x6'));var logger=require(_0xb9d0('0x7'))(_0xb9d0('0x8'));config[_0xb9d0('0x9')]=_['defaults'](config['redis'],{'host':_0xb9d0('0xa'),'port':0x18eb});var socket=require(_0xb9d0('0xb'))(new Redis(config[_0xb9d0('0x9')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process['argv'][0x2]||process[_0xb9d0('0xc')][0x2]===_0xb9d0('0xd')||process['argv'][0x2]===_0xb9d0('0xe')){throw new Error(_0xb9d0('0xf'));}var FILEPATH=process[_0xb9d0('0xc')][0x2];if(!process[_0xb9d0('0xc')][0x3]||process[_0xb9d0('0xc')][0x3]===_0xb9d0('0xd')||process[_0xb9d0('0xc')][0x3]===_0xb9d0('0xe')||!process[_0xb9d0('0xc')][0x4]||process[_0xb9d0('0xc')][0x4]==='undefined'||process[_0xb9d0('0xc')][0x4]==='null'){throw new Error(_0xb9d0('0x10'));}var FIELDS=_[_0xb9d0('0x11')](process[_0xb9d0('0xc')][0x3][_0xb9d0('0x12')](','),process[_0xb9d0('0xc')][0x4][_0xb9d0('0x12')](','));if(!process[_0xb9d0('0xc')][0x5]||process['argv'][0x5]===_0xb9d0('0xd')||process[_0xb9d0('0xc')][0x5]===_0xb9d0('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xb9d0('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xb9d0('0xc')][0x6]!==_0xb9d0('0xd')&&process['argv'][0x6]!==_0xb9d0('0xe')?process[_0xb9d0('0xc')][0x6]:null;var DUPLICATES=process[_0xb9d0('0xc')][0x7]&&process[_0xb9d0('0xc')][0x7]!==_0xb9d0('0xd')&&process[_0xb9d0('0xc')][0x7]!==_0xb9d0('0xe')?process[_0xb9d0('0xc')][0x7]:null;if(!process[_0xb9d0('0xc')][0x8]||process[_0xb9d0('0xc')][0x8]===_0xb9d0('0xd')||process[_0xb9d0('0xc')][0x8]===_0xb9d0('0xe')){throw new Error(_0xb9d0('0x13'));}var SOCKET_TIMESTAMP=process[_0xb9d0('0xc')][0x8];}catch(_0x37fae5){logger[_0xb9d0('0x14')](_0x37fae5);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(_0x263dbf,_0x3ca00f,_0x267290,_0x2253ee){var _0x50dee6={'message':_0x3ca00f};_0x50dee6[_0x263dbf]=!![];if(_0x267290){_0x50dee6[_0xb9d0('0x15')]=_0x267290;}if(_0x2253ee){_0x50dee6[_0xb9d0('0x16')]=_0x2253ee;}return _0x50dee6;}function isEmail(_0x27421c){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))*$/[_0xb9d0('0x17')](_0x27421c);}function checkRow(_0x34cdfd,_0x36ed82,_0x1aee2f){return new BPromise(function(_0x2cf1be,_0x37df94){if(_['isNil'](_0x34cdfd)){return _0x37df94(handleCheckRowError(_0xb9d0('0x14'),_0xb9d0('0x18'),null,_0x1aee2f));}if(_0x34cdfd[_0xb9d0('0x19')]&&_0x34cdfd[_0xb9d0('0x19')][_0xb9d0('0x1a')]){var _0xb653ec=_[_0xb9d0('0x1b')](_0x34cdfd[_0xb9d0('0x19')],'message')['join'](';');return _0x37df94(handleCheckRowError(_0xb9d0('0x14'),_0xb653ec,null,_0x1aee2f));}var _0xced023={};for(var _0x3b3854 in FIELDS){if(FIELDS[_0xb9d0('0x1c')](_0x3b3854)&&FIELDS[_0x3b3854]){_0xced023[_0x3b3854]=_0x34cdfd[_0xb9d0('0x1d')][0x0][FIELDS[_0x3b3854]]||_0x34cdfd[_0xb9d0('0x1d')][0x0]['\ufeff'+FIELDS[_0x3b3854]];}}if(!_0xced023[_0xb9d0('0x1e')]){return _0x37df94(handleCheckRowError(_0xb9d0('0x14'),'firstName\x20not\x20specified!',null,_0x1aee2f));}if(!_0xced023[_0xb9d0('0x1f')]){return _0x37df94(handleCheckRowError('error',_0xb9d0('0x20'),null,_0x1aee2f));}if(_0xced023[_0xb9d0('0x21')]){var _0x300863=moment(_0xced023['birthDate'],_0xb9d0('0x22'));if(!_0x300863[_0xb9d0('0x23')]()){return _0x37df94(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x1aee2f));}}if(_0xced023[_0xb9d0('0x24')]){if(!isEmail(_0xced023[_0xb9d0('0x24')])){return _0x37df94(handleCheckRowError(_0xb9d0('0x14'),_0xb9d0('0x25'),null,_0x1aee2f));}}_0xced023['ListId']=LISTID;_0xced023[_0xb9d0('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb9d0('0x1a')]&&_0x36ed82){var _0xcc805b={};for(var _0x2a3507=0x0,_0x1236da=DUPLICATES['length'];_0x2a3507<_0x1236da;_0x2a3507+=0x1){_0xcc805b[DUPLICATES[_0x2a3507]]=_0xced023[DUPLICATES[_0x2a3507]];}var _0x5c4398=_['find'](_0x36ed82,_0xcc805b);if(_0x5c4398){return _0x37df94(handleCheckRowError('duplicate',_0xb9d0('0x27'),_0x5c4398,_0x1aee2f));}}return db[_0xb9d0('0x28')][_0xb9d0('0x29')](_0xced023,{'raw':!![],'hooks':![],'fields':_['keys'](_0xced023)})[_0xb9d0('0x2a')](function(_0x31cb7b){if(DUPLICATES&&DUPLICATES[_0xb9d0('0x1a')]&&_0x36ed82){_0x36ed82[_0xb9d0('0x2b')](_[_0xb9d0('0x2c')](_0xced023,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x31cb7b['id'];return _0x2cf1be();})['catch'](function(_0x320a0b){return _0x37df94(handleCheckRowError(_0xb9d0('0x14'),_0xb9d0('0x2d')+(_0x320a0b['message']||JSON['stringify'](_0x320a0b)),null,_0x1aee2f));});});}function checkHopper(){function _0x899da8(){return function(_0x2b2c1c){logger[_0xb9d0('0x14')](_0xb9d0('0x2e'),_0xb9d0('0x2f'),util[_0xb9d0('0x30')](_0x2b2c1c,{'showHidden':![],'depth':null}));};}var _0x2c1ace=function(_0x22a0cb,_0x31d2a7){var _0x42e7a0=squel['insert']()['into'](_0xb9d0('0x31'))['fromQuery']([_0xb9d0('0x1f'),_0xb9d0('0x32'),'ContactId',_0xb9d0('0x33'),_0x31d2a7,_0xb9d0('0x34'),'updatedAt'],squel[_0xb9d0('0x35')]()['field'](_0xb9d0('0x1f'),_0xb9d0('0x1f'))[_0xb9d0('0x36')]('NOW()',_0xb9d0('0x32'))['field']('id',_0xb9d0('0x37'))[_0xb9d0('0x36')](LISTID[_0xb9d0('0x38')](),_0xb9d0('0x33'))[_0xb9d0('0x36')](_0x22a0cb['id'][_0xb9d0('0x38')](),_0x31d2a7)['field'](_0xb9d0('0x39'),_0xb9d0('0x34'))[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x3a'))[_0xb9d0('0x3b')](_0xb9d0('0x3c'))[_0xb9d0('0x3d')](_0xb9d0('0x3e'))[_0xb9d0('0x3d')](_0xb9d0('0x3f'),LISTID[_0xb9d0('0x38')]())[_0xb9d0('0x3d')](_0xb9d0('0x40'))[_0xb9d0('0x3d')](_0xb9d0('0x41'),squel['select']()[_0xb9d0('0x36')](_0xb9d0('0x1f'))[_0xb9d0('0x3b')](_0xb9d0('0x31'))[_0xb9d0('0x3d')](_0x31d2a7+_0xb9d0('0x42'),_0x22a0cb['id'][_0xb9d0('0x38')]())))[_0xb9d0('0x38')]();return _0x42e7a0;};var _0x2f0e0e=function(_0x588c09,_0x569305){var _0x1adeb8=squel['insert']()[_0xb9d0('0x43')]('cm_hopper')[_0xb9d0('0x44')](['phone',_0xb9d0('0x32'),'ContactId','ListId',_0x569305,_0xb9d0('0x34'),'updatedAt'],squel[_0xb9d0('0x35')]()[_0xb9d0('0x36')](_0xb9d0('0x1f'),'phone')[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x32'))['field']('id','ContactId')[_0xb9d0('0x36')](LISTID[_0xb9d0('0x38')](),_0xb9d0('0x33'))['field'](_0x588c09['id'][_0xb9d0('0x38')](),_0x569305)[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x34'))[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x3a'))[_0xb9d0('0x3b')]('cm_contacts')[_0xb9d0('0x3d')](_0xb9d0('0x3e'))[_0xb9d0('0x3d')](_0xb9d0('0x3f'),LISTID['toString']())[_0xb9d0('0x3d')](_0xb9d0('0x45'),squel[_0xb9d0('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb9d0('0x36')](_0xb9d0('0x47'))['from'](_0xb9d0('0x48'))['where'](_0x569305+_0xb9d0('0x42'),_0x588c09['id'][_0xb9d0('0x38')]()))[_0xb9d0('0x3d')](_0xb9d0('0x41'),squel[_0xb9d0('0x35')]()[_0xb9d0('0x36')](_0xb9d0('0x1f'))['from']('cm_hopper')['where'](_0x569305+_0xb9d0('0x42'),_0x588c09['id'][_0xb9d0('0x38')]())))[_0xb9d0('0x38')]();return _0x1adeb8;};function _0x117b31(_0x5ac584,_0x4bb9e7){var _0x2de299=squel[_0xb9d0('0x49')]()[_0xb9d0('0x43')]('cm_hopper')[_0xb9d0('0x44')]([_0xb9d0('0x1f'),_0xb9d0('0x32'),_0xb9d0('0x37'),_0xb9d0('0x33'),_0x4bb9e7,'createdAt',_0xb9d0('0x3a')],squel[_0xb9d0('0x35')]()['field']('phone',_0xb9d0('0x1f'))[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x32'))[_0xb9d0('0x36')]('id',_0xb9d0('0x37'))[_0xb9d0('0x36')](LISTID[_0xb9d0('0x38')](),_0xb9d0('0x33'))[_0xb9d0('0x36')](_0x5ac584['id']['toString'](),_0x4bb9e7)[_0xb9d0('0x36')](_0xb9d0('0x39'),'createdAt')['field'](_0xb9d0('0x39'),_0xb9d0('0x3a'))[_0xb9d0('0x3b')](_0xb9d0('0x3c'))[_0xb9d0('0x3d')](_0xb9d0('0x3e'))[_0xb9d0('0x3d')](_0xb9d0('0x3f'),LISTID['toString']())[_0xb9d0('0x3d')](_0xb9d0('0x45'),squel['str'](hopperContacts))[_0xb9d0('0x3d')](_0xb9d0('0x40')))[_0xb9d0('0x38')]();return _0x2de299;}function _0x242d21(_0x431851,_0x4c539d){var _0x3c5e4c=squel[_0xb9d0('0x49')]()[_0xb9d0('0x43')](_0xb9d0('0x4a'))[_0xb9d0('0x44')]([_0xb9d0('0x1f'),_0xb9d0('0x37'),'ListId',_0x4c539d,'createdAt',_0xb9d0('0x3a')],squel[_0xb9d0('0x35')]()['field'](_0xb9d0('0x1f'),_0xb9d0('0x1f'))[_0xb9d0('0x36')]('id',_0xb9d0('0x37'))[_0xb9d0('0x36')](LISTID[_0xb9d0('0x38')](),'ListId')[_0xb9d0('0x36')](_0x431851['id']['toString'](),_0x4c539d)['field'](_0xb9d0('0x39'),_0xb9d0('0x34'))[_0xb9d0('0x36')](_0xb9d0('0x39'),_0xb9d0('0x3a'))[_0xb9d0('0x3b')](_0xb9d0('0x3c'))[_0xb9d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0xb9d0('0x3d')]('ListId\x20=\x20?',LISTID['toString']())[_0xb9d0('0x3d')](_0xb9d0('0x45'),squel[_0xb9d0('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xb9d0('0x38')]();return _0x3c5e4c;}return db[_0xb9d0('0x4b')][_0xb9d0('0x4c')]({'where':{'type':_0xb9d0('0x4d')},'attributes':['id',_0xb9d0('0x4e')],'include':[{'model':db[_0xb9d0('0x4f')],'as':_0xb9d0('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x2c89cd){var _0x173dc7=[];if(_0x2c89cd){var _0x37f9fa;for(var _0x5662c7=0x0,_0x54b414;_0x5662c7<_0x2c89cd[_0xb9d0('0x1a')];_0x5662c7+=0x1){_0x54b414=_0x2c89cd[_0x5662c7][_0xb9d0('0x51')]({'plain':!![]});switch(_0x54b414['dialCheckDuplicateType']){case _0xb9d0('0x52'):_0x173dc7['push'](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x2f0e0e(_0x54b414,_0xb9d0('0x55')))['then'](function(){})['catch'](_0x899da8()));break;case _0xb9d0('0x56'):_0x173dc7[_0xb9d0('0x2b')](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x2c1ace(_0x54b414,_0xb9d0('0x55')))[_0xb9d0('0x2a')](function(){})[_0xb9d0('0x57')](_0x899da8()));break;default:_0x173dc7['push'](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x117b31(_0x54b414,_0xb9d0('0x55')))[_0xb9d0('0x2a')](function(){})['catch'](_0x899da8()));}}}return _0x173dc7;})[_0xb9d0('0x58')]()[_0xb9d0('0x2a')](function(){return db['VoiceQueue'][_0xb9d0('0x4c')]({'where':{'type':_0xb9d0('0x4d')},'attributes':['id'],'include':[{'model':db[_0xb9d0('0x4f')],'as':_0xb9d0('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x3ae237){var _0x3c32bb=[];if(_0x3ae237){var _0x29d48e;for(var _0x1ecf70=0x0,_0x4cae84;_0x1ecf70<_0x3ae237[_0xb9d0('0x1a')];_0x1ecf70+=0x1){_0x4cae84=_0x3ae237[_0x1ecf70][_0xb9d0('0x51')]({'plain':!![]});_0x3c32bb[_0xb9d0('0x2b')](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x242d21(_0x4cae84,_0xb9d0('0x55')))[_0xb9d0('0x2a')](function(){})[_0xb9d0('0x57')](_0x899da8()));}}return _0x3c32bb;})[_0xb9d0('0x58')]();})[_0xb9d0('0x2a')](function(){return db[_0xb9d0('0x5a')]['findAll']({'attributes':['id',_0xb9d0('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xb9d0('0x2a')](function(_0x3219e5){var _0xa988a5=[];if(_0x3219e5){for(var _0x34c409=0x0,_0x40296c;_0x34c409<_0x3219e5['length'];_0x34c409+=0x1){_0x40296c=_0x3219e5[_0x34c409][_0xb9d0('0x51')]({'plain':!![]});switch(_0x40296c[_0xb9d0('0x4e')]){case'always':_0xa988a5[_0xb9d0('0x2b')](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x2f0e0e(_0x40296c,'CampaignId'))[_0xb9d0('0x2a')](function(){})[_0xb9d0('0x57')](_0x899da8()));break;case'onlyIfOpen':_0xa988a5[_0xb9d0('0x2b')](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x2c1ace(_0x40296c,_0xb9d0('0x5b')))[_0xb9d0('0x2a')](function(){})[_0xb9d0('0x57')](_0x899da8()));break;default:_0xa988a5[_0xb9d0('0x2b')](db['sequelize'][_0xb9d0('0x54')](_0x117b31(_0x40296c,_0xb9d0('0x5b')))[_0xb9d0('0x2a')](function(){})[_0xb9d0('0x57')](_0x899da8()));}}}return _0xa988a5;})['all']();})['then'](function(){return db[_0xb9d0('0x5a')][_0xb9d0('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xb9d0('0x4f')],'as':_0xb9d0('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x4de868){var _0x55b666=[];if(_0x4de868){for(var _0x543696=0x0,_0x2a42d1;_0x543696<_0x4de868[_0xb9d0('0x1a')];_0x543696+=0x1){_0x2a42d1=_0x4de868[_0x543696][_0xb9d0('0x51')]({'plain':!![]});_0x55b666[_0xb9d0('0x2b')](db[_0xb9d0('0x53')][_0xb9d0('0x54')](_0x242d21(_0x2a42d1,_0xb9d0('0x5b')))['then'](function(){})[_0xb9d0('0x57')](_0x899da8()));}}return _0x55b666;})['all']();})[_0xb9d0('0x57')](function(_0x5e598c){logger[_0xb9d0('0x14')](_0xb9d0('0x5c'),_0xb9d0('0x5d'),_0x5e598c['message']);});}var processPromises=function(_0x426fbf){return BPromise['all'](promises)['then'](function(_0x59664c){})['catch'](function(_0x2a1e10){logger[_0xb9d0('0x14')]('Error\x20processing\x20rows\x20block:',JSON[_0xb9d0('0x5e')](_0x2a1e10));})[_0xb9d0('0x5f')](function(){socket[_0xb9d0('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x426fbf){return _0x426fbf['resume']();}});};var endCsv=function(){return BPromise[_0xb9d0('0x61')]()[_0xb9d0('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xb9d0('0x2a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb9d0('0x62')](FILEPATH);}catch(_0xe5fd86){logger['error'](_0xb9d0('0x63'),JSON[_0xb9d0('0x5e')](_0xe5fd86));}finally{process[_0xb9d0('0x64')](0x0);}});};process['on'](_0xb9d0('0x65'),function(){logger[_0xb9d0('0x66')](_0xb9d0('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xb9d0('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xb9d0('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb9d0('0x2a')](function(_0x278c51){var _0x1203dd=fs[_0xb9d0('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb9d0('0x69')](_0x1203dd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4fbdff,_0x1273f9){total+=0x1;var _0x508e44=total;promises[_0xb9d0('0x2b')](checkRow(_0x4fbdff,_0x278c51,_0x508e44)[_0xb9d0('0x2a')](function(){success+=0x1;})['catch'](function(_0x44fcfb){if(_0x44fcfb[_0xb9d0('0x14')]){errors+=0x1;delete _0x44fcfb[_0xb9d0('0x14')];}else if(_0x44fcfb[_0xb9d0('0x6a')]){duplicates+=0x1;delete _0x44fcfb[_0xb9d0('0x6a')];}rows['push'](_0x44fcfb);}));if(total%0xc8===0x0){_0x1273f9[_0xb9d0('0x6b')]();return processPromises(_0x1273f9);}},'complete':function(){return processPromises()[_0xb9d0('0x2a')](function(){logger[_0xb9d0('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x51cb14,_0x1f7bc9){logger[_0xb9d0('0x66')](_0xb9d0('0x6c'),JSON['stringify'](_0x51cb14));endCsv();}});})[_0xb9d0('0x57')](function(_0xab8fc3){logger[_0xb9d0('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xb9d0('0x5e')](_0xab8fc3));});}main(); \ No newline at end of file +var _0x0513=['undefined','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','updatedAt','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_contacts','str','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','CampaignId','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!'];(function(_0x51652a,_0x5144fc){var _0xae7099=function(_0x4b239b){while(--_0x4b239b){_0x51652a['push'](_0x51652a['shift']());}};_0xae7099(++_0x5144fc);}(_0x0513,0xc9));var _0x3051=function(_0xb7bd46,_0x941298){_0xb7bd46=_0xb7bd46-0x0;var _0x2abe45=_0x0513[_0xb7bd46];return _0x2abe45;};'use strict';var BPromise=require('bluebird');var util=require(_0x3051('0x0'));var _=require(_0x3051('0x1'));var fs=require('fs');var squel=require(_0x3051('0x2'));var Papa=require(_0x3051('0x3'));var Redis=require(_0x3051('0x4'));var db=require(_0x3051('0x5'))['db'];var config=require(_0x3051('0x6'));var logger=require(_0x3051('0x7'))('api');config[_0x3051('0x8')]=_['defaults'](config[_0x3051('0x8')],{'host':_0x3051('0x9'),'port':0x18eb});var socket=require(_0x3051('0xa'))(new Redis(config[_0x3051('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x3051('0xb')](socket);try{if(!process[_0x3051('0xc')][0x2]||process[_0x3051('0xc')][0x2]==='undefined'||process[_0x3051('0xc')][0x2]===_0x3051('0xd')){throw new Error(_0x3051('0xe'));}var FILEPATH=process[_0x3051('0xc')][0x2];if(!process['argv'][0x3]||process[_0x3051('0xc')][0x3]==='undefined'||process[_0x3051('0xc')][0x3]===_0x3051('0xd')||!process[_0x3051('0xc')][0x4]||process['argv'][0x4]===_0x3051('0xf')||process['argv'][0x4]===_0x3051('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x3051('0xc')][0x3][_0x3051('0x10')](','),process[_0x3051('0xc')][0x4]['split'](','));if(!process[_0x3051('0xc')][0x5]||process[_0x3051('0xc')][0x5]===_0x3051('0xf')||process[_0x3051('0xc')][0x5]===_0x3051('0xd')){throw new Error(_0x3051('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x3051('0xf')&&process[_0x3051('0xc')][0x6]!==_0x3051('0xd')?process[_0x3051('0xc')][0x6]:null;var DUPLICATES=process[_0x3051('0xc')][0x7]&&process['argv'][0x7]!==_0x3051('0xf')&&process[_0x3051('0xc')][0x7]!==_0x3051('0xd')?process[_0x3051('0xc')][0x7]:null;if(!process[_0x3051('0xc')][0x8]||process[_0x3051('0xc')][0x8]===_0x3051('0xf')||process[_0x3051('0xc')][0x8]==='null'){throw new Error(_0x3051('0x12'));}var SOCKET_TIMESTAMP=process[_0x3051('0xc')][0x8];}catch(_0x4fd52f){logger[_0x3051('0x13')](_0x4fd52f);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(_0x15607d,_0xeade92,_0x1abf8d,_0x386b8a){var _0x2011cb={'message':_0xeade92};_0x2011cb[_0x15607d]=!![];if(_0x1abf8d){_0x2011cb['contact']=_0x1abf8d;}if(_0x386b8a){_0x2011cb[_0x3051('0x14')]=_0x386b8a;}return _0x2011cb;}function isEmail(_0x58e3bd){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'](_0x58e3bd);}function checkRow(_0x68c5d6,_0x153ac9,_0x2ed04a){return new BPromise(function(_0x2d4f65,_0x3b315f){if(_[_0x3051('0x15')](_0x68c5d6)){return _0x3b315f(handleCheckRowError('error',_0x3051('0x16'),null,_0x2ed04a));}if(_0x68c5d6['errors']&&_0x68c5d6[_0x3051('0x17')][_0x3051('0x18')]){var _0x22a645=_['map'](_0x68c5d6[_0x3051('0x17')],_0x3051('0x19'))['join'](';');return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x22a645,null,_0x2ed04a));}var _0x3f05a9={};for(var _0x5d7c9c in FIELDS){if(FIELDS[_0x3051('0x1a')](_0x5d7c9c)&&FIELDS[_0x5d7c9c]){_0x3f05a9[_0x5d7c9c]=_0x68c5d6['data'][0x0][FIELDS[_0x5d7c9c]]||_0x68c5d6[_0x3051('0x1b')][0x0]['\ufeff'+FIELDS[_0x5d7c9c]];}}if(!_0x3f05a9[_0x3051('0x1c')]){return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x3051('0x1d'),null,_0x2ed04a));}if(!_0x3f05a9[_0x3051('0x1e')]){return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x3051('0x1f'),null,_0x2ed04a));}if(_0x3f05a9[_0x3051('0x20')]){var _0x5a8687=moment(_0x3f05a9['birthDate'],'YYYY-MM-DD');if(!_0x5a8687['isValid']()){return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x3051('0x21'),null,_0x2ed04a));}}if(_0x3f05a9[_0x3051('0x22')]){if(!isEmail(_0x3f05a9['email'])){return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x3051('0x23'),null,_0x2ed04a));}}_0x3f05a9[_0x3051('0x24')]=LISTID;_0x3f05a9[_0x3051('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3051('0x18')]&&_0x153ac9){var _0x1bb873={};for(var _0x38cadd=0x0,_0x4741c1=DUPLICATES[_0x3051('0x18')];_0x38cadd<_0x4741c1;_0x38cadd+=0x1){_0x1bb873[DUPLICATES[_0x38cadd]]=_0x3f05a9[DUPLICATES[_0x38cadd]];}var _0x21a04d=_[_0x3051('0x26')](_0x153ac9,_0x1bb873);if(_0x21a04d){return _0x3b315f(handleCheckRowError(_0x3051('0x27'),'Duplicate\x20Contact',_0x21a04d,_0x2ed04a));}}return db[_0x3051('0x28')][_0x3051('0x29')](_0x3f05a9,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3f05a9)})[_0x3051('0x2a')](function(_0x5ad6af){if(DUPLICATES&&DUPLICATES[_0x3051('0x18')]&&_0x153ac9){_0x153ac9[_0x3051('0x2b')](_[_0x3051('0x2c')](_0x3f05a9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5ad6af['id'];return _0x2d4f65();})[_0x3051('0x2d')](function(_0x51ffa0){return _0x3b315f(handleCheckRowError(_0x3051('0x13'),_0x3051('0x2e')+(_0x51ffa0[_0x3051('0x19')]||JSON['stringify'](_0x51ffa0)),null,_0x2ed04a));});});}function checkHopper(){function _0x20b26e(){return function(_0x29738a){logger[_0x3051('0x13')](_0x3051('0x2f'),_0x3051('0x30'),util[_0x3051('0x31')](_0x29738a,{'showHidden':![],'depth':null}));};}var _0x2433b7=function(_0x7cd43f,_0x2b3231){var _0x579fa8=squel[_0x3051('0x32')]()[_0x3051('0x33')](_0x3051('0x34'))[_0x3051('0x35')]([_0x3051('0x1e'),_0x3051('0x36'),_0x3051('0x37'),_0x3051('0x24'),_0x2b3231,_0x3051('0x38'),'updatedAt'],squel['select']()[_0x3051('0x39')](_0x3051('0x1e'),_0x3051('0x1e'))[_0x3051('0x39')](_0x3051('0x3a'),'scheduledAt')[_0x3051('0x39')]('id',_0x3051('0x37'))[_0x3051('0x39')](LISTID[_0x3051('0x3b')](),_0x3051('0x24'))[_0x3051('0x39')](_0x7cd43f['id'][_0x3051('0x3b')](),_0x2b3231)[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x38'))[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x3c'))[_0x3051('0x3d')]('cm_contacts')['where'](_0x3051('0x3e'))[_0x3051('0x3f')](_0x3051('0x40'),LISTID[_0x3051('0x3b')]())['where'](_0x3051('0x41'))['where'](_0x3051('0x42'),squel['select']()['field']('phone')[_0x3051('0x3d')](_0x3051('0x34'))['where'](_0x2b3231+'\x20=\x20?',_0x7cd43f['id']['toString']())))[_0x3051('0x3b')]();return _0x579fa8;};var _0x5eb6f2=function(_0x142b1e,_0x5e2c6d){var _0x3b6583=squel[_0x3051('0x32')]()['into']('cm_hopper')['fromQuery']([_0x3051('0x1e'),'scheduledAt','ContactId','ListId',_0x5e2c6d,_0x3051('0x38'),_0x3051('0x3c')],squel[_0x3051('0x43')]()[_0x3051('0x39')]('phone',_0x3051('0x1e'))[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x36'))[_0x3051('0x39')]('id',_0x3051('0x37'))[_0x3051('0x39')](LISTID['toString'](),_0x3051('0x24'))['field'](_0x142b1e['id'][_0x3051('0x3b')](),_0x5e2c6d)[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x38'))[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x3c'))[_0x3051('0x3d')](_0x3051('0x44'))[_0x3051('0x3f')](_0x3051('0x3e'))[_0x3051('0x3f')]('ListId\x20=\x20?',LISTID[_0x3051('0x3b')]())[_0x3051('0x3f')]('id\x20IN\x20?',squel[_0x3051('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x3051('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3051('0x43')]()[_0x3051('0x39')](_0x3051('0x46'))[_0x3051('0x3d')](_0x3051('0x47'))[_0x3051('0x3f')](_0x5e2c6d+'\x20=\x20?',_0x142b1e['id'][_0x3051('0x3b')]()))[_0x3051('0x3f')](_0x3051('0x42'),squel[_0x3051('0x43')]()[_0x3051('0x39')]('phone')[_0x3051('0x3d')](_0x3051('0x34'))[_0x3051('0x3f')](_0x5e2c6d+_0x3051('0x48'),_0x142b1e['id'][_0x3051('0x3b')]())))['toString']();return _0x3b6583;};function _0x4b59b7(_0x1eeac2,_0x35ed59){var _0x21520c=squel['insert']()['into'](_0x3051('0x34'))[_0x3051('0x35')](['phone',_0x3051('0x36'),_0x3051('0x37'),_0x3051('0x24'),_0x35ed59,_0x3051('0x38'),'updatedAt'],squel[_0x3051('0x43')]()['field'](_0x3051('0x1e'),_0x3051('0x1e'))[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x36'))['field']('id',_0x3051('0x37'))['field'](LISTID[_0x3051('0x3b')](),_0x3051('0x24'))['field'](_0x1eeac2['id'][_0x3051('0x3b')](),_0x35ed59)[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x38'))[_0x3051('0x39')](_0x3051('0x3a'),_0x3051('0x3c'))[_0x3051('0x3d')]('cm_contacts')[_0x3051('0x3f')]('deletedAt\x20IS\x20NULL')[_0x3051('0x3f')]('ListId\x20=\x20?',LISTID[_0x3051('0x3b')]())['where'](_0x3051('0x49'),squel[_0x3051('0x45')](hopperContacts))[_0x3051('0x3f')](_0x3051('0x41')))['toString']();return _0x21520c;}function _0x18971b(_0x1eb8c1,_0x3d59b8){var _0x440c8a=squel[_0x3051('0x32')]()['into'](_0x3051('0x4a'))['fromQuery']([_0x3051('0x1e'),_0x3051('0x37'),_0x3051('0x24'),_0x3d59b8,_0x3051('0x38'),_0x3051('0x3c')],squel[_0x3051('0x43')]()[_0x3051('0x39')](_0x3051('0x1e'),'phone')['field']('id',_0x3051('0x37'))['field'](LISTID[_0x3051('0x3b')](),_0x3051('0x24'))[_0x3051('0x39')](_0x1eb8c1['id']['toString'](),_0x3d59b8)[_0x3051('0x39')](_0x3051('0x3a'),'createdAt')['field'](_0x3051('0x3a'),_0x3051('0x3c'))[_0x3051('0x3d')](_0x3051('0x44'))[_0x3051('0x3f')]('deletedAt\x20IS\x20NULL')[_0x3051('0x3f')](_0x3051('0x40'),LISTID[_0x3051('0x3b')]())['where']('id\x20IN\x20?',squel[_0x3051('0x45')](hopperContacts))[_0x3051('0x3f')](_0x3051('0x41')))['toString']();return _0x440c8a;}return db[_0x3051('0x4b')][_0x3051('0x4c')]({'where':{'type':_0x3051('0x4d')},'attributes':['id',_0x3051('0x4e')],'include':[{'model':db[_0x3051('0x4f')],'as':_0x3051('0x50'),'where':{'id':LISTID}}]})[_0x3051('0x2a')](function(_0x42419d){var _0x111ac6=[];if(_0x42419d){var _0x3ce9c9;for(var _0xd76385=0x0,_0x35857a;_0xd76385<_0x42419d[_0x3051('0x18')];_0xd76385+=0x1){_0x35857a=_0x42419d[_0xd76385][_0x3051('0x51')]({'plain':!![]});switch(_0x35857a[_0x3051('0x4e')]){case _0x3051('0x52'):_0x111ac6[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x5eb6f2(_0x35857a,_0x3051('0x55')))['then'](function(){})[_0x3051('0x2d')](_0x20b26e()));break;case _0x3051('0x56'):_0x111ac6[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x2433b7(_0x35857a,'VoiceQueueId'))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));break;default:_0x111ac6['push'](db['sequelize']['query'](_0x4b59b7(_0x35857a,_0x3051('0x55')))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));}}}return _0x111ac6;})[_0x3051('0x57')]()[_0x3051('0x2a')](function(){return db[_0x3051('0x4b')][_0x3051('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3051('0x4f')],'as':_0x3051('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x566632){var _0x2efc40=[];if(_0x566632){var _0xbb88d;for(var _0x255e28=0x0,_0x13f50d;_0x255e28<_0x566632['length'];_0x255e28+=0x1){_0x13f50d=_0x566632[_0x255e28]['get']({'plain':!![]});_0x2efc40[_0x3051('0x2b')](db['sequelize'][_0x3051('0x54')](_0x18971b(_0x13f50d,_0x3051('0x55')))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));}}return _0x2efc40;})['all']();})[_0x3051('0x2a')](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3051('0x4f')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x19e05b){var _0x38e1ba=[];if(_0x19e05b){for(var _0x34f156=0x0,_0x6f5aa8;_0x34f156<_0x19e05b['length'];_0x34f156+=0x1){_0x6f5aa8=_0x19e05b[_0x34f156][_0x3051('0x51')]({'plain':!![]});switch(_0x6f5aa8[_0x3051('0x4e')]){case'always':_0x38e1ba[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x5eb6f2(_0x6f5aa8,_0x3051('0x59')))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));break;case _0x3051('0x56'):_0x38e1ba[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x2433b7(_0x6f5aa8,'CampaignId'))[_0x3051('0x2a')](function(){})['catch'](_0x20b26e()));break;default:_0x38e1ba[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x4b59b7(_0x6f5aa8,_0x3051('0x59')))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));}}}return _0x38e1ba;})[_0x3051('0x57')]();})[_0x3051('0x2a')](function(){return db[_0x3051('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3051('0x4f')],'as':_0x3051('0x58'),'where':{'id':LISTID}}]})[_0x3051('0x2a')](function(_0x6d23df){var _0x2b5542=[];if(_0x6d23df){for(var _0x25d1c4=0x0,_0x2c9e23;_0x25d1c4<_0x6d23df[_0x3051('0x18')];_0x25d1c4+=0x1){_0x2c9e23=_0x6d23df[_0x25d1c4][_0x3051('0x51')]({'plain':!![]});_0x2b5542[_0x3051('0x2b')](db[_0x3051('0x53')][_0x3051('0x54')](_0x18971b(_0x2c9e23,'CampaignId'))[_0x3051('0x2a')](function(){})[_0x3051('0x2d')](_0x20b26e()));}}return _0x2b5542;})[_0x3051('0x57')]();})[_0x3051('0x2d')](function(_0x51f9a9){logger['error']('cmContact,\x20%s,\x20%s',_0x3051('0x5b'),_0x51f9a9[_0x3051('0x19')]);});}var processPromises=function(_0x4819dd){return BPromise[_0x3051('0x57')](promises)[_0x3051('0x2a')](function(_0x159109){})['catch'](function(_0x31d281){logger[_0x3051('0x13')](_0x3051('0x5c'),JSON[_0x3051('0x5d')](_0x31d281));})[_0x3051('0x5e')](function(){socket[_0x3051('0x5f')](_0x3051('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4819dd){return _0x4819dd[_0x3051('0x61')]();}});};var endCsv=function(){return BPromise[_0x3051('0x62')]()[_0x3051('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x3051('0x2a')](function(){socket[_0x3051('0x5f')](_0x3051('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3f7d7b){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x3051('0x5d')](_0x3f7d7b));}finally{process[_0x3051('0x63')](0x0);}});};process['on'](_0x3051('0x64'),function(){logger[_0x3051('0x65')](_0x3051('0x66'));endCsv();});function main(){return BPromise[_0x3051('0x62')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3051('0x28')][_0x3051('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3051('0x2a')](function(_0x251669){var _0x3ec641=fs[_0x3051('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3051('0x68')](_0x3ec641,{'header':!![],'skipEmptyLines':!![],'step':function(_0x380f8c,_0x254b04){total+=0x1;var _0x1b2c86=total;promises[_0x3051('0x2b')](checkRow(_0x380f8c,_0x251669,_0x1b2c86)['then'](function(){success+=0x1;})[_0x3051('0x2d')](function(_0x47e371){if(_0x47e371[_0x3051('0x13')]){errors+=0x1;delete _0x47e371[_0x3051('0x13')];}else if(_0x47e371[_0x3051('0x27')]){duplicates+=0x1;delete _0x47e371['duplicate'];}rows[_0x3051('0x2b')](_0x47e371);}));if(total%0xc8===0x0){_0x254b04[_0x3051('0x69')]();return processPromises(_0x254b04);}},'complete':function(){return processPromises()[_0x3051('0x2a')](function(){logger[_0x3051('0x65')](_0x3051('0x6a'));endCsv();});},'error':function(_0x359da9,_0x13e1f3){logger[_0x3051('0x65')]('CSV\x20parse\x20error',JSON[_0x3051('0x5d')](_0x359da9));endCsv();}});})[_0x3051('0x2d')](function(_0x4f300f){logger[_0x3051('0x13')](_0x3051('0x6b'),JSON[_0x3051('0x5d')](_0x4f300f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 99f0fc0..b17fb6b 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 _0x58a4=['binding','phone\x20is\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','length','all','then','push','isNil','split','filter','findOne','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','errors','code','info','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','main','stringify','send','start','clone','socket_timestamp','server/files/tmp','.csv','header','name','_description','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists'];(function(_0x3cddaf,_0x38319d){var _0x2c0b77=function(_0x5e74a7){while(--_0x5e74a7){_0x3cddaf['push'](_0x3cddaf['shift']());}};_0x2c0b77(++_0x38319d);}(_0x58a4,0xbf));var _0x458a=function(_0x4e7b46,_0x1e5718){_0x4e7b46=_0x4e7b46-0x0;var _0x309599=_0x58a4[_0x4e7b46];return _0x309599;};'use strict';var fs=require('fs');var path=require(_0x458a('0x0'));var _=require(_0x458a('0x1'));var Papa=require(_0x458a('0x2'));var util=require(_0x458a('0x3'));var BPromise=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var squel=require(_0x458a('0x6'));var Redis=require(_0x458a('0x7'));var db=require(_0x458a('0x8'))['db'];var config=require(_0x458a('0x9'));var shared=require(_0x458a('0xa'));var logger=require(_0x458a('0xb'))(_0x458a('0xc'));config['redis']=_['defaults'](config[_0x458a('0xd')],{'host':_0x458a('0xe'),'port':0x18eb});var socket=require(_0x458a('0xf'))(new Redis(config[_0x458a('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x458a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x458a('0x11'));function isEmail(_0x45b79b){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))*$/[_0x458a('0x12')](_0x45b79b);}function selectNotIn(_0x2e1d67,_0x1ff87d,_0x50055c,_0xc1b9b4,_0x804e01){return squel['select']()[_0x458a('0x13')](_0x458a('0x14'))[_0x458a('0x15')](_0xc1b9b4)[_0x458a('0x16')](_0x1ff87d,null,_0x1ff87d+_0x458a('0x17')+_0xc1b9b4+'.'+_0x50055c)['where'](_0xc1b9b4+'.'+_0x50055c+'\x20=\x20'+_0x2e1d67+'.'+_0x50055c)[_0x458a('0x18')](_0x1ff87d+'.dialCheckDuplicateType\x20IN\x20('+_0x804e01[_0x458a('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x44f683,_0x10133b){promisesAdditionalPhones=[];return db[_0x458a('0x19')][_0x458a('0x1a')]({'raw':!![],'attributes':['id',_0x458a('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4b26be){if(_0x4b26be!==null){var _0x5c7993=[];for(var _0x2faf6a=0x0;_0x2faf6a<_0x4b26be[_0x458a('0x1c')];_0x2faf6a++){var _0x3558b9=_0x4b26be[_0x2faf6a];_0x5c7993['push'](insertAdditionalPhones(_0x3558b9));}}Promise[_0x458a('0x1d')](_0x5c7993)[_0x458a('0x1e')](function(){_0x44f683({'val':0x1});});});});}function insertAdditionalPhones(_0x18504d){return new Promise(function(_0x392986,_0xa91473){var _0x4df9ef=_0x18504d['AdditionalPhones'];var _0x178db9=_0x4df9ef['split'](';');var _0x3302b7=[];orderBy=0x0;for(var _0x398ff2=0x0;_0x398ff2<_0x178db9['length'];_0x398ff2++){_0x3302b7[_0x458a('0x1f')](splitAdditionalPhone(_0x18504d['id'],_0x178db9[_0x398ff2]));}Promise['all'](_0x3302b7)[_0x458a('0x1e')](function(){_0x392986({'val':_0x178db9[_0x458a('0x1c')]});});});}function splitAdditionalPhone(_0x59f44c,_0x641a0b){return new Promise(function(_0xead884,_0x5a2bcb){var _0xa6b8ff=_0x641a0b['split'](':');var _0x370959=_0xa6b8ff[0x0];var _0x5bca42=_0xa6b8ff[0x1];if(!_[_0x458a('0x20')](_0x5bca42)){var _0x5dfc6c=_0x5bca42[_0x458a('0x21')]('|');var _0x911eaf=[];for(var _0xcb0756=0x0;_0xcb0756<_0x5dfc6c[_0x458a('0x1c')];_0xcb0756++){if(_0x5dfc6c[_0xcb0756]!==''){var _0x339b95=_[_0x458a('0x22')](promisesAdditionalPhones,{'contactId':_0x59f44c,'phone':_0x5dfc6c[_0xcb0756]});if(_0x339b95[_0x458a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x458a('0x1f')]({'contactId':_0x59f44c,'contactTypeId':_0x370959,'phone':_0x5dfc6c[_0xcb0756],'orderBy':orderBy});}}}_0xead884({'ok':0x1});}else _0xead884({'res':0x0});});}function createAdditionalPhone(_0x1f2d0,_0xfc6b24,_0x52efed,_0x327fcb){var _0x21ec38='';var _0x5a55b7='';var _0xb94bd9=_0x52efed[_0x458a('0x21')]('§');_0x21ec38=_0xb94bd9[0x0];if(_0xb94bd9['length']==0x2)_0x5a55b7=_0xb94bd9[0x1];return new Promise(function(_0x5df150,_0x41b23d){return db['CmContactHasItem'][_0x458a('0x23')]({'where':{'CmContactId':_0x1f2d0,'item':_0x21ec38}})[_0x458a('0x1e')](function(_0x223f73){if(_0x223f73){return db['CmContactHasItem'][_0x458a('0x24')]({'ItemTypeId':_0xfc6b24,'description':_0x5a55b7,'OrderBy':_0x327fcb},{'where':{'CmContactId':_0x1f2d0,'item':_0x21ec38}})[_0x458a('0x1e')](function(_0x1426a8){_0x5df150({'res':'updated'});});}else{return db['CmContactHasItem'][_0x458a('0x25')]({'CmContactId':_0x1f2d0,'item':_0x21ec38,'description':_0x5a55b7,'ItemTypeId':_0xfc6b24,'OrderBy':_0x327fcb,'ItemClass':'PHONE'})[_0x458a('0x1e')](function(_0x56e0b9){_0x5df150({'res':_0x458a('0x26')});});}});});}function insertCmHopper(_0xb39224,_0x492843,_0x309a6a,_0x269f53,_0x625ae3){var _0x525caf=[_0x458a('0x27'),_0x458a('0x28'),_0x458a('0x29'),_0x458a('0x2a'),_0x492843+'.'+_0x269f53,_0x458a('0x2b'),'cm_contacts.updatedAt',_0x458a('0x2c'),_0x458a('0x2d'),'\x22'+_0x625ae3+'\x22'];return squel[_0x458a('0x2e')]()[_0x458a('0x2f')](_0x458a('0x30'))[_0x458a('0x31')](['phone',_0x458a('0x32'),_0x458a('0x33'),_0x458a('0x34'),_0x269f53,_0x458a('0x35'),_0x458a('0x36'),_0x458a('0x37'),_0x458a('0x38'),_0x458a('0x39')],squel[_0x458a('0x3a')]()['fields'](_0x525caf)[_0x458a('0x15')](_0x492843)[_0x458a('0x16')](_0x458a('0x3b'),null,_0x458a('0x3c')+_0x492843+_0x458a('0x3d'))[_0x458a('0x16')](_0x309a6a,null,_0x309a6a+_0x458a('0x17')+_0x492843+'.'+_0x269f53)[_0x458a('0x18')](_0x492843+_0x458a('0x3e'),_0xb39224)[_0x458a('0x18')](_0x458a('0x3f'),NOW)[_0x458a('0x18')](_0x458a('0x40'),selectNotIn(_0x492843,_0x309a6a,_0x269f53,_0x458a('0x30'),[_0x458a('0x41'),'\x22onlyIfOpen\x22']))[_0x458a('0x18')](_0x458a('0x40'),selectNotIn(_0x492843,_0x309a6a,_0x269f53,_0x458a('0x30'),[_0x458a('0x41')])))[_0x458a('0x42')]();}function insertCmHopperBlack(_0x46c1de,_0x2ce59a,_0x1224ba,_0x41d125){var _0x44c5ba=[_0x458a('0x27'),'cm_contacts.id',_0x458a('0x2a'),_0x2ce59a+'.'+_0x41d125,_0x458a('0x2b'),'cm_contacts.updatedAt'];return squel[_0x458a('0x2e')]()[_0x458a('0x2f')](_0x458a('0x43'))['fromQuery']([_0x458a('0x14'),_0x458a('0x33'),_0x458a('0x34'),_0x41d125,_0x458a('0x35'),_0x458a('0x36')],squel[_0x458a('0x3a')]()[_0x458a('0x44')](_0x44c5ba)[_0x458a('0x15')](_0x2ce59a)['join'](_0x458a('0x3b'),null,_0x458a('0x3c')+_0x2ce59a+_0x458a('0x3d'))['join'](_0x1224ba,null,_0x1224ba+_0x458a('0x17')+_0x2ce59a+'.'+_0x41d125)[_0x458a('0x18')](_0x2ce59a+'.CmListId\x20=\x20?',_0x46c1de)[_0x458a('0x18')](_0x458a('0x3f'),NOW)[_0x458a('0x18')](_0x458a('0x40'),squel[_0x458a('0x3a')]()['field']('phone')[_0x458a('0x15')](_0x458a('0x43'))[_0x458a('0x18')](_0x458a('0x45'),_0x46c1de)['where'](_0x41d125+_0x458a('0x46')+_0x2ce59a+'.'+_0x41d125)))[_0x458a('0x42')]();}function insertTzCmHopper(_0x5237b9,_0xac25b2,_0x56ec56,_0x40c97d,_0x357851,_0x30d9d9){var _0x595a32=[_0x458a('0x27'),_0x458a('0x47')+_0x30d9d9+_0x458a('0x48'),'cm_contacts.id','cm_contacts.ListId',_0xac25b2+'.'+_0x40c97d,_0x458a('0x2b'),_0x458a('0x49'),_0x458a('0x2c'),'cm_contacts.UserId','\x22'+_0x357851+'\x22'];var _0x5e7a64=squel[_0x458a('0x2e')]()[_0x458a('0x2f')](_0x458a('0x30'))[_0x458a('0x31')]([_0x458a('0x14'),_0x458a('0x32'),_0x458a('0x33'),_0x458a('0x34'),_0x40c97d,_0x458a('0x35'),_0x458a('0x36'),_0x458a('0x37'),_0x458a('0x38'),_0x458a('0x39')],squel[_0x458a('0x3a')]()[_0x458a('0x44')](_0x595a32)[_0x458a('0x15')](_0xac25b2)['join'](_0x458a('0x3b'),null,_0x458a('0x3c')+_0xac25b2+_0x458a('0x3d'))[_0x458a('0x16')](_0x56ec56,null,_0x56ec56+_0x458a('0x17')+_0xac25b2+'.'+_0x40c97d)['join'](_0x30d9d9,null,_0x30d9d9+'.id\x20=\x20'+_0xac25b2+'.'+_0x40c97d)['where'](_0xac25b2+_0x458a('0x3e'),_0x5237b9)['where'](_0x458a('0x3f'),NOW)[_0x458a('0x18')](_0x458a('0x40'),selectNotIn(_0xac25b2,_0x56ec56,_0x40c97d,_0x458a('0x30'),[_0x458a('0x41'),'\x22onlyIfOpen\x22']))['where'](_0x458a('0x40'),selectNotIn(_0xac25b2,_0x56ec56,_0x40c97d,_0x458a('0x30'),[_0x458a('0x41')])))[_0x458a('0x42')]();return _0x5e7a64;}function insertTzCmHopperBlack(_0x2d67b1,_0x5a6650,_0x21c01a,_0x4eed01){var _0xa51e28=['cm_contacts.phone',_0x458a('0x29'),'cm_contacts.ListId',_0x5a6650+'.'+_0x4eed01,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x458a('0x2e')]()[_0x458a('0x2f')]('cm_hopper_black')[_0x458a('0x31')]([_0x458a('0x14'),_0x458a('0x33'),'ListId',_0x4eed01,_0x458a('0x35'),_0x458a('0x36')],squel[_0x458a('0x3a')]()[_0x458a('0x44')](_0xa51e28)[_0x458a('0x15')](_0x5a6650)[_0x458a('0x16')]('cm_contacts',null,_0x458a('0x3c')+_0x5a6650+_0x458a('0x3d'))[_0x458a('0x16')](_0x21c01a,null,_0x21c01a+_0x458a('0x17')+_0x5a6650+'.'+_0x4eed01)[_0x458a('0x18')](_0x5a6650+_0x458a('0x3e'),_0x2d67b1)[_0x458a('0x18')](_0x458a('0x3f'),NOW)['where'](_0x458a('0x40'),squel['select']()[_0x458a('0x13')](_0x458a('0x14'))[_0x458a('0x15')](_0x458a('0x43'))['where']('ListId\x20=\x20?',_0x2d67b1)[_0x458a('0x18')](_0x4eed01+_0x458a('0x46')+_0x5a6650+'.'+_0x4eed01)))[_0x458a('0x42')]();}function insertCmHopperAdditionalPhones(_0x156a22){var _0x1beef7=[_0x458a('0x4a'),'cm_contact_has_items.item',_0x458a('0x4b'),_0x458a('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x458a('0x2e')]()['into'](_0x458a('0x4d'))[_0x458a('0x31')]([_0x458a('0x4e'),_0x458a('0x14'),_0x458a('0x4f'),_0x458a('0x35'),_0x458a('0x36')],squel[_0x458a('0x3a')]()['fields'](_0x1beef7)[_0x458a('0x15')](_0x458a('0x30'))['join'](_0x458a('0x3b'),null,_0x458a('0x50'))['join'](_0x458a('0x51'),null,_0x458a('0x52'))['where'](_0x458a('0x53'),_0x156a22)[_0x458a('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x458a('0x42')]();}function insertCmContact(_0x1f95d4,_0xce9756,_0x404d93,_0x541375){var _0x27d1f2=_[_0x458a('0x54')](_[_0x458a('0x55')](_0x541375),['ListId',_0x458a('0x56'),_0x458a('0x35'),_0x458a('0x36')]);return squel[_0x458a('0x2e')]()[_0x458a('0x2f')](_0x458a('0x3b'))[_0x458a('0x31')](_0x27d1f2,squel[_0x458a('0x3a')]()[_0x458a('0x44')](_0x27d1f2)[_0x458a('0x15')](_0xce9756)['where']('('+_0x404d93[_0x458a('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0x458a('0x3a')]()[_0x458a('0x44')](_0x404d93)[_0x458a('0x15')](_0x458a('0x3b'))[_0x458a('0x18')](_0x458a('0x45'),_0x1f95d4)[_0x458a('0x18')](_0x458a('0x57')))[_0x458a('0x18')](_0x458a('0x58'),squel[_0x458a('0x3a')]()[_0x458a('0x13')](_0x458a('0x59'),_0x458a('0x5a'))[_0x458a('0x15')](_0xce9756)[_0x458a('0x5b')](_0x404d93['join'](','))))[_0x458a('0x42')]();}function handleStop(){logger['info'](_0x458a('0x5c'));stopped=!![];}function handleUncaughtException(_0x2ea9ce){logger['error'](_0x2ea9ce[_0x458a('0x5d')]);process[_0x458a('0x5e')](0x1);}function handleError(_0x350b73,_0x494710){stats[_0x458a('0x5f')][_0x458a('0x1f')]({'name':_0x494710[_0x458a('0x60')],'message':_0x494710[_0x458a('0x5d')],'row':_0x350b73});}function handleQuery(_0x2892e3){logger[_0x458a('0x61')](_0x2892e3);return db['sequelize'][_0x458a('0x62')](_0x2892e3)['spread'](function(_0x567b68){results[_0x458a('0x1f')](_0x567b68);})[_0x458a('0x63')](function(_0xc0538f){logger[_0x458a('0x64')](_0xc0538f[_0x458a('0x5d')]);});}function updateTzCampaigns(_0x434d04){return new Promise(function(_0x42eae7,_0x5aee0d){var _0x3d30e2=squel[_0x458a('0x3a')]()[_0x458a('0x44')]([_0x458a('0x65'),_0x458a('0x66')])[_0x458a('0x15')]('campaigns')['join']('campaigns_has_cm_lists',null,_0x458a('0x67'))['where'](_0x458a('0x68')+_0x434d04);db[_0x458a('0x69')][_0x458a('0x62')](_0x3d30e2[_0x458a('0x42')]())[_0x458a('0x6a')](function(_0x2246e9){var _0x46df7c=[];for(var _0x49f3ee=0x0;_0x49f3ee<_0x2246e9[_0x458a('0x1c')];_0x49f3ee++){_0x46df7c[_0x458a('0x1f')](getTimezoneData(_0x2246e9[_0x49f3ee],tmp_campaigns));}BPromise['all'](_0x46df7c)[_0x458a('0x1e')](function(){_0x42eae7({'val':0x1});});})['catch'](function(_0xd11ebe){logger['error'](_0xd11ebe[_0x458a('0x5d')]);_0x42eae7({'val':0x0});});});}function updateTzVoiceQueues(_0x177457){return new Promise(function(_0xce45b5,_0x1fe8a1){var _0x5ab84f=squel[_0x458a('0x3a')]()[_0x458a('0x44')]([_0x458a('0x6b'),_0x458a('0x6c')])[_0x458a('0x15')](_0x458a('0x6d'))[_0x458a('0x16')](_0x458a('0x6e'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x458a('0x18')](_0x458a('0x6f')+_0x177457);db[_0x458a('0x69')][_0x458a('0x62')](_0x5ab84f['toString']())[_0x458a('0x6a')](function(_0x45569b){var _0x579352=[];for(var _0x32bc59=0x0;_0x32bc59<_0x45569b[_0x458a('0x1c')];_0x32bc59++){_0x579352[_0x458a('0x1f')](getTimezoneData(_0x45569b[_0x32bc59],tmp_voice_queues));}BPromise[_0x458a('0x1d')](_0x579352)[_0x458a('0x1e')](function(){_0xce45b5({'val':0x1});});})['catch'](function(_0x34d7a6){logger[_0x458a('0x64')](_0x34d7a6[_0x458a('0x5d')]);_0xce45b5({'val':0x0});});});}function getTimezoneData(_0x1dbaa7,_0x2006d7){return new Promise(function(_0x46ac5c,_0x2eecf0){var _0x573f46=shared[_0x458a('0x70')];var _0x4d3790=_0x573f46[_0x1dbaa7[_0x458a('0x71')]];if(_[_0x458a('0x20')](_0x4d3790)){_0x46ac5c({'ret':0x1});}else{var _0x1fa730=_0x4d3790['utcOffset'];var _0x3471bb=squel['insert']()['into'](_0x2006d7)[_0x458a('0x72')]('id',_0x1dbaa7['id'])[_0x458a('0x72')]('offset',_0x1fa730)['set'](_0x458a('0x71'),_0x1dbaa7[_0x458a('0x71')])[_0x458a('0x42')]();return db[_0x458a('0x69')][_0x458a('0x62')](_0x3471bb)['spread'](function(_0x102331){_0x46ac5c({'ret':0x1});})['catch'](function(_0x4389fb){logger[_0x458a('0x64')](_0x4389fb[_0x458a('0x5d')]);_0x2eecf0({'ret':0x1});});}});}function handleTZQuery(_0x54adb7){logger[_0x458a('0x61')](_0x54adb7);return db[_0x458a('0x69')]['query'](_0x54adb7)[_0x458a('0x6a')](function(_0x5bf72f){})[_0x458a('0x63')](function(_0x3fc263){logger[_0x458a('0x64')](_0x3fc263[_0x458a('0x5d')]);});}function main(_0x55a431,_0x5efcd7,_0x4caa30,_0x4a97c4){logger[_0x458a('0x61')](_0x458a('0x73'),_0x55a431,JSON[_0x458a('0x74')](_0x5efcd7));process[_0x458a('0x75')](_0x458a('0x76'));var _0x2eb92e=_0x5efcd7['binding'];var _0x3244a4=_[_0x458a('0x77')](_0x2eb92e);var _0xe744f5=_0x5efcd7[_0x458a('0x78')];var _0x17099e=path[_0x458a('0x16')](config['root'],_0x458a('0x79'),_0xe744f5+_0x458a('0x7a'));hasTZ=_[_0x458a('0x55')](_0x2eb92e)['includes'](_0x458a('0x71'));var _0x42d2a2=_[_0x458a('0x55')](_0x2eb92e)['join']();logger['info'](_0x458a('0x7b'),_0x42d2a2);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x548699){for(var _0x3f14bf=0x0;_0x3f14bf<_0x548699['length'];_0x3f14bf++){if(_0x548699[_0x3f14bf][_0x458a('0x7c')]in _0x2eb92e){contactItemTypes[_0x458a('0x1f')](_0x548699[_0x3f14bf]);delete _0x3244a4[_0x548699[_0x3f14bf][_0x458a('0x7c')]];hasAdditionalPhones=!![];}for(var _0xfcb712 in _0x2eb92e){if(_0x548699[_0x3f14bf][_0x458a('0x7c')]+_0x458a('0x7d')===_0xfcb712){phoneDescriptions['push']({'itemTypeId':_0x548699[_0x3f14bf]['id'],'description':_0xfcb712});delete _0x3244a4[_0xfcb712];}}}if(hasAdditionalPhones)_0x3244a4[_0x458a('0x1b')]='';var _0x59ad9c=_[_0x458a('0x55')](_0x3244a4)['join']();logger[_0x458a('0x61')](_0x458a('0x7b'),_0x59ad9c);fs['writeFileSync'](_0x17099e,_0x59ad9c+'\x0a');Papa['parse'](fs['createReadStream'](_0x55a431),{'header':!![],'skipEmptyLines':!![],'step':function(_0x84906,_0x384c46){try{for(var _0x21d8a9=0x0,_0xb4224d=[];_0x21d8a9<_0x84906[_0x458a('0x7e')]['length'];_0x21d8a9++){stats[_0x458a('0x7f')]+=0x1;if(_0x84906[_0x458a('0x5f')][_0x21d8a9]){handleError(_0x84906[_0x458a('0x7e')][_0x21d8a9],_0x84906[_0x458a('0x5f')][_0x21d8a9]);}else{var _0x34e76e=[];var _0x2fa49e=[];var _0x2646ae={};for(var _0x3f1232 in _0x2eb92e){let _0x52429f=contactItemTypes[_0x458a('0x80')](_0x3ec574=>_0x3ec574[_0x458a('0x7c')]===_0x3f1232);let _0x45a134=contactItemTypes[_0x458a('0x80')](_0x514db0=>_0x514db0[_0x458a('0x7c')]+'_description'===_0x3f1232);if(_['isNil'](_0x52429f)&&_['isNil'](_0x45a134)){if(_0x2eb92e['hasOwnProperty'](_0x3f1232)){if(_0x84906[_0x458a('0x7e')][_0x21d8a9][_0x2eb92e[_0x3f1232]]){var _0x3f187b=_[_0x458a('0x81')](_0x84906[_0x458a('0x7e')][_0x21d8a9][_0x2eb92e[_0x3f1232]]['replace'](/"/g,'\x27'));switch(_0x3f1232){case _0x458a('0x32'):var _0x4514df=moment(_0x3f187b,_0x458a('0x11'),!![]);if(_0x4514df[_0x458a('0x82')]()){_0xb4224d['push']('\x22'+_0x3f187b+'\x22');}else{_0x34e76e['push'](_0x458a('0x83'));}break;case _0x458a('0x37'):var _0x26026d=parseInt(_0x3f187b);_0x3f187b=_[_0x458a('0x84')](_0x26026d)||_0x26026d<0x0||_0x26026d>0x4?_0x4a97c4?0x3:0x2:_0x26026d;_0xb4224d['push']('\x22'+_0x3f187b+'\x22');break;case _0x458a('0x38'):var _0xe19173=parseInt(_0x3f187b);if(_[_0x458a('0x85')](_0xe19173)&&_[_0x458a('0x86')](_0x4caa30,_0xe19173)){_0xb4224d[_0x458a('0x1f')]('\x22'+_0xe19173+'\x22');}else{_0x34e76e[_0x458a('0x1f')](_0x458a('0x87'));}break;case _0x458a('0x88'):if(isEmail(_0x3f187b)){_0xb4224d[_0x458a('0x1f')]('\x22'+_0x3f187b+'\x22');}else{_0x34e76e[_0x458a('0x1f')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x3d58a4=moment(_0x3f187b,_0x458a('0x89'),!![]);if(_0x3d58a4[_0x458a('0x82')]()){_0xb4224d[_0x458a('0x1f')]('\x22'+_0x3f187b+'\x22');}else{_0x34e76e[_0x458a('0x1f')](_0x458a('0x8a'));}break;case _0x458a('0x71'):var _0x583d8a=shared[_0x458a('0x70')];var _0x5aa440=_0x583d8a[_0x3f187b];if(!_[_0x458a('0x20')](_0x5aa440)){var _0x1d7ecc=_0x5aa440[_0x458a('0x8b')];_0xb4224d['push']('\x22'+_0x3f187b+'\x22');_0xb4224d['push']('\x22'+_0x1d7ecc+'\x22');}break;default:_0xb4224d[_0x458a('0x1f')]('\x22'+_0x3f187b+'\x22');}}else{switch(_0x3f1232){case _0x458a('0x8c'):case _0x458a('0x14'):_0x34e76e[_0x458a('0x1f')](_0x3f1232+_0x458a('0x8d'));break;default:_0xb4224d['push']('\x22\x22');}}}}else{var _0x391854='';if(!_[_0x458a('0x20')](_0x52429f)){if(!_0x2646ae[_0x458a('0x8e')](_0x52429f['id'])){if(!_[_0x458a('0x20')](_0x84906[_0x458a('0x7e')][_0x21d8a9][_0x2eb92e[_0x3f1232]])){var _0x3f187b=_[_0x458a('0x81')](_0x84906[_0x458a('0x7e')][_0x21d8a9][_0x2eb92e[_0x3f1232]][_0x458a('0x8f')](/"/g,'\x27'));var _0x52b844=phoneDescriptions[_0x458a('0x80')](_0x543b46=>_0x543b46[_0x458a('0x90')]===_0x52429f['id']);if(!_[_0x458a('0x20')](_0x52b844)){var _0x125337=_['trim'](_0x84906['data'][_0x21d8a9][_0x2eb92e[_0x52b844[_0x458a('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x458a('0x20')](_0x125337))_0x3f187b=_0x3f187b+'§'+_0x125337;}if(_0x391854=='')_0x391854=_0x3f187b;else _0x391854+='|'+_0x3f187b;}_0x2fa49e['push'](_0x52429f['id']+':'+_0x391854);_0x2646ae[_0x52429f['id']]=0x1;}}}}if(hasAdditionalPhones){_0xb4224d[_0x458a('0x1f')]('\x22'+_0x2fa49e[_0x458a('0x16')](';')+'\x22');}if(_0x34e76e[_0x458a('0x1c')]){handleError(_0x84906['data'][_0x21d8a9],{'code':_0x458a('0x92'),'message':_0x34e76e[_0x458a('0x16')]()});}else{fs['appendFileSync'](_0x17099e,_0xb4224d[_0x458a('0x16')]()+'\x0a');}_0xb4224d=[];}if(!(stats['rows']%0xc8)){socket[_0x458a('0x93')](_0x458a('0x94')+_0xe744f5,stats);stats[_0x458a('0x5f')]=[];}}if(stopped){logger['info'](_0x458a('0x95'));_0x384c46[_0x458a('0x96')]();}}catch(_0x9f7d4){handleError(_0x84906[_0x458a('0x7e')][_0x21d8a9],{'code':_0x458a('0x97'),'message':_0x9f7d4[_0x458a('0x5d')]});logger['error'](_0x458a('0x98'),_0x9f7d4[_0x458a('0x5d')]);}},'complete':function(){try{var _0x57cd4b=[];var _0x13db18=[];var _0x187bc8=_0x458a('0x3b');if(_0x5efcd7['duplicates']&&_0x5efcd7[_0x458a('0x99')][_0x458a('0x1c')]){_0x187bc8=_0x458a('0x9a')+_0xe744f5;_0x57cd4b['push'](_0x458a('0x9b')+_0x187bc8+_0x458a('0x9c'));}tmp_campaigns=_0x458a('0x9d')+_0xe744f5;tmp_voice_queues=_0x458a('0x9e')+_0xe744f5;_0x13db18[_0x458a('0x1f')](_0x458a('0x9b')+tmp_campaigns+_0x458a('0x9f'));_0x13db18[_0x458a('0x1f')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x458a('0x9f'));BPromise['each'](_0x13db18,handleTZQuery)['then'](function(_0x57c3c6){updateTzCampaigns(_0x5efcd7[_0x458a('0x34')])['then'](function(_0x1e4ba3){updateTzVoiceQueues(_0x5efcd7['ListId'])[_0x458a('0x1e')](function(_0x58fa9b){if(hasTZ)_0x59ad9c=_0x59ad9c[_0x458a('0x8f')](_0x458a('0x71'),_0x458a('0xa0'));var _0x3a3882=util['format'](_0x458a('0xa1'),_0x17099e,_0x187bc8,_0x59ad9c,_0x5efcd7[_0x458a('0x34')],_0x5efcd7[_0x458a('0x56')]||null,NOW,NOW);if(_['isNil'](_0x2eb92e[_0x458a('0x32')])){_0x3a3882+=_0x458a('0xa2');}_0x57cd4b[_0x458a('0x1f')](_0x3a3882);if(_0x5efcd7[_0x458a('0x99')]&&_0x5efcd7['duplicates'][_0x458a('0x1c')]){_0x57cd4b['push'](insertCmContact(_0x5efcd7['ListId'],_0x187bc8,_0x5efcd7['duplicates'],_0x2eb92e));_0x57cd4b[_0x458a('0x1f')](_0x458a('0xa3')+_0x187bc8+';');}BPromise['each'](_0x57cd4b,handleQuery)[_0x458a('0x1e')](function(_0x49297c){BPromise[_0x458a('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x57cd4b=[];for(var _0x310a09=0x0;_0x310a09_0x569e60[_0xfee4('0x6e')]===_0x68524e);let _0x231b14=contactItemTypes[_0xfee4('0x75')](_0x31880b=>_0x31880b[_0xfee4('0x6e')]+_0xfee4('0x6f')===_0x68524e);if(_[_0xfee4('0x1c')](_0x29d1e3)&&_[_0xfee4('0x1c')](_0x231b14)){if(_0x21e5c6[_0xfee4('0x76')](_0x68524e)){if(_0x24d6f9[_0xfee4('0x73')][_0x2b6bcd][_0x21e5c6[_0x68524e]]){var _0x3eed99=_[_0xfee4('0x77')](_0x24d6f9[_0xfee4('0x73')][_0x2b6bcd][_0x21e5c6[_0x68524e]][_0xfee4('0x78')](/"/g,'\x27'));switch(_0x68524e){case _0xfee4('0x2a'):var _0x3aca31=moment(_0x3eed99,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3aca31[_0xfee4('0x79')]()){_0x286aa4[_0xfee4('0x19')]('\x22'+_0x3eed99+'\x22');}else{_0x59f267[_0xfee4('0x19')](_0xfee4('0x7a'));}break;case _0xfee4('0x2e'):var _0x991c59=parseInt(_0x3eed99);_0x3eed99=_[_0xfee4('0x7b')](_0x991c59)||_0x991c59<0x0||_0x991c59>0x4?_0x22da8e?0x3:0x2:_0x991c59;_0x286aa4[_0xfee4('0x19')]('\x22'+_0x3eed99+'\x22');break;case _0xfee4('0x42'):var _0x4880fc=parseInt(_0x3eed99);if(_[_0xfee4('0x7c')](_0x4880fc)&&_[_0xfee4('0x7d')](_0x399961,_0x4880fc)){_0x286aa4['push']('\x22'+_0x4880fc+'\x22');}else{_0x59f267[_0xfee4('0x19')](_0xfee4('0x7e'));}break;case _0xfee4('0x7f'):if(isEmail(_0x3eed99)){_0x286aa4[_0xfee4('0x19')]('\x22'+_0x3eed99+'\x22');}else{_0x59f267[_0xfee4('0x19')](_0xfee4('0x80'));}break;case _0xfee4('0x81'):var _0x17321c=moment(_0x3eed99,_0xfee4('0x82'),!![]);if(_0x17321c[_0xfee4('0x79')]()){_0x286aa4['push']('\x22'+_0x3eed99+'\x22');}else{_0x59f267[_0xfee4('0x19')](_0xfee4('0x83'));}break;case _0xfee4('0x61'):var _0x1d3d6a=shared[_0xfee4('0x60')];var _0x22658e=_0x1d3d6a[_0x3eed99];if(!_['isNil'](_0x22658e)){var _0xa3e38=_0x22658e['utcOffset'];_0x286aa4[_0xfee4('0x19')]('\x22'+_0x3eed99+'\x22');_0x286aa4[_0xfee4('0x19')]('\x22'+_0xa3e38+'\x22');}break;default:_0x286aa4[_0xfee4('0x19')]('\x22'+_0x3eed99+'\x22');}}else{switch(_0x68524e){case _0xfee4('0x84'):case _0xfee4('0xe'):_0x59f267['push'](_0x68524e+_0xfee4('0x85'));break;default:_0x286aa4[_0xfee4('0x19')]('\x22\x22');}}}}else{var _0x12e3fd='';if(!_[_0xfee4('0x1c')](_0x29d1e3)){if(!_0x3a0662['hasOwnProperty'](_0x29d1e3['id'])){if(!_[_0xfee4('0x1c')](_0x24d6f9[_0xfee4('0x73')][_0x2b6bcd][_0x21e5c6[_0x68524e]])){var _0x3eed99=_[_0xfee4('0x77')](_0x24d6f9['data'][_0x2b6bcd][_0x21e5c6[_0x68524e]][_0xfee4('0x78')](/"/g,'\x27'));var _0x44deee=phoneDescriptions[_0xfee4('0x75')](_0x54c248=>_0x54c248[_0xfee4('0x86')]===_0x29d1e3['id']);if(!_[_0xfee4('0x1c')](_0x44deee)){var _0x312433=_[_0xfee4('0x77')](_0x24d6f9[_0xfee4('0x73')][_0x2b6bcd][_0x21e5c6[_0x44deee[_0xfee4('0x87')]]][_0xfee4('0x78')](/"/g,'\x27'));if(!_[_0xfee4('0x1c')](_0x312433))_0x3eed99=_0x3eed99+'§'+_0x312433;}if(_0x12e3fd=='')_0x12e3fd=_0x3eed99;else _0x12e3fd+='|'+_0x3eed99;}_0x275cd0[_0xfee4('0x19')](_0x29d1e3['id']+':'+_0x12e3fd);_0x3a0662[_0x29d1e3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x286aa4['push']('\x22'+_0x275cd0['join'](';')+'\x22');}if(_0x59f267[_0xfee4('0x18')]){handleError(_0x24d6f9[_0xfee4('0x73')][_0x2b6bcd],{'code':'SystemRow','message':_0x59f267['join']()});}else{fs[_0xfee4('0x88')](_0x218b76,_0x286aa4[_0xfee4('0x10')]()+'\x0a');}_0x286aa4=[];}if(!(stats[_0xfee4('0x74')]%0xc8)){socket[_0xfee4('0x89')](_0xfee4('0x8a')+_0x217f18,stats);stats['errors']=[];}}if(stopped){logger[_0xfee4('0x51')](_0xfee4('0x8b'));_0x3a7773['abort']();}}catch(_0x2384ed){handleError(_0x24d6f9['data'][_0x2b6bcd],{'code':_0xfee4('0x8c'),'message':_0x2384ed[_0xfee4('0x56')]});logger[_0xfee4('0x53')](_0xfee4('0x8d'),_0x2384ed['message']);}},'complete':function(){try{var _0x19b090=[];var _0x5a5b46=[];var _0x19c220=_0xfee4('0x31');if(_0x569432[_0xfee4('0x8e')]&&_0x569432[_0xfee4('0x8e')]['length']){_0x19c220=_0xfee4('0x8f')+_0x217f18;_0x19b090[_0xfee4('0x19')](_0xfee4('0x90')+_0x19c220+_0xfee4('0x91'));}tmp_campaigns=_0xfee4('0x92')+_0x217f18;tmp_voice_queues='voice_queues_'+_0x217f18;_0x5a5b46[_0xfee4('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xfee4('0x93'));_0x5a5b46[_0xfee4('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xfee4('0x93'));BPromise[_0xfee4('0x94')](_0x5a5b46,handleTZQuery)['then'](function(_0x380654){updateTzCampaigns(_0x569432[_0xfee4('0x2c')])['then'](function(_0x60f798){updateTzVoiceQueues(_0x569432[_0xfee4('0x2c')])['then'](function(_0x51a630){if(hasTZ)_0x228eca=_0x228eca[_0xfee4('0x78')]('dialTimezone',_0xfee4('0x95'));var _0x377a85=util[_0xfee4('0xb')]('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',_0x218b76,_0x19c220,_0x228eca,_0x569432[_0xfee4('0x2c')],_0x569432[_0xfee4('0x4c')]||null,NOW,NOW);if(_[_0xfee4('0x1c')](_0x21e5c6[_0xfee4('0x2a')])){_0x377a85+=_0xfee4('0x96');}_0x19b090[_0xfee4('0x19')](_0x377a85);if(_0x569432[_0xfee4('0x8e')]&&_0x569432[_0xfee4('0x8e')][_0xfee4('0x18')]){_0x19b090[_0xfee4('0x19')](insertCmContact(_0x569432['ListId'],_0x19c220,_0x569432[_0xfee4('0x8e')],_0x21e5c6));_0x19b090[_0xfee4('0x19')]('DROP\x20TABLE\x20'+_0x19c220+';');}BPromise[_0xfee4('0x94')](_0x19b090,handleQuery)[_0xfee4('0x17')](function(_0x12dcd5){BPromise[_0xfee4('0x1b')]([handleAdditionalPhones()])[_0xfee4('0x17')](function(){_0x19b090=[];for(var _0x5e0076=0x0;_0x5e0076\x20\x20');}var _0x3b9d48=path[_0xfee4('0x10')](config[_0xfee4('0x6a')],_0xfee4('0x6b'),process[_0xfee4('0xa4')][0x2]);if(!fs[_0xfee4('0xa5')](_0x3b9d48)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x136bc1={};try{_0x136bc1=JSON[_0xfee4('0x71')](process[_0xfee4('0xa4')][0x3]);if(!_0x136bc1[_0xfee4('0x67')]){throw new Error(_0xfee4('0xa6'));}if(!_0x136bc1[_0xfee4('0x67')]['phone']){throw new Error(_0xfee4('0xa7'));}if(!_0x136bc1[_0xfee4('0x67')][_0xfee4('0x84')]){throw new Error(_0xfee4('0xa8'));}var _0x580078=0x0;if(_0x136bc1[_0xfee4('0x67')][_0xfee4('0x42')]){_0x580078=0x1;}if(!_0x136bc1['ListId']){throw new Error(_0xfee4('0xa9'));}}catch(_0x3c9a85){throw new Error(_0xfee4('0xaa'));}var _0x414e2f=[];try{_0x414e2f=_[_0xfee4('0xab')](JSON[_0xfee4('0x71')](process['argv'][0x4]),'id');}catch(_0xeacd68){logger[_0xfee4('0x51')](_0xfee4('0xac'));}main(_0x3b9d48,_0x136bc1,_0x414e2f,_0x580078);}validate();process['on'](_0xfee4('0xad'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 8c6bafd..520e179 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5bf=['existsSync','file\x20doesn\x27t\x20exists','body\x20id\x20mandatory','path','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYYMMDDHHmmss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','spread','length','isNil','push','then','error','message','AdditionalPhones','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','exit','code','query','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','createReadStream','data','rows','errors','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','replace','description','SystemRow','appendFileSync','emit','contact:import:','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','all','contactId','orderBy','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xb5bf[_0x307d86];return _0x361745;};'use strict';var fs=require('fs');var path=require(_0xfb5b('0x0'));var _=require(_0xfb5b('0x1'));var Papa=require(_0xfb5b('0x2'));var util=require('util');var BPromise=require(_0xfb5b('0x3'));var moment=require('moment');var squel=require(_0xfb5b('0x4'));var Redis=require(_0xfb5b('0x5'));var db=require(_0xfb5b('0x6'))['db'];var config=require(_0xfb5b('0x7'));var logger=require(_0xfb5b('0x8'))(_0xfb5b('0x9'));config['redis']=_[_0xfb5b('0xa')](config[_0xfb5b('0xb')],{'host':_0xfb5b('0xc'),'port':0x18eb});var socket=require(_0xfb5b('0xd'))(new Redis(config[_0xfb5b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xfb5b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()['format'](_0xfb5b('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4e0c73){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))*$/[_0xfb5b('0x10')](_0x4e0c73);}function selectNotIn(_0x5a881c,_0x5af168,_0x9989e8,_0x2c6416,_0x3392f9){return squel['select']()[_0xfb5b('0x11')](_0xfb5b('0x12'))[_0xfb5b('0x13')](_0x2c6416)[_0xfb5b('0x14')](_0x5af168,null,_0x5af168+_0xfb5b('0x15')+_0x2c6416+'.'+_0x9989e8)[_0xfb5b('0x16')](_0x2c6416+'.'+_0x9989e8+_0xfb5b('0x17')+_0x5a881c+'.'+_0x9989e8)[_0xfb5b('0x16')](_0x5af168+'.dialCheckDuplicateType\x20IN\x20('+_0x3392f9[_0xfb5b('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1d96d8,_0x74e06f){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfb5b('0x18')]['query'](_0xfb5b('0x19')+tempTableName)[_0xfb5b('0x1a')](function(_0x1b2908){if(_0x1b2908!==null){var _0x5e7898=[];for(var _0x350661=0x0;_0x350661<_0x1b2908[_0xfb5b('0x1b')];_0x350661++){var _0x1da7c9=_0x1b2908[_0x350661];if(!_[_0xfb5b('0x1c')](_0x1da7c9[_0xfb5b('0x12')])){if(!_[_0xfb5b('0x1c')](_0x1da7c9['AdditionalPhones']))_0x5e7898[_0xfb5b('0x1d')](insertAdditionalPhones(_0x1da7c9));promisesContact['push']({'contact':_0x1da7c9});}}}Promise['all'](_0x5e7898)[_0xfb5b('0x1e')](function(){_0x1d96d8({'val':0x1});});})['catch'](function(_0x2a3fbc){logger[_0xfb5b('0x1f')](_0x2a3fbc[_0xfb5b('0x20')]);});});}function insertAdditionalPhones(_0x17d942){return new Promise(function(_0x1bb368,_0x2d2be1){var _0x3612a1=_0x17d942[_0xfb5b('0x21')];if(_[_0xfb5b('0x1c')](_0x3612a1))_0x2d2be1({'val':0x0});else{var _0x255e47=_0x3612a1['split'](';');var _0x3a6ade=[];orderBy=0x0;for(var _0x48137d=0x0;_0x48137d<_0x255e47[_0xfb5b('0x1b')];_0x48137d++){_0x3a6ade[_0xfb5b('0x1d')](splitAdditionalPhone(_0x17d942['id'],_0x255e47[_0x48137d]));}Promise['all'](_0x3a6ade)[_0xfb5b('0x1e')](function(){_0x1bb368({'val':_0x255e47[_0xfb5b('0x1b')]});});}});}function splitAdditionalPhone(_0x4ea97f,_0x2cd4b9){return new Promise(function(_0x40f702,_0x357377){var _0x4e8d99=_0x2cd4b9[_0xfb5b('0x22')](':');var _0xdd4c5e=_0x4e8d99[0x0];var _0x58c4a7=_0x4e8d99[0x1];if(_0x58c4a7!==''){var _0x311bff=_0x58c4a7['split']('|');var _0x2345ec=[];for(var _0x261d95=0x0;_0x261d95<_0x311bff[_0xfb5b('0x1b')];_0x261d95++){if(_0x311bff[_0x261d95]!==''){var _0x4d19eb=_['filter'](promisesAdditionalPhones,{'contactId':_0x4ea97f,'phone':_0x311bff[_0x261d95]});if(_0x4d19eb[_0xfb5b('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xfb5b('0x1d')]({'contactId':_0x4ea97f,'contactTypeId':_0xdd4c5e,'phone':_0x311bff[_0x261d95],'orderBy':orderBy});}}}_0x40f702({'ok':0x1});}else _0x40f702({'res':0x0});});}function createAdditionalPhone(_0x3ac1f8,_0x248ac7,_0x4348da,_0x3281b5){var _0x1bd64b='';var _0x57b3c1='';var _0x36e376=_0x4348da['split']('§');_0x1bd64b=_0x36e376[0x0];if(_0x36e376[_0xfb5b('0x1b')]==0x2)_0x57b3c1=_0x36e376[0x1];return new Promise(function(_0x193898,_0x3c0fd1){return db[_0xfb5b('0x23')][_0xfb5b('0x24')]({'where':{'CmContactId':_0x3ac1f8,'item':_0x1bd64b}})[_0xfb5b('0x1e')](function(_0x254179){if(_0x254179){return db['CmContactHasItem'][_0xfb5b('0x25')]({'ItemTypeId':_0x248ac7,'description':_0x57b3c1,'OrderBy':_0x3281b5},{'where':{'CmContactId':_0x3ac1f8,'item':_0x1bd64b}})['then'](function(_0x48077c){_0x193898({'res':_0xfb5b('0x26')});});}else{return db['CmContactHasItem'][_0xfb5b('0x27')]({'CmContactId':_0x3ac1f8,'item':_0x1bd64b,'ItemTypeId':_0x248ac7,'description':_0x57b3c1,'OrderBy':_0x3281b5,'ItemClass':_0xfb5b('0x28')})[_0xfb5b('0x1e')](function(_0x43dc70){_0x193898({'res':_0xfb5b('0x29')});});}});});}function updateContact(_0x1e4bfe){return new Promise(function(_0x233936,_0x3da698){var _0x1457e7=_0x1e4bfe['id'];delete _0x1e4bfe['id'];return db['CmContact'][_0xfb5b('0x25')](_0x1e4bfe,{'where':{'id':_0x1457e7}})[_0xfb5b('0x1e')](function(_0x5e687d){updatedRows+=0x1;return db[_0xfb5b('0x2a')][_0xfb5b('0x25')]({'phone':_0x1e4bfe[_0xfb5b('0x12')]},{'where':{'ContactId':_0x1457e7}})[_0xfb5b('0x1e')](function(_0x3b9435){_0x233936({'ret':'OK'});});});});}function insertCmHopper(_0x30ec4d,_0xd832c2,_0x514ce1,_0x2fbcbc,_0x4f6e40){var _0x223b21=[_0xfb5b('0x2b'),'cm_contacts.scheduledat',_0xfb5b('0x2c'),_0xfb5b('0x2d'),_0xd832c2+'.'+_0x2fbcbc,_0xfb5b('0x2e'),_0xfb5b('0x2f'),_0xfb5b('0x30'),_0xfb5b('0x31'),'\x22'+_0x4f6e40+'\x22'];return squel[_0xfb5b('0x32')]()[_0xfb5b('0x33')](_0xfb5b('0x34'))[_0xfb5b('0x35')]([_0xfb5b('0x12'),_0xfb5b('0x36'),_0xfb5b('0x37'),_0xfb5b('0x38'),_0x2fbcbc,_0xfb5b('0x39'),_0xfb5b('0x3a'),_0xfb5b('0x3b'),_0xfb5b('0x3c'),_0xfb5b('0x3d')],squel[_0xfb5b('0x3e')]()[_0xfb5b('0x3f')](_0x223b21)[_0xfb5b('0x13')](_0xd832c2)['join'](_0xfb5b('0x40'),null,_0xfb5b('0x41')+_0xd832c2+_0xfb5b('0x42'))[_0xfb5b('0x14')](_0x514ce1,null,_0x514ce1+_0xfb5b('0x15')+_0xd832c2+'.'+_0x2fbcbc)[_0xfb5b('0x16')](_0xd832c2+_0xfb5b('0x43'),_0x30ec4d)[_0xfb5b('0x16')](_0xfb5b('0x44'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xd832c2,_0x514ce1,_0x2fbcbc,_0xfb5b('0x34'),[_0xfb5b('0x45'),'\x22onlyIfOpen\x22']))[_0xfb5b('0x16')](_0xfb5b('0x46'),selectNotIn(_0xd832c2,_0x514ce1,_0x2fbcbc,_0xfb5b('0x34'),[_0xfb5b('0x45')])))[_0xfb5b('0x47')]();}function insertCmHopperBlack(_0x5ba944,_0xef08ad,_0x3e1b0b,_0x5d5d0c){var _0x2e83aa=[_0xfb5b('0x2b'),_0xfb5b('0x2c'),'cm_contacts.ListId',_0xef08ad+'.'+_0x5d5d0c,_0xfb5b('0x2e'),_0xfb5b('0x2f')];return squel[_0xfb5b('0x32')]()['into'](_0xfb5b('0x48'))[_0xfb5b('0x35')]([_0xfb5b('0x12'),_0xfb5b('0x37'),_0xfb5b('0x38'),_0x5d5d0c,_0xfb5b('0x39'),'updatedAt'],squel[_0xfb5b('0x3e')]()[_0xfb5b('0x3f')](_0x2e83aa)[_0xfb5b('0x13')](_0xef08ad)[_0xfb5b('0x14')](_0xfb5b('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0xef08ad+_0xfb5b('0x42'))[_0xfb5b('0x14')](_0x3e1b0b,null,_0x3e1b0b+_0xfb5b('0x15')+_0xef08ad+'.'+_0x5d5d0c)[_0xfb5b('0x16')](_0xef08ad+_0xfb5b('0x43'),_0x5ba944)[_0xfb5b('0x16')](_0xfb5b('0x44'),NOW)[_0xfb5b('0x16')](_0xfb5b('0x46'),squel[_0xfb5b('0x3e')]()[_0xfb5b('0x11')](_0xfb5b('0x12'))[_0xfb5b('0x13')](_0xfb5b('0x48'))[_0xfb5b('0x16')](_0xfb5b('0x49'),_0x5ba944)[_0xfb5b('0x16')](_0x5d5d0c+_0xfb5b('0x4a'),_0xef08ad+'.'+_0x5d5d0c)))[_0xfb5b('0x47')]();}function insertCmHopperAdditionalPhones(_0x18cf14){var _0x43faa4=[_0xfb5b('0x4b'),_0xfb5b('0x4c'),_0xfb5b('0x4d'),_0xfb5b('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0xfb5b('0x32')]()['into'](_0xfb5b('0x4f'))[_0xfb5b('0x35')]([_0xfb5b('0x50'),'phone',_0xfb5b('0x51'),_0xfb5b('0x39'),'updatedAt'],squel[_0xfb5b('0x3e')]()[_0xfb5b('0x3f')](_0x43faa4)['from'](_0xfb5b('0x34'))[_0xfb5b('0x14')]('cm_contacts',null,_0xfb5b('0x52'))['join'](_0xfb5b('0x53'),null,_0xfb5b('0x54'))[_0xfb5b('0x16')]('cm_hopper.ListId\x20=\x20?',_0x18cf14)[_0xfb5b('0x16')](_0xfb5b('0x44'),NOW))[_0xfb5b('0x47')]();}function insertCmContact(_0x502699,_0x3181da,_0x3bc3b2,_0x3e39ce){var _0x2995fd=_[_0xfb5b('0x55')](_[_0xfb5b('0x56')](_0x3e39ce),[_0xfb5b('0x38'),_0xfb5b('0x57'),_0xfb5b('0x39'),_0xfb5b('0x3a')]);return squel[_0xfb5b('0x32')]()[_0xfb5b('0x33')](_0xfb5b('0x40'))[_0xfb5b('0x35')](_0x2995fd,squel[_0xfb5b('0x3e')]()[_0xfb5b('0x3f')](_0x2995fd)[_0xfb5b('0x13')](_0x3181da)['where']('('+_0x3bc3b2[_0xfb5b('0x14')](',')+_0xfb5b('0x58'),squel[_0xfb5b('0x3e')]()[_0xfb5b('0x3f')](_0x3bc3b2)[_0xfb5b('0x13')](_0xfb5b('0x40'))[_0xfb5b('0x16')](_0xfb5b('0x49'),_0x502699))[_0xfb5b('0x16')](_0xfb5b('0x59'),squel[_0xfb5b('0x3e')]()[_0xfb5b('0x11')](_0xfb5b('0x5a'),'min_id')['from'](_0x3181da)[_0xfb5b('0x5b')](_0x3bc3b2[_0xfb5b('0x14')](','))))[_0xfb5b('0x47')]();}function handleStop(){logger[_0xfb5b('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xad840a){logger[_0xfb5b('0x1f')](_0xad840a[_0xfb5b('0x20')]);process[_0xfb5b('0x5d')](0x1);}function handleError(_0x1da4e3,_0x23959e){stats['errors']['push']({'name':_0x23959e[_0xfb5b('0x5e')],'message':_0x23959e['message'],'row':_0x1da4e3});}function handleQuery(_0x198143){logger[_0xfb5b('0x5c')](_0x198143);return db[_0xfb5b('0x18')][_0xfb5b('0x5f')](_0x198143)[_0xfb5b('0x1a')](function(_0x1bd162){results[_0xfb5b('0x1d')](_0x1bd162);})[_0xfb5b('0x60')](function(_0xfdecb){logger[_0xfb5b('0x1f')](_0xfdecb[_0xfb5b('0x20')]);});}function main(_0x14e77d,_0x433db6,_0x413350,_0x480f7c){logger[_0xfb5b('0x5c')](_0xfb5b('0x61'),_0x14e77d,JSON['stringify'](_0x433db6));process[_0xfb5b('0x62')](_0xfb5b('0x63'));var _0x3e589d=_0x433db6[_0xfb5b('0x64')];var _0x18eb89=_['clone'](_0x3e589d);var _0x5c1e15=_0x433db6[_0xfb5b('0x65')];var _0x195403=path[_0xfb5b('0x14')](config[_0xfb5b('0x66')],_0xfb5b('0x67'),_0x5c1e15+_0xfb5b('0x68'));logger[_0xfb5b('0x5c')](_0xfb5b('0x69'),_0x433db6);db[_0xfb5b('0x6a')][_0xfb5b('0x6b')]({'raw':!![],'attributes':['id','name']})[_0xfb5b('0x1e')](function(_0x25a0dd){for(var _0x8b26b1=0x0;_0x8b26b1<_0x25a0dd[_0xfb5b('0x1b')];_0x8b26b1++){if(_0x25a0dd[_0x8b26b1][_0xfb5b('0x6c')]in _0x3e589d){contactItemTypes[_0xfb5b('0x1d')](_0x25a0dd[_0x8b26b1]);delete _0x18eb89[_0x25a0dd[_0x8b26b1][_0xfb5b('0x6c')]];hasAdditionalPhones=!![];}for(var _0x2ff7bf in _0x3e589d){if(_0x25a0dd[_0x8b26b1][_0xfb5b('0x6c')]+_0xfb5b('0x6d')===_0x2ff7bf){phoneDescriptions['push']({'itemTypeId':_0x25a0dd[_0x8b26b1]['id'],'description':_0x2ff7bf});delete _0x18eb89[_0x2ff7bf];}}}if(hasAdditionalPhones)_0x18eb89[_0xfb5b('0x21')]='';var _0x58611c=_[_0xfb5b('0x56')](_0x18eb89)[_0xfb5b('0x14')]();logger[_0xfb5b('0x5c')](_0xfb5b('0x6e'),_0x58611c);fs['writeFileSync'](_0x195403,_0x58611c+'\x0a');Papa['parse'](fs[_0xfb5b('0x6f')](_0x14e77d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x10fece,_0xc1c22){try{for(var _0x53d5a1=0x0,_0x5326c5=[];_0x53d5a1<_0x10fece[_0xfb5b('0x70')]['length'];_0x53d5a1++){stats[_0xfb5b('0x71')]+=0x1;if(_0x10fece[_0xfb5b('0x72')][_0x53d5a1]){handleError(_0x10fece[_0xfb5b('0x70')][_0x53d5a1],_0x10fece[_0xfb5b('0x72')][_0x53d5a1]);}else{var _0x3e2b36=[];var _0x1fc4d5=[];var _0xc61cfe={};for(var _0xc09d52 in _0x3e589d){let _0x3207b9=contactItemTypes[_0xfb5b('0x73')](_0x2dc0e6=>_0x2dc0e6[_0xfb5b('0x6c')]===_0xc09d52);let _0x3b78a4=contactItemTypes[_0xfb5b('0x73')](_0x3b8de1=>_0x3b8de1['name']+'_description'===_0xc09d52);if(_['isNil'](_0x3207b9)&&_[_0xfb5b('0x1c')](_0x3b78a4)){if(_0x3e589d[_0xfb5b('0x74')](_0xc09d52)){if(_0x10fece['data'][_0x53d5a1][_0x3e589d[_0xc09d52]]){var _0x13ab57=_[_0xfb5b('0x75')](_0x10fece[_0xfb5b('0x70')][_0x53d5a1][_0x3e589d[_0xc09d52]]['replace'](/"/g,'\x27'));switch(_0xc09d52){case'scheduledat':var _0x314ce0=moment(_0x13ab57,_0xfb5b('0x76'),!![]);if(_0x314ce0[_0xfb5b('0x77')]()){_0x5326c5['push']('\x22'+_0x13ab57+'\x22');}else{_0x3e2b36[_0xfb5b('0x1d')](_0xfb5b('0x78'));}break;case _0xfb5b('0x3b'):var _0x53db4f=parseInt(_0x13ab57);_0x13ab57=_[_0xfb5b('0x79')](_0x53db4f)||_0x53db4f<0x0||_0x53db4f>0x4?_0x480f7c?0x3:0x2:_0x53db4f;_0x5326c5['push']('\x22'+_0x13ab57+'\x22');break;case _0xfb5b('0x3c'):var _0x3b0dec=parseInt(_0x13ab57);if(_['isNumber'](_0x3b0dec)&&_[_0xfb5b('0x7a')](_0x413350,_0x3b0dec)){_0x5326c5[_0xfb5b('0x1d')]('\x22'+_0x3b0dec+'\x22');}else{_0x3e2b36[_0xfb5b('0x1d')](_0xfb5b('0x7b'));}break;case _0xfb5b('0x7c'):if(isEmail(_0x13ab57)){_0x5326c5[_0xfb5b('0x1d')]('\x22'+_0x13ab57+'\x22');}else{_0x3e2b36[_0xfb5b('0x1d')](_0xfb5b('0x7d'));}break;case _0xfb5b('0x7e'):var _0x5a64fe=moment(_0x13ab57,_0xfb5b('0x7f'),!![]);if(_0x5a64fe[_0xfb5b('0x77')]()){_0x5326c5[_0xfb5b('0x1d')]('\x22'+_0x13ab57+'\x22');}else{_0x3e2b36[_0xfb5b('0x1d')](_0xfb5b('0x80'));}break;default:_0x5326c5[_0xfb5b('0x1d')]('\x22'+_0x13ab57+'\x22');}}else{switch(_0xc09d52){case'firstName':case _0xfb5b('0x12'):_0x3e2b36[_0xfb5b('0x1d')](_0xc09d52+_0xfb5b('0x81'));break;default:_0x5326c5['push']('\x22\x22');}}}}else{var _0x520bfb='';if(!_[_0xfb5b('0x1c')](_0x3207b9)){if(!_0xc61cfe['hasOwnProperty'](_0x3207b9['id'])){for(var _0x5d07d7=0x0;_0x5d07d7<_0x3e589d[_0xc09d52][_0xfb5b('0x1b')];_0x5d07d7++){var _0x13ab57=_[_0xfb5b('0x75')](_0x10fece['data'][_0x53d5a1][_0x3e589d[_0xc09d52][_0x5d07d7]][_0xfb5b('0x82')](/"/g,'\x27'));var _0x3c5900=phoneDescriptions[_0xfb5b('0x73')](_0x17a8b3=>_0x17a8b3['itemTypeId']===_0x3207b9['id']);if(!_[_0xfb5b('0x1c')](_0x3c5900)){var _0x384b3b=_['trim'](_0x10fece[_0xfb5b('0x70')][_0x53d5a1][_0x3e589d[_0x3c5900[_0xfb5b('0x83')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xfb5b('0x1c')](_0x384b3b))_0x13ab57=_0x13ab57+'§'+_0x384b3b;}if(_0x520bfb=='')_0x520bfb=_0x13ab57;else _0x520bfb+='|'+_0x13ab57;}_0x1fc4d5[_0xfb5b('0x1d')](_0x3207b9['id']+':'+_0x520bfb);_0xc61cfe[_0x3207b9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5326c5[_0xfb5b('0x1d')]('\x22'+_0x1fc4d5[_0xfb5b('0x14')](';')+'\x22');}if(_0x3e2b36[_0xfb5b('0x1b')]){handleError(_0x10fece[_0xfb5b('0x70')][_0x53d5a1],{'code':_0xfb5b('0x84'),'message':_0x3e2b36[_0xfb5b('0x14')]()});}else{fs[_0xfb5b('0x85')](_0x195403,_0x5326c5[_0xfb5b('0x14')]()+'\x0a');}_0x5326c5=[];}if(!(stats[_0xfb5b('0x71')]%0xc8)){socket[_0xfb5b('0x86')](_0xfb5b('0x87')+_0x5c1e15,stats);stats[_0xfb5b('0x72')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0xc1c22['abort']();}}catch(_0x51632e){handleError(_0x10fece[_0xfb5b('0x70')][_0x53d5a1],{'code':_0xfb5b('0x88'),'message':_0x51632e[_0xfb5b('0x20')]});logger[_0xfb5b('0x1f')](_0xfb5b('0x89'),_0x51632e[_0xfb5b('0x20')]);}},'complete':function(){try{var _0x598839=[];var _0x2a396e=tempTableName;_0x598839[_0xfb5b('0x1d')](_0xfb5b('0x8a')+_0x2a396e+_0xfb5b('0x8b'));logger[_0xfb5b('0x5c')](_0xfb5b('0x8c'),contactItemTypes[_0xfb5b('0x1b')]);var _0x31060d=util['format'](_0xfb5b('0x8d'),_0x195403,_0x2a396e,_0x58611c,_0x433db6[_0xfb5b('0x38')],_0x433db6[_0xfb5b('0x57')]||null,NOW,NOW);if(_[_0xfb5b('0x1c')](_0x3e589d[_0xfb5b('0x36')])){_0x31060d+=_0xfb5b('0x8e');}_0x598839[_0xfb5b('0x1d')](_0x31060d);BPromise[_0xfb5b('0x8f')](_0x598839,handleQuery)['then'](function(_0x411ab7){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x598839=[];for(var _0x400929=0x0;_0x400929_0x2859a0[_0xb30c('0x68')]===_0x5adca1);let _0x425459=contactItemTypes[_0xb30c('0x70')](_0x4dac7e=>_0x4dac7e[_0xb30c('0x68')]+_0xb30c('0x69')===_0x5adca1);if(_[_0xb30c('0x22')](_0x422ff9)&&_['isNil'](_0x425459)){if(_0x31deb2[_0xb30c('0x71')](_0x5adca1)){if(_0x5bf73e['data'][_0x39c61c][_0x31deb2[_0x5adca1]]){var _0x559113=_[_0xb30c('0x72')](_0x5bf73e[_0xb30c('0x6e')][_0x39c61c][_0x31deb2[_0x5adca1]]['replace'](/"/g,'\x27'));switch(_0x5adca1){case _0xb30c('0x35'):var _0x25d4fd=moment(_0x559113,_0xb30c('0xf'),!![]);if(_0x25d4fd[_0xb30c('0x73')]()){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3['push'](_0xb30c('0x74'));}break;case'priority':var _0x2eaefd=parseInt(_0x559113);_0x559113=_[_0xb30c('0x75')](_0x2eaefd)||_0x2eaefd<0x0||_0x2eaefd>0x4?_0x4dfe31?0x3:0x2:_0x2eaefd;_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');break;case _0xb30c('0x39'):var _0x44723a=parseInt(_0x559113);if(_[_0xb30c('0x76')](_0x44723a)&&_[_0xb30c('0x77')](_0x1493eb,_0x44723a)){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x44723a+'\x22');}else{_0x4728b3[_0xb30c('0x1c')]('agent\x20not\x20exists');}break;case _0xb30c('0x78'):if(isEmail(_0x559113)){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3[_0xb30c('0x1c')](_0xb30c('0x79'));}break;case _0xb30c('0x7a'):var _0x4cab39=moment(_0x559113,_0xb30c('0x7b'),!![]);if(_0x4cab39[_0xb30c('0x73')]()){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3[_0xb30c('0x1c')](_0xb30c('0x7c'));}break;default:_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}}else{switch(_0x5adca1){case'firstName':case _0xb30c('0x12'):_0x4728b3[_0xb30c('0x1c')](_0x5adca1+'\x20not\x20specified');break;default:_0x1d7ad4[_0xb30c('0x1c')]('\x22\x22');}}}}else{var _0x1d7fbf='';if(!_[_0xb30c('0x22')](_0x422ff9)){if(!_0x1b89e0['hasOwnProperty'](_0x422ff9['id'])){for(var _0x3dc4e6=0x0;_0x3dc4e6<_0x31deb2[_0x5adca1][_0xb30c('0x1a')];_0x3dc4e6++){var _0x559113=_[_0xb30c('0x72')](_0x5bf73e['data'][_0x39c61c][_0x31deb2[_0x5adca1][_0x3dc4e6]][_0xb30c('0x7d')](/"/g,'\x27'));var _0x31e9ed=phoneDescriptions[_0xb30c('0x70')](_0x2a881e=>_0x2a881e[_0xb30c('0x7e')]===_0x422ff9['id']);if(!_['isNil'](_0x31e9ed)){var _0x7e4342=_[_0xb30c('0x72')](_0x5bf73e[_0xb30c('0x6e')][_0x39c61c][_0x31deb2[_0x31e9ed[_0xb30c('0x7f')]][0x0]][_0xb30c('0x7d')](/"/g,'\x27'));if(!_[_0xb30c('0x22')](_0x7e4342))_0x559113=_0x559113+'§'+_0x7e4342;}if(_0x1d7fbf=='')_0x1d7fbf=_0x559113;else _0x1d7fbf+='|'+_0x559113;}_0x1f16a8[_0xb30c('0x1c')](_0x422ff9['id']+':'+_0x1d7fbf);_0x1b89e0[_0x422ff9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d7ad4['push']('\x22'+_0x1f16a8[_0xb30c('0x17')](';')+'\x22');}if(_0x4728b3[_0xb30c('0x1a')]){handleError(_0x5bf73e['data'][_0x39c61c],{'code':_0xb30c('0x80'),'message':_0x4728b3[_0xb30c('0x17')]()});}else{fs[_0xb30c('0x81')](_0x481537,_0x1d7ad4[_0xb30c('0x17')]()+'\x0a');}_0x1d7ad4=[];}if(!(stats['rows']%0xc8)){socket[_0xb30c('0x82')]('contact:import:'+_0x5875c6,stats);stats[_0xb30c('0x5c')]=[];}}if(stopped){logger[_0xb30c('0x59')](_0xb30c('0x83'));_0x2f3747[_0xb30c('0x84')]();}}catch(_0x1b5472){handleError(_0x5bf73e[_0xb30c('0x6e')][_0x39c61c],{'code':'SystemError','message':_0x1b5472[_0xb30c('0x21')]});logger[_0xb30c('0x20')]('step',_0x1b5472[_0xb30c('0x21')]);}},'complete':function(){try{var _0x3b80f1=[];var _0x99e471=tempTableName;_0x3b80f1[_0xb30c('0x1c')](_0xb30c('0x85')+_0x99e471+_0xb30c('0x86'));logger['info'](_0xb30c('0x87'),contactItemTypes[_0xb30c('0x1a')]);var _0x4e03fc=util[_0xb30c('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x481537,_0x99e471,_0x504300,_0x125143[_0xb30c('0x46')],_0x125143[_0xb30c('0x54')]||null,NOW,NOW);if(_[_0xb30c('0x22')](_0x31deb2[_0xb30c('0x35')])){_0x4e03fc+=_0xb30c('0x88');}_0x3b80f1[_0xb30c('0x1c')](_0x4e03fc);BPromise[_0xb30c('0x89')](_0x3b80f1,handleQuery)[_0xb30c('0x1e')](function(_0x343714){BPromise[_0xb30c('0x1d')]([handleAdditionalPhones()])[_0xb30c('0x1e')](function(){_0x3b80f1=[];for(var _0x3bb275=0x0;_0x3bb275\x20\x20');}var _0x529573=path[_0xb30c('0x17')](config[_0xb30c('0x64')],_0xb30c('0x65'),process[_0xb30c('0x91')][0x2]);if(!fs[_0xb30c('0x92')](_0x529573)){throw new Error(_0xb30c('0x93'));}var _0x1b0c15={};try{_0x1b0c15=JSON[_0xb30c('0x6c')](process[_0xb30c('0x91')][0x3]);if(!_0x1b0c15[_0xb30c('0x63')]){throw new Error(_0xb30c('0x94'));}var _0xa2521d=0x0;if(_0x1b0c15[_0xb30c('0x63')][_0xb30c('0x39')]){_0xa2521d=0x1;}if(!_0x1b0c15['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1f258c){throw new Error(_0xb30c('0x95'));}var _0x3bbe88=[];try{_0x3bbe88=_[_0xb30c('0x96')](JSON[_0xb30c('0x6c')](process[_0xb30c('0x91')][0x4]),'id');}catch(_0x31efd9){logger['info']('No\x20agent\x20available');}main(_0x529573,_0x1b0c15,_0x3bbe88,_0xa2521d);}validate();process['on'](_0xb30c('0x97'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 29d6cdd..dc78dac 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 _0x22c9=['inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','starttime','Answer\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice'];(function(_0x3f441b,_0x47017e){var _0x3d541e=function(_0x372944){while(--_0x372944){_0x3f441b['push'](_0x3f441b['shift']());}};_0x3d541e(++_0x47017e);}(_0x22c9,0x9f));var _0x922c=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x22c9[_0x17784a];return _0x41aded;};'use strict';exports[_0x922c('0x0')]=function(_0x218397,_0xa1c32e){var _0x4845d0=[{'type':_0x922c('0x1'),'content':_0x922c('0x2'),'variableName':null}];switch(_0x218397[_0x922c('0x3')]()){case _0x922c('0x4'):switch(_0xa1c32e[_0x922c('0x3')]()){case _0x922c('0x5'):_0x4845d0[_0x922c('0x6')]({'type':_0x922c('0x7'),'content':'','variableName':_0x922c('0x8')});_0x4845d0['push']({'type':'variable','content':'','variableName':_0x922c('0x9')});break;case _0x922c('0xa'):_0x4845d0[_0x922c('0x6')]({'type':_0x922c('0x1'),'content':_0x922c('0xb'),'variableName':null});_0x4845d0['push']({'type':_0x922c('0x7'),'content':'','variableName':_0x922c('0xc')});break;}}return _0x4845d0;};exports['getDescriptions']=function(_0x53d903,_0x3f98af){var _0x55841e=[];switch(_0x53d903[_0x922c('0x3')]()){case _0x922c('0x4'):switch(_0x3f98af[_0x922c('0x3')]()){case _0x922c('0x5'):_0x55841e=[{'type':_0x922c('0x1'),'content':_0x922c('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0xf'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x9')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':'calleridname'},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x10'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x922c('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x922c('0x12'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x13')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x14'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x15')},{'type':_0x922c('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x922c('0xe'),'content':'','key':'Agent\x20Name','keyType':_0x922c('0x7'),'variableName':_0x922c('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0x922c('0x7'),'variableName':_0x922c('0xc')},{'type':_0x922c('0x1'),'content':_0x922c('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x18'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x15')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x19'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x1a')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x1b'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x1c')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x1d'),'keyType':_0x922c('0x7'),'variableName':_0x922c('0x1e')},{'type':'keyValue','content':'','key':_0x922c('0x1f'),'keyType':'variable','variableName':_0x922c('0x20')}];break;case _0x922c('0xa'):_0x55841e=[{'type':_0x922c('0x1'),'content':_0x922c('0xd'),'variableName':null},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x21'),'keyType':_0x922c('0x7'),'keyContent':'','variableName':_0x922c('0xc')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x922c('0x7'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0x922c('0x13')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x14'),'keyType':_0x922c('0x7'),'keyContent':'','variableName':_0x922c('0x22')},{'type':_0x922c('0x1'),'content':_0x922c('0x17')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x23'),'keyType':_0x922c('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x922c('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x922c('0x7'),'keyContent':'','variableName':_0x922c('0x24')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x25'),'keyType':_0x922c('0x7'),'keyContent':'','variableName':_0x922c('0x26')},{'type':_0x922c('0xe'),'content':'','key':_0x922c('0x27'),'keyType':_0x922c('0x7'),'keyContent':'','variableName':_0x922c('0x28')}];break;}}return _0x55841e;}; \ No newline at end of file +var _0x76f8=['Talk\x20Time','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','starttime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime'];(function(_0x24b9d4,_0x3042e0){var _0x2ac1c9=function(_0x3b0a45){while(--_0x3b0a45){_0x24b9d4['push'](_0x24b9d4['shift']());}};_0x2ac1c9(++_0x3042e0);}(_0x76f8,0x96));var _0x876f=function(_0x122911,_0x1f5560){_0x122911=_0x122911-0x0;var _0x3ca44a=_0x76f8[_0x122911];return _0x3ca44a;};'use strict';exports[_0x876f('0x0')]=function(_0x584139,_0x36cb96){var _0x5af3d4=[{'type':_0x876f('0x1'),'content':_0x876f('0x2'),'variableName':null}];switch(_0x584139[_0x876f('0x3')]()){case _0x876f('0x4'):switch(_0x36cb96['toLowerCase']()){case'inbound':_0x5af3d4[_0x876f('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x5af3d4[_0x876f('0x5')]({'type':_0x876f('0x6'),'content':'','variableName':_0x876f('0x7')});break;case _0x876f('0x8'):_0x5af3d4['push']({'type':_0x876f('0x1'),'content':_0x876f('0x9'),'variableName':null});_0x5af3d4['push']({'type':_0x876f('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x5af3d4;};exports[_0x876f('0xa')]=function(_0x33eda1,_0x284f6e){var _0x293b84=[];switch(_0x33eda1[_0x876f('0x3')]()){case _0x876f('0x4'):switch(_0x284f6e['toLowerCase']()){case'inbound':_0x293b84=[{'type':_0x876f('0x1'),'content':_0x876f('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0xd'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x7')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0xe'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0xf')},{'type':_0x876f('0xc'),'content':'','key':'Call\x20To','keyType':_0x876f('0x6'),'variableName':_0x876f('0x10')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x11'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x12')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x13'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x14')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x15'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x876f('0x1'),'content':_0x876f('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x876f('0xc'),'content':'','key':'Agent\x20Name','keyType':_0x876f('0x6'),'variableName':_0x876f('0x17')},{'type':'keyValue','content':'','key':_0x876f('0x18'),'keyType':_0x876f('0x6'),'variableName':'destcalleridnum'},{'type':_0x876f('0x1'),'content':_0x876f('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x1a'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x1b')},{'type':'keyValue','content':'','key':_0x876f('0x1c'),'keyType':'variable','variableName':_0x876f('0x1d')},{'type':'keyValue','content':'','key':_0x876f('0x1e'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x1f')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x20'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x21')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x22'),'keyType':_0x876f('0x6'),'variableName':_0x876f('0x23')}];break;case _0x876f('0x8'):_0x293b84=[{'type':_0x876f('0x1'),'content':_0x876f('0xb'),'variableName':null},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x24'),'keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x25')},{'type':'keyValue','content':'','key':_0x876f('0x26'),'keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x27')},{'type':_0x876f('0xc'),'content':'','key':_0x876f('0x13'),'keyType':'variable','keyContent':'','variableName':_0x876f('0x14')},{'type':'keyValue','content':'','key':_0x876f('0x15'),'keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x28')},{'type':_0x876f('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x876f('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x876f('0x6'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x876f('0x29'),'keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x2a')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x2b')},{'type':'keyValue','content':'','key':_0x876f('0x2c'),'keyType':_0x876f('0x6'),'keyContent':'','variableName':_0x876f('0x2d')}];break;}}return _0x293b84;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f965615..bac65cc 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 _0x9edb=['InteractionId','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x9edb,0x16d));var _0xb9ed=function(_0x3cbbf6,_0x56a428){_0x3cbbf6=_0x3cbbf6-0x0;var _0x366cb2=_0x9edb[_0x3cbbf6];return _0x366cb2;};'use strict';var _=require('lodash');var db=require(_0xb9ed('0x0'))['db'];var loggers={'openchannel':require(_0xb9ed('0x1'))(_0xb9ed('0x2')),'mail':require(_0xb9ed('0x1'))(_0xb9ed('0x3')),'fax':require('../../config/logger')(_0xb9ed('0x4')),'sms':require(_0xb9ed('0x1'))('sms-interactions'),'chat':require(_0xb9ed('0x1'))(_0xb9ed('0x5')),'whatsapp':require('../../config/logger')(_0xb9ed('0x6'))};function getInteractionId(_0x35cc62,_0x5748a0,_0x5ee1b3){if(_0x35cc62&&_0x35cc62[_['upperFirst'](_0x5ee1b3)+_0xb9ed('0x7')]){return _0x35cc62[_[_0xb9ed('0x8')](_0x5ee1b3)+_0xb9ed('0x7')];}else if(_0x35cc62&&_0x35cc62['id']){return _0x35cc62['id'];}else if(_0x5748a0&&_0x5748a0['id']){return _0x5748a0['id'];}else{return'unknown';}}function log(_0xe20c65,_0x1da320,_0x2cda19,_0x11390e,_0x7f262a,_0x3f48ff){loggers[_0x7f262a[_0xb9ed('0x9')]()][_0xe20c65](_0xb9ed('0xa'),_0x3f48ff[_0xb9ed('0xb')](),_0x1da320?_0x1da320['id']:null,_0x1da320?_0x1da320[_0xb9ed('0xc')]:null,_0x1da320?_0x1da320[_0xb9ed('0xd')]:null,getInteractionId(_0x2cda19,_0x11390e,_0x7f262a),_0x2cda19?JSON[_0xb9ed('0xe')](_0x2cda19):_0xb9ed('0xf'));}function updateUser(_0x22005a,_0x49e585,_0x132dac,_0x1f8280,_0xd6f1e3){db[_['upperFirst'](_0x1f8280)+_0xb9ed('0x10')][_0xb9ed('0x11')]({'where':{'id':getInteractionId(_0x49e585,_0x132dac,_0x1f8280)}})[_0xb9ed('0x12')](function(_0x5aa065){if(_0x5aa065){return _0x5aa065[_0xb9ed('0x13')]({'UserId':_0x22005a?_0x22005a['id']:null});}})[_0xb9ed('0x12')](function(_0x50a35d){if(_0x50a35d){log(_0xb9ed('0x14'),_0x22005a,_0x49e585,_0x132dac,_0x1f8280,_0xd6f1e3);}})[_0xb9ed('0x15')](function(){log(_0xb9ed('0x16'),_0x22005a,_0x49e585,_0x132dac,_0x1f8280,_0xd6f1e3);});}exports[_0xb9ed('0x17')]=function(_0x58f839,_0x40701d){return function(_0x58b5e9,_0x45d014,_0x10ca3e){var _0x421ab7=_0x58b5e9[_0xb9ed('0x18')];var _0x21a465={};var _0x3cd0d3=_0x58b5e9[_0xb9ed('0x19')];if(_0x21a465){_0x21a465=_[_0xb9ed('0x1a')](_0x58b5e9[_0xb9ed('0x1b')]);_0x21a465=_['omit'](_0x21a465,[_0xb9ed('0x1b'),_0xb9ed('0x1c'),_0xb9ed('0x1d'),'fax',_0xb9ed('0x1e')]);}updateUser(_0x421ab7,_0x21a465,_0x3cd0d3,_0x58f839,_0x40701d);_0x10ca3e(null);};}; \ No newline at end of file +var _0x476d=['chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','role','stringify','null','Interaction','then','update','catch','tracked','query','clone','body','omit','html','mobile','openchannel-interactions','../../config/logger','sms-interactions'];(function(_0x27d602,_0x12ca6f){var _0x550c74=function(_0x4e20cd){while(--_0x4e20cd){_0x27d602['push'](_0x27d602['shift']());}};_0x550c74(++_0x12ca6f);}(_0x476d,0x1b2));var _0xd476=function(_0x320273,_0x4e01df){_0x320273=_0x320273-0x0;var _0x27d0e8=_0x476d[_0x320273];return _0x27d0e8;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xd476('0x0')),'mail':require(_0xd476('0x1'))('mail-interactions'),'fax':require(_0xd476('0x1'))('fax-interactions'),'sms':require('../../config/logger')(_0xd476('0x2')),'chat':require(_0xd476('0x1'))(_0xd476('0x3')),'whatsapp':require(_0xd476('0x1'))(_0xd476('0x4'))};function getInteractionId(_0x42f055,_0x1d43d5,_0x4fbeba){if(_0x42f055&&_0x42f055[_['upperFirst'](_0x4fbeba)+_0xd476('0x5')]){return _0x42f055[_[_0xd476('0x6')](_0x4fbeba)+'InteractionId'];}else if(_0x42f055&&_0x42f055['id']){return _0x42f055['id'];}else if(_0x1d43d5&&_0x1d43d5['id']){return _0x1d43d5['id'];}else{return _0xd476('0x7');}}function log(_0x473088,_0x2c4817,_0x4f8c08,_0xb952db,_0x23a54b,_0xa22d15){loggers[_0x23a54b[_0xd476('0x8')]()][_0x473088]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa22d15['toUpperCase'](),_0x2c4817?_0x2c4817['id']:null,_0x2c4817?_0x2c4817['name']:null,_0x2c4817?_0x2c4817[_0xd476('0x9')]:null,getInteractionId(_0x4f8c08,_0xb952db,_0x23a54b),_0x4f8c08?JSON[_0xd476('0xa')](_0x4f8c08):_0xd476('0xb'));}function updateUser(_0x21188,_0x1a6f12,_0x5f1a16,_0x165452,_0x1cbb03){db[_[_0xd476('0x6')](_0x165452)+_0xd476('0xc')]['findOne']({'where':{'id':getInteractionId(_0x1a6f12,_0x5f1a16,_0x165452)}})[_0xd476('0xd')](function(_0x21a624){if(_0x21a624){return _0x21a624[_0xd476('0xe')]({'UserId':_0x21188?_0x21188['id']:null});}})['then'](function(_0x34d370){if(_0x34d370){log('info',_0x21188,_0x1a6f12,_0x5f1a16,_0x165452,_0x1cbb03);}})[_0xd476('0xf')](function(){log('error',_0x21188,_0x1a6f12,_0x5f1a16,_0x165452,_0x1cbb03);});}exports[_0xd476('0x10')]=function(_0x316eae,_0x6a9d91){return function(_0x5daa3a,_0x2fd61a,_0x333200){var _0x455426=_0x5daa3a['user'];var _0x17f92e={};var _0x36ead4=_0x5daa3a[_0xd476('0x11')];if(_0x17f92e){_0x17f92e=_[_0xd476('0x12')](_0x5daa3a[_0xd476('0x13')]);_0x17f92e=_[_0xd476('0x14')](_0x17f92e,[_0xd476('0x13'),_0xd476('0x15'),'phone','fax',_0xd476('0x16')]);}updateUser(_0x455426,_0x17f92e,_0x36ead4,_0x316eae,_0x6a9d91);_0x333200(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index aad5f9d..13d9b4e 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 _0x3397=['parse','hasOwnProperty','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final'];(function(_0x25e25d,_0x2341f2){var _0x3a26bb=function(_0x417fc0){while(--_0x417fc0){_0x25e25d['push'](_0x25e25d['shift']());}};_0x3a26bb(++_0x2341f2);}(_0x3397,0xe3));var _0x7339=function(_0x59cda9,_0x47d4c4){_0x59cda9=_0x59cda9-0x0;var _0x26c18f=_0x3397[_0x59cda9];return _0x26c18f;};'use strict';var crypto=require(_0x7339('0x0'));var util=require(_0x7339('0x1'));var compose=require('composable-middleware');var db=require(_0x7339('0x2'))['db'];var config=require(_0x7339('0x3'));function getValueFromLicense(_0x19c4b7,_0x3950f2){if(_0x19c4b7&&_0x3950f2){if(_0x3950f2[_0x7339('0x4')]&&_0x3950f2[_0x7339('0x5')]){var _0x3e1aa9=_0x3950f2[_0x7339('0x4')];var _0x1954ba=_0x3950f2[_0x7339('0x5')];var _0x969904=_0x3e1aa9['split']('-')[0x4];var _0x399f07=_0x3e1aa9['split']('-')[0x0];var _0x536914=crypto['createDecipher'](_0x7339('0x6'),util[_0x7339('0x7')](_0x7339('0x8'),_0x969904,_0x3e1aa9,_0x399f07));var _0x50c26c=_0x536914[_0x7339('0x9')](_0x1954ba,_0x7339('0xa'),_0x7339('0xb'));_0x50c26c+=_0x536914[_0x7339('0xc')](_0x7339('0xb'));var _0x3222a4=JSON[_0x7339('0xd')](_0x50c26c);return _0x3222a4[_0x7339('0xe')](_0x19c4b7)?_0x3222a4[_0x19c4b7]:null;}}return null;}function isLimit(_0x5a0c6f,_0x364f20,_0x574343,_0x236de0){var _0x42b479=_0x364f20;return compose()['use'](function(_0x323ad2,_0x5bf1be,_0x1f4510){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7339('0xf')](function(_0x5dea95){var _0x43e089=getValueFromLicense(_0x5a0c6f,_0x5dea95);return _0x43e089?_0x43e089:_0x42b479;})[_0x7339('0xf')](function(_0x561529){_0x42b479=_0x561529;return _0x574343[_0x7339('0x10')](_0x236de0);})[_0x7339('0xf')](function(_0x47ddc0){if(_0x47ddc0>=_0x42b479){return _0x5bf1be['status'](0x193)['json']({'message':util[_0x7339('0x7')](_0x7339('0x11'),_0x5a0c6f)});}_0x1f4510();})[_0x7339('0x12')](function(_0x5cf388){_0x1f4510(_0x5cf388);});});}function isUserLimit(){return isLimit(_0x7339('0x13'),0x1,db[_0x7339('0x14')],{'where':{'$or':[{'role':_0x7339('0x15')},{'role':_0x7339('0x16')}]}});}exports[_0x7339('0x17')]=isUserLimit; \ No newline at end of file +var _0x44fb=['format','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','status','json','catch','users','User','admin','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0x1dbb69,_0x266868){var _0x3a48f9=function(_0xf30b79){while(--_0xf30b79){_0x1dbb69['push'](_0x1dbb69['shift']());}};_0x3a48f9(++_0x266868);}(_0x44fb,0x1a8));var _0xb44f=function(_0x483a55,_0x5c9dc3){_0x483a55=_0x483a55-0x0;var _0x429a77=_0x44fb[_0x483a55];return _0x429a77;};'use strict';var crypto=require(_0xb44f('0x0'));var util=require(_0xb44f('0x1'));var compose=require('composable-middleware');var db=require(_0xb44f('0x2'))['db'];var config=require(_0xb44f('0x3'));function getValueFromLicense(_0x326b8f,_0x495cf1){if(_0x326b8f&&_0x495cf1){if(_0x495cf1[_0xb44f('0x4')]&&_0x495cf1[_0xb44f('0x5')]){var _0x2b964f=_0x495cf1['data1'];var _0x3c8649=_0x495cf1['license'];var _0x5414a6=_0x2b964f[_0xb44f('0x6')]('-')[0x4];var _0x2954d1=_0x2b964f[_0xb44f('0x6')]('-')[0x0];var _0x2dbf46=crypto[_0xb44f('0x7')]('aes-256-ctr',util[_0xb44f('0x8')]('%s:%s:%s',_0x5414a6,_0x2b964f,_0x2954d1));var _0x5e1616=_0x2dbf46[_0xb44f('0x9')](_0x3c8649,_0xb44f('0xa'),_0xb44f('0xb'));_0x5e1616+=_0x2dbf46[_0xb44f('0xc')](_0xb44f('0xb'));var _0x53b37f=JSON['parse'](_0x5e1616);return _0x53b37f[_0xb44f('0xd')](_0x326b8f)?_0x53b37f[_0x326b8f]:null;}}return null;}function isLimit(_0x803105,_0x17bcf4,_0xec4a73,_0x212264){var _0x15f11a=_0x17bcf4;return compose()[_0xb44f('0xe')](function(_0x5c9485,_0x3bb778,_0xeaa763){return db[_0xb44f('0xf')][_0xb44f('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb44f('0x11')](function(_0x3ed7a6){var _0x19c166=getValueFromLicense(_0x803105,_0x3ed7a6);return _0x19c166?_0x19c166:_0x15f11a;})[_0xb44f('0x11')](function(_0x2bc8f3){_0x15f11a=_0x2bc8f3;return _0xec4a73['count'](_0x212264);})['then'](function(_0x34b584){if(_0x34b584>=_0x15f11a){return _0x3bb778[_0xb44f('0x12')](0x193)[_0xb44f('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x803105)});}_0xeaa763();})[_0xb44f('0x14')](function(_0x399891){_0xeaa763(_0x399891);});});}function isUserLimit(){return isLimit(_0xb44f('0x15'),0x1,db[_0xb44f('0x16')],{'where':{'$or':[{'role':_0xb44f('0x17')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ac1c584..c24fcdc 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 _0x023e=['[$or]','and','replace','split','length','forEach','match','indexOf','map','conditions','push','buildExpression','DATE','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','$notIn','operator','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','minutes','lodash','sqlOperator'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x023e,0x1c0));var _0xe023=function(_0x40d431,_0x2e733d){_0x40d431=_0x40d431-0x0;var _0x108354=_0x023e[_0x40d431];return _0x108354;};'use strict';var _=require(_0xe023('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x787920){var _0x21ac39={'conditions':[]};_0x21ac39[_0xe023('0x1')]=_['startsWith'](_0x787920,_0xe023('0x2'))?'or':_0xe023('0x3');var _0xcc6c6f=_0x787920['replace']('[$and]','')[_0xe023('0x4')](_0xe023('0x2'),'')[_0xe023('0x5')]('||');for(var _0x4ab000=0x0;_0x4ab000<_0xcc6c6f[_0xe023('0x6')];_0x4ab000++){var _0x3c5cb4=_0xcc6c6f[_0x4ab000][_0xe023('0x5')](':=');var _0x4ac98d=_0x3c5cb4[0x0];var _0x408f3a=_0x3c5cb4['slice'](0x1);_0x408f3a[_0xe023('0x7')](function(_0x7fbaae){var _0x1317c0=_0x7fbaae[_0xe023('0x5')]('[')['shift']();var _0x211797=_0x7fbaae[_0xe023('0x8')](/\[(.*?)\]/g);_0x211797[_0xe023('0x7')](function(_0x20d905){var _0x1def94=_0x20d905[_0xe023('0x5')]('[')['filter'](function(_0xed607d){return _0xed607d[_0xe023('0x9')](']')>-0x1;})[_0xe023('0xa')](function(_0x145056){return _0x145056[_0xe023('0x5')](']')[0x0];})[0x0];_0x21ac39[_0xe023('0xb')][_0xe023('0xc')]({'field':_0x4ac98d,'operator':_0x1317c0,'value':_0x1def94});});});}return _0x21ac39;};exports[_0xe023('0xd')]=function(_0x1e2fdc,_0xfe6f55,_0x36feca){var _0x784e0e={};if(_0xfe6f55===_0xe023('0xe')){if(_0x36feca['operator']===_0xe023('0xf')){_0x36feca['operator']='$between';_0x36feca[_0xe023('0x10')]+=','+_0x36feca['value'];}else if(_[_0xe023('0x11')]([_0xe023('0x12'),_0xe023('0x13')],_0x36feca['operator'])){_0x36feca['value']=moment(_0x36feca[_0xe023('0x10')])[_0xe023('0x14')](0x1,_0xe023('0x15'))[_0xe023('0x16')](_0xe023('0x17'));}}if(_0x36feca['castTo']){_0xfe6f55=_0x36feca[_0xe023('0x18')];_0x784e0e[_0xe023('0x19')]='CAST('+_0x1e2fdc+'.'+_0x36feca[_0xe023('0x1a')]+'\x20AS\x20'+_0x36feca['castTo']+')\x20'+parseOperator(_0x36feca['operator']);}else{_0x784e0e[_0xe023('0x19')]=_0x1e2fdc+'.'+_0x36feca[_0xe023('0x1a')]+'\x20'+parseOperator(_0x36feca['operator']);}if(_[_0xe023('0x11')](['$ne',_0xe023('0x1b')],_0x36feca[_0xe023('0x1c')]))_0x784e0e[_0xe023('0x19')]='('+_0x784e0e['text']+_0xe023('0x1d')+_0x1e2fdc+'.'+_0x36feca['field']+_0xe023('0x1e');_0x784e0e[_0xe023('0x10')]=parseValue(_0xfe6f55,_0x36feca[_0xe023('0x1c')],_0x36feca['value']);return _0x784e0e;};function parseOperator(_0x208759){var _0x276108;switch(_0x208759){case _0xe023('0x1f'):_0x276108=_0xe023('0x20');break;case'$notIn':_0x276108=_0xe023('0x21');break;case _0xe023('0xf'):_0x276108=_0xe023('0x22');break;case'$ne':_0x276108=_0xe023('0x23');break;case _0xe023('0x24'):case _0xe023('0x25'):case _0xe023('0x26'):_0x276108=_0xe023('0x27');break;case _0xe023('0x28'):_0x276108=_0xe023('0x29');break;case _0xe023('0x12'):_0x276108=_0xe023('0x2a');break;case'$lte':_0x276108='<=\x20?';break;case _0xe023('0x2b'):_0x276108='>=\x20?';break;case _0xe023('0x2c'):_0x276108=_0xe023('0x2d');break;}return _0x276108;}function parseValue(_0xfca17b,_0x9e3bd5,_0xcd1cc7){var _0x2a2361={'start':undefined,'end':undefined};switch(_0x9e3bd5){case _0xe023('0x1f'):case _0xe023('0x1b'):_0x2a2361['start']=_0xcd1cc7[_0xe023('0x5')](',');break;case _0xe023('0x24'):_0x2a2361[_0xe023('0x2e')]='%'+_0xcd1cc7+'%';break;case _0xe023('0x25'):_0x2a2361[_0xe023('0x2e')]=_0xcd1cc7+'%';break;case _0xe023('0x26'):_0x2a2361[_0xe023('0x2e')]='%'+_0xcd1cc7;break;case'$between':var _0x125ce1=_0xcd1cc7[_0xe023('0x5')](',');var _0xcd1cc7=_0x125ce1[_0xe023('0x2f')]();var _0x26d77f=_0x125ce1['pop']();if(_0xfca17b===_0xe023('0xe')){_0xcd1cc7=moment(_0xcd1cc7)[_0xe023('0x30')](0x0,!![])[_0xe023('0x16')]();_0x26d77f=moment(_0x26d77f)[_0xe023('0x30')](0x0,!![])[_0xe023('0x14')](0x17,'hours')[_0xe023('0x14')](0x3b,_0xe023('0x31'))[_0xe023('0x14')](0x3b,'seconds')[_0xe023('0x16')]();}_0x2a2361={'start':_0xcd1cc7,'end':_0x26d77f};break;default:_0x2a2361[_0xe023('0x2e')]=_0xcd1cc7;break;}return _0x2a2361;} \ No newline at end of file +var _0x61a9=['pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','filter','indexOf','conditions','buildExpression','DATE','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','operator','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start'];(function(_0x23f44b,_0x399b43){var _0x278f87=function(_0x356e6b){while(--_0x356e6b){_0x23f44b['push'](_0x23f44b['shift']());}};_0x278f87(++_0x399b43);}(_0x61a9,0xab));var _0x961a=function(_0x8b6bd4,_0x393c4c){_0x8b6bd4=_0x8b6bd4-0x0;var _0x2041f3=_0x61a9[_0x8b6bd4];return _0x2041f3;};'use strict';var _=require(_0x961a('0x0'));var moment=require(_0x961a('0x1'));exports[_0x961a('0x2')]=function(_0x519b9d){var _0x4d7dac={'conditions':[]};_0x4d7dac[_0x961a('0x3')]=_[_0x961a('0x4')](_0x519b9d,_0x961a('0x5'))?'or':_0x961a('0x6');var _0x377839=_0x519b9d[_0x961a('0x7')](_0x961a('0x8'),'')[_0x961a('0x7')]('[$or]','')[_0x961a('0x9')]('||');for(var _0x57798b=0x0;_0x57798b<_0x377839[_0x961a('0xa')];_0x57798b++){var _0x39ffc3=_0x377839[_0x57798b]['split'](':=');var _0x5a20eb=_0x39ffc3[0x0];var _0x41e077=_0x39ffc3['slice'](0x1);_0x41e077[_0x961a('0xb')](function(_0x227ab5){var _0x23f785=_0x227ab5['split']('[')[_0x961a('0xc')]();var _0x56486d=_0x227ab5[_0x961a('0xd')](/\[(.*?)\]/g);_0x56486d[_0x961a('0xb')](function(_0x4b2818){var _0xac41b0=_0x4b2818[_0x961a('0x9')]('[')[_0x961a('0xe')](function(_0x29b44b){return _0x29b44b[_0x961a('0xf')](']')>-0x1;})['map'](function(_0x24f411){return _0x24f411[_0x961a('0x9')](']')[0x0];})[0x0];_0x4d7dac[_0x961a('0x10')]['push']({'field':_0x5a20eb,'operator':_0x23f785,'value':_0xac41b0});});});}return _0x4d7dac;};exports[_0x961a('0x11')]=function(_0x276a4f,_0x4261e0,_0x4e98bd){var _0x390e4b={};if(_0x4261e0===_0x961a('0x12')){if(_0x4e98bd['operator']==='$eq'){_0x4e98bd['operator']=_0x961a('0x13');_0x4e98bd[_0x961a('0x14')]+=','+_0x4e98bd[_0x961a('0x14')];}else if(_[_0x961a('0x15')](['$gt',_0x961a('0x16')],_0x4e98bd['operator'])){_0x4e98bd[_0x961a('0x14')]=moment(_0x4e98bd[_0x961a('0x14')])['add'](0x1,_0x961a('0x17'))[_0x961a('0x18')](_0x961a('0x19'));}}if(_0x4e98bd['castTo']){_0x4261e0=_0x4e98bd[_0x961a('0x1a')];_0x390e4b['text']=_0x961a('0x1b')+_0x276a4f+'.'+_0x4e98bd[_0x961a('0x1c')]+'\x20AS\x20'+_0x4e98bd['castTo']+')\x20'+parseOperator(_0x4e98bd[_0x961a('0x1d')]);}else{_0x390e4b[_0x961a('0x1e')]=_0x276a4f+'.'+_0x4e98bd['field']+'\x20'+parseOperator(_0x4e98bd[_0x961a('0x1d')]);}if(_['includes']([_0x961a('0x1f'),'$notIn'],_0x4e98bd['operator']))_0x390e4b['text']='('+_0x390e4b['text']+_0x961a('0x20')+_0x276a4f+'.'+_0x4e98bd[_0x961a('0x1c')]+_0x961a('0x21');_0x390e4b[_0x961a('0x14')]=parseValue(_0x4261e0,_0x4e98bd[_0x961a('0x1d')],_0x4e98bd[_0x961a('0x14')]);return _0x390e4b;};function parseOperator(_0x53dfce){var _0x59a0ee;switch(_0x53dfce){case _0x961a('0x22'):_0x59a0ee=_0x961a('0x23');break;case'$notIn':_0x59a0ee=_0x961a('0x24');break;case'$eq':_0x59a0ee=_0x961a('0x25');break;case _0x961a('0x1f'):_0x59a0ee=_0x961a('0x26');break;case _0x961a('0x27'):case _0x961a('0x28'):case _0x961a('0x29'):_0x59a0ee='LIKE\x20?';break;case _0x961a('0x2a'):_0x59a0ee='<\x20?';break;case _0x961a('0x2b'):_0x59a0ee='>\x20?';break;case _0x961a('0x16'):_0x59a0ee=_0x961a('0x2c');break;case'$gte':_0x59a0ee=_0x961a('0x2d');break;case _0x961a('0x13'):_0x59a0ee=_0x961a('0x2e');break;}return _0x59a0ee;}function parseValue(_0x23369e,_0x3d45b6,_0x2787c6){var _0x449055={'start':undefined,'end':undefined};switch(_0x3d45b6){case _0x961a('0x22'):case _0x961a('0x2f'):_0x449055[_0x961a('0x30')]=_0x2787c6[_0x961a('0x9')](',');break;case _0x961a('0x27'):_0x449055[_0x961a('0x30')]='%'+_0x2787c6+'%';break;case _0x961a('0x28'):_0x449055[_0x961a('0x30')]=_0x2787c6+'%';break;case'$endsWith':_0x449055[_0x961a('0x30')]='%'+_0x2787c6;break;case _0x961a('0x13'):var _0x2929c1=_0x2787c6[_0x961a('0x9')](',');var _0x2787c6=_0x2929c1[_0x961a('0xc')]();var _0x937cb1=_0x2929c1[_0x961a('0x31')]();if(_0x23369e==='DATE'){_0x2787c6=moment(_0x2787c6)[_0x961a('0x32')](0x0,!![])['format']();_0x937cb1=moment(_0x937cb1)[_0x961a('0x32')](0x0,!![])[_0x961a('0x33')](0x17,_0x961a('0x34'))[_0x961a('0x33')](0x3b,_0x961a('0x35'))[_0x961a('0x33')](0x3b,_0x961a('0x36'))[_0x961a('0x18')]();}_0x449055={'start':_0x2787c6,'end':_0x937cb1};break;default:_0x449055[_0x961a('0x30')]=_0x2787c6;break;}return _0x449055;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9a1709f..bfff0f1 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 _0x0fda=['name','intersection','attributes','length','nolimit','limit','order','pick','filter','object','includes','columns','where','VIRTUAL','lower','merge','options','lodash','moment','parse','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','isObject','isString','omit','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','query','$id','model'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0x0fda,0x1a0));var _0xa0fd=function(_0xa049f8,_0x3c7188){_0xa049f8=_0xa049f8-0x0;var _0x313685=_0x0fda[_0xa049f8];return _0x313685;};'use strict';var _=require(_0xa0fd('0x0'));var sequelize=require('sequelize');var moment=require(_0xa0fd('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x28e34c){var _0x314a1a=['ne'];try{var _0x2f71f3=JSON[_0xa0fd('0x2')](_0x28e34c);var _0xd8e73a=Object[_0xa0fd('0x3')](_0x2f71f3)[0x0];return _0x314a1a['includes'](_0xd8e73a);}catch(_0x4978fa){return![];}}function getOperatorValue(_0x65fa5d){var _0x4aec58=JSON['parse'](_0x65fa5d);var _0x868183=Object[_0xa0fd('0x3')](_0x4aec58)[0x0];var _0x1aab41=_0x4aec58[_0x868183];return{['$'+_0x868183]:_0x1aab41};}exports[_0xa0fd('0x4')]=function(_0x5d996b){var _0x29da4c=null;if(_0x5d996b){_0x29da4c=_0x5d996b[_0xa0fd('0x5')](',');}return _0x29da4c;};exports[_0xa0fd('0x6')]=function(_0x322a1a,_0x4e1873){var _0x31088d={};if(!_[_0xa0fd('0x7')](_0x322a1a)){_[_0xa0fd('0x8')](_0x322a1a,function(_0x5c1786,_0x4409e4){try{if(_0x4e1873){var _0x332e66=_[_0xa0fd('0x9')](_0x4e1873,{'name':_0x4409e4})||{};if(hasSequelizeOperator(_0x5c1786)){_0x31088d[_0x4409e4]=getOperatorValue(_0x5c1786);}else if(_0x332e66[_0xa0fd('0xa')]===_0xa0fd('0xb')&&_['isPlainObject'](_0x5c1786)){var _0x490112=JSON[_0xa0fd('0x2')](_0x5c1786);var _0x16fe85={'$gte':moment(moment(_0x490112['$gte'])[_0xa0fd('0xc')](_0xa0fd('0xd')))[_0xa0fd('0xe')]()[_0xa0fd('0xc')](),'$lte':moment(moment(_0x490112[_0xa0fd('0xf')])[_0xa0fd('0xc')](_0xa0fd('0xd')))['utc']()[_0xa0fd('0x10')](0x1,'s')[_0xa0fd('0xc')]()};_0x31088d[_0x4409e4]=_0x16fe85;}else if(_0x332e66['name']==='uniqueid'){_0x31088d[_0x4409e4]=_0x5c1786;}else{_0x31088d[_0x4409e4]=_[_0xa0fd('0x11')](_0x5c1786)?_0x5c1786:JSON[_0xa0fd('0x2')](_0x5c1786);}}else{_0x31088d[_0x4409e4]=_['isArray'](_0x5c1786)?_0x5c1786:JSON[_0xa0fd('0x2')](_0x5c1786);}}catch(_0x22a876){_0x31088d[_0x4409e4]=_0x5c1786[_0xa0fd('0x5')](',');}});}return _0x31088d;};exports['limit']=function(_0x50cde2){_0x50cde2=parseInt(_0x50cde2,0xa);if(!_0x50cde2||_0x50cde2<0x0){_0x50cde2=LIMIT_VALUE;}return _0x50cde2;};exports[_0xa0fd('0x12')]=function(_0x558109){_0x558109=parseInt(_0x558109,0xa);if(!_0x558109||_0x558109<0x0){_0x558109=0x0;}return _0x558109;};exports[_0xa0fd('0x13')]=function(_0x2de471){var _0x10f64b,_0x2cf99d=null;if(_0x2de471){_0x10f64b=_0x2de471[_0xa0fd('0x5')](',');_0x2cf99d=_[_0xa0fd('0x14')](_0x10f64b,function(_0x113059){if(_0x113059['indexOf']('-')===0x0){return[_0x113059===_0xa0fd('0x15')?sequelize[_0xa0fd('0x16')](sequelize[_0xa0fd('0x17')](_0xa0fd('0x15')),_0xa0fd('0x18')):_0x113059[_0xa0fd('0x19')](0x1),_0xa0fd('0x1a')];}else{return[_0x113059===_0xa0fd('0x15')?sequelize[_0xa0fd('0x16')](sequelize[_0xa0fd('0x17')](_0xa0fd('0x15')),_0xa0fd('0x18')):_0x113059,_0xa0fd('0x1b')];}});}return _0x2cf99d;};exports['omit']=function(_0x37177b,_0x39d8e5){if(_['isEmpty'](_0x37177b)){return _0x37177b;}if(_[_0xa0fd('0x11')](_0x37177b)){for(var _0x3cd5b0=0x0;_0x3cd5b0<_0x37177b['length'];_0x3cd5b0+=0x1){_0x37177b[_0x3cd5b0]=this['omit'](_0x37177b[_0x3cd5b0],_0x39d8e5);}return _0x37177b;}if(!_[_0xa0fd('0x1c')](_0x37177b)){return _0x37177b;}if(_[_0xa0fd('0x1d')](_0x39d8e5)){_0x39d8e5=[_0x39d8e5];}if(!_['isArray'](_0x39d8e5)){return _0x37177b;}for(var _0x5c70fb=0x0;_0x5c70fb<_0x39d8e5['length'];_0x5c70fb+=0x1){_['unset'](_0x37177b,_0x39d8e5[_0x5c70fb]);}for(var _0x11d7f1 in _0x37177b){if(_0x37177b['hasOwnProperty'](_0x11d7f1)){_0x37177b[_0x11d7f1]=this[_0xa0fd('0x1e')](_0x37177b[_0x11d7f1],_0x39d8e5);}}return _0x37177b;};exports[_0xa0fd('0x1f')]=function(_0x2f5b0d){return _0x2f5b0d['match'](RegExp(_0xa0fd('0x20')))?!![]:![];};exports[_0xa0fd('0x21')]=function(_0x4feb93){return _0x4feb93[_0xa0fd('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xa0fd('0x23')]=function(_0x58ddb3){var _0x366921=[];_0x58ddb3[_0xa0fd('0x5')](/[ ,]+/)[_0xa0fd('0x24')](function(_0x2993aa){_0x2993aa=_0x2993aa['replace'](/([^:]")"+/g,'$1');_0x2993aa='+'+_0x2993aa+'*';var _0x33785f=/[ `!@#$%^&*()_\-?~]/;if(_0x2993aa[_0xa0fd('0x22')](_0x33785f))_0x2993aa='\x22'+_0x2993aa+'\x22';_0x366921['push'](_0x2993aa);});return _0x366921['join']('\x20');};exports['getOptions']=function(_0x1fc249,_0x481271,_0x4bf462){var _0x2c3110={},_0x56f911={};if(_0x481271[_0xa0fd('0x25')][_0xa0fd('0x26')]){_0x481271[_0xa0fd('0x25')]['id']=_0x481271[_0xa0fd('0x25')][_0xa0fd('0x26')];delete _0x481271[_0xa0fd('0x25')][_0xa0fd('0x26')];}_0x2c3110[_0xa0fd('0x27')]=_['map'](_0x1fc249,_0xa0fd('0x28'));_0x2c3110['query']=_[_0xa0fd('0x3')](_0x481271['query']);_0x2c3110['filters']=_[_0xa0fd('0x29')](_0x2c3110['model'],_0x2c3110[_0xa0fd('0x25')]);_0x56f911[_0xa0fd('0x2a')]=_[_0xa0fd('0x29')](_0x2c3110[_0xa0fd('0x27')],this['fields'](_0x481271[_0xa0fd('0x25')][_0xa0fd('0x4')]));_0x56f911[_0xa0fd('0x2a')]=_0x56f911[_0xa0fd('0x2a')][_0xa0fd('0x2b')]?_0x56f911[_0xa0fd('0x2a')]:_0x2c3110[_0xa0fd('0x27')];if(!_0x481271['query']['hasOwnProperty'](_0xa0fd('0x2c'))){_0x56f911[_0xa0fd('0x2d')]=this[_0xa0fd('0x2d')](_0x481271[_0xa0fd('0x25')]['limit']);_0x56f911[_0xa0fd('0x12')]=this[_0xa0fd('0x12')](_0x481271[_0xa0fd('0x25')][_0xa0fd('0x12')]);}_0x56f911[_0xa0fd('0x2e')]=this['sort'](_0x481271[_0xa0fd('0x25')][_0xa0fd('0x13')]);_0x56f911['where']=this['filters'](_[_0xa0fd('0x2f')](_0x481271[_0xa0fd('0x25')],_0x2c3110[_0xa0fd('0x6')]),_0x1fc249);if(_0x481271[_0xa0fd('0x25')][_0xa0fd('0x30')]){var _0xbeca16=_0x1fc249;var _0x41b390=_0x481271[_0xa0fd('0x25')][_0xa0fd('0x30')];if(typeof _0x41b390===_0xa0fd('0x31')){_0xbeca16=_[_0xa0fd('0x30')](_0x1fc249,function(_0x1c9bba){return _[_0xa0fd('0x32')](_0x41b390[_0xa0fd('0x33')],_0x1c9bba[_0xa0fd('0x28')]);});_0x41b390=_0x41b390['value'];}_0x56f911['where']=_['merge'](_0x56f911[_0xa0fd('0x34')],{'$or':_[_0xa0fd('0x14')](_0xbeca16,function(_0x399eb1){if(_0x399eb1['type']!==_0xa0fd('0x35')){if(_0x4bf462){return sequelize[_0xa0fd('0x34')](sequelize['fn'](_0xa0fd('0x36'),sequelize['col'](_0x399eb1[_0xa0fd('0x28')])),{'$like':sequelize['fn'](_0xa0fd('0x36'),'%'+_0x481271[_0xa0fd('0x25')][_0xa0fd('0x30')]+'%')});}else{var _0x2a35fa={};_0x2a35fa[_0x399eb1[_0xa0fd('0x28')]]={'$like':'%'+_0x481271['query'][_0xa0fd('0x30')]+'%'};return _0x2a35fa;}}})});}_0x56f911=_[_0xa0fd('0x37')]({},_0x56f911,_0x481271[_0xa0fd('0x38')]);return _0x56f911;}; \ No newline at end of file +var _0xfb65=['sort','where','filter','object','columns','value','merge','VIRTUAL','lower','options','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','map','indexOf','col','priority','substr','DESC','cast','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','forEach','replace','push','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset'];(function(_0x182bd3,_0x243129){var _0x44931e=function(_0x3f4aed){while(--_0x3f4aed){_0x182bd3['push'](_0x182bd3['shift']());}};_0x44931e(++_0x243129);}(_0xfb65,0x82));var _0x5fb6=function(_0x272d4e,_0x4adf01){_0x272d4e=_0x272d4e-0x0;var _0x17863a=_0xfb65[_0x272d4e];return _0x17863a;};'use strict';var _=require('lodash');var sequelize=require(_0x5fb6('0x0'));var moment=require(_0x5fb6('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5cc692){var _0x860687=['ne'];try{var _0x54af6d=JSON[_0x5fb6('0x2')](_0x5cc692);var _0x15d15c=Object[_0x5fb6('0x3')](_0x54af6d)[0x0];return _0x860687[_0x5fb6('0x4')](_0x15d15c);}catch(_0x3a3b1b){return![];}}function getOperatorValue(_0x1fefe3){var _0x4dec8f=JSON['parse'](_0x1fefe3);var _0x238914=Object[_0x5fb6('0x3')](_0x4dec8f)[0x0];var _0x1f99b8=_0x4dec8f[_0x238914];return{['$'+_0x238914]:_0x1f99b8};}exports[_0x5fb6('0x5')]=function(_0x56d6e1){var _0x381710=null;if(_0x56d6e1){_0x381710=_0x56d6e1[_0x5fb6('0x6')](',');}return _0x381710;};exports[_0x5fb6('0x7')]=function(_0x21e613,_0x4ff5d2){var _0x2b63fd={};if(!_[_0x5fb6('0x8')](_0x21e613)){_['forOwn'](_0x21e613,function(_0x6c3565,_0x19387c){try{if(_0x4ff5d2){var _0x160070=_[_0x5fb6('0x9')](_0x4ff5d2,{'name':_0x19387c})||{};if(hasSequelizeOperator(_0x6c3565)){_0x2b63fd[_0x19387c]=getOperatorValue(_0x6c3565);}else if(_0x160070[_0x5fb6('0xa')]==='DATE'&&_[_0x5fb6('0xb')](_0x6c3565)){var _0x15b296=JSON[_0x5fb6('0x2')](_0x6c3565);var _0x41d503={'$gte':moment(moment(_0x15b296[_0x5fb6('0xc')])[_0x5fb6('0xd')](_0x5fb6('0xe')))[_0x5fb6('0xf')]()['format'](),'$lte':moment(moment(_0x15b296['$lte'])[_0x5fb6('0xd')](_0x5fb6('0xe')))['utc']()[_0x5fb6('0x10')](0x1,'s')[_0x5fb6('0xd')]()};_0x2b63fd[_0x19387c]=_0x41d503;}else if(_0x160070[_0x5fb6('0x11')]==='uniqueid'){_0x2b63fd[_0x19387c]=_0x6c3565;}else{_0x2b63fd[_0x19387c]=_[_0x5fb6('0x12')](_0x6c3565)?_0x6c3565:JSON[_0x5fb6('0x2')](_0x6c3565);}}else{_0x2b63fd[_0x19387c]=_[_0x5fb6('0x12')](_0x6c3565)?_0x6c3565:JSON[_0x5fb6('0x2')](_0x6c3565);}}catch(_0x167354){_0x2b63fd[_0x19387c]=_0x6c3565[_0x5fb6('0x6')](',');}});}return _0x2b63fd;};exports['limit']=function(_0xf4ae5d){_0xf4ae5d=parseInt(_0xf4ae5d,0xa);if(!_0xf4ae5d||_0xf4ae5d<0x0){_0xf4ae5d=LIMIT_VALUE;}return _0xf4ae5d;};exports['offset']=function(_0x32f58a){_0x32f58a=parseInt(_0x32f58a,0xa);if(!_0x32f58a||_0x32f58a<0x0){_0x32f58a=0x0;}return _0x32f58a;};exports['sort']=function(_0x43a252){var _0x3ec3b0,_0x402e8a=null;if(_0x43a252){_0x3ec3b0=_0x43a252[_0x5fb6('0x6')](',');_0x402e8a=_[_0x5fb6('0x13')](_0x3ec3b0,function(_0x418f58){if(_0x418f58[_0x5fb6('0x14')]('-')===0x0){return[_0x418f58==='priority'?sequelize['cast'](sequelize[_0x5fb6('0x15')](_0x5fb6('0x16')),'unsigned'):_0x418f58[_0x5fb6('0x17')](0x1),_0x5fb6('0x18')];}else{return[_0x418f58===_0x5fb6('0x16')?sequelize[_0x5fb6('0x19')](sequelize['col'](_0x5fb6('0x16')),_0x5fb6('0x1a')):_0x418f58,_0x5fb6('0x1b')];}});}return _0x402e8a;};exports[_0x5fb6('0x1c')]=function(_0x1b6953,_0x1c1b96){if(_['isEmpty'](_0x1b6953)){return _0x1b6953;}if(_['isArray'](_0x1b6953)){for(var _0x298b44=0x0;_0x298b44<_0x1b6953[_0x5fb6('0x1d')];_0x298b44+=0x1){_0x1b6953[_0x298b44]=this[_0x5fb6('0x1c')](_0x1b6953[_0x298b44],_0x1c1b96);}return _0x1b6953;}if(!_[_0x5fb6('0x1e')](_0x1b6953)){return _0x1b6953;}if(_[_0x5fb6('0x1f')](_0x1c1b96)){_0x1c1b96=[_0x1c1b96];}if(!_[_0x5fb6('0x12')](_0x1c1b96)){return _0x1b6953;}for(var _0x36ac58=0x0;_0x36ac58<_0x1c1b96['length'];_0x36ac58+=0x1){_[_0x5fb6('0x20')](_0x1b6953,_0x1c1b96[_0x36ac58]);}for(var _0x3f9b86 in _0x1b6953){if(_0x1b6953[_0x5fb6('0x21')](_0x3f9b86)){_0x1b6953[_0x3f9b86]=this['omit'](_0x1b6953[_0x3f9b86],_0x1c1b96);}}return _0x1b6953;};exports[_0x5fb6('0x22')]=function(_0x1b4ae4){return _0x1b4ae4['match'](RegExp(_0x5fb6('0x23')))?!![]:![];};exports[_0x5fb6('0x24')]=function(_0x52afd7){return _0x52afd7[_0x5fb6('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x462027){var _0x53dbeb=[];_0x462027['split'](/[ ,]+/)[_0x5fb6('0x26')](function(_0x30bc6c){_0x30bc6c=_0x30bc6c[_0x5fb6('0x27')](/([^:]")"+/g,'$1');_0x30bc6c='+'+_0x30bc6c+'*';var _0x13e045=/[ `!@#$%^&*()_\-?~]/;if(_0x30bc6c[_0x5fb6('0x25')](_0x13e045))_0x30bc6c='\x22'+_0x30bc6c+'\x22';_0x53dbeb[_0x5fb6('0x28')](_0x30bc6c);});return _0x53dbeb['join']('\x20');};exports[_0x5fb6('0x29')]=function(_0x39569e,_0x11b2d1,_0x295e93){var _0x6531fe={},_0x407d86={};if(_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x2b')]){_0x11b2d1[_0x5fb6('0x2a')]['id']=_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x2b')];delete _0x11b2d1['query'][_0x5fb6('0x2b')];}_0x6531fe[_0x5fb6('0x2c')]=_['map'](_0x39569e,_0x5fb6('0x11'));_0x6531fe['query']=_['keys'](_0x11b2d1[_0x5fb6('0x2a')]);_0x6531fe[_0x5fb6('0x7')]=_[_0x5fb6('0x2d')](_0x6531fe['model'],_0x6531fe[_0x5fb6('0x2a')]);_0x407d86['attributes']=_['intersection'](_0x6531fe[_0x5fb6('0x2c')],this[_0x5fb6('0x5')](_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x5')]));_0x407d86[_0x5fb6('0x2e')]=_0x407d86[_0x5fb6('0x2e')][_0x5fb6('0x1d')]?_0x407d86[_0x5fb6('0x2e')]:_0x6531fe[_0x5fb6('0x2c')];if(!_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x21')](_0x5fb6('0x2f'))){_0x407d86['limit']=this[_0x5fb6('0x30')](_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x30')]);_0x407d86['offset']=this[_0x5fb6('0x31')](_0x11b2d1['query'][_0x5fb6('0x31')]);}_0x407d86['order']=this[_0x5fb6('0x32')](_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x32')]);_0x407d86[_0x5fb6('0x33')]=this[_0x5fb6('0x7')](_['pick'](_0x11b2d1[_0x5fb6('0x2a')],_0x6531fe[_0x5fb6('0x7')]),_0x39569e);if(_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x34')]){var _0x52e858=_0x39569e;var _0x136a97=_0x11b2d1[_0x5fb6('0x2a')][_0x5fb6('0x34')];if(typeof _0x136a97===_0x5fb6('0x35')){_0x52e858=_[_0x5fb6('0x34')](_0x39569e,function(_0x26962b){return _['includes'](_0x136a97[_0x5fb6('0x36')],_0x26962b[_0x5fb6('0x11')]);});_0x136a97=_0x136a97[_0x5fb6('0x37')];}_0x407d86[_0x5fb6('0x33')]=_[_0x5fb6('0x38')](_0x407d86[_0x5fb6('0x33')],{'$or':_[_0x5fb6('0x13')](_0x52e858,function(_0x529c2d){if(_0x529c2d[_0x5fb6('0xa')]!==_0x5fb6('0x39')){if(_0x295e93){return sequelize[_0x5fb6('0x33')](sequelize['fn']('lower',sequelize[_0x5fb6('0x15')](_0x529c2d['name'])),{'$like':sequelize['fn'](_0x5fb6('0x3a'),'%'+_0x11b2d1[_0x5fb6('0x2a')]['filter']+'%')});}else{var _0x116119={};_0x116119[_0x529c2d[_0x5fb6('0x11')]]={'$like':'%'+_0x11b2d1[_0x5fb6('0x2a')]['filter']+'%'};return _0x116119;}}})});}_0x407d86=_['merge']({},_0x407d86,_0x11b2d1[_0x5fb6('0x3b')]);return _0x407d86;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 45c94ac..6423c8e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x7cf8eb,_0x5a470e){var _0x24e417=function(_0x10caea){while(--_0x10caea){_0x7cf8eb['push'](_0x7cf8eb['shift']());}};_0x24e417(++_0x5a470e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5e237d,_0x358118){var _0x4bc64c=function(_0xfab3df){while(--_0xfab3df){_0x5e237d['push'](_0x5e237d['shift']());}};_0x4bc64c(++_0x358118);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c4b67cd..0212ff5 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 _0x5851=['execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','model','join','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','createHash','digest','substring','crypto','bimedia-machine-uuid','child_process'];(function(_0x195076,_0x675423){var _0x4f2772=function(_0x4e8c1c){while(--_0x4e8c1c){_0x195076['push'](_0x195076['shift']());}};_0x4f2772(++_0x675423);}(_0x5851,0x151));var _0x1585=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5851[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1585('0x0'));var machine=require(_0x1585('0x1'));var exec=require(_0x1585('0x2'))[_0x1585('0x3')];var config=require(_0x1585('0x4'));function getInterfaces(){var _0x3c2b59=[];var _0x371282=os[_0x1585('0x5')]();var _0x967300=_[_0x1585('0x6')](_[_0x1585('0x7')](_0x371282));for(var _0x35c317=0x0;_0x35c317<_0x967300[_0x1585('0x8')];_0x35c317++){var _0xd6abc0=_0x371282[_0x967300[_0x35c317]][_0x1585('0x9')](function(_0x54fc48){return _0x54fc48[_0x1585('0xa')]===_0x1585('0xb')&&_0x54fc48[_0x1585('0xc')]===![];});_0x3c2b59=_0x3c2b59[_0x1585('0xd')](_0xd6abc0);}return _0x3c2b59;}function getFirstInterface(){var _0x46f635=_['head'](getInterfaces());return{'macAddress':_0x46f635&&_0x46f635[_0x1585('0xe')]?_0x46f635['mac']:_0x1585('0xf'),'ipAddress':_0x46f635&&_0x46f635[_0x1585('0x10')]?_0x46f635[_0x1585('0x10')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2e5c71=_['orderBy'](os['cpus']()['map'](function(_0x4d8c3b){return _0x4d8c3b[_0x1585('0x11')];}))[_0x1585('0x12')](':');return crypto['createHash'](_0x1585('0x13'))[_0x1585('0x14')](_0x2e5c71)['digest'](_0x1585('0x15'));}exports[_0x1585('0x16')]=function(){var _0x536b20=os[_0x1585('0x17')]();var _0x490a6c=/[0-9a-f-]{36}/;if(config[_0x1585('0x18')]&&_0x490a6c[_0x1585('0x19')](config[_0x1585('0x18')])){return config['licenseToken'];}else if(_0x536b20===_0x1585('0x1a')){return exec(_0x1585('0x1b'),{'encoding':_0x1585('0x1c')})['replace']('\x0d\x0a','');}else{var _0x654f59=getFirstInterface();var _0x488002=getCPUhash();var _0x2337c8=_0x488002+'|'+os['hostname']()+'|'+_0x654f59[_0x1585('0x1d')]+'|'+_0x654f59[_0x1585('0x1e')];var _0x5dada4=crypto[_0x1585('0x1f')](_0x1585('0x13'))[_0x1585('0x14')](_0x2337c8)[_0x1585('0x20')](_0x1585('0x15'));return _0x5dada4[_0x1585('0x21')](0x0,0x8)+'-'+_0x5dada4[_0x1585('0x21')](0x8,0xc)+'-'+_0x5dada4[_0x1585('0x21')](0xc,0x10)+'-'+_0x5dada4[_0x1585('0x21')](0x10,0x14)+'-'+_0x5dada4[_0x1585('0x21')](0x14);}}; \ No newline at end of file +var _0x9785=['replace','hostname','macAddress','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','md5','update','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9785,0xd2));var _0x5978=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x9785[_0x5c6994];return _0x1d5c84;};'use strict';var _=require(_0x5978('0x0'));var os=require('os');var crypto=require(_0x5978('0x1'));var machine=require(_0x5978('0x2'));var exec=require('child_process')[_0x5978('0x3')];var config=require(_0x5978('0x4'));function getInterfaces(){var _0x234db3=[];var _0x21dffe=os[_0x5978('0x5')]();var _0x1335fb=_[_0x5978('0x6')](_['keys'](_0x21dffe));for(var _0x3c56a3=0x0;_0x3c56a3<_0x1335fb[_0x5978('0x7')];_0x3c56a3++){var _0xcc6790=_0x21dffe[_0x1335fb[_0x3c56a3]][_0x5978('0x8')](function(_0x5002fe){return _0x5002fe[_0x5978('0x9')]===_0x5978('0xa')&&_0x5002fe[_0x5978('0xb')]===![];});_0x234db3=_0x234db3[_0x5978('0xc')](_0xcc6790);}return _0x234db3;}function getFirstInterface(){var _0x472edd=_[_0x5978('0xd')](getInterfaces());return{'macAddress':_0x472edd&&_0x472edd['mac']?_0x472edd['mac']:_0x5978('0xe'),'ipAddress':_0x472edd&&_0x472edd[_0x5978('0xf')]?_0x472edd[_0x5978('0xf')]:_0x5978('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5a4b61=_['orderBy'](os[_0x5978('0x11')]()[_0x5978('0x12')](function(_0x2e0ec6){return _0x2e0ec6[_0x5978('0x13')];}))[_0x5978('0x14')](':');return crypto['createHash'](_0x5978('0x15'))[_0x5978('0x16')](_0x5a4b61)['digest']('hex');}exports[_0x5978('0x17')]=function(){var _0x567244=os[_0x5978('0x18')]();var _0x34eeea=/[0-9a-f-]{36}/;if(config[_0x5978('0x19')]&&_0x34eeea['test'](config['licenseToken'])){return config[_0x5978('0x19')];}else if(_0x567244===_0x5978('0x1a')){return exec(_0x5978('0x1b'),{'encoding':'utf8'})[_0x5978('0x1c')]('\x0d\x0a','');}else{var _0x36cb7c=getFirstInterface();var _0x470b87=getCPUhash();var _0x2b2ea7=_0x470b87+'|'+os[_0x5978('0x1d')]()+'|'+_0x36cb7c[_0x5978('0x1e')]+'|'+_0x36cb7c['ipAddress'];var _0x3ca317=crypto['createHash'](_0x5978('0x15'))[_0x5978('0x16')](_0x2b2ea7)[_0x5978('0x1f')](_0x5978('0x20'));return _0x3ca317[_0x5978('0x21')](0x0,0x8)+'-'+_0x3ca317[_0x5978('0x21')](0x8,0xc)+'-'+_0x3ca317['substring'](0xc,0x10)+'-'+_0x3ca317[_0x5978('0x21')](0x10,0x14)+'-'+_0x3ca317[_0x5978('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3905f6a..ece1e1c 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 _0xc769=['DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','catch','get','data1','then','active','data2','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff'];(function(_0x158b0b,_0x200e74){var _0x6e961c=function(_0x35bc1a){while(--_0x35bc1a){_0x158b0b['push'](_0x158b0b['shift']());}};_0x6e961c(++_0x200e74);}(_0xc769,0x166));var _0x9c76=function(_0x1d6a29,_0xb90891){_0x1d6a29=_0x1d6a29-0x0;var _0x1d2f72=_0xc769[_0x1d6a29];return _0x1d2f72;};'use strict';var util=require(_0x9c76('0x0'));var moment=require(_0x9c76('0x1'));var rp=require(_0x9c76('0x2'));var BPromise=require(_0x9c76('0x3'));var pkginfo=require('pkginfo')(module,_0x9c76('0x4'));var db=require(_0x9c76('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x9c76('0x6'));var logger=require(_0x9c76('0x7'))(_0x9c76('0x8'));var HOST=_0x9c76('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2b787e){return new BPromise(function(_0x401fbf,_0x5a0c33){var _0x3029cd=util[_0x9c76('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x2b787e,module['exports']['version']);if(oldToken){_0x3029cd=util[_0x9c76('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2b787e,module[_0x9c76('0xb')]['version'],oldToken);}var _0x37bdee={'uri':_0x3029cd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x37bdee)['then'](function(_0x1f859a){_0x401fbf(_0x1f859a);})[_0x9c76('0xc')](function(_0x25c735){_0x5a0c33(_0x25c735);});});}function manageLicense(_0x123858,_0x203bbd){var _0x41feac=_0x203bbd[_0x9c76('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x41feac[_0x9c76('0xe')]!==_0x123858&&!_0x41feac['data2']){oldToken=_0x41feac[_0x9c76('0xe')];}httpRequest(_0x123858)[_0x9c76('0xf')](function(_0x32eb5f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x32eb5f[_0x9c76('0x10')]){isOldTokenSent=![];if(!_0x41feac[_0x9c76('0x8')]&&_0x41feac[_0x9c76('0x8')]!=_0x32eb5f[_0x9c76('0x8')]||_0x41feac['license']&&_0x41feac[_0x9c76('0x11')]){logger[_0x9c76('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x41feac[_0x9c76('0x8')]&&!_0x41feac[_0x9c76('0x11')]&&_0x41feac['license']!=_0x32eb5f[_0x9c76('0x8')]){logger[_0x9c76('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x41feac['license']&&!_0x41feac['data2']&&_0x41feac[_0x9c76('0x8')]==_0x32eb5f[_0x9c76('0x8')]){return _0x203bbd;}return _0x203bbd[_0x9c76('0x13')]({'data1':_0x123858,'data2':null,'license':_0x32eb5f[_0x9c76('0x8')]});}else{if(_0x32eb5f['license']||_0x41feac[_0x9c76('0x8')]){if(!_0x41feac[_0x9c76('0x11')]){if(_0x41feac[_0x9c76('0xe')]==_0x123858){GRAY_PERIOD_REASON=_0x9c76('0x14');logger[_0x9c76('0x12')](_0x9c76('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x9c76('0x16'),_0x41feac['data1'],_0x123858);}logger['info'](_0x9c76('0x17'),GRAY_PERIOD_REASON[_0x9c76('0x18')](),moment()['format'](_0x9c76('0x19')));return _0x203bbd[_0x9c76('0x13')]({'data2':encryptor['encryptString'](moment()[_0x9c76('0xa')](_0x9c76('0x19')))});}else{if(moment()[_0x9c76('0x1a')](encryptor['decryptString'](_0x41feac['data2']),'days')>DAYS){logger[_0x9c76('0x12')](_0x9c76('0x1b'),moment()[_0x9c76('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x203bbd[_0x9c76('0x13')]({'data1':_0x123858,'data2':null,'license':null});}}}else{if(_0x41feac[_0x9c76('0xe')]!=_0x123858){logger[_0x9c76('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x41feac['data1'],_0x123858);return _0x203bbd['update']({'data1':_0x123858,'data2':null,'license':null});}}}return _0x203bbd;})['then'](function(_0x1e1d92){_0x203bbd=_0x1e1d92;})[_0x9c76('0xc')](function(_0x641de4){logger[_0x9c76('0x1c')](_0x641de4[_0x9c76('0x1d')]);})[_0x9c76('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x9c76('0x1f')](),_0x203bbd);},TIME);});}function defaultLicense(){var _0x54be0d=hardware['getUuid']();if(_0x54be0d){return db[_0x9c76('0x20')][_0x9c76('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x54be0d}})['spread'](function(_0x2f5862,_0x30ed7b){logger['info'](_0x9c76('0x22'),_0x54be0d);manageLicense(_0x54be0d,_0x2f5862);})['catch'](function(_0x47bbd0){logger[_0x9c76('0x1c')](_0x47bbd0[_0x9c76('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xdc99=['get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch'];(function(_0x5794e8,_0x3159c1){var _0x173ce3=function(_0x363287){while(--_0x363287){_0x5794e8['push'](_0x5794e8['shift']());}};_0x173ce3(++_0x3159c1);}(_0xdc99,0xcc));var _0x9dc9=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xdc99[_0x209fcd];return _0x501d5e;};'use strict';var util=require(_0x9dc9('0x0'));var moment=require(_0x9dc9('0x1'));var rp=require(_0x9dc9('0x2'));var BPromise=require(_0x9dc9('0x3'));var pkginfo=require(_0x9dc9('0x4'))(module,_0x9dc9('0x5'));var db=require(_0x9dc9('0x6'))['db'];var encryptor=require(_0x9dc9('0x7'));var hardware=require('./hardware');var logger=require(_0x9dc9('0x8'))('license');var HOST=_0x9dc9('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2b9b7f){return new BPromise(function(_0x334c15,_0x13d92f){var _0x521681=util[_0x9dc9('0xa')](_0x9dc9('0xb'),HOST,_0x2b9b7f,module[_0x9dc9('0xc')][_0x9dc9('0x5')]);if(oldToken){_0x521681=util[_0x9dc9('0xa')](_0x9dc9('0xd'),HOST,_0x2b9b7f,module['exports']['version'],oldToken);}var _0x4e2c82={'uri':_0x521681,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4e2c82)[_0x9dc9('0xe')](function(_0x446d3d){_0x334c15(_0x446d3d);})[_0x9dc9('0xf')](function(_0x1253c8){_0x13d92f(_0x1253c8);});});}function manageLicense(_0x302d21,_0x452095){var _0x58db68=_0x452095[_0x9dc9('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x58db68[_0x9dc9('0x11')]!==_0x302d21&&!_0x58db68[_0x9dc9('0x12')]){oldToken=_0x58db68[_0x9dc9('0x11')];}httpRequest(_0x302d21)[_0x9dc9('0xe')](function(_0x12fa8b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x12fa8b[_0x9dc9('0x13')]){isOldTokenSent=![];if(!_0x58db68['license']&&_0x58db68[_0x9dc9('0x14')]!=_0x12fa8b[_0x9dc9('0x14')]||_0x58db68['license']&&_0x58db68[_0x9dc9('0x12')]){logger[_0x9dc9('0x15')](_0x9dc9('0x16'));}if(_0x58db68[_0x9dc9('0x14')]&&!_0x58db68[_0x9dc9('0x12')]&&_0x58db68[_0x9dc9('0x14')]!=_0x12fa8b[_0x9dc9('0x14')]){logger['info'](_0x9dc9('0x17'));}if(_0x58db68[_0x9dc9('0x14')]&&!_0x58db68[_0x9dc9('0x12')]&&_0x58db68[_0x9dc9('0x14')]==_0x12fa8b[_0x9dc9('0x14')]){return _0x452095;}return _0x452095[_0x9dc9('0x18')]({'data1':_0x302d21,'data2':null,'license':_0x12fa8b['license']});}else{if(_0x12fa8b[_0x9dc9('0x14')]||_0x58db68['license']){if(!_0x58db68[_0x9dc9('0x12')]){if(_0x58db68[_0x9dc9('0x11')]==_0x302d21){GRAY_PERIOD_REASON=_0x9dc9('0x19');logger[_0x9dc9('0x15')](_0x9dc9('0x1a'));}else{GRAY_PERIOD_REASON=_0x9dc9('0x1b');logger[_0x9dc9('0x15')](_0x9dc9('0x1c'),_0x58db68[_0x9dc9('0x11')],_0x302d21);}logger[_0x9dc9('0x15')](_0x9dc9('0x1d'),GRAY_PERIOD_REASON[_0x9dc9('0x1e')](),moment()[_0x9dc9('0xa')](_0x9dc9('0x1f')));return _0x452095[_0x9dc9('0x18')]({'data2':encryptor['encryptString'](moment()[_0x9dc9('0xa')](_0x9dc9('0x1f')))});}else{if(moment()[_0x9dc9('0x20')](encryptor[_0x9dc9('0x21')](_0x58db68[_0x9dc9('0x12')]),_0x9dc9('0x22'))>DAYS){logger['info'](_0x9dc9('0x23'),moment()[_0x9dc9('0xa')](_0x9dc9('0x1f')));isOldTokenSent=![];return _0x452095[_0x9dc9('0x18')]({'data1':_0x302d21,'data2':null,'license':null});}}}else{if(_0x58db68[_0x9dc9('0x11')]!=_0x302d21){logger[_0x9dc9('0x15')](_0x9dc9('0x1c'),_0x58db68[_0x9dc9('0x11')],_0x302d21);return _0x452095['update']({'data1':_0x302d21,'data2':null,'license':null});}}}return _0x452095;})['then'](function(_0xf61c41){_0x452095=_0xf61c41;})[_0x9dc9('0xf')](function(_0x3898a7){logger[_0x9dc9('0x24')](_0x3898a7['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x452095);},TIME);});}function defaultLicense(){var _0x47c021=hardware[_0x9dc9('0x25')]();if(_0x47c021){return db[_0x9dc9('0x26')][_0x9dc9('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x47c021}})[_0x9dc9('0x28')](function(_0x5abf7c,_0x1092ca){logger[_0x9dc9('0x15')](_0x9dc9('0x29'),_0x47c021);manageLicense(_0x47c021,_0x5abf7c);})['catch'](function(_0x5a8491){logger[_0x9dc9('0x24')](_0x5a8491[_0x9dc9('0x2a')]);});}}exports[_0x9dc9('0x2b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2fcb84b..54cb353 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 _0x1f41=['License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','days','format','grayReason','machineUuid','disabled','message','User','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy'];(function(_0x2c5a9d,_0x42a3c1){var _0x4675c2=function(_0x1c56d1){while(--_0x1c56d1){_0x2c5a9d['push'](_0x2c5a9d['shift']());}};_0x4675c2(++_0x42a3c1);}(_0x1f41,0x65));var _0x11f4=function(_0xcec3cc,_0x1c7c7d){_0xcec3cc=_0xcec3cc-0x0;var _0xe189b1=_0x1f41[_0xcec3cc];return _0xe189b1;};'use strict';var util=require(_0x11f4('0x0'));var _=require(_0x11f4('0x1'));var moment=require(_0x11f4('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x11f4('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x11f4('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x11f4('0x5'),'machineUuid':hardware[_0x11f4('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x11f4('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x140e8f){return new BPromise(function(_0x801e3b,_0x6e2f48){return db[_0x11f4('0x8')][_0x11f4('0x9')](_[_0x11f4('0xa')](_0x140e8f,{'raw':!![],'where':{'id':0x1}}))[_0x11f4('0xb')](function(_0x3e6fac){return checkLicense(_0x3e6fac,null);})['then'](function(_0x1c471f){_0x801e3b(_0x1c471f);return;})[_0x11f4('0xc')](function(_0x3dc8f1){_0x6e2f48(_0x3dc8f1);});});}function checkLicense(_0x398caf,_0x11f0e4){if(!_0x398caf){demoLicense[_0x11f4('0xd')]=_0x398caf[_0x11f4('0xe')];return demoLicense;}try{var _0x3a49e6=_0x11f0e4||_0x398caf[_0x11f4('0xf')];if(_[_0x11f4('0x10')](_0x3a49e6)){throw new Error(_0x11f4('0x11'));}var _0x6ae094=_0x398caf[_0x11f4('0xe')];var _0x431a8b=_0x398caf[_0x11f4('0x12')];var _0x42dc06=_0x6ae094[_0x11f4('0x13')]('-')[0x4];var _0x353f41=_0x6ae094['split']('-')[0x0];var _0x441602=encryptor[_0x11f4('0x14')](_0x3a49e6,util['format'](_0x11f4('0x15'),_0x42dc06,_0x6ae094,_0x353f41));var _0xff9bf5=JSON[_0x11f4('0x16')](_0x441602);_0xff9bf5[_0x11f4('0x17')]=![];_0xff9bf5[_0x11f4('0xd')]=_0x6ae094;_0xff9bf5['machineUuid']=hardware[_0x11f4('0x6')]();if(_0x431a8b){var _0x31bddd=encryptor[_0x11f4('0x14')](_0x431a8b);_0xff9bf5[_0x11f4('0x18')]=_0x31bddd;_0xff9bf5[_0x11f4('0x19')]=moment(_0x31bddd)[_0x11f4('0x1a')](0x7,_0x11f4('0x1b'))[_0x11f4('0x1c')]();_0xff9bf5[_0x11f4('0x1d')]=_0xff9bf5[_0x11f4('0xd')]!=_0xff9bf5[_0x11f4('0x1e')]?'changed':_0x11f4('0x1f');}return _0xff9bf5;}catch(_0x13c79c){breakingLicense['uuid']=_0x398caf[_0x11f4('0xe')];breakingLicense[_0x11f4('0x20')]=_0x13c79c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x43ddca,_0x3b73e3){getLicense()[_0x11f4('0xb')](function(_0x5e9437){return db[_0x11f4('0x21')]['findAll']({'attributes':[_0x11f4('0x22'),[db['sequelize']['fn']('COUNT',db[_0x11f4('0x23')][_0x11f4('0x24')](_0x11f4('0x22'))),_0x11f4('0x25')]],'group':_0x11f4('0x22'),'where':{'role':{'$or':[_0x11f4('0x26'),_0x11f4('0x27'),_0x11f4('0x28')]}},'raw':!![]})[_0x11f4('0xb')](function(_0x5d0f46){var _0x4a4e9a={'user':_0x5e9437[_0x11f4('0x29')]||0x0,'telephone':_0x5e9437[_0x11f4('0x2a')]||0x0};_0x5d0f46[_0x11f4('0x2b')](function(_0x1bb4b8){var _0x6217da=_0x1bb4b8[_0x11f4('0x22')]===_0x11f4('0x26')?_0x11f4('0x27'):_0x1bb4b8[_0x11f4('0x22')];_0x4a4e9a[_0x6217da]-=_0x1bb4b8['count'];if(_0x4a4e9a[_0x6217da]<0x0)_0x4a4e9a[_0x6217da]=0x0;});_0x43ddca(_0x4a4e9a);return;});})[_0x11f4('0xc')](function(_0x2a0aed){_0x3b73e3(_0x2a0aed);});});}function checkUserLimits(_0x1721f9){return new BPromise(function(_0x4cdf36,_0x440cf8){getLimits()[_0x11f4('0xb')](function(_0x5d65e8){var _0x4e3633=_[_0x11f4('0x2c')](_[_0x11f4('0x2d')](_0x1721f9,_0x11f4('0x22')),['admin',_0x11f4('0x27'),'telephone']);var _0xcced54=(_0x4e3633[_0x11f4('0x26')]||0x0)+(_0x4e3633[_0x11f4('0x27')]||0x0);var _0x152e1a=_0x4e3633[_0x11f4('0x28')]||0x0;if(_0xcced54>_0x5d65e8['user'])return _0x440cf8(_0x11f4('0x2e'));if(_0x152e1a>_0x5d65e8['telephone'])return _0x440cf8(_0x11f4('0x2f'));return _0x4cdf36();})[_0x11f4('0xc')](function(_0x1cfe98){_0x440cf8(_0x1cfe98);});});}module[_0x11f4('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xac6a=['decryptString','format','parse','gray','grayReason','changed','disabled','message','role','sequelize','COUNT','col','count','admin','users','telephones','forEach','countBy','user','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xac6a,0x92));var _0xaac6=function(_0x4fa24d,_0x4238f8){_0x4fa24d=_0x4fa24d-0x0;var _0x1ff9d2=_0xac6a[_0x4fa24d];return _0x1ff9d2;};'use strict';var util=require(_0xaac6('0x0'));var _=require('lodash');var moment=require(_0xaac6('0x1'));var BPromise=require(_0xaac6('0x2'));var hardware=require(_0xaac6('0x3'));var encryptor=require(_0xaac6('0x4'));var db=require(_0xaac6('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'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':_0xaac6('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x18439f){return new BPromise(function(_0x238d3a,_0x137af6){return db[_0xaac6('0x7')][_0xaac6('0x8')](_[_0xaac6('0x9')](_0x18439f,{'raw':!![],'where':{'id':0x1}}))[_0xaac6('0xa')](function(_0x20e06e){return checkLicense(_0x20e06e,null);})[_0xaac6('0xa')](function(_0x542400){_0x238d3a(_0x542400);return;})[_0xaac6('0xb')](function(_0x5722ac){_0x137af6(_0x5722ac);});});}function checkLicense(_0x4cb053,_0x9c6851){if(!_0x4cb053){demoLicense[_0xaac6('0xc')]=_0x4cb053[_0xaac6('0xd')];return demoLicense;}try{var _0x400264=_0x9c6851||_0x4cb053[_0xaac6('0xe')];if(_[_0xaac6('0xf')](_0x400264)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x124ac0=_0x4cb053[_0xaac6('0xd')];var _0x59ef6e=_0x4cb053[_0xaac6('0x10')];var _0x2c4edd=_0x124ac0[_0xaac6('0x11')]('-')[0x4];var _0x508c14=_0x124ac0[_0xaac6('0x11')]('-')[0x0];var _0x95f9ca=encryptor[_0xaac6('0x12')](_0x400264,util[_0xaac6('0x13')]('%s:%s:%s',_0x2c4edd,_0x124ac0,_0x508c14));var _0x49416f=JSON[_0xaac6('0x14')](_0x95f9ca);_0x49416f['demo']=![];_0x49416f[_0xaac6('0xc')]=_0x124ac0;_0x49416f['machineUuid']=hardware['getUuid']();if(_0x59ef6e){var _0x4547af=encryptor[_0xaac6('0x12')](_0x59ef6e);_0x49416f[_0xaac6('0x15')]=_0x4547af;_0x49416f['deadline']=moment(_0x4547af)['add'](0x7,'days')[_0xaac6('0x13')]();_0x49416f[_0xaac6('0x16')]=_0x49416f[_0xaac6('0xc')]!=_0x49416f['machineUuid']?_0xaac6('0x17'):_0xaac6('0x18');}return _0x49416f;}catch(_0x513672){breakingLicense[_0xaac6('0xc')]=_0x4cb053[_0xaac6('0xd')];breakingLicense[_0xaac6('0x19')]=_0x513672[_0xaac6('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3037e2,_0x594759){getLicense()[_0xaac6('0xa')](function(_0x15bfa1){return db['User']['findAll']({'attributes':[_0xaac6('0x1a'),[db[_0xaac6('0x1b')]['fn'](_0xaac6('0x1c'),db['sequelize'][_0xaac6('0x1d')]('role')),_0xaac6('0x1e')]],'group':_0xaac6('0x1a'),'where':{'role':{'$or':[_0xaac6('0x1f'),'user','telephone']}},'raw':!![]})[_0xaac6('0xa')](function(_0x35ed84){var _0x50eecf={'user':_0x15bfa1[_0xaac6('0x20')]||0x0,'telephone':_0x15bfa1[_0xaac6('0x21')]||0x0};_0x35ed84[_0xaac6('0x22')](function(_0x59fd09){var _0x313f5b=_0x59fd09[_0xaac6('0x1a')]===_0xaac6('0x1f')?'user':_0x59fd09['role'];_0x50eecf[_0x313f5b]-=_0x59fd09[_0xaac6('0x1e')];if(_0x50eecf[_0x313f5b]<0x0)_0x50eecf[_0x313f5b]=0x0;});_0x3037e2(_0x50eecf);return;});})[_0xaac6('0xb')](function(_0x2fbfbd){_0x594759(_0x2fbfbd);});});}function checkUserLimits(_0x3c07ab){return new BPromise(function(_0x49437d,_0x138ae8){getLimits()[_0xaac6('0xa')](function(_0x3044ea){var _0x54a229=_['pick'](_[_0xaac6('0x23')](_0x3c07ab,_0xaac6('0x1a')),[_0xaac6('0x1f'),_0xaac6('0x24'),_0xaac6('0x25')]);var _0x233948=(_0x54a229[_0xaac6('0x1f')]||0x0)+(_0x54a229[_0xaac6('0x24')]||0x0);var _0x5b3d09=_0x54a229[_0xaac6('0x25')]||0x0;if(_0x233948>_0x3044ea[_0xaac6('0x24')])return _0x138ae8(_0xaac6('0x26'));if(_0x5b3d09>_0x3044ea['telephone'])return _0x138ae8(_0xaac6('0x27'));return _0x49437d();})['catch'](function(_0x41ca2d){_0x138ae8(_0x41ca2d);});});}module[_0xaac6('0x28')]={'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 548c220..d7aa2ee 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 _0x5f2f=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x53156f,_0x3ac2f2){var _0xa6ec1f=function(_0x2c6b68){while(--_0x2c6b68){_0x53156f['push'](_0x53156f['shift']());}};_0xa6ec1f(++_0x3ac2f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e7dcb,_0x5f0fe9){_0x2e7dcb=_0x2e7dcb-0x0;var _0xc28044=_0x5f2f[_0x2e7dcb];return _0xc28044;};'use strict';module[_0xf5f2('0x0')]={'DOMAIN':_0xf5f2('0x1'),'SESSION_SECRET':_0xf5f2('0x2'),'GOOGLE_ID':_0xf5f2('0x3'),'GOOGLE_SECRET':_0xf5f2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb016=['exports','http://localhost:9000','secret'];(function(_0x3e90ce,_0x5ca394){var _0x30f618=function(_0x157bfa){while(--_0x157bfa){_0x3e90ce['push'](_0x3e90ce['shift']());}};_0x30f618(++_0x5ca394);}(_0xb016,0x159));var _0x6b01=function(_0x4e598a,_0x31a61e){_0x4e598a=_0x4e598a-0x0;var _0x181f02=_0xb016[_0x4e598a];return _0x181f02;};'use strict';module[_0x6b01('0x0')]={'DOMAIN':_0x6b01('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x6b01('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a6a523e..0ebe58b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1fa=['../utils/loggers','fileLogger','exports'];(function(_0x4d5e3d,_0x530dca){var _0x11414b=function(_0x26f41a){while(--_0x26f41a){_0x4d5e3d['push'](_0x4d5e3d['shift']());}};_0x11414b(++_0x530dca);}(_0xa1fa,0x108));var _0xaa1f=function(_0x1d25ef,_0x326e0c){_0x1d25ef=_0x1d25ef-0x0;var _0x307a11=_0xa1fa[_0x1d25ef];return _0x307a11;};'use strict';var fileLogger=require(_0xaa1f('0x0'))[_0xaa1f('0x1')];module[_0xaa1f('0x2')]=fileLogger; \ No newline at end of file +var _0xdafa=['../utils/loggers','fileLogger','exports'];(function(_0x68812b,_0x3d19be){var _0x275c1c=function(_0x69836c){while(--_0x69836c){_0x68812b['push'](_0x68812b['shift']());}};_0x275c1c(++_0x3d19be);}(_0xdafa,0x168));var _0xadaf=function(_0x240d08,_0x35c97b){_0x240d08=_0x240d08-0x0;var _0x2d7e30=_0xdafa[_0x240d08];return _0x2d7e30;};'use strict';var fileLogger=require(_0xadaf('0x0'))[_0xadaf('0x1')];module[_0xadaf('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9e5411b..253066b 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 _0x8ec4=['email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi'];(function(_0x16f20e,_0x321898){var _0x32d8c0=function(_0x5094da){while(--_0x5094da){_0x16f20e['push'](_0x16f20e['shift']());}};_0x32d8c0(++_0x321898);}(_0x8ec4,0x131));var _0x48ec=function(_0x412e42,_0x2ae8aa){_0x412e42=_0x412e42-0x0;var _0x4a212c=_0x8ec4[_0x412e42];return _0x4a212c;};'use strict';var path=require(_0x48ec('0x0'));var os=require('os');var config={'apps':[{'name':_0x48ec('0x1'),'script':path['join'](__dirname,_0x48ec('0x2'))},{'name':_0x48ec('0x3'),'script':path[_0x48ec('0x4')](__dirname,_0x48ec('0x5'))},{'name':_0x48ec('0x6'),'script':path[_0x48ec('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x48ec('0x7'),'script':path[_0x48ec('0x4')](__dirname,_0x48ec('0x8'))},{'name':_0x48ec('0x9'),'script':path['join'](__dirname,_0x48ec('0xa'))},{'name':'xdr','script':path[_0x48ec('0x4')](__dirname,'../../services/xdr/index.js')}]};module[_0x48ec('0xb')]=config; \ No newline at end of file +var _0x9074=['path','join','../../services/express/index.js','ami','../../services/agi/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports'];(function(_0x319d7c,_0x174264){var _0x1643c2=function(_0x4522ba){while(--_0x4522ba){_0x319d7c['push'](_0x319d7c['shift']());}};_0x1643c2(++_0x174264);}(_0x9074,0x132));var _0x4907=function(_0x5f3cb0,_0xa692a0){_0x5f3cb0=_0x5f3cb0-0x0;var _0x596da0=_0x9074[_0x5f3cb0];return _0x596da0;};'use strict';var path=require(_0x4907('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x4907('0x1')](__dirname,_0x4907('0x2'))},{'name':_0x4907('0x3'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,_0x4907('0x4'))},{'name':'email','script':path[_0x4907('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x4907('0x5'),'script':path[_0x4907('0x1')](__dirname,_0x4907('0x6'))},{'name':'xdr','script':path[_0x4907('0x1')](__dirname,_0x4907('0x7'))}]};module[_0x4907('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 191962a..ba2bd30 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 _0x791a=['stop','disconnect','restart','list','describe','delete','dump','saved','pm2','connect','connected','start','then'];(function(_0x50e701,_0x23cfc6){var _0x311157=function(_0x129779){while(--_0x129779){_0x50e701['push'](_0x50e701['shift']());}};_0x311157(++_0x23cfc6);}(_0x791a,0x18e));var _0xa791=function(_0x4e7ed7,_0x2ca714){_0x4e7ed7=_0x4e7ed7-0x0;var _0x217b53=_0x791a[_0x4e7ed7];return _0x217b53;};'use strict';var pm2=require(_0xa791('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1d8503,_0x48a50b){return pm2[_0xa791('0x1')](function(_0x575f27){if(_0x575f27){return _0x48a50b(_0x575f27);}return _0x1d8503(_0xa791('0x2'));});});};exports[_0xa791('0x3')]=function(_0x4ffb7a){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x1c317a,_0x20e78c){return pm2[_0xa791('0x3')](_0x4ffb7a,function(_0x5aac78,_0x13047f){if(_0x5aac78){return _0x20e78c(_0x5aac78);}pm2['disconnect']();return _0x1c317a(_0x13047f);});});});};exports['stop']=function(_0x37947f){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x4243ce,_0x2ff47c){return pm2[_0xa791('0x5')](_0x37947f,function(_0x376fe7,_0x3d88c7){if(_0x376fe7){return _0x2ff47c(_0x376fe7);}pm2[_0xa791('0x6')]();return _0x4243ce(_0x3d88c7);});});});};exports[_0xa791('0x7')]=function(_0x4f1bf8){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x5b1bba,_0x530e2a){return pm2[_0xa791('0x7')](_0x4f1bf8,function(_0x912613,_0x5b74c7){if(_0x912613){return _0x530e2a(_0x912613);}pm2[_0xa791('0x6')]();return _0x5b1bba(_0x5b74c7);});});});};exports[_0xa791('0x8')]=function(){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x4a1672,_0x39564d){return pm2[_0xa791('0x8')](function(_0x5abcff,_0x5bd292){if(_0x5abcff){return _0x39564d(_0x5abcff);}pm2[_0xa791('0x6')]();return _0x4a1672(_0x5bd292);});});});};exports[_0xa791('0x9')]=function(_0x31654e){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x5afba2,_0x5cf188){return pm2[_0xa791('0x9')](_0x31654e,function(_0xb3d8ae,_0x10e5a1){if(_0xb3d8ae){return _0x5cf188(_0xb3d8ae);}pm2[_0xa791('0x6')]();return _0x5afba2(_0x10e5a1);});});});};exports[_0xa791('0xa')]=function(_0x477768){return connect()['then'](function(){return new BPromise(function(_0x1bb6ed,_0x42d9d5){return pm2[_0xa791('0xa')](_0x477768,function(_0x81e090,_0x4f8499){if(_0x81e090){return _0x42d9d5(_0x81e090);}pm2['disconnect']();return _0x1bb6ed(_0x4f8499);});});});};exports[_0xa791('0xb')]=function(){return connect()[_0xa791('0x4')](function(){return new BPromise(function(_0x48ffe9,_0x1018a8){return pm2[_0xa791('0xb')](function(_0x34f725){if(_0x34f725){return _0x1018a8(_0x34f725);}return _0x48ffe9(_0xa791('0xc'));});});});}; \ No newline at end of file +var _0x3dcc=['start','then','disconnect','stop','restart','list','describe','delete','dump','pm2','bluebird','./config','connect'];(function(_0x3b98d0,_0x157042){var _0x4b8e14=function(_0x4562a9){while(--_0x4562a9){_0x3b98d0['push'](_0x3b98d0['shift']());}};_0x4b8e14(++_0x157042);}(_0x3dcc,0x10d));var _0xc3dc=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x3dcc[_0x3b1b23];return _0x1efc85;};'use strict';var pm2=require(_0xc3dc('0x0'));var BPromise=require(_0xc3dc('0x1'));var config=require(_0xc3dc('0x2'));function connect(){return new BPromise(function(_0x213966,_0x3a976c){return pm2[_0xc3dc('0x3')](function(_0x178a75){if(_0x178a75){return _0x3a976c(_0x178a75);}return _0x213966('connected');});});};exports[_0xc3dc('0x4')]=function(_0x1c557f){return connect()[_0xc3dc('0x5')](function(){return new BPromise(function(_0x9b82c,_0x5428bf){return pm2['start'](_0x1c557f,function(_0x4f8b7f,_0x4a278c){if(_0x4f8b7f){return _0x5428bf(_0x4f8b7f);}pm2[_0xc3dc('0x6')]();return _0x9b82c(_0x4a278c);});});});};exports[_0xc3dc('0x7')]=function(_0x444330){return connect()[_0xc3dc('0x5')](function(){return new BPromise(function(_0x450b14,_0x3d9eb1){return pm2['stop'](_0x444330,function(_0x59e8c1,_0x1fc913){if(_0x59e8c1){return _0x3d9eb1(_0x59e8c1);}pm2['disconnect']();return _0x450b14(_0x1fc913);});});});};exports[_0xc3dc('0x8')]=function(_0xb575c){return connect()[_0xc3dc('0x5')](function(){return new BPromise(function(_0x34c0a0,_0x409022){return pm2[_0xc3dc('0x8')](_0xb575c,function(_0x32ef36,_0xbbbc42){if(_0x32ef36){return _0x409022(_0x32ef36);}pm2['disconnect']();return _0x34c0a0(_0xbbbc42);});});});};exports[_0xc3dc('0x9')]=function(){return connect()[_0xc3dc('0x5')](function(){return new BPromise(function(_0x4ffd4b,_0x4fb86a){return pm2[_0xc3dc('0x9')](function(_0x19ca5b,_0x11d544){if(_0x19ca5b){return _0x4fb86a(_0x19ca5b);}pm2[_0xc3dc('0x6')]();return _0x4ffd4b(_0x11d544);});});});};exports[_0xc3dc('0xa')]=function(_0xeb2f15){return connect()['then'](function(){return new BPromise(function(_0x1fa49c,_0x31fc9c){return pm2['describe'](_0xeb2f15,function(_0x47982a,_0x28337a){if(_0x47982a){return _0x31fc9c(_0x47982a);}pm2[_0xc3dc('0x6')]();return _0x1fa49c(_0x28337a);});});});};exports[_0xc3dc('0xb')]=function(_0x3b8bc8){return connect()[_0xc3dc('0x5')](function(){return new BPromise(function(_0xf65a56,_0x29e10d){return pm2[_0xc3dc('0xb')](_0x3b8bc8,function(_0x50e093,_0x700b47){if(_0x50e093){return _0x29e10d(_0x50e093);}pm2['disconnect']();return _0xf65a56(_0x700b47);});});});};exports[_0xc3dc('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x213e32,_0x15c735){return pm2[_0xc3dc('0xc')](function(_0x5e64ef){if(_0x5e64ef){return _0x15c735(_0x5e64ef);}return _0x213e32('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b95ae61..56310ca 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 _0xe39c=['subtract','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xe39c,0x6b));var _0xce39=function(_0x254639,_0x52d8b2){_0x254639=_0x254639-0x0;var _0x582063=_0xe39c[_0x254639];return _0x582063;};'use strict';var _=require(_0xce39('0x0'));var moment=require(_0xce39('0x1'));var Redis=require(_0xce39('0x2'));var util=require(_0xce39('0x3'));var config=require(_0xce39('0x4'));var db=require(_0xce39('0x5'))['db'];var logger=require(_0xce39('0x6'))('schedule');config['redis']=_[_0xce39('0x7')](config[_0xce39('0x8')],{'host':_0xce39('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0xb38448=0x0;var _0x2814d5=[];return db[_0xce39('0xa')][_0xce39('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xce39('0xc')](function(_0x14a54b){_0xb38448=_0x14a54b[_0xce39('0xd')];if(_0xb38448){return db[_0xce39('0xe')][_0xce39('0xf')]({'raw':!![],'attributes':['id',_0xce39('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xce39('0x11')](_0x14a54b[_0xce39('0xd')],'minutes')}}});}else{return[];}})[_0xce39('0xc')](function(_0x439612){if(_0x439612&&_0x439612[_0xce39('0x12')]){_0x2814d5=_['map'](_0x439612||[],'id');logger[_0xce39('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2814d5[_0xce39('0x14')]());return db[_0xce39('0xe')][_0xce39('0x15')]({'closeReason':_0xce39('0x16'),'disposition':_0xce39('0x17'),'closed':!![],'closedAt':moment()[_0xce39('0x18')](_0xce39('0x19'))},{'where':{'id':_0x2814d5}});}})[_0xce39('0xc')](function(){if(_0x2814d5&&_0x2814d5[_0xce39('0x12')]){logger['info'](_0xce39('0x1a'),_0x2814d5[_0xce39('0x14')]());for(var _0x579d05=0x0;_0x579d05<_0x2814d5[_0xce39('0x12')];_0x579d05++){io['emit']('chatInteraction:update',{'id':_0x2814d5[_0x579d05],'closed':!![]});}}})[_0xce39('0x1b')](function(_0x66206d){logger[_0xce39('0x1c')](_0xce39('0x1d'),_0x66206d?util[_0xce39('0x1e')](_0x66206d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3880=['lodash','util','../../config/environment','../../mysqldb','schedule','redis','defaults','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start'];(function(_0x34402b,_0x2bfe25){var _0x1f35db=function(_0x40b161){while(--_0x40b161){_0x34402b['push'](_0x34402b['shift']());}};_0x1f35db(++_0x2bfe25);}(_0x3880,0x140));var _0x0388=function(_0x23757e,_0x144565){_0x23757e=_0x23757e-0x0;var _0x6bf47b=_0x3880[_0x23757e];return _0x6bf47b;};'use strict';var _=require(_0x0388('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x0388('0x1'));var config=require(_0x0388('0x2'));var db=require(_0x0388('0x3'))['db'];var logger=require('../logger')(_0x0388('0x4'));config[_0x0388('0x5')]=_[_0x0388('0x6')](config[_0x0388('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0388('0x5')]));function closeInteractions(){var _0x93b27a=0x0;var _0x574053=[];return db[_0x0388('0x7')][_0x0388('0x8')]({'raw':!![],'attributes':['id',_0x0388('0x9')],'where':{'id':0x1}})[_0x0388('0xa')](function(_0x10191b){_0x93b27a=_0x10191b[_0x0388('0x9')];if(_0x93b27a){return db[_0x0388('0xb')][_0x0388('0xc')]({'raw':!![],'attributes':['id',_0x0388('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0388('0xe')](_0x10191b[_0x0388('0x9')],_0x0388('0xf'))}}});}else{return[];}})[_0x0388('0xa')](function(_0x260e9e){if(_0x260e9e&&_0x260e9e[_0x0388('0x10')]){_0x574053=_['map'](_0x260e9e||[],'id');logger[_0x0388('0x11')](_0x0388('0x12'),_0x574053[_0x0388('0x13')]());return db['ChatInteraction']['update']({'closeReason':_0x0388('0x14'),'disposition':_0x0388('0x15'),'closed':!![],'closedAt':moment()[_0x0388('0x16')](_0x0388('0x17'))},{'where':{'id':_0x574053}});}})[_0x0388('0xa')](function(){if(_0x574053&&_0x574053[_0x0388('0x10')]){logger['info'](_0x0388('0x18'),_0x574053[_0x0388('0x13')]());for(var _0x1dfe1a=0x0;_0x1dfe1a<_0x574053[_0x0388('0x10')];_0x1dfe1a++){io[_0x0388('0x19')](_0x0388('0x1a'),{'id':_0x574053[_0x1dfe1a],'closed':!![]});}}})[_0x0388('0x1b')](function(_0x11c03d){logger[_0x0388('0x1c')](_0x0388('0x1d'),_0x11c03d?util[_0x0388('0x1e')](_0x11c03d,{'showHidden':![],'depth':null}):'');});}exports[_0x0388('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index d5dd6fa..c38802e 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c61=['startAllRefreshIntervals','exports'];(function(_0x5ea2c7,_0x5be5ca){var _0x1f9eba=function(_0x562963){while(--_0x562963){_0x5ea2c7['push'](_0x5ea2c7['shift']());}};_0x1f9eba(++_0x5be5ca);}(_0x5c61,0xcc));var _0x15c6=function(_0x380ca1,_0x1f1a1b){_0x380ca1=_0x380ca1-0x0;var _0x1defa7=_0x5c61[_0x380ca1];return _0x1defa7;};'use strict';function start(){var _0x5d551c=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x5d551c[_0x15c6('0x0')]();}module[_0x15c6('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xc19b=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3ba54c,_0x26d5d0){var _0x4c8397=function(_0x50933c){while(--_0x50933c){_0x3ba54c['push'](_0x3ba54c['shift']());}};_0x4c8397(++_0x26d5d0);}(_0xc19b,0x67));var _0xbc19=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0xc19b[_0x4f0c2b];return _0x526436;};'use strict';function start(){var _0x37048b=require(_0xbc19('0x0'));return _0x37048b[_0xbc19('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b79d012..350ef2c 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 _0x15d7=['subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','then','keys','jobs','map','toString','difference','intersection','length','stop','toRun','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','exists','deleteJob','stop\x20cron','active','endAt','update\x20cron','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','port','Smtp','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','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','stringify','Sent','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','email\x20sent','catch','error\x20mail','info','data','isNil'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x15d7,0x19f));var _0x715d=function(_0x13e56c,_0x315322){_0x13e56c=_0x13e56c-0x0;var _0x2f6321=_0x15d7[_0x13e56c];return _0x2f6321;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x715d('0x0'));var _=require(_0x715d('0x1'));var moment=require(_0x715d('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x715d('0x3'));var BPromise=require(_0x715d('0x4'));var logger=require(_0x715d('0x5'))(_0x715d('0x6'));var db=require(_0x715d('0x7'))['db'];var analyticCustomReportController=require(_0x715d('0x8'));var analyticDefaultReportController=require(_0x715d('0x9'));var client=jayson[_0x715d('0xa')][_0x715d('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5787a8,_0x560c25){return function(){logger['info'](_0x715d('0xc'),_0x5787a8[_0x715d('0xd')]);var _0x203ec8=!![];var _0x43e4f6={'tls':{'rejectUnauthorized':![]}};if(_0x5787a8['MailAccount']['Smtp'][_0x715d('0xe')]){_0x43e4f6['service']=_0x5787a8['MailAccount']['Smtp'][_0x715d('0xe')];}else{_0x43e4f6['host']=_0x5787a8[_0x715d('0xf')]['Smtp']['host'];_0x43e4f6[_0x715d('0x10')]=_0x5787a8[_0x715d('0xf')][_0x715d('0x11')][_0x715d('0x10')];_0x43e4f6[_0x715d('0x12')]=_0x5787a8[_0x715d('0xf')][_0x715d('0x11')][_0x715d('0x12')];}if(_0x5787a8['MailAccount'][_0x715d('0x11')][_0x715d('0x13')]){_0x43e4f6[_0x715d('0x14')]={'user':_0x5787a8[_0x715d('0xf')]['Smtp'][_0x715d('0x15')],'pass':_0x5787a8[_0x715d('0xf')][_0x715d('0x11')][_0x715d('0x16')]};}var _0x54cd2a={'account':_0x43e4f6,'message':{'from':util[_0x715d('0x17')](_0x715d('0x18'),_0x5787a8[_0x715d('0xf')][_0x715d('0x19')],_0x5787a8['MailAccount']['email']||_0x5787a8['MailAccount'][_0x715d('0x11')][_0x715d('0x15')]),'to':_0x5787a8[_0x715d('0xd')],'cc':_0x5787a8['cc'],'bcc':_0x5787a8[_0x715d('0x1a')],'subject':util[_0x715d('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x560c25[_0x715d('0x19')],_0x5787a8[_0x715d('0x1b')],_0x5787a8[_0x715d('0x1c')])}};var _0x3273ae=path[_0x715d('0x1d')](__dirname,_0x715d('0x1e'));var _0x2793b9=_0x560c25[_0x715d('0x1f')];var _0x18b47c=util[_0x715d('0x17')](_0x715d('0x20'),path[_0x715d('0x21')](_0x560c25['savename'],path[_0x715d('0x22')](_0x560c25[_0x715d('0x1f')])),_0x715d('0x23'));var _0x34c8d9=path[_0x715d('0x1d')](_0x3273ae,_0x2793b9);var _0x261b42=path[_0x715d('0x1d')](_0x3273ae,_0x18b47c);if(fs[_0x715d('0x24')](_0x34c8d9)){_0x560c25[_0x715d('0x25')]='Sent';_0x54cd2a[_0x715d('0x26')]['attachments']=[{'filename':_0x2793b9,'path':_0x34c8d9}];_0x54cd2a[_0x715d('0x26')][_0x715d('0x27')]=util[_0x715d('0x17')](_0x715d('0x28'),JSON[_0x715d('0x29')](_0x560c25,null,0x2));}else if(fs['existsSync'](_0x261b42)){_0x560c25[_0x715d('0x25')]=_0x715d('0x2a');_0x54cd2a[_0x715d('0x26')][_0x715d('0x2b')]=[{'filename':_0x18b47c,'path':_0x261b42}];}else{_0x54cd2a['message'][_0x715d('0x27')]=_0x715d('0x2c');if(!_0x5787a8[_0x715d('0x2d')]){_0x203ec8=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x203ec8){return client[_0x715d('0x2e')](_0x715d('0x2f'),_0x54cd2a)['then'](function(_0x48a2aa){if(_0x48a2aa[_0x715d('0x30')]){return logger[_0x715d('0x30')]('error\x20mail',JSON[_0x715d('0x29')](_0x48a2aa));}return logger['info'](_0x715d('0x31'));})[_0x715d('0x32')](function(_0x1d93b6){return logger[_0x715d('0x30')](_0x715d('0x33'),JSON[_0x715d('0x29')](_0x1d93b6));});}};}function handleError(){return function(_0x380098){return logger[_0x715d('0x30')](JSON['stringify'](_0x380098));};}function handleResult(_0x26251c){return function(_0x173ae7){logger[_0x715d('0x34')](_0x715d('0x35'),JSON[_0x715d('0x29')](_0x173ae7));if(_0x26251c['MailAccount']&&_0x26251c[_0x715d('0xf')][_0x715d('0x11')]&&!_[_0x715d('0x36')](_0x26251c[_0x715d('0xd')])){setTimeout(handleSendEmail(_0x26251c,_0x173ae7),0x3c*0x3e8);}};}function handleJob(_0x31ef9b){return function(){try{if(_[_0x715d('0x36')](_0x31ef9b[_0x715d('0x1b')])){return logger[_0x715d('0x34')](_0x715d('0x37'));}if(_['isNil'](_0x31ef9b[_0x715d('0x1c')])){return logger[_0x715d('0x34')](_0x715d('0x38'));}var _0x4e86f4={'startDate':moment()[_0x715d('0x39')](_0x31ef9b[_0x715d('0x1b')],_0x31ef9b['subtractUnit'])[_0x715d('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x715d('0x17')](_0x715d('0x3a')),'type':_0x715d('0x3b'),'output':_0x31ef9b[_0x715d('0x3c')],'name':_0x31ef9b['name']};if(!_[_0x715d('0x36')](_0x31ef9b['DefaultReportId'])){logger[_0x715d('0x34')](_0x715d('0x3d'),_0x31ef9b['DefaultReportId']);return analyticDefaultReportController[_0x715d('0x3e')]({'id':_0x31ef9b[_0x715d('0x3f')]},_0x4e86f4)['then'](handleResult(_0x31ef9b))[_0x715d('0x32')](handleError());}if(!_[_0x715d('0x36')](_0x31ef9b['CustomReportId'])){logger[_0x715d('0x34')](_0x715d('0x40'),_0x31ef9b[_0x715d('0x41')]);return analyticCustomReportController['runReport']({'id':_0x31ef9b[_0x715d('0x41')]},_0x4e86f4)['then'](handleResult(_0x31ef9b))[_0x715d('0x32')](handleError());}}catch(_0x38d0b5){logger[_0x715d('0x30')](JSON['stringify'](_0x38d0b5));}return logger[_0x715d('0x34')](_0x715d('0x42'));};}function getJobs(_0x36967f){var _0x2fc98a={};if(_0x36967f){_0x2fc98a['id']=_0x36967f;}return db[_0x715d('0x43')][_0x715d('0x44')]({'where':_0x2fc98a,'include':[{'model':db['MailAccount'],'attributes':['id',_0x715d('0x19'),_0x715d('0xd')],'include':[{'model':db['MailServerOut'],'as':_0x715d('0x11')}]}]})[_0x715d('0x45')](function(_0x4ae475){var _0x52e60f=_[_0x715d('0x46')](manager[_0x715d('0x47')]);var _0x36ce27=_[_0x715d('0x48')](_0x4ae475,function(_0x3e89d6){return _0x3e89d6['id'][_0x715d('0x49')]();});var _0x20f4cf=_['keyBy'](_0x4ae475,function(_0x161363){return _0x161363['id'][_0x715d('0x49')]();});var _0x240606=_0x36967f?_0x36ce27:_[_0x715d('0x4a')](_0x36ce27,_0x52e60f);var _0x176ec5=_[_0x715d('0x4b')](_0x36ce27,_0x52e60f);var _0x3e2a2b=_[_0x715d('0x4a')](_0x52e60f,_0x36ce27);var _0xcfae6b;var _0x544610;for(_0xcfae6b=0x0;_0xcfae6b<_0x3e2a2b[_0x715d('0x4c')]&&!_0x36967f;_0xcfae6b+=0x1){_0x544610=_0x3e2a2b[_0xcfae6b][_0x715d('0x49')]();if(manager['exists'](_0x544610)){manager[_0x715d('0x4d')](_0x544610);manager['deleteJob'](_0x544610);logger[_0x715d('0x34')]('delete\x20cron',_0x544610);}}logger['info'](_0x715d('0x4e'),JSON[_0x715d('0x29')](_0x240606));for(_0xcfae6b=0x0;_0xcfae6b<_0x240606[_0x715d('0x4c')];_0xcfae6b+=0x1){_0x544610=_0x240606[_0xcfae6b][_0x715d('0x49')]();logger[_0x715d('0x34')]('index',_0x544610);if(_0x36967f){logger[_0x715d('0x34')](_0x715d('0x4f'),_0x36967f);logger[_0x715d('0x34')](JSON[_0x715d('0x29')](_0x20f4cf[_0x544610]));BPromise[_0x715d('0x50')]()['then'](handleJob(_0x20f4cf[_0x544610]));logger[_0x715d('0x34')](_0x715d('0x51'),_0x20f4cf[_0x544610]['name'],_0x20f4cf[_0x544610][_0x715d('0x52')]);}else if(_0x20f4cf[_0x544610][_0x715d('0x52')]&&_0x20f4cf[_0x544610]['active']&&moment()[_0x715d('0x53')](_0x20f4cf[_0x544610][_0x715d('0x54')],_0x20f4cf[_0x544610]['endAt'])){manager[_0x715d('0x55')](_0x544610,_0x20f4cf[_0x544610][_0x715d('0x52')],handleJob(_0x20f4cf[_0x544610]));manager[_0x715d('0x56')](_0x544610);logger[_0x715d('0x34')](_0x715d('0x57'),_0x20f4cf[_0x544610][_0x715d('0x19')],_0x20f4cf[_0x544610]['cron']);}else if(manager[_0x715d('0x58')](_0x544610)){manager[_0x715d('0x4d')](_0x544610);manager[_0x715d('0x59')](_0x544610);logger[_0x715d('0x34')](_0x715d('0x5a'),_0x20f4cf[_0x544610][_0x715d('0x19')],_0x20f4cf[_0x544610][_0x715d('0x52')]);}}for(_0xcfae6b=0x0,_0x544610;_0xcfae6b<_0x176ec5[_0x715d('0x4c')]&&!_0x36967f;_0xcfae6b+=0x1){_0x544610=_0x176ec5[_0xcfae6b][_0x715d('0x49')]();if(manager[_0x715d('0x58')](_0x544610)){if(_0x20f4cf[_0x544610][_0x715d('0x52')]&&_0x20f4cf[_0x544610][_0x715d('0x5b')]&&moment()[_0x715d('0x53')](_0x20f4cf[_0x544610][_0x715d('0x54')],_0x20f4cf[_0x544610][_0x715d('0x5c')])){manager['update'](_0x544610,_0x20f4cf[_0x544610][_0x715d('0x52')],handleJob(_0x20f4cf[_0x544610]));logger[_0x715d('0x34')](_0x715d('0x5d'),_0x20f4cf[_0x544610][_0x715d('0x19')],_0x20f4cf[_0x544610]['cron']);}else{manager[_0x715d('0x4d')](_0x544610);manager[_0x715d('0x59')](_0x544610);logger['info'](_0x715d('0x5a'),_0x20f4cf[_0x544610]['name'],_0x20f4cf[_0x544610]['cron']);}}}})['catch'](function(_0x2d110f){logger[_0x715d('0x30')](JSON[_0x715d('0x29')](_0x2d110f));});}exports['run']=function(_0x1af3f5){return getJobs(_0x1af3f5);};exports[_0x715d('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf48e=['startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','MailAccount','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','message','attachments','text','Sent','sendIfEmpty','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','index','my\x20id','resolve','cron','active','isBetween'];(function(_0x1b24bf,_0x3e51bc){var _0x42fe8a=function(_0x50e38a){while(--_0x50e38a){_0x1b24bf['push'](_0x1b24bf['shift']());}};_0x42fe8a(++_0x3e51bc);}(_0xf48e,0x15d));var _0xef48=function(_0x362b55,_0x27b2c2){_0x362b55=_0x362b55-0x0;var _0x286ee1=_0xf48e[_0x362b55];return _0x286ee1;};'use strict';var fs=require('fs');var util=require(_0xef48('0x0'));var path=require(_0xef48('0x1'));var _=require(_0xef48('0x2'));var moment=require('moment');var CronJobManager=require(_0xef48('0x3'));var jayson=require(_0xef48('0x4'));var BPromise=require('bluebird');var logger=require(_0xef48('0x5'))(_0xef48('0x6'));var db=require(_0xef48('0x7'))['db'];var analyticCustomReportController=require(_0xef48('0x8'));var analyticDefaultReportController=require(_0xef48('0x9'));var client=jayson[_0xef48('0xa')][_0xef48('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x15a5e4,_0x7206e8){return function(){logger[_0xef48('0xc')](_0xef48('0xd'),_0x15a5e4[_0xef48('0xe')]);var _0x267360=!![];var _0x38c356={'tls':{'rejectUnauthorized':![]}};if(_0x15a5e4['MailAccount'][_0xef48('0xf')]['service']){_0x38c356[_0xef48('0x10')]=_0x15a5e4['MailAccount']['Smtp'][_0xef48('0x10')];}else{_0x38c356[_0xef48('0x11')]=_0x15a5e4['MailAccount']['Smtp']['host'];_0x38c356['port']=_0x15a5e4[_0xef48('0x12')][_0xef48('0xf')]['port'];_0x38c356[_0xef48('0x13')]=_0x15a5e4['MailAccount'][_0xef48('0xf')][_0xef48('0x13')];}if(_0x15a5e4[_0xef48('0x12')][_0xef48('0xf')][_0xef48('0x14')]){_0x38c356[_0xef48('0x15')]={'user':_0x15a5e4[_0xef48('0x12')][_0xef48('0xf')][_0xef48('0x16')],'pass':_0x15a5e4[_0xef48('0x12')][_0xef48('0xf')][_0xef48('0x17')]};}var _0x407d21={'account':_0x38c356,'message':{'from':util[_0xef48('0x18')](_0xef48('0x19'),_0x15a5e4['MailAccount'][_0xef48('0x1a')],_0x15a5e4[_0xef48('0x12')][_0xef48('0xe')]||_0x15a5e4[_0xef48('0x12')][_0xef48('0xf')]['user']),'to':_0x15a5e4[_0xef48('0xe')],'cc':_0x15a5e4['cc'],'bcc':_0x15a5e4['bcc'],'subject':util[_0xef48('0x18')](_0xef48('0x1b'),_0x7206e8['name'],_0x15a5e4[_0xef48('0x1c')],_0x15a5e4['subtractUnit'])}};var _0x28671f=path[_0xef48('0x1d')](__dirname,_0xef48('0x1e'));var _0x165fa4=_0x7206e8[_0xef48('0x1f')];var _0x49f05d=util[_0xef48('0x18')](_0xef48('0x20'),path[_0xef48('0x21')](_0x7206e8[_0xef48('0x1f')],path['extname'](_0x7206e8[_0xef48('0x1f')])),_0xef48('0x22'));var _0x38ec6e=path['join'](_0x28671f,_0x165fa4);var _0xe6afb0=path[_0xef48('0x1d')](_0x28671f,_0x49f05d);if(fs[_0xef48('0x23')](_0x38ec6e)){_0x7206e8[_0xef48('0x24')]='Sent';_0x407d21[_0xef48('0x25')][_0xef48('0x26')]=[{'filename':_0x165fa4,'path':_0x38ec6e}];_0x407d21[_0xef48('0x25')][_0xef48('0x27')]=util[_0xef48('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x7206e8,null,0x2));}else if(fs[_0xef48('0x23')](_0xe6afb0)){_0x7206e8[_0xef48('0x24')]=_0xef48('0x28');_0x407d21[_0xef48('0x25')][_0xef48('0x26')]=[{'filename':_0x49f05d,'path':_0xe6afb0}];}else{_0x407d21[_0xef48('0x25')][_0xef48('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x15a5e4[_0xef48('0x29')]){_0x267360=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x267360){return client[_0xef48('0x2a')](_0xef48('0x2b'),_0x407d21)['then'](function(_0x5c0516){if(_0x5c0516[_0xef48('0x2c')]){return logger[_0xef48('0x2c')](_0xef48('0x2d'),JSON[_0xef48('0x2e')](_0x5c0516));}return logger['info'](_0xef48('0x2f'));})[_0xef48('0x30')](function(_0x37e777){return logger[_0xef48('0x2c')](_0xef48('0x2d'),JSON['stringify'](_0x37e777));});}};}function handleError(){return function(_0x5a093f){return logger[_0xef48('0x2c')](JSON['stringify'](_0x5a093f));};}function handleResult(_0x38f65b){return function(_0x36baf4){logger[_0xef48('0xc')]('data',JSON[_0xef48('0x2e')](_0x36baf4));if(_0x38f65b[_0xef48('0x12')]&&_0x38f65b[_0xef48('0x12')][_0xef48('0xf')]&&!_[_0xef48('0x31')](_0x38f65b['email'])){setTimeout(handleSendEmail(_0x38f65b,_0x36baf4),0x3c*0x3e8);}};}function handleJob(_0x50c2d8){return function(){try{if(_[_0xef48('0x31')](_0x50c2d8[_0xef48('0x1c')])){return logger[_0xef48('0xc')](_0xef48('0x32'));}if(_['isNil'](_0x50c2d8['subtractUnit'])){return logger[_0xef48('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x208204={'startDate':moment()['subtract'](_0x50c2d8[_0xef48('0x1c')],_0x50c2d8[_0xef48('0x33')])[_0xef48('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xef48('0x18')](_0xef48('0x34')),'type':_0xef48('0x35'),'output':_0x50c2d8['output'],'name':_0x50c2d8[_0xef48('0x1a')]};if(!_['isNil'](_0x50c2d8[_0xef48('0x36')])){logger[_0xef48('0xc')](_0xef48('0x37'),_0x50c2d8[_0xef48('0x36')]);return analyticDefaultReportController[_0xef48('0x38')]({'id':_0x50c2d8[_0xef48('0x36')]},_0x208204)[_0xef48('0x39')](handleResult(_0x50c2d8))[_0xef48('0x30')](handleError());}if(!_[_0xef48('0x31')](_0x50c2d8['CustomReportId'])){logger[_0xef48('0xc')](_0xef48('0x3a'),_0x50c2d8[_0xef48('0x3b')]);return analyticCustomReportController['runReport']({'id':_0x50c2d8[_0xef48('0x3b')]},_0x208204)[_0xef48('0x39')](handleResult(_0x50c2d8))[_0xef48('0x30')](handleError());}}catch(_0x39764d){logger[_0xef48('0x2c')](JSON[_0xef48('0x2e')](_0x39764d));}return logger[_0xef48('0xc')]('no\x20report\x20id');};}function getJobs(_0x563deb){var _0x2495e4={};if(_0x563deb){_0x2495e4['id']=_0x563deb;}return db[_0xef48('0x3c')]['findAll']({'where':_0x2495e4,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0xef48('0xf')}]}]})[_0xef48('0x39')](function(_0x5309ff){var _0x4f8497=_['keys'](manager['jobs']);var _0x3f9395=_[_0xef48('0x3d')](_0x5309ff,function(_0x5cf607){return _0x5cf607['id'][_0xef48('0x3e')]();});var _0x2ddf0b=_[_0xef48('0x3f')](_0x5309ff,function(_0x3f9f5f){return _0x3f9f5f['id'][_0xef48('0x3e')]();});var _0x47e1d6=_0x563deb?_0x3f9395:_[_0xef48('0x40')](_0x3f9395,_0x4f8497);var _0x514d62=_[_0xef48('0x41')](_0x3f9395,_0x4f8497);var _0x278e33=_['difference'](_0x4f8497,_0x3f9395);var _0x2ddf96;var _0x41b5c2;for(_0x2ddf96=0x0;_0x2ddf96<_0x278e33[_0xef48('0x42')]&&!_0x563deb;_0x2ddf96+=0x1){_0x41b5c2=_0x278e33[_0x2ddf96][_0xef48('0x3e')]();if(manager[_0xef48('0x43')](_0x41b5c2)){manager['stop'](_0x41b5c2);manager[_0xef48('0x44')](_0x41b5c2);logger['info'](_0xef48('0x45'),_0x41b5c2);}}logger['info']('toRun',JSON['stringify'](_0x47e1d6));for(_0x2ddf96=0x0;_0x2ddf96<_0x47e1d6[_0xef48('0x42')];_0x2ddf96+=0x1){_0x41b5c2=_0x47e1d6[_0x2ddf96][_0xef48('0x3e')]();logger['info'](_0xef48('0x46'),_0x41b5c2);if(_0x563deb){logger['info'](_0xef48('0x47'),_0x563deb);logger[_0xef48('0xc')](JSON[_0xef48('0x2e')](_0x2ddf0b[_0x41b5c2]));BPromise[_0xef48('0x48')]()[_0xef48('0x39')](handleJob(_0x2ddf0b[_0x41b5c2]));logger['info']('run\x20job',_0x2ddf0b[_0x41b5c2][_0xef48('0x1a')],_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]);}else if(_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]&&_0x2ddf0b[_0x41b5c2][_0xef48('0x4a')]&&moment()[_0xef48('0x4b')](_0x2ddf0b[_0x41b5c2][_0xef48('0x4c')],_0x2ddf0b[_0x41b5c2][_0xef48('0x4d')])){manager[_0xef48('0x4e')](_0x41b5c2,_0x2ddf0b[_0x41b5c2][_0xef48('0x49')],handleJob(_0x2ddf0b[_0x41b5c2]));manager[_0xef48('0x4f')](_0x41b5c2);logger[_0xef48('0xc')](_0xef48('0x50'),_0x2ddf0b[_0x41b5c2][_0xef48('0x1a')],_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]);}else if(manager[_0xef48('0x43')](_0x41b5c2)){manager[_0xef48('0x51')](_0x41b5c2);manager['deleteJob'](_0x41b5c2);logger['info'](_0xef48('0x52'),_0x2ddf0b[_0x41b5c2][_0xef48('0x1a')],_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]);}}for(_0x2ddf96=0x0,_0x41b5c2;_0x2ddf96<_0x514d62['length']&&!_0x563deb;_0x2ddf96+=0x1){_0x41b5c2=_0x514d62[_0x2ddf96]['toString']();if(manager[_0xef48('0x43')](_0x41b5c2)){if(_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]&&_0x2ddf0b[_0x41b5c2]['active']&&moment()[_0xef48('0x4b')](_0x2ddf0b[_0x41b5c2][_0xef48('0x4c')],_0x2ddf0b[_0x41b5c2][_0xef48('0x4d')])){manager['update'](_0x41b5c2,_0x2ddf0b[_0x41b5c2][_0xef48('0x49')],handleJob(_0x2ddf0b[_0x41b5c2]));logger[_0xef48('0xc')](_0xef48('0x53'),_0x2ddf0b[_0x41b5c2]['name'],_0x2ddf0b[_0x41b5c2]['cron']);}else{manager[_0xef48('0x51')](_0x41b5c2);manager[_0xef48('0x44')](_0x41b5c2);logger[_0xef48('0xc')]('stop\x20cron',_0x2ddf0b[_0x41b5c2]['name'],_0x2ddf0b[_0x41b5c2][_0xef48('0x49')]);}}}})[_0xef48('0x30')](function(_0x5e2b5e){logger[_0xef48('0x2c')](JSON[_0xef48('0x2e')](_0x5e2b5e));});}exports[_0xef48('0x54')]=function(_0x10faf5){return getJobs(_0x10faf5);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index dc01973..0cc5cfc 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 _0xb264=['transcribe','TranscribeService','Comprehend','substring','format','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','sentiment','Positive','Mixed','catch','name','SequelizeValidationError','error','inspect','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','../../config/logger'];(function(_0x31c9dc,_0x24c945){var _0x326c0f=function(_0xf3cecc){while(--_0xf3cecc){_0x31c9dc['push'](_0x31c9dc['shift']());}};_0x326c0f(++_0x24c945);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};var _=require(_0x4b26('0x0'));var AWS=require(_0x4b26('0x1'));var rp=require('request-promise');var util=require(_0x4b26('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x4b26('0x3'))(_0x4b26('0x4'));function getTranscriptionJob(_0x2c7976,_0x2acd7f,_0xb9dc41,_0x5fbad0){return new Promise(function(_0x1e3af6,_0x4e039d){var _0x165096=new AWS[(_0x4b26('0x5'))]({'accessKeyId':_0x2acd7f,'secretAccessKey':_0x2c7976,'region':_0xb9dc41});_0x165096['getTranscriptionJob']({'TranscriptionJobName':_0x5fbad0},function(_0x1edb7c,_0xec9f8a){if(_0x1edb7c){return _0x4e039d(_0x1edb7c);}else{return _0x1e3af6(_0xec9f8a);}});});}function sentiment(_0x2fa7da,_0x4f6c54,_0x2ab5e2,_0x408822,_0x1418fe){return new Promise(function(_0x2d1be3,_0x467589){var _0x59fd0f=new AWS[(_0x4b26('0x6'))]({'accessKeyId':_0x4f6c54,'secretAccessKey':_0x2fa7da,'region':_0x2ab5e2});_0x59fd0f['detectSentiment']({'Text':_0x408822,'LanguageCode':_0x1418fe[_0x4b26('0x7')](0x0,0x2)},function(_0x1b1c14,_0x28a96b){if(_0x1b1c14){return _0x467589(_0x1b1c14);}else{return _0x2d1be3(_0x28a96b);}});});}function checkTranscribeJob(_0x3fd639,_0x46f945,_0x56f690){var _0x25eaa9;return new BPromise(function(_0x3e47f0,_0x484608){logger['info'](util[_0x4b26('0x8')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3fd639['id'],_0x3fd639[_0x4b26('0x9')]));return getTranscriptionJob(_0x56f690[_0x4b26('0xa')],_0x56f690[_0x4b26('0xb')],_0x46f945['transcribeRegion'],_0x3fd639[_0x4b26('0x9')])[_0x4b26('0xc')](function(_0x278a8d){logger[_0x4b26('0xd')](util[_0x4b26('0x8')](_0x4b26('0xe'),_0x3fd639['id'],_0x3fd639[_0x4b26('0x9')],_0x278a8d[_0x4b26('0xf')][_0x4b26('0x10')]));if(!_0x3fd639[_0x4b26('0x11')]){switch(_0x278a8d[_0x4b26('0xf')]['TranscriptionJobStatus']){case _0x4b26('0x12'):var _0x592ddb={'transcribeStatus':_0x278a8d['TranscriptionJob'][_0x4b26('0x10')],'fileUri':_0x278a8d[_0x4b26('0xf')][_0x4b26('0x13')][_0x4b26('0x14')]};logger['info'](util[_0x4b26('0x8')](_0x4b26('0x15'),_0x3fd639['id']));return rp({'uri':_0x278a8d[_0x4b26('0xf')][_0x4b26('0x13')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x2b77d9){logger[_0x4b26('0xd')](util['format'](_0x4b26('0x16'),_0x3fd639['id']));if(_0x2b77d9&&_0x2b77d9[_0x4b26('0x17')]&&_0x2b77d9[_0x4b26('0x17')][_0x4b26('0x18')]&&_0x2b77d9[_0x4b26('0x17')][_0x4b26('0x18')][_0x4b26('0x19')]){_0x592ddb[_0x4b26('0x11')]='';for(var _0x468183=0x0;_0x468183<_0x2b77d9[_0x4b26('0x17')][_0x4b26('0x18')][_0x4b26('0x19')];_0x468183++){_0x592ddb[_0x4b26('0x11')]+=_0x2b77d9[_0x4b26('0x17')]['transcripts'][_0x468183]['transcript']+'';}}return _0x3fd639['update'](_0x592ddb);})[_0x4b26('0xc')](function(){logger[_0x4b26('0xd')](util['format'](_0x4b26('0x1a'),_0x3fd639['id']));if(!_0x3fd639['tempSentiment']){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x46f945['sentiment']||!_0x46f945[_0x4b26('0x1d')]||!_0x46f945[_0x4b26('0x1e')]||!_0x46f945['language']||!_0x46f945[_0x4b26('0x1f')]){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))](_0x4b26('0x20'));}if(!_0x592ddb[_0x4b26('0x11')]){throw new Error(_0x4b26('0x21'));}if(_0x46f945['sentimentAccountId']===_0x56f690['id']){return _0x56f690;}else{return db[_0x4b26('0x22')][_0x4b26('0x23')]({'where':{'id':_settings[_0x4b26('0x1d')]}});}})['then'](function(_0x576fdf){if(!_0x576fdf){throw new db['Sequelize'][(_0x4b26('0x1c'))](_0x4b26('0x24'));}if(!_0x576fdf[_0x4b26('0xa')]||!_0x576fdf[_0x4b26('0xb')]){throw new db[(_0x4b26('0x1b'))]['ValidationError'](_0x4b26('0x25'));}_0x25eaa9=_0x576fdf;logger[_0x4b26('0xd')](util[_0x4b26('0x8')](_0x4b26('0x26'),_0x3fd639['id']));return sentiment(_0x25eaa9[_0x4b26('0xa')],_0x25eaa9['data2'],_0x46f945[_0x4b26('0x1e')],_0x592ddb['fileText'],_0x46f945[_0x4b26('0x27')]);})['then'](function(_0x223f33){logger[_0x4b26('0xd')](util[_0x4b26('0x8')](_0x4b26('0x28'),_0x3fd639['id']));return _0x3fd639[_0x4b26('0x29')]({'sentiment':_0x223f33[_0x4b26('0x2a')],'sPositive':_0x223f33[_0x4b26('0x2b')]['Positive'],'sNegative':_0x223f33[_0x4b26('0x2b')][_0x4b26('0x2c')],'sMixed':_0x223f33['SentimentScore']['Mixed'],'sNeutral':_0x223f33[_0x4b26('0x2b')]['Neutral']});})[_0x4b26('0xc')](function(){logger[_0x4b26('0xd')](util[_0x4b26('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3fd639['id']));_0x3e47f0();});case _0x4b26('0x2d'):return _0x3fd639[_0x4b26('0x29')]({'transcribeStatus':'FAILED','failureReason':_0x278a8d[_0x4b26('0xf')][_0x4b26('0x2e')]})['then'](function(){logger['info'](util['format'](_0x4b26('0x1a'),_0x3fd639['id']));_0x3e47f0();});default:logger[_0x4b26('0xd')](util[_0x4b26('0x8')](_0x4b26('0x2f'),_0x3fd639['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x3fd639['tempSentiment']){throw new db['Sequelize'][(_0x4b26('0x1c'))](_0x4b26('0x30'));}if(!_0x46f945[_0x4b26('0x31')]||!_0x46f945[_0x4b26('0x1d')]||!_0x46f945[_0x4b26('0x1e')]||!_0x46f945['language']||!_0x46f945['bucket']){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))](_0x4b26('0x20'));}if(!_0x3fd639[_0x4b26('0x11')]){throw new Error(_0x4b26('0x21'));}if(_0x46f945['sentimentAccountId']===_0x56f690['id']){return _0x56f690;}else{return db[_0x4b26('0x22')][_0x4b26('0x23')]({'where':{'id':_settings[_0x4b26('0x1d')]}});}})[_0x4b26('0xc')](function(_0x15d486){if(!_0x15d486){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x15d486[_0x4b26('0xa')]||!_0x15d486[_0x4b26('0xb')]){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))](_0x4b26('0x25'));}_0x25eaa9=_0x15d486;logger['info'](util['format'](_0x4b26('0x26'),_0x3fd639['id']));return sentiment(_0x25eaa9[_0x4b26('0xa')],_0x25eaa9[_0x4b26('0xb')],_0x46f945['sentimentRegion'],_0x3fd639['fileText'],_0x46f945[_0x4b26('0x27')]);})[_0x4b26('0xc')](function(_0x4a9a04){logger['info'](util['format'](_0x4b26('0x28'),_0x3fd639['id']));return _0x3fd639[_0x4b26('0x29')]({'sentiment':_0x4a9a04[_0x4b26('0x2a')],'sPositive':_0x4a9a04[_0x4b26('0x2b')][_0x4b26('0x32')],'sNegative':_0x4a9a04[_0x4b26('0x2b')]['Negative'],'sMixed':_0x4a9a04[_0x4b26('0x2b')][_0x4b26('0x33')],'sNeutral':_0x4a9a04[_0x4b26('0x2b')]['Neutral'],'transcribeStatus':_0x4b26('0x12')});})[_0x4b26('0xc')](function(){logger[_0x4b26('0xd')](util[_0x4b26('0x8')](_0x4b26('0x1a'),_0x3fd639['id']));_0x3e47f0();});}})[_0x4b26('0x34')](function(_0x1d1f50){if(_0x1d1f50){if(!_0x1d1f50['name']||_0x1d1f50[_0x4b26('0x35')]!==_0x4b26('0x36')){logger[_0x4b26('0x37')](util[_0x4b26('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3fd639['id']),util[_0x4b26('0x38')](_0x1d1f50,{'showHidden':![],'depth':null}));}}_0x3e47f0();});});}function checkTranscribe(){var _0x10fcbf;var _0x1bd00f;var _0x503574;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x4b26('0x39')}})['then'](function(_0x519724){if(!_0x519724||!_0x519724[_0x4b26('0x19')]){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))]('No\x20transcribe\x20job\x20to\x20check');}_0x10fcbf=_0x519724;return db[_0x4b26('0x3a')][_0x4b26('0x23')]({'where':{'id':0x1}});})[_0x4b26('0xc')](function(_0x4231eb){if(!_0x4231eb){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))](_0x4b26('0x3b'));}_0x1bd00f=_0x4231eb;if(!_0x1bd00f[_0x4b26('0x4')]||!_0x1bd00f[_0x4b26('0x3c')]||!_0x1bd00f[_0x4b26('0x3d')]||!_0x1bd00f[_0x4b26('0x27')]||!_0x1bd00f['bucket']){throw new db['Sequelize'][(_0x4b26('0x1c'))](_0x4b26('0x3e'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1bd00f[_0x4b26('0x3c')]}});})[_0x4b26('0xc')](function(_0x1f1b4c){if(!_0x1f1b4c){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1f1b4c['data1']||!_0x1f1b4c[_0x4b26('0xb')]){throw new db[(_0x4b26('0x1b'))][(_0x4b26('0x1c'))](_0x4b26('0x25'));}_0x503574=_0x1f1b4c;var _0x23e73d=[];_0x10fcbf[_0x4b26('0x3f')](function(_0x1c5ae1){_0x23e73d[_0x4b26('0x40')](checkTranscribeJob(_0x1c5ae1,_0x1bd00f,_0x503574));});return BPromise[_0x4b26('0x41')](_0x23e73d);})[_0x4b26('0x34')](function(_0x483de3){if(_0x483de3){if(!_0x483de3['name']||_0x483de3['name']!==_0x4b26('0x36')){logger[_0x4b26('0x37')](util['inspect'](_0x483de3,{'showHidden':![],'depth':null}));}}});}exports[_0x4b26('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc900=['Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x3ed3d5,_0x3c220b){var _0x502d94=function(_0x3a970d){while(--_0x3a970d){_0x3ed3d5['push'](_0x3ed3d5['shift']());}};_0x502d94(++_0x3c220b);}(_0xc900,0xb3));var _0x0c90=function(_0x132b3a,_0x5d7026){_0x132b3a=_0x132b3a-0x0;var _0x356b37=_0xc900[_0x132b3a];return _0x356b37;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x0c90('0x0'));var util=require(_0x0c90('0x1'));var BPromise=require(_0x0c90('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x0c90('0x3'))(_0x0c90('0x4'));function getTranscriptionJob(_0x492f22,_0x188bba,_0x3f351c,_0x3753cf){return new Promise(function(_0x718a5c,_0x42f9a3){var _0x302ab1=new AWS['TranscribeService']({'accessKeyId':_0x188bba,'secretAccessKey':_0x492f22,'region':_0x3f351c});_0x302ab1[_0x0c90('0x5')]({'TranscriptionJobName':_0x3753cf},function(_0x1c1996,_0x23daed){if(_0x1c1996){return _0x42f9a3(_0x1c1996);}else{return _0x718a5c(_0x23daed);}});});}function sentiment(_0x29a7ba,_0x128656,_0x3d0f49,_0x313ce9,_0x18d9fd){return new Promise(function(_0x3e0df6,_0x34456e){var _0x10daeb=new AWS[(_0x0c90('0x6'))]({'accessKeyId':_0x128656,'secretAccessKey':_0x29a7ba,'region':_0x3d0f49});_0x10daeb[_0x0c90('0x7')]({'Text':_0x313ce9,'LanguageCode':_0x18d9fd['substring'](0x0,0x2)},function(_0x438266,_0x48d32e){if(_0x438266){return _0x34456e(_0x438266);}else{return _0x3e0df6(_0x48d32e);}});});}function checkTranscribeJob(_0x452bd1,_0x50e7db,_0x459cdb){var _0x26fc46;return new BPromise(function(_0x4535a2,_0x3e251f){logger[_0x0c90('0x8')](util['format'](_0x0c90('0x9'),_0x452bd1['id'],_0x452bd1[_0x0c90('0xa')]));return getTranscriptionJob(_0x459cdb['data1'],_0x459cdb[_0x0c90('0xb')],_0x50e7db[_0x0c90('0xc')],_0x452bd1[_0x0c90('0xa')])['then'](function(_0x5daeb7){logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0xe'),_0x452bd1['id'],_0x452bd1[_0x0c90('0xa')],_0x5daeb7[_0x0c90('0xf')][_0x0c90('0x10')]));if(!_0x452bd1[_0x0c90('0x11')]){switch(_0x5daeb7['TranscriptionJob'][_0x0c90('0x10')]){case _0x0c90('0x12'):var _0x462d49={'transcribeStatus':_0x5daeb7[_0x0c90('0xf')]['TranscriptionJobStatus'],'fileUri':_0x5daeb7[_0x0c90('0xf')][_0x0c90('0x13')][_0x0c90('0x14')]};logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x15'),_0x452bd1['id']));return rp({'uri':_0x5daeb7['TranscriptionJob'][_0x0c90('0x13')]['TranscriptFileUri'],'json':!![]})[_0x0c90('0x16')](function(_0x1a021e){logger['info'](util[_0x0c90('0xd')](_0x0c90('0x17'),_0x452bd1['id']));if(_0x1a021e&&_0x1a021e[_0x0c90('0x18')]&&_0x1a021e[_0x0c90('0x18')][_0x0c90('0x19')]&&_0x1a021e[_0x0c90('0x18')]['transcripts'][_0x0c90('0x1a')]){_0x462d49[_0x0c90('0x11')]='';for(var _0x5695a2=0x0;_0x5695a2<_0x1a021e['results'][_0x0c90('0x19')][_0x0c90('0x1a')];_0x5695a2++){_0x462d49[_0x0c90('0x11')]+=_0x1a021e[_0x0c90('0x18')]['transcripts'][_0x5695a2][_0x0c90('0x1b')]+'';}}return _0x452bd1[_0x0c90('0x1c')](_0x462d49);})[_0x0c90('0x16')](function(){logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x1d'),_0x452bd1['id']));if(!_0x452bd1['tempSentiment']){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x20'));}if(!_0x50e7db[_0x0c90('0x21')]||!_0x50e7db['sentimentAccountId']||!_0x50e7db['sentimentRegion']||!_0x50e7db[_0x0c90('0x22')]||!_0x50e7db[_0x0c90('0x23')]){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x24'));}if(!_0x462d49['fileText']){throw new Error(_0x0c90('0x25'));}if(_0x50e7db[_0x0c90('0x26')]===_0x459cdb['id']){return _0x459cdb;}else{return db[_0x0c90('0x27')]['findOne']({'where':{'id':_settings[_0x0c90('0x26')]}});}})['then'](function(_0x54a3f5){if(!_0x54a3f5){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x28'));}if(!_0x54a3f5[_0x0c90('0x29')]||!_0x54a3f5['data2']){throw new db[(_0x0c90('0x1e'))]['ValidationError'](_0x0c90('0x2a'));}_0x26fc46=_0x54a3f5;logger['info'](util[_0x0c90('0xd')](_0x0c90('0x2b'),_0x452bd1['id']));return sentiment(_0x26fc46['data1'],_0x26fc46[_0x0c90('0xb')],_0x50e7db[_0x0c90('0x2c')],_0x462d49[_0x0c90('0x11')],_0x50e7db[_0x0c90('0x22')]);})[_0x0c90('0x16')](function(_0x1517c9){logger[_0x0c90('0x8')](util[_0x0c90('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x452bd1['id']));return _0x452bd1[_0x0c90('0x1c')]({'sentiment':_0x1517c9[_0x0c90('0x2d')],'sPositive':_0x1517c9[_0x0c90('0x2e')][_0x0c90('0x2f')],'sNegative':_0x1517c9['SentimentScore'][_0x0c90('0x30')],'sMixed':_0x1517c9[_0x0c90('0x2e')][_0x0c90('0x31')],'sNeutral':_0x1517c9[_0x0c90('0x2e')][_0x0c90('0x32')]});})[_0x0c90('0x16')](function(){logger[_0x0c90('0x8')](util[_0x0c90('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x452bd1['id']));_0x4535a2();});case _0x0c90('0x33'):return _0x452bd1[_0x0c90('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x5daeb7[_0x0c90('0xf')][_0x0c90('0x34')]})[_0x0c90('0x16')](function(){logger[_0x0c90('0x8')](util[_0x0c90('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x452bd1['id']));_0x4535a2();});default:logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x35'),_0x452bd1['id']));break;}}else{return BPromise[_0x0c90('0x36')]()[_0x0c90('0x16')](function(){if(!_0x452bd1[_0x0c90('0x37')]){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x20'));}if(!_0x50e7db['sentiment']||!_0x50e7db[_0x0c90('0x26')]||!_0x50e7db['sentimentRegion']||!_0x50e7db[_0x0c90('0x22')]||!_0x50e7db['bucket']){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x452bd1['fileText']){throw new Error(_0x0c90('0x25'));}if(_0x50e7db['sentimentAccountId']===_0x459cdb['id']){return _0x459cdb;}else{return db[_0x0c90('0x27')][_0x0c90('0x38')]({'where':{'id':_settings[_0x0c90('0x26')]}});}})['then'](function(_0x2ad8eb){if(!_0x2ad8eb){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x28'));}if(!_0x2ad8eb[_0x0c90('0x29')]||!_0x2ad8eb[_0x0c90('0xb')]){throw new db['Sequelize'][(_0x0c90('0x1f'))](_0x0c90('0x2a'));}_0x26fc46=_0x2ad8eb;logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x2b'),_0x452bd1['id']));return sentiment(_0x26fc46[_0x0c90('0x29')],_0x26fc46[_0x0c90('0xb')],_0x50e7db['sentimentRegion'],_0x452bd1[_0x0c90('0x11')],_0x50e7db['language']);})[_0x0c90('0x16')](function(_0x2470ce){logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x39'),_0x452bd1['id']));return _0x452bd1[_0x0c90('0x1c')]({'sentiment':_0x2470ce[_0x0c90('0x2d')],'sPositive':_0x2470ce[_0x0c90('0x2e')][_0x0c90('0x2f')],'sNegative':_0x2470ce[_0x0c90('0x2e')][_0x0c90('0x30')],'sMixed':_0x2470ce[_0x0c90('0x2e')][_0x0c90('0x31')],'sNeutral':_0x2470ce[_0x0c90('0x2e')][_0x0c90('0x32')],'transcribeStatus':'COMPLETED'});})[_0x0c90('0x16')](function(){logger[_0x0c90('0x8')](util[_0x0c90('0xd')](_0x0c90('0x1d'),_0x452bd1['id']));_0x4535a2();});}})[_0x0c90('0x3a')](function(_0x2d9bea){if(_0x2d9bea){if(!_0x2d9bea[_0x0c90('0x3b')]||_0x2d9bea[_0x0c90('0x3b')]!==_0x0c90('0x3c')){logger[_0x0c90('0x3d')](util[_0x0c90('0xd')](_0x0c90('0x3e'),_0x452bd1['id']),util[_0x0c90('0x3f')](_0x2d9bea,{'showHidden':![],'depth':null}));}}_0x4535a2();});});}function checkTranscribe(){var _0x229e2f;var _0x595504;var _0x1b4aac;return db[_0x0c90('0x40')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x28c510){if(!_0x28c510||!_0x28c510[_0x0c90('0x1a')]){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x41'));}_0x229e2f=_0x28c510;return db['Setting'][_0x0c90('0x38')]({'where':{'id':0x1}});})[_0x0c90('0x16')](function(_0x2b756d){if(!_0x2b756d){throw new db['Sequelize'][(_0x0c90('0x1f'))](_0x0c90('0x42'));}_0x595504=_0x2b756d;if(!_0x595504[_0x0c90('0x4')]||!_0x595504[_0x0c90('0x43')]||!_0x595504[_0x0c90('0xc')]||!_0x595504[_0x0c90('0x22')]||!_0x595504[_0x0c90('0x23')]){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x44'));}return db['CloudProvider'][_0x0c90('0x38')]({'where':{'id':_0x595504['transcribeAccountId']}});})[_0x0c90('0x16')](function(_0x67539d){if(!_0x67539d){throw new db[(_0x0c90('0x1e'))][(_0x0c90('0x1f'))](_0x0c90('0x28'));}if(!_0x67539d[_0x0c90('0x29')]||!_0x67539d['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1b4aac=_0x67539d;var _0x2857a3=[];_0x229e2f[_0x0c90('0x45')](function(_0x3bf5de){_0x2857a3['push'](checkTranscribeJob(_0x3bf5de,_0x595504,_0x1b4aac));});return BPromise[_0x0c90('0x46')](_0x2857a3);})[_0x0c90('0x3a')](function(_0x5727b7){if(_0x5727b7){if(!_0x5727b7[_0x0c90('0x3b')]||_0x5727b7['name']!==_0x0c90('0x3c')){logger[_0x0c90('0x3d')](util[_0x0c90('0x3f')](_0x5727b7,{'showHidden':![],'depth':null}));}}});}exports[_0x0c90('0x47')]=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 9fef590..fc99eed 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 _0xc102=['lastMsgAt','hours','then','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x51ac01,_0x55d78d){var _0x32ea60=function(_0x2a7345){while(--_0x2a7345){_0x51ac01['push'](_0x51ac01['shift']());}};_0x32ea60(++_0x55d78d);}(_0xc102,0x77));var _0x2c10=function(_0x407822,_0xcf252a){_0x407822=_0x407822-0x0;var _0xf17ef7=_0xc102[_0x407822];return _0xf17ef7;};'use strict';var _=require(_0x2c10('0x0'));var moment=require(_0x2c10('0x1'));var Redis=require(_0x2c10('0x2'));var util=require(_0x2c10('0x3'));var config=require(_0x2c10('0x4'));var db=require(_0x2c10('0x5'))['db'];var logger=require(_0x2c10('0x6'))('schedule');config[_0x2c10('0x7')]=_['defaults'](config[_0x2c10('0x7')],{'host':_0x2c10('0x8'),'port':0x18eb});var io=require(_0x2c10('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1930f3=[];return db[_0x2c10('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x2c10('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x2c10('0xc'))}}})[_0x2c10('0xd')](function(_0x765433){if(_0x765433&&_0x765433['length']){_0x1930f3=_['map'](_0x765433||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1930f3[_0x2c10('0xe')]());return db[_0x2c10('0xa')]['update']({'closeReason':_0x2c10('0xf'),'disposition':_0x2c10('0x10'),'closed':!![],'closedAt':moment()['format'](_0x2c10('0x11'))},{'where':{'id':_0x1930f3}});}})[_0x2c10('0xd')](function(){if(_0x1930f3&&_0x1930f3[_0x2c10('0x12')]){logger[_0x2c10('0x13')](_0x2c10('0x14'),_0x1930f3[_0x2c10('0xe')]());for(var _0x37bcfa=0x0;_0x37bcfa<_0x1930f3[_0x2c10('0x12')];_0x37bcfa++){io[_0x2c10('0x15')](_0x2c10('0x16'),{'id':_0x1930f3[_0x37bcfa],'closed':!![]});}}})[_0x2c10('0x17')](function(_0x2e45bb){logger['error'](_0x2c10('0x18'),_0x2e45bb?util[_0x2c10('0x19')](_0x2e45bb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8294=['WhatsappInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../logger','schedule','redis','socket.io-emitter','findAll','lastMsgAt','subtract','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x45081a,_0x3ae384){var _0x55bfe2=function(_0xdb8714){while(--_0xdb8714){_0x45081a['push'](_0x45081a['shift']());}};_0x55bfe2(++_0x3ae384);}(_0x8294,0x1c6));var _0x4829=function(_0x882464,_0x3c1c10){_0x882464=_0x882464-0x0;var _0x2da565=_0x8294[_0x882464];return _0x2da565;};'use strict';var _=require(_0x4829('0x0'));var moment=require(_0x4829('0x1'));var Redis=require('ioredis');var util=require(_0x4829('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x4829('0x3'))(_0x4829('0x4'));config[_0x4829('0x5')]=_['defaults'](config[_0x4829('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x4829('0x6'))(new Redis(config[_0x4829('0x5')]));function closeInteractions(){var _0x396b85=[];return db['WhatsappInteraction'][_0x4829('0x7')]({'raw':!![],'attributes':['id',_0x4829('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4829('0x9')](0x18,'hours')}}})[_0x4829('0xa')](function(_0x298b45){if(_0x298b45&&_0x298b45['length']){_0x396b85=_[_0x4829('0xb')](_0x298b45||[],'id');logger['info'](_0x4829('0xc'),_0x396b85[_0x4829('0xd')]());return db[_0x4829('0xe')][_0x4829('0xf')]({'closeReason':'system','disposition':_0x4829('0x10'),'closed':!![],'closedAt':moment()[_0x4829('0x11')](_0x4829('0x12'))},{'where':{'id':_0x396b85}});}})[_0x4829('0xa')](function(){if(_0x396b85&&_0x396b85[_0x4829('0x13')]){logger[_0x4829('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x396b85[_0x4829('0xd')]());for(var _0x2d6b30=0x0;_0x2d6b30<_0x396b85[_0x4829('0x13')];_0x2d6b30++){io[_0x4829('0x15')](_0x4829('0x16'),{'id':_0x396b85[_0x2d6b30],'closed':!![]});}}})[_0x4829('0x17')](function(_0x42cb28){logger['error'](_0x4829('0x18'),_0x42cb28?util['inspect'](_0x42cb28,{'showHidden':![],'depth':null}):'');});}exports[_0x4829('0x19')]=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 8ad157f..4c4cd81 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0e2=['push','Biondo','Innocenzo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','contacts2','hopper2','util','../mysqldb'];(function(_0x37f730,_0x129034){var _0x2b3253=function(_0x1b370a){while(--_0x1b370a){_0x37f730['push'](_0x37f730['shift']());}};_0x2b3253(++_0x129034);}(_0xf0e2,0x75));var _0x2f0e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xf0e2[_0x2080a3];return _0x8d7d17;};'use strict';var util=require(_0x2f0e('0x0'));var db=require(_0x2f0e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2f0e('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2f0e('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x2f0e('0x4')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2f0e('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2f0e('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2f0e('0x6')](),'updatedAt':Date[_0x2f0e('0x6')]()});}db[_0x2f0e('0x7')][_0x2f0e('0x8')]({'where':{}})[_0x2f0e('0x9')](function(){return db[_0x2f0e('0x7')][_0x2f0e('0xa')](contacts);})[_0x2f0e('0x9')](function(){console['log'](_0x2f0e('0xb'),_0x2f0e('0xc'));return db[_0x2f0e('0xd')][_0x2f0e('0x8')]({'where':{}});})[_0x2f0e('0x9')](function(){return db[_0x2f0e('0xd')]['bulkCreate'](hopper);})[_0x2f0e('0x9')](function(){console['log']('finished\x20populating','hopper1');return db[_0x2f0e('0x7')][_0x2f0e('0xa')](contacts2);})[_0x2f0e('0x9')](function(){console[_0x2f0e('0xe')](_0x2f0e('0xb'),_0x2f0e('0xf'));return db[_0x2f0e('0xd')][_0x2f0e('0xa')](hopper2);})['then'](function(){console[_0x2f0e('0xe')]('finished\x20populating',_0x2f0e('0x10'));})['catch'](function(_0x4639f7){console['log'](_0x4639f7);}); \ No newline at end of file +var _0x0d74=['finished\x20populating','contacts1','CmHopper','contacts2','hopper2','catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','bulkCreate','then','log'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d74,0x138));var _0x40d7=function(_0x2c2d49,_0x476b01){_0x2c2d49=_0x2c2d49-0x0;var _0x3db152=_0x0d74[_0x2c2d49];return _0x3db152;};'use strict';var util=require('util');var db=require(_0x40d7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x40d7('0x1')+i,'phone':0xf879fb460+i,'email':_0x40d7('0x2')+i+_0x40d7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x40d7('0x4')](),'updatedAt':Date[_0x40d7('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x40d7('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x40d7('0x1')+i,'phone':0xf879fb460+i,'email':_0x40d7('0x2')+i+_0x40d7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x40d7('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x40d7('0x4')](),'updatedAt':Date[_0x40d7('0x4')]()});}db[_0x40d7('0x6')][_0x40d7('0x7')]({'where':{}})['then'](function(){return db[_0x40d7('0x6')][_0x40d7('0x8')](contacts);})[_0x40d7('0x9')](function(){console[_0x40d7('0xa')](_0x40d7('0xb'),_0x40d7('0xc'));return db[_0x40d7('0xd')]['destroy']({'where':{}});})[_0x40d7('0x9')](function(){return db[_0x40d7('0xd')][_0x40d7('0x8')](hopper);})[_0x40d7('0x9')](function(){console[_0x40d7('0xa')](_0x40d7('0xb'),'hopper1');return db[_0x40d7('0x6')][_0x40d7('0x8')](contacts2);})[_0x40d7('0x9')](function(){console['log'](_0x40d7('0xb'),_0x40d7('0xe'));return db[_0x40d7('0xd')][_0x40d7('0x8')](hopper2);})[_0x40d7('0x9')](function(){console['log'](_0x40d7('0xb'),_0x40d7('0xf'));})[_0x40d7('0x10')](function(_0x40f141){console['log'](_0x40f141);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 232da90..025f8fc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x993c=['agent','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','util','%s%s','format'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x993c,0xc9));var _0xc993=function(_0x4082a8,_0x9b5705){_0x4082a8=_0x4082a8-0x0;var _0x41dc1e=_0x993c[_0x4082a8];return _0x41dc1e;};'use strict';var util=require(_0xc993('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xc993('0x1'),'agent',i),'fullname':util[_0xc993('0x2')]('%s%s','agent',i),'email':util[_0xc993('0x2')]('%s%s@xcally.com',_0xc993('0x3'),i),'role':_0xc993('0x3'),'password':_0xc993('0x4'),'internal':0xfa0+i,'type':_0xc993('0x5'),'transport':[_0xc993('0x6'),'ws','wss'],'disallow':[_0xc993('0x7')],'allow':['ulaw'],'defaultuser':util[_0xc993('0x2')](_0xc993('0x1'),_0xc993('0x3'),i),'encryption':_0xc993('0x8'),'avpf':_0xc993('0x8'),'force_avp':_0xc993('0x8'),'icesupport':_0xc993('0x8'),'dtlsenable':_0xc993('0x8'),'dtlsverify':'no','dtlscertfile':_0xc993('0x9'),'dtlsprivatekey':_0xc993('0xa'),'dtlssetup':_0xc993('0xb'),'callerid':util[_0xc993('0x2')](_0xc993('0xc'),util['format'](_0xc993('0x1'),_0xc993('0x3'),i),0xfa0+i)});}db[_0xc993('0xd')][_0xc993('0xe')](users)[_0xc993('0xf')](function(){console[_0xc993('0x10')]('add\x20user');})['catch'](function(_0x5c2517){console['log'](_0x5c2517);}); \ No newline at end of file +var _0x11d9=['\x22%s\x22\x20<%s>','User','then','log','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x34a91a,_0x537e54){var _0x15a752=function(_0x4011c4){while(--_0x4011c4){_0x34a91a['push'](_0x34a91a['shift']());}};_0x15a752(++_0x537e54);}(_0x11d9,0x158));var _0x911d=function(_0x1c09ba,_0x13f491){_0x1c09ba=_0x1c09ba-0x0;var _0x5aba8b=_0x11d9[_0x1c09ba];return _0x5aba8b;};'use strict';var util=require(_0x911d('0x0'));var db=require(_0x911d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x911d('0x2')]('%s%s',_0x911d('0x3'),i),'fullname':util['format'](_0x911d('0x4'),_0x911d('0x3'),i),'email':util['format'](_0x911d('0x5'),'agent',i),'role':_0x911d('0x3'),'password':_0x911d('0x6'),'internal':0xfa0+i,'type':_0x911d('0x7'),'transport':[_0x911d('0x8'),'ws','wss'],'disallow':[_0x911d('0x9')],'allow':[_0x911d('0xa')],'defaultuser':util['format']('%s%s',_0x911d('0x3'),i),'encryption':_0x911d('0xb'),'avpf':_0x911d('0xb'),'force_avp':_0x911d('0xb'),'icesupport':_0x911d('0xb'),'dtlsenable':_0x911d('0xb'),'dtlsverify':'no','dtlscertfile':_0x911d('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0x911d('0xd'),util[_0x911d('0x2')](_0x911d('0x4'),_0x911d('0x3'),i),0xfa0+i)});}db[_0x911d('0xe')]['bulkCreate'](users)[_0x911d('0xf')](function(){console['log']('add\x20user');})['catch'](function(_0x2032c5){console[_0x911d('0x10')](_0x2032c5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c643b79..476325b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eec=['lodash','util','bluebird','../mysqldb','name','Agents','role','agent','telephone','UserProfileSection','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','type','ivr','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','userProfileId','FaxQueue','OpenchannelQueues','OpenchannelQueue','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','CONNECTED'];(function(_0x30771b,_0x2803fc){var _0x407fc2=function(_0x58d63c){while(--_0x58d63c){_0x30771b['push'](_0x30771b['shift']());}};_0x407fc2(++_0x2803fc);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var BPromise=require(_0xc6ee('0x2'));var db=require(_0xc6ee('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc6ee('0x4')],'include':[{'as':_0xc6ee('0x5'),'model':db['User'],'attributes':['id',_0xc6ee('0x4'),_0xc6ee('0x6')],'raw':!![],'where':{'role':_0xc6ee('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc6ee('0x4')],'where':{'role':_0xc6ee('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc6ee('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc6ee('0x4')],'where':{'role':_0xc6ee('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc6ee('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0xfcd175,_0x2a4706,_0x4d6c8b){return db[_0xc6ee('0x9')]['findOne']({'where':{'name':_0xfcd175,'userProfileId':_0x2a4706},'raw':!![]})[_0xc6ee('0xa')](function(_0x2e999c){if(_0x2e999c){if(_0x2e999c[_0xc6ee('0xb')]){switch(_0xfcd175){case _0xc6ee('0xc'):case'ChatQueues':case _0xc6ee('0xd'):case _0xc6ee('0xe'):case _0xc6ee('0xf'):case'OpenchannelQueues':case _0xc6ee('0x10'):return db[_0x4d6c8b][_0xc6ee('0x11')](queryQueues);case _0xc6ee('0x12'):return db[_0x4d6c8b]['findAll'](queryTelephones);case _0xc6ee('0x13'):return db[_0x4d6c8b][_0xc6ee('0x11')](queryTrunks);case _0xc6ee('0x14'):return db[_0x4d6c8b]['findAll'](queryCampaigns);}}else{return db[_0xc6ee('0x15')][_0xc6ee('0x11')]({'attributes':[_0xc6ee('0x16')],'where':{'sectionId':_0x2e999c['id']},'raw':!![]})['then'](function(_0x43ef07){if(_0x43ef07){var _0x1db0ff={'where':{'id':_[_0xc6ee('0x17')](_0x43ef07,_0xc6ee('0x16'))},'raw':!![]};switch(_0x4d6c8b){case _0xc6ee('0x18'):_0x1db0ff[_0xc6ee('0x19')][_0xc6ee('0x6')]=_0xc6ee('0x8');break;case _0xc6ee('0x1a'):_0x1db0ff[_0xc6ee('0x19')][_0xc6ee('0x1b')]=_0xc6ee('0x1c');break;}return db[_0x4d6c8b][_0xc6ee('0x11')](_0x1db0ff);}else{return[];}});}}else{return[];}})[_0xc6ee('0xa')](function(_0x14d899){return _0x14d899;});}function joinOrLeaveQueues(_0x229013,_0x1997cd,_0x41e260,_0x31701c){_0x229013[_0x1997cd](util[_0xc6ee('0x1d')](_0xc6ee('0x1e'),_0x41e260,_0x31701c['name']));if(_0x31701c[_0xc6ee('0x5')]){for(var _0x48b15f=0x0;_0x48b15f<_0x31701c['Agents'][_0xc6ee('0x1f')];_0x48b15f+=0x1){_0x229013[_0x1997cd](util[_0xc6ee('0x1d')](_0xc6ee('0x20'),_0x31701c['Agents'][_0x48b15f][_0xc6ee('0x4')]));}}}function joinOrLeave(_0x5143dd,_0x37a3a7,_0x567cc2){var _0x41abd8;if(_0x5143dd[_0xc6ee('0x21')][_0xc6ee('0x22')]['id']){db[_0xc6ee('0x18')][_0xc6ee('0x23')]({'attributes':['id',_0xc6ee('0x4'),'role','userProfileId'],'where':{'id':_0x5143dd[_0xc6ee('0x21')][_0xc6ee('0x22')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xc6ee('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xc6ee('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6ee('0x26')],'as':_0xc6ee('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc6ee('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6ee('0x29')],'as':_0xc6ee('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xc6ee('0x2b')],'as':_0xc6ee('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xc6ee('0xa')](function(_0xd53630){if(_0xd53630){_0x41abd8=_0xd53630;_0x5143dd[_0x37a3a7](util['format'](_0xc6ee('0x20'),_0xd53630['name']));var _0x20efe3=[];switch(_0xd53630[_0xc6ee('0x6')]){case _0xc6ee('0x2d'):_0x5143dd[_0x37a3a7](_0xc6ee('0x2e'));_0x5143dd[_0x37a3a7](_0xc6ee('0x2f'));if(queryQueues['hasOwnProperty'](_0xc6ee('0x30'))){delete queryQueues['include'];}_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x32')][_0xc6ee('0x11')](queryQueues));_0x20efe3[_0xc6ee('0x31')](db['ChatQueue'][_0xc6ee('0x11')](queryQueues));_0x20efe3[_0xc6ee('0x31')](db['FaxQueue'][_0xc6ee('0x11')](queryQueues));_0x20efe3['push'](db[_0xc6ee('0x33')][_0xc6ee('0x11')](queryQueues));_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x34')][_0xc6ee('0x11')](queryQueues));_0x20efe3['push'](db['OpenchannelQueue'][_0xc6ee('0x11')](queryQueues));_0x20efe3['push'](db[_0xc6ee('0x35')][_0xc6ee('0x11')](queryQueues));_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x18')][_0xc6ee('0x11')](queryTelephones));_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x36')][_0xc6ee('0x11')](queryTrunks));_0x20efe3['push'](db['Campaign'][_0xc6ee('0x11')](queryCampaigns));_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x18')][_0xc6ee('0x11')](queryAgents));break;case'user':_0x5143dd[_0x37a3a7](_0xc6ee('0x2e'));_0x5143dd[_0x37a3a7](_0xc6ee('0x2f'));_0x20efe3[_0xc6ee('0x31')](getAssociatedResources(_0xc6ee('0xc'),_0xd53630[_0xc6ee('0x37')],_0xc6ee('0x32')));_0x20efe3['push'](getAssociatedResources('ChatQueues',_0xd53630[_0xc6ee('0x37')],'ChatQueue'));_0x20efe3['push'](getAssociatedResources(_0xc6ee('0xd'),_0xd53630[_0xc6ee('0x37')],_0xc6ee('0x38')));_0x20efe3[_0xc6ee('0x31')](getAssociatedResources('SmsQueues',_0xd53630[_0xc6ee('0x37')],_0xc6ee('0x33')));_0x20efe3[_0xc6ee('0x31')](getAssociatedResources(_0xc6ee('0xf'),_0xd53630[_0xc6ee('0x37')],_0xc6ee('0x34')));_0x20efe3['push'](getAssociatedResources(_0xc6ee('0x39'),_0xd53630[_0xc6ee('0x37')],_0xc6ee('0x3a')));_0x20efe3[_0xc6ee('0x31')](getAssociatedResources('WhatsappQueues',_0xd53630[_0xc6ee('0x37')],'WhatsappQueue'));_0x20efe3[_0xc6ee('0x31')](getAssociatedResources(_0xc6ee('0x12'),_0xd53630['userProfileId'],'User'));_0x20efe3['push'](getAssociatedResources(_0xc6ee('0x13'),_0xd53630[_0xc6ee('0x37')],'Trunk'));_0x20efe3['push'](getAssociatedResources('IvrCampaigns',_0xd53630['userProfileId'],'Campaign'));_0x20efe3[_0xc6ee('0x31')](db[_0xc6ee('0x18')][_0xc6ee('0x11')](queryAgents));break;case'agent':_0x5143dd[_0x37a3a7]('voice:inbound');_0x5143dd[_0x37a3a7]('voice:outbound');_0x20efe3['push'](_0xd53630['getVoiceQueues']({'attributes':['id','name']}));_0x20efe3['push'](_0xd53630[_0xc6ee('0x3b')]({'attributes':['id',_0xc6ee('0x4')]}));_0x20efe3['push'](_0xd53630[_0xc6ee('0x3c')]({'attributes':['id',_0xc6ee('0x4')]}));_0x20efe3[_0xc6ee('0x31')](_0xd53630[_0xc6ee('0x3d')]({'attributes':['id',_0xc6ee('0x4')]}));_0x20efe3[_0xc6ee('0x31')](_0xd53630['getMailQueues']({'attributes':['id',_0xc6ee('0x4')]}));_0x20efe3[_0xc6ee('0x31')](_0xd53630['getOpenchannelQueues']({'attributes':['id','name']}));_0x20efe3[_0xc6ee('0x31')](_0xd53630[_0xc6ee('0x3e')]({'attributes':['id',_0xc6ee('0x4')]}));break;}return BPromise[_0xc6ee('0x3f')](_0x20efe3);}})[_0xc6ee('0xa')](function(_0x38cb59){if(_0x38cb59&&_0x38cb59['length']){for(var _0x1f0da1=0x0;_0x1f0da1<_0x38cb59[_0xc6ee('0x1f')];_0x1f0da1+=0x1){for(var _0x27b961=0x0;_0x27b961<_0x38cb59[_0x1f0da1]['length'];_0x27b961+=0x1){switch(_0x1f0da1){case 0x0:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x40'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x1:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,'chat',_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x2:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x41'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x3:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x42'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x4:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x43'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x5:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x44'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x6:joinOrLeaveQueues(_0x5143dd,_0x37a3a7,_0xc6ee('0x45'),_0x38cb59[_0x1f0da1][_0x27b961]);break;case 0x7:if(_0x41abd8[_0xc6ee('0x6')]!==_0xc6ee('0x7'))_0x5143dd[_0x37a3a7](util[_0xc6ee('0x1d')]('telephone:%s',_0x38cb59[_0x1f0da1][_0x27b961]['name']));break;case 0x8:if(_0x41abd8[_0xc6ee('0x6')]!==_0xc6ee('0x7'))_0x5143dd[_0x37a3a7](util[_0xc6ee('0x1d')](_0xc6ee('0x46'),_0x38cb59[_0x1f0da1][_0x27b961]['name']));break;case 0x9:if(_0x41abd8['role']!=='agent')_0x5143dd[_0x37a3a7](util[_0xc6ee('0x1d')](_0xc6ee('0x47'),_0x38cb59[_0x1f0da1][_0x27b961]['type'],_0x38cb59[_0x1f0da1][_0x27b961]['name']));break;case 0xa:_0x5143dd[_0x37a3a7](util['format'](_0xc6ee('0x20'),_0x38cb59[_0x1f0da1][_0x27b961]['name']));break;}}}}})[_0xc6ee('0xa')](function(){if(_0x37a3a7===_0xc6ee('0x48')){var _0x544c33=_['map'](_0x41abd8['ChatInteractions'],'id');return _0x41abd8[_0xc6ee('0x49')](_0x544c33)[_0xc6ee('0xa')](function(){for(var _0x57ac9c=0x0;_0x57ac9c<_0x544c33['length'];_0x57ac9c+=0x1){_0x567cc2[_0xc6ee('0x4a')](_0xc6ee('0x4b'),{'ChatInteractionId':Number(_0x544c33[_0x57ac9c]),'UserId':Number(_0x41abd8['id'])});}});}})[_0xc6ee('0xa')](function(){if(_0x37a3a7==='leave'){var _0x3051c2=_['map'](_0x41abd8[_0xc6ee('0x25')],'id');return _0x41abd8[_0xc6ee('0x4c')](_0x3051c2)[_0xc6ee('0xa')](function(){for(var _0x26feb2=0x0;_0x26feb2<_0x3051c2['length'];_0x26feb2+=0x1){_0x567cc2[_0xc6ee('0x4a')](_0xc6ee('0x4d'),{'MailInteractionId':Number(_0x3051c2[_0x26feb2]),'UserId':Number(_0x41abd8['id'])});}});}})[_0xc6ee('0xa')](function(){if(_0x37a3a7===_0xc6ee('0x48')){var _0x41a2c5=_['map'](_0x41abd8['FaxInteractions'],'id');return _0x41abd8[_0xc6ee('0x4e')](_0x41a2c5)[_0xc6ee('0xa')](function(){for(var _0x1a2dd5=0x0;_0x1a2dd5<_0x41a2c5[_0xc6ee('0x1f')];_0x1a2dd5+=0x1){_0x567cc2[_0xc6ee('0x4a')](_0xc6ee('0x4f'),{'FaxInteractionId':Number(_0x41a2c5[_0x1a2dd5]),'UserId':Number(_0x41abd8['id'])});}});}})[_0xc6ee('0xa')](function(){if(_0x37a3a7===_0xc6ee('0x48')){var _0x1c82da=_[_0xc6ee('0x17')](_0x41abd8['SmsInteractions'],'id');return _0x41abd8[_0xc6ee('0x50')](_0x1c82da)[_0xc6ee('0xa')](function(){for(var _0x544dfb=0x0;_0x544dfb<_0x1c82da['length'];_0x544dfb+=0x1){_0x567cc2[_0xc6ee('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1c82da[_0x544dfb]),'UserId':Number(_0x41abd8['id'])});}});}})['then'](function(){if(_0x37a3a7===_0xc6ee('0x48')){var _0x3af45a=_[_0xc6ee('0x17')](_0x41abd8['OpenchannelInteractions'],'id');return _0x41abd8[_0xc6ee('0x51')](_0x3af45a)[_0xc6ee('0xa')](function(){for(var _0x5853e5=0x0;_0x5853e5<_0x3af45a[_0xc6ee('0x1f')];_0x5853e5+=0x1){_0x567cc2['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3af45a[_0x5853e5]),'UserId':Number(_0x41abd8['id'])});}});}})['then'](function(){if(_0x37a3a7===_0xc6ee('0x48')){var _0x3e4a60=_[_0xc6ee('0x17')](_0x41abd8[_0xc6ee('0x2c')],'id');return _0x41abd8[_0xc6ee('0x52')](_0x3e4a60)[_0xc6ee('0xa')](function(){for(var _0x290f33=0x0;_0x290f33<_0x3e4a60['length'];_0x290f33+=0x1){_0x567cc2[_0xc6ee('0x4a')](_0xc6ee('0x53'),{'WhatsappInteractionId':Number(_0x3e4a60[_0x290f33]),'UserId':Number(_0x41abd8['id'])});}});}})['catch'](function(_0x2cd6c6){_0x5143dd[_0xc6ee('0x54')](_0x2cd6c6);});}}function onDisconnect(_0x306a02,_0x192ee5){joinOrLeave(_0x306a02,_0xc6ee('0x48'),_0x192ee5);}function onConnect(_0x33b4b7){joinOrLeave(_0x33b4b7,_0xc6ee('0x55'));}exports[_0xc6ee('0x56')]=function(_0x5afa7e){_0x5afa7e['on'](_0xc6ee('0x57'),function(_0x226738){_0x226738[_0xc6ee('0x58')](0x0);_0x226738[_0xc6ee('0x59')]=_0x226738[_0xc6ee('0x5a')][_0xc6ee('0x57')][_0xc6ee('0x5b')]+':'+_0x226738[_0xc6ee('0x5a')][_0xc6ee('0x57')][_0xc6ee('0x5c')];_0x226738['connectedAt']=new Date();_0x226738[_0xc6ee('0x54')]=function(_0x12f258){console[_0xc6ee('0x54')](_0xc6ee('0x5d')+_0x226738[_0xc6ee('0x5e')]['name']+'['+_0x226738[_0xc6ee('0x59')]+']',_0x12f258);};_0x226738['on']('disconnect',function(){onDisconnect(_0x226738,_0x5afa7e);_0x226738['log']('DISCONNECTED');});onConnect(_0x226738);_0x226738[_0xc6ee('0x54')](_0xc6ee('0x5f'));});}; \ No newline at end of file +var _0x85e6=['SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','%s:queue:%s','format','handshake','find','userProfileId','query','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueue','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','join','default','connection','address','request','connectedAt','log'];(function(_0x14076d,_0x5b9e61){var _0x524616=function(_0x15dcf7){while(--_0x15dcf7){_0x14076d['push'](_0x14076d['shift']());}};_0x524616(++_0x5b9e61);}(_0x85e6,0x1a5));var _0x685e=function(_0x27c5ec,_0x4e6925){_0x27c5ec=_0x27c5ec-0x0;var _0x2bafc5=_0x85e6[_0x27c5ec];return _0x2bafc5;};'use strict';var _=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var BPromise=require('bluebird');var db=require(_0x685e('0x2'))['db'];var config=require(_0x685e('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x685e('0x4'),'model':db[_0x685e('0x5')],'attributes':['id',_0x685e('0x6'),'role'],'raw':!![],'where':{'role':_0x685e('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x685e('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x685e('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x685e('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x685e('0x6'),_0x685e('0x9')],'where':{'type':_0x685e('0xa')}};function getAssociatedResources(_0x41b38f,_0x3804ae,_0x53c03f){return db[_0x685e('0xb')]['findOne']({'where':{'name':_0x41b38f,'userProfileId':_0x3804ae},'raw':!![]})[_0x685e('0xc')](function(_0x4c0df1){if(_0x4c0df1){if(_0x4c0df1[_0x685e('0xd')]){switch(_0x41b38f){case _0x685e('0xe'):case _0x685e('0xf'):case _0x685e('0x10'):case _0x685e('0x11'):case _0x685e('0x12'):case _0x685e('0x13'):case _0x685e('0x14'):return db[_0x53c03f][_0x685e('0x15')](queryQueues);case _0x685e('0x16'):return db[_0x53c03f][_0x685e('0x15')](queryTelephones);case _0x685e('0x17'):return db[_0x53c03f][_0x685e('0x15')](queryTrunks);case _0x685e('0x18'):return db[_0x53c03f][_0x685e('0x15')](queryCampaigns);}}else{return db[_0x685e('0x19')]['findAll']({'attributes':[_0x685e('0x1a')],'where':{'sectionId':_0x4c0df1['id']},'raw':!![]})[_0x685e('0xc')](function(_0x250e6d){if(_0x250e6d){var _0x3e2a13={'where':{'id':_[_0x685e('0x1b')](_0x250e6d,'resourceId')},'raw':!![]};switch(_0x53c03f){case _0x685e('0x5'):_0x3e2a13[_0x685e('0x1c')][_0x685e('0x1d')]=_0x685e('0x8');break;case _0x685e('0x1e'):_0x3e2a13[_0x685e('0x1c')]['type']=_0x685e('0xa');break;}return db[_0x53c03f]['findAll'](_0x3e2a13);}else{return[];}});}}else{return[];}})['then'](function(_0x472c77){return _0x472c77;});}function joinOrLeaveQueues(_0x329525,_0x25e5f3,_0xfe5bf9,_0x241670){_0x329525[_0x25e5f3](util['format'](_0x685e('0x1f'),_0xfe5bf9,_0x241670[_0x685e('0x6')]));if(_0x241670[_0x685e('0x4')]){for(var _0x5a54a6=0x0;_0x5a54a6<_0x241670[_0x685e('0x4')]['length'];_0x5a54a6+=0x1){_0x329525[_0x25e5f3](util[_0x685e('0x20')]('user:%s',_0x241670[_0x685e('0x4')][_0x5a54a6][_0x685e('0x6')]));}}}function joinOrLeave(_0x5f2cf1,_0x33eb9b,_0x811b81){var _0x3f55a6;if(_0x5f2cf1[_0x685e('0x21')]['query']['id']){db[_0x685e('0x5')][_0x685e('0x22')]({'attributes':['id',_0x685e('0x6'),_0x685e('0x1d'),_0x685e('0x23')],'where':{'id':_0x5f2cf1[_0x685e('0x21')][_0x685e('0x24')]['id']},'include':[{'model':db[_0x685e('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x685e('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x685e('0x27')],'as':_0x685e('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x685e('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x685e('0x2a')],'as':_0x685e('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x685e('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x685e('0xc')](function(_0x10bf0f){if(_0x10bf0f){_0x3f55a6=_0x10bf0f;_0x5f2cf1[_0x33eb9b](util[_0x685e('0x20')](_0x685e('0x2d'),_0x10bf0f['name']));var _0x1b6bd7=[];switch(_0x10bf0f[_0x685e('0x1d')]){case _0x685e('0x2e'):_0x5f2cf1[_0x33eb9b](_0x685e('0x2f'));_0x5f2cf1[_0x33eb9b]('voice:outbound');if(queryQueues[_0x685e('0x30')](_0x685e('0x31'))){delete queryQueues['include'];}_0x1b6bd7[_0x685e('0x32')](db[_0x685e('0x33')][_0x685e('0x15')](queryQueues));_0x1b6bd7['push'](db[_0x685e('0x34')][_0x685e('0x15')](queryQueues));_0x1b6bd7[_0x685e('0x32')](db[_0x685e('0x35')][_0x685e('0x15')](queryQueues));_0x1b6bd7['push'](db[_0x685e('0x36')][_0x685e('0x15')](queryQueues));_0x1b6bd7[_0x685e('0x32')](db['MailQueue'][_0x685e('0x15')](queryQueues));_0x1b6bd7['push'](db[_0x685e('0x37')][_0x685e('0x15')](queryQueues));_0x1b6bd7[_0x685e('0x32')](db[_0x685e('0x38')][_0x685e('0x15')](queryQueues));_0x1b6bd7['push'](db[_0x685e('0x5')][_0x685e('0x15')](queryTelephones));_0x1b6bd7['push'](db[_0x685e('0x39')]['findAll'](queryTrunks));_0x1b6bd7[_0x685e('0x32')](db['Campaign'][_0x685e('0x15')](queryCampaigns));_0x1b6bd7[_0x685e('0x32')](db['User']['findAll'](queryAgents));break;case _0x685e('0x3a'):_0x5f2cf1[_0x33eb9b](_0x685e('0x2f'));_0x5f2cf1[_0x33eb9b]('voice:outbound');_0x1b6bd7['push'](getAssociatedResources(_0x685e('0xe'),_0x10bf0f[_0x685e('0x23')],'VoiceQueue'));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0xf'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x34')));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0x10'),_0x10bf0f[_0x685e('0x23')],'FaxQueue'));_0x1b6bd7['push'](getAssociatedResources(_0x685e('0x11'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x36')));_0x1b6bd7['push'](getAssociatedResources(_0x685e('0x12'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x3b')));_0x1b6bd7['push'](getAssociatedResources(_0x685e('0x13'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x37')));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0x14'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x38')));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0x16'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x5')));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0x17'),_0x10bf0f['userProfileId'],_0x685e('0x39')));_0x1b6bd7[_0x685e('0x32')](getAssociatedResources(_0x685e('0x18'),_0x10bf0f[_0x685e('0x23')],_0x685e('0x1e')));_0x1b6bd7[_0x685e('0x32')](db['User']['findAll'](queryAgents));break;case'agent':_0x5f2cf1[_0x33eb9b]('voice:inbound');_0x5f2cf1[_0x33eb9b](_0x685e('0x3c'));_0x1b6bd7['push'](_0x10bf0f[_0x685e('0x3d')]({'attributes':['id',_0x685e('0x6')]}));_0x1b6bd7[_0x685e('0x32')](_0x10bf0f[_0x685e('0x3e')]({'attributes':['id',_0x685e('0x6')]}));_0x1b6bd7[_0x685e('0x32')](_0x10bf0f[_0x685e('0x3f')]({'attributes':['id',_0x685e('0x6')]}));_0x1b6bd7[_0x685e('0x32')](_0x10bf0f['getSmsQueues']({'attributes':['id',_0x685e('0x6')]}));_0x1b6bd7['push'](_0x10bf0f[_0x685e('0x40')]({'attributes':['id',_0x685e('0x6')]}));_0x1b6bd7['push'](_0x10bf0f['getOpenchannelQueues']({'attributes':['id','name']}));_0x1b6bd7[_0x685e('0x32')](_0x10bf0f[_0x685e('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x685e('0x42')](_0x1b6bd7);}})[_0x685e('0xc')](function(_0x589904){if(_0x589904&&_0x589904['length']){for(var _0x304915=0x0;_0x304915<_0x589904[_0x685e('0x43')];_0x304915+=0x1){for(var _0x4319a8=0x0;_0x4319a8<_0x589904[_0x304915]['length'];_0x4319a8+=0x1){switch(_0x304915){case 0x0:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x44'),_0x589904[_0x304915][_0x4319a8]);break;case 0x1:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x45'),_0x589904[_0x304915][_0x4319a8]);break;case 0x2:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x46'),_0x589904[_0x304915][_0x4319a8]);break;case 0x3:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x47'),_0x589904[_0x304915][_0x4319a8]);break;case 0x4:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,'mail',_0x589904[_0x304915][_0x4319a8]);break;case 0x5:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x48'),_0x589904[_0x304915][_0x4319a8]);break;case 0x6:joinOrLeaveQueues(_0x5f2cf1,_0x33eb9b,_0x685e('0x49'),_0x589904[_0x304915][_0x4319a8]);break;case 0x7:if(_0x3f55a6[_0x685e('0x1d')]!==_0x685e('0x7'))_0x5f2cf1[_0x33eb9b](util['format'](_0x685e('0x4a'),_0x589904[_0x304915][_0x4319a8][_0x685e('0x6')]));break;case 0x8:if(_0x3f55a6[_0x685e('0x1d')]!==_0x685e('0x7'))_0x5f2cf1[_0x33eb9b](util[_0x685e('0x20')](_0x685e('0x4b'),_0x589904[_0x304915][_0x4319a8][_0x685e('0x6')]));break;case 0x9:if(_0x3f55a6['role']!==_0x685e('0x7'))_0x5f2cf1[_0x33eb9b](util[_0x685e('0x20')](_0x685e('0x4c'),_0x589904[_0x304915][_0x4319a8][_0x685e('0x9')],_0x589904[_0x304915][_0x4319a8][_0x685e('0x6')]));break;case 0xa:_0x5f2cf1[_0x33eb9b](util['format'](_0x685e('0x2d'),_0x589904[_0x304915][_0x4319a8]['name']));break;}}}}})[_0x685e('0xc')](function(){if(_0x33eb9b===_0x685e('0x4d')){var _0xf1a095=_['map'](_0x3f55a6[_0x685e('0x4e')],'id');return _0x3f55a6[_0x685e('0x4f')](_0xf1a095)[_0x685e('0xc')](function(){for(var _0x2c1257=0x0;_0x2c1257<_0xf1a095[_0x685e('0x43')];_0x2c1257+=0x1){_0x811b81[_0x685e('0x50')](_0x685e('0x51'),{'ChatInteractionId':Number(_0xf1a095[_0x2c1257]),'UserId':Number(_0x3f55a6['id'])});}});}})[_0x685e('0xc')](function(){if(_0x33eb9b===_0x685e('0x4d')){var _0x4aa215=_[_0x685e('0x1b')](_0x3f55a6[_0x685e('0x26')],'id');return _0x3f55a6[_0x685e('0x52')](_0x4aa215)[_0x685e('0xc')](function(){for(var _0xdc93c5=0x0;_0xdc93c5<_0x4aa215['length'];_0xdc93c5+=0x1){_0x811b81[_0x685e('0x50')](_0x685e('0x53'),{'MailInteractionId':Number(_0x4aa215[_0xdc93c5]),'UserId':Number(_0x3f55a6['id'])});}});}})[_0x685e('0xc')](function(){if(_0x33eb9b===_0x685e('0x4d')){var _0x2fb953=_[_0x685e('0x1b')](_0x3f55a6['FaxInteractions'],'id');return _0x3f55a6[_0x685e('0x54')](_0x2fb953)[_0x685e('0xc')](function(){for(var _0x24c62a=0x0;_0x24c62a<_0x2fb953[_0x685e('0x43')];_0x24c62a+=0x1){_0x811b81[_0x685e('0x50')](_0x685e('0x55'),{'FaxInteractionId':Number(_0x2fb953[_0x24c62a]),'UserId':Number(_0x3f55a6['id'])});}});}})['then'](function(){if(_0x33eb9b==='leave'){var _0x19a854=_[_0x685e('0x1b')](_0x3f55a6[_0x685e('0x56')],'id');return _0x3f55a6[_0x685e('0x57')](_0x19a854)[_0x685e('0xc')](function(){for(var _0x2b6361=0x0;_0x2b6361<_0x19a854[_0x685e('0x43')];_0x2b6361+=0x1){_0x811b81['emit'](_0x685e('0x58'),{'SmsInteractionId':Number(_0x19a854[_0x2b6361]),'UserId':Number(_0x3f55a6['id'])});}});}})[_0x685e('0xc')](function(){if(_0x33eb9b===_0x685e('0x4d')){var _0x5c6c76=_['map'](_0x3f55a6[_0x685e('0x2b')],'id');return _0x3f55a6['removeOpenchannelInteractions'](_0x5c6c76)['then'](function(){for(var _0x20953e=0x0;_0x20953e<_0x5c6c76[_0x685e('0x43')];_0x20953e+=0x1){_0x811b81[_0x685e('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5c6c76[_0x20953e]),'UserId':Number(_0x3f55a6['id'])});}});}})[_0x685e('0xc')](function(){if(_0x33eb9b==='leave'){var _0x33c7b0=_[_0x685e('0x1b')](_0x3f55a6[_0x685e('0x59')],'id');return _0x3f55a6[_0x685e('0x5a')](_0x33c7b0)[_0x685e('0xc')](function(){for(var _0x3e67d3=0x0;_0x3e67d3<_0x33c7b0[_0x685e('0x43')];_0x3e67d3+=0x1){_0x811b81[_0x685e('0x50')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x33c7b0[_0x3e67d3]),'UserId':Number(_0x3f55a6['id'])});}});}})[_0x685e('0x5b')](function(_0x4f78d2){_0x5f2cf1['log'](_0x4f78d2);});}}function onDisconnect(_0x3d139f,_0x277782){joinOrLeave(_0x3d139f,_0x685e('0x4d'),_0x277782);}function onConnect(_0x8fe751){joinOrLeave(_0x8fe751,_0x685e('0x5c'));}exports[_0x685e('0x5d')]=function(_0x6e7c27){_0x6e7c27['on'](_0x685e('0x5e'),function(_0x4fd5bc){_0x4fd5bc['setMaxListeners'](0x0);_0x4fd5bc[_0x685e('0x5f')]=_0x4fd5bc[_0x685e('0x60')][_0x685e('0x5e')]['remoteAddress']+':'+_0x4fd5bc['request'][_0x685e('0x5e')]['remotePort'];_0x4fd5bc[_0x685e('0x61')]=new Date();_0x4fd5bc[_0x685e('0x62')]=function(_0x41b58c){console[_0x685e('0x62')](_0x685e('0x63')+_0x4fd5bc[_0x685e('0x64')]['name']+'['+_0x4fd5bc[_0x685e('0x5f')]+']',_0x41b58c);};_0x4fd5bc['on'](_0x685e('0x65'),function(){onDisconnect(_0x4fd5bc,_0x6e7c27);_0x4fd5bc[_0x685e('0x62')](_0x685e('0x66'));});onConnect(_0x4fd5bc);_0x4fd5bc[_0x685e('0x62')](_0x685e('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 68ea539..7c8267e 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 _0x719e=['name','AfterCreate','changed','closed','substatus','AfterUpdate','User','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','../logger','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','error','code','EventManager','catch','get','channel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','then','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','event','offlineMessage','opened','Sequelize'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x719e,0x188));var _0xe719=function(_0x2bdecd,_0x21805f){_0x2bdecd=_0x2bdecd-0x0;var _0x56116e=_0x719e[_0x2bdecd];return _0x56116e;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0xe719('0x0'))('triggers');var client=jayson[_0xe719('0x1')][_0xe719('0x2')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xe719('0x3'),'event':_0xe719('0x4'),'condition':_0xe719('0x5'),'callback':afterCreate},{'channel':_0xe719('0x6'),'model':_0xe719('0x3'),'event':_0xe719('0x7'),'condition':_0xe719('0x8'),'callback':afterUpdate},{'channel':'Chat','model':_0xe719('0x9'),'event':_0xe719('0x4'),'condition':_0xe719('0xa'),'callback':afterCreateMessage},{'channel':_0xe719('0x6'),'model':_0xe719('0xb'),'event':_0xe719('0x4'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xe719('0xc'),'event':_0xe719('0x4'),'condition':_0xe719('0x5'),'callback':afterCreate},{'channel':_0xe719('0xd'),'model':'SmsInteraction','event':'afterUpdate','condition':_0xe719('0x8'),'callback':afterUpdate},{'channel':_0xe719('0xd'),'model':_0xe719('0xe'),'event':'afterCreate','condition':_0xe719('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xe719('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xe719('0x10'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0xe719('0x8'),'callback':afterUpdate},{'channel':_0xe719('0x10'),'model':_0xe719('0x11'),'event':_0xe719('0x4'),'condition':_0xe719('0xa'),'callback':afterCreateMessage},{'channel':_0xe719('0x12'),'model':_0xe719('0x13'),'event':_0xe719('0x4'),'condition':_0xe719('0x5'),'callback':afterCreate},{'channel':'Fax','model':_0xe719('0x13'),'event':_0xe719('0x7'),'condition':_0xe719('0x8'),'callback':afterUpdate},{'channel':_0xe719('0x12'),'model':_0xe719('0x14'),'event':_0xe719('0x4'),'condition':_0xe719('0xa'),'callback':afterCreateMessage},{'channel':_0xe719('0x15'),'model':'MailInteraction','event':_0xe719('0x4'),'condition':_0xe719('0x5'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xe719('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe719('0x15'),'model':_0xe719('0x16'),'event':'afterCreate','condition':_0xe719('0xa'),'callback':afterCreateMessage},{'channel':_0xe719('0x17'),'model':'OpenchannelInteraction','event':_0xe719('0x4'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xe719('0x17'),'model':'OpenchannelInteraction','event':_0xe719('0x7'),'condition':_0xe719('0x8'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xe719('0x18'),'event':_0xe719('0x4'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x4f8936){return client[_0xe719('0x19')]('EventManager',_0x4f8936)['then'](function(_0x3faa79){logger[_0xe719('0x1a')](_0xe719('0x1b'),'EventManager',_0x3faa79);if(_0x3faa79[_0xe719('0x1c')]){if(_0x3faa79['error'][_0xe719('0x1d')]===0x1f4){logger['error'](_0xe719('0x1b'),_0xe719('0x1e'),_0x3faa79[_0xe719('0x1c')]);}}})[_0xe719('0x1f')](function(_0xb603a3){logger[_0xe719('0x1c')](_0xe719('0x1b'),_0xe719('0x1e'),_0xb603a3);});}function afterCreateMessage(_0x56ad24){return function(_0x2a6b4b){_0x2a6b4b=_0x2a6b4b[_0xe719('0x20')]({'plain':!![]});_0x2a6b4b[_0xe719('0x21')]=_0x56ad24;_0x2a6b4b['motionChannel']=_0x56ad24;_0x2a6b4b['event']=_0x2a6b4b[_0xe719('0x22')];Promise[_0xe719('0x23')]()['then'](function(){if(typeof _0x2a6b4b[_0xe719('0x24')]===_0xe719('0x25'))return null;var _0x12e801=_0xe719('0x26')+_0x2a6b4b[_0xe719('0x24')];return db[_0xe719('0x27')][_0xe719('0x28')](_0x12e801,{'type':db['Sequelize'][_0xe719('0x29')][_0xe719('0x2a')],'raw':!![]});})[_0xe719('0x2b')](function(_0x5d182c){if(_0x5d182c){_0x2a6b4b[_0xe719('0x2c')]=_0x5d182c[0x0];}if(typeof _0x2a6b4b[_0xe719('0x2d')]==='undefined')return;return getAgent(_0x2a6b4b[_0xe719('0x2d')]);})['then'](function(_0x2e41e2){if(_0x2e41e2){_0x2a6b4b[_0xe719('0x2e')]=util[_0xe719('0x2f')](_0xe719('0x30'),_0x2e41e2['name']);_0x2a6b4b[_0xe719('0x31')]=_0x2e41e2;_0x2a6b4b[_0xe719('0x21')]=_0x56ad24;return request({'event':_0xe719('0x32'),'message':_0x2a6b4b});}else{return request({'event':_0xe719('0x33'),'message':_0x2a6b4b});}})[_0xe719('0x1f')](function(_0x4eea51){logger['error'](_0xe719('0x1b'),_0xe719('0x34'),_0x4eea51);});};}function afterCreateOfflineMessage(_0x1dd7a6){return function(_0x1b1a46){_0x1b1a46=_0x1b1a46['get']({'plain':!![]});_0x1b1a46[_0xe719('0x21')]=_0x1dd7a6;_0x1b1a46[_0xe719('0x35')]=_0x1dd7a6;_0x1b1a46[_0xe719('0x36')]=_0xe719('0x37');return request({'event':_0x1b1a46['event'],'message':_0x1b1a46});};}function afterCreate(_0x4d0481,_0x279e90){return function(_0xbfb954){_0xbfb954=_0xbfb954['get']({'plain':!![]});_0xbfb954['channel']=_0x4d0481;_0xbfb954[_0xe719('0x35')]=_0x4d0481;_0xbfb954[_0xe719('0x36')]=_0xe719('0x38');Promise[_0xe719('0x23')]()[_0xe719('0x2b')](function(){var _0xb4b863=_0xe719('0x26')+_0xbfb954[_0xe719('0x24')];return db[_0xe719('0x27')][_0xe719('0x28')](_0xb4b863,{'type':db[_0xe719('0x39')][_0xe719('0x29')]['SELECT'],'raw':!![]});})[_0xe719('0x2b')](function(_0x5e4702){if(_0x5e4702){_0xbfb954[_0xe719('0x2c')]=_0x5e4702[0x0];}if(typeof _0xbfb954['UserId']===_0xe719('0x25'))return;return getAgent(_0xbfb954[_0xe719('0x2d')]);})['then'](function(_0x5af868){if(_0x5af868){_0xbfb954[_0xe719('0x2e')]=util[_0xe719('0x2f')](_0xe719('0x30'),_0x5af868[_0xe719('0x3a')]);_0xbfb954[_0xe719('0x31')]=_0x5af868;}return request({'event':_0x279e90,'message':_0xbfb954});})[_0xe719('0x1f')](function(_0x5d2074){logger[_0xe719('0x1c')](_0xe719('0x1b'),_0xe719('0x3b'),_0x5d2074);});};}function afterUpdate(_0x42dae6){return function(_0x42d289){var _0x27711b=_0x42d289[_0xe719('0x3c')](_0xe719('0x3d'))&&_0x42d289[_0xe719('0x3d')];var _0x2207d2=_0x42d289[_0xe719('0x3c')](_0xe719('0x3e'));if(_0x27711b||_0x2207d2){var _0x165d9f=_0x27711b?_0xe719('0x8'):_0xe719('0x3e');var _0x2de53e=_0x42d289['get']({'plain':!![]});_0x2de53e['channel']=_0x42dae6;_0x2de53e['motionChannel']=_0x42dae6;_0x2de53e['event']=_0x27711b?_0xe719('0x3d'):_0xe719('0x3e');var _0x297b87=_0xe719('0x26')+_0x2de53e[_0xe719('0x24')];return db[_0xe719('0x27')][_0xe719('0x28')](_0x297b87,{'type':db[_0xe719('0x39')][_0xe719('0x29')]['SELECT'],'raw':!![]})[_0xe719('0x2b')](function(_0x18b8d6){if(_0x18b8d6){_0x2de53e[_0xe719('0x2c')]=_0x18b8d6[0x0];}if(typeof _0x2de53e['UserId']==='undefined')return;return getAgent(_0x2de53e[_0xe719('0x2d')]);})[_0xe719('0x2b')](function(_0x1fbef9){if(_0x1fbef9){_0x2de53e[_0xe719('0x2e')]=util[_0xe719('0x2f')](_0xe719('0x30'),_0x1fbef9[_0xe719('0x3a')]);_0x2de53e['agent']=_0x1fbef9;}return request({'event':_0x165d9f,'message':_0x2de53e});})['catch'](function(_0x487500){logger['error'](_0xe719('0x1b'),_0xe719('0x3f'),_0x487500);});}};}function getAgent(_0x4d4458){return db[_0xe719('0x40')]['find']({'where':{'id':_0x4d4458},'attributes':['id',_0xe719('0x3a'),_0xe719('0x41'),_0xe719('0x42'),_0xe719('0x43')],'raw':!![]})[_0xe719('0x2b')](function(_0x5d9f1f){return _0x5d9f1f;});}exports[_0xe719('0x44')]=function(){for(var _0x2d7e1f=0x0;_0x2d7e1f=_0x5b16fe[_0x36dd('0x15')]){throw Error(_0x36dd('0x16'));}_0x814c76(_0x40910d);})['catch'](function(_0x1695a9){_0x38ef47(_0x1695a9);});});}; \ No newline at end of file +var _0x7eee=['whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms'];(function(_0x16252d,_0xaad177){var _0xeb5dd5=function(_0x4852fd){while(--_0x4852fd){_0x16252d['push'](_0x16252d['shift']());}};_0xeb5dd5(++_0xaad177);}(_0x7eee,0x79));var _0xe7ee=function(_0x22af24,_0x3973e6){_0x22af24=_0x22af24-0x0;var _0x599cda=_0x7eee[_0x22af24];return _0x599cda;};'use strict';var _=require(_0xe7ee('0x0'));var BPromise=require(_0xe7ee('0x1'));var db=require(_0xe7ee('0x2'))['db'];var util=require(_0xe7ee('0x3'));var channels=[_0xe7ee('0x4'),_0xe7ee('0x5'),_0xe7ee('0x6'),_0xe7ee('0x7'),_0xe7ee('0x8'),_0xe7ee('0x9'),_0xe7ee('0xa')];exports[_0xe7ee('0xb')]=function(){return channels;};exports[_0xe7ee('0xc')]=function(_0x5c9563){_0x5c9563=_0x5c9563['toLowerCase']();return _[_0xe7ee('0xd')](channels,_0x5c9563);};exports[_0xe7ee('0xe')]=function(_0x5db676,_0x29ec32,_0x5e97bd,_0x475cec){var _0x412729={'loginAttempts':_0x29ec32,'blocked':_0x5e97bd};if(!_[_0xe7ee('0xf')](_0x475cec)){_0x412729[_0xe7ee('0x10')]=_0x475cec;}return _0x5db676['updateAttributes'](_0x412729);};exports['getLicense']=function(_0x515d4d){return new BPromise(function(_0x218f8d,_0x52266a){var _0x28f47d=0x0;if(_0x515d4d[_0xe7ee('0x11')]!==_0xe7ee('0x12')){_0x218f8d(_0x515d4d);}db[_0xe7ee('0x13')][_0xe7ee('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x515d4d['id']}}})[_0xe7ee('0x15')](function(_0x175b23){_0x28f47d=_0x175b23;return util[_0xe7ee('0x16')]();})[_0xe7ee('0x15')](function(_0x345e57){if(_0x345e57&&_0x345e57['agents']&&_0x28f47d>=_0x345e57[_0xe7ee('0x17')]){throw Error(_0xe7ee('0x18'));}_0x218f8d(_0x515d4d);})[_0xe7ee('0x19')](function(_0x1b9f76){_0x52266a(_0x1b9f76);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 87b75b5..c9cab51 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6e2=['status','json','exports','404'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xa6e2,0x132));var _0x2a6e=function(_0x47c864,_0x3b5dc8){_0x47c864=_0x47c864-0x0;var _0x154631=_0xa6e2[_0x47c864];return _0x154631;};'use strict';module[_0x2a6e('0x0')][0x194]=function pageNotFound(_0x3b0758,_0x5a5a48){var _0x144192=_0x2a6e('0x1');var _0x314611=0x194;var _0x4e74b6={'status':_0x314611};_0x5a5a48['status'](_0x4e74b6[_0x2a6e('0x2')]);_0x5a5a48['render'](_0x144192,{},function(_0x5cd74d,_0x2bb3fa){if(_0x5cd74d){return _0x5a5a48[_0x2a6e('0x2')](_0x4e74b6[_0x2a6e('0x2')])[_0x2a6e('0x3')](_0x4e74b6);}_0x5a5a48['send'](_0x2bb3fa);});}; \ No newline at end of file +var _0x314e=['404','status','render','exports'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x314e,0x173));var _0xe314=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x314e[_0x20a584];return _0x4b41a8;};'use strict';module[_0xe314('0x0')][0x194]=function pageNotFound(_0x9f4226,_0x195e0c){var _0x5d37f9=_0xe314('0x1');var _0x5cb142=0x194;var _0x1d71f6={'status':_0x5cb142};_0x195e0c[_0xe314('0x2')](_0x1d71f6['status']);_0x195e0c[_0xe314('0x3')](_0x5d37f9,{},function(_0x4c15e5,_0xe99c48){if(_0x4c15e5){return _0x195e0c[_0xe314('0x2')](_0x1d71f6[_0xe314('0x2')])['json'](_0x1d71f6);}_0x195e0c['send'](_0xe99c48);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a8ac1fe..8845666 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66d6=['SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','CmCompany','CompanyId','Phones','HopperFinals','OpenchannelInteractions','Company','cm_contact_has_tags','ThroughTags','CmHopperId','Queue','CampaignId','OwnerId','Automation','All','AutomationAllId','Any','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','Configurations','Subjects','ZohoConfiguration','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Field','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','ProjectId','JscriptyProject','MailQueues','TeamVoicePrefix','HopperHistories','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsAccountId','HopperHistory','Queues','UserProfileResource','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappMessage','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','Imap','Smtp','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','xC@LL1234','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','../api/integration/integration.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','belongsToMany','CmList','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessage','IntervalId','FaxAccountId','FaxApplication','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x66d6,0x81));var _0x666d=function(_0x3f8556,_0x35c394){_0x3f8556=_0x3f8556-0x0;var _0x391def=_0x66d6[_0x3f8556];return _0x391def;};'use strict';var config=require(_0x666d('0x0'));var Sequelize=require(_0x666d('0x1'));var _=require(_0x666d('0x2'));var jstz=require(_0x666d('0x3'));var timezone=jstz[_0x666d('0x4')]();config[_0x666d('0x1')]=_[_0x666d('0x5')](config[_0x666d('0x1')],{'database':_0x666d('0x6'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x666d('0x7'),'dialectOptions':{'charset':_0x666d('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x666d('0x9'),'collate':_0x666d('0xa')}}});config['sequelizeHistory']=_[_0x666d('0x5')](config[_0x666d('0xb')],{'database':_0x666d('0x6'),'username':_0x666d('0xc'),'password':_0x666d('0xd'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x666d('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x666d('0x1')][_0x666d('0xe')],config[_0x666d('0x1')][_0x666d('0xf')],config[_0x666d('0x1')][_0x666d('0x10')],config[_0x666d('0x1')][_0x666d('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x666d('0xe')],config[_0x666d('0xb')][_0x666d('0xf')],config[_0x666d('0xb')]['password'],config['sequelizeHistory'][_0x666d('0x11')])};db[_0x666d('0x12')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x14'));db[_0x666d('0x15')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x16'));db[_0x666d('0x17')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x18'));db[_0x666d('0x19')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x1a'));db['VoiceMusicOnHold']=db['sequelize'][_0x666d('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x666d('0x1b')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0x666d('0x1c')]=db[_0x666d('0x1')]['import'](_0x666d('0x1d'));db[_0x666d('0x1e')]=db['sequelize']['import'](_0x666d('0x1f'));db[_0x666d('0x20')]=db[_0x666d('0x1')]['import'](_0x666d('0x21'));db[_0x666d('0x22')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x666d('0x23')]=db['sequelize'][_0x666d('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x666d('0x24')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x25'));db[_0x666d('0x26')]=db[_0x666d('0x1')]['import'](_0x666d('0x27'));db[_0x666d('0x28')]=db['sequelize'][_0x666d('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x666d('0x29')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x2a'));db[_0x666d('0x2b')]=db[_0x666d('0x1')]['import'](_0x666d('0x2c'));db[_0x666d('0x2d')]=db[_0x666d('0x1')]['import'](_0x666d('0x2e'));db['UserVoiceQueueRt']=db[_0x666d('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x666d('0x2f')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x30'));db[_0x666d('0x31')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x32'));db[_0x666d('0x33')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x666d('0x34')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x35'));db[_0x666d('0x36')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x37'));db[_0x666d('0x38')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x39'));db[_0x666d('0x3a')]=db[_0x666d('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x666d('0x3b')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x3c'));db[_0x666d('0x3d')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x3e'));db[_0x666d('0x3f')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/mailAccount/mailAccount.model');db[_0x666d('0x40')]=db[_0x666d('0x1')]['import']('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db['sequelize'][_0x666d('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x666d('0x41')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x42'));db[_0x666d('0x43')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x44'));db[_0x666d('0x45')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x46'));db[_0x666d('0x47')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x666d('0x48')]=db[_0x666d('0x1')]['import'](_0x666d('0x49'));db[_0x666d('0x4a')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x4b'));db[_0x666d('0x4c')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x4d'));db['FaxApplication']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x4e'));db['FaxInteraction']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x666d('0x4f')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/faxMessage/faxMessage.model');db[_0x666d('0x50')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x51'));db['FaxQueueReport']=db[_0x666d('0x1')]['import'](_0x666d('0x52'));db[_0x666d('0x53')]=db[_0x666d('0x1')]['import'](_0x666d('0x54'));db[_0x666d('0x55')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x56'));db[_0x666d('0x57')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x58'));db[_0x666d('0x59')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x5a'));db[_0x666d('0x5b')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x5c'));db[_0x666d('0x5d')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x666d('0x5e')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x666d('0x5f')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x60'));db['OpenchannelQueue']=db['sequelize'][_0x666d('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x666d('0x61')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x62'));db[_0x666d('0x63')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x64'));db['ChatInteraction']=db['sequelize'][_0x666d('0x13')](_0x666d('0x65'));db[_0x666d('0x66')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x67'));db['ChatOfflineMessage']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x68'));db[_0x666d('0x69')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x6a'));db[_0x666d('0x6b')]=db[_0x666d('0x1')]['import'](_0x666d('0x6c'));db[_0x666d('0x6d')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x6e'));db['CmCompany']=db['sequelize'][_0x666d('0x13')]('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0x666d('0x13')]('../api/cmContact/cmContact.model');db[_0x666d('0x6f')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x70'));db[_0x666d('0x71')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x666d('0x72')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x666d('0x73')]=db['sequelize'][_0x666d('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x666d('0x74')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x75'));db[_0x666d('0x76')]=db[_0x666d('0x1')]['import'](_0x666d('0x77'));db[_0x666d('0x78')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/action/action.model');db['Automation']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/automation/automation.model');db[_0x666d('0x79')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x7a'));db[_0x666d('0x7b')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x7c'));db[_0x666d('0x7d')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x7e'));db[_0x666d('0x7f')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x80'));db[_0x666d('0x81')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x82'));db['Cdr']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x83'));db['VoiceQueuesLog']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/schedule/schedule.model');db[_0x666d('0x84')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x85'));db[_0x666d('0x86')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x87'));db[_0x666d('0x88')]=db[_0x666d('0x1')]['import']('../api/contactItemType/contactItemType.model');db[_0x666d('0x89')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x8a'));db[_0x666d('0x8b')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x8c'));db['Template']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x8d'));db['Trigger']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/trigger/trigger.model');db[_0x666d('0x8e')]=db[_0x666d('0x1')]['import']('../api/variable/variable.model');db['Integration']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x8f'));db['IntegrationReport']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x90'));db[_0x666d('0x91')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x666d('0x92')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x93'));db[_0x666d('0x94')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x666d('0x95')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x666d('0x96')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x97'));db['SalesforceAccount']=db['sequelize'][_0x666d('0x13')](_0x666d('0x98'));db[_0x666d('0x99')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x9a'));db[_0x666d('0x9b')]=db['sequelize'][_0x666d('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x666d('0x9c')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x9d'));db[_0x666d('0x9e')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x666d('0x9f')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x666d('0xa0')]=db['sequelize'][_0x666d('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x666d('0xa1')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xa2'));db[_0x666d('0xa3')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xa4'));db[_0x666d('0xa5')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xa6'));db['ZohoConfiguration']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xa7'));db[_0x666d('0xa8')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xa9'));db[_0x666d('0xaa')]=db['sequelize'][_0x666d('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x666d('0xab')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xac'));db['ZendeskField']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xad'));db[_0x666d('0xae')]=db['sequelize'][_0x666d('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x666d('0x1')]['import'](_0x666d('0xaf'));db[_0x666d('0xb0')]=db[_0x666d('0x1')]['import'](_0x666d('0xb1'));db[_0x666d('0xb2')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xb3'));db[_0x666d('0xb4')]=db[_0x666d('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x666d('0xb5')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xb6'));db['ServicenowAccount']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xb7'));db[_0x666d('0xb8')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xb9'));db[_0x666d('0xba')]=db['sequelize']['import'](_0x666d('0xbb'));db[_0x666d('0xbc')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xbd'));db[_0x666d('0xbe')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xbf'));db['Dynamics365Field']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x666d('0xc0')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xc1'));db['FreshsalesConfiguration']=db['sequelize'][_0x666d('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x666d('0xc2')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xc3'));db[_0x666d('0xc4')]=db[_0x666d('0x1')]['import'](_0x666d('0x8f'));db['Network']=db[_0x666d('0x1')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xc5'));db['ChatInternalMessage']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xc6'));db[_0x666d('0xc7')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x666d('0xc8')]=db[_0x666d('0x1')]['import'](_0x666d('0xc9'));db[_0x666d('0xca')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xcb'));db['SmsQueueReport']=db[_0x666d('0x1')][_0x666d('0x13')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xcc'));db[_0x666d('0xcd')]=db[_0x666d('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xce'));db[_0x666d('0xcf')]=db[_0x666d('0x1')]['import'](_0x666d('0xd0'));db[_0x666d('0xd1')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xd2'));db[_0x666d('0xd3')]=db[_0x666d('0x1')]['import'](_0x666d('0xd4'));db[_0x666d('0xd5')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xd6'));db[_0x666d('0xd7')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/squareMessage/squareMessage.model');db[_0x666d('0xd8')]=db[_0x666d('0x1')]['import'](_0x666d('0xd9'));db[_0x666d('0xda')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xdb'));db[_0x666d('0xdc')]=db[_0x666d('0x1')][_0x666d('0x13')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0x666d('0x13')](_0x666d('0xdd'));db['Attachment']=db[_0x666d('0x1')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xde'));db[_0x666d('0xdf')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xe0'));db['ChatTransferReport']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xe1'));db[_0x666d('0xe2')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xe3'));db[_0x666d('0xe4')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xe5'));db[_0x666d('0xe6')]=db['sequelize'][_0x666d('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x666d('0x1')]['import'](_0x666d('0xe7'));db[_0x666d('0xe8')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xe9'));db[_0x666d('0xea')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xeb'));db[_0x666d('0xec')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xed'));db['UserProfileResource']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xee'));db[_0x666d('0xef')]=db[_0x666d('0x1')]['import']('../api/userNotification/userNotification.model');db[_0x666d('0xf0')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xf1'));db[_0x666d('0xf2')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xf3'));db[_0x666d('0xf4')]=db[_0x666d('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize']['import'](_0x666d('0xf5'));db['WhatsappQueueReport']=db['sequelize']['import'](_0x666d('0xf6'));db[_0x666d('0xf7')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xf8'));db[_0x666d('0xf9')]=db['sequelize'][_0x666d('0x13')](_0x666d('0xfa'));db[_0x666d('0xfb')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xfc'));db[_0x666d('0xfd')]=db[_0x666d('0x1')]['import'](_0x666d('0xfe'));db['TeamVoicePrefix']=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0xff'));db[_0x666d('0x100')]=db['sequelize'][_0x666d('0x13')](_0x666d('0x101'));db[_0x666d('0x102')]=db[_0x666d('0x1')][_0x666d('0x13')](_0x666d('0x103'));db[_0x666d('0x12')][_0x666d('0x104')](db[_0x666d('0x20')],{'as':'VoiceMail','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x12')]['hasOne'](db[_0x666d('0x102')],{'as':_0x666d('0x107'),'onDelete':_0x666d('0x105'),'foreignKey':'UserId'});db['User'][_0x666d('0x108')](db[_0x666d('0x1c')],{'as':_0x666d('0x109'),'foreignKey':_0x666d('0x106')});db['User'][_0x666d('0x108')](db[_0x666d('0x10a')],{'as':_0x666d('0x10b'),'foreignKey':_0x666d('0x106')});db['User'][_0x666d('0x108')](db['VoiceExtension'],{'as':_0x666d('0x10c'),'onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x12')]['hasMany'](db[_0x666d('0x72')],{'as':'HopperFinals','foreignKey':_0x666d('0x106')});db[_0x666d('0x12')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x666d('0x106')});db['User'][_0x666d('0x108')](db['ReportAgentPreview'],{'as':_0x666d('0x74'),'foreignKey':_0x666d('0x106')});db['User'][_0x666d('0x108')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x666d('0x106')});db[_0x666d('0x12')]['hasMany'](db[_0x666d('0x10d')],{'as':_0x666d('0x10e'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x12')][_0x666d('0x108')](db[_0x666d('0x57')],{'as':_0x666d('0x10f'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x12')][_0x666d('0x108')](db[_0x666d('0x110')],{'as':_0x666d('0x111'),'foreignKey':'UserId'});db[_0x666d('0x12')]['hasMany'](db[_0x666d('0x41')],{'as':_0x666d('0x112'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x12')][_0x666d('0x108')](db[_0x666d('0xf4')],{'as':_0x666d('0x113'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x12')][_0x666d('0x108')](db[_0x666d('0xef')],{'as':_0x666d('0x114'),'foreignKey':'SenderId'});db[_0x666d('0x12')][_0x666d('0x115')](db[_0x666d('0xea')],{'as':_0x666d('0xea'),'foreignKey':_0x666d('0x116')});db[_0x666d('0x12')]['belongsToMany'](db[_0x666d('0x6b')],{'as':_0x666d('0x117'),'through':_0x666d('0x118')});db['User']['belongsToMany'](db[_0x666d('0x119')],{'as':_0x666d('0x11a'),'through':_0x666d('0x11b')});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x11d')],{'as':_0x666d('0x11e'),'through':'cm_user_has_lists'});db[_0x666d('0x12')][_0x666d('0x11c')](db['Team'],{'through':_0x666d('0x11f')});db[_0x666d('0x12')]['belongsToMany'](db[_0x666d('0x41')],{'as':_0x666d('0x112'),'through':_0x666d('0x120')});db['User'][_0x666d('0x11c')](db[_0x666d('0x10d')],{'as':'ChatInteractions','through':_0x666d('0x121')});db['User'][_0x666d('0x11c')](db[_0x666d('0x110')],{'as':_0x666d('0x111'),'through':_0x666d('0x122')});db['User'][_0x666d('0x11c')](db[_0x666d('0x57')],{'as':'SmsInteractions','through':_0x666d('0x123')});db['User'][_0x666d('0x11c')](db[_0x666d('0x5f')],{'as':'OpenchannelInteractions','through':_0x666d('0x124')});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0xf4')],{'as':_0x666d('0x113'),'through':'user_has_whatsapp_interactions'});db[_0x666d('0x12')][_0x666d('0x11c')](db['VoiceQueue'],{'as':_0x666d('0x125'),'through':_0x666d('0x2f'),'required':![]});db['User'][_0x666d('0x11c')](db[_0x666d('0xe8')],{'as':_0x666d('0x126'),'through':_0x666d('0x100'),'required':![]});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x40')],{'as':'MailQueues','through':_0x666d('0x33'),'required':![]});db['User'][_0x666d('0x11c')](db[_0x666d('0x69')],{'as':_0x666d('0x127'),'through':_0x666d('0x31'),'required':![],'hooks':!![]});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x50')],{'as':_0x666d('0x128'),'through':'UserFaxQueue','required':![]});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x5b')],{'as':_0x666d('0x129'),'through':_0x666d('0x36'),'required':![]});db['User']['belongsToMany'](db[_0x666d('0x12a')],{'as':_0x666d('0x12b'),'through':_0x666d('0x38'),'required':![]});db[_0x666d('0x12')]['belongsToMany'](db[_0x666d('0xf9')],{'as':'WhatsappQueues','through':_0x666d('0x3a'),'required':![]});db[_0x666d('0x12')][_0x666d('0x11c')](db['CmList'],{'through':_0x666d('0x12c')});db['User'][_0x666d('0x11c')](db[_0x666d('0x61')],{'as':_0x666d('0x12d'),'through':_0x666d('0x12e')});db['User'][_0x666d('0x11c')](db[_0x666d('0x4c')],{'as':_0x666d('0x12f'),'through':_0x666d('0x130')});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x3f')],{'as':_0x666d('0x131'),'through':_0x666d('0x132')});db[_0x666d('0x12')][_0x666d('0x11c')](db[_0x666d('0x5d')],{'as':_0x666d('0x133'),'through':_0x666d('0x134')});db[_0x666d('0x12')][_0x666d('0x11c')](db['SmsAccount'],{'as':_0x666d('0x135'),'through':_0x666d('0x136')});db[_0x666d('0x12')][_0x666d('0x11c')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db['User'][_0x666d('0x11c')](db['SquareProject'],{'as':_0x666d('0x137'),'through':_0x666d('0x138')});db[_0x666d('0x15')]['hasMany'](db[_0x666d('0x19')],{'as':_0x666d('0x139'),'onDelete':_0x666d('0x105'),'foreignKey':'ChanSpyId'});db[_0x666d('0x17')]['hasMany'](db[_0x666d('0x19')],{'onDelete':_0x666d('0x105')});db[_0x666d('0x19')][_0x666d('0x108')](db['VoiceExtension'],{'as':_0x666d('0x13a'),'onDelete':_0x666d('0x105')});db[_0x666d('0x13b')][_0x666d('0x11c')](db[_0x666d('0x84')],{'as':_0x666d('0x13c'),'through':_0x666d('0x13d')});db['VoiceQueue'][_0x666d('0x108')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x666d('0x1b')][_0x666d('0x108')](db[_0x666d('0x6f')],{'as':_0x666d('0x13e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x666d('0x108')](db[_0x666d('0x72')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x666d('0x1b')][_0x666d('0x108')](db[_0x666d('0x73')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x666d('0x1b')][_0x666d('0x108')](db['ReportAgentPreview'],{'as':_0x666d('0x74'),'foreignKey':_0x666d('0x13f')});db[_0x666d('0x1b')][_0x666d('0x108')](db[_0x666d('0x71')],{'as':_0x666d('0x140'),'foreignKey':_0x666d('0x13f')});db[_0x666d('0x1b')][_0x666d('0x108')](db[_0x666d('0xca')],{'as':_0x666d('0x141'),'foreignKey':'VoiceQueueId'});db[_0x666d('0x1b')]['belongsTo'](db[_0x666d('0x2b')],{'as':_0x666d('0x2b'),'foreignKey':_0x666d('0x142')});db[_0x666d('0x1b')][_0x666d('0x115')](db[_0x666d('0x2b')],{'as':_0x666d('0x143'),'foreignKey':'TrunkBackupId'});db[_0x666d('0x1b')][_0x666d('0x115')](db[_0x666d('0x7f')],{'as':_0x666d('0x7f'),'foreignKey':'IntervalId'});db[_0x666d('0x1b')][_0x666d('0x115')](db['Pause'],{'as':_0x666d('0x144'),'foreignKey':_0x666d('0x145')});db[_0x666d('0x1b')][_0x666d('0x11c')](db[_0x666d('0x11d')],{'as':'Lists','through':_0x666d('0x146')});db[_0x666d('0x1b')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x2f')});db[_0x666d('0x1b')][_0x666d('0x11c')](db['Team'],{'as':_0x666d('0x148'),'through':_0x666d('0xfd')});db['VoiceQueue'][_0x666d('0x11c')](db[_0x666d('0x11d')],{'as':_0x666d('0x149'),'through':_0x666d('0x14a')});db[_0x666d('0x1c')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x12'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x1e')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x12'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x20')][_0x666d('0x108')](db['VoiceMailMessage'],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x14c'),'sourceKey':'mailbox'});db[_0x666d('0x22')][_0x666d('0x115')](db['VoiceMail'],{'foreignKey':_0x666d('0x14c'),'targetKey':_0x666d('0x14d')});db[_0x666d('0x23')][_0x666d('0x108')](db[_0x666d('0x28')],{'as':_0x666d('0x14e'),'foreignKey':_0x666d('0x14f'),'constraints':![]});db['VoiceCallReport'][_0x666d('0x108')](db[_0x666d('0x26')],{'as':_0x666d('0x150'),'foreignKey':_0x666d('0x14f'),'constraints':![]});db[_0x666d('0x23')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x12'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x23')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x3b')]['belongsTo'](db[_0x666d('0x3f')],{'as':'MailAccount','foreignKey':_0x666d('0x153')});db[_0x666d('0x3b')]['belongsTo'](db[_0x666d('0xfb')],{'as':'CloudProvider','foreignKey':_0x666d('0x154'),'onDelete':_0x666d('0x155')});db[_0x666d('0x3d')][_0x666d('0x115')](db['MailAccount'],{'as':_0x666d('0x3f'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x666d('0x115')](db['CloudProvider'],{'as':_0x666d('0xfb'),'foreignKey':_0x666d('0x154'),'onDelete':_0x666d('0x155')});db[_0x666d('0x3f')][_0x666d('0x104')](db['MailServerIn'],{'as':'Imap','onDelete':_0x666d('0x105')});db['MailAccount'][_0x666d('0x104')](db[_0x666d('0x3d')],{'as':'Smtp','onDelete':_0x666d('0x105')});db[_0x666d('0x3f')][_0x666d('0x108')](db[_0x666d('0x7b')],{'as':_0x666d('0x156'),'foreignKey':_0x666d('0x153'),'onDelete':_0x666d('0x105')});db[_0x666d('0x3f')][_0x666d('0x108')](db['CannedAnswer'],{'as':_0x666d('0x157'),'foreignKey':_0x666d('0x153')});db[_0x666d('0x3f')][_0x666d('0x108')](db[_0x666d('0x43')],{'as':_0x666d('0x14b'),'foreignKey':_0x666d('0x153')});db[_0x666d('0x3f')][_0x666d('0x108')](db['MailInteraction'],{'as':_0x666d('0x158')});db[_0x666d('0x3f')][_0x666d('0x108')](db['MailApplication'],{'as':_0x666d('0x13a')});db['MailAccount']['belongsTo'](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x3f')][_0x666d('0x115')](db[_0x666d('0x15b')],{'as':_0x666d('0x15b'),'foreignKey':_0x666d('0x15c')});db[_0x666d('0x3f')][_0x666d('0x115')](db[_0x666d('0x81')],{'as':_0x666d('0x144'),'foreignKey':_0x666d('0x145')});db['MailAccount'][_0x666d('0x11c')](db['User'],{'as':_0x666d('0x147'),'through':_0x666d('0x132')});db['MailQueue']['belongsToMany'](db['User'],{'as':_0x666d('0x147'),'through':_0x666d('0x33')});db['MailQueue']['belongsToMany'](db[_0x666d('0xd8')],{'through':_0x666d('0x15d'),'as':_0x666d('0x148')});db[_0x666d('0x41')][_0x666d('0x108')](db[_0x666d('0x43')],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x15e')});db[_0x666d('0x41')][_0x666d('0x115')](db[_0x666d('0x3f')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x153')});db[_0x666d('0x41')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x41')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x41')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x161'),'as':_0x666d('0x162')});db[_0x666d('0x41')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x161'),'as':'ThroughTags'});db[_0x666d('0x41')][_0x666d('0x11c')](db['User'],{'as':_0x666d('0x163'),'through':_0x666d('0x120'),'foreignKey':_0x666d('0x15e')});db['MailMessage']['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':_0x666d('0x105')});db[_0x666d('0x43')][_0x666d('0x115')](db['User'],{'as':_0x666d('0x12')});db[_0x666d('0x43')]['belongsTo'](db[_0x666d('0x119')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151')});db['MailMessage']['belongsTo'](db[_0x666d('0x41')],{'as':_0x666d('0x164'),'foreignKey':'MailInteractionId'});db[_0x666d('0x43')]['belongsTo'](db['MailAccount'],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x153')});db[_0x666d('0x43')][_0x666d('0x115')](db[_0x666d('0x61')],{'as':_0x666d('0x61'),'foreignKey':_0x666d('0x165')});db[_0x666d('0x43')]['belongsTo'](db[_0x666d('0x166')],{'as':_0x666d('0x166'),'foreignKey':'ChatOfflineMessageId'});db[_0x666d('0x45')][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x155')});db['MailApplication'][_0x666d('0x115')](db[_0x666d('0x40')],{'onDelete':_0x666d('0x155')});db[_0x666d('0x45')][_0x666d('0x115')](db[_0x666d('0x3f')],{'onDelete':'restrict'});db[_0x666d('0x45')][_0x666d('0x115')](db[_0x666d('0x7f')],{'onDelete':'restrict','foreignKey':_0x666d('0x167')});db[_0x666d('0x45')]['belongsTo'](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':'TagId'});db[_0x666d('0x47')]['belongsTo'](db[_0x666d('0x3f')],{});db['MailQueueReport']['belongsTo'](db['CmList'],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x47')][_0x666d('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0x666d('0x152')});db['MailQueueReport'][_0x666d('0x115')](db[_0x666d('0x41')],{});db['MailQueueReport'][_0x666d('0x115')](db['MailMessage'],{});db[_0x666d('0x47')][_0x666d('0x115')](db[_0x666d('0x12')],{});db['MailQueueReport'][_0x666d('0x115')](db[_0x666d('0x40')],{});db[_0x666d('0x48')]['hasMany'](db['DashboardItem'],{'as':'Items','onDelete':_0x666d('0x105')});db['FaxAccount'][_0x666d('0x108')](db[_0x666d('0x7b')],{'as':_0x666d('0x156'),'foreignKey':'FaxAccountId','onDelete':_0x666d('0x105')});db[_0x666d('0x4c')][_0x666d('0x108')](db[_0x666d('0x79')],{'as':_0x666d('0x157'),'foreignKey':_0x666d('0x168')});db[_0x666d('0x4c')][_0x666d('0x108')](db[_0x666d('0x110')],{'as':_0x666d('0x158')});db[_0x666d('0x4c')]['hasMany'](db[_0x666d('0x169')],{'as':'Applications'});db[_0x666d('0x4c')][_0x666d('0x108')](db[_0x666d('0x19')],{'as':_0x666d('0x16a'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x666d('0x4f')],{'as':_0x666d('0x14b')});db[_0x666d('0x4c')]['belongsTo'](db[_0x666d('0x2b')],{'as':_0x666d('0x2b')});db[_0x666d('0x4c')][_0x666d('0x115')](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':'ListId'});db[_0x666d('0x4c')][_0x666d('0x115')](db[_0x666d('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x666d('0x145')});db[_0x666d('0x4c')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x130')});db[_0x666d('0x169')]['belongsTo'](db[_0x666d('0x12')],{'onDelete':_0x666d('0x155')});db['FaxApplication'][_0x666d('0x115')](db[_0x666d('0x50')],{'onDelete':'restrict'});db[_0x666d('0x169')][_0x666d('0x115')](db[_0x666d('0x4c')],{'onDelete':'restrict'});db[_0x666d('0x169')]['belongsTo'](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':_0x666d('0x16b')});db[_0x666d('0x110')][_0x666d('0x108')](db['FaxMessage'],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x16c')});db[_0x666d('0x110')][_0x666d('0x115')](db[_0x666d('0x4c')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x168')});db[_0x666d('0x110')]['belongsTo'](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db['FaxInteraction']['belongsTo'](db[_0x666d('0x12')],{'as':'Owner','foreignKey':_0x666d('0x106')});db[_0x666d('0x110')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x16d'),'as':_0x666d('0x162')});db[_0x666d('0x110')][_0x666d('0x11c')](db['Tag'],{'through':_0x666d('0x16d'),'as':'ThroughTags'});db[_0x666d('0x110')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Users','through':_0x666d('0x122'),'foreignKey':_0x666d('0x16c')});db['FaxMessage'][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x12')});db[_0x666d('0x4f')][_0x666d('0x115')](db['FaxInteraction'],{'as':_0x666d('0x164'),'foreignKey':'FaxInteractionId'});db[_0x666d('0x4f')][_0x666d('0x115')](db['CmContact'],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151')});db['FaxMessage']['belongsTo'](db[_0x666d('0x16e')],{'as':_0x666d('0x16e'),'foreignKey':_0x666d('0x16f')});db[_0x666d('0x4f')]['belongsTo'](db[_0x666d('0x4c')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x168')});db[_0x666d('0x50')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x34')});db[_0x666d('0x50')][_0x666d('0x11c')](db[_0x666d('0xd8')],{'through':_0x666d('0x170'),'as':_0x666d('0x148')});db[_0x666d('0x171')][_0x666d('0x115')](db[_0x666d('0x4c')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x171')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x171')]['belongsTo'](db['FaxInteraction'],{});db[_0x666d('0x171')][_0x666d('0x115')](db[_0x666d('0x4f')],{});db[_0x666d('0x171')]['belongsTo'](db['User'],{});db[_0x666d('0x171')][_0x666d('0x115')](db[_0x666d('0x50')],{});db[_0x666d('0x53')][_0x666d('0x108')](db[_0x666d('0x7b')],{'as':_0x666d('0x156'),'foreignKey':_0x666d('0x172'),'onDelete':_0x666d('0x105')});db[_0x666d('0x53')][_0x666d('0x108')](db[_0x666d('0x79')],{'as':_0x666d('0x157'),'foreignKey':'SmsAccountId'});db[_0x666d('0x53')][_0x666d('0x108')](db[_0x666d('0x59')],{'as':'Messages','foreignKey':_0x666d('0x172')});db[_0x666d('0x53')][_0x666d('0x108')](db['SmsInteraction'],{'as':'Interactions'});db[_0x666d('0x53')][_0x666d('0x108')](db['SmsApplication'],{'as':'Applications'});db['SmsAccount'][_0x666d('0x115')](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':'ListId'});db[_0x666d('0x53')][_0x666d('0x115')](db[_0x666d('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x666d('0x145')});db[_0x666d('0x53')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Agents','through':_0x666d('0x136')});db[_0x666d('0x55')][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x155')});db[_0x666d('0x55')][_0x666d('0x115')](db[_0x666d('0x5b')],{'onDelete':_0x666d('0x155')});db[_0x666d('0x55')][_0x666d('0x115')](db[_0x666d('0x53')],{'onDelete':_0x666d('0x155')});db[_0x666d('0x55')]['belongsTo'](db[_0x666d('0x7f')],{'onDelete':'restrict','foreignKey':_0x666d('0x167')});db[_0x666d('0x55')][_0x666d('0x115')](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':_0x666d('0x16b')});db[_0x666d('0x57')][_0x666d('0x108')](db[_0x666d('0x59')],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x173')});db[_0x666d('0x57')][_0x666d('0x115')](db['SmsAccount'],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x172')});db[_0x666d('0x57')]['belongsTo'](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x57')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':_0x666d('0x106')});db['SmsInteraction']['belongsToMany'](db[_0x666d('0x86')],{'through':_0x666d('0x174'),'as':_0x666d('0x162')});db[_0x666d('0x57')][_0x666d('0x11c')](db['Tag'],{'through':_0x666d('0x174'),'as':'ThroughTags'});db['SmsInteraction'][_0x666d('0x11c')](db['User'],{'as':'Users','through':_0x666d('0x123'),'foreignKey':_0x666d('0x173')});db[_0x666d('0x59')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x12')});db[_0x666d('0x59')][_0x666d('0x115')](db[_0x666d('0x119')],{'onDelete':'cascade','as':'Contact'});db[_0x666d('0x59')][_0x666d('0x115')](db[_0x666d('0x57')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x164'),'foreignKey':_0x666d('0x173')});db['SmsMessage'][_0x666d('0x115')](db[_0x666d('0x53')],{'as':'Account','foreignKey':_0x666d('0x172')});db['SmsQueue'][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x36'),'foreignKey':_0x666d('0x175')});db[_0x666d('0x5b')][_0x666d('0x11c')](db[_0x666d('0xd8')],{'through':_0x666d('0x176'),'as':_0x666d('0x148')});db['OpenchannelAccount'][_0x666d('0x108')](db[_0x666d('0x7b')],{'as':'Dispositions','foreignKey':_0x666d('0x177'),'onDelete':_0x666d('0x105')});db[_0x666d('0x5d')][_0x666d('0x108')](db[_0x666d('0x79')],{'as':_0x666d('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x666d('0x5d')][_0x666d('0x108')](db[_0x666d('0x5f')],{'as':_0x666d('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x666d('0x5d')]['hasMany'](db[_0x666d('0x178')],{'as':_0x666d('0x14b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x666d('0x5e')],{'as':_0x666d('0x13a'),'foreignKey':_0x666d('0x177')});db[_0x666d('0x5d')][_0x666d('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x666d('0x115')](db[_0x666d('0x81')],{'as':_0x666d('0x144'),'foreignKey':_0x666d('0x145')});db[_0x666d('0x5d')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x134')});db[_0x666d('0x5e')][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x155')});db['OpenchannelApplication'][_0x666d('0x115')](db['OpenchannelQueue'],{'onDelete':_0x666d('0x155'),'foreignKey':_0x666d('0x179')});db['OpenchannelApplication'][_0x666d('0x115')](db[_0x666d('0x5d')],{'onDelete':'restrict','foreignKey':_0x666d('0x177')});db[_0x666d('0x5e')]['belongsTo'](db[_0x666d('0x7f')],{'onDelete':_0x666d('0x155'),'foreignKey':_0x666d('0x167')});db[_0x666d('0x5e')]['belongsTo'](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x666d('0x108')](db[_0x666d('0x178')],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x17a')});db['OpenchannelInteraction'][_0x666d('0x115')](db[_0x666d('0x5d')],{'as':_0x666d('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x666d('0x5f')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x5f')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x17b'),'as':_0x666d('0x162')});db[_0x666d('0x5f')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x17b'),'as':'ThroughTags'});db[_0x666d('0x5f')]['belongsToMany'](db[_0x666d('0x12')],{'as':'Users','through':_0x666d('0x124'),'foreignKey':_0x666d('0x17a')});db[_0x666d('0x178')][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x12')});db[_0x666d('0x178')]['belongsTo'](db['CmContact'],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151')});db[_0x666d('0x178')][_0x666d('0x115')](db[_0x666d('0x5f')],{'onDelete':'cascade','as':_0x666d('0x164'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x666d('0x115')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x666d('0x178')][_0x666d('0x115')](db[_0x666d('0x5d')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x177')});db[_0x666d('0x12a')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x38'),'foreignKey':_0x666d('0x179')});db[_0x666d('0x12a')][_0x666d('0x11c')](db[_0x666d('0xd8')],{'through':_0x666d('0x17c'),'as':_0x666d('0x148')});db[_0x666d('0x61')]['hasMany'](db['Disposition'],{'as':_0x666d('0x156'),'foreignKey':_0x666d('0x165'),'onDelete':'cascade'});db[_0x666d('0x61')][_0x666d('0x108')](db[_0x666d('0x79')],{'as':_0x666d('0x157'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x666d('0x108')](db['ChatProactiveAction'],{'as':_0x666d('0x17d')});db['ChatWebsite'][_0x666d('0x108')](db[_0x666d('0x10d')],{'as':_0x666d('0x158')});db[_0x666d('0x61')][_0x666d('0x108')](db[_0x666d('0x17e')],{'as':'Applications'});db[_0x666d('0x61')]['hasMany'](db['ChatMessage'],{'as':_0x666d('0x14b')});db['ChatWebsite']['belongsTo'](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x61')]['belongsTo'](db[_0x666d('0x7f')],{'as':_0x666d('0x7f'),'foreignKey':_0x666d('0x167')});db[_0x666d('0x61')][_0x666d('0x115')](db[_0x666d('0x3f')],{'as':_0x666d('0x3f'),'foreignKey':'MailAccountId'});db[_0x666d('0x61')]['belongsTo'](db['Pause'],{'as':_0x666d('0x144'),'foreignKey':_0x666d('0x145')});db[_0x666d('0x61')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x147'),'through':_0x666d('0x12e')});db[_0x666d('0x63')]['belongsTo'](db[_0x666d('0x5d')],{});db[_0x666d('0x63')][_0x666d('0x115')](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x63')]['belongsTo'](db['CmContact'],{'as':_0x666d('0x151'),'foreignKey':'ContactId'});db[_0x666d('0x63')]['belongsTo'](db[_0x666d('0x5f')],{});db[_0x666d('0x63')][_0x666d('0x115')](db[_0x666d('0x178')],{});db[_0x666d('0x63')][_0x666d('0x115')](db[_0x666d('0x12')],{});db[_0x666d('0x63')][_0x666d('0x115')](db[_0x666d('0x12a')],{});db[_0x666d('0x17e')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x17f'),'foreignKey':_0x666d('0x106'),'onDelete':_0x666d('0x155')});db[_0x666d('0x17e')][_0x666d('0x115')](db[_0x666d('0x69')],{'as':'Queue','foreignKey':_0x666d('0x180'),'onDelete':_0x666d('0x155')});db[_0x666d('0x17e')][_0x666d('0x115')](db['ChatWebsite'],{'as':_0x666d('0x181'),'foreignKey':_0x666d('0x165'),'onDelete':_0x666d('0x155')});db[_0x666d('0x17e')][_0x666d('0x115')](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':'TagId'});db[_0x666d('0x10d')]['hasMany'](db['ChatMessage'],{'as':_0x666d('0x14b'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x182')});db[_0x666d('0x10d')][_0x666d('0x115')](db[_0x666d('0x61')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x165')});db[_0x666d('0x10d')][_0x666d('0x115')](db['CmContact'],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x10d')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':'UserId'});db[_0x666d('0x10d')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x183'),'as':'Tags'});db[_0x666d('0x10d')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x183'),'as':'ThroughTags'});db[_0x666d('0x10d')]['belongsToMany'](db[_0x666d('0x12')],{'as':_0x666d('0x163'),'through':'user_has_chat_interactions','foreignKey':_0x666d('0x182')});db[_0x666d('0x66')][_0x666d('0x115')](db['User'],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x12')});db[_0x666d('0x66')][_0x666d('0x115')](db[_0x666d('0x119')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x66')][_0x666d('0x115')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x666d('0x164'),'foreignKey':'ChatInteractionId'});db[_0x666d('0x66')][_0x666d('0x115')](db[_0x666d('0x16e')],{'as':_0x666d('0x16e'),'foreignKey':_0x666d('0x16f')});db[_0x666d('0x66')][_0x666d('0x115')](db[_0x666d('0x61')],{'as':'Account','foreignKey':_0x666d('0x165')});db[_0x666d('0x166')]['hasMany'](db[_0x666d('0x16e')],{'as':_0x666d('0x184'),'foreignKey':_0x666d('0x185'),'onDelete':'cascade','hooks':!![]});db[_0x666d('0x166')][_0x666d('0x115')](db[_0x666d('0x119')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151'),'foreignKey':'ContactId'});db[_0x666d('0x166')][_0x666d('0x115')](db[_0x666d('0x61')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x165')});db[_0x666d('0x69')][_0x666d('0x11c')](db['User'],{'as':_0x666d('0x147'),'through':_0x666d('0x31'),'hooks':!![]});db[_0x666d('0x69')]['belongsToMany'](db[_0x666d('0xd8')],{'through':_0x666d('0x186'),'as':_0x666d('0x148')});db[_0x666d('0x6b')][_0x666d('0x108')](db[_0x666d('0x187')],{'as':_0x666d('0x14b'),'foreignKey':_0x666d('0x188'),'onDelete':_0x666d('0x105')});db['ChatGroup'][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x189'),'through':'chat_group_has_users'});db[_0x666d('0x6d')][_0x666d('0x115')](db['ChatWebsite'],{'as':_0x666d('0x181'),'foreignKey':_0x666d('0x165')});db[_0x666d('0x18a')]['hasMany'](db[_0x666d('0x119')],{'as':_0x666d('0x11a'),'foreignKey':_0x666d('0x18b')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0x89')],{'as':_0x666d('0x18c'),'foreignKey':'CmContactId'});db[_0x666d('0x119')][_0x666d('0x108')](db['CmHopper'],{'as':_0x666d('0x13e'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0x72')],{'as':_0x666d('0x18d'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0x73')],{'as':'HopperHistories','foreignKey':_0x666d('0x152')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0x74')],{'as':_0x666d('0x74'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0xca')],{'as':_0x666d('0x141'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x119')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x666d('0x18e'),'foreignKey':_0x666d('0x152'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x666d('0x10d')],{'as':_0x666d('0x10e'),'foreignKey':'ContactId','onDelete':_0x666d('0x155')});db[_0x666d('0x119')]['hasMany'](db['SmsInteraction'],{'as':_0x666d('0x10f'),'foreignKey':'ContactId','onDelete':_0x666d('0x155')});db[_0x666d('0x119')]['hasMany'](db[_0x666d('0x110')],{'as':_0x666d('0x111'),'foreignKey':_0x666d('0x152'),'onDelete':_0x666d('0x155')});db[_0x666d('0x119')][_0x666d('0x108')](db[_0x666d('0x41')],{'as':_0x666d('0x112'),'foreignKey':_0x666d('0x152'),'onDelete':_0x666d('0x155')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0x666d('0x18f'),'foreignKey':_0x666d('0x18b')});db[_0x666d('0x119')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x666d('0x15a'),'onDelete':_0x666d('0x105')});db['CmContact'][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':_0x666d('0x163'),'through':_0x666d('0x11b')});db[_0x666d('0x119')]['belongsToMany'](db[_0x666d('0x86')],{'as':'Tags','through':_0x666d('0x190')});db['CmContact'][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':'cm_contact_has_tags','as':_0x666d('0x191')});db['CmHopper'][_0x666d('0x108')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x666d('0x192')});db['CmHopper'][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152'),'onDelete':'cascade'});db[_0x666d('0x6f')]['belongsTo'](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a'),'onDelete':_0x666d('0x105')});db[_0x666d('0x6f')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x17f'),'foreignKey':_0x666d('0x106')});db[_0x666d('0x6f')][_0x666d('0x115')](db[_0x666d('0x1b')],{'as':_0x666d('0x193'),'foreignKey':_0x666d('0x13f'),'onDelete':_0x666d('0x105')});db[_0x666d('0x6f')]['belongsTo'](db[_0x666d('0xdc')],{'as':_0x666d('0xdc'),'foreignKey':_0x666d('0x194'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':_0x666d('0x195')});db[_0x666d('0x71')][_0x666d('0x115')](db['CmContact'],{'as':_0x666d('0x151'),'foreignKey':'ContactId','onDelete':_0x666d('0x105')});db[_0x666d('0x71')][_0x666d('0x115')](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x666d('0x71')]['belongsTo'](db['VoiceQueue'],{'as':_0x666d('0x193'),'foreignKey':'VoiceQueueId','onDelete':_0x666d('0x105')});db[_0x666d('0x71')][_0x666d('0x115')](db['Campaign'],{'as':_0x666d('0xdc'),'foreignKey':_0x666d('0x194'),'onDelete':_0x666d('0x105')});db[_0x666d('0x196')]['hasMany'](db[_0x666d('0x7d')],{'as':{'plural':_0x666d('0x197'),'singular':'OneAll'},'foreignKey':_0x666d('0x198'),'onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x196')][_0x666d('0x108')](db[_0x666d('0x7d')],{'as':{'plural':_0x666d('0x199'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x196')][_0x666d('0x108')](db[_0x666d('0x78')],{'as':_0x666d('0x19a'),'foreignKey':_0x666d('0x19b'),'onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x7b')]['hasMany'](db[_0x666d('0x7b')],{'as':_0x666d('0x156'),'foreignKey':_0x666d('0x19c'),'onDelete':_0x666d('0x105')});db[_0x666d('0x7f')][_0x666d('0x108')](db[_0x666d('0x7f')],{'as':'Intervals','foreignKey':_0x666d('0x167'),'onDelete':_0x666d('0x105'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x666d('0x10c'),'foreignKey':_0x666d('0x167'),'onDelete':_0x666d('0x155')});db['Interval'][_0x666d('0x108')](db['MailApplication'],{'as':_0x666d('0x19d'),'foreignKey':_0x666d('0x167')});db[_0x666d('0x7f')]['hasMany'](db[_0x666d('0x17e')],{'as':_0x666d('0x19e'),'foreignKey':_0x666d('0x167')});db[_0x666d('0x7f')][_0x666d('0x108')](db[_0x666d('0x169')],{'as':_0x666d('0x19f'),'foreignKey':_0x666d('0x167')});db['Interval'][_0x666d('0x108')](db[_0x666d('0x55')],{'as':_0x666d('0x1a0'),'foreignKey':_0x666d('0x167')});db[_0x666d('0x1a1')][_0x666d('0x115')](db[_0x666d('0x3f')],{});db['Schedule'][_0x666d('0x115')](db[_0x666d('0x91')],{'foreignKey':_0x666d('0x1a2')});db[_0x666d('0x1a1')][_0x666d('0x115')](db[_0x666d('0x1a3')],{'foreignKey':_0x666d('0x1a4')});db[_0x666d('0x84')]['belongsToMany'](db[_0x666d('0x13b')],{'as':'Mohs','through':_0x666d('0x13d'),'onDelete':_0x666d('0x155')});db[_0x666d('0x86')]['belongsToMany'](db[_0x666d('0x119')],{'through':_0x666d('0x190')});db[_0x666d('0x86')]['belongsToMany'](db['ChatInteraction'],{'through':_0x666d('0x183')});db[_0x666d('0x86')][_0x666d('0x11c')](db[_0x666d('0x41')],{'through':_0x666d('0x161')});db['Tag'][_0x666d('0x11c')](db[_0x666d('0x57')],{'through':_0x666d('0x174')});db['Tag'][_0x666d('0x11c')](db[_0x666d('0x110')],{'through':_0x666d('0x16d')});db['Tag'][_0x666d('0x11c')](db[_0x666d('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x666d('0x86')]['belongsToMany'](db[_0x666d('0xf4')],{'through':_0x666d('0x1a5')});db[_0x666d('0x89')][_0x666d('0x115')](db[_0x666d('0x88')],{'as':_0x666d('0x1a6'),'foreignKey':_0x666d('0x1a7')});db['CmHopperAdditionalPhone'][_0x666d('0x115')](db[_0x666d('0x6f')],{'as':_0x666d('0x1a8'),'foreignKey':_0x666d('0x192')});db[_0x666d('0x89')]['belongsTo'](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':'CmContactId'});db[_0x666d('0x1a9')]['hasMany'](db[_0x666d('0x7d')],{'as':{'plural':_0x666d('0x1aa'),'singular':_0x666d('0x1ab')},'foreignKey':_0x666d('0x1ac'),'onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x1a9')]['hasMany'](db[_0x666d('0x7d')],{'as':{'plural':_0x666d('0x1ad'),'singular':'AnyCondition'},'foreignKey':_0x666d('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x666d('0x1a9')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x666d('0x1af'),'onDelete':_0x666d('0x105'),'hooks':!![]});db[_0x666d('0x1a3')][_0x666d('0x108')](db[_0x666d('0x95')],{'as':'Fields','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1a4'),'hooks':!![]});db[_0x666d('0x91')][_0x666d('0x108')](db['AnalyticFieldReport'],{'as':_0x666d('0x1b0'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1a2')});db[_0x666d('0x94')][_0x666d('0x108')](db['AnalyticFieldReport'],{'as':_0x666d('0x1b0'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b1')});db[_0x666d('0x95')]['belongsTo'](db[_0x666d('0x94')],{'foreignKey':_0x666d('0x1b1')});db[_0x666d('0x1b2')][_0x666d('0x108')](db[_0x666d('0x99')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x666d('0x1b3')});db[_0x666d('0x99')][_0x666d('0x108')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x99')][_0x666d('0x108')](db[_0x666d('0x9b')],{'as':_0x666d('0x1b5'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x99')]['hasMany'](db[_0x666d('0x9b')],{'as':'Fields','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b7')});db['SalesforceConfiguration'][_0x666d('0x115')](db[_0x666d('0x1b2')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0x9b')][_0x666d('0x108')](db['SalesforceField'],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x9b')]['hasMany'](db[_0x666d('0x9b')],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x9b')][_0x666d('0x108')](db['SalesforceField'],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0x9b')][_0x666d('0x115')](db[_0x666d('0x8e')],{'as':_0x666d('0x8e'),'foreignKey':_0x666d('0x1bb')});db['SugarcrmAccount'][_0x666d('0x108')](db[_0x666d('0x9e')],{'as':_0x666d('0x1bc'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b3')});db['SugarcrmConfiguration'][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':'Subjects','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x9e')][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':_0x666d('0x1b5'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x9e')][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':_0x666d('0x1b0'),'onDelete':_0x666d('0x105'),'foreignKey':'FieldId'});db[_0x666d('0x9e')][_0x666d('0x115')](db['SugarcrmAccount'],{'as':_0x666d('0x15f'),'foreignKey':'AccountId'});db[_0x666d('0x9f')][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x9f')][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':_0x666d('0x1b9'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x666d('0x108')](db[_0x666d('0x9f')],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0x9f')][_0x666d('0x115')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['DeskAccount'][_0x666d('0x108')](db['DeskConfiguration'],{'as':_0x666d('0x1bc'),'onDelete':'cascade','foreignKey':_0x666d('0x1b3')});db[_0x666d('0xa1')][_0x666d('0x108')](db[_0x666d('0xa3')],{'as':_0x666d('0x1bd'),'onDelete':'cascade','foreignKey':_0x666d('0x1b4')});db[_0x666d('0xa1')]['hasMany'](db[_0x666d('0xa3')],{'as':_0x666d('0x1b5'),'onDelete':_0x666d('0x105'),'foreignKey':'DescriptionId'});db[_0x666d('0xa1')]['hasMany'](db['DeskField'],{'as':_0x666d('0x1b0'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b7')});db['DeskConfiguration'][_0x666d('0x115')](db[_0x666d('0xa0')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0xa1')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0x666d('0xa3')][_0x666d('0x108')](db[_0x666d('0xa3')],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0xa3')]['hasMany'](db['DeskField'],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db['DeskField'][_0x666d('0x108')](db[_0x666d('0xa3')],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0xa3')][_0x666d('0x115')](db[_0x666d('0x8e')],{'as':'Variable','foreignKey':_0x666d('0x1bb')});db[_0x666d('0xa5')][_0x666d('0x108')](db[_0x666d('0x1be')],{'as':_0x666d('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZohoConfiguration'][_0x666d('0x108')](db[_0x666d('0xa8')],{'as':_0x666d('0x1bd'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x1be')][_0x666d('0x108')](db[_0x666d('0xa8')],{'as':'Descriptions','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x1be')][_0x666d('0x108')](db[_0x666d('0xa8')],{'as':'Fields','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0x1be')][_0x666d('0x115')](db['ZohoAccount'],{'as':_0x666d('0x15f'),'foreignKey':'AccountId'});db[_0x666d('0xa8')]['hasMany'](db[_0x666d('0xa8')],{'as':'Subject','foreignKey':_0x666d('0x1b4')});db[_0x666d('0xa8')]['hasMany'](db[_0x666d('0xa8')],{'as':_0x666d('0x1b9'),'foreignKey':'DescriptionId'});db[_0x666d('0xa8')][_0x666d('0x108')](db[_0x666d('0xa8')],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0xa8')]['belongsTo'](db[_0x666d('0x8e')],{'as':'Variable','foreignKey':_0x666d('0x1bb')});db[_0x666d('0xaa')]['hasMany'](db[_0x666d('0xab')],{'as':_0x666d('0x1bc'),'onDelete':_0x666d('0x105'),'foreignKey':'AccountId'});db[_0x666d('0xab')][_0x666d('0x108')](db[_0x666d('0x1bf')],{'as':'Subjects','foreignKey':_0x666d('0x1b4')});db[_0x666d('0xab')]['hasMany'](db['ZendeskField'],{'as':_0x666d('0x1b5'),'foreignKey':'DescriptionId'});db[_0x666d('0xab')][_0x666d('0x108')](db[_0x666d('0x1bf')],{'as':_0x666d('0x1b0'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0xab')][_0x666d('0x115')](db[_0x666d('0xaa')],{'as':'Account','foreignKey':'AccountId'});db[_0x666d('0xab')][_0x666d('0x11c')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x666d('0x1bf')]['hasMany'](db[_0x666d('0x1bf')],{'as':'Subject','foreignKey':'SubjectId'});db['ZendeskField'][_0x666d('0x108')](db[_0x666d('0x1bf')],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x1bf')]['hasMany'](db[_0x666d('0x1bf')],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db['ZendeskField'][_0x666d('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0x666d('0x1bb')});db[_0x666d('0xae')][_0x666d('0x108')](db[_0x666d('0x1c0')],{'as':_0x666d('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x666d('0x1c0')][_0x666d('0x108')](db[_0x666d('0xb0')],{'as':_0x666d('0x1bd'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x666d('0x1c0')]['hasMany'](db[_0x666d('0xb0')],{'as':_0x666d('0x1b5'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x1c0')][_0x666d('0x108')](db[_0x666d('0xb0')],{'as':_0x666d('0x1b0'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0x1c0')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0x1c0')]['belongsToMany'](db[_0x666d('0x86')],{'through':_0x666d('0x1c1')});db['FreshdeskField'][_0x666d('0x108')](db[_0x666d('0xb0')],{'as':'Subject','foreignKey':_0x666d('0x1b4')});db[_0x666d('0xb0')][_0x666d('0x108')](db['FreshdeskField'],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0xb0')][_0x666d('0x108')](db[_0x666d('0xb0')],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db['FreshdeskField'][_0x666d('0x115')](db[_0x666d('0x8e')],{'as':'Variable','foreignKey':_0x666d('0x1bb')});db['VtigerAccount'][_0x666d('0x108')](db[_0x666d('0xb4')],{'as':_0x666d('0x1bc'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0xb4')][_0x666d('0x108')](db[_0x666d('0xb5')],{'as':_0x666d('0x1bd'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0xb4')][_0x666d('0x108')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x666d('0x1b6')});db[_0x666d('0xb4')][_0x666d('0x108')](db[_0x666d('0xb5')],{'as':'Fields','foreignKey':'FieldId'});db['VtigerConfiguration'][_0x666d('0x115')](db[_0x666d('0xb2')],{'as':_0x666d('0x15f'),'foreignKey':'AccountId'});db[_0x666d('0xb5')][_0x666d('0x108')](db[_0x666d('0xb5')],{'as':_0x666d('0x1b8'),'foreignKey':'SubjectId'});db[_0x666d('0xb5')]['hasMany'](db[_0x666d('0xb5')],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0xb5')]['hasMany'](db['VtigerField'],{'as':_0x666d('0x1ba'),'foreignKey':'FieldId'});db[_0x666d('0xb5')][_0x666d('0x115')](db['Variable'],{'as':_0x666d('0x8e'),'foreignKey':_0x666d('0x1bb')});db[_0x666d('0x1c2')]['hasMany'](db[_0x666d('0xb8')],{'as':'Configurations','onDelete':_0x666d('0x105'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x666d('0x108')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x666d('0x1b4')});db[_0x666d('0xb8')]['hasMany'](db[_0x666d('0xba')],{'as':_0x666d('0x1b5'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0xb8')][_0x666d('0x108')](db['ServicenowField'],{'as':_0x666d('0x1b0'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0xb8')][_0x666d('0x115')](db[_0x666d('0x1c2')],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0xba')][_0x666d('0x108')](db[_0x666d('0xba')],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0xba')]['hasMany'](db[_0x666d('0xba')],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0xba')]['hasMany'](db[_0x666d('0xba')],{'as':'Field','foreignKey':_0x666d('0x1b7')});db['ServicenowField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['Dynamics365Account'][_0x666d('0x108')](db[_0x666d('0xbe')],{'as':_0x666d('0x1bc'),'onDelete':_0x666d('0x105'),'foreignKey':'AccountId'});db[_0x666d('0xbc')][_0x666d('0x115')](db[_0x666d('0xfb')],{'as':_0x666d('0xfb'),'foreignKey':_0x666d('0x154')});db['Dynamics365Configuration']['hasMany'](db[_0x666d('0x1c3')],{'as':_0x666d('0x1bd'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0xbe')][_0x666d('0x108')](db[_0x666d('0x1c3')],{'as':_0x666d('0x1b5'),'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b6')});db['Dynamics365Configuration'][_0x666d('0x108')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1b7')});db[_0x666d('0xbe')][_0x666d('0x115')](db['Dynamics365Account'],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1b3')});db[_0x666d('0x1c3')][_0x666d('0x108')](db[_0x666d('0x1c3')],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db[_0x666d('0x1c3')][_0x666d('0x108')](db[_0x666d('0x1c3')],{'as':'Description','foreignKey':_0x666d('0x1b6')});db[_0x666d('0x1c3')][_0x666d('0x108')](db['Dynamics365Field'],{'as':_0x666d('0x1ba'),'foreignKey':_0x666d('0x1b7')});db['Dynamics365Field'][_0x666d('0x115')](db[_0x666d('0x8e')],{'as':'Variable','foreignKey':_0x666d('0x1bb')});db[_0x666d('0xc0')][_0x666d('0x108')](db['FreshsalesConfiguration'],{'as':_0x666d('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0x666d('0x1bd'),'foreignKey':_0x666d('0x1b4')});db['FreshsalesConfiguration']['hasMany'](db[_0x666d('0xc2')],{'as':_0x666d('0x1b5'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0x1c4')][_0x666d('0x108')](db[_0x666d('0xc2')],{'as':'Fields','foreignKey':_0x666d('0x1b7')});db[_0x666d('0x1c4')][_0x666d('0x115')](db[_0x666d('0xc0')],{'as':'Account','foreignKey':_0x666d('0x1b3')});db['FreshsalesField'][_0x666d('0x108')](db[_0x666d('0xc2')],{'as':_0x666d('0x1b8'),'foreignKey':_0x666d('0x1b4')});db['FreshsalesField'][_0x666d('0x108')](db[_0x666d('0xc2')],{'as':_0x666d('0x1b9'),'foreignKey':_0x666d('0x1b6')});db[_0x666d('0xc2')][_0x666d('0x108')](db[_0x666d('0xc2')],{'as':'Field','foreignKey':'FieldId'});db[_0x666d('0xc2')]['belongsTo'](db[_0x666d('0x8e')],{'as':_0x666d('0x8e'),'foreignKey':_0x666d('0x1bb')});db['ChatQueueReport'][_0x666d('0x115')](db[_0x666d('0x61')],{});db['ChatQueueReport'][_0x666d('0x115')](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x1c5')][_0x666d('0x115')](db[_0x666d('0x10d')],{});db[_0x666d('0x1c5')][_0x666d('0x115')](db[_0x666d('0x66')],{});db[_0x666d('0x1c5')][_0x666d('0x115')](db[_0x666d('0x12')],{});db[_0x666d('0x1c5')][_0x666d('0x115')](db[_0x666d('0x69')],{});db['ChatInternalMessage'][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1c6')});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1c7')});db[_0x666d('0xca')][_0x666d('0x108')](db[_0x666d('0xc8')],{'foreignKey':_0x666d('0x1c8'),'onDelete':_0x666d('0x105')});db[_0x666d('0xca')][_0x666d('0x108')](db[_0x666d('0xc7')],{'foreignKey':_0x666d('0x1c8'),'onDelete':_0x666d('0x105')});db[_0x666d('0x1c9')][_0x666d('0x115')](db['SmsAccount'],{});db[_0x666d('0x1c9')][_0x666d('0x115')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x666d('0x1c9')]['belongsTo'](db[_0x666d('0x119')],{'as':'Contact','foreignKey':_0x666d('0x152')});db[_0x666d('0x1c9')][_0x666d('0x115')](db[_0x666d('0x57')],{});db[_0x666d('0x1c9')][_0x666d('0x115')](db[_0x666d('0x59')],{});db['SmsQueueReport']['belongsTo'](db[_0x666d('0x12')],{});db[_0x666d('0x1c9')][_0x666d('0x115')](db[_0x666d('0x5b')],{});db['JscriptyProject'][_0x666d('0x108')](db[_0x666d('0xca')],{'foreignKey':_0x666d('0x1ca')});db[_0x666d('0x1cb')][_0x666d('0x108')](db['JscriptyQuestionReport'],{'foreignKey':_0x666d('0x1ca')});db[_0x666d('0x1cb')][_0x666d('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0x666d('0x1ca')});db[_0x666d('0xd3')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Users','through':'user_has_square_projects'});db[_0x666d('0xd8')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Agents','through':_0x666d('0x11f')});db[_0x666d('0xd8')]['belongsToMany'](db[_0x666d('0x1b')],{'through':_0x666d('0xfd'),'as':_0x666d('0x125')});db[_0x666d('0xd8')][_0x666d('0x11c')](db[_0x666d('0x40')],{'through':_0x666d('0x15d'),'as':_0x666d('0x1cc')});db[_0x666d('0xd8')][_0x666d('0x11c')](db[_0x666d('0x69')],{'through':_0x666d('0x186'),'as':_0x666d('0x127')});db[_0x666d('0xd8')][_0x666d('0x11c')](db[_0x666d('0x50')],{'through':_0x666d('0x170'),'as':_0x666d('0x128')});db[_0x666d('0xd8')]['belongsToMany'](db[_0x666d('0x5b')],{'through':_0x666d('0x176'),'as':'SmsQueues'});db[_0x666d('0xd8')][_0x666d('0x11c')](db['OpenchannelQueue'],{'through':_0x666d('0x17c'),'as':_0x666d('0x12b')});db['Team']['belongsToMany'](db[_0x666d('0xf9')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db['Team'][_0x666d('0x11c')](db['VoicePrefix'],{'through':_0x666d('0x1cd'),'as':_0x666d('0x126')});db[_0x666d('0xdc')][_0x666d('0x108')](db[_0x666d('0x6f')],{'as':_0x666d('0x13e'),'foreignKey':_0x666d('0x194')});db[_0x666d('0xdc')][_0x666d('0x108')](db[_0x666d('0x72')],{'as':'HopperFinals','foreignKey':_0x666d('0x194')});db[_0x666d('0xdc')][_0x666d('0x108')](db[_0x666d('0x73')],{'as':_0x666d('0x1ce'),'foreignKey':_0x666d('0x194')});db[_0x666d('0xdc')][_0x666d('0x108')](db[_0x666d('0x71')],{'as':_0x666d('0x140'),'foreignKey':'CampaignId'});db[_0x666d('0xdc')][_0x666d('0x115')](db['Trunk'],{'as':_0x666d('0x2b'),'foreignKey':_0x666d('0x142')});db[_0x666d('0xdc')][_0x666d('0x115')](db['Trunk'],{'as':_0x666d('0x143'),'foreignKey':_0x666d('0x1cf')});db['Campaign'][_0x666d('0x115')](db['Interval'],{'as':'Interval','foreignKey':_0x666d('0x167')});db[_0x666d('0xdc')][_0x666d('0x115')](db[_0x666d('0xd3')],{'as':_0x666d('0xd3'),'foreignKey':_0x666d('0x1d0')});db[_0x666d('0xdc')][_0x666d('0x11c')](db['CmList'],{'as':_0x666d('0x11e'),'through':_0x666d('0x1d1')});db['Campaign']['belongsToMany'](db[_0x666d('0x11d')],{'as':_0x666d('0x149'),'through':_0x666d('0x1d2')});db[_0x666d('0x16e')][_0x666d('0x115')](db[_0x666d('0x166')],{'as':_0x666d('0x166'),'foreignKey':'ChatOfflineMessageId'});db[_0x666d('0xdf')]['belongsTo'](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x666d('0x41')],{});db[_0x666d('0xdf')][_0x666d('0x115')](db['MailAccount'],{'foreignKey':_0x666d('0x1d3'),'as':_0x666d('0x1d4')});db[_0x666d('0xdf')]['belongsTo'](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d5'),'as':_0x666d('0x1d6')});db[_0x666d('0xdf')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d7'),'as':_0x666d('0x1d8')});db['MailTransferReport']['belongsTo'](db[_0x666d('0x40')],{'foreignKey':'ToMailQueueId','as':_0x666d('0x1d9')});db[_0x666d('0xdf')][_0x666d('0x115')](db[_0x666d('0x3f')],{'foreignKey':_0x666d('0x1da'),'as':_0x666d('0x1db')});db[_0x666d('0x1dc')][_0x666d('0x115')](db[_0x666d('0x66')],{});db[_0x666d('0x1dc')]['belongsTo'](db[_0x666d('0x10d')],{});db[_0x666d('0x1dc')][_0x666d('0x115')](db[_0x666d('0x61')],{'foreignKey':_0x666d('0x1dd'),'as':'FromAccount'});db[_0x666d('0x1dc')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d5'),'as':_0x666d('0x1d6')});db[_0x666d('0x1dc')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':'ToUserId','as':_0x666d('0x1d8')});db[_0x666d('0x1dc')][_0x666d('0x115')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x666d('0x1d9')});db[_0x666d('0x1dc')][_0x666d('0x115')](db[_0x666d('0x61')],{'foreignKey':_0x666d('0x1de'),'as':_0x666d('0x1db')});db['FaxTransferReport'][_0x666d('0x115')](db[_0x666d('0x4f')],{});db[_0x666d('0xe2')][_0x666d('0x115')](db[_0x666d('0x110')],{});db[_0x666d('0xe2')][_0x666d('0x115')](db[_0x666d('0x4c')],{'foreignKey':_0x666d('0x1df'),'as':_0x666d('0x1d4')});db['FaxTransferReport']['belongsTo'](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d5'),'as':_0x666d('0x1d6')});db[_0x666d('0xe2')][_0x666d('0x115')](db['User'],{'foreignKey':_0x666d('0x1d7'),'as':_0x666d('0x1d8')});db[_0x666d('0xe2')][_0x666d('0x115')](db[_0x666d('0x50')],{'foreignKey':_0x666d('0x1e0'),'as':_0x666d('0x1d9')});db[_0x666d('0xe2')][_0x666d('0x115')](db[_0x666d('0x4c')],{'foreignKey':_0x666d('0x1e1'),'as':_0x666d('0x1db')});db['OpenchannelTransferReport'][_0x666d('0x115')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x666d('0x5f')],{});db[_0x666d('0xe4')][_0x666d('0x115')](db[_0x666d('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x666d('0x1d4')});db[_0x666d('0xe4')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d5'),'as':_0x666d('0x1d6')});db[_0x666d('0xe4')]['belongsTo'](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d7'),'as':_0x666d('0x1d8')});db[_0x666d('0xe4')]['belongsTo'](db[_0x666d('0x12a')],{'foreignKey':_0x666d('0x1e2'),'as':_0x666d('0x1d9')});db[_0x666d('0xe4')][_0x666d('0x115')](db[_0x666d('0x5d')],{'foreignKey':_0x666d('0x1e3'),'as':_0x666d('0x1db')});db['SmsTransferReport'][_0x666d('0x115')](db[_0x666d('0x59')],{});db[_0x666d('0xe6')][_0x666d('0x115')](db[_0x666d('0x57')],{});db[_0x666d('0xe6')][_0x666d('0x115')](db[_0x666d('0x53')],{'foreignKey':'FromSmsAccountId','as':_0x666d('0x1d4')});db[_0x666d('0xe6')]['belongsTo'](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d5'),'as':_0x666d('0x1d6')});db[_0x666d('0xe6')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d7'),'as':_0x666d('0x1d8')});db['SmsTransferReport'][_0x666d('0x115')](db[_0x666d('0x5b')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0x666d('0x115')](db[_0x666d('0x53')],{'foreignKey':_0x666d('0x1e4'),'as':'ToAccount'});db['CmList']['hasMany'](db['Disposition'],{'as':_0x666d('0x156'),'foreignKey':_0x666d('0x15a'),'onDelete':_0x666d('0x105')});db[_0x666d('0x11d')][_0x666d('0x108')](db[_0x666d('0x76')],{'as':'CustomFields','foreignKey':_0x666d('0x15a')});db[_0x666d('0x11d')]['hasMany'](db[_0x666d('0x119')],{'as':'Contacts','onDelete':_0x666d('0x105'),'foreignKey':'ListId'});db['CmList'][_0x666d('0x108')](db[_0x666d('0x72')],{'as':_0x666d('0x18d'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x11d')]['hasMany'](db[_0x666d('0x73')],{'as':_0x666d('0x1e5'),'foreignKey':_0x666d('0x15a')});db['CmList']['hasMany'](db[_0x666d('0x74')],{'as':_0x666d('0x74'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0x11d')]['belongsToMany'](db[_0x666d('0x1b')],{'as':_0x666d('0x1e6'),'through':'voice_queues_has_cm_lists'});db[_0x666d('0x11d')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Agents','through':_0x666d('0x12c')});db[_0x666d('0xe8')][_0x666d('0x108')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x666d('0x105')});db[_0x666d('0xe8')][_0x666d('0x11c')](db['User'],{'as':_0x666d('0x147'),'through':_0x666d('0x100')});db[_0x666d('0xe8')][_0x666d('0x11c')](db['Team'],{'through':'TeamVoicePrefix','as':_0x666d('0x148')});db[_0x666d('0xea')][_0x666d('0x108')](db[_0x666d('0x12')],{'as':_0x666d('0x163'),'foreignKey':_0x666d('0x116')});db[_0x666d('0xea')]['hasMany'](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x666d('0x116'),'onDelete':_0x666d('0x105')});db[_0x666d('0xec')][_0x666d('0x108')](db[_0x666d('0x1e7')],{'as':'Resources','foreignKey':_0x666d('0x1e8'),'onDelete':_0x666d('0x105')});db['WhatsappAccount'][_0x666d('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x666d('0x105')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0x666d('0x157'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x666d('0x108')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0x666d('0x1e9')});db[_0x666d('0xf0')]['hasMany'](db['WhatsappInteraction'],{'as':_0x666d('0x158')});db[_0x666d('0xf0')]['hasMany'](db['WhatsappApplication'],{'as':'Applications'});db[_0x666d('0xf0')]['belongsTo'](db[_0x666d('0x11d')],{'as':_0x666d('0x159'),'foreignKey':_0x666d('0x15a')});db[_0x666d('0xf0')][_0x666d('0x115')](db['Pause'],{'as':_0x666d('0x144'),'foreignKey':_0x666d('0x145')});db[_0x666d('0xf0')][_0x666d('0x11c')](db['User'],{'as':_0x666d('0x147'),'through':'user_has_whatsapp_accounts'});db[_0x666d('0xf2')][_0x666d('0x115')](db[_0x666d('0x12')],{'onDelete':'restrict'});db[_0x666d('0xf2')]['belongsTo'](db[_0x666d('0xf9')],{'onDelete':_0x666d('0x155')});db[_0x666d('0xf2')][_0x666d('0x115')](db[_0x666d('0xf0')],{'onDelete':_0x666d('0x155')});db[_0x666d('0xf2')][_0x666d('0x115')](db[_0x666d('0x7f')],{'onDelete':_0x666d('0x155'),'foreignKey':'IntervalId'});db[_0x666d('0xf2')][_0x666d('0x115')](db[_0x666d('0x86')],{'onDelete':_0x666d('0x155'),'foreignKey':_0x666d('0x16b')});db[_0x666d('0xf4')]['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x666d('0x105'),'foreignKey':_0x666d('0x1ea')});db['WhatsappInteraction'][_0x666d('0x115')](db[_0x666d('0xf0')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x666d('0xf4')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':'Contact','foreignKey':_0x666d('0x152')});db['WhatsappInteraction'][_0x666d('0x115')](db[_0x666d('0x12')],{'as':_0x666d('0x160'),'foreignKey':_0x666d('0x106')});db[_0x666d('0xf4')]['belongsToMany'](db['Tag'],{'through':_0x666d('0x1a5'),'as':_0x666d('0x162')});db[_0x666d('0xf4')][_0x666d('0x11c')](db[_0x666d('0x86')],{'through':_0x666d('0x1a5'),'as':_0x666d('0x191')});db[_0x666d('0xf4')][_0x666d('0x11c')](db[_0x666d('0x12')],{'as':'Users','through':_0x666d('0x1eb'),'foreignKey':_0x666d('0x1ea')});db[_0x666d('0x1ec')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':'User'});db[_0x666d('0x1ec')][_0x666d('0x115')](db[_0x666d('0x119')],{'onDelete':_0x666d('0x105'),'as':_0x666d('0x151')});db[_0x666d('0x1ec')][_0x666d('0x115')](db[_0x666d('0xf4')],{'onDelete':'cascade','as':_0x666d('0x164'),'foreignKey':_0x666d('0x1ea')});db[_0x666d('0x1ec')][_0x666d('0x115')](db['WhatsappAccount'],{'as':_0x666d('0x15f'),'foreignKey':_0x666d('0x1e9')});db[_0x666d('0x1ed')][_0x666d('0x115')](db[_0x666d('0xf0')],{});db[_0x666d('0x1ed')]['belongsTo'](db[_0x666d('0x11d')],{'as':'List','foreignKey':_0x666d('0x15a')});db[_0x666d('0x1ed')][_0x666d('0x115')](db[_0x666d('0x119')],{'as':_0x666d('0x151'),'foreignKey':_0x666d('0x152')});db[_0x666d('0x1ed')][_0x666d('0x115')](db[_0x666d('0xf4')],{});db[_0x666d('0x1ed')][_0x666d('0x115')](db[_0x666d('0xf9')],{});db[_0x666d('0x1ed')][_0x666d('0x115')](db[_0x666d('0x1ec')],{});db[_0x666d('0x1ed')]['belongsTo'](db[_0x666d('0x12')],{});db[_0x666d('0xf7')]['belongsTo'](db[_0x666d('0x1ec')],{});db[_0x666d('0xf7')][_0x666d('0x115')](db[_0x666d('0xf4')],{});db[_0x666d('0xf7')][_0x666d('0x115')](db[_0x666d('0xf0')],{'foreignKey':_0x666d('0x1ee'),'as':_0x666d('0x1d4')});db[_0x666d('0xf7')][_0x666d('0x115')](db[_0x666d('0xf0')],{'foreignKey':_0x666d('0x1ef'),'as':_0x666d('0x1db')});db['WhatsappTransferReport'][_0x666d('0x115')](db['WhatsappQueue'],{'foreignKey':_0x666d('0x1f0'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':'FromUserId','as':_0x666d('0x1d6')});db[_0x666d('0xf7')][_0x666d('0x115')](db[_0x666d('0x12')],{'foreignKey':_0x666d('0x1d7'),'as':_0x666d('0x1d8')});db[_0x666d('0xf9')]['belongsToMany'](db[_0x666d('0x12')],{'as':'Agents','through':_0x666d('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0x666d('0xf9')]['belongsToMany'](db[_0x666d('0xd8')],{'through':_0x666d('0x1f1'),'as':_0x666d('0x148')});db[_0x666d('0x102')][_0x666d('0x115')](db[_0x666d('0x12')],{'as':'user','foreignKey':_0x666d('0x106'),'onDelete':'cascade','hooks':!![]});db[_0x666d('0xfb')][_0x666d('0x104')](db[_0x666d('0xbc')],{'as':_0x666d('0xbc'),'onDelete':_0x666d('0x155')});db[_0x666d('0xfb')][_0x666d('0x104')](db[_0x666d('0x3b')],{'as':_0x666d('0x1f2'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0x666d('0x3d')],{'as':_0x666d('0x1f3'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1f37=['../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','License','Campaign','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefix','VoicePrefixes','MailQueues','ChatQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','FaxAccounts','MailAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Team','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','VoiceCallReport','QueueCalls','Contact','CloudProviderId','restrict','MailServerOut','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Messages','Interactions','MailApplication','ListId','TemplateId','Pause','user_has_mail_accounts','team_has_mail_queues','MailMessage','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','MailInteractionId','Account','ChatWebsiteId','ChatOfflineMessageId','DashboardItem','Items','FaxAccountId','Applications','List','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','Tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ProactiveActions','user_has_chat_websites','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','Contacts','CompanyId','CmContactId','JscriptySessionReport','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','Queue','All','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','Extensions','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticMetric','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','SugarcrmAccount','Subject','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','TeamVoiceQueue','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','HopperHistories','TrunkBackup','campaigns_has_cm_lists','MailTransferReport','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','FromUserId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','voice_queues_has_cm_lists','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueId','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../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','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model'];(function(_0x4536d7,_0x2c14bd){var _0x268280=function(_0x36b137){while(--_0x36b137){_0x4536d7['push'](_0x4536d7['shift']());}};_0x268280(++_0x2c14bd);}(_0x1f37,0x18a));var _0x71f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1f37[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0x71f3('0x0'));var Sequelize=require(_0x71f3('0x1'));var _=require(_0x71f3('0x2'));var jstz=require(_0x71f3('0x3'));var timezone=jstz[_0x71f3('0x4')]();config[_0x71f3('0x1')]=_['defaultsDeep'](config[_0x71f3('0x1')],{'database':_0x71f3('0x5'),'username':_0x71f3('0x6'),'password':_0x71f3('0x7'),'options':{'host':_0x71f3('0x8'),'port':0xcea,'dialect':_0x71f3('0x9'),'dialectOptions':{'charset':_0x71f3('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x71f3('0xb'),'collate':_0x71f3('0xc')}}});config[_0x71f3('0xd')]=_['defaultsDeep'](config[_0x71f3('0xd')],{'database':_0x71f3('0x5'),'username':_0x71f3('0x6'),'password':_0x71f3('0x7'),'options':{'host':_0x71f3('0x8'),'port':0xcea,'dialect':_0x71f3('0x9'),'dialectOptions':{'charset':_0x71f3('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x71f3('0xe')],config[_0x71f3('0x1')]['username'],config[_0x71f3('0x1')][_0x71f3('0xf')],config[_0x71f3('0x1')][_0x71f3('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x71f3('0xd')][_0x71f3('0xe')],config[_0x71f3('0xd')][_0x71f3('0x11')],config['sequelizeHistory'][_0x71f3('0xf')],config['sequelizeHistory']['options'])};db[_0x71f3('0x12')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x14'));db[_0x71f3('0x15')]=db['sequelize']['import'](_0x71f3('0x16'));db[_0x71f3('0x17')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x18'));db['VoiceExtension']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x71f3('0x19')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x1a'));db[_0x71f3('0x1b')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x1c'));db[_0x71f3('0x1d')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x1e'));db[_0x71f3('0x1f')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x20'));db[_0x71f3('0x21')]=db['sequelize'][_0x71f3('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x71f3('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x71f3('0x22')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x23'));db[_0x71f3('0x24')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x25'));db[_0x71f3('0x26')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x27'));db[_0x71f3('0x28')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x29'));db[_0x71f3('0x2a')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x2b'));db[_0x71f3('0x2c')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x2d'));db[_0x71f3('0x2e')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x2f'));db['UserVoiceQueue']=db[_0x71f3('0x1')]['import'](_0x71f3('0x30'));db[_0x71f3('0x31')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x32'));db[_0x71f3('0x33')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x34'));db[_0x71f3('0x35')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x36'));db['UserSmsQueue']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x37'));db[_0x71f3('0x38')]=db['sequelize'][_0x71f3('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x71f3('0x39')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x3a'));db[_0x71f3('0x3b')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x3c'));db['MailServerOut']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x3d'));db[_0x71f3('0x3e')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x3f'));db[_0x71f3('0x40')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x41'));db['MailSubstatus']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x42'));db[_0x71f3('0x43')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x44'));db['MailMessage']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x45'));db['MailApplication']=db['sequelize']['import'](_0x71f3('0x46'));db[_0x71f3('0x47')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x48'));db[_0x71f3('0x49')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x4a'));db[_0x71f3('0x4b')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x4c'));db[_0x71f3('0x4d')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x4e'));db[_0x71f3('0x4f')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x50'));db[_0x71f3('0x51')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x52'));db[_0x71f3('0x53')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x54'));db[_0x71f3('0x55')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x56'));db['SmsAccount']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/smsAccount/smsAccount.model');db[_0x71f3('0x57')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x58'));db[_0x71f3('0x59')]=db['sequelize'][_0x71f3('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x5a'));db[_0x71f3('0x5b')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/smsQueue/smsQueue.model');db[_0x71f3('0x5c')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x5d'));db[_0x71f3('0x5e')]=db['sequelize']['import'](_0x71f3('0x5f'));db[_0x71f3('0x60')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x71f3('0x61')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x62'));db[_0x71f3('0x63')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x64'));db[_0x71f3('0x65')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x66'));db[_0x71f3('0x67')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x68'));db[_0x71f3('0x69')]=db[_0x71f3('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0x71f3('0x6a')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x6b'));db[_0x71f3('0x6c')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x6d'));db[_0x71f3('0x6e')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x6f'));db['ChatQueue']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x70'));db['ChatGroup']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x71'));db[_0x71f3('0x72')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x73'));db[_0x71f3('0x74')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x75'));db[_0x71f3('0x76')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x77'));db[_0x71f3('0x78')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x79'));db[_0x71f3('0x7a')]=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x71f3('0x7b')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x7c'));db[_0x71f3('0x7d')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x7e'));db[_0x71f3('0x7f')]=db['sequelize']['import'](_0x71f3('0x80'));db[_0x71f3('0x81')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x82'));db['Action']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x83'));db[_0x71f3('0x84')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/automation/automation.model');db[_0x71f3('0x85')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x86'));db['Disposition']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x87'));db[_0x71f3('0x88')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x89'));db[_0x71f3('0x8a')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x71f3('0x13')]('../api/pause/pause.model');db['Cdr']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x8b'));db[_0x71f3('0x8c')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x8d'));db['Schedule']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x8e'));db['Sound']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x8f'));db[_0x71f3('0x90')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x91'));db[_0x71f3('0x92')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x93'));db[_0x71f3('0x94')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x95'));db[_0x71f3('0x96')]=db['sequelize']['import'](_0x71f3('0x97'));db[_0x71f3('0x98')]=db['sequelize'][_0x71f3('0x13')]('../api/template/template.model');db[_0x71f3('0x99')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x9a'));db[_0x71f3('0x9b')]=db['sequelize']['import'](_0x71f3('0x9c'));db[_0x71f3('0x9d')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x9e'));db['IntegrationReport']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x9f'));db[_0x71f3('0xa0')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xa1'));db[_0x71f3('0xa2')]=db['sequelize']['import'](_0x71f3('0xa3'));db[_0x71f3('0xa4')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xa5'));db[_0x71f3('0xa6')]=db['sequelize'][_0x71f3('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xa7'));db[_0x71f3('0xa8')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xa9'));db[_0x71f3('0xaa')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xab'));db['SalesforceField']=db['sequelize'][_0x71f3('0x13')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xac'));db[_0x71f3('0xad')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xae'));db[_0x71f3('0xaf')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xb0'));db[_0x71f3('0xb1')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xb2'));db[_0x71f3('0xb3')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xb4'));db['DeskField']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xb5'));db[_0x71f3('0xb6')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xb7'));db[_0x71f3('0xb8')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xb9'));db[_0x71f3('0xba')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xbb'));db[_0x71f3('0xbc')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xbd'));db[_0x71f3('0xbe')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xbf'));db[_0x71f3('0xc0')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xc1'));db[_0x71f3('0xc2')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xc3'));db[_0x71f3('0xc4')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xc5'));db[_0x71f3('0xc6')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xc7'));db[_0x71f3('0xc8')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x71f3('0xc9')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xca'));db['VtigerField']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xcb'));db[_0x71f3('0xcc')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xcd'));db[_0x71f3('0xce')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x71f3('0x1')]['import'](_0x71f3('0xcf'));db['Dynamics365Account']=db[_0x71f3('0x1')]['import'](_0x71f3('0xd0'));db[_0x71f3('0xd1')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xd2'));db[_0x71f3('0xd3')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xd4'));db[_0x71f3('0xd5')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x71f3('0xd6')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x71f3('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x71f3('0x9d')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/integration/integration.model');db[_0x71f3('0xd7')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xd8'));db[_0x71f3('0xd9')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xda'));db[_0x71f3('0xdb')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xdc'));db['JscriptyAnswerReport']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x71f3('0x1')]['import'](_0x71f3('0xdd'));db['JscriptySessionReport']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x71f3('0xde')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xdf'));db['SquareReport']=db[_0x71f3('0x1')]['import'](_0x71f3('0xe0'));db[_0x71f3('0xe1')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x71f3('0xe2')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xe3'));db[_0x71f3('0xe4')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xe5'));db[_0x71f3('0xe6')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xe7'));db[_0x71f3('0xe8')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xe9'));db[_0x71f3('0xea')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xeb'));db['SquareMessage']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xec'));db[_0x71f3('0xed')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/license/license.model');db[_0x71f3('0xee')]=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xef'));db[_0x71f3('0xf0')]=db['sequelize'][_0x71f3('0x13')]('../api/attachment/attachment.model');db[_0x71f3('0xf1')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xf2'));db['MailTransferReport']=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xf3'));db[_0x71f3('0xf4')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xf5'));db['FaxTransferReport']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x71f3('0x1')][_0x71f3('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x71f3('0xf6')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xf7'));db['VoicePrefix']=db['sequelize'][_0x71f3('0x13')](_0x71f3('0xf8'));db[_0x71f3('0xf9')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0xfa'));db[_0x71f3('0xfb')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xfc'));db[_0x71f3('0xfd')]=db[_0x71f3('0x1')]['import'](_0x71f3('0xfe'));db[_0x71f3('0xff')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x100'));db[_0x71f3('0x101')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x102'));db[_0x71f3('0x103')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x104'));db[_0x71f3('0x105')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x106'));db[_0x71f3('0x107')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x108'));db[_0x71f3('0x109')]=db[_0x71f3('0x1')]['import'](_0x71f3('0x10a'));db[_0x71f3('0x10b')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x10c'));db[_0x71f3('0x10d')]=db['sequelize'][_0x71f3('0x13')](_0x71f3('0x10e'));db[_0x71f3('0x10f')]=db['sequelize']['import'](_0x71f3('0x110'));db['TeamVoiceQueue']=db[_0x71f3('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x71f3('0x111')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x112'));db[_0x71f3('0x113')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x114'));db[_0x71f3('0x115')]=db[_0x71f3('0x1')][_0x71f3('0x13')](_0x71f3('0x116'));db[_0x71f3('0x12')][_0x71f3('0x117')](db[_0x71f3('0x1f')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')][_0x71f3('0x117')](db[_0x71f3('0x115')],{'as':_0x71f3('0x119'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')][_0x71f3('0x11b')](db['VoiceRecording'],{'as':_0x71f3('0x11c'),'foreignKey':_0x71f3('0x118')});db['User'][_0x71f3('0x11b')](db['UserVoiceQueueRt'],{'as':_0x71f3('0x11d'),'foreignKey':_0x71f3('0x118')});db['User'][_0x71f3('0x11b')](db[_0x71f3('0x11e')],{'as':'Extensions','onDelete':_0x71f3('0x11a'),'hooks':!![]});db[_0x71f3('0x12')]['hasMany'](db[_0x71f3('0x7b')],{'as':_0x71f3('0x11f'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')][_0x71f3('0x11b')](db[_0x71f3('0x7d')],{'as':_0x71f3('0x120'),'foreignKey':'UserId'});db[_0x71f3('0x12')][_0x71f3('0x11b')](db['ReportAgentPreview'],{'as':_0x71f3('0x7f'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')][_0x71f3('0x11b')](db[_0x71f3('0x60')],{'as':_0x71f3('0x121'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')]['hasMany'](db[_0x71f3('0x6a')],{'as':_0x71f3('0x122'),'foreignKey':'UserId'});db['User'][_0x71f3('0x11b')](db['SmsInteraction'],{'as':_0x71f3('0x123'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')][_0x71f3('0x11b')](db[_0x71f3('0x4f')],{'as':_0x71f3('0x124'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')]['hasMany'](db[_0x71f3('0x43')],{'as':_0x71f3('0x125'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x12')]['hasMany'](db[_0x71f3('0x105')],{'as':_0x71f3('0x126'),'foreignKey':'UserId'});db[_0x71f3('0x12')][_0x71f3('0x11b')](db[_0x71f3('0xff')],{'as':_0x71f3('0x127'),'foreignKey':_0x71f3('0x128')});db[_0x71f3('0x12')][_0x71f3('0x129')](db[_0x71f3('0xf9')],{'as':_0x71f3('0xf9'),'foreignKey':_0x71f3('0x12a')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x12c')],{'as':_0x71f3('0x12d'),'through':'chat_group_has_users'});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x76')],{'as':'Contacts','through':_0x71f3('0x12e')});db['User']['belongsToMany'](db[_0x71f3('0xf6')],{'as':_0x71f3('0x12f'),'through':_0x71f3('0x130')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db['Team'],{'through':_0x71f3('0x131')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db['MailInteraction'],{'as':_0x71f3('0x125'),'through':_0x71f3('0x132')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x4f')],{'as':_0x71f3('0x124'),'through':_0x71f3('0x133')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x59')],{'as':_0x71f3('0x123'),'through':'user_has_sms_interactions'});db['User'][_0x71f3('0x12b')](db[_0x71f3('0x60')],{'as':_0x71f3('0x121'),'through':'user_has_openchannel_interactions'});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x105')],{'as':_0x71f3('0x126'),'through':_0x71f3('0x134')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x1b')],{'as':_0x71f3('0x135'),'through':_0x71f3('0x136'),'required':![]});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x137')],{'as':_0x71f3('0x138'),'through':_0x71f3('0x113'),'required':![]});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x40')],{'as':_0x71f3('0x139'),'through':'UserMailQueue','required':![]});db[_0x71f3('0x12')]['belongsToMany'](db[_0x71f3('0x13a')],{'as':'ChatQueues','through':_0x71f3('0x31'),'required':![],'hooks':!![]});db[_0x71f3('0x12')]['belongsToMany'](db[_0x71f3('0x53')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User'][_0x71f3('0x12b')](db['SmsQueue'],{'as':_0x71f3('0x13b'),'through':_0x71f3('0x13c'),'required':![]});db['User'][_0x71f3('0x12b')](db[_0x71f3('0x63')],{'as':_0x71f3('0x13d'),'through':_0x71f3('0x38'),'required':![]});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x10d')],{'as':_0x71f3('0x13e'),'through':'UserWhatsappQueue','required':![]});db[_0x71f3('0x12')][_0x71f3('0x12b')](db['CmList'],{'through':_0x71f3('0x130')});db[_0x71f3('0x12')]['belongsToMany'](db[_0x71f3('0x65')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x4b')],{'as':_0x71f3('0x13f'),'through':'user_has_fax_accounts'});db['User'][_0x71f3('0x12b')](db[_0x71f3('0x3e')],{'as':_0x71f3('0x140'),'through':'user_has_mail_accounts'});db['User'][_0x71f3('0x12b')](db[_0x71f3('0x5c')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x141')],{'as':_0x71f3('0x142'),'through':_0x71f3('0x143')});db[_0x71f3('0x12')][_0x71f3('0x12b')](db[_0x71f3('0x101')],{'as':'WhatsappAccounts','through':_0x71f3('0x144')});db['User']['belongsToMany'](db[_0x71f3('0xe8')],{'as':_0x71f3('0x145'),'through':_0x71f3('0x146')});db[_0x71f3('0x15')]['hasMany'](db[_0x71f3('0x11e')],{'as':'SpiedAgents','onDelete':_0x71f3('0x11a'),'foreignKey':'ChanSpyId'});db[_0x71f3('0x17')]['hasMany'](db[_0x71f3('0x11e')],{'onDelete':'cascade'});db[_0x71f3('0x11e')]['hasMany'](db[_0x71f3('0x11e')],{'as':'Applications','onDelete':'cascade'});db[_0x71f3('0x19')]['belongsToMany'](db[_0x71f3('0x147')],{'as':_0x71f3('0x148'),'through':_0x71f3('0x149')});db[_0x71f3('0x1b')][_0x71f3('0x11b')](db[_0x71f3('0x2e')],{'as':_0x71f3('0x14a'),'foreignKey':_0x71f3('0x14b')});db[_0x71f3('0x1b')][_0x71f3('0x11b')](db[_0x71f3('0x78')],{'as':_0x71f3('0x14c'),'foreignKey':'VoiceQueueId'});db[_0x71f3('0x1b')][_0x71f3('0x11b')](db[_0x71f3('0x7b')],{'as':_0x71f3('0x11f'),'foreignKey':_0x71f3('0x14b')});db[_0x71f3('0x1b')][_0x71f3('0x11b')](db[_0x71f3('0x7d')],{'as':'HopperHistories','foreignKey':_0x71f3('0x14b')});db[_0x71f3('0x1b')]['hasMany'](db[_0x71f3('0x7f')],{'as':_0x71f3('0x7f'),'foreignKey':_0x71f3('0x14b')});db['VoiceQueue']['hasMany'](db[_0x71f3('0x7a')],{'as':_0x71f3('0x14d'),'foreignKey':_0x71f3('0x14b')});db['VoiceQueue'][_0x71f3('0x11b')](db['JscriptySessionReport'],{'as':_0x71f3('0x14e'),'foreignKey':_0x71f3('0x14b')});db[_0x71f3('0x1b')]['belongsTo'](db[_0x71f3('0x2a')],{'as':_0x71f3('0x2a'),'foreignKey':_0x71f3('0x14f')});db[_0x71f3('0x1b')]['belongsTo'](db[_0x71f3('0x2a')],{'as':'TrunkBackup','foreignKey':_0x71f3('0x150')});db[_0x71f3('0x1b')][_0x71f3('0x129')](db[_0x71f3('0x8a')],{'as':_0x71f3('0x8a'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x1b')][_0x71f3('0x129')](db['Pause'],{'as':_0x71f3('0x152'),'foreignKey':_0x71f3('0x153')});db[_0x71f3('0x1b')][_0x71f3('0x12b')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x12f'),'through':'voice_queues_has_cm_lists'});db[_0x71f3('0x1b')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':'UserVoiceQueue'});db[_0x71f3('0x1b')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'as':_0x71f3('0x156'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x71f3('0xf6')],{'as':_0x71f3('0x157'),'through':_0x71f3('0x158')});db[_0x71f3('0x1d')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x12'),'foreignKey':_0x71f3('0x118')});db['ScreenRecording'][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x12'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x1f')][_0x71f3('0x11b')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x159'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x71f3('0x159'),'targetKey':'mailbox'});db[_0x71f3('0x15a')]['hasMany'](db[_0x71f3('0x26')],{'as':_0x71f3('0x15b'),'foreignKey':'uniqueid','constraints':![]});db[_0x71f3('0x15a')][_0x71f3('0x11b')](db[_0x71f3('0x24')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x71f3('0x15a')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x12'),'foreignKey':_0x71f3('0x118')});db['VoiceCallReport'][_0x71f3('0x129')](db['CmContact'],{'as':_0x71f3('0x15c'),'foreignKey':'ContactId'});db['MailServerIn'][_0x71f3('0x129')](db[_0x71f3('0x3e')],{'as':_0x71f3('0x3e'),'foreignKey':'MailAccountId'});db[_0x71f3('0x3b')][_0x71f3('0x129')](db[_0x71f3('0x10f')],{'as':_0x71f3('0x10f'),'foreignKey':_0x71f3('0x15d'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x15f')][_0x71f3('0x129')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x71f3('0x160')});db[_0x71f3('0x15f')][_0x71f3('0x129')](db['CloudProvider'],{'as':_0x71f3('0x10f'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x71f3('0x3e')][_0x71f3('0x117')](db['MailServerIn'],{'as':_0x71f3('0x161'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x3e')][_0x71f3('0x117')](db[_0x71f3('0x15f')],{'as':_0x71f3('0x162'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x3e')]['hasMany'](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':'MailAccountId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x3e')][_0x71f3('0x11b')](db[_0x71f3('0x85')],{'as':_0x71f3('0x165'),'foreignKey':_0x71f3('0x160')});db[_0x71f3('0x3e')]['hasMany'](db['MailMessage'],{'as':_0x71f3('0x166'),'foreignKey':_0x71f3('0x160')});db[_0x71f3('0x3e')][_0x71f3('0x11b')](db[_0x71f3('0x43')],{'as':_0x71f3('0x167')});db[_0x71f3('0x3e')][_0x71f3('0x11b')](db[_0x71f3('0x168')],{'as':'Applications'});db[_0x71f3('0x3e')][_0x71f3('0x129')](db['CmList'],{'as':'List','foreignKey':_0x71f3('0x169')});db[_0x71f3('0x3e')][_0x71f3('0x129')](db[_0x71f3('0x98')],{'as':'Template','foreignKey':_0x71f3('0x16a')});db[_0x71f3('0x3e')]['belongsTo'](db[_0x71f3('0x16b')],{'as':_0x71f3('0x152'),'foreignKey':_0x71f3('0x153')});db[_0x71f3('0x3e')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x16c')});db['MailQueue']['belongsToMany'](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x33')});db[_0x71f3('0x40')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':_0x71f3('0x16d'),'as':'Teams'});db[_0x71f3('0x43')][_0x71f3('0x11b')](db[_0x71f3('0x16e')],{'as':_0x71f3('0x166'),'onDelete':_0x71f3('0x11a'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x71f3('0x129')](db[_0x71f3('0x3e')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x71f3('0x43')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x43')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x170'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x43')][_0x71f3('0x12b')](db['Tag'],{'through':_0x71f3('0x171'),'as':'Tags'});db[_0x71f3('0x43')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x171'),'as':_0x71f3('0x172')});db[_0x71f3('0x43')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x173'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x71f3('0x16e')][_0x71f3('0x11b')](db[_0x71f3('0xf0')],{'as':_0x71f3('0x174'),'onDelete':'cascade'});db[_0x71f3('0x16e')][_0x71f3('0x129')](db['User'],{'as':_0x71f3('0x12')});db[_0x71f3('0x16e')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':'cascade','as':_0x71f3('0x15c')});db['MailMessage'][_0x71f3('0x129')](db[_0x71f3('0x43')],{'as':_0x71f3('0x175'),'foreignKey':_0x71f3('0x176')});db[_0x71f3('0x16e')]['belongsTo'](db[_0x71f3('0x3e')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x160')});db[_0x71f3('0x16e')]['belongsTo'](db[_0x71f3('0x65')],{'as':_0x71f3('0x65'),'foreignKey':_0x71f3('0x178')});db[_0x71f3('0x16e')][_0x71f3('0x129')](db['ChatOfflineMessage'],{'as':_0x71f3('0x6e'),'foreignKey':_0x71f3('0x179')});db[_0x71f3('0x168')][_0x71f3('0x129')](db['User'],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x168')][_0x71f3('0x129')](db[_0x71f3('0x40')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x168')]['belongsTo'](db[_0x71f3('0x3e')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x168')][_0x71f3('0x129')](db[_0x71f3('0x8a')],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x151')});db['MailApplication'][_0x71f3('0x129')](db[_0x71f3('0x90')],{'onDelete':_0x71f3('0x15e'),'foreignKey':'TagId'});db[_0x71f3('0x47')][_0x71f3('0x129')](db[_0x71f3('0x3e')],{});db[_0x71f3('0x47')]['belongsTo'](db[_0x71f3('0xf6')],{'as':'List','foreignKey':_0x71f3('0x169')});db[_0x71f3('0x47')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db['MailQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x43')],{});db[_0x71f3('0x47')][_0x71f3('0x129')](db[_0x71f3('0x16e')],{});db['MailQueueReport']['belongsTo'](db[_0x71f3('0x12')],{});db[_0x71f3('0x47')][_0x71f3('0x129')](db[_0x71f3('0x40')],{});db[_0x71f3('0x49')][_0x71f3('0x11b')](db[_0x71f3('0x17a')],{'as':_0x71f3('0x17b'),'onDelete':'cascade'});db[_0x71f3('0x4b')][_0x71f3('0x11b')](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':'FaxAccountId','onDelete':_0x71f3('0x11a')});db['FaxAccount']['hasMany'](db[_0x71f3('0x85')],{'as':_0x71f3('0x165'),'foreignKey':_0x71f3('0x17c')});db[_0x71f3('0x4b')]['hasMany'](db[_0x71f3('0x4f')],{'as':_0x71f3('0x167')});db[_0x71f3('0x4b')][_0x71f3('0x11b')](db[_0x71f3('0x4d')],{'as':_0x71f3('0x17d')});db[_0x71f3('0x4b')][_0x71f3('0x11b')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x71f3('0x11a')});db['FaxAccount']['hasMany'](db[_0x71f3('0x51')],{'as':_0x71f3('0x166')});db[_0x71f3('0x4b')][_0x71f3('0x129')](db['Trunk'],{'as':'Trunk'});db[_0x71f3('0x4b')][_0x71f3('0x129')](db['CmList'],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0x4b')][_0x71f3('0x129')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x71f3('0x153')});db[_0x71f3('0x4b')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x71f3('0x4d')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x4d')]['belongsTo'](db[_0x71f3('0x53')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x4d')][_0x71f3('0x129')](db[_0x71f3('0x4b')],{'onDelete':_0x71f3('0x15e')});db['FaxApplication'][_0x71f3('0x129')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x71f3('0x17f')});db[_0x71f3('0x4f')][_0x71f3('0x11b')](db[_0x71f3('0x51')],{'as':_0x71f3('0x166'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x180')});db['FaxInteraction'][_0x71f3('0x129')](db['FaxAccount'],{'as':'Account','foreignKey':_0x71f3('0x17c')});db['FaxInteraction'][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':'Contact','foreignKey':_0x71f3('0x16f')});db['FaxInteraction'][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x170'),'foreignKey':_0x71f3('0x118')});db['FaxInteraction'][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x181'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x71f3('0x90')],{'through':'fax_interaction_has_tags','as':_0x71f3('0x172')});db['FaxInteraction']['belongsToMany'](db[_0x71f3('0x12')],{'as':_0x71f3('0x173'),'through':_0x71f3('0x133'),'foreignKey':_0x71f3('0x180')});db[_0x71f3('0x51')]['belongsTo'](db['User'],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x12')});db[_0x71f3('0x51')]['belongsTo'](db[_0x71f3('0x4f')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x71f3('0x51')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0x71f3('0x129')](db[_0x71f3('0xf0')],{'as':_0x71f3('0xf0'),'foreignKey':_0x71f3('0x182')});db[_0x71f3('0x51')]['belongsTo'](db['FaxAccount'],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x17c')});db['FaxQueue'][_0x71f3('0x12b')](db['User'],{'as':_0x71f3('0x154'),'through':_0x71f3('0x35')});db[_0x71f3('0x53')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':_0x71f3('0x183'),'as':_0x71f3('0x156')});db[_0x71f3('0x55')][_0x71f3('0x129')](db['FaxAccount'],{});db[_0x71f3('0x55')][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':'List','foreignKey':_0x71f3('0x169')});db[_0x71f3('0x55')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':'Contact','foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x55')][_0x71f3('0x129')](db['FaxInteraction'],{});db[_0x71f3('0x55')][_0x71f3('0x129')](db[_0x71f3('0x51')],{});db[_0x71f3('0x55')][_0x71f3('0x129')](db[_0x71f3('0x12')],{});db['FaxQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x53')],{});db['SmsAccount'][_0x71f3('0x11b')](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':_0x71f3('0x184'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x141')][_0x71f3('0x11b')](db[_0x71f3('0x85')],{'as':_0x71f3('0x165'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x71f3('0x185')],{'as':_0x71f3('0x166'),'foreignKey':_0x71f3('0x184')});db[_0x71f3('0x141')][_0x71f3('0x11b')](db['SmsInteraction'],{'as':_0x71f3('0x167')});db[_0x71f3('0x141')]['hasMany'](db[_0x71f3('0x57')],{'as':_0x71f3('0x17d')});db[_0x71f3('0x141')][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':'List','foreignKey':'ListId'});db[_0x71f3('0x141')][_0x71f3('0x129')](db['Pause'],{'as':_0x71f3('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x71f3('0x141')][_0x71f3('0x12b')](db['User'],{'as':_0x71f3('0x154'),'through':_0x71f3('0x143')});db[_0x71f3('0x57')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x57')][_0x71f3('0x129')](db['SmsQueue'],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x57')][_0x71f3('0x129')](db[_0x71f3('0x141')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x57')][_0x71f3('0x129')](db['Interval'],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x57')][_0x71f3('0x129')](db[_0x71f3('0x90')],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x17f')});db['SmsInteraction'][_0x71f3('0x11b')](db[_0x71f3('0x185')],{'as':'Messages','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x186')});db[_0x71f3('0x59')][_0x71f3('0x129')](db[_0x71f3('0x141')],{'as':_0x71f3('0x177'),'foreignKey':'SmsAccountId'});db[_0x71f3('0x59')]['belongsTo'](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db['SmsInteraction'][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':'Owner','foreignKey':_0x71f3('0x118')});db[_0x71f3('0x59')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x187'),'as':_0x71f3('0x188')});db[_0x71f3('0x59')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x187'),'as':_0x71f3('0x172')});db[_0x71f3('0x59')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x173'),'through':'user_has_sms_interactions','foreignKey':_0x71f3('0x186')});db[_0x71f3('0x185')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x12')});db['SmsMessage'][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':_0x71f3('0x11a'),'as':'Contact'});db[_0x71f3('0x185')][_0x71f3('0x129')](db[_0x71f3('0x59')],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x175'),'foreignKey':_0x71f3('0x186')});db[_0x71f3('0x185')]['belongsTo'](db[_0x71f3('0x141')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x184')});db[_0x71f3('0x5b')]['belongsToMany'](db['User'],{'as':_0x71f3('0x154'),'through':'UserSmsQueue','foreignKey':_0x71f3('0x189')});db[_0x71f3('0x5b')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':_0x71f3('0x18a'),'as':_0x71f3('0x156')});db[_0x71f3('0x5c')][_0x71f3('0x11b')](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':_0x71f3('0x18b'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x5c')][_0x71f3('0x11b')](db[_0x71f3('0x85')],{'as':_0x71f3('0x165'),'foreignKey':_0x71f3('0x18b')});db['OpenchannelAccount'][_0x71f3('0x11b')](db['OpenchannelInteraction'],{'as':_0x71f3('0x167'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x71f3('0x11b')](db[_0x71f3('0x61')],{'as':_0x71f3('0x166'),'foreignKey':_0x71f3('0x18b')});db[_0x71f3('0x5c')][_0x71f3('0x11b')](db[_0x71f3('0x5e')],{'as':_0x71f3('0x17d'),'foreignKey':_0x71f3('0x18b')});db['OpenchannelAccount']['belongsTo'](db['CmList'],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0x5c')][_0x71f3('0x129')](db['Pause'],{'as':_0x71f3('0x152'),'foreignKey':_0x71f3('0x153')});db[_0x71f3('0x5c')][_0x71f3('0x12b')](db['User'],{'as':_0x71f3('0x154'),'through':_0x71f3('0x18c')});db[_0x71f3('0x5e')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x5e')][_0x71f3('0x129')](db[_0x71f3('0x63')],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x18d')});db['OpenchannelApplication'][_0x71f3('0x129')](db[_0x71f3('0x5c')],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x18b')});db[_0x71f3('0x5e')][_0x71f3('0x129')](db[_0x71f3('0x8a')],{'onDelete':_0x71f3('0x15e'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x5e')][_0x71f3('0x129')](db[_0x71f3('0x90')],{'onDelete':_0x71f3('0x15e'),'foreignKey':'TagId'});db[_0x71f3('0x60')][_0x71f3('0x11b')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x18e')});db[_0x71f3('0x60')][_0x71f3('0x129')](db['OpenchannelAccount'],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x18b')});db[_0x71f3('0x60')]['belongsTo'](db[_0x71f3('0x76')],{'as':'Contact','foreignKey':_0x71f3('0x16f')});db['OpenchannelInteraction'][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x170'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x60')][_0x71f3('0x12b')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x71f3('0x188')});db[_0x71f3('0x60')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x18f'),'as':_0x71f3('0x172')});db['OpenchannelInteraction'][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x173'),'through':_0x71f3('0x190'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x12')});db['OpenchannelMessage'][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x15c')});db[_0x71f3('0x61')][_0x71f3('0x129')](db[_0x71f3('0x60')],{'onDelete':'cascade','as':_0x71f3('0x175'),'foreignKey':_0x71f3('0x18e')});db[_0x71f3('0x61')]['belongsTo'](db[_0x71f3('0xf0')],{'as':_0x71f3('0xf0'),'foreignKey':_0x71f3('0x182')});db['OpenchannelMessage'][_0x71f3('0x129')](db[_0x71f3('0x5c')],{'as':'Account','foreignKey':_0x71f3('0x18b')});db['OpenchannelQueue'][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x71f3('0x63')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':'team_has_openchannel_queues','as':_0x71f3('0x156')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x71f3('0x164'),'foreignKey':'ChatWebsiteId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x65')][_0x71f3('0x11b')](db[_0x71f3('0x85')],{'as':'Answers','foreignKey':_0x71f3('0x178')});db[_0x71f3('0x65')][_0x71f3('0x11b')](db[_0x71f3('0x72')],{'as':_0x71f3('0x191')});db[_0x71f3('0x65')][_0x71f3('0x11b')](db['ChatInteraction'],{'as':_0x71f3('0x167')});db[_0x71f3('0x65')]['hasMany'](db[_0x71f3('0x69')],{'as':_0x71f3('0x17d')});db[_0x71f3('0x65')][_0x71f3('0x11b')](db[_0x71f3('0x6c')],{'as':'Messages'});db[_0x71f3('0x65')][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0x65')][_0x71f3('0x129')](db['Interval'],{'as':'Interval','foreignKey':_0x71f3('0x151')});db['ChatWebsite'][_0x71f3('0x129')](db[_0x71f3('0x3e')],{'as':'MailAccount','foreignKey':_0x71f3('0x160')});db[_0x71f3('0x65')][_0x71f3('0x129')](db[_0x71f3('0x16b')],{'as':'mandatoryDispositionPause','foreignKey':_0x71f3('0x153')});db[_0x71f3('0x65')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x192')});db[_0x71f3('0x67')][_0x71f3('0x129')](db[_0x71f3('0x5c')],{});db['OpenchannelQueueReport'][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0x67')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':'Contact','foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x67')][_0x71f3('0x129')](db[_0x71f3('0x60')],{});db['OpenchannelQueueReport'][_0x71f3('0x129')](db['OpenchannelMessage'],{});db[_0x71f3('0x67')][_0x71f3('0x129')](db[_0x71f3('0x12')],{});db[_0x71f3('0x67')]['belongsTo'](db[_0x71f3('0x63')],{});db[_0x71f3('0x69')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x71f3('0x15e')});db[_0x71f3('0x69')][_0x71f3('0x129')](db[_0x71f3('0x13a')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x71f3('0x15e')});db['ChatApplication'][_0x71f3('0x129')](db[_0x71f3('0x65')],{'as':_0x71f3('0x193'),'foreignKey':'ChatWebsiteId','onDelete':_0x71f3('0x15e')});db[_0x71f3('0x69')][_0x71f3('0x129')](db[_0x71f3('0x90')],{'onDelete':'restrict','foreignKey':_0x71f3('0x17f')});db[_0x71f3('0x6a')][_0x71f3('0x11b')](db[_0x71f3('0x6c')],{'as':_0x71f3('0x166'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x194')});db[_0x71f3('0x6a')][_0x71f3('0x129')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x71f3('0x6a')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x6a')][_0x71f3('0x129')](db['User'],{'as':_0x71f3('0x170'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x6a')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x195'),'as':_0x71f3('0x188')});db[_0x71f3('0x6a')]['belongsToMany'](db[_0x71f3('0x90')],{'through':'chat_interaction_has_tags','as':_0x71f3('0x172')});db[_0x71f3('0x6a')][_0x71f3('0x12b')](db['User'],{'as':'Users','through':_0x71f3('0x196'),'foreignKey':_0x71f3('0x194')});db[_0x71f3('0x6c')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x11a'),'as':'User'});db['ChatMessage'][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x6c')][_0x71f3('0x129')](db[_0x71f3('0x6a')],{'onDelete':'cascade','as':_0x71f3('0x175'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x71f3('0x129')](db[_0x71f3('0xf0')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x71f3('0x6c')][_0x71f3('0x129')](db[_0x71f3('0x65')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x178')});db[_0x71f3('0x6e')][_0x71f3('0x11b')](db['Attachment'],{'as':_0x71f3('0x174'),'foreignKey':_0x71f3('0x179'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db[_0x71f3('0x6e')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':_0x71f3('0x11a'),'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x6e')][_0x71f3('0x129')](db[_0x71f3('0x65')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x71f3('0x13a')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x31'),'hooks':!![]});db[_0x71f3('0x13a')]['belongsToMany'](db[_0x71f3('0x155')],{'through':_0x71f3('0x197'),'as':_0x71f3('0x156')});db[_0x71f3('0x12c')][_0x71f3('0x11b')](db[_0x71f3('0xdb')],{'as':_0x71f3('0x166'),'foreignKey':'ChatGroupId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x12c')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x14a'),'through':'chat_group_has_users'});db[_0x71f3('0x72')][_0x71f3('0x129')](db[_0x71f3('0x65')],{'as':_0x71f3('0x193'),'foreignKey':_0x71f3('0x178')});db['CmCompany']['hasMany'](db[_0x71f3('0x76')],{'as':_0x71f3('0x198'),'foreignKey':_0x71f3('0x199')});db['CmContact'][_0x71f3('0x11b')](db[_0x71f3('0x94')],{'as':'Phones','foreignKey':_0x71f3('0x19a')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db[_0x71f3('0x78')],{'as':_0x71f3('0x14c'),'foreignKey':_0x71f3('0x16f')});db['CmContact'][_0x71f3('0x11b')](db['CmHopperFinal'],{'as':_0x71f3('0x11f'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db[_0x71f3('0x7d')],{'as':'HopperHistories','foreignKey':_0x71f3('0x16f')});db['CmContact'][_0x71f3('0x11b')](db[_0x71f3('0x7f')],{'as':_0x71f3('0x7f'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db[_0x71f3('0x19b')],{'as':_0x71f3('0x14e'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db['OpenchannelInteraction'],{'as':_0x71f3('0x121'),'foreignKey':_0x71f3('0x16f'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x76')]['hasMany'](db[_0x71f3('0x6a')],{'as':_0x71f3('0x122'),'foreignKey':_0x71f3('0x16f'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db[_0x71f3('0x59')],{'as':_0x71f3('0x123'),'foreignKey':'ContactId','onDelete':_0x71f3('0x15e')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db[_0x71f3('0x4f')],{'as':_0x71f3('0x124'),'foreignKey':_0x71f3('0x16f'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x76')][_0x71f3('0x11b')](db['MailInteraction'],{'as':_0x71f3('0x125'),'foreignKey':_0x71f3('0x16f'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x76')][_0x71f3('0x129')](db[_0x71f3('0x74')],{'as':_0x71f3('0x19c'),'foreignKey':_0x71f3('0x199')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169'),'onDelete':_0x71f3('0x11a')});db['CmContact'][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x173'),'through':_0x71f3('0x12e')});db[_0x71f3('0x76')][_0x71f3('0x12b')](db['Tag'],{'as':_0x71f3('0x188'),'through':_0x71f3('0x19d')});db[_0x71f3('0x76')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x19d'),'as':_0x71f3('0x172')});db[_0x71f3('0x78')][_0x71f3('0x11b')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x71f3('0x19e')});db['CmHopper'][_0x71f3('0x129')](db['CmContact'],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f'),'onDelete':_0x71f3('0x11a')});db['CmHopper'][_0x71f3('0x129')](db['CmList'],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x78')][_0x71f3('0x129')](db['User'],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0x71f3('0x129')](db[_0x71f3('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x78')][_0x71f3('0x129')](db['Campaign'],{'as':'Campaign','foreignKey':_0x71f3('0x19f'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x78')]['belongsTo'](db[_0x71f3('0x12')],{'as':'Owner','foreignKey':_0x71f3('0x1a0')});db[_0x71f3('0x7a')]['belongsTo'](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':'ContactId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x7a')]['belongsTo'](db[_0x71f3('0xf6')],{'as':'List','foreignKey':'ListId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x7a')]['belongsTo'](db['VoiceQueue'],{'as':_0x71f3('0x1a1'),'foreignKey':_0x71f3('0x14b'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x7a')]['belongsTo'](db[_0x71f3('0xee')],{'as':_0x71f3('0xee'),'foreignKey':_0x71f3('0x19f'),'onDelete':_0x71f3('0x11a')});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x71f3('0x1a2'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x71f3('0x11a'),'hooks':!![]});db[_0x71f3('0x84')][_0x71f3('0x11b')](db['Condition'],{'as':{'plural':_0x71f3('0x1a3'),'singular':_0x71f3('0x1a4')},'foreignKey':_0x71f3('0x1a5'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db[_0x71f3('0x84')][_0x71f3('0x11b')](db[_0x71f3('0x1a6')],{'as':_0x71f3('0x1a7'),'foreignKey':_0x71f3('0x1a8'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x71f3('0x11b')](db['Disposition'],{'as':_0x71f3('0x164'),'foreignKey':'ParentId','onDelete':_0x71f3('0x11a')});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db['Interval'],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x71f3('0x11a'),'hooks':!![],'required':![]});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db[_0x71f3('0x11e')],{'as':_0x71f3('0x1a9'),'foreignKey':_0x71f3('0x151'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db[_0x71f3('0x168')],{'as':_0x71f3('0x1aa'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db[_0x71f3('0x69')],{'as':_0x71f3('0x1ab'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db[_0x71f3('0x4d')],{'as':'FaxApplications','foreignKey':_0x71f3('0x151')});db[_0x71f3('0x8a')][_0x71f3('0x11b')](db['SmsApplication'],{'as':_0x71f3('0x1ac'),'foreignKey':_0x71f3('0x151')});db[_0x71f3('0x1ad')][_0x71f3('0x129')](db[_0x71f3('0x3e')],{});db['Schedule'][_0x71f3('0x129')](db[_0x71f3('0xa2')],{'foreignKey':_0x71f3('0x1ae')});db['Schedule']['belongsTo'](db[_0x71f3('0xa0')],{'foreignKey':_0x71f3('0x1af')});db['Sound'][_0x71f3('0x12b')](db[_0x71f3('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0x71f3('0x12b')](db['CmContact'],{'through':_0x71f3('0x19d')});db[_0x71f3('0x90')][_0x71f3('0x12b')](db[_0x71f3('0x6a')],{'through':_0x71f3('0x195')});db['Tag'][_0x71f3('0x12b')](db[_0x71f3('0x43')],{'through':_0x71f3('0x171')});db[_0x71f3('0x90')][_0x71f3('0x12b')](db[_0x71f3('0x59')],{'through':_0x71f3('0x187')});db[_0x71f3('0x90')][_0x71f3('0x12b')](db[_0x71f3('0x4f')],{'through':_0x71f3('0x181')});db[_0x71f3('0x90')][_0x71f3('0x12b')](db[_0x71f3('0x60')],{'through':_0x71f3('0x18f')});db[_0x71f3('0x90')][_0x71f3('0x12b')](db[_0x71f3('0x105')],{'through':_0x71f3('0x1b0')});db[_0x71f3('0x94')]['belongsTo'](db[_0x71f3('0x92')],{'as':_0x71f3('0x1b1'),'foreignKey':_0x71f3('0x1b2')});db[_0x71f3('0x96')][_0x71f3('0x129')](db[_0x71f3('0x78')],{'as':'Hopper','foreignKey':_0x71f3('0x19e')});db[_0x71f3('0x94')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x19a')});db[_0x71f3('0x99')][_0x71f3('0x11b')](db['Condition'],{'as':{'plural':_0x71f3('0x1b3'),'singular':'AllCondition'},'foreignKey':_0x71f3('0x1b4'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db['Trigger'][_0x71f3('0x11b')](db[_0x71f3('0x88')],{'as':{'plural':_0x71f3('0x1b5'),'singular':_0x71f3('0x1b6')},'foreignKey':_0x71f3('0x1b7'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db['Trigger'][_0x71f3('0x11b')](db[_0x71f3('0x1a6')],{'as':_0x71f3('0x1a7'),'foreignKey':_0x71f3('0x1b8'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db[_0x71f3('0xa0')][_0x71f3('0x11b')](db[_0x71f3('0xa6')],{'as':'Fields','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1af'),'hooks':!![]});db[_0x71f3('0xa2')][_0x71f3('0x11b')](db[_0x71f3('0xa6')],{'as':'Fields','onDelete':_0x71f3('0x11a'),'foreignKey':'DefaultReportId'});db[_0x71f3('0x1b9')][_0x71f3('0x11b')](db[_0x71f3('0xa6')],{'as':_0x71f3('0x1ba'),'onDelete':'cascade','foreignKey':_0x71f3('0x1bb')});db[_0x71f3('0xa6')][_0x71f3('0x129')](db[_0x71f3('0x1b9')],{'foreignKey':_0x71f3('0x1bb')});db[_0x71f3('0xa8')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xaa')][_0x71f3('0x11b')](db[_0x71f3('0x1be')],{'as':_0x71f3('0x1bf'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c0')});db['SalesforceConfiguration'][_0x71f3('0x11b')](db[_0x71f3('0x1be')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xaa')]['hasMany'](db[_0x71f3('0x1be')],{'as':_0x71f3('0x1ba'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c3')});db['SalesforceConfiguration']['belongsTo'](db[_0x71f3('0xa8')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0x1be')][_0x71f3('0x11b')](db[_0x71f3('0x1be')],{'as':'Subject','foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0x1be')]['hasMany'](db['SalesforceField'],{'as':_0x71f3('0x1c4'),'foreignKey':'DescriptionId'});db[_0x71f3('0x1be')][_0x71f3('0x11b')](db[_0x71f3('0x1be')],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0x1be')][_0x71f3('0x129')](db[_0x71f3('0x9b')],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0x1c7')]['hasMany'](db[_0x71f3('0xad')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xad')][_0x71f3('0x11b')](db[_0x71f3('0xaf')],{'as':'Subjects','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xad')]['hasMany'](db[_0x71f3('0xaf')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xad')][_0x71f3('0x11b')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xad')][_0x71f3('0x129')](db[_0x71f3('0x1c7')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xaf')][_0x71f3('0x11b')](db[_0x71f3('0xaf')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xaf')][_0x71f3('0x11b')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x71f3('0x1c2')});db['SugarcrmField'][_0x71f3('0x11b')](db['SugarcrmField'],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db['SugarcrmField'][_0x71f3('0x129')](db[_0x71f3('0x9b')],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0xb1')][_0x71f3('0x11b')](db[_0x71f3('0xb3')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xb3')][_0x71f3('0x11b')](db[_0x71f3('0x1c9')],{'as':'Subjects','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xb3')][_0x71f3('0x11b')](db[_0x71f3('0x1c9')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xb3')]['hasMany'](db[_0x71f3('0x1c9')],{'as':'Fields','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xb3')][_0x71f3('0x129')](db[_0x71f3('0xb1')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db['DeskConfiguration'][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x1ca')});db['DeskField'][_0x71f3('0x11b')](db[_0x71f3('0x1c9')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0x1c9')][_0x71f3('0x11b')](db[_0x71f3('0x1c9')],{'as':'Description','foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0x1c9')][_0x71f3('0x11b')](db[_0x71f3('0x1c9')],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0x1c9')][_0x71f3('0x129')](db['Variable'],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db['ZohoAccount'][_0x71f3('0x11b')](db[_0x71f3('0xb8')],{'as':'Configurations','onDelete':_0x71f3('0x11a'),'foreignKey':'AccountId'});db[_0x71f3('0xb8')][_0x71f3('0x11b')](db[_0x71f3('0xba')],{'as':'Subjects','onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xb8')][_0x71f3('0x11b')](db[_0x71f3('0xba')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xb8')][_0x71f3('0x11b')](db[_0x71f3('0xba')],{'as':_0x71f3('0x1ba'),'onDelete':_0x71f3('0x11a'),'foreignKey':'FieldId'});db[_0x71f3('0xb8')]['belongsTo'](db[_0x71f3('0xb6')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db['ZohoField'][_0x71f3('0x11b')](db[_0x71f3('0xba')],{'as':_0x71f3('0x1c8'),'foreignKey':'SubjectId'});db[_0x71f3('0xba')][_0x71f3('0x11b')](db['ZohoField'],{'as':'Description','foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xba')]['hasMany'](db[_0x71f3('0xba')],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xba')][_0x71f3('0x129')](db[_0x71f3('0x9b')],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0xbc')][_0x71f3('0x11b')](db[_0x71f3('0xbe')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x71f3('0x1bf'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xbe')][_0x71f3('0x11b')](db[_0x71f3('0xc0')],{'as':_0x71f3('0x1c1'),'foreignKey':'DescriptionId'});db[_0x71f3('0xbe')]['hasMany'](db[_0x71f3('0xc0')],{'as':'Fields','foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xbe')]['belongsTo'](db[_0x71f3('0xbc')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db['ZendeskConfiguration']['belongsToMany'](db[_0x71f3('0x90')],{'through':_0x71f3('0x1cb')});db[_0x71f3('0xc0')][_0x71f3('0x11b')](db['ZendeskField'],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xc0')][_0x71f3('0x11b')](db[_0x71f3('0xc0')],{'as':_0x71f3('0x1c4'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xc0')]['hasMany'](db[_0x71f3('0xc0')],{'as':'Field','foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xc0')]['belongsTo'](db['Variable'],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db['FreshdeskAccount']['hasMany'](db[_0x71f3('0xc4')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xc4')]['hasMany'](db[_0x71f3('0xc6')],{'as':_0x71f3('0x1bf'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xc4')][_0x71f3('0x11b')](db[_0x71f3('0xc6')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':'DescriptionId'});db[_0x71f3('0xc4')][_0x71f3('0x11b')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x71f3('0x11a'),'foreignKey':'FieldId'});db[_0x71f3('0xc4')][_0x71f3('0x129')](db[_0x71f3('0xc2')],{'as':'Account','foreignKey':_0x71f3('0x1bd')});db['FreshdeskConfiguration'][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x1cc')});db[_0x71f3('0xc6')][_0x71f3('0x11b')](db[_0x71f3('0xc6')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xc6')]['hasMany'](db[_0x71f3('0xc6')],{'as':_0x71f3('0x1c4'),'foreignKey':_0x71f3('0x1c2')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db['FreshdeskField'][_0x71f3('0x129')](db['Variable'],{'as':'Variable','foreignKey':_0x71f3('0x1c6')});db['VtigerAccount'][_0x71f3('0x11b')](db[_0x71f3('0xc9')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xc9')][_0x71f3('0x11b')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xc9')][_0x71f3('0x11b')](db[_0x71f3('0x1cd')],{'as':_0x71f3('0x1c1'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x71f3('0x11b')](db['VtigerField'],{'as':_0x71f3('0x1ba'),'foreignKey':'FieldId'});db[_0x71f3('0xc9')]['belongsTo'](db['VtigerAccount'],{'as':_0x71f3('0x177'),'foreignKey':'AccountId'});db[_0x71f3('0x1cd')][_0x71f3('0x11b')](db[_0x71f3('0x1cd')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0x1cd')][_0x71f3('0x11b')](db[_0x71f3('0x1cd')],{'as':'Description','foreignKey':_0x71f3('0x1c2')});db['VtigerField'][_0x71f3('0x11b')](db[_0x71f3('0x1cd')],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0x1cd')][_0x71f3('0x129')](db[_0x71f3('0x9b')],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0xcc')][_0x71f3('0x11b')](db[_0x71f3('0xce')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x71f3('0x11b')](db[_0x71f3('0x1ce')],{'as':_0x71f3('0x1bf'),'foreignKey':_0x71f3('0x1c0')});db['ServicenowConfiguration'][_0x71f3('0x11b')](db[_0x71f3('0x1ce')],{'as':_0x71f3('0x1c1'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xce')][_0x71f3('0x11b')](db['ServicenowField'],{'as':_0x71f3('0x1ba'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0x71f3('0xcc')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0x1ce')][_0x71f3('0x11b')](db[_0x71f3('0x1ce')],{'as':'Subject','foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0x1ce')]['hasMany'](db['ServicenowField'],{'as':_0x71f3('0x1c4'),'foreignKey':'DescriptionId'});db[_0x71f3('0x1ce')][_0x71f3('0x11b')](db['ServicenowField'],{'as':_0x71f3('0x1c5'),'foreignKey':'FieldId'});db['ServicenowField'][_0x71f3('0x129')](db[_0x71f3('0x9b')],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0x1cf')][_0x71f3('0x11b')](db[_0x71f3('0xd1')],{'as':_0x71f3('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db['Dynamics365Account'][_0x71f3('0x129')](db[_0x71f3('0x10f')],{'as':_0x71f3('0x10f'),'foreignKey':_0x71f3('0x15d')});db['Dynamics365Configuration'][_0x71f3('0x11b')](db[_0x71f3('0xd3')],{'as':_0x71f3('0x1bf'),'onDelete':_0x71f3('0x11a'),'foreignKey':'SubjectId'});db[_0x71f3('0xd1')]['hasMany'](db[_0x71f3('0xd3')],{'as':_0x71f3('0x1c1'),'onDelete':_0x71f3('0x11a'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x71f3('0x11b')](db[_0x71f3('0xd3')],{'as':_0x71f3('0x1ba'),'onDelete':'cascade','foreignKey':_0x71f3('0x1c3')});db[_0x71f3('0xd1')][_0x71f3('0x129')](db[_0x71f3('0x1cf')],{'as':'Account','foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xd3')][_0x71f3('0x11b')](db[_0x71f3('0xd3')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xd3')][_0x71f3('0x11b')](db[_0x71f3('0xd3')],{'as':'Description','foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xd3')][_0x71f3('0x11b')](db['Dynamics365Field'],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db['Dynamics365Field'][_0x71f3('0x129')](db['Variable'],{'as':_0x71f3('0x9b'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db[_0x71f3('0xd6')],{'as':_0x71f3('0x1bc'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0xd6')]['hasMany'](db[_0x71f3('0x1d0')],{'as':_0x71f3('0x1bf'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0xd6')][_0x71f3('0x11b')](db[_0x71f3('0x1d0')],{'as':_0x71f3('0x1c1'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0xd6')][_0x71f3('0x11b')](db[_0x71f3('0x1d0')],{'as':'Fields','foreignKey':'FieldId'});db[_0x71f3('0xd6')]['belongsTo'](db[_0x71f3('0xd5')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1bd')});db[_0x71f3('0x1d0')][_0x71f3('0x11b')](db[_0x71f3('0x1d0')],{'as':_0x71f3('0x1c8'),'foreignKey':_0x71f3('0x1c0')});db[_0x71f3('0x1d0')]['hasMany'](db['FreshsalesField'],{'as':_0x71f3('0x1c4'),'foreignKey':_0x71f3('0x1c2')});db[_0x71f3('0x1d0')][_0x71f3('0x11b')](db['FreshsalesField'],{'as':_0x71f3('0x1c5'),'foreignKey':_0x71f3('0x1c3')});db['FreshsalesField'][_0x71f3('0x129')](db['Variable'],{'as':_0x71f3('0x9b'),'foreignKey':_0x71f3('0x1c6')});db[_0x71f3('0xd9')][_0x71f3('0x129')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x71f3('0x129')](db['CmList'],{'as':'List','foreignKey':_0x71f3('0x169')});db[_0x71f3('0xd9')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0xd9')]['belongsTo'](db[_0x71f3('0x6a')],{});db['ChatQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x6c')],{});db[_0x71f3('0xd9')][_0x71f3('0x129')](db[_0x71f3('0x12')],{});db[_0x71f3('0xd9')][_0x71f3('0x129')](db[_0x71f3('0x13a')],{});db[_0x71f3('0xdb')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1d1')});db[_0x71f3('0xdb')]['belongsTo'](db[_0x71f3('0x12')],{'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1d2')});db[_0x71f3('0x19b')][_0x71f3('0x11b')](db[_0x71f3('0x1d3')],{'foreignKey':_0x71f3('0x1d4'),'onDelete':_0x71f3('0x11a')});db['JscriptySessionReport'][_0x71f3('0x11b')](db[_0x71f3('0x1d5')],{'foreignKey':_0x71f3('0x1d4'),'onDelete':_0x71f3('0x11a')});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db[_0x71f3('0xde')][_0x71f3('0x129')](db['CmList'],{'as':'List','foreignKey':_0x71f3('0x169')});db['SmsQueueReport'][_0x71f3('0x129')](db['CmContact'],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0xde')][_0x71f3('0x129')](db[_0x71f3('0x59')],{});db['SmsQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x185')],{});db['SmsQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x12')],{});db[_0x71f3('0xde')]['belongsTo'](db[_0x71f3('0x5b')],{});db[_0x71f3('0xe2')]['hasMany'](db[_0x71f3('0x19b')],{'foreignKey':_0x71f3('0x1d6')});db[_0x71f3('0xe2')][_0x71f3('0x11b')](db[_0x71f3('0x1d3')],{'foreignKey':_0x71f3('0x1d6')});db[_0x71f3('0xe2')][_0x71f3('0x11b')](db[_0x71f3('0x1d5')],{'foreignKey':_0x71f3('0x1d6')});db[_0x71f3('0xe8')][_0x71f3('0x12b')](db['User'],{'as':_0x71f3('0x173'),'through':_0x71f3('0x146')});db[_0x71f3('0x155')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':'user_has_teams'});db['Team'][_0x71f3('0x12b')](db[_0x71f3('0x1b')],{'through':_0x71f3('0x1d7'),'as':'VoiceQueues'});db[_0x71f3('0x155')]['belongsToMany'](db[_0x71f3('0x40')],{'through':_0x71f3('0x16d'),'as':'MailQueues'});db[_0x71f3('0x155')][_0x71f3('0x12b')](db[_0x71f3('0x13a')],{'through':_0x71f3('0x197'),'as':'ChatQueues'});db[_0x71f3('0x155')][_0x71f3('0x12b')](db[_0x71f3('0x53')],{'through':_0x71f3('0x183'),'as':_0x71f3('0x1d8')});db['Team'][_0x71f3('0x12b')](db[_0x71f3('0x5b')],{'through':_0x71f3('0x18a'),'as':_0x71f3('0x13b')});db[_0x71f3('0x155')][_0x71f3('0x12b')](db[_0x71f3('0x63')],{'through':_0x71f3('0x1d9'),'as':_0x71f3('0x13d')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0x71f3('0x1da'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x71f3('0x138')});db[_0x71f3('0xee')]['hasMany'](db[_0x71f3('0x78')],{'as':'Hoppers','foreignKey':_0x71f3('0x19f')});db['Campaign'][_0x71f3('0x11b')](db['CmHopperFinal'],{'as':_0x71f3('0x11f'),'foreignKey':_0x71f3('0x19f')});db[_0x71f3('0xee')][_0x71f3('0x11b')](db['CmHopperHistory'],{'as':_0x71f3('0x1db'),'foreignKey':_0x71f3('0x19f')});db[_0x71f3('0xee')]['hasMany'](db[_0x71f3('0x7a')],{'as':_0x71f3('0x14d'),'foreignKey':_0x71f3('0x19f')});db[_0x71f3('0xee')][_0x71f3('0x129')](db[_0x71f3('0x2a')],{'as':_0x71f3('0x2a'),'foreignKey':'TrunkId'});db[_0x71f3('0xee')][_0x71f3('0x129')](db[_0x71f3('0x2a')],{'as':_0x71f3('0x1dc'),'foreignKey':_0x71f3('0x150')});db[_0x71f3('0xee')][_0x71f3('0x129')](db[_0x71f3('0x8a')],{'as':_0x71f3('0x8a'),'foreignKey':'IntervalId'});db[_0x71f3('0xee')]['belongsTo'](db['SquareProject'],{'as':_0x71f3('0xe8'),'foreignKey':'SquareProjectId'});db[_0x71f3('0xee')][_0x71f3('0x12b')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x12f'),'through':_0x71f3('0x1dd')});db[_0x71f3('0xee')][_0x71f3('0x12b')](db['CmList'],{'as':_0x71f3('0x157'),'through':'campaigns_has_cm_blacklists'});db[_0x71f3('0xf0')][_0x71f3('0x129')](db[_0x71f3('0x6e')],{'as':_0x71f3('0x6e'),'foreignKey':'ChatOfflineMessageId'});db[_0x71f3('0x1de')][_0x71f3('0x129')](db[_0x71f3('0x16e')],{});db['MailTransferReport'][_0x71f3('0x129')](db['MailInteraction'],{});db[_0x71f3('0x1de')][_0x71f3('0x129')](db[_0x71f3('0x3e')],{'foreignKey':'FromMailAccountId','as':_0x71f3('0x1df')});db[_0x71f3('0x1de')][_0x71f3('0x129')](db['User'],{'foreignKey':'FromUserId','as':_0x71f3('0x1e0')});db['MailTransferReport'][_0x71f3('0x129')](db['User'],{'foreignKey':_0x71f3('0x1e1'),'as':_0x71f3('0x1e2')});db['MailTransferReport'][_0x71f3('0x129')](db[_0x71f3('0x40')],{'foreignKey':_0x71f3('0x1e3'),'as':_0x71f3('0x1e4')});db['MailTransferReport']['belongsTo'](db[_0x71f3('0x3e')],{'foreignKey':_0x71f3('0x1e5'),'as':_0x71f3('0x1e6')});db[_0x71f3('0xf4')][_0x71f3('0x129')](db['ChatMessage'],{});db[_0x71f3('0xf4')][_0x71f3('0x129')](db[_0x71f3('0x6a')],{});db[_0x71f3('0xf4')][_0x71f3('0x129')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport'][_0x71f3('0x129')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x71f3('0xf4')]['belongsTo'](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1e1'),'as':'ToAgent'});db[_0x71f3('0xf4')][_0x71f3('0x129')](db[_0x71f3('0x13a')],{'foreignKey':_0x71f3('0x1e7'),'as':_0x71f3('0x1e4')});db['ChatTransferReport'][_0x71f3('0x129')](db[_0x71f3('0x65')],{'foreignKey':_0x71f3('0x1e8'),'as':_0x71f3('0x1e6')});db['FaxTransferReport']['belongsTo'](db[_0x71f3('0x51')],{});db[_0x71f3('0x1e9')][_0x71f3('0x129')](db[_0x71f3('0x4f')],{});db['FaxTransferReport'][_0x71f3('0x129')](db[_0x71f3('0x4b')],{'foreignKey':_0x71f3('0x1ea'),'as':_0x71f3('0x1df')});db[_0x71f3('0x1e9')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'foreignKey':'FromUserId','as':_0x71f3('0x1e0')});db[_0x71f3('0x1e9')]['belongsTo'](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1e1'),'as':'ToAgent'});db[_0x71f3('0x1e9')]['belongsTo'](db[_0x71f3('0x53')],{'foreignKey':_0x71f3('0x1eb'),'as':'ToQueue'});db['FaxTransferReport']['belongsTo'](db[_0x71f3('0x4b')],{'foreignKey':_0x71f3('0x1ec'),'as':_0x71f3('0x1e6')});db[_0x71f3('0x1ed')][_0x71f3('0x129')](db['OpenchannelMessage'],{});db[_0x71f3('0x1ed')][_0x71f3('0x129')](db[_0x71f3('0x60')],{});db[_0x71f3('0x1ed')]['belongsTo'](db[_0x71f3('0x5c')],{'foreignKey':_0x71f3('0x1ee'),'as':_0x71f3('0x1df')});db[_0x71f3('0x1ed')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1ef'),'as':_0x71f3('0x1e0')});db[_0x71f3('0x1ed')]['belongsTo'](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1e1'),'as':_0x71f3('0x1e2')});db[_0x71f3('0x1ed')]['belongsTo'](db[_0x71f3('0x63')],{'foreignKey':_0x71f3('0x1f0'),'as':_0x71f3('0x1e4')});db[_0x71f3('0x1ed')][_0x71f3('0x129')](db[_0x71f3('0x5c')],{'foreignKey':'ToOpenchannelAccountId','as':_0x71f3('0x1e6')});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db[_0x71f3('0x185')],{});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db[_0x71f3('0x59')],{});db[_0x71f3('0x1f1')]['belongsTo'](db[_0x71f3('0x141')],{'foreignKey':_0x71f3('0x1f2'),'as':_0x71f3('0x1df')});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1ef'),'as':_0x71f3('0x1e0')});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'foreignKey':_0x71f3('0x1e1'),'as':_0x71f3('0x1e2')});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db[_0x71f3('0x5b')],{'foreignKey':_0x71f3('0x1f3'),'as':'ToQueue'});db[_0x71f3('0x1f1')][_0x71f3('0x129')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x71f3('0x1e6')});db[_0x71f3('0xf6')][_0x71f3('0x11b')](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':_0x71f3('0x169'),'onDelete':_0x71f3('0x11a')});db['CmList'][_0x71f3('0x11b')](db['CmCustomField'],{'as':_0x71f3('0x1f4'),'foreignKey':'ListId'});db[_0x71f3('0xf6')][_0x71f3('0x11b')](db[_0x71f3('0x76')],{'as':_0x71f3('0x198'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x169')});db['CmList'][_0x71f3('0x11b')](db[_0x71f3('0x7b')],{'as':_0x71f3('0x11f'),'foreignKey':'ListId'});db[_0x71f3('0xf6')][_0x71f3('0x11b')](db[_0x71f3('0x7d')],{'as':_0x71f3('0x120'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0xf6')]['hasMany'](db[_0x71f3('0x7f')],{'as':_0x71f3('0x7f'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0xf6')][_0x71f3('0x12b')](db[_0x71f3('0x1b')],{'as':'Queues','through':_0x71f3('0x1f5')});db[_0x71f3('0xf6')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x130')});db[_0x71f3('0x137')][_0x71f3('0x11b')](db['VoiceExtension'],{'as':_0x71f3('0x1a9'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x137')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x113')});db[_0x71f3('0x137')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':_0x71f3('0x111'),'as':_0x71f3('0x156')});db[_0x71f3('0xf9')][_0x71f3('0x11b')](db['User'],{'as':_0x71f3('0x173'),'foreignKey':_0x71f3('0x12a')});db[_0x71f3('0xf9')]['hasMany'](db[_0x71f3('0xfb')],{'as':_0x71f3('0x1f6'),'foreignKey':_0x71f3('0x12a'),'onDelete':_0x71f3('0x11a')});db['UserProfileSection'][_0x71f3('0x11b')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x71f3('0x1f7'),'onDelete':_0x71f3('0x11a')});db['WhatsappAccount']['hasMany'](db[_0x71f3('0x163')],{'as':_0x71f3('0x164'),'foreignKey':_0x71f3('0x1f8'),'onDelete':_0x71f3('0x11a')});db[_0x71f3('0x101')][_0x71f3('0x11b')](db[_0x71f3('0x85')],{'as':_0x71f3('0x165'),'foreignKey':'WhatsappAccountId'});db[_0x71f3('0x101')]['hasMany'](db[_0x71f3('0x107')],{'as':_0x71f3('0x166'),'foreignKey':_0x71f3('0x1f8')});db['WhatsappAccount'][_0x71f3('0x11b')](db[_0x71f3('0x105')],{'as':_0x71f3('0x167')});db[_0x71f3('0x101')]['hasMany'](db[_0x71f3('0x103')],{'as':'Applications'});db[_0x71f3('0x101')][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x17e'),'foreignKey':_0x71f3('0x169')});db[_0x71f3('0x101')][_0x71f3('0x129')](db[_0x71f3('0x16b')],{'as':_0x71f3('0x152'),'foreignKey':_0x71f3('0x153')});db[_0x71f3('0x101')]['belongsToMany'](db[_0x71f3('0x12')],{'as':_0x71f3('0x154'),'through':_0x71f3('0x144')});db[_0x71f3('0x103')][_0x71f3('0x129')](db['User'],{'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x103')][_0x71f3('0x129')](db[_0x71f3('0x10d')],{'onDelete':'restrict'});db[_0x71f3('0x103')][_0x71f3('0x129')](db[_0x71f3('0x101')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x71f3('0x129')](db[_0x71f3('0x8a')],{'onDelete':_0x71f3('0x15e'),'foreignKey':'IntervalId'});db[_0x71f3('0x103')][_0x71f3('0x129')](db[_0x71f3('0x90')],{'onDelete':_0x71f3('0x15e'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x71f3('0x11b')](db['WhatsappMessage'],{'as':_0x71f3('0x166'),'onDelete':_0x71f3('0x11a'),'foreignKey':_0x71f3('0x1f9')});db[_0x71f3('0x105')][_0x71f3('0x129')](db[_0x71f3('0x101')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1f8')});db[_0x71f3('0x105')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'as':_0x71f3('0x15c'),'foreignKey':_0x71f3('0x16f')});db[_0x71f3('0x105')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x170'),'foreignKey':_0x71f3('0x118')});db[_0x71f3('0x105')]['belongsToMany'](db[_0x71f3('0x90')],{'through':_0x71f3('0x1b0'),'as':'Tags'});db[_0x71f3('0x105')][_0x71f3('0x12b')](db[_0x71f3('0x90')],{'through':_0x71f3('0x1b0'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x71f3('0x12b')](db['User'],{'as':_0x71f3('0x173'),'through':_0x71f3('0x134'),'foreignKey':'WhatsappInteractionId'});db[_0x71f3('0x107')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':_0x71f3('0x12')});db[_0x71f3('0x107')][_0x71f3('0x129')](db[_0x71f3('0x76')],{'onDelete':'cascade','as':_0x71f3('0x15c')});db[_0x71f3('0x107')][_0x71f3('0x129')](db[_0x71f3('0x105')],{'onDelete':_0x71f3('0x11a'),'as':'Interaction','foreignKey':_0x71f3('0x1f9')});db[_0x71f3('0x107')][_0x71f3('0x129')](db[_0x71f3('0x101')],{'as':_0x71f3('0x177'),'foreignKey':_0x71f3('0x1f8')});db[_0x71f3('0x109')]['belongsTo'](db[_0x71f3('0x101')],{});db[_0x71f3('0x109')][_0x71f3('0x129')](db[_0x71f3('0xf6')],{'as':_0x71f3('0x17e'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x71f3('0x129')](db['CmContact'],{'as':'Contact','foreignKey':_0x71f3('0x16f')});db['WhatsappQueueReport'][_0x71f3('0x129')](db['WhatsappInteraction'],{});db[_0x71f3('0x109')][_0x71f3('0x129')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x71f3('0x129')](db[_0x71f3('0x107')],{});db['WhatsappQueueReport'][_0x71f3('0x129')](db['User'],{});db[_0x71f3('0x10b')][_0x71f3('0x129')](db[_0x71f3('0x107')],{});db[_0x71f3('0x10b')][_0x71f3('0x129')](db[_0x71f3('0x105')],{});db['WhatsappTransferReport'][_0x71f3('0x129')](db[_0x71f3('0x101')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x71f3('0x10b')][_0x71f3('0x129')](db[_0x71f3('0x101')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x71f3('0x10b')][_0x71f3('0x129')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0x71f3('0x1e4')});db[_0x71f3('0x10b')][_0x71f3('0x129')](db['User'],{'foreignKey':_0x71f3('0x1ef'),'as':_0x71f3('0x1e0')});db[_0x71f3('0x10b')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'foreignKey':'ToUserId','as':_0x71f3('0x1e2')});db[_0x71f3('0x10d')][_0x71f3('0x12b')](db[_0x71f3('0x12')],{'as':'Agents','through':_0x71f3('0x39'),'foreignKey':_0x71f3('0x1fa')});db[_0x71f3('0x10d')][_0x71f3('0x12b')](db[_0x71f3('0x155')],{'through':_0x71f3('0x1da'),'as':_0x71f3('0x156')});db[_0x71f3('0x115')][_0x71f3('0x129')](db[_0x71f3('0x12')],{'as':'user','foreignKey':_0x71f3('0x118'),'onDelete':_0x71f3('0x11a'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x71f3('0x1cf')],{'as':_0x71f3('0x1cf'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x10f')][_0x71f3('0x117')](db[_0x71f3('0x3b')],{'as':_0x71f3('0x161'),'onDelete':_0x71f3('0x15e')});db[_0x71f3('0x10f')]['hasOne'](db['MailServerOut'],{'as':_0x71f3('0x162'),'onDelete':_0x71f3('0x15e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8a863ea..f0887b9 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf749=['./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/reports/queue','/api/sms/accounts','./api/smsApplication','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/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/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/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/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','/api/users','./api/user','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions'];(function(_0x256b67,_0x14e47b){var _0x3e2d99=function(_0x4a4c5f){while(--_0x4a4c5f){_0x256b67['push'](_0x256b67['shift']());}};_0x3e2d99(++_0x14e47b);}(_0xf749,0x1dc));var _0x9f74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf749[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x9f74('0x0'));var express=require(_0x9f74('0x1'));var errors=require(_0x9f74('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x9f74('0x3'))['setupLoggers'];var clientSideLogs=require(_0x9f74('0x4'));exports[_0x9f74('0x5')]=function(_0x5b8c50){return setupLoggers(_0x5b8c50)['then'](function(){_0x5b8c50['use'](_0x9f74('0x6'),require(_0x9f74('0x7')));_0x5b8c50[_0x9f74('0x8')]('/api/voice/chanspy',require(_0x9f74('0x9')));_0x5b8c50['use'](_0x9f74('0xa'),require(_0x9f74('0xb')));_0x5b8c50[_0x9f74('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc'),require(_0x9f74('0xd')));_0x5b8c50['use'](_0x9f74('0xe'),require(_0x9f74('0xf')));_0x5b8c50[_0x9f74('0x8')]('/api/voice/recordings',require(_0x9f74('0x10')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x11'),require('./api/screenRecording'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x12'),require(_0x9f74('0x13')));_0x5b8c50['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x14'),require(_0x9f74('0x15')));_0x5b8c50['use'](_0x9f74('0x16'),require(_0x9f74('0x17')));_0x5b8c50[_0x9f74('0x8')]('/api/voice/agents/reports',require(_0x9f74('0x18')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x19'),require('./api/voiceQueueReport'));_0x5b8c50['use']('/api/members/reports',require(_0x9f74('0x1a')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x1b'),require(_0x9f74('0x1c')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x1d'),require('./api/voiceTransferReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x1e'),require(_0x9f74('0x1f')));_0x5b8c50[_0x9f74('0x8')]('/api/mail/accounts',require(_0x9f74('0x20')));_0x5b8c50['use'](_0x9f74('0x21'),require(_0x9f74('0x22')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x23'),require(_0x9f74('0x24')));_0x5b8c50['use'](_0x9f74('0x25'),require(_0x9f74('0x26')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x27'),require(_0x9f74('0x28')));_0x5b8c50['use'](_0x9f74('0x29'),require(_0x9f74('0x2a')));_0x5b8c50[_0x9f74('0x8')]('/api/mail/reports/queue',require(_0x9f74('0x2b')));_0x5b8c50[_0x9f74('0x8')]('/api/dashboards',require(_0x9f74('0x2c')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x2d'),require('./api/dashboardItem'));_0x5b8c50[_0x9f74('0x8')]('/api/fax/accounts',require(_0x9f74('0x2e')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x2f'),require('./api/faxApplication'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x30'),require(_0x9f74('0x31')));_0x5b8c50[_0x9f74('0x8')]('/api/fax/messages',require(_0x9f74('0x32')));_0x5b8c50[_0x9f74('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x33'),require('./api/faxQueueReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x34'),require('./api/smsAccount'));_0x5b8c50[_0x9f74('0x8')]('/api/sms/applications',require(_0x9f74('0x35')));_0x5b8c50[_0x9f74('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x5b8c50[_0x9f74('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x36'),require(_0x9f74('0x37')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x38'),require(_0x9f74('0x39')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x3a'),require('./api/openchannelApplication'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x3b'),require(_0x9f74('0x3c')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x3d'),require(_0x9f74('0x3e')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x3f'),require(_0x9f74('0x40')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x41'),require(_0x9f74('0x42')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x43'),require('./api/openchannelQueueReport'));_0x5b8c50[_0x9f74('0x8')]('/api/chat/applications',require(_0x9f74('0x44')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x45'),require(_0x9f74('0x46')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x47'),require(_0x9f74('0x48')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x49'),require(_0x9f74('0x4a')));_0x5b8c50[_0x9f74('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x5b8c50['use'](_0x9f74('0x4b'),require('./api/chatGroup'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x4c'),require('./api/chatProactiveAction'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x4d'),require(_0x9f74('0x4e')));_0x5b8c50['use'](_0x9f74('0x4f'),require(_0x9f74('0x50')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x51'),require(_0x9f74('0x52')));_0x5b8c50['use'](_0x9f74('0x53'),require('./api/cmHopperBlack'));_0x5b8c50['use'](_0x9f74('0x54'),require('./api/cmHopperFinal'));_0x5b8c50['use'](_0x9f74('0x55'),require('./api/cmHopperHistory'));_0x5b8c50['use'](_0x9f74('0x56'),require(_0x9f74('0x57')));_0x5b8c50['use'](_0x9f74('0x58'),require(_0x9f74('0x59')));_0x5b8c50[_0x9f74('0x8')]('/api/automations',require(_0x9f74('0x5a')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x5b'),require('./api/cannedAnswer'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x5c'),require(_0x9f74('0x5d')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x5e'),require(_0x9f74('0x5f')));_0x5b8c50['use'](_0x9f74('0x60'),require(_0x9f74('0x61')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x62'),require(_0x9f74('0x63')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x64'),require(_0x9f74('0x65')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x66'),require(_0x9f74('0x67')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x68'),require('./api/schedule'));_0x5b8c50[_0x9f74('0x8')]('/api/sounds',require('./api/sound'));_0x5b8c50[_0x9f74('0x8')]('/api/tags',require('./api/tag'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x69'),require(_0x9f74('0x6a')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x6b'),require(_0x9f74('0x6c')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x6d'),require('./api/cmHopperAdditionalPhone'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x6e'),require('./api/template'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x6f'),require('./api/trigger'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x70'),require(_0x9f74('0x71')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x72'),require(_0x9f74('0x73')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x74'),require(_0x9f74('0x75')));_0x5b8c50['use'](_0x9f74('0x76'),require(_0x9f74('0x77')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x78'),require(_0x9f74('0x79')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x7a'),require(_0x9f74('0x7b')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x7c'),require(_0x9f74('0x7d')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x7e'),require(_0x9f74('0x7f')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x80'),require(_0x9f74('0x81')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x82'),require(_0x9f74('0x83')));_0x5b8c50['use'](_0x9f74('0x84'),require(_0x9f74('0x85')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x86'),require(_0x9f74('0x87')));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x5b8c50['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x88'),require(_0x9f74('0x89')));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/desk/configurations',require(_0x9f74('0x8a')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x8b'),require(_0x9f74('0x8c')));_0x5b8c50['use'](_0x9f74('0x8d'),require('./api/intZohoAccount'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x8e'),require(_0x9f74('0x8f')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x90'),require(_0x9f74('0x91')));_0x5b8c50['use'](_0x9f74('0x92'),require(_0x9f74('0x93')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x94'),require('./api/intZendeskConfiguration'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x95'),require('./api/intZendeskField'));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x96'),require('./api/intFreshdeskConfiguration'));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/freshdesk/fields',require(_0x9f74('0x97')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x98'),require(_0x9f74('0x99')));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/vtiger/configurations',require(_0x9f74('0x9a')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x9b'),require('./api/intVtigerField'));_0x5b8c50['use'](_0x9f74('0x9c'),require(_0x9f74('0x9d')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x9e'),require('./api/intServicenowConfiguration'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0x9f'),require(_0x9f74('0xa0')));_0x5b8c50['use'](_0x9f74('0xa1'),require(_0x9f74('0xa2')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xa3'),require(_0x9f74('0xa4')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xa5'),require(_0x9f74('0xa6')));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x5b8c50[_0x9f74('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xa7'),require(_0x9f74('0xa8')));_0x5b8c50['use'](_0x9f74('0xa9'),require(_0x9f74('0xaa')));_0x5b8c50['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x5b8c50[_0x9f74('0x8')]('/api/chat/internal/messages',require(_0x9f74('0xab')));_0x5b8c50['use'](_0x9f74('0xac'),require(_0x9f74('0xad')));_0x5b8c50[_0x9f74('0x8')]('/api/jscripty/questions/reports',require(_0x9f74('0xae')));_0x5b8c50['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xaf'),require('./api/smsQueueReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb0'),require(_0x9f74('0xb1')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb2'),require(_0x9f74('0xb3')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb4'),require('./api/jscriptyProject'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb5'),require(_0x9f74('0xb6')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb7'),require(_0x9f74('0xb8')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xb9'),require(_0x9f74('0xba')));_0x5b8c50['use'](_0x9f74('0xbb'),require('./api/squareRecording'));_0x5b8c50[_0x9f74('0x8')]('/api/square/messages',require(_0x9f74('0xbc')));_0x5b8c50[_0x9f74('0x8')]('/api/teams',require(_0x9f74('0xbd')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xbe'),require(_0x9f74('0xbf')));_0x5b8c50[_0x9f74('0x8')]('/api/campaigns',require(_0x9f74('0xc0')));_0x5b8c50[_0x9f74('0x8')]('/api/migrations',require('./api/migration'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc1'),require(_0x9f74('0xc2')));_0x5b8c50['use'](_0x9f74('0xc3'),require('./api/plugin'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc4'),require('./api/mailTransferReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc5'),require(_0x9f74('0xc6')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc7'),require(_0x9f74('0xc8')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xc9'),require(_0x9f74('0xca')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xcb'),require('./api/smsTransferReport'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xcc'),require(_0x9f74('0xcd')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xce'),require('./api/voicePrefix'));_0x5b8c50[_0x9f74('0x8')]('/api/userProfiles',require(_0x9f74('0xcf')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xd0'),require(_0x9f74('0xd1')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xd2'),require(_0x9f74('0xd3')));_0x5b8c50[_0x9f74('0x8')]('/api/userNotifications',require('./api/userNotification'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xd4'),require(_0x9f74('0xd5')));_0x5b8c50['use'](_0x9f74('0xd6'),require(_0x9f74('0xd7')));_0x5b8c50[_0x9f74('0x8')]('/api/whatsapp/interactions',require(_0x9f74('0xd8')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xd9'),require(_0x9f74('0xda')));_0x5b8c50['use'](_0x9f74('0xdb'),require(_0x9f74('0xdc')));_0x5b8c50['use'](_0x9f74('0xdd'),require(_0x9f74('0xde')));_0x5b8c50[_0x9f74('0x8')]('/api/whatsapp/queues',require(_0x9f74('0xdf')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xe0'),require('./api/cloudProvider'));_0x5b8c50['use']('/api/realtime',require('./api/realtime'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xe1'),require(_0x9f74('0xe2')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xe3'),require('./api/authLocal'));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xe4'),require(_0x9f74('0xe5')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xe6'),require('./api/authActiveDirectory'));_0x5b8c50['use'](_0x9f74('0xe7'),require(_0x9f74('0xe8')));_0x5b8c50[_0x9f74('0x8')]('/api/rpc',require(_0x9f74('0xe9')));_0x5b8c50[_0x9f74('0x8')]('/api/version',require(_0x9f74('0xea')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xeb'),require(_0x9f74('0xec')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xed'),require(_0x9f74('0xee')));_0x5b8c50['use'](_0x9f74('0xef'),require(_0x9f74('0xf0')));_0x5b8c50['use'](_0x9f74('0xf1'),clientSideLogs);_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xf2'),express[_0x9f74('0xf3')](path['join'](config[_0x9f74('0xf4')],_0x9f74('0xf2'))));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xf5'),express[_0x9f74('0xf3')](path[_0x9f74('0xf6')](config['root'],_0x9f74('0xf5'))));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xf7'),express[_0x9f74('0xf3')](path['join'](config[_0x9f74('0xf4')],'/demo')));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xf8'),express[_0x9f74('0xf3')](path[_0x9f74('0xf6')](config[_0x9f74('0xf4')],_0x9f74('0xf9'),_0x9f74('0xfa'))));_0x5b8c50[_0x9f74('0x8')](_0x9f74('0xfb'),express[_0x9f74('0xf3')](path['join'](config['root'],_0x9f74('0xfc'))));_0x5b8c50[_0x9f74('0xfd')](_0x9f74('0xfe'))[_0x9f74('0xff')](errors[0x194]);_0x5b8c50[_0x9f74('0xfd')]('/*')[_0x9f74('0xff')](function(_0x10a503,_0x1bc550){_0x1bc550[_0x9f74('0x100')](path['resolve'](_0x5b8c50[_0x9f74('0xff')]('appPath')+'/index.html'));});return _0x5b8c50;});}; \ No newline at end of file +var _0xc9c3=['/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','./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/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/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/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins'];(function(_0x1591f2,_0xc3ddd){var _0x50a96d=function(_0x58cf73){while(--_0x58cf73){_0x1591f2['push'](_0x1591f2['shift']());}};_0x50a96d(++_0xc3ddd);}(_0xc9c3,0x161));var _0x3c9c=function(_0x489489,_0x4895e4){_0x489489=_0x489489-0x0;var _0x5aa68d=_0xc9c3[_0x489489];return _0x5aa68d;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x3c9c('0x0'));var config=require(_0x3c9c('0x1'));var setupLoggers=require(_0x3c9c('0x2'))[_0x3c9c('0x3')];var clientSideLogs=require(_0x3c9c('0x4'));exports[_0x3c9c('0x5')]=function(_0x533222){return setupLoggers(_0x533222)[_0x3c9c('0x6')](function(){_0x533222[_0x3c9c('0x7')](_0x3c9c('0x8'),require(_0x3c9c('0x9')));_0x533222[_0x3c9c('0x7')]('/api/voice/chanspy',require(_0x3c9c('0xa')));_0x533222['use'](_0x3c9c('0xb'),require('./api/voiceContext'));_0x533222['use'](_0x3c9c('0xc'),require(_0x3c9c('0xd')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xe'),require(_0x3c9c('0xf')));_0x533222['use']('/api/voice/queues',require(_0x3c9c('0x10')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x11'),require(_0x3c9c('0x12')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x13'),require(_0x3c9c('0x14')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x15'),require('./api/voiceMail'));_0x533222['use'](_0x3c9c('0x16'),require(_0x3c9c('0x17')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x18'),require('./api/voiceCallReport'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x19'),require(_0x3c9c('0x1a')));_0x533222[_0x3c9c('0x7')]('/api/voice/agents/reports',require(_0x3c9c('0x1b')));_0x533222[_0x3c9c('0x7')]('/api/voice/queues/reports',require(_0x3c9c('0x1c')));_0x533222[_0x3c9c('0x7')]('/api/members/reports',require(_0x3c9c('0x1d')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x1e'),require('./api/trunk'));_0x533222['use'](_0x3c9c('0x1f'),require(_0x3c9c('0x20')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x21'),require(_0x3c9c('0x22')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x23'),require('./api/mailAccount'));_0x533222['use'](_0x3c9c('0x24'),require(_0x3c9c('0x25')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x26'),require('./api/mailSubstatus'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x27'),require(_0x3c9c('0x28')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x29'),require('./api/mailMessage'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x2a'),require('./api/mailApplication'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x2b'),require(_0x3c9c('0x2c')));_0x533222['use'](_0x3c9c('0x2d'),require(_0x3c9c('0x2e')));_0x533222[_0x3c9c('0x7')]('/api/dashboards/items',require(_0x3c9c('0x2f')));_0x533222['use'](_0x3c9c('0x30'),require('./api/faxAccount'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x31'),require(_0x3c9c('0x32')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x33'),require(_0x3c9c('0x34')));_0x533222['use'](_0x3c9c('0x35'),require(_0x3c9c('0x36')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x37'),require('./api/faxQueue'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x38'),require(_0x3c9c('0x39')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x3a'),require(_0x3c9c('0x3b')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x3c'),require(_0x3c9c('0x3d')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x3e'),require(_0x3c9c('0x3f')));_0x533222['use']('/api/sms/messages',require(_0x3c9c('0x40')));_0x533222[_0x3c9c('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x41'),require(_0x3c9c('0x42')));_0x533222['use']('/api/openchannel/applications',require(_0x3c9c('0x43')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x44'),require(_0x3c9c('0x45')));_0x533222['use'](_0x3c9c('0x46'),require(_0x3c9c('0x47')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x48'),require(_0x3c9c('0x49')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x4a'),require('./api/chatWebsite'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x4b'),require('./api/openchannelQueueReport'));_0x533222[_0x3c9c('0x7')]('/api/chat/applications',require(_0x3c9c('0x4c')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x4d'),require(_0x3c9c('0x4e')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x4f'),require('./api/chatMessage'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x50'),require(_0x3c9c('0x51')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x52'),require('./api/chatQueue'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x53'),require('./api/chatGroup'));_0x533222['use']('/api/chat/proactive_actions',require(_0x3c9c('0x54')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x55'),require(_0x3c9c('0x56')));_0x533222['use']('/api/cm/contacts',require(_0x3c9c('0x57')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x58'),require(_0x3c9c('0x59')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x5a'),require(_0x3c9c('0x5b')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x5c'),require(_0x3c9c('0x5d')));_0x533222['use'](_0x3c9c('0x5e'),require('./api/cmHopperHistory'));_0x533222['use']('/api/cm/custom_fields',require(_0x3c9c('0x5f')));_0x533222['use'](_0x3c9c('0x60'),require(_0x3c9c('0x61')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x62'),require('./api/automation'));_0x533222['use'](_0x3c9c('0x63'),require(_0x3c9c('0x64')));_0x533222['use'](_0x3c9c('0x65'),require(_0x3c9c('0x66')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x67'),require(_0x3c9c('0x68')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x69'),require(_0x3c9c('0x6a')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x6b'),require(_0x3c9c('0x6c')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x6d'),require(_0x3c9c('0x6e')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x6f'),require(_0x3c9c('0x70')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x71'),require(_0x3c9c('0x72')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x73'),require(_0x3c9c('0x74')));_0x533222['use'](_0x3c9c('0x75'),require(_0x3c9c('0x76')));_0x533222[_0x3c9c('0x7')]('/api/contact_item_types',require(_0x3c9c('0x77')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x78'),require(_0x3c9c('0x79')));_0x533222['use'](_0x3c9c('0x7a'),require(_0x3c9c('0x7b')));_0x533222['use'](_0x3c9c('0x7c'),require(_0x3c9c('0x7d')));_0x533222[_0x3c9c('0x7')]('/api/triggers',require(_0x3c9c('0x7e')));_0x533222[_0x3c9c('0x7')]('/api/variables',require('./api/variable'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x7f'),require(_0x3c9c('0x80')));_0x533222['use'](_0x3c9c('0x81'),require(_0x3c9c('0x82')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x83'),require(_0x3c9c('0x84')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x85'),require(_0x3c9c('0x86')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x87'),require(_0x3c9c('0x88')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x89'),require(_0x3c9c('0x8a')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x8b'),require(_0x3c9c('0x8c')));_0x533222['use'](_0x3c9c('0x8d'),require(_0x3c9c('0x8e')));_0x533222[_0x3c9c('0x7')]('/api/integrations/salesforce/accounts',require(_0x3c9c('0x8f')));_0x533222[_0x3c9c('0x7')]('/api/integrations/salesforce/configurations',require(_0x3c9c('0x90')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x91'),require(_0x3c9c('0x92')));_0x533222[_0x3c9c('0x7')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x93'),require(_0x3c9c('0x94')));_0x533222['use']('/api/integrations/sugarcrm/fields',require(_0x3c9c('0x95')));_0x533222['use'](_0x3c9c('0x96'),require(_0x3c9c('0x97')));_0x533222[_0x3c9c('0x7')]('/api/integrations/desk/configurations',require(_0x3c9c('0x98')));_0x533222['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x99'),require(_0x3c9c('0x9a')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x9b'),require(_0x3c9c('0x9c')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x9d'),require(_0x3c9c('0x9e')));_0x533222['use'](_0x3c9c('0x9f'),require(_0x3c9c('0xa0')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xa1'),require(_0x3c9c('0xa2')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xa3'),require('./api/intZendeskField'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xa4'),require(_0x3c9c('0xa5')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xa6'),require(_0x3c9c('0xa7')));_0x533222['use'](_0x3c9c('0xa8'),require(_0x3c9c('0xa9')));_0x533222['use'](_0x3c9c('0xaa'),require('./api/intVtigerAccount'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xab'),require(_0x3c9c('0xac')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xad'),require(_0x3c9c('0xae')));_0x533222['use'](_0x3c9c('0xaf'),require(_0x3c9c('0xb0')));_0x533222['use'](_0x3c9c('0xb1'),require('./api/intServicenowConfiguration'));_0x533222[_0x3c9c('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x533222['use'](_0x3c9c('0xb2'),require(_0x3c9c('0xb3')));_0x533222['use'](_0x3c9c('0xb4'),require(_0x3c9c('0xb5')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xb6'),require(_0x3c9c('0xb7')));_0x533222[_0x3c9c('0x7')]('/api/integrations/freshsales/accounts',require(_0x3c9c('0xb8')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xb9'),require(_0x3c9c('0xba')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xbb'),require(_0x3c9c('0xbc')));_0x533222['use'](_0x3c9c('0xbd'),require(_0x3c9c('0xbe')));_0x533222[_0x3c9c('0x7')]('/api/chat/reports/queue',require(_0x3c9c('0xbf')));_0x533222[_0x3c9c('0x7')]('/api/chat/internal/messages',require(_0x3c9c('0xc0')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xc1'),require(_0x3c9c('0xc2')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xc3'),require(_0x3c9c('0xc4')));_0x533222['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xc5'),require(_0x3c9c('0xc6')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xc7'),require(_0x3c9c('0xc8')));_0x533222[_0x3c9c('0x7')]('/api/square/details/reports',require(_0x3c9c('0xc9')));_0x533222[_0x3c9c('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xca'),require('./api/setting'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xcb'),require(_0x3c9c('0xcc')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xcd'),require('./api/squareProject'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xce'),require(_0x3c9c('0xcf')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd0'),require('./api/squareMessage'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd1'),require(_0x3c9c('0xd2')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd3'),require('./api/license'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd4'),require(_0x3c9c('0xd5')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd6'),require(_0x3c9c('0xd7')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xd8'),require(_0x3c9c('0xd9')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xda'),require('./api/plugin'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xdb'),require(_0x3c9c('0xdc')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xdd'),require(_0x3c9c('0xde')));_0x533222['use'](_0x3c9c('0xdf'),require(_0x3c9c('0xe0')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xe1'),require(_0x3c9c('0xe2')));_0x533222['use'](_0x3c9c('0xe3'),require(_0x3c9c('0xe4')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xe5'),require(_0x3c9c('0xe6')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xe7'),require(_0x3c9c('0xe8')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xe9'),require(_0x3c9c('0xea')));_0x533222['use']('/api/userProfile/sections',require(_0x3c9c('0xeb')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xec'),require('./api/userProfileResource'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xed'),require('./api/userNotification'));_0x533222[_0x3c9c('0x7')]('/api/whatsapp/accounts',require(_0x3c9c('0xee')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xef'),require(_0x3c9c('0xf0')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xf1'),require(_0x3c9c('0xf2')));_0x533222['use'](_0x3c9c('0xf3'),require('./api/whatsappMessage'));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xf4'),require(_0x3c9c('0xf5')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xf6'),require('./api/whatsappTransferReport'));_0x533222[_0x3c9c('0x7')]('/api/whatsapp/queues',require(_0x3c9c('0xf7')));_0x533222[_0x3c9c('0x7')]('/api/cloudProviders',require(_0x3c9c('0xf8')));_0x533222['use'](_0x3c9c('0xf9'),require(_0x3c9c('0xfa')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xfb'),require(_0x3c9c('0xfc')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0xfd'),require(_0x3c9c('0xfe')));_0x533222['use'](_0x3c9c('0xff'),require(_0x3c9c('0x100')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x101'),require(_0x3c9c('0x102')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x103'),require(_0x3c9c('0x104')));_0x533222['use']('/api/rpc',require(_0x3c9c('0x105')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x106'),require(_0x3c9c('0x107')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x108'),require(_0x3c9c('0x109')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x10a'),require(_0x3c9c('0x10b')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x10c'),require(_0x3c9c('0x10d')));_0x533222['use'](_0x3c9c('0x10e'),clientSideLogs);_0x533222[_0x3c9c('0x7')](_0x3c9c('0x10f'),express[_0x3c9c('0x110')](path[_0x3c9c('0x111')](config[_0x3c9c('0x112')],_0x3c9c('0x10f'))));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x113'),express[_0x3c9c('0x110')](path[_0x3c9c('0x111')](config[_0x3c9c('0x112')],_0x3c9c('0x113'))));_0x533222[_0x3c9c('0x7')]('/demo',express['static'](path[_0x3c9c('0x111')](config[_0x3c9c('0x112')],'/demo')));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x114'),express[_0x3c9c('0x110')](path[_0x3c9c('0x111')](config[_0x3c9c('0x112')],_0x3c9c('0x115'),_0x3c9c('0x116'))));_0x533222[_0x3c9c('0x7')](_0x3c9c('0x117'),express[_0x3c9c('0x110')](path[_0x3c9c('0x111')](config[_0x3c9c('0x112')],'/server/files/plugins')));_0x533222[_0x3c9c('0x118')](_0x3c9c('0x119'))['get'](errors[0x194]);_0x533222[_0x3c9c('0x118')]('/*')[_0x3c9c('0x11a')](function(_0x274fd3,_0x34ce8b){_0x34ce8b[_0x3c9c('0x11b')](path[_0x3c9c('0x11c')](_0x533222[_0x3c9c('0x11a')]('appPath')+_0x3c9c('0x11d')));});return _0x533222;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c43d39e..3b52ccf 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a2a=['server','http','rpc','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.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/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.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'];(function(_0x4140a6,_0x493bb2){var _0x202fee=function(_0x14a1e7){while(--_0x14a1e7){_0x4140a6['push'](_0x4140a6['shift']());}};_0x202fee(++_0x493bb2);}(_0x1a2a,0xd3));var _0xa1a2=function(_0x2e47c1,_0x1bed12){_0x2e47c1=_0x2e47c1-0x0;var _0x1a0364=_0x1a2a[_0x2e47c1];return _0x1a0364;};'use strict';var jayson=require(_0xa1a2('0x0'));var _=require(_0xa1a2('0x1'));var config=require(_0xa1a2('0x2'));exports[_0xa1a2('0x3')]=function(){return new Promise(function(_0x54edf3,_0x6842fe){var _0x2ef467={};_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x4')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x6')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/voiceQueue/voiceQueue.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/voiceRecording/voiceRecording.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x7')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x8')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x9')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0xa')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0xb')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0xc')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0xd')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0xe')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0xf')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x10')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x11')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x12')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x13')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x14')));_0x2ef467=_['merge'](_0x2ef467,require('../api/faxApplication/faxApplication.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x15')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/faxMessage/faxMessage.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x16')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x17')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x18')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x19')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x1a')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x1b')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x1c')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x1d')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x1e')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x1f')));_0x2ef467=_['merge'](_0x2ef467,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/chatInteraction/chatInteraction.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x20')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/chatQueue/chatQueue.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x21')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/cmHopper/cmHopper.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x22')));_0x2ef467=_['merge'](_0x2ef467,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x23')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x24')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x25')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x26')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x27')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x28')));_0x2ef467=_['merge'](_0x2ef467,require('../api/template/template.rpc'));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x29')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x2a')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x2b')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x2c')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2ef467=_['merge'](_0x2ef467,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x2d')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x2e')));_0x2ef467=_['merge'](_0x2ef467,require(_0xa1a2('0x2f')));_0x2ef467=_['merge'](_0x2ef467,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x30')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x31')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x32')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x33')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x34')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/squareRecording/squareRecording.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x35')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x36')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require('../api/attachment/attachment.rpc'));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x37')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x38')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x39')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x3a')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x3b')));_0x2ef467=_[_0xa1a2('0x5')](_0x2ef467,require(_0xa1a2('0x3c')));var _0x3b9f2d=jayson[_0xa1a2('0x3d')](_0x2ef467)[_0xa1a2('0x3e')]();var _0x46f9b2=config[_0xa1a2('0x3f')]['port']||config['port']+0x1;var _0x100abe=config[_0xa1a2('0x3f')]['ip']||'localhost';_0x3b9f2d['on'](_0xa1a2('0x40'),function(_0x1e84f2){return _0x6842fe(_0x1e84f2);});_0x3b9f2d['listen'](_0x46f9b2,_0x100abe,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x100abe,_0x46f9b2);require(_0xa1a2('0x41'))[_0xa1a2('0x42')]();return _0x54edf3(_0xa1a2('0x43')+_0x100abe+':'+_0x46f9b2);});});}; \ No newline at end of file +var _0x76b7=['../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc'];(function(_0x78f539,_0x97f125){var _0x15ce92=function(_0x6d96ad){while(--_0x6d96ad){_0x78f539['push'](_0x78f539['shift']());}};_0x15ce92(++_0x97f125);}(_0x76b7,0x80));var _0x776b=function(_0x373744,_0x1e8733){_0x373744=_0x373744-0x0;var _0x400da3=_0x76b7[_0x373744];return _0x400da3;};'use strict';var jayson=require(_0x776b('0x0'));var _=require(_0x776b('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x887f11,_0x3fee36){var _0x4b3731={};_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x3')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x4')));_0x4b3731=_['merge'](_0x4b3731,require('../api/voiceQueue/voiceQueue.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x5')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x6')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x7')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x8')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x9')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xa')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/trunk/trunk.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xb')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xc')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/mailServerIn/mailServerIn.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/mailAccount/mailAccount.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xd')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xe')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0xf')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x10')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x11')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x12')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x13')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x14')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x15')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x16')));_0x4b3731=_['merge'](_0x4b3731,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x17')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/smsInteraction/smsInteraction.rpc'));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x18')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x19')));_0x4b3731=_['merge'](_0x4b3731,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x1a')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x1b')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x1c')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/chatInteraction/chatInteraction.rpc'));_0x4b3731=_['merge'](_0x4b3731,require('../api/chatMessage/chatMessage.rpc'));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x1d')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x1e')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x1f')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x20')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x21')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x22')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x23')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/pause/pause.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/sound/sound.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x24')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x25')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x26')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/variable/variable.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x27')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x28')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x29')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x2a')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x2b')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x2c')));_0x4b3731=_['merge'](_0x4b3731,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x2d')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x2e')));_0x4b3731=_['merge'](_0x4b3731,require(_0x776b('0x2f')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x30')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x31')));_0x4b3731=_['merge'](_0x4b3731,require('../api/squareOdbc/squareOdbc.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x32')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/squareRecording/squareRecording.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x33')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x34')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x35')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x36')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x37')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x38')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x39')));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4b3731=_[_0x776b('0x2')](_0x4b3731,require(_0x776b('0x3a')));var _0x2f212c=jayson[_0x776b('0x3b')](_0x4b3731)[_0x776b('0x3c')]();var _0x340bc7=config[_0x776b('0x3d')][_0x776b('0x3e')]||config[_0x776b('0x3e')]+0x1;var _0x50c4fe=config['rpc']['ip']||'localhost';_0x2f212c['on'](_0x776b('0x3f'),function(_0x2aa2ed){return _0x3fee36(_0x2aa2ed);});_0x2f212c['listen'](_0x340bc7,_0x50c4fe,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x50c4fe,_0x340bc7);require(_0x776b('0x40'))[_0x776b('0x41')]();return _0x887f11(_0x776b('0x42')+_0x50c4fe+':'+_0x340bc7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b14c454..fa798f3 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 _0xf0b0=['prototype','sendRequest','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','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','WAIT','label','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','write','destroy','inherits'];(function(_0x5c3303,_0x308e03){var _0x5a6f46=function(_0x193bc9){while(--_0x193bc9){_0x5c3303['push'](_0x5c3303['shift']());}};_0x5a6f46(++_0x308e03);}(_0xf0b0,0xc8));var _0x0f0b=function(_0x13b514,_0x1a9a66){_0x13b514=_0x13b514-0x0;var _0x4b4fee=_0xf0b0[_0x13b514];return _0x4b4fee;};'use strict';var util=require(_0x0f0b('0x0'));var _=require(_0x0f0b('0x1'));var EventEmitter=require(_0x0f0b('0x2'))[_0x0f0b('0x3')];var AGIReply=require(_0x0f0b('0x4'));var AGIError=require(_0x0f0b('0x5'));function AGIChannel(_0x15cacf){var _0xccade2=this,_0x32b620=new AGIReply(),_0x49ee0d=![],_0x5daf4a={};EventEmitter['call'](_0xccade2);_0x15cacf[_0x0f0b('0x6')](_0x0f0b('0x7'));_0x15cacf[_0x0f0b('0x8')](0x8*0x3c*0x3c*0x3e8);_0x32b620[_0x0f0b('0x6')](_0x0f0b('0x7'));_0x32b620['on'](_0x0f0b('0x9'),function(_0x57d855){for(var _0x38061a in _0x57d855){_0xccade2[_0x38061a]=_0x57d855[_0x38061a];}_0xccade2[_0x0f0b('0xa')](_0x0f0b('0xb'));});_0x32b620['on'](_0x0f0b('0xc'),function(_0x5afd74){if(_0x5afd74[_0x0f0b('0xd')]()==_0x0f0b('0xe')){_0xccade2['emit']('hangup');return;}if(_0x5afd74['substring'](0x0,0xb)==_0x0f0b('0xf')){_0x49ee0d=!![];}if(_0x49ee0d){_0x5daf4a['rx']+=_0x5afd74+'\x0a';if(_0x5afd74['search'](_0x0f0b('0x10'))!=-0x1){_0x49ee0d=![];}}else{_0x5daf4a['rx']=_0x5afd74;}if(_0x49ee0d){return;}if(typeof _0x5daf4a['cb']==_0x0f0b('0x11')){var _0x521096=_0x5daf4a['rx'][_0x0f0b('0x12')](0x0,0x3),_0x3871ea=null,_0x204dce=null;_0x521096=parseInt(_0x521096);if(isNaN(_0x521096)){_0x5daf4a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0f0b('0x13')});return;}if(_0x521096!=0xc8){_0x5daf4a['cb'](null,{'code':_0x521096,'result':-0x1,'extra':'KO'});return;}_0x3871ea=_0x5daf4a['rx'][_0x0f0b('0x12')](0x4)[_0x0f0b('0x14')](_0x0f0b('0x15'),'');if(_0x3871ea[_0x0f0b('0x16')]('\x20')!=-0x1){_0x3871ea=_0x3871ea[_0x0f0b('0x17')](0x0,_0x3871ea[_0x0f0b('0x16')]('\x20'));}if(_[_0x0f0b('0x18')](_0x3871ea,'-1')){_0x3871ea=parseInt(_0x3871ea);}_0x204dce=_0x5daf4a['rx'][_0x0f0b('0x19')]('\x20');if(_0x204dce[_0x0f0b('0x1a')]==0x3){_0x204dce=_0x204dce[0x2][_0x0f0b('0x12')](0x1,_0x204dce[0x2][_0x0f0b('0x1a')]-0x1);}else if(_0x204dce[_0x0f0b('0x1a')]>0x3){var _0x2c406d=/\((.+)\)/;var _0x98d74=_0x5daf4a['rx'][_0x0f0b('0x1b')](_0x2c406d);if(_0x98d74){_0x204dce=_0x98d74[0x1];}else{_0x204dce=null;}}else{_0x204dce=null;}_0x5daf4a['cb'](null,{'code':_0x521096,'result':_0x3871ea,'extra':_0x204dce});}});_0x15cacf['on'](_0x0f0b('0x1c'),function(_0xe8bb7e){_0xccade2[_0x0f0b('0xa')](_0x0f0b('0x1c'),new AGIError(_0x0f0b('0x1d'),_0xe8bb7e['code']));});_0x15cacf['on'](_0x0f0b('0x1e'),function(){_0xccade2['emit'](_0x0f0b('0x1e'),new AGIError(_0x0f0b('0x1f')));});_0x15cacf['on'](_0x0f0b('0x20'),function(){_0xccade2[_0x0f0b('0xa')](_0x0f0b('0x20'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x15cacf['destroy']();});_0x15cacf[_0x0f0b('0x21')](_0x32b620);this['command']=function(_0x4da9fc,_0x497c67){var _0x4da9fc=_0x4da9fc||'',_0x497c67=typeof _0x497c67==_0x0f0b('0x11')?_0x497c67:new Function();_0x5daf4a={'tx':_0x4da9fc,'rx':'','cb':_0x497c67};_0x15cacf[_0x0f0b('0x22')](_0x4da9fc+'\x0a');},this[_0x0f0b('0x1e')]=function(){_0x15cacf[_0x0f0b('0x23')]();};}util[_0x0f0b('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x26')]=function(_0x4f5c3e){return this['command']['sync'](this,_0x4f5c3e);};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x27')]=function(){return this[_0x0f0b('0x26')](_0x0f0b('0x28'));};AGIChannel[_0x0f0b('0x25')]['getData']=function(_0x5094f7,_0x294c70,_0x1ad777){_0x5094f7=_0x5094f7===undefined?_0x0f0b('0x29'):_0x5094f7;_0x294c70=_0x294c70===undefined?'5':_0x294c70;_0x1ad777=_0x1ad777===undefined?'1':_0x1ad777;return this[_0x0f0b('0x26')](util['format'](_0x0f0b('0x2a'),_0x5094f7,_0x294c70*0x3e8,_0x1ad777));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x2b')]=function(_0x280f69){_0x280f69=_0x280f69||_0x0f0b('0x2c');return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x2e'),_0x280f69));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x2f')]=function(_0x51203e,_0x56869d){if(_[_0x0f0b('0x30')](_0x56869d)){return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x31'),_0x51203e,_0x56869d[_0x0f0b('0x32')](',')));}return this['sendRequest'](util[_0x0f0b('0x2d')]('EXEC\x20%s\x20%s',_0x51203e,_0x56869d));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x33')]=function(_0x1ced97){return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')]('SET\x20CONTEXT\x20%s',_0x1ced97));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x34')]=function(_0x1f8307){return this[_0x0f0b('0x26')](util['format'](_0x0f0b('0x35'),_0x1f8307));};AGIChannel['prototype'][_0x0f0b('0x36')]=function(_0x4545d4){return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x37'),_0x4545d4));};AGIChannel['prototype'][_0x0f0b('0xe')]=function(){return this['sendRequest'](_0x0f0b('0x38'));};AGIChannel[_0x0f0b('0x25')]['setVariable']=function(_0x11ee71,_0x2446f8){var _0x233b44=_[_0x0f0b('0x39')](_0x2446f8)||_[_0x0f0b('0x3a')](_0x2446f8)?_0x2446f8[_0x0f0b('0x3b')]():_0x2446f8;return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x3c'),_0x11ee71,_0x233b44?_0x233b44['toString']()[_0x0f0b('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x3d')]=function(_0xa62e7e,_0x497824){return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x3e'),_0xa62e7e,_0x497824));};AGIChannel['prototype'][_0x0f0b('0x3f')]=function(_0x4fed7f,_0x118d5e){return this[_0x0f0b('0x26')](util['format'](_0x0f0b('0x40'),_0x4fed7f,_0x118d5e));};AGIChannel[_0x0f0b('0x25')]['sayPhonetic']=function(_0x3c591a,_0x3fb454){return this['sendRequest'](util['format'](_0x0f0b('0x41'),_0x3c591a,_0x3fb454));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x42')]=function(_0x4501a0,_0x117972,_0x432f92){_0x117972=_0x117972||this[_0x0f0b('0x43')];_0x432f92=_0x432f92||0x1;this[_0x0f0b('0x33')](_0x4501a0);this['setExtension'](_0x117972);this['setPriority'](_0x432f92);return this[_0x0f0b('0x2b')](util[_0x0f0b('0x2d')](_0x0f0b('0x44'),_0x4501a0,_0x117972,_0x432f92));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x45')]=function(_0x5a1091){return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x46'),_0x5a1091));};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x47')]=function(_0x541dd0,_0x1663ab,_0x1017cc,_0x263ea5,_0x2a56fa,_0x330445){_0x1663ab=_0x1663ab||_0x0f0b('0x48');_0x1017cc=_0x1017cc||'';_0x263ea5=_0x263ea5===undefined?-0x1:_0x263ea5==='-1'?-0x1:_0x263ea5*0x3e8;_0x2a56fa=_0x2a56fa===undefined?'':'s='+_0x2a56fa;_0x330445=_0x330445?'BEEP':'';return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')](_0x0f0b('0x49'),_0x541dd0,_0x1663ab,_0x1017cc,_0x263ea5,_0x330445,_0x2a56fa));};AGIChannel['prototype'][_0x0f0b('0x4a')]=function(_0x1b0f52,_0x590000){_0x590000=_0x590000||'';return this[_0x0f0b('0x26')](util[_0x0f0b('0x2d')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1b0f52,_0x590000));};AGIChannel[_0x0f0b('0x25')]['agi']=function(_0x410cbc){return this[_0x0f0b('0x2f')](_0x0f0b('0x4b'),_0x410cbc);};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x4c')]=function(_0x5ccac7){return this[_0x0f0b('0x2f')](_0x0f0b('0x4d'),_0x5ccac7);};AGIChannel[_0x0f0b('0x25')][_0x0f0b('0x1c')]=function(_0x1c18c2,_0x4becf2){this[_0x0f0b('0x2b')](util[_0x0f0b('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1c18c2['id'],_0x1c18c2[_0x0f0b('0x4e')],_0x4becf2));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x879a=['startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','replace','indexOf','substr'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x879a,0x12e));var _0xa879=function(_0x3cf11e,_0x2f67f9){_0x3cf11e=_0x3cf11e-0x0;var _0xa4c24a=_0x879a[_0x3cf11e];return _0xa4c24a;};'use strict';var util=require(_0xa879('0x0'));var _=require('lodash');var EventEmitter=require(_0xa879('0x1'))[_0xa879('0x2')];var AGIReply=require(_0xa879('0x3'));var AGIError=require(_0xa879('0x4'));function AGIChannel(_0xca8f9f){var _0x58a2d7=this,_0x22692b=new AGIReply(),_0xf61a50=![],_0x18c5c9={};EventEmitter[_0xa879('0x5')](_0x58a2d7);_0xca8f9f[_0xa879('0x6')](_0xa879('0x7'));_0xca8f9f[_0xa879('0x8')](0x8*0x3c*0x3c*0x3e8);_0x22692b[_0xa879('0x6')](_0xa879('0x7'));_0x22692b['on'](_0xa879('0x9'),function(_0x5b524b){for(var _0x5ecf10 in _0x5b524b){_0x58a2d7[_0x5ecf10]=_0x5b524b[_0x5ecf10];}_0x58a2d7[_0xa879('0xa')](_0xa879('0xb'));});_0x22692b['on'](_0xa879('0xc'),function(_0xe76dd6){if(_0xe76dd6[_0xa879('0xd')]()=='hangup'){_0x58a2d7[_0xa879('0xa')](_0xa879('0xe'));return;}if(_0xe76dd6[_0xa879('0xf')](0x0,0xb)=='520-Invalid'){_0xf61a50=!![];}if(_0xf61a50){_0x18c5c9['rx']+=_0xe76dd6+'\x0a';if(_0xe76dd6[_0xa879('0x10')](_0xa879('0x11'))!=-0x1){_0xf61a50=![];}}else{_0x18c5c9['rx']=_0xe76dd6;}if(_0xf61a50){return;}if(typeof _0x18c5c9['cb']==_0xa879('0x12')){var _0x3e0d3e=_0x18c5c9['rx'][_0xa879('0xf')](0x0,0x3),_0x220bc1=null,_0x19b34c=null;_0x3e0d3e=parseInt(_0x3e0d3e);if(isNaN(_0x3e0d3e)){_0x18c5c9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3e0d3e!=0xc8){_0x18c5c9['cb'](null,{'code':_0x3e0d3e,'result':-0x1,'extra':'KO'});return;}_0x220bc1=_0x18c5c9['rx']['substring'](0x4)[_0xa879('0x13')]('result=','');if(_0x220bc1[_0xa879('0x14')]('\x20')!=-0x1){_0x220bc1=_0x220bc1[_0xa879('0x15')](0x0,_0x220bc1[_0xa879('0x14')]('\x20'));}if(_[_0xa879('0x16')](_0x220bc1,'-1')){_0x220bc1=parseInt(_0x220bc1);}_0x19b34c=_0x18c5c9['rx'][_0xa879('0x17')]('\x20');if(_0x19b34c[_0xa879('0x18')]==0x3){_0x19b34c=_0x19b34c[0x2]['substring'](0x1,_0x19b34c[0x2]['length']-0x1);}else if(_0x19b34c['length']>0x3){var _0x5b8280=/\((.+)\)/;var _0x144958=_0x18c5c9['rx'][_0xa879('0x19')](_0x5b8280);if(_0x144958){_0x19b34c=_0x144958[0x1];}else{_0x19b34c=null;}}else{_0x19b34c=null;}_0x18c5c9['cb'](null,{'code':_0x3e0d3e,'result':_0x220bc1,'extra':_0x19b34c});}});_0xca8f9f['on'](_0xa879('0x1a'),function(_0x28883a){_0x58a2d7[_0xa879('0xa')](_0xa879('0x1a'),new AGIError(_0xa879('0x1b'),_0x28883a[_0xa879('0x1c')]));});_0xca8f9f['on'](_0xa879('0x1d'),function(){_0x58a2d7[_0xa879('0xa')](_0xa879('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xca8f9f['on'](_0xa879('0x1e'),function(){_0x58a2d7['emit'](_0xa879('0x1e'),new AGIError(_0xa879('0x1f')));_0xca8f9f[_0xa879('0x20')]();});_0xca8f9f['pipe'](_0x22692b);this[_0xa879('0x21')]=function(_0x104e55,_0x442a80){var _0x104e55=_0x104e55||'',_0x442a80=typeof _0x442a80==_0xa879('0x12')?_0x442a80:new Function();_0x18c5c9={'tx':_0x104e55,'rx':'','cb':_0x442a80};_0xca8f9f[_0xa879('0x22')](_0x104e55+'\x0a');},this[_0xa879('0x1d')]=function(){_0xca8f9f[_0xa879('0x20')]();};}util[_0xa879('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xa879('0x24')][_0xa879('0x25')]=function(_0x401317){return this[_0xa879('0x21')][_0xa879('0x26')](this,_0x401317);};AGIChannel['prototype'][_0xa879('0x27')]=function(){return this['sendRequest'](_0xa879('0x28'));};AGIChannel[_0xa879('0x24')][_0xa879('0x29')]=function(_0x495121,_0x4e17c5,_0x91fe82){_0x495121=_0x495121===undefined?_0xa879('0x2a'):_0x495121;_0x4e17c5=_0x4e17c5===undefined?'5':_0x4e17c5;_0x91fe82=_0x91fe82===undefined?'1':_0x91fe82;return this[_0xa879('0x25')](util[_0xa879('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x495121,_0x4e17c5*0x3e8,_0x91fe82));};AGIChannel[_0xa879('0x24')][_0xa879('0x2c')]=function(_0x520659){_0x520659=_0x520659||'NO\x20MESSAGE';return this['sendRequest'](util['format'](_0xa879('0x2d'),_0x520659));};AGIChannel[_0xa879('0x24')][_0xa879('0x2e')]=function(_0x2d698e,_0x15decf){if(_[_0xa879('0x2f')](_0x15decf)){return this[_0xa879('0x25')](util[_0xa879('0x2b')](_0xa879('0x30'),_0x2d698e,_0x15decf[_0xa879('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x2d698e,_0x15decf));};AGIChannel[_0xa879('0x24')]['setContext']=function(_0x3ab7dd){return this['sendRequest'](util[_0xa879('0x2b')](_0xa879('0x32'),_0x3ab7dd));};AGIChannel[_0xa879('0x24')][_0xa879('0x33')]=function(_0x488c88){return this[_0xa879('0x25')](util[_0xa879('0x2b')](_0xa879('0x34'),_0x488c88));};AGIChannel[_0xa879('0x24')][_0xa879('0x35')]=function(_0x2057a8){return this['sendRequest'](util[_0xa879('0x2b')](_0xa879('0x36'),_0x2057a8));};AGIChannel[_0xa879('0x24')][_0xa879('0xe')]=function(){return this[_0xa879('0x25')](_0xa879('0x37'));};AGIChannel[_0xa879('0x24')][_0xa879('0x38')]=function(_0xd5deba,_0x5d9a41){var _0xc2eec7=_[_0xa879('0x39')](_0x5d9a41)||_[_0xa879('0x3a')](_0x5d9a41)?_0x5d9a41[_0xa879('0x3b')]():_0x5d9a41;return this[_0xa879('0x25')](util[_0xa879('0x2b')](_0xa879('0x3c'),_0xd5deba,_0xc2eec7?_0xc2eec7[_0xa879('0x3b')]()[_0xa879('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa879('0x3d')]=function(_0x1d7720,_0x55c486){return this[_0xa879('0x25')](util[_0xa879('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x1d7720,_0x55c486));};AGIChannel[_0xa879('0x24')][_0xa879('0x3e')]=function(_0x1dfa6f,_0x215fd8){return this[_0xa879('0x25')](util[_0xa879('0x2b')](_0xa879('0x3f'),_0x1dfa6f,_0x215fd8));};AGIChannel[_0xa879('0x24')][_0xa879('0x40')]=function(_0x24f4b4,_0x5ec2d7){return this[_0xa879('0x25')](util[_0xa879('0x2b')](_0xa879('0x41'),_0x24f4b4,_0x5ec2d7));};AGIChannel[_0xa879('0x24')][_0xa879('0x42')]=function(_0x1fc1e7,_0x4bd152,_0x980713){_0x4bd152=_0x4bd152||this[_0xa879('0x43')];_0x980713=_0x980713||0x1;this[_0xa879('0x44')](_0x1fc1e7);this[_0xa879('0x33')](_0x4bd152);this[_0xa879('0x35')](_0x980713);return this[_0xa879('0x2c')](util[_0xa879('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1fc1e7,_0x4bd152,_0x980713));};AGIChannel[_0xa879('0x24')][_0xa879('0x45')]=function(_0x4a4c95){return this['sendRequest'](util[_0xa879('0x2b')](_0xa879('0x46'),_0x4a4c95));};AGIChannel[_0xa879('0x24')]['recordFile']=function(_0x189410,_0x29cf68,_0x40c6d1,_0x2c922d,_0x1f4869,_0x18c4fc){_0x29cf68=_0x29cf68||_0xa879('0x47');_0x40c6d1=_0x40c6d1||'';_0x2c922d=_0x2c922d===undefined?-0x1:_0x2c922d==='-1'?-0x1:_0x2c922d*0x3e8;_0x1f4869=_0x1f4869===undefined?'':'s='+_0x1f4869;_0x18c4fc=_0x18c4fc?_0xa879('0x48'):'';return this[_0xa879('0x25')](util[_0xa879('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x189410,_0x29cf68,_0x40c6d1,_0x2c922d,_0x18c4fc,_0x1f4869));};AGIChannel[_0xa879('0x24')][_0xa879('0x49')]=function(_0x290928,_0x6fa6d0){_0x6fa6d0=_0x6fa6d0||'';return this['sendRequest'](util[_0xa879('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x290928,_0x6fa6d0));};AGIChannel[_0xa879('0x24')][_0xa879('0x4a')]=function(_0x28c5df){return this[_0xa879('0x2e')](_0xa879('0x4b'),_0x28c5df);};AGIChannel['prototype'][_0xa879('0x4c')]=function(_0x37690c){return this[_0xa879('0x2e')](_0xa879('0x4d'),_0x37690c);};AGIChannel[_0xa879('0x24')][_0xa879('0x1a')]=function(_0x5f1e2a,_0x57e60){this[_0xa879('0x2c')](util[_0xa879('0x2b')](_0xa879('0x4e'),_0x5f1e2a['id'],_0x5f1e2a[_0xa879('0x4f')],_0x57e60));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa879('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d616cef..1a8d5ea 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 _0xe595=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x8ff66e,_0x118183){var _0xb592f2=function(_0x2f9ee9){while(--_0x2f9ee9){_0x8ff66e['push'](_0x8ff66e['shift']());}};_0xb592f2(++_0x118183);}(_0xe595,0x16f));var _0x5e59=function(_0x2752ef,_0x53efe8){_0x2752ef=_0x2752ef-0x0;var _0x5f14fb=_0xe595[_0x2752ef];return _0x5f14fb;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5e59('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x5e59('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x5e59('0x2'),'E_AGI_SOCKET_ERROR':_0x5e59('0x3'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5e59('0x4'),'E_AGI_IVR_ENTRY':_0x5e59('0x5')};function AGIError(_0x18d0ab){var _0x18d0ab=_0x18d0ab||null,_0x5cdd2c=_0x5cdd2c||[],_0x9a319a=0x1,_0x2d7f66='';if(!error[_0x18d0ab]){_0x18d0ab=_0x5e59('0x6');}_0x5cdd2c[_0x5e59('0x7')](error[_0x18d0ab]);while(arguments[_0x9a319a]){_0x5cdd2c['push'](arguments[_0x9a319a]);_0x9a319a++;}_0x2d7f66=util[_0x5e59('0x8')][_0x5e59('0x9')](util,_0x5cdd2c);this['message']=_0x2d7f66;this[_0x5e59('0xa')]=_0x18d0ab;}module[_0x5e59('0xb')]=AGIError; \ No newline at end of file +var _0xe0b2=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe0b2,0x74));var _0x2e0b=function(_0x21e611,_0x4507f3){_0x21e611=_0x21e611-0x0;var _0x2270f2=_0xe0b2[_0x21e611];return _0x2270f2;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2e0b('0x0'),'E_AGI_SERVER_ERROR':_0x2e0b('0x1'),'E_AGI_SERVER_CLOSE':_0x2e0b('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x2e0b('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x2e0b('0x4'),'E_AGI_SOCKET_ERROR':_0x2e0b('0x5'),'E_AGI_SOCKET_CLOSE':_0x2e0b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2e0b('0x7'),'E_AGI_COMMAND_EMPTY':_0x2e0b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2e0b('0x9'),'E_AGI_IVR_ENTRY':_0x2e0b('0xa')};function AGIError(_0x3bfc12){var _0x3bfc12=_0x3bfc12||null,_0x54b798=_0x54b798||[],_0x4d4470=0x1,_0x53732a='';if(!error[_0x3bfc12]){_0x3bfc12=_0x2e0b('0xb');}_0x54b798[_0x2e0b('0xc')](error[_0x3bfc12]);while(arguments[_0x4d4470]){_0x54b798[_0x2e0b('0xc')](arguments[_0x4d4470]);_0x4d4470++;}_0x53732a=util[_0x2e0b('0xd')][_0x2e0b('0xe')](util,_0x54b798);this[_0x2e0b('0xf')]=_0x53732a;this[_0x2e0b('0x10')]=_0x3bfc12;}module[_0x2e0b('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 7c00127..ddfbd10 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 _0x7f12=['getVertex','traverseBFS','info','length','condition','vswitch','target','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','addVertex','addEdge','push','numberOfEdges','prototype','size'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0x7f12,0x1c7));var _0x27f1=function(_0x886af2,_0x553b0d){_0x886af2=_0x886af2-0x0;var _0x56fe35=_0x7f12[_0x886af2];return _0x56fe35;};'use strict';var _=require(_0x27f1('0x0'));var logger=require(_0x27f1('0x1'))(_0x27f1('0x2'));var verticesWithRetry=[_0x27f1('0x3'),_0x27f1('0x4'),'getsecretdigits'];var Graph=function(){this[_0x27f1('0x5')]={};this[_0x27f1('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x27f1('0x7')]=function(_0x4fd1d2){this[_0x27f1('0x5')][_0x4fd1d2['id']]=_0x4fd1d2;this[_0x27f1('0x6')][_0x4fd1d2['id']]=[];};Graph['prototype'][_0x27f1('0x8')]=function(_0x4c396f,_0xcd7b94,_0x105c5b){this['edges'][_0x4c396f][_0x27f1('0x9')]({'target':_0xcd7b94,'condition':_0x105c5b});this[_0x27f1('0xa')]+=0x1;};Graph[_0x27f1('0xb')][_0x27f1('0xc')]=function(){return _[_0x27f1('0xc')](this['vertices']);};Graph[_0x27f1('0xb')]['relations']=function(){return this[_0x27f1('0xa')];};Graph[_0x27f1('0xb')][_0x27f1('0xd')]=function(_0x4739e1){return this[_0x27f1('0x5')][_0x4739e1];};Graph[_0x27f1('0xb')][_0x27f1('0xe')]=function(_0x2bfe51,_0x4c1877){if(!this[_0x27f1('0x5')][_0x2bfe51]){return logger[_0x27f1('0xf')]('no\x20vertex\x20found');}var _0x2dc6cf=_0x4c1877(this[_0x27f1('0x5')][_0x2bfe51]);if(!_0x2dc6cf){return logger['info']('stop\x20traverse');}if(this[_0x27f1('0x6')][_0x2bfe51][_0x27f1('0x10')]===0x0){return logger[_0x27f1('0xf')]('no\x20edge/s\x20available');}for(var _0x2ede07=0x0,_0x56840c=[],_0x177aab=![];_0x2ede07\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','catch','createSquareReport','agi_','substring','debug','close','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','stringify','code','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','moment','../../config/environment','agi','../../config/license/util'];(function(_0x413970,_0x11edf5){var _0x1f8282=function(_0x505234){while(--_0x505234){_0x413970['push'](_0x413970['shift']());}};_0x1f8282(++_0x11edf5);}(_0xa11f,0x107));var _0xfa11=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0xa11f[_0x2a0350];return _0x425220;};'use strict';var parser=require(_0xfa11('0x0'));var _=require(_0xfa11('0x1'));var syncho=require(_0xfa11('0x2'));var util=require('util');var moment=require(_0xfa11('0x3'));var config=require(_0xfa11('0x4'));var logger=require('../../config/logger')(_0xfa11('0x5'));var utilLicense=require(_0xfa11('0x6'));var rpc=require(_0xfa11('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0xfa11('0x8'));var Vertices=require(_0xfa11('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xfa11('0x5')]=_[_0xfa11('0xa')](config['agi'],{'ip':_0xfa11('0xb'),'port':0x11dd});function connectionHandler(_0x128d96){process[_0xfa11('0xc')](function(){syncho(function(){try{setChannelVariables(_0x128d96);agiHandler(_0x128d96);}catch(_0x446092){logger[_0xfa11('0xd')](_0x446092[_0xfa11('0xe')]);}});});}function listeningHandler(){console[_0xfa11('0xf')](_0xfa11('0x10'),config[_0xfa11('0x5')][_0xfa11('0x11')]);logger[_0xfa11('0x12')](util[_0xfa11('0x13')](_0xfa11('0x14'),config[_0xfa11('0x5')]['ip'],config[_0xfa11('0x5')][_0xfa11('0x11')]));}function errorHandler(_0x32c5b4){if(_0x32c5b4&&_0x32c5b4[_0xfa11('0x15')]&&_0x32c5b4['message']){logger['error'](util[_0xfa11('0x13')](_0xfa11('0x16'),_0x32c5b4[_0xfa11('0x15')],_0x32c5b4[_0xfa11('0x17')]));}else{logger['error'](util[_0xfa11('0x13')]('[ERROR]\x20%s',_0x32c5b4[_0xfa11('0xe')]));}}function closeHandler(){logger[_0xfa11('0x12')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfa11('0x18')],this[_0xfa11('0x19')],this[_0xfa11('0x1a')],this[_0xfa11('0x1b')],this[_0xfa11('0x1c')]));try{createSquareReport(this);}catch(_0x51422f){logger[_0xfa11('0xd')](_0x51422f[_0xfa11('0xe')]);}}function timeoutHandler(){logger['info'](util[_0xfa11('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xfa11('0x19')],this[_0xfa11('0x1a')],this[_0xfa11('0x1b')],this[_0xfa11('0x1c')]));}function hangupHandler(){logger[_0xfa11('0x12')](util[_0xfa11('0x13')](_0xfa11('0x1d'),this[_0xfa11('0x18')],this[_0xfa11('0x19')],this['callerid'],this[_0xfa11('0x1b')],this['uniqueid']));this[_0xfa11('0x1e')]=!![];}function getRoot(_0x1048ac){return parser[_0xfa11('0x1f')](_0x1048ac,{'object':!![]})[_0xfa11('0x20')][_0xfa11('0x21')];}function addVertex(_0x141660,_0x50848e,_0x355b7f){_0x50848e['agicommand']=_0x355b7f;if(_0x50848e['hasOwnProperty'](_0xfa11('0x22'))){_0x50848e[_0xfa11('0x23')]=parseInt(_0x50848e[_0xfa11('0x22')],0xa);}_0x141660[_0xfa11('0x24')](_[_0xfa11('0x25')](_0x50848e,_0xfa11('0x26')));}function initGraph(_0x306750,_0xfbde91){var _0x23bf86=new Graph();for(var _0x1a0606 in _0x306750){if(_0x306750[_0xfa11('0x27')](_0x1a0606)){if(_[_0xfa11('0x28')](_0x306750[_0x1a0606])){for(var _0x23d359=0x0;_0x23d359<_0x306750[_0x1a0606][_0xfa11('0x29')];_0x23d359+=0x1){addVertex(_0x23bf86,_0x306750[_0x1a0606][_0x23d359],_0x1a0606);}}else{addVertex(_0x23bf86,_0x306750[_0x1a0606],_0x1a0606);}}}for(var _0x5ea776=0x0;_0x5ea776<_0xfbde91[_0xfa11('0x29')];_0x5ea776+=0x1){if(_0xfbde91[_0x5ea776][_0xfa11('0x2a')]&&_0xfbde91[_0x5ea776]['target']){_0x23bf86[_0xfa11('0x2b')](_0xfbde91[_0x5ea776][_0xfa11('0x2a')],_0xfbde91[_0x5ea776][_0xfa11('0x2c')],_0xfbde91[_0x5ea776][_0xfa11('0x2d')]);}}return _0x23bf86;}function getSquareProject(_0x242b65,_0x36ce58){rpc[_0xfa11('0x2e')](_0x242b65)[_0xfa11('0x2f')](function(_0x3285c1){_0x36ce58(null,_0x3285c1);})[_0xfa11('0x30')](function(_0x170046){_0x36ce58(null,_0x170046);});}function createSquareReport(_0x551001,_0x5e5abf){rpc[_0xfa11('0x31')](_0x551001)[_0xfa11('0x2f')](function(_0x40b213){if(_0x5e5abf){_0x5e5abf(null,_0x40b213);}})[_0xfa11('0x30')](function(_0x1d87d0){if(_0x5e5abf){_0x5e5abf(null,_0x1d87d0);}});}function setChannelVariables(_0x5e8618){for(var _0x2ede2a in _0x5e8618){if(_0x5e8618[_0xfa11('0x27')](_0x2ede2a)){if(_0x2ede2a['indexOf'](_0xfa11('0x32'))===0x0){_0x5e8618[_0x2ede2a[_0xfa11('0x33')](0x4)]=_0x5e8618[_0x2ede2a];delete _0x5e8618[_0x2ede2a];}}}}function getLogFromObject(_0x36767d){return util['inspect'](_0x36767d,{'showHidden':![],'depth':null});}function agiHandler(_0x21f54a){var _0x44be9b,_0x2ed2bc,_0x1b1699,_0x39f4c6,_0x4156d5;logger[_0xfa11('0x34')]('variables',JSON['stringify'](_0x21f54a,null,0x2));logger[_0xfa11('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x21f54a[_0xfa11('0x18')],_0x21f54a['calleridname'],_0x21f54a[_0xfa11('0x1a')],_0x21f54a[_0xfa11('0x1b')],_0x21f54a['uniqueid']));_0x21f54a['on'](_0xfa11('0xd'),errorHandler);_0x21f54a['on'](_0xfa11('0x35'),closeHandler);_0x21f54a['on']('timeout',timeoutHandler);_0x21f54a[_0xfa11('0x1e')]=![];_0x21f54a['on']('hangup',hangupHandler);var _0x2b5a03=getSquareProject[_0xfa11('0x36')](null,_0x21f54a['arg_1']);if(_0x2b5a03){if(_0x2b5a03['production']){_0x44be9b=getRoot(_0x2b5a03[_0xfa11('0x37')]);if(_0x44be9b&&_0x44be9b[_0xfa11('0x38')]){logger[_0xfa11('0x34')](_0xfa11('0x21'),JSON['stringify'](_0x44be9b,null,0x2));_0x21f54a[_0xfa11('0x39')]=moment()[_0xfa11('0x13')](_0xfa11('0x3a'));_0x2ed2bc=initGraph(_[_0xfa11('0x25')](_0x44be9b,_0xfa11('0x26')),_0x44be9b[_0xfa11('0x26')]);_0x1b1699=new Vertices(_0x21f54a,rpc,mailRpc);logger[_0xfa11('0x12')](util[_0xfa11('0x13')](_0xfa11('0x3b'),_0x21f54a[_0xfa11('0x18')],_0x21f54a[_0xfa11('0x19')],_0x21f54a[_0xfa11('0x1a')],_0x21f54a[_0xfa11('0x1b')],_0x21f54a[_0xfa11('0x1c')]));_0x2ed2bc[_0xfa11('0x3c')](_0x44be9b[_0xfa11('0x38')]['id'],function(_0x321ce1){try{_0x321ce1=_0x1b1699[_0xfa11('0x3d')](_0x321ce1);logger[_0xfa11('0x34')](_0xfa11('0x3e'),JSON['stringify'](_0x321ce1,null,0x2));if(_0x321ce1[_0xfa11('0x3f')]==='gotoc'){logger[_0xfa11('0x12')](_0xfa11('0x40'));_0x21f54a[_0xfa11('0x41')]=_0x321ce1[_0xfa11('0x41')]||_0x21f54a[_0xfa11('0x41')];_0x21f54a[_0xfa11('0x42')]=_0x321ce1['extension'];_0x21f54a[_0xfa11('0x43')]=_0x321ce1[_0xfa11('0x43')]?_0x321ce1[_0xfa11('0x43')]-0x1:0x1;return null;}else if(_0x321ce1&&_0x1b1699[_0x321ce1['agicommand']]){_0x4156d5=_0x1b1699[_0x321ce1[_0xfa11('0x3f')]](_0x321ce1);logger[_0xfa11('0x12')](_0xfa11('0x44'),JSON[_0xfa11('0x45')](_0x4156d5,null,0x2));if(_0x4156d5&&_0x4156d5[_0xfa11('0x46')]===AGI_CODE_SUCCESS&&_0x4156d5[_0xfa11('0x47')]!==AGI_RESULT_ERROR&&!_0x21f54a[_0xfa11('0x1e')]){logger[_0xfa11('0x34')](_0xfa11('0x44'),getLogFromObject(_0x4156d5));return _['isUndefined'](_0x4156d5[_0xfa11('0x47')])?null:_0x4156d5[_0xfa11('0x47')]['toString']();}else{logger[_0xfa11('0xd')]('response',getLogFromObject(_0x4156d5));return null;}}else{logger[_0xfa11('0xd')](_0xfa11('0x48'));return null;}}catch(_0x4342cc){logger[_0xfa11('0xd')](_0x4342cc[_0xfa11('0xe')]);return null;}});if(_0x44be9b[_0xfa11('0x49')]){logger[_0xfa11('0x12')](util[_0xfa11('0x13')](_0xfa11('0x4a'),_0x21f54a[_0xfa11('0x18')],_0x21f54a[_0xfa11('0x19')],_0x21f54a[_0xfa11('0x1a')],_0x21f54a[_0xfa11('0x1b')],_0x21f54a['uniqueid']));_0x2ed2bc[_0xfa11('0x3c')](_0x44be9b[_0xfa11('0x49')]['id'],function(_0x5eab55){try{_0x5eab55=_0x1b1699[_0xfa11('0x3d')](_0x5eab55);logger[_0xfa11('0x34')]('vertex',JSON[_0xfa11('0x45')](_0x5eab55,null,0x2));if(_0x5eab55&&_0x1b1699[_0x5eab55[_0xfa11('0x3f')]]){_0x4156d5=_0x1b1699[_0x5eab55[_0xfa11('0x3f')]](_0x5eab55);if(_0x4156d5){logger['debug']('response',getLogFromObject(_0x4156d5));return _[_0xfa11('0x4b')](_0x4156d5[_0xfa11('0x47')])?null:_0x4156d5[_0xfa11('0x47')][_0xfa11('0x4c')]();}else{logger[_0xfa11('0xd')](_0xfa11('0x44'),getLogFromObject(_0x4156d5));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x26a24c){logger[_0xfa11('0xd')](_0x26a24c[_0xfa11('0xe')]);return null;}});}logger[_0xfa11('0x12')](util['format'](_0xfa11('0x4d'),_0x21f54a[_0xfa11('0x18')],_0x21f54a['calleridname'],_0x21f54a['callerid'],_0x21f54a[_0xfa11('0x1b')],_0x21f54a[_0xfa11('0x1c')]));logger[_0xfa11('0x12')](util[_0xfa11('0x13')](_0xfa11('0x4e'),_0x21f54a['context'],_0x21f54a[_0xfa11('0x42')],parseInt(_0x21f54a[_0xfa11('0x43')],0xa)+0x1));_0x21f54a['continueAt'](_0x21f54a[_0xfa11('0x41')],_0x21f54a[_0xfa11('0x42')],parseInt(_0x21f54a[_0xfa11('0x43')],0xa)+0x1);_0x21f54a[_0xfa11('0x35')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x21f54a[_0xfa11('0x18')]));_0x21f54a[_0xfa11('0x4f')](_0x21f54a[_0xfa11('0x41')],_0x21f54a[_0xfa11('0x42')],parseInt(_0x21f54a[_0xfa11('0x43')],0xa)+0x1);_0x21f54a['close']();}}else{logger[_0xfa11('0xd')](util['format'](_0xfa11('0x50'),_0x21f54a[_0xfa11('0x18')]));_0x21f54a['continueAt'](_0x21f54a[_0xfa11('0x41')],_0x21f54a[_0xfa11('0x42')],parseInt(_0x21f54a[_0xfa11('0x43')],0xa)+0x1);_0x21f54a['close']();}}function main(){var _0x47f728;return utilLicense[_0xfa11('0x51')]()[_0xfa11('0x2f')](function(_0x588841){if(_0x588841){if(_0x588841[_0xfa11('0x52')]){if(_0x588841['callysquare']&&_0x588841['callysquare']>0x0){logger['info'](util[_0xfa11('0x13')](_0xfa11('0x53'),_0x588841['callysquare']));_0x47f728=_0x588841[_0xfa11('0x54')];}else{logger[_0xfa11('0x12')](_0xfa11('0x55'));}}else{logger[_0xfa11('0x12')](_0xfa11('0x56'));_0x47f728=-0x1;}}})[_0xfa11('0x30')](function(_0x45c269){logger['error'](_0xfa11('0x57'),_0x45c269[_0xfa11('0xe')]);})[_0xfa11('0x49')](function(){var _0x3df30b=require(_0xfa11('0x58'))(config[_0xfa11('0x5')][_0xfa11('0x11')],config[_0xfa11('0x5')]['ip'],_0x47f728);_0x3df30b['on'](_0xfa11('0xd'),errorHandler);_0x3df30b['on'](_0xfa11('0x59'),listeningHandler);_0x3df30b['on']('connection',connectionHandler);_0x3df30b['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x7cd8=['extension','priority','response','code','result','toString','agicommand\x20not\x20found','traverseBFS','finally','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','close','Project\x20%s\x20not\x20found','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./vertices','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','format','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','catch','then','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','timeout','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x476735,_0x21de6d){var _0x5aa397=function(_0x16a8fe){while(--_0x16a8fe){_0x476735['push'](_0x476735['shift']());}};_0x5aa397(++_0x21de6d);}(_0x7cd8,0x6c));var _0x87cd=function(_0xbf19e7,_0x4deec1){_0xbf19e7=_0xbf19e7-0x0;var _0x327165=_0x7cd8[_0xbf19e7];return _0x327165;};'use strict';var parser=require(_0x87cd('0x0'));var _=require(_0x87cd('0x1'));var syncho=require(_0x87cd('0x2'));var util=require(_0x87cd('0x3'));var moment=require(_0x87cd('0x4'));var config=require(_0x87cd('0x5'));var logger=require(_0x87cd('0x6'))(_0x87cd('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0x87cd('0x8'));var mailRpc=require(_0x87cd('0x9'));var Graph=require('./graph');var Vertices=require(_0x87cd('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x87cd('0x7')]=_['defaults'](config[_0x87cd('0x7')],{'ip':_0x87cd('0xb'),'port':0x11dd});function connectionHandler(_0xe6a6d0){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xe6a6d0);agiHandler(_0xe6a6d0);}catch(_0x850f2f){logger[_0x87cd('0xc')](_0x850f2f[_0x87cd('0xd')]);}});});}function listeningHandler(){console[_0x87cd('0xe')](_0x87cd('0xf'),config['agi'][_0x87cd('0x10')]);logger[_0x87cd('0x11')](util['format'](_0x87cd('0x12'),config[_0x87cd('0x7')]['ip'],config['agi'][_0x87cd('0x10')]));}function errorHandler(_0x1c72ca){if(_0x1c72ca&&_0x1c72ca[_0x87cd('0x13')]&&_0x1c72ca[_0x87cd('0x14')]){logger[_0x87cd('0xc')](util['format']('[%s]\x20%s',_0x1c72ca[_0x87cd('0x13')],_0x1c72ca[_0x87cd('0x14')]));}else{logger[_0x87cd('0xc')](util['format']('[ERROR]\x20%s',_0x1c72ca[_0x87cd('0xd')]));}}function closeHandler(){logger[_0x87cd('0x11')](util['format'](_0x87cd('0x15'),this['arg_1'],this['calleridname'],this[_0x87cd('0x16')],this[_0x87cd('0x17')],this[_0x87cd('0x18')]));try{createSquareReport(this);}catch(_0x144714){logger[_0x87cd('0xc')](_0x144714['stack']);}}function timeoutHandler(){logger[_0x87cd('0x11')](util[_0x87cd('0x19')](_0x87cd('0x1a'),this['arg_1'],this[_0x87cd('0x1b')],this['callerid'],this['dnid'],this[_0x87cd('0x18')]));}function hangupHandler(){logger['info'](util[_0x87cd('0x19')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x87cd('0x1b')],this['callerid'],this['dnid'],this[_0x87cd('0x18')]));this[_0x87cd('0x1c')]=!![];}function getRoot(_0x3dc871){return parser[_0x87cd('0x1d')](_0x3dc871,{'object':!![]})[_0x87cd('0x1e')]['root'];}function addVertex(_0x1bdd6f,_0x3f98a7,_0x3756b9){_0x3f98a7[_0x87cd('0x1f')]=_0x3756b9;if(_0x3f98a7[_0x87cd('0x20')](_0x87cd('0x21'))){_0x3f98a7[_0x87cd('0x22')]=parseInt(_0x3f98a7[_0x87cd('0x21')],0xa);}_0x1bdd6f[_0x87cd('0x23')](_[_0x87cd('0x24')](_0x3f98a7,_0x87cd('0x25')));}function initGraph(_0x2474e4,_0x6fdac1){var _0x197406=new Graph();for(var _0x5c6908 in _0x2474e4){if(_0x2474e4[_0x87cd('0x20')](_0x5c6908)){if(_[_0x87cd('0x26')](_0x2474e4[_0x5c6908])){for(var _0x566104=0x0;_0x566104<_0x2474e4[_0x5c6908][_0x87cd('0x27')];_0x566104+=0x1){addVertex(_0x197406,_0x2474e4[_0x5c6908][_0x566104],_0x5c6908);}}else{addVertex(_0x197406,_0x2474e4[_0x5c6908],_0x5c6908);}}}for(var _0x3b8b1f=0x0;_0x3b8b1f<_0x6fdac1[_0x87cd('0x27')];_0x3b8b1f+=0x1){if(_0x6fdac1[_0x3b8b1f][_0x87cd('0x28')]&&_0x6fdac1[_0x3b8b1f][_0x87cd('0x29')]){_0x197406['addEdge'](_0x6fdac1[_0x3b8b1f][_0x87cd('0x28')],_0x6fdac1[_0x3b8b1f]['target'],_0x6fdac1[_0x3b8b1f][_0x87cd('0x2a')]);}}return _0x197406;}function getSquareProject(_0x73ad6,_0xe2e488){rpc[_0x87cd('0x2b')](_0x73ad6)['then'](function(_0xb37358){_0xe2e488(null,_0xb37358);})[_0x87cd('0x2c')](function(_0x3f0ca9){_0xe2e488(null,_0x3f0ca9);});}function createSquareReport(_0x4c45a3,_0x465fbf){rpc['createSquareReport'](_0x4c45a3)[_0x87cd('0x2d')](function(_0x364d70){if(_0x465fbf){_0x465fbf(null,_0x364d70);}})['catch'](function(_0x13e617){if(_0x465fbf){_0x465fbf(null,_0x13e617);}});}function setChannelVariables(_0x136b4f){for(var _0x4b2709 in _0x136b4f){if(_0x136b4f[_0x87cd('0x20')](_0x4b2709)){if(_0x4b2709[_0x87cd('0x2e')](_0x87cd('0x2f'))===0x0){_0x136b4f[_0x4b2709[_0x87cd('0x30')](0x4)]=_0x136b4f[_0x4b2709];delete _0x136b4f[_0x4b2709];}}}}function getLogFromObject(_0x4b8b14){return util[_0x87cd('0x31')](_0x4b8b14,{'showHidden':![],'depth':null});}function agiHandler(_0x5781e1){var _0x582ec8,_0x41afb2,_0x3ade1d,_0x46b3ee,_0x47f79d;logger[_0x87cd('0x32')]('variables',JSON[_0x87cd('0x33')](_0x5781e1,null,0x2));logger[_0x87cd('0x11')](util['format'](_0x87cd('0x34'),_0x5781e1[_0x87cd('0x35')],_0x5781e1[_0x87cd('0x1b')],_0x5781e1[_0x87cd('0x16')],_0x5781e1[_0x87cd('0x17')],_0x5781e1['uniqueid']));_0x5781e1['on']('error',errorHandler);_0x5781e1['on']('close',closeHandler);_0x5781e1['on'](_0x87cd('0x36'),timeoutHandler);_0x5781e1['evtHangup']=![];_0x5781e1['on']('hangup',hangupHandler);var _0x58de37=getSquareProject[_0x87cd('0x37')](null,_0x5781e1[_0x87cd('0x35')]);if(_0x58de37){if(_0x58de37[_0x87cd('0x38')]){_0x582ec8=getRoot(_0x58de37[_0x87cd('0x38')]);if(_0x582ec8&&_0x582ec8[_0x87cd('0x39')]){logger[_0x87cd('0x32')](_0x87cd('0x3a'),JSON[_0x87cd('0x33')](_0x582ec8,null,0x2));_0x5781e1[_0x87cd('0x3b')]=moment()[_0x87cd('0x19')](_0x87cd('0x3c'));_0x41afb2=initGraph(_[_0x87cd('0x24')](_0x582ec8,_0x87cd('0x25')),_0x582ec8[_0x87cd('0x25')]);_0x3ade1d=new Vertices(_0x5781e1,rpc,mailRpc);logger['info'](util['format'](_0x87cd('0x3d'),_0x5781e1[_0x87cd('0x35')],_0x5781e1[_0x87cd('0x1b')],_0x5781e1[_0x87cd('0x16')],_0x5781e1[_0x87cd('0x17')],_0x5781e1[_0x87cd('0x18')]));_0x41afb2['traverseBFS'](_0x582ec8[_0x87cd('0x39')]['id'],function(_0x3b7ef1){try{_0x3b7ef1=_0x3ade1d[_0x87cd('0x3e')](_0x3b7ef1);logger[_0x87cd('0x32')](_0x87cd('0x3f'),JSON[_0x87cd('0x33')](_0x3b7ef1,null,0x2));if(_0x3b7ef1[_0x87cd('0x1f')]==='gotoc'){logger[_0x87cd('0x11')](_0x87cd('0x40'));_0x5781e1[_0x87cd('0x41')]=_0x3b7ef1[_0x87cd('0x41')]||_0x5781e1['context'];_0x5781e1['extension']=_0x3b7ef1[_0x87cd('0x42')];_0x5781e1['priority']=_0x3b7ef1[_0x87cd('0x43')]?_0x3b7ef1['priority']-0x1:0x1;return null;}else if(_0x3b7ef1&&_0x3ade1d[_0x3b7ef1[_0x87cd('0x1f')]]){_0x47f79d=_0x3ade1d[_0x3b7ef1['agicommand']](_0x3b7ef1);logger[_0x87cd('0x11')](_0x87cd('0x44'),JSON['stringify'](_0x47f79d,null,0x2));if(_0x47f79d&&_0x47f79d[_0x87cd('0x45')]===AGI_CODE_SUCCESS&&_0x47f79d[_0x87cd('0x46')]!==AGI_RESULT_ERROR&&!_0x5781e1['evtHangup']){logger[_0x87cd('0x32')](_0x87cd('0x44'),getLogFromObject(_0x47f79d));return _['isUndefined'](_0x47f79d[_0x87cd('0x46')])?null:_0x47f79d['result'][_0x87cd('0x47')]();}else{logger['error']('response',getLogFromObject(_0x47f79d));return null;}}else{logger['error'](_0x87cd('0x48'));return null;}}catch(_0x5e1ca6){logger[_0x87cd('0xc')](_0x5e1ca6[_0x87cd('0xd')]);return null;}});if(_0x582ec8['finally']){logger[_0x87cd('0x11')](util[_0x87cd('0x19')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5781e1['arg_1'],_0x5781e1[_0x87cd('0x1b')],_0x5781e1['callerid'],_0x5781e1[_0x87cd('0x17')],_0x5781e1[_0x87cd('0x18')]));_0x41afb2[_0x87cd('0x49')](_0x582ec8[_0x87cd('0x4a')]['id'],function(_0x238bc3){try{_0x238bc3=_0x3ade1d[_0x87cd('0x3e')](_0x238bc3);logger[_0x87cd('0x32')](_0x87cd('0x3f'),JSON[_0x87cd('0x33')](_0x238bc3,null,0x2));if(_0x238bc3&&_0x3ade1d[_0x238bc3[_0x87cd('0x1f')]]){_0x47f79d=_0x3ade1d[_0x238bc3[_0x87cd('0x1f')]](_0x238bc3);if(_0x47f79d){logger[_0x87cd('0x32')](_0x87cd('0x44'),getLogFromObject(_0x47f79d));return _[_0x87cd('0x4b')](_0x47f79d[_0x87cd('0x46')])?null:_0x47f79d[_0x87cd('0x46')][_0x87cd('0x47')]();}else{logger[_0x87cd('0xc')](_0x87cd('0x44'),getLogFromObject(_0x47f79d));return null;}}else{logger[_0x87cd('0xc')](_0x87cd('0x48'));return null;}}catch(_0x90dd46){logger[_0x87cd('0xc')](_0x90dd46[_0x87cd('0xd')]);return null;}});}logger['info'](util[_0x87cd('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5781e1[_0x87cd('0x35')],_0x5781e1[_0x87cd('0x1b')],_0x5781e1[_0x87cd('0x16')],_0x5781e1[_0x87cd('0x17')],_0x5781e1[_0x87cd('0x18')]));logger[_0x87cd('0x11')](util[_0x87cd('0x19')](_0x87cd('0x4c'),_0x5781e1[_0x87cd('0x41')],_0x5781e1[_0x87cd('0x42')],parseInt(_0x5781e1[_0x87cd('0x43')],0xa)+0x1));_0x5781e1[_0x87cd('0x4d')](_0x5781e1[_0x87cd('0x41')],_0x5781e1[_0x87cd('0x42')],parseInt(_0x5781e1[_0x87cd('0x43')],0xa)+0x1);_0x5781e1['close']();}}else{logger[_0x87cd('0xc')](util[_0x87cd('0x19')](_0x87cd('0x4e'),_0x5781e1[_0x87cd('0x35')]));_0x5781e1[_0x87cd('0x4d')](_0x5781e1[_0x87cd('0x41')],_0x5781e1[_0x87cd('0x42')],parseInt(_0x5781e1[_0x87cd('0x43')],0xa)+0x1);_0x5781e1[_0x87cd('0x4f')]();}}else{logger[_0x87cd('0xc')](util[_0x87cd('0x19')](_0x87cd('0x50'),_0x5781e1[_0x87cd('0x35')]));_0x5781e1['continueAt'](_0x5781e1[_0x87cd('0x41')],_0x5781e1[_0x87cd('0x42')],parseInt(_0x5781e1[_0x87cd('0x43')],0xa)+0x1);_0x5781e1[_0x87cd('0x4f')]();}}function main(){var _0x24ec15;return utilLicense['getLicense']()['then'](function(_0x1cd8ff){if(_0x1cd8ff){if(_0x1cd8ff['voice']){if(_0x1cd8ff[_0x87cd('0x51')]&&_0x1cd8ff['callysquare']>0x0){logger[_0x87cd('0x11')](util[_0x87cd('0x19')](_0x87cd('0x52'),_0x1cd8ff[_0x87cd('0x51')]));_0x24ec15=_0x1cd8ff['callysquare'];}else{logger[_0x87cd('0x11')](_0x87cd('0x53'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x24ec15=-0x1;}}})[_0x87cd('0x2c')](function(_0x2db93a){logger['error'](_0x87cd('0x54'),_0x2db93a[_0x87cd('0xd')]);})[_0x87cd('0x4a')](function(){var _0x57d3c5=require(_0x87cd('0x55'))(config[_0x87cd('0x7')][_0x87cd('0x10')],config[_0x87cd('0x7')]['ip'],_0x24ec15);_0x57d3c5['on'](_0x87cd('0xc'),errorHandler);_0x57d3c5['on']('listening',listeningHandler);_0x57d3c5['on'](_0x87cd('0x56'),connectionHandler);_0x57d3c5['on'](_0x87cd('0x4f'),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 c195250..9044520 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 _0x55a6=['request','then','error','message','result','catch','SendMail','jayson/promise','client','http'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x55a6,0x1e7));var _0x655a=function(_0x25ebf5,_0xa1ccf2){_0x25ebf5=_0x25ebf5-0x0;var _0x4728db=_0x55a6[_0x25ebf5];return _0x4728db;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x655a('0x0'));var client=jayson[_0x655a('0x1')][_0x655a('0x2')]({'port':0x232b});function request(_0x4bb1e9,_0x305dd9){return new BPromise(function(_0x206bf6,_0x57c94b){return client[_0x655a('0x3')](_0x4bb1e9,_0x305dd9)[_0x655a('0x4')](function(_0x530d57){if(_0x530d57[_0x655a('0x5')]){return _0x57c94b(_0x530d57['error'][_0x655a('0x6')]);}else{return _0x206bf6(_0x530d57[_0x655a('0x7')]);}})[_0x655a('0x8')](function(_0x44abeb){return _0x57c94b(_0x44abeb);});});}exports['sendMailMessage']=function(_0x24f6ed,_0x5552b0){return request(_0x655a('0x9'),{'account':_0x24f6ed,'message':_0x5552b0});}; \ No newline at end of file +var _0xfc7a=['catch','SendMail','bluebird','client','http','request','then','error','message'];(function(_0x5c1258,_0x37befb){var _0x54f585=function(_0x351945){while(--_0x351945){_0x5c1258['push'](_0x5c1258['shift']());}};_0x54f585(++_0x37befb);}(_0xfc7a,0x1a0));var _0xafc7=function(_0x594163,_0xf3583c){_0x594163=_0x594163-0x0;var _0x18c749=_0xfc7a[_0x594163];return _0x18c749;};'use strict';var BPromise=require(_0xafc7('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xafc7('0x1')][_0xafc7('0x2')]({'port':0x232b});function request(_0x7e7db8,_0x415a54){return new BPromise(function(_0x2913a3,_0x11b3e2){return client[_0xafc7('0x3')](_0x7e7db8,_0x415a54)[_0xafc7('0x4')](function(_0x44d691){if(_0x44d691['error']){return _0x11b3e2(_0x44d691[_0xafc7('0x5')][_0xafc7('0x6')]);}else{return _0x2913a3(_0x44d691['result']);}})[_0xafc7('0x7')](function(_0x3169ab){return _0x11b3e2(_0x3169ab);});});}exports['sendMailMessage']=function(_0x7bcc90,_0x24abbe){return request(_0xafc7('0x8'),{'account':_0x7bcc90,'message':_0x24abbe});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 23e69ca..3fdf7d9 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 _0xf5ab=['slice','trim','length','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','split'];(function(_0x4ab472,_0x231476){var _0x2f39ea=function(_0x5e0c99){while(--_0x5e0c99){_0x4ab472['push'](_0x4ab472['shift']());}};_0x2f39ea(++_0x231476);}(_0xf5ab,0x16c));var _0xbf5a=function(_0x2fab66,_0x11f8e4){_0x2fab66=_0x2fab66-0x0;var _0x4bad74=_0xf5ab[_0x2fab66];return _0x4bad74;};'use strict';var util=require(_0xbf5a('0x0'));var Transform=require(_0xbf5a('0x1'))[_0xbf5a('0x2')];function AGIReply(_0x330287){Transform[_0xbf5a('0x3')](this,_0x330287);this[_0xbf5a('0x4')]='';this['_inBody']=![];}util[_0xbf5a('0x5')](AGIReply,Transform);AGIReply[_0xbf5a('0x6')][_0xbf5a('0x7')]=function(_0x402396,_0x4b61a1,_0x45334f){var _0x152549='\x0a',_0xbb19db=['\x0a\x0a',_0xbf5a('0x8')],_0xabb4c2=-0x1,_0x37dd78=-0x1,_0xa7d86a='',_0x265955=0x0,_0x4b914e='',_0x1d004a='';this[_0xbf5a('0x4')]+=_0x402396[_0xbf5a('0x9')]();_0x4b914e=this[_0xbf5a('0x4')];if(!this[_0xbf5a('0xa')]){_0x265955=0x0;while(_0xbb19db[_0x265955]){while((_0x37dd78=_0x4b914e[_0xbf5a('0xb')](_0xbb19db[_0x265955]))!=-0x1){_0xa7d86a=_0xbb19db[_0x265955];_0x1d004a=_0x4b914e[_0xbf5a('0xc')](0x0,_0x37dd78);_0x4b914e=_0x4b914e[_0xbf5a('0xc')](_0x37dd78+_0xa7d86a['length']);var _0x77558e=_0x1d004a[_0xbf5a('0xd')](_0x152549),_0x25773a=0x0,_0x5337bc={},_0x3859dc='',_0x2f22b7='',_0x577d0e=-0x1;while(_0x77558e[_0x25773a]){_0x577d0e=_0x77558e[_0x25773a][_0xbf5a('0xb')](':');if(_0x577d0e!=-0x1){_0x3859dc=_0x77558e[_0x25773a][_0xbf5a('0xe')](0x0,_0x577d0e)[_0xbf5a('0xf')]();_0x2f22b7=_0x77558e[_0x25773a][_0xbf5a('0xe')](_0x577d0e+0x1)[_0xbf5a('0xf')]();if(_0x3859dc[_0xbf5a('0x10')]>0x0){_0x5337bc[_0x3859dc]=_0x2f22b7;}}else{}_0x25773a++;}this[_0xbf5a('0x11')](_0xbf5a('0x12'),_0x5337bc);this[_0xbf5a('0xa')]=!![];}_0x265955++;}this[_0xbf5a('0x4')]=_0x4b914e;}else{while((_0xabb4c2=_0x4b914e[_0xbf5a('0xb')](_0x152549))!=-0x1){_0x1d004a=_0x4b914e['substring'](0x0,_0xabb4c2);this[_0xbf5a('0x11')](_0xbf5a('0x13'),_0x1d004a);_0x4b914e=_0x4b914e[_0xbf5a('0xc')](_0xabb4c2+_0x152549[_0xbf5a('0x10')]);}this[_0xbf5a('0x4')]=_0x4b914e;}_0x45334f();};module[_0xbf5a('0x14')]=AGIReply; \ No newline at end of file +var _0x67ed=['headers','stream','Transform','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','indexOf','substring','length','split','slice','trim','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x67ed,0xde));var _0xd67e=function(_0x2714f7,_0x29079a){_0x2714f7=_0x2714f7-0x0;var _0x41ea29=_0x67ed[_0x2714f7];return _0x41ea29;};'use strict';var util=require('util');var Transform=require(_0xd67e('0x0'))[_0xd67e('0x1')];function AGIReply(_0x421ee8){Transform['call'](this,_0x421ee8);this['_localBuffer']='';this[_0xd67e('0x2')]=![];}util[_0xd67e('0x3')](AGIReply,Transform);AGIReply[_0xd67e('0x4')][_0xd67e('0x5')]=function(_0x29e9ac,_0x12afb1,_0xa5aa71){var _0x5f1e2f='\x0a',_0x356019=['\x0a\x0a',_0xd67e('0x6')],_0x1ceac7=-0x1,_0x5a55de=-0x1,_0x4afa4a='',_0x15245e=0x0,_0x1245c7='',_0x114a30='';this['_localBuffer']+=_0x29e9ac[_0xd67e('0x7')]();_0x1245c7=this[_0xd67e('0x8')];if(!this['_inBody']){_0x15245e=0x0;while(_0x356019[_0x15245e]){while((_0x5a55de=_0x1245c7[_0xd67e('0x9')](_0x356019[_0x15245e]))!=-0x1){_0x4afa4a=_0x356019[_0x15245e];_0x114a30=_0x1245c7[_0xd67e('0xa')](0x0,_0x5a55de);_0x1245c7=_0x1245c7[_0xd67e('0xa')](_0x5a55de+_0x4afa4a[_0xd67e('0xb')]);var _0x51932f=_0x114a30[_0xd67e('0xc')](_0x5f1e2f),_0x2802df=0x0,_0x55e26e={},_0x50b3ec='',_0x25b209='',_0x194077=-0x1;while(_0x51932f[_0x2802df]){_0x194077=_0x51932f[_0x2802df][_0xd67e('0x9')](':');if(_0x194077!=-0x1){_0x50b3ec=_0x51932f[_0x2802df][_0xd67e('0xd')](0x0,_0x194077)[_0xd67e('0xe')]();_0x25b209=_0x51932f[_0x2802df][_0xd67e('0xd')](_0x194077+0x1)[_0xd67e('0xe')]();if(_0x50b3ec[_0xd67e('0xb')]>0x0){_0x55e26e[_0x50b3ec]=_0x25b209;}}else{}_0x2802df++;}this[_0xd67e('0xf')](_0xd67e('0x10'),_0x55e26e);this[_0xd67e('0x2')]=!![];}_0x15245e++;}this[_0xd67e('0x8')]=_0x1245c7;}else{while((_0x1ceac7=_0x1245c7[_0xd67e('0x9')](_0x5f1e2f))!=-0x1){_0x114a30=_0x1245c7[_0xd67e('0xa')](0x0,_0x1ceac7);this[_0xd67e('0xf')]('line',_0x114a30);_0x1245c7=_0x1245c7['substring'](_0x1ceac7+_0x5f1e2f[_0xd67e('0xb')]);}this[_0xd67e('0x8')]=_0x1245c7;}_0xa5aa71();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 52fe4a4..6c59c5c 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 _0x5294=['createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x5294,0x111));var _0x4529=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x5294[_0x2bf141];return _0x48277b;};'use strict';var BPromise=require(_0x4529('0x0'));var moment=require(_0x4529('0x1'));var _=require(_0x4529('0x2'));var util=require(_0x4529('0x3'));var jayson=require(_0x4529('0x4'));var client=jayson[_0x4529('0x5')]['http']({'port':0x2329});function request(_0x940a48,_0x12d02e){return new BPromise(function(_0xb3fbab,_0x5ee1a6){return client[_0x4529('0x6')](_0x940a48,_0x12d02e)[_0x4529('0x7')](function(_0x10192d){if(_0x10192d[_0x4529('0x8')]){return _0x5ee1a6(_0x10192d['error'][_0x4529('0x9')]);}else{return _0xb3fbab(_0x10192d[_0x4529('0xa')]);}})[_0x4529('0xb')](function(_0x5a9e01){return _0x5ee1a6(_0x5a9e01);});});}exports['getSquareProject']=function(_0x584f7d){return request(_0x4529('0xc'),{'options':{'raw':![],'where':{'name':_0x584f7d},'attributes':[_0x4529('0xd')]}});};exports[_0x4529('0xe')]=function(_0x579574){return request(_0x4529('0xf'),{'options':{'raw':![],'where':{'id':_0x579574},'include':[{'model':_0x4529('0x10'),'as':_0x4529('0x11')}],'attributes':['id',_0x4529('0x12'),_0x4529('0x13')]}});};exports[_0x4529('0x14')]=function(_0x4d733b){return request('ShowSquareProject',{'options':{'where':{'id':_0x4d733b},'attributes':[_0x4529('0x12')]}});};exports[_0x4529('0x15')]=function(_0x4f1846){return request(_0x4529('0x16'),{'options':{'where':{'id':_0x4f1846},'attributes':['name']}});};exports[_0x4529('0x17')]=function(_0x381501){return request(_0x4529('0x18'),{'options':{'where':{'id':_0x381501},'attributes':[_0x4529('0x12')]}});};exports['getSquareOdbcById']=function(_0x3fa1a0){return request(_0x4529('0x19'),{'options':{'where':{'id':_0x3fa1a0},'attributes':[_0x4529('0x1a')]}});};exports['getUserById']=function(_0x1c34fc){return request(_0x4529('0x1b'),{'options':{'where':{'id':_0x1c34fc},'attributes':[_0x4529('0x12')]}});};exports[_0x4529('0x1c')]=function(_0x4e17dd){return request(_0x4529('0x1d'),{'options':{'where':{'phone':_0x4e17dd[_0x4529('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x196c11){return request(_0x4529('0x1f'),{'options':{'where':{'id':_0x196c11},'attributes':[_0x4529('0x12')]}});};exports['getSoundById']=function(_0x522a1a){return request(_0x4529('0x20'),{'options':{'where':{'id':_0x522a1a},'attributes':[_0x4529('0x21')]}});};exports[_0x4529('0x22')]=function(_0x1c70d4){return request(_0x4529('0x23'),{'options':{'raw':![],'where':{'id':_0x1c70d4},'include':[{'model':'Interval','as':_0x4529('0x24')}]}});};exports[_0x4529('0x25')]=function(_0x12621d){return request(_0x4529('0x26'),{'options':{'where':{'id':_0x12621d},'attributes':['id',_0x4529('0x12')]}});};exports[_0x4529('0x27')]=function(_0x49bcbb){return request(_0x4529('0x28'),{'body':_0x49bcbb});};exports[_0x4529('0x29')]=function(_0x178259){return request('CreateSquareDetailsReport',{'body':_0x178259});};exports[_0x4529('0x2a')]=function(_0x517434){return request(_0x4529('0x2b'),{'body':_[_0x4529('0x2c')](_0x517434,{'project_name':_0x517434[_0x4529('0x2d')],'prev_project_name':_0x517434[_0x4529('0x2e')]||'','is_subproject':_0x517434[_0x4529('0x2e')]?!![]:![],'leaveAt':moment()[_0x4529('0x2f')](_0x4529('0x30'))})});};exports[_0x4529('0x31')]=function(_0x1fb300){return request('CreateSquareRecording',{'body':_0x1fb300});};exports['createSquareMessage']=function(_0x52065b){return request(_0x4529('0x32'),{'body':_0x52065b});};exports[_0x4529('0x33')]=function(_0x2394d7){return request(_0x4529('0x34'),{'options':{'raw':![],'where':{'phone':_0x2394d7[_0x4529('0x1e')],'ListId':_0x2394d7['ListId']}}})['then'](function(_0x258957){if(_0x258957){return _0x258957;}return request(_0x4529('0x35'),{'body':_0x2394d7});});};exports[_0x4529('0x36')]=function(_0x3e0d2c){return request('ShowPause',{'options':{'where':{'id':_0x3e0d2c},'attributes':['name']}});};exports[_0x4529('0x37')]=function(_0x200089,_0x5f1c84){return request(_0x4529('0x38'),{'body':{'interface':_0x5f1c84},'options':{'where':_0x200089}});};exports[_0x4529('0x39')]=function(_0x3b510f,_0x2af1bd,_0x1eabab){return request(_0x4529('0x3a'),{'body':{'type':_0x2af1bd,'uniqueid':_0x1eabab},'options':{'where':_0x3b510f}});};exports[_0x4529('0x3b')]=function(_0x3de1f5){return request(_0x4529('0x3c'),{'body':{},'options':{'where':_0x3de1f5}});};exports[_0x4529('0x3d')]=function(_0x501a68){return request(_0x4529('0x3e'),{'body':{},'options':{'where':_0x501a68}});}; \ No newline at end of file +var _0xe77f=['createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','bluebird','moment','util','jayson/promise','http','request','then','message','result','catch','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format'];(function(_0x1b7ad0,_0x25c5c3){var _0x424a5a=function(_0x5ece94){while(--_0x5ece94){_0x1b7ad0['push'](_0x1b7ad0['shift']());}};_0x424a5a(++_0x25c5c3);}(_0xe77f,0xba));var _0xfe77=function(_0x16104a,_0x2d9446){_0x16104a=_0x16104a-0x0;var _0x33ef5f=_0xe77f[_0x16104a];return _0x33ef5f;};'use strict';var BPromise=require(_0xfe77('0x0'));var moment=require(_0xfe77('0x1'));var _=require('lodash');var util=require(_0xfe77('0x2'));var jayson=require(_0xfe77('0x3'));var client=jayson['client'][_0xfe77('0x4')]({'port':0x2329});function request(_0xd99b0d,_0x55a414){return new BPromise(function(_0x150fc9,_0x406c8b){return client[_0xfe77('0x5')](_0xd99b0d,_0x55a414)[_0xfe77('0x6')](function(_0x130b85){if(_0x130b85['error']){return _0x406c8b(_0x130b85['error'][_0xfe77('0x7')]);}else{return _0x150fc9(_0x130b85[_0xfe77('0x8')]);}})[_0xfe77('0x9')](function(_0x1a2809){return _0x406c8b(_0x1a2809);});});}exports[_0xfe77('0xa')]=function(_0x38fcb2){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x38fcb2},'attributes':['production']}});};exports[_0xfe77('0xb')]=function(_0x1b2f58){return request(_0xfe77('0xc'),{'options':{'raw':![],'where':{'id':_0x1b2f58},'include':[{'model':_0xfe77('0xd'),'as':'Smtp'}],'attributes':['id',_0xfe77('0xe'),_0xfe77('0xf')]}});};exports[_0xfe77('0x10')]=function(_0x14704e){return request('ShowSquareProject',{'options':{'where':{'id':_0x14704e},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x11')]=function(_0x17627f){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x17627f},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x12')]=function(_0x51f692){return request(_0xfe77('0x13'),{'options':{'where':{'id':_0x51f692},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x14')]=function(_0x28366f){return request(_0xfe77('0x15'),{'options':{'where':{'id':_0x28366f},'attributes':[_0xfe77('0x16')]}});};exports[_0xfe77('0x17')]=function(_0x359704){return request(_0xfe77('0x18'),{'options':{'where':{'id':_0x359704},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x19')]=function(_0x84d3da){return request(_0xfe77('0x1a'),{'options':{'where':{'phone':_0x84d3da['phone']},'attributes':['id']}});};exports[_0xfe77('0x1b')]=function(_0x596f18){return request(_0xfe77('0x1c'),{'options':{'where':{'id':_0x596f18},'attributes':[_0xfe77('0xe')]}});};exports['getSoundById']=function(_0x347a14){return request('ShowSound',{'options':{'where':{'id':_0x347a14},'attributes':[_0xfe77('0x1d')]}});};exports['getIntervalById']=function(_0x57d6b1){return request(_0xfe77('0x1e'),{'options':{'raw':![],'where':{'id':_0x57d6b1},'include':[{'model':'Interval','as':_0xfe77('0x1f')}]}});};exports[_0xfe77('0x20')]=function(_0x1e37f0){return request(_0xfe77('0x21'),{'options':{'where':{'id':_0x1e37f0},'attributes':['id',_0xfe77('0xe')]}});};exports[_0xfe77('0x22')]=function(_0x160c44){return request(_0xfe77('0x23'),{'body':_0x160c44});};exports[_0xfe77('0x24')]=function(_0x21d660){return request(_0xfe77('0x25'),{'body':_0x21d660});};exports[_0xfe77('0x26')]=function(_0x5053f2){return request('CreateSquareReport',{'body':_['merge'](_0x5053f2,{'project_name':_0x5053f2[_0xfe77('0x27')],'prev_project_name':_0x5053f2[_0xfe77('0x28')]||'','is_subproject':_0x5053f2[_0xfe77('0x28')]?!![]:![],'leaveAt':moment()[_0xfe77('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xfe77('0x2a')]=function(_0x63d932){return request('CreateSquareRecording',{'body':_0x63d932});};exports[_0xfe77('0x2b')]=function(_0x14fb23){return request(_0xfe77('0x2c'),{'body':_0x14fb23});};exports[_0xfe77('0x2d')]=function(_0x352120){return request(_0xfe77('0x2e'),{'options':{'raw':![],'where':{'phone':_0x352120[_0xfe77('0x2f')],'ListId':_0x352120[_0xfe77('0x30')]}}})[_0xfe77('0x6')](function(_0x52cee8){if(_0x52cee8){return _0x52cee8;}return request(_0xfe77('0x31'),{'body':_0x352120});});};exports[_0xfe77('0x32')]=function(_0xb93a3d){return request(_0xfe77('0x33'),{'options':{'where':{'id':_0xb93a3d},'attributes':[_0xfe77('0xe')]}});};exports[_0xfe77('0x34')]=function(_0x530ce1,_0x5973f5){return request(_0xfe77('0x35'),{'body':{'interface':_0x5973f5},'options':{'where':_0x530ce1}});};exports['agentPause']=function(_0x191e44,_0x472f74,_0x74188a){return request(_0xfe77('0x36'),{'body':{'type':_0x472f74,'uniqueid':_0x74188a},'options':{'where':_0x191e44}});};exports['agentUnpause']=function(_0x2a5a71){return request(_0xfe77('0x37'),{'body':{},'options':{'where':_0x2a5a71}});};exports[_0xfe77('0x38')]=function(_0x431731){return request('LogoutUser',{'body':{},'options':{'where':_0x431731}});}; \ 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 f888569..78fa9dc 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 _0x9303=['./polly'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0x9303,0xd7));var _0x3930=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x9303[_0x191f9d];return _0x58e60d;};var polly=require(_0x3930('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xaa3f=['exports','./polly','./lex'];(function(_0x1cfd14,_0x20a54e){var _0x5ef6fc=function(_0x249b6f){while(--_0x249b6f){_0x1cfd14['push'](_0x1cfd14['shift']());}};_0x5ef6fc(++_0x20a54e);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x4afb23,_0x40b8fb){_0x4afb23=_0x4afb23-0x0;var _0x4a833d=_0xaa3f[_0x4afb23];return _0x4a833d;};var polly=require(_0xfaa3('0x0'));var lex=require(_0xfaa3('0x1'));module[_0xfaa3('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 29fae7a..476c841 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 _0xaa88=['exports','./lib/api'];(function(_0x55afac,_0x16f08a){var _0x5a0aa6=function(_0x3653cc){while(--_0x3653cc){_0x55afac['push'](_0x55afac['shift']());}};_0x5a0aa6(++_0x16f08a);}(_0xaa88,0x137));var _0x8aa8=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0xaa88[_0x34eb31];return _0x254994;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0xdace=['./lib/api'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xdace,0xc5));var _0xedac=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xdace[_0x349148];return _0x2f2b0f;};'use strict';var lex=require(_0xedac('0x0'));module['exports']=function(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2){return lex(_0x1c76b2,_0x13adb5,_0x46eba0,_0x518516,_0x413d77,_0x36bcd2);}; \ 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 4a9f474..a871a1f 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(_0x1976c5,_0x1a8947){var _0xe37be7=function(_0x4d4eda){while(--_0x4d4eda){_0x1976c5['push'](_0x1976c5['shift']());}};_0xe37be7(++_0x1a8947);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x55df36,_0xea8368){var _0x1f4189=function(_0x3f1342){while(--_0x3f1342){_0x55df36['push'](_0x55df36['shift']());}};_0x1f4189(++_0xea8368);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 9cf27ed..040f4f3 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 _0xd332=['exports','./lib/api'];(function(_0x44fa2b,_0x5d78da){var _0x4aafb5=function(_0x312b76){while(--_0x312b76){_0x44fa2b['push'](_0x44fa2b['shift']());}};_0x4aafb5(++_0x5d78da);}(_0xd332,0x6b));var _0x2d33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd332[_0x321bb2];return _0x9c12ed;};'use strict';var polly=require(_0x2d33('0x0'));module[_0x2d33('0x1')]=function(_0x5279e1,_0x1b0639,_0x433034,_0x1f99e9,_0x5d72e2,_0x1be9a4,_0x4862ad){return polly(_0x5279e1,_0x1b0639,_0x433034,_0x1f99e9,_0x5d72e2,_0x1be9a4,_0x4862ad);}; \ No newline at end of file +var _0xb71b=['exports','./lib/api'];(function(_0xa24907,_0x12e70e){var _0x332ad2=function(_0x396788){while(--_0x396788){_0xa24907['push'](_0xa24907['shift']());}};_0x332ad2(++_0x12e70e);}(_0xb71b,0xc3));var _0xbb71=function(_0x2e0555,_0x5b57b4){_0x2e0555=_0x2e0555-0x0;var _0x154dee=_0xb71b[_0x2e0555];return _0x154dee;};'use strict';var polly=require(_0xbb71('0x0'));module[_0xbb71('0x1')]=function(_0x19ce19,_0x285722,_0x4bfc10,_0x1f7aab,_0x11260f,_0xb90d07,_0x2e9323){return polly(_0x19ce19,_0x285722,_0x4bfc10,_0x1f7aab,_0x11260f,_0xb90d07,_0x2e9323);}; \ 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 e61e30f..ce9a788 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 _0x5f6e=['path','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0xd91c4f,_0x11b812){var _0x15a005=function(_0x389c8e){while(--_0x389c8e){_0xd91c4f['push'](_0xd91c4f['shift']());}};_0x15a005(++_0x11b812);}(_0x5f6e,0xb8));var _0xe5f6=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0x5f6e[_0x10e840];return _0x405caa;};'use strict';var fs=require('fs');var path=require(_0xe5f6('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x4eeaab,_0x35dbe0,_0x350062){return new BPromise(function(_0x3d4815,_0xddf6f9){_0x4eeaab[_0xe5f6('0x1')](_0x35dbe0,function(_0x4475bb,_0x2391fd){if(_0x4475bb){_0xddf6f9(_0x4475bb);}else if(_0x2391fd){if(_0x2391fd[_0xe5f6('0x2')]instanceof Buffer){fs[_0xe5f6('0x3')](_0x350062,_0x2391fd[_0xe5f6('0x2')],function(_0xa8578e){if(_0xa8578e){_0xddf6f9(_0xa8578e);}else{_0x3d4815();}});}else{_0xddf6f9(new Error(_0xe5f6('0x4')));}}else{_0xddf6f9(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xe5f6('0x5')]=function(_0x416a4a,_0x385cbe,_0x2c15d4,_0x4b6f64,_0x40552d,_0x1a73be,_0x31ccb5){var _0x43e125=new AWS[(_0xe5f6('0x6'))]({'accessKeyId':_0x416a4a,'secretAccessKey':_0x385cbe,'region':_0x2c15d4});var _0x5a8ed4={'Text':_0x40552d,'TextType':_0x1a73be||_0xe5f6('0x7'),'OutputFormat':'mp3','VoiceId':_0x4b6f64};return pollyResult(_0x43e125,_0x5a8ed4,_0x31ccb5);}; \ No newline at end of file +var _0x0e1c=['exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3161f4,_0x8e7b45){var _0x1b2b59=function(_0x2adbfd){while(--_0x2adbfd){_0x3161f4['push'](_0x3161f4['shift']());}};_0x1b2b59(++_0x8e7b45);}(_0x0e1c,0x88));var _0xc0e1=function(_0x1f772b,_0x3de6de){_0x1f772b=_0x1f772b-0x0;var _0x24be51=_0x0e1c[_0x1f772b];return _0x24be51;};'use strict';var fs=require('fs');var path=require(_0xc0e1('0x0'));var BPromise=require('bluebird');var rs=require(_0xc0e1('0x1'));var AWS=require(_0xc0e1('0x2'));function pollyResult(_0x42affe,_0x21195f,_0x3ba2e0){return new BPromise(function(_0x30c1e3,_0x3db54d){_0x42affe[_0xc0e1('0x3')](_0x21195f,function(_0x1f7e96,_0x195436){if(_0x1f7e96){_0x3db54d(_0x1f7e96);}else if(_0x195436){if(_0x195436[_0xc0e1('0x4')]instanceof Buffer){fs['writeFile'](_0x3ba2e0,_0x195436[_0xc0e1('0x4')],function(_0x1a9355){if(_0x1a9355){_0x3db54d(_0x1a9355);}else{_0x30c1e3();}});}else{_0x3db54d(new Error(_0xc0e1('0x5')));}}else{_0x3db54d(new Error(_0xc0e1('0x6')));}});});}module[_0xc0e1('0x7')]=function(_0x11d0d2,_0x44f8e3,_0x3c0c31,_0xbc55b9,_0x1701b3,_0x4baa55,_0x52a154){var _0x13f368=new AWS[(_0xc0e1('0x8'))]({'accessKeyId':_0x11d0d2,'secretAccessKey':_0x44f8e3,'region':_0x3c0c31});var _0x577011={'Text':_0x1701b3,'TextType':_0x4baa55||_0xc0e1('0x9'),'OutputFormat':_0xc0e1('0xa'),'VoiceId':_0xbc55b9};return pollyResult(_0x13f368,_0x577011,_0x52a154);}; \ 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 f6f8750..15392e4 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 _0x9888=['./lib/api'];(function(_0x231eb6,_0x3e11fb){var _0x886bf0=function(_0x5d532e){while(--_0x5d532e){_0x231eb6['push'](_0x231eb6['shift']());}};_0x886bf0(++_0x3e11fb);}(_0x9888,0x1d1));var _0x8988=function(_0xff64f7,_0x2c7f9c){_0xff64f7=_0xff64f7-0x0;var _0x4cf306=_0x9888[_0xff64f7];return _0x4cf306;};'use strict';var asr=require(_0x8988('0x0'));module['exports']=function(_0x3d9304,_0x2e0a85,_0x2e0676,_0x44b198){return asr(_0x3d9304,_0x2e0a85,_0x2e0676);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x1ea70f,_0xf23408,_0x30d88b,_0x574cc3){return asr(_0x1ea70f,_0xf23408,_0x30d88b);}; \ 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 b67c1f0..436601a 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 _0xc577=['length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','toString','base64','POST','LINEAR16','8000','url','exports'];(function(_0x743701,_0x3e67bb){var _0x5a141d=function(_0x4b198d){while(--_0x4b198d){_0x743701['push'](_0x743701['shift']());}};_0x5a141d(++_0x3e67bb);}(_0xc577,0x172));var _0x7c57=function(_0x3dc135,_0x546abc){_0x3dc135=_0x3dc135-0x0;var _0x517300=_0xc577[_0x3dc135];return _0x517300;};'use strict';var url=require(_0x7c57('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x7c57('0x1')]=function(_0x35af09,_0xe9a500,_0x2a2415){return new BPromise(function(_0x3abdb2,_0x304922){var _0x2ea08b;if(typeof _0x35af09!=='string'||_0x35af09[_0x7c57('0x2')]===0x0){return _0x304922(_0x7c57('0x3'));}if(typeof _0xe9a500!==_0x7c57('0x4')||_0xe9a500[_0x7c57('0x2')]===0x0){return _0x304922(_0x7c57('0x5'));}if(typeof _0x2a2415!=='undefined'&&(typeof _0x2a2415!=='string'||_0x2a2415['length']===0x0)){return _0x304922(_0x7c57('0x6'));}try{_0x2ea08b=fs['readFileSync'](_0x35af09)[_0x7c57('0x7')](_0x7c57('0x8'));}catch(_0x11dd41){return _0x304922(_0x11dd41);}return _0x3abdb2({'method':_0x7c57('0x9'),'uri':host+'/v1/speech:recognize?key='+_0xe9a500,'body':{'config':{'encoding':_0x7c57('0xa'),'sampleRateHertz':_0x7c57('0xb'),'languageCode':_0x2a2415},'audio':{'content':_0x2ea08b}},'json':!![]});});}; \ No newline at end of file +var _0x7aaf=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','string'];(function(_0x28094e,_0x177dea){var _0x391994=function(_0x5a9b1a){while(--_0x5a9b1a){_0x28094e['push'](_0x28094e['shift']());}};_0x391994(++_0x177dea);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x945d9d,_0x445728){_0x945d9d=_0x945d9d-0x0;var _0x126275=_0x7aaf[_0x945d9d];return _0x126275;};'use strict';var url=require(_0xf7aa('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xf7aa('0x1');module[_0xf7aa('0x2')]=function(_0x551bfb,_0x4b942e,_0x35575f){return new BPromise(function(_0x573e43,_0x198d5c){var _0x5ee53a;if(typeof _0x551bfb!==_0xf7aa('0x3')||_0x551bfb[_0xf7aa('0x4')]===0x0){return _0x198d5c(_0xf7aa('0x5'));}if(typeof _0x4b942e!==_0xf7aa('0x3')||_0x4b942e['length']===0x0){return _0x198d5c(_0xf7aa('0x6'));}if(typeof _0x35575f!=='undefined'&&(typeof _0x35575f!=='string'||_0x35575f[_0xf7aa('0x4')]===0x0)){return _0x198d5c(_0xf7aa('0x7'));}try{_0x5ee53a=fs['readFileSync'](_0x551bfb)['toString']('base64');}catch(_0x3ee03f){return _0x198d5c(_0x3ee03f);}return _0x573e43({'method':_0xf7aa('0x8'),'uri':host+_0xf7aa('0x9')+_0x4b942e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf7aa('0xa'),'languageCode':_0x35575f},'audio':{'content':_0x5ee53a}},'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 53324ae..5eb42dc 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 _0xf50f=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf50f,0x163));var _0xff50=function(_0x42049e,_0x4e1ef5){_0x42049e=_0x42049e-0x0;var _0x2536f4=_0xf50f[_0x42049e];return _0x2536f4;};var asr=require(_0xff50('0x0'));module[_0xff50('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7cde=['./asr','exports'];(function(_0x4ec182,_0x20005b){var _0x43c8ac=function(_0x243fec){while(--_0x243fec){_0x4ec182['push'](_0x4ec182['shift']());}};_0x43c8ac(++_0x20005b);}(_0x7cde,0x1aa));var _0xe7cd=function(_0x51370f,_0x2e9d1e){_0x51370f=_0x51370f-0x0;var _0x456f9b=_0x7cde[_0x51370f];return _0x456f9b;};var asr=require(_0xe7cd('0x0'));module[_0xe7cd('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 8394443..95e6573 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 _0xe84d=['\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','parse','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','end','protocol','data','transcode','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22'];(function(_0x3c0902,_0x30a2ce){var _0x22bc47=function(_0x4cbf6e){while(--_0x4cbf6e){_0x3c0902['push'](_0x3c0902['shift']());}};_0x22bc47(++_0x30a2ce);}(_0xe84d,0xc8));var _0xde84=function(_0x1b3d0e,_0x1fba2f){_0x1b3d0e=_0x1b3d0e-0x0;var _0x2dac24=_0xe84d[_0x1b3d0e];return _0x2dac24;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xde84('0x0'));var dialogflow=require(_0xde84('0x1'));var fs=require('fs');var http=require(_0xde84('0x2'));var https=require(_0xde84('0x3'));var md5=require(_0xde84('0x4'));var path=require(_0xde84('0x5'));var querystring=require('querystring');var rp=require(_0xde84('0x6'));var rs=require(_0xde84('0x7'));var sox=require(_0xde84('0x8'));var tts=require(_0xde84('0x9'));var urlParse=require('url')[_0xde84('0xa')];var util=require('util');var aws=require('./aws');var google=require(_0xde84('0xb'));var sestek=require(_0xde84('0xc'));var tilde=require(_0xde84('0xd'));var logger=require(_0xde84('0xe'))(_0xde84('0xf'));var ISPEECH_API=_0xde84('0x10');function downloadFile(_0x28b6f9,_0x748c9e){return new BPromise(function(_0x2e9441,_0x431632){var _0x4443d1=urlParse(_0x28b6f9);var _0x4feee7=_0x4443d1['protocol']===_0xde84('0x11')?https:http;var _0x498e93={'host':_0x4443d1['host'],'path':_0x4443d1[_0xde84('0x5')],'headers':{'user-agent':_0xde84('0x12')}};_0x4feee7[_0xde84('0x13')](_0x498e93,function(_0xa8dd43){if(_0xa8dd43['statusCode']!==0xc8){logger[_0xde84('0x14')](_0xde84('0x15')+_0x28b6f9+_0xde84('0x16')+_0xa8dd43[_0xde84('0x17')]+'\x20('+_0xa8dd43[_0xde84('0x18')]+')');_0x431632(new Error(_0xde84('0x15')+_0x28b6f9+_0xde84('0x16')+_0xa8dd43[_0xde84('0x17')]+'\x20('+_0xa8dd43['statusMessage']+')'));return;}var _0x52fa93=fs[_0xde84('0x19')](_0x748c9e);_0x52fa93['on'](_0xde84('0x1a'),function(){logger[_0xde84('0x1b')](_0xde84('0x1c'));_0x52fa93['close'](_0x2e9441);});_0x52fa93['on'](_0xde84('0x14'),function(_0x316859){fs[_0xde84('0x1d')](_0x748c9e);logger['error']('download\x20error',_0x316859);_0x431632(_0x316859);});_0xa8dd43['pipe'](_0x52fa93);})['on'](_0xde84('0x14'),function(_0x4f502d){logger[_0xde84('0x14')](_0x4f502d);_0x431632(_0x4f502d);})[_0xde84('0x1e')]();});}function uploadFile(_0x56da68){return new BPromise(function(_0x223d5d,_0x11ac77){var _0x121ab8=urlParse(_0x56da68);var _0x77d875=_0x121ab8[_0xde84('0x1f')]===_0xde84('0x11')?https:http;var _0x3a4944={'host':_0x121ab8['host'],'path':_0x121ab8[_0xde84('0x5')],'headers':{'user-agent':_0xde84('0x12')}};_0x77d875[_0xde84('0x13')](_0x3a4944,function(_0x1f26a3){if(_0x1f26a3[_0xde84('0x17')]!==0xc8){_0x11ac77(new Error('request\x20to\x20'+_0x56da68+_0xde84('0x16')+_0x1f26a3['statusCode']+'\x20('+_0x1f26a3['statusMessage']+')'));return;}var _0x56c251='';_0x1f26a3['on'](_0xde84('0x20'),function(_0x168c4c){_0x56c251+=_0x168c4c;});_0x1f26a3['on']('end',function(){_0x223d5d(_0x56c251);});})['on'](_0xde84('0x14'),function(_0x431db2){_0x11ac77(_0x431db2);})[_0xde84('0x1e')]();});}function convertFile(_0x48023e,_0x106ee4){return new BPromise(function(_0x103ee3,_0x1cb49d){var _0x29d7fe=sox[_0xde84('0x21')](_0x48023e,_0x106ee4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x29d7fe['on'](_0xde84('0x14'),function(_0x19761c){logger['error']('error\x20convert',_0x19761c);_0x1cb49d(_0x19761c);});_0x29d7fe['on'](_0xde84('0x1e'),function(){logger['info'](_0xde84('0x22'));_0x103ee3();});_0x29d7fe[_0xde84('0x23')]();});}function base64Decode(_0x3059c6,_0x58fd2a){var _0x3a2096=path['resolve'](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x26'));fs[_0xde84('0x27')](_0x3a2096,_0x3059c6,'base64');return convertFile(_0x3a2096,_0x58fd2a)[_0xde84('0x28')](function(){try{fs['unlink'](_0x3a2096);fs[_0xde84('0x29')](_0x58fd2a,_0xde84('0x2a'));}catch(_0x43c9ec){logger[_0xde84('0x14')](_0x43c9ec);}return _0x58fd2a[_0xde84('0x2b')]('.')[0x0];});}function base64Encode(_0x52b427){var _0x2fd988=fs[_0xde84('0x2c')](_0x52b427);return new Buffer(_0x2fd988)['toString']('base64');}exports[_0xde84('0x2d')]=function(_0x5d5201,_0x400b88,_0x48cf12,_0x51326e,_0x7bac91,_0x37d139){var _0x33792b,_0x12a745;var _0x459f22=_0xde84('0x2e');var _0x25b4c3=_0xde84('0x2f')+_0x5d5201;var _0x40ed7d={};if(_0x400b88===_0xde84('0x30')){_0x40ed7d[_0xde84('0x31')]={'ssml':_0x48cf12};}else{_0x40ed7d[_0xde84('0x31')]={'text':_0x48cf12};};_0x40ed7d[_0xde84('0x32')]={'languageCode':_0x51326e,'ssmlGender':_0x7bac91};_0x40ed7d[_0xde84('0x33')]={'audioEncoding':_0xde84('0x34'),'sampleRateHertz':0x1f40};var _0x1ef4e7={'url':_0x459f22+_0xde84('0x35')+_0x25b4c3,'method':_0xde84('0x36'),'json':!![],'body':_0x40ed7d};return rp(_0x1ef4e7)[_0xde84('0x28')](function(_0xcb1390){return new BPromise(function(_0x131982,_0x4c0b78){_0x33792b=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x38'));var _0x461148=Buffer[_0xde84('0x39')](_0xcb1390[_0xde84('0x3a')],'base64');return fs['writeFile'](_0x33792b,_0x461148,function(_0x19bb65){_0x4c0b78(_0x19bb65);},function(_0x5b6357){fs[_0xde84('0x29')](_0x33792b,_0xde84('0x2a'));_0x131982(_0x5b6357);});});})[_0xde84('0x28')](function(_0x46f6cb){_0x12a745=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x26'));return convertFile(_0x33792b,_0x12a745);})[_0xde84('0x28')](function(){try{fs[_0xde84('0x1d')](_0x33792b);fs[_0xde84('0x29')](_0x12a745,_0xde84('0x2a'));}catch(_0x50b710){logger['error'](_0x50b710);}logger['info'](_0xde84('0x3b'),_0x12a745[_0xde84('0x2b')]('.')[0x0]);return _0x12a745[_0xde84('0x2b')]('.')[0x0];});};exports[_0xde84('0x3c')]=function(_0x22b4fd,_0x456380){var _0x2bceaa=_0xde84('0x3d');var _0x1c3617,_0x36aa36;var _0x2b5471;var _0x176094={'encoding':'utf8','method':_0xde84('0x36'),'timeout':0x2710,'url':_0x2bceaa,'headers':{'Content-Type':_0xde84('0x3e')},'body':_0xde84('0x3f')+encodeURIComponent(JSON[_0xde84('0x40')]([[['jQ1olc',JSON[_0xde84('0x40')]([_0x22b4fd,_0x456380||'en',![],_0xde84('0x41')]),null,_0xde84('0x42')]]]))};return rp(_0x176094)[_0xde84('0x28')](function(_0x36e53c){try{_0x2b5471=eval(_0x36e53c['slice'](0x5))[0x0][0x2];}catch(_0x5cedd3){throw new Error(_0xde84('0x43')+_0x36e53c[_0xde84('0x20')]);}if(!_0x2b5471){if(_0x22b4fd['length']>0xc8){throw new Error(_0xde84('0x44'));}else{throw new Error(_0xde84('0x45')+_0x456380+_0xde84('0x46'));}}try{_0x2b5471=eval(_0x2b5471)[0x0];}catch(_0x8e8a70){throw new Error(_0xde84('0x43')+res[_0xde84('0x20')]);}const _0x2a100c=_0x2b5471;_0x1c3617=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x38'));fs['writeFileSync'](_0x1c3617,_0x2b5471,{'encoding':'base64'});_0x36aa36=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs['generate'](0x4)+'.wav');return convertFile(_0x1c3617,_0x36aa36);})['then'](function(){try{fs[_0xde84('0x1d')](_0x1c3617);fs[_0xde84('0x29')](_0x36aa36,_0xde84('0x2a'));}catch(_0x26d9a0){logger['error'](_0x26d9a0);}logger['info'](_0xde84('0x47'),_0x36aa36['split']('.')[0x0]);return _0x36aa36['split']('.')[0x0];});};exports[_0xde84('0x48')]=function(_0x240faf,_0x7550a6,_0x3f60dc){return google['asr'](_0x240faf,_0x7550a6,_0x3f60dc)['then'](function(_0x262fb1){logger[_0xde84('0x1b')](_0x262fb1[_0xde84('0x49')]);return rp(_0x262fb1);})[_0xde84('0x28')](function(_0x105649){var _0x5aac21='';var _0x52310c=0x0;try{fs['unlink'](_0x240faf);}catch(_0x2873ed){logger[_0xde84('0x14')](_0x2873ed);}if(_0x105649&&_0x105649[_0xde84('0x4a')]){_0x5aac21=_0x105649[_0xde84('0x4a')][_0xde84('0x4b')](function(_0x424d15){return _0x424d15&&_0x424d15[_0xde84('0x4c')][0x0]&&_0x424d15[_0xde84('0x4c')][0x0][_0xde84('0x4d')]?_0x424d15[_0xde84('0x4c')][0x0][_0xde84('0x4d')]:'';})[_0xde84('0x4e')]('\x0a');_0x52310c=_0x105649['results'][_0xde84('0x4b')](function(_0x56c0d0){return _0x56c0d0&&_0x56c0d0[_0xde84('0x4c')][0x0]&&_0x56c0d0[_0xde84('0x4c')][0x0][_0xde84('0x4f')]?_0x56c0d0[_0xde84('0x4c')][0x0][_0xde84('0x4f')]:0x0;})[_0xde84('0x4e')]('\x0a');}logger[_0xde84('0x1b')](_0xde84('0x50'),_0x5aac21);logger[_0xde84('0x1b')](_0xde84('0x51'),_0x52310c);return{'transcript':_0x5aac21,'confidence':_0x52310c};})['catch'](function(_0x460a29){logger[_0xde84('0x14')](_0xde84('0x52'),_0x460a29[_0xde84('0x17')],_0x460a29['name'],_0x460a29['message']);});};exports[_0xde84('0x53')]=function(_0x3d0e10,_0x532166,_0x5ea394,_0xaf91a){var _0x1cb047=apiai(_0x532166,{'language':_0xaf91a||'en'});return _0x1cb047[_0xde84('0x54')](_0x5ea394,{'sessionId':md5(_0x3d0e10)})[_0xde84('0x28')](function(_0x1a8ad9){logger[_0xde84('0x1b')](JSON[_0xde84('0x40')](_0x1a8ad9));return{'source':_0x1a8ad9[_0xde84('0x55')][_0xde84('0x56')],'resolvedQuery':_0x1a8ad9[_0xde84('0x55')][_0xde84('0x57')],'action':_0x1a8ad9[_0xde84('0x55')][_0xde84('0x58')],'actionIncomplete':_0x1a8ad9['result'][_0xde84('0x59')],'speech':_0x1a8ad9['result']['fulfillment']['speech'],'score':_0x1a8ad9['result'][_0xde84('0x5a')],'statusCode':_0x1a8ad9[_0xde84('0x5b')][_0xde84('0x5c')],'endConversation':_0x1a8ad9[_0xde84('0x55')][_0xde84('0x5d')][_0xde84('0x5e')]||![],'isFallbackIntent':_0x1a8ad9[_0xde84('0x55')]['metadata']['isFallbackIntent']};});};exports[_0xde84('0x5f')]=function(_0x131d7a,_0x54b056,_0x1abce0,_0x3065b6,_0x3a2a2e,_0x47b2a7){var _0x46f088=_0x3065b6[_0xde84('0x60')](/\\n/g,'\x0a');var _0x44b794={'credentials':{'private_key':_0x46f088,'client_email':_0x1abce0}};var _0x26223a=new dialogflow[(_0xde84('0x61'))](_0x44b794);var _0x34b90d=_0x26223a[_0xde84('0x62')](_0x54b056,md5(_0x131d7a));var _0x288bee={'session':_0x34b90d,'queryInput':{'text':{'text':_0x3a2a2e,'languageCode':_0x47b2a7}}};return _0x26223a[_0xde84('0x63')](_0x288bee)[_0xde84('0x28')](function(_0x5ca3ad){if(_0x5ca3ad&&_0x5ca3ad['length']){logger[_0xde84('0x1b')](_0xde84('0x64'),JSON['stringify'](_0x5ca3ad));var _0x513934=_0x5ca3ad[0x0];if(_0x513934){var _0x2afe49={'action':_0x513934[_0xde84('0x65')]['action'],'allRequiredParamsPresent':_0x513934['queryResult'][_0xde84('0x66')],'endConversation':_0x513934['queryResult'][_0xde84('0x67')]&&_0x513934['queryResult'][_0xde84('0x67')][_0xde84('0x68')]?_0x513934[_0xde84('0x65')][_0xde84('0x67')]['fields']['end_conversation'][_0xde84('0x69')]:![],'fulfillmentText':_0x513934[_0xde84('0x65')][_0xde84('0x6a')],'intentName':_0x513934['queryResult']['intent'][_0xde84('0x6b')],'intentDisplayName':_0x513934[_0xde84('0x65')][_0xde84('0x6c')][_0xde84('0x6d')],'isFallbackIntent':_0x513934[_0xde84('0x65')][_0xde84('0x6c')][_0xde84('0x6e')],'languageCode':_0x513934['queryResult'][_0xde84('0x6f')],'queryText':_0x513934[_0xde84('0x65')][_0xde84('0x70')],'responseId':_0x513934['responseId'],'score':_0x513934[_0xde84('0x65')][_0xde84('0x71')],'speech':_0x513934[_0xde84('0x65')][_0xde84('0x6a')],'providerResponse':JSON[_0xde84('0x40')](_0x5ca3ad)};return _0x2afe49;}}});};exports[_0xde84('0x72')]=function(_0x3f60e5,_0x193601,_0x58d2eb,_0x2dcacb){return tilde[_0xde84('0x73')](_0x3f60e5,_0x193601,_0x58d2eb,_0x2dcacb)['then'](function(_0x3a9e08){try{fs[_0xde84('0x1d')](_0x3f60e5);}catch(_0x5bb1e5){logger[_0xde84('0x14')](_0x5bb1e5);}logger[_0xde84('0x1b')]('Tilde\x20ASR\x20transcription',_0x3a9e08[_0xde84('0x4d')]);logger[_0xde84('0x1b')](_0xde84('0x74'),_0x3a9e08[_0xde84('0x4f')]);return _0x3a9e08;});};exports[_0xde84('0x75')]=function(_0xcd4a90,_0x805811,_0xa796f5,_0x138c42,_0x39e959,_0x2153b4){var _0x27d1b9=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x38'));var _0x3500c6;return aws[_0xde84('0x76')](_0xcd4a90,_0x805811,_0xa796f5,_0x138c42,_0x39e959,_0x2153b4,_0x27d1b9)['then'](function(){_0x3500c6=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs['generate'](0x4)+'.wav');return convertFile(_0x27d1b9,_0x3500c6);})[_0xde84('0x28')](function(){try{fs[_0xde84('0x1d')](_0x27d1b9);fs[_0xde84('0x29')](_0x3500c6,_0xde84('0x2a'));}catch(_0x3c833f){logger[_0xde84('0x14')](_0x3c833f);}return _0x3500c6[_0xde84('0x2b')]('.')[0x0];});};exports[_0xde84('0x77')]=function(_0x4ec6c2,_0x45a0d0,_0x157b9c,_0x14e558,_0x4c45d6,_0x38dda1){return aws[_0xde84('0x78')](_0x4ec6c2,_0x45a0d0,_0x157b9c,_0x14e558,_0x4c45d6,_0x38dda1)[_0xde84('0x28')](function(_0x503a7b){logger['info'](JSON[_0xde84('0x40')](_0x503a7b));return _0x503a7b;});};exports[_0xde84('0x79')]=function(_0x5de57b,_0x524ce3,_0x49fd74,_0x3d05bf){var _0x3745e1=util['format'](_0xde84('0x7a'),ISPEECH_API,_0x5de57b,encodeURIComponent(_0x524ce3),_0x49fd74,_0x3d05bf);var _0x5cc6e0=path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x38'));var _0x21ce78;return downloadFile(_0x3745e1,_0x5cc6e0)[_0xde84('0x28')](function(){_0x21ce78=path[_0xde84('0x37')](__dirname,'tmp',rs['generate'](0x4)+_0xde84('0x26'));return convertFile(_0x5cc6e0,_0x21ce78);})[_0xde84('0x28')](function(){try{fs[_0xde84('0x1d')](_0x5cc6e0);fs[_0xde84('0x29')](_0x21ce78,_0xde84('0x2a'));}catch(_0x365c94){logger[_0xde84('0x14')](_0x365c94);}return _0x21ce78['split']('.')[0x0];});};exports[_0xde84('0x7b')]=function(_0x36656e,_0x1319eb,_0x103995,_0x33c939){var _0x17ceec=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1319eb,_0x103995,base64Encode(_0x36656e),_0x33c939?util[_0xde84('0x7c')](_0xde84('0x7d'),encodeURIComponent(_0x33c939)):'freeform=3');return uploadFile(_0x17ceec)[_0xde84('0x28')](function(_0x36d6f5){return querystring[_0xde84('0xa')](_0x36d6f5);});};exports[_0xde84('0x7e')]=function(_0x2e1390,_0x352581){return sestek[_0xde84('0x7f')](_0x2e1390,_0x352581)[_0xde84('0x28')](function(_0x378f15){logger[_0xde84('0x1b')](JSON['stringify'](_0x378f15));var _0x7bc88a={'speech':_0x378f15[_0xde84('0x80')],'action':_0x378f15['channelData']?_0x378f15[_0xde84('0x81')][_0xde84('0x82')]:undefined,'actiondata':_0x378f15['channelData']?_0x378f15[_0xde84('0x81')][_0xde84('0x83')]:undefined};if(_0x378f15['channelData']&&_0x378f15['channelData'][_0xde84('0x84')]){return base64Decode(_0x378f15[_0xde84('0x81')][_0xde84('0x84')][_0xde84('0x85')],path[_0xde84('0x37')](__dirname,_0xde84('0x24'),rs[_0xde84('0x25')](0x4)+_0xde84('0x26')))[_0xde84('0x28')](function(_0x3bd902){_0x7bc88a[_0xde84('0x86')]=_0x3bd902;return _0x7bc88a;});}return _0x7bc88a;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xe448=['resolve','generate','.wav','writeFileSync','then','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','tmp','.mp3','from','writeFile','chmodSync','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','base64','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','fields','queryResult','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','https','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish\x20download\x20file','close','unlink','error','end','host','data','error\x20convert','info','finish\x20to\x20convert','start'];(function(_0x1b2d42,_0x40106a){var _0x5c541c=function(_0x4ddd9a){while(--_0x4ddd9a){_0x1b2d42['push'](_0x1b2d42['shift']());}};_0x5c541c(++_0x40106a);}(_0xe448,0x67));var _0x8e44=function(_0x13d975,_0x49f374){_0x13d975=_0x13d975-0x0;var _0x505ec6=_0xe448[_0x13d975];return _0x505ec6;};'use strict';var apiai=require(_0x8e44('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x8e44('0x1'));var fs=require('fs');var http=require(_0x8e44('0x2'));var https=require(_0x8e44('0x3'));var md5=require('md5');var path=require('path');var querystring=require(_0x8e44('0x4'));var rp=require(_0x8e44('0x5'));var rs=require(_0x8e44('0x6'));var sox=require(_0x8e44('0x7'));var tts=require(_0x8e44('0x8'));var urlParse=require(_0x8e44('0x9'))[_0x8e44('0xa')];var util=require('util');var aws=require(_0x8e44('0xb'));var google=require(_0x8e44('0xc'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x8e44('0xd'))('agi');var ISPEECH_API=_0x8e44('0xe');function downloadFile(_0x475595,_0x3b6899){return new BPromise(function(_0x20684e,_0x77feed){var _0x1467db=urlParse(_0x475595);var _0x531e35=_0x1467db[_0x8e44('0xf')]===_0x8e44('0x10')?https:http;var _0x44b873={'host':_0x1467db['host'],'path':_0x1467db[_0x8e44('0x11')],'headers':{'user-agent':_0x8e44('0x12')}};_0x531e35[_0x8e44('0x13')](_0x44b873,function(_0x346c22){if(_0x346c22[_0x8e44('0x14')]!==0xc8){logger['error'](_0x8e44('0x15')+_0x475595+_0x8e44('0x16')+_0x346c22['statusCode']+'\x20('+_0x346c22[_0x8e44('0x17')]+')');_0x77feed(new Error(_0x8e44('0x15')+_0x475595+_0x8e44('0x16')+_0x346c22[_0x8e44('0x14')]+'\x20('+_0x346c22[_0x8e44('0x17')]+')'));return;}var _0x2b10cd=fs['createWriteStream'](_0x3b6899);_0x2b10cd['on']('finish',function(){logger['info'](_0x8e44('0x18'));_0x2b10cd[_0x8e44('0x19')](_0x20684e);});_0x2b10cd['on']('error',function(_0x3ac377){fs[_0x8e44('0x1a')](_0x3b6899);logger[_0x8e44('0x1b')]('download\x20error',_0x3ac377);_0x77feed(_0x3ac377);});_0x346c22['pipe'](_0x2b10cd);})['on']('error',function(_0x1ddf89){logger['error'](_0x1ddf89);_0x77feed(_0x1ddf89);})[_0x8e44('0x1c')]();});}function uploadFile(_0x1fa984){return new BPromise(function(_0x3a09dd,_0x17db79){var _0x5b9b0d=urlParse(_0x1fa984);var _0x42317b=_0x5b9b0d['protocol']===_0x8e44('0x10')?https:http;var _0x281f65={'host':_0x5b9b0d[_0x8e44('0x1d')],'path':_0x5b9b0d[_0x8e44('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x42317b[_0x8e44('0x13')](_0x281f65,function(_0x1b32d8){if(_0x1b32d8[_0x8e44('0x14')]!==0xc8){_0x17db79(new Error(_0x8e44('0x15')+_0x1fa984+_0x8e44('0x16')+_0x1b32d8[_0x8e44('0x14')]+'\x20('+_0x1b32d8['statusMessage']+')'));return;}var _0x1dca79='';_0x1b32d8['on'](_0x8e44('0x1e'),function(_0x267e4b){_0x1dca79+=_0x267e4b;});_0x1b32d8['on'](_0x8e44('0x1c'),function(){_0x3a09dd(_0x1dca79);});})['on']('error',function(_0x1e8fee){_0x17db79(_0x1e8fee);})[_0x8e44('0x1c')]();});}function convertFile(_0x51c94f,_0x13493f){return new BPromise(function(_0xa92775,_0x346646){var _0xced7b2=sox['transcode'](_0x51c94f,_0x13493f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xced7b2['on']('error',function(_0xdce55b){logger[_0x8e44('0x1b')](_0x8e44('0x1f'),_0xdce55b);_0x346646(_0xdce55b);});_0xced7b2['on'](_0x8e44('0x1c'),function(){logger[_0x8e44('0x20')](_0x8e44('0x21'));_0xa92775();});_0xced7b2[_0x8e44('0x22')]();});}function base64Decode(_0x5a8624,_0x26644a){var _0x46490e=path[_0x8e44('0x23')](__dirname,'tmp',rs[_0x8e44('0x24')](0x4)+_0x8e44('0x25'));fs[_0x8e44('0x26')](_0x46490e,_0x5a8624,'base64');return convertFile(_0x46490e,_0x26644a)[_0x8e44('0x27')](function(){try{fs[_0x8e44('0x1a')](_0x46490e);fs['chmodSync'](_0x26644a,'777');}catch(_0x497a8c){logger[_0x8e44('0x1b')](_0x497a8c);}return _0x26644a[_0x8e44('0x28')]('.')[0x0];});}function base64Encode(_0x58d55a){var _0x1ab3c7=fs[_0x8e44('0x29')](_0x58d55a);return new Buffer(_0x1ab3c7)[_0x8e44('0x2a')]('base64');}exports[_0x8e44('0x2b')]=function(_0x2c4bbd,_0x3b6a3b,_0x27e554,_0x3b1843,_0x1fea86,_0x3e1072){var _0x5bdfb0,_0x416318;var _0xb9b56d=_0x8e44('0x2c');var _0x4fee27=_0x8e44('0x2d')+_0x2c4bbd;var _0x635eba={};if(_0x3b6a3b==='ssml'){_0x635eba[_0x8e44('0x2e')]={'ssml':_0x27e554};}else{_0x635eba[_0x8e44('0x2e')]={'text':_0x27e554};};_0x635eba[_0x8e44('0x2f')]={'languageCode':_0x3b1843,'ssmlGender':_0x1fea86};_0x635eba['audioConfig']={'audioEncoding':_0x8e44('0x30'),'sampleRateHertz':0x1f40};var _0x5f052a={'url':_0xb9b56d+_0x8e44('0x31')+_0x4fee27,'method':_0x8e44('0x32'),'json':!![],'body':_0x635eba};return rp(_0x5f052a)[_0x8e44('0x27')](function(_0xd500f5){return new BPromise(function(_0x293c57,_0x5a6faf){_0x5bdfb0=path['resolve'](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+_0x8e44('0x34'));var _0x456978=Buffer[_0x8e44('0x35')](_0xd500f5['audioContent'],'base64');return fs[_0x8e44('0x36')](_0x5bdfb0,_0x456978,function(_0x33422c){_0x5a6faf(_0x33422c);},function(_0x30789d){fs[_0x8e44('0x37')](_0x5bdfb0,'777');_0x293c57(_0x30789d);});});})['then'](function(_0xde9f4d){_0x416318=path['resolve'](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+'.wav');return convertFile(_0x5bdfb0,_0x416318);})['then'](function(){try{fs[_0x8e44('0x1a')](_0x5bdfb0);fs[_0x8e44('0x37')](_0x416318,_0x8e44('0x38'));}catch(_0x3d97f9){logger['error'](_0x3d97f9);}logger[_0x8e44('0x20')](_0x8e44('0x39'),_0x416318['split']('.')[0x0]);return _0x416318[_0x8e44('0x28')]('.')[0x0];});};exports[_0x8e44('0x3a')]=function(_0x46f4f9,_0x1d0501){var _0x3b0856=_0x8e44('0x3b');var _0x5f3179,_0x118f04;var _0x266c4;var _0x4099a1={'encoding':_0x8e44('0x3c'),'method':_0x8e44('0x32'),'timeout':0x2710,'url':_0x3b0856,'headers':{'Content-Type':_0x8e44('0x3d')},'body':_0x8e44('0x3e')+encodeURIComponent(JSON[_0x8e44('0x3f')]([[['jQ1olc',JSON[_0x8e44('0x3f')]([_0x46f4f9,_0x1d0501||'en',![],'null']),null,'generic']]]))};return rp(_0x4099a1)[_0x8e44('0x27')](function(_0x17d0fe){try{_0x266c4=eval(_0x17d0fe[_0x8e44('0x40')](0x5))[0x0][0x2];}catch(_0x418507){throw new Error('parse\x20response\x20failed:\x0a'+_0x17d0fe['data']);}if(!_0x266c4){if(_0x46f4f9[_0x8e44('0x41')]>0xc8){throw new Error(_0x8e44('0x42'));}else{throw new Error(_0x8e44('0x43')+_0x1d0501+_0x8e44('0x44'));}}try{_0x266c4=eval(_0x266c4)[0x0];}catch(_0x14e65a){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x5ca2c5=_0x266c4;_0x5f3179=path[_0x8e44('0x23')](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+_0x8e44('0x34'));fs[_0x8e44('0x26')](_0x5f3179,_0x266c4,{'encoding':_0x8e44('0x45')});_0x118f04=path['resolve'](__dirname,_0x8e44('0x33'),rs['generate'](0x4)+_0x8e44('0x25'));return convertFile(_0x5f3179,_0x118f04);})[_0x8e44('0x27')](function(){try{fs[_0x8e44('0x1a')](_0x5f3179);fs[_0x8e44('0x37')](_0x118f04,_0x8e44('0x38'));}catch(_0x37df90){logger[_0x8e44('0x1b')](_0x37df90);}logger[_0x8e44('0x20')](_0x8e44('0x46'),_0x118f04[_0x8e44('0x28')]('.')[0x0]);return _0x118f04['split']('.')[0x0];});};exports[_0x8e44('0x47')]=function(_0x1e0bf8,_0x2959e7,_0x81b28f){return google[_0x8e44('0x48')](_0x1e0bf8,_0x2959e7,_0x81b28f)[_0x8e44('0x27')](function(_0x56a09a){logger[_0x8e44('0x20')](_0x56a09a['uri']);return rp(_0x56a09a);})[_0x8e44('0x27')](function(_0x204cb4){var _0x41bff5='';var _0x3fade5=0x0;try{fs[_0x8e44('0x1a')](_0x1e0bf8);}catch(_0x495f6){logger[_0x8e44('0x1b')](_0x495f6);}if(_0x204cb4&&_0x204cb4[_0x8e44('0x49')]){_0x41bff5=_0x204cb4[_0x8e44('0x49')][_0x8e44('0x4a')](function(_0x49f065){return _0x49f065&&_0x49f065[_0x8e44('0x4b')][0x0]&&_0x49f065[_0x8e44('0x4b')][0x0][_0x8e44('0x4c')]?_0x49f065['alternatives'][0x0][_0x8e44('0x4c')]:'';})[_0x8e44('0x4d')]('\x0a');_0x3fade5=_0x204cb4[_0x8e44('0x49')][_0x8e44('0x4a')](function(_0x21a2bb){return _0x21a2bb&&_0x21a2bb[_0x8e44('0x4b')][0x0]&&_0x21a2bb[_0x8e44('0x4b')][0x0][_0x8e44('0x4e')]?_0x21a2bb[_0x8e44('0x4b')][0x0][_0x8e44('0x4e')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x41bff5);logger['info'](_0x8e44('0x4f'),_0x3fade5);return{'transcript':_0x41bff5,'confidence':_0x3fade5};})[_0x8e44('0x50')](function(_0x10fcb0){logger[_0x8e44('0x1b')]('[%s]\x20%s:%s',_0x10fcb0[_0x8e44('0x14')],_0x10fcb0[_0x8e44('0x51')],_0x10fcb0[_0x8e44('0x52')]);});};exports[_0x8e44('0x53')]=function(_0x3fb7fe,_0x4b7197,_0x4fb1d8,_0x1283d0){var _0x4654f6=apiai(_0x4b7197,{'language':_0x1283d0||'en'});return _0x4654f6[_0x8e44('0x54')](_0x4fb1d8,{'sessionId':md5(_0x3fb7fe)})[_0x8e44('0x27')](function(_0x38e913){logger[_0x8e44('0x20')](JSON[_0x8e44('0x3f')](_0x38e913));return{'source':_0x38e913[_0x8e44('0x55')][_0x8e44('0x56')],'resolvedQuery':_0x38e913[_0x8e44('0x55')][_0x8e44('0x57')],'action':_0x38e913[_0x8e44('0x55')][_0x8e44('0x58')],'actionIncomplete':_0x38e913[_0x8e44('0x55')][_0x8e44('0x59')],'speech':_0x38e913[_0x8e44('0x55')][_0x8e44('0x5a')][_0x8e44('0x5b')],'score':_0x38e913[_0x8e44('0x55')][_0x8e44('0x5c')],'statusCode':_0x38e913[_0x8e44('0x5d')][_0x8e44('0x5e')],'endConversation':_0x38e913[_0x8e44('0x55')][_0x8e44('0x5f')][_0x8e44('0x60')]||![],'isFallbackIntent':_0x38e913['result'][_0x8e44('0x5f')][_0x8e44('0x61')]};});};exports[_0x8e44('0x62')]=function(_0x122909,_0x35f05a,_0x95b056,_0x535c7b,_0xc6de84,_0x4562d3){var _0x234b4d=_0x535c7b[_0x8e44('0x63')](/\\n/g,'\x0a');var _0x58e4c6={'credentials':{'private_key':_0x234b4d,'client_email':_0x95b056}};var _0x26738a=new dialogflow[(_0x8e44('0x64'))](_0x58e4c6);var _0x2ad042=_0x26738a[_0x8e44('0x65')](_0x35f05a,md5(_0x122909));var _0x4f095c={'session':_0x2ad042,'queryInput':{'text':{'text':_0xc6de84,'languageCode':_0x4562d3}}};return _0x26738a[_0x8e44('0x66')](_0x4f095c)[_0x8e44('0x27')](function(_0x3bc0a7){if(_0x3bc0a7&&_0x3bc0a7[_0x8e44('0x41')]){logger[_0x8e44('0x20')](_0x8e44('0x67'),JSON[_0x8e44('0x3f')](_0x3bc0a7));var _0xc65414=_0x3bc0a7[0x0];if(_0xc65414){var _0xfc2dea={'action':_0xc65414['queryResult']['action'],'allRequiredParamsPresent':_0xc65414['queryResult'][_0x8e44('0x68')],'endConversation':_0xc65414['queryResult']['diagnosticInfo']&&_0xc65414['queryResult'][_0x8e44('0x69')][_0x8e44('0x6a')]?_0xc65414[_0x8e44('0x6b')][_0x8e44('0x69')][_0x8e44('0x6a')][_0x8e44('0x6c')][_0x8e44('0x6d')]:![],'fulfillmentText':_0xc65414[_0x8e44('0x6b')][_0x8e44('0x6e')],'intentName':_0xc65414[_0x8e44('0x6b')]['intent']['name'],'intentDisplayName':_0xc65414[_0x8e44('0x6b')][_0x8e44('0x6f')][_0x8e44('0x70')],'isFallbackIntent':_0xc65414[_0x8e44('0x6b')]['intent']['isFallback'],'languageCode':_0xc65414['queryResult'][_0x8e44('0x71')],'queryText':_0xc65414[_0x8e44('0x6b')][_0x8e44('0x72')],'responseId':_0xc65414['responseId'],'score':_0xc65414[_0x8e44('0x6b')][_0x8e44('0x73')],'speech':_0xc65414[_0x8e44('0x6b')]['fulfillmentText'],'providerResponse':JSON[_0x8e44('0x3f')](_0x3bc0a7)};return _0xfc2dea;}}});};exports[_0x8e44('0x74')]=function(_0x3810ff,_0x3f126f,_0x3b6f98,_0x2ade5e){return tilde[_0x8e44('0x48')](_0x3810ff,_0x3f126f,_0x3b6f98,_0x2ade5e)['then'](function(_0x5b7a96){try{fs[_0x8e44('0x1a')](_0x3810ff);}catch(_0xa25552){logger['error'](_0xa25552);}logger['info'](_0x8e44('0x75'),_0x5b7a96[_0x8e44('0x4c')]);logger[_0x8e44('0x20')](_0x8e44('0x76'),_0x5b7a96[_0x8e44('0x4e')]);return _0x5b7a96;});};exports[_0x8e44('0x77')]=function(_0x7a1110,_0x55d945,_0x203a62,_0x4deb61,_0x4e38b2,_0x1b5231){var _0x45a7fd=path['resolve'](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+_0x8e44('0x34'));var _0x52f76c;return aws[_0x8e44('0x78')](_0x7a1110,_0x55d945,_0x203a62,_0x4deb61,_0x4e38b2,_0x1b5231,_0x45a7fd)['then'](function(){_0x52f76c=path['resolve'](__dirname,'tmp',rs[_0x8e44('0x24')](0x4)+_0x8e44('0x25'));return convertFile(_0x45a7fd,_0x52f76c);})[_0x8e44('0x27')](function(){try{fs[_0x8e44('0x1a')](_0x45a7fd);fs[_0x8e44('0x37')](_0x52f76c,'777');}catch(_0x5c41fa){logger[_0x8e44('0x1b')](_0x5c41fa);}return _0x52f76c[_0x8e44('0x28')]('.')[0x0];});};exports[_0x8e44('0x79')]=function(_0x4bfc72,_0x14d97a,_0x438b86,_0xa3608b,_0x4d982e,_0x5d95ab){return aws[_0x8e44('0x7a')](_0x4bfc72,_0x14d97a,_0x438b86,_0xa3608b,_0x4d982e,_0x5d95ab)[_0x8e44('0x27')](function(_0xfc5cc1){logger[_0x8e44('0x20')](JSON['stringify'](_0xfc5cc1));return _0xfc5cc1;});};exports[_0x8e44('0x7b')]=function(_0x557956,_0x222d59,_0x46b4a6,_0x1f2158){var _0x5e8e69=util[_0x8e44('0x7c')](_0x8e44('0x7d'),ISPEECH_API,_0x557956,encodeURIComponent(_0x222d59),_0x46b4a6,_0x1f2158);var _0x3cd384=path[_0x8e44('0x23')](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+_0x8e44('0x34'));var _0x3e767a;return downloadFile(_0x5e8e69,_0x3cd384)[_0x8e44('0x27')](function(){_0x3e767a=path[_0x8e44('0x23')](__dirname,'tmp',rs[_0x8e44('0x24')](0x4)+_0x8e44('0x25'));return convertFile(_0x3cd384,_0x3e767a);})[_0x8e44('0x27')](function(){try{fs['unlink'](_0x3cd384);fs['chmodSync'](_0x3e767a,_0x8e44('0x38'));}catch(_0x2d1cae){logger[_0x8e44('0x1b')](_0x2d1cae);}return _0x3e767a[_0x8e44('0x28')]('.')[0x0];});};exports[_0x8e44('0x7e')]=function(_0x5bfa6d,_0x4a28b6,_0x2fd524,_0x191c53){var _0x15f82a=util['format'](_0x8e44('0x7f'),ISPEECH_API,_0x4a28b6,_0x2fd524,base64Encode(_0x5bfa6d),_0x191c53?util[_0x8e44('0x7c')](_0x8e44('0x80'),encodeURIComponent(_0x191c53)):'freeform=3');return uploadFile(_0x15f82a)[_0x8e44('0x27')](function(_0x3c57b3){return querystring['parse'](_0x3c57b3);});};exports[_0x8e44('0x81')]=function(_0x3d02c1,_0x59b770){return sestek[_0x8e44('0x82')](_0x3d02c1,_0x59b770)[_0x8e44('0x27')](function(_0xa63215){logger['info'](JSON['stringify'](_0xa63215));var _0x1ee3bc={'speech':_0xa63215[_0x8e44('0x83')],'action':_0xa63215[_0x8e44('0x84')]?_0xa63215[_0x8e44('0x84')][_0x8e44('0x85')]:undefined,'actiondata':_0xa63215[_0x8e44('0x84')]?_0xa63215[_0x8e44('0x84')][_0x8e44('0x86')]:undefined};if(_0xa63215[_0x8e44('0x84')]&&_0xa63215['channelData']['AudioFromTts']){return base64Decode(_0xa63215[_0x8e44('0x84')][_0x8e44('0x87')]['Data'],path[_0x8e44('0x23')](__dirname,_0x8e44('0x33'),rs[_0x8e44('0x24')](0x4)+_0x8e44('0x25')))[_0x8e44('0x27')](function(_0x52a219){_0x1ee3bc[_0x8e44('0x88')]=_0x52a219;return _0x1ee3bc;});}return _0x1ee3bc;});};exports[_0x8e44('0x89')]=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 247b076..5a44f87 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 _0x8df7=['exports'];(function(_0x78c82b,_0x3309fa){var _0x54273e=function(_0x2529c3){while(--_0x2529c3){_0x78c82b['push'](_0x78c82b['shift']());}};_0x54273e(++_0x3309fa);}(_0x8df7,0x1d5));var _0x78df=function(_0x36a41d,_0x799b99){_0x36a41d=_0x36a41d-0x0;var _0x3bc6fa=_0x8df7[_0x36a41d];return _0x3bc6fa;};var nda=require('./nda');module[_0x78df('0x0')]={'nda':nda}; \ No newline at end of file +var _0xfd47=['./nda','exports'];(function(_0x48d96a,_0xdda709){var _0x5f15fd=function(_0x2444e3){while(--_0x2444e3){_0x48d96a['push'](_0x48d96a['shift']());}};_0x5f15fd(++_0xdda709);}(_0xfd47,0x1da));var _0x7fd4=function(_0x2cd058,_0x5d15d9){_0x2cd058=_0x2cd058-0x0;var _0x446d75=_0xfd47[_0x2cd058];return _0x446d75;};var nda=require(_0x7fd4('0x0'));module[_0x7fd4('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 cd58d15..29e2126 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 _0x8e44=['body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','POST','ndauth_url','/token','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','channelData','ndagenerate_audio'];(function(_0xdc8eac,_0x2ce7e4){var _0x47d9e5=function(_0x3abcdf){while(--_0x3abcdf){_0xdc8eac['push'](_0xdc8eac['shift']());}};_0x47d9e5(++_0x2ce7e4);}(_0x8e44,0x1ac));var _0x48e4=function(_0x4da61c,_0x4f3c93){_0x4da61c=_0x4da61c-0x0;var _0x3403e9=_0x8e44[_0x4da61c];return _0x3403e9;};'use strict';var rp=require(_0x48e4('0x0'));var url=require(_0x48e4('0x1'));var logger=require(_0x48e4('0x2'))('agi');module['exports']=function(_0x3e0b0d,_0x30d851){var _0x41cb6b={'method':_0x48e4('0x3'),'uri':url['resolve'](_0x30d851[_0x48e4('0x4')],_0x48e4('0x5')),'form':{'grant_type':_0x48e4('0x6'),'username':_0x30d851['username'],'password':_0x30d851['password']},'json':!![]};return rp(_0x41cb6b)[_0x48e4('0x7')](function(_0xfd30df){var _0x552cb1={'method':_0x48e4('0x3'),'uri':url[_0x48e4('0x8')](_0x30d851[_0x48e4('0x9')],_0x48e4('0xa')),'body':{'type':_0x30d851[_0x48e4('0xb')]||_0x48e4('0xc'),'channelId':'Nda','conversation':{'id':_0x3e0b0d[_0x48e4('0xd')]},'from':{'id':_0x3e0b0d[_0x48e4('0xe')],'name':_0x3e0b0d[_0x48e4('0xf')]},'recipient':{'id':_0x3e0b0d['dnid'],'name':_0x3e0b0d['extension']},'text':_0x30d851[_0x48e4('0x10')],'channelData':{}},'headers':{'Authorization':_0x48e4('0x11')+_0xfd30df[_0x48e4('0x12')]},'json':!![]};if(_0x30d851[_0x48e4('0x13')]){_0x552cb1['body'][_0x48e4('0x14')]['ProjectName']=_0x30d851[_0x48e4('0x13')];}if(_0x30d851[_0x48e4('0x15')]=='1'){_0x552cb1[_0x48e4('0x16')][_0x48e4('0x14')][_0x48e4('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x48e4('0x18')};}if(_0x30d851[_0x48e4('0x19')]){_0x552cb1['body'][_0x48e4('0x14')][_0x48e4('0x1a')]=_0x30d851['custom_action'];if(_0x30d851[_0x48e4('0x1b')]){_0x552cb1[_0x48e4('0x16')]['channelData'][_0x48e4('0x1c')]=_0x30d851[_0x48e4('0x1b')];}}logger[_0x48e4('0x1d')](JSON['stringify'](_0x552cb1));return rp(_0x552cb1);});}; \ No newline at end of file +var _0xfa68=['ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','dnid','extension','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','CustomAction','custom_action','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve'];(function(_0xb76f6c,_0x488671){var _0x5b176d=function(_0xa15c49){while(--_0xa15c49){_0xb76f6c['push'](_0xb76f6c['shift']());}};_0x5b176d(++_0x488671);}(_0xfa68,0x86));var _0x8fa6=function(_0xd41e23,_0x5762d3){_0xd41e23=_0xd41e23-0x0;var _0x5b3ee4=_0xfa68[_0xd41e23];return _0x5b3ee4;};'use strict';var rp=require(_0x8fa6('0x0'));var url=require(_0x8fa6('0x1'));var logger=require(_0x8fa6('0x2'))('agi');module[_0x8fa6('0x3')]=function(_0x3debfe,_0x3cb0da){var _0x47de91={'method':_0x8fa6('0x4'),'uri':url[_0x8fa6('0x5')](_0x3cb0da[_0x8fa6('0x6')],_0x8fa6('0x7')),'form':{'grant_type':_0x8fa6('0x8'),'username':_0x3cb0da['username'],'password':_0x3cb0da[_0x8fa6('0x8')]},'json':!![]};return rp(_0x47de91)[_0x8fa6('0x9')](function(_0x523f62){var _0x1cdf94={'method':_0x8fa6('0x4'),'uri':url['resolve'](_0x3cb0da['ndassistant_url'],_0x8fa6('0xa')),'body':{'type':_0x3cb0da[_0x8fa6('0xb')]||'message','channelId':_0x8fa6('0xc'),'conversation':{'id':_0x3debfe[_0x8fa6('0xd')]},'from':{'id':_0x3debfe['callerid'],'name':_0x3debfe['calleridname']},'recipient':{'id':_0x3debfe[_0x8fa6('0xe')],'name':_0x3debfe[_0x8fa6('0xf')]},'text':_0x3cb0da['text'],'channelData':{}},'headers':{'Authorization':_0x8fa6('0x10')+_0x523f62[_0x8fa6('0x11')]},'json':!![]};if(_0x3cb0da['project']){_0x1cdf94[_0x8fa6('0x12')][_0x8fa6('0x13')]['ProjectName']=_0x3cb0da[_0x8fa6('0x14')];}if(_0x3cb0da[_0x8fa6('0x15')]=='1'){_0x1cdf94[_0x8fa6('0x12')][_0x8fa6('0x13')][_0x8fa6('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3cb0da['custom_action']){_0x1cdf94[_0x8fa6('0x12')]['channelData'][_0x8fa6('0x17')]=_0x3cb0da[_0x8fa6('0x18')];if(_0x3cb0da[_0x8fa6('0x19')]){_0x1cdf94['body'][_0x8fa6('0x13')][_0x8fa6('0x1a')]=_0x3cb0da[_0x8fa6('0x19')];}}logger['info'](JSON[_0x8fa6('0x1b')](_0x1cdf94));return rp(_0x1cdf94);});}; \ 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 65db7a8..f6ba98d 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x41b036,_0x516b9a,_0x47b313,_0x796361){return asr(_0x41b036,_0x516b9a,_0x47b313,_0x796361);}; \ No newline at end of file +var _0x8cf3=['./lib/api','exports'];(function(_0x41a461,_0x56473a){var _0x5dc08e=function(_0x442fe6){while(--_0x442fe6){_0x41a461['push'](_0x41a461['shift']());}};_0x5dc08e(++_0x56473a);}(_0x8cf3,0x10a));var _0x38cf=function(_0xc77292,_0x19f4c4){_0xc77292=_0xc77292-0x0;var _0x44d235=_0x8cf3[_0xc77292];return _0x44d235;};'use strict';var asr=require(_0x38cf('0x0'));module[_0x38cf('0x1')]=function(_0x2d9e7c,_0x318565,_0x22f7c8,_0x3807eb){return asr(_0x2d9e7c,_0x318565,_0x22f7c8,_0x3807eb);}; \ 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 b08553b..db0a0f3 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 _0xd176=['transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0x2e2148,_0xa0edbb){var _0x126751=function(_0x2e88fd){while(--_0x2e88fd){_0x2e2148['push'](_0x2e2148['shift']());}};_0x126751(++_0xa0edbb);}(_0xd176,0x15b));var _0x6d17=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0xd176[_0x2a2166];return _0x3bcf50;};'use strict';var BPromise=require(_0x6d17('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6d17('0x1'));var crypto=require('crypto');var logger=require(_0x6d17('0x2'))(_0x6d17('0x3'));module[_0x6d17('0x4')]=function(_0x3dffd9,_0x2199dc,_0x43afa7,_0x487474){return new BPromise(function(_0x3ae8eb,_0x1f472b){logger[_0x6d17('0x5')]('Tilde\x20URI',_0x487474||_0x6d17('0x6'));var _0x40b319=new WebSocket(_0x487474||_0x6d17('0x6'),{'perMessageDeflate':![]});var _0x5891cd='';var _0x465df2='0';var _0x4ef3cc='1';var _0x1b45a2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x19dbb6(_0x523e4e){var _0x12ff45=crypto[_0x6d17('0x7')]('sha1');_0x12ff45['update'](_0x523e4e);return _0x12ff45[_0x6d17('0x8')](_0x6d17('0x9'));}function _0xf2ff60(){try{logger['info'](_0x6d17('0xa'));var _0x33491b=moment()[_0x6d17('0xb')]();var _0x562c8=_0x19dbb6(_0x33491b+_0x2199dc+_0x43afa7);_0x40b319[_0x6d17('0xc')](JSON[_0x6d17('0xd')]({'appID':_0x2199dc,'timestamp':_0x33491b,'appKey':_0x562c8}));var _0x21429f=fs[_0x6d17('0xe')](_0x3dffd9);_0x21429f['on'](_0x6d17('0xf'),function(_0x20b836){_0x40b319[_0x6d17('0xc')](_0x20b836);});_0x21429f['on']('close',function(){_0x40b319['send'](_0x6d17('0x10'));});}catch(_0x5d69a0){logger[_0x6d17('0x11')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5d69a0));_0x40b319['terminate']();}}function _0x324243(_0x2959c0){try{if(_0x2959c0){var _0x39b38f=JSON['parse'](_0x2959c0);switch(_0x39b38f[_0x6d17('0x12')]){case 0x0:if(_0x39b38f[_0x6d17('0x13')]){if(_0x39b38f[_0x6d17('0x13')][_0x6d17('0x14')]){logger['info'](_0x6d17('0x15'),JSON[_0x6d17('0xd')](_0x39b38f['result'][_0x6d17('0x16')]));_0x5891cd=_0x39b38f[_0x6d17('0x13')][_0x6d17('0x16')][0x0][_0x6d17('0x17')];_0x465df2=_0x39b38f[_0x6d17('0x13')][_0x6d17('0x16')][0x0][_0x6d17('0x18')];_0x4ef3cc='0';_0x1b45a2=_0x6d17('0x19');_0x40b319['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4ef3cc='1';_0x1b45a2=_0x6d17('0x1a');break;case 0x2:logger[_0x6d17('0x5')](_0x6d17('0x1b'));_0x4ef3cc='2';_0x1b45a2=_0x6d17('0x1b');break;case 0x9:logger['info'](_0x6d17('0x1c'));_0x4ef3cc='9';_0x1b45a2=_0x6d17('0x1c');break;case 0xa:logger['info'](_0x6d17('0x1d'));_0x4ef3cc='10';_0x1b45a2='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4ef3cc='11';_0x1b45a2=_0x6d17('0x1e');}}}catch(_0x169c62){logger[_0x6d17('0x11')](_0x6d17('0x1f'),JSON[_0x6d17('0xd')](_0x169c62));_0x40b319[_0x6d17('0x20')]();}}function _0x5de3a8(){logger[_0x6d17('0x5')](_0x6d17('0x21'));_0x3ae8eb({'transcript':_0x5891cd,'confidence':_0x465df2,'status':_0x4ef3cc,'status_message':_0x1b45a2});}function _0x26c615(_0x42f43e){logger[_0x6d17('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x42f43e)){logger[_0x6d17('0x11')](_[_0x6d17('0x22')](_0x42f43e)?JSON[_0x6d17('0xd')](_0x42f43e):_0x42f43e);}}_0x40b319['on']('open',_0xf2ff60);_0x40b319['on'](_0x6d17('0x23'),_0x324243);_0x40b319['on'](_0x6d17('0x24'),_0x5de3a8);_0x40b319['on'](_0x6d17('0x11'),_0x26c615);});}; \ No newline at end of file +var _0x3ed3=['isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x45502d,_0x5ca8b7){var _0x8813c9=function(_0xa53455){while(--_0xa53455){_0x45502d['push'](_0x45502d['shift']());}};_0x8813c9(++_0x5ca8b7);}(_0x3ed3,0x12a));var _0x33ed=function(_0x27e343,_0x24792d){_0x27e343=_0x27e343-0x0;var _0x296c2c=_0x3ed3[_0x27e343];return _0x296c2c;};'use strict';var BPromise=require(_0x33ed('0x0'));var _=require(_0x33ed('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x33ed('0x2'));var logger=require(_0x33ed('0x3'))(_0x33ed('0x4'));module[_0x33ed('0x5')]=function(_0x50bfe,_0x4fa9ba,_0x4cf0a3,_0xfb2847){return new BPromise(function(_0x491ad2,_0x42939b){logger[_0x33ed('0x6')](_0x33ed('0x7'),_0xfb2847||_0x33ed('0x8'));var _0x493aae=new WebSocket(_0xfb2847||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5d72d6='';var _0x4857b2='0';var _0x158539='1';var _0x32ab4c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2964f7(_0x4dc366){var _0x33d71e=crypto['createHash'](_0x33ed('0x9'));_0x33d71e[_0x33ed('0xa')](_0x4dc366);return _0x33d71e['digest'](_0x33ed('0xb'));}function _0x2c13a3(){try{logger['info'](_0x33ed('0xc'));var _0xd65e29=moment()[_0x33ed('0xd')]();var _0x1916cf=_0x2964f7(_0xd65e29+_0x4fa9ba+_0x4cf0a3);_0x493aae[_0x33ed('0xe')](JSON[_0x33ed('0xf')]({'appID':_0x4fa9ba,'timestamp':_0xd65e29,'appKey':_0x1916cf}));var _0x3d127c=fs[_0x33ed('0x10')](_0x50bfe);_0x3d127c['on'](_0x33ed('0x11'),function(_0x36910e){_0x493aae['send'](_0x36910e);});_0x3d127c['on'](_0x33ed('0x12'),function(){_0x493aae['send'](_0x33ed('0x13'));});}catch(_0xf81267){logger['error'](_0x33ed('0x14'),JSON['stringify'](_0xf81267));_0x493aae[_0x33ed('0x15')]();}}function _0xbf2a10(_0xc5ce2f){try{if(_0xc5ce2f){var _0x4b9aec=JSON['parse'](_0xc5ce2f);switch(_0x4b9aec[_0x33ed('0x16')]){case 0x0:if(_0x4b9aec[_0x33ed('0x17')]){if(_0x4b9aec['result'][_0x33ed('0x18')]){logger['info'](_0x33ed('0x19'),JSON[_0x33ed('0xf')](_0x4b9aec[_0x33ed('0x17')][_0x33ed('0x1a')]));_0x5d72d6=_0x4b9aec[_0x33ed('0x17')]['hypotheses'][0x0][_0x33ed('0x1b')];_0x4857b2=_0x4b9aec[_0x33ed('0x17')][_0x33ed('0x1a')][0x0]['likelihood'];_0x158539='0';_0x32ab4c=_0x33ed('0x1c');_0x493aae[_0x33ed('0x15')]();}}break;case 0x1:logger[_0x33ed('0x6')](_0x33ed('0x1d'));_0x158539='1';_0x32ab4c=_0x33ed('0x1d');break;case 0x2:logger[_0x33ed('0x6')](_0x33ed('0x1e'));_0x158539='2';_0x32ab4c='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x33ed('0x6')](_0x33ed('0x1f'));_0x158539='9';_0x32ab4c=_0x33ed('0x1f');break;case 0xa:logger[_0x33ed('0x6')](_0x33ed('0x20'));_0x158539='10';_0x32ab4c=_0x33ed('0x20');break;case 0xb:logger[_0x33ed('0x6')](_0x33ed('0x21'));_0x158539='11';_0x32ab4c=_0x33ed('0x21');}}}catch(_0x2a7838){logger[_0x33ed('0x22')](_0x33ed('0x23'),JSON['stringify'](_0x2a7838));_0x493aae['terminate']();}}function _0xab180(){logger[_0x33ed('0x6')](_0x33ed('0x24'));_0x491ad2({'transcript':_0x5d72d6,'confidence':_0x4857b2,'status':_0x158539,'status_message':_0x32ab4c});}function _0x53f62f(_0x2cb287){logger[_0x33ed('0x22')](_0x33ed('0x25'));if(!_[_0x33ed('0x26')](_0x2cb287)){logger[_0x33ed('0x22')](_[_0x33ed('0x27')](_0x2cb287)?JSON[_0x33ed('0xf')](_0x2cb287):_0x2cb287);}}_0x493aae['on'](_0x33ed('0x28'),_0x2c13a3);_0x493aae['on'](_0x33ed('0x29'),_0xbf2a10);_0x493aae['on'](_0x33ed('0x12'),_0xab180);_0x493aae['on']('error',_0x53f62f);});}; \ 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 0bca61e..26fc271 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 _0x48af=['exports','./asr'];(function(_0x136002,_0x370daf){var _0x18d244=function(_0x517862){while(--_0x517862){_0x136002['push'](_0x136002['shift']());}};_0x18d244(++_0x370daf);}(_0x48af,0xd7));var _0xf48a=function(_0xed9dd,_0x184eb5){_0xed9dd=_0xed9dd-0x0;var _0x2b0faf=_0x48af[_0xed9dd];return _0x2b0faf;};var asr=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x1ebd=['exports','./asr'];(function(_0x2be7fc,_0x1c8093){var _0xf0f28e=function(_0x18020e){while(--_0x18020e){_0x2be7fc['push'](_0x2be7fc['shift']());}};_0xf0f28e(++_0x1c8093);}(_0x1ebd,0x193));var _0xd1eb=function(_0x2be2c4,_0x1a9470){_0x2be2c4=_0x2be2c4-0x0;var _0x5e5201=_0x1ebd[_0x2be2c4];return _0x5e5201;};var asr=require(_0xd1eb('0x0'));module[_0xd1eb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5e5c8af..51371c2 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 _0x1f8a=['nextTick','exports','util','events','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','close','E_AGI_SERVER_CLOSE'];(function(_0x40f4ca,_0x1f6e83){var _0x1a3c32=function(_0x3a546e){while(--_0x3a546e){_0x40f4ca['push'](_0x40f4ca['shift']());}};_0x1a3c32(++_0x1f6e83);}(_0x1f8a,0x1e2));var _0xa1f8=function(_0xefa85b,_0xecb7b7){_0xefa85b=_0xefa85b-0x0;var _0x289def=_0x1f8a[_0xefa85b];return _0x289def;};'use strict';var util=require(_0xa1f8('0x0'));var net=require('net');var EventEmitter=require(_0xa1f8('0x1'))['EventEmitter'];var AGIError=require(_0xa1f8('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x4a0e6d,_0x1b78a2,_0xb768c3){var _0x327832=this,_0x4a0e6d=_0x4a0e6d||0x11dd,_0x1b78a2=_0x1b78a2||_0xa1f8('0x3'),_0x35bb85=null,_0x4cab1f=0x0;EventEmitter[_0xa1f8('0x4')](_0x327832);function _0x4554ad(){if(!_0x4a0e6d){_0x327832[_0xa1f8('0x5')](_0xa1f8('0x6'),new AGIError(_0xa1f8('0x7')));return![];}_0x35bb85=net[_0xa1f8('0x8')]();_0x35bb85[_0xa1f8('0x9')](_0x4a0e6d,_0x1b78a2);_0x35bb85['on'](_0xa1f8('0xa'),function(){_0x327832[_0xa1f8('0x5')](_0xa1f8('0xa'));});_0x35bb85['on']('connection',function(_0x20acdf){_0x35bb85['getConnections'](function(_0x215828,_0x1014dd){if(_0x215828){_0x327832['emit'](_0xa1f8('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x215828));}else if(_0xb768c3&&_0xb768c3<0x0){_0x327832['emit'](_0xa1f8('0x6'),new AGIError(_0xa1f8('0xb')));_0x20acdf[_0xa1f8('0xc')]();}else if(_0xb768c3&&_0xb768c3>0x0&&_0xb768c3<_0x1014dd){_0x4cab1f+=0x1;_0x327832[_0xa1f8('0x5')](_0xa1f8('0x6'),new AGIError(_0xa1f8('0xd'),_0x4cab1f));_0x20acdf[_0xa1f8('0xc')]();}else{var _0x2084fa=new AGIChannel(_0x20acdf);_0x2084fa['on'](_0xa1f8('0xe'),function(){_0x327832[_0xa1f8('0x5')](_0xa1f8('0xf'),_0x2084fa);});}});});_0x35bb85['on']('error',function(_0x98bc4b){_0x327832[_0xa1f8('0x5')](_0xa1f8('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x98bc4b['code']));});_0x35bb85['on'](_0xa1f8('0x10'),function(){_0x327832[_0xa1f8('0x5')](_0xa1f8('0x10'),new AGIError(_0xa1f8('0x11')));});}process[_0xa1f8('0x12')](function(){_0x4554ad();});};util['inherits'](AGIServer,EventEmitter);module[_0xa1f8('0x13')]=function(_0x4598a4,_0x4e507a,_0x3ec4c5){return new AGIServer(_0x4598a4,_0x4e507a,_0x3ec4c5);}; \ No newline at end of file +var _0xa0c6=['error','createServer','listen','listening','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','./error','./channel','127.0.0.1','call','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0c6,0x162));var _0x6a0c=function(_0x317d4a,_0x16ee27){_0x317d4a=_0x317d4a-0x0;var _0x4847dc=_0xa0c6[_0x317d4a];return _0x4847dc;};'use strict';var util=require(_0x6a0c('0x0'));var net=require('net');var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0x6a0c('0x1'));var AGIChannel=require(_0x6a0c('0x2'));var AGIServer=function(_0x4960e4,_0x267e36,_0x35923d){var _0x130111=this,_0x4960e4=_0x4960e4||0x11dd,_0x267e36=_0x267e36||_0x6a0c('0x3'),_0x378978=null,_0x439b81=0x0;EventEmitter[_0x6a0c('0x4')](_0x130111);function _0x5be363(){if(!_0x4960e4){_0x130111[_0x6a0c('0x5')](_0x6a0c('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x378978=net[_0x6a0c('0x7')]();_0x378978[_0x6a0c('0x8')](_0x4960e4,_0x267e36);_0x378978['on'](_0x6a0c('0x9'),function(){_0x130111['emit']('listening');});_0x378978['on']('connection',function(_0x36da2a){_0x378978['getConnections'](function(_0x85ab80,_0x467bf6){if(_0x85ab80){_0x130111[_0x6a0c('0x5')]('error',new AGIError(_0x6a0c('0xa'),_0x85ab80));}else if(_0x35923d&&_0x35923d<0x0){_0x130111[_0x6a0c('0x5')](_0x6a0c('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x36da2a[_0x6a0c('0xb')]();}else if(_0x35923d&&_0x35923d>0x0&&_0x35923d<_0x467bf6){_0x439b81+=0x1;_0x130111[_0x6a0c('0x5')](_0x6a0c('0x6'),new AGIError(_0x6a0c('0xc'),_0x439b81));_0x36da2a[_0x6a0c('0xb')]();}else{var _0x29d6fc=new AGIChannel(_0x36da2a);_0x29d6fc['on']('ready',function(){_0x130111[_0x6a0c('0x5')](_0x6a0c('0xd'),_0x29d6fc);});}});});_0x378978['on'](_0x6a0c('0x6'),function(_0x5efaa1){_0x130111[_0x6a0c('0x5')](_0x6a0c('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x5efaa1[_0x6a0c('0xe')]));});_0x378978['on']('close',function(){_0x130111['emit'](_0x6a0c('0xf'),new AGIError(_0x6a0c('0x10')));});}process[_0x6a0c('0x11')](function(){_0x5be363();});};util[_0x6a0c('0x12')](AGIServer,EventEmitter);module[_0x6a0c('0x13')]=function(_0x704333,_0x502c33,_0x223cdc){return new AGIServer(_0x704333,_0x502c33,_0x223cdc);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b9575cc..c9355b2 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 _0x4d9e=['agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','dialTimezone','getContactByPhone','timezones','scheduledat','add','minutes','insertContact','utcOffset','getPauseById','agentPause','agent','agentUnpause','agentLogout','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_bot_name','googleASR','tildeASR','appsecret','clear','hasOwnProperty','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','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','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','port','secure','authentication','auth','user','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','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','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','shelljs','randomstring','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x4550cd,_0x52334c){_0x4550cd=_0x4550cd-0x0;var _0x15a9d0=_0x4d9e[_0x4550cd];return _0x15a9d0;};'use strict';var fs=require('fs');var path=require(_0xe4d9('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xe4d9('0x1'));var odbc=require('odbc')();var rs=require(_0xe4d9('0x2'));var moment=require('moment');var Mustache=require(_0xe4d9('0x3'));var rp=require(_0xe4d9('0x4'));var logger=require('../../config/logger')(_0xe4d9('0x5'));var config=require(_0xe4d9('0x6'));var shared=require(_0xe4d9('0x7'));var scripts=require(_0xe4d9('0x8'));var FILES_PATH=_0xe4d9('0x9');var recursiveMapAttributes=[_0xe4d9('0xa'),'rawBody'];var verticesWithRetry=[_0xe4d9('0xb'),_0xe4d9('0xc'),_0xe4d9('0xd')];var AGIVertices=function(_0x18ab9d,_0x3f8937,_0x21ebb8){this['channel']=_0x18ab9d;this[_0xe4d9('0xe')]=_0x3f8937;this[_0xe4d9('0xf')]=_0x21ebb8;};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x11')]=function(_0xddd1fb,_0x3d1e0e){this[_0xe4d9('0xe')]['getVariableById'](_0xddd1fb)['then'](function(_0x580c50){_0x3d1e0e(null,_0x580c50?_0x580c50['name']:![]);})['catch'](function(_0x4b5b09){_0x3d1e0e(_0x4b5b09);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x15c0eb,_0x3238d4){this[_0xe4d9('0xe')]['getVoiceQueueById'](_0x15c0eb)[_0xe4d9('0x12')](function(_0x3f6ce4){_0x3238d4(null,_0x3f6ce4?_0x3f6ce4[_0xe4d9('0x13')]:![]);})[_0xe4d9('0x14')](function(_0x58d0cf){_0x3238d4(_0x58d0cf);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x15')]=function(_0x4687f8,_0x4b354d){this['rpc'][_0xe4d9('0x16')](_0x4687f8)[_0xe4d9('0x12')](function(_0x5ab3d1){_0x4b354d(null,_0x5ab3d1?_0x5ab3d1[_0xe4d9('0x13')]:![]);})['catch'](function(_0x469931){_0x4b354d(_0x469931);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x17')]=function(_0x2522f3,_0x503570){this[_0xe4d9('0xe')][_0xe4d9('0x18')](_0x2522f3)[_0xe4d9('0x12')](function(_0x171224){_0x503570(null,_0x171224?_0x171224[_0xe4d9('0x19')]:![]);})[_0xe4d9('0x14')](function(_0x30d923){_0x503570(_0x30d923);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1a')]=function(_0x4fed7f,_0x44f1aa){this[_0xe4d9('0xe')]['getUserById'](_0x4fed7f)[_0xe4d9('0x12')](function(_0x50d377){_0x44f1aa(null,_0x50d377?_0x50d377[_0xe4d9('0x13')]:![]);})[_0xe4d9('0x14')](function(_0x5b494d){_0x44f1aa(_0x5b494d);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1b')]=function(_0x5b88e9,_0xc5be1b){this[_0xe4d9('0xe')][_0xe4d9('0x1c')](_0x5b88e9)['then'](function(_0x4ee33d){_0xc5be1b(null,_0x4ee33d?_0x4ee33d[_0xe4d9('0x13')]:![]);})[_0xe4d9('0x14')](function(_0x52ef56){_0xc5be1b(_0x52ef56);});};AGIVertices['prototype']['getSound']=function(_0x529e2b,_0x221a61){var _0x48d481=this;this[_0xe4d9('0xe')][_0xe4d9('0x1d')](_0x529e2b)[_0xe4d9('0x12')](function(_0x535200){_0x221a61(null,_0x535200?_0x48d481[_0xe4d9('0x1e')](_0x535200[_0xe4d9('0x1f')]):![]);})[_0xe4d9('0x14')](function(_0x45e8a3){_0x221a61(_0x45e8a3);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x20')]=function(_0x21b7a9,_0x449cb8){this[_0xe4d9('0xe')][_0xe4d9('0x21')](_0x21b7a9)[_0xe4d9('0x12')](function(_0x29a121){_0x449cb8(null,_0x29a121?_0x29a121:![]);})['catch'](function(_0x22efd2){_0x449cb8(_0x22efd2);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x22')]=function(_0x3721a0,_0xa444d0,_0x12e0ae){this['mailRpc']['sendMailMessage'](_0x3721a0,_0xa444d0)['then'](function(){_0x12e0ae(null);})[_0xe4d9('0x14')](function(_0x100e57){_0x12e0ae(_0x100e57);});};AGIVertices[_0xe4d9('0x10')]['getIntervals']=function(_0x5a7422,_0x5ad794){this['rpc'][_0xe4d9('0x23')](_0x5a7422)[_0xe4d9('0x12')](function(_0x4f059b){if(_0x4f059b){if(_0x4f059b[_0xe4d9('0x24')]){_0x5ad794(null,[_0x4f059b[_0xe4d9('0x25')]]);}else{_0x5ad794(null,_['map'](_0x4f059b[_0xe4d9('0x26')],_0xe4d9('0x25')));}}else{_0x5ad794(null,![]);}})[_0xe4d9('0x14')](function(_0x4f7a6c){_0x5ad794(_0x4f7a6c);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1e')]=function(_0x7073ca){return util[_0xe4d9('0x27')](_0xe4d9('0x28'),FILES_PATH,_0x7073ca);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x29')]=function(_0x517f24,_0x234b62,_0x34f72f){odbc['open'](_0x517f24,function(_0x35b5f5){if(_0x35b5f5){logger[_0xe4d9('0x2a')](_0xe4d9('0x2b'),_0x35b5f5);_0x34f72f(_0x35b5f5);}else{logger[_0xe4d9('0x2c')](_0xe4d9('0x2d'));odbc[_0xe4d9('0x2e')](_0x234b62,function(_0x2e8243,_0x4423a7){if(_0x2e8243){logger[_0xe4d9('0x2c')]('Error\x20executing\x20query\x20%s',_0x234b62);_0x34f72f(_0x2e8243);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x234b62);odbc[_0xe4d9('0x2f')](function(_0x3fe6a9){if(_0x3fe6a9){logger[_0xe4d9('0x2a')](_0xe4d9('0x30'),_0x3fe6a9);}_0x34f72f(null,_0x4423a7);});}});}});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x31')]=function(_0x392cdd,_0x5980a2){this['rpc']['getSmsAccountById'](_0x392cdd)[_0xe4d9('0x12')](function(_0x19fdb0){_0x5980a2(null,_0x19fdb0?_0x19fdb0:![]);})['catch'](function(_0x48210e){_0x5980a2(_0x48210e);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x32')]=function(_0x453833,_0x5d0476){this[_0xe4d9('0xe')][_0xe4d9('0x32')](_0x453833)[_0xe4d9('0x12')](function(_0x17de1e){_0x5d0476(null,_0x17de1e);})[_0xe4d9('0x14')](function(_0x1b9d00){_0x5d0476(_0x1b9d00);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x33')]=function(_0x86bc71,_0x288c86,_0x467f58){this['rpc'][_0xe4d9('0x33')]({'uniqueid':this[_0xe4d9('0x34')][_0xe4d9('0x35')],'node':_0x86bc71[_0xe4d9('0x36')],'application':_0x86bc71[_0xe4d9('0x37')],'data':_0x288c86||null,'project_name':this['channel'][_0xe4d9('0x38')],'callerid':this[_0xe4d9('0x34')][_0xe4d9('0x39')]})[_0xe4d9('0x12')](function(_0xc107fc){if(_0x467f58){_0x467f58(null,_0xc107fc);}})[_0xe4d9('0x14')](function(_0x1e5f54){if(_0x467f58){_0x467f58(_0x1e5f54);}});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x3a')]=function(_0x5a09fa,_0x5510e7,_0x246550,_0x179117){this[_0xe4d9('0xe')]['createSquareRecording']({'uniqueid':this[_0xe4d9('0x34')][_0xe4d9('0x35')],'callerid':this[_0xe4d9('0x34')][_0xe4d9('0x39')],'calleridname':this[_0xe4d9('0x34')][_0xe4d9('0x3b')],'context':this[_0xe4d9('0x34')]['context'],'extension':this[_0xe4d9('0x34')][_0xe4d9('0x3c')],'priority':this[_0xe4d9('0x34')][_0xe4d9('0x3d')],'accountcode':this[_0xe4d9('0x34')][_0xe4d9('0x3e')],'dnid':this['channel'][_0xe4d9('0x3f')],'projectName':this[_0xe4d9('0x34')][_0xe4d9('0x38')],'saveName':_0x5510e7,'filename':_0x5a09fa[_0xe4d9('0x40')]||_0x5510e7,'savePath':_0x246550})[_0xe4d9('0x12')](function(_0x19ae72){_0x179117(null,_0x19ae72);})['catch'](function(_0xc0c2fd){_0x179117(_0xc0c2fd);});};AGIVertices[_0xe4d9('0x10')]['createSquareMessage']=function(_0x3eccd4,_0x4c913d,_0x17b46b,_0xbeb7c7,_0x4ebafb){this[_0xe4d9('0xe')]['createSquareMessage']({'uniqueid':this[_0xe4d9('0x34')][_0xe4d9('0x35')],'body':_0x3eccd4,'direction':_0x4c913d,'providerName':_0x17b46b,'providerResponse':_0xbeb7c7})[_0xe4d9('0x12')](function(_0x48b9fa){if(_0x4ebafb){_0x4ebafb(null,_0x48b9fa);}})[_0xe4d9('0x14')](function(_0x725bb4){if(_0x4ebafb){_0x4ebafb(_0x725bb4);}});};AGIVertices['prototype'][_0xe4d9('0x41')]=function(_0x1af63a,_0x37af58){var _0x42d15b=this;var _0x59b548=0x0;var _0x50f513={'firstName':_[_0xe4d9('0x42')](_0x1af63a[_0xe4d9('0x13')])||_[_0xe4d9('0x43')](_0x1af63a[_0xe4d9('0x13')])?_0xe4d9('0x44')+Math[_0xe4d9('0x45')]():_0x1af63a['name'],'lastName':_['isEmpty'](_0x1af63a[_0xe4d9('0x46')])||_[_0xe4d9('0x43')](_0x1af63a[_0xe4d9('0x46')])?null:_0x1af63a[_0xe4d9('0x46')],'phone':_0x1af63a[_0xe4d9('0x47')],'ListId':_0x1af63a[_0xe4d9('0x48')],'scheduledat':_0x1af63a['scheduledAt'],'callbackUniqueid':this[_0xe4d9('0x34')][_0xe4d9('0x35')],'tags':_0xe4d9('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x1af63a[_0xe4d9('0x4a')][_0xe4d9('0x4b')](),'priority':_0x1af63a[_0xe4d9('0x4c')]};if(_['has'](_0x1af63a,_0xe4d9('0x4d'))){if(!_['isNil'](_0x1af63a[_0xe4d9('0x4d')])){var _0x13b008=_0x1af63a[_0xe4d9('0x4d')];if(_0x1af63a['dialTimezone']=='CALLERID(dialTimezone)'){this['rpc'][_0xe4d9('0x4e')]({'phone':_0x1af63a['phone']})[_0xe4d9('0x12')](function(_0x4c37a6){if(!_['isNil'](_0x4c37a6)){var _0x3c2196=_0x4c37a6[_0xe4d9('0x4d')];if(!_[_0xe4d9('0x43')](_0x3c2196)){var _0x1469b8=shared[_0xe4d9('0x4f')][_0x3c2196];if(!_['isNil'](_0x1469b8)){var _0x49a622=-0x1*_0x1469b8['utcOffset'];_0x50f513['scheduledat']=moment(_0x1af63a[_0xe4d9('0x50')])[_0xe4d9('0x51')](_0x49a622,_0xe4d9('0x52'));_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}});}else{var _0x59b548=shared['timezones'][_0x13b008];if(!_[_0xe4d9('0x43')](_0x59b548)){var _0xf4d401=-0x1*_0x59b548[_0xe4d9('0x54')];_0x50f513[_0xe4d9('0x50')]=moment(_0x1af63a[_0xe4d9('0x50')])[_0xe4d9('0x51')](_0xf4d401,_0xe4d9('0x52'));_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}}}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}}else{_0x42d15b[_0xe4d9('0x53')](_0x50f513,_0x1af63a,_0x37af58);}};AGIVertices[_0xe4d9('0x10')]['getPause']=function(_0x2f3396,_0x46d60b){this[_0xe4d9('0xe')][_0xe4d9('0x55')](_0x2f3396)['then'](function(_0x50a00b){_0x46d60b(null,_0x50a00b?_0x50a00b['name']:![]);})[_0xe4d9('0x14')](function(_0x1166c9){_0x46d60b(_0x1166c9);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x56')]=function(_0x547792,_0x53975f,_0x383cd4){var _0xf41d89={'role':_0xe4d9('0x57')};_0xf41d89[_0x547792]=this[_0xe4d9('0x34')][_0xe4d9('0x39')];this[_0xe4d9('0xe')]['agentPause'](_0xf41d89,_0x53975f,this[_0xe4d9('0x34')]['uniqueid'])[_0xe4d9('0x12')](function(_0x3be5a4){_0x383cd4(null,_['isNil'](_0x3be5a4)?![]:!![]);})[_0xe4d9('0x14')](function(_0xc31086){logger['error'](_0xc31086);_0x383cd4(null,![]);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x58')]=function(_0x46d795,_0x175b14){var _0x3a7ff2={'role':_0xe4d9('0x57')};_0x3a7ff2[_0x46d795]=this['channel']['callerid'];this[_0xe4d9('0xe')]['agentUnpause'](_0x3a7ff2)[_0xe4d9('0x12')](function(_0x59f0c7){_0x175b14(null,_['isNil'](_0x59f0c7)?![]:!![]);})[_0xe4d9('0x14')](function(_0x17e6dd){logger[_0xe4d9('0x2a')](_0x17e6dd);_0x175b14(null,![]);});};AGIVertices['prototype'][_0xe4d9('0x59')]=function(_0x564269,_0xfa28c5){var _0x1b658b={'role':_0xe4d9('0x57')};_0x1b658b[_0x564269]=this[_0xe4d9('0x34')]['callerid'];this[_0xe4d9('0xe')][_0xe4d9('0x59')](_0x1b658b)[_0xe4d9('0x12')](function(_0x2d6a65){_0xfa28c5(null,_[_0xe4d9('0x43')](_0x2d6a65)?![]:!![]);})[_0xe4d9('0x14')](function(_0x1fa518){logger[_0xe4d9('0x2a')](_0x1fa518);_0xfa28c5(null,![]);});};AGIVertices[_0xe4d9('0x10')]['agentLogin']=function(_0x948f7e,_0x5c9eb0){var _0x8a066b={'role':_0xe4d9('0x57')};_0x8a066b[_0x948f7e]=this[_0xe4d9('0x34')][_0xe4d9('0x39')];var _0x48cc76=_0x948f7e!='internal'?util[_0xe4d9('0x27')](_0xe4d9('0x5a'),_0xe4d9('0x5b'),this[_0xe4d9('0x34')][_0xe4d9('0x39')]):undefined;this[_0xe4d9('0xe')][_0xe4d9('0x5c')](_0x8a066b,_0x48cc76)[_0xe4d9('0x12')](function(_0x2f0bc1){_0x5c9eb0(null,_['isNil'](_0x2f0bc1)?![]:!![]);})[_0xe4d9('0x14')](function(_0x11215a){logger['error'](_0x11215a);_0x5c9eb0(null,![]);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x5d')]=function(_0x1b5c79,_0x41630d){sh[_0xe4d9('0x5e')](_['trim'](_0x1b5c79),function(_0x276bf8,_0x46a498){var _0x498cb1=_0x46a498[_0xe4d9('0x5f')](/(\r\n|\n|\r)/gm,'');_0x41630d(null,_0x498cb1);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x60')]=function(_0xf3e107,_0xb647f1){scripts[_0xe4d9('0x60')](_0xf3e107['apiKey'],_0xf3e107[_0xe4d9('0x61')]||'text',_0xf3e107[_0xe4d9('0x62')],_0xf3e107[_0xe4d9('0x63')]||_0xe4d9('0x64'),_0xf3e107[_0xe4d9('0x65')]||'MALE',_0xf3e107[_0xe4d9('0x66')]||_0xe4d9('0x67'))['then'](function(_0x23bcfe){_0xb647f1(null,_0x23bcfe);})[_0xe4d9('0x14')](function(_0x4acc49){_0xb647f1(_0x4acc49);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x68')]=function(_0xd2a197,_0x332aa0){scripts[_0xe4d9('0x68')](_0xd2a197[_0xe4d9('0x62')],_0xd2a197[_0xe4d9('0x69')]||'en',0x1)[_0xe4d9('0x12')](function(_0x3e1fd4){_0x332aa0(null,_0x3e1fd4);})['catch'](function(_0xdfe0af){_0x332aa0(_0xdfe0af);});};AGIVertices['prototype'][_0xe4d9('0x6a')]=function(_0x5e8213,_0x183cef){var _0x1e8a81={'uri':_0x5e8213[_0xe4d9('0x6b')],'method':_0x5e8213[_0xe4d9('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5e8213[_0xe4d9('0x6d')])===_0xe4d9('0x6e')&&parseInt(_0x5e8213[_0xe4d9('0x6d')])>=0x1?parseInt(_0x5e8213[_0xe4d9('0x6d')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe4d9('0x6f'),_0xe4d9('0x70')],_0x1e8a81[_0xe4d9('0x6c')][_0xe4d9('0x71')]())){try{_0x1e8a81[_0xe4d9('0x72')]=_0x5e8213[_0xe4d9('0x73')]?JSON[_0xe4d9('0x74')](_0x5e8213[_0xe4d9('0x73')]):{};}catch(_0x208887){logger[_0xe4d9('0x2a')](_0xe4d9('0x75'),_0x208887);}}try{_0x1e8a81[_0xe4d9('0x76')]=_0x5e8213[_0xe4d9('0xa')]?JSON['parse'](_0x5e8213[_0xe4d9('0xa')]):{};}catch(_0x236477){logger['error'](_0xe4d9('0x77'),_0x236477);}if(_0x5e8213[_0xe4d9('0x78')]){try{var _0x56e180=require(_0x5e8213[_0xe4d9('0x78')])[_0xe4d9('0x79')](this,_0x1e8a81);_0x1e8a81[_0xe4d9('0x7a')]=Mustache[_0xe4d9('0x7b')](_0x5e8213[_0xe4d9('0x6b')],_0x56e180,{},['$$','$$']);if(_0x1e8a81[_0xe4d9('0x76')]){_0x1e8a81[_0xe4d9('0x76')]=JSON[_0xe4d9('0x74')](Mustache[_0xe4d9('0x7b')](JSON[_0xe4d9('0x7c')](_0x1e8a81[_0xe4d9('0x76')]),_0x56e180,{},['$$','$$']));}if(_0x1e8a81[_0xe4d9('0x72')]){_0x1e8a81[_0xe4d9('0x72')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x1e8a81[_0xe4d9('0x72')]),_0x56e180,{},['$$','$$']));}}catch(_0x259d75){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x259d75);}}rp(_0x1e8a81)[_0xe4d9('0x12')](function(_0x5346c4){var _0x456401={'statusCode':_0x5346c4['statusCode']||0xc8,'statusMessage':_0x5346c4[_0xe4d9('0x7d')]||'OK','headers':_0x5346c4[_0xe4d9('0x76')]||{},'body':_0x5346c4['body']||{}};_0x183cef(null,_0x456401);})[_0xe4d9('0x14')](function(_0x29ae02){var _0x46bd17={'statusCode':_0x29ae02['statusCode']||0x1f4,'statusMessage':_0x29ae02[_0xe4d9('0x7e')]||_0xe4d9('0x7f'),'headers':_0x29ae02[_0xe4d9('0x80')][_0xe4d9('0x76')]||{},'body':_0x29ae02[_0xe4d9('0x80')][_0xe4d9('0x72')]||{}};_0x183cef(null,_0x46bd17);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x81')]=function(_0x64ea28,_0x319c67){scripts[_0xe4d9('0x81')](this[_0xe4d9('0x34')][_0xe4d9('0x35')],_0x64ea28[_0xe4d9('0x82')],_0x64ea28[_0xe4d9('0x62')],_0x64ea28[_0xe4d9('0x83')]||'en')[_0xe4d9('0x12')](function(_0x35af23){_0x319c67(null,_0x35af23);})[_0xe4d9('0x14')](function(_0x2774fc){_0x319c67(_0x2774fc);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x84')]=function(_0x2a1a74,_0x2c2736){scripts['googleDialogflowV2'](this[_0xe4d9('0x34')][_0xe4d9('0x35')],_0x2a1a74[_0xe4d9('0x85')],_0x2a1a74[_0xe4d9('0x86')],_0x2a1a74[_0xe4d9('0x87')],_0x2a1a74['text'],_0x2a1a74[_0xe4d9('0x88')]||'en')['then'](function(_0x14e4f5){_0x2c2736(null,_0x14e4f5);})[_0xe4d9('0x14')](function(_0x3645f0){_0x2c2736(_0x3645f0);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x89')]=function(_0x5cf029,_0x140b92){scripts[_0xe4d9('0x89')](this[_0xe4d9('0x34')],_0x5cf029)[_0xe4d9('0x12')](function(_0x5a72ba){_0x140b92(null,_0x5a72ba);})['catch'](function(_0x5b59c2){_0x140b92(_0x5b59c2);});};AGIVertices[_0xe4d9('0x10')]['ispeechTTS']=function(_0xb5cc78,_0x35a316){scripts[_0xe4d9('0x8a')](_0xb5cc78[_0xe4d9('0x82')],_0xb5cc78[_0xe4d9('0x62')],_0xb5cc78[_0xe4d9('0x8b')]||_0xe4d9('0x64'),_0xb5cc78[_0xe4d9('0x8c')])[_0xe4d9('0x12')](function(_0x7ff4b7){_0x35a316(null,_0x7ff4b7);})[_0xe4d9('0x14')](function(_0x52a87d){_0x35a316(_0x52a87d);});};AGIVertices[_0xe4d9('0x10')]['ispeechASR']=function(_0x54b611,_0x5227b8,_0x217dac){scripts[_0xe4d9('0x8d')](_0x5227b8,_0x54b611[_0xe4d9('0x82')],_0x54b611[_0xe4d9('0x8e')]||_0xe4d9('0x64'),this[_0xe4d9('0x8f')](_0x54b611[_0xe4d9('0x90')])?_0x54b611['model']:undefined)[_0xe4d9('0x12')](function(_0x4436cf){_0x217dac(null,_0x4436cf);})[_0xe4d9('0x14')](function(_0x2f450e){_0x217dac(_0x2f450e);});};AGIVertices[_0xe4d9('0x10')]['awsPolly']=function(_0x3edaf5,_0x8c4f35){scripts['awsPolly'](_0x3edaf5[_0xe4d9('0x91')],_0x3edaf5[_0xe4d9('0x92')],_0x3edaf5[_0xe4d9('0x93')],_0x3edaf5[_0xe4d9('0x94')]||'Amy',_0x3edaf5[_0xe4d9('0x62')],_0x3edaf5['aws_text_type']||_0xe4d9('0x62'))[_0xe4d9('0x12')](function(_0x26f81e){_0x8c4f35(null,_0x26f81e);})[_0xe4d9('0x14')](function(_0x1f2123){_0x8c4f35(_0x1f2123);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x95')]=function(_0x5398ee,_0x5a3944){scripts[_0xe4d9('0x95')](this[_0xe4d9('0x34')][_0xe4d9('0x35')],_0x5398ee[_0xe4d9('0x91')],_0x5398ee['aws_secret_access_key'],_0x5398ee['aws_lex_region'],_0x5398ee['text'],_0x5398ee[_0xe4d9('0x96')])[_0xe4d9('0x12')](function(_0x2bba50){_0x5a3944(null,_0x2bba50);})[_0xe4d9('0x14')](function(_0x3b5bbc){_0x5a3944(_0x3b5bbc);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x97')]=function(_0x3d0dca,_0x57a98f,_0x1bb725){scripts[_0xe4d9('0x97')](_0x57a98f,_0x3d0dca['key'],_0x3d0dca['google_asr_language']||_0xe4d9('0x64'))[_0xe4d9('0x12')](function(_0x9642e6){_0x1bb725(null,_0x9642e6);})[_0xe4d9('0x14')](function(_0x5bf730){_0x1bb725(_0x5bf730);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x98')]=function(_0x544117,_0x2cf508,_0x504b29){scripts[_0xe4d9('0x98')](_0x2cf508,_0x544117['appid'],_0x544117[_0xe4d9('0x99')],_0x544117['uri'])[_0xe4d9('0x12')](function(_0x1b2036){_0x504b29(null,_0x1b2036);})[_0xe4d9('0x14')](function(_0x393384){_0x504b29(_0x393384);});};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x9a')]=function(_0x437b7b){var _0x19671a=_['includes'](verticesWithRetry,_0x437b7b[_0xe4d9('0x37')])?_0x437b7b:_['clone'](_0x437b7b);for(var _0x463c6b in _0x19671a){if(_0x19671a[_0xe4d9('0x9b')](_0x463c6b)){if(_0x19671a[_0x463c6b]&&_[_0xe4d9('0x9c')](_0x19671a[_0x463c6b])){if(_[_0xe4d9('0x9d')](recursiveMapAttributes,_0x463c6b)){_0x19671a[_0x463c6b]=this[_0xe4d9('0x9e')](_0x19671a[_0x463c6b]);}else{_0x19671a[_0x463c6b]=this[_0xe4d9('0x9f')](_0x19671a[_0x463c6b]);}}}}return _0x19671a;};AGIVertices['prototype'][_0xe4d9('0xa0')]=function(_0x2db5b1){for(var _0x11d7b9 in _0x2db5b1){if(_0x2db5b1[_0xe4d9('0x9b')](_0x11d7b9)){if(_[_0xe4d9('0xa1')](_0x2db5b1[_0x11d7b9])){this[_0xe4d9('0xa0')](_0x2db5b1[_0x11d7b9]);}else if(_[_0xe4d9('0xa2')](_0x2db5b1[_0x11d7b9])){for(var _0xdefef5=0x0;_0xdefef5<_0x2db5b1[_0x11d7b9][_0xe4d9('0xa3')];_0xdefef5++){this['recursiveNodeIndex'](_0x2db5b1[_0x11d7b9][_0xdefef5]);}}else if(_['isString'](_0x2db5b1[_0x11d7b9])){_0x2db5b1[_0x11d7b9]=this[_0xe4d9('0x9f')](_0x2db5b1[_0x11d7b9]);}}}};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xa4')]=function(_0x280160,_0x5a5446){for(var _0x21c2e9 in _0x280160){if(_0x280160['hasOwnProperty'](_0x21c2e9)){if(_[_0xe4d9('0xa1')](_0x280160[_0x21c2e9])){if(!_[_0xe4d9('0x42')](_0x280160[_0x21c2e9])){this['saveRestApiResult'](_0x280160[_0x21c2e9],util['format'](_0xe4d9('0xa5'),_0x5a5446,_0x21c2e9));}}else if(_[_0xe4d9('0xa2')](_0x280160[_0x21c2e9])){for(var _0x34d518=0x0;_0x34d518<_0x280160[_0x21c2e9][_0xe4d9('0xa3')];_0x34d518++){this[_0xe4d9('0xa4')](_0x280160[_0x21c2e9][_0x34d518],util[_0xe4d9('0x27')](_0xe4d9('0xa5'),_0x5a5446,_0x21c2e9+'['+_0x34d518+']'));}}else{if(!_[_0xe4d9('0x43')](_0x280160[_0x21c2e9])){this['channel'][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0xa5'),_0x5a5446,_0x21c2e9),_0x280160[_0x21c2e9]);}}}}};AGIVertices['prototype'][_0xe4d9('0x9e')]=function(_0x343371){try{var _0x5b8866=JSON[_0xe4d9('0x74')](_0x343371);this[_0xe4d9('0xa0')](_0x5b8866);return JSON[_0xe4d9('0x7c')](_0x5b8866);}catch(_0x43fe02){return this[_0xe4d9('0x9f')](_0x343371);}};AGIVertices['prototype'][_0xe4d9('0x9f')]=function(_0x53aa65){var _0x5b032b=_0x53aa65[_0xe4d9('0xa7')]('{');for(var _0x15bba8=0x1;_0x15bba8<_0x5b032b['length'];_0x15bba8+=0x1){var _0x4d902d=_0x5b032b[_0x15bba8][_0xe4d9('0xa7')]('}');if(_0x4d902d[_0xe4d9('0xa3')]>0x1){_0x53aa65=_0x53aa65[_0xe4d9('0xa8')]('{'+_0x4d902d[0x0]+'}',this[_0xe4d9('0x34')][_0xe4d9('0x11')](_0x4d902d[0x0])[_0xe4d9('0xa9')]||_0x4d902d[0x0]);}}if(_0x5b032b[_0xe4d9('0xa3')]===0x1){return _0x53aa65[_0xe4d9('0x4b')]();}return this[_0xe4d9('0x9f')](_0x53aa65);};AGIVertices['prototype'][_0xe4d9('0xaa')]=function(_0x4ca41d,_0x5439b6){var _0x3ab17e=this[_0xe4d9('0x34')]['getVariable'](_0x4ca41d);if(_0x3ab17e['result']===-0x1){return _0x3ab17e;}logger['info'](util[_0xe4d9('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5439b6,_0x3ab17e[_0xe4d9('0xa9')]));return this['channel'][_0xe4d9('0xa6')](_0x5439b6,_0x3ab17e[_0xe4d9('0xa9')]);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x8f')]=function(_0x486daa){return _0x486daa&&_0x486daa!=='0'&&_0x486daa!=='-1'&&_0x486daa!=='';};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xab')]=function(_0x1be6e7){this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x1be6e7,'-');_0x1be6e7['retry']=_0x1be6e7['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xac')]=function(_0xefcf63){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xad'),_0xefcf63['label']));if(!this[_0xe4d9('0x8f')](_0xefcf63['text'])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xaf'));}var _0x13d929='\x22'+_0xefcf63[_0xe4d9('0x62')]+'\x22';if(this[_0xe4d9('0x8f')](_0xefcf63['options'])){_0x13d929+=','+_0xefcf63[_0xe4d9('0x80')];}var _0x5e6efc=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0xb0'),_0x13d929);if(_0x5e6efc['result']===-0x1){return _0x5e6efc;}return this[_0xe4d9('0x34')]['noop'](util['format'](_0xe4d9('0xb1'),_0x13d929));};AGIVertices[_0xe4d9('0x10')]['mrcprecog']=function(_0x54aa80){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xb2'),_0x54aa80[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x54aa80[_0xe4d9('0xb3')])){return this[_0xe4d9('0x34')]['noop']('no\x20grammar\x20configured');}var _0x704678=_0x54aa80[_0xe4d9('0xb3')];if(this[_0xe4d9('0x8f')](_0x54aa80[_0xe4d9('0x80')])){_0x704678+=','+_0x54aa80['options'];}var _0x15ad99=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0xb4'),_0x704678);if(_0x15ad99[_0xe4d9('0xb5')]===-0x1){return _0x15ad99;}var _0x686a23=this[_0xe4d9('0xaa')](_0xe4d9('0xb6'),_0xe4d9('0xb7'));if(_0x686a23[_0xe4d9('0xb5')]===-0x1){return _0x686a23;}var _0x4f44f0=this[_0xe4d9('0xaa')](_0xe4d9('0xb8'),_0xe4d9('0xb9'));if(_0x4f44f0[_0xe4d9('0xb5')]===-0x1){return _0x4f44f0;}var _0x3f72f5=this[_0xe4d9('0xaa')](_0xe4d9('0xba'),_0xe4d9('0xbb'));if(_0x3f72f5[_0xe4d9('0xb5')]===-0x1){return _0x3f72f5;}return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xbc'),_0x704678));};AGIVertices['prototype'][_0xe4d9('0x5')]=function(_0x538db5){logger[_0xe4d9('0x2c')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x538db5['label']));return this[_0xe4d9('0x34')]['agi']([_0x538db5['command'],_0x538db5[_0xe4d9('0xbd')]]);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xbe')]=function(_0x4e0e73){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xbf'),_0x4e0e73['label']));if(this[_0xe4d9('0x8f')](_0x4e0e73[_0xe4d9('0x6d')])){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4e0e73[_0xe4d9('0x6d')]));var _0xa4f123=this['channel'][_0xe4d9('0xc0')](_0x4e0e73[_0xe4d9('0x6d')]);if(_0xa4f123[_0xe4d9('0xb5')]===-0x1){return _0xa4f123;}}return this[_0xe4d9('0x34')][_0xe4d9('0xbe')]();};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x49')]=function(_0xaed44f){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0xc1'),_0xaed44f[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0xaed44f[_0xe4d9('0x48')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0xaed44f,_0xe4d9('0xc2'));}_0xaed44f[_0xe4d9('0x4a')]=moment();if(this[_0xe4d9('0x8f')](_0xaed44f['delay'])){_0xaed44f[_0xe4d9('0x4a')]=moment()[_0xe4d9('0x51')](_0xaed44f['delay'],'minutes');}if(!this[_0xe4d9('0x8f')](_0xaed44f[_0xe4d9('0x4c')])){_0xaed44f[_0xe4d9('0x4c')]=0x2;}this['createCmContact'][_0xe4d9('0x79')](this,_0xaed44f);return this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0xc3'),_0xaed44f[_0xe4d9('0x47')],_0xaed44f[_0xe4d9('0x48')],_0xaed44f['scheduledAt']));};AGIVertices[_0xe4d9('0x10')]['custom_app']=function(_0x561d51){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x561d51[_0xe4d9('0x36')]));var _0x5a1ead=this[_0xe4d9('0x34')]['exec'](_0x561d51[_0xe4d9('0xc4')],_0x561d51[_0xe4d9('0x80')]);if(_0x5a1ead[_0xe4d9('0xb5')]===-0x1){return _0x5a1ead;}return this['channel'][_0xe4d9('0xae')](util['format'](_0xe4d9('0xc5'),_0x561d51[_0xe4d9('0xc4')],_0x561d51['options']));};AGIVertices[_0xe4d9('0x10')]['lumenvoxtts']=function(_0x3f5aec){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xc6'),_0x3f5aec[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x3f5aec[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xaf'));}var _0x339fe8='\x22'+_0x3f5aec[_0xe4d9('0x62')]+'\x22';if(this[_0xe4d9('0x8f')](_0x3f5aec[_0xe4d9('0x80')])){_0x339fe8+=','+_0x3f5aec['options'];}var _0x73cc58=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0xb0'),_0x339fe8);if(_0x73cc58[_0xe4d9('0xb5')]===-0x1){return _0x73cc58;}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0xb1'),_0x339fe8));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xc7')]=function(_0x4b9f8e){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xc8'),_0x4b9f8e[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x4b9f8e[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xaf'));}var _0x442980='\x22'+_0x4b9f8e[_0xe4d9('0x62')]+'\x22';if(this[_0xe4d9('0x8f')](_0x4b9f8e[_0xe4d9('0x80')])){_0x442980+=','+_0x4b9f8e[_0xe4d9('0x80')];}var _0x3fee53=this[_0xe4d9('0x34')][_0xe4d9('0x5e')]('MRCPSynth',_0x442980);if(_0x3fee53[_0xe4d9('0xb5')]===-0x1){return _0x3fee53;}return this['channel'][_0xe4d9('0xae')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x442980));};AGIVertices[_0xe4d9('0x10')]['lumenvoxasr']=function(_0x25d43f){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xc9'),_0x25d43f[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x25d43f[_0xe4d9('0xb3')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xca'));}var _0x5d8c9c=_0x25d43f['grammar'];if(this['isConfigured'](_0x25d43f[_0xe4d9('0x80')])){_0x5d8c9c+=','+_0x25d43f[_0xe4d9('0x80')];}var _0x57e3b8=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0xb4'),_0x5d8c9c);if(_0x57e3b8[_0xe4d9('0xb5')]===-0x1){return _0x57e3b8;}var _0x398aad=this[_0xe4d9('0xaa')](_0xe4d9('0xb6'),_0xe4d9('0xcb'));if(_0x398aad['result']===-0x1){return _0x398aad;}var _0x42abee=this[_0xe4d9('0xaa')](_0xe4d9('0xb8'),_0xe4d9('0xcc'));if(_0x42abee[_0xe4d9('0xb5')]===-0x1){return _0x42abee;}var _0x520aa0=this[_0xe4d9('0xaa')](_0xe4d9('0xba'),'LUMENVOX_ASR_INSTANCE');if(_0x520aa0[_0xe4d9('0xb5')]===-0x1){return _0x520aa0;}return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xbc'),_0x5d8c9c));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xcd')]=function(_0x2a919b){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xce'),_0x2a919b[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x2a919b[_0xe4d9('0xb3')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xca'));}var _0x251486=_0x2a919b[_0xe4d9('0xb3')];if(this[_0xe4d9('0x8f')](_0x2a919b[_0xe4d9('0x80')])){_0x251486+=','+_0x2a919b[_0xe4d9('0x80')];}var _0x290d7d=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0xb4'),_0x251486);if(_0x290d7d[_0xe4d9('0xb5')]===-0x1){return _0x290d7d;}var _0x40d149=this[_0xe4d9('0xaa')]('RECOG_CONFIDENCE()',_0xe4d9('0xcf'));if(_0x40d149[_0xe4d9('0xb5')]===-0x1){return _0x40d149;}var _0x13cd79=this[_0xe4d9('0xaa')](_0xe4d9('0xb8'),_0xe4d9('0xd0'));if(_0x13cd79[_0xe4d9('0xb5')]===-0x1){return _0x13cd79;}var _0x3da039=this['getAndSetVariable']('RECOG_INSTANCE()',_0xe4d9('0xd1'));if(_0x3da039['result']===-0x1){return _0x3da039;}return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xbc'),_0x251486));};AGIVertices['prototype']['database']=function(_0x341530){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x341530[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x341530[_0xe4d9('0xd2')])){return this['channel'][_0xe4d9('0x2a')](_0x341530,'no\x20database\x20selected');}var _0x277f57=this[_0xe4d9('0x17')][_0xe4d9('0x79')](this,_0x341530[_0xe4d9('0xd2')]);if(!_0x277f57){return this[_0xe4d9('0x34')]['error'](_0x341530,_0xe4d9('0xd3'));}if(!this['isConfigured'](_0x341530[_0xe4d9('0x2e')])){return this[_0xe4d9('0x34')]['error'](_0x341530,'no\x20query\x20configured');}var _0x3fee21=_0x341530['query'][_0xe4d9('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xd4'),_0x3fee21));var _0x32d306=this['getQueryOdbc'][_0xe4d9('0x79')](this,_0x277f57,_0x3fee21);this['createSquareDetailsReport'][_0xe4d9('0x79')](this,_0x341530,_0x3fee21);if(!this[_0xe4d9('0x8f')](_0x341530[_0xe4d9('0xd5')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xd6'));}var _0x1ff355=this['getVariable'][_0xe4d9('0x79')](this,_0x341530[_0xe4d9('0xd5')]);if(!_0x1ff355){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x341530,_0xe4d9('0xd7'));}var _0x288786=this;_0x32d306[_0xe4d9('0xd8')](function(_0xeac6f8,_0x48d57d){Object[_0xe4d9('0xd9')](_0xeac6f8)[_0xe4d9('0xd8')](function(_0x217c98){_0x288786[_0xe4d9('0x34')][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0xda'),_0x1ff355,_0x48d57d,_0x217c98),_0xeac6f8[_0x217c98]);});});this[_0xe4d9('0x34')][_0xe4d9('0xa6')](util['format'](_0xe4d9('0xdb'),_0x1ff355),_0x32d306['length']);return this['channel']['noop'](util[_0xe4d9('0x27')](_0xe4d9('0xdc'),_0x1ff355));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xdd')]=function(_0x2515ab){logger[_0xe4d9('0xde')](util[_0xe4d9('0x27')](_0xe4d9('0xdf'),_0x2515ab[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x2515ab['sip_id'])){return this['channel'][_0xe4d9('0x2a')](_0x2515ab,'no\x20user\x20selected');}var _0x3494df=this['getUser'][_0xe4d9('0x79')](this,_0x2515ab[_0xe4d9('0xe0')]);if(!_0x3494df){return this['channel']['error'](_0x2515ab,'no\x20user\x20found');}var _0x5b8385=this[_0xe4d9('0x34')]['exec'](_0xe4d9('0xe1'),[util[_0xe4d9('0x27')]('SIP/%s',_0x3494df),_0x2515ab[_0xe4d9('0x6d')],_0x2515ab[_0xe4d9('0xe2')],_0x2515ab['url']]);if(_0x5b8385['result']===-0x1){return _0x5b8385;}return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xe3'),_0xe4d9('0xe1')));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xe4')]=function(_0x36ab9e){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xe5'),_0x36ab9e['label']));if(!this[_0xe4d9('0x8f')](_0x36ab9e['key'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xe6'));}if(!this[_0xe4d9('0x8f')](_0x36ab9e[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xaf'));}this[_0xe4d9('0x34')][_0xe4d9('0xe7')]=!![];this['createSquareDetailsReport'](_0x36ab9e);this[_0xe4d9('0xe8')](_0x36ab9e[_0xe4d9('0x62')],'in','','');this['channel']['noop'](util['format'](_0xe4d9('0xe9'),_0x36ab9e[_0xe4d9('0x62')]));var _0x53c337=this[_0xe4d9('0x81')][_0xe4d9('0x79')](this,_0x36ab9e);if(_0x53c337){for(var _0x9e75fd in _0x53c337){if(_0x53c337[_0xe4d9('0x9b')](_0x9e75fd)){this[_0xe4d9('0x34')][_0xe4d9('0xa6')](util[_0xe4d9('0x27')]('DIALOGFLOW_%s',_0x9e75fd[_0xe4d9('0x71')]()),_0x53c337[_0x9e75fd]);}}this[_0xe4d9('0xe8')](_0x53c337[_0xe4d9('0xea')],'out','dialogflow','');return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xeb'),_0x53c337[_0xe4d9('0xea')]));}return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x36ab9e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xe4d9('0x10')]['dialogflowV2']=function(_0x2c7c2a){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2c7c2a[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x2c7c2a[_0xe4d9('0x85')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xec'));}if(!this['isConfigured'](_0x2c7c2a['client_email'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xed'));}if(!this[_0xe4d9('0x8f')](_0x2c7c2a[_0xe4d9('0x87')])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xee'));}if(!this[_0xe4d9('0x8f')](_0x2c7c2a[_0xe4d9('0x88')])){return this['channel']['noop']('no\x20anguage\x20configured');}if(!this[_0xe4d9('0x8f')](_0x2c7c2a['text'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xaf'));}this[_0xe4d9('0x34')]['bot']=!![];this['createSquareDetailsReport'](_0x2c7c2a);this[_0xe4d9('0xe8')](_0x2c7c2a[_0xe4d9('0x62')],'in','','');this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0xef'),_0x2c7c2a[_0xe4d9('0x62')]));var _0x2271f7=this[_0xe4d9('0x84')][_0xe4d9('0x79')](this,_0x2c7c2a);if(_0x2271f7){for(var _0xbc8304 in _0x2271f7){if(_0x2271f7[_0xe4d9('0x9b')](_0xbc8304)){if(_0xbc8304!==_0xe4d9('0xf0')){this[_0xe4d9('0x34')][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0xf1'),_0xbc8304[_0xe4d9('0x71')]()),_0x2271f7[_0xbc8304]);}}}this[_0xe4d9('0xe8')](_0x2271f7['speech'],_0xe4d9('0xf2'),'dialogflowV2',_0x2271f7[_0xe4d9('0xf0')]);return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xf3'),_0x2271f7[_0xe4d9('0xea')]));}return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x2c7c2a,_0xe4d9('0xf4'));};AGIVertices['prototype'][_0xe4d9('0xf5')]=function(_0x582aba){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0xf6'),_0x582aba[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x582aba[_0xe4d9('0xf7')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xf8'));}if(!this[_0xe4d9('0x8f')](_0x582aba[_0xe4d9('0xf9')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xfa'));}if(!this[_0xe4d9('0x8f')](_0x582aba[_0xe4d9('0xfb')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')]('no\x20password\x20configured');}if(!this[_0xe4d9('0x8f')](_0x582aba['ndassistant_url'])){return this[_0xe4d9('0x34')]['noop']('no\x20text\x20configured');}this[_0xe4d9('0x34')]['bot']=!![];this[_0xe4d9('0x33')](_0x582aba);this[_0xe4d9('0xe8')](_0x582aba[_0xe4d9('0x62')],'in','','');this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xfc'),_0x582aba[_0xe4d9('0x62')]));var _0x58e7d9=this[_0xe4d9('0x89')]['sync'](this,_0x582aba);if(_0x58e7d9){for(var _0x3ba744 in _0x58e7d9){if(_0x58e7d9[_0xe4d9('0x9b')](_0x3ba744)){this[_0xe4d9('0x34')][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0xfd'),_0x3ba744[_0xe4d9('0x71')]()),_0x58e7d9[_0x3ba744]);}}this[_0xe4d9('0xe8')](_0x58e7d9[_0xe4d9('0xea')],_0xe4d9('0xf2'),_0xe4d9('0xf5'),'');if(_0x58e7d9[_0xe4d9('0xfe')]){this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xff'),_0x58e7d9[_0xe4d9('0xfe')]));var _0x23f862=this[_0xe4d9('0x34')]['streamFile'](_0x58e7d9[_0xe4d9('0xfe')]);try{fs[_0xe4d9('0x100')](_0x58e7d9['audiofile']+'.wav');}catch(_0x3d9447){logger[_0xe4d9('0x2a')](_0x3d9447);}return _0x23f862;}else{return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x101'),_0x58e7d9[_0xe4d9('0xea')]));}}return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x582aba,_0xe4d9('0x102'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x103')]=function(_0x1a2411){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x104'),_0x1a2411[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')]['noop']('end');};AGIVertices['prototype'][_0xe4d9('0x105')]=function(_0x3c35b2){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x106'),_0x3c35b2['label']));var _0x101553='';if(_0x3c35b2['trunk_id']){if(!this[_0xe4d9('0x8f')](_0x3c35b2[_0xe4d9('0x107')])){return this['channel'][_0xe4d9('0x2a')](_0x3c35b2,_0xe4d9('0x108'));}else{var _0x371ce4=parseInt(_0x3c35b2[_0xe4d9('0x107')],0xa);if(isNaN(_0x371ce4)){_0x101553=_0x3c35b2[_0xe4d9('0x107')];}else{_0x101553=this['getTrunk'][_0xe4d9('0x79')](this,_0x3c35b2['trunk_id']);if(!_0x101553){return this['channel'][_0xe4d9('0x2a')](_0x3c35b2,_0xe4d9('0x109'));}}}}else if(_0x3c35b2[_0xe4d9('0x10a')]){_0x101553=_0x3c35b2[_0xe4d9('0x10a')];}else{return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x3c35b2,_0xe4d9('0x108'));}var _0x4e5c77=this['channel']['exec']('DIAL',[util[_0xe4d9('0x27')]('SIP/%s/%s',_0x101553,_0x3c35b2['phone']),_0x3c35b2[_0xe4d9('0x6d')],_0x3c35b2[_0xe4d9('0xe2')],_0x3c35b2[_0xe4d9('0x6b')]]);if(_0x4e5c77['result']===-0x1){return _0x4e5c77;}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xe3'),_0xe4d9('0xe1')));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x10b')]=function(_0x1d5771){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x10c'),_0x1d5771[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x10b'));};AGIVertices['prototype'][_0xe4d9('0xc')]=function(_0x3aa889){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x10d'),_0x3aa889[_0xe4d9('0x36')]));if(_0x3aa889[_0xe4d9('0x10e')]===0x0){return this['maxRetry'](_0x3aa889);}_0x3aa889[_0xe4d9('0x10e')]-=0x1;if(!this[_0xe4d9('0x8f')](_0x3aa889[_0xe4d9('0x10f')])){return this[_0xe4d9('0x34')]['error'](_0x3aa889,_0xe4d9('0x110'));}var _0x491e98=this['getSound'][_0xe4d9('0x79')](this,_0x3aa889[_0xe4d9('0x10f')]);if(!_0x491e98){return this['channel'][_0xe4d9('0x2a')](_0x3aa889,_0xe4d9('0x111'));}if(!this['isConfigured'](_0x3aa889[_0xe4d9('0xd5')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x418bc2=this[_0xe4d9('0x34')][_0xe4d9('0x112')](_0x491e98,_0x3aa889[_0xe4d9('0x113')],_0x3aa889[_0xe4d9('0x114')]);var _0x5e0830=_0x418bc2[_0xe4d9('0xb5')]?_0x418bc2['result'][_0xe4d9('0x4b')]():'';logger[_0xe4d9('0x2c')](_0xe4d9('0x115'),JSON['stringify'](_0x418bc2));if(_0x418bc2[_0xe4d9('0xb5')]===-0x1){this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x3aa889,_0x5e0830);return _0x418bc2;}else if(_0x418bc2['extra']===_0xe4d9('0x6d')){_0x418bc2[_0xe4d9('0xb5')]=_0x5e0830[_0xe4d9('0xa3')]>=parseInt(_0x3aa889[_0xe4d9('0x116')])?'x':'i';}else{_0x418bc2[_0xe4d9('0xb5')]=_0x5e0830[_0xe4d9('0xa3')]>=parseInt(_0x3aa889[_0xe4d9('0x116')])&&_0x5e0830[_0xe4d9('0xa3')]<=parseInt(_0x3aa889[_0xe4d9('0x114')])?'x':'i';}var _0x679bac=this['getVariable'][_0xe4d9('0x79')](this,_0x3aa889[_0xe4d9('0xd5')]);if(!_0x679bac){return this['channel'][_0xe4d9('0x2a')](_0x3aa889,'no\x20variable\x20found');}this[_0xe4d9('0x34')][_0xe4d9('0xa6')](_0x679bac,_0x5e0830);if(this['isConfigured'](_0x3aa889[_0xe4d9('0x117')])){var _0x37d24f=parseInt(_0x3aa889['hiddendigitsnum'],0xa);var _0x226d54=rs[_0xe4d9('0x118')]({'charset':'*','length':_0x37d24f});var _0x362d86=_0x5e0830[_0xe4d9('0xa3')];if(_0x362d86>0x0){if(_0x362d86>_0x37d24f){this['createSquareDetailsReport'][_0xe4d9('0x79')](this,_0x3aa889,_0x3aa889['hiddendigitspos']===_0xe4d9('0x119')?_0x226d54+_0x5e0830['substr'](_0x37d24f):_0x5e0830[_0xe4d9('0x11a')](0x0,_0x362d86-_0x37d24f)+_0x226d54);}else{this['createSquareDetailsReport']['sync'](this,_0x3aa889,rs['generate']({'charset':'*','length':_0x362d86}));}}else{this['createSquareDetailsReport'][_0xe4d9('0x79')](this,_0x3aa889,'');}}else{this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x3aa889,_0x5e0830);}return _0x418bc2;};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xd')]=function(_0x3c2ad3){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3c2ad3[_0xe4d9('0x36')]));return this['getdigits'](_0x3c2ad3);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x11b')]=function(_0x28b6c9){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x11c'),_0x28b6c9[_0xe4d9('0x36')]));this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x28b6c9,_0x28b6c9[_0xe4d9('0x11d')]);return this['channel'][_0xe4d9('0xae')](util['format']('GOAL\x20%s',_0x28b6c9[_0xe4d9('0x11d')]));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x11e')]=function(_0x7b240e){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x11f'),_0x7b240e[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x7b240e['aws_access_key_id'])||!this[_0xe4d9('0x8f')](_0x7b240e[_0xe4d9('0x92')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0x120'));}if(!this[_0xe4d9('0x8f')](_0x7b240e[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')]['noop']('no\x20text\x20configured');}this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x121'),_0x7b240e[_0xe4d9('0x62')]));var _0x4d3cd8=this[_0xe4d9('0x122')][_0xe4d9('0x79')](this,_0x7b240e);if(_0x4d3cd8){this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x123'),_0x4d3cd8));var _0x3c1184=this[_0xe4d9('0x34')]['streamFile'](_0x4d3cd8);try{fs[_0xe4d9('0x100')](_0x4d3cd8+_0xe4d9('0x124'));}catch(_0x182b98){logger['error'](_0x182b98);}return _0x3c1184;}return this[_0xe4d9('0x34')]['error'](_0x7b240e,_0xe4d9('0x125'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x126')]=function(_0x2fc262){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2fc262['label']));if(!this[_0xe4d9('0x8f')](_0x2fc262[_0xe4d9('0x91')])||!this[_0xe4d9('0x8f')](_0x2fc262[_0xe4d9('0x92')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0x120'));}if(!this[_0xe4d9('0x8f')](_0x2fc262['aws_bot_name'])){return this[_0xe4d9('0x34')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0xe4d9('0x8f')](_0x2fc262[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xaf'));}this[_0xe4d9('0x34')][_0xe4d9('0xe7')]=!![];this[_0xe4d9('0x33')](_0x2fc262);this[_0xe4d9('0xe8')](_0x2fc262[_0xe4d9('0x62')],'in','','');this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x127'),_0x2fc262[_0xe4d9('0x62')]));var _0x45d3ae=this['awsLex'][_0xe4d9('0x79')](this,_0x2fc262);if(_0x45d3ae){for(var _0x3cc4b9 in _0x45d3ae){if(_0x45d3ae[_0xe4d9('0x9b')](_0x3cc4b9)&&_['isString'](_0x45d3ae[_0x3cc4b9])){this[_0xe4d9('0x34')]['setVariable'](util[_0xe4d9('0x27')]('AWS_LEX_%s',_0x3cc4b9['toUpperCase']()),_0x45d3ae[_0x3cc4b9]);}}if(_[_0xe4d9('0x43')](_0x45d3ae[_0xe4d9('0x7e')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xe4d9('0xe8')](_0x45d3ae[_0xe4d9('0x7e')],'out','amazonlex','');return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x128'),_0x45d3ae[_0xe4d9('0x7e')]));}}return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x2fc262,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x129')]=function(_0x1f8a9b){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1f8a9b[_0xe4d9('0x36')],_0x1f8a9b['timeout']));if(!this[_0xe4d9('0x8f')](_0x1f8a9b['key'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xe6'));}var _0x859e28=_0xe4d9('0x12a');var _0x3459b7=util['format'](_0xe4d9('0x12b'),FILES_PATH,rs[_0xe4d9('0x118')](0x4));var _0x57004e=util[_0xe4d9('0x27')](_0xe4d9('0xa5'),_0x3459b7,_0x859e28);var _0x44aaa4=!![];if(_0x1f8a9b[_0xe4d9('0x12c')]==='NOBEEP'){_0x44aaa4=![];}var _0x12e1c6=this[_0xe4d9('0x34')]['recordFile'](_0x3459b7,_0x859e28,_0x1f8a9b[_0xe4d9('0x12d')],_0x1f8a9b['timeout'],undefined,_0x44aaa4);if(_0x12e1c6['result']!==-0x1){this['channel']['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x12e'),_0x57004e));var _0x4ff023=this[_0xe4d9('0x97')]['sync'](this,_0x1f8a9b,_0x57004e);if(_0x4ff023){for(var _0x499b36 in _0x4ff023){if(_0x4ff023[_0xe4d9('0x9b')](_0x499b36)){this[_0xe4d9('0x34')]['setVariable'](util[_0xe4d9('0x27')](_0xe4d9('0x12f'),_0x499b36[_0xe4d9('0x71')]()),_0x4ff023[_0x499b36]);}}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0x130'),JSON[_0xe4d9('0x7c')](_0x4ff023)));}}return _0x12e1c6;};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x131')]=function(_0x9a265a){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x132'),_0x9a265a[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x9a265a['appid'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x133'));}if(!this[_0xe4d9('0x8f')](_0x9a265a[_0xe4d9('0x99')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')]('no\x20appsecret\x20configured');}var _0x2c5a77=_0xe4d9('0x12a');var _0x23cf8d=util[_0xe4d9('0x27')](_0xe4d9('0x12b'),FILES_PATH,rs[_0xe4d9('0x118')](0x4));var _0x6481ae=util[_0xe4d9('0x27')](_0xe4d9('0xa5'),_0x23cf8d,_0x2c5a77);var _0x1c4f06=!![];if(_0x9a265a[_0xe4d9('0x12c')]===_0xe4d9('0x134')){_0x1c4f06=![];}var _0x10224b=this[_0xe4d9('0x34')][_0xe4d9('0x135')](_0x23cf8d,_0x2c5a77,_0x9a265a[_0xe4d9('0x12d')],_0x9a265a[_0xe4d9('0x6d')],undefined,_0x1c4f06);if(_0x10224b[_0xe4d9('0xb5')]!==-0x1){this['channel'][_0xe4d9('0xae')](util['format'](_0xe4d9('0x136'),_0x6481ae));var _0x501e36=this[_0xe4d9('0x98')]['sync'](this,_0x9a265a,_0x6481ae);if(_0x501e36){for(var _0x336afc in _0x501e36){if(_0x501e36['hasOwnProperty'](_0x336afc)){this[_0xe4d9('0x34')][_0xe4d9('0xa6')](util[_0xe4d9('0x27')]('TILDE_ASR_%s',_0x336afc[_0xe4d9('0x71')]()),_0x501e36[_0x336afc]);}}return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('TildeASR\x20Result\x20%s',JSON[_0xe4d9('0x7c')](_0x501e36)));}}return _0x10224b;};AGIVertices[_0xe4d9('0x10')]['gotoc']=function(_0x52909b){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x137'),_0x52909b[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')]['continueAt'](_0x52909b[_0xe4d9('0x138')],_0x52909b[_0xe4d9('0x3c')],_0x52909b[_0xe4d9('0x3d')]);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x139')]=function(_0x2a649f){logger[_0xe4d9('0x2c')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a649f['label']));if(!this[_0xe4d9('0x8f')](_0x2a649f[_0xe4d9('0x13a')])){return this[_0xe4d9('0x34')]['error'](_0x2a649f,_0xe4d9('0x13b'));}try{var _0x28aad8=eval(_0x2a649f['condition'])?_0xe4d9('0x13c'):'false';this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x13d'),_0x2a649f['condition'],_0x28aad8));return{'code':0xc8,'result':_0x28aad8};}catch(_0x5b18c7){return{'code':0xc8,'result':_0xe4d9('0x13e')};}};AGIVertices[_0xe4d9('0x10')]['gotoiftime']=function(_0x59f48e){logger[_0xe4d9('0x2c')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x59f48e[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x59f48e[_0xe4d9('0x13f')])){return this['channel'][_0xe4d9('0x2a')](_0x59f48e,_0xe4d9('0x140'));}var _0x269125=this['getIntervals']['sync'](this,_0x59f48e['interval_id']);if(!_0x269125){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x59f48e,_0xe4d9('0x141'));}for(var _0x17ed69=0x0;_0x17ed69<_0x269125['length'];_0x17ed69+=0x1){var _0x3dd6ec=this[_0xe4d9('0x34')][_0xe4d9('0x11')](util['format'](_0xe4d9('0x142'),_0x269125[_0x17ed69]));if(_0x3dd6ec[_0xe4d9('0xb5')]===-0x1){return _0x3dd6ec;}logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x143'),_0x269125[_0x17ed69],_0x3dd6ec[_0xe4d9('0xa9')]));if(_0x3dd6ec['extra']===_0xe4d9('0x13c')){logger[_0xe4d9('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x269125[_0x17ed69],_0xe4d9('0x13c')));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('IFTIME\x20%s\x20%s',_0x269125[_0x17ed69],'true'));return{'code':0xc8,'result':_0xe4d9('0x13c')};}else{logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('IFTIME\x20%s\x20%s',_0x269125[_0x17ed69],'false'));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x143'),_0x269125[_0x17ed69],_0xe4d9('0x13e')));}}return{'code':0xc8,'result':_0xe4d9('0x13e')};};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x144')]=function(_0x1f7152){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x145'),_0x1f7152[_0xe4d9('0x36')]));return this['channel'][_0xe4d9('0x144')]();};AGIVertices['prototype'][_0xe4d9('0x146')]=function(_0x724616){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x147'),_0x724616[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x724616[_0xe4d9('0x82')])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xe6'));}var _0x2602d8=_0xe4d9('0x12a');var _0x17d4c1=util[_0xe4d9('0x27')](_0xe4d9('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x587c3a=util[_0xe4d9('0x27')]('%s.%s',_0x17d4c1,_0x2602d8);var _0x295183=!![];if(_0x724616['beep']===_0xe4d9('0x134')){_0x295183=![];}var _0x436481=this['channel'][_0xe4d9('0x135')](_0x17d4c1,_0x2602d8,_0x724616[_0xe4d9('0x12d')],_0x724616[_0xe4d9('0x6d')],undefined,_0x295183);if(_0x436481['result']!==-0x1){this['channel'][_0xe4d9('0xae')](util['format'](_0xe4d9('0x148'),_0x587c3a));var _0x57fec8=this[_0xe4d9('0x8d')][_0xe4d9('0x79')](this,_0x724616,_0x587c3a);if(_0x57fec8){for(var _0x9ec5a in _0x57fec8){if(_0x57fec8['hasOwnProperty'](_0x9ec5a)){this['channel'][_0xe4d9('0xa6')](util['format'](_0xe4d9('0x149'),_0x9ec5a[_0xe4d9('0x71')]()),_0x57fec8[_0x9ec5a]);}}return this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x14a'),JSON[_0xe4d9('0x7c')](_0x57fec8)));}}return _0x436481;};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x14b')]=function(_0x475397){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x14c'),_0x475397[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x475397['key'])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xe6'));}if(!this['isConfigured'](_0x475397[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0xaf'));}this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x14d'),_0x475397[_0xe4d9('0x62')]));var _0x1b5e4a=this['ispeechTTS'][_0xe4d9('0x79')](this,_0x475397);if(_0x1b5e4a){this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x148'),_0x1b5e4a));var _0x31ff6d=this[_0xe4d9('0x34')][_0xe4d9('0x14e')](_0x1b5e4a,_0x475397['intKey']);try{fs[_0xe4d9('0x100')](_0x1b5e4a+_0xe4d9('0x124'));}catch(_0x141a18){logger['error'](_0x141a18);}return _0x31ff6d;}return this['channel'][_0xe4d9('0x2a')](_0x475397,_0xe4d9('0x14f'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x150')]=function(_0x532e1c){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x151'),_0x532e1c[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x532e1c[_0xe4d9('0x152')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x532e1c,_0xe4d9('0x153'));}logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe4d9('0x34')]['callerid'],_0x532e1c['findBy']));var _0x3aa482=this[_0xe4d9('0x5c')]['sync'](this,_0x532e1c[_0xe4d9('0x152')]);if(_0x3aa482){logger['info'](util[_0xe4d9('0x27')](_0xe4d9('0x154'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x532e1c[_0xe4d9('0x152')]));this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x532e1c[_0xe4d9('0x152')]));return{'code':0xc8,'result':_0xe4d9('0x155')};}else{logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe4d9('0x34')]['callerid'],_0x532e1c['findBy']));this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x156'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x532e1c[_0xe4d9('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x157')]=function(_0x4544b5){logger[_0xe4d9('0x2c')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x4544b5[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x4544b5[_0xe4d9('0x152')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x4544b5,'no\x20find\x20by\x20configured');}logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x158'),this['channel'][_0xe4d9('0x39')],_0x4544b5[_0xe4d9('0x152')]));var _0x543b8c=this[_0xe4d9('0x59')][_0xe4d9('0x79')](this,_0x4544b5['findBy']);if(_0x543b8c){logger['info'](util['format'](_0xe4d9('0x154'),this['channel'][_0xe4d9('0x39')],_0x4544b5[_0xe4d9('0x152')]));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0x154'),this['channel'][_0xe4d9('0x39')],_0x4544b5[_0xe4d9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x156'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x4544b5[_0xe4d9('0x152')]));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x156'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x4544b5[_0xe4d9('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe4d9('0x10')]['math']=function(_0x37a9c5){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x37a9c5[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x37a9c5[_0xe4d9('0x159')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x37a9c5,_0xe4d9('0x15a'));}this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x15b'),_0x37a9c5[_0xe4d9('0x159')]));var _0x251632=eval(_0x37a9c5[_0xe4d9('0x159')]);if(!this['isConfigured'](_0x37a9c5[_0xe4d9('0xd5')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0xd6'));}var _0x241fb4=this[_0xe4d9('0x11')][_0xe4d9('0x79')](this,_0x37a9c5[_0xe4d9('0xd5')]);if(!_0x241fb4){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x37a9c5,_0xe4d9('0xd7'));}if(_[_0xe4d9('0xa2')](_0x251632)){var _0x44b52b=this;_0x251632[_0xe4d9('0xd8')](function(_0x148fd4,_0x3dacea){_0x44b52b[_0xe4d9('0x34')]['setVariable'](util['format']('%s[%s]',_0x241fb4,_0x3dacea),_0x148fd4);});return this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('variable\x20%s[key]\x20set',_0x241fb4));}else{return this[_0xe4d9('0x34')][_0xe4d9('0xa6')](_0x241fb4,_0x251632);}};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0xb')]=function(_0x261e60){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x15c'),_0x261e60[_0xe4d9('0x36')]));if(_0x261e60[_0xe4d9('0x10e')]===0x0){return this['maxRetry'](_0x261e60);}_0x261e60[_0xe4d9('0x10e')]-=0x1;if(!this[_0xe4d9('0x8f')](_0x261e60[_0xe4d9('0x10f')])){return this[_0xe4d9('0x34')]['error'](_0x261e60,'no\x20file\x20audio\x20selected');}var _0x5dd5c0=this[_0xe4d9('0x15d')][_0xe4d9('0x79')](this,_0x261e60['file_id']);if(!_0x5dd5c0){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x261e60,'no\x20file\x20audio\x20found');}var _0x1e01d8=this[_0xe4d9('0x34')][_0xe4d9('0x112')](_0x5dd5c0,_0x261e60['response'],_0x261e60[_0xe4d9('0x15e')]);var _0x2bca23=_0x1e01d8[_0xe4d9('0xb5')];if(_0x1e01d8[_0xe4d9('0xb5')]===-0x1){this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x261e60,'-1');return _0x1e01d8;}else if(_0x1e01d8[_0xe4d9('0xa9')]===_0xe4d9('0x6d')){_0x1e01d8[_0xe4d9('0xb5')]=_0x1e01d8[_0xe4d9('0xb5')][_0xe4d9('0xa3')]>0x0?_0x1e01d8[_0xe4d9('0xb5')]:'t';}else if(_[_0xe4d9('0x42')](_0x1e01d8[_0xe4d9('0xb5')])){_0x1e01d8[_0xe4d9('0xb5')]='#';_0x2bca23='#';}if(!this[_0xe4d9('0x8f')](_0x261e60[_0xe4d9('0xd5')])){this[_0xe4d9('0x34')][_0xe4d9('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5cd0a6=this[_0xe4d9('0x11')][_0xe4d9('0x79')](this,_0x261e60[_0xe4d9('0xd5')]);if(!_0x5cd0a6){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x261e60,_0xe4d9('0xd7'));}this[_0xe4d9('0x34')][_0xe4d9('0xa6')](_0x5cd0a6,_0x2bca23);}this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x261e60,_0x2bca23);return _0x1e01d8;};AGIVertices[_0xe4d9('0x10')]['noop']=function(_0x4cd9c0){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x15f'),_0x4cd9c0[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0x4cd9c0[_0xe4d9('0x160')]||_0x4cd9c0[_0xe4d9('0x36')]);};AGIVertices['prototype'][_0xe4d9('0x161')]=function(_0x55f27d){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x162'),_0x55f27d[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x55f27d[_0xe4d9('0x152')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x55f27d,_0xe4d9('0x153'));}logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x158'),this['channel']['callerid'],_0x55f27d[_0xe4d9('0x152')]));var _0x5f1ed5=this[_0xe4d9('0x163')]['sync'](this,_0x55f27d['pause_id']);var _0x59b0cb=this[_0xe4d9('0x56')][_0xe4d9('0x79')](this,_0x55f27d[_0xe4d9('0x152')],_0x5f1ed5);if(_0x59b0cb){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x154'),this['channel'][_0xe4d9('0x39')],_0x55f27d['findBy']));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x154'),this[_0xe4d9('0x34')]['callerid'],_0x55f27d['findBy']));return{'code':0xc8,'result':_0xe4d9('0x155')};}else{logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x156'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x55f27d[_0xe4d9('0x152')]));this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x154'),this[_0xe4d9('0x34')]['callerid'],_0x55f27d[_0xe4d9('0x152')]));return{'code':0xc8,'result':_0xe4d9('0x164')};}};AGIVertices[_0xe4d9('0x10')]['playback']=function(_0x3ce4fa){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x165'),_0x3ce4fa[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x3ce4fa[_0xe4d9('0x10f')])){return this[_0xe4d9('0x34')]['error'](_0x3ce4fa,_0xe4d9('0x110'));}var _0x1e3cef=this[_0xe4d9('0x15d')][_0xe4d9('0x79')](this,_0x3ce4fa[_0xe4d9('0x10f')]);if(!_0x1e3cef){return this[_0xe4d9('0x34')]['error'](_0x3ce4fa,_0xe4d9('0x111'));}var _0x5e638a=this[_0xe4d9('0x34')]['exec'](_0xe4d9('0x166'),[_0x1e3cef,_0x3ce4fa[_0xe4d9('0xe2')]]);if(_0x5e638a[_0xe4d9('0xb5')]===-0x1){return _0x5e638a;}return this['channel']['noop'](util[_0xe4d9('0x27')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x1e3cef));};AGIVertices['prototype']['queue']=function(_0x10029d){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x167'),_0x10029d[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x10029d['queue_id'])){return this[_0xe4d9('0x34')]['error'](_0x10029d,_0xe4d9('0x168'));}var _0x5ac903='';var _0x36d4fe=parseInt(_0x10029d[_0xe4d9('0x169')],0xa);if(isNaN(_0x36d4fe)){_0x5ac903=_0x10029d['queue_id'];}else{_0x5ac903=this[_0xe4d9('0x16a')][_0xe4d9('0x79')](this,_0x10029d[_0xe4d9('0x169')]);if(!_0x5ac903){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x10029d,_0xe4d9('0x16b'));}}var _0x2fad42='';if(this[_0xe4d9('0x8f')](_0x10029d[_0xe4d9('0x10f')])){var _0x52bb22=this['getSound'][_0xe4d9('0x79')](this,_0x10029d[_0xe4d9('0x10f')]);if(_0x52bb22){_0x2fad42=_0x52bb22;}}this[_0xe4d9('0x33')]['sync'](this,_0x10029d,_0x5ac903);if(_0x10029d[_0xe4d9('0xe2')][_0xe4d9('0x16c')]('x')<0x0){_0x10029d['opts']+='x';}if(_0x10029d[_0xe4d9('0xe2')][_0xe4d9('0x16c')]('X')<0x0){_0x10029d['opts']+='X';}this[_0xe4d9('0x34')]['setVariable'](_0xe4d9('0x16d'),_0x5ac903?_0x5ac903['toLowerCase']():'');var _0x27189a=this[_0xe4d9('0x34')][_0xe4d9('0x5e')](_0xe4d9('0x16e'),[_0x5ac903,_0x10029d[_0xe4d9('0xe2')],_0x10029d[_0xe4d9('0x6b')],_0x2fad42,_0x10029d['timeout'],_0x10029d[_0xe4d9('0x5')],_0x10029d[_0xe4d9('0x16f')],_0x10029d[_0xe4d9('0x170')],'',_0x10029d[_0xe4d9('0x171')]]);if(_0x27189a[_0xe4d9('0xb5')]===-0x1){return _0x27189a;}return this['channel']['noop'](util['format'](_0xe4d9('0xc5'),_0xe4d9('0x16e'),_0x5ac903));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x172')]=function(_0x380f61){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x173'),_0x380f61[_0xe4d9('0x36')]));var _0x36b4a1=_0x380f61['recordingFormat']||_0xe4d9('0x12a');var _0x2d536c=util[_0xe4d9('0x27')](_0xe4d9('0x174'),this[_0xe4d9('0x34')][_0xe4d9('0x35')],rs[_0xe4d9('0x118')](0x5));var _0x4e30f7=util[_0xe4d9('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0x2d536c,_0x36b4a1);var _0x585d1e=util[_0xe4d9('0x27')](_0xe4d9('0x12b'),FILES_PATH,_0x2d536c);this[_0xe4d9('0x3a')][_0xe4d9('0x79')](this,_0x380f61,_0x2d536c,_0x4e30f7);this[_0xe4d9('0x34')][_0xe4d9('0xa6')]('RECORDING_SAVENAME',_0x2d536c);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x585d1e,_0x36b4a1,_0x380f61[_0xe4d9('0x175')],_0x380f61[_0xe4d9('0x6d')]);return this[_0xe4d9('0x34')][_0xe4d9('0x135')](_0x585d1e,_0x36b4a1,_0x380f61['escape_digits'],_0x380f61[_0xe4d9('0x6d')],undefined,!![]);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x176')]=function(_0x1aefeb){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x177'),_0x1aefeb[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x1aefeb['url'])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')]('no\x20url\x20configured');}var _0x19189a=this[_0xe4d9('0x6a')][_0xe4d9('0x79')](this,_0x1aefeb);logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x178'),util[_0xe4d9('0x179')](_0x19189a,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1aefeb[_0xe4d9('0xd5')])){return this['channel'][_0xe4d9('0xae')](_0xe4d9('0x17a'));}var _0x169ee9=this[_0xe4d9('0x11')][_0xe4d9('0x79')](this,_0x1aefeb['variable_id']);if(!_0x169ee9){return this[_0xe4d9('0x34')]['error'](_0x1aefeb,_0xe4d9('0xd7'));}this['channel'][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0x17b'),_0x169ee9),_0x19189a[_0xe4d9('0x17c')]?_0x19189a[_0xe4d9('0x17c')]:_0xe4d9('0x17d'));this['channel'][_0xe4d9('0xa6')](util[_0xe4d9('0x27')](_0xe4d9('0x17e'),_0x169ee9),_0x19189a['statusMessage']?_0x19189a[_0xe4d9('0x7d')]:'OK');if(_0x19189a[_0xe4d9('0x72')]){try{this[_0xe4d9('0xa4')](_0x19189a['body'],_0x169ee9);}catch(_0x127ca8){logger[_0xe4d9('0x2a')](util[_0xe4d9('0x27')](_0xe4d9('0x17f'),_0x169ee9));}}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xdc'),_0x169ee9));};AGIVertices[_0xe4d9('0x10')]['saydigits']=function(_0x3f3a3f){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3f3a3f[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')]['sayDigits'](_0x3f3a3f[_0xe4d9('0x180')][_0xe4d9('0x5f')](/\s+/g,''),_0x3f3a3f['escape_digits']);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x181')]=function(_0x191956){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x182'),_0x191956[_0xe4d9('0x36')]));return this['channel'][_0xe4d9('0x183')](_0x191956[_0xe4d9('0x6e')]['replace'](/\s+/g,''),_0x191956[_0xe4d9('0x175')]);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x184')]=function(_0xc947c9){logger[_0xe4d9('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0xc947c9[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')][_0xe4d9('0x185')](_0xc947c9[_0xe4d9('0x62')],_0xc947c9['escape_digits']);};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x186')]=function(_0x28c2b3){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x187'),_0x28c2b3[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x28c2b3['account_id'])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0x188'));}var _0x4d40b4=this[_0xe4d9('0x20')][_0xe4d9('0x79')](this,_0x28c2b3[_0xe4d9('0x189')]);if(!_0x4d40b4||!_0x4d40b4[_0xe4d9('0x18a')]){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x28c2b3,'no\x20mail\x20account\x20found');}var _0x7dd42c={'from':util[_0xe4d9('0x27')](_0xe4d9('0x18b'),_0x4d40b4[_0xe4d9('0x13')],_0x4d40b4[_0xe4d9('0x18c')]||_0x4d40b4[_0xe4d9('0x18a')]['user']),'to':_0x28c2b3['to']||'','cc':_0x28c2b3['cc']||'','bcc':_0x28c2b3[_0xe4d9('0x18d')]||'','subject':_0x28c2b3[_0xe4d9('0x18e')],'html':_0x28c2b3[_0xe4d9('0x62')],'text':_0x28c2b3[_0xe4d9('0x62')]};var _0x54edbf={'tls':{'rejectUnauthorized':![]}};if(_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x18f')]){_0x54edbf[_0xe4d9('0x18f')]=_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x18f')];}else{_0x54edbf['host']=_0x4d40b4[_0xe4d9('0x18a')]['host'];_0x54edbf[_0xe4d9('0x190')]=_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x190')];_0x54edbf[_0xe4d9('0x191')]=_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x191')];}if(_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x192')]){_0x54edbf[_0xe4d9('0x193')]={'user':_0x4d40b4[_0xe4d9('0x18a')][_0xe4d9('0x194')],'pass':_0x4d40b4['Smtp']['pass']};}if(this[_0xe4d9('0x8f')](_0x28c2b3[_0xe4d9('0x195')])){}logger[_0xe4d9('0xde')]('sendMail\x20message',JSON[_0xe4d9('0x7c')](_0x7dd42c));this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x28c2b3,_0x28c2b3[_0xe4d9('0x189')]);this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x196'),_0x4d40b4[_0xe4d9('0x13')]));this['sendMailMessage']['sync'](this,_0x54edbf,_0x7dd42c);return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x197'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x198')]=function(_0x51b7f0){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x199'),_0x51b7f0[_0xe4d9('0x36')]));return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x19a'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x19b')]=function(_0x2a9f9b){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x19c'),_0x2a9f9b[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x2a9f9b[_0xe4d9('0x19d')])){return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x19e'));}var _0xf40f18=this[_0xe4d9('0x31')][_0xe4d9('0x79')](this,_0x2a9f9b[_0xe4d9('0x19d')]);if(!_0xf40f18){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x2a9f9b,_0xe4d9('0x19f'));}var _0x8c4651={'body':_0x2a9f9b[_0xe4d9('0x1a0')],'phone':_0x2a9f9b['to']||'','SmsAccountId':_0xf40f18['id']};logger[_0xe4d9('0xde')](_0xe4d9('0x1a1'),JSON[_0xe4d9('0x7c')](_0x8c4651));this['createSquareDetailsReport'][_0xe4d9('0x79')](this,_0x2a9f9b,_0x2a9f9b[_0xe4d9('0x19d')]);this['channel']['noop'](util['format'](_0xe4d9('0x1a2'),_0xf40f18['name']));this[_0xe4d9('0x32')]['sync'](this,_0x8c4651);return this[_0xe4d9('0x34')][_0xe4d9('0xae')](_0xe4d9('0x1a3'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1a4')]=function(_0xee2d20){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x1a5'),_0xee2d20[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0xee2d20[_0xe4d9('0xd5')])){return this['channel']['error'](_0xee2d20,_0xe4d9('0x1a6'));}var _0x259c73=this[_0xe4d9('0x11')][_0xe4d9('0x79')](this,_0xee2d20[_0xe4d9('0xd5')]);if(!_0x259c73){return this[_0xe4d9('0x34')]['error'](_0xee2d20,_0xe4d9('0xd7'));}return this[_0xe4d9('0x34')][_0xe4d9('0xa6')](_0x259c73,_0xee2d20['variable_value']);};AGIVertices['prototype']['start']=function(_0x360659){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x1a7'),_0x360659[_0xe4d9('0x36')]));this['channel'][_0xe4d9('0xae')](_0xe4d9('0x1a8'));if(_0x360659[_0xe4d9('0xbe')]===_0xe4d9('0x1a9')){this['channel'][_0xe4d9('0xae')]('Answer');return this[_0xe4d9('0x34')][_0xe4d9('0xbe')]();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0xe4d9('0x10')]['subproject']=function(_0x191bff){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x1aa'),_0x191bff[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x191bff[_0xe4d9('0x1ab')])){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x191bff,'no\x20subproject\x20selected');}var _0x24efc8=this[_0xe4d9('0x15')][_0xe4d9('0x79')](this,_0x191bff[_0xe4d9('0x1ab')]);if(!this[_0xe4d9('0x8f')](_0x24efc8)){return this['channel']['error'](_0x191bff,util[_0xe4d9('0x27')](_0xe4d9('0x1ac'),_0x191bff['project_id']));}if(_0x24efc8===this[_0xe4d9('0x34')]['arg_1']){return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0x191bff,_0xe4d9('0x1ad'));}this[_0xe4d9('0x33')][_0xe4d9('0x79')](this,_0x191bff,_0x24efc8);var _0x3b69d5=this[_0xe4d9('0x34')][_0xe4d9('0x5e')]('AGI',util[_0xe4d9('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||'127.0.0.1',_0x24efc8,this[_0xe4d9('0x34')][_0xe4d9('0x38')]));if(_0x3b69d5[_0xe4d9('0xb5')]===-0x1){return _0x3b69d5;}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0xc5'),_0xe4d9('0x1ae'),_0x24efc8));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1af')]=function(_0x43ba76){logger['info'](util['format'](_0xe4d9('0x1b0'),_0x43ba76['label']));var _0x10bb19=this[_0xe4d9('0x5d')][_0xe4d9('0x79')](this,_0x43ba76[_0xe4d9('0x1b1')]);this['createSquareDetailsReport']['sync'](this,_0x43ba76,_0x43ba76[_0xe4d9('0x1b1')]);if(this['isConfigured'](_0x43ba76[_0xe4d9('0xd5')])){var _0x146688=this[_0xe4d9('0x11')]['sync'](this,_0x43ba76[_0xe4d9('0xd5')]);if(_0x146688){this['channel'][_0xe4d9('0xa6')](_0x146688,_0x10bb19);return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0x1b2'),_0x43ba76[_0xe4d9('0x1b1')],_0x146688));}}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x43ba76[_0xe4d9('0x1b1')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0xde514a){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x1b3'),_0xde514a['label']));_0xde514a[_0xe4d9('0x62')]=_0xde514a[_0xe4d9('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4d9('0x8f')](_0xde514a['apiKey'])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0x1b4'));}if(!this[_0xe4d9('0x8f')](_0xde514a[_0xe4d9('0x62')])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xaf'));}this[_0xe4d9('0x34')][_0xe4d9('0xae')](util['format'](_0xe4d9('0x1b5'),_0xde514a[_0xe4d9('0x62')]));var _0x317162=this['googleCloudTTS']['sync'](this,_0xde514a);if(_0x317162){this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x1b6'),_0x317162));var _0x3b03b2=this[_0xe4d9('0x34')][_0xe4d9('0x14e')](_0x317162);try{fs['unlink'](_0x317162+'.wav');}catch(_0x20ec9c){logger['error'](_0x20ec9c);}return _0x3b03b2;}return this[_0xe4d9('0x34')][_0xe4d9('0x2a')](_0xde514a,_0xe4d9('0x1b7'));};AGIVertices['prototype']['tts']=function(_0x251353){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x251353[_0xe4d9('0x36')]));_0x251353['text']=_0x251353['text'][_0xe4d9('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x251353['text'])){return this[_0xe4d9('0x34')]['noop'](_0xe4d9('0xaf'));}this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x1b8'),_0x251353[_0xe4d9('0x62')]));var _0x1f61b8=this[_0xe4d9('0x68')][_0xe4d9('0x79')](this,_0x251353);if(_0x1f61b8){this[_0xe4d9('0x34')]['noop'](util[_0xe4d9('0x27')](_0xe4d9('0x1b9'),_0x1f61b8));var _0x161125=this[_0xe4d9('0x34')][_0xe4d9('0x14e')](_0x1f61b8);try{fs[_0xe4d9('0x100')](_0x1f61b8+_0xe4d9('0x124'));}catch(_0x583888){logger['error'](_0x583888);}return _0x161125;}return this['channel'][_0xe4d9('0x2a')](_0x251353,_0xe4d9('0x1ba'));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1bb')]=function(_0x96f9b2){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x1bc'),_0x96f9b2[_0xe4d9('0x36')]));if(!this[_0xe4d9('0x8f')](_0x96f9b2['findBy'])){return this[_0xe4d9('0x34')]['error'](_0x96f9b2,_0xe4d9('0x153'));}logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')](_0xe4d9('0x158'),this['channel'][_0xe4d9('0x39')],_0x96f9b2[_0xe4d9('0x152')]));var _0x318e97=this[_0xe4d9('0x58')][_0xe4d9('0x79')](this,_0x96f9b2[_0xe4d9('0x152')]);if(_0x318e97){logger[_0xe4d9('0x2c')](util['format'](_0xe4d9('0x154'),this[_0xe4d9('0x34')]['callerid'],_0x96f9b2['findBy']));this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xe4d9('0x39')],_0x96f9b2['findBy']));return{'code':0xc8,'result':_0xe4d9('0x155')};}else{logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe4d9('0x34')]['callerid'],_0x96f9b2[_0xe4d9('0x152')]));this['channel'][_0xe4d9('0xae')](util[_0xe4d9('0x27')](_0xe4d9('0x156'),this[_0xe4d9('0x34')][_0xe4d9('0x39')],_0x96f9b2[_0xe4d9('0x152')]));return{'code':0xc8,'result':_0xe4d9('0x164')};}};AGIVertices['prototype'][_0xe4d9('0x1bd')]=function(_0x3de4c9){logger[_0xe4d9('0x2c')](util[_0xe4d9('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3de4c9['label']));var _0x55de0e=this['channel'][_0xe4d9('0x5e')](_0xe4d9('0x1be'),[_0x3de4c9[_0xe4d9('0x1bf')],_0x3de4c9[_0xe4d9('0x80')]]);if(_0x55de0e[_0xe4d9('0xb5')]===-0x1){return _0x55de0e;}return this[_0xe4d9('0x34')][_0xe4d9('0xae')](util[_0xe4d9('0x27')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3de4c9['mailbox']));};AGIVertices[_0xe4d9('0x10')][_0xe4d9('0x1c0')]=function(_0x441425){logger['info'](util['format'](_0xe4d9('0x1c1'),_0x441425[_0xe4d9('0x36')]));if(!this['isConfigured'](_0x441425[_0xe4d9('0xd5')])){return this[_0xe4d9('0x34')]['error'](_0x441425,_0xe4d9('0x1a6'));}var _0x422514=this[_0xe4d9('0x11')]['sync'](this,_0x441425[_0xe4d9('0xd5')]);if(!_0x422514){return this['channel']['error'](_0x441425,_0xe4d9('0xd7'));}var _0x41ff93=this[_0xe4d9('0x34')]['getVariable'](_0x422514);return{'code':0xc8,'result':_0x41ff93[_0xe4d9('0xa9')]?_0x41ff93[_0xe4d9('0xa9')]:'-'};};String['prototype'][_0xe4d9('0xa8')]=function(_0x547246,_0x219105){return this[_0xe4d9('0xa7')](_0x547246)[_0xe4d9('0x1c2')](_0x219105);};module['exports']=AGIVertices; \ No newline at end of file +var _0xc9b9=['scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','utcOffset','scheduledat','minutes','insertContact','add','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','format','%s.%s','split','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','retry','maxRetry','mrcpsynth','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','callback_priority','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','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','out','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','no\x20variable\x20found','hiddendigitsnum','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','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','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','file_id','PLAYBACK','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','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','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','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','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','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','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','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','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','vswitch','replaceAll','join','exports','lodash','shelljs','odbc','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','name','getVoiceQueueById','then','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id'];(function(_0x1947b5,_0x246d37){var _0x2f4704=function(_0x475a17){while(--_0x475a17){_0x1947b5['push'](_0x1947b5['shift']());}};_0x2f4704(++_0x246d37);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0xc9b9[_0x2bb66c];return _0x1e0f98;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x9c9b('0x0'));var sh=require(_0x9c9b('0x1'));var odbc=require(_0x9c9b('0x2'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x9c9b('0x3'))('agi');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0x9c9b('0x4'));var FILES_PATH=_0x9c9b('0x5');var recursiveMapAttributes=[_0x9c9b('0x6'),_0x9c9b('0x7')];var verticesWithRetry=[_0x9c9b('0x8'),'getdigits',_0x9c9b('0x9')];var AGIVertices=function(_0x20f056,_0x2a2178,_0x121f42){this['channel']=_0x20f056;this[_0x9c9b('0xa')]=_0x2a2178;this[_0x9c9b('0xb')]=_0x121f42;};AGIVertices['prototype'][_0x9c9b('0xc')]=function(_0x3e57e6,_0x51b63c){this['rpc'][_0x9c9b('0xd')](_0x3e57e6)['then'](function(_0x24a6e5){_0x51b63c(null,_0x24a6e5?_0x24a6e5[_0x9c9b('0xe')]:![]);})['catch'](function(_0x5aa9d4){_0x51b63c(_0x5aa9d4);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x155211,_0x38f7e6){this['rpc'][_0x9c9b('0xf')](_0x155211)[_0x9c9b('0x10')](function(_0x4d88c0){_0x38f7e6(null,_0x4d88c0?_0x4d88c0[_0x9c9b('0xe')]:![]);})[_0x9c9b('0x11')](function(_0x11fdae){_0x38f7e6(_0x11fdae);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x13')]=function(_0x299221,_0x10cb89){this[_0x9c9b('0xa')][_0x9c9b('0x14')](_0x299221)['then'](function(_0x28884a){_0x10cb89(null,_0x28884a?_0x28884a[_0x9c9b('0xe')]:![]);})[_0x9c9b('0x11')](function(_0x34c3e5){_0x10cb89(_0x34c3e5);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x15')]=function(_0x2b8be6,_0x556a98){this['rpc'][_0x9c9b('0x16')](_0x2b8be6)['then'](function(_0x3e5a97){_0x556a98(null,_0x3e5a97?_0x3e5a97[_0x9c9b('0x17')]:![]);})[_0x9c9b('0x11')](function(_0x15fdfc){_0x556a98(_0x15fdfc);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x18')]=function(_0x9b03b,_0xa6d12e){this[_0x9c9b('0xa')][_0x9c9b('0x19')](_0x9b03b)['then'](function(_0x2b8417){_0xa6d12e(null,_0x2b8417?_0x2b8417[_0x9c9b('0xe')]:![]);})[_0x9c9b('0x11')](function(_0x1dc76f){_0xa6d12e(_0x1dc76f);});};AGIVertices[_0x9c9b('0x12')]['getTrunk']=function(_0x3429af,_0x26f1dc){this[_0x9c9b('0xa')][_0x9c9b('0x1a')](_0x3429af)[_0x9c9b('0x10')](function(_0x30b964){_0x26f1dc(null,_0x30b964?_0x30b964[_0x9c9b('0xe')]:![]);})[_0x9c9b('0x11')](function(_0x52fed5){_0x26f1dc(_0x52fed5);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1b')]=function(_0x267dbf,_0x2d284){var _0x1c1466=this;this['rpc'][_0x9c9b('0x1c')](_0x267dbf)['then'](function(_0x21b164){_0x2d284(null,_0x21b164?_0x1c1466[_0x9c9b('0x1d')](_0x21b164[_0x9c9b('0x1e')]):![]);})[_0x9c9b('0x11')](function(_0xa554bd){_0x2d284(_0xa554bd);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1f')]=function(_0x15342f,_0xa07d03){this['rpc'][_0x9c9b('0x20')](_0x15342f)['then'](function(_0x14b2fd){_0xa07d03(null,_0x14b2fd?_0x14b2fd:![]);})['catch'](function(_0x2d7fad){_0xa07d03(_0x2d7fad);});};AGIVertices[_0x9c9b('0x12')]['sendMailMessage']=function(_0x2f2012,_0x369cf7,_0x41d12b){this['mailRpc'][_0x9c9b('0x21')](_0x2f2012,_0x369cf7)['then'](function(){_0x41d12b(null);})['catch'](function(_0xa60e71){_0x41d12b(_0xa60e71);});};AGIVertices['prototype'][_0x9c9b('0x22')]=function(_0x352d70,_0x36c08d){this[_0x9c9b('0xa')]['getIntervalById'](_0x352d70)['then'](function(_0xb1aa09){if(_0xb1aa09){if(_0xb1aa09[_0x9c9b('0x23')]){_0x36c08d(null,[_0xb1aa09['interval']]);}else{_0x36c08d(null,_[_0x9c9b('0x24')](_0xb1aa09[_0x9c9b('0x25')],_0x9c9b('0x26')));}}else{_0x36c08d(null,![]);}})[_0x9c9b('0x11')](function(_0x5d847b){_0x36c08d(_0x5d847b);});};AGIVertices['prototype'][_0x9c9b('0x1d')]=function(_0x351b1e){return util['format'](_0x9c9b('0x27'),FILES_PATH,_0x351b1e);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x28')]=function(_0x52cf57,_0x42adc4,_0x2e2038){odbc[_0x9c9b('0x29')](_0x52cf57,function(_0x359bcf){if(_0x359bcf){logger[_0x9c9b('0x2a')](_0x9c9b('0x2b'),_0x359bcf);_0x2e2038(_0x359bcf);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x42adc4,function(_0x2c27ed,_0x2859c6){if(_0x2c27ed){logger[_0x9c9b('0x2c')](_0x9c9b('0x2d'),_0x42adc4);_0x2e2038(_0x2c27ed);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x42adc4);odbc[_0x9c9b('0x2e')](function(_0x305186){if(_0x305186){logger[_0x9c9b('0x2a')](_0x9c9b('0x2f'),_0x305186);}_0x2e2038(null,_0x2859c6);});}});}});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x30')]=function(_0x29e318,_0x222330){this[_0x9c9b('0xa')][_0x9c9b('0x31')](_0x29e318)['then'](function(_0x43ea07){_0x222330(null,_0x43ea07?_0x43ea07:![]);})[_0x9c9b('0x11')](function(_0x270991){_0x222330(_0x270991);});};AGIVertices['prototype'][_0x9c9b('0x32')]=function(_0x169f43,_0x517ba7){this['rpc']['createSmsMessage'](_0x169f43)['then'](function(_0x5b229a){_0x517ba7(null,_0x5b229a);})[_0x9c9b('0x11')](function(_0x112b5a){_0x517ba7(_0x112b5a);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x33')]=function(_0x1e7ce1,_0x2dc6a4,_0x272b8e){this[_0x9c9b('0xa')][_0x9c9b('0x33')]({'uniqueid':this[_0x9c9b('0x34')][_0x9c9b('0x35')],'node':_0x1e7ce1[_0x9c9b('0x36')],'application':_0x1e7ce1[_0x9c9b('0x37')],'data':_0x2dc6a4||null,'project_name':this['channel'][_0x9c9b('0x38')],'callerid':this[_0x9c9b('0x34')][_0x9c9b('0x39')]})[_0x9c9b('0x10')](function(_0x290458){if(_0x272b8e){_0x272b8e(null,_0x290458);}})['catch'](function(_0x42f9b3){if(_0x272b8e){_0x272b8e(_0x42f9b3);}});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x3a')]=function(_0x249579,_0x5e0c1b,_0x4e6ea7,_0x4addc0){this['rpc'][_0x9c9b('0x3a')]({'uniqueid':this[_0x9c9b('0x34')]['uniqueid'],'callerid':this[_0x9c9b('0x34')][_0x9c9b('0x39')],'calleridname':this[_0x9c9b('0x34')][_0x9c9b('0x3b')],'context':this[_0x9c9b('0x34')][_0x9c9b('0x3c')],'extension':this[_0x9c9b('0x34')]['extension'],'priority':this[_0x9c9b('0x34')][_0x9c9b('0x3d')],'accountcode':this['channel'][_0x9c9b('0x3e')],'dnid':this[_0x9c9b('0x34')]['dnid'],'projectName':this[_0x9c9b('0x34')][_0x9c9b('0x38')],'saveName':_0x5e0c1b,'filename':_0x249579[_0x9c9b('0x3f')]||_0x5e0c1b,'savePath':_0x4e6ea7})[_0x9c9b('0x10')](function(_0x7ab78b){_0x4addc0(null,_0x7ab78b);})[_0x9c9b('0x11')](function(_0x3e3194){_0x4addc0(_0x3e3194);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x40')]=function(_0x43fa7a,_0x13c515,_0x186a3a,_0x4942fb,_0xcc2ab2){this['rpc'][_0x9c9b('0x40')]({'uniqueid':this[_0x9c9b('0x34')][_0x9c9b('0x35')],'body':_0x43fa7a,'direction':_0x13c515,'providerName':_0x186a3a,'providerResponse':_0x4942fb})[_0x9c9b('0x10')](function(_0x3c9e76){if(_0xcc2ab2){_0xcc2ab2(null,_0x3c9e76);}})[_0x9c9b('0x11')](function(_0x1270bb){if(_0xcc2ab2){_0xcc2ab2(_0x1270bb);}});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x41')]=function(_0x36fc17,_0x4a1640){var _0x37dbd5=this;var _0x3a2043=0x0;var _0xed3044={'firstName':_['isEmpty'](_0x36fc17[_0x9c9b('0xe')])||_[_0x9c9b('0x42')](_0x36fc17[_0x9c9b('0xe')])?'callback_'+Math[_0x9c9b('0x43')]():_0x36fc17[_0x9c9b('0xe')],'lastName':_[_0x9c9b('0x44')](_0x36fc17['lastName'])||_[_0x9c9b('0x42')](_0x36fc17[_0x9c9b('0x45')])?null:_0x36fc17[_0x9c9b('0x45')],'phone':_0x36fc17[_0x9c9b('0x46')],'ListId':_0x36fc17[_0x9c9b('0x47')],'scheduledat':_0x36fc17[_0x9c9b('0x48')],'callbackUniqueid':this[_0x9c9b('0x34')]['uniqueid'],'tags':_0x9c9b('0x49'),'description':_0x9c9b('0x4a')+_0x36fc17['scheduledAt'][_0x9c9b('0x4b')](),'priority':_0x36fc17['callback_priority']};if(_[_0x9c9b('0x4c')](_0x36fc17,_0x9c9b('0x4d'))){if(!_[_0x9c9b('0x42')](_0x36fc17[_0x9c9b('0x4d')])){var _0x902c33=_0x36fc17['dialTimezone'];if(_0x36fc17['dialTimezone']==_0x9c9b('0x4e')){this[_0x9c9b('0xa')][_0x9c9b('0x4f')]({'phone':_0x36fc17[_0x9c9b('0x46')]})[_0x9c9b('0x10')](function(_0x593d86){if(!_[_0x9c9b('0x42')](_0x593d86)){var _0x33192d=_0x593d86[_0x9c9b('0x4d')];if(!_[_0x9c9b('0x42')](_0x33192d)){var _0x50d5ae=shared[_0x9c9b('0x50')][_0x33192d];if(!_[_0x9c9b('0x42')](_0x50d5ae)){var _0x1240f7=-0x1*_0x50d5ae[_0x9c9b('0x51')];_0xed3044[_0x9c9b('0x52')]=moment(_0x36fc17['scheduledat'])['add'](_0x1240f7,_0x9c9b('0x53'));_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}});}else{var _0x3a2043=shared[_0x9c9b('0x50')][_0x902c33];if(!_['isNil'](_0x3a2043)){var _0x2b3a3f=-0x1*_0x3a2043[_0x9c9b('0x51')];_0xed3044[_0x9c9b('0x52')]=moment(_0x36fc17[_0x9c9b('0x52')])[_0x9c9b('0x55')](_0x2b3a3f,'minutes');_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}}}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}}else{_0x37dbd5[_0x9c9b('0x54')](_0xed3044,_0x36fc17,_0x4a1640);}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x56')]=function(_0xb30035,_0x568ef6){this['rpc']['getPauseById'](_0xb30035)[_0x9c9b('0x10')](function(_0x4286a8){_0x568ef6(null,_0x4286a8?_0x4286a8[_0x9c9b('0xe')]:![]);})['catch'](function(_0x384c06){_0x568ef6(_0x384c06);});};AGIVertices['prototype'][_0x9c9b('0x57')]=function(_0x3c8c86,_0x2ad954,_0x3eb896){var _0xd9c8a1={'role':_0x9c9b('0x58')};_0xd9c8a1[_0x3c8c86]=this[_0x9c9b('0x34')][_0x9c9b('0x39')];this[_0x9c9b('0xa')][_0x9c9b('0x57')](_0xd9c8a1,_0x2ad954,this[_0x9c9b('0x34')][_0x9c9b('0x35')])[_0x9c9b('0x10')](function(_0x2c3aef){_0x3eb896(null,_['isNil'](_0x2c3aef)?![]:!![]);})[_0x9c9b('0x11')](function(_0xa2d6ce){logger['error'](_0xa2d6ce);_0x3eb896(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x4859bf,_0x4302e1){var _0x26cc1e={'role':_0x9c9b('0x58')};_0x26cc1e[_0x4859bf]=this[_0x9c9b('0x34')][_0x9c9b('0x39')];this[_0x9c9b('0xa')][_0x9c9b('0x59')](_0x26cc1e)['then'](function(_0x51114f){_0x4302e1(null,_[_0x9c9b('0x42')](_0x51114f)?![]:!![]);})[_0x9c9b('0x11')](function(_0x25e7be){logger[_0x9c9b('0x2a')](_0x25e7be);_0x4302e1(null,![]);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x5a')]=function(_0x29eae7,_0x3af6b0){var _0x290060={'role':'agent'};_0x290060[_0x29eae7]=this[_0x9c9b('0x34')][_0x9c9b('0x39')];this[_0x9c9b('0xa')][_0x9c9b('0x5a')](_0x290060)[_0x9c9b('0x10')](function(_0x39d5e8){_0x3af6b0(null,_[_0x9c9b('0x42')](_0x39d5e8)?![]:!![]);})['catch'](function(_0x53f9c0){logger[_0x9c9b('0x2a')](_0x53f9c0);_0x3af6b0(null,![]);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x5b')]=function(_0xb8b036,_0x14fcd3){var _0x2baefb={'role':'agent'};_0x2baefb[_0xb8b036]=this[_0x9c9b('0x34')]['callerid'];var _0x5381a8=_0xb8b036!=_0x9c9b('0x5c')?util['format'](_0x9c9b('0x5d'),_0x9c9b('0x5e'),this[_0x9c9b('0x34')][_0x9c9b('0x39')]):undefined;this[_0x9c9b('0xa')][_0x9c9b('0x5b')](_0x2baefb,_0x5381a8)[_0x9c9b('0x10')](function(_0x309f13){_0x14fcd3(null,_[_0x9c9b('0x42')](_0x309f13)?![]:!![]);})['catch'](function(_0x47bf46){logger[_0x9c9b('0x2a')](_0x47bf46);_0x14fcd3(null,![]);});};AGIVertices[_0x9c9b('0x12')]['shellCommand']=function(_0x18141d,_0x304a9){sh['exec'](_['trim'](_0x18141d),function(_0x131b2d,_0x56e40d){var _0x581d41=_0x56e40d[_0x9c9b('0x5f')](/(\r\n|\n|\r)/gm,'');_0x304a9(null,_0x581d41);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x60')]=function(_0x17a275,_0x559318){scripts[_0x9c9b('0x60')](_0x17a275[_0x9c9b('0x61')],_0x17a275[_0x9c9b('0x62')]||_0x9c9b('0x63'),_0x17a275[_0x9c9b('0x63')],_0x17a275[_0x9c9b('0x64')]||_0x9c9b('0x65'),_0x17a275[_0x9c9b('0x66')]||_0x9c9b('0x67'),_0x17a275[_0x9c9b('0x68')]||_0x9c9b('0x69'))[_0x9c9b('0x10')](function(_0x53e03d){_0x559318(null,_0x53e03d);})[_0x9c9b('0x11')](function(_0xc747fc){_0x559318(_0xc747fc);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x6a')]=function(_0x3df9b4,_0x14d48d){scripts[_0x9c9b('0x6a')](_0x3df9b4[_0x9c9b('0x63')],_0x3df9b4[_0x9c9b('0x6b')]||'en',0x1)[_0x9c9b('0x10')](function(_0x23b2c1){_0x14d48d(null,_0x23b2c1);})[_0x9c9b('0x11')](function(_0x5b5635){_0x14d48d(_0x5b5635);});};AGIVertices['prototype'][_0x9c9b('0x6c')]=function(_0x361845,_0x8abb8f){var _0x2bcc38={'uri':_0x361845[_0x9c9b('0x6d')],'method':_0x361845[_0x9c9b('0x6e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x361845[_0x9c9b('0x6f')])==='number'&&parseInt(_0x361845[_0x9c9b('0x6f')])>=0x1?parseInt(_0x361845[_0x9c9b('0x6f')])*0x3e8:0x5*0x3e8};if(_[_0x9c9b('0x70')]([_0x9c9b('0x71'),_0x9c9b('0x72')],_0x2bcc38['method']['toUpperCase']())){try{_0x2bcc38[_0x9c9b('0x73')]=_0x361845[_0x9c9b('0x7')]?JSON['parse'](_0x361845[_0x9c9b('0x7')]):{};}catch(_0x28591c){logger['error'](_0x9c9b('0x74'),_0x28591c);}}try{_0x2bcc38['headers']=_0x361845['rawHeaders']?JSON[_0x9c9b('0x75')](_0x361845['rawHeaders']):{};}catch(_0x405050){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x405050);}if(_0x361845[_0x9c9b('0x76')]){try{var _0x2770ce=require(_0x361845['computedVariables'])[_0x9c9b('0x77')](this,_0x2bcc38);_0x2bcc38[_0x9c9b('0x78')]=Mustache[_0x9c9b('0x79')](_0x361845[_0x9c9b('0x6d')],_0x2770ce,{},['$$','$$']);if(_0x2bcc38[_0x9c9b('0x7a')]){_0x2bcc38[_0x9c9b('0x7a')]=JSON[_0x9c9b('0x75')](Mustache[_0x9c9b('0x79')](JSON[_0x9c9b('0x7b')](_0x2bcc38['headers']),_0x2770ce,{},['$$','$$']));}if(_0x2bcc38[_0x9c9b('0x73')]){_0x2bcc38['body']=JSON[_0x9c9b('0x75')](Mustache['render'](JSON['stringify'](_0x2bcc38['body']),_0x2770ce,{},['$$','$$']));}}catch(_0x3b96c3){logger[_0x9c9b('0x2a')](_0x9c9b('0x7c'),_0x3b96c3);}}rp(_0x2bcc38)[_0x9c9b('0x10')](function(_0x58b1d8){var _0x4fdea5={'statusCode':_0x58b1d8['statusCode']||0xc8,'statusMessage':_0x58b1d8[_0x9c9b('0x7d')]||'OK','headers':_0x58b1d8[_0x9c9b('0x7a')]||{},'body':_0x58b1d8[_0x9c9b('0x73')]||{}};_0x8abb8f(null,_0x4fdea5);})[_0x9c9b('0x11')](function(_0x2e0356){var _0xe7426={'statusCode':_0x2e0356[_0x9c9b('0x7e')]||0x1f4,'statusMessage':_0x2e0356[_0x9c9b('0x7f')]||_0x9c9b('0x80'),'headers':_0x2e0356[_0x9c9b('0x81')][_0x9c9b('0x7a')]||{},'body':_0x2e0356[_0x9c9b('0x81')]['body']||{}};_0x8abb8f(null,_0xe7426);});};AGIVertices['prototype']['googleDialogflow']=function(_0x540271,_0x426b9e){scripts[_0x9c9b('0x82')](this[_0x9c9b('0x34')]['uniqueid'],_0x540271[_0x9c9b('0x83')],_0x540271[_0x9c9b('0x63')],_0x540271[_0x9c9b('0x84')]||'en')[_0x9c9b('0x10')](function(_0x22616e){_0x426b9e(null,_0x22616e);})[_0x9c9b('0x11')](function(_0x1cc188){_0x426b9e(_0x1cc188);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5e73e6,_0x1f6209){scripts[_0x9c9b('0x85')](this[_0x9c9b('0x34')][_0x9c9b('0x35')],_0x5e73e6['dialogflowV2_project_id'],_0x5e73e6[_0x9c9b('0x86')],_0x5e73e6['private_key'],_0x5e73e6[_0x9c9b('0x63')],_0x5e73e6['dialogflowV2_language']||'en')[_0x9c9b('0x10')](function(_0x4f112d){_0x1f6209(null,_0x4f112d);})[_0x9c9b('0x11')](function(_0xef7f57){_0x1f6209(_0xef7f57);});};AGIVertices['prototype'][_0x9c9b('0x87')]=function(_0x41b47f,_0x168ec7){scripts['sestekNDA'](this[_0x9c9b('0x34')],_0x41b47f)[_0x9c9b('0x10')](function(_0x3fa62f){_0x168ec7(null,_0x3fa62f);})['catch'](function(_0x230709){_0x168ec7(_0x230709);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x88')]=function(_0x187493,_0x36216d){scripts['ispeechTTS'](_0x187493[_0x9c9b('0x83')],_0x187493[_0x9c9b('0x63')],_0x187493[_0x9c9b('0x89')]||_0x9c9b('0x65'),_0x187493[_0x9c9b('0x8a')])[_0x9c9b('0x10')](function(_0x5b769d){_0x36216d(null,_0x5b769d);})['catch'](function(_0x140505){_0x36216d(_0x140505);});};AGIVertices[_0x9c9b('0x12')]['ispeechASR']=function(_0x3bea7f,_0x4db0a2,_0x17095a){scripts[_0x9c9b('0x8b')](_0x4db0a2,_0x3bea7f[_0x9c9b('0x83')],_0x3bea7f[_0x9c9b('0x8c')]||'en-US',this[_0x9c9b('0x8d')](_0x3bea7f[_0x9c9b('0x8e')])?_0x3bea7f[_0x9c9b('0x8e')]:undefined)[_0x9c9b('0x10')](function(_0x424d95){_0x17095a(null,_0x424d95);})[_0x9c9b('0x11')](function(_0x354a52){_0x17095a(_0x354a52);});};AGIVertices['prototype'][_0x9c9b('0x8f')]=function(_0xff4d47,_0x25ff13){scripts[_0x9c9b('0x8f')](_0xff4d47[_0x9c9b('0x90')],_0xff4d47[_0x9c9b('0x91')],_0xff4d47[_0x9c9b('0x92')],_0xff4d47[_0x9c9b('0x93')]||_0x9c9b('0x94'),_0xff4d47[_0x9c9b('0x63')],_0xff4d47[_0x9c9b('0x95')]||_0x9c9b('0x63'))[_0x9c9b('0x10')](function(_0x2ccbd1){_0x25ff13(null,_0x2ccbd1);})[_0x9c9b('0x11')](function(_0xcb1495){_0x25ff13(_0xcb1495);});};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x96')]=function(_0x411d93,_0x3ea71b){scripts[_0x9c9b('0x96')](this['channel'][_0x9c9b('0x35')],_0x411d93[_0x9c9b('0x90')],_0x411d93[_0x9c9b('0x91')],_0x411d93[_0x9c9b('0x97')],_0x411d93[_0x9c9b('0x63')],_0x411d93[_0x9c9b('0x98')])[_0x9c9b('0x10')](function(_0x5bfbbf){_0x3ea71b(null,_0x5bfbbf);})[_0x9c9b('0x11')](function(_0x41636c){_0x3ea71b(_0x41636c);});};AGIVertices['prototype']['googleASR']=function(_0x1273ca,_0x2b1d43,_0x20fe73){scripts[_0x9c9b('0x99')](_0x2b1d43,_0x1273ca[_0x9c9b('0x83')],_0x1273ca['google_asr_language']||_0x9c9b('0x65'))[_0x9c9b('0x10')](function(_0x21ff3f){_0x20fe73(null,_0x21ff3f);})['catch'](function(_0x405e72){_0x20fe73(_0x405e72);});};AGIVertices['prototype'][_0x9c9b('0x9a')]=function(_0x4ac024,_0x53aa8a,_0x29be30){scripts[_0x9c9b('0x9a')](_0x53aa8a,_0x4ac024[_0x9c9b('0x9b')],_0x4ac024[_0x9c9b('0x9c')],_0x4ac024['uri'])[_0x9c9b('0x10')](function(_0xcbad9){_0x29be30(null,_0xcbad9);})[_0x9c9b('0x11')](function(_0x5272eb){_0x29be30(_0x5272eb);});};AGIVertices['prototype']['clear']=function(_0xb687e5){var _0x2f275f=_['includes'](verticesWithRetry,_0xb687e5[_0x9c9b('0x37')])?_0xb687e5:_[_0x9c9b('0x9d')](_0xb687e5);for(var _0x2f9c7e in _0x2f275f){if(_0x2f275f[_0x9c9b('0x9e')](_0x2f9c7e)){if(_0x2f275f[_0x2f9c7e]&&_['isString'](_0x2f275f[_0x2f9c7e])){if(_[_0x9c9b('0x70')](recursiveMapAttributes,_0x2f9c7e)){_0x2f275f[_0x2f9c7e]=this[_0x9c9b('0x9f')](_0x2f275f[_0x2f9c7e]);}else{_0x2f275f[_0x2f9c7e]=this[_0x9c9b('0xa0')](_0x2f275f[_0x2f9c7e]);}}}}return _0x2f275f;};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xa1')]=function(_0x3be4aa){for(var _0x2d6e3a in _0x3be4aa){if(_0x3be4aa[_0x9c9b('0x9e')](_0x2d6e3a)){if(_[_0x9c9b('0xa2')](_0x3be4aa[_0x2d6e3a])){this[_0x9c9b('0xa1')](_0x3be4aa[_0x2d6e3a]);}else if(_[_0x9c9b('0xa3')](_0x3be4aa[_0x2d6e3a])){for(var _0x10136d=0x0;_0x10136d<_0x3be4aa[_0x2d6e3a][_0x9c9b('0xa4')];_0x10136d++){this[_0x9c9b('0xa1')](_0x3be4aa[_0x2d6e3a][_0x10136d]);}}else if(_[_0x9c9b('0xa5')](_0x3be4aa[_0x2d6e3a])){_0x3be4aa[_0x2d6e3a]=this['replaceAllVariables'](_0x3be4aa[_0x2d6e3a]);}}}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xa6')]=function(_0x124afb,_0x6087be){for(var _0x48e8a9 in _0x124afb){if(_0x124afb['hasOwnProperty'](_0x48e8a9)){if(_[_0x9c9b('0xa2')](_0x124afb[_0x48e8a9])){if(!_[_0x9c9b('0x44')](_0x124afb[_0x48e8a9])){this[_0x9c9b('0xa6')](_0x124afb[_0x48e8a9],util[_0x9c9b('0xa7')](_0x9c9b('0xa8'),_0x6087be,_0x48e8a9));}}else if(_[_0x9c9b('0xa3')](_0x124afb[_0x48e8a9])){for(var _0x568dad=0x0;_0x568dad<_0x124afb[_0x48e8a9][_0x9c9b('0xa4')];_0x568dad++){this['saveRestApiResult'](_0x124afb[_0x48e8a9][_0x568dad],util[_0x9c9b('0xa7')]('%s.%s',_0x6087be,_0x48e8a9+'['+_0x568dad+']'));}}else{if(!_['isNil'](_0x124afb[_0x48e8a9])){this[_0x9c9b('0x34')]['setVariable'](util[_0x9c9b('0xa7')](_0x9c9b('0xa8'),_0x6087be,_0x48e8a9),_0x124afb[_0x48e8a9]);}}}}};AGIVertices[_0x9c9b('0x12')]['replaceObjectAllVariables']=function(_0x2a69cf){try{var _0x266a17=JSON['parse'](_0x2a69cf);this[_0x9c9b('0xa1')](_0x266a17);return JSON[_0x9c9b('0x7b')](_0x266a17);}catch(_0x236e3a){return this[_0x9c9b('0xa0')](_0x2a69cf);}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xa0')]=function(_0x284e3a){var _0x52af8c=_0x284e3a['split']('{');for(var _0x4b56a1=0x1;_0x4b56a1<_0x52af8c['length'];_0x4b56a1+=0x1){var _0x228dd4=_0x52af8c[_0x4b56a1][_0x9c9b('0xa9')]('}');if(_0x228dd4['length']>0x1){_0x284e3a=_0x284e3a['replaceAll']('{'+_0x228dd4[0x0]+'}',this['channel']['getVariable'](_0x228dd4[0x0])['extra']||_0x228dd4[0x0]);}}if(_0x52af8c[_0x9c9b('0xa4')]===0x1){return _0x284e3a['toString']();}return this[_0x9c9b('0xa0')](_0x284e3a);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xaa')]=function(_0x5e6e56,_0x144dcf){var _0x1be79d=this[_0x9c9b('0x34')]['getVariable'](_0x5e6e56);if(_0x1be79d[_0x9c9b('0xab')]===-0x1){return _0x1be79d;}logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0xac'),_0x144dcf,_0x1be79d[_0x9c9b('0xad')]));return this[_0x9c9b('0x34')][_0x9c9b('0xae')](_0x144dcf,_0x1be79d[_0x9c9b('0xad')]);};AGIVertices['prototype'][_0x9c9b('0x8d')]=function(_0x3c36e1){return _0x3c36e1&&_0x3c36e1!=='0'&&_0x3c36e1!=='-1'&&_0x3c36e1!=='';};AGIVertices[_0x9c9b('0x12')]['maxRetry']=function(_0x41aab4){this[_0x9c9b('0x33')]['sync'](this,_0x41aab4,'-');_0x41aab4[_0x9c9b('0xaf')]=_0x41aab4[_0x9c9b('0xb0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xb1')]=function(_0x59265b){logger[_0x9c9b('0x2c')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x59265b[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x59265b['text'])){return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0xb2'));}var _0x4ddda5='\x22'+_0x59265b[_0x9c9b('0x63')]+'\x22';if(this[_0x9c9b('0x8d')](_0x59265b[_0x9c9b('0x81')])){_0x4ddda5+=','+_0x59265b[_0x9c9b('0x81')];}var _0x16eaee=this['channel']['exec'](_0x9c9b('0xb3'),_0x4ddda5);if(_0x16eaee[_0x9c9b('0xab')]===-0x1){return _0x16eaee;}return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xb5'),_0x4ddda5));};AGIVertices[_0x9c9b('0x12')]['mrcprecog']=function(_0x50d8c4){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xb6'),_0x50d8c4[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x50d8c4[_0x9c9b('0xb7')])){return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0xb8'));}var _0x5be102=_0x50d8c4[_0x9c9b('0xb7')];if(this['isConfigured'](_0x50d8c4[_0x9c9b('0x81')])){_0x5be102+=','+_0x50d8c4['options'];}var _0x46238b=this[_0x9c9b('0x34')][_0x9c9b('0xb9')]('MRCPRecog',_0x5be102);if(_0x46238b[_0x9c9b('0xab')]===-0x1){return _0x46238b;}var _0x59e08f=this['getAndSetVariable'](_0x9c9b('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0x59e08f['result']===-0x1){return _0x59e08f;}var _0x3d3a5e=this[_0x9c9b('0xaa')](_0x9c9b('0xbb'),_0x9c9b('0xbc'));if(_0x3d3a5e['result']===-0x1){return _0x3d3a5e;}var _0x46b785=this[_0x9c9b('0xaa')]('RECOG_INSTANCE()',_0x9c9b('0xbd'));if(_0x46b785[_0x9c9b('0xab')]===-0x1){return _0x46b785;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5be102));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xbe')]=function(_0x2b5271){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0xbf'),_0x2b5271[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')]['agi']([_0x2b5271['command'],_0x2b5271[_0x9c9b('0xc0')]]);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xc1')]=function(_0x2f7bd4){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x2f7bd4[_0x9c9b('0x36')]));if(this[_0x9c9b('0x8d')](_0x2f7bd4[_0x9c9b('0x6f')])){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xc2'),_0x2f7bd4[_0x9c9b('0x6f')]));var _0x50f8ce=this[_0x9c9b('0x34')][_0x9c9b('0xc3')](_0x2f7bd4[_0x9c9b('0x6f')]);if(_0x50f8ce[_0x9c9b('0xab')]===-0x1){return _0x50f8ce;}}return this[_0x9c9b('0x34')][_0x9c9b('0xc1')]();};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x49')]=function(_0x1fd286){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0xc4'),_0x1fd286[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x1fd286['list_id'])){return this[_0x9c9b('0x34')]['error'](_0x1fd286,_0x9c9b('0xc5'));}_0x1fd286[_0x9c9b('0x48')]=moment();if(this['isConfigured'](_0x1fd286[_0x9c9b('0xc6')])){_0x1fd286[_0x9c9b('0x48')]=moment()[_0x9c9b('0x55')](_0x1fd286[_0x9c9b('0xc6')],_0x9c9b('0x53'));}if(!this[_0x9c9b('0x8d')](_0x1fd286[_0x9c9b('0xc7')])){_0x1fd286[_0x9c9b('0xc7')]=0x2;}this[_0x9c9b('0x41')]['sync'](this,_0x1fd286);return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xc8'),_0x1fd286['phone'],_0x1fd286[_0x9c9b('0x47')],_0x1fd286[_0x9c9b('0x48')]));};AGIVertices[_0x9c9b('0x12')]['custom_app']=function(_0x1cfc9d){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0xc9'),_0x1cfc9d['label']));var _0x19d028=this[_0x9c9b('0x34')][_0x9c9b('0xb9')](_0x1cfc9d[_0x9c9b('0xca')],_0x1cfc9d[_0x9c9b('0x81')]);if(_0x19d028[_0x9c9b('0xab')]===-0x1){return _0x19d028;}return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xcb'),_0x1cfc9d[_0x9c9b('0xca')],_0x1cfc9d[_0x9c9b('0x81')]));};AGIVertices['prototype'][_0x9c9b('0xcc')]=function(_0x5f570b){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5f570b[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x5f570b[_0x9c9b('0x63')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}var _0x7e1cc4='\x22'+_0x5f570b[_0x9c9b('0x63')]+'\x22';if(this[_0x9c9b('0x8d')](_0x5f570b['options'])){_0x7e1cc4+=','+_0x5f570b[_0x9c9b('0x81')];}var _0x5c3b10=this[_0x9c9b('0x34')]['exec'](_0x9c9b('0xb3'),_0x7e1cc4);if(_0x5c3b10[_0x9c9b('0xab')]===-0x1){return _0x5c3b10;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xb5'),_0x7e1cc4));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xcd')]=function(_0x5b84cf){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0xce'),_0x5b84cf['label']));if(!this[_0x9c9b('0x8d')](_0x5b84cf['text'])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}var _0x2d1c8a='\x22'+_0x5b84cf[_0x9c9b('0x63')]+'\x22';if(this[_0x9c9b('0x8d')](_0x5b84cf[_0x9c9b('0x81')])){_0x2d1c8a+=','+_0x5b84cf['options'];}var _0x3524dc=this[_0x9c9b('0x34')]['exec'](_0x9c9b('0xb3'),_0x2d1c8a);if(_0x3524dc[_0x9c9b('0xab')]===-0x1){return _0x3524dc;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xb5'),_0x2d1c8a));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xcf')]=function(_0x245aef){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xd0'),_0x245aef['label']));if(!this['isConfigured'](_0x245aef[_0x9c9b('0xb7')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xb8'));}var _0x467f5f=_0x245aef[_0x9c9b('0xb7')];if(this['isConfigured'](_0x245aef['options'])){_0x467f5f+=','+_0x245aef[_0x9c9b('0x81')];}var _0x43d018=this[_0x9c9b('0x34')][_0x9c9b('0xb9')](_0x9c9b('0xd1'),_0x467f5f);if(_0x43d018[_0x9c9b('0xab')]===-0x1){return _0x43d018;}var _0x22cf70=this[_0x9c9b('0xaa')](_0x9c9b('0xba'),'LUMENVOX_ASR_CONFIDENCE');if(_0x22cf70[_0x9c9b('0xab')]===-0x1){return _0x22cf70;}var _0x2f599f=this[_0x9c9b('0xaa')](_0x9c9b('0xbb'),_0x9c9b('0xd2'));if(_0x2f599f[_0x9c9b('0xab')]===-0x1){return _0x2f599f;}var _0x543cc9=this[_0x9c9b('0xaa')]('RECOG_INSTANCE()',_0x9c9b('0xd3'));if(_0x543cc9['result']===-0x1){return _0x543cc9;}return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xd4'),_0x467f5f));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xd5')]=function(_0x48e4a3){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xd6'),_0x48e4a3[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x48e4a3['grammar'])){return this[_0x9c9b('0x34')]['noop']('no\x20grammar\x20configured');}var _0x3d2d9f=_0x48e4a3[_0x9c9b('0xb7')];if(this[_0x9c9b('0x8d')](_0x48e4a3[_0x9c9b('0x81')])){_0x3d2d9f+=','+_0x48e4a3['options'];}var _0x32c029=this[_0x9c9b('0x34')][_0x9c9b('0xb9')](_0x9c9b('0xd1'),_0x3d2d9f);if(_0x32c029['result']===-0x1){return _0x32c029;}var _0x5cb704=this[_0x9c9b('0xaa')](_0x9c9b('0xba'),_0x9c9b('0xd7'));if(_0x5cb704[_0x9c9b('0xab')]===-0x1){return _0x5cb704;}var _0x182e1=this[_0x9c9b('0xaa')]('RECOG_INPUT()',_0x9c9b('0xd8'));if(_0x182e1['result']===-0x1){return _0x182e1;}var _0x1ef508=this[_0x9c9b('0xaa')]('RECOG_INSTANCE()',_0x9c9b('0xd9'));if(_0x1ef508[_0x9c9b('0xab')]===-0x1){return _0x1ef508;}return this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0xd4'),_0x3d2d9f));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xda')]=function(_0x3978ab){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xdb'),_0x3978ab['label']));if(!this['isConfigured'](_0x3978ab['odbc_id'])){return this[_0x9c9b('0x34')]['error'](_0x3978ab,_0x9c9b('0xdc'));}var _0x1777ef=this[_0x9c9b('0x15')][_0x9c9b('0x77')](this,_0x3978ab[_0x9c9b('0xdd')]);if(!_0x1777ef){return this[_0x9c9b('0x34')]['error'](_0x3978ab,_0x9c9b('0xde'));}if(!this[_0x9c9b('0x8d')](_0x3978ab['query'])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3978ab,_0x9c9b('0xdf'));}var _0x150878=_0x3978ab[_0x9c9b('0xe0')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0xe1'),_0x150878));var _0x2154c7=this[_0x9c9b('0x28')][_0x9c9b('0x77')](this,_0x1777ef,_0x150878);this[_0x9c9b('0x33')]['sync'](this,_0x3978ab,_0x150878);if(!this[_0x9c9b('0x8d')](_0x3978ab[_0x9c9b('0xe2')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xe3'));}var _0x21281e=this[_0x9c9b('0xc')][_0x9c9b('0x77')](this,_0x3978ab[_0x9c9b('0xe2')]);if(!_0x21281e){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3978ab,'no\x20variable\x20found');}var _0x1cfe77=this;_0x2154c7['forEach'](function(_0x19092d,_0x584360){Object['keys'](_0x19092d)[_0x9c9b('0xe4')](function(_0x57969f){_0x1cfe77[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')](_0x9c9b('0xe5'),_0x21281e,_0x584360,_0x57969f),_0x19092d[_0x57969f]);});});this[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')](_0x9c9b('0xe6'),_0x21281e),_0x2154c7[_0x9c9b('0xa4')]);return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xe7'),_0x21281e));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xe8')]=function(_0x5073e6){logger[_0x9c9b('0xe9')](util[_0x9c9b('0xa7')](_0x9c9b('0xea'),_0x5073e6[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x5073e6[_0x9c9b('0xeb')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x5073e6,_0x9c9b('0xec'));}var _0xbc7456=this[_0x9c9b('0x18')]['sync'](this,_0x5073e6[_0x9c9b('0xeb')]);if(!_0xbc7456){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x5073e6,_0x9c9b('0xed'));}var _0x1f90f1=this[_0x9c9b('0x34')][_0x9c9b('0xb9')]('DIAL',[util[_0x9c9b('0xa7')]('SIP/%s',_0xbc7456),_0x5073e6[_0x9c9b('0x6f')],_0x5073e6[_0x9c9b('0xee')],_0x5073e6[_0x9c9b('0x6d')]]);if(_0x1f90f1[_0x9c9b('0xab')]===-0x1){return _0x1f90f1;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xef'),_0x9c9b('0xf0')));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xf1')]=function(_0x50c3c9){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x50c3c9[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x50c3c9[_0x9c9b('0x83')])){return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0xf2'));}if(!this[_0x9c9b('0x8d')](_0x50c3c9[_0x9c9b('0x63')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x9c9b('0x33')](_0x50c3c9);this['createSquareMessage'](_0x50c3c9[_0x9c9b('0x63')],'in','','');this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xf3'),_0x50c3c9[_0x9c9b('0x63')]));var _0x400b2e=this[_0x9c9b('0x82')][_0x9c9b('0x77')](this,_0x50c3c9);if(_0x400b2e){for(var _0x3a2fda in _0x400b2e){if(_0x400b2e['hasOwnProperty'](_0x3a2fda)){this[_0x9c9b('0x34')]['setVariable'](util[_0x9c9b('0xa7')]('DIALOGFLOW_%s',_0x3a2fda['toUpperCase']()),_0x400b2e[_0x3a2fda]);}}this[_0x9c9b('0x40')](_0x400b2e['speech'],_0x9c9b('0xf4'),_0x9c9b('0xf1'),'');return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format']('Dialogflow\x20Result\x20%s',_0x400b2e[_0x9c9b('0xf5')]));}return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x50c3c9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x9c9b('0x12')]['dialogflowV2']=function(_0x16e0bc){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0xf6'),_0x16e0bc[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x16e0bc[_0x9c9b('0xf7')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x16e0bc[_0x9c9b('0x86')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xf8'));}if(!this[_0x9c9b('0x8d')](_0x16e0bc['private_key'])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x16e0bc[_0x9c9b('0xf9')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xfa'));}if(!this[_0x9c9b('0x8d')](_0x16e0bc[_0x9c9b('0x63')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')][_0x9c9b('0xfb')]=!![];this[_0x9c9b('0x33')](_0x16e0bc);this['createSquareMessage'](_0x16e0bc[_0x9c9b('0x63')],'in','','');this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xfc'),_0x16e0bc[_0x9c9b('0x63')]));var _0xb603f5=this[_0x9c9b('0x85')]['sync'](this,_0x16e0bc);if(_0xb603f5){for(var _0x5f1a66 in _0xb603f5){if(_0xb603f5[_0x9c9b('0x9e')](_0x5f1a66)){if(_0x5f1a66!==_0x9c9b('0xfd')){this[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')](_0x9c9b('0xfe'),_0x5f1a66[_0x9c9b('0xff')]()),_0xb603f5[_0x5f1a66]);}}}this[_0x9c9b('0x40')](_0xb603f5[_0x9c9b('0xf5')],'out','dialogflowV2',_0xb603f5[_0x9c9b('0xfd')]);return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x100'),_0xb603f5[_0x9c9b('0xf5')]));}return this[_0x9c9b('0x34')]['error'](_0x16e0bc,_0x9c9b('0x101'));};AGIVertices[_0x9c9b('0x12')]['sesteknda']=function(_0x11fdde){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x102'),_0x11fdde[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x11fdde['ndauth_url'])){return this['channel'][_0x9c9b('0xb4')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x9c9b('0x8d')](_0x11fdde[_0x9c9b('0x103')])){return this[_0x9c9b('0x34')]['noop']('no\x20username\x20configured');}if(!this[_0x9c9b('0x8d')](_0x11fdde['password'])){return this['channel'][_0x9c9b('0xb4')]('no\x20password\x20configured');}if(!this[_0x9c9b('0x8d')](_0x11fdde['ndassistant_url'])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')]['bot']=!![];this[_0x9c9b('0x33')](_0x11fdde);this[_0x9c9b('0x40')](_0x11fdde[_0x9c9b('0x63')],'in','','');this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x104'),_0x11fdde[_0x9c9b('0x63')]));var _0x918f79=this['sestekNDA']['sync'](this,_0x11fdde);if(_0x918f79){for(var _0x48d3af in _0x918f79){if(_0x918f79[_0x9c9b('0x9e')](_0x48d3af)){this[_0x9c9b('0x34')]['setVariable'](util[_0x9c9b('0xa7')](_0x9c9b('0x105'),_0x48d3af[_0x9c9b('0xff')]()),_0x918f79[_0x48d3af]);}}this[_0x9c9b('0x40')](_0x918f79[_0x9c9b('0xf5')],_0x9c9b('0xf4'),'sesteknda','');if(_0x918f79['audiofile']){this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x918f79[_0x9c9b('0x106')]));var _0x4dbb97=this[_0x9c9b('0x34')]['streamFile'](_0x918f79['audiofile']);try{fs[_0x9c9b('0x107')](_0x918f79['audiofile']+_0x9c9b('0x108'));}catch(_0x7ab21f){logger[_0x9c9b('0x2a')](_0x7ab21f);}return _0x4dbb97;}else{return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x109'),_0x918f79['speech']));}}return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x11fdde,_0x9c9b('0x10a'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x10b')]=function(_0x44a478){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x10c'),_0x44a478[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x10b'));};AGIVertices[_0x9c9b('0x12')]['ext_dial']=function(_0x348893){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x10d'),_0x348893['label']));var _0x34501a='';if(_0x348893[_0x9c9b('0x10e')]){if(!this[_0x9c9b('0x8d')](_0x348893['trunk_id'])){return this['channel']['error'](_0x348893,_0x9c9b('0x10f'));}else{var _0x418310=parseInt(_0x348893[_0x9c9b('0x10e')],0xa);if(isNaN(_0x418310)){_0x34501a=_0x348893['trunk_id'];}else{_0x34501a=this[_0x9c9b('0x110')][_0x9c9b('0x77')](this,_0x348893[_0x9c9b('0x10e')]);if(!_0x34501a){return this['channel']['error'](_0x348893,'no\x20trunk\x20found');}}}}else if(_0x348893[_0x9c9b('0x111')]){_0x34501a=_0x348893[_0x9c9b('0x111')];}else{return this['channel'][_0x9c9b('0x2a')](_0x348893,_0x9c9b('0x10f'));}var _0xb145c=this[_0x9c9b('0x34')]['exec'](_0x9c9b('0xf0'),[util[_0x9c9b('0xa7')]('SIP/%s/%s',_0x34501a,_0x348893[_0x9c9b('0x46')]),_0x348893[_0x9c9b('0x6f')],_0x348893[_0x9c9b('0xee')],_0x348893['url']]);if(_0xb145c['result']===-0x1){return _0xb145c;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format'](_0x9c9b('0xef'),'DIAL'));};AGIVertices['prototype'][_0x9c9b('0x112')]=function(_0x39b521){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x39b521[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('finally');};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x113')]=function(_0x1b75ca){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x114'),_0x1b75ca['label']));if(_0x1b75ca[_0x9c9b('0xaf')]===0x0){return this[_0x9c9b('0xb0')](_0x1b75ca);}_0x1b75ca[_0x9c9b('0xaf')]-=0x1;if(!this[_0x9c9b('0x8d')](_0x1b75ca['file_id'])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x1b75ca,_0x9c9b('0x115'));}var _0x865de1=this[_0x9c9b('0x1b')]['sync'](this,_0x1b75ca['file_id']);if(!_0x865de1){return this['channel'][_0x9c9b('0x2a')](_0x1b75ca,_0x9c9b('0x116'));}if(!this['isConfigured'](_0x1b75ca[_0x9c9b('0xe2')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x9c9b('0xe3'));}var _0x51feef=this[_0x9c9b('0x34')][_0x9c9b('0x117')](_0x865de1,_0x1b75ca[_0x9c9b('0x118')],_0x1b75ca['maxdigit']);var _0x29e9aa=_0x51feef[_0x9c9b('0xab')]?_0x51feef[_0x9c9b('0xab')][_0x9c9b('0x4b')]():'';logger[_0x9c9b('0x2c')]('test',JSON[_0x9c9b('0x7b')](_0x51feef));if(_0x51feef[_0x9c9b('0xab')]===-0x1){this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x1b75ca,_0x29e9aa);return _0x51feef;}else if(_0x51feef['extra']===_0x9c9b('0x6f')){_0x51feef[_0x9c9b('0xab')]=_0x29e9aa['length']>=parseInt(_0x1b75ca['mindigit'])?'x':'i';}else{_0x51feef['result']=_0x29e9aa[_0x9c9b('0xa4')]>=parseInt(_0x1b75ca['mindigit'])&&_0x29e9aa[_0x9c9b('0xa4')]<=parseInt(_0x1b75ca[_0x9c9b('0x119')])?'x':'i';}var _0x33ddb6=this['getVariable']['sync'](this,_0x1b75ca[_0x9c9b('0xe2')]);if(!_0x33ddb6){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x1b75ca,_0x9c9b('0x11a'));}this['channel'][_0x9c9b('0xae')](_0x33ddb6,_0x29e9aa);if(this[_0x9c9b('0x8d')](_0x1b75ca[_0x9c9b('0x11b')])){var _0x972adf=parseInt(_0x1b75ca['hiddendigitsnum'],0xa);var _0x47beb9=rs['generate']({'charset':'*','length':_0x972adf});var _0x18d77e=_0x29e9aa[_0x9c9b('0xa4')];if(_0x18d77e>0x0){if(_0x18d77e>_0x972adf){this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x1b75ca,_0x1b75ca['hiddendigitspos']===_0x9c9b('0x11c')?_0x47beb9+_0x29e9aa['substr'](_0x972adf):_0x29e9aa[_0x9c9b('0x11d')](0x0,_0x18d77e-_0x972adf)+_0x47beb9);}else{this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x1b75ca,rs[_0x9c9b('0x11e')]({'charset':'*','length':_0x18d77e}));}}else{this[_0x9c9b('0x33')]['sync'](this,_0x1b75ca,'');}}else{this[_0x9c9b('0x33')]['sync'](this,_0x1b75ca,_0x29e9aa);}return _0x51feef;};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x9')]=function(_0xa63f5a){logger['info'](util['format'](_0x9c9b('0x11f'),_0xa63f5a['label']));return this['getdigits'](_0xa63f5a);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x120')]=function(_0x143c57){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x143c57[_0x9c9b('0x36')]));this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x143c57,_0x143c57['goalname']);return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('GOAL\x20%s',_0x143c57[_0x9c9b('0x121')]));};AGIVertices['prototype'][_0x9c9b('0x122')]=function(_0x1fff0a){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x123'),_0x1fff0a[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x1fff0a[_0x9c9b('0x90')])||!this[_0x9c9b('0x8d')](_0x1fff0a[_0x9c9b('0x91')])){return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0x124'));}if(!this['isConfigured'](_0x1fff0a[_0x9c9b('0x63')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this['channel']['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x125'),_0x1fff0a['text']));var _0x90365c=this['awsPolly'][_0x9c9b('0x77')](this,_0x1fff0a);if(_0x90365c){this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x126'),_0x90365c));var _0x29cb28=this[_0x9c9b('0x34')][_0x9c9b('0x127')](_0x90365c);try{fs[_0x9c9b('0x107')](_0x90365c+_0x9c9b('0x108'));}catch(_0x2cd166){logger[_0x9c9b('0x2a')](_0x2cd166);}return _0x29cb28;}return this['channel']['error'](_0x1fff0a,_0x9c9b('0x128'));};AGIVertices['prototype'][_0x9c9b('0x129')]=function(_0x86d53b){logger['info'](util[_0x9c9b('0xa7')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x86d53b[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x86d53b['aws_access_key_id'])||!this[_0x9c9b('0x8d')](_0x86d53b[_0x9c9b('0x91')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0x124'));}if(!this[_0x9c9b('0x8d')](_0x86d53b[_0x9c9b('0x98')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x12a'));}if(!this[_0x9c9b('0x8d')](_0x86d53b[_0x9c9b('0x63')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')][_0x9c9b('0xfb')]=!![];this['createSquareDetailsReport'](_0x86d53b);this['createSquareMessage'](_0x86d53b[_0x9c9b('0x63')],'in','','');this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('Trying\x20Amazon\x20Lex:\x20%s',_0x86d53b[_0x9c9b('0x63')]));var _0x4f7e22=this[_0x9c9b('0x96')][_0x9c9b('0x77')](this,_0x86d53b);if(_0x4f7e22){for(var _0xf0e445 in _0x4f7e22){if(_0x4f7e22[_0x9c9b('0x9e')](_0xf0e445)&&_[_0x9c9b('0xa5')](_0x4f7e22[_0xf0e445])){this['channel'][_0x9c9b('0xae')](util['format'](_0x9c9b('0x12b'),_0xf0e445[_0x9c9b('0xff')]()),_0x4f7e22[_0xf0e445]);}}if(_[_0x9c9b('0x42')](_0x4f7e22['message'])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0x12c'));}else{this[_0x9c9b('0x40')](_0x4f7e22[_0x9c9b('0x7f')],'out',_0x9c9b('0x12d'),'');return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x12e'),_0x4f7e22['message']));}}return this['channel'][_0x9c9b('0x2a')](_0x86d53b,_0x9c9b('0x12f'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x130')]=function(_0x2ea66b){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x131'),_0x2ea66b[_0x9c9b('0x36')],_0x2ea66b[_0x9c9b('0x6f')]));if(!this[_0x9c9b('0x8d')](_0x2ea66b[_0x9c9b('0x83')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('no\x20key\x20configured');}var _0x33936c=_0x9c9b('0x132');var _0x3b1e82=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1c28fd=util[_0x9c9b('0xa7')]('%s.%s',_0x3b1e82,_0x33936c);var _0x278263=!![];if(_0x2ea66b[_0x9c9b('0x133')]==='NOBEEP'){_0x278263=![];}var _0x53ee76=this[_0x9c9b('0x34')]['recordFile'](_0x3b1e82,_0x33936c,_0x2ea66b['intKey'],_0x2ea66b[_0x9c9b('0x6f')],undefined,_0x278263);if(_0x53ee76[_0x9c9b('0xab')]!==-0x1){this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x134'),_0x1c28fd));var _0x395e7f=this[_0x9c9b('0x99')][_0x9c9b('0x77')](this,_0x2ea66b,_0x1c28fd);if(_0x395e7f){for(var _0x86fba1 in _0x395e7f){if(_0x395e7f[_0x9c9b('0x9e')](_0x86fba1)){this[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')](_0x9c9b('0x135'),_0x86fba1[_0x9c9b('0xff')]()),_0x395e7f[_0x86fba1]);}}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('GoogleASR\x20Result\x20%s',JSON[_0x9c9b('0x7b')](_0x395e7f)));}}return _0x53ee76;};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x136')]=function(_0x554cfa){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x137'),_0x554cfa[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x554cfa[_0x9c9b('0x9b')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x138'));}if(!this['isConfigured'](_0x554cfa[_0x9c9b('0x9c')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x139'));}var _0xf9b190=_0x9c9b('0x132');var _0x2aec2d=util['format'](_0x9c9b('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x10731c=util[_0x9c9b('0xa7')](_0x9c9b('0xa8'),_0x2aec2d,_0xf9b190);var _0x49fe74=!![];if(_0x554cfa[_0x9c9b('0x133')]===_0x9c9b('0x13b')){_0x49fe74=![];}var _0x1bc340=this[_0x9c9b('0x34')]['recordFile'](_0x2aec2d,_0xf9b190,_0x554cfa[_0x9c9b('0x13c')],_0x554cfa[_0x9c9b('0x6f')],undefined,_0x49fe74);if(_0x1bc340['result']!==-0x1){this['channel']['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x13d'),_0x10731c));var _0x522e11=this['tildeASR'][_0x9c9b('0x77')](this,_0x554cfa,_0x10731c);if(_0x522e11){for(var _0x470044 in _0x522e11){if(_0x522e11[_0x9c9b('0x9e')](_0x470044)){this['channel'][_0x9c9b('0xae')](util['format'](_0x9c9b('0x13e'),_0x470044[_0x9c9b('0xff')]()),_0x522e11[_0x470044]);}}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format'](_0x9c9b('0x13f'),JSON[_0x9c9b('0x7b')](_0x522e11)));}}return _0x1bc340;};AGIVertices['prototype'][_0x9c9b('0x140')]=function(_0x10f324){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x10f324[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')][_0x9c9b('0x141')](_0x10f324['context'],_0x10f324['extension'],_0x10f324[_0x9c9b('0x3d')]);};AGIVertices['prototype'][_0x9c9b('0x142')]=function(_0x5b9b54){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x143'),_0x5b9b54['label']));if(!this[_0x9c9b('0x8d')](_0x5b9b54['condition'])){return this['channel'][_0x9c9b('0x2a')](_0x5b9b54,_0x9c9b('0x144'));}try{var _0x4cda81=eval(_0x5b9b54[_0x9c9b('0x145')])?'true':_0x9c9b('0x146');this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x147'),_0x5b9b54[_0x9c9b('0x145')],_0x4cda81));return{'code':0xc8,'result':_0x4cda81};}catch(_0x412601){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x148')]=function(_0x3ab436){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3ab436[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x3ab436[_0x9c9b('0x149')])){return this['channel'][_0x9c9b('0x2a')](_0x3ab436,_0x9c9b('0x14a'));}var _0x4ab396=this[_0x9c9b('0x22')][_0x9c9b('0x77')](this,_0x3ab436[_0x9c9b('0x149')]);if(!_0x4ab396){return this[_0x9c9b('0x34')]['error'](_0x3ab436,'no\x20intervals\x20found');}for(var _0x11c4a4=0x0;_0x11c4a4<_0x4ab396['length'];_0x11c4a4+=0x1){var _0x322be4=this[_0x9c9b('0x34')][_0x9c9b('0xc')](util[_0x9c9b('0xa7')](_0x9c9b('0x14b'),_0x4ab396[_0x11c4a4]));if(_0x322be4[_0x9c9b('0xab')]===-0x1){return _0x322be4;}logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x14c'),_0x4ab396[_0x11c4a4],_0x322be4[_0x9c9b('0xad')]));if(_0x322be4['extra']===_0x9c9b('0x14d')){logger[_0x9c9b('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x4ab396[_0x11c4a4],_0x9c9b('0x14d')));this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x14c'),_0x4ab396[_0x11c4a4],_0x9c9b('0x14d')));return{'code':0xc8,'result':_0x9c9b('0x14d')};}else{logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x14c'),_0x4ab396[_0x11c4a4],_0x9c9b('0x146')));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('IFTIME\x20%s\x20%s',_0x4ab396[_0x11c4a4],_0x9c9b('0x146')));}}return{'code':0xc8,'result':_0x9c9b('0x146')};};AGIVertices['prototype'][_0x9c9b('0x14e')]=function(_0x3d2641){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3d2641['label']));return this['channel']['hangup']();};AGIVertices[_0x9c9b('0x12')]['ispeechasr']=function(_0x484a30){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x14f'),_0x484a30[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x484a30['key'])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xf2'));}var _0x155693=_0x9c9b('0x132');var _0x5257a1=util[_0x9c9b('0xa7')]('%s/recordings/%s',FILES_PATH,rs[_0x9c9b('0x11e')](0x4));var _0x40097c=util['format'](_0x9c9b('0xa8'),_0x5257a1,_0x155693);var _0x58c529=!![];if(_0x484a30[_0x9c9b('0x133')]===_0x9c9b('0x13b')){_0x58c529=![];}var _0x97f7e9=this['channel'][_0x9c9b('0x150')](_0x5257a1,_0x155693,_0x484a30['intKey'],_0x484a30[_0x9c9b('0x6f')],undefined,_0x58c529);if(_0x97f7e9['result']!==-0x1){this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x151'),_0x40097c));var _0x545af2=this[_0x9c9b('0x8b')]['sync'](this,_0x484a30,_0x40097c);if(_0x545af2){for(var _0xc59a04 in _0x545af2){if(_0x545af2['hasOwnProperty'](_0xc59a04)){this[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')]('ISPEECH_ASR_%s',_0xc59a04[_0x9c9b('0xff')]()),_0x545af2[_0xc59a04]);}}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('IspeechASR\x20Result\x20%s',JSON[_0x9c9b('0x7b')](_0x545af2)));}}return _0x97f7e9;};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x152')]=function(_0x29c295){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x153'),_0x29c295[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x29c295[_0x9c9b('0x83')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xf2'));}if(!this[_0x9c9b('0x8d')](_0x29c295['text'])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x154'),_0x29c295[_0x9c9b('0x63')]));var _0x4b087f=this[_0x9c9b('0x88')][_0x9c9b('0x77')](this,_0x29c295);if(_0x4b087f){this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x151'),_0x4b087f));var _0x89f900=this[_0x9c9b('0x34')][_0x9c9b('0x127')](_0x4b087f,_0x29c295[_0x9c9b('0x13c')]);try{fs[_0x9c9b('0x107')](_0x4b087f+_0x9c9b('0x108'));}catch(_0x641bb6){logger[_0x9c9b('0x2a')](_0x641bb6);}return _0x89f900;}return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x29c295,_0x9c9b('0x155'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x156')]=function(_0x3f8173){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x157'),_0x3f8173['label']));if(!this['isConfigured'](_0x3f8173[_0x9c9b('0x158')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3f8173,_0x9c9b('0x159'));}logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x15a'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3f8173[_0x9c9b('0x158')]));var _0x160658=this[_0x9c9b('0x5b')][_0x9c9b('0x77')](this,_0x3f8173[_0x9c9b('0x158')]);if(_0x160658){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x15b'),this['channel']['callerid'],_0x3f8173['findBy']));this['channel']['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x15b'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3f8173[_0x9c9b('0x158')]));return{'code':0xc8,'result':_0x9c9b('0x15c')};}else{logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15d'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3f8173['findBy']));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x15d'),this[_0x9c9b('0x34')]['callerid'],_0x3f8173['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x15e')]=function(_0x52eafa){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15f'),_0x52eafa['label']));if(!this[_0x9c9b('0x8d')](_0x52eafa['findBy'])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x52eafa,_0x9c9b('0x159'));}logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15a'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x52eafa[_0x9c9b('0x158')]));var _0x572cc7=this['agentLogout'][_0x9c9b('0x77')](this,_0x52eafa[_0x9c9b('0x158')]);if(_0x572cc7){logger[_0x9c9b('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x52eafa[_0x9c9b('0x158')]));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9c9b('0x39')],_0x52eafa[_0x9c9b('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x15d'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x52eafa[_0x9c9b('0x158')]));this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x15d'),this['channel'][_0x9c9b('0x39')],_0x52eafa[_0x9c9b('0x158')]));return{'code':0xc8,'result':_0x9c9b('0x160')};}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x161')]=function(_0x506e76){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x162'),_0x506e76[_0x9c9b('0x36')]));if(!this['isConfigured'](_0x506e76[_0x9c9b('0x163')])){return this['channel']['error'](_0x506e76,_0x9c9b('0x164'));}this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x165'),_0x506e76[_0x9c9b('0x163')]));var _0x30ba49=eval(_0x506e76['operation']);if(!this[_0x9c9b('0x8d')](_0x506e76[_0x9c9b('0xe2')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x369d86=this[_0x9c9b('0xc')][_0x9c9b('0x77')](this,_0x506e76[_0x9c9b('0xe2')]);if(!_0x369d86){return this['channel'][_0x9c9b('0x2a')](_0x506e76,_0x9c9b('0x11a'));}if(_[_0x9c9b('0xa3')](_0x30ba49)){var _0x5774e8=this;_0x30ba49[_0x9c9b('0xe4')](function(_0x4f98eb,_0x4839a5){_0x5774e8[_0x9c9b('0x34')][_0x9c9b('0xae')](util['format'](_0x9c9b('0x166'),_0x369d86,_0x4839a5),_0x4f98eb);});return this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x167'),_0x369d86));}else{return this[_0x9c9b('0x34')][_0x9c9b('0xae')](_0x369d86,_0x30ba49);}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x8')]=function(_0x7794b6){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x168'),_0x7794b6[_0x9c9b('0x36')]));if(_0x7794b6[_0x9c9b('0xaf')]===0x0){return this['maxRetry'](_0x7794b6);}_0x7794b6[_0x9c9b('0xaf')]-=0x1;if(!this[_0x9c9b('0x8d')](_0x7794b6['file_id'])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x7794b6,_0x9c9b('0x115'));}var _0x1b65df=this[_0x9c9b('0x1b')][_0x9c9b('0x77')](this,_0x7794b6['file_id']);if(!_0x1b65df){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x7794b6,'no\x20file\x20audio\x20found');}var _0x3a6dc3=this[_0x9c9b('0x34')]['getData'](_0x1b65df,_0x7794b6['response'],_0x7794b6[_0x9c9b('0x169')]);var _0x1394d8=_0x3a6dc3[_0x9c9b('0xab')];if(_0x3a6dc3[_0x9c9b('0xab')]===-0x1){this[_0x9c9b('0x33')]['sync'](this,_0x7794b6,'-1');return _0x3a6dc3;}else if(_0x3a6dc3[_0x9c9b('0xad')]==='timeout'){_0x3a6dc3[_0x9c9b('0xab')]=_0x3a6dc3[_0x9c9b('0xab')][_0x9c9b('0xa4')]>0x0?_0x3a6dc3['result']:'t';}else if(_[_0x9c9b('0x44')](_0x3a6dc3['result'])){_0x3a6dc3[_0x9c9b('0xab')]='#';_0x1394d8='#';}if(!this[_0x9c9b('0x8d')](_0x7794b6[_0x9c9b('0xe2')])){this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0xe3'));}else{var _0x216028=this['getVariable'][_0x9c9b('0x77')](this,_0x7794b6['variable_id']);if(!_0x216028){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x7794b6,_0x9c9b('0x11a'));}this['channel'][_0x9c9b('0xae')](_0x216028,_0x1394d8);}this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x7794b6,_0x1394d8);return _0x3a6dc3;};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0xb4')]=function(_0x581e08){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x16a'),_0x581e08[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')]['noop'](_0x581e08[_0x9c9b('0x16b')]||_0x581e08['label']);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x16c')]=function(_0x3afc5e){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x16d'),_0x3afc5e[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x3afc5e[_0x9c9b('0x158')])){return this['channel'][_0x9c9b('0x2a')](_0x3afc5e,'no\x20find\x20by\x20configured');}logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15a'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3afc5e[_0x9c9b('0x158')]));var _0x52db21=this[_0x9c9b('0x56')][_0x9c9b('0x77')](this,_0x3afc5e['pause_id']);var _0x44f483=this[_0x9c9b('0x57')][_0x9c9b('0x77')](this,_0x3afc5e[_0x9c9b('0x158')],_0x52db21);if(_0x44f483){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3afc5e[_0x9c9b('0x158')]));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x15b'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3afc5e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15d'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3afc5e['findBy']));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x15b'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3afc5e[_0x9c9b('0x158')]));return{'code':0xc8,'result':_0x9c9b('0x160')};}};AGIVertices['prototype'][_0x9c9b('0x16e')]=function(_0x39eb12){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x16f'),_0x39eb12[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x39eb12[_0x9c9b('0x170')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x39eb12,_0x9c9b('0x115'));}var _0x1578db=this[_0x9c9b('0x1b')][_0x9c9b('0x77')](this,_0x39eb12['file_id']);if(!_0x1578db){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x39eb12,'no\x20file\x20audio\x20found');}var _0x226544=this[_0x9c9b('0x34')][_0x9c9b('0xb9')]('PLAYBACK',[_0x1578db,_0x39eb12[_0x9c9b('0xee')]]);if(_0x226544[_0x9c9b('0xab')]===-0x1){return _0x226544;}return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xcb'),_0x9c9b('0x171'),_0x1578db));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x172')]=function(_0x42896c){logger[_0x9c9b('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x42896c['label']));if(!this[_0x9c9b('0x8d')](_0x42896c[_0x9c9b('0x173')])){return this['channel'][_0x9c9b('0x2a')](_0x42896c,_0x9c9b('0x174'));}var _0x2bc4a9='';var _0x99acda=parseInt(_0x42896c[_0x9c9b('0x173')],0xa);if(isNaN(_0x99acda)){_0x2bc4a9=_0x42896c['queue_id'];}else{_0x2bc4a9=this[_0x9c9b('0x175')]['sync'](this,_0x42896c[_0x9c9b('0x173')]);if(!_0x2bc4a9){return this[_0x9c9b('0x34')]['error'](_0x42896c,_0x9c9b('0x176'));}}var _0x425745='';if(this[_0x9c9b('0x8d')](_0x42896c[_0x9c9b('0x170')])){var _0x5b9848=this[_0x9c9b('0x1b')]['sync'](this,_0x42896c[_0x9c9b('0x170')]);if(_0x5b9848){_0x425745=_0x5b9848;}}this[_0x9c9b('0x33')]['sync'](this,_0x42896c,_0x2bc4a9);if(_0x42896c[_0x9c9b('0xee')]['indexOf']('x')<0x0){_0x42896c[_0x9c9b('0xee')]+='x';}if(_0x42896c[_0x9c9b('0xee')][_0x9c9b('0x177')]('X')<0x0){_0x42896c[_0x9c9b('0xee')]+='X';}this[_0x9c9b('0x34')][_0x9c9b('0xae')]('XMCS-QUEUE',_0x2bc4a9?_0x2bc4a9[_0x9c9b('0x178')]():'');var _0x5ea7b7=this['channel'][_0x9c9b('0xb9')](_0x9c9b('0x179'),[_0x2bc4a9,_0x42896c['opts'],_0x42896c['url'],_0x425745,_0x42896c[_0x9c9b('0x6f')],_0x42896c['agi'],_0x42896c[_0x9c9b('0x17a')],_0x42896c[_0x9c9b('0x17b')],'',_0x42896c[_0x9c9b('0x17c')]]);if(_0x5ea7b7[_0x9c9b('0xab')]===-0x1){return _0x5ea7b7;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xcb'),_0x9c9b('0x179'),_0x2bc4a9));};AGIVertices['prototype'][_0x9c9b('0x17d')]=function(_0x50b564){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x17e'),_0x50b564['label']));var _0x428817=_0x50b564['recordingFormat']||'wav';var _0x5df28e=util[_0x9c9b('0xa7')]('%s_%s',this[_0x9c9b('0x34')][_0x9c9b('0x35')],rs[_0x9c9b('0x11e')](0x5));var _0x19a1fd=util[_0x9c9b('0xa7')]('%s/recordings/%s.%s',FILES_PATH,_0x5df28e,_0x428817);var _0x5117dc=util['format'](_0x9c9b('0x13a'),FILES_PATH,_0x5df28e);this[_0x9c9b('0x3a')]['sync'](this,_0x50b564,_0x5df28e,_0x19a1fd);this[_0x9c9b('0x34')][_0x9c9b('0xae')](_0x9c9b('0x17f'),_0x5df28e);logger[_0x9c9b('0x2c')](_0x9c9b('0x180'),_0x5117dc,_0x428817,_0x50b564[_0x9c9b('0x181')],_0x50b564[_0x9c9b('0x6f')]);return this[_0x9c9b('0x34')]['recordFile'](_0x5117dc,_0x428817,_0x50b564[_0x9c9b('0x181')],_0x50b564[_0x9c9b('0x6f')],undefined,!![]);};AGIVertices['prototype'][_0x9c9b('0x182')]=function(_0x3b652f){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x183'),_0x3b652f[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x3b652f[_0x9c9b('0x6d')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x184'));}var _0x534561=this['restAPI'][_0x9c9b('0x77')](this,_0x3b652f);logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Response:',util[_0x9c9b('0x185')](_0x534561,{'showHidden':![],'depth':null})));if(!this[_0x9c9b('0x8d')](_0x3b652f[_0x9c9b('0xe2')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x186'));}var _0x2bd08b=this[_0x9c9b('0xc')][_0x9c9b('0x77')](this,_0x3b652f['variable_id']);if(!_0x2bd08b){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3b652f,_0x9c9b('0x11a'));}this[_0x9c9b('0x34')][_0x9c9b('0xae')](util[_0x9c9b('0xa7')](_0x9c9b('0x187'),_0x2bd08b),_0x534561['statusCode']?_0x534561[_0x9c9b('0x7e')]:_0x9c9b('0x188'));this[_0x9c9b('0x34')]['setVariable'](util[_0x9c9b('0xa7')](_0x9c9b('0x189'),_0x2bd08b),_0x534561[_0x9c9b('0x7d')]?_0x534561[_0x9c9b('0x7d')]:'OK');if(_0x534561[_0x9c9b('0x73')]){try{this[_0x9c9b('0xa6')](_0x534561['body'],_0x2bd08b);}catch(_0x141a46){logger[_0x9c9b('0x2a')](util['format'](_0x9c9b('0x18a'),_0x2bd08b));}}return this[_0x9c9b('0x34')]['noop'](util['format'](_0x9c9b('0xe7'),_0x2bd08b));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x18b')]=function(_0x377cc7){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x18c'),_0x377cc7[_0x9c9b('0x36')]));return this['channel'][_0x9c9b('0x18d')](_0x377cc7[_0x9c9b('0x18e')]['replace'](/\s+/g,''),_0x377cc7['escape_digits']);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x18f')]=function(_0x1c63ae){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x190'),_0x1c63ae[_0x9c9b('0x36')]));return this['channel'][_0x9c9b('0x191')](_0x1c63ae['number'][_0x9c9b('0x5f')](/\s+/g,''),_0x1c63ae[_0x9c9b('0x181')]);};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x192')]=function(_0x5080f2){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5080f2[_0x9c9b('0x36')]));return this[_0x9c9b('0x34')][_0x9c9b('0x193')](_0x5080f2['text'],_0x5080f2[_0x9c9b('0x181')]);};AGIVertices[_0x9c9b('0x12')]['sendMail']=function(_0x3540a2){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x194'),_0x3540a2[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x3540a2[_0x9c9b('0x195')])){return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x196'));}var _0xd65f76=this[_0x9c9b('0x1f')][_0x9c9b('0x77')](this,_0x3540a2[_0x9c9b('0x195')]);if(!_0xd65f76||!_0xd65f76[_0x9c9b('0x197')]){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3540a2,_0x9c9b('0x198'));}var _0x14e83d={'from':util[_0x9c9b('0xa7')](_0x9c9b('0x199'),_0xd65f76[_0x9c9b('0xe')],_0xd65f76['email']||_0xd65f76['Smtp'][_0x9c9b('0x19a')]),'to':_0x3540a2['to']||'','cc':_0x3540a2['cc']||'','bcc':_0x3540a2[_0x9c9b('0x19b')]||'','subject':_0x3540a2[_0x9c9b('0x19c')],'html':_0x3540a2[_0x9c9b('0x63')],'text':_0x3540a2[_0x9c9b('0x63')]};var _0xf7761b={'tls':{'rejectUnauthorized':![]}};if(_0xd65f76[_0x9c9b('0x197')][_0x9c9b('0x19d')]){_0xf7761b[_0x9c9b('0x19d')]=_0xd65f76[_0x9c9b('0x197')][_0x9c9b('0x19d')];}else{_0xf7761b[_0x9c9b('0x19e')]=_0xd65f76['Smtp'][_0x9c9b('0x19e')];_0xf7761b[_0x9c9b('0x19f')]=_0xd65f76['Smtp'][_0x9c9b('0x19f')];_0xf7761b['secure']=_0xd65f76[_0x9c9b('0x197')][_0x9c9b('0x1a0')];}if(_0xd65f76[_0x9c9b('0x197')][_0x9c9b('0x1a1')]){_0xf7761b[_0x9c9b('0x1a2')]={'user':_0xd65f76['Smtp']['user'],'pass':_0xd65f76['Smtp'][_0x9c9b('0x1a3')]};}if(this[_0x9c9b('0x8d')](_0x3540a2['template_id'])){}logger[_0x9c9b('0xe9')](_0x9c9b('0x1a4'),JSON[_0x9c9b('0x7b')](_0x14e83d));this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x3540a2,_0x3540a2['account_id']);this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xd65f76[_0x9c9b('0xe')]));this[_0x9c9b('0x21')][_0x9c9b('0x77')](this,_0xf7761b,_0x14e83d);return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x1a5'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1a6')]=function(_0x2c29be){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x1a7'),_0x2c29be[_0x9c9b('0x36')]));return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0x1a8'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1a9')]=function(_0x4a384e){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x1aa'),_0x4a384e[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x4a384e[_0x9c9b('0x1ab')])){return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0x1ac'));}var _0x1f4499=this[_0x9c9b('0x30')]['sync'](this,_0x4a384e[_0x9c9b('0x1ab')]);if(!_0x1f4499){return this['channel'][_0x9c9b('0x2a')](_0x4a384e,_0x9c9b('0x1ad'));}var _0xe62e50={'body':_0x4a384e['sms_text'],'phone':_0x4a384e['to']||'','SmsAccountId':_0x1f4499['id']};logger['debug']('sendSMS\x20message',JSON['stringify'](_0xe62e50));this['createSquareDetailsReport'][_0x9c9b('0x77')](this,_0x4a384e,_0x4a384e[_0x9c9b('0x1ab')]);this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x1ae'),_0x1f4499[_0x9c9b('0xe')]));this[_0x9c9b('0x32')][_0x9c9b('0x77')](this,_0xe62e50);return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x1af'));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1b0')]=function(_0x3ddec5){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x1b1'),_0x3ddec5['label']));if(!this[_0x9c9b('0x8d')](_0x3ddec5[_0x9c9b('0xe2')])){return this['channel']['error'](_0x3ddec5,_0x9c9b('0x1b2'));}var _0x3f0736=this['getVariable'][_0x9c9b('0x77')](this,_0x3ddec5['variable_id']);if(!_0x3f0736){return this[_0x9c9b('0x34')]['error'](_0x3ddec5,'no\x20variable\x20found');}return this[_0x9c9b('0x34')][_0x9c9b('0xae')](_0x3f0736,_0x3ddec5[_0x9c9b('0x1b3')]);};AGIVertices['prototype'][_0x9c9b('0x1b4')]=function(_0x1783f7){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x1b5'),_0x1783f7[_0x9c9b('0x36')]));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](_0x9c9b('0x1b6'));if(_0x1783f7[_0x9c9b('0xc1')]===_0x9c9b('0x1b7')){this[_0x9c9b('0x34')][_0x9c9b('0xb4')]('Answer');return this['channel']['answer']();}return this[_0x9c9b('0x34')]['noop'](_0x9c9b('0x1b8'));};AGIVertices['prototype'][_0x9c9b('0x1b9')]=function(_0x5b9b35){logger['info'](util[_0x9c9b('0xa7')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5b9b35['label']));if(!this[_0x9c9b('0x8d')](_0x5b9b35[_0x9c9b('0x1ba')])){return this['channel'][_0x9c9b('0x2a')](_0x5b9b35,_0x9c9b('0x1bb'));}var _0x5d3cff=this[_0x9c9b('0x13')][_0x9c9b('0x77')](this,_0x5b9b35[_0x9c9b('0x1ba')]);if(!this[_0x9c9b('0x8d')](_0x5d3cff)){return this[_0x9c9b('0x34')]['error'](_0x5b9b35,util[_0x9c9b('0xa7')](_0x9c9b('0x1bc'),_0x5b9b35['project_id']));}if(_0x5d3cff===this[_0x9c9b('0x34')]['arg_1']){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x5b9b35,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9c9b('0x33')][_0x9c9b('0x77')](this,_0x5b9b35,_0x5d3cff);var _0x33636b=this[_0x9c9b('0x34')][_0x9c9b('0xb9')](_0x9c9b('0x1bd'),util[_0x9c9b('0xa7')](_0x9c9b('0x1be'),config[_0x9c9b('0xbe')][_0x9c9b('0x19e')]||_0x9c9b('0x1bf'),_0x5d3cff,this[_0x9c9b('0x34')][_0x9c9b('0x38')]));if(_0x33636b[_0x9c9b('0xab')]===-0x1){return _0x33636b;}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')]('Executed\x20command\x20%s\x20%s','AGI',_0x5d3cff));};AGIVertices['prototype'][_0x9c9b('0x1c0')]=function(_0xd4f229){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xd4f229['label']));var _0x2cdb2f=this['shellCommand'][_0x9c9b('0x77')](this,_0xd4f229[_0x9c9b('0x1c1')]);this[_0x9c9b('0x33')]['sync'](this,_0xd4f229,_0xd4f229[_0x9c9b('0x1c1')]);if(this[_0x9c9b('0x8d')](_0xd4f229[_0x9c9b('0xe2')])){var _0x3088ff=this[_0x9c9b('0xc')]['sync'](this,_0xd4f229[_0x9c9b('0xe2')]);if(_0x3088ff){this[_0x9c9b('0x34')][_0x9c9b('0xae')](_0x3088ff,_0x2cdb2f);return this[_0x9c9b('0x34')]['noop'](util['format'](_0x9c9b('0x1c2'),_0xd4f229[_0x9c9b('0x1c1')],_0x3088ff));}}return this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x1c3'),_0xd4f229[_0x9c9b('0x1c1')]));};AGIVertices['prototype'][_0x9c9b('0x1c4')]=function(_0x3fe2d4){logger['info'](util[_0x9c9b('0xa7')](_0x9c9b('0x1c5'),_0x3fe2d4['label']));_0x3fe2d4[_0x9c9b('0x63')]=_0x3fe2d4[_0x9c9b('0x63')][_0x9c9b('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9c9b('0x8d')](_0x3fe2d4[_0x9c9b('0x61')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0x1c6'));}if(!this['isConfigured'](_0x3fe2d4[_0x9c9b('0x63')])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x1c7'),_0x3fe2d4['text']));var _0x4d7215=this[_0x9c9b('0x60')][_0x9c9b('0x77')](this,_0x3fe2d4);if(_0x4d7215){this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x1c8'),_0x4d7215));var _0x3889dd=this[_0x9c9b('0x34')][_0x9c9b('0x127')](_0x4d7215);try{fs[_0x9c9b('0x107')](_0x4d7215+'.wav');}catch(_0x10255b){logger[_0x9c9b('0x2a')](_0x10255b);}return _0x3889dd;}return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3fe2d4,_0x9c9b('0x1c9'));};AGIVertices['prototype'][_0x9c9b('0x1ca')]=function(_0x385764){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x1cb'),_0x385764[_0x9c9b('0x36')]));_0x385764[_0x9c9b('0x63')]=_0x385764['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9c9b('0x8d')](_0x385764['text'])){return this['channel'][_0x9c9b('0xb4')](_0x9c9b('0xb2'));}this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0x1cc'),_0x385764[_0x9c9b('0x63')]));var _0x4fbbb3=this[_0x9c9b('0x6a')][_0x9c9b('0x77')](this,_0x385764);if(_0x4fbbb3){this[_0x9c9b('0x34')]['noop'](util[_0x9c9b('0xa7')](_0x9c9b('0x1cd'),_0x4fbbb3));var _0xa95684=this[_0x9c9b('0x34')][_0x9c9b('0x127')](_0x4fbbb3);try{fs[_0x9c9b('0x107')](_0x4fbbb3+'.wav');}catch(_0x5c2dd8){logger[_0x9c9b('0x2a')](_0x5c2dd8);}return _0xa95684;}return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x385764,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9c9b('0x12')]['unpause']=function(_0x3699a4){logger[_0x9c9b('0x2c')](util['format'](_0x9c9b('0x1ce'),_0x3699a4[_0x9c9b('0x36')]));if(!this[_0x9c9b('0x8d')](_0x3699a4[_0x9c9b('0x158')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x3699a4,_0x9c9b('0x159'));}logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3699a4[_0x9c9b('0x158')]));var _0x19c25e=this['agentUnpause']['sync'](this,_0x3699a4['findBy']);if(_0x19c25e){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15b'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3699a4[_0x9c9b('0x158')]));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format'](_0x9c9b('0x15b'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3699a4[_0x9c9b('0x158')]));return{'code':0xc8,'result':_0x9c9b('0x15c')};}else{logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')](_0x9c9b('0x15d'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3699a4[_0x9c9b('0x158')]));this[_0x9c9b('0x34')][_0x9c9b('0xb4')](util['format'](_0x9c9b('0x15d'),this[_0x9c9b('0x34')][_0x9c9b('0x39')],_0x3699a4[_0x9c9b('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1cf')]=function(_0x1286f4){logger['info'](util['format'](_0x9c9b('0x1d0'),_0x1286f4[_0x9c9b('0x36')]));var _0x119e58=this['channel'][_0x9c9b('0xb9')](_0x9c9b('0x1d1'),[_0x1286f4[_0x9c9b('0x1d2')],_0x1286f4[_0x9c9b('0x81')]]);if(_0x119e58[_0x9c9b('0xab')]===-0x1){return _0x119e58;}return this['channel'][_0x9c9b('0xb4')](util[_0x9c9b('0xa7')](_0x9c9b('0xcb'),_0x9c9b('0x1d1'),_0x1286f4[_0x9c9b('0x1d2')]));};AGIVertices[_0x9c9b('0x12')][_0x9c9b('0x1d3')]=function(_0x5e3053){logger[_0x9c9b('0x2c')](util[_0x9c9b('0xa7')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5e3053['label']));if(!this[_0x9c9b('0x8d')](_0x5e3053[_0x9c9b('0xe2')])){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x5e3053,_0x9c9b('0x1b2'));}var _0xf7ba94=this[_0x9c9b('0xc')][_0x9c9b('0x77')](this,_0x5e3053['variable_id']);if(!_0xf7ba94){return this[_0x9c9b('0x34')][_0x9c9b('0x2a')](_0x5e3053,'no\x20variable\x20found');}var _0x833f01=this[_0x9c9b('0x34')][_0x9c9b('0xc')](_0xf7ba94);return{'code':0xc8,'result':_0x833f01[_0x9c9b('0xad')]?_0x833f01['extra']:'-'};};String['prototype'][_0x9c9b('0x1d4')]=function(_0x2bc943,_0xda24ac){return this[_0x9c9b('0xa9')](_0x2bc943)[_0x9c9b('0x1d5')](_0xda24ac);};module[_0x9c9b('0x1d6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e393877..9fd78bc 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 _0x0059=['[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','attended','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]'];(function(_0x23bf99,_0x1380d1){var _0x564811=function(_0x3766e8){while(--_0x3766e8){_0x23bf99['push'](_0x23bf99['shift']());}};_0x564811(++_0x1380d1);}(_0x0059,0x1be));var _0x9005=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x0059[_0x4c9380];return _0x49a523;};'use strict';var util=require('util');var _=require(_0x9005('0x0'));var moment=require(_0x9005('0x1'));var ami=require(_0x9005('0x2'));var logger=require(_0x9005('0x3'))(_0x9005('0x4'));var RpcUser=require(_0x9005('0x5'));var RpcVoiceAgentReport=require(_0x9005('0x6'));function Acw(_0x2df9de){this[_0x9005('0x7')]=_0x2df9de[_0x9005('0x7')];this[_0x9005('0x8')]=_0x2df9de[_0x9005('0x8')];this[_0x9005('0x9')]=_0x2df9de[_0x9005('0x9')];this['channels']={};ami['on'](_0x9005('0xa'),this['syncAgentConnect'][_0x9005('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x9005('0xb')](this));ami['on']('hangup',this[_0x9005('0xc')][_0x9005('0xb')](this));ami['on'](_0x9005('0xd'),this[_0x9005('0xe')]['bind'](this));ami['on'](_0x9005('0xf'),this[_0x9005('0x10')][_0x9005('0xb')](this));ami['on'](_0x9005('0x11'),this['syncBlindTransfer'][_0x9005('0xb')](this));ami['on'](_0x9005('0x12'),this[_0x9005('0x13')][_0x9005('0xb')](this));}function getDiff(_0x34a935){var _0x4fdd52=moment()['milliseconds'](0x0);var _0x52eb7e=moment(_0x34a935)['milliseconds'](0x0);return _0x4fdd52[_0x9005('0x14')](_0x52eb7e,_0x9005('0x15'));}Acw[_0x9005('0x16')][_0x9005('0x17')]=function(_0x3ef0ab){try{var _0x4ff24b=this;var _0x198121=this['channels'][_0x3ef0ab][_0x9005('0x18')];var _0x3e653a=this[_0x9005('0x19')][_0x3ef0ab][_0x9005('0x1a')];var _0x34bad8=this[_0x9005('0x7')][_0x3e653a];var _0xea2599=![];var _0x10ab95=_0x9005('0x1b');if(_0x34bad8[_0x9005('0x1c')]){if(_0x34bad8[_0x9005('0x1d')][_0x9005('0x1e')]){_0xea2599=!![];_0x10ab95=_0x34bad8[_0x9005('0x1d')][_0x9005('0x1e')];}}ami[_0x9005('0x1f')]({'action':_0x9005('0x20'),'interface':_0x198121,'paused':!![],'reason':_0x10ab95})[_0x9005('0x21')](function(_0x5f0b45){if(_0x4ff24b[_0x9005('0x8')][_0x198121]){return RpcUser[_0x9005('0x22')](_0x4ff24b['agents'][_0x198121]['id'])[_0x9005('0x21')](function(_0x366bdd){if(_0x366bdd&&!_0x366bdd[_0x9005('0x23')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x3ef0ab,_0x198121,_0x3e653a);var _0x246957=_0x4ff24b[_0x9005('0x19')][_0x3ef0ab]['attended']&&_0x4ff24b[_0x9005('0x19')][_0x3ef0ab][_0x9005('0x24')]?_0x4ff24b[_0x9005('0x19')][_0x3ef0ab][_0x9005('0x24')]:_0x3ef0ab;return RpcUser[_0x9005('0x25')](_0x4ff24b['agents'][_0x198121],_0x10ab95,_0x246957)[_0x9005('0x21')](function(_0x4c1d60){if(!_0xea2599){_0x4ff24b[_0x9005('0x9')][_0x198121]={};logger[_0x9005('0x26')](_0x9005('0x27'),_0x3ef0ab,_0x4ff24b['voiceQueues'][_0x3e653a][_0x9005('0x28')],_0x198121,_0x3e653a);_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x29')]=setTimeout(_0x4ff24b['stopAcw'][_0x9005('0xb')](_0x4ff24b,_0x198121),_0x4ff24b[_0x9005('0x7')][_0x3e653a][_0x9005('0x28')]*0x3e8);_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x2a')]=moment()[_0x9005('0x2b')](_0x9005('0x2c'));_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x2d')]=_0x3ef0ab;_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x1a')]=_0x3e653a;_0x4ff24b[_0x9005('0x9')][_0x198121]['updateAcw']=function(){var _0x4dcc79=getDiff(_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x2a')]);clearTimeout(_0x4ff24b[_0x9005('0x9')][_0x198121][_0x9005('0x29')]);_0x4ff24b['timers'][_0x198121][_0x9005('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x4dcc79},_0x4ff24b[_0x9005('0x9')][_0x198121]['uniqueid'],_0x198121)['then'](function(_0x14f604){logger[_0x9005('0x26')](_0x9005('0x2e'),_0x3ef0ab,_0x4dcc79,_0x14f604);})[_0x9005('0x2f')](function(_0x1069dd){logger[_0x9005('0x30')](_0x9005('0x31'),_0x3ef0ab,_0x1069dd);});delete _0x4ff24b['timers'][_0x198121];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x3ef0ab,_0x198121,_0x3e653a);}});}})[_0x9005('0x2f')](function(_0x3a2827){logger[_0x9005('0x30')](_0x9005('0x27'),_0x3ef0ab,_0x4ff24b[_0x9005('0x7')][_0x3e653a][_0x9005('0x28')],_0x198121,_0x3e653a);})[_0x9005('0x32')](function(){delete _0x4ff24b[_0x9005('0x19')][_0x3ef0ab];});}catch(_0xcf185b){logger[_0x9005('0x30')]('[ACW][START]\x20%s',_0xcf185b[_0x9005('0x33')]);}};Acw[_0x9005('0x16')][_0x9005('0x34')]=function(_0xbcc073){try{var _0x281561=this;if(_0x281561[_0x9005('0x9')][_0xbcc073]){_0x281561['timers'][_0xbcc073][_0x9005('0x29')]=![];var _0x5eb0a0=_0x281561[_0x9005('0x9')][_0xbcc073][_0x9005('0x2d')];var _0x5e74fd=_0x281561['timers'][_0xbcc073][_0x9005('0x1a')];var _0x368295=_0x281561[_0x9005('0x7')][_0x5e74fd][_0x9005('0x28')];logger[_0x9005('0x26')](_0x9005('0x35'),_0x5eb0a0,_0xbcc073);RpcUser['saveUnpause'](this[_0x9005('0x8')][_0xbcc073]);RpcVoiceAgentReport['update']({'acwtime':_0x368295,'agentacw':!![]},_0x5eb0a0,_0xbcc073)[_0x9005('0x21')](function(_0x2237ab){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x5eb0a0,_0x368295,_0x2237ab);})[_0x9005('0x2f')](function(_0x3de7c3){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x5eb0a0,_0x3de7c3);});}else{logger[_0x9005('0x30')](_0x9005('0x36'),_0xbcc073);if(_0x281561[_0x9005('0x9')]){logger[_0x9005('0x26')](_0x9005('0x37'),JSON[_0x9005('0x38')](_0x281561['timers']));}}}catch(_0xe76b0e){logger[_0x9005('0x30')]('[ACW][STOP]\x20%s',_0xe76b0e[_0x9005('0x33')]);}};Acw[_0x9005('0x16')][_0x9005('0x39')]=function(_0x2f3ff3){try{if(this[_0x9005('0x7')][_0x2f3ff3[_0x9005('0x1a')]]&&(this['voiceQueues'][_0x2f3ff3[_0x9005('0x1a')]][_0x9005('0x4')]||this[_0x9005('0x7')][_0x2f3ff3[_0x9005('0x1a')]][_0x9005('0x1c')])){if(this[_0x9005('0x8')][_0x2f3ff3[_0x9005('0x18')]]){this[_0x9005('0x19')][_0x2f3ff3[_0x9005('0x2d')]]={'queue':_0x2f3ff3[_0x9005('0x1a')],'interface':_0x2f3ff3['interface'],'destlinkedid':_0x2f3ff3[_0x9005('0x24')]};}}}catch(_0x481c94){logger[_0x9005('0x30')](_0x9005('0x3a'),_0x481c94[_0x9005('0x33')]);}};Acw['prototype'][_0x9005('0x13')]=function(_0x3f1ec5){try{if(this[_0x9005('0x7')][_0x3f1ec5[_0x9005('0x1a')]]&&(this[_0x9005('0x7')][_0x3f1ec5[_0x9005('0x1a')]][_0x9005('0x4')]||this['voiceQueues'][_0x3f1ec5[_0x9005('0x1a')]][_0x9005('0x1c')])){if(this[_0x9005('0x8')][_0x3f1ec5[_0x9005('0x18')]]){this[_0x9005('0x19')][_0x3f1ec5['uniqueid']]={'queue':_0x3f1ec5[_0x9005('0x1a')],'interface':_0x3f1ec5[_0x9005('0x18')]};}}}catch(_0x12c38e){logger['error'](_0x9005('0x3b'),_0x12c38e['message']);}};Acw[_0x9005('0x16')][_0x9005('0x3c')]=function(_0x4faaa2){try{if(this[_0x9005('0x19')][_0x4faaa2['uniqueid']]&&_['isUndefined'](this[_0x9005('0x19')][_0x4faaa2[_0x9005('0x2d')]]['attended'])){logger[_0x9005('0x26')](_0x9005('0x3d'),_0x4faaa2[_0x9005('0x2d')]);this[_0x9005('0x17')](_0x4faaa2[_0x9005('0x2d')]);}else if(this[_0x9005('0x19')][_0x4faaa2[_0x9005('0x3e')]]&&_['isUndefined'](this[_0x9005('0x19')][_0x4faaa2[_0x9005('0x3e')]]['attended'])){logger['info'](_0x9005('0x3f'),_0x4faaa2['linkedid']);this[_0x9005('0x17')](_0x4faaa2['linkedid']);}}catch(_0x5d136f){logger['error'](_0x9005('0x40'),_0x5d136f[_0x9005('0x33')]);}};Acw[_0x9005('0x16')][_0x9005('0xc')]=function(_0x5597c4){try{if(this[_0x9005('0x19')][_0x5597c4['uniqueid']]&&this['channels'][_0x5597c4[_0x9005('0x2d')]]['attended']){logger['info'](_0x9005('0x41'),_0x5597c4[_0x9005('0x2d')]);this[_0x9005('0x17')](_0x5597c4[_0x9005('0x2d')]);}else if(this[_0x9005('0x19')][_0x5597c4[_0x9005('0x3e')]]&&this[_0x9005('0x19')][_0x5597c4[_0x9005('0x3e')]][_0x9005('0x42')]){logger['info'](_0x9005('0x43'),_0x5597c4['linkedid']);this[_0x9005('0x17')](_0x5597c4[_0x9005('0x3e')]);}}catch(_0x51b308){logger[_0x9005('0x30')](_0x9005('0x44'),_0x51b308[_0x9005('0x33')]);}};Acw[_0x9005('0x16')][_0x9005('0x10')]=function(_0x31c3c4){try{if(!_[_0x9005('0x45')](this[_0x9005('0x19')][_0x31c3c4[_0x9005('0x46')]])){this[_0x9005('0x17')](_0x31c3c4[_0x9005('0x46')]);if(this['channels'][_0x31c3c4[_0x9005('0x47')]]){this[_0x9005('0x19')][_0x31c3c4['secondtransfereruniqueid']][_0x9005('0x42')]=!![];this[_0x9005('0x19')][_0x31c3c4[_0x9005('0x48')]]=this[_0x9005('0x19')][_0x31c3c4['secondtransfereruniqueid']];delete this['channels'][_0x31c3c4['secondtransfereruniqueid']];}}else if(!_[_0x9005('0x45')](this['channels'][_0x31c3c4[_0x9005('0x48')]])){this[_0x9005('0x17')](_0x31c3c4['transfertargetuniqueid']);if(this['channels'][_0x31c3c4[_0x9005('0x49')]]){this[_0x9005('0x19')][_0x31c3c4['origtransfereruniqueid']][_0x9005('0x42')]=!![];this[_0x9005('0x19')][_0x31c3c4['transfereeuniqueid']]=this[_0x9005('0x19')][_0x31c3c4[_0x9005('0x49')]];delete this[_0x9005('0x19')][_0x31c3c4[_0x9005('0x49')]];}}}catch(_0x258d7a){logger[_0x9005('0x30')](_0x9005('0x4a'),_0x258d7a[_0x9005('0x33')]);}};Acw[_0x9005('0x16')][_0x9005('0x4b')]=function(_0x5a1960){try{if(this['channels'][_0x5a1960[_0x9005('0x4c')]]){logger[_0x9005('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x5a1960[_0x9005('0x4c')]));this[_0x9005('0x17')](_0x5a1960[_0x9005('0x4c')]);}else if(this['channels'][_0x5a1960[_0x9005('0x4d')]]){logger['info'](_0x9005('0x4e'),JSON[_0x9005('0x38')](_0x5a1960[_0x9005('0x4d')]));this[_0x9005('0x17')](_0x5a1960[_0x9005('0x4d')]);}}catch(_0x22b63d){logger[_0x9005('0x30')](_0x9005('0x4f'),_0x22b63d[_0x9005('0x33')]);}};Acw[_0x9005('0x16')]['syncAgentRingNoAnswer']=function(_0x3f74f5){try{if(this['voiceQueues'][_0x3f74f5[_0x9005('0x1a')]]&&this[_0x9005('0x7')][_0x3f74f5[_0x9005('0x1a')]]['autopause']===_0x9005('0x50')){if(this[_0x9005('0x8')][_0x3f74f5[_0x9005('0x18')]]){logger['info'](_0x9005('0x51'),_0x3f74f5[_0x9005('0x2d')],_0x3f74f5[_0x9005('0x18')],_0x3f74f5[_0x9005('0x1a')]);return RpcUser[_0x9005('0x25')](this[_0x9005('0x8')][_0x3f74f5[_0x9005('0x18')]],_0x9005('0x52'),_0x3f74f5[_0x9005('0x2d')]);}}}catch(_0x29a59e){logger[_0x9005('0x30')](_0x9005('0x53'),_0x29a59e[_0x9005('0x33')]);}};module[_0x9005('0x54')]=Acw; \ No newline at end of file +var _0x15ed=['[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','ACW','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[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','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15ed,0xa9));var _0xd15e=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x15ed[_0x127a60];return _0xc1f6a3;};'use strict';var util=require(_0xd15e('0x0'));var _=require('lodash');var moment=require(_0xd15e('0x1'));var ami=require(_0xd15e('0x2'));var logger=require(_0xd15e('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xd15e('0x4'));function Acw(_0xc4f5a8){this[_0xd15e('0x5')]=_0xc4f5a8[_0xd15e('0x5')];this[_0xd15e('0x6')]=_0xc4f5a8[_0xd15e('0x6')];this[_0xd15e('0x7')]=_0xc4f5a8[_0xd15e('0x7')];this['channels']={};ami['on'](_0xd15e('0x8'),this[_0xd15e('0x9')][_0xd15e('0xa')](this));ami['on']('hanguprequest',this[_0xd15e('0xb')][_0xd15e('0xa')](this));ami['on'](_0xd15e('0xc'),this[_0xd15e('0xd')][_0xd15e('0xa')](this));ami['on'](_0xd15e('0xe'),this[_0xd15e('0xf')][_0xd15e('0xa')](this));ami['on'](_0xd15e('0x10'),this[_0xd15e('0x11')][_0xd15e('0xa')](this));ami['on'](_0xd15e('0x12'),this[_0xd15e('0x13')][_0xd15e('0xa')](this));ami['on'](_0xd15e('0x14'),this['syncAgentConnectPreview'][_0xd15e('0xa')](this));}function getDiff(_0x3bbf57){var _0x3ff568=moment()[_0xd15e('0x15')](0x0);var _0x138d57=moment(_0x3bbf57)['milliseconds'](0x0);return _0x3ff568[_0xd15e('0x16')](_0x138d57,'seconds');}Acw[_0xd15e('0x17')][_0xd15e('0x18')]=function(_0xf4a1af){try{var _0x443b71=this;var _0x57de4b=this[_0xd15e('0x19')][_0xf4a1af][_0xd15e('0x1a')];var _0x5c7063=this[_0xd15e('0x19')][_0xf4a1af]['queue'];var _0x5d4622=this[_0xd15e('0x5')][_0x5c7063];var _0xde2022=![];var _0x332464=_0xd15e('0x1b');if(_0x5d4622['mandatoryDisposition']){if(_0x5d4622[_0xd15e('0x1c')]['name']){_0xde2022=!![];_0x332464=_0x5d4622[_0xd15e('0x1c')]['name'];}}ami[_0xd15e('0x1d')]({'action':'QueuePause','interface':_0x57de4b,'paused':!![],'reason':_0x332464})[_0xd15e('0x1e')](function(_0x3057fa){if(_0x443b71[_0xd15e('0x6')][_0x57de4b]){return RpcUser[_0xd15e('0x1f')](_0x443b71['agents'][_0x57de4b]['id'])[_0xd15e('0x1e')](function(_0x356ace){if(_0x356ace&&!_0x356ace[_0xd15e('0x20')]){logger[_0xd15e('0x21')](_0xd15e('0x22'),_0xf4a1af,_0x57de4b,_0x5c7063);var _0x507306=_0x443b71[_0xd15e('0x19')][_0xf4a1af][_0xd15e('0x23')]&&_0x443b71[_0xd15e('0x19')][_0xf4a1af][_0xd15e('0x24')]?_0x443b71[_0xd15e('0x19')][_0xf4a1af]['destlinkedid']:_0xf4a1af;return RpcUser[_0xd15e('0x25')](_0x443b71['agents'][_0x57de4b],_0x332464,_0x507306)['then'](function(_0x577db5){if(!_0xde2022){_0x443b71['timers'][_0x57de4b]={};logger[_0xd15e('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xf4a1af,_0x443b71[_0xd15e('0x5')][_0x5c7063][_0xd15e('0x26')],_0x57de4b,_0x5c7063);_0x443b71[_0xd15e('0x7')][_0x57de4b]['timer']=setTimeout(_0x443b71[_0xd15e('0x27')][_0xd15e('0xa')](_0x443b71,_0x57de4b),_0x443b71[_0xd15e('0x5')][_0x5c7063][_0xd15e('0x26')]*0x3e8);_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x28')]=moment()[_0xd15e('0x29')](_0xd15e('0x2a'));_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x2b')]=_0xf4a1af;_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x2c')]=_0x5c7063;_0x443b71['timers'][_0x57de4b][_0xd15e('0x2d')]=function(){var _0x1880f0=getDiff(_0x443b71['timers'][_0x57de4b][_0xd15e('0x28')]);clearTimeout(_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x2e')]);_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x2e')]=![];RpcVoiceAgentReport[_0xd15e('0x2f')]({'acwtime':_0x1880f0},_0x443b71[_0xd15e('0x7')][_0x57de4b][_0xd15e('0x2b')],_0x57de4b)[_0xd15e('0x1e')](function(_0x16e975){logger['info'](_0xd15e('0x30'),_0xf4a1af,_0x1880f0,_0x16e975);})[_0xd15e('0x31')](function(_0x2713cf){logger[_0xd15e('0x32')]('[%s][UPDATE][ERRORS:%s]',_0xf4a1af,_0x2713cf);});delete _0x443b71[_0xd15e('0x7')][_0x57de4b];};}});}else{logger[_0xd15e('0x21')](_0xd15e('0x33'),_0xf4a1af,_0x57de4b,_0x5c7063);}});}})[_0xd15e('0x31')](function(_0x120e11){logger[_0xd15e('0x32')](_0xd15e('0x34'),_0xf4a1af,_0x443b71[_0xd15e('0x5')][_0x5c7063][_0xd15e('0x26')],_0x57de4b,_0x5c7063);})[_0xd15e('0x35')](function(){delete _0x443b71['channels'][_0xf4a1af];});}catch(_0x349b2a){logger['error'](_0xd15e('0x36'),_0x349b2a['message']);}};Acw[_0xd15e('0x17')][_0xd15e('0x27')]=function(_0x5eeb2c){try{var _0x166969=this;if(_0x166969[_0xd15e('0x7')][_0x5eeb2c]){_0x166969[_0xd15e('0x7')][_0x5eeb2c][_0xd15e('0x2e')]=![];var _0xaab40e=_0x166969[_0xd15e('0x7')][_0x5eeb2c][_0xd15e('0x2b')];var _0x49a575=_0x166969[_0xd15e('0x7')][_0x5eeb2c][_0xd15e('0x2c')];var _0x558c9c=_0x166969['voiceQueues'][_0x49a575][_0xd15e('0x26')];logger['info'](_0xd15e('0x37'),_0xaab40e,_0x5eeb2c);RpcUser['saveUnpause'](this['agents'][_0x5eeb2c]);RpcVoiceAgentReport[_0xd15e('0x2f')]({'acwtime':_0x558c9c,'agentacw':!![]},_0xaab40e,_0x5eeb2c)[_0xd15e('0x1e')](function(_0xa118b8){logger[_0xd15e('0x21')](_0xd15e('0x30'),_0xaab40e,_0x558c9c,_0xa118b8);})[_0xd15e('0x31')](function(_0x21051f){logger[_0xd15e('0x32')](_0xd15e('0x38'),_0xaab40e,_0x21051f);});}else{logger['error'](_0xd15e('0x39'),_0x5eeb2c);if(_0x166969[_0xd15e('0x7')]){logger[_0xd15e('0x21')](_0xd15e('0x3a'),JSON[_0xd15e('0x3b')](_0x166969[_0xd15e('0x7')]));}}}catch(_0x2ec9f2){logger['error']('[ACW][STOP]\x20%s',_0x2ec9f2[_0xd15e('0x3c')]);}};Acw[_0xd15e('0x17')][_0xd15e('0x9')]=function(_0x560079){try{if(this[_0xd15e('0x5')][_0x560079[_0xd15e('0x2c')]]&&(this[_0xd15e('0x5')][_0x560079[_0xd15e('0x2c')]][_0xd15e('0x3d')]||this[_0xd15e('0x5')][_0x560079[_0xd15e('0x2c')]][_0xd15e('0x3e')])){if(this[_0xd15e('0x6')][_0x560079[_0xd15e('0x1a')]]){this['channels'][_0x560079['uniqueid']]={'queue':_0x560079[_0xd15e('0x2c')],'interface':_0x560079['interface'],'destlinkedid':_0x560079[_0xd15e('0x24')]};}}}catch(_0x125b27){logger[_0xd15e('0x32')](_0xd15e('0x3f'),_0x125b27[_0xd15e('0x3c')]);}};Acw[_0xd15e('0x17')][_0xd15e('0x40')]=function(_0x396f2d){try{if(this[_0xd15e('0x5')][_0x396f2d[_0xd15e('0x2c')]]&&(this[_0xd15e('0x5')][_0x396f2d[_0xd15e('0x2c')]][_0xd15e('0x3d')]||this[_0xd15e('0x5')][_0x396f2d[_0xd15e('0x2c')]][_0xd15e('0x3e')])){if(this[_0xd15e('0x6')][_0x396f2d[_0xd15e('0x1a')]]){this[_0xd15e('0x19')][_0x396f2d[_0xd15e('0x2b')]]={'queue':_0x396f2d[_0xd15e('0x2c')],'interface':_0x396f2d[_0xd15e('0x1a')]};}}}catch(_0x1c823f){logger[_0xd15e('0x32')](_0xd15e('0x41'),_0x1c823f[_0xd15e('0x3c')]);}};Acw['prototype'][_0xd15e('0xb')]=function(_0xbc9e76){try{if(this[_0xd15e('0x19')][_0xbc9e76[_0xd15e('0x2b')]]&&_[_0xd15e('0x42')](this[_0xd15e('0x19')][_0xbc9e76['uniqueid']][_0xd15e('0x23')])){logger[_0xd15e('0x21')]('[%s][HANGUP:UNIQUEID]',_0xbc9e76[_0xd15e('0x2b')]);this[_0xd15e('0x18')](_0xbc9e76[_0xd15e('0x2b')]);}else if(this[_0xd15e('0x19')][_0xbc9e76['linkedid']]&&_['isUndefined'](this[_0xd15e('0x19')][_0xbc9e76[_0xd15e('0x43')]][_0xd15e('0x23')])){logger[_0xd15e('0x21')](_0xd15e('0x44'),_0xbc9e76[_0xd15e('0x43')]);this['startAcw'](_0xbc9e76[_0xd15e('0x43')]);}}catch(_0x1d67d3){logger['error'](_0xd15e('0x45'),_0x1d67d3[_0xd15e('0x3c')]);}};Acw[_0xd15e('0x17')][_0xd15e('0xd')]=function(_0x4897c1){try{if(this[_0xd15e('0x19')][_0x4897c1[_0xd15e('0x2b')]]&&this[_0xd15e('0x19')][_0x4897c1[_0xd15e('0x2b')]][_0xd15e('0x23')]){logger[_0xd15e('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4897c1[_0xd15e('0x2b')]);this[_0xd15e('0x18')](_0x4897c1['uniqueid']);}else if(this[_0xd15e('0x19')][_0x4897c1[_0xd15e('0x43')]]&&this[_0xd15e('0x19')][_0x4897c1['linkedid']][_0xd15e('0x23')]){logger[_0xd15e('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4897c1[_0xd15e('0x43')]);this[_0xd15e('0x18')](_0x4897c1[_0xd15e('0x43')]);}}catch(_0x5ed9e8){logger[_0xd15e('0x32')]('[ACW][syncHangup]\x20%s',_0x5ed9e8['message']);}};Acw[_0xd15e('0x17')][_0xd15e('0x11')]=function(_0x1cb116){try{if(!_[_0xd15e('0x46')](this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x47')]])){this[_0xd15e('0x18')](_0x1cb116[_0xd15e('0x47')]);if(this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x48')]]){this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x48')]]['attended']=!![];this['channels'][_0x1cb116[_0xd15e('0x49')]]=this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x48')]];delete this['channels'][_0x1cb116['secondtransfereruniqueid']];}}else if(!_[_0xd15e('0x46')](this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x49')]])){this[_0xd15e('0x18')](_0x1cb116[_0xd15e('0x49')]);if(this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x4a')]]){this['channels'][_0x1cb116[_0xd15e('0x4a')]]['attended']=!![];this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x47')]]=this[_0xd15e('0x19')][_0x1cb116['origtransfereruniqueid']];delete this[_0xd15e('0x19')][_0x1cb116[_0xd15e('0x4a')]];}}}catch(_0x8f8161){logger[_0xd15e('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x8f8161['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x23ad77){try{if(this[_0xd15e('0x19')][_0x23ad77['transfereruniqueid']]){logger[_0xd15e('0x21')](_0xd15e('0x4b'),JSON['stringify'](_0x23ad77[_0xd15e('0x4c')]));this['startAcw'](_0x23ad77[_0xd15e('0x4c')]);}else if(this['channels'][_0x23ad77[_0xd15e('0x4d')]]){logger[_0xd15e('0x21')](_0xd15e('0x4e'),JSON[_0xd15e('0x3b')](_0x23ad77[_0xd15e('0x4d')]));this[_0xd15e('0x18')](_0x23ad77['transfererlinkedid']);}}catch(_0xc7a2fe){logger[_0xd15e('0x32')](_0xd15e('0x4f'),_0xc7a2fe['message']);}};Acw['prototype'][_0xd15e('0xf')]=function(_0x436ae4){try{if(this['voiceQueues'][_0x436ae4[_0xd15e('0x2c')]]&&this[_0xd15e('0x5')][_0x436ae4['queue']]['autopause']==='all'){if(this[_0xd15e('0x6')][_0x436ae4[_0xd15e('0x1a')]]){logger[_0xd15e('0x21')](_0xd15e('0x50'),_0x436ae4[_0xd15e('0x2b')],_0x436ae4[_0xd15e('0x1a')],_0x436ae4[_0xd15e('0x2c')]);return RpcUser[_0xd15e('0x25')](this['agents'][_0x436ae4[_0xd15e('0x1a')]],_0xd15e('0x51'),_0x436ae4[_0xd15e('0x2b')]);}}}catch(_0x214a7b){logger[_0xd15e('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x214a7b[_0xd15e('0x3c')]);}};module[_0xd15e('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 10d6f84..7ce1530 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2032,0xd9));var _0x2203=function(_0x15eaa4,_0x4c1f83){_0x15eaa4=_0x15eaa4-0x0;var _0x36dfe8=_0x2032[_0x15eaa4];return _0x36dfe8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0x10af44,_0x512ceb){_0x10af44=_0x10af44-0x0;var _0x1661eb=_0x2032[_0x10af44];return _0x1661eb;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 3ea1890..04df088 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x27897f,_0x14bcc2){var _0x3f79d6=function(_0x580e2c){while(--_0x580e2c){_0x27897f['push'](_0x27897f['shift']());}};_0x3f79d6(++_0x14bcc2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5169d5,_0x54fe3d){_0x5169d5=_0x5169d5-0x0;var _0x130d16=_0xf4eb[_0x5169d5];return _0x130d16;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x4f6125,_0x5d2afc){_0x4f6125=_0x4f6125-0x0;var _0x383ddf=_0x70e0[_0x4f6125];return _0x383ddf;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index db2be74..ced0a70 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 _0x8489=['number','substring','voiceQueue','prototype','getQueue','queue','exports','util','lodash','moment','string','uniqueid','phone','Contact','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x230afe,_0x1d25ff){var _0x2308fe=function(_0x357178){while(--_0x357178){_0x230afe['push'](_0x230afe['shift']());}};_0x2308fe(++_0x1d25ff);}(_0x8489,0x8b));var _0x9848=function(_0x4ddac3,_0x5143db){_0x4ddac3=_0x4ddac3-0x0;var _0x25a1a8=_0x8489[_0x4ddac3];return _0x25a1a8;};'use strict';var util=require(_0x9848('0x0'));var _=require(_0x9848('0x1'));var moment=require(_0x9848('0x2'));function checkNameSurname(_0x5a20b3,_0x460e4f,_0x30ad6d){var _0x449518='';if(!_['isNil'](_0x460e4f)&&_0x9848('0x3')===typeof _0x460e4f){_0x449518+=_0x460e4f;}if(!_['isNil'](_0x30ad6d)&&_0x9848('0x3')===typeof _0x30ad6d){_0x449518+='\x20'+_0x30ad6d;}if(_0x449518!==''){return _0x449518;}return _0x5a20b3;}function Action(_0x116f8e,_0x1c1795,_0x36a689){this['voiceQueue']=_0x116f8e;this[_0x9848('0x4')]=_0x36a689||undefined;this['name']=checkNameSurname(_0x1c1795['Contact'][_0x9848('0x5')],_0x1c1795[_0x9848('0x6')][_0x9848('0x7')],_0x1c1795[_0x9848('0x6')][_0x9848('0x8')]);this['number']=_0x1c1795[_0x9848('0x5')];this['queue']=_0x116f8e['name'];this['active']=_0x1c1795[_0x9848('0x9')]||![];this[_0x9848('0xa')]=_0x116f8e[_0x9848('0xa')];this[_0x9848('0xb')]=_0x116f8e[_0x9848('0xb')]||0x3;this['scheduledat']=_0x1c1795[_0x9848('0xc')];this[_0x9848('0xd')]=_0x1c1795[_0x9848('0xd')];this[_0x9848('0xe')]=_0x1c1795['countcongestionretry'];this['countnoanswerretry']=_0x1c1795[_0x9848('0xf')];this[_0x9848('0x10')]=_0x1c1795[_0x9848('0x10')];this[_0x9848('0x11')]=_0x1c1795['countdropretry'];this['countabandonedretry']=_0x1c1795[_0x9848('0x12')];this[_0x9848('0x13')]=_0x1c1795['countmachineretry'];this['countagentrejectretry']=_0x1c1795[_0x9848('0x14')];this[_0x9848('0x15')]=_0x1c1795[_0x9848('0x15')];this['ListId']=_0x1c1795[_0x9848('0x16')];this[_0x9848('0x17')]=_0x1c1795['UserId'];this[_0x9848('0x18')]=_0x1c1795[_0x9848('0x18')];this[_0x9848('0x19')]=_0x1c1795[_0x9848('0x19')];this['idHopper']=_0x1c1795['id'];this[_0x9848('0x1a')]=_0x1c1795[_0x9848('0x6')]['firstName']||'';this[_0x9848('0x1b')]=moment()[_0x9848('0x1c')](_0x9848('0x1d'));this[_0x9848('0x1e')]=_0x1c1795[_0x9848('0x1e')];this[_0x9848('0x1f')]=_0x1c1795['callbackuniqueid'];this[_0x9848('0x20')]=_0x1c1795[_0x9848('0x20')];this['recallme']=_0x1c1795[_0x9848('0x21')];this[_0x9848('0x22')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x9848('0x1c')](_0x9848('0x23'),this['name'],this['voiceQueue'][_0x9848('0x24')]>0x0?this[_0x9848('0x25')][_0x9848('0x26')](this[_0x9848('0x27')]['dialCutDigit']):this[_0x9848('0x25')]);};Action[_0x9848('0x28')][_0x9848('0x29')]=function(){return this[_0x9848('0x2a')];};module[_0x9848('0x2b')]=Action; \ No newline at end of file +var _0xa8b4=['isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment'];(function(_0x10b7a5,_0xd3f792){var _0x1764b9=function(_0x4161c4){while(--_0x4161c4){_0x10b7a5['push'](_0x10b7a5['shift']());}};_0x1764b9(++_0xd3f792);}(_0xa8b4,0xad));var _0x4a8b=function(_0x4b9cb4,_0x1f18a8){_0x4b9cb4=_0x4b9cb4-0x0;var _0x335d39=_0xa8b4[_0x4b9cb4];return _0x335d39;};'use strict';var util=require(_0x4a8b('0x0'));var _=require(_0x4a8b('0x1'));var moment=require(_0x4a8b('0x2'));function checkNameSurname(_0x37ada3,_0x123208,_0x58ae0b){var _0x59aa6f='';if(!_[_0x4a8b('0x3')](_0x123208)&&_0x4a8b('0x4')===typeof _0x123208){_0x59aa6f+=_0x123208;}if(!_[_0x4a8b('0x3')](_0x58ae0b)&&_0x4a8b('0x4')===typeof _0x58ae0b){_0x59aa6f+='\x20'+_0x58ae0b;}if(_0x59aa6f!==''){return _0x59aa6f;}return _0x37ada3;}function Action(_0x11b465,_0x183d59,_0x9e0e2d){this[_0x4a8b('0x5')]=_0x11b465;this[_0x4a8b('0x6')]=_0x9e0e2d||undefined;this['name']=checkNameSurname(_0x183d59[_0x4a8b('0x7')][_0x4a8b('0x8')],_0x183d59[_0x4a8b('0x7')][_0x4a8b('0x9')],_0x183d59[_0x4a8b('0x7')][_0x4a8b('0xa')]);this[_0x4a8b('0xb')]=_0x183d59['phone'];this[_0x4a8b('0xc')]=_0x11b465[_0x4a8b('0xd')];this[_0x4a8b('0xe')]=_0x183d59['active']||![];this[_0x4a8b('0xf')]=_0x11b465[_0x4a8b('0xf')];this[_0x4a8b('0x10')]=_0x11b465[_0x4a8b('0x10')]||0x3;this['scheduledat']=_0x183d59[_0x4a8b('0x11')];this[_0x4a8b('0x12')]=_0x183d59[_0x4a8b('0x12')];this[_0x4a8b('0x13')]=_0x183d59[_0x4a8b('0x13')];this[_0x4a8b('0x14')]=_0x183d59[_0x4a8b('0x14')];this[_0x4a8b('0x15')]=_0x183d59[_0x4a8b('0x15')];this[_0x4a8b('0x16')]=_0x183d59[_0x4a8b('0x16')];this[_0x4a8b('0x17')]=_0x183d59['countabandonedretry'];this[_0x4a8b('0x18')]=_0x183d59[_0x4a8b('0x18')];this[_0x4a8b('0x19')]=_0x183d59[_0x4a8b('0x19')];this['ContactId']=_0x183d59['ContactId'];this['ListId']=_0x183d59[_0x4a8b('0x1a')];this['UserId']=_0x183d59['UserId'];this[_0x4a8b('0x1b')]=_0x183d59[_0x4a8b('0x1b')];this[_0x4a8b('0x1c')]=_0x183d59[_0x4a8b('0x1c')];this[_0x4a8b('0x1d')]=_0x183d59['id'];this[_0x4a8b('0x1e')]=_0x183d59['Contact'][_0x4a8b('0x9')]||'';this['starttime']=moment()[_0x4a8b('0x1f')](_0x4a8b('0x20'));this[_0x4a8b('0x21')]=_0x183d59['callback'];this[_0x4a8b('0x22')]=_0x183d59[_0x4a8b('0x22')];this[_0x4a8b('0x23')]=_0x183d59[_0x4a8b('0x23')];this[_0x4a8b('0x24')]=_0x183d59[_0x4a8b('0x24')];this[_0x4a8b('0x25')]='';this['originatecalleridname']='';}Action[_0x4a8b('0x26')][_0x4a8b('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x4a8b('0xd')],this[_0x4a8b('0x5')][_0x4a8b('0x28')]>0x0?this[_0x4a8b('0xb')][_0x4a8b('0x29')](this['voiceQueue'][_0x4a8b('0x28')]):this[_0x4a8b('0xb')]);};Action[_0x4a8b('0x26')][_0x4a8b('0x2a')]=function(){return this[_0x4a8b('0xc')];};module[_0x4a8b('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index d884556..0ccbd70 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86b5=['countagentrejectretry','calleridnum','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x2e5eb6,_0x47a7ca){var _0x1c2bbc=function(_0x44fb93){while(--_0x44fb93){_0x2e5eb6['push'](_0x2e5eb6['shift']());}};_0x1c2bbc(++_0x47a7ca);}(_0x86b5,0x88));var _0x586b=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x86b5[_0x2b55b5];return _0x103d28;};'use strict';var util=require(_0x586b('0x0'));var _=require(_0x586b('0x1'));var moment=require(_0x586b('0x2'));function getSeconds(_0x5c009b,_0x219758){var _0x1427af=moment(_0x5c009b)['milliseconds'](0x0);var _0x583176=moment(_0x219758)[_0x586b('0x3')](0x0);return _0x1427af[_0x586b('0x4')](_0x583176,_0x586b('0x5'));}function AdditionalPhone(_0x3ac844){this[_0x586b('0x6')]=_0x3ac844[_0x586b('0x6')];this[_0x586b('0x7')]=_0x3ac844[_0x586b('0x7')]||undefined;this[_0x586b('0x8')]=_0x3ac844[_0x586b('0x8')];this[_0x586b('0x9')]=_0x3ac844[_0x586b('0x8')]===_0x586b('0xa')?_0x586b('0xb'):_0x3ac844[_0x586b('0x8')];this[_0x586b('0xc')]=_0x3ac844[_0x586b('0xc')];this['countcongestionretry']=_0x3ac844[_0x586b('0xd')];this['countnoanswerretry']=_0x3ac844['countnoanswerretry'];this[_0x586b('0xe')]=_0x3ac844[_0x586b('0xc')]+_0x3ac844[_0x586b('0xd')]+_0x3ac844[_0x586b('0xf')]+_0x3ac844[_0x586b('0x10')]+_0x3ac844[_0x586b('0x11')]+_0x3ac844[_0x586b('0x12')]+_0x3ac844[_0x586b('0x13')]+_0x3ac844[_0x586b('0x14')];this[_0x586b('0x10')]=_0x3ac844[_0x586b('0x10')];this[_0x586b('0x11')]=_0x3ac844[_0x586b('0x11')];this[_0x586b('0x12')]=_0x3ac844['countabandonedretry'];this[_0x586b('0x13')]=_0x3ac844[_0x586b('0x13')];this[_0x586b('0x14')]=_0x3ac844['countagentrejectretry'];this[_0x586b('0xb')]=_0x3ac844[_0x586b('0xb')];this['calleridname']=_0x3ac844['name'];this[_0x586b('0x15')]=_0x3ac844[_0x586b('0x16')];this[_0x586b('0x17')]=_0x3ac844['starttime'];this['responsetime']=_0x3ac844[_0x586b('0x18')];this['endtime']=_0x3ac844[_0x586b('0x18')];this[_0x586b('0x19')]=getSeconds(_0x3ac844['responsetime'],_0x3ac844['starttime']);this['holdtime']=0x0;this[_0x586b('0x1a')]=0x0;this['callback']=_0x3ac844[_0x586b('0x1b')];this[_0x586b('0x1c')]=_0x3ac844[_0x586b('0x1c')];this[_0x586b('0x1d')]=_0x3ac844[_0x586b('0x1d')];this[_0x586b('0x1e')]=_0x3ac844[_0x586b('0x1e')];this[_0x586b('0x1f')]=_0x3ac844[_0x586b('0x1f')];this[_0x586b('0x20')]=_0x3ac844[_0x586b('0x20')];this[_0x586b('0x21')]=_0x3ac844[_0x586b('0x21')];this[_0x586b('0x22')]=_0x3ac844['VoiceQueueId'];this[_0x586b('0x23')]=_0x3ac844[_0x586b('0x23')];this[_0x586b('0x24')]=_0x3ac844[_0x586b('0x24')]||'';this[_0x586b('0x25')]=_0x3ac844[_0x586b('0x25')]||'';}module[_0x586b('0x26')]=History; \ No newline at end of file +var _0xf5bd=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff'];(function(_0x372d72,_0x9a8204){var _0x419175=function(_0x2f5866){while(--_0x2f5866){_0x372d72['push'](_0x372d72['shift']());}};_0x419175(++_0x9a8204);}(_0xf5bd,0x113));var _0xdf5b=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xf5bd[_0x7feb90];return _0x3c5b33;};'use strict';var util=require(_0xdf5b('0x0'));var _=require(_0xdf5b('0x1'));var moment=require(_0xdf5b('0x2'));function getSeconds(_0x16f7cb,_0x3990e4){var _0x474aef=moment(_0x16f7cb)[_0xdf5b('0x3')](0x0);var _0x3ea748=moment(_0x3990e4)[_0xdf5b('0x3')](0x0);return _0x474aef[_0xdf5b('0x4')](_0x3ea748,_0xdf5b('0x5'));}function AdditionalPhone(_0x332a51){this[_0xdf5b('0x6')]=_0x332a51[_0xdf5b('0x6')];this[_0xdf5b('0x7')]=_0x332a51['scheduledat']||undefined;this[_0xdf5b('0x8')]=_0x332a51[_0xdf5b('0x8')];this[_0xdf5b('0x9')]=_0x332a51[_0xdf5b('0x8')]===_0xdf5b('0xa')?_0xdf5b('0xb'):_0x332a51[_0xdf5b('0x8')];this[_0xdf5b('0xc')]=_0x332a51[_0xdf5b('0xc')];this[_0xdf5b('0xd')]=_0x332a51[_0xdf5b('0xd')];this[_0xdf5b('0xe')]=_0x332a51[_0xdf5b('0xe')];this['countglobal']=_0x332a51[_0xdf5b('0xc')]+_0x332a51['countcongestionretry']+_0x332a51[_0xdf5b('0xe')]+_0x332a51[_0xdf5b('0xf')]+_0x332a51[_0xdf5b('0x10')]+_0x332a51[_0xdf5b('0x11')]+_0x332a51['countmachineretry']+_0x332a51[_0xdf5b('0x12')];this[_0xdf5b('0xf')]=_0x332a51[_0xdf5b('0xf')];this[_0xdf5b('0x10')]=_0x332a51[_0xdf5b('0x10')];this[_0xdf5b('0x11')]=_0x332a51[_0xdf5b('0x11')];this[_0xdf5b('0x13')]=_0x332a51[_0xdf5b('0x13')];this[_0xdf5b('0x12')]=_0x332a51[_0xdf5b('0x12')];this[_0xdf5b('0xb')]=_0x332a51['queue'];this[_0xdf5b('0x14')]=_0x332a51[_0xdf5b('0x15')];this[_0xdf5b('0x16')]=_0x332a51[_0xdf5b('0x17')];this[_0xdf5b('0x18')]=_0x332a51[_0xdf5b('0x18')];this[_0xdf5b('0x19')]=_0x332a51[_0xdf5b('0x19')];this[_0xdf5b('0x1a')]=_0x332a51['responsetime'];this[_0xdf5b('0x1b')]=getSeconds(_0x332a51[_0xdf5b('0x19')],_0x332a51[_0xdf5b('0x18')]);this[_0xdf5b('0x1c')]=0x0;this[_0xdf5b('0x1d')]=0x0;this[_0xdf5b('0x1e')]=_0x332a51[_0xdf5b('0x1e')];this[_0xdf5b('0x1f')]=_0x332a51[_0xdf5b('0x1f')];this[_0xdf5b('0x20')]=_0x332a51[_0xdf5b('0x20')];this[_0xdf5b('0x21')]=_0x332a51['recallme'];this[_0xdf5b('0x22')]=_0x332a51['ContactId'];this['ListId']=_0x332a51['ListId'];this[_0xdf5b('0x23')]=_0x332a51[_0xdf5b('0x23')];this[_0xdf5b('0x24')]=_0x332a51[_0xdf5b('0x24')];this[_0xdf5b('0x25')]=_0x332a51[_0xdf5b('0x25')];this[_0xdf5b('0x26')]=_0x332a51[_0xdf5b('0x26')]||'';this[_0xdf5b('0x27')]=_0x332a51[_0xdf5b('0x27')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 7f09b32..0324b91 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 _0x09dd=['answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x09dd,0x1aa));var _0xd09d=function(_0x12e075,_0x2f6b9c){_0x12e075=_0x12e075-0x0;var _0xacd6dd=_0x09dd[_0x12e075];return _0xacd6dd;};'use strict';var util=require(_0xd09d('0x0'));var _=require(_0xd09d('0x1'));var moment=require(_0xd09d('0x2'));function getSeconds(_0x42ce41,_0xed4293){var _0x5f3063=moment(_0x42ce41)[_0xd09d('0x3')](0x0);var _0xb3d0cc=moment(_0xed4293)[_0xd09d('0x3')](0x0);return _0x5f3063['diff'](_0xb3d0cc,_0xd09d('0x4'));}function AgentComplete(_0x59d956,_0x1bd771){this[_0xd09d('0x5')]=0x4;this[_0xd09d('0x6')]=_0xd09d('0x7');this[_0xd09d('0x8')]=_0x59d956[_0xd09d('0x8')];this[_0xd09d('0x9')]=_0x59d956[_0xd09d('0x9')];this[_0xd09d('0xa')]=_0x59d956[_0xd09d('0x9')]==='outbound'?'queue':_0x59d956[_0xd09d('0x9')];this[_0xd09d('0xb')]=_0x59d956[_0xd09d('0xb')];this[_0xd09d('0xc')]=_0x59d956[_0xd09d('0xc')];this[_0xd09d('0xd')]=_0x59d956[_0xd09d('0xd')];this['countglobal']=_0x59d956[_0xd09d('0xb')]+_0x59d956[_0xd09d('0xc')]+_0x59d956[_0xd09d('0xd')]+_0x59d956['countnosuchnumberretry']+_0x59d956[_0xd09d('0xe')]+_0x59d956[_0xd09d('0xf')]+_0x59d956[_0xd09d('0x10')]+_0x59d956[_0xd09d('0x11')];this[_0xd09d('0x12')]=_0x59d956['countnosuchnumberretry'];this[_0xd09d('0xe')]=_0x59d956[_0xd09d('0xe')];this[_0xd09d('0xf')]=_0x59d956['countabandonedretry'];this[_0xd09d('0x10')]=_0x59d956[_0xd09d('0x10')];this[_0xd09d('0x11')]=_0x59d956[_0xd09d('0x11')];this[_0xd09d('0x13')]=_0x1bd771[_0xd09d('0x13')];this[_0xd09d('0x14')]=_0x59d956[_0xd09d('0x15')];this[_0xd09d('0x16')]=_0x59d956['number'];this[_0xd09d('0x17')]=_0x59d956[_0xd09d('0x17')];this['responsetime']=_0x59d956['responsetime'];this[_0xd09d('0x18')]=_0x59d956[_0xd09d('0x18')];this[_0xd09d('0x19')]=moment()['format'](_0xd09d('0x1a'));this[_0xd09d('0x1b')]=getSeconds(_0x59d956[_0xd09d('0x1c')],_0x59d956[_0xd09d('0x17')]);this[_0xd09d('0x1d')]=getSeconds(_0x59d956['answertime'],_0x59d956[_0xd09d('0x1c')]);this[_0xd09d('0x1e')]=getSeconds(this[_0xd09d('0x19')],_0x59d956[_0xd09d('0x18')]);this['queue']=_0x1bd771[_0xd09d('0x1f')];this[_0xd09d('0x20')]=_0x1bd771[_0xd09d('0x20')];this['reason']=_0x1bd771['reason'];this['callback']=_0x59d956[_0xd09d('0x21')];this[_0xd09d('0x22')]=_0x59d956[_0xd09d('0x22')];this[_0xd09d('0x23')]=_0x59d956[_0xd09d('0x23')];this[_0xd09d('0x24')]=_0x59d956[_0xd09d('0x24')];this[_0xd09d('0x25')]=_0x59d956[_0xd09d('0x25')];this[_0xd09d('0x26')]=_0x59d956[_0xd09d('0x26')];this[_0xd09d('0x27')]=_0x59d956['UserId'];this['VoiceQueueId']=_0x59d956[_0xd09d('0x28')];this['CampaignId']=_0x59d956[_0xd09d('0x29')];this[_0xd09d('0x2a')]=_0x59d956[_0xd09d('0x2a')]||'';this[_0xd09d('0x2b')]=_0x59d956[_0xd09d('0x2b')]||'';}module[_0xd09d('0x2c')]=AgentComplete; \ No newline at end of file +var _0x414c=['Answer','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x414c,0x12e));var _0xc414=function(_0x1b5bd1,_0x4a7437){_0x1b5bd1=_0x1b5bd1-0x0;var _0x5a45dd=_0x414c[_0x1b5bd1];return _0x5a45dd;};'use strict';var util=require(_0xc414('0x0'));var _=require(_0xc414('0x1'));var moment=require(_0xc414('0x2'));function getSeconds(_0x188b6f,_0x497a59){var _0x19cb64=moment(_0x188b6f)[_0xc414('0x3')](0x0);var _0x25c8b7=moment(_0x497a59)[_0xc414('0x3')](0x0);return _0x19cb64['diff'](_0x25c8b7,_0xc414('0x4'));}function AgentComplete(_0x564645,_0x83c13d){this[_0xc414('0x5')]=0x4;this['statedesc']=_0xc414('0x6');this['scheduledat']=_0x564645['scheduledat'];this[_0xc414('0x7')]=_0x564645[_0xc414('0x7')];this['campaigntype']=_0x564645['type']===_0xc414('0x8')?'queue':_0x564645[_0xc414('0x7')];this[_0xc414('0x9')]=_0x564645[_0xc414('0x9')];this[_0xc414('0xa')]=_0x564645[_0xc414('0xa')];this[_0xc414('0xb')]=_0x564645[_0xc414('0xb')];this['countglobal']=_0x564645['countbusyretry']+_0x564645[_0xc414('0xa')]+_0x564645[_0xc414('0xb')]+_0x564645[_0xc414('0xc')]+_0x564645[_0xc414('0xd')]+_0x564645[_0xc414('0xe')]+_0x564645['countmachineretry']+_0x564645[_0xc414('0xf')];this[_0xc414('0xc')]=_0x564645['countnosuchnumberretry'];this[_0xc414('0xd')]=_0x564645[_0xc414('0xd')];this['countabandonedretry']=_0x564645[_0xc414('0xe')];this[_0xc414('0x10')]=_0x564645[_0xc414('0x10')];this[_0xc414('0xf')]=_0x564645['countagentrejectretry'];this[_0xc414('0x11')]=_0x83c13d[_0xc414('0x11')];this[_0xc414('0x12')]=_0x564645['name'];this[_0xc414('0x13')]=_0x564645[_0xc414('0x14')];this['starttime']=_0x564645[_0xc414('0x15')];this[_0xc414('0x16')]=_0x564645['responsetime'];this['answertime']=_0x564645[_0xc414('0x17')];this[_0xc414('0x18')]=moment()['format'](_0xc414('0x19'));this[_0xc414('0x1a')]=getSeconds(_0x564645['responsetime'],_0x564645['starttime']);this[_0xc414('0x1b')]=getSeconds(_0x564645[_0xc414('0x17')],_0x564645[_0xc414('0x16')]);this[_0xc414('0x1c')]=getSeconds(this['endtime'],_0x564645[_0xc414('0x17')]);this[_0xc414('0x1d')]=_0x83c13d[_0xc414('0x1d')];this[_0xc414('0x1e')]=_0x83c13d[_0xc414('0x1e')];this[_0xc414('0x1f')]=_0x83c13d[_0xc414('0x1f')];this['callback']=_0x564645[_0xc414('0x20')];this[_0xc414('0x21')]=_0x564645[_0xc414('0x21')];this[_0xc414('0x22')]=_0x564645['callbackat'];this[_0xc414('0x23')]=_0x564645[_0xc414('0x23')];this[_0xc414('0x24')]=_0x564645[_0xc414('0x24')];this[_0xc414('0x25')]=_0x564645['ListId'];this['UserId']=_0x564645[_0xc414('0x26')];this[_0xc414('0x27')]=_0x564645[_0xc414('0x27')];this[_0xc414('0x28')]=_0x564645[_0xc414('0x28')];this[_0xc414('0x29')]=_0x564645['originatecalleridnum']||'';this[_0xc414('0x2a')]=_0x564645[_0xc414('0x2a')]||'';}module[_0xc414('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 18e2279..37f62e1 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 _0xca9e=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','calleridname','calleridnum','responsetime','endtime','ringtime'];(function(_0x69f3c1,_0x2e4abe){var _0x481a11=function(_0x31ee11){while(--_0x31ee11){_0x69f3c1['push'](_0x69f3c1['shift']());}};_0x481a11(++_0x2e4abe);}(_0xca9e,0x136));var _0xeca9=function(_0x52a85c,_0x4abeaa){_0x52a85c=_0x52a85c-0x0;var _0x7829fe=_0xca9e[_0x52a85c];return _0x7829fe;};'use strict';var util=require(_0xeca9('0x0'));var _=require(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));function getSeconds(_0x1c579d,_0x2df937){var _0x1443e3=moment(_0x1c579d)[_0xeca9('0x3')](0x0);var _0x2c6185=moment(_0x2df937)[_0xeca9('0x3')](0x0);return _0x1443e3[_0xeca9('0x4')](_0x2c6185,_0xeca9('0x5'));}function Final(_0x1c4ce6){this[_0xeca9('0x6')]=_0x1c4ce6[_0xeca9('0x6')];this['scheduledat']=_0x1c4ce6[_0xeca9('0x7')];this[_0xeca9('0x8')]=_0x1c4ce6['type'];this['campaigntype']=_0x1c4ce6[_0xeca9('0x8')]===_0xeca9('0x9')?_0xeca9('0xa'):_0x1c4ce6['type'];this[_0xeca9('0xb')]=_0x1c4ce6[_0xeca9('0xb')];this[_0xeca9('0xc')]=_0x1c4ce6[_0xeca9('0xc')];this[_0xeca9('0xd')]=_0x1c4ce6[_0xeca9('0xd')];this['countglobal']=_0x1c4ce6[_0xeca9('0xb')]+_0x1c4ce6[_0xeca9('0xc')]+_0x1c4ce6['countnoanswerretry']+_0x1c4ce6[_0xeca9('0xe')]+_0x1c4ce6['countdropretry']+_0x1c4ce6[_0xeca9('0xf')]+_0x1c4ce6[_0xeca9('0x10')]+_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xe')]=_0x1c4ce6[_0xeca9('0xe')];this[_0xeca9('0x11')]=_0x1c4ce6['countdropretry'];this[_0xeca9('0xf')]=_0x1c4ce6[_0xeca9('0xf')];this[_0xeca9('0x10')]=_0x1c4ce6[_0xeca9('0x10')];this['countagentrejectretry']=_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xa')]=_0x1c4ce6[_0xeca9('0xa')];this['calleridname']=_0x1c4ce6[_0xeca9('0x12')];this[_0xeca9('0x13')]=_0x1c4ce6['calleridnum'];this['starttime']=_0x1c4ce6['starttime'];this[_0xeca9('0x14')]=_0x1c4ce6[_0xeca9('0x14')];this[_0xeca9('0x15')]=_0x1c4ce6['responsetime'];this[_0xeca9('0x16')]=_0x1c4ce6['ringtime']||0x0;this['holdtime']=_0x1c4ce6[_0xeca9('0x17')]||0x0;this['talktime']=_0x1c4ce6[_0xeca9('0x18')]||0x0;this[_0xeca9('0x19')]=_0x1c4ce6['callback'];this[_0xeca9('0x1a')]=_0x1c4ce6[_0xeca9('0x1a')];this['callbackat']=_0x1c4ce6[_0xeca9('0x1b')];this['recallme']=_0x1c4ce6[_0xeca9('0x1c')];this[_0xeca9('0x1d')]=_0x1c4ce6[_0xeca9('0x1d')];this['ListId']=_0x1c4ce6[_0xeca9('0x1e')];this[_0xeca9('0x1f')]=_0x1c4ce6['UserId'];this[_0xeca9('0x20')]=_0x1c4ce6[_0xeca9('0x20')];this[_0xeca9('0x21')]=_0x1c4ce6[_0xeca9('0x21')];this['originatecalleridnum']=_0x1c4ce6[_0xeca9('0x22')]||'';this['originatecalleridname']=_0x1c4ce6[_0xeca9('0x23')]||'';}module[_0xeca9('0x24')]=Final; \ No newline at end of file +var _0xcb81=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue'];(function(_0x10985a,_0x5a1c42){var _0x96bb6d=function(_0x4173fb){while(--_0x4173fb){_0x10985a['push'](_0x10985a['shift']());}};_0x96bb6d(++_0x5a1c42);}(_0xcb81,0x154));var _0x1cb8=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xcb81[_0x15bc81];return _0x59440e;};'use strict';var util=require(_0x1cb8('0x0'));var _=require(_0x1cb8('0x1'));var moment=require('moment');function getSeconds(_0x1b571c,_0x4fb901){var _0x5e8697=moment(_0x1b571c)['milliseconds'](0x0);var _0x38c3ea=moment(_0x4fb901)[_0x1cb8('0x2')](0x0);return _0x5e8697[_0x1cb8('0x3')](_0x38c3ea,_0x1cb8('0x4'));}function Final(_0x41b867){this['uniqueid']=_0x41b867[_0x1cb8('0x5')];this[_0x1cb8('0x6')]=_0x41b867['scheduledat'];this[_0x1cb8('0x7')]=_0x41b867[_0x1cb8('0x7')];this[_0x1cb8('0x8')]=_0x41b867['type']===_0x1cb8('0x9')?'queue':_0x41b867['type'];this[_0x1cb8('0xa')]=_0x41b867[_0x1cb8('0xa')];this[_0x1cb8('0xb')]=_0x41b867[_0x1cb8('0xb')];this[_0x1cb8('0xc')]=_0x41b867[_0x1cb8('0xc')];this[_0x1cb8('0xd')]=_0x41b867[_0x1cb8('0xa')]+_0x41b867['countcongestionretry']+_0x41b867[_0x1cb8('0xc')]+_0x41b867[_0x1cb8('0xe')]+_0x41b867[_0x1cb8('0xf')]+_0x41b867[_0x1cb8('0x10')]+_0x41b867[_0x1cb8('0x11')]+_0x41b867['countagentrejectretry'];this[_0x1cb8('0xe')]=_0x41b867[_0x1cb8('0xe')];this[_0x1cb8('0xf')]=_0x41b867[_0x1cb8('0xf')];this[_0x1cb8('0x10')]=_0x41b867[_0x1cb8('0x10')];this[_0x1cb8('0x11')]=_0x41b867[_0x1cb8('0x11')];this['countagentrejectretry']=_0x41b867[_0x1cb8('0x12')];this['queue']=_0x41b867[_0x1cb8('0x13')];this[_0x1cb8('0x14')]=_0x41b867[_0x1cb8('0x14')];this[_0x1cb8('0x15')]=_0x41b867[_0x1cb8('0x15')];this[_0x1cb8('0x16')]=_0x41b867[_0x1cb8('0x16')];this[_0x1cb8('0x17')]=_0x41b867[_0x1cb8('0x17')];this[_0x1cb8('0x18')]=_0x41b867[_0x1cb8('0x17')];this[_0x1cb8('0x19')]=_0x41b867['ringtime']||0x0;this[_0x1cb8('0x1a')]=_0x41b867[_0x1cb8('0x1a')]||0x0;this[_0x1cb8('0x1b')]=_0x41b867[_0x1cb8('0x1b')]||0x0;this['callback']=_0x41b867[_0x1cb8('0x1c')];this['callbackuniqueid']=_0x41b867[_0x1cb8('0x1d')];this[_0x1cb8('0x1e')]=_0x41b867[_0x1cb8('0x1e')];this[_0x1cb8('0x1f')]=_0x41b867['recallme'];this['ContactId']=_0x41b867[_0x1cb8('0x20')];this[_0x1cb8('0x21')]=_0x41b867[_0x1cb8('0x21')];this[_0x1cb8('0x22')]=_0x41b867[_0x1cb8('0x22')];this[_0x1cb8('0x23')]=_0x41b867[_0x1cb8('0x23')];this['CampaignId']=_0x41b867[_0x1cb8('0x24')];this[_0x1cb8('0x25')]=_0x41b867[_0x1cb8('0x25')]||'';this[_0x1cb8('0x26')]=_0x41b867[_0x1cb8('0x26')]||'';}module[_0x1cb8('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 90e62e0..371c912 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 _0xef38=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0xeeb92,_0x2a08cb){var _0x3f6bab=function(_0xf84e61){while(--_0xf84e61){_0xeeb92['push'](_0xeeb92['shift']());}};_0x3f6bab(++_0x2a08cb);}(_0xef38,0x1e1));var _0x8ef3=function(_0x52c9e5,_0x4862b2){_0x52c9e5=_0x52c9e5-0x0;var _0x101ba7=_0xef38[_0x52c9e5];return _0x101ba7;};'use strict';var util=require(_0x8ef3('0x0'));var _=require(_0x8ef3('0x1'));var moment=require('moment');function getSeconds(_0xd0a72e,_0x4eb920){var _0x1e29b7=moment(_0xd0a72e)[_0x8ef3('0x2')](0x0);var _0x461993=moment(_0x4eb920)[_0x8ef3('0x2')](0x0);return _0x1e29b7[_0x8ef3('0x3')](_0x461993,'seconds');}function Hangup(_0x58bead,_0x22ba66){this[_0x8ef3('0x4')]=0x4;this['statedesc']=_0x8ef3('0x5');this['scheduledat']=_0x58bead[_0x8ef3('0x6')];this['type']=_0x58bead[_0x8ef3('0x7')];this[_0x8ef3('0x8')]=_0x58bead['type']===_0x8ef3('0x9')?_0x8ef3('0xa'):_0x58bead[_0x8ef3('0x7')];this[_0x8ef3('0xb')]=_0x58bead[_0x8ef3('0xb')];this[_0x8ef3('0xc')]=_0x58bead[_0x8ef3('0xc')];this[_0x8ef3('0xd')]=_0x58bead[_0x8ef3('0xd')];this[_0x8ef3('0xe')]=_0x58bead[_0x8ef3('0xb')]+_0x58bead[_0x8ef3('0xc')]+_0x58bead[_0x8ef3('0xd')]+_0x58bead[_0x8ef3('0xf')]+_0x58bead[_0x8ef3('0x10')]+_0x58bead[_0x8ef3('0x11')]+_0x58bead['countmachineretry']+_0x58bead['countagentrejectretry'];this[_0x8ef3('0xf')]=_0x58bead[_0x8ef3('0xf')];this['countdropretry']=_0x58bead[_0x8ef3('0x10')];this[_0x8ef3('0x11')]=_0x58bead[_0x8ef3('0x11')];this[_0x8ef3('0x12')]=_0x58bead['countmachineretry'];this[_0x8ef3('0x13')]=_0x58bead[_0x8ef3('0x13')];this['uniqueid']=_0x22ba66[_0x8ef3('0x14')];this[_0x8ef3('0x15')]=_0x58bead[_0x8ef3('0x16')];this[_0x8ef3('0x17')]=_0x58bead[_0x8ef3('0x18')];this[_0x8ef3('0x19')]=_0x58bead[_0x8ef3('0x19')];this['responsetime']=_0x58bead[_0x8ef3('0x1a')];this[_0x8ef3('0x1b')]=moment()[_0x8ef3('0x1c')](_0x8ef3('0x1d'));this[_0x8ef3('0x1e')]=getSeconds(_0x58bead['responsetime'],_0x58bead[_0x8ef3('0x19')]);this[_0x8ef3('0x1f')]=0x0;this[_0x8ef3('0x20')]=getSeconds(this[_0x8ef3('0x1b')],_0x58bead[_0x8ef3('0x1a')]);this['queue']=_0x58bead[_0x8ef3('0xa')];this[_0x8ef3('0x21')]='IVR';this[_0x8ef3('0x22')]=_0x22ba66[_0x8ef3('0x23')];this[_0x8ef3('0x24')]=_0x58bead[_0x8ef3('0x24')];this[_0x8ef3('0x25')]=_0x58bead[_0x8ef3('0x25')];this[_0x8ef3('0x26')]=_0x58bead['callbackat'];this[_0x8ef3('0x27')]=_0x58bead[_0x8ef3('0x27')];this[_0x8ef3('0x28')]=_0x58bead[_0x8ef3('0x28')];this['ListId']=_0x58bead[_0x8ef3('0x29')];this[_0x8ef3('0x2a')]=_0x58bead[_0x8ef3('0x2a')];this['VoiceQueueId']=_0x58bead[_0x8ef3('0x2b')];this[_0x8ef3('0x2c')]=_0x58bead[_0x8ef3('0x2c')];}module['exports']=Hangup; \ No newline at end of file +var _0x6e9c=['state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff'];(function(_0x46c845,_0x2d342b){var _0x5198ff=function(_0x2373d4){while(--_0x2373d4){_0x46c845['push'](_0x46c845['shift']());}};_0x5198ff(++_0x2d342b);}(_0x6e9c,0x128));var _0xc6e9=function(_0x476a7d,_0x399d71){_0x476a7d=_0x476a7d-0x0;var _0x33524f=_0x6e9c[_0x476a7d];return _0x33524f;};'use strict';var util=require(_0xc6e9('0x0'));var _=require(_0xc6e9('0x1'));var moment=require(_0xc6e9('0x2'));function getSeconds(_0x41e7c8,_0x25456c){var _0x3c67f7=moment(_0x41e7c8)[_0xc6e9('0x3')](0x0);var _0x5d5258=moment(_0x25456c)[_0xc6e9('0x3')](0x0);return _0x3c67f7[_0xc6e9('0x4')](_0x5d5258,'seconds');}function Hangup(_0x20cf7f,_0x34df6f){this[_0xc6e9('0x5')]=0x4;this['statedesc']='Answer';this[_0xc6e9('0x6')]=_0x20cf7f[_0xc6e9('0x6')];this['type']=_0x20cf7f[_0xc6e9('0x7')];this[_0xc6e9('0x8')]=_0x20cf7f[_0xc6e9('0x7')]==='outbound'?_0xc6e9('0x9'):_0x20cf7f['type'];this[_0xc6e9('0xa')]=_0x20cf7f[_0xc6e9('0xa')];this[_0xc6e9('0xb')]=_0x20cf7f[_0xc6e9('0xb')];this[_0xc6e9('0xc')]=_0x20cf7f[_0xc6e9('0xc')];this[_0xc6e9('0xd')]=_0x20cf7f['countbusyretry']+_0x20cf7f[_0xc6e9('0xb')]+_0x20cf7f[_0xc6e9('0xc')]+_0x20cf7f['countnosuchnumberretry']+_0x20cf7f['countdropretry']+_0x20cf7f['countabandonedretry']+_0x20cf7f[_0xc6e9('0xe')]+_0x20cf7f['countagentrejectretry'];this[_0xc6e9('0xf')]=_0x20cf7f[_0xc6e9('0xf')];this[_0xc6e9('0x10')]=_0x20cf7f[_0xc6e9('0x10')];this['countabandonedretry']=_0x20cf7f[_0xc6e9('0x11')];this[_0xc6e9('0xe')]=_0x20cf7f[_0xc6e9('0xe')];this[_0xc6e9('0x12')]=_0x20cf7f['countagentrejectretry'];this[_0xc6e9('0x13')]=_0x34df6f[_0xc6e9('0x13')];this[_0xc6e9('0x14')]=_0x20cf7f[_0xc6e9('0x15')];this['calleridnum']=_0x20cf7f['number'];this[_0xc6e9('0x16')]=_0x20cf7f['starttime'];this[_0xc6e9('0x17')]=_0x20cf7f[_0xc6e9('0x17')];this['endtime']=moment()[_0xc6e9('0x18')](_0xc6e9('0x19'));this[_0xc6e9('0x1a')]=getSeconds(_0x20cf7f[_0xc6e9('0x17')],_0x20cf7f[_0xc6e9('0x16')]);this[_0xc6e9('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xc6e9('0x1c')],_0x20cf7f['responsetime']);this[_0xc6e9('0x9')]=_0x20cf7f[_0xc6e9('0x9')];this[_0xc6e9('0x1d')]=_0xc6e9('0x1e');this[_0xc6e9('0x1f')]=_0x34df6f[_0xc6e9('0x20')];this[_0xc6e9('0x21')]=_0x20cf7f[_0xc6e9('0x21')];this[_0xc6e9('0x22')]=_0x20cf7f[_0xc6e9('0x22')];this['callbackat']=_0x20cf7f[_0xc6e9('0x23')];this[_0xc6e9('0x24')]=_0x20cf7f[_0xc6e9('0x24')];this[_0xc6e9('0x25')]=_0x20cf7f[_0xc6e9('0x25')];this[_0xc6e9('0x26')]=_0x20cf7f['ListId'];this[_0xc6e9('0x27')]=_0x20cf7f[_0xc6e9('0x27')];this[_0xc6e9('0x28')]=_0x20cf7f[_0xc6e9('0x28')];this[_0xc6e9('0x29')]=_0x20cf7f[_0xc6e9('0x29')];}module[_0xc6e9('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 55bf17b..2e85f80 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 _0xfd17=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xfd17,0x1ad));var _0x7fd1=function(_0x15fc07,_0x41cc0c){_0x15fc07=_0x15fc07-0x0;var _0x3d2c0f=_0xfd17[_0x15fc07];return _0x3d2c0f;};'use strict';var util=require('util');var _=require(_0x7fd1('0x0'));var moment=require('moment');function getSeconds(_0x199800,_0x490879){var _0x1d59df=moment(_0x199800)[_0x7fd1('0x1')](0x0);var _0x2c079=moment(_0x490879)[_0x7fd1('0x1')](0x0);return _0x1d59df[_0x7fd1('0x2')](_0x2c079,_0x7fd1('0x3'));}function History(_0xa2c246){this[_0x7fd1('0x4')]=_0xa2c246[_0x7fd1('0x4')];this[_0x7fd1('0x5')]=_0xa2c246[_0x7fd1('0x5')]||undefined;this[_0x7fd1('0x6')]=_0xa2c246[_0x7fd1('0x6')];this[_0x7fd1('0x7')]=_0xa2c246[_0x7fd1('0x6')]===_0x7fd1('0x8')?_0x7fd1('0x9'):_0xa2c246[_0x7fd1('0x6')];this['countbusyretry']=_0xa2c246['countbusyretry'];this[_0x7fd1('0xa')]=_0xa2c246['countcongestionretry'];this[_0x7fd1('0xb')]=_0xa2c246['countnoanswerretry'];this['countglobal']=_0xa2c246[_0x7fd1('0xc')]+_0xa2c246['countcongestionretry']+_0xa2c246[_0x7fd1('0xb')]+_0xa2c246['countnosuchnumberretry']+_0xa2c246[_0x7fd1('0xd')]+_0xa2c246['countabandonedretry']+_0xa2c246[_0x7fd1('0xe')]+_0xa2c246[_0x7fd1('0xf')];this['countnosuchnumberretry']=_0xa2c246[_0x7fd1('0x10')];this[_0x7fd1('0xd')]=_0xa2c246[_0x7fd1('0xd')];this[_0x7fd1('0x11')]=_0xa2c246[_0x7fd1('0x11')];this[_0x7fd1('0xe')]=_0xa2c246[_0x7fd1('0xe')];this['countagentrejectretry']=_0xa2c246[_0x7fd1('0xf')];this[_0x7fd1('0x9')]=_0xa2c246[_0x7fd1('0x9')];this[_0x7fd1('0x12')]=_0xa2c246[_0x7fd1('0x13')];this['calleridnum']=_0xa2c246['number'];this[_0x7fd1('0x14')]=_0xa2c246[_0x7fd1('0x14')];this[_0x7fd1('0x15')]=_0xa2c246[_0x7fd1('0x15')];this['endtime']=_0xa2c246[_0x7fd1('0x15')];this[_0x7fd1('0x16')]=getSeconds(_0xa2c246[_0x7fd1('0x15')],_0xa2c246[_0x7fd1('0x14')]);this['holdtime']=0x0;this[_0x7fd1('0x17')]=0x0;this[_0x7fd1('0x18')]=_0xa2c246[_0x7fd1('0x18')];this[_0x7fd1('0x19')]=_0xa2c246['callbackuniqueid'];this[_0x7fd1('0x1a')]=_0xa2c246[_0x7fd1('0x1a')];this['recallme']=_0xa2c246[_0x7fd1('0x1b')];this[_0x7fd1('0x1c')]=_0xa2c246[_0x7fd1('0x1c')];this[_0x7fd1('0x1d')]=_0xa2c246[_0x7fd1('0x1d')];this[_0x7fd1('0x1e')]=_0xa2c246['UserId'];this[_0x7fd1('0x1f')]=_0xa2c246[_0x7fd1('0x1f')];this[_0x7fd1('0x20')]=_0xa2c246[_0x7fd1('0x20')];this[_0x7fd1('0x21')]=_0xa2c246[_0x7fd1('0x21')]||'';this[_0x7fd1('0x22')]=_0xa2c246[_0x7fd1('0x22')]||'';}module[_0x7fd1('0x23')]=History; \ No newline at end of file +var _0x2e0a=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x4dbfb6,_0x7c84fc){var _0x4c9353=function(_0xd26415){while(--_0xd26415){_0x4dbfb6['push'](_0x4dbfb6['shift']());}};_0x4c9353(++_0x7c84fc);}(_0x2e0a,0x113));var _0xa2e0=function(_0x28809e,_0x11a958){_0x28809e=_0x28809e-0x0;var _0x1d9ef6=_0x2e0a[_0x28809e];return _0x1d9ef6;};'use strict';var util=require(_0xa2e0('0x0'));var _=require(_0xa2e0('0x1'));var moment=require(_0xa2e0('0x2'));function getSeconds(_0x40d7ec,_0x36d0b6){var _0x62af44=moment(_0x40d7ec)[_0xa2e0('0x3')](0x0);var _0x37f841=moment(_0x36d0b6)[_0xa2e0('0x3')](0x0);return _0x62af44['diff'](_0x37f841,_0xa2e0('0x4'));}function History(_0x5996c7){this['uniqueid']=_0x5996c7[_0xa2e0('0x5')];this[_0xa2e0('0x6')]=_0x5996c7[_0xa2e0('0x6')]||undefined;this[_0xa2e0('0x7')]=_0x5996c7[_0xa2e0('0x7')];this[_0xa2e0('0x8')]=_0x5996c7['type']===_0xa2e0('0x9')?_0xa2e0('0xa'):_0x5996c7[_0xa2e0('0x7')];this['countbusyretry']=_0x5996c7[_0xa2e0('0xb')];this[_0xa2e0('0xc')]=_0x5996c7[_0xa2e0('0xc')];this[_0xa2e0('0xd')]=_0x5996c7[_0xa2e0('0xd')];this[_0xa2e0('0xe')]=_0x5996c7[_0xa2e0('0xb')]+_0x5996c7['countcongestionretry']+_0x5996c7['countnoanswerretry']+_0x5996c7[_0xa2e0('0xf')]+_0x5996c7[_0xa2e0('0x10')]+_0x5996c7[_0xa2e0('0x11')]+_0x5996c7['countmachineretry']+_0x5996c7[_0xa2e0('0x12')];this[_0xa2e0('0xf')]=_0x5996c7[_0xa2e0('0xf')];this['countdropretry']=_0x5996c7[_0xa2e0('0x10')];this['countabandonedretry']=_0x5996c7['countabandonedretry'];this[_0xa2e0('0x13')]=_0x5996c7[_0xa2e0('0x13')];this[_0xa2e0('0x12')]=_0x5996c7[_0xa2e0('0x12')];this[_0xa2e0('0xa')]=_0x5996c7[_0xa2e0('0xa')];this[_0xa2e0('0x14')]=_0x5996c7['name'];this['calleridnum']=_0x5996c7['number'];this[_0xa2e0('0x15')]=_0x5996c7[_0xa2e0('0x15')];this[_0xa2e0('0x16')]=_0x5996c7[_0xa2e0('0x16')];this[_0xa2e0('0x17')]=_0x5996c7[_0xa2e0('0x16')];this[_0xa2e0('0x18')]=getSeconds(_0x5996c7[_0xa2e0('0x16')],_0x5996c7['starttime']);this[_0xa2e0('0x19')]=0x0;this['talktime']=0x0;this[_0xa2e0('0x1a')]=_0x5996c7[_0xa2e0('0x1a')];this[_0xa2e0('0x1b')]=_0x5996c7[_0xa2e0('0x1b')];this[_0xa2e0('0x1c')]=_0x5996c7[_0xa2e0('0x1c')];this[_0xa2e0('0x1d')]=_0x5996c7[_0xa2e0('0x1d')];this[_0xa2e0('0x1e')]=_0x5996c7[_0xa2e0('0x1e')];this[_0xa2e0('0x1f')]=_0x5996c7[_0xa2e0('0x1f')];this[_0xa2e0('0x20')]=_0x5996c7[_0xa2e0('0x20')];this[_0xa2e0('0x21')]=_0x5996c7['VoiceQueueId'];this['CampaignId']=_0x5996c7['CampaignId'];this['originatecalleridnum']=_0x5996c7[_0xa2e0('0x22')]||'';this[_0xa2e0('0x23')]=_0x5996c7[_0xa2e0('0x23')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7a028a6..e2f6523 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 _0x1f60=['loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgTalktime','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','[uniqueid]','clearZombieChannels','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[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','loggerHandler','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','isNil','variable','xcally-motion-dialer','dialAMDActive','value','uniqueid','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','voiceQueue','dialDropMaxRetry','additional','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','starttime','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','Action','command','iftime\x20%s,%s','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','checkPreviewRecallReminder','length','Agent','user:dialPreviewRecallReminder','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','XMD-','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','callAdditionalPhoneAfterMin','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','dialBusyRetryFrequency','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RecallFailedTimeout','saveInDb','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','ACTIVE','emptyContact','[actionOriginate]\x20','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','util','lodash','uuid','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting'];(function(_0x3425f9,_0x2358ca){var _0x814f39=function(_0x4cb267){while(--_0x4cb267){_0x3425f9['push'](_0x3425f9['shift']());}};_0x814f39(++_0x2358ca);}(_0x1f60,0x1bf));var _0x01f6=function(_0x152a8c,_0x260c63){_0x152a8c=_0x152a8c-0x0;var _0x514342=_0x1f60[_0x152a8c];return _0x514342;};'use strict';var util=require(_0x01f6('0x0'));var _=require(_0x01f6('0x1'));var BPromise=require('bluebird');var uuid=require(_0x01f6('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x01f6('0x3'));var ut=require(_0x01f6('0x4'));var config=require(_0x01f6('0x5'));var logger=require(_0x01f6('0x6'))(_0x01f6('0x7'));var loggerBooked=require('../../../config/logger')(_0x01f6('0x8'));var loggerPredictive=require(_0x01f6('0x6'))(_0x01f6('0x9'));var loggerPredictiveCalls=require(_0x01f6('0x6'))(_0x01f6('0xa'));var loggerSyncQueueSummary=require(_0x01f6('0x6'))(_0x01f6('0xb'));var ami=require(_0x01f6('0xc'));config[_0x01f6('0xd')]=_[_0x01f6('0xe')](config[_0x01f6('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x01f6('0xf'))(new Redis(config[_0x01f6('0xd')]));var cmHopper=require(_0x01f6('0x10'));var cmHopperHistory=require(_0x01f6('0x11'));var cmHopperFinal=require(_0x01f6('0x12'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x01f6('0x13'));var voiceQueueRt=require(_0x01f6('0x14'));var RpcSetting=require(_0x01f6('0x15'));var Action=require(_0x01f6('0x16'));var History=require(_0x01f6('0x17'));var Final=require(_0x01f6('0x18'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x01f6('0x19'));var Hangup=require(_0x01f6('0x1a'));var ipAgi=process[_0x01f6('0x1b')][_0x01f6('0x1c')]||_0x01f6('0x1d');var strategy={'rrmemory':_0x01f6('0x1e'),'roundrobin':_0x01f6('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x01f6('0x20')][_0x01f6('0x21')]=function(_0x33de1f){this['tail']=this['tail']?this[_0x01f6('0x22')]['finally'](_0x33de1f):_0x33de1f();};function Dialer(_0x49ae84,_0x2693a2){this[_0x01f6('0x23')]=new Sequence();this[_0x01f6('0x24')]=_0x2693a2;this[_0x01f6('0x25')]=_0x49ae84['voiceQueues'];this[_0x01f6('0x26')]=_0x49ae84[_0x01f6('0x26')];this[_0x01f6('0x27')]=_0x49ae84[_0x01f6('0x27')];this[_0x01f6('0x28')]=_0x49ae84['trunks'];this[_0x01f6('0x29')]=config['maxNumberOriginate']||0x2;this[_0x01f6('0x2a')]={};this[_0x01f6('0x2b')]={};this[_0x01f6('0x2c')]={};this[_0x01f6('0x2d')]={};this['optionPredictive']={};this[_0x01f6('0x2e')]={};this['startProgressive']={};this[_0x01f6('0x2f')]={};this[_0x01f6('0x30')]={};this[_0x01f6('0x31')]={};ami['on']('agentconnect',this[_0x01f6('0x32')][_0x01f6('0x33')](this));ami['on'](_0x01f6('0x34'),this[_0x01f6('0x35')]['bind'](this));ami['on']('originateresponse',this[_0x01f6('0x36')][_0x01f6('0x33')](this));ami['on']('agentcomplete',this[_0x01f6('0x37')][_0x01f6('0x33')](this));ami['on'](_0x01f6('0x38'),this['syncQueueSummary']['bind'](this));ami['on'](_0x01f6('0x39'),this[_0x01f6('0x3a')][_0x01f6('0x33')](this));ami['on']('newexten',this[_0x01f6('0x3b')][_0x01f6('0x33')](this));ami['on']('varset',this['syncVarSet'][_0x01f6('0x33')](this));ami['on'](_0x01f6('0x3c'),this[_0x01f6('0x3d')][_0x01f6('0x33')](this));ami['on']('queuestatuscomplete',this[_0x01f6('0x3e')][_0x01f6('0x33')](this));this[_0x01f6('0x3f')]();this[_0x01f6('0x40')]();RpcSetting[_0x01f6('0x41')]()[_0x01f6('0x42')](function(_0x26b9ba){previewRecallmeReminderInterval=_0x26b9ba[_0x01f6('0x43')];});}function isNotNull(_0x32cd68){return _0x32cd68!==null&&!_['isUndefined'](_0x32cd68);}function checkIsLoggedIn(_0x29df4e,_0x52e197){return function(){if(_0x52e197<=0x0){_0x29df4e[_0x01f6('0x44')]=_0x01f6('0x45');throw _0x29df4e['name']+_0x01f6('0x46');}};}function isActive(_0x27b773){return _0x27b773;}function checkIsActive(_0xcf55c7,_0x2a387e){return function(){if(!isActive(_0x2a387e)){_0xcf55c7[_0x01f6('0x44')]=_0x01f6('0x47');throw _0xcf55c7[_0x01f6('0x48')]+_0x01f6('0x49');}};}function checkInterval(_0x316100){return function(){if(!isNotNull(_0x316100['Interval'])){_0x316100[_0x01f6('0x44')]=_0x01f6('0x4a');throw _0x316100[_0x01f6('0x48')]+_0x01f6('0x4b');}if(!isNotNull(_0x316100[_0x01f6('0x4c')][_0x01f6('0x4d')])){_0x316100[_0x01f6('0x44')]='INTERVAL_IS_NULL';throw _0x316100[_0x01f6('0x48')]+_0x01f6('0x4b');}if(!isNotNull(_[_0x01f6('0x4e')](_0x316100['Interval'][_0x01f6('0x4d')]))){_0x316100[_0x01f6('0x44')]='INTERVAL_IS_NULL';throw _0x316100[_0x01f6('0x48')]+_0x01f6('0x4b');}};}function msgResponse(_0x5bb4b2,_0x27c38c,_0x145739){return{'action':_0x5bb4b2,'response':_0x27c38c,'message':_0x145739,'stack':_0x145739};}function myreject(_0x4c15c4){return function(_0x19f509){return _0x4c15c4(msgResponse(_0x01f6('0x4f'),_0x01f6('0x50'),JSON[_0x01f6('0x51')](_0x19f509)));};}function getSeconds(_0x2bc278,_0x36bab8){var _0x562ddd=moment(_0x2bc278)[_0x01f6('0x52')](0x0);var _0x53e9a7=moment(_0x36bab8)[_0x01f6('0x52')](0x0);return _0x562ddd[_0x01f6('0x53')](_0x53e9a7,_0x01f6('0x54'));}function emit(_0x36a8e3,_0x2869ab,_0x5ced7d){io['to'](_0x36a8e3)[_0x01f6('0x55')](_0x2869ab,_0x5ced7d);}function emitVoiceQueueSummary(_0x374f46){if(_0x374f46[_0x01f6('0x56')]===_0x01f6('0x57')){var _0x4f163c={'id':_0x374f46['id'],'name':_0x374f46[_0x01f6('0x48')],'strategy':_0x374f46[_0x01f6('0x58')],'answered':_0x374f46['answered'],'available':_0x374f46[_0x01f6('0x59')],'loggedIn':_0x374f46[_0x01f6('0x5a')],'pTalking':_0x374f46[_0x01f6('0x5b')],'sumBillable':_0x374f46['sumBillable'],'sumDuration':_0x374f46[_0x01f6('0x5c')],'sumHoldTime':_0x374f46[_0x01f6('0x5d')]||0x0,'talking':_0x374f46[_0x01f6('0x5e')],'total':_0x374f46[_0x01f6('0x5f')],'type':_0x374f46[_0x01f6('0x56')],'unmanaged':_0x374f46[_0x01f6('0x60')],'abandoned':_0x374f46[_0x01f6('0x61')],'waiting':_0x374f46[_0x01f6('0x62')],'loggedInDb':_0x374f46[_0x01f6('0x63')],'dialActive':_0x374f46[_0x01f6('0x64')],'dialMethod':_0x374f46[_0x01f6('0x65')],'dialOriginateCallerIdName':_0x374f46[_0x01f6('0x66')],'dialOriginateCallerIdNumber':_0x374f46[_0x01f6('0x67')],'dialOriginateTimeout':_0x374f46[_0x01f6('0x68')],'dialPrefix':_0x374f46[_0x01f6('0x69')],'outboundAnswerAgiCallsDay':_0x374f46['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x374f46[_0x01f6('0x6a')],'outboundBlacklistCallsDay':_0x374f46[_0x01f6('0x6b')],'outboundBusyCallsDay':_0x374f46[_0x01f6('0x6c')],'outboundCongestionCallsDay':_0x374f46[_0x01f6('0x6d')],'outboundDropCallsDayACS':_0x374f46[_0x01f6('0x6e')],'outboundDropCallsDayCallersExit':_0x374f46[_0x01f6('0x6f')],'outboundDropCallsDayTimeout':_0x374f46[_0x01f6('0x70')],'outboundNoAnswerCallsDay':_0x374f46[_0x01f6('0x71')],'outboundNoSuchCallsDay':_0x374f46[_0x01f6('0x72')],'outboundOriginateFailureCallsDay':_0x374f46[_0x01f6('0x73')],'outboundReCallsDay':_0x374f46[_0x01f6('0x74')],'outboundRejectCallsDay':_0x374f46[_0x01f6('0x75')],'outboundUnknownCallsDay':_0x374f46[_0x01f6('0x76')],'predictiveIntervalAnsweredCalls':_0x374f46[_0x01f6('0x77')],'predictiveIntervalAvgHoldtime':_0x374f46[_0x01f6('0x78')],'predictiveIntervalAvgTalktime':_0x374f46['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x374f46[_0x01f6('0x79')],'predictiveIntervalDroppedCallsTimeout':_0x374f46['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x374f46[_0x01f6('0x7a')],'predictiveIntervalErlangCallsDroppedCalls':_0x374f46['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x374f46[_0x01f6('0x7b')],'predictiveIntervalMultiplicativeFactor':_0x374f46[_0x01f6('0x7c')],'predictiveIntervalPauses':_0x374f46[_0x01f6('0x7d')],'predictiveIntervalAvailable':_0x374f46['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x374f46[_0x01f6('0x7e')],'message':_0x374f46[_0x01f6('0x44')],'originated':_0x374f46[_0x01f6('0x7f')],'erlangCalls':_0x374f46[_0x01f6('0x80')],'erlangCallToSecond':_0x374f46[_0x01f6('0x81')],'erlangAbandonmentRate':_0x374f46[_0x01f6('0x82')],'erlangBusyFactor':_0x374f46[_0x01f6('0x83')],'startPredictive':_0x374f46['startPredictive'],'startProgressive':_0x374f46[_0x01f6('0x84')]};if(_0x374f46[_0x01f6('0x85')]){_0x4f163c['Trunk']={'id':_0x374f46[_0x01f6('0x85')]['id'],'name':_0x374f46['Trunk']['name'],'active':_0x374f46[_0x01f6('0x85')][_0x01f6('0x86')],'callerid':_0x374f46[_0x01f6('0x85')]['callerid']};}if(_0x374f46[_0x01f6('0x4c')]){_0x4f163c[_0x01f6('0x4c')]={'id':_0x374f46[_0x01f6('0x4c')]['id'],'name':_0x374f46[_0x01f6('0x4c')][_0x01f6('0x48')]};}var _0x303149=md5(JSON['stringify'](_0x4f163c));if(_0x374f46[_0x01f6('0x87')]!==_0x303149){_0x374f46['md5']=_0x303149;emit(util[_0x01f6('0x88')](_0x01f6('0x89'),_0x4f163c[_0x01f6('0x48')]),_0x01f6('0x8a'),_0x4f163c);}}}function emitCampaignSummary(_0x45cbf4){if(_0x45cbf4[_0x01f6('0x56')]===_0x01f6('0x8b')){emit(util[_0x01f6('0x88')](_0x01f6('0x8c'),_0x45cbf4[_0x01f6('0x48')]),'campaign:save',_0x45cbf4);}}function checkGetDataPredictive(_0x1a61b8){if(isNotNull(_0x1a61b8)&&!_[_0x01f6('0x4e')](_0x1a61b8)){loggerPredictive['info'](_0x01f6('0x8d'));loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x8f'),_0x1a61b8[_0x01f6('0x7e')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x90'),_0x1a61b8[_0x01f6('0x77')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x91'),_0x1a61b8[_0x01f6('0x92')]);loggerPredictive['info'](_0x01f6('0x93'),_0x1a61b8[_0x01f6('0x79')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x94'),_0x1a61b8[_0x01f6('0x78')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x95'),_0x1a61b8[_0x01f6('0x96')]);loggerPredictive[_0x01f6('0x8e')]('---------------------------');if(_0x1a61b8[_0x01f6('0x7e')]>0x0){if(!_[_0x01f6('0x97')](_0x1a61b8['predictiveIntervalAvgTalktime'])&&_0x1a61b8['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x98'));if(!_[_0x01f6('0x97')](_0x1a61b8[_0x01f6('0x78')])&&_0x1a61b8[_0x01f6('0x78')]>0x0){return!![];}loggerPredictive['info'](_0x01f6('0x99'));}else{loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x9a'));}}else{loggerPredictive['info'](_0x01f6('0x9b'));}return![];}function mergeDataErlangB(_0x1362ef){return function(_0x322ab0){loggerPredictive['info'](_0x01f6('0x9c'));loggerPredictive[_0x01f6('0x8e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x322ab0[_0x01f6('0x80')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x9d'),_0x322ab0['erlangCallToSecond']);loggerPredictive[_0x01f6('0x8e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x322ab0[_0x01f6('0x82')]);loggerPredictive[_0x01f6('0x8e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x322ab0[_0x01f6('0x83')]);loggerPredictive[_0x01f6('0x8e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x322ab0[_0x01f6('0x82')]);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x9e'));_[_0x01f6('0x9f')](_0x1362ef,_0x322ab0);};}function getDiff(_0x2e46ea){var _0x487509=moment()[_0x01f6('0x52')](0x0);var _0x4e4703=moment(_0x2e46ea)['milliseconds'](0x0);return _0x487509[_0x01f6('0x53')](_0x4e4703,_0x01f6('0x54'));}function ifInterval(_0x588148,_0x11beae){if(_[_0x01f6('0x97')](_0x11beae)){return![];}return getDiff(_0x11beae)<_0x588148*0x3c;}function freeVariablesPredictive(_0x5e08cb){if(isNotNull(_0x5e08cb)){if(!_[_0x01f6('0x97')](_0x5e08cb[_0x01f6('0x84')])){_0x5e08cb[_0x01f6('0x84')]=undefined;loggerPredictive['info'](_0x5e08cb[_0x01f6('0x48')],_0x01f6('0xa0'));}if(!_[_0x01f6('0x97')](_0x5e08cb['startPredictive'])){_0x5e08cb[_0x01f6('0x2e')]=undefined;loggerPredictive[_0x01f6('0x8e')](_0x5e08cb[_0x01f6('0x48')],_0x01f6('0xa1'));}if(!_[_0x01f6('0x97')](_0x5e08cb[_0x01f6('0xa2')])){clearInterval(_0x5e08cb[_0x01f6('0xa2')]);_0x5e08cb[_0x01f6('0xa2')]=undefined;loggerPredictive[_0x01f6('0x8e')](_0x5e08cb[_0x01f6('0x48')],_0x01f6('0xa3'));}}}function erlangb(_0x31d05f,_0x3b2567){if(_0x3b2567===0x0){return 0x0;}var _0x39f6de=0x1;for(var _0x17349c=0x1;_0x17349c<=_0x3b2567;_0x17349c+=0x1){_0x39f6de=0x1+_0x39f6de*_0x17349c/_0x31d05f;}return 0x1/_0x39f6de;}function isVoiceQueueOutbound(_0x28d7c8){return _0x28d7c8==='outbound';}function isNotPreview(_0xc1ee6c){return _0xc1ee6c!==_0x01f6('0x24');}function isCampaignIvr(_0x1137a4){return _0x1137a4===_0x01f6('0x8b');}function getCallerId(_0x56786a,_0x3e741a,_0x469f8f){if(!_['isUndefined'](_0x469f8f)&&typeof _0x469f8f==='string'&&!_[_0x01f6('0x4e')](_0x469f8f)){if(!_[_0x01f6('0x97')](_0x3e741a)&&typeof _0x3e741a===_0x01f6('0xa4')&&!_[_0x01f6('0x4e')](_0x3e741a)){return util['format'](_0x01f6('0xa5'),_0x3e741a,_0x469f8f);}return util[_0x01f6('0x88')](_0x01f6('0xa5'),_0x469f8f,_0x469f8f);}if(!_[_0x01f6('0x97')](_0x56786a)&&typeof _0x56786a==='string'&&!_[_0x01f6('0x4e')](_0x56786a)){return _0x56786a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4bd42a,_0x11e6b2){return function(_0x561e82){freeVariablesPredictive(_0x11e6b2);emitVoiceQueueSummary(_0x11e6b2);emitCampaignSummary(_0x11e6b2);loggerSyncQueueSummary[_0x01f6('0xa6')](_0x4bd42a,util['inspect'](_0x561e82,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x36d615,_0x2823c5){return function(_0x407333){loggerPredictive[_0x01f6('0xa6')](_0x2823c5['name'],_0x36d615);loggerPredictive[_0x01f6('0xa6')](_0x407333['stack']);freeVariablesPredictive(_0x2823c5);};}function loggerCatch(_0x17762e){return function(_0x117248){logger[_0x01f6('0xa6')](_0x17762e,util['inspect'](_0x117248,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x362df3){return _0x362df3&&!_[_0x01f6('0x97')](_0x362df3)&&_0x362df3['length']>0x0;}function decremetOriginate(_0x5c84d4){if(!_[_0x01f6('0x97')](_0x5c84d4)&&_0x5c84d4!==null){if(typeof _0x5c84d4['originated']!==_0x01f6('0xa7')){if(_0x5c84d4['originated']>0x0){_0x5c84d4['originated']-=0x1;}else{logger[_0x01f6('0xa6')](_0x01f6('0xa8'));}}}else{logger[_0x01f6('0xa6')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x42ca30,_0x13f19f,_0xfce580){if(_0x13f19f>_0xfce580){for(var _0x118cdb=0x0;_0x118cdb<_0x13f19f-_0xfce580;_0x118cdb+=0x1){decremetOriginate(_0x42ca30);}}}function loggerGetContactDialer(_0xddb058,_0x4fc5db,_0x59b4d6){return function(_0x360580){checkContactLowerLimitOriginate(_0x4fc5db,_0x59b4d6,0x0);logger[_0x01f6('0xa6')](_0xddb058,util[_0x01f6('0xa9')](_0x360580,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5bfc0c){return function(_0x394711){if(isNotNull(_0x394711)&&isNotNull(_0x394711[0x0])){if(_0x394711[0x0][_0x01f6('0xaa')]>0x0){_0x5bfc0c[_0x01f6('0x44')]=_0x01f6('0xab');logger[_0x01f6('0x8e')](_0x01f6('0xac')+_0x5bfc0c[_0x01f6('0x48')],_0x394711[0x0][_0x01f6('0xaa')],_0x01f6('0xad'));}else{_0x5bfc0c[_0x01f6('0x44')]=_0x01f6('0xae');logger[_0x01f6('0x8e')](_0x01f6('0xaf')+_0x5bfc0c['name']);}}};}function notSendMessagesQueue(_0x3dcd70){if(_0x3dcd70[_0x01f6('0xb0')]){freeVariablesPredictive(_0x3dcd70);if(_0x3dcd70['originated']===0x0&&_0x3dcd70[_0x01f6('0x5e')]===0x0&&_0x3dcd70[_0x01f6('0x62')]===0x0&&(_0x3dcd70[_0x01f6('0x5b')]||0x0)===0x0){_0x3dcd70['sendMessageOneNotActive']=![];_0x3dcd70[_0x01f6('0x59')]=0x0;_0x3dcd70[_0x01f6('0x44')]=_0x01f6('0x47');loggerSyncQueueSummary['error'](_0x01f6('0xb1'),_0x3dcd70[_0x01f6('0x48')],_0x01f6('0xb2'));}else{_0x3dcd70[_0x01f6('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x01f6('0xa6')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3dcd70[_0x01f6('0x48')],'is\x20disactive');}emitVoiceQueueSummary(_0x3dcd70);}}function notSendMessagesCampaign(_0x55090c){if(_0x55090c[_0x01f6('0xb0')]){if(_0x55090c[_0x01f6('0x7f')]===0x0){_0x55090c[_0x01f6('0xb0')]=![];_0x55090c[_0x01f6('0x44')]=_0x01f6('0x47');loggerSyncQueueSummary[_0x01f6('0xa6')](_0x01f6('0xb3'),_0x55090c[_0x01f6('0x48')],_0x01f6('0xb2'));}else{_0x55090c[_0x01f6('0x44')]=_0x01f6('0xb4');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x55090c[_0x01f6('0x48')],_0x01f6('0xb5'));}emitCampaignSummary(_0x55090c);}}function createObjHistory(_0x33a8e3,_0x40dbb8,_0x3c80b5,_0x39302d,_0x324f26){_0x33a8e3[_0x01f6('0x44')]=_0x3c80b5;var _0x546e68=new Action(_0x33a8e3,_0x40dbb8);var _0xb1fb26=new History(_0x546e68);_0xb1fb26[_0x01f6('0xb6')]=_0x39302d;_0xb1fb26[_0x01f6('0xb7')]=_0x324f26;_0xb1fb26['endtime']=_0x546e68['starttime'];return _0xb1fb26;}Dialer['prototype'][_0x01f6('0x40')]=function(){var _0x3bea4d=this;setInterval(function(){_0x3bea4d['clearZombieChannels'](_0x3bea4d[_0x01f6('0x2d')],_0x01f6('0xb8'));_0x3bea4d['clearZombieChannels'](_0x3bea4d[_0x01f6('0x2b')],'[actions]');},0x32c8);};Dialer[_0x01f6('0x20')][_0x01f6('0xb9')]=function(_0x2b598f,_0x31f051){var _0x4494e4=this;for(var _0x124d69 in _0x2b598f){if(typeof _0x2b598f[_0x124d69]!==_0x01f6('0xa7')){this[_0x01f6('0x23')][_0x01f6('0x21')](function(){if(!_['isNil'](_0x2b598f[_0x124d69])){return ami['Action']({'action':_0x01f6('0xba'),'channel':_0x2b598f[_0x124d69][_0x01f6('0xbb')]})[_0x01f6('0xbc')](function(_0x3b1f13){if(_0x3b1f13[_0x01f6('0x44')]===_0x01f6('0xbd')){setTimeout(function(){if(_0x2b598f[_0x124d69]&&_0x2b598f[_0x124d69][_0x01f6('0x56')]!=='ivr'){_0x4494e4[_0x01f6('0xbe')](_0x4494e4[_0x01f6('0x25')][_0x2b598f[_0x124d69][_0x01f6('0xbf')]]);logger[_0x01f6('0xa6')](_0x01f6('0xc0'),_0x31f051,_0x124d69,_0x2b598f[_0x124d69][_0x01f6('0xbf')]);delete _0x2b598f[_0x124d69];}if(_0x2b598f[_0x124d69]&&_0x2b598f[_0x124d69][_0x01f6('0x56')]===_0x01f6('0x8b')){_0x4494e4[_0x01f6('0xbe')](_0x4494e4[_0x01f6('0x26')][_0x2b598f[_0x124d69][_0x01f6('0xbf')]]);logger[_0x01f6('0xa6')]('[Dialer][checkChannel][ivr]',_0x31f051,_0x124d69,_0x2b598f[_0x124d69][_0x01f6('0xbf')]);delete _0x2b598f[_0x124d69];}},0x2328);}});}});}}};Dialer['prototype'][_0x01f6('0xc1')]=function(_0x531388){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper[_0x01f6('0xc1')](_0x531388))[_0x01f6('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x01f6('0xc3')]=function(_0x276b39){return BPromise[_0x01f6('0xc2')]()['then'](cmHopperBlack[_0x01f6('0xc3')](_0x276b39))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xc4')));};Dialer[_0x01f6('0x20')]['verifyAdditionalPhones']=function(_0x1b97b0,_0x47e5ae,_0x237d3d){return BPromise[_0x01f6('0xc2')]()['then'](cmHopperAdditionalPhone[_0x01f6('0xc5')](_0x1b97b0,_0x47e5ae,_0x237d3d))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer['prototype'][_0x01f6('0xc6')]=function(_0x1067e0,_0x1098df,_0x5e3a01){return BPromise['resolve']()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1067e0,_0x1098df,_0x5e3a01))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xc7')));};Dialer[_0x01f6('0x20')][_0x01f6('0xc8')]=function(_0x1daa4e){return BPromise['resolve']()[_0x01f6('0x42')](cmHopperBlack[_0x01f6('0xc8')](_0x1daa4e))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xc9')));};Dialer[_0x01f6('0x20')][_0x01f6('0xca')]=function(_0x46d7fd){return BPromise[_0x01f6('0xc2')]()['then'](cmHopperHistory[_0x01f6('0xcb')](_0x46d7fd))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xcc')));};Dialer[_0x01f6('0x20')][_0x01f6('0xcd')]=function(_0xe2e41c){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper[_0x01f6('0xcd')](_0xe2e41c))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xce')));};Dialer[_0x01f6('0x20')][_0x01f6('0xcf')]=function(_0x3bad83,_0x27034a,_0x5ba625){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper['unlockContact'](_0x3bad83,_0x27034a,_0x5ba625))['catch'](loggerCatch(_0x01f6('0xd0')));};Dialer[_0x01f6('0x20')]['getContactDialer']=function(_0x2bf444,_0xc72d1d,_0x218981,_0x46ac49,_0xe86ff5){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper[_0x01f6('0xd1')](_0x2bf444,_0xc72d1d,_0x218981,_0x46ac49))[_0x01f6('0xbc')](function(_0x2adfc2){_0xe86ff5[_0x01f6('0xd2')]-=_0x218981;_0xe86ff5[_0x01f6('0xd2')]=_0xe86ff5[_0x01f6('0xd2')]>0x0?_0xe86ff5[_0x01f6('0xd2')]:0x0;loggerCatch(_0x01f6('0xd3'))(_0x2adfc2);});};Dialer[_0x01f6('0x20')][_0x01f6('0xd4')]=function(_0x31e5c5,_0x37115d,_0x11df0c,_0x111da7){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper[_0x01f6('0xd4')](_0x31e5c5,_0x37115d,_0x11df0c))[_0x01f6('0xbc')](function(_0x1186e0){_0x111da7['temp']-=_0x37115d;_0x111da7[_0x01f6('0xd2')]=_0x111da7['temp']>0x0?_0x111da7[_0x01f6('0xd2')]:0x0;loggerCatch(_0x01f6('0xd5'))(_0x1186e0);});};Dialer['prototype'][_0x01f6('0xd6')]=function(_0x704771){return BPromise['resolve']()[_0x01f6('0x42')](voiceQueueRt[_0x01f6('0xd6')](_0x704771))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xd7')));};Dialer[_0x01f6('0x20')][_0x01f6('0xd8')]=function(_0x3ba6eb){return BPromise['resolve']()[_0x01f6('0x42')](cmHopper[_0x01f6('0xd8')](_0x3ba6eb))['catch'](loggerCatch(_0x01f6('0xd9')));};Dialer['prototype'][_0x01f6('0xda')]=function(_0x4660ee){return BPromise[_0x01f6('0xc2')]()['then'](cmHopperHistory[_0x01f6('0xda')](_0x4660ee))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xdb')));};Dialer[_0x01f6('0x20')][_0x01f6('0xbe')]=function(_0x395ef0){if(!_['isUndefined'](_0x395ef0)&&_0x395ef0!==null){if(typeof _0x395ef0[_0x01f6('0x7f')]!==_0x01f6('0xa7')){if(_0x395ef0['originated']>0x0){_0x395ef0['originated']-=0x1;}else{logger[_0x01f6('0xa6')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x01f6('0x20')][_0x01f6('0xdc')]=function(_0x3ca212,_0x30a203){var _0x3aa3cb=this;return function(_0x577054){_0x3aa3cb[_0x01f6('0xbe')](_0x30a203);logger['error'](_0x3ca212,util[_0x01f6('0xa9')](_0x577054,{'showHidden':![],'depth':null}));};};Dialer[_0x01f6('0x20')]['emptyContact']=function(_0x27f15f,_0x2bf541,_0x54ff6c){var _0x3b243b={'state':0x19,'statedesc':_0x01f6('0xdd')};this[_0x01f6('0xbe')](_0x2bf541);this['saveInDb'](_['merge'](_0x3b243b,_[_0x01f6('0xde')](_0x54ff6c,[_0x01f6('0xdf'),_0x01f6('0xe0'),_0x01f6('0xe1'),_0x01f6('0xe2'),'CampaignId'])),_0x01f6('0xe3'),_0x01f6('0xe4'));logger[_0x01f6('0xa6')](_0x27f15f);};Dialer[_0x01f6('0x20')][_0x01f6('0xe5')]=function(_0x469826){return _0x469826===_0x01f6('0xe6');};Dialer[_0x01f6('0x20')]['isTrunkReachable']=function(_0x190b08){return!_[_0x01f6('0x97')](_0x190b08)&&_0x190b08&&!_['isUndefined'](_0x190b08[_0x01f6('0x48')])&&!_['isUndefined'](_0x190b08[_0x01f6('0x86')])&&_0x190b08[_0x01f6('0x86')]&&(this[_0x01f6('0x28')][util[_0x01f6('0x88')](_0x01f6('0xe7'),_0x190b08[_0x01f6('0x48')])][_0x01f6('0xba')]===_0x01f6('0xe8')||this[_0x01f6('0x28')][util[_0x01f6('0x88')]('SIP/%s',_0x190b08[_0x01f6('0x48')])][_0x01f6('0xba')]===_0x01f6('0xe9'));};Dialer[_0x01f6('0x20')]['saveInDb']=function(_0x4af747,_0x56826e,_0x1ea9d1){this[_0x01f6('0xda')](_0x4af747)[_0x01f6('0xbc')](loggerCatch(_0x56826e));this[_0x01f6('0xd8')](_0x4af747)[_0x01f6('0xbc')](loggerCatch(_0x1ea9d1));};Dialer[_0x01f6('0x20')]['syncVarSet']=function(_0x5cbabf){var _0x5a46f2=this[_0x01f6('0x2d')][_0x5cbabf['uniqueid']];var _0x394cd9;if(!_[_0x01f6('0xea')](_0x5cbabf)&&!_[_0x01f6('0xea')](_0x5cbabf[_0x01f6('0xeb')])&&!_[_0x01f6('0xea')](_0x5cbabf[_0x01f6('0xeb')]['amdstatus'])&&_0x5cbabf['exten']===_0x01f6('0xec')&&_0x5a46f2){if(_0x5a46f2[_0x01f6('0x56')]!==_0x01f6('0x8b')&&this[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0xed')]&&_0x5cbabf[_0x01f6('0xee')]==='HANGUP'){delete this[_0x01f6('0x2d')][_0x5cbabf[_0x01f6('0xef')]];this[_0x01f6('0xbe')](this[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]]);this[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0x6a')]+=0x1;this['voiceQueues'][_0x5a46f2[_0x01f6('0xbf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x394cd9=new Hangup(_0x5a46f2,_0x5cbabf);_0x394cd9[_0x01f6('0xb6')]=0x12;_0x394cd9[_0x01f6('0xb7')]=_0x01f6('0xf0');_0x394cd9[_0x01f6('0xf1')]=_0x01f6('0xf2');ami[_0x01f6('0x55')](_0x01f6('0xf3'),ut[_0x01f6('0xf4')](_0x394cd9,'amd'));this['saveInDb'](_0x394cd9,_0x01f6('0xf5'),_0x01f6('0xf6'));}if(_0x5a46f2[_0x01f6('0x56')]!==_0x01f6('0x8b')&&this[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0xed')]&&_0x5cbabf[_0x01f6('0xee')]===_0x01f6('0xf7')){var _0x436056=this;return new BPromise(function(_0xcd6517,_0x5cd7bf){delete _0x436056[_0x01f6('0x2d')][_0x5cbabf[_0x01f6('0xef')]];_0x436056[_0x01f6('0xbe')](_0x436056['voiceQueues'][_0x5a46f2[_0x01f6('0xbf')]]);_0x436056[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0x6a')]+=0x1;_0x436056[_0x01f6('0x25')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0xf8')]+=0x1;var _0xe8ed3c=_0x436056['voiceQueues'][_0x5a46f2[_0x01f6('0xbf')]];var _0x1087a5=new Hangup(_0x5a46f2,_0x5cbabf);_0x1087a5[_0x01f6('0xb6')]=0x13;_0x1087a5[_0x01f6('0xb7')]=_0x01f6('0xf9');_0x1087a5[_0x01f6('0xf1')]='AMD';_0x1087a5[_0x01f6('0xfa')]+=0x1;_0x1087a5[_0x01f6('0xfb')]+=0x1;_0x1087a5['amd']=!![];ami[_0x01f6('0x55')](_0x01f6('0xf3'),ut[_0x01f6('0xf4')](_0x1087a5,_0x01f6('0xfc')));_0x436056[_0x01f6('0xda')](_0x1087a5)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0xfd')));if(_0x1087a5[_0x01f6('0xfe')]+_0x1087a5['countcongestionretry']+_0x1087a5[_0x01f6('0xff')]+_0x1087a5[_0x01f6('0x100')]+_0x1087a5[_0x01f6('0x101')]+_0x1087a5[_0x01f6('0x102')]+_0x1087a5[_0x01f6('0xfa')]+_0x1087a5['countagentrejectretry']>=_0xe8ed3c[_0x01f6('0x103')]){_0x436056['stateGlobal'](_0x1087a5,_0xcd6517,_0x5cd7bf,'reason19\x20machine....');}else{if(_0x1087a5[_0x01f6('0xfa')]>=_0xe8ed3c[_0x01f6('0x104')]){_0x436056[_0x01f6('0x105')](_0x1087a5,_0xcd6517,_0x5cd7bf,_0x01f6('0x106'));}else{_0x436056[_0x01f6('0xcd')]({'active':![],'countmachineretry':_0x1087a5[_0x01f6('0xfa')],'scheduledat':moment()[_0x01f6('0x107')](_0xe8ed3c[_0x01f6('0x108')],_0x01f6('0x109'))[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x1087a5[_0x01f6('0xdf')],'ListId':_0x1087a5[_0x01f6('0xe0')],'VoiceQueueId':_0x1087a5[_0x01f6('0xe2')]||undefined,'CampaignId':_0x1087a5[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x10c')));_0xcd6517({'reschedule':0x1});}}});}if(_0x5a46f2[_0x01f6('0x56')]===_0x01f6('0x8b')&&this[_0x01f6('0x26')][_0x5a46f2[_0x01f6('0xbf')]]['dialAMDActive']&&_0x5cbabf[_0x01f6('0xee')]==='HANGUP'){delete this[_0x01f6('0x2d')][_0x5cbabf[_0x01f6('0xef')]];this[_0x01f6('0xbe')](this[_0x01f6('0x26')][_0x5a46f2['queue']]);_0x394cd9=new Hangup(_0x5a46f2,_0x5cbabf);_0x394cd9[_0x01f6('0xb6')]=0x12;_0x394cd9[_0x01f6('0xb7')]=_0x01f6('0xf0');_0x394cd9['membername']=_0x01f6('0xf2');ami[_0x01f6('0x55')](_0x01f6('0xf3'),ut[_0x01f6('0xf4')](_0x394cd9,_0x01f6('0xfc')));this['saveInDb'](_0x394cd9,_0x01f6('0x10d'),_0x01f6('0x10e'));}if(_0x5a46f2[_0x01f6('0x56')]===_0x01f6('0x8b')&&this['campaigns'][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0xed')]&&_0x5cbabf[_0x01f6('0xee')]==='MACHINE'){var _0x436056=this;return new BPromise(function(_0x1da52c,_0x5d431f){delete _0x436056[_0x01f6('0x2d')][_0x5cbabf['uniqueid']];_0x436056[_0x01f6('0xbe')](_0x436056[_0x01f6('0x26')][_0x5a46f2['queue']]);_0x436056[_0x01f6('0x26')][_0x5a46f2['queue']][_0x01f6('0x6a')]+=0x1;_0x436056[_0x01f6('0x26')][_0x5a46f2[_0x01f6('0xbf')]][_0x01f6('0xf8')]+=0x1;var _0x2bf8a2=_0x436056[_0x01f6('0x26')][_0x5a46f2[_0x01f6('0xbf')]];var _0x578a4f=new Hangup(_0x5a46f2,_0x5cbabf);_0x578a4f[_0x01f6('0xb6')]=0x13;_0x578a4f[_0x01f6('0xb7')]=_0x01f6('0xf9');_0x578a4f['membername']='AMD';_0x578a4f[_0x01f6('0xfa')]+=0x1;_0x578a4f['countglobal']+=0x1;_0x578a4f[_0x01f6('0xfc')]=!![];ami['emit'](_0x01f6('0xf3'),ut[_0x01f6('0xf4')](_0x578a4f,'amd'));_0x436056['createHistory'](_0x578a4f)['catch'](loggerCatch(_0x01f6('0xfd')));if(_0x578a4f[_0x01f6('0xfe')]+_0x578a4f['countcongestionretry']+_0x578a4f[_0x01f6('0xff')]+_0x578a4f[_0x01f6('0x100')]+_0x578a4f[_0x01f6('0x101')]+_0x578a4f[_0x01f6('0x102')]+_0x578a4f['countmachineretry']+_0x578a4f[_0x01f6('0x10f')]>=_0x2bf8a2[_0x01f6('0x103')]){_0x436056[_0x01f6('0x110')](_0x578a4f,_0x1da52c,_0x5d431f,'reason19\x20machine....');}else{if(_0x578a4f[_0x01f6('0xfa')]>=_0x2bf8a2['dialMachineMaxRetry']){_0x436056[_0x01f6('0x105')](_0x578a4f,_0x1da52c,_0x5d431f,_0x01f6('0x106'));}else{_0x436056[_0x01f6('0xcd')]({'active':![],'countmachineretry':_0x578a4f['countmachineretry'],'scheduledat':moment()['add'](_0x2bf8a2[_0x01f6('0x108')],'minutes')[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x578a4f[_0x01f6('0xdf')],'ListId':_0x578a4f['ListId'],'VoiceQueueId':_0x578a4f['VoiceQueueId']||undefined,'CampaignId':_0x578a4f[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch('[rescheduleContact][Machine]'));_0x1da52c({'reschedule':0x1});}}});}}};Dialer[_0x01f6('0x20')][_0x01f6('0x3a')]=function(_0x54816a){var _0x475de9=this[_0x01f6('0x2d')][_0x54816a[_0x01f6('0xef')]];var _0x2eab82=this;var _0x25a913;if(_0x475de9&&_0x475de9[_0x01f6('0x56')]==='ivr'){delete this[_0x01f6('0x2d')][_0x54816a['uniqueid']];this[_0x01f6('0xbe')](this[_0x01f6('0x26')][_0x475de9[_0x01f6('0xbf')]]);this[_0x01f6('0x26')][_0x475de9[_0x01f6('0xbf')]][_0x01f6('0x111')]+=0x1;_0x25a913=new Hangup(_0x475de9,_0x54816a);this[_0x01f6('0xda')](_0x25a913)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x112')));this['moveContactManagedDialer'](_0x25a913)['catch'](loggerCatch(_0x01f6('0x113')));}if(_0x475de9&&_0x475de9['type']!==_0x01f6('0x8b')&&isNotNull(this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]][_0x01f6('0x114')])){delete this[_0x01f6('0x2d')][_0x54816a[_0x01f6('0xef')]];this[_0x01f6('0xbe')](this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]]);this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]]['outboundAnswerCallsDay']+=0x1;this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]][_0x01f6('0xf8')]+=0x1;_0x25a913=new Hangup(_0x475de9,_0x54816a);_0x25a913[_0x01f6('0xb6')]=0x10;_0x25a913[_0x01f6('0xb7')]=_0x01f6('0x115');_0x25a913['membername']=_0x01f6('0x116');this[_0x01f6('0xda')](_0x25a913)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x112')));this[_0x01f6('0xd8')](_0x25a913)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x113')));}if(_0x475de9&&_0x475de9[_0x01f6('0x56')]!==_0x01f6('0x8b')&&!isNotNull(this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]][_0x01f6('0x114')])){delete this[_0x01f6('0x2d')][_0x54816a[_0x01f6('0xef')]];this['updateOriginated'](this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]]);this[_0x01f6('0x25')][_0x475de9[_0x01f6('0xbf')]]['outboundUnknownCallsDay']+=0x1;_0x25a913=new Hangup(_0x475de9,_0x54816a);_0x25a913[_0x01f6('0xb6')]=0xc;_0x25a913[_0x01f6('0xb7')]=_0x54816a['cause-txt'];_0x25a913['membername']=_0x01f6('0x117');this[_0x01f6('0xda')](_0x25a913)[_0x01f6('0xbc')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x01f6('0xd8')](_0x25a913)['catch'](loggerCatch(_0x01f6('0x113')));}};Dialer['prototype'][_0x01f6('0x37')]=function(_0x26aca3){var _0xc79041=this['uniqueId'][_0x26aca3[_0x01f6('0xef')]];var _0x2dce97=this;if(this[_0x01f6('0x25')][_0x26aca3[_0x01f6('0xbf')]]){if(_0xc79041&&_0xc79041['type']!=='ivr'){delete this[_0x01f6('0x2d')][_0x26aca3[_0x01f6('0xef')]];this[_0x01f6('0x25')][_0x26aca3['queue']]['outboundAnswerCallsDay']+=0x1;var _0x55cc5e=new AgentComplete(_0xc79041,_0x26aca3);if(_0x26aca3[_0x01f6('0x118')]===_0x01f6('0x119')){_0x55cc5e[_0x01f6('0x11a')]=this[_0x01f6('0x25')][_0x26aca3[_0x01f6('0xbf')]][_0x01f6('0x11b')]&&this[_0x01f6('0x25')][_0x26aca3[_0x01f6('0xbf')]][_0x01f6('0x11c')]?moment()[_0x01f6('0x88')](_0x01f6('0x10a')):undefined;}this['createHistory'](_0x55cc5e)['catch'](loggerCatch(_0x01f6('0x11d')));this[_0x01f6('0xd8')](_0x55cc5e)[_0x01f6('0xbc')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype']['syncAgentConnect']=function(_0x20023e){if(this[_0x01f6('0x25')][_0x20023e[_0x01f6('0xbf')]]){if(this['uniqueId'][_0x20023e[_0x01f6('0xef')]]&&this[_0x01f6('0x2d')][_0x20023e['uniqueid']]['type']!=='ivr'){this[_0x01f6('0xbe')](this[_0x01f6('0x25')][_0x20023e[_0x01f6('0xbf')]]);this[_0x01f6('0x2d')][_0x20023e[_0x01f6('0xef')]]['answertime']=moment()['format'](_0x01f6('0x10a'));}}};Dialer[_0x01f6('0x20')][_0x01f6('0x11e')]=function(_0x62046a,_0x57c058){this[_0x01f6('0xda')](_0x62046a)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x11d')));if(_0x57c058==0x0){this['moveContactManagedDialer'](_0x62046a)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x11f')));}};Dialer[_0x01f6('0x20')]['syncQueueCallerAbandon']=function(_0x5b6c80){var _0x4133fb=this[_0x01f6('0x2d')][_0x5b6c80[_0x01f6('0xef')]];var _0x14bbbe=this;var _0x12eb14=![];var _0x23f7ed;var _0x57d747;if(this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]]){if(_0x4133fb&&_0x4133fb[_0x01f6('0x56')]!=='ivr'){delete this[_0x01f6('0x2d')][_0x5b6c80[_0x01f6('0xef')]];this[_0x01f6('0xbe')](this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]]);_0x4133fb[_0x01f6('0x120')]=moment()[_0x01f6('0x88')]('YYYY-MM-DD\x20HH:mm:ss');var _0x56fff1=new QueueCallerAbandon(_0x4133fb,_0x5b6c80);if(getSeconds(_0x4133fb['droptime'],_0x4133fb[_0x01f6('0x121')])>=_0x4133fb[_0x01f6('0x122')]){this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x92')]+=0x1;this['voiceQueues'][_0x5b6c80[_0x01f6('0xbf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x123')]+=0x1;_0x56fff1[_0x01f6('0xb6')]=0xa;_0x56fff1[_0x01f6('0xb7')]=_0x01f6('0x124');_0x56fff1[_0x01f6('0x125')]=_0x01f6('0x126');_0x56fff1[_0x01f6('0x11a')]=this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x11b')]?moment()[_0x01f6('0x88')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x56fff1['countdropretry']+=0x1;_0x56fff1[_0x01f6('0xfb')]+=0x1;_0x23f7ed=this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x127')];_0x57d747=this[_0x01f6('0x25')][_0x5b6c80['queue']]['callAdditionalPhoneAfterMin'];_0x14bbbe['verifyAdditionalPhones'](_0x56fff1,_0x56fff1['state'],_0x4133fb[_0x01f6('0x128')])['then'](function(_0x41dd83){_0x12eb14=_0x41dd83['additional']==0x1;if(_0x56fff1[_0x01f6('0x101')]>=_0x14bbbe[_0x01f6('0x25')][_0x5b6c80['queue']][_0x01f6('0x129')]){_0x14bbbe[_0x01f6('0x11e')](_0x56fff1,_0x41dd83[_0x01f6('0x12a')]);}else{_0x14bbbe['rescheduleContact']({'active':![],'countdropretry':_0x56fff1[_0x01f6('0x101')],'scheduledat':moment()[_0x01f6('0x107')](_0x14bbbe[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x127')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4133fb[_0x01f6('0xdf')],'ListId':_0x4133fb[_0x01f6('0xe0')],'VoiceQueueId':_0x4133fb[_0x01f6('0xe2')]||undefined,'CampaignId':_0x4133fb[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch('[rescheduleContact][Drop]'));var _0xcff3d4=new History(_0x56fff1);_0xcff3d4[_0x01f6('0xb6')]=0xa;_0xcff3d4[_0x01f6('0xb7')]=_0x01f6('0x124');_0xcff3d4['starttime']=moment()[_0x01f6('0x88')](_0x01f6('0x10a'));_0xcff3d4[_0x01f6('0x12b')]=_0xcff3d4['starttime'];_0xcff3d4['calleridname']=_0x56fff1[_0x01f6('0x12c')];_0xcff3d4[_0x01f6('0x12d')]=_0x56fff1[_0x01f6('0x12d')];_0x14bbbe[_0x01f6('0xda')](_0xcff3d4)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x12e')));}})[_0x01f6('0x42')](function(_0x387310){if(_0x12eb14)_0x14bbbe['swapAdditionalPhones'](_0x56fff1,_0x23f7ed,_0x57d747)[_0x01f6('0x42')](function(_0x1441e3){return 0x1;});});}else{this[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x79')]+=0x1;this['voiceQueues'][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x6f')]+=0x1;_0x56fff1[_0x01f6('0xb6')]=0xb;_0x56fff1['statedesc']='Abandoned';_0x56fff1[_0x01f6('0x125')]=_0x01f6('0x12f');_0x56fff1['countabandonedretry']+=0x1;_0x56fff1['countglobal']+=0x1;_0x23f7ed=this[_0x01f6('0x25')][_0x5b6c80['queue']][_0x01f6('0x130')];_0x57d747=this[_0x01f6('0x25')][_0x5b6c80['queue']]['callAdditionalPhoneAfterMin'];_0x14bbbe[_0x01f6('0xc5')](_0x56fff1,_0x56fff1['state'],_0x4133fb[_0x01f6('0x128')])[_0x01f6('0x42')](function(_0x4f6212){if(_0x56fff1[_0x01f6('0x102')]>=_0x14bbbe[_0x01f6('0x25')][_0x5b6c80[_0x01f6('0xbf')]][_0x01f6('0x131')]){_0x14bbbe['queueCallerAbandonCreateState'](_0x56fff1,_0x4f6212[_0x01f6('0x12a')]);}else{_0x14bbbe[_0x01f6('0xcd')]({'active':![],'countabandonedretry':_0x56fff1[_0x01f6('0x102')],'scheduledat':moment()[_0x01f6('0x107')](_0x14bbbe[_0x01f6('0x25')][_0x5b6c80['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0x01f6('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4133fb[_0x01f6('0xdf')],'ListId':_0x4133fb['ListId'],'VoiceQueueId':_0x4133fb['VoiceQueueId']||undefined,'CampaignId':_0x4133fb[_0x01f6('0x10b')]||undefined})['catch'](loggerCatch(_0x01f6('0x132')));var _0x222b0f=new History(_0x56fff1);_0x222b0f[_0x01f6('0xb6')]=0xb;_0x222b0f[_0x01f6('0xb7')]=_0x01f6('0x133');_0x222b0f['starttime']=moment()[_0x01f6('0x88')](_0x01f6('0x10a'));_0x222b0f[_0x01f6('0x12b')]=_0x222b0f[_0x01f6('0x134')];_0x222b0f[_0x01f6('0x12c')]=_0x56fff1[_0x01f6('0x12c')];_0x222b0f[_0x01f6('0x12d')]=_0x56fff1[_0x01f6('0x12d')];_0x14bbbe['createHistory'](_0x222b0f)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x135')));}})[_0x01f6('0x42')](function(_0x5e6cfb){if(_0x12eb14)_0x14bbbe['swapAdditionalPhones'](_0x56fff1,_0x23f7ed,_0x57d747)[_0x01f6('0x42')](function(_0x3269de){return 0x1;});});}}}};Dialer['prototype'][_0x01f6('0x3b')]=function(_0x583aac){if(this[_0x01f6('0x2b')][_0x583aac[_0x01f6('0xef')]]){this[_0x01f6('0x2b')][_0x583aac[_0x01f6('0xef')]][_0x01f6('0xbb')]=_0x583aac[_0x01f6('0xbb')];}if(this[_0x01f6('0x2d')][_0x583aac[_0x01f6('0xef')]]){this[_0x01f6('0x2d')][_0x583aac[_0x01f6('0xef')]]['channel']=_0x583aac[_0x01f6('0xbb')];}};Dialer['prototype'][_0x01f6('0x3d')]=function(_0x209dc0){if(strategy[this[_0x01f6('0x25')][this['actions'][_0x209dc0['actionid']][_0x01f6('0xbf')]][_0x01f6('0x58')]]===_0x01f6('0x1f')){if(this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]]&&_[_0x01f6('0xea')](this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0x137')])&&_0x209dc0['status']==='1'&&_0x209dc0[_0x01f6('0x138')]==='0'){if(this[_0x01f6('0x27')][_0x209dc0['stateinterface']]){if(!this[_0x01f6('0x27')][_0x209dc0[_0x01f6('0x139')]]['locked']){this['agents'][_0x209dc0[_0x01f6('0x139')]][_0x01f6('0x137')]=!![];this['actions'][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0x137')]=!![];this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0x139')]=_0x209dc0[_0x01f6('0x139')];}}}}else if((strategy[this[_0x01f6('0x25')][this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0xbf')]][_0x01f6('0x58')]]||'rrmemory')===_0x01f6('0x1e')){if(this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]]){if(this[_0x01f6('0x27')][_0x209dc0[_0x01f6('0x139')]]){this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]]['stateinterface']=_0x209dc0[_0x01f6('0x139')];if(_[_0x01f6('0xea')](this[_0x01f6('0x30')][this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0xbf')]])){this[_0x01f6('0x30')][this[_0x01f6('0x2b')][_0x209dc0['actionid']][_0x01f6('0xbf')]]=[];}this[_0x01f6('0x30')][this[_0x01f6('0x2b')][_0x209dc0[_0x01f6('0x136')]][_0x01f6('0xbf')]][_0x01f6('0x13a')](_[_0x01f6('0x9f')](_[_0x01f6('0xde')](this['actions'][_0x209dc0[_0x01f6('0x136')]],['idHopper',_0x01f6('0x139')]),{'status':_0x209dc0[_0x01f6('0xba')],'paused':_0x209dc0[_0x01f6('0x138')]}));}}}};function unlockQueueStatus(_0x189a05,_0x303eeb){setTimeout(function(){if(_[_0x01f6('0x97')](_0x189a05['queueStatusComplete'])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x303eeb);}_0x189a05[_0x01f6('0x13b')]=!![];loggerBooked[_0x01f6('0x8e')](_0x01f6('0x13c'),_0x303eeb,JSON[_0x01f6('0x51')](_[_0x01f6('0xde')](_0x189a05,[_0x01f6('0x48'),_0x01f6('0x13b')])));},0x1f3);}Dialer[_0x01f6('0x20')][_0x01f6('0x3e')]=function(_0x26d67b){var _0x207b31=this;var _0x455558=_0x207b31[_0x01f6('0x25')][_0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]['queue']];if(strategy[this[_0x01f6('0x25')][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]][_0x01f6('0x58')]]===_0x01f6('0x1f')){if(this['actions'][_0x26d67b[_0x01f6('0x136')]]&&this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]['stateinterface']){this[_0x01f6('0x24')][_0x01f6('0x13d')](this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0x13e')],this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]['stateinterface'])['catch'](function(_0x30e64f){logger[_0x01f6('0xa6')](_0x01f6('0x13f'),util[_0x01f6('0xa9')](_0x30e64f,{'showHidden':![],'depth':null}));})[_0x01f6('0x140')](function(){_0x207b31['updateOriginated'](_0x207b31[_0x01f6('0x25')][_0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]]);_0x207b31[_0x01f6('0x27')][_0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0x139')]]['locked']=![];delete _0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]];unlockQueueStatus(_0x455558);});}else{this[_0x01f6('0xbe')](this[_0x01f6('0x25')][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]]);this[_0x01f6('0xcd')]({'active':![],'ContactId':this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xdf')],'ListId':this[_0x01f6('0x2b')][_0x26d67b['actionid']][_0x01f6('0xe0')],'VoiceQueueId':this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x141')));delete this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]];unlockQueueStatus(_0x455558);}}else if((strategy[this['voiceQueues'][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]][_0x01f6('0x58')]]||_0x01f6('0x1e'))===_0x01f6('0x1e')){var _0x19bc9b;if(this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]])){if(this['queueBookedRR'][_0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]]){this[_0x01f6('0x31')][_0x207b31[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]]['queue']]=this[_0x01f6('0x31')][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]]?this[_0x01f6('0x31')][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]]:this[_0x01f6('0x30')][this['actions'][_0x26d67b['actionid']][_0x01f6('0xbf')]]?this['queueBooked'][this[_0x01f6('0x2b')][_0x26d67b['actionid']][_0x01f6('0xbf')]][_0x01f6('0x142')]||0x0:0x0;}this[_0x01f6('0x30')][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]][_0x01f6('0x142')]=this['queueBookedRR'][this[_0x01f6('0x2b')][_0x26d67b[_0x01f6('0x136')]][_0x01f6('0xbf')]];for(var _0x44320d=0x0;_0x44320d=0x0;})[_0x01f6('0xbc')](myreject(_0x5ae402)));}}else{_0x223fbc[_0x01f6('0x13a')](ami[_0x01f6('0x15a')]({'action':_0x01f6('0x15b'),'command':util['format']('iftime\x20%s,%s',_0xb1e2a3,!_[_0x01f6('0x97')](config[_0x01f6('0x15d')][_0x4755ee])?_0x4755ee:'')})[_0x01f6('0x42')](function(_0x45117c){return _0x45117c[_0x01f6('0x15e')]['indexOf'](_0x01f6('0x160'))>=0x0;})['catch'](myreject(_0x5ae402)));}BPromise['all'](_0x223fbc)[_0x01f6('0x42')](function(_0x5981af){var _0x37220e=_[_0x01f6('0x161')](_0x5981af);if(_0x37220e){return _0x163113(_0x37220e);}else{_0x12a16e[_0x01f6('0x44')]=_0x548247?_0x01f6('0x162'):'INTERVAL_IS_OVERTIME';return _0x5ae402(msgResponse(_0x01f6('0x163'),_0x01f6('0x156'),_0x01f6('0x164')+_0x548247+'\x20'+_0x5197dd+'\x20Interval\x20is\x20overtime:\x20'+util[_0x01f6('0xa9')](_0xb1e2a3,{'showHidden':![],'depth':null})+_0x01f6('0x165')+_0x4755ee));}})[_0x01f6('0xbc')](function(_0x579b49){return _0x5ae402(msgResponse(_0x01f6('0x152'),_0x01f6('0x156'),JSON['stringify'](_0x579b49)));});});};Dialer['prototype'][_0x01f6('0x166')]=function(_0x53e62d){var _0x1477c8=this;return function(){switch(_0x53e62d['dialMethod']){case _0x01f6('0x167'):freeVariablesPredictive(_0x53e62d);_0x1477c8['handlePower'](_0x53e62d,0x1);break;case _0x01f6('0x168'):freeVariablesPredictive(_0x53e62d);_0x1477c8[_0x01f6('0x169')](_0x53e62d,_0x53e62d[_0x01f6('0x16a')]);break;case _0x01f6('0x9'):_0x1477c8[_0x01f6('0x9')](_0x53e62d);break;case _0x01f6('0x8'):freeVariablesPredictive(_0x53e62d);_0x1477c8[_0x01f6('0x169')](_0x53e62d,0x1);break;default:freeVariablesPredictive(_0x53e62d);logger[_0x01f6('0xa6')]('Queue',_0x53e62d[_0x01f6('0x48')],'method\x20not\x20recognized');}};};Dialer[_0x01f6('0x20')][_0x01f6('0x16b')]=function(_0x4855c3){return BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](cmHopper['handlePreviewRecallNotifications'](_0x4855c3['id'],previewRecallmeReminderInterval))['then'](function(_0x256014){for(var _0x4a24d7=0x0;_0x4a24d7<_0x256014[_0x01f6('0x16c')];_0x4a24d7++){var _0x3bd03e=_0x256014[_0x4a24d7][_0x01f6('0x16d')][_0x01f6('0x48')];if(_0x3bd03e)io['to'](util['format']('user:%s',_0x3bd03e))[_0x01f6('0x55')](_0x01f6('0x16e'),{'hopper':_0x256014[_0x4a24d7]});}})['catch'](function(_0x449421){});};Dialer['prototype'][_0x01f6('0x16f')]=function(_0x5d96e9){var _0x157f17=this;return function(){_0x157f17['handleIvr'](_0x5d96e9);};};Dialer[_0x01f6('0x20')][_0x01f6('0xb')]=function(_0x4e9e7e){var _0x3723bb=this;if(isNotPreview(_0x4e9e7e[_0x01f6('0x65')])){if(isVoiceQueueOutbound(_0x4e9e7e[_0x01f6('0x56')])&&isActive(_0x4e9e7e[_0x01f6('0x64')])){_0x4e9e7e['sendMessageOneNotActive']=!![];BPromise[_0x01f6('0xc2')]()[_0x01f6('0x42')](checkIsLoggedIn(_0x4e9e7e,_0x4e9e7e[_0x01f6('0x5a')]))[_0x01f6('0x42')](checkIsActive(_0x4e9e7e,_0x4e9e7e[_0x01f6('0x64')]))[_0x01f6('0x42')](checkInterval(_0x4e9e7e))[_0x01f6('0x42')](_0x3723bb[_0x01f6('0x14d')](_0x4e9e7e))[_0x01f6('0x42')](_0x3723bb[_0x01f6('0x170')](_0x4e9e7e[_0x01f6('0x171')],_0x4e9e7e['dialTimezone'],_0x4e9e7e[_0x01f6('0x48')],_0x4e9e7e))[_0x01f6('0x42')](_0x3723bb[_0x01f6('0x153')](_0x4e9e7e[_0x01f6('0x4c')],_0x4e9e7e[_0x01f6('0x172')],_0x4e9e7e[_0x01f6('0x48')],_0x4e9e7e))[_0x01f6('0x42')](_0x3723bb['checkDialMethod'](_0x4e9e7e))[_0x01f6('0xbc')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4e9e7e));}else{notSendMessagesQueue(_0x4e9e7e);}}else{freeVariablesPredictive(_0x4e9e7e);if(_0x4e9e7e[_0x01f6('0x173')]){_0x3723bb[_0x01f6('0x16b')](_0x4e9e7e);}}};Dialer['prototype']['syncCampaigns']=function(){var _0xcc66b5=this;var _0x259ee1;for(var _0x34805f in this['campaigns']){if(typeof this[_0x01f6('0x26')][_0x34805f]!=='undefined'){_0x259ee1=this[_0x01f6('0x26')][_0x34805f];if(isCampaignIvr(_0x259ee1[_0x01f6('0x56')])&&isActive(_0x259ee1[_0x01f6('0x86')])){_0x259ee1[_0x01f6('0xb0')]=!![];BPromise['resolve']()[_0x01f6('0x42')](checkIsActive(_0x259ee1,_0x259ee1[_0x01f6('0x86')]))['then'](checkInterval(_0x259ee1))[_0x01f6('0x42')](_0xcc66b5[_0x01f6('0x14d')](_0x259ee1))[_0x01f6('0x42')](_0xcc66b5[_0x01f6('0x170')](_0x259ee1[_0x01f6('0x171')],_0x259ee1['dialTimezone'],_0x259ee1[_0x01f6('0x48')],_0x259ee1))[_0x01f6('0x42')](_0xcc66b5[_0x01f6('0x153')](_0x259ee1[_0x01f6('0x4c')],_0x259ee1[_0x01f6('0x172')],_0x259ee1['name'],_0x259ee1))[_0x01f6('0x42')](_0xcc66b5[_0x01f6('0x16f')](_0x259ee1))[_0x01f6('0xbc')](loggerCatchQueueSummary('[syncCampaigns]',_0x259ee1));}else{notSendMessagesCampaign(_0x259ee1);}}}};function getCallerIdRandom(_0x3a520f,_0x4a2f2b){var _0x3caf95;var _0x4cefee;var _0x197cd7;if(_0x4a2f2b<=0x0){_0x4a2f2b=0x1;}_0x3caf95=new RegExp('\x5cw{0,'+_0x4a2f2b+'}$');_0x4cefee=Math[_0x01f6('0x174')](0xa,_0x4a2f2b-0x1);_0x197cd7=Math['pow'](0xa,_0x4a2f2b)-0x1;return util[_0x01f6('0x88')]('%s',_[_0x01f6('0x175')](_0x3a520f,_0x3caf95,_[_0x01f6('0x176')](_0x4cefee,_0x197cd7)));}function extractCalleridName(_0x5234b1){var _0x1b07fb=_0x5234b1[_0x01f6('0x177')](/"(.*?)"/);return _0x1b07fb?_0x1b07fb[0x1]:_0x5234b1;}function extractCalleridNumber(_0x442e36){var _0x5ae301=_0x442e36[_0x01f6('0x177')](/<(.*?)>/);return _0x5ae301?_0x5ae301[0x1]:_0x442e36;}Dialer[_0x01f6('0x20')][_0x01f6('0x178')]=function(_0x155a61,_0x1bdb2c){var _0x5c3b65=this;var _0x3bf4ef=uuid['v4']();this['actions'][_0x3bf4ef]=new Action(_0x155a61,_0x1bdb2c,_0x3bf4ef);return new BPromise(function(_0x31a747,_0x18b479){if(_['isUndefined'](_0x155a61)&&typeof _0x155a61!==_0x01f6('0x179')){return _0x18b479(msgResponse(_0x01f6('0x17a'),_0x01f6('0x156'),_0x01f6('0x17b')));}if(_[_0x01f6('0x97')](_0x1bdb2c[_0x01f6('0x17c')])||_0x1bdb2c[_0x01f6('0x17c')]===null){return _0x18b479(msgResponse(_0x01f6('0x17a'),_0x01f6('0x156'),_0x01f6('0x17d')));}var _0x3d52ae={'XMD-CALLERID':_0x5c3b65['actions'][_0x3bf4ef][_0x01f6('0x17e')](),'XMD-AGI':_0x155a61['dialQueueProject']?util[_0x01f6('0x88')](_0x01f6('0x17f'),ipAgi,_0x155a61[_0x01f6('0x114')]):_0x01f6('0x180'),'XMD-AGIAFTER':_0x155a61[_0x01f6('0x11b')]?util[_0x01f6('0x88')](_0x01f6('0x17f'),ipAgi,_0x155a61[_0x01f6('0x11b')]):_0x01f6('0x180'),'XMD-QUEUE':_0x155a61['type']==='outbound'?util[_0x01f6('0x88')](_0x01f6('0x181'),_0x155a61[_0x01f6('0x48')],_0x155a61[_0x01f6('0x182')]||'',_0x155a61[_0x01f6('0x11c')]?'c':'',_0x155a61[_0x01f6('0x122')]||0x3):'NONE','XMD-CONTACTID':_0x1bdb2c[_0x01f6('0xdf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5c3b65[_0x01f6('0x2b')][_0x3bf4ef][_0x01f6('0x17e')](),'XMD-AMD':_0x155a61[_0x01f6('0xed')]?'ACTIVE':_0x01f6('0x180'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x155a61['dialAMDActive']){_0x3d52ae[_0x01f6('0x183')]=_0x155a61[_0x01f6('0x184')]||0x9c4;_0x3d52ae[_0x01f6('0x185')]=_0x155a61[_0x01f6('0x186')]||0x5dc;_0x3d52ae[_0x01f6('0x187')]=_0x155a61['dialAMDAfterGreetingSilence']||0x320;_0x3d52ae[_0x01f6('0x188')]=_0x155a61[_0x01f6('0x189')]||0x1388;_0x3d52ae['XMD-AMDMINWORDLENGTH']=_0x155a61[_0x01f6('0x18a')]||0x64;_0x3d52ae[_0x01f6('0x18b')]=_0x155a61[_0x01f6('0x18c')]||0x32;_0x3d52ae[_0x01f6('0x18d')]=_0x155a61[_0x01f6('0x18e')]||0x3;_0x3d52ae['XMD-AMDSILENCETHRESHOLD']=_0x155a61['dialAMDSilenceThreshold']||0x100;_0x3d52ae[_0x01f6('0x18f')]=_0x155a61[_0x01f6('0x190')]||0x1388;}if(_0x155a61[_0x01f6('0x56')]===_0x01f6('0x57')){_0x3d52ae[_0x01f6('0x191')]=_0x1bdb2c[_0x01f6('0xe2')];}else{_0x3d52ae[_0x01f6('0x192')]=_0x1bdb2c[_0x01f6('0x10b')];}for(var _0x2041ea in _0x1bdb2c['Contact']){if(typeof _0x1bdb2c[_0x01f6('0x193')][_0x2041ea]!=='undefined'){if(isNotNull(_0x1bdb2c[_0x01f6('0x193')][_0x2041ea])&&_0x2041ea!=='id'&&_0x2041ea!==_0x01f6('0x194')&&_0x2041ea!==_0x01f6('0x195')&&_0x2041ea!=='updatedAt'){_0x3d52ae[util[_0x01f6('0x88')]('%s%s',_0x01f6('0x196'),_['toUpper'](_0x2041ea))]=_0x1bdb2c[_0x01f6('0x193')][_0x2041ea];}}}var _0x447532=_0x5c3b65[_0x01f6('0x14e')](_0x155a61[_0x01f6('0x85')])?getCallerId(_0x155a61[_0x01f6('0x85')][_0x01f6('0x197')],_0x155a61['dialOriginateCallerIdName'],_0x155a61[_0x01f6('0x198')]>0x0?getCallerIdRandom(_0x155a61[_0x01f6('0x67')],_0x155a61[_0x01f6('0x198')]):_0x155a61['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x155a61['TrunkBackup'])?_0x155a61[_0x01f6('0x85')]['callerid']:_0x155a61[_0x01f6('0x14f')]['callerid'],_0x155a61[_0x01f6('0x66')],_0x155a61['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x155a61[_0x01f6('0x67')],_0x155a61[_0x01f6('0x198')]):_0x155a61['dialOriginateCallerIdNumber']);if(_0x447532){_0x3d52ae['XMD-ORIGINATECALLERIDNAME']=_0x5c3b65['actions'][_0x3bf4ef][_0x01f6('0x199')]=extractCalleridName(_0x447532);_0x3d52ae['XMD-ORIGINATECALLERIDNUM']=_0x1bdb2c[_0x01f6('0x17c')];}return ami[_0x01f6('0x15a')]({'actionid':_0x3bf4ef,'action':'originate','channel':_0x5c3b65['isTrunkReachable'](_0x155a61[_0x01f6('0x85')])?util[_0x01f6('0x88')](_0x01f6('0x19a'),_0x155a61[_0x01f6('0x85')][_0x01f6('0x48')],isNotNull(_0x155a61[_0x01f6('0x69')])?_0x155a61[_0x01f6('0x69')][_0x01f6('0x19b')]()||'':'',_0x155a61[_0x01f6('0x19c')]>0x0?_0x1bdb2c[_0x01f6('0x17c')]['substring'](_0x155a61[_0x01f6('0x19c')]):_0x1bdb2c[_0x01f6('0x17c')]):util[_0x01f6('0x88')](_0x01f6('0x19a'),_[_0x01f6('0xea')](_0x155a61['TrunkBackup'])?_0x155a61['Trunk']['name']:_0x155a61[_0x01f6('0x14f')][_0x01f6('0x48')],isNotNull(_0x155a61[_0x01f6('0x69')])?_0x155a61['dialPrefix'][_0x01f6('0x19b')]()||'':'',_0x155a61[_0x01f6('0x19c')]>0x0?_0x1bdb2c[_0x01f6('0x17c')][_0x01f6('0x19d')](_0x155a61[_0x01f6('0x19c')]):_0x1bdb2c[_0x01f6('0x17c')]),'callerid':_0x447532,'Exten':_0x01f6('0xec'),'Context':_0x01f6('0x19e'),'Priority':'1','variable':_0x3d52ae,'timeout':(_0x155a61[_0x01f6('0x68')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3bf4ef})[_0x01f6('0x42')](function(_0x53e71c){return _0x31a747(_0x53e71c);})[_0x01f6('0xbc')](function(_0x35c62f){_0x155a61[_0x01f6('0x73')]+=0x1;var _0x290120=new History(_0x5c3b65[_0x01f6('0x2b')][_0x3bf4ef]);logger[_0x01f6('0xa6')](util[_0x01f6('0x88')](_0x01f6('0x19f'),JSON['stringify'](_0x35c62f)));_0x290120['state']=0xe;_0x290120[_0x01f6('0xb7')]='OriginateError';_0x290120[_0x01f6('0x134')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x290120[_0x01f6('0x12b')]=_0x290120[_0x01f6('0x134')];_0x5c3b65[_0x01f6('0xda')](_0x290120)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1a0')));_0x5c3b65[_0x01f6('0xd8')](_0x290120)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1a0')))[_0x01f6('0x140')](function(){delete _0x5c3b65['actions'][_0x3bf4ef];return _0x18b479(msgResponse(_0x01f6('0x17a'),_0x01f6('0x50'),_0x01f6('0x1a1')));});});});};Dialer['prototype'][_0x01f6('0x36')]=function(_0x5ce5e0){var _0x12f6a6=this['actions'][_0x5ce5e0[_0x01f6('0x136')]];if(_0x12f6a6){delete this[_0x01f6('0x2b')][_0x5ce5e0['actionid']];_0x12f6a6[_0x01f6('0x121')]=moment()[_0x01f6('0x88')](_0x01f6('0x10a'));var _0xa030f5=_0x12f6a6[_0x01f6('0x56')]===_0x01f6('0x8b')?this[_0x01f6('0x26')][_0x12f6a6[_0x01f6('0xbf')]]:this[_0x01f6('0x25')][_0x12f6a6[_0x01f6('0x1a2')]()];if(!this[_0x01f6('0xe5')](_0x5ce5e0[_0x01f6('0x1a3')])){this[_0x01f6('0xbe')](_0xa030f5);return this['callProgressDetecting'](_0x12f6a6,_0xa030f5,_0x5ce5e0)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1a4')));}this['uniqueId'][_0x5ce5e0[_0x01f6('0xef')]]=_0x12f6a6;}};Dialer[_0x01f6('0x20')][_0x01f6('0x1a5')]=function(_0xc7dcb8,_0x24f261,_0x26425e){var _0x5350ce=new History(_0x24f261);if(_0x5350ce[_0x01f6('0xfe')]+_0x5350ce[_0x01f6('0x1a6')]+_0x5350ce['countnoanswerretry']+_0x5350ce[_0x01f6('0x100')]+_0x5350ce[_0x01f6('0x101')]+_0x5350ce['countabandonedretry']+_0x5350ce[_0x01f6('0xfa')]+_0x5350ce[_0x01f6('0x10f')]>=_0x26425e[_0x01f6('0x103')]-0x1){return!![];}switch(_0xc7dcb8){case 0x3:if(_0x5350ce[_0x01f6('0xff')]>=_0x26425e['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x01f6('0xcd')]({'active':![],'countnoanswerretry':_0x5350ce[_0x01f6('0xff')]+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e[_0x01f6('0x1a7')],_0x01f6('0x109'))[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce[_0x01f6('0xdf')],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce[_0x01f6('0xe2')]||undefined,'CampaignId':_0x5350ce[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5350ce['countbusyretry']>=_0x26425e['dialBusyMaxRetry']-0x1){return!![];}this[_0x01f6('0xcd')]({'active':![],'countbusyretry':_0x5350ce[_0x01f6('0xfe')]+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e['dialBusyRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5350ce['ContactId'],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce[_0x01f6('0xe2')]||undefined,'CampaignId':_0x5350ce['CampaignId']||undefined})[_0x01f6('0xbc')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5350ce[_0x01f6('0x1a6')]>=_0x26425e['dialCongestionMaxRetry']-0x1){return!![];}this[_0x01f6('0xcd')]({'active':![],'countcongestionretry':_0x5350ce[_0x01f6('0x1a6')]+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e[_0x01f6('0x1a8')],_0x01f6('0x109'))[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce['ContactId'],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce[_0x01f6('0xe2')]||undefined,'CampaignId':_0x5350ce[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1a9')));break;case 0x0:if(_0x5350ce[_0x01f6('0x100')]>=_0x26425e['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x01f6('0xcd')]({'active':![],'countnosuchnumberretry':_0x5350ce['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e[_0x01f6('0x1aa')],'minutes')[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce[_0x01f6('0xdf')],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce['VoiceQueueId']||undefined,'CampaignId':_0x5350ce[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1ab')));}break;case 0xa:if(_0x5350ce[_0x01f6('0x101')]>=_0x26425e[_0x01f6('0x129')]-0x1){return!![];}this[_0x01f6('0xcd')]({'active':![],'countdropretry':_0x5350ce[_0x01f6('0x101')]+=0x1,'scheduledat':moment()['add'](_0x26425e[_0x01f6('0x127')],'minutes')[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce[_0x01f6('0xdf')],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce['VoiceQueueId']||undefined,'CampaignId':_0x5350ce[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5350ce[_0x01f6('0x102')]>=_0x26425e[_0x01f6('0x131')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x5350ce[_0x01f6('0x102')]+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e[_0x01f6('0x130')],'minutes')[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce[_0x01f6('0xdf')],'ListId':_0x5350ce['ListId'],'VoiceQueueId':_0x5350ce[_0x01f6('0xe2')]||undefined,'CampaignId':_0x5350ce['CampaignId']||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x132')));break;case 0x13:if(_0x5350ce[_0x01f6('0xfa')]>=_0x26425e[_0x01f6('0x104')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x5350ce[_0x01f6('0xfa')]+=0x1,'scheduledat':moment()[_0x01f6('0x107')](_0x26425e[_0x01f6('0x108')],_0x01f6('0x109'))[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce[_0x01f6('0xdf')],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce['VoiceQueueId']||undefined,'CampaignId':_0x5350ce['CampaignId']||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x10c')));break;case 0x14:if(_0x5350ce[_0x01f6('0x10f')]>=_0x26425e['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5350ce[_0x01f6('0x10f')]+=0x1,'scheduledat':moment()['add'](_0x26425e[_0x01f6('0x1ac')],_0x01f6('0x109'))[_0x01f6('0x88')](_0x01f6('0x10a')),'ContactId':_0x5350ce['ContactId'],'ListId':_0x5350ce[_0x01f6('0xe0')],'VoiceQueueId':_0x5350ce['VoiceQueueId']||undefined,'CampaignId':_0x5350ce['CampaignId']||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1ad')));break;default:return!![];}};Dialer[_0x01f6('0x20')][_0x01f6('0x1ae')]=function(_0x202d8c,_0x49d45c,_0x526180){var _0x1e253f=this;var _0x598ae7=new History(_0x202d8c);var _0x5e5daa=![];var _0x3f48b0;var _0x2a9db1;return new BPromise(function(_0x8096f5,_0x21de9e){if(_[_0x01f6('0x97')](_0x49d45c)&&typeof _0x49d45c!==_0x01f6('0x179')){return _0x21de9e(msgResponse(_0x01f6('0x1af'),_0x01f6('0x156'),_0x01f6('0x1b0')));}if(_['isUndefined'](_0x526180)&&typeof _0x526180!==_0x01f6('0x179')){return _0x21de9e(msgResponse(_0x01f6('0x1af'),_0x01f6('0x156'),_0x01f6('0x1b1')));}_0x1e253f[_0x01f6('0xc5')](_0x598ae7,_0x526180[_0x01f6('0x118')],_0x49d45c)[_0x01f6('0x42')](function(_0x3e6d4b){if(_0x3e6d4b['additional']==0x1)_0x5e5daa=!![];switch(_0x526180['reason']){case'0':_0x49d45c[_0x01f6('0x72')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0x0;_0x598ae7[_0x01f6('0xb7')]=_0x01f6('0x1b2');_0x598ae7['countnosuchnumberretry']+=0x1;_0x598ae7['countglobal']+=0x1;ami[_0x01f6('0x55')](_0x01f6('0x1b3'),ut[_0x01f6('0xf4')](_0x202d8c,_0x01f6('0x1b4')));_0x3f48b0=_0x49d45c[_0x01f6('0x1aa')];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];_0x1e253f['createHistory'](_0x598ae7)['catch'](loggerCatch(_0x01f6('0xfd')));if(_0x1e253f[_0x01f6('0x1a5')](0x0,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0x100')]>=_0x49d45c['dialNoSuchNumberMaxRetry']){_0x1e253f[_0x01f6('0x105')](_0x598ae7,_0x8096f5,_0x21de9e,'reason\x200\x20no\x20such\x20number....');}else{_0x1e253f['stateGlobal'](_0x598ae7,_0x8096f5,_0x21de9e,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x49d45c[_0x01f6('0x71')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0x3;_0x598ae7[_0x01f6('0xb7')]=_0x01f6('0x1b6');_0x598ae7[_0x01f6('0xff')]+=0x1;_0x598ae7[_0x01f6('0xfb')]+=0x1;ami['emit'](_0x01f6('0x1b7'),ut[_0x01f6('0xf4')](_0x202d8c,_0x01f6('0x1b8')));_0x3f48b0=_0x49d45c['dialNoAnswerRetryFrequency'];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];_0x1e253f[_0x01f6('0xda')](_0x598ae7)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1b9')));if(_0x1e253f[_0x01f6('0x1a5')](0x3,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0xff')]>=_0x49d45c[_0x01f6('0x1ba')]){_0x1e253f['createStateFinal'](_0x598ae7,_0x8096f5,_0x21de9e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1e253f[_0x01f6('0x110')](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1bb'));}}break;case'5':_0x49d45c[_0x01f6('0x6c')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0x5;_0x598ae7[_0x01f6('0xb7')]=_0x01f6('0x1bc');_0x598ae7['countbusyretry']+=0x1;_0x598ae7[_0x01f6('0xfb')]+=0x1;ami[_0x01f6('0x55')]('custom:agentbusy',ut[_0x01f6('0xf4')](_0x202d8c,_0x01f6('0x1bd')));_0x3f48b0=_0x49d45c[_0x01f6('0x1be')];_0x2a9db1=_0x49d45c['callAdditionalPhoneAfterMin'];_0x1e253f['createHistory'](_0x598ae7)[_0x01f6('0xbc')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1e253f[_0x01f6('0x1a5')](0x5,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0xfe')]>=_0x49d45c[_0x01f6('0x1bf')]){_0x1e253f[_0x01f6('0x105')](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1c0'));}else{_0x1e253f['stateGlobal'](_0x598ae7,_0x8096f5,_0x21de9e,'reason\x205\x20busy');}}break;case'8':_0x49d45c[_0x01f6('0x6d')]+=0x1;_0x598ae7['state']=0x8;_0x598ae7[_0x01f6('0xb7')]=_0x01f6('0x1c1');_0x598ae7[_0x01f6('0x1a6')]+=0x1;_0x598ae7[_0x01f6('0xfb')]+=0x1;_0x3f48b0=_0x49d45c[_0x01f6('0x1a8')];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];ami[_0x01f6('0x55')](_0x01f6('0x1c2'),ut['buildObj'](_0x202d8c,_0x01f6('0x1c3')));_0x1e253f[_0x01f6('0xda')](_0x598ae7)[_0x01f6('0xbc')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1e253f[_0x01f6('0x1a5')](0x8,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0x1a6')]>=_0x49d45c[_0x01f6('0x1c4')]){_0x1e253f['createStateFinal'](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1c5'));}else{_0x1e253f[_0x01f6('0x110')](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1c5'));}}break;case'11':_0x49d45c[_0x01f6('0x1c6')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0xb;_0x598ae7[_0x01f6('0xb7')]='Abandoned';_0x598ae7['countabandonedretry']+=0x1;_0x598ae7[_0x01f6('0xfb')]+=0x1;_0x3f48b0=_0x49d45c[_0x01f6('0x130')];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];_0x1e253f[_0x01f6('0xda')](_0x598ae7)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x135')));if(_0x1e253f[_0x01f6('0x1a5')](0xb,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0x102')]>=_0x49d45c[_0x01f6('0x131')]){_0x1e253f['createStateFinal'](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1c7'));}else{_0x1e253f['stateGlobal'](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1c7'));}}break;case'20':_0x49d45c[_0x01f6('0x75')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0x14;_0x598ae7[_0x01f6('0xb7')]=_0x01f6('0x1c8');_0x598ae7[_0x01f6('0x10f')]+=0x1;_0x598ae7[_0x01f6('0xfb')]+=0x1;_0x3f48b0=_0x49d45c[_0x01f6('0x1ac')];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];ami[_0x01f6('0x55')](_0x01f6('0x1c9'),ut['buildObj'](_0x202d8c,'agentreject'));_0x1e253f[_0x01f6('0xda')](_0x598ae7)[_0x01f6('0xbc')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1e253f[_0x01f6('0x1a5')](0x14,_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7['countagentrejectretry']>=_0x49d45c['dialAgentRejectMaxRetry']){_0x1e253f[_0x01f6('0x105')](_0x598ae7,_0x8096f5,_0x21de9e,_0x01f6('0x1ca'));}else{_0x1e253f[_0x01f6('0x110')](_0x598ae7,_0x8096f5,_0x21de9e,'reason\x2020\x20agentreject');}}break;default:_0x49d45c[_0x01f6('0x76')]+=0x1;_0x598ae7[_0x01f6('0xb6')]=0xc;_0x598ae7[_0x01f6('0xb7')]=_0x526180[_0x01f6('0x118')];_0x3f48b0=_0x49d45c[_0x01f6('0x1ac')];_0x2a9db1=_0x49d45c[_0x01f6('0x1b5')];_0x1e253f[_0x01f6('0xda')](_0x598ae7)[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1cb')));if(_0x1e253f['checkRetriveMax'](_0x526180[_0x01f6('0x118')],_0x202d8c,_0x49d45c)&&!_0x5e5daa){if(_0x598ae7[_0x01f6('0xfe')]+_0x598ae7[_0x01f6('0x1a6')]+_0x598ae7[_0x01f6('0xff')]+_0x598ae7[_0x01f6('0x100')]+_0x598ae7[_0x01f6('0x101')]+_0x598ae7[_0x01f6('0x102')]+_0x598ae7[_0x01f6('0xfa')]+_0x598ae7[_0x01f6('0x10f')]>=_0x49d45c[_0x01f6('0x103')]){_0x1e253f['stateGlobal'](_0x598ae7,_0x8096f5,_0x21de9e,_0x526180['reason']);}else{_0x1e253f['createStateFinal'](_0x598ae7,_0x8096f5,_0x21de9e,_0x526180[_0x01f6('0x118')]);}}}})[_0x01f6('0x42')](function(_0x23ac3c){if(_0x5e5daa){_0x1e253f['swapAdditionalPhones'](_0x598ae7,_0x3f48b0,_0x2a9db1)[_0x01f6('0x42')](function(_0x44b687){return _0x8096f5(0x1);});}});});};Dialer[_0x01f6('0x20')]['stateGlobal']=function(_0x2a0577,_0x3b06b5,_0x45f39a,_0x306a8f){var _0x32ef76=new Final(_0x2a0577);_0x32ef76[_0x01f6('0xb6')]=0xf;_0x32ef76['statedesc']=_0x01f6('0x1cc');this[_0x01f6('0x105')](_0x32ef76,_0x3b06b5,_0x45f39a,_0x306a8f);};Dialer[_0x01f6('0x20')][_0x01f6('0x105')]=function(_0x412ef3,_0x456041,_0x38897b,_0x117093){this['moveContactManagedDialer'](_0x412ef3)[_0x01f6('0x42')](function(){return _0x456041(msgResponse(_0x01f6('0x1af'),_0x01f6('0xe6'),_0x117093));})['catch'](function(){return _0x38897b(msgResponse(_0x01f6('0x1cd'),_0x01f6('0x156'),_0x01f6('0x1ce')));});};Dialer[_0x01f6('0x20')][_0x01f6('0x9')]=function(_0x15e3af){var _0x2587e4=_0x15e3af[_0x01f6('0x1cf')]/0x64;var _0x5873bc=_0x15e3af[_0x01f6('0x70')]/(_0x15e3af[_0x01f6('0x70')]+_0x15e3af[_0x01f6('0x6a')]);var _0x4079ee=Math[_0x01f6('0x1d0')](_0x15e3af[_0x01f6('0x1d1')]*(_0x15e3af[_0x01f6('0x1d2')]/0x64));var _0x145b5a=Math[_0x01f6('0x1d0')](_0x15e3af[_0x01f6('0x1d1')]*(_0x15e3af[_0x01f6('0x1d3')]/0x64));var _0x3f6895=_0x15e3af[_0x01f6('0x59')]+_0x15e3af[_0x01f6('0x5e')];var _0x38072b=Math[_0x01f6('0x1d4')](_0x15e3af['erlangCalls']*_0x15e3af[_0x01f6('0x82')]*_0x15e3af['predictiveIntervalHitRate']*_0x15e3af[_0x01f6('0x7c')]);if(_[_0x01f6('0x97')](_0x15e3af[_0x01f6('0x84')])){if(!_['isUndefined'](_0x15e3af[_0x01f6('0x2e')])){_0x15e3af[_0x01f6('0x2e')]=undefined;loggerPredictive['error'](_0x01f6('0x1d5'),_0x01f6('0x1d6'));}if(!_['isUndefined'](_0x15e3af['handlePredictive'])){loggerPredictive[_0x01f6('0xa6')](_0x01f6('0x1d5'),_0x01f6('0x1d7'));clearInterval(_0x15e3af['handlePredictive']);_0x15e3af['handlePredictive']=undefined;}_0x15e3af[_0x01f6('0x84')]=moment()[_0x01f6('0x88')](_0x01f6('0x10a'));loggerPredictive[_0x01f6('0x8e')](_0x15e3af[_0x01f6('0x48')],_0x01f6('0x1d8'),_0x15e3af[_0x01f6('0x84')]);this['handlePower'](_0x15e3af,0x1);}else if(ifInterval(_0x15e3af[_0x01f6('0x1d9')],_0x15e3af[_0x01f6('0x84')])){this[_0x01f6('0x169')](_0x15e3af,0x1);loggerPredictiveCalls['info'](_0x01f6('0x1da'),_0x15e3af['startProgressive'],_0x15e3af[_0x01f6('0x48')]);_0x15e3af[_0x01f6('0x80')]=0x0;_0x15e3af[_0x01f6('0x123')]=0x0;}else if(_0x2587e4<_0x5873bc&&_0x15e3af[_0x01f6('0x1db')]===_0x01f6('0x1dc')){freeVariablesPredictive(_0x15e3af);loggerPredictive[_0x01f6('0x8e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x01f6('0x1dd'),_0x5873bc,'startProgressive',_0x15e3af[_0x01f6('0x48')]);}else if(_0x38072b<_0x15e3af[_0x01f6('0x123')]&&_0x15e3af[_0x01f6('0x1db')]===_0x01f6('0x1dc')){freeVariablesPredictive(_0x15e3af);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x01f6('0x1de'),_0x38072b,_0x01f6('0x1df'),_0x15e3af['predictiveIntervalErlangCallsDroppedCalls'],_0x01f6('0x84'),_0x15e3af[_0x01f6('0x48')]);}else if(!ifInterval(_0x15e3af[_0x01f6('0x1d9')],_0x15e3af[_0x01f6('0x84')])&&_[_0x01f6('0x97')](_0x15e3af[_0x01f6('0x2e')])&&!_['isUndefined'](_0x15e3af['startProgressive'])){_0x15e3af['startPredictive']=moment()[_0x01f6('0x88')](_0x01f6('0x10a'));loggerPredictive[_0x01f6('0x8e')](_0x15e3af[_0x01f6('0x48')],'started\x20in\x20predictive\x20at',_0x15e3af[_0x01f6('0x2e')]);this[_0x01f6('0xca')](_0x15e3af[_0x01f6('0x1d9')])[_0x01f6('0x42')](this[_0x01f6('0x1e0')](_0x15e3af))[_0x01f6('0x42')](mergeDataErlangB(_0x15e3af))['then'](this[_0x01f6('0x1e1')](_0x15e3af))[_0x01f6('0xbc')](loggerCatchPredictive(_0x01f6('0x1e2'),_0x15e3af));}else if(!ifInterval(_0x15e3af[_0x01f6('0x1d9')],_0x15e3af[_0x01f6('0x2e')])){_0x15e3af[_0x01f6('0x123')]=0x0;_0x15e3af[_0x01f6('0x2e')]=moment()[_0x01f6('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x01f6('0x8e')](_0x15e3af[_0x01f6('0x48')],_0x01f6('0x1e3'),_0x15e3af['startPredictive']);clearInterval(_0x15e3af[_0x01f6('0xa2')]);_0x15e3af['handlePredictive']=undefined;this[_0x01f6('0xca')](_0x15e3af[_0x01f6('0x1d9')])[_0x01f6('0x42')](this[_0x01f6('0x1e0')](_0x15e3af))[_0x01f6('0x42')](mergeDataErlangB(_0x15e3af))[_0x01f6('0x42')](this[_0x01f6('0x1e1')](_0x15e3af))[_0x01f6('0xbc')](loggerCatchPredictive(_0x01f6('0x1e4'),_0x15e3af));}else if(_0x15e3af[_0x01f6('0x1d1')]&&_0x3f6895<_0x15e3af[_0x01f6('0x1d1')]-_0x145b5a){freeVariablesPredictive(_0x15e3af);loggerPredictive['info'](_0x15e3af[_0x01f6('0x48')],_0x01f6('0x1e5'),_0x3f6895,_0x01f6('0x1e6'),_0x15e3af['predictiveIntervalAvailable'],'-',_0x145b5a,'=',_0x15e3af['predictiveIntervalAvailable']-_0x145b5a,')');}else if(_0x15e3af['predictiveIntervalAvailable']&&_0x3f6895>_0x15e3af[_0x01f6('0x1d1')]+_0x4079ee){freeVariablesPredictive(_0x15e3af);loggerPredictive[_0x01f6('0x8e')](_0x15e3af['name'],_0x01f6('0x1e5'),_0x3f6895,_0x01f6('0x1e7'),_0x15e3af['predictiveIntervalAvailable'],'+',_0x4079ee,'=',_0x15e3af[_0x01f6('0x1d1')]+_0x4079ee,')');}};Dialer[_0x01f6('0x20')]['getDataPredictive']=function(_0x39412){var _0x3ccb09=this;return function(_0x18d7de){return new BPromise(function(_0x5acfe7,_0x4dabc1){_['merge'](_0x39412,_0x18d7de[0x0]);if(checkGetDataPredictive(_0x18d7de[0x0])){var _0x5a20b3=_0x39412[_0x01f6('0x1d1')]=_0x39412['talking']+_0x39412['available'];var _0xa47a9f=_0x39412['dialPredictiveInterval']*0x3c;var _0x21bb9c=_0x18d7de[0x0][_0x01f6('0x96')]+_0x18d7de[0x0]['predictiveIntervalAvgHoldtime'];var _0x462886=(_0x18d7de[0x0][_0x01f6('0x77')]+_0x18d7de[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x18d7de[0x0][_0x01f6('0x79')])/_0x18d7de[0x0][_0x01f6('0x7e')];_0x39412[_0x01f6('0x7b')]=_0x462886>0x0?_0x462886:0x1;switch(_0x39412[_0x01f6('0x1db')]){case _0x01f6('0x1dc'):var _0x2451aa=_0x39412[_0x01f6('0x1cf')]/0x64;return _0x3ccb09[_0x01f6('0x1e8')](_0x5a20b3,_0xa47a9f,_0x21bb9c,_0x462886,_0x2451aa)[_0x01f6('0x42')](function(_0x58aa39){return _0x5acfe7(_0x58aa39);});case _0x01f6('0x1e9'):var _0x4bb21a=_0x39412[_0x01f6('0x1cf')]/0x64;return _0x3ccb09[_0x01f6('0x1ea')](_0x5a20b3,_0xa47a9f,_0x21bb9c,_0x462886,_0x4bb21a)[_0x01f6('0x42')](function(_0x73e6ac){return _0x5acfe7(_0x73e6ac);});default:return _0x4dabc1(msgResponse('[getDataPredictive]',_0x01f6('0x156'),_0x01f6('0x1eb')));}}else{return _0x4dabc1(msgResponse(_0x01f6('0x1ec'),_0x01f6('0x156'),_0x01f6('0x1ed')));}});};};Dialer['prototype'][_0x01f6('0x1ee')]=function(_0x32e32e){var _0x4c4d7a=this;return function(_0x495698){return new BPromise(function(_0x272b48,_0x15e6ff){_[_0x01f6('0x9f')](_0x32e32e,_0x495698[0x0]);if(checkGetDataPredictive(_0x495698[0x0])){loggerPredictive[_0x01f6('0x8e')](JSON[_0x01f6('0x51')](_0x495698[0x0]));if(_0x32e32e['dialPredictiveOptimization']==='dropRate'){return _0x4c4d7a[_0x01f6('0xd6')](_0x32e32e['id'])[_0x01f6('0x42')](function(_0x2b6351){var _0x365838=_0x32e32e[_0x01f6('0x5a')]-_0x2b6351[0x0][_0x01f6('0x1ef')];var _0x46e1b6=_0x32e32e[_0x01f6('0x1d9')]*0x3c;var _0x791755=_0x495698[0x0]['predictiveIntervalAvgTalktime']+_0x495698[0x0][_0x01f6('0x78')];var _0xe82283=(_0x495698[0x0][_0x01f6('0x77')]+_0x495698[0x0][_0x01f6('0x92')]+_0x495698[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x495698[0x0]['predictiveIntervalTotalCalls'];var _0x2671f1=_0x32e32e[_0x01f6('0x1cf')]/0x64;_0x32e32e[_0x01f6('0x7d')]=_0x2b6351[0x0]['outboundQueuePauses']||0x0;_0x32e32e[_0x01f6('0x7b')]=_0xe82283>0x0?_0xe82283:0x1;return _0x4c4d7a[_0x01f6('0x1e8')](_0x365838,_0x46e1b6,_0x791755,_0xe82283,_0x2671f1);})[_0x01f6('0x42')](function(_0x281ec7){return _0x272b48(_0x281ec7);})[_0x01f6('0xbc')](function(_0x567443){return _0x15e6ff(msgResponse(_0x01f6('0x1f0'),_0x01f6('0x156'),JSON['stringify'](_0x567443)));});}if(_0x32e32e[_0x01f6('0x1db')]===_0x01f6('0x1e9')){return _0x4c4d7a[_0x01f6('0xd6')](_0x32e32e['id'])[_0x01f6('0x42')](function(_0x25f2ed){var _0x26cfd3=_0x32e32e[_0x01f6('0x5a')]-_0x25f2ed[0x0][_0x01f6('0x1ef')];var _0x3c7ad2=_0x32e32e['dialPredictiveInterval']*0x3c;var _0x170afd=_0x495698[0x0][_0x01f6('0x96')]+_0x495698[0x0][_0x01f6('0x78')];var _0x2b587b=(_0x495698[0x0]['predictiveIntervalAnsweredCalls']+_0x495698[0x0][_0x01f6('0x92')]+_0x495698[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x495698[0x0][_0x01f6('0x7e')];var _0xd3d04a=_0x32e32e[_0x01f6('0x1cf')]/0x64;_0x32e32e[_0x01f6('0x7d')]=_0x25f2ed[0x0]['outboundQueuePauses']||0x0;_0x32e32e[_0x01f6('0x7b')]=_0x2b587b>0x0?_0x2b587b:0x1;return _0x4c4d7a[_0x01f6('0x1ea')](_0x26cfd3,_0x3c7ad2,_0x170afd,_0x2b587b,_0xd3d04a);})[_0x01f6('0x42')](function(_0x412491){return _0x272b48(_0x412491);})[_0x01f6('0xbc')](function(_0x1156a2){return _0x15e6ff(msgResponse(_0x01f6('0x1f0'),_0x01f6('0x156'),JSON[_0x01f6('0x51')](_0x1156a2)));});}}else{return _0x15e6ff(msgResponse('[getDataPredictive]',_0x01f6('0x156'),_0x01f6('0x1ed')));}});};};Dialer[_0x01f6('0x20')][_0x01f6('0x1e1')]=function(_0x48507d){var _0x58389c=this;return function(){var _0x25599c=0x0;var _0xbe47=Math[_0x01f6('0x1d4')](_0x48507d[_0x01f6('0x81')]*0x3e8);if(_0xbe47>0x0){_0xbe47=_0xbe47<0x64?0x64:_0xbe47;loggerPredictive['info'](_0x48507d['name'],_0x01f6('0x1f1'),_0xbe47,_0x01f6('0x52'));_0x48507d['handlePredictive']=setInterval(function(){_0x58389c['handlePredictive'](_0x48507d);loggerPredictiveCalls[_0x01f6('0x8e')](_0x01f6('0x1f2'),_0x25599c+=0x1);},_0xbe47);}else{loggerPredictive[_0x01f6('0x8e')](_0x48507d['name'],_0x01f6('0x1f3'));}};};Dialer[_0x01f6('0x20')]['checkContactBlack']=function(_0x452541,_0x590b0c){var _0x509931=this;return function(_0x2be0f0){if(_[_0x01f6('0x4e')](_0x2be0f0)){if(_[_0x01f6('0xea')](_0x590b0c[_0x01f6('0xe1')])||!_0x590b0c['recallme']){if(_0x452541[_0x01f6('0x65')]===_0x01f6('0x8')){_0x452541['queueStatusComplete']=_[_0x01f6('0x97')](_0x452541['queueStatusComplete'])?!![]:_0x452541['queueStatusComplete'];var _0x52b555=uuid['v4']();_0x509931[_0x01f6('0x2b')][_0x52b555]=new Action(_0x452541,_0x590b0c,_0x52b555);loggerBooked['info']('[booked][checkContactBlack]',_0x52b555,_0x01f6('0x1f4'),JSON[_0x01f6('0x51')](_0x452541['queueStatusComplete']),'Queue:\x20',_0x452541['name']);if(_0x452541[_0x01f6('0x13b')]){_0x452541[_0x01f6('0x13b')]=![];_0x509931['queueBooked'][_0x509931[_0x01f6('0x2b')][_0x52b555]['queue']]=[];ami[_0x01f6('0x15a')]({'actionid':_0x52b555,'action':_0x01f6('0x1f5'),'queue':_0x452541[_0x01f6('0x48')]})[_0x01f6('0xbc')](function(){_0x509931[_0x01f6('0xbe')](_0x452541);_0x509931[_0x01f6('0xcd')]({'active':![],'ContactId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0xdf')],'ListId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0xe0')],'VoiceQueueId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0xe2')]||undefined,'CampaignId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0x10b')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x509931[_0x01f6('0x2b')][_0x52b555];});}else{loggerBooked[_0x01f6('0x8e')](_0x01f6('0x1f6'),JSON[_0x01f6('0x51')](_0x452541[_0x01f6('0x13b')]),_0x01f6('0x1f7'),_0x452541[_0x01f6('0x48')]);_0x509931[_0x01f6('0xbe')](_0x452541);_0x509931[_0x01f6('0xcd')]({'active':![],'ContactId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0xdf')],'ListId':_0x509931[_0x01f6('0x2b')][_0x52b555][_0x01f6('0xe0')],'VoiceQueueId':_0x509931['actions'][_0x52b555][_0x01f6('0xe2')]||undefined,'CampaignId':_0x509931['actions'][_0x52b555][_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x509931[_0x01f6('0x2b')][_0x52b555];}}else{return _0x509931['actionOriginate'](_0x452541,_0x590b0c);}}else{if(getDiff(_0x590b0c[_0x01f6('0x1f8')])<_0x452541['dialRecallMeTimeout']*0x3c){if(_0x590b0c['Agent']&&!_0x590b0c[_0x01f6('0x16d')][_0x01f6('0x1f9')]){_0x509931['preview']['run'](_0x590b0c['id'])[_0x01f6('0x140')](function(){_0x509931[_0x01f6('0xbe')](_0x452541);});}else{_0x509931['unlockContact']({'active':![]},_0x590b0c['id'],0x1)[_0x01f6('0x140')](function(){_0x509931[_0x01f6('0xbe')](_0x452541);});}}else{_0x452541[_0x01f6('0x74')]+=0x1;_0x509931[_0x01f6('0xbe')](_0x452541);if(_0x452541['dialRecallInQueue']){_0x509931[_0x01f6('0xcd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x590b0c[_0x01f6('0xdf')],'ListId':_0x590b0c[_0x01f6('0xe0')],'VoiceQueueId':_0x590b0c['VoiceQueueId']||undefined,'CampaignId':_0x590b0c[_0x01f6('0x10b')]||undefined})[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x1fa')));_0x509931['createHistory'](createObjHistory(_0x452541,_0x590b0c,_0x01f6('0x1fb'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x509931['saveInDb'](createObjHistory(_0x452541,_0x590b0c,_0x01f6('0x1fc'),0x16,_0x01f6('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x452541[_0x01f6('0x6b')]+=0x1;_0x509931[_0x01f6('0x1fe')](createObjHistory(_0x452541,_0x590b0c,'BLACKLIST',0xd,_0x01f6('0x1ff')),_0x01f6('0x200'),_0x01f6('0x201'));throw _0x01f6('0x202');}};};Dialer[_0x01f6('0x20')]['handleIvr']=function(_0x46e6ac){var _0x587a48=this;var _0x2b56c0=_0x46e6ac[_0x01f6('0x203')]-_0x46e6ac[_0x01f6('0x7f')]-_0x46e6ac['temp'];emitCampaignSummary(_0x46e6ac);if(_0x2b56c0>0x0){if(_0x2b56c0>this[_0x01f6('0x29')]){_0x2b56c0=this['maxNumberOriginate'];}_0x46e6ac[_0x01f6('0xd2')]+=_0x2b56c0;this[_0x01f6('0xd4')](_0x46e6ac['id'],_0x2b56c0,_0x46e6ac['dialOrderByScheduledAt'],_0x46e6ac)[_0x01f6('0x42')](function(_0x518e97){_0x46e6ac[_0x01f6('0xd2')]-=_0x2b56c0;_0x46e6ac[_0x01f6('0xd2')]=_0x46e6ac[_0x01f6('0xd2')]>0x0?_0x46e6ac['temp']:0x0;if(!checkContactEmpty(_0x518e97)){_0x46e6ac[_0x01f6('0x44')]=_0x01f6('0xae');logger[_0x01f6('0x8e')](_0x01f6('0x204')+_0x46e6ac[_0x01f6('0x48')]);}else{_0x46e6ac[_0x01f6('0x7f')]+=_0x518e97['length'];_0x46e6ac[_0x01f6('0x44')]=_0x01f6('0x205');for(var _0x46e46e=0x0;_0x46e46e<_0x518e97['length'];_0x46e46e+=0x1){_0x46e6ac['ivrTotalCallsDays']+=0x1;if(_[_0x01f6('0xea')](_0x518e97[_0x46e46e])||_[_0x01f6('0xea')](_0x518e97[_0x46e46e]['Contact'])||_['isNil'](_0x518e97[_0x46e46e][_0x01f6('0x17c')])){_0x587a48['emptyContact']('[actionOriginate]\x20',_0x46e6ac,_0x518e97[_0x46e46e]);}else{_0x587a48[_0x01f6('0xc8')](_[_0x01f6('0xde')](_0x518e97[_0x46e46e],['CampaignId',_0x01f6('0x206')]))['then'](_0x587a48['checkContactBlack'](_0x46e6ac,_0x518e97[_0x46e46e]))[_0x01f6('0xbc')](_0x587a48['loggerHandler']('[actionOriginateIvr]\x20',_0x46e6ac));}}}})['catch'](loggerGetContactDialer(_0x01f6('0x207'),_0x46e6ac,_0x2b56c0));}};Dialer[_0x01f6('0x20')][_0x01f6('0x169')]=function(_0x56e40a,_0x30085f){var _0x293496=this;var _0x104811=[];var _0x22b64f=_0x30085f>=0x1?_0x30085f:0x1;if(_0x56e40a[_0x01f6('0x65')]===_0x01f6('0x8')){_0x22b64f=0x1;}var _0x526bc8=Math[_0x01f6('0x1d4')](_0x56e40a['available']*_0x22b64f)-_0x56e40a['originated']-_0x56e40a[_0x01f6('0xd2')];emitVoiceQueueSummary(_0x56e40a);if(_0x56e40a[_0x01f6('0x208')]>0x0){var _0x5a89cd=_0x56e40a['dialLimitQueue']-_0x56e40a[_0x01f6('0x7f')]-_0x56e40a['talking']-_0x56e40a[_0x01f6('0xd2')]-_0x56e40a[_0x01f6('0x5b')];if(_0x526bc8>_0x5a89cd){_0x526bc8=_0x5a89cd;}}if(_0x526bc8>0x0){if(_0x56e40a['dialMethod']===_0x01f6('0x8')){_0x526bc8=0x1;}if(_0x526bc8>this[_0x01f6('0x29')]){_0x526bc8=this[_0x01f6('0x29')];}_0x56e40a[_0x01f6('0xd2')]+=_0x526bc8;for(var _0x2be063 in this[_0x01f6('0x27')]){if(typeof this[_0x01f6('0x27')][_0x2be063]!==_0x01f6('0xa7')){if(this[_0x01f6('0x27')][_0x2be063]['state']===_0x01f6('0x209')&&this[_0x01f6('0x27')][_0x2be063]['status']==='reachable'){_0x104811['push'](this[_0x01f6('0x27')][_0x2be063]['id']);}}}this[_0x01f6('0xd1')](_0x56e40a['id'],_0x104811,_0x526bc8,_0x56e40a[_0x01f6('0x20a')],_0x56e40a)[_0x01f6('0x42')](function(_0x111e00){_0x56e40a[_0x01f6('0xd2')]-=_0x526bc8;_0x56e40a[_0x01f6('0xd2')]=_0x56e40a['temp']>0x0?_0x56e40a[_0x01f6('0xd2')]:0x0;if(!checkContactEmpty(_0x111e00)){_0x293496[_0x01f6('0xc1')](_0x56e40a)['then'](sendMessageReschedule(_0x56e40a))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x20b')));}else{_0x56e40a['originated']+=_0x111e00[_0x01f6('0x16c')];_0x56e40a['message']=_0x56e40a[_0x01f6('0x65')]===_0x01f6('0x8')?_0x01f6('0x20c'):_0x01f6('0x205');for(var _0x1793e4=0x0;_0x1793e4<_0x111e00[_0x01f6('0x16c')];_0x1793e4+=0x1){if(_[_0x01f6('0xea')](_0x111e00[_0x1793e4])||_[_0x01f6('0xea')](_0x111e00[_0x1793e4][_0x01f6('0x193')])||_['isNil'](_0x111e00[_0x1793e4][_0x01f6('0x17c')])){_0x293496[_0x01f6('0x20d')](_0x01f6('0x20e'),_0x56e40a,_0x111e00[_0x1793e4]);}else{_0x293496[_0x01f6('0xc3')](_[_0x01f6('0xde')](_0x111e00[_0x1793e4],[_0x01f6('0xe2'),_0x01f6('0x206')]))[_0x01f6('0x42')](_0x293496[_0x01f6('0x20f')](_0x56e40a,_0x111e00[_0x1793e4]))[_0x01f6('0xbc')](_0x293496[_0x01f6('0xdc')](_0x01f6('0x20e'),_0x56e40a));}}}})[_0x01f6('0xbc')](loggerGetContactDialer(_0x01f6('0x210'),_0x56e40a,_0x526bc8));}};Dialer['prototype']['handlePredictive']=function(_0x4796ce){if(_0x4796ce['dialLimitQueue']>0x0){var _0x76b664=_0x4796ce['dialLimitQueue']-_0x4796ce['originated']-_0x4796ce[_0x01f6('0x5e')];if(_0x76b664>0x0){this[_0x01f6('0x211')](_0x4796ce);}else{loggerPredictiveCalls[_0x01f6('0x8e')](_0x01f6('0x212'));}}else{this[_0x01f6('0x211')](_0x4796ce);}};Dialer[_0x01f6('0x20')][_0x01f6('0x211')]=function(_0x3cf9a2){var _0x27eb54=this;var _0xdca1=[];_0x3cf9a2[_0x01f6('0x7f')]+=0x1;for(var _0x48e7ad in this[_0x01f6('0x27')]){if(typeof this[_0x01f6('0x27')][_0x48e7ad]!=='undefined'){if(this[_0x01f6('0x27')][_0x48e7ad]['state']===_0x01f6('0x209')&&this[_0x01f6('0x27')][_0x48e7ad]['status']===_0x01f6('0xe8')){_0xdca1[_0x01f6('0x13a')](this[_0x01f6('0x27')][_0x48e7ad]['id']);}}}this[_0x01f6('0xd1')](_0x3cf9a2['id'],_0xdca1,0x1,_0x3cf9a2[_0x01f6('0x20a')],_0x3cf9a2)['then'](function(_0x440f9d){if(!checkContactEmpty(_0x440f9d)){checkContactLowerLimitOriginate(_0x3cf9a2,0x1,0x0);_0x27eb54['countReScheduled'](_0x3cf9a2)[_0x01f6('0x42')](sendMessageReschedule(_0x3cf9a2))[_0x01f6('0xbc')](loggerCatch(_0x01f6('0x20b')));}else{_0x3cf9a2[_0x01f6('0x44')]='RUNNING';if(_[_0x01f6('0xea')](_0x440f9d[0x0])||_[_0x01f6('0xea')](_0x440f9d[0x0][_0x01f6('0x193')])||_['isNil'](_0x440f9d[0x0][_0x01f6('0x17c')])){_0x27eb54[_0x01f6('0x20d')]('[actionOriginate]\x20',_0x3cf9a2,_0x440f9d[0x0]);}else{_0x27eb54[_0x01f6('0xc3')](_[_0x01f6('0xde')](_0x440f9d[0x0],['VoiceQueueId',_0x01f6('0x206')]))[_0x01f6('0x42')](_0x27eb54[_0x01f6('0x20f')](_0x3cf9a2,_0x440f9d[0x0]))['catch'](_0x27eb54[_0x01f6('0xdc')](_0x01f6('0x213'),_0x3cf9a2));}}})[_0x01f6('0xbc')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3cf9a2,0x1));emitVoiceQueueSummary(_0x3cf9a2);};Dialer[_0x01f6('0x20')][_0x01f6('0x1e8')]=function(_0xccf0dd,_0x399619,_0x2ea9e6,_0x418606,_0x267832,_0x3915e3){loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x214'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xccf0dd);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x215'),_0x399619);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x216'),_0x2ea9e6);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x217'),_0x418606);loggerPredictive[_0x01f6('0x8e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x267832);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x9e'));return new BPromise(function(_0x8f16b9,_0x1753da){if(_0xccf0dd<=0x0||isNaN(_0xccf0dd)){return _0x1753da(msgResponse(_0x01f6('0x218'),'Error','m\x20=\x20'+_0xccf0dd));}if(_0x2ea9e6<=0x0||isNaN(_0x2ea9e6)){return _0x1753da(msgResponse(_0x01f6('0x218'),'Error',_0x01f6('0x219')+_0x2ea9e6));}if(_0x418606<=0x0||isNaN(_0x418606)){return _0x1753da(msgResponse(_0x01f6('0x218'),'Error','p\x20=\x20'+_0x418606));}if(_0x399619<=0x0||isNaN(_0x399619)){return _0x1753da(msgResponse('[abandonmentRate]','Error',_0x01f6('0x21a')+_0x399619));}if(_0x267832<=0x0||isNaN(_0x267832)){return _0x1753da(msgResponse(_0x01f6('0x218'),_0x01f6('0x50'),_0x01f6('0x21b')+_0x267832));}_0x3915e3=_0x3915e3||0x0;var _0x1b4960=0x1/_0x2ea9e6;var _0x1cdd9e=0x0;var _0xf24fa6=0x0;var _0x58ed53=0x0;var _0x3f3214=0x0;for(var _0x5c8c8a=0x0;_0x58ed53<_0x267832;_0x5c8c8a+=0x1){_0xf24fa6=_0x5c8c8a/_0x399619;_0x1cdd9e=(_0x418606*_0xf24fa6+_0x3915e3)/_0x1b4960;_0x58ed53=erlangb(_0x1cdd9e,_0xccf0dd);_0x3f3214=_0x1cdd9e/_0xccf0dd*(0x1-erlangb(_0x1cdd9e,_0xccf0dd));}return _0x8f16b9({'erlangCalls':_0x5c8c8a,'erlangCallToSecond':_0x399619/_0x5c8c8a,'erlangAbandonmentRate':_0x58ed53,'erlangBusyFactor':_0x3f3214});});};Dialer[_0x01f6('0x20')][_0x01f6('0x1ea')]=function(_0x307b51,_0x20a047,_0x3849bf,_0x59b966,_0x584ea0,_0x36a021){loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x21c'));loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x21d'),_0x307b51);loggerPredictive[_0x01f6('0x8e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20a047);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x216'),_0x3849bf);loggerPredictive[_0x01f6('0x8e')](_0x01f6('0x217'),_0x59b966);loggerPredictive[_0x01f6('0x8e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x584ea0);loggerPredictive[_0x01f6('0x8e')]('---------------------------');return new BPromise(function(_0x22be2b,_0x777b70){if(_0x307b51<=0x0||isNaN(_0x307b51)){return _0x777b70(msgResponse('[busyFactor]',_0x01f6('0x50'),_0x01f6('0x21e')+_0x307b51));}if(_0x3849bf<=0x0||isNaN(_0x3849bf)){return _0x777b70(msgResponse(_0x01f6('0x21f'),_0x01f6('0x50'),'Ts\x20=\x20'+_0x3849bf));}if(_0x59b966<=0x0||isNaN(_0x59b966)){return _0x777b70(msgResponse('[busyFactor]',_0x01f6('0x50'),_0x01f6('0x220')+_0x59b966));}if(_0x20a047<=0x0||isNaN(_0x20a047)){return _0x777b70(msgResponse(_0x01f6('0x21f'),_0x01f6('0x50'),'interval\x20=\x20'+_0x20a047));}if(_0x584ea0<=0x0||isNaN(_0x584ea0)){return _0x777b70(msgResponse(_0x01f6('0x21f'),'Error',_0x01f6('0x221')+_0x584ea0));}_0x36a021=_0x36a021||0x0;var _0x3873f9=0x1/_0x3849bf;var _0x1eb01b=0x0;var _0x1b28d4=0x0;var _0x4c4687=0x0;var _0x3b8d1a=0x0;for(var _0x371533=0x0;_0x3b8d1a<_0x584ea0;_0x371533+=0x1){_0x1b28d4=_0x371533/_0x20a047;_0x1eb01b=(_0x59b966*_0x1b28d4+_0x36a021)/_0x3873f9;_0x4c4687=erlangb(_0x1eb01b,_0x307b51);_0x3b8d1a=_0x1eb01b/_0x307b51*(0x1-erlangb(_0x1eb01b,_0x307b51));}return _0x22be2b({'erlangCalls':_0x371533,'erlangCallToSecond':_0x20a047/_0x371533,'erlangAbandonmentRate':_0x4c4687,'erlangBusyFactor':_0x3b8d1a});});};module['exports']=Dialer; \ No newline at end of file +var _0x0f80=['answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','calleridname','[syncAgentComplete][createHistory][10]','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','Abandoned','calleridnum','actionid','paused','stateinterface','locked','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','true','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','Queue','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','loggedIn','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkPreviewRecallReminder','syncCampaigns','[syncCampaigns]','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','%s%s','callerid','dialRandomLastDigitCallerIdNumber','TrunkBackup','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','[CatchErlangB]','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','finally','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','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]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./final','./agentComplete','./hangup','127.0.0.1','rrmemory','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','originateresponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','message','NOT_ACTIVE','name','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','outbound','strategy','available','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','stack','inspect','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','unmonitored','uniqueid','isNil','variable','value','HANGUP','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x0f80,0x108));var _0x00f8=function(_0x112b13,_0x501598){_0x112b13=_0x112b13-0x0;var _0x5d856a=_0x0f80[_0x112b13];return _0x5d856a;};'use strict';var util=require('util');var _=require(_0x00f8('0x0'));var BPromise=require(_0x00f8('0x1'));var uuid=require(_0x00f8('0x2'));var moment=require(_0x00f8('0x3'));var rr=require('rr');var md5=require(_0x00f8('0x4'));var Redis=require('ioredis');var ut=require(_0x00f8('0x5'));var config=require(_0x00f8('0x6'));var logger=require(_0x00f8('0x7'))('dialer');var loggerBooked=require(_0x00f8('0x7'))(_0x00f8('0x8'));var loggerPredictive=require(_0x00f8('0x7'))(_0x00f8('0x9'));var loggerPredictiveCalls=require(_0x00f8('0x7'))(_0x00f8('0xa'));var loggerSyncQueueSummary=require(_0x00f8('0x7'))('syncQueueSummary');var ami=require(_0x00f8('0xb'));config[_0x00f8('0xc')]=_[_0x00f8('0xd')](config['redis'],{'host':_0x00f8('0xe'),'port':0x18eb});var io=require(_0x00f8('0xf'))(new Redis(config[_0x00f8('0xc')]));var cmHopper=require(_0x00f8('0x10'));var cmHopperHistory=require(_0x00f8('0x11'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x00f8('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x00f8('0x13'));var History=require('./history');var Final=require(_0x00f8('0x14'));var AgentComplete=require(_0x00f8('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x00f8('0x16'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x00f8('0x17');var strategy={'rrmemory':_0x00f8('0x18'),'roundrobin':_0x00f8('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x00f8('0x1a')]['enqueue']=function(_0x23ba53){this[_0x00f8('0x1b')]=this[_0x00f8('0x1b')]?this[_0x00f8('0x1b')]['finally'](_0x23ba53):_0x23ba53();};function Dialer(_0x406bba,_0x22003e){this[_0x00f8('0x1c')]=new Sequence();this[_0x00f8('0x1d')]=_0x22003e;this[_0x00f8('0x1e')]=_0x406bba[_0x00f8('0x1e')];this[_0x00f8('0x1f')]=_0x406bba['campaigns'];this['agents']=_0x406bba[_0x00f8('0x20')];this['trunks']=_0x406bba[_0x00f8('0x21')];this[_0x00f8('0x22')]=config['maxNumberOriginate']||0x2;this[_0x00f8('0x23')]={};this[_0x00f8('0x24')]={};this[_0x00f8('0x25')]={};this[_0x00f8('0x26')]={};this[_0x00f8('0x27')]={};this[_0x00f8('0x28')]={};this[_0x00f8('0x29')]={};this[_0x00f8('0x2a')]={};this[_0x00f8('0x2b')]={};this[_0x00f8('0x2c')]={};ami['on'](_0x00f8('0x2d'),this[_0x00f8('0x2e')][_0x00f8('0x2f')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x00f8('0x30'),this['syncOriginateResponse'][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x31'),this['syncAgentComplete'][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x32'),this[_0x00f8('0x33')][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x34'),this[_0x00f8('0x35')][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x36'),this[_0x00f8('0x37')][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x38'),this[_0x00f8('0x39')]['bind'](this));ami['on'](_0x00f8('0x3a'),this[_0x00f8('0x3b')][_0x00f8('0x2f')](this));ami['on'](_0x00f8('0x3c'),this['syncQueueStatusComplete'][_0x00f8('0x2f')](this));this[_0x00f8('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x00f8('0x3e')]()[_0x00f8('0x3f')](function(_0x45f806){previewRecallmeReminderInterval=_0x45f806[_0x00f8('0x40')];});}function isNotNull(_0x3272c7){return _0x3272c7!==null&&!_['isUndefined'](_0x3272c7);}function checkIsLoggedIn(_0x1095a7,_0x218678){return function(){if(_0x218678<=0x0){_0x1095a7['message']='AGENTS_NOT_LOGGED';throw _0x1095a7['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x552670){return _0x552670;}function checkIsActive(_0x4014ee,_0x9fd1d2){return function(){if(!isActive(_0x9fd1d2)){_0x4014ee[_0x00f8('0x41')]=_0x00f8('0x42');throw _0x4014ee[_0x00f8('0x43')]+'\x20NOT\x20Active';}};}function checkInterval(_0x7fdadf){return function(){if(!isNotNull(_0x7fdadf['Interval'])){_0x7fdadf['message']=_0x00f8('0x44');throw _0x7fdadf[_0x00f8('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x7fdadf[_0x00f8('0x45')][_0x00f8('0x46')])){_0x7fdadf[_0x00f8('0x41')]='INTERVAL_IS_NULL';throw _0x7fdadf[_0x00f8('0x43')]+_0x00f8('0x47');}if(!isNotNull(_[_0x00f8('0x48')](_0x7fdadf[_0x00f8('0x45')]['Intervals']))){_0x7fdadf[_0x00f8('0x41')]=_0x00f8('0x44');throw _0x7fdadf['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x26d651,_0x1911b9,_0x3e0c18){return{'action':_0x26d651,'response':_0x1911b9,'message':_0x3e0c18,'stack':_0x3e0c18};}function myreject(_0x46bb70){return function(_0x39dfd9){return _0x46bb70(msgResponse(_0x00f8('0x49'),_0x00f8('0x4a'),JSON[_0x00f8('0x4b')](_0x39dfd9)));};}function getSeconds(_0x2c039a,_0x1f5e6c){var _0x1b4f1b=moment(_0x2c039a)[_0x00f8('0x4c')](0x0);var _0x4f36d7=moment(_0x1f5e6c)[_0x00f8('0x4c')](0x0);return _0x1b4f1b[_0x00f8('0x4d')](_0x4f36d7,'seconds');}function emit(_0x640255,_0x143ab4,_0x216642){io['to'](_0x640255)['emit'](_0x143ab4,_0x216642);}function emitVoiceQueueSummary(_0x4fe70f){if(_0x4fe70f['type']===_0x00f8('0x4e')){var _0x2d6de3={'id':_0x4fe70f['id'],'name':_0x4fe70f[_0x00f8('0x43')],'strategy':_0x4fe70f[_0x00f8('0x4f')],'answered':_0x4fe70f['answered'],'available':_0x4fe70f[_0x00f8('0x50')],'loggedIn':_0x4fe70f['loggedIn'],'pTalking':_0x4fe70f['pTalking'],'sumBillable':_0x4fe70f[_0x00f8('0x51')],'sumDuration':_0x4fe70f[_0x00f8('0x52')],'sumHoldTime':_0x4fe70f[_0x00f8('0x53')]||0x0,'talking':_0x4fe70f['talking'],'total':_0x4fe70f[_0x00f8('0x54')],'type':_0x4fe70f[_0x00f8('0x55')],'unmanaged':_0x4fe70f['unmanaged'],'abandoned':_0x4fe70f[_0x00f8('0x56')],'waiting':_0x4fe70f[_0x00f8('0x57')],'loggedInDb':_0x4fe70f[_0x00f8('0x58')],'dialActive':_0x4fe70f['dialActive'],'dialMethod':_0x4fe70f[_0x00f8('0x59')],'dialOriginateCallerIdName':_0x4fe70f[_0x00f8('0x5a')],'dialOriginateCallerIdNumber':_0x4fe70f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4fe70f[_0x00f8('0x5b')],'dialPrefix':_0x4fe70f[_0x00f8('0x5c')],'outboundAnswerAgiCallsDay':_0x4fe70f[_0x00f8('0x5d')],'outboundAnswerCallsDay':_0x4fe70f[_0x00f8('0x5e')],'outboundBlacklistCallsDay':_0x4fe70f[_0x00f8('0x5f')],'outboundBusyCallsDay':_0x4fe70f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4fe70f[_0x00f8('0x60')],'outboundDropCallsDayACS':_0x4fe70f[_0x00f8('0x61')],'outboundDropCallsDayCallersExit':_0x4fe70f[_0x00f8('0x62')],'outboundDropCallsDayTimeout':_0x4fe70f[_0x00f8('0x63')],'outboundNoAnswerCallsDay':_0x4fe70f[_0x00f8('0x64')],'outboundNoSuchCallsDay':_0x4fe70f[_0x00f8('0x65')],'outboundOriginateFailureCallsDay':_0x4fe70f[_0x00f8('0x66')],'outboundReCallsDay':_0x4fe70f[_0x00f8('0x67')],'outboundRejectCallsDay':_0x4fe70f[_0x00f8('0x68')],'outboundUnknownCallsDay':_0x4fe70f['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4fe70f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4fe70f[_0x00f8('0x69')],'predictiveIntervalAvgTalktime':_0x4fe70f[_0x00f8('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x4fe70f[_0x00f8('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x4fe70f[_0x00f8('0x6c')],'predictiveIntervalErlangCalls':_0x4fe70f[_0x00f8('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x4fe70f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4fe70f[_0x00f8('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x4fe70f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4fe70f[_0x00f8('0x6f')],'predictiveIntervalAvailable':_0x4fe70f[_0x00f8('0x70')],'predictiveIntervalTotalCalls':_0x4fe70f[_0x00f8('0x71')],'message':_0x4fe70f['message'],'originated':_0x4fe70f['originated'],'erlangCalls':_0x4fe70f[_0x00f8('0x72')],'erlangCallToSecond':_0x4fe70f[_0x00f8('0x73')],'erlangAbandonmentRate':_0x4fe70f[_0x00f8('0x74')],'erlangBusyFactor':_0x4fe70f[_0x00f8('0x75')],'startPredictive':_0x4fe70f[_0x00f8('0x28')],'startProgressive':_0x4fe70f[_0x00f8('0x29')]};if(_0x4fe70f[_0x00f8('0x76')]){_0x2d6de3[_0x00f8('0x76')]={'id':_0x4fe70f[_0x00f8('0x76')]['id'],'name':_0x4fe70f[_0x00f8('0x76')][_0x00f8('0x43')],'active':_0x4fe70f[_0x00f8('0x76')][_0x00f8('0x77')],'callerid':_0x4fe70f[_0x00f8('0x76')]['callerid']};}if(_0x4fe70f[_0x00f8('0x45')]){_0x2d6de3[_0x00f8('0x45')]={'id':_0x4fe70f['Interval']['id'],'name':_0x4fe70f[_0x00f8('0x45')][_0x00f8('0x43')]};}var _0x5ab362=md5(JSON[_0x00f8('0x4b')](_0x2d6de3));if(_0x4fe70f[_0x00f8('0x4')]!==_0x5ab362){_0x4fe70f[_0x00f8('0x4')]=_0x5ab362;emit(util[_0x00f8('0x78')](_0x00f8('0x79'),_0x2d6de3[_0x00f8('0x43')]),_0x00f8('0x7a'),_0x2d6de3);}}}function emitCampaignSummary(_0x7e8925){if(_0x7e8925[_0x00f8('0x55')]==='ivr'){emit(util[_0x00f8('0x78')](_0x00f8('0x7b'),_0x7e8925[_0x00f8('0x43')]),_0x00f8('0x7c'),_0x7e8925);}}function checkGetDataPredictive(_0x6a9faf){if(isNotNull(_0x6a9faf)&&!_['isEmpty'](_0x6a9faf)){loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x7e'));loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x7f'),_0x6a9faf['predictiveIntervalTotalCalls']);loggerPredictive[_0x00f8('0x7d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6a9faf[_0x00f8('0x80')]);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x81'),_0x6a9faf[_0x00f8('0x6c')]);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x82'),_0x6a9faf[_0x00f8('0x6b')]);loggerPredictive['info'](_0x00f8('0x83'),_0x6a9faf['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x00f8('0x84'),_0x6a9faf[_0x00f8('0x6a')]);loggerPredictive[_0x00f8('0x7d')]('---------------------------');if(_0x6a9faf[_0x00f8('0x71')]>0x0){if(!_['isUndefined'](_0x6a9faf[_0x00f8('0x6a')])&&_0x6a9faf[_0x00f8('0x6a')]>0x0){return!![];}loggerPredictive['info'](_0x00f8('0x85'));if(!_[_0x00f8('0x86')](_0x6a9faf['predictiveIntervalAvgHoldtime'])&&_0x6a9faf[_0x00f8('0x69')]>0x0){return!![];}loggerPredictive[_0x00f8('0x7d')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x00f8('0x7d')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3e59a2){return function(_0x2b8170){loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x87'));loggerPredictive['info'](_0x00f8('0x88'),_0x2b8170[_0x00f8('0x72')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b8170['erlangCallToSecond']);loggerPredictive['info'](_0x00f8('0x89'),_0x2b8170[_0x00f8('0x74')]);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x8a'),_0x2b8170[_0x00f8('0x75')]);loggerPredictive[_0x00f8('0x7d')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b8170[_0x00f8('0x74')]);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x8b'));_[_0x00f8('0x8c')](_0x3e59a2,_0x2b8170);};}function getDiff(_0x5aaa47){var _0x59cde3=moment()[_0x00f8('0x4c')](0x0);var _0x192133=moment(_0x5aaa47)[_0x00f8('0x4c')](0x0);return _0x59cde3[_0x00f8('0x4d')](_0x192133,_0x00f8('0x8d'));}function ifInterval(_0x2cc5fd,_0x3adea5){if(_[_0x00f8('0x86')](_0x3adea5)){return![];}return getDiff(_0x3adea5)<_0x2cc5fd*0x3c;}function freeVariablesPredictive(_0x2beb50){if(isNotNull(_0x2beb50)){if(!_[_0x00f8('0x86')](_0x2beb50[_0x00f8('0x29')])){_0x2beb50[_0x00f8('0x29')]=undefined;loggerPredictive[_0x00f8('0x7d')](_0x2beb50[_0x00f8('0x43')],_0x00f8('0x8e'));}if(!_[_0x00f8('0x86')](_0x2beb50['startPredictive'])){_0x2beb50[_0x00f8('0x28')]=undefined;loggerPredictive[_0x00f8('0x7d')](_0x2beb50['name'],_0x00f8('0x8f'));}if(!_[_0x00f8('0x86')](_0x2beb50[_0x00f8('0x90')])){clearInterval(_0x2beb50['handlePredictive']);_0x2beb50[_0x00f8('0x90')]=undefined;loggerPredictive[_0x00f8('0x7d')](_0x2beb50[_0x00f8('0x43')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x34251c,_0x59f4af){if(_0x59f4af===0x0){return 0x0;}var _0x2fc8ff=0x1;for(var _0x935941=0x1;_0x935941<=_0x59f4af;_0x935941+=0x1){_0x2fc8ff=0x1+_0x2fc8ff*_0x935941/_0x34251c;}return 0x1/_0x2fc8ff;}function isVoiceQueueOutbound(_0x4b5a31){return _0x4b5a31==='outbound';}function isNotPreview(_0x253511){return _0x253511!==_0x00f8('0x1d');}function isCampaignIvr(_0x255912){return _0x255912===_0x00f8('0x91');}function getCallerId(_0x227a26,_0x5b843b,_0x4a1ce6){if(!_['isUndefined'](_0x4a1ce6)&&typeof _0x4a1ce6===_0x00f8('0x92')&&!_[_0x00f8('0x48')](_0x4a1ce6)){if(!_[_0x00f8('0x86')](_0x5b843b)&&typeof _0x5b843b===_0x00f8('0x92')&&!_['isEmpty'](_0x5b843b)){return util[_0x00f8('0x78')](_0x00f8('0x93'),_0x5b843b,_0x4a1ce6);}return util['format'](_0x00f8('0x93'),_0x4a1ce6,_0x4a1ce6);}if(!_[_0x00f8('0x86')](_0x227a26)&&typeof _0x227a26==='string'&&!_[_0x00f8('0x48')](_0x227a26)){return _0x227a26;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1f7a0f,_0x373dcc){return function(_0xc531ec){freeVariablesPredictive(_0x373dcc);emitVoiceQueueSummary(_0x373dcc);emitCampaignSummary(_0x373dcc);loggerSyncQueueSummary[_0x00f8('0x94')](_0x1f7a0f,util['inspect'](_0xc531ec,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4f3951,_0x4a1d72){return function(_0x255e0a){loggerPredictive[_0x00f8('0x94')](_0x4a1d72[_0x00f8('0x43')],_0x4f3951);loggerPredictive[_0x00f8('0x94')](_0x255e0a[_0x00f8('0x95')]);freeVariablesPredictive(_0x4a1d72);};}function loggerCatch(_0x1d1cda){return function(_0x53828b){logger[_0x00f8('0x94')](_0x1d1cda,util[_0x00f8('0x96')](_0x53828b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xfa286f){return _0xfa286f&&!_['isUndefined'](_0xfa286f)&&_0xfa286f[_0x00f8('0x97')]>0x0;}function decremetOriginate(_0x835fa0){if(!_[_0x00f8('0x86')](_0x835fa0)&&_0x835fa0!==null){if(typeof _0x835fa0[_0x00f8('0x98')]!=='undefined'){if(_0x835fa0[_0x00f8('0x98')]>0x0){_0x835fa0['originated']-=0x1;}else{logger[_0x00f8('0x94')](_0x00f8('0x99'));}}}else{logger[_0x00f8('0x94')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3c08b5,_0x4e3b95,_0x408aeb){if(_0x4e3b95>_0x408aeb){for(var _0x111273=0x0;_0x111273<_0x4e3b95-_0x408aeb;_0x111273+=0x1){decremetOriginate(_0x3c08b5);}}}function loggerGetContactDialer(_0xd451cb,_0x55dec8,_0x49b9bf){return function(_0x9b48ac){checkContactLowerLimitOriginate(_0x55dec8,_0x49b9bf,0x0);logger[_0x00f8('0x94')](_0xd451cb,util[_0x00f8('0x96')](_0x9b48ac,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x7378c){return function(_0x220089){if(isNotNull(_0x220089)&&isNotNull(_0x220089[0x0])){if(_0x220089[0x0][_0x00f8('0x9a')]>0x0){_0x7378c['message']=_0x00f8('0x9b');logger['info'](_0x00f8('0x9c')+_0x7378c[_0x00f8('0x43')],_0x220089[0x0][_0x00f8('0x9a')],_0x00f8('0x9d'));}else{_0x7378c[_0x00f8('0x41')]=_0x00f8('0x9e');logger[_0x00f8('0x7d')](_0x00f8('0x9f')+_0x7378c[_0x00f8('0x43')]);}}};}function notSendMessagesQueue(_0x1cb28b){if(_0x1cb28b[_0x00f8('0xa0')]){freeVariablesPredictive(_0x1cb28b);if(_0x1cb28b['originated']===0x0&&_0x1cb28b[_0x00f8('0xa1')]===0x0&&_0x1cb28b[_0x00f8('0x57')]===0x0&&(_0x1cb28b[_0x00f8('0xa2')]||0x0)===0x0){_0x1cb28b[_0x00f8('0xa0')]=![];_0x1cb28b[_0x00f8('0x50')]=0x0;_0x1cb28b[_0x00f8('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x00f8('0x94')](_0x00f8('0xa3'),_0x1cb28b[_0x00f8('0x43')],'is\x20not\x20active');}else{_0x1cb28b['message']=_0x00f8('0xa4');loggerSyncQueueSummary[_0x00f8('0x94')](_0x00f8('0xa3'),_0x1cb28b[_0x00f8('0x43')],_0x00f8('0xa5'));}emitVoiceQueueSummary(_0x1cb28b);}}function notSendMessagesCampaign(_0x76e10f){if(_0x76e10f[_0x00f8('0xa0')]){if(_0x76e10f['originated']===0x0){_0x76e10f[_0x00f8('0xa0')]=![];_0x76e10f[_0x00f8('0x41')]=_0x00f8('0x42');loggerSyncQueueSummary[_0x00f8('0x94')](_0x00f8('0xa6'),_0x76e10f[_0x00f8('0x43')],_0x00f8('0xa7'));}else{_0x76e10f[_0x00f8('0x41')]=_0x00f8('0xa4');loggerSyncQueueSummary[_0x00f8('0x94')](_0x00f8('0xa6'),_0x76e10f[_0x00f8('0x43')],_0x00f8('0xa5'));}emitCampaignSummary(_0x76e10f);}}function createObjHistory(_0x515d60,_0x50294a,_0x1e09a2,_0x16095c,_0x3ecb09){_0x515d60[_0x00f8('0x41')]=_0x1e09a2;var _0x454cad=new Action(_0x515d60,_0x50294a);var _0xfd5f66=new History(_0x454cad);_0xfd5f66[_0x00f8('0xa8')]=_0x16095c;_0xfd5f66[_0x00f8('0xa9')]=_0x3ecb09;_0xfd5f66[_0x00f8('0xaa')]=_0x454cad[_0x00f8('0xab')];return _0xfd5f66;}Dialer[_0x00f8('0x1a')]['loopClearZombieChannels']=function(){var _0x559f7b=this;setInterval(function(){_0x559f7b[_0x00f8('0xac')](_0x559f7b[_0x00f8('0x26')],_0x00f8('0xad'));_0x559f7b['clearZombieChannels'](_0x559f7b[_0x00f8('0x24')],_0x00f8('0xae'));},0x32c8);};Dialer['prototype'][_0x00f8('0xac')]=function(_0x5dd54d,_0x210bd9){var _0x7f2529=this;for(var _0x51c433 in _0x5dd54d){if(typeof _0x5dd54d[_0x51c433]!=='undefined'){this[_0x00f8('0x1c')][_0x00f8('0xaf')](function(){if(!_['isNil'](_0x5dd54d[_0x51c433])){return ami[_0x00f8('0xb0')]({'action':'status','channel':_0x5dd54d[_0x51c433][_0x00f8('0xb1')]})[_0x00f8('0xb2')](function(_0x1f06db){if(_0x1f06db[_0x00f8('0x41')]===_0x00f8('0xb3')){setTimeout(function(){if(_0x5dd54d[_0x51c433]&&_0x5dd54d[_0x51c433]['type']!=='ivr'){_0x7f2529[_0x00f8('0xb4')](_0x7f2529[_0x00f8('0x1e')][_0x5dd54d[_0x51c433][_0x00f8('0xb5')]]);logger[_0x00f8('0x94')]('[Dialer][checkChannel]',_0x210bd9,_0x51c433,_0x5dd54d[_0x51c433]['queue']);delete _0x5dd54d[_0x51c433];}if(_0x5dd54d[_0x51c433]&&_0x5dd54d[_0x51c433]['type']===_0x00f8('0x91')){_0x7f2529[_0x00f8('0xb4')](_0x7f2529[_0x00f8('0x1f')][_0x5dd54d[_0x51c433][_0x00f8('0xb5')]]);logger[_0x00f8('0x94')](_0x00f8('0xb6'),_0x210bd9,_0x51c433,_0x5dd54d[_0x51c433][_0x00f8('0xb5')]);delete _0x5dd54d[_0x51c433];}},0x2328);}});}});}}};Dialer['prototype'][_0x00f8('0xb7')]=function(_0x1d8632){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopper['countReScheduled'](_0x1d8632))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xb9')));};Dialer[_0x00f8('0x1a')][_0x00f8('0xba')]=function(_0x206f7d){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopperBlack[_0x00f8('0xba')](_0x206f7d))[_0x00f8('0xb2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x00f8('0x1a')][_0x00f8('0xbb')]=function(_0x27a362,_0x426e38,_0x294f45){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopperAdditionalPhone[_0x00f8('0xbb')](_0x27a362,_0x426e38,_0x294f45))['catch'](loggerCatch(_0x00f8('0xbc')));};Dialer[_0x00f8('0x1a')][_0x00f8('0xbd')]=function(_0x1a16a9,_0x12817d,_0x126192){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1a16a9,_0x12817d,_0x126192))[_0x00f8('0xb2')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer['prototype'][_0x00f8('0xbe')]=function(_0x2adf6d){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopperBlack[_0x00f8('0xbe')](_0x2adf6d))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xbf')));};Dialer['prototype'][_0x00f8('0xc0')]=function(_0x5119a1){return BPromise[_0x00f8('0xb8')]()['then'](cmHopperHistory[_0x00f8('0xc1')](_0x5119a1))['catch'](loggerCatch(_0x00f8('0xc2')));};Dialer[_0x00f8('0x1a')][_0x00f8('0xc3')]=function(_0x57b87e){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopper[_0x00f8('0xc3')](_0x57b87e))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x00f8('0x1a')][_0x00f8('0xc4')]=function(_0x5da194,_0x4f457e,_0x3e329b){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopper[_0x00f8('0xc4')](_0x5da194,_0x4f457e,_0x3e329b))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xc5')));};Dialer['prototype'][_0x00f8('0xc6')]=function(_0x471067,_0x7589ba,_0x51cee3,_0x2232b8,_0x2353eb){return BPromise[_0x00f8('0xb8')]()['then'](cmHopper['getContactDialer'](_0x471067,_0x7589ba,_0x51cee3,_0x2232b8))['catch'](function(_0x425110){_0x2353eb[_0x00f8('0xc7')]-=_0x51cee3;_0x2353eb[_0x00f8('0xc7')]=_0x2353eb[_0x00f8('0xc7')]>0x0?_0x2353eb[_0x00f8('0xc7')]:0x0;loggerCatch(_0x00f8('0xc8'))(_0x425110);});};Dialer[_0x00f8('0x1a')][_0x00f8('0xc9')]=function(_0x332d2a,_0x7c2a24,_0x2168f5,_0x30511d){return BPromise['resolve']()[_0x00f8('0x3f')](cmHopper[_0x00f8('0xc9')](_0x332d2a,_0x7c2a24,_0x2168f5))['catch'](function(_0x4cb9ca){_0x30511d['temp']-=_0x7c2a24;_0x30511d[_0x00f8('0xc7')]=_0x30511d['temp']>0x0?_0x30511d[_0x00f8('0xc7')]:0x0;loggerCatch(_0x00f8('0xca'))(_0x4cb9ca);});};Dialer[_0x00f8('0x1a')][_0x00f8('0xcb')]=function(_0x5a6a07){return BPromise['resolve']()['then'](voiceQueueRt[_0x00f8('0xcb')](_0x5a6a07))[_0x00f8('0xb2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x00f8('0x1a')]['moveContactManagedDialer']=function(_0x5993ff){return BPromise[_0x00f8('0xb8')]()['then'](cmHopper[_0x00f8('0xcc')](_0x5993ff))['catch'](loggerCatch(_0x00f8('0xcd')));};Dialer['prototype']['createHistory']=function(_0x37106c){return BPromise[_0x00f8('0xb8')]()['then'](cmHopperHistory[_0x00f8('0xce')](_0x37106c))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xcf')));};Dialer['prototype'][_0x00f8('0xb4')]=function(_0xd30388){if(!_[_0x00f8('0x86')](_0xd30388)&&_0xd30388!==null){if(typeof _0xd30388[_0x00f8('0x98')]!==_0x00f8('0xd0')){if(_0xd30388[_0x00f8('0x98')]>0x0){_0xd30388[_0x00f8('0x98')]-=0x1;}else{logger[_0x00f8('0x94')](_0x00f8('0xd1'));}}}else{logger[_0x00f8('0x94')](_0x00f8('0xd2'));}};Dialer[_0x00f8('0x1a')][_0x00f8('0xd3')]=function(_0x46174e,_0x28003a){var _0x403f88=this;return function(_0x1e7fd3){_0x403f88[_0x00f8('0xb4')](_0x28003a);logger['error'](_0x46174e,util[_0x00f8('0x96')](_0x1e7fd3,{'showHidden':![],'depth':null}));};};Dialer[_0x00f8('0x1a')]['emptyContact']=function(_0x2f2031,_0x19a2f2,_0x4c8530){var _0x2bd834={'state':0x19,'statedesc':'notFound'};this[_0x00f8('0xb4')](_0x19a2f2);this[_0x00f8('0xd4')](_[_0x00f8('0x8c')](_0x2bd834,_['pick'](_0x4c8530,[_0x00f8('0xd5'),_0x00f8('0xd6'),_0x00f8('0xd7'),_0x00f8('0xd8'),_0x00f8('0xd9')])),'[emptyContact][createHistory]',_0x00f8('0xda'));logger[_0x00f8('0x94')](_0x2f2031);};Dialer[_0x00f8('0x1a')][_0x00f8('0xdb')]=function(_0x25d8a4){return _0x25d8a4==='Success';};Dialer[_0x00f8('0x1a')][_0x00f8('0xdc')]=function(_0x43360d){return!_[_0x00f8('0x86')](_0x43360d)&&_0x43360d&&!_['isUndefined'](_0x43360d[_0x00f8('0x43')])&&!_[_0x00f8('0x86')](_0x43360d[_0x00f8('0x77')])&&_0x43360d[_0x00f8('0x77')]&&(this['trunks'][util['format'](_0x00f8('0xdd'),_0x43360d['name'])][_0x00f8('0xde')]==='reachable'||this[_0x00f8('0x21')][util[_0x00f8('0x78')](_0x00f8('0xdd'),_0x43360d[_0x00f8('0x43')])][_0x00f8('0xde')]===_0x00f8('0xdf'));};Dialer['prototype'][_0x00f8('0xd4')]=function(_0x2f0066,_0x359139,_0x147e04){this['createHistory'](_0x2f0066)[_0x00f8('0xb2')](loggerCatch(_0x359139));this[_0x00f8('0xcc')](_0x2f0066)[_0x00f8('0xb2')](loggerCatch(_0x147e04));};Dialer[_0x00f8('0x1a')]['syncVarSet']=function(_0x4c698c){var _0x40f978=this['uniqueId'][_0x4c698c[_0x00f8('0xe0')]];var _0x4d68a9;if(!_[_0x00f8('0xe1')](_0x4c698c)&&!_[_0x00f8('0xe1')](_0x4c698c[_0x00f8('0xe2')])&&!_['isNil'](_0x4c698c[_0x00f8('0xe2')]['amdstatus'])&&_0x4c698c['exten']==='xcally-motion-dialer'&&_0x40f978){if(_0x40f978[_0x00f8('0x55')]!==_0x00f8('0x91')&&this['voiceQueues'][_0x40f978[_0x00f8('0xb5')]]['dialAMDActive']&&_0x4c698c[_0x00f8('0xe3')]===_0x00f8('0xe4')){delete this[_0x00f8('0x26')][_0x4c698c[_0x00f8('0xe0')]];this[_0x00f8('0xb4')](this[_0x00f8('0x1e')][_0x40f978[_0x00f8('0xb5')]]);this['voiceQueues'][_0x40f978['queue']][_0x00f8('0x5e')]+=0x1;this[_0x00f8('0x1e')][_0x40f978[_0x00f8('0xb5')]][_0x00f8('0x5d')]+=0x1;_0x4d68a9=new Hangup(_0x40f978,_0x4c698c);_0x4d68a9[_0x00f8('0xa8')]=0x12;_0x4d68a9[_0x00f8('0xa9')]=_0x00f8('0xe5');_0x4d68a9[_0x00f8('0xe6')]=_0x00f8('0xe7');ami[_0x00f8('0xe8')](_0x00f8('0xe9'),ut[_0x00f8('0xea')](_0x4d68a9,_0x00f8('0xeb')));this[_0x00f8('0xd4')](_0x4d68a9,_0x00f8('0xec'),_0x00f8('0xed'));}if(_0x40f978[_0x00f8('0x55')]!==_0x00f8('0x91')&&this['voiceQueues'][_0x40f978[_0x00f8('0xb5')]][_0x00f8('0xee')]&&_0x4c698c['value']===_0x00f8('0xef')){var _0x10eefd=this;return new BPromise(function(_0x381143,_0x5990ba){delete _0x10eefd[_0x00f8('0x26')][_0x4c698c[_0x00f8('0xe0')]];_0x10eefd['updateOriginated'](_0x10eefd[_0x00f8('0x1e')][_0x40f978['queue']]);_0x10eefd['voiceQueues'][_0x40f978[_0x00f8('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x10eefd[_0x00f8('0x1e')][_0x40f978[_0x00f8('0xb5')]][_0x00f8('0x5d')]+=0x1;var _0x564abe=_0x10eefd[_0x00f8('0x1e')][_0x40f978[_0x00f8('0xb5')]];var _0x2d802a=new Hangup(_0x40f978,_0x4c698c);_0x2d802a[_0x00f8('0xa8')]=0x13;_0x2d802a['statedesc']=_0x00f8('0xf0');_0x2d802a[_0x00f8('0xe6')]=_0x00f8('0xe7');_0x2d802a['countmachineretry']+=0x1;_0x2d802a[_0x00f8('0xf1')]+=0x1;_0x2d802a['amd']=!![];ami[_0x00f8('0xe8')](_0x00f8('0xe9'),ut[_0x00f8('0xea')](_0x2d802a,_0x00f8('0xeb')));_0x10eefd[_0x00f8('0xce')](_0x2d802a)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xf2')));if(_0x2d802a[_0x00f8('0xf3')]+_0x2d802a[_0x00f8('0xf4')]+_0x2d802a[_0x00f8('0xf5')]+_0x2d802a[_0x00f8('0xf6')]+_0x2d802a[_0x00f8('0xf7')]+_0x2d802a[_0x00f8('0xf8')]+_0x2d802a[_0x00f8('0xf9')]+_0x2d802a[_0x00f8('0xfa')]>=_0x564abe['dialGlobalMaxRetry']){_0x10eefd[_0x00f8('0xfb')](_0x2d802a,_0x381143,_0x5990ba,_0x00f8('0xfc'));}else{if(_0x2d802a[_0x00f8('0xf9')]>=_0x564abe[_0x00f8('0xfd')]){_0x10eefd[_0x00f8('0xfe')](_0x2d802a,_0x381143,_0x5990ba,_0x00f8('0xff'));}else{_0x10eefd[_0x00f8('0xc3')]({'active':![],'countmachineretry':_0x2d802a['countmachineretry'],'scheduledat':moment()[_0x00f8('0x100')](_0x564abe[_0x00f8('0x101')],_0x00f8('0x102'))[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x2d802a[_0x00f8('0xd5')],'ListId':_0x2d802a[_0x00f8('0xd6')],'VoiceQueueId':_0x2d802a[_0x00f8('0xd8')]||undefined,'CampaignId':_0x2d802a['CampaignId']||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x104')));_0x381143({'reschedule':0x1});}}});}if(_0x40f978[_0x00f8('0x55')]===_0x00f8('0x91')&&this[_0x00f8('0x1f')][_0x40f978[_0x00f8('0xb5')]]['dialAMDActive']&&_0x4c698c[_0x00f8('0xe3')]===_0x00f8('0xe4')){delete this['uniqueId'][_0x4c698c[_0x00f8('0xe0')]];this[_0x00f8('0xb4')](this['campaigns'][_0x40f978[_0x00f8('0xb5')]]);_0x4d68a9=new Hangup(_0x40f978,_0x4c698c);_0x4d68a9['state']=0x12;_0x4d68a9[_0x00f8('0xa9')]=_0x00f8('0xe5');_0x4d68a9[_0x00f8('0xe6')]=_0x00f8('0xe7');ami[_0x00f8('0xe8')](_0x00f8('0xe9'),ut[_0x00f8('0xea')](_0x4d68a9,_0x00f8('0xeb')));this[_0x00f8('0xd4')](_0x4d68a9,_0x00f8('0x105'),_0x00f8('0x106'));}if(_0x40f978[_0x00f8('0x55')]===_0x00f8('0x91')&&this[_0x00f8('0x1f')][_0x40f978['queue']][_0x00f8('0xee')]&&_0x4c698c[_0x00f8('0xe3')]===_0x00f8('0xef')){var _0x10eefd=this;return new BPromise(function(_0x242b9d,_0x21150b){delete _0x10eefd[_0x00f8('0x26')][_0x4c698c[_0x00f8('0xe0')]];_0x10eefd[_0x00f8('0xb4')](_0x10eefd[_0x00f8('0x1f')][_0x40f978[_0x00f8('0xb5')]]);_0x10eefd[_0x00f8('0x1f')][_0x40f978['queue']][_0x00f8('0x5e')]+=0x1;_0x10eefd['campaigns'][_0x40f978['queue']][_0x00f8('0x5d')]+=0x1;var _0x298ec9=_0x10eefd[_0x00f8('0x1f')][_0x40f978[_0x00f8('0xb5')]];var _0x674697=new Hangup(_0x40f978,_0x4c698c);_0x674697[_0x00f8('0xa8')]=0x13;_0x674697[_0x00f8('0xa9')]=_0x00f8('0xf0');_0x674697[_0x00f8('0xe6')]='AMD';_0x674697[_0x00f8('0xf9')]+=0x1;_0x674697[_0x00f8('0xf1')]+=0x1;_0x674697['amd']=!![];ami[_0x00f8('0xe8')](_0x00f8('0xe9'),ut[_0x00f8('0xea')](_0x674697,_0x00f8('0xeb')));_0x10eefd['createHistory'](_0x674697)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xf2')));if(_0x674697['countbusyretry']+_0x674697[_0x00f8('0xf4')]+_0x674697[_0x00f8('0xf5')]+_0x674697['countnosuchnumberretry']+_0x674697[_0x00f8('0xf7')]+_0x674697[_0x00f8('0xf8')]+_0x674697[_0x00f8('0xf9')]+_0x674697[_0x00f8('0xfa')]>=_0x298ec9[_0x00f8('0x107')]){_0x10eefd[_0x00f8('0xfb')](_0x674697,_0x242b9d,_0x21150b,_0x00f8('0xfc'));}else{if(_0x674697[_0x00f8('0xf9')]>=_0x298ec9[_0x00f8('0xfd')]){_0x10eefd[_0x00f8('0xfe')](_0x674697,_0x242b9d,_0x21150b,_0x00f8('0xff'));}else{_0x10eefd[_0x00f8('0xc3')]({'active':![],'countmachineretry':_0x674697[_0x00f8('0xf9')],'scheduledat':moment()[_0x00f8('0x100')](_0x298ec9[_0x00f8('0x101')],_0x00f8('0x102'))[_0x00f8('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x674697[_0x00f8('0xd5')],'ListId':_0x674697['ListId'],'VoiceQueueId':_0x674697[_0x00f8('0xd8')]||undefined,'CampaignId':_0x674697[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x104')));_0x242b9d({'reschedule':0x1});}}});}}};Dialer[_0x00f8('0x1a')][_0x00f8('0x35')]=function(_0x11a81f){var _0x4056a8=this['uniqueId'][_0x11a81f[_0x00f8('0xe0')]];var _0x4b737e=this;var _0x5628c1;if(_0x4056a8&&_0x4056a8[_0x00f8('0x55')]===_0x00f8('0x91')){delete this[_0x00f8('0x26')][_0x11a81f['uniqueid']];this[_0x00f8('0xb4')](this[_0x00f8('0x1f')][_0x4056a8['queue']]);this['campaigns'][_0x4056a8[_0x00f8('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x5628c1=new Hangup(_0x4056a8,_0x11a81f);this[_0x00f8('0xce')](_0x5628c1)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x108')));this[_0x00f8('0xcc')](_0x5628c1)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x109')));}if(_0x4056a8&&_0x4056a8[_0x00f8('0x55')]!=='ivr'&&isNotNull(this[_0x00f8('0x1e')][_0x4056a8[_0x00f8('0xb5')]][_0x00f8('0x10a')])){delete this[_0x00f8('0x26')][_0x11a81f[_0x00f8('0xe0')]];this[_0x00f8('0xb4')](this[_0x00f8('0x1e')][_0x4056a8['queue']]);this[_0x00f8('0x1e')][_0x4056a8[_0x00f8('0xb5')]][_0x00f8('0x5e')]+=0x1;this[_0x00f8('0x1e')][_0x4056a8[_0x00f8('0xb5')]][_0x00f8('0x5d')]+=0x1;_0x5628c1=new Hangup(_0x4056a8,_0x11a81f);_0x5628c1[_0x00f8('0xa8')]=0x10;_0x5628c1[_0x00f8('0xa9')]=_0x00f8('0x10b');_0x5628c1['membername']='AGI';this['createHistory'](_0x5628c1)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x108')));this[_0x00f8('0xcc')](_0x5628c1)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x109')));}if(_0x4056a8&&_0x4056a8[_0x00f8('0x55')]!==_0x00f8('0x91')&&!isNotNull(this[_0x00f8('0x1e')][_0x4056a8[_0x00f8('0xb5')]]['dialQueueProject'])){delete this[_0x00f8('0x26')][_0x11a81f[_0x00f8('0xe0')]];this[_0x00f8('0xb4')](this[_0x00f8('0x1e')][_0x4056a8['queue']]);this[_0x00f8('0x1e')][_0x4056a8[_0x00f8('0xb5')]][_0x00f8('0x10c')]+=0x1;_0x5628c1=new Hangup(_0x4056a8,_0x11a81f);_0x5628c1['state']=0xc;_0x5628c1[_0x00f8('0xa9')]=_0x11a81f[_0x00f8('0x10d')];_0x5628c1['membername']=_0x00f8('0x10e');this[_0x00f8('0xce')](_0x5628c1)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x00f8('0xcc')](_0x5628c1)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x109')));}};Dialer[_0x00f8('0x1a')]['syncAgentComplete']=function(_0x252c1a){var _0xd6906c=this[_0x00f8('0x26')][_0x252c1a[_0x00f8('0xe0')]];var _0x40cf91=this;if(this['voiceQueues'][_0x252c1a[_0x00f8('0xb5')]]){if(_0xd6906c&&_0xd6906c['type']!==_0x00f8('0x91')){delete this[_0x00f8('0x26')][_0x252c1a[_0x00f8('0xe0')]];this['voiceQueues'][_0x252c1a[_0x00f8('0xb5')]]['outboundAnswerCallsDay']+=0x1;var _0x88e56=new AgentComplete(_0xd6906c,_0x252c1a);if(_0x252c1a[_0x00f8('0x10f')]===_0x00f8('0x110')){_0x88e56[_0x00f8('0x111')]=this[_0x00f8('0x1e')][_0x252c1a[_0x00f8('0xb5')]][_0x00f8('0x112')]&&this[_0x00f8('0x1e')][_0x252c1a['queue']][_0x00f8('0x113')]?moment()[_0x00f8('0x78')](_0x00f8('0x103')):undefined;}this[_0x00f8('0xce')](_0x88e56)[_0x00f8('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x00f8('0xcc')](_0x88e56)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x114')));}}};Dialer[_0x00f8('0x1a')][_0x00f8('0x2e')]=function(_0xc73e71){if(this[_0x00f8('0x1e')][_0xc73e71['queue']]){if(this[_0x00f8('0x26')][_0xc73e71[_0x00f8('0xe0')]]&&this['uniqueId'][_0xc73e71['uniqueid']]['type']!==_0x00f8('0x91')){this[_0x00f8('0xb4')](this['voiceQueues'][_0xc73e71[_0x00f8('0xb5')]]);this[_0x00f8('0x26')][_0xc73e71['uniqueid']][_0x00f8('0x115')]=moment()['format'](_0x00f8('0x103'));}}};Dialer['prototype'][_0x00f8('0x116')]=function(_0x1e117b,_0x49bf20){this[_0x00f8('0xce')](_0x1e117b)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x117')));if(_0x49bf20==0x0){this['moveContactManagedDialer'](_0x1e117b)[_0x00f8('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x00f8('0x1a')][_0x00f8('0x118')]=function(_0x5b8074){var _0x4318d6=this[_0x00f8('0x26')][_0x5b8074[_0x00f8('0xe0')]];var _0x34589d=this;var _0x547914=![];var _0x4ea7e8;var _0x3b9898;if(this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]]){if(_0x4318d6&&_0x4318d6['type']!==_0x00f8('0x91')){delete this[_0x00f8('0x26')][_0x5b8074[_0x00f8('0xe0')]];this['updateOriginated'](this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]]);_0x4318d6[_0x00f8('0x119')]=moment()['format'](_0x00f8('0x103'));var _0xa0bee0=new QueueCallerAbandon(_0x4318d6,_0x5b8074);if(getSeconds(_0x4318d6['droptime'],_0x4318d6[_0x00f8('0x11a')])>=_0x4318d6[_0x00f8('0x11b')]){this[_0x00f8('0x1e')][_0x5b8074['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x63')]+=0x1;this[_0x00f8('0x1e')][_0x5b8074['queue']][_0x00f8('0x11c')]+=0x1;_0xa0bee0[_0x00f8('0xa8')]=0xa;_0xa0bee0[_0x00f8('0xa9')]='Drop';_0xa0bee0['dropreason']='TIMEOUT';_0xa0bee0[_0x00f8('0x111')]=this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x112')]?moment()[_0x00f8('0x78')](_0x00f8('0x103')):undefined;_0xa0bee0['countdropretry']+=0x1;_0xa0bee0[_0x00f8('0xf1')]+=0x1;_0x4ea7e8=this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x11d')];_0x3b9898=this[_0x00f8('0x1e')][_0x5b8074['queue']]['callAdditionalPhoneAfterMin'];_0x34589d[_0x00f8('0xbb')](_0xa0bee0,_0xa0bee0[_0x00f8('0xa8')],_0x4318d6[_0x00f8('0x11e')])[_0x00f8('0x3f')](function(_0x1b60bb){_0x547914=_0x1b60bb[_0x00f8('0x11f')]==0x1;if(_0xa0bee0[_0x00f8('0xf7')]>=_0x34589d[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x120')]){_0x34589d['queueCallerAbandonCreateState'](_0xa0bee0,_0x1b60bb[_0x00f8('0x11f')]);}else{_0x34589d['rescheduleContact']({'active':![],'countdropretry':_0xa0bee0['countdropretry'],'scheduledat':moment()[_0x00f8('0x100')](_0x34589d[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x11d')],_0x00f8('0x102'))[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x4318d6[_0x00f8('0xd5')],'ListId':_0x4318d6[_0x00f8('0xd6')],'VoiceQueueId':_0x4318d6[_0x00f8('0xd8')]||undefined,'CampaignId':_0x4318d6[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x121')));var _0x257da8=new History(_0xa0bee0);_0x257da8[_0x00f8('0xa8')]=0xa;_0x257da8['statedesc']=_0x00f8('0x122');_0x257da8[_0x00f8('0xab')]=moment()['format'](_0x00f8('0x103'));_0x257da8[_0x00f8('0xaa')]=_0x257da8[_0x00f8('0xab')];_0x257da8['calleridname']=_0xa0bee0[_0x00f8('0x123')];_0x257da8['calleridnum']=_0xa0bee0['calleridnum'];_0x34589d[_0x00f8('0xce')](_0x257da8)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x124')));}})[_0x00f8('0x3f')](function(_0xb069ea){if(_0x547914)_0x34589d[_0x00f8('0xbd')](_0xa0bee0,_0x4ea7e8,_0x3b9898)[_0x00f8('0x3f')](function(_0x5562c8){return 0x1;});});}else{this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x6b')]+=0x1;this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x62')]+=0x1;_0xa0bee0[_0x00f8('0xa8')]=0xb;_0xa0bee0[_0x00f8('0xa9')]='Abandoned';_0xa0bee0['dropreason']='CALLEREXIT';_0xa0bee0[_0x00f8('0xf8')]+=0x1;_0xa0bee0[_0x00f8('0xf1')]+=0x1;_0x4ea7e8=this[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x125')];_0x3b9898=this[_0x00f8('0x1e')][_0x5b8074['queue']]['callAdditionalPhoneAfterMin'];_0x34589d[_0x00f8('0xbb')](_0xa0bee0,_0xa0bee0[_0x00f8('0xa8')],_0x4318d6[_0x00f8('0x11e')])[_0x00f8('0x3f')](function(_0x40bb3c){if(_0xa0bee0[_0x00f8('0xf8')]>=_0x34589d[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]][_0x00f8('0x126')]){_0x34589d['queueCallerAbandonCreateState'](_0xa0bee0,_0x40bb3c[_0x00f8('0x11f')]);}else{_0x34589d['rescheduleContact']({'active':![],'countabandonedretry':_0xa0bee0[_0x00f8('0xf8')],'scheduledat':moment()[_0x00f8('0x100')](_0x34589d[_0x00f8('0x1e')][_0x5b8074[_0x00f8('0xb5')]]['dialAbandonedRetryFrequency'],'minutes')[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x4318d6['ContactId'],'ListId':_0x4318d6[_0x00f8('0xd6')],'VoiceQueueId':_0x4318d6['VoiceQueueId']||undefined,'CampaignId':_0x4318d6[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x8f3ea1=new History(_0xa0bee0);_0x8f3ea1[_0x00f8('0xa8')]=0xb;_0x8f3ea1[_0x00f8('0xa9')]=_0x00f8('0x127');_0x8f3ea1[_0x00f8('0xab')]=moment()[_0x00f8('0x78')](_0x00f8('0x103'));_0x8f3ea1[_0x00f8('0xaa')]=_0x8f3ea1['starttime'];_0x8f3ea1[_0x00f8('0x123')]=_0xa0bee0['calleridname'];_0x8f3ea1[_0x00f8('0x128')]=_0xa0bee0[_0x00f8('0x128')];_0x34589d[_0x00f8('0xce')](_0x8f3ea1)[_0x00f8('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x00f8('0x3f')](function(_0x506e7b){if(_0x547914)_0x34589d[_0x00f8('0xbd')](_0xa0bee0,_0x4ea7e8,_0x3b9898)[_0x00f8('0x3f')](function(_0x54aba3){return 0x1;});});}}}};Dialer[_0x00f8('0x1a')][_0x00f8('0x37')]=function(_0x2ea234){if(this[_0x00f8('0x24')][_0x2ea234[_0x00f8('0xe0')]]){this[_0x00f8('0x24')][_0x2ea234[_0x00f8('0xe0')]][_0x00f8('0xb1')]=_0x2ea234[_0x00f8('0xb1')];}if(this[_0x00f8('0x26')][_0x2ea234[_0x00f8('0xe0')]]){this['uniqueId'][_0x2ea234['uniqueid']]['channel']=_0x2ea234[_0x00f8('0xb1')];}};Dialer[_0x00f8('0x1a')]['syncQueueMember']=function(_0x26416c){if(strategy[this['voiceQueues'][this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]][_0x00f8('0xb5')]]['strategy']]===_0x00f8('0x19')){if(this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]]&&_[_0x00f8('0xe1')](this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]]['locked'])&&_0x26416c[_0x00f8('0xde')]==='1'&&_0x26416c[_0x00f8('0x12a')]==='0'){if(this[_0x00f8('0x20')][_0x26416c[_0x00f8('0x12b')]]){if(!this[_0x00f8('0x20')][_0x26416c[_0x00f8('0x12b')]]['locked']){this[_0x00f8('0x20')][_0x26416c[_0x00f8('0x12b')]][_0x00f8('0x12c')]=!![];this['actions'][_0x26416c['actionid']][_0x00f8('0x12c')]=!![];this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]]['stateinterface']=_0x26416c[_0x00f8('0x12b')];}}}}else if((strategy[this[_0x00f8('0x1e')][this[_0x00f8('0x24')][_0x26416c['actionid']][_0x00f8('0xb5')]][_0x00f8('0x4f')]]||'rrmemory')==='rrmemory'){if(this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]]){if(this[_0x00f8('0x20')][_0x26416c[_0x00f8('0x12b')]]){this[_0x00f8('0x24')][_0x26416c['actionid']]['stateinterface']=_0x26416c[_0x00f8('0x12b')];if(_[_0x00f8('0xe1')](this[_0x00f8('0x2b')][this[_0x00f8('0x24')][_0x26416c['actionid']][_0x00f8('0xb5')]])){this[_0x00f8('0x2b')][this['actions'][_0x26416c[_0x00f8('0x129')]][_0x00f8('0xb5')]]=[];}this[_0x00f8('0x2b')][this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]][_0x00f8('0xb5')]][_0x00f8('0x12d')](_[_0x00f8('0x8c')](_[_0x00f8('0x12e')](this[_0x00f8('0x24')][_0x26416c[_0x00f8('0x129')]],[_0x00f8('0x12f'),'stateinterface']),{'status':_0x26416c[_0x00f8('0xde')],'paused':_0x26416c[_0x00f8('0x12a')]}));}}}};function unlockQueueStatus(_0x920516,_0x49c3a1){setTimeout(function(){if(_['isUndefined'](_0x920516[_0x00f8('0x130')])){loggerBooked['error'](_0x00f8('0x131'),_0x49c3a1);}_0x920516[_0x00f8('0x130')]=!![];loggerBooked[_0x00f8('0x7d')]('[booked][unlockQueueStatus]',_0x49c3a1,JSON[_0x00f8('0x4b')](_[_0x00f8('0x12e')](_0x920516,[_0x00f8('0x43'),_0x00f8('0x130')])));},0x1f3);}Dialer[_0x00f8('0x1a')]['syncQueueStatusComplete']=function(_0x9e4079){var _0x37f49d=this;var _0x4524ca=_0x37f49d[_0x00f8('0x1e')][_0x37f49d[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]];if(strategy[this[_0x00f8('0x1e')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]][_0x00f8('0x4f')]]==='roundrobin'){if(this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]]&&this['actions'][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0x12b')]){this['preview'][_0x00f8('0x132')](this[_0x00f8('0x24')][_0x9e4079['actionid']]['idHopper'],this['actions'][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0x12b')])['catch'](function(_0x334bf6){logger[_0x00f8('0x94')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x00f8('0x96')](_0x334bf6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x37f49d[_0x00f8('0xb4')](_0x37f49d[_0x00f8('0x1e')][_0x37f49d['actions'][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]);_0x37f49d[_0x00f8('0x20')][_0x37f49d['actions'][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0x12b')]][_0x00f8('0x12c')]=![];delete _0x37f49d['actions'][_0x9e4079[_0x00f8('0x129')]];unlockQueueStatus(_0x4524ca);});}else{this[_0x00f8('0xb4')](this[_0x00f8('0x1e')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]);this[_0x00f8('0xc3')]({'active':![],'ContactId':this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xd5')],'ListId':this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xd6')],'VoiceQueueId':this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xd8')]||undefined,'CampaignId':this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x9e4079['actionid']];unlockQueueStatus(_0x4524ca);}}else if((strategy[this[_0x00f8('0x1e')][this[_0x00f8('0x24')][_0x9e4079['actionid']]['queue']][_0x00f8('0x4f')]]||'rrmemory')===_0x00f8('0x18')){var _0x4ca822;if(this['actions'][_0x9e4079['actionid']]&&!_[_0x00f8('0x48')](this[_0x00f8('0x2b')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]]['queue']])){if(this[_0x00f8('0x2c')][_0x37f49d['actions'][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]){this[_0x00f8('0x2c')][_0x37f49d[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]]['queue']]=this[_0x00f8('0x2c')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]?this[_0x00f8('0x2c')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]:this[_0x00f8('0x2b')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]]?this[_0x00f8('0x2b')][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]][_0x00f8('0x133')]||0x0:0x0;}this['queueBooked'][this[_0x00f8('0x24')][_0x9e4079[_0x00f8('0x129')]][_0x00f8('0xb5')]][_0x00f8('0x133')]=this[_0x00f8('0x2c')][this[_0x00f8('0x24')][_0x9e4079['actionid']]['queue']];for(var _0x549a7f=0x0;_0x549a7f=0x0;})[_0x00f8('0xb2')](myreject(_0x280454)));}}else{_0x1c9375[_0x00f8('0x12d')](ami[_0x00f8('0xb0')]({'action':_0x00f8('0x14a'),'command':util[_0x00f8('0x78')](_0x00f8('0x14b'),_0x244f83,!_[_0x00f8('0x86')](config[_0x00f8('0x146')][_0x2779bc])?_0x2779bc:'')})[_0x00f8('0x3f')](function(_0x509fa5){return _0x509fa5[_0x00f8('0x14d')][_0x00f8('0x14f')]('true')>=0x0;})['catch'](myreject(_0x280454)));}BPromise[_0x00f8('0x150')](_0x1c9375)[_0x00f8('0x3f')](function(_0x113342){var _0x3a2314=_['some'](_0x113342);if(_0x3a2314){return _0x42784c(_0x3a2314);}else{_0x5f4e55[_0x00f8('0x41')]=_0x39ab10?_0x00f8('0x151'):'INTERVAL_IS_OVERTIME';return _0x280454(msgResponse(_0x00f8('0x152'),'Failure',_0x00f8('0x153')+_0x39ab10+'\x20'+_0x3cec68+_0x00f8('0x154')+util['inspect'](_0x244f83,{'showHidden':![],'depth':null})+_0x00f8('0x155')+_0x2779bc));}})['catch'](function(_0xebb3d7){return _0x280454(msgResponse(_0x00f8('0x143'),_0x00f8('0x145'),JSON[_0x00f8('0x4b')](_0xebb3d7)));});});};Dialer[_0x00f8('0x1a')][_0x00f8('0x156')]=function(_0x12ac3d){var _0x491d15=this;return function(){switch(_0x12ac3d[_0x00f8('0x59')]){case _0x00f8('0x157'):freeVariablesPredictive(_0x12ac3d);_0x491d15[_0x00f8('0x158')](_0x12ac3d,0x1);break;case'power':freeVariablesPredictive(_0x12ac3d);_0x491d15[_0x00f8('0x158')](_0x12ac3d,_0x12ac3d['dialPowerLevel']);break;case'predictive':_0x491d15[_0x00f8('0x9')](_0x12ac3d);break;case _0x00f8('0x8'):freeVariablesPredictive(_0x12ac3d);_0x491d15[_0x00f8('0x158')](_0x12ac3d,0x1);break;default:freeVariablesPredictive(_0x12ac3d);logger[_0x00f8('0x94')](_0x00f8('0x159'),_0x12ac3d[_0x00f8('0x43')],'method\x20not\x20recognized');}};};Dialer[_0x00f8('0x1a')]['checkPreviewRecallReminder']=function(_0x4c1e78){return BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](cmHopper[_0x00f8('0x15a')](_0x4c1e78['id'],previewRecallmeReminderInterval))[_0x00f8('0x3f')](function(_0x348f36){for(var _0x3ce06a=0x0;_0x3ce06a<_0x348f36[_0x00f8('0x97')];_0x3ce06a++){var _0xfb93fe=_0x348f36[_0x3ce06a][_0x00f8('0x15b')]['name'];if(_0xfb93fe)io['to'](util[_0x00f8('0x78')]('user:%s',_0xfb93fe))[_0x00f8('0xe8')](_0x00f8('0x15c'),{'hopper':_0x348f36[_0x3ce06a]});}})['catch'](function(_0x15253f){});};Dialer[_0x00f8('0x1a')][_0x00f8('0x15d')]=function(_0x438f1b){var _0x12827b=this;return function(){_0x12827b[_0x00f8('0x15e')](_0x438f1b);};};Dialer[_0x00f8('0x1a')][_0x00f8('0x33')]=function(_0x388e7c){var _0x2065be=this;if(isNotPreview(_0x388e7c['dialMethod'])){if(isVoiceQueueOutbound(_0x388e7c[_0x00f8('0x55')])&&isActive(_0x388e7c['dialActive'])){_0x388e7c[_0x00f8('0xa0')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x388e7c,_0x388e7c[_0x00f8('0x15f')]))[_0x00f8('0x3f')](checkIsActive(_0x388e7c,_0x388e7c[_0x00f8('0x160')]))[_0x00f8('0x3f')](checkInterval(_0x388e7c))['then'](_0x2065be[_0x00f8('0x161')](_0x388e7c))[_0x00f8('0x3f')](_0x2065be['checkIfTime'](_0x388e7c[_0x00f8('0x162')],_0x388e7c[_0x00f8('0x163')],_0x388e7c[_0x00f8('0x43')],_0x388e7c))[_0x00f8('0x3f')](_0x2065be[_0x00f8('0x164')](_0x388e7c[_0x00f8('0x45')],_0x388e7c['dialTimezone'],_0x388e7c[_0x00f8('0x43')],_0x388e7c))['then'](_0x2065be[_0x00f8('0x156')](_0x388e7c))[_0x00f8('0xb2')](loggerCatchQueueSummary('[syncQueueSummary]',_0x388e7c));}else{notSendMessagesQueue(_0x388e7c);}}else{freeVariablesPredictive(_0x388e7c);if(_0x388e7c['dialPreviewRecallmeReminder']){_0x2065be[_0x00f8('0x165')](_0x388e7c);}}};Dialer['prototype'][_0x00f8('0x166')]=function(){var _0xa913c1=this;var _0x72daaf;for(var _0x2e1e53 in this[_0x00f8('0x1f')]){if(typeof this[_0x00f8('0x1f')][_0x2e1e53]!=='undefined'){_0x72daaf=this['campaigns'][_0x2e1e53];if(isCampaignIvr(_0x72daaf[_0x00f8('0x55')])&&isActive(_0x72daaf[_0x00f8('0x77')])){_0x72daaf['sendMessageOneNotActive']=!![];BPromise[_0x00f8('0xb8')]()[_0x00f8('0x3f')](checkIsActive(_0x72daaf,_0x72daaf[_0x00f8('0x77')]))[_0x00f8('0x3f')](checkInterval(_0x72daaf))[_0x00f8('0x3f')](_0xa913c1[_0x00f8('0x161')](_0x72daaf))[_0x00f8('0x3f')](_0xa913c1[_0x00f8('0x142')](_0x72daaf[_0x00f8('0x162')],_0x72daaf['dialTimezone'],_0x72daaf['name'],_0x72daaf))[_0x00f8('0x3f')](_0xa913c1[_0x00f8('0x164')](_0x72daaf[_0x00f8('0x45')],_0x72daaf['dialTimezone'],_0x72daaf[_0x00f8('0x43')],_0x72daaf))[_0x00f8('0x3f')](_0xa913c1[_0x00f8('0x15d')](_0x72daaf))[_0x00f8('0xb2')](loggerCatchQueueSummary(_0x00f8('0x167'),_0x72daaf));}else{notSendMessagesCampaign(_0x72daaf);}}}};function getCallerIdRandom(_0xf068b1,_0x39eaec){var _0x4a4f06;var _0xa4f209;var _0x247932;if(_0x39eaec<=0x0){_0x39eaec=0x1;}_0x4a4f06=new RegExp('\x5cw{0,'+_0x39eaec+'}$');_0xa4f209=Math[_0x00f8('0x168')](0xa,_0x39eaec-0x1);_0x247932=Math[_0x00f8('0x168')](0xa,_0x39eaec)-0x1;return util[_0x00f8('0x78')]('%s',_['replace'](_0xf068b1,_0x4a4f06,_[_0x00f8('0x169')](_0xa4f209,_0x247932)));}function extractCalleridName(_0x2ecf23){var _0x1ec68f=_0x2ecf23['match'](/"(.*?)"/);return _0x1ec68f?_0x1ec68f[0x1]:_0x2ecf23;}function extractCalleridNumber(_0x34e2fc){var _0x49a3d8=_0x34e2fc[_0x00f8('0x16a')](/<(.*?)>/);return _0x49a3d8?_0x49a3d8[0x1]:_0x34e2fc;}Dialer['prototype'][_0x00f8('0x16b')]=function(_0x3ce053,_0x5931e4){var _0x39041d=this;var _0x11a2f7=uuid['v4']();this[_0x00f8('0x24')][_0x11a2f7]=new Action(_0x3ce053,_0x5931e4,_0x11a2f7);return new BPromise(function(_0x2b406c,_0x19f5d5){if(_['isUndefined'](_0x3ce053)&&typeof _0x3ce053!==_0x00f8('0x16c')){return _0x19f5d5(msgResponse(_0x00f8('0x16d'),_0x00f8('0x145'),_0x00f8('0x16e')));}if(_[_0x00f8('0x86')](_0x5931e4[_0x00f8('0x16f')])||_0x5931e4[_0x00f8('0x16f')]===null){return _0x19f5d5(msgResponse(_0x00f8('0x16d'),_0x00f8('0x145'),_0x00f8('0x170')));}var _0x32e305={'XMD-CALLERID':_0x39041d[_0x00f8('0x24')][_0x11a2f7][_0x00f8('0x171')](),'XMD-AGI':_0x3ce053['dialQueueProject']?util[_0x00f8('0x78')](_0x00f8('0x172'),ipAgi,_0x3ce053[_0x00f8('0x10a')]):'NONE','XMD-AGIAFTER':_0x3ce053[_0x00f8('0x112')]?util[_0x00f8('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3ce053['dialQueueProject2']):_0x00f8('0x173'),'XMD-QUEUE':_0x3ce053[_0x00f8('0x55')]===_0x00f8('0x4e')?util[_0x00f8('0x78')](_0x00f8('0x174'),_0x3ce053[_0x00f8('0x43')],_0x3ce053[_0x00f8('0x175')]||'',_0x3ce053[_0x00f8('0x113')]?'c':'',_0x3ce053[_0x00f8('0x11b')]||0x3):_0x00f8('0x173'),'XMD-CONTACTID':_0x5931e4['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x39041d[_0x00f8('0x24')][_0x11a2f7][_0x00f8('0x171')](),'XMD-AMD':_0x3ce053[_0x00f8('0xee')]?_0x00f8('0x176'):_0x00f8('0x173'),'XMD-DESTINATION':_0x00f8('0x177')};if(_0x3ce053[_0x00f8('0xee')]){_0x32e305[_0x00f8('0x178')]=_0x3ce053[_0x00f8('0x179')]||0x9c4;_0x32e305[_0x00f8('0x17a')]=_0x3ce053[_0x00f8('0x17b')]||0x5dc;_0x32e305[_0x00f8('0x17c')]=_0x3ce053[_0x00f8('0x17d')]||0x320;_0x32e305[_0x00f8('0x17e')]=_0x3ce053[_0x00f8('0x17f')]||0x1388;_0x32e305[_0x00f8('0x180')]=_0x3ce053[_0x00f8('0x181')]||0x64;_0x32e305[_0x00f8('0x182')]=_0x3ce053[_0x00f8('0x183')]||0x32;_0x32e305[_0x00f8('0x184')]=_0x3ce053['dialAMDMaximumNumberOfWords']||0x3;_0x32e305[_0x00f8('0x185')]=_0x3ce053[_0x00f8('0x186')]||0x100;_0x32e305[_0x00f8('0x187')]=_0x3ce053[_0x00f8('0x188')]||0x1388;}if(_0x3ce053[_0x00f8('0x55')]===_0x00f8('0x4e')){_0x32e305[_0x00f8('0x189')]=_0x5931e4[_0x00f8('0xd8')];}else{_0x32e305[_0x00f8('0x18a')]=_0x5931e4[_0x00f8('0xd9')];}for(var _0x5e2343 in _0x5931e4[_0x00f8('0x18b')]){if(typeof _0x5931e4['Contact'][_0x5e2343]!==_0x00f8('0xd0')){if(isNotNull(_0x5931e4[_0x00f8('0x18b')][_0x5e2343])&&_0x5e2343!=='id'&&_0x5e2343!==_0x00f8('0x18c')&&_0x5e2343!=='createdAt'&&_0x5e2343!=='updatedAt'){_0x32e305[util[_0x00f8('0x78')](_0x00f8('0x18d'),'XMD-',_['toUpper'](_0x5e2343))]=_0x5931e4[_0x00f8('0x18b')][_0x5e2343];}}}var _0x5406fc=_0x39041d[_0x00f8('0xdc')](_0x3ce053['Trunk'])?getCallerId(_0x3ce053['Trunk'][_0x00f8('0x18e')],_0x3ce053[_0x00f8('0x5a')],_0x3ce053[_0x00f8('0x18f')]>0x0?getCallerIdRandom(_0x3ce053['dialOriginateCallerIdNumber'],_0x3ce053[_0x00f8('0x18f')]):_0x3ce053['dialOriginateCallerIdNumber']):getCallerId(_[_0x00f8('0xe1')](_0x3ce053['TrunkBackup'])?_0x3ce053[_0x00f8('0x76')][_0x00f8('0x18e')]:_0x3ce053[_0x00f8('0x190')][_0x00f8('0x18e')],_0x3ce053[_0x00f8('0x5a')],_0x3ce053[_0x00f8('0x18f')]>0x0?getCallerIdRandom(_0x3ce053[_0x00f8('0x191')],_0x3ce053[_0x00f8('0x18f')]):_0x3ce053[_0x00f8('0x191')]);if(_0x5406fc){_0x32e305['XMD-ORIGINATECALLERIDNAME']=_0x39041d[_0x00f8('0x24')][_0x11a2f7]['originatecalleridname']=extractCalleridName(_0x5406fc);_0x32e305[_0x00f8('0x192')]=_0x5931e4['phone'];}return ami[_0x00f8('0xb0')]({'actionid':_0x11a2f7,'action':'originate','channel':_0x39041d[_0x00f8('0xdc')](_0x3ce053[_0x00f8('0x76')])?util[_0x00f8('0x78')](_0x00f8('0x193'),_0x3ce053['Trunk']['name'],isNotNull(_0x3ce053[_0x00f8('0x5c')])?_0x3ce053[_0x00f8('0x5c')][_0x00f8('0x194')]()||'':'',_0x3ce053['dialCutDigit']>0x0?_0x5931e4[_0x00f8('0x16f')][_0x00f8('0x195')](_0x3ce053['dialCutDigit']):_0x5931e4['phone']):util['format'](_0x00f8('0x193'),_['isNil'](_0x3ce053[_0x00f8('0x190')])?_0x3ce053[_0x00f8('0x76')]['name']:_0x3ce053[_0x00f8('0x190')][_0x00f8('0x43')],isNotNull(_0x3ce053[_0x00f8('0x5c')])?_0x3ce053[_0x00f8('0x5c')][_0x00f8('0x194')]()||'':'',_0x3ce053[_0x00f8('0x196')]>0x0?_0x5931e4['phone'][_0x00f8('0x195')](_0x3ce053[_0x00f8('0x196')]):_0x5931e4[_0x00f8('0x16f')]),'callerid':_0x5406fc,'Exten':_0x00f8('0x177'),'Context':_0x00f8('0x197'),'Priority':'1','variable':_0x32e305,'timeout':(_0x3ce053[_0x00f8('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11a2f7})[_0x00f8('0x3f')](function(_0x53d7e9){return _0x2b406c(_0x53d7e9);})[_0x00f8('0xb2')](function(_0x2b9344){_0x3ce053[_0x00f8('0x66')]+=0x1;var _0xfb264e=new History(_0x39041d['actions'][_0x11a2f7]);logger[_0x00f8('0x94')](util[_0x00f8('0x78')]('[originateError]:\x20%s',JSON[_0x00f8('0x4b')](_0x2b9344)));_0xfb264e['state']=0xe;_0xfb264e[_0x00f8('0xa9')]='OriginateError';_0xfb264e['starttime']=moment()[_0x00f8('0x78')](_0x00f8('0x103'));_0xfb264e[_0x00f8('0xaa')]=_0xfb264e[_0x00f8('0xab')];_0x39041d[_0x00f8('0xce')](_0xfb264e)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x198')));_0x39041d[_0x00f8('0xcc')](_0xfb264e)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x198')))['finally'](function(){delete _0x39041d[_0x00f8('0x24')][_0x11a2f7];return _0x19f5d5(msgResponse(_0x00f8('0x16d'),_0x00f8('0x4a'),_0x00f8('0x199')));});});});};Dialer[_0x00f8('0x1a')][_0x00f8('0x19a')]=function(_0x5cad24){var _0x236fb7=this[_0x00f8('0x24')][_0x5cad24[_0x00f8('0x129')]];if(_0x236fb7){delete this[_0x00f8('0x24')][_0x5cad24[_0x00f8('0x129')]];_0x236fb7[_0x00f8('0x11a')]=moment()[_0x00f8('0x78')](_0x00f8('0x103'));var _0x1283cf=_0x236fb7[_0x00f8('0x55')]===_0x00f8('0x91')?this[_0x00f8('0x1f')][_0x236fb7[_0x00f8('0xb5')]]:this[_0x00f8('0x1e')][_0x236fb7[_0x00f8('0x19b')]()];if(!this['isSuccess'](_0x5cad24[_0x00f8('0x19c')])){this[_0x00f8('0xb4')](_0x1283cf);return this[_0x00f8('0x19d')](_0x236fb7,_0x1283cf,_0x5cad24)[_0x00f8('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x5cad24['uniqueid']]=_0x236fb7;}};Dialer['prototype'][_0x00f8('0x19e')]=function(_0x35e3d7,_0x2e04df,_0x309550){var _0x3ee6e4=new History(_0x2e04df);if(_0x3ee6e4[_0x00f8('0xf3')]+_0x3ee6e4[_0x00f8('0xf4')]+_0x3ee6e4['countnoanswerretry']+_0x3ee6e4[_0x00f8('0xf6')]+_0x3ee6e4['countdropretry']+_0x3ee6e4['countabandonedretry']+_0x3ee6e4[_0x00f8('0xf9')]+_0x3ee6e4[_0x00f8('0xfa')]>=_0x309550[_0x00f8('0x107')]-0x1){return!![];}switch(_0x35e3d7){case 0x3:if(_0x3ee6e4['countnoanswerretry']>=_0x309550[_0x00f8('0x19f')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countnoanswerretry':_0x3ee6e4[_0x00f8('0xf5')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550['dialNoAnswerRetryFrequency'],_0x00f8('0x102'))[_0x00f8('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ee6e4['ContactId'],'ListId':_0x3ee6e4['ListId'],'VoiceQueueId':_0x3ee6e4[_0x00f8('0xd8')]||undefined,'CampaignId':_0x3ee6e4[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3ee6e4['countbusyretry']>=_0x309550[_0x00f8('0x1a0')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countbusyretry':_0x3ee6e4[_0x00f8('0xf3')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550['dialBusyRetryFrequency'],_0x00f8('0x102'))[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4['VoiceQueueId']||undefined,'CampaignId':_0x3ee6e4['CampaignId']||undefined})['catch'](loggerCatch(_0x00f8('0x1a1')));break;case 0x8:if(_0x3ee6e4[_0x00f8('0xf4')]>=_0x309550[_0x00f8('0x1a2')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countcongestionretry':_0x3ee6e4[_0x00f8('0xf4')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550[_0x00f8('0x1a3')],_0x00f8('0x102'))[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4[_0x00f8('0xd8')]||undefined,'CampaignId':_0x3ee6e4['CampaignId']||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1a4')));break;case 0x0:if(_0x3ee6e4[_0x00f8('0xf6')]>=_0x309550[_0x00f8('0x1a5')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3ee6e4[_0x00f8('0xf6')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550[_0x00f8('0x1a6')],_0x00f8('0x102'))[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4[_0x00f8('0xd8')]||undefined,'CampaignId':_0x3ee6e4[_0x00f8('0xd9')]||undefined})['catch'](loggerCatch(_0x00f8('0x1a7')));}break;case 0xa:if(_0x3ee6e4['countdropretry']>=_0x309550[_0x00f8('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x3ee6e4[_0x00f8('0xf7')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550[_0x00f8('0x11d')],_0x00f8('0x102'))['format'](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4['VoiceQueueId']||undefined,'CampaignId':_0x3ee6e4[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x121')));break;case 0xb:if(_0x3ee6e4[_0x00f8('0xf8')]>=_0x309550[_0x00f8('0x126')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countabandonedretry':_0x3ee6e4[_0x00f8('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x309550[_0x00f8('0x125')],_0x00f8('0x102'))['format'](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4[_0x00f8('0xd8')]||undefined,'CampaignId':_0x3ee6e4['CampaignId']||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1a8')));break;case 0x13:if(_0x3ee6e4[_0x00f8('0xf9')]>=_0x309550[_0x00f8('0xfd')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countmachineretry':_0x3ee6e4[_0x00f8('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x309550[_0x00f8('0x101')],'minutes')[_0x00f8('0x78')](_0x00f8('0x103')),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4['VoiceQueueId']||undefined,'CampaignId':_0x3ee6e4[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x104')));break;case 0x14:if(_0x3ee6e4[_0x00f8('0xfa')]>=_0x309550[_0x00f8('0x1a9')]-0x1){return!![];}this[_0x00f8('0xc3')]({'active':![],'countagentrejectretry':_0x3ee6e4[_0x00f8('0xfa')]+=0x1,'scheduledat':moment()[_0x00f8('0x100')](_0x309550[_0x00f8('0x1aa')],_0x00f8('0x102'))[_0x00f8('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ee6e4[_0x00f8('0xd5')],'ListId':_0x3ee6e4[_0x00f8('0xd6')],'VoiceQueueId':_0x3ee6e4[_0x00f8('0xd8')]||undefined,'CampaignId':_0x3ee6e4[_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1ab')));break;default:return!![];}};Dialer[_0x00f8('0x1a')][_0x00f8('0x19d')]=function(_0x2df653,_0x44a8c9,_0x1263f9){var _0x5dbdec=this;var _0x1dc614=new History(_0x2df653);var _0x3efe0c=![];var _0xce4f8a;var _0x3a2461;return new BPromise(function(_0x2bef5a,_0x3f4af5){if(_['isUndefined'](_0x44a8c9)&&typeof _0x44a8c9!==_0x00f8('0x16c')){return _0x3f4af5(msgResponse(_0x00f8('0x1ac'),'Failure',_0x00f8('0x1ad')));}if(_['isUndefined'](_0x1263f9)&&typeof _0x1263f9!==_0x00f8('0x16c')){return _0x3f4af5(msgResponse(_0x00f8('0x1ac'),_0x00f8('0x145'),'evt\x20is\x20undefine'));}_0x5dbdec[_0x00f8('0xbb')](_0x1dc614,_0x1263f9['reason'],_0x44a8c9)[_0x00f8('0x3f')](function(_0x56bec1){if(_0x56bec1[_0x00f8('0x11f')]==0x1)_0x3efe0c=!![];switch(_0x1263f9[_0x00f8('0x10f')]){case'0':_0x44a8c9['outboundNoSuchCallsDay']+=0x1;_0x1dc614[_0x00f8('0xa8')]=0x0;_0x1dc614[_0x00f8('0xa9')]=_0x00f8('0x1ae');_0x1dc614[_0x00f8('0xf6')]+=0x1;_0x1dc614[_0x00f8('0xf1')]+=0x1;ami[_0x00f8('0xe8')]('custom:agentnosuchnumber',ut[_0x00f8('0xea')](_0x2df653,_0x00f8('0x1af')));_0xce4f8a=_0x44a8c9[_0x00f8('0x1a6')];_0x3a2461=_0x44a8c9[_0x00f8('0x1b0')];_0x5dbdec[_0x00f8('0xce')](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xf2')));if(_0x5dbdec['checkRetriveMax'](0x0,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614['countnosuchnumberretry']>=_0x44a8c9['dialNoSuchNumberMaxRetry']){_0x5dbdec[_0x00f8('0xfe')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1b1'));}else{_0x5dbdec[_0x00f8('0xfb')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1b1'));}}break;case'3':_0x44a8c9[_0x00f8('0x64')]+=0x1;_0x1dc614['state']=0x3;_0x1dc614[_0x00f8('0xa9')]=_0x00f8('0x1b2');_0x1dc614[_0x00f8('0xf5')]+=0x1;_0x1dc614[_0x00f8('0xf1')]+=0x1;ami[_0x00f8('0xe8')](_0x00f8('0x1b3'),ut[_0x00f8('0xea')](_0x2df653,_0x00f8('0x1b4')));_0xce4f8a=_0x44a8c9['dialNoAnswerRetryFrequency'];_0x3a2461=_0x44a8c9['callAdditionalPhoneAfterMin'];_0x5dbdec[_0x00f8('0xce')](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1b5')));if(_0x5dbdec['checkRetriveMax'](0x3,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xf5')]>=_0x44a8c9[_0x00f8('0x19f')]){_0x5dbdec['createStateFinal'](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1b6'));}else{_0x5dbdec['stateGlobal'](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1b6'));}}break;case'5':_0x44a8c9[_0x00f8('0x1b7')]+=0x1;_0x1dc614[_0x00f8('0xa8')]=0x5;_0x1dc614['statedesc']='Busy';_0x1dc614[_0x00f8('0xf3')]+=0x1;_0x1dc614['countglobal']+=0x1;ami[_0x00f8('0xe8')]('custom:agentbusy',ut['buildObj'](_0x2df653,_0x00f8('0x1b8')));_0xce4f8a=_0x44a8c9[_0x00f8('0x1b9')];_0x3a2461=_0x44a8c9[_0x00f8('0x1b0')];_0x5dbdec[_0x00f8('0xce')](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1ba')));if(_0x5dbdec[_0x00f8('0x19e')](0x5,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xf3')]>=_0x44a8c9[_0x00f8('0x1a0')]){_0x5dbdec[_0x00f8('0xfe')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1bb'));}else{_0x5dbdec['stateGlobal'](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1bb'));}}break;case'8':_0x44a8c9[_0x00f8('0x60')]+=0x1;_0x1dc614['state']=0x8;_0x1dc614[_0x00f8('0xa9')]=_0x00f8('0x1bc');_0x1dc614[_0x00f8('0xf4')]+=0x1;_0x1dc614[_0x00f8('0xf1')]+=0x1;_0xce4f8a=_0x44a8c9[_0x00f8('0x1a3')];_0x3a2461=_0x44a8c9[_0x00f8('0x1b0')];ami[_0x00f8('0xe8')]('custom:agentcongestion',ut['buildObj'](_0x2df653,'congestion'));_0x5dbdec[_0x00f8('0xce')](_0x1dc614)['catch'](loggerCatch(_0x00f8('0x1bd')));if(_0x5dbdec[_0x00f8('0x19e')](0x8,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xf4')]>=_0x44a8c9[_0x00f8('0x1a2')]){_0x5dbdec[_0x00f8('0xfe')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1be'));}else{_0x5dbdec[_0x00f8('0xfb')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1be'));}}break;case'11':_0x44a8c9[_0x00f8('0x1bf')]+=0x1;_0x1dc614[_0x00f8('0xa8')]=0xb;_0x1dc614[_0x00f8('0xa9')]=_0x00f8('0x127');_0x1dc614[_0x00f8('0xf8')]+=0x1;_0x1dc614['countglobal']+=0x1;_0xce4f8a=_0x44a8c9[_0x00f8('0x125')];_0x3a2461=_0x44a8c9['callAdditionalPhoneAfterMin'];_0x5dbdec[_0x00f8('0xce')](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1c0')));if(_0x5dbdec[_0x00f8('0x19e')](0xb,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xf8')]>=_0x44a8c9[_0x00f8('0x126')]){_0x5dbdec['createStateFinal'](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1c1'));}else{_0x5dbdec[_0x00f8('0xfb')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1c1'));}}break;case'20':_0x44a8c9['outboundRejectCallsDay']+=0x1;_0x1dc614[_0x00f8('0xa8')]=0x14;_0x1dc614['statedesc']='AgentReject';_0x1dc614[_0x00f8('0xfa')]+=0x1;_0x1dc614[_0x00f8('0xf1')]+=0x1;_0xce4f8a=_0x44a8c9[_0x00f8('0x1aa')];_0x3a2461=_0x44a8c9[_0x00f8('0x1b0')];ami[_0x00f8('0xe8')]('custom:agentreject',ut[_0x00f8('0xea')](_0x2df653,_0x00f8('0x1c2')));_0x5dbdec[_0x00f8('0xce')](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1c3')));if(_0x5dbdec[_0x00f8('0x19e')](0x14,_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xfa')]>=_0x44a8c9[_0x00f8('0x1a9')]){_0x5dbdec[_0x00f8('0xfe')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x00f8('0x1c4'));}else{_0x5dbdec[_0x00f8('0xfb')](_0x1dc614,_0x2bef5a,_0x3f4af5,'reason\x2020\x20agentreject');}}break;default:_0x44a8c9['outboundUnknownCallsDay']+=0x1;_0x1dc614[_0x00f8('0xa8')]=0xc;_0x1dc614[_0x00f8('0xa9')]=_0x1263f9[_0x00f8('0x10f')];_0xce4f8a=_0x44a8c9[_0x00f8('0x1aa')];_0x3a2461=_0x44a8c9['callAdditionalPhoneAfterMin'];_0x5dbdec['createHistory'](_0x1dc614)[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1c5')));if(_0x5dbdec['checkRetriveMax'](_0x1263f9[_0x00f8('0x10f')],_0x2df653,_0x44a8c9)&&!_0x3efe0c){if(_0x1dc614[_0x00f8('0xf3')]+_0x1dc614[_0x00f8('0xf4')]+_0x1dc614[_0x00f8('0xf5')]+_0x1dc614[_0x00f8('0xf6')]+_0x1dc614['countdropretry']+_0x1dc614[_0x00f8('0xf8')]+_0x1dc614[_0x00f8('0xf9')]+_0x1dc614[_0x00f8('0xfa')]>=_0x44a8c9[_0x00f8('0x107')]){_0x5dbdec['stateGlobal'](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x1263f9['reason']);}else{_0x5dbdec[_0x00f8('0xfe')](_0x1dc614,_0x2bef5a,_0x3f4af5,_0x1263f9[_0x00f8('0x10f')]);}}}})[_0x00f8('0x3f')](function(_0xa4d3e){if(_0x3efe0c){_0x5dbdec[_0x00f8('0xbd')](_0x1dc614,_0xce4f8a,_0x3a2461)[_0x00f8('0x3f')](function(_0x1aaef7){return _0x2bef5a(0x1);});}});});};Dialer['prototype'][_0x00f8('0xfb')]=function(_0x1fb8b3,_0x348704,_0x1d507c,_0x189337){var _0x522b8a=new Final(_0x1fb8b3);_0x522b8a[_0x00f8('0xa8')]=0xf;_0x522b8a['statedesc']=_0x00f8('0x1c6');this[_0x00f8('0xfe')](_0x522b8a,_0x348704,_0x1d507c,_0x189337);};Dialer[_0x00f8('0x1a')][_0x00f8('0xfe')]=function(_0x26c432,_0x563523,_0x486bea,_0x42a2cb){this[_0x00f8('0xcc')](_0x26c432)[_0x00f8('0x3f')](function(){return _0x563523(msgResponse(_0x00f8('0x1ac'),_0x00f8('0x1c7'),_0x42a2cb));})[_0x00f8('0xb2')](function(){return _0x486bea(msgResponse(_0x00f8('0x1c8'),_0x00f8('0x145'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x00f8('0x9')]=function(_0x23959a){var _0x2d1861=_0x23959a[_0x00f8('0x1c9')]/0x64;var _0x5af616=_0x23959a[_0x00f8('0x63')]/(_0x23959a['outboundDropCallsDayTimeout']+_0x23959a[_0x00f8('0x5e')]);var _0xd98460=Math[_0x00f8('0x1ca')](_0x23959a['predictiveIntervalAvailable']*(_0x23959a[_0x00f8('0x1cb')]/0x64));var _0x438206=Math[_0x00f8('0x1ca')](_0x23959a[_0x00f8('0x70')]*(_0x23959a[_0x00f8('0x1cc')]/0x64));var _0x47b9b7=_0x23959a[_0x00f8('0x50')]+_0x23959a[_0x00f8('0xa1')];var _0x2db7b6=Math[_0x00f8('0x1cd')](_0x23959a['erlangCalls']*_0x23959a[_0x00f8('0x74')]*_0x23959a[_0x00f8('0x6e')]*_0x23959a[_0x00f8('0x1ce')]);if(_[_0x00f8('0x86')](_0x23959a[_0x00f8('0x29')])){if(!_[_0x00f8('0x86')](_0x23959a[_0x00f8('0x28')])){_0x23959a[_0x00f8('0x28')]=undefined;loggerPredictive[_0x00f8('0x94')](_0x00f8('0x1cf'),_0x00f8('0x1d0'));}if(!_['isUndefined'](_0x23959a[_0x00f8('0x90')])){loggerPredictive[_0x00f8('0x94')](_0x00f8('0x1cf'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x23959a[_0x00f8('0x90')]);_0x23959a[_0x00f8('0x90')]=undefined;}_0x23959a[_0x00f8('0x29')]=moment()[_0x00f8('0x78')](_0x00f8('0x103'));loggerPredictive['info'](_0x23959a[_0x00f8('0x43')],_0x00f8('0x1d1'),_0x23959a[_0x00f8('0x29')]);this[_0x00f8('0x158')](_0x23959a,0x1);}else if(ifInterval(_0x23959a['dialPredictiveInterval'],_0x23959a['startProgressive'])){this[_0x00f8('0x158')](_0x23959a,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x23959a[_0x00f8('0x29')],_0x23959a[_0x00f8('0x43')]);_0x23959a[_0x00f8('0x72')]=0x0;_0x23959a['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2d1861<_0x5af616&&_0x23959a[_0x00f8('0x1d2')]===_0x00f8('0x1d3')){freeVariablesPredictive(_0x23959a);loggerPredictive['info'](_0x00f8('0x1d4'),_0x00f8('0x1d5'),_0x5af616,_0x00f8('0x29'),_0x23959a['name']);}else if(_0x2db7b6<_0x23959a[_0x00f8('0x11c')]&&_0x23959a[_0x00f8('0x1d2')]===_0x00f8('0x1d3')){freeVariablesPredictive(_0x23959a);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x1d6'),_0x00f8('0x1d7'),_0x2db7b6,_0x00f8('0x1d8'),_0x23959a[_0x00f8('0x11c')],'startProgressive',_0x23959a[_0x00f8('0x43')]);}else if(!ifInterval(_0x23959a[_0x00f8('0x1d9')],_0x23959a[_0x00f8('0x29')])&&_[_0x00f8('0x86')](_0x23959a['startPredictive'])&&!_[_0x00f8('0x86')](_0x23959a[_0x00f8('0x29')])){_0x23959a['startPredictive']=moment()[_0x00f8('0x78')](_0x00f8('0x103'));loggerPredictive[_0x00f8('0x7d')](_0x23959a[_0x00f8('0x43')],_0x00f8('0x1da'),_0x23959a[_0x00f8('0x28')]);this[_0x00f8('0xc0')](_0x23959a[_0x00f8('0x1d9')])['then'](this['getDataPredictive'](_0x23959a))[_0x00f8('0x3f')](mergeDataErlangB(_0x23959a))[_0x00f8('0x3f')](this[_0x00f8('0x1db')](_0x23959a))[_0x00f8('0xb2')](loggerCatchPredictive(_0x00f8('0x1dc'),_0x23959a));}else if(!ifInterval(_0x23959a[_0x00f8('0x1d9')],_0x23959a['startPredictive'])){_0x23959a[_0x00f8('0x11c')]=0x0;_0x23959a[_0x00f8('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x23959a['name'],'recalculate\x20predictive\x20at',_0x23959a[_0x00f8('0x28')]);clearInterval(_0x23959a['handlePredictive']);_0x23959a[_0x00f8('0x90')]=undefined;this[_0x00f8('0xc0')](_0x23959a['dialPredictiveInterval'])['then'](this['getDataPredictive'](_0x23959a))[_0x00f8('0x3f')](mergeDataErlangB(_0x23959a))[_0x00f8('0x3f')](this[_0x00f8('0x1db')](_0x23959a))[_0x00f8('0xb2')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x23959a));}else if(_0x23959a[_0x00f8('0x70')]&&_0x47b9b7<_0x23959a[_0x00f8('0x70')]-_0x438206){freeVariablesPredictive(_0x23959a);loggerPredictive[_0x00f8('0x7d')](_0x23959a[_0x00f8('0x43')],_0x00f8('0x1dd'),_0x47b9b7,_0x00f8('0x1de'),_0x23959a[_0x00f8('0x70')],'-',_0x438206,'=',_0x23959a[_0x00f8('0x70')]-_0x438206,')');}else if(_0x23959a['predictiveIntervalAvailable']&&_0x47b9b7>_0x23959a[_0x00f8('0x70')]+_0xd98460){freeVariablesPredictive(_0x23959a);loggerPredictive[_0x00f8('0x7d')](_0x23959a['name'],_0x00f8('0x1dd'),_0x47b9b7,')\x20are\x20more\x20than\x20threshold\x20(',_0x23959a['predictiveIntervalAvailable'],'+',_0xd98460,'=',_0x23959a[_0x00f8('0x70')]+_0xd98460,')');}};Dialer[_0x00f8('0x1a')][_0x00f8('0x1df')]=function(_0x26a76b){var _0x3e07b9=this;return function(_0x4d75ff){return new BPromise(function(_0x409ca6,_0x92c837){_[_0x00f8('0x8c')](_0x26a76b,_0x4d75ff[0x0]);if(checkGetDataPredictive(_0x4d75ff[0x0])){var _0xf40262=_0x26a76b['predictiveIntervalAvailable']=_0x26a76b[_0x00f8('0xa1')]+_0x26a76b['available'];var _0x35823f=_0x26a76b['dialPredictiveInterval']*0x3c;var _0x287131=_0x4d75ff[0x0][_0x00f8('0x6a')]+_0x4d75ff[0x0][_0x00f8('0x69')];var _0x57a477=(_0x4d75ff[0x0]['predictiveIntervalAnsweredCalls']+_0x4d75ff[0x0][_0x00f8('0x6c')]+_0x4d75ff[0x0][_0x00f8('0x6b')])/_0x4d75ff[0x0][_0x00f8('0x71')];_0x26a76b[_0x00f8('0x6e')]=_0x57a477>0x0?_0x57a477:0x1;switch(_0x26a76b[_0x00f8('0x1d2')]){case _0x00f8('0x1d3'):var _0x311204=_0x26a76b['dialPredictiveOptimizationPercentage']/0x64;return _0x3e07b9[_0x00f8('0x1e0')](_0xf40262,_0x35823f,_0x287131,_0x57a477,_0x311204)[_0x00f8('0x3f')](function(_0x414ee1){return _0x409ca6(_0x414ee1);});case _0x00f8('0x1e1'):var _0xad80c9=_0x26a76b['dialPredictiveOptimizationPercentage']/0x64;return _0x3e07b9[_0x00f8('0x1e2')](_0xf40262,_0x35823f,_0x287131,_0x57a477,_0xad80c9)[_0x00f8('0x3f')](function(_0x19db48){return _0x409ca6(_0x19db48);});default:return _0x92c837(msgResponse(_0x00f8('0x1e3'),_0x00f8('0x145'),_0x00f8('0x1e4')));}}else{return _0x92c837(msgResponse(_0x00f8('0x1e3'),_0x00f8('0x145'),'check\x20failure'));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x5d3b6c){var _0x15de90=this;return function(_0x48ed3b){return new BPromise(function(_0x3c5db1,_0x42acdc){_['merge'](_0x5d3b6c,_0x48ed3b[0x0]);if(checkGetDataPredictive(_0x48ed3b[0x0])){loggerPredictive[_0x00f8('0x7d')](JSON[_0x00f8('0x4b')](_0x48ed3b[0x0]));if(_0x5d3b6c[_0x00f8('0x1d2')]===_0x00f8('0x1d3')){return _0x15de90[_0x00f8('0xcb')](_0x5d3b6c['id'])[_0x00f8('0x3f')](function(_0x3f1459){var _0x495049=_0x5d3b6c[_0x00f8('0x15f')]-_0x3f1459[0x0]['outboundQueuePauses'];var _0x6b9e7c=_0x5d3b6c['dialPredictiveInterval']*0x3c;var _0xed98c6=_0x48ed3b[0x0][_0x00f8('0x6a')]+_0x48ed3b[0x0][_0x00f8('0x69')];var _0x337820=(_0x48ed3b[0x0][_0x00f8('0x80')]+_0x48ed3b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x48ed3b[0x0][_0x00f8('0x6b')])/_0x48ed3b[0x0][_0x00f8('0x71')];var _0x389d86=_0x5d3b6c['dialPredictiveOptimizationPercentage']/0x64;_0x5d3b6c['predictiveIntervalPauses']=_0x3f1459[0x0]['outboundQueuePauses']||0x0;_0x5d3b6c[_0x00f8('0x6e')]=_0x337820>0x0?_0x337820:0x1;return _0x15de90['abandonmentRate'](_0x495049,_0x6b9e7c,_0xed98c6,_0x337820,_0x389d86);})[_0x00f8('0x3f')](function(_0x2f946c){return _0x3c5db1(_0x2f946c);})[_0x00f8('0xb2')](function(_0x3ad551){return _0x42acdc(msgResponse(_0x00f8('0x1e5'),_0x00f8('0x145'),JSON['stringify'](_0x3ad551)));});}if(_0x5d3b6c[_0x00f8('0x1d2')]===_0x00f8('0x1e1')){return _0x15de90[_0x00f8('0xcb')](_0x5d3b6c['id'])['then'](function(_0x108444){var _0x36c497=_0x5d3b6c[_0x00f8('0x15f')]-_0x108444[0x0][_0x00f8('0x1e6')];var _0x1c41a9=_0x5d3b6c[_0x00f8('0x1d9')]*0x3c;var _0x30c7cd=_0x48ed3b[0x0][_0x00f8('0x6a')]+_0x48ed3b[0x0][_0x00f8('0x69')];var _0x58e96e=(_0x48ed3b[0x0][_0x00f8('0x80')]+_0x48ed3b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x48ed3b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48ed3b[0x0][_0x00f8('0x71')];var _0x58cece=_0x5d3b6c[_0x00f8('0x1c9')]/0x64;_0x5d3b6c[_0x00f8('0x6f')]=_0x108444[0x0][_0x00f8('0x1e6')]||0x0;_0x5d3b6c[_0x00f8('0x6e')]=_0x58e96e>0x0?_0x58e96e:0x1;return _0x15de90[_0x00f8('0x1e2')](_0x36c497,_0x1c41a9,_0x30c7cd,_0x58e96e,_0x58cece);})[_0x00f8('0x3f')](function(_0x12d691){return _0x3c5db1(_0x12d691);})[_0x00f8('0xb2')](function(_0x33f8b4){return _0x42acdc(msgResponse(_0x00f8('0x1e5'),_0x00f8('0x145'),JSON[_0x00f8('0x4b')](_0x33f8b4)));});}}else{return _0x42acdc(msgResponse(_0x00f8('0x1e3'),_0x00f8('0x145'),'check\x20failure'));}});};};Dialer[_0x00f8('0x1a')][_0x00f8('0x1db')]=function(_0x32945a){var _0x455162=this;return function(){var _0xfc5f7a=0x0;var _0x2ad3e6=Math[_0x00f8('0x1cd')](_0x32945a[_0x00f8('0x73')]*0x3e8);if(_0x2ad3e6>0x0){_0x2ad3e6=_0x2ad3e6<0x64?0x64:_0x2ad3e6;loggerPredictive[_0x00f8('0x7d')](_0x32945a[_0x00f8('0x43')],_0x00f8('0x1e7'),_0x2ad3e6,_0x00f8('0x4c'));_0x32945a[_0x00f8('0x90')]=setInterval(function(){_0x455162['handlePredictive'](_0x32945a);loggerPredictiveCalls['info'](_0x00f8('0x1e8'),_0xfc5f7a+=0x1);},_0x2ad3e6);}else{loggerPredictive[_0x00f8('0x7d')](_0x32945a[_0x00f8('0x43')],_0x00f8('0x1e9'));}};};Dialer[_0x00f8('0x1a')][_0x00f8('0x1ea')]=function(_0x29d8b6,_0x48d50d){var _0x423a1a=this;return function(_0x3f1777){if(_[_0x00f8('0x48')](_0x3f1777)){if(_[_0x00f8('0xe1')](_0x48d50d[_0x00f8('0xd7')])||!_0x48d50d['recallme']){if(_0x29d8b6[_0x00f8('0x59')]===_0x00f8('0x8')){_0x29d8b6[_0x00f8('0x130')]=_[_0x00f8('0x86')](_0x29d8b6[_0x00f8('0x130')])?!![]:_0x29d8b6[_0x00f8('0x130')];var _0x3c5d2d=uuid['v4']();_0x423a1a[_0x00f8('0x24')][_0x3c5d2d]=new Action(_0x29d8b6,_0x48d50d,_0x3c5d2d);loggerBooked[_0x00f8('0x7d')](_0x00f8('0x1eb'),_0x3c5d2d,'queueStatusComplete:\x20',JSON[_0x00f8('0x4b')](_0x29d8b6[_0x00f8('0x130')]),_0x00f8('0x1ec'),_0x29d8b6[_0x00f8('0x43')]);if(_0x29d8b6[_0x00f8('0x130')]){_0x29d8b6['queueStatusComplete']=![];_0x423a1a[_0x00f8('0x2b')][_0x423a1a[_0x00f8('0x24')][_0x3c5d2d]['queue']]=[];ami[_0x00f8('0xb0')]({'actionid':_0x3c5d2d,'action':'queuestatus','queue':_0x29d8b6['name']})[_0x00f8('0xb2')](function(){_0x423a1a['updateOriginated'](_0x29d8b6);_0x423a1a[_0x00f8('0xc3')]({'active':![],'ContactId':_0x423a1a['actions'][_0x3c5d2d][_0x00f8('0xd5')],'ListId':_0x423a1a[_0x00f8('0x24')][_0x3c5d2d][_0x00f8('0xd6')],'VoiceQueueId':_0x423a1a[_0x00f8('0x24')][_0x3c5d2d][_0x00f8('0xd8')]||undefined,'CampaignId':_0x423a1a['actions'][_0x3c5d2d][_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1ed')));delete _0x423a1a[_0x00f8('0x24')][_0x3c5d2d];});}else{loggerBooked[_0x00f8('0x7d')](_0x00f8('0x1ee'),JSON[_0x00f8('0x4b')](_0x29d8b6[_0x00f8('0x130')]),_0x00f8('0x1ec'),_0x29d8b6[_0x00f8('0x43')]);_0x423a1a['updateOriginated'](_0x29d8b6);_0x423a1a['rescheduleContact']({'active':![],'ContactId':_0x423a1a[_0x00f8('0x24')][_0x3c5d2d][_0x00f8('0xd5')],'ListId':_0x423a1a[_0x00f8('0x24')][_0x3c5d2d][_0x00f8('0xd6')],'VoiceQueueId':_0x423a1a['actions'][_0x3c5d2d][_0x00f8('0xd8')]||undefined,'CampaignId':_0x423a1a[_0x00f8('0x24')][_0x3c5d2d][_0x00f8('0xd9')]||undefined})[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1ed')));delete _0x423a1a[_0x00f8('0x24')][_0x3c5d2d];}}else{return _0x423a1a[_0x00f8('0x16b')](_0x29d8b6,_0x48d50d);}}else{if(getDiff(_0x48d50d[_0x00f8('0x1ef')])<_0x29d8b6[_0x00f8('0x1f0')]*0x3c){if(_0x48d50d[_0x00f8('0x15b')]&&!_0x48d50d[_0x00f8('0x15b')][_0x00f8('0x1f1')]){_0x423a1a['preview'][_0x00f8('0x132')](_0x48d50d['id'])[_0x00f8('0x1f2')](function(){_0x423a1a[_0x00f8('0xb4')](_0x29d8b6);});}else{_0x423a1a[_0x00f8('0xc4')]({'active':![]},_0x48d50d['id'],0x1)['finally'](function(){_0x423a1a[_0x00f8('0xb4')](_0x29d8b6);});}}else{_0x29d8b6[_0x00f8('0x67')]+=0x1;_0x423a1a[_0x00f8('0xb4')](_0x29d8b6);if(_0x29d8b6[_0x00f8('0x1f3')]){_0x423a1a[_0x00f8('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x48d50d[_0x00f8('0xd5')],'ListId':_0x48d50d['ListId'],'VoiceQueueId':_0x48d50d['VoiceQueueId']||undefined,'CampaignId':_0x48d50d['CampaignId']||undefined})[_0x00f8('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x423a1a['createHistory'](createObjHistory(_0x29d8b6,_0x48d50d,_0x00f8('0x1f4'),0x17,_0x00f8('0x1f5')))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0x1f6')));}else{_0x423a1a['saveInDb'](createObjHistory(_0x29d8b6,_0x48d50d,'RECALLFAILEDTIMEOUT',0x16,_0x00f8('0x1f7')),_0x00f8('0x1f8'),_0x00f8('0x1f9'));}}}}else{_0x29d8b6['outboundBlacklistCallsDay']+=0x1;_0x423a1a[_0x00f8('0xd4')](createObjHistory(_0x29d8b6,_0x48d50d,_0x00f8('0x1fa'),0xd,'Blacklist'),_0x00f8('0x1fb'),'[Originate][MoveBlacklist]');throw _0x00f8('0x1fc');}};};Dialer[_0x00f8('0x1a')][_0x00f8('0x15e')]=function(_0x5f02b6){var _0x57da7a=this;var _0x533087=_0x5f02b6[_0x00f8('0x1fd')]-_0x5f02b6[_0x00f8('0x98')]-_0x5f02b6[_0x00f8('0xc7')];emitCampaignSummary(_0x5f02b6);if(_0x533087>0x0){if(_0x533087>this['maxNumberOriginate']){_0x533087=this[_0x00f8('0x22')];}_0x5f02b6[_0x00f8('0xc7')]+=_0x533087;this['getContactDialerIvr'](_0x5f02b6['id'],_0x533087,_0x5f02b6[_0x00f8('0x1fe')],_0x5f02b6)[_0x00f8('0x3f')](function(_0x5f20e2){_0x5f02b6['temp']-=_0x533087;_0x5f02b6['temp']=_0x5f02b6[_0x00f8('0xc7')]>0x0?_0x5f02b6[_0x00f8('0xc7')]:0x0;if(!checkContactEmpty(_0x5f20e2)){_0x5f02b6['message']=_0x00f8('0x9e');logger[_0x00f8('0x7d')](_0x00f8('0x1ff')+_0x5f02b6['name']);}else{_0x5f02b6['originated']+=_0x5f20e2[_0x00f8('0x97')];_0x5f02b6[_0x00f8('0x41')]=_0x00f8('0x200');for(var _0x3ae7b4=0x0;_0x3ae7b4<_0x5f20e2[_0x00f8('0x97')];_0x3ae7b4+=0x1){_0x5f02b6[_0x00f8('0x201')]+=0x1;if(_[_0x00f8('0xe1')](_0x5f20e2[_0x3ae7b4])||_['isNil'](_0x5f20e2[_0x3ae7b4][_0x00f8('0x18b')])||_[_0x00f8('0xe1')](_0x5f20e2[_0x3ae7b4]['phone'])){_0x57da7a[_0x00f8('0x202')]('[actionOriginate]\x20',_0x5f02b6,_0x5f20e2[_0x3ae7b4]);}else{_0x57da7a['checkIsBlackListIvr'](_[_0x00f8('0x12e')](_0x5f20e2[_0x3ae7b4],['CampaignId',_0x00f8('0x203')]))[_0x00f8('0x3f')](_0x57da7a[_0x00f8('0x1ea')](_0x5f02b6,_0x5f20e2[_0x3ae7b4]))['catch'](_0x57da7a['loggerHandler'](_0x00f8('0x204'),_0x5f02b6));}}}})[_0x00f8('0xb2')](loggerGetContactDialer(_0x00f8('0x205'),_0x5f02b6,_0x533087));}};Dialer[_0x00f8('0x1a')]['handlePower']=function(_0x2f6f19,_0x4dbb15){var _0x437a0b=this;var _0x27095a=[];var _0x5c05f5=_0x4dbb15>=0x1?_0x4dbb15:0x1;if(_0x2f6f19[_0x00f8('0x59')]===_0x00f8('0x8')){_0x5c05f5=0x1;}var _0xa457bc=Math[_0x00f8('0x1cd')](_0x2f6f19[_0x00f8('0x50')]*_0x5c05f5)-_0x2f6f19['originated']-_0x2f6f19[_0x00f8('0xc7')];emitVoiceQueueSummary(_0x2f6f19);if(_0x2f6f19[_0x00f8('0x206')]>0x0){var _0x37a822=_0x2f6f19[_0x00f8('0x206')]-_0x2f6f19[_0x00f8('0x98')]-_0x2f6f19[_0x00f8('0xa1')]-_0x2f6f19[_0x00f8('0xc7')]-_0x2f6f19['pTalking'];if(_0xa457bc>_0x37a822){_0xa457bc=_0x37a822;}}if(_0xa457bc>0x0){if(_0x2f6f19[_0x00f8('0x59')]===_0x00f8('0x8')){_0xa457bc=0x1;}if(_0xa457bc>this[_0x00f8('0x22')]){_0xa457bc=this[_0x00f8('0x22')];}_0x2f6f19['temp']+=_0xa457bc;for(var _0x531000 in this[_0x00f8('0x20')]){if(typeof this[_0x00f8('0x20')][_0x531000]!==_0x00f8('0xd0')){if(this[_0x00f8('0x20')][_0x531000]['state']===_0x00f8('0x207')&&this[_0x00f8('0x20')][_0x531000][_0x00f8('0xde')]===_0x00f8('0x208')){_0x27095a[_0x00f8('0x12d')](this['agents'][_0x531000]['id']);}}}this[_0x00f8('0xc6')](_0x2f6f19['id'],_0x27095a,_0xa457bc,_0x2f6f19[_0x00f8('0x1fe')],_0x2f6f19)[_0x00f8('0x3f')](function(_0x30c988){_0x2f6f19[_0x00f8('0xc7')]-=_0xa457bc;_0x2f6f19[_0x00f8('0xc7')]=_0x2f6f19[_0x00f8('0xc7')]>0x0?_0x2f6f19[_0x00f8('0xc7')]:0x0;if(!checkContactEmpty(_0x30c988)){_0x437a0b[_0x00f8('0xb7')](_0x2f6f19)[_0x00f8('0x3f')](sendMessageReschedule(_0x2f6f19))[_0x00f8('0xb2')](loggerCatch(_0x00f8('0xb9')));}else{_0x2f6f19['originated']+=_0x30c988['length'];_0x2f6f19[_0x00f8('0x41')]=_0x2f6f19[_0x00f8('0x59')]===_0x00f8('0x8')?_0x00f8('0x176'):_0x00f8('0x200');for(var _0x4f512c=0x0;_0x4f512c<_0x30c988[_0x00f8('0x97')];_0x4f512c+=0x1){if(_[_0x00f8('0xe1')](_0x30c988[_0x4f512c])||_[_0x00f8('0xe1')](_0x30c988[_0x4f512c]['Contact'])||_[_0x00f8('0xe1')](_0x30c988[_0x4f512c]['phone'])){_0x437a0b[_0x00f8('0x202')](_0x00f8('0x209'),_0x2f6f19,_0x30c988[_0x4f512c]);}else{_0x437a0b[_0x00f8('0xba')](_[_0x00f8('0x12e')](_0x30c988[_0x4f512c],['VoiceQueueId','Contact.phone']))[_0x00f8('0x3f')](_0x437a0b[_0x00f8('0x1ea')](_0x2f6f19,_0x30c988[_0x4f512c]))['catch'](_0x437a0b[_0x00f8('0xd3')](_0x00f8('0x209'),_0x2f6f19));}}}})[_0x00f8('0xb2')](loggerGetContactDialer('[getContactDialer2]',_0x2f6f19,_0xa457bc));}};Dialer['prototype'][_0x00f8('0x90')]=function(_0x53e28f){if(_0x53e28f[_0x00f8('0x206')]>0x0){var _0xb67337=_0x53e28f[_0x00f8('0x206')]-_0x53e28f[_0x00f8('0x98')]-_0x53e28f[_0x00f8('0xa1')];if(_0xb67337>0x0){this[_0x00f8('0x20a')](_0x53e28f);}else{loggerPredictiveCalls[_0x00f8('0x7d')]('[handlePredictive][limitChannel]');}}else{this[_0x00f8('0x20a')](_0x53e28f);}};Dialer[_0x00f8('0x1a')][_0x00f8('0x20a')]=function(_0x372272){var _0x30f064=this;var _0x5240d1=[];_0x372272[_0x00f8('0x98')]+=0x1;for(var _0x26a3fc in this[_0x00f8('0x20')]){if(typeof this[_0x00f8('0x20')][_0x26a3fc]!=='undefined'){if(this[_0x00f8('0x20')][_0x26a3fc][_0x00f8('0xa8')]===_0x00f8('0x207')&&this[_0x00f8('0x20')][_0x26a3fc][_0x00f8('0xde')]==='reachable'){_0x5240d1[_0x00f8('0x12d')](this['agents'][_0x26a3fc]['id']);}}}this[_0x00f8('0xc6')](_0x372272['id'],_0x5240d1,0x1,_0x372272[_0x00f8('0x1fe')],_0x372272)['then'](function(_0x25728a){if(!checkContactEmpty(_0x25728a)){checkContactLowerLimitOriginate(_0x372272,0x1,0x0);_0x30f064[_0x00f8('0xb7')](_0x372272)[_0x00f8('0x3f')](sendMessageReschedule(_0x372272))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x372272['message']='RUNNING';if(_[_0x00f8('0xe1')](_0x25728a[0x0])||_[_0x00f8('0xe1')](_0x25728a[0x0]['Contact'])||_[_0x00f8('0xe1')](_0x25728a[0x0][_0x00f8('0x16f')])){_0x30f064[_0x00f8('0x202')](_0x00f8('0x209'),_0x372272,_0x25728a[0x0]);}else{_0x30f064['checkIsBlackList'](_[_0x00f8('0x12e')](_0x25728a[0x0],[_0x00f8('0xd8'),_0x00f8('0x203')]))[_0x00f8('0x3f')](_0x30f064[_0x00f8('0x1ea')](_0x372272,_0x25728a[0x0]))['catch'](_0x30f064[_0x00f8('0xd3')](_0x00f8('0x20b'),_0x372272));}}})[_0x00f8('0xb2')](loggerGetContactDialer(_0x00f8('0x20c'),_0x372272,0x1));emitVoiceQueueSummary(_0x372272);};Dialer[_0x00f8('0x1a')][_0x00f8('0x1e0')]=function(_0x29a8a4,_0x50be43,_0x209623,_0x413ef8,_0x21dbe4,_0x36e350){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x00f8('0x20d'),_0x29a8a4);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x20e'),_0x50be43);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x20f'),_0x209623);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x210'),_0x413ef8);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x211'),_0x21dbe4);loggerPredictive['info'](_0x00f8('0x8b'));return new BPromise(function(_0x2d570a,_0x5442d0){if(_0x29a8a4<=0x0||isNaN(_0x29a8a4)){return _0x5442d0(msgResponse(_0x00f8('0x212'),'Error',_0x00f8('0x213')+_0x29a8a4));}if(_0x209623<=0x0||isNaN(_0x209623)){return _0x5442d0(msgResponse(_0x00f8('0x212'),_0x00f8('0x4a'),_0x00f8('0x214')+_0x209623));}if(_0x413ef8<=0x0||isNaN(_0x413ef8)){return _0x5442d0(msgResponse(_0x00f8('0x212'),'Error',_0x00f8('0x215')+_0x413ef8));}if(_0x50be43<=0x0||isNaN(_0x50be43)){return _0x5442d0(msgResponse(_0x00f8('0x212'),_0x00f8('0x4a'),_0x00f8('0x216')+_0x50be43));}if(_0x21dbe4<=0x0||isNaN(_0x21dbe4)){return _0x5442d0(msgResponse(_0x00f8('0x212'),_0x00f8('0x4a'),_0x00f8('0x217')+_0x21dbe4));}_0x36e350=_0x36e350||0x0;var _0xa67939=0x1/_0x209623;var _0x49b34d=0x0;var _0x5ee124=0x0;var _0x241a14=0x0;var _0x5c9760=0x0;for(var _0x5b3e0e=0x0;_0x241a14<_0x21dbe4;_0x5b3e0e+=0x1){_0x5ee124=_0x5b3e0e/_0x50be43;_0x49b34d=(_0x413ef8*_0x5ee124+_0x36e350)/_0xa67939;_0x241a14=erlangb(_0x49b34d,_0x29a8a4);_0x5c9760=_0x49b34d/_0x29a8a4*(0x1-erlangb(_0x49b34d,_0x29a8a4));}return _0x2d570a({'erlangCalls':_0x5b3e0e,'erlangCallToSecond':_0x50be43/_0x5b3e0e,'erlangAbandonmentRate':_0x241a14,'erlangBusyFactor':_0x5c9760});});};Dialer[_0x00f8('0x1a')][_0x00f8('0x1e2')]=function(_0x3c04a7,_0x131b19,_0x110a59,_0x1686ca,_0x2be5bf,_0x16df9b){loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x218'));loggerPredictive[_0x00f8('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',_0x3c04a7);loggerPredictive['info'](_0x00f8('0x20e'),_0x131b19);loggerPredictive[_0x00f8('0x7d')](_0x00f8('0x20f'),_0x110a59);loggerPredictive['info'](_0x00f8('0x210'),_0x1686ca);loggerPredictive['info'](_0x00f8('0x219'),_0x2be5bf);loggerPredictive['info'](_0x00f8('0x8b'));return new BPromise(function(_0x312894,_0x3972f7){if(_0x3c04a7<=0x0||isNaN(_0x3c04a7)){return _0x3972f7(msgResponse(_0x00f8('0x21a'),_0x00f8('0x4a'),_0x00f8('0x213')+_0x3c04a7));}if(_0x110a59<=0x0||isNaN(_0x110a59)){return _0x3972f7(msgResponse(_0x00f8('0x21a'),_0x00f8('0x4a'),'Ts\x20=\x20'+_0x110a59));}if(_0x1686ca<=0x0||isNaN(_0x1686ca)){return _0x3972f7(msgResponse(_0x00f8('0x21a'),_0x00f8('0x4a'),_0x00f8('0x215')+_0x1686ca));}if(_0x131b19<=0x0||isNaN(_0x131b19)){return _0x3972f7(msgResponse(_0x00f8('0x21a'),_0x00f8('0x4a'),'interval\x20=\x20'+_0x131b19));}if(_0x2be5bf<=0x0||isNaN(_0x2be5bf)){return _0x3972f7(msgResponse(_0x00f8('0x21a'),'Error',_0x00f8('0x21b')+_0x2be5bf));}_0x16df9b=_0x16df9b||0x0;var _0x5c8920=0x1/_0x110a59;var _0x36e9e3=0x0;var _0x1f54fb=0x0;var _0x108886=0x0;var _0x5ad563=0x0;for(var _0x256452=0x0;_0x5ad563<_0x2be5bf;_0x256452+=0x1){_0x1f54fb=_0x256452/_0x131b19;_0x36e9e3=(_0x1686ca*_0x1f54fb+_0x16df9b)/_0x5c8920;_0x108886=erlangb(_0x36e9e3,_0x3c04a7);_0x5ad563=_0x36e9e3/_0x3c04a7*(0x1-erlangb(_0x36e9e3,_0x3c04a7));}return _0x312894({'erlangCalls':_0x256452,'erlangCallToSecond':_0x131b19/_0x256452,'erlangAbandonmentRate':_0x108886,'erlangBusyFactor':_0x5ad563});});};module[_0x00f8('0x21c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 3edb9fc..f8a0d50 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 _0xe0ae=['membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','seconds','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','holdtime','talktime','queue'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xe0ae,0xa1));var _0xee0a=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xe0ae[_0x10d670];return _0x20d6f8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xee0a('0x0'));function getSeconds(_0x401526,_0x49a5e2){var _0x42f3f6=moment(_0x401526)['milliseconds'](0x0);var _0x32cc3e=moment(_0x49a5e2)[_0xee0a('0x1')](0x0);return _0x42f3f6['diff'](_0x32cc3e,_0xee0a('0x2'));}function QueueCallerAbandon(_0x4d393b,_0x5bef07){this[_0xee0a('0x3')]=_0x4d393b[_0xee0a('0x3')];this[_0xee0a('0x4')]=_0x4d393b[_0xee0a('0x4')];this['campaigntype']=_0x4d393b[_0xee0a('0x4')]==='outbound'?'queue':_0x4d393b[_0xee0a('0x4')];this[_0xee0a('0x5')]=_0x4d393b[_0xee0a('0x5')];this['countcongestionretry']=_0x4d393b[_0xee0a('0x6')];this[_0xee0a('0x7')]=_0x4d393b['countnoanswerretry'];this[_0xee0a('0x8')]=_0x4d393b['countbusyretry']+_0x4d393b[_0xee0a('0x6')]+_0x4d393b[_0xee0a('0x7')]+_0x4d393b['countnosuchnumberretry']+_0x4d393b[_0xee0a('0x9')]+_0x4d393b['countabandonedretry']+_0x4d393b[_0xee0a('0xa')]+_0x4d393b[_0xee0a('0xb')];this['countnosuchnumberretry']=_0x4d393b['countnosuchnumberretry'];this[_0xee0a('0x9')]=_0x4d393b[_0xee0a('0x9')];this[_0xee0a('0xc')]=_0x4d393b[_0xee0a('0xc')];this[_0xee0a('0xa')]=_0x4d393b['countmachineretry'];this[_0xee0a('0xb')]=_0x4d393b[_0xee0a('0xb')];this['uniqueid']=_0x5bef07[_0xee0a('0xd')];this[_0xee0a('0xe')]=_0x4d393b[_0xee0a('0xf')];this[_0xee0a('0x10')]=_0x4d393b['number'];this[_0xee0a('0x11')]=_0x4d393b[_0xee0a('0x11')];this[_0xee0a('0x12')]=_0x4d393b['responsetime'];this[_0xee0a('0x13')]=_0x4d393b[_0xee0a('0x13')];this[_0xee0a('0x14')]=this[_0xee0a('0x13')];this['ringtime']=getSeconds(_0x4d393b[_0xee0a('0x12')],_0x4d393b[_0xee0a('0x11')]);this[_0xee0a('0x15')]=getSeconds(this[_0xee0a('0x13')],_0x4d393b['responsetime']);this[_0xee0a('0x16')]=0x0;this[_0xee0a('0x17')]=_0x5bef07[_0xee0a('0x17')];this[_0xee0a('0x18')]=_0x5bef07[_0xee0a('0x19')];this[_0xee0a('0x1a')]=_0x5bef07[_0xee0a('0x1a')];this['callback']=_0x4d393b[_0xee0a('0x1b')];this[_0xee0a('0x1c')]=_0x4d393b[_0xee0a('0x1c')];this[_0xee0a('0x1d')]=_0x4d393b['callbackat'];this[_0xee0a('0x1e')]=_0x4d393b[_0xee0a('0x1e')];this[_0xee0a('0x1f')]=_0x4d393b[_0xee0a('0x1f')];this['ListId']=_0x4d393b['ListId'];this['UserId']=_0x4d393b[_0xee0a('0x20')];this['VoiceQueueId']=_0x4d393b['VoiceQueueId'];this[_0xee0a('0x21')]=_0x4d393b[_0xee0a('0x21')];this[_0xee0a('0x22')]=_0x4d393b['originatecalleridnum']||'';this[_0xee0a('0x23')]=_0x4d393b[_0xee0a('0x23')]||'';}module[_0xee0a('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0xa0ec=['originatecalleridname','exports','util','lodash','moment','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x8cfae,_0x13676b){var _0x3e8204=function(_0x4b5d40){while(--_0x4b5d40){_0x8cfae['push'](_0x8cfae['shift']());}};_0x3e8204(++_0x13676b);}(_0xa0ec,0xde));var _0xca0e=function(_0x8f67a9,_0x3cdb40){_0x8f67a9=_0x8f67a9-0x0;var _0x2a86bb=_0xa0ec[_0x8f67a9];return _0x2a86bb;};'use strict';var util=require(_0xca0e('0x0'));var _=require(_0xca0e('0x1'));var moment=require(_0xca0e('0x2'));function getSeconds(_0x4fb6a9,_0x5546da){var _0x23b217=moment(_0x4fb6a9)['milliseconds'](0x0);var _0x357aa3=moment(_0x5546da)['milliseconds'](0x0);return _0x23b217[_0xca0e('0x3')](_0x357aa3,_0xca0e('0x4'));}function QueueCallerAbandon(_0x5ccaa7,_0x2652e5){this[_0xca0e('0x5')]=_0x5ccaa7[_0xca0e('0x5')];this[_0xca0e('0x6')]=_0x5ccaa7[_0xca0e('0x6')];this[_0xca0e('0x7')]=_0x5ccaa7[_0xca0e('0x6')]===_0xca0e('0x8')?'queue':_0x5ccaa7[_0xca0e('0x6')];this[_0xca0e('0x9')]=_0x5ccaa7[_0xca0e('0x9')];this['countcongestionretry']=_0x5ccaa7['countcongestionretry'];this[_0xca0e('0xa')]=_0x5ccaa7[_0xca0e('0xa')];this[_0xca0e('0xb')]=_0x5ccaa7[_0xca0e('0x9')]+_0x5ccaa7[_0xca0e('0xc')]+_0x5ccaa7[_0xca0e('0xa')]+_0x5ccaa7[_0xca0e('0xd')]+_0x5ccaa7[_0xca0e('0xe')]+_0x5ccaa7[_0xca0e('0xf')]+_0x5ccaa7[_0xca0e('0x10')]+_0x5ccaa7[_0xca0e('0x11')];this[_0xca0e('0xd')]=_0x5ccaa7[_0xca0e('0xd')];this[_0xca0e('0xe')]=_0x5ccaa7[_0xca0e('0xe')];this['countabandonedretry']=_0x5ccaa7[_0xca0e('0xf')];this[_0xca0e('0x10')]=_0x5ccaa7[_0xca0e('0x10')];this[_0xca0e('0x11')]=_0x5ccaa7['countagentrejectretry'];this[_0xca0e('0x12')]=_0x2652e5[_0xca0e('0x12')];this['calleridname']=_0x5ccaa7[_0xca0e('0x13')];this[_0xca0e('0x14')]=_0x5ccaa7[_0xca0e('0x15')];this['starttime']=_0x5ccaa7[_0xca0e('0x16')];this['responsetime']=_0x5ccaa7['responsetime'];this[_0xca0e('0x17')]=_0x5ccaa7[_0xca0e('0x17')];this[_0xca0e('0x18')]=this['droptime'];this[_0xca0e('0x19')]=getSeconds(_0x5ccaa7[_0xca0e('0x1a')],_0x5ccaa7[_0xca0e('0x16')]);this[_0xca0e('0x1b')]=getSeconds(this['droptime'],_0x5ccaa7[_0xca0e('0x1a')]);this[_0xca0e('0x1c')]=0x0;this[_0xca0e('0x1d')]=_0x2652e5[_0xca0e('0x1d')];this[_0xca0e('0x1e')]=_0x2652e5[_0xca0e('0x1f')];this['reason']=_0x2652e5[_0xca0e('0x20')];this[_0xca0e('0x21')]=_0x5ccaa7[_0xca0e('0x21')];this['callbackuniqueid']=_0x5ccaa7['callbackuniqueid'];this[_0xca0e('0x22')]=_0x5ccaa7['callbackat'];this['recallme']=_0x5ccaa7[_0xca0e('0x23')];this['ContactId']=_0x5ccaa7[_0xca0e('0x24')];this[_0xca0e('0x25')]=_0x5ccaa7[_0xca0e('0x25')];this['UserId']=_0x5ccaa7[_0xca0e('0x26')];this[_0xca0e('0x27')]=_0x5ccaa7[_0xca0e('0x27')];this[_0xca0e('0x28')]=_0x5ccaa7[_0xca0e('0x28')];this[_0xca0e('0x29')]=_0x5ccaa7[_0xca0e('0x29')]||'';this[_0xca0e('0x2a')]=_0x5ccaa7['originatecalleridname']||'';}module[_0xca0e('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e937a67..0f658cd 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(_0x2e7c24,_0x404874){var _0x3a5f86=function(_0xfed114){while(--_0xfed114){_0x2e7c24['push'](_0x2e7c24['shift']());}};_0x3a5f86(++_0x404874);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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(_0x4162fb,_0x4b4005){var _0x489f1a=function(_0x2cebc3){while(--_0x2cebc3){_0x4162fb['push'](_0x4162fb['shift']());}};_0x489f1a(++_0x4b4005);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 d85b1a1..d4c0643 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 _0x3266=['uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','then','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','status','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird'];(function(_0x493043,_0x118b7d){var _0x25ab64=function(_0x404c16){while(--_0x404c16){_0x493043['push'](_0x493043['shift']());}};_0x25ab64(++_0x118b7d);}(_0x3266,0x6a));var _0x6326=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x3266[_0x5cb1af];return _0x8d7940;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var BPromise=require(_0x6326('0x2'));var uuid=require(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var path=require(_0x6326('0x5'));var tiff2pdf=require(_0x6326('0x6'));var gs=require(_0x6326('0x7'));var logger=require(_0x6326('0x8'))('fax');var ami=require(_0x6326('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x6326('0xa'));var ut=require(_0x6326('0xb'));var Action=require(_0x6326('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x6326('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2af571){this[_0x6326('0xe')]={};this[_0x6326('0xf')]=_0x2af571[_0x6326('0xf')];this[_0x6326('0x10')]=_0x2af571['trunks'];this[_0x6326('0x11')]={};ami['on'](_0x6326('0x12'),this[_0x6326('0x13')][_0x6326('0x14')](this));ami['on'](_0x6326('0x15'),this[_0x6326('0x16')][_0x6326('0x14')](this));ami['on'](_0x6326('0x17'),this[_0x6326('0x18')][_0x6326('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0x6326('0x14')](this));ami['on'](_0x6326('0x19'),this['syncFaxStatus'][_0x6326('0x14')](this));ami['on']('receivefax',this[_0x6326('0x1a')][_0x6326('0x14')](this));ami['on'](_0x6326('0x1b'),this[_0x6326('0x1c')][_0x6326('0x14')](this));ami['on'](_0x6326('0x1d'),this['syncOriginateResponse'][_0x6326('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0x55dd9f){if(_0x55dd9f['context']==='from-voip-provider'){for(var _0x58e960 in this[_0x6326('0xf')]){if(this[_0x6326('0xf')][_0x6326('0x1e')](_0x58e960)){if(_0x55dd9f['exten']===this['faxAccounts'][_0x58e960][_0x6326('0x1f')]){this[_0x6326('0xe')][_0x55dd9f[_0x6326('0x20')]]={};this[_0x6326('0xe')][_0x55dd9f[_0x6326('0x20')]][_0x6326('0x21')]=_0x55dd9f[_0x6326('0x21')];this['channels'][_0x55dd9f[_0x6326('0x20')]]['id']=this['faxAccounts'][_0x58e960]['id'];this[_0x6326('0xe')][_0x55dd9f[_0x6326('0x20')]][_0x6326('0x22')]=this[_0x6326('0xf')][_0x58e960][_0x6326('0x22')];logger[_0x6326('0x23')](_0x55dd9f[_0x6326('0x20')],_0x6326('0x24'));}}}}if(this[_0x6326('0x11')][_0x55dd9f[_0x6326('0x20')]]){this[_0x6326('0xe')][_0x55dd9f['uniqueid']]={};this[_0x6326('0xe')][_0x55dd9f[_0x6326('0x20')]]['channel']=_0x55dd9f['channel'];logger['info'](_0x55dd9f[_0x6326('0x20')],'\x20syncNewchannel\x20');}};Fax[_0x6326('0x25')][_0x6326('0x16')]=function(_0x5a907f){if(this[_0x6326('0xe')][_0x5a907f[_0x6326('0x20')]]){for(var _0xb68fec in _0x5a907f[_0x6326('0x26')]){if(_0x5a907f[_0x6326('0x26')][_0x6326('0x1e')](_0xb68fec)){this[_0x6326('0xe')][_0x5a907f[_0x6326('0x20')]][_0xb68fec]=_0x5a907f[_0x6326('0x27')];}}}};Fax[_0x6326('0x25')][_0x6326('0x18')]=function(_0x2a8873){if(this[_0x6326('0xe')][_0x2a8873[_0x6326('0x20')]]){this[_0x6326('0xe')][_0x2a8873[_0x6326('0x20')]]['channelstate']=_0x2a8873[_0x6326('0x28')];this[_0x6326('0xe')][_0x2a8873[_0x6326('0x20')]]['channelstatedesc']=_0x2a8873[_0x6326('0x29')];}};Fax['prototype']['syncNewExten']=function(_0xfb6b62){if(this[_0x6326('0xe')][_0xfb6b62[_0x6326('0x20')]]){for(var _0x103b1c in _0xfb6b62[_0x6326('0x26')]){if(_0xfb6b62[_0x6326('0x26')][_0x6326('0x1e')](_0x103b1c)){this[_0x6326('0xe')][_0xfb6b62[_0x6326('0x20')]][_0x103b1c]=_0xfb6b62[_0x6326('0x27')];}}}};Fax[_0x6326('0x25')][_0x6326('0x2a')]=function(_0x55aa3b){if(this[_0x6326('0xe')][_0x55aa3b[_0x6326('0x20')]]){this['channels'][_0x55aa3b[_0x6326('0x20')]][_0x6326('0x2b')]=_0x55aa3b[_0x6326('0x2b')];this['channels'][_0x55aa3b[_0x6326('0x20')]]['status']=_0x55aa3b['status'];this[_0x6326('0xe')][_0x55aa3b[_0x6326('0x20')]][_0x6326('0x1f')]=_0x55aa3b['localstationid'];this[_0x6326('0xe')][_0x55aa3b['uniqueid']][_0x6326('0x2c')]=_0x55aa3b['filename'];logger[_0x6326('0x23')](_0x55aa3b[_0x6326('0x20')],_0x6326('0x2d'));}};Fax[_0x6326('0x25')][_0x6326('0x1a')]=function(_0x207fb1){var _0x4f6c8a=this;if(this[_0x6326('0xe')][_0x207fb1[_0x6326('0x20')]]){var _0x489f05=this[_0x6326('0xe')][_0x207fb1['uniqueid']]['id'];this['channels'][_0x207fb1[_0x6326('0x20')]][_0x6326('0x2e')]=_0x207fb1[_0x6326('0x2e')];this[_0x6326('0xe')][_0x207fb1[_0x6326('0x20')]][_0x6326('0x2f')]=_0x207fb1['pagestransferred'];this['channels'][_0x207fb1[_0x6326('0x20')]]['localstationid']=_0x207fb1[_0x6326('0x1f')];this['channels'][_0x207fb1[_0x6326('0x20')]][_0x6326('0x30')]=_0x207fb1[_0x6326('0x30')];this[_0x6326('0xe')][_0x207fb1[_0x6326('0x20')]][_0x6326('0x31')]=_0x207fb1[_0x6326('0x31')];this[_0x6326('0xe')][_0x207fb1[_0x6326('0x20')]][_0x6326('0x2c')]=_0x207fb1[_0x6326('0x2c')];this['channels'][_0x207fb1[_0x6326('0x20')]]['calleridnum']=_0x207fb1[_0x6326('0x32')];if(this[_0x6326('0xe')][_0x207fb1[_0x6326('0x20')]][_0x6326('0x2f')]>0x0){tiff2pdf(_0x207fb1['filename'],_0x6326('0x33'),function(_0x255a70){logger['info'](_0x207fb1[_0x6326('0x20')],_0x6326('0x34'),_0x255a70[_0x6326('0x35')]);attachment[_0x6326('0x36')]({'name':path['parse'](_0x207fb1[_0x6326('0x2c')])[_0x6326('0x22')],'basename':path[_0x6326('0x37')](_0x207fb1[_0x6326('0x2c')])[_0x6326('0x22')]+_0x6326('0x38'),'type':_0x6326('0x39')})['then'](function(_0x2f6a90){faxAccount[_0x6326('0x3a')](_0x489f05,{'from':_0x207fb1[_0x6326('0x32')],'mapKey':_0x6326('0x3b'),'body':path['parse'](_0x207fb1[_0x6326('0x2c')])['name']+_0x6326('0x38'),'AttachmentId':_0x2f6a90['id']})[_0x6326('0x3c')](function(_0x119559){logger[_0x6326('0x3d')](_0x207fb1[_0x6326('0x20')],'\x20notify\x20',JSON[_0x6326('0x3e')](_0x119559));});})['catch'](function(_0x5e0e2f){logger[_0x6326('0x3d')](_0x207fb1[_0x6326('0x20')],'\x20receiveFax\x20',JSON[_0x6326('0x3e')](_0x5e0e2f));});});}logger[_0x6326('0x23')](_0x207fb1[_0x6326('0x20')],_0x6326('0x3f'));}};Fax[_0x6326('0x25')]['syncOriginateResponse']=function(_0x4af0ee){if(this[_0x6326('0x11')][_0x4af0ee[_0x6326('0x20')]]){_[_0x6326('0x40')](this[_0x6326('0xe')][_0x4af0ee[_0x6326('0x20')]],_[_0x6326('0x41')](_0x4af0ee,[_0x6326('0x42'),'reason']));}};function updateStatus(_0x1b5f5b){if(_0x1b5f5b[_0x6326('0x43')]){faxMessage[_0x6326('0x44')](_0x1b5f5b[_0x6326('0x43')],{'failMessage':_0x6326('0x45')})['then'](function(_0x189bef){ut['logger'](_0x6326('0x46'),_0x189bef);})[_0x6326('0x3c')](function(_0x585dec){ut[_0x6326('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x585dec);});}else{ut[_0x6326('0x47')](_0x6326('0x48'));}}Fax[_0x6326('0x25')][_0x6326('0x49')]=function(_0x58731d,_0x42c8bc,_0xbe6b3e){var _0x5c3641=this;var _0x39f3b1={};if(_0x42c8bc){_0x39f3b1={'read':_0x42c8bc};}else{_0x39f3b1={'failMessage':_0xbe6b3e};}if(this[_0x6326('0x11')][_0x58731d][_0x6326('0x43')]){faxMessage['update'](this[_0x6326('0x11')][_0x58731d][_0x6326('0x43')],_0x39f3b1)['then'](function(_0x16e606){ut['logger'](_0x6326('0x4a'),_0x16e606);})[_0x6326('0x3c')](function(_0x3e9825){ut[_0x6326('0x47')](_0x6326('0x4b'),_0x3e9825);})[_0x6326('0x4c')](function(){delete _0x5c3641[_0x6326('0xe')][_0x58731d];delete _0x5c3641['actions'][_0x58731d];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x6326('0xe')][_0x58731d];delete this['actions'][_0x58731d];}};Fax[_0x6326('0x25')][_0x6326('0x1c')]=function(_0xcae454){var _0x35c648=this;if(this[_0x6326('0xe')][_0xcae454['uniqueid']]){if(this[_0x6326('0x11')][_0xcae454[_0x6326('0x20')]]){this['channels'][_0xcae454[_0x6326('0x20')]]['id']=this[_0x6326('0x11')][_0xcae454[_0x6326('0x20')]]['id'];this[_0x6326('0xe')][_0xcae454[_0x6326('0x20')]][_0x6326('0x22')]=this[_0x6326('0x11')][_0xcae454[_0x6326('0x20')]][_0x6326('0x22')];}logger[_0x6326('0x23')](_0xcae454['uniqueid'],this[_0x6326('0x11')][_0xcae454[_0x6326('0x20')]]?_0x6326('0x4d'):_0x6326('0x4e'),JSON['stringify'](this['channels'][_0xcae454[_0x6326('0x20')]]));if(this[_0x6326('0x11')][_0xcae454[_0x6326('0x20')]]){if(this[_0x6326('0xe')][_0xcae454[_0x6326('0x20')]]['faxpages']>0x0&&this['channels'][_0xcae454[_0x6326('0x20')]][_0x6326('0x19')]===_0x6326('0x4f')){this[_0x6326('0x49')](_0xcae454['uniqueid'],!![]);}else{this[_0x6326('0x49')](_0xcae454[_0x6326('0x20')],![],this[_0x6326('0xe')][_0xcae454[_0x6326('0x20')]][_0x6326('0x50')]?_0x6326('0x51')+this['channels'][_0xcae454[_0x6326('0x20')]]['faxstatusstring']:_0x6326('0x52'));}}}};Fax[_0x6326('0x25')]['send']=function(_0x14d66c){var _0x56fb58=this;return new BPromise(function(_0x222e39,_0x3b6de7){_0x56fb58[_0x6326('0x53')](_0x14d66c,_0x56fb58[_0x6326('0xf')][_0x14d66c[_0x6326('0x54')]])[_0x6326('0x55')](function(_0xa2928e){ut[_0x6326('0x47')]('[Fax][execOriginate][success]',_0xa2928e);_0x222e39(ut[_0x6326('0x35')](_0x6326('0x56')));})[_0x6326('0x3c')](function(_0x5ade98){ut[_0x6326('0x47')]('[Fax][execOriginate][failure]',_0x5ade98);updateStatus(_0x14d66c);_0x3b6de7(ut[_0x6326('0x35')](_0x6326('0x57')));});});};Fax[_0x6326('0x25')][_0x6326('0x58')]=function(_0x3894cf){var _0x4f0305=this;return new BPromise(function(_0x468e7d,_0x564332){var _0x4ae3a9=_0x4f0305[_0x6326('0x59')](_0x4f0305[_0x6326('0xf')][_0x3894cf[_0x6326('0x54')]][_0x6326('0x5a')],_0x3894cf);if(_0x4ae3a9['isValid']){_0x468e7d(ut['message']('Trunk\x20Reachable'));}else{_0x564332(ut['message'](_0x4ae3a9[_0x6326('0x35')]));}});};function originate(_0x5044ab,_0x303fef,_0x5f6273){return new BPromise(function(_0x54730e,_0x4c1d7e){if(_0x5f6273){var _0x5401cf=util[_0x6326('0x5b')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x6326('0x37')](_0x5044ab['path'])['name'],_0x5044ab['path']);gs['execute'](_0x5401cf)[_0x6326('0x55')](function(){_0x5044ab['path']=util[_0x6326('0x5b')](_0x6326('0x5c'),path['parse'](_0x5044ab[_0x6326('0x5')])['dir'],path[_0x6326('0x37')](_0x5044ab[_0x6326('0x5')])[_0x6326('0x22')]);_0x303fef[_0x6326('0x5d')]=_0x5044ab[_0x6326('0x5')];ut[_0x6326('0x47')](_0x6326('0x5e'),'');ami[_0x6326('0x5f')](ut[_0x6326('0x60')](_0x5044ab,_0x303fef))[_0x6326('0x55')](function(_0x22d139){_0x54730e(_0x22d139);})[_0x6326('0x3c')](function(_0x3bc5f3){_0x4c1d7e(_0x3bc5f3);});})[_0x6326('0x3c')](function(_0x34e30f){_0x4c1d7e(_0x34e30f);});}else{ami[_0x6326('0x5f')](ut[_0x6326('0x60')](_0x5044ab,_0x303fef))['then'](function(_0x5a7e91){_0x54730e(_0x5a7e91);})['catch'](function(_0x4839bf){_0x4c1d7e(_0x4839bf);});}});}Fax[_0x6326('0x25')]['execOriginate']=function(_0x5d9796,_0x571e38){var _0x5a6b0c=this;return new BPromise(function(_0x565706,_0x5a1a9f){var _0xe845d6=uuid['v4']();var _0x5d664c=ut['addVariables'](_0x5d9796,_0x571e38);_0x5a6b0c[_0x6326('0x11')][_0xe845d6]=new Action(_0xe845d6,_0x571e38,_0x5d9796);var _0x2bfc43=_0x5a6b0c[_0x6326('0x11')][_0xe845d6];if(path['parse'](_0x5d9796[_0x6326('0x5')])[_0x6326('0x61')]===_0x6326('0x38')){originate(_0x2bfc43,_0x5d664c,!![])[_0x6326('0x55')](function(_0x3e9477){_0x565706(_0x3e9477);})['catch'](function(_0x3bff09){_0x5a1a9f(_0x3bff09);});}else{originate(_0x2bfc43,_0x5d664c,![])['then'](function(_0x5c2e68){_0x565706(_0x5c2e68);})[_0x6326('0x3c')](function(_0x4fa150){_0x5a1a9f(_0x4fa150);});}});};Fax['prototype']['isTrunkReachable']=function(_0x491f2e){return!_['isNil'](_0x491f2e)&&!_['isNil'](_0x491f2e['name'])&&!_[_0x6326('0x62')](_0x491f2e[_0x6326('0x63')])&&_0x491f2e[_0x6326('0x63')]&&!_[_0x6326('0x62')](this['trunks'][util['format']('SIP/%s',_0x491f2e[_0x6326('0x22')])])&&!_[_0x6326('0x62')](this['trunks'][util[_0x6326('0x5b')]('SIP/%s',_0x491f2e['name'])][_0x6326('0x64')])&&(this[_0x6326('0x10')][util[_0x6326('0x5b')](_0x6326('0x65'),_0x491f2e[_0x6326('0x22')])][_0x6326('0x64')]===_0x6326('0x66')||this['trunks'][util['format']('SIP/%s',_0x491f2e[_0x6326('0x22')])]['status']==='unmonitored');};Fax[_0x6326('0x25')][_0x6326('0x59')]=function(_0x53bbc3,_0x1fa91d){if(!this['isTrunkReachable'](_0x53bbc3)){ut['logger'](_0x6326('0x67'),_[_0x6326('0x62')](_0x53bbc3)?'':_0x53bbc3['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6326('0x68')};}if(_[_0x6326('0x62')](_0x1fa91d[_0x6326('0x3b')])){ut[_0x6326('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1fa91d));return{'isValid':![],'message':_0x6326('0x69')};}if(_[_0x6326('0x62')](_0x1fa91d[_0x6326('0x5')])){ut[_0x6326('0x47')](_0x6326('0x6a'),JSON[_0x6326('0x3e')](_0x1fa91d));return{'isValid':![],'message':_0x6326('0x6b')};}return{'isValid':!![],'message':_0x6326('0x6c')};};module['exports']=Fax; \ No newline at end of file +var _0x4fc2=['[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus'];(function(_0x4d5ea2,_0x50bede){var _0x5deb1c=function(_0x2a0008){while(--_0x2a0008){_0x4d5ea2['push'](_0x4d5ea2['shift']());}};_0x5deb1c(++_0x50bede);}(_0x4fc2,0x111));var _0x24fc=function(_0x3c26ad,_0x3a8a43){_0x3c26ad=_0x3c26ad-0x0;var _0x4e54fb=_0x4fc2[_0x3c26ad];return _0x4e54fb;};'use strict';var util=require(_0x24fc('0x0'));var _=require(_0x24fc('0x1'));var BPromise=require(_0x24fc('0x2'));var uuid=require(_0x24fc('0x3'));var moment=require('moment');var path=require(_0x24fc('0x4'));var tiff2pdf=require(_0x24fc('0x5'));var gs=require(_0x24fc('0x6'));var logger=require('../../../config/logger')(_0x24fc('0x7'));var ami=require(_0x24fc('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x24fc('0x9'));var ut=require(_0x24fc('0xa'));var Action=require('./action');var faxAccount=require(_0x24fc('0xb'));var attachment=require(_0x24fc('0xc'));var faxMessage=require(_0x24fc('0xd'));function Fax(_0x123eff){this[_0x24fc('0xe')]={};this[_0x24fc('0xf')]=_0x123eff['faxAccounts'];this[_0x24fc('0x10')]=_0x123eff[_0x24fc('0x10')];this[_0x24fc('0x11')]={};ami['on'](_0x24fc('0x12'),this[_0x24fc('0x13')][_0x24fc('0x14')](this));ami['on'](_0x24fc('0x15'),this[_0x24fc('0x16')]['bind'](this));ami['on'](_0x24fc('0x17'),this[_0x24fc('0x18')]['bind'](this));ami['on'](_0x24fc('0x19'),this[_0x24fc('0x1a')][_0x24fc('0x14')](this));ami['on'](_0x24fc('0x1b'),this[_0x24fc('0x1c')][_0x24fc('0x14')](this));ami['on']('receivefax',this[_0x24fc('0x1d')][_0x24fc('0x14')](this));ami['on'](_0x24fc('0x1e'),this[_0x24fc('0x1f')]['bind'](this));ami['on'](_0x24fc('0x20'),this['syncOriginateResponse'][_0x24fc('0x14')](this));}Fax[_0x24fc('0x21')][_0x24fc('0x13')]=function(_0x41c593){if(_0x41c593[_0x24fc('0x22')]==='from-voip-provider'){for(var _0x23873c in this[_0x24fc('0xf')]){if(this[_0x24fc('0xf')][_0x24fc('0x23')](_0x23873c)){if(_0x41c593['exten']===this[_0x24fc('0xf')][_0x23873c][_0x24fc('0x24')]){this[_0x24fc('0xe')][_0x41c593['uniqueid']]={};this[_0x24fc('0xe')][_0x41c593[_0x24fc('0x25')]][_0x24fc('0x26')]=_0x41c593[_0x24fc('0x26')];this['channels'][_0x41c593[_0x24fc('0x25')]]['id']=this['faxAccounts'][_0x23873c]['id'];this[_0x24fc('0xe')][_0x41c593['uniqueid']][_0x24fc('0x27')]=this[_0x24fc('0xf')][_0x23873c][_0x24fc('0x27')];logger['info'](_0x41c593[_0x24fc('0x25')],'\x20syncNewchannel\x20');}}}}if(this[_0x24fc('0x11')][_0x41c593[_0x24fc('0x25')]]){this[_0x24fc('0xe')][_0x41c593[_0x24fc('0x25')]]={};this[_0x24fc('0xe')][_0x41c593[_0x24fc('0x25')]][_0x24fc('0x26')]=_0x41c593[_0x24fc('0x26')];logger[_0x24fc('0x28')](_0x41c593[_0x24fc('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x24fc('0x21')][_0x24fc('0x16')]=function(_0x3ee302){if(this['channels'][_0x3ee302[_0x24fc('0x25')]]){for(var _0x3d1ec8 in _0x3ee302[_0x24fc('0x29')]){if(_0x3ee302[_0x24fc('0x29')][_0x24fc('0x23')](_0x3d1ec8)){this[_0x24fc('0xe')][_0x3ee302['uniqueid']][_0x3d1ec8]=_0x3ee302[_0x24fc('0x2a')];}}}};Fax[_0x24fc('0x21')][_0x24fc('0x18')]=function(_0x1c5146){if(this[_0x24fc('0xe')][_0x1c5146['uniqueid']]){this['channels'][_0x1c5146['uniqueid']][_0x24fc('0x2b')]=_0x1c5146['channelstate'];this[_0x24fc('0xe')][_0x1c5146[_0x24fc('0x25')]][_0x24fc('0x2c')]=_0x1c5146[_0x24fc('0x2c')];}};Fax['prototype'][_0x24fc('0x1a')]=function(_0x33f368){if(this['channels'][_0x33f368[_0x24fc('0x25')]]){for(var _0x1b174d in _0x33f368['variable']){if(_0x33f368['variable'][_0x24fc('0x23')](_0x1b174d)){this['channels'][_0x33f368[_0x24fc('0x25')]][_0x1b174d]=_0x33f368[_0x24fc('0x2a')];}}}};Fax['prototype'][_0x24fc('0x1c')]=function(_0x33bbf2){if(this[_0x24fc('0xe')][_0x33bbf2[_0x24fc('0x25')]]){this[_0x24fc('0xe')][_0x33bbf2[_0x24fc('0x25')]][_0x24fc('0x2d')]=_0x33bbf2[_0x24fc('0x2d')];this[_0x24fc('0xe')][_0x33bbf2['uniqueid']][_0x24fc('0x2e')]=_0x33bbf2[_0x24fc('0x2e')];this[_0x24fc('0xe')][_0x33bbf2[_0x24fc('0x25')]][_0x24fc('0x24')]=_0x33bbf2['localstationid'];this['channels'][_0x33bbf2[_0x24fc('0x25')]]['filename']=_0x33bbf2[_0x24fc('0x2f')];logger[_0x24fc('0x28')](_0x33bbf2[_0x24fc('0x25')],_0x24fc('0x30'));}};Fax['prototype'][_0x24fc('0x1d')]=function(_0x4f4ec8){var _0x65771d=this;if(this[_0x24fc('0xe')][_0x4f4ec8[_0x24fc('0x25')]]){var _0x2485d8=this[_0x24fc('0xe')][_0x4f4ec8['uniqueid']]['id'];this[_0x24fc('0xe')][_0x4f4ec8[_0x24fc('0x25')]][_0x24fc('0x31')]=_0x4f4ec8[_0x24fc('0x31')];this['channels'][_0x4f4ec8[_0x24fc('0x25')]][_0x24fc('0x32')]=_0x4f4ec8['pagestransferred'];this[_0x24fc('0xe')][_0x4f4ec8['uniqueid']][_0x24fc('0x24')]=_0x4f4ec8[_0x24fc('0x24')];this[_0x24fc('0xe')][_0x4f4ec8[_0x24fc('0x25')]][_0x24fc('0x33')]=_0x4f4ec8[_0x24fc('0x33')];this[_0x24fc('0xe')][_0x4f4ec8[_0x24fc('0x25')]]['transferrate']=_0x4f4ec8[_0x24fc('0x34')];this[_0x24fc('0xe')][_0x4f4ec8[_0x24fc('0x25')]]['filename']=_0x4f4ec8[_0x24fc('0x2f')];this[_0x24fc('0xe')][_0x4f4ec8['uniqueid']][_0x24fc('0x35')]=_0x4f4ec8[_0x24fc('0x35')];if(this[_0x24fc('0xe')][_0x4f4ec8['uniqueid']][_0x24fc('0x32')]>0x0){tiff2pdf(_0x4f4ec8[_0x24fc('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x35ccef){logger[_0x24fc('0x28')](_0x4f4ec8[_0x24fc('0x25')],_0x24fc('0x36'),_0x35ccef['message']);attachment[_0x24fc('0x37')]({'name':path[_0x24fc('0x38')](_0x4f4ec8[_0x24fc('0x2f')])[_0x24fc('0x27')],'basename':path[_0x24fc('0x38')](_0x4f4ec8['filename'])[_0x24fc('0x27')]+_0x24fc('0x39'),'type':_0x24fc('0x3a')})[_0x24fc('0x3b')](function(_0x5c0798){faxAccount[_0x24fc('0x3c')](_0x2485d8,{'from':_0x4f4ec8[_0x24fc('0x35')],'mapKey':'fax','body':path['parse'](_0x4f4ec8[_0x24fc('0x2f')])['name']+'.pdf','AttachmentId':_0x5c0798['id']})[_0x24fc('0x3d')](function(_0x5879c2){logger[_0x24fc('0x3e')](_0x4f4ec8[_0x24fc('0x25')],_0x24fc('0x3f'),JSON['stringify'](_0x5879c2));});})[_0x24fc('0x3d')](function(_0x23c1d4){logger[_0x24fc('0x3e')](_0x4f4ec8[_0x24fc('0x25')],_0x24fc('0x40'),JSON[_0x24fc('0x41')](_0x23c1d4));});});}logger[_0x24fc('0x28')](_0x4f4ec8[_0x24fc('0x25')],'\x20receiveFax\x20');}};Fax['prototype'][_0x24fc('0x42')]=function(_0x2f1a99){if(this[_0x24fc('0x11')][_0x2f1a99['uniqueid']]){_['merge'](this[_0x24fc('0xe')][_0x2f1a99[_0x24fc('0x25')]],_[_0x24fc('0x43')](_0x2f1a99,[_0x24fc('0x44'),_0x24fc('0x45')]));}};function updateStatus(_0x42e22a){if(_0x42e22a[_0x24fc('0x46')]){faxMessage[_0x24fc('0x47')](_0x42e22a[_0x24fc('0x46')],{'failMessage':_0x24fc('0x48')})[_0x24fc('0x3b')](function(_0x676f02){ut['logger'](_0x24fc('0x49'),_0x676f02);})[_0x24fc('0x3d')](function(_0x32a466){ut[_0x24fc('0x4a')](_0x24fc('0x4b'),_0x32a466);});}else{ut['logger'](_0x24fc('0x4c'));}}Fax['prototype'][_0x24fc('0x4d')]=function(_0x2ee445,_0x446c14,_0x41ddfb){var _0x40f42b=this;var _0x3dd8e0={};if(_0x446c14){_0x3dd8e0={'read':_0x446c14};}else{_0x3dd8e0={'failMessage':_0x41ddfb};}if(this['actions'][_0x2ee445][_0x24fc('0x46')]){faxMessage[_0x24fc('0x47')](this[_0x24fc('0x11')][_0x2ee445][_0x24fc('0x46')],_0x3dd8e0)[_0x24fc('0x3b')](function(_0x870767){ut['logger'](_0x24fc('0x4e'),_0x870767);})[_0x24fc('0x3d')](function(_0x1628b4){ut[_0x24fc('0x4a')](_0x24fc('0x4f'),_0x1628b4);})[_0x24fc('0x50')](function(){delete _0x40f42b[_0x24fc('0xe')][_0x2ee445];delete _0x40f42b['actions'][_0x2ee445];});}else{ut[_0x24fc('0x4a')](_0x24fc('0x51'));delete this['channels'][_0x2ee445];delete this[_0x24fc('0x11')][_0x2ee445];}};Fax[_0x24fc('0x21')][_0x24fc('0x1f')]=function(_0x2ba959){var _0x36e159=this;if(this[_0x24fc('0xe')][_0x2ba959['uniqueid']]){if(this[_0x24fc('0x11')][_0x2ba959['uniqueid']]){this[_0x24fc('0xe')][_0x2ba959[_0x24fc('0x25')]]['id']=this['actions'][_0x2ba959[_0x24fc('0x25')]]['id'];this['channels'][_0x2ba959[_0x24fc('0x25')]]['name']=this[_0x24fc('0x11')][_0x2ba959[_0x24fc('0x25')]]['name'];}logger[_0x24fc('0x28')](_0x2ba959['uniqueid'],this[_0x24fc('0x11')][_0x2ba959[_0x24fc('0x25')]]?'\x20hangup\x20sendFile\x20':_0x24fc('0x52'),JSON[_0x24fc('0x41')](this[_0x24fc('0xe')][_0x2ba959[_0x24fc('0x25')]]));if(this[_0x24fc('0x11')][_0x2ba959['uniqueid']]){if(this[_0x24fc('0xe')][_0x2ba959[_0x24fc('0x25')]][_0x24fc('0x53')]>0x0&&this[_0x24fc('0xe')][_0x2ba959[_0x24fc('0x25')]]['faxstatus']==='SUCCESS'){this[_0x24fc('0x4d')](_0x2ba959[_0x24fc('0x25')],!![]);}else{this['updateStatus'](_0x2ba959['uniqueid'],![],this[_0x24fc('0xe')][_0x2ba959[_0x24fc('0x25')]][_0x24fc('0x54')]?_0x24fc('0x55')+this['channels'][_0x2ba959[_0x24fc('0x25')]][_0x24fc('0x54')]:_0x24fc('0x56'));}}}};Fax[_0x24fc('0x21')][_0x24fc('0x57')]=function(_0x3e896f){var _0x26ac2e=this;return new BPromise(function(_0xa80507,_0xbe136e){_0x26ac2e[_0x24fc('0x58')](_0x3e896f,_0x26ac2e[_0x24fc('0xf')][_0x3e896f[_0x24fc('0x59')]])[_0x24fc('0x3b')](function(_0x24ca4b){ut[_0x24fc('0x4a')]('[Fax][execOriginate][success]',_0x24ca4b);_0xa80507(ut[_0x24fc('0x5a')](_0x24fc('0x5b')));})[_0x24fc('0x3d')](function(_0x223ca7){ut[_0x24fc('0x4a')](_0x24fc('0x5c'),_0x223ca7);updateStatus(_0x3e896f);_0xbe136e(ut[_0x24fc('0x5a')](_0x24fc('0x5d')));});});};Fax['prototype'][_0x24fc('0x5e')]=function(_0x290ccf){var _0x14adcb=this;return new BPromise(function(_0xba111d,_0x55fceb){var _0x97ae3=_0x14adcb[_0x24fc('0x5f')](_0x14adcb['faxAccounts'][_0x290ccf['FaxAccountId']]['Trunk'],_0x290ccf);if(_0x97ae3[_0x24fc('0x60')]){_0xba111d(ut[_0x24fc('0x5a')](_0x24fc('0x61')));}else{_0x55fceb(ut[_0x24fc('0x5a')](_0x97ae3[_0x24fc('0x5a')]));}});};function originate(_0x1d0f06,_0x52e1aa,_0x11bafd){return new BPromise(function(_0x15e8a3,_0x5a2c09){if(_0x11bafd){var _0x51b1c0=util[_0x24fc('0x62')](_0x24fc('0x63'),path[_0x24fc('0x38')](_0x1d0f06['path'])[_0x24fc('0x27')],_0x1d0f06[_0x24fc('0x4')]);gs[_0x24fc('0x64')](_0x51b1c0)['then'](function(){_0x1d0f06['path']=util['format']('%s/%s.tif',path['parse'](_0x1d0f06[_0x24fc('0x4')])[_0x24fc('0x65')],path[_0x24fc('0x38')](_0x1d0f06[_0x24fc('0x4')])['name']);_0x52e1aa[_0x24fc('0x66')]=_0x1d0f06['path'];ut[_0x24fc('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0x24fc('0x67')](ut[_0x24fc('0x68')](_0x1d0f06,_0x52e1aa))[_0x24fc('0x3b')](function(_0x4291bd){_0x15e8a3(_0x4291bd);})[_0x24fc('0x3d')](function(_0x291d60){_0x5a2c09(_0x291d60);});})[_0x24fc('0x3d')](function(_0x591ec6){_0x5a2c09(_0x591ec6);});}else{ami[_0x24fc('0x67')](ut[_0x24fc('0x68')](_0x1d0f06,_0x52e1aa))[_0x24fc('0x3b')](function(_0x595da4){_0x15e8a3(_0x595da4);})['catch'](function(_0x13d4ba){_0x5a2c09(_0x13d4ba);});}});}Fax[_0x24fc('0x21')]['execOriginate']=function(_0x42b972,_0x1a2e6d){var _0x4c88f5=this;return new BPromise(function(_0x2b51c8,_0x383503){var _0x5249ea=uuid['v4']();var _0x3cd87f=ut[_0x24fc('0x69')](_0x42b972,_0x1a2e6d);_0x4c88f5[_0x24fc('0x11')][_0x5249ea]=new Action(_0x5249ea,_0x1a2e6d,_0x42b972);var _0x1efe4e=_0x4c88f5[_0x24fc('0x11')][_0x5249ea];if(path[_0x24fc('0x38')](_0x42b972['path'])['ext']===_0x24fc('0x39')){originate(_0x1efe4e,_0x3cd87f,!![])['then'](function(_0x29bd9f){_0x2b51c8(_0x29bd9f);})['catch'](function(_0x5233c5){_0x383503(_0x5233c5);});}else{originate(_0x1efe4e,_0x3cd87f,![])[_0x24fc('0x3b')](function(_0x16c609){_0x2b51c8(_0x16c609);})[_0x24fc('0x3d')](function(_0x22235d){_0x383503(_0x22235d);});}});};Fax[_0x24fc('0x21')][_0x24fc('0x6a')]=function(_0x44eb26){return!_[_0x24fc('0x6b')](_0x44eb26)&&!_['isNil'](_0x44eb26[_0x24fc('0x27')])&&!_[_0x24fc('0x6b')](_0x44eb26['active'])&&_0x44eb26['active']&&!_[_0x24fc('0x6b')](this[_0x24fc('0x10')][util[_0x24fc('0x62')](_0x24fc('0x6c'),_0x44eb26[_0x24fc('0x27')])])&&!_['isNil'](this[_0x24fc('0x10')][util[_0x24fc('0x62')]('SIP/%s',_0x44eb26[_0x24fc('0x27')])][_0x24fc('0x2e')])&&(this[_0x24fc('0x10')][util['format'](_0x24fc('0x6c'),_0x44eb26[_0x24fc('0x27')])][_0x24fc('0x2e')]===_0x24fc('0x6d')||this[_0x24fc('0x10')][util[_0x24fc('0x62')](_0x24fc('0x6c'),_0x44eb26[_0x24fc('0x27')])][_0x24fc('0x2e')]==='unmonitored');};Fax[_0x24fc('0x21')][_0x24fc('0x5f')]=function(_0x1dcccf,_0x5ec335){if(!this['isTrunkReachable'](_0x1dcccf)){ut['logger'](_0x24fc('0x6e'),_['isNil'](_0x1dcccf)?'':_0x1dcccf[_0x24fc('0x27')]+_0x24fc('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x24fc('0x6b')](_0x5ec335['fax'])){ut[_0x24fc('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x24fc('0x41')](_0x5ec335));return{'isValid':![],'message':_0x24fc('0x70')};}if(_[_0x24fc('0x6b')](_0x5ec335[_0x24fc('0x4')])){ut[_0x24fc('0x4a')](_0x24fc('0x71'),JSON['stringify'](_0x5ec335));return{'isValid':![],'message':_0x24fc('0x72')};}return{'isValid':!![],'message':_0x24fc('0x73')};};module[_0x24fc('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a885331..47ccbca 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 _0x528f=['inspect','notify','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','../rpc/faxAccount','error'];(function(_0x348d8d,_0x1998f1){var _0x4b4bdc=function(_0x1fd177){while(--_0x1fd177){_0x348d8d['push'](_0x348d8d['shift']());}};_0x4b4bdc(++_0x1998f1);}(_0x528f,0xff));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0xf528('0x0'));var logger=require(_0xf528('0x1'))(_0xf528('0x2'));var _=require('lodash');var faxAccount=require(_0xf528('0x3'));function loggerCatch(_0x3dec43){return function(_0x4c9499){logger[_0xf528('0x4')](_0x3dec43,util[_0xf528('0x5')](_0x4c9499,{'showHidden':![],'depth':null}));};}exports[_0xf528('0x6')]=function(_0x423dae,_0x1f9507){return BPromise['resolve']()[_0xf528('0x7')](faxAccount[_0xf528('0x6')](_0x423dae,_0x1f9507))[_0xf528('0x8')](loggerCatch(_0xf528('0x9')));}; \ No newline at end of file +var _0x296d=['resolve','then','catch','util','bluebird','../../../config/logger','preview','lodash','error','inspect'];(function(_0x314c8a,_0x3f05ca){var _0xd2ea48=function(_0x24de9c){while(--_0x24de9c){_0x314c8a['push'](_0x314c8a['shift']());}};_0xd2ea48(++_0x3f05ca);}(_0x296d,0xa3));var _0xd296=function(_0x226494,_0xc4b645){_0x226494=_0x226494-0x0;var _0x27b950=_0x296d[_0x226494];return _0x27b950;};'use strict';var util=require(_0xd296('0x0'));var BPromise=require(_0xd296('0x1'));var logger=require(_0xd296('0x2'))(_0xd296('0x3'));var _=require(_0xd296('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4a678d){return function(_0x355e23){logger[_0xd296('0x5')](_0x4a678d,util[_0xd296('0x6')](_0x355e23,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x47bbb6,_0x35df4b){return BPromise[_0xd296('0x7')]()[_0xd296('0x8')](faxAccount['notify'](_0x47bbb6,_0x35df4b))[_0xd296('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 1c69d4b..01c0ac4 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 _0x5329=['../../../../config/logger','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x479978,_0x46ab1e){var _0x567a9f=function(_0x45a59e){while(--_0x45a59e){_0x479978['push'](_0x479978['shift']());}};_0x567a9f(++_0x46ab1e);}(_0x5329,0x14f));var _0x9532=function(_0x153b19,_0xd74123){_0x153b19=_0x153b19-0x0;var _0xa6f18e=_0x5329[_0x153b19];return _0xa6f18e;};'use strict';var util=require(_0x9532('0x0'));var logger=require(_0x9532('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x9532('0x2'))[_0x9532('0x3')];exports['execute']=function(_0x5c521e){return new BPromise(function(_0x17f146,_0xbc21c8){exec(_0x5c521e,function(_0xbb352,_0x2fcf78,_0x4b3bc6){logger[_0x9532('0x4')](_0x9532('0x5'),_0x2fcf78);if(_0xbb352){logger['info'](_0x9532('0x5'),_0x9532('0x6'),util[_0x9532('0x7')](_0xbb352,{'showHidden':![],'depth':null}),_0x2fcf78,_0x4b3bc6);_0xbc21c8(_0xbb352);}_0x17f146(_0x2fcf78);});});}; \ No newline at end of file +var _0xdc15=['Exec\x20gs','\x20Error\x20:','inspect','fax','bluebird','child_process','info'];(function(_0x65fbe0,_0x317b60){var _0x5cebd6=function(_0x22858e){while(--_0x22858e){_0x65fbe0['push'](_0x65fbe0['shift']());}};_0x5cebd6(++_0x317b60);}(_0xdc15,0x1c3));var _0x5dc1=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xdc15[_0x5216e0];return _0x5b3f40;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x5dc1('0x0'));var BPromise=require(_0x5dc1('0x1'));var exec=require(_0x5dc1('0x2'))['exec'];exports['execute']=function(_0x3eb346){return new BPromise(function(_0x22a001,_0x2c7581){exec(_0x3eb346,function(_0x3a63ee,_0x37c932,_0x1659d0){logger[_0x5dc1('0x3')](_0x5dc1('0x4'),_0x37c932);if(_0x3a63ee){logger[_0x5dc1('0x3')](_0x5dc1('0x4'),_0x5dc1('0x5'),util[_0x5dc1('0x6')](_0x3a63ee,{'showHidden':![],'depth':null}),_0x37c932,_0x1659d0);_0x2c7581(_0x3a63ee);}_0x22a001(_0x37c932);});});}; \ 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 12749e8..6843b29 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 _0xe62b=['util','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','minrate','format','\x22%s\x22','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid'];(function(_0x4e76ed,_0x4585cc){var _0x206c09=function(_0x506dfa){while(--_0x506dfa){_0x4e76ed['push'](_0x4e76ed['shift']());}};_0x206c09(++_0x4585cc);}(_0xe62b,0x180));var _0xbe62=function(_0x475bf1,_0x5235b6){_0x475bf1=_0x475bf1-0x0;var _0x4095d1=_0xe62b[_0x475bf1];return _0x4095d1;};'use strict';var util=require(_0xbe62('0x0'));var _=require('lodash');var moment=require(_0xbe62('0x1'));var logger=require(_0xbe62('0x2'))(_0xbe62('0x3'));exports[_0xbe62('0x4')]=function(_0x4f12c5){return{'message':_0x4f12c5};};exports[_0xbe62('0x5')]=function(_0x201b6f,_0x370bc6){logger['info'](_0x201b6f,util[_0xbe62('0x6')](_0x370bc6,{'showHidden':![],'depth':null}));};exports[_0xbe62('0x7')]=function(_0x4afc7a,_0x10645c){var _0x5cb052={'XMF-ECM':_0x10645c[_0xbe62('0x8')],'XMF-HEADERINFO':_0x10645c['headerinfo'],'XMF-MINRATE':_0x10645c[_0xbe62('0x9')],'XMF-MAXRATE':_0x10645c['maxrate'],'XMF-MODEM':util[_0xbe62('0xa')](_0xbe62('0xb'),_0x10645c['modem']),'XMF-GATEWAY':_0x10645c['gateway'],'XMF-FAXDETECT':_0x10645c[_0xbe62('0xc')],'XMF-T38TIMEOUT':_0x10645c[_0xbe62('0xd')],'XMF-LOCALSTATIONID':_0x10645c['localstationid'],'XMF-PATH':_0x4afc7a[_0xbe62('0xe')]};return _0x5cb052;};exports[_0xbe62('0xf')]=function(_0x42d03c,_0x24d289){return{'actionid':_0x42d03c[_0xbe62('0x10')],'action':_0xbe62('0x11'),'channel':_0x42d03c[_0xbe62('0x12')],'Exten':_0xbe62('0x13'),'Context':_0xbe62('0x14'),'Priority':'1','callerid':util[_0xbe62('0xa')](_0xbe62('0x15'),_0x42d03c[_0xbe62('0x16')]?_0x42d03c[_0xbe62('0x16')]:'',_0x42d03c[_0xbe62('0x17')]),'variable':_0x24d289,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x42d03c['uniqueid']};}; \ No newline at end of file +var _0x099b=['xcally-motion-fax','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x099b,0xa3));var _0xb099=function(_0x1d2bc2,_0x25fb3c){_0x1d2bc2=_0x1d2bc2-0x0;var _0x4a5707=_0x099b[_0x1d2bc2];return _0x4a5707;};'use strict';var util=require('util');var _=require(_0xb099('0x0'));var moment=require(_0xb099('0x1'));var logger=require(_0xb099('0x2'))('fax');exports['message']=function(_0x2dc4df){return{'message':_0x2dc4df};};exports[_0xb099('0x3')]=function(_0x2458c3,_0x38f6dc){logger[_0xb099('0x4')](_0x2458c3,util[_0xb099('0x5')](_0x38f6dc,{'showHidden':![],'depth':null}));};exports[_0xb099('0x6')]=function(_0x544665,_0x1163d6){var _0x5afbff={'XMF-ECM':_0x1163d6['ecm'],'XMF-HEADERINFO':_0x1163d6[_0xb099('0x7')],'XMF-MINRATE':_0x1163d6[_0xb099('0x8')],'XMF-MAXRATE':_0x1163d6[_0xb099('0x9')],'XMF-MODEM':util[_0xb099('0xa')](_0xb099('0xb'),_0x1163d6[_0xb099('0xc')]),'XMF-GATEWAY':_0x1163d6[_0xb099('0xd')],'XMF-FAXDETECT':_0x1163d6[_0xb099('0xe')],'XMF-T38TIMEOUT':_0x1163d6[_0xb099('0xf')],'XMF-LOCALSTATIONID':_0x1163d6[_0xb099('0x10')],'XMF-PATH':_0x544665[_0xb099('0x11')]};return _0x5afbff;};exports['variablesAction']=function(_0x57df37,_0x5da330){return{'actionid':_0x57df37[_0xb099('0x12')],'action':_0xb099('0x13'),'channel':_0x57df37[_0xb099('0x14')],'Exten':_0xb099('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xb099('0x16'),_0x57df37[_0xb099('0x7')]?_0x57df37[_0xb099('0x7')]:'',_0x57df37[_0xb099('0x10')]),'variable':_0x5da330,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x57df37[_0xb099('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 88aea88..d844d39 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 _0xf163=['./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','getAgents','initAgents','getTelephones','then','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./preview','./fax'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xf163,0x163));var _0x3f16=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xf163[_0x1c6089];return _0x4d97c1;};'use strict';var BPromise=require(_0x3f16('0x0'));var util=require(_0x3f16('0x1'));var moment=require(_0x3f16('0x2'));var server=require(_0x3f16('0x3'));var Realtime=require(_0x3f16('0x4'));var Report=require(_0x3f16('0x5'));var Acw=require(_0x3f16('0x6'));var Trigger=require(_0x3f16('0x7'));var Dialer=require('./dialer');var Preview=require(_0x3f16('0x8'));var Fax=require(_0x3f16('0x9'));var user=require(_0x3f16('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x3f16('0xb'));var voiceCallReport=require(_0x3f16('0xc'));var trunk=require(_0x3f16('0xd'));var trigger=require(_0x3f16('0xe'));var template=require('./rpc/template');var cmHopperHistory=require(_0x3f16('0xf'));var campaign=require(_0x3f16('0x10'));var voiceExtension=require(_0x3f16('0x11'));var faxAccount=require(_0x3f16('0x12'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x3f16('0x13'));var sugarcrm=require(_0x3f16('0x14'));var freshdesk=require(_0x3f16('0x15'));var desk=require(_0x3f16('0x16'));var zoho=require(_0x3f16('0x17'));var vtiger=require(_0x3f16('0x18'));var freshsales=require(_0x3f16('0x19'));var servicenow=require(_0x3f16('0x1a'));var dynamics365=require(_0x3f16('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x3f16('0x1c'))(_0x3f16('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3f16('0x1e')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3f16('0x1e')](_0x3f16('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x3f16('0x20')]())['then'](realtime[_0x3f16('0x21')]())['then'](user[_0x3f16('0x22')]())[_0x3f16('0x23')](realtime[_0x3f16('0x24')]())[_0x3f16('0x23')](trunk[_0x3f16('0x25')]())[_0x3f16('0x23')](realtime[_0x3f16('0x26')]())['then'](voiceQueue[_0x3f16('0x27')]())['then'](realtime['initVoiceQueues']())[_0x3f16('0x23')](trigger[_0x3f16('0x28')]())[_0x3f16('0x23')](realtime['initTriggers']())[_0x3f16('0x23')](template[_0x3f16('0x29')]())[_0x3f16('0x23')](realtime[_0x3f16('0x2a')]())[_0x3f16('0x23')](zendesk[_0x3f16('0x2b')]())[_0x3f16('0x23')](realtime[_0x3f16('0x2c')]())[_0x3f16('0x23')](salesforce[_0x3f16('0x2d')]())['then'](realtime['initSalesforceAccounts']())[_0x3f16('0x23')](sugarcrm[_0x3f16('0x2e')]())[_0x3f16('0x23')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x3f16('0x2f')]())['then'](realtime[_0x3f16('0x30')]())[_0x3f16('0x23')](desk[_0x3f16('0x31')]())[_0x3f16('0x23')](realtime['initDeskAccounts']())[_0x3f16('0x23')](zoho[_0x3f16('0x32')]())['then'](realtime[_0x3f16('0x33')]())[_0x3f16('0x23')](vtiger[_0x3f16('0x34')]())[_0x3f16('0x23')](realtime['initVtigerAccounts']())[_0x3f16('0x23')](freshsales['getFreshsalesAccounts']())[_0x3f16('0x23')](realtime[_0x3f16('0x35')]())[_0x3f16('0x23')](servicenow[_0x3f16('0x36')]())[_0x3f16('0x23')](realtime[_0x3f16('0x37')]())[_0x3f16('0x23')](dynamics365[_0x3f16('0x38')]())[_0x3f16('0x23')](realtime[_0x3f16('0x39')]())[_0x3f16('0x23')](campaign[_0x3f16('0x3a')]())['then'](realtime[_0x3f16('0x3b')]())[_0x3f16('0x23')](voiceExtension[_0x3f16('0x3c')]())['then'](realtime[_0x3f16('0x3d')]())[_0x3f16('0x23')](faxAccount[_0x3f16('0x3e')]())[_0x3f16('0x23')](realtime[_0x3f16('0x3f')]())[_0x3f16('0x23')](function(){return realtime;});}function initParams(){return BPromise[_0x3f16('0x40')]()[_0x3f16('0x23')](voiceQueueReport[_0x3f16('0x41')]())[_0x3f16('0x23')](realtime['initVoiceQueueReports']())[_0x3f16('0x23')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x3f16('0x23')](realtime['initVoiceQueueHopperHistory']())[_0x3f16('0x23')](cmHopperHistory['getCampaignHopperHistory']())[_0x3f16('0x23')](realtime[_0x3f16('0x42')]())['then'](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x3f16('0x43')]())[_0x3f16('0x44')](function(_0x16d677){logger[_0x3f16('0x45')](_0x3f16('0x46'),util[_0x3f16('0x47')](_0x16d677,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3f16('0x48')](realtime,preview,fax)[_0x3f16('0x23')](function(_0xbf9128){return initRealtime();})['then'](function(){return initParams();})[_0x3f16('0x23')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x3f16('0x44')](function(_0x585fe8){logger[_0x3f16('0x45')]('[index.js][main]',util[_0x3f16('0x47')](_0x585fe8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc975=['./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','resolve','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','sync','catch','[index.js][main]','inspect','bluebird','moment','./server','./realtime','./acw','./trigger','./preview','./fax'];(function(_0x383489,_0x1105b9){var _0x19126c=function(_0x2a12bf){while(--_0x2a12bf){_0x383489['push'](_0x383489['shift']());}};_0x19126c(++_0x1105b9);}(_0xc975,0xbe));var _0x5c97=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc975[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x5c97('0x0'));var util=require('util');var moment=require(_0x5c97('0x1'));var server=require(_0x5c97('0x2'));var Realtime=require(_0x5c97('0x3'));var Report=require('./report');var Acw=require(_0x5c97('0x4'));var Trigger=require(_0x5c97('0x5'));var Dialer=require('./dialer');var Preview=require(_0x5c97('0x6'));var Fax=require(_0x5c97('0x7'));var user=require(_0x5c97('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x5c97('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x5c97('0xa'));var trigger=require(_0x5c97('0xb'));var template=require(_0x5c97('0xc'));var cmHopperHistory=require(_0x5c97('0xd'));var campaign=require(_0x5c97('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x5c97('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x5c97('0x10'));var sugarcrm=require(_0x5c97('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x5c97('0x12'));var vtiger=require(_0x5c97('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x5c97('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5c97('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x5c97('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x5c97('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x5c97('0x17')](user[_0x5c97('0x18')]())['then'](realtime[_0x5c97('0x19')]())[_0x5c97('0x17')](user[_0x5c97('0x1a')]())['then'](realtime[_0x5c97('0x1b')]())[_0x5c97('0x17')](trunk[_0x5c97('0x1c')]())[_0x5c97('0x17')](realtime[_0x5c97('0x1d')]())[_0x5c97('0x17')](voiceQueue[_0x5c97('0x1e')]())['then'](realtime[_0x5c97('0x1f')]())[_0x5c97('0x17')](trigger[_0x5c97('0x20')]())[_0x5c97('0x17')](realtime[_0x5c97('0x21')]())[_0x5c97('0x17')](template[_0x5c97('0x22')]())[_0x5c97('0x17')](realtime[_0x5c97('0x23')]())[_0x5c97('0x17')](zendesk[_0x5c97('0x24')]())['then'](realtime[_0x5c97('0x25')]())[_0x5c97('0x17')](salesforce[_0x5c97('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0x5c97('0x17')](sugarcrm[_0x5c97('0x27')]())[_0x5c97('0x17')](realtime['initSugarcrmAccounts']())[_0x5c97('0x17')](freshdesk[_0x5c97('0x28')]())[_0x5c97('0x17')](realtime[_0x5c97('0x29')]())[_0x5c97('0x17')](desk[_0x5c97('0x2a')]())['then'](realtime[_0x5c97('0x2b')]())['then'](zoho[_0x5c97('0x2c')]())['then'](realtime['initZohoAccounts']())[_0x5c97('0x17')](vtiger[_0x5c97('0x2d')]())[_0x5c97('0x17')](realtime[_0x5c97('0x2e')]())[_0x5c97('0x17')](freshsales['getFreshsalesAccounts']())[_0x5c97('0x17')](realtime[_0x5c97('0x2f')]())[_0x5c97('0x17')](servicenow[_0x5c97('0x30')]())[_0x5c97('0x17')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x5c97('0x31')]())[_0x5c97('0x17')](realtime[_0x5c97('0x32')]())['then'](campaign[_0x5c97('0x33')]())['then'](realtime[_0x5c97('0x34')]())[_0x5c97('0x17')](voiceExtension['getVoiceExtensions']())[_0x5c97('0x17')](realtime[_0x5c97('0x35')]())[_0x5c97('0x17')](faxAccount[_0x5c97('0x36')]())[_0x5c97('0x17')](realtime['initFaxAccounts']())[_0x5c97('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x5c97('0x37')]()[_0x5c97('0x17')](voiceQueueReport['getVoiceQueueReports']())[_0x5c97('0x17')](realtime['initVoiceQueueReports']())[_0x5c97('0x17')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x5c97('0x17')](realtime[_0x5c97('0x38')]())[_0x5c97('0x17')](cmHopperHistory[_0x5c97('0x39')]())[_0x5c97('0x17')](realtime[_0x5c97('0x3a')]())[_0x5c97('0x17')](voiceCallReport['getVoiceCallReports']())[_0x5c97('0x17')](realtime[_0x5c97('0x3b')]())['catch'](function(_0x1279e5){logger[_0x5c97('0x3c')](_0x5c97('0x3d'),util['inspect'](_0x1279e5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x443a12){return initRealtime();})[_0x5c97('0x17')](function(){return initParams();})[_0x5c97('0x17')](function(){report[_0x5c97('0x3e')]();setInterval(initRealtime,0x1388);})[_0x5c97('0x3f')](function(_0xa99663){logger[_0x5c97('0x3c')](_0x5c97('0x40'),util[_0x5c97('0x41')](_0xa99663,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 8cd523a..96e028c 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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x8b157e,_0x3d9e27){var _0x2b10b2=function(_0xe9799c){while(--_0xe9799c){_0x8b157e['push'](_0x8b157e['shift']());}};_0x2b10b2(++_0x3d9e27);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x21b79c,_0x5a75d6){var _0x287630=function(_0x55a9f2){while(--_0x55a9f2){_0x21b79c['push'](_0x21b79c['shift']());}};_0x287630(++_0x5a75d6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1ef7b72..2543662 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 _0x3ab5=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x2a9890,_0x5afe52){var _0x502693=function(_0x10ae31){while(--_0x10ae31){_0x2a9890['push'](_0x2a9890['shift']());}};_0x502693(++_0x5afe52);}(_0x3ab5,0xec));var _0x53ab=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3ab5[_0xa464c9];return _0x3d73c4;};'use strict';function Campaign(_0x4edc16){this['id']=_0x4edc16['id']||0x0;this['name']=_0x4edc16[_0x53ab('0x0')]||'';this[_0x53ab('0x1')]=_0x4edc16[_0x53ab('0x1')]||'campaign';this[_0x53ab('0x2')]=0x0;this[_0x53ab('0x3')]=0x0;this[_0x53ab('0x4')]=0x0;this[_0x53ab('0x5')]=0x0;this[_0x53ab('0x6')]='';this[_0x53ab('0x7')]=!![];this[_0x53ab('0x8')]=_0x4edc16['active'];this['limitCalls']=_0x4edc16['limitCalls'];this[_0x53ab('0x9')]=_0x4edc16[_0x53ab('0x9')]||null;this[_0x53ab('0xa')]=_0x4edc16[_0x53ab('0xa')]?_0x4edc16[_0x53ab('0xa')]:null;this[_0x53ab('0xb')]=_0x4edc16['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4edc16[_0x53ab('0xc')];this[_0x53ab('0xd')]=_0x4edc16[_0x53ab('0xd')]||0x1e;this[_0x53ab('0xe')]=_0x4edc16[_0x53ab('0xe')];this[_0x53ab('0xf')]=_0x4edc16[_0x53ab('0xf')];this[_0x53ab('0x10')]=_0x4edc16[_0x53ab('0x10')];this[_0x53ab('0x11')]=_0x4edc16[_0x53ab('0x11')];this[_0x53ab('0x12')]=_0x4edc16[_0x53ab('0x12')];this[_0x53ab('0x13')]=_0x4edc16[_0x53ab('0x13')];this[_0x53ab('0x14')]=_0x4edc16[_0x53ab('0x14')];this[_0x53ab('0x15')]=_0x4edc16[_0x53ab('0x15')]||0x3;this[_0x53ab('0x16')]=_0x4edc16[_0x53ab('0x16')]||0x96;this[_0x53ab('0x17')]=_0x4edc16[_0x53ab('0x17')]||0x3;this[_0x53ab('0x18')]=_0x4edc16[_0x53ab('0x18')]||0x96;this[_0x53ab('0x19')]=_0x4edc16[_0x53ab('0x19')]||0x3;this[_0x53ab('0x1a')]=_0x4edc16['dialAbandonedRetryFrequency']||0x96;this[_0x53ab('0x1b')]=_0x4edc16[_0x53ab('0x1b')]||0x3;this[_0x53ab('0x1c')]=_0x4edc16[_0x53ab('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x4edc16[_0x53ab('0x1d')]||0x3;this[_0x53ab('0x1e')]=_0x4edc16[_0x53ab('0x1e')]||0x96;this[_0x53ab('0x1f')]=_0x4edc16[_0x53ab('0x1f')]||_0x53ab('0x20');this[_0x53ab('0x21')]=_0x4edc16[_0x53ab('0x21')]||undefined;this[_0x53ab('0x22')]=_0x4edc16['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x53ab('0x23')]=_0x4edc16['dialCutDigit']||undefined;this['TrunkBackup']=_0x4edc16['TrunkBackup']?_0x4edc16[_0x53ab('0x24')]:undefined;this[_0x53ab('0x25')]=_0x4edc16[_0x53ab('0x25')]?_0x4edc16[_0x53ab('0x25')]:undefined;this[_0x53ab('0x26')]=_0x4edc16[_0x53ab('0x26')]?_0x4edc16[_0x53ab('0x26')]:undefined;this['SquareProject']=_0x4edc16[_0x53ab('0x27')]?_0x4edc16[_0x53ab('0x27')]:undefined;this[_0x53ab('0x28')]=_0x4edc16['SquareProject']?_0x4edc16[_0x53ab('0x27')][_0x53ab('0x0')]:undefined;this[_0x53ab('0x29')]=_0x4edc16[_0x53ab('0x29')]||![];this['dialAMDInitialSilence']=_0x4edc16[_0x53ab('0x2a')];this[_0x53ab('0x2b')]=_0x4edc16[_0x53ab('0x2b')];this[_0x53ab('0x2c')]=_0x4edc16[_0x53ab('0x2c')];this['dialAMDTotalAnalysisTime']=_0x4edc16['dialAMDTotalAnalysisTime'];this[_0x53ab('0x2d')]=_0x4edc16[_0x53ab('0x2d')];this[_0x53ab('0x2e')]=_0x4edc16[_0x53ab('0x2e')];this[_0x53ab('0x2f')]=_0x4edc16['dialAMDMaximumNumberOfWords'];this[_0x53ab('0x30')]=_0x4edc16[_0x53ab('0x30')];this['dialAMDMaximumWordLength']=_0x4edc16['dialAMDMaximumWordLength'];}module[_0x53ab('0x31')]=Campaign; \ No newline at end of file +var _0x0b52=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x301ea6,_0x202cf3){var _0x3bd1ae=function(_0xc27c01){while(--_0xc27c01){_0x301ea6['push'](_0x301ea6['shift']());}};_0x3bd1ae(++_0x202cf3);}(_0x0b52,0x15f));var _0x20b5=function(_0x5c6ca9,_0x196515){_0x5c6ca9=_0x5c6ca9-0x0;var _0x3b3f3a=_0x0b52[_0x5c6ca9];return _0x3b3f3a;};'use strict';function Campaign(_0x2ea4c1){this['id']=_0x2ea4c1['id']||0x0;this[_0x20b5('0x0')]=_0x2ea4c1['name']||'';this['type']=_0x2ea4c1[_0x20b5('0x1')]||_0x20b5('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x20b5('0x3')]=0x0;this[_0x20b5('0x4')]=0x0;this[_0x20b5('0x5')]='';this[_0x20b5('0x6')]=!![];this['active']=_0x2ea4c1[_0x20b5('0x7')];this[_0x20b5('0x8')]=_0x2ea4c1[_0x20b5('0x8')];this[_0x20b5('0x9')]=_0x2ea4c1[_0x20b5('0x9')]||null;this[_0x20b5('0xa')]=_0x2ea4c1[_0x20b5('0xa')]?_0x2ea4c1['dialGlobalInterval']:null;this[_0x20b5('0xb')]=_0x2ea4c1[_0x20b5('0xb')];this['dialOriginateCallerIdNumber']=_0x2ea4c1[_0x20b5('0xc')];this['dialOriginateTimeout']=_0x2ea4c1[_0x20b5('0xd')]||0x1e;this[_0x20b5('0xe')]=_0x2ea4c1[_0x20b5('0xe')];this['dialCongestionRetryFrequency']=_0x2ea4c1[_0x20b5('0xf')];this[_0x20b5('0x10')]=_0x2ea4c1['dialBusyMaxRetry'];this[_0x20b5('0x11')]=_0x2ea4c1[_0x20b5('0x11')];this[_0x20b5('0x12')]=_0x2ea4c1[_0x20b5('0x12')];this['dialNoAnswerRetryFrequency']=_0x2ea4c1['dialNoAnswerRetryFrequency'];this[_0x20b5('0x13')]=_0x2ea4c1[_0x20b5('0x13')];this[_0x20b5('0x14')]=_0x2ea4c1[_0x20b5('0x14')]||0x3;this[_0x20b5('0x15')]=_0x2ea4c1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x20b5('0x16')]=_0x2ea4c1['dialDropMaxRetry']||0x3;this[_0x20b5('0x17')]=_0x2ea4c1[_0x20b5('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x2ea4c1[_0x20b5('0x18')]||0x3;this[_0x20b5('0x19')]=_0x2ea4c1[_0x20b5('0x19')]||0x96;this[_0x20b5('0x1a')]=_0x2ea4c1['dialMachineMaxRetry']||0x3;this[_0x20b5('0x1b')]=_0x2ea4c1[_0x20b5('0x1b')]||0x96;this[_0x20b5('0x1c')]=_0x2ea4c1[_0x20b5('0x1c')]||0x3;this[_0x20b5('0x1d')]=_0x2ea4c1[_0x20b5('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x2ea4c1[_0x20b5('0x1e')]||_0x20b5('0x1f');this['dialPrefix']=_0x2ea4c1['dialPrefix']||undefined;this[_0x20b5('0x20')]=_0x2ea4c1[_0x20b5('0x20')]||undefined;this[_0x20b5('0x21')]=_0x2ea4c1['dialCutDigit']||undefined;this[_0x20b5('0x22')]=_0x2ea4c1[_0x20b5('0x22')]?_0x2ea4c1['TrunkBackup']:undefined;this[_0x20b5('0x23')]=_0x2ea4c1[_0x20b5('0x23')]?_0x2ea4c1[_0x20b5('0x23')]:undefined;this[_0x20b5('0x24')]=_0x2ea4c1[_0x20b5('0x24')]?_0x2ea4c1[_0x20b5('0x24')]:undefined;this[_0x20b5('0x25')]=_0x2ea4c1['SquareProject']?_0x2ea4c1[_0x20b5('0x25')]:undefined;this[_0x20b5('0x26')]=_0x2ea4c1[_0x20b5('0x25')]?_0x2ea4c1['SquareProject']['name']:undefined;this[_0x20b5('0x27')]=_0x2ea4c1['dialAMDActive']||![];this[_0x20b5('0x28')]=_0x2ea4c1[_0x20b5('0x28')];this[_0x20b5('0x29')]=_0x2ea4c1[_0x20b5('0x29')];this[_0x20b5('0x2a')]=_0x2ea4c1[_0x20b5('0x2a')];this['dialAMDTotalAnalysisTime']=_0x2ea4c1[_0x20b5('0x2b')];this['dialAMDMinWordLength']=_0x2ea4c1[_0x20b5('0x2c')];this[_0x20b5('0x2d')]=_0x2ea4c1[_0x20b5('0x2d')];this[_0x20b5('0x2e')]=_0x2ea4c1['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2ea4c1['dialAMDSilenceThreshold'];this[_0x20b5('0x2f')]=_0x2ea4c1[_0x20b5('0x2f')];}module[_0x20b5('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d016f4e..418ab45 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 _0xe8e8=['calleridname','connectedlinenum','context','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel'];(function(_0x4dc8fa,_0x408c90){var _0x11ee03=function(_0x128826){while(--_0x128826){_0x4dc8fa['push'](_0x4dc8fa['shift']());}};_0x11ee03(++_0x408c90);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x587fa8,_0x54392e){_0x587fa8=_0x587fa8-0x0;var _0x1f3843=_0xe8e8[_0x587fa8];return _0x1f3843;};'use strict';function Channel(){this[_0x8e8e('0x0')]=null;this[_0x8e8e('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x8e8e('0x2')]='';this[_0x8e8e('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x8e8e('0x4')]='';this['uniqueid']=0x0;this[_0x8e8e('0x5')]=0x0;this[_0x8e8e('0x6')]=0x0;this[_0x8e8e('0x7')]=![];this[_0x8e8e('0x8')]=null;this['endtime']=null;this[_0x8e8e('0x9')]=![];this['abandoned']=![];this[_0x8e8e('0xa')]='';this[_0x8e8e('0xb')]='';this[_0x8e8e('0xc')]=0x0;this[_0x8e8e('0xd')]=0x0;this[_0x8e8e('0xe')]=0x0;this[_0x8e8e('0xf')]=null;this[_0x8e8e('0x10')]=null;this['disposition']=null;this[_0x8e8e('0x11')]=![];this[_0x8e8e('0x12')]=null;this[_0x8e8e('0x13')]=null;this[_0x8e8e('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x8e8e('0x15')]=undefined;this[_0x8e8e('0x16')]=undefined;this[_0x8e8e('0x17')]=0x0;}module[_0x8e8e('0x18')]=Channel; \ No newline at end of file +var _0xd2ed=['tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','holdtime'];(function(_0x140b00,_0x75f4b0){var _0x4afadb=function(_0x2fff4c){while(--_0x2fff4c){_0x140b00['push'](_0x140b00['shift']());}};_0x4afadb(++_0x75f4b0);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x2e7548,_0x2c9ec9){_0x2e7548=_0x2e7548-0x0;var _0x17adad=_0xd2ed[_0x2e7548];return _0x17adad;};'use strict';function Channel(){this[_0xdd2e('0x0')]=null;this[_0xdd2e('0x1')]='';this[_0xdd2e('0x2')]='';this[_0xdd2e('0x3')]=0x0;this[_0xdd2e('0x4')]='';this[_0xdd2e('0x5')]=undefined;this[_0xdd2e('0x6')]=undefined;this[_0xdd2e('0x7')]=0x0;this['context']='';this[_0xdd2e('0x8')]=0x0;this['linkedid']=0x0;this[_0xdd2e('0x9')]=0x0;this[_0xdd2e('0xa')]=![];this[_0xdd2e('0xb')]=null;this[_0xdd2e('0xc')]=null;this['unmanaged']=![];this[_0xdd2e('0xd')]=![];this[_0xdd2e('0xe')]='';this[_0xdd2e('0xf')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0xdd2e('0x10')]=0x0;this['type']=null;this[_0xdd2e('0x11')]=null;this[_0xdd2e('0x12')]=null;this['monitor']=![];this[_0xdd2e('0x13')]=null;this['queue']=null;this[_0xdd2e('0x14')]=[];this[_0xdd2e('0x15')]=undefined;this[_0xdd2e('0x16')]=undefined;this['transferType']=undefined;this[_0xdd2e('0x17')]=0x0;}module[_0xdd2e('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b6baed5..66c6129 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 _0x25ff=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x2d398b,_0x5e98f8){var _0x5d8b9d=function(_0x121a78){while(--_0x121a78){_0x2d398b['push'](_0x2d398b['shift']());}};_0x5d8b9d(++_0x5e98f8);}(_0x25ff,0x1c2));var _0xf25f=function(_0x43b1c3,_0x264040){_0x43b1c3=_0x43b1c3-0x0;var _0x18d06b=_0x25ff[_0x43b1c3];return _0x18d06b;};'use strict';function DeskAccount(_0x3f66c7){this['id']=_0x3f66c7['id']||0x0;this[_0xf25f('0x0')]=_0x3f66c7[_0xf25f('0x0')]||'';this['username']=_0x3f66c7[_0xf25f('0x1')]||'';this['remoteUri']=_0x3f66c7[_0xf25f('0x2')]||'';this[_0xf25f('0x3')]=_0x3f66c7[_0xf25f('0x3')]||'';this[_0xf25f('0x4')]=_0x3f66c7[_0xf25f('0x4')]||'';this[_0xf25f('0x5')]=_0x3f66c7[_0xf25f('0x5')]||'';this[_0xf25f('0x6')]=_0x3f66c7['consumerSecret']||'';this[_0xf25f('0x7')]=_0x3f66c7['token']||'';this[_0xf25f('0x8')]=_0x3f66c7[_0xf25f('0x8')]||'';this[_0xf25f('0x9')]=_0x3f66c7['type']||'';this[_0xf25f('0xa')]=_0x3f66c7['serverUrl']||'';this['Configurations']=_0x3f66c7[_0xf25f('0xb')]||{};}module[_0xf25f('0xc')]=DeskAccount; \ No newline at end of file +var _0x9379=['Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2622f2,_0xeb6538){var _0x500f5b=function(_0x283644){while(--_0x283644){_0x2622f2['push'](_0x2622f2['shift']());}};_0x500f5b(++_0xeb6538);}(_0x9379,0xd9));var _0x9937=function(_0x58549b,_0x278753){_0x58549b=_0x58549b-0x0;var _0xd34471=_0x9379[_0x58549b];return _0xd34471;};'use strict';function DeskAccount(_0x5da7dc){this['id']=_0x5da7dc['id']||0x0;this[_0x9937('0x0')]=_0x5da7dc[_0x9937('0x0')]||'';this[_0x9937('0x1')]=_0x5da7dc['username']||'';this[_0x9937('0x2')]=_0x5da7dc['remoteUri']||'';this[_0x9937('0x3')]=_0x5da7dc[_0x9937('0x3')]||'';this[_0x9937('0x4')]=_0x5da7dc[_0x9937('0x4')]||'';this[_0x9937('0x5')]=_0x5da7dc['consumerKey']||'';this[_0x9937('0x6')]=_0x5da7dc[_0x9937('0x6')]||'';this[_0x9937('0x7')]=_0x5da7dc[_0x9937('0x7')]||'';this[_0x9937('0x8')]=_0x5da7dc['tokenSecret']||'';this[_0x9937('0x9')]=_0x5da7dc[_0x9937('0x9')]||'';this[_0x9937('0xa')]=_0x5da7dc[_0x9937('0xa')]||'';this[_0x9937('0xb')]=_0x5da7dc[_0x9937('0xb')]||{};}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 712fe0b..93cb86e 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 _0x9b6a=['serverUrl','modernAuthentication','CloudProvider','name','username','password','tenantId','clientId','clientSecret'];(function(_0x226694,_0x5f0141){var _0x58fffc=function(_0x59f450){while(--_0x59f450){_0x226694['push'](_0x226694['shift']());}};_0x58fffc(++_0x5f0141);}(_0x9b6a,0x1b3));var _0xa9b6=function(_0x15599c,_0x1ebd6a){_0x15599c=_0x15599c-0x0;var _0x5f1b30=_0x9b6a[_0x15599c];return _0x5f1b30;};'use strict';function Dynamics365Account(_0x24ac0d){this['id']=_0x24ac0d['id']||0x0;this['name']=_0x24ac0d[_0xa9b6('0x0')]||'';this[_0xa9b6('0x1')]=_0x24ac0d['username']||'';this['password']=_0x24ac0d[_0xa9b6('0x2')]||'';this['remoteUri']=_0x24ac0d['remoteUri']||'';this[_0xa9b6('0x3')]=_0x24ac0d[_0xa9b6('0x3')]||'';this[_0xa9b6('0x4')]=_0x24ac0d['clientId']||'';this[_0xa9b6('0x5')]=_0x24ac0d[_0xa9b6('0x5')]||{};this[_0xa9b6('0x6')]=_0x24ac0d[_0xa9b6('0x6')]||'';this[_0xa9b6('0x7')]=_0x24ac0d[_0xa9b6('0x7')]||![];this['Configurations']=_0x24ac0d['Configurations']||{};this[_0xa9b6('0x8')]=_0x24ac0d[_0xa9b6('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x7bca=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0xcf0ad3,_0x3abd71){var _0x3dd52e=function(_0x2b041a){while(--_0x2b041a){_0xcf0ad3['push'](_0xcf0ad3['shift']());}};_0x3dd52e(++_0x3abd71);}(_0x7bca,0x12d));var _0xa7bc=function(_0x2d5678,_0xdfb48f){_0x2d5678=_0x2d5678-0x0;var _0x4ad11a=_0x7bca[_0x2d5678];return _0x4ad11a;};'use strict';function Dynamics365Account(_0x5bc4cd){this['id']=_0x5bc4cd['id']||0x0;this[_0xa7bc('0x0')]=_0x5bc4cd[_0xa7bc('0x0')]||'';this[_0xa7bc('0x1')]=_0x5bc4cd[_0xa7bc('0x1')]||'';this[_0xa7bc('0x2')]=_0x5bc4cd['password']||'';this[_0xa7bc('0x3')]=_0x5bc4cd[_0xa7bc('0x3')]||'';this['tenantId']=_0x5bc4cd[_0xa7bc('0x4')]||'';this[_0xa7bc('0x5')]=_0x5bc4cd[_0xa7bc('0x5')]||'';this['clientSecret']=_0x5bc4cd[_0xa7bc('0x6')]||{};this['serverUrl']=_0x5bc4cd['serverUrl']||'';this[_0xa7bc('0x7')]=_0x5bc4cd[_0xa7bc('0x7')]||![];this[_0xa7bc('0x8')]=_0x5bc4cd[_0xa7bc('0x8')]||{};this['CloudProvider']=_0x5bc4cd[_0xa7bc('0x9')]||{};}module[_0xa7bc('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 383bd26..ecf33c7 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 _0x5c8f=['ListId','key','exports','name','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x3e00f8,_0x2cd02b){var _0xb9dc49=function(_0xc7dfc2){while(--_0xc7dfc2){_0x3e00f8['push'](_0x3e00f8['shift']());}};_0xb9dc49(++_0x2cd02b);}(_0x5c8f,0xab));var _0xf5c8=function(_0x45a6e9,_0x4acb29){_0x45a6e9=_0x45a6e9-0x0;var _0x100ad8=_0x5c8f[_0x45a6e9];return _0x100ad8;};'use strict';function FaxAccount(_0x435781){this['id']=_0x435781['id']||0x0;this['name']=_0x435781[_0xf5c8('0x0')]||'';this['description']=_0x435781['description'];this['ecm']=_0x435781['ecm'];this['headerinfo']=_0x435781[_0xf5c8('0x1')];this['localstationid']=_0x435781['localstationid'];this[_0xf5c8('0x2')]=_0x435781['minrate']||0x960;this['maxrate']=_0x435781[_0xf5c8('0x3')]||0x3840;this[_0xf5c8('0x4')]=_0x435781[_0xf5c8('0x4')]||'v17,v27,v29';this[_0xf5c8('0x5')]=_0x435781[_0xf5c8('0x5')]||'no';this[_0xf5c8('0x6')]=_0x435781['faxdetect']||'no';this[_0xf5c8('0x7')]=_0x435781['t38timeout']||0x1388;this['tech']=_0x435781[_0xf5c8('0x8')]||_0xf5c8('0x9');this['Trunk']=_0x435781[_0xf5c8('0xa')]?_0x435781[_0xf5c8('0xa')]:undefined;this['ListId']=_0x435781[_0xf5c8('0xb')];this['key']=_0x435781[_0xf5c8('0xc')];}module[_0xf5c8('0xd')]=FaxAccount; \ No newline at end of file +var _0x72c7=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x234ce7,_0x3e909c){var _0x57c561=function(_0x8ac1bb){while(--_0x8ac1bb){_0x234ce7['push'](_0x234ce7['shift']());}};_0x57c561(++_0x3e909c);}(_0x72c7,0x70));var _0x772c=function(_0x230c53,_0x488a8a){_0x230c53=_0x230c53-0x0;var _0x397074=_0x72c7[_0x230c53];return _0x397074;};'use strict';function FaxAccount(_0x43f15c){this['id']=_0x43f15c['id']||0x0;this[_0x772c('0x0')]=_0x43f15c['name']||'';this[_0x772c('0x1')]=_0x43f15c[_0x772c('0x1')];this[_0x772c('0x2')]=_0x43f15c[_0x772c('0x2')];this[_0x772c('0x3')]=_0x43f15c['headerinfo'];this[_0x772c('0x4')]=_0x43f15c[_0x772c('0x4')];this[_0x772c('0x5')]=_0x43f15c[_0x772c('0x5')]||0x960;this[_0x772c('0x6')]=_0x43f15c[_0x772c('0x6')]||0x3840;this['modem']=_0x43f15c[_0x772c('0x7')]||_0x772c('0x8');this[_0x772c('0x9')]=_0x43f15c['gateway']||'no';this[_0x772c('0xa')]=_0x43f15c[_0x772c('0xa')]||'no';this[_0x772c('0xb')]=_0x43f15c['t38timeout']||0x1388;this[_0x772c('0xc')]=_0x43f15c['tech']||_0x772c('0xd');this[_0x772c('0xe')]=_0x43f15c[_0x772c('0xe')]?_0x43f15c[_0x772c('0xe')]:undefined;this['ListId']=_0x43f15c[_0x772c('0xf')];this[_0x772c('0x10')]=_0x43f15c['key'];}module[_0x772c('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index bb0e970..48d7f73 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 _0x99a4=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x152cab,_0x30291c){var _0x53f755=function(_0x5eb137){while(--_0x5eb137){_0x152cab['push'](_0x152cab['shift']());}};_0x53f755(++_0x30291c);}(_0x99a4,0x160));var _0x499a=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x99a4[_0x3e112d];return _0x531c31;};'use strict';function FreshdeskAccount(_0x1db3f2){this['id']=_0x1db3f2['id']||0x0;this[_0x499a('0x0')]=_0x1db3f2[_0x499a('0x0')]||'';this['username']=_0x1db3f2[_0x499a('0x1')]||'';this[_0x499a('0x2')]=_0x1db3f2[_0x499a('0x3')]||'';this[_0x499a('0x4')]=_0x1db3f2[_0x499a('0x4')]||'';this['serverUrl']=_0x1db3f2[_0x499a('0x5')]||'';this['Configurations']=_0x1db3f2[_0x499a('0x6')]||{};}module[_0x499a('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x69e2=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x35a4d2,_0x2a5a3b){var _0x18c1b6=function(_0x158556){while(--_0x158556){_0x35a4d2['push'](_0x35a4d2['shift']());}};_0x18c1b6(++_0x2a5a3b);}(_0x69e2,0x1c0));var _0x269e=function(_0x5f1a45,_0x44388b){_0x5f1a45=_0x5f1a45-0x0;var _0x3bcb1f=_0x69e2[_0x5f1a45];return _0x3bcb1f;};'use strict';function FreshdeskAccount(_0x1ef68d){this['id']=_0x1ef68d['id']||0x0;this['name']=_0x1ef68d[_0x269e('0x0')]||'';this[_0x269e('0x1')]=_0x1ef68d[_0x269e('0x1')]||'';this['apiKey']=_0x1ef68d[_0x269e('0x2')]||'';this[_0x269e('0x3')]=_0x1ef68d[_0x269e('0x3')]||'';this[_0x269e('0x4')]=_0x1ef68d[_0x269e('0x4')]||'';this[_0x269e('0x5')]=_0x1ef68d[_0x269e('0x5')]||{};}module[_0x269e('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b0ec5dc..787e872 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 _0x2e8a=['exports','name','username','apiKey','remoteUri','Configurations'];(function(_0x17ccf6,_0x47fcdd){var _0x37a893=function(_0x254d52){while(--_0x254d52){_0x17ccf6['push'](_0x17ccf6['shift']());}};_0x37a893(++_0x47fcdd);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x50a1f6,_0x238fd8){_0x50a1f6=_0x50a1f6-0x0;var _0x84f8d4=_0x2e8a[_0x50a1f6];return _0x84f8d4;};'use strict';function FreshsalesAccount(_0x34856e){this['id']=_0x34856e['id']||0x0;this[_0xa2e8('0x0')]=_0x34856e[_0xa2e8('0x0')]||'';this['username']=_0x34856e[_0xa2e8('0x1')]||'';this[_0xa2e8('0x2')]=_0x34856e['token']||'';this[_0xa2e8('0x3')]=_0x34856e['remoteUri']||'';this['serverUrl']=_0x34856e['serverUrl']||'';this['Configurations']=_0x34856e[_0xa2e8('0x4')]||{};}module[_0xa2e8('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x36b2=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x33f143,_0xc9af7f){var _0x59a178=function(_0x59d621){while(--_0x59d621){_0x33f143['push'](_0x33f143['shift']());}};_0x59a178(++_0xc9af7f);}(_0x36b2,0x6b));var _0x236b=function(_0x475fef,_0x243818){_0x475fef=_0x475fef-0x0;var _0x1c090a=_0x36b2[_0x475fef];return _0x1c090a;};'use strict';function FreshsalesAccount(_0x356e23){this['id']=_0x356e23['id']||0x0;this[_0x236b('0x0')]=_0x356e23[_0x236b('0x0')]||'';this['username']=_0x356e23[_0x236b('0x1')]||'';this[_0x236b('0x2')]=_0x356e23[_0x236b('0x3')]||'';this['remoteUri']=_0x356e23[_0x236b('0x4')]||'';this[_0x236b('0x5')]=_0x356e23['serverUrl']||'';this[_0x236b('0x6')]=_0x356e23[_0x236b('0x6')]||{};}module[_0x236b('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 770e74e..22dd2ec 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 _0x35ec=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count'];(function(_0x264eeb,_0xc05998){var _0xa45c83=function(_0x2a82d9){while(--_0x2a82d9){_0x264eeb['push'](_0x264eeb['shift']());}};_0xa45c83(++_0xc05998);}(_0x35ec,0x6a));var _0xc35e=function(_0x101dfc,_0x5af0d6){_0x101dfc=_0x101dfc-0x0;var _0xc840e=_0x35ec[_0x101dfc];return _0xc840e;};'use strict';function QueueReport(){this[_0xc35e('0x0')]=_0xc35e('0x1');this[_0xc35e('0x2')]='';this[_0xc35e('0x3')]='';this[_0xc35e('0x4')]='';this[_0xc35e('0x5')]='';this[_0xc35e('0x6')]=null;this[_0xc35e('0x7')]=null;this[_0xc35e('0x8')]=0x1;this[_0xc35e('0x9')]=0x1;this['queuecallerabandon']=![];this[_0xc35e('0xa')]=null;this[_0xc35e('0xb')]=![];this[_0xc35e('0xc')]=null;this[_0xc35e('0xd')]=![];this[_0xc35e('0xe')]=null;this['originalposition']=0x1;this[_0xc35e('0xf')]='';this[_0xc35e('0x10')]='';this[_0xc35e('0x11')]='';this['accountcode']='';this[_0xc35e('0x12')]='';this[_0xc35e('0x13')]='';this[_0xc35e('0x14')]='';this[_0xc35e('0x15')]=0x0;this[_0xc35e('0x16')]=![];this[_0xc35e('0x17')]='';this[_0xc35e('0x18')]=_0xc35e('0x19');this[_0xc35e('0x1a')]=0x0;this[_0xc35e('0x1b')]={};}module[_0xc35e('0x1c')]=QueueReport; \ No newline at end of file +var _0x9d52=['count','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x9d52,0x10c));var _0x29d5=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x9d52[_0x5c814d];return _0x89b71;};'use strict';function QueueReport(){this[_0x29d5('0x0')]=_0x29d5('0x1');this['uniqueid']='';this[_0x29d5('0x2')]='';this['calleridname']='';this[_0x29d5('0x3')]='';this[_0x29d5('0x4')]=null;this[_0x29d5('0x5')]=null;this[_0x29d5('0x6')]=0x1;this[_0x29d5('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x29d5('0x8')]=null;this[_0x29d5('0x9')]=![];this[_0x29d5('0xa')]=null;this[_0x29d5('0xb')]=0x1;this['channel']='';this[_0x29d5('0xc')]='';this[_0x29d5('0xd')]='';this[_0x29d5('0xe')]='';this[_0x29d5('0xf')]='';this[_0x29d5('0x10')]='';this[_0x29d5('0x11')]='';this['holdtime']=0x0;this[_0x29d5('0x12')]=![];this[_0x29d5('0x13')]='';this[_0x29d5('0x14')]=_0x29d5('0x15');this[_0x29d5('0x16')]=0x0;this[_0x29d5('0x17')]={};}module[_0x29d5('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 38c6308..3e04c92 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 _0xcbf4=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x580a2b,_0x191648){var _0x2533d5=function(_0x44a53d){while(--_0x44a53d){_0x580a2b['push'](_0x580a2b['shift']());}};_0x2533d5(++_0x191648);}(_0xcbf4,0x7c));var _0x4cbf=function(_0x2828ff,_0x45c267){_0x2828ff=_0x2828ff-0x0;var _0x368714=_0xcbf4[_0x2828ff];return _0x368714;};'use strict';function SalesforceAccount(_0x1105eb){this['id']=_0x1105eb['id']||0x0;this['name']=_0x1105eb[_0x4cbf('0x0')]||'';this[_0x4cbf('0x1')]=_0x1105eb[_0x4cbf('0x1')]||'';this[_0x4cbf('0x2')]=_0x1105eb[_0x4cbf('0x2')]||'';this[_0x4cbf('0x3')]=_0x1105eb[_0x4cbf('0x3')]||'';this['clientId']=_0x1105eb[_0x4cbf('0x4')]||'';this[_0x4cbf('0x5')]=_0x1105eb[_0x4cbf('0x5')]||'';this[_0x4cbf('0x6')]=_0x1105eb[_0x4cbf('0x6')]||'';this[_0x4cbf('0x7')]=_0x1105eb[_0x4cbf('0x7')]||_0x4cbf('0x8');this['serverUrl']=_0x1105eb[_0x4cbf('0x9')]||'';this[_0x4cbf('0xa')]=_0x1105eb['Configurations']||{};}module[_0x4cbf('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xdadd=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name'];(function(_0x5cc4b9,_0x299e83){var _0x55a1d4=function(_0x41883f){while(--_0x41883f){_0x5cc4b9['push'](_0x5cc4b9['shift']());}};_0x55a1d4(++_0x299e83);}(_0xdadd,0x18b));var _0xddad=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0xdadd[_0x4e0a03];return _0x2478fc;};'use strict';function SalesforceAccount(_0x392d2b){this['id']=_0x392d2b['id']||0x0;this[_0xddad('0x0')]=_0x392d2b['name']||'';this[_0xddad('0x1')]=_0x392d2b[_0xddad('0x1')]||'';this[_0xddad('0x2')]=_0x392d2b['remoteUri']||'';this[_0xddad('0x3')]=_0x392d2b['password']||'';this[_0xddad('0x4')]=_0x392d2b[_0xddad('0x4')]||'';this[_0xddad('0x5')]=_0x392d2b['clientSecret']||'';this[_0xddad('0x6')]=_0x392d2b['securityToken']||'';this[_0xddad('0x7')]=_0x392d2b[_0xddad('0x7')]||_0xddad('0x8');this['serverUrl']=_0x392d2b['serverUrl']||'';this[_0xddad('0x9')]=_0x392d2b[_0xddad('0x9')]||{};}module[_0xddad('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 0686df7..8579aee 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 _0xd4b2=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xd4b2,0x1ec));var _0x2d4b=function(_0x38231c,_0x1a5931){_0x38231c=_0x38231c-0x0;var _0x5be4e8=_0xd4b2[_0x38231c];return _0x5be4e8;};'use strict';function ServicenowAccount(_0x118f2c){this['id']=_0x118f2c['id']||0x0;this[_0x2d4b('0x0')]=_0x118f2c[_0x2d4b('0x0')]||'';this[_0x2d4b('0x1')]=_0x118f2c[_0x2d4b('0x1')]||'';this[_0x2d4b('0x2')]=_0x118f2c[_0x2d4b('0x2')]||'';this[_0x2d4b('0x3')]=_0x118f2c[_0x2d4b('0x3')]||'';this[_0x2d4b('0x4')]=_0x118f2c['serverUrl']||'';this[_0x2d4b('0x5')]=_0x118f2c[_0x2d4b('0x5')]||{};}module[_0x2d4b('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0467=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x0467,0x1d2));var _0x7046=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0467[_0x19e35c];return _0x3e1fe8;};'use strict';function ServicenowAccount(_0x4b6075){this['id']=_0x4b6075['id']||0x0;this['name']=_0x4b6075[_0x7046('0x0')]||'';this[_0x7046('0x1')]=_0x4b6075[_0x7046('0x1')]||'';this[_0x7046('0x2')]=_0x4b6075[_0x7046('0x2')]||'';this['remoteUri']=_0x4b6075[_0x7046('0x3')]||'';this[_0x7046('0x4')]=_0x4b6075[_0x7046('0x4')]||'';this['Configurations']=_0x4b6075[_0x7046('0x5')]||{};}module[_0x7046('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 9da5215..04cf48a 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 _0xa081=['Configurations','username','password','remoteUri','serverUrl'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0xa081,0x146));var _0x1a08=function(_0x399889,_0x2c3f11){_0x399889=_0x399889-0x0;var _0x56abe4=_0xa081[_0x399889];return _0x56abe4;};'use strict';function SugarcrmAccount(_0xc40d8){this['id']=_0xc40d8['id']||0x0;this['name']=_0xc40d8['name']||'';this['username']=_0xc40d8[_0x1a08('0x0')]||'';this[_0x1a08('0x1')]=_0xc40d8[_0x1a08('0x1')]||'';this[_0x1a08('0x2')]=_0xc40d8[_0x1a08('0x2')]||'';this[_0x1a08('0x3')]=_0xc40d8['serverUrl']||'';this[_0x1a08('0x4')]=_0xc40d8['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x8893=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x165fa0,_0x3a25a9){var _0x5d58bb=function(_0x2dfaee){while(--_0x2dfaee){_0x165fa0['push'](_0x165fa0['shift']());}};_0x5d58bb(++_0x3a25a9);}(_0x8893,0x1a8));var _0x3889=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x8893[_0x9b5bb2];return _0x2e1e92;};'use strict';function SugarcrmAccount(_0x5c2f00){this['id']=_0x5c2f00['id']||0x0;this[_0x3889('0x0')]=_0x5c2f00[_0x3889('0x0')]||'';this[_0x3889('0x1')]=_0x5c2f00[_0x3889('0x1')]||'';this[_0x3889('0x2')]=_0x5c2f00[_0x3889('0x2')]||'';this['remoteUri']=_0x5c2f00[_0x3889('0x3')]||'';this[_0x3889('0x4')]=_0x5c2f00[_0x3889('0x4')]||'';this['Configurations']=_0x5c2f00[_0x3889('0x5')]||{};}module[_0x3889('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 4d1986d..6b40b47 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 _0x7e7b=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x11886d,_0x56ad0b){var _0x59f423=function(_0x3e09fa){while(--_0x3e09fa){_0x11886d['push'](_0x11886d['shift']());}};_0x59f423(++_0x56ad0b);}(_0x7e7b,0x133));var _0xb7e7=function(_0x107fb8,_0x1503dc){_0x107fb8=_0x107fb8-0x0;var _0x193322=_0x7e7b[_0x107fb8];return _0x193322;};'use strict';function Telephone(_0x3741bf){this['id']=_0x3741bf['id']||0x0;this[_0xb7e7('0x0')]=_0x3741bf['name']||'';this[_0xb7e7('0x1')]=_0x3741bf[_0xb7e7('0x1')]||'';this[_0xb7e7('0x2')]=_0xb7e7('0x3');this[_0xb7e7('0x4')]=0x0;this[_0xb7e7('0x5')]=_0xb7e7('0x3');this[_0xb7e7('0x6')]='';}module[_0xb7e7('0x7')]=Telephone; \ No newline at end of file +var _0x30d3=['accountcode','state','unknown','stateTime','status','address','exports','name'];(function(_0x24f0ce,_0x249495){var _0x4e8ab7=function(_0x10de2c){while(--_0x10de2c){_0x24f0ce['push'](_0x24f0ce['shift']());}};_0x4e8ab7(++_0x249495);}(_0x30d3,0x9f));var _0x330d=function(_0x48a3d4,_0x423306){_0x48a3d4=_0x48a3d4-0x0;var _0x37406d=_0x30d3[_0x48a3d4];return _0x37406d;};'use strict';function Telephone(_0x3e6f9c){this['id']=_0x3e6f9c['id']||0x0;this['name']=_0x3e6f9c[_0x330d('0x0')]||'';this[_0x330d('0x1')]=_0x3e6f9c[_0x330d('0x1')]||'';this[_0x330d('0x2')]=_0x330d('0x3');this[_0x330d('0x4')]=0x0;this[_0x330d('0x5')]='unknown';this[_0x330d('0x6')]='';}module[_0x330d('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 1081ea3..419c6b5 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(_0x5295bd,_0x56517a){var _0x2ae369=function(_0x1b4138){while(--_0x1b4138){_0x5295bd['push'](_0x5295bd['shift']());}};_0x2ae369(++_0x56517a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x33da68,_0x26dea6){var _0x164425=function(_0x12fce7){while(--_0x12fce7){_0x33da68['push'](_0x33da68['shift']());}};_0x164425(++_0x26dea6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 eb6f390..bfde923 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x193d80,_0x110fd9){var _0x4dc86c=function(_0x2cd05b){while(--_0x2cd05b){_0x193d80['push'](_0x193d80['shift']());}};_0x4dc86c(++_0x110fd9);}(_0x4fc2,0x111));var _0x24fc=function(_0x7eee7,_0x3779a1){_0x7eee7=_0x7eee7-0x0;var _0x469f62=_0x4fc2[_0x7eee7];return _0x469f62;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1a85,0x178));var _0x51a8=function(_0x29ca3a,_0x118266){_0x29ca3a=_0x29ca3a-0x0;var _0x45371e=_0x1a85[_0x29ca3a];return _0x45371e;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4360895..a684b56 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 _0x328e=['port','domain','domainport','address','defaultuser','active','name','state','unknown','status','registry','indexOf','split','host'];(function(_0x30aea8,_0x5ebed8){var _0x135b21=function(_0x198145){while(--_0x198145){_0x30aea8['push'](_0x30aea8['shift']());}};_0x135b21(++_0x5ebed8);}(_0x328e,0x147));var _0xe328=function(_0x52ab84,_0x384d32){_0x52ab84=_0x52ab84-0x0;var _0x481d6a=_0x328e[_0x52ab84];return _0x481d6a;};'use strict';function Trunk(_0x3c5d08){this['id']=_0x3c5d08['id']||0x0;this[_0xe328('0x0')]=_0x3c5d08['active']||![];this['name']=_0x3c5d08[_0xe328('0x1')]||'';this[_0xe328('0x2')]=_0xe328('0x3');this['stateTime']=0x0;this[_0xe328('0x4')]=_0xe328('0x3');this[_0xe328('0x5')]=_0x3c5d08['registry']&&_0x3c5d08['registry'][_0xe328('0x6')](':')?_0x3c5d08[_0xe328('0x5')][_0xe328('0x7')](':')[0x0]:'';this[_0xe328('0x8')]='';this[_0xe328('0x9')]='';this[_0xe328('0xa')]='';this[_0xe328('0xb')]='';this['refresh']='';this['stateRegistry']=_0xe328('0x3');this['registrationtime']='';this[_0xe328('0xc')]='';this[_0xe328('0xd')]=_0x3c5d08[_0xe328('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x5a19=['state','unknown','stateTime','status','registry','host','domain','domainport','refresh','registrationtime','address','defaultuser','active','name'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5a19,0xc2));var _0x95a1=function(_0x43b22b,_0xea722c){_0x43b22b=_0x43b22b-0x0;var _0xd4e124=_0x5a19[_0x43b22b];return _0xd4e124;};'use strict';function Trunk(_0x33cd93){this['id']=_0x33cd93['id']||0x0;this[_0x95a1('0x0')]=_0x33cd93[_0x95a1('0x0')]||![];this[_0x95a1('0x1')]=_0x33cd93[_0x95a1('0x1')]||'';this[_0x95a1('0x2')]=_0x95a1('0x3');this[_0x95a1('0x4')]=0x0;this[_0x95a1('0x5')]=_0x95a1('0x3');this[_0x95a1('0x6')]=_0x33cd93[_0x95a1('0x6')]&&_0x33cd93[_0x95a1('0x6')]['indexOf'](':')?_0x33cd93[_0x95a1('0x6')]['split'](':')[0x0]:'';this[_0x95a1('0x7')]='';this['port']='';this[_0x95a1('0x8')]='';this[_0x95a1('0x9')]='';this[_0x95a1('0xa')]='';this['stateRegistry']=_0x95a1('0x3');this[_0x95a1('0xb')]='';this[_0x95a1('0xc')]='';this[_0x95a1('0xd')]=_0x33cd93[_0x95a1('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c05af66..55e45e4 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 _0xbcd9=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x5afeee,_0x89ba93){var _0x3f52c2=function(_0x4f9b2){while(--_0x4f9b2){_0x5afeee['push'](_0x5afeee['shift']());}};_0x3f52c2(++_0x89ba93);}(_0xbcd9,0x114));var _0x9bcd=function(_0x18102b,_0x4d8a49){_0x18102b=_0x18102b-0x0;var _0x5d0c46=_0xbcd9[_0x18102b];return _0x5d0c46;};'use strict';function voiceExtension(_0x537375){this['id']=_0x537375['id']||0x0;this[_0x9bcd('0x0')]=_0x537375[_0x9bcd('0x0')]||'';this[_0x9bcd('0x1')]=_0x537375[_0x9bcd('0x1')]||_0x9bcd('0x2');this[_0x9bcd('0x3')]=_0x537375[_0x9bcd('0x3')]||![];}module[_0x9bcd('0x4')]=voiceExtension; \ No newline at end of file +var _0xf395=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf395,0x154));var _0x5f39=function(_0xa7aaff,_0x474fdb){_0xa7aaff=_0xa7aaff-0x0;var _0x331295=_0xf395[_0xa7aaff];return _0x331295;};'use strict';function voiceExtension(_0x313113){this['id']=_0x313113['id']||0x0;this[_0x5f39('0x0')]=_0x313113[_0x5f39('0x0')]||'';this[_0x5f39('0x1')]=_0x313113[_0x5f39('0x1')]||_0x5f39('0x2');this['mandatoryDisposition']=_0x313113[_0x5f39('0x3')]||![];}module[_0x5f39('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 dfaec09..814b9ac 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 _0xb697=['mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent'];(function(_0x48b88d,_0x4304dc){var _0x39088b=function(_0xde5075){while(--_0xde5075){_0x48b88d['push'](_0x48b88d['shift']());}};_0x39088b(++_0x4304dc);}(_0xb697,0x1ef));var _0x7b69=function(_0x33b360,_0x1a33ae){_0x33b360=_0x33b360-0x0;var _0x31e9e7=_0xb697[_0x33b360];return _0x31e9e7;};'use strict';var statusDesc=[_0x7b69('0x0'),_0x7b69('0x1'),_0x7b69('0x2'),_0x7b69('0x3'),_0x7b69('0x4'),_0x7b69('0x5'),'ringing',_0x7b69('0x6'),_0x7b69('0x7')];var monitorFormat={'wav':_0x7b69('0x8'),'wav49':_0x7b69('0x9'),'gsm':_0x7b69('0xa')};var strategy={'rrmemory':_0x7b69('0xb'),'roundrobin':_0x7b69('0xc')};function VoiceQueue(_0x3f827a){this['id']=_0x3f827a['id']||0x0;this[_0x7b69('0xd')]=_0x3f827a[_0x7b69('0xd')]||'';this[_0x7b69('0xe')]=_0x3f827a[_0x7b69('0xe')]||'';this[_0x7b69('0xf')]=_0x3f827a[_0x7b69('0xf')]||_0x7b69('0x10');this[_0x7b69('0x11')]=0x0;this[_0x7b69('0x12')]=0x0;this[_0x7b69('0x13')]=0x0;this[_0x7b69('0x14')]=0x0;this['sumDuration']=0x0;this[_0x7b69('0x15')]=0x0;this['sumBillable']=0x0;this[_0x7b69('0x16')]=0x0;this[_0x7b69('0x17')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x7b69('0x18')]=_0x3f827a['acw']||![];this[_0x7b69('0x19')]=_0x3f827a[_0x7b69('0x19')]||0xa;this['autopause']=_0x3f827a[_0x7b69('0x1a')]||'no';this[_0x7b69('0x1b')]=!![];this['message']='';this[_0x7b69('0x1c')]=0x0;this['temp']=0x0;this[_0x7b69('0x1d')]=_0x3f827a['dialTimezone']||null;this[_0x7b69('0x1e')]=_0x3f827a[_0x7b69('0x1e')]?_0x3f827a[_0x7b69('0x1e')]:null;this[_0x7b69('0x1f')]=_0x3f827a[_0x7b69('0x1f')];this[_0x7b69('0x20')]=_0x3f827a[_0x7b69('0x20')]||_0x7b69('0x21');this[_0x7b69('0x22')]=_0x3f827a['dialLimitChannel']||0x0;this[_0x7b69('0x23')]=_0x3f827a[_0x7b69('0x23')]||0x0;this[_0x7b69('0x24')]=_0x3f827a[_0x7b69('0x24')]||0x1;this[_0x7b69('0x25')]=_0x3f827a[_0x7b69('0x25')]||'dropRate';this[_0x7b69('0x26')]=_0x3f827a[_0x7b69('0x26')]||0.03;this['dialPredictiveInterval']=_0x3f827a[_0x7b69('0x27')]||0x258;this[_0x7b69('0x28')]=_0x3f827a[_0x7b69('0x28')]||_0x7b69('0x29');this['dialOriginateCallerIdNumber']=_0x3f827a['dialOriginateCallerIdNumber']||_0x7b69('0x29');this[_0x7b69('0x2a')]=_0x3f827a[_0x7b69('0x2a')]||0x1e;this[_0x7b69('0x2b')]=_0x3f827a[_0x7b69('0x2b')]||_0x7b69('0x2c');this[_0x7b69('0x2d')]=_0x3f827a[_0x7b69('0x2d')]||0x3;this[_0x7b69('0x2e')]=_0x3f827a[_0x7b69('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x3f827a[_0x7b69('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x3f827a[_0x7b69('0x30')]||0x96;this[_0x7b69('0x31')]=_0x3f827a[_0x7b69('0x31')]||0x3;this[_0x7b69('0x32')]=_0x3f827a['dialBusyRetryFrequency']||0x96;this[_0x7b69('0x33')]=_0x3f827a[_0x7b69('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3f827a['dialNoAnswerRetryFrequency']||0x96;this[_0x7b69('0x34')]=_0x3f827a['dialNoSuchNumberMaxRetry']||0x3;this[_0x7b69('0x35')]=_0x3f827a[_0x7b69('0x35')]||0x96;this[_0x7b69('0x36')]=_0x3f827a[_0x7b69('0x36')]||0x3;this[_0x7b69('0x37')]=_0x3f827a[_0x7b69('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x3f827a[_0x7b69('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x3f827a[_0x7b69('0x39')]||0x96;this[_0x7b69('0x3a')]=_0x3f827a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x3f827a[_0x7b69('0x3b')]||0x96;this[_0x7b69('0x3c')]=_0x3f827a[_0x7b69('0x3c')]||0x3;this[_0x7b69('0x3d')]=_0x3f827a[_0x7b69('0x3d')]||0x96;this[_0x7b69('0x3e')]=_0x3f827a[_0x7b69('0x3e')]||0x3;this[_0x7b69('0x3f')]=_0x3f827a[_0x7b69('0x3f')]||0x4;this[_0x7b69('0x40')]=_0x3f827a[_0x7b69('0x40')]?_0x3f827a[_0x7b69('0x40')]:undefined;this['TrunkBackup']=_0x3f827a[_0x7b69('0x41')]?_0x3f827a[_0x7b69('0x41')]:undefined;this['dialPrefix']=_0x3f827a[_0x7b69('0x42')]||undefined;this[_0x7b69('0x43')]=_0x3f827a[_0x7b69('0x43')]?_0x3f827a[_0x7b69('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x3f827a[_0x7b69('0x44')]||'DESC';this[_0x7b69('0x45')]=_0x3f827a[_0x7b69('0x45')]||undefined;this[_0x7b69('0x46')]=_0x3f827a['dialCutDigit']||undefined;this[_0x7b69('0x47')]=strategy[_0x3f827a[_0x7b69('0x47')]]||_0x7b69('0xb');this[_0x7b69('0x48')]=!![];this[_0x7b69('0x49')]=_0x3f827a[_0x7b69('0x49')]||![];this[_0x7b69('0x4a')]=_0x3f827a[_0x7b69('0x4a')];this[_0x7b69('0x4b')]=_0x3f827a[_0x7b69('0x4b')];this[_0x7b69('0x4c')]=_0x3f827a[_0x7b69('0x4c')];this['dialAMDTotalAnalysisTime']=_0x3f827a[_0x7b69('0x4d')];this[_0x7b69('0x4e')]=_0x3f827a[_0x7b69('0x4e')];this[_0x7b69('0x4f')]=_0x3f827a[_0x7b69('0x4f')];this[_0x7b69('0x50')]=_0x3f827a['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x3f827a[_0x7b69('0x51')];this[_0x7b69('0x52')]=_0x3f827a[_0x7b69('0x52')];this[_0x7b69('0x53')]=0x0;this[_0x7b69('0x54')]=0x0;this[_0x7b69('0x55')]=_0x3f827a[_0x7b69('0x55')];this['outboundAnswerCallsDay']=0x0;this[_0x7b69('0x56')]=0x0;this[_0x7b69('0x57')]=0x0;this[_0x7b69('0x58')]=0x0;this[_0x7b69('0x59')]=0x0;this[_0x7b69('0x5a')]=0x0;this[_0x7b69('0x5b')]=0x0;this[_0x7b69('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x7b69('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x7b69('0x5e')]=0x0;this[_0x7b69('0x5f')]=0x0;this[_0x7b69('0x60')]=0x0;this[_0x7b69('0x61')]=undefined;this[_0x7b69('0x62')]=undefined;this['handlePredictive']=undefined;this[_0x7b69('0x63')]=1.05;this[_0x7b69('0x64')]=0x0;this[_0x7b69('0x65')]=0x0;this[_0x7b69('0x66')]=0x0;this[_0x7b69('0x67')]=0x0;this[_0x7b69('0x68')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x7b69('0x69')]=0x0;this[_0x7b69('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3f827a[_0x7b69('0x6b')]||0x14;this[_0x7b69('0x6c')]=_0x3f827a[_0x7b69('0x6b')]||0xa;this[_0x7b69('0x6d')]=0x0;this[_0x7b69('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7b69('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7b69('0x70')]=0x0;this[_0x7b69('0x71')]=0x0;this['dialRecallMeTimeout']=_0x3f827a['dialRecallMeTimeout']||0x1e;this[_0x7b69('0x72')]=_0x3f827a['dialRecallInQueue']||![];this[_0x7b69('0x73')]=!!_0x3f827a['dialPreviewAutoRecallMe']||![];this[_0x7b69('0x74')]=!!_0x3f827a[_0x7b69('0x74')]||![];this[_0x7b69('0x75')]=_0x3f827a[_0x7b69('0x75')]||undefined;this[_0x7b69('0x76')]=_0x3f827a[_0x7b69('0x76')]||![];this[_0x7b69('0x77')]=_0x3f827a[_0x7b69('0x77')]||![];this[_0x7b69('0xe')]=monitorFormat[_0x3f827a[_0x7b69('0xe')]]?monitorFormat[_0x3f827a[_0x7b69('0xe')]]:undefined;this[_0x7b69('0x78')]=_0x3f827a['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x3f827a['mandatoryDispositionPause']?_0x3f827a[_0x7b69('0x79')]:undefined;}module[_0x7b69('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x5633=['name','monitor_format','type','inbound','talking','total','answered','sumDuration','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x5633,0xe8));var _0x3563=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5633[_0xf50820];return _0x2a9b10;};'use strict';var statusDesc=[_0x3563('0x0'),'not_inuse','inuse',_0x3563('0x1'),_0x3563('0x2'),_0x3563('0x3'),_0x3563('0x4'),_0x3563('0x5'),_0x3563('0x6')];var monitorFormat={'wav':_0x3563('0x7'),'wav49':'wav49','gsm':_0x3563('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x3563('0x9')};function VoiceQueue(_0x58eb43){this['id']=_0x58eb43['id']||0x0;this[_0x3563('0xa')]=_0x58eb43['name']||'';this[_0x3563('0xb')]=_0x58eb43[_0x3563('0xb')]||'';this[_0x3563('0xc')]=_0x58eb43[_0x3563('0xc')]||_0x3563('0xd');this['waiting']=0x0;this[_0x3563('0xe')]=0x0;this[_0x3563('0xf')]=0x0;this[_0x3563('0x10')]=0x0;this[_0x3563('0x11')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x3563('0x12')]=0x0;this[_0x3563('0x13')]=0x0;this['loggedIn']=0x0;this[_0x3563('0x14')]=0x0;this[_0x3563('0x15')]=_0x58eb43[_0x3563('0x15')]||![];this[_0x3563('0x16')]=_0x58eb43[_0x3563('0x16')]||0xa;this['autopause']=_0x58eb43[_0x3563('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0x3563('0x18')]='';this[_0x3563('0x19')]=0x0;this[_0x3563('0x1a')]=0x0;this[_0x3563('0x1b')]=_0x58eb43['dialTimezone']||null;this[_0x3563('0x1c')]=_0x58eb43[_0x3563('0x1c')]?_0x58eb43[_0x3563('0x1c')]:null;this[_0x3563('0x1d')]=_0x58eb43[_0x3563('0x1d')];this['dialMethod']=_0x58eb43[_0x3563('0x1e')]||_0x3563('0x1f');this[_0x3563('0x20')]=_0x58eb43['dialLimitChannel']||0x0;this[_0x3563('0x21')]=_0x58eb43[_0x3563('0x21')]||0x0;this[_0x3563('0x22')]=_0x58eb43[_0x3563('0x22')]||0x1;this['dialPredictiveOptimization']=_0x58eb43['dialPredictiveOptimization']||_0x3563('0x23');this[_0x3563('0x24')]=_0x58eb43[_0x3563('0x24')]||0.03;this['dialPredictiveInterval']=_0x58eb43[_0x3563('0x25')]||0x258;this[_0x3563('0x26')]=_0x58eb43[_0x3563('0x26')]||_0x3563('0x27');this[_0x3563('0x28')]=_0x58eb43[_0x3563('0x28')]||_0x3563('0x27');this[_0x3563('0x29')]=_0x58eb43[_0x3563('0x29')]||0x1e;this[_0x3563('0x2a')]=_0x58eb43['dialQueueOptions']||'tTxX';this[_0x3563('0x2b')]=_0x58eb43[_0x3563('0x2b')]||0x3;this[_0x3563('0x2c')]=_0x58eb43[_0x3563('0x2c')]||undefined;this[_0x3563('0x2d')]=_0x58eb43['dialCongestionMaxRetry']||0x3;this[_0x3563('0x2e')]=_0x58eb43[_0x3563('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x58eb43[_0x3563('0x2f')]||0x3;this[_0x3563('0x30')]=_0x58eb43[_0x3563('0x30')]||0x96;this[_0x3563('0x31')]=_0x58eb43[_0x3563('0x31')]||0x3;this[_0x3563('0x32')]=_0x58eb43[_0x3563('0x32')]||0x96;this[_0x3563('0x33')]=_0x58eb43[_0x3563('0x33')]||0x3;this[_0x3563('0x34')]=_0x58eb43['dialNoSuchNumberRetryFrequency']||0x96;this[_0x3563('0x35')]=_0x58eb43['dialDropMaxRetry']||0x3;this[_0x3563('0x36')]=_0x58eb43[_0x3563('0x36')]||0x96;this[_0x3563('0x37')]=_0x58eb43[_0x3563('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x58eb43['dialAbandonedRetryFrequency']||0x96;this[_0x3563('0x38')]=_0x58eb43['dialMachineMaxRetry']||0x3;this[_0x3563('0x39')]=_0x58eb43[_0x3563('0x39')]||0x96;this[_0x3563('0x3a')]=_0x58eb43[_0x3563('0x3a')]||0x3;this[_0x3563('0x3b')]=_0x58eb43[_0x3563('0x3b')]||0x96;this[_0x3563('0x3c')]=_0x58eb43[_0x3563('0x3c')]||0x3;this[_0x3563('0x3d')]=_0x58eb43[_0x3563('0x3d')]||0x4;this['Trunk']=_0x58eb43['Trunk']?_0x58eb43[_0x3563('0x3e')]:undefined;this['TrunkBackup']=_0x58eb43[_0x3563('0x3f')]?_0x58eb43[_0x3563('0x3f')]:undefined;this[_0x3563('0x40')]=_0x58eb43['dialPrefix']||undefined;this[_0x3563('0x41')]=_0x58eb43[_0x3563('0x41')]?_0x58eb43['Interval']:undefined;this[_0x3563('0x42')]=_0x58eb43[_0x3563('0x42')]||_0x3563('0x43');this[_0x3563('0x44')]=_0x58eb43[_0x3563('0x44')]||undefined;this['dialCutDigit']=_0x58eb43['dialCutDigit']||undefined;this[_0x3563('0x45')]=strategy[_0x58eb43[_0x3563('0x45')]]||_0x3563('0x46');this[_0x3563('0x47')]=!![];this[_0x3563('0x48')]=_0x58eb43[_0x3563('0x48')]||![];this['dialAMDInitialSilence']=_0x58eb43[_0x3563('0x49')];this[_0x3563('0x4a')]=_0x58eb43[_0x3563('0x4a')];this['dialAMDAfterGreetingSilence']=_0x58eb43[_0x3563('0x4b')];this[_0x3563('0x4c')]=_0x58eb43[_0x3563('0x4c')];this[_0x3563('0x4d')]=_0x58eb43[_0x3563('0x4d')];this[_0x3563('0x4e')]=_0x58eb43[_0x3563('0x4e')];this[_0x3563('0x4f')]=_0x58eb43['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x58eb43['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x58eb43[_0x3563('0x50')];this[_0x3563('0x51')]=0x0;this['pTalking']=0x0;this['timeout']=_0x58eb43[_0x3563('0x52')];this[_0x3563('0x53')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x3563('0x54')]=0x0;this[_0x3563('0x55')]=0x0;this[_0x3563('0x56')]=0x0;this[_0x3563('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x3563('0x58')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x3563('0x59')]=0x0;this[_0x3563('0x5a')]=0x0;this[_0x3563('0x5b')]=0x0;this[_0x3563('0x5c')]=0x0;this[_0x3563('0x5d')]=undefined;this[_0x3563('0x5e')]=undefined;this[_0x3563('0x5f')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x3563('0x60')]=0x0;this[_0x3563('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x3563('0x62')]=0x0;this[_0x3563('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x3563('0x64')]=0x0;this[_0x3563('0x65')]=0x0;this[_0x3563('0x66')]=_0x58eb43[_0x3563('0x67')]||0x14;this[_0x3563('0x68')]=_0x58eb43[_0x3563('0x67')]||0xa;this[_0x3563('0x69')]=0x0;this[_0x3563('0x6a')]=0x0;this[_0x3563('0x6b')]=0x1;this['erlangCalls']=0x0;this[_0x3563('0x6c')]=0x0;this[_0x3563('0x6d')]=0x0;this[_0x3563('0x6e')]=0x0;this[_0x3563('0x6f')]=_0x58eb43[_0x3563('0x6f')]||0x1e;this[_0x3563('0x70')]=_0x58eb43[_0x3563('0x70')]||![];this['dialPreviewAutoRecallMe']=!!_0x58eb43[_0x3563('0x71')]||![];this['dialPreviewRecallmeReminder']=!!_0x58eb43[_0x3563('0x72')]||![];this['dialQueueProject2']=_0x58eb43[_0x3563('0x73')]||undefined;this[_0x3563('0x74')]=_0x58eb43['dialAgiAfterHangupClient']||![];this[_0x3563('0x75')]=_0x58eb43[_0x3563('0x75')]||![];this['monitor_format']=monitorFormat[_0x58eb43[_0x3563('0xb')]]?monitorFormat[_0x58eb43[_0x3563('0xb')]]:undefined;this[_0x3563('0x76')]=_0x58eb43[_0x3563('0x76')]||![];this['mandatoryDispositionPause']=_0x58eb43['mandatoryDispositionPause']?_0x58eb43[_0x3563('0x77')]:undefined;}module[_0x3563('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2c22039..0980f12 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 _0x52a0=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4d09ab,_0x269112){var _0x4ba5e8=function(_0x31807a){while(--_0x31807a){_0x4d09ab['push'](_0x4d09ab['shift']());}};_0x4ba5e8(++_0x269112);}(_0x52a0,0x149));var _0x052a=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x52a0[_0x279e6f];return _0x489a5f;};'use strict';function VtigerAccount(_0x1db034){this['id']=_0x1db034['id']||0x0;this[_0x052a('0x0')]=_0x1db034[_0x052a('0x0')]||'';this[_0x052a('0x1')]=_0x1db034[_0x052a('0x1')]||'';this[_0x052a('0x2')]=_0x1db034[_0x052a('0x2')]||'';this['remoteUri']=_0x1db034[_0x052a('0x3')]||'';this[_0x052a('0x4')]=_0x1db034['serverUrl']||'';this[_0x052a('0x5')]=_0x1db034[_0x052a('0x5')]||{};}module[_0x052a('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe9f3=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x2bf706,_0x30c798){var _0x146156=function(_0x1fd68c){while(--_0x1fd68c){_0x2bf706['push'](_0x2bf706['shift']());}};_0x146156(++_0x30c798);}(_0xe9f3,0xe7));var _0x3e9f=function(_0x379c0d,_0x41c5d8){_0x379c0d=_0x379c0d-0x0;var _0x569f71=_0xe9f3[_0x379c0d];return _0x569f71;};'use strict';function VtigerAccount(_0x181fa5){this['id']=_0x181fa5['id']||0x0;this['name']=_0x181fa5[_0x3e9f('0x0')]||'';this[_0x3e9f('0x1')]=_0x181fa5[_0x3e9f('0x1')]||'';this[_0x3e9f('0x2')]=_0x181fa5['accessKey']||'';this[_0x3e9f('0x3')]=_0x181fa5[_0x3e9f('0x3')]||'';this[_0x3e9f('0x4')]=_0x181fa5['serverUrl']||'';this['Configurations']=_0x181fa5[_0x3e9f('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index be0426a..7cea882 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 _0x88a0=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x88a0,0x6a));var _0x088a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x88a0[_0x501510];return _0x1e6ee5;};'use strict';function ZendeskAccount(_0x4f6351){this['id']=_0x4f6351['id']||0x0;this[_0x088a('0x0')]=_0x4f6351[_0x088a('0x0')]||'';this['username']=_0x4f6351[_0x088a('0x1')]||'';this[_0x088a('0x2')]=_0x4f6351[_0x088a('0x2')]||'';this[_0x088a('0x3')]=_0x4f6351[_0x088a('0x3')]||'';this[_0x088a('0x4')]=_0x4f6351[_0x088a('0x4')]||'';this[_0x088a('0x5')]=_0x4f6351[_0x088a('0x5')]||'';this[_0x088a('0x6')]=_0x4f6351['type']||_0x088a('0x7');this[_0x088a('0x8')]=_0x4f6351[_0x088a('0x8')]||'';this[_0x088a('0x9')]=_0x4f6351[_0x088a('0x9')]||{};}module[_0x088a('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x2c4b=['name','username','password','token','remoteUri','authType','serverUrl','Configurations'];(function(_0x3777b8,_0x26abd2){var _0x14817b=function(_0x2f373c){while(--_0x2f373c){_0x3777b8['push'](_0x3777b8['shift']());}};_0x14817b(++_0x26abd2);}(_0x2c4b,0x180));var _0xb2c4=function(_0x55afc1,_0x25d8fc){_0x55afc1=_0x55afc1-0x0;var _0x150431=_0x2c4b[_0x55afc1];return _0x150431;};'use strict';function ZendeskAccount(_0x50099a){this['id']=_0x50099a['id']||0x0;this[_0xb2c4('0x0')]=_0x50099a['name']||'';this[_0xb2c4('0x1')]=_0x50099a['username']||'';this[_0xb2c4('0x2')]=_0x50099a[_0xb2c4('0x2')]||'';this['token']=_0x50099a[_0xb2c4('0x3')]||'';this['remoteUri']=_0x50099a[_0xb2c4('0x4')]||'';this['authType']=_0x50099a[_0xb2c4('0x5')]||'';this['type']=_0x50099a['type']||'integrationTab';this[_0xb2c4('0x6')]=_0x50099a['serverUrl']||'';this[_0xb2c4('0x7')]=_0x50099a[_0xb2c4('0x7')]||{};}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 318b3ea..65f0f93 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 _0xff5e=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x1211ab,_0x4577e1){var _0x47573d=function(_0x459cb0){while(--_0x459cb0){_0x1211ab['push'](_0x1211ab['shift']());}};_0x47573d(++_0x4577e1);}(_0xff5e,0x12c));var _0xeff5=function(_0x4db19d,_0x539f1d){_0x4db19d=_0x4db19d-0x0;var _0x3b62b4=_0xff5e[_0x4db19d];return _0x3b62b4;};'use strict';function ZohoAccount(_0x36bfe8){this['id']=_0x36bfe8['id']||0x0;this[_0xeff5('0x0')]=_0x36bfe8['name']||'';this['description']=_0x36bfe8[_0xeff5('0x1')]||'';this[_0xeff5('0x2')]=_0x36bfe8['host']||'';this[_0xeff5('0x3')]=_0x36bfe8[_0xeff5('0x3')]||'';this[_0xeff5('0x4')]=_0x36bfe8['clientId']||'';this[_0xeff5('0x5')]=_0x36bfe8[_0xeff5('0x5')]||'';this[_0xeff5('0x6')]=_0x36bfe8[_0xeff5('0x6')]||'';this[_0xeff5('0x7')]=_0x36bfe8['code']||'';this[_0xeff5('0x8')]=_0x36bfe8[_0xeff5('0x8')]||'';this[_0xeff5('0x9')]=_0x36bfe8[_0xeff5('0x9')]||{};}module[_0xeff5('0xa')]=ZohoAccount; \ No newline at end of file +var _0xba1e=['Configurations','exports','name','description','host','clientSecret','serverUrl','code','refreshToken'];(function(_0x483d76,_0x2c0f05){var _0x2dbecd=function(_0x4ab398){while(--_0x4ab398){_0x483d76['push'](_0x483d76['shift']());}};_0x2dbecd(++_0x2c0f05);}(_0xba1e,0x9b));var _0xeba1=function(_0x2f93d7,_0xc79a48){_0x2f93d7=_0x2f93d7-0x0;var _0x2925e9=_0xba1e[_0x2f93d7];return _0x2925e9;};'use strict';function ZohoAccount(_0x2b2f6d){this['id']=_0x2b2f6d['id']||0x0;this['name']=_0x2b2f6d[_0xeba1('0x0')]||'';this[_0xeba1('0x1')]=_0x2b2f6d['description']||'';this[_0xeba1('0x2')]=_0x2b2f6d[_0xeba1('0x2')]||'';this['zone']=_0x2b2f6d['zone']||'';this['clientId']=_0x2b2f6d['clientId']||'';this[_0xeba1('0x3')]=_0x2b2f6d['clientSecret']||'';this[_0xeba1('0x4')]=_0x2b2f6d[_0xeba1('0x4')]||'';this[_0xeba1('0x5')]=_0x2b2f6d['code']||'';this[_0xeba1('0x6')]=_0x2b2f6d['refreshToken']||'';this[_0xeba1('0x7')]=_0x2b2f6d[_0xeba1('0x7')]||{};}module[_0xeba1('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9b73a41..0cb8baa 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 _0x32f4=['isNil','uniqueid','queue','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','calleridname','exports','util','lodash','moment','string'];(function(_0xde9879,_0x22f5b5){var _0x393fa2=function(_0x23b6ff){while(--_0x23b6ff){_0xde9879['push'](_0xde9879['shift']());}};_0x393fa2(++_0x22f5b5);}(_0x32f4,0x154));var _0x432f=function(_0x3b60d7,_0x5ea279){_0x3b60d7=_0x3b60d7-0x0;var _0x163a86=_0x32f4[_0x3b60d7];return _0x163a86;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));function checkNameSurname(_0x2b22ad,_0x5ee65a,_0x2a4628){var _0x6f0e8a='';if(!_['isNil'](_0x5ee65a)&&_0x432f('0x3')===typeof _0x5ee65a){_0x6f0e8a+=_0x5ee65a;}if(!_[_0x432f('0x4')](_0x2a4628)&&_0x432f('0x3')===typeof _0x2a4628){_0x6f0e8a+='\x20'+_0x2a4628;}if(_0x6f0e8a!==''){return _0x6f0e8a;}return _0x2b22ad;}function Action(_0x355b02,_0x2f5f03,_0x5d8cc0,_0x5b5f08,_0x2f66fd){this[_0x432f('0x5')]=_0x5d8cc0||undefined;this['idContact']=_0x355b02['id'];this[_0x432f('0x6')]=_0x2f5f03['name'];this[_0x432f('0x7')]=_0x2f5f03[_0x432f('0x7')];this[_0x432f('0x8')]=_0x432f('0x6');this[_0x432f('0x9')]=![];this['membername']=_[_0x432f('0x4')](_0x355b02['Agent'])?undefined:_0x355b02[_0x432f('0xa')]['name'];this[_0x432f('0xb')]=this[_0x432f('0xc')]?util['format'](_0x432f('0xd'),this[_0x432f('0xc')]):_0x5b5f08||undefined;this['calleridname']=checkNameSurname(_0x355b02[_0x432f('0xe')][_0x432f('0xf')],_0x355b02['Contact']['firstName'],_0x355b02[_0x432f('0xe')][_0x432f('0x10')]);this[_0x432f('0x11')]=_0x355b02[_0x432f('0x11')]||![];this[_0x432f('0x12')]=_0x355b02['phone'];this[_0x432f('0x13')]=_0x355b02[_0x432f('0x13')];this[_0x432f('0x14')]=_0x355b02[_0x432f('0x14')]||0x0;this['countcongestionretry']=_0x355b02[_0x432f('0x15')]||0x0;this[_0x432f('0x16')]=_0x355b02[_0x432f('0x16')]||0x0;this[_0x432f('0x17')]=(_0x355b02[_0x432f('0x14')]||0x0)+(_0x355b02[_0x432f('0x15')]||0x0)+(_0x355b02['countnoanswerretry']||0x0)+(_0x355b02[_0x432f('0x18')]||0x0)+(_0x355b02['countdropretry']||0x0)+(_0x355b02[_0x432f('0x19')]||0x0)+(_0x355b02[_0x432f('0x1a')]||0x0)+(_0x355b02[_0x432f('0x1b')]||0x0);this[_0x432f('0x18')]=_0x355b02[_0x432f('0x18')]||0x0;this[_0x432f('0x1c')]=_0x355b02[_0x432f('0x1c')]||0x0;this[_0x432f('0x19')]=_0x355b02[_0x432f('0x19')]||0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this[_0x432f('0x1b')]=_0x355b02['countagentrejectretry']||0x0;this['callback']=_0x355b02[_0x432f('0x1d')];this['callbackuniqueid']=_0x355b02[_0x432f('0x1e')];this['callbackat']=_0x355b02[_0x432f('0x1f')];this[_0x432f('0x20')]=_0x355b02[_0x432f('0x20')];this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')];this[_0x432f('0x22')]=_0x355b02['ListId'];this[_0x432f('0x23')]=_[_0x432f('0x4')](_0x355b02['Agent'])?_0x355b02[_0x432f('0x23')]:_0x355b02[_0x432f('0xa')]['id'];this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')];this[_0x432f('0x25')]='';this[_0x432f('0x26')]='';}Action[_0x432f('0x27')]['getCaller']=function(){return util[_0x432f('0x28')]('\x22%s\x22\x20<%s>',this[_0x432f('0x29')],this['number']);};module[_0x432f('0x2a')]=Action; \ No newline at end of file +var _0x4213=['name','type','dialAnswer','isNil','Agent','channelAgent','membername','format','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','number','util','lodash','moment','string','uniqueid','idContact','queue'];(function(_0x4bdfce,_0x50af49){var _0x636627=function(_0x1f181e){while(--_0x1f181e){_0x4bdfce['push'](_0x4bdfce['shift']());}};_0x636627(++_0x50af49);}(_0x4213,0x77));var _0x3421=function(_0xaf239d,_0xa8d009){_0xaf239d=_0xaf239d-0x0;var _0x131aec=_0x4213[_0xaf239d];return _0x131aec;};'use strict';var util=require(_0x3421('0x0'));var _=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));function checkNameSurname(_0x7870a4,_0x2613b6,_0x153f3a){var _0x1bab18='';if(!_['isNil'](_0x2613b6)&&_0x3421('0x3')===typeof _0x2613b6){_0x1bab18+=_0x2613b6;}if(!_['isNil'](_0x153f3a)&&_0x3421('0x3')===typeof _0x153f3a){_0x1bab18+='\x20'+_0x153f3a;}if(_0x1bab18!==''){return _0x1bab18;}return _0x7870a4;}function Action(_0xfe969c,_0x2155f8,_0x2a04e0,_0x5469d8,_0x50e464){this[_0x3421('0x4')]=_0x2a04e0||undefined;this[_0x3421('0x5')]=_0xfe969c['id'];this[_0x3421('0x6')]=_0x2155f8[_0x3421('0x7')];this['type']=_0x2155f8[_0x3421('0x8')];this['campaigntype']='queue';this[_0x3421('0x9')]=![];this['membername']=_[_0x3421('0xa')](_0xfe969c[_0x3421('0xb')])?undefined:_0xfe969c[_0x3421('0xb')][_0x3421('0x7')];this[_0x3421('0xc')]=this[_0x3421('0xd')]?util[_0x3421('0xe')]('SIP/%s',this[_0x3421('0xd')]):_0x5469d8||undefined;this[_0x3421('0xf')]=checkNameSurname(_0xfe969c[_0x3421('0x10')][_0x3421('0x11')],_0xfe969c[_0x3421('0x10')][_0x3421('0x12')],_0xfe969c[_0x3421('0x10')]['lastName']);this[_0x3421('0x13')]=_0xfe969c['active']||![];this[_0x3421('0x14')]=_0xfe969c[_0x3421('0x11')];this['scheduledat']=_0xfe969c[_0x3421('0x15')];this['countbusyretry']=_0xfe969c[_0x3421('0x16')]||0x0;this[_0x3421('0x17')]=_0xfe969c['countcongestionretry']||0x0;this[_0x3421('0x18')]=_0xfe969c[_0x3421('0x18')]||0x0;this[_0x3421('0x19')]=(_0xfe969c[_0x3421('0x16')]||0x0)+(_0xfe969c[_0x3421('0x17')]||0x0)+(_0xfe969c[_0x3421('0x18')]||0x0)+(_0xfe969c[_0x3421('0x1a')]||0x0)+(_0xfe969c[_0x3421('0x1b')]||0x0)+(_0xfe969c[_0x3421('0x1c')]||0x0)+(_0xfe969c[_0x3421('0x1d')]||0x0)+(_0xfe969c[_0x3421('0x1e')]||0x0);this['countnosuchnumberretry']=_0xfe969c[_0x3421('0x1a')]||0x0;this['countdropretry']=_0xfe969c['countdropretry']||0x0;this['countabandonedretry']=_0xfe969c[_0x3421('0x1c')]||0x0;this[_0x3421('0x1d')]=_0xfe969c[_0x3421('0x1d')]||0x0;this[_0x3421('0x1e')]=_0xfe969c[_0x3421('0x1e')]||0x0;this[_0x3421('0x1f')]=_0xfe969c[_0x3421('0x1f')];this[_0x3421('0x20')]=_0xfe969c[_0x3421('0x20')];this[_0x3421('0x21')]=_0xfe969c['callbackat'];this['recallme']=_0xfe969c['recallme'];this[_0x3421('0x22')]=_0xfe969c[_0x3421('0x22')];this[_0x3421('0x23')]=_0xfe969c['ListId'];this['UserId']=_[_0x3421('0xa')](_0xfe969c['Agent'])?_0xfe969c[_0x3421('0x24')]:_0xfe969c['Agent']['id'];this[_0x3421('0x25')]=_0xfe969c[_0x3421('0x25')];this[_0x3421('0x26')]='';this[_0x3421('0x27')]='';}Action[_0x3421('0x28')]['getCaller']=function(){return util[_0x3421('0xe')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x3421('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6302025..855039e 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 _0xa9e0=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file +var _0xa9e0=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','additional','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','status','SIP/%s','execRun','recallme','validateContact','isValid','phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','socket.io-emitter','redis','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var ami=require('../ami');var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require(_0x0a9e('0x9'));var Action=require(_0x0a9e('0xa'));var ut=require('./util/util');config['redis']=_[_0x0a9e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0xc'))(new Redis(config[_0x0a9e('0xd')]));var Sequence=function(){};Sequence[_0x0a9e('0xe')][_0x0a9e('0xf')]=function(_0xfeb75b){this[_0x0a9e('0x10')]=this['tail']?this['tail']['finally'](_0xfeb75b):_0xfeb75b();};function Preview(_0x4cfe67){this[_0x0a9e('0x11')]=new Sequence();this[_0x0a9e('0x12')]=_0x4cfe67[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x4cfe67[_0x0a9e('0x14')];this[_0x0a9e('0x15')]={};this['agents']=_0x4cfe67[_0x0a9e('0x16')];this[_0x0a9e('0x17')]=0x0;ami['on'](_0x0a9e('0x18'),this[_0x0a9e('0x19')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x1b'),this['syncHangup'][_0x0a9e('0x1a')](this));ami['on']('hanguprequest',this[_0x0a9e('0x1c')]['bind'](this));ami['on'](_0x0a9e('0x1d'),this[_0x0a9e('0x1e')]['bind'](this));ami['on'](_0x0a9e('0x1f'),this['syncNewExten'][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x1a')](this));ami['on'](_0x0a9e('0x24'),this[_0x0a9e('0x25')][_0x0a9e('0x1a')](this));this[_0x0a9e('0x26')](this[_0x0a9e('0x12')]);}function emit(_0x4bb1e3,_0x2c3407,_0x155cce){io['to'](_0x4bb1e3)['emit'](_0x2c3407,_0x155cce);}function emitCampaignPreview(_0x20f109){if(_0x20f109['type']==='outbound'){var _0x3a02e1={'id':_0x20f109['id'],'name':_0x20f109[_0x0a9e('0x27')],'strategy':_0x20f109[_0x0a9e('0x28')],'answered':_0x20f109[_0x0a9e('0x29')],'available':_0x20f109['available'],'loggedIn':_0x20f109[_0x0a9e('0x2a')],'pTalking':_0x20f109[_0x0a9e('0x2b')],'sumBillable':_0x20f109[_0x0a9e('0x2c')],'sumDuration':_0x20f109[_0x0a9e('0x2d')],'sumHoldTime':_0x20f109[_0x0a9e('0x2e')]||0x0,'talking':_0x20f109[_0x0a9e('0x2f')],'total':_0x20f109[_0x0a9e('0x30')],'type':_0x20f109['type'],'unmanaged':_0x20f109['unmanaged'],'abandoned':_0x20f109[_0x0a9e('0x31')],'waiting':_0x20f109[_0x0a9e('0x32')],'loggedInDb':_0x20f109[_0x0a9e('0x33')],'dialActive':_0x20f109[_0x0a9e('0x34')],'dialMethod':_0x20f109['dialMethod'],'dialOriginateCallerIdName':_0x20f109[_0x0a9e('0x35')],'dialOriginateCallerIdNumber':_0x20f109['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x20f109[_0x0a9e('0x36')],'dialPrefix':_0x20f109['dialPrefix'],'outboundAnswerAgiCallsDay':_0x20f109[_0x0a9e('0x37')],'outboundAnswerCallsDay':_0x20f109[_0x0a9e('0x38')],'outboundBlacklistCallsDay':_0x20f109[_0x0a9e('0x39')],'outboundBusyCallsDay':_0x20f109[_0x0a9e('0x3a')],'outboundCongestionCallsDay':_0x20f109[_0x0a9e('0x3b')],'outboundDropCallsDayACS':_0x20f109[_0x0a9e('0x3c')],'outboundDropCallsDayCallersExit':_0x20f109[_0x0a9e('0x3d')],'outboundDropCallsDayTimeout':_0x20f109[_0x0a9e('0x3e')],'outboundNoAnswerCallsDay':_0x20f109['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x20f109[_0x0a9e('0x3f')],'outboundOriginateFailureCallsDay':_0x20f109[_0x0a9e('0x40')],'outboundReCallsDay':_0x20f109[_0x0a9e('0x41')],'outboundRejectCallsDay':_0x20f109[_0x0a9e('0x42')],'outboundUnknownCallsDay':_0x20f109['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x20f109[_0x0a9e('0x43')],'predictiveIntervalAnsweredCalls':_0x20f109[_0x0a9e('0x44')],'predictiveIntervalAvgHoldtime':_0x20f109[_0x0a9e('0x45')],'predictiveIntervalAvgTalktime':_0x20f109[_0x0a9e('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x20f109[_0x0a9e('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x20f109[_0x0a9e('0x48')],'predictiveIntervalErlangCalls':_0x20f109[_0x0a9e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x20f109[_0x0a9e('0x4a')],'predictiveIntervalHitRate':_0x20f109[_0x0a9e('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x20f109['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x20f109[_0x0a9e('0x4c')],'predictiveIntervalAvailable':_0x20f109['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x20f109[_0x0a9e('0x4d')],'message':_0x20f109[_0x0a9e('0x4e')],'originated':_0x20f109[_0x0a9e('0x4f')],'erlangCalls':_0x20f109[_0x0a9e('0x50')],'erlangCallToSecond':_0x20f109[_0x0a9e('0x51')],'erlangAbandonmentRate':_0x20f109['erlangAbandonmentRate'],'erlangBusyFactor':_0x20f109[_0x0a9e('0x52')],'startPredictive':_0x20f109[_0x0a9e('0x53')],'startProgressive':_0x20f109[_0x0a9e('0x54')]};if(_0x20f109[_0x0a9e('0x55')]){_0x3a02e1[_0x0a9e('0x55')]={'id':_0x20f109[_0x0a9e('0x55')]['id'],'name':_0x20f109[_0x0a9e('0x55')][_0x0a9e('0x27')],'active':_0x20f109['Trunk'][_0x0a9e('0x56')],'callerid':_0x20f109['Trunk'][_0x0a9e('0x57')]};}if(_0x20f109[_0x0a9e('0x58')]){_0x3a02e1[_0x0a9e('0x58')]={'id':_0x20f109[_0x0a9e('0x58')]['id'],'name':_0x20f109['Interval'][_0x0a9e('0x27')]};}var _0xd1836d=md5(JSON[_0x0a9e('0x59')](_0x3a02e1));if(_0x20f109[_0x0a9e('0x3')]!==_0xd1836d){_0x20f109['md5']=_0xd1836d;emit(util['format'](_0x0a9e('0x5a'),_0x3a02e1['name']),_0x0a9e('0x5b'),_0x3a02e1);}}}function emitVoiceQueueChannelRemove(_0x3d9717){logger[_0x0a9e('0x5c')](_0x0a9e('0x5d'),JSON['stringify'](_0x3d9717));emit(util[_0x0a9e('0x5e')](_0x0a9e('0x5a'),_0x3d9717[_0x0a9e('0x27')]),'voice_queue_channel:remove',_0x3d9717);io[_0x0a9e('0x5f')](_0x0a9e('0x60'),_0x3d9717);}function notSendMessagesQueue(_0x289467){if(_0x289467['sendMessageOneNotActive']){if(_0x289467['originated']===0x0&&_0x289467[_0x0a9e('0x2b')]===0x0){_0x289467[_0x0a9e('0x61')]=![];_0x289467['available']=0x0;_0x289467[_0x0a9e('0x62')]=0x0;_0x289467[_0x0a9e('0x4e')]=_0x0a9e('0x63');ut[_0x0a9e('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x289467['name']+_0x0a9e('0x65'));}else{_0x289467[_0x0a9e('0x4e')]='IS_DISACTIVED';ut[_0x0a9e('0x64')](_0x0a9e('0x66'),_0x289467[_0x0a9e('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x289467);}}Preview[_0x0a9e('0xe')][_0x0a9e('0x26')]=function(){var _0x274e8e=this;setInterval(function(){_0x274e8e[_0x0a9e('0x67')]();},0x7cf);};Preview[_0x0a9e('0xe')][_0x0a9e('0x67')]=function(){var _0x2881b3=this[_0x0a9e('0x12')];this[_0x0a9e('0x17')]+=0x1;for(var _0x3da2cd in _0x2881b3){if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&(_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')||_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6a'))&&_0x2881b3[_0x3da2cd]['type']==='outbound'){if(this[_0x0a9e('0x17')]>0x7){this[_0x0a9e('0x17')]=0x0;this[_0x0a9e('0x6b')]();}}if(_0x2881b3[_0x0a9e('0x68')](_0x3da2cd)&&_0x2881b3[_0x3da2cd][_0x0a9e('0x69')]===_0x0a9e('0x6')&&_0x2881b3[_0x3da2cd][_0x0a9e('0x6c')]===_0x0a9e('0x6d')){if(_0x2881b3[_0x3da2cd][_0x0a9e('0x34')]){this[_0x0a9e('0x6e')](_0x2881b3[_0x3da2cd]);if(_0x2881b3[_0x3da2cd][_0x0a9e('0x6f')])this[_0x0a9e('0x70')](_0x2881b3[_0x3da2cd]);}else{notSendMessagesQueue(_0x2881b3[_0x3da2cd]);}}}};Preview['prototype'][_0x0a9e('0x71')]=function(_0x138b8b){var _0xdd268f=this;this[_0x0a9e('0x11')][_0x0a9e('0xf')](function(){if(!_[_0x0a9e('0x72')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b])){loggerAction[_0x0a9e('0x5c')]('[clearZombieChannels][talking]',_0x138b8b,_0x0a9e('0x73'),_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')],_0x0a9e('0x75'),JSON[_0x0a9e('0x59')](_0xdd268f['campaignsPreview'][_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]][_0x0a9e('0x4f')]),_0x0a9e('0x76'),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']][_0x0a9e('0x2b')]),JSON[_0x0a9e('0x59')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x77')]),JSON[_0x0a9e('0x59')](_[_0x0a9e('0x78')](_0xdd268f[_0x0a9e('0x15')][_0x138b8b],[_0x0a9e('0x79'),_0x0a9e('0x7a'),'VoiceQueueId',_0x0a9e('0x7b')])));return ami[_0x0a9e('0x7c')]({'action':'status','channel':_0xdd268f['actions'][_0x138b8b]['channel']})[_0x0a9e('0x7d')](function(_0x4317e3){if(_0x4317e3[_0x0a9e('0x4e')]===_0x0a9e('0x7e')){setTimeout(function(){if(_0xdd268f[_0x0a9e('0x15')][_0x138b8b]){ut[_0x0a9e('0x7f')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']],'[clearZombieChannel]');if(_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x77')]===!![]){ut[_0x0a9e('0x80')](_0xdd268f[_0x0a9e('0x12')][_0xdd268f['actions'][_0x138b8b][_0x0a9e('0x74')]],_0x0a9e('0x81'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b]['queue']);}ut[_0x0a9e('0x82')]('[Dialer][checkChannel][Preview]'+_0x138b8b,_0xdd268f[_0x0a9e('0x15')][_0x138b8b][_0x0a9e('0x74')]);delete _0xdd268f[_0x0a9e('0x15')][_0x138b8b];}},0x2328);}});}});};Preview['prototype'][_0x0a9e('0x6b')]=function(){var _0x1bf38a=this;loggerAction['info']('[action]',_[_0x0a9e('0x83')](this[_0x0a9e('0x15')]));for(var _0x49c095 in this[_0x0a9e('0x15')]){if(_0x1bf38a['actions'][_0x0a9e('0x68')](_0x49c095)){_0x1bf38a['clearZombieChannel'](_0x49c095);}}};Preview[_0x0a9e('0xe')]['recallMe']=function(_0x5da27d){var _0x5df0ad=this;rpcDb[_0x0a9e('0x84')](_0x5da27d['id'],ut['agentReadyId'](this[_0x0a9e('0x16')]))[_0x0a9e('0x85')](function(_0x3cfd00){if(!_[_0x0a9e('0x72')](_0x3cfd00)){for(var _0x232830=0x0;_0x232830<_0x3cfd00[_0x0a9e('0x86')];_0x232830+=0x1){if(ut[_0x0a9e('0x87')](_0x3cfd00[_0x232830][_0x0a9e('0x88')])<_0x5da27d['dialRecallMeTimeout']*0x3c){if(_0x3cfd00[_0x232830][_0x0a9e('0x89')]&&!_0x3cfd00[_0x232830][_0x0a9e('0x89')][_0x0a9e('0x8a')]){_0x5df0ad[_0x0a9e('0x8b')](_0x3cfd00[_0x232830]['id'])[_0x0a9e('0x85')](ut[_0x0a9e('0x8c')]('[RecallMe]'))[_0x0a9e('0x7d')](ut[_0x0a9e('0x8c')]('[RecallMe]'));}else{rpcDb[_0x0a9e('0x8d')](_0x3cfd00[_0x232830]['id']);}}else{var _0x5cc8fb=new Action(_0x3cfd00[_0x232830],_0x5da27d);_0x5cc8fb[_0x0a9e('0x8e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5da27d['outboundReCallsDay']+=0x1;ut[_0x0a9e('0x8f')](_0x5cc8fb,0x17,'RecallInQueue');if(_0x5da27d[_0x0a9e('0x90')]){rpcDb[_0x0a9e('0x91')](ut[_0x0a9e('0x92')](_0x3cfd00[_0x232830]));rpcDb[_0x0a9e('0x93')](_0x5cc8fb,_0x0a9e('0x94'));}else{ut[_0x0a9e('0x8f')](_0x5cc8fb,0x16,'RecallFailedTimeout');rpcDb[_0x0a9e('0x93')](_0x5cc8fb,'[HistoryRecallClose]');rpcDb[_0x0a9e('0x95')](_0x5cc8fb,_0x0a9e('0x96'));}}}}})[_0x0a9e('0x7d')](ut['logger2'](_0x0a9e('0x97')));};Preview[_0x0a9e('0xe')][_0x0a9e('0x6e')]=function(_0x32e134){_0x32e134['sendMessageOneNotActive']=!![];if(ut[_0x0a9e('0x98')](_0x32e134[_0x0a9e('0x2a')])){_0x32e134['message']=_0x0a9e('0x99');}else if(!ut[_0x0a9e('0x9a')](_0x32e134[_0x0a9e('0x34')])){_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x63');}else if(!this['isTrunkReachable'](_0x32e134[_0x0a9e('0x55')])){if(!this[_0x0a9e('0x9b')](_0x32e134[_0x0a9e('0x9c')])){_0x32e134['message']=_0x0a9e('0x9d');}else{_0x32e134['message']='ACTIVE';}}else{_0x32e134[_0x0a9e('0x4e')]=_0x0a9e('0x9e');}emitCampaignPreview(_0x32e134);};Preview[_0x0a9e('0xe')][_0x0a9e('0x9f')]=function(_0x186f39,_0xc8c264,_0x387489){var _0x54a37d=this;var _0x2d7205=this[_0x0a9e('0x15')][_0xc8c264];var _0x2e89b7=this[_0x0a9e('0x12')][_0x2d7205[_0x0a9e('0x74')]];var _0x2b8192;var _0x320898=![];var _0x412a72=0x2;var _0x2a28c0=0x3;if(_0x2e89b7){switch(_0x387489){case'1':_0x2e89b7[_0x0a9e('0x3f')]+=0x1;_0x2d7205['countnosuchnumberretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x0,'NoSuchNumber');ami[_0x0a9e('0x5f')](_0x0a9e('0xa2'),ut['buildObj'](_0x2d7205,_0x0a9e('0xa3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xa4'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'0',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a43a8){_0x320898=_0x4a43a8['additional']==0x1;_0x412a72=_0x2e89b7['dialNoSuchNumberRetryFrequency'];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xaa'));}else{if(_0x2d7205[_0x0a9e('0xab')]>=_0x2e89b7['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xaa'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xab'),_0x2e89b7['dialNoSuchNumberRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];}else{_0x2d7205[_0x0a9e('0xab')]++;logger[_0x0a9e('0x5c')](_0x0a9e('0xb0'),_0x2d7205['countnosuchnumberretry']);logger[_0x0a9e('0x5c')]('id',_0x2d7205[_0x0a9e('0xb1')]);_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnosuchnumberretry':_0x2d7205['countnosuchnumberretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xb4'):var _0x4abc8f=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));_0x2d7205[_0x0a9e('0xb6')]=_0x4abc8f;_0x2d7205[_0x0a9e('0xb7')]=_0x4abc8f;_0x2d7205[_0x0a9e('0x77')]=!![];_0x2e89b7[_0x0a9e('0x2b')]+=0x1;logger[_0x0a9e('0x5c')](_0x0a9e('0xb8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7[_0x0a9e('0x2b')]);ami[_0x0a9e('0x5f')]('custom:agentconnect',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xbc'),this[_0x0a9e('0x12')][_0x2d7205['queue']]));if(_0x2e89b7[_0x0a9e('0xbd')]){ami[_0x0a9e('0x5f')](_0x0a9e('0xbe'),ut[_0x0a9e('0xbf')](_0x2d7205));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc0'),this['campaignsPreview'][_0x2d7205[_0x0a9e('0x74')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2d7205,_0x0a9e('0xc0')));_0x2e89b7[_0x0a9e('0x38')]+=0x1;_0x2e89b7['total']+=0x1;_0x2e89b7[_0x0a9e('0x29')]+=0x1;ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xc1'));_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x4,_0x0a9e('0xc2'));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xc3'));rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xc4'));rpcDb[_0x0a9e('0xc5')](_0x2d7205);_0x2e89b7['sumDuration']+=_0x2d7205[_0x0a9e('0xc6')];_0x2e89b7[_0x0a9e('0x2c')]+=_0x2d7205['talktime'];logger[_0x0a9e('0x5c')]('[syncHangup][talking][decrement]',_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x2e89b7['pTalking']);delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;case _0x0a9e('0xc7'):_0x2e89b7[_0x0a9e('0x3a')]+=0x1;_0x2d7205['countbusyretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x5,'Busy');_0x412a72=_0x2e89b7[_0x0a9e('0xc8')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentbusy',ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xc9')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xca'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'5',_0x2e89b7)[_0x0a9e('0x85')](function(_0x5a8854){_0x320898=_0x5a8854[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut['totalGlobal'](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2d7205[_0x0a9e('0xcc')]>=_0x2e89b7[_0x0a9e('0xcd')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xcc'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xcc')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countbusyretry':_0x2d7205[_0x0a9e('0xcc')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xcf'):_0x2e89b7[_0x0a9e('0xd0')]+=0x1;_0x2d7205['countnoanswerretry']+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x3,_0x0a9e('0xd1'));_0x412a72=_0x2e89b7[_0x0a9e('0xd2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')](_0x0a9e('0xd3'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xd4')));rpcDb['createCustomerHistory'](_0x2d7205,_0x0a9e('0xd5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'3',_0x2e89b7)[_0x0a9e('0x85')](function(_0x30ef6e){_0x320898=_0x30ef6e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xd6'));}else{if(_0x2d7205[_0x0a9e('0xd7')]>=_0x2e89b7[_0x0a9e('0xd8')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xd5'));}else{rpcDb[_0x0a9e('0xac')](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xd7'),_0x2e89b7[_0x0a9e('0xd2')]),_0x2d7205['unlockAgent'],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205['countnoanswerretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xd9'):_0x2e89b7['outboundCongestionCallsDay']+=0x1;_0x2d7205[_0x0a9e('0xda')]+=0x1;_0x2d7205['countglobal']=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x8,'Congestion');_0x412a72=_0x2e89b7[_0x0a9e('0xdb')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];ami[_0x0a9e('0x5f')]('custom:agentcongestion',ut['buildObj'](_0x2d7205,_0x0a9e('0xdc')));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xdd'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'8',_0x2e89b7)[_0x0a9e('0x85')](function(_0x2450a8){_0x320898=_0x2450a8[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut['cloneAction'](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb['createCustomerFinal'](_0x2b8192,_0x0a9e('0xde'));}else{if(_0x2d7205[_0x0a9e('0xda')]>=_0x2e89b7[_0x0a9e('0xdf')]){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x0a9e('0xce')](_0x2d7205,_0x0a9e('0xda'),_0x2e89b7[_0x0a9e('0xc8')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205['countcongestionretry']++;_0x54a37d['incrementPreviewCounters']({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countcongestionretry':_0x2d7205['countcongestionretry']}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case _0x0a9e('0xe0'):_0x2e89b7[_0x0a9e('0x42')]+=0x1;_0x2d7205[_0x0a9e('0xe1')]+=0x1;_0x2d7205['countglobal']=ut['totalGlobal'](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x14,'AgentReject');_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7['callAdditionalPhoneAfterMin'];ami[_0x0a9e('0x5f')]('custom:agentreject',ut['buildObj'](_0x2d7205,_0x0a9e('0xe3')));rpcDb[_0x0a9e('0x93')](_0x2d7205,'[syncHangupRequest][logAgentReject]');_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x15c6b9){_0x320898=_0x15c6b9[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut['cloneAction'](_0x2d7205,0x14,_0x0a9e('0xe4'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xe5'));}else{if(_0x2d7205[_0x0a9e('0xe1')]>=_0x2e89b7[_0x0a9e('0xe6')]){rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xe5'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe1'),_0x2e89b7[_0x0a9e('0xe2')]),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});break;case _0x0a9e('0xe7'):_0x2e89b7[_0x0a9e('0x43')]+=0x1;_0x2d7205[_0x0a9e('0xe8')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0xb,'Abandoned');rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xe9'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'11',_0x2e89b7)[_0x0a9e('0x85')](function(_0x34f7b5){_0x320898=_0x34f7b5['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2d7205[_0x0a9e('0xea')]>=_0x2e89b7['dialAbandonedMaxRety']){rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xe9'));}else{rpcDb[_0x0a9e('0xac')](ut['scheduledAt'](_0x2d7205,_0x0a9e('0xe8'),_0x2e89b7['dialAbandonedRetryFrequency']),_0x2d7205[_0x0a9e('0xad')],_0x2d7205[_0x0a9e('0xae')]);}}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});break;case'18':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xec')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0x12,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit']('custom:amd',ut[_0x0a9e('0xbb')](_0x2d7205,'amd'));rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xef'));_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0xe2b083){_0x320898=_0xe2b083[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0x12,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xef'));}else{rpcDb['createCustomerFinal'](_0x2d7205,_0x0a9e('0xef'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205['idContact'],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d[_0x0a9e('0xb3')](_0x2d7205,_0x412a72,_0x2a28c0)['then'](function(){});});}});delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];break;case'19':_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut['logCustomer'](_0x2d7205,0x13,_0x186f39[_0x0a9e('0xed')]||_0x186f39[_0x0a9e('0xee')]);ami['emit'](_0x0a9e('0xf0'),ut[_0x0a9e('0xbb')](_0x2d7205,_0x0a9e('0xf1')));rpcDb['createCustomerHistory'](_0x2d7205,'[callProgressDetectingCustomer][machine]');_0x54a37d['verifyAdditionalPhones'](_0x2d7205,'18',_0x2e89b7)[_0x0a9e('0x85')](function(_0x4a70ce){_0x320898=_0x4a70ce['additional']==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7[_0x0a9e('0xa7')]){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,'Global');rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf2'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf2'));}}else{_0x2d7205[_0x0a9e('0xd7')]++;_0x54a37d[_0x0a9e('0xb2')]({'id':_0x2d7205[_0x0a9e('0xb1')],'field':{'countnoanswerretry':_0x2d7205[_0x0a9e('0xd7')]}})[_0x0a9e('0x85')](function(){_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(){});});}});delete this['actions'][_0x186f39[_0x0a9e('0xaf')]];break;default:if(_0x2d7205[_0x0a9e('0x77')]){ut[_0x0a9e('0x80')](_0x2e89b7,_0x0a9e('0xf3'));ut[_0x0a9e('0x82')](_0x0a9e('0xf4')+_0x2e89b7['name'],_0x186f39);}_0x2e89b7[_0x0a9e('0xeb')]+=0x1;_0x2d7205[_0x0a9e('0xa0')]=ut[_0x0a9e('0xa1')](_0x2d7205);ut[_0x0a9e('0x8f')](_0x2d7205,0xc,_0x186f39['cause-txt']||_0x186f39[_0x0a9e('0xee')]);_0x412a72=_0x2e89b7[_0x0a9e('0xe2')];_0x2a28c0=_0x2e89b7[_0x0a9e('0xa6')];rpcDb[_0x0a9e('0x93')](_0x2d7205,_0x0a9e('0xf5'));_0x54a37d[_0x0a9e('0xa5')](_0x2d7205,'20',_0x2e89b7)[_0x0a9e('0x85')](function(_0x25931e){_0x320898=_0x25931e[_0x0a9e('0xcb')]==0x1;if(!_0x320898){if(ut[_0x0a9e('0xa1')](_0x2d7205)>=_0x2e89b7['dialGlobalMaxRetry']){_0x2b8192=ut[_0x0a9e('0xa8')](_0x2d7205,0xf,_0x0a9e('0xa9'));rpcDb[_0x0a9e('0x95')](_0x2b8192,_0x0a9e('0xf6'));}else{rpcDb[_0x0a9e('0x95')](_0x2d7205,_0x0a9e('0xf6'));}delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xaf')]];}else{_0x54a37d['swapAdditionalPhones'](_0x2d7205,_0x412a72,_0x2a28c0)[_0x0a9e('0x85')](function(_0xd2391){});}});}if(!(_0x2d7205[_0x0a9e('0x77')]&&_0x387489==='16')){ut['updateOriginated'](_0x2e89b7,_0x0a9e('0xf7'));logger[_0x0a9e('0x5c')](_0x0a9e('0xf8'),_0x2d7205[_0x0a9e('0xb9')],_0x0a9e('0xba'),_0x2e89b7[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x2e89b7[_0x0a9e('0x4f')]);}if(_0x387489!==_0x0a9e('0xb4')){delete this[_0x0a9e('0x15')][_0x186f39['linkedid']];delete this[_0x0a9e('0x15')][_0x186f39[_0x0a9e('0xf9')]];}}};Preview[_0x0a9e('0xe')][_0x0a9e('0xfa')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){if(_[_0x0a9e('0xfb')](_0x3942fd)&&'object'!==typeof _0x3942fd){return;}if(_['isUndefined'](_0x5cb48d)&&'object'!==typeof _0x5cb48d){return;}switch(_0x5cb48d[_0x0a9e('0xfc')]){case'0':ut[_0x0a9e('0xfd')](_0x2b624e,0x0,_0x0a9e('0xfe'));rpcDb[_0x0a9e('0xff')](_0x2b624e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x0a9e('0xfd')](_0x2b624e,0x3,_0x0a9e('0xd1'));rpcDb[_0x0a9e('0xff')](_0x2b624e,_0x0a9e('0x100'));break;case'5':ut[_0x0a9e('0xfd')](_0x2b624e,0x5,'Busy');rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x101'));break;case'8':ut[_0x0a9e('0xfd')](_0x2b624e,0x8,_0x0a9e('0x102'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));break;case'22':ut[_0x0a9e('0xfd')](_0x2b624e,0x16,_0x0a9e('0x104'));rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x105'));break;default:ut[_0x0a9e('0xfd')](_0x2b624e,0xc,_0x5cb48d[_0x0a9e('0xfc')]);rpcDb['createAgentHistory'](_0x2b624e,_0x0a9e('0x103'));}ut[_0x0a9e('0x7f')](_0x3942fd,_0x0a9e('0x106'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b624e['uniqueid'],_0x0a9e('0xba'),_0x3942fd[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x3942fd[_0x0a9e('0x4f')]);delete this['actions'][_0x2b624e[_0x0a9e('0xb9')]];};Preview['prototype'][_0x0a9e('0xa5')]=function(_0x2ff2ab,_0x242f23,_0x57f673){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xa5')](_0x2ff2ab,_0x242f23,_0x57f673))['catch'](logger[_0x0a9e('0x5c')]('[verifyAdditionalPhone]\x20'));};Preview[_0x0a9e('0xe')]['swapAdditionalPhones']=function(_0x41b90a,_0x57b7d4,_0xb14971){return BPromise[_0x0a9e('0x107')]()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb3')](_0x41b90a,_0x57b7d4,_0xb14971))[_0x0a9e('0x7d')](logger[_0x0a9e('0x5c')](_0x0a9e('0x108')));};Preview['prototype'][_0x0a9e('0xb2')]=function(_0x1c9ea2){return BPromise['resolve']()[_0x0a9e('0x85')](cmHopperAdditionalPhone[_0x0a9e('0xb2')](_0x1c9ea2))['catch'](logger[_0x0a9e('0x5c')](_0x0a9e('0x109')));};Preview[_0x0a9e('0xe')]['checkInBlack']=function(_0x3766d7,_0xf49ed4,_0xdeb5e4,_0x3f0d64,_0x2003bc){var _0x29fdfe=this;return new BPromise(function(_0x3ba897,_0x74d9b8){if(_[_0x0a9e('0x72')](_0xf49ed4)||_[_0x0a9e('0x72')](_0xf49ed4['Contact'])||_[_0x0a9e('0x72')](_0xf49ed4['phone'])||_[_0x0a9e('0x72')](_0xf49ed4[_0x0a9e('0x10a')])){_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x10b'),_0x3f0d64,_0x2003bc));return;}var _0x5d577b=uuid['v4']();var _0x2d45db=_0x29fdfe['campaignsPreview'][_0xf49ed4[_0x0a9e('0x73')][_0x0a9e('0x27')]];var _0x2977a7=_0xdeb5e4?_0x29fdfe['agents'][_0xdeb5e4]['id']:undefined;_0x29fdfe[_0x0a9e('0x15')][_0x5d577b]=new Action(_0xf49ed4,_0x2d45db,_0x5d577b,_0xdeb5e4,_0x2977a7);var _0x402544=_0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x402544[_0x0a9e('0xad')]=_0x3f0d64;_0x402544[_0x0a9e('0xae')]=_0x2003bc;_0x402544[_0x0a9e('0x10c')]=_0xdeb5e4;if(_[_0x0a9e('0x10d')](_0x3766d7)){_0x29fdfe['execCall'](_0x402544,_0x2d45db,_0xf49ed4,_0xdeb5e4)[_0x0a9e('0x85')](function(_0x228c10){logger[_0x0a9e('0x5c')](_0x0a9e('0x10e'),_0x0a9e('0x10f')+_0x402544[_0x0a9e('0x74')]+_0x0a9e('0x110')+_0x402544['idContact'],JSON['stringify'](_0x228c10));ami[_0x0a9e('0x5f')](_0x0a9e('0x111'),ut[_0x0a9e('0xbb')](_0x402544,_0x0a9e('0x112'),_0x29fdfe[_0x0a9e('0x12')][_0x402544[_0x0a9e('0x74')]]));_0x3ba897(ut[_0x0a9e('0x4e')]('Calling'));})[_0x0a9e('0x7d')](function(_0x1d7fc4){ut[_0x0a9e('0x64')](_0x0a9e('0x113'),_0x1d7fc4);_0x74d9b8(ut[_0x0a9e('0x4e')](_0x0a9e('0x114'),_0x3f0d64,_0x2003bc));});}else{_0x2d45db[_0x0a9e('0x39')]+=0x1;ut['logBlacklist'](_0x402544);rpcDb[_0x0a9e('0x115')](_0x402544,_0x0a9e('0x116'));delete _0x29fdfe[_0x0a9e('0x15')][_0x5d577b];_0x74d9b8(ut['message'](_0x0a9e('0x117'),_0x3f0d64,_0x2003bc));}});};Preview[_0x0a9e('0xe')][_0x0a9e('0x9b')]=function(_0x292f02){return!_['isNil'](_0x292f02)&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x27')])&&!_[_0x0a9e('0x72')](_0x292f02[_0x0a9e('0x56')])&&_0x292f02[_0x0a9e('0x56')]&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])])&&!_[_0x0a9e('0x72')](this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02['name'])][_0x0a9e('0x118')])&&(this[_0x0a9e('0x14')][util[_0x0a9e('0x5e')]('SIP/%s',_0x292f02[_0x0a9e('0x27')])][_0x0a9e('0x118')]==='reachable'||this[_0x0a9e('0x14')][util['format'](_0x0a9e('0x119'),_0x292f02['name'])]['status']==='unmonitored');};Preview[_0x0a9e('0xe')][_0x0a9e('0x8b')]=function(_0x19f800,_0x20007e){var _0x7d59a9=this;return new BPromise(function(_0xe17af8,_0x48fbef){_0x7d59a9[_0x0a9e('0x11a')](_0x19f800,_0x20007e)[_0x0a9e('0x85')](function(_0x1713a7){_0xe17af8(_[_0x0a9e('0x78')](_0x1713a7,[_0x0a9e('0x4e')]));})[_0x0a9e('0x7d')](function(_0x31c937){if(_0x31c937['unlock']){rpcDb['unlockContact'](_0x19f800);}if(_0x31c937[_0x0a9e('0x56')]){rpcDb['disableContact'](_0x19f800);}_0x48fbef(_[_0x0a9e('0x78')](_0x31c937,[_0x0a9e('0x4e')]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11a')]=function(_0x37a448,_0x383dd8){var _0x594f25=this;return new BPromise(function(_0x4716d1,_0x59b872){var _0x50e32a,_0x504403;rpcDb['getContactPreview'](_0x37a448)[_0x0a9e('0x85')](function(_0x5dc978){if(!_['isNil'](_0x5dc978[0x0])){_0x504403=_0x5dc978[0x0][_0x0a9e('0x11b')]?![]:!![];_0x50e32a=_0x5dc978[0x0]['recallme']?!![]:![];_0x50e32a=_0x383dd8?!![]:_0x50e32a;}var _0x24470a=_0x594f25[_0x0a9e('0x11c')](_0x5dc978);if(_0x24470a[_0x0a9e('0x11d')]){rpcDb['checkIsBlackList'](_[_0x0a9e('0x78')](_0x5dc978[0x0],[_0x0a9e('0x10a'),_0x0a9e('0x11e')]))['then'](function(_0x5236c9){_0x594f25[_0x0a9e('0x11f')](_0x5236c9,_0x5dc978[0x0],_0x383dd8,_0x504403,_0x50e32a)[_0x0a9e('0x85')](function(_0x89d2cb){_0x4716d1(_0x89d2cb);})[_0x0a9e('0x7d')](function(_0x3b0db2){_0x59b872(_0x3b0db2);});})[_0x0a9e('0x7d')](function(_0x247a6c){ut[_0x0a9e('0x64')](_0x0a9e('0x120'),_0x247a6c);_0x59b872(ut[_0x0a9e('0x4e')]('Call\x20unsuccessful',_0x504403,_0x50e32a));});}else{_0x59b872(ut['message'](_0x24470a['message'],_0x504403,_0x50e32a));}})[_0x0a9e('0x7d')](function(_0x19dcc2){ut[_0x0a9e('0x64')](_0x0a9e('0x121'),_0x19dcc2);_0x59b872(ut[_0x0a9e('0x4e')](_0x0a9e('0x122'),![],!![]));});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x11c')]=function(_0x5d74e9){if(_['isNil'](_0x5d74e9)||_[_0x0a9e('0x10d')](_0x5d74e9)||!_[_0x0a9e('0x72')](_0x5d74e9[0x0]['Agent'])&&_[_0x0a9e('0x72')](_0x5d74e9[0x0][_0x0a9e('0x89')][_0x0a9e('0x27')])){ut[_0x0a9e('0x64')](_0x0a9e('0x123'),_0x5d74e9);return{'isValid':![],'message':_0x0a9e('0x124')};}var _0x167196=this[_0x0a9e('0x12')][_0x5d74e9[0x0][_0x0a9e('0x73')][_0x0a9e('0x27')]];_0x167196[_0x0a9e('0x4e')]=_0x0a9e('0x9e');if(_['isNil'](_0x167196)){ut[_0x0a9e('0x64')](_0x0a9e('0x125'),_0x167196);return{'isValid':![],'message':_0x0a9e('0x126')};}if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x55')])){ut[_0x0a9e('0x64')](_0x0a9e('0x127'),_0x0a9e('0x128')+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x129'));if(!this[_0x0a9e('0x9b')](_0x167196[_0x0a9e('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12a'));return{'isValid':![],'message':_0x0a9e('0x12b')};}}if(!ut[_0x0a9e('0x9a')](_0x167196[_0x0a9e('0x34')])){ut[_0x0a9e('0x64')](_0x0a9e('0x12c'),_0x167196['name']+_0x0a9e('0x12d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x167196[_0x0a9e('0x27')]+_0x0a9e('0x12d')};}return{'isValid':!![],'message':_0x0a9e('0x12e')};};Preview[_0x0a9e('0xe')][_0x0a9e('0x12f')]=function(_0x358f74,_0x465003,_0x261eca,_0xa7a754){var _0x32a199=this;return new BPromise(function(_0x39d367,_0x8231e5){var _0x43111e=_0x358f74[_0x0a9e('0xb9')];var _0x3c8a9a=_0x32a199[_0x0a9e('0x9b')](_0x465003['Trunk'])?util['format'](_0x0a9e('0x130'),_0x465003[_0x0a9e('0x55')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003['dialCutDigit']>0x0?_0x261eca[_0x0a9e('0x11e')]['substring'](_0x465003[_0x0a9e('0x133')]):_0x261eca['phone']):util[_0x0a9e('0x5e')]('SIP/%s/%s%s',_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['name']:_0x465003[_0x0a9e('0x9c')]['name'],_['isNil'](_0x465003[_0x0a9e('0x131')])?'':_0x465003[_0x0a9e('0x131')][_0x0a9e('0x132')]()||'',_0x465003[_0x0a9e('0x133')]>0x0?_0x261eca[_0x0a9e('0x11e')][_0x0a9e('0x134')](_0x465003[_0x0a9e('0x133')]):_0x261eca[_0x0a9e('0x11e')]);var _0x1a3143=_0x32a199[_0x0a9e('0x9b')](_0x465003[_0x0a9e('0x55')])?ut[_0x0a9e('0x135')](_0x465003[_0x0a9e('0x55')][_0x0a9e('0x57')],_0x465003[_0x0a9e('0x35')],_0x465003[_0x0a9e('0x136')]>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003['dialOriginateCallerIdNumber']):ut[_0x0a9e('0x135')](_[_0x0a9e('0x72')](_0x465003[_0x0a9e('0x9c')])?_0x465003[_0x0a9e('0x55')]['callerid']:_0x465003['TrunkBackup']['callerid'],_0x465003[_0x0a9e('0x35')],_0x465003['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0a9e('0x137')](_0x465003[_0x0a9e('0x138')],_0x465003[_0x0a9e('0x136')]):_0x465003[_0x0a9e('0x138')]);if(_0x1a3143){_0x358f74[_0x0a9e('0x139')]=ut[_0x0a9e('0x13a')](_0x1a3143);_0x358f74[_0x0a9e('0x13b')]=ut[_0x0a9e('0x13c')](_0x1a3143);}var _0x2154d8=ut[_0x0a9e('0x13d')](_0x465003,_0x261eca,_0x3c8a9a,_0x1a3143,_0x43111e,_0x358f74);_['merge'](_0x358f74,ut[_0x0a9e('0x13e')](_0x2154d8));_0x358f74['starttime']=moment()[_0x0a9e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0a9e('0x7c')](ut[_0x0a9e('0x13f')](_0x358f74,_0x465003,_0x2154d8,_0x358f74[_0x0a9e('0xae')],_0xa7a754))['then'](function(_0x920ad8){_0x465003[_0x0a9e('0x4f')]+=0x1;logger['info']('[originated][increment]',_0x43111e,_0x0a9e('0xba'),_0x465003[_0x0a9e('0x27')],_0x0a9e('0x75'),_0x465003['originated']);_0x39d367(_0x920ad8);})['catch'](function(_0x4869c1){ut[_0x0a9e('0xfd')](_0x358f74,0xe,_0x0a9e('0x140'));rpcDb[_0x0a9e('0xff')](_0x358f74,_0x0a9e('0x141'));_0x8231e5(_0x4869c1);});});};Preview[_0x0a9e('0xe')][_0x0a9e('0x142')]=function(_0x183b9b){if(this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]]){this[_0x0a9e('0x15')][_0x183b9b[_0x0a9e('0xaf')]][_0x0a9e('0x143')]=_0x183b9b[_0x0a9e('0x143')];}};Preview[_0x0a9e('0xe')][_0x0a9e('0x19')]=function(_0x1a74c4){var _0x94e69b=this;var _0x320367=this['actions'][_0x1a74c4[_0x0a9e('0x144')]];if(_0x320367){if(_0x320367[_0x0a9e('0x10c')]&&this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]){ut[_0x0a9e('0x145')](_0x320367,this[_0x0a9e('0x16')][_0x320367['lookAgent']][_0x0a9e('0x27')],this[_0x0a9e('0x16')][_0x320367[_0x0a9e('0x10c')]]['id']);}var _0x1109de=_[_0x0a9e('0x146')](_0x320367);_0x1109de[_0x0a9e('0xb6')]=moment()[_0x0a9e('0x5e')](_0x0a9e('0xb5'));var _0x4175a6=_0x94e69b['campaignsPreview'][_0x320367['queue']];if(ut[_0x0a9e('0x147')](_0x1a74c4[_0x0a9e('0x148')])){if(_0x320367['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x320367[_0x0a9e('0xb1')]);}if(_0x320367['activeContact']){rpcDb[_0x0a9e('0x8d')](_0x320367['idContact']);}ami[_0x0a9e('0x5f')](_0x0a9e('0x14a'),ut['buildObj'](_0x320367,_0x0a9e('0x14b'),this[_0x0a9e('0x12')][_0x320367['queue']]));this[_0x0a9e('0xfa')](_0x1109de,_0x4175a6,_0x1a74c4);}else{_0x320367[_0x0a9e('0x8e')]=moment()['format'](_0x0a9e('0xb5'));ut[_0x0a9e('0xfd')](_0x1109de,0x4,_0x0a9e('0xc2'));rpcDb[_0x0a9e('0xff')](_0x1109de,_0x0a9e('0x14c'));}}};Preview[_0x0a9e('0xe')]['syncHangup']=function(_0x1e5b09){var _0x36dc4f=this;var _0x51e697=this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]];var _0x22c390;if(_0x51e697){_0x22c390=this[_0x0a9e('0x12')][_0x51e697[_0x0a9e('0x74')]];logger[_0x0a9e('0x5c')](_0x0a9e('0x14d'),_0x1e5b09['linkedid'],'\x20Queue',_0x22c390['name'],'pTalking:\x20',_0x22c390['pTalking']);}if(this[_0x0a9e('0x15')][_0x1e5b09[_0x0a9e('0xaf')]]&&_0x1e5b09['linkedid']!==_0x1e5b09['uniqueid']){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this[_0x0a9e('0x15')][_0x1e5b09['linkedid']][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')]('[syncHangup][talking][cause]',_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390[_0x0a9e('0x2b')]);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09['linkedid'],_0x1e5b09[_0x0a9e('0x14e')]);}}else if(_0x51e697&&_['isNil'](_0x51e697[_0x0a9e('0x14f')])&&_0x22c390[_0x0a9e('0x150')]&&_0x1e5b09['linkedid']===_0x1e5b09[_0x0a9e('0xb9')]&&_[_0x0a9e('0x72')](_0x1e5b09['reason'])&&_0x1e5b09[_0x0a9e('0x14e')]==='16'&&_0x1e5b09['channelstate']==='6'&&_[_0x0a9e('0xfb')](_0x51e697[_0x0a9e('0x151')])){if(_0x51e697['unlockAgent']){rpcDb[_0x0a9e('0x149')](_0x51e697['idContact']);}if(_0x51e697[_0x0a9e('0xae')]){rpcDb[_0x0a9e('0x8d')](_0x51e697[_0x0a9e('0xb1')]);}_0x1e5b09[_0x0a9e('0xfc')]='22';this[_0x0a9e('0xfa')](_0x51e697,_0x22c390,_0x1e5b09);}else if(_0x51e697&&_0x51e697[_0x0a9e('0x151')]){if(_0x1e5b09[_0x0a9e('0x14e')]==='16'&&this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x152'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09['cause'],_0x0a9e('0xba'),_0x22c390['name'],'pTalking:\x20',_0x22c390[_0x0a9e('0x2b')]);this['callProgressDetectingCustomer'](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}else if(this['actions'][_0x1e5b09[_0x0a9e('0xaf')]][_0x0a9e('0x77')]){logger[_0x0a9e('0x5c')](_0x0a9e('0x153'),_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')],_0x0a9e('0xba'),_0x22c390[_0x0a9e('0x27')],_0x0a9e('0x76'),_0x22c390['pTalking']);this[_0x0a9e('0x9f')](_0x1e5b09,_0x1e5b09[_0x0a9e('0xaf')],_0x1e5b09[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')]['syncDialEnd']=function(_0x38d95a){if(this[_0x0a9e('0x15')][_0x38d95a[_0x0a9e('0xf9')]]&&_0x38d95a['destlinkedid']!==_0x38d95a[_0x0a9e('0x154')]){this[_0x0a9e('0x9f')](_0x38d95a,_0x38d95a[_0x0a9e('0xf9')],_0x38d95a['dialstatus']);}};Preview[_0x0a9e('0xe')]['syncHangupRequest']=function(_0x2394f2){if(this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]&&_0x2394f2[_0x0a9e('0xaf')]!==_0x2394f2[_0x0a9e('0xb9')]&&!this[_0x0a9e('0x15')][_0x2394f2[_0x0a9e('0xaf')]]['dialAnswer']){if(_0x2394f2[_0x0a9e('0x14e')]==='1'){this[_0x0a9e('0x9f')](_0x2394f2,_0x2394f2[_0x0a9e('0xaf')],_0x2394f2[_0x0a9e('0x14e')]);}}};Preview[_0x0a9e('0xe')][_0x0a9e('0x155')]=function(_0x3a4def,_0x2670f5,_0x2310ca){if(this[_0x0a9e('0x15')][_0x3a4def]){if(_[_0x0a9e('0x72')](this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')])){this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')]={};}this[_0x0a9e('0x15')][_0x3a4def][_0x0a9e('0x156')][_0x2670f5]=_0x2310ca;}};Preview[_0x0a9e('0xe')][_0x0a9e('0x21')]=function(_0x611e46){try{if(!_[_0x0a9e('0x72')](_0x611e46)){if(ut[_0x0a9e('0x157')](_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0])){this[_0x0a9e('0x155')](_0x611e46[_0x0a9e('0xb9')],_[_0x0a9e('0x158')](_0x611e46['variable'])[0x0],_0x611e46[_0x0a9e('0x159')]);}}}catch(_0x4c925e){logger[_0x0a9e('0x15a')](_0x0a9e('0x15b'),util[_0x0a9e('0x15c')](_0x4c925e,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xe')][_0x0a9e('0x23')]=function(_0xb09ef6){if(_0xb09ef6){if(this[_0x0a9e('0x15')][_0xb09ef6[_0x0a9e('0x15d')]]){this['actions'][_0xb09ef6[_0x0a9e('0x15d')]][_0x0a9e('0x151')]=!![];}}};Preview['prototype'][_0x0a9e('0x25')]=function(_0x2db8fe){if(_0x2db8fe){if(this[_0x0a9e('0x15')][_0x2db8fe['transfererlinkedid']]){this[_0x0a9e('0x15')][_0x2db8fe[_0x0a9e('0x15e')]][_0x0a9e('0x151')]=!![];}}};module[_0x0a9e('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 403db8e..596d49a 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 _0xc3c7=['queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x351b3a,_0x5d8d77){var _0x1e4def=function(_0x530fd6){while(--_0x530fd6){_0x351b3a['push'](_0x351b3a['shift']());}};_0x1e4def(++_0x5d8d77);}(_0xc3c7,0x148));var _0x7c3c=function(_0x20a573,_0x3328b4){_0x20a573=_0x20a573-0x0;var _0x399adf=_0xc3c7[_0x20a573];return _0x399adf;};'use strict';var util=require('util');var BPromise=require(_0x7c3c('0x0'));var logger=require(_0x7c3c('0x1'))('preview');var _=require(_0x7c3c('0x2'));var cmHopper=require(_0x7c3c('0x3'));var cmHopperFinal=require(_0x7c3c('0x4'));var cmHopperHistory=require(_0x7c3c('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7c3c('0x6'));var agentReportPreview=require(_0x7c3c('0x7'));var voiceQueueReport=require(_0x7c3c('0x8'));function loggerCatch(_0x54ce99){return function(_0x256f13){logger[_0x7c3c('0x9')](_0x54ce99,util['inspect'](_0x256f13,{'showHidden':![],'depth':null}));};}function create(_0x49b927){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopperHistory[_0x7c3c('0xc')](_0x49b927))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0xe')));}function createAgent(_0x598566){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](agentReportPreview[_0x7c3c('0xc')](_0x598566))['catch'](loggerCatch(_0x7c3c('0xe')));}function moveContact(_0x2c6f29){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0xf')](_0x2c6f29,!![]))[_0x7c3c('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x3c61aa){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopperBlack['checkIsBlackList'](_0x3c61aa))[_0x7c3c('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x7c3c('0x10')]=function(_0x3b75eb){return BPromise['resolve']()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0x10')](_0x3b75eb))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x11')));};exports[_0x7c3c('0xc')]=function(_0x469b79,_0x501032){create(_0x469b79)[_0x7c3c('0xd')](loggerCatch(_0x501032));moveContact(_0x469b79)[_0x7c3c('0xd')](loggerCatch(_0x501032));};exports[_0x7c3c('0x12')]=function(_0x3217ee,_0x39d874){createAgent(_0x3217ee)[_0x7c3c('0xd')](loggerCatch(_0x39d874));};exports['createCustomerHistory']=function(_0x3d53be,_0x45fd7e){create(_0x3d53be)['catch'](loggerCatch(_0x45fd7e));};exports[_0x7c3c('0x13')]=function(_0x48f984,_0x42875e){moveContact(_0x48f984)[_0x7c3c('0xd')](loggerCatch(_0x42875e));};exports[_0x7c3c('0x14')]=function(_0x5420a3,_0x2099ec,_0x44e31f){if(_0x2099ec){_0x5420a3[_0x7c3c('0x15')]=null;}if(_0x44e31f){_0x5420a3['active']=![];}return BPromise['resolve']()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0x14')](_0x5420a3))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x16')));};exports[_0x7c3c('0x17')]=function(_0x5b6526){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0x17')](_0x5b6526))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x18')));};exports[_0x7c3c('0x19')]=function(_0x21a94f){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopper['unlockContact']({'UserId':null},_0x21a94f,0x1))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x1a')));};exports[_0x7c3c('0x1b')]=function(_0x2ea44b){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0x19')]({'active':![]},_0x2ea44b,0x1))[_0x7c3c('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0x7c3c('0x1c')]=function(_0x2b1f61){var _0x1447ec={};_0x1447ec[_0x7c3c('0x1d')]=_0x2b1f61[_0x7c3c('0x1d')];_0x1447ec['uniqueid']=_0x2b1f61[_0x7c3c('0x1e')];_0x1447ec[_0x7c3c('0x1f')]=_0x2b1f61[_0x7c3c('0x1f')];_0x1447ec[_0x7c3c('0x20')]=_0x2b1f61[_0x7c3c('0x20')];_0x1447ec['queue']=_0x2b1f61[_0x7c3c('0x21')];_0x1447ec[_0x7c3c('0x22')]=_0x2b1f61[_0x7c3c('0x23')];_0x1447ec[_0x7c3c('0x24')]=_0x2b1f61[_0x7c3c('0x23')];_0x1447ec['queuecallercomplete']=0x1;_0x1447ec[_0x7c3c('0x25')]=_0x2b1f61['endtime'];_0x1447ec[_0x7c3c('0x26')]=_0x2b1f61[_0x7c3c('0x27')];_0x1447ec['context']=_0x7c3c('0x28');_0x1447ec[_0x7c3c('0x29')]=_0x7c3c('0x2a');_0x1447ec[_0x7c3c('0x2b')]=0x0;_0x1447ec['assigned']=0x1;_0x1447ec[_0x7c3c('0x2c')]=_0x2b1f61['membername'];_0x1447ec[_0x7c3c('0x2d')]=_0x7c3c('0x2e');return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](voiceQueueReport[_0x7c3c('0x2f')](_0x1447ec))[_0x7c3c('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x7c3c('0x30')]=function(_0x1b0ac0,_0x383057){return BPromise[_0x7c3c('0xa')]()['then'](cmHopper[_0x7c3c('0x30')](_0x1b0ac0,_0x383057))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x31')));};exports[_0x7c3c('0x32')]=function(_0x1917d0){return BPromise[_0x7c3c('0xa')]()[_0x7c3c('0xb')](cmHopper[_0x7c3c('0x14')](_0x1917d0,!![],!![]))[_0x7c3c('0xd')](loggerCatch(_0x7c3c('0x33')));}; \ No newline at end of file +var _0x10b4=['[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[unlockContact]\x20','disableContact','unlockContact','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','createHistory','catch','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','getContactPreview'];(function(_0x684f8d,_0x35f431){var _0x1487d4=function(_0x342f8f){while(--_0x342f8f){_0x684f8d['push'](_0x684f8d['shift']());}};_0x1487d4(++_0x35f431);}(_0x10b4,0x127));var _0x410b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x10b4[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x410b('0x0'));var BPromise=require('bluebird');var logger=require(_0x410b('0x1'))(_0x410b('0x2'));var _=require(_0x410b('0x3'));var cmHopper=require(_0x410b('0x4'));var cmHopperFinal=require(_0x410b('0x5'));var cmHopperHistory=require(_0x410b('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x410b('0x7'));var voiceQueueReport=require(_0x410b('0x8'));function loggerCatch(_0x287d04){return function(_0x12d82a){logger['error'](_0x287d04,util['inspect'](_0x12d82a,{'showHidden':![],'depth':null}));};}function create(_0x839a2b){return BPromise[_0x410b('0x9')]()['then'](cmHopperHistory[_0x410b('0xa')](_0x839a2b))[_0x410b('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x21160e){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](agentReportPreview[_0x410b('0xa')](_0x21160e))['catch'](loggerCatch(_0x410b('0xd')));}function moveContact(_0x429ff2){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopper[_0x410b('0xe')](_0x429ff2,!![]))[_0x410b('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x410b('0xf')]=function(_0x1966d2){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopperBlack[_0x410b('0xf')](_0x1966d2))[_0x410b('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x410b('0x10')]=function(_0x5506fd){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopper[_0x410b('0x10')](_0x5506fd))[_0x410b('0xb')](loggerCatch(_0x410b('0x11')));};exports[_0x410b('0xa')]=function(_0x353719,_0x5e2ffd){create(_0x353719)[_0x410b('0xb')](loggerCatch(_0x5e2ffd));moveContact(_0x353719)[_0x410b('0xb')](loggerCatch(_0x5e2ffd));};exports['createAgentHistory']=function(_0x3e5608,_0x5d8033){createAgent(_0x3e5608)[_0x410b('0xb')](loggerCatch(_0x5d8033));};exports[_0x410b('0x12')]=function(_0x94f005,_0x239ae3){create(_0x94f005)[_0x410b('0xb')](loggerCatch(_0x239ae3));};exports[_0x410b('0x13')]=function(_0x4667b1,_0x54aeac){moveContact(_0x4667b1)[_0x410b('0xb')](loggerCatch(_0x54aeac));};exports['rescheduleContact']=function(_0x71a40b,_0x3f10bb,_0xb7003b){if(_0x3f10bb){_0x71a40b[_0x410b('0x14')]=null;}if(_0xb7003b){_0x71a40b[_0x410b('0x15')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x410b('0x16')](_0x71a40b))[_0x410b('0xb')](loggerCatch(_0x410b('0x17')));};exports[_0x410b('0x18')]=function(_0x4db1b0){return BPromise['resolve']()[_0x410b('0xc')](cmHopper[_0x410b('0x18')](_0x4db1b0))[_0x410b('0xb')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x1c4728){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1c4728,0x1))[_0x410b('0xb')](loggerCatch(_0x410b('0x19')));};exports[_0x410b('0x1a')]=function(_0x305048){return BPromise['resolve']()['then'](cmHopper[_0x410b('0x1b')]({'active':![]},_0x305048,0x1))[_0x410b('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x410b('0x1c')]=function(_0x3349fe){var _0x182534={};_0x182534['type']=_0x3349fe['type'];_0x182534[_0x410b('0x1d')]=_0x3349fe['uniqueid'];_0x182534['calleridnum']=_0x3349fe[_0x410b('0x1e')];_0x182534['calleridname']=_0x3349fe[_0x410b('0x1f')];_0x182534[_0x410b('0x20')]=_0x3349fe[_0x410b('0x20')];_0x182534['queuecallerjoinAt']=_0x3349fe[_0x410b('0x21')];_0x182534[_0x410b('0x22')]=_0x3349fe[_0x410b('0x21')];_0x182534['queuecallercomplete']=0x1;_0x182534[_0x410b('0x23')]=_0x3349fe[_0x410b('0x24')];_0x182534['connectedlinename']=_0x3349fe['membername'];_0x182534[_0x410b('0x25')]=_0x410b('0x26');_0x182534[_0x410b('0x27')]=_0x410b('0x28');_0x182534[_0x410b('0x29')]=0x0;_0x182534['assigned']=0x1;_0x182534[_0x410b('0x2a')]=_0x3349fe[_0x410b('0x2b')];_0x182534[_0x410b('0x2c')]=_0x410b('0x2d');return BPromise[_0x410b('0x9')]()['then'](voiceQueueReport[_0x410b('0x2e')](_0x182534))[_0x410b('0xb')](loggerCatch(_0x410b('0x2f')));};exports[_0x410b('0x30')]=function(_0x279f18,_0x10af74){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopper[_0x410b('0x30')](_0x279f18,_0x10af74))[_0x410b('0xb')](loggerCatch(_0x410b('0x31')));};exports[_0x410b('0x32')]=function(_0x72aa39){return BPromise[_0x410b('0x9')]()[_0x410b('0xc')](cmHopper[_0x410b('0x16')](_0x72aa39,!![],!![]))[_0x410b('0xb')](loggerCatch(_0x410b('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d9c6dc9..88c94e0 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 _0xbd05=['originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildAcw','status','reachable','push','getDiff','diff','seconds','CampaignId','filterKey','type','active','scheduledat','countbusyretry','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialoptions','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid'];(function(_0x385e51,_0x6ea9fb){var _0x12d21f=function(_0x18e553){while(--_0x18e553){_0x385e51['push'](_0x385e51['shift']());}};_0x12d21f(++_0x6ea9fb);}(_0xbd05,0x15f));var _0x5bd0=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0xbd05[_0x3f8282];return _0x50f918;};'use strict';var util=require('util');var _=require(_0x5bd0('0x0'));var moment=require(_0x5bd0('0x1'));var logger=require('../../../../config/logger')(_0x5bd0('0x2'));var ipAgi=process[_0x5bd0('0x3')][_0x5bd0('0x4')]||_0x5bd0('0x5');function getSeconds(_0x439945,_0x2fa2f3){var _0x43d782=moment(_0x439945)[_0x5bd0('0x6')](0x0);var _0xd55daa=moment(_0x2fa2f3)[_0x5bd0('0x6')](0x0);return _0x43d782['diff'](_0xd55daa,'seconds');}exports[_0x5bd0('0x7')]=function(_0x2643e8){return function(_0x409ab1){logger[_0x5bd0('0x8')](_0x2643e8,util['inspect'](_0x409ab1,{'showHidden':![],'depth':null}));};};exports[_0x5bd0('0x9')]=function(_0x5008aa,_0x5a9acc){logger[_0x5bd0('0xa')](_0x5008aa,util[_0x5bd0('0xb')](_0x5a9acc,{'showHidden':![],'depth':null}));};exports[_0x5bd0('0xc')]=function(_0x227c14,_0x3cb4a8){logger[_0x5bd0('0x8')](_0x227c14,util[_0x5bd0('0xb')](_0x3cb4a8,{'showHidden':![],'depth':null}));};exports[_0x5bd0('0xd')]=function(_0xc39de5){return function(_0x1de333){logger[_0x5bd0('0xa')](_0xc39de5,util[_0x5bd0('0xb')](_0x1de333,{'showHidden':![],'depth':null}));};};exports[_0x5bd0('0xe')]=function(_0x23a605,_0x7b564,_0x5b530a){return{'message':_0x23a605,'unlock':_0x7b564,'active':_0x5b530a};};exports[_0x5bd0('0xf')]=function(_0x40b5d2,_0x323f24,_0x3b1dac){if(!_['isUndefined'](_0x3b1dac)&&_0x5bd0('0x10')===typeof _0x3b1dac&&!_[_0x5bd0('0x11')](_0x3b1dac)){if(!_[_0x5bd0('0x12')](_0x323f24)&&_0x5bd0('0x10')===typeof _0x323f24&&!_[_0x5bd0('0x11')](_0x323f24)){return util['format'](_0x5bd0('0x13'),_0x323f24,_0x3b1dac);}return util[_0x5bd0('0x14')](_0x5bd0('0x13'),_0x3b1dac,_0x3b1dac);}if(!_[_0x5bd0('0x12')](_0x40b5d2)&&_0x5bd0('0x10')===typeof _0x40b5d2&&!_[_0x5bd0('0x11')](_0x40b5d2)){return _0x40b5d2;}return _0x5bd0('0x15');};exports[_0x5bd0('0x16')]=function(_0x50bccb){if(_[_0x5bd0('0x17')](_0x50bccb)){return![];}return _0x50bccb;};exports['addVariables']=function(_0x17344a,_0x5a965f,_0x134895,_0x2df451,_0x4d3d71,_0x23b58b){var _0x525c1e={'XMD-QUEUE':_0x5a965f[_0x5bd0('0x18')]?_0x5a965f[_0x5bd0('0x18')][_0x5bd0('0x19')]:'','XMD-CALLERID':_0x2df451,'XMD-CALLERID-PREVIEW':_0x23b58b?util['format'](_0x5bd0('0x13'),_0x23b58b[_0x5bd0('0x1a')],_0x23b58b[_0x5bd0('0x1b')]):_0x2df451,'XMD-DIALID':_0x4d3d71,'XMD-CONTACTID':_0x5a965f[_0x5bd0('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2df451,'XMD-VOICEQUEUEID':_0x5a965f['VoiceQueueId'],'XMD-DIALCHANNEL':_0x134895,'XMD-DIALTIMEOUT':_0x17344a['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x5bd0('0x14')](_0x5bd0('0x1d'),_0x17344a[_0x5bd0('0x1e')]?'g':'',_[_0x5bd0('0x11')](_0x17344a['monitor_format'])?'':_0x5bd0('0x1f')),'XMD-DIALURL':_0x17344a['dialPreviewUrl']||'','XMD-AGI':_0x17344a[_0x5bd0('0x20')]?util['format'](_0x5bd0('0x21'),ipAgi,_0x17344a[_0x5bd0('0x20')]):_0x5bd0('0x22'),'XMD-AGIAFTER':_0x17344a['dialQueueProject2']?util[_0x5bd0('0x14')](_0x5bd0('0x21'),ipAgi,_0x17344a['dialQueueProject2']):_0x5bd0('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x23b58b?_0x23b58b['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x23b58b?_0x23b58b['originatecalleridname']:'','XMD-DESTINATION':_0x5bd0('0x23'),'SIPADDHEADER':_0x5bd0('0x24')};if(!_['isEmpty'](_0x17344a[_0x5bd0('0x25')])){_0x525c1e[util[_0x5bd0('0x14')]('%s',_0x5bd0('0x26'))]=_0x17344a[_0x5bd0('0x25')];_0x525c1e[util['format']('%s',_0x5bd0('0x27'))]=_0x4d3d71;}if(_0x5a965f&&_0x5a965f[_0x5bd0('0x28')]){for(var _0x395638 in _0x5a965f[_0x5bd0('0x28')]){if(_0x5a965f[_0x5bd0('0x28')][_0x5bd0('0x29')](_0x395638)){if(!_[_0x5bd0('0x17')](_0x5a965f[_0x5bd0('0x28')][_0x395638])&&_0x395638!=='id'&&_0x395638!==_0x5bd0('0x2a')&&_0x395638!==_0x5bd0('0x2b')&&_0x395638!==_0x5bd0('0x2c')){_0x525c1e[util[_0x5bd0('0x14')]('%s%s',_0x5bd0('0x2d'),_[_0x5bd0('0x2e')](_0x395638))]=_0x5a965f[_0x5bd0('0x28')][_0x395638];}}}}return _0x525c1e;};exports[_0x5bd0('0x2f')]=function(_0x5b6b42){var _0x3a402a={};for(var _0x4b7a3f in _0x5b6b42){if(_0x5b6b42[_0x5bd0('0x29')](_0x4b7a3f)){_0x3a402a[util[_0x5bd0('0x14')]('%s',_[_0x5bd0('0x30')](_0x4b7a3f))]=_0x5b6b42[_0x4b7a3f];}}return{'variables':_0x3a402a};};exports['updateOriginated']=function(_0x576f8d,_0x316286){if(!_['isNil'](_0x576f8d)){if(_0x576f8d[_0x5bd0('0x29')](_0x5bd0('0x31'))){if(_0x576f8d['originated']>0x0){_0x576f8d[_0x5bd0('0x31')]-=0x1;}else{logger[_0x5bd0('0x8')](_0x5bd0('0x32'),_0x316286);}}}else{logger['error'](_0x5bd0('0x33'),_0x316286);}};exports[_0x5bd0('0x34')]=function(_0x45dd37){var _0x4757f4=moment()[_0x5bd0('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x45dd37[_0x5bd0('0x35')]=0xd;_0x45dd37[_0x5bd0('0x36')]=_0x5bd0('0x37');_0x45dd37[_0x5bd0('0x38')]=_0x4757f4;_0x45dd37[_0x5bd0('0x39')]=_0x4757f4;_0x45dd37['endtime']=_0x4757f4;};exports[_0x5bd0('0x3a')]=function(_0x517337,_0x1327bd,_0x36e421){var _0x24bb7b=moment()[_0x5bd0('0x14')](_0x5bd0('0x3b'));_0x517337[_0x5bd0('0x35')]=_0x1327bd;_0x517337[_0x5bd0('0x36')]=_0x36e421;_0x517337[_0x5bd0('0x39')]=_0x24bb7b;_0x517337[_0x5bd0('0x3c')]=getSeconds(_0x517337[_0x5bd0('0x39')],_0x517337[_0x5bd0('0x38')]);};exports[_0x5bd0('0x3d')]=function(_0x476ed5,_0x5f0810,_0x4af1d3){_0x476ed5[_0x5bd0('0x3e')]=_0x5f0810;_0x476ed5[_0x5bd0('0x3f')]=_0x4af1d3;};exports[_0x5bd0('0x40')]=function(_0x41753b,_0x945a45,_0x41bb42){var _0x24ab0e=moment()[_0x5bd0('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x41753b[_0x5bd0('0x35')]=_0x945a45;_0x41753b[_0x5bd0('0x36')]=_0x41bb42;_0x41753b['responsetime']=_0x41753b[_0x5bd0('0x39')]?_0x41753b[_0x5bd0('0x39')]:_0x24ab0e;_0x41753b[_0x5bd0('0x41')]=_0x41753b[_0x5bd0('0x41')]?_0x41753b['endtime']:_0x24ab0e;_0x41753b[_0x5bd0('0x3c')]=getSeconds(_0x41753b[_0x5bd0('0x39')]||0x0,_0x41753b['starttime']||0x0);_0x41753b[_0x5bd0('0x42')]=_0x41753b[_0x5bd0('0x43')]?getSeconds(_0x41753b[_0x5bd0('0x41')],_0x41753b[_0x5bd0('0x43')]):0x0;};exports[_0x5bd0('0x44')]=function(_0x5a6893){return _0x5a6893==='Failure';};exports['variablesAction']=function(_0x43f183,_0x318321,_0x19177a,_0x5c2261,_0xfdb6c1){var _0x1f860d=_0x5c2261?_0x5bd0('0x45'):_0x43f183['calleridname'];_0x1f860d=_0xfdb6c1?_0x5bd0('0x46'):_0x1f860d;return{'actionid':_0x43f183[_0x5bd0('0x47')],'action':_0x5bd0('0x48'),'channel':_0x43f183[_0x5bd0('0x49')],'callerid':util['format'](_0x5bd0('0x13'),_0x1f860d,_0x43f183['calleridnum']),'Exten':_0x5bd0('0x23'),'Context':'from-sip','Priority':'1','variable':_0x19177a,'timeout':(_0x318321[_0x5bd0('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43f183['uniqueid']};};exports[_0x5bd0('0x4b')]=function(_0x3cb5aa){return _0x3cb5aa['countbusyretry']+_0x3cb5aa[_0x5bd0('0x4c')]+_0x3cb5aa[_0x5bd0('0x4d')]+_0x3cb5aa[_0x5bd0('0x4e')]+_0x3cb5aa['countnosuchnumberretry'];};exports[_0x5bd0('0x4f')]=function(_0x444c52){var _0x59e7cb=_[_0x5bd0('0x50')](_0x444c52);_0x59e7cb[_0x5bd0('0x35')]=0xf;_0x59e7cb['statedesc']=_0x5bd0('0x51');return _0x59e7cb;};exports[_0x5bd0('0x52')]=function(_0x3aca5b,_0x5b40e0,_0x2854a7){var _0xc368a2={};_0xc368a2[_0x5b40e0]=_0x3aca5b[_0x5b40e0];_0xc368a2['active']=![];_0xc368a2['scheduledat']=moment()[_0x5bd0('0x53')](_0x2854a7,_0x5bd0('0x54'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0xc368a2[_0x5bd0('0x1c')]=_0x3aca5b[_0x5bd0('0x1c')];_0xc368a2[_0x5bd0('0x55')]=_0x3aca5b[_0x5bd0('0x55')];_0xc368a2[_0x5bd0('0x56')]=_0x3aca5b[_0x5bd0('0x56')]||undefined;return _0xc368a2;};exports[_0x5bd0('0x57')]=function(_0x459eaa,_0x12b600){if(!_[_0x5bd0('0x17')](_0x459eaa)){if(_0x459eaa[_0x5bd0('0x58')]>0x0){_0x459eaa[_0x5bd0('0x58')]-=0x1;}else{logger[_0x5bd0('0x8')](_0x12b600,_0x5bd0('0x59'));}}else{logger[_0x5bd0('0x8')](_0x12b600,_0x5bd0('0x5a'));}};exports[_0x5bd0('0x5b')]=function(_0x4e053f){if(_0x4e053f<=0x0){return!![];}return![];};exports[_0x5bd0('0x5c')]=function(_0x194d22,_0xc40545,_0xbc20a4){_0x194d22[_0x5bd0('0x5d')]=_0xc40545;_0x194d22[_0x5bd0('0x19')]=_0x194d22[_0x5bd0('0x5e')];_0x194d22[_0x5bd0('0x5f')]=_0x194d22[_0x5bd0('0x49')];_0x194d22[_0x5bd0('0x60')]='voice';if(_0xbc20a4){_0x194d22[_0x5bd0('0x61')]=_0xbc20a4['mandatoryDisposition'];}return _0x194d22;};exports[_0x5bd0('0x62')]=function(_0x5b85d5){var _0x31e2b8={};_0x31e2b8[_0x5bd0('0x5e')]=_0x5b85d5[_0x5bd0('0x5e')];_0x31e2b8[_0x5bd0('0x5f')]=_0x5b85d5[_0x5bd0('0x49')];_0x31e2b8[_0x5bd0('0x47')]=_0x5b85d5[_0x5bd0('0x47')];return _0x31e2b8;};exports['agentReadyId']=function(_0x287543){var _0xdd40e5=[];for(var _0x215143 in _0x287543){if(_0x287543[_0x5bd0('0x29')](_0x215143)){if(!_[_0x5bd0('0x17')](_0x287543[_0x215143])&&_0x287543[_0x215143]['state']==='not_inuse'&&_0x287543[_0x215143][_0x5bd0('0x63')]===_0x5bd0('0x64')){_0xdd40e5[_0x5bd0('0x65')](_0x287543[_0x215143]['id']);}}}return _0xdd40e5;};exports[_0x5bd0('0x66')]=function(_0x1937fe){var _0x43cb54=moment()[_0x5bd0('0x6')](0x0);var _0x179f74=moment(_0x1937fe)['milliseconds'](0x0);return _0x43cb54[_0x5bd0('0x67')](_0x179f74,_0x5bd0('0x68'));};exports['createBody']=function(_0x4332e4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4332e4[_0x5bd0('0x1c')],'ListId':_0x4332e4[_0x5bd0('0x55')],'VoiceQueueId':_0x4332e4[_0x5bd0('0x56')]||undefined,'CampaignId':_0x4332e4[_0x5bd0('0x69')]||undefined};};exports[_0x5bd0('0x6a')]=function(_0x11dc59){if(_0x11dc59===_0x5bd0('0x47')||_0x11dc59==='idContact'||_0x11dc59===_0x5bd0('0x5e')||_0x11dc59===_0x5bd0('0x6b')||_0x11dc59==='campaigntype'||_0x11dc59==='dialAnswer'||_0x11dc59===_0x5bd0('0x3e')||_0x11dc59===_0x5bd0('0x49')||_0x11dc59===_0x5bd0('0x1a')||_0x11dc59===_0x5bd0('0x6c')||_0x11dc59===_0x5bd0('0x1b')||_0x11dc59===_0x5bd0('0x6d')||_0x11dc59===_0x5bd0('0x6e')||_0x11dc59===_0x5bd0('0x4c')||_0x11dc59===_0x5bd0('0x4d')||_0x11dc59==='countglobal'||_0x11dc59===_0x5bd0('0x6f')||_0x11dc59===_0x5bd0('0x70')||_0x11dc59===_0x5bd0('0x71')||_0x11dc59===_0x5bd0('0x72')||_0x11dc59===_0x5bd0('0x1c')||_0x11dc59===_0x5bd0('0x55')||_0x11dc59===_0x5bd0('0x3f')||_0x11dc59==='VoiceQueueId'||_0x11dc59==='sipcallid'||_0x11dc59===_0x5bd0('0x73')||_0x11dc59===_0x5bd0('0x74')||_0x11dc59===_0x5bd0('0x75')||_0x11dc59==='xmd-listid'||_0x11dc59==='xmd-dialurl'||_0x11dc59==='xmd-dialtimeout'||_0x11dc59===_0x5bd0('0x76')||_0x11dc59==='xmd-dialid'||_0x11dc59==='xmd-dialchannel'||_0x11dc59==='xmd-contactid'||_0x11dc59===_0x5bd0('0x77')||_0x11dc59===_0x5bd0('0x78')||_0x11dc59===_0x5bd0('0x79')||_0x11dc59===_0x5bd0('0x7a')||_0x11dc59===_0x5bd0('0x7b')||_0x11dc59===_0x5bd0('0x7c')||_0x11dc59==='rtpaudioqosjitter'||_0x11dc59===_0x5bd0('0x7d')||_0x11dc59===_0x5bd0('0x7e')||_0x11dc59===_0x5bd0('0x7f')||_0x11dc59===_0x5bd0('0x80')||_0x11dc59===_0x5bd0('0x81')||_0x11dc59===_0x5bd0('0x7b')||_0x11dc59===_0x5bd0('0x7c')||_0x11dc59===_0x5bd0('0x82')||_0x11dc59===_0x5bd0('0x7d')||_0x11dc59===_0x5bd0('0x7e')||_0x11dc59===_0x5bd0('0x7f')||_0x11dc59===_0x5bd0('0x80')||_0x11dc59===_0x5bd0('0x81')||_0x11dc59===_0x5bd0('0x83')||_0x11dc59===_0x5bd0('0x84')||_0x11dc59===_0x5bd0('0x35')||_0x11dc59==='statedesc'){return![];}return!![];};exports[_0x5bd0('0x85')]=function(_0x33f238,_0x54af11){var _0x2887fe,_0x2d09c1,_0x2e0ae0;if(_0x54af11<=0x0){_0x54af11=0x1;}_0x2887fe=new RegExp(_0x5bd0('0x86')+_0x54af11+'}$');_0x2d09c1=Math[_0x5bd0('0x87')](0xa,_0x54af11-0x1);_0x2e0ae0=Math[_0x5bd0('0x87')](0xa,_0x54af11)-0x1;return util['format']('%s',_[_0x5bd0('0x88')](_0x33f238,_0x2887fe,_[_0x5bd0('0x89')](_0x2d09c1,_0x2e0ae0)));};exports[_0x5bd0('0x8a')]=function(_0x31457c){var _0x148910=_0x31457c[_0x5bd0('0x8b')](/"(.*?)"/);return _0x148910?_0x148910[0x1]:_0x31457c;};exports[_0x5bd0('0x8c')]=function(_0x410c08){var _0x2feee9=_0x410c08[_0x5bd0('0x8b')](/<(.*?)>/);return _0x2feee9?_0x2feee9[0x1]:_0x410c08;}; \ No newline at end of file +var _0xe793=['ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','logAgent','statedesc','starttime','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','reachable','diff','idContact','type','campaigntype','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','seconds','error','inspect','logger','info','logger2','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name'];(function(_0x5af14e,_0x477164){var _0x19e876=function(_0x3995c4){while(--_0x3995c4){_0x5af14e['push'](_0x5af14e['shift']());}};_0x19e876(++_0x477164);}(_0xe793,0x73));var _0x3e79=function(_0x275720,_0x395a93){_0x275720=_0x275720-0x0;var _0x1f83d9=_0xe793[_0x275720];return _0x1f83d9;};'use strict';var util=require('util');var _=require(_0x3e79('0x0'));var moment=require(_0x3e79('0x1'));var logger=require(_0x3e79('0x2'))(_0x3e79('0x3'));var ipAgi=process[_0x3e79('0x4')]['XCALLY_IP_AGI']||_0x3e79('0x5');function getSeconds(_0x3c0ddb,_0x3cb6f0){var _0x4bd633=moment(_0x3c0ddb)[_0x3e79('0x6')](0x0);var _0x2c02a8=moment(_0x3cb6f0)['milliseconds'](0x0);return _0x4bd633['diff'](_0x2c02a8,_0x3e79('0x7'));}exports['loggerCatch']=function(_0x15ff71){return function(_0x1b8cd){logger[_0x3e79('0x8')](_0x15ff71,util[_0x3e79('0x9')](_0x1b8cd,{'showHidden':![],'depth':null}));};};exports[_0x3e79('0xa')]=function(_0x2b94e0,_0x1a9b80){logger[_0x3e79('0xb')](_0x2b94e0,util[_0x3e79('0x9')](_0x1a9b80,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x39c52f,_0x47ff1e){logger[_0x3e79('0x8')](_0x39c52f,util[_0x3e79('0x9')](_0x47ff1e,{'showHidden':![],'depth':null}));};exports[_0x3e79('0xc')]=function(_0x490224){return function(_0x5aa703){logger[_0x3e79('0xb')](_0x490224,util[_0x3e79('0x9')](_0x5aa703,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x19b739,_0x2c9687,_0x19652a){return{'message':_0x19b739,'unlock':_0x2c9687,'active':_0x19652a};};exports[_0x3e79('0xd')]=function(_0x1bb2a9,_0x33883a,_0x29ee36){if(!_['isUndefined'](_0x29ee36)&&_0x3e79('0xe')===typeof _0x29ee36&&!_[_0x3e79('0xf')](_0x29ee36)){if(!_['isUndefined'](_0x33883a)&&_0x3e79('0xe')===typeof _0x33883a&&!_[_0x3e79('0xf')](_0x33883a)){return util[_0x3e79('0x10')]('\x22%s\x22\x20<%s>',_0x33883a,_0x29ee36);}return util[_0x3e79('0x10')](_0x3e79('0x11'),_0x29ee36,_0x29ee36);}if(!_[_0x3e79('0x12')](_0x1bb2a9)&&_0x3e79('0xe')===typeof _0x1bb2a9&&!_[_0x3e79('0xf')](_0x1bb2a9)){return _0x1bb2a9;}return _0x3e79('0x13');};exports[_0x3e79('0x14')]=function(_0x1fd670){if(_[_0x3e79('0x15')](_0x1fd670)){return![];}return _0x1fd670;};exports[_0x3e79('0x16')]=function(_0x525a00,_0x220fa5,_0x1564aa,_0x98f8f2,_0x293df5,_0x3af24a){var _0x479e39={'XMD-QUEUE':_0x220fa5[_0x3e79('0x17')]?_0x220fa5[_0x3e79('0x17')][_0x3e79('0x18')]:'','XMD-CALLERID':_0x98f8f2,'XMD-CALLERID-PREVIEW':_0x3af24a?util[_0x3e79('0x10')](_0x3e79('0x11'),_0x3af24a['calleridname'],_0x3af24a['calleridnum']):_0x98f8f2,'XMD-DIALID':_0x293df5,'XMD-CONTACTID':_0x220fa5[_0x3e79('0x19')],'XMD-CDRTYPE':_0x3e79('0x1a'),'CALLERID(all)':_0x98f8f2,'XMD-VOICEQUEUEID':_0x220fa5['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1564aa,'XMD-DIALTIMEOUT':_0x525a00[_0x3e79('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x525a00[_0x3e79('0x1c')]?'g':'',_['isEmpty'](_0x525a00[_0x3e79('0x1d')])?'':_0x3e79('0x1e')),'XMD-DIALURL':_0x525a00[_0x3e79('0x1f')]||'','XMD-AGI':_0x525a00['dialQueueProject']?util['format'](_0x3e79('0x20'),ipAgi,_0x525a00[_0x3e79('0x21')]):_0x3e79('0x22'),'XMD-AGIAFTER':_0x525a00[_0x3e79('0x1c')]?util[_0x3e79('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x525a00[_0x3e79('0x1c')]):_0x3e79('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3af24a?_0x3af24a[_0x3e79('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3af24a?_0x3af24a[_0x3e79('0x24')]:'','XMD-DESTINATION':_0x3e79('0x25'),'SIPADDHEADER':_0x3e79('0x26')};if(!_['isEmpty'](_0x525a00[_0x3e79('0x1d')])){_0x479e39[util[_0x3e79('0x10')]('%s',_0x3e79('0x27'))]=_0x525a00[_0x3e79('0x1d')];_0x479e39[util[_0x3e79('0x10')]('%s',_0x3e79('0x28'))]=_0x293df5;}if(_0x220fa5&&_0x220fa5[_0x3e79('0x29')]){for(var _0xac8dc2 in _0x220fa5['Contact']){if(_0x220fa5[_0x3e79('0x29')][_0x3e79('0x2a')](_0xac8dc2)){if(!_[_0x3e79('0x15')](_0x220fa5[_0x3e79('0x29')][_0xac8dc2])&&_0xac8dc2!=='id'&&_0xac8dc2!=='tags'&&_0xac8dc2!==_0x3e79('0x2b')&&_0xac8dc2!==_0x3e79('0x2c')){_0x479e39[util['format'](_0x3e79('0x2d'),_0x3e79('0x2e'),_[_0x3e79('0x2f')](_0xac8dc2))]=_0x220fa5['Contact'][_0xac8dc2];}}}}return _0x479e39;};exports['toLowerVariables']=function(_0x4a5708){var _0x5de8aa={};for(var _0x432e6e in _0x4a5708){if(_0x4a5708[_0x3e79('0x2a')](_0x432e6e)){_0x5de8aa[util[_0x3e79('0x10')]('%s',_['toLower'](_0x432e6e))]=_0x4a5708[_0x432e6e];}}return{'variables':_0x5de8aa};};exports[_0x3e79('0x30')]=function(_0x3ba283,_0x394ccc){if(!_[_0x3e79('0x15')](_0x3ba283)){if(_0x3ba283[_0x3e79('0x2a')](_0x3e79('0x31'))){if(_0x3ba283[_0x3e79('0x31')]>0x0){_0x3ba283['originated']-=0x1;}else{logger[_0x3e79('0x8')](_0x3e79('0x32'),_0x394ccc);}}}else{logger[_0x3e79('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x394ccc);}};exports[_0x3e79('0x33')]=function(_0x3c7d0f){var _0x401bcc=moment()[_0x3e79('0x10')](_0x3e79('0x34'));_0x3c7d0f[_0x3e79('0x35')]=0xd;_0x3c7d0f['statedesc']=_0x3e79('0x36');_0x3c7d0f['starttime']=_0x401bcc;_0x3c7d0f[_0x3e79('0x37')]=_0x401bcc;_0x3c7d0f['endtime']=_0x401bcc;};exports[_0x3e79('0x38')]=function(_0x324427,_0xe21c90,_0x163b49){var _0x5e7a09=moment()['format'](_0x3e79('0x34'));_0x324427['state']=_0xe21c90;_0x324427[_0x3e79('0x39')]=_0x163b49;_0x324427[_0x3e79('0x37')]=_0x5e7a09;_0x324427['ringtime']=getSeconds(_0x324427[_0x3e79('0x37')],_0x324427[_0x3e79('0x3a')]);};exports[_0x3e79('0x3b')]=function(_0x2ea2ab,_0x1292a9,_0x1d763e){_0x2ea2ab[_0x3e79('0x3c')]=_0x1292a9;_0x2ea2ab[_0x3e79('0x3d')]=_0x1d763e;};exports[_0x3e79('0x3e')]=function(_0x84e523,_0x1a1230,_0x152cd7){var _0x294330=moment()['format'](_0x3e79('0x34'));_0x84e523[_0x3e79('0x35')]=_0x1a1230;_0x84e523[_0x3e79('0x39')]=_0x152cd7;_0x84e523['responsetime']=_0x84e523[_0x3e79('0x37')]?_0x84e523[_0x3e79('0x37')]:_0x294330;_0x84e523[_0x3e79('0x3f')]=_0x84e523[_0x3e79('0x3f')]?_0x84e523['endtime']:_0x294330;_0x84e523[_0x3e79('0x40')]=getSeconds(_0x84e523[_0x3e79('0x37')]||0x0,_0x84e523['starttime']||0x0);_0x84e523[_0x3e79('0x41')]=_0x84e523[_0x3e79('0x42')]?getSeconds(_0x84e523[_0x3e79('0x3f')],_0x84e523[_0x3e79('0x42')]):0x0;};exports['isFailure']=function(_0x550f13){return _0x550f13===_0x3e79('0x43');};exports[_0x3e79('0x44')]=function(_0x3c59f4,_0x7f4877,_0x4c812a,_0x15f627,_0x961fab){var _0x5f2a71=_0x15f627?_0x3e79('0x45'):_0x3c59f4[_0x3e79('0x46')];_0x5f2a71=_0x961fab?_0x3e79('0x47'):_0x5f2a71;return{'actionid':_0x3c59f4[_0x3e79('0x48')],'action':_0x3e79('0x49'),'channel':_0x3c59f4[_0x3e79('0x4a')],'callerid':util[_0x3e79('0x10')](_0x3e79('0x11'),_0x5f2a71,_0x3c59f4[_0x3e79('0x4b')]),'Exten':_0x3e79('0x25'),'Context':'from-sip','Priority':'1','variable':_0x4c812a,'timeout':(_0x7f4877[_0x3e79('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c59f4[_0x3e79('0x48')]};};exports['totalGlobal']=function(_0x44912d){return _0x44912d['countbusyretry']+_0x44912d[_0x3e79('0x4d')]+_0x44912d['countnoanswerretry']+_0x44912d['countagentrejectretry']+_0x44912d[_0x3e79('0x4e')];};exports[_0x3e79('0x4f')]=function(_0xdef205){var _0x5cd9d7=_[_0x3e79('0x50')](_0xdef205);_0x5cd9d7[_0x3e79('0x35')]=0xf;_0x5cd9d7[_0x3e79('0x39')]=_0x3e79('0x51');return _0x5cd9d7;};exports[_0x3e79('0x52')]=function(_0xe6aa0e,_0x47b6fd,_0x5718f6){var _0x1e36a7={};_0x1e36a7[_0x47b6fd]=_0xe6aa0e[_0x47b6fd];_0x1e36a7[_0x3e79('0x53')]=![];_0x1e36a7[_0x3e79('0x54')]=moment()[_0x3e79('0x55')](_0x5718f6,_0x3e79('0x56'))[_0x3e79('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e36a7[_0x3e79('0x19')]=_0xe6aa0e['ContactId'];_0x1e36a7['ListId']=_0xe6aa0e[_0x3e79('0x57')];_0x1e36a7[_0x3e79('0x58')]=_0xe6aa0e[_0x3e79('0x58')]||undefined;return _0x1e36a7;};exports[_0x3e79('0x59')]=function(_0x384cd8,_0x216848){if(!_[_0x3e79('0x15')](_0x384cd8)){if(_0x384cd8[_0x3e79('0x5a')]>0x0){_0x384cd8[_0x3e79('0x5a')]-=0x1;}else{logger[_0x3e79('0x8')](_0x216848,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3e79('0x8')](_0x216848,_0x3e79('0x5b'));}};exports[_0x3e79('0x5c')]=function(_0x7e9206){if(_0x7e9206<=0x0){return!![];}return![];};exports[_0x3e79('0x5d')]=function(_0x118d2b,_0xe5ad10,_0x14df58){_0x118d2b[_0x3e79('0x5e')]=_0xe5ad10;_0x118d2b[_0x3e79('0x18')]=_0x118d2b[_0x3e79('0x5f')];_0x118d2b[_0x3e79('0x60')]=_0x118d2b[_0x3e79('0x4a')];_0x118d2b[_0x3e79('0x61')]=_0x3e79('0x62');if(_0x14df58){_0x118d2b['mandatoryDisposition']=_0x14df58[_0x3e79('0x63')];}return _0x118d2b;};exports['buildAcw']=function(_0x2b2f52){var _0x3a9837={};_0x3a9837['queue']=_0x2b2f52[_0x3e79('0x5f')];_0x3a9837[_0x3e79('0x60')]=_0x2b2f52[_0x3e79('0x4a')];_0x3a9837[_0x3e79('0x48')]=_0x2b2f52[_0x3e79('0x48')];return _0x3a9837;};exports[_0x3e79('0x64')]=function(_0x5b79b1){var _0x5e111d=[];for(var _0x3bd906 in _0x5b79b1){if(_0x5b79b1[_0x3e79('0x2a')](_0x3bd906)){if(!_[_0x3e79('0x15')](_0x5b79b1[_0x3bd906])&&_0x5b79b1[_0x3bd906][_0x3e79('0x35')]===_0x3e79('0x65')&&_0x5b79b1[_0x3bd906]['status']===_0x3e79('0x66')){_0x5e111d['push'](_0x5b79b1[_0x3bd906]['id']);}}}return _0x5e111d;};exports['getDiff']=function(_0xc70047){var _0x3cb3f3=moment()[_0x3e79('0x6')](0x0);var _0x346c51=moment(_0xc70047)[_0x3e79('0x6')](0x0);return _0x3cb3f3[_0x3e79('0x67')](_0x346c51,'seconds');};exports['createBody']=function(_0xe9e714){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xe9e714[_0x3e79('0x19')],'ListId':_0xe9e714[_0x3e79('0x57')],'VoiceQueueId':_0xe9e714[_0x3e79('0x58')]||undefined,'CampaignId':_0xe9e714['CampaignId']||undefined};};exports['filterKey']=function(_0x45de85){if(_0x45de85===_0x3e79('0x48')||_0x45de85===_0x3e79('0x68')||_0x45de85===_0x3e79('0x5f')||_0x45de85===_0x3e79('0x69')||_0x45de85===_0x3e79('0x6a')||_0x45de85==='dialAnswer'||_0x45de85==='membername'||_0x45de85===_0x3e79('0x4a')||_0x45de85==='calleridname'||_0x45de85==='active'||_0x45de85===_0x3e79('0x4b')||_0x45de85===_0x3e79('0x54')||_0x45de85==='countbusyretry'||_0x45de85==='countcongestionretry'||_0x45de85===_0x3e79('0x6b')||_0x45de85===_0x3e79('0x6c')||_0x45de85===_0x3e79('0x6d')||_0x45de85===_0x3e79('0x6e')||_0x45de85===_0x3e79('0x6f')||_0x45de85===_0x3e79('0x70')||_0x45de85==='ContactId'||_0x45de85===_0x3e79('0x57')||_0x45de85==='UserId'||_0x45de85==='VoiceQueueId'||_0x45de85==='sipcallid'||_0x45de85===_0x3e79('0x71')||_0x45de85===_0x3e79('0x72')||_0x45de85===_0x3e79('0x73')||_0x45de85===_0x3e79('0x74')||_0x45de85==='xmd-dialurl'||_0x45de85==='xmd-dialtimeout'||_0x45de85===_0x3e79('0x75')||_0x45de85===_0x3e79('0x76')||_0x45de85==='xmd-dialchannel'||_0x45de85===_0x3e79('0x77')||_0x45de85===_0x3e79('0x78')||_0x45de85==='xmd-callerid'||_0x45de85===_0x3e79('0x79')||_0x45de85===_0x3e79('0x7a')||_0x45de85===_0x3e79('0x7b')||_0x45de85==='rtpaudioqosbridged'||_0x45de85===_0x3e79('0x7c')||_0x45de85===_0x3e79('0x7d')||_0x45de85===_0x3e79('0x7e')||_0x45de85===_0x3e79('0x7f')||_0x45de85===_0x3e79('0x80')||_0x45de85===_0x3e79('0x81')||_0x45de85===_0x3e79('0x7b')||_0x45de85===_0x3e79('0x82')||_0x45de85===_0x3e79('0x7c')||_0x45de85===_0x3e79('0x7d')||_0x45de85==='rtpaudioqosloss'||_0x45de85===_0x3e79('0x7f')||_0x45de85==='rtpaudioqosrtt'||_0x45de85===_0x3e79('0x81')||_0x45de85===_0x3e79('0x83')||_0x45de85===_0x3e79('0x84')||_0x45de85===_0x3e79('0x35')||_0x45de85===_0x3e79('0x39')){return![];}return!![];};exports[_0x3e79('0x85')]=function(_0x51cb85,_0x3676a7){var _0x1ce39d,_0x1c9ac0,_0x2b47cf;if(_0x3676a7<=0x0){_0x3676a7=0x1;}_0x1ce39d=new RegExp(_0x3e79('0x86')+_0x3676a7+'}$');_0x1c9ac0=Math[_0x3e79('0x87')](0xa,_0x3676a7-0x1);_0x2b47cf=Math['pow'](0xa,_0x3676a7)-0x1;return util[_0x3e79('0x10')]('%s',_[_0x3e79('0x88')](_0x51cb85,_0x1ce39d,_[_0x3e79('0x89')](_0x1c9ac0,_0x2b47cf)));};exports[_0x3e79('0x8a')]=function(_0x4ff340){var _0x34495b=_0x4ff340[_0x3e79('0x8b')](/"(.*?)"/);return _0x34495b?_0x34495b[0x1]:_0x4ff340;};exports['extractCalleridNumber']=function(_0x165480){var _0xfc6d57=_0x165480[_0x3e79('0x8b')](/<(.*?)>/);return _0xfc6d57?_0xfc6d57[0x1]:_0x165480;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2566352..7791e8a 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 _0xc5ae=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queuepause','boolean'];(function(_0x24cd72,_0x53ba5c){var _0x2989ea=function(_0x315473){while(--_0x315473){_0x24cd72['push'](_0x24cd72['shift']());}};_0x2989ea(++_0x53ba5c);}(_0xc5ae,0x113));var _0xec5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc5ae[_0x14add3];return _0x4a174f;};'use strict';exports[_0xec5a('0x0')]={'queue':{'type':_0xec5a('0x1'),'required':!![]},'interface':{'type':_0xec5a('0x1'),'required':!![]},'membername':{'type':_0xec5a('0x1'),'required':!![]},'penalty':{'type':_0xec5a('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xec5a('0x1'),'required':!![]},'interface':{'type':_0xec5a('0x1'),'required':!![]}};exports[_0xec5a('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xec5a('0x4')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xec5a('0x1'),'required':!![]}};exports[_0xec5a('0x5')]={'uniqueid':{'type':_0xec5a('0x1'),'required':!![]},'filename':{'type':_0xec5a('0x1')},'format':{'type':_0xec5a('0x1')},'mixmonitorid':{'type':_0xec5a('0x1')}};exports[_0xec5a('0x6')]={'uniqueid':{'type':_0xec5a('0x1'),'required':!![]}};exports[_0xec5a('0x7')]={'uniqueid':{'type':_0xec5a('0x1'),'required':!![]},'exten':{'type':_0xec5a('0x1'),'required':!![]},'context':{'type':_0xec5a('0x1')}}; \ No newline at end of file +var _0x9296=['queueremove','voicequeuechannel','voicequeuechannelhangup','queueadd','string','number','boolean'];(function(_0x22839b,_0x5d3d52){var _0x31d4f4=function(_0x2903fe){while(--_0x2903fe){_0x22839b['push'](_0x22839b['shift']());}};_0x31d4f4(++_0x5d3d52);}(_0x9296,0xe3));var _0x6929=function(_0x59dfea,_0x5334d9){_0x59dfea=_0x59dfea-0x0;var _0x5d50b9=_0x9296[_0x59dfea];return _0x5d50b9;};'use strict';exports[_0x6929('0x0')]={'queue':{'type':_0x6929('0x1'),'required':!![]},'interface':{'type':_0x6929('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6929('0x2'),'required':![]},'paused':{'type':_0x6929('0x3'),'required':![]}};exports[_0x6929('0x4')]={'queue':{'type':_0x6929('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x6929('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x6929('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x6929('0x1'),'required':![]}};exports[_0x6929('0x5')]={'uniqueid':{'type':_0x6929('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x6929('0x1'),'required':!![]},'filename':{'type':_0x6929('0x1')},'format':{'type':_0x6929('0x1')},'mixmonitorid':{'type':_0x6929('0x1')}};exports[_0x6929('0x6')]={'uniqueid':{'type':_0x6929('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x6929('0x1'),'required':!![]},'exten':{'type':_0x6929('0x1'),'required':!![]},'context':{'type':_0x6929('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 43f0860..451ba99 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 _0xe6a6=['initTelephones','mergeFromDatabase','initTrunks','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','sumHoldTime','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','diff','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','faxAccounts','exports','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../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','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','isUndefined'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xe6a6,0x1d9));var _0x6e6a=function(_0x1cd310,_0x28be66){_0x1cd310=_0x1cd310-0x0;var _0x4bf4b0=_0xe6a6[_0x1cd310];return _0x4bf4b0;};'use strict';var BPromise=require('bluebird');var util=require(_0x6e6a('0x0'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x6e6a('0x1'));var Trunk=require(_0x6e6a('0x2'));var VoiceQueue=require(_0x6e6a('0x3'));var Trigger=require(_0x6e6a('0x4'));var Template=require(_0x6e6a('0x5'));var Campaign=require(_0x6e6a('0x6'));var VoiceExtension=require(_0x6e6a('0x7'));var ZendeskAccount=require(_0x6e6a('0x8'));var SalesforceAccount=require(_0x6e6a('0x9'));var FreshdeskAccount=require(_0x6e6a('0xa'));var SugarcrmAccount=require(_0x6e6a('0xb'));var ZohoAccount=require(_0x6e6a('0xc'));var DeskAccount=require(_0x6e6a('0xd'));var VtigerAccount=require(_0x6e6a('0xe'));var ServicenowAccount=require(_0x6e6a('0xf'));var Dynamics365Account=require(_0x6e6a('0x10'));var FreshsalesAccount=require(_0x6e6a('0x11'));var FaxAccount=require(_0x6e6a('0x12'));var Realtime=function(){this[_0x6e6a('0x13')]={};this[_0x6e6a('0x14')]={};this[_0x6e6a('0x15')]={};this[_0x6e6a('0x16')]={};this[_0x6e6a('0x17')]={};this[_0x6e6a('0x18')]={};this[_0x6e6a('0x19')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6e6a('0x1a')]={};this[_0x6e6a('0x1b')]={};this[_0x6e6a('0x1c')]={};this[_0x6e6a('0x1d')]={};this['timers']={};this[_0x6e6a('0x1e')]={};this[_0x6e6a('0x1f')]={};this[_0x6e6a('0x20')]={};this[_0x6e6a('0x21')]={};this[_0x6e6a('0x22')]={};this['zohoAccounts']={};this[_0x6e6a('0x23')]={};this[_0x6e6a('0x24')]={};this[_0x6e6a('0x25')]={};this[_0x6e6a('0x26')]={};this[_0x6e6a('0x27')]={};this['faxAccounts']={};};function freeIsNotKey(_0x261554,_0x2a4f23,_0x14747b){var _0x42a8eb=_[_0x6e6a('0x28')](_0x261554,function(_0x75d668,_0x58ca4d){return _0x75d668[_0x14747b];});for(var _0x22f376 in _0x2a4f23){if(_0x2a4f23[_0x6e6a('0x29')](_0x22f376)){if(!_0x42a8eb[_0x22f376]){delete _0x2a4f23[_0x22f376];}}}}function freeIsNotKeySip(_0x5d7d9a,_0x218420){var _0x41931d=_[_0x6e6a('0x28')](_0x5d7d9a,function(_0x17e9a7,_0x5a57eb){return util['format'](_0x6e6a('0x2a'),_0x17e9a7[_0x6e6a('0x2b')]);});for(var _0x358355 in _0x218420){if(_0x218420[_0x6e6a('0x29')](_0x358355)){if(!_0x41931d[_0x358355]){delete _0x218420[_0x358355];}}}}function freeIsNotKeyAgent(_0x2ff5b4,_0xd1df44){var _0x54aef0=_['mapKeys'](_0x2ff5b4,function(_0x1c3431,_0x4929d4){var _0x23d7d2=_[_0x6e6a('0x2c')](_0x1c3431[_0x6e6a('0x2d')])?util[_0x6e6a('0x2e')](_0x6e6a('0x2a'),_0x1c3431['name']):_0x1c3431[_0x6e6a('0x2d')];return _0x23d7d2;});for(var _0x1bc9a5 in _0xd1df44){if(_0xd1df44[_0x6e6a('0x29')](_0x1bc9a5)){if(!_0x54aef0[_0x1bc9a5]){delete _0xd1df44[_0x1bc9a5];}}}}function clearVoiceCallReports(_0x2810eb){_0x2810eb[_0x6e6a('0x2f')]=0x0;_0x2810eb['answered']=0x0;_0x2810eb['sumHoldTime']=0x0;_0x2810eb[_0x6e6a('0x30')]=0x0;_0x2810eb[_0x6e6a('0x31')]=0x0;}function clearCampaigns(_0x97ec20){if(!_[_0x6e6a('0x32')](_0x97ec20)){for(var _0x3c79c5 in _0x97ec20){if(_0x97ec20[_0x6e6a('0x29')](_0x3c79c5)){_0x97ec20[_0x3c79c5][_0x6e6a('0x33')]=0x0;_0x97ec20[_0x3c79c5][_0x6e6a('0x34')]=0x0;}}}}function clearVoiceQueues(_0x1faf7c){if(!_[_0x6e6a('0x32')](_0x1faf7c)){for(var _0x6b3646 in _0x1faf7c){if(_0x1faf7c[_0x6e6a('0x29')](_0x6b3646)){_0x1faf7c[_0x6b3646][_0x6e6a('0x2f')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x35')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x36')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x37')]=0x0;_0x1faf7c[_0x6b3646]['sumHoldTime']=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x30')]=0x0;_0x1faf7c[_0x6b3646]['sumBillable']=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x38')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x39')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3a')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3b')]=0x0;_0x1faf7c[_0x6b3646]['outboundNoSuchCallsDay']=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3c')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3d')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3e')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x3f')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x40')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x41')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x42')]=0x0;_0x1faf7c[_0x6b3646]['outboundAnswerAgiCallsDay']=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x43')]=0x0;_0x1faf7c[_0x6b3646][_0x6e6a('0x44')]=!![];}}}}Realtime[_0x6e6a('0x45')]['mergeFromDatabase']=function(_0x66b4e2,_0x355f6d){for(var _0xc3b803 in _0x355f6d){if(_0x66b4e2[_0x6e6a('0x29')](_0xc3b803)){_0x66b4e2[_0xc3b803]=_0x355f6d[_0xc3b803];}}};Realtime[_0x6e6a('0x45')]['initAgents']=function(){var _0x21626f=this;return function(_0x31eb3b){if(_0x31eb3b){freeIsNotKeyAgent(_0x31eb3b,_0x21626f[_0x6e6a('0x13')]);for(var _0x29aced=0x0,_0x9c0487={},_0x587824={};_0x29aced<_0x31eb3b[_0x6e6a('0x46')];_0x29aced+=0x1){_0x9c0487=_0x31eb3b[_0x29aced];var _0x2d21a4=_['isNil'](_0x9c0487[_0x6e6a('0x2d')])?util['format'](_0x6e6a('0x2a'),_0x9c0487[_0x6e6a('0x2b')]):_0x9c0487[_0x6e6a('0x2d')];if(_[_0x6e6a('0x47')](_0x21626f[_0x6e6a('0x13')][_0x2d21a4])){_0x21626f[_0x6e6a('0x13')][_0x2d21a4]=new Agent(_0x9c0487);}else{_0x21626f['mergeFromDatabase'](_0x21626f[_0x6e6a('0x13')][_0x2d21a4],_0x9c0487);}}}return _0x21626f[_0x6e6a('0x13')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x48')]=function(){var _0x23a370=this;return function(_0x3a21d6){if(_0x3a21d6){freeIsNotKeySip(_0x3a21d6,_0x23a370[_0x6e6a('0x14')]);for(var _0xd2c38f=0x0,_0x1541dc={},_0x5bd06b={};_0xd2c38f<_0x3a21d6['length'];_0xd2c38f+=0x1){_0x1541dc=_0x3a21d6[_0xd2c38f];if(_[_0x6e6a('0x47')](_0x23a370['telephones'][util[_0x6e6a('0x2e')](_0x6e6a('0x2a'),_0x1541dc[_0x6e6a('0x2b')])])){_0x23a370[_0x6e6a('0x14')][util[_0x6e6a('0x2e')](_0x6e6a('0x2a'),_0x1541dc[_0x6e6a('0x2b')])]=new Telephone(_0x1541dc);}else{_0x23a370[_0x6e6a('0x49')](_0x23a370[_0x6e6a('0x14')][util[_0x6e6a('0x2e')](_0x6e6a('0x2a'),_0x1541dc['name'])],_0x1541dc);}}}return _0x23a370[_0x6e6a('0x14')];};};Realtime['prototype'][_0x6e6a('0x4a')]=function(){var _0x398697=this;return function(_0x2cfac8){if(_0x2cfac8){freeIsNotKeySip(_0x2cfac8,_0x398697[_0x6e6a('0x15')]);for(var _0x3488f2=0x0,_0x273a4c={},_0x56ded2={};_0x3488f2<_0x2cfac8[_0x6e6a('0x46')];_0x3488f2+=0x1){_0x273a4c=_0x2cfac8[_0x3488f2];if(_['isUndefined'](_0x398697[_0x6e6a('0x15')][util[_0x6e6a('0x2e')](_0x6e6a('0x2a'),_0x273a4c[_0x6e6a('0x2b')])])){_0x398697[_0x6e6a('0x15')][util[_0x6e6a('0x2e')]('SIP/%s',_0x273a4c[_0x6e6a('0x2b')])]=new Trunk(_0x273a4c);}else{_0x398697['mergeFromDatabase'](_0x398697[_0x6e6a('0x15')][util['format'](_0x6e6a('0x2a'),_0x273a4c[_0x6e6a('0x2b')])],_0x273a4c);}}}return _0x398697[_0x6e6a('0x15')];};};Realtime[_0x6e6a('0x45')]['initVoiceQueues']=function(){var _0x11df39=this;return function(_0x1b5959){if(_0x1b5959){freeIsNotKey(_0x1b5959,_0x11df39['voiceQueues'],_0x6e6a('0x2b'));for(var _0x44b91b=0x0,_0x166a1f={},_0x25c813={};_0x44b91b<_0x1b5959[_0x6e6a('0x46')];_0x44b91b+=0x1){_0x166a1f=_0x1b5959[_0x44b91b];if(_['isUndefined'](_0x11df39[_0x6e6a('0x16')][_0x166a1f['name']])){_0x11df39['voiceQueues'][_0x166a1f[_0x6e6a('0x2b')]]=new VoiceQueue(_0x166a1f);}else{_0x11df39[_0x6e6a('0x49')](_0x11df39[_0x6e6a('0x16')][_0x166a1f[_0x6e6a('0x2b')]],_0x166a1f);}}}return _0x11df39[_0x6e6a('0x16')];};};Realtime['prototype'][_0x6e6a('0x4b')]=function(){var _0x46fc88=this;return function(_0xb2b124){if(_0xb2b124){freeIsNotKey(_0xb2b124,_0x46fc88[_0x6e6a('0x17')],'id');for(var _0x1aad93=0x0,_0x196d16={},_0x3931e9={};_0x1aad93<_0xb2b124[_0x6e6a('0x46')];_0x1aad93+=0x1){_0x196d16=_0xb2b124[_0x1aad93];if(_[_0x6e6a('0x47')](_0x46fc88[_0x6e6a('0x17')][_0x196d16['id']])){_0x46fc88[_0x6e6a('0x17')][_0x196d16['id']]=new Trigger(_0x196d16);}else{_0x46fc88[_0x6e6a('0x49')](_0x46fc88[_0x6e6a('0x17')][_0x196d16['id']],_0x196d16);}}}return _0x46fc88[_0x6e6a('0x17')];};};Realtime[_0x6e6a('0x45')]['initTemplates']=function(){var _0x5c608c=this;return function(_0x3ed143){if(_0x3ed143){freeIsNotKey(_0x3ed143,_0x5c608c['templates'],'id');for(var _0x1f0fbc=0x0,_0x5df107={},_0x218e08={};_0x1f0fbc<_0x3ed143[_0x6e6a('0x46')];_0x1f0fbc+=0x1){_0x5df107=_0x3ed143[_0x1f0fbc];if(_[_0x6e6a('0x47')](_0x5c608c[_0x6e6a('0x19')][_0x5df107['id']])){_0x5c608c[_0x6e6a('0x19')][_0x5df107['id']]=new Template(_0x5df107);}else{_0x5c608c['mergeFromDatabase'](_0x5c608c[_0x6e6a('0x19')][_0x5df107['id']],_0x5df107);}}}return _0x5c608c[_0x6e6a('0x19')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x4c')]=function(){var _0x434d51=this;return function(_0x4c9127){if(_0x4c9127){freeIsNotKey(_0x4c9127,_0x434d51['zendeskAccounts'],'id');for(var _0x1ffdda=0x0,_0x1089da={},_0x2e39df={};_0x1ffdda<_0x4c9127[_0x6e6a('0x46')];_0x1ffdda+=0x1){_0x1089da=_0x4c9127[_0x1ffdda];if(_['isUndefined'](_0x434d51[_0x6e6a('0x1f')][_0x1089da['id']])){_0x434d51[_0x6e6a('0x1f')][_0x1089da['id']]=new ZendeskAccount(_0x1089da);}else{_0x434d51[_0x6e6a('0x49')](_0x434d51[_0x6e6a('0x1f')][_0x1089da['id']],_0x1089da);}}}return _0x434d51[_0x6e6a('0x1f')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x4d')]=function(){var _0x435618=this;return function(_0x1284fa){if(_0x1284fa){freeIsNotKey(_0x1284fa,_0x435618['salesforceAccounts'],'id');for(var _0x2cbfdc=0x0,_0x448103={},_0x441ad6={};_0x2cbfdc<_0x1284fa[_0x6e6a('0x46')];_0x2cbfdc+=0x1){_0x448103=_0x1284fa[_0x2cbfdc];if(_['isUndefined'](_0x435618[_0x6e6a('0x20')][_0x448103['id']])){_0x435618[_0x6e6a('0x20')][_0x448103['id']]=new SalesforceAccount(_0x448103);}else{_0x435618['mergeFromDatabase'](_0x435618[_0x6e6a('0x20')][_0x448103['id']],_0x448103);}}}return _0x435618['salesforceAccounts'];};};Realtime['prototype'][_0x6e6a('0x4e')]=function(){var _0x599428=this;return function(_0x436452){if(_0x436452){freeIsNotKey(_0x436452,_0x599428[_0x6e6a('0x22')],'id');for(var _0xac471=0x0,_0x8e58ef={},_0x22d857={};_0xac471<_0x436452[_0x6e6a('0x46')];_0xac471+=0x1){_0x8e58ef=_0x436452[_0xac471];if(_[_0x6e6a('0x47')](_0x599428[_0x6e6a('0x22')][_0x8e58ef['id']])){_0x599428[_0x6e6a('0x22')][_0x8e58ef['id']]=new FreshdeskAccount(_0x8e58ef);}else{_0x599428[_0x6e6a('0x49')](_0x599428[_0x6e6a('0x22')][_0x8e58ef['id']],_0x8e58ef);}}}return _0x599428['freshdeskAccounts'];};};Realtime[_0x6e6a('0x45')]['initZohoAccounts']=function(){var _0x2e1a72=this;return function(_0x52d71c){if(_0x52d71c){freeIsNotKey(_0x52d71c,_0x2e1a72[_0x6e6a('0x4f')],'id');for(var _0x5abcf2=0x0,_0x5cde0d={},_0x27d1c2={};_0x5abcf2<_0x52d71c[_0x6e6a('0x46')];_0x5abcf2+=0x1){_0x5cde0d=_0x52d71c[_0x5abcf2];if(_[_0x6e6a('0x47')](_0x2e1a72[_0x6e6a('0x4f')][_0x5cde0d['id']])){_0x2e1a72[_0x6e6a('0x4f')][_0x5cde0d['id']]=new ZohoAccount(_0x5cde0d);}else{_0x2e1a72[_0x6e6a('0x49')](_0x2e1a72['zohoAccounts'][_0x5cde0d['id']],_0x5cde0d);}}}return _0x2e1a72[_0x6e6a('0x4f')];};};Realtime[_0x6e6a('0x45')]['initDeskAccounts']=function(){var _0x8d083c=this;return function(_0x230738){if(_0x230738){freeIsNotKey(_0x230738,_0x8d083c[_0x6e6a('0x23')],'id');for(var _0x28bcc4=0x0,_0x2ce85f={},_0x331aaf={};_0x28bcc4<_0x230738['length'];_0x28bcc4+=0x1){_0x2ce85f=_0x230738[_0x28bcc4];if(_[_0x6e6a('0x47')](_0x8d083c[_0x6e6a('0x23')][_0x2ce85f['id']])){_0x8d083c['deskAccounts'][_0x2ce85f['id']]=new DeskAccount(_0x2ce85f);}else{_0x8d083c[_0x6e6a('0x49')](_0x8d083c[_0x6e6a('0x23')][_0x2ce85f['id']],_0x2ce85f);}}}return _0x8d083c[_0x6e6a('0x23')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x50')]=function(){var _0x3fcf18=this;return function(_0xccaeb4){if(_0xccaeb4){freeIsNotKey(_0xccaeb4,_0x3fcf18[_0x6e6a('0x21')],'id');for(var _0x596227=0x0,_0x198070={},_0x2e0cc3={};_0x596227<_0xccaeb4['length'];_0x596227+=0x1){_0x198070=_0xccaeb4[_0x596227];if(_[_0x6e6a('0x47')](_0x3fcf18[_0x6e6a('0x21')][_0x198070['id']])){_0x3fcf18[_0x6e6a('0x21')][_0x198070['id']]=new SugarcrmAccount(_0x198070);}else{_0x3fcf18[_0x6e6a('0x49')](_0x3fcf18[_0x6e6a('0x21')][_0x198070['id']],_0x198070);}}}return _0x3fcf18['sugarcrmAccounts'];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x51')]=function(){var _0x467cbd=this;return function(_0x131df6){if(_0x131df6){freeIsNotKey(_0x131df6,_0x467cbd[_0x6e6a('0x24')],'id');for(var _0x1bd4f5=0x0,_0x2904ec={},_0x4e11c5={};_0x1bd4f5<_0x131df6[_0x6e6a('0x46')];_0x1bd4f5+=0x1){_0x2904ec=_0x131df6[_0x1bd4f5];if(_[_0x6e6a('0x47')](_0x467cbd[_0x6e6a('0x24')][_0x2904ec['id']])){_0x467cbd['vtigerAccounts'][_0x2904ec['id']]=new VtigerAccount(_0x2904ec);}else{_0x467cbd['mergeFromDatabase'](_0x467cbd[_0x6e6a('0x24')][_0x2904ec['id']],_0x2904ec);}}}return _0x467cbd[_0x6e6a('0x24')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x52')]=function(){var _0x4a7704=this;return function(_0x268b78){if(_0x268b78){freeIsNotKey(_0x268b78,_0x4a7704[_0x6e6a('0x25')],'id');for(var _0x4ebafc=0x0,_0x3333e3={},_0x492008={};_0x4ebafc<_0x268b78[_0x6e6a('0x46')];_0x4ebafc+=0x1){_0x3333e3=_0x268b78[_0x4ebafc];if(_[_0x6e6a('0x47')](_0x4a7704[_0x6e6a('0x25')][_0x3333e3['id']])){_0x4a7704[_0x6e6a('0x25')][_0x3333e3['id']]=new ServicenowAccount(_0x3333e3);}else{_0x4a7704[_0x6e6a('0x49')](_0x4a7704[_0x6e6a('0x25')][_0x3333e3['id']],_0x3333e3);}}}return _0x4a7704['servicenowAccounts'];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x53')]=function(){var _0x33527e=this;return function(_0x4c3fcc){if(_0x4c3fcc){freeIsNotKey(_0x4c3fcc,_0x33527e[_0x6e6a('0x26')],'id');for(var _0x4c12ff=0x0,_0x1559d8={},_0x2809cb={};_0x4c12ff<_0x4c3fcc['length'];_0x4c12ff+=0x1){_0x1559d8=_0x4c3fcc[_0x4c12ff];if(_[_0x6e6a('0x47')](_0x33527e[_0x6e6a('0x26')][_0x1559d8['id']])){_0x33527e[_0x6e6a('0x26')][_0x1559d8['id']]=new Dynamics365Account(_0x1559d8);}else{_0x33527e[_0x6e6a('0x49')](_0x33527e['dynamics365Accounts'][_0x1559d8['id']],_0x1559d8);}}}return _0x33527e['dynamics365Accounts'];};};Realtime[_0x6e6a('0x45')]['initFreshsalesAccounts']=function(){var _0x24bb25=this;return function(_0x4bc2a1){if(_0x4bc2a1){freeIsNotKey(_0x4bc2a1,_0x24bb25['freshsalesAccounts'],'id');for(var _0x4de1b0=0x0,_0x5d5b1e={},_0xe076f2={};_0x4de1b0<_0x4bc2a1['length'];_0x4de1b0+=0x1){_0x5d5b1e=_0x4bc2a1[_0x4de1b0];if(_['isUndefined'](_0x24bb25[_0x6e6a('0x27')][_0x5d5b1e['id']])){_0x24bb25[_0x6e6a('0x27')][_0x5d5b1e['id']]=new FreshsalesAccount(_0x5d5b1e);}else{_0x24bb25[_0x6e6a('0x49')](_0x24bb25[_0x6e6a('0x27')][_0x5d5b1e['id']],_0x5d5b1e);}}}return _0x24bb25['freshsalesAccounts'];};};Realtime[_0x6e6a('0x45')]['initVoiceQueueHopperHistory']=function(){var _0x3e451f=this;return function(_0x41d74e){for(var _0x4d1078=0x0;_0x4d1078<_0x41d74e[_0x6e6a('0x46')];_0x4d1078+=0x1){_[_0x6e6a('0x54')](_0x3e451f[_0x6e6a('0x16')][_0x41d74e[_0x4d1078]['name']],_0x41d74e[_0x4d1078]);}return _0x3e451f[_0x6e6a('0x16')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x55')]=function(){var _0x1e55be=this;return function(_0x20c895){clearVoiceQueues(_0x1e55be[_0x6e6a('0x16')]);if(_0x20c895){_0x20c895=_[_0x6e6a('0x56')](_0x20c895,_0x6e6a('0x57'));for(var _0x2dd6d5 in _0x20c895){if(_0x20c895[_0x6e6a('0x29')](_0x2dd6d5)){var _0x4d3c9d={};for(var _0x1e44fb=0x0;_0x1e44fb<_0x20c895[_0x2dd6d5]['length'];_0x1e44fb+=0x1){var _0x2af329=_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x58')];if(_0x1e55be[_0x6e6a('0x16')][_0x2af329]){if(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x59')]){_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x36')]+=0x1;}if(_0x20c895[_0x2dd6d5][_0x1e44fb]['queuecallerabandon']){_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x37')]+=0x1;}_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x5a')]+=moment(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x5b')])['diff'](moment(_0x20c895[_0x2dd6d5][_0x1e44fb]['queuecallerjoinAt']),_0x6e6a('0x5c'))||0x0;if(_0x1e44fb===_0x20c895[_0x2dd6d5]['length']-0x1){_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x30')]+=moment(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x5d')]||_0x20c895[_0x2dd6d5][_0x1e44fb]['queuecallerabandonAt']||_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x5e')])['diff'](moment(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x5f')]),_0x6e6a('0x5c'))||0x0;_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x2f')]+=0x1;if(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x60')]){_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x35')]+=0x1;_0x1e55be['voiceQueues'][_0x2af329][_0x6e6a('0x31')]+=moment(_0x20c895[_0x2dd6d5][_0x1e44fb]['queuecallercompleteAt'])[_0x6e6a('0x61')](moment(_0x20c895[_0x2dd6d5][_0x1e44fb][_0x6e6a('0x5b')]),_0x6e6a('0x5c'))||0x0;}}else{_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x30')]+=_0x1e55be[_0x6e6a('0x16')][_0x2af329][_0x6e6a('0x5a')]||0x0;}}}}}}return _0x1e55be[_0x6e6a('0x16')];};};Realtime['prototype'][_0x6e6a('0x62')]=function(){var _0x54112a=this;return function(_0x34032d){clearVoiceCallReports(_0x54112a[_0x6e6a('0x63')]);if(_0x34032d){for(var _0xce59e5=0x0;_0xce59e5<_0x34032d[_0x6e6a('0x46')];_0xce59e5+=0x1){_0x54112a['outbound']['total']+=0x1;_0x54112a['outbound'][_0x6e6a('0x30')]+=_0x34032d[_0xce59e5][_0x6e6a('0x64')];if(_0x34032d[_0xce59e5]['disposition']===_0x6e6a('0x65')){_0x54112a[_0x6e6a('0x63')][_0x6e6a('0x35')]+=0x1;_0x54112a[_0x6e6a('0x63')][_0x6e6a('0x5a')]+=_0x34032d[_0xce59e5][_0x6e6a('0x64')]-_0x34032d[_0xce59e5][_0x6e6a('0x66')]||0x0;_0x54112a[_0x6e6a('0x63')][_0x6e6a('0x31')]+=_0x34032d[_0xce59e5]['billableseconds'];}}}return _0x54112a[_0x6e6a('0x63')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x67')]=function(){var _0x4493b6=this;return function(_0x5deac9){if(_0x5deac9){freeIsNotKey(_0x5deac9,_0x4493b6[_0x6e6a('0x18')],_0x6e6a('0x2b'));for(var _0x19d57b=0x0,_0xfc374a={};_0x19d57b<_0x5deac9[_0x6e6a('0x46')];_0x19d57b+=0x1){_0xfc374a=_0x5deac9[_0x19d57b];if(_['isUndefined'](_0x4493b6[_0x6e6a('0x18')][_0xfc374a['name']])){_0x4493b6[_0x6e6a('0x18')][_0xfc374a[_0x6e6a('0x2b')]]=new Campaign(_0xfc374a);}else{_0x4493b6[_0x6e6a('0x49')](_0x4493b6[_0x6e6a('0x18')][_0xfc374a[_0x6e6a('0x2b')]],_0xfc374a);_0x4493b6['campaigns'][_0xfc374a[_0x6e6a('0x2b')]][_0x6e6a('0x68')]=_0xfc374a[_0x6e6a('0x69')]?_0xfc374a[_0x6e6a('0x69')]['name']:undefined;}}}return _0x4493b6[_0x6e6a('0x18')];};};Realtime[_0x6e6a('0x45')][_0x6e6a('0x6a')]=function(){var _0x1bccc7=this;return function(_0x28450f){if(_0x28450f){freeIsNotKey(_0x28450f,_0x1bccc7['voiceExtensions'],'id');for(var _0x375709=0x0,_0x1313a9={};_0x375709<_0x28450f['length'];_0x375709+=0x1){_0x1313a9=_0x28450f[_0x375709];if(_['isUndefined'](_0x1bccc7[_0x6e6a('0x1a')][_0x1313a9['id']])){_0x1bccc7[_0x6e6a('0x1a')][_0x1313a9['id']]=new VoiceExtension(_0x1313a9);}else{_0x1bccc7[_0x6e6a('0x49')](_0x1bccc7[_0x6e6a('0x1a')][_0x1313a9['id']],_0x1313a9);}}}return _0x1bccc7[_0x6e6a('0x1a')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0xd8d2ea=this;return function(_0x4205b9){clearCampaigns(_0xd8d2ea[_0x6e6a('0x18')]);for(var _0x47b12e=0x0;_0x47b12e<_0x4205b9[_0x6e6a('0x46')];_0x47b12e+=0x1){_['merge'](_0xd8d2ea[_0x6e6a('0x18')][_0x4205b9[_0x47b12e][_0x6e6a('0x2b')]],_0x4205b9[_0x47b12e]);}return _0xd8d2ea[_0x6e6a('0x18')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x3188a4=this;return function(_0x1b295e){if(_0x1b295e){freeIsNotKey(_0x1b295e,_0x3188a4[_0x6e6a('0x6b')],'id');for(var _0x5b0fb7=0x0,_0x3a5585={},_0x48b6b4={};_0x5b0fb7<_0x1b295e[_0x6e6a('0x46')];_0x5b0fb7+=0x1){_0x3a5585=_0x1b295e[_0x5b0fb7];if(_['isUndefined'](_0x3188a4[_0x6e6a('0x6b')][_0x3a5585['id']])){_0x3188a4['faxAccounts'][_0x3a5585['id']]=new FaxAccount(_0x3a5585);}else{_0x3188a4[_0x6e6a('0x49')](_0x3188a4[_0x6e6a('0x6b')][_0x3a5585['id']],_0x3a5585);}}}return _0x3188a4[_0x6e6a('0x6b')];};};module[_0x6e6a('0x6c')]=Realtime; \ No newline at end of file +var _0xa3c8=['../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','campaigns','templates','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','isNil','interface','format','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','name','initTelephones','isUndefined','initTrunks','trunks','voiceQueues','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','SquareProject','initFaxAccounts','util','lodash','moment'];(function(_0x40a357,_0xcea901){var _0x1814ee=function(_0x5ad158){while(--_0x5ad158){_0x40a357['push'](_0x40a357['shift']());}};_0x1814ee(++_0xcea901);}(_0xa3c8,0x67));var _0x8a3c=function(_0x4ad73f,_0x2a2b6e){_0x4ad73f=_0x4ad73f-0x0;var _0x57cf2f=_0xa3c8[_0x4ad73f];return _0x57cf2f;};'use strict';var BPromise=require('bluebird');var util=require(_0x8a3c('0x0'));var _=require(_0x8a3c('0x1'));var moment=require(_0x8a3c('0x2'));var Agent=require(_0x8a3c('0x3'));var Telephone=require(_0x8a3c('0x4'));var Trunk=require(_0x8a3c('0x5'));var VoiceQueue=require(_0x8a3c('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x8a3c('0x7'));var Campaign=require(_0x8a3c('0x8'));var VoiceExtension=require(_0x8a3c('0x9'));var ZendeskAccount=require(_0x8a3c('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x8a3c('0xb'));var SugarcrmAccount=require(_0x8a3c('0xc'));var ZohoAccount=require(_0x8a3c('0xd'));var DeskAccount=require(_0x8a3c('0xe'));var VtigerAccount=require(_0x8a3c('0xf'));var ServicenowAccount=require(_0x8a3c('0x10'));var Dynamics365Account=require(_0x8a3c('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x8a3c('0x12'));var Realtime=function(){this[_0x8a3c('0x13')]={};this[_0x8a3c('0x14')]={};this['trunks']={};this['voiceQueues']={};this['triggers']={};this[_0x8a3c('0x15')]={};this[_0x8a3c('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8a3c('0x17')]={};this[_0x8a3c('0x18')]={};this[_0x8a3c('0x19')]={};this['outboundChannels']={};this[_0x8a3c('0x1a')]={};this[_0x8a3c('0x1b')]={};this[_0x8a3c('0x1c')]={};this[_0x8a3c('0x1d')]={};this['sugarcrmAccounts']={};this[_0x8a3c('0x1e')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x8a3c('0x1f')]={};this[_0x8a3c('0x20')]={};this[_0x8a3c('0x21')]={};this[_0x8a3c('0x22')]={};this[_0x8a3c('0x23')]={};};function freeIsNotKey(_0x54bc42,_0x4bd81a,_0x469507){var _0x3c1b00=_[_0x8a3c('0x24')](_0x54bc42,function(_0x293b52,_0x4b3a9b){return _0x293b52[_0x469507];});for(var _0x51e60f in _0x4bd81a){if(_0x4bd81a[_0x8a3c('0x25')](_0x51e60f)){if(!_0x3c1b00[_0x51e60f]){delete _0x4bd81a[_0x51e60f];}}}}function freeIsNotKeySip(_0xa942f5,_0x5f0197){var _0x4987f8=_[_0x8a3c('0x24')](_0xa942f5,function(_0x44c042,_0xdfcc13){return util['format'](_0x8a3c('0x26'),_0x44c042['name']);});for(var _0x59313b in _0x5f0197){if(_0x5f0197['hasOwnProperty'](_0x59313b)){if(!_0x4987f8[_0x59313b]){delete _0x5f0197[_0x59313b];}}}}function freeIsNotKeyAgent(_0x2461fb,_0x1cc560){var _0x35d581=_[_0x8a3c('0x24')](_0x2461fb,function(_0x24cbc0,_0x20900e){var _0x237924=_[_0x8a3c('0x27')](_0x24cbc0[_0x8a3c('0x28')])?util[_0x8a3c('0x29')](_0x8a3c('0x26'),_0x24cbc0['name']):_0x24cbc0[_0x8a3c('0x28')];return _0x237924;});for(var _0x127a4c in _0x1cc560){if(_0x1cc560[_0x8a3c('0x25')](_0x127a4c)){if(!_0x35d581[_0x127a4c]){delete _0x1cc560[_0x127a4c];}}}}function clearVoiceCallReports(_0x566851){_0x566851[_0x8a3c('0x2a')]=0x0;_0x566851['answered']=0x0;_0x566851[_0x8a3c('0x2b')]=0x0;_0x566851[_0x8a3c('0x2c')]=0x0;_0x566851[_0x8a3c('0x2d')]=0x0;}function clearCampaigns(_0x39d943){if(!_[_0x8a3c('0x2e')](_0x39d943)){for(var _0x2b1b59 in _0x39d943){if(_0x39d943[_0x8a3c('0x25')](_0x2b1b59)){_0x39d943[_0x2b1b59][_0x8a3c('0x2f')]=0x0;_0x39d943[_0x2b1b59][_0x8a3c('0x30')]=0x0;}}}}function clearVoiceQueues(_0x8ad528){if(!_[_0x8a3c('0x2e')](_0x8ad528)){for(var _0x377e74 in _0x8ad528){if(_0x8ad528[_0x8a3c('0x25')](_0x377e74)){_0x8ad528[_0x377e74][_0x8a3c('0x2a')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x31')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x32')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x33')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x2b')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x2c')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x2d')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x34')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x35')]=0x0;_0x8ad528[_0x377e74]['outboundBusyCallsDay']=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x36')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x37')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x38')]=0x0;_0x8ad528[_0x377e74]['outboundDropCallsDayTimeout']=0x0;_0x8ad528[_0x377e74]['outboundDropCallsDayCallersExit']=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x39')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x3a')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x3b')]=0x0;_0x8ad528[_0x377e74]['outboundReCallsDay']=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x34')]=0x0;_0x8ad528[_0x377e74][_0x8a3c('0x3c')]=0x0;_0x8ad528[_0x377e74]['queueStatusComplete']=!![];}}}}Realtime[_0x8a3c('0x3d')][_0x8a3c('0x3e')]=function(_0x43d2ea,_0x48dd88){for(var _0x167810 in _0x48dd88){if(_0x43d2ea[_0x8a3c('0x25')](_0x167810)){_0x43d2ea[_0x167810]=_0x48dd88[_0x167810];}}};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x3f')]=function(){var _0x4f5bee=this;return function(_0x3da717){if(_0x3da717){freeIsNotKeyAgent(_0x3da717,_0x4f5bee[_0x8a3c('0x13')]);for(var _0xbeef2d=0x0,_0xdd7f64={},_0x2c2b1e={};_0xbeef2d<_0x3da717[_0x8a3c('0x40')];_0xbeef2d+=0x1){_0xdd7f64=_0x3da717[_0xbeef2d];var _0x553682=_['isNil'](_0xdd7f64[_0x8a3c('0x28')])?util[_0x8a3c('0x29')](_0x8a3c('0x26'),_0xdd7f64[_0x8a3c('0x41')]):_0xdd7f64[_0x8a3c('0x28')];if(_['isUndefined'](_0x4f5bee['agents'][_0x553682])){_0x4f5bee[_0x8a3c('0x13')][_0x553682]=new Agent(_0xdd7f64);}else{_0x4f5bee[_0x8a3c('0x3e')](_0x4f5bee[_0x8a3c('0x13')][_0x553682],_0xdd7f64);}}}return _0x4f5bee[_0x8a3c('0x13')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x42')]=function(){var _0x2682b5=this;return function(_0x4cc906){if(_0x4cc906){freeIsNotKeySip(_0x4cc906,_0x2682b5['telephones']);for(var _0x398431=0x0,_0x1569ca={},_0x269445={};_0x398431<_0x4cc906['length'];_0x398431+=0x1){_0x1569ca=_0x4cc906[_0x398431];if(_[_0x8a3c('0x43')](_0x2682b5['telephones'][util[_0x8a3c('0x29')](_0x8a3c('0x26'),_0x1569ca[_0x8a3c('0x41')])])){_0x2682b5['telephones'][util['format'](_0x8a3c('0x26'),_0x1569ca[_0x8a3c('0x41')])]=new Telephone(_0x1569ca);}else{_0x2682b5[_0x8a3c('0x3e')](_0x2682b5[_0x8a3c('0x14')][util['format'](_0x8a3c('0x26'),_0x1569ca[_0x8a3c('0x41')])],_0x1569ca);}}}return _0x2682b5[_0x8a3c('0x14')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x44')]=function(){var _0x49e5a4=this;return function(_0x47cb7e){if(_0x47cb7e){freeIsNotKeySip(_0x47cb7e,_0x49e5a4['trunks']);for(var _0xa3b6b2=0x0,_0x593aee={},_0x25d6a1={};_0xa3b6b2<_0x47cb7e[_0x8a3c('0x40')];_0xa3b6b2+=0x1){_0x593aee=_0x47cb7e[_0xa3b6b2];if(_[_0x8a3c('0x43')](_0x49e5a4[_0x8a3c('0x45')][util[_0x8a3c('0x29')](_0x8a3c('0x26'),_0x593aee[_0x8a3c('0x41')])])){_0x49e5a4['trunks'][util['format'](_0x8a3c('0x26'),_0x593aee[_0x8a3c('0x41')])]=new Trunk(_0x593aee);}else{_0x49e5a4[_0x8a3c('0x3e')](_0x49e5a4[_0x8a3c('0x45')][util['format'](_0x8a3c('0x26'),_0x593aee['name'])],_0x593aee);}}}return _0x49e5a4['trunks'];};};Realtime[_0x8a3c('0x3d')]['initVoiceQueues']=function(){var _0x453907=this;return function(_0x89e5a1){if(_0x89e5a1){freeIsNotKey(_0x89e5a1,_0x453907[_0x8a3c('0x46')],_0x8a3c('0x41'));for(var _0x2fcd63=0x0,_0x522153={},_0x10d16b={};_0x2fcd63<_0x89e5a1[_0x8a3c('0x40')];_0x2fcd63+=0x1){_0x522153=_0x89e5a1[_0x2fcd63];if(_['isUndefined'](_0x453907[_0x8a3c('0x46')][_0x522153[_0x8a3c('0x41')]])){_0x453907['voiceQueues'][_0x522153[_0x8a3c('0x41')]]=new VoiceQueue(_0x522153);}else{_0x453907[_0x8a3c('0x3e')](_0x453907[_0x8a3c('0x46')][_0x522153['name']],_0x522153);}}}return _0x453907['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0x828fde=this;return function(_0xa515f3){if(_0xa515f3){freeIsNotKey(_0xa515f3,_0x828fde['triggers'],'id');for(var _0x44e65a=0x0,_0x15c8fa={},_0x20c7f1={};_0x44e65a<_0xa515f3['length'];_0x44e65a+=0x1){_0x15c8fa=_0xa515f3[_0x44e65a];if(_[_0x8a3c('0x43')](_0x828fde[_0x8a3c('0x47')][_0x15c8fa['id']])){_0x828fde[_0x8a3c('0x47')][_0x15c8fa['id']]=new Trigger(_0x15c8fa);}else{_0x828fde[_0x8a3c('0x3e')](_0x828fde['triggers'][_0x15c8fa['id']],_0x15c8fa);}}}return _0x828fde[_0x8a3c('0x47')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x48')]=function(){var _0x518d2a=this;return function(_0x9a8d41){if(_0x9a8d41){freeIsNotKey(_0x9a8d41,_0x518d2a['templates'],'id');for(var _0x147736=0x0,_0x266723={},_0xd60067={};_0x147736<_0x9a8d41[_0x8a3c('0x40')];_0x147736+=0x1){_0x266723=_0x9a8d41[_0x147736];if(_[_0x8a3c('0x43')](_0x518d2a[_0x8a3c('0x16')][_0x266723['id']])){_0x518d2a[_0x8a3c('0x16')][_0x266723['id']]=new Template(_0x266723);}else{_0x518d2a[_0x8a3c('0x3e')](_0x518d2a[_0x8a3c('0x16')][_0x266723['id']],_0x266723);}}}return _0x518d2a[_0x8a3c('0x16')];};};Realtime['prototype'][_0x8a3c('0x49')]=function(){var _0x46054d=this;return function(_0x6e7752){if(_0x6e7752){freeIsNotKey(_0x6e7752,_0x46054d[_0x8a3c('0x1c')],'id');for(var _0x1d8bd5=0x0,_0x5512fc={},_0x334945={};_0x1d8bd5<_0x6e7752['length'];_0x1d8bd5+=0x1){_0x5512fc=_0x6e7752[_0x1d8bd5];if(_[_0x8a3c('0x43')](_0x46054d[_0x8a3c('0x1c')][_0x5512fc['id']])){_0x46054d[_0x8a3c('0x1c')][_0x5512fc['id']]=new ZendeskAccount(_0x5512fc);}else{_0x46054d[_0x8a3c('0x3e')](_0x46054d[_0x8a3c('0x1c')][_0x5512fc['id']],_0x5512fc);}}}return _0x46054d[_0x8a3c('0x1c')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x4a')]=function(){var _0x19ce85=this;return function(_0x5ed196){if(_0x5ed196){freeIsNotKey(_0x5ed196,_0x19ce85[_0x8a3c('0x1d')],'id');for(var _0x3db9af=0x0,_0x1189f0={},_0x9fd40a={};_0x3db9af<_0x5ed196[_0x8a3c('0x40')];_0x3db9af+=0x1){_0x1189f0=_0x5ed196[_0x3db9af];if(_[_0x8a3c('0x43')](_0x19ce85[_0x8a3c('0x1d')][_0x1189f0['id']])){_0x19ce85[_0x8a3c('0x1d')][_0x1189f0['id']]=new SalesforceAccount(_0x1189f0);}else{_0x19ce85['mergeFromDatabase'](_0x19ce85['salesforceAccounts'][_0x1189f0['id']],_0x1189f0);}}}return _0x19ce85[_0x8a3c('0x1d')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x4b')]=function(){var _0x594bfb=this;return function(_0x27bc1f){if(_0x27bc1f){freeIsNotKey(_0x27bc1f,_0x594bfb[_0x8a3c('0x1e')],'id');for(var _0x30933f=0x0,_0x42e9fd={},_0x5be4ac={};_0x30933f<_0x27bc1f[_0x8a3c('0x40')];_0x30933f+=0x1){_0x42e9fd=_0x27bc1f[_0x30933f];if(_[_0x8a3c('0x43')](_0x594bfb[_0x8a3c('0x1e')][_0x42e9fd['id']])){_0x594bfb[_0x8a3c('0x1e')][_0x42e9fd['id']]=new FreshdeskAccount(_0x42e9fd);}else{_0x594bfb[_0x8a3c('0x3e')](_0x594bfb[_0x8a3c('0x1e')][_0x42e9fd['id']],_0x42e9fd);}}}return _0x594bfb['freshdeskAccounts'];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x4c')]=function(){var _0x57197e=this;return function(_0x410867){if(_0x410867){freeIsNotKey(_0x410867,_0x57197e[_0x8a3c('0x4d')],'id');for(var _0x54f5c9=0x0,_0x526e46={},_0x6a4b30={};_0x54f5c9<_0x410867[_0x8a3c('0x40')];_0x54f5c9+=0x1){_0x526e46=_0x410867[_0x54f5c9];if(_[_0x8a3c('0x43')](_0x57197e[_0x8a3c('0x4d')][_0x526e46['id']])){_0x57197e[_0x8a3c('0x4d')][_0x526e46['id']]=new ZohoAccount(_0x526e46);}else{_0x57197e[_0x8a3c('0x3e')](_0x57197e[_0x8a3c('0x4d')][_0x526e46['id']],_0x526e46);}}}return _0x57197e[_0x8a3c('0x4d')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x4e')]=function(){var _0x426cbf=this;return function(_0x2a65c4){if(_0x2a65c4){freeIsNotKey(_0x2a65c4,_0x426cbf[_0x8a3c('0x4f')],'id');for(var _0x34acb0=0x0,_0x4284f3={},_0x41eca1={};_0x34acb0<_0x2a65c4[_0x8a3c('0x40')];_0x34acb0+=0x1){_0x4284f3=_0x2a65c4[_0x34acb0];if(_[_0x8a3c('0x43')](_0x426cbf['deskAccounts'][_0x4284f3['id']])){_0x426cbf[_0x8a3c('0x4f')][_0x4284f3['id']]=new DeskAccount(_0x4284f3);}else{_0x426cbf[_0x8a3c('0x3e')](_0x426cbf['deskAccounts'][_0x4284f3['id']],_0x4284f3);}}}return _0x426cbf[_0x8a3c('0x4f')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x50')]=function(){var _0x12b51d=this;return function(_0x4dec93){if(_0x4dec93){freeIsNotKey(_0x4dec93,_0x12b51d[_0x8a3c('0x51')],'id');for(var _0x34b0a2=0x0,_0x58c086={},_0x4701e7={};_0x34b0a2<_0x4dec93[_0x8a3c('0x40')];_0x34b0a2+=0x1){_0x58c086=_0x4dec93[_0x34b0a2];if(_[_0x8a3c('0x43')](_0x12b51d[_0x8a3c('0x51')][_0x58c086['id']])){_0x12b51d[_0x8a3c('0x51')][_0x58c086['id']]=new SugarcrmAccount(_0x58c086);}else{_0x12b51d['mergeFromDatabase'](_0x12b51d[_0x8a3c('0x51')][_0x58c086['id']],_0x58c086);}}}return _0x12b51d[_0x8a3c('0x51')];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x52')]=function(){var _0x36da14=this;return function(_0x4bc0ac){if(_0x4bc0ac){freeIsNotKey(_0x4bc0ac,_0x36da14['vtigerAccounts'],'id');for(var _0x3a402b=0x0,_0x5d7408={},_0x1d1b86={};_0x3a402b<_0x4bc0ac[_0x8a3c('0x40')];_0x3a402b+=0x1){_0x5d7408=_0x4bc0ac[_0x3a402b];if(_['isUndefined'](_0x36da14['vtigerAccounts'][_0x5d7408['id']])){_0x36da14[_0x8a3c('0x1f')][_0x5d7408['id']]=new VtigerAccount(_0x5d7408);}else{_0x36da14[_0x8a3c('0x3e')](_0x36da14['vtigerAccounts'][_0x5d7408['id']],_0x5d7408);}}}return _0x36da14[_0x8a3c('0x1f')];};};Realtime[_0x8a3c('0x3d')]['initServicenowAccounts']=function(){var _0x58a7af=this;return function(_0x948faf){if(_0x948faf){freeIsNotKey(_0x948faf,_0x58a7af['servicenowAccounts'],'id');for(var _0x3d2fb5=0x0,_0x5f5ba5={},_0x69747d={};_0x3d2fb5<_0x948faf[_0x8a3c('0x40')];_0x3d2fb5+=0x1){_0x5f5ba5=_0x948faf[_0x3d2fb5];if(_[_0x8a3c('0x43')](_0x58a7af[_0x8a3c('0x20')][_0x5f5ba5['id']])){_0x58a7af[_0x8a3c('0x20')][_0x5f5ba5['id']]=new ServicenowAccount(_0x5f5ba5);}else{_0x58a7af[_0x8a3c('0x3e')](_0x58a7af[_0x8a3c('0x20')][_0x5f5ba5['id']],_0x5f5ba5);}}}return _0x58a7af['servicenowAccounts'];};};Realtime['prototype'][_0x8a3c('0x53')]=function(){var _0x531ae0=this;return function(_0x4eceb6){if(_0x4eceb6){freeIsNotKey(_0x4eceb6,_0x531ae0['dynamics365Accounts'],'id');for(var _0x3cd901=0x0,_0x157b55={},_0x15a6b={};_0x3cd901<_0x4eceb6[_0x8a3c('0x40')];_0x3cd901+=0x1){_0x157b55=_0x4eceb6[_0x3cd901];if(_[_0x8a3c('0x43')](_0x531ae0[_0x8a3c('0x21')][_0x157b55['id']])){_0x531ae0[_0x8a3c('0x21')][_0x157b55['id']]=new Dynamics365Account(_0x157b55);}else{_0x531ae0[_0x8a3c('0x3e')](_0x531ae0[_0x8a3c('0x21')][_0x157b55['id']],_0x157b55);}}}return _0x531ae0['dynamics365Accounts'];};};Realtime['prototype'][_0x8a3c('0x54')]=function(){var _0x1cb985=this;return function(_0x182c91){if(_0x182c91){freeIsNotKey(_0x182c91,_0x1cb985[_0x8a3c('0x22')],'id');for(var _0xa67623=0x0,_0x607a82={},_0x4fe16a={};_0xa67623<_0x182c91['length'];_0xa67623+=0x1){_0x607a82=_0x182c91[_0xa67623];if(_[_0x8a3c('0x43')](_0x1cb985[_0x8a3c('0x22')][_0x607a82['id']])){_0x1cb985[_0x8a3c('0x22')][_0x607a82['id']]=new FreshsalesAccount(_0x607a82);}else{_0x1cb985[_0x8a3c('0x3e')](_0x1cb985[_0x8a3c('0x22')][_0x607a82['id']],_0x607a82);}}}return _0x1cb985['freshsalesAccounts'];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x55')]=function(){var _0xf1f745=this;return function(_0x8bb3e0){for(var _0x428703=0x0;_0x428703<_0x8bb3e0['length'];_0x428703+=0x1){_[_0x8a3c('0x56')](_0xf1f745[_0x8a3c('0x46')][_0x8bb3e0[_0x428703][_0x8a3c('0x41')]],_0x8bb3e0[_0x428703]);}return _0xf1f745[_0x8a3c('0x46')];};};Realtime[_0x8a3c('0x3d')]['initVoiceQueueReports']=function(){var _0x3a883c=this;return function(_0x4fefc0){clearVoiceQueues(_0x3a883c[_0x8a3c('0x46')]);if(_0x4fefc0){_0x4fefc0=_[_0x8a3c('0x57')](_0x4fefc0,_0x8a3c('0x58'));for(var _0x5eda76 in _0x4fefc0){if(_0x4fefc0['hasOwnProperty'](_0x5eda76)){var _0x2fdc21={};for(var _0x4ae19a=0x0;_0x4ae19a<_0x4fefc0[_0x5eda76][_0x8a3c('0x40')];_0x4ae19a+=0x1){var _0x1fca06=_0x4fefc0[_0x5eda76][_0x4ae19a]['queue'];if(_0x3a883c[_0x8a3c('0x46')][_0x1fca06]){if(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x59')]){_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x32')]+=0x1;}if(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5a')]){_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x33')]+=0x1;}_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x2b')]+=moment(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5b')])['diff'](moment(_0x4fefc0[_0x5eda76][_0x4ae19a]['queuecallerjoinAt']),_0x8a3c('0x5c'))||0x0;if(_0x4ae19a===_0x4fefc0[_0x5eda76][_0x8a3c('0x40')]-0x1){_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x2c')]+=moment(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5d')]||_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5e')]||_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5f')])[_0x8a3c('0x60')](moment(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x61')]),_0x8a3c('0x5c'))||0x0;_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x2a')]+=0x1;if(_0x4fefc0[_0x5eda76][_0x4ae19a]['queuecallercomplete']){_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x31')]+=0x1;_0x3a883c[_0x8a3c('0x46')][_0x1fca06][_0x8a3c('0x2d')]+=moment(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5d')])['diff'](moment(_0x4fefc0[_0x5eda76][_0x4ae19a][_0x8a3c('0x5b')]),_0x8a3c('0x5c'))||0x0;}}else{_0x3a883c[_0x8a3c('0x46')][_0x1fca06]['sumDuration']+=_0x3a883c['voiceQueues'][_0x1fca06]['sumHoldTime']||0x0;}}}}}}return _0x3a883c[_0x8a3c('0x46')];};};Realtime['prototype'][_0x8a3c('0x62')]=function(){var _0x193fe9=this;return function(_0x57b48d){clearVoiceCallReports(_0x193fe9['outbound']);if(_0x57b48d){for(var _0x278886=0x0;_0x278886<_0x57b48d['length'];_0x278886+=0x1){_0x193fe9['outbound'][_0x8a3c('0x2a')]+=0x1;_0x193fe9[_0x8a3c('0x63')][_0x8a3c('0x2c')]+=_0x57b48d[_0x278886]['duration'];if(_0x57b48d[_0x278886][_0x8a3c('0x64')]===_0x8a3c('0x65')){_0x193fe9[_0x8a3c('0x63')][_0x8a3c('0x31')]+=0x1;_0x193fe9[_0x8a3c('0x63')]['sumHoldTime']+=_0x57b48d[_0x278886][_0x8a3c('0x66')]-_0x57b48d[_0x278886][_0x8a3c('0x67')]||0x0;_0x193fe9[_0x8a3c('0x63')][_0x8a3c('0x2d')]+=_0x57b48d[_0x278886][_0x8a3c('0x67')];}}}return _0x193fe9[_0x8a3c('0x63')];};};Realtime[_0x8a3c('0x3d')]['initCampaigns']=function(){var _0xd9d7b5=this;return function(_0x160391){if(_0x160391){freeIsNotKey(_0x160391,_0xd9d7b5['campaigns'],_0x8a3c('0x41'));for(var _0x1aedde=0x0,_0x3fdc9c={};_0x1aedde<_0x160391[_0x8a3c('0x40')];_0x1aedde+=0x1){_0x3fdc9c=_0x160391[_0x1aedde];if(_[_0x8a3c('0x43')](_0xd9d7b5[_0x8a3c('0x15')][_0x3fdc9c[_0x8a3c('0x41')]])){_0xd9d7b5[_0x8a3c('0x15')][_0x3fdc9c['name']]=new Campaign(_0x3fdc9c);}else{_0xd9d7b5[_0x8a3c('0x3e')](_0xd9d7b5[_0x8a3c('0x15')][_0x3fdc9c[_0x8a3c('0x41')]],_0x3fdc9c);_0xd9d7b5['campaigns'][_0x3fdc9c[_0x8a3c('0x41')]]['dialQueueProject']=_0x3fdc9c[_0x8a3c('0x68')]?_0x3fdc9c[_0x8a3c('0x68')][_0x8a3c('0x41')]:undefined;}}}return _0xd9d7b5[_0x8a3c('0x15')];};};Realtime[_0x8a3c('0x3d')]['initVoiceExtensions']=function(){var _0x4dc5cd=this;return function(_0x468c7a){if(_0x468c7a){freeIsNotKey(_0x468c7a,_0x4dc5cd[_0x8a3c('0x17')],'id');for(var _0x46cfcf=0x0,_0x235968={};_0x46cfcf<_0x468c7a[_0x8a3c('0x40')];_0x46cfcf+=0x1){_0x235968=_0x468c7a[_0x46cfcf];if(_[_0x8a3c('0x43')](_0x4dc5cd['voiceExtensions'][_0x235968['id']])){_0x4dc5cd[_0x8a3c('0x17')][_0x235968['id']]=new VoiceExtension(_0x235968);}else{_0x4dc5cd[_0x8a3c('0x3e')](_0x4dc5cd['voiceExtensions'][_0x235968['id']],_0x235968);}}}return _0x4dc5cd[_0x8a3c('0x17')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x3525ae=this;return function(_0x7d9d5f){clearCampaigns(_0x3525ae[_0x8a3c('0x15')]);for(var _0x36c334=0x0;_0x36c334<_0x7d9d5f[_0x8a3c('0x40')];_0x36c334+=0x1){_[_0x8a3c('0x56')](_0x3525ae[_0x8a3c('0x15')][_0x7d9d5f[_0x36c334][_0x8a3c('0x41')]],_0x7d9d5f[_0x36c334]);}return _0x3525ae['campaigns'];};};Realtime[_0x8a3c('0x3d')][_0x8a3c('0x69')]=function(){var _0x201915=this;return function(_0x43c7e8){if(_0x43c7e8){freeIsNotKey(_0x43c7e8,_0x201915[_0x8a3c('0x23')],'id');for(var _0x1688b7=0x0,_0x551cfd={},_0x5d82cf={};_0x1688b7<_0x43c7e8[_0x8a3c('0x40')];_0x1688b7+=0x1){_0x551cfd=_0x43c7e8[_0x1688b7];if(_[_0x8a3c('0x43')](_0x201915[_0x8a3c('0x23')][_0x551cfd['id']])){_0x201915[_0x8a3c('0x23')][_0x551cfd['id']]=new FaxAccount(_0x551cfd);}else{_0x201915['mergeFromDatabase'](_0x201915[_0x8a3c('0x23')][_0x551cfd['id']],_0x551cfd);}}}return _0x201915[_0x8a3c('0x23')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9d0fc34..a12efb2 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 _0xa44e=['voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','connectedlinenum','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','length','filename','createdAt','connectedlinename','isArray','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport'];(function(_0x5ee6f3,_0x4cf046){var _0xa0a711=function(_0x52553f){while(--_0x52553f){_0x5ee6f3['push'](_0x5ee6f3['shift']());}};_0xa0a711(++_0x4cf046);}(_0xa44e,0x1b8));var _0xea44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa44e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea44('0x0'));var moment=require(_0xea44('0x1'));var util=require('util');var config=require(_0xea44('0x2'));var ami=require(_0xea44('0x3'));var RpcVoiceAgentReport=require(_0xea44('0x4'));var RpcVoiceCallReport=require(_0xea44('0x5'));var RpcVoiceDialReport=require(_0xea44('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xea44('0x7'));var RpcVoiceTransferReport=require(_0xea44('0x8'));var VoiceQueueReport=require(_0xea44('0x9'));var VoiceCallReport=require(_0xea44('0xa'));var VoiceAgentReport=require(_0xea44('0xb'));var VoiceDialReport=require(_0xea44('0xc'));var UserReport=require(_0xea44('0xd'));function Report(_0x597ddb){this[_0xea44('0xe')]=_0x597ddb;this[_0xea44('0xf')]=_0x597ddb['agents'];this['telephones']=_0x597ddb[_0xea44('0x10')];}Report['prototype'][_0xea44('0x11')]=function(_0x87a1ab){var _0x35e59e=new VoiceQueueReport(this[_0xea44('0xe')]);var _0x5b8a5e=new VoiceAgentReport(this[_0xea44('0xe')]);var _0x4505eb=new VoiceDialReport(this[_0xea44('0xe')]);var _0x193b21=new VoiceCallReport(this[_0xea44('0xe')]);var _0x306cc9=new UserReport(this[_0xea44('0xe')]);if(config['xdr']&&config[_0xea44('0x12')]['disabled']){ami['on'](_0xea44('0x13'),this[_0xea44('0x14')]['bind'](this));ami['on'](_0xea44('0x15'),this[_0xea44('0x16')][_0xea44('0x17')](this));ami['on'](_0xea44('0x18'),this[_0xea44('0x19')][_0xea44('0x17')](this));ami['on'](_0xea44('0x1a'),this[_0xea44('0x1b')]['bind'](this));ami['on']('blindtransfer',this[_0xea44('0x1c')][_0xea44('0x17')](this));ami['on'](_0xea44('0x1d'),this[_0xea44('0x1e')][_0xea44('0x17')](this));}};Report[_0xea44('0x1f')][_0xea44('0x20')]=function(_0xefd658){var _0x9c00f8;_0x9c00f8=_['find'](this['agents'],function(_0xfa87bf){return _0xfa87bf[_0xea44('0x21')]==_0xefd658||_0xfa87bf[_0xea44('0x22')]==_0xefd658;});if(_[_0xea44('0x23')](_0x9c00f8)){var _0x4e6a88=_[_0xea44('0x24')](this[_0xea44('0x10')],function(_0x296ac1){return _0x296ac1[_0xea44('0x21')]==_0xefd658||_0x296ac1['name']==_0xefd658;});if(_0x4e6a88){_0x9c00f8=_[_0xea44('0x24')](this[_0xea44('0xf')],function(_0x21c02f){return _0x21c02f[_0xea44('0x25')]==util[_0xea44('0x26')](_0xea44('0x27'),_0x4e6a88[_0xea44('0x22')]);});}}return _0x9c00f8;};Report[_0xea44('0x1f')]['voiceQueueReport']=function(_0x2a0c76){for(var _0x2e6410=0x0;_0x2e6410<_0x2a0c76['length'];_0x2e6410+=0x1){var _0x569311=this[_0xea44('0x20')](_0x2a0c76[_0x2e6410]['connectedlinenum']);if(_0x569311){_0x2a0c76[_0x2e6410][_0xea44('0x21')]=_0x569311[_0xea44('0x21')];_0x2a0c76[_0x2e6410][_0xea44('0x28')]=!![];_0x2a0c76[_0x2e6410][_0xea44('0x29')]=_0x569311[_0xea44('0x22')];_0x2a0c76[_0x2e6410][_0xea44('0x25')]=_[_0xea44('0x23')](_0x569311[_0xea44('0x25')])?util[_0xea44('0x26')](_0xea44('0x27'),_0x569311[_0xea44('0x22')]):_0x569311[_0xea44('0x25')];if(_0x2a0c76[_0x2e6410][_0xea44('0x2a')]){_0x2a0c76[_0x2e6410][_0xea44('0x2b')]=moment()[_0xea44('0x26')](_0xea44('0x2c'));}if(_0x2a0c76[_0x2e6410][_0xea44('0x2d')]){_0x2a0c76[_0x2e6410][_0xea44('0x2e')]=moment()['format'](_0xea44('0x2c'));}RpcMemberReport[_0xea44('0x14')](_0x2a0c76[_0x2e6410]);}RpcVoiceQueueReport[_0xea44('0x2f')](_0x2a0c76[_0x2e6410]);}};function extractCalleridNumber(_0x355a65){var _0x19027a=_0x355a65[_0xea44('0x30')](/<(.*?)>/);return _0x19027a?_0x19027a[0x1]:_0x355a65;}Report[_0xea44('0x1f')]['getAgentByInternal']=function(_0x3c1966){for(var _0x1dd1a3=0x0;_0x1dd1a3',_0x3ea466[_0xea44('0x48')],_0x3ea466[_0xea44('0x36')]);}if(RpcVoiceTransferReport[_0xea44('0x49')][_0x3ea466['linkedid']]){var _0x4a3fb4=RpcVoiceTransferReport['transfers'][_0x3ea466[_0xea44('0x4a')]];_0x4a3fb4[_0xea44('0x4b')]=_0x3ea466[_0xea44('0x4c')];RpcVoiceTransferReport[_0xea44('0x1c')](_0x4a3fb4);delete RpcVoiceTransferReport[_0xea44('0x49')][_0x3ea466[_0xea44('0x4a')]];}if(_[_0xea44('0x23')](_0x3ea466[_0xea44('0x3b')])){_0x3ea466['type']=this[_0xea44('0x32')](_0x3ea466);}if(_[_0xea44('0x23')](_0x3ea466[_0xea44('0x4d')])){var _0x16c54b=_0x3ea466[_0xea44('0x33')][_0xea44('0x34')]('-')[0x0];var _0x5b7b86=this[_0xea44('0xf')][_0x16c54b];if(!_0x5b7b86)_0x5b7b86=this[_0xea44('0x35')](_0x3ea466[_0xea44('0x21')]);if(_0x5b7b86){_0x3ea466[_0xea44('0x4d')]=_0x5b7b86['id'];_0x3ea466[_0xea44('0x4e')]=_0x5b7b86[_0xea44('0x22')];}}RpcVoiceCallReport[_0xea44('0x2f')](_0x3ea466);if(_0x3ea466[_0xea44('0x4f')]){for(var _0xfbf614=0x0;_0xfbf614<_0x3ea466[_0xea44('0x50')][_0xea44('0x51')];_0xfbf614+=0x1){_0x3ea466['monitorFilename']=_0x3ea466['monitors'][_0xfbf614][_0xea44('0x52')];_0x3ea466[_0xea44('0x53')]=_0x3ea466[_0xea44('0x50')][_0xfbf614][_0xea44('0x53')];if(_0x3ea466[_0xea44('0x3a')]==_0xea44('0x42')){_0x3ea466[_0xea44('0x36')]=_0x3ea466[_0xea44('0x47')];_0x3ea466['calleridname']=_0x3ea466[_0xea44('0x54')];_0x3ea466[_0xea44('0x47')]=_0x3ea466[_0xea44('0x21')];_0x3ea466['connectedlinename']=_0x3ea466[_0xea44('0x4e')];_0x3ea466[_0xea44('0x3a')]=_0x3ea466['originatecalleridnum'];}else if(_0x3ea466['exten']=='xcally-motion-dialer'){_0x3ea466[_0xea44('0x36')]=_0x3ea466['destination'];_0x3ea466['exten']=_0x3ea466[_0xea44('0x43')];}RpcVoiceRecording[_0xea44('0x2f')](_0x3ea466);}}};Report['prototype'][_0xea44('0x19')]=function(_0x306400){if(_[_0xea44('0x55')](_0x306400)){_0x306400['forEach'](function(_0x39e022){RpcVoiceAgentReport[_0xea44('0x2f')](_0x39e022);});}else{RpcVoiceAgentReport[_0xea44('0x2f')](_0x306400);}};Report['prototype']['voiceDialReport']=function(_0x44c833){RpcVoiceDialReport[_0xea44('0x2f')](_0x44c833);var _0x186adc;var _0x5030b4;var _0x260e99=_0x44c833['channel'];if(_['startsWith'](_0x260e99,_0xea44('0x56'))){_0x5030b4=_0x260e99[_0xea44('0x57')](_0x260e99[_0xea44('0x58')]('/')+0x1,_0x260e99['indexOf']('@'));_0x186adc=_[_0xea44('0x24')](this[_0xea44('0xf')],function(_0x47bd25){return _0x47bd25[_0xea44('0x59')]==_0x5030b4||_0x47bd25[_0xea44('0x5a')]==_0x5030b4||_0x47bd25['accountcode']==_0x5030b4;});}else{_0x5030b4=_0x260e99[_0xea44('0x57')](_0x260e99['indexOf']('/')+0x1,_0x260e99['lastIndexOf']('-'));_0x186adc=this[_0xea44('0x20')](_0x5030b4);}if(_0x186adc){_0x44c833[_0xea44('0x25')]=_['isNil'](_0x186adc[_0xea44('0x25')])?util['format']('SIP/%s',_0x186adc[_0xea44('0x22')]):_0x186adc[_0xea44('0x25')];_0x44c833[_0xea44('0x4e')]=_0x186adc[_0xea44('0x22')];_0x44c833[_0xea44('0x21')]=_0x186adc[_0xea44('0x21')];RpcMemberReport[_0xea44('0x1b')](_0x44c833);}};Report[_0xea44('0x1f')]['blindTransfer']=function(_0x311d59){RpcVoiceTransferReport[_0xea44('0x49')][_0x311d59[_0xea44('0x5b')]]=_0x311d59;};Report[_0xea44('0x1f')][_0xea44('0x1e')]=function(_0x547357){RpcVoiceTransferReport['attendedTransfer'](_0x547357);};module[_0xea44('0x5c')]=Report; \ No newline at end of file +var _0x7a3f=['getCallType','channel','split','calleridnum','outbound','destination','type','dialer','lastdata','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','monitor','monitors','filename','createdAt','connectedlinename','membername','exten','xcally-motion-dialer','Local','indexOf','mobile','phone','substring','SIP/%s','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','voiceQueueReport','length','connectedlinenum','assigned','queuecallercompleteAt','format','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys'];(function(_0x12fe86,_0x57ec8d){var _0x3c528b=function(_0x497daf){while(--_0x497daf){_0x12fe86['push'](_0x12fe86['shift']());}};_0x3c528b(++_0x57ec8d);}(_0x7a3f,0x135));var _0xf7a3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7a3f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf7a3('0x0'));var moment=require('moment');var util=require(_0xf7a3('0x1'));var config=require(_0xf7a3('0x2'));var ami=require(_0xf7a3('0x3'));var RpcVoiceAgentReport=require(_0xf7a3('0x4'));var RpcVoiceCallReport=require(_0xf7a3('0x5'));var RpcVoiceDialReport=require(_0xf7a3('0x6'));var RpcMemberReport=require(_0xf7a3('0x7'));var RpcVoiceQueueReport=require(_0xf7a3('0x8'));var RpcVoiceRecording=require(_0xf7a3('0x9'));var RpcVoiceTransferReport=require(_0xf7a3('0xa'));var VoiceQueueReport=require(_0xf7a3('0xb'));var VoiceCallReport=require(_0xf7a3('0xc'));var VoiceAgentReport=require(_0xf7a3('0xd'));var VoiceDialReport=require(_0xf7a3('0xe'));var UserReport=require(_0xf7a3('0xf'));function Report(_0x1a0109){this['realtime']=_0x1a0109;this[_0xf7a3('0x10')]=_0x1a0109[_0xf7a3('0x10')];this[_0xf7a3('0x11')]=_0x1a0109['telephones'];}Report[_0xf7a3('0x12')][_0xf7a3('0x13')]=function(_0x4a1997){var _0x307168=new VoiceQueueReport(this['realtime']);var _0x45ce27=new VoiceAgentReport(this[_0xf7a3('0x14')]);var _0x23efd6=new VoiceDialReport(this[_0xf7a3('0x14')]);var _0xd050db=new VoiceCallReport(this[_0xf7a3('0x14')]);var _0x3306f4=new UserReport(this[_0xf7a3('0x14')]);if(config[_0xf7a3('0x15')]&&config['xdr'][_0xf7a3('0x16')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xf7a3('0x17')](this));ami['on'](_0xf7a3('0x18'),this[_0xf7a3('0x19')][_0xf7a3('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0xf7a3('0x1a')][_0xf7a3('0x17')](this));ami['on'](_0xf7a3('0x1b'),this[_0xf7a3('0x1c')][_0xf7a3('0x17')](this));ami['on'](_0xf7a3('0x1d'),this[_0xf7a3('0x1e')][_0xf7a3('0x17')](this));ami['on']('attendedtransfer',this[_0xf7a3('0x1f')]['bind'](this));}};Report[_0xf7a3('0x12')][_0xf7a3('0x20')]=function(_0x2462aa){var _0x270971;_0x270971=_[_0xf7a3('0x21')](this[_0xf7a3('0x10')],function(_0x1a6969){return _0x1a6969[_0xf7a3('0x22')]==_0x2462aa||_0x1a6969[_0xf7a3('0x23')]==_0x2462aa;});if(_[_0xf7a3('0x24')](_0x270971)){var _0x4b9049=_['find'](this['telephones'],function(_0x49be6a){return _0x49be6a[_0xf7a3('0x22')]==_0x2462aa||_0x49be6a[_0xf7a3('0x23')]==_0x2462aa;});if(_0x4b9049){_0x270971=_['find'](this[_0xf7a3('0x10')],function(_0x377310){return _0x377310[_0xf7a3('0x25')]==util['format']('SIP/%s',_0x4b9049[_0xf7a3('0x23')]);});}}return _0x270971;};Report[_0xf7a3('0x12')][_0xf7a3('0x26')]=function(_0x5adcdc){for(var _0x5c60de=0x0;_0x5c60de<_0x5adcdc[_0xf7a3('0x27')];_0x5c60de+=0x1){var _0x3188a5=this['findAgent'](_0x5adcdc[_0x5c60de][_0xf7a3('0x28')]);if(_0x3188a5){_0x5adcdc[_0x5c60de]['accountcode']=_0x3188a5[_0xf7a3('0x22')];_0x5adcdc[_0x5c60de][_0xf7a3('0x29')]=!![];_0x5adcdc[_0x5c60de]['lastAssignedTo']=_0x3188a5[_0xf7a3('0x23')];_0x5adcdc[_0x5c60de][_0xf7a3('0x25')]=_[_0xf7a3('0x24')](_0x3188a5[_0xf7a3('0x25')])?util['format']('SIP/%s',_0x3188a5[_0xf7a3('0x23')]):_0x3188a5[_0xf7a3('0x25')];if(_0x5adcdc[_0x5c60de]['queuecallercomplete']){_0x5adcdc[_0x5c60de][_0xf7a3('0x2a')]=moment()[_0xf7a3('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5adcdc[_0x5c60de][_0xf7a3('0x2c')]){_0x5adcdc[_0x5c60de][_0xf7a3('0x2d')]=moment()[_0xf7a3('0x2b')](_0xf7a3('0x2e'));}RpcMemberReport[_0xf7a3('0x26')](_0x5adcdc[_0x5c60de]);}RpcVoiceQueueReport[_0xf7a3('0x2f')](_0x5adcdc[_0x5c60de]);}};function extractCalleridNumber(_0x302223){var _0x1b88cd=_0x302223[_0xf7a3('0x30')](/<(.*?)>/);return _0x1b88cd?_0x1b88cd[0x1]:_0x302223;}Report[_0xf7a3('0x12')][_0xf7a3('0x31')]=function(_0x5ed972){for(var _0x31f768=0x0;_0x31f7680x0?_0x54e8f4:0x0;this[_0x70da('0x3f')][_0x54809e[_0x70da('0x6a')]][_0x70da('0x56')]=this[_0x70da('0x3f')][_0x54809e['queue']][_0x70da('0x56')]>_[_0x70da('0x6f')](_0x54809e[_0x70da('0x70')])?_[_0x70da('0x6f')](_0x54809e[_0x70da('0x70')]):this[_0x70da('0x3f')][_0x54809e[_0x70da('0x6a')]]['talking'];this['emitVoiceQueueSummary'](this[_0x70da('0x3f')][_0x54809e[_0x70da('0x6a')]],_0x70da('0x67'));}logger[_0x70da('0x42')](_0x70da('0x71'),util['inspect'](this[_0x70da('0x3f')][_0x54809e[_0x70da('0x6a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x70da('0x72'),this[_0x70da('0x3f')][_0x54809e[_0x70da('0x6a')]]);}}}catch(_0xd165a5){logger[_0x70da('0x3a')]('[voiceQueueReport][queuesummary]',util['inspect'](_0xd165a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x17')]=function(_0x3dc299){logger['debug'](_0x70da('0x73'),util[_0x70da('0x3c')](_0x3dc299,{'showHidden':![],'depth':null}));this[_0x70da('0x11')]=!![];};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x74')]=function(_0x28ea9a){try{if(this[_0x70da('0x64')](_0x28ea9a)){logger[_0x70da('0x42')](_0x70da('0x75'),_0x28ea9a[_0x70da('0x45')],util[_0x70da('0x3c')](_0x28ea9a,{'showHidden':![],'depth':null}));if(_[_0x70da('0x65')](this[_0x70da('0xe')][_0x28ea9a['uniqueid']]))this['queueReports'][_0x28ea9a['uniqueid']]=[];if(_[_0x70da('0x65')](this[_0x70da('0x10')][_0x28ea9a['uniqueid']]))this[_0x70da('0x10')][_0x28ea9a[_0x70da('0x45')]]={};var _0x4634e5=new QueueReport();_0x4634e5[_0x70da('0x47')]=_0x28ea9a[_0x70da('0x6a')];_0x4634e5[_0x70da('0x4f')]=this[_0x70da('0x3f')][_0x4634e5['name']]&&this[_0x70da('0x3f')][_0x4634e5[_0x70da('0x47')]][_0x70da('0x4f')]?this[_0x70da('0x3f')][_0x4634e5[_0x70da('0x47')]]['type']||_0x70da('0x50'):_0x70da('0x50');_0x4634e5['queue']=_0x28ea9a['queue'];_0x4634e5[_0x70da('0x76')]=moment()[_0x70da('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4634e5['position']=_0x28ea9a['position'];_0x4634e5[_0x70da('0x77')]=_0x28ea9a[_0x70da('0x77')];_0x4634e5['uniqueid']=_0x28ea9a['uniqueid'];_0x4634e5['routealias']=this[_0x70da('0x10')][_0x28ea9a[_0x70da('0x45')]][_0x70da('0x78')];logger[_0x70da('0x6b')](_0x70da('0x79'),_0x4634e5[_0x70da('0x47')],_0x4634e5[_0x70da('0x4f')]);_[_0x70da('0x7a')](_0x4634e5,_[_0x70da('0x7b')](_0x28ea9a,_[_0x70da('0x7c')](_0x4634e5)));this['queueReports'][_0x28ea9a[_0x70da('0x45')]]['push'](_0x4634e5);this['channels'][_0x28ea9a[_0x70da('0x45')]]=_0x4634e5;this[_0x70da('0x41')](_0x4634e5,_0x70da('0x18'));}}catch(_0x32c01c){logger[_0x70da('0x3a')](_0x70da('0x75'),_0x28ea9a['uniqueid'],util['inspect'](_0x32c01c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x1a')]=function(_0x1f9b6f){try{if(this[_0x70da('0x64')](_0x1f9b6f)){logger['debug'](_0x70da('0x7d'),_0x1f9b6f[_0x70da('0x45')],util[_0x70da('0x3c')](_0x1f9b6f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1f9b6f['uniqueid']]){var _0x41b429=_[_0x70da('0x7e')](this[_0x70da('0xe')][_0x1f9b6f[_0x70da('0x45')]]);_0x41b429[_0x70da('0x7f')]=![];_0x41b429[_0x70da('0x80')]=null;_0x41b429[_0x70da('0x81')]=_0x1f9b6f[_0x70da('0x81')];_0x41b429[_0x70da('0x82')]=_0x1f9b6f['originalposition'];_0x41b429[_0x70da('0x19')]=!![];_0x41b429['queuecallerabandonAt']=moment()[_0x70da('0x4d')](_0x70da('0x83'));_0x41b429['queuecallerexitreason']=_0x70da('0x84');_0x41b429[_0x70da('0x85')]=null;logger[_0x70da('0x6b')](_0x70da('0x86'),_0x41b429[_0x70da('0x47')],_0x41b429['type']);this[_0x70da('0x10')][_0x1f9b6f[_0x70da('0x45')]]=_0x41b429;this[_0x70da('0x49')](_0x41b429,'queuecallerabandon');}}}catch(_0x54cb23){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x1f9b6f[_0x70da('0x45')],util[_0x70da('0x3c')](_0x54cb23,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x1c')]=function(_0x2dc94d){try{if(this[_0x70da('0x64')](_0x2dc94d)){logger[_0x70da('0x42')](_0x70da('0x87'),_0x2dc94d[_0x70da('0x45')],util['inspect'](_0x2dc94d,{'showHidden':![],'depth':null}));if(this[_0x70da('0xe')][_0x2dc94d['uniqueid']]){var _0x165bfe=_[_0x70da('0x7e')](this[_0x70da('0xe')][_0x2dc94d['uniqueid']]);_0x165bfe[_0x70da('0x88')]=moment()['format'](_0x70da('0x83'));_0x165bfe[_0x70da('0x89')]=_0x2dc94d[_0x70da('0x89')];_0x165bfe[_0x70da('0x8a')]=_0x2dc94d[_0x70da('0x8a')];logger['info'](_0x70da('0x8b'),_0x165bfe[_0x70da('0x47')],_0x165bfe[_0x70da('0x4f')],_0x2dc94d[_0x70da('0x89')],_0x2dc94d[_0x70da('0x8a')]);this[_0x70da('0x10')][_0x2dc94d[_0x70da('0x45')]]=_0x165bfe;this['emitVoiceQueueChannelSave'](_0x165bfe,_0x70da('0x1b'));}}}catch(_0x4ab481){logger[_0x70da('0x3a')](_0x70da('0x87'),_0x2dc94d[_0x70da('0x45')],util[_0x70da('0x3c')](_0x4ab481,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x8c')]=function(_0x2749cd){try{if(this['isNotNull'](_0x2749cd)){logger[_0x70da('0x42')](_0x70da('0x8d'),_0x2749cd[_0x70da('0x45')],util[_0x70da('0x3c')](_0x2749cd,{'showHidden':![],'depth':null}));if(this[_0x70da('0xe')][_0x2749cd[_0x70da('0x45')]]){var _0xd9b91d=_[_0x70da('0x7e')](this[_0x70da('0xe')][_0x2749cd[_0x70da('0x45')]]);_0xd9b91d[_0x70da('0x7f')]=!![];_0xd9b91d['queuecallerexitreason']=_0x70da('0x8e');logger['info'](_0x70da('0x8f'),_0xd9b91d[_0x70da('0x47')],_0xd9b91d[_0x70da('0x4f')]);}}}catch(_0x1133f9){logger[_0x70da('0x3a')]('[%s][voiceQueueReport][agentconnect]',_0x2749cd[_0x70da('0x45')],util[_0x70da('0x3c')](_0x1133f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x1d')]=function(_0x467473){try{if(this[_0x70da('0x64')](_0x467473)){logger[_0x70da('0x42')](_0x70da('0x90'),_0x467473[_0x70da('0x45')],util[_0x70da('0x3c')](_0x467473,{'showHidden':![],'depth':null}));if(this[_0x70da('0xe')][_0x467473[_0x70da('0x45')]]){var _0x2324fb=_[_0x70da('0x7e')](this[_0x70da('0xe')][_0x467473[_0x70da('0x45')]]);_0x2324fb['queuecallerabandon']=![];_0x2324fb[_0x70da('0x91')]=null;_0x2324fb['assigned']=!![];_0x2324fb[_0x70da('0x85')]=_0x467473[_0x70da('0x92')];_0x2324fb[_0x70da('0x81')]=_0x467473[_0x70da('0x81')];_0x2324fb[_0x70da('0x7f')]=!![];_0x2324fb[_0x70da('0x93')]=![];_0x2324fb[_0x70da('0x94')]=null;if(!_0x2324fb[_0x70da('0x95')]){if(_0x467473[_0x70da('0x96')]=='transfer'){_0x2324fb[_0x70da('0x4b')]='COMPLETED';logger[_0x70da('0x6b')](_0x70da('0x97'),_0x2324fb['name'],_0x2324fb[_0x70da('0x4f')]);}else{if(_[_0x70da('0x98')](_0x467473[_0x70da('0x37')]['toLowerCase'](),_0x70da('0x99'))){if(this[_0x70da('0xe')][_0x467473[_0x70da('0x9a')]]){var _0x3540e1=_[_0x70da('0x7e')](this[_0x70da('0xe')][_0x467473[_0x70da('0x9a')]]);_0x3540e1['queuecallercomplete']=![];_0x3540e1[_0x70da('0x93')]=!![];_0x3540e1[_0x70da('0x94')]=moment(_0x2324fb[_0x70da('0x76')])[_0x70da('0x9b')](_0x467473[_0x70da('0x81')],_0x70da('0x9c'))[_0x70da('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3540e1[_0x70da('0x4b')]='FORWARDTRANSFER';_0x3540e1[_0x70da('0x95')]=!![];_0x3540e1[_0x70da('0x9d')]='FORWARD';_0x3540e1[_0x70da('0x9e')]=_0x467473[_0x70da('0x9f')];_0x3540e1[_0x70da('0xa0')]=_0x467473[_0x70da('0x45')];logger[_0x70da('0x6b')](_0x70da('0xa1'),_0x3540e1[_0x70da('0x47')],_0x3540e1[_0x70da('0x4f')]);var _0x21b6f6=this[_0x70da('0xe')][_0x467473[_0x70da('0x9a')]];this[_0x70da('0xe')][_0x467473[_0x70da('0x9a')]]=this[_0x70da('0xe')][_0x467473['uniqueid']];this[_0x70da('0xe')][_0x467473[_0x70da('0x45')]]=_0x21b6f6;}}else{_0x2324fb['queuecallerexitreason']='COMPLETEDBY'+_0x467473['reason']['toUpperCase']();logger[_0x70da('0x6b')](_0x70da('0xa2'),_0x2324fb[_0x70da('0x47')],_0x2324fb[_0x70da('0x4f')],_0x2324fb[_0x70da('0x4b')]);}}}this['channels'][_0x467473[_0x70da('0x45')]]=_0x2324fb;this[_0x70da('0x49')](_0x2324fb,_0x70da('0xa3'));}}}catch(_0x21a88f){logger['error'](_0x70da('0x90'),_0x467473[_0x70da('0x45')],util[_0x70da('0x3c')](_0x21a88f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x70da('0xa')]['syncVarSet']=function(_0x454959){try{if(this[_0x70da('0x64')](_0x454959)){logger['debug']('[%s][voiceQueueReport][varset]',_0x454959[_0x70da('0x45')],util[_0x70da('0x3c')](_0x454959,{'showHidden':![],'depth':null}));this[_0x70da('0xa4')](_0x454959[_0x70da('0x45')],_[_0x70da('0x7c')](_0x454959[_0x70da('0xa5')])[0x0],_0x454959[_0x70da('0xa6')]);if(this[_0x70da('0xe')][_0x454959['uniqueid']]){var _0x6fb692=_['last'](this['queueReports'][_0x454959['uniqueid']]);if(_0x6fb692){if(this[_0x70da('0x64')](_0x454959[_0x70da('0xa5')])&&this['isNotNull'](_0x454959[_0x70da('0xa5')]['queuestatus'])){switch(_0x454959[_0x70da('0xa6')]){case'CONTINUE':_0x6fb692[_0x70da('0x93')]=![];_0x6fb692[_0x70da('0x94')]=null;break;case'TIMEOUT':_0x6fb692[_0x70da('0xa7')]=_0x70da('0xa8');_0x6fb692[_0x70da('0x93')]=!![];_0x6fb692[_0x70da('0x94')]=moment()[_0x70da('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x6fb692[_0x70da('0x88')]=moment()['format'](_0x70da('0x83'));logger[_0x70da('0x42')](_0x70da('0xa9'),_0x454959[_0x70da('0x45')],util[_0x70da('0x3c')](_0x6fb692,{'showHidden':![],'depth':null}));ami[_0x70da('0x40')](_0x70da('0xaa'),_0x6fb692);break;default:_0x6fb692['queuecallerexit']=!![];_0x6fb692[_0x70da('0x94')]=moment()[_0x70da('0x4d')](_0x70da('0x83'));_0x6fb692['queuecallerleaveAt']=moment()['format'](_0x70da('0x83'));}_0x6fb692[_0x70da('0x19')]=![];_0x6fb692[_0x70da('0x91')]=null;_0x6fb692[_0x70da('0x4b')]=_0x454959[_0x70da('0xa6')];this['channels'][_0x454959[_0x70da('0x45')]]=_0x6fb692;this[_0x70da('0x49')](_0x6fb692,_0x70da('0xab'));}else if(this['isNotNull'](_0x454959[_0x70da('0xa5')])&&this[_0x70da('0x64')](_0x454959['variable'][_0x70da('0xac')])){if(!_0x6fb692[_0x70da('0x19')]){_0x6fb692['queuecallerexit']=!![];_0x6fb692[_0x70da('0x94')]=moment()[_0x70da('0x4d')](_0x70da('0x83'));_0x6fb692['queuecallerexitreason']='EXITWITHKEY';_0x6fb692[_0x70da('0x88')]=moment()[_0x70da('0x4d')](_0x70da('0x83'));this[_0x70da('0x10')][_0x454959[_0x70da('0x45')]]=_0x6fb692;}}logger[_0x70da('0x6b')](_0x70da('0xad'),_0x454959[_0x70da('0x45')],_0x6fb692[_0x70da('0x47')],_0x6fb692[_0x70da('0x4f')],_[_0x70da('0x7c')](_0x454959['variable'])[0x0],_0x454959['value']);_0x6fb692[_0x70da('0x13')]=this[_0x70da('0x13')][_0x454959[_0x70da('0x45')]];}}}}catch(_0x168a3c){logger[_0x70da('0x3a')](_0x70da('0xae'),_0x454959['uniqueid'],util[_0x70da('0x3c')](_0x168a3c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x70da('0xa4')]=function(_0x390e6f,_0x6fd45b,_0x50e9e2){var _0x893cf7=[_0x70da('0xaf'),_0x70da('0xb0'),_0x70da('0xb1'),_0x70da('0xb2'),_0x70da('0xb3'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x70da('0xb4'),'sipcallid','sipuri',_0x70da('0xb5'),_0x70da('0xb6'),_0x70da('0xb7'),_0x70da('0xb8'),'memberinterface',_0x70da('0xb9'),_0x70da('0x92'),_0x70da('0xba'),_0x70da('0xbb')];if(!_[_0x70da('0x34')](_0x6fd45b)&&!_[_0x70da('0xbc')](_0x893cf7,_0x6fd45b)){if(_[_0x70da('0x65')](this[_0x70da('0x13')][_0x390e6f])){this[_0x70da('0x13')][_0x390e6f]={};}this[_0x70da('0x13')][_0x390e6f][_0x6fd45b]=_0x50e9e2;}};VoiceQueueReport[_0x70da('0xa')][_0x70da('0x21')]=function(_0x4c08b7){try{if(this[_0x70da('0x64')](_0x4c08b7)){logger['debug'](_0x70da('0xbd'),_0x4c08b7[_0x70da('0x45')],util[_0x70da('0x3c')](_0x4c08b7,{'showHidden':![],'depth':null}));if(this[_0x70da('0xe')][_0x4c08b7[_0x70da('0x45')]]){for(var _0x358517=0x0,_0x1d5569={};_0x3585170x0?_0x6bdd79:0x0;this[_0x55ca('0x41')][_0x5c082f[_0x55ca('0x68')]][_0x55ca('0x2e')]=this[_0x55ca('0x41')][_0x5c082f[_0x55ca('0x68')]][_0x55ca('0x2e')]>_[_0x55ca('0x6c')](_0x5c082f[_0x55ca('0x6d')])?_['toNumber'](_0x5c082f[_0x55ca('0x6d')]):this[_0x55ca('0x41')][_0x5c082f[_0x55ca('0x68')]][_0x55ca('0x2e')];this[_0x55ca('0x6f')](this[_0x55ca('0x41')][_0x5c082f[_0x55ca('0x68')]],_0x55ca('0x12'));}logger[_0x55ca('0x45')](_0x55ca('0x70'),util['inspect'](this[_0x55ca('0x41')][_0x5c082f['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x55ca('0x71'),this['voiceQueues'][_0x5c082f[_0x55ca('0x68')]]);}}}catch(_0x186940){logger[_0x55ca('0x3a')](_0x55ca('0x67'),util['inspect'](_0x186940,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x16')]=function(_0x2ef6b1){logger[_0x55ca('0x45')](_0x55ca('0x72'),util[_0x55ca('0x3c')](_0x2ef6b1,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x55ca('0xa')]['syncQueueCallerJoin']=function(_0x226afb){try{if(this[_0x55ca('0x62')](_0x226afb)){logger[_0x55ca('0x45')](_0x55ca('0x73'),_0x226afb['uniqueid'],util[_0x55ca('0x3c')](_0x226afb,{'showHidden':![],'depth':null}));if(_[_0x55ca('0x63')](this['queueReports'][_0x226afb['uniqueid']]))this[_0x55ca('0xe')][_0x226afb[_0x55ca('0x48')]]=[];if(_[_0x55ca('0x63')](this['channels'][_0x226afb[_0x55ca('0x48')]]))this[_0x55ca('0x10')][_0x226afb[_0x55ca('0x48')]]={};var _0x495b24=new QueueReport();_0x495b24[_0x55ca('0x4b')]=_0x226afb[_0x55ca('0x68')];_0x495b24[_0x55ca('0x57')]=this['voiceQueues'][_0x495b24[_0x55ca('0x4b')]]&&this[_0x55ca('0x41')][_0x495b24['name']]['type']?this['voiceQueues'][_0x495b24[_0x55ca('0x4b')]][_0x55ca('0x57')]||'inbound':_0x55ca('0x52');_0x495b24[_0x55ca('0x68')]=_0x226afb[_0x55ca('0x68')];_0x495b24['queuecallerjoinAt']=moment()[_0x55ca('0x49')](_0x55ca('0x74'));_0x495b24[_0x55ca('0x75')]=_0x226afb[_0x55ca('0x75')];_0x495b24[_0x55ca('0x76')]=_0x226afb[_0x55ca('0x76')];_0x495b24['uniqueid']=_0x226afb[_0x55ca('0x48')];_0x495b24['routealias']=this[_0x55ca('0x10')][_0x226afb[_0x55ca('0x48')]]['routealias'];logger[_0x55ca('0x77')](_0x55ca('0x78'),_0x495b24[_0x55ca('0x4b')],_0x495b24[_0x55ca('0x57')]);_[_0x55ca('0x79')](_0x495b24,_[_0x55ca('0x7a')](_0x226afb,_['keys'](_0x495b24)));this[_0x55ca('0xe')][_0x226afb['uniqueid']][_0x55ca('0x7b')](_0x495b24);this['channels'][_0x226afb['uniqueid']]=_0x495b24;this[_0x55ca('0x44')](_0x495b24,_0x55ca('0x7c'));}}catch(_0x15e8cd){logger[_0x55ca('0x3a')](_0x55ca('0x73'),_0x226afb['uniqueid'],util['inspect'](_0x15e8cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x7d')]=function(_0x5bb154){try{if(this['isNotNull'](_0x5bb154)){logger[_0x55ca('0x45')](_0x55ca('0x7e'),_0x5bb154[_0x55ca('0x48')],util[_0x55ca('0x3c')](_0x5bb154,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5bb154['uniqueid']]){var _0x1205c7=_[_0x55ca('0x7f')](this[_0x55ca('0xe')][_0x5bb154[_0x55ca('0x48')]]);_0x1205c7[_0x55ca('0x80')]=![];_0x1205c7[_0x55ca('0x81')]=null;_0x1205c7[_0x55ca('0x82')]=_0x5bb154['holdtime'];_0x1205c7['originalposition']=_0x5bb154[_0x55ca('0x83')];_0x1205c7[_0x55ca('0x18')]=!![];_0x1205c7[_0x55ca('0x84')]=moment()[_0x55ca('0x49')](_0x55ca('0x74'));_0x1205c7[_0x55ca('0x4e')]='ABANDONED';_0x1205c7[_0x55ca('0x85')]=null;logger['info'](_0x55ca('0x86'),_0x1205c7['name'],_0x1205c7['type']);this[_0x55ca('0x10')][_0x5bb154[_0x55ca('0x48')]]=_0x1205c7;this[_0x55ca('0x42')](_0x1205c7,_0x55ca('0x18'));}}}catch(_0x389e5c){logger[_0x55ca('0x3a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5bb154[_0x55ca('0x48')],util[_0x55ca('0x3c')](_0x389e5c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x1a')]=function(_0x37704a){try{if(this[_0x55ca('0x62')](_0x37704a)){logger[_0x55ca('0x45')]('[%s][voiceQueueReport][queuecallerleave]',_0x37704a[_0x55ca('0x48')],util['inspect'](_0x37704a,{'showHidden':![],'depth':null}));if(this[_0x55ca('0xe')][_0x37704a[_0x55ca('0x48')]]){var _0x289913=_[_0x55ca('0x7f')](this['queueReports'][_0x37704a['uniqueid']]);_0x289913['queuecallerleaveAt']=moment()[_0x55ca('0x49')](_0x55ca('0x74'));_0x289913['connectedlinenum']=_0x37704a[_0x55ca('0x87')];_0x289913[_0x55ca('0x88')]=_0x37704a[_0x55ca('0x88')];logger[_0x55ca('0x77')](_0x55ca('0x89'),_0x289913['name'],_0x289913[_0x55ca('0x57')],_0x37704a[_0x55ca('0x87')],_0x37704a['connectedlinename']);this[_0x55ca('0x10')][_0x37704a[_0x55ca('0x48')]]=_0x289913;this[_0x55ca('0x44')](_0x289913,_0x55ca('0x19'));}}}catch(_0x4342de){logger[_0x55ca('0x3a')](_0x55ca('0x8a'),_0x37704a[_0x55ca('0x48')],util[_0x55ca('0x3c')](_0x4342de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')]['syncAgentConnect']=function(_0x4cc6ad){try{if(this[_0x55ca('0x62')](_0x4cc6ad)){logger[_0x55ca('0x45')](_0x55ca('0x8b'),_0x4cc6ad['uniqueid'],util['inspect'](_0x4cc6ad,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4cc6ad[_0x55ca('0x48')]]){var _0x2c30ea=_['last'](this[_0x55ca('0xe')][_0x4cc6ad[_0x55ca('0x48')]]);_0x2c30ea[_0x55ca('0x80')]=!![];_0x2c30ea[_0x55ca('0x4e')]=_0x55ca('0x8c');logger[_0x55ca('0x77')](_0x55ca('0x8d'),_0x2c30ea[_0x55ca('0x4b')],_0x2c30ea[_0x55ca('0x57')]);}}}catch(_0x431341){logger[_0x55ca('0x3a')](_0x55ca('0x8b'),_0x4cc6ad['uniqueid'],util[_0x55ca('0x3c')](_0x431341,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x1c')]=function(_0x295bc3){try{if(this['isNotNull'](_0x295bc3)){logger[_0x55ca('0x45')](_0x55ca('0x8e'),_0x295bc3['uniqueid'],util['inspect'](_0x295bc3,{'showHidden':![],'depth':null}));if(this[_0x55ca('0xe')][_0x295bc3[_0x55ca('0x48')]]){var _0x3831e1=_[_0x55ca('0x7f')](this[_0x55ca('0xe')][_0x295bc3[_0x55ca('0x48')]]);_0x3831e1[_0x55ca('0x18')]=![];_0x3831e1[_0x55ca('0x84')]=null;_0x3831e1[_0x55ca('0x8f')]=!![];_0x3831e1[_0x55ca('0x85')]=_0x295bc3[_0x55ca('0x90')];_0x3831e1['holdtime']=_0x295bc3[_0x55ca('0x82')];_0x3831e1[_0x55ca('0x80')]=!![];_0x3831e1[_0x55ca('0x91')]=![];_0x3831e1[_0x55ca('0x92')]=null;if(!_0x3831e1['transfer']){if(_0x295bc3[_0x55ca('0x93')]==_0x55ca('0x94')){_0x3831e1[_0x55ca('0x4e')]=_0x55ca('0x95');logger[_0x55ca('0x77')](_0x55ca('0x96'),_0x3831e1[_0x55ca('0x4b')],_0x3831e1[_0x55ca('0x57')]);}else{if(_[_0x55ca('0x97')](_0x295bc3[_0x55ca('0x98')][_0x55ca('0x99')](),_0x55ca('0x9a'))){if(this[_0x55ca('0xe')][_0x295bc3[_0x55ca('0x9b')]]){var _0x55895a=_[_0x55ca('0x7f')](this[_0x55ca('0xe')][_0x295bc3['linkedid']]);_0x55895a['queuecallercomplete']=![];_0x55895a[_0x55ca('0x91')]=!![];_0x55895a[_0x55ca('0x92')]=moment(_0x3831e1[_0x55ca('0x9c')])[_0x55ca('0x9d')](_0x295bc3['holdtime'],'seconds')[_0x55ca('0x49')](_0x55ca('0x74'));_0x55895a[_0x55ca('0x4e')]=_0x55ca('0x9e');_0x55895a['transfer']=!![];_0x55895a[_0x55ca('0x9f')]=_0x55ca('0xa0');_0x55895a['transferexten']=_0x295bc3[_0x55ca('0xa1')];_0x55895a[_0x55ca('0xa2')]=_0x295bc3[_0x55ca('0x48')];logger[_0x55ca('0x77')](_0x55ca('0xa3'),_0x55895a[_0x55ca('0x4b')],_0x55895a['type']);var _0x415044=this['queueReports'][_0x295bc3['linkedid']];this[_0x55ca('0xe')][_0x295bc3[_0x55ca('0x9b')]]=this[_0x55ca('0xe')][_0x295bc3['uniqueid']];this[_0x55ca('0xe')][_0x295bc3['uniqueid']]=_0x415044;}}else{_0x3831e1[_0x55ca('0x4e')]=_0x55ca('0xa4')+_0x295bc3[_0x55ca('0x93')][_0x55ca('0xa5')]();logger[_0x55ca('0x77')](_0x55ca('0xa6'),_0x3831e1[_0x55ca('0x4b')],_0x3831e1[_0x55ca('0x57')],_0x3831e1[_0x55ca('0x4e')]);}}}this[_0x55ca('0x10')][_0x295bc3['uniqueid']]=_0x3831e1;this[_0x55ca('0x42')](_0x3831e1,_0x55ca('0x1b'));}}}catch(_0x5014fb){logger[_0x55ca('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x295bc3[_0x55ca('0x48')],util[_0x55ca('0x3c')](_0x5014fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x1e')]=function(_0x968342){try{if(this[_0x55ca('0x62')](_0x968342)){logger[_0x55ca('0x45')](_0x55ca('0xa7'),_0x968342['uniqueid'],util['inspect'](_0x968342,{'showHidden':![],'depth':null}));this[_0x55ca('0xa8')](_0x968342['uniqueid'],_[_0x55ca('0xa9')](_0x968342[_0x55ca('0xaa')])[0x0],_0x968342[_0x55ca('0xab')]);if(this[_0x55ca('0xe')][_0x968342['uniqueid']]){var _0xb7e2c6=_[_0x55ca('0x7f')](this[_0x55ca('0xe')][_0x968342[_0x55ca('0x48')]]);if(_0xb7e2c6){if(this[_0x55ca('0x62')](_0x968342[_0x55ca('0xaa')])&&this['isNotNull'](_0x968342[_0x55ca('0xaa')][_0x55ca('0xac')])){switch(_0x968342['value']){case'CONTINUE':_0xb7e2c6[_0x55ca('0x91')]=![];_0xb7e2c6[_0x55ca('0x92')]=null;break;case _0x55ca('0xad'):_0xb7e2c6[_0x55ca('0xae')]=_0x55ca('0xaf');_0xb7e2c6[_0x55ca('0x91')]=!![];_0xb7e2c6[_0x55ca('0x92')]=moment()['format'](_0x55ca('0x74'));_0xb7e2c6[_0x55ca('0xb0')]=moment()[_0x55ca('0x49')](_0x55ca('0x74'));logger[_0x55ca('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x968342[_0x55ca('0x48')],util['inspect'](_0xb7e2c6,{'showHidden':![],'depth':null}));ami[_0x55ca('0x43')](_0x55ca('0xb1'),_0xb7e2c6);break;default:_0xb7e2c6[_0x55ca('0x91')]=!![];_0xb7e2c6['queuecallerexitAt']=moment()[_0x55ca('0x49')](_0x55ca('0x74'));_0xb7e2c6['queuecallerleaveAt']=moment()[_0x55ca('0x49')](_0x55ca('0x74'));}_0xb7e2c6['queuecallerabandon']=![];_0xb7e2c6[_0x55ca('0x84')]=null;_0xb7e2c6[_0x55ca('0x4e')]=_0x968342['value'];this[_0x55ca('0x10')][_0x968342['uniqueid']]=_0xb7e2c6;this[_0x55ca('0x42')](_0xb7e2c6,'varset');}else if(this[_0x55ca('0x62')](_0x968342[_0x55ca('0xaa')])&&this['isNotNull'](_0x968342['variable'][_0x55ca('0xb2')])){if(!_0xb7e2c6[_0x55ca('0x18')]){_0xb7e2c6[_0x55ca('0x91')]=!![];_0xb7e2c6[_0x55ca('0x92')]=moment()[_0x55ca('0x49')](_0x55ca('0x74'));_0xb7e2c6['queuecallerexitreason']='EXITWITHKEY';_0xb7e2c6['queuecallerleaveAt']=moment()[_0x55ca('0x49')](_0x55ca('0x74'));this[_0x55ca('0x10')][_0x968342[_0x55ca('0x48')]]=_0xb7e2c6;}}logger[_0x55ca('0x77')](_0x55ca('0xb3'),_0x968342['uniqueid'],_0xb7e2c6[_0x55ca('0x4b')],_0xb7e2c6[_0x55ca('0x57')],_[_0x55ca('0xa9')](_0x968342[_0x55ca('0xaa')])[0x0],_0x968342[_0x55ca('0xab')]);_0xb7e2c6[_0x55ca('0x3d')]=this[_0x55ca('0x3d')][_0x968342[_0x55ca('0x48')]];}}}}catch(_0x15cf8d){logger['error'](_0x55ca('0xa7'),_0x968342['uniqueid'],util['inspect'](_0x15cf8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0xa8')]=function(_0x287143,_0x35fd00,_0x5e4f29){var _0x57be13=[_0x55ca('0xb4'),_0x55ca('0xb5'),_0x55ca('0xb6'),_0x55ca('0xb7'),'rtpaudioqosloss',_0x55ca('0xb8'),_0x55ca('0xb9'),_0x55ca('0xba'),_0x55ca('0xbb'),_0x55ca('0xbc'),'bridgepeer',_0x55ca('0xbd'),_0x55ca('0xbe'),'memberdynamic',_0x55ca('0xbf'),_0x55ca('0xc0'),_0x55ca('0x90'),'memberpenalty',_0x55ca('0xc1')];if(!_['isNil'](_0x35fd00)&&!_[_0x55ca('0xc2')](_0x57be13,_0x35fd00)){if(_['isUndefined'](this['variables'][_0x287143])){this[_0x55ca('0x3d')][_0x287143]={};}this[_0x55ca('0x3d')][_0x287143][_0x35fd00]=_0x5e4f29;}};VoiceQueueReport[_0x55ca('0xa')][_0x55ca('0x1f')]=function(_0x2afdc6){try{if(this[_0x55ca('0x62')](_0x2afdc6)){logger[_0x55ca('0x45')](_0x55ca('0xc3'),_0x2afdc6[_0x55ca('0x48')],util[_0x55ca('0x3c')](_0x2afdc6,{'showHidden':![],'depth':null}));if(this[_0x55ca('0xe')][_0x2afdc6[_0x55ca('0x48')]]){for(var _0x12a1ec=0x0,_0x3532b4={};_0x12a1ec=0x0?moment(_0x24aac5[_0x88be('0x18')])[_0x88be('0xf')](_0x24aac5['starttime'],_0x88be('0x17')):null,'data1':'outbound','data2':_0x24aac5['accountcode'],'data3':_0x24aac5[_0x88be('0x19')],'data4':_0x24aac5[_0x88be('0x1a')]||null,'role':_0x88be('0x12'),'internal':_0x24aac5['accountcode']?_[_0x88be('0x1b')](_0x24aac5[_0x88be('0x13')]):undefined,'uniqueid':_0x24aac5[_0x88be('0x14')]},'log':_0x88be('0x6')});}; \ No newline at end of file +var _0x8fc4=['accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','endtime','starttime','outbound','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent'];(function(_0x240b29,_0x2aa431){var _0x1edb1e=function(_0x394bda){while(--_0x394bda){_0x240b29['push'](_0x240b29['shift']());}};_0x1edb1e(++_0x2aa431);}(_0x8fc4,0x17d));var _0x48fc=function(_0x5877ba,_0x1bc236){_0x5877ba=_0x5877ba-0x0;var _0x2878ff=_0x8fc4[_0x5877ba];return _0x2878ff;};'use strict';var moment=require(_0x48fc('0x0'));var _=require(_0x48fc('0x1'));var util=require(_0x48fc('0x2'));var client=require('../client');exports[_0x48fc('0x3')]=function(_0x30f1c0){var _0x4ef6cc=_0x30f1c0[_0x48fc('0x4')]||_0x30f1c0[_0x48fc('0x5')];return client[_0x48fc('0x6')]('CreateMemberReport',{'body':{'channel':_0x48fc('0x7'),'membername':_0x30f1c0[_0x48fc('0x8')],'interface':_[_0x48fc('0x9')](_0x30f1c0[_0x48fc('0xa')])?util[_0x48fc('0xb')](_0x48fc('0xc'),_0x30f1c0[_0x48fc('0x8')]):_0x30f1c0[_0x48fc('0xa')],'type':_0x48fc('0xd'),'enterAt':_0x30f1c0[_0x48fc('0xe')],'exitAt':_0x4ef6cc,'duration':moment(_0x4ef6cc)[_0x48fc('0xf')](_0x30f1c0[_0x48fc('0xe')],_0x48fc('0x10')),'data1':_0x48fc('0x11'),'data2':_0x30f1c0[_0x48fc('0x12')],'data3':_0x30f1c0[_0x48fc('0x13')],'data4':null,'data5':_0x30f1c0[_0x48fc('0x14')],'role':_0x48fc('0x15'),'internal':_0x30f1c0[_0x48fc('0x16')]?_[_0x48fc('0x17')](_0x30f1c0[_0x48fc('0x16')]):undefined,'uniqueid':_0x30f1c0[_0x48fc('0x18')]},'log':_0x48fc('0x19')});};exports[_0x48fc('0x1a')]=function(_0x5dbfb9){return client[_0x48fc('0x6')](_0x48fc('0x19'),{'body':{'channel':'voice','membername':_0x5dbfb9['membername'],'interface':_0x5dbfb9[_0x48fc('0xa')],'type':_0x48fc('0xd'),'enterAt':_0x5dbfb9['starttime'],'exitAt':_0x5dbfb9['endtime'],'duration':moment(_0x5dbfb9[_0x48fc('0x1b')])[_0x48fc('0xf')](_0x5dbfb9['starttime'],_0x48fc('0x10'))>=0x0?moment(_0x5dbfb9['endtime'])[_0x48fc('0xf')](_0x5dbfb9[_0x48fc('0x1c')],_0x48fc('0x10')):null,'data1':_0x48fc('0x1d'),'data2':_0x5dbfb9[_0x48fc('0x16')],'data3':_0x5dbfb9[_0x48fc('0x13')],'data4':_0x5dbfb9[_0x48fc('0x1e')]||null,'role':_0x48fc('0x15'),'internal':_0x5dbfb9['accountcode']?_[_0x48fc('0x17')](_0x5dbfb9[_0x48fc('0x16')]):undefined,'uniqueid':_0x5dbfb9[_0x48fc('0x18')]},'log':_0x48fc('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 706e025..916c72f 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 _0x88c8=['getSettings','stopRecordingOnTransfer','../client'];(function(_0x57a430,_0x281e18){var _0x533e30=function(_0x30f094){while(--_0x30f094){_0x57a430['push'](_0x57a430['shift']());}};_0x533e30(++_0x281e18);}(_0x88c8,0x7a));var _0x888c=function(_0x24dff2,_0x308bb4){_0x24dff2=_0x24dff2-0x0;var _0x5e4797=_0x88c8[_0x24dff2];return _0x5e4797;};'use strict';var client=require(_0x888c('0x0'));exports[_0x888c('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x888c('0x2'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x6f59=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x6f59,0x1be));var _0x96f5=function(_0x567743,_0x46ee4e){_0x567743=_0x567743-0x0;var _0x4613a0=_0x6f59[_0x567743];return _0x4613a0;};'use strict';var client=require(_0x96f5('0x0'));exports[_0x96f5('0x1')]=function(){return client[_0x96f5('0x2')](_0x96f5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x96f5('0x4'),_0x96f5('0x5')]},'log':_0x96f5('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 312e2ac..edcd5d3 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 _0xb8f0=['getTemplates','GetTemplate','name','html','../client'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xb8f0,0x112));var _0x0b8f=function(_0x117723,_0xfac4a1){_0x117723=_0x117723-0x0;var _0xdf892d=_0xb8f0[_0x117723];return _0xdf892d;};'use strict';var client=require(_0x0b8f('0x0'));exports[_0x0b8f('0x1')]=function(_0x153c0f){return function(_0x11162b){return client['Request'](_0x0b8f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0b8f('0x3'),_0x0b8f('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xd786=['html','../client','getTemplates','GetTemplate','name'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xd786,0x1dc));var _0x6d78=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xd786[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0x6d78('0x0'));exports[_0x6d78('0x1')]=function(_0x1e0785){return function(_0x43f830){return client['Request'](_0x6d78('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6d78('0x3'),_0x6d78('0x4')]},'log':_0x6d78('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fd4fc01..5704429 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 _0xac7d=['data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','channel','status','AllConditions','field','value','AnyConditions','Actions','action'];(function(_0x2423be,_0x4d39ba){var _0x3783d3=function(_0x56b1fb){while(--_0x56b1fb){_0x2423be['push'](_0x2423be['shift']());}};_0x3783d3(++_0x4d39ba);}(_0xac7d,0x1c9));var _0xdac7=function(_0x285d05,_0x1e4f2f){_0x285d05=_0x285d05-0x0;var _0x6aaafe=_0xac7d[_0x285d05];return _0x6aaafe;};'use strict';var client=require(_0xdac7('0x0'));exports[_0xdac7('0x1')]=function(_0x5179ea){return function(_0x47a988){return client[_0xdac7('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xdac7('0x3'),_0xdac7('0x4')],'include':[{'model':'Condition','as':_0xdac7('0x5'),'attributes':['id',_0xdac7('0x6'),'operator',_0xdac7('0x7')]},{'model':'Condition','as':_0xdac7('0x8'),'attributes':['id',_0xdac7('0x6'),'operator',_0xdac7('0x7')]},{'model':'Action','as':_0xdac7('0x9'),'attributes':['id',_0xdac7('0xa'),_0xdac7('0xb'),_0xdac7('0xc'),_0xdac7('0xd'),_0xdac7('0xe'),_0xdac7('0xf'),_0xdac7('0x10'),'data7']}]},'log':_0xdac7('0x11')});};}; \ No newline at end of file +var _0x54b0=['status','Condition','AllConditions','field','AnyConditions','operator','value','Action','Actions','data1','data2','data4','data5','data6','data7','GetTrigger','name','channel'];(function(_0x1a9d7b,_0x1fc191){var _0x23c002=function(_0xc8aa0f){while(--_0xc8aa0f){_0x1a9d7b['push'](_0x1a9d7b['shift']());}};_0x23c002(++_0x1fc191);}(_0x54b0,0xe7));var _0x054b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x54b0[_0x3947c9];return _0x2e7871;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x4c271e){return function(_0x41625f){return client['Request'](_0x054b('0x0'),{'options':{'raw':![],'attributes':['id',_0x054b('0x1'),_0x054b('0x2'),_0x054b('0x3')],'include':[{'model':_0x054b('0x4'),'as':_0x054b('0x5'),'attributes':['id',_0x054b('0x6'),'operator','value']},{'model':_0x054b('0x4'),'as':_0x054b('0x7'),'attributes':['id',_0x054b('0x6'),_0x054b('0x8'),_0x054b('0x9')]},{'model':_0x054b('0xa'),'as':_0x054b('0xb'),'attributes':['id','action',_0x054b('0xc'),_0x054b('0xd'),'data3',_0x054b('0xe'),_0x054b('0xf'),_0x054b('0x10'),_0x054b('0x11')]}]},'log':_0x054b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 22d8b9f..524ac7a 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 _0xb024=['registry','getTrunks','Request','GetTrunk'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb024,0x1ad));var _0x4b02=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb024[_0x413feb];return _0x40ee88;};'use strict';var client=require('../client');exports[_0x4b02('0x0')]=function(_0x8f00d0){return function(_0x3c2440){return client[_0x4b02('0x1')](_0x4b02('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4b02('0x3'),'defaultuser']},'log':_0x4b02('0x2')});};}; \ No newline at end of file +var _0x4eb6=['getTrunks','Request','name','registry','defaultuser','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb6,0xf5));var _0x64eb=function(_0x102f0f,_0x179a3a){_0x102f0f=_0x102f0f-0x0;var _0x12efec=_0x4eb6[_0x102f0f];return _0x12efec;};'use strict';var client=require(_0x64eb('0x0'));exports[_0x64eb('0x1')]=function(_0x5644f2){return function(_0x2cf2ef){return client[_0x64eb('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x64eb('0x3'),_0x64eb('0x4'),_0x64eb('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 17c6eed..e95b61d 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 _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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe706,0xa3));var _0x6e70=function(_0x48b3fb,_0x4b07bf){_0x48b3fb=_0x48b3fb-0x0;var _0x458604=_0xe706[_0x48b3fb];return _0x458604;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8fb2f38..948b411 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 _0xf111=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','Request'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xf111,0x117));var _0x1f11=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xf111[_0x2f87cd];return _0x5d7eda;};'use strict';var client=require('../client');exports['create']=function(_0x3b4ff4){return client[_0x1f11('0x0')](_0x1f11('0x1'),{'body':_0x3b4ff4,'log':_0x1f11('0x1')});};exports[_0x1f11('0x2')]=function(_0x3350b7,_0x38aff5,_0x210988){return client[_0x1f11('0x0')](_0x1f11('0x3'),{'body':_0x3350b7,'options':{'where':{'uniqueid':_0x38aff5,'interface':_0x210988,'agentcomplete':!![]}},'log':_0x1f11('0x3')});}; \ No newline at end of file +var _0xecf1=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xecf1,0x1ef));var _0x1ecf=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0xecf1[_0x43576f];return _0x4d2466;};'use strict';var client=require(_0x1ecf('0x0'));exports['create']=function(_0xff74d7){return client[_0x1ecf('0x1')](_0x1ecf('0x2'),{'body':_0xff74d7,'log':_0x1ecf('0x2')});};exports[_0x1ecf('0x3')]=function(_0x12ecbd,_0x2246f1,_0x1e7350){return client[_0x1ecf('0x1')](_0x1ecf('0x4'),{'body':_0x12ecbd,'options':{'where':{'uniqueid':_0x2246f1,'interface':_0x1e7350,'agentcomplete':!![]}},'log':_0x1ecf('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6300a00..1b4b564 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 _0x0386=['util','lodash','../client','create','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','billableseconds'];(function(_0x2ce6ab,_0x4ef47d){var _0x197a53=function(_0x482ea1){while(--_0x482ea1){_0x2ce6ab['push'](_0x2ce6ab['shift']());}};_0x197a53(++_0x4ef47d);}(_0x0386,0x154));var _0x6038=function(_0x58f41c,_0x2bac65){_0x58f41c=_0x58f41c-0x0;var _0x5d50fa=_0x0386[_0x58f41c];return _0x5d50fa;};'use strict';var moment=require('moment');var util=require(_0x6038('0x0'));var _=require(_0x6038('0x1'));var client=require(_0x6038('0x2'));exports[_0x6038('0x3')]=function(_0x2e4a0e){return client['Request'](_0x6038('0x4'),{'body':_[_0x6038('0x5')](_0x2e4a0e,{'source':_0x2e4a0e['calleridnum'],'destinationcontext':_0x2e4a0e[_0x6038('0x6')],'callerid':_0x2e4a0e[_0x6038('0x7')],'amaflags':_0x6038('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x6038('0x9')]=function(){return function(){return client[_0x6038('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x6038('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x6038('0xc'))[_0x6038('0xd')](_0x6038('0xe')),moment()['endOf']('day')[_0x6038('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x6038('0xf'),'disposition','duration',_0x6038('0x10')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x07ee=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x58a4ac,_0x26f3e7){var _0x435e2d=function(_0x1a5660){while(--_0x1a5660){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x435e2d(++_0x26f3e7);}(_0x07ee,0x1eb));var _0xe07e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x07ee[_0x34bf97];return _0x292719;};'use strict';var moment=require(_0xe07e('0x0'));var util=require(_0xe07e('0x1'));var _=require(_0xe07e('0x2'));var client=require(_0xe07e('0x3'));exports[_0xe07e('0x4')]=function(_0x17e096){return client[_0xe07e('0x5')](_0xe07e('0x6'),{'body':_['merge'](_0x17e096,{'source':_0x17e096[_0xe07e('0x7')],'destinationcontext':_0x17e096['context'],'callerid':_0x17e096[_0xe07e('0x8')],'amaflags':_0xe07e('0x9')}),'log':_0xe07e('0x6')});};exports[_0xe07e('0xa')]=function(){return function(){return client[_0xe07e('0x5')](_0xe07e('0xb'),{'options':{'where':{'type':[_0xe07e('0xc')],'createdAt':{'$between':[moment()[_0xe07e('0xd')]('day')[_0xe07e('0xe')](_0xe07e('0xf')),moment()[_0xe07e('0x10')](_0xe07e('0x11'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xe07e('0x12'),_0xe07e('0x13'),'duration','billableseconds']},'log':_0xe07e('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ef41a14..3bf8266 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 _0xb57f=['create','Request','CreateVoiceDialReport','../client'];(function(_0x1e8398,_0x58480e){var _0xc67b1a=function(_0x45bf4b){while(--_0x45bf4b){_0x1e8398['push'](_0x1e8398['shift']());}};_0xc67b1a(++_0x58480e);}(_0xb57f,0xdf));var _0xfb57=function(_0x3e5ba6,_0x22369b){_0x3e5ba6=_0x3e5ba6-0x0;var _0x4d0767=_0xb57f[_0x3e5ba6];return _0x4d0767;};'use strict';var client=require(_0xfb57('0x0'));exports[_0xfb57('0x1')]=function(_0x59e4cf){return client[_0xfb57('0x2')]('CreateVoiceDialReport',{'body':_0x59e4cf,'log':_0xfb57('0x3')});}; \ No newline at end of file +var _0x4849=['create','Request','CreateVoiceDialReport','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4849,0x12b));var _0x9484=function(_0x1930b6,_0x2cdf60){_0x1930b6=_0x1930b6-0x0;var _0x5850aa=_0x4849[_0x1930b6];return _0x5850aa;};'use strict';var client=require(_0x9484('0x0'));exports[_0x9484('0x1')]=function(_0x45894a){return client[_0x9484('0x2')]('CreateVoiceDialReport',{'body':_0x45894a,'log':_0x9484('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bd417e5..c5e8d8c 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 _0xc6fe=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x52ec51,_0x2f1bb7){var _0x386802=function(_0x45c53c){while(--_0x45c53c){_0x52ec51['push'](_0x52ec51['shift']());}};_0x386802(++_0x2f1bb7);}(_0xc6fe,0xbc));var _0xec6f=function(_0x4c41c3,_0x668eb3){_0x4c41c3=_0x4c41c3-0x0;var _0x50b018=_0xc6fe[_0x4c41c3];return _0x50b018;};'use strict';var client=require(_0xec6f('0x0'));exports[_0xec6f('0x1')]=function(){return function(){return client['Request'](_0xec6f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xec6f('0x3'),_0xec6f('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xe13a=['getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x155d18,_0x5b4da9){var _0x3cfdc6=function(_0x15e47a){while(--_0x15e47a){_0x155d18['push'](_0x155d18['shift']());}};_0x3cfdc6(++_0x5b4da9);}(_0xe13a,0x178));var _0xae13=function(_0x4eca5c,_0x2fe077){_0x4eca5c=_0x4eca5c-0x0;var _0x1ca42e=_0xe13a[_0x4eca5c];return _0x1ca42e;};'use strict';var client=require('../client');exports[_0xae13('0x0')]=function(){return function(){return client[_0xae13('0x1')](_0xae13('0x2'),{'options':{'raw':!![],'attributes':['id',_0xae13('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xae13('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a8c4e20..f3be144 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 _0x9b7c=['autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout'];(function(_0x4c055e,_0xa39030){var _0x360d6a=function(_0x4d8617){while(--_0x4d8617){_0x4c055e['push'](_0x4c055e['shift']());}};_0x360d6a(++_0xa39030);}(_0x9b7c,0x73));var _0xc9b7=function(_0x2afb08,_0x324211){_0x2afb08=_0x2afb08-0x0;var _0x38cc5a=_0x9b7c[_0x2afb08];return _0x38cc5a;};'use strict';var client=require(_0xc9b7('0x0'));exports[_0xc9b7('0x1')]=function(){return function(){return client[_0xc9b7('0x2')](_0xc9b7('0x3'),{'options':{'raw':![],'attributes':['id',_0xc9b7('0x4'),_0xc9b7('0x5'),_0xc9b7('0x6'),_0xc9b7('0x7'),_0xc9b7('0x8'),'type','dialActive',_0xc9b7('0x9'),_0xc9b7('0xa'),_0xc9b7('0xb'),'dialPowerLevel',_0xc9b7('0xc'),_0xc9b7('0xd'),_0xc9b7('0xe'),_0xc9b7('0xf'),_0xc9b7('0x10'),_0xc9b7('0x11'),'dialQueueOptions',_0xc9b7('0x12'),_0xc9b7('0x13'),_0xc9b7('0x14'),_0xc9b7('0x15'),_0xc9b7('0x16'),'dialBusyRetryFrequency',_0xc9b7('0x17'),'dialNoAnswerRetryFrequency',_0xc9b7('0x18'),_0xc9b7('0x19'),'dialGlobalInterval',_0xc9b7('0x1a'),'dialCheckDuplicateType',_0xc9b7('0x1b'),_0xc9b7('0x1c'),_0xc9b7('0x1d'),_0xc9b7('0x1e'),_0xc9b7('0x1f'),_0xc9b7('0x20'),_0xc9b7('0x21'),_0xc9b7('0x22'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xc9b7('0x23'),_0xc9b7('0x24'),_0xc9b7('0x25'),_0xc9b7('0x26'),_0xc9b7('0x27'),'dialQueueProject2',_0xc9b7('0x8'),_0xc9b7('0x28'),_0xc9b7('0x29'),_0xc9b7('0x2a'),_0xc9b7('0x2b'),_0xc9b7('0x2c'),_0xc9b7('0x2d'),'dialDropRetryFrequency',_0xc9b7('0x2e'),_0xc9b7('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xc9b7('0x30'),'dialAgentRejectRetryFrequency',_0xc9b7('0x31'),'dialPredictiveIntervalMaxThreshold',_0xc9b7('0x32'),_0xc9b7('0x33'),'dialPreviewRecallmeReminder',_0xc9b7('0x34')],'include':[{'model':_0xc9b7('0x35'),'as':_0xc9b7('0x35'),'attributes':['id','name','callerid',_0xc9b7('0x36')]},{'model':_0xc9b7('0x37'),'as':_0xc9b7('0x38'),'attributes':['id',_0xc9b7('0x4')]},{'model':_0xc9b7('0x35'),'as':'TrunkBackup','attributes':['id',_0xc9b7('0x4'),_0xc9b7('0x39'),'active']},{'model':'Interval','as':_0xc9b7('0x3a'),'attributes':['id',_0xc9b7('0x4')],'include':[{'model':_0xc9b7('0x3a'),'as':_0xc9b7('0x3b'),'attributes':['id',_0xc9b7('0x4'),_0xc9b7('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xde78=['mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active'];(function(_0xe9c24f,_0x231920){var _0x41be20=function(_0x1d2861){while(--_0x1d2861){_0xe9c24f['push'](_0xe9c24f['shift']());}};_0x41be20(++_0x231920);}(_0xde78,0x166));var _0x8de7=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0xde78[_0x54e6f5];return _0x5e8794;};'use strict';var client=require(_0x8de7('0x0'));exports[_0x8de7('0x1')]=function(){return function(){return client[_0x8de7('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8de7('0x3'),_0x8de7('0x4'),'acwTimeout',_0x8de7('0x5'),'monitor_format',_0x8de7('0x6'),_0x8de7('0x7'),_0x8de7('0x8'),_0x8de7('0x9'),_0x8de7('0xa'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x8de7('0xb'),_0x8de7('0xc'),_0x8de7('0xd'),'dialOriginateTimeout',_0x8de7('0xe'),_0x8de7('0xf'),_0x8de7('0x10'),_0x8de7('0x11'),_0x8de7('0x12'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8de7('0x13'),_0x8de7('0x14'),_0x8de7('0x15'),_0x8de7('0x16'),_0x8de7('0x17'),_0x8de7('0x18'),_0x8de7('0x19'),_0x8de7('0x1a'),_0x8de7('0x1b'),_0x8de7('0x1c'),_0x8de7('0x1d'),_0x8de7('0x1e'),'dialAMDMinWordLength',_0x8de7('0x1f'),_0x8de7('0x20'),_0x8de7('0x21'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0x8de7('0x22'),_0x8de7('0x23'),_0x8de7('0x24'),_0x8de7('0x25'),_0x8de7('0x26'),_0x8de7('0x27'),_0x8de7('0x28'),_0x8de7('0x29'),_0x8de7('0x2a'),_0x8de7('0x2b'),_0x8de7('0x2c'),_0x8de7('0x2d'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x8de7('0x2e'),_0x8de7('0x2f'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x8de7('0x30'),_0x8de7('0x31'),'dialPredictiveIntervalMinThreshold',_0x8de7('0x32'),_0x8de7('0x33'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x8de7('0x34'),'as':_0x8de7('0x34'),'attributes':['id',_0x8de7('0x3'),_0x8de7('0x35'),_0x8de7('0x36')]},{'model':'Pause','as':_0x8de7('0x37'),'attributes':['id','name']},{'model':_0x8de7('0x34'),'as':_0x8de7('0x38'),'attributes':['id',_0x8de7('0x3'),_0x8de7('0x35'),_0x8de7('0x36')]},{'model':_0x8de7('0x39'),'as':_0x8de7('0x39'),'attributes':['id',_0x8de7('0x3')],'include':[{'model':_0x8de7('0x39'),'as':'Intervals','attributes':['id',_0x8de7('0x3'),_0x8de7('0x3a')]}]}]},'log':_0x8de7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ad6f423..1077050 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(_0xf24848,_0x3d69fe){var _0x2e9a97=function(_0x41b9b4){while(--_0x41b9b4){_0xf24848['push'](_0xf24848['shift']());}};_0x2e9a97(++_0x3d69fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x50a5cf,_0x55c60b){var _0x28fdef=function(_0x560397){while(--_0x560397){_0x50a5cf['push'](_0x50a5cf['shift']());}};_0x28fdef(++_0x55c60b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 2bf8a0d..9cab9a1 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 _0x268b=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0xa5415f,_0x365a28){var _0x1afb2f=function(_0x1c5010){while(--_0x1c5010){_0xa5415f['push'](_0xa5415f['shift']());}};_0x1afb2f(++_0x365a28);}(_0x268b,0x16d));var _0xb268=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x268b[_0x2bc1fe];return _0x1a47a5;};'use strict';var client=require(_0xb268('0x0'));exports[_0xb268('0x1')]=function(_0x4cf90f){return function(){return client['Request'](_0xb268('0x2'),{'options':{'where':{'VoiceQueueId':_0x4cf90f,'paused':!![]},'raw':!![]},'log':_0xb268('0x1')});};}; \ No newline at end of file +var _0x8eae=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x139d35,_0x342ca3){var _0x3970a1=function(_0x429126){while(--_0x429126){_0x139d35['push'](_0x139d35['shift']());}};_0x3970a1(++_0x342ca3);}(_0x8eae,0x1c1));var _0xe8ea=function(_0x23f4ad,_0xb1c02f){_0x23f4ad=_0x23f4ad-0x0;var _0x42e2ec=_0x8eae[_0x23f4ad];return _0x42e2ec;};'use strict';var client=require('../client');exports[_0xe8ea('0x0')]=function(_0x5a38d3){return function(){return client[_0xe8ea('0x1')](_0xe8ea('0x2'),{'options':{'where':{'VoiceQueueId':_0x5a38d3,'paused':!![]},'raw':!![]},'log':_0xe8ea('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fadabee..53d21e4 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x573fc4,_0x1c34db){var _0x5f5dc6=function(_0x3235ea){while(--_0x3235ea){_0x573fc4['push'](_0x573fc4['shift']());}};_0x5f5dc6(++_0x1c34db);}(_0x7a54,0x106));var _0x47a5=function(_0x418f88,_0x455a62){_0x418f88=_0x418f88-0x0;var _0xa0682a=_0x7a54[_0x418f88];return _0xa0682a;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1bacc9,_0x51b05a){var _0x367a4c=function(_0x3237d2){while(--_0x3237d2){_0x1bacc9['push'](_0x1bacc9['shift']());}};_0x367a4c(++_0x51b05a);}(_0x7a54,0x106));var _0x47a5=function(_0x3b983c,_0x19e6af){_0x3b983c=_0x3b983c-0x0;var _0x3780a8=_0x7a54[_0x3b983c];return _0x3780a8;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index cb7a469..02abc10 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 _0xc4cb=['transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x13f96d,_0x22405e){var _0x36855d=function(_0x559687){while(--_0x559687){_0x13f96d['push'](_0x13f96d['shift']());}};_0x36855d(++_0x22405e);}(_0xc4cb,0x1b0));var _0xbc4c=function(_0x5f3cab,_0x1b523d){_0x5f3cab=_0x5f3cab-0x0;var _0x2db243=_0xc4cb[_0x5f3cab];return _0x2db243;};'use strict';var client=require('../client');exports[_0xbc4c('0x0')]={};exports[_0xbc4c('0x1')]=function(_0x2b6515){return client[_0xbc4c('0x2')](_0xbc4c('0x3'),{'body':{'result':_0x2b6515[_0xbc4c('0x4')],'transfererchannel':_0x2b6515[_0xbc4c('0x5')],'transferercalleridnum':_0x2b6515[_0xbc4c('0x6')],'transferercalleridname':_0x2b6515[_0xbc4c('0x7')],'transfererconnectedlinenum':_0x2b6515['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2b6515['transfererconnectedlinename'],'transfereraccountcode':_0x2b6515[_0xbc4c('0x8')],'transferercontext':_0x2b6515['transferercontext'],'transfererexten':_0x2b6515[_0xbc4c('0x9')],'transfererlinkedid':_0x2b6515[_0xbc4c('0xa')],'transfereechannel':_0x2b6515[_0xbc4c('0xb')],'transfereecalleridnum':_0x2b6515[_0xbc4c('0xc')],'transfereecalleridname':_0x2b6515[_0xbc4c('0xd')],'transfereeconnectedlinenum':_0x2b6515[_0xbc4c('0xe')],'transfereeconnectedlinename':_0x2b6515[_0xbc4c('0xf')],'transfereeaccountcode':_0x2b6515[_0xbc4c('0x10')],'transfereecontext':_0x2b6515[_0xbc4c('0x11')],'transfereeexten':_0x2b6515[_0xbc4c('0x12')],'transfereelinkedid':_0x2b6515[_0xbc4c('0x13')],'isexternal':_0x2b6515['isexternal'],'context':_0x2b6515['context'],'extension':_0x2b6515['extension'],'type':_0xbc4c('0x14')},'log':'CreateVoiceTransferReport'});};exports[_0xbc4c('0x15')]=function(_0xa718df){return client['Request'](_0xbc4c('0x3'),{'body':{'result':_0xa718df[_0xbc4c('0x4')],'transfererchannel':_0xa718df['origtransfererchannel'],'transferercalleridnum':_0xa718df[_0xbc4c('0x16')],'transferercalleridname':_0xa718df['origtransferercalleridname'],'transfererconnectedlinenum':_0xa718df[_0xbc4c('0x17')],'transfererconnectedlinename':_0xa718df[_0xbc4c('0x18')],'transfereraccountcode':_0xa718df[_0xbc4c('0x19')],'transferercontext':_0xa718df[_0xbc4c('0x1a')],'transfererexten':_0xa718df[_0xbc4c('0x1b')],'transfererlinkedid':_0xa718df[_0xbc4c('0x1c')],'transfereechannel':_0xa718df[_0xbc4c('0x1d')],'transfereecalleridnum':_0xa718df[_0xbc4c('0x1e')],'transfereecalleridname':_0xa718df['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xa718df[_0xbc4c('0x1f')],'transfereeconnectedlinename':_0xa718df[_0xbc4c('0x20')],'transfereeaccountcode':_0xa718df[_0xbc4c('0x21')],'transfereecontext':_0xa718df[_0xbc4c('0x22')],'transfereeexten':_0xa718df[_0xbc4c('0x23')],'transfereelinkedid':_0xa718df['transfertargetlinkedid'],'isexternal':_0xa718df[_0xbc4c('0x24')],'context':_0xa718df[_0xbc4c('0x25')],'extension':_0xa718df[_0xbc4c('0x26')],'type':_0xbc4c('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xf08d=['extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereeexten','transfereelinkedid'];(function(_0x263b9e,_0x1a6637){var _0x1639d8=function(_0x239bf5){while(--_0x239bf5){_0x263b9e['push'](_0x263b9e['shift']());}};_0x1639d8(++_0x1a6637);}(_0xf08d,0x1ae));var _0xdf08=function(_0x19b24c,_0x2ef4e1){_0x19b24c=_0x19b24c-0x0;var _0x5c4bdd=_0xf08d[_0x19b24c];return _0x5c4bdd;};'use strict';var client=require(_0xdf08('0x0'));exports[_0xdf08('0x1')]={};exports[_0xdf08('0x2')]=function(_0x5df16e){return client[_0xdf08('0x3')](_0xdf08('0x4'),{'body':{'result':_0x5df16e[_0xdf08('0x5')],'transfererchannel':_0x5df16e[_0xdf08('0x6')],'transferercalleridnum':_0x5df16e[_0xdf08('0x7')],'transferercalleridname':_0x5df16e[_0xdf08('0x8')],'transfererconnectedlinenum':_0x5df16e[_0xdf08('0x9')],'transfererconnectedlinename':_0x5df16e['transfererconnectedlinename'],'transfereraccountcode':_0x5df16e[_0xdf08('0xa')],'transferercontext':_0x5df16e[_0xdf08('0xb')],'transfererexten':_0x5df16e[_0xdf08('0xc')],'transfererlinkedid':_0x5df16e[_0xdf08('0xd')],'transfereechannel':_0x5df16e[_0xdf08('0xe')],'transfereecalleridnum':_0x5df16e[_0xdf08('0xf')],'transfereecalleridname':_0x5df16e[_0xdf08('0x10')],'transfereeconnectedlinenum':_0x5df16e[_0xdf08('0x11')],'transfereeconnectedlinename':_0x5df16e['transfereeconnectedlinename'],'transfereeaccountcode':_0x5df16e['transfereeaccountcode'],'transfereecontext':_0x5df16e[_0xdf08('0x12')],'transfereeexten':_0x5df16e[_0xdf08('0x13')],'transfereelinkedid':_0x5df16e[_0xdf08('0x14')],'isexternal':_0x5df16e['isexternal'],'context':_0x5df16e['context'],'extension':_0x5df16e[_0xdf08('0x15')],'type':_0xdf08('0x16')},'log':_0xdf08('0x4')});};exports[_0xdf08('0x17')]=function(_0x2fc6fc){return client[_0xdf08('0x3')](_0xdf08('0x4'),{'body':{'result':_0x2fc6fc[_0xdf08('0x5')],'transfererchannel':_0x2fc6fc['origtransfererchannel'],'transferercalleridnum':_0x2fc6fc['origtransferercalleridnum'],'transferercalleridname':_0x2fc6fc[_0xdf08('0x18')],'transfererconnectedlinenum':_0x2fc6fc[_0xdf08('0x19')],'transfererconnectedlinename':_0x2fc6fc[_0xdf08('0x1a')],'transfereraccountcode':_0x2fc6fc[_0xdf08('0x1b')],'transferercontext':_0x2fc6fc[_0xdf08('0x1c')],'transfererexten':_0x2fc6fc[_0xdf08('0x1d')],'transfererlinkedid':_0x2fc6fc[_0xdf08('0x1e')],'transfereechannel':_0x2fc6fc[_0xdf08('0x1f')],'transfereecalleridnum':_0x2fc6fc[_0xdf08('0x20')],'transfereecalleridname':_0x2fc6fc[_0xdf08('0x21')],'transfereeconnectedlinenum':_0x2fc6fc[_0xdf08('0x22')],'transfereeconnectedlinename':_0x2fc6fc[_0xdf08('0x23')],'transfereeaccountcode':_0x2fc6fc['transfertargetaccountcode'],'transfereecontext':_0x2fc6fc[_0xdf08('0x24')],'transfereeexten':_0x2fc6fc[_0xdf08('0x25')],'transfereelinkedid':_0x2fc6fc[_0xdf08('0x26')],'isexternal':_0x2fc6fc[_0xdf08('0x27')],'context':_0x2fc6fc['origtransferercontext'],'extension':_0x2fc6fc['origtransfererexten'],'type':_0xdf08('0x28')},'log':_0xdf08('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 31764ca..09ec697 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 _0x4873=['erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','validate','resolve','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../properties','../ami','listen','format','SIP','timers','updateAcw','agents','QueuePause','isConnected','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','type','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x4873,0x1df));var _0x3487=function(_0x534d2f,_0x598e1e){_0x534d2f=_0x534d2f-0x0;var _0x48cf8c=_0x4873[_0x534d2f];return _0x48cf8c;};'use strict';var _=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var jayson=require(_0x3487('0x2'));var schema=require('validate');var BPromise=require(_0x3487('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x3487('0x4'));var ami=require(_0x3487('0x5'));exports[_0x3487('0x6')]=function(_0x1d6d6c,_0x2fc292,_0xbe12a4){return new BPromise(function(_0x2611dc,_0x193589){var _0x4a2407={'QueuePause':function(_0x1d4cae){return new Promise(function(_0x3df081,_0x1d0487){var _0x3be031=util[_0x3487('0x7')]('%s/%s',_0x3487('0x8'),_0x1d4cae['name']);if(_0x1d6d6c[_0x3487('0x9')]&&_0x1d6d6c[_0x3487('0x9')][_0x3be031]&&_0x1d6d6c['timers'][_0x3be031]['timer']){_0x1d6d6c[_0x3487('0x9')][_0x3be031][_0x3487('0xa')]();}if(_0x1d6d6c['agents'][_0x3be031]){_0x1d6d6c[_0x3487('0xb')][_0x3be031]['updateStatusRealtime']({'statePause':_0x1d4cae['pause']?!![]:![]});}_0x3df081({'code':0xc8,'message':_0x3487('0xc')});});},'Reload':function(_0x1be2e0){var _0x3883c7=this;return new Promise(function(_0x3033b3,_0x8d7a3c){if(ami[_0x3487('0xd')]()==![]){return _0x8d7a3c(_0x3883c7['error'](0x1f4,[config[_0x3487('0xe')]['ip'],config[_0x3487('0xe')][_0x3487('0xf')],'ami\x20disconnected'][_0x3487('0x10')]('\x20')));}_0x1be2e0=_[_0x3487('0x11')](_0x1be2e0,_[_0x3487('0x12')](properties[_0x3487('0x13')]));_0x1be2e0[_0x3487('0x14')]=_0x3487('0x15');return ami[_0x3487('0x16')](_0x1be2e0)[_0x3487('0x17')](function(_0x320894){_0x3033b3({'code':0xc8,'message':_0x320894[_0x3487('0x18')]});})[_0x3487('0x19')](function(_0x41795b){_0x8d7a3c(_0x3883c7[_0x3487('0x1a')](0x1f5,_0x41795b[_0x3487('0x18')]));});});},'Command':function(_0x56f282){var _0x320349=this;return new Promise(function(_0x594ff6,_0x2fd2e8){if(ami[_0x3487('0xd')]()==![]){return _0x2fd2e8(_0x320349[_0x3487('0x1a')](0x1f4,[config[_0x3487('0xe')]['ip'],config[_0x3487('0xe')][_0x3487('0xf')],'ami\x20disconnected'][_0x3487('0x10')]('\x20')));}_0x56f282=_[_0x3487('0x11')](_0x56f282,_0x3487('0x1b'));_0x56f282[_0x3487('0x14')]=_0x3487('0x1c');return ami[_0x3487('0x16')](_0x56f282)['then'](function(_0x384792){_0x594ff6({'code':0xc8,'message':_0x384792[_0x3487('0x1d')]});})[_0x3487('0x19')](function(_0x482551){_0x2fd2e8(_0x320349['error'](0x1f5,_0x482551[_0x3487('0x18')]));});});},'VoiceQueues':function(_0x20be9a){return new Promise(function(_0x2a0b57,_0x3a9d76){var _0x4c6882=[];for(var _0x79a183 in _0x1d6d6c[_0x3487('0x1e')]){if(_0x1d6d6c['voiceQueues'][_0x3487('0x1f')](_0x79a183)){var _0x3fb245=_0x1d6d6c['voiceQueues'][_0x79a183];var _0x59968f={'id':_0x3fb245['id'],'name':_0x3fb245[_0x3487('0x20')],'strategy':_0x3fb245[_0x3487('0x21')],'answered':_0x3fb245[_0x3487('0x22')],'available':_0x3fb245[_0x3487('0x23')],'loggedIn':_0x3fb245[_0x3487('0x24')],'pTalking':_0x3fb245[_0x3487('0x25')],'sumBillable':_0x3fb245[_0x3487('0x26')],'sumDuration':_0x3fb245[_0x3487('0x27')],'sumHoldTime':_0x3fb245[_0x3487('0x28')]||0x0,'talking':_0x3fb245[_0x3487('0x29')],'total':_0x3fb245[_0x3487('0x2a')],'type':_0x3fb245['type'],'unmanaged':_0x3fb245['unmanaged'],'abandoned':_0x3fb245[_0x3487('0x2b')],'waiting':_0x3fb245[_0x3487('0x2c')],'loggedInDb':_0x3fb245['loggedInDb']};if(_0x3fb245[_0x3487('0x2d')]===_0x3487('0x2e')){_0x59968f['dialActive']=_0x3fb245['dialActive'];_0x59968f[_0x3487('0x2f')]=_0x3fb245[_0x3487('0x2f')];_0x59968f[_0x3487('0x30')]=_0x3fb245['dialOriginateCallerIdName'];_0x59968f[_0x3487('0x31')]=_0x3fb245['dialOriginateCallerIdNumber'];_0x59968f['dialOriginateTimeout']=_0x3fb245['dialOriginateTimeout'];_0x59968f[_0x3487('0x32')]=_0x3fb245[_0x3487('0x32')];_0x59968f['temp']=_0x3fb245['temp'];_0x59968f[_0x3487('0x33')]=_0x3fb245['outboundAnswerAgiCallsDay'];_0x59968f['outboundAnswerCallsDay']=_0x3fb245[_0x3487('0x34')];_0x59968f[_0x3487('0x35')]=_0x3fb245[_0x3487('0x35')];_0x59968f['outboundBusyCallsDay']=_0x3fb245[_0x3487('0x36')];_0x59968f[_0x3487('0x37')]=_0x3fb245[_0x3487('0x37')];_0x59968f[_0x3487('0x38')]=_0x3fb245['outboundDropCallsDayACS'];_0x59968f[_0x3487('0x39')]=_0x3fb245[_0x3487('0x39')];_0x59968f['outboundDropCallsDayTimeout']=_0x3fb245[_0x3487('0x3a')];_0x59968f[_0x3487('0x3b')]=_0x3fb245[_0x3487('0x3b')];_0x59968f[_0x3487('0x3c')]=_0x3fb245[_0x3487('0x3c')];_0x59968f[_0x3487('0x3d')]=_0x3fb245[_0x3487('0x3d')];_0x59968f[_0x3487('0x3e')]=_0x3fb245[_0x3487('0x3e')];_0x59968f['outboundRejectCallsDay']=_0x3fb245[_0x3487('0x3f')];_0x59968f[_0x3487('0x40')]=_0x3fb245['outboundUnknownCallsDay'];_0x59968f['predictiveIntervalAnsweredCalls']=_0x3fb245[_0x3487('0x41')];_0x59968f[_0x3487('0x42')]=_0x3fb245[_0x3487('0x42')];_0x59968f['predictiveIntervalAvgTalktime']=_0x3fb245['predictiveIntervalAvgTalktime'];_0x59968f['predictiveIntervalDroppedCallsCallersExit']=_0x3fb245[_0x3487('0x43')];_0x59968f[_0x3487('0x44')]=_0x3fb245['predictiveIntervalDroppedCallsTimeout'];_0x59968f[_0x3487('0x45')]=_0x3fb245[_0x3487('0x45')];_0x59968f[_0x3487('0x46')]=_0x3fb245[_0x3487('0x46')];_0x59968f[_0x3487('0x47')]=_0x3fb245[_0x3487('0x47')];_0x59968f[_0x3487('0x48')]=_0x3fb245[_0x3487('0x48')];_0x59968f[_0x3487('0x49')]=_0x3fb245['predictiveIntervalPauses'];_0x59968f[_0x3487('0x4a')]=_0x3fb245[_0x3487('0x4a')];_0x59968f['predictiveIntervalTotalCalls']=_0x3fb245['predictiveIntervalTotalCalls'];_0x59968f[_0x3487('0x18')]=_0x3fb245['message'];_0x59968f['originated']=_0x3fb245[_0x3487('0x4b')];_0x59968f['erlangCalls']=_0x3fb245['erlangCalls'];_0x59968f[_0x3487('0x4c')]=_0x3fb245[_0x3487('0x4c')];_0x59968f['erlangAbandonmentRate']=_0x3fb245['erlangAbandonmentRate'];_0x59968f[_0x3487('0x4d')]=_0x3fb245[_0x3487('0x4d')];_0x59968f['startPredictive']=_0x3fb245[_0x3487('0x4e')];_0x59968f[_0x3487('0x4f')]=_0x3fb245['startProgressive'];}if(_0x3fb245[_0x3487('0x50')]){_0x59968f[_0x3487('0x50')]={'id':_0x3fb245[_0x3487('0x50')]['id'],'name':_0x3fb245['Trunk'][_0x3487('0x20')],'active':_0x3fb245[_0x3487('0x50')][_0x3487('0x51')],'callerid':_0x3fb245[_0x3487('0x50')][_0x3487('0x52')]};}if(_0x3fb245[_0x3487('0x53')]){_0x59968f[_0x3487('0x53')]={'id':_0x3fb245[_0x3487('0x53')]['id'],'name':_0x3fb245['Interval'][_0x3487('0x20')]};}_0x4c6882[_0x3487('0x54')](_0x59968f);}}_0x2a0b57({'count':_0x4c6882[_0x3487('0x55')],'rows':_0x4c6882});});},'UpdateVoiceQueue':function(_0x2795f3){return new Promise(function(_0x3315da,_0x31e766){var _0x324ebb=_[_0x3487('0x56')](_0x1d6d6c['voiceQueues'],{'id':parseInt(_0x2795f3['id'])});var _0x59f0fa=_[_0x3487('0x57')](_0x2795f3,['id']);if(_0x324ebb){for(var _0x32ddbb in _0x59f0fa){if(typeof _0x59f0fa[_0x32ddbb]!==_0x3487('0x58')&&typeof _0x324ebb[_0x32ddbb]!==_0x3487('0x58')){_0x324ebb[_0x32ddbb]=_0x59f0fa[_0x32ddbb];}}_0x3315da(_0x324ebb);}else{_0x31e766();}});},'VoiceChannels':function(_0x5bff36){return new Promise(function(_0x50b81c,_0x1f373b){var _0x122456=_[_0x3487('0x59')](_0x1d6d6c[_0x3487('0x5a')]);_0x50b81c({'count':_0x122456[_0x3487('0x55')],'rows':_0x122456});});},'VoiceChannelMixMonitor':function(_0x3f46af){var _0x357670=this;return new Promise(function(_0x1cac2c,_0x515e68){if(ami['isConnected']()==![]){return _0x515e68(_0x357670[_0x3487('0x1a')](0x1f4,[config[_0x3487('0xe')]['ip'],config['asterisk'][_0x3487('0xf')],'ami\x20disconnected']['join']('\x20')));}var _0x12ebfc=schema(properties[_0x3487('0x5b')])['validate'](_0x3f46af);if(_0x12ebfc[_0x3487('0x55')]>0x0){return _0x515e68(_0x357670[_0x3487('0x1a')](0x1f4,_[_0x3487('0x5c')](_0x12ebfc,'message')[_0x3487('0x10')](',\x20')));}var _0x56b3fa=_[_0x3487('0x56')](_0x1d6d6c[_0x3487('0x5a')],{'uniqueid':_0x3f46af['uniqueid']});if(_0x56b3fa&&_0x56b3fa[_0x3487('0x5d')]){var _0xb6be79=util[_0x3487('0x7')](_0x3487('0x5e'),_0x3f46af[_0x3487('0x5f')]||_0x3f46af[_0x3487('0x60')],_0x3f46af[_0x3487('0x7')]||'wav');return ami[_0x3487('0x16')]({'action':_0x3487('0x61'),'channel':_0x56b3fa['channel'],'file':_0xb6be79,'options':_0x3487('0x62')})[_0x3487('0x17')](function(_0x3e03e4){var _0x36bae6=_[_0x3487('0x56')](_0x56b3fa[_0x3487('0x63')],{'filename':_0x3487('0x64')+_0xb6be79[_0x3487('0x65')]()});if(_[_0x3487('0x66')](_0x36bae6)){_0x56b3fa[_0x3487('0x63')]['push']({'filename':_0x3487('0x64')+_0xb6be79[_0x3487('0x65')](),'createdAt':moment()[_0x3487('0x7')](_0x3487('0x67')),'mixmonitorid':_0x3e03e4[_0x3487('0x68')],'status':_0x3487('0x69')});}else{_0x36bae6['mixmonitorid']=_0x3e03e4[_0x3487('0x68')];_0x36bae6[_0x3487('0x6a')]='rec';}_0x1cac2c({'code':0xc8,'message':[_0x3f46af['uniqueid'],_0x3487('0x6b'),_0x3e03e4[_0x3487('0x68')]][_0x3487('0x10')]('\x20'),'mixmonitorid':_0x3e03e4[_0x3487('0x68')]});})[_0x3487('0x19')](function(_0x24ce5b){_0x515e68(_0x357670['error'](0x1f5,[_0x3f46af['uniqueid'],_0x24ce5b[_0x3487('0x18')][_0x3487('0x65')]()]['join']('\x20')));});}else{return _0x515e68(_0x357670[_0x3487('0x1a')](0x1f5,_0x3487('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x143d42){var _0x48c4ea=this;return new Promise(function(_0x43a4c5,_0xa278c6){if(ami['isConnected']()==![]){return _0xa278c6(_0x48c4ea['error'](0x1f4,[config[_0x3487('0xe')]['ip'],config[_0x3487('0xe')][_0x3487('0xf')],_0x3487('0x6d')]['join']('\x20')));}var _0x463d65=schema(properties[_0x3487('0x5b')])[_0x3487('0x6e')](_0x143d42);if(_0x463d65[_0x3487('0x55')]>0x0){return _0xa278c6(_0x48c4ea['error'](0x1f4,_['map'](_0x463d65,_0x3487('0x18'))['join'](',\x20')));}var _0x347a8c=_[_0x3487('0x56')](_0x1d6d6c[_0x3487('0x5a')],{'uniqueid':_0x143d42[_0x3487('0x60')]});if(_0x347a8c){return BPromise[_0x3487('0x6f')]()[_0x3487('0x17')](function(){if(_0x347a8c[_0x3487('0x5d')]){return ami[_0x3487('0x16')]({'action':_0x3487('0x70'),'channel':_0x347a8c[_0x3487('0x5d')],'mixmonitorid':_0x143d42[_0x3487('0x68')]})['catch'](function(_0x468064){});}})[_0x3487('0x17')](function(){if(_0x347a8c['destinationchannel']){return ami[_0x3487('0x16')]({'action':'StopMixMonitor','channel':_0x347a8c['destinationchannel'],'mixmonitorid':_0x143d42[_0x3487('0x68')]})[_0x3487('0x19')](function(_0x23a38a){});}})[_0x3487('0x17')](function(_0x3d47c3){var _0x2dcfd2=_[_0x3487('0x56')](_0x347a8c['monitors'],{'mixmonitorid':_0x143d42[_0x3487('0x68')]});if(_0x2dcfd2){_0x2dcfd2[_0x3487('0x6a')]=_0x3487('0x71');}})[_0x3487('0x17')](function(){var _0x1612e5=util[_0x3487('0x7')](_0x3487('0x5e'),_0x143d42[_0x3487('0x5f')]||_0x143d42[_0x3487('0x60')],_0x143d42[_0x3487('0x7')]||'wav');var _0x548e3e=_[_0x3487('0x56')](_0x347a8c['monitors'],{'filename':_0x3487('0x64')+_0x1612e5[_0x3487('0x65')]()});if(_0x548e3e){_0x548e3e[_0x3487('0x6a')]=_0x3487('0x71');}})['then'](function(){_0x43a4c5({'code':0xc8,'message':[_0x143d42[_0x3487('0x60')],_0x3487('0x72')][_0x3487('0x10')]('\x20')});})[_0x3487('0x19')](function(_0x11c4bf){_0xa278c6(_0x48c4ea[_0x3487('0x1a')](0x1f5,[_0x143d42['uniqueid'],_0x11c4bf[_0x3487('0x18')][_0x3487('0x65')]()]['join']('\x20')));});}else{return _0xa278c6(_0x48c4ea[_0x3487('0x1a')](0x1f5,_0x3487('0x6c')));}});},'VoiceQueuesChannels':function(_0xad8256){return new Promise(function(_0x459138,_0x379b7f){var _0x2daca0=_[_0x3487('0x59')](_0x1d6d6c[_0x3487('0x73')]);_0x459138({'count':_0x2daca0[_0x3487('0x55')],'rows':_0x2daca0});});},'VoiceQueuesChannel':function(_0x4180eb){var _0x5469ba=this;return new Promise(function(_0x14c921,_0x5d7d62){var _0x4b2992=schema(properties[_0x3487('0x74')])['validate'](_0x4180eb);if(_0x4b2992[_0x3487('0x55')]>0x0){return _0x5d7d62(_0x5469ba[_0x3487('0x1a')](0x1f4,_[_0x3487('0x5c')](_0x4b2992,'message')[_0x3487('0x10')](',\x20')));}var _0x2e3da3=_[_0x3487('0x56')](_0x1d6d6c['queueChannels'],{'uniqueid':_0x4180eb[_0x3487('0x60')]});if(_0x2e3da3){_0x14c921(_0x2e3da3);}else{return _0x5d7d62(_0x5469ba[_0x3487('0x1a')](0x1f5,_0x3487('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x5b7787){var _0x4bdd41=this;return new Promise(function(_0x168786,_0xd2e056){if(ami[_0x3487('0xd')]()==![]){return _0xd2e056(_0x4bdd41[_0x3487('0x1a')](0x1f4,[config[_0x3487('0xe')]['ip'],config[_0x3487('0xe')][_0x3487('0xf')],_0x3487('0x6d')][_0x3487('0x10')]('\x20')));}var _0xd482a=schema(properties[_0x3487('0x75')])[_0x3487('0x6e')](_0x5b7787);if(_0xd482a[_0x3487('0x55')]>0x0){return _0xd2e056(_0x4bdd41[_0x3487('0x1a')](0x1f4,_[_0x3487('0x5c')](_0xd482a,_0x3487('0x18'))[_0x3487('0x10')](',\x20')));}var _0x33ffb6=_[_0x3487('0x56')](_0x1d6d6c['queueChannels'],{'uniqueid':_0x5b7787[_0x3487('0x60')]});if(_0x33ffb6&&_0x33ffb6[_0x3487('0x5d')]){return ami[_0x3487('0x16')]({'action':_0x3487('0x76'),'channel':_0x33ffb6[_0x3487('0x5d')]})['then'](function(_0x4d97c9){_0x168786({'code':0xc8,'message':[_0x5b7787[_0x3487('0x60')],_0x4d97c9[_0x3487('0x18')][_0x3487('0x65')]()][_0x3487('0x10')]('\x20')});})[_0x3487('0x19')](function(_0x39b3d7){_0xd2e056(_0x4bdd41[_0x3487('0x1a')](0x1f5,[_0x5b7787['uniqueid'],_0x39b3d7[_0x3487('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0xd2e056(_0x4bdd41[_0x3487('0x1a')](0x1f5,_0x3487('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x457a78){var _0x44dc2f=this;return new Promise(function(_0x3adaa2,_0x19a455){if(ami[_0x3487('0xd')]()==![]){return _0x19a455(_0x44dc2f[_0x3487('0x1a')](0x1f4,[config[_0x3487('0xe')]['ip'],config[_0x3487('0xe')][_0x3487('0xf')],_0x3487('0x6d')][_0x3487('0x10')]('\x20')));}var _0x11d40c=schema(properties[_0x3487('0x77')])['validate'](_0x457a78);if(_0x11d40c[_0x3487('0x55')]>0x0){return _0x19a455(_0x44dc2f[_0x3487('0x1a')](0x1f4,_[_0x3487('0x5c')](_0x11d40c,_0x3487('0x18'))['join'](',\x20')));}var _0x530c6e=_['find'](_0x1d6d6c[_0x3487('0x73')],{'uniqueid':_0x457a78[_0x3487('0x60')]});if(_0x530c6e&&_0x530c6e[_0x3487('0x5d')]){return ami[_0x3487('0x16')]({'action':_0x3487('0x78'),'channel':_0x530c6e['channel'],'exten':_0x457a78[_0x3487('0x79')],'context':_0x457a78['context']||_0x530c6e[_0x3487('0x7a')],'priority':0x1})[_0x3487('0x17')](function(_0x188aec){_0x3adaa2({'code':0xc8,'message':[_0x457a78[_0x3487('0x60')],_0x188aec[_0x3487('0x18')][_0x3487('0x65')]()][_0x3487('0x10')]('\x20')});})['catch'](function(_0x136789){_0x19a455(_0x44dc2f[_0x3487('0x1a')](0x1f5,[_0x457a78[_0x3487('0x60')],_0x136789[_0x3487('0x18')][_0x3487('0x65')]()][_0x3487('0x10')]('\x20')));});}else{return _0x19a455(_0x44dc2f[_0x3487('0x1a')](0x1f5,_0x3487('0x6c')));}});},'Agents':function(_0x2dce91){return new Promise(function(_0x8d3164,_0x2f5012){var _0x3b0540=_['values'](_0x1d6d6c['agents']);_0x8d3164({'count':_0x3b0540[_0x3487('0x55')],'rows':_0x3b0540});});},'Telephones':function(_0x3188e9){return new Promise(function(_0xcfb667,_0x3abde2){var _0x311560=_['values'](_0x1d6d6c['telephones']);_0xcfb667({'count':_0x311560[_0x3487('0x55')],'rows':_0x311560});});},'Trunks':function(_0x47c8a7){return new Promise(function(_0x43c120,_0x3c7469){var _0x1c3a61=_[_0x3487('0x59')](_0x1d6d6c[_0x3487('0x7b')]);_0x43c120({'count':_0x1c3a61[_0x3487('0x55')],'rows':_0x1c3a61});});},'OutboundChannels':function(_0xd12729){return new Promise(function(_0x1cb7e9,_0x57b4e1){var _0x409dde=_[_0x3487('0x59')](_0x1d6d6c[_0x3487('0x7c')]);_0x1cb7e9({'count':_0x409dde['length'],'rows':_0x409dde});});},'Outbound':function(_0x252eec){return new Promise(function(_0x2ffab6,_0x8608ac){_0x2ffab6(_0x1d6d6c[_0x3487('0x2e')]);});},'Campaigns':function(_0x492292){return new Promise(function(_0x50571e,_0x34eda4){var _0x32ed8c=_[_0x3487('0x59')](_0x1d6d6c[_0x3487('0x7d')]);_0x50571e({'count':_0x32ed8c[_0x3487('0x55')],'rows':_0x32ed8c});});},'VoiceQueuesPreview':function(_0x6beb62){var _0x3b9992=this;return new Promise(function(_0x80288a,_0x258bf4){_0x2fc292['run'](_0x6beb62['id'])[_0x3487('0x17')](function(_0xc9382d){_0x80288a({'code':0xc8,'message':_0xc9382d[_0x3487('0x18')]});})[_0x3487('0x19')](function(_0x59c0fb){_0x258bf4(_0x3b9992['error'](0x1f4,_0x59c0fb[_0x3487('0x18')]));});});},'EventManager':function(_0x4b528b){var _0x5ef864=this;return new Promise(function(_0x2e32cc,_0x64d58e){if(!_0x4b528b[_0x3487('0x7e')]){return _0x64d58e(_0x5ef864[_0x3487('0x1a')](0x1f4,_0x3487('0x7f')));}ami[_0x3487('0x80')](_0x3487('0x81')+_0x4b528b[_0x3487('0x7e')],_0x4b528b['message']);_0x2e32cc({'code':0xc8,'message':_0x4b528b});});},'FaxAccounts':function(_0x3d3b7e){return new Promise(function(_0x215a57,_0x574449){var _0xddf26e=_['values'](_0x1d6d6c[_0x3487('0x82')]);_0x215a57({'count':_0xddf26e['length'],'rows':_0xddf26e});});},'SendFax':function(_0x2cf63e){var _0x3e70eb=this;return new Promise(function(_0xfc35d,_0xbcb012){_0xbe12a4[_0x3487('0x83')](_0x2cf63e)[_0x3487('0x17')](function(_0x50413f){_0xfc35d({'code':0xc8,'message':_0x50413f[_0x3487('0x18')]});})['catch'](function(_0x5bc11b){_0xbcb012(_0x3e70eb[_0x3487('0x1a')](0x1f4,_0x5bc11b[_0x3487('0x18')]));});});},'CheckAfterSend':function(_0xc7fd3f){var _0x2e7509=this;return new Promise(function(_0x609d8e,_0x2f943d){_0xbe12a4[_0x3487('0x84')](_0xc7fd3f)['then'](function(_0x44d7ee){_0x609d8e({'code':0xc8,'message':_0x44d7ee[_0x3487('0x18')]});})[_0x3487('0x19')](function(_0x1803ae){_0x2f943d(_0x2e7509['error'](0x1f4,_0x1803ae['message']));});});}};var _0x4340fb=jayson[_0x3487('0x85')](_0x4a2407)[_0x3487('0x86')]();_0x4340fb['on']('error',function(_0x54652c){return _0x193589(_0x54652c);});_0x4340fb['listen'](0x232a,_0x3487('0x87'),function(){console[_0x3487('0x88')](_0x3487('0x89'),0x232a);return _0x2611dc(_0x3487('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xdf55=['util','validate','bluebird','../../../config/environment','../properties','../ami','format','%s/%s','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','error','command','Action','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','push','length','omit','undefined','map','channels','channel','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','voicechannel','resolve','StopMixMonitor','destinationchannel','stop','Channel\x20doesn\x27t\x20exist','values','voicequeuechannel','queueChannels','Redirect','exten','telephones','trunks','outboundChannels','outbound','campaigns','run','Event\x20name\x20mandatory','emit','event','checkAfterSend','http','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash'];(function(_0x3e8930,_0x154364){var _0x15b38f=function(_0x34c7ae){while(--_0x34c7ae){_0x3e8930['push'](_0x3e8930['shift']());}};_0x15b38f(++_0x154364);}(_0xdf55,0x83));var _0x5df5=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0xdf55[_0x56fd29];return _0x2a0bf7;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var jayson=require('jayson/promise');var schema=require(_0x5df5('0x2'));var BPromise=require(_0x5df5('0x3'));var moment=require('moment');var config=require(_0x5df5('0x4'));var properties=require(_0x5df5('0x5'));var ami=require(_0x5df5('0x6'));exports['listen']=function(_0x289af4,_0x417341,_0x27ec86){return new BPromise(function(_0x476e21,_0x9b8756){var _0x2b7ed9={'QueuePause':function(_0x4722a2){return new Promise(function(_0x3743f3,_0x4d43a3){var _0x338f2b=util[_0x5df5('0x7')](_0x5df5('0x8'),'SIP',_0x4722a2['name']);if(_0x289af4[_0x5df5('0x9')]&&_0x289af4['timers'][_0x338f2b]&&_0x289af4[_0x5df5('0x9')][_0x338f2b][_0x5df5('0xa')]){_0x289af4['timers'][_0x338f2b]['updateAcw']();}if(_0x289af4[_0x5df5('0xb')][_0x338f2b]){_0x289af4[_0x5df5('0xb')][_0x338f2b][_0x5df5('0xc')]({'statePause':_0x4722a2[_0x5df5('0xd')]?!![]:![]});}_0x3743f3({'code':0xc8,'message':_0x5df5('0xe')});});},'Reload':function(_0xb4a4fe){var _0x37a747=this;return new Promise(function(_0x463990,_0x52bf75){if(ami[_0x5df5('0xf')]()==![]){return _0x52bf75(_0x37a747['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config['asterisk'][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}_0xb4a4fe=_[_0x5df5('0x14')](_0xb4a4fe,_[_0x5df5('0x15')](properties['module']));_0xb4a4fe[_0x5df5('0x16')]=_0x5df5('0x17');return ami['Action'](_0xb4a4fe)[_0x5df5('0x18')](function(_0x45813f){_0x463990({'code':0xc8,'message':_0x45813f[_0x5df5('0x19')]});})[_0x5df5('0x1a')](function(_0x215d59){_0x52bf75(_0x37a747['error'](0x1f5,_0x215d59['message']));});});},'Command':function(_0x48c824){var _0x5d8dfd=this;return new Promise(function(_0x58152a,_0x40a8f5){if(ami[_0x5df5('0xf')]()==![]){return _0x40a8f5(_0x5d8dfd[_0x5df5('0x1b')](0x1f4,[config[_0x5df5('0x10')]['ip'],config['asterisk'][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}_0x48c824=_[_0x5df5('0x14')](_0x48c824,_0x5df5('0x1c'));_0x48c824[_0x5df5('0x16')]='Command';return ami[_0x5df5('0x1d')](_0x48c824)[_0x5df5('0x18')](function(_0x8742a7){_0x58152a({'code':0xc8,'message':_0x8742a7[_0x5df5('0x1e')]});})['catch'](function(_0x4358ba){_0x40a8f5(_0x5d8dfd[_0x5df5('0x1b')](0x1f5,_0x4358ba[_0x5df5('0x19')]));});});},'VoiceQueues':function(_0x4a544b){return new Promise(function(_0x52206d,_0x532923){var _0x357fb0=[];for(var _0x3ff82e in _0x289af4[_0x5df5('0x1f')]){if(_0x289af4[_0x5df5('0x1f')][_0x5df5('0x20')](_0x3ff82e)){var _0x1fd83c=_0x289af4[_0x5df5('0x1f')][_0x3ff82e];var _0x28723e={'id':_0x1fd83c['id'],'name':_0x1fd83c['name'],'strategy':_0x1fd83c[_0x5df5('0x21')],'answered':_0x1fd83c['answered'],'available':_0x1fd83c[_0x5df5('0x22')],'loggedIn':_0x1fd83c[_0x5df5('0x23')],'pTalking':_0x1fd83c['pTalking'],'sumBillable':_0x1fd83c[_0x5df5('0x24')],'sumDuration':_0x1fd83c['sumDuration'],'sumHoldTime':_0x1fd83c[_0x5df5('0x25')]||0x0,'talking':_0x1fd83c['talking'],'total':_0x1fd83c[_0x5df5('0x26')],'type':_0x1fd83c['type'],'unmanaged':_0x1fd83c[_0x5df5('0x27')],'abandoned':_0x1fd83c['abandoned'],'waiting':_0x1fd83c[_0x5df5('0x28')],'loggedInDb':_0x1fd83c[_0x5df5('0x29')]};if(_0x1fd83c[_0x5df5('0x2a')]==='outbound'){_0x28723e[_0x5df5('0x2b')]=_0x1fd83c[_0x5df5('0x2b')];_0x28723e[_0x5df5('0x2c')]=_0x1fd83c[_0x5df5('0x2c')];_0x28723e[_0x5df5('0x2d')]=_0x1fd83c[_0x5df5('0x2d')];_0x28723e[_0x5df5('0x2e')]=_0x1fd83c['dialOriginateCallerIdNumber'];_0x28723e['dialOriginateTimeout']=_0x1fd83c[_0x5df5('0x2f')];_0x28723e[_0x5df5('0x30')]=_0x1fd83c[_0x5df5('0x30')];_0x28723e[_0x5df5('0x31')]=_0x1fd83c[_0x5df5('0x31')];_0x28723e[_0x5df5('0x32')]=_0x1fd83c['outboundAnswerAgiCallsDay'];_0x28723e[_0x5df5('0x33')]=_0x1fd83c[_0x5df5('0x33')];_0x28723e[_0x5df5('0x34')]=_0x1fd83c[_0x5df5('0x34')];_0x28723e['outboundBusyCallsDay']=_0x1fd83c[_0x5df5('0x35')];_0x28723e['outboundCongestionCallsDay']=_0x1fd83c[_0x5df5('0x36')];_0x28723e[_0x5df5('0x37')]=_0x1fd83c['outboundDropCallsDayACS'];_0x28723e[_0x5df5('0x38')]=_0x1fd83c['outboundDropCallsDayCallersExit'];_0x28723e[_0x5df5('0x39')]=_0x1fd83c[_0x5df5('0x39')];_0x28723e[_0x5df5('0x3a')]=_0x1fd83c[_0x5df5('0x3a')];_0x28723e['outboundNoSuchCallsDay']=_0x1fd83c[_0x5df5('0x3b')];_0x28723e[_0x5df5('0x3c')]=_0x1fd83c[_0x5df5('0x3c')];_0x28723e[_0x5df5('0x3d')]=_0x1fd83c['outboundReCallsDay'];_0x28723e[_0x5df5('0x3e')]=_0x1fd83c[_0x5df5('0x3e')];_0x28723e[_0x5df5('0x3f')]=_0x1fd83c[_0x5df5('0x3f')];_0x28723e[_0x5df5('0x40')]=_0x1fd83c[_0x5df5('0x40')];_0x28723e[_0x5df5('0x41')]=_0x1fd83c['predictiveIntervalAvgHoldtime'];_0x28723e[_0x5df5('0x42')]=_0x1fd83c[_0x5df5('0x42')];_0x28723e['predictiveIntervalDroppedCallsCallersExit']=_0x1fd83c[_0x5df5('0x43')];_0x28723e[_0x5df5('0x44')]=_0x1fd83c['predictiveIntervalDroppedCallsTimeout'];_0x28723e[_0x5df5('0x45')]=_0x1fd83c[_0x5df5('0x45')];_0x28723e[_0x5df5('0x46')]=_0x1fd83c[_0x5df5('0x46')];_0x28723e[_0x5df5('0x47')]=_0x1fd83c[_0x5df5('0x47')];_0x28723e[_0x5df5('0x48')]=_0x1fd83c[_0x5df5('0x48')];_0x28723e['predictiveIntervalPauses']=_0x1fd83c['predictiveIntervalPauses'];_0x28723e[_0x5df5('0x49')]=_0x1fd83c['predictiveIntervalAvailable'];_0x28723e[_0x5df5('0x4a')]=_0x1fd83c[_0x5df5('0x4a')];_0x28723e['message']=_0x1fd83c[_0x5df5('0x19')];_0x28723e[_0x5df5('0x4b')]=_0x1fd83c[_0x5df5('0x4b')];_0x28723e[_0x5df5('0x4c')]=_0x1fd83c[_0x5df5('0x4c')];_0x28723e[_0x5df5('0x4d')]=_0x1fd83c[_0x5df5('0x4d')];_0x28723e[_0x5df5('0x4e')]=_0x1fd83c['erlangAbandonmentRate'];_0x28723e[_0x5df5('0x4f')]=_0x1fd83c['erlangBusyFactor'];_0x28723e[_0x5df5('0x50')]=_0x1fd83c[_0x5df5('0x50')];_0x28723e[_0x5df5('0x51')]=_0x1fd83c[_0x5df5('0x51')];}if(_0x1fd83c[_0x5df5('0x52')]){_0x28723e['Trunk']={'id':_0x1fd83c[_0x5df5('0x52')]['id'],'name':_0x1fd83c[_0x5df5('0x52')][_0x5df5('0x53')],'active':_0x1fd83c['Trunk'][_0x5df5('0x54')],'callerid':_0x1fd83c[_0x5df5('0x52')]['callerid']};}if(_0x1fd83c[_0x5df5('0x55')]){_0x28723e[_0x5df5('0x55')]={'id':_0x1fd83c[_0x5df5('0x55')]['id'],'name':_0x1fd83c[_0x5df5('0x55')]['name']};}_0x357fb0[_0x5df5('0x56')](_0x28723e);}}_0x52206d({'count':_0x357fb0[_0x5df5('0x57')],'rows':_0x357fb0});});},'UpdateVoiceQueue':function(_0x514fd8){return new Promise(function(_0x18d22c,_0xaf1598){var _0x35927b=_['find'](_0x289af4[_0x5df5('0x1f')],{'id':parseInt(_0x514fd8['id'])});var _0x3842d0=_[_0x5df5('0x58')](_0x514fd8,['id']);if(_0x35927b){for(var _0x2724e3 in _0x3842d0){if(typeof _0x3842d0[_0x2724e3]!=='undefined'&&typeof _0x35927b[_0x2724e3]!==_0x5df5('0x59')){_0x35927b[_0x2724e3]=_0x3842d0[_0x2724e3];}}_0x18d22c(_0x35927b);}else{_0xaf1598();}});},'VoiceChannels':function(_0xcdf101){return new Promise(function(_0x2eb30e,_0x3bbb73){var _0x14f9ca=_['values'](_0x289af4['channels']);_0x2eb30e({'count':_0x14f9ca[_0x5df5('0x57')],'rows':_0x14f9ca});});},'VoiceChannelMixMonitor':function(_0x5b12f1){var _0x35ad9d=this;return new Promise(function(_0x207498,_0x2f43bf){if(ami[_0x5df5('0xf')]()==![]){return _0x2f43bf(_0x35ad9d['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x2a25fe=schema(properties['voicechannel'])[_0x5df5('0x2')](_0x5b12f1);if(_0x2a25fe['length']>0x0){return _0x2f43bf(_0x35ad9d[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x2a25fe,_0x5df5('0x19'))['join'](',\x20')));}var _0x8622f4=_['find'](_0x289af4[_0x5df5('0x5b')],{'uniqueid':_0x5b12f1['uniqueid']});if(_0x8622f4&&_0x8622f4[_0x5df5('0x5c')]){var _0x2e9b93=util[_0x5df5('0x7')]('%s.%s',_0x5b12f1[_0x5df5('0x5d')]||_0x5b12f1[_0x5df5('0x5e')],_0x5b12f1['format']||_0x5df5('0x5f'));return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x60'),'channel':_0x8622f4[_0x5df5('0x5c')],'file':_0x2e9b93,'options':_0x5df5('0x61')})[_0x5df5('0x18')](function(_0x16fc86){var _0x48087d=_[_0x5df5('0x62')](_0x8622f4['monitors'],{'filename':_0x5df5('0x63')+_0x2e9b93[_0x5df5('0x64')]()});if(_[_0x5df5('0x65')](_0x48087d)){_0x8622f4[_0x5df5('0x66')][_0x5df5('0x56')]({'filename':_0x5df5('0x63')+_0x2e9b93[_0x5df5('0x64')](),'createdAt':moment()[_0x5df5('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x16fc86[_0x5df5('0x67')],'status':_0x5df5('0x68')});}else{_0x48087d[_0x5df5('0x67')]=_0x16fc86[_0x5df5('0x67')];_0x48087d[_0x5df5('0x69')]='rec';}_0x207498({'code':0xc8,'message':[_0x5b12f1[_0x5df5('0x5e')],'MixMonitor\x20Success',_0x16fc86['mixmonitorid']][_0x5df5('0x13')]('\x20'),'mixmonitorid':_0x16fc86[_0x5df5('0x67')]});})[_0x5df5('0x1a')](function(_0x210ad2){_0x2f43bf(_0x35ad9d[_0x5df5('0x1b')](0x1f5,[_0x5b12f1[_0x5df5('0x5e')],_0x210ad2['message'][_0x5df5('0x64')]()][_0x5df5('0x13')]('\x20')));});}else{return _0x2f43bf(_0x35ad9d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x7fdce7){var _0x2e6d4d=this;return new Promise(function(_0x9a168c,_0x4672c5){if(ami[_0x5df5('0xf')]()==![]){return _0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x57e3ea=schema(properties[_0x5df5('0x6a')])[_0x5df5('0x2')](_0x7fdce7);if(_0x57e3ea[_0x5df5('0x57')]>0x0){return _0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x57e3ea,_0x5df5('0x19'))[_0x5df5('0x13')](',\x20')));}var _0x95e12=_[_0x5df5('0x62')](_0x289af4['channels'],{'uniqueid':_0x7fdce7[_0x5df5('0x5e')]});if(_0x95e12){return BPromise[_0x5df5('0x6b')]()[_0x5df5('0x18')](function(){if(_0x95e12[_0x5df5('0x5c')]){return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x6c'),'channel':_0x95e12[_0x5df5('0x5c')],'mixmonitorid':_0x7fdce7[_0x5df5('0x67')]})[_0x5df5('0x1a')](function(_0xf3e0ac){});}})[_0x5df5('0x18')](function(){if(_0x95e12[_0x5df5('0x6d')]){return ami['Action']({'action':_0x5df5('0x6c'),'channel':_0x95e12[_0x5df5('0x6d')],'mixmonitorid':_0x7fdce7['mixmonitorid']})[_0x5df5('0x1a')](function(_0x24702a){});}})[_0x5df5('0x18')](function(_0x26e2aa){var _0x5137fb=_[_0x5df5('0x62')](_0x95e12[_0x5df5('0x66')],{'mixmonitorid':_0x7fdce7['mixmonitorid']});if(_0x5137fb){_0x5137fb['status']=_0x5df5('0x6e');}})[_0x5df5('0x18')](function(){var _0x9e61ef=util['format']('%s.%s',_0x7fdce7[_0x5df5('0x5d')]||_0x7fdce7[_0x5df5('0x5e')],_0x7fdce7['format']||_0x5df5('0x5f'));var _0x1b3785=_[_0x5df5('0x62')](_0x95e12[_0x5df5('0x66')],{'filename':_0x5df5('0x63')+_0x9e61ef['toLowerCase']()});if(_0x1b3785){_0x1b3785[_0x5df5('0x69')]=_0x5df5('0x6e');}})[_0x5df5('0x18')](function(){_0x9a168c({'code':0xc8,'message':[_0x7fdce7[_0x5df5('0x5e')],'StopMixMonitor\x20Success'][_0x5df5('0x13')]('\x20')});})['catch'](function(_0x10f893){_0x4672c5(_0x2e6d4d[_0x5df5('0x1b')](0x1f5,[_0x7fdce7['uniqueid'],_0x10f893[_0x5df5('0x19')]['toLowerCase']()][_0x5df5('0x13')]('\x20')));});}else{return _0x4672c5(_0x2e6d4d['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannels':function(_0x3b8aaf){return new Promise(function(_0x37a40c,_0x21332d){var _0x2a90aa=_[_0x5df5('0x70')](_0x289af4['queueChannels']);_0x37a40c({'count':_0x2a90aa[_0x5df5('0x57')],'rows':_0x2a90aa});});},'VoiceQueuesChannel':function(_0x643ee9){var _0x30a019=this;return new Promise(function(_0x554de4,_0x33c7d7){var _0x32114d=schema(properties[_0x5df5('0x71')])[_0x5df5('0x2')](_0x643ee9);if(_0x32114d[_0x5df5('0x57')]>0x0){return _0x33c7d7(_0x30a019[_0x5df5('0x1b')](0x1f4,_['map'](_0x32114d,'message')[_0x5df5('0x13')](',\x20')));}var _0x23159c=_[_0x5df5('0x62')](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x643ee9[_0x5df5('0x5e')]});if(_0x23159c){_0x554de4(_0x23159c);}else{return _0x33c7d7(_0x30a019['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x2cf2d1){var _0x14e068=this;return new Promise(function(_0x54e5e0,_0x247022){if(ami[_0x5df5('0xf')]()==![]){return _0x247022(_0x14e068[_0x5df5('0x1b')](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],_0x5df5('0x12')][_0x5df5('0x13')]('\x20')));}var _0x2675cc=schema(properties['voicequeuechannelhangup'])[_0x5df5('0x2')](_0x2cf2d1);if(_0x2675cc[_0x5df5('0x57')]>0x0){return _0x247022(_0x14e068[_0x5df5('0x1b')](0x1f4,_['map'](_0x2675cc,_0x5df5('0x19'))[_0x5df5('0x13')](',\x20')));}var _0x49f2da=_[_0x5df5('0x62')](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x2cf2d1[_0x5df5('0x5e')]});if(_0x49f2da&&_0x49f2da['channel']){return ami[_0x5df5('0x1d')]({'action':'Hangup','channel':_0x49f2da[_0x5df5('0x5c')]})[_0x5df5('0x18')](function(_0x17c836){_0x54e5e0({'code':0xc8,'message':[_0x2cf2d1[_0x5df5('0x5e')],_0x17c836[_0x5df5('0x19')][_0x5df5('0x64')]()]['join']('\x20')});})[_0x5df5('0x1a')](function(_0x7b85c6){_0x247022(_0x14e068['error'](0x1f5,[_0x2cf2d1[_0x5df5('0x5e')],_0x7b85c6['message']['toLowerCase']()][_0x5df5('0x13')]('\x20')));});}else{return _0x247022(_0x14e068['error'](0x1f5,_0x5df5('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x19c839){var _0x311dc0=this;return new Promise(function(_0x1f3f81,_0x453238){if(ami[_0x5df5('0xf')]()==![]){return _0x453238(_0x311dc0['error'](0x1f4,[config[_0x5df5('0x10')]['ip'],config[_0x5df5('0x10')][_0x5df5('0x11')],'ami\x20disconnected'][_0x5df5('0x13')]('\x20')));}var _0x2d065b=schema(properties['voicequeuechannelredirect'])[_0x5df5('0x2')](_0x19c839);if(_0x2d065b[_0x5df5('0x57')]>0x0){return _0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f4,_[_0x5df5('0x5a')](_0x2d065b,_0x5df5('0x19'))['join'](',\x20')));}var _0x2e2830=_['find'](_0x289af4[_0x5df5('0x72')],{'uniqueid':_0x19c839['uniqueid']});if(_0x2e2830&&_0x2e2830[_0x5df5('0x5c')]){return ami[_0x5df5('0x1d')]({'action':_0x5df5('0x73'),'channel':_0x2e2830[_0x5df5('0x5c')],'exten':_0x19c839[_0x5df5('0x74')],'context':_0x19c839['context']||_0x2e2830['context'],'priority':0x1})[_0x5df5('0x18')](function(_0x179b78){_0x1f3f81({'code':0xc8,'message':[_0x19c839[_0x5df5('0x5e')],_0x179b78[_0x5df5('0x19')][_0x5df5('0x64')]()]['join']('\x20')});})[_0x5df5('0x1a')](function(_0xdceef4){_0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f5,[_0x19c839[_0x5df5('0x5e')],_0xdceef4[_0x5df5('0x19')][_0x5df5('0x64')]()][_0x5df5('0x13')]('\x20')));});}else{return _0x453238(_0x311dc0[_0x5df5('0x1b')](0x1f5,_0x5df5('0x6f')));}});},'Agents':function(_0x285281){return new Promise(function(_0x1bff6c,_0x535fee){var _0x581a59=_['values'](_0x289af4[_0x5df5('0xb')]);_0x1bff6c({'count':_0x581a59[_0x5df5('0x57')],'rows':_0x581a59});});},'Telephones':function(_0x496790){return new Promise(function(_0x1bb992,_0x11bb45){var _0x1e1d34=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x75')]);_0x1bb992({'count':_0x1e1d34[_0x5df5('0x57')],'rows':_0x1e1d34});});},'Trunks':function(_0x36d8ee){return new Promise(function(_0x4f8f84,_0x331afb){var _0x36c355=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x76')]);_0x4f8f84({'count':_0x36c355[_0x5df5('0x57')],'rows':_0x36c355});});},'OutboundChannels':function(_0x259f6a){return new Promise(function(_0x3d8c32,_0x535fe6){var _0x34dd22=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x77')]);_0x3d8c32({'count':_0x34dd22[_0x5df5('0x57')],'rows':_0x34dd22});});},'Outbound':function(_0x24b27c){return new Promise(function(_0x41110a,_0x226636){_0x41110a(_0x289af4[_0x5df5('0x78')]);});},'Campaigns':function(_0x523a89){return new Promise(function(_0x4594d2,_0x2a1916){var _0x508bc6=_[_0x5df5('0x70')](_0x289af4[_0x5df5('0x79')]);_0x4594d2({'count':_0x508bc6[_0x5df5('0x57')],'rows':_0x508bc6});});},'VoiceQueuesPreview':function(_0x25229d){var _0x177b00=this;return new Promise(function(_0x5907b8,_0x19d854){_0x417341[_0x5df5('0x7a')](_0x25229d['id'])[_0x5df5('0x18')](function(_0x4cb7d9){_0x5907b8({'code':0xc8,'message':_0x4cb7d9['message']});})[_0x5df5('0x1a')](function(_0x3f0579){_0x19d854(_0x177b00[_0x5df5('0x1b')](0x1f4,_0x3f0579[_0x5df5('0x19')]));});});},'EventManager':function(_0x19d901){var _0x2a4fef=this;return new Promise(function(_0x584a16,_0x53217e){if(!_0x19d901['event']){return _0x53217e(_0x2a4fef[_0x5df5('0x1b')](0x1f4,_0x5df5('0x7b')));}ami[_0x5df5('0x7c')]('custom:'+_0x19d901[_0x5df5('0x7d')],_0x19d901['message']);_0x584a16({'code':0xc8,'message':_0x19d901});});},'FaxAccounts':function(_0xc53f8d){return new Promise(function(_0x172f01,_0x530de6){var _0x18281b=_[_0x5df5('0x70')](_0x289af4['faxAccounts']);_0x172f01({'count':_0x18281b[_0x5df5('0x57')],'rows':_0x18281b});});},'SendFax':function(_0x19a281){var _0x4367f5=this;return new Promise(function(_0x9fffdb,_0x5372c8){_0x27ec86['send'](_0x19a281)[_0x5df5('0x18')](function(_0x2484ee){_0x9fffdb({'code':0xc8,'message':_0x2484ee[_0x5df5('0x19')]});})['catch'](function(_0x30231a){_0x5372c8(_0x4367f5[_0x5df5('0x1b')](0x1f4,_0x30231a[_0x5df5('0x19')]));});});},'CheckAfterSend':function(_0xfa3cde){var _0x8be225=this;return new Promise(function(_0x5857a1,_0x6b6ddb){_0x27ec86[_0x5df5('0x7e')](_0xfa3cde)[_0x5df5('0x18')](function(_0x10a013){_0x5857a1({'code':0xc8,'message':_0x10a013[_0x5df5('0x19')]});})[_0x5df5('0x1a')](function(_0x2683ec){_0x6b6ddb(_0x8be225[_0x5df5('0x1b')](0x1f4,_0x2683ec[_0x5df5('0x19')]));});});}};var _0x3eb955=jayson['server'](_0x2b7ed9)[_0x5df5('0x7f')]();_0x3eb955['on'](_0x5df5('0x1b'),function(_0x4efacf){return _0x9b8756(_0x4efacf);});_0x3eb955[_0x5df5('0x80')](0x232a,_0x5df5('0x81'),function(){console['log'](_0x5df5('0x82'),0x232a);return _0x476e21(_0x5df5('0x83')+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 2e4354a..2067273 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 _0x75dc=['name','toLowerCase','merge','lodash','bluebird','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','format','user:%s'];(function(_0x101bb8,_0x29c087){var _0x302b9a=function(_0x4251e6){while(--_0x4251e6){_0x101bb8['push'](_0x101bb8['shift']());}};_0x302b9a(++_0x29c087);}(_0x75dc,0x1d7));var _0xc75d=function(_0x3918a3,_0x3e3db8){_0x3918a3=_0x3918a3-0x0;var _0x4f252f=_0x75dc[_0x3918a3];return _0x4f252f;};'use strict';var _=require(_0xc75d('0x0'));var BPromise=require(_0xc75d('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xc75d('0x2'))(_0xc75d('0x3'));var cmContactRpc=require(_0xc75d('0x4'));config[_0xc75d('0x5')]=_[_0xc75d('0x6')](config[_0xc75d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc75d('0x7'))(new Redis(config[_0xc75d('0x5')]));function emit(_0x928edc,_0x5d75a9,_0x1ed94f,_0x182591,_0x645b48){logger[_0xc75d('0x8')]('[CM][%s][%s]',_0x928edc,_0x5d75a9['id'],_0x1ed94f,_0x182591,JSON[_0xc75d('0x9')](_0x645b48));io['to'](_0x1ed94f)['emit'](_0x182591,_0x645b48);}exports['exec']=function(_0x3d0ac4,_0x2deb8b,_0x2b6fee,_0x431843){var _0x496a6f,_0x1cadf6;var _0x10cac9={};var _0x34aeb4;var _0x1b0911=Number(_0x2b6fee[_0xc75d('0xa')]);var _0x2521fd=_0x2b6fee[_0xc75d('0xb')]?Boolean(Number(_0x2b6fee['data2'])):![];var _0x46228e;var _0x2313be=![];if(!_[_0xc75d('0xc')](_0x2b6fee[_0xc75d('0xd')])){if(_0x2b6fee['data5']=='1')_0x2313be=!![];}if(!_0x2313be){if(_0x431843['xmd-contactid']){_0x10cac9['id']=_0x431843[_0xc75d('0xe')];}}if(!_0x10cac9['id']){_0x10cac9[_0xc75d('0xf')]=_0x1b0911;_0x46228e=_0x2b6fee[_0xc75d('0x10')]&&_0x2b6fee[_0xc75d('0x10')]!=='0'?_0x2b6fee[_0xc75d('0x10')][_0xc75d('0x11')](','):[_0xc75d('0x12')];_0x10cac9['$or']=_[_0xc75d('0x13')](_0x46228e,function(_0x1fe446){var _0x2d8aeb={};_0x2d8aeb[_0x1fe446]=_0x431843[_0xc75d('0x14')]?_0x431843[_0xc75d('0x15')]:_0x431843['calleridnum'];return _0x2d8aeb;});_0x34aeb4=_0x431843[_0xc75d('0x14')]?_0x431843['destcalleridnum']:_0x431843['calleridnum'];}var _0x3933c5=['id',_0xc75d('0x16'),_0xc75d('0x17'),_0xc75d('0x12'),_0xc75d('0x18'),'fax',_0xc75d('0xf'),_0xc75d('0x19'),_0xc75d('0x1a'),_0xc75d('0x1b')];var _0x1ae4e9=_[_0xc75d('0x1c')](_0x3933c5,_0x46228e);BPromise[_0xc75d('0x1d')]()[_0xc75d('0x1e')](cmContactRpc['getContacts']({'attributes':_0x1ae4e9,'where':_0x10cac9,'phone':_0x34aeb4}))[_0xc75d('0x1e')](function(_0x296456){_0x1cadf6=_0x296456;if(!_[_0xc75d('0x1f')](_0x1cadf6)){if(_0x1cadf6[_0xc75d('0x20')]===0x1){_0x496a6f=_0x1cadf6[0x0];logger['info'](_0xc75d('0x21'),_0x431843[_0xc75d('0x22')],_0x2deb8b['id'],_0x496a6f['id']);}else{logger[_0xc75d('0x8')](_0xc75d('0x23'),_0x431843[_0xc75d('0x22')],_0x2deb8b['id'],_[_0xc75d('0x13')](_0x1cadf6,'id')['join'](','));}return;}else{logger[_0xc75d('0x8')](_0xc75d('0x24'),_0x431843['uniqueid'],_0x2deb8b['id']);var _0x4dcda0={'ListId':_0x1b0911};var _0x4b5c88=_0x2b6fee[_0xc75d('0x25')]&&_0x2b6fee[_0xc75d('0x25')]!=='0'?_0x2b6fee[_0xc75d('0x25')]:_0xc75d('0x12');if(_0x2521fd){logger[_0xc75d('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x431843['uniqueid'],_0x2deb8b['id']);_0x4dcda0[_0x4b5c88]=_[_0xc75d('0xc')](_0x431843[_0xc75d('0x14')])?_0x431843['calleridnum']:_0x431843[_0xc75d('0x15')];if(_[_0xc75d('0xc')](_0x431843[_0xc75d('0x14')])){_0x4dcda0[_0xc75d('0x16')]=_0x431843['calleridname']&&_0x431843[_0xc75d('0x26')]!==_0xc75d('0x27')?_0x431843[_0xc75d('0x26')]:'Unknown';}else{_0x4dcda0['firstName']=_0x431843[_0xc75d('0x28')]&&_0x431843[_0xc75d('0x28')]!==''?_0x431843[_0xc75d('0x28')]:_0xc75d('0x29');}return BPromise[_0xc75d('0x1d')]()[_0xc75d('0x1e')](cmContactRpc[_0xc75d('0x2a')](_0x4dcda0))[_0xc75d('0x1e')](function(_0x38e86a){_0x496a6f=_0x38e86a;_0x1cadf6[_0xc75d('0x2b')](_0x38e86a);if(_0x496a6f){logger[_0xc75d('0x8')](_0xc75d('0x2c'),_0x431843[_0xc75d('0x22')],_0x2deb8b['id'],_0x496a6f['id']);}return;});}else{logger[_0xc75d('0x8')](_0xc75d('0x2d'),_0x431843['uniqueid'],_0x2deb8b['id']);_0x4dcda0[_0x4b5c88]=_[_0xc75d('0xc')](_0x431843[_0xc75d('0x14')])?_0x431843[_0xc75d('0x2e')]:_0x431843[_0xc75d('0x15')];if(_['isNil'](_0x431843[_0xc75d('0x14')])){_0x4dcda0[_0xc75d('0x16')]=_0x431843[_0xc75d('0x26')]&&_0x431843['calleridname']!==''?_0x431843['calleridname']:'Unknown';}else{_0x4dcda0[_0xc75d('0x16')]=_0x431843[_0xc75d('0x28')]&&_0x431843['destcalleridname']!==_0xc75d('0x27')?_0x431843[_0xc75d('0x28')]:_0xc75d('0x29');}_0x496a6f=_0x4dcda0;_0x1cadf6[_0xc75d('0x2b')](_0x4dcda0);return;}}})[_0xc75d('0x1e')](function(){if(_0x3d0ac4){emit(_0x431843[_0xc75d('0x22')],_0x2deb8b,util[_0xc75d('0x2f')](_0xc75d('0x30'),_0x3d0ac4[_0xc75d('0x31')]),util[_0xc75d('0x2f')]('trigger:%s',_0x2b6fee['action'][_0xc75d('0x32')]()),{'evt':_[_0xc75d('0x33')](_0x431843,{'autoCreate':_0x2521fd}),'contact':_0x496a6f===undefined?{}:_0x496a6f,'contacts':_0x1cadf6[_0xc75d('0x20')]===0x0?undefined:_0x1cadf6});}});}; \ No newline at end of file +var _0xc217=['[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s'];(function(_0x4fefe0,_0x1e4b1f){var _0xd9c6f=function(_0x59f41e){while(--_0x59f41e){_0x4fefe0['push'](_0x4fefe0['shift']());}};_0xd9c6f(++_0x1e4b1f);}(_0xc217,0x15d));var _0x7c21=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xc217[_0x249d99];return _0x5bfb05;};'use strict';var _=require(_0x7c21('0x0'));var BPromise=require('bluebird');var Redis=require(_0x7c21('0x1'));var util=require(_0x7c21('0x2'));var config=require(_0x7c21('0x3'));var logger=require(_0x7c21('0x4'))(_0x7c21('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x7c21('0x6')]=_[_0x7c21('0x7')](config[_0x7c21('0x6')],{'host':_0x7c21('0x8'),'port':0x18eb});var io=require(_0x7c21('0x9'))(new Redis(config[_0x7c21('0x6')]));function emit(_0x9a0f8b,_0x4fa730,_0x121d33,_0x126810,_0x5e118c){logger[_0x7c21('0xa')](_0x7c21('0xb'),_0x9a0f8b,_0x4fa730['id'],_0x121d33,_0x126810,JSON[_0x7c21('0xc')](_0x5e118c));io['to'](_0x121d33)[_0x7c21('0xd')](_0x126810,_0x5e118c);}exports[_0x7c21('0xe')]=function(_0x4140dc,_0x220fef,_0x548176,_0x45408d){var _0x4e335a,_0x1e4a9d;var _0x4fe98e={};var _0x1b896e;var _0xd0793c=Number(_0x548176[_0x7c21('0xf')]);var _0x299185=_0x548176[_0x7c21('0x10')]?Boolean(Number(_0x548176[_0x7c21('0x10')])):![];var _0x4a665d;var _0x213c67=![];if(!_[_0x7c21('0x11')](_0x548176[_0x7c21('0x12')])){if(_0x548176[_0x7c21('0x12')]=='1')_0x213c67=!![];}if(!_0x213c67){if(_0x45408d['xmd-contactid']){_0x4fe98e['id']=_0x45408d[_0x7c21('0x13')];}}if(!_0x4fe98e['id']){_0x4fe98e[_0x7c21('0x14')]=_0xd0793c;_0x4a665d=_0x548176[_0x7c21('0x15')]&&_0x548176[_0x7c21('0x15')]!=='0'?_0x548176[_0x7c21('0x15')][_0x7c21('0x16')](','):['phone'];_0x4fe98e[_0x7c21('0x17')]=_['map'](_0x4a665d,function(_0x1eb3b9){var _0x15ee11={};_0x15ee11[_0x1eb3b9]=_0x45408d[_0x7c21('0x18')]?_0x45408d['destcalleridnum']:_0x45408d[_0x7c21('0x19')];return _0x15ee11;});_0x1b896e=_0x45408d[_0x7c21('0x18')]?_0x45408d[_0x7c21('0x1a')]:_0x45408d[_0x7c21('0x19')];}var _0x369b07=['id',_0x7c21('0x1b'),_0x7c21('0x1c'),_0x7c21('0x1d'),'mobile','fax',_0x7c21('0x14'),'createdAt',_0x7c21('0x1e'),_0x7c21('0x1f')];var _0x2da528=_['union'](_0x369b07,_0x4a665d);BPromise[_0x7c21('0x20')]()[_0x7c21('0x21')](cmContactRpc[_0x7c21('0x22')]({'attributes':_0x2da528,'where':_0x4fe98e,'phone':_0x1b896e}))[_0x7c21('0x21')](function(_0x5288c2){_0x1e4a9d=_0x5288c2;if(!_[_0x7c21('0x23')](_0x1e4a9d)){if(_0x1e4a9d[_0x7c21('0x24')]===0x1){_0x4e335a=_0x1e4a9d[0x0];logger[_0x7c21('0xa')](_0x7c21('0x25'),_0x45408d[_0x7c21('0x26')],_0x220fef['id'],_0x4e335a['id']);}else{logger['info'](_0x7c21('0x27'),_0x45408d[_0x7c21('0x26')],_0x220fef['id'],_[_0x7c21('0x28')](_0x1e4a9d,'id')['join'](','));}return;}else{logger[_0x7c21('0xa')](_0x7c21('0x29'),_0x45408d[_0x7c21('0x26')],_0x220fef['id']);var _0x58a17c={'ListId':_0xd0793c};var _0x5d043e=_0x548176[_0x7c21('0x2a')]&&_0x548176[_0x7c21('0x2a')]!=='0'?_0x548176[_0x7c21('0x2a')]:_0x7c21('0x1d');if(_0x299185){logger[_0x7c21('0xa')](_0x7c21('0x2b'),_0x45408d[_0x7c21('0x26')],_0x220fef['id']);_0x58a17c[_0x5d043e]=_['isNil'](_0x45408d[_0x7c21('0x18')])?_0x45408d[_0x7c21('0x19')]:_0x45408d['destcalleridnum'];if(_['isNil'](_0x45408d[_0x7c21('0x18')])){_0x58a17c[_0x7c21('0x1b')]=_0x45408d[_0x7c21('0x2c')]&&_0x45408d[_0x7c21('0x2c')]!==''?_0x45408d[_0x7c21('0x2c')]:_0x7c21('0x2d');}else{_0x58a17c[_0x7c21('0x1b')]=_0x45408d[_0x7c21('0x2e')]&&_0x45408d['destcalleridname']!==_0x7c21('0x2f')?_0x45408d['destcalleridname']:_0x7c21('0x2d');}return BPromise['resolve']()[_0x7c21('0x21')](cmContactRpc['createContact'](_0x58a17c))[_0x7c21('0x21')](function(_0xbaef1d){_0x4e335a=_0xbaef1d;_0x1e4a9d[_0x7c21('0x30')](_0xbaef1d);if(_0x4e335a){logger[_0x7c21('0xa')](_0x7c21('0x31'),_0x45408d[_0x7c21('0x26')],_0x220fef['id'],_0x4e335a['id']);}return;});}else{logger['info'](_0x7c21('0x32'),_0x45408d[_0x7c21('0x26')],_0x220fef['id']);_0x58a17c[_0x5d043e]=_['isNil'](_0x45408d[_0x7c21('0x18')])?_0x45408d[_0x7c21('0x19')]:_0x45408d[_0x7c21('0x1a')];if(_[_0x7c21('0x11')](_0x45408d[_0x7c21('0x18')])){_0x58a17c['firstName']=_0x45408d[_0x7c21('0x2c')]&&_0x45408d[_0x7c21('0x2c')]!==_0x7c21('0x2f')?_0x45408d[_0x7c21('0x2c')]:_0x7c21('0x2d');}else{_0x58a17c['firstName']=_0x45408d[_0x7c21('0x2e')]&&_0x45408d[_0x7c21('0x2e')]!==''?_0x45408d[_0x7c21('0x2e')]:_0x7c21('0x2d');}_0x4e335a=_0x58a17c;_0x1e4a9d[_0x7c21('0x30')](_0x58a17c);return;}}})[_0x7c21('0x21')](function(){if(_0x4140dc){emit(_0x45408d[_0x7c21('0x26')],_0x220fef,util['format'](_0x7c21('0x33'),_0x4140dc[_0x7c21('0x34')]),util[_0x7c21('0x35')]('trigger:%s',_0x548176[_0x7c21('0x36')][_0x7c21('0x37')]()),{'evt':_[_0x7c21('0x38')](_0x45408d,{'autoCreate':_0x299185}),'contact':_0x4e335a===undefined?{}:_0x4e335a,'contacts':_0x1e4a9d[_0x7c21('0x24')]===0x0?undefined:_0x1e4a9d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a6092ae..7a2a66f 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 _0xc6ac=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zendeskAccounts','deskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:offlineMessage','prototype','info','emit','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','html','data2','render','template\x20not\x20found','isNil','data3','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','replace','channel','AllConditions','every','checkConditions','some','AnyConditions','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','value','event','agent','membername','lastevent','mailSubstatus','null','offlineMessage','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts'];(function(_0x5a44eb,_0x25e6e5){var _0x3b51e6=function(_0x5c9280){while(--_0x5c9280){_0x5a44eb['push'](_0x5a44eb['shift']());}};_0x3b51e6(++_0x25e6e5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x20b9f9,_0x1bf73d){_0x20b9f9=_0x20b9f9-0x0;var _0x503ff5=_0xc6ac[_0x20b9f9];return _0x503ff5;};'use strict';var util=require(_0xcc6a('0x0'));var _=require(_0xcc6a('0x1'));var url=require(_0xcc6a('0x2'));var Mustache=require(_0xcc6a('0x3'));var Redis=require(_0xcc6a('0x4'));var urlforward=require(_0xcc6a('0x5'));var integration=require(_0xcc6a('0x6'));var cmContact=require(_0xcc6a('0x7'));var script=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var logger=require(_0xcc6a('0xa'))(_0xcc6a('0xb'));var ami=require(_0xcc6a('0xc'));config[_0xcc6a('0xd')]=_['defaults'](config[_0xcc6a('0xd')],{'host':_0xcc6a('0xe'),'port':0x18eb});var io=require(_0xcc6a('0xf'))(new Redis(config['redis']));var operators={'equals':function(_0x43e3bf,_0x210f63){return _0x43e3bf==_0x210f63;},'not_equals':function(_0x7806a0,_0x463ebb){return _0x7806a0!=_0x463ebb;}};var barAndWebActions=[_0xcc6a('0x10'),'url',_0xcc6a('0x11')];function Trigger(_0x290119){this[_0xcc6a('0x12')]=_0x290119['triggers'];this[_0xcc6a('0x13')]=_0x290119[_0xcc6a('0x13')];this[_0xcc6a('0x14')]=_0x290119['voiceQueues'];this['templates']=_0x290119[_0xcc6a('0x15')];this[_0xcc6a('0x16')]=_0x290119[_0xcc6a('0x16')];this['zendeskAccounts']=_0x290119['zendeskAccounts'];this[_0xcc6a('0x17')]=_0x290119[_0xcc6a('0x17')];this[_0xcc6a('0x18')]=_0x290119[_0xcc6a('0x18')];this[_0xcc6a('0x19')]=_0x290119[_0xcc6a('0x19')];this[_0xcc6a('0x1a')]=_0x290119[_0xcc6a('0x1a')];this['deskAccounts']=_0x290119['deskAccounts'];this['vtigerAccounts']=_0x290119[_0xcc6a('0x1b')];this[_0xcc6a('0x1c')]=_0x290119[_0xcc6a('0x1c')];this[_0xcc6a('0x1d')]=_0x290119[_0xcc6a('0x1d')];this[_0xcc6a('0x1e')]=_0x290119[_0xcc6a('0x1e')];this[_0xcc6a('0x1f')]={'zendesk':this[_0xcc6a('0x20')],'salesforce':this[_0xcc6a('0x18')],'freshdesk':this[_0xcc6a('0x17')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xcc6a('0x1a')],'desk':this[_0xcc6a('0x21')],'vtiger':this[_0xcc6a('0x1b')],'dynamics365':this[_0xcc6a('0x1d')],'freshsales':this[_0xcc6a('0x1e')],'servicenow':this[_0xcc6a('0x1c')]};ami['on'](_0xcc6a('0x22'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x25'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on']('custom:agentringnoanswer',this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x26'),this['syncCustomEvent'][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x27'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x28'),this[_0xcc6a('0x23')]['bind'](this));ami['on'](_0xcc6a('0x29'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on']('custom:agentcongestion',this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on']('custom:agentreject',this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x2a'),this[_0xcc6a('0x23')]['bind'](this));ami['on'](_0xcc6a('0x2b'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on']('custom:timeout',this[_0xcc6a('0x23')]['bind'](this));ami['on']('custom:dialbegin',this[_0xcc6a('0x2c')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x2d'),this[_0xcc6a('0x2c')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x2e'),this['syncAgentDial'][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x2f'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x30'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x31'),this['syncCustomEvent'][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x32'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x33'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));ami['on']('custom:acceptmessage',this[_0xcc6a('0x23')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xcc6a('0x24')](this));ami['on'](_0xcc6a('0x34'),this[_0xcc6a('0x23')][_0xcc6a('0x24')](this));}Trigger[_0xcc6a('0x35')]['emit']=function(_0x58f6ee,_0x10f47d,_0x11173a){logger[_0xcc6a('0x36')](_0x58f6ee,_0x10f47d,JSON['stringify'](_0x11173a));io['to'](_0x58f6ee)[_0xcc6a('0x37')](_0x10f47d,_0x11173a);};Trigger[_0xcc6a('0x35')][_0xcc6a('0x23')]=function(_0xa326b2){var _0x73bf0d=_[_0xcc6a('0x38')](_0xa326b2);if(typeof _0x73bf0d[_0xcc6a('0x39')]===_0xcc6a('0x3a')){_0x73bf0d[_0xcc6a('0x39')]=_0xcc6a('0x3b');}this[_0xcc6a('0x3c')](_0x73bf0d);};Trigger[_0xcc6a('0x35')][_0xcc6a('0x2c')]=function(_0x349f07){if(this[_0xcc6a('0x13')][_0x349f07[_0xcc6a('0x3d')]]){this[_0xcc6a('0x23')](_0x349f07);}};Trigger[_0xcc6a('0x35')]['checkTriggers']=function(_0x553e66){var _0x1d3e45;for(var _0x42d7af in this[_0xcc6a('0x12')]){if(this[_0xcc6a('0x12')][_0xcc6a('0x3e')](_0x42d7af)){if(this[_0xcc6a('0x12')][_0x42d7af][_0xcc6a('0x3f')]){_0x1d3e45=this[_0xcc6a('0x40')](this['triggers'][_0x42d7af],_0x553e66);if(_0x1d3e45){_['merge'](_0x553e66,_0x553e66[_0xcc6a('0x41')]);for(var _0x4a4c4d=0x0,_0x578525,_0x5cf1ba,_0x674e04;_0x4a4c4d0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x6bc67c,_0x3566fd){var _0x55e73e=function(_0x380d89){while(--_0x380d89){_0x6bc67c['push'](_0x6bc67c['shift']());}};_0x55e73e(++_0x3566fd);}(_0x55ca,0x126));var _0xa55c=function(_0x5aa023,_0x1cf1d2){_0x5aa023=_0x5aa023-0x0;var _0x31ceb5=_0x55ca[_0x5aa023];return _0x31ceb5;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5c06d8b..cb2f924 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 _0xbfe6=['access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','value','telephone1','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','lodash','request-promise','util','md5','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','resolve','POST','clientId','username','password','clientSecret','then'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0xbfe6,0x112));var _0x6bfe=function(_0x42f6b1,_0x560c04){_0x42f6b1=_0x42f6b1-0x0;var _0x39b69f=_0xbfe6[_0x42f6b1];return _0x39b69f;};'use strict';var _=require(_0x6bfe('0x0'));var rp=require(_0x6bfe('0x1'));var util=require(_0x6bfe('0x2'));var intUtil=require('./util');var md5=require(_0x6bfe('0x3'));var Redis=require('ioredis');var logger=require(_0x6bfe('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0x6bfe('0x5')]=_[_0x6bfe('0x6')](config[_0x6bfe('0x5')],{'host':_0x6bfe('0x7'),'port':0x18eb});var io=require(_0x6bfe('0x8'))(new Redis(config[_0x6bfe('0x5')]));function getAuthToken(_0x19b9b3,_0x2d08b5,_0x4b6d28){if(_0x19b9b3[_0x6bfe('0x9')]){_0x19b9b3['remoteUri']=_0x19b9b3[_0x6bfe('0xa')][_0x6bfe('0xb')];_0x19b9b3['tenantId']=_0x19b9b3[_0x6bfe('0xa')][_0x6bfe('0xc')];return Promise[_0x6bfe('0xd')](_0x19b9b3[_0x6bfe('0xa')]['data5']);}var _0x11e21b={'method':_0x6bfe('0xe'),'uri':_0x2d08b5,'form':{'client_id':_0x19b9b3[_0x6bfe('0xf')],'resource':_0x19b9b3['remoteUri'],'username':_0x19b9b3[_0x6bfe('0x10')],'password':_0x19b9b3['password'],'grant_type':_0x6bfe('0x11'),'client_secret':_0x19b9b3[_0x6bfe('0x12')]},'json':!![]};return rp(_0x11e21b)[_0x6bfe('0x13')](function(_0x36a627){return _0x36a627[_0x6bfe('0x14')];})[_0x6bfe('0x15')](function(_0x2c586a){logger['error']('['+[_0x4b6d28[_0x6bfe('0x16')]()]+']\x20Wrong\x20credentials!');return _0x2c586a[_0x6bfe('0x17')];});}function getUser(_0xa9e1ef,_0x3ca416,_0x32ad2b,_0x92f993,_0x4aa9f6,_0x27c878){return new Promise(function(_0x1380a4,_0x1ad6f3){return getAuthToken(_0x3ca416,_0x92f993,_0x27c878)[_0x6bfe('0x13')](function(_0x5a0087){var _0x1c2070={'method':_0x6bfe('0x18'),'uri':_0x4aa9f6+_0x6bfe('0x19'),'headers':{'Authorization':_0x6bfe('0x1a')+_0x5a0087,'OData-Version':_0x6bfe('0x1b')},'json':!![]};return rp(_0x1c2070);})[_0x6bfe('0x13')](function(_0x2aaa41){var _0x45a4bb=_0x2aaa41['value'];var _0x386430=![];var _0x40730e=null;if(!_[_0x6bfe('0x1c')](_0x32ad2b)){if(intUtil[_0x6bfe('0x1d')](_0x32ad2b[_0x6bfe('0x1e')])){_0xa9e1ef[_0x6bfe('0x1f')]=_0x32ad2b['email'];for(_0x40730e=0x0;_0x40730e<_0x45a4bb[_0x6bfe('0x20')];_0x40730e++){if(_0x45a4bb[_0x40730e][_0x6bfe('0x21')]===_0x32ad2b[_0x6bfe('0x1e')]&&!_0x45a4bb[_0x40730e][_0x6bfe('0x22')]){_0x386430=!![];logger[_0x6bfe('0x23')]('['+[_0x27c878['toUpperCase']()]+_0x6bfe('0x24')+_0x45a4bb[_0x40730e]['systemuserid']+'!');_0xa9e1ef[_0x6bfe('0x25')]=_0x45a4bb[_0x40730e]['systemuserid'];}}}}if(!_0x386430){logger[_0x6bfe('0x23')]('['+[_0x27c878[_0x6bfe('0x16')]()]+_0x6bfe('0x26'));_0xa9e1ef[_0x6bfe('0x1f')]=_0x3ca416[_0x6bfe('0x10')];for(_0x40730e=0x0;_0x40730e<_0x45a4bb['length'];_0x40730e++){if(_0x45a4bb[_0x40730e][_0x6bfe('0x21')]===_0x3ca416[_0x6bfe('0x10')]){_0xa9e1ef[_0x6bfe('0x25')]=_0x45a4bb[_0x40730e][_0x6bfe('0x27')];}}}_0x1380a4(_0xa9e1ef);})[_0x6bfe('0x15')](function(_0x684e5){_0x1ad6f3(_0x684e5['message']);});});}function createEndUser(_0x5c56f3,_0x4f7ee9,_0x4dac06,_0x8de068,_0x5cb0c7,_0x5b0f79){return new Promise(function(_0xfc3bf0,_0x43f220){return getAuthToken(_0x4f7ee9,_0x4dac06,_0x5b0f79)[_0x6bfe('0x13')](function(_0x5714c6){var _0x418db5=_0x5b0f79[_0x6bfe('0x28')]()===_0x6bfe('0x29')?_0x5cb0c7[_0x6bfe('0x2a')]:_0x5cb0c7['calleridnum'];var _0x243d45={'method':'POST','uri':_0x8de068+'contacts','body':{'telephone1':_0x418db5,'fullname':_0x418db5,'firstname':_0x418db5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6bfe('0x2b')+_0x5c56f3[_0x6bfe('0x25')]+')'},'headers':{'Authorization':_0x6bfe('0x1a')+_0x5714c6,'OData-Version':_0x6bfe('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x243d45);})[_0x6bfe('0x13')](function(_0x16217a){var _0x32e146=_0x16217a['headers'][_0x6bfe('0x2c')];var _0x11bdb8=_0x32e146[_0x6bfe('0x2d')](_0x32e146[_0x6bfe('0x2e')]('(')+0x1,_0x32e146['lastIndexOf'](')'));_0x5c56f3[_0x6bfe('0x2f')]=_0x11bdb8;_0xfc3bf0(_0x5c56f3);})['catch'](function(_0x7b4794){_0x43f220(_0x7b4794['message']);});});}function getEndUser(_0x266bc0,_0x248c3a,_0x1e3115,_0x115773,_0x162e8b,_0x499d2b,_0x30450e){var _0x5ea105=_0x499d2b[_0x6bfe('0x28')]()===_0x6bfe('0x29')?_0x162e8b[_0x6bfe('0x2a')]:_0x162e8b[_0x6bfe('0x30')];return getAuthToken(_0x248c3a,_0x1e3115,_0x499d2b)['then'](function(_0x2ac9c0){var _0x56fc5={'method':'GET','uri':_0x115773+_0x6bfe('0x31')+_0x5ea105['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x6bfe('0x1a')+_0x2ac9c0,'If-None-Match':null,'OData-Version':_0x6bfe('0x1b')},'json':!![]};return rp(_0x56fc5);})['then'](function(_0x504e3b){var _0x32d5aa=![];if(!_0x504e3b)return _0x32d5aa;var _0x5ced22=_0x504e3b[_0x6bfe('0x32')];for(var _0xbd7edc=0x0;_0xbd7edc<_0x5ced22[_0x6bfe('0x20')];_0xbd7edc++){if(_0x5ced22[_0xbd7edc][_0x6bfe('0x33')]===_0x5ea105){_0x32d5aa=!![];_0x266bc0[_0x6bfe('0x2f')]=_0x5ced22[_0xbd7edc][_0x6bfe('0x34')];}}return _0x32d5aa;})[_0x6bfe('0x13')](function(_0x441429){if(_0x441429)return _0x266bc0;if(_0x30450e==='nothing'){logger[_0x6bfe('0x23')]('['+[_0x499d2b['toUpperCase']()]+_0x6bfe('0x35'));return _0x266bc0;}return createEndUser(_0x266bc0,_0x248c3a,_0x1e3115,_0x115773,_0x162e8b,_0x499d2b)['then'](function(_0x1053eb){logger['info']('['+[_0x499d2b[_0x6bfe('0x16')]()]+_0x6bfe('0x36'),_0x1053eb[_0x6bfe('0x2f')]);return _0x1053eb;});});}function getCustomFields(_0x27c9f2,_0x3ef499,_0x297032){var _0x45ef6a={};if(_0x27c9f2[_0x6bfe('0x20')]>0x0){_[_0x6bfe('0x37')](_0x27c9f2,function(_0x487f99){if(_[_0x6bfe('0x38')]([_0x6bfe('0x39'),_0x6bfe('0x3a')],_0x487f99['type'])&&_0x487f99['nameField']&&!_0x487f99['customField']){var _0x19b8bd=_0x487f99[_0x6bfe('0x3b')][_0x6bfe('0x28')]();var _0x55dc82=_0x19b8bd[_0x6bfe('0x2d')](0x0,_0x19b8bd[_0x6bfe('0x3c')]('_'));var _0x410d5b=_0x19b8bd['substring'](_0x19b8bd[_0x6bfe('0x3c')]('_')+0x1);if(_0x55dc82===_0x297032){_0x45ef6a[_0x410d5b]=_0x487f99[_0x6bfe('0x3d')];}}});}return _0x45ef6a;}function getTicket(_0x7a70f8,_0x33dacb,_0x5c8fca,_0x50eb1e,_0x352678,_0x2858ef,_0x34049d){return new Promise(function(_0x157503,_0x4f5942){var _0x57f6d8;return getAuthToken(_0x33dacb,_0x5c8fca,_0x34049d)[_0x6bfe('0x13')](function(_0x511752){if(_0x2858ef[_0x6bfe('0x3e')]===_0x6bfe('0x3f')){_0x57f6d8={'method':_0x6bfe('0xe'),'uri':_0x50eb1e+_0x6bfe('0x40'),'body':Object[_0x6bfe('0x41')]({},{'title':intUtil['getString'](_0x2858ef['Subjects'],_0x352678,'\x20'),'description':intUtil[_0x6bfe('0x42')](_0x2858ef[_0x6bfe('0x43')],_0x352678,'\x0a'),'customerid_contact@odata.bind':_0x7a70f8[_0x6bfe('0x2f')]?_0x6bfe('0x44')+_0x7a70f8[_0x6bfe('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x7a70f8['userId']+')','caseorigincode':'1'},getCustomFields(_0x2858ef[_0x6bfe('0x45')],_0x352678,_0x2858ef['ticketType'])),'headers':{'Authorization':_0x6bfe('0x1a')+_0x511752,'OData-Version':_0x6bfe('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2858ef['ticketType']===_0x6bfe('0x46')){var _0x5bb467=_0x7a70f8[_0x6bfe('0x2f')]?[{'partyid_systemuser@odata.bind':_0x6bfe('0x2b')+_0x7a70f8[_0x6bfe('0x25')]+')','participationtypemask':_0x7a70f8[_0x6bfe('0x47')]===_0x6bfe('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x6bfe('0x44')+_0x7a70f8[_0x6bfe('0x2f')]+')','participationtypemask':_0x7a70f8['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6bfe('0x2b')+_0x7a70f8[_0x6bfe('0x25')]+')','participationtypemask':_0x7a70f8[_0x6bfe('0x47')]===_0x6bfe('0x48')?0x2:0x1}];_0x57f6d8={'method':_0x6bfe('0xe'),'uri':_0x50eb1e+_0x6bfe('0x49'),'body':Object[_0x6bfe('0x41')]({},{'subject':intUtil[_0x6bfe('0x42')](_0x2858ef[_0x6bfe('0x4a')],_0x352678,'\x20'),'phonenumber':String(_0x352678[_0x6bfe('0x30')]),'description':intUtil[_0x6bfe('0x42')](_0x2858ef['Descriptions'],_0x352678,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7a70f8[_0x6bfe('0x2f')]?_0x6bfe('0x44')+_0x7a70f8['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x7a70f8['userId']+')','directioncode':_0x7a70f8['callDirection']===_0x6bfe('0x48')?![]:!![],'phonecall_activity_parties':_0x5bb467},getCustomFields(_0x2858ef[_0x6bfe('0x45')],_0x352678,_0x2858ef[_0x6bfe('0x3e')])),'headers':{'Authorization':_0x6bfe('0x1a')+_0x511752,'OData-Version':_0x6bfe('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x57f6d8);})['then'](function(_0x5e641e){var _0x163207=_0x5e641e[_0x6bfe('0x4b')][_0x6bfe('0x2c')];var _0x44ea64=_0x163207['substring'](_0x163207[_0x6bfe('0x2e')]('(')+0x1,_0x163207[_0x6bfe('0x2e')](')'));_0x7a70f8[_0x6bfe('0x4c')]=_0x44ea64;_0x157503(_0x7a70f8);})['catch'](function(_0x24c35b){_0x4f5942(_0x24c35b[_0x6bfe('0x17')]);});});}function emit(_0x2c0096,_0x467a3d,_0x5dc733,_0x1a5d35){var _0x235230={'uri':util[_0x6bfe('0x4d')](_0x6bfe('0x4e'),_0x2c0096,_0x5dc733,_0x1a5d35)};io['to'](util[_0x6bfe('0x4d')](_0x6bfe('0x4f'),_0x467a3d))['emit'](_0x6bfe('0x50'),_0x235230);}exports['cs']=function(_0x56f4a9,_0x19091e,_0x24e06f,_0xc58ca6,_0x3b7cd0,_0x1aa923,_0x6d59d8,_0x34eb17){var _0x3d6965={};_0x1aa923[_0x6bfe('0x51')]=_0x1aa923[_0x6bfe('0x9')]?intUtil[_0x6bfe('0x52')](_0x1aa923[_0x6bfe('0xa')][_0x6bfe('0xb')]):intUtil[_0x6bfe('0x52')](_0x1aa923[_0x6bfe('0x51')]);_0x1aa923[_0x6bfe('0x53')]=intUtil[_0x6bfe('0x52')](_0x1aa923[_0x6bfe('0x53')]);_0x3d6965[_0x6bfe('0x47')]=_0x34eb17===_0x6bfe('0x48')||_0x34eb17===_0x6bfe('0x54')?_0x6bfe('0x48'):_0x6bfe('0x29');var _0x5918cf=_0x1aa923[_0x6bfe('0x9')]?util[_0x6bfe('0x4d')](_0x6bfe('0x55'),_0x1aa923[_0x6bfe('0xa')][_0x6bfe('0xb')]):util[_0x6bfe('0x4d')](_0x6bfe('0x55'),_0x1aa923[_0x6bfe('0x51')]);var _0x403200=util[_0x6bfe('0x4d')](_0x6bfe('0x56'),_0x1aa923['tenantId']);var _0x30eb8f=util[_0x6bfe('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1aa923['serverUrl'],_0x19091e[_0x6bfe('0x57')],md5(_0x19091e['uniqueid']));if(_0x3b7cd0&&_0x3b7cd0['monitor_format']){logger[_0x6bfe('0x23')]('[QUEUE]','Recording\x20is\x20enabled!');_0x19091e['recordingURL']=_0x30eb8f;}else if(_0x6d59d8&&_0x6d59d8['recordingFormat']&&_0x6d59d8['recordingFormat']!==_0x6bfe('0x58')){logger[_0x6bfe('0x23')](_0x6bfe('0x59'),_0x6bfe('0x5a'));_0x19091e[_0x6bfe('0x5b')]=_0x30eb8f;}else{_0x19091e[_0x6bfe('0x5b')]='';}return getUser(_0x3d6965,_0x1aa923,_0xc58ca6,_0x403200,_0x5918cf,_0x34eb17)[_0x6bfe('0x13')](function(_0x27c739){logger[_0x6bfe('0x23')]('['+_0x34eb17[_0x6bfe('0x16')]()+']\x20The\x20User\x20ID\x20is:',_0x27c739[_0x6bfe('0x25')]);logger['info']('['+_0x34eb17[_0x6bfe('0x16')]()+_0x6bfe('0x5c'),_0x27c739[_0x6bfe('0x1f')]);return getEndUser(_0x27c739,_0x1aa923,_0x403200,_0x5918cf,_0x19091e,_0x34eb17,_0x24e06f['moduleCreate']);})[_0x6bfe('0x13')](function(_0x51015a){logger[_0x6bfe('0x23')]('['+_0x34eb17['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x51015a[_0x6bfe('0x2f')]);logger[_0x6bfe('0x23')]('['+_0x34eb17['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x19091e[_0x6bfe('0x30')]);return getTicket(_0x51015a,_0x1aa923,_0x403200,_0x5918cf,_0x19091e,_0x24e06f,_0x34eb17);})[_0x6bfe('0x13')](function(_0x39f472){logger['info'](util[_0x6bfe('0x4d')]('['+_0x34eb17[_0x6bfe('0x16')]()+_0x6bfe('0x5d'),_0x24e06f['ticketType'],_0x39f472[_0x6bfe('0x4c')]));logger[_0x6bfe('0x23')](util[_0x6bfe('0x4d')]('['+_0x34eb17[_0x6bfe('0x16')]()+_0x6bfe('0x5e'),_0x34eb17));if(_0x34eb17!=='unmanaged'){logger[_0x6bfe('0x23')]('['+_0x34eb17[_0x6bfe('0x16')]()+']',_0x6bfe('0x5f'));emit(_0x1aa923[_0x6bfe('0x51')],_0xc58ca6[_0x6bfe('0x60')],_0x24e06f[_0x6bfe('0x3e')],_0x39f472['ticketId']);}})['catch'](function(_0x402540){logger[_0x6bfe('0x61')]('['+_0x34eb17['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x402540['message']);});}; \ No newline at end of file +var _0x9f33=['lodash','request-promise','util','./util','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','enduserId','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','/contacts(','Fields','ticketType','callDirection','queue','Descriptions','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration'];(function(_0x272b9f,_0x3d10e7){var _0x5632b9=function(_0x1776e0){while(--_0x1776e0){_0x272b9f['push'](_0x272b9f['shift']());}};_0x5632b9(++_0x3d10e7);}(_0x9f33,0x147));var _0x39f3=function(_0x3390f9,_0x427bfa){_0x3390f9=_0x3390f9-0x0;var _0x32c1c5=_0x9f33[_0x3390f9];return _0x32c1c5;};'use strict';var _=require(_0x39f3('0x0'));var rp=require(_0x39f3('0x1'));var util=require(_0x39f3('0x2'));var intUtil=require(_0x39f3('0x3'));var md5=require(_0x39f3('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x39f3('0x5'));var config=require(_0x39f3('0x6'));config[_0x39f3('0x7')]=_[_0x39f3('0x8')](config['redis'],{'host':_0x39f3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x39f3('0x7')]));function getAuthToken(_0x5e4b5f,_0x1dc508,_0x22b9dd){if(_0x5e4b5f[_0x39f3('0xa')]){_0x5e4b5f[_0x39f3('0xb')]=_0x5e4b5f[_0x39f3('0xc')]['data7'];_0x5e4b5f[_0x39f3('0xd')]=_0x5e4b5f['CloudProvider'][_0x39f3('0xe')];return Promise[_0x39f3('0xf')](_0x5e4b5f[_0x39f3('0xc')][_0x39f3('0x10')]);}var _0x5c5f20={'method':_0x39f3('0x11'),'uri':_0x1dc508,'form':{'client_id':_0x5e4b5f['clientId'],'resource':_0x5e4b5f[_0x39f3('0xb')],'username':_0x5e4b5f[_0x39f3('0x12')],'password':_0x5e4b5f[_0x39f3('0x13')],'grant_type':_0x39f3('0x13'),'client_secret':_0x5e4b5f[_0x39f3('0x14')]},'json':!![]};return rp(_0x5c5f20)['then'](function(_0x557acc){return _0x557acc['access_token'];})[_0x39f3('0x15')](function(_0x5e4aa1){logger[_0x39f3('0x16')]('['+[_0x22b9dd[_0x39f3('0x17')]()]+_0x39f3('0x18'));return _0x5e4aa1[_0x39f3('0x19')];});}function getUser(_0x7b06ae,_0x3c50ff,_0x3470e9,_0xaeb687,_0x174165,_0x47936d){return new Promise(function(_0x4ce2f7,_0x5b9459){return getAuthToken(_0x3c50ff,_0xaeb687,_0x47936d)[_0x39f3('0x1a')](function(_0x11767b){var _0x238c62={'method':'GET','uri':_0x174165+_0x39f3('0x1b'),'headers':{'Authorization':_0x39f3('0x1c')+_0x11767b,'OData-Version':_0x39f3('0x1d')},'json':!![]};return rp(_0x238c62);})[_0x39f3('0x1a')](function(_0x26b547){var _0x237b41=_0x26b547[_0x39f3('0x1e')];var _0x821ebb=![];var _0xc87ba5=null;if(!_['isNil'](_0x3470e9)){if(intUtil[_0x39f3('0x1f')](_0x3470e9[_0x39f3('0x20')])){_0x7b06ae[_0x39f3('0x21')]=_0x3470e9['email'];for(_0xc87ba5=0x0;_0xc87ba5<_0x237b41[_0x39f3('0x22')];_0xc87ba5++){if(_0x237b41[_0xc87ba5][_0x39f3('0x23')]===_0x3470e9[_0x39f3('0x20')]&&!_0x237b41[_0xc87ba5][_0x39f3('0x24')]){_0x821ebb=!![];logger['info']('['+[_0x47936d['toUpperCase']()]+_0x39f3('0x25')+_0x237b41[_0xc87ba5][_0x39f3('0x26')]+'!');_0x7b06ae[_0x39f3('0x27')]=_0x237b41[_0xc87ba5][_0x39f3('0x26')];}}}}if(!_0x821ebb){logger[_0x39f3('0x28')]('['+[_0x47936d['toUpperCase']()]+_0x39f3('0x29'));_0x7b06ae[_0x39f3('0x21')]=_0x3c50ff[_0x39f3('0x12')];for(_0xc87ba5=0x0;_0xc87ba5<_0x237b41[_0x39f3('0x22')];_0xc87ba5++){if(_0x237b41[_0xc87ba5][_0x39f3('0x23')]===_0x3c50ff[_0x39f3('0x12')]){_0x7b06ae[_0x39f3('0x27')]=_0x237b41[_0xc87ba5][_0x39f3('0x26')];}}}_0x4ce2f7(_0x7b06ae);})[_0x39f3('0x15')](function(_0x1c8ca5){_0x5b9459(_0x1c8ca5['message']);});});}function createEndUser(_0x2ec5e3,_0x42c80b,_0x2d3359,_0x2712eb,_0x452444,_0x4c43fa){return new Promise(function(_0x3013d2,_0xae888a){return getAuthToken(_0x42c80b,_0x2d3359,_0x4c43fa)[_0x39f3('0x1a')](function(_0x42fd36){var _0x58e968=_0x4c43fa[_0x39f3('0x2a')]()===_0x39f3('0x2b')?_0x452444[_0x39f3('0x2c')]:_0x452444[_0x39f3('0x2d')];var _0x213333={'method':_0x39f3('0x11'),'uri':_0x2712eb+_0x39f3('0x2e'),'body':{'telephone1':_0x58e968,'fullname':_0x58e968,'firstname':_0x58e968,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x39f3('0x2f')+_0x2ec5e3[_0x39f3('0x27')]+')'},'headers':{'Authorization':_0x39f3('0x1c')+_0x42fd36,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x213333);})[_0x39f3('0x1a')](function(_0x1dc8ba){var _0x56433a=_0x1dc8ba[_0x39f3('0x30')][_0x39f3('0x31')];var _0x5f1fa5=_0x56433a[_0x39f3('0x32')](_0x56433a[_0x39f3('0x33')]('(')+0x1,_0x56433a[_0x39f3('0x33')](')'));_0x2ec5e3['enduserId']=_0x5f1fa5;_0x3013d2(_0x2ec5e3);})['catch'](function(_0x31b82b){_0xae888a(_0x31b82b[_0x39f3('0x19')]);});});}function getEndUser(_0x27c575,_0x51be4a,_0x4c7b04,_0x573cad,_0x3c145e,_0x3b0655,_0x1648b6){var _0x466a30=_0x3b0655[_0x39f3('0x2a')]()===_0x39f3('0x2b')?_0x3c145e[_0x39f3('0x2c')]:_0x3c145e[_0x39f3('0x2d')];return getAuthToken(_0x51be4a,_0x4c7b04,_0x3b0655)[_0x39f3('0x1a')](function(_0x181aa4){var _0x2c8533={'method':_0x39f3('0x34'),'uri':_0x573cad+_0x39f3('0x35')+_0x466a30[_0x39f3('0x36')]('+',_0x39f3('0x37'))+'\x27','headers':{'Authorization':_0x39f3('0x1c')+_0x181aa4,'If-None-Match':null,'OData-Version':_0x39f3('0x1d')},'json':!![]};return rp(_0x2c8533);})[_0x39f3('0x1a')](function(_0x1a2d48){var _0x20d61f=![];if(!_0x1a2d48)return _0x20d61f;var _0x4ea756=_0x1a2d48[_0x39f3('0x1e')];for(var _0x4c771f=0x0;_0x4c771f<_0x4ea756[_0x39f3('0x22')];_0x4c771f++){if(_0x4ea756[_0x4c771f][_0x39f3('0x38')]===_0x466a30){_0x20d61f=!![];_0x27c575[_0x39f3('0x39')]=_0x4ea756[_0x4c771f][_0x39f3('0x3a')];}}return _0x20d61f;})[_0x39f3('0x1a')](function(_0x58d47d){if(_0x58d47d)return _0x27c575;if(_0x1648b6==='nothing'){logger[_0x39f3('0x28')]('['+[_0x3b0655['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x27c575;}return createEndUser(_0x27c575,_0x51be4a,_0x4c7b04,_0x573cad,_0x3c145e,_0x3b0655)[_0x39f3('0x1a')](function(_0x26f9eb){logger['info']('['+[_0x3b0655['toUpperCase']()]+_0x39f3('0x3b'),_0x26f9eb[_0x39f3('0x39')]);return _0x26f9eb;});});}function getCustomFields(_0x2bcd80,_0x426a1b,_0x39e23f){var _0x238bc9={};if(_0x2bcd80['length']>0x0){_[_0x39f3('0x3c')](_0x2bcd80,function(_0x3f15a7){if(_[_0x39f3('0x3d')]([_0x39f3('0x3e'),_0x39f3('0x3f')],_0x3f15a7[_0x39f3('0x40')])&&_0x3f15a7[_0x39f3('0x41')]&&!_0x3f15a7[_0x39f3('0x42')]){var _0x8b5888=_0x3f15a7[_0x39f3('0x43')][_0x39f3('0x2a')]();var _0x447c41=_0x8b5888[_0x39f3('0x32')](0x0,_0x8b5888[_0x39f3('0x44')]('_'));var _0x309416=_0x8b5888[_0x39f3('0x32')](_0x8b5888[_0x39f3('0x44')]('_')+0x1);if(_0x447c41===_0x39e23f){_0x238bc9[_0x309416]=_0x3f15a7['content'];}}});}return _0x238bc9;}function getTicket(_0x3e930a,_0x3441b5,_0x58debb,_0x58c7b5,_0x47995b,_0x1c8438,_0x10cf7b){return new Promise(function(_0x20c213,_0x3c3c28){var _0x3018e2;return getAuthToken(_0x3441b5,_0x58debb,_0x10cf7b)[_0x39f3('0x1a')](function(_0x484f15){if(_0x1c8438['ticketType']===_0x39f3('0x45')){_0x3018e2={'method':'POST','uri':_0x58c7b5+_0x39f3('0x46'),'body':Object[_0x39f3('0x47')]({},{'title':intUtil[_0x39f3('0x48')](_0x1c8438[_0x39f3('0x49')],_0x47995b,'\x20'),'description':intUtil[_0x39f3('0x48')](_0x1c8438['Descriptions'],_0x47995b,'\x0a'),'customerid_contact@odata.bind':_0x3e930a['enduserId']?_0x39f3('0x4a')+_0x3e930a[_0x39f3('0x39')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3e930a[_0x39f3('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x1c8438[_0x39f3('0x4b')],_0x47995b,_0x1c8438[_0x39f3('0x4c')])),'headers':{'Authorization':_0x39f3('0x1c')+_0x484f15,'OData-Version':_0x39f3('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1c8438[_0x39f3('0x4c')]==='phonecall'){var _0x2479dc=_0x3e930a[_0x39f3('0x39')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3e930a[_0x39f3('0x27')]+')','participationtypemask':_0x3e930a[_0x39f3('0x4d')]===_0x39f3('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x39f3('0x4a')+_0x3e930a[_0x39f3('0x39')]+')','participationtypemask':_0x3e930a['callDirection']===_0x39f3('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3e930a['userId']+')','participationtypemask':_0x3e930a[_0x39f3('0x4d')]===_0x39f3('0x4e')?0x2:0x1}];_0x3018e2={'method':_0x39f3('0x11'),'uri':_0x58c7b5+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x39f3('0x48')](_0x1c8438[_0x39f3('0x49')],_0x47995b,'\x20'),'phonenumber':String(_0x47995b[_0x39f3('0x2d')]),'description':intUtil[_0x39f3('0x48')](_0x1c8438[_0x39f3('0x4f')],_0x47995b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e930a[_0x39f3('0x39')]?_0x39f3('0x4a')+_0x3e930a['enduserId']+')':undefined,'ownerid@odata.bind':_0x39f3('0x2f')+_0x3e930a[_0x39f3('0x27')]+')','directioncode':_0x3e930a[_0x39f3('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2479dc},getCustomFields(_0x1c8438[_0x39f3('0x4b')],_0x47995b,_0x1c8438[_0x39f3('0x4c')])),'headers':{'Authorization':_0x39f3('0x1c')+_0x484f15,'OData-Version':_0x39f3('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3018e2);})[_0x39f3('0x1a')](function(_0x2270ff){var _0x25d80f=_0x2270ff[_0x39f3('0x30')][_0x39f3('0x31')];var _0xd04458=_0x25d80f[_0x39f3('0x32')](_0x25d80f[_0x39f3('0x33')]('(')+0x1,_0x25d80f['lastIndexOf'](')'));_0x3e930a[_0x39f3('0x50')]=_0xd04458;_0x20c213(_0x3e930a);})[_0x39f3('0x15')](function(_0x2aa8fd){_0x3c3c28(_0x2aa8fd[_0x39f3('0x19')]);});});}function emit(_0x683138,_0x4e93c0,_0x593429,_0x5a51dc){var _0x35b3fe={'uri':util['format'](_0x39f3('0x51'),_0x683138,_0x593429,_0x5a51dc)};io['to'](util[_0x39f3('0x52')](_0x39f3('0x53'),_0x4e93c0))['emit'](_0x39f3('0x54'),_0x35b3fe);}exports['cs']=function(_0x46fafa,_0x314c2f,_0x44bb48,_0x44203d,_0x28aa70,_0x318eda,_0x374d68,_0x3071d5){var _0x474edb={};_0x318eda[_0x39f3('0xb')]=_0x318eda['modernAuthentication']?intUtil['stripTrailingSlash'](_0x318eda[_0x39f3('0xc')]['data7']):intUtil[_0x39f3('0x55')](_0x318eda[_0x39f3('0xb')]);_0x318eda['serverUrl']=intUtil['stripTrailingSlash'](_0x318eda[_0x39f3('0x56')]);_0x474edb[_0x39f3('0x4d')]=_0x3071d5===_0x39f3('0x4e')||_0x3071d5===_0x39f3('0x57')?_0x39f3('0x4e'):_0x39f3('0x2b');var _0x51a6c9=_0x318eda[_0x39f3('0xa')]?util[_0x39f3('0x52')](_0x39f3('0x58'),_0x318eda[_0x39f3('0xc')][_0x39f3('0x59')]):util[_0x39f3('0x52')](_0x39f3('0x58'),_0x318eda[_0x39f3('0xb')]);var _0x221ee5=util[_0x39f3('0x52')](_0x39f3('0x5a'),_0x318eda['tenantId']);var _0x5ef68d=util[_0x39f3('0x52')](_0x39f3('0x5b'),_0x318eda[_0x39f3('0x56')],_0x314c2f[_0x39f3('0x5c')],md5(_0x314c2f[_0x39f3('0x5c')]));if(_0x28aa70&&_0x28aa70[_0x39f3('0x5d')]){logger[_0x39f3('0x28')](_0x39f3('0x5e'),_0x39f3('0x5f'));_0x314c2f[_0x39f3('0x60')]=_0x5ef68d;}else if(_0x374d68&&_0x374d68[_0x39f3('0x61')]&&_0x374d68[_0x39f3('0x61')]!==_0x39f3('0x62')){logger['info'](_0x39f3('0x63'),_0x39f3('0x5f'));_0x314c2f['recordingURL']=_0x5ef68d;}else{_0x314c2f[_0x39f3('0x60')]='';}return getUser(_0x474edb,_0x318eda,_0x44203d,_0x221ee5,_0x51a6c9,_0x3071d5)[_0x39f3('0x1a')](function(_0x21bb8a){logger['info']('['+_0x3071d5['toUpperCase']()+_0x39f3('0x64'),_0x21bb8a[_0x39f3('0x27')]);logger[_0x39f3('0x28')]('['+_0x3071d5['toUpperCase']()+_0x39f3('0x65'),_0x21bb8a[_0x39f3('0x21')]);return getEndUser(_0x21bb8a,_0x318eda,_0x221ee5,_0x51a6c9,_0x314c2f,_0x3071d5,_0x44bb48[_0x39f3('0x66')]);})['then'](function(_0x40b708){logger['info']('['+_0x3071d5[_0x39f3('0x17')]()+_0x39f3('0x67'),_0x40b708[_0x39f3('0x39')]);logger[_0x39f3('0x28')]('['+_0x3071d5[_0x39f3('0x17')]()+_0x39f3('0x68'),_0x314c2f['calleridnum']);return getTicket(_0x40b708,_0x318eda,_0x221ee5,_0x51a6c9,_0x314c2f,_0x44bb48,_0x3071d5);})['then'](function(_0x5922cd){logger['info'](util['format']('['+_0x3071d5['toUpperCase']()+_0x39f3('0x69'),_0x44bb48[_0x39f3('0x4c')],_0x5922cd[_0x39f3('0x50')]));logger['info'](util[_0x39f3('0x52')]('['+_0x3071d5['toUpperCase']()+_0x39f3('0x6a'),_0x3071d5));if(_0x3071d5!==_0x39f3('0x57')){logger[_0x39f3('0x28')]('['+_0x3071d5[_0x39f3('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x318eda['remoteUri'],_0x44203d[_0x39f3('0x6b')],_0x44bb48[_0x39f3('0x4c')],_0x5922cd[_0x39f3('0x50')]);}})[_0x39f3('0x15')](function(_0x560e83){logger[_0x39f3('0x16')]('['+_0x3071d5[_0x39f3('0x17')]()+_0x39f3('0x6c'),_0x560e83['message']);});}; \ 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 6b5b5c4..e8d6b14 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 _0x5f14=['toLowerCase','queue','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','unmanaged','monitor_format','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','name','Fields','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','forEach','includes','picklist','type','nameField','customField','content','string','push','idField','variable','variableName','customVariable','Variable'];(function(_0x58016b,_0x4b37cb){var _0xde1c8c=function(_0x3ab67e){while(--_0x3ab67e){_0x58016b['push'](_0x58016b['shift']());}};_0xde1c8c(++_0x4b37cb);}(_0x5f14,0x72));var _0x45f1=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x5f14[_0x427d3a];return _0xe5c521;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x45f1('0x0'));var Redis=require(_0x45f1('0x1'));var intUtil=require('./util');var config=require(_0x45f1('0x2'));var logger=require(_0x45f1('0x3'))(_0x45f1('0x4'));config[_0x45f1('0x5')]=_[_0x45f1('0x6')](config[_0x45f1('0x5')],{'host':_0x45f1('0x7'),'port':0x18eb});var io=require(_0x45f1('0x8'))(new Redis(config[_0x45f1('0x5')]));var headers={'Content-Type':_0x45f1('0x9'),'Accept':'application/json'};function emit(_0x4acc84,_0xbaffc7,_0xd764a0){io['to'](_0x4acc84)[_0x45f1('0xa')](_0xbaffc7,_0xd764a0);}function getTicket(_0x430f82,_0x5d9e40,_0x1b89d1,_0xc2f755,_0x12e6ab){logger[_0x45f1('0xb')](_0x45f1('0xc'));var _0x49d901=_[_0x45f1('0xd')]({'responder_id':_0x5d9e40['id'],'requester_id':_0x1b89d1['id'],'name':util[_0x45f1('0xe')](_0x45f1('0xf'),_0x12e6ab[_0x45f1('0x10')]),'phone':_0x12e6ab['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x45f1('0x11')](_0xc2f755[_0x45f1('0x12')],_0x12e6ab,'\x20'),'description':intUtil[_0x45f1('0x11')](_0xc2f755[_0x45f1('0x13')],_0x12e6ab,_0x45f1('0x14')),'tags':getTags(_0xc2f755['Tags'],_0x45f1('0x15'))},getCustomFields(_0xc2f755[_0x45f1('0x16')],_0x12e6ab));_0x49d901[_0x45f1('0x17')]=_['mapValues'](_['keyBy'](_0x49d901[_0x45f1('0x17')],'id'),_0x45f1('0x18'));return request({'uri':util[_0x45f1('0xe')](_0x45f1('0x19'),_0x430f82[_0x45f1('0x1a')]),'method':'POST','body':_0x49d901})[_0x45f1('0x1b')](function(_0x405d08){logger['info'](_0x45f1('0x1c'));return _0x405d08;});}function getUser(_0xaeac75,_0x3c9dea){if(intUtil[_0x45f1('0x1d')](_0x3c9dea)){return request({'uri':util[_0x45f1('0xe')](_0x45f1('0x1e'),_0xaeac75['remoteUri']),'qs':{'email':_0x3c9dea}})['then'](function(_0x36479e){if(_0x36479e[_0x45f1('0x1f')]){logger[_0x45f1('0xb')](_0x45f1('0x20'));return _[_0x45f1('0x21')](_0x36479e,function(_0x3f5eea){return _0x3f5eea[_0x45f1('0x22')][_0x45f1('0x23')]===_0x3c9dea;});}else{logger[_0x45f1('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x45f1('0xe')](_0x45f1('0x24'),_0xaeac75[_0x45f1('0x1a')])})[_0x45f1('0x1b')](function(_0x32dd11){logger[_0x45f1('0xb')]('Admin\x20account\x20selected.');return _0x32dd11;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x45f1('0xe')]('%s/api/v2/agents/me',_0xaeac75[_0x45f1('0x1a')])})[_0x45f1('0x1b')](function(_0x488f98){logger[_0x45f1('0xb')](_0x45f1('0x25'));return _0x488f98;});}}function getEndUser(_0x13a3b2,_0x199207,_0xa77bf4){logger[_0x45f1('0xb')](_0x45f1('0x26'),_0xa77bf4);return request({'uri':util[_0x45f1('0xe')](_0x45f1('0x27'),_0x13a3b2[_0x45f1('0x1a')]),'qs':{'phone':_0xa77bf4}})['then'](function(_0x17ca57){if(_0x17ca57[_0x45f1('0x1f')]){logger['info']('Enduser\x20found!');return _[_0x45f1('0x21')](_0x17ca57,{'phone':_0xa77bf4});}else{logger[_0x45f1('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x45f1('0x27'),_0x13a3b2[_0x45f1('0x1a')]),'method':_0x45f1('0x28'),'body':{'name':_0x199207,'phone':_0xa77bf4}})[_0x45f1('0x1b')](function(_0x440ab3){logger[_0x45f1('0xb')](_0x45f1('0x29'));return _0x440ab3;});}});}function getAuth(_0x3d97ed){return util[_0x45f1('0xe')](_0x45f1('0x2a'),new Buffer(_0x3d97ed['apiKey']+':X')[_0x45f1('0x2b')](_0x45f1('0x2c')));}function request(_0x375f95){logger['debug'](_0x45f1('0x2d'),JSON[_0x45f1('0x2e')](_0x375f95));return rp(_[_0x45f1('0x6')](_0x375f95,{'method':_0x45f1('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x25b109,_0x1bf697){var _0x14bd2b=[];if(_0x25b109&&_0x25b109['length']>0x0){_0x14bd2b=_['map'](_0x25b109,_0x1bf697);}return _0x14bd2b;}function getCustomFields(_0x455227,_0x53e032){var _0x4dd7d8=[];var _0x39ca9e={'custom_fields':[]};if(_0x455227['length']>0x0){_[_0x45f1('0x30')](_0x455227,function(_0x2d6aec){if(_[_0x45f1('0x31')](['string',_0x45f1('0x32')],_0x2d6aec[_0x45f1('0x33')])&&_0x2d6aec[_0x45f1('0x34')]&&!_0x2d6aec[_0x45f1('0x35')]){_0x39ca9e[_0x2d6aec[_0x45f1('0x34')]['toLowerCase']()]=_0x2d6aec[_0x45f1('0x36')][_0x45f1('0x2b')]();}else if(_['includes']([_0x45f1('0x37'),'picklist'],_0x2d6aec[_0x45f1('0x33')])&&_0x2d6aec['idField']&&_0x2d6aec[_0x45f1('0x35')]){_0x39ca9e[_0x45f1('0x17')][_0x45f1('0x38')]({'id':_0x2d6aec[_0x45f1('0x39')],'value':_0x2d6aec['content'][_0x45f1('0x2b')]()});}else if(_0x2d6aec[_0x45f1('0x33')]===_0x45f1('0x3a')&&_0x2d6aec[_0x45f1('0x3b')]&&_0x2d6aec[_0x45f1('0x39')]&&_0x2d6aec['customField']){_0x53e032[_0x2d6aec[_0x45f1('0x3b')]]&&_0x39ca9e[_0x45f1('0x17')][_0x45f1('0x38')]({'id':_0x2d6aec[_0x45f1('0x39')],'value':_0x53e032[_0x2d6aec[_0x45f1('0x3b')]][_0x45f1('0x2b')]()});}else if(_0x2d6aec[_0x45f1('0x33')]===_0x45f1('0x3c')&&_0x2d6aec['Variable']&&_0x2d6aec[_0x45f1('0x3d')]['name']&&_0x2d6aec['idField']&&_0x2d6aec[_0x45f1('0x35')]){_0x53e032[_0x2d6aec['Variable'][_0x45f1('0x15')][_0x45f1('0x3e')]()]&&_0x39ca9e[_0x45f1('0x17')]['push']({'id':_0x2d6aec[_0x45f1('0x39')],'value':_0x53e032[_0x2d6aec[_0x45f1('0x3d')][_0x45f1('0x15')]['toLowerCase']()][_0x45f1('0x2b')]()});}});}return _0x39ca9e;}exports[_0x45f1('0x3f')]=function(_0x2df5f6,_0x3d4815,_0x27da03,_0x21724b,_0x25ec3c,_0x1a920c){var _0xfdfeba,_0x303c23;_0x1a920c[_0x45f1('0x1a')]=intUtil[_0x45f1('0x40')](_0x1a920c['remoteUri']);_0x1a920c[_0x45f1('0x41')]=intUtil[_0x45f1('0x40')](_0x1a920c[_0x45f1('0x41')]);if(_0x25ec3c&&_0x25ec3c['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x3d4815[_0x45f1('0x42')]=util[_0x45f1('0xe')](_0x45f1('0x43'),_0x1a920c['serverUrl'],_0x3d4815[_0x45f1('0x44')],md5(_0x3d4815[_0x45f1('0x44')]));}else{_0x3d4815[_0x45f1('0x42')]='';}headers[_0x45f1('0x45')]=getAuth(_0x1a920c);return getUser(_0x1a920c,_0x21724b[_0x45f1('0x23')])[_0x45f1('0x1b')](function(_0x5e8093){_0xfdfeba=_0x5e8093;logger['info']('The\x20User\x20ID\x20is:',_0xfdfeba['id']);return getEndUser(_0x1a920c,_0x3d4815['calleridname'],_0x3d4815[_0x45f1('0x46')]);})[_0x45f1('0x1b')](function(_0x20b859){_0x303c23=_0x20b859;logger[_0x45f1('0xb')](_0x45f1('0x47'),_0x303c23['id']);return getTicket(_0x1a920c,_0xfdfeba,_0x303c23,_0x27da03,_0x3d4815);})['then'](function(_0x23c1fa){if(_0x23c1fa&&_0x23c1fa['id']){logger[_0x45f1('0xb')](_0x45f1('0x1c'));logger[_0x45f1('0xb')](_0x45f1('0x48'),_0x23c1fa['id']);logger[_0x45f1('0xb')](_0x45f1('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x45f1('0x4a'),_0x21724b[_0x45f1('0x15')]),_0x45f1('0x4b'),{'uri':util[_0x45f1('0xe')]('%s/helpdesk/tickets/%d',_0x1a920c[_0x45f1('0x1a')],_0x23c1fa['id'])});}})['catch'](function(_0x217aee){logger[_0x45f1('0x4c')](_0x45f1('0x49'),JSON[_0x45f1('0x2e')](_0x217aee));});};exports[_0x45f1('0x4d')]=function(_0x36afbb,_0x4c9a14,_0x17362d,_0x484a49,_0x5bdc48,_0x45697d,_0x13f2db){var _0x404325,_0x2e4eae;_0x45697d[_0x45f1('0x1a')]=intUtil['stripTrailingSlash'](_0x45697d['remoteUri']);_0x45697d[_0x45f1('0x41')]=intUtil['stripTrailingSlash'](_0x45697d[_0x45f1('0x41')]);if(_0x13f2db&&_0x13f2db[_0x45f1('0x4e')]&&_0x13f2db['recordingFormat']!==_0x45f1('0x4f')){logger['info'](_0x45f1('0x50'),_0x45f1('0x51'));_0x4c9a14['recordingURL']=util[_0x45f1('0xe')](_0x45f1('0x43'),_0x45697d['serverUrl'],_0x4c9a14[_0x45f1('0x44')],md5(_0x4c9a14[_0x45f1('0x44')]));}headers[_0x45f1('0x45')]=getAuth(_0x45697d);return getUser(_0x45697d,_0x484a49[_0x45f1('0x23')])[_0x45f1('0x1b')](function(_0x3e7f1b){_0x404325=_0x3e7f1b;logger[_0x45f1('0xb')](_0x45f1('0x52'),_0x404325['id']);return getEndUser(_0x45697d,_0x4c9a14['destcalleridname'],_0x4c9a14['destcalleridnum']);})[_0x45f1('0x1b')](function(_0x3584b7){_0x2e4eae=_0x3584b7;logger[_0x45f1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2e4eae['id']);return getTicket(_0x45697d,_0x404325,_0x2e4eae,_0x17362d,_0x4c9a14);})['then'](function(_0x267fe1){if(_0x267fe1&&_0x267fe1['id']){logger['info'](_0x45f1('0x1c'));logger[_0x45f1('0xb')](_0x45f1('0x48'),_0x267fe1['id']);logger[_0x45f1('0xb')](_0x45f1('0x50'),_0x45f1('0x53'));emit(util[_0x45f1('0xe')]('user:%s',_0x484a49[_0x45f1('0x15')]),_0x45f1('0x4b'),{'uri':util[_0x45f1('0xe')](_0x45f1('0x54'),_0x45697d[_0x45f1('0x1a')],_0x267fe1['id'])});}})[_0x45f1('0x55')](function(_0x4b7b4a){logger[_0x45f1('0x4c')](_0x45f1('0x50'),JSON[_0x45f1('0x2e')](_0x4b7b4a));});};exports[_0x45f1('0x56')]=function(_0x4a1af6,_0x3dd57e,_0x287431,_0x442c54,_0x3ca09a,_0x212b25){var _0xd0ccf6,_0x5c3918;_0x212b25[_0x45f1('0x1a')]=intUtil[_0x45f1('0x40')](_0x212b25['remoteUri']);_0x212b25[_0x45f1('0x41')]=intUtil[_0x45f1('0x40')](_0x212b25[_0x45f1('0x41')]);if(_0x3ca09a&&_0x3ca09a[_0x45f1('0x57')]){logger[_0x45f1('0xb')]('['+_0x3dd57e['lastevent']['toUpperCase']()+']',_0x45f1('0x51'));_0x3dd57e[_0x45f1('0x42')]=util[_0x45f1('0xe')](_0x45f1('0x43'),_0x212b25[_0x45f1('0x41')],_0x3dd57e['uniqueid'],md5(_0x3dd57e[_0x45f1('0x44')]));}else{_0x3dd57e['recordingURL']='';}headers[_0x45f1('0x45')]=getAuth(_0x212b25);return getUser(_0x212b25,'')[_0x45f1('0x1b')](function(_0x2d8f34){_0xd0ccf6=_0x2d8f34;logger['info'](_0x45f1('0x52'),_0xd0ccf6['id']);return getEndUser(_0x212b25,_0x3dd57e[_0x45f1('0x10')],_0x3dd57e[_0x45f1('0x46')]);})[_0x45f1('0x1b')](function(_0xe3f71f){_0x5c3918=_0xe3f71f;logger[_0x45f1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5c3918['id']);return getTicket(_0x212b25,_0xd0ccf6,_0x5c3918,_0x287431,_0x3dd57e);})['then'](function(_0x531b62){if(_0x531b62){logger[_0x45f1('0xb')](_0x45f1('0x1c'));logger[_0x45f1('0xb')](_0x45f1('0x48'),_0x531b62['id']);}})[_0x45f1('0x55')](function(_0x54c378){logger[_0x45f1('0x4c')]('['+_0x3dd57e['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x54c378));});}; \ No newline at end of file +var _0x741c=['type','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','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:','[QUEUE]','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','trigger:browser:url','stringify','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','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!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','forEach','includes','string','picklist','nameField','customField','content'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x741c,0xe3));var _0xc741=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x741c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc741('0x0'));var rp=require(_0xc741('0x1'));var md5=require(_0xc741('0x2'));var util=require(_0xc741('0x3'));var Redis=require(_0xc741('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xc741('0x5'));config[_0xc741('0x6')]=_[_0xc741('0x7')](config[_0xc741('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc741('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xc741('0x9')};function emit(_0xfc2071,_0x6ce25e,_0x9e90f6){io['to'](_0xfc2071)[_0xc741('0xa')](_0x6ce25e,_0x9e90f6);}function getTicket(_0xf9883c,_0x5d1760,_0x2a9a1a,_0x35a0ee,_0x3d8886){logger[_0xc741('0xb')](_0xc741('0xc'));var _0x570331=_[_0xc741('0xd')]({'responder_id':_0x5d1760['id'],'requester_id':_0x2a9a1a['id'],'name':util[_0xc741('0xe')](_0xc741('0xf'),_0x3d8886[_0xc741('0x10')]),'phone':_0x3d8886[_0xc741('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc741('0x12')](_0x35a0ee['Subjects'],_0x3d8886,'\x20'),'description':intUtil[_0xc741('0x12')](_0x35a0ee[_0xc741('0x13')],_0x3d8886,_0xc741('0x14')),'tags':getTags(_0x35a0ee[_0xc741('0x15')],_0xc741('0x16'))},getCustomFields(_0x35a0ee[_0xc741('0x17')],_0x3d8886));_0x570331[_0xc741('0x18')]=_[_0xc741('0x19')](_[_0xc741('0x1a')](_0x570331['custom_fields'],'id'),_0xc741('0x1b'));return request({'uri':util[_0xc741('0xe')](_0xc741('0x1c'),_0xf9883c[_0xc741('0x1d')]),'method':'POST','body':_0x570331})[_0xc741('0x1e')](function(_0x3ed221){logger[_0xc741('0xb')](_0xc741('0x1f'));return _0x3ed221;});}function getUser(_0x52d7a5,_0x152e45){if(intUtil[_0xc741('0x20')](_0x152e45)){return request({'uri':util['format'](_0xc741('0x21'),_0x52d7a5[_0xc741('0x1d')]),'qs':{'email':_0x152e45}})[_0xc741('0x1e')](function(_0x1a0b74){if(_0x1a0b74[_0xc741('0x22')]){logger[_0xc741('0xb')](_0xc741('0x23'));return _[_0xc741('0x24')](_0x1a0b74,function(_0x556cc4){return _0x556cc4[_0xc741('0x25')][_0xc741('0x26')]===_0x152e45;});}else{logger['info'](_0xc741('0x27'));return request({'uri':util[_0xc741('0xe')](_0xc741('0x28'),_0x52d7a5[_0xc741('0x1d')])})['then'](function(_0x2405ff){logger[_0xc741('0xb')]('Admin\x20account\x20selected.');return _0x2405ff;});}});}else{logger[_0xc741('0xb')](_0xc741('0x29'));return request({'uri':util[_0xc741('0xe')](_0xc741('0x28'),_0x52d7a5[_0xc741('0x1d')])})[_0xc741('0x1e')](function(_0x448c21){logger[_0xc741('0xb')](_0xc741('0x2a'));return _0x448c21;});}}function getEndUser(_0x2776fa,_0xa11618,_0x5d6f99){logger[_0xc741('0xb')](_0xc741('0x2b'),_0x5d6f99);return request({'uri':util[_0xc741('0xe')](_0xc741('0x2c'),_0x2776fa[_0xc741('0x1d')]),'qs':{'phone':_0x5d6f99}})[_0xc741('0x1e')](function(_0x182e5c){if(_0x182e5c[_0xc741('0x22')]){logger['info'](_0xc741('0x2d'));return _[_0xc741('0x24')](_0x182e5c,{'phone':_0x5d6f99});}else{logger[_0xc741('0xb')](_0xc741('0x2e'));return request({'uri':util['format'](_0xc741('0x2c'),_0x2776fa[_0xc741('0x1d')]),'method':_0xc741('0x2f'),'body':{'name':_0xa11618,'phone':_0x5d6f99}})[_0xc741('0x1e')](function(_0x4b690f){logger[_0xc741('0xb')]('Enduser\x20created.');return _0x4b690f;});}});}function getAuth(_0x36f0d0){return util[_0xc741('0xe')](_0xc741('0x30'),new Buffer(_0x36f0d0[_0xc741('0x31')]+':X')[_0xc741('0x32')](_0xc741('0x33')));}function request(_0x421916){logger[_0xc741('0x34')](_0xc741('0x35'),JSON['stringify'](_0x421916));return rp(_[_0xc741('0x7')](_0x421916,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x58bbe4,_0x2bb22){var _0x1e7e30=[];if(_0x58bbe4&&_0x58bbe4[_0xc741('0x22')]>0x0){_0x1e7e30=_['map'](_0x58bbe4,_0x2bb22);}return _0x1e7e30;}function getCustomFields(_0x5cc4da,_0x3bc4ed){var _0x186f4b=[];var _0x1ddc6e={'custom_fields':[]};if(_0x5cc4da['length']>0x0){_[_0xc741('0x36')](_0x5cc4da,function(_0x59fca4){if(_[_0xc741('0x37')]([_0xc741('0x38'),_0xc741('0x39')],_0x59fca4['type'])&&_0x59fca4[_0xc741('0x3a')]&&!_0x59fca4[_0xc741('0x3b')]){_0x1ddc6e[_0x59fca4[_0xc741('0x3a')]['toLowerCase']()]=_0x59fca4[_0xc741('0x3c')][_0xc741('0x32')]();}else if(_[_0xc741('0x37')]([_0xc741('0x38'),_0xc741('0x39')],_0x59fca4[_0xc741('0x3d')])&&_0x59fca4[_0xc741('0x3e')]&&_0x59fca4[_0xc741('0x3b')]){_0x1ddc6e[_0xc741('0x18')][_0xc741('0x3f')]({'id':_0x59fca4[_0xc741('0x3e')],'value':_0x59fca4[_0xc741('0x3c')][_0xc741('0x32')]()});}else if(_0x59fca4[_0xc741('0x3d')]===_0xc741('0x40')&&_0x59fca4[_0xc741('0x41')]&&_0x59fca4[_0xc741('0x3e')]&&_0x59fca4[_0xc741('0x3b')]){_0x3bc4ed[_0x59fca4[_0xc741('0x41')]]&&_0x1ddc6e[_0xc741('0x18')][_0xc741('0x3f')]({'id':_0x59fca4[_0xc741('0x3e')],'value':_0x3bc4ed[_0x59fca4[_0xc741('0x41')]][_0xc741('0x32')]()});}else if(_0x59fca4[_0xc741('0x3d')]===_0xc741('0x42')&&_0x59fca4[_0xc741('0x43')]&&_0x59fca4['Variable'][_0xc741('0x16')]&&_0x59fca4[_0xc741('0x3e')]&&_0x59fca4[_0xc741('0x3b')]){_0x3bc4ed[_0x59fca4[_0xc741('0x43')][_0xc741('0x16')][_0xc741('0x44')]()]&&_0x1ddc6e[_0xc741('0x18')][_0xc741('0x3f')]({'id':_0x59fca4[_0xc741('0x3e')],'value':_0x3bc4ed[_0x59fca4[_0xc741('0x43')][_0xc741('0x16')][_0xc741('0x44')]()][_0xc741('0x32')]()});}});}return _0x1ddc6e;}exports[_0xc741('0x45')]=function(_0x355854,_0x243863,_0x3d5a28,_0x48948a,_0x19514d,_0x53e4e0){var _0x1ca7ba,_0x4b7e53;_0x53e4e0[_0xc741('0x1d')]=intUtil[_0xc741('0x46')](_0x53e4e0[_0xc741('0x1d')]);_0x53e4e0[_0xc741('0x47')]=intUtil['stripTrailingSlash'](_0x53e4e0[_0xc741('0x47')]);if(_0x19514d&&_0x19514d[_0xc741('0x48')]){logger[_0xc741('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x243863[_0xc741('0x49')]=util[_0xc741('0xe')](_0xc741('0x4a'),_0x53e4e0[_0xc741('0x47')],_0x243863[_0xc741('0x4b')],md5(_0x243863['uniqueid']));}else{_0x243863[_0xc741('0x49')]='';}headers[_0xc741('0x4c')]=getAuth(_0x53e4e0);return getUser(_0x53e4e0,_0x48948a[_0xc741('0x26')])[_0xc741('0x1e')](function(_0x386d23){_0x1ca7ba=_0x386d23;logger[_0xc741('0xb')](_0xc741('0x4d'),_0x1ca7ba['id']);return getEndUser(_0x53e4e0,_0x243863[_0xc741('0x10')],_0x243863[_0xc741('0x11')]);})['then'](function(_0x293964){_0x4b7e53=_0x293964;logger['info'](_0xc741('0x4e'),_0x4b7e53['id']);return getTicket(_0x53e4e0,_0x1ca7ba,_0x4b7e53,_0x3d5a28,_0x243863);})['then'](function(_0x2b78e6){if(_0x2b78e6&&_0x2b78e6['id']){logger['info'](_0xc741('0x1f'));logger[_0xc741('0xb')](_0xc741('0x4f'),_0x2b78e6['id']);logger[_0xc741('0xb')](_0xc741('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc741('0xe')](_0xc741('0x51'),_0x48948a['name']),'trigger:browser:url',{'uri':util[_0xc741('0xe')](_0xc741('0x52'),_0x53e4e0[_0xc741('0x1d')],_0x2b78e6['id'])});}})[_0xc741('0x53')](function(_0x5c0290){logger[_0xc741('0x54')](_0xc741('0x50'),JSON['stringify'](_0x5c0290));});};exports[_0xc741('0x55')]=function(_0x147898,_0x38addc,_0x5e694a,_0x2936a1,_0xe3e1c7,_0x4b0e39,_0x42626e){var _0xcb1339,_0x29f468;_0x4b0e39[_0xc741('0x1d')]=intUtil['stripTrailingSlash'](_0x4b0e39['remoteUri']);_0x4b0e39['serverUrl']=intUtil[_0xc741('0x46')](_0x4b0e39[_0xc741('0x47')]);if(_0x42626e&&_0x42626e[_0xc741('0x56')]&&_0x42626e[_0xc741('0x56')]!==_0xc741('0x57')){logger[_0xc741('0xb')](_0xc741('0x58'),_0xc741('0x59'));_0x38addc['recordingURL']=util['format'](_0xc741('0x4a'),_0x4b0e39[_0xc741('0x47')],_0x38addc[_0xc741('0x4b')],md5(_0x38addc[_0xc741('0x4b')]));}headers[_0xc741('0x4c')]=getAuth(_0x4b0e39);return getUser(_0x4b0e39,_0x2936a1[_0xc741('0x26')])[_0xc741('0x1e')](function(_0x4041e2){_0xcb1339=_0x4041e2;logger[_0xc741('0xb')]('The\x20User\x20ID\x20is:',_0xcb1339['id']);return getEndUser(_0x4b0e39,_0x38addc['destcalleridname'],_0x38addc[_0xc741('0x5a')]);})[_0xc741('0x1e')](function(_0x571898){_0x29f468=_0x571898;logger['info'](_0xc741('0x4e'),_0x29f468['id']);return getTicket(_0x4b0e39,_0xcb1339,_0x29f468,_0x5e694a,_0x38addc);})[_0xc741('0x1e')](function(_0x40f5b7){if(_0x40f5b7&&_0x40f5b7['id']){logger[_0xc741('0xb')](_0xc741('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x40f5b7['id']);logger[_0xc741('0xb')](_0xc741('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc741('0xe')](_0xc741('0x51'),_0x2936a1[_0xc741('0x16')]),_0xc741('0x5b'),{'uri':util[_0xc741('0xe')]('%s/helpdesk/tickets/%d',_0x4b0e39[_0xc741('0x1d')],_0x40f5b7['id'])});}})[_0xc741('0x53')](function(_0x459ef1){logger[_0xc741('0x54')](_0xc741('0x58'),JSON[_0xc741('0x5c')](_0x459ef1));});};exports[_0xc741('0x5d')]=function(_0x29628c,_0x588b38,_0x3177ed,_0x2fd66b,_0x1c09f3,_0x432311){var _0x349120,_0x2fa98c;_0x432311[_0xc741('0x1d')]=intUtil['stripTrailingSlash'](_0x432311['remoteUri']);_0x432311[_0xc741('0x47')]=intUtil[_0xc741('0x46')](_0x432311['serverUrl']);if(_0x1c09f3&&_0x1c09f3[_0xc741('0x48')]){logger[_0xc741('0xb')]('['+_0x588b38[_0xc741('0x5e')][_0xc741('0x5f')]()+']',_0xc741('0x59'));_0x588b38[_0xc741('0x49')]=util[_0xc741('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x432311['serverUrl'],_0x588b38[_0xc741('0x4b')],md5(_0x588b38[_0xc741('0x4b')]));}else{_0x588b38[_0xc741('0x49')]='';}headers['Authorization']=getAuth(_0x432311);return getUser(_0x432311,'')['then'](function(_0x3595b0){_0x349120=_0x3595b0;logger[_0xc741('0xb')](_0xc741('0x4d'),_0x349120['id']);return getEndUser(_0x432311,_0x588b38[_0xc741('0x10')],_0x588b38['calleridnum']);})['then'](function(_0x5eca4f){_0x2fa98c=_0x5eca4f;logger[_0xc741('0xb')](_0xc741('0x4e'),_0x2fa98c['id']);return getTicket(_0x432311,_0x349120,_0x2fa98c,_0x3177ed,_0x588b38);})[_0xc741('0x1e')](function(_0x3ae194){if(_0x3ae194){logger['info'](_0xc741('0x1f'));logger[_0xc741('0xb')](_0xc741('0x4f'),_0x3ae194['id']);}})[_0xc741('0x53')](function(_0x670537){logger['error']('['+_0x588b38[_0xc741('0x5e')][_0xc741('0x5f')]()+']',JSON[_0xc741('0x5c')](_0x670537));});}; \ 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 707283e..2a4ca71 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 _0xd1c4=['&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','endUserId','Contact\x20found\x20mobile_number:','work_number','contactNumber','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','error','/api/lookup?q='];(function(_0x57fea4,_0x20fe14){var _0x1d5621=function(_0x14c27e){while(--_0x14c27e){_0x57fea4['push'](_0x57fea4['shift']());}};_0x1d5621(++_0x20fe14);}(_0xd1c4,0x1da));var _0x4d1c=function(_0x5970ff,_0x18b1c5){_0x5970ff=_0x5970ff-0x0;var _0x186043=_0xd1c4[_0x5970ff];return _0x186043;};'use strict';var _=require(_0x4d1c('0x0'));var rp=require(_0x4d1c('0x1'));var md5=require(_0x4d1c('0x2'));var util=require('util');var moment=require(_0x4d1c('0x3'));var Promise=require(_0x4d1c('0x4'));var Redis=require(_0x4d1c('0x5'));var intUtil=require(_0x4d1c('0x6'));var config=require(_0x4d1c('0x7'));var logger=require(_0x4d1c('0x8'))(_0x4d1c('0x9'));config[_0x4d1c('0xa')]=_[_0x4d1c('0xb')](config[_0x4d1c('0xa')],{'host':_0x4d1c('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4d1c('0xa')]));function getAdminId(_0x4aa71a,_0x37ecfd,_0x2daa96,_0xcf108d){return new Promise(function(_0x27efcd,_0x344404){var _0x435673=![];var _0x5c6815={'method':_0x4d1c('0xd'),'uri':_0xcf108d+_0x4d1c('0xe'),'json':!![]};_0x5c6815[_0x4d1c('0xf')]=_0x2daa96;logger[_0x4d1c('0x10')](_0x4d1c('0x11'));return rp(_0x5c6815)[_0x4d1c('0x12')](function(_0x5d5dcc){if(_0x5d5dcc){var _0x5a2efb=_0x5d5dcc[_0x4d1c('0x13')];var _0xa89a8=null;for(_0xa89a8=0x0;_0xa89a8<_0x5a2efb['length'];_0xa89a8++){if(_0x5a2efb[_0xa89a8][_0x4d1c('0x14')]===_0x4aa71a['adminEmail']){_0x4aa71a[_0x4d1c('0x15')]=_0x5a2efb[_0xa89a8]['id'];_0x435673=!![];}}if(_0x435673){logger[_0x4d1c('0x10')]('Admin\x20found:',_0x4aa71a[_0x4d1c('0x15')]);_0x27efcd(_0x4aa71a);}else{_0x344404({'statusCode':0x194,'message':_0x4d1c('0x16')});}}else{_0x344404({'statusCode':0x194,'message':_0x4d1c('0x16')});}})[_0x4d1c('0x17')](function(_0x3454ac){logger['error']('['+[_0x37ecfd[_0x4d1c('0x18')]()]+']',_0x3454ac[_0x4d1c('0x19')]);_0x344404(_0x3454ac);});});}function getUser(_0x2fb35d,_0x14b3ff,_0x21b234){return function(_0x3d19a4){return new Promise(function(_0x3e968b,_0xb0701){var _0x16f2dc={'method':_0x4d1c('0xd'),'uri':_0x21b234+_0x4d1c('0xe'),'json':!![]};_0x16f2dc[_0x4d1c('0xf')]=_0x14b3ff;logger[_0x4d1c('0x10')]('Getting\x20user\x20list');return rp(_0x16f2dc)[_0x4d1c('0x12')](function(_0xcf8bd0){if(_0xcf8bd0){var _0x4113aa=_0xcf8bd0[_0x4d1c('0x13')];var _0x14008e=![];var _0x2c7da5=null;if(_0x3d19a4[_0x4d1c('0x1a')]!==null){logger[_0x4d1c('0x10')](_0x4d1c('0x1b'),_0x3d19a4[_0x4d1c('0x1a')]);_0x3d19a4['userEmail']=_0x3d19a4[_0x4d1c('0x1a')];for(_0x2c7da5=0x0;_0x2c7da5<_0x4113aa[_0x4d1c('0x1c')];_0x2c7da5++){if(_0x4113aa[_0x2c7da5][_0x4d1c('0x14')]===_0x3d19a4[_0x4d1c('0x1a')]){_0x14008e=!![];_0x3d19a4[_0x4d1c('0x1d')]=_0x4113aa[_0x2c7da5]['id'];logger[_0x4d1c('0x10')](_0x4d1c('0x1e'),_0x3d19a4[_0x4d1c('0x1d')]);}}}if(!_0x14008e){logger[_0x4d1c('0x10')](_0x4d1c('0x1f'));_0x3d19a4[_0x4d1c('0x20')]=_0x3d19a4[_0x4d1c('0x21')];_0x3d19a4['userId']=_0x3d19a4[_0x4d1c('0x15')];_0x14008e=!![];}if(_0x14008e){_0x3e968b(_0x3d19a4);}else{_0xb0701({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xb0701({'statusCode':0x194,'message':_0x4d1c('0x16')});}})[_0x4d1c('0x17')](function(_0x1066eb){logger[_0x4d1c('0x22')]('['+[_0x2fb35d[_0x4d1c('0x18')]()]+']',_0x1066eb['message']);_0xb0701(_0x1066eb);});});};}function searchContact(_0x43ecea,_0xeb6012,_0x473ae0,_0x32329e){return new Promise(function(_0x2f1a77,_0x289ca9){var _0x5e602d={'method':_0x4d1c('0xd'),'headers':_0xeb6012,'uri':_0x43ecea+_0x4d1c('0x23')+_0x32329e+_0x4d1c('0x24')+_0x473ae0+_0x4d1c('0x25'),'json':!![]};rp(_0x5e602d)[_0x4d1c('0x12')](function(_0x5c99ef){var _0x308501=_[_0x4d1c('0x26')](_0x5c99ef[_0x4d1c('0x27')]['contacts'],[_0x473ae0,_0x32329e]);_0x2f1a77(_0x308501);})[_0x4d1c('0x17')](function(_0x3feedd){_0x289ca9(_0x3feedd);});});}function getEndUser(_0x4afabf,_0x1b0f31,_0x3a9aab){return function(_0x4157fc){return new Promise(function(_0x51bbc6,_0x70a2e9){logger[_0x4d1c('0x10')](util[_0x4d1c('0x28')](_0x4d1c('0x29'),_0x4157fc['contactNumber']));searchContact(_0x3a9aab,_0x1b0f31,'mobile_number',_0x4157fc['contactNumber'])[_0x4d1c('0x12')](function(_0x46db24){if(_0x46db24){_0x4157fc[_0x4d1c('0x2a')]=_0x46db24['id'];logger[_0x4d1c('0x10')](_0x4d1c('0x2b'),_0x4157fc['endUserId']);return _0x51bbc6(_0x4157fc);}searchContact(_0x3a9aab,_0x1b0f31,_0x4d1c('0x2c'),_0x4157fc[_0x4d1c('0x2d')])[_0x4d1c('0x12')](function(_0x6f32f){if(_0x6f32f){_0x4157fc[_0x4d1c('0x2a')]=_0x6f32f['id'];logger[_0x4d1c('0x10')]('Contact\x20found\x20work_number:',_0x4157fc[_0x4d1c('0x2a')]);return _0x51bbc6(_0x4157fc);}createEndUser(_0x4157fc,_0x4afabf,_0x1b0f31,_0x3a9aab)['then'](function(_0x5bd5a6){logger['info'](_0x4d1c('0x2e'),_0x5bd5a6[_0x4d1c('0x2a')]);return _0x51bbc6(_0x5bd5a6);});});})[_0x4d1c('0x17')](function(_0x341d67){_0x70a2e9(_0x341d67);});});};}function createEndUser(_0xef7fc,_0x25ec25,_0x150b06,_0xf2f3f1){return new Promise(function(_0x418f62,_0x2f4ec5){var _0x21eb6d=moment();var _0x7c67ec={'method':'POST','uri':_0xf2f3f1+'/api/contacts','body':{'contact':{'last_name':_0xef7fc[_0x4d1c('0x2d')],'work_number':_0xef7fc[_0x4d1c('0x2d')],'mobile_number':_0xef7fc['contactNumber'],'owner_id':_0xef7fc['userId'],'created_at':_0x21eb6d[_0x4d1c('0x28')](_0x4d1c('0x2f'))}},'json':!![]};_0x7c67ec[_0x4d1c('0xf')]=_0x150b06;logger[_0x4d1c('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x7c67ec)[_0x4d1c('0x12')](function(_0x33d688){_0xef7fc[_0x4d1c('0x2a')]=_0x33d688[_0x4d1c('0x30')]['id'];_0x418f62(_0xef7fc);})[_0x4d1c('0x17')](function(_0x430d50){logger[_0x4d1c('0x22')]('['+[_0x25ec25[_0x4d1c('0x18')]()]+']',_0x430d50[_0x4d1c('0x19')]);_0x2f4ec5(_0x430d50[_0x4d1c('0x19')]);});});}function getTicket(_0x59625a,_0x2b1e93,_0x534e2a,_0x3d5fa3,_0x1f84b0){return function(_0x277874){logger[_0x4d1c('0x10')](_0x4d1c('0x31'));return new Promise(function(_0x28297f,_0x4cf7b7){var _0x468938=moment();var _0x37008d={'method':_0x4d1c('0x32'),'uri':_0x534e2a+_0x4d1c('0x33'),'body':{'title':intUtil[_0x4d1c('0x34')](_0x3d5fa3[_0x4d1c('0x35')],_0x1f84b0,'\x20'),'description':intUtil['getString'](_0x3d5fa3[_0x4d1c('0x36')],_0x1f84b0,'\x0a'),'owner_id':_0x277874['userId'],'creater_id':_0x277874['adminId'],'targetable_id':_0x277874[_0x4d1c('0x2a')],'targetable_type':'Contact','created_at':_0x468938['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x468938[_0x4d1c('0x37')](0x1e,'m')[_0x4d1c('0x28')](_0x4d1c('0x2f'))},'json':!![]};_0x37008d[_0x4d1c('0xf')]=_0x2b1e93;return rp(_0x37008d)['then'](function(_0x54742c){_0x277874['ticketId']=_0x54742c[_0x4d1c('0x38')]['id'];logger[_0x4d1c('0x10')](_0x4d1c('0x39'),_0x277874[_0x4d1c('0x3a')]);_0x28297f(_0x277874);})['catch'](function(_0x29f876){logger[_0x4d1c('0x22')]('['+[_0x59625a[_0x4d1c('0x18')]()]+']',_0x29f876[_0x4d1c('0x19')]);_0x4cf7b7(_0x29f876[_0x4d1c('0x19')]);});});};}function emit(_0x1f089c,_0x24ad8d,_0x54ceaf){var _0x5f25a3={'uri':_0x1f089c+_0x4d1c('0x3b')+_0x54ceaf};io['to'](util[_0x4d1c('0x28')](_0x4d1c('0x3c'),_0x24ad8d))[_0x4d1c('0x3d')](_0x4d1c('0x3e'),_0x5f25a3);}exports['cs']=function(_0x4654a2,_0x13d33a,_0x2f9c9c,_0x3d19c8,_0x5c939d,_0x28f4b9,_0x46c348,_0xd9dec9){var _0x2aa492={};var _0x41c5c8={'Authorization':'Token\x20token='+_0x28f4b9['apiKey']};_0x28f4b9[_0x4d1c('0x3f')]=intUtil[_0x4d1c('0x40')](_0x28f4b9[_0x4d1c('0x3f')]);_0x28f4b9[_0x4d1c('0x41')]=intUtil[_0x4d1c('0x40')](_0x28f4b9[_0x4d1c('0x41')]);var _0x56bcbc=_0x28f4b9['remoteUri'];_0x2aa492[_0x4d1c('0x21')]=_0x28f4b9[_0x4d1c('0x42')];_0x2aa492[_0x4d1c('0x2d')]=_0xd9dec9[_0x4d1c('0x43')]()===_0x4d1c('0x44')?_0x13d33a[_0x4d1c('0x45')]:_0x13d33a[_0x4d1c('0x46')];_0x2aa492[_0x4d1c('0x47')]=_0xd9dec9==='queue'||_0xd9dec9===_0x4d1c('0x48')?'queue':_0x4d1c('0x44');if(_0x3d19c8){_0x2aa492['agentEmail']=_0x3d19c8[_0x4d1c('0x14')];}var _0x27f8ef=util[_0x4d1c('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28f4b9[_0x4d1c('0x41')],_0x13d33a[_0x4d1c('0x49')],md5(_0x13d33a['uniqueid']));if(_0x5c939d&&_0x5c939d[_0x4d1c('0x4a')]){logger[_0x4d1c('0x10')](_0x4d1c('0x4b'),'Recording\x20is\x20enabled!');_0x13d33a[_0x4d1c('0x4c')]=_0x27f8ef;}else if(_0x46c348&&_0x46c348['recordingFormat']&&_0x46c348[_0x4d1c('0x4d')]!==_0x4d1c('0x4e')){logger['info'](_0x4d1c('0x4f'),_0x4d1c('0x50'));_0x13d33a['recordingURL']=_0x27f8ef;}else{_0x13d33a[_0x4d1c('0x4c')]='';}return getAdminId(_0x2aa492,_0xd9dec9,_0x41c5c8,_0x56bcbc)[_0x4d1c('0x12')](getUser(_0xd9dec9,_0x41c5c8,_0x56bcbc))['then'](getEndUser(_0xd9dec9,_0x41c5c8,_0x56bcbc))['then'](getTicket(_0xd9dec9,_0x41c5c8,_0x56bcbc,_0x2f9c9c,_0x13d33a))[_0x4d1c('0x12')](function(_0x547577){logger['info'](util['format'](_0x4d1c('0x51'),_0x547577['ticketId']));if(_0xd9dec9!==_0x4d1c('0x48')){logger['info']('['+[_0xd9dec9[_0x4d1c('0x18')]()]+']',_0x4d1c('0x52'));emit(_0x56bcbc,_0x3d19c8[_0x4d1c('0x53')],_0x547577['endUserId']);}})[_0x4d1c('0x17')](function(_0x32c890){logger[_0x4d1c('0x22')]('['+[_0xd9dec9[_0x4d1c('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x4d1c('0x54')](_0x32c890,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2a5a=['then','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','users','agentEmail','userEmail','userId','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Descriptions','add','YYYY-MM-DDTHH:mm:ss','ticketId','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info'];(function(_0x104662,_0x53a7a7){var _0x19cba7=function(_0x5a76c0){while(--_0x5a76c0){_0x104662['push'](_0x104662['shift']());}};_0x19cba7(++_0x53a7a7);}(_0x2a5a,0x1e2));var _0xa2a5=function(_0x223e1d,_0x436cb8){_0x223e1d=_0x223e1d-0x0;var _0x1afc30=_0x2a5a[_0x223e1d];return _0x1afc30;};'use strict';var _=require('lodash');var rp=require(_0xa2a5('0x0'));var md5=require(_0xa2a5('0x1'));var util=require(_0xa2a5('0x2'));var moment=require('moment');var Promise=require(_0xa2a5('0x3'));var Redis=require(_0xa2a5('0x4'));var intUtil=require(_0xa2a5('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa2a5('0x6'))(_0xa2a5('0x7'));config[_0xa2a5('0x8')]=_[_0xa2a5('0x9')](config[_0xa2a5('0x8')],{'host':_0xa2a5('0xa'),'port':0x18eb});var io=require(_0xa2a5('0xb'))(new Redis(config['redis']));function getAdminId(_0x707516,_0xf87634,_0xe9bf2,_0x116c43){return new Promise(function(_0x2dd11c,_0x56a937){var _0x5938bd=![];var _0x33956a={'method':_0xa2a5('0xc'),'uri':_0x116c43+'/api/selector/owners','json':!![]};_0x33956a[_0xa2a5('0xd')]=_0xe9bf2;logger[_0xa2a5('0xe')]('Getting\x20admin\x20information');return rp(_0x33956a)[_0xa2a5('0xf')](function(_0xdebc9){if(_0xdebc9){var _0x23c980=_0xdebc9['users'];var _0x136063=null;for(_0x136063=0x0;_0x136063<_0x23c980[_0xa2a5('0x10')];_0x136063++){if(_0x23c980[_0x136063][_0xa2a5('0x11')]===_0x707516[_0xa2a5('0x12')]){_0x707516[_0xa2a5('0x13')]=_0x23c980[_0x136063]['id'];_0x5938bd=!![];}}if(_0x5938bd){logger[_0xa2a5('0xe')]('Admin\x20found:',_0x707516[_0xa2a5('0x13')]);_0x2dd11c(_0x707516);}else{_0x56a937({'statusCode':0x194,'message':_0xa2a5('0x14')});}}else{_0x56a937({'statusCode':0x194,'message':_0xa2a5('0x14')});}})[_0xa2a5('0x15')](function(_0x481e5c){logger[_0xa2a5('0x16')]('['+[_0xf87634[_0xa2a5('0x17')]()]+']',_0x481e5c[_0xa2a5('0x18')]);_0x56a937(_0x481e5c);});});}function getUser(_0x13acd7,_0x416c9b,_0x3683df){return function(_0x305941){return new Promise(function(_0x31afcf,_0x2b3fb3){var _0x55e0ab={'method':_0xa2a5('0xc'),'uri':_0x3683df+_0xa2a5('0x19'),'json':!![]};_0x55e0ab[_0xa2a5('0xd')]=_0x416c9b;logger['info']('Getting\x20user\x20list');return rp(_0x55e0ab)['then'](function(_0x1285a1){if(_0x1285a1){var _0x7b7d71=_0x1285a1[_0xa2a5('0x1a')];var _0x328d40=![];var _0x4afc6b=null;if(_0x305941[_0xa2a5('0x1b')]!==null){logger[_0xa2a5('0xe')]('Getting\x20user\x20with\x20email',_0x305941[_0xa2a5('0x1b')]);_0x305941[_0xa2a5('0x1c')]=_0x305941['agentEmail'];for(_0x4afc6b=0x0;_0x4afc6b<_0x7b7d71[_0xa2a5('0x10')];_0x4afc6b++){if(_0x7b7d71[_0x4afc6b][_0xa2a5('0x11')]===_0x305941[_0xa2a5('0x1b')]){_0x328d40=!![];_0x305941[_0xa2a5('0x1d')]=_0x7b7d71[_0x4afc6b]['id'];logger['info']('User\x20found:',_0x305941['userId']);}}}if(!_0x328d40){logger[_0xa2a5('0xe')]('Admin\x20selected');_0x305941[_0xa2a5('0x1c')]=_0x305941[_0xa2a5('0x12')];_0x305941[_0xa2a5('0x1d')]=_0x305941[_0xa2a5('0x13')];_0x328d40=!![];}if(_0x328d40){_0x31afcf(_0x305941);}else{_0x2b3fb3({'statusCode':0x194,'message':_0xa2a5('0x14')});}}else{_0x2b3fb3({'statusCode':0x194,'message':_0xa2a5('0x14')});}})[_0xa2a5('0x15')](function(_0x4eff84){logger[_0xa2a5('0x16')]('['+[_0x13acd7[_0xa2a5('0x17')]()]+']',_0x4eff84[_0xa2a5('0x18')]);_0x2b3fb3(_0x4eff84);});});};}function searchContact(_0x56a03a,_0x1b4410,_0x4944ef,_0x1cc34a){return new Promise(function(_0x8f716b,_0x4421ea){var _0x2b640a={'method':_0xa2a5('0xc'),'headers':_0x1b4410,'uri':_0x56a03a+'/api/lookup?q='+_0x1cc34a+_0xa2a5('0x1e')+_0x4944ef+_0xa2a5('0x1f'),'json':!![]};rp(_0x2b640a)['then'](function(_0x469362){var _0x9ddfc=_[_0xa2a5('0x20')](_0x469362[_0xa2a5('0x21')]['contacts'],[_0x4944ef,_0x1cc34a]);_0x8f716b(_0x9ddfc);})[_0xa2a5('0x15')](function(_0x184b8f){_0x4421ea(_0x184b8f);});});}function getEndUser(_0x2ae44c,_0x4c7e28,_0x41a98b){return function(_0x4191fc){return new Promise(function(_0x395c8e,_0x25827e){logger['info'](util['format'](_0xa2a5('0x22'),_0x4191fc[_0xa2a5('0x23')]));searchContact(_0x41a98b,_0x4c7e28,_0xa2a5('0x24'),_0x4191fc[_0xa2a5('0x23')])[_0xa2a5('0xf')](function(_0x1e4b54){if(_0x1e4b54){_0x4191fc[_0xa2a5('0x25')]=_0x1e4b54['id'];logger[_0xa2a5('0xe')](_0xa2a5('0x26'),_0x4191fc['endUserId']);return _0x395c8e(_0x4191fc);}searchContact(_0x41a98b,_0x4c7e28,_0xa2a5('0x27'),_0x4191fc[_0xa2a5('0x23')])[_0xa2a5('0xf')](function(_0x11c8a7){if(_0x11c8a7){_0x4191fc['endUserId']=_0x11c8a7['id'];logger[_0xa2a5('0xe')](_0xa2a5('0x28'),_0x4191fc[_0xa2a5('0x25')]);return _0x395c8e(_0x4191fc);}createEndUser(_0x4191fc,_0x2ae44c,_0x4c7e28,_0x41a98b)['then'](function(_0x536d61){logger[_0xa2a5('0xe')]('Contact\x20created:',_0x536d61[_0xa2a5('0x25')]);return _0x395c8e(_0x536d61);});});})[_0xa2a5('0x15')](function(_0x53ef46){_0x25827e(_0x53ef46);});});};}function createEndUser(_0x34dd06,_0x383e41,_0x2c458f,_0x3dd513){return new Promise(function(_0x1a42dd,_0x53dac5){var _0x184170=moment();var _0x1307ea={'method':'POST','uri':_0x3dd513+_0xa2a5('0x29'),'body':{'contact':{'last_name':_0x34dd06[_0xa2a5('0x23')],'work_number':_0x34dd06['contactNumber'],'mobile_number':_0x34dd06[_0xa2a5('0x23')],'owner_id':_0x34dd06[_0xa2a5('0x1d')],'created_at':_0x184170[_0xa2a5('0x2a')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1307ea[_0xa2a5('0xd')]=_0x2c458f;logger['info'](_0xa2a5('0x2b'));return rp(_0x1307ea)[_0xa2a5('0xf')](function(_0x518a8f){_0x34dd06[_0xa2a5('0x25')]=_0x518a8f['contact']['id'];_0x1a42dd(_0x34dd06);})[_0xa2a5('0x15')](function(_0x5bd808){logger[_0xa2a5('0x16')]('['+[_0x383e41[_0xa2a5('0x17')]()]+']',_0x5bd808[_0xa2a5('0x18')]);_0x53dac5(_0x5bd808[_0xa2a5('0x18')]);});});}function getTicket(_0x4e5985,_0x41716b,_0x2c4046,_0x30938b,_0x359d6e){return function(_0x1b1f35){logger[_0xa2a5('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x17444f,_0x142ab0){var _0x4390a5=moment();var _0x5d58a7={'method':'POST','uri':_0x2c4046+_0xa2a5('0x2c'),'body':{'title':intUtil[_0xa2a5('0x2d')](_0x30938b['Subjects'],_0x359d6e,'\x20'),'description':intUtil[_0xa2a5('0x2d')](_0x30938b[_0xa2a5('0x2e')],_0x359d6e,'\x0a'),'owner_id':_0x1b1f35[_0xa2a5('0x1d')],'creater_id':_0x1b1f35['adminId'],'targetable_id':_0x1b1f35['endUserId'],'targetable_type':'Contact','created_at':_0x4390a5[_0xa2a5('0x2a')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4390a5[_0xa2a5('0x2f')](0x1e,'m')[_0xa2a5('0x2a')](_0xa2a5('0x30'))},'json':!![]};_0x5d58a7['headers']=_0x41716b;return rp(_0x5d58a7)['then'](function(_0x3c258b){_0x1b1f35[_0xa2a5('0x31')]=_0x3c258b['task']['id'];logger[_0xa2a5('0xe')]('Task\x20created:',_0x1b1f35[_0xa2a5('0x31')]);_0x17444f(_0x1b1f35);})['catch'](function(_0x1e4de8){logger['error']('['+[_0x4e5985[_0xa2a5('0x17')]()]+']',_0x1e4de8[_0xa2a5('0x18')]);_0x142ab0(_0x1e4de8[_0xa2a5('0x18')]);});});};}function emit(_0x274de8,_0x512f35,_0x4260a1){var _0x4f17d8={'uri':_0x274de8+_0xa2a5('0x32')+_0x4260a1};io['to'](util[_0xa2a5('0x2a')]('user:%s',_0x512f35))[_0xa2a5('0x33')](_0xa2a5('0x34'),_0x4f17d8);}exports['cs']=function(_0x32d030,_0x342672,_0x5988fe,_0xaa28e0,_0x131a0e,_0x1ca669,_0x478af5,_0x2c6b7d){var _0x505710={};var _0x430963={'Authorization':_0xa2a5('0x35')+_0x1ca669[_0xa2a5('0x36')]};_0x1ca669[_0xa2a5('0x37')]=intUtil[_0xa2a5('0x38')](_0x1ca669[_0xa2a5('0x37')]);_0x1ca669[_0xa2a5('0x39')]=intUtil['stripTrailingSlash'](_0x1ca669[_0xa2a5('0x39')]);var _0x79dd6e=_0x1ca669['remoteUri'];_0x505710['adminEmail']=_0x1ca669[_0xa2a5('0x3a')];_0x505710['contactNumber']=_0x2c6b7d['toLowerCase']()===_0xa2a5('0x3b')?_0x342672['destcalleridnum']:_0x342672[_0xa2a5('0x3c')];_0x505710[_0xa2a5('0x3d')]=_0x2c6b7d===_0xa2a5('0x3e')||_0x2c6b7d==='unmanaged'?_0xa2a5('0x3e'):_0xa2a5('0x3b');if(_0xaa28e0){_0x505710[_0xa2a5('0x1b')]=_0xaa28e0['email'];}var _0x20245a=util[_0xa2a5('0x2a')](_0xa2a5('0x3f'),_0x1ca669[_0xa2a5('0x39')],_0x342672[_0xa2a5('0x40')],md5(_0x342672[_0xa2a5('0x40')]));if(_0x131a0e&&_0x131a0e['monitor_format']){logger[_0xa2a5('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x342672[_0xa2a5('0x41')]=_0x20245a;}else if(_0x478af5&&_0x478af5['recordingFormat']&&_0x478af5[_0xa2a5('0x42')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x342672[_0xa2a5('0x41')]=_0x20245a;}else{_0x342672[_0xa2a5('0x41')]='';}return getAdminId(_0x505710,_0x2c6b7d,_0x430963,_0x79dd6e)['then'](getUser(_0x2c6b7d,_0x430963,_0x79dd6e))[_0xa2a5('0xf')](getEndUser(_0x2c6b7d,_0x430963,_0x79dd6e))[_0xa2a5('0xf')](getTicket(_0x2c6b7d,_0x430963,_0x79dd6e,_0x5988fe,_0x342672))['then'](function(_0x16e2c2){logger[_0xa2a5('0xe')](util[_0xa2a5('0x2a')](_0xa2a5('0x43'),_0x16e2c2['ticketId']));if(_0x2c6b7d!==_0xa2a5('0x44')){logger[_0xa2a5('0xe')]('['+[_0x2c6b7d[_0xa2a5('0x17')]()]+']',_0xa2a5('0x45'));emit(_0x79dd6e,_0xaa28e0['name'],_0x16e2c2[_0xa2a5('0x25')]);}})[_0xa2a5('0x15')](function(_0x35a091){logger[_0xa2a5('0x16')]('['+[_0x2c6b7d[_0xa2a5('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xa2a5('0x46')](_0x35a091,{'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 65b713f..f0f24da 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 _0x0c4f=['./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','data1','toLowerCase','data2','Configurations','data3','queue','log','unmanaged','salesforce','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x5ba991,_0x4e09a7){var _0x55cb66=function(_0xfdfa12){while(--_0xfdfa12){_0x5ba991['push'](_0x5ba991['shift']());}};_0x55cb66(++_0x4e09a7);}(_0x0c4f,0x156));var _0xf0c4=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x0c4f[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0xf0c4('0x0'));var util=require(_0xf0c4('0x1'));var zendesk=require(_0xf0c4('0x2'));var salesforce=require(_0xf0c4('0x3'));var sugarcrm=require(_0xf0c4('0x4'));var freshdesk=require(_0xf0c4('0x5'));var zoho=require(_0xf0c4('0x6'));var desk=require(_0xf0c4('0x7'));var vtiger=require(_0xf0c4('0x8'));var servicenow=require(_0xf0c4('0x9'));var dynamics365=require(_0xf0c4('0xa'));var freshsales=require(_0xf0c4('0xb'));var integrations=[_0xf0c4('0xc'),'salesforce',_0xf0c4('0xd'),_0xf0c4('0xe'),_0xf0c4('0xf'),_0xf0c4('0x10'),_0xf0c4('0x11'),_0xf0c4('0x12'),_0xf0c4('0x13'),'servicenow'];exports['exec']=function(_0x2f3bf3,_0x20423a,_0x48aea3,_0x1d02a1,_0x35c020,_0x4fb11f){if(_0x48aea3){if(_['includes'](integrations,_0x2f3bf3[_0xf0c4('0x14')][_0xf0c4('0x15')]())){try{var _0x3fbc77=null;var _0x50237d='';var _0x37310c=_0x48aea3[_0x2f3bf3['data1'][_0xf0c4('0x15')]()];if(_0x37310c){var _0x5ef6ee=_0x37310c[_0x2f3bf3[_0xf0c4('0x16')]];if(_0x5ef6ee){var _0x549cc7=_['find'](_0x5ef6ee[_0xf0c4('0x17')],{'id':parseInt(_0x2f3bf3[_0xf0c4('0x18')],0xa)});if(_0x549cc7){if(_0x1d02a1){if(_0x35c020&&_0x20423a[_0xf0c4('0x19')]){_0x50237d=_0xf0c4('0x19');}else if(_0x20423a['routeId']){_0x50237d='outbound';}else{console[_0xf0c4('0x1a')]('EVENT\x20UNKNOWN',_0x20423a);}}else{_0x50237d=_0xf0c4('0x1b');}switch(_0x2f3bf3[_0xf0c4('0x14')][_0xf0c4('0x15')]()){case'zendesk':zendesk[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case _0xf0c4('0x1c'):salesforce[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case'sugarcrm':sugarcrm[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case _0xf0c4('0xe'):freshdesk[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case _0xf0c4('0xf'):zoho[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case _0xf0c4('0x10'):desk[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case'vtiger':vtiger[_0x50237d](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f);break;case _0xf0c4('0x13'):freshsales['cs'](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f,_0x50237d);break;case'servicenow':servicenow['cs'](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f,_0x50237d);break;case _0xf0c4('0x12'):dynamics365['cs'](_0x2f3bf3,_0x20423a,_0x549cc7,_0x1d02a1,_0x35c020,_0x5ef6ee,_0x4fb11f,_0x50237d);break;default:console[_0xf0c4('0x1a')]('unknown\x20integration');}}else{_0x3fbc77=require('../../../../config/logger')(_0x2f3bf3['data1']['toLowerCase']());_0x3fbc77['error']('[EXEC]',util[_0xf0c4('0x1d')](_0xf0c4('0x1e'),_0x2f3bf3[_0xf0c4('0x14')][_0xf0c4('0x15')](),_0x2f3bf3['data3']));}}else{_0x3fbc77=require('../../../../config/logger')(_0x2f3bf3[_0xf0c4('0x14')][_0xf0c4('0x15')]());_0x3fbc77['error']('[EXEC]',util[_0xf0c4('0x1d')](_0xf0c4('0x1f'),_0x2f3bf3['data1'][_0xf0c4('0x15')](),_0x2f3bf3[_0xf0c4('0x16')]));}}else{}}catch(_0x51b0fd){console['error'](_0x51b0fd);}}}}; \ No newline at end of file +var _0xdc3c=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','vtiger','freshsales','dynamics365','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0xad5f41,_0x10f299){_0xad5f41=_0xad5f41-0x0;var _0x397bfd=_0xdc3c[_0xad5f41];return _0x397bfd;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var zendesk=require(_0xcdc3('0x1'));var salesforce=require(_0xcdc3('0x2'));var sugarcrm=require(_0xcdc3('0x3'));var freshdesk=require(_0xcdc3('0x4'));var zoho=require(_0xcdc3('0x5'));var desk=require(_0xcdc3('0x6'));var vtiger=require(_0xcdc3('0x7'));var servicenow=require(_0xcdc3('0x8'));var dynamics365=require(_0xcdc3('0x9'));var freshsales=require(_0xcdc3('0xa'));var integrations=[_0xcdc3('0xb'),_0xcdc3('0xc'),_0xcdc3('0xd'),_0xcdc3('0xe'),_0xcdc3('0xf'),_0xcdc3('0x10'),'vtiger','dynamics365','freshsales',_0xcdc3('0x11')];exports[_0xcdc3('0x12')]=function(_0x1900a2,_0x14478e,_0x18ba5f,_0x3c8a53,_0x358771,_0x64c9af){if(_0x18ba5f){if(_[_0xcdc3('0x13')](integrations,_0x1900a2['data1']['toLowerCase']())){try{var _0x6cf272=null;var _0x1ea112='';var _0x1c22c5=_0x18ba5f[_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')]()];if(_0x1c22c5){var _0x20cf7c=_0x1c22c5[_0x1900a2[_0xcdc3('0x16')]];if(_0x20cf7c){var _0x359598=_['find'](_0x20cf7c[_0xcdc3('0x17')],{'id':parseInt(_0x1900a2['data3'],0xa)});if(_0x359598){if(_0x3c8a53){if(_0x358771&&_0x14478e[_0xcdc3('0x18')]){_0x1ea112='queue';}else if(_0x14478e[_0xcdc3('0x19')]){_0x1ea112=_0xcdc3('0x1a');}else{console[_0xcdc3('0x1b')](_0xcdc3('0x1c'),_0x14478e);}}else{_0x1ea112=_0xcdc3('0x1d');}switch(_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')]()){case _0xcdc3('0xb'):zendesk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xc'):salesforce[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xd'):sugarcrm[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xe'):freshdesk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case'zoho':zoho[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x10'):desk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x1e'):vtiger[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x1f'):freshsales['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;case _0xcdc3('0x11'):servicenow['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;case _0xcdc3('0x20'):dynamics365['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;default:console[_0xcdc3('0x1b')]('unknown\x20integration');}}else{_0x6cf272=require('../../../../config/logger')(_0x1900a2['data1'][_0xcdc3('0x15')]());_0x6cf272['error'](_0xcdc3('0x21'),util[_0xcdc3('0x22')](_0xcdc3('0x23'),_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')](),_0x1900a2[_0xcdc3('0x24')]));}}else{_0x6cf272=require(_0xcdc3('0x25'))(_0x1900a2['data1']['toLowerCase']());_0x6cf272[_0xcdc3('0x26')](_0xcdc3('0x21'),util[_0xcdc3('0x22')](_0xcdc3('0x27'),_0x1900a2['data1'][_0xcdc3('0x15')](),_0x1900a2[_0xcdc3('0x16')]));}}else{}}catch(_0x499d63){console[_0xcdc3('0x26')](_0x499d63);}}}}; \ 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 8f01af6..679492f 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 _0x04ca=['upperFirst','forEach','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridname','toUpperCase',']\x20Ticket\x20%s\x20created.','jsforce','util','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','additionalSearchAccount','Account','Lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s'];(function(_0xebc29a,_0x8c4f6d){var _0x5b0615=function(_0xa154ac){while(--_0xa154ac){_0xebc29a['push'](_0xebc29a['shift']());}};_0x5b0615(++_0x8c4f6d);}(_0x04ca,0xb8));var _0xa04c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x04ca[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xa04c('0x0'));var util=require(_0xa04c('0x1'));var Redis=require(_0xa04c('0x2'));var intUtil=require(_0xa04c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa04c('0x4'))('salesforce');config['redis']=_['defaults'](config[_0xa04c('0x5')],{'host':_0xa04c('0x6'),'port':0x18eb});var io=require(_0xa04c('0x7'))(new Redis(config['redis']));function emit(_0x2e66bc,_0x3951b2,_0x840411){io['to'](_0x2e66bc)[_0xa04c('0x8')](_0x3951b2,_0x840411);}function getTicket(_0x438b89,_0x5d6859,_0x730c04,_0x477f6e,_0x345f16,_0x391e72,_0x8e9765,_0x38f014){var _0x300bb9=Object[_0xa04c('0x9')]({},{'OwnerId':_0x5d6859['id'],'Subject':intUtil[_0xa04c('0xa')](_0x477f6e[_0xa04c('0xb')],_0x345f16,'\x20'),'Description':intUtil[_0xa04c('0xa')](_0x477f6e['Descriptions'],_0x345f16,'\x0a')},getCustomFields(_0x391e72,_0x345f16));if(_0x730c04){if(_0x477f6e[_0xa04c('0xc')]===_0xa04c('0xd')){_0x300bb9[_0xa04c('0xe')]=moment[_0xa04c('0xf')]();_0x300bb9['IsReminderSet']=![];_0x300bb9[_0xa04c('0x10')]=![];if(_0x730c04['endUserType']===_0xa04c('0x11')||_0x730c04[_0xa04c('0x12')]===_0xa04c('0x13')){_0x300bb9[_0xa04c('0x14')]=_0x730c04['id'];}else if(_0x730c04[_0xa04c('0x12')]==='account'){_0x300bb9[_0xa04c('0x15')]=_0x730c04['id'];}}else if(_0x477f6e[_0xa04c('0xc')]===_0xa04c('0x16')){if(_0x730c04[_0xa04c('0x12')]===_0xa04c('0x11')){_0x300bb9[_0xa04c('0x17')]=_0x730c04['id'];}else if(_0x730c04['endUserType']===_0xa04c('0x18')){_0x300bb9[_0xa04c('0x19')]=_0x730c04['id'];}else if(_0x730c04[_0xa04c('0x12')]===_0xa04c('0x13')&&_0x477f6e[_0xa04c('0x1a')]){_0x300bb9[_0x477f6e['leadId']]=_0x730c04['id'];}else{logger[_0xa04c('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x8e9765[_0xa04c('0x1c')](_0x477f6e[_0xa04c('0xc')])[_0xa04c('0x1d')](_0x300bb9);}function getUser(_0x1b1abb,_0x121aa8,_0x158b17){if(!_['isNil'](_0x121aa8)&&intUtil[_0xa04c('0x1e')](_0x121aa8)){var _0x4eb0c8={'Email':_0x121aa8};var _0x5bd994={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x158b17[_0xa04c('0x1c')](_0xa04c('0x1f'))[_0xa04c('0x20')](_0x4eb0c8,_0x5bd994)[_0xa04c('0x21')]()[_0xa04c('0x22')](function(_0x33358d){if(_0x33358d[_0xa04c('0x23')]){var _0x4bb65a=_[_0xa04c('0x20')](_0x33358d,function(_0x4f3499){return _0x4f3499['Email']===_0x121aa8;});if(_0x4bb65a){logger['info'](_0xa04c('0x24'),_0x121aa8);return BPromise[_0xa04c('0x25')]({'id':_0x4bb65a['Id'],'name':_0x4bb65a[_0xa04c('0x26')]});}}else{logger[_0xa04c('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x121aa8);return _0x158b17[_0xa04c('0x27')]()[_0xa04c('0x22')](function(_0x40fa9b){return BPromise[_0xa04c('0x25')]({'id':_0x40fa9b[_0xa04c('0x28')],'name':_0x40fa9b[_0xa04c('0x29')]});});}});}else{logger[_0xa04c('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x121aa8);return _0x158b17['identity']()[_0xa04c('0x22')](function(_0x312383){return BPromise[_0xa04c('0x25')]({'id':_0x312383['user_id'],'name':_0x312383[_0xa04c('0x29')]});});}}function getEndUser(_0x368093,_0x56b235,_0x341cc7,_0x5aa6fd,_0x700f93){var _0x4b02fe={'$or':{'Phone':_0x5aa6fd}};var _0xf299f2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0xa04c('0x1b')](_0xa04c('0x2a'),_0x5aa6fd,_0x56b235['moduleSearch']);switch(_0x56b235[_0xa04c('0x2b')]){case _0xa04c('0x2c'):var _0x53afd8=_['cloneDeep'](_0x4b02fe);if(_0x56b235[_0xa04c('0x2d')]){var _0x44290c={};_0x44290c[_0x56b235['additionalSearchContact']]=_0x5aa6fd;_[_0xa04c('0x2e')](_0x53afd8[_0xa04c('0x2f')],_0x44290c);}return _0x700f93['sobject'](_0xa04c('0x30'))['find'](_0x53afd8,_0xf299f2)['execute']()['then'](function(_0x943589){if(_0x943589&&_0x943589[_0xa04c('0x23')]){return _0x943589;}else{var _0x585acf=_[_0xa04c('0x31')](_0x4b02fe);if(_0x56b235[_0xa04c('0x32')]){var _0x488570={};_0x488570[_0x56b235[_0xa04c('0x32')]]=_0x5aa6fd;_[_0xa04c('0x2e')](_0x585acf[_0xa04c('0x2f')],_0x488570);}return _0x700f93[_0xa04c('0x1c')]('Lead')['find'](_0x585acf,_0xf299f2);}});case'account_contact_lead':var _0x57f82b=_['cloneDeep'](_0x4b02fe);if(_0x56b235[_0xa04c('0x33')]){var _0x44290c={};_0x44290c[_0x56b235['additionalSearchAccount']]=_0x5aa6fd;_[_0xa04c('0x2e')](_0x57f82b['$or'],_0x44290c);}return _0x700f93[_0xa04c('0x1c')](_0xa04c('0x34'))[_0xa04c('0x20')](_0x57f82b,_0xf299f2)[_0xa04c('0x21')]()[_0xa04c('0x22')](function(_0x476b30){if(_0x476b30&&_0x476b30[_0xa04c('0x23')]){return _0x476b30;}else{var _0x279d59=_[_0xa04c('0x31')](_0x4b02fe);if(_0x56b235[_0xa04c('0x2d')]){var _0x4b3df8={};_0x4b3df8[_0x56b235[_0xa04c('0x2d')]]=_0x5aa6fd;_['merge'](_0x279d59[_0xa04c('0x2f')],_0x4b3df8);}return _0x700f93[_0xa04c('0x1c')](_0xa04c('0x30'))[_0xa04c('0x20')](_0x279d59,_0xf299f2)['then'](function(_0x3c998d){if(_0x3c998d&&_0x3c998d[_0xa04c('0x23')]){return _0x3c998d;}else{var _0x5f557c=_[_0xa04c('0x31')](_0x4b02fe);if(_0x56b235[_0xa04c('0x32')]){var _0x588128={};_0x588128[_0x56b235['additionalSearchLead']]=_0x5aa6fd;_[_0xa04c('0x2e')](_0x5f557c['$or'],_0x588128);}return _0x700f93[_0xa04c('0x1c')](_0xa04c('0x35'))[_0xa04c('0x20')](_0x5f557c,_0xf299f2);}});}});case _0xa04c('0x11'):var _0x53afd8=_['cloneDeep'](_0x4b02fe);if(_0x56b235[_0xa04c('0x2d')]){var _0x44290c={};_0x44290c[_0x56b235['additionalSearchContact']]=_0x5aa6fd;_[_0xa04c('0x2e')](_0x53afd8[_0xa04c('0x2f')],_0x44290c);}return _0x700f93[_0xa04c('0x1c')](_0xa04c('0x30'))[_0xa04c('0x20')](_0x53afd8,_0xf299f2)[_0xa04c('0x21')]();case'lead':var _0x349935=_['cloneDeep'](_0x4b02fe);if(_0x56b235[_0xa04c('0x32')]){var _0x44290c={};_0x44290c[_0x56b235[_0xa04c('0x32')]]=_0x5aa6fd;_['merge'](_0x349935[_0xa04c('0x2f')],_0x44290c);}return _0x700f93[_0xa04c('0x1c')]('Lead')[_0xa04c('0x20')](_0x349935,_0xf299f2);case _0xa04c('0x18'):var _0x57f82b=_[_0xa04c('0x31')](_0x4b02fe);if(_0x56b235['additionalSearchAccount']){var _0x44290c={};_0x44290c[_0x56b235[_0xa04c('0x33')]]=_0x5aa6fd;_['merge'](_0x57f82b[_0xa04c('0x2f')],_0x44290c);}return _0x700f93['sobject']('Account')['find'](_0x57f82b,_0xf299f2);default:return null;}})[_0xa04c('0x22')](function(_0x5c5ce7){if(_0x5c5ce7&&_0x5c5ce7['length']){var _0x5a6c26=_[_0xa04c('0x36')](_0x5c5ce7);if(_0x5a6c26){return BPromise[_0xa04c('0x25')]({'id':_0x5a6c26['Id'],'name':_0x5a6c26['Name'],'phone':_0x5a6c26[_0xa04c('0x37')],'endUserType':_0x5a6c26[_0xa04c('0x38')]['type'][_0xa04c('0x39')]()});}}})['then'](function(_0x23a44a){if(_0x23a44a){logger[_0xa04c('0x1b')](_0xa04c('0x3a'),_0x23a44a[_0xa04c('0x12')],_0x5aa6fd);return BPromise[_0xa04c('0x25')](_0x23a44a);}else{logger['info'](_0xa04c('0x3b'),_0x5aa6fd);var _0x12396a={'Phone':_0x5aa6fd};if(_0x56b235[_0xa04c('0x3c')]){if(_0x56b235['moduleCreate']===_0xa04c('0x11')){logger[_0xa04c('0x1b')](_0xa04c('0x3d'),_0x5aa6fd,_0x56b235[_0xa04c('0x3c')]);_0x12396a[_0xa04c('0x3e')]=_0x341cc7!==_0xa04c('0x3f')?_0x341cc7:util[_0xa04c('0x40')](_0xa04c('0x41'),_0x5aa6fd);}else if(_0x56b235[_0xa04c('0x3c')]==='lead'){logger[_0xa04c('0x1b')](_0xa04c('0x3d'),_0x5aa6fd,_0x56b235['moduleCreate']);_0x12396a[_0xa04c('0x3e')]=_0x341cc7!==_0xa04c('0x3f')?_0x341cc7:util[_0xa04c('0x40')](_0xa04c('0x41'),_0x5aa6fd);_0x12396a['Company']='No\x20Company';}else if(_0x56b235[_0xa04c('0x3c')]===_0xa04c('0x18')){logger[_0xa04c('0x1b')](_0xa04c('0x3d'),_0x5aa6fd,_0x56b235['moduleCreate']);_0x12396a[_0xa04c('0x26')]=_0x341cc7!==_0xa04c('0x3f')?_0x341cc7:util[_0xa04c('0x40')](_0xa04c('0x41'),_0x5aa6fd);}else{return null;}}return _0x700f93[_0xa04c('0x1c')](_[_0xa04c('0x42')](_0x56b235['moduleCreate']))[_0xa04c('0x1d')](_0x12396a)[_0xa04c('0x22')](function(_0x3e0509){return BPromise[_0xa04c('0x25')]({'id':_0x3e0509['id'],'endUserType':_0x56b235[_0xa04c('0x3c')]});});}});}function getCustomFields(_0x19b893,_0x43039d){var _0x135302={};if(_0x19b893[_0xa04c('0x23')]>0x0){_[_0xa04c('0x43')](_0x19b893,function(_0x39fef2){if(_['includes']([_0xa04c('0x44'),_0xa04c('0x45')],_0x39fef2[_0xa04c('0x46')])&&_0x39fef2[_0xa04c('0x47')]){_0x135302[_0x39fef2[_0xa04c('0x47')]]=_0x39fef2[_0xa04c('0x48')][_0xa04c('0x49')]();}else if(_0x39fef2['type']==='variable'&&_0x39fef2[_0xa04c('0x4a')]&&_0x39fef2['idField']){_0x43039d[_0x39fef2['variableName']]&&(_0x135302[_0x39fef2[_0xa04c('0x47')]]=_0x43039d[_0x39fef2['variableName']][_0xa04c('0x49')]());}else if(_0x39fef2[_0xa04c('0x46')]===_0xa04c('0x4b')&&_0x39fef2[_0xa04c('0x4c')]&&_0x39fef2['Variable'][_0xa04c('0x4d')]&&_0x39fef2[_0xa04c('0x47')]){_0x43039d[_0x39fef2['Variable'][_0xa04c('0x4d')][_0xa04c('0x39')]()]&&(_0x135302[_0x39fef2[_0xa04c('0x47')]]=_0x43039d[_0x39fef2['Variable'][_0xa04c('0x4d')][_0xa04c('0x39')]()][_0xa04c('0x49')]());}});}return _0x135302;}function getConnection(_0x389e13){var _0x512ed9=_0x389e13[_0xa04c('0x4e')][_0xa04c('0x4f')](_0x389e13[_0xa04c('0x50')]);var _0x25d72b=new jsforce[(_0xa04c('0x51'))]({'oauth2':{'loginUrl':_0x389e13[_0xa04c('0x52')]||_0xa04c('0x53'),'clientId':_0x389e13[_0xa04c('0x54')],'clientSecret':_0x389e13[_0xa04c('0x55')]}});return _0x25d72b[_0xa04c('0x56')](_0x389e13[_0xa04c('0x57')],_0x512ed9)[_0xa04c('0x22')](function(){logger['info'](_0xa04c('0x58'));return _0x25d72b;});}exports[_0xa04c('0x59')]=function(_0x3db2c9,_0x25e456,_0x18b15e,_0x520267,_0x54189d,_0x531752){var _0x653316,_0x233f6c,_0x1dfb44,_0x4cae89;_0x531752[_0xa04c('0x5a')]=intUtil['stripTrailingSlash'](_0x531752[_0xa04c('0x5a')]);_0x531752['remoteUri']=intUtil[_0xa04c('0x5b')](_0x531752[_0xa04c('0x52')]);if(_0x54189d&&_0x54189d[_0xa04c('0x5c')]){logger[_0xa04c('0x1b')](_0xa04c('0x5d'),_0xa04c('0x5e'));_0x25e456[_0xa04c('0x5f')]=util[_0xa04c('0x40')](_0xa04c('0x60'),_0x531752['serverUrl'],_0x25e456[_0xa04c('0x61')],md5(_0x25e456[_0xa04c('0x61')]));}else{_0x25e456[_0xa04c('0x5f')]='';}return getConnection(_0x531752)[_0xa04c('0x22')](function(_0xeeb4c4){_0x4cae89=_0xeeb4c4;return getUser(_0x531752,_0x520267[_0xa04c('0x62')],_0x4cae89);})[_0xa04c('0x22')](function(_0x4d863a){_0x653316=_0x4d863a;return getEndUser(_0x531752,_0x18b15e,_0x25e456['calleridname'],_0x25e456['calleridnum'],_0x4cae89);})[_0xa04c('0x22')](function(_0x35ee62){_0x233f6c=_0x35ee62;return getTicket(_0x531752,_0x653316,_0x233f6c,_0x18b15e,_0x25e456,_0x18b15e[_0xa04c('0x63')],_0x4cae89,_0xa04c('0x59'));})['then'](function(_0x36583d){_0x1dfb44=_0x36583d;logger[_0xa04c('0x1b')](_0xa04c('0x64'),_0x1dfb44['id']);logger['info'](_0xa04c('0x65'),_0x1dfb44['id'],_0x520267['name'],_0x531752['type']);switch(_0x531752['type']){case'integrationTab':emit(util['format']('user:%s',_0x520267[_0xa04c('0x4d')]),_0xa04c('0x66'),{'recordId':_0x1dfb44['id']});break;case _0xa04c('0x67'):emit(util['format'](_0xa04c('0x68'),_0x520267[_0xa04c('0x4d')]),_0xa04c('0x69'),{'uri':util['format'](_0xa04c('0x6a'),_0x4cae89[_0xa04c('0x6b')],_0x1dfb44['id'])});break;default:logger['error'](_0xa04c('0x6c'));}})[_0xa04c('0x6d')](function(_0x14ca95){logger[_0xa04c('0x6e')](_0xa04c('0x5d'),_0x14ca95);});};exports[_0xa04c('0x6f')]=function(_0x51ae22,_0x2dcc2f,_0x496302,_0x460896,_0x50d61f,_0x2963ce,_0x3f79d0){var _0x1f04c3,_0x5b25cc,_0x21eed1,_0x4da0a6;_0x2963ce[_0xa04c('0x5a')]=intUtil[_0xa04c('0x5b')](_0x2963ce[_0xa04c('0x5a')]);_0x2963ce[_0xa04c('0x52')]=intUtil[_0xa04c('0x5b')](_0x2963ce[_0xa04c('0x52')]);if(_0x3f79d0&&_0x3f79d0[_0xa04c('0x70')]&&_0x3f79d0[_0xa04c('0x70')]!==_0xa04c('0x71')){logger[_0xa04c('0x1b')](_0xa04c('0x72'),_0xa04c('0x5e'));_0x2dcc2f[_0xa04c('0x5f')]=util[_0xa04c('0x40')](_0xa04c('0x60'),_0x2963ce[_0xa04c('0x5a')],_0x2dcc2f[_0xa04c('0x61')],md5(_0x2dcc2f['uniqueid']));}return getConnection(_0x2963ce)[_0xa04c('0x22')](function(_0xabfed9){_0x4da0a6=_0xabfed9;return getUser(_0x2963ce,_0x460896['email'],_0x4da0a6);})[_0xa04c('0x22')](function(_0x5e4e30){_0x1f04c3=_0x5e4e30;return getEndUser(_0x2963ce,_0x496302,_0x2dcc2f[_0xa04c('0x73')],_0x2dcc2f['destcalleridnum'],_0x4da0a6);})[_0xa04c('0x22')](function(_0x418780){_0x5b25cc=_0x418780;return getTicket(_0x2963ce,_0x1f04c3,_0x5b25cc,_0x496302,_0x2dcc2f,_0x496302[_0xa04c('0x63')],_0x4da0a6,'outbound');})[_0xa04c('0x22')](function(_0x49a96f){_0x21eed1=_0x49a96f;logger[_0xa04c('0x1b')](_0xa04c('0x74'),_0x21eed1['id']);logger[_0xa04c('0x1b')](_0xa04c('0x75'),_0x21eed1['id'],_0x460896['name'],_0x2963ce[_0xa04c('0x46')]);switch(_0x2963ce[_0xa04c('0x46')]){case _0xa04c('0x76'):emit(util[_0xa04c('0x40')](_0xa04c('0x68'),_0x460896['name']),_0xa04c('0x66'),{'recordId':_0x21eed1['id']});break;case'newTab':emit(util[_0xa04c('0x40')](_0xa04c('0x68'),_0x460896[_0xa04c('0x4d')]),_0xa04c('0x69'),{'uri':util[_0xa04c('0x40')]('%s/%s/e',_0x4da0a6[_0xa04c('0x6b')],_0x21eed1['id'])});break;default:logger['error'](_0xa04c('0x72'),_0xa04c('0x77'));}})[_0xa04c('0x6d')](function(_0x4528c7){logger[_0xa04c('0x6e')]('[OUTBOUND]',_0x4528c7);});};exports[_0xa04c('0x78')]=function(_0x38c953,_0x4cd8bf,_0x579399,_0x50e771,_0x46fa07,_0x28c5a3){var _0x568870,_0x2a0194,_0x5c040a,_0x4a5252;_0x28c5a3[_0xa04c('0x5a')]=intUtil[_0xa04c('0x5b')](_0x28c5a3[_0xa04c('0x5a')]);_0x28c5a3[_0xa04c('0x52')]=intUtil['stripTrailingSlash'](_0x28c5a3[_0xa04c('0x52')]);if(_0x46fa07&&_0x46fa07[_0xa04c('0x5c')]){logger['info']('['+_0x4cd8bf[_0xa04c('0x79')]['toUpperCase']()+']',_0xa04c('0x5e'));_0x4cd8bf[_0xa04c('0x5f')]=util['format'](_0xa04c('0x60'),_0x28c5a3[_0xa04c('0x5a')],_0x4cd8bf[_0xa04c('0x61')],md5(_0x4cd8bf[_0xa04c('0x61')]));}else{_0x4cd8bf[_0xa04c('0x5f')]='';}return getConnection(_0x28c5a3)[_0xa04c('0x22')](function(_0xa09fc0){_0x4a5252=_0xa09fc0;if(!_['isNil'](_0x50e771)){return getUser(_0x28c5a3,_0x50e771['name'],_0x4a5252);}else{return getUser(_0x28c5a3,null,_0x4a5252);}})[_0xa04c('0x22')](function(_0x3f61e5){_0x568870=_0x3f61e5;return getEndUser(_0x28c5a3,_0x579399,_0x4cd8bf[_0xa04c('0x7a')],_0x4cd8bf['calleridnum'],_0x4a5252);})[_0xa04c('0x22')](function(_0x202fe7){_0x2a0194=_0x202fe7;return getTicket(_0x28c5a3,_0x568870,_0x2a0194,_0x579399,_0x4cd8bf,_0x579399[_0xa04c('0x63')],_0x4a5252);})['then'](function(_0x609966){_0x5c040a=_0x609966;logger['info']('['+_0x4cd8bf[_0xa04c('0x79')][_0xa04c('0x7b')]()+_0xa04c('0x7c'),_0x5c040a['id']);logger[_0xa04c('0x1b')]('['+_0x4cd8bf[_0xa04c('0x79')][_0xa04c('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x28c5a3[_0xa04c('0x46')]);})[_0xa04c('0x6d')](function(_0x5cf3e8){logger['error']('['+_0x4cd8bf['lastevent'][_0xa04c('0x7b')]()+']',_0x5cf3e8);});}; \ No newline at end of file +var _0x4c8a=['unmanaged','toUpperCase','isNil','calleridnum','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','WhoId','account','Case','ContactId','AccountId','lead','leadId','info','sobject','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','Contact','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x4c8a,0x106));var _0xa4c8=function(_0x7396a3,_0x57ef30){_0x7396a3=_0x7396a3-0x0;var _0x17a2af=_0x4c8a[_0x7396a3];return _0x17a2af;};'use strict';var _=require(_0xa4c8('0x0'));var rp=require('request-promise');var moment=require(_0xa4c8('0x1'));var BPromise=require(_0xa4c8('0x2'));var md5=require(_0xa4c8('0x3'));var jsforce=require(_0xa4c8('0x4'));var util=require(_0xa4c8('0x5'));var Redis=require(_0xa4c8('0x6'));var intUtil=require(_0xa4c8('0x7'));var config=require(_0xa4c8('0x8'));var logger=require(_0xa4c8('0x9'))(_0xa4c8('0xa'));config[_0xa4c8('0xb')]=_['defaults'](config[_0xa4c8('0xb')],{'host':_0xa4c8('0xc'),'port':0x18eb});var io=require(_0xa4c8('0xd'))(new Redis(config[_0xa4c8('0xb')]));function emit(_0x5655cb,_0x4fc193,_0xbe8a20){io['to'](_0x5655cb)[_0xa4c8('0xe')](_0x4fc193,_0xbe8a20);}function getTicket(_0x8abc2f,_0x41b156,_0x39214e,_0x10c038,_0x13946c,_0x4d400e,_0x9e3976,_0xfb4afe){var _0x466be6=Object[_0xa4c8('0xf')]({},{'OwnerId':_0x41b156['id'],'Subject':intUtil[_0xa4c8('0x10')](_0x10c038['Subjects'],_0x13946c,'\x20'),'Description':intUtil['getString'](_0x10c038['Descriptions'],_0x13946c,'\x0a')},getCustomFields(_0x4d400e,_0x13946c));if(_0x39214e){if(_0x10c038[_0xa4c8('0x11')]===_0xa4c8('0x12')){_0x466be6[_0xa4c8('0x13')]=moment['utc']();_0x466be6['IsReminderSet']=![];_0x466be6[_0xa4c8('0x14')]=![];if(_0x39214e[_0xa4c8('0x15')]===_0xa4c8('0x16')||_0x39214e[_0xa4c8('0x15')]==='lead'){_0x466be6[_0xa4c8('0x17')]=_0x39214e['id'];}else if(_0x39214e['endUserType']===_0xa4c8('0x18')){_0x466be6['WhatId']=_0x39214e['id'];}}else if(_0x10c038[_0xa4c8('0x11')]===_0xa4c8('0x19')){if(_0x39214e[_0xa4c8('0x15')]===_0xa4c8('0x16')){_0x466be6[_0xa4c8('0x1a')]=_0x39214e['id'];}else if(_0x39214e[_0xa4c8('0x15')]===_0xa4c8('0x18')){_0x466be6[_0xa4c8('0x1b')]=_0x39214e['id'];}else if(_0x39214e[_0xa4c8('0x15')]===_0xa4c8('0x1c')&&_0x10c038[_0xa4c8('0x1d')]){_0x466be6[_0x10c038['leadId']]=_0x39214e['id'];}else{logger[_0xa4c8('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x9e3976[_0xa4c8('0x1f')](_0x10c038[_0xa4c8('0x11')])['create'](_0x466be6);}function getUser(_0x31d50b,_0x2c798c,_0x48ab53){if(!_['isNil'](_0x2c798c)&&intUtil[_0xa4c8('0x20')](_0x2c798c)){var _0x227074={'Email':_0x2c798c};var _0x456c3e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x48ab53[_0xa4c8('0x1f')](_0xa4c8('0x21'))[_0xa4c8('0x22')](_0x227074,_0x456c3e)[_0xa4c8('0x23')]()[_0xa4c8('0x24')](function(_0x3d096c){if(_0x3d096c[_0xa4c8('0x25')]){var _0x56edde=_['find'](_0x3d096c,function(_0x51d11f){return _0x51d11f[_0xa4c8('0x26')]===_0x2c798c;});if(_0x56edde){logger[_0xa4c8('0x1e')](_0xa4c8('0x27'),_0x2c798c);return BPromise[_0xa4c8('0x28')]({'id':_0x56edde['Id'],'name':_0x56edde[_0xa4c8('0x29')]});}}else{logger[_0xa4c8('0x1e')](_0xa4c8('0x2a'),_0x2c798c);return _0x48ab53[_0xa4c8('0x2b')]()[_0xa4c8('0x24')](function(_0x133aa9){return BPromise[_0xa4c8('0x28')]({'id':_0x133aa9[_0xa4c8('0x2c')],'name':_0x133aa9[_0xa4c8('0x2d')]});});}});}else{logger[_0xa4c8('0x1e')](_0xa4c8('0x2a'),_0x2c798c);return _0x48ab53['identity']()['then'](function(_0x25fef4){return BPromise[_0xa4c8('0x28')]({'id':_0x25fef4[_0xa4c8('0x2c')],'name':_0x25fef4['display_name']});});}}function getEndUser(_0xaa68ff,_0x29b90a,_0x1ace82,_0x19c4b8,_0x3d4014){var _0x3dfdde={'$or':{'Phone':_0x19c4b8}};var _0x3c7999={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa4c8('0x28')]()[_0xa4c8('0x24')](function(){logger[_0xa4c8('0x1e')](_0xa4c8('0x2e'),_0x19c4b8,_0x29b90a[_0xa4c8('0x2f')]);switch(_0x29b90a['moduleSearch']){case _0xa4c8('0x30'):var _0x1059b6=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x32')]){var _0x5bc9f9={};_0x5bc9f9[_0x29b90a[_0xa4c8('0x32')]]=_0x19c4b8;_['merge'](_0x1059b6['$or'],_0x5bc9f9);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x33'))[_0xa4c8('0x22')](_0x1059b6,_0x3c7999)['execute']()[_0xa4c8('0x24')](function(_0x35f810){if(_0x35f810&&_0x35f810[_0xa4c8('0x25')]){return _0x35f810;}else{var _0x522171=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a['additionalSearchLead']){var _0x55d980={};_0x55d980[_0x29b90a[_0xa4c8('0x34')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x522171[_0xa4c8('0x36')],_0x55d980);}return _0x3d4014['sobject'](_0xa4c8('0x37'))[_0xa4c8('0x22')](_0x522171,_0x3c7999);}});case _0xa4c8('0x38'):var _0x2ca04e=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x39')]){var _0x5bc9f9={};_0x5bc9f9[_0x29b90a[_0xa4c8('0x39')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x2ca04e[_0xa4c8('0x36')],_0x5bc9f9);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x3a'))[_0xa4c8('0x22')](_0x2ca04e,_0x3c7999)[_0xa4c8('0x23')]()[_0xa4c8('0x24')](function(_0x14e26f){if(_0x14e26f&&_0x14e26f[_0xa4c8('0x25')]){return _0x14e26f;}else{var _0x565949=_['cloneDeep'](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x32')]){var _0x3f1a92={};_0x3f1a92[_0x29b90a[_0xa4c8('0x32')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x565949[_0xa4c8('0x36')],_0x3f1a92);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x33'))[_0xa4c8('0x22')](_0x565949,_0x3c7999)[_0xa4c8('0x24')](function(_0x58855f){if(_0x58855f&&_0x58855f['length']){return _0x58855f;}else{var _0x226749=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x34')]){var _0x80a2a5={};_0x80a2a5[_0x29b90a[_0xa4c8('0x34')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x226749['$or'],_0x80a2a5);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x37'))[_0xa4c8('0x22')](_0x226749,_0x3c7999);}});}});case'contact':var _0x1059b6=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a['additionalSearchContact']){var _0x5bc9f9={};_0x5bc9f9[_0x29b90a['additionalSearchContact']]=_0x19c4b8;_['merge'](_0x1059b6[_0xa4c8('0x36')],_0x5bc9f9);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x33'))[_0xa4c8('0x22')](_0x1059b6,_0x3c7999)[_0xa4c8('0x23')]();case _0xa4c8('0x1c'):var _0x39b8d6=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x34')]){var _0x5bc9f9={};_0x5bc9f9[_0x29b90a[_0xa4c8('0x34')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x39b8d6['$or'],_0x5bc9f9);}return _0x3d4014['sobject'](_0xa4c8('0x37'))[_0xa4c8('0x22')](_0x39b8d6,_0x3c7999);case _0xa4c8('0x18'):var _0x2ca04e=_[_0xa4c8('0x31')](_0x3dfdde);if(_0x29b90a[_0xa4c8('0x39')]){var _0x5bc9f9={};_0x5bc9f9[_0x29b90a[_0xa4c8('0x39')]]=_0x19c4b8;_[_0xa4c8('0x35')](_0x2ca04e[_0xa4c8('0x36')],_0x5bc9f9);}return _0x3d4014[_0xa4c8('0x1f')](_0xa4c8('0x3a'))['find'](_0x2ca04e,_0x3c7999);default:return null;}})[_0xa4c8('0x24')](function(_0x13ba91){if(_0x13ba91&&_0x13ba91[_0xa4c8('0x25')]){var _0x18a718=_[_0xa4c8('0x3b')](_0x13ba91);if(_0x18a718){return BPromise[_0xa4c8('0x28')]({'id':_0x18a718['Id'],'name':_0x18a718[_0xa4c8('0x29')],'phone':_0x18a718[_0xa4c8('0x3c')],'endUserType':_0x18a718[_0xa4c8('0x3d')][_0xa4c8('0x3e')][_0xa4c8('0x3f')]()});}}})['then'](function(_0x418fd3){if(_0x418fd3){logger[_0xa4c8('0x1e')](_0xa4c8('0x40'),_0x418fd3[_0xa4c8('0x15')],_0x19c4b8);return BPromise[_0xa4c8('0x28')](_0x418fd3);}else{logger[_0xa4c8('0x1e')](_0xa4c8('0x41'),_0x19c4b8);var _0xe0009b={'Phone':_0x19c4b8};if(_0x29b90a[_0xa4c8('0x42')]){if(_0x29b90a[_0xa4c8('0x42')]===_0xa4c8('0x16')){logger[_0xa4c8('0x1e')](_0xa4c8('0x43'),_0x19c4b8,_0x29b90a['moduleCreate']);_0xe0009b[_0xa4c8('0x44')]=_0x1ace82!==_0xa4c8('0x45')?_0x1ace82:util[_0xa4c8('0x46')](_0xa4c8('0x47'),_0x19c4b8);}else if(_0x29b90a[_0xa4c8('0x42')]===_0xa4c8('0x1c')){logger[_0xa4c8('0x1e')](_0xa4c8('0x43'),_0x19c4b8,_0x29b90a[_0xa4c8('0x42')]);_0xe0009b[_0xa4c8('0x44')]=_0x1ace82!==''?_0x1ace82:util['format']('Caller\x20-\x20%s',_0x19c4b8);_0xe0009b[_0xa4c8('0x48')]=_0xa4c8('0x49');}else if(_0x29b90a[_0xa4c8('0x42')]===_0xa4c8('0x18')){logger['info'](_0xa4c8('0x43'),_0x19c4b8,_0x29b90a[_0xa4c8('0x42')]);_0xe0009b[_0xa4c8('0x29')]=_0x1ace82!==_0xa4c8('0x45')?_0x1ace82:util[_0xa4c8('0x46')]('Caller\x20-\x20%s',_0x19c4b8);}else{return null;}}return _0x3d4014[_0xa4c8('0x1f')](_[_0xa4c8('0x4a')](_0x29b90a[_0xa4c8('0x42')]))['create'](_0xe0009b)[_0xa4c8('0x24')](function(_0x1f3d59){return BPromise[_0xa4c8('0x28')]({'id':_0x1f3d59['id'],'endUserType':_0x29b90a[_0xa4c8('0x42')]});});}});}function getCustomFields(_0x92ba32,_0xc7ac16){var _0x42b5f8={};if(_0x92ba32['length']>0x0){_[_0xa4c8('0x4b')](_0x92ba32,function(_0x5ad9e1){if(_[_0xa4c8('0x4c')]([_0xa4c8('0x4d'),_0xa4c8('0x4e')],_0x5ad9e1[_0xa4c8('0x3e')])&&_0x5ad9e1[_0xa4c8('0x4f')]){_0x42b5f8[_0x5ad9e1[_0xa4c8('0x4f')]]=_0x5ad9e1[_0xa4c8('0x50')][_0xa4c8('0x51')]();}else if(_0x5ad9e1[_0xa4c8('0x3e')]===_0xa4c8('0x52')&&_0x5ad9e1[_0xa4c8('0x53')]&&_0x5ad9e1[_0xa4c8('0x4f')]){_0xc7ac16[_0x5ad9e1[_0xa4c8('0x53')]]&&(_0x42b5f8[_0x5ad9e1[_0xa4c8('0x4f')]]=_0xc7ac16[_0x5ad9e1[_0xa4c8('0x53')]][_0xa4c8('0x51')]());}else if(_0x5ad9e1[_0xa4c8('0x3e')]==='customVariable'&&_0x5ad9e1[_0xa4c8('0x54')]&&_0x5ad9e1[_0xa4c8('0x54')][_0xa4c8('0x55')]&&_0x5ad9e1['idField']){_0xc7ac16[_0x5ad9e1['Variable'][_0xa4c8('0x55')][_0xa4c8('0x3f')]()]&&(_0x42b5f8[_0x5ad9e1['idField']]=_0xc7ac16[_0x5ad9e1[_0xa4c8('0x54')]['name'][_0xa4c8('0x3f')]()][_0xa4c8('0x51')]());}});}return _0x42b5f8;}function getConnection(_0x5010a7){var _0x1ed338=_0x5010a7['password']['concat'](_0x5010a7[_0xa4c8('0x56')]);var _0x4b4fc2=new jsforce[(_0xa4c8('0x57'))]({'oauth2':{'loginUrl':_0x5010a7[_0xa4c8('0x58')]||_0xa4c8('0x59'),'clientId':_0x5010a7[_0xa4c8('0x5a')],'clientSecret':_0x5010a7['clientSecret']}});return _0x4b4fc2[_0xa4c8('0x5b')](_0x5010a7['username'],_0x1ed338)[_0xa4c8('0x24')](function(){logger[_0xa4c8('0x1e')](_0xa4c8('0x5c'));return _0x4b4fc2;});}exports['queue']=function(_0x2e7724,_0x3a2669,_0x4b86c9,_0x3af0fe,_0x1db75a,_0x63fcf5){var _0x99106e,_0x4c5af3,_0x21a41c,_0xf7282d;_0x63fcf5['serverUrl']=intUtil[_0xa4c8('0x5d')](_0x63fcf5[_0xa4c8('0x5e')]);_0x63fcf5['remoteUri']=intUtil[_0xa4c8('0x5d')](_0x63fcf5['remoteUri']);if(_0x1db75a&&_0x1db75a[_0xa4c8('0x5f')]){logger[_0xa4c8('0x1e')](_0xa4c8('0x60'),_0xa4c8('0x61'));_0x3a2669[_0xa4c8('0x62')]=util['format'](_0xa4c8('0x63'),_0x63fcf5[_0xa4c8('0x5e')],_0x3a2669['uniqueid'],md5(_0x3a2669[_0xa4c8('0x64')]));}else{_0x3a2669[_0xa4c8('0x62')]='';}return getConnection(_0x63fcf5)['then'](function(_0x2c24ad){_0xf7282d=_0x2c24ad;return getUser(_0x63fcf5,_0x3af0fe[_0xa4c8('0x65')],_0xf7282d);})[_0xa4c8('0x24')](function(_0x5b31e8){_0x99106e=_0x5b31e8;return getEndUser(_0x63fcf5,_0x4b86c9,_0x3a2669[_0xa4c8('0x66')],_0x3a2669['calleridnum'],_0xf7282d);})[_0xa4c8('0x24')](function(_0x3c002c){_0x4c5af3=_0x3c002c;return getTicket(_0x63fcf5,_0x99106e,_0x4c5af3,_0x4b86c9,_0x3a2669,_0x4b86c9[_0xa4c8('0x67')],_0xf7282d,_0xa4c8('0x68'));})[_0xa4c8('0x24')](function(_0x2e9e36){_0x21a41c=_0x2e9e36;logger['info'](_0xa4c8('0x69'),_0x21a41c['id']);logger[_0xa4c8('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x21a41c['id'],_0x3af0fe['name'],_0x63fcf5[_0xa4c8('0x3e')]);switch(_0x63fcf5['type']){case _0xa4c8('0x6a'):emit(util[_0xa4c8('0x46')](_0xa4c8('0x6b'),_0x3af0fe[_0xa4c8('0x55')]),_0xa4c8('0x6c'),{'recordId':_0x21a41c['id']});break;case _0xa4c8('0x6d'):emit(util[_0xa4c8('0x46')](_0xa4c8('0x6b'),_0x3af0fe[_0xa4c8('0x55')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0xf7282d['instanceUrl'],_0x21a41c['id'])});break;default:logger[_0xa4c8('0x6e')](_0xa4c8('0x6f'));}})[_0xa4c8('0x70')](function(_0x3ac428){logger[_0xa4c8('0x6e')](_0xa4c8('0x60'),_0x3ac428);});};exports[_0xa4c8('0x71')]=function(_0x3c2d9a,_0x4880a3,_0x56a934,_0x4c07f3,_0x1d4624,_0x57e262,_0x16e6ce){var _0x4cf70d,_0x2019b9,_0x144e73,_0x1fa3a8;_0x57e262[_0xa4c8('0x5e')]=intUtil[_0xa4c8('0x5d')](_0x57e262[_0xa4c8('0x5e')]);_0x57e262['remoteUri']=intUtil[_0xa4c8('0x5d')](_0x57e262['remoteUri']);if(_0x16e6ce&&_0x16e6ce[_0xa4c8('0x72')]&&_0x16e6ce[_0xa4c8('0x72')]!=='none'){logger[_0xa4c8('0x1e')](_0xa4c8('0x73'),_0xa4c8('0x61'));_0x4880a3['recordingURL']=util[_0xa4c8('0x46')](_0xa4c8('0x63'),_0x57e262[_0xa4c8('0x5e')],_0x4880a3[_0xa4c8('0x64')],md5(_0x4880a3[_0xa4c8('0x64')]));}return getConnection(_0x57e262)[_0xa4c8('0x24')](function(_0x3d6f1d){_0x1fa3a8=_0x3d6f1d;return getUser(_0x57e262,_0x4c07f3[_0xa4c8('0x65')],_0x1fa3a8);})[_0xa4c8('0x24')](function(_0x1fb70c){_0x4cf70d=_0x1fb70c;return getEndUser(_0x57e262,_0x56a934,_0x4880a3[_0xa4c8('0x74')],_0x4880a3[_0xa4c8('0x75')],_0x1fa3a8);})['then'](function(_0x258901){_0x2019b9=_0x258901;return getTicket(_0x57e262,_0x4cf70d,_0x2019b9,_0x56a934,_0x4880a3,_0x56a934[_0xa4c8('0x67')],_0x1fa3a8,_0xa4c8('0x71'));})['then'](function(_0x3eb3b2){_0x144e73=_0x3eb3b2;logger['info'](_0xa4c8('0x76'),_0x144e73['id']);logger[_0xa4c8('0x1e')](_0xa4c8('0x77'),_0x144e73['id'],_0x4c07f3[_0xa4c8('0x55')],_0x57e262['type']);switch(_0x57e262[_0xa4c8('0x3e')]){case _0xa4c8('0x6a'):emit(util[_0xa4c8('0x46')]('user:%s',_0x4c07f3['name']),_0xa4c8('0x6c'),{'recordId':_0x144e73['id']});break;case _0xa4c8('0x6d'):emit(util[_0xa4c8('0x46')]('user:%s',_0x4c07f3[_0xa4c8('0x55')]),'trigger:browser:url',{'uri':util[_0xa4c8('0x46')]('%s/%s/e',_0x1fa3a8[_0xa4c8('0x78')],_0x144e73['id'])});break;default:logger['error'](_0xa4c8('0x73'),_0xa4c8('0x79'));}})['catch'](function(_0x456bde){logger[_0xa4c8('0x6e')](_0xa4c8('0x73'),_0x456bde);});};exports[_0xa4c8('0x7a')]=function(_0x51c8ab,_0x304b53,_0x5259b6,_0x3cb27c,_0x452a5c,_0x2a8902){var _0x5980,_0x3bffc7,_0x2ba07d,_0x2c584a;_0x2a8902['serverUrl']=intUtil[_0xa4c8('0x5d')](_0x2a8902[_0xa4c8('0x5e')]);_0x2a8902[_0xa4c8('0x58')]=intUtil[_0xa4c8('0x5d')](_0x2a8902[_0xa4c8('0x58')]);if(_0x452a5c&&_0x452a5c[_0xa4c8('0x5f')]){logger['info']('['+_0x304b53['lastevent'][_0xa4c8('0x7b')]()+']',_0xa4c8('0x61'));_0x304b53[_0xa4c8('0x62')]=util[_0xa4c8('0x46')](_0xa4c8('0x63'),_0x2a8902[_0xa4c8('0x5e')],_0x304b53[_0xa4c8('0x64')],md5(_0x304b53[_0xa4c8('0x64')]));}else{_0x304b53[_0xa4c8('0x62')]='';}return getConnection(_0x2a8902)[_0xa4c8('0x24')](function(_0x2514e8){_0x2c584a=_0x2514e8;if(!_[_0xa4c8('0x7c')](_0x3cb27c)){return getUser(_0x2a8902,_0x3cb27c[_0xa4c8('0x55')],_0x2c584a);}else{return getUser(_0x2a8902,null,_0x2c584a);}})[_0xa4c8('0x24')](function(_0x26b5e6){_0x5980=_0x26b5e6;return getEndUser(_0x2a8902,_0x5259b6,_0x304b53[_0xa4c8('0x66')],_0x304b53[_0xa4c8('0x7d')],_0x2c584a);})[_0xa4c8('0x24')](function(_0x36c8da){_0x3bffc7=_0x36c8da;return getTicket(_0x2a8902,_0x5980,_0x3bffc7,_0x5259b6,_0x304b53,_0x5259b6[_0xa4c8('0x67')],_0x2c584a);})[_0xa4c8('0x24')](function(_0x212335){_0x2ba07d=_0x212335;logger['info']('['+_0x304b53[_0xa4c8('0x7e')][_0xa4c8('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x2ba07d['id']);logger[_0xa4c8('0x1e')]('['+_0x304b53[_0xa4c8('0x7e')][_0xa4c8('0x7b')]()+_0xa4c8('0x7f'),_0x2a8902['type']);})[_0xa4c8('0x70')](function(_0x3bbd52){logger[_0xa4c8('0x6e')]('['+_0x304b53[_0xa4c8('0x7e')][_0xa4c8('0x7b')]()+']',_0x3bbd52);});}; \ 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 ebe9a82..20dfcbc 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 _0x690a=['push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','true','adminEmail','],\x20getUser\x20crm','error','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','content','toString','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident\x20-\x20'];(function(_0x449f9d,_0x5bf3f5){var _0x5488a0=function(_0xac6406){while(--_0xac6406){_0x449f9d['push'](_0x449f9d['shift']());}};_0x5488a0(++_0x5bf3f5);}(_0x690a,0xfe));var _0xa690=function(_0x28d7c5,_0x1c1d87){_0x28d7c5=_0x28d7c5-0x0;var _0x577cb2=_0x690a[_0x28d7c5];return _0x577cb2;};'use strict';var _=require('lodash');var Promise=require(_0xa690('0x0'));var rp=require(_0xa690('0x1'));var util=require(_0xa690('0x2'));var md5=require(_0xa690('0x3'));var Redis=require(_0xa690('0x4'));var intUtil=require(_0xa690('0x5'));var config=require(_0xa690('0x6'));var logger=require('../../../../config/logger')(_0xa690('0x7'));config[_0xa690('0x8')]=_[_0xa690('0x9')](config[_0xa690('0x8')],{'host':_0xa690('0xa'),'port':0x18eb});var io=require(_0xa690('0xb'))(new Redis(config[_0xa690('0x8')]));function getAdminUser(_0x161591,_0x35a187,_0x427a89,_0x4f6ab1,_0x37eadf,_0x52600d){return new Promise(function(_0x3b19e9,_0x37e884){var _0x5deef0={'method':_0xa690('0xc'),'uri':_0x4f6ab1+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x37eadf+'&'+_0x52600d,'auth':_0x35a187,'json':!![]};return rp(_0x5deef0)[_0xa690('0xd')](function(_0x34fa1d){if(_0x34fa1d[_0xa690('0xe')][_0xa690('0xf')]>0x0){_0x427a89[_0xa690('0x10')]=_0x34fa1d[_0xa690('0xe')][0x0][_0xa690('0x11')];}logger['info']('['+[_0x161591[_0xa690('0x12')]()]+_0xa690('0x13'),_0x427a89);_0x3b19e9(_0x427a89);})[_0xa690('0x14')](function(_0x5bd4b6){logger['error']('['+[_0x161591[_0xa690('0x12')]()]+']',_0x5bd4b6[_0xa690('0x15')]);_0x37e884(_0x5bd4b6['message']);});});}function getUser(_0x886460,_0x339fa6,_0x2b7d96,_0x51d05a,_0x464cbd){return function(_0x324204){logger[_0xa690('0x16')]('['+[_0x886460[_0xa690('0x12')]()]+_0xa690('0x17'),_0x324204);return new Promise(function(_0x5ae1e4,_0x56f177){if(intUtil[_0xa690('0x18')](_0x324204[_0xa690('0x19')])){var _0x580165={'method':'GET','uri':_0x2b7d96+_0xa690('0x1a')+_0x324204['userEmail']+'&'+_0x51d05a+'&'+_0x464cbd,'auth':_0x339fa6,'json':!![]};logger[_0xa690('0x16')]('['+[_0x886460[_0xa690('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x580165);return rp(_0x580165)['then'](function(_0x4da7e7){logger['info']('['+[_0x886460[_0xa690('0x12')]()]+_0xa690('0x1b'),_0x4da7e7);if(_0x4da7e7['result']['length']>0x0&&String(_0x4da7e7[_0xa690('0xe')][0x0]['active'])===_0xa690('0x1c')){_0x324204['userId']=_0x4da7e7[_0xa690('0xe')][0x0]['sys_id'];}else{_0x324204['userId']=_0x324204[_0xa690('0x10')];_0x324204[_0xa690('0x19')]=_0x324204[_0xa690('0x1d')];}logger['info']('['+[_0x886460[_0xa690('0x12')]()]+_0xa690('0x1e'),_0x324204);_0x5ae1e4(_0x324204);})['catch'](function(_0x5ac330){logger[_0xa690('0x1f')]('['+[_0x886460[_0xa690('0x12')]()]+']',_0x5ac330['message']);_0x56f177(_0x5ac330[_0xa690('0x15')]);});}else{logger[_0xa690('0x16')]('['+[_0x886460[_0xa690('0x12')]()]+']\x20using\x20admin\x20profile');_0x324204[_0xa690('0x20')]=_0x324204[_0xa690('0x10')];_0x324204[_0xa690('0x19')]=_0x324204['adminEmail'];_0x5ae1e4(_0x324204);}});};}function createEndUser(_0x54f635,_0x218c05,_0x485236,_0x4cd976,_0xdf2a98){logger[_0xa690('0x16')]('['+[_0x54f635[_0xa690('0x12')]()]+_0xa690('0x21'),_0x485236);return new Promise(function(_0x58c4d7,_0x1764da){var _0x4b2ebb={'method':_0xa690('0x22'),'uri':_0x4cd976+_0xa690('0x23')+_0xdf2a98,'body':{'user_name':_0x485236[_0xa690('0x24')],'roles':_0xa690('0x25'),'first_name':_0x485236[_0xa690('0x24')],'active':'true','date_format':'System','phone':_0x485236['endUserNumber']},'auth':_0x218c05,'json':!![]};return rp(_0x4b2ebb)[_0xa690('0xd')](function(_0xc43ecb){logger['info']('['+[_0x54f635[_0xa690('0x12')]()]+'],\x20EndUser\x20schema',_0xc43ecb['result']);_0x485236[_0xa690('0x26')]=_0xc43ecb[_0xa690('0xe')]['sys_id'];_0x58c4d7(_0x485236);})['catch'](function(_0x50f62c){logger[_0xa690('0x1f')]('['+[_0x54f635[_0xa690('0x12')]()]+']',_0x50f62c[_0xa690('0x15')]);_0x1764da(_0x50f62c[_0xa690('0x15')]);});});}function getEndUser(_0x19e5a6,_0xbce039,_0x4bc1e9,_0x396c76,_0x3a6812){return function(_0x165ff4){logger[_0xa690('0x16')]('['+[_0x19e5a6[_0xa690('0x12')]()]+_0xa690('0x27'),_0x165ff4);return new Promise(function(_0x30f992,_0x420317){var _0x30ba69={'method':_0xa690('0xc'),'uri':_0x4bc1e9+_0xa690('0x28')+_0x165ff4[_0xa690('0x24')]+'&'+_0x396c76+'&'+_0x3a6812,'auth':_0xbce039,'json':!![]};return rp(_0x30ba69)[_0xa690('0xd')](function(_0x598c28){if(_0x598c28[_0xa690('0xe')][_0xa690('0xf')]>0x0){_0x165ff4[_0xa690('0x26')]=_0x598c28[_0xa690('0xe')][0x0][_0xa690('0x11')];logger[_0xa690('0x16')]('['+[_0x19e5a6[_0xa690('0x12')]()]+'],\x20getEndUser\x20crm',_0x165ff4);_0x30f992(_0x165ff4);}else{return createEndUser(_0x19e5a6,_0xbce039,_0x165ff4,_0x4bc1e9,_0x396c76)[_0xa690('0xd')](function(_0x69ccdf){logger[_0xa690('0x16')]('['+[_0x19e5a6[_0xa690('0x12')]()]+_0xa690('0x29'),_0x69ccdf);_0x30f992(_0x69ccdf);});}})[_0xa690('0x14')](function(_0x60b870){logger['error']('['+[_0x19e5a6[_0xa690('0x12')]()]+']',_0x60b870[_0xa690('0x15')]);_0x420317(_0x60b870[_0xa690('0x15')]);});});};}function getCustomFields(_0x510f3b,_0x1acd74){var _0x1e3db2={};if(_0x510f3b[_0xa690('0xf')]>0x0){_[_0xa690('0x2a')](_0x510f3b,function(_0x2b1982){if(_[_0xa690('0x2b')]([_0xa690('0x2c'),_0xa690('0x2d')],_0x2b1982['type'])&&_0x2b1982[_0xa690('0x2e')]&&!_0x2b1982[_0xa690('0x2f')]){_0x1e3db2[_0x2b1982['nameField']['toLowerCase']()]=_0x2b1982[_0xa690('0x30')][_0xa690('0x31')]();}else if(_[_0xa690('0x2b')](['string',_0xa690('0x2d')],_0x2b1982[_0xa690('0x32')])&&_0x2b1982[_0xa690('0x33')]&&_0x2b1982[_0xa690('0x2f')]){_0x1e3db2[_0x2b1982[_0xa690('0x33')][_0xa690('0x34')]()]=_0x2b1982[_0xa690('0x30')][_0xa690('0x31')]();}else if(_0x2b1982[_0xa690('0x32')]===_0xa690('0x35')&&_0x2b1982['variableName']&&_0x2b1982[_0xa690('0x33')]&&_0x2b1982[_0xa690('0x2f')]){_0x1e3db2[_0x2b1982['idField'][_0xa690('0x34')]()]=_0x1acd74[_0x2b1982[_0xa690('0x36')]]['toString']();}else if(_0x2b1982[_0xa690('0x32')]===_0xa690('0x37')&&_0x2b1982[_0xa690('0x38')]&&_0x2b1982[_0xa690('0x38')]['name']&&_0x2b1982[_0xa690('0x33')]&&_0x2b1982[_0xa690('0x2f')]){_0x1e3db2[_0x2b1982[_0xa690('0x33')][_0xa690('0x34')]()]=_0x1acd74[_0x2b1982[_0xa690('0x38')][_0xa690('0x39')][_0xa690('0x34')]()][_0xa690('0x31')]();}});}return _0x1e3db2;}function getTicket(_0x2c09d5,_0x1883e2,_0x1f2d90,_0x1427e9,_0x2be6da,_0x27336){return function(_0x2aafe2){logger[_0xa690('0x16')]('['+[_0x2c09d5[_0xa690('0x12')]()]+_0xa690('0x3a'),_0x2aafe2);return new Promise(function(_0x1c0cf7,_0x16470a){var _0x3f4451=_0x2c09d5['toLowerCase']()===_0xa690('0x3b')?_0x2aafe2['userId']:_0x2aafe2[_0xa690('0x26')];var _0x280e55={'method':_0xa690('0x22'),'uri':_0x1f2d90+'incident'+'?'+_0x27336,'body':Object[_0xa690('0x3c')]({},{'active':_0xa690('0x1c'),'caller_id':_0x3f4451,'assigned_to':_0x2aafe2[_0xa690('0x20')],'short_description':intUtil[_0xa690('0x3d')](_0x1427e9['Subjects'],_0x2be6da,'\x20'),'description':intUtil[_0xa690('0x3d')](_0x1427e9[_0xa690('0x3e')],_0x2be6da,'\x0a')},getCustomFields(_0x1427e9[_0xa690('0x3f')],_0x2be6da)),'auth':_0x1883e2,'json':!![]};return rp(_0x280e55)[_0xa690('0xd')](function(_0x3ce0ac){logger['info']('['+[_0x2c09d5['toUpperCase']()]+_0xa690('0x40'),_0x3ce0ac[_0xa690('0xe')]);_0x2aafe2[_0xa690('0x41')]=_0x3ce0ac[_0xa690('0xe')]['sys_id'];_0x2aafe2[_0xa690('0x42')]=_0x3ce0ac[_0xa690('0xe')][_0xa690('0x43')];logger[_0xa690('0x16')]('['+[_0x2c09d5[_0xa690('0x12')]()]+_0xa690('0x44'),_0x2aafe2);_0x1c0cf7(_0x2aafe2);})['catch'](function(_0xcaf2f2){logger[_0xa690('0x1f')]('['+[_0x2c09d5[_0xa690('0x12')]()]+']',_0xcaf2f2['message']);_0x16470a(_0xcaf2f2[_0xa690('0x15')]);});});};}function createRemoteTag(_0x4328de,_0x37decd,_0x3a3587,_0x9bd088){return new Promise(function(_0x1e4d7b,_0x47a688){var _0x225658={'method':_0xa690('0x22'),'uri':_0x3a3587+_0xa690('0x45')+'?'+_0x9bd088,'body':{'short_description':_0x4328de,'global':!![],'active':!![],'name':_0x4328de},'auth':_0x37decd,'json':!![]};return rp(_0x225658)[_0xa690('0xd')](function(_0x5f03e2){var _0x1e292d=_0x5f03e2[_0xa690('0xe')][_0xa690('0x11')];_0x1e4d7b(_0x1e292d);});});}function getRemoteTag(_0x3dc62a,_0x525bfd,_0xa750e9,_0x516066,_0x54c780){return new Promise(function(_0x4ad317,_0x1201a6){var _0x233897={'method':_0xa690('0xc'),'uri':_0xa750e9+_0xa690('0x45')+_0xa690('0x46')+_0x3dc62a+'&'+_0x516066,'auth':_0x525bfd,'json':!![]};return rp(_0x233897)[_0xa690('0xd')](function(_0x34f410){if(_0x34f410['result']['length']>0x0){var _0x11171c=_0x34f410[_0xa690('0xe')][0x0][_0xa690('0x11')];_0x4ad317(_0x11171c);}else{return createRemoteTag(_0x3dc62a,_0x525bfd,_0xa750e9,_0x516066)[_0xa690('0xd')](function(_0x3f0c8e){_0x4ad317(_0x3f0c8e);});}});});}function assignTagToIncident(_0x1575d8,_0xf15a2a,_0x2e2c3d,_0x3c5ad0,_0x3032a5){return new Promise(function(_0x5035de,_0x5f1d58){var _0x252d58={'method':_0xa690('0x22'),'uri':_0x2e2c3d+'label_entry'+'?'+_0x3032a5,'body':{'label':_0x1575d8,'table':_0xa690('0x47'),'id_type':'Incident','table_key':_0x3c5ad0['ticketId'],'title':_0xa690('0x48')+_0x3c5ad0[_0xa690('0x42')],'id_display':_0x3c5ad0[_0xa690('0x42')]},'auth':_0xf15a2a,'json':!![]};return rp(_0x252d58)['then'](function(_0x50fe49){_0x5035de();})['catch'](function(){_0x5035de();});});}function manageTags(_0x4a71d7,_0x2d5d25,_0x2da594,_0x46d669,_0x529718,_0x102f4a,_0xedde21){return new Promise(function(_0x4c3e2e,_0x498a30){var _0x272e43=[];_0x2d5d25[_0xa690('0x2a')](function(_0x383d39){_0x272e43[_0xa690('0x49')](getRemoteTag(_0x383d39,_0x2da594,_0x46d669,_0x102f4a,_0xedde21));});return Promise[_0xa690('0x4a')](_0x272e43)['then'](function(_0x1ab13e){if(_0x1ab13e[_0xa690('0xf')]){logger[_0xa690('0x16')]('['+[_0x4a71d7[_0xa690('0x12')]()]+_0xa690('0x4b'),_0x1ab13e);var _0x2cd8a7=[];_0x1ab13e['forEach'](function(_0x53ebc4){_0x2cd8a7[_0xa690('0x49')](assignTagToIncident(_0x53ebc4,_0x2da594,_0x46d669,_0x529718,_0x102f4a));});return Promise[_0xa690('0x4a')](_0x2cd8a7)['then'](function(){_0x4c3e2e();})['catch'](function(){_0x4c3e2e();});}else{_0x4c3e2e();}});});}function getTags(_0x5c4d12,_0x5e733b,_0x482e74,_0xf97368,_0x1b57f7,_0x36f23b){return function(_0x3778b8){return new Promise(function(_0x5ee71b,_0x3e33b0){var _0x788edc=[];var _0x5931e4=_0xf97368[_0xa690('0x4c')];if(_0x5931e4&&_0x5931e4[_0xa690('0xf')]>0x0){_0x788edc=_[_0xa690('0x4d')](_0x5931e4,'name');}if(_0x788edc[_0xa690('0xf')]>0x0){return manageTags(_0x5c4d12,_0x788edc,_0x5e733b,_0x482e74,_0x3778b8,_0x1b57f7,_0x36f23b)[_0xa690('0xd')](function(){_0x5ee71b(_0x3778b8);});}else{_0x5ee71b(_0x3778b8);}});};}function emit(_0x368f6c,_0x1b735a,_0x4fe799){var _0x3b20be=_0xa690('0x4e')+_0xa690('0x4f')+_0xa690('0x50')+_0xa690('0x51');var _0x5a9e0d={'uri':_0x368f6c+_0xa690('0x52')+_0x4fe799+_0x3b20be};io['to'](util[_0xa690('0x53')](_0xa690('0x54'),_0x1b735a))[_0xa690('0x55')](_0xa690('0x56'),_0x5a9e0d);}exports['cs']=function(_0x2b91f2,_0x9dc7fe,_0x59debe,_0x55ca9f,_0x141fab,_0xb97fc7,_0x1f21ba,_0x5edf41){var _0x257c7a={};var _0xc02307={'user':_0xb97fc7[_0xa690('0x57')],'pass':_0xb97fc7['password']};var _0x5233bb=_0xa690('0x58');var _0x25156e=_0xa690('0x59');_0xb97fc7[_0xa690('0x5a')]=intUtil[_0xa690('0x5b')](_0xb97fc7[_0xa690('0x5a')]);_0xb97fc7[_0xa690('0x5c')]=intUtil[_0xa690('0x5b')](_0xb97fc7[_0xa690('0x5c')]);var _0x22fae7=util[_0xa690('0x53')](_0xa690('0x5d'),_0xb97fc7['remoteUri']);_0x257c7a[_0xa690('0x19')]=!_['isNil'](_0x55ca9f)?_0x55ca9f[_0xa690('0x5e')]:null;_0x257c7a[_0xa690('0x1d')]=_0xb97fc7[_0xa690('0x5e')];_0x257c7a[_0xa690('0x24')]=_0x5edf41[_0xa690('0x34')]()===_0xa690('0x3b')?_0x9dc7fe[_0xa690('0x5f')]:_0x9dc7fe[_0xa690('0x60')];_0x257c7a['callDirection']=_0x5edf41==='queue'||_0x5edf41===_0xa690('0x61')?'queue':'outbound';var _0x5d6ee9=util[_0xa690('0x53')](_0xa690('0x62'),_0xb97fc7['serverUrl'],_0x9dc7fe[_0xa690('0x63')],md5(_0x9dc7fe['uniqueid']));if(_0x141fab&&_0x141fab['monitor_format']){logger['info']('[QUEUE]',_0xa690('0x64'));_0x9dc7fe['recordingURL']=_0x5d6ee9;}else if(_0x1f21ba&&_0x1f21ba[_0xa690('0x65')]&&_0x1f21ba[_0xa690('0x65')]!=='none'){logger['info'](_0xa690('0x66'),_0xa690('0x64'));_0x9dc7fe[_0xa690('0x67')]=_0x5d6ee9;}else{_0x9dc7fe[_0xa690('0x67')]='';}return getAdminUser(_0x5edf41,_0xc02307,_0x257c7a,_0x22fae7,_0x25156e,_0x5233bb)[_0xa690('0xd')](getUser(_0x5edf41,_0xc02307,_0x22fae7,_0x25156e,_0x5233bb))[_0xa690('0xd')](getEndUser(_0x5edf41,_0xc02307,_0x22fae7,_0x25156e,_0x5233bb))[_0xa690('0xd')](getTicket(_0x5edf41,_0xc02307,_0x22fae7,_0x59debe,_0x9dc7fe,_0x25156e))['then'](function(_0x19d1c2){logger[_0xa690('0x16')](util[_0xa690('0x53')](_0xa690('0x68'),_0x19d1c2[_0xa690('0x41')]));logger[_0xa690('0x16')](util[_0xa690('0x53')](_0xa690('0x69'),_0x5edf41));if(_0x5edf41!==_0xa690('0x61')){logger['info']('['+[_0x5edf41[_0xa690('0x12')]()]+']',_0xa690('0x6a'));emit(_0xb97fc7[_0xa690('0x5a')],_0x55ca9f['name'],_0x19d1c2['ticketId']);}})[_0xa690('0x14')](function(_0xe36975){logger[_0xa690('0x1f')]('['+[_0x5edf41[_0xa690('0x12')]()]+_0xa690('0x6b'),util[_0xa690('0x6c')](_0xe36975,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd8db=['request-promise','util','md5','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','result','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','string','picklist','type','nameField','customField','content','toString','includes','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','isNil','email','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xd8db,0xd2));var _0xbd8d=function(_0x509771,_0x3b6a5d){_0x509771=_0x509771-0x0;var _0x1ed8fe=_0xd8db[_0x509771];return _0x1ed8fe;};'use strict';var _=require(_0xbd8d('0x0'));var Promise=require(_0xbd8d('0x1'));var rp=require(_0xbd8d('0x2'));var util=require(_0xbd8d('0x3'));var md5=require(_0xbd8d('0x4'));var Redis=require(_0xbd8d('0x5'));var intUtil=require(_0xbd8d('0x6'));var config=require('../../../../config/environment');var logger=require(_0xbd8d('0x7'))('servicenow');config['redis']=_[_0xbd8d('0x8')](config[_0xbd8d('0x9')],{'host':_0xbd8d('0xa'),'port':0x18eb});var io=require(_0xbd8d('0xb'))(new Redis(config[_0xbd8d('0x9')]));function getAdminUser(_0x246dd1,_0xc3a1,_0x54e96d,_0x159c46,_0x5136c5,_0x696acd){return new Promise(function(_0x4c128d,_0x119f97){var _0x52ae3d={'method':'GET','uri':_0x159c46+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5136c5+'&'+_0x696acd,'auth':_0xc3a1,'json':!![]};return rp(_0x52ae3d)['then'](function(_0x1433f0){if(_0x1433f0[_0xbd8d('0xc')][_0xbd8d('0xd')]>0x0){_0x54e96d[_0xbd8d('0xe')]=_0x1433f0[_0xbd8d('0xc')][0x0]['sys_id'];}logger[_0xbd8d('0xf')]('['+[_0x246dd1[_0xbd8d('0x10')]()]+'],\x20getAdminUser\x20crm',_0x54e96d);_0x4c128d(_0x54e96d);})[_0xbd8d('0x11')](function(_0x3558eb){logger[_0xbd8d('0x12')]('['+[_0x246dd1[_0xbd8d('0x10')]()]+']',_0x3558eb[_0xbd8d('0x13')]);_0x119f97(_0x3558eb[_0xbd8d('0x13')]);});});}function getUser(_0x3cdc74,_0x476d9c,_0xc87d42,_0x4c1a87,_0x44757b){return function(_0x5ad4e8){logger[_0xbd8d('0xf')]('['+[_0x3cdc74[_0xbd8d('0x10')]()]+_0xbd8d('0x14'),_0x5ad4e8);return new Promise(function(_0x8dae29,_0x5a8f04){if(intUtil[_0xbd8d('0x15')](_0x5ad4e8[_0xbd8d('0x16')])){var _0x55e69e={'method':'GET','uri':_0xc87d42+_0xbd8d('0x17')+_0x5ad4e8['userEmail']+'&'+_0x4c1a87+'&'+_0x44757b,'auth':_0x476d9c,'json':!![]};logger[_0xbd8d('0xf')]('['+[_0x3cdc74[_0xbd8d('0x10')]()]+_0xbd8d('0x18'),_0x55e69e);return rp(_0x55e69e)[_0xbd8d('0x19')](function(_0xbf1d51){logger[_0xbd8d('0xf')]('['+[_0x3cdc74[_0xbd8d('0x10')]()]+_0xbd8d('0x1a'),_0xbf1d51);if(_0xbf1d51['result'][_0xbd8d('0xd')]>0x0&&String(_0xbf1d51[_0xbd8d('0xc')][0x0][_0xbd8d('0x1b')])===_0xbd8d('0x1c')){_0x5ad4e8[_0xbd8d('0x1d')]=_0xbf1d51['result'][0x0][_0xbd8d('0x1e')];}else{_0x5ad4e8[_0xbd8d('0x1d')]=_0x5ad4e8[_0xbd8d('0xe')];_0x5ad4e8[_0xbd8d('0x16')]=_0x5ad4e8[_0xbd8d('0x1f')];}logger['info']('['+[_0x3cdc74[_0xbd8d('0x10')]()]+_0xbd8d('0x20'),_0x5ad4e8);_0x8dae29(_0x5ad4e8);})[_0xbd8d('0x11')](function(_0x23dc84){logger[_0xbd8d('0x12')]('['+[_0x3cdc74[_0xbd8d('0x10')]()]+']',_0x23dc84[_0xbd8d('0x13')]);_0x5a8f04(_0x23dc84[_0xbd8d('0x13')]);});}else{logger['info']('['+[_0x3cdc74[_0xbd8d('0x10')]()]+_0xbd8d('0x21'));_0x5ad4e8[_0xbd8d('0x1d')]=_0x5ad4e8[_0xbd8d('0xe')];_0x5ad4e8[_0xbd8d('0x16')]=_0x5ad4e8['adminEmail'];_0x8dae29(_0x5ad4e8);}});};}function createEndUser(_0x7c3baa,_0x2a6f88,_0x37a730,_0x55cf38,_0xc3f30){logger['info']('['+[_0x7c3baa['toUpperCase']()]+_0xbd8d('0x22'),_0x37a730);return new Promise(function(_0x2c78d0,_0x22dae9){var _0x53bccc={'method':_0xbd8d('0x23'),'uri':_0x55cf38+'sys_user?'+_0xc3f30,'body':{'user_name':_0x37a730[_0xbd8d('0x24')],'roles':_0xbd8d('0x25'),'first_name':_0x37a730[_0xbd8d('0x24')],'active':_0xbd8d('0x1c'),'date_format':_0xbd8d('0x26'),'phone':_0x37a730[_0xbd8d('0x24')]},'auth':_0x2a6f88,'json':!![]};return rp(_0x53bccc)[_0xbd8d('0x19')](function(_0x43884a){logger['info']('['+[_0x7c3baa[_0xbd8d('0x10')]()]+_0xbd8d('0x27'),_0x43884a[_0xbd8d('0xc')]);_0x37a730[_0xbd8d('0x28')]=_0x43884a[_0xbd8d('0xc')][_0xbd8d('0x1e')];_0x2c78d0(_0x37a730);})[_0xbd8d('0x11')](function(_0x4ac9ba){logger['error']('['+[_0x7c3baa[_0xbd8d('0x10')]()]+']',_0x4ac9ba['message']);_0x22dae9(_0x4ac9ba['message']);});});}function getEndUser(_0x5dc350,_0x5c0fdd,_0x2d3e46,_0x536ee9,_0x2e72d1){return function(_0x2440b9){logger['info']('['+[_0x5dc350[_0xbd8d('0x10')]()]+_0xbd8d('0x29'),_0x2440b9);return new Promise(function(_0x40b26d,_0x400590){var _0x20e85a={'method':_0xbd8d('0x2a'),'uri':_0x2d3e46+_0xbd8d('0x2b')+_0x2440b9[_0xbd8d('0x24')]+'&'+_0x536ee9+'&'+_0x2e72d1,'auth':_0x5c0fdd,'json':!![]};return rp(_0x20e85a)[_0xbd8d('0x19')](function(_0x2bfd37){if(_0x2bfd37[_0xbd8d('0xc')][_0xbd8d('0xd')]>0x0){_0x2440b9['endUserId']=_0x2bfd37[_0xbd8d('0xc')][0x0][_0xbd8d('0x1e')];logger[_0xbd8d('0xf')]('['+[_0x5dc350['toUpperCase']()]+_0xbd8d('0x2c'),_0x2440b9);_0x40b26d(_0x2440b9);}else{return createEndUser(_0x5dc350,_0x5c0fdd,_0x2440b9,_0x2d3e46,_0x536ee9)[_0xbd8d('0x19')](function(_0x18242f){logger['info']('['+[_0x5dc350[_0xbd8d('0x10')]()]+'],\x20createEndUser\x20crm',_0x18242f);_0x40b26d(_0x18242f);});}})[_0xbd8d('0x11')](function(_0x54d9cd){logger[_0xbd8d('0x12')]('['+[_0x5dc350[_0xbd8d('0x10')]()]+']',_0x54d9cd[_0xbd8d('0x13')]);_0x400590(_0x54d9cd[_0xbd8d('0x13')]);});});};}function getCustomFields(_0x36bd69,_0x23cc1c){var _0x185ac2={};if(_0x36bd69['length']>0x0){_[_0xbd8d('0x2d')](_0x36bd69,function(_0x324f7d){if(_['includes']([_0xbd8d('0x2e'),_0xbd8d('0x2f')],_0x324f7d[_0xbd8d('0x30')])&&_0x324f7d[_0xbd8d('0x31')]&&!_0x324f7d[_0xbd8d('0x32')]){_0x185ac2[_0x324f7d[_0xbd8d('0x31')]['toLowerCase']()]=_0x324f7d[_0xbd8d('0x33')][_0xbd8d('0x34')]();}else if(_[_0xbd8d('0x35')]([_0xbd8d('0x2e'),_0xbd8d('0x2f')],_0x324f7d[_0xbd8d('0x30')])&&_0x324f7d[_0xbd8d('0x36')]&&_0x324f7d['customField']){_0x185ac2[_0x324f7d[_0xbd8d('0x36')][_0xbd8d('0x37')]()]=_0x324f7d[_0xbd8d('0x33')][_0xbd8d('0x34')]();}else if(_0x324f7d[_0xbd8d('0x30')]===_0xbd8d('0x38')&&_0x324f7d['variableName']&&_0x324f7d['idField']&&_0x324f7d['customField']){_0x185ac2[_0x324f7d['idField']['toLowerCase']()]=_0x23cc1c[_0x324f7d[_0xbd8d('0x39')]][_0xbd8d('0x34')]();}else if(_0x324f7d[_0xbd8d('0x30')]===_0xbd8d('0x3a')&&_0x324f7d['Variable']&&_0x324f7d[_0xbd8d('0x3b')]['name']&&_0x324f7d[_0xbd8d('0x36')]&&_0x324f7d[_0xbd8d('0x32')]){_0x185ac2[_0x324f7d[_0xbd8d('0x36')][_0xbd8d('0x37')]()]=_0x23cc1c[_0x324f7d[_0xbd8d('0x3b')][_0xbd8d('0x3c')][_0xbd8d('0x37')]()][_0xbd8d('0x34')]();}});}return _0x185ac2;}function getTicket(_0xd53e0c,_0x4d5475,_0x559cbc,_0x2ede35,_0x25904b,_0x288ba6){return function(_0x30e1aa){logger['info']('['+[_0xd53e0c[_0xbd8d('0x10')]()]+_0xbd8d('0x3d'),_0x30e1aa);return new Promise(function(_0x1bcc87,_0x3ac248){var _0x1d921c=_0xd53e0c['toLowerCase']()===_0xbd8d('0x3e')?_0x30e1aa[_0xbd8d('0x1d')]:_0x30e1aa[_0xbd8d('0x28')];var _0x2ccd30={'method':_0xbd8d('0x23'),'uri':_0x559cbc+_0xbd8d('0x3f')+'?'+_0x288ba6,'body':Object[_0xbd8d('0x40')]({},{'active':_0xbd8d('0x1c'),'caller_id':_0x1d921c,'assigned_to':_0x30e1aa[_0xbd8d('0x1d')],'short_description':intUtil[_0xbd8d('0x41')](_0x2ede35[_0xbd8d('0x42')],_0x25904b,'\x20'),'description':intUtil[_0xbd8d('0x41')](_0x2ede35[_0xbd8d('0x43')],_0x25904b,'\x0a')},getCustomFields(_0x2ede35[_0xbd8d('0x44')],_0x25904b)),'auth':_0x4d5475,'json':!![]};return rp(_0x2ccd30)[_0xbd8d('0x19')](function(_0x1ee915){logger[_0xbd8d('0xf')]('['+[_0xd53e0c[_0xbd8d('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x1ee915[_0xbd8d('0xc')]);_0x30e1aa['ticketId']=_0x1ee915['result']['sys_id'];_0x30e1aa['ticketNumber']=_0x1ee915[_0xbd8d('0xc')]['number'];logger['info']('['+[_0xd53e0c[_0xbd8d('0x10')]()]+']\x20getTicket\x20crm',_0x30e1aa);_0x1bcc87(_0x30e1aa);})[_0xbd8d('0x11')](function(_0x38d8ac){logger[_0xbd8d('0x12')]('['+[_0xd53e0c[_0xbd8d('0x10')]()]+']',_0x38d8ac['message']);_0x3ac248(_0x38d8ac[_0xbd8d('0x13')]);});});};}function createRemoteTag(_0xaf71b3,_0x496bd9,_0x49ee2b,_0x271b97){return new Promise(function(_0x15fa6a,_0x154d99){var _0x463490={'method':_0xbd8d('0x23'),'uri':_0x49ee2b+'label'+'?'+_0x271b97,'body':{'short_description':_0xaf71b3,'global':!![],'active':!![],'name':_0xaf71b3},'auth':_0x496bd9,'json':!![]};return rp(_0x463490)[_0xbd8d('0x19')](function(_0x10a5be){var _0x4615ff=_0x10a5be[_0xbd8d('0xc')][_0xbd8d('0x1e')];_0x15fa6a(_0x4615ff);});});}function getRemoteTag(_0x33af7c,_0x122062,_0x6b038b,_0x3b53b9,_0x34f101){return new Promise(function(_0x540e63,_0x1811d8){var _0x40b3f6={'method':_0xbd8d('0x2a'),'uri':_0x6b038b+_0xbd8d('0x45')+_0xbd8d('0x46')+_0x33af7c+'&'+_0x3b53b9,'auth':_0x122062,'json':!![]};return rp(_0x40b3f6)[_0xbd8d('0x19')](function(_0x1db760){if(_0x1db760['result'][_0xbd8d('0xd')]>0x0){var _0x4c29b6=_0x1db760[_0xbd8d('0xc')][0x0][_0xbd8d('0x1e')];_0x540e63(_0x4c29b6);}else{return createRemoteTag(_0x33af7c,_0x122062,_0x6b038b,_0x3b53b9)[_0xbd8d('0x19')](function(_0xe3c425){_0x540e63(_0xe3c425);});}});});}function assignTagToIncident(_0x46300b,_0x113cc1,_0x5df08e,_0x29885c,_0x1e7a2a){return new Promise(function(_0x14621b,_0x297c43){var _0x372f6e={'method':_0xbd8d('0x23'),'uri':_0x5df08e+_0xbd8d('0x47')+'?'+_0x1e7a2a,'body':{'label':_0x46300b,'table':_0xbd8d('0x3f'),'id_type':'Incident','table_key':_0x29885c['ticketId'],'title':_0xbd8d('0x48')+_0x29885c['ticketNumber'],'id_display':_0x29885c[_0xbd8d('0x49')]},'auth':_0x113cc1,'json':!![]};return rp(_0x372f6e)[_0xbd8d('0x19')](function(_0x5569a0){_0x14621b();})[_0xbd8d('0x11')](function(){_0x14621b();});});}function manageTags(_0x3c2c25,_0x5a9af8,_0x152545,_0x526ae6,_0x1dc0c2,_0x31a499,_0x2ad9a0){return new Promise(function(_0x372596,_0x58175f){var _0x17714c=[];_0x5a9af8[_0xbd8d('0x2d')](function(_0x2033bd){_0x17714c[_0xbd8d('0x4a')](getRemoteTag(_0x2033bd,_0x152545,_0x526ae6,_0x31a499,_0x2ad9a0));});return Promise[_0xbd8d('0x4b')](_0x17714c)['then'](function(_0x326aa2){if(_0x326aa2['length']){logger[_0xbd8d('0xf')]('['+[_0x3c2c25[_0xbd8d('0x10')]()]+_0xbd8d('0x4c'),_0x326aa2);var _0x24faef=[];_0x326aa2[_0xbd8d('0x2d')](function(_0x40c85d){_0x24faef['push'](assignTagToIncident(_0x40c85d,_0x152545,_0x526ae6,_0x1dc0c2,_0x31a499));});return Promise[_0xbd8d('0x4b')](_0x24faef)['then'](function(){_0x372596();})[_0xbd8d('0x11')](function(){_0x372596();});}else{_0x372596();}});});}function getTags(_0x208b34,_0x278d8e,_0x33c330,_0x16007b,_0x48a88e,_0x3ebd90){return function(_0x8e085b){return new Promise(function(_0x1630e5,_0x509c6f){var _0x2de5e2=[];var _0x5220b6=_0x16007b[_0xbd8d('0x4d')];if(_0x5220b6&&_0x5220b6[_0xbd8d('0xd')]>0x0){_0x2de5e2=_['map'](_0x5220b6,'name');}if(_0x2de5e2[_0xbd8d('0xd')]>0x0){return manageTags(_0x208b34,_0x2de5e2,_0x278d8e,_0x33c330,_0x8e085b,_0x48a88e,_0x3ebd90)[_0xbd8d('0x19')](function(){_0x1630e5(_0x8e085b);});}else{_0x1630e5(_0x8e085b);}});};}function emit(_0x58062b,_0x865c82,_0x416048){var _0x2303d9='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xbd8d('0x4e')+'%255EORDERBYDESCnumber';var _0x54457c={'uri':_0x58062b+_0xbd8d('0x4f')+_0x416048+_0x2303d9};io['to'](util[_0xbd8d('0x50')]('user:%s',_0x865c82))[_0xbd8d('0x51')](_0xbd8d('0x52'),_0x54457c);}exports['cs']=function(_0x3d7b82,_0x4627ab,_0x4bbb28,_0x4d1631,_0x2a1513,_0x1e1aed,_0x3facf4,_0x53d849){var _0x3e55e7={};var _0x5a9f58={'user':_0x1e1aed[_0xbd8d('0x53')],'pass':_0x1e1aed[_0xbd8d('0x54')]};var _0x4c6974='sysparm_limit=1';var _0x2204bb=_0xbd8d('0x55');_0x1e1aed['remoteUri']=intUtil[_0xbd8d('0x56')](_0x1e1aed[_0xbd8d('0x57')]);_0x1e1aed['serverUrl']=intUtil[_0xbd8d('0x56')](_0x1e1aed[_0xbd8d('0x58')]);var _0x67fcd2=util[_0xbd8d('0x50')]('%s/api/now/table/',_0x1e1aed['remoteUri']);_0x3e55e7[_0xbd8d('0x16')]=!_[_0xbd8d('0x59')](_0x4d1631)?_0x4d1631[_0xbd8d('0x5a')]:null;_0x3e55e7[_0xbd8d('0x1f')]=_0x1e1aed[_0xbd8d('0x5a')];_0x3e55e7[_0xbd8d('0x24')]=_0x53d849[_0xbd8d('0x37')]()===_0xbd8d('0x3e')?_0x4627ab['destcalleridnum']:_0x4627ab[_0xbd8d('0x5b')];_0x3e55e7[_0xbd8d('0x5c')]=_0x53d849==='queue'||_0x53d849===_0xbd8d('0x5d')?_0xbd8d('0x5e'):_0xbd8d('0x3e');var _0x98bc9b=util[_0xbd8d('0x50')](_0xbd8d('0x5f'),_0x1e1aed[_0xbd8d('0x58')],_0x4627ab[_0xbd8d('0x60')],md5(_0x4627ab['uniqueid']));if(_0x2a1513&&_0x2a1513['monitor_format']){logger[_0xbd8d('0xf')](_0xbd8d('0x61'),_0xbd8d('0x62'));_0x4627ab[_0xbd8d('0x63')]=_0x98bc9b;}else if(_0x3facf4&&_0x3facf4[_0xbd8d('0x64')]&&_0x3facf4['recordingFormat']!=='none'){logger[_0xbd8d('0xf')]('[OUTBOUND]',_0xbd8d('0x62'));_0x4627ab['recordingURL']=_0x98bc9b;}else{_0x4627ab[_0xbd8d('0x63')]='';}return getAdminUser(_0x53d849,_0x5a9f58,_0x3e55e7,_0x67fcd2,_0x2204bb,_0x4c6974)[_0xbd8d('0x19')](getUser(_0x53d849,_0x5a9f58,_0x67fcd2,_0x2204bb,_0x4c6974))['then'](getEndUser(_0x53d849,_0x5a9f58,_0x67fcd2,_0x2204bb,_0x4c6974))['then'](getTicket(_0x53d849,_0x5a9f58,_0x67fcd2,_0x4bbb28,_0x4627ab,_0x2204bb))[_0xbd8d('0x19')](function(_0x132bff){logger['info'](util[_0xbd8d('0x50')](_0xbd8d('0x65'),_0x132bff[_0xbd8d('0x66')]));logger[_0xbd8d('0xf')](util[_0xbd8d('0x50')]('call\x20direction:\x20%s',_0x53d849));if(_0x53d849!==_0xbd8d('0x5d')){logger[_0xbd8d('0xf')]('['+[_0x53d849['toUpperCase']()]+']',_0xbd8d('0x67'));emit(_0x1e1aed[_0xbd8d('0x57')],_0x4d1631[_0xbd8d('0x3c')],_0x132bff[_0xbd8d('0x66')]);}})[_0xbd8d('0x11')](function(_0x5d8bb5){logger[_0xbd8d('0x12')]('['+[_0x53d849['toUpperCase']()]+_0xbd8d('0x68'),util[_0xbd8d('0x69')](_0x5d8bb5,{'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 b24727b..91e1067 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 _0xbf25=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','entry_list','find','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','catch','lastevent','lodash','request-promise','bluebird','util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','name_value_list','Agent\x20found!','value'];(function(_0x4c3c8b,_0x4c4917){var _0x4a154e=function(_0x3dba08){while(--_0x3dba08){_0x4c3c8b['push'](_0x4c3c8b['shift']());}};_0x4a154e(++_0x4c4917);}(_0xbf25,0x12d));var _0x5bf2=function(_0x4d527e,_0x134704){_0x4d527e=_0x4d527e-0x0;var _0x14c2ad=_0xbf25[_0x4d527e];return _0x14c2ad;};'use strict';var _=require(_0x5bf2('0x0'));var rp=require(_0x5bf2('0x1'));var BPromise=require(_0x5bf2('0x2'));var md5=require('md5');var util=require(_0x5bf2('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5bf2('0x4'));var logger=require(_0x5bf2('0x5'))('sugarcrm');config['redis']=_[_0x5bf2('0x6')](config[_0x5bf2('0x7')],{'host':_0x5bf2('0x8'),'port':0x18eb});var io=require(_0x5bf2('0x9'))(new Redis(config[_0x5bf2('0x7')]));var def={'method':_0x5bf2('0xa'),'json':!![]};function emit(_0x2affa9,_0x591eed,_0x5f307d){io['to'](_0x2affa9)['emit'](_0x591eed,_0x5f307d);}function getTicket(_0x350011,_0x23bbf8,_0x245f6f,_0x12b8e6,_0x386ad6,_0x1d0414,_0xe1081,_0x31f031){logger[_0x5bf2('0xb')](_0x5bf2('0xc'));var _0x4374fc=new Date();var _0x22fad8=[{'name':_0x5bf2('0xd'),'value':intUtil[_0x5bf2('0xe')](_0x12b8e6[_0x5bf2('0xf')],_0x386ad6,'\x20')},{'name':_0x5bf2('0x10'),'value':_0x23bbf8['id']},{'name':_0x5bf2('0x11'),'value':_0x23bbf8['id']},{'name':'description','value':intUtil[_0x5bf2('0xe')](_0x12b8e6[_0x5bf2('0x12')],_0x386ad6,'\x0a')},{'name':'date_start','value':_0x4374fc[_0x5bf2('0x13')]()['slice'](0x0,0x13)[_0x5bf2('0x14')]('T','\x20')},{'name':_0x5bf2('0x15'),'value':'0'},{'name':_0x5bf2('0x16'),'value':'15'},{'name':'parent_id','value':_0x245f6f['id']},{'name':_0x5bf2('0x17'),'value':_0x5bf2('0x18')},{'name':_0x5bf2('0x19'),'value':_0x245f6f[_0x5bf2('0xd')]},{'name':'direction','value':_0x31f031}];if(_0x1d0414[_0x5bf2('0x1a')]){_['forEach'](_0x1d0414,function(_0x3e436b){if(_0x386ad6[_0x3e436b[_0x5bf2('0x1b')]]){_0x22fad8[_0x5bf2('0x1c')]({'name':_0x3e436b[_0x5bf2('0x1d')],'value':_0x386ad6[_0x3e436b['variableName']]});}});}return request({'form':{'method':_0x5bf2('0x1e'),'input_type':'JSON','response_type':_0x5bf2('0x1f'),'rest_data':JSON[_0x5bf2('0x20')]({'session':_0xe1081['id'],'module_name':_0x5bf2('0x21'),'name_value_list':_0x22fad8})}});}function getAuth(_0x4898f7){return util[_0x5bf2('0x22')]('Basic\x20%s',new Buffer(_0x4898f7[_0x5bf2('0x23')]+':X')[_0x5bf2('0x24')](_0x5bf2('0x25')));}function getServerInfo(_0x85a105){return request({'form':{'method':_0x5bf2('0x26'),'input_type':'JSON','response_type':_0x5bf2('0x1f'),'rest_data':JSON[_0x5bf2('0x20')]({'session':_0x85a105['id']})}});}function getUser(_0x1bca22,_0x5b6d03,_0x11ca0b){if(!_[_0x5bf2('0x27')](_0x5b6d03)){logger['info'](_0x5bf2('0x28'),_0x5b6d03);return request({'form':{'method':_0x5bf2('0x29'),'input_type':_0x5bf2('0x1f'),'response_type':'JSON','rest_data':JSON[_0x5bf2('0x20')]({'session':_0x11ca0b['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5b6d03),'order_by':'','offset':'0','select_fields':['id',_0x5bf2('0xd'),_0x5bf2('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5bf2('0x2b')](function(_0x35e32e){if(_0x35e32e['entry_list'][_0x5bf2('0x1a')]){var _0x463ccf=_['find'](_0x35e32e['entry_list'],function(_0xdae8ee){return _0xdae8ee[_0x5bf2('0x2c')][_0x5bf2('0x2a')]['value']===_0x5b6d03;});if(_0x463ccf){logger['info'](_0x5bf2('0x2d'));return BPromise['resolve']({'id':_0x463ccf[_0x5bf2('0x2c')]['id'][_0x5bf2('0x2e')],'name':_0x463ccf[_0x5bf2('0x2c')][_0x5bf2('0xd')]['value']});}}logger[_0x5bf2('0xb')](_0x5bf2('0x2f'));return BPromise[_0x5bf2('0x30')]({'id':_0x11ca0b[_0x5bf2('0x2c')][_0x5bf2('0x31')]['value'],'name':_0x11ca0b[_0x5bf2('0x2c')][_0x5bf2('0x2a')][_0x5bf2('0x2e')]});});}else{logger[_0x5bf2('0xb')](_0x5bf2('0x32'));return BPromise[_0x5bf2('0x30')]({'id':_0x11ca0b[_0x5bf2('0x2c')]['user_id'][_0x5bf2('0x2e')],'name':_0x11ca0b[_0x5bf2('0x2c')][_0x5bf2('0x2a')]['value']});}}function getEndUser(_0x4d981c,_0x108c7c,_0x13db96,_0x3c8e20){logger[_0x5bf2('0xb')](_0x5bf2('0x33'),_0x13db96);return request({'form':{'method':'get_entry_list','input_type':_0x5bf2('0x1f'),'response_type':_0x5bf2('0x1f'),'rest_data':JSON[_0x5bf2('0x20')]({'session':_0x3c8e20['id'],'module_name':_0x5bf2('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x13db96),'order_by':'','offset':'0','select_fields':['id',_0x5bf2('0xd'),_0x5bf2('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5bf2('0x2b')](function(_0x58a058){if(_0x58a058[_0x5bf2('0x35')][_0x5bf2('0x1a')]){var _0x180f74=_[_0x5bf2('0x36')](_0x58a058[_0x5bf2('0x35')],function(_0x42ac48){return _0x42ac48[_0x5bf2('0x2c')][_0x5bf2('0x34')][_0x5bf2('0x2e')]===_0x13db96;});if(_0x180f74){logger[_0x5bf2('0xb')](_0x5bf2('0x37'));return BPromise[_0x5bf2('0x30')]({'id':_0x180f74['name_value_list']['id']['value'],'name':_0x180f74[_0x5bf2('0x2c')][_0x5bf2('0xd')][_0x5bf2('0x2e')],'phone':_0x180f74[_0x5bf2('0x2c')]['phone_home']['value']});}}else{logger[_0x5bf2('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x5bf2('0x1f'),'response_type':_0x5bf2('0x1f'),'rest_data':JSON['stringify']({'session':_0x3c8e20['id'],'module_name':_0x5bf2('0x18'),'name_value_list':[{'name':'first_name','value':_0x108c7c!==''?_0x108c7c:util['format'](_0x5bf2('0x38'),_0x13db96)},{'name':_0x5bf2('0x34'),'value':_0x13db96}]})}})[_0x5bf2('0x2b')](function(_0x1a247c){logger[_0x5bf2('0xb')](_0x5bf2('0x39'));return BPromise[_0x5bf2('0x30')]({'id':_0x1a247c['id'],'name':_0x1a247c[_0x5bf2('0x35')][_0x5bf2('0x3a')][_0x5bf2('0x2e')],'phone':_0x1a247c['entry_list'][_0x5bf2('0x34')][_0x5bf2('0x2e')]});});}});}function request(_0x5a7d90){logger[_0x5bf2('0x3b')](_0x5bf2('0x3c'),JSON['stringify'](_0x5a7d90));return rp(_[_0x5bf2('0x3d')](def,_0x5a7d90));}function getTags(_0x211385,_0x489908){var _0x56823b=[];if(_0x211385&&_0x211385['length']>0x0){_0x56823b=_[_0x5bf2('0x3e')](_0x211385,_0x489908);}return _0x56823b;}function getCustomFields(_0x3ca5dc,_0x3cd6f7){var _0x576211=[];var _0x2d242d={'custom_fields':[]};if(_0x3ca5dc[_0x5bf2('0x1a')]>0x0){_[_0x5bf2('0x3f')](_0x3ca5dc,function(_0x400f79){if(_0x400f79[_0x5bf2('0x40')]===_0x5bf2('0x41')&&_0x400f79[_0x5bf2('0x42')]&&!_0x400f79[_0x5bf2('0x43')]){_0x2d242d[_0x400f79[_0x5bf2('0x42')][_0x5bf2('0x44')]()]=_0x400f79[_0x5bf2('0x45')][_0x5bf2('0x24')]();}else if(_0x400f79[_0x5bf2('0x40')]==='string'&&_0x400f79[_0x5bf2('0x1d')]&&_0x400f79[_0x5bf2('0x43')]){_0x2d242d[_0x5bf2('0x46')][_0x5bf2('0x1c')]({'id':_0x400f79[_0x5bf2('0x1d')],'value':_0x400f79[_0x5bf2('0x45')][_0x5bf2('0x24')]()});}else if(_0x400f79[_0x5bf2('0x40')]===_0x5bf2('0x47')&&_0x400f79[_0x5bf2('0x1b')]&&_0x400f79['idField']&&_0x400f79[_0x5bf2('0x43')]){_0x3cd6f7[_0x400f79['variableName']]&&_0x2d242d['custom_fields'][_0x5bf2('0x1c')]({'id':_0x400f79[_0x5bf2('0x1d')],'value':_0x3cd6f7[_0x400f79[_0x5bf2('0x1b')]][_0x5bf2('0x24')]()});}else if(_0x400f79['type']===_0x5bf2('0x48')&&_0x400f79[_0x5bf2('0x49')]&&_0x400f79[_0x5bf2('0x49')]['name']&&_0x400f79[_0x5bf2('0x1d')]&&_0x400f79[_0x5bf2('0x43')]){_0x3cd6f7[_0x400f79['Variable'][_0x5bf2('0xd')]['toLowerCase']()]&&_0x2d242d['custom_fields'][_0x5bf2('0x1c')]({'id':_0x400f79[_0x5bf2('0x1d')],'value':_0x3cd6f7[_0x400f79[_0x5bf2('0x49')][_0x5bf2('0xd')]['toLowerCase']()][_0x5bf2('0x24')]()});}});}return _0x2d242d;}function getConnection(_0x11269b){return request({'method':_0x5bf2('0xa'),'form':{'method':_0x5bf2('0x4a'),'input_type':_0x5bf2('0x1f'),'response_type':_0x5bf2('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x11269b['username'],'password':_0x11269b[_0x5bf2('0x4b')],'encryption':_0x5bf2('0x4c')},'application':_0x5bf2('0x4d')})}})[_0x5bf2('0x2b')](function(_0x12fdfe){var _0x2d1bcc=_0x12fdfe;if(_0x2d1bcc['id']){def[_0x5bf2('0x4e')]=_0x2d1bcc['id'];return BPromise[_0x5bf2('0x30')](_0x2d1bcc);}else{throw new Error(util[_0x5bf2('0x22')](_0x5bf2('0x4f'),_0x11269b['id']));}});}function setRelationship(_0x1c2904,_0x11f1d1,_0x1bb044,_0x464905){return request({'form':{'method':'set_relationship','input_type':_0x5bf2('0x1f'),'response_type':'JSON','rest_data':JSON[_0x5bf2('0x20')]({'session':_0x1c2904['id'],'module_name':'Calls','module_id':_0x1bb044['id'],'link_field_name':_0x464905,'related_ids':[_0x11f1d1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5bf2('0x50')]=function(_0x328c60,_0x2ca745,_0x4f0bd6,_0x6f402b,_0x291a31,_0x3b17a7){var _0x41142b,_0x1a0ddc,_0x11571a,_0xee1618;_0x3b17a7[_0x5bf2('0x51')]=intUtil['stripTrailingSlash'](_0x3b17a7[_0x5bf2('0x51')]);_0x3b17a7['serverUrl']=intUtil[_0x5bf2('0x52')](_0x3b17a7[_0x5bf2('0x53')]);def[_0x5bf2('0x54')]=util[_0x5bf2('0x22')]('%s/service/v4_1/rest.php',_0x3b17a7['remoteUri']);if(_0x291a31&&_0x291a31['monitor_format']){logger[_0x5bf2('0xb')](_0x5bf2('0x55'),_0x5bf2('0x56'));_0x2ca745[_0x5bf2('0x57')]=util[_0x5bf2('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b17a7['serverUrl'],_0x2ca745['uniqueid'],md5(_0x2ca745[_0x5bf2('0x58')]));}else{_0x2ca745['recordingURL']='';}return getConnection(_0x3b17a7)[_0x5bf2('0x2b')](function(_0x19ba2c){_0xee1618=_0x19ba2c;return getUser(_0x3b17a7,_0x6f402b['name'],_0xee1618);})[_0x5bf2('0x2b')](function(_0x12de22){_0x41142b=_0x12de22;logger[_0x5bf2('0xb')](_0x5bf2('0x59'),_0x41142b['id']);return getEndUser(_0x3b17a7,_0x2ca745[_0x5bf2('0x5a')],_0x2ca745[_0x5bf2('0x5b')],_0xee1618);})[_0x5bf2('0x2b')](function(_0xbc583c){_0x1a0ddc=_0xbc583c;logger[_0x5bf2('0xb')](_0x5bf2('0x5c'),_0x1a0ddc['id']);return getTicket(_0x3b17a7,_0x41142b,_0x1a0ddc,_0x4f0bd6,_0x2ca745,_0x4f0bd6[_0x5bf2('0x5d')],_0xee1618,_0x5bf2('0x5e'));})[_0x5bf2('0x2b')](function(_0x158800){_0x11571a=_0x158800;logger[_0x5bf2('0xb')](_0x5bf2('0x5f'));logger[_0x5bf2('0xb')](_0x5bf2('0x60'),_0x11571a['id']);return setRelationship(_0xee1618,_0x41142b,_0x11571a,'users');})[_0x5bf2('0x2b')](function(){return setRelationship(_0xee1618,_0x1a0ddc,_0x11571a,_0x5bf2('0x61'));})[_0x5bf2('0x2b')](function(){return getServerInfo(_0xee1618);})[_0x5bf2('0x2b')](function(_0x28d38b){var _0x645fbd=parseInt(_0x28d38b['version']['charAt'](0x0));var _0x25a521=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3b17a7['remoteUri'],_0x11571a['id']);if(_0x645fbd>0x6){_0x25a521=util['format'](_0x5bf2('0x62'),_0x3b17a7['remoteUri'],_0x11571a['id']);}logger[_0x5bf2('0xb')](_0x5bf2('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5bf2('0x22')]('user:%s',_0x6f402b[_0x5bf2('0xd')]),_0x5bf2('0x63'),{'uri':_0x25a521});})['catch'](function(_0x678113){logger[_0x5bf2('0x64')](_0x5bf2('0x55'),JSON[_0x5bf2('0x20')](_0x678113));});};exports['outbound']=function(_0x407838,_0x17067a,_0x349933,_0x23a638,_0x21022e,_0x35b17c,_0x2db921){var _0xc2826c,_0x1ee352,_0x4d1696,_0x1b6b82;_0x35b17c[_0x5bf2('0x51')]=intUtil['stripTrailingSlash'](_0x35b17c[_0x5bf2('0x51')]);_0x35b17c[_0x5bf2('0x53')]=intUtil[_0x5bf2('0x52')](_0x35b17c[_0x5bf2('0x53')]);def[_0x5bf2('0x54')]=util[_0x5bf2('0x22')](_0x5bf2('0x65'),_0x35b17c[_0x5bf2('0x51')]);if(_0x2db921&&_0x2db921['recordingFormat']&&_0x2db921[_0x5bf2('0x66')]!==_0x5bf2('0x67')){logger[_0x5bf2('0xb')](_0x5bf2('0x68'),'Recording\x20is\x20enabled!');_0x17067a['recordingURL']=util[_0x5bf2('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35b17c[_0x5bf2('0x53')],_0x17067a[_0x5bf2('0x58')],md5(_0x17067a[_0x5bf2('0x58')]));}return getConnection(_0x35b17c)['then'](function(_0x36af7e){_0x1b6b82=_0x36af7e;return getUser(_0x35b17c,_0x23a638[_0x5bf2('0xd')],_0x1b6b82);})['then'](function(_0x10225a){_0xc2826c=_0x10225a;logger[_0x5bf2('0xb')](_0x5bf2('0x59'),_0xc2826c['id']);return getEndUser(_0x35b17c,_0x17067a[_0x5bf2('0x69')],_0x17067a[_0x5bf2('0x6a')],_0x1b6b82);})[_0x5bf2('0x2b')](function(_0x3bc410){_0x1ee352=_0x3bc410;logger[_0x5bf2('0xb')](_0x5bf2('0x5c'),_0x1ee352['id']);return getTicket(_0x35b17c,_0xc2826c,_0x1ee352,_0x349933,_0x17067a,_0x349933[_0x5bf2('0x5d')],_0x1b6b82,'Outbound');})[_0x5bf2('0x2b')](function(_0x4e40f3){_0x4d1696=_0x4e40f3;logger[_0x5bf2('0xb')](_0x5bf2('0x5f'));logger[_0x5bf2('0xb')](_0x5bf2('0x60'),_0x4d1696['id']);return setRelationship(_0x1b6b82,_0xc2826c,_0x4d1696,_0x5bf2('0x6b'));})['then'](function(){return setRelationship(_0x1b6b82,_0x1ee352,_0x4d1696,_0x5bf2('0x61'));})[_0x5bf2('0x2b')](function(){return getServerInfo(_0x1b6b82);})['then'](function(_0x32d7b7){var _0x3132d2=parseInt(_0x32d7b7[_0x5bf2('0x6c')][_0x5bf2('0x6d')](0x0));var _0x4a4044=util['format'](_0x5bf2('0x6e'),_0x35b17c[_0x5bf2('0x51')],_0x4d1696['id']);if(_0x3132d2>0x6){_0x4a4044=util['format'](_0x5bf2('0x62'),_0x35b17c[_0x5bf2('0x51')],_0x4d1696['id']);}logger[_0x5bf2('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x23a638[_0x5bf2('0xd')]),_0x5bf2('0x63'),{'uri':_0x4a4044});})['catch'](function(_0x585093){logger[_0x5bf2('0x64')](_0x5bf2('0x68'),JSON[_0x5bf2('0x20')](_0x585093));});};exports[_0x5bf2('0x6f')]=function(_0x84f0a1,_0x133132,_0x3bbcc3,_0x338f72,_0x85e305,_0xcfb08d){var _0x370ae5,_0x5c2f27,_0x482eec,_0x585e6e;_0xcfb08d[_0x5bf2('0x51')]=intUtil[_0x5bf2('0x52')](_0xcfb08d[_0x5bf2('0x51')]);_0xcfb08d[_0x5bf2('0x53')]=intUtil[_0x5bf2('0x52')](_0xcfb08d[_0x5bf2('0x53')]);def[_0x5bf2('0x54')]=util[_0x5bf2('0x22')](_0x5bf2('0x65'),_0xcfb08d[_0x5bf2('0x51')]);if(_0x85e305&&_0x85e305['monitor_format']){logger['info']('['+_0x133132['lastevent'][_0x5bf2('0x70')]()+']',_0x5bf2('0x56'));_0x133132['recordingURL']=util[_0x5bf2('0x22')](_0x5bf2('0x71'),_0xcfb08d[_0x5bf2('0x53')],_0x133132[_0x5bf2('0x58')],md5(_0x133132[_0x5bf2('0x58')]));}else{_0x133132[_0x5bf2('0x57')]='';}return getConnection(_0xcfb08d)[_0x5bf2('0x2b')](function(_0x2fcd75){_0x585e6e=_0x2fcd75;if(!_[_0x5bf2('0x27')](_0x338f72)){return getUser(_0xcfb08d,_0x338f72['name'],_0x585e6e);}else{return getUser(_0xcfb08d,null,_0x585e6e);}})['then'](function(_0x13c4b4){_0x370ae5=_0x13c4b4;logger['info']('The\x20User\x20ID\x20is:',_0x370ae5['id']);return getEndUser(_0xcfb08d,_0x133132[_0x5bf2('0x5a')],_0x133132[_0x5bf2('0x5b')],_0x585e6e);})[_0x5bf2('0x2b')](function(_0x14db93){_0x5c2f27=_0x14db93;logger[_0x5bf2('0xb')](_0x5bf2('0x5c'),_0x5c2f27['id']);return getTicket(_0xcfb08d,_0x370ae5,_0x5c2f27,_0x3bbcc3,_0x133132,_0x3bbcc3[_0x5bf2('0x5d')],_0x585e6e,_0x5bf2('0x5e'));})[_0x5bf2('0x2b')](function(_0x3a85ce){_0x482eec=_0x3a85ce;logger[_0x5bf2('0xb')](_0x5bf2('0x5f'));logger[_0x5bf2('0xb')](_0x5bf2('0x60'),_0x482eec['id']);return setRelationship(_0x585e6e,_0x370ae5,_0x482eec,'users');})[_0x5bf2('0x2b')](function(){return setRelationship(_0x585e6e,_0x5c2f27,_0x482eec,_0x5bf2('0x61'));})[_0x5bf2('0x2b')](function(){return getServerInfo(_0x585e6e);})[_0x5bf2('0x72')](function(_0x4be48c){logger[_0x5bf2('0x64')]('['+_0x133132[_0x5bf2('0x73')][_0x5bf2('0x70')]()+']',JSON['stringify'](_0x4be48c));});}; \ No newline at end of file +var _0xd622=['Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Enduser\x20created.','debug','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','%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','catch','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','Inbound','lodash','bluebird','md5','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','emit','name','getString'];(function(_0x18851f,_0x5e8881){var _0x47078c=function(_0x4d0034){while(--_0x4d0034){_0x18851f['push'](_0x18851f['shift']());}};_0x47078c(++_0x5e8881);}(_0xd622,0x15a));var _0x2d62=function(_0x133631,_0x4c51ff){_0x133631=_0x133631-0x0;var _0xa43a9a=_0xd622[_0x133631];return _0xa43a9a;};'use strict';var _=require(_0x2d62('0x0'));var rp=require('request-promise');var BPromise=require(_0x2d62('0x1'));var md5=require(_0x2d62('0x2'));var util=require(_0x2d62('0x3'));var Redis=require('ioredis');var intUtil=require(_0x2d62('0x4'));var config=require(_0x2d62('0x5'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x2d62('0x6')]=_[_0x2d62('0x7')](config[_0x2d62('0x6')],{'host':_0x2d62('0x8'),'port':0x18eb});var io=require(_0x2d62('0x9'))(new Redis(config[_0x2d62('0x6')]));var def={'method':_0x2d62('0xa'),'json':!![]};function emit(_0x85c8c6,_0x40ad66,_0x2d1363){io['to'](_0x85c8c6)[_0x2d62('0xb')](_0x40ad66,_0x2d1363);}function getTicket(_0x593be6,_0x57fbbd,_0x528a76,_0x1c0be0,_0x105e54,_0x3f5eb6,_0x1483b5,_0x1e9f3e){logger['info']('Creating\x20new\x20ticket...');var _0x283dee=new Date();var _0x8ce6=[{'name':_0x2d62('0xc'),'value':intUtil[_0x2d62('0xd')](_0x1c0be0[_0x2d62('0xe')],_0x105e54,'\x20')},{'name':_0x2d62('0xf'),'value':_0x57fbbd['id']},{'name':'created_by','value':_0x57fbbd['id']},{'name':_0x2d62('0x10'),'value':intUtil[_0x2d62('0xd')](_0x1c0be0[_0x2d62('0x11')],_0x105e54,'\x0a')},{'name':_0x2d62('0x12'),'value':_0x283dee[_0x2d62('0x13')]()[_0x2d62('0x14')](0x0,0x13)[_0x2d62('0x15')]('T','\x20')},{'name':_0x2d62('0x16'),'value':'0'},{'name':_0x2d62('0x17'),'value':'15'},{'name':_0x2d62('0x18'),'value':_0x528a76['id']},{'name':'parent_type','value':_0x2d62('0x19')},{'name':_0x2d62('0x1a'),'value':_0x528a76[_0x2d62('0xc')]},{'name':_0x2d62('0x1b'),'value':_0x1e9f3e}];if(_0x3f5eb6['length']){_['forEach'](_0x3f5eb6,function(_0x1deca6){if(_0x105e54[_0x1deca6[_0x2d62('0x1c')]]){_0x8ce6[_0x2d62('0x1d')]({'name':_0x1deca6[_0x2d62('0x1e')],'value':_0x105e54[_0x1deca6[_0x2d62('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x2d62('0x1f'),'response_type':_0x2d62('0x1f'),'rest_data':JSON[_0x2d62('0x20')]({'session':_0x1483b5['id'],'module_name':'Calls','name_value_list':_0x8ce6})}});}function getAuth(_0x3ae5d1){return util[_0x2d62('0x21')](_0x2d62('0x22'),new Buffer(_0x3ae5d1[_0x2d62('0x23')]+':X')[_0x2d62('0x24')](_0x2d62('0x25')));}function getServerInfo(_0x103d46){return request({'form':{'method':_0x2d62('0x26'),'input_type':_0x2d62('0x1f'),'response_type':'JSON','rest_data':JSON[_0x2d62('0x20')]({'session':_0x103d46['id']})}});}function getUser(_0x5b89e0,_0x2eb173,_0x1f0ff3){if(!_[_0x2d62('0x27')](_0x2eb173)){logger[_0x2d62('0x28')](_0x2d62('0x29'),_0x2eb173);return request({'form':{'method':_0x2d62('0x2a'),'input_type':_0x2d62('0x1f'),'response_type':_0x2d62('0x1f'),'rest_data':JSON[_0x2d62('0x20')]({'session':_0x1f0ff3['id'],'module_name':'Employees','query':util[_0x2d62('0x21')](_0x2d62('0x2b'),_0x2eb173),'order_by':'','offset':'0','select_fields':['id',_0x2d62('0xc'),_0x2d62('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2d62('0x2d')](function(_0x21e44f){if(_0x21e44f['entry_list'][_0x2d62('0x2e')]){var _0x4f7d75=_[_0x2d62('0x2f')](_0x21e44f[_0x2d62('0x30')],function(_0x3b1a6d){return _0x3b1a6d['name_value_list'][_0x2d62('0x2c')][_0x2d62('0x31')]===_0x2eb173;});if(_0x4f7d75){logger[_0x2d62('0x28')](_0x2d62('0x32'));return BPromise[_0x2d62('0x33')]({'id':_0x4f7d75[_0x2d62('0x34')]['id'][_0x2d62('0x31')],'name':_0x4f7d75[_0x2d62('0x34')]['name'][_0x2d62('0x31')]});}}logger[_0x2d62('0x28')](_0x2d62('0x35'));return BPromise[_0x2d62('0x33')]({'id':_0x1f0ff3[_0x2d62('0x34')][_0x2d62('0x36')][_0x2d62('0x31')],'name':_0x1f0ff3['name_value_list'][_0x2d62('0x2c')][_0x2d62('0x31')]});});}else{logger[_0x2d62('0x28')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x2d62('0x33')]({'id':_0x1f0ff3[_0x2d62('0x34')]['user_id'][_0x2d62('0x31')],'name':_0x1f0ff3[_0x2d62('0x34')][_0x2d62('0x2c')][_0x2d62('0x31')]});}}function getEndUser(_0x442752,_0x4b0434,_0x3d9841,_0x8b212){logger[_0x2d62('0x28')](_0x2d62('0x37'),_0x3d9841);return request({'form':{'method':_0x2d62('0x2a'),'input_type':'JSON','response_type':_0x2d62('0x1f'),'rest_data':JSON[_0x2d62('0x20')]({'session':_0x8b212['id'],'module_name':_0x2d62('0x19'),'query':util['format'](_0x2d62('0x38'),_0x3d9841),'order_by':'','offset':'0','select_fields':['id',_0x2d62('0xc'),_0x2d62('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2d62('0x2d')](function(_0x349992){if(_0x349992['entry_list'][_0x2d62('0x2e')]){var _0xfffdae=_[_0x2d62('0x2f')](_0x349992['entry_list'],function(_0x489fed){return _0x489fed[_0x2d62('0x34')][_0x2d62('0x39')][_0x2d62('0x31')]===_0x3d9841;});if(_0xfffdae){logger[_0x2d62('0x28')](_0x2d62('0x3a'));return BPromise[_0x2d62('0x33')]({'id':_0xfffdae['name_value_list']['id'][_0x2d62('0x31')],'name':_0xfffdae[_0x2d62('0x34')][_0x2d62('0xc')][_0x2d62('0x31')],'phone':_0xfffdae[_0x2d62('0x34')]['phone_home'][_0x2d62('0x31')]});}}else{logger['info'](_0x2d62('0x3b'));return request({'form':{'method':_0x2d62('0x3c'),'input_type':_0x2d62('0x1f'),'response_type':_0x2d62('0x1f'),'rest_data':JSON[_0x2d62('0x20')]({'session':_0x8b212['id'],'module_name':_0x2d62('0x19'),'name_value_list':[{'name':_0x2d62('0x3d'),'value':_0x4b0434!==_0x2d62('0x3e')?_0x4b0434:util[_0x2d62('0x21')]('Caller\x20-\x20%s',_0x3d9841)},{'name':_0x2d62('0x39'),'value':_0x3d9841}]})}})[_0x2d62('0x2d')](function(_0x15b2ff){logger[_0x2d62('0x28')](_0x2d62('0x3f'));return BPromise[_0x2d62('0x33')]({'id':_0x15b2ff['id'],'name':_0x15b2ff['entry_list']['first_name'][_0x2d62('0x31')],'phone':_0x15b2ff[_0x2d62('0x30')][_0x2d62('0x39')][_0x2d62('0x31')]});});}});}function request(_0x35b1c3){logger[_0x2d62('0x40')]('[HTTP]',JSON[_0x2d62('0x20')](_0x35b1c3));return rp(_['merge'](def,_0x35b1c3));}function getTags(_0x494ee6,_0x303301){var _0xc2f65=[];if(_0x494ee6&&_0x494ee6[_0x2d62('0x2e')]>0x0){_0xc2f65=_[_0x2d62('0x41')](_0x494ee6,_0x303301);}return _0xc2f65;}function getCustomFields(_0x42e609,_0x437014){var _0x5b072e=[];var _0x36c0a4={'custom_fields':[]};if(_0x42e609['length']>0x0){_[_0x2d62('0x42')](_0x42e609,function(_0x54211a){if(_0x54211a[_0x2d62('0x43')]===_0x2d62('0x44')&&_0x54211a[_0x2d62('0x45')]&&!_0x54211a[_0x2d62('0x46')]){_0x36c0a4[_0x54211a[_0x2d62('0x45')][_0x2d62('0x47')]()]=_0x54211a[_0x2d62('0x48')][_0x2d62('0x24')]();}else if(_0x54211a[_0x2d62('0x43')]==='string'&&_0x54211a[_0x2d62('0x1e')]&&_0x54211a['customField']){_0x36c0a4[_0x2d62('0x49')][_0x2d62('0x1d')]({'id':_0x54211a[_0x2d62('0x1e')],'value':_0x54211a[_0x2d62('0x48')][_0x2d62('0x24')]()});}else if(_0x54211a['type']===_0x2d62('0x4a')&&_0x54211a[_0x2d62('0x1c')]&&_0x54211a[_0x2d62('0x1e')]&&_0x54211a[_0x2d62('0x46')]){_0x437014[_0x54211a['variableName']]&&_0x36c0a4['custom_fields']['push']({'id':_0x54211a[_0x2d62('0x1e')],'value':_0x437014[_0x54211a[_0x2d62('0x1c')]]['toString']()});}else if(_0x54211a[_0x2d62('0x43')]===_0x2d62('0x4b')&&_0x54211a['Variable']&&_0x54211a[_0x2d62('0x4c')][_0x2d62('0xc')]&&_0x54211a['idField']&&_0x54211a[_0x2d62('0x46')]){_0x437014[_0x54211a[_0x2d62('0x4c')][_0x2d62('0xc')][_0x2d62('0x47')]()]&&_0x36c0a4[_0x2d62('0x49')]['push']({'id':_0x54211a[_0x2d62('0x1e')],'value':_0x437014[_0x54211a['Variable']['name']['toLowerCase']()][_0x2d62('0x24')]()});}});}return _0x36c0a4;}function getConnection(_0x466716){return request({'method':_0x2d62('0xa'),'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2d62('0x20')]({'user_auth':{'user_name':_0x466716[_0x2d62('0x4d')],'password':_0x466716['password'],'encryption':_0x2d62('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x2d62('0x2d')](function(_0x4f1aa2){var _0x4e9dd6=_0x4f1aa2;if(_0x4e9dd6['id']){def[_0x2d62('0x4f')]=_0x4e9dd6['id'];return BPromise[_0x2d62('0x33')](_0x4e9dd6);}else{throw new Error(util[_0x2d62('0x21')](_0x2d62('0x50'),_0x466716['id']));}});}function setRelationship(_0x2ca937,_0x5becb1,_0x347bff,_0x81e59a){return request({'form':{'method':_0x2d62('0x51'),'input_type':_0x2d62('0x1f'),'response_type':_0x2d62('0x1f'),'rest_data':JSON[_0x2d62('0x20')]({'session':_0x2ca937['id'],'module_name':_0x2d62('0x52'),'module_id':_0x347bff['id'],'link_field_name':_0x81e59a,'related_ids':[_0x5becb1['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x186ffd,_0x350a3e,_0x6c9ca2,_0x2e5e01,_0x555fb1,_0x59eb81){var _0x6a93fc,_0xab7c1a,_0x34f102,_0x35dacd;_0x59eb81[_0x2d62('0x53')]=intUtil[_0x2d62('0x54')](_0x59eb81[_0x2d62('0x53')]);_0x59eb81['serverUrl']=intUtil[_0x2d62('0x54')](_0x59eb81['serverUrl']);def[_0x2d62('0x55')]=util[_0x2d62('0x21')](_0x2d62('0x56'),_0x59eb81[_0x2d62('0x53')]);if(_0x555fb1&&_0x555fb1[_0x2d62('0x57')]){logger[_0x2d62('0x28')](_0x2d62('0x58'),_0x2d62('0x59'));_0x350a3e[_0x2d62('0x5a')]=util[_0x2d62('0x21')](_0x2d62('0x5b'),_0x59eb81[_0x2d62('0x5c')],_0x350a3e[_0x2d62('0x5d')],md5(_0x350a3e[_0x2d62('0x5d')]));}else{_0x350a3e[_0x2d62('0x5a')]='';}return getConnection(_0x59eb81)[_0x2d62('0x2d')](function(_0x54ff41){_0x35dacd=_0x54ff41;return getUser(_0x59eb81,_0x2e5e01[_0x2d62('0xc')],_0x35dacd);})[_0x2d62('0x2d')](function(_0x5c4aa5){_0x6a93fc=_0x5c4aa5;logger[_0x2d62('0x28')](_0x2d62('0x5e'),_0x6a93fc['id']);return getEndUser(_0x59eb81,_0x350a3e[_0x2d62('0x5f')],_0x350a3e[_0x2d62('0x60')],_0x35dacd);})[_0x2d62('0x2d')](function(_0x48818c){_0xab7c1a=_0x48818c;logger[_0x2d62('0x28')]('The\x20Enduser\x20ID\x20is:',_0xab7c1a['id']);return getTicket(_0x59eb81,_0x6a93fc,_0xab7c1a,_0x6c9ca2,_0x350a3e,_0x6c9ca2[_0x2d62('0x61')],_0x35dacd,'Inbound');})[_0x2d62('0x2d')](function(_0x523dc6){_0x34f102=_0x523dc6;logger['info'](_0x2d62('0x62'));logger[_0x2d62('0x28')](_0x2d62('0x63'),_0x34f102['id']);return setRelationship(_0x35dacd,_0x6a93fc,_0x34f102,_0x2d62('0x64'));})[_0x2d62('0x2d')](function(){return setRelationship(_0x35dacd,_0xab7c1a,_0x34f102,_0x2d62('0x65'));})['then'](function(){return getServerInfo(_0x35dacd);})['then'](function(_0x4f1371){var _0x80bf8a=parseInt(_0x4f1371[_0x2d62('0x66')][_0x2d62('0x67')](0x0));var _0x128075=util[_0x2d62('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x59eb81[_0x2d62('0x53')],_0x34f102['id']);if(_0x80bf8a>0x6){_0x128075=util[_0x2d62('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x59eb81[_0x2d62('0x53')],_0x34f102['id']);}logger[_0x2d62('0x28')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2d62('0x21')](_0x2d62('0x68'),_0x2e5e01[_0x2d62('0xc')]),_0x2d62('0x69'),{'uri':_0x128075});})['catch'](function(_0x11be4e){logger[_0x2d62('0x6a')](_0x2d62('0x58'),JSON[_0x2d62('0x20')](_0x11be4e));});};exports[_0x2d62('0x6b')]=function(_0x31ba6f,_0x136829,_0x23209a,_0x3bc6fa,_0x3c138f,_0x3dca3e,_0x5dcdf1){var _0x3335d8,_0x30a8b0,_0x4e2ae9,_0x253057;_0x3dca3e['remoteUri']=intUtil[_0x2d62('0x54')](_0x3dca3e['remoteUri']);_0x3dca3e['serverUrl']=intUtil[_0x2d62('0x54')](_0x3dca3e[_0x2d62('0x5c')]);def[_0x2d62('0x55')]=util[_0x2d62('0x21')]('%s/service/v4_1/rest.php',_0x3dca3e[_0x2d62('0x53')]);if(_0x5dcdf1&&_0x5dcdf1[_0x2d62('0x6c')]&&_0x5dcdf1['recordingFormat']!=='none'){logger[_0x2d62('0x28')](_0x2d62('0x6d'),_0x2d62('0x59'));_0x136829[_0x2d62('0x5a')]=util['format'](_0x2d62('0x5b'),_0x3dca3e['serverUrl'],_0x136829[_0x2d62('0x5d')],md5(_0x136829[_0x2d62('0x5d')]));}return getConnection(_0x3dca3e)[_0x2d62('0x2d')](function(_0x2c1a84){_0x253057=_0x2c1a84;return getUser(_0x3dca3e,_0x3bc6fa[_0x2d62('0xc')],_0x253057);})[_0x2d62('0x2d')](function(_0x5ee95d){_0x3335d8=_0x5ee95d;logger[_0x2d62('0x28')]('The\x20User\x20ID\x20is:',_0x3335d8['id']);return getEndUser(_0x3dca3e,_0x136829[_0x2d62('0x6e')],_0x136829['destcalleridnum'],_0x253057);})[_0x2d62('0x2d')](function(_0x2fc8de){_0x30a8b0=_0x2fc8de;logger['info']('The\x20Enduser\x20ID\x20is:',_0x30a8b0['id']);return getTicket(_0x3dca3e,_0x3335d8,_0x30a8b0,_0x23209a,_0x136829,_0x23209a['Fields'],_0x253057,_0x2d62('0x6f'));})[_0x2d62('0x2d')](function(_0x36ffa6){_0x4e2ae9=_0x36ffa6;logger[_0x2d62('0x28')](_0x2d62('0x62'));logger[_0x2d62('0x28')](_0x2d62('0x63'),_0x4e2ae9['id']);return setRelationship(_0x253057,_0x3335d8,_0x4e2ae9,_0x2d62('0x64'));})[_0x2d62('0x2d')](function(){return setRelationship(_0x253057,_0x30a8b0,_0x4e2ae9,_0x2d62('0x65'));})[_0x2d62('0x2d')](function(){return getServerInfo(_0x253057);})['then'](function(_0x3073fc){var _0x211949=parseInt(_0x3073fc[_0x2d62('0x66')][_0x2d62('0x67')](0x0));var _0x4a0318=util[_0x2d62('0x21')](_0x2d62('0x70'),_0x3dca3e[_0x2d62('0x53')],_0x4e2ae9['id']);if(_0x211949>0x6){_0x4a0318=util['format'](_0x2d62('0x71'),_0x3dca3e['remoteUri'],_0x4e2ae9['id']);}logger[_0x2d62('0x28')](_0x2d62('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2d62('0x68'),_0x3bc6fa['name']),_0x2d62('0x69'),{'uri':_0x4a0318});})[_0x2d62('0x72')](function(_0x564f94){logger[_0x2d62('0x6a')](_0x2d62('0x6d'),JSON[_0x2d62('0x20')](_0x564f94));});};exports[_0x2d62('0x73')]=function(_0x55fbb2,_0x51898c,_0x404650,_0x13460c,_0x1eadbf,_0xdef071){var _0x31e2bb,_0x112b15,_0x1efbca,_0x318af2;_0xdef071[_0x2d62('0x53')]=intUtil[_0x2d62('0x54')](_0xdef071[_0x2d62('0x53')]);_0xdef071[_0x2d62('0x5c')]=intUtil['stripTrailingSlash'](_0xdef071['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0xdef071[_0x2d62('0x53')]);if(_0x1eadbf&&_0x1eadbf[_0x2d62('0x57')]){logger[_0x2d62('0x28')]('['+_0x51898c[_0x2d62('0x74')][_0x2d62('0x75')]()+']',_0x2d62('0x59'));_0x51898c[_0x2d62('0x5a')]=util[_0x2d62('0x21')](_0x2d62('0x5b'),_0xdef071[_0x2d62('0x5c')],_0x51898c[_0x2d62('0x5d')],md5(_0x51898c['uniqueid']));}else{_0x51898c['recordingURL']='';}return getConnection(_0xdef071)[_0x2d62('0x2d')](function(_0x1b6c8c){_0x318af2=_0x1b6c8c;if(!_[_0x2d62('0x27')](_0x13460c)){return getUser(_0xdef071,_0x13460c[_0x2d62('0xc')],_0x318af2);}else{return getUser(_0xdef071,null,_0x318af2);}})[_0x2d62('0x2d')](function(_0x23c717){_0x31e2bb=_0x23c717;logger[_0x2d62('0x28')](_0x2d62('0x5e'),_0x31e2bb['id']);return getEndUser(_0xdef071,_0x51898c[_0x2d62('0x5f')],_0x51898c[_0x2d62('0x60')],_0x318af2);})[_0x2d62('0x2d')](function(_0x49cf3f){_0x112b15=_0x49cf3f;logger['info'](_0x2d62('0x76'),_0x112b15['id']);return getTicket(_0xdef071,_0x31e2bb,_0x112b15,_0x404650,_0x51898c,_0x404650[_0x2d62('0x61')],_0x318af2,_0x2d62('0x77'));})[_0x2d62('0x2d')](function(_0xc11251){_0x1efbca=_0xc11251;logger[_0x2d62('0x28')](_0x2d62('0x62'));logger[_0x2d62('0x28')](_0x2d62('0x63'),_0x1efbca['id']);return setRelationship(_0x318af2,_0x31e2bb,_0x1efbca,_0x2d62('0x64'));})['then'](function(){return setRelationship(_0x318af2,_0x112b15,_0x1efbca,'contacts');})[_0x2d62('0x2d')](function(){return getServerInfo(_0x318af2);})[_0x2d62('0x72')](function(_0x20c90d){logger[_0x2d62('0x6a')]('['+_0x51898c[_0x2d62('0x74')][_0x2d62('0x75')]()+']',JSON[_0x2d62('0x20')](_0x20c90d));});}; \ 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 bd894e9..007a95c 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 _0x3b96=['stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format'];(function(_0x1dd08c,_0x2ffe93){var _0x422d44=function(_0x12e5ba){while(--_0x12e5ba){_0x1dd08c['push'](_0x1dd08c['shift']());}};_0x422d44(++_0x2ffe93);}(_0x3b96,0xae));var _0x63b9=function(_0x101994,_0x27c160){_0x101994=_0x101994-0x0;var _0x370588=_0x3b96[_0x101994];return _0x370588;};'use strict';var _=require(_0x63b9('0x0'));var util=require(_0x63b9('0x1'));exports[_0x63b9('0x2')]=function(_0x5b7b30,_0x6877bc,_0x2056a1){var _0xd3ea2f=[];if(_0x5b7b30[_0x63b9('0x3')]>0x0){var _0x1ecd12=_[_0x63b9('0x4')](_0x5b7b30,['id']);for(var _0x2fd339=0x0;_0x2fd339<_0x1ecd12[_0x63b9('0x3')];_0x2fd339++){var _0x32971a=_0x1ecd12[_0x2fd339];if(_0x32971a[_0x63b9('0x5')]===_0x63b9('0x6')){_0xd3ea2f[_0x63b9('0x7')](_0x32971a[_0x63b9('0x8')]);}else if(_0x32971a['type']===_0x63b9('0x9')&&_0x32971a[_0x63b9('0xa')]){_0x6877bc[_0x32971a[_0x63b9('0xa')]]&&_0xd3ea2f['push'](_0x6877bc[_0x32971a[_0x63b9('0xa')]][_0x63b9('0xb')]());}else if(_0x32971a[_0x63b9('0x5')]===_0x63b9('0xc')&&_0x32971a[_0x63b9('0xd')]&&_0x32971a['Variable'][_0x63b9('0xe')]){_0x6877bc[_0x32971a[_0x63b9('0xd')][_0x63b9('0xe')]['toLowerCase']()]&&_0xd3ea2f[_0x63b9('0x7')](_0x6877bc[_0x32971a[_0x63b9('0xd')]['name'][_0x63b9('0xf')]()]['toString']());}else if(_0x32971a[_0x63b9('0x5')]===_0x63b9('0x10')){if(_0x32971a[_0x63b9('0x11')]===_0x63b9('0x6')&&_0x32971a[_0x63b9('0x12')]){_0xd3ea2f[_0x63b9('0x7')](util['format'](_0x63b9('0x13'),_0x32971a[_0x63b9('0x12')],_0x32971a[_0x63b9('0x14')]));}else if(_0x32971a[_0x63b9('0x11')]===_0x63b9('0x9')&&_0x32971a[_0x63b9('0xa')]&&_0x32971a[_0x63b9('0x12')]){_0x6877bc[_0x32971a['variableName']]&&_0xd3ea2f['push'](util[_0x63b9('0x15')](_0x63b9('0x13'),_0x32971a[_0x63b9('0x12')],_0x6877bc[_0x32971a[_0x63b9('0xa')]]));}else if(_0x32971a['keyType']===_0x63b9('0xc')&&_0x32971a[_0x63b9('0xd')]&&_0x32971a[_0x63b9('0xd')][_0x63b9('0xe')]&&_0x32971a[_0x63b9('0x12')]){_0x6877bc[_0x32971a['Variable']['name'][_0x63b9('0xf')]()]&&_0xd3ea2f[_0x63b9('0x7')](util[_0x63b9('0x15')](_0x63b9('0x13'),_0x32971a[_0x63b9('0x12')],_0x6877bc[_0x32971a['Variable'][_0x63b9('0xe')][_0x63b9('0xf')]()]));}}}}return _0xd3ea2f['join'](_0x2056a1);};exports[_0x63b9('0x16')]=function(_0x4cf749){var _0x187fce=_0x4cf749[_0x63b9('0x17')](-0x1);if(_0x187fce==='/'){_0x4cf749=_0x4cf749['substring'](0x0,_0x4cf749[_0x63b9('0x18')](_0x187fce));}return _0x4cf749;};exports[_0x63b9('0x19')]=function(_0x4f32c1){if(!_[_0x63b9('0x1a')](_0x4f32c1)&&_0x4f32c1!==''){var _0x1457e1=/^(([^<>()\[\]\\.,;:\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 _0x1457e1[_0x63b9('0x1b')](String(_0x4f32c1)[_0x63b9('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xe6e4=['push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','util','getString','length','type','string'];(function(_0x126864,_0x479f4d){var _0x931724=function(_0x3922cb){while(--_0x3922cb){_0x126864['push'](_0x126864['shift']());}};_0x931724(++_0x479f4d);}(_0xe6e4,0x1a4));var _0x4e6e=function(_0x1d7791,_0x2a291f){_0x1d7791=_0x1d7791-0x0;var _0x2293f8=_0xe6e4[_0x1d7791];return _0x2293f8;};'use strict';var _=require('lodash');var util=require(_0x4e6e('0x0'));exports[_0x4e6e('0x1')]=function(_0x475a13,_0x24be58,_0xeaba9d){var _0x179cc6=[];if(_0x475a13[_0x4e6e('0x2')]>0x0){var _0x103726=_['sortBy'](_0x475a13,['id']);for(var _0x2d8b8e=0x0;_0x2d8b8e<_0x103726[_0x4e6e('0x2')];_0x2d8b8e++){var _0x3def36=_0x103726[_0x2d8b8e];if(_0x3def36[_0x4e6e('0x3')]===_0x4e6e('0x4')){_0x179cc6[_0x4e6e('0x5')](_0x3def36[_0x4e6e('0x6')]);}else if(_0x3def36[_0x4e6e('0x3')]===_0x4e6e('0x7')&&_0x3def36[_0x4e6e('0x8')]){_0x24be58[_0x3def36[_0x4e6e('0x8')]]&&_0x179cc6[_0x4e6e('0x5')](_0x24be58[_0x3def36['variableName']]['toString']());}else if(_0x3def36[_0x4e6e('0x3')]===_0x4e6e('0x9')&&_0x3def36['Variable']&&_0x3def36[_0x4e6e('0xa')][_0x4e6e('0xb')]){_0x24be58[_0x3def36[_0x4e6e('0xa')][_0x4e6e('0xb')][_0x4e6e('0xc')]()]&&_0x179cc6[_0x4e6e('0x5')](_0x24be58[_0x3def36['Variable']['name'][_0x4e6e('0xc')]()][_0x4e6e('0xd')]());}else if(_0x3def36[_0x4e6e('0x3')]===_0x4e6e('0xe')){if(_0x3def36[_0x4e6e('0xf')]===_0x4e6e('0x4')&&_0x3def36[_0x4e6e('0x10')]){_0x179cc6[_0x4e6e('0x5')](util[_0x4e6e('0x11')](_0x4e6e('0x12'),_0x3def36[_0x4e6e('0x10')],_0x3def36[_0x4e6e('0x13')]));}else if(_0x3def36['keyType']==='variable'&&_0x3def36[_0x4e6e('0x8')]&&_0x3def36[_0x4e6e('0x10')]){_0x24be58[_0x3def36['variableName']]&&_0x179cc6[_0x4e6e('0x5')](util[_0x4e6e('0x11')]('%s:\x20%s',_0x3def36['key'],_0x24be58[_0x3def36['variableName']]));}else if(_0x3def36['keyType']===_0x4e6e('0x9')&&_0x3def36['Variable']&&_0x3def36[_0x4e6e('0xa')][_0x4e6e('0xb')]&&_0x3def36[_0x4e6e('0x10')]){_0x24be58[_0x3def36[_0x4e6e('0xa')][_0x4e6e('0xb')][_0x4e6e('0xc')]()]&&_0x179cc6[_0x4e6e('0x5')](util[_0x4e6e('0x11')](_0x4e6e('0x12'),_0x3def36[_0x4e6e('0x10')],_0x24be58[_0x3def36[_0x4e6e('0xa')][_0x4e6e('0xb')][_0x4e6e('0xc')]()]));}}}}return _0x179cc6['join'](_0xeaba9d);};exports[_0x4e6e('0x14')]=function(_0x2ce75a){var _0x513f3b=_0x2ce75a[_0x4e6e('0x15')](-0x1);if(_0x513f3b==='/'){_0x2ce75a=_0x2ce75a[_0x4e6e('0x16')](0x0,_0x2ce75a[_0x4e6e('0x17')](_0x513f3b));}return _0x2ce75a;};exports[_0x4e6e('0x18')]=function(_0x374d06){if(!_['isNil'](_0x374d06)&&_0x374d06!==''){var _0x630ec2=/^(([^<>()\[\]\\.,;:\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 _0x630ec2['test'](String(_0x374d06)[_0x4e6e('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 5e7c1da..f30493d 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x5c7864,_0xe31f2d){var _0x837491=function(_0x2030de){while(--_0x2030de){_0x5c7864['push'](_0x5c7864['shift']());}};_0x837491(++_0xe31f2d);}(_0x34e8,0x12c));var _0x834e=function(_0x5f2980,_0x2e167a){_0x5f2980=_0x5f2980-0x0;var _0xd04d23=_0x34e8[_0x5f2980];return _0xd04d23;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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(_0x3b4cd2,_0x249513){var _0x551693=function(_0x55649c){while(--_0x55649c){_0x3b4cd2['push'](_0x3b4cd2['shift']());}};_0x551693(++_0x249513);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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 4bb0198..d547384 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 _0x03fd=['includes','string','picklist','type','customField','content','idField','custom_fields','push','variable','variableName','Variable','toLowerCase','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','first','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach'];(function(_0x30a372,_0x23f270){var _0x1cef84=function(_0x3bfc65){while(--_0x3bfc65){_0x30a372['push'](_0x30a372['shift']());}};_0x1cef84(++_0x23f270);}(_0x03fd,0x11a));var _0xd03f=function(_0x359ffa,_0x140d66){_0x359ffa=_0x359ffa-0x0;var _0x1cc6b9=_0x03fd[_0x359ffa];return _0x1cc6b9;};'use strict';var _=require(_0xd03f('0x0'));var rp=require(_0xd03f('0x1'));var md5=require(_0xd03f('0x2'));var util=require(_0xd03f('0x3'));var Redis=require('ioredis');var intUtil=require(_0xd03f('0x4'));var config=require(_0xd03f('0x5'));var logger=require(_0xd03f('0x6'))(_0xd03f('0x7'));config[_0xd03f('0x8')]=_[_0xd03f('0x9')](config[_0xd03f('0x8')],{'host':_0xd03f('0xa'),'port':0x18eb});var io=require(_0xd03f('0xb'))(new Redis(config[_0xd03f('0x8')]));function emit(_0x4eb449,_0x575330,_0x1e981f){io['to'](_0x4eb449)['emit'](_0x575330,_0x1e981f);}var headers={'Content-Type':_0xd03f('0xc'),'Accept':_0xd03f('0xc')};function getTicket(_0x23ba86,_0xbb0670,_0x30fba5,_0x137cf5,_0x58a65c){logger[_0xd03f('0xd')](_0xd03f('0xe'));return request({'uri':util[_0xd03f('0xf')](_0xd03f('0x10'),_0x23ba86[_0xd03f('0x11')]),'method':_0xd03f('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x30fba5['id'],'submitter_id':_0xbb0670?_0xbb0670['id']:undefined,'assignee_id':_0xbb0670?_0xbb0670['id']:undefined,'tags':getTags(_0x137cf5['Tags'],_0xd03f('0x13')),'subject':intUtil[_0xd03f('0x14')](_0x137cf5[_0xd03f('0x15')],_0x58a65c,'\x20'),'description':intUtil['getString'](_0x137cf5[_0xd03f('0x16')],_0x58a65c,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd03f('0x14')](_0x137cf5[_0xd03f('0x16')],_0x58a65c,'\x0a')}},getCustomFields(_0x137cf5[_0xd03f('0x17')],_0x58a65c))}})[_0xd03f('0x18')](function(_0x301c07){logger[_0xd03f('0xd')](_0xd03f('0x19'));return _0x301c07[_0xd03f('0x1a')];});}function getUser(_0x1c16f5,_0x5b9bc4){if(intUtil[_0xd03f('0x1b')](_0x5b9bc4)){logger['info'](_0xd03f('0x1c'),_0x5b9bc4);return request({'uri':util[_0xd03f('0xf')](_0xd03f('0x1d'),_0x1c16f5[_0xd03f('0x11')]),'qs':{'query':util[_0xd03f('0xf')](_0xd03f('0x1e'),_0x5b9bc4)}})[_0xd03f('0x18')](function(_0x1088aa){if(_0x1088aa[_0xd03f('0x1f')]){logger['info'](_0xd03f('0x20'));return _[_0xd03f('0x21')](_0x1088aa[_0xd03f('0x22')],{'email':_0x5b9bc4,'role':_0xd03f('0x23')});}else{logger[_0xd03f('0xd')](_0xd03f('0x24'));return request({'uri':util[_0xd03f('0xf')](_0xd03f('0x25'),_0x1c16f5[_0xd03f('0x11')])})[_0xd03f('0x18')](function(_0x32d8bd){logger[_0xd03f('0xd')]('Admin\x20account\x20selected.');return _0x32d8bd[_0xd03f('0x26')];});}});}else{logger['info'](_0xd03f('0x24'));return request({'uri':util[_0xd03f('0xf')](_0xd03f('0x25'),_0x1c16f5['remoteUri'])})['then'](function(_0x4210ce){logger['info'](_0xd03f('0x27'));return _0x4210ce[_0xd03f('0x26')];});}}function getEndUser(_0x2ffa1b,_0x3a9267,_0x1f4e0f){logger[_0xd03f('0xd')](_0xd03f('0x28'),_0x1f4e0f);return request({'uri':util[_0xd03f('0xf')]('%s/search.json',_0x2ffa1b[_0xd03f('0x11')]),'qs':{'query':util[_0xd03f('0xf')](_0xd03f('0x29'),_0x1f4e0f)}})[_0xd03f('0x18')](function(_0x419298){var _0x47d50f;if(_0x419298['results']['length']){_0x419298['results']=_[_0xd03f('0x2a')](_0x419298[_0xd03f('0x22')],{'suspended':![],'role':'end-user'});if(_0x419298[_0xd03f('0x22')][_0xd03f('0x2b')]){_0x47d50f=_[_0xd03f('0x2c')](_0x419298['results']);}}if(_0x47d50f){logger[_0xd03f('0xd')](_0xd03f('0x2d'));return _0x47d50f;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xd03f('0xf')](_0xd03f('0x2e'),_0x2ffa1b['remoteUri']),'method':_0xd03f('0x12'),'body':{'user':{'role':_0xd03f('0x2f'),'name':util[_0xd03f('0xf')](_0xd03f('0x30'),_0x3a9267||_0x1f4e0f),'phone':_0x1f4e0f}}})['then'](function(_0x16561c){logger[_0xd03f('0xd')]('Enduser\x20created.');return _0x16561c[_0xd03f('0x26')];});}});}function getAuth(_0x377d25){var _0x2f9905;if(_0x377d25[_0xd03f('0x31')]===_0xd03f('0x32')){_0x2f9905=util[_0xd03f('0xf')](_0xd03f('0x33'),_0x377d25[_0xd03f('0x34')],_0x377d25[_0xd03f('0x32')]);}else if(_0x377d25['authType']===_0xd03f('0x35')){_0x2f9905=util[_0xd03f('0xf')](_0xd03f('0x36'),_0x377d25[_0xd03f('0x34')],_0x377d25[_0xd03f('0x35')]);}return util[_0xd03f('0xf')](_0xd03f('0x37'),new Buffer(_0x2f9905)[_0xd03f('0x38')]('base64'));}function request(_0x2d93d9){logger[_0xd03f('0x39')](_0xd03f('0x3a'),JSON[_0xd03f('0x3b')](_0x2d93d9));return rp(_[_0xd03f('0x9')](_0x2d93d9,{'method':_0xd03f('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x2059da,_0x22ba7b){var _0x1dcbe8=[];if(_0x2059da&&_0x2059da[_0xd03f('0x2b')]>0x0){_0x1dcbe8=_[_0xd03f('0x3d')](_0x2059da,_0x22ba7b);}return _0x1dcbe8;}function getCustomFields(_0x3819b9,_0x4ef3c0){var _0x5083c5=[];var _0x1472b9={'custom_fields':[]};if(_0x3819b9[_0xd03f('0x2b')]>0x0){_[_0xd03f('0x3e')](_0x3819b9,function(_0x3a331e){if(_[_0xd03f('0x3f')]([_0xd03f('0x40'),_0xd03f('0x41')],_0x3a331e[_0xd03f('0x42')])&&_0x3a331e['nameField']&&!_0x3a331e[_0xd03f('0x43')]){_0x1472b9[_0x3a331e['nameField']['toLowerCase']()]=_0x3a331e[_0xd03f('0x44')][_0xd03f('0x38')]();}else if(_['includes']([_0xd03f('0x40'),_0xd03f('0x41')],_0x3a331e[_0xd03f('0x42')])&&_0x3a331e[_0xd03f('0x45')]&&_0x3a331e[_0xd03f('0x43')]){_0x1472b9[_0xd03f('0x46')][_0xd03f('0x47')]({'id':_0x3a331e['idField'],'value':_0x3a331e[_0xd03f('0x44')][_0xd03f('0x38')]()});}else if(_0x3a331e['type']===_0xd03f('0x48')&&_0x3a331e[_0xd03f('0x49')]&&_0x3a331e[_0xd03f('0x45')]&&_0x3a331e[_0xd03f('0x43')]){_0x4ef3c0[_0x3a331e['variableName']]&&_0x1472b9['custom_fields']['push']({'id':_0x3a331e[_0xd03f('0x45')],'value':_0x4ef3c0[_0x3a331e['variableName']]['toString']()});}else if(_0x3a331e[_0xd03f('0x42')]==='customVariable'&&_0x3a331e[_0xd03f('0x4a')]&&_0x3a331e['Variable']['name']&&_0x3a331e[_0xd03f('0x45')]&&_0x3a331e[_0xd03f('0x43')]){_0x4ef3c0[_0x3a331e[_0xd03f('0x4a')][_0xd03f('0x13')][_0xd03f('0x4b')]()]&&_0x1472b9[_0xd03f('0x46')][_0xd03f('0x47')]({'id':_0x3a331e[_0xd03f('0x45')],'value':_0x4ef3c0[_0x3a331e['Variable']['name'][_0xd03f('0x4b')]()][_0xd03f('0x38')]()});}});}return _0x1472b9;}exports[_0xd03f('0x4c')]=function(_0x436903,_0x348a25,_0x48ed91,_0x4769c6,_0x59708e,_0x2a313c){var _0x1323ed,_0x8c17e2;_0x2a313c['remoteUri']=intUtil['stripTrailingSlash'](_0x2a313c[_0xd03f('0x11')]);_0x2a313c[_0xd03f('0x4d')]=intUtil['stripTrailingSlash'](_0x2a313c['serverUrl']);if(_0x59708e&&_0x59708e[_0xd03f('0x4e')]){logger[_0xd03f('0xd')](_0xd03f('0x4f'),_0xd03f('0x50'));_0x348a25[_0xd03f('0x51')]=util[_0xd03f('0xf')](_0xd03f('0x52'),_0x2a313c[_0xd03f('0x4d')],_0x348a25[_0xd03f('0x53')],md5(_0x348a25[_0xd03f('0x53')]));}else{_0x348a25[_0xd03f('0x51')]='';}headers['Authorization']=getAuth(_0x2a313c);return getUser(_0x2a313c,_0x4769c6[_0xd03f('0x54')])[_0xd03f('0x18')](function(_0x2657df){_0x1323ed=_0x2657df;logger[_0xd03f('0xd')]('The\x20User\x20ID\x20is:',_0x1323ed['id']);return getEndUser(_0x2a313c,_0x348a25[_0xd03f('0x55')],_0x348a25['calleridnum']);})[_0xd03f('0x18')](function(_0x33d1a9){_0x8c17e2=_0x33d1a9;logger['info'](_0xd03f('0x56'),_0x8c17e2['id']);return getTicket(_0x2a313c,_0x1323ed,_0x8c17e2,_0x48ed91,_0x348a25);})[_0xd03f('0x18')](function(_0x2afa5f){if(_0x2afa5f){logger[_0xd03f('0xd')](_0xd03f('0x57'),_0x2afa5f['id']);switch(_0x2a313c[_0xd03f('0x42')]){case'integrationTab':logger[_0xd03f('0xd')](_0xd03f('0x4f'),_0xd03f('0x58'));return request({'uri':util['format'](_0xd03f('0x59'),_0x2a313c[_0xd03f('0x11')],_0x1323ed['id'],_0x2afa5f['id']),'method':'POST'});case _0xd03f('0x5a'):logger[_0xd03f('0xd')](_0xd03f('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd03f('0x5b'),_0x4769c6[_0xd03f('0x13')]),_0xd03f('0x5c'),{'uri':util[_0xd03f('0xf')](_0xd03f('0x5d'),_0x2a313c[_0xd03f('0x11')]['replace'](_0xd03f('0x5e'),''),_0x2afa5f['id'])});break;default:logger[_0xd03f('0x5f')](_0xd03f('0x4f'),_0xd03f('0x60'));}}})['catch'](function(_0x54b0c7){logger['error'](_0xd03f('0x61'),util[_0xd03f('0x62')](_0x54b0c7,{'showHidden':!![],'depth':null}));});};exports[_0xd03f('0x63')]=function(_0x3da31a,_0xe4ba28,_0x55ee95,_0xe62c43,_0xf8e589,_0x3ed741,_0x501d67){var _0x292049,_0x5861f5;_0x3ed741['remoteUri']=intUtil[_0xd03f('0x64')](_0x3ed741['remoteUri']);_0x3ed741[_0xd03f('0x4d')]=intUtil[_0xd03f('0x64')](_0x3ed741[_0xd03f('0x4d')]);if(_0x501d67&&_0x501d67[_0xd03f('0x65')]&&_0x501d67[_0xd03f('0x65')]!==_0xd03f('0x66')){logger[_0xd03f('0xd')](_0xd03f('0x67'),_0xd03f('0x50'));_0xe4ba28['recordingURL']=util[_0xd03f('0xf')](_0xd03f('0x52'),_0x3ed741[_0xd03f('0x4d')],_0xe4ba28['uniqueid'],md5(_0xe4ba28[_0xd03f('0x53')]));}headers[_0xd03f('0x68')]=getAuth(_0x3ed741);return getUser(_0x3ed741,_0xe62c43[_0xd03f('0x54')])[_0xd03f('0x18')](function(_0xbc162c){_0x292049=_0xbc162c;logger['info'](_0xd03f('0x69'),_0x292049['id']);return getEndUser(_0x3ed741,_0xe4ba28[_0xd03f('0x6a')],_0xe4ba28[_0xd03f('0x6b')]);})['then'](function(_0x3c3fd6){_0x5861f5=_0x3c3fd6;logger[_0xd03f('0xd')](_0xd03f('0x56'),_0x5861f5['id']);return getTicket(_0x3ed741,_0x292049,_0x5861f5,_0x55ee95,_0xe4ba28);})['then'](function(_0x1762f5){if(_0x1762f5){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1762f5['id']);switch(_0x3ed741[_0xd03f('0x42')]){case _0xd03f('0x6c'):logger[_0xd03f('0xd')](_0xd03f('0x67'),_0xd03f('0x58'));return request({'uri':util['format'](_0xd03f('0x59'),_0x3ed741[_0xd03f('0x11')],_0x292049['id'],_0x1762f5['id']),'method':_0xd03f('0x12')});case _0xd03f('0x5a'):logger[_0xd03f('0xd')]('[OUTBOUND]',_0xd03f('0x6d'));emit(util[_0xd03f('0xf')](_0xd03f('0x5b'),_0xe62c43[_0xd03f('0x13')]),_0xd03f('0x5c'),{'uri':util['format'](_0xd03f('0x5d'),_0x3ed741['remoteUri'][_0xd03f('0x6e')](_0xd03f('0x5e'),''),_0x1762f5['id'])});break;default:logger[_0xd03f('0x5f')](_0xd03f('0x67'),_0xd03f('0x60'));}}})['catch'](function(_0x5262b8){logger[_0xd03f('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd03f('0x62')](_0x5262b8,{'showHidden':!![],'depth':null}));});};exports[_0xd03f('0x6f')]=function(_0x3435cb,_0x11d5f2,_0x278ad7,_0xac78ee,_0x3d0a59,_0x456ba9){var _0x312158,_0x782bbd;_0x456ba9[_0xd03f('0x11')]=intUtil['stripTrailingSlash'](_0x456ba9[_0xd03f('0x11')]);_0x456ba9[_0xd03f('0x4d')]=intUtil[_0xd03f('0x64')](_0x456ba9[_0xd03f('0x4d')]);if(_0x3d0a59&&_0x3d0a59[_0xd03f('0x4e')]){logger[_0xd03f('0xd')]('['+_0x11d5f2[_0xd03f('0x70')][_0xd03f('0x71')]()+']',_0xd03f('0x50'));_0x11d5f2[_0xd03f('0x51')]=util[_0xd03f('0xf')](_0xd03f('0x52'),_0x456ba9[_0xd03f('0x4d')],_0x11d5f2['uniqueid'],md5(_0x11d5f2['uniqueid']));}else{_0x11d5f2[_0xd03f('0x51')]='';}headers[_0xd03f('0x68')]=getAuth(_0x456ba9);return getUser(_0x456ba9)['then'](function(_0xcc147b){_0x312158=_0xcc147b;logger[_0xd03f('0xd')](_0xd03f('0x69'),_0x312158['id']);return getEndUser(_0x456ba9,_0x11d5f2[_0xd03f('0x55')],_0x11d5f2['calleridnum']);})[_0xd03f('0x18')](function(_0x1bb568){_0x782bbd=_0x1bb568;logger[_0xd03f('0xd')](_0xd03f('0x56'),_0x782bbd['id']);return getTicket(_0x456ba9,_0x312158,_0x782bbd,_0x278ad7,_0x11d5f2);})[_0xd03f('0x18')](function(_0x3073b2){if(_0x3073b2){logger[_0xd03f('0xd')](_0xd03f('0x57'),_0x3073b2['id']);}})['catch'](function(_0x38a57c){logger[_0xd03f('0x5f')]('['+_0x11d5f2[_0xd03f('0x70')][_0xd03f('0x71')]()+']'+_0xd03f('0x72'),util[_0xd03f('0x62')](_0x38a57c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2cd6=['nameField','picklist','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','username','password','%s/token:%s','Basic\x20%s','toString','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField'];(function(_0x29a89a,_0x2dc401){var _0x1f2858=function(_0x477719){while(--_0x477719){_0x29a89a['push'](_0x29a89a['shift']());}};_0x1f2858(++_0x2dc401);}(_0x2cd6,0x187));var _0x62cd=function(_0x5f03e5,_0x1b4ef1){_0x5f03e5=_0x5f03e5-0x0;var _0x3edd89=_0x2cd6[_0x5f03e5];return _0x3edd89;};'use strict';var _=require(_0x62cd('0x0'));var rp=require(_0x62cd('0x1'));var md5=require(_0x62cd('0x2'));var util=require(_0x62cd('0x3'));var Redis=require(_0x62cd('0x4'));var intUtil=require(_0x62cd('0x5'));var config=require('../../../../config/environment');var logger=require(_0x62cd('0x6'))(_0x62cd('0x7'));config[_0x62cd('0x8')]=_[_0x62cd('0x9')](config['redis'],{'host':_0x62cd('0xa'),'port':0x18eb});var io=require(_0x62cd('0xb'))(new Redis(config[_0x62cd('0x8')]));function emit(_0x54f070,_0x56ef3b,_0x131001){io['to'](_0x54f070)[_0x62cd('0xc')](_0x56ef3b,_0x131001);}var headers={'Content-Type':_0x62cd('0xd'),'Accept':'application/json'};function getTicket(_0x240e49,_0xf13b49,_0x158370,_0x3cd913,_0x59e5f6){logger[_0x62cd('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x10'),_0x240e49[_0x62cd('0x11')]),'method':_0x62cd('0x12'),'body':{'ticket':_[_0x62cd('0x13')]({'requester_id':_0x158370['id'],'submitter_id':_0xf13b49?_0xf13b49['id']:undefined,'assignee_id':_0xf13b49?_0xf13b49['id']:undefined,'tags':getTags(_0x3cd913[_0x62cd('0x14')],_0x62cd('0x15')),'subject':intUtil[_0x62cd('0x16')](_0x3cd913[_0x62cd('0x17')],_0x59e5f6,'\x20'),'description':intUtil[_0x62cd('0x16')](_0x3cd913['Descriptions'],_0x59e5f6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3cd913['Descriptions'],_0x59e5f6,'\x0a')}},getCustomFields(_0x3cd913[_0x62cd('0x18')],_0x59e5f6))}})[_0x62cd('0x19')](function(_0x5b577c){logger['info'](_0x62cd('0x1a'));return _0x5b577c[_0x62cd('0x1b')];});}function getUser(_0xba379d,_0x4d9bba){if(intUtil[_0x62cd('0x1c')](_0x4d9bba)){logger['info'](_0x62cd('0x1d'),_0x4d9bba);return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x1e'),_0xba379d['remoteUri']),'qs':{'query':util[_0x62cd('0xf')]('type:user\x20role:agent\x20email:%s',_0x4d9bba)}})['then'](function(_0x400691){if(_0x400691[_0x62cd('0x1f')]){logger[_0x62cd('0xe')](_0x62cd('0x20'));return _[_0x62cd('0x21')](_0x400691['results'],{'email':_0x4d9bba,'role':_0x62cd('0x22')});}else{logger[_0x62cd('0xe')](_0x62cd('0x23'));return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x24'),_0xba379d[_0x62cd('0x11')])})['then'](function(_0x557393){logger['info']('Admin\x20account\x20selected.');return _0x557393[_0x62cd('0x25')];});}});}else{logger['info'](_0x62cd('0x23'));return request({'uri':util['format'](_0x62cd('0x24'),_0xba379d[_0x62cd('0x11')])})['then'](function(_0x14dfcd){logger[_0x62cd('0xe')](_0x62cd('0x26'));return _0x14dfcd['user'];});}}function getEndUser(_0xa49072,_0x2564f0,_0x2e48dd){logger['info'](_0x62cd('0x27'),_0x2e48dd);return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x1e'),_0xa49072['remoteUri']),'qs':{'query':util['format'](_0x62cd('0x28'),_0x2e48dd)}})[_0x62cd('0x19')](function(_0xa48781){var _0x169333;if(_0xa48781[_0x62cd('0x29')][_0x62cd('0x2a')]){_0xa48781[_0x62cd('0x29')]=_['filter'](_0xa48781[_0x62cd('0x29')],{'suspended':![],'role':'end-user'});if(_0xa48781[_0x62cd('0x29')][_0x62cd('0x2a')]){_0x169333=_[_0x62cd('0x2b')](_0xa48781['results']);}}if(_0x169333){logger[_0x62cd('0xe')](_0x62cd('0x2c'));return _0x169333;}else{logger[_0x62cd('0xe')](_0x62cd('0x2d'));return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x2e'),_0xa49072[_0x62cd('0x11')]),'method':'POST','body':{'user':{'role':_0x62cd('0x2f'),'name':util[_0x62cd('0xf')](_0x62cd('0x30'),_0x2564f0||_0x2e48dd),'phone':_0x2e48dd}}})[_0x62cd('0x19')](function(_0x56c79b){logger[_0x62cd('0xe')]('Enduser\x20created.');return _0x56c79b['user'];});}});}function getAuth(_0x1dd356){var _0x386e8f;if(_0x1dd356[_0x62cd('0x31')]==='password'){_0x386e8f=util[_0x62cd('0xf')](_0x62cd('0x32'),_0x1dd356[_0x62cd('0x33')],_0x1dd356[_0x62cd('0x34')]);}else if(_0x1dd356['authType']==='token'){_0x386e8f=util[_0x62cd('0xf')](_0x62cd('0x35'),_0x1dd356[_0x62cd('0x33')],_0x1dd356['token']);}return util[_0x62cd('0xf')](_0x62cd('0x36'),new Buffer(_0x386e8f)[_0x62cd('0x37')]('base64'));}function request(_0x10057a){logger['debug'](_0x62cd('0x38'),JSON[_0x62cd('0x39')](_0x10057a));return rp(_['defaults'](_0x10057a,{'method':_0x62cd('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x2666d0,_0x2d41c8){var _0x3e791d=[];if(_0x2666d0&&_0x2666d0[_0x62cd('0x2a')]>0x0){_0x3e791d=_[_0x62cd('0x3b')](_0x2666d0,_0x2d41c8);}return _0x3e791d;}function getCustomFields(_0x5be54f,_0x12c779){var _0xc3a28f=[];var _0x4c13f1={'custom_fields':[]};if(_0x5be54f[_0x62cd('0x2a')]>0x0){_[_0x62cd('0x3c')](_0x5be54f,function(_0x49615d){if(_[_0x62cd('0x3d')]([_0x62cd('0x3e'),'picklist'],_0x49615d[_0x62cd('0x3f')])&&_0x49615d['nameField']&&!_0x49615d[_0x62cd('0x40')]){_0x4c13f1[_0x49615d[_0x62cd('0x41')]['toLowerCase']()]=_0x49615d['content'][_0x62cd('0x37')]();}else if(_[_0x62cd('0x3d')]([_0x62cd('0x3e'),_0x62cd('0x42')],_0x49615d[_0x62cd('0x3f')])&&_0x49615d[_0x62cd('0x43')]&&_0x49615d['customField']){_0x4c13f1[_0x62cd('0x44')][_0x62cd('0x45')]({'id':_0x49615d[_0x62cd('0x43')],'value':_0x49615d['content'][_0x62cd('0x37')]()});}else if(_0x49615d[_0x62cd('0x3f')]===_0x62cd('0x46')&&_0x49615d['variableName']&&_0x49615d[_0x62cd('0x43')]&&_0x49615d[_0x62cd('0x40')]){_0x12c779[_0x49615d[_0x62cd('0x47')]]&&_0x4c13f1[_0x62cd('0x44')][_0x62cd('0x45')]({'id':_0x49615d[_0x62cd('0x43')],'value':_0x12c779[_0x49615d[_0x62cd('0x47')]][_0x62cd('0x37')]()});}else if(_0x49615d[_0x62cd('0x3f')]===_0x62cd('0x48')&&_0x49615d['Variable']&&_0x49615d['Variable'][_0x62cd('0x15')]&&_0x49615d[_0x62cd('0x43')]&&_0x49615d['customField']){_0x12c779[_0x49615d[_0x62cd('0x49')][_0x62cd('0x15')]['toLowerCase']()]&&_0x4c13f1[_0x62cd('0x44')][_0x62cd('0x45')]({'id':_0x49615d[_0x62cd('0x43')],'value':_0x12c779[_0x49615d[_0x62cd('0x49')]['name'][_0x62cd('0x4a')]()][_0x62cd('0x37')]()});}});}return _0x4c13f1;}exports[_0x62cd('0x4b')]=function(_0x5ed0e4,_0x5a7ee7,_0x10f913,_0x5098da,_0xeb5e6d,_0x22afdb){var _0x25dbdd,_0x568d2e;_0x22afdb[_0x62cd('0x11')]=intUtil['stripTrailingSlash'](_0x22afdb[_0x62cd('0x11')]);_0x22afdb[_0x62cd('0x4c')]=intUtil[_0x62cd('0x4d')](_0x22afdb['serverUrl']);if(_0xeb5e6d&&_0xeb5e6d[_0x62cd('0x4e')]){logger[_0x62cd('0xe')]('[QUEUE]',_0x62cd('0x4f'));_0x5a7ee7['recordingURL']=util[_0x62cd('0xf')](_0x62cd('0x50'),_0x22afdb[_0x62cd('0x4c')],_0x5a7ee7[_0x62cd('0x51')],md5(_0x5a7ee7['uniqueid']));}else{_0x5a7ee7[_0x62cd('0x52')]='';}headers[_0x62cd('0x53')]=getAuth(_0x22afdb);return getUser(_0x22afdb,_0x5098da['email'])[_0x62cd('0x19')](function(_0x34858b){_0x25dbdd=_0x34858b;logger[_0x62cd('0xe')](_0x62cd('0x54'),_0x25dbdd['id']);return getEndUser(_0x22afdb,_0x5a7ee7[_0x62cd('0x55')],_0x5a7ee7[_0x62cd('0x56')]);})[_0x62cd('0x19')](function(_0xc4150a){_0x568d2e=_0xc4150a;logger[_0x62cd('0xe')](_0x62cd('0x57'),_0x568d2e['id']);return getTicket(_0x22afdb,_0x25dbdd,_0x568d2e,_0x10f913,_0x5a7ee7);})[_0x62cd('0x19')](function(_0x5d6f02){if(_0x5d6f02){logger[_0x62cd('0xe')](_0x62cd('0x58'),_0x5d6f02['id']);switch(_0x22afdb[_0x62cd('0x3f')]){case _0x62cd('0x59'):logger[_0x62cd('0xe')](_0x62cd('0x5a'),_0x62cd('0x5b'));return request({'uri':util['format'](_0x62cd('0x5c'),_0x22afdb['remoteUri'],_0x25dbdd['id'],_0x5d6f02['id']),'method':_0x62cd('0x12')});case _0x62cd('0x5d'):logger[_0x62cd('0xe')](_0x62cd('0x5a'),_0x62cd('0x5e'));emit(util['format']('user:%s',_0x5098da['name']),_0x62cd('0x5f'),{'uri':util[_0x62cd('0xf')](_0x62cd('0x60'),_0x22afdb[_0x62cd('0x11')][_0x62cd('0x61')](_0x62cd('0x62'),''),_0x5d6f02['id'])});break;default:logger[_0x62cd('0x63')](_0x62cd('0x5a'),_0x62cd('0x64'));}}})['catch'](function(_0x3883d8){logger[_0x62cd('0x63')](_0x62cd('0x65'),util[_0x62cd('0x66')](_0x3883d8,{'showHidden':!![],'depth':null}));});};exports[_0x62cd('0x67')]=function(_0x12a899,_0x56dc74,_0x43f11f,_0x502f9c,_0x5b6de1,_0x1d99ec,_0x199409){var _0x5f450b,_0x504add;_0x1d99ec[_0x62cd('0x11')]=intUtil[_0x62cd('0x4d')](_0x1d99ec[_0x62cd('0x11')]);_0x1d99ec[_0x62cd('0x4c')]=intUtil[_0x62cd('0x4d')](_0x1d99ec[_0x62cd('0x4c')]);if(_0x199409&&_0x199409[_0x62cd('0x68')]&&_0x199409[_0x62cd('0x68')]!=='none'){logger['info'](_0x62cd('0x69'),_0x62cd('0x4f'));_0x56dc74[_0x62cd('0x52')]=util[_0x62cd('0xf')](_0x62cd('0x50'),_0x1d99ec[_0x62cd('0x4c')],_0x56dc74[_0x62cd('0x51')],md5(_0x56dc74[_0x62cd('0x51')]));}headers[_0x62cd('0x53')]=getAuth(_0x1d99ec);return getUser(_0x1d99ec,_0x502f9c[_0x62cd('0x6a')])[_0x62cd('0x19')](function(_0x1ee0da){_0x5f450b=_0x1ee0da;logger[_0x62cd('0xe')](_0x62cd('0x54'),_0x5f450b['id']);return getEndUser(_0x1d99ec,_0x56dc74['destcalleridname'],_0x56dc74[_0x62cd('0x6b')]);})[_0x62cd('0x19')](function(_0x7b270b){_0x504add=_0x7b270b;logger[_0x62cd('0xe')]('The\x20Enduser\x20ID\x20is:',_0x504add['id']);return getTicket(_0x1d99ec,_0x5f450b,_0x504add,_0x43f11f,_0x56dc74);})[_0x62cd('0x19')](function(_0x5515f7){if(_0x5515f7){logger['info'](_0x62cd('0x58'),_0x5515f7['id']);switch(_0x1d99ec[_0x62cd('0x3f')]){case _0x62cd('0x59'):logger['info'](_0x62cd('0x69'),_0x62cd('0x5b'));return request({'uri':util[_0x62cd('0xf')](_0x62cd('0x5c'),_0x1d99ec['remoteUri'],_0x5f450b['id'],_0x5515f7['id']),'method':_0x62cd('0x12')});case _0x62cd('0x5d'):logger[_0x62cd('0xe')]('[OUTBOUND]',_0x62cd('0x5e'));emit(util[_0x62cd('0xf')]('user:%s',_0x502f9c['name']),_0x62cd('0x5f'),{'uri':util[_0x62cd('0xf')]('%s/agent/tickets/%s',_0x1d99ec[_0x62cd('0x11')]['replace']('/api/v2',''),_0x5515f7['id'])});break;default:logger[_0x62cd('0x63')](_0x62cd('0x69'),_0x62cd('0x64'));}}})[_0x62cd('0x6c')](function(_0x362df6){logger['error'](_0x62cd('0x6d'),util[_0x62cd('0x66')](_0x362df6,{'showHidden':!![],'depth':null}));});};exports[_0x62cd('0x6e')]=function(_0x8e81ef,_0x2e2b1c,_0x3b7ab9,_0x3effb9,_0x2a858b,_0xba9ebd){var _0xbad609,_0x5e4d93;_0xba9ebd[_0x62cd('0x11')]=intUtil[_0x62cd('0x4d')](_0xba9ebd[_0x62cd('0x11')]);_0xba9ebd[_0x62cd('0x4c')]=intUtil[_0x62cd('0x4d')](_0xba9ebd[_0x62cd('0x4c')]);if(_0x2a858b&&_0x2a858b['monitor_format']){logger['info']('['+_0x2e2b1c[_0x62cd('0x6f')][_0x62cd('0x70')]()+']',_0x62cd('0x4f'));_0x2e2b1c[_0x62cd('0x52')]=util[_0x62cd('0xf')](_0x62cd('0x50'),_0xba9ebd['serverUrl'],_0x2e2b1c[_0x62cd('0x51')],md5(_0x2e2b1c[_0x62cd('0x51')]));}else{_0x2e2b1c[_0x62cd('0x52')]='';}headers[_0x62cd('0x53')]=getAuth(_0xba9ebd);return getUser(_0xba9ebd)[_0x62cd('0x19')](function(_0x1a3cf0){_0xbad609=_0x1a3cf0;logger[_0x62cd('0xe')]('The\x20User\x20ID\x20is:',_0xbad609['id']);return getEndUser(_0xba9ebd,_0x2e2b1c[_0x62cd('0x55')],_0x2e2b1c[_0x62cd('0x56')]);})[_0x62cd('0x19')](function(_0x50f425){_0x5e4d93=_0x50f425;logger['info'](_0x62cd('0x57'),_0x5e4d93['id']);return getTicket(_0xba9ebd,_0xbad609,_0x5e4d93,_0x3b7ab9,_0x2e2b1c);})['then'](function(_0x19f9c9){if(_0x19f9c9){logger['info'](_0x62cd('0x58'),_0x19f9c9['id']);}})['catch'](function(_0x30136c){logger[_0x62cd('0x63')]('['+_0x2e2b1c[_0x62cd('0x6f')][_0x62cd('0x70')]()+']'+_0x62cd('0x71'),util['inspect'](_0x30136c,{'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 8d4ac82..9486076 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 _0x9b60=['profile','administrator','Subject','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','outbound','[OUTBOUND]','destcalleridname','Outbound','user:%s','unmanaged','monitor_format','toUpperCase','com','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','includes','string','picklist','idField','content','variableName','type','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','isBefore','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','stringify','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner'];(function(_0x3d75da,_0x372212){var _0x1bd83f=function(_0x3908dd){while(--_0x3908dd){_0x3d75da['push'](_0x3d75da['shift']());}};_0x1bd83f(++_0x372212);}(_0x9b60,0x174));var _0x09b6=function(_0xfd8260,_0x2f6fd0){_0xfd8260=_0xfd8260-0x0;var _0x54d8cb=_0x9b60[_0xfd8260];return _0x54d8cb;};'use strict';var _=require(_0x09b6('0x0'));var rp=require(_0x09b6('0x1'));var md5=require(_0x09b6('0x2'));var util=require(_0x09b6('0x3'));var intUtil=require(_0x09b6('0x4'));var moment=require(_0x09b6('0x5'));var Redis=require(_0x09b6('0x6'));var BPromise=require(_0x09b6('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x09b6('0x8'));config[_0x09b6('0x9')]=_[_0x09b6('0xa')](config[_0x09b6('0x9')],{'host':_0x09b6('0xb'),'port':0x18eb});var io=require(_0x09b6('0xc'))(new Redis(config[_0x09b6('0x9')]));function emit(_0x19f574,_0x3c9222,_0x3040da){io['to'](_0x19f574)[_0x09b6('0xd')](_0x3c9222,_0x3040da);}function request(_0x3df9d2){logger[_0x09b6('0xe')](_0x09b6('0xf'),JSON['stringify'](_0x3df9d2));return rp(_0x3df9d2);}function getCustomFields(_0x36986d,_0x3b9333){var _0x5b1799={};if(_0x36986d['length']>0x0){_[_0x09b6('0x10')](_0x36986d,function(_0x112184){if(_[_0x09b6('0x11')]([_0x09b6('0x12'),_0x09b6('0x13')],_0x112184['type'])&&_0x112184[_0x09b6('0x14')]){_0x5b1799[_0x112184[_0x09b6('0x14')]]=_0x112184[_0x09b6('0x15')]['toString']();}else if(_0x112184['type']==='variable'&&_0x112184[_0x09b6('0x16')]&&_0x112184[_0x09b6('0x14')]&&_0x3b9333[_0x112184[_0x09b6('0x16')]]){_0x5b1799[_0x112184[_0x09b6('0x14')]]=_0x3b9333[_0x112184[_0x09b6('0x16')]]['toString']();}else if(_0x112184[_0x09b6('0x17')]===_0x09b6('0x18')&&_0x112184[_0x09b6('0x19')]&&_0x112184[_0x09b6('0x19')][_0x09b6('0x1a')]&&_0x112184['idField']&&_0x3b9333[_0x112184[_0x09b6('0x19')][_0x09b6('0x1a')][_0x09b6('0x1b')]()]){_0x5b1799[_0x112184[_0x09b6('0x14')]]=_0x3b9333[_0x112184[_0x09b6('0x19')]['name'][_0x09b6('0x1b')]()][_0x09b6('0x1c')]();}});}return _0x5b1799;}function getName(_0x3d2b28){if(_0x3d2b28[_0x09b6('0x1d')]('\x20')>0x0){var _0xff437c=_0x3d2b28[_0x09b6('0x1e')](/ (.+)/);if(_0xff437c[0x1]){return _0xff437c;}}return[_0x3d2b28,_0x3d2b28];}var accountsTokens={};function getAccessToken(_0x4d0903){return new Promise(function(_0x3340b0,_0x4b24de){if(!_[_0x09b6('0x1f')](accountsTokens[_0x4d0903['id']])&&!_[_0x09b6('0x1f')](accountsTokens[_0x4d0903['id']]['access_token'])){if(moment()[_0x09b6('0x20')](accountsTokens[_0x4d0903['id']]['expires_in'])){_0x3340b0(accountsTokens[_0x4d0903['id']][_0x09b6('0x21')]);}}var _0x700746;switch(_0x4d0903[_0x09b6('0x22')]){case'US':_0x700746=_0x09b6('0x23');break;case'AU':_0x700746=_0x09b6('0x24');break;case'EU':_0x700746='https://accounts.zoho.eu';break;case'IN':_0x700746=_0x09b6('0x25');break;case'CN':_0x700746=_0x09b6('0x26');break;default:_0x700746=_0x09b6('0x27');break;}var _0x5c125c={'method':_0x09b6('0x28'),'uri':_0x700746+_0x09b6('0x29'),'qs':{'refresh_token':_0x4d0903[_0x09b6('0x2a')],'client_id':_0x4d0903[_0x09b6('0x2b')],'client_secret':_0x4d0903[_0x09b6('0x2c')],'grant_type':_0x09b6('0x2d')},'json':!![]};return rp(_0x5c125c)[_0x09b6('0x2e')](function(_0x348cdb){accountsTokens[_0x4d0903['id']]={'access_token':_0x348cdb['access_token'],'expires_in':moment()[_0x09b6('0x2f')](_0x348cdb['expires_in'],'seconds')};_0x3340b0(_0x348cdb[_0x09b6('0x21')]);})[_0x09b6('0x30')](function(_0x1a001c){logger[_0x09b6('0x31')](_0x09b6('0x32'),_0x1a001c[_0x09b6('0x33')]);_0x4b24de(_0x1a001c);});});}function getUser(_0x4642ac,_0x5281ff,_0x333b59,_0x3e9fba){logger[_0x09b6('0x34')]('Search\x20user');return request({'method':'GET','uri':util[_0x09b6('0x35')](_0x09b6('0x36'),_0x5281ff),'qs':{'type':_0x09b6('0x37')},'headers':{'Authorization':_0x09b6('0x38')+_0x4642ac},'json':!![]})[_0x09b6('0x2e')](function(_0x420992){if(_0x420992['users']){var _0x38847f=-0x1;if(_[_0x09b6('0x39')](_0x420992[_0x09b6('0x3a')])){if(!_[_0x09b6('0x1f')](_0x3e9fba)){_0x38847f=_[_0x09b6('0x3b')](_0x420992[_0x09b6('0x3a')],function(_0x19b9c9){return _0x19b9c9['email']===_0x3e9fba;});}if(_0x38847f>=0x0){logger[_0x09b6('0x34')]('Agent\x20found!');}else{logger[_0x09b6('0x34')]('Using\x20the\x20admin\x20account!');_0x38847f=_[_0x09b6('0x3b')](_0x420992[_0x09b6('0x3a')],function(_0x282efa){return _0x282efa['profile'][_0x09b6('0x1a')]===_0x09b6('0x3c');});}return _0x420992[_0x09b6('0x3a')][_0x38847f];}else{if(_0x420992['user']['profile'][_0x09b6('0x1a')]===_0x09b6('0x3c')){logger[_0x09b6('0x34')](_0x09b6('0x3d'));user=_0x420992[_0x09b6('0x3e')];return user;}else{logger['error'](_0x09b6('0x3f'),JSON[_0x09b6('0x40')](_0x420992));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x09b6('0x40')](_0x420992));}}}else{logger[_0x09b6('0x31')](_0x09b6('0x3f'),JSON['stringify'](_0x420992));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x420992));}})[_0x09b6('0x30')](function(_0x20a982){console[_0x09b6('0x31')](_0x20a982);});}function getZohoUser(_0x464caf,_0x9cd3c7){return new BPromise(function(_0x58affd,_0x3b7683){request(_0x464caf)[_0x09b6('0x2e')](function(_0x57373d){var _0x47e860=null;if(_0x57373d){_0x47e860=_0x57373d[_0x09b6('0x41')][0x0];_0x47e860[_0x09b6('0x42')]=_0x9cd3c7;}_0x58affd(_0x47e860);})['catch'](function(_0x975812){_0x3b7683(_0x975812);});});}function createEndUser(_0x116b2c,_0x562ec3,_0x370755,_0xb3b12f,_0x5d66f9,_0x1c6d6c){var _0x370755=getName(_0x370755);return request({'method':'POST','uri':_0x09b6('0x43')+_0x562ec3+_0x09b6('0x44')+_['startCase'](_0x1c6d6c[_0x09b6('0x45')])+'s','body':{'data':[{'Last_Name':_0x370755[0x1],'First_Name':_0x370755[0x0],'Phone':_0xb3b12f,'Owner':{'name':!_[_0x09b6('0x1f')](_0x5d66f9[_0x09b6('0x46')][_0x09b6('0x1a')])?_0x5d66f9['role']['name']:!_[_0x09b6('0x1f')](_0x5d66f9[_0x09b6('0x47')])?_0x5d66f9['first_name']+'\x20'+_0x5d66f9[_0x09b6('0x48')]:_0x5d66f9['last_name'],'id':_0x5d66f9['id']}}]},'headers':{'Authorization':_0x09b6('0x38')+_0x116b2c},'json':!![]})[_0x09b6('0x2e')](function(_0x1ca191){if(_0x1ca191&&_0x1ca191[_0x09b6('0x41')][0x0][_0x09b6('0x49')]===_0x09b6('0x4a')){var _0x1a7e1c=_0x1ca191[_0x09b6('0x41')][0x0][_0x09b6('0x4b')];_0x1a7e1c[_0x09b6('0x42')]=_[_0x09b6('0x4c')](_0x1c6d6c[_0x09b6('0x45')])+'s';return _0x1a7e1c;}logger[_0x09b6('0x31')](_0x09b6('0x3f'),JSON['stringify'](data));throw new Error(_0x09b6('0x4d')+JSON[_0x09b6('0x40')](data));})['catch'](function(_0x5e417e){console['log']('CREATE\x20ERROR',_0x5e417e);});}function getEndUser(_0xb6fe69,_0x599b3a,_0x2b2a2c,_0xbb41fc,_0xcaec39,_0x1ba44b,_0x40c810){var _0x34d523={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xb6fe69},'json':!![]};switch(_0x40c810['moduleSearch']){case'contact_lead':_0x34d523['uri']='https://www.zohoapis.'+_0x599b3a+_0x09b6('0x4e')+_0xcaec39+'))';return getZohoUser(_0x34d523,_0x09b6('0x4f'))[_0x09b6('0x2e')](function(_0x5951c8){if(_0x5951c8)return _0x5951c8;_0x34d523[_0x09b6('0x50')]=_0x09b6('0x43')+_0x599b3a+_0x09b6('0x51')+_0xcaec39+'))';return getZohoUser(_0x34d523,_0x09b6('0x52'))[_0x09b6('0x2e')](function(_0x9c2249){if(_0x9c2249)return _0x9c2249;if(_0x40c810[_0x09b6('0x45')]!=_0x09b6('0x53')){return createEndUser(_0xb6fe69,_0x599b3a,_0xbb41fc,_0xcaec39,_0x1ba44b,_0x40c810);}else{return{};}});});break;case _0x09b6('0x54'):_0x34d523[_0x09b6('0x50')]=_0x09b6('0x43')+_0x599b3a+_0x09b6('0x4e')+_0xcaec39+'))';return getZohoUser(_0x34d523,_0x09b6('0x4f'))['then'](function(_0x1d8d21){if(_0x1d8d21)return _0x1d8d21;if(_0x40c810[_0x09b6('0x45')]!=_0x09b6('0x53')){return createEndUser(_0xb6fe69,_0x599b3a,_0xbb41fc,_0xcaec39,_0x1ba44b,_0x40c810);}else{return{};}});break;case _0x09b6('0x55'):_0x34d523[_0x09b6('0x50')]=_0x09b6('0x43')+_0x599b3a+_0x09b6('0x51')+_0xcaec39+'))';return getZohoUser(_0x34d523,'Leads')[_0x09b6('0x2e')](function(_0x4bc8e0){if(_0x4bc8e0)return _0x4bc8e0;if(_0x40c810[_0x09b6('0x45')]!='nothing'){return createEndUser(_0xb6fe69,_0x599b3a,_0xbb41fc,_0xcaec39,_0x1ba44b,_0x40c810);}else{return{};}});break;}}function getCall(_0x1af32d,_0x2a21cb,_0x5a5ac0,_0x55171f,_0x14e2fd,_0x48fd28,_0x26516c,_0x54b015){logger[_0x09b6('0x34')]('Creating\x20new\x20call...');var _0x15fca5={};_0x15fca5[_0x09b6('0x56')]={'name':!_[_0x09b6('0x1f')](_0x55171f[_0x09b6('0x46')][_0x09b6('0x1a')])&&!_['isNil'](_0x55171f['profile'][_0x09b6('0x1a')])&&_0x55171f[_0x09b6('0x57')][_0x09b6('0x1a')]===_0x09b6('0x58')?_0x55171f['role'][_0x09b6('0x1a')]:!_[_0x09b6('0x1f')](_0x55171f[_0x09b6('0x47')])?_0x55171f[_0x09b6('0x47')]+'\x20'+_0x55171f[_0x09b6('0x48')]:_0x55171f['last_name'],'id':_0x55171f['id']};_0x15fca5[_0x09b6('0x59')]=intUtil['getString'](_0x48fd28['Subjects'],_0x26516c,'\x20');_0x15fca5[_0x09b6('0x5a')]=intUtil[_0x09b6('0x5b')](_0x48fd28['Descriptions'],_0x26516c,'\x0a');if(_0x14e2fd[_0x09b6('0x42')]==='Contacts'){_0x15fca5[_0x09b6('0x5c')]={'name':!_[_0x09b6('0x1f')](_0x14e2fd[_0x09b6('0x5d')])?_0x14e2fd[_0x09b6('0x5d')]:!_['isNil'](_0x14e2fd[_0x09b6('0x5e')])?_0x14e2fd[_0x09b6('0x5e')]+'\x20'+_0x14e2fd[_0x09b6('0x5f')]:_0x14e2fd['Last_Name'],'id':_0x14e2fd['id']};}if(_0x14e2fd[_0x09b6('0x42')]==='Leads'){_0x15fca5[_0x09b6('0x60')]={'name':!_[_0x09b6('0x1f')](_0x14e2fd[_0x09b6('0x5d')])?_0x14e2fd['Full_Name']:!_[_0x09b6('0x1f')](_0x14e2fd[_0x09b6('0x5e')])?_0x14e2fd[_0x09b6('0x5e')]+'\x20'+_0x14e2fd[_0x09b6('0x5f')]:_0x14e2fd[_0x09b6('0x5f')],'id':_0x14e2fd['id']};_0x15fca5['$se_module']=_['startCase'](_0x14e2fd[_0x09b6('0x42')]);}if(_0x26516c[_0x09b6('0x61')]){_0x15fca5['Call_Duration']=moment[_0x09b6('0x62')](parseInt(_0x26516c['talktime'])*0x3e8)[_0x09b6('0x35')](_0x09b6('0x63'));}else if(_0x26516c[_0x09b6('0x64')]&&_0x26516c['endtime']){_0x15fca5[_0x09b6('0x65')]=moment[_0x09b6('0x62')](moment(_0x26516c[_0x09b6('0x66')],_0x09b6('0x67'))[_0x09b6('0x68')](moment(_0x26516c[_0x09b6('0x69')],_0x09b6('0x67'))))[_0x09b6('0x35')]('mm:ss');}switch(_0x26516c[_0x09b6('0x6a')]){case'called':_0x15fca5[_0x09b6('0x6b')]=_0x09b6('0x6c');break;case _0x09b6('0x6d'):case _0x09b6('0x6e'):_0x15fca5[_0x09b6('0x6b')]=_0x09b6('0x6f');break;case _0x09b6('0x70'):_0x15fca5['Call_Result']=_0x09b6('0x71');break;case _0x09b6('0x72'):_0x15fca5[_0x09b6('0x6b')]=_0x09b6('0x73');break;case _0x09b6('0x74'):_0x15fca5[_0x09b6('0x6b')]=_0x09b6('0x75');default:}_0x15fca5[_0x09b6('0x76')]=(_0x54b015==='outbound'?moment(_0x26516c[_0x09b6('0x69')])[_0x09b6('0x35')](_0x09b6('0x67')):moment(_0x26516c[_0x09b6('0x77')])[_0x09b6('0x35')](_0x09b6('0x67')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x15fca5[_0x09b6('0x78')]=_0x54b015||'Inbound';_0x15fca5=_[_0x09b6('0x79')](_0x15fca5,getCustomFields(_0x48fd28[_0x09b6('0x7a')],_0x26516c));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x2a21cb+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1af32d},'body':{'data':[_0x15fca5]},'json':!![]})['then'](function(_0x30412a){if(_0x30412a&&_0x30412a[_0x09b6('0x41')][0x0][_0x09b6('0x49')]===_0x09b6('0x4a')){logger[_0x09b6('0x34')](_0x09b6('0x7b'));return{'id':_0x30412a['data'][0x0]['details']['id']};}})['catch'](function(_0x3a4783){logger['info'](_0x09b6('0x7c'),_0x3a4783[_0x09b6('0x33')]);console['log']('err',_0x3a4783);});}exports[_0x09b6('0x7d')]=function(_0x3bf6eb,_0x569c7b,_0x2df3d8,_0x168812,_0x26423e,_0x5550bb){var _0x5722d7,_0x29d385,_0x24cfd4;_0x5550bb['host']=intUtil[_0x09b6('0x7e')](_0x5550bb[_0x09b6('0x7f')]);_0x5550bb[_0x09b6('0x80')]=intUtil[_0x09b6('0x7e')](_0x5550bb[_0x09b6('0x80')]);if(_0x26423e&&_0x26423e['monitor_format']){logger[_0x09b6('0x34')](_0x09b6('0x81'),_0x09b6('0x82'));_0x569c7b[_0x09b6('0x83')]=_0x5550bb[_0x09b6('0x80')]+_0x09b6('0x84')+_0x569c7b[_0x09b6('0x85')]+_0x09b6('0x86')+md5(_0x569c7b[_0x09b6('0x85')]);}else{_0x569c7b[_0x09b6('0x83')]='';}var _0x43f768=_0x5550bb['host']===_0x09b6('0x87')?'eu':'com';return getAccessToken(_0x5550bb)[_0x09b6('0x2e')](function(_0x167ec2){_0x24cfd4=_0x167ec2;return getUser(_0x24cfd4,_0x43f768,_0x5550bb,_0x168812[_0x09b6('0x88')]);})['then'](function(_0x32e5da){_0x5722d7=_0x32e5da;logger[_0x09b6('0x34')](_0x09b6('0x89'),_0x5722d7['id']);return getEndUser(_0x24cfd4,_0x43f768,_0x5550bb,_0x569c7b[_0x09b6('0x8a')],_0x569c7b[_0x09b6('0x8b')],_0x5722d7,_0x2df3d8);})[_0x09b6('0x2e')](function(_0x26b386){_0x29d385=_0x26b386;return getCall(_0x24cfd4,_0x43f768,_0x5550bb,_0x5722d7,_0x29d385,_0x2df3d8,_0x569c7b,_0x09b6('0x8c'));})[_0x09b6('0x2e')](function(_0x393d47){if(_0x393d47){logger[_0x09b6('0x34')](_0x09b6('0x8d'),_0x393d47['id']);logger[_0x09b6('0x34')](_0x09b6('0x81'),_0x09b6('0x8e'));emit(util[_0x09b6('0x35')]('user:%s',_0x168812[_0x09b6('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5550bb[_0x09b6('0x7f')]+_0x09b6('0x8f')+_0x393d47['id']});}})['catch'](function(_0x5af218){logger[_0x09b6('0x31')](_0x09b6('0x81'),JSON[_0x09b6('0x40')](_0x5af218));});};exports[_0x09b6('0x90')]=function(_0x36d21b,_0x3be17a,_0x251676,_0x2c2b98,_0x18b2dc,_0x4255cd,_0x223806){var _0xb02a25,_0x4dc471,_0x316125;_0x4255cd[_0x09b6('0x7f')]=intUtil['stripTrailingSlash'](_0x4255cd['host']);_0x4255cd[_0x09b6('0x80')]=intUtil[_0x09b6('0x7e')](_0x4255cd['serverUrl']);if(_0x223806&&_0x223806['recordingFormat']&&_0x223806['recordingFormat']!=='none'){logger[_0x09b6('0x34')](_0x09b6('0x91'),_0x09b6('0x82'));_0x3be17a[_0x09b6('0x83')]=_0x4255cd[_0x09b6('0x80')]+_0x09b6('0x84')+_0x3be17a[_0x09b6('0x85')]+_0x09b6('0x86')+md5(_0x3be17a[_0x09b6('0x85')]);}var _0xe5c702=_0x4255cd['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x4255cd)['then'](function(_0x3f1599){_0x316125=_0x3f1599;return getUser(_0x316125,_0xe5c702,_0x4255cd,_0x2c2b98['email']);})['then'](function(_0x54e415){_0xb02a25=_0x54e415;logger['info']('The\x20User\x20ID\x20is:',_0xb02a25['id']);return getEndUser(_0x316125,_0xe5c702,_0x4255cd,_0x3be17a[_0x09b6('0x92')],_0x3be17a['destcalleridnum'],_0xb02a25,_0x251676);})[_0x09b6('0x2e')](function(_0x6037fa){_0x4dc471=_0x6037fa;return getCall(_0x316125,_0xe5c702,_0x4255cd,_0xb02a25,_0x4dc471,_0x251676,_0x3be17a,_0x09b6('0x93'));})['then'](function(_0x50cdc4){if(_0x50cdc4){logger[_0x09b6('0x34')](_0x09b6('0x8d'),_0x50cdc4['id']);logger[_0x09b6('0x34')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x09b6('0x35')](_0x09b6('0x94'),_0x2c2b98[_0x09b6('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x4255cd[_0x09b6('0x7f')]+_0x09b6('0x8f')+_0x50cdc4['id']});}})[_0x09b6('0x30')](function(_0x1382f5){logger['error']('[OUTBOUND]',JSON[_0x09b6('0x40')](_0x1382f5));});};exports[_0x09b6('0x95')]=function(_0x5a98fa,_0x32edf6,_0x4969f1,_0x32d283,_0x3f2a10,_0xc676e1){var _0x5376e8,_0x2ad08f,_0x2502a5;_0xc676e1[_0x09b6('0x7f')]=intUtil['stripTrailingSlash'](_0xc676e1[_0x09b6('0x7f')]);_0xc676e1[_0x09b6('0x80')]=intUtil['stripTrailingSlash'](_0xc676e1['serverUrl']);if(_0x3f2a10&&_0x3f2a10[_0x09b6('0x96')]){logger[_0x09b6('0x34')]('['+_0x32edf6['lastevent'][_0x09b6('0x97')]()+']',_0x09b6('0x82'));_0x32edf6[_0x09b6('0x83')]=_0xc676e1[_0x09b6('0x80')]+'/api/voice/recordings/'+_0x32edf6[_0x09b6('0x85')]+_0x09b6('0x86')+md5(_0x32edf6['uniqueid']);}else{_0x32edf6['recordingURL']='';}var _0xcbeede=_0xc676e1['host']===_0x09b6('0x87')?'eu':_0x09b6('0x98');return getAccessToken(_0xc676e1)['then'](function(_0x17e281){_0x2502a5=_0x17e281;return getUser(_0x2502a5,_0xcbeede,_0xc676e1);})[_0x09b6('0x2e')](function(_0x3dfd8b){_0x5376e8=_0x3dfd8b;logger['info'](_0x09b6('0x89'),_0x5376e8['id']);return getEndUser(_0x2502a5,_0xcbeede,_0xc676e1,_0x32edf6[_0x09b6('0x8a')],_0x32edf6[_0x09b6('0x8b')],_0x5376e8,_0x4969f1);})[_0x09b6('0x2e')](function(_0x58a18f){_0x2ad08f=_0x58a18f;return getCall(_0x2502a5,_0xcbeede,_0xc676e1,_0x5376e8,_0x2ad08f,_0x4969f1,_0x32edf6,_0x09b6('0x8c'));})[_0x09b6('0x2e')](function(_0x5604bc){if(_0x5604bc){logger['info'](_0x09b6('0x8d'),_0x5604bc['id']);}})[_0x09b6('0x30')](function(_0x2b1cf3){logger['error']('['+_0x32edf6[_0x09b6('0x6a')]['toUpperCase']()+']',JSON['stringify'](_0x2b1cf3));});}; \ No newline at end of file +var _0x4ded=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','ActiveUsers','users','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','catch','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','format','agentcalledAt','Call_Type','Call\x20created!','err','stack','queue','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridnum','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','trigger:browser:url','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x4ded,0x116));var _0xd4de=function(_0x32d10e,_0x275676){_0x32d10e=_0x32d10e-0x0;var _0x3febcb=_0x4ded[_0x32d10e];return _0x3febcb;};'use strict';var _=require(_0xd4de('0x0'));var rp=require(_0xd4de('0x1'));var md5=require(_0xd4de('0x2'));var util=require(_0xd4de('0x3'));var intUtil=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var Redis=require(_0xd4de('0x6'));var BPromise=require(_0xd4de('0x7'));var config=require(_0xd4de('0x8'));var logger=require(_0xd4de('0x9'))(_0xd4de('0xa'));config[_0xd4de('0xb')]=_['defaults'](config[_0xd4de('0xb')],{'host':_0xd4de('0xc'),'port':0x18eb});var io=require(_0xd4de('0xd'))(new Redis(config[_0xd4de('0xb')]));function emit(_0x4453c2,_0x1e8c35,_0x5c612f){io['to'](_0x4453c2)[_0xd4de('0xe')](_0x1e8c35,_0x5c612f);}function request(_0x5ebcf3){logger['debug']('[HTTP]',JSON[_0xd4de('0xf')](_0x5ebcf3));return rp(_0x5ebcf3);}function getCustomFields(_0x459a46,_0x4e5b10){var _0x5b6dc4={};if(_0x459a46['length']>0x0){_[_0xd4de('0x10')](_0x459a46,function(_0x49d931){if(_[_0xd4de('0x11')]([_0xd4de('0x12'),_0xd4de('0x13')],_0x49d931[_0xd4de('0x14')])&&_0x49d931[_0xd4de('0x15')]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x49d931[_0xd4de('0x16')][_0xd4de('0x17')]();}else if(_0x49d931[_0xd4de('0x14')]===_0xd4de('0x18')&&_0x49d931[_0xd4de('0x19')]&&_0x49d931[_0xd4de('0x15')]&&_0x4e5b10[_0x49d931[_0xd4de('0x19')]]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x4e5b10[_0x49d931[_0xd4de('0x19')]][_0xd4de('0x17')]();}else if(_0x49d931[_0xd4de('0x14')]==='customVariable'&&_0x49d931['Variable']&&_0x49d931[_0xd4de('0x1a')][_0xd4de('0x1b')]&&_0x49d931[_0xd4de('0x15')]&&_0x4e5b10[_0x49d931[_0xd4de('0x1a')]['name']['toLowerCase']()]){_0x5b6dc4[_0x49d931[_0xd4de('0x15')]]=_0x4e5b10[_0x49d931['Variable'][_0xd4de('0x1b')][_0xd4de('0x1c')]()]['toString']();}});}return _0x5b6dc4;}function getName(_0xc15081){if(_0xc15081['indexOf']('\x20')>0x0){var _0x2287d8=_0xc15081[_0xd4de('0x1d')](/ (.+)/);if(_0x2287d8[0x1]){return _0x2287d8;}}return[_0xc15081,_0xc15081];}var accountsTokens={};function getAccessToken(_0x2bad14){return new Promise(function(_0x8e8712,_0x5368f5){if(!_[_0xd4de('0x1e')](accountsTokens[_0x2bad14['id']])&&!_[_0xd4de('0x1e')](accountsTokens[_0x2bad14['id']][_0xd4de('0x1f')])){if(moment()[_0xd4de('0x20')](accountsTokens[_0x2bad14['id']][_0xd4de('0x21')])){_0x8e8712(accountsTokens[_0x2bad14['id']][_0xd4de('0x1f')]);}}var _0x1561fd;switch(_0x2bad14[_0xd4de('0x22')]){case'US':_0x1561fd=_0xd4de('0x23');break;case'AU':_0x1561fd=_0xd4de('0x24');break;case'EU':_0x1561fd='https://accounts.zoho.eu';break;case'IN':_0x1561fd=_0xd4de('0x25');break;case'CN':_0x1561fd=_0xd4de('0x26');break;default:_0x1561fd=_0xd4de('0x27');break;}var _0x22970c={'method':_0xd4de('0x28'),'uri':_0x1561fd+_0xd4de('0x29'),'qs':{'refresh_token':_0x2bad14[_0xd4de('0x2a')],'client_id':_0x2bad14[_0xd4de('0x2b')],'client_secret':_0x2bad14[_0xd4de('0x2c')],'grant_type':_0xd4de('0x2d')},'json':!![]};return rp(_0x22970c)[_0xd4de('0x2e')](function(_0xb2d8a1){accountsTokens[_0x2bad14['id']]={'access_token':_0xb2d8a1['access_token'],'expires_in':moment()[_0xd4de('0x2f')](_0xb2d8a1[_0xd4de('0x21')],'seconds')};_0x8e8712(_0xb2d8a1[_0xd4de('0x1f')]);})['catch'](function(_0x44b710){logger[_0xd4de('0x30')](_0xd4de('0x31'),_0x44b710['stack']);_0x5368f5(_0x44b710);});});}function getUser(_0xd4de93,_0x36f2f1,_0x17f0a,_0x50cb73){logger[_0xd4de('0x32')](_0xd4de('0x33'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x36f2f1),'qs':{'type':_0xd4de('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd4de93},'json':!![]})[_0xd4de('0x2e')](function(_0x1429ba){if(_0x1429ba[_0xd4de('0x35')]){var _0x2e08eb=-0x1;if(_['isArrayLikeObject'](_0x1429ba[_0xd4de('0x35')])){if(!_[_0xd4de('0x1e')](_0x50cb73)){_0x2e08eb=_['findIndex'](_0x1429ba[_0xd4de('0x35')],function(_0x1d86fc){return _0x1d86fc['email']===_0x50cb73;});}if(_0x2e08eb>=0x0){logger['info'](_0xd4de('0x36'));}else{logger[_0xd4de('0x32')](_0xd4de('0x37'));_0x2e08eb=_[_0xd4de('0x38')](_0x1429ba['users'],function(_0x2bdc98){return _0x2bdc98[_0xd4de('0x39')]['name']===_0xd4de('0x3a');});}return _0x1429ba[_0xd4de('0x35')][_0x2e08eb];}else{if(_0x1429ba[_0xd4de('0x3b')][_0xd4de('0x39')][_0xd4de('0x1b')]===_0xd4de('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1429ba[_0xd4de('0x3b')];return user;}else{logger[_0xd4de('0x30')](_0xd4de('0x3c'),JSON['stringify'](_0x1429ba));throw new Error(_0xd4de('0x3d')+JSON[_0xd4de('0xf')](_0x1429ba));}}}else{logger['error'](_0xd4de('0x3c'),JSON[_0xd4de('0xf')](_0x1429ba));throw new Error(_0xd4de('0x3d')+JSON[_0xd4de('0xf')](_0x1429ba));}})['catch'](function(_0x53d7dc){console[_0xd4de('0x30')](_0x53d7dc);});}function getZohoUser(_0x541777,_0x3e5e34){return new BPromise(function(_0x4de12c,_0x97c0ab){request(_0x541777)[_0xd4de('0x2e')](function(_0x21cd77){var _0x1e1937=null;if(_0x21cd77){_0x1e1937=_0x21cd77['data'][0x0];_0x1e1937[_0xd4de('0x3e')]=_0x3e5e34;}_0x4de12c(_0x1e1937);})['catch'](function(_0xbee33){_0x97c0ab(_0xbee33);});});}function createEndUser(_0x280f76,_0x7f17b9,_0x4517a6,_0x349c5f,_0x13c256,_0x3e8ae0){var _0x4517a6=getName(_0x4517a6);return request({'method':_0xd4de('0x28'),'uri':_0xd4de('0x3f')+_0x7f17b9+_0xd4de('0x40')+_[_0xd4de('0x41')](_0x3e8ae0[_0xd4de('0x42')])+'s','body':{'data':[{'Last_Name':_0x4517a6[0x1],'First_Name':_0x4517a6[0x0],'Phone':_0x349c5f,'Owner':{'name':!_['isNil'](_0x13c256[_0xd4de('0x43')][_0xd4de('0x1b')])?_0x13c256[_0xd4de('0x43')]['name']:!_[_0xd4de('0x1e')](_0x13c256[_0xd4de('0x44')])?_0x13c256[_0xd4de('0x44')]+'\x20'+_0x13c256['last_name']:_0x13c256[_0xd4de('0x45')],'id':_0x13c256['id']}}]},'headers':{'Authorization':_0xd4de('0x46')+_0x280f76},'json':!![]})[_0xd4de('0x2e')](function(_0x3f1e22){if(_0x3f1e22&&_0x3f1e22[_0xd4de('0x47')][0x0][_0xd4de('0x48')]===_0xd4de('0x49')){var _0x5ecbbd=_0x3f1e22[_0xd4de('0x47')][0x0][_0xd4de('0x4a')];_0x5ecbbd[_0xd4de('0x3e')]=_['startCase'](_0x3e8ae0[_0xd4de('0x42')])+'s';return _0x5ecbbd;}logger[_0xd4de('0x30')](_0xd4de('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xd4de('0xf')](data));})[_0xd4de('0x4b')](function(_0x5a2b3e){console[_0xd4de('0x4c')](_0xd4de('0x4d'),_0x5a2b3e);});}function getEndUser(_0x3a3c63,_0x13b317,_0x564a96,_0x27afac,_0x72d025,_0x579700,_0x3745ef){var _0x196d0b={'method':_0xd4de('0x4e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3a3c63},'json':!![]};switch(_0x3745ef[_0xd4de('0x4f')]){case _0xd4de('0x50'):_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x52')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x53'))[_0xd4de('0x2e')](function(_0x425a7e){if(_0x425a7e)return _0x425a7e;_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x54'))[_0xd4de('0x2e')](function(_0x178daf){if(_0x178daf)return _0x178daf;if(_0x3745ef['moduleCreate']!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});});break;case _0xd4de('0x56'):_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x52')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x53'))[_0xd4de('0x2e')](function(_0x29cb16){if(_0x29cb16)return _0x29cb16;if(_0x3745ef[_0xd4de('0x42')]!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});break;case'lead':_0x196d0b[_0xd4de('0x51')]=_0xd4de('0x3f')+_0x13b317+_0xd4de('0x57')+_0x72d025+'))';return getZohoUser(_0x196d0b,_0xd4de('0x54'))[_0xd4de('0x2e')](function(_0x584548){if(_0x584548)return _0x584548;if(_0x3745ef['moduleCreate']!=_0xd4de('0x55')){return createEndUser(_0x3a3c63,_0x13b317,_0x27afac,_0x72d025,_0x579700,_0x3745ef);}else{return{};}});break;}}function getCall(_0x2deedb,_0x4f9b6b,_0x48cb7d,_0x2d8589,_0x368081,_0x377376,_0x199440,_0x34d772){logger[_0xd4de('0x32')](_0xd4de('0x58'));var _0x4801de={};_0x4801de[_0xd4de('0x59')]={'name':!_[_0xd4de('0x1e')](_0x2d8589[_0xd4de('0x43')][_0xd4de('0x1b')])&&!_['isNil'](_0x2d8589[_0xd4de('0x39')][_0xd4de('0x1b')])&&_0x2d8589[_0xd4de('0x39')][_0xd4de('0x1b')]===_0xd4de('0x5a')?_0x2d8589[_0xd4de('0x43')]['name']:!_[_0xd4de('0x1e')](_0x2d8589['first_name'])?_0x2d8589['first_name']+'\x20'+_0x2d8589[_0xd4de('0x45')]:_0x2d8589[_0xd4de('0x45')],'id':_0x2d8589['id']};_0x4801de[_0xd4de('0x5b')]=intUtil[_0xd4de('0x5c')](_0x377376['Subjects'],_0x199440,'\x20');_0x4801de[_0xd4de('0x5d')]=intUtil[_0xd4de('0x5c')](_0x377376[_0xd4de('0x5e')],_0x199440,'\x0a');if(_0x368081[_0xd4de('0x3e')]===_0xd4de('0x53')){_0x4801de['Who_Id']={'name':!_['isNil'](_0x368081['Full_Name'])?_0x368081[_0xd4de('0x5f')]:!_[_0xd4de('0x1e')](_0x368081[_0xd4de('0x60')])?_0x368081[_0xd4de('0x60')]+'\x20'+_0x368081['Last_Name']:_0x368081[_0xd4de('0x61')],'id':_0x368081['id']};}if(_0x368081[_0xd4de('0x3e')]===_0xd4de('0x54')){_0x4801de[_0xd4de('0x62')]={'name':!_['isNil'](_0x368081[_0xd4de('0x5f')])?_0x368081[_0xd4de('0x5f')]:!_[_0xd4de('0x1e')](_0x368081[_0xd4de('0x60')])?_0x368081['First_Name']+'\x20'+_0x368081['Last_Name']:_0x368081['Last_Name'],'id':_0x368081['id']};_0x4801de[_0xd4de('0x63')]=_[_0xd4de('0x41')](_0x368081[_0xd4de('0x3e')]);}if(_0x199440['talktime']){_0x4801de[_0xd4de('0x64')]=moment[_0xd4de('0x65')](parseInt(_0x199440[_0xd4de('0x66')])*0x3e8)['format'](_0xd4de('0x67'));}else if(_0x199440['answertime']&&_0x199440[_0xd4de('0x68')]){_0x4801de[_0xd4de('0x64')]=moment[_0xd4de('0x65')](moment(_0x199440[_0xd4de('0x68')],_0xd4de('0x69'))[_0xd4de('0x6a')](moment(_0x199440[_0xd4de('0x6b')],_0xd4de('0x69'))))['format'](_0xd4de('0x67'));}switch(_0x199440['lastevent']){case _0xd4de('0x6c'):_0x4801de[_0xd4de('0x6d')]='Called';break;case _0xd4de('0x6e'):case _0xd4de('0x6f'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x70');break;case _0xd4de('0x71'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x72');break;case _0xd4de('0x73'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x74');break;case _0xd4de('0x75'):_0x4801de[_0xd4de('0x6d')]=_0xd4de('0x76');default:}_0x4801de['Call_Start_Time']=(_0x34d772===_0xd4de('0x77')?moment(_0x199440[_0xd4de('0x6b')])[_0xd4de('0x78')](_0xd4de('0x69')):moment(_0x199440[_0xd4de('0x79')])[_0xd4de('0x78')](_0xd4de('0x69')))||moment()[_0xd4de('0x78')]('YYYY-MM-DDTHH:mm:ss');_0x4801de[_0xd4de('0x7a')]=_0x34d772||'Inbound';_0x4801de=_['merge'](_0x4801de,getCustomFields(_0x377376['Fields'],_0x199440));return request({'method':_0xd4de('0x28'),'uri':_0xd4de('0x3f')+_0x4f9b6b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2deedb},'body':{'data':[_0x4801de]},'json':!![]})['then'](function(_0x576b5f){if(_0x576b5f&&_0x576b5f[_0xd4de('0x47')][0x0]['code']===_0xd4de('0x49')){logger['info'](_0xd4de('0x7b'));return{'id':_0x576b5f[_0xd4de('0x47')][0x0]['details']['id']};}})['catch'](function(_0x561e52){logger['info'](_0xd4de('0x7c'),_0x561e52[_0xd4de('0x7d')]);console[_0xd4de('0x4c')](_0xd4de('0x7c'),_0x561e52);});}exports[_0xd4de('0x7e')]=function(_0x282d4f,_0x574c46,_0x5c651b,_0x53cbd9,_0xca9ce0,_0x2bb19d){var _0x4c2343,_0x28ecbf,_0x496415;_0x2bb19d[_0xd4de('0x7f')]=intUtil['stripTrailingSlash'](_0x2bb19d[_0xd4de('0x7f')]);_0x2bb19d[_0xd4de('0x80')]=intUtil['stripTrailingSlash'](_0x2bb19d[_0xd4de('0x80')]);if(_0xca9ce0&&_0xca9ce0['monitor_format']){logger[_0xd4de('0x32')](_0xd4de('0x81'),_0xd4de('0x82'));_0x574c46[_0xd4de('0x83')]=_0x2bb19d['serverUrl']+_0xd4de('0x84')+_0x574c46[_0xd4de('0x85')]+_0xd4de('0x86')+md5(_0x574c46[_0xd4de('0x85')]);}else{_0x574c46[_0xd4de('0x83')]='';}var _0x21c8d2=_0x2bb19d[_0xd4de('0x7f')]===_0xd4de('0x87')?'eu':_0xd4de('0x88');return getAccessToken(_0x2bb19d)[_0xd4de('0x2e')](function(_0xc908e9){_0x496415=_0xc908e9;return getUser(_0x496415,_0x21c8d2,_0x2bb19d,_0x53cbd9[_0xd4de('0x89')]);})[_0xd4de('0x2e')](function(_0x573039){_0x4c2343=_0x573039;logger[_0xd4de('0x32')]('The\x20User\x20ID\x20is:',_0x4c2343['id']);return getEndUser(_0x496415,_0x21c8d2,_0x2bb19d,_0x574c46['calleridname'],_0x574c46[_0xd4de('0x8a')],_0x4c2343,_0x5c651b);})[_0xd4de('0x2e')](function(_0x5f197d){_0x28ecbf=_0x5f197d;return getCall(_0x496415,_0x21c8d2,_0x2bb19d,_0x4c2343,_0x28ecbf,_0x5c651b,_0x574c46,_0xd4de('0x8b'));})[_0xd4de('0x2e')](function(_0x3457bb){if(_0x3457bb){logger[_0xd4de('0x32')]('The\x20Call\x20ID\x20is:',_0x3457bb['id']);logger[_0xd4de('0x32')](_0xd4de('0x81'),_0xd4de('0x8c'));emit(util[_0xd4de('0x78')](_0xd4de('0x8d'),_0x53cbd9['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x2bb19d['host']+_0xd4de('0x8e')+_0x3457bb['id']});}})['catch'](function(_0x302c7d){logger['error'](_0xd4de('0x81'),JSON[_0xd4de('0xf')](_0x302c7d));});};exports[_0xd4de('0x77')]=function(_0x30dca3,_0x1d6dab,_0x15136e,_0x15f056,_0x31b518,_0x5a270a,_0x2c0f32){var _0x1fec27,_0x2025ba,_0x178ce8;_0x5a270a['host']=intUtil[_0xd4de('0x8f')](_0x5a270a[_0xd4de('0x7f')]);_0x5a270a['serverUrl']=intUtil[_0xd4de('0x8f')](_0x5a270a[_0xd4de('0x80')]);if(_0x2c0f32&&_0x2c0f32[_0xd4de('0x90')]&&_0x2c0f32[_0xd4de('0x90')]!==_0xd4de('0x91')){logger[_0xd4de('0x32')](_0xd4de('0x92'),_0xd4de('0x82'));_0x1d6dab[_0xd4de('0x83')]=_0x5a270a[_0xd4de('0x80')]+_0xd4de('0x84')+_0x1d6dab['uniqueid']+_0xd4de('0x86')+md5(_0x1d6dab['uniqueid']);}var _0x117308=_0x5a270a[_0xd4de('0x7f')]===_0xd4de('0x87')?'eu':'com';return getAccessToken(_0x5a270a)[_0xd4de('0x2e')](function(_0x1cab80){_0x178ce8=_0x1cab80;return getUser(_0x178ce8,_0x117308,_0x5a270a,_0x15f056['email']);})[_0xd4de('0x2e')](function(_0x43d02f){_0x1fec27=_0x43d02f;logger[_0xd4de('0x32')](_0xd4de('0x93'),_0x1fec27['id']);return getEndUser(_0x178ce8,_0x117308,_0x5a270a,_0x1d6dab[_0xd4de('0x94')],_0x1d6dab[_0xd4de('0x95')],_0x1fec27,_0x15136e);})['then'](function(_0x19e593){_0x2025ba=_0x19e593;return getCall(_0x178ce8,_0x117308,_0x5a270a,_0x1fec27,_0x2025ba,_0x15136e,_0x1d6dab,_0xd4de('0x96'));})['then'](function(_0x2f4183){if(_0x2f4183){logger[_0xd4de('0x32')](_0xd4de('0x97'),_0x2f4183['id']);logger[_0xd4de('0x32')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4de('0x78')](_0xd4de('0x8d'),_0x15f056[_0xd4de('0x1b')]),_0xd4de('0x98'),{'uri':'https://crm.'+_0x5a270a[_0xd4de('0x7f')]+_0xd4de('0x8e')+_0x2f4183['id']});}})[_0xd4de('0x4b')](function(_0x21e62d){logger['error']('[OUTBOUND]',JSON[_0xd4de('0xf')](_0x21e62d));});};exports['unmanaged']=function(_0x1ac87e,_0x3f19d9,_0x2cb193,_0x449bba,_0x5afe8e,_0x59620f){var _0x6984b4,_0x1a1abd,_0x5d860d;_0x59620f['host']=intUtil[_0xd4de('0x8f')](_0x59620f[_0xd4de('0x7f')]);_0x59620f[_0xd4de('0x80')]=intUtil['stripTrailingSlash'](_0x59620f[_0xd4de('0x80')]);if(_0x5afe8e&&_0x5afe8e[_0xd4de('0x99')]){logger['info']('['+_0x3f19d9[_0xd4de('0x9a')]['toUpperCase']()+']',_0xd4de('0x82'));_0x3f19d9[_0xd4de('0x83')]=_0x59620f['serverUrl']+_0xd4de('0x84')+_0x3f19d9[_0xd4de('0x85')]+_0xd4de('0x86')+md5(_0x3f19d9[_0xd4de('0x85')]);}else{_0x3f19d9[_0xd4de('0x83')]='';}var _0x20af58=_0x59620f['host']===_0xd4de('0x87')?'eu':_0xd4de('0x88');return getAccessToken(_0x59620f)[_0xd4de('0x2e')](function(_0xb0ab3a){_0x5d860d=_0xb0ab3a;return getUser(_0x5d860d,_0x20af58,_0x59620f);})[_0xd4de('0x2e')](function(_0x291e8a){_0x6984b4=_0x291e8a;logger['info'](_0xd4de('0x93'),_0x6984b4['id']);return getEndUser(_0x5d860d,_0x20af58,_0x59620f,_0x3f19d9['calleridname'],_0x3f19d9[_0xd4de('0x8a')],_0x6984b4,_0x2cb193);})[_0xd4de('0x2e')](function(_0x2171fb){_0x1a1abd=_0x2171fb;return getCall(_0x5d860d,_0x20af58,_0x59620f,_0x6984b4,_0x1a1abd,_0x2cb193,_0x3f19d9,_0xd4de('0x8b'));})[_0xd4de('0x2e')](function(_0x4cea38){if(_0x4cea38){logger[_0xd4de('0x32')](_0xd4de('0x97'),_0x4cea38['id']);}})[_0xd4de('0x4b')](function(_0x477cc7){logger[_0xd4de('0x30')]('['+_0x3f19d9[_0xd4de('0x9a')][_0xd4de('0x9b')]()+']',JSON[_0xd4de('0xf')](_0x477cc7));});}; \ 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 fb9c3fd..87f7270 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 _0xb906=['data3','render','error','format','info','shelljs','../../../../config/logger','trigger','exec','data2','Script'];(function(_0x451a11,_0x4b9c54){var _0xd01af2=function(_0x296065){while(--_0x296065){_0x451a11['push'](_0x451a11['shift']());}};_0xd01af2(++_0x4b9c54);}(_0xb906,0xec));var _0x6b90=function(_0x2cd282,_0x531316){_0x2cd282=_0x2cd282-0x0;var _0x18acd4=_0xb906[_0x2cd282];return _0x18acd4;};'use strict';var util=require('util');var sh=require(_0x6b90('0x0'));var Mustache=require('mustache');var logger=require(_0x6b90('0x1'))(_0x6b90('0x2'));exports[_0x6b90('0x3')]=function(_0x1b0ab5,_0x14d066){var _0xb88cc3=_0x1b0ab5[_0x6b90('0x4')]?_0x1b0ab5[_0x6b90('0x4')]:_0x6b90('0x5');var _0x375d8c=_0x1b0ab5[_0x6b90('0x6')]?Mustache[_0x6b90('0x7')](_0x1b0ab5[_0x6b90('0x6')],_0x14d066):_0x14d066;sh[_0x6b90('0x3')](_0x375d8c,function(_0xafeb79,_0x3f6ab6,_0x5512a2){if(_0xafeb79!==0x0){logger[_0x6b90('0x8')](util[_0x6b90('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xb88cc3,_0x375d8c,_0xafeb79,_0x5512a2));}else{logger[_0x6b90('0xa')](util[_0x6b90('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0xb88cc3,_0x375d8c,_0x3f6ab6));}});}; \ No newline at end of file +var _0x1160=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x541eba,_0x4f2765){var _0x5a1abf=function(_0x485458){while(--_0x485458){_0x541eba['push'](_0x541eba['shift']());}};_0x5a1abf(++_0x4f2765);}(_0x1160,0xb2));var _0x0116=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x1160[_0x26f702];return _0x11417d;};'use strict';var util=require(_0x0116('0x0'));var sh=require(_0x0116('0x1'));var Mustache=require(_0x0116('0x2'));var logger=require(_0x0116('0x3'))(_0x0116('0x4'));exports[_0x0116('0x5')]=function(_0x1ddc84,_0x32063a){var _0xcfa6b1=_0x1ddc84[_0x0116('0x6')]?_0x1ddc84[_0x0116('0x6')]:'Script';var _0xc8b686=_0x1ddc84[_0x0116('0x7')]?Mustache['render'](_0x1ddc84[_0x0116('0x7')],_0x32063a):_0x32063a;sh['exec'](_0xc8b686,function(_0x3423ce,_0x15ab0b,_0x36fcc4){if(_0x3423ce!==0x0){logger['error'](util['format'](_0x0116('0x8'),_0xcfa6b1,_0xc8b686,_0x3423ce,_0x36fcc4));}else{logger['info'](util[_0x0116('0x9')](_0x0116('0xa'),_0xcfa6b1,_0xc8b686,_0x15ab0b));}});}; \ 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 1df0397..9489103 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 _0x2d58=['data5','headers','data6','parse','error','stack','toUpperCase','DELETE','POST','data7','render','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','lodash','mustache','../../../../config/logger','trigger','data1','data2','number'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0x2d58,0x1d4));var _0x82d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2d58[_0x122ef9];return _0x42fba0;};'use strict';var rp=require('request-promise');var util=require(_0x82d5('0x0'));var _=require(_0x82d5('0x1'));var Mustache=require(_0x82d5('0x2'));var logger=require(_0x82d5('0x3'))(_0x82d5('0x4'));exports['exec']=function(_0x33e871,_0x1fe428){var _0x64b957,_0x246d75;var _0x246205={'method':_0x33e871[_0x82d5('0x5')]['toUpperCase'](),'uri':Mustache['render'](_0x33e871[_0x82d5('0x6')],_0x1fe428),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x33e871['data5'])===_0x82d5('0x7')&&parseInt(_0x33e871[_0x82d5('0x8')])>=0x1&&parseInt(_0x33e871[_0x82d5('0x8')])<=0xa?parseInt(_0x33e871[_0x82d5('0x8')])*0x3e8:0x5*0x3e8};try{_0x246205[_0x82d5('0x9')]=_0x33e871[_0x82d5('0xa')]?JSON[_0x82d5('0xb')](Mustache['render'](_0x33e871[_0x82d5('0xa')],_0x1fe428)):{};}catch(_0x3a146b){logger[_0x82d5('0xc')](_0x3a146b[_0x82d5('0xd')]);}switch(_0x33e871[_0x82d5('0x5')][_0x82d5('0xe')]()){case'GET':case _0x82d5('0xf'):_0x64b957=null;_0x246205['qs']=_0x1fe428;break;case _0x82d5('0x10'):case'PUT':if(_0x33e871[_0x82d5('0x11')]){try{_0x64b957=JSON[_0x82d5('0xb')](Mustache[_0x82d5('0x12')](_0x33e871[_0x82d5('0x11')],_0x1fe428));_0x246205['body']=_0x64b957;}catch(_0x4be487){logger['error'](_0x4be487[_0x82d5('0xd')]);logger[_0x82d5('0xc')](_0x82d5('0x13'));}}else{_0x64b957=_0x1fe428;_0x246205[_0x82d5('0x14')]=_0x64b957;}break;}logger[_0x82d5('0x15')](util[_0x82d5('0x16')](_0x82d5('0x17'),_0x33e871['data1'],_0x33e871[_0x82d5('0x6')],JSON[_0x82d5('0x18')](_0x246205)));rp(_0x246205)[_0x82d5('0x19')](function(_0x4982d7){_0x64b957=!_[_0x82d5('0x1a')](_0x64b957)?_0x82d5('0x1b')+_0x64b957:'';_0x246d75=typeof _0x4982d7[_0x82d5('0x14')]===_0x82d5('0x1c')?JSON[_0x82d5('0x18')](_0x4982d7[_0x82d5('0x14')]):_0x4982d7['body'];logger[_0x82d5('0x15')](util[_0x82d5('0x16')](_0x82d5('0x1d'),_0x33e871[_0x82d5('0x5')],_0x33e871['data2'],_0x4982d7['statusCode'],_0x246d75));})['catch'](function(_0x2a5d4f){logger[_0x82d5('0xc')](util['format'](_0x82d5('0x1e'),_0x33e871[_0x82d5('0x5')],_0x33e871[_0x82d5('0x6')],_0x2a5d4f[_0x82d5('0x1f')],_0x2a5d4f[_0x82d5('0x20')],_0x2a5d4f[_0x82d5('0x21')]));});}; \ No newline at end of file +var _0xbc15=['number','headers','data6','parse','render','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5'];(function(_0x19d020,_0x49a410){var _0x544125=function(_0x4fd23e){while(--_0x4fd23e){_0x19d020['push'](_0x19d020['shift']());}};_0x544125(++_0x49a410);}(_0xbc15,0x1e3));var _0x5bc1=function(_0x3b6487,_0x24a724){_0x3b6487=_0x3b6487-0x0;var _0x5e0522=_0xbc15[_0x3b6487];return _0x5e0522;};'use strict';var rp=require(_0x5bc1('0x0'));var util=require(_0x5bc1('0x1'));var _=require(_0x5bc1('0x2'));var Mustache=require(_0x5bc1('0x3'));var logger=require(_0x5bc1('0x4'))(_0x5bc1('0x5'));exports[_0x5bc1('0x6')]=function(_0x33eaaa,_0x2552e1){var _0x34dcb8,_0x523c4b;var _0x339158={'method':_0x33eaaa[_0x5bc1('0x7')][_0x5bc1('0x8')](),'uri':Mustache['render'](_0x33eaaa[_0x5bc1('0x9')],_0x2552e1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x33eaaa[_0x5bc1('0xa')])===_0x5bc1('0xb')&&parseInt(_0x33eaaa['data5'])>=0x1&&parseInt(_0x33eaaa[_0x5bc1('0xa')])<=0xa?parseInt(_0x33eaaa[_0x5bc1('0xa')])*0x3e8:0x5*0x3e8};try{_0x339158[_0x5bc1('0xc')]=_0x33eaaa[_0x5bc1('0xd')]?JSON[_0x5bc1('0xe')](Mustache[_0x5bc1('0xf')](_0x33eaaa['data6'],_0x2552e1)):{};}catch(_0x1d7879){logger['error'](_0x1d7879[_0x5bc1('0x10')]);}switch(_0x33eaaa[_0x5bc1('0x7')][_0x5bc1('0x8')]()){case _0x5bc1('0x11'):case _0x5bc1('0x12'):_0x34dcb8=null;_0x339158['qs']=_0x2552e1;break;case _0x5bc1('0x13'):case _0x5bc1('0x14'):if(_0x33eaaa[_0x5bc1('0x15')]){try{_0x34dcb8=JSON[_0x5bc1('0xe')](Mustache['render'](_0x33eaaa['data7'],_0x2552e1));_0x339158[_0x5bc1('0x16')]=_0x34dcb8;}catch(_0x1d2538){logger[_0x5bc1('0x17')](_0x1d2538[_0x5bc1('0x10')]);logger[_0x5bc1('0x17')](_0x5bc1('0x18'));}}else{_0x34dcb8=_0x2552e1;_0x339158[_0x5bc1('0x16')]=_0x34dcb8;}break;}logger[_0x5bc1('0x19')](util[_0x5bc1('0x1a')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x33eaaa['data1'],_0x33eaaa[_0x5bc1('0x9')],JSON['stringify'](_0x339158)));rp(_0x339158)[_0x5bc1('0x1b')](function(_0xa1bec6){_0x34dcb8=!_[_0x5bc1('0x1c')](_0x34dcb8)?_0x5bc1('0x1d')+_0x34dcb8:'';_0x523c4b=typeof _0xa1bec6[_0x5bc1('0x16')]===_0x5bc1('0x1e')?JSON[_0x5bc1('0x1f')](_0xa1bec6['body']):_0xa1bec6['body'];logger['info'](util[_0x5bc1('0x1a')](_0x5bc1('0x20'),_0x33eaaa[_0x5bc1('0x7')],_0x33eaaa[_0x5bc1('0x9')],_0xa1bec6[_0x5bc1('0x21')],_0x523c4b));})[_0x5bc1('0x22')](function(_0x1e029f){logger[_0x5bc1('0x17')](util[_0x5bc1('0x1a')](_0x5bc1('0x23'),_0x33eaaa['data1'],_0x33eaaa[_0x5bc1('0x9')],_0x1e029f[_0x5bc1('0x21')],_0x1e029f[_0x5bc1('0x24')],_0x1e029f[_0x5bc1('0x25')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 50fd0e6..4d32001 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 _0xaa3a=['client','Request','request','then','debug','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xaa3a,0x14c));var _0xaaa3=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0xaa3a[_0x8e7772];return _0x408200;};'use strict';var jayson=require(_0xaaa3('0x0'));var BPromise=require(_0xaaa3('0x1'));var logger=require(_0xaaa3('0x2'))(_0xaaa3('0x3'));var client=jayson[_0xaaa3('0x4')]['http']({'port':0x2329});client[_0xaaa3('0x5')]=function(_0x27d0a9,_0x33ac9b){return new BPromise(function(_0x3d1ac9,_0x57621b){return client[_0xaaa3('0x6')](_0x27d0a9,_0x33ac9b)[_0xaaa3('0x7')](function(_0x228b48){logger[_0xaaa3('0x8')]('rpc',_0xaaa3('0x3'),_0x27d0a9,_0x33ac9b,_0x228b48);if(_0x228b48['error']){logger[_0xaaa3('0x9')](_0xaaa3('0xa'),_0xaaa3('0x3'),_0x27d0a9,_0x228b48['error'][_0xaaa3('0xb')],_0x33ac9b);return _0x57621b(_0x228b48[_0xaaa3('0x9')][_0xaaa3('0xb')]);}else{return _0x3d1ac9(_0x228b48['result']);}})[_0xaaa3('0xc')](function(_0x57a9d4){logger[_0xaaa3('0x9')]('rpc',_0xaaa3('0x3'),_0x27d0a9,_0x57a9d4,_0x33ac9b);return _0x57621b(_0x57a9d4);});});};module[_0xaaa3('0xd')]=client; \ No newline at end of file +var _0x5f8c=['routing','error','message','result','exports','jayson/promise','bluebird','../../config/logger','http','Request','request','debug','rpc'];(function(_0x16c397,_0x48824f){var _0x341732=function(_0x1c126f){while(--_0x1c126f){_0x16c397['push'](_0x16c397['shift']());}};_0x341732(++_0x48824f);}(_0x5f8c,0x7a));var _0xc5f8=function(_0x14eb73,_0x33d2a1){_0x14eb73=_0x14eb73-0x0;var _0x686a1c=_0x5f8c[_0x14eb73];return _0x686a1c;};'use strict';var jayson=require(_0xc5f8('0x0'));var BPromise=require(_0xc5f8('0x1'));var logger=require(_0xc5f8('0x2'))('routing');var client=jayson['client'][_0xc5f8('0x3')]({'port':0x2329});client[_0xc5f8('0x4')]=function(_0x3ae596,_0x1c72e6){return new BPromise(function(_0x14be37,_0xeb0e01){return client[_0xc5f8('0x5')](_0x3ae596,_0x1c72e6)['then'](function(_0x48b056){logger[_0xc5f8('0x6')](_0xc5f8('0x7'),_0xc5f8('0x8'),_0x3ae596,_0x1c72e6,_0x48b056);if(_0x48b056[_0xc5f8('0x9')]){logger[_0xc5f8('0x9')](_0xc5f8('0x7'),_0xc5f8('0x8'),_0x3ae596,_0x48b056[_0xc5f8('0x9')][_0xc5f8('0xa')],_0x1c72e6);return _0xeb0e01(_0x48b056[_0xc5f8('0x9')]['message']);}else{return _0x14be37(_0x48b056[_0xc5f8('0xb')]);}})['catch'](function(_0x2b8b94){logger[_0xc5f8('0x9')]('rpc',_0xc5f8('0x8'),_0x3ae596,_0x2b8b94,_0x1c72e6);return _0xeb0e01(_0x2b8b94);});});};module[_0xc5f8('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5efcaf3..4d01acd 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 _0xe96d=['then','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x559443,_0x4eb8b6){var _0x246c41=function(_0x2e5eb2){while(--_0x2e5eb2){_0x559443['push'](_0x559443['shift']());}};_0x246c41(++_0x4eb8b6);}(_0xe96d,0xbd));var _0xde96=function(_0x20113b,_0x3c460d){_0x20113b=_0x20113b-0x0;var _0x574908=_0xe96d[_0x20113b];return _0x574908;};'use strict';var server=require('./server');var Realtime=require(_0xde96('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xde96('0x1'));var setting=require(_0xde96('0x2'));var logger=require(_0xde96('0x3'))(_0xde96('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xde96('0x5')]()[_0xde96('0x6')](mailAccount['getMailAccounts']())[_0xde96('0x6')](realtime[_0xde96('0x7')]())[_0xde96('0x6')](function(){email[_0xde96('0x8')](realtime[_0xde96('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xde96('0xa')]();})['then'](function(_0x31daec){return setInterval(initRealtime,_0x31daec[_0xde96('0xb')]*0x3e8);})[_0xde96('0xc')](function(_0x29690e){logger['error']('Email\x20service\x20initialization',_0x29690e);});}main(); \ No newline at end of file +var _0x925d=['listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','refresh','mailAccounts'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x925d,0x1a5));var _0xd925=function(_0x57247a,_0x183aa4){_0x57247a=_0x57247a-0x0;var _0x6d5095=_0x925d[_0x57247a];return _0x6d5095;};'use strict';var server=require('./server');var Realtime=require(_0xd925('0x0'));var EmailChannel=require(_0xd925('0x1'));var mailAccount=require(_0xd925('0x2'));var setting=require(_0xd925('0x3'));var logger=require(_0xd925('0x4'))(_0xd925('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd925('0x6')]()['then'](mailAccount[_0xd925('0x7')]())[_0xd925('0x8')](realtime['initMailAccounts']())[_0xd925('0x8')](function(){email[_0xd925('0x9')](realtime[_0xd925('0xa')]);return realtime;});}function main(){return server[_0xd925('0xb')](realtime,email)[_0xd925('0x8')](function(){return initRealtime();})[_0xd925('0x8')](function(){return setting[_0xd925('0xc')]();})[_0xd925('0x8')](function(_0x5dce91){return setInterval(initRealtime,_0x5dce91[_0xd925('0xd')]*0x3e8);})['catch'](function(_0x40cb0c){logger[_0xd925('0xe')](_0xd925('0xf'),_0x40cb0c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 45a5c8d..a67fcff 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 _0x3785=['from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','info','mailAccounts','imapAccounts','smtp','prototype','name','active','Imap','status','messageStatus','stringify','md5','emit','refresh','service','custom','provider','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x3785,0x72));var _0x5378=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x3785[_0x515afd];return _0x536d53;};'use strict';var _=require(_0x5378('0x0'));var moment=require(_0x5378('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x5378('0x2'))(_0x5378('0x3'));config[_0x5378('0x4')]=_['defaults'](config[_0x5378('0x4')],{'host':_0x5378('0x5'),'port':0x18eb});var io=require(_0x5378('0x6'))(new Redis(config['redis']));var EmailImap=require(_0x5378('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2ff3a){logger[_0x5378('0x8')]('start\x20email\x20channel');this[_0x5378('0x9')]=_0x2ff3a[_0x5378('0x9')];this[_0x5378('0xa')]={};this[_0x5378('0xb')]=new EmailSmtp();}EmailChannel[_0x5378('0xc')]['emit']=function(_0x3cb352){var _0x5393a5=this['mailAccounts'][_0x3cb352];var _0x198971={'id':_0x5393a5['id'],'name':_0x5393a5[_0x5378('0xd')],'key':_0x5393a5['key'],'active':_0x5393a5[_0x5378('0xe')],'Imap':{'status':_0x5393a5[_0x5378('0xf')][_0x5378('0x10')],'messageStatus':_0x5393a5[_0x5378('0xf')][_0x5378('0x11')],'total':_0x5393a5[_0x5378('0xf')]['total']}};if(_['isNil'](md5Accounts[_0x3cb352])){md5Accounts[_0x3cb352]={};}var _0x26a320=md5(JSON[_0x5378('0x12')](_0x198971));if(md5Accounts[_0x3cb352][_0x5378('0x13')]!==_0x26a320){md5Accounts[_0x3cb352][_0x5378('0x13')]=_0x26a320;io[_0x5378('0x14')]('mailAccount:update',_0x198971);}};EmailChannel[_0x5378('0xc')][_0x5378('0x15')]=function(_0x26bfd1){for(var _0x567768 in _0x26bfd1){if(_0x26bfd1['hasOwnProperty'](_0x567768)){if(_0x26bfd1[_0x567768]['Imap']&&_0x26bfd1[_0x567768]['active']){var _0x45ba7e=_0x26bfd1[_0x567768][_0x5378('0xf')];if(!_0x45ba7e[_0x5378('0x16')]&&_0x26bfd1[_0x567768]['provider']!==_0x5378('0x17'))_0x45ba7e[_0x5378('0x16')]=_0x26bfd1[_0x567768][_0x5378('0x18')];if(!this[_0x5378('0xa')]['hasOwnProperty'](_0x45ba7e['id'])){this[_0x5378('0xa')][_0x45ba7e['id']]=new EmailImap(_0x45ba7e,_0x26bfd1[_0x567768][_0x5378('0x3')]);this[_0x5378('0xa')][_0x45ba7e['id']]['on']('box',this[_0x5378('0x19')][_0x5378('0x1a')](this,_0x567768));this[_0x5378('0xa')][_0x45ba7e['id']]['on'](_0x5378('0x3'),this[_0x5378('0x1b')]['bind'](this,_0x567768));this['imapAccounts'][_0x45ba7e['id']]['on'](_0x5378('0x1c'),this[_0x5378('0x1d')][_0x5378('0x1a')](this,_0x567768));this['imapAccounts'][_0x45ba7e['id']]['on'](_0x5378('0x1e'),this[_0x5378('0x1f')]['bind'](this,_0x567768));}}else{if(_[_0x5378('0x20')](this[_0x5378('0x9')][_0x567768]['Imap'])){this[_0x5378('0x9')][_0x567768][_0x5378('0xf')]={};}this[_0x5378('0x9')][_0x567768][_0x5378('0xf')]['status']=_0x5378('0x21');this[_0x5378('0x9')][_0x567768]['Imap'][_0x5378('0x11')]='';this['emit'](_0x567768);}}}};EmailChannel['prototype'][_0x5378('0x19')]=function(_0x3c3f46,_0x3b54d1){if(this[_0x5378('0x9')][_0x3c3f46]){this[_0x5378('0x9')][_0x3c3f46][_0x5378('0xf')]['status']=_0x5378('0x22');this['mailAccounts'][_0x3c3f46]['Imap'][_0x5378('0x11')]=_0x3b54d1['name'];if(_0x3b54d1[_0x5378('0x23')]){this[_0x5378('0x9')][_0x3c3f46]['Imap'][_0x5378('0x24')]=_0x3b54d1[_0x5378('0x23')][_0x5378('0x24')];}return this[_0x5378('0x14')](_0x3c3f46);}};EmailChannel[_0x5378('0xc')]['handleImapEmail']=function(_0x34c418,_0x930083){logger[_0x5378('0x8')](_0x5378('0x25'),_0x930083['firstName'],_0x930083[_0x5378('0x26')],_0x930083[_0x5378('0x27')],_0x34c418);if(this['mailAccounts'][_0x34c418]){return mailAccount[_0x5378('0x28')](_0x34c418,_0x930083)['then'](function(_0x162ff6){if(_0x162ff6){logger[_0x5378('0x8')](_0x5378('0x29'));}})[_0x5378('0x2a')](function(_0x1bb30e){logger[_0x5378('0x1e')](_0x5378('0x2b'),JSON[_0x5378('0x12')](_0x1bb30e));});}};EmailChannel[_0x5378('0xc')][_0x5378('0x1d')]=function(_0x369e35){if(this[_0x5378('0x9')][_0x369e35]&&this['mailAccounts'][_0x369e35][_0x5378('0xf')]){if(this['imapAccounts'][this['mailAccounts'][_0x369e35][_0x5378('0xf')]['id']]){delete this[_0x5378('0xa')][this[_0x5378('0x9')][_0x369e35]['Imap']['id']];}this[_0x5378('0x9')][_0x369e35][_0x5378('0xf')]['lastSync']=moment();this[_0x5378('0x14')](_0x369e35);}};EmailChannel[_0x5378('0xc')]['handleImapError']=function(_0x2baff6,_0x1c1575){if(this[_0x5378('0x9')][_0x2baff6]){this[_0x5378('0x9')][_0x2baff6][_0x5378('0xf')][_0x5378('0x10')]=_0x5378('0x1e');this[_0x5378('0x9')][_0x2baff6][_0x5378('0xf')]['messageStatus']=_0x1c1575;return this['emit'](_0x2baff6);}};EmailChannel['prototype']['sendMail']=function(_0xc9e6fe,_0x4741cb){return this['smtp'][_0x5378('0x2c')](_0xc9e6fe,_0x4741cb);};EmailChannel['prototype'][_0x5378('0x2d')]=function(_0x37ed93){var _0xe97413=this;if(this['mailAccounts'][_0x37ed93['id']]){if(_['isNil'](this[_0x5378('0x9')][_0x37ed93['id']]['Smtp'])){this[_0x5378('0x9')][_0x37ed93['id']]['Smtp']={};}this[_0x5378('0x9')][_0x37ed93['id']][_0x5378('0x2e')][_0x5378('0x2f')]=moment();return new BPromise(function(_0x45f332,_0x4b0156){return _0xe97413[_0x5378('0xb')][_0x5378('0x30')](_0x37ed93)['then'](function(_0x530d8c){_0xe97413['mailAccounts'][_0x37ed93['id']][_0x5378('0x2e')][_0x5378('0x10')]=_0x5378('0x31');_0xe97413['mailAccounts'][_0x37ed93['id']][_0x5378('0x2e')][_0x5378('0x11')]='';_0xe97413[_0x5378('0x14')](_0x37ed93['id']);_0x45f332(_0x530d8c);})[_0x5378('0x2a')](function(_0x8433c6){_0xe97413[_0x5378('0x9')][_0x37ed93['id']][_0x5378('0x2e')][_0x5378('0x10')]='error';_0xe97413['mailAccounts'][_0x37ed93['id']][_0x5378('0x2e')][_0x5378('0x11')]=_0x8433c6;_0xe97413[_0x5378('0x14')](_0x37ed93['id']);_0x4b0156(_0x8433c6);});});}return this[_0x5378('0xb')][_0x5378('0x30')](_0x37ed93);};module[_0x5378('0x32')]=EmailChannel; \ No newline at end of file +var _0x33bc=['from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','../rpc/mailAccount','info','start\x20email\x20channel','smtp','emit','mailAccounts','name','key','active','Imap','status','messageStatus','total','isNil','stringify','prototype','service','custom','provider','imapAccounts','hasOwnProperty','box','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x33bc,0x1c3));var _0xc33b=function(_0x1d0073,_0x168a1c){_0x1d0073=_0x1d0073-0x0;var _0x355fc7=_0x33bc[_0x1d0073];return _0x355fc7;};'use strict';var _=require(_0xc33b('0x0'));var moment=require(_0xc33b('0x1'));var BPromise=require(_0xc33b('0x2'));var md5=require(_0xc33b('0x3'));var Redis=require(_0xc33b('0x4'));var config=require(_0xc33b('0x5'));var logger=require('../../../config/logger')(_0xc33b('0x6'));config[_0xc33b('0x7')]=_[_0xc33b('0x8')](config[_0xc33b('0x7')],{'host':_0xc33b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc33b('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xc33b('0xa'));var md5Accounts={};function EmailChannel(_0x363830){logger[_0xc33b('0xb')](_0xc33b('0xc'));this['mailAccounts']=_0x363830['mailAccounts'];this['imapAccounts']={};this[_0xc33b('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0xc33b('0xe')]=function(_0x566c19){var _0x4b902d=this[_0xc33b('0xf')][_0x566c19];var _0x4213f3={'id':_0x4b902d['id'],'name':_0x4b902d[_0xc33b('0x10')],'key':_0x4b902d[_0xc33b('0x11')],'active':_0x4b902d[_0xc33b('0x12')],'Imap':{'status':_0x4b902d[_0xc33b('0x13')][_0xc33b('0x14')],'messageStatus':_0x4b902d[_0xc33b('0x13')][_0xc33b('0x15')],'total':_0x4b902d['Imap'][_0xc33b('0x16')]}};if(_[_0xc33b('0x17')](md5Accounts[_0x566c19])){md5Accounts[_0x566c19]={};}var _0x1cacf5=md5(JSON[_0xc33b('0x18')](_0x4213f3));if(md5Accounts[_0x566c19][_0xc33b('0x3')]!==_0x1cacf5){md5Accounts[_0x566c19][_0xc33b('0x3')]=_0x1cacf5;io[_0xc33b('0xe')]('mailAccount:update',_0x4213f3);}};EmailChannel[_0xc33b('0x19')]['refresh']=function(_0x3ba5c3){for(var _0x7e4729 in _0x3ba5c3){if(_0x3ba5c3['hasOwnProperty'](_0x7e4729)){if(_0x3ba5c3[_0x7e4729][_0xc33b('0x13')]&&_0x3ba5c3[_0x7e4729][_0xc33b('0x12')]){var _0x15c383=_0x3ba5c3[_0x7e4729][_0xc33b('0x13')];if(!_0x15c383[_0xc33b('0x1a')]&&_0x3ba5c3[_0x7e4729]['provider']!==_0xc33b('0x1b'))_0x15c383[_0xc33b('0x1a')]=_0x3ba5c3[_0x7e4729][_0xc33b('0x1c')];if(!this[_0xc33b('0x1d')][_0xc33b('0x1e')](_0x15c383['id'])){this['imapAccounts'][_0x15c383['id']]=new EmailImap(_0x15c383,_0x3ba5c3[_0x7e4729][_0xc33b('0x6')]);this[_0xc33b('0x1d')][_0x15c383['id']]['on'](_0xc33b('0x1f'),this['handleImapBox'][_0xc33b('0x20')](this,_0x7e4729));this[_0xc33b('0x1d')][_0x15c383['id']]['on'](_0xc33b('0x6'),this[_0xc33b('0x21')][_0xc33b('0x20')](this,_0x7e4729));this[_0xc33b('0x1d')][_0x15c383['id']]['on']('end',this[_0xc33b('0x22')][_0xc33b('0x20')](this,_0x7e4729));this['imapAccounts'][_0x15c383['id']]['on'](_0xc33b('0x23'),this[_0xc33b('0x24')][_0xc33b('0x20')](this,_0x7e4729));}}else{if(_[_0xc33b('0x17')](this[_0xc33b('0xf')][_0x7e4729]['Imap'])){this[_0xc33b('0xf')][_0x7e4729]['Imap']={};}this[_0xc33b('0xf')][_0x7e4729][_0xc33b('0x13')][_0xc33b('0x14')]=_0xc33b('0x25');this['mailAccounts'][_0x7e4729][_0xc33b('0x13')][_0xc33b('0x15')]='';this[_0xc33b('0xe')](_0x7e4729);}}}};EmailChannel['prototype'][_0xc33b('0x26')]=function(_0x10ad07,_0x5d645f){if(this[_0xc33b('0xf')][_0x10ad07]){this[_0xc33b('0xf')][_0x10ad07][_0xc33b('0x13')][_0xc33b('0x14')]=_0xc33b('0x27');this[_0xc33b('0xf')][_0x10ad07]['Imap'][_0xc33b('0x15')]=_0x5d645f[_0xc33b('0x10')];if(_0x5d645f['messages']){this[_0xc33b('0xf')][_0x10ad07][_0xc33b('0x13')]['total']=_0x5d645f[_0xc33b('0x28')][_0xc33b('0x16')];}return this[_0xc33b('0xe')](_0x10ad07);}};EmailChannel['prototype'][_0xc33b('0x21')]=function(_0x3418ab,_0xb8626e){logger[_0xc33b('0xb')](_0xc33b('0x29'),_0xb8626e[_0xc33b('0x2a')],_0xb8626e[_0xc33b('0x2b')],_0xb8626e[_0xc33b('0x2c')],_0x3418ab);if(this[_0xc33b('0xf')][_0x3418ab]){return mailAccount[_0xc33b('0x2d')](_0x3418ab,_0xb8626e)[_0xc33b('0x2e')](function(_0x5da78b){if(_0x5da78b){logger['info'](_0xc33b('0x2f'));}})[_0xc33b('0x30')](function(_0x4cf0f1){logger['error'](_0xc33b('0x31'),JSON[_0xc33b('0x18')](_0x4cf0f1));});}};EmailChannel[_0xc33b('0x19')][_0xc33b('0x22')]=function(_0x42a114){if(this[_0xc33b('0xf')][_0x42a114]&&this[_0xc33b('0xf')][_0x42a114][_0xc33b('0x13')]){if(this[_0xc33b('0x1d')][this[_0xc33b('0xf')][_0x42a114][_0xc33b('0x13')]['id']]){delete this[_0xc33b('0x1d')][this[_0xc33b('0xf')][_0x42a114][_0xc33b('0x13')]['id']];}this['mailAccounts'][_0x42a114]['Imap'][_0xc33b('0x32')]=moment();this[_0xc33b('0xe')](_0x42a114);}};EmailChannel[_0xc33b('0x19')][_0xc33b('0x24')]=function(_0x335083,_0x41ebb8){if(this[_0xc33b('0xf')][_0x335083]){this[_0xc33b('0xf')][_0x335083][_0xc33b('0x13')][_0xc33b('0x14')]='error';this[_0xc33b('0xf')][_0x335083][_0xc33b('0x13')][_0xc33b('0x15')]=_0x41ebb8;return this[_0xc33b('0xe')](_0x335083);}};EmailChannel[_0xc33b('0x19')]['sendMail']=function(_0x1ec202,_0x4d434c){return this[_0xc33b('0xd')]['send'](_0x1ec202,_0x4d434c);};EmailChannel['prototype']['verifySmtp']=function(_0x4f91b7){var _0x29cddb=this;if(this[_0xc33b('0xf')][_0x4f91b7['id']]){if(_[_0xc33b('0x17')](this['mailAccounts'][_0x4f91b7['id']][_0xc33b('0x33')])){this[_0xc33b('0xf')][_0x4f91b7['id']]['Smtp']={};}this[_0xc33b('0xf')][_0x4f91b7['id']][_0xc33b('0x33')]['lastSync']=moment();return new BPromise(function(_0x3283c8,_0xd62c6c){return _0x29cddb[_0xc33b('0xd')][_0xc33b('0x34')](_0x4f91b7)[_0xc33b('0x2e')](function(_0xcba9bd){_0x29cddb[_0xc33b('0xf')][_0x4f91b7['id']][_0xc33b('0x33')][_0xc33b('0x14')]=_0xc33b('0x35');_0x29cddb[_0xc33b('0xf')][_0x4f91b7['id']][_0xc33b('0x33')][_0xc33b('0x15')]='';_0x29cddb[_0xc33b('0xe')](_0x4f91b7['id']);_0x3283c8(_0xcba9bd);})['catch'](function(_0x23d4f8){_0x29cddb[_0xc33b('0xf')][_0x4f91b7['id']][_0xc33b('0x33')][_0xc33b('0x14')]=_0xc33b('0x23');_0x29cddb['mailAccounts'][_0x4f91b7['id']]['Smtp'][_0xc33b('0x15')]=_0x23d4f8;_0x29cddb[_0xc33b('0xe')](_0x4f91b7['id']);_0xd62c6c(_0x23d4f8);});});}return this[_0xc33b('0xd')]['verify'](_0x4f91b7);};module[_0xc33b('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index cb1aa84..16cdd47 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 _0xe2fe=['stringify','textCode','hasOwnProperty','upperFirst','lodash','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','getAccount','account','imap','ready','handleReady','handleEnd','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','fetch','once','error','end','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser'];(function(_0x1f4ec3,_0x28207d){var _0x496261=function(_0x47c0ed){while(--_0x47c0ed){_0x1f4ec3['push'](_0x1f4ec3['shift']());}};_0x496261(++_0x28207d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var Imap=require('imap');var simpleParser=require(_0xee2f('0x1'))['simpleParser'];var Iconv=require(_0xee2f('0x2'))[_0xee2f('0x3')];var EventEmitter=require(_0xee2f('0x4'))[_0xee2f('0x5')];var utils=require(_0xee2f('0x6'));var logger=require('../../../config/logger')(_0xee2f('0x7'));function EmailImap(_0x2b7e7c,_0x49926b){this[_0xee2f('0x8')]=_0xee2f('0x9');this['account']=this[_0xee2f('0xa')](_0x2b7e7c,_0x49926b);this['imap']=new Imap(this[_0xee2f('0xb')]);this[_0xee2f('0xc')]['once'](_0xee2f('0xd'),this[_0xee2f('0xe')]['bind'](this));this['imap']['once']('end',this[_0xee2f('0xf')]['bind'](this));this['imap']['on']('error',this[_0xee2f('0x10')][_0xee2f('0x11')](this));this[_0xee2f('0xc')][_0xee2f('0x12')]();}util[_0xee2f('0x13')](EmailImap,EventEmitter);EmailImap[_0xee2f('0x14')]['getAccount']=function(_0x3861e6,_0x531c3a){var _0x36db10={'connTimeout':_0x3861e6[_0xee2f('0x15')]?_0x3861e6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3861e6[_0xee2f('0x16')]?_0x3861e6[_0xee2f('0x16')]*0x3e8:0x1388};if(_[_0xee2f('0x17')](_0x3861e6[_0xee2f('0x18')])){if(_0x3861e6[_0xee2f('0x19')]){_0x36db10['user']=_0x3861e6[_0xee2f('0x1a')];_0x36db10['password']=_0x3861e6[_0xee2f('0x1b')];}_0x36db10[_0xee2f('0x1c')]=_0x3861e6['host'];_0x36db10['port']=_0x3861e6[_0xee2f('0x1d')]||0x3e1;if(_0x3861e6['tls']){_0x36db10[_0xee2f('0x1e')]=!![];}else{_0x36db10[_0xee2f('0x1e')]=![];_0x36db10[_0xee2f('0x1f')]='required';}}else{if(_0x3861e6[_0xee2f('0x20')]){_0x36db10[_0xee2f('0x21')]=utils[_0xee2f('0x22')](_0x3861e6[_0xee2f('0x23')][_0xee2f('0x24')],_0x3861e6['user']);_0x36db10['user']=_0x3861e6[_0xee2f('0x1a')];}else{_0x36db10[_0xee2f('0x1a')]=_0x3861e6[_0xee2f('0x1a')];_0x36db10[_0xee2f('0x1b')]=_0x3861e6[_0xee2f('0x1b')];}_0x36db10[_0xee2f('0x1c')]=utils[_0xee2f('0x25')](_0x3861e6['service']);_0x36db10[_0xee2f('0x1d')]=0x3e1;_0x36db10[_0xee2f('0x1e')]=!![];}_0x36db10[_0xee2f('0x7')]=_0x531c3a||_0x3861e6[_0xee2f('0x1a')]||_0xee2f('0x26');return _0x36db10;};EmailImap[_0xee2f('0x14')][_0xee2f('0xe')]=function(){this[_0xee2f('0xc')][_0xee2f('0x27')](this[_0xee2f('0x8')],![],this[_0xee2f('0x28')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x28')]=function(_0x53f6ed,_0x4ef690){if(_0x53f6ed){this['handleError'](_0x53f6ed,!![]);}else{this[_0xee2f('0x29')](_0xee2f('0x2a'),_0x4ef690);this[_0xee2f('0x2b')]();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x2c')]=function(_0x3737fd){if(_0x3737fd){this['handleError'](_0x3737fd,!![]);}else{this[_0xee2f('0xc')]['end']();}};EmailImap[_0xee2f('0x14')][_0xee2f('0x2b')]=function(){this[_0xee2f('0xc')][_0xee2f('0x2d')]([_0xee2f('0x2e')],this['handleReadUnseen'][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')]['handleReadUnseen']=function(_0x4ee0e1,_0xd1aaac){if(_0x4ee0e1){this['handleError'](_0x4ee0e1,!![]);}else{if(_0xd1aaac[_0xee2f('0x2f')]){try{var _0xc447e=this['imap'][_0xee2f('0x30')](_0xd1aaac,{'bodies':'','markSeen':!![]});_0xc447e['on']('message',this['handleFetchMessage']['bind'](this));_0xc447e[_0xee2f('0x31')](_0xee2f('0x32'),this['handleFetchError'][_0xee2f('0x11')](this));_0xc447e[_0xee2f('0x31')](_0xee2f('0x33'),this[_0xee2f('0x34')][_0xee2f('0x11')](this));}catch(_0x4e682d){logger[_0xee2f('0x32')](_0x4e682d);}}else{this['imap'][_0xee2f('0x35')](!![],this[_0xee2f('0x2c')][_0xee2f('0x11')](this));}}};EmailImap['prototype'][_0xee2f('0x36')]=function(_0x5ed71e){_0x5ed71e['on'](_0xee2f('0x37'),this['handleMessageBody'][_0xee2f('0x11')](this));_0x5ed71e[_0xee2f('0x31')](_0xee2f('0x38'),this[_0xee2f('0x39')][_0xee2f('0x11')](this));_0x5ed71e[_0xee2f('0x31')](_0xee2f('0x33'),this[_0xee2f('0x3a')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x3b')]=function(_0x5ad0a7){simpleParser(_0x5ad0a7,{'Iconv':Iconv},this[_0xee2f('0x3c')]['bind'](this));};EmailImap[_0xee2f('0x14')][_0xee2f('0x39')]=function(){};EmailImap[_0xee2f('0x14')][_0xee2f('0x3a')]=function(){};EmailImap[_0xee2f('0x14')][_0xee2f('0x3c')]=function(_0x694950,_0x130371){if(_0x694950){logger['error'](_0x694950);}else{var _0x562d58=this;utils['parser'](this[_0xee2f('0xb')],_0x130371,function(_0x5483ae){_0x562d58[_0xee2f('0x29')]('email',_0x5483ae);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap'][_0xee2f('0x35')](!![],this[_0xee2f('0x2c')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')]['handleFetchError']=function(_0x5986f4){this[_0xee2f('0x10')](_0x5986f4);this['imap']['closeBox'](!![],this[_0xee2f('0x2c')][_0xee2f('0x11')](this));};EmailImap[_0xee2f('0x14')]['handleEnd']=function(){this[_0xee2f('0x29')](_0xee2f('0x33'));};EmailImap[_0xee2f('0x14')]['handleError']=function(_0x5896f6,_0x137a83){logger[_0xee2f('0x32')](_0xee2f('0x10'),this[_0xee2f('0xb')]['email'],JSON[_0xee2f('0x3d')](_0x5896f6));var _0x1df63d='';if(_0x5896f6){if(_0x5896f6[_0xee2f('0x3e')]){_0x1df63d=_0x5896f6[_0xee2f('0x3e')];}else{for(var _0x214eed in _0x5896f6){if(_0x5896f6[_0xee2f('0x3f')](_0x214eed)){_0x1df63d+=_[_0xee2f('0x40')](_0x214eed)+':\x20'+_0x5896f6[_0x214eed]+'\x0a';}}}}if(_0x137a83){this[_0xee2f('0xc')][_0xee2f('0x33')]();}else{this[_0xee2f('0x29')]('error',_0x1df63d);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x2542=['UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','data5','anonymous@xcally.com','prototype','openBox','emit','box','handleCloseBox','readUnseen','search'];(function(_0x3b500e,_0x4639bc){var _0x3ae452=function(_0x5952ee){while(--_0x5952ee){_0x3b500e['push'](_0x3b500e['shift']());}};_0x3ae452(++_0x4639bc);}(_0x2542,0x169));var _0x2254=function(_0x8901ba,_0x3776f8){_0x8901ba=_0x8901ba-0x0;var _0x1594b2=_0x2542[_0x8901ba];return _0x1594b2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var Imap=require(_0x2254('0x2'));var simpleParser=require(_0x2254('0x3'))['simpleParser'];var Iconv=require(_0x2254('0x4'))['Iconv'];var EventEmitter=require(_0x2254('0x5'))[_0x2254('0x6')];var utils=require(_0x2254('0x7'));var logger=require(_0x2254('0x8'))(_0x2254('0x9'));function EmailImap(_0x508183,_0x19ad3c){this[_0x2254('0xa')]=_0x2254('0xb');this[_0x2254('0xc')]=this[_0x2254('0xd')](_0x508183,_0x19ad3c);this[_0x2254('0x2')]=new Imap(this[_0x2254('0xc')]);this[_0x2254('0x2')][_0x2254('0xe')](_0x2254('0xf'),this[_0x2254('0x10')]['bind'](this));this[_0x2254('0x2')][_0x2254('0xe')](_0x2254('0x11'),this[_0x2254('0x12')]['bind'](this));this['imap']['on'](_0x2254('0x13'),this[_0x2254('0x14')][_0x2254('0x15')](this));this[_0x2254('0x2')][_0x2254('0x16')]();}util[_0x2254('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0x2254('0xd')]=function(_0x7c7ab0,_0x504749){var _0x2f4de={'connTimeout':_0x7c7ab0[_0x2254('0x18')]?_0x7c7ab0[_0x2254('0x18')]*0x3e8:0x2710,'authTimeout':_0x7c7ab0[_0x2254('0x19')]?_0x7c7ab0[_0x2254('0x19')]*0x3e8:0x1388};if(_[_0x2254('0x1a')](_0x7c7ab0['service'])){if(_0x7c7ab0[_0x2254('0x1b')]){_0x2f4de['user']=_0x7c7ab0[_0x2254('0x1c')];_0x2f4de[_0x2254('0x1d')]=_0x7c7ab0[_0x2254('0x1d')];}_0x2f4de[_0x2254('0x1e')]=_0x7c7ab0[_0x2254('0x1e')];_0x2f4de[_0x2254('0x1f')]=_0x7c7ab0['port']||0x3e1;if(_0x7c7ab0['tls']){_0x2f4de['tls']=!![];}else{_0x2f4de[_0x2254('0x20')]=![];_0x2f4de[_0x2254('0x21')]=_0x2254('0x22');}}else{if(_0x7c7ab0[_0x2254('0x23')]){_0x2f4de[_0x2254('0x24')]=utils[_0x2254('0x25')](_0x7c7ab0['CloudProvider'][_0x2254('0x26')],_0x7c7ab0[_0x2254('0x1c')]);_0x2f4de[_0x2254('0x1c')]=_0x7c7ab0['user'];}else{_0x2f4de['user']=_0x7c7ab0['user'];_0x2f4de[_0x2254('0x1d')]=_0x7c7ab0[_0x2254('0x1d')];}_0x2f4de[_0x2254('0x1e')]=utils['getHost'](_0x7c7ab0['service']);_0x2f4de['port']=0x3e1;_0x2f4de['tls']=!![];}_0x2f4de['email']=_0x504749||_0x7c7ab0['user']||_0x2254('0x27');return _0x2f4de;};EmailImap[_0x2254('0x28')][_0x2254('0x10')]=function(){this[_0x2254('0x2')][_0x2254('0x29')](this[_0x2254('0xa')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x2254('0x28')]['handleOpenBox']=function(_0x35608a,_0x141dc5){if(_0x35608a){this[_0x2254('0x14')](_0x35608a,!![]);}else{this[_0x2254('0x2a')](_0x2254('0x2b'),_0x141dc5);this['readUnseen']();}};EmailImap[_0x2254('0x28')][_0x2254('0x2c')]=function(_0x21285d){if(_0x21285d){this[_0x2254('0x14')](_0x21285d,!![]);}else{this[_0x2254('0x2')][_0x2254('0x11')]();}};EmailImap[_0x2254('0x28')][_0x2254('0x2d')]=function(){this[_0x2254('0x2')][_0x2254('0x2e')]([_0x2254('0x2f')],this[_0x2254('0x30')][_0x2254('0x15')](this));};EmailImap[_0x2254('0x28')][_0x2254('0x30')]=function(_0x1b16c8,_0x2c929f){if(_0x1b16c8){this[_0x2254('0x14')](_0x1b16c8,!![]);}else{if(_0x2c929f[_0x2254('0x31')]){try{var _0x4e3658=this[_0x2254('0x2')][_0x2254('0x32')](_0x2c929f,{'bodies':'','markSeen':!![]});_0x4e3658['on'](_0x2254('0x33'),this[_0x2254('0x34')][_0x2254('0x15')](this));_0x4e3658[_0x2254('0xe')](_0x2254('0x13'),this[_0x2254('0x35')][_0x2254('0x15')](this));_0x4e3658['once'](_0x2254('0x11'),this[_0x2254('0x36')]['bind'](this));}catch(_0x240d4e){logger[_0x2254('0x13')](_0x240d4e);}}else{this[_0x2254('0x2')][_0x2254('0x37')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x2254('0x28')]['handleFetchMessage']=function(_0x3d620a){_0x3d620a['on'](_0x2254('0x38'),this[_0x2254('0x39')][_0x2254('0x15')](this));_0x3d620a[_0x2254('0xe')](_0x2254('0x3a'),this[_0x2254('0x3b')]['bind'](this));_0x3d620a[_0x2254('0xe')](_0x2254('0x11'),this[_0x2254('0x3c')][_0x2254('0x15')](this));};EmailImap[_0x2254('0x28')][_0x2254('0x39')]=function(_0x3e7ccb){simpleParser(_0x3e7ccb,{'Iconv':Iconv},this[_0x2254('0x3d')][_0x2254('0x15')](this));};EmailImap[_0x2254('0x28')]['handleMessageAttributes']=function(){};EmailImap[_0x2254('0x28')][_0x2254('0x3c')]=function(){};EmailImap[_0x2254('0x28')][_0x2254('0x3d')]=function(_0x4c7cc3,_0x3f3705){if(_0x4c7cc3){logger[_0x2254('0x13')](_0x4c7cc3);}else{var _0x457625=this;utils[_0x2254('0x3e')](this[_0x2254('0xc')],_0x3f3705,function(_0x2602db){_0x457625[_0x2254('0x2a')](_0x2254('0x9'),_0x2602db);});}};EmailImap['prototype'][_0x2254('0x36')]=function(){this['imap'][_0x2254('0x37')](!![],this[_0x2254('0x2c')][_0x2254('0x15')](this));};EmailImap[_0x2254('0x28')][_0x2254('0x35')]=function(_0x3171ca){this[_0x2254('0x14')](_0x3171ca);this['imap'][_0x2254('0x37')](!![],this[_0x2254('0x2c')][_0x2254('0x15')](this));};EmailImap[_0x2254('0x28')][_0x2254('0x12')]=function(){this['emit'](_0x2254('0x11'));};EmailImap[_0x2254('0x28')][_0x2254('0x14')]=function(_0x135ed8,_0x1d8e75){logger['error'](_0x2254('0x14'),this['account'][_0x2254('0x9')],JSON[_0x2254('0x3f')](_0x135ed8));var _0xb4d042='';if(_0x135ed8){if(_0x135ed8[_0x2254('0x40')]){_0xb4d042=_0x135ed8[_0x2254('0x40')];}else{for(var _0x32ad54 in _0x135ed8){if(_0x135ed8[_0x2254('0x41')](_0x32ad54)){_0xb4d042+=_[_0x2254('0x42')](_0x32ad54)+':\x20'+_0x135ed8[_0x32ad54]+'\x0a';}}}}if(_0x1d8e75){this[_0x2254('0x2')][_0x2254('0x11')]();}else{this[_0x2254('0x2a')](_0x2254('0x13'),_0xb4d042);this[_0x2254('0x2a')]('end');}};module[_0x2254('0x43')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5968e98..d8ea289 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 _0x4706=['verify','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','compile','toString'];(function(_0x5f32bc,_0x444942){var _0x29e0a6=function(_0x512106){while(--_0x512106){_0x5f32bc['push'](_0x5f32bc['shift']());}};_0x29e0a6(++_0x444942);}(_0x4706,0x123));var _0x6470=function(_0x2cbe85,_0x545538){_0x2cbe85=_0x2cbe85-0x0;var _0x111261=_0x4706[_0x2cbe85];return _0x111261;};'use strict';var nodemailer=require(_0x6470('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6470('0x1')][_0x6470('0x2')]=function(_0x5b0039,_0x5cd6f5){return new Promise(function(_0x494db5,_0x23b571){var _0x952eb6=nodemailer[_0x6470('0x3')](_0x5b0039);_0x952eb6['use'](_0x6470('0x4'),inlineBase64());_0x952eb6['sendMail'](_0x5cd6f5,function(_0x31832b,_0x255a4f){if(_0x31832b){_0x23b571(_0x31832b[_0x6470('0x5')]());}else{_0x494db5(_0x255a4f);}});});};EmailSmtp[_0x6470('0x1')][_0x6470('0x6')]=function(_0x1495a7){return new Promise(function(_0x44c297,_0x1e57ec){var _0x3cf34e=nodemailer[_0x6470('0x3')](_0x1495a7);_0x3cf34e[_0x6470('0x6')](function(_0x2f9dca,_0x16b548){if(_0x2f9dca){_0x1e57ec(_0x2f9dca[_0x6470('0x5')]());}else{if(_0x16b548){_0x44c297(_0x16b548);}else{_0x1e57ec(_0x6470('0x7'));}}});});};module[_0x6470('0x8')]=EmailSmtp; \ No newline at end of file +var _0xe6cb=['toString','Not\x20verifired','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail','verify'];(function(_0x334bcc,_0x35be89){var _0x18961c=function(_0x2c57ef){while(--_0x2c57ef){_0x334bcc['push'](_0x334bcc['shift']());}};_0x18961c(++_0x35be89);}(_0xe6cb,0x1cd));var _0xbe6c=function(_0x242e5d,_0x432066){_0x242e5d=_0x242e5d-0x0;var _0x443b3a=_0xe6cb[_0x242e5d];return _0x443b3a;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xbe6c('0x0'));function EmailSmtp(){}EmailSmtp[_0xbe6c('0x1')]['send']=function(_0x366f84,_0x2217c2){return new Promise(function(_0x1c9c02,_0x102bfb){var _0x4d4912=nodemailer[_0xbe6c('0x2')](_0x366f84);_0x4d4912[_0xbe6c('0x3')](_0xbe6c('0x4'),inlineBase64());_0x4d4912[_0xbe6c('0x5')](_0x2217c2,function(_0x36a4c4,_0x3a3b2e){if(_0x36a4c4){_0x102bfb(_0x36a4c4['toString']());}else{_0x1c9c02(_0x3a3b2e);}});});};EmailSmtp[_0xbe6c('0x1')][_0xbe6c('0x6')]=function(_0x15cc67){return new Promise(function(_0x297dab,_0xd27567){var _0x1e6f6f=nodemailer['createTransport'](_0x15cc67);_0x1e6f6f['verify'](function(_0x39b39b,_0x470fa5){if(_0x39b39b){_0xd27567(_0x39b39b[_0xbe6c('0x7')]());}else{if(_0x470fa5){_0x297dab(_0x470fa5);}else{_0xd27567(_0xbe6c('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 01a50e4..46197e5 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 _0x3887=['textAsHtml','message','originTo','originCc','bcc','type','attachment','attachment-','format','%s-%s','now','join','root','server/files/attachments/','writeFileSync','push','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','value','generate','head','name','substring','indexOf','split','length','Anonymous','pop','address','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body'];(function(_0x360dc2,_0x843dd0){var _0x32817d=function(_0x427143){while(--_0x427143){_0x360dc2['push'](_0x360dc2['shift']());}};_0x32817d(++_0x843dd0);}(_0x3887,0x85));var _0x7388=function(_0x3945f4,_0x2da4ad){_0x3945f4=_0x3945f4-0x0;var _0x2a1633=_0x3887[_0x3945f4];return _0x2a1633;};'use strict';var _=require(_0x7388('0x0'));var moment=require(_0x7388('0x1'));var random=require(_0x7388('0x2'));var fs=require('fs');var path=require(_0x7388('0x3'));var util=require('util');var tnef=require(_0x7388('0x4'));var logger=require(_0x7388('0x5'))(_0x7388('0x6'));var config=require('../../../config/environment');function getAddress(_0x1f2e9c){var _0x1eaf0e=_['head'](_0x1f2e9c[_0x7388('0x7')]);return _0x1eaf0e&&_0x1eaf0e['address']?_0x1eaf0e['address']:'anonymous'+random[_0x7388('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x430455){var _0x4fa076=_[_0x7388('0x9')](_0x430455[_0x7388('0x7')]);if(_0x4fa076&&_0x4fa076[_0x7388('0xa')]){if(_0x4fa076[_0x7388('0xa')]==_0x4fa076['address']){return _0x4fa076[_0x7388('0xa')][_0x7388('0xb')](0x0,_0x4fa076[_0x7388('0xa')][_0x7388('0xc')]('@'));}var _0x4d76ef=_0x4fa076[_0x7388('0xa')][_0x7388('0xd')](/\s+/);return _0x4d76ef[_0x7388('0xe')]>0x1?_0x4d76ef['slice'](0x0,-0x1)['join']('\x20'):_0x4fa076[_0x7388('0xa')];}return _0x7388('0xf');}function getLastName(_0x1392a2){var _0x455960=_[_0x7388('0x9')](_0x1392a2['value']);if(_0x455960&&_0x455960['name']){var _0x1f55d9=_0x455960[_0x7388('0xa')]['split'](/\s+/);return _0x1f55d9[_0x7388('0xe')]>0x1?_0x1f55d9[_0x7388('0x10')]():'';}return'';}function getMails(_0x5cc294,_0x555b4c){var _0x5ce5eb='';for(var _0x1b3fa3=0x0;_0x1b3fa3<_0x555b4c['value'][_0x7388('0xe')];_0x1b3fa3+=0x1){if(_0x555b4c['value'][_0x1b3fa3][_0x7388('0x11')]!==_0x5cc294){if(!_[_0x7388('0x12')](_0x5ce5eb)){_0x5ce5eb+=',';}_0x5ce5eb+=_0x555b4c['value'][_0x1b3fa3][_0x7388('0xa')]||_0x555b4c[_0x7388('0x7')][_0x1b3fa3][_0x7388('0x11')]||'';_0x5ce5eb+='\x20<';_0x5ce5eb+=_0x555b4c[_0x7388('0x7')][_0x1b3fa3][_0x7388('0x11')]?_0x555b4c['value'][_0x1b3fa3]['address']:_0x7388('0x13')+random['generate'](0x6)+'@xcally.com';_0x5ce5eb+='>';}}return _0x5ce5eb;}function parseEmail(_0x34f958,_0x21dc5c,_0x3ba13c){if(_0x21dc5c[_0x7388('0x14')]){var _0x13b066=/)<[^<]*)*<\/script>/gi;while(_0x13b066[_0x7388('0x15')](_0x21dc5c[_0x7388('0x14')])){_0x21dc5c['html']=_0x21dc5c[_0x7388('0x14')][_0x7388('0x16')](_0x13b066,'');}if(_0x21dc5c[_0x7388('0x14')][_0x7388('0x17')](_0x7388('0x18'))){var _0x11b00a=[];_0x21dc5c[_0x7388('0x19')][_0x7388('0x1a')](_0x41f60c=>{_0x11b00a['push'](_0x41f60c[_0x7388('0x1b')]);});var _0x230300=/]+>/g;var _0x478e92=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x59c107=_0x21dc5c[_0x7388('0x14')][_0x7388('0x16')](_0x478e92,_0x7388('0x1c'));var _0x2f185a=_0x59c107['replace'](_0x230300,_0x7388('0x1d'));for(let _0x54646e=0x0;_0x54646e<_0x11b00a[_0x7388('0xe')];_0x54646e++){var _0x2707e7=_0x2f185a['replace'](_0x7388('0x1d'),_0x7388('0x1e')+_0x11b00a[_0x54646e]+_0x7388('0x1f'));_0x2f185a=_0x2707e7;}_0x21dc5c[_0x7388('0x14')]=_0x2f185a;}_0x3ba13c[_0x7388('0x20')]=_0x21dc5c['html'];}else{_0x3ba13c[_0x7388('0x20')]=_0x21dc5c[_0x7388('0x21')];}if(_0x3ba13c[_0x7388('0x20')]){_0x3ba13c[_0x7388('0x20')]=_0x3ba13c['body']['replace'](/0x0){var _0x387ea9=['Auto-Submitted:\x20auto-replied',_0x7388('0x33'),_0x7388('0x34')];for(var _0x12fd2a=0x0;_0x12fd2a<_0x21dc5c[_0x7388('0x32')][_0x7388('0xe')];_0x12fd2a++){var _0x161d33=_[_0x7388('0xc')](_0x387ea9,_0x21dc5c[_0x7388('0x32')][_0x12fd2a][_0x7388('0x35')]);if(_0x161d33>=0x0){_0x3ba13c[_0x7388('0x36')]=!![];}}}return _0x3ba13c;}exports['parser']=function(_0x53db35,_0x3e8c8d,_0x1ddbd0){var _0x29efe5={'from':getAddress(_0x3e8c8d[_0x7388('0x37')]),'firstName':getFirstName(_0x3e8c8d[_0x7388('0x37')]),'lastName':getLastName(_0x3e8c8d[_0x7388('0x37')]),'mapKey':_0x7388('0x6'),'message':{'from':getMails(_0x53db35[_0x7388('0x6')],_0x3e8c8d[_0x7388('0x37')]),'to':_0x53db35[_0x7388('0x6')],'cc':'','subject':_0x3e8c8d[_0x7388('0x38')]||'','messageId':_0x3e8c8d['messageId'],'inReplyTo':_0x3e8c8d['inReplyTo'],'sentAt':moment(_0x3e8c8d[_0x7388('0x39')])['format'](_0x7388('0x3a')),'attach':![],'attachments':[]}};if(!_0x3e8c8d[_0x7388('0x14')]&&!_0x3e8c8d[_0x7388('0x21')]){var _0xb0065=_[_0x7388('0x3b')](_0x3e8c8d[_0x7388('0x19')],{'contentType':_0x7388('0x3c')});if(_0xb0065['length']){logger['info'](util['format'](_0x7388('0x3d'),_0x3e8c8d[_0x7388('0x3e')]));tnef[_0x7388('0x3f')](_['first'](_0xb0065)[_0x7388('0x40')],function(_0x305268,_0x23a965){if(_0x23a965){_0x3e8c8d['html']=_0x23a965[_0x7388('0x41')]||_0x7388('0x42');if(_0x23a965[_0x7388('0x43')]){for(var _0x87a9b9=0x0;_0x87a9b9<_0x23a965[_0x7388('0x43')][_0x7388('0xe')];_0x87a9b9++){var _0xc0fb15=_0x23a965[_0x7388('0x43')][_0x87a9b9];_0x29efe5['message']['attachments'][_0x7388('0x30')]({'filename':_0xc0fb15[_0x7388('0x44')],'content':Buffer[_0x7388('0x37')](_0xc0fb15[_0x7388('0x45')])});}}}_0x1ddbd0(parseEmail(_0x53db35,_0x3e8c8d,_0x29efe5));});}else{_0x3e8c8d[_0x7388('0x14')]=_0x7388('0x42');_0x1ddbd0(parseEmail(_0x53db35,_0x3e8c8d,_0x29efe5));}}else{_0x1ddbd0(parseEmail(_0x53db35,_0x3e8c8d,_0x29efe5));}};exports[_0x7388('0x46')]=function(_0x54c3f1){switch(_0x54c3f1){case'gmail':return _0x7388('0x47');case _0x7388('0x48'):return _0x7388('0x49');case _0x7388('0x4a'):return'imap-mail.outlook.com';case _0x7388('0x4b'):return _0x7388('0x4c');}return _0x7388('0x4d');};exports[_0x7388('0x4e')]=function(_0x43df67,_0x3db447){var _0x4749d0=['user='+(_0x3db447||''),_0x7388('0x4f')+_0x43df67,'',''];return Buffer[_0x7388('0x37')](_0x4749d0['join'](''),_0x7388('0x50'))[_0x7388('0x51')](_0x7388('0x52'));}; \ No newline at end of file +var _0xc330=['now','root','server/files/attachments/','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','user=','auth=Bearer\x20','toString','base64','moment','randomstring','path','../../../config/logger','../../../config/environment','head','address','generate','@xcally.com','value','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','test','html','replace','','body','0x1?_0x45ce0f[_0x0c33('0xe')](0x0,-0x1)[_0x0c33('0xf')]('\x20'):_0x49a3d0[_0x0c33('0xa')];}return _0x0c33('0x10');}function getLastName(_0x36816d){var _0x29d3aa=_[_0x0c33('0x5')](_0x36816d['value']);if(_0x29d3aa&&_0x29d3aa[_0x0c33('0xa')]){var _0x1f5eda=_0x29d3aa[_0x0c33('0xa')]['split'](/\s+/);return _0x1f5eda['length']>0x1?_0x1f5eda[_0x0c33('0x11')]():'';}return'';}function getMails(_0x1e80d6,_0x5485c2){var _0x2893c1='';for(var _0x4a4fbf=0x0;_0x4a4fbf<_0x5485c2[_0x0c33('0x9')][_0x0c33('0xd')];_0x4a4fbf+=0x1){if(_0x5485c2[_0x0c33('0x9')][_0x4a4fbf]['address']!==_0x1e80d6){if(!_[_0x0c33('0x12')](_0x2893c1)){_0x2893c1+=',';}_0x2893c1+=_0x5485c2[_0x0c33('0x9')][_0x4a4fbf][_0x0c33('0xa')]||_0x5485c2[_0x0c33('0x9')][_0x4a4fbf][_0x0c33('0x6')]||'';_0x2893c1+='\x20<';_0x2893c1+=_0x5485c2[_0x0c33('0x9')][_0x4a4fbf][_0x0c33('0x6')]?_0x5485c2[_0x0c33('0x9')][_0x4a4fbf][_0x0c33('0x6')]:_0x0c33('0x13')+random[_0x0c33('0x7')](0x6)+_0x0c33('0x8');_0x2893c1+='>';}}return _0x2893c1;}function parseEmail(_0x4a5e2d,_0x345bbb,_0x32995f){if(_0x345bbb['html']){var _0x57fdae=/)<[^<]*)*<\/script>/gi;while(_0x57fdae[_0x0c33('0x14')](_0x345bbb[_0x0c33('0x15')])){_0x345bbb[_0x0c33('0x15')]=_0x345bbb['html'][_0x0c33('0x16')](_0x57fdae,'');}if(_0x345bbb[_0x0c33('0x15')]['includes'](_0x0c33('0x17'))){var _0x4e9b75=[];_0x345bbb[_0x0c33('0x18')][_0x0c33('0x19')](_0x168f11=>{_0x4e9b75[_0x0c33('0x1a')](_0x168f11['filename']);});var _0x5a0a47=/]+>/g;var _0x327d85=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x470bc9=_0x345bbb[_0x0c33('0x15')]['replace'](_0x327d85,'_SRC');var _0x385c3c=_0x470bc9[_0x0c33('0x16')](_0x5a0a47,_0x0c33('0x1b'));for(let _0x52ce00=0x0;_0x52ce00<_0x4e9b75[_0x0c33('0xd')];_0x52ce00++){var _0x27c2a0=_0x385c3c['replace'](_0x0c33('0x1b'),'\x20[Attachment:\x20'+_0x4e9b75[_0x52ce00]+_0x0c33('0x1c'));_0x385c3c=_0x27c2a0;}_0x345bbb[_0x0c33('0x15')]=_0x385c3c;}_0x32995f[_0x0c33('0x1d')]=_0x345bbb[_0x0c33('0x15')];}else{_0x32995f['body']=_0x345bbb['textAsHtml'];}if(_0x32995f[_0x0c33('0x1d')]){_0x32995f[_0x0c33('0x1d')]=_0x32995f[_0x0c33('0x1d')][_0x0c33('0x16')](/0x0){var _0x3d2874=[_0x0c33('0x2e'),_0x0c33('0x2f'),'Precedence:\x20auto_reply'];for(var _0x9860e9=0x0;_0x9860e9<_0x345bbb[_0x0c33('0x2d')][_0x0c33('0xd')];_0x9860e9++){var _0x390041=_['indexOf'](_0x3d2874,_0x345bbb['headerLines'][_0x9860e9][_0x0c33('0x30')]);if(_0x390041>=0x0){_0x32995f[_0x0c33('0x31')]=!![];}}}return _0x32995f;}exports[_0x0c33('0x32')]=function(_0x4b401b,_0x5bda95,_0x3a7e9a){var _0x2d7233={'from':getAddress(_0x5bda95[_0x0c33('0x33')]),'firstName':getFirstName(_0x5bda95[_0x0c33('0x33')]),'lastName':getLastName(_0x5bda95[_0x0c33('0x33')]),'mapKey':_0x0c33('0x21'),'message':{'from':getMails(_0x4b401b[_0x0c33('0x21')],_0x5bda95[_0x0c33('0x33')]),'to':_0x4b401b[_0x0c33('0x21')],'cc':'','subject':_0x5bda95[_0x0c33('0x34')]||'','messageId':_0x5bda95[_0x0c33('0x35')],'inReplyTo':_0x5bda95[_0x0c33('0x36')],'sentAt':moment(_0x5bda95['date'])[_0x0c33('0x27')](_0x0c33('0x37')),'attach':![],'attachments':[]}};if(!_0x5bda95[_0x0c33('0x15')]&&!_0x5bda95[_0x0c33('0x38')]){var _0x4e61fa=_[_0x0c33('0x39')](_0x5bda95[_0x0c33('0x18')],{'contentType':_0x0c33('0x3a')});if(_0x4e61fa[_0x0c33('0xd')]){logger[_0x0c33('0x3b')](util[_0x0c33('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5bda95[_0x0c33('0x35')]));tnef[_0x0c33('0x3c')](_[_0x0c33('0x3d')](_0x4e61fa)[_0x0c33('0x3e')],function(_0x3d99e1,_0x2919a0){if(_0x2919a0){_0x5bda95['html']=_0x2919a0[_0x0c33('0x3f')]||_0x0c33('0x40');if(_0x2919a0[_0x0c33('0x41')]){for(var _0x4d8d24=0x0;_0x4d8d24<_0x2919a0[_0x0c33('0x41')][_0x0c33('0xd')];_0x4d8d24++){var _0x1f95d5=_0x2919a0[_0x0c33('0x41')][_0x4d8d24];_0x2d7233['message']['attachments'][_0x0c33('0x1a')]({'filename':_0x1f95d5['Title'],'content':Buffer['from'](_0x1f95d5[_0x0c33('0x42')])});}}}_0x3a7e9a(parseEmail(_0x4b401b,_0x5bda95,_0x2d7233));});}else{_0x5bda95['html']=_0x0c33('0x40');_0x3a7e9a(parseEmail(_0x4b401b,_0x5bda95,_0x2d7233));}}else{_0x3a7e9a(parseEmail(_0x4b401b,_0x5bda95,_0x2d7233));}};exports[_0x0c33('0x43')]=function(_0x3cbf63){switch(_0x3cbf63){case _0x0c33('0x44'):return _0x0c33('0x45');case _0x0c33('0x46'):return _0x0c33('0x47');case _0x0c33('0x48'):return _0x0c33('0x49');case'outlook365':return _0x0c33('0x4a');}return'127.0.0.1';};exports['generateXOAuth2Token']=function(_0x4f1c8e,_0x56083c){var _0x585a87=[_0x0c33('0x4b')+(_0x56083c||''),_0x0c33('0x4c')+_0x4f1c8e,'',''];return Buffer[_0x0c33('0x33')](_0x585a87[_0x0c33('0xf')](''),'utf-8')[_0x0c33('0x4d')](_0x0c33('0x4e'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a9337d2..2fe4e3d 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 _0x59cc=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x59cc,0x1b2));var _0xc59c=function(_0x4d6449,_0x2a93db){_0x4d6449=_0x4d6449-0x0;var _0x4bfe59=_0x59cc[_0x4d6449];return _0x4bfe59;};'use strict';var _=require('lodash');function MailAccount(_0xb44004){this['id']=_0xb44004['id']||0x0;this[_0xc59c('0x0')]=_0xb44004[_0xc59c('0x0')]||'Service';this[_0xc59c('0x1')]=_0xb44004[_0xc59c('0x1')]||_0xc59c('0x2');this[_0xc59c('0x3')]=_0xb44004[_0xc59c('0x3')]||![];this[_0xc59c('0x4')]=_0xb44004['Imap']||[];this[_0xc59c('0x5')]=_0xb44004[_0xc59c('0x5')]||[];}module[_0xc59c('0x6')]=MailAccount; \ No newline at end of file +var _0x8c6b=['key','active','Imap','Smtp','exports','lodash','name'];(function(_0x4cfd78,_0x52355e){var _0xf4a95a=function(_0x5c2d5b){while(--_0x5c2d5b){_0x4cfd78['push'](_0x4cfd78['shift']());}};_0xf4a95a(++_0x52355e);}(_0x8c6b,0x124));var _0xb8c6=function(_0x4484c8,_0x28f2eb){_0x4484c8=_0x4484c8-0x0;var _0x582d76=_0x8c6b[_0x4484c8];return _0x582d76;};'use strict';var _=require(_0xb8c6('0x0'));function MailAccount(_0x2dda24){this['id']=_0x2dda24['id']||0x0;this[_0xb8c6('0x1')]=_0x2dda24[_0xb8c6('0x1')]||'Service';this[_0xb8c6('0x2')]=_0x2dda24[_0xb8c6('0x2')]||'SERV';this[_0xb8c6('0x3')]=_0x2dda24[_0xb8c6('0x3')]||![];this[_0xb8c6('0x4')]=_0x2dda24['Imap']||[];this[_0xb8c6('0x5')]=_0x2dda24['Smtp']||[];}module[_0xb8c6('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index a625550..7438f07 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 _0x498d=['mergeFromDatabase','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0xfd55d5,_0x18e3df){var _0x31eb24=function(_0x403a07){while(--_0x403a07){_0xfd55d5['push'](_0xfd55d5['shift']());}};_0x31eb24(++_0x18e3df);}(_0x498d,0x67));var _0xd498=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x498d[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require(_0xd498('0x0'));var MailAccount=require(_0xd498('0x1'));var Realtime=function(){this[_0xd498('0x2')]={};};function freeIsNotKey(_0x5f3c2c,_0x1d2f24,_0x2c5092){var _0x138f6d=_[_0xd498('0x3')](_0x5f3c2c,function(_0x13be1c,_0x26994b){return _0x13be1c[_0x2c5092];});for(var _0x169660 in _0x1d2f24){if(_0x1d2f24['hasOwnProperty'](_0x169660)){if(!_0x138f6d[_0x169660]){delete _0x1d2f24[_0x169660];}}}}Realtime[_0xd498('0x4')][_0xd498('0x5')]=function(_0x2c9ff8,_0x329fb6){for(var _0x59cfaf in _0x329fb6){if(_0x2c9ff8['hasOwnProperty'](_0x59cfaf)){_0x2c9ff8[_0x59cfaf]=_0x329fb6[_0x59cfaf];}}};Realtime[_0xd498('0x4')]['initMailAccounts']=function(){var _0x175516=this;return function(_0xdab4e2){if(_0xdab4e2){freeIsNotKey(_0xdab4e2,_0x175516[_0xd498('0x2')],'id');for(var _0x126b81=0x0,_0x32e957={},_0x4ad6f5={};_0x126b81<_0xdab4e2['length'];_0x126b81+=0x1){_0x32e957=_0xdab4e2[_0x126b81];if(_[_0xd498('0x6')](_0x175516[_0xd498('0x2')][_0x32e957['id']])){_0x175516['mailAccounts'][_0x32e957['id']]=new MailAccount(_0x32e957);}else{_[_0xd498('0x7')](_0x175516['mailAccounts'][_0x32e957['id']],_0x32e957);}}}return _0x175516[_0xd498('0x2')];};};module[_0xd498('0x8')]=Realtime; \ No newline at end of file +var _0x328d=['length','isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x59c3a2,_0x2676ad){var _0x310c95=function(_0x3dbfc9){while(--_0x3dbfc9){_0x59c3a2['push'](_0x59c3a2['shift']());}};_0x310c95(++_0x2676ad);}(_0x328d,0x197));var _0xd328=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x328d[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xd328('0x0'));var MailAccount=require(_0xd328('0x1'));var Realtime=function(){this[_0xd328('0x2')]={};};function freeIsNotKey(_0x4b2bd3,_0x71be3d,_0x57390a){var _0x1b452d=_['mapKeys'](_0x4b2bd3,function(_0x31566e,_0x687ef2){return _0x31566e[_0x57390a];});for(var _0xcd436c in _0x71be3d){if(_0x71be3d[_0xd328('0x3')](_0xcd436c)){if(!_0x1b452d[_0xcd436c]){delete _0x71be3d[_0xcd436c];}}}}Realtime[_0xd328('0x4')][_0xd328('0x5')]=function(_0x4f7052,_0x46e2d9){for(var _0x51e9f9 in _0x46e2d9){if(_0x4f7052[_0xd328('0x3')](_0x51e9f9)){_0x4f7052[_0x51e9f9]=_0x46e2d9[_0x51e9f9];}}};Realtime[_0xd328('0x4')][_0xd328('0x6')]=function(){var _0xc23e1d=this;return function(_0x19ee99){if(_0x19ee99){freeIsNotKey(_0x19ee99,_0xc23e1d[_0xd328('0x2')],'id');for(var _0x28b787=0x0,_0x2a2511={},_0x52b86d={};_0x28b787<_0x19ee99[_0xd328('0x7')];_0x28b787+=0x1){_0x2a2511=_0x19ee99[_0x28b787];if(_[_0xd328('0x8')](_0xc23e1d[_0xd328('0x2')][_0x2a2511['id']])){_0xc23e1d[_0xd328('0x2')][_0x2a2511['id']]=new MailAccount(_0x2a2511);}else{_['merge'](_0xc23e1d['mailAccounts'][_0x2a2511['id']],_0x2a2511);}}}return _0xc23e1d[_0xd328('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d00d544..0cdf4c6 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 _0x0618=['GetMailAccount','name','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts'];(function(_0x2c6dd1,_0x4a82a0){var _0x4690b3=function(_0x59f4ec){while(--_0x59f4ec){_0x2c6dd1['push'](_0x2c6dd1['shift']());}};_0x4690b3(++_0x4a82a0);}(_0x0618,0x1c6));var _0x8061=function(_0x568d1a,_0x252354){_0x568d1a=_0x568d1a-0x0;var _0x12f6c1=_0x0618[_0x568d1a];return _0x12f6c1;};'use strict';var client=require(_0x8061('0x0'));exports[_0x8061('0x1')]=function(){return function(){return client['Request'](_0x8061('0x2'),{'options':{'attributes':['id',_0x8061('0x3'),'provider','service',_0x8061('0x4'),_0x8061('0x5'),_0x8061('0x6'),_0x8061('0x7'),_0x8061('0x8')],'raw':![],'include':[{'model':_0x8061('0x9'),'as':_0x8061('0xa'),'include':[{'model':_0x8061('0xb'),'attributes':['id',_0x8061('0x3'),_0x8061('0xc'),_0x8061('0xd'),'data5'],'as':_0x8061('0xb')}]},{'model':'MailServerOut','as':_0x8061('0xe'),'include':[{'model':_0x8061('0xb'),'attributes':['id',_0x8061('0x3'),_0x8061('0xc'),_0x8061('0xd'),'data5'],'as':'CloudProvider'}]}]},'log':_0x8061('0xf')});};};exports[_0x8061('0x10')]=function(_0x593022,_0x50913f){return client[_0x8061('0x11')](_0x8061('0x12'),{'account':{'id':_0x593022},'body':_0x50913f,'log':_0x8061('0x12')});}; \ No newline at end of file +var _0x7d5d=['Imap','name','type','CloudProvider','MailServerOut','data5','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','provider','service','email','key','ListId','TemplateId','MailServerIn'];(function(_0x899f5b,_0xeb544){var _0x1033b1=function(_0x1bfbbd){while(--_0x1bfbbd){_0x899f5b['push'](_0x899f5b['shift']());}};_0x1033b1(++_0xeb544);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x1b6320,_0x3a51b6){_0x1b6320=_0x1b6320-0x0;var _0x413de8=_0x7d5d[_0x1b6320];return _0x413de8;};'use strict';var client=require('../client');exports[_0xd7d5('0x0')]=function(){return function(){return client[_0xd7d5('0x1')]('GetMailAccount',{'options':{'attributes':['id','name',_0xd7d5('0x2'),_0xd7d5('0x3'),_0xd7d5('0x4'),'active',_0xd7d5('0x5'),_0xd7d5('0x6'),_0xd7d5('0x7')],'raw':![],'include':[{'model':_0xd7d5('0x8'),'as':_0xd7d5('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0xd7d5('0xa'),_0xd7d5('0x3'),_0xd7d5('0xb'),'data5'],'as':_0xd7d5('0xc')}]},{'model':_0xd7d5('0xd'),'as':'Smtp','include':[{'model':_0xd7d5('0xc'),'attributes':['id',_0xd7d5('0xa'),_0xd7d5('0x3'),'type',_0xd7d5('0xe')],'as':_0xd7d5('0xc')}]}]},'log':_0xd7d5('0xf')});};};exports[_0xd7d5('0x10')]=function(_0x4be025,_0x59d51c){return client[_0xd7d5('0x1')](_0xd7d5('0x11'),{'account':{'id':_0x4be025},'body':_0x59d51c,'log':_0xd7d5('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index d685b6a..6042644 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 _0x544c=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x3603bc,_0x590d00){var _0x7fabf1=function(_0xb9e0a9){while(--_0xb9e0a9){_0x3603bc['push'](_0x3603bc['shift']());}};_0x7fabf1(++_0x590d00);}(_0x544c,0xf3));var _0xc544=function(_0x55ba32,_0x3c0cd5){_0x55ba32=_0x55ba32-0x0;var _0x56f1d0=_0x544c[_0x55ba32];return _0x56f1d0;};'use strict';var client=require(_0xc544('0x0'));exports[_0xc544('0x1')]=function(){return client[_0xc544('0x2')](_0xc544('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc544('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x3329=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x4729fe,_0x2b16ac){var _0x4bcbad=function(_0x27e2d9){while(--_0x27e2d9){_0x4729fe['push'](_0x4729fe['shift']());}};_0x4bcbad(++_0x2b16ac);}(_0x3329,0x1ab));var _0x9332=function(_0x15c822,_0x4e945b){_0x15c822=_0x15c822-0x0;var _0x5bcf35=_0x3329[_0x15c822];return _0x5bcf35;};'use strict';var client=require(_0x9332('0x0'));exports[_0x9332('0x1')]=function(){return client['Request'](_0x9332('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9332('0x3')]},'log':_0x9332('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e275935..19a5b18 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 0312346..7475dda 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 _0x1bd2=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','exports','lodash','http','express','ioredis','../../config/environment','createServer','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis'];(function(_0x4430ea,_0x1867b7){var _0x431c9d=function(_0x242569){while(--_0x242569){_0x4430ea['push'](_0x4430ea['shift']());}};_0x431c9d(++_0x1867b7);}(_0x1bd2,0x133));var _0x21bd=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x1bd2[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x21bd('0x0'));var http=require(_0x21bd('0x1'));var express=require(_0x21bd('0x2'));var sticky=require('sticky-session');var Redis=require(_0x21bd('0x3'));var config=require(_0x21bd('0x4'));var app=express();var server=http[_0x21bd('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x21bd('0x6')])){var socketio=require(_0x21bd('0x7'))(server,{'transports':[_0x21bd('0x8'),_0x21bd('0x9')]});config[_0x21bd('0xa')]=_[_0x21bd('0xb')](config['redis'],{'host':_0x21bd('0xc'),'port':0x18eb});socketio[_0x21bd('0xd')](require(_0x21bd('0xe'))({'pubClient':new Redis(config[_0x21bd('0xa')]),'subClient':new Redis(config[_0x21bd('0xa')])}));require('../../config/triggers')[_0x21bd('0xf')]();require(_0x21bd('0x10'))[_0x21bd('0xf')](socketio);require(_0x21bd('0x11'))[_0x21bd('0xf')](app);require(_0x21bd('0x12'))[_0x21bd('0xf')](app);}else{server[_0x21bd('0x13')](_0x21bd('0x14'),function(){console[_0x21bd('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x21bd('0x16')]=app; \ No newline at end of file +var _0xb1d6=['listening','http','express','sticky-session','ioredis','../../config/environment','listen','port','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once'];(function(_0x4f72e0,_0x4f1587){var _0x5d945c=function(_0x21a682){while(--_0x21a682){_0x4f72e0['push'](_0x4f72e0['shift']());}};_0x5d945c(++_0x4f1587);}(_0xb1d6,0x157));var _0x6b1d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb1d6[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var http=require(_0x6b1d('0x0'));var express=require(_0x6b1d('0x1'));var sticky=require(_0x6b1d('0x2'));var Redis=require(_0x6b1d('0x3'));var config=require(_0x6b1d('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x6b1d('0x5')](server,config[_0x6b1d('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x6b1d('0x7'),_0x6b1d('0x8')]});config[_0x6b1d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x6b1d('0xa')](require(_0x6b1d('0xb'))({'pubClient':new Redis(config[_0x6b1d('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x6b1d('0xc'))[_0x6b1d('0xd')]();require(_0x6b1d('0xe'))[_0x6b1d('0xd')](socketio);require(_0x6b1d('0xf'))[_0x6b1d('0xd')](app);require('../../routes')[_0x6b1d('0xd')](app);}else{server[_0x6b1d('0x10')](_0x6b1d('0x11'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6b1d('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index fe55fcc..0794bde 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 _0xe483=['message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x294a10,_0xf990e3){var _0x3aea50=function(_0x1cec90){while(--_0x1cec90){_0x294a10['push'](_0x294a10['shift']());}};_0x3aea50(++_0xf990e3);}(_0xe483,0x154));var _0x3e48=function(_0x4f1beb,_0x19d3d9){_0x4f1beb=_0x4f1beb-0x0;var _0x30a38b=_0xe483[_0x4f1beb];return _0x30a38b;};'use strict';var jayson=require(_0x3e48('0x0'));var BPromise=require('bluebird');var logger=require(_0x3e48('0x1'))(_0x3e48('0x2'));var client=jayson[_0x3e48('0x3')][_0x3e48('0x4')]({'port':0x2329});client[_0x3e48('0x5')]=function(_0x3ab618,_0x39f8d6){return new BPromise(function(_0x10570d,_0x2f3150){return client[_0x3e48('0x6')](_0x3ab618,_0x39f8d6)[_0x3e48('0x7')](function(_0x5e8ac2){logger['debug'](_0x3e48('0x8'),_0x3e48('0x2'),_0x3ab618,_0x39f8d6,_0x5e8ac2);if(_0x5e8ac2[_0x3e48('0x9')]){logger[_0x3e48('0x9')](_0x3e48('0x8'),'routing',_0x3ab618,_0x5e8ac2[_0x3e48('0x9')][_0x3e48('0xa')],_0x39f8d6);return _0x2f3150(_0x5e8ac2[_0x3e48('0x9')]['message']);}else{return _0x10570d(_0x5e8ac2[_0x3e48('0xb')]);}})[_0x3e48('0xc')](function(_0x5b1887){logger['error'](_0x3e48('0x8'),_0x3e48('0x2'),_0x3ab618,_0x5b1887,_0x39f8d6);return _0x2f3150(_0x5b1887);});});};module[_0x3e48('0xd')]=client; \ No newline at end of file +var _0x2240=['../../config/logger','routing','client','Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x2240,0xa6));var _0x0224=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2240[_0x543084];return _0x306a57;};'use strict';var jayson=require(_0x0224('0x0'));var BPromise=require(_0x0224('0x1'));var logger=require(_0x0224('0x2'))(_0x0224('0x3'));var client=jayson[_0x0224('0x4')]['http']({'port':0x2329});client[_0x0224('0x5')]=function(_0x2bb1c3,_0x1563f6){return new BPromise(function(_0x5b4587,_0x491026){return client[_0x0224('0x6')](_0x2bb1c3,_0x1563f6)[_0x0224('0x7')](function(_0x3f7582){logger[_0x0224('0x8')](_0x0224('0x9'),_0x0224('0x3'),_0x2bb1c3,_0x1563f6,_0x3f7582);if(_0x3f7582[_0x0224('0xa')]){logger['error'](_0x0224('0x9'),'routing',_0x2bb1c3,_0x3f7582['error'][_0x0224('0xb')],_0x1563f6);return _0x491026(_0x3f7582[_0x0224('0xa')][_0x0224('0xb')]);}else{return _0x5b4587(_0x3f7582['result']);}})[_0x0224('0xc')](function(_0x59a8ce){logger[_0x0224('0xa')](_0x0224('0x9'),'routing',_0x2bb1c3,_0x59a8ce,_0x1563f6);return _0x491026(_0x59a8ce);});});};module[_0x0224('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 642c12a..f220c10 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 _0xf429=['./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','./server'];(function(_0x34e466,_0x51b310){var _0x49a385=function(_0x344d7b){while(--_0x344d7b){_0x34e466['push'](_0x34e466['shift']());}};_0x49a385(++_0x51b310);}(_0xf429,0x107));var _0x9f42=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xf429[_0x29632e];return _0x426e04;};'use strict';var BPromise=require('bluebird');var server=require(_0x9f42('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x9f42('0x1'));var openchannelQueue=require(_0x9f42('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x9f42('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x9f42('0x4'));var whatsappQueue=require(_0x9f42('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9f42('0x6')]()[_0x9f42('0x7')](user[_0x9f42('0x8')]())[_0x9f42('0x7')](realtime[_0x9f42('0x9')]())[_0x9f42('0x7')](interval[_0x9f42('0xa')]())[_0x9f42('0x7')](realtime['initIntervals']())[_0x9f42('0x7')](openchannelQueue[_0x9f42('0xb')]())[_0x9f42('0x7')](realtime[_0x9f42('0xc')]())[_0x9f42('0x7')](chatQueue['getChatQueues']())['then'](realtime[_0x9f42('0xd')]())[_0x9f42('0x7')](smsQueue[_0x9f42('0xe')]())[_0x9f42('0x7')](realtime[_0x9f42('0xf')]())[_0x9f42('0x7')](mailQueue[_0x9f42('0x10')]())[_0x9f42('0x7')](realtime['initMailQueues']())[_0x9f42('0x7')](faxQueue[_0x9f42('0x11')]())['then'](realtime[_0x9f42('0x12')]())[_0x9f42('0x7')](whatsappQueue[_0x9f42('0x13')]())['then'](realtime[_0x9f42('0x14')]())[_0x9f42('0x7')](function(){return realtime;});}function main(){return server[_0x9f42('0x15')](realtime)[_0x9f42('0x7')](function(_0x21f477){return initRealtime();})['then'](function(_0x3ab75c){return setInterval(initRealtime,0x1388);})['catch'](function(_0x51df41){console['log'](_0x51df41);});}main(); \ No newline at end of file +var _0xdf21=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x449628,_0x31d665){var _0x591025=function(_0x28dcc0){while(--_0x28dcc0){_0x449628['push'](_0x449628['shift']());}};_0x591025(++_0x31d665);}(_0xdf21,0x16a));var _0x1df2=function(_0x277e80,_0x2649ad){_0x277e80=_0x277e80-0x0;var _0x4afa0e=_0xdf21[_0x277e80];return _0x4afa0e;};'use strict';var BPromise=require(_0x1df2('0x0'));var server=require(_0x1df2('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x1df2('0x2'));var openchannelQueue=require(_0x1df2('0x3'));var chatQueue=require(_0x1df2('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x1df2('0x5'));var faxQueue=require(_0x1df2('0x6'));var whatsappQueue=require(_0x1df2('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x1df2('0x8')](user[_0x1df2('0x9')]())[_0x1df2('0x8')](realtime[_0x1df2('0xa')]())[_0x1df2('0x8')](interval['getIntervals']())[_0x1df2('0x8')](realtime[_0x1df2('0xb')]())['then'](openchannelQueue[_0x1df2('0xc')]())[_0x1df2('0x8')](realtime[_0x1df2('0xd')]())['then'](chatQueue[_0x1df2('0xe')]())[_0x1df2('0x8')](realtime[_0x1df2('0xf')]())['then'](smsQueue[_0x1df2('0x10')]())[_0x1df2('0x8')](realtime[_0x1df2('0x11')]())['then'](mailQueue[_0x1df2('0x12')]())[_0x1df2('0x8')](realtime[_0x1df2('0x13')]())[_0x1df2('0x8')](faxQueue[_0x1df2('0x14')]())[_0x1df2('0x8')](realtime[_0x1df2('0x15')]())['then'](whatsappQueue['getWhatsappQueues']())[_0x1df2('0x8')](realtime[_0x1df2('0x16')]())[_0x1df2('0x8')](function(){return realtime;});}function main(){return server[_0x1df2('0x17')](realtime)[_0x1df2('0x8')](function(_0x505215){return initRealtime();})[_0x1df2('0x8')](function(_0x22e560){return setInterval(initRealtime,0x1388);})[_0x1df2('0x18')](function(_0x1bc63e){console[_0x1df2('0x19')](_0x1bc63e);});}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 cbf407d..cc77f9b 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x483985,_0x3bd7d7){var _0x580ad0=function(_0x5477b6){while(--_0x5477b6){_0x483985['push'](_0x483985['shift']());}};_0x580ad0(++_0x3bd7d7);}(_0xe14b,0x93));var _0xbe14=function(_0x13dc93,_0x27d2b4){_0x13dc93=_0x13dc93-0x0;var _0x139ce9=_0xe14b[_0x13dc93];return _0x139ce9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +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(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x814b,0x1a2));var _0xb814=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x814b[_0x330723];return _0x60c546;};'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 95ca1d9..2bd4e98 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 _0x6e70=['result','sendMailMessage','bluebird','jayson/promise','client','request','error','message'];(function(_0x4bc9d6,_0x2f0ee4){var _0x319d33=function(_0xa75f89){while(--_0xa75f89){_0x4bc9d6['push'](_0x4bc9d6['shift']());}};_0x319d33(++_0x2f0ee4);}(_0x6e70,0x17a));var _0x06e7=function(_0x36dde7,_0x3ac235){_0x36dde7=_0x36dde7-0x0;var _0x355be4=_0x6e70[_0x36dde7];return _0x355be4;};'use strict';var BPromise=require(_0x06e7('0x0'));var jayson=require(_0x06e7('0x1'));var client=jayson[_0x06e7('0x2')]['http']({'port':0x232b});function request(_0x33a008,_0x14af75){return new BPromise(function(_0x226acb,_0x4a3bc4){return client[_0x06e7('0x3')](_0x33a008,_0x14af75)['then'](function(_0x3ab4b1){if(_0x3ab4b1[_0x06e7('0x4')]){return _0x4a3bc4(_0x3ab4b1['error'][_0x06e7('0x5')]);}else{return _0x226acb(_0x3ab4b1[_0x06e7('0x6')]);}})['catch'](function(_0x46f83a){return _0x4a3bc4(_0x46f83a);});});}exports[_0x06e7('0x7')]=function(_0xa73802,_0x3b89a6){return request('SendMail',{'account':_0xa73802,'message':_0x3b89a6});}; \ No newline at end of file +var _0x3f7c=['bluebird','client','request','then','error','message','result','catch'];(function(_0x44d9a2,_0x1806d0){var _0x6687cf=function(_0x473679){while(--_0x473679){_0x44d9a2['push'](_0x44d9a2['shift']());}};_0x6687cf(++_0x1806d0);}(_0x3f7c,0x1e0));var _0xc3f7=function(_0xd8c91b,_0x3ad0b1){_0xd8c91b=_0xd8c91b-0x0;var _0x5dd57c=_0x3f7c[_0xd8c91b];return _0x5dd57c;};'use strict';var BPromise=require(_0xc3f7('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xc3f7('0x1')]['http']({'port':0x232b});function request(_0x4b4f4b,_0x2eaa27){return new BPromise(function(_0x3faced,_0x58e9c1){return client[_0xc3f7('0x2')](_0x4b4f4b,_0x2eaa27)[_0xc3f7('0x3')](function(_0xd38ce2){if(_0xd38ce2['error']){return _0x58e9c1(_0xd38ce2[_0xc3f7('0x4')][_0xc3f7('0x5')]);}else{return _0x3faced(_0xd38ce2[_0xc3f7('0x6')]);}})[_0xc3f7('0x7')](function(_0x52ad9a){return _0x58e9c1(_0x52ad9a);});});}exports['sendMailMessage']=function(_0xda7f76,_0x898951){return request('SendMail',{'account':_0xda7f76,'message':_0x898951});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3a9c1c4..c9b47b0 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 _0x602a=['ioredis','../../../config/environment','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','getChannelStatus','Status','toNumber','format','chatStatus','chatCurrentCapacity','mailStatus','mailCurrentCapacity','busyQueue','stringify','emit','user:save','exports','lodash','md5'];(function(_0x159818,_0x29c189){var _0x577027=function(_0x22639b){while(--_0x22639b){_0x159818['push'](_0x159818['shift']());}};_0x577027(++_0x29c189);}(_0x602a,0x1de));var _0xa602=function(_0xa14f4e,_0x5be868){_0xa14f4e=_0xa14f4e-0x0;var _0x5a6895=_0x602a[_0xa14f4e];return _0x5a6895;};'use strict';var _=require(_0xa602('0x0'));var moment=require('moment');var md5=require(_0xa602('0x1'));var Redis=require(_0xa602('0x2'));var config=require(_0xa602('0x3'));config[_0xa602('0x4')]=_['defaults'](config[_0xa602('0x4')],{'host':_0xa602('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa602('0x4')]));function Agent(_0x3777ac){this['id']=_0x3777ac['id']||0x0;this[_0xa602('0x6')]=_0x3777ac[_0xa602('0x6')]||'';this['online']=_0x3777ac[_0xa602('0x7')]||!![];this[_0xa602('0x8')]=_0x3777ac[_0xa602('0x8')]||![];this[_0xa602('0x9')]=_0x3777ac[_0xa602('0x9')]||![];this[_0xa602('0xa')]=_0x3777ac['mailPause']||![];this[_0xa602('0xb')]=_0x3777ac[_0xa602('0xb')]||![];this[_0xa602('0xc')]=_0x3777ac['smsPause']||![];this['openchannelPause']=_0x3777ac['openchannelPause']||![];this['chatStatus']=_0xa602('0xd');this[_0xa602('0xe')]=0x0;this[_0xa602('0xf')]=_0x3777ac[_0xa602('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xa602('0xd');this[_0xa602('0x10')]=0x0;this[_0xa602('0x11')]=_0x3777ac['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xa602('0x12')]=_0xa602('0xd');this[_0xa602('0x13')]=0x0;this[_0xa602('0x14')]=_0x3777ac[_0xa602('0x14')]||0x0;this[_0xa602('0x15')]=0x0;this[_0xa602('0x16')]=_0xa602('0xd');this[_0xa602('0x17')]=0x0;this[_0xa602('0x18')]=_0x3777ac[_0xa602('0x18')]||0x0;this[_0xa602('0x19')]=0x0;this[_0xa602('0x1a')]=_0xa602('0xd');this[_0xa602('0x1b')]=0x0;this['whatsappCapacity']=_0x3777ac[_0xa602('0x1c')]||0x0;this[_0xa602('0x1d')]=0x0;this[_0xa602('0x1e')]=_0xa602('0xd');this[_0xa602('0x1f')]=0x0;this[_0xa602('0x20')]=_0x3777ac[_0xa602('0x20')]||0x0;this[_0xa602('0x21')]=0x0;this[_0xa602('0x22')]=![];this['busyQueue']=undefined;this[_0xa602('0x1')]='';this[_0xa602('0x23')]();}Agent['prototype']['getChannelStatus']=function(_0x520a9f){if(this[_0x520a9f+_0xa602('0x24')]>0x0){if(this[_0x520a9f+_0xa602('0x25')]>0x0&&this[_0x520a9f+_0xa602('0x24')]>=this[_0x520a9f+_0xa602('0x25')]){return _0xa602('0x26');}else{return _0xa602('0x27');}}else{return _0xa602('0x28');}};Agent['prototype']['updateRealtime']=function(){var _0x3a9da1=[_0xa602('0x29'),_0xa602('0x2a'),_0xa602('0x2b'),_0xa602('0x2c'),_0xa602('0x2d'),_0xa602('0x2e')];for(var _0xb64b84=0x0;_0xb64b84<_0x3a9da1['length'];_0xb64b84+=0x1){var _0x4ba62d=this[_0xa602('0x2f')](_0x3a9da1[_0xb64b84]);if(this[_0x3a9da1[_0xb64b84]+_0xa602('0x30')]!==_0x4ba62d){this[_0x3a9da1[_0xb64b84]+'StatusTime']=_[_0xa602('0x31')](moment()[_0xa602('0x32')]('x'));}this[_0x3a9da1[_0xb64b84]+_0xa602('0x30')]=_0x4ba62d;}var _0x13f3eb={'id':this['id'],'name':this[_0xa602('0x6')],'online':this[_0xa602('0x7')],'voicePause':this[_0xa602('0x8')],'chatPause':this[_0xa602('0x9')],'mailPause':this[_0xa602('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xa602('0x33')],'chatStatusTime':this[_0xa602('0xe')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xa602('0x34')],'mailStatus':this[_0xa602('0x35')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xa602('0x11')],'mailCurrentCapacity':this[_0xa602('0x36')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xa602('0x14')],'faxCurrentCapacity':this[_0xa602('0x15')],'smsStatus':this[_0xa602('0x16')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa602('0x18')],'smsCurrentCapacity':this[_0xa602('0x19')],'whatsappStatus':this[_0xa602('0x1a')],'whatsappStatusTime':this[_0xa602('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xa602('0x1e')],'openchannelStatusTime':this[_0xa602('0x1f')],'openchannelCapacity':this[_0xa602('0x20')],'openchannelCurrentCapacity':this[_0xa602('0x21')],'busy':this[_0xa602('0x22')],'busyQueue':this[_0xa602('0x37')]};var _0x54aa60=md5(JSON[_0xa602('0x38')](_0x13f3eb));if(this[_0xa602('0x1')]!==_0x54aa60){this['md5']=_0x54aa60;io[_0xa602('0x39')](_0xa602('0x3a'),_0x13f3eb);}};module[_0xa602('0x3b')]=Agent; \ No newline at end of file +var _0x15da=['faxCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','prototype','mail','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','busyQueue','stringify','user:save','exports','moment','md5','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailCapacity','faxStatus'];(function(_0x3c45de,_0x1f0979){var _0x270350=function(_0x45f304){while(--_0x45f304){_0x3c45de['push'](_0x3c45de['shift']());}};_0x270350(++_0x1f0979);}(_0x15da,0x98));var _0xa15d=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x15da[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require('lodash');var moment=require(_0xa15d('0x0'));var md5=require(_0xa15d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa15d('0x2')]=_['defaults'](config['redis'],{'host':_0xa15d('0x3'),'port':0x18eb});var io=require(_0xa15d('0x4'))(new Redis(config[_0xa15d('0x2')]));function Agent(_0xc0e67f){this['id']=_0xc0e67f['id']||0x0;this[_0xa15d('0x5')]=_0xc0e67f[_0xa15d('0x5')]||'';this[_0xa15d('0x6')]=_0xc0e67f['online']||!![];this[_0xa15d('0x7')]=_0xc0e67f[_0xa15d('0x7')]||![];this[_0xa15d('0x8')]=_0xc0e67f[_0xa15d('0x8')]||![];this[_0xa15d('0x9')]=_0xc0e67f[_0xa15d('0x9')]||![];this[_0xa15d('0xa')]=_0xc0e67f[_0xa15d('0xa')]||![];this[_0xa15d('0xb')]=_0xc0e67f[_0xa15d('0xb')]||![];this['openchannelPause']=_0xc0e67f[_0xa15d('0xc')]||![];this[_0xa15d('0xd')]=_0xa15d('0xe');this[_0xa15d('0xf')]=0x0;this[_0xa15d('0x10')]=_0xc0e67f[_0xa15d('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0xa15d('0xe');this['mailStatusTime']=0x0;this[_0xa15d('0x11')]=_0xc0e67f['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xa15d('0x12')]=_0xa15d('0xe');this['faxStatusTime']=0x0;this[_0xa15d('0x13')]=_0xc0e67f['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xa15d('0xe');this['smsStatusTime']=0x0;this[_0xa15d('0x14')]=_0xc0e67f[_0xa15d('0x14')]||0x0;this[_0xa15d('0x15')]=0x0;this[_0xa15d('0x16')]=_0xa15d('0xe');this[_0xa15d('0x17')]=0x0;this[_0xa15d('0x18')]=_0xc0e67f[_0xa15d('0x18')]||0x0;this[_0xa15d('0x19')]=0x0;this['openchannelStatus']=_0xa15d('0xe');this[_0xa15d('0x1a')]=0x0;this[_0xa15d('0x1b')]=_0xc0e67f['openchannelCapacity']||0x0;this[_0xa15d('0x1c')]=0x0;this[_0xa15d('0x1d')]=![];this['busyQueue']=undefined;this[_0xa15d('0x1')]='';this[_0xa15d('0x1e')]();}Agent['prototype'][_0xa15d('0x1f')]=function(_0x507643){if(this[_0x507643+_0xa15d('0x20')]>0x0){if(this[_0x507643+_0xa15d('0x21')]>0x0&&this[_0x507643+_0xa15d('0x20')]>=this[_0x507643+'Capacity']){return _0xa15d('0x22');}else{return'working';}}else{return _0xa15d('0x23');}};Agent[_0xa15d('0x24')][_0xa15d('0x1e')]=function(){var _0x1bf324=[_0xa15d('0x25'),'chat',_0xa15d('0x26'),'fax',_0xa15d('0x27'),_0xa15d('0x28')];for(var _0x2cfe62=0x0;_0x2cfe62<_0x1bf324[_0xa15d('0x29')];_0x2cfe62+=0x1){var _0x39047d=this['getChannelStatus'](_0x1bf324[_0x2cfe62]);if(this[_0x1bf324[_0x2cfe62]+_0xa15d('0x2a')]!==_0x39047d){this[_0x1bf324[_0x2cfe62]+_0xa15d('0x2b')]=_[_0xa15d('0x2c')](moment()[_0xa15d('0x2d')]('x'));}this[_0x1bf324[_0x2cfe62]+_0xa15d('0x2a')]=_0x39047d;}var _0x5ed99e={'id':this['id'],'name':this[_0xa15d('0x5')],'online':this[_0xa15d('0x6')],'voicePause':this[_0xa15d('0x7')],'chatPause':this[_0xa15d('0x8')],'mailPause':this[_0xa15d('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0xa15d('0xa')],'openchannelPause':this[_0xa15d('0xc')],'chatStatus':this[_0xa15d('0xd')],'chatStatusTime':this[_0xa15d('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xa15d('0x2e')],'mailStatus':this[_0xa15d('0x2f')],'mailStatusTime':this[_0xa15d('0x30')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xa15d('0x31')],'faxStatus':this[_0xa15d('0x12')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xa15d('0x13')],'faxCurrentCapacity':this[_0xa15d('0x32')],'smsStatus':this[_0xa15d('0x33')],'smsStatusTime':this[_0xa15d('0x34')],'smsCapacity':this[_0xa15d('0x14')],'smsCurrentCapacity':this[_0xa15d('0x15')],'whatsappStatus':this[_0xa15d('0x16')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xa15d('0x18')],'whatsappCurrentCapacity':this[_0xa15d('0x19')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa15d('0x1a')],'openchannelCapacity':this[_0xa15d('0x1b')],'openchannelCurrentCapacity':this[_0xa15d('0x1c')],'busy':this[_0xa15d('0x1d')],'busyQueue':this[_0xa15d('0x35')]};var _0x17225c=md5(JSON[_0xa15d('0x36')](_0x5ed99e));if(this[_0xa15d('0x1')]!==_0x17225c){this[_0xa15d('0x1')]=_0x17225c;io['emit'](_0xa15d('0x37'),_0x5ed99e);}};module[_0xa15d('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fc83e36..37954ae 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 _0xe721=['strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','Agents','online','available','format','chat:queue:%s','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x59486a,_0x44a427){var _0x48e184=function(_0x2b40dc){while(--_0x2b40dc){_0x59486a['push'](_0x59486a['shift']());}};_0x48e184(++_0x44a427);}(_0xe721,0xfb));var _0x1e72=function(_0x415949,_0x414e4e){_0x415949=_0x415949-0x0;var _0x3a7220=_0xe721[_0x415949];return _0x3a7220;};'use strict';var _=require(_0x1e72('0x0'));var md5=require(_0x1e72('0x1'));var util=require(_0x1e72('0x2'));var Redis=require(_0x1e72('0x3'));var config=require('../../../config/environment');config[_0x1e72('0x4')]=_[_0x1e72('0x5')](config[_0x1e72('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1e72('0x6'))(new Redis(config[_0x1e72('0x4')]));function ChatQueue(_0x58fa96){this['id']=_0x58fa96['id']||0x0;this['name']=_0x58fa96[_0x1e72('0x7')]||'';this[_0x1e72('0x8')]=_0x58fa96[_0x1e72('0x8')]||0xa;this[_0x1e72('0x9')]=_0x58fa96[_0x1e72('0x9')]||_0x1e72('0xa');this['Agents']=_0x58fa96['Agents'];this[_0x1e72('0xb')]={};this[_0x1e72('0xc')]=0x0;this[_0x1e72('0x1')]='';this[_0x1e72('0xd')]();this[_0x1e72('0xe')]();}ChatQueue[_0x1e72('0xf')][_0x1e72('0xd')]=function(){var _0x19bc85=this['mapAgentsId'][_0x1e72('0x10')];this[_0x1e72('0xb')]=_['map'](this['Agents'],'id');this[_0x1e72('0xb')]['_rr']=_0x19bc85;};ChatQueue['prototype'][_0x1e72('0xe')]=function(){this[_0x1e72('0x11')]=0x0;this[_0x1e72('0x12')]=0x0;for(var _0x10f4b3=0x0;_0x10f4b3=0x0?this[_0x1e72('0x16')]:0x0;var _0x47343a={'id':this['id'],'available':this[_0x1e72('0x16')],'loggedIn':this[_0x1e72('0x11')],'name':this[_0x1e72('0x7')],'paused':this[_0x1e72('0x12')],'waiting':this[_0x1e72('0xc')]};var _0x415f16=md5(JSON['stringify'](_0x47343a));if(this[_0x1e72('0x1')]!==_0x415f16){this[_0x1e72('0x1')]=_0x415f16;io['to'](util[_0x1e72('0x17')](_0x1e72('0x18'),_0x47343a[_0x1e72('0x7')]))['emit']('chat_queue:save',_0x47343a);}};module[_0x1e72('0x19')]=ChatQueue; \ No newline at end of file +var _0x28de=['format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused','length','chatPause','available','stringify'];(function(_0x53e1ee,_0x22ce54){var _0x333bfe=function(_0x28faa9){while(--_0x28faa9){_0x53e1ee['push'](_0x53e1ee['shift']());}};_0x333bfe(++_0x22ce54);}(_0x28de,0xf4));var _0xe28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28de[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe28d('0x0'));var md5=require(_0xe28d('0x1'));var util=require(_0xe28d('0x2'));var Redis=require(_0xe28d('0x3'));var config=require(_0xe28d('0x4'));config['redis']=_[_0xe28d('0x5')](config[_0xe28d('0x6')],{'host':_0xe28d('0x7'),'port':0x18eb});var io=require(_0xe28d('0x8'))(new Redis(config[_0xe28d('0x6')]));function ChatQueue(_0x55f9d9){this['id']=_0x55f9d9['id']||0x0;this[_0xe28d('0x9')]=_0x55f9d9[_0xe28d('0x9')]||'';this[_0xe28d('0xa')]=_0x55f9d9['timeout']||0xa;this[_0xe28d('0xb')]=_0x55f9d9['strategy']||_0xe28d('0xc');this[_0xe28d('0xd')]=_0x55f9d9[_0xe28d('0xd')];this[_0xe28d('0xe')]={};this[_0xe28d('0xf')]=0x0;this[_0xe28d('0x1')]='';this[_0xe28d('0x10')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x884459=this[_0xe28d('0xe')][_0xe28d('0x11')];this['mapAgentsId']=_['map'](this[_0xe28d('0xd')],'id');this[_0xe28d('0xe')]['_rr']=_0x884459;};ChatQueue[_0xe28d('0x12')][_0xe28d('0x13')]=function(){this[_0xe28d('0x14')]=0x0;this[_0xe28d('0x15')]=0x0;for(var _0x3a0a20=0x0;_0x3a0a20=0x0?this[_0xe28d('0x18')]:0x0;var _0x5cb760={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe28d('0x14')],'name':this['name'],'paused':this[_0xe28d('0x15')],'waiting':this['waiting']};var _0x11acea=md5(JSON[_0xe28d('0x19')](_0x5cb760));if(this['md5']!==_0x11acea){this[_0xe28d('0x1')]=_0x11acea;io['to'](util[_0xe28d('0x1a')](_0xe28d('0x1b'),_0x5cb760[_0xe28d('0x9')]))['emit'](_0xe28d('0x1c'),_0x5cb760);}};module[_0xe28d('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 91bea47..ec28573 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 _0xf9d7=['updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','faxPause','available','waiting','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x11a372,_0x26d3da){var _0x2943be=function(_0x1f3040){while(--_0x1f3040){_0x11a372['push'](_0x11a372['shift']());}};_0x2943be(++_0x26d3da);}(_0xf9d7,0x132));var _0x7f9d=function(_0x2b7248,_0x17b24e){_0x2b7248=_0x2b7248-0x0;var _0x418838=_0xf9d7[_0x2b7248];return _0x418838;};'use strict';var _=require(_0x7f9d('0x0'));var md5=require(_0x7f9d('0x1'));var util=require(_0x7f9d('0x2'));var Redis=require(_0x7f9d('0x3'));var config=require('../../../config/environment');config[_0x7f9d('0x4')]=_[_0x7f9d('0x5')](config[_0x7f9d('0x4')],{'host':_0x7f9d('0x6'),'port':0x18eb});var io=require(_0x7f9d('0x7'))(new Redis(config[_0x7f9d('0x4')]));function FaxQueue(_0x104d7d){this['id']=_0x104d7d['id']||0x0;this['name']=_0x104d7d[_0x7f9d('0x8')]||'';this[_0x7f9d('0x9')]=_0x104d7d[_0x7f9d('0x9')]||0xa;this['strategy']=_0x104d7d[_0x7f9d('0xa')]||'beepall';this[_0x7f9d('0xb')]=_0x104d7d[_0x7f9d('0xb')];this[_0x7f9d('0xc')]={};this['waiting']=0x0;this[_0x7f9d('0x1')]='';this['updateRouting']();this[_0x7f9d('0xd')]();}FaxQueue[_0x7f9d('0xe')][_0x7f9d('0xf')]=function(){var _0x2d89c6=this[_0x7f9d('0xc')][_0x7f9d('0x10')];this[_0x7f9d('0xc')]=_[_0x7f9d('0x11')](this['Agents'],'id');this[_0x7f9d('0xc')][_0x7f9d('0x10')]=_0x2d89c6;};FaxQueue['prototype'][_0x7f9d('0xd')]=function(){this[_0x7f9d('0x12')]=0x0;this[_0x7f9d('0x13')]=0x0;for(var _0x230891=0x0;_0x230891=0x0?this[_0x7f9d('0x16')]:0x0;var _0x372c88={'id':this['id'],'available':this[_0x7f9d('0x16')],'loggedIn':this[_0x7f9d('0x12')],'name':this['name'],'paused':this[_0x7f9d('0x13')],'waiting':this[_0x7f9d('0x17')]};var _0x2632b3=md5(JSON[_0x7f9d('0x18')](_0x372c88));if(this['md5']!==_0x2632b3){this['md5']=_0x2632b3;io['to'](util[_0x7f9d('0x19')](_0x7f9d('0x1a'),_0x372c88[_0x7f9d('0x8')]))['emit'](_0x7f9d('0x1b'),_0x372c88);}};module[_0x7f9d('0x1c')]=FaxQueue; \ No newline at end of file +var _0x1d49=['length','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused'];(function(_0x4a1d6e,_0x50fdca){var _0x45fac8=function(_0x2e9e97){while(--_0x2e9e97){_0x4a1d6e['push'](_0x4a1d6e['shift']());}};_0x45fac8(++_0x50fdca);}(_0x1d49,0x19e));var _0x91d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d4('0x0'));var md5=require(_0x91d4('0x1'));var util=require(_0x91d4('0x2'));var Redis=require(_0x91d4('0x3'));var config=require(_0x91d4('0x4'));config[_0x91d4('0x5')]=_[_0x91d4('0x6')](config[_0x91d4('0x5')],{'host':_0x91d4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x91d4('0x5')]));function FaxQueue(_0x2f190f){this['id']=_0x2f190f['id']||0x0;this[_0x91d4('0x8')]=_0x2f190f[_0x91d4('0x8')]||'';this[_0x91d4('0x9')]=_0x2f190f['timeout']||0xa;this[_0x91d4('0xa')]=_0x2f190f[_0x91d4('0xa')]||_0x91d4('0xb');this['Agents']=_0x2f190f[_0x91d4('0xc')];this[_0x91d4('0xd')]={};this[_0x91d4('0xe')]=0x0;this[_0x91d4('0x1')]='';this[_0x91d4('0xf')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x4d222b=this[_0x91d4('0xd')]['_rr'];this[_0x91d4('0xd')]=_['map'](this[_0x91d4('0xc')],'id');this[_0x91d4('0xd')][_0x91d4('0x10')]=_0x4d222b;};FaxQueue[_0x91d4('0x11')][_0x91d4('0x12')]=function(){this[_0x91d4('0x13')]=0x0;this[_0x91d4('0x14')]=0x0;for(var _0x1546d5=0x0;_0x1546d5=0x0?this['available']:0x0;var _0x426f9a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x91d4('0x13')],'name':this[_0x91d4('0x8')],'paused':this[_0x91d4('0x14')],'waiting':this[_0x91d4('0xe')]};var _0x4cc71e=md5(JSON[_0x91d4('0x18')](_0x426f9a));if(this[_0x91d4('0x1')]!==_0x4cc71e){this[_0x91d4('0x1')]=_0x4cc71e;io['to'](util[_0x91d4('0x19')](_0x91d4('0x1a'),_0x426f9a['name']))[_0x91d4('0x1b')](_0x91d4('0x1c'),_0x426f9a);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e88e10e..3173a94 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 _0x4de5=['exports','name','Intervals'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x4de5,0xd9));var _0x54de=function(_0x134353,_0x2911b2){_0x134353=_0x134353-0x0;var _0x2ead3c=_0x4de5[_0x134353];return _0x2ead3c;};'use strict';function Interval(_0x728b8a){this['id']=_0x728b8a['id']||0x0;this[_0x54de('0x0')]=_0x728b8a[_0x54de('0x0')]||'';this[_0x54de('0x1')]=_0x728b8a[_0x54de('0x1')]||{};}module[_0x54de('0x2')]=Interval; \ No newline at end of file +var _0xa440=['name','Intervals'];(function(_0x37ab08,_0x56ec1c){var _0x34f031=function(_0x4f3c06){while(--_0x4f3c06){_0x37ab08['push'](_0x37ab08['shift']());}};_0x34f031(++_0x56ec1c);}(_0xa440,0x160));var _0x0a44=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0xa440[_0x588011];return _0x3b3773;};'use strict';function Interval(_0x456710){this['id']=_0x456710['id']||0x0;this['name']=_0x456710[_0x0a44('0x0')]||'';this[_0x0a44('0x1')]=_0x456710[_0x0a44('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index fc28041..918e6d4 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 _0x794e=['beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x794e,0x93));var _0xe794=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x794e[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var md5=require(_0xe794('0x0'));var util=require(_0xe794('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xe794('0x2')](config[_0xe794('0x3')],{'host':_0xe794('0x4'),'port':0x18eb});var io=require(_0xe794('0x5'))(new Redis(config['redis']));function MailQueue(_0x39109d){this['id']=_0x39109d['id']||0x0;this[_0xe794('0x6')]=_0x39109d[_0xe794('0x6')]||'';this[_0xe794('0x7')]=_0x39109d[_0xe794('0x7')]||0xa;this[_0xe794('0x8')]=_0x39109d[_0xe794('0x8')]||_0xe794('0x9');this['Agents']=_0x39109d[_0xe794('0xa')];this['mapAgentsId']={};this[_0xe794('0xb')]=0x0;this[_0xe794('0x0')]='';this[_0xe794('0xc')]();this['updateRealtime']();}MailQueue['prototype'][_0xe794('0xc')]=function(){var _0x4c917e=this[_0xe794('0xd')]['_rr'];this[_0xe794('0xd')]=_['map'](this[_0xe794('0xa')],'id');this[_0xe794('0xd')][_0xe794('0xe')]=_0x4c917e;};MailQueue['prototype']['updateRealtime']=function(){this[_0xe794('0xf')]=0x0;this[_0xe794('0x10')]=0x0;for(var _0x4392c4=0x0;_0x4392c4=0x0?this[_0xe794('0x14')]:0x0;var _0x4ad73a={'id':this['id'],'available':this[_0xe794('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe794('0x10')],'waiting':this[_0xe794('0xb')]};var _0x40bbfa=md5(JSON[_0xe794('0x15')](_0x4ad73a));if(this[_0xe794('0x0')]!==_0x40bbfa){this[_0xe794('0x0')]=_0x40bbfa;io['to'](util['format'](_0xe794('0x16'),_0x4ad73a['name']))[_0xe794('0x17')](_0xe794('0x18'),_0x4ad73a);}};module[_0xe794('0x19')]=MailQueue; \ No newline at end of file +var _0x2ef8=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x2ef8,0x1c7));var _0x82ef=function(_0x30d81d,_0x4ec528){_0x30d81d=_0x30d81d-0x0;var _0x167c2c=_0x2ef8[_0x30d81d];return _0x167c2c;};'use strict';var _=require(_0x82ef('0x0'));var md5=require(_0x82ef('0x1'));var util=require(_0x82ef('0x2'));var Redis=require(_0x82ef('0x3'));var config=require(_0x82ef('0x4'));config['redis']=_[_0x82ef('0x5')](config[_0x82ef('0x6')],{'host':_0x82ef('0x7'),'port':0x18eb});var io=require(_0x82ef('0x8'))(new Redis(config[_0x82ef('0x6')]));function MailQueue(_0x43dded){this['id']=_0x43dded['id']||0x0;this[_0x82ef('0x9')]=_0x43dded[_0x82ef('0x9')]||'';this[_0x82ef('0xa')]=_0x43dded[_0x82ef('0xa')]||0xa;this['strategy']=_0x43dded[_0x82ef('0xb')]||_0x82ef('0xc');this[_0x82ef('0xd')]=_0x43dded[_0x82ef('0xd')];this[_0x82ef('0xe')]={};this['waiting']=0x0;this[_0x82ef('0x1')]='';this[_0x82ef('0xf')]();this[_0x82ef('0x10')]();}MailQueue[_0x82ef('0x11')]['updateRouting']=function(){var _0x34ce15=this['mapAgentsId']['_rr'];this[_0x82ef('0xe')]=_['map'](this[_0x82ef('0xd')],'id');this[_0x82ef('0xe')]['_rr']=_0x34ce15;};MailQueue['prototype'][_0x82ef('0x10')]=function(){this[_0x82ef('0x12')]=0x0;this['paused']=0x0;for(var _0x5b6051=0x0;_0x5b6051=0x0?this['available']:0x0;var _0x151620={'id':this['id'],'available':this[_0x82ef('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x82ef('0x16')],'waiting':this[_0x82ef('0x18')]};var _0x41555c=md5(JSON[_0x82ef('0x19')](_0x151620));if(this[_0x82ef('0x1')]!==_0x41555c){this[_0x82ef('0x1')]=_0x41555c;io['to'](util[_0x82ef('0x1a')](_0x82ef('0x1b'),_0x151620[_0x82ef('0x9')]))[_0x82ef('0x1c')](_0x82ef('0x1d'),_0x151620);}};module[_0x82ef('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 781a74a..d73043e 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(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x2ef3,0xba));var _0x32ef=function(_0x578106,_0x36e2a0){_0x578106=_0x578106-0x0;var _0x6ef762=_0x2ef3[_0x578106];return _0x6ef762;};'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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e0550d4..435d928 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 _0xbe31=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','stringify','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x2a95bb,_0x2e4aab){var _0xcb72ba=function(_0x42f79f){while(--_0x42f79f){_0x2a95bb['push'](_0x2a95bb['shift']());}};_0xcb72ba(++_0x2e4aab);}(_0xbe31,0x83));var _0x1be3=function(_0xfa99ba,_0x4d6ba2){_0xfa99ba=_0xfa99ba-0x0;var _0x3f2c62=_0xbe31[_0xfa99ba];return _0x3f2c62;};'use strict';var _=require('lodash');var md5=require(_0x1be3('0x0'));var util=require(_0x1be3('0x1'));var Redis=require(_0x1be3('0x2'));var config=require(_0x1be3('0x3'));config[_0x1be3('0x4')]=_[_0x1be3('0x5')](config[_0x1be3('0x4')],{'host':_0x1be3('0x6'),'port':0x18eb});var io=require(_0x1be3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x2d4d97){this['id']=_0x2d4d97['id']||0x0;this['name']=_0x2d4d97[_0x1be3('0x8')]||'';this[_0x1be3('0x9')]=_0x2d4d97[_0x1be3('0x9')]||0xa;this[_0x1be3('0xa')]=_0x2d4d97[_0x1be3('0xa')]||_0x1be3('0xb');this[_0x1be3('0xc')]=_0x2d4d97[_0x1be3('0xc')];this[_0x1be3('0xd')]={};this[_0x1be3('0xe')]=0x0;this['md5']='';this[_0x1be3('0xf')]();this[_0x1be3('0x10')]();}SmsQueue[_0x1be3('0x11')][_0x1be3('0xf')]=function(){var _0x1f4ea8=this[_0x1be3('0xd')][_0x1be3('0x12')];this[_0x1be3('0xd')]=_[_0x1be3('0x13')](this['Agents'],'id');this[_0x1be3('0xd')]['_rr']=_0x1f4ea8;};SmsQueue[_0x1be3('0x11')][_0x1be3('0x10')]=function(){this['loggedIn']=0x0;this[_0x1be3('0x14')]=0x0;for(var _0x573684=0x0;_0x573684=0x0?this[_0x1be3('0x18')]:0x0;var _0xaa1d7b={'id':this['id'],'available':this[_0x1be3('0x18')],'loggedIn':this[_0x1be3('0x17')],'name':this[_0x1be3('0x8')],'paused':this[_0x1be3('0x14')],'waiting':this[_0x1be3('0xe')]};var _0x745447=md5(JSON[_0x1be3('0x19')](_0xaa1d7b));if(this[_0x1be3('0x0')]!==_0x745447){this[_0x1be3('0x0')]=_0x745447;io['to'](util['format']('sms:queue:%s',_0xaa1d7b[_0x1be3('0x8')]))['emit'](_0x1be3('0x1a'),_0xaa1d7b);}};module[_0x1be3('0x1b')]=SmsQueue; \ No newline at end of file +var _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0x22d06b,_0x378973){var _0x2280f5=function(_0x36b33d){while(--_0x36b33d){_0x22d06b['push'](_0x22d06b['shift']());}};_0x2280f5(++_0x378973);}(_0xfa2f,0xe8));var _0xffa2=function(_0x220542,_0x2bd4e2){_0x220542=_0x220542-0x0;var _0x176ab6=_0xfa2f[_0x220542];return _0x176ab6;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e2fab7e..094a78d 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 _0x5d5d=['available','paused','stringify','format','emit','whatsapp_queue:save','lodash','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','map','_rr','updateRealtime','loggedIn','length','online'];(function(_0x1568d8,_0x348ecf){var _0x2adbc3=function(_0x3ea328){while(--_0x3ea328){_0x1568d8['push'](_0x1568d8['shift']());}};_0x2adbc3(++_0x348ecf);}(_0x5d5d,0x158));var _0xd5d5=function(_0x1edc60,_0x5bad20){_0x1edc60=_0x1edc60-0x0;var _0x5502c9=_0x5d5d[_0x1edc60];return _0x5502c9;};'use strict';var _=require(_0xd5d5('0x0'));var md5=require('md5');var util=require(_0xd5d5('0x1'));var Redis=require('ioredis');var config=require(_0xd5d5('0x2'));config[_0xd5d5('0x3')]=_['defaults'](config[_0xd5d5('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xd5d5('0x4'))(new Redis(config[_0xd5d5('0x3')]));function WhatsappQueue(_0x1ad122){this['id']=_0x1ad122['id']||0x0;this[_0xd5d5('0x5')]=_0x1ad122[_0xd5d5('0x5')]||'';this[_0xd5d5('0x6')]=_0x1ad122[_0xd5d5('0x6')]||0xa;this[_0xd5d5('0x7')]=_0x1ad122[_0xd5d5('0x7')]||_0xd5d5('0x8');this[_0xd5d5('0x9')]=_0x1ad122[_0xd5d5('0x9')];this[_0xd5d5('0xa')]={};this[_0xd5d5('0xb')]=0x0;this[_0xd5d5('0xc')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0xd5d5('0xd')]['updateRouting']=function(){var _0x13c35a=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xd5d5('0xe')](this['Agents'],'id');this[_0xd5d5('0xa')][_0xd5d5('0xf')]=_0x13c35a;};WhatsappQueue[_0xd5d5('0xd')][_0xd5d5('0x10')]=function(){this[_0xd5d5('0x11')]=0x0;this['paused']=0x0;for(var _0x1862e=0x0;_0x1862e=0x0?this['available']:0x0;var _0x2e1ac6={'id':this['id'],'available':this[_0xd5d5('0x14')],'loggedIn':this[_0xd5d5('0x11')],'name':this[_0xd5d5('0x5')],'paused':this[_0xd5d5('0x15')],'waiting':this[_0xd5d5('0xb')]};var _0x4a9652=md5(JSON[_0xd5d5('0x16')](_0x2e1ac6));if(this[_0xd5d5('0xc')]!==_0x4a9652){this['md5']=_0x4a9652;io['to'](util[_0xd5d5('0x17')]('whatsapp:queue:%s',_0x2e1ac6[_0xd5d5('0x5')]))[_0xd5d5('0x18')](_0xd5d5('0x19'),_0x2e1ac6);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xc10d=['md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','length','online','whatsappPause','paused','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x1c9075,_0xb4e64){var _0x148f6b=function(_0x528c51){while(--_0x528c51){_0x1c9075['push'](_0x1c9075['shift']());}};_0x148f6b(++_0xb4e64);}(_0xc10d,0xa8));var _0xdc10=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xc10d[_0x412e27];return _0x53da42;};'use strict';var _=require('lodash');var md5=require(_0xdc10('0x0'));var util=require(_0xdc10('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xdc10('0x2')]=_[_0xdc10('0x3')](config['redis'],{'host':_0xdc10('0x4'),'port':0x18eb});var io=require(_0xdc10('0x5'))(new Redis(config[_0xdc10('0x2')]));function WhatsappQueue(_0x3f5644){this['id']=_0x3f5644['id']||0x0;this[_0xdc10('0x6')]=_0x3f5644[_0xdc10('0x6')]||'';this[_0xdc10('0x7')]=_0x3f5644[_0xdc10('0x7')]||0xa;this[_0xdc10('0x8')]=_0x3f5644['strategy']||_0xdc10('0x9');this[_0xdc10('0xa')]=_0x3f5644[_0xdc10('0xa')];this[_0xdc10('0xb')]={};this[_0xdc10('0xc')]=0x0;this['md5']='';this[_0xdc10('0xd')]();this[_0xdc10('0xe')]();}WhatsappQueue['prototype'][_0xdc10('0xd')]=function(){var _0x597738=this[_0xdc10('0xb')][_0xdc10('0xf')];this['mapAgentsId']=_['map'](this[_0xdc10('0xa')],'id');this[_0xdc10('0xb')][_0xdc10('0xf')]=_0x597738;};WhatsappQueue[_0xdc10('0x10')][_0xdc10('0xe')]=function(){this[_0xdc10('0x11')]=0x0;this['paused']=0x0;for(var _0x5e0181=0x0;_0x5e0181=0x0?this[_0xdc10('0x16')]:0x0;var _0x256a58={'id':this['id'],'available':this[_0xdc10('0x16')],'loggedIn':this[_0xdc10('0x11')],'name':this[_0xdc10('0x6')],'paused':this[_0xdc10('0x15')],'waiting':this[_0xdc10('0xc')]};var _0x1d489d=md5(JSON['stringify'](_0x256a58));if(this['md5']!==_0x1d489d){this[_0xdc10('0x0')]=_0x1d489d;io['to'](util[_0xdc10('0x17')](_0xdc10('0x18'),_0x256a58[_0xdc10('0x6')]))[_0xdc10('0x19')](_0xdc10('0x1a'),_0x256a58);}};module[_0xdc10('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b978420..f052821 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_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 db10195..3d62b71 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 _0x2ffd=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x2ffd,0x123));var _0xd2ff=function(_0x493f77,_0x570eba){_0x493f77=_0x493f77-0x0;var _0x5e7f1d=_0x2ffd[_0x493f77];return _0x5e7f1d;};'use strict';var client=require(_0xd2ff('0x0'));exports['update']=function(_0x2f5c2e,_0x27f386){return client[_0xd2ff('0x1')]('UpdateChatInteraction',{'body':_0x27f386,'options':{'where':{'id':_0x2f5c2e}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x17f062,_0x1268cb){return client[_0xd2ff('0x1')](_0xd2ff('0x2'),{'body':_0x1268cb,'options':{'where':{'id':_0x17f062}},'log':_0xd2ff('0x3')});}; \ No newline at end of file +var _0xdab6=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction'];(function(_0x345311,_0x12f92e){var _0x5b5496=function(_0x3a704c){while(--_0x3a704c){_0x345311['push'](_0x345311['shift']());}};_0x5b5496(++_0x12f92e);}(_0xdab6,0x171));var _0x6dab=function(_0x58e4e6,_0x170875){_0x58e4e6=_0x58e4e6-0x0;var _0x1deb4d=_0xdab6[_0x58e4e6];return _0x1deb4d;};'use strict';var client=require('../client');exports[_0x6dab('0x0')]=function(_0x55806b,_0x2a33f4){return client['Request'](_0x6dab('0x1'),{'body':_0x2a33f4,'options':{'where':{'id':_0x55806b}},'log':_0x6dab('0x2')});};exports[_0x6dab('0x3')]=function(_0x29912e,_0x474822){return client[_0x6dab('0x4')](_0x6dab('0x5'),{'body':_0x474822,'options':{'where':{'id':_0x29912e}},'log':_0x6dab('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1a66c1d..6a0d5ec 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 _0xb502=['Request','createChatMessage','../client','create'];(function(_0x1167d5,_0x4d2d44){var _0x3de7fa=function(_0x4a98de){while(--_0x4a98de){_0x1167d5['push'](_0x1167d5['shift']());}};_0x3de7fa(++_0x4d2d44);}(_0xb502,0x112));var _0x2b50=function(_0x4b2423,_0x45f261){_0x4b2423=_0x4b2423-0x0;var _0x4944b0=_0xb502[_0x4b2423];return _0x4944b0;};'use strict';var client=require(_0x2b50('0x0'));exports[_0x2b50('0x1')]=function(_0xc6ddc0){return client[_0x2b50('0x2')]('CreateChatMessage',{'body':_0xc6ddc0,'log':_0x2b50('0x3')});}; \ No newline at end of file +var _0x1e2d=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x34abcc,_0x39da95){var _0x58a97d=function(_0x3a7edc){while(--_0x3a7edc){_0x34abcc['push'](_0x34abcc['shift']());}};_0x58a97d(++_0x39da95);}(_0x1e2d,0x128));var _0xd1e2=function(_0x4d3154,_0x54f7d3){_0x4d3154=_0x4d3154-0x0;var _0x191f60=_0x1e2d[_0x4d3154];return _0x191f60;};'use strict';var client=require(_0xd1e2('0x0'));exports[_0xd1e2('0x1')]=function(_0x3c65ba){return client[_0xd1e2('0x2')](_0xd1e2('0x3'),{'body':_0x3c65ba,'log':_0xd1e2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 45f8b76..40a0541 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 _0x74f3=['timeout','strategy','User','online','../client','getChatQueues','Request','name'];(function(_0x2573e3,_0x50a36d){var _0x19e6d3=function(_0x39e010){while(--_0x39e010){_0x2573e3['push'](_0x2573e3['shift']());}};_0x19e6d3(++_0x50a36d);}(_0x74f3,0x164));var _0x374f=function(_0x272dc6,_0x56e7be){_0x272dc6=_0x272dc6-0x0;var _0x3102fc=_0x74f3[_0x272dc6];return _0x3102fc;};'use strict';var client=require(_0x374f('0x0'));exports[_0x374f('0x1')]=function(){return function(){return client[_0x374f('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x374f('0x3'),_0x374f('0x4'),_0x374f('0x5')],'include':[{'model':_0x374f('0x6'),'as':'Agents','attributes':['id',_0x374f('0x3'),_0x374f('0x7'),'chatPause']}]},'log':_0x374f('0x1')});};}; \ No newline at end of file +var _0x097c=['name','timeout','strategy','User','chatPause','../client','getChatQueues','Request'];(function(_0x13c9d6,_0x587717){var _0x50481=function(_0x356df9){while(--_0x356df9){_0x13c9d6['push'](_0x13c9d6['shift']());}};_0x50481(++_0x587717);}(_0x097c,0x1d5));var _0xc097=function(_0x3f688e,_0xe3fc1c){_0x3f688e=_0x3f688e-0x0;var _0x156ff1=_0x097c[_0x3f688e];return _0x156ff1;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(){return function(){return client[_0xc097('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc097('0x3'),_0xc097('0x4'),_0xc097('0x5')],'include':[{'model':_0xc097('0x6'),'as':'Agents','attributes':['id',_0xc097('0x3'),'online',_0xc097('0x7')]}]},'log':_0xc097('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5ab6c02..62db30c 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 _0xf296=['Request','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xf296,0x94));var _0x6f29=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0xf296[_0x5e6d65];return _0x5e1f75;};'use strict';var client=require(_0x6f29('0x0'));exports[_0x6f29('0x1')]=function(_0x4e5239){return client[_0x6f29('0x2')]('CreateChatQueueReport',{'body':_0x4e5239,'log':'CreateChatQueueReport'});};exports[_0x6f29('0x3')]=function(_0x3cdbee,_0x4cdc12){return client[_0x6f29('0x2')](_0x6f29('0x4'),{'body':_0x4cdc12,'options':{'where':{'uniqueid':_0x3cdbee},'order':[['id',_0x6f29('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x7ee1=['update','DESC','UpdateChatQueueReport','../client','Request','CreateChatQueueReport'];(function(_0x5ef73f,_0x52a74a){var _0x567b5c=function(_0x1e8cbe){while(--_0x1e8cbe){_0x5ef73f['push'](_0x5ef73f['shift']());}};_0x567b5c(++_0x52a74a);}(_0x7ee1,0xab));var _0x17ee=function(_0x179bb0,_0x2090d3){_0x179bb0=_0x179bb0-0x0;var _0xd9e30b=_0x7ee1[_0x179bb0];return _0xd9e30b;};'use strict';var client=require(_0x17ee('0x0'));exports['create']=function(_0x360a8f){return client[_0x17ee('0x1')](_0x17ee('0x2'),{'body':_0x360a8f,'log':_0x17ee('0x2')});};exports[_0x17ee('0x3')]=function(_0x48baa3,_0x3a5743){return client['Request']('UpdateChatQueueReport',{'body':_0x3a5743,'options':{'where':{'uniqueid':_0x48baa3},'order':[['id',_0x17ee('0x4')]],'limit':0x1},'log':_0x17ee('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3147681..2df5584 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(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x7a54,0x106));var _0x47a5=function(_0xd15c1,_0x34968d){_0xd15c1=_0xd15c1-0x0;var _0x26fd24=_0x7a54[_0xd15c1];return _0x26fd24;};'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(_0x31f7b8,_0x44168d){var _0x471a56=function(_0x18dc3c){while(--_0x18dc3c){_0x31f7b8['push'](_0x31f7b8['shift']());}};_0x471a56(++_0x44168d);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 e1cc41b..2c9a6ff 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 _0xc901=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x4ac5a4,_0x248114){var _0x35e907=function(_0x325bf4){while(--_0x325bf4){_0x4ac5a4['push'](_0x4ac5a4['shift']());}};_0x35e907(++_0x248114);}(_0xc901,0x1cd));var _0x1c90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc901[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0x1c90('0x0')]=function(_0xa9306f){return client[_0x1c90('0x1')](_0x1c90('0x2'),{'body':_0xa9306f,'log':_0x1c90('0x3')});}; \ No newline at end of file +var _0xbe2f=['Request','createFaxMessage','../client'];(function(_0x24ac51,_0x2145ba){var _0x13a5fe=function(_0x402e80){while(--_0x402e80){_0x24ac51['push'](_0x24ac51['shift']());}};_0x13a5fe(++_0x2145ba);}(_0xbe2f,0x8f));var _0xfbe2=function(_0x11d4ed,_0x449dc0){_0x11d4ed=_0x11d4ed-0x0;var _0x441ed5=_0xbe2f[_0x11d4ed];return _0x441ed5;};'use strict';var client=require(_0xfbe2('0x0'));exports['create']=function(_0x56ae2b){return client[_0xfbe2('0x1')]('CreateFaxMessage',{'body':_0x56ae2b,'log':_0xfbe2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5fa7aa6..60df326 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 _0xbe75=['timeout','strategy','online','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name'];(function(_0x26307f,_0x28a0a4){var _0x50e950=function(_0x557639){while(--_0x557639){_0x26307f['push'](_0x26307f['shift']());}};_0x50e950(++_0x28a0a4);}(_0xbe75,0x1b5));var _0x5be7=function(_0x431836,_0x27231c){_0x431836=_0x431836-0x0;var _0x131d0e=_0xbe75[_0x431836];return _0x131d0e;};'use strict';var client=require(_0x5be7('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x5be7('0x1')](_0x5be7('0x2'),{'options':{'raw':![],'attributes':['id',_0x5be7('0x3'),_0x5be7('0x4'),_0x5be7('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x5be7('0x3'),_0x5be7('0x6'),_0x5be7('0x7')]}]},'log':_0x5be7('0x8')});};}; \ No newline at end of file +var _0xb496=['User','Agents','Request','name','timeout','strategy'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0xb496,0x1b2));var _0x6b49=function(_0x5a5650,_0x1d0d6c){_0x5a5650=_0x5a5650-0x0;var _0x1b5a9c=_0xb496[_0x5a5650];return _0x1b5a9c;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x6b49('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x6b49('0x1'),_0x6b49('0x2'),_0x6b49('0x3')],'include':[{'model':_0x6b49('0x4'),'as':_0x6b49('0x5'),'attributes':['id',_0x6b49('0x1'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b136e60..d8c14d8 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 _0xe2a3=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2e001f,_0x512286){var _0x309ae2=function(_0x436b5a){while(--_0x436b5a){_0x2e001f['push'](_0x2e001f['shift']());}};_0x309ae2(++_0x512286);}(_0xe2a3,0xaf));var _0x3e2a=function(_0x3dc473,_0x4b2a0b){_0x3dc473=_0x3dc473-0x0;var _0x4820a6=_0xe2a3[_0x3dc473];return _0x4820a6;};'use strict';var client=require(_0x3e2a('0x0'));exports[_0x3e2a('0x1')]=function(_0x267fe7){return client[_0x3e2a('0x2')](_0x3e2a('0x3'),{'body':_0x267fe7,'log':_0x3e2a('0x3')});};exports[_0x3e2a('0x4')]=function(_0x19925,_0x4d2e25){return client[_0x3e2a('0x2')](_0x3e2a('0x5'),{'body':_0x4d2e25,'options':{'where':{'uniqueid':_0x19925},'order':[['id','DESC']],'limit':0x1},'log':_0x3e2a('0x5')});}; \ No newline at end of file +var _0xf2c8=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x2354ba,_0x14c8b0){var _0x28ec41=function(_0x50ba6d){while(--_0x50ba6d){_0x2354ba['push'](_0x2354ba['shift']());}};_0x28ec41(++_0x14c8b0);}(_0xf2c8,0x1d4));var _0x8f2c=function(_0x4a6d25,_0xb75971){_0x4a6d25=_0x4a6d25-0x0;var _0x6a6f97=_0xf2c8[_0x4a6d25];return _0x6a6f97;};'use strict';var client=require('../client');exports[_0x8f2c('0x0')]=function(_0x5d0ca0){return client[_0x8f2c('0x1')]('CreateFaxQueueReport',{'body':_0x5d0ca0,'log':_0x8f2c('0x2')});};exports[_0x8f2c('0x3')]=function(_0x264383,_0x132c24){return client['Request'](_0x8f2c('0x4'),{'body':_0x132c24,'options':{'where':{'uniqueid':_0x264383},'order':[['id',_0x8f2c('0x5')]],'limit':0x1},'log':_0x8f2c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index eaa5aa4..cc7440e 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 _0x72a6=['interval','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x40412a,_0xd7d49){var _0x369d36=function(_0x325cb4){while(--_0x325cb4){_0x40412a['push'](_0x40412a['shift']());}};_0x369d36(++_0xd7d49);}(_0x72a6,0x1d6));var _0x672a=function(_0x3949ab,_0x4c06df){_0x3949ab=_0x3949ab-0x0;var _0x66bae2=_0x72a6[_0x3949ab];return _0x66bae2;};'use strict';var client=require('../client');exports[_0x672a('0x0')]=function(){return function(){return client[_0x672a('0x1')](_0x672a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x672a('0x3')],'include':[{'model':_0x672a('0x4'),'as':_0x672a('0x5'),'attributes':['id',_0x672a('0x3'),_0x672a('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x361d=['interval','../client','getIntervals','GetInterval','name','Interval','Intervals'];(function(_0x293560,_0xba995e){var _0x4548ba=function(_0x1dfc83){while(--_0x1dfc83){_0x293560['push'](_0x293560['shift']());}};_0x4548ba(++_0xba995e);}(_0x361d,0x189));var _0xd361=function(_0x3b0073,_0x529b46){_0x3b0073=_0x3b0073-0x0;var _0x1c0d27=_0x361d[_0x3b0073];return _0x1c0d27;};'use strict';var client=require(_0xd361('0x0'));exports[_0xd361('0x1')]=function(){return function(){return client['Request'](_0xd361('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd361('0x3')],'include':[{'model':_0xd361('0x4'),'as':_0xd361('0x5'),'attributes':['id','name',_0xd361('0x6')]}]},'log':_0xd361('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9ab0d8c..8a21aa1 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 _0x958a=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x39b07f,_0x4ef1dd){var _0xe5ae78=function(_0x5b2960){while(--_0x5b2960){_0x39b07f['push'](_0x39b07f['shift']());}};_0xe5ae78(++_0x4ef1dd);}(_0x958a,0x128));var _0xa958=function(_0x25df80,_0x35d058){_0x25df80=_0x25df80-0x0;var _0xfdfe0e=_0x958a[_0x25df80];return _0xfdfe0e;};'use strict';var client=require(_0xa958('0x0'));exports[_0xa958('0x1')]=function(_0x519e66,_0x44a925){return client[_0xa958('0x2')](_0xa958('0x3'),{'body':_0x44a925,'options':{'where':{'id':_0x519e66}},'log':_0xa958('0x4')});};exports[_0xa958('0x5')]=function(_0x5194f8,_0x3424b0){return client['Request'](_0xa958('0x6'),{'body':_0x3424b0,'options':{'where':{'id':_0x5194f8}},'log':_0xa958('0x7')});}; \ No newline at end of file +var _0x6d11=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0xb3fbd3,_0xaba06f){var _0x43b683=function(_0x569e66){while(--_0x569e66){_0xb3fbd3['push'](_0xb3fbd3['shift']());}};_0x43b683(++_0xaba06f);}(_0x6d11,0xbf));var _0x16d1=function(_0x5c8874,_0x23dbce){_0x5c8874=_0x5c8874-0x0;var _0x4b1818=_0x6d11[_0x5c8874];return _0x4b1818;};'use strict';var client=require(_0x16d1('0x0'));exports[_0x16d1('0x1')]=function(_0x78317b,_0x49dea5){return client[_0x16d1('0x2')]('UpdateMailInteraction',{'body':_0x49dea5,'options':{'where':{'id':_0x78317b}},'log':_0x16d1('0x3')});};exports[_0x16d1('0x4')]=function(_0x4bce83,_0x48754e){return client[_0x16d1('0x2')](_0x16d1('0x5'),{'body':_0x48754e,'options':{'where':{'id':_0x4bce83}},'log':_0x16d1('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1d42a14..0ccc94b 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 _0x058b=['Request','createMailMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x058b,0x6a));var _0xb058=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x058b[_0x4c1ec2];return _0x3f6f1c;};'use strict';var client=require(_0xb058('0x0'));exports[_0xb058('0x1')]=function(_0x577a84){return client[_0xb058('0x2')]('CreateMailMessage',{'body':_0x577a84,'log':_0xb058('0x3')});}; \ No newline at end of file +var _0x8740=['CreateMailMessage','../client','create','Request'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x8740,0x101));var _0x0874=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8740[_0x1deb03];return _0x189fe7;};'use strict';var client=require(_0x0874('0x0'));exports[_0x0874('0x1')]=function(_0x43288e){return client[_0x0874('0x2')](_0x0874('0x3'),{'body':_0x43288e,'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 d6aff37..49e003c 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 _0x98d8=['User','Agents','online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','timeout'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x98d8,0xcd));var _0x898d=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0x98d8[_0x37bab4];return _0x336d20;};'use strict';var client=require(_0x898d('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x898d('0x1')](_0x898d('0x2'),{'options':{'raw':![],'attributes':['id',_0x898d('0x3'),_0x898d('0x4'),'strategy'],'include':[{'model':_0x898d('0x5'),'as':_0x898d('0x6'),'attributes':['id','name',_0x898d('0x7'),_0x898d('0x8')]}]},'log':_0x898d('0x9')});};}; \ No newline at end of file +var _0xbba1=['name','User','online','../client','GetMailQueue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbba1,0x17f));var _0x1bba=function(_0x3f2a23,_0x216cbc){_0x3f2a23=_0x3f2a23-0x0;var _0x4e9663=_0xbba1[_0x3f2a23];return _0x4e9663;};'use strict';var client=require(_0x1bba('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x1bba('0x1'),{'options':{'raw':![],'attributes':['id',_0x1bba('0x2'),'timeout','strategy'],'include':[{'model':_0x1bba('0x3'),'as':'Agents','attributes':['id','name',_0x1bba('0x4'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ebdc476..d7a3b81 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 _0x0604=['update','UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x0604,0x1c5));var _0x4060=function(_0x58ac52,_0x32e668){_0x58ac52=_0x58ac52-0x0;var _0x4cfd12=_0x0604[_0x58ac52];return _0x4cfd12;};'use strict';var client=require(_0x4060('0x0'));exports['create']=function(_0x54c1f9){return client[_0x4060('0x1')](_0x4060('0x2'),{'body':_0x54c1f9,'log':_0x4060('0x2')});};exports[_0x4060('0x3')]=function(_0x389681,_0x1060e8){return client[_0x4060('0x1')](_0x4060('0x4'),{'body':_0x1060e8,'options':{'where':{'uniqueid':_0x389681},'order':[['id',_0x4060('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xe862=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xe862,0xe5));var _0x2e86=function(_0x59be85,_0x5bc38e){_0x59be85=_0x59be85-0x0;var _0x5746f5=_0xe862[_0x59be85];return _0x5746f5;};'use strict';var client=require(_0x2e86('0x0'));exports[_0x2e86('0x1')]=function(_0x2c5204){return client[_0x2e86('0x2')](_0x2e86('0x3'),{'body':_0x2c5204,'log':_0x2e86('0x3')});};exports[_0x2e86('0x4')]=function(_0x33559e,_0x4f4a02){return client[_0x2e86('0x2')](_0x2e86('0x5'),{'body':_0x4f4a02,'options':{'where':{'uniqueid':_0x33559e},'order':[['id',_0x2e86('0x6')]],'limit':0x1},'log':_0x2e86('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 080921b..642c487 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 _0x3380=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3380,0x137));var _0x0338=function(_0x2d5c47,_0x5eeb35){_0x2d5c47=_0x2d5c47-0x0;var _0x475bf4=_0x3380[_0x2d5c47];return _0x475bf4;};'use strict';var client=require(_0x0338('0x0'));exports[_0x0338('0x1')]=function(_0x33f903,_0x4b58e7){return client[_0x0338('0x2')](_0x0338('0x3'),{'body':_0x4b58e7,'options':{'where':{'id':_0x33f903}},'log':_0x0338('0x4')});};exports['addTags']=function(_0x24bcb7,_0x32448a){return client[_0x0338('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x32448a,'options':{'where':{'id':_0x24bcb7}},'log':_0x0338('0x5')});}; \ No newline at end of file +var _0x7eac=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x46fe6a,_0x58ff06){var _0x58cb14=function(_0x217dc0){while(--_0x217dc0){_0x46fe6a['push'](_0x46fe6a['shift']());}};_0x58cb14(++_0x58ff06);}(_0x7eac,0x70));var _0xc7ea=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7eac[_0x491a7f];return _0x3d8f44;};'use strict';var client=require('../client');exports[_0xc7ea('0x0')]=function(_0x4afc40,_0x55c8f2){return client[_0xc7ea('0x1')](_0xc7ea('0x2'),{'body':_0x55c8f2,'options':{'where':{'id':_0x4afc40}},'log':_0xc7ea('0x3')});};exports[_0xc7ea('0x4')]=function(_0x461f85,_0x1fe022){return client[_0xc7ea('0x1')](_0xc7ea('0x5'),{'body':_0x1fe022,'options':{'where':{'id':_0x461f85}},'log':_0xc7ea('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 11cba40..e4b4107 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 _0x8a01=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8a01,0xf6));var _0x18a0=function(_0x3a46a8,_0x20e857){_0x3a46a8=_0x3a46a8-0x0;var _0x1976f8=_0x8a01[_0x3a46a8];return _0x1976f8;};'use strict';var client=require(_0x18a0('0x0'));exports[_0x18a0('0x1')]=function(_0x3f4866){return client[_0x18a0('0x2')](_0x18a0('0x3'),{'body':_0x3f4866,'log':_0x18a0('0x4')});}; \ No newline at end of file +var _0xbd5d=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x20e79f,_0x35b24a){var _0x1fbb34=function(_0x9f2769){while(--_0x9f2769){_0x20e79f['push'](_0x20e79f['shift']());}};_0x1fbb34(++_0x35b24a);}(_0xbd5d,0x114));var _0xdbd5=function(_0x74042f,_0x78228b){_0x74042f=_0x74042f-0x0;var _0x242f9e=_0xbd5d[_0x74042f];return _0x242f9e;};'use strict';var client=require(_0xdbd5('0x0'));exports[_0xdbd5('0x1')]=function(_0x127aef){return client[_0xdbd5('0x2')](_0xdbd5('0x3'),{'body':_0x127aef,'log':_0xdbd5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c777d84..4953134 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 _0xf4d4=['Request','timeout','strategy','Agents','name','openchannelPause','getOpenchannelQueues','../client'];(function(_0x176ab4,_0x2e6e5e){var _0x361756=function(_0x51a862){while(--_0x51a862){_0x176ab4['push'](_0x176ab4['shift']());}};_0x361756(++_0x2e6e5e);}(_0xf4d4,0x1af));var _0x4f4d=function(_0x1d0041,_0x1a6f9a){_0x1d0041=_0x1d0041-0x0;var _0x5b5a43=_0xf4d4[_0x1d0041];return _0x5b5a43;};'use strict';var client=require(_0x4f4d('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x4f4d('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x4f4d('0x2'),_0x4f4d('0x3')],'include':[{'model':'User','as':_0x4f4d('0x4'),'attributes':['id',_0x4f4d('0x5'),'online',_0x4f4d('0x6')]}]},'log':_0x4f4d('0x7')});};}; \ No newline at end of file +var _0xb432=['timeout','User','Agents','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3feb46,_0xa026a3){var _0x2336bc=function(_0x34c9bb){while(--_0x34c9bb){_0x3feb46['push'](_0x3feb46['shift']());}};_0x2336bc(++_0xa026a3);}(_0xb432,0x8e));var _0x2b43=function(_0xdf4ff6,_0x4df36a){_0xdf4ff6=_0xdf4ff6-0x0;var _0x254581=_0xb432[_0xdf4ff6];return _0x254581;};'use strict';var client=require('../client');exports[_0x2b43('0x0')]=function(){return function(){return client['Request'](_0x2b43('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x2b43('0x2'),'strategy'],'include':[{'model':_0x2b43('0x3'),'as':_0x2b43('0x4'),'attributes':['id','name','online',_0x2b43('0x5')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 93c899d..d1991d1 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 _0xd95d=['UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x34217f,_0x4954d9){var _0x533721=function(_0x5ea689){while(--_0x5ea689){_0x34217f['push'](_0x34217f['shift']());}};_0x533721(++_0x4954d9);}(_0xd95d,0xf2));var _0xdd95=function(_0x292fbe,_0x1148ec){_0x292fbe=_0x292fbe-0x0;var _0x53ddce=_0xd95d[_0x292fbe];return _0x53ddce;};'use strict';var client=require(_0xdd95('0x0'));exports[_0xdd95('0x1')]=function(_0x1f2858){return client[_0xdd95('0x2')]('CreateOpenchannelQueueReport',{'body':_0x1f2858,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x4e81b0,_0x7a23d1){return client[_0xdd95('0x2')](_0xdd95('0x3'),{'body':_0x7a23d1,'options':{'where':{'uniqueid':_0x4e81b0},'order':[['id',_0xdd95('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x90db=['create','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x39d625,_0xcbd247){var _0x45bafa=function(_0x40f316){while(--_0x40f316){_0x39d625['push'](_0x39d625['shift']());}};_0x45bafa(++_0xcbd247);}(_0x90db,0x1c0));var _0xb90d=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x90db[_0x37bd26];return _0xe83dc4;};'use strict';var client=require('../client');exports[_0xb90d('0x0')]=function(_0x289d0e){return client[_0xb90d('0x1')]('CreateOpenchannelQueueReport',{'body':_0x289d0e,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x50a80e,_0x4aaef1){return client[_0xb90d('0x1')](_0xb90d('0x2'),{'body':_0x4aaef1,'options':{'where':{'uniqueid':_0x50a80e},'order':[['id',_0xb90d('0x3')]],'limit':0x1},'log':_0xb90d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 781202a..88cfd7c 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 _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1e69,0x85));var _0x91e6=function(_0x2af732,_0x852a76){_0x2af732=_0x2af732-0x0;var _0x2f0a55=_0x1e69[_0x2af732];return _0x2f0a55;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file +var _0xbc17=['addTags','addTagsToSmsInteraction','../client','update','Request'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x25c7fb,_0x2e4e86){_0x25c7fb=_0x25c7fb-0x0;var _0x214b77=_0xbc17[_0x25c7fb];return _0x214b77;};'use strict';var client=require(_0x7bc1('0x0'));exports[_0x7bc1('0x1')]=function(_0x5e8e5a,_0x20ed9b){return client[_0x7bc1('0x2')]('UpdateSmsInteraction',{'body':_0x20ed9b,'options':{'where':{'id':_0x5e8e5a}},'log':'updateSmsInteraction'});};exports[_0x7bc1('0x3')]=function(_0x7aa41e,_0x5dfaa8){return client[_0x7bc1('0x2')]('AddTagsToSmsInteraction',{'body':_0x5dfaa8,'options':{'where':{'id':_0x7aa41e}},'log':_0x7bc1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index aa4ca7b..41a4650 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 _0x53b4=['create','CreateSmsMessage'];(function(_0x49ba0a,_0x574ef8){var _0x40b3ad=function(_0x4b5674){while(--_0x4b5674){_0x49ba0a['push'](_0x49ba0a['shift']());}};_0x40b3ad(++_0x574ef8);}(_0x53b4,0x10e));var _0x453b=function(_0x481bdf,_0x231538){_0x481bdf=_0x481bdf-0x0;var _0x281a12=_0x53b4[_0x481bdf];return _0x281a12;};'use strict';var client=require('../client');exports[_0x453b('0x0')]=function(_0x4c0e4e){return client['Request'](_0x453b('0x1'),{'body':_0x4c0e4e,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xfa16=['CreateSmsMessage','createSmsMessage','create','Request'];(function(_0x13fc22,_0x4f609a){var _0x483c1d=function(_0x11b778){while(--_0x11b778){_0x13fc22['push'](_0x13fc22['shift']());}};_0x483c1d(++_0x4f609a);}(_0xfa16,0x9a));var _0x6fa1=function(_0x39f7bc,_0x4c90f8){_0x39f7bc=_0x39f7bc-0x0;var _0x23285d=_0xfa16[_0x39f7bc];return _0x23285d;};'use strict';var client=require('../client');exports[_0x6fa1('0x0')]=function(_0x2b84ae){return client[_0x6fa1('0x1')](_0x6fa1('0x2'),{'body':_0x2b84ae,'log':_0x6fa1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1b63897..487dc57 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(_0x170850,_0x2e8c9f){var _0x59c584=function(_0x822b62){while(--_0x822b62){_0x170850['push'](_0x170850['shift']());}};_0x59c584(++_0x2e8c9f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2f5e11,_0x2a5c64){var _0x3f8761=function(_0x277e41){while(--_0x277e41){_0x2f5e11['push'](_0x2f5e11['shift']());}};_0x3f8761(++_0x2a5c64);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d5738ff..ba4973c 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x6e17c,_0x3c1fe1){var _0x43ea56=function(_0x2bfed4){while(--_0x2bfed4){_0x6e17c['push'](_0x6e17c['shift']());}};_0x43ea56(++_0x3c1fe1);}(_0x55ca,0x126));var _0xa55c=function(_0x2703cf,_0x526b31){_0x2703cf=_0x2703cf-0x0;var _0x28f18a=_0x55ca[_0x2703cf];return _0x28f18a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x167fa4,_0x22aaff){var _0x103075=function(_0x551aa0){while(--_0x551aa0){_0x167fa4['push'](_0x167fa4['shift']());}};_0x103075(++_0x22aaff);}(_0x70e0,0x17b));var _0x070e=function(_0x214d8d,_0x28a849){_0x214d8d=_0x214d8d-0x0;var _0x50003b=_0x70e0[_0x214d8d];return _0x50003b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index e265ecd..56d10fc 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(_0x1cca01,_0xb99c4e){var _0x5949f9=function(_0x59dc48){while(--_0x59dc48){_0x1cca01['push'](_0x1cca01['shift']());}};_0x5949f9(++_0xb99c4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x2039f7,_0x2a781b){var _0x41c7a8=function(_0x331f7c){while(--_0x331f7c){_0x2039f7['push'](_0x2039f7['shift']());}};_0x41c7a8(++_0x2a781b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 5c1aaec..9c37684 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 _0x8d0a=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x8d0a,0x172));var _0xa8d0=function(_0x264043,_0x1358df){_0x264043=_0x264043-0x0;var _0x2af121=_0x8d0a[_0x264043];return _0x2af121;};'use strict';var client=require(_0xa8d0('0x0'));exports[_0xa8d0('0x1')]=function(_0x42a78b,_0x51c455){return client[_0xa8d0('0x2')](_0xa8d0('0x3'),{'body':_0x51c455,'options':{'where':{'id':_0x42a78b}},'log':'updateWhatsappInteraction'});};exports[_0xa8d0('0x4')]=function(_0x3812b4,_0x33c4b1){return client['Request'](_0xa8d0('0x5'),{'body':_0x33c4b1,'options':{'where':{'id':_0x3812b4}},'log':_0xa8d0('0x6')});}; \ No newline at end of file +var _0xaf11=['Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xaf11,0x12f));var _0x1af1=function(_0x5d8f58,_0x231866){_0x5d8f58=_0x5d8f58-0x0;var _0x105e90=_0xaf11[_0x5d8f58];return _0x105e90;};'use strict';var client=require(_0x1af1('0x0'));exports[_0x1af1('0x1')]=function(_0x326da9,_0x1d0736){return client['Request'](_0x1af1('0x2'),{'body':_0x1d0736,'options':{'where':{'id':_0x326da9}},'log':_0x1af1('0x3')});};exports[_0x1af1('0x4')]=function(_0x53af48,_0xb0ace){return client[_0x1af1('0x5')](_0x1af1('0x6'),{'body':_0xb0ace,'options':{'where':{'id':_0x53af48}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1505d3a..bdabc95 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 _0x1606=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x29abe6,_0x39ef28){var _0x4f91aa=function(_0xc797f2){while(--_0xc797f2){_0x29abe6['push'](_0x29abe6['shift']());}};_0x4f91aa(++_0x39ef28);}(_0x1606,0xf9));var _0x6160=function(_0x310982,_0x353311){_0x310982=_0x310982-0x0;var _0x14f215=_0x1606[_0x310982];return _0x14f215;};'use strict';var client=require(_0x6160('0x0'));exports[_0x6160('0x1')]=function(_0x10fdc7){return client[_0x6160('0x2')](_0x6160('0x3'),{'body':_0x10fdc7,'log':_0x6160('0x4')});}; \ No newline at end of file +var _0x29a8=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x26cd37,_0x5a9ef0){var _0x10b068=function(_0x12e7d3){while(--_0x12e7d3){_0x26cd37['push'](_0x26cd37['shift']());}};_0x10b068(++_0x5a9ef0);}(_0x29a8,0x18e));var _0x829a=function(_0x2336b3,_0x31e223){_0x2336b3=_0x2336b3-0x0;var _0x28deeb=_0x29a8[_0x2336b3];return _0x28deeb;};'use strict';var client=require(_0x829a('0x0'));exports[_0x829a('0x1')]=function(_0x5c3398){return client[_0x829a('0x2')](_0x829a('0x3'),{'body':_0x5c3398,'log':_0x829a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3000bf8..029027e 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 _0x1aff=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x1aff,0x106));var _0xf1af=function(_0x3a1bd4,_0x5f9b1c){_0x3a1bd4=_0x3a1bd4-0x0;var _0x2efe2b=_0x1aff[_0x3a1bd4];return _0x2efe2b;};'use strict';var client=require(_0xf1af('0x0'));exports[_0xf1af('0x1')]=function(){return function(){return client[_0xf1af('0x2')](_0xf1af('0x3'),{'options':{'raw':![],'attributes':['id',_0xf1af('0x4'),_0xf1af('0x5'),_0xf1af('0x6')],'include':[{'model':_0xf1af('0x7'),'as':_0xf1af('0x8'),'attributes':['id',_0xf1af('0x4'),_0xf1af('0x9'),_0xf1af('0xa')]}]},'log':_0xf1af('0x1')});};}; \ No newline at end of file +var _0x4b38=['online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x4b38,0xd9));var _0x84b3=function(_0x2e8daa,_0x5ea7ef){_0x2e8daa=_0x2e8daa-0x0;var _0x1fd10b=_0x4b38[_0x2e8daa];return _0x1fd10b;};'use strict';var client=require(_0x84b3('0x0'));exports[_0x84b3('0x1')]=function(){return function(){return client[_0x84b3('0x2')](_0x84b3('0x3'),{'options':{'raw':![],'attributes':['id',_0x84b3('0x4'),'timeout',_0x84b3('0x5')],'include':[{'model':_0x84b3('0x6'),'as':_0x84b3('0x7'),'attributes':['id','name',_0x84b3('0x8'),'whatsappPause']}]},'log':_0x84b3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 183fec5..4f9c733 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 _0xdf39=['UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport','update'];(function(_0x1489a5,_0x1fa1bd){var _0x1350fc=function(_0x2fbbc1){while(--_0x2fbbc1){_0x1489a5['push'](_0x1489a5['shift']());}};_0x1350fc(++_0x1fa1bd);}(_0xdf39,0x128));var _0x9df3=function(_0xef9267,_0x152317){_0xef9267=_0xef9267-0x0;var _0x4372a2=_0xdf39[_0xef9267];return _0x4372a2;};'use strict';var client=require('../client');exports[_0x9df3('0x0')]=function(_0xde52a2){return client[_0x9df3('0x1')](_0x9df3('0x2'),{'body':_0xde52a2,'log':_0x9df3('0x2')});};exports[_0x9df3('0x3')]=function(_0x1c0004,_0xe596eb){return client[_0x9df3('0x1')](_0x9df3('0x4'),{'body':_0xe596eb,'options':{'where':{'uniqueid':_0x1c0004},'order':[['id',_0x9df3('0x5')]],'limit':0x1},'log':_0x9df3('0x4')});}; \ No newline at end of file +var _0x63c0=['update','UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0x11acfd,_0x3a161a){var _0x188c0b=function(_0x3faaf4){while(--_0x3faaf4){_0x11acfd['push'](_0x11acfd['shift']());}};_0x188c0b(++_0x3a161a);}(_0x63c0,0x183));var _0x063c=function(_0x334672,_0x42f550){_0x334672=_0x334672-0x0;var _0x7cb6dc=_0x63c0[_0x334672];return _0x7cb6dc;};'use strict';var client=require('../client');exports[_0x063c('0x0')]=function(_0x47c833){return client[_0x063c('0x1')](_0x063c('0x2'),{'body':_0x47c833,'log':_0x063c('0x2')});};exports[_0x063c('0x3')]=function(_0x4d2ce7,_0x9f976c){return client[_0x063c('0x1')](_0x063c('0x4'),{'body':_0x9f976c,'options':{'where':{'uniqueid':_0x4d2ce7},'order':[['id',_0x063c('0x5')]],'limit':0x1},'log':_0x063c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index ba9b561..0565a08 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 _0xe8b2=['message','stop','find','agents','name','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','[%s][AGENT]\x20%s'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xe8b2,0x7d));var _0x2e8b=function(_0x5be9c4,_0x5c5059){_0x5be9c4=_0x5be9c4-0x0;var _0x3cbf88=_0xe8b2[_0x5be9c4];return _0x3cbf88;};'use strict';var schema=require(_0x2e8b('0x0'));var _=require(_0x2e8b('0x1'));var util=require(_0x2e8b('0x2'));var seqqueue=require(_0x2e8b('0x3'));var logger=require(_0x2e8b('0x4'))(_0x2e8b('0x5'));var strategy=require(_0x2e8b('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x2e8b('0x7')},'timeout':{'type':_0x2e8b('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5d808b,_0x34ad0a,_0x4b7462){return logger[_0x2e8b('0x9')](util[_0x2e8b('0xa')](_0x2e8b('0xb'),_0x5d808b,_0x34ad0a['name'],_0x4b7462));}function handleFindAgent(_0x4ae2b9){return function(_0x51c51e){return _0x51c51e['name'][_0x2e8b('0xc')]()===_0x4ae2b9[_0x2e8b('0xc')]();};}exports[_0x2e8b('0xd')]=function(_0x22310b,_0x48f050,_0x486ce2,_0x2c61f0){return function(_0x11bee3){try{var _0x435630={'name':_0x48f050[0x0],'timeout':_0x48f050[0x1]};var _0x2a6993=queue[_0x2e8b('0x0')](_0x435630,{'typecast':!![]});if(_0x2a6993['length']){logger['error'](_0x2e8b('0xe'),_0x22310b,_['map'](_0x2a6993,_0x2e8b('0xf'))['join'](',\x20'));_0x11bee3[_0x2e8b('0x10')]();}else{var _0xa00eff=_[_0x2e8b('0x11')](_0x486ce2[_0x2e8b('0x12')],handleFindAgent(_0x435630[_0x2e8b('0x13')]));if(_0xa00eff){var _0x1a5ee3=(_0x435630[_0x2e8b('0x14')]||0xa)*0x3e8;var _0x1230ae,_0x5b08cd;var _0x59f523=seqqueue[_0x2e8b('0x15')](_0x1a5ee3);_0x59f523['id']=_0x22310b;_0x59f523[_0x2e8b('0x16')]=_0x1a5ee3;_0x59f523[_0x2e8b('0x17')]=_0x2c61f0[_0x2e8b('0x17')];writeLog(_0x22310b,_0xa00eff,util[_0x2e8b('0xa')](_0x2e8b('0x18'),_0x1a5ee3));_0x486ce2[_0x2e8b('0x19')][_0x22310b]['on'](_0x2e8b('0x1a'),function(){logger[_0x2e8b('0x9')](_0x2e8b('0x1b'),_0x22310b);clearTimeout(_0x5b08cd);_0x5b08cd=undefined;_0x59f523[_0x2e8b('0x1c')]();if(_0x486ce2[_0x2e8b('0x19')][_0x22310b]){delete _0x486ce2['rules'][_0x22310b];}_0x11bee3[_0x2e8b('0x10')]();});_0x486ce2['rules'][_0x22310b]['on'](_0x2e8b('0x1d'),function(){if(_0x486ce2['rules'][_0x22310b]){delete _0x486ce2[_0x2e8b('0x19')][_0x22310b];}});_0x5b08cd=setTimeout(function(){logger[_0x2e8b('0x9')](_0x2e8b('0x1e'),_0x22310b);clearTimeout(_0x5b08cd);_0x59f523['close']();_0x11bee3['next']();},_0x1a5ee3);strategy['agent'](_0x59f523,_0xa00eff,_0x486ce2,_0x2c61f0);}else{logger['error'](_0x2e8b('0x1f'),_0x22310b,_0x435630['name']);_0x11bee3[_0x2e8b('0x10')]();}}}catch(_0x19a645){console['log'](_0x19a645);logger[_0x2e8b('0x20')](_0x2e8b('0x21'),_0x22310b,_0x19a645[_0x2e8b('0x22')]);_0x11bee3['stop']();}};}; \ No newline at end of file +var _0x5ebd=['info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','message','join','find','timeout','createQueue','channel','START:%s','rules'];(function(_0x1ba914,_0x5c37f9){var _0x8753d=function(_0x468fba){while(--_0x468fba){_0x1ba914['push'](_0x1ba914['shift']());}};_0x8753d(++_0x5c37f9);}(_0x5ebd,0xf9));var _0xd5eb=function(_0x57dea6,_0x2daecb){_0x57dea6=_0x57dea6-0x0;var _0x4cd39c=_0x5ebd[_0x57dea6];return _0x4cd39c;};'use strict';var schema=require('validate');var _=require(_0xd5eb('0x0'));var util=require(_0xd5eb('0x1'));var seqqueue=require(_0xd5eb('0x2'));var logger=require(_0xd5eb('0x3'))('routing');var strategy=require(_0xd5eb('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xd5eb('0x5')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x8fd8a2,_0x3c6718,_0x55a91d){return logger['info'](util[_0xd5eb('0x6')](_0xd5eb('0x7'),_0x8fd8a2,_0x3c6718[_0xd5eb('0x8')],_0x55a91d));}function handleFindAgent(_0x664969){return function(_0x45d06a){return _0x45d06a['name'][_0xd5eb('0x9')]()===_0x664969[_0xd5eb('0x9')]();};}exports[_0xd5eb('0xa')]=function(_0x44f9b9,_0x1b4c4f,_0x38ffa2,_0x451d74){return function(_0x30dd4e){try{var _0x3ba5c6={'name':_0x1b4c4f[0x0],'timeout':_0x1b4c4f[0x1]};var _0x13ba4a=queue['validate'](_0x3ba5c6,{'typecast':!![]});if(_0x13ba4a[_0xd5eb('0xb')]){logger[_0xd5eb('0xc')]('[%s][AGENT]\x20%s',_0x44f9b9,_['map'](_0x13ba4a,_0xd5eb('0xd'))[_0xd5eb('0xe')](',\x20'));_0x30dd4e['stop']();}else{var _0x40d642=_[_0xd5eb('0xf')](_0x38ffa2['agents'],handleFindAgent(_0x3ba5c6[_0xd5eb('0x8')]));if(_0x40d642){var _0x438eee=(_0x3ba5c6[_0xd5eb('0x10')]||0xa)*0x3e8;var _0x157e20,_0x445f72;var _0x1af3b0=seqqueue[_0xd5eb('0x11')](_0x438eee);_0x1af3b0['id']=_0x44f9b9;_0x1af3b0['atimeout']=_0x438eee;_0x1af3b0[_0xd5eb('0x12')]=_0x451d74[_0xd5eb('0x12')];writeLog(_0x44f9b9,_0x40d642,util[_0xd5eb('0x6')](_0xd5eb('0x13'),_0x438eee));_0x38ffa2[_0xd5eb('0x14')][_0x44f9b9]['on']('end',function(){logger[_0xd5eb('0x15')](_0xd5eb('0x16'),_0x44f9b9);clearTimeout(_0x445f72);_0x445f72=undefined;_0x1af3b0['close']();if(_0x38ffa2[_0xd5eb('0x14')][_0x44f9b9]){delete _0x38ffa2[_0xd5eb('0x14')][_0x44f9b9];}_0x30dd4e[_0xd5eb('0x17')]();});_0x38ffa2[_0xd5eb('0x14')][_0x44f9b9]['on'](_0xd5eb('0x18'),function(){if(_0x38ffa2[_0xd5eb('0x14')][_0x44f9b9]){delete _0x38ffa2['rules'][_0x44f9b9];}});_0x445f72=setTimeout(function(){logger[_0xd5eb('0x15')]('[%s][AGENT]\x20ROUTING\x20END',_0x44f9b9);clearTimeout(_0x445f72);_0x1af3b0['close']();_0x30dd4e[_0xd5eb('0x19')]();},_0x438eee);strategy[_0xd5eb('0x1a')](_0x1af3b0,_0x40d642,_0x38ffa2,_0x451d74);}else{logger[_0xd5eb('0xc')](_0xd5eb('0x1b'),_0x44f9b9,_0x3ba5c6[_0xd5eb('0x8')]);_0x30dd4e[_0xd5eb('0x17')]();}}}catch(_0xe7aa){console['log'](_0xe7aa);logger['error'](_0xd5eb('0x1c'),_0x44f9b9,_0xe7aa[_0xd5eb('0x1d')]);_0x30dd4e['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 a37045d..4dea786 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 _0x2f9d=['error','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','toString','postText','message','amazonlex','providerName','stringify','dialogState','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','account','upperFirst','InteractionId','body','Message','create','then','catch'];(function(_0x100ee1,_0x3d15db){var _0x346151=function(_0x421106){while(--_0x421106){_0x100ee1['push'](_0x100ee1['shift']());}};_0x346151(++_0x3d15db);}(_0x2f9d,0xf4));var _0xd2f9=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2f9d[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var moment=require(_0xd2f9('0x0'));var AWS=require('aws-sdk');var utils=require(_0xd2f9('0x1'));var logger=require(_0xd2f9('0x2'))(_0xd2f9('0x3'));var rpc={'chatMessage':require(_0xd2f9('0x4')),'openchannelMessage':require(_0xd2f9('0x5')),'mailMessage':require(_0xd2f9('0x6')),'smsMessage':require(_0xd2f9('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd2f9('0x8'))};exports[_0xd2f9('0x9')]=function(_0x56d878,_0x4a5c91){return function(_0x3dc10a){try{if(!_[_0xd2f9('0xa')](this[_0xd2f9('0xb')][_0xd2f9('0xc')])){logger[_0xd2f9('0xd')](_0xd2f9('0xe'),_0x56d878,_0xd2f9('0xf'));return _0x3dc10a[_0xd2f9('0x10')]();}var _0x367830={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd2f9('0x11')](_0xd2f9('0x12')),'direction':_0xd2f9('0x13')};if(this[_0xd2f9('0x14')]===_0xd2f9('0x15')||this['channel']==='whatsapp'){_0x367830[_0xd2f9('0x16')]=this[_0xd2f9('0xb')][_0xd2f9('0x16')];}var _0x56e61a=this[_0xd2f9('0x14')];if(_0x56e61a===_0xd2f9('0x17')){_0x367830['ChatWebsiteId']=this[_0xd2f9('0x18')]['id'];}else{_0x367830[_[_0xd2f9('0x19')](_0x56e61a)+'AccountId']=this[_0xd2f9('0x18')]['id'];}_0x367830[_[_0xd2f9('0x19')](_0x56e61a)+_0xd2f9('0x1a')]=this[_0xd2f9('0xb')]['id'];if(this['interaction']['created']){var _0x5c2d63=_0x4a5c91[0x4];if(!_['isEmpty'](_0x5c2d63)){_0x367830[_0xd2f9('0x1b')]=utils['getMustacheRender'](_0x5c2d63,this);return rpc[_0x56e61a+_0xd2f9('0x1c')][_0xd2f9('0x1d')](_0x367830)[_0xd2f9('0x1e')](function(_0x4f78f2){logger[_0xd2f9('0xd')]('[%s][AMAZONLEX]\x20%s',_0x56d878,_0x367830['body']);})[_0xd2f9('0x1f')](function(_0x4aa03f){logger[_0xd2f9('0x20')](_0xd2f9('0xe'),_0x56d878,JSON['stringify'](_0x4aa03f));})[_0xd2f9('0x21')](function(){logger[_0xd2f9('0xd')](_0xd2f9('0x22'),_0x56d878);_0x3dc10a[_0xd2f9('0x23')]();});}else{logger['info'](_0xd2f9('0x24'),_0x56d878);_0x3dc10a[_0xd2f9('0x23')]();}}else{var _0x261948=this;var _0x118b94=new AWS[(_0xd2f9('0x25'))]({'accessKeyId':_0x4a5c91[0x0],'secretAccessKey':_0x4a5c91[0x1],'region':_0x4a5c91[0x2]});var _0x361d5e={'botAlias':_0xd2f9('0x26'),'botName':_0x4a5c91[0x3],'inputText':this['message'][_0xd2f9('0x1b')],'userId':this[_0xd2f9('0x14')]+':'+this[_0xd2f9('0xb')]['id'][_0xd2f9('0x27')]()};_0x118b94[_0xd2f9('0x28')](_0x361d5e,function(_0xcbb45d,_0x295c2a){if(_0xcbb45d){logger['error'](_0xd2f9('0xe'),_0x56d878,_0xcbb45d[_0xd2f9('0x29')]);_0x3dc10a['next']();}else if(_0x295c2a&&_0x295c2a[_0xd2f9('0x29')]){_0x261948['body'][_0xd2f9('0x2a')]=_0x295c2a;_0x367830[_0xd2f9('0x1b')]=_0x295c2a[_0xd2f9('0x29')];_0x367830[_0xd2f9('0x2b')]=_0xd2f9('0x2a');_0x367830['providerResponse']=JSON[_0xd2f9('0x2c')](_0x295c2a);return rpc[_0x56e61a+_0xd2f9('0x1c')]['create'](_0x367830)[_0xd2f9('0x1e')](function(_0x5f4c72){logger[_0xd2f9('0xd')](_0xd2f9('0xe'),_0x56d878,_0x367830[_0xd2f9('0x1b')]);if(_0x295c2a[_0xd2f9('0x2d')]=='Failed'){_0x3dc10a['next']();}else{_0x3dc10a[_0xd2f9('0x23')]();}})[_0xd2f9('0x1f')](function(_0x49d045){logger[_0xd2f9('0x20')](_0xd2f9('0xe'),_0x56d878,JSON[_0xd2f9('0x2c')](_0x49d045));_0x3dc10a[_0xd2f9('0x10')]();});}else{_0x3dc10a['next']();}});}}catch(_0x4af889){logger[_0xd2f9('0x20')](_0xd2f9('0xe'),_0x56d878,JSON[_0xd2f9('0x2c')](_0x4af889));_0x3dc10a[_0xd2f9('0x23')]();}};}; \ No newline at end of file +var _0xbb41=['amazonlex','providerName','then','lodash','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','interaction','created','body','getMustacheRender','Message','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText'];(function(_0x3a2b12,_0xbfb5c2){var _0x479087=function(_0x2ee111){while(--_0x2ee111){_0x3a2b12['push'](_0x3a2b12['shift']());}};_0x479087(++_0xbfb5c2);}(_0xbb41,0xda));var _0x1bb4=function(_0x503c88,_0x2a8eb7){_0x503c88=_0x503c88-0x0;var _0x157d19=_0xbb41[_0x503c88];return _0x157d19;};'use strict';var _=require(_0x1bb4('0x0'));var moment=require(_0x1bb4('0x1'));var AWS=require(_0x1bb4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1bb4('0x3'));var rpc={'chatMessage':require(_0x1bb4('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1bb4('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1bb4('0x6'))};exports['consequence']=function(_0x42a831,_0x1aa915){return function(_0x556cfd){try{if(!_[_0x1bb4('0x7')](this['interaction'][_0x1bb4('0x8')])){logger['info'](_0x1bb4('0x9'),_0x42a831,_0x1bb4('0xa'));return _0x556cfd[_0x1bb4('0xb')]();}var _0x38ecb4={'ContactId':this[_0x1bb4('0xc')]['id'],'sentAt':moment()[_0x1bb4('0xd')](_0x1bb4('0xe')),'direction':_0x1bb4('0xf')};if(this[_0x1bb4('0x10')]==='sms'||this[_0x1bb4('0x10')]===_0x1bb4('0x11')){_0x38ecb4[_0x1bb4('0x12')]=this['interaction'][_0x1bb4('0x12')];}var _0x27da35=this[_0x1bb4('0x10')];if(_0x27da35==='chat'){_0x38ecb4[_0x1bb4('0x13')]=this['account']['id'];}else{_0x38ecb4[_[_0x1bb4('0x14')](_0x27da35)+_0x1bb4('0x15')]=this['account']['id'];}_0x38ecb4[_[_0x1bb4('0x14')](_0x27da35)+'InteractionId']=this[_0x1bb4('0x16')]['id'];if(this[_0x1bb4('0x16')][_0x1bb4('0x17')]){var _0x4791a5=_0x1aa915[0x4];if(!_['isEmpty'](_0x4791a5)){_0x38ecb4[_0x1bb4('0x18')]=utils[_0x1bb4('0x19')](_0x4791a5,this);return rpc[_0x27da35+_0x1bb4('0x1a')]['create'](_0x38ecb4)['then'](function(_0x40aac7){logger[_0x1bb4('0x1b')](_0x1bb4('0x9'),_0x42a831,_0x38ecb4[_0x1bb4('0x18')]);})[_0x1bb4('0x1c')](function(_0x487d1d){logger[_0x1bb4('0x1d')](_0x1bb4('0x9'),_0x42a831,JSON[_0x1bb4('0x1e')](_0x487d1d));})[_0x1bb4('0x1f')](function(){logger[_0x1bb4('0x1b')](_0x1bb4('0x20'),_0x42a831);_0x556cfd[_0x1bb4('0x21')]();});}else{logger[_0x1bb4('0x1b')](_0x1bb4('0x22'),_0x42a831);_0x556cfd[_0x1bb4('0x21')]();}}else{var _0x1300fa=this;var _0x1e27a4=new AWS[(_0x1bb4('0x23'))]({'accessKeyId':_0x1aa915[0x0],'secretAccessKey':_0x1aa915[0x1],'region':_0x1aa915[0x2]});var _0x2dffcb={'botAlias':_0x1bb4('0x24'),'botName':_0x1aa915[0x3],'inputText':this[_0x1bb4('0x25')][_0x1bb4('0x18')],'userId':this[_0x1bb4('0x10')]+':'+this[_0x1bb4('0x16')]['id'][_0x1bb4('0x26')]()};_0x1e27a4[_0x1bb4('0x27')](_0x2dffcb,function(_0x3abdef,_0x25a116){if(_0x3abdef){logger[_0x1bb4('0x1d')](_0x1bb4('0x9'),_0x42a831,_0x3abdef[_0x1bb4('0x25')]);_0x556cfd['next']();}else if(_0x25a116&&_0x25a116[_0x1bb4('0x25')]){_0x1300fa['body'][_0x1bb4('0x28')]=_0x25a116;_0x38ecb4[_0x1bb4('0x18')]=_0x25a116[_0x1bb4('0x25')];_0x38ecb4[_0x1bb4('0x29')]='amazonlex';_0x38ecb4['providerResponse']=JSON['stringify'](_0x25a116);return rpc[_0x27da35+'Message']['create'](_0x38ecb4)[_0x1bb4('0x2a')](function(_0x273dd4){logger[_0x1bb4('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x42a831,_0x38ecb4[_0x1bb4('0x18')]);if(_0x25a116['dialogState']=='Failed'){_0x556cfd['next']();}else{_0x556cfd[_0x1bb4('0x21')]();}})[_0x1bb4('0x1c')](function(_0xb856e4){logger['error'](_0x1bb4('0x9'),_0x42a831,JSON[_0x1bb4('0x1e')](_0xb856e4));_0x556cfd[_0x1bb4('0xb')]();});}else{_0x556cfd[_0x1bb4('0xb')]();}});}}catch(_0x3e2f13){logger[_0x1bb4('0x1d')](_0x1bb4('0x9'),_0x42a831,JSON[_0x1bb4('0x1e')](_0x3e2f13));_0x556cfd[_0x1bb4('0x21')]();}};}; \ 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 3088ddc..1912087 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 _0xdbe8=['format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','messageId','','replace','','All','auto_reply','sendMailMessage','then','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact'];(function(_0x2c3737,_0x4bbb67){var _0x408142=function(_0x5150b1){while(--_0x5150b1){_0x2c3737['push'](_0x2c3737['shift']());}};_0x408142(++_0x4bbb67);}(_0xdbe8,0x15d));var _0x8dbe=function(_0x373c69,_0x15249f){_0x373c69=_0x373c69-0x0;var _0x17c512=_0xdbe8[_0x373c69];return _0x17c512;};'use strict';var _=require(_0x8dbe('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x8dbe('0x1'))(_0x8dbe('0x2'));var rpc={'chatMessage':require(_0x8dbe('0x3')),'openchannelMessage':require(_0x8dbe('0x4')),'mailMessage':require(_0x8dbe('0x5')),'smsMessage':require(_0x8dbe('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x8dbe('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x8dbe('0x8')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x8dbe('0x9')),'whatsappInteraction':require(_0x8dbe('0xa'))};var mailRpc=require(_0x8dbe('0xb'));exports['consequence']=function(_0x557036,_0x2c4670,_0x16ee3,_0x45f9e5){return function(_0x14ed79){try{var _0x1253ab=this['channel'];if(_0x1253ab===_0x8dbe('0xc')&&_0x45f9e5[_0x8dbe('0xd')][_0x8dbe('0xe')]){logger[_0x8dbe('0xf')]('[%s][AUTOREPLY]\x20%s',_0x557036,_0x8dbe('0x10'));return _0x14ed79[_0x8dbe('0x11')]();}if(_0x2c4670[0x0]==='1'&&(_['isNil'](this[_0x8dbe('0x12')][_0x8dbe('0x13')])||!this[_0x8dbe('0x12')][_0x8dbe('0x13')])){logger[_0x8dbe('0xf')](_0x8dbe('0x14'),_0x557036,_0x8dbe('0x15'));return _0x14ed79[_0x8dbe('0x11')]();}if(_0x2c4670[0x0]==='2'&&this[_0x8dbe('0x12')][_0x8dbe('0x16')]){logger['info'](_0x8dbe('0x17'),_0x557036,_0x8dbe('0x18'));return _0x14ed79['next']();}var _0x2c637e={'ContactId':this[_0x8dbe('0x19')]['id'],'sentAt':moment()[_0x8dbe('0x1a')](_0x8dbe('0x1b')),'direction':_0x8dbe('0x1c')};if(this[_0x8dbe('0x1d')]===_0x8dbe('0xc')){_0x2c637e[_0x8dbe('0xd')]=utils[_0x8dbe('0x1e')](_0x2c4670[0x2],this);}else{_0x2c637e[_0x8dbe('0xd')]=utils['getMustacheRender'](_0x2c4670[0x1],this);}if(this[_0x8dbe('0x1f')]){_0x2c637e['to']=this[_0x8dbe('0x1f')][_0x8dbe('0x20')]||'';if(this[_0x8dbe('0x1d')]===_0x8dbe('0xc')&&_0x2c4670[0x1]==='1'){_0x2c637e['cc']=this[_0x8dbe('0x1f')]['cc']||'';}_0x2c637e[_0x8dbe('0x20')]=this[_0x8dbe('0x1f')]['to']||'';_0x2c637e[_0x8dbe('0x21')]=this[_0x8dbe('0x1f')][_0x8dbe('0x21')]||'';_0x2c637e[_0x8dbe('0x22')]=!![];if(this[_0x8dbe('0x1f')][_0x8dbe('0x23')]){_0x2c637e[_0x8dbe('0x23')]='';_0x2c637e[_0x8dbe('0x23')]+=_[_0x8dbe('0x24')](this['message'][_0x8dbe('0x23')],'Re:')?'':_0x8dbe('0x25');_0x2c637e[_0x8dbe('0x23')]+=this[_0x8dbe('0x1f')]['subject'];}}if(this[_0x8dbe('0x1d')]===_0x8dbe('0x26')){_0x2c637e[_0x8dbe('0x27')]=this[_0x8dbe('0x28')]['id'];}else{_0x2c637e[_[_0x8dbe('0x29')](this[_0x8dbe('0x1d')])+_0x8dbe('0x2a')]=this[_0x8dbe('0x28')]['id'];}_0x2c637e[_[_0x8dbe('0x29')](this[_0x8dbe('0x1d')])+_0x8dbe('0x2b')]=this['interaction']['id'];var _0x39cd90=this[_0x8dbe('0x12')];if(rpc[this[_0x8dbe('0x1d')]+_0x8dbe('0x2c')]){if(this[_0x8dbe('0x1d')]===_0x8dbe('0xc')){var _0x4be688={'tls':{'rejectUnauthorized':![]}};if(this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x2e')]){_0x4be688[_0x8dbe('0x2e')]=this[_0x8dbe('0x28')]['Smtp']['service'];}else{_0x4be688[_0x8dbe('0x2f')]=this[_0x8dbe('0x28')]['Smtp'][_0x8dbe('0x2f')];_0x4be688['port']=this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x30')];_0x4be688[_0x8dbe('0x31')]=this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x31')];}if(this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x32')]){_0x4be688[_0x8dbe('0x33')]={'user':this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x34')],'pass':this[_0x8dbe('0x28')][_0x8dbe('0x2d')][_0x8dbe('0x35')]};}_0x2c637e['inReplyTo']=this[_0x8dbe('0x1f')][_0x8dbe('0x36')];_0x2c637e['html']=_0x8dbe('0x37')+_[_0x8dbe('0x38')](_0x2c637e[_0x8dbe('0xd')],_0x8dbe('0x39'),_0x8dbe('0x3a'))+_0x8dbe('0x3b');_0x2c637e['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x8dbe('0x3c'),'Precedence':_0x8dbe('0x3d')};return mailRpc[_0x8dbe('0x3e')](_0x4be688,_0x2c637e)[_0x8dbe('0x3f')](function(_0x62457c){logger[_0x8dbe('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x557036);_0x2c637e[_0x8dbe('0x36')]=_0x62457c[_0x8dbe('0x1f')][_0x8dbe('0x36')];return rpc[_0x1253ab+_0x8dbe('0x2c')][_0x8dbe('0x40')](_0x2c637e);})['then'](function(_0x17abc6){logger['info'](_0x8dbe('0x14'),_0x557036,JSON['stringify'](_0x17abc6));})['catch'](function(_0xee7eca){logger[_0x8dbe('0x41')](_0x8dbe('0x42'),_0x557036,JSON[_0x8dbe('0x43')](_0xee7eca));})[_0x8dbe('0x44')](function(){Promise[_0x8dbe('0x45')]()['then'](function(){if(_0x2c4670[0x0]!=='2'||_0x39cd90[_0x8dbe('0x16')])return;return rpc[_0x1253ab+_0x8dbe('0x46')][_0x8dbe('0x47')](_0x39cd90['id'],{'autoreplyExecuted':!![]})[_0x8dbe('0x3f')](function(_0x43e0aa){logger[_0x8dbe('0xf')](_0x8dbe('0x17'),_0x557036,JSON[_0x8dbe('0x43')](_0x43e0aa));})[_0x8dbe('0x48')](function(_0x3eb60f){logger[_0x8dbe('0x41')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x557036,JSON[_0x8dbe('0x43')](_0x3eb60f));});})[_0x8dbe('0x3f')](function(){_0x14ed79[_0x8dbe('0x11')]();});});}else{return rpc[this[_0x8dbe('0x1d')]+'Message'][_0x8dbe('0x40')](_0x2c637e)[_0x8dbe('0x3f')](function(_0x1c6306){logger[_0x8dbe('0xf')](_0x8dbe('0x14'),_0x557036,_0x2c637e[_0x8dbe('0xd')]);})[_0x8dbe('0x48')](function(_0xe52f1c){logger['error'](_0x8dbe('0x14'),_0x557036,JSON[_0x8dbe('0x43')](_0xe52f1c));})['finally'](function(){Promise[_0x8dbe('0x45')]()[_0x8dbe('0x3f')](function(){if(_0x2c4670[0x0]!=='2'||_0x39cd90[_0x8dbe('0x16')])return;return rpc[_0x1253ab+_0x8dbe('0x46')][_0x8dbe('0x47')](_0x39cd90['id'],{'autoreplyExecuted':!![]})[_0x8dbe('0x3f')](function(_0x1c6ad5){logger[_0x8dbe('0xf')](_0x8dbe('0x17'),_0x557036,JSON['stringify'](_0x1c6ad5));})['catch'](function(_0x402d38){logger['error'](_0x8dbe('0x49'),_0x557036,JSON['stringify'](_0x402d38));});})['then'](function(){_0x14ed79[_0x8dbe('0x11')]();});});}}}catch(_0x3069c4){logger['error'](_0x8dbe('0x14'),_0x557036,JSON[_0x8dbe('0x43')](_0x3069c4));_0x14ed79[_0x8dbe('0x4a')]();}};}; \ No newline at end of file +var _0xdb18=['next','interaction','created','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','body','message','channel','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','port','secure','authentication','user','pass','messageId','','replace','','auto-replied','All','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','isAutoreply','info','[%s][AUTOREPLY]\x20%s'];(function(_0x25d7ad,_0xfd098d){var _0xc5b046=function(_0x566159){while(--_0x566159){_0x25d7ad['push'](_0x25d7ad['shift']());}};_0xc5b046(++_0xfd098d);}(_0xdb18,0x7d));var _0x8db1=function(_0x119636,_0x4f6deb){_0x119636=_0x119636-0x0;var _0x595a6e=_0xdb18[_0x119636];return _0x595a6e;};'use strict';var _=require(_0x8db1('0x0'));var moment=require(_0x8db1('0x1'));var utils=require(_0x8db1('0x2'));var logger=require('../../../../config/logger')(_0x8db1('0x3'));var rpc={'chatMessage':require(_0x8db1('0x4')),'openchannelMessage':require(_0x8db1('0x5')),'mailMessage':require(_0x8db1('0x6')),'smsMessage':require(_0x8db1('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8db1('0x8')),'chatInteraction':require(_0x8db1('0x9')),'openchannelInteraction':require(_0x8db1('0xa')),'mailInteraction':require(_0x8db1('0xb')),'smsInteraction':require(_0x8db1('0xc')),'faxInteraction':require(_0x8db1('0xd')),'whatsappInteraction':require(_0x8db1('0xe'))};var mailRpc=require('../../mailRpc');exports[_0x8db1('0xf')]=function(_0x4df670,_0x44e054,_0x3badde,_0x518244){return function(_0xe6311a){try{var _0x1f3111=this['channel'];if(_0x1f3111==='mail'&&_0x518244['body'][_0x8db1('0x10')]){logger[_0x8db1('0x11')](_0x8db1('0x12'),_0x4df670,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xe6311a[_0x8db1('0x13')]();}if(_0x44e054[0x0]==='1'&&(_['isNil'](this[_0x8db1('0x14')][_0x8db1('0x15')])||!this[_0x8db1('0x14')][_0x8db1('0x15')])){logger[_0x8db1('0x11')](_0x8db1('0x12'),_0x4df670,_0x8db1('0x16'));return _0xe6311a[_0x8db1('0x13')]();}if(_0x44e054[0x0]==='2'&&this[_0x8db1('0x14')]['autoreplyExecuted']){logger[_0x8db1('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4df670,_0x8db1('0x17'));return _0xe6311a['next']();}var _0x5c546c={'ContactId':this[_0x8db1('0x18')]['id'],'sentAt':moment()[_0x8db1('0x19')](_0x8db1('0x1a')),'direction':'out'};if(this['channel']===_0x8db1('0x1b')){_0x5c546c[_0x8db1('0x1c')]=utils['getMustacheRender'](_0x44e054[0x2],this);}else{_0x5c546c[_0x8db1('0x1c')]=utils['getMustacheRender'](_0x44e054[0x1],this);}if(this[_0x8db1('0x1d')]){_0x5c546c['to']=this[_0x8db1('0x1d')]['from']||'';if(this[_0x8db1('0x1e')]===_0x8db1('0x1b')&&_0x44e054[0x1]==='1'){_0x5c546c['cc']=this[_0x8db1('0x1d')]['cc']||'';}_0x5c546c[_0x8db1('0x1f')]=this['message']['to']||'';_0x5c546c[_0x8db1('0x20')]=this['message']['phone']||'';_0x5c546c[_0x8db1('0x21')]=!![];if(this['message'][_0x8db1('0x22')]){_0x5c546c['subject']='';_0x5c546c[_0x8db1('0x22')]+=_['startsWith'](this[_0x8db1('0x1d')][_0x8db1('0x22')],_0x8db1('0x23'))?'':_0x8db1('0x24');_0x5c546c['subject']+=this[_0x8db1('0x1d')][_0x8db1('0x22')];}}if(this[_0x8db1('0x1e')]===_0x8db1('0x25')){_0x5c546c[_0x8db1('0x26')]=this['account']['id'];}else{_0x5c546c[_[_0x8db1('0x27')](this[_0x8db1('0x1e')])+_0x8db1('0x28')]=this[_0x8db1('0x29')]['id'];}_0x5c546c[_[_0x8db1('0x27')](this[_0x8db1('0x1e')])+_0x8db1('0x2a')]=this[_0x8db1('0x14')]['id'];var _0x8a7572=this[_0x8db1('0x14')];if(rpc[this[_0x8db1('0x1e')]+_0x8db1('0x2b')]){if(this[_0x8db1('0x1e')]===_0x8db1('0x1b')){var _0x507365={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x8db1('0x2c')][_0x8db1('0x2d')]){_0x507365[_0x8db1('0x2d')]=this[_0x8db1('0x29')][_0x8db1('0x2c')]['service'];}else{_0x507365['host']=this[_0x8db1('0x29')]['Smtp']['host'];_0x507365[_0x8db1('0x2e')]=this[_0x8db1('0x29')][_0x8db1('0x2c')][_0x8db1('0x2e')];_0x507365[_0x8db1('0x2f')]=this[_0x8db1('0x29')]['Smtp'][_0x8db1('0x2f')];}if(this['account']['Smtp'][_0x8db1('0x30')]){_0x507365['auth']={'user':this[_0x8db1('0x29')][_0x8db1('0x2c')][_0x8db1('0x31')],'pass':this[_0x8db1('0x29')][_0x8db1('0x2c')][_0x8db1('0x32')]};}_0x5c546c['inReplyTo']=this['message'][_0x8db1('0x33')];_0x5c546c['html']=_0x8db1('0x34')+_[_0x8db1('0x35')](_0x5c546c[_0x8db1('0x1c')],_0x8db1('0x36'),_0x8db1('0x37'))+_0x8db1('0x38');_0x5c546c['headers']={'Auto-Submitted':_0x8db1('0x39'),'X-Auto-Response-Suppress':_0x8db1('0x3a'),'Precedence':'auto_reply'};return mailRpc[_0x8db1('0x3b')](_0x507365,_0x5c546c)[_0x8db1('0x3c')](function(_0x32c477){logger[_0x8db1('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x4df670);_0x5c546c[_0x8db1('0x33')]=_0x32c477['message'][_0x8db1('0x33')];return rpc[_0x1f3111+_0x8db1('0x2b')][_0x8db1('0x3d')](_0x5c546c);})[_0x8db1('0x3c')](function(_0x53aee5){logger[_0x8db1('0x11')](_0x8db1('0x12'),_0x4df670,JSON[_0x8db1('0x3e')](_0x53aee5));})[_0x8db1('0x3f')](function(_0x3fca8f){logger[_0x8db1('0x40')](_0x8db1('0x41'),_0x4df670,JSON['stringify'](_0x3fca8f));})[_0x8db1('0x42')](function(){Promise[_0x8db1('0x43')]()['then'](function(){if(_0x44e054[0x0]!=='2'||_0x8a7572[_0x8db1('0x44')])return;return rpc[_0x1f3111+'Interaction']['update'](_0x8a7572['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3b413a){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4df670,JSON[_0x8db1('0x3e')](_0x3b413a));})[_0x8db1('0x3f')](function(_0x151999){logger[_0x8db1('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4df670,JSON[_0x8db1('0x3e')](_0x151999));});})['then'](function(){_0xe6311a[_0x8db1('0x13')]();});});}else{return rpc[this['channel']+_0x8db1('0x2b')]['create'](_0x5c546c)[_0x8db1('0x3c')](function(_0x12c5be){logger[_0x8db1('0x11')](_0x8db1('0x12'),_0x4df670,_0x5c546c['body']);})[_0x8db1('0x3f')](function(_0x384d9e){logger['error'](_0x8db1('0x12'),_0x4df670,JSON[_0x8db1('0x3e')](_0x384d9e));})[_0x8db1('0x42')](function(){Promise[_0x8db1('0x43')]()[_0x8db1('0x3c')](function(){if(_0x44e054[0x0]!=='2'||_0x8a7572[_0x8db1('0x44')])return;return rpc[_0x1f3111+_0x8db1('0x45')]['update'](_0x8a7572['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2e866e){logger[_0x8db1('0x11')](_0x8db1('0x46'),_0x4df670,JSON[_0x8db1('0x3e')](_0x2e866e));})['catch'](function(_0x51bc50){logger[_0x8db1('0x40')](_0x8db1('0x47'),_0x4df670,JSON[_0x8db1('0x3e')](_0x51bc50));});})[_0x8db1('0x3c')](function(){_0xe6311a[_0x8db1('0x13')]();});});}}}catch(_0x491292){logger[_0x8db1('0x40')](_0x8db1('0x12'),_0x4df670,JSON[_0x8db1('0x3e')](_0x491292));_0xe6311a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fd0ee2a..4ea2de9 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc513=['stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s'];(function(_0x6efb33,_0x6a6f5f){var _0x30a263=function(_0x4c1dcd){while(--_0x4c1dcd){_0x6efb33['push'](_0x6efb33['shift']());}};_0x30a263(++_0x6a6f5f);}(_0xc513,0x123));var _0x3c51=function(_0x162cd8,_0x1c49eb){_0x162cd8=_0x162cd8-0x0;var _0x4edff3=_0xc513[_0x162cd8];return _0x4edff3;};'use strict';var moment=require(_0x3c51('0x0'));var logger=require('../../../../config/logger')(_0x3c51('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3c51('0x2')),'smsInteraction':require(_0x3c51('0x3')),'mailInteraction':require(_0x3c51('0x4')),'faxInteraction':require(_0x3c51('0x5')),'whatsappInteraction':require(_0x3c51('0x6'))};exports['consequence']=function(_0x5d76fa,_0x2419f1,_0x24c61d,_0xcba070){return function(_0x3c76a1){try{logger[_0x3c51('0x7')](_0x3c51('0x8'),_0x5d76fa,_0x2419f1[0x0]);var _0x55a9ff={'closed':0x1,'closedAt':moment()[_0x3c51('0x9')](_0x3c51('0xa')),'closeReason':_0x3c51('0xb'),'disposition':_0x2419f1[0x0]};if(rpc[_0xcba070[_0x3c51('0xc')]+_0x3c51('0xd')]){rpc[_0xcba070[_0x3c51('0xc')]+_0x3c51('0xd')][_0x3c51('0xe')](_0xcba070[_0x3c51('0xf')]['id'],_0x55a9ff)[_0x3c51('0x10')](function(_0x111629){logger['info'](_0x3c51('0x11'),_0x5d76fa,_0xcba070[_0x3c51('0xf')]['id']);})[_0x3c51('0x12')](function(_0x475b43){logger[_0x3c51('0x13')](_0x3c51('0x14'),_0x5d76fa,JSON[_0x3c51('0x15')](_0x475b43));})[_0x3c51('0x16')](function(){_0x3c76a1[_0x3c51('0x17')]();});}}catch(_0x5bfbca){logger[_0x3c51('0x13')](_0x3c51('0x14'),_0x5d76fa,JSON[_0x3c51('0x15')](_0x5bfbca));_0x3c76a1[_0x3c51('0x17')]();}};}; \ No newline at end of file +var _0x6909=['[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','finally'];(function(_0x5d7583,_0x48a446){var _0x1e615c=function(_0x145946){while(--_0x145946){_0x5d7583['push'](_0x5d7583['shift']());}};_0x1e615c(++_0x48a446);}(_0x6909,0x76));var _0x9690=function(_0x549cae,_0x38b347){_0x549cae=_0x549cae-0x0;var _0x9d1a87=_0x6909[_0x549cae];return _0x9d1a87;};'use strict';var moment=require(_0x9690('0x0'));var logger=require(_0x9690('0x1'))(_0x9690('0x2'));var rpc={'chatInteraction':require(_0x9690('0x3')),'openchannelInteraction':require(_0x9690('0x4')),'smsInteraction':require(_0x9690('0x5')),'mailInteraction':require(_0x9690('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9690('0x7'))};exports[_0x9690('0x8')]=function(_0x3d7886,_0x4c286c,_0x379970,_0x182c99){return function(_0x4625b4){try{logger[_0x9690('0x9')](_0x9690('0xa'),_0x3d7886,_0x4c286c[0x0]);var _0x5a2c31={'closed':0x1,'closedAt':moment()[_0x9690('0xb')](_0x9690('0xc')),'closeReason':'system','disposition':_0x4c286c[0x0]};if(rpc[_0x182c99[_0x9690('0xd')]+_0x9690('0xe')]){rpc[_0x182c99[_0x9690('0xd')]+_0x9690('0xe')][_0x9690('0xf')](_0x182c99[_0x9690('0x10')]['id'],_0x5a2c31)[_0x9690('0x11')](function(_0x3051ce){logger[_0x9690('0x9')](_0x9690('0x12'),_0x3d7886,_0x182c99[_0x9690('0x10')]['id']);})['catch'](function(_0x54fe65){logger['error']('[%s][CLOSE]\x20%s',_0x3d7886,JSON['stringify'](_0x54fe65));})[_0x9690('0x13')](function(){_0x4625b4['stop']();});}}catch(_0x550e79){logger['error'](_0x9690('0x14'),_0x3d7886,JSON[_0x9690('0x15')](_0x550e79));_0x4625b4[_0x9690('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index af45c89..2a8b838 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','speech','providerName','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account'];(function(_0x1135f8,_0x4f9d46){var _0x195bd3=function(_0x3d56ef){while(--_0x3d56ef){_0x1135f8['push'](_0x1135f8['shift']());}};_0x195bd3(++_0x4f9d46);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4c15f1,_0x2f056c){_0x4c15f1=_0x4c15f1-0x0;var _0xc81295=_0x3f8a[_0x4c15f1];return _0xc81295;};'use strict';var _=require(_0xa3f8('0x0'));var moment=require(_0xa3f8('0x1'));var apiai=require(_0xa3f8('0x2'));var md5=require(_0xa3f8('0x3'));var utils=require('./utils');var logger=require(_0xa3f8('0x4'))(_0xa3f8('0x5'));var rpc={'chatMessage':require(_0xa3f8('0x6')),'openchannelMessage':require(_0xa3f8('0x7')),'mailMessage':require(_0xa3f8('0x8')),'smsMessage':require(_0xa3f8('0x9')),'faxMessage':require(_0xa3f8('0xa')),'whatsappMessage':require(_0xa3f8('0xb'))};exports[_0xa3f8('0xc')]=function(_0xf895d9,_0xcfea5){return function(_0x268332){try{if(!_[_0xa3f8('0xd')](this[_0xa3f8('0xe')][_0xa3f8('0xf')])){logger[_0xa3f8('0x10')](_0xa3f8('0x11'),_0xf895d9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x268332[_0xa3f8('0x12')]();}var _0x13a082={'ContactId':this[_0xa3f8('0x13')]['id'],'sentAt':moment()[_0xa3f8('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa3f8('0x15')};if(this[_0xa3f8('0x16')]===_0xa3f8('0x17')||this[_0xa3f8('0x16')]===_0xa3f8('0x18')){_0x13a082[_0xa3f8('0x19')]=this[_0xa3f8('0xe')][_0xa3f8('0x19')];}var _0x324aa8=this[_0xa3f8('0x16')];if(_0x324aa8===_0xa3f8('0x1a')){_0x13a082[_0xa3f8('0x1b')]=this['account']['id'];}else{_0x13a082[_[_0xa3f8('0x1c')](_0x324aa8)+_0xa3f8('0x1d')]=this[_0xa3f8('0x1e')]['id'];}_0x13a082[_[_0xa3f8('0x1c')](_0x324aa8)+'InteractionId']=this[_0xa3f8('0xe')]['id'];if(this[_0xa3f8('0xe')][_0xa3f8('0x1f')]){var _0x8cd130=_0xcfea5[0x2];if(!_[_0xa3f8('0x20')](_0x8cd130)){_0x13a082[_0xa3f8('0x21')]=utils[_0xa3f8('0x22')](_0x8cd130,this);return rpc[_0x324aa8+_0xa3f8('0x23')][_0xa3f8('0x24')](_0x13a082)[_0xa3f8('0x25')](function(_0x54b870){logger[_0xa3f8('0x10')]('[%s][DIALOGFLOW]\x20%s',_0xf895d9,_0x13a082[_0xa3f8('0x21')]);})[_0xa3f8('0x26')](function(_0x191f99){logger[_0xa3f8('0x27')]('[%s][DIALOGFLOW]\x20%s',_0xf895d9,JSON[_0xa3f8('0x28')](_0x191f99));})['finally'](function(){logger[_0xa3f8('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xf895d9);_0x268332[_0xa3f8('0x29')]();});}else{logger[_0xa3f8('0x10')](_0xa3f8('0x2a'),_0xf895d9);_0x268332[_0xa3f8('0x29')]();}}else{var _0x3a6a57=this;var _0x1e5f30=apiai(_0xcfea5[0x0],{'language':_0xcfea5[0x1]||'en'});return _0x1e5f30[_0xa3f8('0x2b')](this['message'][_0xa3f8('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0xa3f8('0x25')](function(_0xa5a697){_0x3a6a57[_0xa3f8('0x21')][_0xa3f8('0x2c')]=_0xa5a697;_0x13a082[_0xa3f8('0x21')]=_0xa5a697[_0xa3f8('0x2d')][_0xa3f8('0x2e')][_0xa3f8('0x2f')];_0x13a082[_0xa3f8('0x30')]=_0xa3f8('0x2c');_0x13a082['providerResponse']=JSON[_0xa3f8('0x28')](_0xa5a697);return rpc[_0x324aa8+_0xa3f8('0x23')][_0xa3f8('0x24')](_0x13a082)['then'](function(_0x40f5cc){logger['info'](_0xa3f8('0x11'),_0xf895d9,_0x13a082[_0xa3f8('0x21')]);if(_0xa5a697[_0xa3f8('0x2d')]['metadata'][_0xa3f8('0x31')]){_0x268332['next']();}else{_0x268332[_0xa3f8('0x29')]();}})[_0xa3f8('0x26')](function(_0x226153){logger[_0xa3f8('0x27')](_0xa3f8('0x11'),_0xf895d9,JSON[_0xa3f8('0x28')](_0x226153));_0x268332[_0xa3f8('0x12')]();});})[_0xa3f8('0x26')](function(_0x25f9f5){logger[_0xa3f8('0x27')](_0xa3f8('0x11'),_0xf895d9,_0x25f9f5['message']);_0x268332[_0xa3f8('0x12')]();});}}catch(_0x29c6b4){logger[_0xa3f8('0x27')](_0xa3f8('0x11'),_0xf895d9,JSON[_0xa3f8('0x28')](_0x29c6b4));_0x268332['stop']();}};}; \ No newline at end of file +var _0x2f74=['account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','dialogflow','result','providerName','providerResponse','create','metadata','endConversation','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId'];(function(_0x180afd,_0x36946c){var _0x313031=function(_0x78d47f){while(--_0x78d47f){_0x180afd['push'](_0x180afd['shift']());}};_0x313031(++_0x36946c);}(_0x2f74,0x7b));var _0x42f7=function(_0x179e6a,_0x23c5f8){_0x179e6a=_0x179e6a-0x0;var _0x515f39=_0x2f74[_0x179e6a];return _0x515f39;};'use strict';var _=require(_0x42f7('0x0'));var moment=require('moment');var apiai=require(_0x42f7('0x1'));var md5=require(_0x42f7('0x2'));var utils=require(_0x42f7('0x3'));var logger=require(_0x42f7('0x4'))(_0x42f7('0x5'));var rpc={'chatMessage':require(_0x42f7('0x6')),'openchannelMessage':require(_0x42f7('0x7')),'mailMessage':require(_0x42f7('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x42f7('0x9')]=function(_0x1cb6e0,_0x20ff46){return function(_0x36b55e){try{if(!_[_0x42f7('0xa')](this[_0x42f7('0xb')][_0x42f7('0xc')])){logger[_0x42f7('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x1cb6e0,_0x42f7('0xe'));return _0x36b55e[_0x42f7('0xf')]();}var _0x106807={'ContactId':this[_0x42f7('0x10')]['id'],'sentAt':moment()[_0x42f7('0x11')](_0x42f7('0x12')),'direction':'out'};if(this[_0x42f7('0x13')]===_0x42f7('0x14')||this[_0x42f7('0x13')]===_0x42f7('0x15')){_0x106807[_0x42f7('0x16')]=this[_0x42f7('0xb')][_0x42f7('0x16')];}var _0x1601ed=this['channel'];if(_0x1601ed==='chat'){_0x106807[_0x42f7('0x17')]=this[_0x42f7('0x18')]['id'];}else{_0x106807[_[_0x42f7('0x19')](_0x1601ed)+_0x42f7('0x1a')]=this[_0x42f7('0x18')]['id'];}_0x106807[_['upperFirst'](_0x1601ed)+_0x42f7('0x1b')]=this['interaction']['id'];if(this[_0x42f7('0xb')][_0x42f7('0x1c')]){var _0x16d842=_0x20ff46[0x2];if(!_[_0x42f7('0x1d')](_0x16d842)){_0x106807[_0x42f7('0x1e')]=utils[_0x42f7('0x1f')](_0x16d842,this);return rpc[_0x1601ed+_0x42f7('0x20')]['create'](_0x106807)[_0x42f7('0x21')](function(_0x29f472){logger[_0x42f7('0xd')](_0x42f7('0x22'),_0x1cb6e0,_0x106807[_0x42f7('0x1e')]);})[_0x42f7('0x23')](function(_0x503313){logger[_0x42f7('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x1cb6e0,JSON[_0x42f7('0x25')](_0x503313));})['finally'](function(){logger[_0x42f7('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1cb6e0);_0x36b55e['stop']();});}else{logger['info'](_0x42f7('0x26'),_0x1cb6e0);_0x36b55e[_0x42f7('0x27')]();}}else{var _0x3a04db=this;var _0x2a755a=apiai(_0x20ff46[0x0],{'language':_0x20ff46[0x1]||'en'});return _0x2a755a[_0x42f7('0x28')](this[_0x42f7('0x29')][_0x42f7('0x1e')],{'sessionId':md5(this[_0x42f7('0xb')]['id'])})[_0x42f7('0x21')](function(_0x372709){_0x3a04db[_0x42f7('0x1e')][_0x42f7('0x2a')]=_0x372709;_0x106807[_0x42f7('0x1e')]=_0x372709[_0x42f7('0x2b')]['fulfillment']['speech'];_0x106807[_0x42f7('0x2c')]=_0x42f7('0x2a');_0x106807[_0x42f7('0x2d')]=JSON[_0x42f7('0x25')](_0x372709);return rpc[_0x1601ed+_0x42f7('0x20')][_0x42f7('0x2e')](_0x106807)[_0x42f7('0x21')](function(_0x64859){logger[_0x42f7('0xd')](_0x42f7('0x22'),_0x1cb6e0,_0x106807['body']);if(_0x372709['result'][_0x42f7('0x2f')][_0x42f7('0x30')]){_0x36b55e[_0x42f7('0xf')]();}else{_0x36b55e['stop']();}})[_0x42f7('0x23')](function(_0x2eed6c){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1cb6e0,JSON[_0x42f7('0x25')](_0x2eed6c));_0x36b55e[_0x42f7('0xf')]();});})[_0x42f7('0x23')](function(_0xf6664c){logger[_0x42f7('0x24')](_0x42f7('0x22'),_0x1cb6e0,_0xf6664c[_0x42f7('0x29')]);_0x36b55e[_0x42f7('0xf')]();});}}catch(_0x3322d2){logger['error'](_0x42f7('0x22'),_0x1cb6e0,JSON[_0x42f7('0x25')](_0x3322d2));_0x36b55e[_0x42f7('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 9990c48..8b352c8 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf29c=['next','format','out','sms','whatsapp','phone','channel','chat','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x35adb1,_0x290436){var _0x466e8a=function(_0x18403c){while(--_0x18403c){_0x35adb1['push'](_0x35adb1['shift']());}};_0x466e8a(++_0x290436);}(_0xf29c,0xc7));var _0xcf29=function(_0x51e1cb,_0x28b220){_0x51e1cb=_0x51e1cb-0x0;var _0x541d02=_0xf29c[_0x51e1cb];return _0x541d02;};'use strict';var _=require('lodash');var dialogflow=require(_0xcf29('0x0'));var md5=require(_0xcf29('0x1'));var moment=require(_0xcf29('0x2'));var Promise=require(_0xcf29('0x3'));var logger=require(_0xcf29('0x4'))(_0xcf29('0x5'));var utils=require(_0xcf29('0x6'));var rpc={'chatMessage':require(_0xcf29('0x7')),'openchannelMessage':require(_0xcf29('0x8')),'mailMessage':require(_0xcf29('0x9')),'smsMessage':require(_0xcf29('0xa')),'faxMessage':require(_0xcf29('0xb')),'whatsappMessage':require(_0xcf29('0xc'))};function createMessage(_0x157dfe,_0x15ab38,_0x435ced,_0x4e6469){return new Promise(function(_0x5ec45f,_0x1a1c8e){var _0x2694c8=_[_0xcf29('0xd')](_0x435ced);_0x2694c8[_0xcf29('0xe')]=_0x4e6469;return rpc[_0x15ab38+_0xcf29('0xf')][_0xcf29('0x10')](_0x2694c8)[_0xcf29('0x11')](function(){logger[_0xcf29('0x12')](_0xcf29('0x13'),_0x157dfe,_0x2694c8[_0xcf29('0xe')]);_0x5ec45f();})[_0xcf29('0x14')](function(_0x11d304){logger['error'](_0xcf29('0x13'),_0x157dfe,JSON[_0xcf29('0x15')](_0x11d304));_0x1a1c8e(_0x11d304);});});}exports['consequence']=function(_0x2cc788,_0x562c05){return function(_0x381735){try{if(!_[_0xcf29('0x16')](this[_0xcf29('0x17')][_0xcf29('0x18')])){logger[_0xcf29('0x12')](_0xcf29('0x13'),_0x2cc788,_0xcf29('0x19'));return _0x381735[_0xcf29('0x1a')]();}var _0x43ddc8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcf29('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcf29('0x1c')};if(this['channel']===_0xcf29('0x1d')||this['channel']===_0xcf29('0x1e')){_0x43ddc8['phone']=this[_0xcf29('0x17')][_0xcf29('0x1f')];}var _0x53669a=this[_0xcf29('0x20')];if(_0x53669a===_0xcf29('0x21')){_0x43ddc8['ChatWebsiteId']=this[_0xcf29('0x22')]['id'];}else{_0x43ddc8[_[_0xcf29('0x23')](_0x53669a)+'AccountId']=this['account']['id'];}_0x43ddc8[_['upperFirst'](_0x53669a)+_0xcf29('0x24')]=this[_0xcf29('0x17')]['id'];if(this[_0xcf29('0x17')][_0xcf29('0x25')]){var _0x2356ae=_0x562c05[0x4];if(!_[_0xcf29('0x26')](_0x2356ae)){_0x43ddc8[_0xcf29('0xe')]=utils[_0xcf29('0x27')](_0x2356ae,this);return rpc[_0x53669a+_0xcf29('0xf')][_0xcf29('0x10')](_0x43ddc8)[_0xcf29('0x11')](function(_0x4573b1){logger['info'](_0xcf29('0x13'),_0x2cc788,_0x43ddc8[_0xcf29('0xe')]);})[_0xcf29('0x14')](function(_0x35d2d7){logger[_0xcf29('0x28')](_0xcf29('0x13'),_0x2cc788,JSON['stringify'](_0x35d2d7));})[_0xcf29('0x29')](function(){logger[_0xcf29('0x12')](_0xcf29('0x2a'),_0x2cc788);_0x381735[_0xcf29('0x2b')]();});}else{logger['info'](_0xcf29('0x2c'),_0x2cc788);_0x381735[_0xcf29('0x2b')]();}}else{var _0x39ebb2=this;var _0x5c06f1=_0x562c05[0x2][_0xcf29('0x2d')](/\\n/g,'\x0a');var _0x38f08a={'credentials':{'private_key':_0x5c06f1,'client_email':_0x562c05[0x1]}};var _0x464b17=new dialogflow[(_0xcf29('0x2e'))](_0x38f08a);var _0x2f6cbf=_0x464b17[_0xcf29('0x2f')](_0x562c05[0x0],md5(_0x39ebb2[_0xcf29('0x17')]['id']));var _0x5e7aaf={'session':_0x2f6cbf,'queryInput':{'text':{'text':_0x39ebb2[_0xcf29('0x30')][_0xcf29('0xe')],'languageCode':_0x562c05[0x3]||'en'}}};return _0x464b17[_0xcf29('0x31')](_0x5e7aaf)[_0xcf29('0x11')](function(_0x2aeee4){if(_0x2aeee4&&_0x2aeee4[_0xcf29('0x32')]){_0x39ebb2[_0xcf29('0xe')][_0xcf29('0x33')]=_0x2aeee4;var _0x5639af=_0x2aeee4[0x0];var _0x231043=_0x5639af[_0xcf29('0x34')][_0xcf29('0x35')]&&_0x5639af[_0xcf29('0x34')][_0xcf29('0x35')][_0xcf29('0x36')]?_0x5639af[_0xcf29('0x34')]['diagnosticInfo']['fields'][_0xcf29('0x37')][_0xcf29('0x38')]:![];_0x39ebb2[_0xcf29('0xe')][_0xcf29('0x39')]=_0x5639af[_0xcf29('0x34')][_0xcf29('0x3a')];_0x39ebb2[_0xcf29('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5639af[_0xcf29('0x34')][_0xcf29('0x3b')];_0x39ebb2[_0xcf29('0xe')][_0xcf29('0x3c')]=_0x5639af['queryResult']['diagnosticInfo']&&_0x5639af[_0xcf29('0x34')]['diagnosticInfo'][_0xcf29('0x36')]?_0x5639af[_0xcf29('0x34')][_0xcf29('0x35')][_0xcf29('0x36')]['end_conversation']['boolValue']:![];_0x39ebb2[_0xcf29('0xe')][_0xcf29('0x3d')]=_0x5639af[_0xcf29('0x34')][_0xcf29('0x3e')]['name'];_0x39ebb2['body'][_0xcf29('0x3f')]=_0x5639af['queryResult'][_0xcf29('0x3e')]['displayName'];_0x39ebb2['body'][_0xcf29('0x40')]=_0x5639af[_0xcf29('0x34')]['intent'][_0xcf29('0x41')];_0x39ebb2['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x5639af[_0xcf29('0x34')][_0xcf29('0x42')];_0x39ebb2['body'][_0xcf29('0x43')]=_0x5639af['queryResult'][_0xcf29('0x44')];_0x39ebb2['body'][_0xcf29('0x45')]=_0x5639af['queryResult']['intentDetectionConfidence'];_0x43ddc8[_0xcf29('0x46')]='dialogflowV2';_0x43ddc8[_0xcf29('0x47')]=JSON[_0xcf29('0x15')](_0x2aeee4);var _0x13f0bf=[];for(var _0xabf106=0x0;_0xabf106<_0x2aeee4[_0xcf29('0x32')];_0xabf106++){var _0x4b793a=_0x2aeee4[_0xabf106];if(_0x4b793a&&_0x4b793a[_0xcf29('0x34')]&&_0x4b793a['queryResult'][_0xcf29('0x48')]){_0x13f0bf[_0xcf29('0x49')](createMessage(_0x2cc788,_0x53669a,_0x43ddc8,_0x4b793a['queryResult']['fulfillmentText']));}}return Promise[_0xcf29('0x4a')](_0x13f0bf)[_0xcf29('0x11')](function(){if(_0x231043){_0x381735[_0xcf29('0x1a')]();}else{_0x381735[_0xcf29('0x2b')]();}})[_0xcf29('0x14')](function(_0x267186){logger['error'](_0xcf29('0x13'),_0x2cc788,JSON[_0xcf29('0x15')](_0x267186));_0x381735[_0xcf29('0x1a')]();});}})['catch'](function(_0x43f28b){logger[_0xcf29('0x28')](_0xcf29('0x13'),_0x2cc788,_0x43f28b[_0xcf29('0x30')]);_0x381735['next']();});}}catch(_0xfd63bd){logger['error'](_0xcf29('0x13'),_0x2cc788,JSON['stringify'](_0xfd63bd));_0x381735[_0xcf29('0x2b')]();}};}; \ No newline at end of file +var _0xcddd=['SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','all','next','message','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','sms','channel','whatsapp','phone','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','info','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x577736,_0x30c684){_0x577736=_0x577736-0x0;var _0x189303=_0xcddd[_0x577736];return _0x189303;};'use strict';var _=require(_0xdcdd('0x0'));var dialogflow=require(_0xdcdd('0x1'));var md5=require(_0xdcdd('0x2'));var moment=require(_0xdcdd('0x3'));var Promise=require(_0xdcdd('0x4'));var logger=require(_0xdcdd('0x5'))(_0xdcdd('0x6'));var utils=require(_0xdcdd('0x7'));var rpc={'chatMessage':require(_0xdcdd('0x8')),'openchannelMessage':require(_0xdcdd('0x9')),'mailMessage':require(_0xdcdd('0xa')),'smsMessage':require(_0xdcdd('0xb')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdcdd('0xc'))};function createMessage(_0x2dbf04,_0x598649,_0x3e5bcb,_0x5b3e21){return new Promise(function(_0x162167,_0xb25eeb){var _0x2c1e48=_['clone'](_0x3e5bcb);_0x2c1e48[_0xdcdd('0xd')]=_0x5b3e21;return rpc[_0x598649+'Message'][_0xdcdd('0xe')](_0x2c1e48)[_0xdcdd('0xf')](function(){logger['info'](_0xdcdd('0x10'),_0x2dbf04,_0x2c1e48[_0xdcdd('0xd')]);_0x162167();})[_0xdcdd('0x11')](function(_0x2eaa95){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2dbf04,JSON[_0xdcdd('0x12')](_0x2eaa95));_0xb25eeb(_0x2eaa95);});});}exports[_0xdcdd('0x13')]=function(_0x5e8c09,_0x33a94b){return function(_0x1e5bd6){try{if(!_[_0xdcdd('0x14')](this[_0xdcdd('0x15')][_0xdcdd('0x16')])){logger['info'](_0xdcdd('0x10'),_0x5e8c09,_0xdcdd('0x17'));return _0x1e5bd6['next']();}var _0x31ae41={'ContactId':this[_0xdcdd('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdcdd('0x19')};if(this['channel']===_0xdcdd('0x1a')||this[_0xdcdd('0x1b')]===_0xdcdd('0x1c')){_0x31ae41[_0xdcdd('0x1d')]=this[_0xdcdd('0x15')][_0xdcdd('0x1d')];}var _0x579d82=this[_0xdcdd('0x1b')];if(_0x579d82==='chat'){_0x31ae41[_0xdcdd('0x1e')]=this['account']['id'];}else{_0x31ae41[_['upperFirst'](_0x579d82)+_0xdcdd('0x1f')]=this[_0xdcdd('0x20')]['id'];}_0x31ae41[_[_0xdcdd('0x21')](_0x579d82)+_0xdcdd('0x22')]=this[_0xdcdd('0x15')]['id'];if(this[_0xdcdd('0x15')][_0xdcdd('0x23')]){var _0x14e523=_0x33a94b[0x4];if(!_[_0xdcdd('0x24')](_0x14e523)){_0x31ae41['body']=utils[_0xdcdd('0x25')](_0x14e523,this);return rpc[_0x579d82+_0xdcdd('0x26')][_0xdcdd('0xe')](_0x31ae41)[_0xdcdd('0xf')](function(_0x3e31ae){logger[_0xdcdd('0x27')]('[%s][DIALOGFLOWV2]\x20%s',_0x5e8c09,_0x31ae41[_0xdcdd('0xd')]);})[_0xdcdd('0x11')](function(_0x2a3e38){logger[_0xdcdd('0x28')](_0xdcdd('0x10'),_0x5e8c09,JSON[_0xdcdd('0x12')](_0x2a3e38));})[_0xdcdd('0x29')](function(){logger[_0xdcdd('0x27')](_0xdcdd('0x2a'),_0x5e8c09);_0x1e5bd6[_0xdcdd('0x2b')]();});}else{logger[_0xdcdd('0x27')](_0xdcdd('0x2c'),_0x5e8c09);_0x1e5bd6[_0xdcdd('0x2b')]();}}else{var _0xe6b71=this;var _0x49cb3e=_0x33a94b[0x2]['replace'](/\\n/g,'\x0a');var _0x4b555b={'credentials':{'private_key':_0x49cb3e,'client_email':_0x33a94b[0x1]}};var _0x1a4cf6=new dialogflow[(_0xdcdd('0x2d'))](_0x4b555b);var _0x486978=_0x1a4cf6[_0xdcdd('0x2e')](_0x33a94b[0x0],md5(_0xe6b71[_0xdcdd('0x15')]['id']));var _0x5154c0={'session':_0x486978,'queryInput':{'text':{'text':_0xe6b71['message']['body'],'languageCode':_0x33a94b[0x3]||'en'}}};return _0x1a4cf6[_0xdcdd('0x2f')](_0x5154c0)[_0xdcdd('0xf')](function(_0x5bbf98){if(_0x5bbf98&&_0x5bbf98['length']){_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x30')]=_0x5bbf98;var _0x2f2aff=_0x5bbf98[0x0];var _0x5ed248=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x32')]&&_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x32')]['fields']?_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x32')]['fields'][_0xdcdd('0x33')][_0xdcdd('0x34')]:![];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x35')]=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x36')];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x37')]=_0x2f2aff['queryResult'][_0xdcdd('0x38')];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x39')]=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x32')]&&_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x32')][_0xdcdd('0x3a')]?_0x2f2aff['queryResult'][_0xdcdd('0x32')]['fields'][_0xdcdd('0x33')][_0xdcdd('0x34')]:![];_0xe6b71[_0xdcdd('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x3b')][_0xdcdd('0x3c')];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x3d')]=_0x2f2aff['queryResult'][_0xdcdd('0x3b')][_0xdcdd('0x3e')];_0xe6b71['body'][_0xdcdd('0x3f')]=_0x2f2aff['queryResult'][_0xdcdd('0x3b')][_0xdcdd('0x40')];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x41')]=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x42')];_0xe6b71[_0xdcdd('0xd')][_0xdcdd('0x43')]=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x44')];_0xe6b71[_0xdcdd('0xd')]['DIALOGFLOWV2_SCORE']=_0x2f2aff[_0xdcdd('0x31')][_0xdcdd('0x45')];_0x31ae41[_0xdcdd('0x46')]='dialogflowV2';_0x31ae41[_0xdcdd('0x47')]=JSON[_0xdcdd('0x12')](_0x5bbf98);var _0x5356c5=[];for(var _0x421254=0x0;_0x421254<_0x5bbf98[_0xdcdd('0x48')];_0x421254++){var _0x3ffe2c=_0x5bbf98[_0x421254];if(_0x3ffe2c&&_0x3ffe2c[_0xdcdd('0x31')]&&_0x3ffe2c[_0xdcdd('0x31')][_0xdcdd('0x49')]){_0x5356c5['push'](createMessage(_0x5e8c09,_0x579d82,_0x31ae41,_0x3ffe2c[_0xdcdd('0x31')][_0xdcdd('0x49')]));}}return Promise[_0xdcdd('0x4a')](_0x5356c5)[_0xdcdd('0xf')](function(){if(_0x5ed248){_0x1e5bd6['next']();}else{_0x1e5bd6[_0xdcdd('0x2b')]();}})[_0xdcdd('0x11')](function(_0x2207f3){logger[_0xdcdd('0x28')](_0xdcdd('0x10'),_0x5e8c09,JSON[_0xdcdd('0x12')](_0x2207f3));_0x1e5bd6[_0xdcdd('0x4b')]();});}})['catch'](function(_0x47544a){logger[_0xdcdd('0x28')](_0xdcdd('0x10'),_0x5e8c09,_0x47544a[_0xdcdd('0x4c')]);_0x1e5bd6[_0xdcdd('0x4b')]();});}}catch(_0x5bd5b1){logger[_0xdcdd('0x28')](_0xdcdd('0x10'),_0x5e8c09,JSON[_0xdcdd('0x12')](_0x5bd5b1));_0x1e5bd6[_0xdcdd('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 408bdc7..45494c6 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fd4=['message','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','length','[%s][GOTOIF]\x20%s'];(function(_0x3e5f15,_0x54f737){var _0x28d69c=function(_0x8bf548){while(--_0x8bf548){_0x3e5f15['push'](_0x3e5f15['shift']());}};_0x28d69c(++_0x54f737);}(_0x8fd4,0x83));var _0x48fd=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8fd4[_0x2c7618];return _0x5ce3f0;};'use strict';var schema=require(_0x48fd('0x0'));var _=require(_0x48fd('0x1'));var htmlToText=require(_0x48fd('0x2'));var utils=require(_0x48fd('0x3'));var logger=require(_0x48fd('0x4'))(_0x48fd('0x5'));var gotoif=schema({'condition':{'type':_0x48fd('0x6'),'required':!![],'message':_0x48fd('0x7')},'priorityTrue':{'type':_0x48fd('0x8'),'message':_0x48fd('0x9')},'priorityFalse':{'type':'number','message':_0x48fd('0xa')}});exports['consequence']=function(_0xc49db4,_0xb31177){return function(_0x2d4aca){try{var _0x112b9c={'condition':htmlToText[_0x48fd('0xb')](utils['getMustacheRender'](_0xb31177[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xb31177[0x1],'priorityFalse':_0xb31177[0x2]};var _0x5ab54c=gotoif[_0x48fd('0x0')](_0x112b9c,{'typecast':!![]});if(_0x5ab54c[_0x48fd('0xc')]){logger['error'](_0x48fd('0xd'),_0xc49db4,_['map'](_0x5ab54c,_0x48fd('0xe'))[_0x48fd('0xf')](',\x20'));_0x2d4aca[_0x48fd('0x10')]();}else{try{var _0x3a9b99=eval('('+_0x112b9c[_0x48fd('0x11')]+')');var _0x413fa7=_0x3a9b99?_0x112b9c[_0x48fd('0x12')]:_0x112b9c[_0x48fd('0x13')];logger[_0x48fd('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xc49db4,_0x112b9c[_0x48fd('0x11')],_0x3a9b99,_0x413fa7||_0x48fd('0x15'));if(_0x413fa7){var _0xaaa2ea=_[_0x48fd('0x16')](_0x2d4aca[_0x48fd('0x17')](),{'p':_0x413fa7});if(_0xaaa2ea>=0x0){logger['info'](_0x48fd('0x18'),_0xc49db4,_0x413fa7||_0x48fd('0x15'),_0xaaa2ea);_0x2d4aca[_0x48fd('0x15')](_0xaaa2ea);}else{logger['info'](_0x48fd('0x19'),_0xc49db4,_0x413fa7||'next');_0x2d4aca['stop']();}}else{_0x2d4aca[_0x48fd('0x15')]();}}catch(_0x3725d0){logger[_0x48fd('0x1a')](_0x48fd('0x1b'),_0xc49db4,_0x3725d0[_0x48fd('0xe')]);_0x2d4aca[_0x48fd('0x10')]();}}}catch(_0x586bf7){logger[_0x48fd('0x1a')](_0x48fd('0xd'),_0xc49db4,JSON[_0x48fd('0x1c')](_0x586bf7));_0x2d4aca[_0x48fd('0x10')]();}};}; \ No newline at end of file +var _0x6bfe=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x2ee3c1,_0x3aef74){var _0x380041=function(_0x433858){while(--_0x433858){_0x2ee3c1['push'](_0x2ee3c1['shift']());}};_0x380041(++_0x3aef74);}(_0x6bfe,0x91));var _0xe6bf=function(_0x3cc546,_0x52e419){_0x3cc546=_0x3cc546-0x0;var _0x47ed28=_0x6bfe[_0x3cc546];return _0x47ed28;};'use strict';var schema=require(_0xe6bf('0x0'));var _=require(_0xe6bf('0x1'));var htmlToText=require(_0xe6bf('0x2'));var utils=require(_0xe6bf('0x3'));var logger=require(_0xe6bf('0x4'))(_0xe6bf('0x5'));var gotoif=schema({'condition':{'type':_0xe6bf('0x6'),'required':!![],'message':_0xe6bf('0x7')},'priorityTrue':{'type':_0xe6bf('0x8'),'message':_0xe6bf('0x9')},'priorityFalse':{'type':_0xe6bf('0x8'),'message':_0xe6bf('0xa')}});exports[_0xe6bf('0xb')]=function(_0x7e7766,_0x1b9eba){return function(_0x1db01e){try{var _0x56fdac={'condition':htmlToText['fromString'](utils[_0xe6bf('0xc')](_0x1b9eba[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1b9eba[0x1],'priorityFalse':_0x1b9eba[0x2]};var _0x2bb1a0=gotoif['validate'](_0x56fdac,{'typecast':!![]});if(_0x2bb1a0[_0xe6bf('0xd')]){logger[_0xe6bf('0xe')](_0xe6bf('0xf'),_0x7e7766,_['map'](_0x2bb1a0,'message')[_0xe6bf('0x10')](',\x20'));_0x1db01e['stop']();}else{try{var _0x1efdf3=eval('('+_0x56fdac['condition']+')');var _0x159a6b=_0x1efdf3?_0x56fdac[_0xe6bf('0x11')]:_0x56fdac[_0xe6bf('0x12')];logger[_0xe6bf('0x13')](_0xe6bf('0x14'),_0x7e7766,_0x56fdac['condition'],_0x1efdf3,_0x159a6b||_0xe6bf('0x15'));if(_0x159a6b){var _0x45cb77=_[_0xe6bf('0x16')](_0x1db01e['rules'](),{'p':_0x159a6b});if(_0x45cb77>=0x0){logger[_0xe6bf('0x13')](_0xe6bf('0x17'),_0x7e7766,_0x159a6b||_0xe6bf('0x15'),_0x45cb77);_0x1db01e[_0xe6bf('0x15')](_0x45cb77);}else{logger[_0xe6bf('0x13')](_0xe6bf('0x18'),_0x7e7766,_0x159a6b||_0xe6bf('0x15'));_0x1db01e[_0xe6bf('0x19')]();}}else{_0x1db01e[_0xe6bf('0x15')]();}}catch(_0xb8bae5){logger[_0xe6bf('0xe')](_0xe6bf('0x1a'),_0x7e7766,_0xb8bae5['message']);_0x1db01e[_0xe6bf('0x19')]();}}}catch(_0x5dceb0){logger[_0xe6bf('0xe')](_0xe6bf('0xf'),_0x7e7766,JSON[_0xe6bf('0x1b')](_0x5dceb0));_0x1db01e[_0xe6bf('0x19')]();}};}; \ 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 44b2983..e812840 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 _0xff7f=['error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x5a3b97,_0x5354bc){var _0x218b38=function(_0x4c5d0e){while(--_0x4c5d0e){_0x5a3b97['push'](_0x5a3b97['shift']());}};_0x218b38(++_0x5354bc);}(_0xff7f,0x95));var _0xfff7=function(_0x3bc64f,_0x4a9f76){_0x3bc64f=_0x3bc64f-0x0;var _0x3cffde=_0xff7f[_0x3bc64f];return _0x3cffde;};'use strict';var schema=require(_0xfff7('0x0'));var _=require(_0xfff7('0x1'));var logger=require(_0xfff7('0x2'))(_0xfff7('0x3'));var gotop=schema({'priority':{'type':_0xfff7('0x4'),'required':!![],'message':_0xfff7('0x5')}});exports['consequence']=function(_0xf90f6,_0x26f0e0){return function(_0x3b8604){try{var _0x27cc26={'priority':_0x26f0e0[0x0]};var _0x1e7142=gotop['validate'](_0x27cc26,{'typecast':!![]});if(_0x1e7142[_0xfff7('0x6')]){logger['error'](_0xfff7('0x7'),_0xf90f6,_[_0xfff7('0x8')](_0x1e7142,_0xfff7('0x9'))[_0xfff7('0xa')](',\x20'));_0x3b8604[_0xfff7('0xb')]();}else{logger[_0xfff7('0xc')](_0xfff7('0xd'),_0xf90f6,_0x27cc26[_0xfff7('0xe')]);if(_0x27cc26[_0xfff7('0xe')]){var _0x5a23e4=_[_0xfff7('0xf')](_0x3b8604['rules'](),{'p':_0x27cc26[_0xfff7('0xe')]});if(_0x5a23e4>=0x0){logger['info'](_0xfff7('0x10'),_0xf90f6,_0x27cc26['priority']||_0xfff7('0x11'),_0x5a23e4);_0x3b8604[_0xfff7('0x11')](_0x5a23e4);}else{logger[_0xfff7('0xc')](_0xfff7('0x12'),_0xf90f6,_0x27cc26[_0xfff7('0xe')]||_0xfff7('0x11'));_0x3b8604[_0xfff7('0xb')]();}}else{_0x3b8604[_0xfff7('0x11')]();}}}catch(_0x45dc24){logger[_0xfff7('0x13')]('[%s][GOTOP]\x20%s',_0xf90f6,JSON[_0xfff7('0x14')](_0x45dc24));_0x3b8604[_0xfff7('0xb')]();}};}; \ No newline at end of file +var _0xd6d7=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd6d7,0xa6));var _0x7d6d=function(_0x39911e,_0x379d3d){_0x39911e=_0x39911e-0x0;var _0x379487=_0xd6d7[_0x39911e];return _0x379487;};'use strict';var schema=require(_0x7d6d('0x0'));var _=require(_0x7d6d('0x1'));var logger=require('../../../../config/logger')(_0x7d6d('0x2'));var gotop=schema({'priority':{'type':_0x7d6d('0x3'),'required':!![],'message':_0x7d6d('0x4')}});exports[_0x7d6d('0x5')]=function(_0x59c9f1,_0x1b096b){return function(_0x25002e){try{var _0x8f595={'priority':_0x1b096b[0x0]};var _0x878d8d=gotop[_0x7d6d('0x0')](_0x8f595,{'typecast':!![]});if(_0x878d8d[_0x7d6d('0x6')]){logger[_0x7d6d('0x7')](_0x7d6d('0x8'),_0x59c9f1,_['map'](_0x878d8d,'message')[_0x7d6d('0x9')](',\x20'));_0x25002e[_0x7d6d('0xa')]();}else{logger[_0x7d6d('0xb')](_0x7d6d('0xc'),_0x59c9f1,_0x8f595[_0x7d6d('0xd')]);if(_0x8f595[_0x7d6d('0xd')]){var _0x438f48=_[_0x7d6d('0xe')](_0x25002e[_0x7d6d('0xf')](),{'p':_0x8f595[_0x7d6d('0xd')]});if(_0x438f48>=0x0){logger[_0x7d6d('0xb')](_0x7d6d('0x10'),_0x59c9f1,_0x8f595[_0x7d6d('0xd')]||_0x7d6d('0x11'),_0x438f48);_0x25002e[_0x7d6d('0x11')](_0x438f48);}else{logger['info'](_0x7d6d('0x12'),_0x59c9f1,_0x8f595[_0x7d6d('0xd')]||_0x7d6d('0x11'));_0x25002e[_0x7d6d('0xa')]();}}else{_0x25002e[_0x7d6d('0x11')]();}}}catch(_0x17f8f8){logger['error'](_0x7d6d('0x8'),_0x59c9f1,JSON[_0x7d6d('0x13')](_0x17f8f8));_0x25002e[_0x7d6d('0xa')]();}};}; \ 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 9c2e41f..2f44d08 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 _0xbac2=['stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','create','then','info','body','catch','error','[%s][MESSAGE]\x20%s'];(function(_0xb83baa,_0x3d2d64){var _0x20808e=function(_0x3e963f){while(--_0x3e963f){_0xb83baa['push'](_0xb83baa['shift']());}};_0x20808e(++_0x3d2d64);}(_0xbac2,0xc6));var _0x2bac=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xbac2[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x2bac('0x0'));var utils=require(_0x2bac('0x1'));var logger=require(_0x2bac('0x2'))(_0x2bac('0x3'));var rpc={'chatMessage':require(_0x2bac('0x4')),'openchannelMessage':require(_0x2bac('0x5')),'mailMessage':require(_0x2bac('0x6')),'smsMessage':require(_0x2bac('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2bac('0x8'))};exports[_0x2bac('0x9')]=function(_0x5bd890,_0x943fc9){return function(_0x40c167){try{var _0x41b237={'body':utils[_0x2bac('0xa')](_0x943fc9[0x0],this),'ContactId':this[_0x2bac('0xb')]['id']};if(this[_0x2bac('0xc')]===_0x2bac('0xd')){_0x41b237[_0x2bac('0xe')]=this[_0x2bac('0xf')]['id'];}else{_0x41b237[_[_0x2bac('0x10')](this[_0x2bac('0xc')])+_0x2bac('0x11')]=this[_0x2bac('0xf')]['id'];}_0x41b237[_['upperFirst'](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0x2bac('0x12')]){return rpc[this[_0x2bac('0xc')]+_0x2bac('0x12')][_0x2bac('0x13')](_0x41b237)[_0x2bac('0x14')](function(_0x124a93){logger[_0x2bac('0x15')]('[%s][MESSAGE]\x20%s',_0x5bd890,_0x41b237[_0x2bac('0x16')]);_0x40c167['next']();})[_0x2bac('0x17')](function(_0x1ab2a0){logger[_0x2bac('0x18')](_0x2bac('0x19'),_0x5bd890,JSON[_0x2bac('0x1a')](_0x1ab2a0));_0x40c167[_0x2bac('0x1b')]();});}}catch(_0x4f2637){logger['error'](_0x2bac('0x19'),_0x5bd890,JSON[_0x2bac('0x1a')](_0x4f2637));_0x40c167[_0x2bac('0x1b')]();}};}; \ No newline at end of file +var _0xd237=['AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xd237,0x14f));var _0x7d23=function(_0xc2fcdb,_0x5e225a){_0xc2fcdb=_0xc2fcdb-0x0;var _0x4d7af3=_0xd237[_0xc2fcdb];return _0x4d7af3;};'use strict';var _=require(_0x7d23('0x0'));var utils=require(_0x7d23('0x1'));var logger=require(_0x7d23('0x2'))(_0x7d23('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7d23('0x4')),'mailMessage':require(_0x7d23('0x5')),'smsMessage':require(_0x7d23('0x6')),'faxMessage':require(_0x7d23('0x7')),'whatsappMessage':require(_0x7d23('0x8'))};exports[_0x7d23('0x9')]=function(_0x52ad33,_0x24f10b){return function(_0x5e9d09){try{var _0x5ca126={'body':utils['getMustacheRender'](_0x24f10b[0x0],this),'ContactId':this[_0x7d23('0xa')]['id']};if(this[_0x7d23('0xb')]===_0x7d23('0xc')){_0x5ca126[_0x7d23('0xd')]=this[_0x7d23('0xe')]['id'];}else{_0x5ca126[_[_0x7d23('0xf')](this[_0x7d23('0xb')])+_0x7d23('0x10')]=this['account']['id'];}_0x5ca126[_[_0x7d23('0xf')](this[_0x7d23('0xb')])+_0x7d23('0x11')]=this['interaction']['id'];if(rpc[this[_0x7d23('0xb')]+'Message']){return rpc[this[_0x7d23('0xb')]+_0x7d23('0x12')][_0x7d23('0x13')](_0x5ca126)[_0x7d23('0x14')](function(_0x3b0b15){logger[_0x7d23('0x15')](_0x7d23('0x16'),_0x52ad33,_0x5ca126['body']);_0x5e9d09['next']();})[_0x7d23('0x17')](function(_0xf1db40){logger[_0x7d23('0x18')](_0x7d23('0x16'),_0x52ad33,JSON['stringify'](_0xf1db40));_0x5e9d09[_0x7d23('0x19')]();});}}catch(_0x5a318d){logger[_0x7d23('0x18')]('[%s][MESSAGE]\x20%s',_0x52ad33,JSON[_0x7d23('0x1a')](_0x5a318d));_0x5e9d09[_0x7d23('0x19')]();}};}; \ 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 d27c350..e444490 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 _0x15a4=['stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x5678f8,_0x58f1bf){var _0x16ca87=function(_0x448b77){while(--_0x448b77){_0x5678f8['push'](_0x5678f8['shift']());}};_0x16ca87(++_0x58f1bf);}(_0x15a4,0x178));var _0x415a=function(_0x2340f6,_0x27c0d0){_0x2340f6=_0x2340f6-0x0;var _0x4339ee=_0x15a4[_0x2340f6];return _0x4339ee;};'use strict';var utils=require(_0x415a('0x0'));var logger=require(_0x415a('0x1'))(_0x415a('0x2'));exports[_0x415a('0x3')]=function(_0x237062,_0x4a187f){return function(_0x2db30f){try{logger[_0x415a('0x4')](_0x415a('0x5'),_0x237062,utils[_0x415a('0x6')](_0x4a187f[0x0],this));_0x2db30f[_0x415a('0x7')]();}catch(_0x466c1e){logger[_0x415a('0x8')](_0x415a('0x5'),_0x237062,JSON[_0x415a('0x9')](_0x466c1e));_0x2db30f[_0x415a('0xa')]();}};}; \ No newline at end of file +var _0x087d=['getMustacheRender','next','error','[%s][NOOP]\x20%s','./utils','../../../../config/logger','routing','info'];(function(_0x5c9f45,_0x46d8af){var _0x5f3d7e=function(_0x27f359){while(--_0x27f359){_0x5c9f45['push'](_0x5c9f45['shift']());}};_0x5f3d7e(++_0x46d8af);}(_0x087d,0x15c));var _0xd087=function(_0xfdde02,_0x27e453){_0xfdde02=_0xfdde02-0x0;var _0x2dec18=_0x087d[_0xfdde02];return _0x2dec18;};'use strict';var utils=require(_0xd087('0x0'));var logger=require(_0xd087('0x1'))(_0xd087('0x2'));exports['consequence']=function(_0x3eccee,_0x1dcfa7){return function(_0xe425d8){try{logger[_0xd087('0x3')]('[%s][NOOP]\x20%s',_0x3eccee,utils[_0xd087('0x4')](_0x1dcfa7[0x0],this));_0xe425d8[_0xd087('0x5')]();}catch(_0x13739d){logger[_0xd087('0x6')](_0xd087('0x7'),_0x3eccee,JSON['stringify'](_0x13739d));_0xe425d8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 4e2425f..e8224e5 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 _0xe238=['error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','info','[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','atimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','queue','joinAt','emit','clone','queue_id','account','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create'];(function(_0x4dd99f,_0x225db1){var _0x124fe9=function(_0x48df05){while(--_0x48df05){_0x4dd99f['push'](_0x4dd99f['shift']());}};_0x124fe9(++_0x225db1);}(_0xe238,0x18d));var _0x8e23=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe238[_0x46e363];return _0x3fb059;};'use strict';var schema=require(_0x8e23('0x0'));var _=require(_0x8e23('0x1'));var util=require(_0x8e23('0x2'));var seqqueue=require(_0x8e23('0x3'));var moment=require(_0x8e23('0x4'));var Redis=require(_0x8e23('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8e23('0x6'))(_0x8e23('0x7'));var strategy=require('./strategy');config[_0x8e23('0x8')]=_[_0x8e23('0x9')](config[_0x8e23('0x8')],{'host':_0x8e23('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e23('0x8')]));var attributes=['id','queue_id','account',_0x8e23('0xb'),'from',_0x8e23('0xc')];function emit(_0x43d795,_0x27fe8c,_0xb398f1){io['to'](_0x43d795)[_0x8e23('0xd')](_0x27fe8c,_0xb398f1);}function emitChannelQueueInteraction(_0x587da2,_0x3164fe,_0x37fa74,_0xa2bcad,_0x28a9ef,_0x3cd916,_0x153431,_0x595123){var _0x513b3d=_[_0x8e23('0xe')](_0x37fa74);_0x513b3d[_0x8e23('0xf')]=_0x595123;_0x513b3d['queue']=_0x3164fe;_0x513b3d[_0x8e23('0x10')]=_0xa2bcad;_0x513b3d['id']=_0x28a9ef;if(_0x3cd916){_0x153431[util['format']('%sQueuesWaitingInteractions',_0x587da2)][_0x28a9ef]=_[_0x8e23('0x11')](_0x513b3d,attributes);}else{delete _0x153431[util[_0x8e23('0x12')](_0x8e23('0x13'),_0x587da2)][_0x28a9ef];}emit(util[_0x8e23('0x12')](_0x8e23('0x14'),_0x587da2,_0x3164fe),util['format'](_0x8e23('0x15'),_0x587da2,_0x3cd916?_0x8e23('0x16'):'remove'),_[_0x8e23('0x11')](_0x513b3d,attributes));}var rpc={'openchannelQueueReport':require(_0x8e23('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x8e23('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x8e23('0x19')),'whatsappQueueReport':require(_0x8e23('0x1a'))};var queue=schema({'name':{'type':_0x8e23('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x8e23('0x1c'),'message':_0x8e23('0x1d')}});function startRouting(_0x4e93ab,_0x56f1e4,_0x38e831,_0xdcb70){if(_0x4e93ab&&_0x56f1e4&&_0x38e831){_0x56f1e4[_0x8e23('0x1e')]+=0x1;var _0x2402f7={'uniqueid':_0x4e93ab,'from':_0x38e831[_0x8e23('0x1f')]?_0x38e831[_0x8e23('0x1f')]['from']:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x38e831[_0x8e23('0x20')]?_0x38e831['contact']['id']:null,'ListId':_0x38e831[_0x8e23('0x21')]?_0x38e831[_0x8e23('0x21')]['id']:null};_0x2402f7[_[_0x8e23('0x22')](_0x38e831[_0x8e23('0x23')])+_0x8e23('0x24')]=_0x56f1e4['id']||null;_0x2402f7[_['upperFirst'](_0x38e831[_0x8e23('0x23')])+_0x8e23('0x25')]=_0x38e831['interaction']?_0x38e831[_0x8e23('0x26')]['id']:null;_0x2402f7[_['upperFirst'](_0x38e831[_0x8e23('0x23')])+'MessageId']=_0x38e831[_0x8e23('0x27')]?_0x38e831[_0x8e23('0x27')]['id']:null;_0x2402f7[_[_0x8e23('0x22')](_0x38e831[_0x8e23('0x23')])+(_0x38e831[_0x8e23('0x23')]!==_0x8e23('0x28')?_0x8e23('0x29'):_0x8e23('0x2a'))]=_0x38e831[_0x8e23('0x10')]?_0x38e831[_0x8e23('0x10')]['id']:null;logger['info'](util['format'](_0x8e23('0x2b'),_0x4e93ab,_0x56f1e4[_0x8e23('0x2c')]));emitChannelQueueInteraction(_0x38e831[_0x8e23('0x23')],_0x56f1e4[_0x8e23('0x2c')],_0x2402f7,_0x38e831[_0x8e23('0x10')][_0x8e23('0x2c')],_0x38e831[_0x8e23('0x27')]['id'],!![],_0xdcb70,_0x56f1e4['id']);if(rpc[_0x38e831[_0x8e23('0x23')]+'QueueReport']){return rpc[_0x38e831['channel']+_0x8e23('0x2d')][_0x8e23('0x2e')](_0x2402f7)['catch'](function(_0x47c23b){logger[_0x8e23('0x2f')](_0x8e23('0x30'));});}}}function stopRouting(_0x17a601,_0x2a67a6,_0x3c1c51,_0x5cc357){if(_0x17a601&&_0x2a67a6){_0x2a67a6[_0x8e23('0x1e')]-=0x1;var _0xc1b9d1={'leaveAt':moment()[_0x8e23('0x12')](_0x8e23('0x31')),'acceptAt':moment()['format'](_0x8e23('0x31')),'reason':'accepted'};logger[_0x8e23('0x32')](util[_0x8e23('0x12')](_0x8e23('0x33'),_0x17a601,_0x2a67a6['name']));emitChannelQueueInteraction(_0x3c1c51[_0x8e23('0x23')],_0x2a67a6[_0x8e23('0x2c')],_0x3c1c51[_0x8e23('0x1f')],_0x3c1c51[_0x8e23('0x10')][_0x8e23('0x2c')],_0x3c1c51['message']['id'],![],_0x5cc357,_0x2a67a6['id']);if(rpc[_0x3c1c51[_0x8e23('0x23')]+_0x8e23('0x2d')]){return rpc[_0x3c1c51['channel']+_0x8e23('0x2d')]['update'](_0x17a601,_0xc1b9d1)[_0x8e23('0x34')](function(_0x17338b){logger[_0x8e23('0x2f')](_0x8e23('0x35'));});}}}function endRouting(_0x5c450d,_0x38f148,_0x3f2a1d,_0x2ab70f){if(_0x5c450d&&_0x38f148){_0x38f148[_0x8e23('0x1e')]-=0x1;var _0x12c31f={'leaveAt':moment()[_0x8e23('0x12')](_0x8e23('0x31')),'exitAt':moment()[_0x8e23('0x12')](_0x8e23('0x31')),'reason':_0x8e23('0x36')};logger[_0x8e23('0x32')](util[_0x8e23('0x12')](_0x8e23('0x37'),_0x5c450d,_0x38f148[_0x8e23('0x2c')]));emitChannelQueueInteraction(_0x3f2a1d['channel'],_0x38f148[_0x8e23('0x2c')],_0x3f2a1d[_0x8e23('0x1f')],_0x3f2a1d[_0x8e23('0x10')][_0x8e23('0x2c')],_0x3f2a1d[_0x8e23('0x27')]['id'],![],_0x2ab70f);if(rpc[_0x3f2a1d['channel']+_0x8e23('0x2d')]){return rpc[_0x3f2a1d['channel']+_0x8e23('0x2d')][_0x8e23('0x38')](_0x5c450d,_0x12c31f)[_0x8e23('0x34')](function(_0x2d69ff){logger[_0x8e23('0x2f')](_0x8e23('0x35'));});}}}function handleFindQueue(_0x142411){return function(_0x2ba2f4){return _0x2ba2f4[_0x8e23('0x2c')][_0x8e23('0x39')]()===_0x142411[_0x8e23('0x39')]();};}exports['consequence']=function(_0x1b05b3,_0x346b24,_0x41248c,_0x55590f){return function(_0x5dc606){try{var _0x4d7369={'name':_0x346b24[0x0],'timeout':_0x346b24[0x1]};var _0x5b93b0=queue[_0x8e23('0x0')](_0x4d7369,{'typecast':!![]});if(_0x5b93b0[_0x8e23('0x3a')]){logger[_0x8e23('0x2f')](_0x8e23('0x3b'),_0x1b05b3,_[_0x8e23('0x3c')](_0x5b93b0,'message')[_0x8e23('0x3d')](',\x20'));_0x5dc606[_0x8e23('0x3e')]();}else{var _0x1abbda=_['find'](_0x41248c[_0x55590f['channel']+'Queues'],handleFindQueue(_0x4d7369[_0x8e23('0x2c')]));if(_0x1abbda){startRouting(_0x1b05b3,_0x1abbda,_0x55590f,_0x41248c);var _0x32ff43=(_0x1abbda['timeout']||0xa)*0x3e8;var _0x5d0d97=(_0x4d7369[_0x8e23('0x36')]||0x14)*0x3e8;var _0x5a32bc,_0x862540;if(_0x32ff43>_0x5d0d97){_0x5d0d97=_0x32ff43;}var _0x2c3ad8=seqqueue['createQueue'](_0x32ff43);_0x2c3ad8['id']=_0x1b05b3;_0x2c3ad8[_0x8e23('0x3f')]=_0x32ff43;_0x2c3ad8['qtimeout']=_0x5d0d97;_0x2c3ad8[_0x8e23('0x23')]=_0x55590f[_0x8e23('0x23')];_0x41248c[_0x8e23('0x40')][_0x1b05b3]['on'](_0x8e23('0x41'),function(){logger[_0x8e23('0x32')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1b05b3);stopRouting(_0x1b05b3,_0x1abbda,_0x55590f,_0x41248c);clearTimeout(_0x5a32bc);_0x5a32bc=undefined;_0x2c3ad8[_0x8e23('0x42')](!![]);if(_0x41248c[_0x8e23('0x40')][_0x1b05b3]){delete _0x41248c[_0x8e23('0x40')][_0x1b05b3];}_0x5dc606[_0x8e23('0x3e')]();});_0x41248c['rules'][_0x1b05b3]['on']('complete',function(){if(_0x41248c[_0x8e23('0x40')][_0x1b05b3]){delete _0x41248c[_0x8e23('0x40')][_0x1b05b3];}});_0x5a32bc=setTimeout(function(){logger[_0x8e23('0x32')](_0x8e23('0x43'),_0x1b05b3);endRouting(_0x1b05b3,_0x1abbda,_0x55590f,_0x41248c);clearTimeout(_0x5a32bc);_0x2c3ad8[_0x8e23('0x42')](!![]);_0x5dc606['next']();},_0x5d0d97);switch(_0x1abbda[_0x8e23('0x44')]){case _0x8e23('0x45'):strategy[_0x8e23('0x45')](_0x2c3ad8,_0x1abbda,_0x41248c,_0x55590f);break;default:strategy[_0x8e23('0x46')](_0x2c3ad8,_0x1abbda,_0x41248c,_0x55590f);}}else{logger[_0x8e23('0x2f')](_0x8e23('0x47'),_0x1b05b3,_0x4d7369[_0x8e23('0x2c')]);_0x5dc606[_0x8e23('0x3e')]();}}}catch(_0x40746e){console[_0x8e23('0x48')](_0x40746e);logger['error']('[%s][QUEUE]\x20%s',_0x1b05b3,_0x40746e[_0x8e23('0x49')]);_0x5dc606['stop']();}};}; \ No newline at end of file +var _0x1241=['../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','createQueue','qtimeout','end','rules','close','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','joinAt','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport'];(function(_0x34ae76,_0x4cd562){var _0x5325eb=function(_0x29406a){while(--_0x29406a){_0x34ae76['push'](_0x34ae76['shift']());}};_0x5325eb(++_0x4cd562);}(_0x1241,0x155));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x1124('0x0'));var _=require(_0x1124('0x1'));var util=require(_0x1124('0x2'));var seqqueue=require(_0x1124('0x3'));var moment=require(_0x1124('0x4'));var Redis=require(_0x1124('0x5'));var config=require(_0x1124('0x6'));var logger=require('../../../../config/logger')(_0x1124('0x7'));var strategy=require(_0x1124('0x8'));config[_0x1124('0x9')]=_['defaults'](config[_0x1124('0x9')],{'host':_0x1124('0xa'),'port':0x18eb});var io=require(_0x1124('0xb'))(new Redis(config['redis']));var attributes=['id',_0x1124('0xc'),'account',_0x1124('0xd'),'from',_0x1124('0xe')];function emit(_0xb04f55,_0x444fad,_0x5a5080){io['to'](_0xb04f55)['emit'](_0x444fad,_0x5a5080);}function emitChannelQueueInteraction(_0x4b7304,_0x11ccc8,_0x4003b3,_0x26b0f1,_0x4cec61,_0x1c317e,_0x3d4ea2,_0x35a50f){var _0x44053a=_['clone'](_0x4003b3);_0x44053a['queue_id']=_0x35a50f;_0x44053a[_0x1124('0xd')]=_0x11ccc8;_0x44053a[_0x1124('0xf')]=_0x26b0f1;_0x44053a['id']=_0x4cec61;if(_0x1c317e){_0x3d4ea2[util[_0x1124('0x10')](_0x1124('0x11'),_0x4b7304)][_0x4cec61]=_[_0x1124('0x12')](_0x44053a,attributes);}else{delete _0x3d4ea2[util[_0x1124('0x10')](_0x1124('0x11'),_0x4b7304)][_0x4cec61];}emit(util['format'](_0x1124('0x13'),_0x4b7304,_0x11ccc8),util[_0x1124('0x10')](_0x1124('0x14'),_0x4b7304,_0x1c317e?_0x1124('0x15'):_0x1124('0x16')),_[_0x1124('0x12')](_0x44053a,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1124('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x1124('0x18')),'faxQueueReport':require(_0x1124('0x19')),'whatsappQueueReport':require(_0x1124('0x1a'))};var queue=schema({'name':{'type':_0x1124('0x1b'),'required':!![],'message':_0x1124('0x1c')},'timeout':{'type':'number','message':_0x1124('0x1d')}});function startRouting(_0x190dae,_0x204fd8,_0x490166,_0x1ab44c){if(_0x190dae&&_0x204fd8&&_0x490166){_0x204fd8[_0x1124('0x1e')]+=0x1;var _0x2d395e={'uniqueid':_0x190dae,'from':_0x490166[_0x1124('0x1f')]?_0x490166['body']['from']:'','joinAt':moment()[_0x1124('0x10')](_0x1124('0x20')),'ContactId':_0x490166[_0x1124('0x21')]?_0x490166[_0x1124('0x21')]['id']:null,'ListId':_0x490166[_0x1124('0x22')]?_0x490166[_0x1124('0x22')]['id']:null};_0x2d395e[_[_0x1124('0x23')](_0x490166[_0x1124('0x24')])+_0x1124('0x25')]=_0x204fd8['id']||null;_0x2d395e[_['upperFirst'](_0x490166[_0x1124('0x24')])+_0x1124('0x26')]=_0x490166[_0x1124('0x27')]?_0x490166[_0x1124('0x27')]['id']:null;_0x2d395e[_[_0x1124('0x23')](_0x490166[_0x1124('0x24')])+_0x1124('0x28')]=_0x490166['message']?_0x490166[_0x1124('0x29')]['id']:null;_0x2d395e[_[_0x1124('0x23')](_0x490166[_0x1124('0x24')])+(_0x490166[_0x1124('0x24')]!==_0x1124('0x2a')?_0x1124('0x2b'):'WebsiteId')]=_0x490166['account']?_0x490166[_0x1124('0xf')]['id']:null;logger[_0x1124('0x2c')](util[_0x1124('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x190dae,_0x204fd8['name']));emitChannelQueueInteraction(_0x490166['channel'],_0x204fd8[_0x1124('0x2d')],_0x2d395e,_0x490166[_0x1124('0xf')][_0x1124('0x2d')],_0x490166['message']['id'],!![],_0x1ab44c,_0x204fd8['id']);if(rpc[_0x490166[_0x1124('0x24')]+_0x1124('0x2e')]){return rpc[_0x490166['channel']+_0x1124('0x2e')][_0x1124('0x2f')](_0x2d395e)[_0x1124('0x30')](function(_0x7dfe9d){logger[_0x1124('0x31')](_0x1124('0x32'));});}}}function stopRouting(_0x34bb01,_0x1b7af5,_0x38bc90,_0x5aeb48){if(_0x34bb01&&_0x1b7af5){_0x1b7af5['waiting']-=0x1;var _0xce8a19={'leaveAt':moment()[_0x1124('0x10')](_0x1124('0x20')),'acceptAt':moment()[_0x1124('0x10')](_0x1124('0x20')),'reason':_0x1124('0x33')};logger[_0x1124('0x2c')](util[_0x1124('0x10')](_0x1124('0x34'),_0x34bb01,_0x1b7af5[_0x1124('0x2d')]));emitChannelQueueInteraction(_0x38bc90[_0x1124('0x24')],_0x1b7af5[_0x1124('0x2d')],_0x38bc90[_0x1124('0x1f')],_0x38bc90[_0x1124('0xf')][_0x1124('0x2d')],_0x38bc90[_0x1124('0x29')]['id'],![],_0x5aeb48,_0x1b7af5['id']);if(rpc[_0x38bc90[_0x1124('0x24')]+_0x1124('0x2e')]){return rpc[_0x38bc90[_0x1124('0x24')]+_0x1124('0x2e')][_0x1124('0x35')](_0x34bb01,_0xce8a19)[_0x1124('0x30')](function(_0x48c07d){logger[_0x1124('0x31')](_0x1124('0x36'));});}}}function endRouting(_0x15c10c,_0x142d2c,_0x12273b,_0x2424db){if(_0x15c10c&&_0x142d2c){_0x142d2c[_0x1124('0x1e')]-=0x1;var _0x1712a={'leaveAt':moment()['format'](_0x1124('0x20')),'exitAt':moment()[_0x1124('0x10')](_0x1124('0x20')),'reason':_0x1124('0x37')};logger[_0x1124('0x2c')](util['format'](_0x1124('0x38'),_0x15c10c,_0x142d2c['name']));emitChannelQueueInteraction(_0x12273b['channel'],_0x142d2c[_0x1124('0x2d')],_0x12273b[_0x1124('0x1f')],_0x12273b[_0x1124('0xf')][_0x1124('0x2d')],_0x12273b['message']['id'],![],_0x2424db);if(rpc[_0x12273b[_0x1124('0x24')]+_0x1124('0x2e')]){return rpc[_0x12273b[_0x1124('0x24')]+_0x1124('0x2e')][_0x1124('0x35')](_0x15c10c,_0x1712a)[_0x1124('0x30')](function(_0xb8bad6){logger[_0x1124('0x31')](_0x1124('0x36'));});}}}function handleFindQueue(_0x3a1ddd){return function(_0xaf1cf4){return _0xaf1cf4[_0x1124('0x2d')][_0x1124('0x39')]()===_0x3a1ddd[_0x1124('0x39')]();};}exports['consequence']=function(_0x2b5f53,_0x4ddc02,_0x2a8960,_0x1c6b5e){return function(_0x3e03fd){try{var _0x599063={'name':_0x4ddc02[0x0],'timeout':_0x4ddc02[0x1]};var _0x51eb81=queue[_0x1124('0x0')](_0x599063,{'typecast':!![]});if(_0x51eb81[_0x1124('0x3a')]){logger[_0x1124('0x31')](_0x1124('0x3b'),_0x2b5f53,_[_0x1124('0x3c')](_0x51eb81,'message')['join'](',\x20'));_0x3e03fd[_0x1124('0x3d')]();}else{var _0x13a059=_[_0x1124('0x3e')](_0x2a8960[_0x1c6b5e['channel']+_0x1124('0x3f')],handleFindQueue(_0x599063[_0x1124('0x2d')]));if(_0x13a059){startRouting(_0x2b5f53,_0x13a059,_0x1c6b5e,_0x2a8960);var _0x1b0c0f=(_0x13a059['timeout']||0xa)*0x3e8;var _0x432d9a=(_0x599063[_0x1124('0x37')]||0x14)*0x3e8;var _0x455b62,_0x4d466c;if(_0x1b0c0f>_0x432d9a){_0x432d9a=_0x1b0c0f;}var _0x14ecb1=seqqueue[_0x1124('0x40')](_0x1b0c0f);_0x14ecb1['id']=_0x2b5f53;_0x14ecb1['atimeout']=_0x1b0c0f;_0x14ecb1[_0x1124('0x41')]=_0x432d9a;_0x14ecb1[_0x1124('0x24')]=_0x1c6b5e['channel'];_0x2a8960['rules'][_0x2b5f53]['on'](_0x1124('0x42'),function(){logger[_0x1124('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2b5f53);stopRouting(_0x2b5f53,_0x13a059,_0x1c6b5e,_0x2a8960);clearTimeout(_0x455b62);_0x455b62=undefined;_0x14ecb1['close'](!![]);if(_0x2a8960[_0x1124('0x43')][_0x2b5f53]){delete _0x2a8960[_0x1124('0x43')][_0x2b5f53];}_0x3e03fd['stop']();});_0x2a8960[_0x1124('0x43')][_0x2b5f53]['on']('complete',function(){if(_0x2a8960[_0x1124('0x43')][_0x2b5f53]){delete _0x2a8960[_0x1124('0x43')][_0x2b5f53];}});_0x455b62=setTimeout(function(){logger[_0x1124('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2b5f53);endRouting(_0x2b5f53,_0x13a059,_0x1c6b5e,_0x2a8960);clearTimeout(_0x455b62);_0x14ecb1[_0x1124('0x44')](!![]);_0x3e03fd['next']();},_0x432d9a);switch(_0x13a059['strategy']){case'rrmemory':strategy[_0x1124('0x45')](_0x14ecb1,_0x13a059,_0x2a8960,_0x1c6b5e);break;default:strategy[_0x1124('0x46')](_0x14ecb1,_0x13a059,_0x2a8960,_0x1c6b5e);}}else{logger['error'](_0x1124('0x47'),_0x2b5f53,_0x599063[_0x1124('0x2d')]);_0x3e03fd[_0x1124('0x3d')]();}}}catch(_0x42e54e){console['log'](_0x42e54e);logger[_0x1124('0x31')]('[%s][QUEUE]\x20%s',_0x2b5f53,_0x42e54e[_0x1124('0x48')]);_0x3e03fd[_0x1124('0x3d')]();}};}; \ 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 c3b2fe5..eedb3d2 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 _0x5e1b=['bind','timeout','handleTimeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun'];(function(_0x25ed9e,_0x50714c){var _0x3e15c1=function(_0x26d473){while(--_0x26d473){_0x25ed9e['push'](_0x25ed9e['shift']());}};_0x3e15c1(++_0x50714c);}(_0x5e1b,0x1af));var _0xb5e1=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x5e1b[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0xb5e1('0x0'));var uuid=require(_0xb5e1('0x1'));var util=require(_0xb5e1('0x2'));var logger=require(_0xb5e1('0x3'))(_0xb5e1('0x4'));var Agent=function(_0x3a1574,_0x1640ba,_0x273f36,_0x12a6f2){this[_0xb5e1('0x5')]=uuid['v4']();this[_0xb5e1('0x6')]=_0x3a1574;this[_0xb5e1('0x7')]=_0x1640ba;this[_0xb5e1('0x8')]=_0x273f36;this[_0xb5e1('0x4')]=_0x12a6f2;this[_0xb5e1('0x6')][_0xb5e1('0x9')](this[_0xb5e1('0xa')]['bind'](this),this['handleTimeout'][_0xb5e1('0xb')](this));this[_0xb5e1('0x6')]['on'](_0xb5e1('0xc'),this[_0xb5e1('0xd')][_0xb5e1('0xb')](this));this[_0xb5e1('0x6')]['on'](_0xb5e1('0xe'),this['handleDrained'][_0xb5e1('0xb')](this));};Agent[_0xb5e1('0xf')][_0xb5e1('0x9')]=function(){this[_0xb5e1('0x6')][_0xb5e1('0x9')](this[_0xb5e1('0xa')][_0xb5e1('0xb')](this),this[_0xb5e1('0xd')][_0xb5e1('0xb')](this));};Agent[_0xb5e1('0xf')][_0xb5e1('0x10')]=function(){this[_0xb5e1('0xd')](!![]);};Agent[_0xb5e1('0xf')]['handleRun']=function(_0x5d185a){logger[_0xb5e1('0x11')](_0xb5e1('0x12'),this[_0xb5e1('0x6')]['id'],this['agent']['id']);if(_[_0xb5e1('0x13')](this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']])){logger[_0xb5e1('0x11')](_0xb5e1('0x15'),this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xb5e1('0x16')]||util['isAgentAvailable'](this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x8')]['agents'][this[_0xb5e1('0x7')]['id']],this[_0xb5e1('0x6')][_0xb5e1('0x17')],![])){this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']][_0xb5e1('0x18')]=!![];this['realtime'][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']][_0xb5e1('0x19')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']],null,this[_0xb5e1('0x4')]);util[_0xb5e1('0x1a')](this['squeue']['id'],this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']],_0xb5e1('0x1b')+(this[_0xb5e1('0x4')]['forcedOwnership']?_0xb5e1('0x1c'):''));}else{logger['info'](_0xb5e1('0x1d'),this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x7')]['id']);setTimeout(this[_0xb5e1('0x9')][_0xb5e1('0xb')](this),0x3e8);}}};Agent[_0xb5e1('0xf')]['handleTimeout']=function(_0x4afccf){if(_[_0xb5e1('0x13')](this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']])){return logger['info'](_0xb5e1('0x15'),this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x7')]['id']);}else{logger['info'](_0xb5e1('0x1e'),this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x7')]['id']);util[_0xb5e1('0x1f')](this[_0xb5e1('0x5')],this['squeue']['id'],this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']],null,this[_0xb5e1('0x4')]);this[_0xb5e1('0x8')]['agents'][this['agent']['id']][_0xb5e1('0x18')]=![];this[_0xb5e1('0x8')][_0xb5e1('0x14')][this['agent']['id']]['busyQueue']=undefined;util[_0xb5e1('0x1a')](this[_0xb5e1('0x6')]['id'],this[_0xb5e1('0x8')][_0xb5e1('0x14')][this[_0xb5e1('0x7')]['id']],_0x4afccf?'STOP':_0xb5e1('0x20'));}if(!_0x4afccf){setTimeout(this[_0xb5e1('0x9')][_0xb5e1('0xb')](this),0x3e8);}};function agent(_0x4b6d2c,_0x1e246c,_0x49a9ef,_0x251474){return new Agent(_0x4b6d2c,_0x1e246c,_0x49a9ef,_0x251474);}module[_0xb5e1('0x21')]=agent; \ No newline at end of file +var _0xd3f5=['push','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','handleTimeout','timeout','bind','drained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','showNotification','writeLog','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x2ed2c5,_0x15d9ff){var _0xf2915a=function(_0x46aacd){while(--_0x46aacd){_0x2ed2c5['push'](_0x2ed2c5['shift']());}};_0xf2915a(++_0x15d9ff);}(_0xd3f5,0x7d));var _0x5d3f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3f5[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5d3f('0x0'));var uuid=require(_0x5d3f('0x1'));var util=require(_0x5d3f('0x2'));var logger=require('../../../../../config/logger')(_0x5d3f('0x3'));var Agent=function(_0x15a94b,_0x35ac4b,_0x3307dc,_0x1a0058){this[_0x5d3f('0x4')]=uuid['v4']();this[_0x5d3f('0x5')]=_0x15a94b;this[_0x5d3f('0x6')]=_0x35ac4b;this[_0x5d3f('0x7')]=_0x3307dc;this[_0x5d3f('0x3')]=_0x1a0058;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x5d3f('0x8')]['bind'](this));this['squeue']['on'](_0x5d3f('0x9'),this['handleTimeout'][_0x5d3f('0xa')](this));this['squeue']['on'](_0x5d3f('0xb'),this['handleDrained'][_0x5d3f('0xa')](this));};Agent[_0x5d3f('0xc')]['push']=function(){this[_0x5d3f('0x5')]['push'](this['handleRun'][_0x5d3f('0xa')](this),this['handleTimeout'][_0x5d3f('0xa')](this));};Agent[_0x5d3f('0xc')]['handleDrained']=function(){this[_0x5d3f('0x8')](!![]);};Agent['prototype'][_0x5d3f('0xd')]=function(_0x4920cf){logger['info'](_0x5d3f('0xe'),this[_0x5d3f('0x5')]['id'],this['agent']['id']);if(_[_0x5d3f('0xf')](this[_0x5d3f('0x7')][_0x5d3f('0x10')][this[_0x5d3f('0x6')]['id']])){logger[_0x5d3f('0x11')](_0x5d3f('0x12'),this[_0x5d3f('0x5')]['id'],this[_0x5d3f('0x6')]['id']);setTimeout(this['push'][_0x5d3f('0xa')](this),0x3e8);}else{if(this[_0x5d3f('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x5d3f('0x5')]['id'],this['realtime'][_0x5d3f('0x10')][this['agent']['id']],this['squeue'][_0x5d3f('0x13')],![])){this[_0x5d3f('0x7')]['agents'][this[_0x5d3f('0x6')]['id']][_0x5d3f('0x14')]=!![];this['realtime'][_0x5d3f('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x5d3f('0x15')](this[_0x5d3f('0x4')],this[_0x5d3f('0x5')]['id'],this['realtime'][_0x5d3f('0x10')][this[_0x5d3f('0x6')]['id']],null,this[_0x5d3f('0x3')]);util[_0x5d3f('0x16')](this[_0x5d3f('0x5')]['id'],this['realtime'][_0x5d3f('0x10')][this[_0x5d3f('0x6')]['id']],'RINGING'+(this[_0x5d3f('0x3')][_0x5d3f('0x17')]?':FORCED':''));}else{logger['info'](_0x5d3f('0x18'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x5d3f('0x19')][_0x5d3f('0xa')](this),0x3e8);}}};Agent['prototype'][_0x5d3f('0x8')]=function(_0xe0d202){if(_[_0x5d3f('0xf')](this[_0x5d3f('0x7')][_0x5d3f('0x10')][this[_0x5d3f('0x6')]['id']])){return logger[_0x5d3f('0x11')](_0x5d3f('0x12'),this['squeue']['id'],this[_0x5d3f('0x6')]['id']);}else{logger[_0x5d3f('0x11')](_0x5d3f('0x1a'),this['squeue']['id'],this[_0x5d3f('0x6')]['id']);util[_0x5d3f('0x1b')](this[_0x5d3f('0x4')],this['squeue']['id'],this[_0x5d3f('0x7')]['agents'][this[_0x5d3f('0x6')]['id']],null,this[_0x5d3f('0x3')]);this[_0x5d3f('0x7')][_0x5d3f('0x10')][this['agent']['id']]['busy']=![];this[_0x5d3f('0x7')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x5d3f('0x16')](this[_0x5d3f('0x5')]['id'],this[_0x5d3f('0x7')][_0x5d3f('0x10')][this[_0x5d3f('0x6')]['id']],_0xe0d202?'STOP':_0x5d3f('0x1c'));}if(!_0xe0d202){setTimeout(this[_0x5d3f('0x19')][_0x5d3f('0xa')](this),0x3e8);}};function agent(_0x24f775,_0x485d72,_0xa38171,_0x371dbc){return new Agent(_0x24f775,_0x485d72,_0xa38171,_0x371dbc);}module[_0x5d3f('0x1d')]=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 e74add8..7bd463b 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 _0xdc0d=['writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc0d,0x1db));var _0xddc0=function(_0x599aa2,_0x380b24){_0x599aa2=_0x599aa2-0x0;var _0x508563=_0xdc0d[_0x599aa2];return _0x508563;};'use strict';var _=require(_0xddc0('0x0'));var uuid=require(_0xddc0('0x1'));var util=require('./util');var logger=require(_0xddc0('0x2'))('routing');var Beepall=function(_0x223e0f,_0xac8cc5,_0x333d21,_0x32ad85){this[_0xddc0('0x3')]=uuid['v4']();this[_0xddc0('0x4')]=_0x223e0f;this[_0xddc0('0x5')]=_0xac8cc5;this[_0xddc0('0x6')]=_0x333d21;this[_0xddc0('0x7')]=_0x32ad85;this['squeue'][_0xddc0('0x8')](this[_0xddc0('0x9')][_0xddc0('0xa')](this),this[_0xddc0('0xb')][_0xddc0('0xa')](this));this[_0xddc0('0x4')]['on']('timeout',this[_0xddc0('0xb')][_0xddc0('0xa')](this));this[_0xddc0('0x4')]['on'](_0xddc0('0xc'),this[_0xddc0('0xd')][_0xddc0('0xa')](this));};Beepall[_0xddc0('0xe')][_0xddc0('0x8')]=function(){this['squeue'][_0xddc0('0x8')](this[_0xddc0('0x9')]['bind'](this),this[_0xddc0('0xb')][_0xddc0('0xa')](this));};Beepall[_0xddc0('0xe')][_0xddc0('0xd')]=function(_0x2faa0d){this['handleTimeout'](!![]);};Beepall[_0xddc0('0xe')][_0xddc0('0x9')]=function(_0x523089){var _0x24aa03=!![];if(!_['isNil'](this[_0xddc0('0x5')])&&!_[_0xddc0('0xf')](this[_0xddc0('0x5')]['Agents'])&&this['queue'][_0xddc0('0x10')][_0xddc0('0x11')]>0x0){for(var _0x39b837=0x0,_0x22d0b0;_0x39b8370x0){for(var _0x1b7c00=0x0,_0x57825d;_0x1b7c000x0&&_0x47f71a[_0x32a85c+_0xb5fa('0x24')]>=_0x47f71a[_0x32a85c+'Capacity']){writeLog(_0x283a56,_0x47f71a,_0x32a85c['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x28a350,_0x460b54,_0x12c0d4,_0x2bdf50,_0x534884){return sendNotification(!![],_0x28a350,_0x460b54,_0x12c0d4,_0x2bdf50,_0x534884);};exports[_0xb5fa('0x25')]=function(_0x358549,_0x353314,_0x409af9,_0x2a5690,_0x142bfa){return sendNotification(![],_0x358549,_0x353314,_0x409af9,_0x2a5690,_0x142bfa);};exports[_0xb5fa('0x26')]=writeLog; \ No newline at end of file +var _0xf2e3=['../../../../../config/logger','routing','redis','defaults','socket.io-emitter','emit','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','save','remove','info','isAgentAvailable','busy','BUSY','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','../utils','mustache','ioredis','../../../../../config/environment'];(function(_0x38604d,_0x25602a){var _0x1b66b0=function(_0xe18e8f){while(--_0xe18e8f){_0x38604d['push'](_0x38604d['shift']());}};_0x1b66b0(++_0x25602a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xf2e3[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var utils=require(_0x3f2e('0x1'));var Mustache=require(_0x3f2e('0x2'));var Redis=require(_0x3f2e('0x3'));var config=require(_0x3f2e('0x4'));var logger=require(_0x3f2e('0x5'))(_0x3f2e('0x6'));config[_0x3f2e('0x7')]=_[_0x3f2e('0x8')](config[_0x3f2e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3f2e('0x9'))(new Redis(config[_0x3f2e('0x7')]));function emit(_0x3c0864,_0xdf499f,_0x12c6e7){io['to'](_0x3c0864)[_0x3f2e('0xa')](_0xdf499f,_0x12c6e7);}function sendNotification(_0x3636f6,_0x434e0c,_0x2676a7,_0x29a6cc,_0x21f22b,_0x32902a){io['to'](util[_0x3f2e('0xb')](_0x3f2e('0xc'),_0x29a6cc[_0x3f2e('0xd')]))[_0x3f2e('0xa')](_0x3f2e('0xe'),_0x29a6cc);var _0x475cd2=_0x32902a||{};var _0x39b819=_0x2676a7['split']('.');var _0x27c697={'uniqueid':_0x434e0c,'channel':_0x39b819[0x0],'id':_0x39b819[0x1],'title':_0x39b819[0x0]+_0x3f2e('0xf'),'interactionId':_0x39b819[0x2],'queue':_0x21f22b?_0x21f22b['name']:null,'sound':_0x475cd2[_0x3f2e('0x10')][_0x3f2e('0x11')],'shake':_0x475cd2[_0x3f2e('0x10')][_0x3f2e('0x12')]};try{if(!_0x475cd2[_0x3f2e('0x13')]){_0x475cd2['body']={};}if(_0x21f22b){_0x475cd2[_0x3f2e('0x13')][_0x3f2e('0x14')]=_0x21f22b;}else if(_0x475cd2[_0x3f2e('0x13')]['queue']){delete _0x475cd2[_0x3f2e('0x13')][_0x3f2e('0x14')];}_0x27c697[_0x3f2e('0x15')]=utils[_0x3f2e('0x16')](_0x475cd2[_0x3f2e('0x10')][_0x3f2e('0x17')],_0x475cd2);}catch(_0x1c2c0c){_0x27c697[_0x3f2e('0x15')]=_0x3f2e('0x18');logger[_0x3f2e('0x19')](util[_0x3f2e('0xb')]('[%s][QUEUE]\x20%s',_0x434e0c,_0x1c2c0c[_0x3f2e('0x1a')]));}io['to'](util[_0x3f2e('0xb')](_0x3f2e('0xc'),_0x29a6cc[_0x3f2e('0xd')]))[_0x3f2e('0xa')](util['format']('notification:%s',_0x3636f6?_0x3f2e('0x1b'):_0x3f2e('0x1c')),_0x27c697);}function writeLog(_0x38bbae,_0x2ac500,_0x4381e5){return logger[_0x3f2e('0x1d')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x38bbae,_0x2ac500[_0x3f2e('0xd')],_0x4381e5));}exports[_0x3f2e('0x1e')]=function(_0x5a66d6,_0x541292,_0x46bb1c,_0x5646f5){if(_0x541292[_0x3f2e('0x1f')]){writeLog(_0x5a66d6,_0x541292,_0x3f2e('0x20'));return![];}if(!_0x541292['online']){writeLog(_0x5a66d6,_0x541292,'OFFLINE');return![];}if(_0x541292[_0x46bb1c+'Pause']){writeLog(_0x5a66d6,_0x541292,_0x3f2e('0x21'));return![];}if(_0x5646f5&&_0x541292[_0x3f2e('0x22')](_0x46bb1c+'Capacity')&&_0x541292[_0x3f2e('0x22')](_0x46bb1c+'CurrentCapacity')){if(_0x541292[_0x46bb1c+_0x3f2e('0x23')]>0x0&&_0x541292[_0x46bb1c+'CurrentCapacity']>=_0x541292[_0x46bb1c+_0x3f2e('0x23')]){writeLog(_0x5a66d6,_0x541292,_0x46bb1c[_0x3f2e('0x24')]()+_0x3f2e('0x25'));return![];}}return!![];};exports[_0x3f2e('0x26')]=function(_0x11bad1,_0x4799d3,_0x426d68,_0x28ef64,_0x5eab38){return sendNotification(!![],_0x11bad1,_0x4799d3,_0x426d68,_0x28ef64,_0x5eab38);};exports['hideNotification']=function(_0x2b9fda,_0x1e5db4,_0x35f421,_0x22e6ad,_0x5452f5){return sendNotification(![],_0x2b9fda,_0x1e5db4,_0x35f421,_0x22e6ad,_0x5452f5);};exports[_0x3f2e('0x27')]=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 dd0a53d..fa3195d 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 _0xb223=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','shelljs','../../../../config/logger','routing','string'];(function(_0x2f60a3,_0x4e4b91){var _0x2ab592=function(_0x2715d0){while(--_0x2715d0){_0x2f60a3['push'](_0x2f60a3['shift']());}};_0x2ab592(++_0x4e4b91);}(_0xb223,0x194));var _0x3b22=function(_0x5b3afb,_0x278363){_0x5b3afb=_0x5b3afb-0x0;var _0x411c77=_0xb223[_0x5b3afb];return _0x411c77;};'use strict';var schema=require('validate');var sh=require(_0x3b22('0x0'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x3b22('0x1'))(_0x3b22('0x2'));var system=schema({'command':{'type':_0x3b22('0x3'),'required':!![],'message':_0x3b22('0x4')}});exports[_0x3b22('0x5')]=function(_0x493144,_0x22f0ba){return function(_0x610298){try{var _0x4d91a8={'command':_0x22f0ba[0x0]};var _0x2d826a=system[_0x3b22('0x6')](_0x4d91a8,{'typecast':!![]});if(_0x2d826a[_0x3b22('0x7')]){logger[_0x3b22('0x8')](_0x3b22('0x9'),_0x493144,_[_0x3b22('0xa')](_0x2d826a,'message')[_0x3b22('0xb')](',\x20'));logger[_0x3b22('0xc')](_0x3b22('0xd'),_0x493144);_0x610298[_0x3b22('0xe')]();}else{var _0x358286=this;var _0x4a244d=utils['getMustacheRender'](_0x22f0ba[0x0],this);logger['info'](_0x3b22('0xf'),_0x493144,_0x4a244d);sh[_0x3b22('0x10')](_[_0x3b22('0x11')](_0x4a244d),function(_0x52f85f,_0xd8ca3){logger[_0x3b22('0xc')](_0x3b22('0x12'),_0x493144,_0x52f85f);if(_0x52f85f==0x0){var _0x1233f6=_0xd8ca3['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x22f0ba[0x1])||_[_0x3b22('0x13')](_0x22f0ba[0x1])){logger[_0x3b22('0xc')](_0x3b22('0x14'),_0x493144);_0x358286[_0x3b22('0x15')][_0x22f0ba[0x1]]=_0x1233f6;}else{logger[_0x3b22('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x493144,_0x22f0ba[0x1],_0x1233f6);_0x358286['body'][_0x22f0ba[0x1]]=_0x1233f6;}}_0x610298[_0x3b22('0xe')]();});}}catch(_0x2771e8){logger[_0x3b22('0x8')](_0x3b22('0x9'),_0x493144,_[_0x3b22('0x16')](_0x2771e8)?JSON[_0x3b22('0x17')](_0x2771e8):_0x2771e8);logger[_0x3b22('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x493144);_0x610298[_0x3b22('0xe')]();}};}; \ No newline at end of file +var _0x1016=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1016,0x124));var _0x6101=function(_0x1cc2db,_0x31791c){_0x1cc2db=_0x1cc2db-0x0;var _0x1e08b7=_0x1016[_0x1cc2db];return _0x1e08b7;};'use strict';var schema=require(_0x6101('0x0'));var sh=require(_0x6101('0x1'));var _=require(_0x6101('0x2'));var utils=require('./utils');var logger=require(_0x6101('0x3'))(_0x6101('0x4'));var system=schema({'command':{'type':_0x6101('0x5'),'required':!![],'message':_0x6101('0x6')}});exports[_0x6101('0x7')]=function(_0x11c400,_0x1ad545){return function(_0x2b0043){try{var _0x49bf64={'command':_0x1ad545[0x0]};var _0x3bd613=system[_0x6101('0x0')](_0x49bf64,{'typecast':!![]});if(_0x3bd613['length']){logger[_0x6101('0x8')](_0x6101('0x9'),_0x11c400,_[_0x6101('0xa')](_0x3bd613,_0x6101('0xb'))[_0x6101('0xc')](',\x20'));logger['info'](_0x6101('0xd'),_0x11c400);_0x2b0043[_0x6101('0xe')]();}else{var _0x329bac=this;var _0x38dc8d=utils[_0x6101('0xf')](_0x1ad545[0x0],this);logger['info'](_0x6101('0x10'),_0x11c400,_0x38dc8d);sh[_0x6101('0x11')](_[_0x6101('0x12')](_0x38dc8d),function(_0x2f11ee,_0x170094){logger[_0x6101('0x13')](_0x6101('0x14'),_0x11c400,_0x2f11ee);if(_0x2f11ee==0x0){var _0x150993=_0x170094['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x6101('0x15')](_0x1ad545[0x1])||_[_0x6101('0x16')](_0x1ad545[0x1])){logger[_0x6101('0x13')](_0x6101('0x17'),_0x11c400);_0x329bac[_0x6101('0x18')][_0x1ad545[0x1]]=_0x150993;}else{logger[_0x6101('0x13')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x11c400,_0x1ad545[0x1],_0x150993);_0x329bac[_0x6101('0x18')][_0x1ad545[0x1]]=_0x150993;}}_0x2b0043[_0x6101('0xe')]();});}}catch(_0x5b193d){logger['error']('[%s][SYSTEM]\x20%s',_0x11c400,_['isObject'](_0x5b193d)?JSON[_0x6101('0x19')](_0x5b193d):_0x5b193d);logger[_0x6101('0x13')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x11c400);_0x2b0043[_0x6101('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 173a232..8a9f9c8 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 _0x5ba7=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify'];(function(_0x1eeacc,_0x7e161){var _0x367622=function(_0x37988b){while(--_0x37988b){_0x1eeacc['push'](_0x1eeacc['shift']());}};_0x367622(++_0x7e161);}(_0x5ba7,0x18b));var _0x75ba=function(_0x2ba04b,_0x3fa6b6){_0x2ba04b=_0x2ba04b-0x0;var _0x5c16e3=_0x5ba7[_0x2ba04b];return _0x5c16e3;};'use strict';var schema=require(_0x75ba('0x0'));var _=require(_0x75ba('0x1'));var rpc={'chatInteraction':require(_0x75ba('0x2')),'openchannelInteraction':require(_0x75ba('0x3')),'smsInteraction':require(_0x75ba('0x4')),'mailInteraction':require(_0x75ba('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x75ba('0x6'));var tag=schema({'tag':{'type':_0x75ba('0x7'),'required':!![],'message':_0x75ba('0x8')}});exports[_0x75ba('0x9')]=function(_0x3f8acb,_0x5333d7,_0x12db76,_0x46912d){return function(_0x524bd1){try{var _0x2c9d2f={'tag':_0x5333d7[0x0]};var _0x2abe0e=tag[_0x75ba('0x0')](_0x2c9d2f,{'typecast':!![]});if(_0x2abe0e[_0x75ba('0xa')]){logger[_0x75ba('0xb')](_0x75ba('0xc'),_0x3f8acb,_[_0x75ba('0xd')](_0x2abe0e,'message')[_0x75ba('0xe')](',\x20'));logger[_0x75ba('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3f8acb);_0x524bd1[_0x75ba('0x10')]();}else{var _0x24058d={'ids':[_0x5333d7[0x0]]};if(rpc[_0x46912d[_0x75ba('0x11')]+_0x75ba('0x12')]){rpc[_0x46912d[_0x75ba('0x11')]+_0x75ba('0x12')][_0x75ba('0x13')](_0x46912d['interaction']['id'],_0x24058d)[_0x75ba('0x14')](function(_0x33dd02){logger[_0x75ba('0xf')](_0x75ba('0x15'),_0x3f8acb,_0x5333d7[0x1],_0x46912d[_0x75ba('0x11')],_0x46912d[_0x75ba('0x16')]['id']);})[_0x75ba('0x17')](function(_0x4e439a){logger[_0x75ba('0xb')](_0x75ba('0xc'),_0x3f8acb,JSON[_0x75ba('0x18')](_0x4e439a));logger[_0x75ba('0xf')](_0x75ba('0x19'),_0x3f8acb);})[_0x75ba('0x1a')](function(){_0x524bd1[_0x75ba('0x10')]();});}}}catch(_0x128971){logger['error'](_0x75ba('0xc'),_0x3f8acb,_[_0x75ba('0x1b')](_0x128971)?JSON['stringify'](_0x128971):_0x128971);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3f8acb);_0x524bd1[_0x75ba('0x10')]();}};}; \ No newline at end of file +var _0x7670=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','[%s][TAG]\x20%s','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7670,0x1f1));var _0x0767=function(_0xdc7581,_0x10270f){_0xdc7581=_0xdc7581-0x0;var _0x12e586=_0x7670[_0xdc7581];return _0x12e586;};'use strict';var schema=require('validate');var _=require(_0x0767('0x0'));var rpc={'chatInteraction':require(_0x0767('0x1')),'openchannelInteraction':require(_0x0767('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x0767('0x3')),'faxInteraction':require(_0x0767('0x4')),'whatsappInteraction':require(_0x0767('0x5'))};var logger=require(_0x0767('0x6'))(_0x0767('0x7'));var tag=schema({'tag':{'type':_0x0767('0x8'),'required':!![],'message':_0x0767('0x9')}});exports['consequence']=function(_0x57f1d2,_0x22f9ee,_0x551858,_0x153f1c){return function(_0x4d5df6){try{var _0x348cf2={'tag':_0x22f9ee[0x0]};var _0x52aeaa=tag['validate'](_0x348cf2,{'typecast':!![]});if(_0x52aeaa[_0x0767('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x57f1d2,_[_0x0767('0xb')](_0x52aeaa,_0x0767('0xc'))['join'](',\x20'));logger[_0x0767('0xd')](_0x0767('0xe'),_0x57f1d2);_0x4d5df6[_0x0767('0xf')]();}else{var _0x240b5e={'ids':[_0x22f9ee[0x0]]};if(rpc[_0x153f1c[_0x0767('0x10')]+_0x0767('0x11')]){rpc[_0x153f1c[_0x0767('0x10')]+_0x0767('0x11')][_0x0767('0x12')](_0x153f1c[_0x0767('0x13')]['id'],_0x240b5e)[_0x0767('0x14')](function(_0x1a3b6c){logger[_0x0767('0xd')](_0x0767('0x15'),_0x57f1d2,_0x22f9ee[0x1],_0x153f1c[_0x0767('0x10')],_0x153f1c['interaction']['id']);})[_0x0767('0x16')](function(_0x5821cb){logger[_0x0767('0x17')]('[%s][TAG]\x20%s',_0x57f1d2,JSON[_0x0767('0x18')](_0x5821cb));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x57f1d2);})[_0x0767('0x19')](function(){_0x4d5df6['next']();});}}}catch(_0x277820){logger[_0x0767('0x17')](_0x0767('0x1a'),_0x57f1d2,_[_0x0767('0x1b')](_0x277820)?JSON[_0x0767('0x18')](_0x277820):_0x277820);logger[_0x0767('0xd')](_0x0767('0xe'),_0x57f1d2);_0x4d5df6['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index b003782..84c60f4 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc72=['lodash','consequence','replace','\x20-\x20','includes','push','?params=','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xfc72,0x1df));var _0x2fc7=function(_0x34331b,_0x22a64c){_0x34331b=_0x34331b-0x0;var _0x1f97c8=_0xfc72[_0x34331b];return _0x1f97c8;};'use strict';var rp=require('request-promise');var logger=require(_0x2fc7('0x0'))('routing');var _=require(_0x2fc7('0x1'));var arr=[];exports[_0x2fc7('0x2')]=function(_0x2c6f61,_0x26fbd0){return function(_0x47525b){var _0x5e6128=_0x26fbd0[0xa];var _0x2833b2=_0x26fbd0[0xb];var _0xd8745b=_0x26fbd0[0xc];var _0x5190ce=_0x26fbd0[0xd];var _0x2e5caa=_0x26fbd0[0xe];var _0x213a34=_0x26fbd0[0xf][_0x2fc7('0x3')](/\n/g,_0x2fc7('0x4'));var _0x41d561=_0x26fbd0[0x10][_0x2fc7('0x3')](/\n/g,'\x20');if(!arr[_0x2fc7('0x5')](_0x2833b2)){arr[_0x2fc7('0x6')](_0x2833b2);var _0x108229=_0x26fbd0[0x3];var _0x589507=_0x26fbd0[0x4];var _0x19267a=_0x26fbd0[0x1];var _0x569d1f=_0x26fbd0[0x0];var _0x174539={};_0x174539['urlOnAnswer']=_0x26fbd0[0x8]+_0x2fc7('0x7')+_0xd8745b+'|'+_0x5e6128+'|'+_0x5190ce+'|'+_0x2833b2+'|'+_0x2e5caa;_0x174539['urlOnRing']=_0x26fbd0[0x7]+_0x2fc7('0x7')+_0xd8745b+'|'+_0x5e6128+'|'+_0x5190ce+'|'+_0x2833b2+'|'+_0x2e5caa+'|'+_0x213a34+'|'+_0x41d561;_0x174539[_0x2fc7('0x8')]=_0x26fbd0[0x9];var _0xdd861c={};_0xdd861c[_0x2fc7('0x9')]=_0x2fc7('0xa');_0xdd861c[_0x2fc7('0xb')]=_0x2fc7('0xc');var _0x18036f=[];_0x18036f[_0x2fc7('0x6')](_0x26fbd0[0x2]);_0x18036f[_0x2fc7('0x6')](_0x26fbd0[0x5]);_0x18036f[_0x2fc7('0x6')](_0x26fbd0[0x6]);_0xdd861c[_0x2fc7('0xd')]=_0x18036f;_0xdd861c['id']=0x1;var _0x267e4a=JSON[_0x2fc7('0xe')](_0xdd861c);var _0x58fc65={'encoding':_0x2fc7('0xf'),'method':_0x2fc7('0x10'),'timeout':0x2710,'url':_0x108229,'headers':{'Content-Type':_0x2fc7('0x11')},'body':_0x267e4a};return rp(_0x58fc65)[_0x2fc7('0x12')](function(_0x466893){const _0xa319ac=JSON[_0x2fc7('0x13')](_0x466893);if(!_0xa319ac[_0x2fc7('0x14')][_0x2fc7('0x15')]){throw new Error(_0x2fc7('0x16'));}var _0x46c665=_0x2833b2;var _0xeb7d9a=_0x2fc7('0x17')+_0x19267a+_0x2fc7('0x18')+_0x569d1f+'&sessionId='+_0x46c665+_0x2fc7('0x19')+JSON['stringify'](_0x174539);var _0x50dbc0=_0x589507+'?'+_0xeb7d9a;return rp(_0x50dbc0);})['then'](function(_0x3d91f5){logger['info'](_0x2fc7('0x1a'),_0x2c6f61,_0x3d91f5);_0x47525b[_0x2fc7('0x1b')]();})['catch'](function(_0x181f4d){logger[_0x2fc7('0x1c')]('[%s][TVOX]\x20%s',_0x2c6f61,_['isObject'](_0x181f4d)?JSON[_0x2fc7('0xe')](_0x181f4d):_0x181f4d);_0x47525b[_0x2fc7('0x1b')]();});}else{logger[_0x2fc7('0x1d')](_0x2fc7('0x1e'),_0x2c6f61);_0x47525b[_0x2fc7('0x1f')]();}};}; \ No newline at end of file +var _0x7d62=['info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','push','?params=','urlOnRing','title','2.0','method','login','application/json-rpc','then','result','&serviceId=','&data=','stringify'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0x7d62,0xbd));var _0x27d6=function(_0x150de5,_0x392c60){_0x150de5=_0x150de5-0x0;var _0x4c8102=_0x7d62[_0x150de5];return _0x4c8102;};'use strict';var rp=require('request-promise');var logger=require(_0x27d6('0x0'))(_0x27d6('0x1'));var _=require(_0x27d6('0x2'));var arr=[];exports[_0x27d6('0x3')]=function(_0xced794,_0x4b9bb6){return function(_0x274b15){var _0x4876cd=_0x4b9bb6[0xa];var _0x1827f4=_0x4b9bb6[0xb];var _0x5f7574=_0x4b9bb6[0xc];var _0x4eb918=_0x4b9bb6[0xd];var _0x27e57c=_0x4b9bb6[0xe];var _0x378943=_0x4b9bb6[0xf]['replace'](/\n/g,_0x27d6('0x4'));var _0x41ce76=_0x4b9bb6[0x10][_0x27d6('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x1827f4)){arr[_0x27d6('0x6')](_0x1827f4);var _0x498620=_0x4b9bb6[0x3];var _0x405b77=_0x4b9bb6[0x4];var _0x3574ec=_0x4b9bb6[0x1];var _0x48b9b9=_0x4b9bb6[0x0];var _0x390d91={};_0x390d91['urlOnAnswer']=_0x4b9bb6[0x8]+_0x27d6('0x7')+_0x5f7574+'|'+_0x4876cd+'|'+_0x4eb918+'|'+_0x1827f4+'|'+_0x27e57c;_0x390d91[_0x27d6('0x8')]=_0x4b9bb6[0x7]+_0x27d6('0x7')+_0x5f7574+'|'+_0x4876cd+'|'+_0x4eb918+'|'+_0x1827f4+'|'+_0x27e57c+'|'+_0x378943+'|'+_0x41ce76;_0x390d91[_0x27d6('0x9')]=_0x4b9bb6[0x9];var _0x3deac6={};_0x3deac6['jsonrpc']=_0x27d6('0xa');_0x3deac6[_0x27d6('0xb')]=_0x27d6('0xc');var _0x19cc4c=[];_0x19cc4c[_0x27d6('0x6')](_0x4b9bb6[0x2]);_0x19cc4c[_0x27d6('0x6')](_0x4b9bb6[0x5]);_0x19cc4c[_0x27d6('0x6')](_0x4b9bb6[0x6]);_0x3deac6['params']=_0x19cc4c;_0x3deac6['id']=0x1;var _0x4c4e5d=JSON['stringify'](_0x3deac6);var _0x408e5d={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x498620,'headers':{'Content-Type':_0x27d6('0xd')},'body':_0x4c4e5d};return rp(_0x408e5d)[_0x27d6('0xe')](function(_0xd2be7f){const _0x5b6af8=JSON['parse'](_0xd2be7f);if(!_0x5b6af8[_0x27d6('0xf')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x33064a=_0x1827f4;var _0x4f6060='channelId='+_0x3574ec+_0x27d6('0x10')+_0x48b9b9+'&sessionId='+_0x33064a+_0x27d6('0x11')+JSON[_0x27d6('0x12')](_0x390d91);var _0x4349d5=_0x405b77+'?'+_0x4f6060;return rp(_0x4349d5);})[_0x27d6('0xe')](function(_0x574637){logger[_0x27d6('0x13')](_0x27d6('0x14'),_0xced794,_0x574637);_0x274b15[_0x27d6('0x15')]();})[_0x27d6('0x16')](function(_0x2a94c6){logger[_0x27d6('0x17')](_0x27d6('0x18'),_0xced794,_[_0x27d6('0x19')](_0x2a94c6)?JSON[_0x27d6('0x12')](_0x2a94c6):_0x2a94c6);_0x274b15[_0x27d6('0x15')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xced794);_0x274b15['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 9f966f9..c66ea89 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x2c5c53,_0x272eb5){var _0x7305ee=function(_0x2bccd5){while(--_0x2bccd5){_0x2c5c53['push'](_0x2c5c53['shift']());}};_0x7305ee(++_0x272eb5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2f948a,_0x55e48e){var _0x593823=function(_0x16383c){while(--_0x16383c){_0x2f948a['push'](_0x2f948a['shift']());}};_0x593823(++_0x55e48e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 12306c9..02f5ec5 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 _0x26c2=['smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','log','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','uuid','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','interaction','applications','isArray','length','join','app','.js','appdata','mail','push','slice','split','amazonlex','message','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','rules','execute','Applications\x20executed','complete','stack','error','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues'];(function(_0x90a194,_0x5dccf1){var _0x173c17=function(_0x2bc560){while(--_0x2bc560){_0x90a194['push'](_0x90a194['shift']());}};_0x173c17(++_0x5dccf1);}(_0x26c2,0x130));var _0x226c=function(_0x47d256,_0x20c88c){_0x47d256=_0x47d256-0x0;var _0x4e527b=_0x26c2[_0x47d256];return _0x4e527b;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x226c('0x0'));var BPromise=require(_0x226c('0x1'));var uuid=require(_0x226c('0x2'));var utils=require(_0x226c('0x3'));var config=require('../../../config/environment');var logger=require(_0x226c('0x4'))(_0x226c('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x226c('0x6')),'chatQueueReport':require(_0x226c('0x7')),'smsQueueReport':require(_0x226c('0x8')),'faxQueueReport':require(_0x226c('0x9')),'whatsappQueueReport':require(_0x226c('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x34cbc3,_0x461773,_0x335cab){return util[_0x226c('0xb')](_0x226c('0xc'),_0x34cbc3,_0x461773||0x0,_0x335cab||0x0);}function getIntervals(_0x51879f,_0x16cbbd){var _0x3280f8=[];if(!_['isNil'](_0x16cbbd['IntervalId'])&&!_[_0x226c('0xd')](_0x51879f[_0x16cbbd[_0x226c('0xe')]])&&!_[_0x226c('0xd')](_0x51879f[_0x16cbbd[_0x226c('0xe')]][_0x226c('0xf')])){_0x3280f8=_[_0x226c('0x10')](_0x51879f[_0x16cbbd[_0x226c('0xe')]]['Intervals'],'interval');}else if(!_[_0x226c('0xd')](_0x16cbbd[_0x226c('0x11')])){_0x3280f8=[_0x16cbbd[_0x226c('0x11')]];}return _0x3280f8;}exports[_0x226c('0x12')]=function(_0x4eb557){_0x4eb557['rules']={};return new BPromise(function(_0x21d61b,_0x3cff57){var _0x15e13b={'Start':function(_0x55697c){var _0x5d6c21=this;return new Promise(function(_0x694eef,_0x2e4a51){if(_0x55697c){try{var _0x30755=[];var _0x45a804=getId(_0x55697c[_0x226c('0x13')],_0x55697c['message']?_0x55697c['message']['id']:0x0,_0x55697c['interaction']?_0x55697c[_0x226c('0x14')]['id']:0x0);if(_0x55697c[_0x226c('0x15')]&&_[_0x226c('0x16')](_0x55697c[_0x226c('0x15')])&&_0x55697c['applications'][_0x226c('0x17')]){for(var _0xb6417f=0x0;_0xb6417f<_0x55697c[_0x226c('0x15')][_0x226c('0x17')];_0xb6417f+=0x1){var _0x11fa82=_0x55697c[_0x226c('0x15')][_0xb6417f];if(fs['existsSync'](path[_0x226c('0x18')](__dirname,_0x226c('0x15'),_0x11fa82[_0x226c('0x19')]+_0x226c('0x1a')))){var _0x272f26=[];switch(_0x11fa82['app']['toLowerCase']()){case'autoreply':var _0x1f1bf2=_0x11fa82[_0x226c('0x1b')]['split'](',');if(_0x55697c[_0x226c('0x13')]===_0x226c('0x1c')){_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x0]);_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x1]);_0x272f26[_0x226c('0x1d')](_0x1f1bf2['slice'](0x2,_0x1f1bf2[_0x226c('0x17')])['join'](','));}else{_0x272f26[_0x226c('0x1d')](_0x1f1bf2[0x0]);_0x272f26['push'](_0x1f1bf2[_0x226c('0x1e')](0x1,_0x1f1bf2[_0x226c('0x17')])[_0x226c('0x18')](','));}break;case'dialogflow':var _0x14c49b=_0x11fa82['appdata'][_0x226c('0x1f')](',');_0x272f26['push'](_0x14c49b[0x0]);_0x272f26[_0x226c('0x1d')](_0x14c49b[0x1]);_0x272f26['push'](_0x14c49b[_0x226c('0x1e')](0x2,_0x14c49b[_0x226c('0x17')])['join'](','));break;case'dialogflowv2':var _0x3b1e93=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x0]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x1]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x2]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[0x3]);_0x272f26[_0x226c('0x1d')](_0x3b1e93[_0x226c('0x1e')](0x4,_0x3b1e93[_0x226c('0x17')])[_0x226c('0x18')](','));break;case _0x226c('0x20'):var _0x49e901=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26[_0x226c('0x1d')](_0x49e901[0x0]);_0x272f26[_0x226c('0x1d')](_0x49e901[0x1]);_0x272f26[_0x226c('0x1d')](_0x49e901[0x2]);_0x272f26['push'](_0x49e901[0x3]);_0x272f26[_0x226c('0x1d')](_0x49e901[_0x226c('0x1e')](0x4,_0x49e901[_0x226c('0x17')])['join'](','));break;case _0x226c('0x21'):_0x272f26['push'](_0x11fa82[_0x226c('0x1b')]);break;case _0x226c('0x22'):_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x23')]);_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x1b')]);break;case _0x226c('0x24'):var _0x39e942=utils[_0x226c('0x25')](_0x55697c[_0x226c('0x26')][_0x226c('0x27')],_0x55697c);var _0x3062d7=_0x11fa82[_0x226c('0x1b')][_0x226c('0x1f')](',');_0x272f26['push'](_0x3062d7[0x0]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x1]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x2]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x3]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x4]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x5]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x6]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x7]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x8]);_0x272f26[_0x226c('0x1d')](_0x3062d7[0x9]);_0x272f26['push'](_0x3062d7[0xa]);_0x272f26['push'](_0x55697c[_0x226c('0x14')]['id']);_0x272f26[_0x226c('0x1d')](_0x55697c[_0x226c('0x21')]['id']);_0x272f26[_0x226c('0x1d')](_0x11fa82[_0x226c('0x28')]);_0x272f26[_0x226c('0x1d')](_0x55697c[_0x226c('0x14')][_0x226c('0x29')]);_0x272f26[_0x226c('0x1d')](_0x55697c['body'][_0x226c('0x2a')]);_0x272f26['push'](_0x39e942);break;default:_0x272f26=_[_0x226c('0xd')](_0x11fa82[_0x226c('0x1b')])?[]:_0x11fa82[_0x226c('0x1b')]['split'](',');}var _0x507aa8={'id':util[_0x226c('0xb')](_0x226c('0x2b'),_0x45a804,_0x11fa82['id'],_0x11fa82['app']),'condition':require(_0x226c('0x2c'))[_0x226c('0x2d')](_0x45a804,getIntervals(_0x4eb557[_0x226c('0x2e')],_0x11fa82),_0x4eb557),'consequence':require(_0x226c('0x2f')+_0x11fa82['app'])[_0x226c('0x30')](_0x45a804,_0x272f26,_0x4eb557,_0x55697c),'p':_0x11fa82[_0x226c('0x31')]||0x0};logger[_0x226c('0x32')]('Push\x20new\x20rule',_0x507aa8['id'],_0x226c('0x33'),getIntervals(_0x4eb557[_0x226c('0x2e')],_0x11fa82)[_0x226c('0x18')](_0x226c('0x34')));_0x30755[_0x226c('0x1d')](_0x507aa8);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x226c('0x15'),_0x11fa82[_0x226c('0x19')]+_0x226c('0x1a')));}}_0x4eb557[_0x226c('0x35')][_0x45a804]=new RuleEngine(_0x30755);_0x4eb557[_0x226c('0x35')][_0x45a804][_0x226c('0x36')](_0x55697c,function(_0x16ae23){logger[_0x226c('0x32')](_0x226c('0x37'),JSON['stringify'](_0x16ae23['matchPath']));if(_0x4eb557[_0x226c('0x35')][_0x45a804]){_0x4eb557[_0x226c('0x35')][_0x45a804]['emit'](_0x226c('0x38'));}});return _0x694eef({'code':0xc8,'message':_0x55697c});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x694eef({'code':0xc8,'message':_0x55697c});}}catch(_0x1b2338){logger['error'](_0x1b2338[_0x226c('0x39')]);return _0x2e4a51(_0x5d6c21[_0x226c('0x3a')](0x1f4,_0x1b2338));}}return _0x2e4a51(_0x226c('0x3b'));});},'AcceptMessage':function(_0x1c6618){var _0x89b599=this;return new Promise(function(_0x1e3cda,_0x4e705c){if(_0x1c6618[_0x226c('0x3c')]&&_0x1c6618['agent']['id']){if(_0x4eb557[_0x226c('0x3d')][_0x1c6618[_0x226c('0x3c')]['id']]){_0x4eb557[_0x226c('0x3d')][_0x1c6618[_0x226c('0x3c')]['id']]['busy']=![];_0x4eb557[_0x226c('0x3d')][_0x1c6618['agent']['id']][_0x226c('0x3e')]=undefined;}}if(_0x1c6618[_0x226c('0x21')]&&_0x1c6618[_0x226c('0x21')]['id']){try{var _0x707957=getId(_0x1c6618[_0x226c('0x13')],_0x1c6618[_0x226c('0x21')]?_0x1c6618['message']['id']:0x0,_0x1c6618[_0x226c('0x14')]?_0x1c6618[_0x226c('0x14')]['id']:0x0);if(_0x4eb557[_0x226c('0x35')][_0x707957]){_0x4eb557[_0x226c('0x35')][_0x707957][_0x226c('0x3f')](_0x226c('0x40'));if(rpc[_0x1c6618[_0x226c('0x13')]+_0x226c('0x41')]){rpc[_0x1c6618[_0x226c('0x13')]+_0x226c('0x41')][_0x226c('0x42')](_0x707957,{'UserId':_0x1c6618[_0x226c('0x21')]['UserId']})['catch'](function(_0x486510){logger[_0x226c('0x3a')](_0x226c('0x43'));});}}return _0x1e3cda({'code':0xc8,'message':_0x1c6618});}catch(_0x1cbf5d){logger['error'](_0x1cbf5d[_0x226c('0x39')]);return _0x4e705c(_0x89b599[_0x226c('0x3a')](0x1f4,_0x1cbf5d));}}logger['error'](_0x226c('0x44'));return _0x4e705c(_0x89b599[_0x226c('0x3a')](0x1f4,_0x226c('0x44')));});},'RejectMessage':function(_0x28d055){var _0x2a1d64=this;return new Promise(function(_0x3c0dfb,_0x3e60bf){if(_0x28d055[_0x226c('0x3c')]&&_0x28d055['agent']['id']){try{if(_0x4eb557[_0x226c('0x3d')][_0x28d055[_0x226c('0x3c')]['id']]){_0x4eb557['agents'][_0x28d055[_0x226c('0x3c')]['id']][_0x226c('0x45')]=![];_0x4eb557[_0x226c('0x3d')][_0x28d055[_0x226c('0x3c')]['id']][_0x226c('0x3e')]=undefined;}return _0x3c0dfb({'code':0xc8,'message':_0x28d055});}catch(_0x2a099a){logger['error'](_0x2a099a[_0x226c('0x39')]);return _0x3e60bf(_0x2a1d64['error'](0x1f4,_0x2a099a));}}logger['error'](_0x226c('0x44'));return _0x3e60bf(_0x2a1d64[_0x226c('0x3a')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3861be){var _0x17cfc1=this;return new Promise(function(_0x347be6,_0x54b6bc){if(_0x3861be[_0x226c('0x13')]&&_0x3861be[_0x226c('0x14')]&&_0x3861be[_0x226c('0x14')]['id']){try{var _0x24096f=getId(_0x3861be[_0x226c('0x13')],_0x3861be['message']?_0x3861be[_0x226c('0x21')]['id']:0x0,_0x3861be['interaction']?_0x3861be['interaction']['id']:0x0);if(_0x4eb557[_0x226c('0x35')][_0x24096f]){_0x4eb557[_0x226c('0x35')][_0x24096f][_0x226c('0x3f')]('end');}return _0x347be6({'code':0xc8,'message':_0x3861be});}catch(_0xb225d3){logger[_0x226c('0x3a')](_0xb225d3['stack']);return _0x54b6bc(_0x17cfc1[_0x226c('0x3a')](0x1f4,_0xb225d3));}}logger[_0x226c('0x3a')](_0x226c('0x44'));return _0x54b6bc(_0x17cfc1['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x26cfd5){var _0x55db16=this;return new Promise(function(_0x29d34c,_0xfb8c4b){if(_0x4eb557['agents']['hasOwnProperty'](_0x26cfd5['id'])){for(var _0x1790c7 in _0x26cfd5[_0x226c('0x46')]){if(_0x26cfd5[_0x226c('0x46')][_0x226c('0x47')](_0x1790c7)){if(_0x4eb557['agents'][_0x26cfd5['id']][_0x226c('0x47')](_0x1790c7+_0x226c('0x48'))){_0x4eb557[_0x226c('0x3d')][_0x26cfd5['id']][_0x1790c7+'CurrentCapacity']=parseInt(_0x26cfd5[_0x226c('0x46')][_0x1790c7],0xa);}}}_0x4eb557['agents'][_0x26cfd5['id']][_0x226c('0x49')]();return _0x29d34c({'code':0xc8,'message':_0x4eb557[_0x226c('0x3d')][_0x26cfd5['id']]});}else{return _0xfb8c4b(_0x55db16[_0x226c('0x3a')](0x1f4,_0x226c('0x4a')));}});},'Agents':function(_0x30ddc2){return new Promise(function(_0x3711c9,_0x222932){var _0x40ed3a=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x3d')]);_0x3711c9({'count':_0x40ed3a[_0x226c('0x17')],'rows':_0x40ed3a});});},'ChatQueues':function(_0x2268e6){return new Promise(function(_0x52605b,_0x435c42){var _0x3d128d=[];for(var _0x1c3973 in _0x4eb557[_0x226c('0x4c')]){if(_0x4eb557[_0x226c('0x4c')][_0x226c('0x47')](_0x1c3973)){var _0x29ff98=_0x4eb557['chatQueues'][_0x1c3973];var _0x2856f4={'id':_0x29ff98['id'],'available':_0x29ff98['available'],'loggedIn':_0x29ff98[_0x226c('0x4d')],'name':_0x29ff98['name'],'paused':_0x29ff98[_0x226c('0x4e')],'waiting':_0x29ff98[_0x226c('0x4f')]};_0x3d128d[_0x226c('0x1d')](_0x2856f4);}}_0x52605b({'count':_0x3d128d[_0x226c('0x17')],'rows':_0x3d128d});});},'MailQueues':function(_0x5645a7){return new Promise(function(_0x13a8d6,_0x2d447d){var _0x315ac6=[];for(var _0x57490f in _0x4eb557[_0x226c('0x50')]){if(_0x4eb557[_0x226c('0x50')][_0x226c('0x47')](_0x57490f)){var _0xb580f0=_0x4eb557[_0x226c('0x50')][_0x57490f];var _0x487451={'id':_0xb580f0['id'],'available':_0xb580f0[_0x226c('0x51')],'loggedIn':_0xb580f0['loggedIn'],'name':_0xb580f0[_0x226c('0x52')],'paused':_0xb580f0[_0x226c('0x4e')],'waiting':_0xb580f0[_0x226c('0x4f')]};_0x315ac6[_0x226c('0x1d')](_0x487451);}}_0x13a8d6({'count':_0x315ac6['length'],'rows':_0x315ac6});});},'OpenchannelQueues':function(_0xda4304){return new Promise(function(_0x33cd69,_0x50b481){var _0x19d927=[];for(var _0x3fc153 in _0x4eb557[_0x226c('0x53')]){if(_0x4eb557[_0x226c('0x53')][_0x226c('0x47')](_0x3fc153)){var _0x1a0aca=_0x4eb557['openchannelQueues'][_0x3fc153];var _0x389cb7={'id':_0x1a0aca['id'],'available':_0x1a0aca[_0x226c('0x51')],'loggedIn':_0x1a0aca[_0x226c('0x4d')],'name':_0x1a0aca[_0x226c('0x52')],'paused':_0x1a0aca['paused'],'waiting':_0x1a0aca[_0x226c('0x4f')]};_0x19d927['push'](_0x389cb7);}}_0x33cd69({'count':_0x19d927[_0x226c('0x17')],'rows':_0x19d927});});},'SmsQueues':function(_0xb756b9){return new Promise(function(_0x59c9c3,_0x2a00f9){var _0x501597=[];for(var _0x564d3a in _0x4eb557[_0x226c('0x54')]){if(_0x4eb557[_0x226c('0x54')][_0x226c('0x47')](_0x564d3a)){var _0x41d1fd=_0x4eb557[_0x226c('0x54')][_0x564d3a];var _0x4b7770={'id':_0x41d1fd['id'],'available':_0x41d1fd[_0x226c('0x51')],'loggedIn':_0x41d1fd[_0x226c('0x4d')],'name':_0x41d1fd[_0x226c('0x52')],'paused':_0x41d1fd['paused'],'waiting':_0x41d1fd['waiting']};_0x501597[_0x226c('0x1d')](_0x4b7770);}}_0x59c9c3({'count':_0x501597['length'],'rows':_0x501597});});},'FaxQueues':function(_0x1fb15d){return new Promise(function(_0x5a9c92,_0x4a94ad){var _0x5aa1bb=[];for(var _0x2246fd in _0x4eb557[_0x226c('0x55')]){if(_0x4eb557['faxQueues']['hasOwnProperty'](_0x2246fd)){var _0x5f3051=_0x4eb557['faxQueues'][_0x2246fd];var _0x23ab51={'id':_0x5f3051['id'],'available':_0x5f3051['available'],'loggedIn':_0x5f3051[_0x226c('0x4d')],'name':_0x5f3051[_0x226c('0x52')],'paused':_0x5f3051[_0x226c('0x4e')],'waiting':_0x5f3051[_0x226c('0x4f')]};_0x5aa1bb[_0x226c('0x1d')](_0x23ab51);}}_0x5a9c92({'count':_0x5aa1bb[_0x226c('0x17')],'rows':_0x5aa1bb});});},'WhatsappQueues':function(_0x3517fa){return new Promise(function(_0x882ec8,_0x58c2e1){var _0x3746c1=[];for(var _0x345ad9 in _0x4eb557[_0x226c('0x56')]){if(_0x4eb557[_0x226c('0x56')][_0x226c('0x47')](_0x345ad9)){var _0x3b9403=_0x4eb557[_0x226c('0x56')][_0x345ad9];var _0x3659d8={'id':_0x3b9403['id'],'available':_0x3b9403['available'],'loggedIn':_0x3b9403[_0x226c('0x4d')],'name':_0x3b9403[_0x226c('0x52')],'paused':_0x3b9403[_0x226c('0x4e')],'waiting':_0x3b9403[_0x226c('0x4f')]};_0x3746c1[_0x226c('0x1d')](_0x3659d8);}}_0x882ec8({'count':_0x3746c1[_0x226c('0x17')],'rows':_0x3746c1});});},'ChatQueuesWaitingInteractions':function(_0x2585cf){return new Promise(function(_0x5ef2a2,_0x19a525){var _0x357e86=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x57')]);_0x5ef2a2({'count':_0x357e86[_0x226c('0x17')],'rows':_0x357e86});});},'MailQueuesWaitingInteractions':function(_0x2ac44b){return new Promise(function(_0x5292cb,_0x2e1c6c){var _0xbf68ea=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x58')]);_0x5292cb({'count':_0xbf68ea[_0x226c('0x17')],'rows':_0xbf68ea});});},'OpenchannelQueuesWaitingInteractions':function(_0x868257){return new Promise(function(_0x20a47c,_0x5af32e){var _0x52b1c5=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x59')]);_0x20a47c({'count':_0x52b1c5['length'],'rows':_0x52b1c5});});},'SmsQueuesWaitingInteractions':function(_0xbd31d7){return new Promise(function(_0x5524c5,_0x48e0a6){var _0x2ad739=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x5a')]);_0x5524c5({'count':_0x2ad739[_0x226c('0x17')],'rows':_0x2ad739});});},'FaxQueuesWaitingInteractions':function(_0x6ef63d){return new Promise(function(_0x2d0155,_0x5aa822){var _0x15f1de=_[_0x226c('0x4b')](_0x4eb557['faxQueuesWaitingInteractions']);_0x2d0155({'count':_0x15f1de[_0x226c('0x17')],'rows':_0x15f1de});});},'WhatsappQueuesWaitingInteractions':function(_0x43088a){return new Promise(function(_0x13f463,_0x1558cc){var _0x454ee0=_[_0x226c('0x4b')](_0x4eb557[_0x226c('0x5b')]);_0x13f463({'count':_0x454ee0[_0x226c('0x17')],'rows':_0x454ee0});});}};var _0x28ede7=jayson[_0x226c('0x5c')](_0x15e13b)[_0x226c('0x5d')]();_0x28ede7['on'](_0x226c('0x3a'),function(_0x27fdbd){logger[_0x226c('0x3a')](JSON[_0x226c('0x5e')](_0x27fdbd));return _0x3cff57(_0x27fdbd);});_0x28ede7['listen'](0x232c,'127.0.0.1',function(){console[_0x226c('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x21d61b(_0x226c('0x60')+0x232c);});});}; \ No newline at end of file +var _0xf403=['format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','intervals','info','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','capacity','hasOwnProperty','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport'];(function(_0x1e19eb,_0x2a04b6){var _0x46ead4=function(_0x148b33){while(--_0x148b33){_0x1e19eb['push'](_0x1e19eb['shift']());}};_0x46ead4(++_0x2a04b6);}(_0xf403,0x1d3));var _0x3f40=function(_0x1f60f7,_0x7932e7){_0x1f60f7=_0x1f60f7-0x0;var _0x48e8fa=_0xf403[_0x1f60f7];return _0x48e8fa;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var path=require(_0x3f40('0x1'));var fs=require('fs');var jayson=require(_0x3f40('0x2'));var BPromise=require(_0x3f40('0x3'));var uuid=require(_0x3f40('0x4'));var utils=require(_0x3f40('0x5'));var config=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3f40('0x9')),'smsQueueReport':require(_0x3f40('0xa')),'faxQueueReport':require(_0x3f40('0xb')),'whatsappQueueReport':require(_0x3f40('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1dffe8,_0x4c1694,_0x59d3f2){return util[_0x3f40('0xd')](_0x3f40('0xe'),_0x1dffe8,_0x4c1694||0x0,_0x59d3f2||0x0);}function getIntervals(_0x40d198,_0x5bf41d){var _0x48c244=[];if(!_[_0x3f40('0xf')](_0x5bf41d[_0x3f40('0x10')])&&!_[_0x3f40('0xf')](_0x40d198[_0x5bf41d['IntervalId']])&&!_[_0x3f40('0xf')](_0x40d198[_0x5bf41d[_0x3f40('0x10')]][_0x3f40('0x11')])){_0x48c244=_['map'](_0x40d198[_0x5bf41d[_0x3f40('0x10')]]['Intervals'],_0x3f40('0x12'));}else if(!_[_0x3f40('0xf')](_0x5bf41d[_0x3f40('0x12')])){_0x48c244=[_0x5bf41d[_0x3f40('0x12')]];}return _0x48c244;}exports['listen']=function(_0x2b2bfe){_0x2b2bfe[_0x3f40('0x13')]={};return new BPromise(function(_0xa25e56,_0x1c9144){var _0x232241={'Start':function(_0x4e28b9){var _0x2e51ed=this;return new Promise(function(_0x3d11c9,_0x535f85){if(_0x4e28b9){try{var _0x4ef80e=[];var _0x54f596=getId(_0x4e28b9[_0x3f40('0x14')],_0x4e28b9[_0x3f40('0x15')]?_0x4e28b9[_0x3f40('0x15')]['id']:0x0,_0x4e28b9[_0x3f40('0x16')]?_0x4e28b9[_0x3f40('0x16')]['id']:0x0);if(_0x4e28b9['applications']&&_[_0x3f40('0x17')](_0x4e28b9[_0x3f40('0x18')])&&_0x4e28b9[_0x3f40('0x18')][_0x3f40('0x19')]){for(var _0x3129e2=0x0;_0x3129e2<_0x4e28b9['applications'][_0x3f40('0x19')];_0x3129e2+=0x1){var _0x5ae5d7=_0x4e28b9[_0x3f40('0x18')][_0x3129e2];if(fs[_0x3f40('0x1a')](path[_0x3f40('0x1b')](__dirname,_0x3f40('0x18'),_0x5ae5d7[_0x3f40('0x1c')]+'.js'))){var _0x27f5a5=[];switch(_0x5ae5d7[_0x3f40('0x1c')][_0x3f40('0x1d')]()){case _0x3f40('0x1e'):var _0x258de9=_0x5ae5d7[_0x3f40('0x1f')]['split'](',');if(_0x4e28b9[_0x3f40('0x14')]===_0x3f40('0x20')){_0x27f5a5[_0x3f40('0x21')](_0x258de9[0x0]);_0x27f5a5['push'](_0x258de9[0x1]);_0x27f5a5[_0x3f40('0x21')](_0x258de9['slice'](0x2,_0x258de9[_0x3f40('0x19')])['join'](','));}else{_0x27f5a5['push'](_0x258de9[0x0]);_0x27f5a5['push'](_0x258de9[_0x3f40('0x22')](0x1,_0x258de9[_0x3f40('0x19')])[_0x3f40('0x1b')](','));}break;case _0x3f40('0x23'):var _0x5b1079=_0x5ae5d7[_0x3f40('0x1f')]['split'](',');_0x27f5a5[_0x3f40('0x21')](_0x5b1079[0x0]);_0x27f5a5[_0x3f40('0x21')](_0x5b1079[0x1]);_0x27f5a5[_0x3f40('0x21')](_0x5b1079['slice'](0x2,_0x5b1079[_0x3f40('0x19')])['join'](','));break;case _0x3f40('0x24'):var _0x5b9079=_0x5ae5d7['appdata'][_0x3f40('0x25')](',');_0x27f5a5[_0x3f40('0x21')](_0x5b9079[0x0]);_0x27f5a5[_0x3f40('0x21')](_0x5b9079[0x1]);_0x27f5a5[_0x3f40('0x21')](_0x5b9079[0x2]);_0x27f5a5[_0x3f40('0x21')](_0x5b9079[0x3]);_0x27f5a5[_0x3f40('0x21')](_0x5b9079[_0x3f40('0x22')](0x4,_0x5b9079[_0x3f40('0x19')])['join'](','));break;case _0x3f40('0x26'):var _0x2d2624=_0x5ae5d7[_0x3f40('0x1f')][_0x3f40('0x25')](',');_0x27f5a5[_0x3f40('0x21')](_0x2d2624[0x0]);_0x27f5a5['push'](_0x2d2624[0x1]);_0x27f5a5[_0x3f40('0x21')](_0x2d2624[0x2]);_0x27f5a5[_0x3f40('0x21')](_0x2d2624[0x3]);_0x27f5a5[_0x3f40('0x21')](_0x2d2624['slice'](0x4,_0x2d2624[_0x3f40('0x19')])[_0x3f40('0x1b')](','));break;case _0x3f40('0x15'):_0x27f5a5[_0x3f40('0x21')](_0x5ae5d7[_0x3f40('0x1f')]);break;case _0x3f40('0x27'):_0x27f5a5[_0x3f40('0x21')](_0x5ae5d7[_0x3f40('0x28')]);_0x27f5a5[_0x3f40('0x21')](_0x5ae5d7[_0x3f40('0x1f')]);break;case _0x3f40('0x29'):var _0x25399a=utils[_0x3f40('0x2a')](_0x4e28b9[_0x3f40('0x2b')][_0x3f40('0x2c')],_0x4e28b9);var _0xf26a2f=_0x5ae5d7[_0x3f40('0x1f')][_0x3f40('0x25')](',');_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x0]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x1]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x2]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x3]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x4]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x5]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x6]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x7]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x8]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0x9]);_0x27f5a5[_0x3f40('0x21')](_0xf26a2f[0xa]);_0x27f5a5[_0x3f40('0x21')](_0x4e28b9['interaction']['id']);_0x27f5a5['push'](_0x4e28b9[_0x3f40('0x15')]['id']);_0x27f5a5[_0x3f40('0x21')](_0x5ae5d7[_0x3f40('0x2d')]);_0x27f5a5[_0x3f40('0x21')](_0x4e28b9[_0x3f40('0x16')][_0x3f40('0x2e')]);_0x27f5a5[_0x3f40('0x21')](_0x4e28b9['body'][_0x3f40('0x2f')]);_0x27f5a5['push'](_0x25399a);break;default:_0x27f5a5=_[_0x3f40('0xf')](_0x5ae5d7[_0x3f40('0x1f')])?[]:_0x5ae5d7[_0x3f40('0x1f')]['split'](',');}var _0x37a83d={'id':util[_0x3f40('0xd')]('%s:%s:%s',_0x54f596,_0x5ae5d7['id'],_0x5ae5d7[_0x3f40('0x1c')]),'condition':require(_0x3f40('0x30'))['condition'](_0x54f596,getIntervals(_0x2b2bfe[_0x3f40('0x31')],_0x5ae5d7),_0x2b2bfe),'consequence':require('./applications/'+_0x5ae5d7[_0x3f40('0x1c')])['consequence'](_0x54f596,_0x27f5a5,_0x2b2bfe,_0x4e28b9),'p':_0x5ae5d7['priority']||0x0};logger[_0x3f40('0x32')]('Push\x20new\x20rule',_0x37a83d['id'],_0x3f40('0x33'),getIntervals(_0x2b2bfe[_0x3f40('0x31')],_0x5ae5d7)[_0x3f40('0x1b')](_0x3f40('0x34')));_0x4ef80e['push'](_0x37a83d);}else{logger[_0x3f40('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3f40('0x1b')](__dirname,_0x3f40('0x18'),_0x5ae5d7[_0x3f40('0x1c')]+'.js'));}}_0x2b2bfe['rules'][_0x54f596]=new RuleEngine(_0x4ef80e);_0x2b2bfe[_0x3f40('0x13')][_0x54f596][_0x3f40('0x36')](_0x4e28b9,function(_0x41bd93){logger[_0x3f40('0x32')](_0x3f40('0x37'),JSON[_0x3f40('0x38')](_0x41bd93[_0x3f40('0x39')]));if(_0x2b2bfe[_0x3f40('0x13')][_0x54f596]){_0x2b2bfe['rules'][_0x54f596][_0x3f40('0x3a')]('complete');}});return _0x3d11c9({'code':0xc8,'message':_0x4e28b9});}else{logger['info'](_0x3f40('0x3b'));return _0x3d11c9({'code':0xc8,'message':_0x4e28b9});}}catch(_0x45eeac){logger[_0x3f40('0x35')](_0x45eeac[_0x3f40('0x3c')]);return _0x535f85(_0x2e51ed[_0x3f40('0x35')](0x1f4,_0x45eeac));}}return _0x535f85(_0x3f40('0x3d'));});},'AcceptMessage':function(_0x468b38){var _0x3d6cf8=this;return new Promise(function(_0x1cc958,_0x2d4997){if(_0x468b38[_0x3f40('0x3e')]&&_0x468b38[_0x3f40('0x3e')]['id']){if(_0x2b2bfe[_0x3f40('0x3f')][_0x468b38[_0x3f40('0x3e')]['id']]){_0x2b2bfe['agents'][_0x468b38[_0x3f40('0x3e')]['id']]['busy']=![];_0x2b2bfe[_0x3f40('0x3f')][_0x468b38[_0x3f40('0x3e')]['id']]['busyQueue']=undefined;}}if(_0x468b38[_0x3f40('0x15')]&&_0x468b38[_0x3f40('0x15')]['id']){try{var _0xc58511=getId(_0x468b38[_0x3f40('0x14')],_0x468b38[_0x3f40('0x15')]?_0x468b38[_0x3f40('0x15')]['id']:0x0,_0x468b38[_0x3f40('0x16')]?_0x468b38[_0x3f40('0x16')]['id']:0x0);if(_0x2b2bfe[_0x3f40('0x13')][_0xc58511]){_0x2b2bfe[_0x3f40('0x13')][_0xc58511][_0x3f40('0x3a')](_0x3f40('0x40'));if(rpc[_0x468b38[_0x3f40('0x14')]+_0x3f40('0x41')]){rpc[_0x468b38[_0x3f40('0x14')]+_0x3f40('0x41')][_0x3f40('0x42')](_0xc58511,{'UserId':_0x468b38[_0x3f40('0x15')][_0x3f40('0x43')]})[_0x3f40('0x44')](function(_0xca7210){logger['error'](_0x3f40('0x45'));});}}return _0x1cc958({'code':0xc8,'message':_0x468b38});}catch(_0x50db96){logger[_0x3f40('0x35')](_0x50db96[_0x3f40('0x3c')]);return _0x2d4997(_0x3d6cf8[_0x3f40('0x35')](0x1f4,_0x50db96));}}logger['error']('message\x20is\x20empty');return _0x2d4997(_0x3d6cf8['error'](0x1f4,_0x3f40('0x46')));});},'RejectMessage':function(_0x426d5b){var _0x5f4f1a=this;return new Promise(function(_0x27301f,_0x1e0af6){if(_0x426d5b['agent']&&_0x426d5b[_0x3f40('0x3e')]['id']){try{if(_0x2b2bfe['agents'][_0x426d5b[_0x3f40('0x3e')]['id']]){_0x2b2bfe[_0x3f40('0x3f')][_0x426d5b[_0x3f40('0x3e')]['id']][_0x3f40('0x47')]=![];_0x2b2bfe[_0x3f40('0x3f')][_0x426d5b[_0x3f40('0x3e')]['id']][_0x3f40('0x48')]=undefined;}return _0x27301f({'code':0xc8,'message':_0x426d5b});}catch(_0x36f481){logger[_0x3f40('0x35')](_0x36f481[_0x3f40('0x3c')]);return _0x1e0af6(_0x5f4f1a[_0x3f40('0x35')](0x1f4,_0x36f481));}}logger[_0x3f40('0x35')](_0x3f40('0x46'));return _0x1e0af6(_0x5f4f1a['error'](0x1f4,_0x3f40('0x46')));});},'AbandonInteraction':function(_0x22beb7){var _0x1c94a1=this;return new Promise(function(_0x3ee1d6,_0x38b026){if(_0x22beb7['channel']&&_0x22beb7[_0x3f40('0x16')]&&_0x22beb7[_0x3f40('0x16')]['id']){try{var _0x1c4b44=getId(_0x22beb7[_0x3f40('0x14')],_0x22beb7[_0x3f40('0x15')]?_0x22beb7['message']['id']:0x0,_0x22beb7['interaction']?_0x22beb7[_0x3f40('0x16')]['id']:0x0);if(_0x2b2bfe[_0x3f40('0x13')][_0x1c4b44]){_0x2b2bfe['rules'][_0x1c4b44][_0x3f40('0x3a')]('end');}return _0x3ee1d6({'code':0xc8,'message':_0x22beb7});}catch(_0x204cff){logger['error'](_0x204cff[_0x3f40('0x3c')]);return _0x38b026(_0x1c94a1['error'](0x1f4,_0x204cff));}}logger[_0x3f40('0x35')](_0x3f40('0x46'));return _0x38b026(_0x1c94a1[_0x3f40('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4d1231){var _0x4b4d14=this;return new Promise(function(_0x56e654,_0x273739){if(_0x2b2bfe['agents']['hasOwnProperty'](_0x4d1231['id'])){for(var _0x1a03b3 in _0x4d1231[_0x3f40('0x49')]){if(_0x4d1231[_0x3f40('0x49')][_0x3f40('0x4a')](_0x1a03b3)){if(_0x2b2bfe['agents'][_0x4d1231['id']][_0x3f40('0x4a')](_0x1a03b3+'CurrentCapacity')){_0x2b2bfe['agents'][_0x4d1231['id']][_0x1a03b3+'CurrentCapacity']=parseInt(_0x4d1231[_0x3f40('0x49')][_0x1a03b3],0xa);}}}_0x2b2bfe['agents'][_0x4d1231['id']]['updateRealtime']();return _0x56e654({'code':0xc8,'message':_0x2b2bfe[_0x3f40('0x3f')][_0x4d1231['id']]});}else{return _0x273739(_0x4b4d14[_0x3f40('0x35')](0x1f4,_0x3f40('0x4b')));}});},'Agents':function(_0x3df44b){return new Promise(function(_0x346ae4,_0x49c7a5){var _0x8e4dea=_['values'](_0x2b2bfe[_0x3f40('0x3f')]);_0x346ae4({'count':_0x8e4dea[_0x3f40('0x19')],'rows':_0x8e4dea});});},'ChatQueues':function(_0x341705){return new Promise(function(_0x52a7e9,_0x356e28){var _0x2408f4=[];for(var _0x46821c in _0x2b2bfe[_0x3f40('0x4c')]){if(_0x2b2bfe[_0x3f40('0x4c')]['hasOwnProperty'](_0x46821c)){var _0x2f76a1=_0x2b2bfe[_0x3f40('0x4c')][_0x46821c];var _0xf6b569={'id':_0x2f76a1['id'],'available':_0x2f76a1[_0x3f40('0x4d')],'loggedIn':_0x2f76a1[_0x3f40('0x4e')],'name':_0x2f76a1[_0x3f40('0x4f')],'paused':_0x2f76a1[_0x3f40('0x50')],'waiting':_0x2f76a1[_0x3f40('0x51')]};_0x2408f4[_0x3f40('0x21')](_0xf6b569);}}_0x52a7e9({'count':_0x2408f4[_0x3f40('0x19')],'rows':_0x2408f4});});},'MailQueues':function(_0x163dce){return new Promise(function(_0x2fc05f,_0x52c075){var _0x5de7af=[];for(var _0x5c0273 in _0x2b2bfe[_0x3f40('0x52')]){if(_0x2b2bfe[_0x3f40('0x52')][_0x3f40('0x4a')](_0x5c0273)){var _0x27fc56=_0x2b2bfe[_0x3f40('0x52')][_0x5c0273];var _0x32aa47={'id':_0x27fc56['id'],'available':_0x27fc56['available'],'loggedIn':_0x27fc56[_0x3f40('0x4e')],'name':_0x27fc56['name'],'paused':_0x27fc56[_0x3f40('0x50')],'waiting':_0x27fc56[_0x3f40('0x51')]};_0x5de7af[_0x3f40('0x21')](_0x32aa47);}}_0x2fc05f({'count':_0x5de7af[_0x3f40('0x19')],'rows':_0x5de7af});});},'OpenchannelQueues':function(_0xe72141){return new Promise(function(_0x5154f7,_0x3a5118){var _0x54667a=[];for(var _0x4a333a in _0x2b2bfe[_0x3f40('0x53')]){if(_0x2b2bfe['openchannelQueues'][_0x3f40('0x4a')](_0x4a333a)){var _0x1ae5f9=_0x2b2bfe[_0x3f40('0x53')][_0x4a333a];var _0x3231a5={'id':_0x1ae5f9['id'],'available':_0x1ae5f9[_0x3f40('0x4d')],'loggedIn':_0x1ae5f9[_0x3f40('0x4e')],'name':_0x1ae5f9[_0x3f40('0x4f')],'paused':_0x1ae5f9['paused'],'waiting':_0x1ae5f9[_0x3f40('0x51')]};_0x54667a[_0x3f40('0x21')](_0x3231a5);}}_0x5154f7({'count':_0x54667a[_0x3f40('0x19')],'rows':_0x54667a});});},'SmsQueues':function(_0x36194a){return new Promise(function(_0x4285ad,_0x53fbcf){var _0xda2429=[];for(var _0xf82b65 in _0x2b2bfe[_0x3f40('0x54')]){if(_0x2b2bfe[_0x3f40('0x54')][_0x3f40('0x4a')](_0xf82b65)){var _0x2e1297=_0x2b2bfe['smsQueues'][_0xf82b65];var _0x46cfbb={'id':_0x2e1297['id'],'available':_0x2e1297[_0x3f40('0x4d')],'loggedIn':_0x2e1297[_0x3f40('0x4e')],'name':_0x2e1297[_0x3f40('0x4f')],'paused':_0x2e1297[_0x3f40('0x50')],'waiting':_0x2e1297['waiting']};_0xda2429['push'](_0x46cfbb);}}_0x4285ad({'count':_0xda2429['length'],'rows':_0xda2429});});},'FaxQueues':function(_0x25d8fb){return new Promise(function(_0x40ee4a,_0x212ca4){var _0xb52921=[];for(var _0x6ac505 in _0x2b2bfe[_0x3f40('0x55')]){if(_0x2b2bfe[_0x3f40('0x55')][_0x3f40('0x4a')](_0x6ac505)){var _0x3fc422=_0x2b2bfe[_0x3f40('0x55')][_0x6ac505];var _0x37ba89={'id':_0x3fc422['id'],'available':_0x3fc422[_0x3f40('0x4d')],'loggedIn':_0x3fc422[_0x3f40('0x4e')],'name':_0x3fc422['name'],'paused':_0x3fc422[_0x3f40('0x50')],'waiting':_0x3fc422[_0x3f40('0x51')]};_0xb52921[_0x3f40('0x21')](_0x37ba89);}}_0x40ee4a({'count':_0xb52921['length'],'rows':_0xb52921});});},'WhatsappQueues':function(_0x4d6e57){return new Promise(function(_0x4595cd,_0xfc6dd){var _0xcddecb=[];for(var _0x1f297a in _0x2b2bfe['whatsappQueues']){if(_0x2b2bfe[_0x3f40('0x56')][_0x3f40('0x4a')](_0x1f297a)){var _0x2dd0ed=_0x2b2bfe[_0x3f40('0x56')][_0x1f297a];var _0x2989c6={'id':_0x2dd0ed['id'],'available':_0x2dd0ed[_0x3f40('0x4d')],'loggedIn':_0x2dd0ed[_0x3f40('0x4e')],'name':_0x2dd0ed[_0x3f40('0x4f')],'paused':_0x2dd0ed[_0x3f40('0x50')],'waiting':_0x2dd0ed[_0x3f40('0x51')]};_0xcddecb['push'](_0x2989c6);}}_0x4595cd({'count':_0xcddecb['length'],'rows':_0xcddecb});});},'ChatQueuesWaitingInteractions':function(_0x274ea8){return new Promise(function(_0x32580f,_0x168382){var _0x3e24ed=_['values'](_0x2b2bfe[_0x3f40('0x57')]);_0x32580f({'count':_0x3e24ed[_0x3f40('0x19')],'rows':_0x3e24ed});});},'MailQueuesWaitingInteractions':function(_0x1be18a){return new Promise(function(_0x2fae6e,_0xca2941){var _0x54efab=_['values'](_0x2b2bfe[_0x3f40('0x58')]);_0x2fae6e({'count':_0x54efab[_0x3f40('0x19')],'rows':_0x54efab});});},'OpenchannelQueuesWaitingInteractions':function(_0x2d0d69){return new Promise(function(_0x5eddc3,_0x849ce9){var _0x4892a9=_[_0x3f40('0x59')](_0x2b2bfe['openchannelQueuesWaitingInteractions']);_0x5eddc3({'count':_0x4892a9['length'],'rows':_0x4892a9});});},'SmsQueuesWaitingInteractions':function(_0xd842ca){return new Promise(function(_0x412afa,_0x3d7454){var _0x324565=_[_0x3f40('0x59')](_0x2b2bfe[_0x3f40('0x5a')]);_0x412afa({'count':_0x324565[_0x3f40('0x19')],'rows':_0x324565});});},'FaxQueuesWaitingInteractions':function(_0x59c918){return new Promise(function(_0xb4e27e,_0x5c42a7){var _0x32b72d=_['values'](_0x2b2bfe['faxQueuesWaitingInteractions']);_0xb4e27e({'count':_0x32b72d[_0x3f40('0x19')],'rows':_0x32b72d});});},'WhatsappQueuesWaitingInteractions':function(_0x5c2314){return new Promise(function(_0x53cffd,_0x271f7f){var _0x1cd45f=_[_0x3f40('0x59')](_0x2b2bfe[_0x3f40('0x5b')]);_0x53cffd({'count':_0x1cd45f[_0x3f40('0x19')],'rows':_0x1cd45f});});}};var _0x11ef8f=jayson[_0x3f40('0x5c')](_0x232241)['http']();_0x11ef8f['on'](_0x3f40('0x35'),function(_0x5f22a4){logger['error'](JSON[_0x3f40('0x38')](_0x5f22a4));return _0x1c9144(_0x5f22a4);});_0x11ef8f[_0x3f40('0x5d')](0x232c,_0x3f40('0x5e'),function(){console['log'](_0x3f40('0x5f'),0x232c);return _0xa25e56('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a322948..e0e5f07 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 _0x0260=['then','message','indexOf','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','lodash','routing','request','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s'];(function(_0x16e33e,_0x4d6a4a){var _0xce79fe=function(_0x2cc6c6){while(--_0x2cc6c6){_0x16e33e['push'](_0x16e33e['shift']());}};_0xce79fe(++_0x4d6a4a);}(_0x0260,0x1d1));var _0x0026=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x0260[_0x4b2436];return _0x4f5ab2;};'use strict';var util=require(_0x0026('0x0'));var BPromise=require(_0x0026('0x1'));var jayson=require('jayson/promise');var _=require(_0x0026('0x2'));var logger=require('../../../config/logger')(_0x0026('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x2dcd99,_0x211587){return new BPromise(function(_0x4dc265,_0x33e3ee){return client[_0x0026('0x4')](_0x2dcd99,_0x211587)['then'](function(_0x517410){if(_0x517410['error']){return _0x33e3ee(_0x517410[_0x0026('0x5')]['message']);}else{return _0x4dc265(_0x517410['result']);}})[_0x0026('0x6')](function(_0x413bcd){return _0x33e3ee(_0x413bcd);});});}exports[_0x0026('0x7')]=function(_0x167908,_0xf8b2bb,_0x10d3d5){return function(_0x4d2f22){if(_0x10d3d5[_0x0026('0x8')]&&!_0x10d3d5[_0x0026('0x8')][_0x167908]){logger[_0x0026('0x9')](_0x0026('0xa'),_0x167908);return _0x4d2f22[_0x0026('0xb')]();}var _0x37c107=[];for(var _0xb5dd24=0x0;_0xb5dd24<_0xf8b2bb[_0x0026('0xc')];_0xb5dd24+=0x1){_0x37c107[_0x0026('0xd')](request('Command',{'command':util['format'](_0x0026('0xe'),_0xf8b2bb[_0xb5dd24])})[_0x0026('0xf')](function(_0x4a15d3){return _0x4a15d3&&_0x4a15d3['message']&&_0x4a15d3[_0x0026('0x10')][_0x0026('0x11')]('true')>=0x0?!![]:![];})[_0x0026('0x6')](function(_0xdb9abe){logger['error'](_0x0026('0x12'),_0x167908,_0xf8b2bb[_0xb5dd24]);}));}BPromise[_0x0026('0x13')](_0x37c107)[_0x0026('0xf')](function(_0x59f817){var _0x29e113=_['some'](_0x59f817);logger[_0x0026('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x167908,_0xf8b2bb[_0x0026('0x14')](_0x0026('0x15')),_0x29e113);_0x4d2f22['when'](_0x29e113);})[_0x0026('0x6')](function(_0x4a470b){console[_0x0026('0x16')](_0x4a470b);logger['error'](_0x0026('0x17'),_0x167908,_0xf8b2bb[_0x0026('0x14')]('\x20|\x20'),_0x4a470b['stack']);_0x4d2f22[_0x0026('0xb')]();});};}; \ No newline at end of file +var _0x78fd=['iftime\x20%s','indexOf','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x78fd,0x13e));var _0xd78f=function(_0x4705bc,_0x5eb5c0){_0x4705bc=_0x4705bc-0x0;var _0x5001b8=_0x78fd[_0x4705bc];return _0x5001b8;};'use strict';var util=require(_0xd78f('0x0'));var BPromise=require(_0xd78f('0x1'));var jayson=require(_0xd78f('0x2'));var _=require('lodash');var logger=require(_0xd78f('0x3'))(_0xd78f('0x4'));var client=jayson[_0xd78f('0x5')][_0xd78f('0x6')]({'port':0x232a});function request(_0x3bfa45,_0x323962){return new BPromise(function(_0x2dd33a,_0x4094d){return client[_0xd78f('0x7')](_0x3bfa45,_0x323962)[_0xd78f('0x8')](function(_0x1fda06){if(_0x1fda06['error']){return _0x4094d(_0x1fda06[_0xd78f('0x9')][_0xd78f('0xa')]);}else{return _0x2dd33a(_0x1fda06['result']);}})['catch'](function(_0x356e90){return _0x4094d(_0x356e90);});});}exports['condition']=function(_0x383d84,_0x1492c8,_0x48693b){return function(_0x206f28){if(_0x48693b['rules']&&!_0x48693b[_0xd78f('0xb')][_0x383d84]){logger[_0xd78f('0xc')](_0xd78f('0xd'),_0x383d84);return _0x206f28[_0xd78f('0xe')]();}var _0x3f2977=[];for(var _0x421a97=0x0;_0x421a97<_0x1492c8[_0xd78f('0xf')];_0x421a97+=0x1){_0x3f2977[_0xd78f('0x10')](request(_0xd78f('0x11'),{'command':util['format'](_0xd78f('0x12'),_0x1492c8[_0x421a97])})[_0xd78f('0x8')](function(_0x1c2d55){return _0x1c2d55&&_0x1c2d55[_0xd78f('0xa')]&&_0x1c2d55[_0xd78f('0xa')][_0xd78f('0x13')]('true')>=0x0?!![]:![];})[_0xd78f('0x14')](function(_0x200cef){logger[_0xd78f('0x9')](_0xd78f('0x15'),_0x383d84,_0x1492c8[_0x421a97]);}));}BPromise[_0xd78f('0x16')](_0x3f2977)[_0xd78f('0x8')](function(_0x3e1a91){var _0xdf237f=_['some'](_0x3e1a91);logger['info'](_0xd78f('0x17'),_0x383d84,_0x1492c8['join'](_0xd78f('0x18')),_0xdf237f);_0x206f28[_0xd78f('0x19')](_0xdf237f);})['catch'](function(_0x3475fd){console[_0xd78f('0x1a')](_0x3475fd);logger['error'](_0xd78f('0x17'),_0x383d84,_0x1492c8['join']('\x20|\x20'),_0x3475fd[_0xd78f('0x1b')]);_0x206f28[_0xd78f('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2515f63..a99ba40 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 _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x297acf,_0x530d6c){var _0x2dd757=function(_0x1b7aa9){while(--_0x1b7aa9){_0x297acf['push'](_0x297acf['shift']());}};_0x2dd757(++_0x530d6c);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2e1125,_0x3e0eaa){_0x2e1125=_0x2e1125-0x0;var _0x28fdb6=_0x76dc[_0x2e1125];return _0x28fdb6;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file +var _0x2bc6=['lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x34f542,_0x17797c){var _0x2cd681=function(_0x316ff3){while(--_0x316ff3){_0x34f542['push'](_0x34f542['shift']());}};_0x2cd681(++_0x17797c);}(_0x2bc6,0x163));var _0x62bc=function(_0x3bed12,_0x1810f5){_0x3bed12=_0x3bed12-0x0;var _0x193c6a=_0x2bc6[_0x3bed12];return _0x193c6a;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var utils=require(_0x62bc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56939b,_0x4b4e73){utils['info'](util['format'](_0x62bc('0x3'),_0x56939b['uniqueid'],_0x56939b[_0x62bc('0x4')],_0x56939b[_0x62bc('0x5')],_0x56939b['membername'],_0x56939b[_0x62bc('0x6')],_0x56939b[_0x62bc('0x7')],_0x56939b[_0x62bc('0x8')],_0x56939b[_0x62bc('0x9')]));if(_0x56939b[_0x62bc('0x5')]){utils[_0x62bc('0xa')](_0x56939b['queue'])[_0x62bc('0xb')](function(_0x762c71){if(_0x762c71){_0x56939b[_0x62bc('0xc')]=_0x762c71[_0x62bc('0xc')];_0x56939b['agentacw']=_0x56939b[_0x62bc('0xd')]?_0x762c71[_0x62bc('0xe')]:![];_0x56939b[_0x62bc('0xf')]=_0x56939b['agentacw']?_0x762c71[_0x62bc('0x10')]:0x0;}utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);});}else{utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);}if(_0x4b4e73){delete transfers[_0x56939b[_0x62bc('0x13')]];}else{delete agents[_0x56939b[_0x62bc('0x14')]];}}exports['agentcalled']=function(_0x2a96ae){try{utils[_0x62bc('0x15')](util['format'](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x2a96ae);agents[_0x2a96ae[_0x62bc('0x14')]]=_0x2a96ae;agents[_0x2a96ae['destuniqueid']][_0x62bc('0x17')]=utils[_0x62bc('0x18')]();agents[_0x2a96ae['destuniqueid']]['lastevent']=_0x62bc('0x19');agents[_0x2a96ae[_0x62bc('0x14')]]['connectedlinenum']=null;agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1a')]=null;utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1d'),_0x2a96ae[_0x62bc('0x13')],agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x2a96ae[_0x62bc('0x14')]));}catch(_0x5ed51c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x5ed51c);}};exports['agentringnoanswer']=function(_0x380621){try{if(!_['isNil'](agents[_0x380621[_0x62bc('0x14')]])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')]('[%s][agents][agentringnoanswer]',_0x380621[_0x62bc('0x13')]),_0x380621);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1f'),_0x380621[_0x62bc('0x13')],agents[_0x380621[_0x62bc('0x14')]]['membername'],_0x380621[_0x62bc('0x14')]));agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x20')]=!![];agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x21')]=utils['now']();agents[_0x380621['destuniqueid']][_0x62bc('0x9')]='timeout';agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x22')]=_0x62bc('0x23');agents[_0x380621['destuniqueid']][_0x62bc('0x24')]=_0x380621[_0x62bc('0x25')]?parseInt(_0x380621[_0x62bc('0x25')])/0x3e8:0x0;agents[_0x380621['destuniqueid']]['talktime']=0x0;unanswered[_0x62bc('0x26')](_0x380621[_0x62bc('0x14')]);}}catch(_0x23817c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x27'),_0x380621[_0x62bc('0x13')]),_0x23817c);}};exports[_0x62bc('0x28')]=function(_0x5a9302){try{_[_0x62bc('0x29')](agents,function(_0x5e4491,_0x26701b){if(_0x5e4491[_0x62bc('0x13')]==_0x5a9302[_0x62bc('0x13')]&&!_[_0x62bc('0x2a')](unanswered,_0x5e4491[_0x62bc('0x14')])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x2b'),_0x5a9302[_0x62bc('0x13')]),_0x5a9302);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x2c'),_0x5a9302[_0x62bc('0x13')],_0x5e4491[_0x62bc('0x1e')],_0x5e4491[_0x62bc('0x14')]));_0x5e4491[_0x62bc('0x20')]=!![];_0x5e4491[_0x62bc('0x21')]=utils['now']();_0x5e4491[_0x62bc('0x9')]='abandoned';_0x5e4491['reason']=_0x62bc('0x2d');_0x5e4491['holdtime']=_0x5a9302['holdtime'];_0x5e4491['talktime']=0x0;writeDB(_0x5e4491);}});}catch(_0x3f22c1){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][queuecallerabandon]',_0x5a9302['uniqueid']),_0x3f22c1);}};exports['agentconnect']=function(_0x3c938d){try{if(agents[_0x3c938d[_0x62bc('0x14')]]){utils['debug'](util['format'](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x13')]),_0x3c938d);utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x30'),_0x3c938d[_0x62bc('0x13')],agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x3c938d['destuniqueid']));agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x31')]=utils['now']();agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x8')]=_0x3c938d[_0x62bc('0x8')];agents[_0x3c938d[_0x62bc('0x14')]]['connectedlinename']=_0x3c938d[_0x62bc('0x1a')];agents[_0x3c938d['destuniqueid']][_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x9')]='connect';_[_0x62bc('0x29')](agents,function(_0x5c806b,_0x392550){if(_0x5c806b[_0x62bc('0x14')]!=_0x3c938d[_0x62bc('0x14')]&&_0x5c806b[_0x62bc('0x13')]==_0x3c938d[_0x62bc('0x13')]){_0x5c806b[_0x62bc('0x32')]=0x0;_0x5c806b[_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];_0x5c806b[_0x62bc('0x20')]=!![];_0x5c806b['agentringnoanswerAt']=utils['now']();_0x5c806b[_0x62bc('0x9')]=_0x62bc('0x33');_0x5c806b['reason']=_0x62bc('0x33');_0x5c806b[_0x62bc('0x34')]=_0x3c938d[_0x62bc('0x14')];_0x5c806b[_0x62bc('0x35')]=_0x3c938d[_0x62bc('0x1e')];writeDB(_0x5c806b);}});}}catch(_0x5f3752){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][agentconnect]',_0x3c938d['uniqueid']),_0x5f3752);}};exports[_0x62bc('0xd')]=function(_0xdbd9ee){try{if(!_[_0x62bc('0x36')](agents[_0xdbd9ee['destuniqueid']])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0xdbd9ee);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdbd9ee[_0x62bc('0x13')],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x1e')],_0xdbd9ee[_0x62bc('0x14')]));agents[_0xdbd9ee[_0x62bc('0x14')]]['agentcomplete']=!![];agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt']=utils[_0x62bc('0x18')]();agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt'],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x31')]);agents[_0xdbd9ee[_0x62bc('0x14')]][_0x62bc('0x22')]=_0xdbd9ee[_0x62bc('0x22')];agents[_0xdbd9ee[_0x62bc('0x14')]]['lastevent']=_0x62bc('0x39');writeDB(agents[_0xdbd9ee[_0x62bc('0x14')]]);}}catch(_0x4859fc){utils[_0x62bc('0x2e')](util['format'](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0x4859fc);}};exports[_0x62bc('0x3a')]=function(_0xca6190){try{if(!_[_0x62bc('0x36')](agents[_0xca6190[_0x62bc('0x3b')]])){utils[_0x62bc('0x15')](util['format'](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0xca6190);utils['info'](util[_0x62bc('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xca6190[_0x62bc('0x13')],agents[_0xca6190[_0x62bc('0x3b')]]['membername'],agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')]));agents[_0xca6190[_0x62bc('0x3b')]]['transfer']=!![];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3d')]=_0x62bc('0x3e');agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3f')]=_0xca6190[_0x62bc('0x40')];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x41')]=agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')];}}catch(_0x44d2a2){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0x44d2a2);}};exports[_0x62bc('0x42')]=function(_0x5b0e9b){try{utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x5b0e9b);if(_0x5b0e9b[_0x62bc('0x44')]==_0x5b0e9b[_0x62bc('0x45')]){if(!_[_0x62bc('0x36')](agents[_0x5b0e9b[_0x62bc('0x46')]])){utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x47'),_0x5b0e9b[_0x62bc('0x44')],agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x1e')]));agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3f')]=_0x5b0e9b[_0x62bc('0x4a')];agents[_0x5b0e9b[_0x62bc('0x46')]]['transferuniqueid']=_0x5b0e9b['origtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x4b')]&&agents[_0x5b0e9b[_0x62bc('0x4b')]]){agents[_0x5b0e9b[_0x62bc('0x4b')]]['agententerreason']=0x1;transfers[_0x5b0e9b[_0x62bc('0x4b')]]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x4b')]]);transfers[_0x5b0e9b[_0x62bc('0x4b')]]['calleridnum']=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x7')];transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4d')]=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x4b')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b['transfereeuniqueid']][_0x62bc('0x24')]=0x0;transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4e')]=0x2;}}else if(_0x5b0e9b['secondtransfereruniqueid']==_0x5b0e9b[_0x62bc('0x4f')]){if(!_['isNil'](agents[_0x5b0e9b[_0x62bc('0x44')]])){utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x47'),_0x5b0e9b['origtransfereruniqueid'],agents[_0x5b0e9b[_0x62bc('0x44')]]['membername']));agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x44')]]['transferexten']=_0x5b0e9b[_0x62bc('0x50')];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x41')]=_0x5b0e9b['secondtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x51')]&&agents[_0x5b0e9b[_0x62bc('0x51')]]){agents[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x1;transfers[_0x5b0e9b['transfertargetuniqueid']]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x51')]]);transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x7')]=agents[_0x5b0e9b[_0x62bc('0x44')]]['calleridnum'];transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x4d')]=agents[_0x5b0e9b['origtransfereruniqueid']][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x51')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b[_0x62bc('0x51')]]['holdtime']=0x0;transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x2;}}}catch(_0x6bb64b){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x6bb64b);}};exports[_0x62bc('0x52')]=function(_0x177fba){try{utils['debug'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba[_0x62bc('0x13')]),_0x177fba);if(agents[_0x177fba[_0x62bc('0x13')]]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]===_0x62bc('0x23')){if(_0x177fba[_0x62bc('0x54')]==='21'){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]=_0x62bc('0x55');agents[_0x177fba['uniqueid']][_0x62bc('0x9')]=_0x62bc('0x55');}utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);var _0x5698a4=unanswered[_0x62bc('0x56')](_0x177fba[_0x62bc('0x13')]);if(_0x5698a4>-0x1){unanswered[_0x62bc('0x57')](_0x5698a4,0x1);}}if(transfers[_0x177fba[_0x62bc('0x13')]]){transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](transfers[_0x177fba['uniqueid']][_0x62bc('0x58')],transfers[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);transfers[_0x177fba[_0x62bc('0x13')]]['reason']=_0x62bc('0x59');transfers[_0x177fba[_0x62bc('0x13')]]['lastevent']=_0x62bc('0x39');utils['info'](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],transfers[_0x177fba['uniqueid']][_0x62bc('0x1e')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(transfers[_0x177fba[_0x62bc('0x13')]],!![]);}if(agents[_0x177fba['uniqueid']]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x31')]){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')],agents[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);agents[_0x177fba['uniqueid']]['reason']=agents[_0x177fba[_0x62bc('0x13')]]['transfer']?_0x62bc('0x48'):_0x62bc('0x59');agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]=_0x62bc('0x39');utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x5a'),_0x177fba['uniqueid'],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]]['reason'],agents[_0x177fba[_0x62bc('0x13')]]['lastevent']));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);}}catch(_0x3aa295){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba['uniqueid']),_0x3aa295);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3733d86..e6f60c6 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 _0x639a=['noop','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','info','format','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup'];(function(_0x44c23a,_0x95aba7){var _0x1ce6f8=function(_0x3f4065){while(--_0x3f4065){_0x44c23a['push'](_0x44c23a['shift']());}};_0x1ce6f8(++_0x95aba7);}(_0x639a,0x1e8));var _0xa639=function(_0x38ba31,_0x4fe0b6){_0x38ba31=_0x38ba31-0x0;var _0x19e62e=_0x639a[_0x38ba31];return _0x19e62e;};'use strict';var _=require(_0xa639('0x0'));var util=require(_0xa639('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0xa639('0x2'),_0xa639('0x3'),'FAILED',_0xa639('0x2'),_0xa639('0x2'),_0xa639('0x2'),_0xa639('0x4'),'BUSY',_0xa639('0x3'),'FAILED',_0xa639('0x3')];var channels={};function writeDB(_0x38b779){var _0x277b76;if(transfers[_0xa639('0x5')][_0x38b779[_0xa639('0x6')]]){_0x277b76=_0x38b779['uniqueid'];_0x38b779[_0xa639('0x6')]=transfers[_0xa639('0x5')][_0x38b779[_0xa639('0x6')]]['transfereeuniqueid'];}utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x38b779[_0xa639('0x6')],_0x38b779[_0xa639('0x9')],_0x38b779['queue'],_0x38b779[_0xa639('0xa')],_0x38b779[_0xa639('0xb')],_0x38b779['calleridnum'],_0x38b779[_0xa639('0xc')],_0x38b779[_0xa639('0xd')]));if(_0x38b779[_0xa639('0xe')]){utils[_0xa639('0xf')](_0x38b779[_0xa639('0xe')])[_0xa639('0x10')](function(_0x3dc4b5){if(_0x3dc4b5){_0x38b779['UserId']=_0x3dc4b5['id'];}utils[_0xa639('0x11')](_0xa639('0x12'),_0x38b779);});}else{utils[_0xa639('0x11')](_0xa639('0x12'),_0x38b779);}if(channels[_0x38b779[_0xa639('0x6')]]){delete channels[_0x38b779[_0xa639('0x6')]];}else if(_0x277b76&&channels[_0x277b76]){if(!transfers[_0xa639('0x5')][_0x277b76][_0xa639('0x13')])delete transfers[_0xa639('0x5')][_0x277b76];delete channels[_0x277b76];}}exports['newchannel']=function(_0x3a894c){try{utils[_0xa639('0x14')](util['format'](_0xa639('0x15'),_0x3a894c[_0xa639('0x6')]),_0x3a894c);if(_0x3a894c[_0xa639('0x6')]==_0x3a894c[_0xa639('0x16')]&&_0x3a894c['channel']!=_0xa639('0x17')){utils[_0xa639('0x7')](util[_0xa639('0x8')](_0xa639('0x18'),_0x3a894c['uniqueid'],_0x3a894c[_0xa639('0x19')],_0x3a894c[_0xa639('0x1a')]));channels[_0x3a894c[_0xa639('0x6')]]={'uniqueid':_0x3a894c[_0xa639('0x6')],'accountcode':_0x3a894c[_0xa639('0xe')],'source':_0x3a894c['calleridnum'],'destination':_0x3a894c[_0xa639('0x1a')],'destinationcontext':_0x3a894c[_0xa639('0x19')],'channel':_0x3a894c[_0xa639('0x9')],'starttime':utils[_0xa639('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xa639('0x1c')};}}catch(_0x597397){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x15'),_0x3a894c['uniqueid']),_0x597397);}};exports[_0xa639('0x1e')]=function(_0x54c7cd){try{utils[_0xa639('0x14')](util[_0xa639('0x8')](_0xa639('0x1f'),_0x54c7cd[_0xa639('0x6')]),_0x54c7cd);if(!_['isNil'](channels[_0x54c7cd[_0xa639('0x6')]])&&_0x54c7cd[_0xa639('0x20')]==0x6){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x54c7cd[_0xa639('0x6')],_0x54c7cd[_0xa639('0x19')],_0x54c7cd[_0xa639('0x9')]));if(_[_0xa639('0x21')](channels[_0x54c7cd[_0xa639('0x6')]][_0xa639('0x22')])){channels[_0x54c7cd['uniqueid']]['systemanswertime']=utils[_0xa639('0x1b')]();}}else if(!_[_0xa639('0x21')](channels[_0x54c7cd[_0xa639('0x16')]])&&_0x54c7cd[_0xa639('0x20')]==0x6&&_0x54c7cd[_0xa639('0x19')]!='transfer'){utils['info'](util[_0xa639('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x54c7cd[_0xa639('0x6')],_0x54c7cd['linkedid'],_0x54c7cd[_0xa639('0x19')],_0x54c7cd[_0xa639('0x9')]));channels[_0x54c7cd[_0xa639('0x16')]][_0xa639('0xe')]=_0x54c7cd[_0xa639('0xe')];channels[_0x54c7cd[_0xa639('0x16')]][_0xa639('0x23')]=_0x54c7cd[_0xa639('0x9')];if(_['isNil'](channels[_0x54c7cd[_0xa639('0x16')]]['answertime'])){channels[_0x54c7cd[_0xa639('0x16')]][_0xa639('0x24')]=utils['now']();}channels[_0x54c7cd[_0xa639('0x16')]][_0xa639('0x25')]=dispositions[_['toNumber'](_0x54c7cd['channelstate'])]||_0xa639('0x4');}}catch(_0xca6d1a){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x1f'),_0x54c7cd[_0xa639('0x6')]),_0xca6d1a);}};exports['hangup']=function(_0x47905c){try{if(!_[_0xa639('0x21')](channels[_0x47905c[_0xa639('0x6')]])){utils['debug'](util[_0xa639('0x8')](_0xa639('0x26'),_0x47905c[_0xa639('0x6')]),_0x47905c);if(_[_0xa639('0x21')](channels[_0x47905c['uniqueid']][_0xa639('0x27')])){channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x27')]=_0x47905c[_0xa639('0x28')]+'\x20<'+_0x47905c['calleridnum']+'>';}utils[_0xa639('0x7')](util[_0xa639('0x8')](_0xa639('0x29'),_0x47905c[_0xa639('0x6')],channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x27')],_0x47905c[_0xa639('0x2a')]));channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x2b')]=utils[_0xa639('0x1b')]();channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x2c')]=utils[_0xa639('0x2d')](channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x2b')],channels[_0x47905c[_0xa639('0x6')]]['starttime']);channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x2e')]=channels[_0x47905c[_0xa639('0x6')]]['answertime']?utils[_0xa639('0x2d')](channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x2b')],channels[_0x47905c[_0xa639('0x6')]][_0xa639('0x24')]):0x0;writeDB(channels[_0x47905c[_0xa639('0x6')]]);}}catch(_0x404939){utils['error'](util[_0xa639('0x8')](_0xa639('0x26'),_0x47905c[_0xa639('0x6')]),_0x404939);}};exports['attendedtransfer']=function(_0x4db3a1){try{if(!_['isNil'](channels[_0x4db3a1[_0xa639('0x2f')]])){utils[_0xa639('0x14')](util[_0xa639('0x8')]('[%s][calls][attendedtransfer]',_0x4db3a1['origtransfereruniqueid']),_0x4db3a1);if(channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x9')]==_0x4db3a1['transfereechannel']){utils[_0xa639('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4db3a1[_0xa639('0x30')],_0x4db3a1[_0xa639('0x2f')],_0x4db3a1['secondtransfererchannel']));channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x23')]=_0x4db3a1[_0xa639('0x31')];channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x32')]=_0xa639('0x33');}else if(channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x9')]=_0x4db3a1[_0xa639('0x34')]){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4db3a1[_0xa639('0x30')],_0x4db3a1['localtwolinkedid'],_0x4db3a1[_0xa639('0x35')]));channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x23')]=_0x4db3a1[_0xa639('0x35')];channels[_0x4db3a1[_0xa639('0x2f')]][_0xa639('0x32')]=_0xa639('0x33');}}}catch(_0x48cc80){utils['error'](util['format'](_0xa639('0x36'),_0x4db3a1[_0xa639('0x30')]),_0x48cc80);}};exports[_0xa639('0x37')]=function(_0x4eb95e){try{if(!_[_0xa639('0x21')](channels[_0x4eb95e['uniqueid']])){utils['debug'](util[_0xa639('0x8')](_0xa639('0x38'),_0x4eb95e[_0xa639('0x6')]),_0x4eb95e);channels[_0x4eb95e[_0xa639('0x6')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0xa639('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4eb95e[_0xa639('0x6')],channels[_0x4eb95e[_0xa639('0x6')]][_0xa639('0x39')]));}}catch(_0xd92674){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x38'),_0x4eb95e[_0xa639('0x6')]),_0xd92674);}};exports['musiconholdstop']=function(_0x11f7c7){try{if(!_[_0xa639('0x21')](channels[_0x11f7c7[_0xa639('0x6')]])){utils[_0xa639('0x14')](util[_0xa639('0x8')]('[%s][calls][musiconholdstop]',_0x11f7c7[_0xa639('0x6')]),_0x11f7c7);if(!_[_0xa639('0x21')](channels[_0x11f7c7['uniqueid']][_0xa639('0x39')])){channels[_0x11f7c7[_0xa639('0x6')]][_0xa639('0x3a')]+=utils['diffTime'](utils[_0xa639('0x1b')](),channels[_0x11f7c7[_0xa639('0x6')]][_0xa639('0x39')]);utils[_0xa639('0x7')](util[_0xa639('0x8')](_0xa639('0x3b'),_0x11f7c7[_0xa639('0x6')],channels[_0x11f7c7[_0xa639('0x6')]][_0xa639('0x3a')]));delete channels[_0x11f7c7[_0xa639('0x6')]][_0xa639('0x39')];}}}catch(_0x44aaae){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x3c'),_0x11f7c7['uniqueid']),_0x44aaae);}};exports[_0xa639('0x3d')]=function(_0x524114){try{if(!_[_0xa639('0x21')](channels[_0x524114['uniqueid']])){utils['debug'](util[_0xa639('0x8')](_0xa639('0x3e'),_0x524114['uniqueid']),_0x524114);if(!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')][_0xa639('0x40')])){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x524114[_0xa639('0x6')],_0x524114[_0xa639('0x41')]));channels[_0x524114[_0xa639('0x6')]][_0xa639('0x42')]=_0x524114[_0xa639('0x41')];}if(!_['isNil'](_0x524114[_0xa639('0x3f')][_0xa639('0x43')])){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x524114[_0xa639('0x6')],_0x524114[_0xa639('0x41')]));channels[_0x524114['uniqueid']][_0xa639('0x44')]=_0x524114[_0xa639('0x41')];channels[_0x524114[_0xa639('0x6')]][_0xa639('0x27')]='\x22'+_0x524114['value']+_0xa639('0x45')+_0x524114[_0xa639('0x41')]+'>';}if(!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')]['xmd-callerid-preview'])||!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')]['xmd-callerid'])){utils[_0xa639('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x524114[_0xa639('0x6')],!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')][_0xa639('0x46')])?_0xa639('0x46'):_0xa639('0x47'),_0x524114[_0xa639('0x41')]));channels[_0x524114[_0xa639('0x6')]][_0xa639('0x27')]=_0x524114[_0xa639('0x41')];}if(!_['isNil'](_0x524114[_0xa639('0x3f')][_0xa639('0x48')])||!_[_0xa639('0x21')](_0x524114['variable']['xmcs-queue'])){utils[_0xa639('0x7')](util[_0xa639('0x8')](_0xa639('0x49'),_0x524114['uniqueid'],!_['isNil'](_0x524114['variable']['xmd-queue'])?'xmd-queue':'xmcs-queue',_0x524114['value']));channels[_0x524114[_0xa639('0x6')]][_0xa639('0x4a')]='Queue';channels[_0x524114[_0xa639('0x6')]][_0xa639('0x4b')]=_0x524114[_0xa639('0x41')];channels[_0x524114[_0xa639('0x6')]]['queue']=!![];}if(!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')][_0xa639('0x4c')])){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x524114['uniqueid'],_0x524114[_0xa639('0x41')]));channels[_0x524114['uniqueid']]['ContactId']=_0x524114['value'];}if(!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')]['xmd-cdrtype'])){utils[_0xa639('0x7')](util['format'](_0xa639('0x4d'),_0x524114[_0xa639('0x6')],_0x524114['value']));channels[_0x524114[_0xa639('0x6')]][_0xa639('0x4e')]=_0x524114[_0xa639('0x41')];}if(!_['isNil'](_0x524114[_0xa639('0x3f')]['outboundrouteid'])){utils['info'](util[_0xa639('0x8')](_0xa639('0x4f'),_0x524114[_0xa639('0x6')],_0x524114[_0xa639('0x41')]));channels[_0x524114['uniqueid']][_0xa639('0x50')]=_0x524114[_0xa639('0x41')];}if(!_[_0xa639('0x21')](_0x524114[_0xa639('0x3f')][_0xa639('0x51')])){utils[_0xa639('0x7')](util[_0xa639('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x524114['uniqueid'],_0x524114[_0xa639('0x41')]));channels[_0x524114['uniqueid']][_0xa639('0x51')]=_0x524114[_0xa639('0x41')];}}}catch(_0xd31491){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x3e'),_0x524114[_0xa639('0x6')]),_0xd31491);}};exports[_0xa639('0x52')]=function(_0x51055c){try{if(!_[_0xa639('0x21')](channels[_0x51055c[_0xa639('0x6')]])){utils[_0xa639('0x14')](util[_0xa639('0x8')]('[%s][calls][newexten]',_0x51055c['uniqueid']),_0x51055c);utils['info'](util[_0xa639('0x8')](_0xa639('0x53'),_0x51055c[_0xa639('0x6')],_0x51055c['application'],_0x51055c[_0xa639('0x54')]));if(_0x51055c[_0xa639('0x55')][_0xa639('0x56')]()==_0xa639('0x57')&&_[_0xa639('0x58')](_0x51055c[_0xa639('0x54')][_0xa639('0x56')](),_0xa639('0x59'))){var _0x1f6fa9=_0x51055c['appdata'][_0xa639('0x5a')]('=');var _0x10c6fa=_0x1f6fa9[0x0][_0xa639('0x5b')](_0x1f6fa9[0x0]['lastIndexOf']('(')+0x1,_0x1f6fa9[0x0][_0xa639('0x5c')](')'));var _0x1ed3d7=_0x1f6fa9[0x1];channels[_0x51055c[_0xa639('0x6')]][_0x10c6fa]=_0x1ed3d7;}if(!_['includes']([_0xa639('0x5d'),_0xa639('0x5e'),'execif','set',_0xa639('0x5f')],_0x51055c[_0xa639('0x55')][_0xa639('0x56')]())){channels[_0x51055c[_0xa639('0x6')]]['lastapplication']=_0x51055c[_0xa639('0x55')];channels[_0x51055c[_0xa639('0x6')]][_0xa639('0x4b')]=_0x51055c[_0xa639('0x54')];}}}catch(_0x283637){utils[_0xa639('0x1d')](util[_0xa639('0x8')](_0xa639('0x60'),_0x51055c['uniqueid']),_0x283637);}}; \ No newline at end of file +var _0x4e99=['channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','noop','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','uniqueid','blinds','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','format','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil'];(function(_0x225ff2,_0x385660){var _0x351894=function(_0x3c9df6){while(--_0x3c9df6){_0x225ff2['push'](_0x225ff2['shift']());}};_0x351894(++_0x385660);}(_0x4e99,0x122));var _0x94e9=function(_0x5e9920,_0x5f6551){_0x5e9920=_0x5e9920-0x0;var _0x22cd4e=_0x4e99[_0x5e9920];return _0x22cd4e;};'use strict';var _=require('lodash');var util=require(_0x94e9('0x0'));var utils=require(_0x94e9('0x1'));var transfers=require(_0x94e9('0x2'));var dispositions=[_0x94e9('0x3'),'FAILED',_0x94e9('0x4'),'NO\x20ANSWER',_0x94e9('0x3'),_0x94e9('0x3'),_0x94e9('0x5'),'BUSY',_0x94e9('0x4'),'FAILED',_0x94e9('0x4')];var channels={};function writeDB(_0x368e50){var _0x3986a4;if(transfers['blinds'][_0x368e50[_0x94e9('0x6')]]){_0x3986a4=_0x368e50[_0x94e9('0x6')];_0x368e50['uniqueid']=transfers[_0x94e9('0x7')][_0x368e50['uniqueid']][_0x94e9('0x8')];}utils[_0x94e9('0x9')](util['format'](_0x94e9('0xa'),_0x368e50[_0x94e9('0x6')],_0x368e50[_0x94e9('0xb')],_0x368e50[_0x94e9('0xc')],_0x368e50[_0x94e9('0xd')],_0x368e50[_0x94e9('0xe')],_0x368e50[_0x94e9('0xf')],_0x368e50[_0x94e9('0x10')],_0x368e50[_0x94e9('0x11')]));if(_0x368e50[_0x94e9('0x12')]){utils[_0x94e9('0x13')](_0x368e50[_0x94e9('0x12')])[_0x94e9('0x14')](function(_0x4550a7){if(_0x4550a7){_0x368e50[_0x94e9('0x15')]=_0x4550a7['id'];}utils[_0x94e9('0x16')](_0x94e9('0x17'),_0x368e50);});}else{utils[_0x94e9('0x16')]('CreateVoiceCallReport',_0x368e50);}if(channels[_0x368e50[_0x94e9('0x6')]]){delete channels[_0x368e50[_0x94e9('0x6')]];}else if(_0x3986a4&&channels[_0x3986a4]){if(!transfers[_0x94e9('0x7')][_0x3986a4]['recording'])delete transfers['blinds'][_0x3986a4];delete channels[_0x3986a4];}}exports['newchannel']=function(_0x4e8d64){try{utils[_0x94e9('0x18')](util[_0x94e9('0x19')]('[%s][calls][newchannel]',_0x4e8d64[_0x94e9('0x6')]),_0x4e8d64);if(_0x4e8d64['uniqueid']==_0x4e8d64[_0x94e9('0x1a')]&&_0x4e8d64['channel']!=_0x94e9('0x1b')){utils[_0x94e9('0x9')](util['format'](_0x94e9('0x1c'),_0x4e8d64['uniqueid'],_0x4e8d64[_0x94e9('0x1d')],_0x4e8d64['exten']));channels[_0x4e8d64[_0x94e9('0x6')]]={'uniqueid':_0x4e8d64['uniqueid'],'accountcode':_0x4e8d64[_0x94e9('0x12')],'source':_0x4e8d64[_0x94e9('0xf')],'destination':_0x4e8d64[_0x94e9('0x1e')],'destinationcontext':_0x4e8d64[_0x94e9('0x1d')],'channel':_0x4e8d64[_0x94e9('0xb')],'starttime':utils[_0x94e9('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x94e9('0x3'),'amaflags':_0x94e9('0x20')};}}catch(_0x4f7088){utils[_0x94e9('0x21')](util[_0x94e9('0x19')]('[%s][calls][newchannel]',_0x4e8d64['uniqueid']),_0x4f7088);}};exports[_0x94e9('0x22')]=function(_0x38f889){try{utils['debug'](util['format'](_0x94e9('0x23'),_0x38f889[_0x94e9('0x6')]),_0x38f889);if(!_[_0x94e9('0x24')](channels[_0x38f889[_0x94e9('0x6')]])&&_0x38f889[_0x94e9('0x25')]==0x6){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x26'),_0x38f889[_0x94e9('0x6')],_0x38f889['context'],_0x38f889[_0x94e9('0xb')]));if(_[_0x94e9('0x24')](channels[_0x38f889[_0x94e9('0x6')]][_0x94e9('0x27')])){channels[_0x38f889[_0x94e9('0x6')]][_0x94e9('0x27')]=utils[_0x94e9('0x1f')]();}}else if(!_['isNil'](channels[_0x38f889['linkedid']])&&_0x38f889[_0x94e9('0x25')]==0x6&&_0x38f889[_0x94e9('0x1d')]!=_0x94e9('0x28')){utils[_0x94e9('0x9')](util[_0x94e9('0x19')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x38f889[_0x94e9('0x6')],_0x38f889[_0x94e9('0x1a')],_0x38f889['context'],_0x38f889['channel']));channels[_0x38f889[_0x94e9('0x1a')]][_0x94e9('0x12')]=_0x38f889[_0x94e9('0x12')];channels[_0x38f889['linkedid']][_0x94e9('0x29')]=_0x38f889['channel'];if(_[_0x94e9('0x24')](channels[_0x38f889['linkedid']][_0x94e9('0x2a')])){channels[_0x38f889[_0x94e9('0x1a')]][_0x94e9('0x2a')]=utils['now']();}channels[_0x38f889[_0x94e9('0x1a')]][_0x94e9('0x2b')]=dispositions[_[_0x94e9('0x2c')](_0x38f889[_0x94e9('0x25')])]||_0x94e9('0x5');}}catch(_0xd5971f){utils[_0x94e9('0x21')](util[_0x94e9('0x19')]('[%s][calls][newstate]',_0x38f889[_0x94e9('0x6')]),_0xd5971f);}};exports[_0x94e9('0x2d')]=function(_0x44b014){try{if(!_[_0x94e9('0x24')](channels[_0x44b014[_0x94e9('0x6')]])){utils[_0x94e9('0x18')](util[_0x94e9('0x19')]('[%s][calls][hangup]',_0x44b014['uniqueid']),_0x44b014);if(_[_0x94e9('0x24')](channels[_0x44b014['uniqueid']][_0x94e9('0x2e')])){channels[_0x44b014['uniqueid']]['callerid']=_0x44b014[_0x94e9('0x2f')]+'\x20<'+_0x44b014[_0x94e9('0xf')]+'>';}utils[_0x94e9('0x9')](util[_0x94e9('0x19')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x44b014['uniqueid'],channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x2e')],_0x44b014['cause-txt']));channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x30')]=utils['now']();channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x31')]=utils[_0x94e9('0x32')](channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x30')],channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x33')]);channels[_0x44b014[_0x94e9('0x6')]]['billableseconds']=channels[_0x44b014[_0x94e9('0x6')]][_0x94e9('0x2a')]?utils[_0x94e9('0x32')](channels[_0x44b014['uniqueid']]['endtime'],channels[_0x44b014['uniqueid']][_0x94e9('0x2a')]):0x0;writeDB(channels[_0x44b014[_0x94e9('0x6')]]);}}catch(_0x4edf27){utils[_0x94e9('0x21')](util[_0x94e9('0x19')](_0x94e9('0x34'),_0x44b014['uniqueid']),_0x4edf27);}};exports[_0x94e9('0x35')]=function(_0x569973){try{if(!_[_0x94e9('0x24')](channels[_0x569973[_0x94e9('0x36')]])){utils[_0x94e9('0x18')](util[_0x94e9('0x19')]('[%s][calls][attendedtransfer]',_0x569973[_0x94e9('0x37')]),_0x569973);if(channels[_0x569973[_0x94e9('0x36')]][_0x94e9('0xb')]==_0x569973[_0x94e9('0x38')]){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x39'),_0x569973[_0x94e9('0x37')],_0x569973[_0x94e9('0x36')],_0x569973[_0x94e9('0x3a')]));channels[_0x569973[_0x94e9('0x36')]][_0x94e9('0x29')]=_0x569973[_0x94e9('0x3a')];channels[_0x569973[_0x94e9('0x36')]][_0x94e9('0x3b')]=_0x94e9('0x3c');}else if(channels[_0x569973['localtwolinkedid']][_0x94e9('0xb')]=_0x569973[_0x94e9('0x3d')]){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x39'),_0x569973[_0x94e9('0x37')],_0x569973[_0x94e9('0x36')],_0x569973[_0x94e9('0x3e')]));channels[_0x569973[_0x94e9('0x36')]]['destinationchannel']=_0x569973[_0x94e9('0x3e')];channels[_0x569973[_0x94e9('0x36')]]['userfield']='_attended';}}}catch(_0x254f82){utils['error'](util[_0x94e9('0x19')]('[%s][calls][attendedtransfer]',_0x569973[_0x94e9('0x37')]),_0x254f82);}};exports[_0x94e9('0x3f')]=function(_0x5c9565){try{if(!_[_0x94e9('0x24')](channels[_0x5c9565[_0x94e9('0x6')]])){utils['debug'](util[_0x94e9('0x19')]('[%s][calls][musiconholdstart]',_0x5c9565[_0x94e9('0x6')]),_0x5c9565);channels[_0x5c9565[_0x94e9('0x6')]][_0x94e9('0x40')]=utils[_0x94e9('0x1f')]();utils['info'](util[_0x94e9('0x19')](_0x94e9('0x41'),_0x5c9565['uniqueid'],channels[_0x5c9565[_0x94e9('0x6')]][_0x94e9('0x40')]));}}catch(_0x28c469){utils[_0x94e9('0x21')](util[_0x94e9('0x19')](_0x94e9('0x42'),_0x5c9565['uniqueid']),_0x28c469);}};exports[_0x94e9('0x43')]=function(_0x349582){try{if(!_[_0x94e9('0x24')](channels[_0x349582[_0x94e9('0x6')]])){utils[_0x94e9('0x18')](util[_0x94e9('0x19')](_0x94e9('0x44'),_0x349582['uniqueid']),_0x349582);if(!_[_0x94e9('0x24')](channels[_0x349582[_0x94e9('0x6')]][_0x94e9('0x40')])){channels[_0x349582[_0x94e9('0x6')]][_0x94e9('0x45')]+=utils[_0x94e9('0x32')](utils['now'](),channels[_0x349582[_0x94e9('0x6')]]['musiconholdstartAt']);utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x46'),_0x349582['uniqueid'],channels[_0x349582[_0x94e9('0x6')]][_0x94e9('0x45')]));delete channels[_0x349582['uniqueid']]['musiconholdstartAt'];}}}catch(_0x459ac9){utils[_0x94e9('0x21')](util['format'](_0x94e9('0x44'),_0x349582[_0x94e9('0x6')]),_0x459ac9);}};exports[_0x94e9('0x47')]=function(_0x51adf2){try{if(!_['isNil'](channels[_0x51adf2[_0x94e9('0x6')]])){utils[_0x94e9('0x18')](util[_0x94e9('0x19')](_0x94e9('0x48'),_0x51adf2['uniqueid']),_0x51adf2);if(!_[_0x94e9('0x24')](_0x51adf2['variable'][_0x94e9('0x49')])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x4b')]=_0x51adf2[_0x94e9('0x4a')];}if(!_[_0x94e9('0x24')](_0x51adf2[_0x94e9('0x4c')][_0x94e9('0x4d')])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x4e'),_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x4f')]=_0x51adf2[_0x94e9('0x4a')];channels[_0x51adf2['uniqueid']][_0x94e9('0x2e')]='\x22'+_0x51adf2[_0x94e9('0x4a')]+_0x94e9('0x50')+_0x51adf2[_0x94e9('0x4a')]+'>';}if(!_['isNil'](_0x51adf2[_0x94e9('0x4c')][_0x94e9('0x51')])||!_[_0x94e9('0x24')](_0x51adf2['variable'][_0x94e9('0x52')])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x53'),_0x51adf2['uniqueid'],!_[_0x94e9('0x24')](_0x51adf2[_0x94e9('0x4c')][_0x94e9('0x51')])?_0x94e9('0x51'):_0x94e9('0x52'),_0x51adf2['value']));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x2e')]=_0x51adf2['value'];}if(!_[_0x94e9('0x24')](_0x51adf2['variable'][_0x94e9('0x54')])||!_['isNil'](_0x51adf2[_0x94e9('0x4c')][_0x94e9('0x55')])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x53'),_0x51adf2['uniqueid'],!_['isNil'](_0x51adf2['variable']['xmd-queue'])?_0x94e9('0x54'):'xmcs-queue',_0x51adf2['value']));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x56')]=_0x94e9('0x57');channels[_0x51adf2['uniqueid']][_0x94e9('0x58')]=_0x51adf2['value'];channels[_0x51adf2['uniqueid']][_0x94e9('0xc')]=!![];}if(!_[_0x94e9('0x24')](_0x51adf2['variable']['xmd-contactid'])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x59'),_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2[_0x94e9('0x6')]]['ContactId']=_0x51adf2[_0x94e9('0x4a')];}if(!_[_0x94e9('0x24')](_0x51adf2[_0x94e9('0x4c')]['xmd-cdrtype'])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x5a')]=_0x51adf2['value'];}if(!_['isNil'](_0x51adf2['variable'][_0x94e9('0x5b')])){utils[_0x94e9('0x9')](util[_0x94e9('0x19')](_0x94e9('0x5c'),_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2[_0x94e9('0x6')]][_0x94e9('0x5d')]=_0x51adf2[_0x94e9('0x4a')];}if(!_[_0x94e9('0x24')](_0x51adf2[_0x94e9('0x4c')][_0x94e9('0x5e')])){utils['info'](util[_0x94e9('0x19')](_0x94e9('0x5f'),_0x51adf2[_0x94e9('0x6')],_0x51adf2[_0x94e9('0x4a')]));channels[_0x51adf2['uniqueid']][_0x94e9('0x5e')]=_0x51adf2[_0x94e9('0x4a')];}}}catch(_0x3ad04a){utils[_0x94e9('0x21')](util[_0x94e9('0x19')]('[%s][calls][varset]',_0x51adf2[_0x94e9('0x6')]),_0x3ad04a);}};exports[_0x94e9('0x60')]=function(_0x4b0898){try{if(!_[_0x94e9('0x24')](channels[_0x4b0898['uniqueid']])){utils['debug'](util[_0x94e9('0x19')](_0x94e9('0x61'),_0x4b0898[_0x94e9('0x6')]),_0x4b0898);utils['info'](util[_0x94e9('0x19')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4b0898['uniqueid'],_0x4b0898[_0x94e9('0x62')],_0x4b0898['appdata']));if(_0x4b0898[_0x94e9('0x62')][_0x94e9('0x63')]()==_0x94e9('0x64')&&_[_0x94e9('0x65')](_0x4b0898[_0x94e9('0x66')][_0x94e9('0x63')](),_0x94e9('0x67'))){var _0x344614=_0x4b0898['appdata'][_0x94e9('0x68')]('=');var _0x49309b=_0x344614[0x0][_0x94e9('0x69')](_0x344614[0x0][_0x94e9('0x6a')]('(')+0x1,_0x344614[0x0][_0x94e9('0x6a')](')'));var _0x27e7cc=_0x344614[0x1];channels[_0x4b0898[_0x94e9('0x6')]][_0x49309b]=_0x27e7cc;}if(!_['includes']([_0x94e9('0x2d'),_0x94e9('0x6b'),'execif','set',_0x94e9('0x6c')],_0x4b0898['application'][_0x94e9('0x63')]())){channels[_0x4b0898[_0x94e9('0x6')]][_0x94e9('0x56')]=_0x4b0898[_0x94e9('0x62')];channels[_0x4b0898[_0x94e9('0x6')]][_0x94e9('0x58')]=_0x4b0898['appdata'];}}}catch(_0x393405){utils[_0x94e9('0x21')](util[_0x94e9('0x19')](_0x94e9('0x61'),_0x4b0898[_0x94e9('0x6')]),_0x393405);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4377d50..aab835b 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 _0xadc2=['error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','[core]\x20shutdown','fullybooted'];(function(_0xf105c1,_0x30dd5e){var _0x450364=function(_0x5af239){while(--_0x5af239){_0xf105c1['push'](_0xf105c1['shift']());}};_0x450364(++_0x30dd5e);}(_0xadc2,0x187));var _0x2adc=function(_0x20a63e,_0xcb0bea){_0x20a63e=_0x20a63e-0x0;var _0x56fe3d=_0xadc2[_0x20a63e];return _0x56fe3d;};'use strict';var utils=require(_0x2adc('0x0'));exports['connect']=function(){utils[_0x2adc('0x1')](_0x2adc('0x2'));};exports['shutdown']=function(){utils[_0x2adc('0x1')](_0x2adc('0x3'));};exports[_0x2adc('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x2adc('0x5')]=function(_0x4f5271){utils[_0x2adc('0x5')]('[core]\x20error',_0x4f5271);};exports[_0x2adc('0x6')]=function(){utils[_0x2adc('0x1')](_0x2adc('0x7'));};exports[_0x2adc('0x8')]=function(_0xdfaa02){}; \ No newline at end of file +var _0x6d10=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6d10,0x15b));var _0x06d1=function(_0x11437d,_0x7de5ae){_0x11437d=_0x11437d-0x0;var _0x3eb623=_0x6d10[_0x11437d];return _0x3eb623;};'use strict';var utils=require(_0x06d1('0x0'));exports[_0x06d1('0x1')]=function(){utils[_0x06d1('0x2')](_0x06d1('0x3'));};exports[_0x06d1('0x4')]=function(){utils['info'](_0x06d1('0x5'));};exports['fullybooted']=function(){utils['info'](_0x06d1('0x6'));};exports[_0x06d1('0x7')]=function(_0x4bd2c6){utils[_0x06d1('0x7')](_0x06d1('0x8'),_0x4bd2c6);};exports[_0x06d1('0x9')]=function(){utils[_0x06d1('0x2')](_0x06d1('0xa'));};exports[_0x06d1('0xb')]=function(_0x2657cb){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 414d751..5c00420 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 _0x5399=['isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','endtime','holdtime','diffTime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]'];(function(_0x3d729b,_0x365ea4){var _0x21f06e=function(_0x729dbf){while(--_0x729dbf){_0x3d729b['push'](_0x3d729b['shift']());}};_0x21f06e(++_0x365ea4);}(_0x5399,0x147));var _0x9539=function(_0x5db0fc,_0x1702bf){_0x5db0fc=_0x5db0fc-0x0;var _0x1cdcf1=_0x5399[_0x5db0fc];return _0x1cdcf1;};'use strict';var _=require('lodash');var util=require(_0x9539('0x0'));var utils=require(_0x9539('0x1'));var dials={};function writeDB(_0x4efec9){utils[_0x9539('0x2')](util[_0x9539('0x3')](_0x9539('0x4'),_0x4efec9[_0x9539('0x5')],_0x4efec9['channel'],_0x4efec9[_0x9539('0x6')],_0x4efec9[_0x9539('0x7')],_0x4efec9['connectedlinenum'],_0x4efec9[_0x9539('0x8')]));utils[_0x9539('0x9')]('CreateVoiceDialReport',_0x4efec9);delete dials[_0x4efec9['uniqueid']];}exports['newexten']=function(_0xc7a7fa){try{utils[_0x9539('0xa')](util[_0x9539('0x3')](_0x9539('0xb'),_0xc7a7fa[_0x9539('0x5')]),_0xc7a7fa);utils[_0x9539('0x2')](util[_0x9539('0x3')](_0x9539('0xc'),_0xc7a7fa[_0x9539('0x5')],_0xc7a7fa[_0x9539('0xd')],_0xc7a7fa[_0x9539('0xe')]));if(_0xc7a7fa[_0x9539('0xd')][_0x9539('0xf')]()==_0x9539('0x10')&&_[_0x9539('0x11')](_0xc7a7fa[_0x9539('0xe')][_0x9539('0xf')](),_0x9539('0x12'))){var _0x228120=_0xc7a7fa[_0x9539('0xe')][_0x9539('0x13')]('=');dials[_0xc7a7fa[_0x9539('0x5')]]={'routeId':_0x228120[0x1]};}}catch(_0x529cc2){utils[_0x9539('0x14')](util[_0x9539('0x3')](_0x9539('0xb'),_0xc7a7fa[_0x9539('0x5')]),_0x529cc2);}};exports[_0x9539('0x15')]=function(_0x5103b9){try{utils[_0x9539('0xa')](util[_0x9539('0x3')](_0x9539('0x16'),_0x5103b9[_0x9539('0x5')]),_0x5103b9);if(!_[_0x9539('0x17')](_0x5103b9[_0x9539('0x18')]['outboundrouteid'])){utils[_0x9539('0x2')](util[_0x9539('0x3')](_0x9539('0x19'),_0x5103b9[_0x9539('0x5')],_0x5103b9[_0x9539('0x1a')]));dials[_0x5103b9[_0x9539('0x5')]]={'routeId':_0x5103b9[_0x9539('0x1a')]};}}catch(_0x2efa10){utils[_0x9539('0x14')](util[_0x9539('0x3')](_0x9539('0x16'),_0x5103b9['uniqueid']),_0x2efa10);}};exports[_0x9539('0x1b')]=function(_0x4ae1f9){try{if(!_['isNil'](dials[_0x4ae1f9['uniqueid']])){utils[_0x9539('0xa')](util[_0x9539('0x3')](_0x9539('0x1c'),_0x4ae1f9[_0x9539('0x5')]),_0x4ae1f9);dials[_0x4ae1f9[_0x9539('0x5')]]=_[_0x9539('0x1d')](dials[_0x4ae1f9[_0x9539('0x5')]],_0x4ae1f9);dials[_0x4ae1f9['uniqueid']][_0x9539('0x1e')]=utils[_0x9539('0x1f')]();dials[_0x4ae1f9['uniqueid']][_0x9539('0x20')]=_0x9539('0x21');utils[_0x9539('0x2')](util[_0x9539('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4ae1f9[_0x9539('0x5')],dials[_0x4ae1f9['uniqueid']][_0x9539('0x1e')]));}}catch(_0x4c4227){utils[_0x9539('0x14')](util[_0x9539('0x3')]('[%s][dials][dialbegin]',_0x4ae1f9[_0x9539('0x5')]),_0x4c4227);}};exports[_0x9539('0x22')]=function(_0x535018){try{if(!_[_0x9539('0x17')](dials[_0x535018['uniqueid']])){utils[_0x9539('0xa')](util['format']('[%s][dials][dialend]',_0x535018[_0x9539('0x5')]),_0x535018);dials[_0x535018[_0x9539('0x5')]][_0x9539('0x8')]=_0x535018[_0x9539('0x8')];if(_0x535018[_0x9539('0x8')]==_0x9539('0x23')){dials[_0x535018['uniqueid']]=_['assign'](dials[_0x535018[_0x9539('0x5')]],_0x535018);dials[_0x535018[_0x9539('0x5')]]['answertime']=utils[_0x9539('0x1f')]();dials[_0x535018[_0x9539('0x5')]]['lastevent']=_0x9539('0x24');utils[_0x9539('0x2')](util[_0x9539('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x535018[_0x9539('0x5')],_0x535018[_0x9539('0x8')],dials[_0x535018['uniqueid']][_0x9539('0x25')]));}else{utils['info'](util[_0x9539('0x3')](_0x9539('0x26'),_0x535018['uniqueid'],_0x535018['dialstatus']));}}}catch(_0xe52533){utils[_0x9539('0x14')](util[_0x9539('0x3')](_0x9539('0x27'),_0x535018[_0x9539('0x5')]),_0xe52533);}};exports[_0x9539('0x28')]=function(_0x4838ee){try{if(!_[_0x9539('0x17')](dials[_0x4838ee[_0x9539('0x5')]])){utils[_0x9539('0xa')](util[_0x9539('0x3')](_0x9539('0x29'),_0x4838ee[_0x9539('0x5')]),_0x4838ee);utils['info'](util[_0x9539('0x3')](_0x9539('0x2a'),_0x4838ee['uniqueid'],_0x4838ee[_0x9539('0x7')],_0x4838ee[_0x9539('0x2b')],_0x4838ee['cause-txt']));dials[_0x4838ee[_0x9539('0x5')]]=_[_0x9539('0x1d')](dials[_0x4838ee['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x9539('0x2c')});dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x2d')]=utils['diffTime'](dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x2e')],dials[_0x4838ee['uniqueid']][_0x9539('0x1e')]);dials[_0x4838ee['uniqueid']][_0x9539('0x2f')]=utils[_0x9539('0x30')](dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x25')]||dials[_0x4838ee['uniqueid']][_0x9539('0x2e')],dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x1e')]);dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x31')]=dials[_0x4838ee[_0x9539('0x5')]][_0x9539('0x25')]?utils[_0x9539('0x30')](dials[_0x4838ee[_0x9539('0x5')]]['endtime'],dials[_0x4838ee['uniqueid']][_0x9539('0x25')]):0x0;writeDB(dials[_0x4838ee[_0x9539('0x5')]]);}}catch(_0x12e92c){utils['error'](util[_0x9539('0x3')](_0x9539('0x29'),_0x4838ee[_0x9539('0x5')]),_0x12e92c);}}; \ No newline at end of file +var _0xd16f=['info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','now','diffTime','endtime','holdtime','answertime','util'];(function(_0x158ab3,_0x4b5908){var _0x302830=function(_0x19fa14){while(--_0x19fa14){_0x158ab3['push'](_0x158ab3['shift']());}};_0x302830(++_0x4b5908);}(_0xd16f,0x98));var _0xfd16=function(_0x1f2923,_0x45160a){_0x1f2923=_0x1f2923-0x0;var _0x37fc95=_0xd16f[_0x1f2923];return _0x37fc95;};'use strict';var _=require('lodash');var util=require(_0xfd16('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x27dc60){utils[_0xfd16('0x1')](util[_0xfd16('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x27dc60[_0xfd16('0x3')],_0x27dc60[_0xfd16('0x4')],_0x27dc60[_0xfd16('0x5')],_0x27dc60[_0xfd16('0x6')],_0x27dc60[_0xfd16('0x7')],_0x27dc60[_0xfd16('0x8')]));utils[_0xfd16('0x9')](_0xfd16('0xa'),_0x27dc60);delete dials[_0x27dc60['uniqueid']];}exports[_0xfd16('0xb')]=function(_0x5b3fcb){try{utils[_0xfd16('0xc')](util[_0xfd16('0x2')](_0xfd16('0xd'),_0x5b3fcb[_0xfd16('0x3')]),_0x5b3fcb);utils[_0xfd16('0x1')](util[_0xfd16('0x2')](_0xfd16('0xe'),_0x5b3fcb[_0xfd16('0x3')],_0x5b3fcb['application'],_0x5b3fcb['appdata']));if(_0x5b3fcb[_0xfd16('0xf')][_0xfd16('0x10')]()==_0xfd16('0x11')&&_['startsWith'](_0x5b3fcb[_0xfd16('0x12')][_0xfd16('0x10')](),_0xfd16('0x13'))){var _0x1d0e45=_0x5b3fcb['appdata'][_0xfd16('0x14')]('=');dials[_0x5b3fcb['uniqueid']]={'routeId':_0x1d0e45[0x1]};}}catch(_0x506f3d){utils[_0xfd16('0x15')](util[_0xfd16('0x2')](_0xfd16('0xd'),_0x5b3fcb[_0xfd16('0x3')]),_0x506f3d);}};exports[_0xfd16('0x16')]=function(_0x42b80){try{utils['debug'](util['format'](_0xfd16('0x17'),_0x42b80[_0xfd16('0x3')]),_0x42b80);if(!_[_0xfd16('0x18')](_0x42b80[_0xfd16('0x19')][_0xfd16('0x1a')])){utils[_0xfd16('0x1')](util[_0xfd16('0x2')](_0xfd16('0x1b'),_0x42b80[_0xfd16('0x3')],_0x42b80[_0xfd16('0x1c')]));dials[_0x42b80[_0xfd16('0x3')]]={'routeId':_0x42b80[_0xfd16('0x1c')]};}}catch(_0x205f23){utils[_0xfd16('0x15')](util[_0xfd16('0x2')](_0xfd16('0x17'),_0x42b80['uniqueid']),_0x205f23);}};exports[_0xfd16('0x1d')]=function(_0xebc4a5){try{if(!_[_0xfd16('0x18')](dials[_0xebc4a5[_0xfd16('0x3')]])){utils['debug'](util['format'](_0xfd16('0x1e'),_0xebc4a5['uniqueid']),_0xebc4a5);dials[_0xebc4a5['uniqueid']]=_[_0xfd16('0x1f')](dials[_0xebc4a5[_0xfd16('0x3')]],_0xebc4a5);dials[_0xebc4a5[_0xfd16('0x3')]][_0xfd16('0x20')]=utils['now']();dials[_0xebc4a5[_0xfd16('0x3')]][_0xfd16('0x21')]=_0xfd16('0x22');utils[_0xfd16('0x1')](util[_0xfd16('0x2')](_0xfd16('0x23'),_0xebc4a5[_0xfd16('0x3')],dials[_0xebc4a5[_0xfd16('0x3')]][_0xfd16('0x20')]));}}catch(_0x3d07c9){utils[_0xfd16('0x15')](util[_0xfd16('0x2')](_0xfd16('0x1e'),_0xebc4a5[_0xfd16('0x3')]),_0x3d07c9);}};exports[_0xfd16('0x24')]=function(_0x55db52){try{if(!_[_0xfd16('0x18')](dials[_0x55db52[_0xfd16('0x3')]])){utils[_0xfd16('0xc')](util[_0xfd16('0x2')](_0xfd16('0x25'),_0x55db52[_0xfd16('0x3')]),_0x55db52);dials[_0x55db52[_0xfd16('0x3')]][_0xfd16('0x8')]=_0x55db52['dialstatus'];if(_0x55db52[_0xfd16('0x8')]==_0xfd16('0x26')){dials[_0x55db52['uniqueid']]=_[_0xfd16('0x1f')](dials[_0x55db52[_0xfd16('0x3')]],_0x55db52);dials[_0x55db52[_0xfd16('0x3')]]['answertime']=utils['now']();dials[_0x55db52[_0xfd16('0x3')]][_0xfd16('0x21')]=_0xfd16('0x27');utils[_0xfd16('0x1')](util[_0xfd16('0x2')](_0xfd16('0x28'),_0x55db52[_0xfd16('0x3')],_0x55db52[_0xfd16('0x8')],dials[_0x55db52[_0xfd16('0x3')]]['answertime']));}else{utils[_0xfd16('0x1')](util[_0xfd16('0x2')](_0xfd16('0x29'),_0x55db52[_0xfd16('0x3')],_0x55db52['dialstatus']));}}}catch(_0x22544a){utils[_0xfd16('0x15')](util[_0xfd16('0x2')](_0xfd16('0x25'),_0x55db52[_0xfd16('0x3')]),_0x22544a);}};exports[_0xfd16('0x2a')]=function(_0x408e16){try{if(!_[_0xfd16('0x18')](dials[_0x408e16['uniqueid']])){utils['debug'](util[_0xfd16('0x2')](_0xfd16('0x2b'),_0x408e16[_0xfd16('0x3')]),_0x408e16);utils[_0xfd16('0x1')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x408e16[_0xfd16('0x3')],_0x408e16[_0xfd16('0x6')],_0x408e16[_0xfd16('0x2c')],_0x408e16[_0xfd16('0x2d')]));dials[_0x408e16[_0xfd16('0x3')]]=_[_0xfd16('0x1f')](dials[_0x408e16['uniqueid']],{'endtime':utils[_0xfd16('0x2e')](),'lastevent':'complete'});dials[_0x408e16[_0xfd16('0x3')]]['duration']=utils[_0xfd16('0x2f')](dials[_0x408e16[_0xfd16('0x3')]][_0xfd16('0x30')],dials[_0x408e16['uniqueid']][_0xfd16('0x20')]);dials[_0x408e16['uniqueid']][_0xfd16('0x31')]=utils['diffTime'](dials[_0x408e16[_0xfd16('0x3')]][_0xfd16('0x32')]||dials[_0x408e16['uniqueid']][_0xfd16('0x30')],dials[_0x408e16[_0xfd16('0x3')]]['starttime']);dials[_0x408e16['uniqueid']]['billableseconds']=dials[_0x408e16[_0xfd16('0x3')]][_0xfd16('0x32')]?utils[_0xfd16('0x2f')](dials[_0x408e16[_0xfd16('0x3')]][_0xfd16('0x30')],dials[_0x408e16[_0xfd16('0x3')]][_0xfd16('0x32')]):0x0;writeDB(dials[_0x408e16['uniqueid']]);}}catch(_0x3e8153){utils[_0xfd16('0x15')](util[_0xfd16('0x2')](_0xfd16('0x2b'),_0x408e16[_0xfd16('0x3')]),_0x3e8153);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 181905d..7ca9398 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 _0xe36e=['port','username','keepConnected','XDR\x20DISABLED','info','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','format','device','devicestatechange','[%s][index][devicestatechange]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe36e,0xbb));var _0xee36=function(_0x5419f1,_0x33dbe7){_0x5419f1=_0x5419f1-0x0;var _0x2946a8=_0xe36e[_0x5419f1];return _0x2946a8;};var AsteriskManager=require(_0xee36('0x0'));var config=require('../../config/environment');var utils=require(_0xee36('0x1'));var util=require(_0xee36('0x2'));var isXDREnabled=config[_0xee36('0x3')]&&!config[_0xee36('0x3')][_0xee36('0x4')];var isProduction=config[_0xee36('0x5')]===_0xee36('0x6')||![];var isLocalAsterisk=config[_0xee36('0x3')]&&config[_0xee36('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xee36('0x7')][_0xee36('0x8')],config[_0xee36('0x7')]['ip'],config[_0xee36('0x7')][_0xee36('0x9')],config[_0xee36('0x7')]['password'],!![]);ami[_0xee36('0xa')]();if(!isXDREnabled){utils['info'](_0xee36('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xee36('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xee36('0xd'));var calls=require('./calls.controller');var queues=require(_0xee36('0xe'));var recordings=require(_0xee36('0xf'));var members=require(_0xee36('0x10'));var dials=require(_0xee36('0x11'));var transfers=require('./transfers.controller');var core=require(_0xee36('0x12'));ami['on'](_0xee36('0x13'),core['connect']);ami['on']('shutdown',core[_0xee36('0x14')]);ami['on'](_0xee36('0x15'),core[_0xee36('0x15')]);ami['on'](_0xee36('0x16'),core['error']);ami['on']('close',core['close']);ami['on'](_0xee36('0x17'),core[_0xee36('0x17')]);ami['on']('devicestatechange',function(_0x3231a4){try{utils['debug'](util[_0xee36('0x18')]('[%s][index][devicestatechange]',_0x3231a4[_0xee36('0x19')]),_0x3231a4);members[_0xee36('0x1a')](_0x3231a4);}catch(_0x4a5449){utils['error'](util[_0xee36('0x18')](_0xee36('0x1b'),_0x3231a4[_0xee36('0x19')]),_0x4a5449);}});ami['on']('agentcalled',function(_0x43c208){try{utils['debug'](util[_0xee36('0x18')]('[%s][index][agentcalled]',_0x43c208[_0xee36('0x1c')]),_0x43c208);agents['agentcalled'](_0x43c208);}catch(_0x132cac){utils[_0xee36('0x16')](util['format']('[%s][index][agentcalled]',_0x43c208[_0xee36('0x1c')]),_0x132cac);}});ami['on'](_0xee36('0x1d'),function(_0xceaf42){try{utils['debug'](util[_0xee36('0x18')](_0xee36('0x1e'),_0xceaf42['uniqueid']),_0xceaf42);agents[_0xee36('0x1d')](_0xceaf42);}catch(_0x590f39){utils[_0xee36('0x16')](util[_0xee36('0x18')](_0xee36('0x1e'),_0xceaf42[_0xee36('0x1c')]),_0x590f39);}});ami['on'](_0xee36('0x1f'),function(_0x2332c3){try{utils[_0xee36('0x20')](util[_0xee36('0x18')]('[%s][index][agentconnect]',_0x2332c3[_0xee36('0x1c')]),_0x2332c3);agents[_0xee36('0x1f')](_0x2332c3);queues['agentconnect'](_0x2332c3);}catch(_0x17b54e){utils['error'](util[_0xee36('0x18')](_0xee36('0x21'),_0x2332c3[_0xee36('0x1c')]),_0x17b54e);}});ami['on'](_0xee36('0x22'),function(_0x4bcb33){try{utils['debug'](util['format'](_0xee36('0x23'),_0x4bcb33[_0xee36('0x1c')]),_0x4bcb33);agents['agentcomplete'](_0x4bcb33);queues[_0xee36('0x22')](_0x4bcb33);members['agentcomplete'](_0x4bcb33);}catch(_0x2d9617){utils['error'](util[_0xee36('0x18')]('[%s][index][agentcomplete]',_0x4bcb33['uniqueid']),_0x2d9617);}});ami['on']('queuecallerabandon',function(_0x52b500){try{utils['debug'](util['format'](_0xee36('0x24'),_0x52b500[_0xee36('0x1c')]),_0x52b500);agents[_0xee36('0x25')](_0x52b500);queues[_0xee36('0x25')](_0x52b500);}catch(_0x3d3c86){utils[_0xee36('0x16')](util[_0xee36('0x18')]('[%s][index][queuecallerabandon]',_0x52b500['uniqueid']),_0x3d3c86);}});ami['on']('queuecallerjoin',function(_0x45045f){try{utils['debug'](util[_0xee36('0x18')](_0xee36('0x26'),_0x45045f[_0xee36('0x1c')]),_0x45045f);queues[_0xee36('0x27')](_0x45045f);recordings[_0xee36('0x27')](_0x45045f);}catch(_0x34cb8c){utils[_0xee36('0x16')](util[_0xee36('0x18')](_0xee36('0x26'),_0x45045f[_0xee36('0x1c')]),_0x34cb8c);}});ami['on']('queuecallerleave',function(_0xfb3c34){try{utils[_0xee36('0x20')](util[_0xee36('0x18')]('[%s][index][queuecallerleave]',_0xfb3c34[_0xee36('0x1c')]),_0xfb3c34);queues[_0xee36('0x28')](_0xfb3c34);}catch(_0x50f441){utils['error'](util['format']('[%s][index][queuecallerleave]',_0xfb3c34['uniqueid']),_0x50f441);}});ami['on'](_0xee36('0x29'),function(_0x139841){try{utils[_0xee36('0x20')](util[_0xee36('0x18')](_0xee36('0x2a'),_0x139841['uniqueid']),_0x139841);queues[_0xee36('0x29')](_0x139841);calls[_0xee36('0x29')](_0x139841);}catch(_0x10554e){utils['error'](util[_0xee36('0x18')](_0xee36('0x2a'),_0x139841[_0xee36('0x1c')]),_0x10554e);}});ami['on'](_0xee36('0x2b'),function(_0x5829bf){try{utils[_0xee36('0x20')](util[_0xee36('0x18')](_0xee36('0x2c'),_0x5829bf[_0xee36('0x1c')]),_0x5829bf);queues[_0xee36('0x2b')](_0x5829bf);calls[_0xee36('0x2b')](_0x5829bf);}catch(_0x1d883b){utils['error'](util[_0xee36('0x18')](_0xee36('0x2c'),_0x5829bf[_0xee36('0x1c')]),_0x1d883b);}});ami['on'](_0xee36('0x2d'),function(_0x4cc008){try{utils[_0xee36('0x20')](util[_0xee36('0x18')]('[%s][index][newstate]',_0x4cc008[_0xee36('0x1c')]),_0x4cc008);calls[_0xee36('0x2d')](_0x4cc008);recordings['newstate'](_0x4cc008);}catch(_0x49eefd){utils[_0xee36('0x16')](util[_0xee36('0x18')](_0xee36('0x2e'),_0x4cc008['uniqueid']),_0x49eefd);}});ami['on']('hangup',function(_0x3f2250){try{utils['debug'](util[_0xee36('0x18')](_0xee36('0x2f'),_0x3f2250[_0xee36('0x1c')]),_0x3f2250);calls['hangup'](_0x3f2250);recordings['hangup'](_0x3f2250);dials[_0xee36('0x30')](_0x3f2250);agents[_0xee36('0x30')](_0x3f2250);queues[_0xee36('0x30')](_0x3f2250);}catch(_0x395398){utils[_0xee36('0x16')](util['format']('[%s][index][hangup]',_0x3f2250[_0xee36('0x1c')]),_0x395398);}});ami['on'](_0xee36('0x31'),function(_0x222b11){try{utils[_0xee36('0x20')](util['format'](_0xee36('0x32'),_0x222b11[_0xee36('0x1c')]),_0x222b11);members['cdr'](_0x222b11);}catch(_0x5c464b){utils[_0xee36('0x16')](util[_0xee36('0x18')](_0xee36('0x32'),_0x222b11[_0xee36('0x1c')]),_0x5c464b);}});ami['on'](_0xee36('0x33'),function(_0x4e9031){try{utils[_0xee36('0x20')](util['format'](_0xee36('0x34'),_0x4e9031[_0xee36('0x1c')]),_0x4e9031);queues[_0xee36('0x33')](_0x4e9031);agents['blindtransfer'](_0x4e9031);transfers[_0xee36('0x33')](_0x4e9031);recordings['blindtransfer'](_0x4e9031);}catch(_0x4d9048){utils['error'](util[_0xee36('0x18')](_0xee36('0x34'),_0x4e9031['uniqueid']),_0x4d9048);}});ami['on'](_0xee36('0x35'),function(_0xd85d59){try{utils['debug'](util[_0xee36('0x18')](_0xee36('0x36'),_0xd85d59[_0xee36('0x37')]),_0xd85d59);queues['attendedtransfer'](_0xd85d59);transfers['attendedtransfer'](_0xd85d59);agents['attendedtransfer'](_0xd85d59);calls[_0xee36('0x35')](_0xd85d59);}catch(_0x1bad52){utils[_0xee36('0x16')](util[_0xee36('0x18')]('[%s][index][attendedtransfer]',_0xd85d59[_0xee36('0x37')]),_0x1bad52);}});ami['on'](_0xee36('0x38'),function(_0x4bc0dc){try{utils[_0xee36('0x20')](util['format'](_0xee36('0x39'),_0x4bc0dc['uniqueid']),_0x4bc0dc);queues[_0xee36('0x38')](_0x4bc0dc);recordings['varset'](_0x4bc0dc);calls[_0xee36('0x38')](_0x4bc0dc);dials[_0xee36('0x38')](_0x4bc0dc);}catch(_0x137745){utils[_0xee36('0x16')](util['format']('[%s][index][varset]',_0x4bc0dc[_0xee36('0x1c')]),_0x137745);}});ami['on'](_0xee36('0x3a'),function(_0x38bad1){try{utils[_0xee36('0x20')](util[_0xee36('0x18')](_0xee36('0x3b'),_0x38bad1[_0xee36('0x1c')]),_0x38bad1);calls['newexten'](_0x38bad1);recordings['newexten'](_0x38bad1);dials[_0xee36('0x3a')](_0x38bad1);}catch(_0x35a33f){utils[_0xee36('0x16')](util['format'](_0xee36('0x3b'),_0x38bad1[_0xee36('0x1c')]),_0x35a33f);}});ami['on'](_0xee36('0x3c'),function(_0x5a90f3){try{utils[_0xee36('0x20')](util[_0xee36('0x18')]('[%s][index][newchannel]',_0x5a90f3[_0xee36('0x1c')]),_0x5a90f3);calls['newchannel'](_0x5a90f3);recordings[_0xee36('0x3c')](_0x5a90f3);}catch(_0x4f2069){utils['error'](util[_0xee36('0x18')](_0xee36('0x3d'),_0x5a90f3['uniqueid']),_0x4f2069);}});ami['on']('dialbegin',function(_0x18630e){try{utils[_0xee36('0x20')](util[_0xee36('0x18')]('[%s][index][dialbegin]',_0x18630e[_0xee36('0x1c')]),_0x18630e);dials['dialbegin'](_0x18630e);}catch(_0x490cc5){utils['error'](util[_0xee36('0x18')](_0xee36('0x3e'),_0x18630e[_0xee36('0x1c')]),_0x490cc5);}});ami['on'](_0xee36('0x3f'),function(_0x2a9f91){try{utils[_0xee36('0x20')](util['format'](_0xee36('0x40'),_0x2a9f91[_0xee36('0x1c')]),_0x2a9f91);dials[_0xee36('0x3f')](_0x2a9f91);}catch(_0x463e9d){utils[_0xee36('0x16')](util[_0xee36('0x18')](_0xee36('0x40'),_0x2a9f91['uniqueid']),_0x463e9d);}});} \ No newline at end of file +var _0x86b8=['production','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','device','error','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env'];(function(_0x1b5e1e,_0x502a09){var _0x4c717e=function(_0x30a3a2){while(--_0x30a3a2){_0x1b5e1e['push'](_0x1b5e1e['shift']());}};_0x4c717e(++_0x502a09);}(_0x86b8,0x15d));var _0x886b=function(_0x2a349b,_0x3d5899){_0x2a349b=_0x2a349b-0x0;var _0x5e39e8=_0x86b8[_0x2a349b];return _0x5e39e8;};var AsteriskManager=require(_0x886b('0x0'));var config=require(_0x886b('0x1'));var utils=require(_0x886b('0x2'));var util=require('util');var isXDREnabled=config[_0x886b('0x3')]&&!config['xdr'][_0x886b('0x4')];var isProduction=config[_0x886b('0x5')]===_0x886b('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x886b('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x886b('0x7')],config[_0x886b('0x8')]['ip'],config[_0x886b('0x8')][_0x886b('0x9')],config[_0x886b('0x8')][_0x886b('0xa')],!![]);ami[_0x886b('0xb')]();if(!isXDREnabled){utils[_0x886b('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x886b('0xc')](_0x886b('0xd'));}else{var agents=require(_0x886b('0xe'));var calls=require(_0x886b('0xf'));var queues=require(_0x886b('0x10'));var recordings=require(_0x886b('0x11'));var members=require(_0x886b('0x12'));var dials=require(_0x886b('0x13'));var transfers=require('./transfers.controller');var core=require(_0x886b('0x14'));ami['on'](_0x886b('0x15'),core['connect']);ami['on'](_0x886b('0x16'),core[_0x886b('0x16')]);ami['on'](_0x886b('0x17'),core[_0x886b('0x17')]);ami['on']('error',core['error']);ami['on'](_0x886b('0x18'),core[_0x886b('0x18')]);ami['on'](_0x886b('0x19'),core[_0x886b('0x19')]);ami['on'](_0x886b('0x1a'),function(_0x17d7d9){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')]('[%s][index][devicestatechange]',_0x17d7d9[_0x886b('0x1d')]),_0x17d7d9);members[_0x886b('0x1a')](_0x17d7d9);}catch(_0x54fd8e){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x1f'),_0x17d7d9[_0x886b('0x1d')]),_0x54fd8e);}});ami['on'](_0x886b('0x20'),function(_0xe05a77){try{utils['debug'](util['format'](_0x886b('0x21'),_0xe05a77[_0x886b('0x22')]),_0xe05a77);agents[_0x886b('0x20')](_0xe05a77);}catch(_0x4fea00){utils['error'](util[_0x886b('0x1c')](_0x886b('0x21'),_0xe05a77[_0x886b('0x22')]),_0x4fea00);}});ami['on'](_0x886b('0x23'),function(_0x32697f){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')]('[%s][index][agentringnoanswer]',_0x32697f[_0x886b('0x22')]),_0x32697f);agents[_0x886b('0x23')](_0x32697f);}catch(_0x2287e2){utils['error'](util[_0x886b('0x1c')](_0x886b('0x24'),_0x32697f[_0x886b('0x22')]),_0x2287e2);}});ami['on'](_0x886b('0x25'),function(_0x544435){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x26'),_0x544435[_0x886b('0x22')]),_0x544435);agents[_0x886b('0x25')](_0x544435);queues['agentconnect'](_0x544435);}catch(_0x308038){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x26'),_0x544435['uniqueid']),_0x308038);}});ami['on']('agentcomplete',function(_0x3b85a4){try{utils[_0x886b('0x1b')](util['format'](_0x886b('0x27'),_0x3b85a4[_0x886b('0x22')]),_0x3b85a4);agents[_0x886b('0x28')](_0x3b85a4);queues[_0x886b('0x28')](_0x3b85a4);members[_0x886b('0x28')](_0x3b85a4);}catch(_0xbfd773){utils['error'](util['format'](_0x886b('0x27'),_0x3b85a4[_0x886b('0x22')]),_0xbfd773);}});ami['on'](_0x886b('0x29'),function(_0x634c6){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')]('[%s][index][queuecallerabandon]',_0x634c6['uniqueid']),_0x634c6);agents['queuecallerabandon'](_0x634c6);queues['queuecallerabandon'](_0x634c6);}catch(_0x224df5){utils['error'](util[_0x886b('0x1c')]('[%s][index][queuecallerabandon]',_0x634c6['uniqueid']),_0x224df5);}});ami['on'](_0x886b('0x2a'),function(_0x1e5cbe){try{utils['debug'](util['format'](_0x886b('0x2b'),_0x1e5cbe['uniqueid']),_0x1e5cbe);queues['queuecallerjoin'](_0x1e5cbe);recordings[_0x886b('0x2a')](_0x1e5cbe);}catch(_0x4e11c0){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x2b'),_0x1e5cbe[_0x886b('0x22')]),_0x4e11c0);}});ami['on']('queuecallerleave',function(_0x258c16){try{utils[_0x886b('0x1b')](util['format'](_0x886b('0x2c'),_0x258c16[_0x886b('0x22')]),_0x258c16);queues[_0x886b('0x2d')](_0x258c16);}catch(_0x46d4af){utils[_0x886b('0x1e')](util[_0x886b('0x1c')]('[%s][index][queuecallerleave]',_0x258c16[_0x886b('0x22')]),_0x46d4af);}});ami['on'](_0x886b('0x2e'),function(_0x283756){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x2f'),_0x283756[_0x886b('0x22')]),_0x283756);queues[_0x886b('0x2e')](_0x283756);calls[_0x886b('0x2e')](_0x283756);}catch(_0x4f63cd){utils['error'](util[_0x886b('0x1c')](_0x886b('0x2f'),_0x283756['uniqueid']),_0x4f63cd);}});ami['on'](_0x886b('0x30'),function(_0x2376fb){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')]('[%s][index][musiconholdstop]',_0x2376fb[_0x886b('0x22')]),_0x2376fb);queues['musiconholdstop'](_0x2376fb);calls[_0x886b('0x30')](_0x2376fb);}catch(_0x5d82a7){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x31'),_0x2376fb[_0x886b('0x22')]),_0x5d82a7);}});ami['on'](_0x886b('0x32'),function(_0x140a0c){try{utils['debug'](util[_0x886b('0x1c')](_0x886b('0x33'),_0x140a0c['uniqueid']),_0x140a0c);calls[_0x886b('0x32')](_0x140a0c);recordings['newstate'](_0x140a0c);}catch(_0x26e2b4){utils[_0x886b('0x1e')](util['format'](_0x886b('0x33'),_0x140a0c[_0x886b('0x22')]),_0x26e2b4);}});ami['on'](_0x886b('0x34'),function(_0x296932){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')]('[%s][index][hangup]',_0x296932['uniqueid']),_0x296932);calls[_0x886b('0x34')](_0x296932);recordings[_0x886b('0x34')](_0x296932);dials[_0x886b('0x34')](_0x296932);agents['hangup'](_0x296932);queues[_0x886b('0x34')](_0x296932);}catch(_0x1be6c8){utils[_0x886b('0x1e')](util['format']('[%s][index][hangup]',_0x296932['uniqueid']),_0x1be6c8);}});ami['on'](_0x886b('0x35'),function(_0x460af4){try{utils['debug'](util[_0x886b('0x1c')](_0x886b('0x36'),_0x460af4[_0x886b('0x22')]),_0x460af4);members[_0x886b('0x35')](_0x460af4);}catch(_0x34c370){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x36'),_0x460af4[_0x886b('0x22')]),_0x34c370);}});ami['on']('blindtransfer',function(_0x5c905d){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x37'),_0x5c905d[_0x886b('0x22')]),_0x5c905d);queues['blindtransfer'](_0x5c905d);agents[_0x886b('0x38')](_0x5c905d);transfers['blindtransfer'](_0x5c905d);recordings[_0x886b('0x38')](_0x5c905d);}catch(_0x8e1489){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x37'),_0x5c905d[_0x886b('0x22')]),_0x8e1489);}});ami['on']('attendedtransfer',function(_0x4de0d4){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x39'),_0x4de0d4[_0x886b('0x3a')]),_0x4de0d4);queues[_0x886b('0x3b')](_0x4de0d4);transfers[_0x886b('0x3b')](_0x4de0d4);agents[_0x886b('0x3b')](_0x4de0d4);calls['attendedtransfer'](_0x4de0d4);}catch(_0x2420a7){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x39'),_0x4de0d4[_0x886b('0x3a')]),_0x2420a7);}});ami['on'](_0x886b('0x3c'),function(_0x1eb427){try{utils[_0x886b('0x1b')](util['format'](_0x886b('0x3d'),_0x1eb427[_0x886b('0x22')]),_0x1eb427);queues[_0x886b('0x3c')](_0x1eb427);recordings[_0x886b('0x3c')](_0x1eb427);calls['varset'](_0x1eb427);dials['varset'](_0x1eb427);}catch(_0x18102f){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x3d'),_0x1eb427[_0x886b('0x22')]),_0x18102f);}});ami['on']('newexten',function(_0x17cd99){try{utils[_0x886b('0x1b')](util['format'](_0x886b('0x3e'),_0x17cd99['uniqueid']),_0x17cd99);calls[_0x886b('0x3f')](_0x17cd99);recordings[_0x886b('0x3f')](_0x17cd99);dials[_0x886b('0x3f')](_0x17cd99);}catch(_0x48a06e){utils[_0x886b('0x1e')](util['format'](_0x886b('0x3e'),_0x17cd99[_0x886b('0x22')]),_0x48a06e);}});ami['on']('newchannel',function(_0x5c2498){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x40'),_0x5c2498[_0x886b('0x22')]),_0x5c2498);calls[_0x886b('0x41')](_0x5c2498);recordings[_0x886b('0x41')](_0x5c2498);}catch(_0x1795ac){utils[_0x886b('0x1e')](util[_0x886b('0x1c')]('[%s][index][newchannel]',_0x5c2498['uniqueid']),_0x1795ac);}});ami['on'](_0x886b('0x42'),function(_0x49c454){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x43'),_0x49c454[_0x886b('0x22')]),_0x49c454);dials[_0x886b('0x42')](_0x49c454);}catch(_0x432b42){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x44'),_0x49c454['uniqueid']),_0x432b42);}});ami['on'](_0x886b('0x45'),function(_0x345eeb){try{utils[_0x886b('0x1b')](util[_0x886b('0x1c')](_0x886b('0x46'),_0x345eeb[_0x886b('0x22')]),_0x345eeb);dials['dialend'](_0x345eeb);}catch(_0x2917e6){utils[_0x886b('0x1e')](util[_0x886b('0x1c')](_0x886b('0x46'),_0x345eeb[_0x886b('0x22')]),_0x2917e6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9173e8a..d237bc2 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 _0x5304=['NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','split','assign','data1','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','info','format','uniqueid','channel','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','catch','error','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','now','agent'];(function(_0x65bb18,_0x281984){var _0x14701e=function(_0x1cfeba){while(--_0x1cfeba){_0x65bb18['push'](_0x65bb18['shift']());}};_0x14701e(++_0x281984);}(_0x5304,0x167));var _0x4530=function(_0xe7281f,_0x2d77c3){_0xe7281f=_0xe7281f-0x0;var _0x90dc99=_0x5304[_0xe7281f];return _0x90dc99;};'use strict';var _=require(_0x4530('0x0'));var util=require(_0x4530('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x719e6b){utils[_0x4530('0x2')](util[_0x4530('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x719e6b[_0x4530('0x4')],_0x719e6b['interface'],_0x719e6b[_0x4530('0x5')],_0x719e6b['data2'],_0x719e6b[_0x4530('0x6')],_0x719e6b['type']));if(_0x719e6b[_0x4530('0x7')]){utils[_0x4530('0x8')](_0x719e6b[_0x4530('0x7')])[_0x4530('0x9')](function(_0x230db3){if(_0x230db3){_0x719e6b['membername']=_0x230db3[_0x4530('0xa')];_0x719e6b[_0x4530('0xb')]=_0x230db3[_0x4530('0xb')];utils['request']('CreateMemberReport',_0x719e6b);}else{utils['getUserByName'](_0x719e6b['interface']['split']('/')[0x1])['then'](function(_0x485c63){if(_0x485c63){_0x719e6b['membername']=_0x485c63[_0x4530('0xa')];_0x719e6b[_0x4530('0xb')]=_0x485c63[_0x4530('0xb')];utils[_0x4530('0xc')](_0x4530('0xd'),_0x719e6b);}});}})[_0x4530('0xe')](function(_0x20a07f){utils[_0x4530('0xf')](util[_0x4530('0x3')]('[%s][members][writeDB]',_0x719e6b[_0x4530('0x4')]),_0x20a07f);});}delete members[_0x719e6b[_0x4530('0x7')]];}function startsWith(_0x1ab39b,_0x18b1df){return _['some'](_0x1ab39b,function(_0x31999b){return _[_0x4530('0x10')](_0x18b1df,_0x31999b);});}exports[_0x4530('0x11')]=function(_0x126da1){try{utils[_0x4530('0x12')](util[_0x4530('0x3')]('[%s][members][devicestatechange]',members[_0x126da1[_0x4530('0x13')]]?members[_0x126da1[_0x4530('0x13')]][_0x4530('0x4')]:_0x126da1[_0x4530('0x13')]),_0x126da1);utils[_0x4530('0x2')](util['format'](_0x4530('0x14'),members[_0x126da1['device']]?members[_0x126da1[_0x4530('0x13')]][_0x4530('0x4')]:_0x126da1[_0x4530('0x13')],_0x126da1['state'],_0x126da1['device']));switch(_0x126da1['state']){case'INUSE':case _0x4530('0x15'):if(!startsWith(exclude,_0x126da1['device'])){members[_0x126da1[_0x4530('0x13')]]={'channel':_0x4530('0x16'),'interface':_0x126da1[_0x4530('0x13')],'type':'TALKING','enterAt':utils[_0x4530('0x17')](),'role':_0x4530('0x18')};}break;case _0x4530('0x19'):if(!_[_0x4530('0x1a')](members[_0x126da1[_0x4530('0x13')]])){members[_0x126da1['device']][_0x4530('0x1b')]=utils[_0x4530('0x17')]();members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1c')]=utils[_0x4530('0x1d')](members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1b')],members[_0x126da1[_0x4530('0x13')]][_0x4530('0x1e')]);if(members[_0x126da1[_0x4530('0x13')]]['uniqueid']){writeDB(members[_0x126da1[_0x4530('0x13')]]);}}break;default:break;}}catch(_0x1cbf7e){utils[_0x4530('0xf')](util['format'](_0x4530('0x1f'),members[_0x126da1[_0x4530('0x13')]]?members[_0x126da1['device']]['uniqueid']:_0x126da1['device']),_0x1cbf7e);}};exports[_0x4530('0x20')]=function(_0x235356){try{if(!_[_0x4530('0x1a')](members[_0x235356[_0x4530('0x7')]])){utils['debug'](util['format'](_0x4530('0x21'),_0x235356[_0x4530('0x4')]),_0x235356);utils[_0x4530('0x2')](util[_0x4530('0x3')](_0x4530('0x22'),_0x235356['uniqueid'],_0x235356[_0x4530('0x7')],_0x235356[_0x4530('0x23')]));members[_0x235356['interface']]=_['assign'](members[_0x235356['interface']],{'data4':_0x235356[_0x4530('0x23')],'uniqueid':_0x235356[_0x4530('0x4')]});}}catch(_0x294711){utils[_0x4530('0xf')](util[_0x4530('0x3')](_0x4530('0x21'),_0x235356['uniqueid']),_0x294711);}};exports[_0x4530('0x24')]=function(_0x37df0d){try{utils['debug'](util[_0x4530('0x3')](_0x4530('0x25'),_0x37df0d['uniqueid']),_0x37df0d);if(_0x37df0d[_0x4530('0x5')]){var _0x45a419=_0x37df0d[_0x4530('0x5')][_0x4530('0x26')]('-')[0x0];if(!_[_0x4530('0x1a')](members[_0x45a419])){members[_0x45a419]=_[_0x4530('0x27')](members[_0x45a419],{'data1':members[_0x45a419][_0x4530('0x28')]||_0x37df0d[_0x4530('0x29')],'data2':members[_0x45a419][_0x4530('0x2a')]||_0x37df0d[_0x4530('0x2b')],'data3':members[_0x45a419][_0x4530('0x2c')]||_0x37df0d[_0x4530('0x2d')],'uniqueid':members[_0x45a419]['uniqueid']||_0x37df0d[_0x4530('0x4')]});utils['info'](util['format'](_0x4530('0x2e'),_0x37df0d[_0x4530('0x4')],members[_0x45a419][_0x4530('0x28')],members[_0x45a419][_0x4530('0x2a')],members[_0x45a419]['data3']));if(members[_0x45a419]['exitAt']){writeDB(members[_0x45a419]);}}}if(_0x37df0d['destinationchannel']){var _0x19ad51=_0x37df0d[_0x4530('0x2f')][_0x4530('0x26')]('-')[0x0];if(!_[_0x4530('0x1a')](members[_0x19ad51])){members[_0x19ad51]=_[_0x4530('0x27')](members[_0x19ad51],{'data1':members[_0x19ad51][_0x4530('0x28')]||_0x37df0d[_0x4530('0x29')],'data2':members[_0x19ad51][_0x4530('0x2a')]||_0x37df0d[_0x4530('0x2b')],'data3':members[_0x19ad51][_0x4530('0x2c')]||_0x37df0d[_0x4530('0x2d')],'uniqueid':members[_0x19ad51][_0x4530('0x4')]||_0x37df0d[_0x4530('0x4')]});utils[_0x4530('0x2')](util[_0x4530('0x3')](_0x4530('0x2e'),_0x37df0d[_0x4530('0x4')],members[_0x19ad51][_0x4530('0x28')],members[_0x19ad51][_0x4530('0x2a')],members[_0x19ad51][_0x4530('0x2c')]));if(members[_0x19ad51][_0x4530('0x1b')]){writeDB(members[_0x19ad51]);}}}}catch(_0x386cb5){utils[_0x4530('0xf')](util['format'](_0x4530('0x25'),_0x37df0d[_0x4530('0x4')]),_0x386cb5);}}; \ No newline at end of file +var _0xf3f9=['name','error','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','cdr','[%s][members][cdr]','isNil','assign','data1','source','data3','destination','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split'];(function(_0x583705,_0x5bab07){var _0x2bf20d=function(_0x583bdc){while(--_0x583bdc){_0x583705['push'](_0x583705['shift']());}};_0x2bf20d(++_0x5bab07);}(_0xf3f9,0x14a));var _0x9f3f=function(_0x322771,_0x31e96a){_0x322771=_0x322771-0x0;var _0x27f298=_0xf3f9[_0x322771];return _0x27f298;};'use strict';var _=require(_0x9f3f('0x0'));var util=require('util');var utils=require(_0x9f3f('0x1'));var members={};var exclude=[_0x9f3f('0x2'),_0x9f3f('0x3')];function writeDB(_0x375192){utils[_0x9f3f('0x4')](util[_0x9f3f('0x5')](_0x9f3f('0x6'),_0x375192[_0x9f3f('0x7')],_0x375192['interface'],_0x375192[_0x9f3f('0x8')],_0x375192[_0x9f3f('0x9')],_0x375192[_0x9f3f('0xa')],_0x375192[_0x9f3f('0xb')]));if(_0x375192[_0x9f3f('0xc')]){utils[_0x9f3f('0xd')](_0x375192[_0x9f3f('0xc')])[_0x9f3f('0xe')](function(_0x83eb85){if(_0x83eb85){_0x375192[_0x9f3f('0xa')]=_0x83eb85['name'];_0x375192[_0x9f3f('0xf')]=_0x83eb85['internal'];utils[_0x9f3f('0x10')](_0x9f3f('0x11'),_0x375192);}else{utils[_0x9f3f('0x12')](_0x375192['interface'][_0x9f3f('0x13')]('/')[0x1])[_0x9f3f('0xe')](function(_0x22d5aa){if(_0x22d5aa){_0x375192[_0x9f3f('0xa')]=_0x22d5aa[_0x9f3f('0x14')];_0x375192[_0x9f3f('0xf')]=_0x22d5aa[_0x9f3f('0xf')];utils[_0x9f3f('0x10')](_0x9f3f('0x11'),_0x375192);}});}})['catch'](function(_0x4497ec){utils[_0x9f3f('0x15')](util[_0x9f3f('0x5')]('[%s][members][writeDB]',_0x375192[_0x9f3f('0x7')]),_0x4497ec);});}delete members[_0x375192['interface']];}function startsWith(_0x1fc547,_0x8cd098){return _['some'](_0x1fc547,function(_0x3c025a){return _[_0x9f3f('0x16')](_0x8cd098,_0x3c025a);});}exports['devicestatechange']=function(_0xa76f76){try{utils[_0x9f3f('0x17')](util[_0x9f3f('0x5')]('[%s][members][devicestatechange]',members[_0xa76f76[_0x9f3f('0x18')]]?members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x7')]:_0xa76f76[_0x9f3f('0x18')]),_0xa76f76);utils['info'](util[_0x9f3f('0x5')](_0x9f3f('0x19'),members[_0xa76f76['device']]?members[_0xa76f76['device']][_0x9f3f('0x7')]:_0xa76f76[_0x9f3f('0x18')],_0xa76f76['state'],_0xa76f76[_0x9f3f('0x18')]));switch(_0xa76f76[_0x9f3f('0x1a')]){case _0x9f3f('0x1b'):case _0x9f3f('0x1c'):if(!startsWith(exclude,_0xa76f76['device'])){members[_0xa76f76[_0x9f3f('0x18')]]={'channel':_0x9f3f('0x1d'),'interface':_0xa76f76[_0x9f3f('0x18')],'type':_0x9f3f('0x1e'),'enterAt':utils[_0x9f3f('0x1f')](),'role':_0x9f3f('0x20')};}break;case _0x9f3f('0x21'):if(!_['isNil'](members[_0xa76f76[_0x9f3f('0x18')]])){members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x22')]=utils[_0x9f3f('0x1f')]();members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x23')]=utils[_0x9f3f('0x24')](members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x22')],members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x25')]);if(members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x7')]){writeDB(members[_0xa76f76[_0x9f3f('0x18')]]);}}break;default:break;}}catch(_0x332e97){utils['error'](util[_0x9f3f('0x5')]('[%s][members][devicestatechange]',members[_0xa76f76[_0x9f3f('0x18')]]?members[_0xa76f76[_0x9f3f('0x18')]][_0x9f3f('0x7')]:_0xa76f76[_0x9f3f('0x18')]),_0x332e97);}};exports[_0x9f3f('0x26')]=function(_0x2bf879){try{if(!_['isNil'](members[_0x2bf879[_0x9f3f('0xc')]])){utils['debug'](util[_0x9f3f('0x5')](_0x9f3f('0x27'),_0x2bf879[_0x9f3f('0x7')]),_0x2bf879);utils[_0x9f3f('0x4')](util[_0x9f3f('0x5')](_0x9f3f('0x28'),_0x2bf879[_0x9f3f('0x7')],_0x2bf879[_0x9f3f('0xc')],_0x2bf879['queue']));members[_0x2bf879['interface']]=_['assign'](members[_0x2bf879[_0x9f3f('0xc')]],{'data4':_0x2bf879['queue'],'uniqueid':_0x2bf879['uniqueid']});}}catch(_0x3931b3){utils['error'](util[_0x9f3f('0x5')](_0x9f3f('0x27'),_0x2bf879[_0x9f3f('0x7')]),_0x3931b3);}};exports[_0x9f3f('0x29')]=function(_0x1fd3b3){try{utils[_0x9f3f('0x17')](util[_0x9f3f('0x5')](_0x9f3f('0x2a'),_0x1fd3b3[_0x9f3f('0x7')]),_0x1fd3b3);if(_0x1fd3b3[_0x9f3f('0x8')]){var _0x163e93=_0x1fd3b3[_0x9f3f('0x8')][_0x9f3f('0x13')]('-')[0x0];if(!_[_0x9f3f('0x2b')](members[_0x163e93])){members[_0x163e93]=_[_0x9f3f('0x2c')](members[_0x163e93],{'data1':members[_0x163e93][_0x9f3f('0x2d')]||_0x1fd3b3[_0x9f3f('0xb')],'data2':members[_0x163e93][_0x9f3f('0x9')]||_0x1fd3b3[_0x9f3f('0x2e')],'data3':members[_0x163e93][_0x9f3f('0x2f')]||_0x1fd3b3[_0x9f3f('0x30')],'uniqueid':members[_0x163e93][_0x9f3f('0x7')]||_0x1fd3b3[_0x9f3f('0x7')]});utils[_0x9f3f('0x4')](util[_0x9f3f('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1fd3b3['uniqueid'],members[_0x163e93][_0x9f3f('0x2d')],members[_0x163e93][_0x9f3f('0x9')],members[_0x163e93][_0x9f3f('0x2f')]));if(members[_0x163e93][_0x9f3f('0x22')]){writeDB(members[_0x163e93]);}}}if(_0x1fd3b3[_0x9f3f('0x31')]){var _0x403795=_0x1fd3b3[_0x9f3f('0x31')][_0x9f3f('0x13')]('-')[0x0];if(!_[_0x9f3f('0x2b')](members[_0x403795])){members[_0x403795]=_[_0x9f3f('0x2c')](members[_0x403795],{'data1':members[_0x403795][_0x9f3f('0x2d')]||_0x1fd3b3[_0x9f3f('0xb')],'data2':members[_0x403795][_0x9f3f('0x9')]||_0x1fd3b3['source'],'data3':members[_0x403795][_0x9f3f('0x2f')]||_0x1fd3b3[_0x9f3f('0x30')],'uniqueid':members[_0x403795][_0x9f3f('0x7')]||_0x1fd3b3['uniqueid']});utils[_0x9f3f('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1fd3b3[_0x9f3f('0x7')],members[_0x403795][_0x9f3f('0x2d')],members[_0x403795][_0x9f3f('0x9')],members[_0x403795][_0x9f3f('0x2f')]));if(members[_0x403795]['exitAt']){writeDB(members[_0x403795]);}}}}catch(_0x425d4a){utils[_0x9f3f('0x15')](util['format'](_0x9f3f('0x2a'),_0x1fd3b3['uniqueid']),_0x425d4a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7bfa93b..1ee8022 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 _0x09d2=['[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%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','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','name','variable','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09d2,0x152));var _0x209d=function(_0x194d28,_0x268ce5){_0x194d28=_0x194d28-0x0;var _0x101a2a=_0x09d2[_0x194d28];return _0x101a2a;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x62876){utils[_0x209d('0x0')](util['format'](_0x209d('0x1'),_0x62876[_0x209d('0x2')],_0x62876['channel'],_0x62876[_0x209d('0x3')],_0x62876[_0x209d('0x4')],_0x62876['calleridnum'],_0x62876[_0x209d('0x5')],_0x62876[_0x209d('0x6')]));if(_0x62876[_0x209d('0x3')]){utils['getVoiceQueueByName'](_0x62876[_0x209d('0x3')])[_0x209d('0x7')](function(_0x245fab){if(_0x245fab){_0x62876[_0x209d('0x8')]=_0x245fab[_0x209d('0x8')];}utils['request'](_0x209d('0x9'),_0x62876);});}else{utils[_0x209d('0xa')]('CreateVoiceQueueReport',_0x62876);}if(_0x62876[_0x209d('0xb')]){delete queues[_0x62876[_0x209d('0xb')]];}else{delete queues[_0x62876[_0x209d('0x2')]];}}exports[_0x209d('0xc')]=function(_0x46adc4){try{utils['debug'](util[_0x209d('0xd')](_0x209d('0xe'),_0x46adc4['uniqueid']),_0x46adc4);utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0xf'),_0x46adc4[_0x209d('0x2')],_0x46adc4[_0x209d('0x3')],_0x46adc4['position']));queues[_0x46adc4[_0x209d('0x2')]]=_[_0x209d('0x10')](_0x46adc4,{'originalposition':_0x46adc4[_0x209d('0x11')],'queuecallerjoinAt':utils[_0x209d('0x12')](),'mohtime':0x0});}catch(_0x30058e){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0xe'),_0x46adc4[_0x209d('0x2')]),_0x30058e);}};exports['hangup']=function(_0x5be6f8){try{if(!_[_0x209d('0x14')](queues[_0x5be6f8['uniqueid']])){utils[_0x209d('0x15')](util[_0x209d('0xd')](_0x209d('0x16'),_0x5be6f8[_0x209d('0x2')]),_0x5be6f8);if(queues[_0x5be6f8['uniqueid']][_0x209d('0x17')]){if(!queues[_0x5be6f8['uniqueid']][_0x209d('0x18')]&&!queues[_0x5be6f8['uniqueid']][_0x209d('0x19')]){queues[_0x5be6f8[_0x209d('0x2')]][_0x209d('0x1a')]=!![];queues[_0x5be6f8[_0x209d('0x2')]][_0x209d('0x1b')]=utils['now']();queues[_0x5be6f8[_0x209d('0x2')]][_0x209d('0x6')]=_0x209d('0x1c');}utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5be6f8[_0x209d('0x2')],queues[_0x5be6f8[_0x209d('0x2')]]['name'],queues[_0x5be6f8['uniqueid']][_0x209d('0x6')]));writeDB(queues[_0x5be6f8[_0x209d('0x2')]]);}else if(queues[_0x5be6f8['uniqueid']][_0x209d('0xb')]){utils[_0x209d('0x0')](util[_0x209d('0xd')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5be6f8['uniqueid'],queues[_0x5be6f8['uniqueid']]['name'],queues[_0x5be6f8[_0x209d('0x2')]][_0x209d('0xb')]));queues[queues[_0x5be6f8[_0x209d('0x2')]][_0x209d('0xb')]]=queues[_0x5be6f8['uniqueid']];queues[queues[_0x5be6f8[_0x209d('0x2')]]['transfereduniqueid']][_0x209d('0x1d')]=0x2;delete queues[_0x5be6f8[_0x209d('0x2')]];}}}catch(_0x3eb2b3){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0x16'),_0x5be6f8[_0x209d('0x2')]),_0x3eb2b3);}};exports[_0x209d('0x1e')]=function(_0x36227a){try{utils[_0x209d('0x15')](util[_0x209d('0xd')](_0x209d('0x1f'),_0x36227a[_0x209d('0x2')]),_0x36227a);if(!_['isNil'](_0x36227a['variable'][_0x209d('0x20')])&&_0x36227a[_0x209d('0x21')][_0x209d('0x22')]()!==_0x209d('0x23')){if(!_[_0x209d('0x14')](queues[_0x36227a[_0x209d('0x2')]])){queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x18')]=![];queues[_0x36227a['uniqueid']][_0x209d('0x24')]=null;queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x19')]=!![];queues[_0x36227a[_0x209d('0x2')]]['queuecallerexitAt']=utils[_0x209d('0x12')]();queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x6')]=_0x36227a[_0x209d('0x21')][_0x209d('0x22')]();utils[_0x209d('0x0')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x36227a[_0x209d('0x2')],queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x25')],_0x36227a[_0x209d('0x21')],queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x6')]));writeDB(queues[_0x36227a[_0x209d('0x2')]]);}}else if(!_[_0x209d('0x14')](_0x36227a[_0x209d('0x26')][_0x209d('0x27')])){if(!_[_0x209d('0x14')](queues[_0x36227a[_0x209d('0x2')]])&&!queues[_0x36227a[_0x209d('0x2')]]['queuecallerabandon']){queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x18')]=![];queues[_0x36227a[_0x209d('0x2')]]['queuecallerabandonAt']=null;queues[_0x36227a[_0x209d('0x2')]]['queuecallerexit']=!![];queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x28')]=utils[_0x209d('0x12')]();queues[_0x36227a[_0x209d('0x2')]][_0x209d('0x6')]=_0x209d('0x29');utils[_0x209d('0x0')](util['format'](_0x209d('0x2a'),_0x36227a[_0x209d('0x2')],queues[_0x36227a['uniqueid']][_0x209d('0x25')],_0x36227a[_0x209d('0x21')],queues[_0x36227a['uniqueid']][_0x209d('0x6')]));}}}catch(_0x4f66cb){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0x1f'),_0x36227a[_0x209d('0x2')]),_0x4f66cb);}};exports['queuecallerabandon']=function(_0x24aab7){try{if(!_['isNil'](queues[_0x24aab7['uniqueid']])){utils[_0x209d('0x15')](util['format'](_0x209d('0x2b'),_0x24aab7[_0x209d('0x2')]),_0x24aab7);queues[_0x24aab7[_0x209d('0x2')]][_0x209d('0x19')]=![];queues[_0x24aab7[_0x209d('0x2')]]['queuecallerexitAt']=null;queues[_0x24aab7[_0x209d('0x2')]]['queuecallerabandon']=!![];queues[_0x24aab7[_0x209d('0x2')]][_0x209d('0x24')]=utils['now']();queues[_0x24aab7[_0x209d('0x2')]][_0x209d('0x6')]='ABANDONED';utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0x2c'),_0x24aab7[_0x209d('0x2')],queues[_0x24aab7['uniqueid']][_0x209d('0x25')],queues[_0x24aab7[_0x209d('0x2')]][_0x209d('0x6')]));}}catch(_0x518d60){utils['error'](util[_0x209d('0xd')](_0x209d('0x2b'),_0x24aab7[_0x209d('0x2')]),_0x518d60);}};exports[_0x209d('0x2d')]=function(_0xd04091){try{if(!_[_0x209d('0x14')](queues[_0xd04091[_0x209d('0x2')]])){utils[_0x209d('0x15')](util[_0x209d('0xd')](_0x209d('0x2e'),_0xd04091[_0x209d('0x2')]),_0xd04091);utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0x2f'),_0xd04091['uniqueid'],queues[_0xd04091['uniqueid']][_0x209d('0x25')],_0xd04091[_0x209d('0x30')],_0xd04091[_0x209d('0x31')]));queues[_0xd04091[_0x209d('0x2')]][_0x209d('0x2d')]=!![];queues[_0xd04091['uniqueid']][_0x209d('0x17')]=utils['now']();queues[_0xd04091[_0x209d('0x2')]][_0x209d('0x32')]=utils[_0x209d('0x33')](queues[_0xd04091[_0x209d('0x2')]]['queuecallerleaveAt'],queues[_0xd04091['uniqueid']][_0x209d('0x34')]);queues[_0xd04091[_0x209d('0x2')]][_0x209d('0x11')]=_0xd04091['position'];queues[_0xd04091[_0x209d('0x2')]][_0x209d('0x35')]=_0xd04091[_0x209d('0x35')];queues[_0xd04091[_0x209d('0x2')]]['connectedlinenum']=_0xd04091[_0x209d('0x30')];queues[_0xd04091['uniqueid']]['connectedlinename']=_0xd04091[_0x209d('0x31')];}}catch(_0x75279d){utils[_0x209d('0x13')](util[_0x209d('0xd')]('[%s][queues][queuecallerleave]',_0xd04091[_0x209d('0x2')]),_0x75279d);}};exports[_0x209d('0x36')]=function(_0x7a5019){try{if(!_[_0x209d('0x14')](queues[_0x7a5019[_0x209d('0x2')]])){utils[_0x209d('0x15')](util[_0x209d('0xd')]('[%s][queues][agentconnect]',_0x7a5019['uniqueid']),_0x7a5019);utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0x37'),_0x7a5019[_0x209d('0x2')],queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x25')],_0x7a5019[_0x209d('0x38')],_0x7a5019[_0x209d('0x39')]));queues[_0x7a5019['uniqueid']][_0x209d('0x18')]=![];queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x18')]=![];queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x24')]=null;queues[_0x7a5019['uniqueid']]['queuecallerexit']=![];queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x6')]=null;queues[_0x7a5019[_0x209d('0x2')]]['queuecallerexitAt']=null;queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x3a')]=!![];queues[_0x7a5019[_0x209d('0x2')]][_0x209d('0x5')]=_0x7a5019[_0x209d('0x39')];queues[_0x7a5019['uniqueid']][_0x209d('0x4')]=_0x7a5019[_0x209d('0x38')];}}catch(_0x4d94a7){utils['error'](util[_0x209d('0xd')](_0x209d('0x3b'),_0x7a5019[_0x209d('0x2')]),_0x4d94a7);}};exports['agentcomplete']=function(_0x3e04f8){try{if(!_[_0x209d('0x14')](queues[_0x3e04f8[_0x209d('0x2')]])){if(queues[_0x3e04f8[_0x209d('0x2')]]['queuecallerleaveAt']){utils[_0x209d('0x15')](util[_0x209d('0xd')](_0x209d('0x3c'),_0x3e04f8[_0x209d('0x2')]),_0x3e04f8);queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x18')]=![];queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x18')]=![];queues[_0x3e04f8[_0x209d('0x2')]]['queuecallerabandonAt']=null;queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x19')]=![];queues[_0x3e04f8['uniqueid']][_0x209d('0x28')]=null;queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x3a')]=!![];queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x4')]=_0x3e04f8[_0x209d('0x38')];queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x1a')]=!![];queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x1b')]=utils['now']();if(_0x3e04f8['reason']==_0x209d('0x3d')){if(!queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x3d')]){queues[_0x3e04f8[_0x209d('0x2')]]['queuecallerexitreason']=_0x209d('0x3e');}}else{queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x6')]=_0x209d('0x3f')+_0x3e04f8['reason'][_0x209d('0x22')]();}utils[_0x209d('0x0')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3e04f8[_0x209d('0x2')],queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x25')],_0x3e04f8[_0x209d('0x38')],queues[_0x3e04f8[_0x209d('0x2')]][_0x209d('0x6')]));writeDB(queues[_0x3e04f8[_0x209d('0x2')]]);}}}catch(_0x40b876){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0x3c'),_0x3e04f8[_0x209d('0x2')]),_0x40b876);}};exports[_0x209d('0x40')]=function(_0x169a8b){try{if(!_[_0x209d('0x14')](queues[_0x169a8b[_0x209d('0x41')]])){utils[_0x209d('0x15')](util['format'](_0x209d('0x42'),_0x169a8b[_0x209d('0x2')]),_0x169a8b);queues[_0x169a8b[_0x209d('0x41')]]['transfer']=!![];queues[_0x169a8b[_0x209d('0x41')]][_0x209d('0x43')]=_0x209d('0x44');queues[_0x169a8b[_0x209d('0x41')]][_0x209d('0x45')]=_0x169a8b[_0x209d('0x46')];queues[_0x169a8b[_0x209d('0x41')]][_0x209d('0x47')]=_0x169a8b[_0x209d('0x41')];queues[_0x169a8b['transfereeuniqueid']]['queuecallerexitreason']=_0x209d('0x48');utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0x49'),_0x169a8b['uniqueid'],queues[_0x169a8b['transfereeuniqueid']][_0x209d('0x25')],_0x169a8b[_0x209d('0x41')],_0x169a8b['extension']));}}catch(_0x1db7ef){utils[_0x209d('0x13')](util['format'](_0x209d('0x42'),_0x169a8b[_0x209d('0x2')]),_0x1db7ef);}};exports[_0x209d('0x4a')]=function(_0x315457){try{utils[_0x209d('0x15')](util['format'](_0x209d('0x4b'),_0x315457[_0x209d('0x4c')]),_0x315457);if(_0x315457[_0x209d('0x4c')]==_0x315457[_0x209d('0x4d')]){if(!_[_0x209d('0x14')](queues[_0x315457[_0x209d('0x4e')]])){utils[_0x209d('0x0')](util[_0x209d('0xd')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x315457[_0x209d('0x4c')],queues[_0x315457[_0x209d('0x4e')]][_0x209d('0x25')],_0x315457['origtransfererexten']));queues[_0x315457[_0x209d('0x4e')]][_0x209d('0x3d')]=!![];queues[_0x315457[_0x209d('0x4e')]][_0x209d('0x43')]=_0x209d('0x4f');queues[_0x315457[_0x209d('0x4e')]][_0x209d('0x45')]=_0x315457[_0x209d('0x50')];queues[_0x315457['secondtransfererlinkedid']]['transferuniqueid']=_0x315457['origtransfereruniqueid'];queues[_0x315457['secondtransfererlinkedid']][_0x209d('0x6')]='ATTENDEDTRANSFER';}if(!_[_0x209d('0x14')](queues[_0x315457[_0x209d('0x4d')]])){if(_0x315457[_0x209d('0x51')]&&queues[_0x315457[_0x209d('0x51')]]){queues[_0x315457[_0x209d('0x51')]][_0x209d('0x1d')]=0x1;queues[_0x315457[_0x209d('0x41')]]=_[_0x209d('0x52')](queues[_0x315457[_0x209d('0x51')]]);queues[_0x315457[_0x209d('0x41')]][_0x209d('0xb')]=_0x315457[_0x209d('0x53')];queues[_0x315457['transfereeuniqueid']][_0x209d('0x1d')]=0x2;queues[_0x315457['transfereeuniqueid']][_0x209d('0x54')]=queues[_0x315457[_0x209d('0x4e')]][_0x209d('0x54')];queues[_0x315457[_0x209d('0x41')]][_0x209d('0x55')]=queues[_0x315457['secondtransfererlinkedid']]['calleridname'];queues[_0x315457[_0x209d('0x41')]]['queuecallerjoinAt']=utils[_0x209d('0x12')]();queues[_0x315457['transfereeuniqueid']][_0x209d('0x17')]=utils[_0x209d('0x12')]();queues[_0x315457[_0x209d('0x41')]][_0x209d('0x32')]=0x0;queues[_0x315457[_0x209d('0x41')]]['mohtime']=0x0;utils['info'](util[_0x209d('0xd')](_0x209d('0x56'),_0x315457['origtransfereruniqueid'],queues[_0x315457[_0x209d('0x41')]]['name'],queues[_0x315457['transfereeuniqueid']][_0x209d('0x54')],queues[_0x315457[_0x209d('0x41')]][_0x209d('0x55')]));}else{utils[_0x209d('0x0')](util['format'](_0x209d('0x57'),_0x315457[_0x209d('0x4c')],queues[_0x315457[_0x209d('0x4d')]][_0x209d('0x25')],_0x315457['secondtransfererlinkedid']));queues[_0x315457['origtransfererlinkedid']][_0x209d('0xb')]=_0x315457[_0x209d('0x4e')];}}}else if(_0x315457[_0x209d('0x58')]==_0x315457[_0x209d('0x4e')]){if(!_[_0x209d('0x14')](queues[_0x315457['origtransfererlinkedid']])){utils[_0x209d('0x0')](util[_0x209d('0xd')](_0x209d('0x59'),_0x315457[_0x209d('0x4c')],queues[_0x315457['origtransfererlinkedid']][_0x209d('0x25')],_0x315457[_0x209d('0x58')],_0x315457[_0x209d('0x5a')]));queues[_0x315457[_0x209d('0x4d')]]['transfer']=!![];queues[_0x315457['origtransfererlinkedid']][_0x209d('0x43')]='ATTENDED';queues[_0x315457[_0x209d('0x4d')]]['transferexten']=_0x315457['secondtransfererexten'];queues[_0x315457[_0x209d('0x4d')]][_0x209d('0x47')]=_0x315457[_0x209d('0x58')];queues[_0x315457[_0x209d('0x4d')]][_0x209d('0x6')]=_0x209d('0x5b');}if(!_[_0x209d('0x14')](queues[_0x315457['secondtransfererlinkedid']])){if(_0x315457[_0x209d('0x5c')]&&queues[_0x315457[_0x209d('0x5c')]]){queues[_0x315457['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x315457[_0x209d('0x53')]]=_[_0x209d('0x52')](queues[_0x315457[_0x209d('0x5c')]]);queues[_0x315457['transfertargetuniqueid']][_0x209d('0xb')]=_0x315457['transfertargetuniqueid'];queues[_0x315457['transfertargetuniqueid']][_0x209d('0x1d')]=0x2;queues[_0x315457['transfertargetuniqueid']][_0x209d('0x54')]=queues[_0x315457['origtransfererlinkedid']][_0x209d('0x54')];queues[_0x315457[_0x209d('0x53')]][_0x209d('0x55')]=queues[_0x315457[_0x209d('0x4d')]][_0x209d('0x55')];queues[_0x315457[_0x209d('0x53')]][_0x209d('0x34')]=utils[_0x209d('0x12')]();queues[_0x315457[_0x209d('0x53')]][_0x209d('0x17')]=utils[_0x209d('0x12')]();queues[_0x315457['transfertargetuniqueid']][_0x209d('0x32')]=0x0;queues[_0x315457[_0x209d('0x53')]][_0x209d('0x5d')]=0x0;utils['info'](util[_0x209d('0xd')](_0x209d('0x5e'),_0x315457[_0x209d('0x4c')],queues[_0x315457[_0x209d('0x53')]][_0x209d('0x25')],queues[_0x315457[_0x209d('0x53')]][_0x209d('0xb')],queues[_0x315457['transfertargetuniqueid']][_0x209d('0x54')],queues[_0x315457['transfertargetuniqueid']][_0x209d('0x55')]));}else{utils[_0x209d('0x0')](util['format'](_0x209d('0x57'),_0x315457[_0x209d('0x4c')],queues[_0x315457[_0x209d('0x4e')]]['name'],_0x315457[_0x209d('0x4d')]));queues[_0x315457['secondtransfererlinkedid']][_0x209d('0xb')]=_0x315457['origtransfererlinkedid'];}}}}catch(_0x48f8c3){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0x4b'),_0x315457[_0x209d('0x4c')]),_0x48f8c3);}};exports[_0x209d('0x5f')]=function(_0x53993b){try{if(!_[_0x209d('0x14')](queues[_0x53993b['uniqueid']])){utils[_0x209d('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x53993b[_0x209d('0x2')]),_0x53993b);queues[_0x53993b[_0x209d('0x2')]][_0x209d('0x60')]=utils[_0x209d('0x12')]();utils['info'](util[_0x209d('0xd')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x53993b[_0x209d('0x2')],queues[_0x53993b['uniqueid']][_0x209d('0x25')],queues[_0x53993b[_0x209d('0x2')]][_0x209d('0x60')]));}}catch(_0x59e1c8){utils[_0x209d('0x13')](util['format'](_0x209d('0x61'),_0x53993b[_0x209d('0x2')]),_0x59e1c8);}};exports[_0x209d('0x62')]=function(_0x428f14){try{if(!_[_0x209d('0x14')](queues[_0x428f14[_0x209d('0x2')]])){if(!_['isNil'](queues[_0x428f14['uniqueid']]['musiconholdstartAt'])){utils[_0x209d('0x15')](util[_0x209d('0xd')](_0x209d('0x63'),_0x428f14[_0x209d('0x2')]),_0x428f14);queues[_0x428f14[_0x209d('0x2')]][_0x209d('0x5d')]+=utils[_0x209d('0x33')](utils[_0x209d('0x12')](),queues[_0x428f14[_0x209d('0x2')]][_0x209d('0x60')]);utils['info'](util[_0x209d('0xd')](_0x209d('0x64'),_0x428f14[_0x209d('0x2')],queues[_0x428f14[_0x209d('0x2')]][_0x209d('0x25')],queues[_0x428f14['uniqueid']][_0x209d('0x5d')]));delete queues[_0x428f14['uniqueid']][_0x209d('0x60')];}}}catch(_0x3a8114){utils[_0x209d('0x13')](util[_0x209d('0xd')](_0x209d('0x63'),_0x428f14[_0x209d('0x2')]),_0x3a8114);}}; \ No newline at end of file +var _0xe949=['[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe949,0x169));var _0x9e94=function(_0x214f33,_0x286a3e){_0x214f33=_0x214f33-0x0;var _0x35dad1=_0xe949[_0x214f33];return _0x35dad1;};'use strict';var _=require(_0x9e94('0x0'));var util=require(_0x9e94('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x284ccb){utils['info'](util[_0x9e94('0x2')](_0x9e94('0x3'),_0x284ccb[_0x9e94('0x4')],_0x284ccb['channel'],_0x284ccb[_0x9e94('0x5')],_0x284ccb[_0x9e94('0x6')],_0x284ccb[_0x9e94('0x7')],_0x284ccb['accountcode'],_0x284ccb[_0x9e94('0x8')]));if(_0x284ccb['queue']){utils[_0x9e94('0x9')](_0x284ccb[_0x9e94('0x5')])[_0x9e94('0xa')](function(_0x54b87c){if(_0x54b87c){_0x284ccb[_0x9e94('0xb')]=_0x54b87c[_0x9e94('0xb')];}utils['request'](_0x9e94('0xc'),_0x284ccb);});}else{utils[_0x9e94('0xd')]('CreateVoiceQueueReport',_0x284ccb);}if(_0x284ccb[_0x9e94('0xe')]){delete queues[_0x284ccb[_0x9e94('0xe')]];}else{delete queues[_0x284ccb[_0x9e94('0x4')]];}}exports[_0x9e94('0xf')]=function(_0x4323f2){try{utils[_0x9e94('0x10')](util[_0x9e94('0x2')]('[%s][queues][queuecallerjoin]',_0x4323f2['uniqueid']),_0x4323f2);utils[_0x9e94('0x11')](util['format'](_0x9e94('0x12'),_0x4323f2[_0x9e94('0x4')],_0x4323f2['queue'],_0x4323f2[_0x9e94('0x13')]));queues[_0x4323f2[_0x9e94('0x4')]]=_[_0x9e94('0x14')](_0x4323f2,{'originalposition':_0x4323f2['position'],'queuecallerjoinAt':utils[_0x9e94('0x15')](),'mohtime':0x0});}catch(_0xabaf08){utils[_0x9e94('0x16')](util[_0x9e94('0x2')](_0x9e94('0x17'),_0x4323f2[_0x9e94('0x4')]),_0xabaf08);}};exports[_0x9e94('0x18')]=function(_0x58f5d5){try{if(!_['isNil'](queues[_0x58f5d5[_0x9e94('0x4')]])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x19'),_0x58f5d5[_0x9e94('0x4')]),_0x58f5d5);if(queues[_0x58f5d5[_0x9e94('0x4')]]['queuecallerleaveAt']){if(!queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0x1a')]&&!queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0x1b')]){queues[_0x58f5d5['uniqueid']]['queuecallercomplete']=!![];queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0x1c')]=utils[_0x9e94('0x15')]();queues[_0x58f5d5['uniqueid']][_0x9e94('0x8')]=_0x9e94('0x1d');}utils[_0x9e94('0x11')](util[_0x9e94('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x58f5d5['uniqueid'],queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0x1e')],queues[_0x58f5d5[_0x9e94('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x58f5d5[_0x9e94('0x4')]]);}else if(queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0xe')]){utils[_0x9e94('0x11')](util[_0x9e94('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x58f5d5[_0x9e94('0x4')],queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0x1e')],queues[_0x58f5d5[_0x9e94('0x4')]]['transfereduniqueid']));queues[queues[_0x58f5d5['uniqueid']][_0x9e94('0xe')]]=queues[_0x58f5d5[_0x9e94('0x4')]];queues[queues[_0x58f5d5[_0x9e94('0x4')]][_0x9e94('0xe')]][_0x9e94('0x1f')]=0x2;delete queues[_0x58f5d5['uniqueid']];}}}catch(_0x675a11){utils[_0x9e94('0x16')](util['format'](_0x9e94('0x19'),_0x58f5d5[_0x9e94('0x4')]),_0x675a11);}};exports[_0x9e94('0x20')]=function(_0x4f4d7a){try{utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x21'),_0x4f4d7a[_0x9e94('0x4')]),_0x4f4d7a);if(!_[_0x9e94('0x22')](_0x4f4d7a['variable'][_0x9e94('0x23')])&&_0x4f4d7a['value']['toUpperCase']()!==_0x9e94('0x24')){if(!_[_0x9e94('0x22')](queues[_0x4f4d7a[_0x9e94('0x4')]])){queues[_0x4f4d7a['uniqueid']][_0x9e94('0x1a')]=![];queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x25')]=null;queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x1b')]=!![];queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x26')]=utils[_0x9e94('0x15')]();queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x8')]=_0x4f4d7a[_0x9e94('0x27')][_0x9e94('0x28')]();utils['info'](util[_0x9e94('0x2')](_0x9e94('0x29'),_0x4f4d7a[_0x9e94('0x4')],queues[_0x4f4d7a['uniqueid']][_0x9e94('0x1e')],_0x4f4d7a[_0x9e94('0x27')],queues[_0x4f4d7a['uniqueid']][_0x9e94('0x8')]));writeDB(queues[_0x4f4d7a[_0x9e94('0x4')]]);}}else if(!_['isNil'](_0x4f4d7a['variable'][_0x9e94('0x2a')])){if(!_[_0x9e94('0x22')](queues[_0x4f4d7a[_0x9e94('0x4')]])&&!queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x1a')]){queues[_0x4f4d7a['uniqueid']][_0x9e94('0x1a')]=![];queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x25')]=null;queues[_0x4f4d7a[_0x9e94('0x4')]]['queuecallerexit']=!![];queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x26')]=utils['now']();queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x8')]=_0x9e94('0x2b');utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x2c'),_0x4f4d7a['uniqueid'],queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x1e')],_0x4f4d7a[_0x9e94('0x27')],queues[_0x4f4d7a[_0x9e94('0x4')]][_0x9e94('0x8')]));}}}catch(_0x5ae1b2){utils[_0x9e94('0x16')](util[_0x9e94('0x2')](_0x9e94('0x21'),_0x4f4d7a[_0x9e94('0x4')]),_0x5ae1b2);}};exports['queuecallerabandon']=function(_0x28821c){try{if(!_[_0x9e94('0x22')](queues[_0x28821c[_0x9e94('0x4')]])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x2d'),_0x28821c['uniqueid']),_0x28821c);queues[_0x28821c[_0x9e94('0x4')]][_0x9e94('0x1b')]=![];queues[_0x28821c[_0x9e94('0x4')]]['queuecallerexitAt']=null;queues[_0x28821c['uniqueid']]['queuecallerabandon']=!![];queues[_0x28821c[_0x9e94('0x4')]][_0x9e94('0x25')]=utils[_0x9e94('0x15')]();queues[_0x28821c[_0x9e94('0x4')]][_0x9e94('0x8')]='ABANDONED';utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x2e'),_0x28821c['uniqueid'],queues[_0x28821c['uniqueid']][_0x9e94('0x1e')],queues[_0x28821c['uniqueid']]['queuecallerexitreason']));}}catch(_0x4151d4){utils[_0x9e94('0x16')](util[_0x9e94('0x2')]('[%s][queues][queuecallerabandon]',_0x28821c[_0x9e94('0x4')]),_0x4151d4);}};exports['queuecallerleave']=function(_0x2ac2c0){try{if(!_[_0x9e94('0x22')](queues[_0x2ac2c0['uniqueid']])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x2f'),_0x2ac2c0[_0x9e94('0x4')]),_0x2ac2c0);utils['info'](util['format'](_0x9e94('0x30'),_0x2ac2c0[_0x9e94('0x4')],queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x1e')],_0x2ac2c0[_0x9e94('0x31')],_0x2ac2c0[_0x9e94('0x32')]));queues[_0x2ac2c0['uniqueid']][_0x9e94('0x33')]=!![];queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x34')]=utils[_0x9e94('0x15')]();queues[_0x2ac2c0['uniqueid']][_0x9e94('0x35')]=utils['diffTime'](queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x34')],queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x36')]);queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x13')]=_0x2ac2c0[_0x9e94('0x13')];queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x37')]=_0x2ac2c0[_0x9e94('0x37')];queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x31')]=_0x2ac2c0[_0x9e94('0x31')];queues[_0x2ac2c0[_0x9e94('0x4')]][_0x9e94('0x32')]=_0x2ac2c0[_0x9e94('0x32')];}}catch(_0x6f83f3){utils['error'](util[_0x9e94('0x2')](_0x9e94('0x2f'),_0x2ac2c0[_0x9e94('0x4')]),_0x6f83f3);}};exports[_0x9e94('0x38')]=function(_0x3f92fc){try{if(!_[_0x9e94('0x22')](queues[_0x3f92fc['uniqueid']])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x39'),_0x3f92fc[_0x9e94('0x4')]),_0x3f92fc);utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x3a'),_0x3f92fc[_0x9e94('0x4')],queues[_0x3f92fc['uniqueid']][_0x9e94('0x1e')],_0x3f92fc[_0x9e94('0x3b')],_0x3f92fc['destaccountcode']));queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x1a')]=![];queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x1a')]=![];queues[_0x3f92fc['uniqueid']][_0x9e94('0x25')]=null;queues[_0x3f92fc[_0x9e94('0x4')]]['queuecallerexit']=![];queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x8')]=null;queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x26')]=null;queues[_0x3f92fc['uniqueid']][_0x9e94('0x3c')]=!![];queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x3d')]=_0x3f92fc[_0x9e94('0x3e')];queues[_0x3f92fc[_0x9e94('0x4')]][_0x9e94('0x6')]=_0x3f92fc[_0x9e94('0x3b')];}}catch(_0x136b63){utils[_0x9e94('0x16')](util[_0x9e94('0x2')](_0x9e94('0x39'),_0x3f92fc[_0x9e94('0x4')]),_0x136b63);}};exports['agentcomplete']=function(_0x567abd){try{if(!_[_0x9e94('0x22')](queues[_0x567abd['uniqueid']])){if(queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x34')]){utils[_0x9e94('0x10')](util[_0x9e94('0x2')]('[%s][queues][agentcomplete]',_0x567abd[_0x9e94('0x4')]),_0x567abd);queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x1a')]=![];queues[_0x567abd['uniqueid']]['queuecallerabandon']=![];queues[_0x567abd['uniqueid']][_0x9e94('0x25')]=null;queues[_0x567abd['uniqueid']][_0x9e94('0x1b')]=![];queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x26')]=null;queues[_0x567abd[_0x9e94('0x4')]]['assigned']=!![];queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x6')]=_0x567abd['membername'];queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x3f')]=!![];queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x1c')]=utils['now']();if(_0x567abd[_0x9e94('0x40')]==_0x9e94('0x41')){if(!queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x41')]){queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x8')]=_0x9e94('0x42');}}else{queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x8')]=_0x9e94('0x43')+_0x567abd['reason'][_0x9e94('0x28')]();}utils[_0x9e94('0x11')](util['format'](_0x9e94('0x44'),_0x567abd['uniqueid'],queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x1e')],_0x567abd['membername'],queues[_0x567abd[_0x9e94('0x4')]][_0x9e94('0x8')]));writeDB(queues[_0x567abd[_0x9e94('0x4')]]);}}}catch(_0x62d621){utils[_0x9e94('0x16')](util[_0x9e94('0x2')]('[%s][queues][agentcomplete]',_0x567abd[_0x9e94('0x4')]),_0x62d621);}};exports['blindtransfer']=function(_0x292f0b){try{if(!_[_0x9e94('0x22')](queues[_0x292f0b[_0x9e94('0x45')]])){utils['debug'](util[_0x9e94('0x2')](_0x9e94('0x46'),_0x292f0b[_0x9e94('0x4')]),_0x292f0b);queues[_0x292f0b[_0x9e94('0x45')]][_0x9e94('0x41')]=!![];queues[_0x292f0b['transfereeuniqueid']]['transfertype']=_0x9e94('0x47');queues[_0x292f0b[_0x9e94('0x45')]]['transferexten']=_0x292f0b[_0x9e94('0x48')];queues[_0x292f0b['transfereeuniqueid']][_0x9e94('0x49')]=_0x292f0b[_0x9e94('0x45')];queues[_0x292f0b[_0x9e94('0x45')]][_0x9e94('0x8')]='BLINDTRANSFER';utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x4a'),_0x292f0b[_0x9e94('0x4')],queues[_0x292f0b[_0x9e94('0x45')]][_0x9e94('0x1e')],_0x292f0b[_0x9e94('0x45')],_0x292f0b['extension']));}}catch(_0x306a32){utils[_0x9e94('0x16')](util['format']('[%s][queues][blindtransfer]',_0x292f0b['uniqueid']),_0x306a32);}};exports[_0x9e94('0x4b')]=function(_0x501c56){try{utils[_0x9e94('0x10')](util['format'](_0x9e94('0x4c'),_0x501c56['origtransfereruniqueid']),_0x501c56);if(_0x501c56[_0x9e94('0x4d')]==_0x501c56[_0x9e94('0x4e')]){if(!_[_0x9e94('0x22')](queues[_0x501c56['secondtransfererlinkedid']])){utils[_0x9e94('0x11')](util[_0x9e94('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x501c56['origtransfereruniqueid'],queues[_0x501c56[_0x9e94('0x4f')]]['name'],_0x501c56['origtransfererexten']));queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x41')]=!![];queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x50')]=_0x9e94('0x51');queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x52')]=_0x501c56['origtransfererexten'];queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x49')]=_0x501c56[_0x9e94('0x4d')];queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x9e94('0x22')](queues[_0x501c56[_0x9e94('0x4e')]])){if(_0x501c56['transfereelinkedid']&&queues[_0x501c56[_0x9e94('0x53')]]){queues[_0x501c56[_0x9e94('0x53')]][_0x9e94('0x1f')]=0x1;queues[_0x501c56[_0x9e94('0x45')]]=_[_0x9e94('0x54')](queues[_0x501c56[_0x9e94('0x53')]]);queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0xe')]=_0x501c56[_0x9e94('0x55')];queues[_0x501c56['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x7')]=queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x7')];queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x56')]=queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0x56')];queues[_0x501c56['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x9e94('0x15')]();queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x34')]=utils[_0x9e94('0x15')]();queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x35')]=0x0;queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x57')]=0x0;utils[_0x9e94('0x11')](util[_0x9e94('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x501c56[_0x9e94('0x4d')],queues[_0x501c56['transfereeuniqueid']][_0x9e94('0x1e')],queues[_0x501c56[_0x9e94('0x45')]][_0x9e94('0x7')],queues[_0x501c56['transfereeuniqueid']][_0x9e94('0x56')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x501c56[_0x9e94('0x4d')],queues[_0x501c56['origtransfererlinkedid']]['name'],_0x501c56[_0x9e94('0x4f')]));queues[_0x501c56[_0x9e94('0x4e')]]['transfereduniqueid']=_0x501c56[_0x9e94('0x4f')];}}}else if(_0x501c56['secondtransfereruniqueid']==_0x501c56['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x501c56['origtransfererlinkedid']])){utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x58'),_0x501c56['origtransfereruniqueid'],queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x1e')],_0x501c56['secondtransfereruniqueid'],_0x501c56[_0x9e94('0x59')]));queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x41')]=!![];queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x50')]=_0x9e94('0x51');queues[_0x501c56['origtransfererlinkedid']][_0x9e94('0x52')]=_0x501c56[_0x9e94('0x59')];queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x49')]=_0x501c56[_0x9e94('0x5a')];queues[_0x501c56['origtransfererlinkedid']][_0x9e94('0x8')]=_0x9e94('0x5b');}if(!_['isNil'](queues[_0x501c56[_0x9e94('0x4f')]])){if(_0x501c56[_0x9e94('0x5c')]&&queues[_0x501c56[_0x9e94('0x5c')]]){queues[_0x501c56['transfertargetlinkedid']][_0x9e94('0x1f')]=0x1;queues[_0x501c56[_0x9e94('0x55')]]=_['clone'](queues[_0x501c56[_0x9e94('0x5c')]]);queues[_0x501c56[_0x9e94('0x55')]]['transfereduniqueid']=_0x501c56['transfertargetuniqueid'];queues[_0x501c56[_0x9e94('0x55')]]['queuecallerenterreason']=0x2;queues[_0x501c56[_0x9e94('0x55')]]['calleridnum']=queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x7')];queues[_0x501c56[_0x9e94('0x55')]][_0x9e94('0x56')]=queues[_0x501c56[_0x9e94('0x4e')]][_0x9e94('0x56')];queues[_0x501c56['transfertargetuniqueid']][_0x9e94('0x36')]=utils[_0x9e94('0x15')]();queues[_0x501c56[_0x9e94('0x55')]][_0x9e94('0x34')]=utils[_0x9e94('0x15')]();queues[_0x501c56[_0x9e94('0x55')]][_0x9e94('0x35')]=0x0;queues[_0x501c56['transfertargetuniqueid']][_0x9e94('0x57')]=0x0;utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x5d'),_0x501c56[_0x9e94('0x4d')],queues[_0x501c56['transfertargetuniqueid']][_0x9e94('0x1e')],queues[_0x501c56[_0x9e94('0x55')]]['transfereduniqueid'],queues[_0x501c56[_0x9e94('0x55')]]['calleridnum'],queues[_0x501c56[_0x9e94('0x55')]][_0x9e94('0x56')]));}else{utils['info'](util[_0x9e94('0x2')](_0x9e94('0x5e'),_0x501c56[_0x9e94('0x4d')],queues[_0x501c56['secondtransfererlinkedid']][_0x9e94('0x1e')],_0x501c56[_0x9e94('0x4e')]));queues[_0x501c56[_0x9e94('0x4f')]][_0x9e94('0xe')]=_0x501c56[_0x9e94('0x4e')];}}}}catch(_0x2c0748){utils[_0x9e94('0x16')](util['format'](_0x9e94('0x4c'),_0x501c56[_0x9e94('0x4d')]),_0x2c0748);}};exports[_0x9e94('0x5f')]=function(_0x59758c){try{if(!_[_0x9e94('0x22')](queues[_0x59758c[_0x9e94('0x4')]])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')](_0x9e94('0x60'),_0x59758c[_0x9e94('0x4')]),_0x59758c);queues[_0x59758c[_0x9e94('0x4')]]['musiconholdstartAt']=utils[_0x9e94('0x15')]();utils[_0x9e94('0x11')](util[_0x9e94('0x2')](_0x9e94('0x61'),_0x59758c[_0x9e94('0x4')],queues[_0x59758c[_0x9e94('0x4')]]['name'],queues[_0x59758c['uniqueid']][_0x9e94('0x62')]));}}catch(_0x2de3c1){utils[_0x9e94('0x16')](util[_0x9e94('0x2')]('[%s][queues][musiconholdstart]',_0x59758c[_0x9e94('0x4')]),_0x2de3c1);}};exports[_0x9e94('0x63')]=function(_0x345fba){try{if(!_[_0x9e94('0x22')](queues[_0x345fba[_0x9e94('0x4')]])){if(!_[_0x9e94('0x22')](queues[_0x345fba['uniqueid']]['musiconholdstartAt'])){utils[_0x9e94('0x10')](util[_0x9e94('0x2')]('[%s][queues][musiconholdstop]',_0x345fba[_0x9e94('0x4')]),_0x345fba);queues[_0x345fba[_0x9e94('0x4')]][_0x9e94('0x57')]+=utils[_0x9e94('0x64')](utils[_0x9e94('0x15')](),queues[_0x345fba[_0x9e94('0x4')]][_0x9e94('0x62')]);utils[_0x9e94('0x11')](util[_0x9e94('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x345fba['uniqueid'],queues[_0x345fba[_0x9e94('0x4')]][_0x9e94('0x1e')],queues[_0x345fba[_0x9e94('0x4')]][_0x9e94('0x57')]));delete queues[_0x345fba[_0x9e94('0x4')]][_0x9e94('0x62')];}}}catch(_0x1bb9b0){utils[_0x9e94('0x16')](util[_0x9e94('0x2')](_0x9e94('0x65'),_0x345fba['uniqueid']),_0x1bb9b0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index dc1a874..45bcb1a 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 _0x86ba=['[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','blinds','newchannel','debug','linkedid','context','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename'];(function(_0x21f88f,_0x48cfba){var _0x3b9ff5=function(_0x292aee){while(--_0x292aee){_0x21f88f['push'](_0x21f88f['shift']());}};_0x3b9ff5(++_0x48cfba);}(_0x86ba,0xb4));var _0xa86b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x86ba[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa86b('0x0'));var util=require(_0xa86b('0x1'));var utils=require(_0xa86b('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x307aa3){var _0x208983;utils[_0xa86b('0x3')](util[_0xa86b('0x4')](_0xa86b('0x5'),_0x307aa3[_0xa86b('0x6')]));if(transfers['blinds'][_0x307aa3[_0xa86b('0x6')]]){_0x208983=_0x307aa3[_0xa86b('0x6')];_0x307aa3['uniqueid']=transfers['blinds'][_0x307aa3[_0xa86b('0x6')]]['transfereeuniqueid'];}if(_0x307aa3[_0xa86b('0x7')]){utils[_0xa86b('0x8')](_0x307aa3[_0xa86b('0x7')])[_0xa86b('0x9')](function(_0x181912){if(_0x181912){_0x307aa3['membername']=_0x181912[_0xa86b('0xa')];_0x307aa3[_0xa86b('0xb')]=_0x181912['id'];}utils[_0xa86b('0xc')](_0xa86b('0xd'),_0x307aa3);});}else{utils[_0xa86b('0xc')](_0xa86b('0xd'),_0x307aa3);}if(_0x208983)delete transfers[_0xa86b('0xe')][_0x208983];}exports[_0xa86b('0xf')]=function(_0x438f03){try{utils[_0xa86b('0x10')](util[_0xa86b('0x4')]('[%s][recordings][newchannel]',_0x438f03[_0xa86b('0x6')]),_0x438f03);if(_0x438f03[_0xa86b('0x6')]==_0x438f03[_0xa86b('0x11')]){utils[_0xa86b('0x3')](util[_0xa86b('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x438f03[_0xa86b('0x6')],_0x438f03[_0xa86b('0x12')],_0x438f03[_0xa86b('0x13')]));recordings[_0x438f03['uniqueid']]={'uniqueid':_0x438f03['uniqueid'],'accountcode':_0x438f03[_0xa86b('0x7')],'exten':_0x438f03[_0xa86b('0x13')],'context':_0x438f03[_0xa86b('0x12')],'channel':_0x438f03['channel'],'monitors':[]};}}catch(_0x26c06a){utils[_0xa86b('0x14')](util[_0xa86b('0x4')]('[%s][recordings][newchannel]',_0x438f03[_0xa86b('0x6')]),_0x26c06a);}};exports['newstate']=function(_0x190664){try{utils[_0xa86b('0x10')](util[_0xa86b('0x4')](_0xa86b('0x15'),_0x190664[_0xa86b('0x6')]),_0x190664);if(!_[_0xa86b('0x16')](recordings[_0x190664[_0xa86b('0x6')]])&&_0x190664[_0xa86b('0x17')]==0x6){utils[_0xa86b('0x3')](util['format'](_0xa86b('0x18'),_0x190664['uniqueid'],_0x190664[_0xa86b('0x12')],_0x190664[_0xa86b('0x19')]));}else if(!_[_0xa86b('0x16')](recordings[_0x190664['linkedid']])&&_0x190664['channelstate']==0x6&&_0x190664[_0xa86b('0x12')]!='transfer'){utils[_0xa86b('0x3')](util['format'](_0xa86b('0x1a'),_0x190664['uniqueid'],_0x190664['linkedid'],_0x190664[_0xa86b('0x12')],_0x190664[_0xa86b('0x19')]));recordings[_0x190664['linkedid']][_0xa86b('0x7')]=_0x190664[_0xa86b('0x7')];}}catch(_0x71c39){utils['error'](util[_0xa86b('0x4')]('[%s][recordings][newstate]',_0x190664[_0xa86b('0x6')]),_0x71c39);}};exports[_0xa86b('0x1b')]=function(_0x5e6c1a){try{if(!_[_0xa86b('0x16')](_0x5e6c1a[_0xa86b('0x1c')])&&!_[_0xa86b('0x16')](_0x5e6c1a[_0xa86b('0x1c')][_0xa86b('0x1d')])){utils[_0xa86b('0x10')](util[_0xa86b('0x4')](_0xa86b('0x1e'),_0x5e6c1a[_0xa86b('0x6')]),_0x5e6c1a);utils[_0xa86b('0x3')](util[_0xa86b('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5e6c1a[_0xa86b('0x6')],_0x5e6c1a[_0xa86b('0x1c')],_0x5e6c1a[_0xa86b('0x1f')]));if(_[_0xa86b('0x20')](_0x5e6c1a[_0xa86b('0x1f')],_0xa86b('0x21'))){_0x5e6c1a['value']=_0x5e6c1a[_0xa86b('0x1f')][_0xa86b('0x22')](_0xa86b('0x21'),_0xa86b('0x23'));}if(recordings[_0x5e6c1a['linkedid']]){var _0x4936c4=_['find'](recordings[_0x5e6c1a[_0xa86b('0x11')]][_0xa86b('0x24')],{'value':_0x5e6c1a[_0xa86b('0x1f')]});if(_[_0xa86b('0x16')](_0x4936c4)){recordings[_0x5e6c1a[_0xa86b('0x11')]]['monitors'][_0xa86b('0x25')]({'value':_0x5e6c1a[_0xa86b('0x1f')]});}}}}catch(_0x151cd6){utils[_0xa86b('0x14')](util[_0xa86b('0x4')]('[%s][recordings][varset]',_0x5e6c1a['uniqueid']),_0x151cd6);}};exports['hangup']=function(_0x5e1459){try{if(!_['isNil'](recordings[_0x5e1459[_0xa86b('0x6')]])){utils[_0xa86b('0x10')](util['format'](_0xa86b('0x26'),_0x5e1459[_0xa86b('0x6')]),_0x5e1459);utils[_0xa86b('0x3')](util[_0xa86b('0x4')](_0xa86b('0x27'),_0x5e1459['uniqueid'],_0x5e1459[_0xa86b('0x28')],_0x5e1459[_0xa86b('0x29')],_0x5e1459[_0xa86b('0x2a')]));recordings[_0x5e1459['uniqueid']][_0xa86b('0x28')]=_0x5e1459[_0xa86b('0x28')];recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x29')]=_0x5e1459[_0xa86b('0x29')];recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x2b')]=_0x5e1459['connectedlinenum'];recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x2c')]=_0x5e1459[_0xa86b('0x2c')];if(recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x2d')]==_0xa86b('0x2e')&&recordings[_0x5e1459[_0xa86b('0x6')]]['accountcode']){recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x2b')]=recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x7')];recordings[_0x5e1459[_0xa86b('0x6')]][_0xa86b('0x2c')]='';}recordings[_0x5e1459[_0xa86b('0x6')]]['monitors']['forEach'](function(_0x24b79e){var _0x29f620=_[_0xa86b('0x2f')](recordings[_0x5e1459[_0xa86b('0x6')]]);_0x29f620[_0xa86b('0x1f')]=_0x24b79e[_0xa86b('0x1f')];writeDB(_0x29f620);});delete recordings[_0x5e1459[_0xa86b('0x6')]];}}catch(_0x2eaf68){utils[_0xa86b('0x14')](util[_0xa86b('0x4')](_0xa86b('0x26'),_0x5e1459[_0xa86b('0x6')]),_0x2eaf68);}};exports[_0xa86b('0x30')]=function(_0x274d4d){try{if(!_[_0xa86b('0x16')](recordings[_0x274d4d[_0xa86b('0x6')]])){utils[_0xa86b('0x10')](util['format'](_0xa86b('0x31'),_0x274d4d[_0xa86b('0x6')]),_0x274d4d);utils['info'](util[_0xa86b('0x4')](_0xa86b('0x32'),_0x274d4d[_0xa86b('0x6')],_0x274d4d['application'],_0x274d4d[_0xa86b('0x33')]));if(_0x274d4d['application'][_0xa86b('0x34')]()==_0xa86b('0x35')&&_[_0xa86b('0x36')](_0x274d4d['appdata'][_0xa86b('0x34')](),_0xa86b('0x37'))){var _0x29787d=_0x274d4d[_0xa86b('0x33')][_0xa86b('0x38')]('=');var _0x3df7e4=_0x29787d[0x0][_0xa86b('0x39')](_0x29787d[0x0][_0xa86b('0x3a')]('(')+0x1,_0x29787d[0x0][_0xa86b('0x3a')](')'));var _0x3cf605=_0x29787d[0x1];recordings[_0x274d4d[_0xa86b('0x6')]][_0x3df7e4]=_0x3cf605;}}}catch(_0x5511ce){utils[_0xa86b('0x14')](util[_0xa86b('0x4')](_0xa86b('0x31'),_0x274d4d[_0xa86b('0x6')]),_0x5511ce);}};exports['queuecallerjoin']=function(_0x4a18cf){try{if(!_[_0xa86b('0x16')](recordings[_0x4a18cf[_0xa86b('0x6')]])){utils[_0xa86b('0x10')](util[_0xa86b('0x4')](_0xa86b('0x3b'),_0x4a18cf['uniqueid']),_0x4a18cf);utils[_0xa86b('0x3')](util['format'](_0xa86b('0x3c'),_0x4a18cf['uniqueid'],_0x4a18cf[_0xa86b('0x3d')]));recordings[_0x4a18cf[_0xa86b('0x6')]][_0xa86b('0x3d')]=_0x4a18cf[_0xa86b('0x3d')];}}catch(_0x10694b){utils[_0xa86b('0x14')](util[_0xa86b('0x4')](_0xa86b('0x3b'),_0x4a18cf[_0xa86b('0x6')]),_0x10694b);}};exports[_0xa86b('0x3e')]=function(_0x3c6a5d){try{utils['debug'](util[_0xa86b('0x4')](_0xa86b('0x3f'),_0x3c6a5d['uniqueid']),_0x3c6a5d);utils[_0xa86b('0x3')](util[_0xa86b('0x4')](_0xa86b('0x40'),_0x3c6a5d[_0xa86b('0x6')],_0x3c6a5d[_0xa86b('0x41')],_0x3c6a5d['transferercalleridname'],_0x3c6a5d[_0xa86b('0x42')],_0x3c6a5d[_0xa86b('0x43')]));if(recordings[_0x3c6a5d[_0xa86b('0x44')]]&&transfers['blinds'][_0x3c6a5d[_0xa86b('0x44')]]){transfers['blinds'][_0x3c6a5d['transfereruniqueid']][_0xa86b('0x45')]=!![];}}catch(_0x336a09){utils[_0xa86b('0x14')](util['format']('[%s][recordings][blindtransfer]',_0x3c6a5d[_0xa86b('0x6')]),_0x336a09);}}; \ No newline at end of file +var _0xab7b=['util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash'];(function(_0x515ef2,_0x19dfa0){var _0x564aa7=function(_0x1b7fa9){while(--_0x1b7fa9){_0x515ef2['push'](_0x515ef2['shift']());}};_0x564aa7(++_0x19dfa0);}(_0xab7b,0x18b));var _0xbab7=function(_0x100332,_0x4296e1){_0x100332=_0x100332-0x0;var _0x308ffc=_0xab7b[_0x100332];return _0x308ffc;};'use strict';var _=require(_0xbab7('0x0'));var util=require(_0xbab7('0x1'));var utils=require(_0xbab7('0x2'));var transfers=require(_0xbab7('0x3'));var recordings={};function writeDB(_0xbdea72){var _0x218ec6;utils[_0xbab7('0x4')](util[_0xbab7('0x5')](_0xbab7('0x6'),_0xbdea72[_0xbab7('0x7')]));if(transfers[_0xbab7('0x8')][_0xbdea72[_0xbab7('0x7')]]){_0x218ec6=_0xbdea72[_0xbab7('0x7')];_0xbdea72[_0xbab7('0x7')]=transfers[_0xbab7('0x8')][_0xbdea72['uniqueid']][_0xbab7('0x9')];}if(_0xbdea72[_0xbab7('0xa')]){utils[_0xbab7('0xb')](_0xbdea72['accountcode'])['then'](function(_0x35843f){if(_0x35843f){_0xbdea72[_0xbab7('0xc')]=_0x35843f[_0xbab7('0xd')];_0xbdea72[_0xbab7('0xe')]=_0x35843f['id'];}utils[_0xbab7('0xf')]('CreateVoiceRecording',_0xbdea72);});}else{utils[_0xbab7('0xf')](_0xbab7('0x10'),_0xbdea72);}if(_0x218ec6)delete transfers[_0xbab7('0x8')][_0x218ec6];}exports['newchannel']=function(_0x226042){try{utils[_0xbab7('0x11')](util[_0xbab7('0x5')](_0xbab7('0x12'),_0x226042[_0xbab7('0x7')]),_0x226042);if(_0x226042[_0xbab7('0x7')]==_0x226042['linkedid']){utils[_0xbab7('0x4')](util[_0xbab7('0x5')](_0xbab7('0x13'),_0x226042['uniqueid'],_0x226042[_0xbab7('0x14')],_0x226042[_0xbab7('0x15')]));recordings[_0x226042[_0xbab7('0x7')]]={'uniqueid':_0x226042[_0xbab7('0x7')],'accountcode':_0x226042[_0xbab7('0xa')],'exten':_0x226042[_0xbab7('0x15')],'context':_0x226042[_0xbab7('0x14')],'channel':_0x226042[_0xbab7('0x16')],'monitors':[]};}}catch(_0x27f75d){utils[_0xbab7('0x17')](util[_0xbab7('0x5')](_0xbab7('0x12'),_0x226042[_0xbab7('0x7')]),_0x27f75d);}};exports[_0xbab7('0x18')]=function(_0x2753a6){try{utils['debug'](util[_0xbab7('0x5')](_0xbab7('0x19'),_0x2753a6[_0xbab7('0x7')]),_0x2753a6);if(!_['isNil'](recordings[_0x2753a6[_0xbab7('0x7')]])&&_0x2753a6[_0xbab7('0x1a')]==0x6){utils[_0xbab7('0x4')](util[_0xbab7('0x5')](_0xbab7('0x1b'),_0x2753a6[_0xbab7('0x7')],_0x2753a6[_0xbab7('0x14')],_0x2753a6[_0xbab7('0x16')]));}else if(!_[_0xbab7('0x1c')](recordings[_0x2753a6[_0xbab7('0x1d')]])&&_0x2753a6[_0xbab7('0x1a')]==0x6&&_0x2753a6[_0xbab7('0x14')]!='transfer'){utils[_0xbab7('0x4')](util[_0xbab7('0x5')](_0xbab7('0x1e'),_0x2753a6[_0xbab7('0x7')],_0x2753a6[_0xbab7('0x1d')],_0x2753a6[_0xbab7('0x14')],_0x2753a6[_0xbab7('0x16')]));recordings[_0x2753a6[_0xbab7('0x1d')]][_0xbab7('0xa')]=_0x2753a6[_0xbab7('0xa')];}}catch(_0x5778f8){utils['error'](util[_0xbab7('0x5')](_0xbab7('0x19'),_0x2753a6[_0xbab7('0x7')]),_0x5778f8);}};exports[_0xbab7('0x1f')]=function(_0x3bde93){try{if(!_[_0xbab7('0x1c')](_0x3bde93[_0xbab7('0x20')])&&!_[_0xbab7('0x1c')](_0x3bde93[_0xbab7('0x20')]['mixmonitor_filename'])){utils[_0xbab7('0x11')](util[_0xbab7('0x5')](_0xbab7('0x21'),_0x3bde93[_0xbab7('0x7')]),_0x3bde93);utils['info'](util[_0xbab7('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3bde93[_0xbab7('0x7')],_0x3bde93[_0xbab7('0x20')],_0x3bde93['value']));if(_['endsWith'](_0x3bde93[_0xbab7('0x22')],_0xbab7('0x23'))){_0x3bde93[_0xbab7('0x22')]=_0x3bde93[_0xbab7('0x22')][_0xbab7('0x24')](_0xbab7('0x23'),_0xbab7('0x25'));}if(recordings[_0x3bde93[_0xbab7('0x1d')]]){var _0x595294=_[_0xbab7('0x26')](recordings[_0x3bde93[_0xbab7('0x1d')]][_0xbab7('0x27')],{'value':_0x3bde93[_0xbab7('0x22')]});if(_['isNil'](_0x595294)){recordings[_0x3bde93[_0xbab7('0x1d')]][_0xbab7('0x27')][_0xbab7('0x28')]({'value':_0x3bde93[_0xbab7('0x22')]});}}}}catch(_0xaf073){utils[_0xbab7('0x17')](util['format']('[%s][recordings][varset]',_0x3bde93[_0xbab7('0x7')]),_0xaf073);}};exports['hangup']=function(_0x565aba){try{if(!_[_0xbab7('0x1c')](recordings[_0x565aba['uniqueid']])){utils[_0xbab7('0x11')](util[_0xbab7('0x5')](_0xbab7('0x29'),_0x565aba[_0xbab7('0x7')]),_0x565aba);utils[_0xbab7('0x4')](util[_0xbab7('0x5')](_0xbab7('0x2a'),_0x565aba[_0xbab7('0x7')],_0x565aba[_0xbab7('0x2b')],_0x565aba[_0xbab7('0x2c')],_0x565aba['cause-txt']));recordings[_0x565aba[_0xbab7('0x7')]][_0xbab7('0x2b')]=_0x565aba[_0xbab7('0x2b')];recordings[_0x565aba['uniqueid']]['calleridname']=_0x565aba[_0xbab7('0x2c')];recordings[_0x565aba[_0xbab7('0x7')]]['connectedlinenum']=_0x565aba[_0xbab7('0x2d')];recordings[_0x565aba[_0xbab7('0x7')]]['connectedlinename']=_0x565aba[_0xbab7('0x2e')];if(recordings[_0x565aba[_0xbab7('0x7')]][_0xbab7('0x2f')]=='outbound'&&recordings[_0x565aba['uniqueid']]['accountcode']){recordings[_0x565aba[_0xbab7('0x7')]]['connectedlinenum']=recordings[_0x565aba[_0xbab7('0x7')]][_0xbab7('0xa')];recordings[_0x565aba[_0xbab7('0x7')]][_0xbab7('0x2e')]='';}recordings[_0x565aba[_0xbab7('0x7')]][_0xbab7('0x27')]['forEach'](function(_0x27c7ad){var _0x3e9fcc=_[_0xbab7('0x30')](recordings[_0x565aba['uniqueid']]);_0x3e9fcc['value']=_0x27c7ad[_0xbab7('0x22')];writeDB(_0x3e9fcc);});delete recordings[_0x565aba[_0xbab7('0x7')]];}}catch(_0x315d64){utils[_0xbab7('0x17')](util[_0xbab7('0x5')](_0xbab7('0x29'),_0x565aba[_0xbab7('0x7')]),_0x315d64);}};exports[_0xbab7('0x31')]=function(_0x38ebbc){try{if(!_[_0xbab7('0x1c')](recordings[_0x38ebbc[_0xbab7('0x7')]])){utils['debug'](util[_0xbab7('0x5')](_0xbab7('0x32'),_0x38ebbc['uniqueid']),_0x38ebbc);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x38ebbc['uniqueid'],_0x38ebbc[_0xbab7('0x33')],_0x38ebbc['appdata']));if(_0x38ebbc[_0xbab7('0x33')][_0xbab7('0x34')]()=='set'&&_['startsWith'](_0x38ebbc[_0xbab7('0x35')][_0xbab7('0x34')](),_0xbab7('0x36'))){var _0x4144e2=_0x38ebbc[_0xbab7('0x35')][_0xbab7('0x37')]('=');var _0x1d4844=_0x4144e2[0x0]['substring'](_0x4144e2[0x0][_0xbab7('0x38')]('(')+0x1,_0x4144e2[0x0][_0xbab7('0x38')](')'));var _0x5bacb9=_0x4144e2[0x1];recordings[_0x38ebbc['uniqueid']][_0x1d4844]=_0x5bacb9;}}}catch(_0x4933f8){utils[_0xbab7('0x17')](util['format'](_0xbab7('0x32'),_0x38ebbc['uniqueid']),_0x4933f8);}};exports['queuecallerjoin']=function(_0x4581f3){try{if(!_[_0xbab7('0x1c')](recordings[_0x4581f3['uniqueid']])){utils[_0xbab7('0x11')](util['format'](_0xbab7('0x39'),_0x4581f3['uniqueid']),_0x4581f3);utils['info'](util['format'](_0xbab7('0x3a'),_0x4581f3[_0xbab7('0x7')],_0x4581f3[_0xbab7('0x3b')]));recordings[_0x4581f3['uniqueid']]['queue']=_0x4581f3['queue'];}}catch(_0x12c7a8){utils['error'](util[_0xbab7('0x5')](_0xbab7('0x39'),_0x4581f3[_0xbab7('0x7')]),_0x12c7a8);}};exports['blindtransfer']=function(_0x5b9cbb){try{utils[_0xbab7('0x11')](util[_0xbab7('0x5')](_0xbab7('0x3c'),_0x5b9cbb[_0xbab7('0x7')]),_0x5b9cbb);utils[_0xbab7('0x4')](util['format'](_0xbab7('0x3d'),_0x5b9cbb['uniqueid'],_0x5b9cbb[_0xbab7('0x3e')],_0x5b9cbb['transferercalleridname'],_0x5b9cbb[_0xbab7('0x3f')],_0x5b9cbb[_0xbab7('0x40')]));if(recordings[_0x5b9cbb[_0xbab7('0x41')]]&&transfers['blinds'][_0x5b9cbb[_0xbab7('0x41')]]){transfers[_0xbab7('0x8')][_0x5b9cbb['transfereruniqueid']]['recording']=!![];}}catch(_0x4fa814){utils['error'](util[_0xbab7('0x5')]('[%s][recordings][blindtransfer]',_0x5b9cbb[_0xbab7('0x7')]),_0x4fa814);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c930618..5dd1942 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 _0x66b6=['format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x66b6,0xfc));var _0x666b=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x66b6[_0x3c504b];return _0x2e5354;};'use strict';var _=require(_0x666b('0x0'));var util=require(_0x666b('0x1'));var utils=require(_0x666b('0x2'));function writeDB(_0x238b1d){utils[_0x666b('0x3')](util['format'](_0x666b('0x4'),_0x238b1d[_0x666b('0x5')]===_0x666b('0x6')?_0x238b1d['origtransfereruniqueid']:_0x238b1d[_0x666b('0x7')],_0x238b1d[_0x666b('0x5')]));utils['request'](_0x666b('0x8'),_0x238b1d);}exports[_0x666b('0x9')]={};exports[_0x666b('0xa')]=function(_0xa4ffd4){try{utils[_0x666b('0xb')](util[_0x666b('0xc')](_0x666b('0xd'),_0xa4ffd4[_0x666b('0x7')]),_0xa4ffd4);utils[_0x666b('0x3')](util[_0x666b('0xc')](_0x666b('0xe'),_0xa4ffd4[_0x666b('0x7')],_0xa4ffd4['transferercalleridnum'],_0xa4ffd4[_0x666b('0xf')],_0xa4ffd4[_0x666b('0x10')],_0xa4ffd4[_0x666b('0x11')]));_0xa4ffd4[_0x666b('0x5')]=_0x666b('0x12');exports[_0x666b('0x9')][_0xa4ffd4[_0x666b('0x13')]]=_0xa4ffd4;writeDB(_0xa4ffd4);}catch(_0x29887c){utils[_0x666b('0x14')](util[_0x666b('0xc')](_0x666b('0xd'),_0xa4ffd4[_0x666b('0x7')]),_0x29887c);}};exports['attendedtransfer']=function(_0x3b9d11){try{utils[_0x666b('0xb')](util[_0x666b('0xc')](_0x666b('0x15'),_0x3b9d11[_0x666b('0x16')]),_0x3b9d11);utils[_0x666b('0x3')](util[_0x666b('0xc')](_0x666b('0x17'),_0x3b9d11[_0x666b('0x16')],_0x3b9d11[_0x666b('0x18')],_0x3b9d11[_0x666b('0x19')],_0x3b9d11[_0x666b('0x1a')],_0x3b9d11[_0x666b('0x1b')]));_0x3b9d11=_['assign'](_0x3b9d11,{'transfererchannel':_0x3b9d11[_0x666b('0x1c')],'transferercalleridnum':_0x3b9d11[_0x666b('0x18')],'transferercalleridname':_0x3b9d11['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b9d11[_0x666b('0x1d')],'transfererconnectedlinename':_0x3b9d11[_0x666b('0x1e')],'transfereraccountcode':_0x3b9d11['origtransfereraccountcode'],'transferercontext':_0x3b9d11[_0x666b('0x1f')],'transfererexten':_0x3b9d11[_0x666b('0x20')],'transfererlinkedid':_0x3b9d11['origtransfererlinkedid'],'context':_0x3b9d11[_0x666b('0x21')],'extension':_0x3b9d11[_0x666b('0x22')],'type':_0x666b('0x6')});if(_[_0x666b('0x23')](_0x3b9d11[_0x666b('0x24')])){_0x3b9d11=_[_0x666b('0x25')](_0x3b9d11,{'transfereechannel':_0x3b9d11[_0x666b('0x26')],'transfereecalleridnum':_0x3b9d11[_0x666b('0x1a')],'transfereecalleridname':_0x3b9d11['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3b9d11[_0x666b('0x27')],'transfereeconnectedlinename':_0x3b9d11[_0x666b('0x28')],'transfereeaccountcode':_0x3b9d11[_0x666b('0x29')],'transfereecontext':_0x3b9d11[_0x666b('0x2a')],'transfereeexten':_0x3b9d11[_0x666b('0x2b')],'transfereelinkedid':_0x3b9d11['transfertargetlinkedid']});}writeDB(_0x3b9d11);}catch(_0x16ff4e){utils[_0x666b('0x14')](util[_0x666b('0xc')](_0x666b('0x15'),_0x3b9d11[_0x666b('0x16')]),_0x16ff4e);}}; \ No newline at end of file +var _0xfd30=['transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','blinds','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname'];(function(_0x3b25ba,_0x5bb278){var _0x16d05c=function(_0x3b51e1){while(--_0x3b51e1){_0x3b25ba['push'](_0x3b25ba['shift']());}};_0x16d05c(++_0x5bb278);}(_0xfd30,0x14f));var _0x0fd3=function(_0x2cdb3d,_0x1741e1){_0x2cdb3d=_0x2cdb3d-0x0;var _0x391f78=_0xfd30[_0x2cdb3d];return _0x391f78;};'use strict';var _=require(_0x0fd3('0x0'));var util=require(_0x0fd3('0x1'));var utils=require(_0x0fd3('0x2'));function writeDB(_0x14eb4e){utils[_0x0fd3('0x3')](util[_0x0fd3('0x4')](_0x0fd3('0x5'),_0x14eb4e[_0x0fd3('0x6')]==='attended'?_0x14eb4e['origtransfereruniqueid']:_0x14eb4e['uniqueid'],_0x14eb4e['type']));utils[_0x0fd3('0x7')](_0x0fd3('0x8'),_0x14eb4e);}exports[_0x0fd3('0x9')]={};exports['blindtransfer']=function(_0x10b94d){try{utils['debug'](util['format'](_0x0fd3('0xa'),_0x10b94d['uniqueid']),_0x10b94d);utils[_0x0fd3('0x3')](util['format'](_0x0fd3('0xb'),_0x10b94d[_0x0fd3('0xc')],_0x10b94d[_0x0fd3('0xd')],_0x10b94d[_0x0fd3('0xe')],_0x10b94d[_0x0fd3('0xf')],_0x10b94d[_0x0fd3('0x10')]));_0x10b94d[_0x0fd3('0x6')]=_0x0fd3('0x11');exports[_0x0fd3('0x9')][_0x10b94d[_0x0fd3('0x12')]]=_0x10b94d;writeDB(_0x10b94d);}catch(_0x51344d){utils['error'](util['format'](_0x0fd3('0xa'),_0x10b94d[_0x0fd3('0xc')]),_0x51344d);}};exports['attendedtransfer']=function(_0x35d1c0){try{utils[_0x0fd3('0x13')](util[_0x0fd3('0x4')](_0x0fd3('0x14'),_0x35d1c0[_0x0fd3('0x15')]),_0x35d1c0);utils[_0x0fd3('0x3')](util[_0x0fd3('0x4')](_0x0fd3('0x16'),_0x35d1c0[_0x0fd3('0x15')],_0x35d1c0[_0x0fd3('0x17')],_0x35d1c0[_0x0fd3('0x18')],_0x35d1c0[_0x0fd3('0x19')],_0x35d1c0[_0x0fd3('0x1a')]));_0x35d1c0=_[_0x0fd3('0x1b')](_0x35d1c0,{'transfererchannel':_0x35d1c0[_0x0fd3('0x1c')],'transferercalleridnum':_0x35d1c0[_0x0fd3('0x17')],'transferercalleridname':_0x35d1c0['origtransferercalleridname'],'transfererconnectedlinenum':_0x35d1c0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x35d1c0[_0x0fd3('0x1d')],'transfereraccountcode':_0x35d1c0[_0x0fd3('0x1e')],'transferercontext':_0x35d1c0['secondtransferercontext'],'transfererexten':_0x35d1c0[_0x0fd3('0x1f')],'transfererlinkedid':_0x35d1c0[_0x0fd3('0x20')],'context':_0x35d1c0[_0x0fd3('0x21')],'extension':_0x35d1c0['origtransfererexten'],'type':_0x0fd3('0x22')});if(_[_0x0fd3('0x23')](_0x35d1c0[_0x0fd3('0x24')])){_0x35d1c0=_[_0x0fd3('0x1b')](_0x35d1c0,{'transfereechannel':_0x35d1c0[_0x0fd3('0x25')],'transfereecalleridnum':_0x35d1c0[_0x0fd3('0x19')],'transfereecalleridname':_0x35d1c0[_0x0fd3('0x1a')],'transfereeconnectedlinenum':_0x35d1c0[_0x0fd3('0x26')],'transfereeconnectedlinename':_0x35d1c0[_0x0fd3('0x27')],'transfereeaccountcode':_0x35d1c0[_0x0fd3('0x28')],'transfereecontext':_0x35d1c0[_0x0fd3('0x29')],'transfereeexten':_0x35d1c0[_0x0fd3('0x2a')],'transfereelinkedid':_0x35d1c0[_0x0fd3('0x2b')]});}writeDB(_0x35d1c0);}catch(_0x2517f3){utils[_0x0fd3('0x2c')](util[_0x0fd3('0x4')](_0x0fd3('0x14'),_0x35d1c0[_0x0fd3('0x15')]),_0x2517f3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2462f30..1bd3c08 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 _0x9fe7=['[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isBefore','bluebird','jayson/promise','util','http','../../config/logger','xdr','info','debug','inspect','error','request','then','catch','[utils][request]\x20name:%s','internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByName','[utils][getUserByName]','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9fe7,0x1df));var _0x79fe=function(_0x29f587,_0x839db3){_0x29f587=_0x29f587-0x0;var _0x2f84e0=_0x9fe7[_0x29f587];return _0x2f84e0;};'use strict';var BPromise=require(_0x79fe('0x0'));var jayson=require(_0x79fe('0x1'));var moment=require('moment');var util=require(_0x79fe('0x2'));var client=jayson['client'][_0x79fe('0x3')]({'port':0x2329});var logger=require(_0x79fe('0x4'))(_0x79fe('0x5'));exports['info']=function(_0x44c145,_0x627ec4){logger[_0x79fe('0x6')](_0x44c145,_0x627ec4?util['inspect'](_0x627ec4,{'showHidden':![],'depth':null}):'');};exports[_0x79fe('0x7')]=function(_0x2a5aef,_0x2ba246){logger['debug'](_0x2a5aef,_0x2ba246?util[_0x79fe('0x8')](_0x2ba246,{'showHidden':![],'depth':null}):'');};exports[_0x79fe('0x9')]=function(_0x29b317,_0x26d723){logger[_0x79fe('0x9')](_0x29b317,_0x26d723?util['inspect'](_0x26d723,{'showHidden':![],'depth':null}):'');};exports[_0x79fe('0xa')]=function(_0x253f7d,_0x4a3ccf){return client[_0x79fe('0xa')](_0x253f7d,{'body':_0x4a3ccf})[_0x79fe('0xb')](function(_0x33351e){logger[_0x79fe('0x7')]('[utils][request]\x20name:%s',_0x253f7d,_0x33351e?util[_0x79fe('0x8')](_0x33351e,{'showHidden':![],'depth':null}):'');})[_0x79fe('0xc')](function(_0x3e0ad8){logger[_0x79fe('0x9')](_0x79fe('0xd'),_0x253f7d,_0x3e0ad8?util[_0x79fe('0x8')](_0x3e0ad8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x42bbe4){return client[_0x79fe('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x79fe('0xe'),_0x79fe('0xf'),_0x79fe('0x10')],'where':_0x42bbe4,'limit':0x1}})[_0x79fe('0xb')](function(_0x35fb79){logger[_0x79fe('0x7')]('[utils][getUser]\x20where:%s',JSON[_0x79fe('0x11')](_0x42bbe4),_0x35fb79?util[_0x79fe('0x8')](_0x35fb79,{'showHidden':![],'depth':null}):'');return _0x35fb79[_0x79fe('0x12')][_0x79fe('0x13')]?_0x35fb79['result'][0x0]:null;});}exports[_0x79fe('0x14')]=function(_0x16f93a){return new BPromise(function(_0x39be95,_0x40a549){if(_0x16f93a){return getUser({'internal':_0x16f93a})['then'](function(_0x5e2f0b){logger[_0x79fe('0x6')](_0x79fe('0x15'),_0x16f93a,_0x5e2f0b?_0x79fe('0x16'):'notfound');return _0x39be95(_0x5e2f0b);})[_0x79fe('0xc')](function(_0x4141ec){logger[_0x79fe('0x9')]('[utils][getUserByInternal]',_0x4141ec?util[_0x79fe('0x8')](_0x4141ec,{'showHidden':![],'depth':null}):'');return _0x39be95(null);});}return _0x39be95(null);});};exports['getUserByInterface']=function(_0x15f019){return new BPromise(function(_0xde2451,_0x3f1b15){if(_0x15f019){return getUser({'interface':_0x15f019})[_0x79fe('0xb')](function(_0x1ac8d7){logger[_0x79fe('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x15f019,_0x1ac8d7?'found':_0x79fe('0x17'));return _0xde2451(_0x1ac8d7);})['catch'](function(_0x16aa35){logger[_0x79fe('0x9')]('[utils][getUserByInterface]',_0x16aa35?util['inspect'](_0x16aa35,{'showHidden':![],'depth':null}):'');return _0xde2451(null);});}return _0xde2451(null);});};exports[_0x79fe('0x18')]=function(_0x321778){return new BPromise(function(_0x59339b,_0x46d93d){if(_0x321778){return getUser({'name':_0x321778})[_0x79fe('0xb')](function(_0x5c84e0){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x321778,_0x5c84e0?_0x79fe('0x16'):_0x79fe('0x17'));return _0x59339b(_0x5c84e0);})[_0x79fe('0xc')](function(_0x4ac913){logger[_0x79fe('0x9')](_0x79fe('0x19'),_0x4ac913?util[_0x79fe('0x8')](_0x4ac913,{'showHidden':![],'depth':null}):'');return _0x59339b(null);});}return _0x59339b(null);});};exports['getVoiceQueueByName']=function(_0x4e2740){return new BPromise(function(_0x14e055,_0x51200f){if(_0x4e2740){return client[_0x79fe('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x79fe('0x1a')],'where':{'name':_0x4e2740},'limit':0x1}})[_0x79fe('0xb')](function(_0x4dff5f){logger[_0x79fe('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4e2740,_0x4dff5f?util[_0x79fe('0x8')](_0x4dff5f,{'showHidden':![],'depth':null}):'');logger[_0x79fe('0x6')](_0x79fe('0x1b'),_0x4e2740,_0x4dff5f?_0x79fe('0x16'):_0x79fe('0x17'));return _0x14e055(_0x4dff5f['result'][_0x79fe('0x13')]?_0x4dff5f[_0x79fe('0x12')][0x0]:null);})[_0x79fe('0xc')](function(_0x190202){logger[_0x79fe('0x9')](_0x79fe('0x1c'),_0x190202?util['inspect'](_0x190202,{'showHidden':![],'depth':null}):'');return _0x14e055(null);});}return _0x14e055(null);});};exports[_0x79fe('0x1d')]=function(_0x125226,_0x8ddef3){return moment(_0x125226)[_0x79fe('0x1e')](_0x8ddef3,_0x79fe('0x1f'))[_0x79fe('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x79fe('0x21')]=function(_0x5a917f,_0x2bdf83){return moment(_0x5a917f)['subtract'](_0x2bdf83,_0x79fe('0x1f'))['format'](_0x79fe('0x22'));};exports[_0x79fe('0x23')]=function(_0x41177d,_0x4fb6f4){return moment(_0x41177d)[_0x79fe('0x24')](moment(_0x4fb6f4),_0x79fe('0x1f'));};exports[_0x79fe('0x25')]=function(_0x31b9d6,_0x2b203b){return parseInt(_0x31b9d6,0xa)+parseInt(_0x2b203b,0xa);};exports['now']=function(){return moment()['format'](_0x79fe('0x22'));};exports['isAfter']=function(_0x27de50,_0x44d97e){if(_0x44d97e){return moment(_0x27de50)['isAfter'](_0x44d97e);}return!![];};exports[_0x79fe('0x26')]=function(_0x46da71,_0xfa1cc){if(_0xfa1cc){return moment(_0x46da71)[_0x79fe('0x26')](_0xfa1cc);}else if(_0x46da71){return!![];}return![];}; \ No newline at end of file +var _0xe0bb=['util','client','http','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','internal','interface','then','stringify','result','length','getUserByInternal','found','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','moment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe0bb,0x15e));var _0xbe0b=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xe0bb[_0x3daa8c];return _0x2b1bd7;};'use strict';var BPromise=require(_0xbe0b('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbe0b('0x1'));var util=require(_0xbe0b('0x2'));var client=jayson[_0xbe0b('0x3')][_0xbe0b('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xbe0b('0x5'));exports[_0xbe0b('0x6')]=function(_0x545f7c,_0x15e322){logger[_0xbe0b('0x6')](_0x545f7c,_0x15e322?util[_0xbe0b('0x7')](_0x15e322,{'showHidden':![],'depth':null}):'');};exports[_0xbe0b('0x8')]=function(_0x26a8ad,_0x4f2e4f){logger['debug'](_0x26a8ad,_0x4f2e4f?util['inspect'](_0x4f2e4f,{'showHidden':![],'depth':null}):'');};exports[_0xbe0b('0x9')]=function(_0x40f11a,_0x21ce3c){logger[_0xbe0b('0x9')](_0x40f11a,_0x21ce3c?util['inspect'](_0x21ce3c,{'showHidden':![],'depth':null}):'');};exports[_0xbe0b('0xa')]=function(_0x430b78,_0x463bfd){return client[_0xbe0b('0xa')](_0x430b78,{'body':_0x463bfd})['then'](function(_0x4f2fc3){logger[_0xbe0b('0x8')]('[utils][request]\x20name:%s',_0x430b78,_0x4f2fc3?util[_0xbe0b('0x7')](_0x4f2fc3,{'showHidden':![],'depth':null}):'');})[_0xbe0b('0xb')](function(_0x2b762b){logger['error'](_0xbe0b('0xc'),_0x430b78,_0x2b762b?util[_0xbe0b('0x7')](_0x2b762b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x232f45){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbe0b('0xd'),'name',_0xbe0b('0xe')],'where':_0x232f45,'limit':0x1}})[_0xbe0b('0xf')](function(_0x552bd8){logger[_0xbe0b('0x8')]('[utils][getUser]\x20where:%s',JSON[_0xbe0b('0x10')](_0x232f45),_0x552bd8?util[_0xbe0b('0x7')](_0x552bd8,{'showHidden':![],'depth':null}):'');return _0x552bd8[_0xbe0b('0x11')][_0xbe0b('0x12')]?_0x552bd8[_0xbe0b('0x11')][0x0]:null;});}exports[_0xbe0b('0x13')]=function(_0x53238b){return new BPromise(function(_0xdf12d8,_0x4ab055){if(_0x53238b){return getUser({'internal':_0x53238b})[_0xbe0b('0xf')](function(_0x37ce95){logger[_0xbe0b('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x53238b,_0x37ce95?_0xbe0b('0x14'):'notfound');return _0xdf12d8(_0x37ce95);})[_0xbe0b('0xb')](function(_0x538634){logger[_0xbe0b('0x9')]('[utils][getUserByInternal]',_0x538634?util[_0xbe0b('0x7')](_0x538634,{'showHidden':![],'depth':null}):'');return _0xdf12d8(null);});}return _0xdf12d8(null);});};exports['getUserByInterface']=function(_0x14229f){return new BPromise(function(_0x19034c,_0x3ec714){if(_0x14229f){return getUser({'interface':_0x14229f})[_0xbe0b('0xf')](function(_0x318710){logger[_0xbe0b('0x6')](_0xbe0b('0x15'),_0x14229f,_0x318710?_0xbe0b('0x14'):_0xbe0b('0x16'));return _0x19034c(_0x318710);})[_0xbe0b('0xb')](function(_0x7b0b1){logger[_0xbe0b('0x9')](_0xbe0b('0x17'),_0x7b0b1?util[_0xbe0b('0x7')](_0x7b0b1,{'showHidden':![],'depth':null}):'');return _0x19034c(null);});}return _0x19034c(null);});};exports[_0xbe0b('0x18')]=function(_0x8c9d7a){return new BPromise(function(_0x1ac7b6,_0x442237){if(_0x8c9d7a){return getUser({'name':_0x8c9d7a})[_0xbe0b('0xf')](function(_0x403c3f){logger[_0xbe0b('0x6')](_0xbe0b('0x19'),_0x8c9d7a,_0x403c3f?_0xbe0b('0x14'):'notfound');return _0x1ac7b6(_0x403c3f);})[_0xbe0b('0xb')](function(_0x7cecce){logger[_0xbe0b('0x9')](_0xbe0b('0x1a'),_0x7cecce?util[_0xbe0b('0x7')](_0x7cecce,{'showHidden':![],'depth':null}):'');return _0x1ac7b6(null);});}return _0x1ac7b6(null);});};exports['getVoiceQueueByName']=function(_0x716d56){return new BPromise(function(_0x2aceae,_0x193e5e){if(_0x716d56){return client['request'](_0xbe0b('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xbe0b('0x1c'),'type',_0xbe0b('0x1d'),_0xbe0b('0x1e')],'where':{'name':_0x716d56},'limit':0x1}})['then'](function(_0x21b89a){logger[_0xbe0b('0x8')](_0xbe0b('0x1f'),_0x716d56,_0x21b89a?util[_0xbe0b('0x7')](_0x21b89a,{'showHidden':![],'depth':null}):'');logger[_0xbe0b('0x6')](_0xbe0b('0x20'),_0x716d56,_0x21b89a?_0xbe0b('0x14'):'notfound');return _0x2aceae(_0x21b89a[_0xbe0b('0x11')][_0xbe0b('0x12')]?_0x21b89a[_0xbe0b('0x11')][0x0]:null);})[_0xbe0b('0xb')](function(_0x48267c){logger[_0xbe0b('0x9')](_0xbe0b('0x21'),_0x48267c?util[_0xbe0b('0x7')](_0x48267c,{'showHidden':![],'depth':null}):'');return _0x2aceae(null);});}return _0x2aceae(null);});};exports[_0xbe0b('0x22')]=function(_0x524530,_0x407986){return moment(_0x524530)[_0xbe0b('0x23')](_0x407986,_0xbe0b('0x24'))['format'](_0xbe0b('0x25'));};exports[_0xbe0b('0x26')]=function(_0x11e4d3,_0x361c77){return moment(_0x11e4d3)[_0xbe0b('0x27')](_0x361c77,_0xbe0b('0x24'))['format'](_0xbe0b('0x25'));};exports[_0xbe0b('0x28')]=function(_0x736bb2,_0x206211){return moment(_0x736bb2)['diff'](moment(_0x206211),_0xbe0b('0x24'));};exports[_0xbe0b('0x29')]=function(_0x5a0233,_0x111b9a){return parseInt(_0x5a0233,0xa)+parseInt(_0x111b9a,0xa);};exports['now']=function(){return moment()['format'](_0xbe0b('0x25'));};exports[_0xbe0b('0x2a')]=function(_0xcd9eec,_0x588bde){if(_0x588bde){return moment(_0xcd9eec)['isAfter'](_0x588bde);}return!![];};exports[_0xbe0b('0x2b')]=function(_0x46bc77,_0x342758){if(_0x342758){return moment(_0x46bc77)['isBefore'](_0x342758);}else if(_0x46bc77){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 559e6fc..76a04d2 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e86=['inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','role','other','agent_name','setupLoggers','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','name','ensureDir','log','user','then','no-user','timestamp','catch','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x6e86,0x1d5));var _0x66e8=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x6e86[_0x447ef1];return _0x3d72ec;};var fs=require('fs-extra');var _=require(_0x66e8('0x0'));var ewinston=require(_0x66e8('0x1'));var path=require(_0x66e8('0x2'));var util=require(_0x66e8('0x3'));var fileLogger=require(_0x66e8('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x66e8('0x5')];var maskSensitiveData=require(_0x66e8('0x6'))[_0x66e8('0x7')];function ClientSideLogger(){function _0x1d275e(_0x5a4db7){var _0x265eec=path[_0x66e8('0x8')](_0x66e8('0x9'),'log',_0x66e8('0xa'));var _0x105415=path[_0x66e8('0x8')](_0x66e8('0xb'),_0x5a4db7['role']+'-'+_0x5a4db7[_0x66e8('0xc')]);return fs[_0x66e8('0xd')](path[_0x66e8('0x8')](_0x265eec,_0x105415))['then'](function(){var _0x2bd8c8=fileLogger(_0x66e8('0xb'),path[_0x66e8('0x8')](_0x265eec,_0x105415));return _0x2bd8c8;})['catch'](function(_0x336131){throw _0x336131;});}this[_0x66e8('0xe')]=function(_0x55c9f0,_0x51dd90,_0x323414,_0x3233a3){return _0x1d275e(_0x55c9f0[_0x66e8('0xf')])[_0x66e8('0x10')](function(_0x3d4592){var _0x4ed308=_0x3d4592[_0x51dd90];return _0x4ed308;})[_0x66e8('0x10')](function(_0x5e399f){var _0x27814c=_0x55c9f0['user']?_0x55c9f0[_0x66e8('0xf')]['id']:_0x66e8('0x11');var _0x41eb7d=_0x3233a3['data'];var _0x40008e=_0x3233a3[_0x66e8('0x12')];var _0x188d3c=new Date(Number(_0x40008e));return _0x5e399f(_0x27814c,_0x188d3c,_0x323414,_0x41eb7d);})[_0x66e8('0x13')](function(_0x4a8288){fileLogger(_0x66e8('0xb'))[_0x66e8('0x14')](_0x4a8288);});};}function setupLoggers(_0x11c321){return new Promise(function(_0x427f0e){var _0x572ff2=new ClientSideLogger();var _0xcde583=fileLogger('api');var _0x17f9f5=fileLogger(_0x66e8('0x15'));_0x11c321[_0x66e8('0x16')]('client-side-logger',_0x572ff2);_0x11c321[_0x66e8('0x17')](ewinston[_0x66e8('0x18')]({'winstonInstance':_0xcde583,'meta':![],'statusLevels':!![],'msg':function(_0x317012,_0x202ece){var _0x4b2e14=_0x66e8('0x19');if(!_[_0x66e8('0x1a')](_0x317012[_0x66e8('0x1b')])){_0x4b2e14+=_0x66e8('0x1c');var _0x1e848e=_0x317012[_0x66e8('0x1b')];maskSensitiveData(_0x1e848e);}return safeTemplate(util['format'](_0x4b2e14,_0x317012[_0x66e8('0x1d')],_0x317012[_0x66e8('0x1e')][_0x66e8('0x1f')]?_0x317012[_0x66e8('0x1e')][_0x66e8('0x1f')]:_0x317012[_0x66e8('0x20')][_0x66e8('0x21')]||_0x317012['ip'],_0x317012[_0x66e8('0x22')],_0x202ece[_0x66e8('0x23')],_0x202ece[_0x66e8('0x24')],_0x317012[_0x66e8('0xf')]?_0x317012[_0x66e8('0xf')]['id']:null,_0x317012['user']?_0x317012[_0x66e8('0xf')][_0x66e8('0xc')]:null,_0x317012[_0x66e8('0xf')]?_0x317012[_0x66e8('0xf')]['role']:null,_0x1e848e?util[_0x66e8('0x25')](_0x1e848e,![],null):''));}}));_0x11c321['use'](ewinston[_0x66e8('0x18')]({'winstonInstance':_0x17f9f5,'meta':![],'statusLevels':!![],'msg':function(_0x1ab6aa,_0x1be6c9){var _0xc55415=_0x66e8('0x26');if(_0x1ab6aa[_0x66e8('0x1b')]&&_0x1ab6aa[_0x66e8('0x1b')][_0x66e8('0x27')]&&_0x1ab6aa[_0x66e8('0x1b')][_0x66e8('0x28')]){_0xc55415='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x66e8('0x29')](_0xc55415,_0x1ab6aa['method'],_0x1ab6aa[_0x66e8('0x1e')][_0x66e8('0x1f')]?_0x1ab6aa[_0x66e8('0x1e')][_0x66e8('0x1f')]:_0x1ab6aa[_0x66e8('0x20')][_0x66e8('0x21')]||_0x1ab6aa['ip'],_0x1ab6aa[_0x66e8('0x22')],_0x1be6c9[_0x66e8('0x23')],_0x1be6c9[_0x66e8('0x24')],_0x1ab6aa[_0x66e8('0xf')]?_0x1ab6aa[_0x66e8('0xf')]['id']:null,_0x1ab6aa[_0x66e8('0xf')]?_0x1ab6aa[_0x66e8('0xf')][_0x66e8('0xc')]:null,_0x1ab6aa[_0x66e8('0xf')]?_0x1ab6aa[_0x66e8('0xf')][_0x66e8('0x2a')]:null,_0x1ab6aa[_0x66e8('0x1b')]&&_0x1ab6aa[_0x66e8('0x1b')]['device']?_0x1ab6aa['body'][_0x66e8('0x27')]:_0x66e8('0x2b'),_0x1ab6aa[_0x66e8('0x1b')]&&_0x1ab6aa[_0x66e8('0x1b')][_0x66e8('0x28')]?_0x1ab6aa[_0x66e8('0x1b')][_0x66e8('0x28')]:'',_0x1ab6aa[_0x66e8('0x1b')]&&_0x1ab6aa['body'][_0x66e8('0x2c')]?_0x1ab6aa[_0x66e8('0x1b')][_0x66e8('0x2c')]:'');},'ignoreRoute':function(_0x5d2e90){var _0x67b2e9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x67b2e9['test'](_0x5d2e90[_0x66e8('0x22')]);}}));return _0x427f0e();});}exports[_0x66e8('0x2d')]=setupLoggers; \ No newline at end of file +var _0x9565=['setupLoggers','fs-extra','lodash','express-winston','path','util','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','name','then','user','data','timestamp','error','auth','client-side-logger','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','responseTime','role','inspect','device','agent_id','format','method','other','agent_name','test'];(function(_0x45b3eb,_0x3f68ba){var _0x42404d=function(_0x3516b5){while(--_0x3516b5){_0x45b3eb['push'](_0x45b3eb['shift']());}};_0x42404d(++_0x3f68ba);}(_0x9565,0xd3));var _0x5956=function(_0x1b963c,_0x163bed){_0x1b963c=_0x1b963c-0x0;var _0x3b14ea=_0x9565[_0x1b963c];return _0x3b14ea;};var fs=require(_0x5956('0x0'));var _=require(_0x5956('0x1'));var ewinston=require(_0x5956('0x2'));var path=require(_0x5956('0x3'));var util=require(_0x5956('0x4'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require('./safe-template')[_0x5956('0x5')];var maskSensitiveData=require(_0x5956('0x6'))[_0x5956('0x7')];function ClientSideLogger(){function _0x3c9931(_0x1a02fc){var _0x4da625=path[_0x5956('0x8')](_0x5956('0x9'),_0x5956('0xa'),'xcally');var _0x479893=path[_0x5956('0x8')](_0x5956('0xb'),_0x1a02fc['role']+'-'+_0x1a02fc[_0x5956('0xc')]);return fs['ensureDir'](path[_0x5956('0x8')](_0x4da625,_0x479893))[_0x5956('0xd')](function(){var _0x545b64=fileLogger('client',path[_0x5956('0x8')](_0x4da625,_0x479893));return _0x545b64;})['catch'](function(_0x13a0f5){throw _0x13a0f5;});}this[_0x5956('0xa')]=function(_0x287e57,_0x3685dc,_0x533f70,_0x556eda){return _0x3c9931(_0x287e57[_0x5956('0xe')])['then'](function(_0x9d72de){var _0x14d0f7=_0x9d72de[_0x3685dc];return _0x14d0f7;})[_0x5956('0xd')](function(_0x53aa58){var _0xa1485b=_0x287e57['user']?_0x287e57[_0x5956('0xe')]['id']:'no-user';var _0x43aebc=_0x556eda[_0x5956('0xf')];var _0x5edeaa=_0x556eda[_0x5956('0x10')];var _0x4929d1=new Date(Number(_0x5edeaa));return _0x53aa58(_0xa1485b,_0x4929d1,_0x533f70,_0x43aebc);})['catch'](function(_0x22039b){fileLogger(_0x5956('0xb'))[_0x5956('0x11')](_0x22039b);});};}function setupLoggers(_0x5edaf2){return new Promise(function(_0x8588fa){var _0x43429=new ClientSideLogger();var _0x775b74=fileLogger('api');var _0x48ea3f=fileLogger(_0x5956('0x12'));_0x5edaf2['set'](_0x5956('0x13'),_0x43429);_0x5edaf2['use'](ewinston[_0x5956('0x14')]({'winstonInstance':_0x775b74,'meta':![],'statusLevels':!![],'msg':function(_0x4ae101,_0x526006){var _0x2fab78=_0x5956('0x15');if(!_[_0x5956('0x16')](_0x4ae101[_0x5956('0x17')])){_0x2fab78+=_0x5956('0x18');var _0x15426c=_0x4ae101[_0x5956('0x17')];maskSensitiveData(_0x15426c);}return safeTemplate(util['format'](_0x2fab78,_0x4ae101['method'],_0x4ae101[_0x5956('0x19')][_0x5956('0x1a')]?_0x4ae101[_0x5956('0x19')]['x-forwarded-for']:_0x4ae101[_0x5956('0x1b')][_0x5956('0x1c')]||_0x4ae101['ip'],_0x4ae101[_0x5956('0x1d')],_0x526006[_0x5956('0x1e')],_0x526006[_0x5956('0x1f')],_0x4ae101[_0x5956('0xe')]?_0x4ae101[_0x5956('0xe')]['id']:null,_0x4ae101[_0x5956('0xe')]?_0x4ae101['user'][_0x5956('0xc')]:null,_0x4ae101[_0x5956('0xe')]?_0x4ae101[_0x5956('0xe')][_0x5956('0x20')]:null,_0x15426c?util[_0x5956('0x21')](_0x15426c,![],null):''));}}));_0x5edaf2['use'](ewinston[_0x5956('0x14')]({'winstonInstance':_0x48ea3f,'meta':![],'statusLevels':!![],'msg':function(_0xc4a47d,_0x2c2caf){var _0xb57d0b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xc4a47d['body']&&_0xc4a47d[_0x5956('0x17')][_0x5956('0x22')]&&_0xc4a47d[_0x5956('0x17')][_0x5956('0x23')]){_0xb57d0b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x5956('0x24')](_0xb57d0b,_0xc4a47d[_0x5956('0x25')],_0xc4a47d[_0x5956('0x19')]['x-forwarded-for']?_0xc4a47d[_0x5956('0x19')]['x-forwarded-for']:_0xc4a47d[_0x5956('0x1b')][_0x5956('0x1c')]||_0xc4a47d['ip'],_0xc4a47d[_0x5956('0x1d')],_0x2c2caf['statusCode'],_0x2c2caf['responseTime'],_0xc4a47d[_0x5956('0xe')]?_0xc4a47d['user']['id']:null,_0xc4a47d['user']?_0xc4a47d[_0x5956('0xe')][_0x5956('0xc')]:null,_0xc4a47d[_0x5956('0xe')]?_0xc4a47d[_0x5956('0xe')][_0x5956('0x20')]:null,_0xc4a47d['body']&&_0xc4a47d[_0x5956('0x17')]['device']?_0xc4a47d[_0x5956('0x17')]['device']:_0x5956('0x26'),_0xc4a47d[_0x5956('0x17')]&&_0xc4a47d[_0x5956('0x17')][_0x5956('0x23')]?_0xc4a47d[_0x5956('0x17')]['agent_id']:'',_0xc4a47d[_0x5956('0x17')]&&_0xc4a47d[_0x5956('0x17')][_0x5956('0x27')]?_0xc4a47d['body'][_0x5956('0x27')]:'');},'ignoreRoute':function(_0x2cb1f8){var _0x48e6ef=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x48e6ef[_0x5956('0x28')](_0x2cb1f8[_0x5956('0x1d')]);}}));return _0x8588fa();});}exports[_0x5956('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index a50399b..77ad9ac 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb54b=['stringify','Logger','transports','Console','warn','File','error','%s-%s','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','format','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0xb54b,0x14d));var _0xbb54=function(_0x54750c,_0x5759fe){_0x54750c=_0x54750c-0x0;var _0xf85c39=_0xb54b[_0x54750c];return _0xf85c39;};'use strict';var path=require(_0xbb54('0x0'));var util=require(_0xbb54('0x1'));var moment=require(_0xbb54('0x2'));var winston=require(_0xbb54('0x3'));var config=require(_0xbb54('0x4'));var debugLevel=config[_0xbb54('0x5')]?config['debugLevel']['toLowerCase']():_0xbb54('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xbb54('0x7'),'error':'red','warn':'bold\x20yellow','info':_0xbb54('0x8'),'print':_0xbb54('0x9'),'success':_0xbb54('0xa'),'http':_0xbb54('0xb'),'verbose':_0xbb54('0xc'),'debug':_0xbb54('0xd'),'silly':_0xbb54('0xe')};winston[_0xbb54('0xf')](XC_LOG_COLORS);function getLogFileName(_0x3d6bc6,_0xddd395,_0x2620ab){var _0x38c539=_0x3d6bc6||'/var/log/xcally';return path['join'](_0x38c539,util[_0xbb54('0x10')]('%s-%s.log',_0xddd395,_0x2620ab));}function formatter(_0x209093,_0x71ae74){_0x71ae74[_0xbb54('0x11')]=_0x71ae74[_0xbb54('0x11')][_0xbb54('0x12')](/@@{/g,_0xbb54('0x13'))['replace'](/}@@/g,'}}}')[_0xbb54('0x12')](/@{/g,'{{')[_0xbb54('0x12')](/}@/g,'}}');return util[_0xbb54('0x10')](_0xbb54('0x14'),moment()[_0xbb54('0x10')](_0xbb54('0x15')),_0x71ae74[_0xbb54('0x16')][_0xbb54('0x17')](),_0x209093,_0x71ae74['message']);}function fileFormat(_0x4e841f,_0x566048){_0x566048[_0xbb54('0x11')]=_0x566048[_0xbb54('0x11')][_0xbb54('0x12')](/@@{/g,_0xbb54('0x13'))[_0xbb54('0x12')](/}@@/g,_0xbb54('0x18'))[_0xbb54('0x12')](/@{/g,'{{')[_0xbb54('0x12')](/}@/g,'}}');var _0x16b280=_0x566048[_0xbb54('0x19')]&&Object[_0xbb54('0x1a')](_0x566048['meta'])['length']?'\x0a\x09'+JSON[_0xbb54('0x1b')](_0x566048[_0xbb54('0x19')]):'';return util[_0xbb54('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xbb54('0x15')),_0x566048[_0xbb54('0x16')][_0xbb54('0x17')](),_0x4e841f,_0x566048[_0xbb54('0x11')],_0x16b280);}function consoleLogger(){var _0x3afc26=new winston[(_0xbb54('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbb54('0x1d'))][(_0xbb54('0x1e'))]({'level':_0xbb54('0x1f'),'json':![],'formatter':function(_0x281802){return formatter('',_0x281802);}})]});return _0x3afc26;}function fileLogger(_0x2d2891,_0x452ba9){var _0x1ab576=new winston[(_0xbb54('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbb54('0x1d'))][(_0xbb54('0x20'))]({'name':util[_0xbb54('0x10')]('%s-%s',_0x2d2891,_0xbb54('0x21')),'filename':getLogFileName(_0x452ba9,_0x2d2891,'error'),'level':_0xbb54('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5752b9){return fileFormat(_0x2d2891,_0x5752b9);}}),new winston[(_0xbb54('0x1d'))][(_0xbb54('0x20'))]({'name':util['format'](_0xbb54('0x22'),_0x2d2891,debugLevel),'filename':getLogFileName(_0x452ba9,_0x2d2891,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a6544){return fileFormat(_0x2d2891,_0x5a6544);}}),new winston['transports'][(_0xbb54('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x3bdf8d){return fileFormat(_0x2d2891,_0x3bdf8d);}})]});return _0x1ab576;}exports['consoleLogger']=consoleLogger;exports[_0xbb54('0x23')]=fileLogger; \ No newline at end of file +var _0x6264=['debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','addColors','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','%s-%s','error','File','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment'];(function(_0x91288,_0x153cb6){var _0x170cde=function(_0x142e11){while(--_0x142e11){_0x91288['push'](_0x91288['shift']());}};_0x170cde(++_0x153cb6);}(_0x6264,0x177));var _0x4626=function(_0x5d31e4,_0x2775e0){_0x5d31e4=_0x5d31e4-0x0;var _0xad568d=_0x6264[_0x5d31e4];return _0xad568d;};'use strict';var path=require(_0x4626('0x0'));var util=require(_0x4626('0x1'));var moment=require(_0x4626('0x2'));var winston=require(_0x4626('0x3'));var config=require(_0x4626('0x4'));var debugLevel=config[_0x4626('0x5')]?config[_0x4626('0x5')][_0x4626('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x4626('0x7'),'error':_0x4626('0x8'),'warn':_0x4626('0x9'),'info':_0x4626('0xa'),'print':_0x4626('0xb'),'success':'bold\x20green','http':_0x4626('0xc'),'verbose':_0x4626('0xd'),'debug':_0x4626('0xe'),'silly':'bold\x20cyan'};winston[_0x4626('0xf')](XC_LOG_COLORS);function getLogFileName(_0x55806e,_0x9cea04,_0x11990f){var _0x156012=_0x55806e||'/var/log/xcally';return path[_0x4626('0x10')](_0x156012,util[_0x4626('0x11')](_0x4626('0x12'),_0x9cea04,_0x11990f));}function formatter(_0x63eac5,_0x4cc4df){_0x4cc4df[_0x4626('0x13')]=_0x4cc4df[_0x4626('0x13')]['replace'](/@@{/g,_0x4626('0x14'))[_0x4626('0x15')](/}@@/g,_0x4626('0x16'))[_0x4626('0x15')](/@{/g,'{{')[_0x4626('0x15')](/}@/g,'}}');return util[_0x4626('0x11')](_0x4626('0x17'),moment()[_0x4626('0x11')](_0x4626('0x18')),_0x4cc4df['level']['toUpperCase'](),_0x63eac5,_0x4cc4df['message']);}function fileFormat(_0x875f07,_0x46bd0d){_0x46bd0d[_0x4626('0x13')]=_0x46bd0d[_0x4626('0x13')]['replace'](/@@{/g,_0x4626('0x14'))['replace'](/}@@/g,_0x4626('0x16'))[_0x4626('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x15d1e4=_0x46bd0d['meta']&&Object['keys'](_0x46bd0d['meta'])[_0x4626('0x19')]?'\x0a\x09'+JSON[_0x4626('0x1a')](_0x46bd0d['meta']):'';return util[_0x4626('0x11')](_0x4626('0x1b'),moment()[_0x4626('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x46bd0d['level'][_0x4626('0x1c')](),_0x875f07,_0x46bd0d[_0x4626('0x13')],_0x15d1e4);}function consoleLogger(){var _0x1d07cc=new winston[(_0x4626('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4626('0x1e'))][(_0x4626('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x1f3370){return formatter('',_0x1f3370);}})]});return _0x1d07cc;}function fileLogger(_0x2fd71e,_0x753de1){var _0x2303fb=new winston[(_0x4626('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4626('0x1e'))]['File']({'name':util[_0x4626('0x11')](_0x4626('0x20'),_0x2fd71e,_0x4626('0x21')),'filename':getLogFileName(_0x753de1,_0x2fd71e,_0x4626('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a66c4){return fileFormat(_0x2fd71e,_0x4a66c4);}}),new winston[(_0x4626('0x1e'))][(_0x4626('0x22'))]({'name':util['format'](_0x4626('0x20'),_0x2fd71e,debugLevel),'filename':getLogFileName(_0x753de1,_0x2fd71e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a937d){return fileFormat(_0x2fd71e,_0x5a937d);}}),new winston[(_0x4626('0x1e'))][(_0x4626('0x1f'))]({'level':_0x4626('0x23'),'json':![],'formatter':function(_0x5c688e){return fileFormat(_0x2fd71e,_0x5c688e);}})]});return _0x2303fb;}exports[_0x4626('0x24')]=consoleLogger;exports[_0x4626('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9a92f17..3394c3e 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdb28,0x106));var _0x8db2=function(_0x3dec2b,_0x25424c){_0x3dec2b=_0x3dec2b-0x0;var _0x38ad85=_0xdb28[_0x3dec2b];return _0x38ad85;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x27f833,_0x41253f){var _0x38e0e4=function(_0x53c679){while(--_0x53c679){_0x27f833['push'](_0x27f833['shift']());}};_0x38e0e4(++_0x41253f);}(_0x66fa,0x117));var _0xa66f=function(_0x297cf9,_0x11f265){_0x297cf9=_0x297cf9-0x0;var _0x1a51f7=_0x66fa[_0x297cf9];return _0x1a51f7;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 542f41f..148bbb1 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xda2d,0x102));var _0xdda2=function(_0x4b7f21,_0xd216c5){_0x4b7f21=_0x4b7f21-0x0;var _0x11762f=_0xda2d[_0x4b7f21];return _0x11762f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file +var _0x6cb4=['keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x1987e7,_0x5e8613){var _0x141433=function(_0x5cfabf){while(--_0x5cfabf){_0x1987e7['push'](_0x1987e7['shift']());}};_0x141433(++_0x5e8613);}(_0x6cb4,0xff));var _0x46cb=function(_0x185744,_0x47c221){_0x185744=_0x185744-0x0;var _0x3954c5=_0x6cb4[_0x185744];return _0x3954c5;};var _=require(_0x46cb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x338f2b){return _0x338f2b==='{{'?_0x46cb('0x1'):_0x46cb('0x2');}function safeTemplate(_0x375bef){var _0x36add6=_0x375bef;if(typeof _0x375bef===_0x46cb('0x3')){_0x36add6=_0x375bef[_0x46cb('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x46cb('0x5')](_0x375bef)){_0x36add6=_0x375bef['map'](function(_0x1a3fe4){return safeTemplate(_0x1a3fe4);});}else if(_['isPlainObject'](_0x375bef)){_0x36add6=Object[_0x46cb('0x6')](_0x375bef)['reduce'](function(_0x11262d,_0x148d0f){_0x11262d[_0x148d0f]=safeTemplate(_0x375bef[_0x148d0f]);return _0x11262d;},{});}return _0x36add6;}module[_0x46cb('0x7')][_0x46cb('0x8')]=safeTemplate; \ No newline at end of file